diff --git a/README.md b/README.md index 980fc6b2..4a771895 100644 --- a/README.md +++ b/README.md @@ -6,133 +6,15 @@ [paypal-badge]: https://img.shields.io/badge/Paypal-Donate!-%2300457C.svg?logo=paypal&style=flat-square [paypal-link]: https://paypal.me/ZackRauen -BandagedBD (Bandaged BetterDiscord) is a fork of the original [BetterDiscord](https://github.com/Jiiks/BetterDiscordApp) by Jiiks. This has a number of improvements over the original which is currently undergoing a full rewrite. In the interim, the current version has been unmaintained hence this fork existing. I will continue to maintain this fork until BDv2 comes out. I am helping to develop BDv2 as well so as release gets closer this fork will become less and less active. +This branch is for the ongoing rewrite of BandagedBD. You can view what I believe to be left in the TODO.md file. -# Installation +# Testing -### Windows -Grab the `exe` file from the latest release on the [releases page](https://github.com/rauenzi/BetterDiscordApp/releases). +The following steps tell you how you can currently test the state of the rewrite as of September 26th 2019. -### macOS/OS X -Grab the `zip` file from the latest release on the [releases page](https://github.com/rauenzi/BetterDiscordApp/releases). - -### Linux -See this link: https://gist.github.com/ObserverOfTime/d7e60eb9aa7fe837545c8cb77cf31172 - -# FAQ - -### What is this? - -This is a client modification for Discord. You can read more about it in the [original repo](https://github.com/Jiiks/BetterDiscordApp). - -### Where can I get plugins and themes? - -In our suport servers we have channels with lists of official plugins and themes. Please note we do not have an official listing on a website and are **not affiliated with any of those websites**. - -### Support Servers? - -Yup we have two of them [this one](https://discord.gg/0Tmfo5ZbORCRqbAd) and [this one](https://discord.gg/2HScm8j) - - - - -# Supporters - -These people have all subscribed to the `True Supporter` tier on Patreon to support BandagedBD. - - - - - - -
-Kraken
-Kraken
-
- - -# Bandagers - -These people have all subscribed to the `Bandager` tier on Patreon to support BandagedBD. - - - - - - -
- Kraken
- William JCM -
- -# Donors - -These people have either donated or subscribed to the most basic patron tier to support BandagedBD. - - - - - - - - - -
-
- aetheryx -
-
- JBeauDee -
-
- vantiss -
-
- xstefen -
-
- 『Sorey』 -
\ No newline at end of file +1. locate your BD installation. For Windows it is usually in `%localappdata%\Discord\app-0.0.305\resources\app\betterdiscord`. +2. Open config.json in a text editor (n++, notepad, etc). +3. Change the line `"branch": "master",` to `"branch": "development",`. +4. (optional) Change `"minified": false,` to `"minified": true,` to stay on the bleeding edge (sometimes I forget to update the minified version). +5. Fully restart your Discord client. +6. You can verify it worked by seeing the revamped plugins and themes pages as well as custom css. You can also see if the version in settings is 1.0.0+ \ No newline at end of file diff --git a/TODO.md b/TODO.md new file mode 100644 index 00000000..43dd3a00 --- /dev/null +++ b/TODO.md @@ -0,0 +1,37 @@ +# To-Do List + +This list only reflects the items that have needed to be done since June 2019, there was a lot of progress/change before this point. + +Note: The items listed here are not in any sort of priority order. + +### In Progress +- Redo emotemenu +- Remove all jquery usage + +### To Dummy/Crash Proof +- PublicServers react +- Floating window + +### To Complete +- Move old utilities to BdApi +- Component patcher (also does additional classes, etc) +- Plugin Class +- New Plugin API +- Require patch +- Backwards compatibility module (with deprecation notices) + - Modify old monkeyPatch to really use Patcher +- Repo browser +- Addon update system +- PublicServer button patch +- Redo devmode +- Rewrite emote auto caps + +### Potential Ideas +- Rearchitect to not use remote files +- Modify CSP rather than entirely remove + +### Done +- PublicServers React Rewrite +- Rewrite plugin/theme cards +- Addon list controls +- Use an actual patcher and not monkeyPatch \ No newline at end of file diff --git a/js/main.js b/js/main.js index 67eee0b1..5e88d26a 100644 --- a/js/main.js +++ b/js/main.js @@ -275,7 +275,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _str /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony default export */ __webpack_exports__[\"default\"] = ({\n local: false,\n localServer: \"//localhost:8080\",\n minified: true,\n version: \"0.3.0\",\n branch: \"master\",\n repo: \"rauenzi\",\n minSupportedVersion: \"0.3.0\",\n bbdVersion: \"0.2.17\"\n});//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly9Db3JlLy4vc3JjL2RhdGEvY29uZmlnLmpzPzRiYWEiXSwibmFtZXMiOlsibG9jYWwiLCJsb2NhbFNlcnZlciIsIm1pbmlmaWVkIiwidmVyc2lvbiIsImJyYW5jaCIsInJlcG8iLCJtaW5TdXBwb3J0ZWRWZXJzaW9uIiwiYmJkVmVyc2lvbiJdLCJtYXBwaW5ncyI6IkFBQUE7QUFBZTtBQUNYQSxPQUFLLEVBQUUsS0FESTtBQUVYQyxhQUFXLEVBQUUsa0JBRkY7QUFHWEMsVUFBUSxFQUFFLElBSEM7QUFJWEMsU0FBTyxFQUFFLE9BSkU7QUFLWEMsUUFBTSxFQUFFLFFBTEc7QUFNWEMsTUFBSSxFQUFFLFNBTks7QUFPWEMscUJBQW1CLEVBQUUsT0FQVjtBQVFYQyxZQUFVLEVBQUU7QUFSRCxDQUFmIiwiZmlsZSI6Ii4vc3JjL2RhdGEvY29uZmlnLmpzLmpzIiwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0IGRlZmF1bHQge1xyXG4gICAgbG9jYWw6IGZhbHNlLFxyXG4gICAgbG9jYWxTZXJ2ZXI6IFwiLy9sb2NhbGhvc3Q6ODA4MFwiLFxyXG4gICAgbWluaWZpZWQ6IHRydWUsXHJcbiAgICB2ZXJzaW9uOiBcIjAuMy4wXCIsXHJcbiAgICBicmFuY2g6IFwibWFzdGVyXCIsXHJcbiAgICByZXBvOiBcInJhdWVuemlcIixcclxuICAgIG1pblN1cHBvcnRlZFZlcnNpb246IFwiMC4zLjBcIixcclxuICAgIGJiZFZlcnNpb246IFwiMC4yLjE3XCJcclxufTsiXSwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///./src/data/config.js\n"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony default export */ __webpack_exports__[\"default\"] = ({\n local: false,\n localServer: \"//localhost:8080\",\n minified: true,\n version: \"0.3.0\",\n branch: \"master\",\n repo: \"rauenzi\",\n minSupportedVersion: \"0.3.0\",\n bbdVersion: \"1.0.0\"\n});//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly9Db3JlLy4vc3JjL2RhdGEvY29uZmlnLmpzPzRiYWEiXSwibmFtZXMiOlsibG9jYWwiLCJsb2NhbFNlcnZlciIsIm1pbmlmaWVkIiwidmVyc2lvbiIsImJyYW5jaCIsInJlcG8iLCJtaW5TdXBwb3J0ZWRWZXJzaW9uIiwiYmJkVmVyc2lvbiJdLCJtYXBwaW5ncyI6IkFBQUE7QUFBZTtBQUNYQSxPQUFLLEVBQUUsS0FESTtBQUVYQyxhQUFXLEVBQUUsa0JBRkY7QUFHWEMsVUFBUSxFQUFFLElBSEM7QUFJWEMsU0FBTyxFQUFFLE9BSkU7QUFLWEMsUUFBTSxFQUFFLFFBTEc7QUFNWEMsTUFBSSxFQUFFLFNBTks7QUFPWEMscUJBQW1CLEVBQUUsT0FQVjtBQVFYQyxZQUFVLEVBQUU7QUFSRCxDQUFmIiwiZmlsZSI6Ii4vc3JjL2RhdGEvY29uZmlnLmpzLmpzIiwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0IGRlZmF1bHQge1xyXG4gICAgbG9jYWw6IGZhbHNlLFxyXG4gICAgbG9jYWxTZXJ2ZXI6IFwiLy9sb2NhbGhvc3Q6ODA4MFwiLFxyXG4gICAgbWluaWZpZWQ6IHRydWUsXHJcbiAgICB2ZXJzaW9uOiBcIjAuMy4wXCIsXHJcbiAgICBicmFuY2g6IFwibWFzdGVyXCIsXHJcbiAgICByZXBvOiBcInJhdWVuemlcIixcclxuICAgIG1pblN1cHBvcnRlZFZlcnNpb246IFwiMC4zLjBcIixcclxuICAgIGJiZFZlcnNpb246IFwiMS4wLjBcIlxyXG59OyJdLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///./src/data/config.js\n"); /***/ }), @@ -479,7 +479,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) * /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _utilities__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./utilities */ \"./src/modules/utilities.js\");\n/* harmony import */ var _webpackmodules__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./webpackmodules */ \"./src/modules/webpackmodules.js\");\n/* harmony import */ var _discordmodules__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./discordmodules */ \"./src/modules/discordmodules.js\");\n/* harmony import */ var _datastore__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./datastore */ \"./src/modules/datastore.js\");\n/* harmony import */ var _dommanager__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./dommanager */ \"./src/modules/dommanager.js\");\n/* harmony import */ var _ui_toasts__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../ui/toasts */ \"./src/ui/toasts.js\");\n/* harmony import */ var _ui_modals__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../ui/modals */ \"./src/ui/modals.js\");\n\n\n\n\n\n\n\nconst BdApi = {\n get React() {\n return _discordmodules__WEBPACK_IMPORTED_MODULE_2__[\"default\"].React;\n },\n\n get ReactDOM() {\n return _discordmodules__WEBPACK_IMPORTED_MODULE_2__[\"default\"].ReactDOM;\n },\n\n get WindowConfigFile() {\n if (this._windowConfigFile) return this._windowConfigFile;\n\n const electron = __webpack_require__(/*! electron */ \"electron\").remote.app;\n\n const path = __webpack_require__(/*! path */ \"path\");\n\n const base = electron.getAppPath();\n const roamingBase = electron.getPath(\"userData\");\n const roamingLocation = path.resolve(roamingBase, electron.getVersion(), \"modules\", \"discord_desktop_core\", \"injector\", \"config.json\");\n const location = path.resolve(base, \"..\", \"app\", \"config.json\");\n\n const fs = __webpack_require__(/*! fs */ \"fs\");\n\n const realLocation = fs.existsSync(location) ? location : fs.existsSync(roamingLocation) ? roamingLocation : null;\n if (!realLocation) return this._windowConfigFile = null;\n return this._windowConfigFile = realLocation;\n }\n\n};\n\nBdApi.getAllWindowPreferences = function () {\n if (!this.WindowConfigFile) return {};\n return require(this.WindowConfigFile);\n};\n\nBdApi.getWindowPreference = function (key) {\n if (!this.WindowConfigFile) return undefined;\n return this.getAllWindowPreferences()[key];\n};\n\nBdApi.setWindowPreference = function (key, value) {\n if (!this.WindowConfigFile) return;\n\n const fs = __webpack_require__(/*! fs */ \"fs\");\n\n const prefs = this.getAllWindowPreferences();\n prefs[key] = value;\n delete __webpack_require__.c[this.WindowConfigFile];\n fs.writeFileSync(this.WindowConfigFile, JSON.stringify(prefs, null, 4));\n}; //Inject CSS to document head\n//id = id of element\n//css = custom css\n\n\nBdApi.injectCSS = function (id, css) {\n _dommanager__WEBPACK_IMPORTED_MODULE_4__[\"default\"].injectStyle(id, css);\n}; //Clear css/remove any element\n//id = id of element\n\n\nBdApi.clearCSS = function (id) {\n _dommanager__WEBPACK_IMPORTED_MODULE_4__[\"default\"].removeStyle(id);\n}; //Inject CSS to document head\n//id = id of element\n//css = custom css\n\n\nBdApi.linkJS = function (id, url) {\n return _dommanager__WEBPACK_IMPORTED_MODULE_4__[\"default\"].injectScript(id, url);\n}; //Clear css/remove any element\n//id = id of element\n\n\nBdApi.unlinkJS = function (id) {\n _dommanager__WEBPACK_IMPORTED_MODULE_4__[\"default\"].removeScript(id);\n};\n/**\r\n * Shows a generic but very customizable modal.\r\n * @param {string} title - title of the modal\r\n * @param {string} content - a string of text to display in the modal\r\n */\n\n\nBdApi.alert = function (title, content) {\n _ui_modals__WEBPACK_IMPORTED_MODULE_6__[\"default\"].alert(title, content);\n};\n/**\r\n * Shows a generic but very customizable confirmation modal with optional confirm and cancel callbacks.\r\n * @param {string} title - title of the modal\r\n * @param {(string|ReactElement|Array)} children - a single or mixed array of react elements and strings. Everything is wrapped in Discord's `TextElement` component so strings will show and render properly.\r\n * @param {object} [options] - options to modify the modal\r\n * @param {boolean} [options.danger=false] - whether the main button should be red or not\r\n * @param {string} [options.confirmText=Okay] - text for the confirmation/submit button\r\n * @param {string} [options.cancelText=Cancel] - text for the cancel button\r\n * @param {callable} [options.onConfirm=NOOP] - callback to occur when clicking the submit button\r\n * @param {callable} [options.onCancel=NOOP] - callback to occur when clicking the cancel button\r\n */\n\n\nBdApi.showConfirmationModal = function (title, content, options = {}) {\n return _ui_modals__WEBPACK_IMPORTED_MODULE_6__[\"default\"].showConfirmationModal(title, content, options);\n};\n/**\r\n * This shows a toast similar to android towards the bottom of the screen.\r\n *\r\n * @param {string} content The string to show in the toast.\r\n * @param {object} options Options object. Optional parameter.\r\n * @param {string} [options.type=\"\"] Changes the type of the toast stylistically and semantically. Choices: \"\", \"info\", \"success\", \"danger\"/\"error\", \"warning\"/\"warn\". Default: \"\"\r\n * @param {boolean} [options.icon=true] Determines whether the icon should show corresponding to the type. A toast without type will always have no icon. Default: true\r\n * @param {number} [options.timeout=3000] Adjusts the time (in ms) the toast should be shown for before disappearing automatically. Default: 3000\r\n * @param {boolean} [options.forceShow=false] Whether to force showing the toast and ignore the bd setting\r\n */\n\n\nBdApi.showToast = function (content, options = {}) {\n _ui_toasts__WEBPACK_IMPORTED_MODULE_5__[\"default\"].show(content, options);\n}; // Finds module\n\n\nBdApi.findModule = function (filter) {\n return _webpackmodules__WEBPACK_IMPORTED_MODULE_1__[\"default\"].getModule(filter);\n}; // Finds module\n\n\nBdApi.findAllModules = function (filter) {\n return _webpackmodules__WEBPACK_IMPORTED_MODULE_1__[\"default\"].getModule(filter, false);\n}; // Finds module\n\n\nBdApi.findModuleByProps = function (...props) {\n return _webpackmodules__WEBPACK_IMPORTED_MODULE_1__[\"default\"].getByProps(...props);\n};\n\nBdApi.findModuleByPrototypes = function (...protos) {\n return _webpackmodules__WEBPACK_IMPORTED_MODULE_1__[\"default\"].getByPrototypes(...protos);\n};\n\nBdApi.findModuleByDisplayName = function (name) {\n return _webpackmodules__WEBPACK_IMPORTED_MODULE_1__[\"default\"].getByDisplayName(name);\n}; // Gets react instance\n\n\nBdApi.getInternalInstance = function (node) {\n if (!(node instanceof window.jQuery) && !(node instanceof Element)) return undefined;\n if (node instanceof jQuery) node = node[0];\n return _utilities__WEBPACK_IMPORTED_MODULE_0__[\"default\"].getReactInstance(node);\n}; // Gets data\n\n\nBdApi.loadData = function (pluginName, key) {\n return _datastore__WEBPACK_IMPORTED_MODULE_3__[\"default\"].getPluginData(pluginName, key);\n};\n\nBdApi.getData = BdApi.loadData; // Sets data\n\nBdApi.saveData = function (pluginName, key, data) {\n return _datastore__WEBPACK_IMPORTED_MODULE_3__[\"default\"].setPluginData(pluginName, key, data);\n};\n\nBdApi.setData = BdApi.saveData; // Deletes data\n\nBdApi.deleteData = function (pluginName, key) {\n return _datastore__WEBPACK_IMPORTED_MODULE_3__[\"default\"].deletePluginData(pluginName, key);\n}; // Patches other functions\n\n\nBdApi.monkeyPatch = function (what, methodName, options) {\n return _utilities__WEBPACK_IMPORTED_MODULE_0__[\"default\"].monkeyPatch(what, methodName, options);\n}; // Event when element is removed\n\n\nBdApi.onRemoved = function (node, callback) {\n return _utilities__WEBPACK_IMPORTED_MODULE_0__[\"default\"].onRemoved(node, callback);\n}; // Wraps function in try..catch\n\n\nBdApi.suppressErrors = function (method, message) {\n return _utilities__WEBPACK_IMPORTED_MODULE_0__[\"default\"].suppressErrors(method, message);\n}; // Tests for valid JSON\n\n\nBdApi.testJSON = function (data) {\n return _utilities__WEBPACK_IMPORTED_MODULE_0__[\"default\"].testJSON(data);\n}; //Get another plugin\n//name = name of plugin\n// BdApi.getPlugin = function (name) {\n// if (Plugins.hasOwnProperty(name)) {\n// return Plugins[name].plugin;\n// }\n// return null;\n// };\n// BdApi.isPluginEnabled = function(name) {\n// return !!PluginCookie[name];\n// };\n// BdApi.isThemeEnabled = function(name) {\n// return !!ThemeCookie[name];\n// };\n// BdApi.isSettingEnabled = function(id) {\n// return !!SettingsCookie[id];\n// };\n// Gets data\n\n\nBdApi.getBDData = function (key) {\n return _datastore__WEBPACK_IMPORTED_MODULE_3__[\"default\"].getBDData(key);\n}; // Sets data\n\n\nBdApi.setBDData = function (key, data) {\n return _datastore__WEBPACK_IMPORTED_MODULE_3__[\"default\"].setBDData(key, data);\n};\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (BdApi);//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly9Db3JlLy4vc3JjL21vZHVsZXMvcGx1Z2luYXBpLmpzPzZhOTMiXSwibmFtZXMiOlsiQmRBcGkiLCJSZWFjdCIsIkRpc2NvcmRNb2R1bGVzIiwiUmVhY3RET00iLCJXaW5kb3dDb25maWdGaWxlIiwiX3dpbmRvd0NvbmZpZ0ZpbGUiLCJlbGVjdHJvbiIsInJlcXVpcmUiLCJyZW1vdGUiLCJhcHAiLCJwYXRoIiwiYmFzZSIsImdldEFwcFBhdGgiLCJyb2FtaW5nQmFzZSIsImdldFBhdGgiLCJyb2FtaW5nTG9jYXRpb24iLCJyZXNvbHZlIiwiZ2V0VmVyc2lvbiIsImxvY2F0aW9uIiwiZnMiLCJyZWFsTG9jYXRpb24iLCJleGlzdHNTeW5jIiwiZ2V0QWxsV2luZG93UHJlZmVyZW5jZXMiLCJfX25vbl93ZWJwYWNrX3JlcXVpcmVfXyIsImdldFdpbmRvd1ByZWZlcmVuY2UiLCJrZXkiLCJ1bmRlZmluZWQiLCJzZXRXaW5kb3dQcmVmZXJlbmNlIiwidmFsdWUiLCJwcmVmcyIsIndyaXRlRmlsZVN5bmMiLCJKU09OIiwic3RyaW5naWZ5IiwiaW5qZWN0Q1NTIiwiaWQiLCJjc3MiLCJET01NYW5hZ2VyIiwiaW5qZWN0U3R5bGUiLCJjbGVhckNTUyIsInJlbW92ZVN0eWxlIiwibGlua0pTIiwidXJsIiwiaW5qZWN0U2NyaXB0IiwidW5saW5rSlMi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vLyAgICAgcmV0dXJuIG51bGw7XHJcbi8vIH07XHJcblxyXG4vLyBCZEFwaS5pc1BsdWdpbkVuYWJsZWQgPSBmdW5jdGlvbihuYW1lKSB7XHJcbi8vICAgICByZXR1cm4gISFQbHVnaW5Db29raWVbbmFtZV07XHJcbi8vIH07XHJcblxyXG4vLyBCZEFwaS5pc1RoZW1lRW5hYmxlZCA9IGZ1bmN0aW9uKG5hbWUpIHtcclxuLy8gICAgIHJldHVybiAhIVRoZW1lQ29va2llW25hbWVdO1xyXG4vLyB9O1xyXG5cclxuLy8gQmRBcGkuaXNTZXR0aW5nRW5hYmxlZCA9IGZ1bmN0aW9uKGlkKSB7XHJcbi8vICAgICByZXR1cm4gISFTZXR0aW5nc0Nvb2tpZVtpZF07XHJcbi8vIH07XHJcblxyXG4vLyBHZXRzIGRhdGFcclxuQmRBcGkuZ2V0QkREYXRhID0gZnVuY3Rpb24oa2V5KSB7XHJcbiAgICByZXR1cm4gRGF0YVN0b3JlLmdldEJERGF0YShrZXkpO1xyXG59O1xyXG5cclxuLy8gU2V0cyBkYXRhXHJcbkJkQXBpLnNldEJERGF0YSA9IGZ1bmN0aW9uKGtleSwgZGF0YSkge1xyXG4gICAgcmV0dXJuIERhdGFTdG9yZS5zZXRCRERhdGEoa2V5LCBkYXRhKTtcclxufTtcclxuXHJcbmV4cG9ydCBkZWZhdWx0IEJkQXBpOyJdLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///./src/modules/pluginapi.js\n"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _utilities__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./utilities */ \"./src/modules/utilities.js\");\n/* harmony import */ var _webpackmodules__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./webpackmodules */ \"./src/modules/webpackmodules.js\");\n/* harmony import */ var _discordmodules__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./discordmodules */ \"./src/modules/discordmodules.js\");\n/* harmony import */ var _datastore__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./datastore */ \"./src/modules/datastore.js\");\n/* harmony import */ var _dommanager__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./dommanager */ \"./src/modules/dommanager.js\");\n/* harmony import */ var _ui_toasts__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../ui/toasts */ \"./src/ui/toasts.js\");\n/* harmony import */ var _ui_modals__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../ui/modals */ \"./src/ui/modals.js\");\n/* harmony import */ var _pluginmanager__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./pluginmanager */ \"./src/modules/pluginmanager.js\");\n/* harmony import */ var _thememanager__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./thememanager */ \"./src/modules/thememanager.js\");\n\n\n\n\n\n\n\n\n\nconst BdApi = {\n get React() {\n return _discordmodules__WEBPACK_IMPORTED_MODULE_2__[\"default\"].React;\n },\n\n get ReactDOM() {\n return _discordmodules__WEBPACK_IMPORTED_MODULE_2__[\"default\"].ReactDOM;\n },\n\n get WindowConfigFile() {\n if (this._windowConfigFile) return this._windowConfigFile;\n\n const electron = __webpack_require__(/*! electron */ \"electron\").remote.app;\n\n const path = __webpack_require__(/*! path */ \"path\");\n\n const base = electron.getAppPath();\n const roamingBase = electron.getPath(\"userData\");\n const roamingLocation = path.resolve(roamingBase, electron.getVersion(), \"modules\", \"discord_desktop_core\", \"injector\", \"config.json\");\n const location = path.resolve(base, \"..\", \"app\", \"config.json\");\n\n const fs = __webpack_require__(/*! fs */ \"fs\");\n\n const realLocation = fs.existsSync(location) ? location : fs.existsSync(roamingLocation) ? roamingLocation : null;\n if (!realLocation) return this._windowConfigFile = null;\n return this._windowConfigFile = realLocation;\n }\n\n};\n\nBdApi.getAllWindowPreferences = function () {\n if (!this.WindowConfigFile) return {};\n return require(this.WindowConfigFile);\n};\n\nBdApi.getWindowPreference = function (key) {\n if (!this.WindowConfigFile) return undefined;\n return this.getAllWindowPreferences()[key];\n};\n\nBdApi.setWindowPreference = function (key, value) {\n if (!this.WindowConfigFile) return;\n\n const fs = __webpack_require__(/*! fs */ \"fs\");\n\n const prefs = this.getAllWindowPreferences();\n prefs[key] = value;\n delete __webpack_require__.c[this.WindowConfigFile];\n fs.writeFileSync(this.WindowConfigFile, JSON.stringify(prefs, null, 4));\n}; //Inject CSS to document head\n//id = id of element\n//css = custom css\n\n\nBdApi.injectCSS = function (id, css) {\n _dommanager__WEBPACK_IMPORTED_MODULE_4__[\"default\"].injectStyle(id, css);\n}; //Clear css/remove any element\n//id = id of element\n\n\nBdApi.clearCSS = function (id) {\n _dommanager__WEBPACK_IMPORTED_MODULE_4__[\"default\"].removeStyle(id);\n}; //Inject CSS to document head\n//id = id of element\n//css = custom css\n\n\nBdApi.linkJS = function (id, url) {\n return _dommanager__WEBPACK_IMPORTED_MODULE_4__[\"default\"].injectScript(id, url);\n}; //Clear css/remove any element\n//id = id of element\n\n\nBdApi.unlinkJS = function (id) {\n _dommanager__WEBPACK_IMPORTED_MODULE_4__[\"default\"].removeScript(id);\n};\n/**\r\n * Shows a generic but very customizable modal.\r\n * @param {string} title - title of the modal\r\n * @param {string} content - a string of text to display in the modal\r\n */\n\n\nBdApi.alert = function (title, content) {\n _ui_modals__WEBPACK_IMPORTED_MODULE_6__[\"default\"].alert(title, content);\n};\n/**\r\n * Shows a generic but very customizable confirmation modal with optional confirm and cancel callbacks.\r\n * @param {string} title - title of the modal\r\n * @param {(string|ReactElement|Array)} children - a single or mixed array of react elements and strings. Everything is wrapped in Discord's `TextElement` component so strings will show and render properly.\r\n * @param {object} [options] - options to modify the modal\r\n * @param {boolean} [options.danger=false] - whether the main button should be red or not\r\n * @param {string} [options.confirmText=Okay] - text for the confirmation/submit button\r\n * @param {string} [options.cancelText=Cancel] - text for the cancel button\r\n * @param {callable} [options.onConfirm=NOOP] - callback to occur when clicking the submit button\r\n * @param {callable} [options.onCancel=NOOP] - callback to occur when clicking the cancel button\r\n */\n\n\nBdApi.showConfirmationModal = function (title, content, options = {}) {\n return _ui_modals__WEBPACK_IMPORTED_MODULE_6__[\"default\"].showConfirmationModal(title, content, options);\n};\n/**\r\n * This shows a toast similar to android towards the bottom of the screen.\r\n *\r\n * @param {string} content The string to show in the toast.\r\n * @param {object} options Options object. Optional parameter.\r\n * @param {string} [options.type=\"\"] Changes the type of the toast stylistically and semantically. Choices: \"\", \"info\", \"success\", \"danger\"/\"error\", \"warning\"/\"warn\". Default: \"\"\r\n * @param {boolean} [options.icon=true] Determines whether the icon should show corresponding to the type. A toast without type will always have no icon. Default: true\r\n * @param {number} [options.timeout=3000] Adjusts the time (in ms) the toast should be shown for before disappearing automatically. Default: 3000\r\n * @param {boolean} [options.forceShow=false] Whether to force showing the toast and ignore the bd setting\r\n */\n\n\nBdApi.showToast = function (content, options = {}) {\n _ui_toasts__WEBPACK_IMPORTED_MODULE_5__[\"default\"].show(content, options);\n}; // Finds module\n\n\nBdApi.findModule = function (filter) {\n return _webpackmodules__WEBPACK_IMPORTED_MODULE_1__[\"default\"].getModule(filter);\n}; // Finds module\n\n\nBdApi.findAllModules = function (filter) {\n return _webpackmodules__WEBPACK_IMPORTED_MODULE_1__[\"default\"].getModule(filter, false);\n}; // Finds module\n\n\nBdApi.findModuleByProps = function (...props) {\n return _webpackmodules__WEBPACK_IMPORTED_MODULE_1__[\"default\"].getByProps(...props);\n};\n\nBdApi.findModuleByPrototypes = function (...protos) {\n return _webpackmodules__WEBPACK_IMPORTED_MODULE_1__[\"default\"].getByPrototypes(...protos);\n};\n\nBdApi.findModuleByDisplayName = function (name) {\n return _webpackmodules__WEBPACK_IMPORTED_MODULE_1__[\"default\"].getByDisplayName(name);\n}; // Gets react instance\n\n\nBdApi.getInternalInstance = function (node) {\n if (!(node instanceof window.jQuery) && !(node instanceof Element)) return undefined;\n if (node instanceof jQuery) node = node[0];\n return _utilities__WEBPACK_IMPORTED_MODULE_0__[\"default\"].getReactInstance(node);\n}; // Gets data\n\n\nBdApi.loadData = function (pluginName, key) {\n return _datastore__WEBPACK_IMPORTED_MODULE_3__[\"default\"].getPluginData(pluginName, key);\n};\n\nBdApi.getData = BdApi.loadData; // Sets data\n\nBdApi.saveData = function (pluginName, key, data) {\n return _datastore__WEBPACK_IMPORTED_MODULE_3__[\"default\"].setPluginData(pluginName, key, data);\n};\n\nBdApi.setData = BdApi.saveData; // Deletes data\n\nBdApi.deleteData = function (pluginName, key) {\n return _datastore__WEBPACK_IMPORTED_MODULE_3__[\"default\"].deletePluginData(pluginName, key);\n}; // Patches other functions\n\n\nBdApi.monkeyPatch = function (what, methodName, options) {\n const {\n before,\n after,\n instead,\n once = false,\n silent = false,\n force = false\n } = options;\n const displayName = options.displayName || what.displayName || what.name || what.constructor.displayName || what.constructor.name;\n if (!silent) console.log(\"patch\", methodName, \"of\", displayName); // eslint-disable-line no-console\n\n if (!what[methodName]) {\n if (force) what[methodName] = function () {};else return console.error(methodName, \"does not exist for\", displayName); // eslint-disable-line no-console\n }\n\n const origMethod = what[methodName];\n\n const cancel = () => {\n if (!silent) console.log(\"unpatch\", methodName, \"of\", displayName); // eslint-disable-line no-console\n\n what[methodName] = origMethod;\n };\n\n what[methodName] = function () {\n const data = {\n thisObject: this,\n methodArguments: arguments,\n cancelPatch: cancel,\n originalMethod: origMethod,\n callOriginalMethod: () => data.returnValue = data.originalMethod.apply(data.thisObject, data.methodArguments)\n };\n\n if (instead) {\n const tempRet = _utilities__WEBPACK_IMPORTED_MODULE_0__[\"default\"].suppressErrors(instead, \"`instead` callback of \" + what[methodName].displayName)(data);\n if (tempRet !== undefined) data.returnValue = tempRet;\n } else {\n if (before) _utilities__WEBPACK_IMPORTED_MODULE_0__[\"default\"].suppressErrors(before, \"`before` callback of \" + what[methodName].displayName)(data);\n data.callOriginalMethod();\n if (after) _utilities__WEBPACK_IMPORTED_MODULE_0__[\"default\"].suppressErrors(after, \"`after` callback of \" + what[methodName].displayName)(data);\n }\n\n if (once) cancel();\n return data.returnValue;\n };\n\n what[methodName].__monkeyPatched = true;\n if (!what[methodName].__originalMethod) what[methodName].__originalMethod = origMethod;\n what[methodName].displayName = \"patched \" + (what[methodName].displayName || methodName);\n return cancel;\n}; // Event when element is removed\n\n\nBdApi.onRemoved = function (node, callback) {\n return _utilities__WEBPACK_IMPORTED_MODULE_0__[\"default\"].onRemoved(node, callback);\n}; // Wraps function in try..catch\n\n\nBdApi.suppressErrors = function (method, message) {\n return _utilities__WEBPACK_IMPORTED_MODULE_0__[\"default\"].suppressErrors(method, message);\n}; // Tests for valid JSON\n\n\nBdApi.testJSON = function (data) {\n return _utilities__WEBPACK_IMPORTED_MODULE_0__[\"default\"].testJSON(data);\n}; //Get another plugin\n//name = name of plugin\n\n\nBdApi.getPlugin = function (name) {\n return _pluginmanager__WEBPACK_IMPORTED_MODULE_7__[\"default\"].addonList.find(a => a.name == name);\n};\n\nBdApi.isPluginEnabled = function (name) {\n const plugin = this.getPlugin(name);\n if (!plugin) return false;\n return _pluginmanager__WEBPACK_IMPORTED_MODULE_7__[\"default\"].isEnabled(plugin.id);\n};\n\nBdApi.isThemeEnabled = function (name) {\n const theme = _thememanager__WEBPACK_IMPORTED_MODULE_8__[\"default\"].addonList.find(a => a.name == name);\n if (!theme) return false;\n return _thememanager__WEBPACK_IMPORTED_MODULE_8__[\"default\"].isEnabled(theme.id);\n}; // Gets data\n\n\nBdApi.getBDData = function (key) {\n return _datastore__WEBPACK_IMPORTED_MODULE_3__[\"default\"].getBDData(key);\n}; // Sets data\n\n\nBdApi.setBDData = function (key, data) {\n return _datastore__WEBPACK_IMPORTED_MODULE_3__[\"default\"].setBDData(key, data);\n};\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (BdApi);//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly9Db3JlLy4vc3JjL21vZHVs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HVnaW4pIHJldHVybiBmYWxzZTtcclxuICAgIHJldHVybiBQbHVnaW5NYW5hZ2VyLmlzRW5hYmxlZChwbHVnaW4uaWQpO1xyXG59O1xyXG5cclxuQmRBcGkuaXNUaGVtZUVuYWJsZWQgPSBmdW5jdGlvbihuYW1lKSB7XHJcbiAgICBjb25zdCB0aGVtZSA9IFRoZW1lTWFuYWdlci5hZGRvbkxpc3QuZmluZChhID0+IGEubmFtZSA9PSBuYW1lKTtcclxuICAgIGlmICghdGhlbWUpIHJldHVybiBmYWxzZTtcclxuICAgIHJldHVybiBUaGVtZU1hbmFnZXIuaXNFbmFibGVkKHRoZW1lLmlkKTtcclxufTtcclxuXHJcbi8vIEdldHMgZGF0YVxyXG5CZEFwaS5nZXRCRERhdGEgPSBmdW5jdGlvbihrZXkpIHtcclxuICAgIHJldHVybiBEYXRhU3RvcmUuZ2V0QkREYXRhKGtleSk7XHJcbn07XHJcblxyXG4vLyBTZXRzIGRhdGFcclxuQmRBcGkuc2V0QkREYXRhID0gZnVuY3Rpb24oa2V5LCBkYXRhKSB7XHJcbiAgICByZXR1cm4gRGF0YVN0b3JlLnNldEJERGF0YShrZXksIGRhdGEpO1xyXG59O1xyXG5cclxuZXhwb3J0IGRlZmF1bHQgQmRBcGk7Il0sInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///./src/modules/pluginapi.js\n"); /***/ }), @@ -551,7 +551,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var data /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"default\", function() { return Utilities; });\n/* harmony import */ var data__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! data */ \"./src/data/data.js\");\n/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./logger */ \"./src/modules/logger.js\");\n\n\nclass Utilities {\n static repoUrl(path) {\n return `https://cdn.staticaly.com/gh/${data__WEBPACK_IMPORTED_MODULE_0__[\"Config\"].repo}/BetterDiscordApp/${data__WEBPACK_IMPORTED_MODULE_0__[\"Config\"].hash}/${path}`;\n }\n /**\r\n * Parses a string of HTML and returns the results. If the second parameter is true,\r\n * the parsed HTML will be returned as a document fragment {@see https://developer.mozilla.org/en-US/docs/Web/API/DocumentFragment}.\r\n * This is extremely useful if you have a list of elements at the top level, they can then be appended all at once to another node.\r\n *\r\n * If the second parameter is false, then the return value will be the list of parsed\r\n * nodes and there were multiple top level nodes, otherwise the single node is returned.\r\n * @param {string} html - HTML to be parsed\r\n * @param {boolean} [fragment=false] - Whether or not the return should be the raw `DocumentFragment`\r\n * @returns {(DocumentFragment|NodeList|HTMLElement)} - The result of HTML parsing\r\n */\n\n\n static parseHTML(html, fragment = false) {\n const template = document.createElement(\"template\");\n template.innerHTML = html;\n const node = template.content.cloneNode(true);\n if (fragment) return node;\n return node.childNodes.length > 1 ? node.childNodes : node.childNodes[0];\n }\n\n static getTextArea() {\n return $(\".channelTextArea-1LDbYG textarea\");\n }\n\n static insertText(textarea, text) {\n textarea.focus();\n textarea.selectionStart = 0;\n textarea.selectionEnd = textarea.value.length;\n document.execCommand(\"insertText\", false, text);\n }\n\n static escape(s) {\n return s.replace(/[-/\\\\^$*+?.()|[\\]{}]/g, \"\\\\$&\");\n }\n\n static testJSON(data) {\n try {\n return JSON.parse(data);\n } catch (err) {\n return false;\n }\n }\n\n static suppressErrors(method, message) {\n return (...params) => {\n try {\n return method(...params);\n } catch (e) {\n _logger__WEBPACK_IMPORTED_MODULE_1__[\"default\"].stacktrace(\"SuppressedError\", \"Error occurred in \" + message, e);\n }\n };\n }\n\n static monkeyPatch(what, methodName, options) {\n const {\n before,\n after,\n instead,\n once = false,\n silent = false,\n force = false\n } = options;\n const displayName = options.displayName || what.displayName || what.name || what.constructor.displayName || what.constructor.name;\n if (!silent) console.log(\"patch\", methodName, \"of\", displayName); // eslint-disable-line no-console\n\n if (!what[methodName]) {\n if (force) what[methodName] = function () {};else return console.error(methodName, \"does not exist for\", displayName); // eslint-disable-line no-console\n }\n\n const origMethod = what[methodName];\n\n const cancel = () => {\n if (!silent) console.log(\"unpatch\", methodName, \"of\", displayName); // eslint-disable-line no-console\n\n what[methodName] = origMethod;\n };\n\n what[methodName] = function () {\n const data = {\n thisObject: this,\n methodArguments: arguments,\n cancelPatch: cancel,\n originalMethod: origMethod,\n callOriginalMethod: () => data.returnValue = data.originalMethod.apply(data.thisObject, data.methodArguments)\n };\n\n if (instead) {\n const tempRet = Utilities.suppressErrors(instead, \"`instead` callback of \" + what[methodName].displayName)(data);\n if (tempRet !== undefined) data.returnValue = tempRet;\n } else {\n if (before) Utilities.suppressErrors(before, \"`before` callback of \" + what[methodName].displayName)(data);\n data.callOriginalMethod();\n if (after) Utilities.suppressErrors(after, \"`after` callback of \" + what[methodName].displayName)(data);\n }\n\n if (once) cancel();\n return data.returnValue;\n };\n\n what[methodName].__monkeyPatched = true;\n if (!what[methodName].__originalMethod) what[methodName].__originalMethod = origMethod;\n what[methodName].displayName = \"patched \" + (what[methodName].displayName || methodName);\n return cancel;\n }\n\n static onRemoved(node, callback) {\n const observer = new MutationObserver(mutations => {\n for (let m = 0; m < mutations.length; m++) {\n const mutation = mutations[m];\n const nodes = Array.from(mutation.removedNodes);\n const directMatch = nodes.indexOf(node) > -1;\n const parentMatch = nodes.some(parent => parent.contains(node));\n\n if (directMatch || parentMatch) {\n observer.disconnect();\n callback();\n }\n }\n });\n observer.observe(document.body, {\n subtree: true,\n childList: true\n });\n }\n\n static isEmpty(obj) {\n if (obj == null || obj == undefined || obj == \"\") return true;\n if (typeof obj !== \"object\") return false;\n if (Array.isArray(obj)) return obj.length == 0;\n\n for (const key in obj) {\n if (obj.hasOwnProperty(key)) return false;\n }\n\n return true;\n }\n /**\r\n * Generates an automatically memoizing version of an object.\r\n * @author Zerebos\r\n * @param {Object} object - object to memoize\r\n * @returns {Proxy} the proxy to the object that memoizes properties\r\n */\n\n\n static memoizeObject(object) {\n const proxy = new Proxy(object, {\n get: function (obj, mod) {\n if (!obj.hasOwnProperty(mod)) return undefined;\n\n if (Object.getOwnPropertyDescriptor(obj, mod).get) {\n const value = obj[mod];\n delete obj[mod];\n obj[mod] = value;\n }\n\n return obj[mod];\n },\n set: function (obj, mod, value) {\n if (obj.hasOwnProperty(mod)) return _logger__WEBPACK_IMPORTED_MODULE_1__[\"default\"].error(\"MemoizedObject\", \"Trying to overwrite existing property\");\n obj[mod] = value;\n return obj[mod];\n }\n });\n Object.defineProperty(proxy, \"hasOwnProperty\", {\n value: function (prop) {\n return this[prop] !== undefined;\n }\n });\n return proxy;\n }\n /**\r\n * Deep extends an object with a set of other objects. Objects later in the list\r\n * of `extenders` have priority, that is to say if one sets a key to be a primitive,\r\n * it will be overwritten with the next one with the same key. If it is an object,\r\n * and the keys match, the object is extended. This happens recursively.\r\n * @param {object} extendee - Object to be extended\r\n * @param {...object} extenders - Objects to extend with\r\n * @returns {object} - A reference to `extendee`\r\n */\n\n\n static extend(extendee, ...extenders) {\n for (let i = 0; i < extenders.length; i++) {\n for (const key in extenders[i]) {\n if (extenders[i].hasOwnProperty(key)) {\n if (typeof extendee[key] === \"object\" && typeof extenders[i][key] === \"object\") this.extend(extendee[key], extenders[i][key]);else if (typeof extenders[i][key] === \"object\") extendee[key] = {}, this.extend(extendee[key], extenders[i][key]);else extendee[key] = extenders[i][key];\n }\n }\n }\n\n return extendee;\n }\n /**\r\n * Format strings with placeholders (`{{placeholder}}`) into full strings.\r\n * Quick example: `PluginUtilities.formatString(\"Hello, {{user}}\", {user: \"Zerebos\"})`\r\n * would return \"Hello, Zerebos\".\r\n * @param {string} string - string to format\r\n * @param {object} values - object literal of placeholders to replacements\r\n * @returns {string} the properly formatted string\r\n */\n\n\n static formatString(string, values) {\n for (const val in values) {\n let replacement = values[val];\n if (Array.isArray(replacement)) replacement = JSON.stringify(replacement);\n if (typeof replacement === \"object\" && replacement !== null) replacement = replacement.toString();\n string = string.replace(new RegExp(`{{${val}}}`, \"g\"), replacement);\n }\n\n return string;\n }\n /**\r\n * Finds a value, subobject, or array from a tree that matches a specific filter.\r\n * @param {object} tree Tree that should be walked\r\n * @param {callable} searchFilter Filter to check against each object and subobject\r\n * @param {object} options Additional options to customize the search\r\n * @param {Array|null} [options.walkable=null] Array of strings to use as keys that are allowed to be walked on. Null value indicates all keys are walkable\r\n * @param {Array} [options.ignore=[]] Array of strings to use as keys to exclude from the search, most helpful when `walkable = null`.\r\n */\n\n\n static findInTree(tree, searchFilter, {\n walkable = null,\n ignore = []\n } = {}) {\n if (typeof searchFilter === \"string\") {\n if (tree.hasOwnProperty(searchFilter)) return tree[searchFilter];\n } else if (searchFilter(tree)) {\n return tree;\n }\n\n if (typeof tree !== \"object\" || tree == null) return undefined;\n let tempReturn = undefined;\n\n if (tree instanceof Array) {\n for (const value of tree) {\n tempReturn = this.findInTree(value, searchFilter, {\n walkable,\n ignore\n });\n if (typeof tempReturn != \"undefined\") return tempReturn;\n }\n } else {\n const toWalk = walkable == null ? Object.keys(tree) : walkable;\n\n for (const key of toWalk) {\n if (typeof tree[key] == \"undefined\" || ignore.includes(key)) continue;\n tempReturn = this.findInTree(tree[key], searchFilter, {\n walkable,\n ignore\n });\n if (typeof tempReturn != \"undefined\") return tempReturn;\n }\n }\n\n return tempReturn;\n }\n /**\r\n * Gets a nested property (if it exists) safely. Path should be something like `prop.prop2.prop3`.\r\n * Numbers can be used for arrays as well like `prop.prop2.array.0.id`.\r\n * @param {Object} obj - object to get nested property of\r\n * @param {string} path - representation of the property to obtain\r\n */\n\n\n static getNestedProp(obj, path) {\n return path.split(/\\s?\\.\\s?/).reduce(function (currentObj, prop) {\n return currentObj && currentObj[prop];\n }, obj);\n }\n /**\r\n * Finds a value, subobject, or array from a tree that matches a specific filter. Great for patching render functions.\r\n * @param {object} tree React tree to look through. Can be a rendered object or an internal instance.\r\n * @param {callable} searchFilter Filter function to check subobjects against.\r\n */\n\n\n static findInRenderTree(tree, searchFilter, {\n walkable = [\"props\", \"children\", \"child\", \"sibling\"],\n ignore = []\n } = {}) {\n return this.findInTree(tree, searchFilter, {\n walkable,\n ignore\n });\n }\n /**\r\n * Finds a value, subobject, or array from a tree that matches a specific filter. Great for patching render functions.\r\n * @param {object} tree React tree to look through. Can be a rendered object or an internal instance.\r\n * @param {callable} searchFilter Filter function to check subobjects against.\r\n */\n\n\n static findInReactTree(tree, searchFilter) {\n return this.findInTree(tree, searchFilter, {\n walkable: [\"props\", \"children\", \"return\", \"stateNode\"]\n });\n }\n\n static getReactInstance(node) {\n if (node.__reactInternalInstance$) return node.__reactInternalInstance$;\n return node[Object.keys(node).find(k => k.startsWith(\"__reactInternalInstance\"))] || null;\n }\n /**\r\n * Grabs a value from the react internal instance. Allows you to grab\r\n * long depth values safely without accessing no longer valid properties.\r\n * @param {HTMLElement} node - node to obtain react instance of\r\n * @param {object} options - options for the search\r\n * @param {array} [options.include] - list of items to include from the search\r\n * @param {array} [options.exclude=[\"Popout\", \"Tooltip\", \"Scroller\", \"BackgroundFlash\"]] - list of items to exclude from the search\r\n * @param {callable} [options.filter=_=>_] - filter to check the current instance with (should return a boolean)\r\n * @return {(*|null)} the owner instance or undefined if not found.\r\n */\n\n\n static getOwnerInstance(node, {\n include,\n exclude = [\"Popout\", \"Tooltip\", \"Scroller\", \"BackgroundFlash\"],\n filter = _ => _\n } = {}) {\n if (node === undefined) return undefined;\n const excluding = include === undefined;\n const nameFilter = excluding ? exclude : include;\n\n function getDisplayName(owner) {\n const type = owner.type;\n if (!type) return null;\n return type.displayName || type.name || null;\n }\n\n function classFilter(owner) {\n const name = getDisplayName(owner);\n return name !== null && !!(nameFilter.includes(name) ^ excluding);\n }\n\n let curr = this.getReactInstance(node);\n\n for (curr = curr && curr.return; curr !== null; curr = curr.return) {\n if (curr === null) continue;\n const owner = curr.stateNode;\n if (curr !== null && !(owner instanceof HTMLElement) && classFilter(curr) && filter(owner)) return owner;\n }\n\n return null;\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F0Y2ggfHwgcGFyZW50TWF0Y2gpIHtcclxuICAgICAgICAgICAgICAgICAgICBvYnNlcnZlci5kaXNjb25uZWN0KCk7XHJcbiAgICAgICAgICAgICAgICAgICAgY2FsbGJhY2soKTtcclxuICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgfVxyXG4gICAgICAgIH0pO1xyXG5cclxuICAgICAgICBvYnNlcnZlci5vYnNlcnZlKGRvY3VtZW50LmJvZHksIHtzdWJ0cmVlOiB0cnVlLCBjaGlsZExpc3Q6IHRydWV9KTtcclxuICAgIH1cclxuXHJcbiAgICBzdGF0aWMgaXNFbXB0eShvYmopIHtcclxuICAgICAgICBpZiAob2JqID09IG51bGwgfHwgb2JqID09IHVuZGVmaW5lZCB8fCBvYmogPT0gXCJcIikgcmV0dXJuIHRydWU7XHJcbiAgICAgICAgaWYgKHR5cGVvZihvYmopICE9PSBcIm9iamVjdFwiKSByZXR1cm4gZmFsc2U7XHJcbiAgICAgICAgaWYgKEFycmF5LmlzQXJyYXkob2JqKSkgcmV0dXJuIG9iai5sZW5ndGggPT0gMDtcclxuICAgICAgICBmb3IgKGNvbnN0IGtleSBpbiBvYmopIHtcclxuICAgICAgICAgICAgaWYgKG9iai5oYXNPd25Qcm9wZXJ0eShrZXkpKSByZXR1cm4gZmFsc2U7XHJcbiAgICAgICAgfVxyXG4gICAgICAgIHJldHVybiB0cnVlO1xyXG4gICAgfVxyXG5cclxuICAgIC8qKlxyXG4gICAgICogR2VuZXJhdGVzIGFuIGF1dG9tYXRpY2FsbHkgbWVtb2l6aW5nIHZlcnNpb24gb2YgYW4gb2JqZWN0LlxyXG4gICAgICogQGF1dGhvciBaZXJlYm9zXHJcbiAgICAgKiBAcGFyYW0ge09iamVjdH0gb2JqZWN0IC0gb2JqZWN0IHRvIG1lbW9pemVcclxuICAgICAqIEByZXR1cm5zIHtQcm94eX0gdGhlIHByb3h5IHRvIHRoZSBvYmplY3QgdGhhdCBtZW1vaXplcyBwcm9wZXJ0aWVzXHJcbiAgICAgKi9cclxuICAgIHN0YXRpYyBtZW1vaXplT2JqZWN0KG9iamVjdCkge1xyXG4gICAgICAgIGNvbnN0IHByb3h5ID0gbmV3IFByb3h5KG9iamVjdCwge1xyXG4gICAgICAgICAgICBnZXQ6IGZ1bmN0aW9uKG9iaiwgbW9kKSB7XHJcbiAgICAgICAgICAgICAgICBpZiAoIW9iai5oYXNPd25Qcm9wZXJ0eShtb2QpKSByZXR1cm4gdW5kZWZpbmVkO1xyXG4gICAgICAgICAgICAgICAgaWYgKE9iamVjdC5nZXRPd25Qcm9wZXJ0eURlc2NyaXB0b3Iob2JqLCBtb2QpLmdldCkge1xyXG4gICAgICAgICAgICAgICAgICAgIGNvbnN0IHZhbHVlID0gb2JqW21vZF07XHJcbiAgICAgICAgICAgICAgICAgICAgZGVsZXRlIG9ialttb2RdO1xyXG4gICAgICAgICAgICAgICAgICAgIG9ialttb2RdID0gdmFsdWU7XHJcbiAgICAgICAgICAgICAgICB9XHJcbiAgICAgICAgICAgICAgICByZXR1cm4gb2JqW21vZF07XHJcbiAgICAgICAgICAgIH0sXHJcbiAgICAgICAgICAgIHNldDogZnVuY3Rpb24ob2JqLCBtb2QsIHZhbHVlKSB7XHJcbiAgICAgICAgICAgICAgICBpZiAob2JqLmhhc093blByb3BlcnR5KG1vZCkpIHJldHVybiBMb2dnZXIuZXJyb3IoXCJNZW1vaXplZE9iamVjdFwiLCBcIlRyeWluZyB0byBvdmVyd3JpdGUgZXhpc3RpbmcgcHJvcGVydHlcIik7XHJcbiAgICAgICAgICAgICAgICBvYmpbbW9kXSA9IHZhbHVlO1xyXG4gICAgICAgICAgICAgICAgcmV0dXJuIG9ialttb2RdO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgfSk7XHJcblxyXG4gICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eShwcm94eSwgXCJoYXNPd25Qcm9wZXJ0eVwiLCB7dmFsdWU6IGZ1bmN0aW9uKHByb3ApIHtcclxu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HRlbXBSZXR1cm4gPSB1bmRlZmluZWQ7XHJcbiAgICAgICAgaWYgKHRyZWUgaW5zdGFuY2VvZiBBcnJheSkge1xyXG4gICAgICAgICAgICBmb3IgKGNvbnN0IHZhbHVlIG9mIHRyZWUpIHtcclxuICAgICAgICAgICAgICAgIHRlbXBSZXR1cm4gPSB0aGlzLmZpbmRJblRyZWUodmFsdWUsIHNlYXJjaEZpbHRlciwge3dhbGthYmxlLCBpZ25vcmV9KTtcclxuICAgICAgICAgICAgICAgIGlmICh0eXBlb2YgdGVtcFJldHVybiAhPSBcInVuZGVmaW5lZFwiKSByZXR1cm4gdGVtcFJldHVybjtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgIH1cclxuICAgICAgICBlbHNlIHtcclxuICAgICAgICAgICAgY29uc3QgdG9XYWxrID0gd2Fsa2FibGUgPT0gbnVsbCA/IE9iamVjdC5rZXlzKHRyZWUpIDogd2Fsa2FibGU7XHJcbiAgICAgICAgICAgIGZvciAoY29uc3Qga2V5IG9mIHRvV2Fsaykge1xyXG4gICAgICAgICAgICAgICAgaWYgKHR5cGVvZih0cmVlW2tleV0pID09IFwidW5kZWZpbmVkXCIgfHwgaWdub3JlLmluY2x1ZGVzKGtleSkpIGNvbnRpbnVlO1xyXG4gICAgICAgICAgICAgICAgdGVtcFJldHVybiA9IHRoaXMuZmluZEluVHJlZSh0cmVlW2tleV0sIHNlYXJjaEZpbHRlciwge3dhbGthYmxlLCBpZ25vcmV9KTtcclxuICAgICAgICAgICAgICAgIGlmICh0eXBlb2YgdGVtcFJldHVybiAhPSBcInVuZGVmaW5lZFwiKSByZXR1cm4gdGVtcFJldHVybjtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgIH1cclxuICAgICAgICByZXR1cm4gdGVtcFJldHVybjtcclxuICAgIH1cclxuXHJcbiAgICAvKipcclxuICAgICAqIEdldHMgYSBuZXN0ZWQgcHJvcGVydHkgKGlmIGl0IGV4aXN0cykgc2FmZWx5LiBQYXRoIHNob3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IGN1cnIgJiYgY3Vyci5yZXR1cm47IGN1cnIgIT09IG51bGw7IGN1cnIgPSBjdXJyLnJldHVybikge1xyXG5cdFx0XHRpZiAoY3VyciA9PT0gbnVsbCkgY29udGludWU7XHJcblx0XHRcdGNvbnN0IG93bmVyID0gY3Vyci5zdGF0ZU5vZGU7XHJcblx0XHRcdGlmIChjdXJyICE9PSBudWxsICYmICEob3duZXIgaW5zdGFuY2VvZiBIVE1MRWxlbWVudCkgJiYgY2xhc3NGaWx0ZXIoY3VycikgJiYgZmlsdGVyKG93bmVyKSkgcmV0dXJuIG93bmVyO1xyXG5cdFx0fVxyXG5cclxuXHRcdHJldHVybiBudWxsO1xyXG5cdH1cclxufSJdLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///./src/modules/utilities.js\n"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"default\", function() { return Utilities; });\n/* harmony import */ var data__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! data */ \"./src/data/data.js\");\n/* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./logger */ \"./src/modules/logger.js\");\n\n\nclass Utilities {\n static repoUrl(path) {\n return `https://cdn.staticaly.com/gh/${data__WEBPACK_IMPORTED_MODULE_0__[\"Config\"].repo}/BetterDiscordApp/${data__WEBPACK_IMPORTED_MODULE_0__[\"Config\"].hash}/${path}`;\n }\n /**\r\n * Parses a string of HTML and returns the results. If the second parameter is true,\r\n * the parsed HTML will be returned as a document fragment {@see https://developer.mozilla.org/en-US/docs/Web/API/DocumentFragment}.\r\n * This is extremely useful if you have a list of elements at the top level, they can then be appended all at once to another node.\r\n *\r\n * If the second parameter is false, then the return value will be the list of parsed\r\n * nodes and there were multiple top level nodes, otherwise the single node is returned.\r\n * @param {string} html - HTML to be parsed\r\n * @param {boolean} [fragment=false] - Whether or not the return should be the raw `DocumentFragment`\r\n * @returns {(DocumentFragment|NodeList|HTMLElement)} - The result of HTML parsing\r\n */\n\n\n static parseHTML(html, fragment = false) {\n const template = document.createElement(\"template\");\n template.innerHTML = html;\n const node = template.content.cloneNode(true);\n if (fragment) return node;\n return node.childNodes.length > 1 ? node.childNodes : node.childNodes[0];\n }\n\n static getTextArea() {\n return $(\".channelTextArea-1LDbYG textarea\");\n }\n\n static insertText(textarea, text) {\n textarea.focus();\n textarea.selectionStart = 0;\n textarea.selectionEnd = textarea.value.length;\n document.execCommand(\"insertText\", false, text);\n }\n\n static escape(s) {\n return s.replace(/[-/\\\\^$*+?.()|[\\]{}]/g, \"\\\\$&\");\n }\n\n static testJSON(data) {\n try {\n return JSON.parse(data);\n } catch (err) {\n return false;\n }\n }\n\n static suppressErrors(method, message) {\n return (...params) => {\n try {\n return method(...params);\n } catch (e) {\n _logger__WEBPACK_IMPORTED_MODULE_1__[\"default\"].stacktrace(\"SuppressedError\", \"Error occurred in \" + message, e);\n }\n };\n }\n\n static onRemoved(node, callback) {\n const observer = new MutationObserver(mutations => {\n for (let m = 0; m < mutations.length; m++) {\n const mutation = mutations[m];\n const nodes = Array.from(mutation.removedNodes);\n const directMatch = nodes.indexOf(node) > -1;\n const parentMatch = nodes.some(parent => parent.contains(node));\n\n if (directMatch || parentMatch) {\n observer.disconnect();\n callback();\n }\n }\n });\n observer.observe(document.body, {\n subtree: true,\n childList: true\n });\n }\n\n static isEmpty(obj) {\n if (obj == null || obj == undefined || obj == \"\") return true;\n if (typeof obj !== \"object\") return false;\n if (Array.isArray(obj)) return obj.length == 0;\n\n for (const key in obj) {\n if (obj.hasOwnProperty(key)) return false;\n }\n\n return true;\n }\n /**\r\n * Generates an automatically memoizing version of an object.\r\n * @author Zerebos\r\n * @param {Object} object - object to memoize\r\n * @returns {Proxy} the proxy to the object that memoizes properties\r\n */\n\n\n static memoizeObject(object) {\n const proxy = new Proxy(object, {\n get: function (obj, mod) {\n if (!obj.hasOwnProperty(mod)) return undefined;\n\n if (Object.getOwnPropertyDescriptor(obj, mod).get) {\n const value = obj[mod];\n delete obj[mod];\n obj[mod] = value;\n }\n\n return obj[mod];\n },\n set: function (obj, mod, value) {\n if (obj.hasOwnProperty(mod)) return _logger__WEBPACK_IMPORTED_MODULE_1__[\"default\"].error(\"MemoizedObject\", \"Trying to overwrite existing property\");\n obj[mod] = value;\n return obj[mod];\n }\n });\n Object.defineProperty(proxy, \"hasOwnProperty\", {\n value: function (prop) {\n return this[prop] !== undefined;\n }\n });\n return proxy;\n }\n /**\r\n * Deep extends an object with a set of other objects. Objects later in the list\r\n * of `extenders` have priority, that is to say if one sets a key to be a primitive,\r\n * it will be overwritten with the next one with the same key. If it is an object,\r\n * and the keys match, the object is extended. This happens recursively.\r\n * @param {object} extendee - Object to be extended\r\n * @param {...object} extenders - Objects to extend with\r\n * @returns {object} - A reference to `extendee`\r\n */\n\n\n static extend(extendee, ...extenders) {\n for (let i = 0; i < extenders.length; i++) {\n for (const key in extenders[i]) {\n if (extenders[i].hasOwnProperty(key)) {\n if (typeof extendee[key] === \"object\" && typeof extenders[i][key] === \"object\") this.extend(extendee[key], extenders[i][key]);else if (typeof extenders[i][key] === \"object\") extendee[key] = {}, this.extend(extendee[key], extenders[i][key]);else extendee[key] = extenders[i][key];\n }\n }\n }\n\n return extendee;\n }\n /**\r\n * Format strings with placeholders (`{{placeholder}}`) into full strings.\r\n * Quick example: `PluginUtilities.formatString(\"Hello, {{user}}\", {user: \"Zerebos\"})`\r\n * would return \"Hello, Zerebos\".\r\n * @param {string} string - string to format\r\n * @param {object} values - object literal of placeholders to replacements\r\n * @returns {string} the properly formatted string\r\n */\n\n\n static formatString(string, values) {\n for (const val in values) {\n let replacement = values[val];\n if (Array.isArray(replacement)) replacement = JSON.stringify(replacement);\n if (typeof replacement === \"object\" && replacement !== null) replacement = replacement.toString();\n string = string.replace(new RegExp(`{{${val}}}`, \"g\"), replacement);\n }\n\n return string;\n }\n /**\r\n * Finds a value, subobject, or array from a tree that matches a specific filter.\r\n * @param {object} tree Tree that should be walked\r\n * @param {callable} searchFilter Filter to check against each object and subobject\r\n * @param {object} options Additional options to customize the search\r\n * @param {Array|null} [options.walkable=null] Array of strings to use as keys that are allowed to be walked on. Null value indicates all keys are walkable\r\n * @param {Array} [options.ignore=[]] Array of strings to use as keys to exclude from the search, most helpful when `walkable = null`.\r\n */\n\n\n static findInTree(tree, searchFilter, {\n walkable = null,\n ignore = []\n } = {}) {\n if (typeof searchFilter === \"string\") {\n if (tree.hasOwnProperty(searchFilter)) return tree[searchFilter];\n } else if (searchFilter(tree)) {\n return tree;\n }\n\n if (typeof tree !== \"object\" || tree == null) return undefined;\n let tempReturn = undefined;\n\n if (tree instanceof Array) {\n for (const value of tree) {\n tempReturn = this.findInTree(value, searchFilter, {\n walkable,\n ignore\n });\n if (typeof tempReturn != \"undefined\") return tempReturn;\n }\n } else {\n const toWalk = walkable == null ? Object.keys(tree) : walkable;\n\n for (const key of toWalk) {\n if (typeof tree[key] == \"undefined\" || ignore.includes(key)) continue;\n tempReturn = this.findInTree(tree[key], searchFilter, {\n walkable,\n ignore\n });\n if (typeof tempReturn != \"undefined\") return tempReturn;\n }\n }\n\n return tempReturn;\n }\n /**\r\n * Gets a nested property (if it exists) safely. Path should be something like `prop.prop2.prop3`.\r\n * Numbers can be used for arrays as well like `prop.prop2.array.0.id`.\r\n * @param {Object} obj - object to get nested property of\r\n * @param {string} path - representation of the property to obtain\r\n */\n\n\n static getNestedProp(obj, path) {\n return path.split(/\\s?\\.\\s?/).reduce(function (currentObj, prop) {\n return currentObj && currentObj[prop];\n }, obj);\n }\n /**\r\n * Finds a value, subobject, or array from a tree that matches a specific filter. Great for patching render functions.\r\n * @param {object} tree React tree to look through. Can be a rendered object or an internal instance.\r\n * @param {callable} searchFilter Filter function to check subobjects against.\r\n */\n\n\n static findInRenderTree(tree, searchFilter, {\n walkable = [\"props\", \"children\", \"child\", \"sibling\"],\n ignore = []\n } = {}) {\n return this.findInTree(tree, searchFilter, {\n walkable,\n ignore\n });\n }\n /**\r\n * Finds a value, subobject, or array from a tree that matches a specific filter. Great for patching render functions.\r\n * @param {object} tree React tree to look through. Can be a rendered object or an internal instance.\r\n * @param {callable} searchFilter Filter function to check subobjects against.\r\n */\n\n\n static findInReactTree(tree, searchFilter) {\n return this.findInTree(tree, searchFilter, {\n walkable: [\"props\", \"children\", \"return\", \"stateNode\"]\n });\n }\n\n static getReactInstance(node) {\n if (node.__reactInternalInstance$) return node.__reactInternalInstance$;\n return node[Object.keys(node).find(k => k.startsWith(\"__reactInternalInstance\"))] || null;\n }\n /**\r\n * Grabs a value from the react internal instance. Allows you to grab\r\n * long depth values safely without accessing no longer valid properties.\r\n * @param {HTMLElement} node - node to obtain react instance of\r\n * @param {object} options - options for the search\r\n * @param {array} [options.include] - list of items to include from the search\r\n * @param {array} [options.exclude=[\"Popout\", \"Tooltip\", \"Scroller\", \"BackgroundFlash\"]] - list of items to exclude from the search\r\n * @param {callable} [options.filter=_=>_] - filter to check the current instance with (should return a boolean)\r\n * @return {(*|null)} the owner instance or undefined if not found.\r\n */\n\n\n static getOwnerInstance(node, {\n include,\n exclude = [\"Popout\", \"Tooltip\", \"Scroller\", \"BackgroundFlash\"],\n filter = _ => _\n } = {}) {\n if (node === undefined) return undefined;\n const excluding = include === undefined;\n const nameFilter = excluding ? exclude : include;\n\n function getDisplayName(owner) {\n const type = owner.type;\n if (!type) return null;\n return type.displayName || type.name || null;\n }\n\n function classFilter(owner) {\n const name = getDisplayName(owner);\n return name !== null && !!(nameFilter.includes(name) ^ excluding);\n }\n\n let curr = this.getReactInstance(node);\n\n for (curr = curr && curr.return; curr !== null; curr = curr.return) {\n if (curr === null) continue;\n const owner = curr.stateNode;\n if (curr !== null && !(owner instanceof HTMLElement) && classFilter(curr) && filter(owner)) return owner;\n }\n\n return null;\n }\n\n}//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly9Db3JlLy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FtcXF17fV0vZywgXCJcXFxcJCZcIik7XHJcbiAgICB9XHJcblxyXG4gICAgc3RhdGljIHRlc3RKU09OKGRhdGEpIHtcclxuICAgICAgICB0cnkge1xyXG4gICAgICAgICAgICByZXR1cm4gSlNPTi5wYXJzZShkYXRhKTtcclxuICAgICAgICB9XHJcbiAgICAgICAgY2F0Y2ggKGVycikge1xyXG4gICAgICAgICAgICByZXR1cm4gZmFsc2U7XHJcbiAgICAgICAgfVxyXG4gICAgfVxyXG5cclxuICAgIHN0YXRpYyBzdXBwcmVzc0Vycm9ycyhtZXRob2QsIG1lc3NhZ2UpIHtcclxuICAgICAgICByZXR1cm4gKC4uLnBhcmFtcykgPT4ge1xyXG4gICAgICAgICAgICB0cnkgeyByZXR1cm4gbWV0aG9kKC4uLnBhcmFtcyk7XHR9XHJcbiAgICAgICAgICAgIGNhdGNoIChlKSB7IExvZ2dlci5zdGFja3RyYWNlKFwiU3VwcHJlc3NlZEVycm9yXCIsIFwiRXJyb3Igb2NjdXJyZWQgaW4gXCIgKyBtZXNzYWdlLCBlKTsgfVxyXG4gICAgICAgIH07XHJcbiAgICB9XHJcblxyXG4gICAgc3RhdGljIG9uUmVtb3ZlZChub2RlLCBjYWxsYmFjaykge1xyXG4gICAgICAgIGNvbnN0IG9ic2VydmVyID0gbmV3IE11dGF0aW9uT2JzZXJ2ZXIoKG11dGF0aW9ucykgPT4ge1xyXG4gICAgICAgICAgICBmb3IgKGxldCBtID0gMDsgbSA8IG11dGF0aW9ucy5sZW5ndGg7IG0rKykge1xyXG4gICAgICAgICAgICAgICAgY29uc3QgbXV0YXRpb24gPSBtdXRhdGlvbnNbbV07XHJcbiAgICAgICAgICAgICAgICBjb25zdCBub2RlcyA9IEFycmF5LmZyb20obXV0YXRpb24ucmVtb3ZlZE5vZGVzKTtcclxuICAgICAgICAgICAgICAgIGNvbnN0IGRpcmVjdE1hdGNoID0gbm9kZXMuaW5kZXhPZihub2RlKSA+IC0xO1xyXG4gICAgICAgICAgICA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plY3R9IG9iamVjdCAtIG9iamVjdCB0byBtZW1vaXplXHJcbiAgICAgKiBAcmV0dXJucyB7UHJveHl9IHRoZSBwcm94eSB0byB0aGUgb2JqZWN0IHRoYXQgbWVtb2l6ZXMgcHJvcGVydGllc1xyXG4gICAgICovXHJcbiAgICBzdGF0aWMgbWVtb2l6ZU9iamVjdChvYmplY3QpIHtcclxuICAgICAgICBjb25zdCBwcm94eSA9IG5ldyBQcm94eShvYmplY3QsIHtcclxuICAgICAgICAgICAgZ2V0OiBmdW5jdGlvbihvYmosIG1vZCkge1xyXG4gICAgICAgICAgICAgICAgaWYgKCFvYmouaGFzT3duUHJvcGVydHkobW9kKSkgcmV0dXJuIHVuZGVmaW5lZDtcclxuICAgICAgICAgICAgICAgIGlmIChPYmplY3QuZ2V0T3duUHJvcGVydHlEZXNjcmlwdG9yKG9iaiwgbW9kKS5nZXQpIHtcclxuICAgICAgICAgICAgICAgICAgICBjb25zdCB2YWx1ZSA9IG9ialttb2RdO1xyXG4gICAgICAgICAgICAgICAgICAgIGRlbGV0ZSBvYmpbbW9kXTtcclxuICAgICAgICAgICAgICAgICAgICBvYmpbbW9kXSA9IHZhbHVlO1xyXG4gICAgICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICAgICAgcmV0dXJuIG9ialttb2RdO1xyXG4gICAgICAgICAgICB9LFxyXG4gICAgICAgICAgICBzZXQ6IGZ1bmN0aW9uKG9iaiwgbW9kLCB2YWx1ZSkge1xyXG4gICAgICAgICAgICAgICAgaWYgKG9iai5oYXNPd25Qcm9wZXJ0eShtb2QpKSByZXR1cm4gTG9nZ2VyLmVycm9yKFwiTWVtb2l6ZWRPYmplY3RcIiwgXCJUcnlpbmcgdG8gb3ZlcndyaXRlIGV4aXN0aW5nIHByb3BlcnR5XCIpO1xyXG4gICAgICAgICAgICAgICAgb2JqW21vZF0gPSB2YWx1ZTtcclxuICAgICAgICAgICAgICAgIHJldHVybiBvYmpbbW9kXTtcclxuICAgICAgICAgICAgfVxy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dGVyLmluY2x1ZGVzKG5hbWUpIF4gZXhjbHVkaW5nKSk7XHJcblx0XHR9XHJcblxyXG5cdFx0bGV0IGN1cnIgPSB0aGlzLmdldFJlYWN0SW5zdGFuY2Uobm9kZSk7XHJcblx0XHRmb3IgKGN1cnIgPSBjdXJyICYmIGN1cnIucmV0dXJuOyBjdXJyICE9PSBudWxsOyBjdXJyID0gY3Vyci5yZXR1cm4pIHtcclxuXHRcdFx0aWYgKGN1cnIgPT09IG51bGwpIGNvbnRpbnVlO1xyXG5cdFx0XHRjb25zdCBvd25lciA9IGN1cnIuc3RhdGVOb2RlO1xyXG5cdFx0XHRpZiAoY3VyciAhPT0gbnVsbCAmJiAhKG93bmVyIGluc3RhbmNlb2YgSFRNTEVsZW1lbnQpICYmIGNsYXNzRmlsdGVyKGN1cnIpICYmIGZpbHRlcihvd25lcikpIHJldHVybiBvd25lcjtcclxuXHRcdH1cclxuXHJcblx0XHRyZXR1cm4gbnVsbDtcclxuXHR9XHJcbn0iXSwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///./src/modules/utilities.js\n"); /***/ }), @@ -611,7 +611,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) * /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"default\", function() { return PublicServersConnection; });\n/* harmony import */ var modules__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! modules */ \"./src/modules/modules.js\");\n\nconst SortedGuildStore = modules__WEBPACK_IMPORTED_MODULE_0__[\"WebpackModules\"].getByProps(\"getSortedGuilds\");\nconst AvatarDefaults = modules__WEBPACK_IMPORTED_MODULE_0__[\"WebpackModules\"].getByProps(\"getUserAvatarURL\", \"DEFAULT_AVATARS\");\nconst InviteActions = modules__WEBPACK_IMPORTED_MODULE_0__[\"WebpackModules\"].getByProps(\"acceptInvite\");\n\nconst BrowserWindow = __webpack_require__(/*! electron */ \"electron\").remote.BrowserWindow;\n\nclass PublicServersConnection {\n static get endPoint() {\n return \"https://search.discordservers.com\";\n }\n\n static get joinEndPoint() {\n return \"https://j.discordservers.com\";\n }\n\n static get connectEndPoint() {\n return \"https://auth.discordservers.com/info\";\n }\n\n static getDefaultAvatar() {\n return AvatarDefaults.DEFAULT_AVATARS[Math.floor(Math.random() * 5)];\n }\n\n static hasJoined(id) {\n return SortedGuildStore.guildPositions.includes(id);\n }\n\n static search({\n term = \"\",\n category = \"\",\n from = 0\n } = {}) {\n return new Promise(resolve => {\n const queries = [];\n if (category) queries.push(`category=${category.replace(/ /g, \"%20\")}`);\n if (term) queries.push(`term=${term.replace(/ /g, \"%20\")}`);\n if (from) queries.push(`from=${from}`);\n const query = `?${queries.join(\"&\")}`;\n $.ajax({\n method: \"GET\",\n url: `${this.endPoint}${query}`,\n success: data => {\n const next = data.size + data.from;\n resolve({\n servers: data.results,\n size: data.size,\n from: data.from,\n total: data.total,\n next: next >= data.total ? null : next\n });\n },\n error: () => resolve(null)\n });\n });\n }\n\n static join(id, native = false) {\n return new Promise(resolve => {\n if (native) return InviteActions.acceptInvite(id), resolve(true);\n $.ajax({\n method: \"GET\",\n url: `${this.joinEndPoint}/${id}`,\n headers: {\n \"Accept\": \"application/json;\",\n \"Content-Type\": \"application/json;\",\n \"x-discord-token\": this._accessToken\n },\n crossDomain: true,\n xhrFields: {\n withCredentials: true\n },\n success: () => resolve(true),\n error: () => resolve(false)\n });\n });\n }\n\n static checkConnection() {\n return new Promise(resolve => {\n try {\n $.ajax({\n method: \"GET\",\n url: this.connectEndPoint,\n headers: {\n \"Accept\": \"application/json;\",\n \"Content-Type\": \"application/json;\"\n },\n crossDomain: true,\n xhrFields: {\n withCredentials: true\n },\n success: data => {\n this._accessToken = data.access_token;\n resolve(data);\n },\n error: () => resolve(false)\n });\n } catch (error) {\n resolve(false);\n }\n });\n }\n\n static connect() {\n return new Promise(resolve => {\n const joinWindow = new BrowserWindow(this.windowOptions);\n const url = `https://auth.discordservers.com/connect?scopes=guilds.join&previousUrl=${this.connectEndPoint}`;\n joinWindow.webContents.on(\"did-navigate\", (event, navUrl) => {\n if (navUrl != this.connectEndPoint) return;\n joinWindow.close();\n resolve();\n });\n joinWindow.loadURL(url);\n });\n }\n\n static get windowOptions() {\n return {\n width: 380,\n height: 450,\n backgroundColor: \"#282b30\",\n show: true,\n resizable: true,\n maximizable: false,\n minimizable: false,\n alwaysOnTop: true,\n frame: false,\n center: true,\n webPreferences: {\n nodeIntegration: false\n }\n };\n }\n\n}//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly9Db3JlLy4vc3JjL3N0cnVjdHMvcHNjb25uZWN0aW9uLmpzP2VmZjYiXSwibmFtZXMiOlsiU29ydGVkR3VpbGRTdG9yZSIsIldlYnBhY2tNb2R1bGVzIiwiZ2V0QnlQcm9wcyIsIkF2YXRhckRlZmF1bHRzIiwiSW52aXRlQWN0aW9ucyIsIkJyb3dzZXJXaW5kb3ciLCJyZXF1aXJlIiwicmVtb3RlIiwiUHVibGljU2VydmVyc0Nvbm5lY3Rpb24iLCJlbmRQb2ludCIsImpvaW5FbmRQb2ludCIsImNvbm5lY3RFbmRQb2ludCIsImdldERlZmF1bHRBdmF0YXIiLCJERUZBVUxUX0FWQVRBUlMiLCJNYXRoIiwiZmxvb3IiLCJyYW5kb20iLCJoYXNKb2luZWQiLCJpZCIsImd1aWxkUG9zaXRpb25zIiwiaW5jbHVkZXMiLCJzZWFyY2giLCJ0ZXJtIiwiY2F0ZWdvcnkiLCJmcm9tIiwiUHJvbWlzZSIsInJlc29sdmUiLCJxdWVyaWVzIiwicHVzaCIsInJlcGxhY2UiLCJxdWVyeSIsImpvaW4iLCIkIiwiYWpheCIsIm1ldGhvZCIsInVybCIsInN1Y2Nlc3MiLCJkYXRhIiwibmV4dCIsInNpemUiLCJzZXJ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uICAgICAgICByZXR1cm4gU29ydGVkR3VpbGRTdG9yZS5ndWlsZFBvc2l0aW9ucy5pbmNsdWRlcyhpZCk7XHJcbiAgICB9XHJcblxyXG4gICAgc3RhdGljIHNlYXJjaCh7dGVybSA9IFwiXCIsIGNhdGVnb3J5ID0gXCJcIiwgZnJvbSA9IDB9ID0ge30pIHtcclxuICAgICAgICByZXR1cm4gbmV3IFByb21pc2UocmVzb2x2ZSA9PiB7XHJcbiAgICAgICAgICAgIGNvbnN0IHF1ZXJpZXMgPSBbXTtcclxuICAgICAgICAgICAgaWYgKGNhdGVnb3J5KSBxdWVyaWVzLnB1c2goYGNhdGVnb3J5PSR7Y2F0ZWdvcnkucmVwbGFjZSgvIC9nLCBcIiUyMFwiKX1gKTtcclxuICAgICAgICAgICAgaWYgKHRlcm0pIHF1ZXJpZXMucHVzaChgdGVybT0ke3Rlcm0ucmVwbGFjZSgvIC9nLCBcIiUyMFwiKX1gKTtcclxuICAgICAgICAgICAgaWYgKGZyb20pIHF1ZXJpZXMucHVzaChgZnJvbT0ke2Zyb219YCk7XHJcbiAgICAgICAgICAgIGNvbnN0IHF1ZXJ5ID0gYD8ke3F1ZXJpZXMuam9pbihcIiZcIil9YDtcclxuICAgICAgICAgICAgJC5hamF4KHtcclxuICAgICAgICAgICAgICAgIG1ldGhvZDogXCJHRVRcIixcclxuICAgICAgICAgICAgICAgIHVybDogYCR7dGhpcy5lbmRQb2ludH0ke3F1ZXJ5fWAsXHJcbiAgICAgICAgICAgICAgICBzdWNjZXNzOiBkYXRhID0+IHtcclxuICAgICAgICAgICAgICAgICAgICBjb25zdCBuZXh0ID0gZGF0YS5zaXplICsgZGF0YS5mcm9tO1xyXG4gICAgICAgICAgICAgICAgICAgIHJlc29sdmUoe1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBzZXJ2ZXJzOiBkYXRhLnJlc3VsdHMsXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIHNpemU6IGRhdGEuc2l6ZSxcclxuICAgICAgICAgICAgICAgICAgICAgICAgZnJvbTogZGF0YS5mcm9tLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICB0b3RhbDogZGF0YS50b3RhbCxcclxuICAgICAgICAgICAgICAgICAgICAgICAgbmV4dDogbmV4dCA+PSBkYXRhLnRvdGFsID8gbnVsbCA6IG5leHRcclxuICAgICAgICAgICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgICAgIH0sXHJcbiAgICAgICAgICAgICAgICBlcnJvcjogKCkgPT4gcmVzb2x2ZShudWxsKVxyXG4gICAgICAgICAgICB9KTtcclxuICAgICAgICB9KTtcclxuICAgIH1cclxuXHJcbiAgICBzdGF0aWMgam9pbihpZCwgbmF0aXZlID0gZmFsc2UpIHtcclxuICAgICAgICByZXR1cm4gbmV3IFByb21pc2UocmVzb2x2ZSA9PiB7XHJcbiAgICAgICAgICAgIGlmIChuYXRpdmUpIHJldHVybiBJbnZpdGVBY3Rpb25zLmFjY2VwdEludml0ZShpZCksIHJlc29sdmUodHJ1ZSk7XHJcbiAgICAgICAgICAgICQuYWpheCh7XHJcbiAgICAgICAgICAgICAgICBtZXRob2Q6IFwiR0VUXCIsXHJcbiAgICAgICAgICAgICAgICB1cmw6IGAke3RoaXMuam9pbkVuZFBvaW50fS8ke2lkfWAsXHJcbiAgICAgICAgICAgICAgICBoZWFkZXJzOiB7XHJcbiAgICAgICAgICAgICAgICAgICAgXCJBY2NlcHRcIjogXCJhcHBsaWNhdGlvbi9qc29uO1wiLFxyXG4gICAgICAgICAgICAgICAgICAgIFwiQ29udGVudC1UeXBlXCI6IFwiYXBwbGljYXRpb24vanNvbjtcIiAsXHJcbiAgICAgICAgICAgICAgICAgICAgXCJ4LWRpc2NvcmQtdG9rZW5cIjogdGhpcy5fYWNjZXNzVG9rZW5cclxuICAgICAgICAgICAgICAgIH0sXHJcbiAgICAgICAgICAgICAgICBjcm9zc0RvbWFpbjogdHJ1ZSxcclxuICAgICAgICAgICAgICAgIHhockZpZWxkczoge1xyXG4gICAgICAgICAgICAgICAgICAgIHdpdGhDcmVkZW50aWFsczogdHJ1ZVxyXG4gICAgICAgICAgICAgICAgfSxcclxuICAgICAgICAgICAgICAgIHN1Y2Nlc3M6ICgpID0+IHJlc29sdmUodHJ1ZSksXHJcbiAgICAgICAgICAgICAgICBlcnJvcjogKCkgPT4gcmVzb2x2ZShmYWxzZSlcclxuICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgfSk7XHJcbiAgICB9XHJcblxyXG4gICAgc3RhdGljIGNoZWNrQ29ubmVjdGlvbigpIHtcclxuICAgICAgICByZXR1cm4gbmV3IFByb21pc2UocmVzb2x2ZSA9PiB7XHJcbiAgICAgICAgICAgIHRyeSB7XHJcbiAgICAgICAgICAgICAgICAkLmFqYXgoe1xyXG4gICAgICAgICAgICAgICAgICAgIG1ldGhvZDogXCJHRVRcIixcclxuICAgICAgICAgICAgICAgICAgICB1cmw6IHRoaXMuY29ubmVjdEVuZFBvaW50LFxyXG4gICAgICAgICAgICAgICAgICAgIGhlYWRlcnM6IHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgXCJBY2NlcHRcIjogXCJhcHBsaWNhdGlvbi9qc29uO1wiLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICBcIkNvbnRlbnQtVHlwZVwiOiBcImFwcGxpY2F0aW9uL2pzb247XCJcclxuICAgICAgICAgICAgICAgICAgICB9LFxyXG4gICAgICAgICAgICAgICAgICAgIGNyb3NzRG9tYWluOiB0cnVlLFxyXG4gICAgICAgICAgICAgICAgICAgIHhockZpZWxkczoge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB3aXRoQ3JlZGVudGlhbHM6IHRydWVcclxuICAgICAgICAgICAgICAgICAgICB9LFxyXG4gICAgICAgICAgICAgICAgICAgIHN1Y2Nlc3M6IGRhdGEgPT4ge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLl9hY2Nlc3NUb2tlbiA9IGRhdGEuYWNjZXNzX3Rva2VuO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICByZXNvbHZlKGRhdGEpO1xyXG4gICAgICAgICAgICAgICAgICAgIH0sXHJcbiAgICAgICAgICAgICAgICAgICAgZXJyb3I6ICgpID0+IHJlc29sdmUoZmFsc2UpXHJcbiAgICAgICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBjYXRjaCAoZXJyb3IpIHtcclxuICAgICAgICAgICAgICAgIHJlc29sdmUoZmFsc2UpO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgfSk7XHJcbiAgICB9XHJcblxyXG4gICAgc3RhdGljIGNvbm5lY3QoKSB7XHJcbiAgICAgICAgcmV0dXJuIG5ldyBQcm9taXNlKHJlc29sdmUgPT4ge1xyXG4gICAgICAgICAgICBjb25zdCBqb2luV2luZG93ID0gbmV3IEJyb3dzZXJXaW5kb3codGhpcy53aW5kb3dPcHRpb25zKTtcclxuICAgICAgICAgICAgY29uc3QgdXJsID0gYGh0dHBzOi8vYXV0aC5kaXNjb3Jkc2VydmVycy5jb20vY29ubmVjdD9zY29wZXM9Z3VpbGRzLmpvaW4mcHJldmlvdXNVcmw9JHt0aGlzLmNvbm5lY3RFbmRQb2ludH1gO1xyXG4gICAgICAgICAgICBqb2luV2luZG93LndlYkNvbnRlbnRzLm9uKFwiZGlkLW5hdmlnYXRlXCIsIChldmVudCwgbmF2VXJsKSA9PiB7XHJcbiAgICAgICAgICAgICAgICBpZiAobmF2VXJsICE9IHRoaXMuY29ubmVjdEVuZFBvaW50KSByZXR1cm47XHJcbiAgICAgICAgICAgICAgICBqb2luV2luZG93LmNsb3NlKCk7XHJcbiAgICAgICAgICAgICAgICByZXNvbHZlKCk7XHJcbiAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICBqb2luV2luZG93LmxvYWRVUkwodXJsKTtcclxuICAgICAgICB9KTtcclxuICAgIH1cclxuXHJcbiAgICBzdGF0aWMgZ2V0IHdpbmRvd09wdGlvbnMoKSB7XHJcbiAgICAgICAgcmV0dXJuIHtcclxuICAgICAgICAgICAgd2lkdGg6IDM4MCxcclxuICAgICAgICAgICAgaGVpZ2h0OiA0NTAsXHJcbiAgICAgICAgICAgIGJhY2tncm91bmRDb2xvcjogXCIjMjgyYjMwXCIsXHJcbiAgICAgICAgICAgIHNob3c6IHRydWUsXHJcbiAgICAgICAgICAgIHJlc2l6YWJsZTogdHJ1ZSxcclxuICAgICAgICAgICAgbWF4aW1pemFibGU6IGZhbHNlLFxyXG4gICAgICAgICAgICBtaW5pbWl6YWJsZTogZmFsc2UsXHJcbiAgICAgICAgICAgIGFsd2F5c09uVG9wOiB0cnVlLFxyXG4gICAgICAgICAgICBmcmFtZTogZmFsc2UsXHJcbiAgICAgICAgICAgIGNlbnRlcjogdHJ1ZSxcclxuICAgICAgICAgICAgd2ViUHJlZmVyZW5jZXM6IHtcclxuICAgICAgICAgICAgICAgIG5vZGVJbnRlZ3JhdGlvbjogZmFsc2VcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgIH07XHJcbiAgICB9XHJcblxyXG59XHJcbiJdLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///./src/structs/psconnection.js\n"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"default\", function() { return PublicServersConnection; });\n/* harmony import */ var modules__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! modules */ \"./src/modules/modules.js\");\n\nconst SortedGuildStore = modules__WEBPACK_IMPORTED_MODULE_0__[\"WebpackModules\"].getByProps(\"getSortedGuilds\");\nconst AvatarDefaults = modules__WEBPACK_IMPORTED_MODULE_0__[\"WebpackModules\"].getByProps(\"getUserAvatarURL\", \"DEFAULT_AVATARS\");\nconst InviteActions = modules__WEBPACK_IMPORTED_MODULE_0__[\"WebpackModules\"].getByProps(\"acceptInvite\");\n\nconst BrowserWindow = __webpack_require__(/*! electron */ \"electron\").remote.BrowserWindow;\n\nclass PublicServersConnection {\n static get endPoint() {\n return \"https://search.discordservers.com\";\n }\n\n static get joinEndPoint() {\n return \"https://j.discordservers.com\";\n }\n\n static get connectEndPoint() {\n return \"https://auth.discordservers.com/info\";\n }\n\n static getDefaultAvatar() {\n return AvatarDefaults.DEFAULT_AVATARS[Math.floor(Math.random() * 5)];\n }\n\n static hasJoined(id) {\n return SortedGuildStore.getFlattenedGuildIds().includes(id);\n }\n\n static search({\n term = \"\",\n category = \"\",\n from = 0\n } = {}) {\n return new Promise(resolve => {\n const queries = [];\n if (category) queries.push(`category=${category.replace(/ /g, \"%20\")}`);\n if (term) queries.push(`term=${term.replace(/ /g, \"%20\")}`);\n if (from) queries.push(`from=${from}`);\n const query = `?${queries.join(\"&\")}`;\n $.ajax({\n method: \"GET\",\n url: `${this.endPoint}${query}`,\n success: data => {\n const next = data.size + data.from;\n resolve({\n servers: data.results,\n size: data.size,\n from: data.from,\n total: data.total,\n next: next >= data.total ? null : next\n });\n },\n error: () => resolve(null)\n });\n });\n }\n\n static join(id, native = false) {\n return new Promise(resolve => {\n if (native) return InviteActions.acceptInvite(id), resolve(true);\n $.ajax({\n method: \"GET\",\n url: `${this.joinEndPoint}/${id}`,\n headers: {\n \"Accept\": \"application/json;\",\n \"Content-Type\": \"application/json;\",\n \"x-discord-token\": this._accessToken\n },\n crossDomain: true,\n xhrFields: {\n withCredentials: true\n },\n success: () => resolve(true),\n error: () => resolve(false)\n });\n });\n }\n\n static checkConnection() {\n return new Promise(resolve => {\n try {\n $.ajax({\n method: \"GET\",\n url: this.connectEndPoint,\n headers: {\n \"Accept\": \"application/json;\",\n \"Content-Type\": \"application/json;\"\n },\n crossDomain: true,\n xhrFields: {\n withCredentials: true\n },\n success: data => {\n this._accessToken = data.access_token;\n resolve(data);\n },\n error: () => resolve(false)\n });\n } catch (error) {\n resolve(false);\n }\n });\n }\n\n static connect() {\n return new Promise(resolve => {\n const joinWindow = new BrowserWindow(this.windowOptions);\n const url = `https://auth.discordservers.com/connect?scopes=guilds.join&previousUrl=${this.connectEndPoint}`;\n joinWindow.webContents.on(\"did-navigate\", (event, navUrl) => {\n if (navUrl != this.connectEndPoint) return;\n joinWindow.close();\n resolve();\n });\n joinWindow.loadURL(url);\n });\n }\n\n static get windowOptions() {\n return {\n width: 380,\n height: 450,\n backgroundColor: \"#282b30\",\n show: true,\n resizable: true,\n maximizable: false,\n minimizable: false,\n alwaysOnTop: true,\n frame: false,\n center: true,\n webPreferences: {\n nodeIntegration: false\n }\n };\n }\n\n}//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly9Db3JlLy4vc3JjL3N0cnVjdHMvcHNjb25uZWN0aW9uLmpzP2VmZjYiXSwibmFtZXMiOlsiU29ydGVkR3VpbGRTdG9yZSIsIldlYnBhY2tNb2R1bGVzIiwiZ2V0QnlQcm9wcyIsIkF2YXRhckRlZmF1bHRzIiwiSW52aXRlQWN0aW9ucyIsIkJyb3dzZXJXaW5kb3ciLCJyZXF1aXJlIiwicmVtb3RlIiwiUHVibGljU2VydmVyc0Nvbm5lY3Rpb24iLCJlbmRQb2ludCIsImpvaW5FbmRQb2ludCIsImNvbm5lY3RFbmRQb2ludCIsImdldERlZmF1bHRBdmF0YXIiLCJERUZBVUxUX0FWQVRBUlMiLCJNYXRoIiwiZmxvb3IiLCJyYW5kb20iLCJoYXNKb2luZWQiLCJpZCIsImdldEZsYXR0ZW5lZEd1aWxkSWRzIiwiaW5jbHVkZXMiLCJzZWFyY2giLCJ0ZXJtIiwiY2F0ZWdvcnkiLCJmcm9tIiwiUHJvbWlzZSIsInJlc29sdmUiLCJxdWVyaWVzIiwicHVzaCIsInJlcGxhY2UiLCJxdWVyeSIsImpvaW4iLCIkIiwiYWpheCIsIm1ldGhvZCIsInVybCIsInN1Y2Nlc3MiLCJkYXRhIiwibmV4dCIsInNpemUiLCJzZXJ2ZXJzIiwicmVzdWx0cyIsInRvdGFsIiwiZXJyb3I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AgICAgZnJvbTogZGF0YS5mcm9tLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICB0b3RhbDogZGF0YS50b3RhbCxcclxuICAgICAgICAgICAgICAgICAgICAgICAgbmV4dDogbmV4dCA+PSBkYXRhLnRvdGFsID8gbnVsbCA6IG5leHRcclxuICAgICAgICAgICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgICAgIH0sXHJcbiAgICAgICAgICAgICAgICBlcnJvcjogKCkgPT4gcmVzb2x2ZShudWxsKVxyXG4gICAgICAgICAgICB9KTtcclxuICAgICAgICB9KTtcclxuICAgIH1cclxuXHJcbiAgICBzdGF0aWMgam9pbihpZCwgbmF0aXZlID0gZmFsc2UpIHtcclxuICAgICAgICByZXR1cm4gbmV3IFByb21pc2UocmVzb2x2ZSA9PiB7XHJcbiAgICAgICAgICAgIGlmIChuYXRpdmUpIHJldHVybiBJbnZpdGVBY3Rpb25zLmFjY2VwdEludml0ZShpZCksIHJlc29sdmUodHJ1ZSk7XHJcbiAgICAgICAgICAgICQuYWpheCh7XHJcbiAgICAgICAgICAgICAgICBtZXRob2Q6IFwiR0VUXCIsXHJcbiAgICAgICAgICAgICAgICB1cmw6IGAke3RoaXMuam9pbkVuZFBvaW50fS8ke2lkfWAsXHJcbiAgICAgICAgICAgICAgICBoZWFkZXJzOiB7XHJcbiAgICAgICAgICAgICAgICAgICAgXCJBY2NlcHRcIjogXCJhcHBsaWNhdGlvbi9qc29uO1wiLFxyXG4gICAgICAgICAgICAgICAgICAgIFwiQ29udGVudC1UeXBlXCI6IFwiYXBwbGljYXRpb24vanNvbjtcIiAsXHJcbiAgICAgICAgICAgICAgICAgICAgXCJ4LWRpc2NvcmQtdG9rZW5cIjogdGhpcy5fYWNjZXNzVG9rZW5cclxuICAgICAgICAgICAgICAgIH0sXHJcbiAgICAgICAgICAgICAgICBjcm9zc0RvbWFpbjogdHJ1ZSxcclxuICAgICAgICAgICAgICAgIHhockZpZWxkczoge1xyXG4gICAgICAgICAgICAgICAgICAgIHdpdGhDcmVkZW50aWFsczogdHJ1ZVxyXG4gICAgICAgICAgICAgICAgfSxcclxuICAgICAgICAgICAgICAgIHN1Y2Nlc3M6ICgpID0+IHJlc29sdmUodHJ1ZSksXHJcbiAgICAgICAgICAgICAgICBlcnJvcjogKCkgPT4gcmVzb2x2ZShmYWxzZSlcclxuICAgICAgICAgICAgfSk7XHJcbiAgICAgICAgfSk7XHJcbiAgICB9XHJcblxyXG4gICAgc3RhdGljIGNoZWNrQ29ubmVjdGlvbigpIHtcclxuICAgICAgICByZXR1cm4gbmV3IFByb21pc2UocmVzb2x2ZSA9PiB7XHJcbiAgICAgICAgICAgIHRyeSB7XHJcbiAgICAgICAgICAgICAgICAkLmFqYXgoe1xyXG4gICAgICAgICAgICAgICAgICAgIG1ldGhvZDogXCJHRVRcIixcclxuICAgICAgICAgICAgICAgICAgICB1cmw6IHRoaXMuY29ubmVjdEVuZFBvaW50LFxyXG4gICAgICAgICAgICAgICAgICAgIGhlYWRlcnM6IHtcclxuICAgICAgICAgICAgICAgICAgICAgICAgXCJBY2NlcHRcIjogXCJhcHBsaWNhdGlvbi9qc29uO1wiLFxyXG4gICAgICAgICAgICAgICAgICAgICAgICBcIkNvbnRlbnQtVHlwZVwiOiBcImFwcGxpY2F0aW9uL2pzb247XCJcclxuICAgICAgICAgICAgICAgICAgICB9LFxyXG4gICAgICAgICAgICAgICAgICAgIGNyb3NzRG9tYWluOiB0cnVlLFxyXG4gICAgICAgICAgICAgICAgICAgIHhockZpZWxkczoge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB3aXRoQ3JlZGVudGlhbHM6IHRydWVcclxuICAgICAgICAgICAgICAgICAgICB9LFxyXG4gICAgICAgICAgICAgICAgICAgIHN1Y2Nlc3M6IGRhdGEgPT4ge1xyXG4gICAgICAgICAgICAgICAgICAgICAgICB0aGlzLl9hY2Nlc3NUb2tlbiA9IGRhdGEuYWNjZXNzX3Rva2VuO1xyXG4gICAgICAgICAgICAgICAgICAgICAgICByZXNvbHZlKGRhdGEpO1xyXG4gICAgICAgICAgICAgICAgICAgIH0sXHJcbiAgICAgICAgICAgICAgICAgICAgZXJyb3I6ICgpID0+IHJlc29sdmUoZmFsc2UpXHJcbiAgICAgICAgICAgICAgICB9KTtcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgICAgICBjYXRjaCAoZXJyb3IpIHtcclxuICAgICAgICAgICAgICAgIHJlc29sdmUoZmFsc2UpO1xyXG4gICAgICAgICAgICB9XHJcbiAgICAgICAgfSk7XHJcbiAgICB9XHJcblxyXG4gICAgc3RhdGljIGNvbm5lY3QoKSB7XHJcbiAgICAgICAgcmV0dXJuIG5ldyBQcm9taXNlKHJlc29sdmUgPT4ge1xyXG4gICAgICAgICAgICBjb25zdCBqb2luV2luZG93ID0gbmV3IEJyb3dzZXJXaW5kb3codGhpcy53aW5kb3dPcHRpb25zKTtcclxuICAgICAgICAgICAgY29uc3QgdXJsID0gYGh0dHBzOi8vYXV0aC5kaXNjb3Jkc2VydmVycy5jb20vY29ubmVjdD9zY29wZXM9Z3VpbGRzLmpvaW4mcHJldmlvdXNVcmw9JHt0aGlzLmNvbm5lY3RFbmRQb2ludH1gO1xyXG4gICAgICAgICAgICBqb2luV2luZG93LndlYkNvbnRlbnRzLm9uKFwiZGlkLW5hdmlnYXRlXCIsIChldmVudCwgbmF2VXJsKSA9PiB7XHJcbiAgICAgICAgICAgICAgICBpZiAobmF2VXJsICE9IHRoaXMuY29ubmVjdEVuZFBvaW50KSByZXR1cm47XHJcbiAgICAgICAgICAgICAgICBqb2luV2luZG93LmNsb3NlKCk7XHJcbiAgICAgICAgICAgICAgICByZXNvbHZlKCk7XHJcbiAgICAgICAgICAgIH0pO1xyXG4gICAgICAgICAgICBqb2luV2luZG93LmxvYWRVUkwodXJsKTtcclxuICAgICAgICB9KTtcclxuICAgIH1cclxuXHJcbiAgICBzdGF0aWMgZ2V0IHdpbmRvd09wdGlvbnMoKSB7XHJcbiAgICAgICAgcmV0dXJuIHtcclxuICAgICAgICAgICAgd2lkdGg6IDM4MCxcclxuICAgICAgICAgICAgaGVpZ2h0OiA0NTAsXHJcbiAgICAgICAgICAgIGJhY2tncm91bmRDb2xvcjogXCIjMjgyYjMwXCIsXHJcbiAgICAgICAgICAgIHNob3c6IHRydWUsXHJcbiAgICAgICAgICAgIHJlc2l6YWJsZTogdHJ1ZSxcclxuICAgICAgICAgICAgbWF4aW1pemFibGU6IGZhbHNlLFxyXG4gICAgICAgICAgICBtaW5pbWl6YWJsZTogZmFsc2UsXHJcbiAgICAgICAgICAgIGFsd2F5c09uVG9wOiB0cnVlLFxyXG4gICAgICAgICAgICBmcmFtZTogZmFsc2UsXHJcbiAgICAgICAgICAgIGNlbnRlcjogdHJ1ZSxcclxuICAgICAgICAgICAgd2ViUHJlZmVyZW5jZXM6IHtcclxuICAgICAgICAgICAgICAgIG5vZGVJbnRlZ3JhdGlvbjogZmFsc2VcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgIH07XHJcbiAgICB9XHJcblxyXG59XHJcbiJdLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///./src/structs/psconnection.js\n"); /***/ }), @@ -1031,7 +1031,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) * /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"default\", function() { return Toasts; });\n/* harmony import */ var modules__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! modules */ \"./src/modules/modules.js\");\n\nconst channelsClass = modules__WEBPACK_IMPORTED_MODULE_0__[\"WebpackModules\"].getByProps(\"channels\").channels.split(\" \")[0];\nconst membersWrapClass = modules__WEBPACK_IMPORTED_MODULE_0__[\"WebpackModules\"].getByProps(\"membersWrap\").membersWrap.split(\" \")[0];\nclass Toasts {\n static get shouldShowToasts() {\n return modules__WEBPACK_IMPORTED_MODULE_0__[\"Settings\"].get(\"settings\", \"general\", \"showToasts\");\n }\n /** Shorthand for `type = \"success\"` for {@link module:Toasts.show} */\n\n\n static async success(content, options = {}) {\n return this.show(content, Object.assign(options, {\n type: \"success\"\n }));\n }\n /** Shorthand for `type = \"info\"` for {@link module:Toasts.show} */\n\n\n static async info(content, options = {}) {\n return this.show(content, Object.assign(options, {\n type: \"info\"\n }));\n }\n /** Shorthand for `type = \"warning\"` for {@link module:Toasts.show} */\n\n\n static async warning(content, options = {}) {\n return this.show(content, Object.assign(options, {\n type: \"warning\"\n }));\n }\n /** Shorthand for `type = \"error\"` for {@link module:Toasts.show} */\n\n\n static async error(content, options = {}) {\n return this.show(content, Object.assign(options, {\n type: \"error\"\n }));\n }\n /** Shorthand for `type = \"default\"` for {@link module:Toasts.show} */\n\n\n static async default(content, options = {}) {\n return this.show(content, Object.assign(options, {\n type: \"\"\n }));\n }\n /**\r\n * This shows a toast similar to android towards the bottom of the screen.\r\n *\r\n * @param {string} content The string to show in the toast.\r\n * @param {object} options Options object. Optional parameter.\r\n * @param {string} [options.type=\"\"] Changes the type of the toast stylistically and semantically. Choices: \"\", \"info\", \"success\", \"danger\"/\"error\", \"warning\"/\"warn\". Default: \"\"\r\n * @param {boolean} [options.icon=true] Determines whether the icon should show corresponding to the type. A toast without type will always have no icon. Default: true\r\n * @param {number} [options.timeout=3000] Adjusts the time (in ms) the toast should be shown for before disappearing automatically. Default: 3000\r\n * @param {boolean} [options.forceShow=false] Whether to force showing the toast and ignore the bd setting\r\n */\n\n\n static show(content, options = {}) {\n const {\n type = \"\",\n icon = true,\n timeout = 3000,\n forceShow = false\n } = options;\n if (!this.shouldShowToasts && !forceShow) return;\n this.ensureContainer();\n const toastElem = document.createElement(\"div\");\n toastElem.classList.add(\"bd-toast\");\n if (type) toastElem.classList.add(\"toast-\" + type);\n if (type && icon) toastElem.classList.add(\"icon\");\n toastElem.innerText = content;\n document.querySelector(\".bd-toasts\").appendChild(toastElem);\n setTimeout(() => {\n toastElem.classList.add(\"closing\");\n setTimeout(() => {\n toastElem.remove();\n if (!document.querySelectorAll(\".bd-toasts .bd-toast\").length) document.querySelector(\".bd-toasts\").remove();\n }, 300);\n }, timeout);\n }\n\n static ensureContainer() {\n if (document.querySelector(\".bd-toasts\")) return;\n const container = document.querySelector(`.${channelsClass} + div`);\n const memberlist = container.querySelector(`.${membersWrapClass}`);\n const form = container ? container.querySelector(\"form\") : null;\n const left = container ? container.getBoundingClientRect().left : 310;\n const right = memberlist ? memberlist.getBoundingClientRect().left : 0;\n const width = right ? right - container.getBoundingClientRect().left : container.offsetWidth;\n const bottom = form ? form.offsetHeight : 80;\n const toastWrapper = document.createElement(\"div\");\n toastWrapper.classList.add(\"bd-toasts\");\n toastWrapper.style.setProperty(\"left\", left + \"px\");\n toastWrapper.style.setProperty(\"width\", width + \"px\");\n toastWrapper.style.setProperty(\"bottom\", bottom + \"px\");\n document.querySelector(\"#app-mount\").appendChild(toastWrapper);\n }\n\n}//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly9Db3JlLy4vc3JjL3VpL3RvYXN0cy5qcz9jZmU1Il0sIm5hbWVzIjpbImNoYW5uZWxzQ2xhc3MiLCJXZWJwYWNrTW9kdWxlcyIsImdldEJ5UHJvcHMiLCJjaGFubmVscyIsInNwbGl0IiwibWVtYmVyc1dyYXBDbGFzcyIsIm1lbWJlcnNXcmFwIiwiVG9hc3RzIiwic2hvdWxkU2hvd1RvYXN0cyIsIlNldHRpbmdzIiwiZ2V0Iiwic3VjY2VzcyIsImNvbnRlbnQiLCJvcHRpb25zIiwic2hvdyIsIk9iamVjdCIsImFzc2lnbiIsInR5cGUiLCJpbmZvIiwid2FybmluZyIsImVycm9yIiwiZGVmYXVsdCIsImljb24iLCJ0aW1lb3V0IiwiZm9yY2VTaG93IiwiZW5zdXJlQ29udGFpbmVyIiwidG9hc3RFbGVtIiwiZG9jdW1lbnQi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pID0+IHtcclxuICAgICAgICAgICAgdG9hc3RFbGVtLmNsYXNzTGlzdC5hZGQoXCJjbG9zaW5nXCIpO1xyXG4gICAgICAgICAgICBzZXRUaW1lb3V0KCgpID0+IHtcclxuICAgICAgICAgICAgICAgIHRvYXN0RWxlbS5yZW1vdmUoKTtcclxuICAgICAgICAgICAgICAgIGlmICghZG9jdW1lbnQucXVlcnlTZWxlY3RvckFsbChcIi5iZC10b2FzdHMgLmJkLXRvYXN0XCIpLmxlbmd0aCkgZG9jdW1lbnQucXVlcnlTZWxlY3RvcihcIi5iZC10b2FzdHNcIikucmVtb3ZlKCk7XHJcbiAgICAgICAgICAgIH0sIDMwMCk7XHJcbiAgICAgICAgfSwgdGltZW91dCk7XHJcbiAgICB9XHJcblxyXG4gICAgc3RhdGljIGVuc3VyZUNvbnRhaW5lcigpIHtcclxuICAgICAgICBpZiAoZG9jdW1lbnQucXVlcnlTZWxlY3RvcihcIi5iZC10b2FzdHNcIikpIHJldHVybjtcclxuICAgICAgICBjb25zdCBjb250YWluZXIgPSBkb2N1bWVudC5xdWVyeVNlbGVjdG9yKGAuJHtjaGFubmVsc0NsYXNzfSArIGRpdmApO1xyXG4gICAgICAgIGNvbnN0IG1lbWJlcmxpc3QgPSBjb250YWluZXIucXVlcnlTZWxlY3RvcihgLiR7bWVtYmVyc1dyYXBDbGFzc31gKTtcclxuICAgICAgICBjb25zdCBmb3JtID0gY29udGFpbmVyID8gY29udGFpbmVyLnF1ZXJ5U2VsZWN0b3IoXCJmb3JtXCIpIDogbnVsbDtcclxuICAgICAgICBjb25zdCBsZWZ0ID0gY29udGFpbmVyID8gY29udGFpbmVyLmdldEJvdW5kaW5nQ2xpZW50UmVjdCgpLmxlZnQgOiAzMTA7XHJcbiAgICAgICAgY29uc3QgcmlnaHQgPSBtZW1iZXJsaXN0ID8gbWVtYmVybGlzdC5nZXRCb3VuZGluZ0NsaWVudFJlY3QoKS5sZWZ0IDogMDtcclxuICAgICAgICBjb25zdCB3aWR0aCA9IHJpZ2h0ID8gcmlnaHQgLSBjb250YWluZXIuZ2V0Qm91bmRpbmdDbGllbnRSZWN0KCkubGVmdCA6IGNvbnRhaW5lci5vZmZzZXRXaWR0aDtcclxuICAgICAgICBjb25zdCBib3R0b20gPSBmb3JtID8gZm9ybS5vZmZzZXRIZWlnaHQgOiA4MDtcclxuICAgICAgICBjb25zdCB0b2FzdFdyYXBwZXIgPSBkb2N1bWVudC5jcmVhdGVFbGVtZW50KFwiZGl2XCIpO1xyXG4gICAgICAgIHRvYXN0V3JhcHBlci5jbGFzc0xpc3QuYWRkKFwiYmQtdG9hc3RzXCIpO1xyXG4gICAgICAgIHRvYXN0V3JhcHBlci5zdHlsZS5zZXRQcm9wZXJ0eShcImxlZnRcIiwgbGVmdCArIFwicHhcIik7XHJcbiAgICAgICAgdG9hc3RXcmFwcGVyLnN0eWxlLnNldFByb3BlcnR5KFwid2lkdGhcIiwgd2lkdGggKyBcInB4XCIpO1xyXG4gICAgICAgIHRvYXN0V3JhcHBlci5zdHlsZS5zZXRQcm9wZXJ0eShcImJvdHRvbVwiLCBib3R0b20gKyBcInB4XCIpO1xyXG4gICAgICAgIGRvY3VtZW50LnF1ZXJ5U2VsZWN0b3IoXCIjYXBwLW1vdW50XCIpLmFwcGVuZENoaWxkKHRvYXN0V3JhcHBlcik7XHJcbiAgICB9XHJcbn0iXSwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///./src/ui/toasts.js\n"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"default\", function() { return Toasts; });\n/* harmony import */ var modules__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! modules */ \"./src/modules/modules.js\");\n\nconst channelsClass = modules__WEBPACK_IMPORTED_MODULE_0__[\"WebpackModules\"].getByProps(\"sidebar\", \"hasNotice\").sidebar.split(\" \")[0];\nconst membersWrapClass = modules__WEBPACK_IMPORTED_MODULE_0__[\"WebpackModules\"].getByProps(\"membersWrap\").membersWrap.split(\" \")[0];\nclass Toasts {\n static get shouldShowToasts() {\n return modules__WEBPACK_IMPORTED_MODULE_0__[\"Settings\"].get(\"settings\", \"general\", \"showToasts\");\n }\n /** Shorthand for `type = \"success\"` for {@link module:Toasts.show} */\n\n\n static async success(content, options = {}) {\n return this.show(content, Object.assign(options, {\n type: \"success\"\n }));\n }\n /** Shorthand for `type = \"info\"` for {@link module:Toasts.show} */\n\n\n static async info(content, options = {}) {\n return this.show(content, Object.assign(options, {\n type: \"info\"\n }));\n }\n /** Shorthand for `type = \"warning\"` for {@link module:Toasts.show} */\n\n\n static async warning(content, options = {}) {\n return this.show(content, Object.assign(options, {\n type: \"warning\"\n }));\n }\n /** Shorthand for `type = \"error\"` for {@link module:Toasts.show} */\n\n\n static async error(content, options = {}) {\n return this.show(content, Object.assign(options, {\n type: \"error\"\n }));\n }\n /** Shorthand for `type = \"default\"` for {@link module:Toasts.show} */\n\n\n static async default(content, options = {}) {\n return this.show(content, Object.assign(options, {\n type: \"\"\n }));\n }\n /**\r\n * This shows a toast similar to android towards the bottom of the screen.\r\n *\r\n * @param {string} content The string to show in the toast.\r\n * @param {object} options Options object. Optional parameter.\r\n * @param {string} [options.type=\"\"] Changes the type of the toast stylistically and semantically. Choices: \"\", \"info\", \"success\", \"danger\"/\"error\", \"warning\"/\"warn\". Default: \"\"\r\n * @param {boolean} [options.icon=true] Determines whether the icon should show corresponding to the type. A toast without type will always have no icon. Default: true\r\n * @param {number} [options.timeout=3000] Adjusts the time (in ms) the toast should be shown for before disappearing automatically. Default: 3000\r\n * @param {boolean} [options.forceShow=false] Whether to force showing the toast and ignore the bd setting\r\n */\n\n\n static show(content, options = {}) {\n const {\n type = \"\",\n icon = true,\n timeout = 3000,\n forceShow = false\n } = options;\n if (!this.shouldShowToasts && !forceShow) return;\n this.ensureContainer();\n const toastElem = document.createElement(\"div\");\n toastElem.classList.add(\"bd-toast\");\n if (type) toastElem.classList.add(\"toast-\" + type);\n if (type && icon) toastElem.classList.add(\"icon\");\n toastElem.innerText = content;\n document.querySelector(\".bd-toasts\").appendChild(toastElem);\n setTimeout(() => {\n toastElem.classList.add(\"closing\");\n setTimeout(() => {\n toastElem.remove();\n if (!document.querySelectorAll(\".bd-toasts .bd-toast\").length) document.querySelector(\".bd-toasts\").remove();\n }, 300);\n }, timeout);\n }\n\n static ensureContainer() {\n if (document.querySelector(\".bd-toasts\")) return;\n const container = document.querySelector(`.${channelsClass} + div`);\n const memberlist = container.querySelector(`.${membersWrapClass}`);\n const form = container ? container.querySelector(\"form\") : null;\n const left = container ? container.getBoundingClientRect().left : 310;\n const right = memberlist ? memberlist.getBoundingClientRect().left : 0;\n const width = right ? right - container.getBoundingClientRect().left : container.offsetWidth;\n const bottom = form ? form.offsetHeight : 80;\n const toastWrapper = document.createElement(\"div\");\n toastWrapper.classList.add(\"bd-toasts\");\n toastWrapper.style.setProperty(\"left\", left + \"px\");\n toastWrapper.style.setProperty(\"width\", width + \"px\");\n toastWrapper.style.setProperty(\"bottom\", bottom + \"px\");\n document.querySelector(\"#app-mount\").appendChild(toastWrapper);\n }\n\n}//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly9Db3JlLy4vc3JjL3VpL3RvYXN0cy5qcz9jZmU1Il0sIm5hbWVzIjpbImNoYW5uZWxzQ2xhc3MiLCJXZWJwYWNrTW9kdWxlcyIsImdldEJ5UHJvcHMiLCJzaWRlYmFyIiwic3BsaXQiLCJtZW1iZXJzV3JhcENsYXNzIiwibWVtYmVyc1dyYXAiLCJUb2FzdHMiLCJzaG91bGRTaG93VG9hc3RzIiwiU2V0dGluZ3MiLCJnZXQiLCJzdWNjZXNzIiwiY29udGVudCIsIm9wdGlvbnMiLCJzaG93IiwiT2JqZWN0IiwiYXNzaWduIiwidHlwZSIsImluZm8iLCJ3YXJuaW5nIiwiZXJyb3IiLCJkZWZhdWx0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ubmVyVGV4dCA9IGNvbnRlbnQ7XHJcbiAgICAgICAgZG9jdW1lbnQucXVlcnlTZWxlY3RvcihcIi5iZC10b2FzdHNcIikuYXBwZW5kQ2hpbGQodG9hc3RFbGVtKTtcclxuICAgICAgICBzZXRUaW1lb3V0KCgpID0+IHtcclxuICAgICAgICAgICAgdG9hc3RFbGVtLmNsYXNzTGlzdC5hZGQoXCJjbG9zaW5nXCIpO1xyXG4gICAgICAgICAgICBzZXRUaW1lb3V0KCgpID0+IHtcclxuICAgICAgICAgICAgICAgIHRvYXN0RWxlbS5yZW1vdmUoKTtcclxuICAgICAgICAgICAgICAgIGlmICghZG9jdW1lbnQucXVlcnlTZWxlY3RvckFsbChcIi5iZC10b2FzdHMgLmJkLXRvYXN0XCIpLmxlbmd0aCkgZG9jdW1lbnQucXVlcnlTZWxlY3RvcihcIi5iZC10b2FzdHNcIikucmVtb3ZlKCk7XHJcbiAgICAgICAgICAgIH0sIDMwMCk7XHJcbiAgICAgICAgfSwgdGltZW91dCk7XHJcbiAgICB9XHJcblxyXG4gICAgc3RhdGljIGVuc3VyZUNvbnRhaW5lcigpIHtcclxuICAgICAgICBpZiAoZG9jdW1lbnQucXVlcnlTZWxlY3RvcihcIi5iZC10b2FzdHNcIikpIHJldHVybjtcclxuICAgICAgICBjb25zdCBjb250YWluZXIgPSBkb2N1bWVudC5xdWVyeVNlbGVjdG9yKGAuJHtjaGFubmVsc0NsYXNzfSArIGRpdmApO1xyXG4gICAgICAgIGNvbnN0IG1lbWJlcmxpc3QgPSBjb250YWluZXIucXVlcnlTZWxlY3RvcihgLiR7bWVtYmVyc1dyYXBDbGFzc31gKTtcclxuICAgICAgICBjb25zdCBmb3JtID0gY29udGFpbmVyID8gY29udGFpbmVyLnF1ZXJ5U2VsZWN0b3IoXCJmb3JtXCIpIDogbnVsbDtcclxuICAgICAgICBjb25zdCBsZWZ0ID0gY29udGFpbmVyID8gY29udGFpbmVyLmdldEJvdW5kaW5nQ2xpZW50UmVjdCgpLmxlZnQgOiAzMTA7XHJcbiAgICAgICAgY29uc3QgcmlnaHQgPSBtZW1iZXJsaXN0ID8gbWVtYmVybGlzdC5nZXRCb3VuZGluZ0NsaWVudFJlY3QoKS5sZWZ0IDogMDtcclxuICAgICAgICBjb25zdCB3aWR0aCA9IHJpZ2h0ID8gcmlnaHQgLSBjb250YWluZXIuZ2V0Qm91bmRpbmdDbGllbnRSZWN0KCkubGVmdCA6IGNvbnRhaW5lci5vZmZzZXRXaWR0aDtcclxuICAgICAgICBjb25zdCBib3R0b20gPSBmb3JtID8gZm9ybS5vZmZzZXRIZWlnaHQgOiA4MDtcclxuICAgICAgICBjb25zdCB0b2FzdFdyYXBwZXIgPSBkb2N1bWVudC5jcmVhdGVFbGVtZW50KFwiZGl2XCIpO1xyXG4gICAgICAgIHRvYXN0V3JhcHBlci5jbGFzc0xpc3QuYWRkKFwiYmQtdG9hc3RzXCIpO1xyXG4gICAgICAgIHRvYXN0V3JhcHBlci5zdHlsZS5zZXRQcm9wZXJ0eShcImxlZnRcIiwgbGVmdCArIFwicHhcIik7XHJcbiAgICAgICAgdG9hc3RXcmFwcGVyLnN0eWxlLnNldFByb3BlcnR5KFwid2lkdGhcIiwgd2lkdGggKyBcInB4XCIpO1xyXG4gICAgICAgIHRvYXN0V3JhcHBlci5zdHlsZS5zZXRQcm9wZXJ0eShcImJvdHRvbVwiLCBib3R0b20gKyBcInB4XCIpO1xyXG4gICAgICAgIGRvY3VtZW50LnF1ZXJ5U2VsZWN0b3IoXCIjYXBwLW1vdW50XCIpLmFwcGVuZENoaWxkKHRvYXN0V3JhcHBlcik7XHJcbiAgICB9XHJcbn0iXSwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///./src/ui/toasts.js\n"); /***/ }), diff --git a/js/main.min.js b/js/main.min.js index 1d72780e..43252239 100644 --- a/js/main.min.js +++ b/js/main.min.js @@ -1 +1 @@ -var Core=function(e){var t={};function s(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,s),i.l=!0,i.exports}return s.m=e,s.c=t,s.d=function(e,t,n){s.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},s.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},s.t=function(e,t){if(1&t&&(e=s(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(s.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)s.d(n,i,function(t){return e[t]}.bind(null,i));return n},s.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return s.d(t,"a",t),t},s.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},s.p="",s(s.s=6)}([function(e,t){e.exports=require("electron")},function(e,t){e.exports=require("fs")},function(e,t){e.exports=require("path")},function(e,t){e.exports=require("request")},function(e,t){e.exports=require("module")},function(e,t){e.exports=require("events")},function(e,t,s){"use strict";s.r(t);var n={};s.r(n),s.d(n,"EmoteModule",function(){return Ye}),s.d(n,"CustomCSS",function(){return it}),s.d(n,"VoiceMode",function(){return ot}),s.d(n,"ClassNormalizer",function(){return at}),s.d(n,"DeveloperMode",function(){return lt}),s.d(n,"PublicServers",function(){return yt}),s.d(n,"DarkMode",function(){return vt}),s.d(n,"MinimalMode",function(){return wt}),s.d(n,"TwentyFourHour",function(){return Ct}),s.d(n,"ColoredText",function(){return Et}),s.d(n,"VoiceDisconnect",function(){return Pt}),s.d(n,"EmoteMenu",function(){return kt}),s.d(n,"EmoteAutocaps",function(){return Mt}),s.d(n,"WindowPrefs",function(){return Nt});var i={local:!1,localServer:"//localhost:8080",minified:!0,version:"0.3.0",branch:"master",repo:"rauenzi",minSupportedVersion:"0.3.0",bbdVersion:"0.2.17"},o=[{type:"category",id:"general",name:"General",collapsible:!0,settings:[{type:"switch",id:"download",value:!0},{type:"switch",id:"emoteMenu",value:!0},{type:"switch",id:"hideEmojiMenu",value:!1,enableWith:"emoteMenu"},{type:"switch",id:"autoCaps",value:!1},{type:"switch",id:"showNames",value:!0},{type:"switch",id:"modifiers",value:!0},{type:"switch",id:"animateOnHover",value:!1}]},{type:"category",id:"categories",name:"Categories",collapsible:!0,settings:[{type:"switch",id:"twitchglobal",value:!0},{type:"switch",id:"twitchsubscriber",value:!1},{type:"switch",id:"frankerfacez",value:!0},{type:"switch",id:"bttv",value:!0}]}],r=[{type:"category",id:"general",collapsible:!0,settings:[{type:"switch",id:"emotes",value:!0},{type:"switch",id:"publicServers",value:!0},{type:"switch",id:"voiceDisconnect",value:!1},{type:"switch",id:"twentyFourHour",value:!1},{type:"switch",id:"classNormalizer",value:!0},{type:"switch",id:"showToasts",value:!0}]},{type:"category",id:"appearance",collapsible:!0,settings:[{type:"switch",id:"voiceMode",value:!1},{type:"switch",id:"minimalMode",value:!1},{type:"switch",id:"hideChannels",value:!1,enableWith:"minimalMode"},{type:"switch",id:"darkMode",value:!0},{type:"switch",id:"coloredText",value:!1}]},{type:"category",id:"addons",collapsible:!0,shown:!1,settings:[{type:"switch",id:"addonErrors",value:!0},{type:"switch",id:"autoScroll",value:!0},{type:"switch",id:"autoReload",value:!0},{type:"dropdown",id:"editAction",value:"detached",options:[{value:"detached"},{value:"system"}]}]},{type:"category",id:"customcss",collapsible:!0,shown:!1,settings:[{type:"switch",id:"customcss",value:!0},{type:"switch",id:"liveUpdate",value:!1},{type:"dropdown",id:"openAction",value:"settings",options:[{value:"settings"},{value:"detached"},{value:"system"}]}]},{type:"category",id:"developer",collapsible:!0,shown:!1,settings:[{type:"switch",id:"developerMode",value:!1},{type:"switch",id:"copySelector",value:!1,enableWith:"developerMode"}]},{type:"category",id:"window",collapsible:!0,shown:!1,settings:[{type:"switch",id:"transparency",value:!1},{type:"switch",id:"frame",value:!1,hidden:!0}]}],a={Panels:{plugins:"Plugins",themes:"Themes",customcss:"Custom CSS"},Collections:{settings:{name:"Settings",general:{name:"General",emotes:{name:"Emote System",note:"Enables BD's emote system"},publicServers:{name:"Public Servers",note:"Display public servers button"},voiceDisconnect:{name:"Voice Disconnect",note:"Disconnect from voice server when closing Discord"},twentyFourHour:{name:"24-Hour Timestamps",note:"Hides channels when in minimal mode"},classNormalizer:{name:"Normalize Classes",note:"Adds stable classes to elements to help themes. (e.g. adds .da-channels to .channels-Ie2l6A)"},showToasts:{name:"Show Toasts",note:"Shows a small notification for important information"}},appearance:{name:"Appearance",voiceMode:{name:"Voice Mode",note:"Hides everything that isn't voice chat"},minimalMode:{name:"Minimal Mode",note:"Hide elements and reduce the size of elements"},hideChannels:{name:"Hide Channels",note:"Hides channels when in minimal mode"},darkMode:{name:"Dark Mode",note:"Make certain elements dark by default"},coloredText:{name:"Colored Text",note:"Make text colour the same as role color"}},addons:{name:"Addon Manager",addonErrors:{name:"Show Addon Errors",note:"Shows a modal with plugin/theme errors"},autoScroll:{name:"Scroll To Settings",note:"Auto-scrolls to a plugin's settings when the button is clicked (only if out of view)"},autoReload:{name:"Automatic Loading",note:"Automatically loads, reloads, and unloads plugins and themes"},editAction:{name:"Edit Action",note:"Where plugins & themes appear when editing",options:{detached:"Detached Window",system:"System Editor"}}},customcss:{name:"Custom CSS",customcss:{name:"Custom CSS",note:"Enables the Custom CSS tab"},liveUpdate:{name:"Live Update",note:"Updates the css as you type"},startDetached:{name:"Start Detached",note:"Clicking the Custom CSS tab opens the editor in a separate window"},nativeOpen:{name:"Open in Native Editor",note:"Clicking the Custom CSS tab opens your custom css in your native editor"},openAction:{name:"Editor Location",note:"Where Custom CSS should open by default",options:{settings:"Settings Menu",detached:"Detached Window",system:"System Editor"}}},developer:{name:"Developer Settings",developerMode:{name:"Developer Mode",note:"Allows activating debugger when pressing F8"},copySelector:{name:"Copy Selector",note:'Adds a "Copy Selector" option to context menus when developer mode is active'}},window:{name:"Window Preferences",transparency:{name:"Enable Transparency",note:"Enables the main window to be see-through (requires restart)"},frame:{name:"Window Frame",note:"Adds the native os window frame to the main window"}}},emotes:{name:"Emotes",general:{name:"General",download:{name:"Download Emotes",note:"Download emotes whenever they are out of date"},emoteMenu:{name:"Emote Menu",note:"Show Twitch/Favourite emotes in emote menu"},hideEmojiMenu:{name:"Hide Emoji Menu",note:"Hides Discord's emoji menu when using emote menu"},autoCaps:{name:"Emote Autocapitalization",note:"Autocapitalize emote commands"},showNames:{name:"Show Names",note:"Show emote names on hover"},modifiers:{name:"Show Emote Modifiers",note:"Enable emote mods (flip, spin, pulse, spin2, spin3, 1spin, 2spin, 3spin, tr, bl, br, shake, shake2, shake3, flap)"},animateOnHover:{name:"Animate On Hover",note:"Only animate the emote modifiers on hover"}},categories:{name:"Categories",twitchglobal:{name:"Twitch Globals",note:"Show Twitch global emotes"},twitchsubscriber:{name:"Twitch Subscribers",note:"Show Twitch subscriber emotes"},frankerfacez:{name:"FrankerFaceZ",note:"Show emotes from FFZ"},bttv:{name:"BetterTTV",note:"Show emotes from BTTV"}}}},Addons:{title:"{{name}} v{{version}} by {{author}}",openFolder:"Open {{type}} Folder",reload:"Reload",addonSettings:"Settings",website:"Website",source:"Source",server:"Support Server",donate:"Donate",name:"Name",author:"Author",version:"Version",added:"Date Added",modified:"Date Modified",search:"Search {{type}}",editAddon:"Edit",deleteAddon:"Delete",confirmDelete:"Are you sure you want to delete {{name}}?",confirmationText:"You have unsaved changes to {{name}}. Closing this window will lose all those changes."},Emotes:{loading:"Loading emotes in the background do not reload.",loaded:"All emotes successfully loaded.",clearEmotes:"Clear Emote Data",favoriteAction:"Favorite!"},CustomCSS:{confirmationText:"You have unsaved changes to your Custom CSS. Closing this window will lose all those changes.",update:"Update",save:"Save",openNative:"Open in System Editor",openDetached:"Detach Window",settings:"Editor Settings",editorTitle:"Custom CSS Editor"},PublicServers:{button:"public",join:"Join",joining:"Joining",joined:"Joined",loading:"Loading",loadMore:"Load More",notConnected:"Not connected to DiscordServers.com!",search:"Search",connect:"Connect",reconnect:"Reconnect",categories:"Categories",connection:"Connected as: {{username}}#{{discriminator}}",results:"Showing {{start}}-{{end}} of {{total}} results in {{category}}",query:"for {{query}}"},Modals:{confirmAction:"Are You Sure?",okay:"Okay",cancel:"Cancel",close:"Close",name:"Name",message:"Message",error:"Error",addonErrors:"Addon Errors"},Sorting:{sortBy:"Sort By",order:"Order",ascending:"Ascending",descending:"Descending"}};const l={err:"error",error:"error",dbg:"debug",debug:"debug",log:"log",warn:"warn",info:"info"};class d{static stacktrace(e,t,s){console.error(`%c[${e}]%c ${t}\n\n%c`,"color: #3a71c1; font-weight: 700;","color: red; font-weight: 700;","color: red;",s)}static err(e,...t){d._log(e,t,"error")}static warn(e,...t){d._log(e,t,"warn")}static info(e,...t){d._log(e,t,"info")}static debug(e,...t){d._log(e,t,"debug")}static log(e,...t){d._log(e,t)}static _log(e,t,s="log"){s=d.parseType(s),Array.isArray(t)||(t=[t]),console[s](`%c[BandagedBD]%c [${e}]%c`,"color: #3E82E5; font-weight: 700;","color: #3a71c1;","",...t)}static parseType(e){return l.hasOwnProperty(e)?l[e]:"log"}}class c{static repoUrl(e){return`https://cdn.staticaly.com/gh/${i.repo}/BetterDiscordApp/${i.hash}/${e}`}static parseHTML(e,t=!1){const s=document.createElement("template");s.innerHTML=e;const n=s.content.cloneNode(!0);return t?n:n.childNodes.length>1?n.childNodes:n.childNodes[0]}static getTextArea(){return $(".channelTextArea-1LDbYG textarea")}static insertText(e,t){e.focus(),e.selectionStart=0,e.selectionEnd=e.value.length,document.execCommand("insertText",!1,t)}static escape(e){return e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}static testJSON(e){try{return JSON.parse(e)}catch(e){return!1}}static suppressErrors(e,t){return(...s)=>{try{return e(...s)}catch(e){d.stacktrace("SuppressedError","Error occurred in "+t,e)}}}static monkeyPatch(e,t,s){const{before:n,after:i,instead:o,once:r=!1,silent:a=!1,force:l=!1}=s,d=s.displayName||e.displayName||e.name||e.constructor.displayName||e.constructor.name;if(a||console.log("patch",t,"of",d),!e[t]){if(!l)return console.error(t,"does not exist for",d);e[t]=function(){}}const h=e[t],u=()=>{a||console.log("unpatch",t,"of",d),e[t]=h};return e[t]=function(){const s={thisObject:this,methodArguments:arguments,cancelPatch:u,originalMethod:h,callOriginalMethod:()=>s.returnValue=s.originalMethod.apply(s.thisObject,s.methodArguments)};if(o){const n=c.suppressErrors(o,"`instead` callback of "+e[t].displayName)(s);void 0!==n&&(s.returnValue=n)}else n&&c.suppressErrors(n,"`before` callback of "+e[t].displayName)(s),s.callOriginalMethod(),i&&c.suppressErrors(i,"`after` callback of "+e[t].displayName)(s);return r&&u(),s.returnValue},e[t].__monkeyPatched=!0,e[t].__originalMethod||(e[t].__originalMethod=h),e[t].displayName="patched "+(e[t].displayName||t),u}static onRemoved(e,t){const s=new MutationObserver(n=>{for(let i=0;i-1,l=r.some(t=>t.contains(e));(a||l)&&(s.disconnect(),t())}});s.observe(document.body,{subtree:!0,childList:!0})}static isEmpty(e){if(null==e||null==e||""==e)return!0;if("object"!=typeof e)return!1;if(Array.isArray(e))return 0==e.length;for(const t in e)if(e.hasOwnProperty(t))return!1;return!0}static memoizeObject(e){const t=new Proxy(e,{get:function(e,t){if(e.hasOwnProperty(t)){if(Object.getOwnPropertyDescriptor(e,t).get){const s=e[t];delete e[t],e[t]=s}return e[t]}},set:function(e,t,s){return e.hasOwnProperty(t)?d.error("MemoizedObject","Trying to overwrite existing property"):(e[t]=s,e[t])}});return Object.defineProperty(t,"hasOwnProperty",{value:function(e){return void 0!==this[e]}}),t}static extend(e,...t){for(let s=0;se.startsWith("__reactInternalInstance"))]||null}static getOwnerInstance(e,{include:t,exclude:s=["Popout","Tooltip","Scroller","BackgroundFlash"],filter:n=(e=>e)}={}){if(void 0===e)return;const i=void 0===t,o=i?s:t;function r(e){const t=function(e){const t=e.type;return t&&(t.displayName||t.name)||null}(e);return null!==t&&!!(o.includes(t)^i)}let a=this.getReactInstance(e);for(a=a&&a.return;null!==a;a=a.return){if(null===a)continue;const e=a.stateNode;if(null!==a&&!(e instanceof HTMLElement)&&r(a)&&n(e))return e}return null}}class h{static byProperties(e,t=(e=>e)){return s=>{const n=t(s);return!!n&&e.every(e=>void 0!==n[e])}}static byPrototypeFields(e,t=(e=>e)){return s=>{const n=t(s);return!!n&&(!!n.prototype&&e.every(e=>void 0!==n.prototype[e]))}}static byCode(e,t=(e=>e)){return s=>{const n=t(s);return!!n&&-1!==n.toString([]).search(e)}}static byString(...e){return t=>{const s=t.toString([]);for(const t of e)if(!s.includes(t))return!1;return!0}}static byDisplayName(e){return t=>t&&t.displayName===e}static combine(...e){return t=>e.every(e=>e(t))}}class u{static find(e,t=!0){return this.getModule(e,t)}static findAll(e){return this.getModule(e,!1)}static findByUniqueProperties(e,t=!0){return t?this.getByProps(...e):this.getAllByProps(...e)}static findByDisplayName(e){return this.getByDisplayName(e)}static getModule(e,t=!0){const s=this.getAllModules(),n=[];for(const i in s){if(!s.hasOwnProperty(i))continue;const o=s[i],{exports:r}=o;let a=null;if(r&&(r.__esModule&&r.default&&e(r.default)&&(a=r.default),e(r)&&(a=r),a)){if(t)return a;n.push(a)}}return t||0==n.length?void 0:n}static getModules(e){return this.getModule(e,!1)}static getByDisplayName(e){return this.getModule(h.byDisplayName(e),!0)}static getByRegex(e,t=!0){return this.getModule(h.byCode(e),t)}static getByPrototypes(...e){return this.getModule(h.byPrototypeFields(e),!0)}static getAllByPrototypes(...e){return this.getModule(h.byPrototypeFields(e),!1)}static getByProps(...e){return this.getModule(h.byProperties(e),!0)}static getAllByProps(...e){return this.getModule(h.byProperties(e),!1)}static getByString(...e){return this.getModule(h.byString(...e),!0)}static getAllByString(...e){return this.getModule(h.byString(...e),!1)}static get require(){if(this._require)return this._require;const e="bbd-webpackmodules",t="function"==typeof window.webpackJsonp?window.webpackJsonp([],{[e]:(e,t,s)=>t.default=s},[e]).default:window.webpackJsonp.push([[],{[e]:(e,t,s)=>e.exports=s},[[e]]]);return delete t.m[e],delete t.c[e],this._require=t}static getAllModules(){return this.require.c}}var p=c.memoizeObject({get React(){return u.getByProps("createElement","cloneElement")},get ReactDOM(){return u.getByProps("render","findDOMNode")},get Flux(){return u.getByProps("connectStores")},get Events(){return u.getByPrototypes("setMaxListeners","emit")},get GuildStore(){return u.getByProps("getGuild")},get SortedGuildStore(){return u.getByProps("getSortedGuilds")},get SelectedGuildStore(){return u.getByProps("getLastSelectedGuildId")},get GuildSync(){return u.getByProps("getSyncedGuilds")},get GuildInfo(){return u.getByProps("getAcronym")},get GuildChannelsStore(){return u.getByProps("getChannels","getDefaultChannel")},get GuildMemberStore(){return u.getByProps("getMember")},get MemberCountStore(){return u.getByProps("getMemberCounts")},get GuildEmojiStore(){return u.getByProps("getEmojis")},get GuildActions(){return u.getByProps("markGuildAsRead")},get GuildPermissions(){return u.getByProps("getGuildPermissions")},get ChannelStore(){return u.getByProps("getChannels","getDMFromUserId")},get SelectedChannelStore(){return u.getByProps("getLastSelectedChannelId")},get ChannelActions(){return u.getByProps("selectChannel")},get PrivateChannelActions(){return u.getByProps("openPrivateChannel")},get ChannelSelector(){return u.getByProps("selectGuild","selectChannel")},get UserInfoStore(){return u.getByProps("getToken")},get UserSettingsStore(){return u.getByProps("guildPositions")},get AccountManager(){return u.getByProps("register","login")},get UserSettingsUpdater(){return u.getByProps("updateRemoteSettings")},get OnlineWatcher(){return u.getByProps("isOnline")},get CurrentUserIdle(){return u.getByProps("getIdleTime")},get RelationshipStore(){return u.getByProps("isBlocked","getFriendIDs")},get RelationshipManager(){return u.getByProps("addRelationship")},get MentionStore(){return u.getByProps("getMentions")},get UserStore(){return u.getByProps("getCurrentUser")},get UserStatusStore(){return u.getByProps("getStatus","getState")},get UserTypingStore(){return u.getByProps("isTyping")},get UserActivityStore(){return u.getByProps("getActivity")},get UserNameResolver(){return u.getByProps("getName")},get UserNoteStore(){return u.getByProps("getNote")},get UserNoteActions(){return u.getByProps("updateNote")},get EmojiInfo(){return u.getByProps("isEmojiDisabled")},get EmojiUtils(){return u.getByProps("getGuildEmoji")},get EmojiStore(){return u.getByProps("getByCategory","EMOJI_NAME_RE")},get InviteStore(){return u.getByProps("getInvites")},get InviteResolver(){return u.getByProps("findInvite")},get InviteActions(){return u.getByProps("acceptInvite")},get DiscordConstants(){return u.getByProps("Permissions","ActivityTypes","StatusTypes")},get DiscordPermissions(){return u.getByProps("Permissions","ActivityTypes","StatusTypes").Permissions},get PermissionUtils(){return u.getByProps("getHighestRole")},get ColorConverter(){return u.getByProps("hex2int")},get ColorShader(){return u.getByProps("darken")},get TinyColor(){return u.getByPrototypes("toRgb")},get ClassResolver(){return u.getByProps("getClass")},get ButtonData(){return u.getByProps("ButtonSizes")},get IconNames(){return u.getByProps("IconNames")},get NavigationUtils(){return u.getByProps("transitionTo","replaceWith","getHistory")},get MessageStore(){return u.getByProps("getMessages")},get MessageActions(){return u.getByProps("jumpToMessage","_sendMessage")},get MessageQueue(){return u.getByProps("enqueue")},get MessageParser(){return u.getByProps("createMessage","parse","unparse")},get hljs(){return u.getByProps("highlight","highlightBlock")},get SimpleMarkdown(){return u.getByProps("parseBlock","parseInline","defaultOutput")},get ExperimentStore(){return u.getByProps("getExperimentOverrides")},get ExperimentsManager(){return u.getByProps("isDeveloper")},get CurrentExperiment(){return u.getByProps("getExperimentId")},get ImageResolver(){return u.getByProps("getUserAvatarURL","getGuildIconURL")},get ImageUtils(){return u.getByProps("getSizedImageSrc")},get AvatarDefaults(){return u.getByProps("getUserAvatarURL","DEFAULT_AVATARS")},get WindowInfo(){return u.getByProps("isFocused","windowSize")},get TagInfo(){return u.getByProps("VALID_TAG_NAMES")},get DOMInfo(){return u.getByProps("canUseDOM")},get LocaleManager(){return u.getByProps("setLocale")},get Moment(){return u.getByProps("parseZone")},get LocationManager(){return u.getByProps("createLocation")},get Timestamps(){return u.getByProps("fromTimestamp")},get TimeFormatter(){return u.getByProps("dateFormat")},get Strings(){return u.getByProps("Messages").Messages},get StringFormats(){return u.getByProps("a","z")},get StringUtils(){return u.getByProps("toASCII")},get URLParser(){return u.getByProps("Url","parse")},get ExtraURLs(){return u.getByProps("getArticleURL")},get DNDActions(){return u.getByProps("beginDrag")},get DNDSources(){return u.getByProps("addTarget")},get DNDObjects(){return u.getByProps("DragSource")},get MediaDeviceInfo(){return u.getByProps("Codecs","SUPPORTED_BROWSERS")},get MediaInfo(){return u.getByProps("getOutputVolume")},get MediaEngineInfo(){return u.getByProps("MediaEngineFeatures")},get VoiceInfo(){return u.getByProps("EchoCancellation")},get VideoStream(){return u.getByProps("getVideoStream")},get SoundModule(){return u.getByProps("playSound")},get ElectronModule(){return u.getByProps("setBadge")},get Dispatcher(){return u.getByProps("dirtyDispatch")},get PathUtils(){return u.getByProps("hasBasename")},get NotificationModule(){return u.getByProps("showNotification")},get RouterModule(){return u.getByProps("Router")},get APIModule(){return u.getByProps("getAPIBaseURL")},get AnalyticEvents(){return u.getByProps("AnalyticEventConfigs")},get KeyGenerator(){return u.getByRegex(/"binary"/)},get Buffers(){return u.getByProps("Buffer","kMaxLength")},get DeviceStore(){return u.getByProps("getDevices")},get SoftwareInfo(){return u.getByProps("os")},get CurrentContext(){return u.getByProps("setTagsContext")},get GuildClasses(){const e=u.getByProps("wrapper","unreadMentionsBar"),t=u.getByProps("guildsError","selected"),s=u.getByProps("blobContainer");return Object.assign({},e,t,s)}});const m=s(5);var g=new class extends m{constructor(){super(),this.setMaxListeners(20)}dispatch(e,...t){this.emit(e,...t)}};const f=s(1),b=s(2),y=DiscordNative.globals.releaseChannel;var v=new class{constructor(){this.data={misc:{}},this.pluginData={},this.cacheData={}}initialize(){f.existsSync(this.baseFolder)||f.mkdirSync(this.baseFolder),f.existsSync(this.dataFolder)||f.mkdirSync(this.dataFolder),f.existsSync(this.localeFolder)||f.mkdirSync(this.localeFolder),f.existsSync(this.emoteFolder)||f.mkdirSync(this.emoteFolder),f.existsSync(this.cacheFile)||f.writeFileSync(this.cacheFile,JSON.stringify({})),f.existsSync(this.customCSS)||f.writeFileSync(this.customCSS,"");const e=f.readdirSync(this.dataFolder).filter(e=>!f.statSync(b.resolve(this.dataFolder,e)).isDirectory()&&e.endsWith(".json"));for(const t of e)this.data[t.split(".")[0]]=require(b.resolve(this.dataFolder,t));this.cacheData=c.testJSON(f.readFileSync(this.cacheFile).toString())||{}}get customCSS(){return this._customCSS||(this._customCSS=b.resolve(this.dataFolder,"custom.css"))}get baseFolder(){return this._baseFolder||(this._baseFolder=b.resolve(i.dataPath,"data"))}get dataFolder(){return this._dataFolder||(this._dataFolder=b.resolve(this.baseFolder,`${y}`))}get localeFolder(){return this._localeFolder||(this._localeFolder=b.resolve(this.baseFolder,"locales"))}get emoteFolder(){return this._emoteFolder||(this._emoteFolder=b.resolve(this.baseFolder,"emotes"))}get cacheFile(){return this._cacheFile||(this._cacheFile=b.resolve(this.baseFolder,".cache"))}getPluginFile(e){return b.resolve(i.dataPath,"plugins",e+".config.json")}_getFile(e){return"settings"==e||"plugins"==e||"themes"==e?b.resolve(this.dataFolder,`${e}.json`):b.resolve(this.dataFolder,"misc.json")}getBDData(e){return this.data.misc[e]||""}setBDData(e,t){this.data.misc[e]=t,f.writeFileSync(b.resolve(this.dataFolder,"misc.json"),JSON.stringify(this.data.misc,null,4))}getLocale(e){const t=b.resolve(this.localeFolder,`${e}.json`);return f.existsSync(t)?c.testJSON(f.readFileSync(t).toString()):null}saveLocale(e,t){f.writeFileSync(b.resolve(this.localeFolder,`${e}.json`),JSON.stringify(t,null,4))}getCacheHash(e,t){return this.cacheData[e]&&f.existsSync(b.resolve(this.baseFolder,e,`${t}.json`))&&this.cacheData[e][t]||""}setCacheHash(e,t,s){this.cacheData[e]||(this.cacheData[e]={}),this.cacheData[e][t]=s,f.writeFileSync(this.cacheFile,JSON.stringify(this.cacheData))}invalidateCache(e,t){this.cacheData[e]&&(delete this.cacheData[e][t],f.writeFileSync(this.cacheFile,JSON.stringify(this.cacheData)))}emotesExist(e){return f.existsSync(b.resolve(this.emoteFolder,`${e}.json`))}getEmoteData(e){const t=b.resolve(this.emoteFolder,`${e}.json`);return f.existsSync(t)?c.testJSON(f.readFileSync(t).toString()):null}saveEmoteData(e,t){f.writeFileSync(b.resolve(this.emoteFolder,`${e}.json`),JSON.stringify(t))}getData(e){return this.data[e]||""}setData(e,t){this.data[e]=t,f.writeFileSync(b.resolve(this.dataFolder,`${e}.json`),JSON.stringify(t,null,4))}loadCustomCSS(){return f.readFileSync(this.customCSS).toString()}saveCustomCSS(e){return f.writeFileSync(this.customCSS,e)}getPluginData(e,t){return void 0!==this.pluginData[e]?this.pluginData[e][t]||void 0:f.existsSync(this.getPluginFile(e))?(this.pluginData[e]=JSON.parse(f.readFileSync(this.getPluginFile(e))),this.pluginData[e][t]||void 0):void 0}setPluginData(e,t,s){void 0!==s&&(void 0===this.pluginData[e]&&(this.pluginData[e]={}),this.pluginData[e][t]=s,f.writeFileSync(this.getPluginFile(e),JSON.stringify(this.pluginData[e],null,4)))}deletePluginData(e,t){void 0===this.pluginData[e]&&(this.pluginData[e]={}),delete this.pluginData[e][t],f.writeFileSync(this.getPluginFile(e),JSON.stringify(this.pluginData[e],null,4))}};const w=s(3),{Dispatcher:C,DiscordConstants:S,UserSettingsStore:E}=p;var P=new class{get discordLocale(){return E.locale.split("-")[0]}get defaultLocale(){return"en"}constructor(){this.locale="",this.strings={}}async initialize(){await this.setLocale(this.discordLocale),C.subscribe(S.ActionTypes.USER_SETTINGS_UPDATE,({settings:e})=>{const t=e.locale;t&&t!=this.locale&&this.setLocale(t.split("-")[0])})}async setLocale(e){let t;if(e!=this.defaultLocale){if(!(t=await this.getLocaleStrings(e)))return this.setLocale(this.defaultLocale)}else t=a;this.locale=e,c.extend(this.strings,t),g.emit("strings-updated")}async getLocaleStrings(e){const t=v.getCacheHash("locales",e);if(!t)return await this.downloadLocale(e);const s=await this.downloadLocale(e,t);return s||v.getLocale(e)}downloadLocale(e,t=""){return new Promise(s=>{const n={url:c.repoUrl(`data/locales/${e}.json`),timeout:2e3,json:!0};t&&(n.headers={"If-None-Match":t}),w.get(n,(t,n,i)=>{if(t||200!==n.statusCode)return s(null);v.saveLocale(e,i),v.setCacheHash("locales",e,n.headers.etag),s(i)})})}};class x{static get bdHead(){return this.getElement("bd-head")}static get bdBody(){return this.getElement("bd-body")}static get bdScripts(){return this.getElement("bd-scripts")}static get bdStyles(){return this.getElement("bd-styles")}static get bdThemes(){return this.getElement("bd-themes")}static get bdCustomCSS(){return this.getElement("#customcss")}static initialize(){this.createElement("bd-head",{target:document.head}),this.createElement("bd-body",{target:document.body}),this.createElement("bd-scripts",{target:this.bdHead}),this.createElement("bd-styles",{target:this.bdHead}),this.createElement("bd-themes",{target:this.bdHead}),this.createElement("style",{id:"customcss",target:this.bdHead})}static escapeID(e){return e.replace(/^[^a-z]+|[^\w-]+/gi,"-")}static getElement(e,t=document){return e instanceof Node?e:t.querySelector(e)}static createElement(e,t={}){const{className:s,id:n,target:i}=t,o=document.createElement(e);return s&&(o.className=s),n&&(o.id=n),i&&this.getElement(i).append(o),o}static removeStyle(e){e=this.escapeID(e);const t=this.getElement(`#${e}`,this.bdStyles);t&&t.remove()}static injectStyle(e,t){e=this.escapeID(e);const s=this.getElement(`#${e}`,this.bdStyles)||this.createElement("style",{id:e});s.textContent=t,this.bdStyles.append(s)}static removeTheme(e){e=this.escapeID(e);const t=this.getElement(`#${e}`,this.bdThemes);t&&t.remove()}static injectTheme(e,t){e=this.escapeID(e);const s=this.getElement(`#${e}`,this.bdThemes)||this.createElement("style",{id:e});s.textContent=t,this.bdThemes.append(s)}static updateCustomCSS(e){this.bdCustomCSS.textContent=e}static removeScript(e){e=this.escapeID(e);const t=this.getElement(`#${e}`,this.bdScripts);t&&t.remove()}static injectScript(e,t){return e=this.escapeID(e),new Promise(s=>{const n=this.getElement(`#${e}`,this.bdScripts)||this.createElement("script",{id:e});n.src=t,n.onload=s,this.bdScripts.append(n)})}}class k extends String{format(e){return c.formatString(this,e)}}var M=new Proxy(P.strings,{get:function(e,t){return e.hasOwnProperty(t)?new Proxy(e[t],{get:function(e,t){return"string"==typeof e[t]?new k(e[t]):e[t]}}):new Proxy({},{get:function(){return`String group "${t}" not found.`}})}}),A=new class{constructor(){this.state={},this.collections=[],this.panels=[],this.updateStrings=this.updateStrings.bind(this)}initialize(){this.registerCollection("settings","Settings",r),g.on("strings-updated",this.updateStrings)}registerCollection(e,t,s,n=null){if(this.collections.find(t=>t.id==e))return d.error("Settings","Already have a collection with id "+e);this.collections.push({type:"collection",id:e,name:t,settings:s,button:n}),this.setupCollection(e),this.loadCollection(e),this.updateStrings()}removeCollection(e){const t=this.collections.findIndex(t=>t.id==e);if(!t<0)return d.error("Settings","No collection with id "+e);this.collections.splice(t,1)}registerPanel(e,t,s){if(this.panels.find(t=>t.id==e))return d.error("Settings","Already have a panel with id "+e);const{element:n,onClick:i,order:o=1}=s,r={id:e,order:o,label:t,section:e};i&&(r.clickListener=i),n&&(r.element=n instanceof p.React.Component?()=>p.React.createElement(n,{}):"function"==typeof n?n:()=>n),this.panels.push(r)}removePanel(e){const t=this.panels.findIndex(t=>t.id==e);if(!t<0)return d.error("Settings","No collection with id "+e);this.panels.splice(t,1)}getPath(e,t="",s=""){return{collection:3==e.length?e[0]:t,category:3==e.length?e[1]:2==e.length?e[0]:s,setting:e[e.length-1]}}setupCollection(e){const t=this.collections.find(t=>t.id==e);if(!t)return;const s=t.settings;this.state[t.id]||(this.state[t.id]={});for(let e=0;e{const e=this.state[o.collection][o.category][o.setting];return s.enableWith?!e:e}})}}}}saveSettings(){for(const e in this.state)this.saveCollection(e)}loadSettings(){for(const e in this.state)this.loadCollection(e)}saveCollection(e){v.setData(e,this.state[e])}loadCollection(e){const t=v.getData(e);if(!t)return this.saveCollection(e);for(const s in this.state[e]){t[s]||Object.assign(t,{[s]:this.state[e][s]});for(const n in this.state[e][s]){if(null==t[s][n])continue;const i=this.getSetting(e,s,n);if("switch"==i.type&&(this.state[e][s][n]=t[s][n]),"dropdown"==i.type){i.options.some(e=>e.value==t[s][n])&&(this.state[e][s][n]=t[s][n])}}}this.saveCollection(e)}onSettingChange(e,t,s,n){this.state[e][t][s]=n,g.dispatch("setting-updated",e,t,s,n),this.saveCollection(e)}getSetting(e,t,s){return 2==arguments.length?this.collections[0].find(e=>e.id==arguments[0]).settings.find(e=>e.id==arguments[1]):this.collections.find(t=>t.id==e).settings.find(e=>e.id==t).settings.find(e=>e.id==s)}get(e,t,s){return 2==arguments.length&&(s=t,t=e,e="settings"),!(!this.state[e]||!this.state[e][t])&&this.state[e][t][s]}set(e,t,s,n){return 3==arguments.length&&(n=s,s=t,t=e,e="settings"),this.onSettingChange(e,t,s,n)}on(e,t,s,n){const i=(i,o,r,a)=>{i===e&&o===t&&r===s&&n(a)};return g.on("setting-updated",i),()=>{g.off("setting-updated",i)}}updateStrings(){for(let e=0;e"before"===e.type))try{t.callback(this,arguments)}catch(s){d.err("Patcher",`Could not fire before callback of ${e.functionName} for ${t.caller}`,s)}const s=e.children.filter(e=>"instead"===e.type);if(s.length)for(const n of s)try{const s=n.callback(this,arguments,e.originalFunction.bind(this));void 0!==s&&(t=s)}catch(t){d.err("Patcher",`Could not fire instead callback of ${e.functionName} for ${n.caller}`,t)}else t=e.originalFunction.apply(this,arguments);for(const s of e.children.filter(e=>"after"===e.type))try{const n=s.callback(this,arguments,t);void 0!==n&&(t=n)}catch(t){d.err("Patcher",`Could not fire after callback of ${e.functionName} for ${s.caller}`,t)}return t}}static rePatch(e){e.proxyFunction=e.module[e.functionName]=this.makeOverride(e)}static makePatch(e,t,s){const n={name:s,module:e,functionName:t,originalFunction:e[t],proxyFunction:null,revert:()=>{n.module[n.functionName]=n.originalFunction,n.proxyFunction=null,n.children=[]},counter:0,children:[]};return n.proxyFunction=e[t]=this.makeOverride(n),this.patches.push(n),n}static before(e,t,s,n,i={}){return this.pushChildPatch(e,t,s,n,Object.assign(i,{type:"before"}))}static after(e,t,s,n,i={}){return this.pushChildPatch(e,t,s,n,Object.assign(i,{type:"after"}))}static instead(e,t,s,n,i={}){return this.pushChildPatch(e,t,s,n,Object.assign(i,{type:"instead"}))}static pushChildPatch(e,t,s,n,i={}){const{type:o="after",forcePatch:r=!0}=i,a=this.resolveModule(t);if(!a)return null;if(!a[s]&&r&&(a[s]=function(){}),!(a[s]instanceof Function))return null;"string"==typeof t&&(i.displayName=t);const l=`${i.displayName||a.displayName||a.name||a.constructor.displayName||a.constructor.name}.${s}`,d=this.patches.find(e=>e.module==a&&e.functionName==s)||this.makePatch(a,s,l);d.proxyFunction||this.rePatch(d);const c={caller:e,type:o,id:d.counter,callback:n,unpatch:()=>{if(d.children.splice(d.children.findIndex(e=>e.id===c.id&&e.type===o),1),d.children.length<=0){const e=this.patches.findIndex(e=>e.module==a&&e.functionName==s);this.patches[e].revert(),this.patches.splice(e,1)}}};return d.children.push(c),d.counter++,c.unpatch}}const T=p.React,B={},L=new Set,j=new Set;var z=new class{get named(){return B}get unknown(){return L}get listeners(){return j}constructor(){F.after("ReactComponents",T,"createElement",(e,t,s)=>{this.walkRenderTree(s)}),F.instead("ReactComponents",T.Component.prototype,"componentWillMount",e=>{this.addComponent(e.constructor)}),F.instead("ReactComponents",T.Component.prototype,"UNSAFE_componentWillMount",e=>{this.addComponent(e.constructor)}),F.instead("ReactComponents",T.PureComponent.prototype,"componentWillMount",e=>{this.addComponent(e.constructor)}),F.instead("ReactComponents",T.PureComponent.prototype,"UNSAFE_componentWillMount",e=>{this.addComponent(e.constructor)})}initialize(){this.walkReactTree(document.querySelector("#app-mount")._reactRootContainer._internalRoot.current)}get(e,t){return new Promise(s=>{if(B[e])return s(B[e]);if(j.add({name:e,filter:t,resolve:s}),t)for(const s of L)t(s)&&(s.displayName=e,L.delete(s),this.addNamedComponent(s))})}addNamedComponent(e){const t=e.displayName;if(!B[t]){B[t]=e;for(const s of j)s.name===t&&(s.resolve(e),j.delete(s))}}addUnknownComponent(e){if(!L.has(e)){for(const t of j)t.filter&&t.filter(e)&&(e.displayName=t.name,this.addNamedComponent(e));e.displayName||L.add(e)}}addComponent(e){return e.displayName?this.addNamedComponent(e):this.addUnknownComponent(e)}walkRenderTree(e){if(e){if("function"==typeof e.type&&this.addComponent(e.type),Array.isArray(e))for(const t of e)this.walkRenderTree(t);e.props&&e.props.children&&this.walkRenderTree(e.props.children)}}walkReactTree(e){e&&("function"==typeof e.type&&this.addComponent(e.type),e.child&&this.walkReactTree(e.child),e.sibling&&this.walkReactTree(e.sibling))}};const O=p.React,R=(p.ReactDOM,u.getByProps("channels").channels.split(" ")[0]),I=u.getByProps("membersWrap").membersWrap.split(" ")[0];class _{static get shouldShowToasts(){return A.get("settings","general","showToasts")}static async success(e,t={}){return this.show(e,Object.assign(t,{type:"success"}))}static async info(e,t={}){return this.show(e,Object.assign(t,{type:"info"}))}static async warning(e,t={}){return this.show(e,Object.assign(t,{type:"warning"}))}static async error(e,t={}){return this.show(e,Object.assign(t,{type:"error"}))}static async default(e,t={}){return this.show(e,Object.assign(t,{type:""}))}static show(e,t={}){const{type:s="",icon:n=!0,timeout:i=3e3,forceShow:o=!1}=t;if(!this.shouldShowToasts&&!o)return;this.ensureContainer();const r=document.createElement("div");r.classList.add("bd-toast"),s&&r.classList.add("toast-"+s),s&&n&&r.classList.add("icon"),r.innerText=e,document.querySelector(".bd-toasts").appendChild(r),setTimeout(()=>{r.classList.add("closing"),setTimeout(()=>{r.remove(),document.querySelectorAll(".bd-toasts .bd-toast").length||document.querySelector(".bd-toasts").remove()},300)},i)}static ensureContainer(){if(document.querySelector(".bd-toasts"))return;const e=document.querySelector(`.${R} + div`),t=e.querySelector(`.${I}`),s=e?e.querySelector("form"):null,n=e?e.getBoundingClientRect().left:310,i=t?t.getBoundingClientRect().left:0,o=i?i-e.getBoundingClientRect().left:e.offsetWidth,r=s?s.offsetHeight:80,a=document.createElement("div");a.classList.add("bd-toasts"),a.style.setProperty("left",n+"px"),a.style.setProperty("width",o+"px"),a.style.setProperty("bottom",r+"px"),document.querySelector("#app-mount").appendChild(a)}}class q extends O.Component{constructor(e){super(e),this.onClick=this.onClick.bind(this),this.state={checked:this.props.checked||!1}}render(){return O.createElement("div",{className:"checkbox-item"},O.createElement("div",{className:"checkbox-label label-JWQiNe da-label"},this.props.text),O.createElement("div",{className:"checkbox-wrapper checkbox-3kaeSU da-checkbox checkbox-3EVISJ da-checkbox",onClick:this.onClick},O.createElement("div",{className:"checkbox-inner checkboxInner-3yjcPe da-checkboxInner"},O.createElement("input",{className:"checkbox checkboxElement-1qV33p da-checkboxElement",checked:this.state.checked,type:"checkbox"}),O.createElement("span",null)),O.createElement("span",null)))}onClick(){this.props.onChange(!this.state.checked),this.setState({checked:!this.state.checked})}}function H(){return(H=Object.assign||function(e){for(var t=1;t{for(const s of e){if(!(s.addedNodes.length&&s.addedNodes[0]instanceof Element))continue;const e=s.addedNodes[0];e.parentElement===document.body&&e.querySelector("#ace_settingsmenu")&&(e.id="ace_settingsmenu_container",t.disconnect())}});t.observe(document.body,{childList:!0})};const t=this.props.theme==V.defaultProps.theme?this.props.theme.split("-")[1]:this.props.theme;this.editor.setTheme(`ace/theme/${t}`),this.editor.session.setMode(`ace/mode/${this.props.language}`),this.editor.setShowPrintMargin(!1),this.editor.setFontSize(this.props.fontSize),this.editor.on("change",this.onChange)}componentWillUnmount(){this.editor.destroy()}get value(){return this.editor.session.getValue()}set value(e){this.editor.setValue(e)}onChange(){this.props.onChange&&this.props.onChange(this.value)}showSettings(){return this.editor.keyBinding.$defaultHandler.commands.showSettingsMenu.exec(this.editor)}resize(){return this.editor.resize()}buildControl(e){return"checkbox"==e.type?this.makeCheckbox(e):this.makeButton(e)}makeCheckbox(e){return O.createElement(q,{text:e.label,onChange:e.onChange,checked:e.checked})}makeButton(e){return O.createElement(U,{color:"black",position:"top",text:e.tooltip},t=>O.createElement("button",H({},t,{className:"btn btn-primary",onClick:t=>{e.onClick(t,this.value)}}),e.label))}render(){this.editor&&this.editor.resize&&this.editor.resize();const e=this.props.controls.filter(e=>"right"!=e.side).map(this.buildControl.bind(this)),t=this.props.controls.filter(e=>"right"==e.side).map(this.buildControl.bind(this));return O.createElement("div",{id:"bd-editor-panel",className:this.props.theme},O.createElement("div",{id:"bd-editor-controls"},O.createElement("div",{className:"controls-section controls-left"},e),O.createElement("div",{className:"controls-section controls-right"},t)),O.createElement("div",{className:"editor-wrapper"},O.createElement("div",{id:this.props.id,className:"editor "+this.props.theme},this.props.value)))}}class J extends O.Component{render(){const e=this.props.size||"24px";return O.createElement("svg",{viewBox:"0 0 24 24",style:{width:e,height:e}},O.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),O.createElement("path",{d:"M17 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V7l-4-4zm2 16H5V5h11.17L19 7.83V19zm-7-7c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3zM6 6h9v4H6z"}))}}class Z extends O.Component{render(){const e=this.props.size||"24px";return O.createElement("svg",{viewBox:"0 0 24 24",fill:"#FFFFFF",style:{width:e,height:e},onClick:this.props.onClick},O.createElement("path",{d:"M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34c-.39-.39-1.02-.39-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z"}),O.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}))}}class Y extends O.Component{render(){const e=this.props.size||"20px";return O.createElement("svg",{viewBox:"0 0 20 20",style:{width:e,height:e}},O.createElement("path",{fill:"none",d:"M0 0h20v20H0V0z"}),O.createElement("path",{d:"M15.95 10.78c.03-.25.05-.51.05-.78s-.02-.53-.06-.78l1.69-1.32c.15-.12.19-.34.1-.51l-1.6-2.77c-.1-.18-.31-.24-.49-.18l-1.99.8c-.42-.32-.86-.58-1.35-.78L12 2.34c-.03-.2-.2-.34-.4-.34H8.4c-.2 0-.36.14-.39.34l-.3 2.12c-.49.2-.94.47-1.35.78l-1.99-.8c-.18-.07-.39 0-.49.18l-1.6 2.77c-.1.18-.06.39.1.51l1.69 1.32c-.04.25-.07.52-.07.78s.02.53.06.78L2.37 12.1c-.15.12-.19.34-.1.51l1.6 2.77c.1.18.31.24.49.18l1.99-.8c.42.32.86.58 1.35.78l.3 2.12c.04.2.2.34.4.34h3.2c.2 0 .37-.14.39-.34l.3-2.12c.49-.2.94-.47 1.35-.78l1.99.8c.18.07.39 0 .49-.18l1.6-2.77c.1-.18.06-.39-.1-.51l-1.67-1.32zM10 13c-1.65 0-3-1.35-3-3s1.35-3 3-3 3 1.35 3 3-1.35 3-3 3z"}))}}class K extends O.Component{constructor(e){super(e),this.hasUnsavedChanges=!1,this.onChange=this.onChange.bind(this),this.save=this.save.bind(this),this.openNative=this.openNative.bind(this),this.update=this.update.bind(this),this.controls=[{label:O.createElement(J,{size:"18px"}),tooltip:M.CustomCSS.save,onClick:this.save},{label:O.createElement(Z,{size:"18px"}),tooltip:M.CustomCSS.openNative,onClick:this.openNative},{label:O.createElement(Y,{size:"18px"}),tooltip:M.CustomCSS.settings,onClick:"showSettings"}]}update(){this.forceUpdate()}updateEditor(e){this.editor&&(this.editor.value=e)}get value(){return this.editor.session.getValue()}set value(e){this.editor.setValue(e)}showSettings(){return this.editor.keyBinding.$defaultHandler.commands.showSettingsMenu.exec(this.editor)}resize(){return this.editor.resize()}setEditorRef(e){this.editor=e,this.props.editorRef&&void 0!==this.props.editorRef.current?this.props.editorRef.current=e:this.props.editorRef&&(this.props.editorRef=e)}render(){return O.createElement(V,{ref:this.setEditorRef.bind(this),language:this.props.language,id:this.props.id||"bd-addon-editor",controls:this.controls,value:this.props.content,onChange:this.onChange})}onChange(){this.hasUnsavedChanges=!0}save(e,t){this.hasUnsavedChanges=!1,this.props.save&&this.props.save(t)}openNative(){this.props.openNative&&this.props.openNative()}}class X{static get width(){return Math.max(document.documentElement.clientWidth,window.innerWidth||0)}static get height(){return Math.max(document.documentElement.clientHeight,window.innerHeight||0)}}class Q extends O.Component{render(){return O.createElement("svg",{viewBox:"0 0 12 12",style:{width:"18px",height:"18px"}},O.createElement("g",{className:"background",fill:"none",fillRule:"evenodd"},O.createElement("path",{d:"M0 0h12v12H0"}),O.createElement("path",{className:"fill",fill:"#dcddde",d:"M9.5 3.205L8.795 2.5 6 5.295 3.205 2.5l-.705.705L5.295 6 2.5 8.795l.705.705L6 6.705 8.795 9.5l.705-.705L6.705 6"})))}}class ee extends O.Component{render(){const e=this.props.size||"24px";return O.createElement("svg",{className:this.props.className||"",fill:"#FFFFFF",viewBox:"0 0 24 24",style:{width:e,height:e},onClick:this.props.onClick},O.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),O.createElement("path",{d:"M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z"}))}}class te{static get shouldShowAddonErrors(){return A.get("settings","addons","addonErrors")}static get ModalStack(){return u.getByProps("push","update","pop","popWithKey")}static get AlertModal(){return u.getByPrototypes("handleCancel","handleSubmit","handleMinorConfirm")}static get TextElement(){return u.getByProps("Sizes","Weights")}static get ConfirmationModal(){return u.getModule(e=>e.defaultProps&&e.key&&"confirm-modal"==e.key())}static default(e,t){const s=u.getByProps("backdrop")||{backdrop:"backdrop-1wrmKb"},n=u.getModule(e=>e.modal&&e.inner&&!e.sizeMedium)||{modal:"modal-36zFtW",inner:"inner-2VEzy9"},i=u.getByProps("sizeMedium")||{modal:"backdrop-1wrmKb",sizeMedium:"sizeMedium-ctncE5",content:"content-2KoCOZ",header:"header-2nhbou",footer:"footer-30ewN8",close:"close-hhyjWJ",inner:"inner-2Z5QZX"},o=c.parseHTML(`
\n
\n
\n
\n
\n
${e}
\n
\n
\n
\n
\n ${t}\n
\n
\n
\n \n
\n
\n
`);o.querySelector(".footer button").addEventListener("click",()=>{o.addClass("closing"),setTimeout(()=>{o.remove()},300)}),o.querySelector(".bd-backdrop").addEventListener("click",()=>{o.addClass("closing"),setTimeout(()=>{o.remove()},300)}),document.querySelector("#app-mount").append(o)}static alert(e,t){if(this.ModalStack&&this.AlertModal)return this.default(e,t);this.ModalStack.push(function(s){return O.createElement(this.AlertModal,Object.assign({title:e,body:t},s))})}static showConfirmationModal(e,t,s={}){const n=this.TextElement,i=this.ConfirmationModal,o=this.ModalStack;if(!this.ModalStack||!this.ConfirmationModal||!this.TextElement)return this.alert(e,t);const{onConfirm:r,onCancel:a,confirmText:l,cancelText:d,danger:c=!1}=s;"string"==typeof t?t=n.default({color:n.Colors.PRIMARY,children:[t]}):Array.isArray(t)&&(t=n.default({color:n.Colors.PRIMARY,children:t})),t=[t];const h=()=>{};o.push(function(s){return O.createElement(i,Object.assign({header:e,children:t,red:c,confirmText:l||M.Modals.okay,cancelText:d||M.Modals.cancel,onConfirm:r||h,onCancel:a||h},s))})}static showAddonErrors({plugins:e=[],themes:t=[]}){if(!e||!t||!this.shouldShowAddonErrors)return;if(!e.length&&!t.length)return;const s=u.getByProps("backdrop")||{backdrop:"backdrop-1wrmKb"},n=u.getModule(e=>e.modal&&e.inner&&!e.sizeMedium)||{modal:"modal-36zFtW",inner:"inner-2VEzy9"},i=u.getByProps("sizeMedium")||{modal:"modal-3v8ziU",sizeMedium:"sizeMedium-ctncE5",content:"content-2KoCOZ",header:"header-2nhbou",footer:"footer-30ewN8",close:"close-hhyjWJ",inner:"inner-2Z5QZX"},o=$(`
\n
\n
\n
\n
${M.Modals.addonErrors}
\n
\n
\n
\n
${M.Panels.plugins}
\n
${M.Panels.themes}
\n
\n
\n
\n
${M.Modals.name}
\n
${M.Modals.message}
\n
${M.Modals.error}
\n
\n
\n
\n\n
\n
\n
\n \n
\n
\n
`),r=function(e){const t=$('
');for(const s of e){const e=$(`
\n
${s.name?s.name:s.file}
\n
${s.message}
\n \n
`);t.append(e),s.error&&e.find("a").on("click",e=>{e.preventDefault(),d.stacktrace("AddonError",`Error details for ${s.name?s.name:s.file}.`,s.error)})}return t},a=[r(e),r(t)];o.find(".tab-bar-item").on("click",e=>{e.preventDefault(),o.find(".tab-bar-item").removeClass("selected"),$(e.target).addClass("selected"),o.find(".scroller").empty().append(a[$(e.target).index()])}),o.find(".footer button").on("click",()=>{o.addClass("closing"),setTimeout(()=>{o.remove()},300)}),o.find(".bd-backdrop").on("click",()=>{o.addClass("closing"),setTimeout(()=>{o.remove()},300)}),o.appendTo("#app-mount"),e.length?o.find(".tab-bar-item")[0].click():o.find(".tab-bar-item")[1].click()}}class se extends O.Component{constructor(e){super(e),this.state={modalOpen:!1},this.offX=0,this.offY=0,this.titlebar=O.createRef(),this.window=O.createRef(),this.close=this.close.bind(this),this.maximize=this.maximize.bind(this),this.onDrag=this.onDrag.bind(this),this.onDragStart=this.onDragStart.bind(this),this.onDragStop=this.onDragStop.bind(this),this.onResizeStart=this.onResizeStart.bind(this)}componentDidMount(){this.window.current.addEventListener("mousedown",this.onResizeStart,!1),this.titlebar.current.addEventListener("mousedown",this.onDragStart,!1),document.addEventListener("mouseup",this.onDragStop,!1)}onResizeStart(){this.currentWidth=this.window.current.style.width,this.currentHeight=this.window.current.style.height}onDragStop(){if(document.removeEventListener("mousemove",this.onDrag,!0),this.props.onResize){const e=this.window.current.style.width,t=this.window.current.style.height;e==this.currentWidth&&t==this.currentHeight||this.props.onResize(),this.currentWidth=e,this.currentHeight=t}}onDragStart(e){const t=this.window.current;this.offY=e.clientY-parseInt(t.offsetTop),this.offX=e.clientX-parseInt(t.offsetLeft),document.addEventListener("mousemove",this.onDrag,!0)}onDrag(e){const t=this.window.current;t.style.top=e.clientY-this.offY+"px",t.style.left=e.clientX-this.offX+"px"}componentWillUnmount(){this.titlebar.current.removeEventListener("mousedown",this.onDragStart,!1),document.removeEventListener("mouseup",this.onDragStop,!1)}render(){const e=this.props.center?X.height/2-this.props.height/2:this.props.top,t=this.props.center?X.width/2-this.props.width/2:this.props.left,s=`floating-window${` ${this.props.className}`||""}${this.props.resizable?" resizable":""}${this.state.modalOpen?" modal-open":""}`,n={height:this.props.height,width:this.props.width,left:t||0,top:e||0};return O.createElement("div",{id:this.props.id,className:s,ref:this.window,style:n},O.createElement("div",{className:"floating-window-titlebar",ref:this.titlebar},O.createElement("span",{className:"title"},this.props.title),O.createElement("div",{className:"floating-window-buttons"},O.createElement("div",{className:"button maximize-button",onClick:this.maximize},O.createElement(ee,{size:"18px"})),O.createElement("div",{className:"button close-button",onClick:this.close},O.createElement(Q,null)))),O.createElement("div",{className:"floating-window-content"},this.props.children))}async close(){let e=!0;("function"==typeof this.props.confirmClose?this.props.confirmClose():this.props.confirmClose)&&(this.setState({modalOpen:!0}),e=await this.confirmClose(),this.setState({modalOpen:!1})),this.props.close&&e&&this.props.close()}maximize(){this.window.current.style.width="100%",this.window.current.style.height="100%",this.window.current.style.top="20px",this.window.current.style.left="0px",this.props.onResize&&this.props.onResize()}confirmClose(){return new Promise(e=>{te.showConfirmationModal(M.Modals.confirmAction,this.props.confirmationText,{danger:!0,confirmText:M.Modals.close,onConfirm:()=>{e(!0)},onCancel:()=>{e(!1)}})})}}function ne(){return(ne=Object.assign||function(e){for(var t=1;tO.createElement(se,ne({},e,{close:this.close.bind(this,e.id)}),e.children))}open(e){this.setState({windows:[...this.state.windows,e]})}close(e){this.setState({windows:this.state.windows.filter(t=>(t.id==e&&t.onClose&&t.onClose(),t.id!=e))})}static get id(){return"floating-windows"}static get root(){if(this._root)return this._root;const e=document.createElement("div");return e.id=this.id,document.body.append(e),this._root=e}},{ref:ie}),re=c.findInReactTree(c.getReactInstance(document.querySelector(".app-19_DXt")),e=>e&&e.type&&e.type.displayName&&"App"==e.type.displayName);F.after("FloatingContainer",re.type.prototype,"render",(e,t,s)=>{c.findInRenderTree(s,e=>e&&e[5]&&e[5].type&&"LayerContainer"==e[5].type.displayName,{walkable:["children","props"]}).push(oe)}),re.stateNode.forceUpdate();var ae=ie.current;const le=p.React,de=s(2),ce=s(1),he=s(4).Module;he.globalPaths.push(de.resolve(s(0).remote.app.getAppPath(),"node_modules"));const ue=/[^\S\r\n]*?\r?\n[^\S\r\n]*?\*[^\S\r\n]?/,pe=/^\\@/,me=function(e){return 65279===e.charCodeAt(0)&&(e=e.slice(1)),e};class ge{get name(){return""}get moduleExtension(){return""}get extension(){return""}get addonFolder(){return""}get language(){return""}get prefix(){return"addon"}get collection(){return"settings"}get category(){return"addons"}get id(){return"autoReload"}emit(e,...t){return g.emit(`${this.prefix}-${e}`,...t)}constructor(){this.timeCache={},this.addonList=[],this.state={}}initialize(){return this.originalRequire=he._extensions[this.moduleExtension],he._extensions[this.moduleExtension]=this.getAddonRequire(),A.on(this.collection,this.category,this.id,e=>{e?this.watchAddons():this.unwatchAddons()}),this.loadAllAddons()}initializeAddon(){}getFileModification(e,t){return t}startAddon(){}stopAddon(){}loadState(){const e=v.getData(`${this.prefix}s`);e&&Object.assign(this.state,e)}saveState(){v.setData(`${this.prefix}s`,this.state)}watchAddons(){if(this.watcher)return d.error(this.name,`Already watching ${this.prefix} addons.`);d.log(this.name,`Starting to watch ${this.prefix} addons.`),this.watcher=ce.watch(this.addonFolder,{persistent:!1},async(e,t)=>{if(!e||!t||!t.endsWith(this.extension))return;await new Promise(e=>setTimeout(e,50));try{ce.statSync(de.resolve(this.addonFolder,t))}catch(e){if("ENOENT"!==e.code)return;delete this.timeCache[t],this.unloadAddon(t,!0)}if(!ce.statSync(de.resolve(this.addonFolder,t)).isFile())return;const s=ce.statSync(de.resolve(this.addonFolder,t));s&&s.mtime&&s.mtime.getTime()&&"number"==typeof s.mtime.getTime()&&this.timeCache[t]!=s.mtime.getTime()&&(this.timeCache[t]=s.mtime.getTime(),"rename"==e&&this.loadAddon(t,!0),"change"==e&&this.reloadAddon(t,!0))})}unwatchAddons(){if(!this.watcher)return d.error(this.name,`Was not watching ${this.prefix} addons.`);this.watcher.close(),delete this.watcher,d.log(this.name,`No longer watching ${this.prefix} addons.`)}extractMeta(e){const t=e.split("\n")[0];if(t.includes("//META"))return this.parseOldMeta(e);if(t.includes("/**"))return this.parseNewMeta(e);throw new N("META was not found.")}parseOldMeta(e){const t=e.split("\n")[0],s=t.substring(t.lastIndexOf("//META")+6,t.lastIndexOf("*//")),n=c.testJSON(s);if(!n)throw new N("META could not be parsed.");if(!n.name)throw new N("META missing name data.");return n}parseNewMeta(e){const t=e.split("/**",2)[1].split("*/",1)[0],s={};let n="",i="";for(const e of t.split(ue))if(0!==e.length)if("@"===e.charAt(0)&&" "!==e.charAt(1)){s[n]=i;const t=e.indexOf(" ");n=e.substr(1,t-1),i=e.substr(t+1)}else i+=" "+e.replace("\\n","\n").replace(pe,"@");return s[n]=i.trim(),delete s[""],s}getAddonRequire(){const e=this,t=this.originalRequire;return function(s,n){const i=de.resolve(e.addonFolder,de.basename(n));if(!ce.existsSync(i)||n!==ce.realpathSync(i))return Reflect.apply(t,this,arguments);let o=ce.readFileSync(n,"utf8");o=me(o);const r=ce.statSync(n),a=e.extractMeta(o);a.id=a.name,a.filename=de.basename(n),a.added=r.atimeMs,a.modified=r.mtimeMs,a.size=r.size,o=e.getFileModification(s,o,a),s._compile(o,n)}}loadAddon(e,t=!1){if(void 0===e)return;try{require(de.resolve(this.addonFolder,e))}catch(n){return new D(e,e,"Could not be compiled.",{message:n.message,stack:n.stack})}const s=require(de.resolve(this.addonFolder,e));if(this.addonList.find(e=>e.id==s.id))return new D(s.name,e,`There is already a plugin with name ${s.name}`);const n=this.initializeAddon(s);return n||(this.addonList.push(s),t&&_.success(`${s.name} v${s.version} was loaded.`),this.emit("loaded",s.id),this.state[s.id]?this.startAddon(s):this.state[s.id]=!1)}unloadAddon(e,t=!0,s=!1){const n="string"==typeof e?this.addonList.find(t=>t.id==e||t.filename==e):e;return!!n&&(this.state[n.id]&&(s?this.stopAddon(n):this.disableAddon(n)),delete require.cache[require.resolve(de.resolve(this.addonFolder,n.filename))],this.addonList.splice(this.addonList.indexOf(n),1),this.emit("unloaded",n.id),t&&_.success(`${n.name} was unloaded.`),!0)}reloadAddon(e,t=!0){const s="string"==typeof e?this.addonList.find(t=>t.id==e||t.filename==e):e,n=this.unloadAddon(s,t,!0);return n?this.loadAddon(s.filename,t):n}isLoaded(e){return!!this.addonList.find(t=>t.id==e||t.filename==e)}isEnabled(e){const t=this.addonList.find(t=>t.id==e||t.filename==e);return!!t&&this.state[t.id]}enableAddon(e){const t="string"==typeof e?this.addonList.find(t=>t.id==e):e;t&&(this.state[t.id]||(this.state[t.id]=!0,this.startAddon(t),this.saveState()))}disableAddon(e){const t="string"==typeof e?this.addonList.find(t=>t.id==e):e;t&&this.state[t.id]&&(this.state[t.id]=!1,this.stopAddon(t),this.saveState())}toggleAddon(e){this.state[e]?this.disableAddon(e):this.enableAddon(e)}loadNewAddons(){const e=ce.readdirSync(this.addonFolder),t=this.addonList.filter(t=>!e.includes(t.filename)).map(e=>e.id);return{added:e.filter(e=>!this.addonList.find(t=>t.filename==e)&&e.endsWith(this.extension)&&ce.statSync(de.resolve(this.addonFolder,e)).isFile()),removed:t}}updateList(){const e=this.loadNewAddons();for(const t of e.added)this.loadAddon(t);for(const t of e.removed)this.unloadAddon(t)}loadAllAddons(){this.loadState();const e=[],t=ce.readdirSync(this.addonFolder);for(const s of t){if(!ce.statSync(de.resolve(this.addonFolder,s)).isFile()||!s.endsWith(this.extension))continue;const t=this.loadAddon(s,!1);t instanceof D&&e.push(t)}return this.saveState(),A.get(this.collection,this.category,this.id)&&this.watchAddons(),e}deleteAddon(e){const t="string"==typeof e?this.addonList.find(t=>t.id==e||t.filename==e):e;return ce.unlinkSync(de.resolve(this.addonFolder,t.filename))}saveAddon(e,t){const s="string"==typeof e?this.addonList.find(t=>t.id==e||t.filename==e):e;return ce.writeFileSync(de.resolve(this.addonFolder,s.filename),t)}editAddon(e,t){const n="string"==typeof e?this.addonList.find(t=>t.id==e||t.filename==e):e,i=de.resolve(this.addonFolder,n.filename);return void 0===t&&(t="system"==A.get("settings","addons","editAction")),t?s(0).shell.openItem(`${i}`):this.openDetached(n)}openDetached(e){const t=de.resolve(this.addonFolder,e.filename),s=ce.readFileSync(t).toString(),n=le.createRef(),i=le.createElement(K,{id:"bd-floating-editor-"+e.name,ref:n,content:s,save:this.saveAddon.bind(this,e),openNative:this.editAddon.bind(this,e,!0),language:this.language});ae.open({onClose:()=>{this.isDetached=!1},onResize:()=>{n&&n.current&&n.current.resize&&n.current.resize()},title:e.name,id:s.id,className:"floating-addon-window",height:470,width:410,center:!0,resizable:!0,children:i,confirmClose:()=>!(!n||!n.current)&&n.current.hasUnsavedChanges,confirmationText:M.Addons.confirmationText.format({name:e.name})})}}const fe="bd-settings-title h2-2gWE-o title-3sZWYQ size16-14cGz5 height20-mO2eIN weightSemiBold-NJexzi defaultColor-1_ajX0 defaultMarginh2-2LTaUL marginBottom20-32qID7",be="bd-settings-title bd-settings-group-title h5-18_1nd title-3sZWYQ size12-3R0845 height16-2Lv3qA weightSemiBold-NJexzi da-h5 da-title da-size12 da-height16 da-weightSemiBold marginBottom4-2qk4Hy da-marginBottom4 marginTop8-1DLZ1n da-marginTop8";class ye extends O.Component{constructor(e){super(e)}render(){const e=this.props.isGroup?be:fe,t=this.props.className?`${e} ${this.props.className}`:e;return O.createElement("h2",{className:t,onClick:()=>{this.props.onClick&&this.props.onClick()}},this.props.text,this.props.button&&O.createElement("button",{className:"bd-button bd-button-title",onClick:this.props.button.onClick},this.props.button.title),this.props.otherChildren)}}class ve extends O.Component{render(){const e=this.props.size||"24px";return O.createElement("svg",{className:this.props.className||"",onClick:this.props.onClick,fill:"#dcddde",viewBox:"0 0 24 24",style:{width:e,height:e}},O.createElement("path",{d:"M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4l-2.35 2.35z"}),O.createElement("path",{fill:"none",d:"M0 0h24v24H0z"}))}}class we extends O.Component{render(){const e=this.props.size||"24px";return O.createElement("svg",{className:this.props.className||"",fill:"#FFFFFF",viewBox:"0 0 24 24",style:{width:e,height:e},onClick:this.props.onClick},O.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),O.createElement("path",{d:"M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zm2.46-7.12l1.41-1.41L12 12.59l2.12-2.12 1.41 1.41L13.41 14l2.12 2.12-1.41 1.41L12 15.41l-2.12 2.12-1.41-1.41L10.59 14l-2.13-2.12zM15.5 4l-1-1h-5l-1 1H5v2h14V4z"}),O.createElement("path",{fill:"none",d:"M0 0h24v24H0z"}))}}class Ce extends O.Component{constructor(e){super(e),this.state={checked:this.props.checked},this.onChange=this.onChange.bind(this)}onChange(){this.props.disabled||(this.props.onChange(!this.state.checked),this.setState({checked:!this.state.checked}))}render(){const e=this.props.disabled?" bd-switch-disabled":"",t=this.state.checked?" bd-switch-checked":"";return O.createElement("div",{className:"bd-switch"+e+t},O.createElement("input",{type:"checkbox",id:this.props.id,className:"bd-checkbox",disabled:this.props.disabled,checked:this.state.checked,onChange:this.onChange}))}}function Se(){return(Se=Object.assign||function(e){for(var t=1;t{const s=e.scrollTop,n=s+e.clientHeight,i=t.offsetTop,o=i+t.clientHeight;return in})(t[0],e[0])&&t.animate({scrollTop:e.offset().top-t.offset().top+t.scrollTop()-30},300)}getString(e){return"string"==typeof e?e:e.toString()}onChange(){this.props.onChange&&this.props.onChange(this.props.addon.id),this.props.enabled=!this.props.enabled}showSettings(){this.props.hasSettings&&this.setState({settingsOpen:!0})}closeSettings(){this.panelRef.current.innerHTML="",this.setState({settingsOpen:!1})}buildTitle(e,t,s){const n=M.Addons.title.split(/({{[A-Za-z]+}})/),i=n.findIndex(e=>"{{name}}"==e);i&&(n[i]=O.createElement("span",{className:"bd-name"},e));const o=n.findIndex(e=>"{{version}}"==e);i&&(n[o]=O.createElement("span",{className:"bd-version"},t));const r=n.findIndex(e=>"{{author}}"==e);return i&&(n[r]=O.createElement("span",{className:"bd-author"},s)),n.flat()}get settingsComponent(){const e=this.props.addon,t=this.getString(e.name);try{this.settingsPanel=this.props.getSettingsPanel()}catch(e){d.stacktrace("Addon Settings","Unable to get settings panel for "+t+".",e)}const s={id:`${t}-settings`,className:"addon-settings",ref:this.panelRef};return"string"==typeof settingsPanel&&(s.dangerouslySetInnerHTML=this.settingsPanel),O.createElement("div",{className:"bd-addon-card settings-open bd-switch-item"},O.createElement("div",{className:"bd-close",onClick:this.closeSettings},O.createElement(Q,null)),O.createElement("div",s,this.settingsPanel instanceof O.Component?this.settingsPanel:null))}buildLink(e){const t=this.props.addon[e];return t?O.createElement("a",{className:"bd-link bd-link-website",href:t,target:"_blank",rel:"noopener noreferrer"},M.Addons[e]):null}get footer(){const e=["website","source"];if(!e.some(e=>this.props.addon[e])&&!this.props.hasSettings)return null;const t=e.map(this.buildLink.bind(this)).filter(e=>e);return O.createElement("div",{className:"bd-footer"},O.createElement("span",{className:"bd-links"},t.map((e,s)=>sO.createElement("div",Se({},e,{className:"bd-addon-button",onClick:s}),t))}render(){if(this.state.settingsOpen)return this.settingsComponent;const e=this.props.addon,t=this.getString(e.name),s=this.getString(e.author),n=this.getString(e.description),i=this.getString(e.version);return O.createElement("div",{id:`${e.id}-card`,className:"bd-addon-card settings-closed"},O.createElement("div",{className:"bd-addon-header"},O.createElement("span",{className:"bd-title"},this.buildTitle(t,i,s)),O.createElement("div",{className:"bd-controls"},this.props.editAddon&&this.makeButton(M.Addons.editAddon,O.createElement(Z,null),this.props.editAddon),this.props.deleteAddon&&this.makeButton(M.Addons.deleteAddon,O.createElement(we,null),this.props.deleteAddon),this.props.showReloadIcon&&this.makeButton(M.Addons.reload,O.createElement(ve,{className:"bd-reload bd-reload-card"}),this.reload),O.createElement(Ce,{checked:this.props.enabled,onChange:this.onChange}))),O.createElement("div",{className:"bd-description-wrap scroller-wrap fade"},O.createElement("div",{className:"bd-description scroller"},n)),this.footer)}}class xe extends O.Component{render(){const e=this.props.size||"16px";return O.createElement("svg",{className:this.props.className||"",fill:"#FFFFFF",viewBox:"0 0 24 24",style:{width:e,height:e}},O.createElement("path",{d:"M8.12 9.29L12 13.17l3.88-3.88c.39-.39 1.02-.39 1.41 0 .39.39.39 1.02 0 1.41l-4.59 4.59c-.39.39-1.02.39-1.41 0L6.7 10.7c-.39-.39-.39-1.02 0-1.41.39-.38 1.03-.39 1.42 0z"}))}}class ke extends O.Component{constructor(e){super(e),this.state={open:!1,value:this.props.value||this.props.options[0].value},this.dropdown=O.createRef(),this.onChange=this.onChange.bind(this),this.showMenu=this.showMenu.bind(this),this.hideMenu=this.hideMenu.bind(this)}showMenu(e){e.preventDefault(),this.setState({open:!0},()=>{document.addEventListener("click",this.hideMenu)})}hideMenu(){this.setState({open:!1},()=>{document.removeEventListener("click",this.hideMenu)})}onChange(e){this.setState({value:e}),this.props.onChange&&this.props.onChange(e)}get selected(){return this.props.options.find(e=>e.value==this.state.value)}get options(){const e=this.selected;return O.createElement("div",{className:"bd-select-options"},this.props.options.map(t=>O.createElement("div",{className:`bd-select-option${e.value==t.value?" selected":""}`,onClick:this.onChange.bind(this,t.value)},t.label)))}render(){const e="transparent"==this.props.style?" bd-select-transparent":"",t=this.state.open?" menu-open":"";return O.createElement("div",{className:`bd-select${e}${t}`,onClick:this.showMenu,ref:this.dropdown},O.createElement("div",{className:"bd-select-value"},this.selected.label),O.createElement(xe,{className:"bd-select-arrow"}),this.state.open&&this.options)}}class Me extends O.Component{render(){const e=this.props.size||"16px";return O.createElement("svg",{className:this.props.className||"",fill:"#FFFFFF",viewBox:"0 0 24 24",style:{width:e,height:e}},O.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),O.createElement("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"}))}}class Ae extends O.Component{render(){return O.createElement("div",{className:"bd-search-wrapper"},O.createElement("input",{onChange:this.props.onChange,onKeyDown:this.props.onKeyDown,type:"text",className:"bd-search",placeholder:this.props.placeholder,maxLength:"50"}),O.createElement(Me,null))}}class De extends O.Component{constructor(e){super(e),this.state={sort:"name",ascending:!0,query:""},this.sort=this.sort.bind(this),this.reverse=this.reverse.bind(this),this.search=this.search.bind(this),this.update=this.update.bind(this)}componentDidMount(){g.on(`${this.props.prefix}-loaded`,this.update),g.on(`${this.props.prefix}-unloaded`,this.update)}componentWillUnmount(){g.off(`${this.props.prefix}-loaded`,this.update),g.off(`${this.props.prefix}-unloaded`,this.update)}update(){this.forceUpdate()}reload(){this.props.refreshList&&this.props.refreshList(),this.forceUpdate()}reverse(e){this.setState({ascending:e})}sort(e){this.setState({sort:e})}search(e){this.setState({query:e.target.value.toLocaleLowerCase()})}get sortOptions(){return[{label:M.Addons.name,value:"name"},{label:M.Addons.author,value:"author"},{label:M.Addons.version,value:"version"},{label:M.Addons.added,value:"added"},{label:M.Addons.modified,value:"modified"}]}get directions(){return[{label:M.Sorting.ascending,value:!0},{label:M.Sorting.descending,value:!1}]}render(){const{title:e,folder:t,addonList:n,addonState:i,onChange:o,reload:r}=this.props,a=!A.get("settings","addons","autoReload"),l=t?{title:M.Addons.openFolder.format({type:e}),onClick:()=>{s(0).shell.openItem(t)}}:null,d=n.sort((e,t)=>{const s=e[this.state.sort],n=t[this.state.sort];return"string"==typeof s?s.toLocaleLowerCase().localeCompare(n.toLocaleLowerCase()):s>n?1:n>s?-1:0});return this.state.ascending||d.reverse(),[O.createElement(ye,{key:"title",text:e,button:l,otherChildren:a&&O.createElement(ve,{className:"bd-reload",onClick:this.reload.bind(this)})}),O.createElement("div",{className:"bd-controls bd-addon-controls"},O.createElement(Ae,{onChange:this.search,placeholder:`${M.Addons.search.format({type:this.props.title})}...`}),O.createElement("div",{className:"bd-addon-dropdowns"},O.createElement("div",{className:"bd-select-wrapper"},O.createElement("label",{className:"bd-label"},M.Sorting.sortBy,":"),O.createElement(ke,{options:this.sortOptions,onChange:this.sort,style:"transparent"})),O.createElement("div",{className:"bd-select-wrapper"},O.createElement("label",{className:"bd-label"},M.Sorting.order,":"),O.createElement(ke,{options:this.directions,onChange:this.reverse,style:"transparent"})))),O.createElement("div",{key:"addonList",className:"bd-addon-list"},d.map(e=>{if(this.state.query){let t=e.name.toLocaleLowerCase().includes(this.state.query);if(!(t=(t=t||e.author.toLocaleLowerCase().includes(this.state.query))||e.description.toLocaleLowerCase().includes(this.state.query)))return null}const t=e.type&&"function"==typeof e.plugin.getSettingsPanel,s=t&&e.plugin.getSettingsPanel.bind(e.plugin);return O.createElement(Pe,{editAddon:this.editAddon.bind(this,e.id),deleteAddon:this.deleteAddon.bind(this,e.id),showReloadIcon:a,key:e.id,enabled:i[e.id],addon:e,onChange:o,reload:r,hasSettings:t,getSettingsPanel:s})}))]}editAddon(e){this.props.editAddon&&this.props.editAddon(e)}async deleteAddon(e){const t=this.props.addonList.find(t=>t.id==e);await this.confirmDelete(t)&&this.props.deleteAddon&&this.props.deleteAddon(t)}confirmDelete(e){return new Promise(t=>{te.showConfirmationModal(M.Modals.confirmAction,M.Addons.confirmDelete.format({name:e.name}),{danger:!0,confirmText:M.Addons.deleteAddon,onConfirm:()=>{t(!0)},onCancel:()=>{t(!1)}})})}}class Ne extends O.Component{render(){return O.createElement("div",{className:"bd-divider divider-3573oO marginTop8-1DLZ1n marginBottom40-2vIwTv"})}}class Fe extends O.Component{render(){return O.createElement("div",{className:"bd-setting-item"},O.createElement("div",{className:"bd-setting-header"},O.createElement("label",{htmlFor:this.props.id,className:"bd-setting-title"},this.props.name),this.props.children),O.createElement("div",{className:"bd-setting-note"},this.props.note),O.createElement("div",{className:"bd-setting-divider"}))}}const Te="bd-settings-group";class Be extends O.Component{constructor(e){if(super(e),this.props.button&&this.props.collapsible){const e=this.props.button.onClick;this.props.button.onClick=t=>{t.stopPropagation(),e(...arguments)}}this.props.hasOwnProperty("shown")||(this.props.shown=!0),this.container=O.createRef(),this.state={collapsed:this.props.collapsible&&!this.props.shown},this.onChange=this.onChange.bind(this),this.toggleCollapse=this.toggleCollapse.bind(this)}toggleCollapse(){const e=this.container.current,t=this.state.collapsed?300:1;e.style.setProperty("height",e.scrollHeight+"px"),e.classList.add("animating"),this.setState({collapsed:!this.state.collapsed},()=>setTimeout(()=>{e.style.setProperty("height",""),e.classList.remove("animating")},t))}onChange(e,t){this.props.onChange&&(this.props.id?this.props.onChange(this.props.id,e,t):this.props.onChange(e,t),this.forceUpdate())}render(){const{settings:e}=this.props,t=this.props.collapsible?`collapsible ${this.state.collapsed?"collapsed":"expanded"}`:"",s=`${Te} ${t}`;return O.createElement("div",{className:s},O.createElement(ye,{text:this.props.name,collapsible:this.props.collapsible,onClick:this.toggleCollapse,button:this.props.button,isGroup:!0}),O.createElement("div",{className:"bd-settings-container",ref:this.container},e.filter(e=>!e.hidden).map(e=>{let t=null;return"dropdown"==e.type&&(t=O.createElement(ke,{disabled:e.disabled,id:e.id,options:e.options,value:e.value,onChange:this.onChange.bind(this,e.id)})),"switch"==e.type&&(t=O.createElement(Ce,{disabled:e.disabled,id:e.id,checked:e.value,onChange:this.onChange.bind(this,e.id)})),t?O.createElement(Fe,{id:e.id,key:e.id,name:e.name,note:e.note},t):null})),this.props.showDivider&&O.createElement(Ne,null))}}class Le extends O.Component{buildTitle(e,t,s){const n=M.Addons.title.split(/({{[A-Za-z]+}})/),i=n.findIndex(e=>"{{name}}"==e);i&&(n[i]=e);const o=n.findIndex(e=>"{{version}}"==e);i&&(n[o]=t);const r=n.findIndex(e=>"{{author}}"==e);return i&&(n[r]=s),n.flat()}render(){return O.createElement("div",{id:"bbd-version"},this.buildTitle("BBD",i.bbdVersion,O.createElement("a",{href:"https://github.com/rauenzi",target:"_blank",rel:"noopener noreferrer"},"Zerebos")))}}var je=new class{constructor(){this.patchSections(),g.on("strings-updated",this.forceUpdate)}onChange(e){return(t,s,n)=>{const i=A.collections.length+A.panels.length;e(t,s,n),i!=A.collections.length+A.panels.length&&setTimeout(this.forceUpdate.bind(this),50)}}buildSettingsPanel(e,t,s,n,i=null){return t.forEach(e=>{e.settings.forEach(t=>t.value=s[e.id][t.id])}),this.getSettingsPanel(e,t,this.onChange(n),i)}getSettingsPanel(e,t,s,n=null){return[O.createElement(ye,{text:e,button:n}),t.map(e=>O.createElement(Be,Object.assign({},e,{onChange:s})))]}getAddonPanel(e,t,s,n={}){return O.createElement(De,Object.assign({},{title:e,addonList:t,addonState:s},n))}async patchSections(){F.after("SettingsManager",u.getByDisplayName("FluxContainer(GuildSettings)").prototype,"render",e=>{e._reactInternalFiber.return.return.return.return.return.return.memoizedProps.id="guild-settings"});const e=await z.get("UserSettings",e=>e.prototype&&e.prototype.generateSections);F.after("SettingsManager",e.prototype,"render",e=>{e._reactInternalFiber.return.return.return.return.return.return.return.memoizedProps.id="user-settings"}),F.after("SettingsManager",e.prototype,"generateSections",(e,t,s)=>{let n=s.findIndex(e=>"linux"==e.section.toLowerCase())+1;const i=e=>{s.splice(n,0,e),n++};i({section:"DIVIDER"}),i({section:"HEADER",label:"BandagedBD"});for(const e of A.collections)e.disabled||i({section:e.name,label:e.name,element:()=>this.buildSettingsPanel(e.name,e.settings,A.state[e.id],A.onSettingChange.bind(A,e.id),e.button?e.button:null)});for(const t of A.panels.sort((e,t)=>e.order>t.order))t.clickListener&&(t.onClick=n=>t.clickListener(e,n,s)),i(t);i({section:"CUSTOM",element:Le})}),this.forceUpdate()}forceUpdate(){const e=u.getByProps("standardSidebarView").standardSidebarView.split(" ")[0],t=document.querySelector(`.${e}`);if(!t)return;const s=c.findInReactTree(c.getReactInstance(t),e=>e&&e.generateSections,{walkable:["return","stateNode"]});s&&s.forceUpdate()}};const $e=s(2),ze=s(0).remote;var Oe=new class extends ge{get name(){return"PluginManager"}get moduleExtension(){return".js"}get extension(){return".plugin.js"}get addonFolder(){return $e.resolve(i.dataPath,"plugins")}get prefix(){return"plugin"}get language(){return"javascript"}constructor(){super(),this.onSwitch=this.onSwitch.bind(this),this.observer=new MutationObserver(e=>{for(let t=0,s=e.length;tje.getAddonPanel(M.Panels.plugins,this.addonList,this.state,{folder:this.addonFolder,onChange:this.togglePlugin.bind(this),reload:this.reloadPlugin.bind(this),refreshList:this.updatePluginList.bind(this),saveAddon:this.saveAddon.bind(this),editAddon:this.editAddon.bind(this),deleteAddon:this.deleteAddon.bind(this),prefix:this.prefix})}),e}updatePluginList(){return this.updateList()}loadAllPlugins(){return this.loadAllAddons()}enablePlugin(e){return this.enableAddon(e)}disablePlugin(e){return this.disableAddon(e)}togglePlugin(e){return this.toggleAddon(e)}unloadPlugin(e){return this.unloadAddon(e)}loadPlugin(e){const t=this.loadAddon(e);t&&te.showAddonErrors({themes:[t]})}reloadPlugin(e){const t=this.reloadAddon(e);return t&&te.showAddonErrors({plugins:[t]}),"string"==typeof e?this.addonList.find(t=>t.id==e||t.filename==e):e}initializeAddon(e){if(!e.type)return new D(e.name,e.filename,"Plugin had no exports",{message:"Plugin had no exports or no name property.",stack:""});try{const t=new e.type;e.plugin=t,e.name=t.getName()||e.name,e.author=t.getAuthor()||e.author||"No author",e.description=t.getDescription()||e.description||"No description",e.version=t.getVersion()||e.version||"No version";try{"function"==typeof e.plugin.load&&e.plugin.load()}catch(t){return this.state[e.id]=!1,new D(e.name,e.filename,"load() could not be fired.",{message:t.message,stack:t.stack})}}catch(t){return new D(e.name,e.filename,"Could not be constructed.",{message:t.message,stack:t.stack})}}getFileModification(e,t,s){return e._compile(t,e.filename),c.isEmpty(e.exports)?t+=`\nmodule.exports = ${JSON.stringify(s)};\nmodule.exports.type = ${s.exports||s.name};`:(s.type=e.exports,e.exports=s,"")}startAddon(e){return this.startPlugin(e)}stopAddon(e){return this.stopPlugin(e)}startPlugin(e){const t="string"==typeof e?this.addonList.find(t=>t.id==e):e;if(!t)return;const s=t.plugin;try{s.start(),this.emit("started",t.id),_.show(`${t.name} v${t.version} has started.`)}catch(e){return this.state[t.id]=!1,_.error(`${t.name} v${t.version} could not be started.`),d.stacktrace(this.name,t.name+" could not be started.",e),new D(t.name,t.filename,"start() could not be fired.",{message:e.message,stack:e.stack})}}stopPlugin(e){const t="string"==typeof e?this.addonList.find(t=>t.id==e):e;if(!t)return;const s=t.plugin;try{s.stop(),this.emit("stopped",t.id),_.show(`${t.name} v${t.version} has stopped.`)}catch(e){return this.state[t.id]=!1,_.error(`${t.name} v${t.version} could not be stopped.`),d.stacktrace(this.name,t.name+" could not be stopped.",e),new D(t.name,t.filename,"stop() could not be fired.",{message:e.message,stack:e.stack})}}setupFunctions(){ze.getCurrentWebContents().on("did-navigate-in-page",this.onSwitch.bind(this)),this.observer.observe(document,{childList:!0,subtree:!0})}onSwitch(){this.emit("page-switch");for(let e=0;eje.getAddonPanel(M.Panels.themes,this.addonList,this.state,{folder:this.addonFolder,onChange:this.toggleTheme.bind(this),reload:this.reloadTheme.bind(this),refreshList:this.updateThemeList.bind(this),saveAddon:this.saveAddon.bind(this),editAddon:this.editAddon.bind(this),deleteAddon:this.deleteAddon.bind(this),prefix:this.prefix})}),e}updateThemeList(){return this.updateList()}loadAllThemes(){return this.loadAllAddons()}enableTheme(e){return this.enableAddon(e)}disableTheme(e){return this.disableAddon(e)}toggleTheme(e){return this.toggleAddon(e)}unloadTheme(e){return this.unloadAddon(e)}loadTheme(e){const t=this.loadAddon(e);t&&te.showAddonErrors({themes:[t]})}reloadTheme(e){const t=this.reloadAddon(e);t&&te.showAddonErrors({themes:[t]})}getFileModification(e,t,s){return s.css=t,`module.exports = ${JSON.stringify(s)};`}startAddon(e){return this.addTheme(e)}stopAddon(e){return this.removeTheme(e)}addTheme(e){const t="string"==typeof e?this.addonList.find(t=>t.id==e):e;t&&(x.injectTheme(t.id,t.css),_.show(`${t.name} v${t.version} has been applied.`))}removeTheme(e){const t="string"==typeof e?this.addonList.find(t=>t.id==e):e;t&&(x.removeTheme(t.id),_.show(`${t.name} v${t.version} has been removed.`))}};class _e{get name(){return"Unnamed Builtin"}get collection(){return"settings"}get category(){return"general"}get id(){return"None"}async initialize(){A.get(this.collection,this.category,this.id)&&await this.enable(),g.on("setting-updated",(e,t,s,n)=>{e==this.collection&&t===this.category&&s===this.id&&(n?this.enable():this.disable())})}registerSetting(e,t,s,n,i){return 4==arguments.length?(e=this.collection,t=arguments[0],s=arguments[1],n=arguments[2],i=arguments[3]):3==arguments.length&&(e=this.collection,t=this.category,s=arguments[0],n=arguments[1],i=arguments[2]),A.on(e,t,s,e=>{e?n():i()})}get(e,t,s){return 2==arguments.length?(e=this.collection,t=arguments[0],s=arguments[1]):1==arguments.length&&(e=this.collection,t=this.category,s=arguments[0]),A.get(e,t,s)}async enable(){this.log("Enabled"),await this.enabled()}async disable(){this.log("Disabled"),await this.disabled()}async enabled(){}async disabled(){}log(...e){d.log(this.name,...e)}warn(...e){d.warn(this.name,...e)}error(...e){d.err(this.name,...e)}stacktrace(e,t){d.stacktrace(this.name,e,t)}after(e,t,s){return F.after(this.name,e,t,s)}unpatchAll(){return F.unpatchAll(this.name)}}const qe=u.getByDisplayName("TooltipDeprecated");class He extends O.Component{constructor(e){super(e),this.state={shouldAnimate:!this.animateOnHover,isFavorite:this.props.isFavorite},this.onMouseEnter=this.onMouseEnter.bind(this),this.onMouseLeave=this.onMouseLeave.bind(this),this.onClick=this.onClick.bind(this),this.toggleFavorite=this.toggleFavorite.bind(this)}get animateOnHover(){return A.get("emotes","general","animateOnHover")}get label(){return this.props.modifier?`${this.props.name}:${this.props.modifier}`:this.props.name}get modifierClass(){return this.props.modifier?` emote${this.props.modifier}`:""}onMouseEnter(){!this.state.shouldAnimate&&this.animateOnHover&&this.setState({shouldAnimate:!0})}onMouseLeave(){this.state.shouldAnimate&&this.animateOnHover&&this.setState({shouldAnimate:!1})}onClick(e){this.props.onClick&&this.props.onClick(e)}toggleFavorite(e){e.preventDefault(),e.stopPropagation(),this.state.isFavorite?g.emit("emotes-favorite-removed",this.label):g.emit("emotes-favorite-added",this.label,this.props.url),this.setState({isFavorite:!this.state.isFavorite})}render(){return O.createElement(qe,{color:"black",position:"top",text:this.label,delay:750},O.createElement("div",{className:"emotewrapper"+(this.props.jumboable?" jumboable":""),onMouseEnter:this.onMouseEnter,onMouseLeave:this.onMouseLeave,onClick:this.onClick},O.createElement("img",{draggable:!1,className:"emote"+this.modifierClass+(this.props.jumboable?" jumboable":"")+(this.state.shouldAnimate?"":" stop-animation"),dataModifier:this.props.modifier,alt:this.label,src:this.props.url}),O.createElement("input",{className:"fav"+(this.state.isFavorite?" active":""),title:M.Emotes.favoriteAction,type:"button",onClick:this.toggleFavorite})))}}const Ue=s(3),We={TwitchGlobal:new k("https://static-cdn.jtvnw.net/emoticons/v1/{{id}}/1.0"),TwitchSubscriber:new k("https://static-cdn.jtvnw.net/emoticons/v1/{{id}}/1.0"),FrankerFaceZ:new k("https://cdn.frankerfacez.com/emoticon/{{id}}/1"),BTTV:new k("https://cdn.betterttv.net/emote/{{id}}/1x")},Ge={TwitchGlobal:{},TwitchSubscriber:{},BTTV:{},FrankerFaceZ:{}},Ve=[],Je=["twitch","subscriber","bttv","ffz"],Ze=["flip","spin","pulse","spin2","spin3","1spin","2spin","3spin","tr","bl","br","shake","shake2","shake3","flap"];var Ye=new class extends _e{get name(){return"Emotes"}get collection(){return"settings"}get category(){return"general"}get id(){return"emotes"}get categories(){return Object.keys(Ge).filter(e=>this.isCategoryEnabled(e))}get shouldDownload(){return A.get("emotes",this.category,"download")}isCategoryEnabled(e){return super.get("emotes","categories",e.toLowerCase())}get(e){return super.get("emotes","general",e)}get MessageContentComponent(){return u.getModule(e=>e.defaultProps&&e.defaultProps.hasOwnProperty("disableButtons"))}get Emotes(){return Ge}get TwitchGlobal(){return Ge.TwitchGlobal}get TwitchSubscriber(){return Ge.TwitchSubscriber}get BTTV(){return Ge.BTTV}get FrankerFaceZ(){return Ge.FrankerFaceZ}get blacklist(){return Ve}get favorites(){return this.favoriteEmotes}getUrl(e,t){return We[e].format({id:Ge[e][t]})}getCategory(e){return Ge[e]}getRemoteFile(e){return c.repoUrl(`data/emotes/${e.toLowerCase()}.json`)}initialize(){super.initialize(),window.emoteModule=this;const e=v.getBDData("favoriteEmotes");this.favoriteEmotes=e||{},this.addFavorite=this.addFavorite.bind(this),this.removeFavorite=this.removeFavorite.bind(this),this.onCategoryToggle=this.onCategoryToggle.bind(this),this.resetEmotes=this.resetEmotes.bind(this)}async enabled(){for(A.registerCollection("emotes","Emotes",o,{title:M.Emotes.clearEmotes,onClick:this.resetEmotes}),await this.getBlacklist(),await this.loadEmoteData();!this.MessageContentComponent;)await new Promise(e=>setTimeout(e,100));this.patchMessageContent(),g.on("emotes-favorite-added",this.addFavorite),g.on("emotes-favorite-removed",this.removeFavorite),g.on("setting-updated",this.onCategoryToggle)}disabled(){g.off("setting-updated",this.onCategoryToggle),g.off("emotes-favorite-added",this.addFavorite),g.off("emotes-favorite-removed",this.removeFavorite),A.removeCollection("emotes"),this.emptyEmotes(),this.cancelEmoteRender&&(this.cancelEmoteRender(),delete this.cancelEmoteRender)}onCategoryToggle(e,t,s,n){if("emotes"==e&&"categories"==t)return n?this.loadEmoteData(s):this.unloadEmoteData(s)}addFavorite(e,t){this.favoriteEmotes.hasOwnProperty(e)||(this.favoriteEmotes[e]=t),this.saveFavorites()}removeFavorite(e){this.favoriteEmotes.hasOwnProperty(e)&&(delete this.favoriteEmotes[e],this.saveFavorites())}isFavorite(e){return this.favoriteEmotes.hasOwnProperty(e)}saveFavorites(){v.setBDData("favoriteEmotes",this.favoriteEmotes)}emptyEmotes(){for(const e in Ge)Object.assign(Ge,{[e]:{}})}patchMessageContent(){this.cancelEmoteRender||(this.cancelEmoteRender=this.after(this.MessageContentComponent.prototype,"render",(e,t,s)=>{this.after(s.props,"children",(e,t,s)=>{if(0==this.categories.length)return;const n=s.props.children[1];if(!n.props.children)return;const i=n.props.children[1];if(i&&i.length){for(let e=0;e"string"==typeof e&&""==e.replace(/\s*/,"")||(!(!e.type||"BDEmote"!=e.type.name)||!!(e.props&&e.props.children&&e.props.children.props&&e.props.children.props.emojiName))))for(const e of i)"object"==typeof e&&("BDEmote"==e.type.name?e.props.jumboable=!0:e.props&&e.props.children&&e.props.children.props&&e.props.children.props.emojiName&&(e.props.children.props.jumboable=!0))}})}))}async getBlacklist(){const e=v.emotesExist("Blacklist"),t=await this.isCacheValid("Blacklist"),s=t||!t&&e&&!this.shouldDownload?v.getEmoteData("Blacklist"):await this.downloadEmotes("Blacklist");Ve.push(...s)}isCacheValid(e){return new Promise(t=>{const s=v.getCacheHash("emotes",e);if(!s)return t(!1);Ue.head({url:this.getRemoteFile(e),headers:{"If-None-Match":s}},(e,s)=>{t(304==s.statusCode)})})}async loadEmoteData(e){e||(e=this.categories),Array.isArray(e)||(e=[e]);const t=Object.keys(Ge);e=e.map(e=>t.find(t=>t.toLowerCase()==e.toLowerCase())),_.show(M.Emotes.loading,{type:"info"}),this.emotesLoaded=!1;for(const t of e){const e=v.emotesExist(t),s=await this.isCacheValid(t);let n=null;if(s||!s&&e&&!this.shouldDownload){this.log(`Loading ${t} emotes from local cache.`);const e=v.getEmoteData(t);Object.keys(e).length>0&&(n=e)}n||(n=await this.downloadEmotes(t)),Object.assign(Ge[t],n),await new Promise(e=>setTimeout(e,1e3))}this.emotesLoaded=!0,g.dispatch("emotes-loaded"),_.show(M.Emotes.loaded,{type:"success"})}unloadEmoteData(e){e||(e=this.categories),Array.isArray(e)||(e=[e]);const t=Object.keys(Ge);e=e.map(e=>t.find(t=>t.toLowerCase()==e.toLowerCase()));for(const t of e)delete Ge[t],Ge[t]={}}downloadEmotes(e){const t=this.getRemoteFile(e);this.log(`Downloading ${e} from ${t}`);const s={url:t,timeout:1e4,json:!0};return new Promise(t=>{Ue.get(s,(s,n,i)=>{if(s||200!=n.statusCode)return this.stacktrace(`Could not download ${e} emotes.`,s),t({});for(const e in i)(e.length<4||Ve.includes(e)||!i[e])&&delete i[e];v.saveEmoteData(e,i),v.setCacheHash("emotes",e,n.headers.etag),t(i),this.log(`Downloaded ${e}`)})})}resetEmotes(){const e=Object.keys(Ge);this.unloadEmoteData(e);for(const t of e)v.invalidateCache("emotes",t);this.loadEmoteData()}};class Ke extends O.Component{render(){const e=this.props.size||"24px";return O.createElement("svg",{viewBox:"0 0 24 24",style:{width:e,height:e}},O.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),O.createElement("path",{d:"M19 19H5V5h7V3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2v-7h-2v7zM14 3v2h3.59l-9.83 9.83 1.41 1.41L19 6.41V10h2V3h-7z"}))}}class Xe extends O.Component{constructor(e){super(e),this.hasUnsavedChanges=!1,this.onChange=this.onChange.bind(this),this.toggleLiveUpdate=this.toggleLiveUpdate.bind(this),this.updateCss=this.updateCss.bind(this),this.saveCss=this.saveCss.bind(this),this.openDetached=this.props.openDetached?this.openDetached.bind(this):null,this.openNative=this.openNative.bind(this),this.updateEditor=this.updateEditor.bind(this),this.controls=[{label:O.createElement(ve,{size:"18px"}),tooltip:M.CustomCSS.update,onClick:this.updateCss},{label:O.createElement(J,{size:"18px"}),tooltip:M.CustomCSS.save,onClick:this.saveCss},{label:O.createElement(Z,{size:"18px"}),tooltip:M.CustomCSS.openNative,onClick:this.openNative},{label:O.createElement(Y,{size:"18px"}),tooltip:M.CustomCSS.settings,onClick:"showSettings"},{label:M.Collections.settings.customcss.liveUpdate.name,type:"checkbox",onChange:this.toggleLiveUpdate,checked:A.get("settings","customcss","liveUpdate"),side:"right"}],this.openDetached&&this.controls.push({label:O.createElement(Ke,{size:"18px"}),tooltip:M.CustomCSS.openDetached,onClick:this.openDetached,side:"right"})}componentDidMount(){g.on("customcss-updated",this.updateEditor)}componentWillUnmount(){g.off("customcss-updated",this.updateEditor)}updateEditor(e){this.editor&&(this.editor.value=e)}get value(){return this.editor.session.getValue()}set value(e){this.editor.setValue(e)}showSettings(){return this.editor.keyBinding.$defaultHandler.commands.showSettingsMenu.exec(this.editor)}resize(){return this.editor.resize()}setEditorRef(e){this.editor=e,this.props.editorRef&&void 0!==this.props.editorRef.current?this.props.editorRef.current=e:this.props.editorRef&&(this.props.editorRef=e)}onChange(){this.hasUnsavedChanges=!0,this.props.onChange&&this.props.onChange(...arguments)}render(){return O.createElement(V,{ref:this.setEditorRef.bind(this),readOnly:this.props.readOnly,id:this.props.id||"bd-customcss-editor",onChange:this.onChange,controls:this.controls,value:this.props.css})}toggleLiveUpdate(e){A.set("settings","customcss","liveUpdate",e)}updateCss(e,t){this.props.update&&this.props.update(t)}saveCss(e,t){this.hasUnsavedChanges=!1,this.props.save&&this.props.save(t)}openDetached(e,t){this.props.openDetached&&this.props.openDetached(t)}openNative(){this.props.openNative&&this.props.openNative()}}const Qe=s(1),et=s(0),tt=u.getByProps("updateAccount"),st=u.getByProps("dirtyDispatch"),nt=u.getByProps("ActionTypes").ActionTypes;var it=new class extends _e{get name(){return"Custom CSS"}get category(){return"customcss"}get id(){return"customcss"}get startDetached(){return"detached"==A.get(this.collection,this.category,"openAction")}get nativeOpen(){return"system"==A.get(this.collection,this.category,"openAction")}constructor(){super(),this.savedCss="",this.insertedCss="",this.isDetached=!1}async enabled(){window.ace||x.injectScript("ace-script","https://cdnjs.cloudflare.com/ajax/libs/ace/1.2.9/ace.js").then(()=>{window.require.original&&(window.require=window.require.original)}),A.registerPanel(this.id,M.Panels.customcss,{order:2,element:()=>[O.createElement(ye,{text:M.CustomCSS.editorTitle}),O.createElement(Xe,{css:this.savedCss,save:this.saveCSS.bind(this),update:this.insertCSS.bind(this),openNative:this.openNative.bind(this),openDetached:this.openDetached.bind(this),onChange:this.onChange.bind(this)})],onClick:e=>{if(this.isDetached)return;if(this.nativeOpen)return this.openNative();if(this.startDetached)return this.openDetached();const t=c.findInRenderTree(e._reactInternalFiber,e=>e&&e.onSetSection,{walkable:["child","memoizedProps","props","children"]});t&&t.onSetSection&&t.onSetSection(this.id)}}),this.loadCSS(),this.insertCSS(this.savedCss),this.watchContent()}disabled(){A.removePanel(this.id),this.unwatchContent()}watchContent(){if(this.watcher)return this.error("Already watching content.");const e={};this.log("Starting to watch content."),this.watcher=Qe.watch(v.customCSS,{persistent:!1},async(t,s)=>{if(!t||!s)return;await new Promise(e=>setTimeout(e,50));try{Qe.statSync(v.customCSS)}catch(t){if("ENOENT"!==t.code)return;delete e[s],this.saveCSS("")}const n=Qe.statSync(v.customCSS);if(n&&n.mtime&&n.mtime.getTime()&&"number"==typeof n.mtime.getTime()&&e[s]!=n.mtime.getTime()&&(e[s]=n.mtime.getTime(),"change"==t)){const e=v.loadCustomCSS();if(e==this.savedCss)return;this.savedCss=e,this.insertCSS(this.savedCss),g.emit("customcss-updated",this.savedCss)}})}unwatchContent(){if(!this.watcher)return this.error("Was not watching content.");this.watcher.close(),delete this.watcher,this.log("No longer watching content.")}onChange(e){A.get("settings","customcss","liveUpdate")&&(this.insertCSS(e),this.saveCSS(e))}loadCSS(){this.savedCss=v.loadCustomCSS()}insertCSS(e){void 0===e?e=this.insertedCss:this.insertedCss=e,x.updateCustomCSS(e)}saveCSS(e){void 0!==e&&(this.savedCss=e),v.saveCustomCSS(this.savedCss)}openNative(){et.shell.openExternal(`file://${v.customCSS}`)}openDetached(e){const t=O.createRef(),s=O.createElement(Xe,{id:"bd-floating-editor",ref:t,css:e,save:this.saveCSS.bind(this),update:this.insertCSS.bind(this),openNative:this.openNative.bind(this),onChange:this.onChange.bind(this)});ae.open({onClose:()=>{this.isDetached=!1},onResize:()=>{t&&t.current&&t.current.resize&&t.current.resize()},title:M.CustomCSS.editorTitle,id:"floating-editor-window",height:470,width:410,center:!0,resizable:!0,children:s,confirmClose:()=>!(!t||!t.current)&&t.current.hasUnsavedChanges,confirmationText:M.CustomCSS.confirmationText}),this.isDetached=!0,tt.close(),st.dirtyDispatch({type:nt.LAYER_POP})}},ot=new class extends _e{get name(){return"VoiceMode"}get category(){return"appearance"}get id(){return"voiceMode"}enabled(){document.querySelector(".chat-3bRxxu").style.setProperty("visibility","hidden"),document.querySelector(".chat-3bRxxu").style.setProperty("min-width","0px"),document.querySelector(".channels-Ie2l6A").style.setProperty("flex-grow","100000")}disabled(){document.querySelector(".chat-3bRxxu").style.setProperty("visibility",""),document.querySelector(".chat-3bRxxu").style.setProperty("min-width",""),document.querySelector(".channels-Ie2l6A").style.setProperty("flex-grow","")}};const rt=new RegExp("^(?!da-)((?:[A-Za-z]|[0-9]|-)+)-(?:[A-Za-z]|[0-9]|-|_){6}$");var at=new class extends _e{get id(){return"classNormalizer"}get category(){return"general"}get name(){return"ClassNormalizer"}enabled(){this.hasPatched||(this.patchClassModules(u.getModules(this.moduleFilter.bind(this))),this.normalizeElement(document.querySelector("#app-mount")),this.hasPatched=!0,this.patchDOMMethods())}disabled(){this.hasPatched&&(this.unpatchClassModules(u.getModules(this.moduleFilter.bind(this))),this.revertElement(document.querySelector("#app-mount")),this.hasPatched=!1)}patchClassModules(e){for(const t of e)this.patchClassModule("da",t)}unpatchClassModules(e){for(const t of e)this.unpatchClassModule("da",t)}shouldIgnore(e){return!isNaN(e)||(!!(e.endsWith("px")||e.endsWith("ch")||e.endsWith("em")||e.endsWith("ms"))||(!!e.startsWith("layerContainer-")||(!(!e.startsWith("#")||7!=e.length&&4!=e.length)||!(!e.includes("calc(")&&!e.includes("rgba")))))}moduleFilter(e){if("object"!=typeof e||Array.isArray(e))return!1;if(e.__esModule)return!1;if(!Object.keys(e).length)return!1;for(const t in e){const s=e[t];if("string"!=typeof s)return!1;if(!this.shouldIgnore(s)){if(1===s.split("-").length)return!1;if(!rt.test(s.split(" ")[0]))return!1}}return!0}patchClassModule(e,t){for(const s in t){const n=t[s];if(this.shouldIgnore(n))continue;const i=n.split(" ");for(const n of i){const i=n.match(rt)[1];if(!i)continue;const o=i.split("-").map((e,t)=>t?e[0].toUpperCase()+e.slice(1):e).join("");t[s]+=` ${e}-${o}`}}}unpatchClassModule(e,t){for(const s in t){const n=t[s];if(this.shouldIgnore(n))continue;let i="";const o=n.split(" ");for(const t of o)t.startsWith(`${e}-`)||(i+=` ${t}`);t[s]=i.trim()}}normalizeElement(e){if(!(e instanceof Element))return;const t=e.classList;for(let s=0,n=t.length;st?e[0].toUpperCase()+e.slice(1):e).join("");e.classList.add(`da-${n}`)}for(const t of e.children)this.normalizeElement(t)}revertElement(e){if(!(e instanceof Element))return;e.children&&e.children.length&&this.revertElement(e.children[0]),e.nextElementSibling&&this.revertElement(e.nextElementSibling);const t=e.classList,s=[];for(let e=0;ee.call(this,t))}}},lt=new class extends _e{get name(){return"DeveloperMode"}get category(){return"developer"}get id(){return"developerMode"}get selectorModeID(){return"copySelector"}get selectorMode(){return this.get(this.selectorModeID)}constructor(){super(),this.enableSelectors=this.enableSelectors.bind(this),this.disableSelectors=this.disableSelectors.bind(this)}enabled(){$(window).on("keydown.bdDevmode",e=>{119!==e.which&&118!=e.which||this.log("Debugger Activated")}),this.selectorMode&&this.enableSelectors(),this.selectorCancel=this.registerSetting(this.selectorModeID,this.enableSelectors,this.disableSelectors)}disabled(){$(window).off("keydown.bdDevmode"),this.selectorMode&&this.disableSelectors(),this.selectorCancel&&this.selectorCancel()}enableSelectors(){$(document).on("contextmenu.bdDevmode",e=>{this.lastSelector=this.getSelector(e.toElement);setImmediate(()=>{let t=$(".contextMenu-HLZMGh");t.length<=0&&((t=$('
')).addClass($(".app, .app-2rEoOp").hasClass("theme-dark")?"theme-dark":"theme-light"),t.appendTo(".app, .app-2rEoOp"),t.css("top",e.clientY),t.css("left",e.clientX),$(document).on("click.bdDevModeCtx",()=>{t.remove(),$(document).off(".bdDevModeCtx")}),$(document).on("contextmenu.bdDevModeCtx",()=>{t.remove(),$(document).off(".bdDevModeCtx")}),$(document).on("keyup.bdDevModeCtx",e=>{27===e.keyCode&&(t.remove(),$(document).off(".bdDevModeCtx"))}));const s=$("
",{class:"itemGroup-1tL0uz"}),n=$("
",{class:"item-1Yvehc",click:()=>{p.ElectronModule.copy(this.lastSelector),t.hide()}}).append($("",{text:M.Collections.settings.developer.copySelector.name}));s.append(n),t.append(s),t.hasClass("undefined")&&t.css("top","-="+s.outerHeight())}),e.stopPropagation()})}disableSelectors(){$(document).off("contextmenu.bdDevmode"),$(document).off("contextmenu.bdDevModeCtx")}getRules(e,t=e.ownerDocument.styleSheets){return[...t].filter(e=>!e.href||!e.href.includes("BetterDiscordApp")).map(e=>[...e.cssRules||[]]).flat().filter(t=>t&&t.selectorText&&e.matches(t.selectorText)&&t.style.length&&t.selectorText.split(", ").length<8&&!t.selectorText.split(", ").includes("*"))}getSelector(e){if(e.id)return`#${e.id}`;const t=this.getRules(e),s=t[t.length-1];return s?s.selectorText:e.classList.length?`.${Array.from(e.classList).join(".")}`:`.${Array.from(e.parentElement.classList).join(".")}`}};class dt extends O.Component{constructor(e){super(e),this.props.server.iconUrl||(this.props.server.iconUrl=this.props.defaultAvatar()),this.state={imageError:!1,joined:this.props.joined},this.join=this.join.bind(this),this.handleError=this.handleError.bind(this)}render(){const{server:e}=this.props,t="string"==typeof this.state.joined?`${M.PublicServers.joining}...`:this.state.joined?M.PublicServers.joined:M.PublicServers.join,s=`bd-button${1==this.state.joined?" bd-button-success":""}`;return O.createElement("div",{className:`bd-server-card${e.pinned?" bd-server-card-pinned":""}`},O.createElement("img",{className:"bd-server-image",src:e.iconUrl,onError:this.handleError}),",",O.createElement("div",{className:"bd-server-content"},O.createElement("div",{className:"bd-server-header"},O.createElement("h5",{className:"bd-server-name"},e.name),O.createElement("h5",{className:"bd-server-member-count"},e.members," Members")),O.createElement("div",{className:"bd-scroller-wrap bd-server-description-container"},O.createElement("div",{className:"bd-scroller bd-server-description"},e.description)),O.createElement("div",{className:"bd-server-footer"},O.createElement("div",{className:"bd-server-tags"},e.categories.join(", ")),O.createElement("button",{type:"button",className:s,onClick:this.join},t))))}handleError(){this.props.server.iconUrl=this.props.defaultAvatar(),this.setState({imageError:!0})}async join(){if(this.state.joined)return;this.setState({joined:"joining"});const e=await this.props.join(this.props.server.identifier,this.props.server.nativejoin);this.setState({joined:e})}}const ct=u.getByProps("getSortedGuilds"),ht=u.getByProps("getUserAvatarURL","DEFAULT_AVATARS"),ut=u.getByProps("acceptInvite"),pt=s(0).remote.BrowserWindow;class mt{static get endPoint(){return"https://search.discordservers.com"}static get joinEndPoint(){return"https://j.discordservers.com"}static get connectEndPoint(){return"https://auth.discordservers.com/info"}static getDefaultAvatar(){return ht.DEFAULT_AVATARS[Math.floor(5*Math.random())]}static hasJoined(e){return ct.guildPositions.includes(e)}static search({term:e="",category:t="",from:s=0}={}){return new Promise(n=>{const i=[];t&&i.push(`category=${t.replace(/ /g,"%20")}`),e&&i.push(`term=${e.replace(/ /g,"%20")}`),s&&i.push(`from=${s}`);const o=`?${i.join("&")}`;$.ajax({method:"GET",url:`${this.endPoint}${o}`,success:e=>{const t=e.size+e.from;n({servers:e.results,size:e.size,from:e.from,total:e.total,next:t>=e.total?null:t})},error:()=>n(null)})})}static join(e,t=!1){return new Promise(s=>{if(t)return ut.acceptInvite(e),s(!0);$.ajax({method:"GET",url:`${this.joinEndPoint}/${e}`,headers:{Accept:"application/json;","Content-Type":"application/json;","x-discord-token":this._accessToken},crossDomain:!0,xhrFields:{withCredentials:!0},success:()=>s(!0),error:()=>s(!1)})})}static checkConnection(){return new Promise(e=>{try{$.ajax({method:"GET",url:this.connectEndPoint,headers:{Accept:"application/json;","Content-Type":"application/json;"},crossDomain:!0,xhrFields:{withCredentials:!0},success:t=>{this._accessToken=t.access_token,e(t)},error:()=>e(!1)})}catch(t){e(!1)}})}static connect(){return new Promise(e=>{const t=new pt(this.windowOptions),s=`https://auth.discordservers.com/connect?scopes=guilds.join&previousUrl=${this.connectEndPoint}`;t.webContents.on("did-navigate",(s,n)=>{n==this.connectEndPoint&&(t.close(),e())}),t.loadURL(s)})}static get windowOptions(){return{width:380,height:450,backgroundColor:"#282b30",show:!0,resizable:!0,maximizable:!1,minimizable:!1,alwaysOnTop:!0,frame:!1,center:!0,webPreferences:{nodeIntegration:!1}}}}const gt=u.getByDisplayName("SettingsView");class ft extends O.Component{get categoryButtons(){return["All","FPS Games","MMO Games","Strategy Games","MOBA Games","RPG Games","Tabletop Games","Sandbox Games","Simulation Games","Music","Community","Language","Programming","Other"]}constructor(e){super(e),this.state={category:"All",query:"",loading:!0,user:null,results:{servers:[],size:0,from:0,total:0,next:null}},this.changeCategory=this.changeCategory.bind(this),this.searchKeyDown=this.searchKeyDown.bind(this),this.connect=this.connect.bind(this),this.loadNextPage=this.loadNextPage.bind(this)}componentDidMount(){this.checkConnection()}async checkConnection(){const e=await mt.checkConnection();if(!e)return this.setState({loading:!0,user:null});this.setState({user:e}),this.search()}async connect(){await mt.connect(),this.checkConnection()}searchKeyDown(e){this.state.loading||13!==e.which||this.search(e.target.value)}async search(e="",t=0){this.setState({query:e,loading:!0});const s=await mt.search({term:e,category:"All"==this.state.category?"":this.state.category,from:t});if(!s)return this.setState({results:{servers:[],size:0,from:0,total:0,next:null}});this.setState({loading:!1,results:s})}async changeCategory(e){this.state.loading||(await new Promise(t=>this.setState({category:e},t)),this.search())}loadNextPage(){this.state.loading||this.search(this.state.query,this.state.results.next)}async join(e,t=!1){return await mt.join(e,t)}get searchBox(){return O.createElement(Ae,{onKeyDown:this.searchKeyDown,placeholder:`${M.PublicServers.search}...`})}get title(){if(!this.state.user)return M.PublicServers.notConnected;if(this.state.loading)return`${M.PublicServers.loading}...`;const e=this.state.results.from+1,t=this.state.results.total,s=this.state.results.next?this.state.results.next:t;let n=M.PublicServers.results.format({start:e,end:s,total:t,category:this.state.category});return this.state.query&&(n+=" "+M.PublicServers.query.format({query:this.state.query})),n}get content(){const e=this.state.user?null:{title:M.PublicServers.connect,onClick:this.connect},t="All"!=this.state.category&&this.state.user?null:this.bdServer,s=this.state.results.servers.map(e=>O.createElement(dt,{key:e.identifier,server:e,joined:mt.hasJoined(e.identifier),defaultAvatar:mt.getDefaultAvatar}));return[O.createElement(ye,{text:this.title,button:e}),t,s,this.state.results.next?this.nextButton:null,this.state.results.servers.length>0&&O.createElement(ye,{text:this.title})]}get nextButton(){return O.createElement("button",{type:"button",className:"bd-button bd-button-next",onClick:this.loadNextPage},this.state.loading?M.PublicServers.loading:M.PublicServers.loadMore)}get connection(){const{user:e}=this.state;return e?O.createElement("div",{id:"bd-connection"},O.createElement("div",{className:"bd-footnote"},M.PublicServers.connection.format(e)),O.createElement("button",{type:"button",className:"bd-button bd-button-reconnect",onClick:this.connect},M.PublicServers.reconnect)):O.createElement("div",{id:"bd-connection"})}get bdServer(){const e={name:"BetterDiscord",online:"7500+",members:"20000+",categories:["community","programming","support"],description:"Official BetterDiscord server for plugins, themes, support, etc",identifier:"86004744966914048",iconUrl:"https://cdn.discordapp.com/icons/86004744966914048/292e7f6bfff2b71dfd13e508a859aedd.webp",nativejoin:!0,invite_code:"0Tmfo5ZbORCRqbAd",pinned:!0};return O.createElement(dt,{server:e,pinned:!0,joined:mt.hasJoined(e.identifier),defaultAvatar:mt.getDefaultAvatar})}render(){const e=this.categoryButtons.map(e=>({section:e,label:e,element:()=>this.content}));return O.createElement(gt,{onClose:this.props.close,onSetSection:this.changeCategory,section:this.state.category,sections:[{section:"HEADER",label:M.PublicServers.search},{section:"CUSTOM",element:()=>this.searchBox},{section:"HEADER",label:M.PublicServers.categories},...e,{section:"DIVIDER"},{section:"HEADER",label:O.createElement("a",{href:"https://discordservers.com",target:"_blank"},"DiscordServers.com")},{section:"DIVIDER"},{section:"CUSTOM",element:()=>this.connection}],theme:"dark"})}}const bt=u.getByProps("pushLayer");var yt=new class extends _e{get name(){return"PublicServers"}get category(){return"general"}get id(){return"publicServers"}enabled(){const e=p.GuildClasses.wrapper.split(" ")[0];$(`.${e} .scroller-2FKFPG >:first-child`).after(this.button)}disabled(){$("#bd-pub-li").remove()}openPublicServers(){bt.pushLayer(()=>p.React.createElement(ft,{close:bt.popLayer}))}get button(){return $("
",{class:p.GuildClasses.listItem,id:"bd-pub-li"}).append($("
",{class:"wrapper-25eVIn "+p.GuildClasses.circleButtonMask,text:M.PublicServers.button,id:"bd-pub-button",click:()=>{this.openPublicServers()}}))}},vt=new class extends _e{get name(){return"DarkMode"}get category(){return"appearance"}get id(){return"darkMode"}enabled(){document.getElementById("app-mount").classList.add("bda-dark","bd-dark")}disabled(){document.getElementById("app-mount").classList.remove("bda-dark","bd-dark")}},wt=new class extends _e{get name(){return"MinimalMode"}get category(){return"appearance"}get id(){return"minimalMode"}get hideChannelsID(){return"hideChannels"}get hideChannels(){return this.get(this.hideChannelsID)}constructor(){super(),this.enableHideChannels=this.enableHideChannels.bind(this),this.disableHideChannels=this.disableHideChannels.bind(this)}enabled(){document.body.classList.add("bd-minimal"),this.hideChannels&&this.enableHideChannels(),this.hideChannelCancel=this.registerSetting(this.hideChannelsID,this.enableHideChannels,this.disableHideChannels)}disabled(){document.body.classList.remove("bd-minimal"),this.hideChannels&&this.disableHideChannels(),this.hideChannelCancel&&this.hideChannelCancel()}enableHideChannels(){document.body.classList.add("bd-minimal-chan")}disableHideChannels(){document.body.classList.remove("bd-minimal-chan")}},Ct=new class extends _e{get name(){return"24Hour"}get category(){return"general"}get id(){return"twentyFourHour"}enabled(){this.inject24Hour()}disabled(){this.unpatchAll()}inject24Hour(){const e=new RegExp("([0-9]{1,2}):([0-9]{1,2})\\s(AM|PM)"),t=(t,s,n)=>{const i=n.match(e);if(i&&4===i.length)return"AM"===i[3]?n.replace(i[0],`${"12"===i[1]?"00":i[1].padStart(2,"0")}:${i[2]}`):n.replace(i[0],`${"12"===i[1]?"12":parseInt(i[1])+12}:${i[2]}`)};this.after(p.TimeFormatter,"calendarFormat",t),this.after(p.TimeFormatter,"dateFormat",t)}};const St=u.getModule(e=>e.defaultProps&&e.defaultProps.hasOwnProperty("disableButtons"));var Et=new class extends _e{get name(){return"ColoredText"}get category(){return"appearance"}get id(){return"coloredText"}enabled(){this.injectColoredText()}disabled(){this.unpatchAll()}injectColoredText(){this.after(St.prototype,"render",(e,t,s)=>{this.after(s.props,"children",{silent:!0,after:({returnValue:t})=>{const s=t.props.children[1],n=e.props.message.colorString;s&&n&&(s.props.style={color:n})}})})}removeColoredText(){document.querySelectorAll(".markup-2BOw-j").forEach(e=>{e.style.setProperty("color","")})}},Pt=new class extends _e{get name(){return"VoiceDisconnect"}get category(){return"general"}get id(){return"voiceDisconnect"}constructor(){super(),this.beforeUnload=this.beforeUnload.bind(this)}enabled(){window.addEventListener("beforeunload",this.beforeUnload)}disabled(){window.removeEventListener("beforeunload",this.beforeUnload)}beforeUnload(){p.ChannelActions.selectVoiceChannel(null,null)}};const xt=(e,t,s={})=>{const{onContextMenu:n,onClick:i}=s,o=c.parseHTML(`
\n ${e}\n
`);return n&&o.addEventListener("contextmenu",n),o.addEventListener("click",i),o};var kt=new class extends _e{get name(){return"EmoteMenu"}get collection(){return"emotes"}get category(){return"general"}get id(){return"emoteMenu"}get hideEmojisID(){return"hideEmojiMenu"}get hideEmojis(){return this.get(this.hideEmojisID)}constructor(){super(),this.lastTab="bd-qem-emojis",this.qmeHeader=c.parseHTML('
\n \n \n
');for(const e of this.qmeHeader.getElementsByTagName("button"))e.addEventListener("click",this.switchMenu.bind(this));this.teContainer=c.parseHTML('
\n
\n
\n
\n\n
\n
\n
\n
'),this.teContainerInner=this.teContainer.querySelector(".emote-menu-inner"),this.faContainer=c.parseHTML('
\n
\n
\n
\n\n
\n
\n
\n
'),this.faContainerInner=this.faContainer.querySelector(".emote-menu-inner"),this.observer=new MutationObserver(e=>{for(const t of e)this.observe(t)}),this.enableHideEmojis=this.enableHideEmojis.bind(this),this.disableHideEmojis=this.disableHideEmojis.bind(this),this.updateTwitchEmotes=this.updateTwitchEmotes.bind(this)}async enabled(){this.log("Starting to observe"),this.observer.observe(document.getElementById("app-mount"),{childList:!0,subtree:!0}),this.hideEmojiCancel=this.registerSetting(this.hideEmojisID,this.enableHideEmojis,this.disableHideEmojis),this.hideEmojis&&this.enableHideEmojis(),Ye.emotesLoaded&&this.updateTwitchEmotes(),this.updateFavorites(),g.on("emotes-loaded",this.updateTwitchEmotes)}disabled(){g.off("emotes-loaded",this.updateTwitchEmotes),this.observer.disconnect(),this.disableHideEmojis(),this.hideEmojiCancel&&this.hideEmojiCancel()}enableHideEmojis(){const e=document.querySelector(".emojiPicker-3m1S-j");e&&e.classList.add("bd-qme-hidden")}disableHideEmojis(){const e=document.querySelector(".emojiPicker-3m1S-j");e&&e.classList.remove("bd-qme-hidden")}insertEmote(e){const t=c.getTextArea();c.insertText(t[0]," "==t.val().slice(-1)?t.val()+e:t.val()+" "+e)}favContext(e){e.stopPropagation();const t=e.target.closest(".emote-container").children[0],s=$('
Remove
');s.css({top:e.pageY-$("#bd-qem-favourite-container").offset().top,left:e.pageX-$("#bd-qem-favourite-container").offset().left}),$(t).parent().append(s),s.on("click",e=>{e.preventDefault(),e.stopPropagation(),$(t).remove(),Ye.removeFavorite($(t).attr("title")),this.updateFavorites(),$(document).off("mousedown.emotemenu")}),$(document).on("mousedown.emotemenu",function(e){"removemenu"!=e.target.id&&($("#removemenu").remove(),$(document).off("mousedown.emotemenu"))})}switchMenu(e){let t="string"==typeof e?e:e.target.id;"bd-qem-emojis"==t&&this.hideEmojis&&(t="bd-qem-favourite");const s=$("#bd-qem-twitch"),n=$("#bd-qem-favourite"),i=$("#bd-qem-emojis");switch(s.removeClass("active"),n.removeClass("active"),i.removeClass("active"),$(".emojiPicker-3m1S-j").hide(),$("#bd-qem-favourite-container").hide(),$("#bd-qem-twitch-container").hide(),t){case"bd-qem-twitch":s.addClass("active"),$("#bd-qem-twitch-container").show();break;case"bd-qem-favourite":n.addClass("active"),$("#bd-qem-favourite-container").show();break;case"bd-qem-emojis":i.addClass("active"),$(".emojiPicker-3m1S-j").show(),$(".emojiPicker-3m1S-j input").focus()}t&&(this.lastTab=t)}observe(e){if(!(e.addedNodes.length&&e.addedNodes[0]instanceof Element))return;const t=e.addedNodes[0];if(!t.classList.contains("popout-3sVMXz")||t.classList.contains("popoutLeft-30WmrD")||!t.getElementsByClassName("emojiPicker-3m1S-j").length)return;const s=$(t);this.hideEmojis?s.addClass("bd-qme-hidden"):s.removeClass("bd-qme-hidden"),s.prepend(this.qmeHeader),s.append(this.teContainer),s.append(this.faContainer),this.switchMenu(this.lastTab)}updateTwitchEmotes(){for(;this.teContainerInner.firstChild;)this.teContainerInner.firstChild.remove();for(const e in Ye.getCategory("TwitchGlobal")){if(!Ye.getCategory("TwitchGlobal").hasOwnProperty(e))continue;const t=Ye.getUrl("TwitchGlobal",e),s=xt(e,t,{onClick:this.insertEmote.bind(this,e)});this.teContainerInner.append(s)}}updateFavorites(){for(;this.faContainerInner.firstChild;)this.faContainerInner.firstChild.remove();for(const e in Ye.favorites){const t=Ye.favorites[e],s=xt(e,t,{onClick:this.insertEmote.bind(this,e),onContextMenu:this.favContext.bind(this)});this.faContainerInner.append(s)}Ye.saveFavorites()}},Mt=new class extends _e{get name(){return"EmoteAutocapitalize"}get collection(){return"emotes"}get category(){return"general"}get id(){return"autoCaps"}enabled(){$("body").off(".bdac"),$("body").on("keyup.bdac change.bdac paste.bdac",$(".channelTextArea-1LDbYG textarea:first"),()=>{const e=$(".channelTextArea-1LDbYG textarea:first").val();if(null==e)return;const t=e.split(" ").pop();if(t.length>3){if("danSgame"==t)return;const s=this.capitalize(t.toLowerCase());null!=s&&c.insertText(c.getTextArea()[0],e.replace(t,s))}})}disabled(){$("body").off(".bdac")}capitalize(e){const t=Ye.getCategory("TwitchGlobal");for(const s in t)if(t.hasOwnProperty(s)&&e==(s+"").toLowerCase())return s}};const At=s(1),Dt=s(2);var Nt=new class extends _e{get name(){return"WindowPrefs"}get category(){return"window"}get id(){return"transparency"}get WindowConfigFile(){if(this._windowConfigFile)return this._windowConfigFile;const e=s(0).remote.app,t=e.getAppPath(),n=e.getPath("userData"),i=Dt.resolve(n,e.getVersion(),"modules","discord_desktop_core","injector","config.json"),o=Dt.resolve(t,"..","app","config.json"),r=At.existsSync(o)?o:At.existsSync(i)?i:null;return this._windowConfigFile=r||null}enabled(){this.setWindowPreference("transparent",!0),this.setWindowPreference("backgroundColor",null)}disabled(){this.setWindowPreference("transparent",!1),this.setWindowPreference("backgroundColor","#2f3136")}getAllWindowPreferences(){return this.WindowConfigFile?require(this.WindowConfigFile):{}}getWindowPreference(e){if(this.WindowConfigFile)return this.getAllWindowPreferences()[e]}setWindowPreference(e,t){if(!this.WindowConfigFile)return;const n=this.getAllWindowPreferences();n[e]=t,delete s.c[this.WindowConfigFile],At.writeFileSync(this.WindowConfigFile,JSON.stringify(n,null,4))}};class Ft extends O.Component{render(){return O.createElement("svg",{className:"bd-logo "+this.props.className,height:"100%",width:this.props.size||"16px",viewBox:"0 0 2000 2000",style:{fillRule:"evenodd",clipRule:"evenodd",strokeLinecap:"round",strokeLinejoin:"round"}},O.createElement("metadata",null),O.createElement("defs",null,O.createElement("filter",{id:"shadow1"},O.createElement("feDropShadow",{dx:"20",dy:"0",stdDeviation:"20",floodColor:"rgba(0,0,0,0.35)"})),O.createElement("filter",{id:"shadow2"},O.createElement("feDropShadow",{dx:"15",dy:"0",stdDeviation:"20",floodColor:"rgba(255,255,255,0.15)"})),O.createElement("filter",{id:"shadow3"},O.createElement("feDropShadow",{dx:"10",dy:"0",stdDeviation:"20",floodColor:"rgba(0,0,0,0.35)"}))),O.createElement("g",null,O.createElement("path",{style:{filter:"url(#shadow3)"},fill:"#171717",opacity:"1",d:"M1195.44+135.442L1195.44+135.442L997.6+136.442C1024.2+149.742+1170.34+163.542+1193.64+179.742C1264.34+228.842+1319.74+291.242+1358.24+365.042C1398.14+441.642+1419.74+530.642+1422.54+629.642L1422.54+630.842L1422.54+632.042C1422.54+773.142+1422.54+1228.14+1422.54+1369.14L1422.54+1370.34L1422.54+1371.54C1419.84+1470.54+1398.24+1559.54+1358.24+1636.14C1319.74+1709.94+1264.44+1772.34+1193.64+1821.44C1171.04+1837.14+1025.7+1850.54+1000+1863.54L1193.54+1864.54C1539.74+1866.44+1864.54+1693.34+1864.54+1296.64L1864.54+716.942C1866.44+312.442+1541.64+135.442+1195.44+135.442Z"}),O.createElement("path",{style:{filter:"url(#shadow2)"},fill:"#3E82E5",opacity:"1",d:"M1695.54+631.442C1685.84+278.042+1409.34+135.442+1052.94+135.442L361.74+136.442L803.74+490.442L1060.74+490.442C1335.24+490.442+1335.24+835.342+1060.74+835.342L1060.74+1164.84C1150.22+1164.84+1210.53+1201.48+1241.68+1250.87C1306.07+1353+1245.76+1509.64+1060.74+1509.64L361.74+1863.54L1052.94+1864.54C1409.24+1864.54+1685.74+1721.94+1695.54+1368.54C1695.54+1205.94+1651.04+1084.44+1572.64+999.942C1651.04+915.542+1695.54+794.042+1695.54+631.442Z"}),O.createElement("path",{style:{filter:"url(#shadow1)"},fill:"#FFFFFF",opacity:"1",d:"M1469.25+631.442C1459.55+278.042+1183.05+135.442+826.65+135.442L135.45+135.442L135.45+1004C135.45+1004+135.427+1255.21+355.626+1255.21C575.825+1255.21+575.848+1004+575.848+1004L577.45+490.442L834.45+490.442C1108.95+490.442+1108.95+835.342+834.45+835.342L664.65+835.342L664.65+1164.84L834.45+1164.84C923.932+1164.84+984.244+1201.48+1015.39+1250.87C1079.78+1353+1019.47+1509.64+834.45+1509.64L135.45+1509.64L135.45+1864.54L826.65+1864.54C1182.95+1864.54+1459.45+1721.94+1469.25+1368.54C1469.25+1205.94+1424.75+1084.44+1346.35+999.942C1424.75+915.542+1469.25+794.042+1469.25+631.442Z"})))}}var Tt=new class{initialize(){c.suppressErrors(this.patchSocial.bind(this),"BD Social Patch")(),c.suppressErrors(this.patchGuildPills.bind(this),"BD Guild Pills Patch")(),c.suppressErrors(this.patchGuildListItems.bind(this),"BD Guild List Items Patch")(),c.suppressErrors(this.patchGuildSeparator.bind(this),"BD Guild Separator Patch")()}patchSocial(){if(this.socialPatch)return;const e=u.getByDisplayName("TabBar"),t=u.getByDisplayName("Anchor");e&&t&&(this.socialPatch=F.after("ThemeHelper",e.prototype,"render",(e,s,n)=>{const i=n.props.children;if(!i||!i.length)return;if("Separator"!==i[i.length-2].type.displayName)return;if(!i[i.length-1].type.toString().includes("socialLinks"))return;const o=i[i.length-1].type;i[i.length-1].type=function(){const e=o(...arguments);return e.props.children.push(p.React.createElement(t,{className:"bd-social-link",href:"https://github.com/rauenzi/BetterDiscordApp",rel:"author",title:"BandagedBD",target:"_blank"},p.React.createElement(Ft,{size:"16px",className:"bd-social-logo"}))),e}}))}patchGuildListItems(){if(this.guildListItemsPatch)return;const e=p.GuildClasses.listItem.split(" ")[0],t=p.GuildClasses.blobContainer.split(" ")[0],s=c.getReactInstance(document.querySelector(`.${e} .${t}`).parentElement).return.type;s&&(this.guildListItemsPatch=F.after("ThemeHelper",s.prototype,"render",(e,t,s)=>{const n=e.props;return s.props.className+=" bd-guild",n.unread&&(s.props.className+=" bd-unread"),n.selected&&(s.props.className+=" bd-selected"),n.audio&&(s.props.className+=" bd-audio"),n.video&&(s.props.className+=" bd-video"),n.badge&&(s.props.className+=" bd-badge"),n.animatable&&(s.props.className+=" bd-animatable"),s}))}patchGuildPills(){if(this.guildPillPatch)return;const e=u.getModule(e=>e.default&&!e.default.displayName&&e.default.toString&&e.default.toString().includes("translate3d"));e&&(this.guildPillPatch=F.after("ThemeHelper",e,"default",(e,t,s)=>{const n=t[0];return n.unread&&(s.props.className+=" bd-unread"),n.selected&&(s.props.className+=" bd-selected"),n.hovered&&(s.props.className+=" bd-hovered"),s}))}patchGuildSeparator(){if(this.guildSeparatorPatch)return;const e=u.getByDisplayName("Guilds"),t=u.getByProps("renderListItem");if(!t||!e)return;const s=function(){const e=t.Separator(...arguments);return e.props.className+=" bd-guild-separator",e};this.guildSeparatorPatch=F.after("ThemeHelper",e.prototype,"render",(e,t,n)=>{const i=c.findInReactTree(n,e=>e.type&&!e.type.displayName&&"function"==typeof e.type&&c.isEmpty(e.props));i&&(i.type=s)})}};const Bt=p.GuildClasses;function Lt(){}Lt.prototype.setConfig=function(e){Object.assign(i,e)},Lt.prototype.init=async function(){if(i.version
Please download the latest version from GitHub");v.initialize(),await P.initialize(),d.log("Startup","Initializing Settings"),A.initialize(),x.initialize(),await this.waitForGuilds(),z.initialize(),Tt.initialize();for(const e in n)n[e].initialize();d.log("Startup","Loading Plugins");const e=Oe.initialize();d.log("Startup","Loading Themes");const t=Ie.initialize();d.log("Startup","Removing Loading Icon"),document.getElementsByClassName("bd-loaderv2")[0].remove(),d.log("Startup","Collecting Startup Errors"),te.showAddonErrors({plugins:e,themes:t})},Lt.prototype.waitForGuilds=function(){return new Promise(e=>{const t=function(){"complete"!=document.readyState&&setTimeout(t,100);const s=Bt.wrapper.split(" ")[0],n=Bt.listItem.split(" ")[0],o=Bt.blobContainer.split(" ")[0];if(document.querySelectorAll(`.${s} .${n} .${o}`).length>0)return e(i.deferLoaded=!0);setTimeout(t,100)};t()})};var jt=new Lt;const $t={get React(){return p.React},get ReactDOM(){return p.ReactDOM},get WindowConfigFile(){if(this._windowConfigFile)return this._windowConfigFile;const e=s(0).remote.app,t=s(2),n=e.getAppPath(),i=e.getPath("userData"),o=t.resolve(i,e.getVersion(),"modules","discord_desktop_core","injector","config.json"),r=t.resolve(n,"..","app","config.json"),a=s(1),l=a.existsSync(r)?r:a.existsSync(o)?o:null;return this._windowConfigFile=l||null},getAllWindowPreferences:function(){return this.WindowConfigFile?require(this.WindowConfigFile):{}},getWindowPreference:function(e){if(this.WindowConfigFile)return this.getAllWindowPreferences()[e]},setWindowPreference:function(e,t){if(!this.WindowConfigFile)return;const n=s(1),i=this.getAllWindowPreferences();i[e]=t,delete s.c[this.WindowConfigFile],n.writeFileSync(this.WindowConfigFile,JSON.stringify(i,null,4))},injectCSS:function(e,t){x.injectStyle(e,t)},clearCSS:function(e){x.removeStyle(e)},linkJS:function(e,t){return x.injectScript(e,t)},unlinkJS:function(e){x.removeScript(e)},alert:function(e,t){te.alert(e,t)},showConfirmationModal:function(e,t,s={}){return te.showConfirmationModal(e,t,s)},showToast:function(e,t={}){_.show(e,t)},findModule:function(e){return u.getModule(e)},findAllModules:function(e){return u.getModule(e,!1)},findModuleByProps:function(...e){return u.getByProps(...e)},findModuleByPrototypes:function(...e){return u.getByPrototypes(...e)},findModuleByDisplayName:function(e){return u.getByDisplayName(e)},getInternalInstance:function(e){if(e instanceof window.jQuery||e instanceof Element)return e instanceof jQuery&&(e=e[0]),c.getReactInstance(e)},loadData:function(e,t){return v.getPluginData(e,t)}};$t.getData=$t.loadData,$t.saveData=function(e,t,s){return v.setPluginData(e,t,s)},$t.setData=$t.saveData,$t.deleteData=function(e,t){return v.deletePluginData(e,t)},$t.monkeyPatch=function(e,t,s){return c.monkeyPatch(e,t,s)},$t.onRemoved=function(e,t){return c.onRemoved(e,t)},$t.suppressErrors=function(e,t){return c.suppressErrors(e,t)},$t.testJSON=function(e){return c.testJSON(e)},$t.getBDData=function(e){return v.getBDData(e)},$t.setBDData=function(e,t){return v.setBDData(e,t)};var zt=$t;s.d(t,"default",function(){return Rt});const Ot=document.createElement("div");Ot.className="bd-loaderv2",Ot.title="BandagedBD is loading...",document.body.appendChild(Ot),window.BdApi=zt,window.pluginModule=Oe,window.themeModule=Ie,window.bdEmotes=Ye.Emotes,window.bemotes=Ye.blacklist,window.settingsModule=A,window.DataStore=v,window.DomManager=x,window.utils=c,window.Components=z,window.BDEvents=g,window.bdConfig=i,window.Strings=M;class Rt{constructor(e){jt.setConfig(e)}init(){jt.init()}}!function(){const e=s(4),t=e._load;e._load=function(e){return"betterdiscord"!==e&&!e.startsWith("betterdiscord/")||"api"!=e.substr("betterdiscord/".length)?t.apply(this,arguments):zt}}()}]).default; \ No newline at end of file +var Core=function(e){var t={};function s(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,s),i.l=!0,i.exports}return s.m=e,s.c=t,s.d=function(e,t,n){s.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},s.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},s.t=function(e,t){if(1&t&&(e=s(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(s.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)s.d(n,i,function(t){return e[t]}.bind(null,i));return n},s.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return s.d(t,"a",t),t},s.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},s.p="",s(s.s=6)}([function(e,t){e.exports=require("electron")},function(e,t){e.exports=require("fs")},function(e,t){e.exports=require("path")},function(e,t){e.exports=require("request")},function(e,t){e.exports=require("module")},function(e,t){e.exports=require("events")},function(e,t,s){"use strict";s.r(t);var n={};s.r(n),s.d(n,"EmoteModule",function(){return Ye}),s.d(n,"CustomCSS",function(){return it}),s.d(n,"VoiceMode",function(){return ot}),s.d(n,"ClassNormalizer",function(){return at}),s.d(n,"DeveloperMode",function(){return lt}),s.d(n,"PublicServers",function(){return yt}),s.d(n,"DarkMode",function(){return vt}),s.d(n,"MinimalMode",function(){return wt}),s.d(n,"TwentyFourHour",function(){return Ct}),s.d(n,"ColoredText",function(){return Et}),s.d(n,"VoiceDisconnect",function(){return Pt}),s.d(n,"EmoteMenu",function(){return kt}),s.d(n,"EmoteAutocaps",function(){return Mt}),s.d(n,"WindowPrefs",function(){return Nt});var i={local:!1,localServer:"//localhost:8080",minified:!0,version:"0.3.0",branch:"master",repo:"rauenzi",minSupportedVersion:"0.3.0",bbdVersion:"1.0.0"},o=[{type:"category",id:"general",name:"General",collapsible:!0,settings:[{type:"switch",id:"download",value:!0},{type:"switch",id:"emoteMenu",value:!0},{type:"switch",id:"hideEmojiMenu",value:!1,enableWith:"emoteMenu"},{type:"switch",id:"autoCaps",value:!1},{type:"switch",id:"showNames",value:!0},{type:"switch",id:"modifiers",value:!0},{type:"switch",id:"animateOnHover",value:!1}]},{type:"category",id:"categories",name:"Categories",collapsible:!0,settings:[{type:"switch",id:"twitchglobal",value:!0},{type:"switch",id:"twitchsubscriber",value:!1},{type:"switch",id:"frankerfacez",value:!0},{type:"switch",id:"bttv",value:!0}]}],r=[{type:"category",id:"general",collapsible:!0,settings:[{type:"switch",id:"emotes",value:!0},{type:"switch",id:"publicServers",value:!0},{type:"switch",id:"voiceDisconnect",value:!1},{type:"switch",id:"twentyFourHour",value:!1},{type:"switch",id:"classNormalizer",value:!0},{type:"switch",id:"showToasts",value:!0}]},{type:"category",id:"appearance",collapsible:!0,settings:[{type:"switch",id:"voiceMode",value:!1},{type:"switch",id:"minimalMode",value:!1},{type:"switch",id:"hideChannels",value:!1,enableWith:"minimalMode"},{type:"switch",id:"darkMode",value:!0},{type:"switch",id:"coloredText",value:!1}]},{type:"category",id:"addons",collapsible:!0,shown:!1,settings:[{type:"switch",id:"addonErrors",value:!0},{type:"switch",id:"autoScroll",value:!0},{type:"switch",id:"autoReload",value:!0},{type:"dropdown",id:"editAction",value:"detached",options:[{value:"detached"},{value:"system"}]}]},{type:"category",id:"customcss",collapsible:!0,shown:!1,settings:[{type:"switch",id:"customcss",value:!0},{type:"switch",id:"liveUpdate",value:!1},{type:"dropdown",id:"openAction",value:"settings",options:[{value:"settings"},{value:"detached"},{value:"system"}]}]},{type:"category",id:"developer",collapsible:!0,shown:!1,settings:[{type:"switch",id:"developerMode",value:!1},{type:"switch",id:"copySelector",value:!1,enableWith:"developerMode"}]},{type:"category",id:"window",collapsible:!0,shown:!1,settings:[{type:"switch",id:"transparency",value:!1},{type:"switch",id:"frame",value:!1,hidden:!0}]}],a={Panels:{plugins:"Plugins",themes:"Themes",customcss:"Custom CSS"},Collections:{settings:{name:"Settings",general:{name:"General",emotes:{name:"Emote System",note:"Enables BD's emote system"},publicServers:{name:"Public Servers",note:"Display public servers button"},voiceDisconnect:{name:"Voice Disconnect",note:"Disconnect from voice server when closing Discord"},twentyFourHour:{name:"24-Hour Timestamps",note:"Hides channels when in minimal mode"},classNormalizer:{name:"Normalize Classes",note:"Adds stable classes to elements to help themes. (e.g. adds .da-channels to .channels-Ie2l6A)"},showToasts:{name:"Show Toasts",note:"Shows a small notification for important information"}},appearance:{name:"Appearance",voiceMode:{name:"Voice Mode",note:"Hides everything that isn't voice chat"},minimalMode:{name:"Minimal Mode",note:"Hide elements and reduce the size of elements"},hideChannels:{name:"Hide Channels",note:"Hides channels when in minimal mode"},darkMode:{name:"Dark Mode",note:"Make certain elements dark by default"},coloredText:{name:"Colored Text",note:"Make text colour the same as role color"}},addons:{name:"Addon Manager",addonErrors:{name:"Show Addon Errors",note:"Shows a modal with plugin/theme errors"},autoScroll:{name:"Scroll To Settings",note:"Auto-scrolls to a plugin's settings when the button is clicked (only if out of view)"},autoReload:{name:"Automatic Loading",note:"Automatically loads, reloads, and unloads plugins and themes"},editAction:{name:"Edit Action",note:"Where plugins & themes appear when editing",options:{detached:"Detached Window",system:"System Editor"}}},customcss:{name:"Custom CSS",customcss:{name:"Custom CSS",note:"Enables the Custom CSS tab"},liveUpdate:{name:"Live Update",note:"Updates the css as you type"},startDetached:{name:"Start Detached",note:"Clicking the Custom CSS tab opens the editor in a separate window"},nativeOpen:{name:"Open in Native Editor",note:"Clicking the Custom CSS tab opens your custom css in your native editor"},openAction:{name:"Editor Location",note:"Where Custom CSS should open by default",options:{settings:"Settings Menu",detached:"Detached Window",system:"System Editor"}}},developer:{name:"Developer Settings",developerMode:{name:"Developer Mode",note:"Allows activating debugger when pressing F8"},copySelector:{name:"Copy Selector",note:'Adds a "Copy Selector" option to context menus when developer mode is active'}},window:{name:"Window Preferences",transparency:{name:"Enable Transparency",note:"Enables the main window to be see-through (requires restart)"},frame:{name:"Window Frame",note:"Adds the native os window frame to the main window"}}},emotes:{name:"Emotes",general:{name:"General",download:{name:"Download Emotes",note:"Download emotes whenever they are out of date"},emoteMenu:{name:"Emote Menu",note:"Show Twitch/Favourite emotes in emote menu"},hideEmojiMenu:{name:"Hide Emoji Menu",note:"Hides Discord's emoji menu when using emote menu"},autoCaps:{name:"Emote Autocapitalization",note:"Autocapitalize emote commands"},showNames:{name:"Show Names",note:"Show emote names on hover"},modifiers:{name:"Show Emote Modifiers",note:"Enable emote mods (flip, spin, pulse, spin2, spin3, 1spin, 2spin, 3spin, tr, bl, br, shake, shake2, shake3, flap)"},animateOnHover:{name:"Animate On Hover",note:"Only animate the emote modifiers on hover"}},categories:{name:"Categories",twitchglobal:{name:"Twitch Globals",note:"Show Twitch global emotes"},twitchsubscriber:{name:"Twitch Subscribers",note:"Show Twitch subscriber emotes"},frankerfacez:{name:"FrankerFaceZ",note:"Show emotes from FFZ"},bttv:{name:"BetterTTV",note:"Show emotes from BTTV"}}}},Addons:{title:"{{name}} v{{version}} by {{author}}",openFolder:"Open {{type}} Folder",reload:"Reload",addonSettings:"Settings",website:"Website",source:"Source",server:"Support Server",donate:"Donate",name:"Name",author:"Author",version:"Version",added:"Date Added",modified:"Date Modified",search:"Search {{type}}",editAddon:"Edit",deleteAddon:"Delete",confirmDelete:"Are you sure you want to delete {{name}}?",confirmationText:"You have unsaved changes to {{name}}. Closing this window will lose all those changes."},Emotes:{loading:"Loading emotes in the background do not reload.",loaded:"All emotes successfully loaded.",clearEmotes:"Clear Emote Data",favoriteAction:"Favorite!"},CustomCSS:{confirmationText:"You have unsaved changes to your Custom CSS. Closing this window will lose all those changes.",update:"Update",save:"Save",openNative:"Open in System Editor",openDetached:"Detach Window",settings:"Editor Settings",editorTitle:"Custom CSS Editor"},PublicServers:{button:"public",join:"Join",joining:"Joining",joined:"Joined",loading:"Loading",loadMore:"Load More",notConnected:"Not connected to DiscordServers.com!",search:"Search",connect:"Connect",reconnect:"Reconnect",categories:"Categories",connection:"Connected as: {{username}}#{{discriminator}}",results:"Showing {{start}}-{{end}} of {{total}} results in {{category}}",query:"for {{query}}"},Modals:{confirmAction:"Are You Sure?",okay:"Okay",cancel:"Cancel",close:"Close",name:"Name",message:"Message",error:"Error",addonErrors:"Addon Errors"},Sorting:{sortBy:"Sort By",order:"Order",ascending:"Ascending",descending:"Descending"}};const l={err:"error",error:"error",dbg:"debug",debug:"debug",log:"log",warn:"warn",info:"info"};class d{static stacktrace(e,t,s){console.error(`%c[${e}]%c ${t}\n\n%c`,"color: #3a71c1; font-weight: 700;","color: red; font-weight: 700;","color: red;",s)}static err(e,...t){d._log(e,t,"error")}static warn(e,...t){d._log(e,t,"warn")}static info(e,...t){d._log(e,t,"info")}static debug(e,...t){d._log(e,t,"debug")}static log(e,...t){d._log(e,t)}static _log(e,t,s="log"){s=d.parseType(s),Array.isArray(t)||(t=[t]),console[s](`%c[BandagedBD]%c [${e}]%c`,"color: #3E82E5; font-weight: 700;","color: #3a71c1;","",...t)}static parseType(e){return l.hasOwnProperty(e)?l[e]:"log"}}class c{static repoUrl(e){return`https://cdn.staticaly.com/gh/${i.repo}/BetterDiscordApp/${i.hash}/${e}`}static parseHTML(e,t=!1){const s=document.createElement("template");s.innerHTML=e;const n=s.content.cloneNode(!0);return t?n:n.childNodes.length>1?n.childNodes:n.childNodes[0]}static getTextArea(){return $(".channelTextArea-1LDbYG textarea")}static insertText(e,t){e.focus(),e.selectionStart=0,e.selectionEnd=e.value.length,document.execCommand("insertText",!1,t)}static escape(e){return e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}static testJSON(e){try{return JSON.parse(e)}catch(e){return!1}}static suppressErrors(e,t){return(...s)=>{try{return e(...s)}catch(e){d.stacktrace("SuppressedError","Error occurred in "+t,e)}}}static onRemoved(e,t){const s=new MutationObserver(n=>{for(let i=0;i-1,l=r.some(t=>t.contains(e));(a||l)&&(s.disconnect(),t())}});s.observe(document.body,{subtree:!0,childList:!0})}static isEmpty(e){if(null==e||null==e||""==e)return!0;if("object"!=typeof e)return!1;if(Array.isArray(e))return 0==e.length;for(const t in e)if(e.hasOwnProperty(t))return!1;return!0}static memoizeObject(e){const t=new Proxy(e,{get:function(e,t){if(e.hasOwnProperty(t)){if(Object.getOwnPropertyDescriptor(e,t).get){const s=e[t];delete e[t],e[t]=s}return e[t]}},set:function(e,t,s){return e.hasOwnProperty(t)?d.error("MemoizedObject","Trying to overwrite existing property"):(e[t]=s,e[t])}});return Object.defineProperty(t,"hasOwnProperty",{value:function(e){return void 0!==this[e]}}),t}static extend(e,...t){for(let s=0;se.startsWith("__reactInternalInstance"))]||null}static getOwnerInstance(e,{include:t,exclude:s=["Popout","Tooltip","Scroller","BackgroundFlash"],filter:n=(e=>e)}={}){if(void 0===e)return;const i=void 0===t,o=i?s:t;function r(e){const t=function(e){const t=e.type;return t&&(t.displayName||t.name)||null}(e);return null!==t&&!!(o.includes(t)^i)}let a=this.getReactInstance(e);for(a=a&&a.return;null!==a;a=a.return){if(null===a)continue;const e=a.stateNode;if(null!==a&&!(e instanceof HTMLElement)&&r(a)&&n(e))return e}return null}}class h{static byProperties(e,t=(e=>e)){return s=>{const n=t(s);return!!n&&e.every(e=>void 0!==n[e])}}static byPrototypeFields(e,t=(e=>e)){return s=>{const n=t(s);return!!n&&(!!n.prototype&&e.every(e=>void 0!==n.prototype[e]))}}static byCode(e,t=(e=>e)){return s=>{const n=t(s);return!!n&&-1!==n.toString([]).search(e)}}static byString(...e){return t=>{const s=t.toString([]);for(const t of e)if(!s.includes(t))return!1;return!0}}static byDisplayName(e){return t=>t&&t.displayName===e}static combine(...e){return t=>e.every(e=>e(t))}}class u{static find(e,t=!0){return this.getModule(e,t)}static findAll(e){return this.getModule(e,!1)}static findByUniqueProperties(e,t=!0){return t?this.getByProps(...e):this.getAllByProps(...e)}static findByDisplayName(e){return this.getByDisplayName(e)}static getModule(e,t=!0){const s=this.getAllModules(),n=[];for(const i in s){if(!s.hasOwnProperty(i))continue;const o=s[i],{exports:r}=o;let a=null;if(r&&(r.__esModule&&r.default&&e(r.default)&&(a=r.default),e(r)&&(a=r),a)){if(t)return a;n.push(a)}}return t||0==n.length?void 0:n}static getModules(e){return this.getModule(e,!1)}static getByDisplayName(e){return this.getModule(h.byDisplayName(e),!0)}static getByRegex(e,t=!0){return this.getModule(h.byCode(e),t)}static getByPrototypes(...e){return this.getModule(h.byPrototypeFields(e),!0)}static getAllByPrototypes(...e){return this.getModule(h.byPrototypeFields(e),!1)}static getByProps(...e){return this.getModule(h.byProperties(e),!0)}static getAllByProps(...e){return this.getModule(h.byProperties(e),!1)}static getByString(...e){return this.getModule(h.byString(...e),!0)}static getAllByString(...e){return this.getModule(h.byString(...e),!1)}static get require(){if(this._require)return this._require;const e="bbd-webpackmodules",t="function"==typeof window.webpackJsonp?window.webpackJsonp([],{[e]:(e,t,s)=>t.default=s},[e]).default:window.webpackJsonp.push([[],{[e]:(e,t,s)=>e.exports=s},[[e]]]);return delete t.m[e],delete t.c[e],this._require=t}static getAllModules(){return this.require.c}}var p=c.memoizeObject({get React(){return u.getByProps("createElement","cloneElement")},get ReactDOM(){return u.getByProps("render","findDOMNode")},get Flux(){return u.getByProps("connectStores")},get Events(){return u.getByPrototypes("setMaxListeners","emit")},get GuildStore(){return u.getByProps("getGuild")},get SortedGuildStore(){return u.getByProps("getSortedGuilds")},get SelectedGuildStore(){return u.getByProps("getLastSelectedGuildId")},get GuildSync(){return u.getByProps("getSyncedGuilds")},get GuildInfo(){return u.getByProps("getAcronym")},get GuildChannelsStore(){return u.getByProps("getChannels","getDefaultChannel")},get GuildMemberStore(){return u.getByProps("getMember")},get MemberCountStore(){return u.getByProps("getMemberCounts")},get GuildEmojiStore(){return u.getByProps("getEmojis")},get GuildActions(){return u.getByProps("markGuildAsRead")},get GuildPermissions(){return u.getByProps("getGuildPermissions")},get ChannelStore(){return u.getByProps("getChannels","getDMFromUserId")},get SelectedChannelStore(){return u.getByProps("getLastSelectedChannelId")},get ChannelActions(){return u.getByProps("selectChannel")},get PrivateChannelActions(){return u.getByProps("openPrivateChannel")},get ChannelSelector(){return u.getByProps("selectGuild","selectChannel")},get UserInfoStore(){return u.getByProps("getToken")},get UserSettingsStore(){return u.getByProps("guildPositions")},get AccountManager(){return u.getByProps("register","login")},get UserSettingsUpdater(){return u.getByProps("updateRemoteSettings")},get OnlineWatcher(){return u.getByProps("isOnline")},get CurrentUserIdle(){return u.getByProps("getIdleTime")},get RelationshipStore(){return u.getByProps("isBlocked","getFriendIDs")},get RelationshipManager(){return u.getByProps("addRelationship")},get MentionStore(){return u.getByProps("getMentions")},get UserStore(){return u.getByProps("getCurrentUser")},get UserStatusStore(){return u.getByProps("getStatus","getState")},get UserTypingStore(){return u.getByProps("isTyping")},get UserActivityStore(){return u.getByProps("getActivity")},get UserNameResolver(){return u.getByProps("getName")},get UserNoteStore(){return u.getByProps("getNote")},get UserNoteActions(){return u.getByProps("updateNote")},get EmojiInfo(){return u.getByProps("isEmojiDisabled")},get EmojiUtils(){return u.getByProps("getGuildEmoji")},get EmojiStore(){return u.getByProps("getByCategory","EMOJI_NAME_RE")},get InviteStore(){return u.getByProps("getInvites")},get InviteResolver(){return u.getByProps("findInvite")},get InviteActions(){return u.getByProps("acceptInvite")},get DiscordConstants(){return u.getByProps("Permissions","ActivityTypes","StatusTypes")},get DiscordPermissions(){return u.getByProps("Permissions","ActivityTypes","StatusTypes").Permissions},get PermissionUtils(){return u.getByProps("getHighestRole")},get ColorConverter(){return u.getByProps("hex2int")},get ColorShader(){return u.getByProps("darken")},get TinyColor(){return u.getByPrototypes("toRgb")},get ClassResolver(){return u.getByProps("getClass")},get ButtonData(){return u.getByProps("ButtonSizes")},get IconNames(){return u.getByProps("IconNames")},get NavigationUtils(){return u.getByProps("transitionTo","replaceWith","getHistory")},get MessageStore(){return u.getByProps("getMessages")},get MessageActions(){return u.getByProps("jumpToMessage","_sendMessage")},get MessageQueue(){return u.getByProps("enqueue")},get MessageParser(){return u.getByProps("createMessage","parse","unparse")},get hljs(){return u.getByProps("highlight","highlightBlock")},get SimpleMarkdown(){return u.getByProps("parseBlock","parseInline","defaultOutput")},get ExperimentStore(){return u.getByProps("getExperimentOverrides")},get ExperimentsManager(){return u.getByProps("isDeveloper")},get CurrentExperiment(){return u.getByProps("getExperimentId")},get ImageResolver(){return u.getByProps("getUserAvatarURL","getGuildIconURL")},get ImageUtils(){return u.getByProps("getSizedImageSrc")},get AvatarDefaults(){return u.getByProps("getUserAvatarURL","DEFAULT_AVATARS")},get WindowInfo(){return u.getByProps("isFocused","windowSize")},get TagInfo(){return u.getByProps("VALID_TAG_NAMES")},get DOMInfo(){return u.getByProps("canUseDOM")},get LocaleManager(){return u.getByProps("setLocale")},get Moment(){return u.getByProps("parseZone")},get LocationManager(){return u.getByProps("createLocation")},get Timestamps(){return u.getByProps("fromTimestamp")},get TimeFormatter(){return u.getByProps("dateFormat")},get Strings(){return u.getByProps("Messages").Messages},get StringFormats(){return u.getByProps("a","z")},get StringUtils(){return u.getByProps("toASCII")},get URLParser(){return u.getByProps("Url","parse")},get ExtraURLs(){return u.getByProps("getArticleURL")},get DNDActions(){return u.getByProps("beginDrag")},get DNDSources(){return u.getByProps("addTarget")},get DNDObjects(){return u.getByProps("DragSource")},get MediaDeviceInfo(){return u.getByProps("Codecs","SUPPORTED_BROWSERS")},get MediaInfo(){return u.getByProps("getOutputVolume")},get MediaEngineInfo(){return u.getByProps("MediaEngineFeatures")},get VoiceInfo(){return u.getByProps("EchoCancellation")},get VideoStream(){return u.getByProps("getVideoStream")},get SoundModule(){return u.getByProps("playSound")},get ElectronModule(){return u.getByProps("setBadge")},get Dispatcher(){return u.getByProps("dirtyDispatch")},get PathUtils(){return u.getByProps("hasBasename")},get NotificationModule(){return u.getByProps("showNotification")},get RouterModule(){return u.getByProps("Router")},get APIModule(){return u.getByProps("getAPIBaseURL")},get AnalyticEvents(){return u.getByProps("AnalyticEventConfigs")},get KeyGenerator(){return u.getByRegex(/"binary"/)},get Buffers(){return u.getByProps("Buffer","kMaxLength")},get DeviceStore(){return u.getByProps("getDevices")},get SoftwareInfo(){return u.getByProps("os")},get CurrentContext(){return u.getByProps("setTagsContext")},get GuildClasses(){const e=u.getByProps("wrapper","unreadMentionsBar"),t=u.getByProps("guildsError","selected"),s=u.getByProps("blobContainer");return Object.assign({},e,t,s)}});const m=s(5);var g=new class extends m{constructor(){super(),this.setMaxListeners(20)}dispatch(e,...t){this.emit(e,...t)}};const f=s(1),b=s(2),y=DiscordNative.globals.releaseChannel;var v=new class{constructor(){this.data={misc:{}},this.pluginData={},this.cacheData={}}initialize(){f.existsSync(this.baseFolder)||f.mkdirSync(this.baseFolder),f.existsSync(this.dataFolder)||f.mkdirSync(this.dataFolder),f.existsSync(this.localeFolder)||f.mkdirSync(this.localeFolder),f.existsSync(this.emoteFolder)||f.mkdirSync(this.emoteFolder),f.existsSync(this.cacheFile)||f.writeFileSync(this.cacheFile,JSON.stringify({})),f.existsSync(this.customCSS)||f.writeFileSync(this.customCSS,"");const e=f.readdirSync(this.dataFolder).filter(e=>!f.statSync(b.resolve(this.dataFolder,e)).isDirectory()&&e.endsWith(".json"));for(const t of e)this.data[t.split(".")[0]]=require(b.resolve(this.dataFolder,t));this.cacheData=c.testJSON(f.readFileSync(this.cacheFile).toString())||{}}get customCSS(){return this._customCSS||(this._customCSS=b.resolve(this.dataFolder,"custom.css"))}get baseFolder(){return this._baseFolder||(this._baseFolder=b.resolve(i.dataPath,"data"))}get dataFolder(){return this._dataFolder||(this._dataFolder=b.resolve(this.baseFolder,`${y}`))}get localeFolder(){return this._localeFolder||(this._localeFolder=b.resolve(this.baseFolder,"locales"))}get emoteFolder(){return this._emoteFolder||(this._emoteFolder=b.resolve(this.baseFolder,"emotes"))}get cacheFile(){return this._cacheFile||(this._cacheFile=b.resolve(this.baseFolder,".cache"))}getPluginFile(e){return b.resolve(i.dataPath,"plugins",e+".config.json")}_getFile(e){return"settings"==e||"plugins"==e||"themes"==e?b.resolve(this.dataFolder,`${e}.json`):b.resolve(this.dataFolder,"misc.json")}getBDData(e){return this.data.misc[e]||""}setBDData(e,t){this.data.misc[e]=t,f.writeFileSync(b.resolve(this.dataFolder,"misc.json"),JSON.stringify(this.data.misc,null,4))}getLocale(e){const t=b.resolve(this.localeFolder,`${e}.json`);return f.existsSync(t)?c.testJSON(f.readFileSync(t).toString()):null}saveLocale(e,t){f.writeFileSync(b.resolve(this.localeFolder,`${e}.json`),JSON.stringify(t,null,4))}getCacheHash(e,t){return this.cacheData[e]&&f.existsSync(b.resolve(this.baseFolder,e,`${t}.json`))&&this.cacheData[e][t]||""}setCacheHash(e,t,s){this.cacheData[e]||(this.cacheData[e]={}),this.cacheData[e][t]=s,f.writeFileSync(this.cacheFile,JSON.stringify(this.cacheData))}invalidateCache(e,t){this.cacheData[e]&&(delete this.cacheData[e][t],f.writeFileSync(this.cacheFile,JSON.stringify(this.cacheData)))}emotesExist(e){return f.existsSync(b.resolve(this.emoteFolder,`${e}.json`))}getEmoteData(e){const t=b.resolve(this.emoteFolder,`${e}.json`);return f.existsSync(t)?c.testJSON(f.readFileSync(t).toString()):null}saveEmoteData(e,t){f.writeFileSync(b.resolve(this.emoteFolder,`${e}.json`),JSON.stringify(t))}getData(e){return this.data[e]||""}setData(e,t){this.data[e]=t,f.writeFileSync(b.resolve(this.dataFolder,`${e}.json`),JSON.stringify(t,null,4))}loadCustomCSS(){return f.readFileSync(this.customCSS).toString()}saveCustomCSS(e){return f.writeFileSync(this.customCSS,e)}getPluginData(e,t){return void 0!==this.pluginData[e]?this.pluginData[e][t]||void 0:f.existsSync(this.getPluginFile(e))?(this.pluginData[e]=JSON.parse(f.readFileSync(this.getPluginFile(e))),this.pluginData[e][t]||void 0):void 0}setPluginData(e,t,s){void 0!==s&&(void 0===this.pluginData[e]&&(this.pluginData[e]={}),this.pluginData[e][t]=s,f.writeFileSync(this.getPluginFile(e),JSON.stringify(this.pluginData[e],null,4)))}deletePluginData(e,t){void 0===this.pluginData[e]&&(this.pluginData[e]={}),delete this.pluginData[e][t],f.writeFileSync(this.getPluginFile(e),JSON.stringify(this.pluginData[e],null,4))}};const w=s(3),{Dispatcher:C,DiscordConstants:S,UserSettingsStore:E}=p;var P=new class{get discordLocale(){return E.locale.split("-")[0]}get defaultLocale(){return"en"}constructor(){this.locale="",this.strings={}}async initialize(){await this.setLocale(this.discordLocale),C.subscribe(S.ActionTypes.USER_SETTINGS_UPDATE,({settings:e})=>{const t=e.locale;t&&t!=this.locale&&this.setLocale(t.split("-")[0])})}async setLocale(e){let t;if(e!=this.defaultLocale){if(!(t=await this.getLocaleStrings(e)))return this.setLocale(this.defaultLocale)}else t=a;this.locale=e,c.extend(this.strings,t),g.emit("strings-updated")}async getLocaleStrings(e){const t=v.getCacheHash("locales",e);if(!t)return await this.downloadLocale(e);const s=await this.downloadLocale(e,t);return s||v.getLocale(e)}downloadLocale(e,t=""){return new Promise(s=>{const n={url:c.repoUrl(`data/locales/${e}.json`),timeout:2e3,json:!0};t&&(n.headers={"If-None-Match":t}),w.get(n,(t,n,i)=>{if(t||200!==n.statusCode)return s(null);v.saveLocale(e,i),v.setCacheHash("locales",e,n.headers.etag),s(i)})})}};class x{static get bdHead(){return this.getElement("bd-head")}static get bdBody(){return this.getElement("bd-body")}static get bdScripts(){return this.getElement("bd-scripts")}static get bdStyles(){return this.getElement("bd-styles")}static get bdThemes(){return this.getElement("bd-themes")}static get bdCustomCSS(){return this.getElement("#customcss")}static initialize(){this.createElement("bd-head",{target:document.head}),this.createElement("bd-body",{target:document.body}),this.createElement("bd-scripts",{target:this.bdHead}),this.createElement("bd-styles",{target:this.bdHead}),this.createElement("bd-themes",{target:this.bdHead}),this.createElement("style",{id:"customcss",target:this.bdHead})}static escapeID(e){return e.replace(/^[^a-z]+|[^\w-]+/gi,"-")}static getElement(e,t=document){return e instanceof Node?e:t.querySelector(e)}static createElement(e,t={}){const{className:s,id:n,target:i}=t,o=document.createElement(e);return s&&(o.className=s),n&&(o.id=n),i&&this.getElement(i).append(o),o}static removeStyle(e){e=this.escapeID(e);const t=this.getElement(`#${e}`,this.bdStyles);t&&t.remove()}static injectStyle(e,t){e=this.escapeID(e);const s=this.getElement(`#${e}`,this.bdStyles)||this.createElement("style",{id:e});s.textContent=t,this.bdStyles.append(s)}static removeTheme(e){e=this.escapeID(e);const t=this.getElement(`#${e}`,this.bdThemes);t&&t.remove()}static injectTheme(e,t){e=this.escapeID(e);const s=this.getElement(`#${e}`,this.bdThemes)||this.createElement("style",{id:e});s.textContent=t,this.bdThemes.append(s)}static updateCustomCSS(e){this.bdCustomCSS.textContent=e}static removeScript(e){e=this.escapeID(e);const t=this.getElement(`#${e}`,this.bdScripts);t&&t.remove()}static injectScript(e,t){return e=this.escapeID(e),new Promise(s=>{const n=this.getElement(`#${e}`,this.bdScripts)||this.createElement("script",{id:e});n.src=t,n.onload=s,this.bdScripts.append(n)})}}class k extends String{format(e){return c.formatString(this,e)}}var M=new Proxy(P.strings,{get:function(e,t){return e.hasOwnProperty(t)?new Proxy(e[t],{get:function(e,t){return"string"==typeof e[t]?new k(e[t]):e[t]}}):new Proxy({},{get:function(){return`String group "${t}" not found.`}})}}),A=new class{constructor(){this.state={},this.collections=[],this.panels=[],this.updateStrings=this.updateStrings.bind(this)}initialize(){this.registerCollection("settings","Settings",r),g.on("strings-updated",this.updateStrings)}registerCollection(e,t,s,n=null){if(this.collections.find(t=>t.id==e))return d.error("Settings","Already have a collection with id "+e);this.collections.push({type:"collection",id:e,name:t,settings:s,button:n}),this.setupCollection(e),this.loadCollection(e),this.updateStrings()}removeCollection(e){const t=this.collections.findIndex(t=>t.id==e);if(!t<0)return d.error("Settings","No collection with id "+e);this.collections.splice(t,1)}registerPanel(e,t,s){if(this.panels.find(t=>t.id==e))return d.error("Settings","Already have a panel with id "+e);const{element:n,onClick:i,order:o=1}=s,r={id:e,order:o,label:t,section:e};i&&(r.clickListener=i),n&&(r.element=n instanceof p.React.Component?()=>p.React.createElement(n,{}):"function"==typeof n?n:()=>n),this.panels.push(r)}removePanel(e){const t=this.panels.findIndex(t=>t.id==e);if(!t<0)return d.error("Settings","No collection with id "+e);this.panels.splice(t,1)}getPath(e,t="",s=""){return{collection:3==e.length?e[0]:t,category:3==e.length?e[1]:2==e.length?e[0]:s,setting:e[e.length-1]}}setupCollection(e){const t=this.collections.find(t=>t.id==e);if(!t)return;const s=t.settings;this.state[t.id]||(this.state[t.id]={});for(let e=0;e{const e=this.state[o.collection][o.category][o.setting];return s.enableWith?!e:e}})}}}}saveSettings(){for(const e in this.state)this.saveCollection(e)}loadSettings(){for(const e in this.state)this.loadCollection(e)}saveCollection(e){v.setData(e,this.state[e])}loadCollection(e){const t=v.getData(e);if(!t)return this.saveCollection(e);for(const s in this.state[e]){t[s]||Object.assign(t,{[s]:this.state[e][s]});for(const n in this.state[e][s]){if(null==t[s][n])continue;const i=this.getSetting(e,s,n);if("switch"==i.type&&(this.state[e][s][n]=t[s][n]),"dropdown"==i.type){i.options.some(e=>e.value==t[s][n])&&(this.state[e][s][n]=t[s][n])}}}this.saveCollection(e)}onSettingChange(e,t,s,n){this.state[e][t][s]=n,g.dispatch("setting-updated",e,t,s,n),this.saveCollection(e)}getSetting(e,t,s){return 2==arguments.length?this.collections[0].find(e=>e.id==arguments[0]).settings.find(e=>e.id==arguments[1]):this.collections.find(t=>t.id==e).settings.find(e=>e.id==t).settings.find(e=>e.id==s)}get(e,t,s){return 2==arguments.length&&(s=t,t=e,e="settings"),!(!this.state[e]||!this.state[e][t])&&this.state[e][t][s]}set(e,t,s,n){return 3==arguments.length&&(n=s,s=t,t=e,e="settings"),this.onSettingChange(e,t,s,n)}on(e,t,s,n){const i=(i,o,r,a)=>{i===e&&o===t&&r===s&&n(a)};return g.on("setting-updated",i),()=>{g.off("setting-updated",i)}}updateStrings(){for(let e=0;e"before"===e.type))try{t.callback(this,arguments)}catch(s){d.err("Patcher",`Could not fire before callback of ${e.functionName} for ${t.caller}`,s)}const s=e.children.filter(e=>"instead"===e.type);if(s.length)for(const n of s)try{const s=n.callback(this,arguments,e.originalFunction.bind(this));void 0!==s&&(t=s)}catch(t){d.err("Patcher",`Could not fire instead callback of ${e.functionName} for ${n.caller}`,t)}else t=e.originalFunction.apply(this,arguments);for(const s of e.children.filter(e=>"after"===e.type))try{const n=s.callback(this,arguments,t);void 0!==n&&(t=n)}catch(t){d.err("Patcher",`Could not fire after callback of ${e.functionName} for ${s.caller}`,t)}return t}}static rePatch(e){e.proxyFunction=e.module[e.functionName]=this.makeOverride(e)}static makePatch(e,t,s){const n={name:s,module:e,functionName:t,originalFunction:e[t],proxyFunction:null,revert:()=>{n.module[n.functionName]=n.originalFunction,n.proxyFunction=null,n.children=[]},counter:0,children:[]};return n.proxyFunction=e[t]=this.makeOverride(n),this.patches.push(n),n}static before(e,t,s,n,i={}){return this.pushChildPatch(e,t,s,n,Object.assign(i,{type:"before"}))}static after(e,t,s,n,i={}){return this.pushChildPatch(e,t,s,n,Object.assign(i,{type:"after"}))}static instead(e,t,s,n,i={}){return this.pushChildPatch(e,t,s,n,Object.assign(i,{type:"instead"}))}static pushChildPatch(e,t,s,n,i={}){const{type:o="after",forcePatch:r=!0}=i,a=this.resolveModule(t);if(!a)return null;if(!a[s]&&r&&(a[s]=function(){}),!(a[s]instanceof Function))return null;"string"==typeof t&&(i.displayName=t);const l=`${i.displayName||a.displayName||a.name||a.constructor.displayName||a.constructor.name}.${s}`,d=this.patches.find(e=>e.module==a&&e.functionName==s)||this.makePatch(a,s,l);d.proxyFunction||this.rePatch(d);const c={caller:e,type:o,id:d.counter,callback:n,unpatch:()=>{if(d.children.splice(d.children.findIndex(e=>e.id===c.id&&e.type===o),1),d.children.length<=0){const e=this.patches.findIndex(e=>e.module==a&&e.functionName==s);this.patches[e].revert(),this.patches.splice(e,1)}}};return d.children.push(c),d.counter++,c.unpatch}}const T=p.React,B={},L=new Set,j=new Set;var z=new class{get named(){return B}get unknown(){return L}get listeners(){return j}constructor(){F.after("ReactComponents",T,"createElement",(e,t,s)=>{this.walkRenderTree(s)}),F.instead("ReactComponents",T.Component.prototype,"componentWillMount",e=>{this.addComponent(e.constructor)}),F.instead("ReactComponents",T.Component.prototype,"UNSAFE_componentWillMount",e=>{this.addComponent(e.constructor)}),F.instead("ReactComponents",T.PureComponent.prototype,"componentWillMount",e=>{this.addComponent(e.constructor)}),F.instead("ReactComponents",T.PureComponent.prototype,"UNSAFE_componentWillMount",e=>{this.addComponent(e.constructor)})}initialize(){this.walkReactTree(document.querySelector("#app-mount")._reactRootContainer._internalRoot.current)}get(e,t){return new Promise(s=>{if(B[e])return s(B[e]);if(j.add({name:e,filter:t,resolve:s}),t)for(const s of L)t(s)&&(s.displayName=e,L.delete(s),this.addNamedComponent(s))})}addNamedComponent(e){const t=e.displayName;if(!B[t]){B[t]=e;for(const s of j)s.name===t&&(s.resolve(e),j.delete(s))}}addUnknownComponent(e){if(!L.has(e)){for(const t of j)t.filter&&t.filter(e)&&(e.displayName=t.name,this.addNamedComponent(e));e.displayName||L.add(e)}}addComponent(e){return e.displayName?this.addNamedComponent(e):this.addUnknownComponent(e)}walkRenderTree(e){if(e){if("function"==typeof e.type&&this.addComponent(e.type),Array.isArray(e))for(const t of e)this.walkRenderTree(t);e.props&&e.props.children&&this.walkRenderTree(e.props.children)}}walkReactTree(e){e&&("function"==typeof e.type&&this.addComponent(e.type),e.child&&this.walkReactTree(e.child),e.sibling&&this.walkReactTree(e.sibling))}};const O=p.React,R=(p.ReactDOM,u.getByProps("sidebar","hasNotice").sidebar.split(" ")[0]),I=u.getByProps("membersWrap").membersWrap.split(" ")[0];class _{static get shouldShowToasts(){return A.get("settings","general","showToasts")}static async success(e,t={}){return this.show(e,Object.assign(t,{type:"success"}))}static async info(e,t={}){return this.show(e,Object.assign(t,{type:"info"}))}static async warning(e,t={}){return this.show(e,Object.assign(t,{type:"warning"}))}static async error(e,t={}){return this.show(e,Object.assign(t,{type:"error"}))}static async default(e,t={}){return this.show(e,Object.assign(t,{type:""}))}static show(e,t={}){const{type:s="",icon:n=!0,timeout:i=3e3,forceShow:o=!1}=t;if(!this.shouldShowToasts&&!o)return;this.ensureContainer();const r=document.createElement("div");r.classList.add("bd-toast"),s&&r.classList.add("toast-"+s),s&&n&&r.classList.add("icon"),r.innerText=e,document.querySelector(".bd-toasts").appendChild(r),setTimeout(()=>{r.classList.add("closing"),setTimeout(()=>{r.remove(),document.querySelectorAll(".bd-toasts .bd-toast").length||document.querySelector(".bd-toasts").remove()},300)},i)}static ensureContainer(){if(document.querySelector(".bd-toasts"))return;const e=document.querySelector(`.${R} + div`),t=e.querySelector(`.${I}`),s=e?e.querySelector("form"):null,n=e?e.getBoundingClientRect().left:310,i=t?t.getBoundingClientRect().left:0,o=i?i-e.getBoundingClientRect().left:e.offsetWidth,r=s?s.offsetHeight:80,a=document.createElement("div");a.classList.add("bd-toasts"),a.style.setProperty("left",n+"px"),a.style.setProperty("width",o+"px"),a.style.setProperty("bottom",r+"px"),document.querySelector("#app-mount").appendChild(a)}}class q extends O.Component{constructor(e){super(e),this.onClick=this.onClick.bind(this),this.state={checked:this.props.checked||!1}}render(){return O.createElement("div",{className:"checkbox-item"},O.createElement("div",{className:"checkbox-label label-JWQiNe da-label"},this.props.text),O.createElement("div",{className:"checkbox-wrapper checkbox-3kaeSU da-checkbox checkbox-3EVISJ da-checkbox",onClick:this.onClick},O.createElement("div",{className:"checkbox-inner checkboxInner-3yjcPe da-checkboxInner"},O.createElement("input",{className:"checkbox checkboxElement-1qV33p da-checkboxElement",checked:this.state.checked,type:"checkbox"}),O.createElement("span",null)),O.createElement("span",null)))}onClick(){this.props.onChange(!this.state.checked),this.setState({checked:!this.state.checked})}}function H(){return(H=Object.assign||function(e){for(var t=1;t{for(const s of e){if(!(s.addedNodes.length&&s.addedNodes[0]instanceof Element))continue;const e=s.addedNodes[0];e.parentElement===document.body&&e.querySelector("#ace_settingsmenu")&&(e.id="ace_settingsmenu_container",t.disconnect())}});t.observe(document.body,{childList:!0})};const t=this.props.theme==V.defaultProps.theme?this.props.theme.split("-")[1]:this.props.theme;this.editor.setTheme(`ace/theme/${t}`),this.editor.session.setMode(`ace/mode/${this.props.language}`),this.editor.setShowPrintMargin(!1),this.editor.setFontSize(this.props.fontSize),this.editor.on("change",this.onChange)}componentWillUnmount(){this.editor.destroy()}get value(){return this.editor.session.getValue()}set value(e){this.editor.setValue(e)}onChange(){this.props.onChange&&this.props.onChange(this.value)}showSettings(){return this.editor.keyBinding.$defaultHandler.commands.showSettingsMenu.exec(this.editor)}resize(){return this.editor.resize()}buildControl(e){return"checkbox"==e.type?this.makeCheckbox(e):this.makeButton(e)}makeCheckbox(e){return O.createElement(q,{text:e.label,onChange:e.onChange,checked:e.checked})}makeButton(e){return O.createElement(U,{color:"black",position:"top",text:e.tooltip},t=>O.createElement("button",H({},t,{className:"btn btn-primary",onClick:t=>{e.onClick(t,this.value)}}),e.label))}render(){this.editor&&this.editor.resize&&this.editor.resize();const e=this.props.controls.filter(e=>"right"!=e.side).map(this.buildControl.bind(this)),t=this.props.controls.filter(e=>"right"==e.side).map(this.buildControl.bind(this));return O.createElement("div",{id:"bd-editor-panel",className:this.props.theme},O.createElement("div",{id:"bd-editor-controls"},O.createElement("div",{className:"controls-section controls-left"},e),O.createElement("div",{className:"controls-section controls-right"},t)),O.createElement("div",{className:"editor-wrapper"},O.createElement("div",{id:this.props.id,className:"editor "+this.props.theme},this.props.value)))}}class J extends O.Component{render(){const e=this.props.size||"24px";return O.createElement("svg",{viewBox:"0 0 24 24",style:{width:e,height:e}},O.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),O.createElement("path",{d:"M17 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V7l-4-4zm2 16H5V5h11.17L19 7.83V19zm-7-7c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3zM6 6h9v4H6z"}))}}class Z extends O.Component{render(){const e=this.props.size||"24px";return O.createElement("svg",{viewBox:"0 0 24 24",fill:"#FFFFFF",style:{width:e,height:e},onClick:this.props.onClick},O.createElement("path",{d:"M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34c-.39-.39-1.02-.39-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z"}),O.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}))}}class Y extends O.Component{render(){const e=this.props.size||"20px";return O.createElement("svg",{viewBox:"0 0 20 20",style:{width:e,height:e}},O.createElement("path",{fill:"none",d:"M0 0h20v20H0V0z"}),O.createElement("path",{d:"M15.95 10.78c.03-.25.05-.51.05-.78s-.02-.53-.06-.78l1.69-1.32c.15-.12.19-.34.1-.51l-1.6-2.77c-.1-.18-.31-.24-.49-.18l-1.99.8c-.42-.32-.86-.58-1.35-.78L12 2.34c-.03-.2-.2-.34-.4-.34H8.4c-.2 0-.36.14-.39.34l-.3 2.12c-.49.2-.94.47-1.35.78l-1.99-.8c-.18-.07-.39 0-.49.18l-1.6 2.77c-.1.18-.06.39.1.51l1.69 1.32c-.04.25-.07.52-.07.78s.02.53.06.78L2.37 12.1c-.15.12-.19.34-.1.51l1.6 2.77c.1.18.31.24.49.18l1.99-.8c.42.32.86.58 1.35.78l.3 2.12c.04.2.2.34.4.34h3.2c.2 0 .37-.14.39-.34l.3-2.12c.49-.2.94-.47 1.35-.78l1.99.8c.18.07.39 0 .49-.18l1.6-2.77c.1-.18.06-.39-.1-.51l-1.67-1.32zM10 13c-1.65 0-3-1.35-3-3s1.35-3 3-3 3 1.35 3 3-1.35 3-3 3z"}))}}class K extends O.Component{constructor(e){super(e),this.hasUnsavedChanges=!1,this.onChange=this.onChange.bind(this),this.save=this.save.bind(this),this.openNative=this.openNative.bind(this),this.update=this.update.bind(this),this.controls=[{label:O.createElement(J,{size:"18px"}),tooltip:M.CustomCSS.save,onClick:this.save},{label:O.createElement(Z,{size:"18px"}),tooltip:M.CustomCSS.openNative,onClick:this.openNative},{label:O.createElement(Y,{size:"18px"}),tooltip:M.CustomCSS.settings,onClick:"showSettings"}]}update(){this.forceUpdate()}updateEditor(e){this.editor&&(this.editor.value=e)}get value(){return this.editor.session.getValue()}set value(e){this.editor.setValue(e)}showSettings(){return this.editor.keyBinding.$defaultHandler.commands.showSettingsMenu.exec(this.editor)}resize(){return this.editor.resize()}setEditorRef(e){this.editor=e,this.props.editorRef&&void 0!==this.props.editorRef.current?this.props.editorRef.current=e:this.props.editorRef&&(this.props.editorRef=e)}render(){return O.createElement(V,{ref:this.setEditorRef.bind(this),language:this.props.language,id:this.props.id||"bd-addon-editor",controls:this.controls,value:this.props.content,onChange:this.onChange})}onChange(){this.hasUnsavedChanges=!0}save(e,t){this.hasUnsavedChanges=!1,this.props.save&&this.props.save(t)}openNative(){this.props.openNative&&this.props.openNative()}}class X{static get width(){return Math.max(document.documentElement.clientWidth,window.innerWidth||0)}static get height(){return Math.max(document.documentElement.clientHeight,window.innerHeight||0)}}class Q extends O.Component{render(){return O.createElement("svg",{viewBox:"0 0 12 12",style:{width:"18px",height:"18px"}},O.createElement("g",{className:"background",fill:"none",fillRule:"evenodd"},O.createElement("path",{d:"M0 0h12v12H0"}),O.createElement("path",{className:"fill",fill:"#dcddde",d:"M9.5 3.205L8.795 2.5 6 5.295 3.205 2.5l-.705.705L5.295 6 2.5 8.795l.705.705L6 6.705 8.795 9.5l.705-.705L6.705 6"})))}}class ee extends O.Component{render(){const e=this.props.size||"24px";return O.createElement("svg",{className:this.props.className||"",fill:"#FFFFFF",viewBox:"0 0 24 24",style:{width:e,height:e},onClick:this.props.onClick},O.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),O.createElement("path",{d:"M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z"}))}}class te{static get shouldShowAddonErrors(){return A.get("settings","addons","addonErrors")}static get ModalStack(){return u.getByProps("push","update","pop","popWithKey")}static get AlertModal(){return u.getByPrototypes("handleCancel","handleSubmit","handleMinorConfirm")}static get TextElement(){return u.getByProps("Sizes","Weights")}static get ConfirmationModal(){return u.getModule(e=>e.defaultProps&&e.key&&"confirm-modal"==e.key())}static default(e,t){const s=u.getByProps("backdrop")||{backdrop:"backdrop-1wrmKb"},n=u.getModule(e=>e.modal&&e.inner&&!e.sizeMedium)||{modal:"modal-36zFtW",inner:"inner-2VEzy9"},i=u.getByProps("sizeMedium")||{modal:"backdrop-1wrmKb",sizeMedium:"sizeMedium-ctncE5",content:"content-2KoCOZ",header:"header-2nhbou",footer:"footer-30ewN8",close:"close-hhyjWJ",inner:"inner-2Z5QZX"},o=c.parseHTML(`
\n
\n
\n
\n
\n
${e}
\n
\n
\n
\n
\n ${t}\n
\n
\n
\n \n
\n
\n
`);o.querySelector(".footer button").addEventListener("click",()=>{o.addClass("closing"),setTimeout(()=>{o.remove()},300)}),o.querySelector(".bd-backdrop").addEventListener("click",()=>{o.addClass("closing"),setTimeout(()=>{o.remove()},300)}),document.querySelector("#app-mount").append(o)}static alert(e,t){if(this.ModalStack&&this.AlertModal)return this.default(e,t);this.ModalStack.push(function(s){return O.createElement(this.AlertModal,Object.assign({title:e,body:t},s))})}static showConfirmationModal(e,t,s={}){const n=this.TextElement,i=this.ConfirmationModal,o=this.ModalStack;if(!this.ModalStack||!this.ConfirmationModal||!this.TextElement)return this.alert(e,t);const{onConfirm:r,onCancel:a,confirmText:l,cancelText:d,danger:c=!1}=s;"string"==typeof t?t=n.default({color:n.Colors.PRIMARY,children:[t]}):Array.isArray(t)&&(t=n.default({color:n.Colors.PRIMARY,children:t})),t=[t];const h=()=>{};o.push(function(s){return O.createElement(i,Object.assign({header:e,children:t,red:c,confirmText:l||M.Modals.okay,cancelText:d||M.Modals.cancel,onConfirm:r||h,onCancel:a||h},s))})}static showAddonErrors({plugins:e=[],themes:t=[]}){if(!e||!t||!this.shouldShowAddonErrors)return;if(!e.length&&!t.length)return;const s=u.getByProps("backdrop")||{backdrop:"backdrop-1wrmKb"},n=u.getModule(e=>e.modal&&e.inner&&!e.sizeMedium)||{modal:"modal-36zFtW",inner:"inner-2VEzy9"},i=u.getByProps("sizeMedium")||{modal:"modal-3v8ziU",sizeMedium:"sizeMedium-ctncE5",content:"content-2KoCOZ",header:"header-2nhbou",footer:"footer-30ewN8",close:"close-hhyjWJ",inner:"inner-2Z5QZX"},o=$(`
\n
\n
\n
\n
${M.Modals.addonErrors}
\n
\n
\n
\n
${M.Panels.plugins}
\n
${M.Panels.themes}
\n
\n
\n
\n
${M.Modals.name}
\n
${M.Modals.message}
\n
${M.Modals.error}
\n
\n
\n
\n\n
\n
\n
\n \n
\n
\n
`),r=function(e){const t=$('
');for(const s of e){const e=$(`
\n
${s.name?s.name:s.file}
\n
${s.message}
\n \n
`);t.append(e),s.error&&e.find("a").on("click",e=>{e.preventDefault(),d.stacktrace("AddonError",`Error details for ${s.name?s.name:s.file}.`,s.error)})}return t},a=[r(e),r(t)];o.find(".tab-bar-item").on("click",e=>{e.preventDefault(),o.find(".tab-bar-item").removeClass("selected"),$(e.target).addClass("selected"),o.find(".scroller").empty().append(a[$(e.target).index()])}),o.find(".footer button").on("click",()=>{o.addClass("closing"),setTimeout(()=>{o.remove()},300)}),o.find(".bd-backdrop").on("click",()=>{o.addClass("closing"),setTimeout(()=>{o.remove()},300)}),o.appendTo("#app-mount"),e.length?o.find(".tab-bar-item")[0].click():o.find(".tab-bar-item")[1].click()}}class se extends O.Component{constructor(e){super(e),this.state={modalOpen:!1},this.offX=0,this.offY=0,this.titlebar=O.createRef(),this.window=O.createRef(),this.close=this.close.bind(this),this.maximize=this.maximize.bind(this),this.onDrag=this.onDrag.bind(this),this.onDragStart=this.onDragStart.bind(this),this.onDragStop=this.onDragStop.bind(this),this.onResizeStart=this.onResizeStart.bind(this)}componentDidMount(){this.window.current.addEventListener("mousedown",this.onResizeStart,!1),this.titlebar.current.addEventListener("mousedown",this.onDragStart,!1),document.addEventListener("mouseup",this.onDragStop,!1)}onResizeStart(){this.currentWidth=this.window.current.style.width,this.currentHeight=this.window.current.style.height}onDragStop(){if(document.removeEventListener("mousemove",this.onDrag,!0),this.props.onResize){const e=this.window.current.style.width,t=this.window.current.style.height;e==this.currentWidth&&t==this.currentHeight||this.props.onResize(),this.currentWidth=e,this.currentHeight=t}}onDragStart(e){const t=this.window.current;this.offY=e.clientY-parseInt(t.offsetTop),this.offX=e.clientX-parseInt(t.offsetLeft),document.addEventListener("mousemove",this.onDrag,!0)}onDrag(e){const t=this.window.current;t.style.top=e.clientY-this.offY+"px",t.style.left=e.clientX-this.offX+"px"}componentWillUnmount(){this.titlebar.current.removeEventListener("mousedown",this.onDragStart,!1),document.removeEventListener("mouseup",this.onDragStop,!1)}render(){const e=this.props.center?X.height/2-this.props.height/2:this.props.top,t=this.props.center?X.width/2-this.props.width/2:this.props.left,s=`floating-window${` ${this.props.className}`||""}${this.props.resizable?" resizable":""}${this.state.modalOpen?" modal-open":""}`,n={height:this.props.height,width:this.props.width,left:t||0,top:e||0};return O.createElement("div",{id:this.props.id,className:s,ref:this.window,style:n},O.createElement("div",{className:"floating-window-titlebar",ref:this.titlebar},O.createElement("span",{className:"title"},this.props.title),O.createElement("div",{className:"floating-window-buttons"},O.createElement("div",{className:"button maximize-button",onClick:this.maximize},O.createElement(ee,{size:"18px"})),O.createElement("div",{className:"button close-button",onClick:this.close},O.createElement(Q,null)))),O.createElement("div",{className:"floating-window-content"},this.props.children))}async close(){let e=!0;("function"==typeof this.props.confirmClose?this.props.confirmClose():this.props.confirmClose)&&(this.setState({modalOpen:!0}),e=await this.confirmClose(),this.setState({modalOpen:!1})),this.props.close&&e&&this.props.close()}maximize(){this.window.current.style.width="100%",this.window.current.style.height="100%",this.window.current.style.top="20px",this.window.current.style.left="0px",this.props.onResize&&this.props.onResize()}confirmClose(){return new Promise(e=>{te.showConfirmationModal(M.Modals.confirmAction,this.props.confirmationText,{danger:!0,confirmText:M.Modals.close,onConfirm:()=>{e(!0)},onCancel:()=>{e(!1)}})})}}function ne(){return(ne=Object.assign||function(e){for(var t=1;tO.createElement(se,ne({},e,{close:this.close.bind(this,e.id)}),e.children))}open(e){this.setState({windows:[...this.state.windows,e]})}close(e){this.setState({windows:this.state.windows.filter(t=>(t.id==e&&t.onClose&&t.onClose(),t.id!=e))})}static get id(){return"floating-windows"}static get root(){if(this._root)return this._root;const e=document.createElement("div");return e.id=this.id,document.body.append(e),this._root=e}},{ref:ie}),re=c.findInReactTree(c.getReactInstance(document.querySelector(".app-19_DXt")),e=>e&&e.type&&e.type.displayName&&"App"==e.type.displayName);F.after("FloatingContainer",re.type.prototype,"render",(e,t,s)=>{c.findInRenderTree(s,e=>e&&e[6]&&e[6].type&&"LayerContainer"==e[6].type.displayName,{walkable:["children","props"]}).push(oe)}),re.stateNode.forceUpdate();var ae=ie.current;const le=p.React,de=s(2),ce=s(1),he=s(4).Module;he.globalPaths.push(de.resolve(s(0).remote.app.getAppPath(),"node_modules"));const ue=/[^\S\r\n]*?\r?\n[^\S\r\n]*?\*[^\S\r\n]?/,pe=/^\\@/,me=function(e){return 65279===e.charCodeAt(0)&&(e=e.slice(1)),e};class ge{get name(){return""}get moduleExtension(){return""}get extension(){return""}get addonFolder(){return""}get language(){return""}get prefix(){return"addon"}get collection(){return"settings"}get category(){return"addons"}get id(){return"autoReload"}emit(e,...t){return g.emit(`${this.prefix}-${e}`,...t)}constructor(){this.timeCache={},this.addonList=[],this.state={}}initialize(){return this.originalRequire=he._extensions[this.moduleExtension],he._extensions[this.moduleExtension]=this.getAddonRequire(),A.on(this.collection,this.category,this.id,e=>{e?this.watchAddons():this.unwatchAddons()}),this.loadAllAddons()}initializeAddon(){}getFileModification(e,t){return t}startAddon(){}stopAddon(){}loadState(){const e=v.getData(`${this.prefix}s`);e&&Object.assign(this.state,e)}saveState(){v.setData(`${this.prefix}s`,this.state)}watchAddons(){if(this.watcher)return d.error(this.name,`Already watching ${this.prefix} addons.`);d.log(this.name,`Starting to watch ${this.prefix} addons.`),this.watcher=ce.watch(this.addonFolder,{persistent:!1},async(e,t)=>{if(!e||!t||!t.endsWith(this.extension))return;await new Promise(e=>setTimeout(e,50));try{ce.statSync(de.resolve(this.addonFolder,t))}catch(e){if("ENOENT"!==e.code)return;delete this.timeCache[t],this.unloadAddon(t,!0)}if(!ce.statSync(de.resolve(this.addonFolder,t)).isFile())return;const s=ce.statSync(de.resolve(this.addonFolder,t));s&&s.mtime&&s.mtime.getTime()&&"number"==typeof s.mtime.getTime()&&this.timeCache[t]!=s.mtime.getTime()&&(this.timeCache[t]=s.mtime.getTime(),"rename"==e&&this.loadAddon(t,!0),"change"==e&&this.reloadAddon(t,!0))})}unwatchAddons(){if(!this.watcher)return d.error(this.name,`Was not watching ${this.prefix} addons.`);this.watcher.close(),delete this.watcher,d.log(this.name,`No longer watching ${this.prefix} addons.`)}extractMeta(e){const t=e.split("\n")[0];if(t.includes("//META"))return this.parseOldMeta(e);if(t.includes("/**"))return this.parseNewMeta(e);throw new N("META was not found.")}parseOldMeta(e){const t=e.split("\n")[0],s=t.substring(t.lastIndexOf("//META")+6,t.lastIndexOf("*//")),n=c.testJSON(s);if(!n)throw new N("META could not be parsed.");if(!n.name)throw new N("META missing name data.");return n}parseNewMeta(e){const t=e.split("/**",2)[1].split("*/",1)[0],s={};let n="",i="";for(const e of t.split(ue))if(0!==e.length)if("@"===e.charAt(0)&&" "!==e.charAt(1)){s[n]=i;const t=e.indexOf(" ");n=e.substr(1,t-1),i=e.substr(t+1)}else i+=" "+e.replace("\\n","\n").replace(pe,"@");return s[n]=i.trim(),delete s[""],s}getAddonRequire(){const e=this,t=this.originalRequire;return function(s,n){const i=de.resolve(e.addonFolder,de.basename(n));if(!ce.existsSync(i)||n!==ce.realpathSync(i))return Reflect.apply(t,this,arguments);let o=ce.readFileSync(n,"utf8");o=me(o);const r=ce.statSync(n),a=e.extractMeta(o);a.id=a.name,a.filename=de.basename(n),a.added=r.atimeMs,a.modified=r.mtimeMs,a.size=r.size,o=e.getFileModification(s,o,a),s._compile(o,n)}}loadAddon(e,t=!1){if(void 0===e)return;try{require(de.resolve(this.addonFolder,e))}catch(n){return new D(e,e,"Could not be compiled.",{message:n.message,stack:n.stack})}const s=require(de.resolve(this.addonFolder,e));if(this.addonList.find(e=>e.id==s.id))return new D(s.name,e,`There is already a plugin with name ${s.name}`);const n=this.initializeAddon(s);return n||(this.addonList.push(s),t&&_.success(`${s.name} v${s.version} was loaded.`),this.emit("loaded",s.id),this.state[s.id]?this.startAddon(s):this.state[s.id]=!1)}unloadAddon(e,t=!0,s=!1){const n="string"==typeof e?this.addonList.find(t=>t.id==e||t.filename==e):e;return!!n&&(this.state[n.id]&&(s?this.stopAddon(n):this.disableAddon(n)),delete require.cache[require.resolve(de.resolve(this.addonFolder,n.filename))],this.addonList.splice(this.addonList.indexOf(n),1),this.emit("unloaded",n.id),t&&_.success(`${n.name} was unloaded.`),!0)}reloadAddon(e,t=!0){const s="string"==typeof e?this.addonList.find(t=>t.id==e||t.filename==e):e,n=this.unloadAddon(s,t,!0);return n?this.loadAddon(s.filename,t):n}isLoaded(e){return!!this.addonList.find(t=>t.id==e||t.filename==e)}isEnabled(e){const t=this.addonList.find(t=>t.id==e||t.filename==e);return!!t&&this.state[t.id]}enableAddon(e){const t="string"==typeof e?this.addonList.find(t=>t.id==e):e;t&&(this.state[t.id]||(this.state[t.id]=!0,this.startAddon(t),this.saveState()))}disableAddon(e){const t="string"==typeof e?this.addonList.find(t=>t.id==e):e;t&&this.state[t.id]&&(this.state[t.id]=!1,this.stopAddon(t),this.saveState())}toggleAddon(e){this.state[e]?this.disableAddon(e):this.enableAddon(e)}loadNewAddons(){const e=ce.readdirSync(this.addonFolder),t=this.addonList.filter(t=>!e.includes(t.filename)).map(e=>e.id);return{added:e.filter(e=>!this.addonList.find(t=>t.filename==e)&&e.endsWith(this.extension)&&ce.statSync(de.resolve(this.addonFolder,e)).isFile()),removed:t}}updateList(){const e=this.loadNewAddons();for(const t of e.added)this.loadAddon(t);for(const t of e.removed)this.unloadAddon(t)}loadAllAddons(){this.loadState();const e=[],t=ce.readdirSync(this.addonFolder);for(const s of t){if(!ce.statSync(de.resolve(this.addonFolder,s)).isFile()||!s.endsWith(this.extension))continue;const t=this.loadAddon(s,!1);t instanceof D&&e.push(t)}return this.saveState(),A.get(this.collection,this.category,this.id)&&this.watchAddons(),e}deleteAddon(e){const t="string"==typeof e?this.addonList.find(t=>t.id==e||t.filename==e):e;return ce.unlinkSync(de.resolve(this.addonFolder,t.filename))}saveAddon(e,t){const s="string"==typeof e?this.addonList.find(t=>t.id==e||t.filename==e):e;return ce.writeFileSync(de.resolve(this.addonFolder,s.filename),t)}editAddon(e,t){const n="string"==typeof e?this.addonList.find(t=>t.id==e||t.filename==e):e,i=de.resolve(this.addonFolder,n.filename);return void 0===t&&(t="system"==A.get("settings","addons","editAction")),t?s(0).shell.openItem(`${i}`):this.openDetached(n)}openDetached(e){const t=de.resolve(this.addonFolder,e.filename),s=ce.readFileSync(t).toString(),n=le.createRef(),i=le.createElement(K,{id:"bd-floating-editor-"+e.name,ref:n,content:s,save:this.saveAddon.bind(this,e),openNative:this.editAddon.bind(this,e,!0),language:this.language});ae.open({onClose:()=>{this.isDetached=!1},onResize:()=>{n&&n.current&&n.current.resize&&n.current.resize()},title:e.name,id:s.id,className:"floating-addon-window",height:470,width:410,center:!0,resizable:!0,children:i,confirmClose:()=>!(!n||!n.current)&&n.current.hasUnsavedChanges,confirmationText:M.Addons.confirmationText.format({name:e.name})})}}const fe="bd-settings-title h2-2gWE-o title-3sZWYQ size16-14cGz5 height20-mO2eIN weightSemiBold-NJexzi defaultColor-1_ajX0 defaultMarginh2-2LTaUL marginBottom20-32qID7",be="bd-settings-title bd-settings-group-title h5-18_1nd title-3sZWYQ size12-3R0845 height16-2Lv3qA weightSemiBold-NJexzi da-h5 da-title da-size12 da-height16 da-weightSemiBold marginBottom4-2qk4Hy da-marginBottom4 marginTop8-1DLZ1n da-marginTop8";class ye extends O.Component{constructor(e){super(e)}render(){const e=this.props.isGroup?be:fe,t=this.props.className?`${e} ${this.props.className}`:e;return O.createElement("h2",{className:t,onClick:()=>{this.props.onClick&&this.props.onClick()}},this.props.text,this.props.button&&O.createElement("button",{className:"bd-button bd-button-title",onClick:this.props.button.onClick},this.props.button.title),this.props.otherChildren)}}class ve extends O.Component{render(){const e=this.props.size||"24px";return O.createElement("svg",{className:this.props.className||"",onClick:this.props.onClick,fill:"#dcddde",viewBox:"0 0 24 24",style:{width:e,height:e}},O.createElement("path",{d:"M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4l-2.35 2.35z"}),O.createElement("path",{fill:"none",d:"M0 0h24v24H0z"}))}}class we extends O.Component{render(){const e=this.props.size||"24px";return O.createElement("svg",{className:this.props.className||"",fill:"#FFFFFF",viewBox:"0 0 24 24",style:{width:e,height:e},onClick:this.props.onClick},O.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),O.createElement("path",{d:"M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zm2.46-7.12l1.41-1.41L12 12.59l2.12-2.12 1.41 1.41L13.41 14l2.12 2.12-1.41 1.41L12 15.41l-2.12 2.12-1.41-1.41L10.59 14l-2.13-2.12zM15.5 4l-1-1h-5l-1 1H5v2h14V4z"}),O.createElement("path",{fill:"none",d:"M0 0h24v24H0z"}))}}class Ce extends O.Component{constructor(e){super(e),this.state={checked:this.props.checked},this.onChange=this.onChange.bind(this)}onChange(){this.props.disabled||(this.props.onChange(!this.state.checked),this.setState({checked:!this.state.checked}))}render(){const e=this.props.disabled?" bd-switch-disabled":"",t=this.state.checked?" bd-switch-checked":"";return O.createElement("div",{className:"bd-switch"+e+t},O.createElement("input",{type:"checkbox",id:this.props.id,className:"bd-checkbox",disabled:this.props.disabled,checked:this.state.checked,onChange:this.onChange}))}}function Se(){return(Se=Object.assign||function(e){for(var t=1;t{const s=e.scrollTop,n=s+e.clientHeight,i=t.offsetTop,o=i+t.clientHeight;return in})(t[0],e[0])&&t.animate({scrollTop:e.offset().top-t.offset().top+t.scrollTop()-30},300)}getString(e){return"string"==typeof e?e:e.toString()}onChange(){this.props.onChange&&this.props.onChange(this.props.addon.id),this.props.enabled=!this.props.enabled}showSettings(){this.props.hasSettings&&this.setState({settingsOpen:!0})}closeSettings(){this.panelRef.current.innerHTML="",this.setState({settingsOpen:!1})}buildTitle(e,t,s){const n=M.Addons.title.split(/({{[A-Za-z]+}})/),i=n.findIndex(e=>"{{name}}"==e);i&&(n[i]=O.createElement("span",{className:"bd-name"},e));const o=n.findIndex(e=>"{{version}}"==e);i&&(n[o]=O.createElement("span",{className:"bd-version"},t));const r=n.findIndex(e=>"{{author}}"==e);return i&&(n[r]=O.createElement("span",{className:"bd-author"},s)),n.flat()}get settingsComponent(){const e=this.props.addon,t=this.getString(e.name);try{this.settingsPanel=this.props.getSettingsPanel()}catch(e){d.stacktrace("Addon Settings","Unable to get settings panel for "+t+".",e)}const s={id:`${t}-settings`,className:"addon-settings",ref:this.panelRef};return"string"==typeof settingsPanel&&(s.dangerouslySetInnerHTML=this.settingsPanel),O.createElement("div",{className:"bd-addon-card settings-open bd-switch-item"},O.createElement("div",{className:"bd-close",onClick:this.closeSettings},O.createElement(Q,null)),O.createElement("div",s,this.settingsPanel instanceof O.Component?this.settingsPanel:null))}buildLink(e){const t=this.props.addon[e];return t?O.createElement("a",{className:"bd-link bd-link-website",href:t,target:"_blank",rel:"noopener noreferrer"},M.Addons[e]):null}get footer(){const e=["website","source"];if(!e.some(e=>this.props.addon[e])&&!this.props.hasSettings)return null;const t=e.map(this.buildLink.bind(this)).filter(e=>e);return O.createElement("div",{className:"bd-footer"},O.createElement("span",{className:"bd-links"},t.map((e,s)=>sO.createElement("div",Se({},e,{className:"bd-addon-button",onClick:s}),t))}render(){if(this.state.settingsOpen)return this.settingsComponent;const e=this.props.addon,t=this.getString(e.name),s=this.getString(e.author),n=this.getString(e.description),i=this.getString(e.version);return O.createElement("div",{id:`${e.id}-card`,className:"bd-addon-card settings-closed"},O.createElement("div",{className:"bd-addon-header"},O.createElement("span",{className:"bd-title"},this.buildTitle(t,i,s)),O.createElement("div",{className:"bd-controls"},this.props.editAddon&&this.makeButton(M.Addons.editAddon,O.createElement(Z,null),this.props.editAddon),this.props.deleteAddon&&this.makeButton(M.Addons.deleteAddon,O.createElement(we,null),this.props.deleteAddon),this.props.showReloadIcon&&this.makeButton(M.Addons.reload,O.createElement(ve,{className:"bd-reload bd-reload-card"}),this.reload),O.createElement(Ce,{checked:this.props.enabled,onChange:this.onChange}))),O.createElement("div",{className:"bd-description-wrap scroller-wrap fade"},O.createElement("div",{className:"bd-description scroller"},n)),this.footer)}}class xe extends O.Component{render(){const e=this.props.size||"16px";return O.createElement("svg",{className:this.props.className||"",fill:"#FFFFFF",viewBox:"0 0 24 24",style:{width:e,height:e}},O.createElement("path",{d:"M8.12 9.29L12 13.17l3.88-3.88c.39-.39 1.02-.39 1.41 0 .39.39.39 1.02 0 1.41l-4.59 4.59c-.39.39-1.02.39-1.41 0L6.7 10.7c-.39-.39-.39-1.02 0-1.41.39-.38 1.03-.39 1.42 0z"}))}}class ke extends O.Component{constructor(e){super(e),this.state={open:!1,value:this.props.value||this.props.options[0].value},this.dropdown=O.createRef(),this.onChange=this.onChange.bind(this),this.showMenu=this.showMenu.bind(this),this.hideMenu=this.hideMenu.bind(this)}showMenu(e){e.preventDefault(),this.setState({open:!0},()=>{document.addEventListener("click",this.hideMenu)})}hideMenu(){this.setState({open:!1},()=>{document.removeEventListener("click",this.hideMenu)})}onChange(e){this.setState({value:e}),this.props.onChange&&this.props.onChange(e)}get selected(){return this.props.options.find(e=>e.value==this.state.value)}get options(){const e=this.selected;return O.createElement("div",{className:"bd-select-options"},this.props.options.map(t=>O.createElement("div",{className:`bd-select-option${e.value==t.value?" selected":""}`,onClick:this.onChange.bind(this,t.value)},t.label)))}render(){const e="transparent"==this.props.style?" bd-select-transparent":"",t=this.state.open?" menu-open":"";return O.createElement("div",{className:`bd-select${e}${t}`,onClick:this.showMenu,ref:this.dropdown},O.createElement("div",{className:"bd-select-value"},this.selected.label),O.createElement(xe,{className:"bd-select-arrow"}),this.state.open&&this.options)}}class Me extends O.Component{render(){const e=this.props.size||"16px";return O.createElement("svg",{className:this.props.className||"",fill:"#FFFFFF",viewBox:"0 0 24 24",style:{width:e,height:e}},O.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),O.createElement("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"}))}}class Ae extends O.Component{render(){return O.createElement("div",{className:"bd-search-wrapper"},O.createElement("input",{onChange:this.props.onChange,onKeyDown:this.props.onKeyDown,type:"text",className:"bd-search",placeholder:this.props.placeholder,maxLength:"50"}),O.createElement(Me,null))}}class De extends O.Component{constructor(e){super(e),this.state={sort:"name",ascending:!0,query:""},this.sort=this.sort.bind(this),this.reverse=this.reverse.bind(this),this.search=this.search.bind(this),this.update=this.update.bind(this)}componentDidMount(){g.on(`${this.props.prefix}-loaded`,this.update),g.on(`${this.props.prefix}-unloaded`,this.update)}componentWillUnmount(){g.off(`${this.props.prefix}-loaded`,this.update),g.off(`${this.props.prefix}-unloaded`,this.update)}update(){this.forceUpdate()}reload(){this.props.refreshList&&this.props.refreshList(),this.forceUpdate()}reverse(e){this.setState({ascending:e})}sort(e){this.setState({sort:e})}search(e){this.setState({query:e.target.value.toLocaleLowerCase()})}get sortOptions(){return[{label:M.Addons.name,value:"name"},{label:M.Addons.author,value:"author"},{label:M.Addons.version,value:"version"},{label:M.Addons.added,value:"added"},{label:M.Addons.modified,value:"modified"}]}get directions(){return[{label:M.Sorting.ascending,value:!0},{label:M.Sorting.descending,value:!1}]}render(){const{title:e,folder:t,addonList:n,addonState:i,onChange:o,reload:r}=this.props,a=!A.get("settings","addons","autoReload"),l=t?{title:M.Addons.openFolder.format({type:e}),onClick:()=>{s(0).shell.openItem(t)}}:null,d=n.sort((e,t)=>{const s=e[this.state.sort],n=t[this.state.sort];return"string"==typeof s?s.toLocaleLowerCase().localeCompare(n.toLocaleLowerCase()):s>n?1:n>s?-1:0});return this.state.ascending||d.reverse(),[O.createElement(ye,{key:"title",text:e,button:l,otherChildren:a&&O.createElement(ve,{className:"bd-reload",onClick:this.reload.bind(this)})}),O.createElement("div",{className:"bd-controls bd-addon-controls"},O.createElement(Ae,{onChange:this.search,placeholder:`${M.Addons.search.format({type:this.props.title})}...`}),O.createElement("div",{className:"bd-addon-dropdowns"},O.createElement("div",{className:"bd-select-wrapper"},O.createElement("label",{className:"bd-label"},M.Sorting.sortBy,":"),O.createElement(ke,{options:this.sortOptions,onChange:this.sort,style:"transparent"})),O.createElement("div",{className:"bd-select-wrapper"},O.createElement("label",{className:"bd-label"},M.Sorting.order,":"),O.createElement(ke,{options:this.directions,onChange:this.reverse,style:"transparent"})))),O.createElement("div",{key:"addonList",className:"bd-addon-list"},d.map(e=>{if(this.state.query){let t=e.name.toLocaleLowerCase().includes(this.state.query);if(!(t=(t=t||e.author.toLocaleLowerCase().includes(this.state.query))||e.description.toLocaleLowerCase().includes(this.state.query)))return null}const t=e.type&&"function"==typeof e.plugin.getSettingsPanel,s=t&&e.plugin.getSettingsPanel.bind(e.plugin);return O.createElement(Pe,{editAddon:this.editAddon.bind(this,e.id),deleteAddon:this.deleteAddon.bind(this,e.id),showReloadIcon:a,key:e.id,enabled:i[e.id],addon:e,onChange:o,reload:r,hasSettings:t,getSettingsPanel:s})}))]}editAddon(e){this.props.editAddon&&this.props.editAddon(e)}async deleteAddon(e){const t=this.props.addonList.find(t=>t.id==e);await this.confirmDelete(t)&&this.props.deleteAddon&&this.props.deleteAddon(t)}confirmDelete(e){return new Promise(t=>{te.showConfirmationModal(M.Modals.confirmAction,M.Addons.confirmDelete.format({name:e.name}),{danger:!0,confirmText:M.Addons.deleteAddon,onConfirm:()=>{t(!0)},onCancel:()=>{t(!1)}})})}}class Ne extends O.Component{render(){return O.createElement("div",{className:"bd-divider divider-3573oO marginTop8-1DLZ1n marginBottom40-2vIwTv"})}}class Fe extends O.Component{render(){return O.createElement("div",{className:"bd-setting-item"},O.createElement("div",{className:"bd-setting-header"},O.createElement("label",{htmlFor:this.props.id,className:"bd-setting-title"},this.props.name),this.props.children),O.createElement("div",{className:"bd-setting-note"},this.props.note),O.createElement("div",{className:"bd-setting-divider"}))}}const Te="bd-settings-group";class Be extends O.Component{constructor(e){if(super(e),this.props.button&&this.props.collapsible){const e=this.props.button.onClick;this.props.button.onClick=t=>{t.stopPropagation(),e(...arguments)}}this.props.hasOwnProperty("shown")||(this.props.shown=!0),this.container=O.createRef(),this.state={collapsed:this.props.collapsible&&!this.props.shown},this.onChange=this.onChange.bind(this),this.toggleCollapse=this.toggleCollapse.bind(this)}toggleCollapse(){const e=this.container.current,t=this.state.collapsed?300:1;e.style.setProperty("height",e.scrollHeight+"px"),e.classList.add("animating"),this.setState({collapsed:!this.state.collapsed},()=>setTimeout(()=>{e.style.setProperty("height",""),e.classList.remove("animating")},t))}onChange(e,t){this.props.onChange&&(this.props.id?this.props.onChange(this.props.id,e,t):this.props.onChange(e,t),this.forceUpdate())}render(){const{settings:e}=this.props,t=this.props.collapsible?`collapsible ${this.state.collapsed?"collapsed":"expanded"}`:"",s=`${Te} ${t}`;return O.createElement("div",{className:s},O.createElement(ye,{text:this.props.name,collapsible:this.props.collapsible,onClick:this.toggleCollapse,button:this.props.button,isGroup:!0}),O.createElement("div",{className:"bd-settings-container",ref:this.container},e.filter(e=>!e.hidden).map(e=>{let t=null;return"dropdown"==e.type&&(t=O.createElement(ke,{disabled:e.disabled,id:e.id,options:e.options,value:e.value,onChange:this.onChange.bind(this,e.id)})),"switch"==e.type&&(t=O.createElement(Ce,{disabled:e.disabled,id:e.id,checked:e.value,onChange:this.onChange.bind(this,e.id)})),t?O.createElement(Fe,{id:e.id,key:e.id,name:e.name,note:e.note},t):null})),this.props.showDivider&&O.createElement(Ne,null))}}class Le extends O.Component{buildTitle(e,t,s){const n=M.Addons.title.split(/({{[A-Za-z]+}})/),i=n.findIndex(e=>"{{name}}"==e);i&&(n[i]=e);const o=n.findIndex(e=>"{{version}}"==e);i&&(n[o]=t);const r=n.findIndex(e=>"{{author}}"==e);return i&&(n[r]=s),n.flat()}render(){return O.createElement("div",{id:"bbd-version"},this.buildTitle("BBD",i.bbdVersion,O.createElement("a",{href:"https://github.com/rauenzi",target:"_blank",rel:"noopener noreferrer"},"Zerebos")))}}var je=new class{constructor(){this.patchSections(),g.on("strings-updated",this.forceUpdate)}onChange(e){return(t,s,n)=>{const i=A.collections.length+A.panels.length;e(t,s,n),i!=A.collections.length+A.panels.length&&setTimeout(this.forceUpdate.bind(this),50)}}buildSettingsPanel(e,t,s,n,i=null){return t.forEach(e=>{e.settings.forEach(t=>t.value=s[e.id][t.id])}),this.getSettingsPanel(e,t,this.onChange(n),i)}getSettingsPanel(e,t,s,n=null){return[O.createElement(ye,{text:e,button:n}),t.map(e=>O.createElement(Be,Object.assign({},e,{onChange:s})))]}getAddonPanel(e,t,s,n={}){return O.createElement(De,Object.assign({},{title:e,addonList:t,addonState:s},n))}async patchSections(){F.after("SettingsManager",u.getByDisplayName("FluxContainer(GuildSettings)").prototype,"render",e=>{e._reactInternalFiber.return.return.return.return.return.return.memoizedProps.id="guild-settings"});const e=await z.get("UserSettings",e=>e.prototype&&e.prototype.generateSections);F.after("SettingsManager",e.prototype,"render",e=>{e._reactInternalFiber.return.return.return.return.return.return.return.memoizedProps.id="user-settings"}),F.after("SettingsManager",e.prototype,"generateSections",(e,t,s)=>{let n=s.findIndex(e=>"linux"==e.section.toLowerCase())+1;const i=e=>{s.splice(n,0,e),n++};i({section:"DIVIDER"}),i({section:"HEADER",label:"BandagedBD"});for(const e of A.collections)e.disabled||i({section:e.name,label:e.name,element:()=>this.buildSettingsPanel(e.name,e.settings,A.state[e.id],A.onSettingChange.bind(A,e.id),e.button?e.button:null)});for(const t of A.panels.sort((e,t)=>e.order>t.order))t.clickListener&&(t.onClick=n=>t.clickListener(e,n,s)),i(t);i({section:"CUSTOM",element:Le})}),this.forceUpdate()}forceUpdate(){const e=u.getByProps("standardSidebarView").standardSidebarView.split(" ")[0],t=document.querySelector(`.${e}`);if(!t)return;const s=c.findInReactTree(c.getReactInstance(t),e=>e&&e.generateSections,{walkable:["return","stateNode"]});s&&s.forceUpdate()}};const $e=s(2),ze=s(0).remote;var Oe=new class extends ge{get name(){return"PluginManager"}get moduleExtension(){return".js"}get extension(){return".plugin.js"}get addonFolder(){return $e.resolve(i.dataPath,"plugins")}get prefix(){return"plugin"}get language(){return"javascript"}constructor(){super(),this.onSwitch=this.onSwitch.bind(this),this.observer=new MutationObserver(e=>{for(let t=0,s=e.length;tje.getAddonPanel(M.Panels.plugins,this.addonList,this.state,{folder:this.addonFolder,onChange:this.togglePlugin.bind(this),reload:this.reloadPlugin.bind(this),refreshList:this.updatePluginList.bind(this),saveAddon:this.saveAddon.bind(this),editAddon:this.editAddon.bind(this),deleteAddon:this.deleteAddon.bind(this),prefix:this.prefix})}),e}updatePluginList(){return this.updateList()}loadAllPlugins(){return this.loadAllAddons()}enablePlugin(e){return this.enableAddon(e)}disablePlugin(e){return this.disableAddon(e)}togglePlugin(e){return this.toggleAddon(e)}unloadPlugin(e){return this.unloadAddon(e)}loadPlugin(e){const t=this.loadAddon(e);t&&te.showAddonErrors({themes:[t]})}reloadPlugin(e){const t=this.reloadAddon(e);return t&&te.showAddonErrors({plugins:[t]}),"string"==typeof e?this.addonList.find(t=>t.id==e||t.filename==e):e}initializeAddon(e){if(!e.type)return new D(e.name,e.filename,"Plugin had no exports",{message:"Plugin had no exports or no name property.",stack:""});try{const t=new e.type;e.plugin=t,e.name=t.getName()||e.name,e.author=t.getAuthor()||e.author||"No author",e.description=t.getDescription()||e.description||"No description",e.version=t.getVersion()||e.version||"No version";try{"function"==typeof e.plugin.load&&e.plugin.load()}catch(t){return this.state[e.id]=!1,new D(e.name,e.filename,"load() could not be fired.",{message:t.message,stack:t.stack})}}catch(t){return new D(e.name,e.filename,"Could not be constructed.",{message:t.message,stack:t.stack})}}getFileModification(e,t,s){return e._compile(t,e.filename),c.isEmpty(e.exports)?t+=`\nmodule.exports = ${JSON.stringify(s)};\nmodule.exports.type = ${s.exports||s.name};`:(s.type=e.exports,e.exports=s,"")}startAddon(e){return this.startPlugin(e)}stopAddon(e){return this.stopPlugin(e)}startPlugin(e){const t="string"==typeof e?this.addonList.find(t=>t.id==e):e;if(!t)return;const s=t.plugin;try{s.start(),this.emit("started",t.id),_.show(`${t.name} v${t.version} has started.`)}catch(e){return this.state[t.id]=!1,_.error(`${t.name} v${t.version} could not be started.`),d.stacktrace(this.name,t.name+" could not be started.",e),new D(t.name,t.filename,"start() could not be fired.",{message:e.message,stack:e.stack})}}stopPlugin(e){const t="string"==typeof e?this.addonList.find(t=>t.id==e):e;if(!t)return;const s=t.plugin;try{s.stop(),this.emit("stopped",t.id),_.show(`${t.name} v${t.version} has stopped.`)}catch(e){return this.state[t.id]=!1,_.error(`${t.name} v${t.version} could not be stopped.`),d.stacktrace(this.name,t.name+" could not be stopped.",e),new D(t.name,t.filename,"stop() could not be fired.",{message:e.message,stack:e.stack})}}setupFunctions(){ze.getCurrentWebContents().on("did-navigate-in-page",this.onSwitch.bind(this)),this.observer.observe(document,{childList:!0,subtree:!0})}onSwitch(){this.emit("page-switch");for(let e=0;eje.getAddonPanel(M.Panels.themes,this.addonList,this.state,{folder:this.addonFolder,onChange:this.toggleTheme.bind(this),reload:this.reloadTheme.bind(this),refreshList:this.updateThemeList.bind(this),saveAddon:this.saveAddon.bind(this),editAddon:this.editAddon.bind(this),deleteAddon:this.deleteAddon.bind(this),prefix:this.prefix})}),e}updateThemeList(){return this.updateList()}loadAllThemes(){return this.loadAllAddons()}enableTheme(e){return this.enableAddon(e)}disableTheme(e){return this.disableAddon(e)}toggleTheme(e){return this.toggleAddon(e)}unloadTheme(e){return this.unloadAddon(e)}loadTheme(e){const t=this.loadAddon(e);t&&te.showAddonErrors({themes:[t]})}reloadTheme(e){const t=this.reloadAddon(e);t&&te.showAddonErrors({themes:[t]})}getFileModification(e,t,s){return s.css=t,`module.exports = ${JSON.stringify(s)};`}startAddon(e){return this.addTheme(e)}stopAddon(e){return this.removeTheme(e)}addTheme(e){const t="string"==typeof e?this.addonList.find(t=>t.id==e):e;t&&(x.injectTheme(t.id,t.css),_.show(`${t.name} v${t.version} has been applied.`))}removeTheme(e){const t="string"==typeof e?this.addonList.find(t=>t.id==e):e;t&&(x.removeTheme(t.id),_.show(`${t.name} v${t.version} has been removed.`))}};class _e{get name(){return"Unnamed Builtin"}get collection(){return"settings"}get category(){return"general"}get id(){return"None"}async initialize(){A.get(this.collection,this.category,this.id)&&await this.enable(),g.on("setting-updated",(e,t,s,n)=>{e==this.collection&&t===this.category&&s===this.id&&(n?this.enable():this.disable())})}registerSetting(e,t,s,n,i){return 4==arguments.length?(e=this.collection,t=arguments[0],s=arguments[1],n=arguments[2],i=arguments[3]):3==arguments.length&&(e=this.collection,t=this.category,s=arguments[0],n=arguments[1],i=arguments[2]),A.on(e,t,s,e=>{e?n():i()})}get(e,t,s){return 2==arguments.length?(e=this.collection,t=arguments[0],s=arguments[1]):1==arguments.length&&(e=this.collection,t=this.category,s=arguments[0]),A.get(e,t,s)}async enable(){this.log("Enabled"),await this.enabled()}async disable(){this.log("Disabled"),await this.disabled()}async enabled(){}async disabled(){}log(...e){d.log(this.name,...e)}warn(...e){d.warn(this.name,...e)}error(...e){d.err(this.name,...e)}stacktrace(e,t){d.stacktrace(this.name,e,t)}after(e,t,s){return F.after(this.name,e,t,s)}unpatchAll(){return F.unpatchAll(this.name)}}const qe=u.getByDisplayName("TooltipDeprecated");class He extends O.Component{constructor(e){super(e),this.state={shouldAnimate:!this.animateOnHover,isFavorite:this.props.isFavorite},this.onMouseEnter=this.onMouseEnter.bind(this),this.onMouseLeave=this.onMouseLeave.bind(this),this.onClick=this.onClick.bind(this),this.toggleFavorite=this.toggleFavorite.bind(this)}get animateOnHover(){return A.get("emotes","general","animateOnHover")}get label(){return this.props.modifier?`${this.props.name}:${this.props.modifier}`:this.props.name}get modifierClass(){return this.props.modifier?` emote${this.props.modifier}`:""}onMouseEnter(){!this.state.shouldAnimate&&this.animateOnHover&&this.setState({shouldAnimate:!0})}onMouseLeave(){this.state.shouldAnimate&&this.animateOnHover&&this.setState({shouldAnimate:!1})}onClick(e){this.props.onClick&&this.props.onClick(e)}toggleFavorite(e){e.preventDefault(),e.stopPropagation(),this.state.isFavorite?g.emit("emotes-favorite-removed",this.label):g.emit("emotes-favorite-added",this.label,this.props.url),this.setState({isFavorite:!this.state.isFavorite})}render(){return O.createElement(qe,{color:"black",position:"top",text:this.label,delay:750},O.createElement("div",{className:"emotewrapper"+(this.props.jumboable?" jumboable":""),onMouseEnter:this.onMouseEnter,onMouseLeave:this.onMouseLeave,onClick:this.onClick},O.createElement("img",{draggable:!1,className:"emote"+this.modifierClass+(this.props.jumboable?" jumboable":"")+(this.state.shouldAnimate?"":" stop-animation"),dataModifier:this.props.modifier,alt:this.label,src:this.props.url}),O.createElement("input",{className:"fav"+(this.state.isFavorite?" active":""),title:M.Emotes.favoriteAction,type:"button",onClick:this.toggleFavorite})))}}const Ue=s(3),We={TwitchGlobal:new k("https://static-cdn.jtvnw.net/emoticons/v1/{{id}}/1.0"),TwitchSubscriber:new k("https://static-cdn.jtvnw.net/emoticons/v1/{{id}}/1.0"),FrankerFaceZ:new k("https://cdn.frankerfacez.com/emoticon/{{id}}/1"),BTTV:new k("https://cdn.betterttv.net/emote/{{id}}/1x")},Ge={TwitchGlobal:{},TwitchSubscriber:{},BTTV:{},FrankerFaceZ:{}},Ve=[],Je=["twitch","subscriber","bttv","ffz"],Ze=["flip","spin","pulse","spin2","spin3","1spin","2spin","3spin","tr","bl","br","shake","shake2","shake3","flap"];var Ye=new class extends _e{get name(){return"Emotes"}get collection(){return"settings"}get category(){return"general"}get id(){return"emotes"}get categories(){return Object.keys(Ge).filter(e=>this.isCategoryEnabled(e))}get shouldDownload(){return A.get("emotes",this.category,"download")}isCategoryEnabled(e){return super.get("emotes","categories",e.toLowerCase())}get(e){return super.get("emotes","general",e)}get MessageContentComponent(){return u.getModule(e=>e.defaultProps&&e.defaultProps.hasOwnProperty("disableButtons"))}get Emotes(){return Ge}get TwitchGlobal(){return Ge.TwitchGlobal}get TwitchSubscriber(){return Ge.TwitchSubscriber}get BTTV(){return Ge.BTTV}get FrankerFaceZ(){return Ge.FrankerFaceZ}get blacklist(){return Ve}get favorites(){return this.favoriteEmotes}getUrl(e,t){return We[e].format({id:Ge[e][t]})}getCategory(e){return Ge[e]}getRemoteFile(e){return c.repoUrl(`data/emotes/${e.toLowerCase()}.json`)}initialize(){super.initialize(),window.emoteModule=this;const e=v.getBDData("favoriteEmotes");this.favoriteEmotes=e||{},this.addFavorite=this.addFavorite.bind(this),this.removeFavorite=this.removeFavorite.bind(this),this.onCategoryToggle=this.onCategoryToggle.bind(this),this.resetEmotes=this.resetEmotes.bind(this)}async enabled(){for(A.registerCollection("emotes","Emotes",o,{title:M.Emotes.clearEmotes,onClick:this.resetEmotes}),await this.getBlacklist(),await this.loadEmoteData();!this.MessageContentComponent;)await new Promise(e=>setTimeout(e,100));this.patchMessageContent(),g.on("emotes-favorite-added",this.addFavorite),g.on("emotes-favorite-removed",this.removeFavorite),g.on("setting-updated",this.onCategoryToggle)}disabled(){g.off("setting-updated",this.onCategoryToggle),g.off("emotes-favorite-added",this.addFavorite),g.off("emotes-favorite-removed",this.removeFavorite),A.removeCollection("emotes"),this.emptyEmotes(),this.cancelEmoteRender&&(this.cancelEmoteRender(),delete this.cancelEmoteRender)}onCategoryToggle(e,t,s,n){if("emotes"==e&&"categories"==t)return n?this.loadEmoteData(s):this.unloadEmoteData(s)}addFavorite(e,t){this.favoriteEmotes.hasOwnProperty(e)||(this.favoriteEmotes[e]=t),this.saveFavorites()}removeFavorite(e){this.favoriteEmotes.hasOwnProperty(e)&&(delete this.favoriteEmotes[e],this.saveFavorites())}isFavorite(e){return this.favoriteEmotes.hasOwnProperty(e)}saveFavorites(){v.setBDData("favoriteEmotes",this.favoriteEmotes)}emptyEmotes(){for(const e in Ge)Object.assign(Ge,{[e]:{}})}patchMessageContent(){this.cancelEmoteRender||(this.cancelEmoteRender=this.after(this.MessageContentComponent.prototype,"render",(e,t,s)=>{this.after(s.props,"children",(e,t,s)=>{if(0==this.categories.length)return;const n=s.props.children[1];if(!n.props.children)return;const i=n.props.children[1];if(i&&i.length){for(let e=0;e"string"==typeof e&&""==e.replace(/\s*/,"")||(!(!e.type||"BDEmote"!=e.type.name)||!!(e.props&&e.props.children&&e.props.children.props&&e.props.children.props.emojiName))))for(const e of i)"object"==typeof e&&("BDEmote"==e.type.name?e.props.jumboable=!0:e.props&&e.props.children&&e.props.children.props&&e.props.children.props.emojiName&&(e.props.children.props.jumboable=!0))}})}))}async getBlacklist(){const e=v.emotesExist("Blacklist"),t=await this.isCacheValid("Blacklist"),s=t||!t&&e&&!this.shouldDownload?v.getEmoteData("Blacklist"):await this.downloadEmotes("Blacklist");Ve.push(...s)}isCacheValid(e){return new Promise(t=>{const s=v.getCacheHash("emotes",e);if(!s)return t(!1);Ue.head({url:this.getRemoteFile(e),headers:{"If-None-Match":s}},(e,s)=>{t(304==s.statusCode)})})}async loadEmoteData(e){e||(e=this.categories),Array.isArray(e)||(e=[e]);const t=Object.keys(Ge);e=e.map(e=>t.find(t=>t.toLowerCase()==e.toLowerCase())),_.show(M.Emotes.loading,{type:"info"}),this.emotesLoaded=!1;for(const t of e){const e=v.emotesExist(t),s=await this.isCacheValid(t);let n=null;if(s||!s&&e&&!this.shouldDownload){this.log(`Loading ${t} emotes from local cache.`);const e=v.getEmoteData(t);Object.keys(e).length>0&&(n=e)}n||(n=await this.downloadEmotes(t)),Object.assign(Ge[t],n),await new Promise(e=>setTimeout(e,1e3))}this.emotesLoaded=!0,g.dispatch("emotes-loaded"),_.show(M.Emotes.loaded,{type:"success"})}unloadEmoteData(e){e||(e=this.categories),Array.isArray(e)||(e=[e]);const t=Object.keys(Ge);e=e.map(e=>t.find(t=>t.toLowerCase()==e.toLowerCase()));for(const t of e)delete Ge[t],Ge[t]={}}downloadEmotes(e){const t=this.getRemoteFile(e);this.log(`Downloading ${e} from ${t}`);const s={url:t,timeout:1e4,json:!0};return new Promise(t=>{Ue.get(s,(s,n,i)=>{if(s||200!=n.statusCode)return this.stacktrace(`Could not download ${e} emotes.`,s),t({});for(const e in i)(e.length<4||Ve.includes(e)||!i[e])&&delete i[e];v.saveEmoteData(e,i),v.setCacheHash("emotes",e,n.headers.etag),t(i),this.log(`Downloaded ${e}`)})})}resetEmotes(){const e=Object.keys(Ge);this.unloadEmoteData(e);for(const t of e)v.invalidateCache("emotes",t);this.loadEmoteData()}};class Ke extends O.Component{render(){const e=this.props.size||"24px";return O.createElement("svg",{viewBox:"0 0 24 24",style:{width:e,height:e}},O.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),O.createElement("path",{d:"M19 19H5V5h7V3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2v-7h-2v7zM14 3v2h3.59l-9.83 9.83 1.41 1.41L19 6.41V10h2V3h-7z"}))}}class Xe extends O.Component{constructor(e){super(e),this.hasUnsavedChanges=!1,this.onChange=this.onChange.bind(this),this.toggleLiveUpdate=this.toggleLiveUpdate.bind(this),this.updateCss=this.updateCss.bind(this),this.saveCss=this.saveCss.bind(this),this.openDetached=this.props.openDetached?this.openDetached.bind(this):null,this.openNative=this.openNative.bind(this),this.updateEditor=this.updateEditor.bind(this),this.controls=[{label:O.createElement(ve,{size:"18px"}),tooltip:M.CustomCSS.update,onClick:this.updateCss},{label:O.createElement(J,{size:"18px"}),tooltip:M.CustomCSS.save,onClick:this.saveCss},{label:O.createElement(Z,{size:"18px"}),tooltip:M.CustomCSS.openNative,onClick:this.openNative},{label:O.createElement(Y,{size:"18px"}),tooltip:M.CustomCSS.settings,onClick:"showSettings"},{label:M.Collections.settings.customcss.liveUpdate.name,type:"checkbox",onChange:this.toggleLiveUpdate,checked:A.get("settings","customcss","liveUpdate"),side:"right"}],this.openDetached&&this.controls.push({label:O.createElement(Ke,{size:"18px"}),tooltip:M.CustomCSS.openDetached,onClick:this.openDetached,side:"right"})}componentDidMount(){g.on("customcss-updated",this.updateEditor)}componentWillUnmount(){g.off("customcss-updated",this.updateEditor)}updateEditor(e){this.editor&&(this.editor.value=e)}get value(){return this.editor.session.getValue()}set value(e){this.editor.setValue(e)}showSettings(){return this.editor.keyBinding.$defaultHandler.commands.showSettingsMenu.exec(this.editor)}resize(){return this.editor.resize()}setEditorRef(e){this.editor=e,this.props.editorRef&&void 0!==this.props.editorRef.current?this.props.editorRef.current=e:this.props.editorRef&&(this.props.editorRef=e)}onChange(){this.hasUnsavedChanges=!0,this.props.onChange&&this.props.onChange(...arguments)}render(){return O.createElement(V,{ref:this.setEditorRef.bind(this),readOnly:this.props.readOnly,id:this.props.id||"bd-customcss-editor",onChange:this.onChange,controls:this.controls,value:this.props.css})}toggleLiveUpdate(e){A.set("settings","customcss","liveUpdate",e)}updateCss(e,t){this.props.update&&this.props.update(t)}saveCss(e,t){this.hasUnsavedChanges=!1,this.props.save&&this.props.save(t)}openDetached(e,t){this.props.openDetached&&this.props.openDetached(t)}openNative(){this.props.openNative&&this.props.openNative()}}const Qe=s(1),et=s(0),tt=u.getByProps("updateAccount"),st=u.getByProps("dirtyDispatch"),nt=u.getByProps("ActionTypes").ActionTypes;var it=new class extends _e{get name(){return"Custom CSS"}get category(){return"customcss"}get id(){return"customcss"}get startDetached(){return"detached"==A.get(this.collection,this.category,"openAction")}get nativeOpen(){return"system"==A.get(this.collection,this.category,"openAction")}constructor(){super(),this.savedCss="",this.insertedCss="",this.isDetached=!1}async enabled(){window.ace||x.injectScript("ace-script","https://cdnjs.cloudflare.com/ajax/libs/ace/1.2.9/ace.js").then(()=>{window.require.original&&(window.require=window.require.original)}),A.registerPanel(this.id,M.Panels.customcss,{order:2,element:()=>[O.createElement(ye,{text:M.CustomCSS.editorTitle}),O.createElement(Xe,{css:this.savedCss,save:this.saveCSS.bind(this),update:this.insertCSS.bind(this),openNative:this.openNative.bind(this),openDetached:this.openDetached.bind(this),onChange:this.onChange.bind(this)})],onClick:e=>{if(this.isDetached)return;if(this.nativeOpen)return this.openNative();if(this.startDetached)return this.openDetached();const t=c.findInRenderTree(e._reactInternalFiber,e=>e&&e.onSetSection,{walkable:["child","memoizedProps","props","children"]});t&&t.onSetSection&&t.onSetSection(this.id)}}),this.loadCSS(),this.insertCSS(this.savedCss),this.watchContent()}disabled(){A.removePanel(this.id),this.unwatchContent()}watchContent(){if(this.watcher)return this.error("Already watching content.");const e={};this.log("Starting to watch content."),this.watcher=Qe.watch(v.customCSS,{persistent:!1},async(t,s)=>{if(!t||!s)return;await new Promise(e=>setTimeout(e,50));try{Qe.statSync(v.customCSS)}catch(t){if("ENOENT"!==t.code)return;delete e[s],this.saveCSS("")}const n=Qe.statSync(v.customCSS);if(n&&n.mtime&&n.mtime.getTime()&&"number"==typeof n.mtime.getTime()&&e[s]!=n.mtime.getTime()&&(e[s]=n.mtime.getTime(),"change"==t)){const e=v.loadCustomCSS();if(e==this.savedCss)return;this.savedCss=e,this.insertCSS(this.savedCss),g.emit("customcss-updated",this.savedCss)}})}unwatchContent(){if(!this.watcher)return this.error("Was not watching content.");this.watcher.close(),delete this.watcher,this.log("No longer watching content.")}onChange(e){A.get("settings","customcss","liveUpdate")&&(this.insertCSS(e),this.saveCSS(e))}loadCSS(){this.savedCss=v.loadCustomCSS()}insertCSS(e){void 0===e?e=this.insertedCss:this.insertedCss=e,x.updateCustomCSS(e)}saveCSS(e){void 0!==e&&(this.savedCss=e),v.saveCustomCSS(this.savedCss)}openNative(){et.shell.openExternal(`file://${v.customCSS}`)}openDetached(e){const t=O.createRef(),s=O.createElement(Xe,{id:"bd-floating-editor",ref:t,css:e,save:this.saveCSS.bind(this),update:this.insertCSS.bind(this),openNative:this.openNative.bind(this),onChange:this.onChange.bind(this)});ae.open({onClose:()=>{this.isDetached=!1},onResize:()=>{t&&t.current&&t.current.resize&&t.current.resize()},title:M.CustomCSS.editorTitle,id:"floating-editor-window",height:470,width:410,center:!0,resizable:!0,children:s,confirmClose:()=>!(!t||!t.current)&&t.current.hasUnsavedChanges,confirmationText:M.CustomCSS.confirmationText}),this.isDetached=!0,tt.close(),st.dirtyDispatch({type:nt.LAYER_POP})}},ot=new class extends _e{get name(){return"VoiceMode"}get category(){return"appearance"}get id(){return"voiceMode"}enabled(){document.querySelector(".chat-3bRxxu").style.setProperty("visibility","hidden"),document.querySelector(".chat-3bRxxu").style.setProperty("min-width","0px"),document.querySelector(".channels-Ie2l6A").style.setProperty("flex-grow","100000")}disabled(){document.querySelector(".chat-3bRxxu").style.setProperty("visibility",""),document.querySelector(".chat-3bRxxu").style.setProperty("min-width",""),document.querySelector(".channels-Ie2l6A").style.setProperty("flex-grow","")}};const rt=new RegExp("^(?!da-)((?:[A-Za-z]|[0-9]|-)+)-(?:[A-Za-z]|[0-9]|-|_){6}$");var at=new class extends _e{get id(){return"classNormalizer"}get category(){return"general"}get name(){return"ClassNormalizer"}enabled(){this.hasPatched||(this.patchClassModules(u.getModules(this.moduleFilter.bind(this))),this.normalizeElement(document.querySelector("#app-mount")),this.hasPatched=!0,this.patchDOMMethods())}disabled(){this.hasPatched&&(this.unpatchClassModules(u.getModules(this.moduleFilter.bind(this))),this.revertElement(document.querySelector("#app-mount")),this.hasPatched=!1)}patchClassModules(e){for(const t of e)this.patchClassModule("da",t)}unpatchClassModules(e){for(const t of e)this.unpatchClassModule("da",t)}shouldIgnore(e){return!isNaN(e)||(!!(e.endsWith("px")||e.endsWith("ch")||e.endsWith("em")||e.endsWith("ms"))||(!!e.startsWith("layerContainer-")||(!(!e.startsWith("#")||7!=e.length&&4!=e.length)||!(!e.includes("calc(")&&!e.includes("rgba")))))}moduleFilter(e){if("object"!=typeof e||Array.isArray(e))return!1;if(e.__esModule)return!1;if(!Object.keys(e).length)return!1;for(const t in e){const s=e[t];if("string"!=typeof s)return!1;if(!this.shouldIgnore(s)){if(1===s.split("-").length)return!1;if(!rt.test(s.split(" ")[0]))return!1}}return!0}patchClassModule(e,t){for(const s in t){const n=t[s];if(this.shouldIgnore(n))continue;const i=n.split(" ");for(const n of i){const i=n.match(rt)[1];if(!i)continue;const o=i.split("-").map((e,t)=>t?e[0].toUpperCase()+e.slice(1):e).join("");t[s]+=` ${e}-${o}`}}}unpatchClassModule(e,t){for(const s in t){const n=t[s];if(this.shouldIgnore(n))continue;let i="";const o=n.split(" ");for(const t of o)t.startsWith(`${e}-`)||(i+=` ${t}`);t[s]=i.trim()}}normalizeElement(e){if(!(e instanceof Element))return;const t=e.classList;for(let s=0,n=t.length;st?e[0].toUpperCase()+e.slice(1):e).join("");e.classList.add(`da-${n}`)}for(const t of e.children)this.normalizeElement(t)}revertElement(e){if(!(e instanceof Element))return;e.children&&e.children.length&&this.revertElement(e.children[0]),e.nextElementSibling&&this.revertElement(e.nextElementSibling);const t=e.classList,s=[];for(let e=0;ee.call(this,t))}}},lt=new class extends _e{get name(){return"DeveloperMode"}get category(){return"developer"}get id(){return"developerMode"}get selectorModeID(){return"copySelector"}get selectorMode(){return this.get(this.selectorModeID)}constructor(){super(),this.enableSelectors=this.enableSelectors.bind(this),this.disableSelectors=this.disableSelectors.bind(this)}enabled(){$(window).on("keydown.bdDevmode",e=>{119!==e.which&&118!=e.which||this.log("Debugger Activated")}),this.selectorMode&&this.enableSelectors(),this.selectorCancel=this.registerSetting(this.selectorModeID,this.enableSelectors,this.disableSelectors)}disabled(){$(window).off("keydown.bdDevmode"),this.selectorMode&&this.disableSelectors(),this.selectorCancel&&this.selectorCancel()}enableSelectors(){$(document).on("contextmenu.bdDevmode",e=>{this.lastSelector=this.getSelector(e.toElement);setImmediate(()=>{let t=$(".contextMenu-HLZMGh");t.length<=0&&((t=$('
')).addClass($(".app, .app-2rEoOp").hasClass("theme-dark")?"theme-dark":"theme-light"),t.appendTo(".app, .app-2rEoOp"),t.css("top",e.clientY),t.css("left",e.clientX),$(document).on("click.bdDevModeCtx",()=>{t.remove(),$(document).off(".bdDevModeCtx")}),$(document).on("contextmenu.bdDevModeCtx",()=>{t.remove(),$(document).off(".bdDevModeCtx")}),$(document).on("keyup.bdDevModeCtx",e=>{27===e.keyCode&&(t.remove(),$(document).off(".bdDevModeCtx"))}));const s=$("
",{class:"itemGroup-1tL0uz"}),n=$("
",{class:"item-1Yvehc",click:()=>{p.ElectronModule.copy(this.lastSelector),t.hide()}}).append($("",{text:M.Collections.settings.developer.copySelector.name}));s.append(n),t.append(s),t.hasClass("undefined")&&t.css("top","-="+s.outerHeight())}),e.stopPropagation()})}disableSelectors(){$(document).off("contextmenu.bdDevmode"),$(document).off("contextmenu.bdDevModeCtx")}getRules(e,t=e.ownerDocument.styleSheets){return[...t].filter(e=>!e.href||!e.href.includes("BetterDiscordApp")).map(e=>[...e.cssRules||[]]).flat().filter(t=>t&&t.selectorText&&e.matches(t.selectorText)&&t.style.length&&t.selectorText.split(", ").length<8&&!t.selectorText.split(", ").includes("*"))}getSelector(e){if(e.id)return`#${e.id}`;const t=this.getRules(e),s=t[t.length-1];return s?s.selectorText:e.classList.length?`.${Array.from(e.classList).join(".")}`:`.${Array.from(e.parentElement.classList).join(".")}`}};class dt extends O.Component{constructor(e){super(e),this.props.server.iconUrl||(this.props.server.iconUrl=this.props.defaultAvatar()),this.state={imageError:!1,joined:this.props.joined},this.join=this.join.bind(this),this.handleError=this.handleError.bind(this)}render(){const{server:e}=this.props,t="string"==typeof this.state.joined?`${M.PublicServers.joining}...`:this.state.joined?M.PublicServers.joined:M.PublicServers.join,s=`bd-button${1==this.state.joined?" bd-button-success":""}`;return O.createElement("div",{className:`bd-server-card${e.pinned?" bd-server-card-pinned":""}`},O.createElement("img",{className:"bd-server-image",src:e.iconUrl,onError:this.handleError}),",",O.createElement("div",{className:"bd-server-content"},O.createElement("div",{className:"bd-server-header"},O.createElement("h5",{className:"bd-server-name"},e.name),O.createElement("h5",{className:"bd-server-member-count"},e.members," Members")),O.createElement("div",{className:"bd-scroller-wrap bd-server-description-container"},O.createElement("div",{className:"bd-scroller bd-server-description"},e.description)),O.createElement("div",{className:"bd-server-footer"},O.createElement("div",{className:"bd-server-tags"},e.categories.join(", ")),O.createElement("button",{type:"button",className:s,onClick:this.join},t))))}handleError(){this.props.server.iconUrl=this.props.defaultAvatar(),this.setState({imageError:!0})}async join(){if(this.state.joined)return;this.setState({joined:"joining"});const e=await this.props.join(this.props.server.identifier,this.props.server.nativejoin);this.setState({joined:e})}}const ct=u.getByProps("getSortedGuilds"),ht=u.getByProps("getUserAvatarURL","DEFAULT_AVATARS"),ut=u.getByProps("acceptInvite"),pt=s(0).remote.BrowserWindow;class mt{static get endPoint(){return"https://search.discordservers.com"}static get joinEndPoint(){return"https://j.discordservers.com"}static get connectEndPoint(){return"https://auth.discordservers.com/info"}static getDefaultAvatar(){return ht.DEFAULT_AVATARS[Math.floor(5*Math.random())]}static hasJoined(e){return ct.getFlattenedGuildIds().includes(e)}static search({term:e="",category:t="",from:s=0}={}){return new Promise(n=>{const i=[];t&&i.push(`category=${t.replace(/ /g,"%20")}`),e&&i.push(`term=${e.replace(/ /g,"%20")}`),s&&i.push(`from=${s}`);const o=`?${i.join("&")}`;$.ajax({method:"GET",url:`${this.endPoint}${o}`,success:e=>{const t=e.size+e.from;n({servers:e.results,size:e.size,from:e.from,total:e.total,next:t>=e.total?null:t})},error:()=>n(null)})})}static join(e,t=!1){return new Promise(s=>{if(t)return ut.acceptInvite(e),s(!0);$.ajax({method:"GET",url:`${this.joinEndPoint}/${e}`,headers:{Accept:"application/json;","Content-Type":"application/json;","x-discord-token":this._accessToken},crossDomain:!0,xhrFields:{withCredentials:!0},success:()=>s(!0),error:()=>s(!1)})})}static checkConnection(){return new Promise(e=>{try{$.ajax({method:"GET",url:this.connectEndPoint,headers:{Accept:"application/json;","Content-Type":"application/json;"},crossDomain:!0,xhrFields:{withCredentials:!0},success:t=>{this._accessToken=t.access_token,e(t)},error:()=>e(!1)})}catch(t){e(!1)}})}static connect(){return new Promise(e=>{const t=new pt(this.windowOptions),s=`https://auth.discordservers.com/connect?scopes=guilds.join&previousUrl=${this.connectEndPoint}`;t.webContents.on("did-navigate",(s,n)=>{n==this.connectEndPoint&&(t.close(),e())}),t.loadURL(s)})}static get windowOptions(){return{width:380,height:450,backgroundColor:"#282b30",show:!0,resizable:!0,maximizable:!1,minimizable:!1,alwaysOnTop:!0,frame:!1,center:!0,webPreferences:{nodeIntegration:!1}}}}const gt=u.getByDisplayName("SettingsView");class ft extends O.Component{get categoryButtons(){return["All","FPS Games","MMO Games","Strategy Games","MOBA Games","RPG Games","Tabletop Games","Sandbox Games","Simulation Games","Music","Community","Language","Programming","Other"]}constructor(e){super(e),this.state={category:"All",query:"",loading:!0,user:null,results:{servers:[],size:0,from:0,total:0,next:null}},this.changeCategory=this.changeCategory.bind(this),this.searchKeyDown=this.searchKeyDown.bind(this),this.connect=this.connect.bind(this),this.loadNextPage=this.loadNextPage.bind(this)}componentDidMount(){this.checkConnection()}async checkConnection(){const e=await mt.checkConnection();if(!e)return this.setState({loading:!0,user:null});this.setState({user:e}),this.search()}async connect(){await mt.connect(),this.checkConnection()}searchKeyDown(e){this.state.loading||13!==e.which||this.search(e.target.value)}async search(e="",t=0){this.setState({query:e,loading:!0});const s=await mt.search({term:e,category:"All"==this.state.category?"":this.state.category,from:t});if(!s)return this.setState({results:{servers:[],size:0,from:0,total:0,next:null}});this.setState({loading:!1,results:s})}async changeCategory(e){this.state.loading||(await new Promise(t=>this.setState({category:e},t)),this.search())}loadNextPage(){this.state.loading||this.search(this.state.query,this.state.results.next)}async join(e,t=!1){return await mt.join(e,t)}get searchBox(){return O.createElement(Ae,{onKeyDown:this.searchKeyDown,placeholder:`${M.PublicServers.search}...`})}get title(){if(!this.state.user)return M.PublicServers.notConnected;if(this.state.loading)return`${M.PublicServers.loading}...`;const e=this.state.results.from+1,t=this.state.results.total,s=this.state.results.next?this.state.results.next:t;let n=M.PublicServers.results.format({start:e,end:s,total:t,category:this.state.category});return this.state.query&&(n+=" "+M.PublicServers.query.format({query:this.state.query})),n}get content(){const e=this.state.user?null:{title:M.PublicServers.connect,onClick:this.connect},t="All"!=this.state.category&&this.state.user?null:this.bdServer,s=this.state.results.servers.map(e=>O.createElement(dt,{key:e.identifier,server:e,joined:mt.hasJoined(e.identifier),defaultAvatar:mt.getDefaultAvatar}));return[O.createElement(ye,{text:this.title,button:e}),t,s,this.state.results.next?this.nextButton:null,this.state.results.servers.length>0&&O.createElement(ye,{text:this.title})]}get nextButton(){return O.createElement("button",{type:"button",className:"bd-button bd-button-next",onClick:this.loadNextPage},this.state.loading?M.PublicServers.loading:M.PublicServers.loadMore)}get connection(){const{user:e}=this.state;return e?O.createElement("div",{id:"bd-connection"},O.createElement("div",{className:"bd-footnote"},M.PublicServers.connection.format(e)),O.createElement("button",{type:"button",className:"bd-button bd-button-reconnect",onClick:this.connect},M.PublicServers.reconnect)):O.createElement("div",{id:"bd-connection"})}get bdServer(){const e={name:"BetterDiscord",online:"7500+",members:"20000+",categories:["community","programming","support"],description:"Official BetterDiscord server for plugins, themes, support, etc",identifier:"86004744966914048",iconUrl:"https://cdn.discordapp.com/icons/86004744966914048/292e7f6bfff2b71dfd13e508a859aedd.webp",nativejoin:!0,invite_code:"0Tmfo5ZbORCRqbAd",pinned:!0};return O.createElement(dt,{server:e,pinned:!0,joined:mt.hasJoined(e.identifier),defaultAvatar:mt.getDefaultAvatar})}render(){const e=this.categoryButtons.map(e=>({section:e,label:e,element:()=>this.content}));return O.createElement(gt,{onClose:this.props.close,onSetSection:this.changeCategory,section:this.state.category,sections:[{section:"HEADER",label:M.PublicServers.search},{section:"CUSTOM",element:()=>this.searchBox},{section:"HEADER",label:M.PublicServers.categories},...e,{section:"DIVIDER"},{section:"HEADER",label:O.createElement("a",{href:"https://discordservers.com",target:"_blank"},"DiscordServers.com")},{section:"DIVIDER"},{section:"CUSTOM",element:()=>this.connection}],theme:"dark"})}}const bt=u.getByProps("pushLayer");var yt=new class extends _e{get name(){return"PublicServers"}get category(){return"general"}get id(){return"publicServers"}enabled(){const e=p.GuildClasses.wrapper.split(" ")[0];$(`.${e} .scroller-2FKFPG >:first-child`).after(this.button)}disabled(){$("#bd-pub-li").remove()}openPublicServers(){bt.pushLayer(()=>p.React.createElement(ft,{close:bt.popLayer}))}get button(){return $("
",{class:p.GuildClasses.listItem,id:"bd-pub-li"}).append($("
",{class:"wrapper-25eVIn "+p.GuildClasses.circleButtonMask,text:M.PublicServers.button,id:"bd-pub-button",click:()=>{this.openPublicServers()}}))}},vt=new class extends _e{get name(){return"DarkMode"}get category(){return"appearance"}get id(){return"darkMode"}enabled(){document.getElementById("app-mount").classList.add("bda-dark","bd-dark")}disabled(){document.getElementById("app-mount").classList.remove("bda-dark","bd-dark")}},wt=new class extends _e{get name(){return"MinimalMode"}get category(){return"appearance"}get id(){return"minimalMode"}get hideChannelsID(){return"hideChannels"}get hideChannels(){return this.get(this.hideChannelsID)}constructor(){super(),this.enableHideChannels=this.enableHideChannels.bind(this),this.disableHideChannels=this.disableHideChannels.bind(this)}enabled(){document.body.classList.add("bd-minimal"),this.hideChannels&&this.enableHideChannels(),this.hideChannelCancel=this.registerSetting(this.hideChannelsID,this.enableHideChannels,this.disableHideChannels)}disabled(){document.body.classList.remove("bd-minimal"),this.hideChannels&&this.disableHideChannels(),this.hideChannelCancel&&this.hideChannelCancel()}enableHideChannels(){document.body.classList.add("bd-minimal-chan")}disableHideChannels(){document.body.classList.remove("bd-minimal-chan")}},Ct=new class extends _e{get name(){return"24Hour"}get category(){return"general"}get id(){return"twentyFourHour"}enabled(){this.inject24Hour()}disabled(){this.unpatchAll()}inject24Hour(){const e=new RegExp("([0-9]{1,2}):([0-9]{1,2})\\s(AM|PM)"),t=(t,s,n)=>{const i=n.match(e);if(i&&4===i.length)return"AM"===i[3]?n.replace(i[0],`${"12"===i[1]?"00":i[1].padStart(2,"0")}:${i[2]}`):n.replace(i[0],`${"12"===i[1]?"12":parseInt(i[1])+12}:${i[2]}`)};this.after(p.TimeFormatter,"calendarFormat",t),this.after(p.TimeFormatter,"dateFormat",t)}};const St=u.getModule(e=>e.defaultProps&&e.defaultProps.hasOwnProperty("disableButtons"));var Et=new class extends _e{get name(){return"ColoredText"}get category(){return"appearance"}get id(){return"coloredText"}enabled(){this.injectColoredText()}disabled(){this.unpatchAll()}injectColoredText(){this.after(St.prototype,"render",(e,t,s)=>{this.after(s.props,"children",{silent:!0,after:({returnValue:t})=>{const s=t.props.children[1],n=e.props.message.colorString;s&&n&&(s.props.style={color:n})}})})}removeColoredText(){document.querySelectorAll(".markup-2BOw-j").forEach(e=>{e.style.setProperty("color","")})}},Pt=new class extends _e{get name(){return"VoiceDisconnect"}get category(){return"general"}get id(){return"voiceDisconnect"}constructor(){super(),this.beforeUnload=this.beforeUnload.bind(this)}enabled(){window.addEventListener("beforeunload",this.beforeUnload)}disabled(){window.removeEventListener("beforeunload",this.beforeUnload)}beforeUnload(){p.ChannelActions.selectVoiceChannel(null,null)}};const xt=(e,t,s={})=>{const{onContextMenu:n,onClick:i}=s,o=c.parseHTML(`
\n ${e}\n
`);return n&&o.addEventListener("contextmenu",n),o.addEventListener("click",i),o};var kt=new class extends _e{get name(){return"EmoteMenu"}get collection(){return"emotes"}get category(){return"general"}get id(){return"emoteMenu"}get hideEmojisID(){return"hideEmojiMenu"}get hideEmojis(){return this.get(this.hideEmojisID)}constructor(){super(),this.lastTab="bd-qem-emojis",this.qmeHeader=c.parseHTML('
\n \n \n
');for(const e of this.qmeHeader.getElementsByTagName("button"))e.addEventListener("click",this.switchMenu.bind(this));this.teContainer=c.parseHTML('
\n
\n
\n
\n\n
\n
\n
\n
'),this.teContainerInner=this.teContainer.querySelector(".emote-menu-inner"),this.faContainer=c.parseHTML('
\n
\n
\n
\n\n
\n
\n
\n
'),this.faContainerInner=this.faContainer.querySelector(".emote-menu-inner"),this.observer=new MutationObserver(e=>{for(const t of e)this.observe(t)}),this.enableHideEmojis=this.enableHideEmojis.bind(this),this.disableHideEmojis=this.disableHideEmojis.bind(this),this.updateTwitchEmotes=this.updateTwitchEmotes.bind(this)}async enabled(){this.log("Starting to observe"),this.observer.observe(document.getElementById("app-mount"),{childList:!0,subtree:!0}),this.hideEmojiCancel=this.registerSetting(this.hideEmojisID,this.enableHideEmojis,this.disableHideEmojis),this.hideEmojis&&this.enableHideEmojis(),Ye.emotesLoaded&&this.updateTwitchEmotes(),this.updateFavorites(),g.on("emotes-loaded",this.updateTwitchEmotes)}disabled(){g.off("emotes-loaded",this.updateTwitchEmotes),this.observer.disconnect(),this.disableHideEmojis(),this.hideEmojiCancel&&this.hideEmojiCancel()}enableHideEmojis(){const e=document.querySelector(".emojiPicker-3m1S-j");e&&e.classList.add("bd-qme-hidden")}disableHideEmojis(){const e=document.querySelector(".emojiPicker-3m1S-j");e&&e.classList.remove("bd-qme-hidden")}insertEmote(e){const t=c.getTextArea();c.insertText(t[0]," "==t.val().slice(-1)?t.val()+e:t.val()+" "+e)}favContext(e){e.stopPropagation();const t=e.target.closest(".emote-container").children[0],s=$('
Remove
');s.css({top:e.pageY-$("#bd-qem-favourite-container").offset().top,left:e.pageX-$("#bd-qem-favourite-container").offset().left}),$(t).parent().append(s),s.on("click",e=>{e.preventDefault(),e.stopPropagation(),$(t).remove(),Ye.removeFavorite($(t).attr("title")),this.updateFavorites(),$(document).off("mousedown.emotemenu")}),$(document).on("mousedown.emotemenu",function(e){"removemenu"!=e.target.id&&($("#removemenu").remove(),$(document).off("mousedown.emotemenu"))})}switchMenu(e){let t="string"==typeof e?e:e.target.id;"bd-qem-emojis"==t&&this.hideEmojis&&(t="bd-qem-favourite");const s=$("#bd-qem-twitch"),n=$("#bd-qem-favourite"),i=$("#bd-qem-emojis");switch(s.removeClass("active"),n.removeClass("active"),i.removeClass("active"),$(".emojiPicker-3m1S-j").hide(),$("#bd-qem-favourite-container").hide(),$("#bd-qem-twitch-container").hide(),t){case"bd-qem-twitch":s.addClass("active"),$("#bd-qem-twitch-container").show();break;case"bd-qem-favourite":n.addClass("active"),$("#bd-qem-favourite-container").show();break;case"bd-qem-emojis":i.addClass("active"),$(".emojiPicker-3m1S-j").show(),$(".emojiPicker-3m1S-j input").focus()}t&&(this.lastTab=t)}observe(e){if(!(e.addedNodes.length&&e.addedNodes[0]instanceof Element))return;const t=e.addedNodes[0];if(!t.classList.contains("popout-3sVMXz")||t.classList.contains("popoutLeft-30WmrD")||!t.getElementsByClassName("emojiPicker-3m1S-j").length)return;const s=$(t);this.hideEmojis?s.addClass("bd-qme-hidden"):s.removeClass("bd-qme-hidden"),s.prepend(this.qmeHeader),s.append(this.teContainer),s.append(this.faContainer),this.switchMenu(this.lastTab)}updateTwitchEmotes(){for(;this.teContainerInner.firstChild;)this.teContainerInner.firstChild.remove();for(const e in Ye.getCategory("TwitchGlobal")){if(!Ye.getCategory("TwitchGlobal").hasOwnProperty(e))continue;const t=Ye.getUrl("TwitchGlobal",e),s=xt(e,t,{onClick:this.insertEmote.bind(this,e)});this.teContainerInner.append(s)}}updateFavorites(){for(;this.faContainerInner.firstChild;)this.faContainerInner.firstChild.remove();for(const e in Ye.favorites){const t=Ye.favorites[e],s=xt(e,t,{onClick:this.insertEmote.bind(this,e),onContextMenu:this.favContext.bind(this)});this.faContainerInner.append(s)}Ye.saveFavorites()}},Mt=new class extends _e{get name(){return"EmoteAutocapitalize"}get collection(){return"emotes"}get category(){return"general"}get id(){return"autoCaps"}enabled(){$("body").off(".bdac"),$("body").on("keyup.bdac change.bdac paste.bdac",$(".channelTextArea-1LDbYG textarea:first"),()=>{const e=$(".channelTextArea-1LDbYG textarea:first").val();if(null==e)return;const t=e.split(" ").pop();if(t.length>3){if("danSgame"==t)return;const s=this.capitalize(t.toLowerCase());null!=s&&c.insertText(c.getTextArea()[0],e.replace(t,s))}})}disabled(){$("body").off(".bdac")}capitalize(e){const t=Ye.getCategory("TwitchGlobal");for(const s in t)if(t.hasOwnProperty(s)&&e==(s+"").toLowerCase())return s}};const At=s(1),Dt=s(2);var Nt=new class extends _e{get name(){return"WindowPrefs"}get category(){return"window"}get id(){return"transparency"}get WindowConfigFile(){if(this._windowConfigFile)return this._windowConfigFile;const e=s(0).remote.app,t=e.getAppPath(),n=e.getPath("userData"),i=Dt.resolve(n,e.getVersion(),"modules","discord_desktop_core","injector","config.json"),o=Dt.resolve(t,"..","app","config.json"),r=At.existsSync(o)?o:At.existsSync(i)?i:null;return this._windowConfigFile=r||null}enabled(){this.setWindowPreference("transparent",!0),this.setWindowPreference("backgroundColor",null)}disabled(){this.setWindowPreference("transparent",!1),this.setWindowPreference("backgroundColor","#2f3136")}getAllWindowPreferences(){return this.WindowConfigFile?require(this.WindowConfigFile):{}}getWindowPreference(e){if(this.WindowConfigFile)return this.getAllWindowPreferences()[e]}setWindowPreference(e,t){if(!this.WindowConfigFile)return;const n=this.getAllWindowPreferences();n[e]=t,delete s.c[this.WindowConfigFile],At.writeFileSync(this.WindowConfigFile,JSON.stringify(n,null,4))}};class Ft extends O.Component{render(){return O.createElement("svg",{className:"bd-logo "+this.props.className,height:"100%",width:this.props.size||"16px",viewBox:"0 0 2000 2000",style:{fillRule:"evenodd",clipRule:"evenodd",strokeLinecap:"round",strokeLinejoin:"round"}},O.createElement("metadata",null),O.createElement("defs",null,O.createElement("filter",{id:"shadow1"},O.createElement("feDropShadow",{dx:"20",dy:"0",stdDeviation:"20",floodColor:"rgba(0,0,0,0.35)"})),O.createElement("filter",{id:"shadow2"},O.createElement("feDropShadow",{dx:"15",dy:"0",stdDeviation:"20",floodColor:"rgba(255,255,255,0.15)"})),O.createElement("filter",{id:"shadow3"},O.createElement("feDropShadow",{dx:"10",dy:"0",stdDeviation:"20",floodColor:"rgba(0,0,0,0.35)"}))),O.createElement("g",null,O.createElement("path",{style:{filter:"url(#shadow3)"},fill:"#171717",opacity:"1",d:"M1195.44+135.442L1195.44+135.442L997.6+136.442C1024.2+149.742+1170.34+163.542+1193.64+179.742C1264.34+228.842+1319.74+291.242+1358.24+365.042C1398.14+441.642+1419.74+530.642+1422.54+629.642L1422.54+630.842L1422.54+632.042C1422.54+773.142+1422.54+1228.14+1422.54+1369.14L1422.54+1370.34L1422.54+1371.54C1419.84+1470.54+1398.24+1559.54+1358.24+1636.14C1319.74+1709.94+1264.44+1772.34+1193.64+1821.44C1171.04+1837.14+1025.7+1850.54+1000+1863.54L1193.54+1864.54C1539.74+1866.44+1864.54+1693.34+1864.54+1296.64L1864.54+716.942C1866.44+312.442+1541.64+135.442+1195.44+135.442Z"}),O.createElement("path",{style:{filter:"url(#shadow2)"},fill:"#3E82E5",opacity:"1",d:"M1695.54+631.442C1685.84+278.042+1409.34+135.442+1052.94+135.442L361.74+136.442L803.74+490.442L1060.74+490.442C1335.24+490.442+1335.24+835.342+1060.74+835.342L1060.74+1164.84C1150.22+1164.84+1210.53+1201.48+1241.68+1250.87C1306.07+1353+1245.76+1509.64+1060.74+1509.64L361.74+1863.54L1052.94+1864.54C1409.24+1864.54+1685.74+1721.94+1695.54+1368.54C1695.54+1205.94+1651.04+1084.44+1572.64+999.942C1651.04+915.542+1695.54+794.042+1695.54+631.442Z"}),O.createElement("path",{style:{filter:"url(#shadow1)"},fill:"#FFFFFF",opacity:"1",d:"M1469.25+631.442C1459.55+278.042+1183.05+135.442+826.65+135.442L135.45+135.442L135.45+1004C135.45+1004+135.427+1255.21+355.626+1255.21C575.825+1255.21+575.848+1004+575.848+1004L577.45+490.442L834.45+490.442C1108.95+490.442+1108.95+835.342+834.45+835.342L664.65+835.342L664.65+1164.84L834.45+1164.84C923.932+1164.84+984.244+1201.48+1015.39+1250.87C1079.78+1353+1019.47+1509.64+834.45+1509.64L135.45+1509.64L135.45+1864.54L826.65+1864.54C1182.95+1864.54+1459.45+1721.94+1469.25+1368.54C1469.25+1205.94+1424.75+1084.44+1346.35+999.942C1424.75+915.542+1469.25+794.042+1469.25+631.442Z"})))}}var Tt=new class{initialize(){c.suppressErrors(this.patchSocial.bind(this),"BD Social Patch")(),c.suppressErrors(this.patchGuildPills.bind(this),"BD Guild Pills Patch")(),c.suppressErrors(this.patchGuildListItems.bind(this),"BD Guild List Items Patch")(),c.suppressErrors(this.patchGuildSeparator.bind(this),"BD Guild Separator Patch")()}patchSocial(){if(this.socialPatch)return;const e=u.getByDisplayName("TabBar"),t=u.getByDisplayName("Anchor");e&&t&&(this.socialPatch=F.after("ThemeHelper",e.prototype,"render",(e,s,n)=>{const i=n.props.children;if(!i||!i.length)return;if("Separator"!==i[i.length-2].type.displayName)return;if(!i[i.length-1].type.toString().includes("socialLinks"))return;const o=i[i.length-1].type;i[i.length-1].type=function(){const e=o(...arguments);return e.props.children.push(p.React.createElement(t,{className:"bd-social-link",href:"https://github.com/rauenzi/BetterDiscordApp",rel:"author",title:"BandagedBD",target:"_blank"},p.React.createElement(Ft,{size:"16px",className:"bd-social-logo"}))),e}}))}patchGuildListItems(){if(this.guildListItemsPatch)return;const e=p.GuildClasses.listItem.split(" ")[0],t=p.GuildClasses.blobContainer.split(" ")[0],s=c.getReactInstance(document.querySelector(`.${e} .${t}`).parentElement).return.type;s&&(this.guildListItemsPatch=F.after("ThemeHelper",s.prototype,"render",(e,t,s)=>{const n=e.props;return s.props.className+=" bd-guild",n.unread&&(s.props.className+=" bd-unread"),n.selected&&(s.props.className+=" bd-selected"),n.audio&&(s.props.className+=" bd-audio"),n.video&&(s.props.className+=" bd-video"),n.badge&&(s.props.className+=" bd-badge"),n.animatable&&(s.props.className+=" bd-animatable"),s}))}patchGuildPills(){if(this.guildPillPatch)return;const e=u.getModule(e=>e.default&&!e.default.displayName&&e.default.toString&&e.default.toString().includes("translate3d"));e&&(this.guildPillPatch=F.after("ThemeHelper",e,"default",(e,t,s)=>{const n=t[0];return n.unread&&(s.props.className+=" bd-unread"),n.selected&&(s.props.className+=" bd-selected"),n.hovered&&(s.props.className+=" bd-hovered"),s}))}patchGuildSeparator(){if(this.guildSeparatorPatch)return;const e=u.getByDisplayName("Guilds"),t=u.getByProps("renderListItem");if(!t||!e)return;const s=function(){const e=t.Separator(...arguments);return e.props.className+=" bd-guild-separator",e};this.guildSeparatorPatch=F.after("ThemeHelper",e.prototype,"render",(e,t,n)=>{const i=c.findInReactTree(n,e=>e.type&&!e.type.displayName&&"function"==typeof e.type&&c.isEmpty(e.props));i&&(i.type=s)})}};const Bt=p.GuildClasses;function Lt(){}Lt.prototype.setConfig=function(e){Object.assign(i,e)},Lt.prototype.init=async function(){if(i.version
Please download the latest version from GitHub");v.initialize(),await P.initialize(),d.log("Startup","Initializing Settings"),A.initialize(),x.initialize(),await this.waitForGuilds(),z.initialize(),Tt.initialize();for(const e in n)n[e].initialize();d.log("Startup","Loading Plugins");const e=Oe.initialize();d.log("Startup","Loading Themes");const t=Ie.initialize();d.log("Startup","Removing Loading Icon"),document.getElementsByClassName("bd-loaderv2")[0].remove(),d.log("Startup","Collecting Startup Errors"),te.showAddonErrors({plugins:e,themes:t})},Lt.prototype.waitForGuilds=function(){return new Promise(e=>{const t=function(){"complete"!=document.readyState&&setTimeout(t,100);const s=Bt.wrapper.split(" ")[0],n=Bt.listItem.split(" ")[0],o=Bt.blobContainer.split(" ")[0];if(document.querySelectorAll(`.${s} .${n} .${o}`).length>0)return e(i.deferLoaded=!0);setTimeout(t,100)};t()})};var jt=new Lt;const $t={get React(){return p.React},get ReactDOM(){return p.ReactDOM},get WindowConfigFile(){if(this._windowConfigFile)return this._windowConfigFile;const e=s(0).remote.app,t=s(2),n=e.getAppPath(),i=e.getPath("userData"),o=t.resolve(i,e.getVersion(),"modules","discord_desktop_core","injector","config.json"),r=t.resolve(n,"..","app","config.json"),a=s(1),l=a.existsSync(r)?r:a.existsSync(o)?o:null;return this._windowConfigFile=l||null},getAllWindowPreferences:function(){return this.WindowConfigFile?require(this.WindowConfigFile):{}},getWindowPreference:function(e){if(this.WindowConfigFile)return this.getAllWindowPreferences()[e]},setWindowPreference:function(e,t){if(!this.WindowConfigFile)return;const n=s(1),i=this.getAllWindowPreferences();i[e]=t,delete s.c[this.WindowConfigFile],n.writeFileSync(this.WindowConfigFile,JSON.stringify(i,null,4))},injectCSS:function(e,t){x.injectStyle(e,t)},clearCSS:function(e){x.removeStyle(e)},linkJS:function(e,t){return x.injectScript(e,t)},unlinkJS:function(e){x.removeScript(e)},alert:function(e,t){te.alert(e,t)},showConfirmationModal:function(e,t,s={}){return te.showConfirmationModal(e,t,s)},showToast:function(e,t={}){_.show(e,t)},findModule:function(e){return u.getModule(e)},findAllModules:function(e){return u.getModule(e,!1)},findModuleByProps:function(...e){return u.getByProps(...e)},findModuleByPrototypes:function(...e){return u.getByPrototypes(...e)},findModuleByDisplayName:function(e){return u.getByDisplayName(e)},getInternalInstance:function(e){if(e instanceof window.jQuery||e instanceof Element)return e instanceof jQuery&&(e=e[0]),c.getReactInstance(e)},loadData:function(e,t){return v.getPluginData(e,t)}};$t.getData=$t.loadData,$t.saveData=function(e,t,s){return v.setPluginData(e,t,s)},$t.setData=$t.saveData,$t.deleteData=function(e,t){return v.deletePluginData(e,t)},$t.monkeyPatch=function(e,t,s){const{before:n,after:i,instead:o,once:r=!1,silent:a=!1,force:l=!1}=s,d=s.displayName||e.displayName||e.name||e.constructor.displayName||e.constructor.name;if(a||console.log("patch",t,"of",d),!e[t]){if(!l)return console.error(t,"does not exist for",d);e[t]=function(){}}const h=e[t],u=()=>{a||console.log("unpatch",t,"of",d),e[t]=h};return e[t]=function(){const s={thisObject:this,methodArguments:arguments,cancelPatch:u,originalMethod:h,callOriginalMethod:()=>s.returnValue=s.originalMethod.apply(s.thisObject,s.methodArguments)};if(o){const n=c.suppressErrors(o,"`instead` callback of "+e[t].displayName)(s);void 0!==n&&(s.returnValue=n)}else n&&c.suppressErrors(n,"`before` callback of "+e[t].displayName)(s),s.callOriginalMethod(),i&&c.suppressErrors(i,"`after` callback of "+e[t].displayName)(s);return r&&u(),s.returnValue},e[t].__monkeyPatched=!0,e[t].__originalMethod||(e[t].__originalMethod=h),e[t].displayName="patched "+(e[t].displayName||t),u},$t.onRemoved=function(e,t){return c.onRemoved(e,t)},$t.suppressErrors=function(e,t){return c.suppressErrors(e,t)},$t.testJSON=function(e){return c.testJSON(e)},$t.getPlugin=function(e){return Oe.addonList.find(t=>t.name==e)},$t.isPluginEnabled=function(e){const t=this.getPlugin(e);return!!t&&Oe.isEnabled(t.id)},$t.isThemeEnabled=function(e){const t=Ie.addonList.find(t=>t.name==e);return!!t&&Ie.isEnabled(t.id)},$t.getBDData=function(e){return v.getBDData(e)},$t.setBDData=function(e,t){return v.setBDData(e,t)};var zt=$t;s.d(t,"default",function(){return Rt});const Ot=document.createElement("div");Ot.className="bd-loaderv2",Ot.title="BandagedBD is loading...",document.body.appendChild(Ot),window.BdApi=zt,window.pluginModule=Oe,window.themeModule=Ie,window.bdEmotes=Ye.Emotes,window.bemotes=Ye.blacklist,window.settingsModule=A,window.DataStore=v,window.DomManager=x,window.utils=c,window.Components=z,window.BDEvents=g,window.bdConfig=i,window.Strings=M;class Rt{constructor(e){jt.setConfig(e)}init(){jt.init()}}!function(){const e=s(4),t=e._load;e._load=function(e){return"betterdiscord"!==e&&!e.startsWith("betterdiscord/")||"api"!=e.substr("betterdiscord/".length)?t.apply(this,arguments):zt}}()}]).default; \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 685f4530..9b3fa587 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4278,9 +4278,9 @@ } }, "lodash": { - "version": "4.17.11", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz", - "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==", + "version": "4.17.15", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", + "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==", "dev": true }, "loose-envify": { @@ -4506,9 +4506,9 @@ } }, "mixin-deep": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.3.1.tgz", - "integrity": "sha512-8ZItLHeEgaqEvd5lYBXfm4EZSFCX29Jb9K+lAHhDKzReKBQKj3R+7NOF6tjqYi9t4oI8VUfaWITJQm86wnXGNQ==", + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.3.2.tgz", + "integrity": "sha512-WRoDn//mXBiJ1H40rqa3vH0toePwSsGb45iInWlTySa+Uu4k3tYUSxa2v1KqAiLtvlrSzaExqS1gtk96A9zvEA==", "dev": true, "requires": { "for-in": "^1.0.2", @@ -5581,9 +5581,9 @@ "dev": true }, "set-value": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.0.tgz", - "integrity": "sha512-hw0yxk9GT/Hr5yJEYnHNKYXkIA8mVJgd9ditYZCe16ZczcaELYYcfvaXesNACk2O8O0nTiPQcQhGUQj8JLzeeg==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.1.tgz", + "integrity": "sha512-JxHc1weCN68wRY0fhCoXpyK55m/XPHafOmK4UWD7m2CI14GMcFypt4w/0+NV5f/ZMby2F6S2wwA7fgynh9gWSw==", "dev": true, "requires": { "extend-shallow": "^2.0.1", @@ -6276,38 +6276,15 @@ "dev": true }, "union-value": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/union-value/-/union-value-1.0.0.tgz", - "integrity": "sha1-XHHDTLW61dzr4+oM0IIHulqhrqQ=", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/union-value/-/union-value-1.0.1.tgz", + "integrity": "sha512-tJfXmxMeWYnczCVs7XAEvIV7ieppALdyepWMkHkwciRpZraG/xwT+s2JN8+pr1+8jCRf80FFzvr+MpQeeoF4Xg==", "dev": true, "requires": { "arr-union": "^3.1.0", "get-value": "^2.0.6", "is-extendable": "^0.1.1", - "set-value": "^0.4.3" - }, - "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" - } - }, - "set-value": { - "version": "0.4.3", - "resolved": "https://registry.npmjs.org/set-value/-/set-value-0.4.3.tgz", - "integrity": "sha1-fbCPnT0i3H945Trzw79GZuzfzPE=", - "dev": true, - "requires": { - "extend-shallow": "^2.0.1", - "is-extendable": "^0.1.1", - "is-plain-object": "^2.0.1", - "to-object-path": "^0.3.0" - } - } + "set-value": "^2.0.1" } }, "unique-filename": { diff --git a/src/data/config.js b/src/data/config.js index 30eff2cb..74a83d5c 100644 --- a/src/data/config.js +++ b/src/data/config.js @@ -6,5 +6,5 @@ export default { branch: "master", repo: "rauenzi", minSupportedVersion: "0.3.0", - bbdVersion: "0.2.17" + bbdVersion: "1.0.0" }; \ No newline at end of file diff --git a/src/modules/pluginapi.js b/src/modules/pluginapi.js index 7b7491e8..65e527f9 100644 --- a/src/modules/pluginapi.js +++ b/src/modules/pluginapi.js @@ -5,6 +5,8 @@ import DataStore from "./datastore"; import DOMManager from "./dommanager"; import Toasts from "../ui/toasts"; import Modals from "../ui/modals"; +import PluginManager from "./pluginmanager"; +import ThemeManager from "./thememanager"; const BdApi = { get React() { return DiscordModules.React; }, @@ -158,9 +160,43 @@ BdApi.deleteData = function(pluginName, key) { // Patches other functions BdApi.monkeyPatch = function(what, methodName, options) { - return Utilities.monkeyPatch(what, methodName, options); + const {before, after, instead, once = false, silent = false, force = false} = options; + const displayName = options.displayName || what.displayName || what.name || what.constructor.displayName || what.constructor.name; + if (!silent) console.log("patch", methodName, "of", displayName); // eslint-disable-line no-console + if (!what[methodName]) { + if (force) what[methodName] = function() {}; + else return console.error(methodName, "does not exist for", displayName); // eslint-disable-line no-console + } + const origMethod = what[methodName]; + const cancel = () => { + if (!silent) console.log("unpatch", methodName, "of", displayName); // eslint-disable-line no-console + what[methodName] = origMethod; + }; + what[methodName] = function() { + const data = { + thisObject: this, + methodArguments: arguments, + cancelPatch: cancel, + originalMethod: origMethod, + callOriginalMethod: () => data.returnValue = data.originalMethod.apply(data.thisObject, data.methodArguments) + }; + if (instead) { + const tempRet = Utilities.suppressErrors(instead, "`instead` callback of " + what[methodName].displayName)(data); + if (tempRet !== undefined) data.returnValue = tempRet; + } + else { + if (before) Utilities.suppressErrors(before, "`before` callback of " + what[methodName].displayName)(data); + data.callOriginalMethod(); + if (after) Utilities.suppressErrors(after, "`after` callback of " + what[methodName].displayName)(data); + } + if (once) cancel(); + return data.returnValue; + }; + what[methodName].__monkeyPatched = true; + if (!what[methodName].__originalMethod) what[methodName].__originalMethod = origMethod; + what[methodName].displayName = "patched " + (what[methodName].displayName || methodName); + return cancel; }; - // Event when element is removed BdApi.onRemoved = function(node, callback) { return Utilities.onRemoved(node, callback); @@ -178,24 +214,21 @@ BdApi.testJSON = function(data) { //Get another plugin //name = name of plugin -// BdApi.getPlugin = function (name) { -// if (Plugins.hasOwnProperty(name)) { -// return Plugins[name].plugin; -// } -// return null; -// }; +BdApi.getPlugin = function (name) { + return PluginManager.addonList.find(a => a.name == name); +}; -// BdApi.isPluginEnabled = function(name) { -// return !!PluginCookie[name]; -// }; +BdApi.isPluginEnabled = function(name) { + const plugin = this.getPlugin(name); + if (!plugin) return false; + return PluginManager.isEnabled(plugin.id); +}; -// BdApi.isThemeEnabled = function(name) { -// return !!ThemeCookie[name]; -// }; - -// BdApi.isSettingEnabled = function(id) { -// return !!SettingsCookie[id]; -// }; +BdApi.isThemeEnabled = function(name) { + const theme = ThemeManager.addonList.find(a => a.name == name); + if (!theme) return false; + return ThemeManager.isEnabled(theme.id); +}; // Gets data BdApi.getBDData = function(key) { diff --git a/src/modules/utilities.js b/src/modules/utilities.js index 29b1ae53..25b64255 100644 --- a/src/modules/utilities.js +++ b/src/modules/utilities.js @@ -57,45 +57,6 @@ export default class Utilities { }; } - static monkeyPatch(what, methodName, options) { - const {before, after, instead, once = false, silent = false, force = false} = options; - const displayName = options.displayName || what.displayName || what.name || what.constructor.displayName || what.constructor.name; - if (!silent) console.log("patch", methodName, "of", displayName); // eslint-disable-line no-console - if (!what[methodName]) { - if (force) what[methodName] = function() {}; - else return console.error(methodName, "does not exist for", displayName); // eslint-disable-line no-console - } - const origMethod = what[methodName]; - const cancel = () => { - if (!silent) console.log("unpatch", methodName, "of", displayName); // eslint-disable-line no-console - what[methodName] = origMethod; - }; - what[methodName] = function() { - const data = { - thisObject: this, - methodArguments: arguments, - cancelPatch: cancel, - originalMethod: origMethod, - callOriginalMethod: () => data.returnValue = data.originalMethod.apply(data.thisObject, data.methodArguments) - }; - if (instead) { - const tempRet = Utilities.suppressErrors(instead, "`instead` callback of " + what[methodName].displayName)(data); - if (tempRet !== undefined) data.returnValue = tempRet; - } - else { - if (before) Utilities.suppressErrors(before, "`before` callback of " + what[methodName].displayName)(data); - data.callOriginalMethod(); - if (after) Utilities.suppressErrors(after, "`after` callback of " + what[methodName].displayName)(data); - } - if (once) cancel(); - return data.returnValue; - }; - what[methodName].__monkeyPatched = true; - if (!what[methodName].__originalMethod) what[methodName].__originalMethod = origMethod; - what[methodName].displayName = "patched " + (what[methodName].displayName || methodName); - return cancel; - } - static onRemoved(node, callback) { const observer = new MutationObserver((mutations) => { for (let m = 0; m < mutations.length; m++) { diff --git a/src/structs/psconnection.js b/src/structs/psconnection.js index bdb84e79..d1320ccc 100644 --- a/src/structs/psconnection.js +++ b/src/structs/psconnection.js @@ -18,7 +18,7 @@ export default class PublicServersConnection { } static hasJoined(id) { - return SortedGuildStore.guildPositions.includes(id); + return SortedGuildStore.getFlattenedGuildIds().includes(id); } static search({term = "", category = "", from = 0} = {}) { diff --git a/src/ui/toasts.js b/src/ui/toasts.js index fce24701..447c76c8 100644 --- a/src/ui/toasts.js +++ b/src/ui/toasts.js @@ -1,6 +1,6 @@ import {WebpackModules, Settings} from "modules"; -const channelsClass = WebpackModules.getByProps("channels").channels.split(" ")[0]; +const channelsClass = WebpackModules.getByProps("sidebar", "hasNotice").sidebar.split(" ")[0]; const membersWrapClass = WebpackModules.getByProps("membersWrap").membersWrap.split(" ")[0]; export default class Toasts {