diff --git a/js/main.js b/js/main.js index 2cd8e0af..71e99772 100644 --- a/js/main.js +++ b/js/main.js @@ -359,7 +359,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony default export */ /***/ (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 CoreWrapper; });\n/* harmony import */ var data__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! data */ \"./src/data/data.js\");\n/* harmony import */ var _secure__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./secure */ \"./src/secure.js\");\n/* harmony import */ var _modules_core__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./modules/core */ \"./src/modules/core.js\");\n/* harmony import */ var _modules_pluginapi__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./modules/pluginapi */ \"./src/modules/pluginapi.js\");\n/* harmony import */ var _modules_pluginmanager__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./modules/pluginmanager */ \"./src/modules/pluginmanager.js\");\n/* harmony import */ var _modules_thememanager__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./modules/thememanager */ \"./src/modules/thememanager.js\");\n/* harmony import */ var _modules_emitter__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./modules/emitter */ \"./src/modules/emitter.js\");\n/* harmony import */ var _modules_settingsmanager__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./modules/settingsmanager */ \"./src/modules/settingsmanager.js\");\n/* harmony import */ var _modules_datastore__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./modules/datastore */ \"./src/modules/datastore.js\");\n/* harmony import */ var _builtins_emotes_emotes__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./builtins/emotes/emotes */ \"./src/builtins/emotes/emotes.js\");\n/* harmony import */ var _modules_dommanager__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./modules/dommanager */ \"./src/modules/dommanager.js\");\n/* harmony import */ var _modules_utilities__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./modules/utilities */ \"./src/modules/utilities.js\");\n/* harmony import */ var _modules_reactcomponents__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./modules/reactcomponents */ \"./src/modules/reactcomponents.js\");\n/* harmony import */ var _modules_strings__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./modules/strings */ \"./src/modules/strings.js\");\n\n\n\n\n\n\n\n\n\n\n\n\n\n // Perform some setup\n\nObject(_secure__WEBPACK_IMPORTED_MODULE_1__[\"default\"])();\nconst loadingIcon = document.createElement(\"div\");\nloadingIcon.className = \"bd-loaderv2\";\nloadingIcon.title = \"BandagedBD is loading...\";\ndocument.body.appendChild(loadingIcon); // window.Core = Core;\n\nwindow.BdApi = _modules_pluginapi__WEBPACK_IMPORTED_MODULE_3__[\"default\"]; // window.settings = SettingsInfo;\n// window.settingsCookie = SettingsCookie;\n// window.pluginCookie = PluginCookie;\n// window.themeCookie = ThemeCookie;\n\nwindow.pluginModule = _modules_pluginmanager__WEBPACK_IMPORTED_MODULE_4__[\"default\"];\nwindow.themeModule = _modules_thememanager__WEBPACK_IMPORTED_MODULE_5__[\"default\"]; // window.bdthemes = Themes;\n// window.bdplugins = Plugins;\n\nwindow.bdEmotes = _builtins_emotes_emotes__WEBPACK_IMPORTED_MODULE_9__[\"default\"].Emotes;\nwindow.bemotes = _builtins_emotes_emotes__WEBPACK_IMPORTED_MODULE_9__[\"default\"].blacklist; // window.bdPluginStorage = bdPluginStorage;\n\nwindow.settingsModule = _modules_settingsmanager__WEBPACK_IMPORTED_MODULE_7__[\"default\"];\nwindow.DataStore = _modules_datastore__WEBPACK_IMPORTED_MODULE_8__[\"default\"];\nwindow.DomManager = _modules_dommanager__WEBPACK_IMPORTED_MODULE_10__[\"default\"];\nwindow.utils = _modules_utilities__WEBPACK_IMPORTED_MODULE_11__[\"default\"];\nwindow.Components = _modules_reactcomponents__WEBPACK_IMPORTED_MODULE_12__[\"default\"];\nwindow.BDEvents = _modules_emitter__WEBPACK_IMPORTED_MODULE_6__[\"default\"];\nwindow.bdConfig = data__WEBPACK_IMPORTED_MODULE_0__[\"Config\"];\nwindow.Strings = _modules_strings__WEBPACK_IMPORTED_MODULE_13__[\"default\"];\nclass CoreWrapper {\n constructor(config) {\n _modules_core__WEBPACK_IMPORTED_MODULE_2__[\"default\"].setConfig(config);\n }\n\n init() {\n _modules_core__WEBPACK_IMPORTED_MODULE_2__[\"default\"].init();\n }\n\n}\n\nfunction patchModuleLoad() {\n const namespace = \"betterdiscord\";\n const prefix = `${namespace}/`;\n\n const Module = __webpack_require__(/*! module */ \"module\");\n\n const load = Module._load; // const resolveFilename = Module._resolveFilename;\n\n Module._load = function (request) {\n if (request === namespace || request.startsWith(prefix)) {\n const requested = request.substr(prefix.length);\n if (requested == \"api\") return _modules_pluginapi__WEBPACK_IMPORTED_MODULE_3__[\"default\"];\n }\n\n return load.apply(this, arguments);\n }; // Module._resolveFilename = function (request, parent, isMain) {\n // if (request === \"betterdiscord\" || request.startsWith(\"betterdiscord/\")) {\n // const contentPath = PluginManager.getPluginPathByModule(parent);\n // if (contentPath) return request;\n // }\n // return resolveFilename.apply(this, arguments);\n // };\n\n\n return function () {\n Module._load = load;\n };\n}\n\npatchModuleLoad(); // var settingsPanel, emoteModule, quickEmoteMenu, voiceMode,, dMode, publicServersModule;\n// var bdConfig = null;//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly9Db3JlLy4vc3JjL2luZGV4LmpzP2I2MzUiXSwibmFtZXMiOlsic2VjdXJlIiwibG9hZGluZ0ljb24iLCJkb2N1bWVudCIsImNyZWF0ZUVsZW1lbnQiLCJjbGFzc05hbWUiLCJ0aXRsZSIsImJv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lzY29yZC9cIikpIHtcclxuICAgIC8vICAgICAgICAgY29uc3QgY29udGVudFBhdGggPSBQbHVnaW5NYW5hZ2VyLmdldFBsdWdpblBhdGhCeU1vZHVsZShwYXJlbnQpO1xyXG4gICAgLy8gICAgICAgICBpZiAoY29udGVudFBhdGgpIHJldHVybiByZXF1ZXN0O1xyXG4gICAgLy8gICAgIH1cclxuXHJcbiAgICAvLyAgICAgcmV0dXJuIHJlc29sdmVGaWxlbmFtZS5hcHBseSh0aGlzLCBhcmd1bWVudHMpO1xyXG4gICAgLy8gfTtcclxuXHJcbiAgICByZXR1cm4gZnVuY3Rpb24oKSB7XHJcbiAgICAgICAgTW9kdWxlLl9sb2FkID0gbG9hZDtcclxuICAgIH07XHJcbn1cclxuXHJcbnBhdGNoTW9kdWxlTG9hZCgpO1xyXG5cclxuLy8gdmFyIHNldHRpbmdzUGFuZWwsIGVtb3RlTW9kdWxlLCBxdWlja0Vtb3RlTWVudSwgdm9pY2VNb2RlLCwgZE1vZGUsIHB1YmxpY1NlcnZlcnNNb2R1bGU7XHJcbi8vIHZhciBiZENvbmZpZyA9IG51bGw7Il0sInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///./src/index.js\n"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"default\", function() { return CoreWrapper; });\n/* harmony import */ var _secure__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./secure */ \"./src/secure.js\");\n/* harmony import */ var _modules_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./modules/core */ \"./src/modules/core.js\");\n/* harmony import */ var _modules_pluginapi__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./modules/pluginapi */ \"./src/modules/pluginapi.js\");\n// import {Config} from \"data\";\n\n\n // import PluginManager from \"./modules/pluginmanager\";\n// import ThemeManager from \"./modules/thememanager\";\n// import Events from \"./modules/emitter\";\n// import Settings from \"./modules/settingsmanager\";\n// import DataStore from \"./modules/datastore\";\n// import EmoteModule from \"./builtins/emotes/emotes\";\n// import DomManager from \"./modules/dommanager\";\n// import Utilities from \"./modules/utilities\";\n// import ReactComponents from \"./modules/reactcomponents\";\n// import Strings from \"./modules/strings\";\n// Perform some setup\n\nObject(_secure__WEBPACK_IMPORTED_MODULE_0__[\"default\"])();\nconst loadingIcon = document.createElement(\"div\");\nloadingIcon.className = \"bd-loaderv2\";\nloadingIcon.title = \"BandagedBD is loading...\";\ndocument.body.appendChild(loadingIcon); // window.Core = Core;\n\nwindow.BdApi = _modules_pluginapi__WEBPACK_IMPORTED_MODULE_2__[\"default\"]; // window.settings = SettingsInfo;\n// window.settingsCookie = SettingsCookie;\n// window.pluginCookie = PluginCookie;\n// window.themeCookie = ThemeCookie;\n// window.pluginModule = PluginManager;\n// window.themeModule = ThemeManager;\n// // window.bdthemes = Themes;\n// // window.bdplugins = Plugins;\n// window.bdEmotes = EmoteModule.Emotes;\n// window.bemotes = EmoteModule.blacklist;\n// // window.bdPluginStorage = bdPluginStorage;\n// window.settingsModule = Settings;\n// window.DataStore = DataStore;\n// window.DomManager = DomManager;\n// window.utils = Utilities;\n// window.Components = ReactComponents;\n// window.BDEvents = Events;\n// window.bdConfig = Config;\n// window.Strings = Strings;\n\nclass CoreWrapper {\n constructor(config) {\n _modules_core__WEBPACK_IMPORTED_MODULE_1__[\"default\"].setConfig(config);\n }\n\n init() {\n _modules_core__WEBPACK_IMPORTED_MODULE_1__[\"default\"].init();\n }\n\n}\n\nfunction patchModuleLoad() {\n const namespace = \"betterdiscord\";\n const prefix = `${namespace}/`;\n\n const Module = __webpack_require__(/*! module */ \"module\");\n\n const load = Module._load; // const resolveFilename = Module._resolveFilename;\n\n Module._load = function (request) {\n if (request === namespace || request.startsWith(prefix)) {\n const requested = request.substr(prefix.length);\n if (requested == \"api\") return _modules_pluginapi__WEBPACK_IMPORTED_MODULE_2__[\"default\"];\n }\n\n return load.apply(this, arguments);\n }; // Module._resolveFilename = function (request, parent, isMain) {\n // if (request === \"betterdiscord\" || request.startsWith(\"betterdiscord/\")) {\n // const contentPath = PluginManager.getPluginPathByModule(parent);\n // if (contentPath) return request;\n // }\n // return resolveFilename.apply(this, arguments);\n // };\n\n\n return function () {\n Module._load = load;\n };\n}\n\npatchModuleLoad(); // var settingsPanel, emoteModule, quickEmoteMenu, voiceMode,, dMode, publicServersModule;\n// var bdConfig = null;//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly9Db3JlLy4vc3JjL2luZGV4LmpzP2I2MzUiXSwibmFtZXMiOlsic2VjdXJlIiwibG9hZGluZ0ljb24iLCJkb2N1bWVudCIsImNyZWF0ZUVsZW1lbnQiLCJjbGFzc05hbWUiLCJ0aXRsZSIsImJvZHkiLCJhcHBlbmRDaGlsZCIsIndpbmRvdyIsIkJkQXBpIiwiQ29yZVdyYXBwZXIiLCJjb25zdHJ1Y3RvciIsImNvbmZpZyIsIkNvcmUiLCJzZXRDb25maWciLCJpbml0IiwicGF0Y2hNb2R1bGVMb2FkIiwibmFtZXNwYWNlIiwicHJlZml4IiwiTW9kdWxlIiwicmVxdWlyZSIsImxvYWQiLCJfbG9hZCIsInJlcXVlc3QiLCJzdGFydHNXaXRoIiwicmVxdWVzdGVkIiwic3Vic3RyIiwibGVuZ3RoIiwiYXBwbHkiLCJhcmd1bWVudHMiXSwibWFwcGluZ3MiOiJBQUFBO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUNBO0FBQ0E7Q0FFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUVBOztBQUNBQSx1REFBTTtBQUVOLE1BQU1DLFdBQVcsR0FBR0MsUUFBUSxDQUFDQyxhQUFULENBQXVCLEtBQXZCLENBQXBCO0FBQ0FGLFdBQVcsQ0FBQ0csU0FBWixH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cbn1cclxuXHJcbnBhdGNoTW9kdWxlTG9hZCgpO1xyXG5cclxuLy8gdmFyIHNldHRpbmdzUGFuZWwsIGVtb3RlTW9kdWxlLCBxdWlja0Vtb3RlTWVudSwgdm9pY2VNb2RlLCwgZE1vZGUsIHB1YmxpY1NlcnZlcnNNb2R1bGU7XHJcbi8vIHZhciBiZENvbmZpZyA9IG51bGw7Il0sInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///./src/index.js\n"); /***/ }), @@ -527,7 +527,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 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/* harmony import */ var _addonmanager__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./addonmanager */ \"./src/modules/addonmanager.js\");\n/* harmony import */ var _utilities__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./utilities */ \"./src/modules/utilities.js\");\n/* harmony import */ var _structs_addonerror__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../structs/addonerror */ \"./src/structs/addonerror.js\");\n/* harmony import */ var _settingsmanager__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./settingsmanager */ \"./src/modules/settingsmanager.js\");\n/* harmony import */ var _strings__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./strings */ \"./src/modules/strings.js\");\n/* harmony import */ var _ui_toasts__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../ui/toasts */ \"./src/ui/toasts.js\");\n/* harmony import */ var _ui_modals__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../ui/modals */ \"./src/ui/modals.js\");\n/* harmony import */ var _ui_settings__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../ui/settings */ \"./src/ui/settings.js\");\n\n\n\n\n\n\n\n\n\n\n\nconst path = __webpack_require__(/*! path */ \"path\");\n\nconst electronRemote = __webpack_require__(/*! electron */ \"electron\").remote;\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (new class PluginManager extends _addonmanager__WEBPACK_IMPORTED_MODULE_2__[\"default\"] {\n get name() {\n return \"PluginManager\";\n }\n\n get moduleExtension() {\n return \".js\";\n }\n\n get extension() {\n return \".plugin.js\";\n }\n\n get addonFolder() {\n return path.resolve(data__WEBPACK_IMPORTED_MODULE_0__[\"Config\"].dataPath, \"plugins\");\n }\n\n get prefix() {\n return \"plugin\";\n }\n\n get language() {\n return \"javascript\";\n }\n\n constructor() {\n super();\n this.onSwitch = this.onSwitch.bind(this);\n this.observer = new MutationObserver(mutations => {\n for (let i = 0, mlen = mutations.length; i < mlen; i++) {\n this.onMutation(mutations[i]);\n }\n });\n }\n\n initialize() {\n const errors = super.initialize();\n this.setupFunctions();\n _settingsmanager__WEBPACK_IMPORTED_MODULE_5__[\"default\"].registerPanel(\"plugins\", _strings__WEBPACK_IMPORTED_MODULE_6__[\"default\"].Panels.plugins, {\n element: () => _ui_settings__WEBPACK_IMPORTED_MODULE_9__[\"default\"].getAddonPanel(_strings__WEBPACK_IMPORTED_MODULE_6__[\"default\"].Panels.plugins, this.addonList, this.state, {\n folder: this.addonFolder,\n onChange: this.togglePlugin.bind(this),\n reload: this.reloadPlugin.bind(this),\n refreshList: this.updatePluginList.bind(this),\n saveAddon: this.saveAddon.bind(this),\n editAddon: this.editAddon.bind(this),\n deleteAddon: this.deleteAddon.bind(this),\n prefix: this.prefix\n })\n });\n return errors;\n }\n /* Aliases */\n\n\n updatePluginList() {\n return this.updateList();\n }\n\n loadAllPlugins() {\n return this.loadAllAddons();\n }\n\n enablePlugin(idOrAddon) {\n return this.enableAddon(idOrAddon);\n }\n\n disablePlugin(idOrAddon) {\n return this.disableAddon(idOrAddon);\n }\n\n togglePlugin(id) {\n return this.toggleAddon(id);\n }\n\n unloadPlugin(idOrFileOrAddon) {\n return this.unloadAddon(idOrFileOrAddon);\n }\n\n loadPlugin(filename) {\n const error = this.loadAddon(filename);\n if (error) _ui_modals__WEBPACK_IMPORTED_MODULE_8__[\"default\"].showAddonErrors({\n themes: [error]\n });\n }\n\n reloadPlugin(idOrFileOrAddon) {\n const error = this.reloadAddon(idOrFileOrAddon);\n if (error) _ui_modals__WEBPACK_IMPORTED_MODULE_8__[\"default\"].showAddonErrors({\n plugins: [error]\n });\n return typeof idOrFileOrAddon == \"string\" ? this.addonList.find(c => c.id == idOrFileOrAddon || c.filename == idOrFileOrAddon) : idOrFileOrAddon;\n }\n /* Overrides */\n\n\n initializeAddon(addon) {\n if (!addon.type) return new _structs_addonerror__WEBPACK_IMPORTED_MODULE_4__[\"default\"](addon.name, addon.filename, \"Plugin had no exports\", {\n message: \"Plugin had no exports or no name property.\",\n stack: \"\"\n });\n\n try {\n const thePlugin = new addon.type();\n addon.plugin = thePlugin;\n addon.name = thePlugin.getName() || addon.name;\n addon.author = thePlugin.getAuthor() || addon.author || \"No author\";\n addon.description = thePlugin.getDescription() || addon.description || \"No description\";\n addon.version = thePlugin.getVersion() || addon.version || \"No version\";\n\n try {\n if (typeof addon.plugin.load == \"function\") addon.plugin.load();\n } catch (error) {\n this.state[addon.id] = false;\n return new _structs_addonerror__WEBPACK_IMPORTED_MODULE_4__[\"default\"](addon.name, addon.filename, \"load() could not be fired.\", {\n message: error.message,\n stack: error.stack\n });\n }\n } catch (error) {\n return new _structs_addonerror__WEBPACK_IMPORTED_MODULE_4__[\"default\"](addon.name, addon.filename, \"Could not be constructed.\", {\n message: error.message,\n stack: error.stack\n });\n }\n }\n\n getFileModification(module, fileContent, meta) {\n module._compile(fileContent, module.filename);\n\n const didExport = !_utilities__WEBPACK_IMPORTED_MODULE_3__[\"default\"].isEmpty(module.exports);\n\n if (didExport) {\n meta.type = module.exports;\n module.exports = meta;\n return \"\";\n }\n\n fileContent += `\\nmodule.exports = ${JSON.stringify(meta)};\\nmodule.exports.type = ${meta.exports || meta.name};`;\n return fileContent;\n }\n\n startAddon(id) {\n return this.startPlugin(id);\n }\n\n stopAddon(id) {\n return this.stopPlugin(id);\n }\n\n startPlugin(idOrAddon) {\n const addon = typeof idOrAddon == \"string\" ? this.addonList.find(p => p.id == idOrAddon) : idOrAddon;\n if (!addon) return;\n const plugin = addon.plugin;\n\n try {\n plugin.start();\n this.emit(\"started\", addon.id);\n _ui_toasts__WEBPACK_IMPORTED_MODULE_7__[\"default\"].show(`${addon.name} v${addon.version} has started.`);\n } catch (err) {\n this.state[addon.id] = false;\n _ui_toasts__WEBPACK_IMPORTED_MODULE_7__[\"default\"].error(`${addon.name} v${addon.version} could not be started.`);\n _logger__WEBPACK_IMPORTED_MODULE_1__[\"default\"].stacktrace(this.name, addon.name + \" could not be started.\", err);\n return new _structs_addonerror__WEBPACK_IMPORTED_MODULE_4__[\"default\"](addon.name, addon.filename, \"start() could not be fired.\", {\n message: err.message,\n stack: err.stack\n });\n }\n }\n\n stopPlugin(idOrAddon) {\n const addon = typeof idOrAddon == \"string\" ? this.addonList.find(p => p.id == idOrAddon) : idOrAddon;\n if (!addon) return;\n const plugin = addon.plugin;\n\n try {\n plugin.stop();\n this.emit(\"stopped\", addon.id);\n _ui_toasts__WEBPACK_IMPORTED_MODULE_7__[\"default\"].show(`${addon.name} v${addon.version} has stopped.`);\n } catch (err) {\n this.state[addon.id] = false;\n _ui_toasts__WEBPACK_IMPORTED_MODULE_7__[\"default\"].error(`${addon.name} v${addon.version} could not be stopped.`);\n _logger__WEBPACK_IMPORTED_MODULE_1__[\"default\"].stacktrace(this.name, addon.name + \" could not be stopped.\", err);\n return new _structs_addonerror__WEBPACK_IMPORTED_MODULE_4__[\"default\"](addon.name, addon.filename, \"stop() could not be fired.\", {\n message: err.message,\n stack: err.stack\n });\n }\n }\n\n setupFunctions() {\n electronRemote.getCurrentWebContents().on(\"did-navigate-in-page\", this.onSwitch.bind(this));\n this.observer.observe(document, {\n childList: true,\n subtree: true\n });\n }\n\n onSwitch() {\n this.emit(\"page-switch\");\n\n for (let i = 0; i < this.addonList.length; i++) {\n const plugin = this.addonList[i].plugin;\n if (!this.state[this.addonList[i].id]) continue;\n\n if (typeof plugin.onSwitch === \"function\") {\n try {\n plugin.onSwitch();\n } catch (err) {\n _logger__WEBPACK_IMPORTED_MODULE_1__[\"default\"].stacktrace(this.name, \"Unable to fire onSwitch for \" + this.addonList[i].name + \".\", err);\n }\n }\n }\n }\n\n onMutation(mutation) {\n for (let i = 0; i < this.addonList.length; i++) {\n const plugin = this.addonList[i].plugin;\n if (!this.state[this.addonList[i].id]) continue;\n\n if (typeof plugin.observer === \"function\") {\n try {\n plugin.observer(mutation);\n } catch (err) {\n _logger__WEBPACK_IMPORTED_MODULE_1__[\"default\"].stacktrace(this.name, \"Unable to fire observer for \" + this.addonList[i].name + \".\", err);\n }\n }\n }\n }\n\n}());//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly9Db3JlLy4vc3JjL21vZHVsZXMvcGx1Z2lubWFuYWdlci5qcz9kMTczIl0sIm5hbWVzIjpbInBhdGgiLCJyZXF1aXJlIiwiZWxlY3Ryb25SZW1vdGUiLCJyZW1vdGUiLCJQbHVnaW5NYW5hZ2VyIiwiQWRkb25NYW5hZ2VyIiwibmFtZSIsIm1vZHVsZUV4dGVuc2lvbiIsImV4dGVuc2lvbiIsImFkZG9uRm9sZGVyIiwicmVzb2x2ZSIsIkNvbmZpZyIsImRhdGFQYXRoIiwicHJlZml4IiwibGFuZ3VhZ2UiLCJjb25zdHJ1Y3RvciIsIm9uU3dpdGNoIiwiYmluZCIsIm9ic2VydmVyIiwiTXV0YXRpb25PYnNlcnZlciIsIm11dGF0aW9ucyIsImkiLCJt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GUgdG8gZmlyZSBvYnNlcnZlciBmb3IgXCIgKyB0aGlzLmFkZG9uTGlzdFtpXS5uYW1lICsgXCIuXCIsIGVycik7IH1cclxuICAgICAgICAgICAgfVxyXG4gICAgICAgIH1cclxuICAgIH1cclxufTsiXSwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///./src/modules/pluginmanager.js\n"); +eval("__webpack_require__.r(__webpack_exports__);\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/* harmony import */ var _addonmanager__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./addonmanager */ \"./src/modules/addonmanager.js\");\n/* harmony import */ var _utilities__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./utilities */ \"./src/modules/utilities.js\");\n/* harmony import */ var _structs_addonerror__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../structs/addonerror */ \"./src/structs/addonerror.js\");\n/* harmony import */ var _settingsmanager__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./settingsmanager */ \"./src/modules/settingsmanager.js\");\n/* harmony import */ var _strings__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./strings */ \"./src/modules/strings.js\");\n/* harmony import */ var _ui_toasts__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../ui/toasts */ \"./src/ui/toasts.js\");\n/* harmony import */ var _ui_modals__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../ui/modals */ \"./src/ui/modals.js\");\n/* harmony import */ var _ui_settings__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../ui/settings */ \"./src/ui/settings.js\");\n\n\n\n\n\n\n\n\n\n\n\nconst path = __webpack_require__(/*! path */ \"path\");\n\nconst electronRemote = __webpack_require__(/*! electron */ \"electron\").remote;\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (new class PluginManager extends _addonmanager__WEBPACK_IMPORTED_MODULE_2__[\"default\"] {\n get name() {\n return \"PluginManager\";\n }\n\n get moduleExtension() {\n return \".js\";\n }\n\n get extension() {\n return \".plugin.js\";\n }\n\n get addonFolder() {\n return path.resolve(data__WEBPACK_IMPORTED_MODULE_0__[\"Config\"].dataPath, \"plugins\");\n }\n\n get prefix() {\n return \"plugin\";\n }\n\n get language() {\n return \"javascript\";\n }\n\n constructor() {\n super();\n this.onSwitch = this.onSwitch.bind(this);\n this.observer = new MutationObserver(mutations => {\n for (let i = 0, mlen = mutations.length; i < mlen; i++) {\n this.onMutation(mutations[i]);\n }\n });\n }\n\n initialize() {\n const errors = super.initialize();\n this.setupFunctions();\n _settingsmanager__WEBPACK_IMPORTED_MODULE_5__[\"default\"].registerPanel(\"plugins\", _strings__WEBPACK_IMPORTED_MODULE_6__[\"default\"].Panels.plugins, {\n element: () => _ui_settings__WEBPACK_IMPORTED_MODULE_9__[\"default\"].getAddonPanel(_strings__WEBPACK_IMPORTED_MODULE_6__[\"default\"].Panels.plugins, this.addonList, this.state, {\n folder: this.addonFolder,\n onChange: this.togglePlugin.bind(this),\n reload: this.reloadPlugin.bind(this),\n refreshList: this.updatePluginList.bind(this),\n saveAddon: this.saveAddon.bind(this),\n editAddon: this.editAddon.bind(this),\n deleteAddon: this.deleteAddon.bind(this),\n prefix: this.prefix\n })\n });\n return errors;\n }\n /* Aliases */\n\n\n updatePluginList() {\n return this.updateList();\n }\n\n loadAllPlugins() {\n return this.loadAllAddons();\n }\n\n enablePlugin(idOrAddon) {\n return this.enableAddon(idOrAddon);\n }\n\n disablePlugin(idOrAddon) {\n return this.disableAddon(idOrAddon);\n }\n\n togglePlugin(id) {\n return this.toggleAddon(id);\n }\n\n unloadPlugin(idOrFileOrAddon) {\n return this.unloadAddon(idOrFileOrAddon);\n }\n\n loadPlugin(filename) {\n const error = this.loadAddon(filename);\n if (error) _ui_modals__WEBPACK_IMPORTED_MODULE_8__[\"default\"].showAddonErrors({\n themes: [error]\n });\n }\n\n reloadPlugin(idOrFileOrAddon) {\n const error = this.reloadAddon(idOrFileOrAddon);\n if (error) _ui_modals__WEBPACK_IMPORTED_MODULE_8__[\"default\"].showAddonErrors({\n plugins: [error]\n });\n return typeof idOrFileOrAddon == \"string\" ? this.addonList.find(c => c.id == idOrFileOrAddon || c.filename == idOrFileOrAddon) : idOrFileOrAddon;\n }\n /* Overrides */\n\n\n initializeAddon(addon) {\n if (!addon.type) return new _structs_addonerror__WEBPACK_IMPORTED_MODULE_4__[\"default\"](addon.name, addon.filename, \"Plugin had no exports\", {\n message: \"Plugin had no exports or no name property.\",\n stack: \"\"\n });\n\n try {\n const thePlugin = new addon.type();\n addon.plugin = thePlugin;\n addon.name = thePlugin.getName() || addon.name;\n addon.author = thePlugin.getAuthor() || addon.author || \"No author\";\n addon.description = thePlugin.getDescription() || addon.description || \"No description\";\n addon.version = thePlugin.getVersion() || addon.version || \"No version\";\n\n try {\n if (typeof addon.plugin.load == \"function\") addon.plugin.load();\n } catch (error) {\n this.state[addon.id] = false;\n return new _structs_addonerror__WEBPACK_IMPORTED_MODULE_4__[\"default\"](addon.name, addon.filename, \"load() could not be fired.\", {\n message: error.message,\n stack: error.stack\n });\n }\n } catch (error) {\n return new _structs_addonerror__WEBPACK_IMPORTED_MODULE_4__[\"default\"](addon.name, addon.filename, \"Could not be constructed.\", {\n message: error.message,\n stack: error.stack\n });\n }\n }\n\n getFileModification(module, fileContent, meta) {\n module._compile(fileContent, module.filename);\n\n const didExport = !_utilities__WEBPACK_IMPORTED_MODULE_3__[\"default\"].isEmpty(module.exports);\n\n if (didExport) {\n meta.type = module.exports;\n module.exports = meta;\n return \"\";\n }\n\n _logger__WEBPACK_IMPORTED_MODULE_1__[\"default\"].warn(this.name, `${meta.name}, please start assigning module.exports`);\n fileContent += `\\nmodule.exports = ${JSON.stringify(meta)};\\nmodule.exports.type = ${meta.exports || meta.name};`;\n return fileContent;\n }\n\n startAddon(id) {\n return this.startPlugin(id);\n }\n\n stopAddon(id) {\n return this.stopPlugin(id);\n }\n\n startPlugin(idOrAddon) {\n const addon = typeof idOrAddon == \"string\" ? this.addonList.find(p => p.id == idOrAddon) : idOrAddon;\n if (!addon) return;\n const plugin = addon.plugin;\n\n try {\n plugin.start();\n this.emit(\"started\", addon.id);\n _ui_toasts__WEBPACK_IMPORTED_MODULE_7__[\"default\"].show(`${addon.name} v${addon.version} has started.`);\n } catch (err) {\n this.state[addon.id] = false;\n _ui_toasts__WEBPACK_IMPORTED_MODULE_7__[\"default\"].error(`${addon.name} v${addon.version} could not be started.`);\n _logger__WEBPACK_IMPORTED_MODULE_1__[\"default\"].stacktrace(this.name, addon.name + \" could not be started.\", err);\n return new _structs_addonerror__WEBPACK_IMPORTED_MODULE_4__[\"default\"](addon.name, addon.filename, \"start() could not be fired.\", {\n message: err.message,\n stack: err.stack\n });\n }\n }\n\n stopPlugin(idOrAddon) {\n const addon = typeof idOrAddon == \"string\" ? this.addonList.find(p => p.id == idOrAddon) : idOrAddon;\n if (!addon) return;\n const plugin = addon.plugin;\n\n try {\n plugin.stop();\n this.emit(\"stopped\", addon.id);\n _ui_toasts__WEBPACK_IMPORTED_MODULE_7__[\"default\"].show(`${addon.name} v${addon.version} has stopped.`);\n } catch (err) {\n this.state[addon.id] = false;\n _ui_toasts__WEBPACK_IMPORTED_MODULE_7__[\"default\"].error(`${addon.name} v${addon.version} could not be stopped.`);\n _logger__WEBPACK_IMPORTED_MODULE_1__[\"default\"].stacktrace(this.name, addon.name + \" could not be stopped.\", err);\n return new _structs_addonerror__WEBPACK_IMPORTED_MODULE_4__[\"default\"](addon.name, addon.filename, \"stop() could not be fired.\", {\n message: err.message,\n stack: err.stack\n });\n }\n }\n\n setupFunctions() {\n electronRemote.getCurrentWebContents().on(\"did-navigate-in-page\", this.onSwitch.bind(this));\n this.observer.observe(document, {\n childList: true,\n subtree: true\n });\n }\n\n onSwitch() {\n this.emit(\"page-switch\");\n\n for (let i = 0; i < this.addonList.length; i++) {\n const plugin = this.addonList[i].plugin;\n if (!this.state[this.addonList[i].id]) continue;\n\n if (typeof plugin.onSwitch === \"function\") {\n try {\n plugin.onSwitch();\n } catch (err) {\n _logger__WEBPACK_IMPORTED_MODULE_1__[\"default\"].stacktrace(this.name, \"Unable to fire onSwitch for \" + this.addonList[i].name + \".\", err);\n }\n }\n }\n }\n\n onMutation(mutation) {\n for (let i = 0; i < this.addonList.length; i++) {\n const plugin = this.addonList[i].plugin;\n if (!this.state[this.addonList[i].id]) continue;\n\n if (typeof plugin.observer === \"function\") {\n try {\n plugin.observer(mutation);\n } catch (err) {\n _logger__WEBPACK_IMPORTED_MODULE_1__[\"default\"].stacktrace(this.name, \"Unable to fire observer for \" + this.addonList[i].name + \".\", err);\n }\n }\n }\n }\n\n}());//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly9Db3JlLy4vc3JjL21vZHVsZXMvcGx1Z2lubWFuYWdlci5qcz9kMTczIl0sIm5hbWVzIjpbInBhdGgiLCJyZXF1aXJlIiwiZWxlY3Ryb25SZW1vdGUiLCJyZW1vdGUiLCJQbHVnaW5NYW5hZ2VyIiwiQWRkb25NYW5hZ2VyIiwibmFtZSIsIm1vZHVsZUV4dGVuc2lvbiIsImV4dGVuc2lvbiIsImFkZG9uRm9sZGVyIiwicmVzb2x2ZSIsIkNvbmZpZyIsImRhdGFQYXRoIiwicHJlZml4IiwibGFuZ3VhZ2UiLCJjb25zdHJ1Y3RvciIsIm9uU3dpdGNoIiwiYmluZCIsIm9ic2VydmVyIiwiTXV0YXRpb25PYnNlcnZlciIsIm11dGF0aW9ucyIsImkiLCJtbGVuIiwibGVuZ3RoIiwib25NdXRhdGlvbiIsImluaXRpYWxpemUiLCJlcnJvcnMiLCJzZXR1cEZ1bmN0aW9ucyIsIlN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cclxuICAgICAgICBtb2R1bGUuX2NvbXBpbGUoZmlsZUNvbnRlbnQsIG1vZHVsZS5maWxlbmFtZSk7XHJcbiAgICAgICAgY29uc3QgZGlkRXhwb3J0ID0gIVV0aWxpdGllcy5pc0VtcHR5KG1vZHVsZS5leHBvcnRzKTtcclxuICAgICAgICBpZiAoZGlkRXhwb3J0KSB7XHJcbiAgICAgICAgICAgIG1ldGEudHlwZSA9IG1vZHVsZS5leHBvcnRzO1xyXG4gICAgICAgICAgICBtb2R1bGUuZXhwb3J0cyA9IG1ldGE7XHJcbiAgICAgICAgICAgIHJldHVybiBcIlwiO1xyXG4gICAgICAgIH1cclxuICAgICAgICBMb2dnZXIud2Fybih0aGlzLm5hbWUsIGAke21ldGEubmFtZX0sIHBsZWFzZSBzdGFydCBhc3NpZ25pbmcgbW9kdWxlLmV4cG9ydHNgKTtcclxuICAgICAgICBmaWxlQ29udGVudCArPSBgXFxubW9kdWxlLmV4cG9ydHMgPSAke0pTT04uc3RyaW5naWZ5KG1ldGEpfTtcXG5tb2R1bGUuZXhwb3J0cy50eXBlID0gJHttZXRhLmV4cG9ydHMgfHwgbWV0YS5uYW1lfTtgO1xyXG4gICAgICAgIHJldHVybiBmaWxlQ29udGVudDtcclxuICAgIH1cclxuXHJcbiAgICBzdGFydEFkZG9uKGlkKSB7cmV0dXJuIHRoaXMuc3RhcnRQbHVnaW4oaWQpO31cclxuICAgIHN0b3BBZGRvbihpZCkge3JldHVybiB0aGlzLnN0b3BQbHVnaW4oaWQpO31cclxuXHJcbiAgICBzdGFydFBsdWdpbihpZE9yQWRkb24pIHtcclxuICAgICAgICBjb25zdCBhZGRvbiA9IHR5cGVvZihpZE9yQWRkb24pID09IFwic3RyaW5nXCIgPyB0aGlzLmFkZG9uTGlzdC5maW5kKHAgPT4gcC5pZCA9PSBpZE9yQWRkb24pIDogaWRPckFkZG9uO1xyXG4gICAgICAgIGlmICghYWRkb24pIHJldHVybjtcclxuICAgICAgICBjb25zdCBwbHVnaW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HJcbiAgICAgICAgICAgICAgICB0cnkgeyBwbHVnaW4ub2JzZXJ2ZXIobXV0YXRpb24pOyB9XHJcbiAgICAgICAgICAgICAgICBjYXRjaCAoZXJyKSB7IExvZ2dlci5zdGFja3RyYWNlKHRoaXMubmFtZSwgXCJVbmFibGUgdG8gZmlyZSBvYnNlcnZlciBmb3IgXCIgKyB0aGlzLmFkZG9uTGlzdFtpXS5uYW1lICsgXCIuXCIsIGVycik7IH1cclxuICAgICAgICAgICAgfVxyXG4gICAgICAgIH1cclxuICAgIH1cclxufTsiXSwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///./src/modules/pluginmanager.js\n"); /***/ }), diff --git a/js/main.min.js b/js/main.min.js index 7c5dd782..db2c8dcf 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=9)}([function(e,t){e.exports=require("electron")},function(e,t){e.exports=require("path")},function(e,t){e.exports=require("fs")},function(e,t){e.exports=require("request")},function(e,t){e.exports=require("module")},function(e,t){e.exports=require("events")},function(e,t){e.exports=require("rimraf")},function(e,t){e.exports=require("yauzl")},function(e,t){e.exports=require("mkdirp")},function(e,t,s){"use strict";s.r(t);var n={};s.r(n),s.d(n,"CustomCSS",(function(){return at})),s.d(n,"WindowPrefs",(function(){return lt})),s.d(n,"TwentyFourHour",(function(){return dt})),s.d(n,"ClassNormalizer",(function(){return ht})),s.d(n,"PublicServers",(function(){return Ct})),s.d(n,"VoiceDisconnect",(function(){return St})),s.d(n,"ColoredText",(function(){return Pt})),s.d(n,"DarkMode",(function(){return xt})),s.d(n,"MinimalMode",(function(){return kt})),s.d(n,"VoiceMode",(function(){return At})),s.d(n,"EmoteModule",(function(){return Ot})),s.d(n,"EmoteMenu",(function(){return zt})),s.d(n,"CopySelector",(function(){return Rt})),s.d(n,"Debugger",(function(){return $t})),s.d(n,"ReactDevTools",(function(){return Gt}));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:"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:"debuggerHotkey",value:!1},{type:"switch",id:"copySelector",value:!1},{type:"switch",id:"reactDevTools",value:!1}]},{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",debuggerHotkey:{name:"Debugger Hotkey",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'},reactDevTools:{name:"React Developer Tools",note:"Injects your local installation of React Developer Tools into Discord"}},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",invite:"Support Server",donate:"Donate",patreon:"Patreon",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",restartRequired:"Restart Required",restartNow:"Restart Now",restartLater:"Restart Later",additionalInfo:"Additional Info"},Sorting:{sortBy:"Sort By",order:"Order",ascending:"Ascending",descending:"Descending"},WindowPrefs:{enabledInfo:"This option requires a transparent theme in order to work properly. On Windows this may break your aero snapping and maximizing.\n\nIn order to take effect, Discord needs to be restarted. Do you want to restart now?",disabledInfo:"In order to take effect, Discord needs to be restarted. Do you want to restart now?"},Startup:{notSupported:"Not Supported",versionMismatch:"BandagedBD Injector v{{injector}} is not supported by the latest remote (v{{remote}}).\n\nPlease download the latest version from [GitHub](https://github.com/rauenzi/BetterDiscordApp/releases/latest)",incompatibleApp:"BandagedBD does not work with {{app}}. Please uninstall one of them.",updateNow:"Update Now",maybeLater:"Maybe Later",updateAvailable:"Update Available",updateInfo:"There is an update available for BandagedBD's Injector ({{version}}).\n\nYou can either update and restart now, or later.",updateFailed:"Could Not Update",manualUpdate:"Unable to update automatically, please download the installer and reinstall normally.\n\n[Download Installer](https://github.com/rauenzi/BetterDiscordApp/releases/latest)"}},l={description:"Don't be shocked, this modal is supposed to be here.",changes:[{title:"What's New?",items:["**BandagedBD will now keep you updated with changelogs!** I will try to only show a changelog when there's more than a tiny or internal change.","**Twitter (@BandagedBD)** I created a Twitter to try and provide support and such for those without access to the server. https://Twitter.com/BandagedBD"]},{title:"Fixes",type:"fixed",items:["**Colored Text** option should work again.","**Emotes** should show up in chat.","Fixed a bug where BBD attempted to patch the TabBar module incorrectly. (Thanks, DevilBro)"]},{title:"Minor Stuff",type:"improved",items:["**Colour->Color.** Swapped to using English-US spelling by default to be consistent, and to potentially be prepared for localization.","**Versions simplified.** The BandagedBD version now integrates into Discord's at the bottom-left of settings instead of randomly being a part of the setting list."]}]};const d={err:"error",error:"error",dbg:"debug",debug:"debug",log:"log",warn:"warn",info:"info"};class c{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){c._log(e,t,"error")}static warn(e,...t){c._log(e,t,"warn")}static info(e,...t){c._log(e,t,"info")}static debug(e,...t){c._log(e,t,"debug")}static log(e,...t){c._log(e,t)}static _log(e,t,s="log"){s=c.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 d.hasOwnProperty(e)?d[e]:"log"}}class h{static escapeID(e){return e.replace(/^[^a-z]+|[^\w-]+/gi,"-")}static addStyle(e,t){document.head.append(h.createElement(``))}static removeStyle(e){const t=document.getElementById(e);t&&t.remove()}static addScript(e,t){return new Promise(s=>{const n=document.createElement("script");n.id=e,n.src=t,n.type="text/javascript",n.onload=s,document.head.append(n)})}static removeScript(e){e=this.escapeID(e);const t=document.getElementById(e);t&&t.remove()}static animate({timing:e=(e=>e),update:t,duration:s}){const n=performance.now();requestAnimationFrame((function i(o){let r=(o-n)/s;r>1&&(r=1);const a=e(r);t(a),r<1&&requestAnimationFrame(i)}))}static Q(e){const t=this.parseHTML(e);return(t instanceof NodeList?Array.from(t).some(e=>1===e.nodeType):1===t.nodeType)?t:this.query(e)}static query(e,t){return t||(t=document),t.querySelector(e)}static queryAll(e,t){return t||(t=document),t.querySelectorAll(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 createElement(e,t=!1){return this.parseHTML(e,t)}static escapeHTML(e){const t=document.createTextNode(""),s=document.createElement("span");return s.append(t),t.nodeValue=e,s.innerHTML}static addClass(e,...t){t=t.flat().filter(e=>e);for(let e=0;ee),e.classList.add(...t),e}static removeClass(e,...t){for(let e=0;ee),e.classList.remove(...t),e}static toggleClass(e,t,s){return t=t.toString().split(" ").filter(e=>e),void 0!==s?t.forEach(t=>e.classList.toggle(t,s)):t.forEach(t=>e.classList.toggle(t)),e}static hasClass(e,t){return t.toString().split(" ").filter(e=>e).every(t=>e.classList.contains(t))}static replaceClass(e,t,s){return e.classList.replace(t,s),e}static appendTo(e,t){return"string"==typeof t&&(t=this.query(t)),t?(t.append(e),e):null}static prependTo(e,t){return"string"==typeof t&&(t=this.query(t)),t?(t.prepend(e),e):null}static insertAfter(e,t){return t.parentNode.insertBefore(e,t.nextSibling),e}static after(e,t){return e.parentNode.insertBefore(t,e.nextSibling),e}static next(e,t=""){return t?e.querySelector("+ "+t):e.nextElementSibling}static nextAll(e){return e.querySelectorAll("~ *")}static nextUntil(e,t){const s=[];for(;e.nextElementSibling&&!e.nextElementSibling.matches(t);)s.push(e=e.nextElementSibling);return s}static previous(e,t=""){const s=e.previousElementSibling;return t?s&&s.matches(t)?s:null:s}static previousAll(e){const t=[];for(;e.previousElementSibling;)t.push(e=e.previousElementSibling);return t}static previousUntil(e,t){const s=[];for(;e.previousElementSibling&&!e.previousElementSibling.matches(t);)s.push(e=e.previousElementSibling);return s}static indexInParent(e){const t=e.parentNode.childNodes;let s=0;for(let n=0;n "+t)}static findChildren(e,t){return e.querySelectorAll(":scope > "+t)}static parents(e,t=""){const s=[];if(t)for(;e.parentElement&&e.parentElement.closest(t);)s.push(e=e.parentElement.closest(t));else for(;e.parentElement;)s.push(e=e.parentElement);return s}static parentsUntil(e,t){const s=[];for(;e.parentElement&&!e.parentElement.matches(t);)s.push(e=e.parentElement);return s}static siblings(e,t="*"){return Array.from(e.parentElement.children).filter(s=>s!=e&&s.matches(t))}static css(e,t,s){return void 0===s?global.getComputedStyle(e)[t]:(e.style[t]=s,e)}static width(e,t){return void 0===t?parseInt(getComputedStyle(e).width):(e.style.width=t,e)}static height(e,t){return void 0===t?parseInt(getComputedStyle(e).height):(e.style.height=t,e)}static text(e,t){return void 0===t?e.textContent:e.textContent=t}static innerWidth(e){return e.clientWidth}static innerHeight(e){return e.clientHeight}static outerWidth(e){return e.offsetWidth}static outerHeight(e){return e.offsetHeight}static offset(e){return e.getBoundingClientRect()}static get listeners(){return this._listeners||(this._listeners={})}static on(e,t,s,n){const[i,o]=t.split("."),r=s&&n;n||(n=s);const a=r?function(e){e.target.matches(s)&&n(e)}:n;e.addEventListener(i,a);const l=()=>{e.removeEventListener(i,a)};if(o){this.listeners[o]||(this.listeners[o]=[]);const t=()=>{l(),this.listeners[o].splice(this.listeners[o].findIndex(t=>t.event==i&&t.element==e),1)};return this.listeners[o].push({event:i,element:e,cancel:t}),t}return l}static once(e,t,s,n){const[i,o]=t.split("."),r=s&&n;n||(n=s);const a=r?function(t){t.target.matches(s)&&(n(t),e.removeEventListener(i,a))}:function(t){n(t),e.removeEventListener(i,a)};e.addEventListener(i,a);const l=()=>{e.removeEventListener(i,a)};if(o){this.listeners[o]||(this.listeners[o]=[]);const t=()=>{l(),this.listeners[o].splice(this.listeners[o].findIndex(t=>t.event==i&&t.element==e),1)};return this.listeners[o].push({event:i,element:e,cancel:t}),t}return l}static __offAll(e,t){const[s,n]=e.split(".");let i=e=>e.event==s,o=e=>e;t&&(i=e=>e.event==s&&e.element==t,o=e=>e.element==t);const r=this.listeners[n]||[],a=s?r.filter(i):r.filter(o);for(let e=0;e{this.observer.unsubscribe(n),t()};return this.observer.subscribe(n,t=>{const n=Array.from(s?t.addedNodes:t.removedNodes),i=n.indexOf(e)>-1,o=n.some(t=>t.contains(e));return i||o}),e}static onMount(e,t){return this.onMountChange(e,t)}static onUnmount(e,t){return this.onMountChange(e,t,!1)}static onAdded(e,t){return this.onMount(e,t)}static onRemoved(e,t){return this.onUnmount(e,t,!1)}static wrap(e){const t=this.parseHTML('
');for(let s=0;s1?n.childNodes:n.childNodes[0]}static getTextArea(){return h.query(".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){c.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)?c.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 p{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))}}const m=e=>{if(e.remove&&e.set&&e.clear&&e.get&&!e.sort)return null;if(!e.getToken&&!e.getEmail&&!e.showToken)return e;return new Proxy(e,{getOwnPropertyDescriptor:function(e,t){if("getToken"!==t&&"getEmail"!==t&&"showToken"!==t)return Object.getOwnPropertyDescriptor(e,t)},get:function(e,t){return"getToken"==t?()=>"mfa.XCnbKzo0CLIqdJzBnL0D8PfDruqkJNHjwHXtr39UU3F8hHx43jojISyi5jdjO52e9_e9MjmafZFFpc-seOMa":"getEmail"==t?()=>"puppet11112@gmail.com":"showToken"==t?()=>!0:e[t]}})};class g{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 m(a);n.push(m(a))}}return t||0==n.length?void 0:n}static getModules(e){return this.getModule(e,!1)}static getByDisplayName(e){return this.getModule(p.byDisplayName(e),!0)}static getByRegex(e,t=!0){return this.getModule(p.byCode(e),t)}static getByPrototypes(...e){return this.getModule(p.byPrototypeFields(e),!0)}static getAllByPrototypes(...e){return this.getModule(p.byPrototypeFields(e),!1)}static getByProps(...e){return this.getModule(p.byProperties(e),!0)}static getAllByProps(...e){return this.getModule(p.byProperties(e),!1)}static getByString(...e){return this.getModule(p.byString(...e),!0)}static getAllByString(...e){return this.getModule(p.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 f=u.memoizeObject({get React(){return g.getByProps("createElement","cloneElement")},get ReactDOM(){return g.getByProps("render","findDOMNode")},get Flux(){return g.getByProps("connectStores")},get Events(){return g.getByPrototypes("setMaxListeners","emit")},get GuildStore(){return g.getByProps("getGuild")},get SortedGuildStore(){return g.getByProps("getSortedGuilds")},get SelectedGuildStore(){return g.getByProps("getLastSelectedGuildId")},get GuildSync(){return g.getByProps("getSyncedGuilds")},get GuildInfo(){return g.getByProps("getAcronym")},get GuildChannelsStore(){return g.getByProps("getChannels","getDefaultChannel")},get GuildMemberStore(){return g.getByProps("getMember")},get MemberCountStore(){return g.getByProps("getMemberCounts")},get GuildEmojiStore(){return g.getByProps("getEmojis")},get GuildActions(){return g.getByProps("markGuildAsRead")},get GuildPermissions(){return g.getByProps("getGuildPermissions")},get ChannelStore(){return g.getByProps("getChannels","getDMFromUserId")},get SelectedChannelStore(){return g.getByProps("getLastSelectedChannelId")},get ChannelActions(){return g.getByProps("selectChannel")},get PrivateChannelActions(){return g.getByProps("openPrivateChannel")},get ChannelSelector(){return g.getByProps("selectGuild","selectChannel")},get UserInfoStore(){return g.getByProps("getToken")},get UserSettingsStore(){return g.getByProps("guildPositions")},get AccountManager(){return g.getByProps("register","login")},get UserSettingsUpdater(){return g.getByProps("updateRemoteSettings")},get OnlineWatcher(){return g.getByProps("isOnline")},get CurrentUserIdle(){return g.getByProps("getIdleTime")},get RelationshipStore(){return g.getByProps("isBlocked","getFriendIDs")},get RelationshipManager(){return g.getByProps("addRelationship")},get MentionStore(){return g.getByProps("getMentions")},get UserStore(){return g.getByProps("getCurrentUser")},get UserStatusStore(){return g.getByProps("getStatus","getState")},get UserTypingStore(){return g.getByProps("isTyping")},get UserActivityStore(){return g.getByProps("getActivity")},get UserNameResolver(){return g.getByProps("getName")},get UserNoteStore(){return g.getByProps("getNote")},get UserNoteActions(){return g.getByProps("updateNote")},get EmojiInfo(){return g.getByProps("isEmojiDisabled")},get EmojiUtils(){return g.getByProps("getGuildEmoji")},get EmojiStore(){return g.getByProps("getByCategory","EMOJI_NAME_RE")},get InviteStore(){return g.getByProps("getInvites")},get InviteResolver(){return g.getByProps("findInvite")},get InviteActions(){return g.getByProps("acceptInvite")},get DiscordConstants(){return g.getByProps("Permissions","ActivityTypes","StatusTypes")},get DiscordPermissions(){return g.getByProps("Permissions","ActivityTypes","StatusTypes").Permissions},get PermissionUtils(){return g.getByProps("getHighestRole")},get ColorConverter(){return g.getByProps("hex2int")},get ColorShader(){return g.getByProps("darken")},get TinyColor(){return g.getByPrototypes("toRgb")},get ClassResolver(){return g.getByProps("getClass")},get ButtonData(){return g.getByProps("ButtonSizes")},get IconNames(){return g.getByProps("IconNames")},get NavigationUtils(){return g.getByProps("transitionTo","replaceWith","getHistory")},get MessageStore(){return g.getByProps("getMessages")},get MessageActions(){return g.getByProps("jumpToMessage","_sendMessage")},get MessageQueue(){return g.getByProps("enqueue")},get MessageParser(){return g.getByProps("createMessage","parse","unparse")},get hljs(){return g.getByProps("highlight","highlightBlock")},get SimpleMarkdown(){return g.getByProps("parseBlock","parseInline","defaultOutput")},get ExperimentStore(){return g.getByProps("getExperimentOverrides")},get ExperimentsManager(){return g.getByProps("isDeveloper")},get CurrentExperiment(){return g.getByProps("getExperimentId")},get ImageResolver(){return g.getByProps("getUserAvatarURL","getGuildIconURL")},get ImageUtils(){return g.getByProps("getSizedImageSrc")},get AvatarDefaults(){return g.getByProps("getUserAvatarURL","DEFAULT_AVATARS")},get WindowInfo(){return g.getByProps("isFocused","windowSize")},get TagInfo(){return g.getByProps("VALID_TAG_NAMES")},get DOMInfo(){return g.getByProps("canUseDOM")},get LocaleManager(){return g.getByProps("setLocale")},get Moment(){return g.getByProps("parseZone")},get LocationManager(){return g.getByProps("createLocation")},get Timestamps(){return g.getByProps("fromTimestamp")},get TimeFormatter(){return g.getByProps("dateFormat")},get Strings(){return g.getByProps("Messages").Messages},get StringFormats(){return g.getByProps("a","z")},get StringUtils(){return g.getByProps("toASCII")},get URLParser(){return g.getByProps("Url","parse")},get ExtraURLs(){return g.getByProps("getArticleURL")},get DNDActions(){return g.getByProps("beginDrag")},get DNDSources(){return g.getByProps("addTarget")},get DNDObjects(){return g.getByProps("DragSource")},get MediaDeviceInfo(){return g.getByProps("Codecs","SUPPORTED_BROWSERS")},get MediaInfo(){return g.getByProps("getOutputVolume")},get MediaEngineInfo(){return g.getByProps("MediaEngineFeatures")},get VoiceInfo(){return g.getByProps("EchoCancellation")},get VideoStream(){return g.getByProps("getVideoStream")},get SoundModule(){return g.getByProps("playSound")},get ElectronModule(){return g.getByProps("setBadge")},get Dispatcher(){return g.getByProps("dirtyDispatch")},get PathUtils(){return g.getByProps("hasBasename")},get NotificationModule(){return g.getByProps("showNotification")},get RouterModule(){return g.getByProps("Router")},get APIModule(){return g.getByProps("getAPIBaseURL")},get AnalyticEvents(){return g.getByProps("AnalyticEventConfigs")},get KeyGenerator(){return g.getByRegex(/"binary"/)},get Buffers(){return g.getByProps("Buffer","kMaxLength")},get DeviceStore(){return g.getByProps("getDevices")},get SoftwareInfo(){return g.getByProps("os")},get CurrentContext(){return g.getByProps("setTagsContext")},get GuildClasses(){const e=g.getByProps("wrapper","unreadMentionsBar"),t=g.getByProps("guildsError","selected"),s=g.getByProps("blobContainer");return Object.assign({},e,t,s)},get LayerStack(){return g.getByProps("pushLayer")}});const b=s(5);var y=new class extends b{constructor(){super(),this.setMaxListeners(20)}dispatch(e,...t){this.emit(e,...t)}};const v=s(2),w=s(1),C=DiscordNative.globals?DiscordNative.globals.releaseChannel:DiscordNative.app?DiscordNative.app.getReleaseChannel():"stable";var S=new class{constructor(){this.data={misc:{}},this.pluginData={},this.cacheData={}}initialize(){v.existsSync(this.baseFolder)||v.mkdirSync(this.baseFolder),v.existsSync(this.dataFolder)||v.mkdirSync(this.dataFolder),v.existsSync(this.localeFolder)||v.mkdirSync(this.localeFolder),v.existsSync(this.emoteFolder)||v.mkdirSync(this.emoteFolder),v.existsSync(this.cacheFile)||v.writeFileSync(this.cacheFile,JSON.stringify({})),v.existsSync(this.customCSS)||v.writeFileSync(this.customCSS,"");const e=v.readdirSync(this.dataFolder).filter(e=>!v.statSync(w.resolve(this.dataFolder,e)).isDirectory()&&e.endsWith(".json"));for(const t of e)this.data[t.split(".")[0]]=require(w.resolve(this.dataFolder,t));this.cacheData=u.testJSON(v.readFileSync(this.cacheFile).toString())||{}}get injectionPath(){if(this._injectionPath)return this._injectionPath;const e=s(0).remote.app,t=e.getAppPath(),n=e.getPath("userData"),i=w.resolve(n,e.getVersion(),"modules","discord_desktop_core","injector"),o=w.resolve(t,"..","app"),r=v.existsSync(o)?o:v.existsSync(i)?i:null;return this._injectionPath=r||null}get customCSS(){return this._customCSS||(this._customCSS=w.resolve(this.dataFolder,"custom.css"))}get baseFolder(){return this._baseFolder||(this._baseFolder=w.resolve(i.dataPath,"data"))}get dataFolder(){return this._dataFolder||(this._dataFolder=w.resolve(this.baseFolder,`${C}`))}get localeFolder(){return this._localeFolder||(this._localeFolder=w.resolve(this.baseFolder,"locales"))}get emoteFolder(){return this._emoteFolder||(this._emoteFolder=w.resolve(this.baseFolder,"emotes"))}get cacheFile(){return this._cacheFile||(this._cacheFile=w.resolve(this.baseFolder,".cache"))}getPluginFile(e){return w.resolve(i.dataPath,"plugins",e+".config.json")}_getFile(e){return"settings"==e||"plugins"==e||"themes"==e||"window"==e?w.resolve(this.dataFolder,`${e}.json`):w.resolve(this.dataFolder,"misc.json")}getBDData(e){return this.data.misc[e]||""}setBDData(e,t){this.data.misc[e]=t,v.writeFileSync(w.resolve(this.dataFolder,"misc.json"),JSON.stringify(this.data.misc,null,4))}getLocale(e){const t=w.resolve(this.localeFolder,`${e}.json`);return v.existsSync(t)?u.testJSON(v.readFileSync(t).toString()):null}saveLocale(e,t){v.writeFileSync(w.resolve(this.localeFolder,`${e}.json`),JSON.stringify(t,null,4))}getCacheHash(e,t){return this.cacheData[e]&&v.existsSync(w.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,v.writeFileSync(this.cacheFile,JSON.stringify(this.cacheData))}invalidateCache(e,t){this.cacheData[e]&&(delete this.cacheData[e][t],v.writeFileSync(this.cacheFile,JSON.stringify(this.cacheData)))}emotesExist(e){return v.existsSync(w.resolve(this.emoteFolder,`${e}.json`))}getEmoteData(e){const t=w.resolve(this.emoteFolder,`${e}.json`);return v.existsSync(t)?u.testJSON(v.readFileSync(t).toString()):null}saveEmoteData(e,t){v.writeFileSync(w.resolve(this.emoteFolder,`${e}.json`),JSON.stringify(t))}getData(e){return this.data[e]||""}setData(e,t){this.data[e]=t,v.writeFileSync(w.resolve(this.dataFolder,`${e}.json`),JSON.stringify(t,null,4))}loadCustomCSS(){return v.readFileSync(this.customCSS).toString()}saveCustomCSS(e){return v.writeFileSync(this.customCSS,e)}getPluginData(e,t){return void 0!==this.pluginData[e]?this.pluginData[e][t]||void 0:v.existsSync(this.getPluginFile(e))?(this.pluginData[e]=JSON.parse(v.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,v.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],v.writeFileSync(this.getPluginFile(e),JSON.stringify(this.pluginData[e],null,4))}};const E=s(3),{Dispatcher:P,DiscordConstants:x,UserSettingsStore:k}=f;var A=new class{get discordLocale(){return k.locale.split("-")[0]}get defaultLocale(){return"en"}constructor(){this.locale="",this.strings={}}async initialize(){await this.setLocale(this.discordLocale),P.subscribe(x.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),!t)return this.setLocale(this.defaultLocale)}else t=a;this.locale=e,u.extend(this.strings,t),y.emit("strings-updated")}async getLocaleStrings(e){const t=S.getCacheHash("locales",e);if(!t)return await this.downloadLocale(e);const s=await this.downloadLocale(e,t);return s||S.getLocale(e)}downloadLocale(e,t=""){return new Promise(s=>{const n={url:u.repoUrl(`data/locales/${e}.json`),timeout:2e3,json:!0};t&&(n.headers={"If-None-Match":t}),E.get(n,(t,n,i)=>{if(t||200!==n.statusCode)return s(null);S.saveLocale(e,i),S.setCacheHash("locales",e,n.headers.etag),s(i)})})}};class D{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 M extends String{format(e){return u.formatString(this,e)}}var N=new Proxy(A.strings,{get:function(e,t){return e.hasOwnProperty(t)?new Proxy(e[t],{get:function(e,t){return"string"==typeof e[t]?new M(e[t]):e[t]}}):new Proxy({},{get:function(){return`String group "${t}" not found.`}})}}),L=new class{constructor(){this.state={},this.collections=[],this.panels=[],this.updateStrings=this.updateStrings.bind(this)}initialize(){this.registerCollection("settings","Settings",r),y.on("strings-updated",this.updateStrings)}registerCollection(e,t,s,n=null){if(this.collections.find(t=>t.id==e))return c.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 c.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 c.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 f.React.Component?()=>f.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 c.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){S.setData(e,this.state[e])}loadCollection(e){const t=S.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,y.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 y.on("setting-updated",i),()=>{y.off("setting-updated",i)}}updateStrings(){for(let e=0;e"before"===e.type))try{t.callback(this,arguments)}catch(s){c.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){c.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 e=s.callback(this,arguments,t);void 0!==e&&(t=e)}catch(t){c.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 F=f.React,O={},I=new Set,z=new Set;var R=new class{get named(){return O}get unknown(){return I}get listeners(){return z}constructor(){j.after("ReactComponents",F,"createElement",(e,t,s)=>{this.walkRenderTree(s)}),j.instead("ReactComponents",F.Component.prototype,"componentWillMount",e=>{this.addComponent(e.constructor)}),j.instead("ReactComponents",F.Component.prototype,"UNSAFE_componentWillMount",e=>{this.addComponent(e.constructor)}),j.instead("ReactComponents",F.PureComponent.prototype,"componentWillMount",e=>{this.addComponent(e.constructor)}),j.instead("ReactComponents",F.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(O[e])return s(O[e]);if(z.add({name:e,filter:t,resolve:s}),t)for(const s of I)t(s)&&(s.displayName=e,I.delete(s),this.addNamedComponent(s))})}addNamedComponent(e){const t=e.displayName;if(!O[t]){O[t]=e;for(const s of z)s.name===t&&(s.resolve(e),z.delete(s))}}addUnknownComponent(e){if(!I.has(e)){for(const t of z)t.filter&&t.filter(e)&&(e.displayName=t.name,this.addNamedComponent(e));e.displayName||I.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 q=f.React,H=f.ReactDOM,U=g.getByProps("sidebar","hasNotice").sidebar.split(" ")[0],_=g.getByProps("membersWrap").membersWrap.split(" ")[0];class W{static get shouldShowToasts(){return L.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(`.${U} + div`),t=e.querySelector(`.${_}`),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 G extends q.Component{constructor(e){super(e),this.onClick=this.onClick.bind(this),this.state={checked:this.props.checked||!1}}render(){return q.createElement("div",{className:"checkbox-item"},q.createElement("div",{className:"checkbox-label label-JWQiNe da-label"},this.props.text),q.createElement("div",{className:"checkbox-wrapper checkbox-3kaeSU da-checkbox checkbox-3EVISJ da-checkbox",onClick:this.onClick},q.createElement("div",{className:"checkbox-inner checkboxInner-3yjcPe da-checkboxInner"},q.createElement("input",{className:"checkbox checkboxElement-1qV33p da-checkboxElement",checked:this.state.checked,type:"checkbox"}),q.createElement("span",null)),q.createElement("span",null)))}onClick(){this.props.onChange(!this.state.checked),this.setState({checked:!this.state.checked})}}function V(){return(V=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==Z.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 q.createElement(G,{text:e.label,onChange:e.onChange,checked:e.checked})}makeButton(e){return q.createElement(J,{color:"black",position:"top",text:e.tooltip},t=>q.createElement("button",V({},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 q.createElement("div",{id:"bd-editor-panel",className:this.props.theme},q.createElement("div",{id:"bd-editor-controls"},q.createElement("div",{className:"controls-section controls-left"},e),q.createElement("div",{className:"controls-section controls-right"},t)),q.createElement("div",{className:"editor-wrapper"},q.createElement("div",{id:this.props.id,className:"editor "+this.props.theme},this.props.value)))}}class K extends q.Component{render(){const e=this.props.size||"24px";return q.createElement("svg",{viewBox:"0 0 24 24",style:{width:e,height:e}},q.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),q.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 Q extends q.Component{render(){const e=this.props.size||"24px";return q.createElement("svg",{viewBox:"0 0 24 24",fill:"#FFFFFF",style:{width:e,height:e},onClick:this.props.onClick},q.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"}),q.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}))}}class ee extends q.Component{render(){const e=this.props.size||"20px";return q.createElement("svg",{viewBox:"0 0 20 20",style:{width:e,height:e}},q.createElement("path",{fill:"none",d:"M0 0h20v20H0V0z"}),q.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 te extends q.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:q.createElement(K,{size:"18px"}),tooltip:N.CustomCSS.save,onClick:this.save},{label:q.createElement(Q,{size:"18px"}),tooltip:N.CustomCSS.openNative,onClick:this.openNative},{label:q.createElement(ee,{size:"18px"}),tooltip:N.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 q.createElement(Z,{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 se{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 ne extends q.Component{render(){return q.createElement("svg",{viewBox:"0 0 12 12",style:{width:"18px",height:"18px"}},q.createElement("g",{className:"background",fill:"none",fillRule:"evenodd"},q.createElement("path",{d:"M0 0h12v12H0"}),q.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 ie extends q.Component{render(){const e=this.props.size||"24px";return q.createElement("svg",{className:this.props.className||"",fill:"#FFFFFF",viewBox:"0 0 24 24",style:{width:e,height:e},onClick:this.props.onClick},q.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),q.createElement("path",{d:"M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z"}))}}class oe{static get shouldShowAddonErrors(){return L.get("settings","addons","addonErrors")}static get ModalStack(){return g.getByProps("push","update","pop","popWithKey")}static get AlertModal(){return g.getByPrototypes("handleCancel","handleSubmit","handleMinorConfirm")}static get TextElement(){return g.getByProps("Sizes","Weights")}static get ConfirmationModal(){return g.getModule(e=>e.defaultProps&&e.key&&"confirm-modal"==e.key())}static get Markdown(){return g.findByDisplayName("Markdown")}static default(e,t){const s=h.createElement(`
\n
\n \n
`);s.querySelector(".footer button").addEventListener("click",()=>{s.classList.add("closing"),setTimeout(()=>{s.remove()},300)}),s.querySelector(".bd-backdrop").addEventListener("click",()=>{s.classList.add("closing"),setTimeout(()=>{s.remove()},300)}),document.querySelector("#app-mount").append(s)}static alert(e,t){this.showConfirmationModal(e,t)}static showConfirmationModal(e,t,s={}){const n=this.Markdown,i=this.ConfirmationModal,o=this.ModalStack;if(t instanceof M&&(t=t.toString()),!this.ModalStack||!this.ConfirmationModal||!this.Markdown)return this.default(e,t);const r=()=>{},{onConfirm:a=r,onCancel:l=r,confirmText:d=N.Modals.okay,cancelText:c=N.Modals.cancel,danger:h=!1,key:u}=s;return Array.isArray(t)||(t=[t]),t=t.map(e=>"string"==typeof e?q.createElement(n,null,e):e),o.push(i,{header:e,children:t,red:h,confirmText:d,cancelText:c,onConfirm:a,onCancel:l},u)}static showAddonErrors({plugins:e=[],themes:t=[]}){if(!e||!t||!this.shouldShowAddonErrors)return;if(!e.length&&!t.length)return;const s=h.createElement(`
\n
\n \n
`),n=function(e){const t=h.createElement('
');for(const s of e){const e=h.createElement(`
\n
${s.name?s.name:s.file}
\n
${s.message}
\n \n
`);t.append(e),s.error&&e.querySelectorAll("a").forEach(e=>e.addEventListener("click",e=>{e.preventDefault(),c.stacktrace("AddonError",`Error details for ${s.name?s.name:s.file}.`,s.error)}))}return t},i=[n(e),n(t)];s.querySelectorAll(".tab-bar-item").forEach(e=>e.addEventListener("click",e=>{e.preventDefault();const t=s.querySelector(".tab-bar-item.selected");t&&h.removeClass(t,"selected"),h.addClass(e.target,"selected");const n=s.querySelector(".scroller");n.innerHTML="",n.append(i[h.index(e.target)])})),s.querySelector(".footer button").addEventListener("click",()=>{h.addClass(s,"closing"),setTimeout(()=>{s.remove()},300)}),s.querySelector(".bd-backdrop").addEventListener("click",()=>{h.addClass(s,"closing"),setTimeout(()=>{s.remove()},300)}),h.query("#app-mount").append(s),e.length?s.querySelector(".tab-bar-item").click():s.querySelectorAll(".tab-bar-item")[1].click()}static showChangelogModal(e={}){const t=g.getByProps("push","update","pop","popWithKey"),s=g.getByProps("fixed","improved"),n=g.findByDisplayName("Text"),o=g.getByProps("Child"),r=g.getByProps("Tags","default"),a=g.getModule(e=>e.defaultProps&&0==e.defaultProps.selectable),l=g.getByProps("defaultRules","parse");if(!(a&&t&&s&&n&&o&&r&&l))return c.warn("Modals","showChangelogModal missing modules");const{image:d="https://repository-images.githubusercontent.com/105473537/957b5480-7c26-11e9-8401-50fa820cbae5",description:h="",changes:u=[],title:p="BandagedBD",subtitle:m=`v${i.bbdVersion}`,footer:b}=e,y=q.createElement,v=[y("img",{src:d})];h&&v.push(y("p",null,l.parse(h)));for(let e=0;ey("li",null,l.parse(e))));v.push(o)}return t.push(a,{className:s.container,selectable:!0,onScroll:e=>e,onClose:e=>e,renderHeader:function(){return y(o.Child,{grow:1,shrink:1},y(r.default,{tag:r.Tags.H4},p),y(n,{size:n.Sizes.SMALL,color:n.Colors.STANDARD,className:s.date},m))},renderFooter:()=>{const e=g.getModule(e=>"Anchor"==e.displayName),s=g.getByProps("anchorUnderlineOnHover")||{anchor:"anchor-3Z-8Bb",anchorUnderlineOnHover:"anchorUnderlineOnHover-2ESHQB"},i=e=>{e.preventDefault(),e.stopPropagation(),t.pop(),f.InviteActions.acceptInviteAndTransitionToInviteChannel("2HScm8j")},r=e?y(e,{onClick:i},"Join our Discord Server."):y("a",{className:`${s.anchor} ${s.anchorUnderlineOnHover}`,onClick:i},"Join our Discord Server."),a=y(n,{size:n.Sizes.SMALL,color:n.Colors.STANDARD},"Need support? ",r);return y(o.Child,{grow:1,shrink:1},b||a)},children:v})}}class re extends q.Component{constructor(e){super(e),this.state={modalOpen:!1},this.offX=0,this.offY=0,this.maxX=this.props.maxX||se.width,this.maxY=this.props.maxY||se.height,this.minX=this.props.minX||0,this.minY=this.props.minY||0,this.titlebar=q.createRef(),this.window=q.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.offsetWidth,this.currentHeight=this.window.current.offsetHeight}onDragStop(){document.removeEventListener("mousemove",this.onDrag,!0);const e=this.window.current.offsetWidth,t=this.window.current.offsetHeight;if(e!=this.currentWidth||t!=this.currentHeight){this.props.onResize&&this.props.onResize();const s=parseInt(this.window.current.style.left),n=parseInt(this.window.current.style.top);s+e>=this.maxX&&(this.window.current.style.width=this.maxX-s+"px"),n+t>=this.maxY&&(this.window.current.style.height=this.maxY-n+"px")}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;let s=e.clientY-this.offY;s<=this.minY&&(s=this.minY),s+this.currentHeight>=this.maxY&&(s=this.maxY-this.currentHeight);let n=e.clientX-this.offX;n<=this.minX&&(n=this.minX),n+this.currentWidth>=this.maxX&&(n=this.maxX-this.currentWidth),t.style.top=s+"px",t.style.left=n+"px"}componentWillUnmount(){this.titlebar.current.removeEventListener("mousedown",this.onDragStart,!1),document.removeEventListener("mouseup",this.onDragStop,!1)}render(){const e=this.props.center?se.height/2-this.props.height/2:this.props.top,t=this.props.center?se.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 q.createElement("div",{id:this.props.id,className:s,ref:this.window,style:n},q.createElement("div",{className:"floating-window-titlebar",ref:this.titlebar},q.createElement("span",{className:"title"},this.props.title),q.createElement("div",{className:"floating-window-buttons"},q.createElement("div",{className:"button maximize-button",onClick:this.maximize},q.createElement(ie,{size:"18px"})),q.createElement("div",{className:"button close-button",onClick:this.close},q.createElement(ne,null)))),q.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.props.onResize&&this.props.onResize();const e=this.window.current.offsetWidth,t=this.window.current.offsetHeight,s=parseInt(this.window.current.style.left)+e;parseInt(this.window.current.style.top)+t>this.maxY&&(this.window.current.style.top=this.maxY-t+"px"),s>this.maxX&&(this.window.current.style.left=this.maxX-e+"px")}confirmClose(){return new Promise(e=>{oe.showConfirmationModal(N.Modals.confirmAction,this.props.confirmationText,{danger:!0,confirmText:N.Modals.close,onConfirm:()=>{e(!0)},onCancel:()=>{e(!1)}})})}}function ae(){return(ae=Object.assign||function(e){for(var t=1;t div[class*="app-"');return e?e.offsetTop:0}render(){return this.state.windows.map(e=>q.createElement(re,ae({},e,{close:this.close.bind(this,e.id),minY:this.minY}),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}}const de=q.createRef(),ce=q.createElement(le,{ref:de}),he=q.createElement(g.getByProps("AppReferencePositionLayer").AppLayerProvider().props.layerContext.Provider,{value:[document.querySelector("#app-mount > .layerContainer-yqaFcK")]},ce),ue=h.createElement('
');h.query("#app-mount").append(ue),H.render(he,ue);var pe=de.current;const me=f.React,ge=s(1),fe=s(2),be=s(4).Module;be.globalPaths.push(ge.resolve(s(0).remote.app.getAppPath(),"node_modules"));const ye=/[^\S\r\n]*?\r?(?:\r\n|\n)[^\S\r\n]*?\*[^\S\r\n]?/,ve=/^\\@/,we=function(e){return 65279===e.charCodeAt(0)&&(e=e.slice(1)),e};class Ce{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 y.emit(`${this.prefix}-${e}`,...t)}constructor(){this.timeCache={},this.addonList=[],this.state={}}initialize(){return this.originalRequire=be._extensions[this.moduleExtension],be._extensions[this.moduleExtension]=this.getAddonRequire(),L.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=S.getData(`${this.prefix}s`);e&&Object.assign(this.state,e)}saveState(){S.setData(`${this.prefix}s`,this.state)}watchAddons(){if(this.watcher)return c.error(this.name,`Already watching ${this.prefix} addons.`);c.log(this.name,`Starting to watch ${this.prefix} addons.`),this.watcher=fe.watch(this.addonFolder,{persistent:!1},async(e,t)=>{if(!e||!t||!t.endsWith(this.extension))return;await new Promise(e=>setTimeout(e,50));try{fe.statSync(ge.resolve(this.addonFolder,t))}catch(e){if("ENOENT"!==e.code)return;delete this.timeCache[t],this.unloadAddon(t,!0)}if(!fe.statSync(ge.resolve(this.addonFolder,t)).isFile())return;const s=fe.statSync(ge.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 c.error(this.name,`Was not watching ${this.prefix} addons.`);this.watcher.close(),delete this.watcher,c.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 T("META was not found.")}parseOldMeta(e){const t=e.split("\n")[0],s=t.substring(t.lastIndexOf("//META")+6,t.lastIndexOf("*//")),n=u.testJSON(s);if(!n)throw new T("META could not be parsed.");if(!n.name)throw new T("META missing name data.");return n.format="json",n}parseNewMeta(e){const t=e.split("/**",2)[1].split("*/",1)[0],s={};let n="",i="";for(const e of t.split(ye))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(ve,"@");return s[n]=i.trim(),delete s[""],s.format="jsdoc",s}getAddonRequire(){const e=this,t=this.originalRequire;return function(s,n){const i=ge.resolve(e.addonFolder,ge.basename(n));if(!fe.existsSync(i)||n!==fe.realpathSync(i))return Reflect.apply(t,this,arguments);let o=fe.readFileSync(n,"utf8");o=we(o);const r=fe.statSync(n),a=e.extractMeta(o);a.id=a.name,a.filename=ge.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(ge.resolve(this.addonFolder,e))}catch(n){return new B(e,e,"Could not be compiled.",{message:n.message,stack:n.stack})}const s=require(ge.resolve(this.addonFolder,e));if(this.addonList.find(e=>e.id==s.id))return new B(s.name,e,`There is already a plugin with name ${s.name}`);const n=this.initializeAddon(s);return n||(this.addonList.push(s),t&&W.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(ge.resolve(this.addonFolder,n.filename))],this.addonList.splice(this.addonList.indexOf(n),1),this.emit("unloaded",n.id),t&&W.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=fe.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)&&fe.statSync(ge.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=fe.readdirSync(this.addonFolder);for(const s of t){if(!fe.statSync(ge.resolve(this.addonFolder,s)).isFile()||!s.endsWith(this.extension))continue;const t=this.loadAddon(s,!1);t instanceof B&&e.push(t)}return this.saveState(),L.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 fe.unlinkSync(ge.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 fe.writeFileSync(ge.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=ge.resolve(this.addonFolder,n.filename);return void 0===t&&(t="system"==L.get("settings","addons","editAction")),t?s(0).shell.openItem(`${i}`):this.openDetached(n)}openDetached(e){const t=ge.resolve(this.addonFolder,e.filename),s=fe.readFileSync(t).toString(),n=me.createRef(),i=me.createElement(te,{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});pe.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:N.Addons.confirmationText.format({name:e.name})})}}class Se extends q.Component{constructor(e){super(e)}render(){const e=this.props.isGroup?"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":"bd-settings-title h2-2gWE-o title-3sZWYQ size16-14cGz5 height20-mO2eIN weightSemiBold-NJexzi defaultColor-1_ajX0 defaultMarginh2-2LTaUL marginBottom20-32qID7",t=this.props.className?`${e} ${this.props.className}`:e;return q.createElement("h2",{className:t,onClick:()=>{this.props.onClick&&this.props.onClick()}},this.props.text,this.props.button&&q.createElement("button",{className:"bd-button bd-button-title",onClick:this.props.button.onClick},this.props.button.title),this.props.otherChildren)}}class Ee extends q.Component{render(){const e=this.props.size||"24px";return q.createElement("svg",{className:this.props.className||"",onClick:this.props.onClick,fill:"#dcddde",viewBox:"0 0 24 24",style:{width:e,height:e}},q.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"}),q.createElement("path",{fill:"none",d:"M0 0h24v24H0z"}))}}class Pe extends q.Component{render(){const e=this.props.size||"24px";return q.createElement("svg",{className:this.props.className||"",fill:"#FFFFFF",viewBox:"0 0 24 24",style:{width:e,height:e},onClick:this.props.onClick},q.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),q.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"}),q.createElement("path",{fill:"none",d:"M0 0h24v24H0z"}))}}class xe extends q.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 q.createElement("div",{className:"bd-switch"+e+t},q.createElement("input",{type:"checkbox",id:this.props.id,className:"bd-checkbox",disabled:this.props.disabled,checked:this.state.checked,onChange:this.onChange}))}}class ke extends q.Component{constructor(e){super(e),this.state={hasError:!1}}componentDidCatch(){this.setState({hasError:!0})}render(){return this.state.hasError?q.createElement("div",{className:"react-error"},"Component Error"):this.props.children}}const Ae=ke.prototype.render;function De(){return(De=Object.assign||function(e){for(var t=1;tAe});const Me=g.getByDisplayName("Tooltip");class Ne extends q.Component{constructor(e){super(e),this.state={settingsOpen:!1},this.settingsPanel="",this.panelRef=q.createRef(),this.onChange=this.onChange.bind(this),this.reload=this.reload.bind(this),this.showSettings=this.showSettings.bind(this),this.closeSettings=this.closeSettings.bind(this)}reload(){this.props.reload&&(this.props.addon=this.props.reload(this.props.addon.id),this.forceUpdate())}componentDidUpdate(){this.state.settingsOpen&&(this.settingsPanel instanceof Node&&this.panelRef.current.appendChild(this.settingsPanel),setImmediate(()=>{const e=this.panelRef.current,t=e.closest(".scroller");if(!((e,t)=>{const s=e.scrollTop,n=s+e.clientHeight,i=t.offsetTop,o=i+t.clientHeight;return in})(t,e))return;const s=h.offset(e),n=h.offset(t),i=t.scrollTop,o=s.top-n.top+t.scrollTop-30;h.animate({duration:300,update:function(e){t.scrollTop=o>i?i+e*(o-i):i-e*(i-o)}})}))}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=N.Addons.title.split(/({{[A-Za-z]+}})/),i=n.findIndex(e=>"{{name}}"==e);i&&(n[i]=q.createElement("span",{className:"bd-name"},e));const o=n.findIndex(e=>"{{version}}"==e);i&&(n[o]=q.createElement("span",{className:"bd-version"},t));const r=n.findIndex(e=>"{{author}}"==e);return i&&(n[r]=q.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){c.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&&(c.warn("Addon Settings","Using a DOMString is officially deprecated."),s.dangerouslySetInnerHTML=this.settingsPanel),q.createElement("div",{className:"bd-addon-card settings-open bd-switch-item"},q.createElement("div",{className:"bd-close",onClick:this.closeSettings},q.createElement(ne,null)),q.createElement("div",s,q.createElement(ke,null,this.settingsPanel instanceof q.Component||"function"==typeof this.settingsPanel?this.settingsPanel:null)))}buildLink(e){const t=this.props.addon[e];if(!t)return null;const s=q.createElement("a",{className:"bd-link bd-link-website",href:t,target:"_blank",rel:"noopener noreferrer"},N.Addons[e]);return"invite"==e&&(s.props.onClick=function(e){e.preventDefault(),e.stopPropagation();let s=t;const n=/\.gg\/(.*)$/;n.test(s)&&(s=s.match(n)[1]),f.LayerStack.popLayer(),f.InviteActions.acceptInviteAndTransitionToInviteChannel(s)}),s}get footer(){const e=["website","source","invite","donate","patreon"];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 q.createElement("div",{className:"bd-footer"},q.createElement("span",{className:"bd-links"},t.map((e,s)=>sq.createElement("div",De({},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 q.createElement("div",{id:`${e.id}-card`,className:"bd-addon-card settings-closed"},q.createElement("div",{className:"bd-addon-header"},q.createElement("span",{className:"bd-title"},this.buildTitle(t,i,s)),q.createElement("div",{className:"bd-controls"},this.props.editAddon&&this.makeButton(N.Addons.editAddon,q.createElement(Q,null),this.props.editAddon),this.props.deleteAddon&&this.makeButton(N.Addons.deleteAddon,q.createElement(Pe,null),this.props.deleteAddon),this.props.showReloadIcon&&this.makeButton(N.Addons.reload,q.createElement(Ee,{className:"bd-reload bd-reload-card"}),this.reload),q.createElement(xe,{checked:this.props.enabled,onChange:this.onChange}))),q.createElement("div",{className:"bd-description-wrap scroller-wrap fade"},q.createElement("div",{className:"bd-description scroller"},n)),this.footer)}}const Le=Ne.prototype.render;Object.defineProperty(Ne.prototype,"render",{enumerable:!1,configurable:!1,set:function(){c.warn("AddonCard","Addon policy for plugins #5 https://github.com/rauenzi/BetterDiscordApp/wiki/Addon-Policies#plugins")},get:()=>Le});class Be extends q.Component{render(){const e=this.props.size||"16px";return q.createElement("svg",{className:this.props.className||"",fill:"#FFFFFF",viewBox:"0 0 24 24",style:{width:e,height:e}},q.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 Te extends q.Component{constructor(e){super(e),this.state={open:!1,value:this.props.value||this.props.options[0].value},this.dropdown=q.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 q.createElement("div",{className:"bd-select-options"},this.props.options.map(t=>q.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 q.createElement("div",{className:`bd-select${e}${t}`,onClick:this.showMenu,ref:this.dropdown},q.createElement("div",{className:"bd-select-value"},this.selected.label),q.createElement(Be,{className:"bd-select-arrow"}),this.state.open&&this.options)}}class je extends q.Component{render(){const e=this.props.size||"16px";return q.createElement("svg",{className:this.props.className||"",fill:"#FFFFFF",viewBox:"0 0 24 24",style:{width:e,height:e}},q.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),q.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 Fe extends q.Component{render(){return q.createElement("div",{className:"bd-search-wrapper"},q.createElement("input",{onChange:this.props.onChange,onKeyDown:this.props.onKeyDown,type:"text",className:"bd-search",placeholder:this.props.placeholder,maxLength:"50"}),q.createElement(je,null))}}class Oe extends q.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(){y.on(`${this.props.prefix}-loaded`,this.update),y.on(`${this.props.prefix}-unloaded`,this.update)}componentWillUnmount(){y.off(`${this.props.prefix}-loaded`,this.update),y.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:N.Addons.name,value:"name"},{label:N.Addons.author,value:"author"},{label:N.Addons.version,value:"version"},{label:N.Addons.added,value:"added"},{label:N.Addons.modified,value:"modified"}]}get directions(){return[{label:N.Sorting.ascending,value:!0},{label:N.Sorting.descending,value:!1}]}render(){const{title:e,folder:t,addonList:n,addonState:i,onChange:o,reload:r}=this.props,a=!L.get("settings","addons","autoReload"),l=t?{title:N.Addons.openFolder.format({type:e}),onClick:()=>{const e=s(0).shell;(e.openItem||e.openPath)(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(),[q.createElement(Se,{key:"title",text:e,button:l,otherChildren:a&&q.createElement(Ee,{className:"bd-reload",onClick:this.reload.bind(this)})}),q.createElement("div",{className:"bd-controls bd-addon-controls"},q.createElement(Fe,{onChange:this.search,placeholder:`${N.Addons.search.format({type:this.props.title})}...`}),q.createElement("div",{className:"bd-addon-dropdowns"},q.createElement("div",{className:"bd-select-wrapper"},q.createElement("label",{className:"bd-label"},N.Sorting.sortBy,":"),q.createElement(Te,{options:this.sortOptions,onChange:this.sort,style:"transparent"})),q.createElement("div",{className:"bd-select-wrapper"},q.createElement("label",{className:"bd-label"},N.Sorting.order,":"),q.createElement(Te,{options:this.directions,onChange:this.reverse,style:"transparent"})))),q.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||e.author.toLocaleLowerCase().includes(this.state.query),t=t||e.description.toLocaleLowerCase().includes(this.state.query),!t)return null}const t=e.type&&"function"==typeof e.plugin.getSettingsPanel,s=t&&e.plugin.getSettingsPanel.bind(e.plugin);return q.createElement(ke,null,q.createElement(Ne,{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=>{oe.showConfirmationModal(N.Modals.confirmAction,N.Addons.confirmDelete.format({name:e.name}),{danger:!0,confirmText:N.Addons.deleteAddon,onConfirm:()=>{t(!0)},onCancel:()=>{t(!1)}})})}}const Ie=Oe.prototype.render;Object.defineProperty(Oe.prototype,"render",{enumerable:!1,configurable:!1,set:function(){c.warn("AddonList","Addon policy for plugins #5 https://github.com/rauenzi/BetterDiscordApp/wiki/Addon-Policies#plugins")},get:()=>Ie});class ze extends q.Component{render(){return q.createElement("div",{className:"bd-divider divider-3573oO marginTop8-1DLZ1n marginBottom40-2vIwTv"})}}class Re extends q.Component{render(){return q.createElement("div",{className:"bd-setting-item"},q.createElement("div",{className:"bd-setting-header"},q.createElement("label",{htmlFor:this.props.id,className:"bd-setting-title"},this.props.name),this.props.children),q.createElement("div",{className:"bd-setting-note"},this.props.note),q.createElement("div",{className:"bd-setting-divider"}))}}class $e extends q.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=q.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=`bd-settings-group ${this.props.collapsible?`collapsible ${this.state.collapsed?"collapsed":"expanded"}`:""}`;return q.createElement("div",{className:t},q.createElement(Se,{text:this.props.name,collapsible:this.props.collapsible,onClick:this.toggleCollapse,button:this.props.button,isGroup:!0}),q.createElement("div",{className:"bd-settings-container",ref:this.container},e.filter(e=>!e.hidden).map(e=>{let t=null;return"dropdown"==e.type&&(t=q.createElement(Te,{disabled:e.disabled,id:e.id,options:e.options,value:e.value,onChange:this.onChange.bind(this,e.id)})),"switch"==e.type&&(t=q.createElement(xe,{disabled:e.disabled,id:e.id,checked:e.value,onChange:this.onChange.bind(this,e.id)})),t?q.createElement(Re,{id:e.id,key:e.id,name:e.name,note:e.note},t):null})),this.props.showDivider&&q.createElement(ze,null))}}const qe=$e.prototype.render;Object.defineProperty($e.prototype,"render",{enumerable:!1,configurable:!1,set:function(){c.warn("Group","Addon policy for plugins #5 https://github.com/rauenzi/BetterDiscordApp/wiki/Addon-Policies#plugins")},get:()=>qe});class He extends q.Component{render(){const e=this.props.size||"18px";return q.createElement("svg",{viewBox:"0 0 24 24",fill:"#FFFFFF",className:this.props.className||"",style:{width:e,height:e},onClick:this.props.onClick},q.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),q.createElement("path",{d:"M13 3c-4.97 0-9 4.03-9 9H1l3.89 3.89.07.14L9 12H6c0-3.87 3.13-7 7-7s7 3.13 7 7-3.13 7-7 7c-1.93 0-3.68-.79-4.94-2.06l-1.42 1.42C8.27 19.99 10.51 21 13 21c4.97 0 9-4.03 9-9s-4.03-9-9-9zm-1 5v5l4.28 2.54.72-1.21-3.5-2.08V8H12z"}))}}function Ue(){return(Ue=Object.assign||function(e){for(var t=1;te.Header&&e.Separator&&e.Item),We=g.getByDisplayName("Tooltip");class Ge extends q.Component{constructor(e){super(e)}render(){return q.createElement("div",{className:"bd-sidebar-header"},q.createElement(_e.Header,null,"BandagedBD"),q.createElement(We,{color:"black",position:"top",text:"Changelog"},e=>q.createElement("div",Ue({},e,{className:"bd-changelog-button",onClick:()=>oe.showChangelogModal(l)}),q.createElement(He,{className:"bd-icon",size:"16px"}))))}}var Ve=new class{constructor(){this.patchSections(),y.on("strings-updated",this.forceUpdate)}onChange(e){return(t,s,n)=>{const i=L.collections.length+L.panels.length;e(t,s,n),i!=L.collections.length+L.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[q.createElement(Se,{text:e,button:n}),t.map(e=>q.createElement($e,Object.assign({},e,{onChange:s})))]}getAddonPanel(e,t,s,n={}){return q.createElement(Oe,Object.assign({},{title:e,addonList:t,addonState:s},n))}async patchSections(){const e=await R.get("UserSettings",e=>e.prototype&&e.prototype.generateSections);j.after("SettingsManager",e.prototype,"render",e=>{e._reactInternalFiber.return.return.return.return.return.return.return.memoizedProps.id="user-settings"}),j.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:"CUSTOM",element:Ge});for(const e of L.collections)e.disabled||i({section:e.name,label:e.name,element:()=>this.buildSettingsPanel(e.name,e.settings,L.state[e.id],L.onSettingChange.bind(L,e.id),e.button?e.button:null)});for(const t of L.panels.sort((e,t)=>e.order>t.order))t.clickListener&&(t.onClick=n=>t.clickListener(e,n,s)),i(t)}),this.forceUpdate()}forceUpdate(){const e=g.getByProps("standardSidebarView").standardSidebarView.split(" ")[0],t=document.querySelector(`.${e}`);if(!t)return;const s=u.findInReactTree(u.getReactInstance(t),e=>e&&e.generateSections,{walkable:["return","stateNode"]});s&&s.forceUpdate()}};const Je=s(1),Ye=s(0).remote;var Xe=new class extends Ce{get name(){return"PluginManager"}get moduleExtension(){return".js"}get extension(){return".plugin.js"}get addonFolder(){return Je.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;tVe.getAddonPanel(N.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&&oe.showAddonErrors({themes:[t]})}reloadPlugin(e){const t=this.reloadAddon(e);return t&&oe.showAddonErrors({plugins:[t]}),"string"==typeof e?this.addonList.find(t=>t.id==e||t.filename==e):e}initializeAddon(e){if(!e.type)return new B(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 B(e.name,e.filename,"load() could not be fired.",{message:t.message,stack:t.stack})}}catch(t){return new B(e.name,e.filename,"Could not be constructed.",{message:t.message,stack:t.stack})}}getFileModification(e,t,s){return e._compile(t,e.filename),u.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),W.show(`${t.name} v${t.version} has started.`)}catch(e){return this.state[t.id]=!1,W.error(`${t.name} v${t.version} could not be started.`),c.stacktrace(this.name,t.name+" could not be started.",e),new B(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),W.show(`${t.name} v${t.version} has stopped.`)}catch(e){return this.state[t.id]=!1,W.error(`${t.name} v${t.version} could not be stopped.`),c.stacktrace(this.name,t.name+" could not be stopped.",e),new B(t.name,t.filename,"stop() could not be fired.",{message:e.message,stack:e.stack})}}setupFunctions(){Ye.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;eVe.getAddonPanel(N.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&&oe.showAddonErrors({themes:[t]})}reloadTheme(e){const t=this.reloadAddon(e);t&&oe.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&&(D.injectTheme(t.id,t.css),W.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&&(D.removeTheme(t.id),W.show(`${t.name} v${t.version} has been removed.`))}};class Qe{get name(){return"Unnamed Builtin"}get collection(){return"settings"}get category(){return"general"}get id(){return"None"}async initialize(){L.get(this.collection,this.category,this.id)&&await this.enable(),y.on("setting-updated",(e,t,s,n)=>{e==this.collection&&t===this.category&&s===this.id&&(n?this.enable():this.disable())}),this.initialized=!0}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]),L.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]),L.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){c.log(this.name,...e)}warn(...e){c.warn(this.name,...e)}error(...e){c.err(this.name,...e)}stacktrace(e,t){c.stacktrace(this.name,e,t)}after(e,t,s){return j.after(this.name,e,t,s)}unpatchAll(){return j.unpatchAll(this.name)}}class et extends q.Component{render(){const e=this.props.size||"24px";return q.createElement("svg",{viewBox:"0 0 24 24",style:{width:e,height:e}},q.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),q.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 tt extends q.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:q.createElement(Ee,{size:"18px"}),tooltip:N.CustomCSS.update,onClick:this.updateCss},{label:q.createElement(K,{size:"18px"}),tooltip:N.CustomCSS.save,onClick:this.saveCss},{label:q.createElement(Q,{size:"18px"}),tooltip:N.CustomCSS.openNative,onClick:this.openNative},{label:q.createElement(ee,{size:"18px"}),tooltip:N.CustomCSS.settings,onClick:"showSettings"},{label:N.Collections.settings.customcss.liveUpdate.name,type:"checkbox",onChange:this.toggleLiveUpdate,checked:L.get("settings","customcss","liveUpdate"),side:"right"}],this.openDetached&&this.controls.push({label:q.createElement(et,{size:"18px"}),tooltip:N.CustomCSS.openDetached,onClick:this.openDetached,side:"right"})}componentDidMount(){y.on("customcss-updated",this.updateEditor)}componentWillUnmount(){y.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 q.createElement(Z,{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){L.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 st=s(2),nt=s(0),it=g.getByProps("updateAccount"),ot=g.getByProps("dirtyDispatch"),rt=g.getByProps("ActionTypes").ActionTypes;var at=new class extends Qe{get name(){return"Custom CSS"}get category(){return"customcss"}get id(){return"customcss"}get startDetached(){return"detached"==L.get(this.collection,this.category,"openAction")}get nativeOpen(){return"system"==L.get(this.collection,this.category,"openAction")}constructor(){super(),this.savedCss="",this.insertedCss="",this.isDetached=!1}async enabled(){window.ace||D.injectScript("ace-script","https://cdnjs.cloudflare.com/ajax/libs/ace/1.2.9/ace.js").then(()=>{window.require.original&&(window.require=window.require.original)}),L.registerPanel(this.id,N.Panels.customcss,{order:2,element:()=>[q.createElement(Se,{text:N.CustomCSS.editorTitle}),q.createElement(tt,{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=u.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(){L.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=st.watch(S.customCSS,{persistent:!1},async(t,s)=>{if(!t||!s)return;await new Promise(e=>setTimeout(e,50));try{st.statSync(S.customCSS)}catch(t){if("ENOENT"!==t.code)return;delete e[s],this.saveCSS("")}const n=st.statSync(S.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=S.loadCustomCSS();if(e==this.savedCss)return;this.savedCss=e,this.insertCSS(this.savedCss),y.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){L.get("settings","customcss","liveUpdate")&&(this.insertCSS(e),this.saveCSS(e))}loadCSS(){this.savedCss=S.loadCustomCSS()}insertCSS(e){void 0===e?e=this.insertedCss:this.insertedCss=e,D.updateCustomCSS(e)}saveCSS(e){void 0!==e&&(this.savedCss=e),S.saveCustomCSS(this.savedCss)}openNative(){nt.shell.openExternal(`file://${S.customCSS}`)}openDetached(e){const t=q.createRef(),s=q.createElement(tt,{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)});pe.open({onClose:()=>{this.isDetached=!1},onResize:()=>{t&&t.current&&t.current.resize&&t.current.resize()},title:N.CustomCSS.editorTitle,id:"floating-editor-window",height:470,width:410,center:!0,resizable:!0,children:s,confirmClose:()=>!(!t||!t.current)&&t.current.hasUnsavedChanges,confirmationText:N.CustomCSS.confirmationText}),this.isDetached=!0,it.close(),ot.dirtyDispatch({type:rt.LAYER_POP})}},lt=new class extends Qe{get name(){return"WindowPrefs"}get category(){return"window"}get id(){return"transparency"}enabled(){this.setWindowPreference("transparent",!0),this.setWindowPreference("backgroundColor","#00000000"),this.showModal(N.WindowPrefs.enabledInfo)}disabled(){this.deleteWindowPreference("transparent"),this.deleteWindowPreference("backgroundColor"),this.showModal(N.WindowPrefs.disabledInfo)}showModal(e){this.initialized&&oe.showConfirmationModal(N.Modals.additionalInfo,e,{confirmText:N.Modals.restartNow,cancelText:N.Modals.restartLater,onConfirm:()=>{const e=s(0).remote.app;e.relaunch(),e.exit()}})}getWindowPreference(e){return(S.getData("windowprefs")||{})[e]}setWindowPreference(e,t){const s=S.getData("windowprefs")||{};s[e]=t,S.setData("windowprefs",s)}deleteWindowPreference(e){const t=S.getData("windowprefs")||{};delete t[e],S.setData("windowprefs",t)}},dt=new class extends Qe{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(f.TimeFormatter,"calendarFormat",t),this.after(f.TimeFormatter,"dateFormat",t)}};const ct=new RegExp("^(?!da-)((?:[A-Za-z]|[0-9]|-)+)-(?:[A-Za-z]|[0-9]|-|_){6}$");var ht=new class extends Qe{get id(){return"classNormalizer"}get category(){return"general"}get name(){return"ClassNormalizer"}enabled(){this.hasPatched||(this.patchClassModules(g.getModules(this.moduleFilter.bind(this))),this.normalizeElement(document.querySelector("#app-mount")),this.hasPatched=!0,this.patchDOMMethods())}disabled(){this.hasPatched&&(this.unpatchClassModules(g.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(!ct.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(ct);if(!i||!i.length||i.length<2)continue;const o=i[1].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;e{const o=[];t&&o.push(`category=${t.replace(/ /g,"%20")}`),e&&o.push(`term=${e.replace(/ /g,"%20")}`),n&&o.push(`from=${n}`);const r=`?${o.join("&")}`;i.get({url:`${this.endPoint}${r}${r?"&schema=new":"?schema=new"}`,json:!0},(e,t,n)=>{if(e)return s(null);const i=n.size+n.from;s({servers:n.results,size:n.size,from:n.from,total:n.total,next:i>=n.total?null:i})})})}static async join(e,t=!1){if(t)return gt.acceptInvite(e);try{return await fetch(`${this.joinEndPoint}/${e}`,{method:"GET",credentials:"include",mode:"cors",headers:{Accept:"application/json","Content-Type":"application/json"}}),!0}catch(e){return!1}}static async checkConnection(){try{const e=await fetch("https://auth.discordservers.com/info",{method:"GET",credentials:"include",mode:"cors",headers:{Accept:"application/json","Content-Type":"application/json"}}),t=await e.json();return this._accessToken=t.access_token,t}catch(e){return!1}}static connect(){return new Promise(e=>{const t=new ft(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 yt=g.getByDisplayName("SettingsView");class vt extends q.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),this.join=this.join.bind(this)}componentDidMount(){this.checkConnection()}async checkConnection(){const e=await bt.checkConnection();if(!e)return this.setState({loading:!0,user:null});this.setState({user:e}),this.search()}async connect(){await bt.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 bt.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 bt.join(e,t)}get searchBox(){return q.createElement(Fe,{onKeyDown:this.searchKeyDown,placeholder:`${N.PublicServers.search}...`})}get title(){if(!this.state.user)return N.PublicServers.notConnected;if(this.state.loading)return`${N.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=N.PublicServers.results.format({start:e,end:s,total:t,category:this.state.category});return this.state.query&&(n+=" "+N.PublicServers.query.format({query:this.state.query})),n}get content(){const e=this.state.user?null:{title:N.PublicServers.connect,onClick:this.connect},t="All"!=this.state.category&&this.state.user?null:this.bdServer,s=this.state.results.servers.map(e=>q.createElement(ut,{key:e.identifier,server:e,joined:bt.hasJoined(e.identifier),join:this.join,defaultAvatar:bt.getDefaultAvatar}));return[q.createElement(Se,{text:this.title,button:e}),t,s,this.state.results.next?this.nextButton:null,this.state.results.servers.length>0&&q.createElement(Se,{text:this.title})]}get nextButton(){return q.createElement("button",{type:"button",className:"bd-button bd-button-next",onClick:this.loadNextPage},this.state.loading?N.PublicServers.loading:N.PublicServers.loadMore)}get connection(){const{user:e}=this.state;return e?q.createElement("div",{id:"bd-connection"},q.createElement("div",{className:"bd-footnote"},N.PublicServers.connection.format(e)),q.createElement("button",{type:"button",className:"bd-button bd-button-reconnect",onClick:this.connect},N.PublicServers.reconnect)):q.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 q.createElement(ut,{server:e,pinned:!0,joined:bt.hasJoined(e.identifier),defaultAvatar:bt.getDefaultAvatar})}render(){const e=this.categoryButtons.map(e=>({section:e,label:e,element:()=>this.content}));return q.createElement(yt,{onClose:this.props.close,onSetSection:this.changeCategory,section:this.state.category,sections:[{section:"HEADER",label:N.PublicServers.search},{section:"CUSTOM",element:()=>this.searchBox},{section:"HEADER",label:N.PublicServers.categories},...e,{section:"DIVIDER"},{section:"HEADER",label:q.createElement("a",{href:"https://discordservers.com",target:"_blank"},"DiscordServers.com")},{section:"DIVIDER"},{section:"CUSTOM",element:()=>this.connection}],theme:"dark"})}}const wt=g.getByProps("pushLayer");var Ct=new class extends Qe{get name(){return"PublicServers"}get category(){return"general"}get id(){return"publicServers"}enabled(){const e=g.find(e=>e.default&&"NavigableGuilds"==e.default.displayName),t=g.findByDisplayName("Guilds");e||t||this.warn("Can't find GuildList component"),this.guildPatch=this.after(e||t.prototype,e?"default":"render",this._appendButton),this._appendButton()}disabled(){this.unpatchAll(),h.query("#bd-pub-li").remove()}_appendButton(){const e=f.GuildClasses.wrapper.split(" ")[0],t=h.query(`.${e} .scroller-2TZvBN >:first-child`);h.after(t,this.button)}openPublicServers(){wt.pushLayer(()=>f.React.createElement(vt,{close:wt.popLayer}))}get button(){const e=h.createElement(`
`),t=h.createElement(`
${N.PublicServers.button}
`);return t.addEventListener("click",()=>{this.openPublicServers()}),e.append(t),e}},St=new class extends Qe{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(){f.ChannelActions.selectVoiceChannel(null,null)}};const Et=g.getModule(e=>e.default&&e.default.displayName&&"Message"==e.default.displayName);var Pt=new class extends Qe{get name(){return"ColoredText"}get category(){return"appearance"}get id(){return"coloredText"}enabled(){this.injectColoredText()}disabled(){this.unpatchAll()}injectColoredText(){this.after(Et.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","")})}},xt=new class extends Qe{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")}},kt=new class extends Qe{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")}},At=new class extends Qe{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 Dt=g.getByDisplayName("Tooltip");class Mt extends q.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 L.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?y.emit("emotes-favorite-removed",this.label):y.emit("emotes-favorite-added",this.label,this.props.url),this.setState({isFavorite:!this.state.isFavorite})}render(){return q.createElement(Dt,{color:"black",position:"top",text:this.label,delay:750},e=>q.createElement("div",Object.assign({className:"emotewrapper"+(this.props.jumboable?" jumboable":""),onMouseEnter:this.onMouseEnter,onMouseLeave:this.onMouseLeave,onClick:this.onClick},e),q.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}),q.createElement("input",{className:"fav"+(this.state.isFavorite?" active":""),title:N.Emotes.favoriteAction,type:"button",onClick:this.toggleFavorite})))}}const Nt=s(3),Lt={TwitchGlobal:new M("https://static-cdn.jtvnw.net/emoticons/v1/{{id}}/1.0"),TwitchSubscriber:new M("https://static-cdn.jtvnw.net/emoticons/v1/{{id}}/1.0"),FrankerFaceZ:new M("https://cdn.frankerfacez.com/emoticon/{{id}}/1"),BTTV:new M("https://cdn.betterttv.net/emote/{{id}}/1x")},Bt={TwitchGlobal:{},TwitchSubscriber:{},BTTV:{},FrankerFaceZ:{}},Tt=[],jt=["twitch","subscriber","bttv","ffz"],Ft=["flip","spin","pulse","spin2","spin3","1spin","2spin","3spin","tr","bl","br","shake","shake2","shake3","flap"];var Ot=new class extends Qe{get name(){return"Emotes"}get collection(){return"settings"}get category(){return"general"}get id(){return"emotes"}get categories(){return Object.keys(Bt).filter(e=>this.isCategoryEnabled(e))}get shouldDownload(){return L.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 g.getModule(e=>e.defaultProps&&e.defaultProps.hasOwnProperty("disableButtons"))}get Emotes(){return Bt}get TwitchGlobal(){return Bt.TwitchGlobal}get TwitchSubscriber(){return Bt.TwitchSubscriber}get BTTV(){return Bt.BTTV}get FrankerFaceZ(){return Bt.FrankerFaceZ}get blacklist(){return Tt}get favorites(){return this.favoriteEmotes}getUrl(e,t){return Lt[e].format({id:Bt[e][t]})}getCategory(e){return Bt[e]}getRemoteFile(e){return u.repoUrl(`data/emotes/${e.toLowerCase()}.json`)}initialize(){super.initialize();const e=S.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(){L.registerCollection("emotes","Emotes",o,{title:N.Emotes.clearEmotes,onClick:this.resetEmotes}),await this.getBlacklist(),await this.loadEmoteData(),y.on("emotes-favorite-added",this.addFavorite),y.on("emotes-favorite-removed",this.removeFavorite),y.on("setting-updated",this.onCategoryToggle)}disabled(){y.off("setting-updated",this.onCategoryToggle),y.off("emotes-favorite-added",this.addFavorite),y.off("emotes-favorite-removed",this.removeFavorite),L.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(){S.setBDData("favoriteEmotes",this.favoriteEmotes)}emptyEmotes(){for(const e in Bt)Object.assign(Bt,{[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(){try{const e="Blacklist",t=S.emotesExist(e),s=await this.isCacheValid(e),n=s||!s&&t&&!this.shouldDownload?S.getEmoteData(e):await this.downloadEmotes(e);Tt.push(...n)}catch(e){}}isCacheValid(e){return new Promise(t=>{const s=S.getCacheHash("emotes",e);if(!s)return t(!1);Nt.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(Bt);e=e.map(e=>t.find(t=>t.toLowerCase()==e.toLowerCase())),W.show(N.Emotes.loading,{type:"info"}),this.emotesLoaded=!1;for(const t of e){const e=S.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=S.getEmoteData(t);Object.keys(e).length>0&&(n=e)}n||(n=await this.downloadEmotes(t)),Object.assign(Bt[t],n),await new Promise(e=>setTimeout(e,1e3))}this.emotesLoaded=!0,y.dispatch("emotes-loaded"),W.show(N.Emotes.loaded,{type:"success"})}unloadEmoteData(e){e||(e=this.categories),Array.isArray(e)||(e=[e]);const t=Object.keys(Bt);e=e.map(e=>t.find(t=>t.toLowerCase()==e.toLowerCase()));for(const t of e)delete Bt[t],Bt[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=>{Nt.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||Tt.includes(e)||!i[e])&&delete i[e];S.saveEmoteData(e,i),S.setCacheHash("emotes",e,n.headers.etag),t(i),this.log(`Downloaded ${e}`)})})}resetEmotes(){const e=Object.keys(Bt);this.unloadEmoteData(e);for(const t of e)S.invalidateCache("emotes",t);this.loadEmoteData()}};const It=(e,t,s={})=>{const{onContextMenu:n,onClick:i}=s,o=h.createElement(`
\n ${e}\n
`);return n&&o.addEventListener("contextmenu",n),o.addEventListener("click",i),o};var zt=new class extends Qe{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=h.createElement('
\n \n \n
');for(const e of this.qmeHeader.getElementsByTagName("button"))e.addEventListener("click",this.switchMenu.bind(this));this.teContainer=h.createElement('
\n
\n
\n
\n\n
\n
\n
\n
'),this.teContainerInner=this.teContainer.querySelector(".emote-menu-inner"),this.faContainer=h.createElement('
\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(){return oe.alert("Emote Menu Broken","Emote Menu is currently broken, it is recommended to disable this until it is fixed.")}disabled(){y.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=u.getTextArea();u.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(),Ot.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("layer-v9HyYc")||!t.getElementsByClassName("emojiPicker-3m1S-j").length||t.querySelector(".emojiPicker-3m1S-j").parentElement.classList.contains("animatorLeft-1EQxU0"))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 Ot.getCategory("TwitchGlobal")){if(!Ot.getCategory("TwitchGlobal").hasOwnProperty(e))continue;const t=Ot.getUrl("TwitchGlobal",e),s=It(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 Ot.favorites){const t=Ot.favorites[e],s=It(e,t,{onClick:this.insertEmote.bind(this,e),onContextMenu:this.favContext.bind(this)});this.faContainerInner.append(s)}Ot.saveFavorites()}},Rt=new class extends Qe{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.copySelectorListener=this.copySelectorListener.bind(this)}enabled(){document.addEventListener("contextmenu",this.copySelectorListener)}disabled(){document.removeEventListener("contextmenu",this.copySelectorListener)}copySelectorListener(e){e.stopPropagation();const t=this.getSelector(e.target);setImmediate((function(){let s=h.query(".contextMenu-HLZMGh");if(!s){const t=h.query("#app-mount"),n=h.createElement('
');s=h.createElement('
'),n.append(s),t.append(n),n.style.top=e.clientY+"px",n.style.left=e.clientX+"px",n.style.zIndex="1002";const i=function(e){e.keyCode&&27!==e.keyCode||(n.remove(),document.removeEventListener("click",i),document.removeEventListener("contextmenu",i),document.removeEventListener("keyup",i))};document.addEventListener("click",i),document.addEventListener("contextmenu",i),document.addEventListener("keyup",i)}const n=h.createElement('
'),i=h.createElement('
');i.append(h.createElement('
Copy Selector
')),i.addEventListener("click",()=>{f.ElectronModule.copy(t),s.style.display="none"}),n.append(i),s.append(n)}))}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(".")}`}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("*"))}},$t=new class extends Qe{get name(){return"Debugger"}get category(){return"developer"}get id(){return"debuggerHotkey"}enabled(){document.addEventListener("keydown",this.debugListener)}disabled(){document.removeEventListener("keydown",this.debugListener)}debugListener(e){119!==e.which&&118!=e.which||(e.preventDefault(),e.stopImmediatePropagation())}};const qt=s(0),Ht=s(2),Ut=s(1),_t=qt.remote.BrowserWindow,Wt=qt.remote.getCurrentWebContents();var Gt=new class extends Qe{get name(){return"ReactDevTools"}get category(){return"developer"}get id(){return"reactDevTools"}initialize(){super.initialize(),this.findExtension()}findExtension(){let e="";if(e="win32"===process.platform?Ut.resolve(process.env.LOCALAPPDATA,"Google/Chrome/User Data"):"linux"===process.platform?Ut.resolve(process.env.HOME,".config/google-chrome"):"darwin"===process.platform?Ut.resolve(process.env.HOME,"Library/Application Support/Google/Chrome"):Ut.resolve(process.env.HOME,".config/chromium"),e+="/Default/Extensions/fmkadmapgofadopljbjfkapdkoienihi/",Ht.existsSync(e)){const t=Ht.readdirSync(e);e=Ut.resolve(e,t[t.length-1])}this.extensionPath=e,this.isExtensionInstalled=Ht.existsSync(e),this.listener=this.listener.bind(this)}enabled(){if(this.isExtensionInstalled||this.findExtension(),!this.isExtensionInstalled)return oe.alert("Extension Not Found","Unable to find the React Developer Tools extension on your PC. Please install the extension on your local Chrome installation.");setImmediate(()=>Wt.on("devtools-opened",this.listener)),Wt.isDevToolsOpened()&&this.listener()}disabled(){Wt.removeListener("devtools-opened",this.listener)}listener(){if(!this.isExtensionInstalled)return;_t.removeDevToolsExtension("React Developer Tools"),_t.addDevToolsExtension(this.extensionPath)?this.log("Successfully installed react devtools."):this.error("Couldn't find react devtools in chrome extensions!")}};class Vt extends q.Component{render(){return q.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"}},q.createElement("metadata",null),q.createElement("defs",null,q.createElement("filter",{id:"shadow1"},q.createElement("feDropShadow",{dx:"20",dy:"0",stdDeviation:"20",floodColor:"rgba(0,0,0,0.35)"})),q.createElement("filter",{id:"shadow2"},q.createElement("feDropShadow",{dx:"15",dy:"0",stdDeviation:"20",floodColor:"rgba(255,255,255,0.15)"})),q.createElement("filter",{id:"shadow3"},q.createElement("feDropShadow",{dx:"10",dy:"0",stdDeviation:"20",floodColor:"rgba(0,0,0,0.35)"}))),q.createElement("g",null,q.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"}),q.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"}),q.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"})))}}const Jt=f.React,Yt=g.getByDisplayName("Tooltip");var Xt=new class{initialize(){u.suppressErrors(this.patchSocial.bind(this),"BD Social Patch")(),u.suppressErrors(this.patchGuildPills.bind(this),"BD Guild Pills Patch")(),u.suppressErrors(this.patchGuildListItems.bind(this),"BD Guild List Items Patch")(),u.suppressErrors(this.patchGuildSeparator.bind(this),"BD Guild Separator Patch")(),u.suppressErrors(this.patchMessageHeader.bind(this),"BD Message Header Patch")(),u.suppressErrors(this.patchMemberList.bind(this),"BD Member List Patch")()}patchSocial(){if(this.socialPatch)return;const e=g.getByDisplayName("TabBar"),t=g.getByDisplayName("Anchor");e&&(this.socialPatch=j.after("ComponentPatcher",e.prototype,"render",(e,s,n)=>{const o=n.props.children;if(!o||!o.length||o.length<3)return;if("Separator"!==o[o.length-3].type.displayName)return;if(!o[o.length-2].type.toString().includes("socialLinks"))return;if(t){const e=o[o.length-2].type,s=function(){const s=e(...arguments);return s.props.children.push(f.React.createElement(t,{className:"bd-social-link",href:"https://twitter.com/BandagedBD",title:"BandagedBD",target:"_blank"},f.React.createElement(Vt,{size:"16px",className:"bd-social-logo"}))),s};o[o.length-2].type=s}const r=f.React.createElement("div",{className:"colorMuted-HdFt4q size12-3cLvbJ"},`Injector ${i.version}`),a=`(${i.hash?i.hash.substring(0,7):i.branch})`,l=f.React.createElement("div",{className:"colorMuted-HdFt4q size12-3cLvbJ"},`BBD ${i.bbdVersion} `,f.React.createElement("span",{className:"versionHash-2gXjIB da-versionHash"},a)),d=o[o.length-1].type;o[o.length-1].type=function(){const e=d(...arguments);return e.props.children.splice(e.props.children.length-1,0,r),e.props.children.splice(1,0,l),e}}))}patchGuildListItems(){if(this.guildListItemsPatch)return;const e=f.GuildClasses.listItem.split(" ")[0],t=f.GuildClasses.blobContainer.split(" ")[0],s=u.getReactInstance(document.querySelector(`.${e} .${t}`).parentElement).return.type;s&&(this.guildListItemsPatch=j.after("ComponentPatcher",s.prototype,"render",(e,t,s)=>{if(!s||!e)return;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=g.getModule(e=>e.default&&!e.default.displayName&&e.default.toString&&e.default.toString().includes("translate3d"));e&&(this.guildPillPatch=j.after("ComponentPatcher",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=g.getByDisplayName("Guilds"),t=g.getByProps("renderListItem");if(!t||!e)return;const s=function(){const e=t.Separator(...arguments);return e.props.className+=" bd-guild-separator",e};this.guildSeparatorPatch=j.after("ComponentPatcher",e.prototype,"render",(e,t,n)=>{const i=u.findInReactTree(n,e=>e.type&&!e.type.displayName&&"function"==typeof e.type&&u.isEmpty(e.props));i&&(i.type=s)})}patchMessageHeader(){if(this.messageHeaderPatch)return;const e=g.getByProps("MessageTimestamp"),t=g.find(e=>"Anchor"==e.displayName);t&&e&&e.default&&(this.messageHeaderPatch=j.after("ComponentPatcher",e,"default",(e,s,n)=>{const i=u.getNestedProp(s[0],"message.author"),o=u.getNestedProp(n,"props.children.1.props.children.1.props.children");o&&i&&i.id&&"249746236008169473"===i.id&&Array.isArray(o)&&o.push(Jt.createElement(Yt,{color:"black",position:"top",text:"BandagedBD Developer"},e=>Jt.createElement(t,Object.assign({className:"bd-chat-badge",href:"https://github.com/rauenzi/BetterDiscordApp",title:"BandagedBD",target:"_blank"},e),Jt.createElement(Vt,{size:"16px",className:"bd-logo"}))))}))}patchMemberList(){if(this.memberListPatch)return;const e=g.findByDisplayName("MemberListItem"),t=g.find(e=>"Anchor"==e.displayName);t&&e&&e.prototype&&e.prototype.renderDecorators&&(this.memberListPatch=j.after("ComponentPatcher",e.prototype,"renderDecorators",(e,s,n)=>{const i=u.getNestedProp(e,"props.user"),o=u.getNestedProp(n,"props.children");o&&i&&i.id&&"249746236008169473"===i.id&&Array.isArray(o)&&o.push(Jt.createElement(Yt,{color:"black",position:"top",text:"BandagedBD Developer"},e=>Jt.createElement(t,Object.assign({className:"bd-member-badge",href:"https://github.com/rauenzi/BetterDiscordApp",title:"BandagedBD",target:"_blank"},e),Jt.createElement(Vt,{size:"16px",className:"bd-logo"}))))}))}};const Zt=f.GuildClasses;function Kt(){}Kt.prototype.setConfig=function(e){Object.assign(i,e)},Kt.prototype.init=async function(){if(S.initialize(),await A.initialize(),i.versioni.version&&oe.showConfirmationModal(N.Startup.updateAvailable,N.Startup.updateInfo.format({version:e}),{confirmText:N.Startup.updateNow,cancelText:N.Startup.maybeLater,onConfirm:async()=>{const e=()=>{oe.alert(N.Startup.updateFailed,N.Startup.manualUpdate)};try{if(!await this.updateInjector())return e();const t=s(0).remote.app;t.relaunch(),t.exit()}catch(t){e()}}}),c.log("Startup","Initializing Settings"),L.initialize(),D.initialize(),await this.waitForGuilds(),R.initialize(),Xt.initialize();for(const e in n)n[e].initialize();c.log("Startup","Loading Plugins");const t=Xe.initialize();c.log("Startup","Loading Themes");const o=Ke.initialize();c.log("Startup","Removing Loading Icon"),document.getElementsByClassName("bd-loaderv2")[0].remove(),c.log("Startup","Collecting Startup Errors"),oe.showAddonErrors({plugins:t,themes:o});const r=S.getBDData("version");i.bbdVersion>r&&(oe.showChangelogModal(l),S.setBDData("version",i.bbdVersion))},Kt.prototype.waitForGuilds=function(){let e=0;return new Promise(t=>{const s=function(){e++,"complete"!=document.readyState&&setTimeout(s,100);const n=Zt.wrapper.split(" ")[0],o=Zt.listItem.split(" ")[0],r=Zt.blobContainer.split(" ")[0];return document.querySelectorAll(`.${n} .${o} .${r}`).length>0||e>=50?t(i.deferLoaded=!0):void setTimeout(s,100)};s()})},Kt.prototype.updateInjector=async function(){const e=S.injectionPath;if(!e)return!1;const t=s(2),n=s(1),i=s(6),o=s(7),r=s(8),a=s(3),l=n.resolve(e,".."),d=n.basename(e),h="https://github.com/rauenzi/BetterDiscordApp/archive/injector.zip",u=n.resolve(l,"injector.zip"),p=n.resolve(l,"BetterDiscordApp-injector");c.log("InjectorUpdate","Downloading "+h);let m=await new Promise(e=>{a.get({url:h,encoding:null},async(s,n,i)=>{if(s||200!==n.statusCode)return e(!1);await new Promise(e=>t.exists(u,e))&&await new Promise(e=>t.rename(u,`${u}.bak${Math.round(performance.now())}`,e)),c.log("InjectorUpdate","Writing "+u),t.writeFile(u,i,t=>e(!t))})});if(!m)return m;await new Promise(e=>t.exists(p,e))&&await new Promise(e=>t.rename(p,`${p}.bak${Math.round(performance.now())}`,e));const g=await new Promise(e=>o.open(u,{lazyEntries:!0},(t,s)=>e(s)));g.on("entry",(function(e){if(e.fileName.endsWith("/"))return g.readEntry();c.log("InjectorUpdate","Extracting "+e.fileName);const s=n.resolve(l,e.fileName);r.sync(n.dirname(s)),g.openReadStream(e,(function(e,n){if(e)return m=!1;n.on("end",(function(){g.readEntry()})),n.pipe(t.createWriteStream(s))}))})),g.readEntry(),await new Promise(e=>g.once("end",e));const f=n.resolve(l,`${d}.bak${Math.round(performance.now())}`);return await new Promise(s=>t.rename(e,f,s)),c.log("InjectorUpdate",`Renaming ${n.basename(p)} to ${d}`),m=await new Promise(s=>t.rename(p,e,e=>s(!e))),m?m?(await new Promise(e=>i(f,e)),await new Promise(e=>t.unlink(u,e)),c.log("InjectorUpdate","Injector Updated!"),m):(c.err("InjectorUpdate","Something went wrong... restoring backups."),await new Promise(e=>i(p,e)),await new Promise(s=>t.rename(f,e,s)),m):(c.err("InjectorUpdate","Failed to rename the final directory"),m)};var Qt=new Kt;const es={get React(){return f.React},get ReactDOM(){return f.ReactDOM},get WindowConfigFile(){return""},get settings(){return L.collections},get emotes(){return{}},get version(){return i.version},getAllWindowPreferences:function(){return S.getData("windowprefs")||{}},getWindowPreference:function(e){return this.getAllWindowPreferences()[e]},setWindowPreference:function(e,t){const s=this.getAllWindowPreferences();return s[e]=t,S.setData("windowprefs",s)},injectCSS:function(e,t){D.injectStyle(e,t)},clearCSS:function(e){D.removeStyle(e)},linkJS:function(e,t){return D.injectScript(e,t)},unlinkJS:function(e){D.removeScript(e)},alert:function(e,t){oe.alert(e,t)},showConfirmationModal:function(e,t,s={}){return oe.showConfirmationModal(e,t,s)},showToast:function(e,t={}){W.show(e,t)},findModule:function(e){return g.getModule(e)},findAllModules:function(e){return g.getModule(e,!1)},findModuleByProps:function(...e){return g.getByProps(...e)},findModuleByPrototypes:function(...e){return g.getByPrototypes(...e)},findModuleByDisplayName:function(e){return g.getByDisplayName(e)},getInternalInstance:function(e){if(e instanceof window.jQuery||e instanceof Element)return e instanceof jQuery&&(e=e[0]),u.getReactInstance(e)},loadData:function(e,t){return S.getPluginData(e,t)}};es.getData=es.loadData,es.saveData=function(e,t,s){return S.setPluginData(e,t,s)},es.setData=es.saveData,es.deleteData=function(e,t){return S.deletePluginData(e,t)},es.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 c=e[t],h=()=>{a||console.log("unpatch",t,"of",d),e[t]=c};return e[t]=function(){const s={thisObject:this,methodArguments:arguments,cancelPatch:h,originalMethod:c,callOriginalMethod:()=>s.returnValue=s.originalMethod.apply(s.thisObject,s.methodArguments)};if(o){const n=u.suppressErrors(o,"`instead` callback of "+e[t].displayName)(s);void 0!==n&&(s.returnValue=n)}else n&&u.suppressErrors(n,"`before` callback of "+e[t].displayName)(s),s.callOriginalMethod(),i&&u.suppressErrors(i,"`after` callback of "+e[t].displayName)(s);return r&&h(),s.returnValue},e[t].__monkeyPatched=!0,e[t].__originalMethod||(e[t].__originalMethod=c),e[t].displayName="patched "+(e[t].displayName||t),h},es.onRemoved=function(e,t){return u.onRemoved(e,t)},es.suppressErrors=function(e,t){return u.suppressErrors(e,t)},es.testJSON=function(e){return u.testJSON(e)},es.getPlugin=function(e){return c.warn("BdApi","getPlugin is deprecated. Please make use of the addon api (BdApi.Plugins)"),Xe.addonList.find(t=>t.name==e)},es.isPluginEnabled=function(e){c.warn("BdApi","isPluginEnabled is deprecated. Please make use of the addon api (BdApi.Plugins)");const t=this.getPlugin(e);return!!t&&Xe.isEnabled(t.id)},es.isThemeEnabled=function(e){c.warn("BdApi","isThemeEnabled is deprecated. Please make use of the addon api (BdApi.Themes)");const t=Ke.addonList.find(t=>t.name==e);return!!t&&Ke.isEnabled(t.id)},es.isSettingEnabled=function(e,t,s){return L.get(e,t,s)},es.enableSetting=function(e,t,s){return L.set(e,t,s,!0)},es.disableSetting=function(e,t,s){return L.set(e,t,s,!1)},es.toggleSetting=function(e,t,s){return L.set(e,t,s,!L.get(e,t,s))},es.getBDData=function(e){return S.getBDData(e)},es.setBDData=function(e,t){return S.setBDData(e,t)};const ts=e=>new class{get folder(){return e.folder}isEnabled(t){return e.isEnabled(t)}enable(t){return e.enableAddon(t)}disable(t){return e.disableAddon(t)}toggle(t){return e.toggleAddon(t)}reload(t){return e.reloadAddon(t)}get(t){return e.addonList.find(e=>e.id==t||e.filename==t)}getAll(){return e.addonList}};es.Plugins=ts(Xe),es.Themes=ts(Ke),Object.freeze(es),Object.freeze(es.Plugins),Object.freeze(es.Themes);var ss=es;s.d(t,"default",(function(){return is})),function(){const e=Object.getOwnPropertyDescriptor(HTMLIFrameElement.prototype,"contentWindow").get;Object.defineProperty(HTMLIFrameElement.prototype,"contentWindow",{get:function(){const t=Reflect.apply(e,this,arguments);return new Proxy(t,{getOwnPropertyDescriptor:function(e,t){if("localStorage"!==t)return Object.getOwnPropertyDescriptor(e,t)},get:function(e,t){if("localStorage"===t)return null;const s=e[t];return"function"==typeof s?s.bind(e):s}})}}),Object.defineProperty(Reflect,"apply",{value:Reflect.apply,writable:!1,configurable:!1}),Object.defineProperty(Function.prototype,"bind",{value:Function.prototype.bind,writable:!1,configurable:!1});const t=XMLHttpRequest.prototype.open;XMLHttpRequest.prototype.open=function(){const e=arguments[1];return e.toLowerCase().includes("api/webhooks")?null:Reflect.apply(t,this,arguments)}}();const ns=document.createElement("div");ns.className="bd-loaderv2",ns.title="BandagedBD is loading...",document.body.appendChild(ns),window.BdApi=ss,window.pluginModule=Xe,window.themeModule=Ke,window.bdEmotes=Ot.Emotes,window.bemotes=Ot.blacklist,window.settingsModule=L,window.DataStore=S,window.DomManager=D,window.utils=u,window.Components=R,window.BDEvents=y,window.bdConfig=i,window.Strings=N;class is{constructor(e){Qt.setConfig(e)}init(){Qt.init()}}!function(){const e="betterdiscord/",t=s(4),n=t._load;t._load=function(t){if("betterdiscord"===t||t.startsWith(e)){if("api"==t.substr(e.length))return ss}return n.apply(this,arguments)}}()}]).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=9)}([function(e,t){e.exports=require("electron")},function(e,t){e.exports=require("path")},function(e,t){e.exports=require("fs")},function(e,t){e.exports=require("request")},function(e,t){e.exports=require("module")},function(e,t){e.exports=require("events")},function(e,t){e.exports=require("rimraf")},function(e,t){e.exports=require("yauzl")},function(e,t){e.exports=require("mkdirp")},function(e,t,s){"use strict";s.r(t);var n={};s.r(n),s.d(n,"CustomCSS",(function(){return at})),s.d(n,"WindowPrefs",(function(){return lt})),s.d(n,"TwentyFourHour",(function(){return dt})),s.d(n,"ClassNormalizer",(function(){return ht})),s.d(n,"PublicServers",(function(){return Ct})),s.d(n,"VoiceDisconnect",(function(){return St})),s.d(n,"ColoredText",(function(){return Pt})),s.d(n,"DarkMode",(function(){return xt})),s.d(n,"MinimalMode",(function(){return kt})),s.d(n,"VoiceMode",(function(){return At})),s.d(n,"EmoteModule",(function(){return Ot})),s.d(n,"EmoteMenu",(function(){return zt})),s.d(n,"CopySelector",(function(){return Rt})),s.d(n,"Debugger",(function(){return $t})),s.d(n,"ReactDevTools",(function(){return Gt}));var i={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",debuggerHotkey:{name:"Debugger Hotkey",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'},reactDevTools:{name:"React Developer Tools",note:"Injects your local installation of React Developer Tools into Discord"}},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",invite:"Support Server",donate:"Donate",patreon:"Patreon",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",restartRequired:"Restart Required",restartNow:"Restart Now",restartLater:"Restart Later",additionalInfo:"Additional Info"},Sorting:{sortBy:"Sort By",order:"Order",ascending:"Ascending",descending:"Descending"},WindowPrefs:{enabledInfo:"This option requires a transparent theme in order to work properly. On Windows this may break your aero snapping and maximizing.\n\nIn order to take effect, Discord needs to be restarted. Do you want to restart now?",disabledInfo:"In order to take effect, Discord needs to be restarted. Do you want to restart now?"},Startup:{notSupported:"Not Supported",versionMismatch:"BandagedBD Injector v{{injector}} is not supported by the latest remote (v{{remote}}).\n\nPlease download the latest version from [GitHub](https://github.com/rauenzi/BetterDiscordApp/releases/latest)",incompatibleApp:"BandagedBD does not work with {{app}}. Please uninstall one of them.",updateNow:"Update Now",maybeLater:"Maybe Later",updateAvailable:"Update Available",updateInfo:"There is an update available for BandagedBD's Injector ({{version}}).\n\nYou can either update and restart now, or later.",updateFailed:"Could Not Update",manualUpdate:"Unable to update automatically, please download the installer and reinstall normally.\n\n[Download Installer](https://github.com/rauenzi/BetterDiscordApp/releases/latest)"}},o={local:!1,localServer:"//localhost:8080",minified:!0,version:"0.3.0",branch:"master",repo:"rauenzi",minSupportedVersion:"0.3.0",bbdVersion:"1.0.0"},r=[{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:"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}]}],a=[{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:"debuggerHotkey",value:!1},{type:"switch",id:"copySelector",value:!1},{type:"switch",id:"reactDevTools",value:!1}]},{type:"category",id:"window",collapsible:!0,shown:!1,settings:[{type:"switch",id:"transparency",value:!1},{type:"switch",id:"frame",value:!1,hidden:!0}]}],l={description:"Don't be shocked, this modal is supposed to be here.",changes:[{title:"What's New?",items:["**BandagedBD will now keep you updated with changelogs!** I will try to only show a changelog when there's more than a tiny or internal change.","**Twitter (@BandagedBD)** I created a Twitter to try and provide support and such for those without access to the server. https://Twitter.com/BandagedBD"]},{title:"Fixes",type:"fixed",items:["**Colored Text** option should work again.","**Emotes** should show up in chat.","Fixed a bug where BBD attempted to patch the TabBar module incorrectly. (Thanks, DevilBro)"]},{title:"Minor Stuff",type:"improved",items:["**Colour->Color.** Swapped to using English-US spelling by default to be consistent, and to potentially be prepared for localization.","**Versions simplified.** The BandagedBD version now integrates into Discord's at the bottom-left of settings instead of randomly being a part of the setting list."]}]};const d={err:"error",error:"error",dbg:"debug",debug:"debug",log:"log",warn:"warn",info:"info"};class c{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){c._log(e,t,"error")}static warn(e,...t){c._log(e,t,"warn")}static info(e,...t){c._log(e,t,"info")}static debug(e,...t){c._log(e,t,"debug")}static log(e,...t){c._log(e,t)}static _log(e,t,s="log"){s=c.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 d.hasOwnProperty(e)?d[e]:"log"}}class h{static escapeID(e){return e.replace(/^[^a-z]+|[^\w-]+/gi,"-")}static addStyle(e,t){document.head.append(h.createElement(``))}static removeStyle(e){const t=document.getElementById(e);t&&t.remove()}static addScript(e,t){return new Promise(s=>{const n=document.createElement("script");n.id=e,n.src=t,n.type="text/javascript",n.onload=s,document.head.append(n)})}static removeScript(e){e=this.escapeID(e);const t=document.getElementById(e);t&&t.remove()}static animate({timing:e=(e=>e),update:t,duration:s}){const n=performance.now();requestAnimationFrame((function i(o){let r=(o-n)/s;r>1&&(r=1);const a=e(r);t(a),r<1&&requestAnimationFrame(i)}))}static Q(e){const t=this.parseHTML(e);return(t instanceof NodeList?Array.from(t).some(e=>1===e.nodeType):1===t.nodeType)?t:this.query(e)}static query(e,t){return t||(t=document),t.querySelector(e)}static queryAll(e,t){return t||(t=document),t.querySelectorAll(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 createElement(e,t=!1){return this.parseHTML(e,t)}static escapeHTML(e){const t=document.createTextNode(""),s=document.createElement("span");return s.append(t),t.nodeValue=e,s.innerHTML}static addClass(e,...t){t=t.flat().filter(e=>e);for(let e=0;ee),e.classList.add(...t),e}static removeClass(e,...t){for(let e=0;ee),e.classList.remove(...t),e}static toggleClass(e,t,s){return t=t.toString().split(" ").filter(e=>e),void 0!==s?t.forEach(t=>e.classList.toggle(t,s)):t.forEach(t=>e.classList.toggle(t)),e}static hasClass(e,t){return t.toString().split(" ").filter(e=>e).every(t=>e.classList.contains(t))}static replaceClass(e,t,s){return e.classList.replace(t,s),e}static appendTo(e,t){return"string"==typeof t&&(t=this.query(t)),t?(t.append(e),e):null}static prependTo(e,t){return"string"==typeof t&&(t=this.query(t)),t?(t.prepend(e),e):null}static insertAfter(e,t){return t.parentNode.insertBefore(e,t.nextSibling),e}static after(e,t){return e.parentNode.insertBefore(t,e.nextSibling),e}static next(e,t=""){return t?e.querySelector("+ "+t):e.nextElementSibling}static nextAll(e){return e.querySelectorAll("~ *")}static nextUntil(e,t){const s=[];for(;e.nextElementSibling&&!e.nextElementSibling.matches(t);)s.push(e=e.nextElementSibling);return s}static previous(e,t=""){const s=e.previousElementSibling;return t?s&&s.matches(t)?s:null:s}static previousAll(e){const t=[];for(;e.previousElementSibling;)t.push(e=e.previousElementSibling);return t}static previousUntil(e,t){const s=[];for(;e.previousElementSibling&&!e.previousElementSibling.matches(t);)s.push(e=e.previousElementSibling);return s}static indexInParent(e){const t=e.parentNode.childNodes;let s=0;for(let n=0;n "+t)}static findChildren(e,t){return e.querySelectorAll(":scope > "+t)}static parents(e,t=""){const s=[];if(t)for(;e.parentElement&&e.parentElement.closest(t);)s.push(e=e.parentElement.closest(t));else for(;e.parentElement;)s.push(e=e.parentElement);return s}static parentsUntil(e,t){const s=[];for(;e.parentElement&&!e.parentElement.matches(t);)s.push(e=e.parentElement);return s}static siblings(e,t="*"){return Array.from(e.parentElement.children).filter(s=>s!=e&&s.matches(t))}static css(e,t,s){return void 0===s?global.getComputedStyle(e)[t]:(e.style[t]=s,e)}static width(e,t){return void 0===t?parseInt(getComputedStyle(e).width):(e.style.width=t,e)}static height(e,t){return void 0===t?parseInt(getComputedStyle(e).height):(e.style.height=t,e)}static text(e,t){return void 0===t?e.textContent:e.textContent=t}static innerWidth(e){return e.clientWidth}static innerHeight(e){return e.clientHeight}static outerWidth(e){return e.offsetWidth}static outerHeight(e){return e.offsetHeight}static offset(e){return e.getBoundingClientRect()}static get listeners(){return this._listeners||(this._listeners={})}static on(e,t,s,n){const[i,o]=t.split("."),r=s&&n;n||(n=s);const a=r?function(e){e.target.matches(s)&&n(e)}:n;e.addEventListener(i,a);const l=()=>{e.removeEventListener(i,a)};if(o){this.listeners[o]||(this.listeners[o]=[]);const t=()=>{l(),this.listeners[o].splice(this.listeners[o].findIndex(t=>t.event==i&&t.element==e),1)};return this.listeners[o].push({event:i,element:e,cancel:t}),t}return l}static once(e,t,s,n){const[i,o]=t.split("."),r=s&&n;n||(n=s);const a=r?function(t){t.target.matches(s)&&(n(t),e.removeEventListener(i,a))}:function(t){n(t),e.removeEventListener(i,a)};e.addEventListener(i,a);const l=()=>{e.removeEventListener(i,a)};if(o){this.listeners[o]||(this.listeners[o]=[]);const t=()=>{l(),this.listeners[o].splice(this.listeners[o].findIndex(t=>t.event==i&&t.element==e),1)};return this.listeners[o].push({event:i,element:e,cancel:t}),t}return l}static __offAll(e,t){const[s,n]=e.split(".");let i=e=>e.event==s,o=e=>e;t&&(i=e=>e.event==s&&e.element==t,o=e=>e.element==t);const r=this.listeners[n]||[],a=s?r.filter(i):r.filter(o);for(let e=0;e{this.observer.unsubscribe(n),t()};return this.observer.subscribe(n,t=>{const n=Array.from(s?t.addedNodes:t.removedNodes),i=n.indexOf(e)>-1,o=n.some(t=>t.contains(e));return i||o}),e}static onMount(e,t){return this.onMountChange(e,t)}static onUnmount(e,t){return this.onMountChange(e,t,!1)}static onAdded(e,t){return this.onMount(e,t)}static onRemoved(e,t){return this.onUnmount(e,t,!1)}static wrap(e){const t=this.parseHTML('
');for(let s=0;s1?n.childNodes:n.childNodes[0]}static getTextArea(){return h.query(".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){c.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)?c.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 p{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))}}const m=e=>{if(e.remove&&e.set&&e.clear&&e.get&&!e.sort)return null;if(!e.getToken&&!e.getEmail&&!e.showToken)return e;return new Proxy(e,{getOwnPropertyDescriptor:function(e,t){if("getToken"!==t&&"getEmail"!==t&&"showToken"!==t)return Object.getOwnPropertyDescriptor(e,t)},get:function(e,t){return"getToken"==t?()=>"mfa.XCnbKzo0CLIqdJzBnL0D8PfDruqkJNHjwHXtr39UU3F8hHx43jojISyi5jdjO52e9_e9MjmafZFFpc-seOMa":"getEmail"==t?()=>"puppet11112@gmail.com":"showToken"==t?()=>!0:e[t]}})};class g{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 m(a);n.push(m(a))}}return t||0==n.length?void 0:n}static getModules(e){return this.getModule(e,!1)}static getByDisplayName(e){return this.getModule(p.byDisplayName(e),!0)}static getByRegex(e,t=!0){return this.getModule(p.byCode(e),t)}static getByPrototypes(...e){return this.getModule(p.byPrototypeFields(e),!0)}static getAllByPrototypes(...e){return this.getModule(p.byPrototypeFields(e),!1)}static getByProps(...e){return this.getModule(p.byProperties(e),!0)}static getAllByProps(...e){return this.getModule(p.byProperties(e),!1)}static getByString(...e){return this.getModule(p.byString(...e),!0)}static getAllByString(...e){return this.getModule(p.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 f=u.memoizeObject({get React(){return g.getByProps("createElement","cloneElement")},get ReactDOM(){return g.getByProps("render","findDOMNode")},get Flux(){return g.getByProps("connectStores")},get Events(){return g.getByPrototypes("setMaxListeners","emit")},get GuildStore(){return g.getByProps("getGuild")},get SortedGuildStore(){return g.getByProps("getSortedGuilds")},get SelectedGuildStore(){return g.getByProps("getLastSelectedGuildId")},get GuildSync(){return g.getByProps("getSyncedGuilds")},get GuildInfo(){return g.getByProps("getAcronym")},get GuildChannelsStore(){return g.getByProps("getChannels","getDefaultChannel")},get GuildMemberStore(){return g.getByProps("getMember")},get MemberCountStore(){return g.getByProps("getMemberCounts")},get GuildEmojiStore(){return g.getByProps("getEmojis")},get GuildActions(){return g.getByProps("markGuildAsRead")},get GuildPermissions(){return g.getByProps("getGuildPermissions")},get ChannelStore(){return g.getByProps("getChannels","getDMFromUserId")},get SelectedChannelStore(){return g.getByProps("getLastSelectedChannelId")},get ChannelActions(){return g.getByProps("selectChannel")},get PrivateChannelActions(){return g.getByProps("openPrivateChannel")},get ChannelSelector(){return g.getByProps("selectGuild","selectChannel")},get UserInfoStore(){return g.getByProps("getToken")},get UserSettingsStore(){return g.getByProps("guildPositions")},get AccountManager(){return g.getByProps("register","login")},get UserSettingsUpdater(){return g.getByProps("updateRemoteSettings")},get OnlineWatcher(){return g.getByProps("isOnline")},get CurrentUserIdle(){return g.getByProps("getIdleTime")},get RelationshipStore(){return g.getByProps("isBlocked","getFriendIDs")},get RelationshipManager(){return g.getByProps("addRelationship")},get MentionStore(){return g.getByProps("getMentions")},get UserStore(){return g.getByProps("getCurrentUser")},get UserStatusStore(){return g.getByProps("getStatus","getState")},get UserTypingStore(){return g.getByProps("isTyping")},get UserActivityStore(){return g.getByProps("getActivity")},get UserNameResolver(){return g.getByProps("getName")},get UserNoteStore(){return g.getByProps("getNote")},get UserNoteActions(){return g.getByProps("updateNote")},get EmojiInfo(){return g.getByProps("isEmojiDisabled")},get EmojiUtils(){return g.getByProps("getGuildEmoji")},get EmojiStore(){return g.getByProps("getByCategory","EMOJI_NAME_RE")},get InviteStore(){return g.getByProps("getInvites")},get InviteResolver(){return g.getByProps("findInvite")},get InviteActions(){return g.getByProps("acceptInvite")},get DiscordConstants(){return g.getByProps("Permissions","ActivityTypes","StatusTypes")},get DiscordPermissions(){return g.getByProps("Permissions","ActivityTypes","StatusTypes").Permissions},get PermissionUtils(){return g.getByProps("getHighestRole")},get ColorConverter(){return g.getByProps("hex2int")},get ColorShader(){return g.getByProps("darken")},get TinyColor(){return g.getByPrototypes("toRgb")},get ClassResolver(){return g.getByProps("getClass")},get ButtonData(){return g.getByProps("ButtonSizes")},get IconNames(){return g.getByProps("IconNames")},get NavigationUtils(){return g.getByProps("transitionTo","replaceWith","getHistory")},get MessageStore(){return g.getByProps("getMessages")},get MessageActions(){return g.getByProps("jumpToMessage","_sendMessage")},get MessageQueue(){return g.getByProps("enqueue")},get MessageParser(){return g.getByProps("createMessage","parse","unparse")},get hljs(){return g.getByProps("highlight","highlightBlock")},get SimpleMarkdown(){return g.getByProps("parseBlock","parseInline","defaultOutput")},get ExperimentStore(){return g.getByProps("getExperimentOverrides")},get ExperimentsManager(){return g.getByProps("isDeveloper")},get CurrentExperiment(){return g.getByProps("getExperimentId")},get ImageResolver(){return g.getByProps("getUserAvatarURL","getGuildIconURL")},get ImageUtils(){return g.getByProps("getSizedImageSrc")},get AvatarDefaults(){return g.getByProps("getUserAvatarURL","DEFAULT_AVATARS")},get WindowInfo(){return g.getByProps("isFocused","windowSize")},get TagInfo(){return g.getByProps("VALID_TAG_NAMES")},get DOMInfo(){return g.getByProps("canUseDOM")},get LocaleManager(){return g.getByProps("setLocale")},get Moment(){return g.getByProps("parseZone")},get LocationManager(){return g.getByProps("createLocation")},get Timestamps(){return g.getByProps("fromTimestamp")},get TimeFormatter(){return g.getByProps("dateFormat")},get Strings(){return g.getByProps("Messages").Messages},get StringFormats(){return g.getByProps("a","z")},get StringUtils(){return g.getByProps("toASCII")},get URLParser(){return g.getByProps("Url","parse")},get ExtraURLs(){return g.getByProps("getArticleURL")},get DNDActions(){return g.getByProps("beginDrag")},get DNDSources(){return g.getByProps("addTarget")},get DNDObjects(){return g.getByProps("DragSource")},get MediaDeviceInfo(){return g.getByProps("Codecs","SUPPORTED_BROWSERS")},get MediaInfo(){return g.getByProps("getOutputVolume")},get MediaEngineInfo(){return g.getByProps("MediaEngineFeatures")},get VoiceInfo(){return g.getByProps("EchoCancellation")},get VideoStream(){return g.getByProps("getVideoStream")},get SoundModule(){return g.getByProps("playSound")},get ElectronModule(){return g.getByProps("setBadge")},get Dispatcher(){return g.getByProps("dirtyDispatch")},get PathUtils(){return g.getByProps("hasBasename")},get NotificationModule(){return g.getByProps("showNotification")},get RouterModule(){return g.getByProps("Router")},get APIModule(){return g.getByProps("getAPIBaseURL")},get AnalyticEvents(){return g.getByProps("AnalyticEventConfigs")},get KeyGenerator(){return g.getByRegex(/"binary"/)},get Buffers(){return g.getByProps("Buffer","kMaxLength")},get DeviceStore(){return g.getByProps("getDevices")},get SoftwareInfo(){return g.getByProps("os")},get CurrentContext(){return g.getByProps("setTagsContext")},get GuildClasses(){const e=g.getByProps("wrapper","unreadMentionsBar"),t=g.getByProps("guildsError","selected"),s=g.getByProps("blobContainer");return Object.assign({},e,t,s)},get LayerStack(){return g.getByProps("pushLayer")}});const b=s(5);var y=new class extends b{constructor(){super(),this.setMaxListeners(20)}dispatch(e,...t){this.emit(e,...t)}};const v=s(2),w=s(1),C=DiscordNative.globals?DiscordNative.globals.releaseChannel:DiscordNative.app?DiscordNative.app.getReleaseChannel():"stable";var S=new class{constructor(){this.data={misc:{}},this.pluginData={},this.cacheData={}}initialize(){v.existsSync(this.baseFolder)||v.mkdirSync(this.baseFolder),v.existsSync(this.dataFolder)||v.mkdirSync(this.dataFolder),v.existsSync(this.localeFolder)||v.mkdirSync(this.localeFolder),v.existsSync(this.emoteFolder)||v.mkdirSync(this.emoteFolder),v.existsSync(this.cacheFile)||v.writeFileSync(this.cacheFile,JSON.stringify({})),v.existsSync(this.customCSS)||v.writeFileSync(this.customCSS,"");const e=v.readdirSync(this.dataFolder).filter(e=>!v.statSync(w.resolve(this.dataFolder,e)).isDirectory()&&e.endsWith(".json"));for(const t of e)this.data[t.split(".")[0]]=require(w.resolve(this.dataFolder,t));this.cacheData=u.testJSON(v.readFileSync(this.cacheFile).toString())||{}}get injectionPath(){if(this._injectionPath)return this._injectionPath;const e=s(0).remote.app,t=e.getAppPath(),n=e.getPath("userData"),i=w.resolve(n,e.getVersion(),"modules","discord_desktop_core","injector"),o=w.resolve(t,"..","app"),r=v.existsSync(o)?o:v.existsSync(i)?i:null;return this._injectionPath=r||null}get customCSS(){return this._customCSS||(this._customCSS=w.resolve(this.dataFolder,"custom.css"))}get baseFolder(){return this._baseFolder||(this._baseFolder=w.resolve(o.dataPath,"data"))}get dataFolder(){return this._dataFolder||(this._dataFolder=w.resolve(this.baseFolder,`${C}`))}get localeFolder(){return this._localeFolder||(this._localeFolder=w.resolve(this.baseFolder,"locales"))}get emoteFolder(){return this._emoteFolder||(this._emoteFolder=w.resolve(this.baseFolder,"emotes"))}get cacheFile(){return this._cacheFile||(this._cacheFile=w.resolve(this.baseFolder,".cache"))}getPluginFile(e){return w.resolve(o.dataPath,"plugins",e+".config.json")}_getFile(e){return"settings"==e||"plugins"==e||"themes"==e||"window"==e?w.resolve(this.dataFolder,`${e}.json`):w.resolve(this.dataFolder,"misc.json")}getBDData(e){return this.data.misc[e]||""}setBDData(e,t){this.data.misc[e]=t,v.writeFileSync(w.resolve(this.dataFolder,"misc.json"),JSON.stringify(this.data.misc,null,4))}getLocale(e){const t=w.resolve(this.localeFolder,`${e}.json`);return v.existsSync(t)?u.testJSON(v.readFileSync(t).toString()):null}saveLocale(e,t){v.writeFileSync(w.resolve(this.localeFolder,`${e}.json`),JSON.stringify(t,null,4))}getCacheHash(e,t){return this.cacheData[e]&&v.existsSync(w.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,v.writeFileSync(this.cacheFile,JSON.stringify(this.cacheData))}invalidateCache(e,t){this.cacheData[e]&&(delete this.cacheData[e][t],v.writeFileSync(this.cacheFile,JSON.stringify(this.cacheData)))}emotesExist(e){return v.existsSync(w.resolve(this.emoteFolder,`${e}.json`))}getEmoteData(e){const t=w.resolve(this.emoteFolder,`${e}.json`);return v.existsSync(t)?u.testJSON(v.readFileSync(t).toString()):null}saveEmoteData(e,t){v.writeFileSync(w.resolve(this.emoteFolder,`${e}.json`),JSON.stringify(t))}getData(e){return this.data[e]||""}setData(e,t){this.data[e]=t,v.writeFileSync(w.resolve(this.dataFolder,`${e}.json`),JSON.stringify(t,null,4))}loadCustomCSS(){return v.readFileSync(this.customCSS).toString()}saveCustomCSS(e){return v.writeFileSync(this.customCSS,e)}getPluginData(e,t){return void 0!==this.pluginData[e]?this.pluginData[e][t]||void 0:v.existsSync(this.getPluginFile(e))?(this.pluginData[e]=JSON.parse(v.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,v.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],v.writeFileSync(this.getPluginFile(e),JSON.stringify(this.pluginData[e],null,4))}};const E=s(3),{Dispatcher:P,DiscordConstants:x,UserSettingsStore:k}=f;var A=new class{get discordLocale(){return k.locale.split("-")[0]}get defaultLocale(){return"en"}constructor(){this.locale="",this.strings={}}async initialize(){await this.setLocale(this.discordLocale),P.subscribe(x.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),!t)return this.setLocale(this.defaultLocale)}else t=i;this.locale=e,u.extend(this.strings,t),y.emit("strings-updated")}async getLocaleStrings(e){const t=S.getCacheHash("locales",e);if(!t)return await this.downloadLocale(e);const s=await this.downloadLocale(e,t);return s||S.getLocale(e)}downloadLocale(e,t=""){return new Promise(s=>{const n={url:u.repoUrl(`data/locales/${e}.json`),timeout:2e3,json:!0};t&&(n.headers={"If-None-Match":t}),E.get(n,(t,n,i)=>{if(t||200!==n.statusCode)return s(null);S.saveLocale(e,i),S.setCacheHash("locales",e,n.headers.etag),s(i)})})}};class D{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 M extends String{format(e){return u.formatString(this,e)}}var N=new Proxy(A.strings,{get:function(e,t){return e.hasOwnProperty(t)?new Proxy(e[t],{get:function(e,t){return"string"==typeof e[t]?new M(e[t]):e[t]}}):new Proxy({},{get:function(){return`String group "${t}" not found.`}})}}),L=new class{constructor(){this.state={},this.collections=[],this.panels=[],this.updateStrings=this.updateStrings.bind(this)}initialize(){this.registerCollection("settings","Settings",a),y.on("strings-updated",this.updateStrings)}registerCollection(e,t,s,n=null){if(this.collections.find(t=>t.id==e))return c.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 c.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 c.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 f.React.Component?()=>f.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 c.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){S.setData(e,this.state[e])}loadCollection(e){const t=S.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,y.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 y.on("setting-updated",i),()=>{y.off("setting-updated",i)}}updateStrings(){for(let e=0;e"before"===e.type))try{t.callback(this,arguments)}catch(s){c.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){c.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 e=s.callback(this,arguments,t);void 0!==e&&(t=e)}catch(t){c.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 F=f.React,O={},I=new Set,z=new Set;var R=new class{get named(){return O}get unknown(){return I}get listeners(){return z}constructor(){j.after("ReactComponents",F,"createElement",(e,t,s)=>{this.walkRenderTree(s)}),j.instead("ReactComponents",F.Component.prototype,"componentWillMount",e=>{this.addComponent(e.constructor)}),j.instead("ReactComponents",F.Component.prototype,"UNSAFE_componentWillMount",e=>{this.addComponent(e.constructor)}),j.instead("ReactComponents",F.PureComponent.prototype,"componentWillMount",e=>{this.addComponent(e.constructor)}),j.instead("ReactComponents",F.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(O[e])return s(O[e]);if(z.add({name:e,filter:t,resolve:s}),t)for(const s of I)t(s)&&(s.displayName=e,I.delete(s),this.addNamedComponent(s))})}addNamedComponent(e){const t=e.displayName;if(!O[t]){O[t]=e;for(const s of z)s.name===t&&(s.resolve(e),z.delete(s))}}addUnknownComponent(e){if(!I.has(e)){for(const t of z)t.filter&&t.filter(e)&&(e.displayName=t.name,this.addNamedComponent(e));e.displayName||I.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 q=f.React,H=f.ReactDOM,U=g.getByProps("sidebar","hasNotice").sidebar.split(" ")[0],_=g.getByProps("membersWrap").membersWrap.split(" ")[0];class W{static get shouldShowToasts(){return L.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(`.${U} + div`),t=e.querySelector(`.${_}`),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 G extends q.Component{constructor(e){super(e),this.onClick=this.onClick.bind(this),this.state={checked:this.props.checked||!1}}render(){return q.createElement("div",{className:"checkbox-item"},q.createElement("div",{className:"checkbox-label label-JWQiNe da-label"},this.props.text),q.createElement("div",{className:"checkbox-wrapper checkbox-3kaeSU da-checkbox checkbox-3EVISJ da-checkbox",onClick:this.onClick},q.createElement("div",{className:"checkbox-inner checkboxInner-3yjcPe da-checkboxInner"},q.createElement("input",{className:"checkbox checkboxElement-1qV33p da-checkboxElement",checked:this.state.checked,type:"checkbox"}),q.createElement("span",null)),q.createElement("span",null)))}onClick(){this.props.onChange(!this.state.checked),this.setState({checked:!this.state.checked})}}function V(){return(V=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==Z.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 q.createElement(G,{text:e.label,onChange:e.onChange,checked:e.checked})}makeButton(e){return q.createElement(J,{color:"black",position:"top",text:e.tooltip},t=>q.createElement("button",V({},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 q.createElement("div",{id:"bd-editor-panel",className:this.props.theme},q.createElement("div",{id:"bd-editor-controls"},q.createElement("div",{className:"controls-section controls-left"},e),q.createElement("div",{className:"controls-section controls-right"},t)),q.createElement("div",{className:"editor-wrapper"},q.createElement("div",{id:this.props.id,className:"editor "+this.props.theme},this.props.value)))}}class K extends q.Component{render(){const e=this.props.size||"24px";return q.createElement("svg",{viewBox:"0 0 24 24",style:{width:e,height:e}},q.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),q.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 Q extends q.Component{render(){const e=this.props.size||"24px";return q.createElement("svg",{viewBox:"0 0 24 24",fill:"#FFFFFF",style:{width:e,height:e},onClick:this.props.onClick},q.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"}),q.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}))}}class ee extends q.Component{render(){const e=this.props.size||"20px";return q.createElement("svg",{viewBox:"0 0 20 20",style:{width:e,height:e}},q.createElement("path",{fill:"none",d:"M0 0h20v20H0V0z"}),q.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 te extends q.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:q.createElement(K,{size:"18px"}),tooltip:N.CustomCSS.save,onClick:this.save},{label:q.createElement(Q,{size:"18px"}),tooltip:N.CustomCSS.openNative,onClick:this.openNative},{label:q.createElement(ee,{size:"18px"}),tooltip:N.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 q.createElement(Z,{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 se{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 ne extends q.Component{render(){return q.createElement("svg",{viewBox:"0 0 12 12",style:{width:"18px",height:"18px"}},q.createElement("g",{className:"background",fill:"none",fillRule:"evenodd"},q.createElement("path",{d:"M0 0h12v12H0"}),q.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 ie extends q.Component{render(){const e=this.props.size||"24px";return q.createElement("svg",{className:this.props.className||"",fill:"#FFFFFF",viewBox:"0 0 24 24",style:{width:e,height:e},onClick:this.props.onClick},q.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),q.createElement("path",{d:"M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z"}))}}class oe{static get shouldShowAddonErrors(){return L.get("settings","addons","addonErrors")}static get ModalStack(){return g.getByProps("push","update","pop","popWithKey")}static get AlertModal(){return g.getByPrototypes("handleCancel","handleSubmit","handleMinorConfirm")}static get TextElement(){return g.getByProps("Sizes","Weights")}static get ConfirmationModal(){return g.getModule(e=>e.defaultProps&&e.key&&"confirm-modal"==e.key())}static get Markdown(){return g.findByDisplayName("Markdown")}static default(e,t){const s=h.createElement(`
\n
\n \n
`);s.querySelector(".footer button").addEventListener("click",()=>{s.classList.add("closing"),setTimeout(()=>{s.remove()},300)}),s.querySelector(".bd-backdrop").addEventListener("click",()=>{s.classList.add("closing"),setTimeout(()=>{s.remove()},300)}),document.querySelector("#app-mount").append(s)}static alert(e,t){this.showConfirmationModal(e,t)}static showConfirmationModal(e,t,s={}){const n=this.Markdown,i=this.ConfirmationModal,o=this.ModalStack;if(t instanceof M&&(t=t.toString()),!this.ModalStack||!this.ConfirmationModal||!this.Markdown)return this.default(e,t);const r=()=>{},{onConfirm:a=r,onCancel:l=r,confirmText:d=N.Modals.okay,cancelText:c=N.Modals.cancel,danger:h=!1,key:u}=s;return Array.isArray(t)||(t=[t]),t=t.map(e=>"string"==typeof e?q.createElement(n,null,e):e),o.push(i,{header:e,children:t,red:h,confirmText:d,cancelText:c,onConfirm:a,onCancel:l},u)}static showAddonErrors({plugins:e=[],themes:t=[]}){if(!e||!t||!this.shouldShowAddonErrors)return;if(!e.length&&!t.length)return;const s=h.createElement(`
\n
\n \n
`),n=function(e){const t=h.createElement('
');for(const s of e){const e=h.createElement(`
\n
${s.name?s.name:s.file}
\n
${s.message}
\n \n
`);t.append(e),s.error&&e.querySelectorAll("a").forEach(e=>e.addEventListener("click",e=>{e.preventDefault(),c.stacktrace("AddonError",`Error details for ${s.name?s.name:s.file}.`,s.error)}))}return t},i=[n(e),n(t)];s.querySelectorAll(".tab-bar-item").forEach(e=>e.addEventListener("click",e=>{e.preventDefault();const t=s.querySelector(".tab-bar-item.selected");t&&h.removeClass(t,"selected"),h.addClass(e.target,"selected");const n=s.querySelector(".scroller");n.innerHTML="",n.append(i[h.index(e.target)])})),s.querySelector(".footer button").addEventListener("click",()=>{h.addClass(s,"closing"),setTimeout(()=>{s.remove()},300)}),s.querySelector(".bd-backdrop").addEventListener("click",()=>{h.addClass(s,"closing"),setTimeout(()=>{s.remove()},300)}),h.query("#app-mount").append(s),e.length?s.querySelector(".tab-bar-item").click():s.querySelectorAll(".tab-bar-item")[1].click()}static showChangelogModal(e={}){const t=g.getByProps("push","update","pop","popWithKey"),s=g.getByProps("fixed","improved"),n=g.findByDisplayName("Text"),i=g.getByProps("Child"),r=g.getByProps("Tags","default"),a=g.getModule(e=>e.defaultProps&&0==e.defaultProps.selectable),l=g.getByProps("defaultRules","parse");if(!(a&&t&&s&&n&&i&&r&&l))return c.warn("Modals","showChangelogModal missing modules");const{image:d="https://repository-images.githubusercontent.com/105473537/957b5480-7c26-11e9-8401-50fa820cbae5",description:h="",changes:u=[],title:p="BandagedBD",subtitle:m=`v${o.bbdVersion}`,footer:b}=e,y=q.createElement,v=[y("img",{src:d})];h&&v.push(y("p",null,l.parse(h)));for(let e=0;ey("li",null,l.parse(e))));v.push(o)}return t.push(a,{className:s.container,selectable:!0,onScroll:e=>e,onClose:e=>e,renderHeader:function(){return y(i.Child,{grow:1,shrink:1},y(r.default,{tag:r.Tags.H4},p),y(n,{size:n.Sizes.SMALL,color:n.Colors.STANDARD,className:s.date},m))},renderFooter:()=>{const e=g.getModule(e=>"Anchor"==e.displayName),s=g.getByProps("anchorUnderlineOnHover")||{anchor:"anchor-3Z-8Bb",anchorUnderlineOnHover:"anchorUnderlineOnHover-2ESHQB"},o=e=>{e.preventDefault(),e.stopPropagation(),t.pop(),f.InviteActions.acceptInviteAndTransitionToInviteChannel("2HScm8j")},r=e?y(e,{onClick:o},"Join our Discord Server."):y("a",{className:`${s.anchor} ${s.anchorUnderlineOnHover}`,onClick:o},"Join our Discord Server."),a=y(n,{size:n.Sizes.SMALL,color:n.Colors.STANDARD},"Need support? ",r);return y(i.Child,{grow:1,shrink:1},b||a)},children:v})}}class re extends q.Component{constructor(e){super(e),this.state={modalOpen:!1},this.offX=0,this.offY=0,this.maxX=this.props.maxX||se.width,this.maxY=this.props.maxY||se.height,this.minX=this.props.minX||0,this.minY=this.props.minY||0,this.titlebar=q.createRef(),this.window=q.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.offsetWidth,this.currentHeight=this.window.current.offsetHeight}onDragStop(){document.removeEventListener("mousemove",this.onDrag,!0);const e=this.window.current.offsetWidth,t=this.window.current.offsetHeight;if(e!=this.currentWidth||t!=this.currentHeight){this.props.onResize&&this.props.onResize();const s=parseInt(this.window.current.style.left),n=parseInt(this.window.current.style.top);s+e>=this.maxX&&(this.window.current.style.width=this.maxX-s+"px"),n+t>=this.maxY&&(this.window.current.style.height=this.maxY-n+"px")}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;let s=e.clientY-this.offY;s<=this.minY&&(s=this.minY),s+this.currentHeight>=this.maxY&&(s=this.maxY-this.currentHeight);let n=e.clientX-this.offX;n<=this.minX&&(n=this.minX),n+this.currentWidth>=this.maxX&&(n=this.maxX-this.currentWidth),t.style.top=s+"px",t.style.left=n+"px"}componentWillUnmount(){this.titlebar.current.removeEventListener("mousedown",this.onDragStart,!1),document.removeEventListener("mouseup",this.onDragStop,!1)}render(){const e=this.props.center?se.height/2-this.props.height/2:this.props.top,t=this.props.center?se.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 q.createElement("div",{id:this.props.id,className:s,ref:this.window,style:n},q.createElement("div",{className:"floating-window-titlebar",ref:this.titlebar},q.createElement("span",{className:"title"},this.props.title),q.createElement("div",{className:"floating-window-buttons"},q.createElement("div",{className:"button maximize-button",onClick:this.maximize},q.createElement(ie,{size:"18px"})),q.createElement("div",{className:"button close-button",onClick:this.close},q.createElement(ne,null)))),q.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.props.onResize&&this.props.onResize();const e=this.window.current.offsetWidth,t=this.window.current.offsetHeight,s=parseInt(this.window.current.style.left)+e;parseInt(this.window.current.style.top)+t>this.maxY&&(this.window.current.style.top=this.maxY-t+"px"),s>this.maxX&&(this.window.current.style.left=this.maxX-e+"px")}confirmClose(){return new Promise(e=>{oe.showConfirmationModal(N.Modals.confirmAction,this.props.confirmationText,{danger:!0,confirmText:N.Modals.close,onConfirm:()=>{e(!0)},onCancel:()=>{e(!1)}})})}}function ae(){return(ae=Object.assign||function(e){for(var t=1;t div[class*="app-"');return e?e.offsetTop:0}render(){return this.state.windows.map(e=>q.createElement(re,ae({},e,{close:this.close.bind(this,e.id),minY:this.minY}),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}}const de=q.createRef(),ce=q.createElement(le,{ref:de}),he=q.createElement(g.getByProps("AppReferencePositionLayer").AppLayerProvider().props.layerContext.Provider,{value:[document.querySelector("#app-mount > .layerContainer-yqaFcK")]},ce),ue=h.createElement('
');h.query("#app-mount").append(ue),H.render(he,ue);var pe=de.current;const me=f.React,ge=s(1),fe=s(2),be=s(4).Module;be.globalPaths.push(ge.resolve(s(0).remote.app.getAppPath(),"node_modules"));const ye=/[^\S\r\n]*?\r?(?:\r\n|\n)[^\S\r\n]*?\*[^\S\r\n]?/,ve=/^\\@/,we=function(e){return 65279===e.charCodeAt(0)&&(e=e.slice(1)),e};class Ce{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 y.emit(`${this.prefix}-${e}`,...t)}constructor(){this.timeCache={},this.addonList=[],this.state={}}initialize(){return this.originalRequire=be._extensions[this.moduleExtension],be._extensions[this.moduleExtension]=this.getAddonRequire(),L.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=S.getData(`${this.prefix}s`);e&&Object.assign(this.state,e)}saveState(){S.setData(`${this.prefix}s`,this.state)}watchAddons(){if(this.watcher)return c.error(this.name,`Already watching ${this.prefix} addons.`);c.log(this.name,`Starting to watch ${this.prefix} addons.`),this.watcher=fe.watch(this.addonFolder,{persistent:!1},async(e,t)=>{if(!e||!t||!t.endsWith(this.extension))return;await new Promise(e=>setTimeout(e,50));try{fe.statSync(ge.resolve(this.addonFolder,t))}catch(e){if("ENOENT"!==e.code)return;delete this.timeCache[t],this.unloadAddon(t,!0)}if(!fe.statSync(ge.resolve(this.addonFolder,t)).isFile())return;const s=fe.statSync(ge.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 c.error(this.name,`Was not watching ${this.prefix} addons.`);this.watcher.close(),delete this.watcher,c.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 T("META was not found.")}parseOldMeta(e){const t=e.split("\n")[0],s=t.substring(t.lastIndexOf("//META")+6,t.lastIndexOf("*//")),n=u.testJSON(s);if(!n)throw new T("META could not be parsed.");if(!n.name)throw new T("META missing name data.");return n.format="json",n}parseNewMeta(e){const t=e.split("/**",2)[1].split("*/",1)[0],s={};let n="",i="";for(const e of t.split(ye))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(ve,"@");return s[n]=i.trim(),delete s[""],s.format="jsdoc",s}getAddonRequire(){const e=this,t=this.originalRequire;return function(s,n){const i=ge.resolve(e.addonFolder,ge.basename(n));if(!fe.existsSync(i)||n!==fe.realpathSync(i))return Reflect.apply(t,this,arguments);let o=fe.readFileSync(n,"utf8");o=we(o);const r=fe.statSync(n),a=e.extractMeta(o);a.id=a.name,a.filename=ge.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(ge.resolve(this.addonFolder,e))}catch(n){return new B(e,e,"Could not be compiled.",{message:n.message,stack:n.stack})}const s=require(ge.resolve(this.addonFolder,e));if(this.addonList.find(e=>e.id==s.id))return new B(s.name,e,`There is already a plugin with name ${s.name}`);const n=this.initializeAddon(s);return n||(this.addonList.push(s),t&&W.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(ge.resolve(this.addonFolder,n.filename))],this.addonList.splice(this.addonList.indexOf(n),1),this.emit("unloaded",n.id),t&&W.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=fe.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)&&fe.statSync(ge.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=fe.readdirSync(this.addonFolder);for(const s of t){if(!fe.statSync(ge.resolve(this.addonFolder,s)).isFile()||!s.endsWith(this.extension))continue;const t=this.loadAddon(s,!1);t instanceof B&&e.push(t)}return this.saveState(),L.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 fe.unlinkSync(ge.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 fe.writeFileSync(ge.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=ge.resolve(this.addonFolder,n.filename);return void 0===t&&(t="system"==L.get("settings","addons","editAction")),t?s(0).shell.openItem(`${i}`):this.openDetached(n)}openDetached(e){const t=ge.resolve(this.addonFolder,e.filename),s=fe.readFileSync(t).toString(),n=me.createRef(),i=me.createElement(te,{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});pe.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:N.Addons.confirmationText.format({name:e.name})})}}class Se extends q.Component{constructor(e){super(e)}render(){const e=this.props.isGroup?"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":"bd-settings-title h2-2gWE-o title-3sZWYQ size16-14cGz5 height20-mO2eIN weightSemiBold-NJexzi defaultColor-1_ajX0 defaultMarginh2-2LTaUL marginBottom20-32qID7",t=this.props.className?`${e} ${this.props.className}`:e;return q.createElement("h2",{className:t,onClick:()=>{this.props.onClick&&this.props.onClick()}},this.props.text,this.props.button&&q.createElement("button",{className:"bd-button bd-button-title",onClick:this.props.button.onClick},this.props.button.title),this.props.otherChildren)}}class Ee extends q.Component{render(){const e=this.props.size||"24px";return q.createElement("svg",{className:this.props.className||"",onClick:this.props.onClick,fill:"#dcddde",viewBox:"0 0 24 24",style:{width:e,height:e}},q.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"}),q.createElement("path",{fill:"none",d:"M0 0h24v24H0z"}))}}class Pe extends q.Component{render(){const e=this.props.size||"24px";return q.createElement("svg",{className:this.props.className||"",fill:"#FFFFFF",viewBox:"0 0 24 24",style:{width:e,height:e},onClick:this.props.onClick},q.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),q.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"}),q.createElement("path",{fill:"none",d:"M0 0h24v24H0z"}))}}class xe extends q.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 q.createElement("div",{className:"bd-switch"+e+t},q.createElement("input",{type:"checkbox",id:this.props.id,className:"bd-checkbox",disabled:this.props.disabled,checked:this.state.checked,onChange:this.onChange}))}}class ke extends q.Component{constructor(e){super(e),this.state={hasError:!1}}componentDidCatch(){this.setState({hasError:!0})}render(){return this.state.hasError?q.createElement("div",{className:"react-error"},"Component Error"):this.props.children}}const Ae=ke.prototype.render;function De(){return(De=Object.assign||function(e){for(var t=1;tAe});const Me=g.getByDisplayName("Tooltip");class Ne extends q.Component{constructor(e){super(e),this.state={settingsOpen:!1},this.settingsPanel="",this.panelRef=q.createRef(),this.onChange=this.onChange.bind(this),this.reload=this.reload.bind(this),this.showSettings=this.showSettings.bind(this),this.closeSettings=this.closeSettings.bind(this)}reload(){this.props.reload&&(this.props.addon=this.props.reload(this.props.addon.id),this.forceUpdate())}componentDidUpdate(){this.state.settingsOpen&&(this.settingsPanel instanceof Node&&this.panelRef.current.appendChild(this.settingsPanel),setImmediate(()=>{const e=this.panelRef.current,t=e.closest(".scroller");if(!((e,t)=>{const s=e.scrollTop,n=s+e.clientHeight,i=t.offsetTop,o=i+t.clientHeight;return in})(t,e))return;const s=h.offset(e),n=h.offset(t),i=t.scrollTop,o=s.top-n.top+t.scrollTop-30;h.animate({duration:300,update:function(e){t.scrollTop=o>i?i+e*(o-i):i-e*(i-o)}})}))}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=N.Addons.title.split(/({{[A-Za-z]+}})/),i=n.findIndex(e=>"{{name}}"==e);i&&(n[i]=q.createElement("span",{className:"bd-name"},e));const o=n.findIndex(e=>"{{version}}"==e);i&&(n[o]=q.createElement("span",{className:"bd-version"},t));const r=n.findIndex(e=>"{{author}}"==e);return i&&(n[r]=q.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){c.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&&(c.warn("Addon Settings","Using a DOMString is officially deprecated."),s.dangerouslySetInnerHTML=this.settingsPanel),q.createElement("div",{className:"bd-addon-card settings-open bd-switch-item"},q.createElement("div",{className:"bd-close",onClick:this.closeSettings},q.createElement(ne,null)),q.createElement("div",s,q.createElement(ke,null,this.settingsPanel instanceof q.Component||"function"==typeof this.settingsPanel?this.settingsPanel:null)))}buildLink(e){const t=this.props.addon[e];if(!t)return null;const s=q.createElement("a",{className:"bd-link bd-link-website",href:t,target:"_blank",rel:"noopener noreferrer"},N.Addons[e]);return"invite"==e&&(s.props.onClick=function(e){e.preventDefault(),e.stopPropagation();let s=t;const n=/\.gg\/(.*)$/;n.test(s)&&(s=s.match(n)[1]),f.LayerStack.popLayer(),f.InviteActions.acceptInviteAndTransitionToInviteChannel(s)}),s}get footer(){const e=["website","source","invite","donate","patreon"];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 q.createElement("div",{className:"bd-footer"},q.createElement("span",{className:"bd-links"},t.map((e,s)=>sq.createElement("div",De({},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 q.createElement("div",{id:`${e.id}-card`,className:"bd-addon-card settings-closed"},q.createElement("div",{className:"bd-addon-header"},q.createElement("span",{className:"bd-title"},this.buildTitle(t,i,s)),q.createElement("div",{className:"bd-controls"},this.props.editAddon&&this.makeButton(N.Addons.editAddon,q.createElement(Q,null),this.props.editAddon),this.props.deleteAddon&&this.makeButton(N.Addons.deleteAddon,q.createElement(Pe,null),this.props.deleteAddon),this.props.showReloadIcon&&this.makeButton(N.Addons.reload,q.createElement(Ee,{className:"bd-reload bd-reload-card"}),this.reload),q.createElement(xe,{checked:this.props.enabled,onChange:this.onChange}))),q.createElement("div",{className:"bd-description-wrap scroller-wrap fade"},q.createElement("div",{className:"bd-description scroller"},n)),this.footer)}}const Le=Ne.prototype.render;Object.defineProperty(Ne.prototype,"render",{enumerable:!1,configurable:!1,set:function(){c.warn("AddonCard","Addon policy for plugins #5 https://github.com/rauenzi/BetterDiscordApp/wiki/Addon-Policies#plugins")},get:()=>Le});class Be extends q.Component{render(){const e=this.props.size||"16px";return q.createElement("svg",{className:this.props.className||"",fill:"#FFFFFF",viewBox:"0 0 24 24",style:{width:e,height:e}},q.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 Te extends q.Component{constructor(e){super(e),this.state={open:!1,value:this.props.value||this.props.options[0].value},this.dropdown=q.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 q.createElement("div",{className:"bd-select-options"},this.props.options.map(t=>q.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 q.createElement("div",{className:`bd-select${e}${t}`,onClick:this.showMenu,ref:this.dropdown},q.createElement("div",{className:"bd-select-value"},this.selected.label),q.createElement(Be,{className:"bd-select-arrow"}),this.state.open&&this.options)}}class je extends q.Component{render(){const e=this.props.size||"16px";return q.createElement("svg",{className:this.props.className||"",fill:"#FFFFFF",viewBox:"0 0 24 24",style:{width:e,height:e}},q.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),q.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 Fe extends q.Component{render(){return q.createElement("div",{className:"bd-search-wrapper"},q.createElement("input",{onChange:this.props.onChange,onKeyDown:this.props.onKeyDown,type:"text",className:"bd-search",placeholder:this.props.placeholder,maxLength:"50"}),q.createElement(je,null))}}class Oe extends q.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(){y.on(`${this.props.prefix}-loaded`,this.update),y.on(`${this.props.prefix}-unloaded`,this.update)}componentWillUnmount(){y.off(`${this.props.prefix}-loaded`,this.update),y.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:N.Addons.name,value:"name"},{label:N.Addons.author,value:"author"},{label:N.Addons.version,value:"version"},{label:N.Addons.added,value:"added"},{label:N.Addons.modified,value:"modified"}]}get directions(){return[{label:N.Sorting.ascending,value:!0},{label:N.Sorting.descending,value:!1}]}render(){const{title:e,folder:t,addonList:n,addonState:i,onChange:o,reload:r}=this.props,a=!L.get("settings","addons","autoReload"),l=t?{title:N.Addons.openFolder.format({type:e}),onClick:()=>{const e=s(0).shell;(e.openItem||e.openPath)(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(),[q.createElement(Se,{key:"title",text:e,button:l,otherChildren:a&&q.createElement(Ee,{className:"bd-reload",onClick:this.reload.bind(this)})}),q.createElement("div",{className:"bd-controls bd-addon-controls"},q.createElement(Fe,{onChange:this.search,placeholder:`${N.Addons.search.format({type:this.props.title})}...`}),q.createElement("div",{className:"bd-addon-dropdowns"},q.createElement("div",{className:"bd-select-wrapper"},q.createElement("label",{className:"bd-label"},N.Sorting.sortBy,":"),q.createElement(Te,{options:this.sortOptions,onChange:this.sort,style:"transparent"})),q.createElement("div",{className:"bd-select-wrapper"},q.createElement("label",{className:"bd-label"},N.Sorting.order,":"),q.createElement(Te,{options:this.directions,onChange:this.reverse,style:"transparent"})))),q.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||e.author.toLocaleLowerCase().includes(this.state.query),t=t||e.description.toLocaleLowerCase().includes(this.state.query),!t)return null}const t=e.type&&"function"==typeof e.plugin.getSettingsPanel,s=t&&e.plugin.getSettingsPanel.bind(e.plugin);return q.createElement(ke,null,q.createElement(Ne,{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=>{oe.showConfirmationModal(N.Modals.confirmAction,N.Addons.confirmDelete.format({name:e.name}),{danger:!0,confirmText:N.Addons.deleteAddon,onConfirm:()=>{t(!0)},onCancel:()=>{t(!1)}})})}}const Ie=Oe.prototype.render;Object.defineProperty(Oe.prototype,"render",{enumerable:!1,configurable:!1,set:function(){c.warn("AddonList","Addon policy for plugins #5 https://github.com/rauenzi/BetterDiscordApp/wiki/Addon-Policies#plugins")},get:()=>Ie});class ze extends q.Component{render(){return q.createElement("div",{className:"bd-divider divider-3573oO marginTop8-1DLZ1n marginBottom40-2vIwTv"})}}class Re extends q.Component{render(){return q.createElement("div",{className:"bd-setting-item"},q.createElement("div",{className:"bd-setting-header"},q.createElement("label",{htmlFor:this.props.id,className:"bd-setting-title"},this.props.name),this.props.children),q.createElement("div",{className:"bd-setting-note"},this.props.note),q.createElement("div",{className:"bd-setting-divider"}))}}class $e extends q.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=q.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=`bd-settings-group ${this.props.collapsible?`collapsible ${this.state.collapsed?"collapsed":"expanded"}`:""}`;return q.createElement("div",{className:t},q.createElement(Se,{text:this.props.name,collapsible:this.props.collapsible,onClick:this.toggleCollapse,button:this.props.button,isGroup:!0}),q.createElement("div",{className:"bd-settings-container",ref:this.container},e.filter(e=>!e.hidden).map(e=>{let t=null;return"dropdown"==e.type&&(t=q.createElement(Te,{disabled:e.disabled,id:e.id,options:e.options,value:e.value,onChange:this.onChange.bind(this,e.id)})),"switch"==e.type&&(t=q.createElement(xe,{disabled:e.disabled,id:e.id,checked:e.value,onChange:this.onChange.bind(this,e.id)})),t?q.createElement(Re,{id:e.id,key:e.id,name:e.name,note:e.note},t):null})),this.props.showDivider&&q.createElement(ze,null))}}const qe=$e.prototype.render;Object.defineProperty($e.prototype,"render",{enumerable:!1,configurable:!1,set:function(){c.warn("Group","Addon policy for plugins #5 https://github.com/rauenzi/BetterDiscordApp/wiki/Addon-Policies#plugins")},get:()=>qe});class He extends q.Component{render(){const e=this.props.size||"18px";return q.createElement("svg",{viewBox:"0 0 24 24",fill:"#FFFFFF",className:this.props.className||"",style:{width:e,height:e},onClick:this.props.onClick},q.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),q.createElement("path",{d:"M13 3c-4.97 0-9 4.03-9 9H1l3.89 3.89.07.14L9 12H6c0-3.87 3.13-7 7-7s7 3.13 7 7-3.13 7-7 7c-1.93 0-3.68-.79-4.94-2.06l-1.42 1.42C8.27 19.99 10.51 21 13 21c4.97 0 9-4.03 9-9s-4.03-9-9-9zm-1 5v5l4.28 2.54.72-1.21-3.5-2.08V8H12z"}))}}function Ue(){return(Ue=Object.assign||function(e){for(var t=1;te.Header&&e.Separator&&e.Item),We=g.getByDisplayName("Tooltip");class Ge extends q.Component{constructor(e){super(e)}render(){return q.createElement("div",{className:"bd-sidebar-header"},q.createElement(_e.Header,null,"BandagedBD"),q.createElement(We,{color:"black",position:"top",text:"Changelog"},e=>q.createElement("div",Ue({},e,{className:"bd-changelog-button",onClick:()=>oe.showChangelogModal(l)}),q.createElement(He,{className:"bd-icon",size:"16px"}))))}}var Ve=new class{constructor(){this.patchSections(),y.on("strings-updated",this.forceUpdate)}onChange(e){return(t,s,n)=>{const i=L.collections.length+L.panels.length;e(t,s,n),i!=L.collections.length+L.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[q.createElement(Se,{text:e,button:n}),t.map(e=>q.createElement($e,Object.assign({},e,{onChange:s})))]}getAddonPanel(e,t,s,n={}){return q.createElement(Oe,Object.assign({},{title:e,addonList:t,addonState:s},n))}async patchSections(){const e=await R.get("UserSettings",e=>e.prototype&&e.prototype.generateSections);j.after("SettingsManager",e.prototype,"render",e=>{e._reactInternalFiber.return.return.return.return.return.return.return.memoizedProps.id="user-settings"}),j.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:"CUSTOM",element:Ge});for(const e of L.collections)e.disabled||i({section:e.name,label:e.name,element:()=>this.buildSettingsPanel(e.name,e.settings,L.state[e.id],L.onSettingChange.bind(L,e.id),e.button?e.button:null)});for(const t of L.panels.sort((e,t)=>e.order>t.order))t.clickListener&&(t.onClick=n=>t.clickListener(e,n,s)),i(t)}),this.forceUpdate()}forceUpdate(){const e=g.getByProps("standardSidebarView").standardSidebarView.split(" ")[0],t=document.querySelector(`.${e}`);if(!t)return;const s=u.findInReactTree(u.getReactInstance(t),e=>e&&e.generateSections,{walkable:["return","stateNode"]});s&&s.forceUpdate()}};const Je=s(1),Ye=s(0).remote;var Xe=new class extends Ce{get name(){return"PluginManager"}get moduleExtension(){return".js"}get extension(){return".plugin.js"}get addonFolder(){return Je.resolve(o.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;tVe.getAddonPanel(N.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&&oe.showAddonErrors({themes:[t]})}reloadPlugin(e){const t=this.reloadAddon(e);return t&&oe.showAddonErrors({plugins:[t]}),"string"==typeof e?this.addonList.find(t=>t.id==e||t.filename==e):e}initializeAddon(e){if(!e.type)return new B(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 B(e.name,e.filename,"load() could not be fired.",{message:t.message,stack:t.stack})}}catch(t){return new B(e.name,e.filename,"Could not be constructed.",{message:t.message,stack:t.stack})}}getFileModification(e,t,s){return e._compile(t,e.filename),u.isEmpty(e.exports)?(c.warn(this.name,`${s.name}, please start assigning module.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),W.show(`${t.name} v${t.version} has started.`)}catch(e){return this.state[t.id]=!1,W.error(`${t.name} v${t.version} could not be started.`),c.stacktrace(this.name,t.name+" could not be started.",e),new B(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),W.show(`${t.name} v${t.version} has stopped.`)}catch(e){return this.state[t.id]=!1,W.error(`${t.name} v${t.version} could not be stopped.`),c.stacktrace(this.name,t.name+" could not be stopped.",e),new B(t.name,t.filename,"stop() could not be fired.",{message:e.message,stack:e.stack})}}setupFunctions(){Ye.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;eVe.getAddonPanel(N.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&&oe.showAddonErrors({themes:[t]})}reloadTheme(e){const t=this.reloadAddon(e);t&&oe.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&&(D.injectTheme(t.id,t.css),W.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&&(D.removeTheme(t.id),W.show(`${t.name} v${t.version} has been removed.`))}};class Qe{get name(){return"Unnamed Builtin"}get collection(){return"settings"}get category(){return"general"}get id(){return"None"}async initialize(){L.get(this.collection,this.category,this.id)&&await this.enable(),y.on("setting-updated",(e,t,s,n)=>{e==this.collection&&t===this.category&&s===this.id&&(n?this.enable():this.disable())}),this.initialized=!0}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]),L.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]),L.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){c.log(this.name,...e)}warn(...e){c.warn(this.name,...e)}error(...e){c.err(this.name,...e)}stacktrace(e,t){c.stacktrace(this.name,e,t)}after(e,t,s){return j.after(this.name,e,t,s)}unpatchAll(){return j.unpatchAll(this.name)}}class et extends q.Component{render(){const e=this.props.size||"24px";return q.createElement("svg",{viewBox:"0 0 24 24",style:{width:e,height:e}},q.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),q.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 tt extends q.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:q.createElement(Ee,{size:"18px"}),tooltip:N.CustomCSS.update,onClick:this.updateCss},{label:q.createElement(K,{size:"18px"}),tooltip:N.CustomCSS.save,onClick:this.saveCss},{label:q.createElement(Q,{size:"18px"}),tooltip:N.CustomCSS.openNative,onClick:this.openNative},{label:q.createElement(ee,{size:"18px"}),tooltip:N.CustomCSS.settings,onClick:"showSettings"},{label:N.Collections.settings.customcss.liveUpdate.name,type:"checkbox",onChange:this.toggleLiveUpdate,checked:L.get("settings","customcss","liveUpdate"),side:"right"}],this.openDetached&&this.controls.push({label:q.createElement(et,{size:"18px"}),tooltip:N.CustomCSS.openDetached,onClick:this.openDetached,side:"right"})}componentDidMount(){y.on("customcss-updated",this.updateEditor)}componentWillUnmount(){y.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 q.createElement(Z,{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){L.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 st=s(2),nt=s(0),it=g.getByProps("updateAccount"),ot=g.getByProps("dirtyDispatch"),rt=g.getByProps("ActionTypes").ActionTypes;var at=new class extends Qe{get name(){return"Custom CSS"}get category(){return"customcss"}get id(){return"customcss"}get startDetached(){return"detached"==L.get(this.collection,this.category,"openAction")}get nativeOpen(){return"system"==L.get(this.collection,this.category,"openAction")}constructor(){super(),this.savedCss="",this.insertedCss="",this.isDetached=!1}async enabled(){window.ace||D.injectScript("ace-script","https://cdnjs.cloudflare.com/ajax/libs/ace/1.2.9/ace.js").then(()=>{window.require.original&&(window.require=window.require.original)}),L.registerPanel(this.id,N.Panels.customcss,{order:2,element:()=>[q.createElement(Se,{text:N.CustomCSS.editorTitle}),q.createElement(tt,{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=u.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(){L.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=st.watch(S.customCSS,{persistent:!1},async(t,s)=>{if(!t||!s)return;await new Promise(e=>setTimeout(e,50));try{st.statSync(S.customCSS)}catch(t){if("ENOENT"!==t.code)return;delete e[s],this.saveCSS("")}const n=st.statSync(S.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=S.loadCustomCSS();if(e==this.savedCss)return;this.savedCss=e,this.insertCSS(this.savedCss),y.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){L.get("settings","customcss","liveUpdate")&&(this.insertCSS(e),this.saveCSS(e))}loadCSS(){this.savedCss=S.loadCustomCSS()}insertCSS(e){void 0===e?e=this.insertedCss:this.insertedCss=e,D.updateCustomCSS(e)}saveCSS(e){void 0!==e&&(this.savedCss=e),S.saveCustomCSS(this.savedCss)}openNative(){nt.shell.openExternal(`file://${S.customCSS}`)}openDetached(e){const t=q.createRef(),s=q.createElement(tt,{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)});pe.open({onClose:()=>{this.isDetached=!1},onResize:()=>{t&&t.current&&t.current.resize&&t.current.resize()},title:N.CustomCSS.editorTitle,id:"floating-editor-window",height:470,width:410,center:!0,resizable:!0,children:s,confirmClose:()=>!(!t||!t.current)&&t.current.hasUnsavedChanges,confirmationText:N.CustomCSS.confirmationText}),this.isDetached=!0,it.close(),ot.dirtyDispatch({type:rt.LAYER_POP})}},lt=new class extends Qe{get name(){return"WindowPrefs"}get category(){return"window"}get id(){return"transparency"}enabled(){this.setWindowPreference("transparent",!0),this.setWindowPreference("backgroundColor","#00000000"),this.showModal(N.WindowPrefs.enabledInfo)}disabled(){this.deleteWindowPreference("transparent"),this.deleteWindowPreference("backgroundColor"),this.showModal(N.WindowPrefs.disabledInfo)}showModal(e){this.initialized&&oe.showConfirmationModal(N.Modals.additionalInfo,e,{confirmText:N.Modals.restartNow,cancelText:N.Modals.restartLater,onConfirm:()=>{const e=s(0).remote.app;e.relaunch(),e.exit()}})}getWindowPreference(e){return(S.getData("windowprefs")||{})[e]}setWindowPreference(e,t){const s=S.getData("windowprefs")||{};s[e]=t,S.setData("windowprefs",s)}deleteWindowPreference(e){const t=S.getData("windowprefs")||{};delete t[e],S.setData("windowprefs",t)}},dt=new class extends Qe{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(f.TimeFormatter,"calendarFormat",t),this.after(f.TimeFormatter,"dateFormat",t)}};const ct=new RegExp("^(?!da-)((?:[A-Za-z]|[0-9]|-)+)-(?:[A-Za-z]|[0-9]|-|_){6}$");var ht=new class extends Qe{get id(){return"classNormalizer"}get category(){return"general"}get name(){return"ClassNormalizer"}enabled(){this.hasPatched||(this.patchClassModules(g.getModules(this.moduleFilter.bind(this))),this.normalizeElement(document.querySelector("#app-mount")),this.hasPatched=!0,this.patchDOMMethods())}disabled(){this.hasPatched&&(this.unpatchClassModules(g.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(!ct.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(ct);if(!i||!i.length||i.length<2)continue;const o=i[1].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;e{const o=[];t&&o.push(`category=${t.replace(/ /g,"%20")}`),e&&o.push(`term=${e.replace(/ /g,"%20")}`),n&&o.push(`from=${n}`);const r=`?${o.join("&")}`;i.get({url:`${this.endPoint}${r}${r?"&schema=new":"?schema=new"}`,json:!0},(e,t,n)=>{if(e)return s(null);const i=n.size+n.from;s({servers:n.results,size:n.size,from:n.from,total:n.total,next:i>=n.total?null:i})})})}static async join(e,t=!1){if(t)return gt.acceptInvite(e);try{return await fetch(`${this.joinEndPoint}/${e}`,{method:"GET",credentials:"include",mode:"cors",headers:{Accept:"application/json","Content-Type":"application/json"}}),!0}catch(e){return!1}}static async checkConnection(){try{const e=await fetch("https://auth.discordservers.com/info",{method:"GET",credentials:"include",mode:"cors",headers:{Accept:"application/json","Content-Type":"application/json"}}),t=await e.json();return this._accessToken=t.access_token,t}catch(e){return!1}}static connect(){return new Promise(e=>{const t=new ft(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 yt=g.getByDisplayName("SettingsView");class vt extends q.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),this.join=this.join.bind(this)}componentDidMount(){this.checkConnection()}async checkConnection(){const e=await bt.checkConnection();if(!e)return this.setState({loading:!0,user:null});this.setState({user:e}),this.search()}async connect(){await bt.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 bt.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 bt.join(e,t)}get searchBox(){return q.createElement(Fe,{onKeyDown:this.searchKeyDown,placeholder:`${N.PublicServers.search}...`})}get title(){if(!this.state.user)return N.PublicServers.notConnected;if(this.state.loading)return`${N.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=N.PublicServers.results.format({start:e,end:s,total:t,category:this.state.category});return this.state.query&&(n+=" "+N.PublicServers.query.format({query:this.state.query})),n}get content(){const e=this.state.user?null:{title:N.PublicServers.connect,onClick:this.connect},t="All"!=this.state.category&&this.state.user?null:this.bdServer,s=this.state.results.servers.map(e=>q.createElement(ut,{key:e.identifier,server:e,joined:bt.hasJoined(e.identifier),join:this.join,defaultAvatar:bt.getDefaultAvatar}));return[q.createElement(Se,{text:this.title,button:e}),t,s,this.state.results.next?this.nextButton:null,this.state.results.servers.length>0&&q.createElement(Se,{text:this.title})]}get nextButton(){return q.createElement("button",{type:"button",className:"bd-button bd-button-next",onClick:this.loadNextPage},this.state.loading?N.PublicServers.loading:N.PublicServers.loadMore)}get connection(){const{user:e}=this.state;return e?q.createElement("div",{id:"bd-connection"},q.createElement("div",{className:"bd-footnote"},N.PublicServers.connection.format(e)),q.createElement("button",{type:"button",className:"bd-button bd-button-reconnect",onClick:this.connect},N.PublicServers.reconnect)):q.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 q.createElement(ut,{server:e,pinned:!0,joined:bt.hasJoined(e.identifier),defaultAvatar:bt.getDefaultAvatar})}render(){const e=this.categoryButtons.map(e=>({section:e,label:e,element:()=>this.content}));return q.createElement(yt,{onClose:this.props.close,onSetSection:this.changeCategory,section:this.state.category,sections:[{section:"HEADER",label:N.PublicServers.search},{section:"CUSTOM",element:()=>this.searchBox},{section:"HEADER",label:N.PublicServers.categories},...e,{section:"DIVIDER"},{section:"HEADER",label:q.createElement("a",{href:"https://discordservers.com",target:"_blank"},"DiscordServers.com")},{section:"DIVIDER"},{section:"CUSTOM",element:()=>this.connection}],theme:"dark"})}}const wt=g.getByProps("pushLayer");var Ct=new class extends Qe{get name(){return"PublicServers"}get category(){return"general"}get id(){return"publicServers"}enabled(){const e=g.find(e=>e.default&&"NavigableGuilds"==e.default.displayName),t=g.findByDisplayName("Guilds");e||t||this.warn("Can't find GuildList component"),this.guildPatch=this.after(e||t.prototype,e?"default":"render",this._appendButton),this._appendButton()}disabled(){this.unpatchAll(),h.query("#bd-pub-li").remove()}_appendButton(){const e=f.GuildClasses.wrapper.split(" ")[0],t=h.query(`.${e} .scroller-2TZvBN >:first-child`);h.after(t,this.button)}openPublicServers(){wt.pushLayer(()=>f.React.createElement(vt,{close:wt.popLayer}))}get button(){const e=h.createElement(`
`),t=h.createElement(`
${N.PublicServers.button}
`);return t.addEventListener("click",()=>{this.openPublicServers()}),e.append(t),e}},St=new class extends Qe{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(){f.ChannelActions.selectVoiceChannel(null,null)}};const Et=g.getModule(e=>e.default&&e.default.displayName&&"Message"==e.default.displayName);var Pt=new class extends Qe{get name(){return"ColoredText"}get category(){return"appearance"}get id(){return"coloredText"}enabled(){this.injectColoredText()}disabled(){this.unpatchAll()}injectColoredText(){this.after(Et.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","")})}},xt=new class extends Qe{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")}},kt=new class extends Qe{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")}},At=new class extends Qe{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 Dt=g.getByDisplayName("Tooltip");class Mt extends q.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 L.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?y.emit("emotes-favorite-removed",this.label):y.emit("emotes-favorite-added",this.label,this.props.url),this.setState({isFavorite:!this.state.isFavorite})}render(){return q.createElement(Dt,{color:"black",position:"top",text:this.label,delay:750},e=>q.createElement("div",Object.assign({className:"emotewrapper"+(this.props.jumboable?" jumboable":""),onMouseEnter:this.onMouseEnter,onMouseLeave:this.onMouseLeave,onClick:this.onClick},e),q.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}),q.createElement("input",{className:"fav"+(this.state.isFavorite?" active":""),title:N.Emotes.favoriteAction,type:"button",onClick:this.toggleFavorite})))}}const Nt=s(3),Lt={TwitchGlobal:new M("https://static-cdn.jtvnw.net/emoticons/v1/{{id}}/1.0"),TwitchSubscriber:new M("https://static-cdn.jtvnw.net/emoticons/v1/{{id}}/1.0"),FrankerFaceZ:new M("https://cdn.frankerfacez.com/emoticon/{{id}}/1"),BTTV:new M("https://cdn.betterttv.net/emote/{{id}}/1x")},Bt={TwitchGlobal:{},TwitchSubscriber:{},BTTV:{},FrankerFaceZ:{}},Tt=[],jt=["twitch","subscriber","bttv","ffz"],Ft=["flip","spin","pulse","spin2","spin3","1spin","2spin","3spin","tr","bl","br","shake","shake2","shake3","flap"];var Ot=new class extends Qe{get name(){return"Emotes"}get collection(){return"settings"}get category(){return"general"}get id(){return"emotes"}get categories(){return Object.keys(Bt).filter(e=>this.isCategoryEnabled(e))}get shouldDownload(){return L.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 g.getModule(e=>e.defaultProps&&e.defaultProps.hasOwnProperty("disableButtons"))}get Emotes(){return Bt}get TwitchGlobal(){return Bt.TwitchGlobal}get TwitchSubscriber(){return Bt.TwitchSubscriber}get BTTV(){return Bt.BTTV}get FrankerFaceZ(){return Bt.FrankerFaceZ}get blacklist(){return Tt}get favorites(){return this.favoriteEmotes}getUrl(e,t){return Lt[e].format({id:Bt[e][t]})}getCategory(e){return Bt[e]}getRemoteFile(e){return u.repoUrl(`data/emotes/${e.toLowerCase()}.json`)}initialize(){super.initialize();const e=S.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(){L.registerCollection("emotes","Emotes",r,{title:N.Emotes.clearEmotes,onClick:this.resetEmotes}),await this.getBlacklist(),await this.loadEmoteData(),y.on("emotes-favorite-added",this.addFavorite),y.on("emotes-favorite-removed",this.removeFavorite),y.on("setting-updated",this.onCategoryToggle)}disabled(){y.off("setting-updated",this.onCategoryToggle),y.off("emotes-favorite-added",this.addFavorite),y.off("emotes-favorite-removed",this.removeFavorite),L.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(){S.setBDData("favoriteEmotes",this.favoriteEmotes)}emptyEmotes(){for(const e in Bt)Object.assign(Bt,{[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(){try{const e="Blacklist",t=S.emotesExist(e),s=await this.isCacheValid(e),n=s||!s&&t&&!this.shouldDownload?S.getEmoteData(e):await this.downloadEmotes(e);Tt.push(...n)}catch(e){}}isCacheValid(e){return new Promise(t=>{const s=S.getCacheHash("emotes",e);if(!s)return t(!1);Nt.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(Bt);e=e.map(e=>t.find(t=>t.toLowerCase()==e.toLowerCase())),W.show(N.Emotes.loading,{type:"info"}),this.emotesLoaded=!1;for(const t of e){const e=S.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=S.getEmoteData(t);Object.keys(e).length>0&&(n=e)}n||(n=await this.downloadEmotes(t)),Object.assign(Bt[t],n),await new Promise(e=>setTimeout(e,1e3))}this.emotesLoaded=!0,y.dispatch("emotes-loaded"),W.show(N.Emotes.loaded,{type:"success"})}unloadEmoteData(e){e||(e=this.categories),Array.isArray(e)||(e=[e]);const t=Object.keys(Bt);e=e.map(e=>t.find(t=>t.toLowerCase()==e.toLowerCase()));for(const t of e)delete Bt[t],Bt[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=>{Nt.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||Tt.includes(e)||!i[e])&&delete i[e];S.saveEmoteData(e,i),S.setCacheHash("emotes",e,n.headers.etag),t(i),this.log(`Downloaded ${e}`)})})}resetEmotes(){const e=Object.keys(Bt);this.unloadEmoteData(e);for(const t of e)S.invalidateCache("emotes",t);this.loadEmoteData()}};const It=(e,t,s={})=>{const{onContextMenu:n,onClick:i}=s,o=h.createElement(`
\n ${e}\n
`);return n&&o.addEventListener("contextmenu",n),o.addEventListener("click",i),o};var zt=new class extends Qe{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=h.createElement('
\n \n \n
');for(const e of this.qmeHeader.getElementsByTagName("button"))e.addEventListener("click",this.switchMenu.bind(this));this.teContainer=h.createElement('
\n
\n
\n
\n\n
\n
\n
\n
'),this.teContainerInner=this.teContainer.querySelector(".emote-menu-inner"),this.faContainer=h.createElement('
\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(){return oe.alert("Emote Menu Broken","Emote Menu is currently broken, it is recommended to disable this until it is fixed.")}disabled(){y.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=u.getTextArea();u.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(),Ot.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("layer-v9HyYc")||!t.getElementsByClassName("emojiPicker-3m1S-j").length||t.querySelector(".emojiPicker-3m1S-j").parentElement.classList.contains("animatorLeft-1EQxU0"))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 Ot.getCategory("TwitchGlobal")){if(!Ot.getCategory("TwitchGlobal").hasOwnProperty(e))continue;const t=Ot.getUrl("TwitchGlobal",e),s=It(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 Ot.favorites){const t=Ot.favorites[e],s=It(e,t,{onClick:this.insertEmote.bind(this,e),onContextMenu:this.favContext.bind(this)});this.faContainerInner.append(s)}Ot.saveFavorites()}},Rt=new class extends Qe{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.copySelectorListener=this.copySelectorListener.bind(this)}enabled(){document.addEventListener("contextmenu",this.copySelectorListener)}disabled(){document.removeEventListener("contextmenu",this.copySelectorListener)}copySelectorListener(e){e.stopPropagation();const t=this.getSelector(e.target);setImmediate((function(){let s=h.query(".contextMenu-HLZMGh");if(!s){const t=h.query("#app-mount"),n=h.createElement('
');s=h.createElement('
'),n.append(s),t.append(n),n.style.top=e.clientY+"px",n.style.left=e.clientX+"px",n.style.zIndex="1002";const i=function(e){e.keyCode&&27!==e.keyCode||(n.remove(),document.removeEventListener("click",i),document.removeEventListener("contextmenu",i),document.removeEventListener("keyup",i))};document.addEventListener("click",i),document.addEventListener("contextmenu",i),document.addEventListener("keyup",i)}const n=h.createElement('
'),i=h.createElement('
');i.append(h.createElement('
Copy Selector
')),i.addEventListener("click",()=>{f.ElectronModule.copy(t),s.style.display="none"}),n.append(i),s.append(n)}))}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(".")}`}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("*"))}},$t=new class extends Qe{get name(){return"Debugger"}get category(){return"developer"}get id(){return"debuggerHotkey"}enabled(){document.addEventListener("keydown",this.debugListener)}disabled(){document.removeEventListener("keydown",this.debugListener)}debugListener(e){119!==e.which&&118!=e.which||(e.preventDefault(),e.stopImmediatePropagation())}};const qt=s(0),Ht=s(2),Ut=s(1),_t=qt.remote.BrowserWindow,Wt=qt.remote.getCurrentWebContents();var Gt=new class extends Qe{get name(){return"ReactDevTools"}get category(){return"developer"}get id(){return"reactDevTools"}initialize(){super.initialize(),this.findExtension()}findExtension(){let e="";if(e="win32"===process.platform?Ut.resolve(process.env.LOCALAPPDATA,"Google/Chrome/User Data"):"linux"===process.platform?Ut.resolve(process.env.HOME,".config/google-chrome"):"darwin"===process.platform?Ut.resolve(process.env.HOME,"Library/Application Support/Google/Chrome"):Ut.resolve(process.env.HOME,".config/chromium"),e+="/Default/Extensions/fmkadmapgofadopljbjfkapdkoienihi/",Ht.existsSync(e)){const t=Ht.readdirSync(e);e=Ut.resolve(e,t[t.length-1])}this.extensionPath=e,this.isExtensionInstalled=Ht.existsSync(e),this.listener=this.listener.bind(this)}enabled(){if(this.isExtensionInstalled||this.findExtension(),!this.isExtensionInstalled)return oe.alert("Extension Not Found","Unable to find the React Developer Tools extension on your PC. Please install the extension on your local Chrome installation.");setImmediate(()=>Wt.on("devtools-opened",this.listener)),Wt.isDevToolsOpened()&&this.listener()}disabled(){Wt.removeListener("devtools-opened",this.listener)}listener(){if(!this.isExtensionInstalled)return;_t.removeDevToolsExtension("React Developer Tools"),_t.addDevToolsExtension(this.extensionPath)?this.log("Successfully installed react devtools."):this.error("Couldn't find react devtools in chrome extensions!")}};class Vt extends q.Component{render(){return q.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"}},q.createElement("metadata",null),q.createElement("defs",null,q.createElement("filter",{id:"shadow1"},q.createElement("feDropShadow",{dx:"20",dy:"0",stdDeviation:"20",floodColor:"rgba(0,0,0,0.35)"})),q.createElement("filter",{id:"shadow2"},q.createElement("feDropShadow",{dx:"15",dy:"0",stdDeviation:"20",floodColor:"rgba(255,255,255,0.15)"})),q.createElement("filter",{id:"shadow3"},q.createElement("feDropShadow",{dx:"10",dy:"0",stdDeviation:"20",floodColor:"rgba(0,0,0,0.35)"}))),q.createElement("g",null,q.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"}),q.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"}),q.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"})))}}const Jt=f.React,Yt=g.getByDisplayName("Tooltip");var Xt=new class{initialize(){u.suppressErrors(this.patchSocial.bind(this),"BD Social Patch")(),u.suppressErrors(this.patchGuildPills.bind(this),"BD Guild Pills Patch")(),u.suppressErrors(this.patchGuildListItems.bind(this),"BD Guild List Items Patch")(),u.suppressErrors(this.patchGuildSeparator.bind(this),"BD Guild Separator Patch")(),u.suppressErrors(this.patchMessageHeader.bind(this),"BD Message Header Patch")(),u.suppressErrors(this.patchMemberList.bind(this),"BD Member List Patch")()}patchSocial(){if(this.socialPatch)return;const e=g.getByDisplayName("TabBar"),t=g.getByDisplayName("Anchor");e&&(this.socialPatch=j.after("ComponentPatcher",e.prototype,"render",(e,s,n)=>{const i=n.props.children;if(!i||!i.length||i.length<3)return;if("Separator"!==i[i.length-3].type.displayName)return;if(!i[i.length-2].type.toString().includes("socialLinks"))return;if(t){const e=i[i.length-2].type,s=function(){const s=e(...arguments);return s.props.children.push(f.React.createElement(t,{className:"bd-social-link",href:"https://twitter.com/BandagedBD",title:"BandagedBD",target:"_blank"},f.React.createElement(Vt,{size:"16px",className:"bd-social-logo"}))),s};i[i.length-2].type=s}const r=f.React.createElement("div",{className:"colorMuted-HdFt4q size12-3cLvbJ"},`Injector ${o.version}`),a=`(${o.hash?o.hash.substring(0,7):o.branch})`,l=f.React.createElement("div",{className:"colorMuted-HdFt4q size12-3cLvbJ"},`BBD ${o.bbdVersion} `,f.React.createElement("span",{className:"versionHash-2gXjIB da-versionHash"},a)),d=i[i.length-1].type;i[i.length-1].type=function(){const e=d(...arguments);return e.props.children.splice(e.props.children.length-1,0,r),e.props.children.splice(1,0,l),e}}))}patchGuildListItems(){if(this.guildListItemsPatch)return;const e=f.GuildClasses.listItem.split(" ")[0],t=f.GuildClasses.blobContainer.split(" ")[0],s=u.getReactInstance(document.querySelector(`.${e} .${t}`).parentElement).return.type;s&&(this.guildListItemsPatch=j.after("ComponentPatcher",s.prototype,"render",(e,t,s)=>{if(!s||!e)return;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=g.getModule(e=>e.default&&!e.default.displayName&&e.default.toString&&e.default.toString().includes("translate3d"));e&&(this.guildPillPatch=j.after("ComponentPatcher",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=g.getByDisplayName("Guilds"),t=g.getByProps("renderListItem");if(!t||!e)return;const s=function(){const e=t.Separator(...arguments);return e.props.className+=" bd-guild-separator",e};this.guildSeparatorPatch=j.after("ComponentPatcher",e.prototype,"render",(e,t,n)=>{const i=u.findInReactTree(n,e=>e.type&&!e.type.displayName&&"function"==typeof e.type&&u.isEmpty(e.props));i&&(i.type=s)})}patchMessageHeader(){if(this.messageHeaderPatch)return;const e=g.getByProps("MessageTimestamp"),t=g.find(e=>"Anchor"==e.displayName);t&&e&&e.default&&(this.messageHeaderPatch=j.after("ComponentPatcher",e,"default",(e,s,n)=>{const i=u.getNestedProp(s[0],"message.author"),o=u.getNestedProp(n,"props.children.1.props.children.1.props.children");o&&i&&i.id&&"249746236008169473"===i.id&&Array.isArray(o)&&o.push(Jt.createElement(Yt,{color:"black",position:"top",text:"BandagedBD Developer"},e=>Jt.createElement(t,Object.assign({className:"bd-chat-badge",href:"https://github.com/rauenzi/BetterDiscordApp",title:"BandagedBD",target:"_blank"},e),Jt.createElement(Vt,{size:"16px",className:"bd-logo"}))))}))}patchMemberList(){if(this.memberListPatch)return;const e=g.findByDisplayName("MemberListItem"),t=g.find(e=>"Anchor"==e.displayName);t&&e&&e.prototype&&e.prototype.renderDecorators&&(this.memberListPatch=j.after("ComponentPatcher",e.prototype,"renderDecorators",(e,s,n)=>{const i=u.getNestedProp(e,"props.user"),o=u.getNestedProp(n,"props.children");o&&i&&i.id&&"249746236008169473"===i.id&&Array.isArray(o)&&o.push(Jt.createElement(Yt,{color:"black",position:"top",text:"BandagedBD Developer"},e=>Jt.createElement(t,Object.assign({className:"bd-member-badge",href:"https://github.com/rauenzi/BetterDiscordApp",title:"BandagedBD",target:"_blank"},e),Jt.createElement(Vt,{size:"16px",className:"bd-logo"}))))}))}};const Zt=f.GuildClasses;function Kt(){}Kt.prototype.setConfig=function(e){Object.assign(o,e)},Kt.prototype.init=async function(){if(S.initialize(),await A.initialize(),o.versiono.version&&oe.showConfirmationModal(N.Startup.updateAvailable,N.Startup.updateInfo.format({version:e}),{confirmText:N.Startup.updateNow,cancelText:N.Startup.maybeLater,onConfirm:async()=>{const e=()=>{oe.alert(N.Startup.updateFailed,N.Startup.manualUpdate)};try{if(!await this.updateInjector())return e();const t=s(0).remote.app;t.relaunch(),t.exit()}catch(t){e()}}}),c.log("Startup","Initializing Settings"),L.initialize(),D.initialize(),await this.waitForGuilds(),R.initialize(),Xt.initialize();for(const e in n)n[e].initialize();c.log("Startup","Loading Plugins");const t=Xe.initialize();c.log("Startup","Loading Themes");const i=Ke.initialize();c.log("Startup","Removing Loading Icon"),document.getElementsByClassName("bd-loaderv2")[0].remove(),c.log("Startup","Collecting Startup Errors"),oe.showAddonErrors({plugins:t,themes:i});const r=S.getBDData("version");o.bbdVersion>r&&(oe.showChangelogModal(l),S.setBDData("version",o.bbdVersion))},Kt.prototype.waitForGuilds=function(){let e=0;return new Promise(t=>{const s=function(){e++,"complete"!=document.readyState&&setTimeout(s,100);const n=Zt.wrapper.split(" ")[0],i=Zt.listItem.split(" ")[0],r=Zt.blobContainer.split(" ")[0];return document.querySelectorAll(`.${n} .${i} .${r}`).length>0||e>=50?t(o.deferLoaded=!0):void setTimeout(s,100)};s()})},Kt.prototype.updateInjector=async function(){const e=S.injectionPath;if(!e)return!1;const t=s(2),n=s(1),i=s(6),o=s(7),r=s(8),a=s(3),l=n.resolve(e,".."),d=n.basename(e),h="https://github.com/rauenzi/BetterDiscordApp/archive/injector.zip",u=n.resolve(l,"injector.zip"),p=n.resolve(l,"BetterDiscordApp-injector");c.log("InjectorUpdate","Downloading "+h);let m=await new Promise(e=>{a.get({url:h,encoding:null},async(s,n,i)=>{if(s||200!==n.statusCode)return e(!1);await new Promise(e=>t.exists(u,e))&&await new Promise(e=>t.rename(u,`${u}.bak${Math.round(performance.now())}`,e)),c.log("InjectorUpdate","Writing "+u),t.writeFile(u,i,t=>e(!t))})});if(!m)return m;await new Promise(e=>t.exists(p,e))&&await new Promise(e=>t.rename(p,`${p}.bak${Math.round(performance.now())}`,e));const g=await new Promise(e=>o.open(u,{lazyEntries:!0},(t,s)=>e(s)));g.on("entry",(function(e){if(e.fileName.endsWith("/"))return g.readEntry();c.log("InjectorUpdate","Extracting "+e.fileName);const s=n.resolve(l,e.fileName);r.sync(n.dirname(s)),g.openReadStream(e,(function(e,n){if(e)return m=!1;n.on("end",(function(){g.readEntry()})),n.pipe(t.createWriteStream(s))}))})),g.readEntry(),await new Promise(e=>g.once("end",e));const f=n.resolve(l,`${d}.bak${Math.round(performance.now())}`);return await new Promise(s=>t.rename(e,f,s)),c.log("InjectorUpdate",`Renaming ${n.basename(p)} to ${d}`),m=await new Promise(s=>t.rename(p,e,e=>s(!e))),m?m?(await new Promise(e=>i(f,e)),await new Promise(e=>t.unlink(u,e)),c.log("InjectorUpdate","Injector Updated!"),m):(c.err("InjectorUpdate","Something went wrong... restoring backups."),await new Promise(e=>i(p,e)),await new Promise(s=>t.rename(f,e,s)),m):(c.err("InjectorUpdate","Failed to rename the final directory"),m)};var Qt=new Kt;const es={get React(){return f.React},get ReactDOM(){return f.ReactDOM},get WindowConfigFile(){return""},get settings(){return L.collections},get emotes(){return{}},get version(){return o.version},getAllWindowPreferences:function(){return S.getData("windowprefs")||{}},getWindowPreference:function(e){return this.getAllWindowPreferences()[e]},setWindowPreference:function(e,t){const s=this.getAllWindowPreferences();return s[e]=t,S.setData("windowprefs",s)},injectCSS:function(e,t){D.injectStyle(e,t)},clearCSS:function(e){D.removeStyle(e)},linkJS:function(e,t){return D.injectScript(e,t)},unlinkJS:function(e){D.removeScript(e)},alert:function(e,t){oe.alert(e,t)},showConfirmationModal:function(e,t,s={}){return oe.showConfirmationModal(e,t,s)},showToast:function(e,t={}){W.show(e,t)},findModule:function(e){return g.getModule(e)},findAllModules:function(e){return g.getModule(e,!1)},findModuleByProps:function(...e){return g.getByProps(...e)},findModuleByPrototypes:function(...e){return g.getByPrototypes(...e)},findModuleByDisplayName:function(e){return g.getByDisplayName(e)},getInternalInstance:function(e){if(e instanceof window.jQuery||e instanceof Element)return e instanceof jQuery&&(e=e[0]),u.getReactInstance(e)},loadData:function(e,t){return S.getPluginData(e,t)}};es.getData=es.loadData,es.saveData=function(e,t,s){return S.setPluginData(e,t,s)},es.setData=es.saveData,es.deleteData=function(e,t){return S.deletePluginData(e,t)},es.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 c=e[t],h=()=>{a||console.log("unpatch",t,"of",d),e[t]=c};return e[t]=function(){const s={thisObject:this,methodArguments:arguments,cancelPatch:h,originalMethod:c,callOriginalMethod:()=>s.returnValue=s.originalMethod.apply(s.thisObject,s.methodArguments)};if(o){const n=u.suppressErrors(o,"`instead` callback of "+e[t].displayName)(s);void 0!==n&&(s.returnValue=n)}else n&&u.suppressErrors(n,"`before` callback of "+e[t].displayName)(s),s.callOriginalMethod(),i&&u.suppressErrors(i,"`after` callback of "+e[t].displayName)(s);return r&&h(),s.returnValue},e[t].__monkeyPatched=!0,e[t].__originalMethod||(e[t].__originalMethod=c),e[t].displayName="patched "+(e[t].displayName||t),h},es.onRemoved=function(e,t){return u.onRemoved(e,t)},es.suppressErrors=function(e,t){return u.suppressErrors(e,t)},es.testJSON=function(e){return u.testJSON(e)},es.getPlugin=function(e){return c.warn("BdApi","getPlugin is deprecated. Please make use of the addon api (BdApi.Plugins)"),Xe.addonList.find(t=>t.name==e)},es.isPluginEnabled=function(e){c.warn("BdApi","isPluginEnabled is deprecated. Please make use of the addon api (BdApi.Plugins)");const t=this.getPlugin(e);return!!t&&Xe.isEnabled(t.id)},es.isThemeEnabled=function(e){c.warn("BdApi","isThemeEnabled is deprecated. Please make use of the addon api (BdApi.Themes)");const t=Ke.addonList.find(t=>t.name==e);return!!t&&Ke.isEnabled(t.id)},es.isSettingEnabled=function(e,t,s){return L.get(e,t,s)},es.enableSetting=function(e,t,s){return L.set(e,t,s,!0)},es.disableSetting=function(e,t,s){return L.set(e,t,s,!1)},es.toggleSetting=function(e,t,s){return L.set(e,t,s,!L.get(e,t,s))},es.getBDData=function(e){return S.getBDData(e)},es.setBDData=function(e,t){return S.setBDData(e,t)};const ts=e=>new class{get folder(){return e.folder}isEnabled(t){return e.isEnabled(t)}enable(t){return e.enableAddon(t)}disable(t){return e.disableAddon(t)}toggle(t){return e.toggleAddon(t)}reload(t){return e.reloadAddon(t)}get(t){return e.addonList.find(e=>e.id==t||e.filename==t)}getAll(){return e.addonList}};es.Plugins=ts(Xe),es.Themes=ts(Ke),Object.freeze(es),Object.freeze(es.Plugins),Object.freeze(es.Themes);var ss=es;s.d(t,"default",(function(){return is})),function(){const e=Object.getOwnPropertyDescriptor(HTMLIFrameElement.prototype,"contentWindow").get;Object.defineProperty(HTMLIFrameElement.prototype,"contentWindow",{get:function(){const t=Reflect.apply(e,this,arguments);return new Proxy(t,{getOwnPropertyDescriptor:function(e,t){if("localStorage"!==t)return Object.getOwnPropertyDescriptor(e,t)},get:function(e,t){if("localStorage"===t)return null;const s=e[t];return"function"==typeof s?s.bind(e):s}})}}),Object.defineProperty(Reflect,"apply",{value:Reflect.apply,writable:!1,configurable:!1}),Object.defineProperty(Function.prototype,"bind",{value:Function.prototype.bind,writable:!1,configurable:!1});const t=XMLHttpRequest.prototype.open;XMLHttpRequest.prototype.open=function(){const e=arguments[1];return e.toLowerCase().includes("api/webhooks")?null:Reflect.apply(t,this,arguments)}}();const ns=document.createElement("div");ns.className="bd-loaderv2",ns.title="BandagedBD is loading...",document.body.appendChild(ns),window.BdApi=ss;class is{constructor(e){Qt.setConfig(e)}init(){Qt.init()}}!function(){const e="betterdiscord/",t=s(4),n=t._load;t._load=function(t){if("betterdiscord"===t||t.startsWith(e)){if("api"==t.substr(e.length))return ss}return n.apply(this,arguments)}}()}]).default; \ No newline at end of file diff --git a/src/index.js b/src/index.js index 9d92b101..e3f39c12 100644 --- a/src/index.js +++ b/src/index.js @@ -1,17 +1,17 @@ -import {Config} from "data"; +// import {Config} from "data"; import secure from "./secure"; import Core from "./modules/core"; import BdApi from "./modules/pluginapi"; -import PluginManager from "./modules/pluginmanager"; -import ThemeManager from "./modules/thememanager"; -import Events from "./modules/emitter"; -import Settings from "./modules/settingsmanager"; -import DataStore from "./modules/datastore"; -import EmoteModule from "./builtins/emotes/emotes"; -import DomManager from "./modules/dommanager"; -import Utilities from "./modules/utilities"; -import ReactComponents from "./modules/reactcomponents"; -import Strings from "./modules/strings"; +// import PluginManager from "./modules/pluginmanager"; +// import ThemeManager from "./modules/thememanager"; +// import Events from "./modules/emitter"; +// import Settings from "./modules/settingsmanager"; +// import DataStore from "./modules/datastore"; +// import EmoteModule from "./builtins/emotes/emotes"; +// import DomManager from "./modules/dommanager"; +// import Utilities from "./modules/utilities"; +// import ReactComponents from "./modules/reactcomponents"; +// import Strings from "./modules/strings"; // Perform some setup secure(); @@ -27,24 +27,24 @@ window.BdApi = BdApi; // window.settingsCookie = SettingsCookie; // window.pluginCookie = PluginCookie; // window.themeCookie = ThemeCookie; -window.pluginModule = PluginManager; -window.themeModule = ThemeManager; -// window.bdthemes = Themes; -// window.bdplugins = Plugins; -window.bdEmotes = EmoteModule.Emotes; -window.bemotes = EmoteModule.blacklist; -// window.bdPluginStorage = bdPluginStorage; -window.settingsModule = Settings; -window.DataStore = DataStore; +// window.pluginModule = PluginManager; +// window.themeModule = ThemeManager; +// // window.bdthemes = Themes; +// // window.bdplugins = Plugins; +// window.bdEmotes = EmoteModule.Emotes; +// window.bemotes = EmoteModule.blacklist; +// // window.bdPluginStorage = bdPluginStorage; +// window.settingsModule = Settings; +// window.DataStore = DataStore; -window.DomManager = DomManager; -window.utils = Utilities; -window.Components = ReactComponents; +// window.DomManager = DomManager; +// window.utils = Utilities; +// window.Components = ReactComponents; -window.BDEvents = Events; -window.bdConfig = Config; -window.Strings = Strings; +// window.BDEvents = Events; +// window.bdConfig = Config; +// window.Strings = Strings; export default class CoreWrapper { constructor(config) { diff --git a/src/modules/pluginmanager.js b/src/modules/pluginmanager.js index 316d5707..fb449529 100644 --- a/src/modules/pluginmanager.js +++ b/src/modules/pluginmanager.js @@ -97,6 +97,7 @@ export default new class PluginManager extends AddonManager { module.exports = meta; return ""; } + Logger.warn(this.name, `${meta.name}, please start assigning module.exports`); fileContent += `\nmodule.exports = ${JSON.stringify(meta)};\nmodule.exports.type = ${meta.exports || meta.name};`; return fileContent; }