From 22ac7a80908dfc5804cfdc420ca113976c2bc969 Mon Sep 17 00:00:00 2001 From: Jean Ouina Date: Wed, 27 May 2020 20:19:13 +0200 Subject: [PATCH] Lightcord Servers first commit --- BetterDiscordApp/js/main.js | 16 +++++----- BetterDiscordApp/src/0globals.js | 4 ++- BetterDiscordApp/src/modules/distant.js | 42 ++++++++++++++++++++----- 3 files changed, 46 insertions(+), 16 deletions(-) diff --git a/BetterDiscordApp/js/main.js b/BetterDiscordApp/js/main.js index 617a84b..eb91ad8 100644 --- a/BetterDiscordApp/js/main.js +++ b/BetterDiscordApp/js/main.js @@ -95,7 +95,7 @@ module.exports = /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"minimumDiscordVersion\", function() { return minimumDiscordVersion; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"currentDiscordVersion\", function() { return currentDiscordVersion; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"minSupportedVersion\", function() { return minSupportedVersion; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"bbdVersion\", function() { return bbdVersion; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"bbdChangelog\", function() { return bbdChangelog; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"settings\", function() { return settings; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"defaultCookie\", function() { return defaultCookie; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"settingsCookie\", function() { return settingsCookie; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"settingsRPC\", function() { return settingsRPC; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"defaultRPC\", function() { return defaultRPC; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"bdpluginErrors\", function() { return bdpluginErrors; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"bdthemeErrors\", function() { return bdthemeErrors; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"bdConfig\", function() { return bdConfig; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"bdthemes\", function() { return bdthemes; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"bdplugins\", function() { return bdplugins; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"pluginCookie\", function() { return pluginCookie; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"themeCookie\", function() { return themeCookie; });\n// var settingsPanel, voiceMode, pluginModule, themeModule, dMode, publicServersModule, mainCore, BDV2;\nconst minimumDiscordVersion = \"0.0.306\";\nconst currentDiscordVersion = window.DiscordNative && window.DiscordNative.remoteApp && window.DiscordNative.remoteApp.getVersion && window.DiscordNative.remoteApp.getVersion() || \"0.0.306\";\nconst minSupportedVersion = \"0.3.0\";\nconst bbdVersion = \"0.3.4\";\nconst bbdChangelog = {\n description: \"LightCord Edition.\",\n changes: [{\n title: \"What's New?\",\n items: [\"**LightCord** is now using BandagedBD. That means all plugins you were using can be used too !\", \"**Window Transparency** changes were made to more compatible with external window managers and addons like Glasscord.\", \"Initialization sequence has once again been changed slightly to hopefully improve loading times.\", \"We removed emotes. That's sad for people who were actually using it, but it was leading to more loading time and some basic words were emote.\"]\n }, {\n title: \"Bug Fixes\",\n type: \"fixed\",\n items: [\"Some fixes related to showing modals in the `BdApi`.\"]\n }]\n};\nconst settings = {\n \"Custom css live update\": {\n id: \"bda-css-0\",\n info: \"\",\n implemented: true,\n hidden: true,\n cat: \"core\"\n },\n \"Custom css auto udpate\": {\n id: \"bda-css-1\",\n info: \"\",\n implemented: true,\n hidden: true,\n cat: \"core\"\n },\n \"BetterDiscord Blue\": {\n id: \"bda-gs-b\",\n info: \"Replace Discord blue with BD Blue\",\n implemented: false,\n hidden: false,\n cat: \"core\"\n },\n\n /* Core */\n\n /* ====== */\n \"Public Servers\": {\n id: \"bda-gs-1\",\n info: \"Display public servers button\",\n implemented: true,\n hidden: false,\n cat: \"core\",\n category: \"modules\"\n },\n \"Minimal Mode\": {\n id: \"bda-gs-2\",\n info: \"Hide elements and reduce the size of elements.\",\n implemented: true,\n hidden: false,\n cat: \"core\",\n category: \"modules\"\n },\n \"Voice Mode\": {\n id: \"bda-gs-4\",\n info: \"Only show voice chat\",\n implemented: true,\n hidden: false,\n cat: \"core\",\n category: \"modules\"\n },\n \"Hide Channels\": {\n id: \"bda-gs-3\",\n info: \"Hide channels in minimal mode\",\n implemented: true,\n hidden: false,\n cat: \"core\",\n category: \"modules\"\n },\n \"Dark Mode\": {\n id: \"bda-gs-5\",\n info: \"Make certain elements dark by default(wip)\",\n implemented: true,\n hidden: false,\n cat: \"core\",\n category: \"modules\"\n },\n \"Voice Disconnect\": {\n id: \"bda-dc-0\",\n info: \"Disconnect from voice server when closing Discord\",\n implemented: true,\n hidden: false,\n cat: \"core\",\n category: \"modules\"\n },\n \"24 Hour Timestamps\": {\n id: \"bda-gs-6\",\n info: \"Replace 12hr timestamps with proper ones\",\n implemented: true,\n hidden: false,\n cat: \"core\",\n category: \"modules\"\n },\n \"Colored Text\": {\n id: \"bda-gs-7\",\n info: \"Make text color the same as role color\",\n implemented: true,\n hidden: false,\n cat: \"core\",\n category: \"modules\"\n },\n \"Normalize Classes\": {\n id: \"fork-ps-4\",\n info: \"Adds stable classes to elements to help themes. (e.g. adds .da-channels to .channels-Ie2l6A)\",\n implemented: true,\n hidden: false,\n cat: \"core\",\n category: \"modules\"\n },\n\n /* Content */\n \"Content Error Modal\": {\n id: \"fork-ps-1\",\n info: \"Shows a modal with plugin/theme errors\",\n implemented: true,\n hidden: false,\n cat: \"core\",\n category: \"content manager\"\n },\n \"Show Toasts\": {\n id: \"fork-ps-2\",\n info: \"Shows a small notification for important information\",\n implemented: true,\n hidden: false,\n cat: \"core\",\n category: \"content manager\"\n },\n \"Scroll To Settings\": {\n id: \"fork-ps-3\",\n info: \"Auto-scrolls to a plugin's settings when the button is clicked (only if out of view)\",\n implemented: true,\n hidden: false,\n cat: \"core\",\n category: \"content manager\"\n },\n \"Automatic Loading\": {\n id: \"fork-ps-5\",\n info: \"Automatically loads, reloads, and unloads plugins and themes\",\n implemented: true,\n hidden: false,\n cat: \"core\",\n category: \"content manager\"\n },\n\n /* Developer */\n \"Developer Mode\": {\n id: \"bda-gs-8\",\n info: \"Developer Mode Toggle\",\n implemented: true,\n hidden: false,\n cat: \"core\",\n category: \"developer settings\"\n },\n \"Copy Selector\": {\n id: \"fork-dm-1\",\n info: \"Adds a \\\"Copy Selector\\\" option to context menus when developer mode is active\",\n implemented: true,\n hidden: false,\n cat: \"core\",\n category: \"developer settings\"\n },\n \"React DevTools\": {\n id: \"reactDevTools\",\n info: \"Adds react developer tools to the devtools. Must be installed in Google Chrome on your pc.\",\n implemented: true,\n hidden: true,\n cat: \"core\",\n category: \"developer settings\"\n },\n\n /** LightCord */\n \"Disable BetterDiscord\": {\n id: \"bd-disable\",\n info: \"Disable Betterdiscord (plugins, themes, etc).\",\n implemented: false,\n hidden: false,\n cat: \"lightcord\",\n category: \"Lightcord\"\n },\n \"Calling Ring Beat\": {\n id: \"lightcord-2\",\n info: \"Enable Discord's special calling beat.\",\n implemented: true,\n hidden: false,\n cat: \"lightcord\",\n category: \"Lightcord\"\n },\n \"Developer Options\": {\n id: \"lightcord-1\",\n info: \"Enable Discord's Internal Developer Options. This allow the \\\"Experiments\\\" tab and the \\\"Developer Options\\\" tab. (must close and reopen settings)\",\n implemented: true,\n hidden: false,\n cat: \"lightcord\",\n category: \"Lightcord\"\n },\n \"Ad Block\": {\n id: \"lightcord-4\",\n info: \"Block any BOT that dm you with an invite link. Even in an embed.\",\n implemented: true,\n hidden: false,\n cat: \"lightcord\",\n category: \"Lightcord\"\n },\n\n /** Lightcord Window */\n \"Always-on-Top\": {\n id: \"lightcord-3\",\n info: \"Enable window's Always-on-Top mode, where Lightcord stays on top of other applications.\",\n implemented: true,\n hidden: false,\n cat: \"lightcord\",\n category: \"Window\"\n },\n\n /** RichPresence */\n \"Enable\": {\n id: \"lightcord-presence-1\",\n info: \"Enable RichPresence below.\",\n implemented: true,\n hidden: false,\n cat: \"status\"\n }\n};\nconst defaultCookie = {\n \"bda-gs-1\": true,\n \"bda-gs-2\": false,\n \"bda-gs-3\": false,\n \"bda-gs-4\": false,\n \"bda-gs-5\": true,\n \"bda-gs-6\": false,\n \"bda-gs-7\": false,\n \"bda-gs-8\": true,\n \"bda-es-0\": true,\n \"bda-es-1\": true,\n \"bda-es-2\": true,\n \"bda-es-4\": false,\n \"bda-es-6\": true,\n \"bda-es-7\": true,\n \"bda-gs-b\": false,\n \"bda-es-8\": true,\n \"bda-dc-0\": false,\n \"bda-css-0\": false,\n \"bda-css-1\": false,\n \"bda-es-9\": true,\n \"fork-dm-1\": false,\n \"fork-ps-1\": true,\n \"fork-ps-2\": true,\n \"fork-ps-3\": true,\n \"fork-ps-4\": true,\n \"fork-ps-5\": true,\n \"fork-es-2\": false,\n \"fork-es-3\": true,\n \"fork-wp-1\": false,\n \"fork-wp-2\": false,\n \"fork-beta\": true,\n \"reactDevTools\": false,\n \"lightcord-1\": false,\n \"lightcord-2\": true,\n \"lightcord-presence-1\": false,\n \"lightcord-3\": false,\n \"lightcord-4\": false\n};\nconst settingsCookie = {};\nconst settingsRPC = {};\nconst defaultRPC = {\n \"name\": \"Lightcord\",\n \"application_id\": \"711416957718757418\",\n \"state\": \"Lightcord Client\",\n \"details\": \"Browsing Discord\",\n \"timestamps.start\": Date.now(),\n \"assets.small\": null,\n \"assets.large\": \"712323821037682791\"\n};\nconst bdpluginErrors = [];\nconst bdthemeErrors = []; // define for backwards compatibility\n\nconst bdConfig = Object.create(BetterDiscordConfig);\nconst bdthemes = {};\nconst bdplugins = {};\nconst pluginCookie = {};\nconst themeCookie = {};//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxl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BO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBIiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///./src/0globals.js\n"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"minimumDiscordVersion\", function() { return minimumDiscordVersion; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"currentDiscordVersion\", function() { return currentDiscordVersion; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"minSupportedVersion\", function() { return minSupportedVersion; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"bbdVersion\", function() { return bbdVersion; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"bbdChangelog\", function() { return bbdChangelog; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"settings\", function() { return settings; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"defaultCookie\", function() { return defaultCookie; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"settingsCookie\", function() { return settingsCookie; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"settingsRPC\", function() { return settingsRPC; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"defaultRPC\", function() { return defaultRPC; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"bdpluginErrors\", function() { return bdpluginErrors; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"bdthemeErrors\", function() { return bdthemeErrors; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"bdConfig\", function() { return bdConfig; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"bdthemes\", function() { return bdthemes; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"bdplugins\", function() { return bdplugins; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"pluginCookie\", function() { return pluginCookie; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"themeCookie\", function() { return themeCookie; });\n// var settingsPanel, voiceMode, pluginModule, themeModule, dMode, publicServersModule, mainCore, BDV2;\nconst minimumDiscordVersion = \"0.0.306\";\nconst currentDiscordVersion = window.DiscordNative && window.DiscordNative.remoteApp && window.DiscordNative.remoteApp.getVersion && window.DiscordNative.remoteApp.getVersion() || \"0.0.306\";\nconst minSupportedVersion = \"0.3.0\";\nconst bbdVersion = \"0.3.4\";\nconst bbdChangelog = {\n description: \"LightCord Edition.\",\n changes: [{\n title: \"What's New?\",\n items: [\"**LightCord** is now using BandagedBD. That means all plugins you were using can be used too !\", \"**Window Transparency** changes were made to more compatible with external window managers and addons like Glasscord.\", \"Initialization sequence has once again been changed slightly to hopefully improve loading times.\", \"We removed emotes. That's sad for people who were actually using it, but it was leading to more loading time and some basic words were emote.\"]\n }, {\n title: \"Bug Fixes\",\n type: \"fixed\",\n items: [\"Some fixes related to showing modals in the `BdApi`.\"]\n }]\n};\nconst settings = {\n \"Custom css live update\": {\n id: \"bda-css-0\",\n info: \"\",\n implemented: true,\n hidden: true,\n cat: \"core\"\n },\n \"Custom css auto udpate\": {\n id: \"bda-css-1\",\n info: \"\",\n implemented: true,\n hidden: true,\n cat: \"core\"\n },\n \"BetterDiscord Blue\": {\n id: \"bda-gs-b\",\n info: \"Replace Discord blue with BD Blue\",\n implemented: false,\n hidden: false,\n cat: \"core\"\n },\n\n /* Core */\n\n /* ====== */\n \"Public Servers\": {\n id: \"bda-gs-1\",\n info: \"Display public servers button\",\n implemented: true,\n hidden: false,\n cat: \"core\",\n category: \"modules\"\n },\n \"Minimal Mode\": {\n id: \"bda-gs-2\",\n info: \"Hide elements and reduce the size of elements.\",\n implemented: true,\n hidden: false,\n cat: \"core\",\n category: \"modules\"\n },\n \"Voice Mode\": {\n id: \"bda-gs-4\",\n info: \"Only show voice chat\",\n implemented: true,\n hidden: false,\n cat: \"core\",\n category: \"modules\"\n },\n \"Hide Channels\": {\n id: \"bda-gs-3\",\n info: \"Hide channels in minimal mode\",\n implemented: true,\n hidden: false,\n cat: \"core\",\n category: \"modules\"\n },\n \"Dark Mode\": {\n id: \"bda-gs-5\",\n info: \"Make certain elements dark by default(wip)\",\n implemented: true,\n hidden: false,\n cat: \"core\",\n category: \"modules\"\n },\n \"Voice Disconnect\": {\n id: \"bda-dc-0\",\n info: \"Disconnect from voice server when closing Discord\",\n implemented: true,\n hidden: false,\n cat: \"core\",\n category: \"modules\"\n },\n \"24 Hour Timestamps\": {\n id: \"bda-gs-6\",\n info: \"Replace 12hr timestamps with proper ones\",\n implemented: true,\n hidden: false,\n cat: \"core\",\n category: \"modules\"\n },\n \"Colored Text\": {\n id: \"bda-gs-7\",\n info: \"Make text color the same as role color\",\n implemented: true,\n hidden: false,\n cat: \"core\",\n category: \"modules\"\n },\n \"Normalize Classes\": {\n id: \"fork-ps-4\",\n info: \"Adds stable classes to elements to help themes. (e.g. adds .da-channels to .channels-Ie2l6A)\",\n implemented: true,\n hidden: false,\n cat: \"core\",\n category: \"modules\"\n },\n\n /* Content */\n \"Content Error Modal\": {\n id: \"fork-ps-1\",\n info: \"Shows a modal with plugin/theme errors\",\n implemented: true,\n hidden: false,\n cat: \"core\",\n category: \"content manager\"\n },\n \"Show Toasts\": {\n id: \"fork-ps-2\",\n info: \"Shows a small notification for important information\",\n implemented: true,\n hidden: false,\n cat: \"core\",\n category: \"content manager\"\n },\n \"Scroll To Settings\": {\n id: \"fork-ps-3\",\n info: \"Auto-scrolls to a plugin's settings when the button is clicked (only if out of view)\",\n implemented: true,\n hidden: false,\n cat: \"core\",\n category: \"content manager\"\n },\n \"Automatic Loading\": {\n id: \"fork-ps-5\",\n info: \"Automatically loads, reloads, and unloads plugins and themes\",\n implemented: true,\n hidden: false,\n cat: \"core\",\n category: \"content manager\"\n },\n\n /* Developer */\n \"Developer Mode\": {\n id: \"bda-gs-8\",\n info: \"Developer Mode Toggle\",\n implemented: true,\n hidden: false,\n cat: \"core\",\n category: \"developer settings\"\n },\n \"Copy Selector\": {\n id: \"fork-dm-1\",\n info: \"Adds a \\\"Copy Selector\\\" option to context menus when developer mode is active\",\n implemented: true,\n hidden: false,\n cat: \"core\",\n category: \"developer settings\"\n },\n \"React DevTools\": {\n id: \"reactDevTools\",\n info: \"Adds react developer tools to the devtools. Must be installed in Google Chrome on your pc.\",\n implemented: true,\n hidden: true,\n cat: \"core\",\n category: \"developer settings\"\n },\n\n /** LightCord */\n \"Disable BetterDiscord\": {\n id: \"bd-disable\",\n info: \"Disable Betterdiscord (plugins, themes, etc).\",\n implemented: false,\n hidden: false,\n cat: \"lightcord\",\n category: \"Lightcord\"\n },\n \"Calling Ring Beat\": {\n id: \"lightcord-2\",\n info: \"Enable Discord's special calling beat.\",\n implemented: true,\n hidden: false,\n cat: \"lightcord\",\n category: \"Lightcord\"\n },\n \"Developer Options\": {\n id: \"lightcord-1\",\n info: \"Enable Discord's Internal Developer Options. This allow the \\\"Experiments\\\" tab and the \\\"Developer Options\\\" tab. (must close and reopen settings)\",\n implemented: true,\n hidden: false,\n cat: \"lightcord\",\n category: \"Lightcord\"\n },\n \"Ad Block\": {\n id: \"lightcord-4\",\n info: \"Block any BOT that dm you with an invite link. Even in an embed.\",\n implemented: true,\n hidden: false,\n cat: \"lightcord\",\n category: \"Lightcord\"\n },\n \"Enable Lightcord Servers\": {\n id: \"lightcord-5\",\n info: \"Disabling it erase any informations about you in our servers. But you won't see anything like custom badges.\",\n implemented: true,\n hidden: false,\n cat: \"lightcord\",\n category: \"Lightcord\"\n },\n\n /** Lightcord Window */\n \"Always-on-Top\": {\n id: \"lightcord-3\",\n info: \"Enable window's Always-on-Top mode, where Lightcord stays on top of other applications.\",\n implemented: true,\n hidden: false,\n cat: \"lightcord\",\n category: \"Window\"\n },\n\n /** RichPresence */\n \"Enable\": {\n id: \"lightcord-presence-1\",\n info: \"Enable RichPresence below.\",\n implemented: true,\n hidden: false,\n cat: \"status\"\n }\n};\nconst defaultCookie = {\n \"bda-gs-1\": true,\n \"bda-gs-2\": false,\n \"bda-gs-3\": false,\n \"bda-gs-4\": false,\n \"bda-gs-5\": true,\n \"bda-gs-6\": false,\n \"bda-gs-7\": false,\n \"bda-gs-8\": true,\n \"bda-es-0\": true,\n \"bda-es-1\": true,\n \"bda-es-2\": true,\n \"bda-es-4\": false,\n \"bda-es-6\": true,\n \"bda-es-7\": true,\n \"bda-gs-b\": false,\n \"bda-es-8\": true,\n \"bda-dc-0\": false,\n \"bda-css-0\": false,\n \"bda-css-1\": false,\n \"bda-es-9\": true,\n \"fork-dm-1\": false,\n \"fork-ps-1\": true,\n \"fork-ps-2\": true,\n \"fork-ps-3\": true,\n \"fork-ps-4\": true,\n \"fork-ps-5\": true,\n \"fork-es-2\": false,\n \"fork-es-3\": true,\n \"fork-wp-1\": false,\n \"fork-wp-2\": false,\n \"fork-beta\": true,\n \"reactDevTools\": false,\n \"lightcord-1\": false,\n \"lightcord-2\": true,\n \"lightcord-presence-1\": false,\n \"lightcord-3\": false,\n \"lightcord-4\": false,\n \"lightcord-5\": true\n};\nconst settingsCookie = {};\nconst settingsRPC = {};\nconst defaultRPC = {\n \"name\": \"Lightcord\",\n \"application_id\": \"711416957718757418\",\n \"state\": \"Lightcord Client\",\n \"details\": \"Browsing Discord\",\n \"timestamps.start\": Date.now(),\n \"assets.small\": null,\n \"assets.large\": \"712323821037682791\"\n};\nconst bdpluginErrors = [];\nconst bdthemeErrors = []; // define for backwards compatibility\n\nconst bdConfig = Object.create(BetterDiscordConfig);\nconst bdthemes = {};\nconst bdplugins = {};\nconst pluginCookie = {};\nconst themeCookie = {};//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiLi9zcmMvMGdsb2JhbHMuanMuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly9CZXR0ZXJEaXNjb3JkLy4vc3JjLzBnbG9iYWxzLmpzPzAwZDIiXSwic291cmNlc0NvbnRlbnQiOlsiLy8gdmFyIHNldHRpbmdzUGFuZWwsIHZvaWNlTW9kZSwgcGx1Z2luTW9kdWxlLCB0aGVtZU1vZHVsZSwgZE1vZGUsIHB1YmxpY1NlcnZlcnNNb2R1bGUsIG1haW5Db3JlLCBCRFYyO1xuZXhwb3J0IGNvbnN0IG1pbmltdW1EaXNjb3JkVmVyc2lvbiA9IFwiMC4wLjMwNlwiO1xuZXhwb3J0IGNvbnN0IGN1cnJlbnREaXNjb3JkVmVyc2lvbiA9IHdpbmRvdy5EaXNjb3JkTmF0aXZlICYmIHdpbmRvdy5EaXNjb3JkTmF0aXZlLnJlbW90ZUFwcCAmJiB3aW5kb3cuRGlzY29yZE5hdGl2ZS5yZW1vdGVBcHAuZ2V0VmVyc2lvbiAmJiB3aW5kb3cuRGlzY29yZE5hdGl2ZS5yZW1vdGVBcHAuZ2V0VmVyc2lvbigpIHx8IFwiMC4wLjMwNlwiO1xuZXhwb3J0IGNvbnN0IG1pblN1cHBvcnRlZFZlcnNpb24gPSBcIjA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tBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQSIsInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///./src/0globals.js\n"); /***/ }), @@ -239,7 +239,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _0gl /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _0globals__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../0globals */ \"./src/0globals.js\");\n/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./utils */ \"./src/modules/utils.js\");\n/* harmony import */ var _v2__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./v2 */ \"./src/modules/v2.js\");\n/* harmony import */ var _settingsPanel__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./settingsPanel */ \"./src/modules/settingsPanel.js\");\n/* harmony import */ var _pluginModule__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./pluginModule */ \"./src/modules/pluginModule.js\");\n/* harmony import */ var _themeModule__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./themeModule */ \"./src/modules/themeModule.js\");\n/* harmony import */ var _dataStore__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./dataStore */ \"./src/modules/dataStore.js\");\n/* harmony import */ var _webpackModules__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./webpackModules */ \"./src/modules/webpackModules.js\");\n/* harmony import */ var _domtools__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./domtools */ \"./src/modules/domtools.js\");\n/* harmony import */ var _ui_bdLogo__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../ui/bdLogo */ \"./src/ui/bdLogo.js\");\n/* harmony import */ var _ui_tooltipWrap__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../ui/tooltipWrap */ \"./src/ui/tooltipWrap.js\");\n/* harmony import */ var _svg_lightcord__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../svg/lightcord */ \"./src/svg/lightcord.jsx\");\n/* harmony import */ var _pluginCertifier__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./pluginCertifier */ \"./src/modules/pluginCertifier.js\");\n/* harmony import */ var _distant__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./distant */ \"./src/modules/distant.js\");\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nfunction Core() {// Object.assign(bdConfig, __non_webpack_require__(DataStore.configFile));\n // this.init();\n}\n\nCore.prototype.setConfig = function (config) {\n Object.assign(_0globals__WEBPACK_IMPORTED_MODULE_0__[\"bdConfig\"], config);\n};\n\nCore.prototype.init = async function () {\n if (!Array.prototype.flat) {\n _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].alert(\"Not Supported\", \"BetterDiscord v\" + _0globals__WEBPACK_IMPORTED_MODULE_0__[\"bbdVersion\"] + \" does not support this old version (\" + _0globals__WEBPACK_IMPORTED_MODULE_0__[\"currentDiscordVersion\"] + \") of Discord. Please update your Discord installation before proceeding.\");\n return;\n }\n\n if (_0globals__WEBPACK_IMPORTED_MODULE_0__[\"bdConfig\"].version < _0globals__WEBPACK_IMPORTED_MODULE_0__[\"minSupportedVersion\"]) {\n _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].alert(\"Not Supported\", \"BetterDiscord v\" + _0globals__WEBPACK_IMPORTED_MODULE_0__[\"bdConfig\"].version + \" (your version)\" + \" is not supported by the latest js (\" + _0globals__WEBPACK_IMPORTED_MODULE_0__[\"bbdVersion\"] + \").

Please download the latest version from GitHub\");\n return;\n }\n\n if (window.ED) {\n _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].alert(\"Not Supported\", \"BandagedBD does not work with EnhancedDiscord. Please uninstall one of them.\");\n return;\n }\n\n if (window.WebSocket && window.WebSocket.name && window.WebSocket.name.includes(\"Patched\")) {\n _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].alert(\"Not Supported\", \"BandagedBD does not work with Powercord. Please uninstall one of them.\");\n return;\n }\n\n const latestLocalVersion = _0globals__WEBPACK_IMPORTED_MODULE_0__[\"bdConfig\"].updater ? _0globals__WEBPACK_IMPORTED_MODULE_0__[\"bdConfig\"].updater.LatestVersion : _0globals__WEBPACK_IMPORTED_MODULE_0__[\"bdConfig\"].latestVersion;\n\n if (latestLocalVersion > _0globals__WEBPACK_IMPORTED_MODULE_0__[\"bdConfig\"].version) {\n _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].showConfirmationModal(\"Update Available\", [`There is an update available for BandagedBD's Injector (${latestLocalVersion}).`, \"You can either update and restart now, or later.\"], {\n confirmText: \"Update Now\",\n cancelText: \"Maybe Later\",\n onConfirm: async () => {\n const onUpdateFailed = () => {\n _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].alert(\"Could Not Update\", `Unable to update automatically, please download the installer and reinstall normally.

Download Installer`);\n };\n\n try {\n const didUpdate = await this.updateInjector();\n if (!didUpdate) return onUpdateFailed();\n\n const app = __webpack_require__(/*! electron */ \"electron\").remote.app;\n\n app.relaunch();\n app.exit();\n } catch (err) {\n onUpdateFailed();\n }\n }\n });\n }\n\n _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].log(\"Startup\", \"Initializing Settings\");\n this.initSettings();\n await this.checkForGuilds();\n _v2__WEBPACK_IMPORTED_MODULE_2__[\"default\"].initialize();\n _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].log(\"Startup\", \"Updating Settings\");\n _settingsPanel__WEBPACK_IMPORTED_MODULE_3__[\"default\"].initializeSettings();\n _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].log(\"Startup\", \"Loading Plugins\");\n _pluginModule__WEBPACK_IMPORTED_MODULE_4__[\"default\"].loadPlugins();\n _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].log(\"Startup\", \"Loading Themes\");\n _themeModule__WEBPACK_IMPORTED_MODULE_5__[\"default\"].loadThemes();\n _domtools__WEBPACK_IMPORTED_MODULE_8__[\"default\"].addStyle(\"customcss\", atob(_dataStore__WEBPACK_IMPORTED_MODULE_6__[\"default\"].getBDData(\"bdcustomcss\")));\n window.addEventListener(\"beforeunload\", function () {\n if (_0globals__WEBPACK_IMPORTED_MODULE_0__[\"settingsCookie\"][\"bda-dc-0\"]) document.querySelector(\".btn.btn-disconnect\").click();\n });\n new _pluginCertifier__WEBPACK_IMPORTED_MODULE_12__[\"default\"]().start();\n _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].log(\"Startup\", \"Removing Loading Icon\");\n if (document.getElementsByClassName(\"bd-loaderv2\").length) document.getElementsByClassName(\"bd-loaderv2\")[0].remove();\n _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].log(\"Startup\", \"Initializing Main Observer\");\n this.initObserver(); // Show loading errors\n\n if (_0globals__WEBPACK_IMPORTED_MODULE_0__[\"settingsCookie\"][\"fork-ps-1\"]) {\n _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].log(\"Startup\", \"Collecting Startup Errors\");\n _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].showContentErrors({\n plugins: _0globals__WEBPACK_IMPORTED_MODULE_0__[\"bdpluginErrors\"],\n themes: _0globals__WEBPACK_IMPORTED_MODULE_0__[\"bdthemeErrors\"]\n });\n }\n\n const previousVersion = _dataStore__WEBPACK_IMPORTED_MODULE_6__[\"default\"].getBDData(\"version\");\n\n if (_0globals__WEBPACK_IMPORTED_MODULE_0__[\"bbdVersion\"] > previousVersion) {\n if (_0globals__WEBPACK_IMPORTED_MODULE_0__[\"bbdChangelog\"]) this.showChangelogModal(_0globals__WEBPACK_IMPORTED_MODULE_0__[\"bbdChangelog\"]);\n _dataStore__WEBPACK_IMPORTED_MODULE_6__[\"default\"].setBDData(\"version\", _0globals__WEBPACK_IMPORTED_MODULE_0__[\"bbdVersion\"]);\n }\n\n _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].suppressErrors(this.patchSocial.bind(this), \"BD Social Patch\")();\n _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].suppressErrors(this.patchGuildPills.bind(this), \"BD Guild Pills Patch\")();\n _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].suppressErrors(this.patchGuildListItems.bind(this), \"BD Guild List Items Patch\")();\n _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].suppressErrors(this.patchGuildSeparator.bind(this), \"BD Guild Separator Patch\")();\n _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].suppressErrors(this.patchMessageHeader.bind(this), \"BD Badge Chat Patch\")();\n _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].suppressErrors(this.patchMemberList.bind(this), \"BD Badge Member List Patch\")();\n\n if (_0globals__WEBPACK_IMPORTED_MODULE_0__[\"bdConfig\"].haveInstalledDefault) {\n let alert = _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].alert(\"First Installation\", \"As it is the first time you install Lightcord, We added two default themes and one default plugin in your plugin/theme folder. Check it in the Plugin/Theme settings.\");\n await new Promise(resolve => {\n alert.onClose(resolve);\n });\n }\n};\n\nCore.prototype.checkForGuilds = function () {\n let timesChecked = 0;\n return new Promise(resolve => {\n const checkForGuilds = function () {\n const wrapper = _v2__WEBPACK_IMPORTED_MODULE_2__[\"default\"].guildClasses.wrapper.split(\" \")[0];\n if (document.querySelectorAll(`.${wrapper}`).length > 0) timesChecked++;\n const guild = _v2__WEBPACK_IMPORTED_MODULE_2__[\"default\"].guildClasses.listItem.split(\" \")[0];\n const blob = _v2__WEBPACK_IMPORTED_MODULE_2__[\"default\"].guildClasses.blobContainer.split(\" \")[0];\n if (document.querySelectorAll(`.${wrapper} .${guild} .${blob}`).length > 0) return resolve(_0globals__WEBPACK_IMPORTED_MODULE_0__[\"bdConfig\"].deferLoaded = true);else if (timesChecked >= 50) return resolve(_0globals__WEBPACK_IMPORTED_MODULE_0__[\"bdConfig\"].deferLoaded = true);\n setTimeout(checkForGuilds, 100);\n };\n\n if (document.readyState != \"loading\") setTimeout(checkForGuilds, 100);\n document.addEventListener(\"DOMContentLoaded\", () => {\n setTimeout(checkForGuilds, 100);\n });\n });\n};\n\nCore.prototype.injectExternals = async function () {\n await _domtools__WEBPACK_IMPORTED_MODULE_8__[\"default\"].addScript(\"ace-script\", \"https://cdnjs.cloudflare.com/ajax/libs/ace/1.2.9/ace.js\");\n if (window.require.original) window.require = window.require.original;\n};\n\nCore.prototype.initSettings = function () {\n _dataStore__WEBPACK_IMPORTED_MODULE_6__[\"default\"].initialize();\n\n if (!_dataStore__WEBPACK_IMPORTED_MODULE_6__[\"default\"].getSettingGroup(\"settings\") && !_dataStore__WEBPACK_IMPORTED_MODULE_6__[\"default\"].getSettingGroup(\"rpc\")) {\n if (!_dataStore__WEBPACK_IMPORTED_MODULE_6__[\"default\"].getSettingGroup(\"settings\")) {\n Object.assign(_0globals__WEBPACK_IMPORTED_MODULE_0__[\"settingsCookie\"], _0globals__WEBPACK_IMPORTED_MODULE_0__[\"defaultCookie\"]);\n }\n\n if (!_dataStore__WEBPACK_IMPORTED_MODULE_6__[\"default\"].getSettingGroup(\"rpc\")) {\n Object.assign(_0globals__WEBPACK_IMPORTED_MODULE_0__[\"settingsRPC\"], _0globals__WEBPACK_IMPORTED_MODULE_0__[\"defaultRPC\"]);\n }\n\n _settingsPanel__WEBPACK_IMPORTED_MODULE_3__[\"default\"].saveSettings();\n } else {\n _settingsPanel__WEBPACK_IMPORTED_MODULE_3__[\"default\"].loadSettings();\n\n for (const setting in _0globals__WEBPACK_IMPORTED_MODULE_0__[\"defaultCookie\"]) {\n if (_0globals__WEBPACK_IMPORTED_MODULE_0__[\"settingsCookie\"][setting] == undefined) {\n _0globals__WEBPACK_IMPORTED_MODULE_0__[\"settingsCookie\"][setting] = _0globals__WEBPACK_IMPORTED_MODULE_0__[\"defaultCookie\"][setting];\n _settingsPanel__WEBPACK_IMPORTED_MODULE_3__[\"default\"].saveSettings();\n }\n }\n }\n};\n\nCore.prototype.initObserver = function () {\n const mainObserver = new MutationObserver(mutations => {\n for (let i = 0, mlen = mutations.length; i < mlen; i++) {\n const mutation = mutations[i];\n if (typeof _pluginModule__WEBPACK_IMPORTED_MODULE_4__[\"default\"] !== \"undefined\") _pluginModule__WEBPACK_IMPORTED_MODULE_4__[\"default\"].rawObserver(mutation); // if there was nothing added, skip\n\n if (!mutation.addedNodes.length || !(mutation.addedNodes[0] instanceof Element)) continue;\n const node = mutation.addedNodes[0];\n let [classNameLayer, classNameSocialLinks] = [BDModules.get(e => e.layer && typeof e.layer === \"string\" && e.animating)[0].layer, BDModules.get(e => e.socialLinks && typeof e.socialLinks === \"string\")[0].socialLinks];\n\n if (node.classList.contains(classNameLayer)) {\n if (node.getElementsByClassName(\"guild-settings-base-section\").length) node.setAttribute(\"layer-id\", \"server-settings\");\n\n if (node.getElementsByClassName(classNameSocialLinks).length) {\n node.setAttribute(\"layer-id\", \"user-settings\");\n node.setAttribute(\"id\", \"user-settings\");\n if (!document.getElementById(\"bd-settings-sidebar\")) _settingsPanel__WEBPACK_IMPORTED_MODULE_3__[\"default\"].renderSidebar();\n }\n }\n\n if (node.parentElement == document.body && node.querySelector(\"#ace_settingsmenu\")) node.id = \"ace_settingsmenu_container\"; // Emoji Picker\n //node.getElementsByClassName(\"emojiPicker-3m1S-j\").length && !node.querySelector(\".emojiPicker-3m1S-j\").parentElement.classList.contains(\"animatorLeft-1EQxU0\")\n //if (node.classList.contains(classNameLayer2) && node.getElementsByClassName(classNameEmojiPicker).length && !node.querySelector(\".\"+classNameEmojiPicker).parentElement.classList.contains(classNameAnimatorLeft)) quickEmoteMenu.obsCallback(node);\n }\n });\n mainObserver.observe(document, {\n childList: true,\n subtree: true\n });\n};\n\nCore.prototype.showChangelogModal = function (options = {}) {\n return _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].showChangelogModal(options);\n};\n\nCore.prototype.alert = function (title, content) {\n return _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].alert(title, content);\n};\n\nCore.prototype.patchSocial = function () {\n if (this.socialPatch) return;\n const TabBar = _webpackModules__WEBPACK_IMPORTED_MODULE_7__[\"default\"].find(m => m.displayName == \"TabBar\");\n const Anchor = _webpackModules__WEBPACK_IMPORTED_MODULE_7__[\"default\"].find(m => m.displayName == \"Anchor\");\n if (!TabBar) return;\n this.socialPatch = _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].monkeyPatch(TabBar.prototype, \"render\", {\n after: data => {\n const children = data.returnValue.props.children;\n if (!children || !children.length || children.length < 3) return;\n if (children[children.length - 3].type.displayName !== \"Separator\") return;\n if (!children[children.length - 2].type.toString().includes(\"socialLinks\")) return;\n\n if (Anchor) {\n let socialModule1 = BDModules.get(e => e.socialLinks)[0];\n const original = children[children.length - 2].type;\n\n const newOne = function () {\n const returnVal = original(...arguments);\n returnVal.props.children.push(_v2__WEBPACK_IMPORTED_MODULE_2__[\"default\"].React.createElement(_ui_tooltipWrap__WEBPACK_IMPORTED_MODULE_10__[\"default\"], {\n color: \"black\",\n side: \"top\",\n text: \"Lightcord\"\n }, _v2__WEBPACK_IMPORTED_MODULE_2__[\"default\"].React.createElement(Anchor, {\n className: \"bd-social-link \" + socialModule1.link,\n href: \"https://github.com/Lightcord/Lightcord\",\n title: \"Lightcord\",\n target: \"_blank\"\n }, _v2__WEBPACK_IMPORTED_MODULE_2__[\"default\"].React.createElement(_svg_lightcord__WEBPACK_IMPORTED_MODULE_11__[\"default\"], {\n size: \"16px\",\n className: \"bd-social-logo\"\n }))));\n returnVal.props.children.push(_v2__WEBPACK_IMPORTED_MODULE_2__[\"default\"].React.createElement(_ui_tooltipWrap__WEBPACK_IMPORTED_MODULE_10__[\"default\"], {\n color: \"black\",\n side: \"top\",\n text: \"BandagedBD\"\n }, _v2__WEBPACK_IMPORTED_MODULE_2__[\"default\"].React.createElement(Anchor, {\n className: \"bd-social-link \" + socialModule1.link,\n href: \"https://github.com/rauenzi/BetterDiscordApp\",\n title: \"BandagedBD\",\n target: \"_blank\"\n }, _v2__WEBPACK_IMPORTED_MODULE_2__[\"default\"].React.createElement(_ui_bdLogo__WEBPACK_IMPORTED_MODULE_9__[\"default\"], {\n size: \"16px\",\n className: \"bd-social-logo\"\n }))));\n return returnVal;\n };\n\n children[children.length - 2].type = newOne;\n }\n\n let [classNameColorMuted, sizes, classNameVersionHash] = [BDModules.get(e => e.colorMuted)[0].colorMuted, BDModules.get(e => e.size32)[0], BDModules.get(e => e.versionHash)[0].versionHash];\n const injector = _v2__WEBPACK_IMPORTED_MODULE_2__[\"default\"].react.createElement(\"div\", {\n className: `${classNameColorMuted} ${sizes.size12}`\n }, `Injector ${_0globals__WEBPACK_IMPORTED_MODULE_0__[\"bdConfig\"].version}`);\n const versionHash = `(${_0globals__WEBPACK_IMPORTED_MODULE_0__[\"bdConfig\"].hash ? _0globals__WEBPACK_IMPORTED_MODULE_0__[\"bdConfig\"].hash.substring(0, 7) : _0globals__WEBPACK_IMPORTED_MODULE_0__[\"bdConfig\"].branch})`;\n const additional = _v2__WEBPACK_IMPORTED_MODULE_2__[\"default\"].react.createElement(\"div\", {\n className: `${classNameColorMuted} ${sizes.size12}`\n }, `BBD ${_0globals__WEBPACK_IMPORTED_MODULE_0__[\"bbdVersion\"]} `, _v2__WEBPACK_IMPORTED_MODULE_2__[\"default\"].react.createElement(\"span\", {\n className: classNameVersionHash + \" da-versionHash\"\n }, versionHash));\n const originalVersions = children[children.length - 1].type;\n\n children[children.length - 1].type = function () {\n const returnVal = originalVersions(...arguments);\n returnVal.props.children.splice(returnVal.props.children.length - 1, 0, injector);\n returnVal.props.children.splice(1, 0, additional);\n return returnVal;\n };\n }\n });\n};\n\nconst getGuildClasses = function () {\n const guildsWrapper = _webpackModules__WEBPACK_IMPORTED_MODULE_7__[\"default\"].findByProps(\"wrapper\", \"unreadMentionsBar\");\n const guilds = _webpackModules__WEBPACK_IMPORTED_MODULE_7__[\"default\"].findByProps(\"guildsError\", \"selected\");\n const pill = _webpackModules__WEBPACK_IMPORTED_MODULE_7__[\"default\"].findByProps(\"blobContainer\");\n return Object.assign({}, guildsWrapper, guilds, pill);\n};\n\nCore.prototype.patchGuildListItems = function () {\n if (this.guildListItemsPatch) return;\n const GuildClasses = getGuildClasses();\n const listItemClass = GuildClasses.listItem.split(\" \")[0];\n const blobClass = GuildClasses.blobContainer.split(\" \")[0];\n const reactInstance = _v2__WEBPACK_IMPORTED_MODULE_2__[\"default\"].getInternalInstance(document.querySelector(`.${listItemClass} .${blobClass}`).parentElement);\n const GuildComponent = reactInstance.return.type;\n if (!GuildComponent) return;\n this.guildListItemsPatch = _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].monkeyPatch(GuildComponent.prototype, \"render\", {\n after: data => {\n if (data.returnValue && data.thisObject) {\n const returnValue = data.returnValue;\n const guildData = data.thisObject.props;\n returnValue.props.className += \" bd-guild\";\n if (guildData.unread) returnValue.props.className += \" bd-unread\";\n if (guildData.selected) returnValue.props.className += \" bd-selected\";\n if (guildData.audio) returnValue.props.className += \" bd-audio\";\n if (guildData.video) returnValue.props.className += \" bd-video\";\n if (guildData.badge) returnValue.props.className += \" bd-badge\";\n if (guildData.animatable) returnValue.props.className += \" bd-animatable\";\n return returnValue;\n }\n }\n });\n};\n\nCore.prototype.patchGuildPills = function () {\n if (this.guildPillPatch) return;\n const guildPill = _webpackModules__WEBPACK_IMPORTED_MODULE_7__[\"default\"].find(m => m.default && !m.default.displayName && m.default.toString && m.default.toString().includes(\"translate3d\"));\n if (!guildPill) return;\n this.guildPillPatch = _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].monkeyPatch(guildPill, \"default\", {\n after: data => {\n const props = data.methodArguments[0];\n if (props.unread) data.returnValue.props.className += \" bd-unread\";\n if (props.selected) data.returnValue.props.className += \" bd-selected\";\n if (props.hovered) data.returnValue.props.className += \" bd-hovered\";\n return data.returnValue;\n }\n });\n};\n\nCore.prototype.patchGuildSeparator = function () {\n if (this.guildSeparatorPatch) return;\n const Guilds = _webpackModules__WEBPACK_IMPORTED_MODULE_7__[\"default\"].findByDisplayName(\"Guilds\");\n const guildComponents = _webpackModules__WEBPACK_IMPORTED_MODULE_7__[\"default\"].findByProps(\"renderListItem\");\n if (!guildComponents || !Guilds) return;\n\n const GuildSeparator = function () {\n const returnValue = guildComponents.Separator(...arguments);\n returnValue.props.className += \" bd-guild-separator\";\n return returnValue;\n };\n\n this.guildSeparatorPatch = _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].monkeyPatch(Guilds.prototype, \"render\", {\n after: data => {\n data.returnValue.props.children[1].props.children[3].type = GuildSeparator;\n }\n });\n};\n\nCore.prototype.patchMessageHeader = function () {\n if (this.messageHeaderPatch) return;\n const MessageHeader = _webpackModules__WEBPACK_IMPORTED_MODULE_7__[\"default\"].findByProps(\"MessageTimestamp\");\n const Anchor = _webpackModules__WEBPACK_IMPORTED_MODULE_7__[\"default\"].find(m => m.displayName == \"Anchor\");\n if (!Anchor || !MessageHeader || !MessageHeader.default) return;\n this.messageHeaderPatch = _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].monkeyPatch(MessageHeader, \"default\", {\n after: data => {\n const author = _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].getNestedProp(data.methodArguments[0], \"message.author\"); // const header = Utils.getNestedProp(data.returnValue, \"props.children.1.props\");\n\n const children = _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].getNestedProp(data.returnValue, \"props.children.1.props.children.1.props.children\");\n if (!children || !author || !author.id) return; // if (header && header.className) header.className += \" \"\n\n if (!Array.isArray(children)) return;\n\n if (author.id === \"249746236008169473\") {\n // Rauenzi: BandagedBD Developer\n children.push(_v2__WEBPACK_IMPORTED_MODULE_2__[\"default\"].React.createElement(_ui_tooltipWrap__WEBPACK_IMPORTED_MODULE_10__[\"default\"], {\n color: \"black\",\n side: \"top\",\n text: \"BandagedBD Developer\"\n }, _v2__WEBPACK_IMPORTED_MODULE_2__[\"default\"].React.createElement(Anchor, {\n className: \"bd-chat-badge\",\n href: \"https://github.com/rauenzi/BetterDiscordApp\",\n title: \"BandagedBD\",\n target: \"_blank\"\n }, _v2__WEBPACK_IMPORTED_MODULE_2__[\"default\"].React.createElement(_ui_bdLogo__WEBPACK_IMPORTED_MODULE_9__[\"default\"], {\n size: \"16px\",\n className: \"bd-logo\"\n }))));\n } else if (author.id === \"696481194443014174\" || author.id === \"696003456611385396\") {\n // Not Thomiz: Lightcord Developer, Phorcys: Lightcord Developer\n children.push(_v2__WEBPACK_IMPORTED_MODULE_2__[\"default\"].React.createElement(_ui_tooltipWrap__WEBPACK_IMPORTED_MODULE_10__[\"default\"], {\n color: \"black\",\n side: \"top\",\n text: \"Lightcord Developer\"\n }, _v2__WEBPACK_IMPORTED_MODULE_2__[\"default\"].React.createElement(Anchor, {\n className: \"bd-chat-badge\",\n href: \"https://github.com/Lightcord/Lightcord\",\n title: \"Lightcord\",\n target: \"_blank\"\n }, _v2__WEBPACK_IMPORTED_MODULE_2__[\"default\"].React.createElement(_svg_lightcord__WEBPACK_IMPORTED_MODULE_11__[\"default\"], {\n size: \"16px\",\n className: \"bd-logo\"\n }))));\n }\n\n const id = Object(_distant__WEBPACK_IMPORTED_MODULE_13__[\"uuidv4\"])();\n children.push(_v2__WEBPACK_IMPORTED_MODULE_2__[\"default\"].React.createElement(\"div\", {\n id: \"badges-\" + id,\n style: {\n display: \"inline\"\n }\n }));\n applyBadges(id, author, true);\n }\n });\n};\n\nfunction applyBadges(id, user, chat) {\n process.nextTick(() => {\n const div = document.getElementById(\"badges-\" + id);\n if (!div || div.childNodes.length > 0) return;\n const Anchor = _webpackModules__WEBPACK_IMPORTED_MODULE_7__[\"default\"].find(m => m.displayName == \"Anchor\");\n _distant__WEBPACK_IMPORTED_MODULE_13__[\"default\"].getBadges(user.id).then(badges => {\n badges.forEach(badge => {\n const props = {\n size: \"16px\",\n className: \"bd-logo\"\n };\n badge.scopes.forEach(scope => {// TODO: implement scope for badges (user, channel, etc)\n });\n const element = _v2__WEBPACK_IMPORTED_MODULE_2__[\"default\"].React.createElement(_ui_tooltipWrap__WEBPACK_IMPORTED_MODULE_10__[\"default\"], {\n color: \"black\",\n side: \"top\",\n text: badge.name\n }, _v2__WEBPACK_IMPORTED_MODULE_2__[\"default\"].React.createElement(Anchor, {\n className: chat ? \"bd-chat-badge\" : \"bd-member-badge\",\n href: badge.href,\n title: badge.name,\n target: \"_blank\"\n }, _v2__WEBPACK_IMPORTED_MODULE_2__[\"default\"].React.createElement(badge.component, props)));\n const div2 = document.createElement(\"div\");\n _v2__WEBPACK_IMPORTED_MODULE_2__[\"default\"].reactDom.render(element, div2);\n div2.childNodes.forEach(node => {\n div.appendChild(node);\n });\n });\n });\n });\n}\n\nCore.prototype.patchMemberList = function () {\n if (this.memberListPatch) return;\n const MemberListItem = _webpackModules__WEBPACK_IMPORTED_MODULE_7__[\"default\"].findByDisplayName(\"MemberListItem\");\n const Anchor = _webpackModules__WEBPACK_IMPORTED_MODULE_7__[\"default\"].find(m => m.displayName == \"Anchor\");\n if (!Anchor || !MemberListItem || !MemberListItem.prototype || !MemberListItem.prototype.renderDecorators) return;\n this.memberListPatch = _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].monkeyPatch(MemberListItem.prototype, \"renderDecorators\", {\n after: data => {\n const user = _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].getNestedProp(data.thisObject, \"props.user\");\n const children = _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].getNestedProp(data.returnValue, \"props.children\");\n if (!children || !user || !user.id) return; // if (header && header.className) header.className += \" \"\n\n if (!Array.isArray(children)) return;\n\n if (user.id === \"249746236008169473\") {\n children.push(_v2__WEBPACK_IMPORTED_MODULE_2__[\"default\"].React.createElement(_ui_tooltipWrap__WEBPACK_IMPORTED_MODULE_10__[\"default\"], {\n color: \"black\",\n side: \"top\",\n text: \"BandagedBD Developer\"\n }, _v2__WEBPACK_IMPORTED_MODULE_2__[\"default\"].React.createElement(Anchor, {\n className: \"bd-member-badge\",\n href: \"https://github.com/rauenzi/BetterDiscordApp\",\n title: \"BandagedBD\",\n target: \"_blank\"\n }, _v2__WEBPACK_IMPORTED_MODULE_2__[\"default\"].React.createElement(_ui_bdLogo__WEBPACK_IMPORTED_MODULE_9__[\"default\"], {\n size: \"16px\",\n className: \"bd-logo\"\n }))));\n } else if (user.id === \"696481194443014174\" || user.id === \"696003456611385396\") {\n children.push(_v2__WEBPACK_IMPORTED_MODULE_2__[\"default\"].React.createElement(_ui_tooltipWrap__WEBPACK_IMPORTED_MODULE_10__[\"default\"], {\n color: \"black\",\n side: \"top\",\n text: \"Lightcord Developer\"\n }, _v2__WEBPACK_IMPORTED_MODULE_2__[\"default\"].React.createElement(Anchor, {\n className: \"bd-member-badge\",\n href: \"https://github.com/Lightcord/Lightcord\",\n title: \"Lightcord\",\n target: \"_blank\"\n }, _v2__WEBPACK_IMPORTED_MODULE_2__[\"default\"].React.createElement(_svg_lightcord__WEBPACK_IMPORTED_MODULE_11__[\"default\"], {\n size: \"32px\",\n className: \"bd-logo\"\n }))));\n }\n\n const id = Object(_distant__WEBPACK_IMPORTED_MODULE_13__[\"uuidv4\"])();\n children.push(_v2__WEBPACK_IMPORTED_MODULE_2__[\"default\"].React.createElement(\"div\", {\n id: \"badges-\" + id\n }));\n applyBadges(id, user, false);\n }\n });\n};\n\nCore.prototype.updateInjector = async function () {\n const injectionPath = _dataStore__WEBPACK_IMPORTED_MODULE_6__[\"default\"].injectionPath;\n if (!injectionPath) return false;\n\n const fs = __webpack_require__(/*! fs */ \"fs\");\n\n const path = __webpack_require__(/*! path */ \"path\");\n\n const rmrf = __webpack_require__(/*! rimraf */ \"rimraf\");\n\n const yauzl = __webpack_require__(/*! yauzl */ \"yauzl\");\n\n const mkdirp = __webpack_require__(/*! mkdirp */ \"mkdirp\");\n\n const request =\n /*require(\"request\");*/\n null;\n const parentPath = path.resolve(injectionPath, \"..\");\n const folderName = path.basename(injectionPath);\n const zipLink = \"https://github.com/rauenzi/BetterDiscordApp/archive/injector.zip\";\n const savedZip = path.resolve(parentPath, \"injector.zip\");\n const extractedFolder = path.resolve(parentPath, \"BetterDiscordApp-injector\"); // Download the injector zip file\n\n _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].log(\"InjectorUpdate\", \"Downloading \" + zipLink);\n let success = await new Promise(resolve => {\n request.get({\n url: zipLink,\n encoding: null\n }, async (error, response, body) => {\n if (error || response.statusCode !== 200) return resolve(false); // Save a backup in case someone has their own copy\n\n const alreadyExists = await new Promise(res => fs.exists(savedZip, res));\n if (alreadyExists) await new Promise(res => fs.rename(savedZip, `${savedZip}.bak${Math.round(performance.now())}`, res));\n _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].log(\"InjectorUpdate\", \"Writing \" + savedZip);\n fs.writeFile(savedZip, body, err => resolve(!err));\n });\n });\n if (!success) return success; // Check and delete rename extraction\n\n const alreadyExists = await new Promise(res => fs.exists(extractedFolder, res));\n if (alreadyExists) await new Promise(res => fs.rename(extractedFolder, `${extractedFolder}.bak${Math.round(performance.now())}`, res)); // Unzip the downloaded zip file\n\n const zipfile = await new Promise(r => yauzl.open(savedZip, {\n lazyEntries: true\n }, (err, zip) => r(zip)));\n zipfile.on(\"entry\", function (entry) {\n // Skip directories, they are handled with mkdirp\n if (entry.fileName.endsWith(\"/\")) return zipfile.readEntry();\n _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].log(\"InjectorUpdate\", \"Extracting \" + entry.fileName); // Make any needed parent directories\n\n const fullPath = path.resolve(parentPath, entry.fileName);\n mkdirp.sync(path.dirname(fullPath));\n zipfile.openReadStream(entry, function (err, readStream) {\n if (err) return success = false;\n readStream.on(\"end\", function () {\n zipfile.readEntry();\n }); // Go to next file after this\n\n readStream.pipe(fs.createWriteStream(fullPath));\n });\n });\n zipfile.readEntry(); // Start reading\n // Wait for the final file to finish\n\n await new Promise(resolve => zipfile.once(\"end\", resolve)); // Save a backup in case something goes wrong during final step\n\n const backupFolder = path.resolve(parentPath, `${folderName}.bak${Math.round(performance.now())}`);\n await new Promise(resolve => fs.rename(injectionPath, backupFolder, resolve)); // Rename the extracted folder to what it should be\n\n _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].log(\"InjectorUpdate\", `Renaming ${path.basename(extractedFolder)} to ${folderName}`);\n success = await new Promise(resolve => fs.rename(extractedFolder, injectionPath, err => resolve(!err)));\n\n if (!success) {\n _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].err(\"InjectorUpdate\", \"Failed to rename the final directory\");\n return success;\n } // If rename had issues, delete what we tried to rename and restore backup\n\n\n if (!success) {\n _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].err(\"InjectorUpdate\", \"Something went wrong... restoring backups.\");\n await new Promise(resolve => rmrf(extractedFolder, resolve));\n await new Promise(resolve => fs.rename(backupFolder, injectionPath, resolve));\n return success;\n } // If we've gotten to this point, everything should have gone smoothly.\n // Cleanup the backup folder then remove the zip\n\n\n await new Promise(resolve => rmrf(backupFolder, resolve));\n await new Promise(resolve => fs.unlink(savedZip, resolve));\n _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].log(\"InjectorUpdate\", \"Injector Updated!\");\n return success;\n};\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (new Core());//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiLi9zcmMvbW9kdWxlcy9jb3JlLmpzLmpzIiwic291cmNlcyI6WyJ3ZWJwYWNrOi8vQmV0dGVyRGlzY29yZC8uL3NyYy9tb2R1bGVzL2NvcmUuanM/MTNjMiJdLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBiZENvbmZpZywgbWluU3VwcG9ydGVkVmVyc2lvbiwgYmJkVmVyc2lvbiwgc2V0dGluZ3NDb29raWUsIGJkcGx1Z2luRXJyb3JzLCBiZHRoZW1lRXJyb3JzLCBiYmRDaGFuZ2Vsb2csIGRlZmF1bHRDb29raWUsIGN1cnJlbnREaXNjb3JkVmVyc2lvbiwgZGVmYXVsdFJQQywgc2V0dGluZ3NSUEMgfSBmcm9tIFwiLi4vMGdsb2JhbHNcIjtcbmltcG9ydCBVdGlscyBmcm9tIFwiLi91dGlsc1wiO1xuaW1wb3J0IEJEVjIgZnJvbSBcIi4vdjJcIjtcbmltcG9ydCBzZXR0aW5nc1BhbmVsIGZyb20gXCIuL3NldHRpbmdzUGFuZWxcIjtcbmltcG9ydCBwbHVnaW5Nb2R1bGUgZnJvbSBcIi4vcGx1Z2luTW9kdWxlXCI7XG5pbXBvcnQgdGhlbWVNb2R1bGUgZnJvbSBcIi4vdGhlbWVNb2R1bGVcIjtcbmltcG9ydCBEYXRhU3RvcmUgZnJvbSBcIi4vZGF0YVN0b3JlXCI7XG5pbXBvcnQgV2VicGFja01vZHVsZXMgZnJvbSBcIi4vd2VicGFja01vZHVsZXNcIjtcbmltcG9ydCBET00gZnJvbSBcIi4vZG9tdG9vbHNcIjtcbmltcG9ydCBCRExvZ28gZnJvbSBcIi4uL3VpL2JkTG9nb1wiO1xuaW1wb3J0IFRvb2x0aXBXcmFwIGZyb20gXCIuLi91aS90b29sdGlwV3JhcFwiO1xuaW1wb3J0I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DQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///./src/modules/core.js\n"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _0globals__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../0globals */ \"./src/0globals.js\");\n/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./utils */ \"./src/modules/utils.js\");\n/* harmony import */ var _v2__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./v2 */ \"./src/modules/v2.js\");\n/* harmony import */ var _settingsPanel__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./settingsPanel */ \"./src/modules/settingsPanel.js\");\n/* harmony import */ var _pluginModule__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./pluginModule */ \"./src/modules/pluginModule.js\");\n/* harmony import */ var _themeModule__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./themeModule */ \"./src/modules/themeModule.js\");\n/* harmony import */ var _dataStore__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./dataStore */ \"./src/modules/dataStore.js\");\n/* harmony import */ var _webpackModules__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./webpackModules */ \"./src/modules/webpackModules.js\");\n/* harmony import */ var _domtools__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./domtools */ \"./src/modules/domtools.js\");\n/* harmony import */ var _ui_bdLogo__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../ui/bdLogo */ \"./src/ui/bdLogo.js\");\n/* harmony import */ var _ui_tooltipWrap__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../ui/tooltipWrap */ \"./src/ui/tooltipWrap.js\");\n/* harmony import */ var _svg_lightcord__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../svg/lightcord */ \"./src/svg/lightcord.jsx\");\n/* harmony import */ var _pluginCertifier__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./pluginCertifier */ \"./src/modules/pluginCertifier.js\");\n/* harmony import */ var _distant__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./distant */ \"./src/modules/distant.js\");\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nfunction Core() {// Object.assign(bdConfig, __non_webpack_require__(DataStore.configFile));\n // this.init();\n}\n\nCore.prototype.setConfig = function (config) {\n Object.assign(_0globals__WEBPACK_IMPORTED_MODULE_0__[\"bdConfig\"], config);\n};\n\nCore.prototype.init = async function () {\n if (!Array.prototype.flat) {\n _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].alert(\"Not Supported\", \"BetterDiscord v\" + _0globals__WEBPACK_IMPORTED_MODULE_0__[\"bbdVersion\"] + \" does not support this old version (\" + _0globals__WEBPACK_IMPORTED_MODULE_0__[\"currentDiscordVersion\"] + \") of Discord. Please update your Discord installation before proceeding.\");\n return;\n }\n\n if (_0globals__WEBPACK_IMPORTED_MODULE_0__[\"bdConfig\"].version < _0globals__WEBPACK_IMPORTED_MODULE_0__[\"minSupportedVersion\"]) {\n _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].alert(\"Not Supported\", \"BetterDiscord v\" + _0globals__WEBPACK_IMPORTED_MODULE_0__[\"bdConfig\"].version + \" (your version)\" + \" is not supported by the latest js (\" + _0globals__WEBPACK_IMPORTED_MODULE_0__[\"bbdVersion\"] + \").

Please download the latest version from GitHub\");\n return;\n }\n\n if (window.ED) {\n _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].alert(\"Not Supported\", \"BandagedBD does not work with EnhancedDiscord. Please uninstall one of them.\");\n return;\n }\n\n if (window.WebSocket && window.WebSocket.name && window.WebSocket.name.includes(\"Patched\")) {\n _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].alert(\"Not Supported\", \"BandagedBD does not work with Powercord. Please uninstall one of them.\");\n return;\n }\n\n const latestLocalVersion = _0globals__WEBPACK_IMPORTED_MODULE_0__[\"bdConfig\"].updater ? _0globals__WEBPACK_IMPORTED_MODULE_0__[\"bdConfig\"].updater.LatestVersion : _0globals__WEBPACK_IMPORTED_MODULE_0__[\"bdConfig\"].latestVersion;\n\n if (latestLocalVersion > _0globals__WEBPACK_IMPORTED_MODULE_0__[\"bdConfig\"].version) {\n _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].showConfirmationModal(\"Update Available\", [`There is an update available for BandagedBD's Injector (${latestLocalVersion}).`, \"You can either update and restart now, or later.\"], {\n confirmText: \"Update Now\",\n cancelText: \"Maybe Later\",\n onConfirm: async () => {\n const onUpdateFailed = () => {\n _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].alert(\"Could Not Update\", `Unable to update automatically, please download the installer and reinstall normally.

Download Installer`);\n };\n\n try {\n const didUpdate = await this.updateInjector();\n if (!didUpdate) return onUpdateFailed();\n\n const app = __webpack_require__(/*! electron */ \"electron\").remote.app;\n\n app.relaunch();\n app.exit();\n } catch (err) {\n onUpdateFailed();\n }\n }\n });\n }\n\n _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].log(\"Startup\", \"Initializing Settings\");\n this.initSettings();\n await this.checkForGuilds();\n _v2__WEBPACK_IMPORTED_MODULE_2__[\"default\"].initialize();\n _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].log(\"Startup\", \"Updating Settings\");\n _settingsPanel__WEBPACK_IMPORTED_MODULE_3__[\"default\"].initializeSettings();\n _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].log(\"Startup\", \"Loading Plugins\");\n _pluginModule__WEBPACK_IMPORTED_MODULE_4__[\"default\"].loadPlugins();\n _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].log(\"Startup\", \"Loading Themes\");\n _themeModule__WEBPACK_IMPORTED_MODULE_5__[\"default\"].loadThemes();\n _domtools__WEBPACK_IMPORTED_MODULE_8__[\"default\"].addStyle(\"customcss\", atob(_dataStore__WEBPACK_IMPORTED_MODULE_6__[\"default\"].getBDData(\"bdcustomcss\")));\n window.addEventListener(\"beforeunload\", function () {\n if (_0globals__WEBPACK_IMPORTED_MODULE_0__[\"settingsCookie\"][\"bda-dc-0\"]) document.querySelector(\".btn.btn-disconnect\").click();\n });\n _pluginCertifier__WEBPACK_IMPORTED_MODULE_12__[\"default\"].start();\n _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].log(\"Startup\", \"Removing Loading Icon\");\n if (document.getElementsByClassName(\"bd-loaderv2\").length) document.getElementsByClassName(\"bd-loaderv2\")[0].remove();\n _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].log(\"Startup\", \"Initializing Main Observer\");\n this.initObserver(); // Show loading errors\n\n if (_0globals__WEBPACK_IMPORTED_MODULE_0__[\"settingsCookie\"][\"fork-ps-1\"]) {\n _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].log(\"Startup\", \"Collecting Startup Errors\");\n _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].showContentErrors({\n plugins: _0globals__WEBPACK_IMPORTED_MODULE_0__[\"bdpluginErrors\"],\n themes: _0globals__WEBPACK_IMPORTED_MODULE_0__[\"bdthemeErrors\"]\n });\n }\n\n const previousVersion = _dataStore__WEBPACK_IMPORTED_MODULE_6__[\"default\"].getBDData(\"version\");\n\n if (_0globals__WEBPACK_IMPORTED_MODULE_0__[\"bbdVersion\"] > previousVersion) {\n if (_0globals__WEBPACK_IMPORTED_MODULE_0__[\"bbdChangelog\"]) this.showChangelogModal(_0globals__WEBPACK_IMPORTED_MODULE_0__[\"bbdChangelog\"]);\n _dataStore__WEBPACK_IMPORTED_MODULE_6__[\"default\"].setBDData(\"version\", _0globals__WEBPACK_IMPORTED_MODULE_0__[\"bbdVersion\"]);\n }\n\n _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].suppressErrors(this.patchSocial.bind(this), \"BD Social Patch\")();\n _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].suppressErrors(this.patchGuildPills.bind(this), \"BD Guild Pills Patch\")();\n _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].suppressErrors(this.patchGuildListItems.bind(this), \"BD Guild List Items Patch\")();\n _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].suppressErrors(this.patchGuildSeparator.bind(this), \"BD Guild Separator Patch\")();\n _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].suppressErrors(this.patchMessageHeader.bind(this), \"BD Badge Chat Patch\")();\n _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].suppressErrors(this.patchMemberList.bind(this), \"BD Badge Member List Patch\")();\n _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].suppressErrors(this.patchAttachment.bind(this), \"LC Plugin Certifier Patch\")();\n\n if (_0globals__WEBPACK_IMPORTED_MODULE_0__[\"bdConfig\"].haveInstalledDefault) {\n let alert = _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].alert(\"First Installation\", \"As it is the first time you install Lightcord, We added two default themes and one default plugin in your plugin/theme folder. Check it in the Plugin/Theme settings.\");\n await new Promise(resolve => {\n alert.onClose(resolve);\n });\n }\n};\n\nCore.prototype.checkForGuilds = function () {\n let timesChecked = 0;\n return new Promise(resolve => {\n const checkForGuilds = function () {\n const wrapper = _v2__WEBPACK_IMPORTED_MODULE_2__[\"default\"].guildClasses.wrapper.split(\" \")[0];\n if (document.querySelectorAll(`.${wrapper}`).length > 0) timesChecked++;\n const guild = _v2__WEBPACK_IMPORTED_MODULE_2__[\"default\"].guildClasses.listItem.split(\" \")[0];\n const blob = _v2__WEBPACK_IMPORTED_MODULE_2__[\"default\"].guildClasses.blobContainer.split(\" \")[0];\n if (document.querySelectorAll(`.${wrapper} .${guild} .${blob}`).length > 0) return resolve(_0globals__WEBPACK_IMPORTED_MODULE_0__[\"bdConfig\"].deferLoaded = true);else if (timesChecked >= 50) return resolve(_0globals__WEBPACK_IMPORTED_MODULE_0__[\"bdConfig\"].deferLoaded = true);\n setTimeout(checkForGuilds, 100);\n };\n\n if (document.readyState != \"loading\") setTimeout(checkForGuilds, 100);\n document.addEventListener(\"DOMContentLoaded\", () => {\n setTimeout(checkForGuilds, 100);\n });\n });\n};\n\nCore.prototype.injectExternals = async function () {\n await _domtools__WEBPACK_IMPORTED_MODULE_8__[\"default\"].addScript(\"ace-script\", \"https://cdnjs.cloudflare.com/ajax/libs/ace/1.2.9/ace.js\");\n if (window.require.original) window.require = window.require.original;\n};\n\nCore.prototype.initSettings = function () {\n _dataStore__WEBPACK_IMPORTED_MODULE_6__[\"default\"].initialize();\n\n if (!_dataStore__WEBPACK_IMPORTED_MODULE_6__[\"default\"].getSettingGroup(\"settings\") && !_dataStore__WEBPACK_IMPORTED_MODULE_6__[\"default\"].getSettingGroup(\"rpc\")) {\n if (!_dataStore__WEBPACK_IMPORTED_MODULE_6__[\"default\"].getSettingGroup(\"settings\")) {\n Object.assign(_0globals__WEBPACK_IMPORTED_MODULE_0__[\"settingsCookie\"], _0globals__WEBPACK_IMPORTED_MODULE_0__[\"defaultCookie\"]);\n }\n\n if (!_dataStore__WEBPACK_IMPORTED_MODULE_6__[\"default\"].getSettingGroup(\"rpc\")) {\n Object.assign(_0globals__WEBPACK_IMPORTED_MODULE_0__[\"settingsRPC\"], _0globals__WEBPACK_IMPORTED_MODULE_0__[\"defaultRPC\"]);\n }\n\n _settingsPanel__WEBPACK_IMPORTED_MODULE_3__[\"default\"].saveSettings();\n } else {\n _settingsPanel__WEBPACK_IMPORTED_MODULE_3__[\"default\"].loadSettings();\n\n for (const setting in _0globals__WEBPACK_IMPORTED_MODULE_0__[\"defaultCookie\"]) {\n if (_0globals__WEBPACK_IMPORTED_MODULE_0__[\"settingsCookie\"][setting] == undefined) {\n _0globals__WEBPACK_IMPORTED_MODULE_0__[\"settingsCookie\"][setting] = _0globals__WEBPACK_IMPORTED_MODULE_0__[\"defaultCookie\"][setting];\n _settingsPanel__WEBPACK_IMPORTED_MODULE_3__[\"default\"].saveSettings();\n }\n }\n }\n};\n\nCore.prototype.initObserver = function () {\n const mainObserver = new MutationObserver(mutations => {\n for (let i = 0, mlen = mutations.length; i < mlen; i++) {\n const mutation = mutations[i];\n if (typeof _pluginModule__WEBPACK_IMPORTED_MODULE_4__[\"default\"] !== \"undefined\") _pluginModule__WEBPACK_IMPORTED_MODULE_4__[\"default\"].rawObserver(mutation); // if there was nothing added, skip\n\n if (!mutation.addedNodes.length || !(mutation.addedNodes[0] instanceof Element)) continue;\n const node = mutation.addedNodes[0];\n let [classNameLayer, classNameSocialLinks] = [BDModules.get(e => e.layer && typeof e.layer === \"string\" && e.animating)[0].layer, BDModules.get(e => e.socialLinks && typeof e.socialLinks === \"string\")[0].socialLinks];\n\n if (node.classList.contains(classNameLayer)) {\n if (node.getElementsByClassName(\"guild-settings-base-section\").length) node.setAttribute(\"layer-id\", \"server-settings\");\n\n if (node.getElementsByClassName(classNameSocialLinks).length) {\n node.setAttribute(\"layer-id\", \"user-settings\");\n node.setAttribute(\"id\", \"user-settings\");\n if (!document.getElementById(\"bd-settings-sidebar\")) _settingsPanel__WEBPACK_IMPORTED_MODULE_3__[\"default\"].renderSidebar();\n }\n }\n\n if (node.parentElement == document.body && node.querySelector(\"#ace_settingsmenu\")) node.id = \"ace_settingsmenu_container\"; // Emoji Picker\n //node.getElementsByClassName(\"emojiPicker-3m1S-j\").length && !node.querySelector(\".emojiPicker-3m1S-j\").parentElement.classList.contains(\"animatorLeft-1EQxU0\")\n //if (node.classList.contains(classNameLayer2) && node.getElementsByClassName(classNameEmojiPicker).length && !node.querySelector(\".\"+classNameEmojiPicker).parentElement.classList.contains(classNameAnimatorLeft)) quickEmoteMenu.obsCallback(node);\n }\n });\n mainObserver.observe(document, {\n childList: true,\n subtree: true\n });\n};\n\nCore.prototype.showChangelogModal = function (options = {}) {\n return _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].showChangelogModal(options);\n};\n\nCore.prototype.alert = function (title, content) {\n return _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].alert(title, content);\n};\n\nCore.prototype.patchSocial = function () {\n if (this.socialPatch) return;\n const TabBar = _webpackModules__WEBPACK_IMPORTED_MODULE_7__[\"default\"].find(m => m.displayName == \"TabBar\");\n const Anchor = _webpackModules__WEBPACK_IMPORTED_MODULE_7__[\"default\"].find(m => m.displayName == \"Anchor\");\n if (!TabBar) return;\n this.socialPatch = _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].monkeyPatch(TabBar.prototype, \"render\", {\n after: data => {\n const children = data.returnValue.props.children;\n if (!children || !children.length || children.length < 3) return;\n if (children[children.length - 3].type.displayName !== \"Separator\") return;\n if (!children[children.length - 2].type.toString().includes(\"socialLinks\")) return;\n\n if (Anchor) {\n let socialModule1 = BDModules.get(e => e.socialLinks)[0];\n const original = children[children.length - 2].type;\n\n const newOne = function () {\n const returnVal = original(...arguments);\n returnVal.props.children.push(_v2__WEBPACK_IMPORTED_MODULE_2__[\"default\"].React.createElement(_ui_tooltipWrap__WEBPACK_IMPORTED_MODULE_10__[\"default\"], {\n color: \"black\",\n side: \"top\",\n text: \"Lightcord\"\n }, _v2__WEBPACK_IMPORTED_MODULE_2__[\"default\"].React.createElement(Anchor, {\n className: \"bd-social-link \" + socialModule1.link,\n href: \"https://github.com/Lightcord/Lightcord\",\n title: \"Lightcord\",\n target: \"_blank\"\n }, _v2__WEBPACK_IMPORTED_MODULE_2__[\"default\"].React.createElement(_svg_lightcord__WEBPACK_IMPORTED_MODULE_11__[\"default\"], {\n size: \"16px\",\n className: \"bd-social-logo\"\n }))));\n returnVal.props.children.push(_v2__WEBPACK_IMPORTED_MODULE_2__[\"default\"].React.createElement(_ui_tooltipWrap__WEBPACK_IMPORTED_MODULE_10__[\"default\"], {\n color: \"black\",\n side: \"top\",\n text: \"BandagedBD\"\n }, _v2__WEBPACK_IMPORTED_MODULE_2__[\"default\"].React.createElement(Anchor, {\n className: \"bd-social-link \" + socialModule1.link,\n href: \"https://github.com/rauenzi/BetterDiscordApp\",\n title: \"BandagedBD\",\n target: \"_blank\"\n }, _v2__WEBPACK_IMPORTED_MODULE_2__[\"default\"].React.createElement(_ui_bdLogo__WEBPACK_IMPORTED_MODULE_9__[\"default\"], {\n size: \"16px\",\n className: \"bd-social-logo\"\n }))));\n return returnVal;\n };\n\n children[children.length - 2].type = newOne;\n }\n\n let [classNameColorMuted, sizes, classNameVersionHash] = [BDModules.get(e => e.colorMuted)[0].colorMuted, BDModules.get(e => e.size32)[0], BDModules.get(e => e.versionHash)[0].versionHash];\n const injector = _v2__WEBPACK_IMPORTED_MODULE_2__[\"default\"].react.createElement(\"div\", {\n className: `${classNameColorMuted} ${sizes.size12}`\n }, `Injector ${_0globals__WEBPACK_IMPORTED_MODULE_0__[\"bdConfig\"].version}`);\n const versionHash = `(${_0globals__WEBPACK_IMPORTED_MODULE_0__[\"bdConfig\"].hash ? _0globals__WEBPACK_IMPORTED_MODULE_0__[\"bdConfig\"].hash.substring(0, 7) : _0globals__WEBPACK_IMPORTED_MODULE_0__[\"bdConfig\"].branch})`;\n const additional = _v2__WEBPACK_IMPORTED_MODULE_2__[\"default\"].react.createElement(\"div\", {\n className: `${classNameColorMuted} ${sizes.size12}`\n }, `BBD ${_0globals__WEBPACK_IMPORTED_MODULE_0__[\"bbdVersion\"]} `, _v2__WEBPACK_IMPORTED_MODULE_2__[\"default\"].react.createElement(\"span\", {\n className: classNameVersionHash + \" da-versionHash\"\n }, versionHash));\n const originalVersions = children[children.length - 1].type;\n\n children[children.length - 1].type = function () {\n const returnVal = originalVersions(...arguments);\n returnVal.props.children.splice(returnVal.props.children.length - 1, 0, injector);\n returnVal.props.children.splice(1, 0, additional);\n return returnVal;\n };\n }\n });\n};\n\nconst getGuildClasses = function () {\n const guildsWrapper = _webpackModules__WEBPACK_IMPORTED_MODULE_7__[\"default\"].findByProps(\"wrapper\", \"unreadMentionsBar\");\n const guilds = _webpackModules__WEBPACK_IMPORTED_MODULE_7__[\"default\"].findByProps(\"guildsError\", \"selected\");\n const pill = _webpackModules__WEBPACK_IMPORTED_MODULE_7__[\"default\"].findByProps(\"blobContainer\");\n return Object.assign({}, guildsWrapper, guilds, pill);\n};\n\nCore.prototype.patchGuildListItems = function () {\n if (this.guildListItemsPatch) return;\n const GuildClasses = getGuildClasses();\n const listItemClass = GuildClasses.listItem.split(\" \")[0];\n const blobClass = GuildClasses.blobContainer.split(\" \")[0];\n const reactInstance = _v2__WEBPACK_IMPORTED_MODULE_2__[\"default\"].getInternalInstance(document.querySelector(`.${listItemClass} .${blobClass}`).parentElement);\n const GuildComponent = reactInstance.return.type;\n if (!GuildComponent) return;\n this.guildListItemsPatch = _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].monkeyPatch(GuildComponent.prototype, \"render\", {\n after: data => {\n if (data.returnValue && data.thisObject) {\n const returnValue = data.returnValue;\n const guildData = data.thisObject.props;\n returnValue.props.className += \" bd-guild\";\n if (guildData.unread) returnValue.props.className += \" bd-unread\";\n if (guildData.selected) returnValue.props.className += \" bd-selected\";\n if (guildData.audio) returnValue.props.className += \" bd-audio\";\n if (guildData.video) returnValue.props.className += \" bd-video\";\n if (guildData.badge) returnValue.props.className += \" bd-badge\";\n if (guildData.animatable) returnValue.props.className += \" bd-animatable\";\n return returnValue;\n }\n }\n });\n};\n\nCore.prototype.patchGuildPills = function () {\n if (this.guildPillPatch) return;\n const guildPill = _webpackModules__WEBPACK_IMPORTED_MODULE_7__[\"default\"].find(m => m.default && !m.default.displayName && m.default.toString && m.default.toString().includes(\"translate3d\"));\n if (!guildPill) return;\n this.guildPillPatch = _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].monkeyPatch(guildPill, \"default\", {\n after: data => {\n const props = data.methodArguments[0];\n if (props.unread) data.returnValue.props.className += \" bd-unread\";\n if (props.selected) data.returnValue.props.className += \" bd-selected\";\n if (props.hovered) data.returnValue.props.className += \" bd-hovered\";\n return data.returnValue;\n }\n });\n};\n\nCore.prototype.patchGuildSeparator = function () {\n if (this.guildSeparatorPatch) return;\n const Guilds = _webpackModules__WEBPACK_IMPORTED_MODULE_7__[\"default\"].findByDisplayName(\"Guilds\");\n const guildComponents = _webpackModules__WEBPACK_IMPORTED_MODULE_7__[\"default\"].findByProps(\"renderListItem\");\n if (!guildComponents || !Guilds) return;\n\n const GuildSeparator = function () {\n const returnValue = guildComponents.Separator(...arguments);\n returnValue.props.className += \" bd-guild-separator\";\n return returnValue;\n };\n\n this.guildSeparatorPatch = _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].monkeyPatch(Guilds.prototype, \"render\", {\n after: data => {\n data.returnValue.props.children[1].props.children[3].type = GuildSeparator;\n }\n });\n};\n\nCore.prototype.patchAttachment = function () {\n if (this.AttachmentPatch) return;\n const Attachment = BDModules.get(e => e.default && e.default.displayName === \"Attachment\")[0]; // temporary\n\n const Anchor = _webpackModules__WEBPACK_IMPORTED_MODULE_7__[\"default\"].find(m => m.displayName == \"Anchor\");\n if (!Anchor || !Attachment || !Attachment.default) return;\n this.AttachmentPatch = _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].monkeyPatch(Attachment, \"default\", {\n after: data => {\n const attachment = data.methodArguments[0] || null;\n const children = _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].getNestedProp(data.returnValue, \"props.children\");\n if (!children || !attachment || !attachment.url) return;\n if (!Array.isArray(children)) return;\n const id = Object(_distant__WEBPACK_IMPORTED_MODULE_13__[\"uuidv4\"])();\n children.push(_v2__WEBPACK_IMPORTED_MODULE_2__[\"default\"].react.createElement(\"div\", {\n id: \"certified-\" + id\n }));\n _pluginCertifier__WEBPACK_IMPORTED_MODULE_12__[\"default\"].patch(attachment, \"certified-\" + id);\n }\n });\n};\n\nCore.prototype.patchMessageHeader = function () {\n if (this.messageHeaderPatch) return;\n const MessageHeader = _webpackModules__WEBPACK_IMPORTED_MODULE_7__[\"default\"].findByProps(\"MessageTimestamp\");\n const Anchor = _webpackModules__WEBPACK_IMPORTED_MODULE_7__[\"default\"].find(m => m.displayName == \"Anchor\");\n if (!Anchor || !MessageHeader || !MessageHeader.default) return;\n this.messageHeaderPatch = _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].monkeyPatch(MessageHeader, \"default\", {\n after: data => {\n const author = _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].getNestedProp(data.methodArguments[0], \"message.author\"); // const header = Utils.getNestedProp(data.returnValue, \"props.children.1.props\");\n\n const children = _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].getNestedProp(data.returnValue, \"props.children.1.props.children.1.props.children\");\n if (!children || !author || !author.id) return; // if (header && header.className) header.className += \" \"\n\n if (!Array.isArray(children)) return;\n\n if (author.id === \"249746236008169473\") {\n // Rauenzi: BandagedBD Developer\n children.push(_v2__WEBPACK_IMPORTED_MODULE_2__[\"default\"].React.createElement(_ui_tooltipWrap__WEBPACK_IMPORTED_MODULE_10__[\"default\"], {\n color: \"black\",\n side: \"top\",\n text: \"BandagedBD Developer\"\n }, _v2__WEBPACK_IMPORTED_MODULE_2__[\"default\"].React.createElement(Anchor, {\n className: \"bd-chat-badge\",\n href: \"https://github.com/rauenzi/BetterDiscordApp\",\n title: \"BandagedBD\",\n target: \"_blank\"\n }, _v2__WEBPACK_IMPORTED_MODULE_2__[\"default\"].React.createElement(_ui_bdLogo__WEBPACK_IMPORTED_MODULE_9__[\"default\"], {\n size: \"16px\",\n className: \"bd-logo\"\n }))));\n } else if (author.id === \"696481194443014174\" || author.id === \"696003456611385396\") {\n // Not Thomiz: Lightcord Developer, Phorcys: Lightcord Developer\n children.push(_v2__WEBPACK_IMPORTED_MODULE_2__[\"default\"].React.createElement(_ui_tooltipWrap__WEBPACK_IMPORTED_MODULE_10__[\"default\"], {\n color: \"black\",\n side: \"top\",\n text: \"Lightcord Developer\"\n }, _v2__WEBPACK_IMPORTED_MODULE_2__[\"default\"].React.createElement(Anchor, {\n className: \"bd-chat-badge\",\n href: \"https://github.com/Lightcord/Lightcord\",\n title: \"Lightcord\",\n target: \"_blank\"\n }, _v2__WEBPACK_IMPORTED_MODULE_2__[\"default\"].React.createElement(_svg_lightcord__WEBPACK_IMPORTED_MODULE_11__[\"default\"], {\n size: \"16px\",\n className: \"bd-logo\"\n }))));\n }\n\n const id = Object(_distant__WEBPACK_IMPORTED_MODULE_13__[\"uuidv4\"])();\n children.push(_v2__WEBPACK_IMPORTED_MODULE_2__[\"default\"].React.createElement(\"div\", {\n id: \"badges-\" + id,\n style: {\n display: \"inline\"\n }\n }));\n applyBadges(id, author, true);\n }\n });\n};\n\nfunction applyBadges(id, user, chat) {\n process.nextTick(() => {\n const div = document.getElementById(\"badges-\" + id);\n if (!div || div.childNodes.length > 0) return;\n const Anchor = _webpackModules__WEBPACK_IMPORTED_MODULE_7__[\"default\"].find(m => m.displayName == \"Anchor\");\n _distant__WEBPACK_IMPORTED_MODULE_13__[\"default\"].getBadges(user.id).then(badges => {\n badges.forEach(badge => {\n const props = {\n size: \"16px\",\n className: \"bd-logo\"\n };\n badge.scopes.forEach(scope => {// TODO: implement scope for badges (user, channel, etc)\n });\n const element = _v2__WEBPACK_IMPORTED_MODULE_2__[\"default\"].React.createElement(_ui_tooltipWrap__WEBPACK_IMPORTED_MODULE_10__[\"default\"], {\n color: \"black\",\n side: \"top\",\n text: badge.name\n }, _v2__WEBPACK_IMPORTED_MODULE_2__[\"default\"].React.createElement(Anchor, {\n className: chat ? \"bd-chat-badge\" : \"bd-member-badge\",\n href: badge.href,\n title: badge.name,\n target: \"_blank\"\n }, _v2__WEBPACK_IMPORTED_MODULE_2__[\"default\"].React.createElement(badge.component, props)));\n const div2 = document.createElement(\"div\");\n _v2__WEBPACK_IMPORTED_MODULE_2__[\"default\"].reactDom.render(element, div2);\n div2.childNodes.forEach(node => {\n div.appendChild(node);\n });\n });\n });\n });\n}\n\nCore.prototype.patchMemberList = function () {\n if (this.memberListPatch) return;\n const MemberListItem = _webpackModules__WEBPACK_IMPORTED_MODULE_7__[\"default\"].findByDisplayName(\"MemberListItem\");\n const Anchor = _webpackModules__WEBPACK_IMPORTED_MODULE_7__[\"default\"].find(m => m.displayName == \"Anchor\");\n if (!Anchor || !MemberListItem || !MemberListItem.prototype || !MemberListItem.prototype.renderDecorators) return;\n this.memberListPatch = _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].monkeyPatch(MemberListItem.prototype, \"renderDecorators\", {\n after: data => {\n const user = _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].getNestedProp(data.thisObject, \"props.user\");\n const children = _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].getNestedProp(data.returnValue, \"props.children\");\n if (!children || !user || !user.id) return; // if (header && header.className) header.className += \" \"\n\n if (!Array.isArray(children)) return;\n\n if (user.id === \"249746236008169473\") {\n children.push(_v2__WEBPACK_IMPORTED_MODULE_2__[\"default\"].React.createElement(_ui_tooltipWrap__WEBPACK_IMPORTED_MODULE_10__[\"default\"], {\n color: \"black\",\n side: \"top\",\n text: \"BandagedBD Developer\"\n }, _v2__WEBPACK_IMPORTED_MODULE_2__[\"default\"].React.createElement(Anchor, {\n className: \"bd-member-badge\",\n href: \"https://github.com/rauenzi/BetterDiscordApp\",\n title: \"BandagedBD\",\n target: \"_blank\"\n }, _v2__WEBPACK_IMPORTED_MODULE_2__[\"default\"].React.createElement(_ui_bdLogo__WEBPACK_IMPORTED_MODULE_9__[\"default\"], {\n size: \"16px\",\n className: \"bd-logo\"\n }))));\n } else if (user.id === \"696481194443014174\" || user.id === \"696003456611385396\") {\n children.push(_v2__WEBPACK_IMPORTED_MODULE_2__[\"default\"].React.createElement(_ui_tooltipWrap__WEBPACK_IMPORTED_MODULE_10__[\"default\"], {\n color: \"black\",\n side: \"top\",\n text: \"Lightcord Developer\"\n }, _v2__WEBPACK_IMPORTED_MODULE_2__[\"default\"].React.createElement(Anchor, {\n className: \"bd-member-badge\",\n href: \"https://github.com/Lightcord/Lightcord\",\n title: \"Lightcord\",\n target: \"_blank\"\n }, _v2__WEBPACK_IMPORTED_MODULE_2__[\"default\"].React.createElement(_svg_lightcord__WEBPACK_IMPORTED_MODULE_11__[\"default\"], {\n size: \"32px\",\n className: \"bd-logo\"\n }))));\n }\n\n const id = Object(_distant__WEBPACK_IMPORTED_MODULE_13__[\"uuidv4\"])();\n children.push(_v2__WEBPACK_IMPORTED_MODULE_2__[\"default\"].React.createElement(\"div\", {\n id: \"badges-\" + id\n }));\n applyBadges(id, user, false);\n }\n });\n};\n\nCore.prototype.updateInjector = async function () {\n const injectionPath = _dataStore__WEBPACK_IMPORTED_MODULE_6__[\"default\"].injectionPath;\n if (!injectionPath) return false;\n\n const fs = __webpack_require__(/*! fs */ \"fs\");\n\n const path = __webpack_require__(/*! path */ \"path\");\n\n const rmrf = __webpack_require__(/*! rimraf */ \"rimraf\");\n\n const yauzl = __webpack_require__(/*! yauzl */ \"yauzl\");\n\n const mkdirp = __webpack_require__(/*! mkdirp */ \"mkdirp\");\n\n const request =\n /*require(\"request\");*/\n null;\n const parentPath = path.resolve(injectionPath, \"..\");\n const folderName = path.basename(injectionPath);\n const zipLink = \"https://github.com/rauenzi/BetterDiscordApp/archive/injector.zip\";\n const savedZip = path.resolve(parentPath, \"injector.zip\");\n const extractedFolder = path.resolve(parentPath, \"BetterDiscordApp-injector\"); // Download the injector zip file\n\n _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].log(\"InjectorUpdate\", \"Downloading \" + zipLink);\n let success = await new Promise(resolve => {\n request.get({\n url: zipLink,\n encoding: null\n }, async (error, response, body) => {\n if (error || response.statusCode !== 200) return resolve(false); // Save a backup in case someone has their own copy\n\n const alreadyExists = await new Promise(res => fs.exists(savedZip, res));\n if (alreadyExists) await new Promise(res => fs.rename(savedZip, `${savedZip}.bak${Math.round(performance.now())}`, res));\n _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].log(\"InjectorUpdate\", \"Writing \" + savedZip);\n fs.writeFile(savedZip, body, err => resolve(!err));\n });\n });\n if (!success) return success; // Check and delete rename extraction\n\n const alreadyExists = await new Promise(res => fs.exists(extractedFolder, res));\n if (alreadyExists) await new Promise(res => fs.rename(extractedFolder, `${extractedFolder}.bak${Math.round(performance.now())}`, res)); // Unzip the downloaded zip file\n\n const zipfile = await new Promise(r => yauzl.open(savedZip, {\n lazyEntries: true\n }, (err, zip) => r(zip)));\n zipfile.on(\"entry\", function (entry) {\n // Skip directories, they are handled with mkdirp\n if (entry.fileName.endsWith(\"/\")) return zipfile.readEntry();\n _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].log(\"InjectorUpdate\", \"Extracting \" + entry.fileName); // Make any needed parent directories\n\n const fullPath = path.resolve(parentPath, entry.fileName);\n mkdirp.sync(path.dirname(fullPath));\n zipfile.openReadStream(entry, function (err, readStream) {\n if (err) return success = false;\n readStream.on(\"end\", function () {\n zipfile.readEntry();\n }); // Go to next file after this\n\n readStream.pipe(fs.createWriteStream(fullPath));\n });\n });\n zipfile.readEntry(); // Start reading\n // Wait for the final file to finish\n\n await new Promise(resolve => zipfile.once(\"end\", resolve)); // Save a backup in case something goes wrong during final step\n\n const backupFolder = path.resolve(parentPath, `${folderName}.bak${Math.round(performance.now())}`);\n await new Promise(resolve => fs.rename(injectionPath, backupFolder, resolve)); // Rename the extracted folder to what it should be\n\n _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].log(\"InjectorUpdate\", `Renaming ${path.basename(extractedFolder)} to ${folderName}`);\n success = await new Promise(resolve => fs.rename(extractedFolder, injectionPath, err => resolve(!err)));\n\n if (!success) {\n _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].err(\"InjectorUpdate\", \"Failed to rename the final directory\");\n return success;\n } // If rename had issues, delete what we tried to rename and restore backup\n\n\n if (!success) {\n _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].err(\"InjectorUpdate\", \"Something went wrong... restoring backups.\");\n await new Promise(resolve => rmrf(extractedFolder, resolve));\n await new Promise(resolve => fs.rename(backupFolder, injectionPath, resolve));\n return success;\n } // If we've gotten to this point, everything should have gone smoothly.\n // Cleanup the backup folder then remove the zip\n\n\n await new Promise(resolve => rmrf(backupFolder, resolve));\n await new Promise(resolve => fs.unlink(savedZip, resolve));\n _utils__WEBPACK_IMPORTED_MODULE_1__[\"default\"].log(\"InjectorUpdate\", \"Injector Updated!\");\n return success;\n};\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (new Core());//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiLi9zcmMvbW9kdWxlcy9jb3JlLmpzLmpzIiwic291cmNlcyI6WyJ3ZWJwYWNrOi8vQmV0dGVyRGlzY29yZC8uL3NyYy9tb2R1bGVzL2NvcmUuanM/MTNjMiJdLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBiZENvbmZpZywgbWluU3VwcG9ydGVkVmVyc2lvbiwgYmJkVmVyc2lvbiwgc2V0dGluZ3NDb29raWUsIGJkcGx1Z2luRXJyb3JzLCBiZHRoZW1lRXJyb3JzLCBiYmRDaGFuZ2Vsb2csIGRlZmF1bHRDb29raWUsIGN1cnJlb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hcmdldDogXCJfYmxhbmtcIlxuICAgICAgICAgIH0sIEJEVjIuUmVhY3QuY3JlYXRlRWxlbWVudChMaWdodGNvcmRMb2dvLCB7XG4gICAgICAgICAgICBzaXplOiBcIjE2cHhcIixcbiAgICAgICAgICAgIGNsYXNzTmFtZTogXCJiZC1zb2NpYWwtbG9nb1wiXG4gICAgICAgICAgfSkpKSk7XG4gICAgICAgICAgcmV0dXJuVmFsLnByb3BzLmNoaWxkcmVuLnB1c2goQkRWMi5SZWFjdC5jcmVhdGVFbGVtZW50KFRvb2x0aXBXcmFwLCB7XG4gICAgICAgICAgICBjb2xvcjogXCJibGFja1wiLFxuICAgICAgICAgICAgc2lkZTogXCJ0b3BcIixcbiAgICAgICAgICAgIHRleHQ6IFwiQmFuZGFnZWRCRFwiXG4gICAgICAgICAgfSwgQkRWMi5SZWFjdC5jcmVhdGVFbGVtZW50KEFuY2hvciwge1xuICAgICAgICAgICAgY2xhc3NOYW1lOiBcImJkLXNvY2lhbC1saW5rIFwiICsgc29jaWFsTW9kdWxlMS5saW5rLFxuICAgICAgICAgICAgaHJlZjogXCJodHRwczovL2dpdGh1Yi5jb20vcmF1ZW56aS9CZXR0ZXJEaXNjb3JkQXBwXCIsXG4gICAgICAgICAgICB0aXRsZTogXCJCYW5kYWdlZEJEXCIsXG4gICAgICAgICAgICB0YXJnZXQ6IFwiX2JsYW5rXCJcbiAgICAgICAgICB9LCBCRFYyLlJlYWN0LmNyZWF0ZUVsZW1lbnQoQkRMb2dvLCB7XG4gICAgICAgICAgICBzaXplOiBcIjE2cHhcIixcbiAgICAgICAgICAgIGNsYXNzTmFtZTogXCJiZC1zb2NpYWwtbG9nb1wiXG4gICAgICAgICAgfSkpKSk7XG4gICAgICAgICAgcmV0dXJuIHJldHVyblZhbDtcbiAgICAgICAgfTtcblxuICAgICAgICBjaGlsZHJlbltjaGlsZHJlbi5sZW5ndGggLSAyXS50eXBlID0gbmV3T25lO1xuICAgICAgfVxuXG4gICAgICBsZXQgW2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NBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBIiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///./src/modules/core.js\n"); /***/ }), @@ -275,7 +275,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _0gl /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"uuidv4\", function() { return uuidv4; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Constants\", function() { return Constants; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Routes\", function() { return Routes; });\n/* harmony import */ var _svg_bug_hunter__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../svg/bug_hunter */ \"./src/svg/bug_hunter.jsx\");\n\nfunction uuidv4() {\n // Generate UUID (No crypto rng)\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {\n var r = Math.random() * 16 | 0,\n v = c == 'x' ? r : r & 0x3 | 0x8;\n return v.toString(16);\n });\n}\nconst awaitingBadgesPromises = {};\n/* harmony default export */ __webpack_exports__[\"default\"] = (new class DistantServer {\n constructor() {\n this._cache = {\n badges: {}\n };\n }\n\n get cache() {\n return this._cache;\n }\n\n set cache(data) {\n if (typeof data !== \"object\" || typeof this._cache !== \"object\") return this._cache = data;\n return this._cache = Object.assign(this._cache, data);\n }\n /**\r\n * Get custom badges from the user ID.\r\n * @param {string} user The user ID \r\n * @returns {Promise}\r\n */\n\n\n async getBadges(user) {\n if (this.cache.badges[user]) return this.cache.badges[user];\n if (awaitingBadgesPromises[user]) return awaitingBadgesPromises[user];\n let resolve;\n const newPromise = new Promise(res => resolve = res);\n awaitingBadgesPromises[user] = newPromise;\n const badges = [];\n\n for (let badge of Constants.badges) {\n if (badge.defaultUsers.includes(user)) badges.push(badge);\n }\n\n const fetchedBadges = await new Promise(resolve => {\n handleRequest(Routes.badges(user), \"GET\").then(async res => {\n if (res.status !== 200) {\n // Couldn't fetch badges: server error\n return resolve([]); // no badge fetched\n }\n\n return resolve((await res.json()));\n }).catch(() => {\n // Couldn't fetch badges: error\n return resolve([]); // no badge fetched\n });\n });\n\n for (let badge of fetchedBadges) {\n if (!Constants.badges.find(e => e.id === badge)) continue; // We do not have the Component, skip it.\n\n if (badges.find(e => e.id === badge)) continue; // Already inserted.\n\n badges.push(Constants.badges.find(e => e.id === badge));\n }\n\n this.cache = {\n badges: Object.assign(this.cache.badges, {\n [user]: badges\n })\n };\n setTimeout(() => {\n delete this.cache.badges[user];\n }, 600000);\n resolve(badges);\n delete awaitingBadgesPromises[user];\n return badges;\n }\n\n}());\n\nconst handleRequest = function (route, method) {\n return fetch(`${Constants.SERVER_URL}/api/v1${route}`, {\n method,\n headers: {\n \"CLIENT\": \"Lightcord\"\n }\n });\n};\n\nconst Constants = {\n SERVER_URL: \"http://127.0.0.1\",\n badges: [{\n name: \"Bug Hunter\",\n id: \"f04698f5-816b-41e3-bd01-92291193d7a5\",\n defaultUsers: [\"696481194443014174\", \"585858920149549067\"],\n scopes: [],\n component: _svg_bug_hunter__WEBPACK_IMPORTED_MODULE_0__[\"default\"],\n href: \"https://github.com/lightcord/lightcord/wiki/badges/bug_hunter\"\n }]\n};\nconst Routes = {\n badges(user) {\n return `/${user}/badges`;\n }\n\n};//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiLi9zcmMvbW9kdWxlcy9kaXN0YW50LmpzLmpzIiwic291cmNlcyI6WyJ3ZWJwYWNrOi8vQmV0dGVyRGlzY29yZC8uL3NyYy9tb2R1bGVzL2Rpc3RhbnQuanM/MjJhMiJdLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgQnVnSHVudGVyQmFkZ2UgZnJvbSBcIi4uL3N2Zy9idWdfaHVudGVyXCI7XG5leHBvcnQgZnVuY3Rpb24gdXVpZHY0KCkge1xuICAvLyBHZW5lcmF0ZSBVVUlEIChObyBjcnlwdG8gcm5nKVxuICByZXR1cm4gJ3h4eHh4eHh4LXh4eHgtNHh4eC15eHh4LXh4eHh4eHh4eHh4eCcucmVwbGFjZSgvW3h5XS9nLCBmdW5jdGlvbiAoYykge1xuICAgIHZhciByID0gTWF0aC5yYW5kb20oKSAqIDE2IHwgMCxcbiAgICAgICAgdiA9IGMgPT0gJ3gnID8gciA6IHIgJiAweDMgfCAweDg7XG4gICAgcmV0dXJuIHYudG9TdHJpbmcoMTYpO1xuICB9KTtcbn1cbmNvbnN0IGF3YWl0aW5nQmFkZ2VzUHJvbWlzZXMgPSB7fTtcbmV4cG9ydCBkZWZhdWx0IG5ldyBjbGFzcyBEaXN0YW50U2VydmVyIHtcbiAgY29uc3RydWN0b3IoKSB7XG4gICAgdGhpcy5fY2FjaGUgPSB7XG4gICAgICBiYWRnZXM6IHt9XG4gICAgfTtcbiAgfVxuXG4gIGdldCBjYWNoZSgpIHtcbiAgICByZXR1cm4gdGhpcy5fY2FjaGU7XG4gIH1cblxuICBzZXQgY2FjaGUoZGF0YSkge1xuICAgIGlmICh0eXBlb2YgZGF0YSAhPT0gXCJvYmplY3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UFBO0FBQUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQSIsInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///./src/modules/distant.js\n"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"uuidv4\", function() { return uuidv4; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Constants\", function() { return Constants; });\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"Routes\", function() { return Routes; });\n/* harmony import */ var _svg_bug_hunter__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../svg/bug_hunter */ \"./src/svg/bug_hunter.jsx\");\n\nfunction uuidv4() {\n // Generate UUID (No crypto rng)\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {\n var r = Math.random() * 16 | 0,\n v = c == 'x' ? r : r & 0x3 | 0x8;\n return v.toString(16);\n });\n}\nconst awaitingBadgesPromises = {};\n/* harmony default export */ __webpack_exports__[\"default\"] = (new class DistantServer {\n constructor() {\n this._cache = {\n badges: {}\n };\n }\n\n get cache() {\n return this._cache;\n }\n\n set cache(data) {\n if (typeof data !== \"object\" || typeof this._cache !== \"object\") return this._cache = data;\n return this._cache = Object.assign(this._cache, data);\n }\n\n async delete() {\n BdApi.showToast(\"Deleting all infos about you on Lightcord Servers...\", {\n type: \"warn\"\n });\n return handleRequest(Routes.delete, \"delete\").then(async res => {\n if (res.status !== 200) {\n BdApi.showToast(\"An error occured, couldn't delete informations. See console for more infos\", {\n type: \"error\"\n });\n throw new Error(`Couldn't delete all informations: ${res.status + \" \" + res.statusText + \" \" + (await res.text())}`);\n }\n\n console.info(`Succesfully deleted informations.`);\n BdApi.showToast(\"Succesfully deleted informations\", {\n type: \"success\"\n });\n window.Lightcord.Api.Authorization = null;\n return res.json();\n }).catch(err => {\n BdApi.showToast(\"An error occured, couldn't delete informations. See console for more infos\", {\n type: \"error\"\n });\n throw new Error(`Couldn't delete all informations: ${err.stack}`);\n });\n }\n /**\r\n * Get custom badges from the user ID.\r\n * @param {string} user The user ID \r\n * @returns {Promise}\r\n */\n\n\n async getBadges(user) {\n if (this.cache.badges[user]) return this.cache.badges[user];\n if (awaitingBadgesPromises[user]) return awaitingBadgesPromises[user];\n let resolve;\n const newPromise = new Promise(res => resolve = res);\n awaitingBadgesPromises[user] = newPromise;\n const badges = [];\n\n for (let badge of Constants.badges) {\n if (badge.defaultUsers.includes(user)) badges.push(badge);\n }\n\n const fetchedBadges = await new Promise(resolve => {\n handleRequest(Routes.badges(user), \"GET\").then(async res => {\n if (res.status !== 200) {\n // Couldn't fetch badges: server error\n return resolve([]); // no badge fetched\n }\n\n return resolve((await res.json()));\n }).catch(() => {\n // Couldn't fetch badges: error\n return resolve([]); // no badge fetched\n });\n });\n\n for (let badge of fetchedBadges) {\n if (!Constants.badges.find(e => e.id === badge)) continue; // We do not have the Component, skip it.\n\n if (badges.find(e => e.id === badge)) continue; // Already inserted.\n\n badges.push(Constants.badges.find(e => e.id === badge));\n }\n\n this.cache = {\n badges: Object.assign(this.cache.badges, {\n [user]: badges\n })\n };\n setTimeout(() => {\n delete this.cache.badges[user];\n }, 600000);\n resolve(badges);\n delete awaitingBadgesPromises[user];\n return badges;\n }\n\n}());\n\nconst handleRequest = function (route, method) {\n return fetch(`${Constants.SERVER_URL}/api/v1${route}`, {\n method,\n headers: {\n \"CLIENT\": \"Lightcord\",\n \"Authorization\": window.Lightcord.Api.Authorization || \"None::Anonymous\"\n }\n });\n};\n\nconst Constants = {\n SERVER_URL: \"http://127.0.0.1\",\n badges: [{\n name: \"Lightcord User\",\n id: \"01cfa7b0-7cdb-4b0e-8258-9c6a78235c93\",\n defaultUsers: [\"696481194443014174\"],\n scopes: [\"user\"],\n component: _svg_bug_hunter__WEBPACK_IMPORTED_MODULE_0__[\"default\"],\n href: \"https://github.com/lightcord/lightcord/wiki/badges/bug_hunter\"\n }, {\n name: \"Lightcord Bug Hunter\",\n id: \"f04698f5-816b-41e3-bd01-92291193d7a5\",\n defaultUsers: [\"696481194443014174\"],\n scopes: [],\n component: _svg_bug_hunter__WEBPACK_IMPORTED_MODULE_0__[\"default\"],\n href: \"https://github.com/lightcord/lightcord/wiki/badges/bug_hunter\"\n }]\n};\nconst Routes = {\n badges: user => `/${user}/badges`,\n delete: `/delete`\n};//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiLi9zcmMvbW9kdWxlcy9kaXN0YW50LmpzLmpzIiwic291cm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tBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///./src/modules/distant.js\n"); /***/ }), @@ -299,7 +299,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) * /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"default\", function() { return PluginCertifier; });\n/* harmony import */ var node_fetch__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! node-fetch */ \"node-fetch\");\n/* harmony import */ var node_fetch__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(node_fetch__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var electron__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! electron */ \"electron\");\n/* harmony import */ var electron__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(electron__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var crypto__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! crypto */ \"crypto\");\n/* harmony import */ var crypto__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(crypto__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _v2__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./v2 */ \"./src/modules/v2.js\");\n/* harmony import */ var _ui_tooltipWrap__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../ui/tooltipWrap */ \"./src/ui/tooltipWrap.js\");\n\n\n\n\n\nconst debug = true;\nconst cache = {};\nconst cache2 = {};\nconst PinnedModule = BDModules.get(e => e.default && e.default.getPinnedMessages)[0].default;\nconst ChannelModule = BDModules.get(e => e.default && e.default.getChannelId)[0].default;\nconst fetchMessagesModule = BDModules.get(e => e.default && e.default.fetchMessages)[0].default;\nconst fetchMessagesModule2 = BDModules.get(e => e.default && e.default.fetchMessages)[1].default;\nconst getMessagesModule = BDModules.get(e => e.default && e.default.getMessages)[0].default;\nclass PluginCertifier {\n constructor() {}\n\n start() {\n const dispatcher = window.Lightcord.DiscordModules.dispatcher;\n const constants = window.Lightcord.DiscordModules.constants;\n const originalFetchMessages = fetchMessagesModule.fetchMessages;\n\n fetchMessagesModule.fetchMessages = function () {\n const returnValue = originalFetchMessages.apply(this, arguments);\n\n if (returnValue instanceof Promise) {\n returnValue.then(() => {\n const ev = getMessagesModule.getMessages(ChannelModule.getChannelId());\n process.nextTick(() => {\n for (const message of ev._array) {\n const attachments = message.attachments || [];\n if (attachments.length === 0) continue; // no attachments\n\n attachments.forEach(attachment => {\n processAttachment(attachment);\n });\n }\n });\n });\n }\n\n return returnValue;\n };\n\n const originalFetchMessages2 = fetchMessagesModule2.fetchMessages;\n\n fetchMessagesModule2.fetchMessages = function () {\n const returnValue = originalFetchMessages2.apply(this, arguments);\n\n if (returnValue instanceof Promise) {\n returnValue.then(() => {\n const ev = getMessagesModule.getMessages(ChannelModule.getChannelId());\n process.nextTick(() => {\n for (const message of ev._array) {\n const attachments = message.attachments || [];\n if (attachments.length === 0) continue; // no attachments\n\n attachments.forEach(attachment => {\n processAttachment(attachment);\n });\n }\n });\n });\n }\n\n return returnValue;\n };\n\n const alreadyUsed = {};\n const originalGetPinnedMessages = PinnedModule.getPinnedMessages.bind(PinnedModule);\n\n PinnedModule.getPinnedMessages = function () {\n const pinned = originalGetPinnedMessages(...arguments);\n if (!pinned || alreadyUsed[pinned.id]) return pinned;\n alreadyUsed[pinned.id] = true;\n setTimeout(() => {\n delete alreadyUsed[pinned.id];\n\n for (const message of pinned.messages) {\n const attachments = message.attachments || [];\n if (attachments.length === 0) continue; // no attachments\n\n attachments.forEach(attachment => {\n processAttachment(attachment);\n });\n }\n }, 50);\n return pinned;\n };\n\n dispatcher.subscribe(constants.ActionTypes.MESSAGE_CREATE, ev => {\n const message = ev.message;\n if (message.channel_id !== ChannelModule.getChannelId()) return;\n process.nextTick(() => {\n const attachments = message.attachments || [];\n if (attachments.length === 0) return; // no attachments\n\n attachments.forEach(attachment => {\n processAttachment(attachment);\n });\n });\n });\n const messages = getMessagesModule.getMessages(ChannelModule.getChannelId());\n process.nextTick(() => {\n for (const message of messages._array) {\n const attachments = message.attachments || [];\n if (attachments.length === 0) continue; // no attachments\n\n attachments.forEach(attachment => {\n processAttachment(attachment);\n });\n }\n });\n }\n\n}\n/*\r\nfunction checkViruses(hash, data){\r\n data = data.toString(\"utf8\").split(/[^\\w\\d]+/g)\r\n let isHarmful = false\r\n for(let keyword of data){\r\n for(let oof of [\r\n \"token\",\r\n \"email\",\r\n \"phone\",\r\n \"MFA\",\r\n \"2fa\",\r\n \"process.exit\",\r\n \"child_process\",\r\n \"localStorage\"\r\n ]){\r\n if(keyword.toLowerCase().includes(oof.toLowerCase())){\r\n console.log(keyword, oof)\r\n isHarmful = true\r\n break\r\n } \r\n }\r\n if(isHarmful)break\r\n }\r\n console.log(isHarmful)\r\n if(!isHarmful)return\r\n cache[hash] = {\r\n suspect: true,\r\n name: hashToUrl[hash].split(\"/\").pop(),\r\n type: hashToUrl[hash].endsWith(\".js\") ? \"Plugin\" : \"Theme\" \r\n }\r\n\r\n let elements = Array.from(document.querySelectorAll(`a[href=\"${hashToUrl[hash]}\"]`)).filter(e => !e.classList.contains(\"da-fileNameLink\")).map(e => e.parentElement)\r\n renderToElements(elements, cache[hash], cache[hash].name)\r\n}*/\n\nconst hashToUrl = {};\n\nfunction processAttachment(attachment) {\n if (!attachment.url.startsWith(\"https://cdn.discordapp.com/\")) return;\n if (!attachment.filename.endsWith(\".plugin.js\") && !attachment.filename.endsWith(\".theme.css\")) return;\n\n let nextHash = (hash, data) => {\n if (!cache[hash]) {\n node_fetch__WEBPACK_IMPORTED_MODULE_0___default()(\"https://raw.githubusercontent.com/Lightcord/filehashes/master/hashes/\" + hash, {\n headers: {\n \"User-Agent\": electron__WEBPACK_IMPORTED_MODULE_1__[\"remote\"].getCurrentWebContents().userAgent\n }\n }).then(async res => {\n if (res.status !== 200) return; //checkViruses(hash, data)\n\n const result = await res.json();\n debug && console.log(`Hash valid:`, result);\n cache[hash] = result;\n let elements = Array.from(document.querySelectorAll(`a[href=\"${attachment.url}\"]`)).filter(e => !e.classList.contains(\"da-fileNameLink\")).map(e => e.parentElement);\n renderToElements(elements, result, attachment.filename);\n }).catch(() => {});\n } else {\n const result = cache[hash];\n debug && console.log(`Hash Cached:`, result);\n let elements = Array.from(document.querySelectorAll(`a[href=\"${attachment.url}\"]`)).filter(e => !e.classList.contains(\"da-fileNameLink\")).map(e => e.parentElement);\n renderToElements(elements, result, attachment.filename);\n }\n };\n\n if (cache2[attachment.url]) return nextHash(cache2[attachment.url]);\n node_fetch__WEBPACK_IMPORTED_MODULE_0___default()(attachment.url, {\n headers: {\n \"User-Agent\": electron__WEBPACK_IMPORTED_MODULE_1__[\"remote\"].getCurrentWebContents().userAgent\n }\n }).then(res => {\n if (res.status !== 200) throw new Error(\"File doesn't exist.\");\n const hash = crypto__WEBPACK_IMPORTED_MODULE_2__[\"createHash\"](\"sha256\");\n let data = Buffer.alloc(0);\n res.body.on(\"data\", chunk => {\n data = Buffer.concat([data, chunk]);\n hash.update(chunk);\n });\n res.body.on(\"end\", () => {\n const hashResult = hash.digest(\"hex\");\n debug && console.log(`Calculated hash for file ${attachment.filename}: ${hashResult}`);\n cache2[attachment.url] = hashResult;\n hashToUrl[hashResult] = attachment.url;\n nextHash(hashResult, data);\n });\n }).catch(() => {});\n}\n\nconst flowerStarModule = BDModules.get(e => e.flowerStarContainer)[0];\nconst childModule = BDModules.get(e => e.childContainer)[0];\n/**\r\n * \r\n * @param {HTMLDivElement[]} elements \r\n * @param {{type: \"Theme\"|\"Plugin\", name: string, official?: boolean}|{suspect:true, type: \"Theme\"|\"Plugin\", name: string}} result\r\n */\n\nfunction renderToElements(elements, result, filename) {\n elements.forEach(e => {\n if (e.childNodes.length > 3) return;\n const div = document.createElement(\"div\");\n e.appendChild(div);\n /*\r\n if(result.suspect){\r\n e.style.backgroundColor = \"#E13838\"\r\n /**\r\n * \r\n * @param {HTMLElement} node \r\n */\n\n /*\r\n let nextNode = (node) => {\r\n for(let child of node.children){\r\n if(child.tagName === \"a\"){\r\n child.addEventListener(\"click\", (e) => {\r\n e.preventDefault()\r\n alert(\"You are about to download a suspect \"+result.type.toLowerCase()+\". Are you sure ? If yes, then please copy and paste the URL directly into your browser.\")\r\n })\r\n }else if([\"div\"].includes(child.tagName)){\r\n nextNode(child)\r\n }\r\n }\r\n }\r\n nextNode(e)\r\n }else */\n\n if (!result.official) {\n _v2__WEBPACK_IMPORTED_MODULE_3__[\"default\"].reactDom.render(_v2__WEBPACK_IMPORTED_MODULE_3__[\"default\"].react.createElement(_ui_tooltipWrap__WEBPACK_IMPORTED_MODULE_4__[\"default\"], {\n text: result.type + \" \" + result.name + \" is certified by Lightcord.\"\n }, _v2__WEBPACK_IMPORTED_MODULE_3__[\"default\"].react.createElement(\"div\", {\n className: flowerStarModule.flowerStarContainer,\n style: {\n width: \"16px\",\n height: \"16px\"\n }\n }, _v2__WEBPACK_IMPORTED_MODULE_3__[\"default\"].react.createElement(\"svg\", {\n className: flowerStarModule.flowerStar,\n \"aria-hidden\": \"false\",\n width: \"16px\",\n height: \"16px\",\n viewBox: \"0 0 16 15.2\"\n }, _v2__WEBPACK_IMPORTED_MODULE_3__[\"default\"].react.createElement(\"path\", {\n fill: \"#4f545c\",\n \"fill-rule\": \"evenodd\",\n d: \"m16 7.6c0 .79-1.28 1.38-1.52 2.09s.44 2 0 2.59-1.84.35-2.46.8-.79 1.84-1.54 2.09-1.67-.8-2.47-.8-1.75 1-2.47.8-.92-1.64-1.54-2.09-2-.18-2.46-.8.23-1.84 0-2.59-1.54-1.3-1.54-2.09 1.28-1.38 1.52-2.09-.44-2 0-2.59 1.85-.35 2.48-.8.78-1.84 1.53-2.12 1.67.83 2.47.83 1.75-1 2.47-.8.91 1.64 1.53 2.09 2 .18 2.46.8-.23 1.84 0 2.59 1.54 1.3 1.54 2.09z\"\n })), _v2__WEBPACK_IMPORTED_MODULE_3__[\"default\"].react.createElement(\"div\", {\n className: childModule.childContainer\n }, _v2__WEBPACK_IMPORTED_MODULE_3__[\"default\"].react.createElement(\"svg\", {\n \"aria-hidden\": \"false\",\n width: \"16px\",\n height: \"16px\",\n viewBox: \"0 0 16 15.2\"\n }, _v2__WEBPACK_IMPORTED_MODULE_3__[\"default\"].react.createElement(\"path\", {\n fill: \"#ffffff\",\n d: \"M7.4,11.17,4,8.62,5,7.26l2,1.53L10.64,4l1.36,1Z\"\n }))))), div);\n } else {\n _v2__WEBPACK_IMPORTED_MODULE_3__[\"default\"].reactDom.render(_v2__WEBPACK_IMPORTED_MODULE_3__[\"default\"].react.createElement(_ui_tooltipWrap__WEBPACK_IMPORTED_MODULE_4__[\"default\"], {\n text: result.type + \" \" + result.name + \" was made by the developers of Lightcord.\",\n style: \"brand\"\n }, _v2__WEBPACK_IMPORTED_MODULE_3__[\"default\"].react.createElement(\"div\", {\n className: flowerStarModule.flowerStarContainer,\n style: {\n width: \"16px\",\n height: \"16px\"\n }\n }, _v2__WEBPACK_IMPORTED_MODULE_3__[\"default\"].react.createElement(\"svg\", {\n className: flowerStarModule.flowerStar,\n \"aria-hidden\": \"false\",\n width: \"16px\",\n height: \"16px\",\n viewBox: \"0 0 16 15.2\",\n stroke: \"#36393f\",\n style: {\n color: \"#4087ed\"\n }\n }, _v2__WEBPACK_IMPORTED_MODULE_3__[\"default\"].react.createElement(\"path\", {\n fill: \"currentColor\",\n \"fill-rule\": \"evenodd\",\n d: \"m16 7.6c0 .79-1.28 1.38-1.52 2.09s.44 2 0 2.59-1.84.35-2.46.8-.79 1.84-1.54 2.09-1.67-.8-2.47-.8-1.75 1-2.47.8-.92-1.64-1.54-2.09-2-.18-2.46-.8.23-1.84 0-2.59-1.54-1.3-1.54-2.09 1.28-1.38 1.52-2.09-.44-2 0-2.59 1.85-.35 2.48-.8.78-1.84 1.53-2.12 1.67.83 2.47.83 1.75-1 2.47-.8.91 1.64 1.53 2.09 2 .18 2.46.8-.23 1.84 0 2.59 1.54 1.3 1.54 2.09z\"\n })), _v2__WEBPACK_IMPORTED_MODULE_3__[\"default\"].react.createElement(\"div\", {\n className: childModule.childContainer\n }, _v2__WEBPACK_IMPORTED_MODULE_3__[\"default\"].react.createElement(\"svg\", {\n \"aria-hidden\": \"false\",\n width: \"16px\",\n height: \"16px\",\n viewBox: \"0 0 16 15.2\"\n }, _v2__WEBPACK_IMPORTED_MODULE_3__[\"default\"].react.createElement(\"path\", {\n fill: \"#ffffff\",\n d: \"M10.7,5.28a2.9,2.9,0,0,0-2.11.86.11.11,0,0,0,0,.16l1.05.94a.11.11,0,0,0,.15,0,1.27,1.27,0,0,1,.9-.33c.65,0,.65.73.65.73a.64.64,0,0,1-.65.65,1.73,1.73,0,0,1-1.18-.54c-.31-.26-.36-.32-.73-.66S7.06,5.28,5.65,5.28A2.26,2.26,0,0,0,3.37,7.56,2.59,2.59,0,0,0,3.82,9a2.18,2.18,0,0,0,1.83.89,2.94,2.94,0,0,0,2.1-.81.11.11,0,0,0,0-.16L6.74,8A.11.11,0,0,0,6.6,8a1.58,1.58,0,0,1-.94.29h0A.71.71,0,0,1,5,7.56H5a.63.63,0,0,1,.65-.64c.71,0,1.42.75,1.94,1.27.75.76,1.66,1.79,3.11,1.74A2.28,2.28,0,0,0,13,7.64a2.59,2.59,0,0,0-.45-1.47A2.14,2.14,0,0,0,10.7,5.28Z\"\n }))))), div);\n }\n });\n}//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiLi9zcmMvbW9kdWxlcy9wbHVnaW5DZXJ0aWZpZXIuanMuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly9CZXR0ZXJEaXNjb3JkLy4vc3JjL21vZHVsZXMvcGx1Z2luQ2VydGlmaWVyLmpzPzQyODMiXSwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IG5vZGVGZXRjaCBmcm9tIFwibm9kZS1mZXRjaFwiO1xuaW1wb3J0ICogYXMgZWxlY3Ryb24gZnJvbSBcImVsZWN0cm9uXCI7XG5pbXBvcnQgKiBhcyBjcnlwdG8gZnJvbSBcImNyeXB0b1wiO1xuaW1wb3J0IEJEVjIgZnJvbSBcIi4vdjJcIjtcbmltcG9ydCB0b29sdGlwV3JhcCBmcm9tIFwiLi4vdWkvdG9vbHRpcFdyYXBcIjtcbmNvbnN0IGRlYnVnID0gdHJ1ZTtcbmNvbnN0IGNhY2hlID0ge307XG5jb25zdCBjYWNoZTIgPSB7fTtcbmNvbnN0IFBpbm5lZE1vZHVsZSA9IEJETW9kdWxlcy5nZXQoZSA9PiBlLmRlZmF1bHQgJiYgZS5kZWZhdWx0LmdldFBpbm5lZE1lc3NhZ2VzKVswXS5kZWZhdWx0O1xuY29uc3QgQ2hhbm5lbE1vZHVsZSA9IEJETW9kdWxlcy5nZXQoZSA9PiBlLmRlZmF1bHQgJiYgZS5kZWZhdWx0LmdldENoYW5uZWxJZClbMF0uZGVmYXVsdDtcbmNvbnN0IGZldGNoTWVzc2FnZXN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nZXRNZXNzYWdlc01vZHVsZS5nZXRNZXNzYWdlcyhDaGFubmVsTW9kdWxlLmdldENoYW5uZWxJZCgpKTtcbiAgICBwcm9jZXNzLm5leHRUaWNrKCgpID0+IHtcbiAgICAgIGZvciAoY29uc3QgbWVzc2FnZSBvZiBtZXNzYWdlcy5fYXJyYXkpIHtcbiAgICAgICAgY29uc3QgYXR0YWNobWVudHMgPSBtZXNzYWdlLmF0dGFjaG1lbnRzIHx8IFtdO1xuICAgICAgICBpZiAoYXR0YWNobWVudHMubGVuZ3RoID09PSAwKSBjb250aW51ZTsgLy8gbm8gYXR0YWNobWVudHNcblxuICAgICAgICBhdHRhY2htZW50cy5mb3JFYWNoKGF0dGFjaG1lbnQgPT4ge1xuICAgICAgICAgIHByb2Nlc3NBdHRhY2htZW50KGF0dGFjaG1lbnQpO1xuICAgICAgICB9KTtcbiAgICAgIH1cbiAgICB9KTtcbiAgfVxuXG59XG4vKlxyXG5mdW5jdGlvbiBjaGVja1ZpcnVzZXMoaGFzaCwgZGF0YSl7XHJcbiAgICBkYXRhID0gZGF0YS50b1N0cmluZyhcInV0ZjhcIikuc3BsaXQoL1teXFx3XFxkXSsvZylcclxuICAgIGxldCBpc0hhcm1mdWwgPSBmYWxzZVxyXG4gICAgZm9yKGxldCBrZXl3b3JkIG9mIGRhdGEpe1xyXG4gICAgICAgIGZvcihsZXQgb29mIG9mIFtcclxuICAgICAgICAgICAgXCJ0b2tlblwiLFxyXG4gICAgICAgICAgICBcImVtYWlsXCIsXHJcbiAgICAgICAgICAgIFwicGhvbmVcIixcclxuICAgICAgICAgICAgXCJNRkFcIixcclxuICAgICAgICAgICAgXCIyZmFcIixcclxuICAgICAgICAgICAgXCJwcm9jZXNzLmV4aXRcIixcclxuICAgICAgICAgICAgXCJjaGlsZF9wcm9jZXNzXCIsXHJcbiAgICAgICAgICAgIFwibG9jYWxTdG9yYWdlXCJcclxuICAgICAgICBdKXtcclxuICAgICAgICAgICAgaWYoa2V5d29yZC50b0x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0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBIiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///./src/modules/pluginCertifier.js\n"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var node_fetch__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! node-fetch */ \"node-fetch\");\n/* harmony import */ var node_fetch__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(node_fetch__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var electron__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! electron */ \"electron\");\n/* harmony import */ var electron__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(electron__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var crypto__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! crypto */ \"crypto\");\n/* harmony import */ var crypto__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(crypto__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _v2__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./v2 */ \"./src/modules/v2.js\");\n/* harmony import */ var _ui_tooltipWrap__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../ui/tooltipWrap */ \"./src/ui/tooltipWrap.js\");\n/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./utils */ \"./src/modules/utils.js\");\n\n\n\n\n\n\nconst debug = true;\nconst cache = {};\nconst cache2 = {};\n/*\r\nconst PinnedModule = BDModules.get(e => e.default && e.default.getPinnedMessages)[0].default\r\nconst ChannelModule = BDModules.get(e => e.default && e.default.getChannelId)[0].default\r\nconst fetchMessagesModule = BDModules.get(e => e.default && e.default.fetchMessages)[0].default\r\nconst fetchMessagesModule2 = BDModules.get(e => e.default && e.default.fetchMessages)[1].default\r\nconst getMessagesModule = BDModules.get(e => e.default && e.default.getMessages)[0].default*/\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (new class PluginCertifier {\n constructor() {}\n\n patch(attachment, id) {\n process.nextTick(() => {\n processAttachment(attachment, id);\n });\n }\n\n start() {\n /*const dispatcher = window.Lightcord.DiscordModules.dispatcher\r\n const constants = window.Lightcord.DiscordModules.constants\r\n const originalFetchMessages = fetchMessagesModule.fetchMessages\r\n fetchMessagesModule.fetchMessages = function(){\r\n const returnValue = originalFetchMessages.apply(this, arguments)\r\n if(returnValue instanceof Promise){\r\n returnValue\r\n .then(() => {\r\n const ev = getMessagesModule.getMessages(ChannelModule.getChannelId())\r\n process.nextTick(() => {\r\n for(const message of ev._array){\r\n const attachments = message.attachments || []\r\n if(attachments.length === 0)continue // no attachments\r\n \r\n attachments.forEach(attachment => {\r\n processAttachment(attachment)\r\n })\r\n }\r\n })\r\n })\r\n }\r\n return returnValue\r\n }\r\n const originalFetchMessages2 = fetchMessagesModule2.fetchMessages\r\n fetchMessagesModule2.fetchMessages = function(){\r\n const returnValue = originalFetchMessages2.apply(this, arguments)\r\n if(returnValue instanceof Promise){\r\n returnValue\r\n .then(() => {\r\n const ev = getMessagesModule.getMessages(ChannelModule.getChannelId())\r\n process.nextTick(() => {\r\n for(const message of ev._array){\r\n const attachments = message.attachments || []\r\n if(attachments.length === 0)continue // no attachments\r\n \r\n attachments.forEach(attachment => {\r\n processAttachment(attachment)\r\n })\r\n }\r\n })\r\n })\r\n }\r\n return returnValue\r\n }\r\n const alreadyUsed = {}\r\n const originalGetPinnedMessages = PinnedModule.getPinnedMessages.bind(PinnedModule)\r\n PinnedModule.getPinnedMessages = function(){\r\n const pinned = originalGetPinnedMessages(...arguments)\r\n if(!pinned || alreadyUsed[pinned.id])return pinned\r\n alreadyUsed[pinned.id] = true\r\n \r\n setTimeout(() => {\r\n delete alreadyUsed[pinned.id]\r\n for(const message of pinned.messages){\r\n const attachments = message.attachments || []\r\n if(attachments.length === 0)continue // no attachments\r\n attachments.forEach(attachment => {\r\n processAttachment(attachment)\r\n })\r\n }\r\n }, 50);\r\n return pinned\r\n }\r\n dispatcher.subscribe(constants.ActionTypes.MESSAGE_CREATE, (ev) => {\r\n const message = ev.message\r\n if(message.channel_id !== ChannelModule.getChannelId())return\r\n process.nextTick(() => {\r\n const attachments = message.attachments || []\r\n if(attachments.length === 0)return // no attachments\r\n attachments.forEach(attachment => {\r\n processAttachment(attachment)\r\n })\r\n })\r\n })\r\n const messages = getMessagesModule.getMessages(ChannelModule.getChannelId())\r\n process.nextTick(() => {\r\n for(const message of messages._array){\r\n const attachments = message.attachments || []\r\n if(attachments.length === 0)continue // no attachments\r\n attachments.forEach(attachment => {\r\n processAttachment(attachment)\r\n })\r\n }\r\n })*/\n }\n\n}());\n\nfunction checkViruses(hash, data, id) {\n data = data.toString(\"utf8\").split(/[^\\w\\d]+/g);\n let isHarmful = false;\n\n for (let keyword of data) {\n for (let oof of [\"token\", \"email\", \"phone\", \"MFA\", \"2fa\", \"process\", \"child_process\", \"localStorage\", \"eval\", \"getGlobal\", \"BrowserWindow\"]) {\n if (keyword.toLowerCase().includes(oof.toLowerCase())) {\n isHarmful = \"token stealer/virus\";\n break;\n }\n }\n\n if (isHarmful) break;\n }\n\n if (!isHarmful) {\n /**\r\n * @type {string}\r\n */\n const no_comments = data.replace(/\\/\\*[\\s\\S]*?\\*\\/|([^\\\\:]|^)\\/\\/.*$/gm, \"\").trim(); // removing the META{} comment from plugins\n\n if (/var [\\w\\d_$]+=\\[\"/gi.test(no_comments)) {\n isHarmful = \"obfuscation/hidden code\";\n }\n\n if (!isHarmful) {\n const regexps = [\n /** hexadecimal */\n /_0x\\w{4}\\('0x[\\dabcdef]+'\\)/g, /_0x\\w{4}\\('0x[\\dabcdef]+'[, ]+'[^']{4}'\\)/g, // _0x8db7('0x0', 'x1]f')\n\n /** mangled */\n /\\w+\\('0x[\\dabcdef]+'\\)/g, /\\w+\\('0x[\\dabcdef]+'[, ]+'[^']{4}'\\)/g // _0x8db7('0x0', 'x1]f')\n ];\n\n for (let regex of regexps) {\n if (isHarmful) break;\n isHarmful = regex.test(no_comments) ? \"obfuscation/hidden code\" : false;\n }\n }\n }\n\n if (!isHarmful) return;\n cache[hash] = {\n suspect: true,\n name: hashToUrl[hash].split(\"/\").pop(),\n type: hashToUrl[hash].endsWith(\".js\") ? \"Plugin\" : \"Theme\",\n harm: isHarmful\n };\n console.log(`Found potentially dangerous virus: ${cache[hash].name}`);\n renderToElements(id, cache[hash], cache[hash].name);\n}\n\nconst hashToUrl = {};\n\nfunction processAttachment(attachment, id) {\n if (!attachment.url.startsWith(\"https://cdn.discordapp.com/\")) return document.getElementById(id).remove();\n if (!attachment.filename.endsWith(\".plugin.js\") && !attachment.filename.endsWith(\".theme.css\")) return document.getElementById(id).remove();\n\n let nextHash = (hash, data) => {\n if (!cache[hash]) {\n node_fetch__WEBPACK_IMPORTED_MODULE_0___default()(\"https://cdn.jsdelivr.net/gh/Lightcord/filehashes@master/hashes/\" + hash, {\n // Using node-fetch to bypass cors\n headers: {\n \"User-Agent\": electron__WEBPACK_IMPORTED_MODULE_1__[\"remote\"].getCurrentWebContents().userAgent // have to set user-agent\n\n }\n }).then(async res => {\n if (res.status !== 200) return checkViruses(hash, data, id);\n const result = await res.json();\n cache[hash] = result;\n renderToElements(id, result, attachment.filename);\n }).catch(() => {});\n } else {\n const result = cache[hash];\n renderToElements(id, result, attachment.filename);\n }\n };\n\n if (cache2[attachment.url]) return nextHash(cache2[attachment.url]);\n node_fetch__WEBPACK_IMPORTED_MODULE_0___default()(attachment.url, {\n headers: {\n \"User-Agent\": electron__WEBPACK_IMPORTED_MODULE_1__[\"remote\"].getCurrentWebContents().userAgent\n }\n }).then(res => {\n if (res.status !== 200) throw new Error(\"File doesn't exist.\");\n const hash = crypto__WEBPACK_IMPORTED_MODULE_2__[\"createHash\"](\"sha256\");\n let data = Buffer.alloc(0);\n res.body.on(\"data\", chunk => {\n data = Buffer.concat([data, chunk]);\n hash.update(chunk);\n });\n res.body.on(\"end\", () => {\n const hashResult = hash.digest(\"hex\");\n cache2[attachment.url] = hashResult;\n hashToUrl[hashResult] = attachment.url;\n nextHash(hashResult, data);\n });\n }).catch(() => {});\n}\n\nconst flowerStarModule = BDModules.get(e => e.flowerStarContainer)[0];\nconst childModule = BDModules.get(e => e.childContainer)[0];\n/**\r\n * \r\n * @param {HTMLDivElement[]} elements \r\n * @param {{type: \"Theme\"|\"Plugin\", name: string, official?: boolean}|{suspect:true, type: \"Theme\"|\"Plugin\", name: string, harm: string}} result\r\n */\n\nfunction renderToElements(id, result, filename) {\n const div = document.getElementById(id);\n if (!div || div.childNodes.length > 0) return; // already certified, so don't do it.\n // TODO: implements suspect plugins.\n\n if (result.suspect) {\n try {\n div.parentNode.style.borderColor = \"rgb(240, 71, 71)\";\n /**\r\n * \r\n * @param {HTMLElement} node \r\n */\n\n let nextNode = node => {\n for (let child of node.children) {\n if (child.tagName === \"A\") {\n child.addEventListener(\"click\", e => {\n e.preventDefault();\n e.stopImmediatePropagation();\n _utils__WEBPACK_IMPORTED_MODULE_5__[\"default\"].showConfirmationModal(\"Are you sure you want to download this ?\", \"The \" + result.type.toLowerCase() + \" **\" + filename + \"** might be dangerous **(\" + result.harm + \")**. \\n\\n**We don't recommand to download it**. However, you can still do it below.\", {\n confirmText: \"Download Anyway\",\n cancelText: \"Don't !\",\n danger: true,\n onCancel: () => {},\n onConfirm: () => {\n electron__WEBPACK_IMPORTED_MODULE_1__[\"remote\"].shell.openExternal(child.href);\n }\n });\n });\n } else if ([\"div\"].includes(child.tagName.toLowerCase())) {\n nextNode(child);\n }\n }\n };\n\n nextNode(div.parentNode);\n } catch (e) {\n console.error(e);\n }\n\n _v2__WEBPACK_IMPORTED_MODULE_3__[\"default\"].reactDom.render(_v2__WEBPACK_IMPORTED_MODULE_3__[\"default\"].react.createElement(_ui_tooltipWrap__WEBPACK_IMPORTED_MODULE_4__[\"default\"], {\n text: result.type + \" \" + result.name + \" is potentially dangerous.\"\n }, _v2__WEBPACK_IMPORTED_MODULE_3__[\"default\"].react.createElement(\"div\", {\n className: flowerStarModule.flowerStarContainer,\n style: {\n width: \"16px\",\n height: \"16px\"\n }\n }, _v2__WEBPACK_IMPORTED_MODULE_3__[\"default\"].react.createElement(\"svg\", {\n className: BDModules.get(e => e.svg)[0].svg,\n \"aria-hidden\": \"false\",\n width: \"16px\",\n height: \"16px\",\n viewBox: \"0 0 40 32\"\n }, _v2__WEBPACK_IMPORTED_MODULE_3__[\"default\"].react.createElement(\"rect\", {\n x: \"0\",\n y: \"0\",\n width: \"32\",\n height: \"32\",\n mask: \"url(#svg-mask-avatar-status-round-32)\",\n fill: \"#f04747\",\n mask: \"url(#svg-mask-status-dnd)\",\n className: BDModules.get(e => e.pointerEvents)[0].pointerEvents\n })))), div);\n } else if (!result.official) {\n div.parentNode.style.borderColor = \"#4087ed\";\n _v2__WEBPACK_IMPORTED_MODULE_3__[\"default\"].reactDom.render(_v2__WEBPACK_IMPORTED_MODULE_3__[\"default\"].react.createElement(_ui_tooltipWrap__WEBPACK_IMPORTED_MODULE_4__[\"default\"], {\n text: result.type + \" \" + result.name + \" is certified by Lightcord.\"\n }, _v2__WEBPACK_IMPORTED_MODULE_3__[\"default\"].react.createElement(\"div\", {\n className: flowerStarModule.flowerStarContainer,\n style: {\n width: \"16px\",\n height: \"16px\"\n }\n }, _v2__WEBPACK_IMPORTED_MODULE_3__[\"default\"].react.createElement(\"svg\", {\n className: flowerStarModule.flowerStar,\n \"aria-hidden\": \"false\",\n width: \"16px\",\n height: \"16px\",\n viewBox: \"0 0 16 15.2\"\n }, _v2__WEBPACK_IMPORTED_MODULE_3__[\"default\"].react.createElement(\"path\", {\n fill: \"#4f545c\",\n \"fill-rule\": \"evenodd\",\n d: \"m16 7.6c0 .79-1.28 1.38-1.52 2.09s.44 2 0 2.59-1.84.35-2.46.8-.79 1.84-1.54 2.09-1.67-.8-2.47-.8-1.75 1-2.47.8-.92-1.64-1.54-2.09-2-.18-2.46-.8.23-1.84 0-2.59-1.54-1.3-1.54-2.09 1.28-1.38 1.52-2.09-.44-2 0-2.59 1.85-.35 2.48-.8.78-1.84 1.53-2.12 1.67.83 2.47.83 1.75-1 2.47-.8.91 1.64 1.53 2.09 2 .18 2.46.8-.23 1.84 0 2.59 1.54 1.3 1.54 2.09z\"\n })), _v2__WEBPACK_IMPORTED_MODULE_3__[\"default\"].react.createElement(\"div\", {\n className: childModule.childContainer\n }, _v2__WEBPACK_IMPORTED_MODULE_3__[\"default\"].react.createElement(\"svg\", {\n \"aria-hidden\": \"false\",\n width: \"16px\",\n height: \"16px\",\n viewBox: \"0 0 16 15.2\"\n }, _v2__WEBPACK_IMPORTED_MODULE_3__[\"default\"].react.createElement(\"path\", {\n fill: \"#ffffff\",\n d: \"M7.4,11.17,4,8.62,5,7.26l2,1.53L10.64,4l1.36,1Z\"\n }))))), div);\n } else {\n div.parentNode.style.borderColor = \"#4087ed\";\n _v2__WEBPACK_IMPORTED_MODULE_3__[\"default\"].reactDom.render(_v2__WEBPACK_IMPORTED_MODULE_3__[\"default\"].react.createElement(_ui_tooltipWrap__WEBPACK_IMPORTED_MODULE_4__[\"default\"], {\n text: result.type + \" \" + result.name + \" was made by the developers of Lightcord.\",\n style: \"brand\"\n }, _v2__WEBPACK_IMPORTED_MODULE_3__[\"default\"].react.createElement(\"div\", {\n className: flowerStarModule.flowerStarContainer,\n style: {\n width: \"16px\",\n height: \"16px\"\n }\n }, _v2__WEBPACK_IMPORTED_MODULE_3__[\"default\"].react.createElement(\"svg\", {\n className: flowerStarModule.flowerStar,\n \"aria-hidden\": \"false\",\n width: \"16px\",\n height: \"16px\",\n viewBox: \"0 0 16 15.2\",\n stroke: \"#36393f\",\n style: {\n color: \"#4087ed\"\n }\n }, _v2__WEBPACK_IMPORTED_MODULE_3__[\"default\"].react.createElement(\"path\", {\n fill: \"currentColor\",\n \"fill-rule\": \"evenodd\",\n d: \"m16 7.6c0 .79-1.28 1.38-1.52 2.09s.44 2 0 2.59-1.84.35-2.46.8-.79 1.84-1.54 2.09-1.67-.8-2.47-.8-1.75 1-2.47.8-.92-1.64-1.54-2.09-2-.18-2.46-.8.23-1.84 0-2.59-1.54-1.3-1.54-2.09 1.28-1.38 1.52-2.09-.44-2 0-2.59 1.85-.35 2.48-.8.78-1.84 1.53-2.12 1.67.83 2.47.83 1.75-1 2.47-.8.91 1.64 1.53 2.09 2 .18 2.46.8-.23 1.84 0 2.59 1.54 1.3 1.54 2.09z\"\n })), _v2__WEBPACK_IMPORTED_MODULE_3__[\"default\"].react.createElement(\"div\", {\n className: childModule.childContainer\n }, _v2__WEBPACK_IMPORTED_MODULE_3__[\"default\"].react.createElement(\"svg\", {\n \"aria-hidden\": \"false\",\n width: \"16px\",\n height: \"16px\",\n viewBox: \"0 0 16 15.2\"\n }, _v2__WEBPACK_IMPORTED_MODULE_3__[\"default\"].react.createElement(\"path\", {\n fill: \"#ffffff\",\n d: \"M10.7,5.28a2.9,2.9,0,0,0-2.11.86.11.11,0,0,0,0,.16l1.05.94a.11.11,0,0,0,.15,0,1.27,1.27,0,0,1,.9-.33c.65,0,.65.73.65.73a.64.64,0,0,1-.65.65,1.73,1.73,0,0,1-1.18-.54c-.31-.26-.36-.32-.73-.66S7.06,5.28,5.65,5.28A2.26,2.26,0,0,0,3.37,7.56,2.59,2.59,0,0,0,3.82,9a2.18,2.18,0,0,0,1.83.89,2.94,2.94,0,0,0,2.1-.81.11.11,0,0,0,0-.16L6.74,8A.11.11,0,0,0,6.6,8a1.58,1.58,0,0,1-.94.29h0A.71.71,0,0,1,5,7.56H5a.63.63,0,0,1,.65-.64c.71,0,1.42.75,1.94,1.27.75.76,1.66,1.79,3.11,1.74A2.28,2.28,0,0,0,13,7.64a2.59,2.59,0,0,0-.45-1.47A2.14,2.14,0,0,0,10.7,5.28Z\"\n }))))), div);\n }\n}//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiLi9zcmMvbW9kdWxlcy9wbHVnaW5DZXJ0aWZpZXIuanMuanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly9CZXR0ZXJEaXNjb3JkLy4vc3JjL21vZHVsZXMvcGx1Z2luQ2VydGlmaWVyLmpzPzQyODMiXSwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IG5vZGVGZXRjaCBmcm9tIFwibm9kZS1mZXRjaFwiO1xuaW1wb3J0ICogYXMgZWxlY3Ryb24gZnJvbSBcImVsZWN0cm9uXCI7XG5pbXBvcnQgKiBhcyBjcnlwdG8gZnJvbSBcImNyeXB0b1wiO1xuaW1wb3J0IEJEVjIgZnJvbSBcIi4vdjJcIjtc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ICAgICAgICAgICAgICAgICAgIGF0dGFjaG1lbnRzLmZvckVhY2goYXR0YWNobWVudCA9PiB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBwcm9jZXNzQXR0YWNobWVudChhdHRhY2htZW50KVxyXG4gICAgICAgICAgICAgICAgICAgICAgICB9KVxyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIH0pXHJcbiAgICAgICAgICAgIH0pXHJcbiAgICAgICAgfVxyXG4gICAgICAgIHJldHVybiByZXR1cm5WYWx1ZVxyXG4gICAgfVxyXG4gICAgICBjb25zdCBvcmlnaW5hbEZldGNoTWVzc2FnZXMyID0gZmV0Y2hNZXNzYWdlc01vZHVsZTIuZmV0Y2hNZXNzYWdlc1xyXG4gICAgZmV0Y2hNZXNzYWdlc01vZHVsZTIuZmV0Y2hNZXNzYWdlcyA9IGZ1bmN0aW9uKCl7XHJcbiAgICAgICAgY29uc3QgcmV0dXJuVmFsdWUgPSBvcmlnaW5hbEZldGNoTWVzc2FnZXMyLmFwcGx5KHRoaXMsIGFyZ3VtZW50cylcclxuICAgICAgICBpZihyZXR1cm5WYWx1ZSBpbnN0YW5jZW9mIFByb21pc2Upe1xyXG4gICAgICAgICAgICByZXR1cm5WYWx1ZVxyXG4gICAgICAgICAgICAudGhlbigoKSA9PiB7XHJcbiAgICAgICAgICAgICAgICBjb25zdCBldiA9IGdldE1lc3NhZ2VzTW9kdWxlLmdldE1lc3NhZ2VzKENoYW5uZWxNb2R1bGUuZ2V0Q2hhbm5lbElkKCkpXHJcbiAgICAgICAgICAgICAgICBwcm9jZXNzLm5leHRUaWNrKCgpID0+IHtcclxuICAgICAgICAgICAgICAgICAgICBmb3IoY29uc3QgbWVzc2FnZSBvZiBldi5fYXJyYXkpe1xyXG4gICAgICAgICAgICAgICAgICAgICAgICBjb25zdCBhdHRhY2htZW50cyA9IG1lc3NhZ2UuYXR0YWNobWVudHMgfHwgW11cclxuICAgICAgICAgICAgICAgICAgICAgICAgaWYoYXR0YWNobWVudHMubGVuZ3RoID09PSAwKWNvbnRpbnVlIC8vIG5vIGF0dGFjaG1lbnRzXHJcbiAgICAgICAgXHJcbiAgICAgICAgICAgICAgICAgICAgICAgIGF0dGFjaG1lbnRzLmZvckVhY2goYXR0YWNobWVudCA9PiB7XHJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBwcm9jZXNzQXR0YWNobWVudChhdHRhY2htZW50KVxyXG4gICAgICAgICAgICAgICAgICAgICAgICB9KVxyXG4gICAgICAgICAgICAgICAgICAgIH1cclxuICAgICAgICAgICAgICAgIH0pXHJcbiAgICAgICAgICAgIH0pXHJcbiAgICAgICAgfVxyXG4gICAgICAgIHJldHVybiByZXR1cm5WYWx1ZVxyXG4gICAgfVxyXG4gICAgICBjb25zdCBhbHJlYWR5VXNlZCA9IHt9XHJcbiAgICBjb25zdCBvcmlnaW5hbEdldFBpbm5lZE1lc3NhZ2VzID0gUGlubmVkTW9kdWxlLmdldFBpbm5lZE1lc3NhZ2VzLmJpbmQoUGlubmVkTW9kdWxlKVxyXG4gICAgUGlubmVkTW9kdWxlLmdldFBpbm5lZE1lc3NhZ2VzID0gZnVuY3Rpb24oKXtcclxuICAgICAgICBjb25zdCBwaW5uZWQgPSBvcmlnaW5hbEdldFBpbm5lZE1lc3NhZ2VzKC4uLmFyZ3VtZW50cylcclxuICAgICAgICBpZighcGlubmVkIHx8IGFscmVhZHlVc2VkW3Bpbm5lZC5pZF0pcmV0dXJuIHBpbm5lZFxyXG4gICAgICAgIGFscmVhZHlVc2VkW3Bpbm5lZC5pZF0gPSB0cnVlXHJcbiAgICAgICAgXHJcbiAgICAgICAgc2V0VGltZW91dCgoKSA9PiB7XHJcbiAgICAgICAgICAgIGRlbGV0ZSBhbHJlYWR5VXNlZFtwaW5uZWQuaWRdXHJcbiAgICAgICAgICAgIGZvcihjb25zdCBtZXNzYWdlIG9mIHBpbm5lZC5tZXNzYWdlcyl7XHJcbiAgICAgICAgICAgICAgICBjb25zdCBhdHRhY2htZW50cyA9IG1lc3NhZ2UuYXR0YWNobWVudHMgfHwgW11cclxuICAgICAgICAgICAgICAgIGlmKGF0dGFjaG1lbnRzLmxlbmd0aCA9PT0gMCljb250aW51ZSAvLyBubyBhdHRhY2htZW50c1xyXG4gICAgICAgICAgICAgICAgICAgICAgYXR0YWNobWVudHMuZm9yRWFjaChhdHRhY2htZW50ID0+IHtcclxuICAgICAgICAgICAgICAgICAgICBwcm9jZXNzQXR0YWNobWVudChhdHRhY2htZW50KVxyXG4gICAgICAgICAgICAgICAgfSlcclxuICAgICAgICAgICAgfVxyXG4gICAgICAgIH0sIDUwKTtcclxuICAgICAgICAgIHJldHVybiBwaW5uZWRcclxuICAgIH1cclxuICAgICAgZGlzcGF0Y2hlci5zdWJzY3JpYmUoY29uc3RhbnRzLkFjdGlvblR5cGVzLk1FU1NBR0VfQ1JFQVRFLCAoZXYpID0+IHtcclxuICAgICAgICBjb25zdCBtZXNzYWdlID0gZXYubWVzc2FnZVxyXG4gICAgICAgIGlmKG1lc3NhZ2UuY2hhbm5lbF9pZCAhPT0gQ2hhbm5lbE1vZHVsZS5nZXRDaGFubmVsSWQoKSlyZXR1cm5cclxuICAgICAgICBwcm9jZXNzLm5leHRUaWNrKCgpID0+IHtcclxuICAgICAgICAgICAgY29uc3QgYXR0YWNobWVudHMgPSBtZXNzYWdlLmF0dGFjaG1lbnRzIHx8IFtdXHJcbiAgICAgICAgICAgIGlmKGF0dGFjaG1lbnRzLmxlbmd0aCA9PT0gMClyZXR1cm4gLy8gbm8gYXR0YWNobWVudHNcclxuICAgICAgICAgICAgICBhdHRhY2htZW50cy5mb3JFYWNoKGF0dGFjaG1lbnQgPT4ge1xyXG4gICAgICAgICAgICAgICAgcHJvY2Vzc0F0dGFjaG1lbnQoYXR0YWNobWVudClcclxuICAgICAgICAgICAgfSlcclxuICAgICAgICB9KVxyXG4gICAgfSlcclxuICAgICAgY29uc3QgbWVzc2FnZXMgPSBnZXRNZXNzYWdlc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b25Nb2RhbChcIkFyZSB5b3Ugc3VyZSB5b3Ugd2FudCB0byBkb3dubG9hZCB0aGlzID9cIiwgXCJUaGUgXCIgKyByZXN1bHQudHlwZS50b0xvd2VyQ2FzZSgpICsgXCIgKipcIiArIGZpbGVuYW1lICsgXCIqKiBtaWdodCBiZSBkYW5nZXJvdXMgKiooXCIgKyByZXN1bHQuaGFybSArIFwiKSoqLiBcXG5cXG4qKldlIGRvbid0IHJlY29tbWFuZCB0byBkb3dubG9hZCBpdCoqLiBIb3dldmVyLCB5b3UgY2FuIHN0aWxsIGRvIGl0IGJlbG93LlwiLCB7XG4gICAgICAgICAgICAgICAgY29uZmlybVRleHQ6IFwiRG93bmxvYWQgQW55d2F5XCIsXG4gICAgICAgICAgICAgICAgY2FuY2VsVGV4dDogXCJEb24ndCAhXCIsXG4gICAgICAgICAgICAgICAgZGFuZ2VyOiB0cnVlLFxuICAgICAgICAgICAgICAgIG9uQ2FuY2VsOiAoKSA9PiB7fSxcbiAgICAgICAgICAgICAgICBvbkNvbmZpcm06ICgpID0+IHtcbiAgICAgICAgICAgICAgICAgIGVsZWN0cm9uLnJlbW90ZS5zaGVsbC5vcGVuRXh0ZXJuYWwoY2hpbGQuaHJlZik7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIH0pO1xuICAgICAgICAgIH0gZWxzZSBpZiAoW1wiZGl2XCJdLmluY2x1ZGVzKGNoaWxkLnRhZ05hbWUudG9Mb3dlckNhc2UoKSkpIHtcbiAgICAgICAgICAgIG5leHROb2RlKGNoaWxkKTtcbiAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgIH07XG5cbiAgICAgIG5leHROb2RlKGRpdi5wYXJlbnROb2RlKTtcbiAgICB9IGNhdGNoIChlKSB7XG4gICAgICBjb25zb2xlLmVycm9yKGUpO1xuICAgIH1cblxuICAgIEJEVjIucmVhY3REb20ucmVuZGVyKEJEVjIucmVhY3QuY3JlYXRlRWxlbWV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@@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _uti /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _0globals__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../0globals */ \"./src/0globals.js\");\n/* harmony import */ var _dataStore__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./dataStore */ \"./src/modules/dataStore.js\");\n/* harmony import */ var _settingsPanelSidebar__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./settingsPanelSidebar */ \"./src/modules/settingsPanelSidebar.js\");\n/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./utils */ \"./src/modules/utils.js\");\n/* harmony import */ var _v2__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./v2 */ \"./src/modules/v2.js\");\n/* harmony import */ var _contentManager__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./contentManager */ \"./src/modules/contentManager.js\");\n/* harmony import */ var _bdEvents__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./bdEvents */ \"./src/modules/bdEvents.js\");\n/* harmony import */ var _coloredText__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./coloredText */ \"./src/modules/coloredText.js\");\n/* harmony import */ var _24hour__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./24hour */ \"./src/modules/24hour.js\");\n/* harmony import */ var _reactDevTools__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./reactDevTools */ \"./src/modules/reactDevTools.js\");\n/* harmony import */ var _domtools__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./domtools */ \"./src/modules/domtools.js\");\n/* harmony import */ var _publicServers__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./publicServers */ \"./src/modules/publicServers.js\");\n/* harmony import */ var _voiceMode__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./voiceMode */ \"./src/modules/voiceMode.js\");\n/* harmony import */ var _classNormalizer__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./classNormalizer */ \"./src/modules/classNormalizer.js\");\n/* harmony import */ var _devMode__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./devMode */ \"./src/modules/devMode.js\");\n/* harmony import */ var _ui_tools__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../ui/tools */ \"./src/ui/tools.js\");\n/* harmony import */ var _ui_scroller__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ../ui/scroller */ \"./src/ui/scroller.js\");\n/* harmony import */ var _ui_sectionedSettingsPanel__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ../ui/sectionedSettingsPanel */ \"./src/ui/sectionedSettingsPanel.js\");\n/* harmony import */ var _ui_settingsPanel__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ../ui/settingsPanel */ \"./src/ui/settingsPanel.js\");\n/* harmony import */ var _ui_cssEditor__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ../ui/cssEditor */ \"./src/ui/cssEditor.js\");\n/* harmony import */ var _ui_addonlist__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ../ui/addonlist */ \"./src/ui/addonlist.jsx\");\n/* harmony import */ var _ui_presenceSettings__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ../ui/presenceSettings */ \"./src/ui/presenceSettings.jsx\");\n/* harmony import */ var _CustomRichPresence__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ./CustomRichPresence */ \"./src/modules/CustomRichPresence.js\");\n/* harmony import */ var _ui_AccountInfos__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ../ui/AccountInfos */ \"./src/ui/AccountInfos.jsx\");\n/* harmony import */ var electron__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! electron */ \"electron\");\n/* harmony import */ var electron__WEBPACK_IMPORTED_MODULE_24___default = /*#__PURE__*/__webpack_require__.n(electron__WEBPACK_IMPORTED_MODULE_24__);\n/* harmony import */ var _AntiAdDM__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(/*! ./AntiAdDM */ \"./src/modules/AntiAdDM.js\");\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (new class V2_SettingsPanel {\n constructor() {\n this.sideBarOnClick = this.sideBarOnClick.bind(this);\n this.onChange = this.onChange.bind(this);\n this.updateSettings = this.updateSettings.bind(this);\n this.sidebar = new _settingsPanelSidebar__WEBPACK_IMPORTED_MODULE_2__[\"default\"](this.sideBarOnClick); // this.buildPluginProps = this.buildPluginProps.bind(this);\n // this.buildThemeProps = this.buildThemeProps.bind(this);\n\n this.showOriginal = this.showOriginal.bind(this);\n }\n\n get root() {\n const _root = _domtools__WEBPACK_IMPORTED_MODULE_10__[\"default\"].query(\"#bd-settingspane-container\");\n\n if (!_root) {\n if (!this.injectRoot()) return null;\n return this.root;\n }\n\n return _root;\n }\n\n injectRoot() {\n let [classNameLayer, classSidebar] = [BDModules.get(e => e.layer && e.animating)[0].layer.split(\" \")[0], BDModules.get(e => e.standardSidebarView)[0]];\n const sidebar = _domtools__WEBPACK_IMPORTED_MODULE_10__[\"default\"].query(\".\" + classNameLayer + \" .\" + classSidebar.standardSidebarView.split(\" \")[0] + \", .\" + classNameLayer + \" .ui-standard-sidebar-view\");\n if (!sidebar) return false;\n const root = _domtools__WEBPACK_IMPORTED_MODULE_10__[\"default\"].createElement(`
`);\n sidebar.append(root);\n _utils__WEBPACK_IMPORTED_MODULE_3__[\"default\"].onRemoved(root, () => {\n _v2__WEBPACK_IMPORTED_MODULE_4__[\"default\"].reactDom.unmountComponentAtNode(root);\n });\n return true;\n }\n\n get coreSettings() {\n const settings = this.getSettings(\"core\");\n const categories = [...new Set(settings.map(s => s.category))];\n const sections = categories.map(c => {\n return {\n title: c,\n settings: settings.filter(s => s.category == c)\n };\n });\n return sections;\n }\n\n get lightcordSettings() {\n const settings = this.getSettings(\"lightcord\");\n const categories = [...new Set(settings.map(s => s.category))];\n const sections = categories.map(c => {\n return {\n title: c,\n settings: settings.filter(s => s.category == c)\n };\n });\n return sections;\n }\n\n get PresenceSettings() {\n return this.getSettings(\"status\");\n }\n\n get MsgLogSettings() {\n return this.getSettings(\"msglog\");\n }\n\n getSettings(category) {\n return Object.keys(_0globals__WEBPACK_IMPORTED_MODULE_0__[\"settings\"]).reduce((arr, key) => {\n const setting = _0globals__WEBPACK_IMPORTED_MODULE_0__[\"settings\"][key];\n\n if (setting.cat === category && setting.implemented && !setting.hidden) {\n setting.text = key;\n arr.push(setting);\n }\n\n return arr;\n }, []);\n }\n\n sideBarOnClick(id) {\n const contentRegion = _domtools__WEBPACK_IMPORTED_MODULE_10__[\"default\"].query(\".contentRegion-3nDuYy, .content-region\");\n contentRegion.style.display = \"none\";\n this.root.style.display = \"\";\n\n switch (id) {\n case \"core\":\n this.renderCoreSettings();\n break;\n\n case \"customcss\":\n this.renderCustomCssEditor();\n break;\n\n case \"plugins\":\n case \"themes\":\n this.renderAddonPane(id);\n break;\n\n case \"lightcord\":\n this.renderLightCordSettings();\n break;\n\n case \"status\":\n this.renderPresenceSettings();\n break;\n\n case \"accountinfo\":\n this.renderAccountInfos();\n break;\n }\n }\n\n onClick() {}\n\n onChange(id, checked) {\n this.updateSettings(id, checked);\n }\n\n updateSettings(id, enabled) {\n _0globals__WEBPACK_IMPORTED_MODULE_0__[\"settingsCookie\"][id] = enabled;\n\n if (id == \"bda-gs-2\") {\n if (enabled) _domtools__WEBPACK_IMPORTED_MODULE_10__[\"default\"].addClass(document.body, \"bd-minimal\");else _domtools__WEBPACK_IMPORTED_MODULE_10__[\"default\"].removeClass(document.body, \"bd-minimal\");\n }\n\n if (id == \"bda-gs-3\") {\n if (enabled) _domtools__WEBPACK_IMPORTED_MODULE_10__[\"default\"].addClass(document.body, \"bd-minimal-chan\");else _domtools__WEBPACK_IMPORTED_MODULE_10__[\"default\"].removeClass(document.body, \"bd-minimal-chan\");\n }\n\n if (id == \"bda-gs-1\") {\n if (enabled) _publicServers__WEBPACK_IMPORTED_MODULE_11__[\"default\"].addButton();else _publicServers__WEBPACK_IMPORTED_MODULE_11__[\"default\"].removeButton();\n }\n\n if (id == \"bda-gs-4\") {\n if (enabled) _voiceMode__WEBPACK_IMPORTED_MODULE_12__[\"default\"].start();else _voiceMode__WEBPACK_IMPORTED_MODULE_12__[\"default\"].stop();\n }\n\n if (id == \"bda-gs-5\") {\n if (enabled) _domtools__WEBPACK_IMPORTED_MODULE_10__[\"default\"].addClass(_domtools__WEBPACK_IMPORTED_MODULE_10__[\"default\"].query(\"#app-mount\"), \"bda-dark\");else _domtools__WEBPACK_IMPORTED_MODULE_10__[\"default\"].removeClass(_domtools__WEBPACK_IMPORTED_MODULE_10__[\"default\"].query(\"#app-mount\"), \"bda-dark\");\n }\n\n if (enabled && id == \"bda-gs-6\") _24hour__WEBPACK_IMPORTED_MODULE_8__[\"default\"].inject24Hour();\n\n if (id == \"bda-gs-7\") {\n if (enabled) _coloredText__WEBPACK_IMPORTED_MODULE_7__[\"default\"].injectColoredText();else _coloredText__WEBPACK_IMPORTED_MODULE_7__[\"default\"].removeColoredText();\n }\n\n if (id == \"fork-ps-4\") {\n if (enabled) _classNormalizer__WEBPACK_IMPORTED_MODULE_13__[\"default\"].start();else _classNormalizer__WEBPACK_IMPORTED_MODULE_13__[\"default\"].stop();\n }\n\n if (id == \"fork-ps-5\") {\n if (enabled) {\n _contentManager__WEBPACK_IMPORTED_MODULE_5__[\"default\"].watchContent(\"plugin\");\n _contentManager__WEBPACK_IMPORTED_MODULE_5__[\"default\"].watchContent(\"theme\");\n } else {\n _contentManager__WEBPACK_IMPORTED_MODULE_5__[\"default\"].unwatchContent(\"plugin\");\n _contentManager__WEBPACK_IMPORTED_MODULE_5__[\"default\"].unwatchContent(\"theme\");\n }\n }\n\n if (id == \"fork-wp-1\") {\n _utils__WEBPACK_IMPORTED_MODULE_3__[\"default\"].setWindowPreference(\"transparent\", enabled);\n if (enabled) _utils__WEBPACK_IMPORTED_MODULE_3__[\"default\"].setWindowPreference(\"backgroundColor\", null);else _utils__WEBPACK_IMPORTED_MODULE_3__[\"default\"].setWindowPreference(\"backgroundColor\", \"#2f3136\");\n }\n\n if (id == \"bda-gs-8\") {\n if (enabled) _devMode__WEBPACK_IMPORTED_MODULE_14__[\"default\"].startDebugListener();else _devMode__WEBPACK_IMPORTED_MODULE_14__[\"default\"].stopDebugListener();\n }\n\n if (id == \"fork-dm-1\") {\n if (enabled) _devMode__WEBPACK_IMPORTED_MODULE_14__[\"default\"].startCopySelector();else _devMode__WEBPACK_IMPORTED_MODULE_14__[\"default\"].stopCopySelector();\n }\n\n if (id === \"reactDevTools\") {\n if (enabled) _reactDevTools__WEBPACK_IMPORTED_MODULE_9__[\"default\"].start();else _reactDevTools__WEBPACK_IMPORTED_MODULE_9__[\"default\"].stop();\n }\n\n if (id === \"lightcord-1\") {\n if (enabled) window.Lightcord.Settings.devMode = true;else window.Lightcord.Settings.devMode = false;\n }\n\n if (id === \"lightcord-2\") {\n if (enabled) window.Lightcord.Settings.callRingingBeat = true;else window.Lightcord.Settings.callRingingBeat = false;\n }\n\n if (id === \"lightcord-presence-1\") {\n if (enabled) _CustomRichPresence__WEBPACK_IMPORTED_MODULE_22__[\"default\"].enable();else _CustomRichPresence__WEBPACK_IMPORTED_MODULE_22__[\"default\"].disable();\n }\n\n if (id === \"lightcord-3\") {\n if (enabled) electron__WEBPACK_IMPORTED_MODULE_24__[\"remote\"].getCurrentWindow().setAlwaysOnTop(true);else electron__WEBPACK_IMPORTED_MODULE_24__[\"remote\"].getCurrentWindow().setAlwaysOnTop(false);\n }\n\n if (id === \"lightcord-4\") {\n if (enabled) {\n _AntiAdDM__WEBPACK_IMPORTED_MODULE_25__[\"default\"].enable();\n } else {\n _AntiAdDM__WEBPACK_IMPORTED_MODULE_25__[\"default\"].disable();\n }\n }\n\n this.saveSettings();\n }\n\n async initializeSettings() {\n if (_0globals__WEBPACK_IMPORTED_MODULE_0__[\"settingsCookie\"].reactDevTools) _reactDevTools__WEBPACK_IMPORTED_MODULE_9__[\"default\"].start();\n if (_0globals__WEBPACK_IMPORTED_MODULE_0__[\"settingsCookie\"][\"bda-gs-2\"]) _domtools__WEBPACK_IMPORTED_MODULE_10__[\"default\"].addClass(document.body, \"bd-minimal\");\n if (_0globals__WEBPACK_IMPORTED_MODULE_0__[\"settingsCookie\"][\"bda-gs-3\"]) _domtools__WEBPACK_IMPORTED_MODULE_10__[\"default\"].addClass(document.body, \"bd-minimal-chan\");\n if (_0globals__WEBPACK_IMPORTED_MODULE_0__[\"settingsCookie\"][\"bda-gs-1\"]) _publicServers__WEBPACK_IMPORTED_MODULE_11__[\"default\"].addButton();\n if (_0globals__WEBPACK_IMPORTED_MODULE_0__[\"settingsCookie\"][\"bda-gs-4\"]) _voiceMode__WEBPACK_IMPORTED_MODULE_12__[\"default\"].start();\n if (_0globals__WEBPACK_IMPORTED_MODULE_0__[\"settingsCookie\"][\"bda-gs-5\"]) _domtools__WEBPACK_IMPORTED_MODULE_10__[\"default\"].addClass(_domtools__WEBPACK_IMPORTED_MODULE_10__[\"default\"].query(\"#app-mount\"), \"bda-dark\");\n if (_0globals__WEBPACK_IMPORTED_MODULE_0__[\"settingsCookie\"][\"bda-gs-6\"]) _24hour__WEBPACK_IMPORTED_MODULE_8__[\"default\"].inject24Hour();\n if (_0globals__WEBPACK_IMPORTED_MODULE_0__[\"settingsCookie\"][\"bda-gs-7\"]) _coloredText__WEBPACK_IMPORTED_MODULE_7__[\"default\"].injectColoredText();\n if (_0globals__WEBPACK_IMPORTED_MODULE_0__[\"settingsCookie\"][\"fork-ps-4\"]) _classNormalizer__WEBPACK_IMPORTED_MODULE_13__[\"default\"].start();\n if (_0globals__WEBPACK_IMPORTED_MODULE_0__[\"settingsCookie\"][\"lightcord-1\"]) window.Lightcord.Settings.devMode = true;\n if (_0globals__WEBPACK_IMPORTED_MODULE_0__[\"settingsCookie\"][\"lightcord-2\"]) window.Lightcord.Settings.callRingingBeat = true;\n if (_0globals__WEBPACK_IMPORTED_MODULE_0__[\"settingsCookie\"][\"lightcord-presence-1\"]) _CustomRichPresence__WEBPACK_IMPORTED_MODULE_22__[\"default\"].enable();\n if (_0globals__WEBPACK_IMPORTED_MODULE_0__[\"settingsCookie\"][\"lightcord-3\"]) electron__WEBPACK_IMPORTED_MODULE_24__[\"remote\"].getCurrentWindow().setAlwaysOnTop(true);\n if (_0globals__WEBPACK_IMPORTED_MODULE_0__[\"settingsCookie\"][\"lightcord-4\"]) _AntiAdDM__WEBPACK_IMPORTED_MODULE_25__[\"default\"].enable();\n\n if (_0globals__WEBPACK_IMPORTED_MODULE_0__[\"settingsCookie\"][\"fork-ps-5\"]) {\n _contentManager__WEBPACK_IMPORTED_MODULE_5__[\"default\"].watchContent(\"plugin\");\n _contentManager__WEBPACK_IMPORTED_MODULE_5__[\"default\"].watchContent(\"theme\");\n }\n\n if (_0globals__WEBPACK_IMPORTED_MODULE_0__[\"settingsCookie\"][\"bda-gs-8\"]) _devMode__WEBPACK_IMPORTED_MODULE_14__[\"default\"].startDebugListener();\n if (_0globals__WEBPACK_IMPORTED_MODULE_0__[\"settingsCookie\"][\"fork-dm-1\"]) _devMode__WEBPACK_IMPORTED_MODULE_14__[\"default\"].startCopySelector();\n this.saveSettings();\n }\n\n saveSettings() {\n _dataStore__WEBPACK_IMPORTED_MODULE_1__[\"default\"].setSettingGroup(\"settings\", _0globals__WEBPACK_IMPORTED_MODULE_0__[\"settingsCookie\"]);\n _dataStore__WEBPACK_IMPORTED_MODULE_1__[\"default\"].setSettingGroup(\"rpc\", _0globals__WEBPACK_IMPORTED_MODULE_0__[\"settingsRPC\"]);\n }\n\n loadSettings() {\n Object.assign(_0globals__WEBPACK_IMPORTED_MODULE_0__[\"settingsCookie\"], _dataStore__WEBPACK_IMPORTED_MODULE_1__[\"default\"].getSettingGroup(\"settings\"));\n Object.assign(_0globals__WEBPACK_IMPORTED_MODULE_0__[\"settingsRPC\"], _dataStore__WEBPACK_IMPORTED_MODULE_1__[\"default\"].getSettingGroup(\"rpc\"));\n }\n\n showOriginal() {\n _v2__WEBPACK_IMPORTED_MODULE_4__[\"default\"].reactDom.unmountComponentAtNode(this.root);\n this.root.style.display = \"none\";\n _domtools__WEBPACK_IMPORTED_MODULE_10__[\"default\"].query(\".\" + BDModules.get(e => e.contentRegion)[0].contentRegion.split(\" \")[0] + \", .content-region\").style.display = \"\";\n }\n\n renderSidebar() {\n const tabs = document.querySelectorAll(\"[class*='side-'] > [class*='item-']\");\n\n for (const element of tabs) {\n element.removeEventListener(\"click\", this.showOriginal);\n element.addEventListener(\"click\", this.showOriginal);\n }\n\n this.sidebar.render();\n }\n\n get coreComponent() {\n return _v2__WEBPACK_IMPORTED_MODULE_4__[\"default\"].react.createElement(_ui_scroller__WEBPACK_IMPORTED_MODULE_16__[\"default\"], {\n contentColumn: true,\n fade: true,\n dark: true\n }, _v2__WEBPACK_IMPORTED_MODULE_4__[\"default\"].react.createElement(_ui_sectionedSettingsPanel__WEBPACK_IMPORTED_MODULE_17__[\"default\"], {\n key: \"cspanel\",\n onChange: this.onChange,\n sections: this.coreSettings\n }), _v2__WEBPACK_IMPORTED_MODULE_4__[\"default\"].react.createElement(_ui_tools__WEBPACK_IMPORTED_MODULE_15__[\"default\"], {\n key: \"tools\"\n }));\n }\n\n get lightcordComponent() {\n return _v2__WEBPACK_IMPORTED_MODULE_4__[\"default\"].react.createElement(_ui_scroller__WEBPACK_IMPORTED_MODULE_16__[\"default\"], {\n contentColumn: true,\n fade: true,\n dark: true\n }, _v2__WEBPACK_IMPORTED_MODULE_4__[\"default\"].react.createElement(_ui_sectionedSettingsPanel__WEBPACK_IMPORTED_MODULE_17__[\"default\"], {\n key: \"lspannel\",\n onChange: this.onChange,\n sections: this.lightcordSettings\n }), _v2__WEBPACK_IMPORTED_MODULE_4__[\"default\"].react.createElement(_ui_tools__WEBPACK_IMPORTED_MODULE_15__[\"default\"], {\n key: \"tools\"\n }));\n }\n\n get PresenceComponent() {\n return _v2__WEBPACK_IMPORTED_MODULE_4__[\"default\"].react.createElement(_ui_scroller__WEBPACK_IMPORTED_MODULE_16__[\"default\"], {\n contentColumn: true,\n fade: true,\n dark: true\n }, _v2__WEBPACK_IMPORTED_MODULE_4__[\"default\"].react.createElement(_ui_presenceSettings__WEBPACK_IMPORTED_MODULE_21__[\"default\"], {\n key: \"lppannel\",\n onChange: this.onChange,\n settings: this.PresenceSettings\n }), _v2__WEBPACK_IMPORTED_MODULE_4__[\"default\"].react.createElement(_ui_tools__WEBPACK_IMPORTED_MODULE_15__[\"default\"], {\n key: \"tools\"\n }));\n }\n\n get AccountInfosComponent() {\n return _v2__WEBPACK_IMPORTED_MODULE_4__[\"default\"].react.createElement(_ui_scroller__WEBPACK_IMPORTED_MODULE_16__[\"default\"], {\n contentColumn: true,\n fade: true,\n dark: true\n }, _v2__WEBPACK_IMPORTED_MODULE_4__[\"default\"].react.createElement(_ui_AccountInfos__WEBPACK_IMPORTED_MODULE_23__[\"default\"], {\n key: \"lapannel\"\n }), _v2__WEBPACK_IMPORTED_MODULE_4__[\"default\"].react.createElement(_ui_tools__WEBPACK_IMPORTED_MODULE_15__[\"default\"], {\n key: \"tools\"\n }));\n }\n\n get customCssComponent() {\n return _v2__WEBPACK_IMPORTED_MODULE_4__[\"default\"].react.createElement(_ui_scroller__WEBPACK_IMPORTED_MODULE_16__[\"default\"], {\n contentColumn: true,\n fade: true,\n dark: true\n }, _v2__WEBPACK_IMPORTED_MODULE_4__[\"default\"].react.createElement(_ui_cssEditor__WEBPACK_IMPORTED_MODULE_19__[\"default\"], {\n key: \"csseditor\"\n }), _v2__WEBPACK_IMPORTED_MODULE_4__[\"default\"].react.createElement(_ui_tools__WEBPACK_IMPORTED_MODULE_15__[\"default\"], {\n key: \"tools\"\n }));\n }\n\n renderCoreSettings() {\n const root = this.root;\n if (!root) return _utils__WEBPACK_IMPORTED_MODULE_3__[\"default\"].err(\"SettingsPanel\", \"FAILED TO LOCATE ROOT: .layer-3QrUeG .standardSidebarView-3F1I7i\");\n _v2__WEBPACK_IMPORTED_MODULE_4__[\"default\"].reactDom.render(this.coreComponent, root);\n }\n\n renderLightCordSettings() {\n const root = this.root;\n if (!root) return _utils__WEBPACK_IMPORTED_MODULE_3__[\"default\"].err(\"SettingsPanel\", \"FAILED TO LOCATE ROOT: .layer-3QrUeG .standardSidebarView-3F1I7i\");\n _v2__WEBPACK_IMPORTED_MODULE_4__[\"default\"].reactDom.render(this.lightcordComponent, root);\n }\n\n renderPresenceSettings() {\n const root = this.root;\n if (!root) return _utils__WEBPACK_IMPORTED_MODULE_3__[\"default\"].err(\"SettingsPanel\", \"FAILED TO LOCATE ROOT: .layer-3QrUeG .standardSidebarView-3F1I7i\");\n _v2__WEBPACK_IMPORTED_MODULE_4__[\"default\"].reactDom.render(this.PresenceComponent, root);\n }\n\n renderAccountInfos() {\n const root = this.root;\n if (!root) return _utils__WEBPACK_IMPORTED_MODULE_3__[\"default\"].err(\"SettingsPanel\", \"FAILED TO LOCATE ROOT: .layer-3QrUeG .standardSidebarView-3F1I7i\");\n _v2__WEBPACK_IMPORTED_MODULE_4__[\"default\"].reactDom.render(this.AccountInfosComponent, root);\n }\n\n renderCustomCssEditor() {\n const root = this.root;\n if (!root) return _utils__WEBPACK_IMPORTED_MODULE_3__[\"default\"].err(\"SettingsPanel\", \"FAILED TO LOCATE ROOT: .layer-3QrUeG .standardSidebarView-3F1I7i\");\n _v2__WEBPACK_IMPORTED_MODULE_4__[\"default\"].reactDom.render(this.customCssComponent, root);\n } // renderAddonPane(type) {\n // const root = this.root;\n // if (!root) return Utils.err(\"SettingsPanel\", \"FAILED TO LOCATE ROOT: .layer-3QrUeG .standardSidebarView-3F1I7i\");\n // BDV2.reactDom.render(this.contentComponent(type), root);\n // }\n\n\n renderAddonPane(type) {\n if (!this.root) return _utils__WEBPACK_IMPORTED_MODULE_3__[\"default\"].err(\"SettingsPanel\", \"FAILED TO LOCATE ROOT: .layer-3QrUeG .standardSidebarView-3F1I7i\"); // I know this shouldn't be here, but when it isn't,\n // React refuses to change the button when going\n // between plugins and themes page... something\n // to debug later.\n\n class ContentList extends _v2__WEBPACK_IMPORTED_MODULE_4__[\"default\"].react.Component {\n constructor(props) {\n super(props);\n this.prefix = this.props.type.replace(\"s\", \"\");\n this.onChange = this.onChange.bind(this);\n }\n\n componentDidMount() {\n _bdEvents__WEBPACK_IMPORTED_MODULE_6__[\"default\"].on(`${this.prefix}-reloaded`, this.onChange);\n _bdEvents__WEBPACK_IMPORTED_MODULE_6__[\"default\"].on(`${this.prefix}-loaded`, this.onChange);\n _bdEvents__WEBPACK_IMPORTED_MODULE_6__[\"default\"].on(`${this.prefix}-unloaded`, this.onChange);\n }\n\n componentWillUnmount() {\n _bdEvents__WEBPACK_IMPORTED_MODULE_6__[\"default\"].off(`${this.prefix}-reloaded`, this.onChange);\n _bdEvents__WEBPACK_IMPORTED_MODULE_6__[\"default\"].off(`${this.prefix}-loaded`, this.onChange);\n _bdEvents__WEBPACK_IMPORTED_MODULE_6__[\"default\"].off(`${this.prefix}-unloaded`, this.onChange);\n }\n\n onChange() {\n this.props.onChange(this.props.type);\n }\n\n render() {\n return this.props.children;\n }\n\n }\n\n const list = type === \"plugins\" ? Object.values(_0globals__WEBPACK_IMPORTED_MODULE_0__[\"bdplugins\"]) : Object.values(_0globals__WEBPACK_IMPORTED_MODULE_0__[\"bdthemes\"]);\n return _v2__WEBPACK_IMPORTED_MODULE_4__[\"default\"].reactDom.render(_v2__WEBPACK_IMPORTED_MODULE_4__[\"default\"].react.createElement(ContentList, {\n type,\n onChange: this.sideBarOnClick\n }, _v2__WEBPACK_IMPORTED_MODULE_4__[\"default\"].react.createElement(_ui_addonlist__WEBPACK_IMPORTED_MODULE_20__[\"default\"], {\n type,\n list\n })), this.root);\n }\n\n}());//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiLi9zcmMvbW9kdWxlcy9zZXR0aW5nc1BhbmVsLmpzLmpzIiwic291cmNlcyI6WyJ3ZWJwYWNrOi8vQmV0dGVyRGlzY29yZC8uL3NyYy9tb2R1bGVzL3NldHRpbmdzUGFuZWwuanM/NTdiMCJdLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBzZXR0aW5ncywgc2V0dGluZ3NDb29raWUsIGJkcGx1Z2lucywgYmR0aGVtZXMsIHNldHRpbmdzUlBDIH0gZnJvbSBcIi4uLzBnbG9iYWxzXCI7XG5pbXBvcnQgRGF0YVN0b3JlIGZyb20gXCIuL2RhdGFTdG9yZVwiO1xuaW1wb3J0IFYyX1NldHRpbmdzUGFuZWxfU2lkZWJhciBmcm9tIFwiLi9zZXR0aW5nc1BhbmVsU2lkZWJhclwiO1xuaW1wb3J0IFV0aWxzIGZyb20gXCIuL3V0aWxzXCI7XG5pbXBvcnQgQkRWMiBmcm9tIFwiLi92MlwiO1xuaW1wb3J0IENvbnRlbnRNYW5hZ2VyIGZyb20gXCIuL2NvbnRlbnRNYW5hZ2VyXCI7XG5pbXBvcnQgQkRFdmVudHMgZnJvbSBcIi4vYmRFdmVudHNcIjtcbmltcG9ydCBjb2xvcmVkVGV4dCBmcm9tIFwiLi9jb2xvcmVkVGV4dFwiO1xuaW1wb3J0IHRmSG91ciBmcm9tIFwiLi8yNGhvdXJcIjtcbmltcG9ydCByZWFjdERldlRvb2xzIGZyb20gXCIuL3JlYWN0RGV2VG9vbHNcIjtcbmltcG9ydCBET00gZnJvbSBcIi4vZG9tdG9vbHNcIjtcbmltcG9ydCBwdWJsaWNTZXJ2ZXJzTW9kdWxlIGZyb20gXCIuL3B1YmxpY1NlcnZlcnNcIjtcbmltcG9ydCB2b2ljZU1vZGUgZnJvbSBcIi4vdm9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0=\n//# sourceURL=webpack-internal:///./src/modules/settingsPanel.js\n"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _0globals__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../0globals */ \"./src/0globals.js\");\n/* harmony import */ var _dataStore__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./dataStore */ \"./src/modules/dataStore.js\");\n/* harmony import */ var _settingsPanelSidebar__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./settingsPanelSidebar */ \"./src/modules/settingsPanelSidebar.js\");\n/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./utils */ \"./src/modules/utils.js\");\n/* harmony import */ var _v2__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./v2 */ \"./src/modules/v2.js\");\n/* harmony import */ var _contentManager__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./contentManager */ \"./src/modules/contentManager.js\");\n/* harmony import */ var _bdEvents__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./bdEvents */ \"./src/modules/bdEvents.js\");\n/* harmony import */ var _coloredText__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./coloredText */ \"./src/modules/coloredText.js\");\n/* harmony import */ var _24hour__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./24hour */ \"./src/modules/24hour.js\");\n/* harmony import */ var _reactDevTools__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./reactDevTools */ \"./src/modules/reactDevTools.js\");\n/* harmony import */ var _domtools__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./domtools */ \"./src/modules/domtools.js\");\n/* harmony import */ var _publicServers__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./publicServers */ \"./src/modules/publicServers.js\");\n/* harmony import */ var _voiceMode__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./voiceMode */ \"./src/modules/voiceMode.js\");\n/* harmony import */ var _classNormalizer__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./classNormalizer */ \"./src/modules/classNormalizer.js\");\n/* harmony import */ var _devMode__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./devMode */ \"./src/modules/devMode.js\");\n/* harmony import */ var _ui_tools__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../ui/tools */ \"./src/ui/tools.js\");\n/* harmony import */ var _ui_scroller__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ../ui/scroller */ \"./src/ui/scroller.js\");\n/* harmony import */ var _ui_sectionedSettingsPanel__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ../ui/sectionedSettingsPanel */ \"./src/ui/sectionedSettingsPanel.js\");\n/* harmony import */ var _ui_settingsPanel__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ../ui/settingsPanel */ \"./src/ui/settingsPanel.js\");\n/* harmony import */ var _ui_cssEditor__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ../ui/cssEditor */ \"./src/ui/cssEditor.js\");\n/* harmony import */ var _ui_addonlist__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ../ui/addonlist */ \"./src/ui/addonlist.jsx\");\n/* harmony import */ var _ui_presenceSettings__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ../ui/presenceSettings */ \"./src/ui/presenceSettings.jsx\");\n/* harmony import */ var _CustomRichPresence__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ./CustomRichPresence */ \"./src/modules/CustomRichPresence.js\");\n/* harmony import */ var _ui_AccountInfos__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ../ui/AccountInfos */ \"./src/ui/AccountInfos.jsx\");\n/* harmony import */ var electron__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! electron */ \"electron\");\n/* harmony import */ var electron__WEBPACK_IMPORTED_MODULE_24___default = /*#__PURE__*/__webpack_require__.n(electron__WEBPACK_IMPORTED_MODULE_24__);\n/* harmony import */ var _AntiAdDM__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(/*! ./AntiAdDM */ \"./src/modules/AntiAdDM.js\");\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (new class V2_SettingsPanel {\n constructor() {\n this.sideBarOnClick = this.sideBarOnClick.bind(this);\n this.onChange = this.onChange.bind(this);\n this.updateSettings = this.updateSettings.bind(this);\n this.sidebar = new _settingsPanelSidebar__WEBPACK_IMPORTED_MODULE_2__[\"default\"](this.sideBarOnClick); // this.buildPluginProps = this.buildPluginProps.bind(this);\n // this.buildThemeProps = this.buildThemeProps.bind(this);\n\n this.showOriginal = this.showOriginal.bind(this);\n }\n\n get root() {\n const _root = _domtools__WEBPACK_IMPORTED_MODULE_10__[\"default\"].query(\"#bd-settingspane-container\");\n\n if (!_root) {\n if (!this.injectRoot()) return null;\n return this.root;\n }\n\n return _root;\n }\n\n injectRoot() {\n let [classNameLayer, classSidebar] = [BDModules.get(e => e.layer && e.animating)[0].layer.split(\" \")[0], BDModules.get(e => e.standardSidebarView)[0]];\n const sidebar = _domtools__WEBPACK_IMPORTED_MODULE_10__[\"default\"].query(\".\" + classNameLayer + \" .\" + classSidebar.standardSidebarView.split(\" \")[0] + \", .\" + classNameLayer + \" .ui-standard-sidebar-view\");\n if (!sidebar) return false;\n const root = _domtools__WEBPACK_IMPORTED_MODULE_10__[\"default\"].createElement(`
`);\n sidebar.append(root);\n _utils__WEBPACK_IMPORTED_MODULE_3__[\"default\"].onRemoved(root, () => {\n _v2__WEBPACK_IMPORTED_MODULE_4__[\"default\"].reactDom.unmountComponentAtNode(root);\n });\n return true;\n }\n\n get coreSettings() {\n const settings = this.getSettings(\"core\");\n const categories = [...new Set(settings.map(s => s.category))];\n const sections = categories.map(c => {\n return {\n title: c,\n settings: settings.filter(s => s.category == c)\n };\n });\n return sections;\n }\n\n get lightcordSettings() {\n const settings = this.getSettings(\"lightcord\");\n const categories = [...new Set(settings.map(s => s.category))];\n const sections = categories.map(c => {\n return {\n title: c,\n settings: settings.filter(s => s.category == c)\n };\n });\n return sections;\n }\n\n get PresenceSettings() {\n return this.getSettings(\"status\");\n }\n\n get MsgLogSettings() {\n return this.getSettings(\"msglog\");\n }\n\n getSettings(category) {\n return Object.keys(_0globals__WEBPACK_IMPORTED_MODULE_0__[\"settings\"]).reduce((arr, key) => {\n const setting = _0globals__WEBPACK_IMPORTED_MODULE_0__[\"settings\"][key];\n\n if (setting.cat === category && setting.implemented && !setting.hidden) {\n setting.text = key;\n arr.push(setting);\n }\n\n return arr;\n }, []);\n }\n\n sideBarOnClick(id) {\n const contentRegion = _domtools__WEBPACK_IMPORTED_MODULE_10__[\"default\"].query(\".contentRegion-3nDuYy, .content-region\");\n contentRegion.style.display = \"none\";\n this.root.style.display = \"\";\n\n switch (id) {\n case \"core\":\n this.renderCoreSettings();\n break;\n\n case \"customcss\":\n this.renderCustomCssEditor();\n break;\n\n case \"plugins\":\n case \"themes\":\n this.renderAddonPane(id);\n break;\n\n case \"lightcord\":\n this.renderLightCordSettings();\n break;\n\n case \"status\":\n this.renderPresenceSettings();\n break;\n\n case \"accountinfo\":\n this.renderAccountInfos();\n break;\n }\n }\n\n onClick() {}\n\n onChange(id, checked) {\n this.updateSettings(id, checked);\n }\n\n updateSettings(id, enabled) {\n _0globals__WEBPACK_IMPORTED_MODULE_0__[\"settingsCookie\"][id] = enabled;\n\n if (id == \"bda-gs-2\") {\n if (enabled) _domtools__WEBPACK_IMPORTED_MODULE_10__[\"default\"].addClass(document.body, \"bd-minimal\");else _domtools__WEBPACK_IMPORTED_MODULE_10__[\"default\"].removeClass(document.body, \"bd-minimal\");\n }\n\n if (id == \"bda-gs-3\") {\n if (enabled) _domtools__WEBPACK_IMPORTED_MODULE_10__[\"default\"].addClass(document.body, \"bd-minimal-chan\");else _domtools__WEBPACK_IMPORTED_MODULE_10__[\"default\"].removeClass(document.body, \"bd-minimal-chan\");\n }\n\n if (id == \"bda-gs-1\") {\n if (enabled) _publicServers__WEBPACK_IMPORTED_MODULE_11__[\"default\"].addButton();else _publicServers__WEBPACK_IMPORTED_MODULE_11__[\"default\"].removeButton();\n }\n\n if (id == \"bda-gs-4\") {\n if (enabled) _voiceMode__WEBPACK_IMPORTED_MODULE_12__[\"default\"].start();else _voiceMode__WEBPACK_IMPORTED_MODULE_12__[\"default\"].stop();\n }\n\n if (id == \"bda-gs-5\") {\n if (enabled) _domtools__WEBPACK_IMPORTED_MODULE_10__[\"default\"].addClass(_domtools__WEBPACK_IMPORTED_MODULE_10__[\"default\"].query(\"#app-mount\"), \"bda-dark\");else _domtools__WEBPACK_IMPORTED_MODULE_10__[\"default\"].removeClass(_domtools__WEBPACK_IMPORTED_MODULE_10__[\"default\"].query(\"#app-mount\"), \"bda-dark\");\n }\n\n if (enabled && id == \"bda-gs-6\") _24hour__WEBPACK_IMPORTED_MODULE_8__[\"default\"].inject24Hour();\n\n if (id == \"bda-gs-7\") {\n if (enabled) _coloredText__WEBPACK_IMPORTED_MODULE_7__[\"default\"].injectColoredText();else _coloredText__WEBPACK_IMPORTED_MODULE_7__[\"default\"].removeColoredText();\n }\n\n if (id == \"fork-ps-4\") {\n if (enabled) _classNormalizer__WEBPACK_IMPORTED_MODULE_13__[\"default\"].start();else _classNormalizer__WEBPACK_IMPORTED_MODULE_13__[\"default\"].stop();\n }\n\n if (id == \"fork-ps-5\") {\n if (enabled) {\n _contentManager__WEBPACK_IMPORTED_MODULE_5__[\"default\"].watchContent(\"plugin\");\n _contentManager__WEBPACK_IMPORTED_MODULE_5__[\"default\"].watchContent(\"theme\");\n } else {\n _contentManager__WEBPACK_IMPORTED_MODULE_5__[\"default\"].unwatchContent(\"plugin\");\n _contentManager__WEBPACK_IMPORTED_MODULE_5__[\"default\"].unwatchContent(\"theme\");\n }\n }\n\n if (id == \"fork-wp-1\") {\n _utils__WEBPACK_IMPORTED_MODULE_3__[\"default\"].setWindowPreference(\"transparent\", enabled);\n if (enabled) _utils__WEBPACK_IMPORTED_MODULE_3__[\"default\"].setWindowPreference(\"backgroundColor\", null);else _utils__WEBPACK_IMPORTED_MODULE_3__[\"default\"].setWindowPreference(\"backgroundColor\", \"#2f3136\");\n }\n\n if (id == \"bda-gs-8\") {\n if (enabled) _devMode__WEBPACK_IMPORTED_MODULE_14__[\"default\"].startDebugListener();else _devMode__WEBPACK_IMPORTED_MODULE_14__[\"default\"].stopDebugListener();\n }\n\n if (id == \"fork-dm-1\") {\n if (enabled) _devMode__WEBPACK_IMPORTED_MODULE_14__[\"default\"].startCopySelector();else _devMode__WEBPACK_IMPORTED_MODULE_14__[\"default\"].stopCopySelector();\n }\n\n if (id === \"reactDevTools\") {\n if (enabled) _reactDevTools__WEBPACK_IMPORTED_MODULE_9__[\"default\"].start();else _reactDevTools__WEBPACK_IMPORTED_MODULE_9__[\"default\"].stop();\n }\n\n if (id === \"lightcord-1\") {\n if (enabled) window.Lightcord.Settings.devMode = true;else window.Lightcord.Settings.devMode = false;\n }\n\n if (id === \"lightcord-2\") {\n if (enabled) window.Lightcord.Settings.callRingingBeat = true;else window.Lightcord.Settings.callRingingBeat = false;\n }\n\n if (id === \"lightcord-presence-1\") {\n if (enabled) _CustomRichPresence__WEBPACK_IMPORTED_MODULE_22__[\"default\"].enable();else _CustomRichPresence__WEBPACK_IMPORTED_MODULE_22__[\"default\"].disable();\n }\n\n if (id === \"lightcord-3\") {\n if (enabled) electron__WEBPACK_IMPORTED_MODULE_24__[\"remote\"].getCurrentWindow().setAlwaysOnTop(true);else electron__WEBPACK_IMPORTED_MODULE_24__[\"remote\"].getCurrentWindow().setAlwaysOnTop(false);\n }\n\n if (id === \"lightcord-4\") {\n if (enabled) {\n _AntiAdDM__WEBPACK_IMPORTED_MODULE_25__[\"default\"].enable();\n } else {\n _AntiAdDM__WEBPACK_IMPORTED_MODULE_25__[\"default\"].disable();\n }\n }\n\n this.saveSettings();\n }\n\n async initializeSettings() {\n if (_0globals__WEBPACK_IMPORTED_MODULE_0__[\"settingsCookie\"].reactDevTools) _reactDevTools__WEBPACK_IMPORTED_MODULE_9__[\"default\"].start();\n if (_0globals__WEBPACK_IMPORTED_MODULE_0__[\"settingsCookie\"][\"bda-gs-2\"]) _domtools__WEBPACK_IMPORTED_MODULE_10__[\"default\"].addClass(document.body, \"bd-minimal\");\n if (_0globals__WEBPACK_IMPORTED_MODULE_0__[\"settingsCookie\"][\"bda-gs-3\"]) _domtools__WEBPACK_IMPORTED_MODULE_10__[\"default\"].addClass(document.body, \"bd-minimal-chan\");\n if (_0globals__WEBPACK_IMPORTED_MODULE_0__[\"settingsCookie\"][\"bda-gs-1\"]) _publicServers__WEBPACK_IMPORTED_MODULE_11__[\"default\"].addButton();\n if (_0globals__WEBPACK_IMPORTED_MODULE_0__[\"settingsCookie\"][\"bda-gs-4\"]) _voiceMode__WEBPACK_IMPORTED_MODULE_12__[\"default\"].start();\n if (_0globals__WEBPACK_IMPORTED_MODULE_0__[\"settingsCookie\"][\"bda-gs-5\"]) _domtools__WEBPACK_IMPORTED_MODULE_10__[\"default\"].addClass(_domtools__WEBPACK_IMPORTED_MODULE_10__[\"default\"].query(\"#app-mount\"), \"bda-dark\");\n if (_0globals__WEBPACK_IMPORTED_MODULE_0__[\"settingsCookie\"][\"bda-gs-6\"]) _24hour__WEBPACK_IMPORTED_MODULE_8__[\"default\"].inject24Hour();\n if (_0globals__WEBPACK_IMPORTED_MODULE_0__[\"settingsCookie\"][\"bda-gs-7\"]) _coloredText__WEBPACK_IMPORTED_MODULE_7__[\"default\"].injectColoredText();\n if (_0globals__WEBPACK_IMPORTED_MODULE_0__[\"settingsCookie\"][\"fork-ps-4\"]) _classNormalizer__WEBPACK_IMPORTED_MODULE_13__[\"default\"].start();\n if (_0globals__WEBPACK_IMPORTED_MODULE_0__[\"settingsCookie\"][\"lightcord-1\"]) window.Lightcord.Settings.devMode = true;\n if (_0globals__WEBPACK_IMPORTED_MODULE_0__[\"settingsCookie\"][\"lightcord-2\"]) window.Lightcord.Settings.callRingingBeat = true;\n if (_0globals__WEBPACK_IMPORTED_MODULE_0__[\"settingsCookie\"][\"lightcord-presence-1\"]) _CustomRichPresence__WEBPACK_IMPORTED_MODULE_22__[\"default\"].enable();\n if (_0globals__WEBPACK_IMPORTED_MODULE_0__[\"settingsCookie\"][\"lightcord-3\"]) electron__WEBPACK_IMPORTED_MODULE_24__[\"remote\"].getCurrentWindow().setAlwaysOnTop(true);\n if (_0globals__WEBPACK_IMPORTED_MODULE_0__[\"settingsCookie\"][\"lightcord-4\"]) _AntiAdDM__WEBPACK_IMPORTED_MODULE_25__[\"default\"].enable();\n\n if (_0globals__WEBPACK_IMPORTED_MODULE_0__[\"settingsCookie\"][\"fork-ps-5\"]) {\n _contentManager__WEBPACK_IMPORTED_MODULE_5__[\"default\"].watchContent(\"plugin\");\n _contentManager__WEBPACK_IMPORTED_MODULE_5__[\"default\"].watchContent(\"theme\");\n }\n\n if (_0globals__WEBPACK_IMPORTED_MODULE_0__[\"settingsCookie\"][\"bda-gs-8\"]) _devMode__WEBPACK_IMPORTED_MODULE_14__[\"default\"].startDebugListener();\n if (_0globals__WEBPACK_IMPORTED_MODULE_0__[\"settingsCookie\"][\"fork-dm-1\"]) _devMode__WEBPACK_IMPORTED_MODULE_14__[\"default\"].startCopySelector();\n this.saveSettings();\n }\n\n saveSettings() {\n _dataStore__WEBPACK_IMPORTED_MODULE_1__[\"default\"].setSettingGroup(\"settings\", _0globals__WEBPACK_IMPORTED_MODULE_0__[\"settingsCookie\"]);\n _dataStore__WEBPACK_IMPORTED_MODULE_1__[\"default\"].setSettingGroup(\"rpc\", _0globals__WEBPACK_IMPORTED_MODULE_0__[\"settingsRPC\"]);\n }\n\n loadSettings() {\n Object.assign(_0globals__WEBPACK_IMPORTED_MODULE_0__[\"settingsCookie\"], _dataStore__WEBPACK_IMPORTED_MODULE_1__[\"default\"].getSettingGroup(\"settings\"));\n Object.assign(_0globals__WEBPACK_IMPORTED_MODULE_0__[\"settingsRPC\"], _dataStore__WEBPACK_IMPORTED_MODULE_1__[\"default\"].getSettingGroup(\"rpc\"));\n }\n\n showOriginal() {\n _v2__WEBPACK_IMPORTED_MODULE_4__[\"default\"].reactDom.unmountComponentAtNode(this.root);\n this.root.style.display = \"none\";\n _domtools__WEBPACK_IMPORTED_MODULE_10__[\"default\"].query(\".\" + BDModules.get(e => e.contentRegion)[0].contentRegion.split(\" \")[0] + \", .content-region\").style.display = \"\";\n }\n\n renderSidebar() {\n const tabs = document.querySelectorAll(\"[class*='side-'] > [class*='item-']\");\n\n for (const element of tabs) {\n element.removeEventListener(\"click\", this.showOriginal);\n element.addEventListener(\"click\", this.showOriginal);\n }\n\n this.sidebar.render();\n }\n\n get coreComponent() {\n return _v2__WEBPACK_IMPORTED_MODULE_4__[\"default\"].react.createElement(_ui_scroller__WEBPACK_IMPORTED_MODULE_16__[\"default\"], {\n contentColumn: true,\n fade: true,\n dark: true\n }, _v2__WEBPACK_IMPORTED_MODULE_4__[\"default\"].react.createElement(_ui_sectionedSettingsPanel__WEBPACK_IMPORTED_MODULE_17__[\"default\"], {\n key: \"cspanel\",\n onChange: this.onChange,\n sections: this.coreSettings\n }), _v2__WEBPACK_IMPORTED_MODULE_4__[\"default\"].react.createElement(_ui_tools__WEBPACK_IMPORTED_MODULE_15__[\"default\"], {\n key: \"tools\"\n }));\n }\n\n get lightcordComponent() {\n return _v2__WEBPACK_IMPORTED_MODULE_4__[\"default\"].react.createElement(_ui_scroller__WEBPACK_IMPORTED_MODULE_16__[\"default\"], {\n contentColumn: true,\n fade: true,\n dark: true\n }, _v2__WEBPACK_IMPORTED_MODULE_4__[\"default\"].react.createElement(_ui_sectionedSettingsPanel__WEBPACK_IMPORTED_MODULE_17__[\"default\"], {\n key: \"lspannel\",\n onChange: this.onChange,\n sections: this.lightcordSettings\n }), _v2__WEBPACK_IMPORTED_MODULE_4__[\"default\"].react.createElement(_ui_tools__WEBPACK_IMPORTED_MODULE_15__[\"default\"], {\n key: \"tools\"\n }));\n }\n\n get PresenceComponent() {\n return _v2__WEBPACK_IMPORTED_MODULE_4__[\"default\"].react.createElement(_ui_scroller__WEBPACK_IMPORTED_MODULE_16__[\"default\"], {\n contentColumn: true,\n fade: true,\n dark: true\n }, _v2__WEBPACK_IMPORTED_MODULE_4__[\"default\"].react.createElement(_ui_presenceSettings__WEBPACK_IMPORTED_MODULE_21__[\"default\"], {\n key: \"lppannel\",\n onChange: this.onChange,\n settings: this.PresenceSettings\n }), _v2__WEBPACK_IMPORTED_MODULE_4__[\"default\"].react.createElement(_ui_tools__WEBPACK_IMPORTED_MODULE_15__[\"default\"], {\n key: \"tools\"\n }));\n }\n\n get AccountInfosComponent() {\n return _v2__WEBPACK_IMPORTED_MODULE_4__[\"default\"].react.createElement(_ui_scroller__WEBPACK_IMPORTED_MODULE_16__[\"default\"], {\n contentColumn: true,\n fade: true,\n dark: true\n }, _v2__WEBPACK_IMPORTED_MODULE_4__[\"default\"].react.createElement(_ui_AccountInfos__WEBPACK_IMPORTED_MODULE_23__[\"default\"], {\n key: \"lapannel\"\n }), _v2__WEBPACK_IMPORTED_MODULE_4__[\"default\"].react.createElement(_ui_tools__WEBPACK_IMPORTED_MODULE_15__[\"default\"], {\n key: \"tools\"\n }));\n }\n\n get customCssComponent() {\n return _v2__WEBPACK_IMPORTED_MODULE_4__[\"default\"].react.createElement(_ui_scroller__WEBPACK_IMPORTED_MODULE_16__[\"default\"], {\n contentColumn: true,\n fade: true,\n dark: true\n }, _v2__WEBPACK_IMPORTED_MODULE_4__[\"default\"].react.createElement(_ui_cssEditor__WEBPACK_IMPORTED_MODULE_19__[\"default\"], {\n key: \"csseditor\"\n }), _v2__WEBPACK_IMPORTED_MODULE_4__[\"default\"].react.createElement(_ui_tools__WEBPACK_IMPORTED_MODULE_15__[\"default\"], {\n key: \"tools\"\n }));\n }\n\n renderCoreSettings() {\n const root = this.root;\n if (!root) return _utils__WEBPACK_IMPORTED_MODULE_3__[\"default\"].err(\"SettingsPanel\", \"FAILED TO LOCATE ROOT: .layer-3QrUeG .standardSidebarView-3F1I7i\");\n _v2__WEBPACK_IMPORTED_MODULE_4__[\"default\"].reactDom.render(this.coreComponent, root);\n }\n\n renderLightCordSettings() {\n const root = this.root;\n if (!root) return _utils__WEBPACK_IMPORTED_MODULE_3__[\"default\"].err(\"SettingsPanel\", \"FAILED TO LOCATE ROOT: .layer-3QrUeG .standardSidebarView-3F1I7i\");\n _v2__WEBPACK_IMPORTED_MODULE_4__[\"default\"].reactDom.render(this.lightcordComponent, root);\n }\n\n renderPresenceSettings() {\n const root = this.root;\n if (!root) return _utils__WEBPACK_IMPORTED_MODULE_3__[\"default\"].err(\"SettingsPanel\", \"FAILED TO LOCATE ROOT: .layer-3QrUeG .standardSidebarView-3F1I7i\");\n _v2__WEBPACK_IMPORTED_MODULE_4__[\"default\"].reactDom.render(this.PresenceComponent, root);\n }\n\n renderAccountInfos() {\n const root = this.root;\n if (!root) return _utils__WEBPACK_IMPORTED_MODULE_3__[\"default\"].err(\"SettingsPanel\", \"FAILED TO LOCATE ROOT: .layer-3QrUeG .standardSidebarView-3F1I7i\");\n _v2__WEBPACK_IMPORTED_MODULE_4__[\"default\"].reactDom.render(this.AccountInfosComponent, root);\n }\n\n renderCustomCssEditor() {\n const root = this.root;\n if (!root) return _utils__WEBPACK_IMPORTED_MODULE_3__[\"default\"].err(\"SettingsPanel\", \"FAILED TO LOCATE ROOT: .layer-3QrUeG .standardSidebarView-3F1I7i\");\n _v2__WEBPACK_IMPORTED_MODULE_4__[\"default\"].reactDom.render(this.customCssComponent, root);\n } // renderAddonPane(type) {\n // const root = this.root;\n // if (!root) return Utils.err(\"SettingsPanel\", \"FAILED TO LOCATE ROOT: .layer-3QrUeG .standardSidebarView-3F1I7i\");\n // BDV2.reactDom.render(this.contentComponent(type), root);\n // }\n\n\n renderAddonPane(type) {\n if (!this.root) return _utils__WEBPACK_IMPORTED_MODULE_3__[\"default\"].err(\"SettingsPanel\", \"FAILED TO LOCATE ROOT: .layer-3QrUeG .standardSidebarView-3F1I7i\"); // I know this shouldn't be here, but when it isn't,\n // React refuses to change the button when going\n // between plugins and themes page... something\n // to debug later.\n\n class ContentList extends _v2__WEBPACK_IMPORTED_MODULE_4__[\"default\"].react.Component {\n constructor(props) {\n super(props);\n this.prefix = this.props.type.replace(\"s\", \"\");\n this.onChange = this.onChange.bind(this);\n }\n\n componentDidMount() {\n _bdEvents__WEBPACK_IMPORTED_MODULE_6__[\"default\"].on(`${this.prefix}-reloaded`, this.onChange);\n _bdEvents__WEBPACK_IMPORTED_MODULE_6__[\"default\"].on(`${this.prefix}-loaded`, this.onChange);\n _bdEvents__WEBPACK_IMPORTED_MODULE_6__[\"default\"].on(`${this.prefix}-unloaded`, this.onChange);\n }\n\n componentWillUnmount() {\n _bdEvents__WEBPACK_IMPORTED_MODULE_6__[\"default\"].off(`${this.prefix}-reloaded`, this.onChange);\n _bdEvents__WEBPACK_IMPORTED_MODULE_6__[\"default\"].off(`${this.prefix}-loaded`, this.onChange);\n _bdEvents__WEBPACK_IMPORTED_MODULE_6__[\"default\"].off(`${this.prefix}-unloaded`, this.onChange);\n }\n\n onChange() {\n this.props.onChange(this.props.type);\n }\n\n render() {\n return this.props.children;\n }\n\n }\n\n const originalRender = ContentList.prototype.render;\n Object.defineProperty(ContentList.prototype, \"render\", {\n enumerable: false,\n configurable: false,\n set: function () {\n console.warn(\"Addon policy for plugins #5 https://github.com/rauenzi/BetterDiscordApp/wiki/Addon-Policies#plugins\");\n },\n get: () => originalRender\n });\n const list = type === \"plugins\" ? Object.values(_0globals__WEBPACK_IMPORTED_MODULE_0__[\"bdplugins\"]) : Object.values(_0globals__WEBPACK_IMPORTED_MODULE_0__[\"bdthemes\"]);\n return _v2__WEBPACK_IMPORTED_MODULE_4__[\"default\"].reactDom.render(_v2__WEBPACK_IMPORTED_MODULE_4__[\"default\"].react.createElement(ContentList, {\n type,\n onChange: this.sideBarOnClick\n }, _v2__WEBPACK_IMPORTED_MODULE_4__[\"default\"].react.createElement(_ui_addonlist__WEBPACK_IMPORTED_MODULE_20__[\"default\"], {\n type,\n list\n })), this.root);\n }\n\n}());//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiLi9zcmMvbW9kdWxlcy9zZXR0aW5nc1BhbmVsLmpzLmpzIiwic291cmNlcyI6WyJ3ZWJwYWNrOi8vQmV0dGVyRGlzY29yZC8uL3NyYy9tb2R1bGVzL3NldHRpbmdzUGFuZWwuanM/NTdiMCJdLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBzZXR0aW5ncywgc2V0dGluZ3NDb29raWUsIGJkcGx1Z2lucywgYmR0aGVtZXMsIHNldHRpbmdzUlBDIH0gZnJvbSBcIi4uLzBnbG9iYWxzXCI7XG5pbXBvcnQgRGF0YVN0b3JlIGZyb20gXCIuL2RhdGFTdG9yZVwiO1xuaW1wb3J0IFYyX1NldHRpbmdzUGFuZWxfU2lkZWJhciBmcm9tIFwiLi9zZXR0aW5nc1BhbmVsU2lkZWJhclwiO1xuaW1wb3J0IFV0aWxzIGZyb20gXCIuL3V0aWxzXCI7XG5pbXBvcnQgQkRWMiBmcm9tIFwiLi92MlwiO1xuaW1wb3J0IENvbnRlbnRNYW5hZ2VyIGZyb20gXCIuL2NvbnRlbnRNYW5hZ2VyXCI7XG5pbXBvcnQgQkRFdmVudHMgZnJvbSBcIi4vYmRFdmVudHNcIjtcbmltcG9ydCBjb2xvcmVkVGV4dCBmcm9tIFwiLi9jb2xvcmVkVGV4dFwiO1xuaW1wb3J0IHRmSG91ciBmcm9tIFwiLi8yNGhvdXJcIjtcbmltcG9ydCByZWFjdERldlRvb2xzIGZyb20gXCIuL3JlYWN0RGV2VG9vbHNcIjtcbmltcG9ydCBET00gZnJvbSBcIi4vZG9tdG9vbHNcIjt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UFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBIiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///./src/modules/settingsPanel.js\n"); /***/ }), @@ -383,7 +383,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _0gl /***/ (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 Utils; });\n/* harmony import */ var _0globals__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../0globals */ \"./src/0globals.js\");\n/* harmony import */ var _webpackModules__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./webpackModules */ \"./src/modules/webpackModules.js\");\n/* harmony import */ var _v2__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./v2 */ \"./src/modules/v2.js\");\n/* harmony import */ var _domtools__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./domtools */ \"./src/modules/domtools.js\");\n\n\n\n\nclass Utils {\n /** Document/window width */\n static get screenWidth() {\n return Math.max(document.documentElement.clientWidth, window.innerWidth || 0);\n }\n /** Document/window height */\n\n\n static get screenHeight() {\n return Math.max(document.documentElement.clientHeight, window.innerHeight || 0);\n }\n\n static get WindowConfigFile() {\n return this._windowConfigFile = null;\n }\n\n static getAllWindowPreferences() {\n return {\n transparent: true,\n frame: false\n };\n }\n\n static getWindowPreference(key) {\n if (key === \"transparent\") return true;\n if (key === \"frame\") return false;\n return null;\n }\n\n static setWindowPreference(key, value) {\n if (key === \"transparent\") return true;\n if (key === \"frame\") return false;\n return null;\n }\n\n static stripBOM(content) {\n if (content.charCodeAt(0) === 0xFEFF) {\n content = content.slice(1);\n }\n\n return content;\n }\n\n static getTextArea() {\n return _domtools__WEBPACK_IMPORTED_MODULE_3__[\"default\"].query(\".\" + BDModules.get(e => e.channelTextArea && e.titleWrapper)[0].channelTextArea.split(\" \")[0] + \" textarea\");\n }\n\n static insertText(textarea, text) {\n textarea.focus();\n textarea.selectionStart = 0;\n textarea.selectionEnd = textarea.value.length;\n document.execCommand(\"insertText\", false, text);\n }\n\n static escapeID(id) {\n return id.replace(/^[^a-z]+|[^\\w-]+/gi, \"-\");\n }\n\n static log(moduleName, message) {\n console.log(`%c[BandagedBD]%c [${moduleName}]%c ${message}`, \"color: #3a71c1; font-weight: 700;\", \"color: #3a71c1;\", \"\");\n }\n\n static warn(moduleName, message) {\n console.warn(`%c[BandagedBD]%c [${moduleName}]%c ${message}`, \"color: #E8A400; font-weight: 700;\", \"color: #E8A400;\", \"\");\n }\n\n static err(moduleName, message, error) {\n console.log(`%c[BandagedBD]%c [${moduleName}]%c ${message}`, \"color: red; font-weight: 700;\", \"color: red;\", \"\");\n\n if (error) {\n console.groupCollapsed(\"%cError: \" + error.message, \"color: red;\");\n console.error(error.stack);\n console.groupEnd();\n }\n }\n\n static escape(s) {\n return s.replace(/[-/\\\\^$*+?.()|[\\]{}]/g, \"\\\\$&\");\n }\n\n static testJSON(data) {\n try {\n return JSON.parse(data);\n } catch (err) {\n return false;\n }\n }\n\n static isEmpty(obj) {\n if (obj == null || obj == undefined || obj == \"\") return true;\n if (typeof obj !== \"object\") return false;\n if (Array.isArray(obj)) return obj.length == 0;\n\n for (const key in obj) {\n if (obj.hasOwnProperty(key)) return false;\n }\n\n return true;\n }\n\n static suppressErrors(method, message) {\n return (...params) => {\n try {\n return method(...params);\n } catch (e) {\n this.err(\"SuppressedError\", \"Error occurred in \" + message, e);\n }\n };\n }\n\n static monkeyPatch(what, methodName, options) {\n const {\n before,\n after,\n instead,\n once = false,\n silent = false,\n force = false\n } = options;\n const displayName = options.displayName || what.displayName || what[methodName].displayName || what.name || what.constructor.displayName || what.constructor.name;\n if (!silent) console.log(\"patch\", methodName, \"of\", displayName); // eslint-disable-line no-console\n\n if (!what[methodName]) {\n if (force) what[methodName] = function () {};else return console.error(methodName, \"does not exist for\", displayName); // eslint-disable-line no-console\n }\n\n const origMethod = what[methodName];\n\n const cancel = () => {\n if (!silent) console.log(\"unpatch\", methodName, \"of\", displayName); // eslint-disable-line no-console\n\n what[methodName] = origMethod;\n };\n\n what[methodName] = function () {\n const data = {\n thisObject: this,\n methodArguments: arguments,\n cancelPatch: cancel,\n originalMethod: origMethod,\n callOriginalMethod: () => data.returnValue = data.originalMethod.apply(data.thisObject, data.methodArguments)\n };\n\n if (instead) {\n const tempRet = Utils.suppressErrors(instead, \"`instead` callback of \" + what[methodName].displayName)(data);\n if (tempRet !== undefined) data.returnValue = tempRet;\n } else {\n if (before) Utils.suppressErrors(before, \"`before` callback of \" + what[methodName].displayName)(data);\n data.callOriginalMethod();\n if (after) Utils.suppressErrors(after, \"`after` callback of \" + what[methodName].displayName)(data);\n }\n\n if (once) cancel();\n return data.returnValue;\n };\n\n Object.assign(what[methodName], origMethod);\n what[methodName].__monkeyPatched = true;\n what[methodName].displayName = displayName;\n\n if (!what[methodName].__originalMethod) {\n what[methodName].__originalMethod = origMethod;\n\n what[methodName].toString = function () {\n return origMethod.toString();\n };\n }\n\n return cancel;\n }\n\n static onRemoved(node, callback) {\n const observer = new MutationObserver(mutations => {\n for (let m = 0; m < mutations.length; m++) {\n const mutation = mutations[m];\n const nodes = Array.from(mutation.removedNodes);\n const directMatch = nodes.indexOf(node) > -1;\n const parentMatch = nodes.some(parent => parent.contains(node));\n\n if (directMatch || parentMatch) {\n observer.disconnect();\n callback();\n }\n }\n });\n observer.observe(document.body, {\n subtree: true,\n childList: true\n });\n }\n\n static getNestedProp(obj, path) {\n return path.split(/\\s?\\.\\s?/).reduce(function (obj, prop) {\n return obj && obj[prop];\n }, obj);\n }\n /**\r\n * This shows a toast similar to android towards the bottom of the screen.\r\n *\r\n * @param {string} content The string to show in the toast.\r\n * @param {object} options Options object. Optional parameter.\r\n * @param {string} options.type Changes the type of the toast stylistically and semantically. Choices: \"\", \"info\", \"success\", \"danger\"/\"error\", \"warning\"/\"warn\". Default: \"\"\r\n * @param {boolean} options.icon Determines whether the icon should show corresponding to the type. A toast without type will always have no icon. Default: true\r\n * @param {number} options.timeout Adjusts the time (in ms) the toast should be shown for before disappearing automatically. Default: 3000\r\n */\n\n\n static showToast(content, options = {}) {\n if (!document.querySelector(\".bd-toasts\")) {\n const container = document.querySelector(\".\" + BDModules.get(e => e.sidebar && e.hasNotice)[0].sidebar.split(\" \")[9] + \" + div\") || null;\n const memberlist = container ? container.querySelector(\".\" + BDModules.get(e => e.membersWrap)[0].membersWrap) : null;\n const form = container ? container.querySelector(\"form\") : null;\n const left = container ? container.getBoundingClientRect().left : 310;\n const right = memberlist ? memberlist.getBoundingClientRect().left : 0;\n const width = right ? right - container.getBoundingClientRect().left : Utils.screenWidth - left - 240;\n const bottom = form ? form.offsetHeight : 80;\n const toastWrapper = document.createElement(\"div\");\n toastWrapper.classList.add(\"bd-toasts\");\n toastWrapper.style.setProperty(\"left\", left + \"px\");\n toastWrapper.style.setProperty(\"width\", width + \"px\");\n toastWrapper.style.setProperty(\"bottom\", bottom + \"px\");\n document.querySelector(\"#app-mount\").appendChild(toastWrapper);\n }\n\n const {\n type = \"\",\n icon = true,\n timeout = 3000\n } = options;\n const toastElem = document.createElement(\"div\");\n toastElem.classList.add(\"bd-toast\");\n if (type) toastElem.classList.add(\"toast-\" + type);\n if (type && icon) toastElem.classList.add(\"icon\");\n toastElem.innerText = content;\n document.querySelector(\".bd-toasts\").appendChild(toastElem);\n setTimeout(() => {\n toastElem.classList.add(\"closing\");\n setTimeout(() => {\n toastElem.remove();\n if (!document.querySelectorAll(\".bd-toasts .bd-toast\").length) document.querySelector(\".bd-toasts\").remove();\n }, 300);\n }, timeout);\n }\n\n static alert(title, content) {\n let modalModule = BDModules.get(e => e.modal && e.inner && !e.hideOnFullscreen)[0];\n let headerModule = BDModules.get(e => e.header && e.responsiveWidthMobile && e.hideOnFullscreen)[0];\n let footer2Module = BDModules.get(e => e.header && e.responsiveWidthMobile && e.focusLock)[0];\n const modal = _domtools__WEBPACK_IMPORTED_MODULE_3__[\"default\"].createElement(`
\n
e.backdrop && e.backdropWithLayer)[0].backdrop}\">
\n
\n
\n
\n
${title}
\n
\n
\n
\n
\n ${content}\n
\n
\n
\n
\n \n
\n
\n
\n
`);\n modal.querySelector(\".footer button\").addEventListener(\"click\", () => {\n _domtools__WEBPACK_IMPORTED_MODULE_3__[\"default\"].addClass(modal, \"closing\");\n setTimeout(() => {\n modal.remove();\n closingListeners.forEach(listener => {\n try {\n listener();\n } catch (e) {\n console.error(e);\n }\n });\n }, 300);\n });\n modal.querySelector(\".bd-backdrop\").addEventListener(\"click\", () => {\n _domtools__WEBPACK_IMPORTED_MODULE_3__[\"default\"].addClass(modal, \"closing\");\n setTimeout(() => {\n modal.remove();\n closingListeners.forEach(listener => {\n try {\n listener();\n } catch (e) {\n console.error(e);\n }\n });\n }, 300);\n });\n _domtools__WEBPACK_IMPORTED_MODULE_3__[\"default\"].query(\"#app-mount\").append(modal);\n const closingListeners = [];\n return {\n close: () => {\n _domtools__WEBPACK_IMPORTED_MODULE_3__[\"default\"].addClass(modal, \"closing\");\n setTimeout(() => {\n modal.remove();\n closingListeners.forEach(listener => {\n try {\n listener();\n } catch (e) {\n console.error(e);\n }\n });\n }, 300);\n },\n onClose: listener => {\n closingListeners.push(listener);\n }\n };\n }\n\n static showContentErrors({\n plugins: pluginErrors = [],\n themes: themeErrors = []\n }) {\n if (!pluginErrors || !themeErrors) return;\n if (!pluginErrors.length && !themeErrors.length) return;\n let modalModule = BDModules.get(e => e.modal && e.inner && !e.hideOnFullscreen)[0];\n let headerModule = BDModules.get(e => e.header && e.responsiveWidthMobile && e.hideOnFullscreen)[0];\n let footer2Module = BDModules.get(e => e.header && e.responsiveWidthMobile && e.focusLock)[0];\n const modal = _domtools__WEBPACK_IMPORTED_MODULE_3__[\"default\"].createElement(`
\n
e.backdrop && e.backdropWithLayer)[0].backdrop}\">
\n
\n
\n
Content Errors
\n
\n
\n
\n
Plugins
\n
Themes
\n
\n
\n
\n
Name
\n
Message
\n
Error
\n
\n
\n
\n \n
\n
\n
\n
\n \n
\n
\n
\n
`);\n\n function generateTab(errors) {\n const container = _domtools__WEBPACK_IMPORTED_MODULE_3__[\"default\"].createElement(`
`);\n\n for (const err of errors) {\n const error = _domtools__WEBPACK_IMPORTED_MODULE_3__[\"default\"].createElement(`
\n
${err.name ? err.name : err.file}
\n
${err.message}
\n \n
`);\n container.append(error);\n\n if (err.error) {\n error.querySelectorAll(\"a\").forEach(el => el.addEventListener(\"click\", e => {\n e.preventDefault();\n Utils.err(\"ContentManager\", `Error details for ${err.name ? err.name : err.file}.`, err.error);\n }));\n }\n }\n\n return container;\n }\n\n const tabs = [generateTab(pluginErrors), generateTab(themeErrors)];\n modal.querySelectorAll(\".tab-bar-item\").forEach(el => el.addEventListener(\"click\", e => {\n e.preventDefault();\n const selected = modal.querySelector(\".tab-bar-item.selected\");\n if (selected) _domtools__WEBPACK_IMPORTED_MODULE_3__[\"default\"].removeClass(selected, \"selected\");\n _domtools__WEBPACK_IMPORTED_MODULE_3__[\"default\"].addClass(e.target, \"selected\");\n const scroller = modal.querySelector(\".scroller\");\n scroller.innerHTML = \"\";\n scroller.append(tabs[_domtools__WEBPACK_IMPORTED_MODULE_3__[\"default\"].index(e.target)]);\n }));\n modal.querySelector(\".footer button\").addEventListener(\"click\", () => {\n _domtools__WEBPACK_IMPORTED_MODULE_3__[\"default\"].addClass(modal, \"closing\");\n setTimeout(() => {\n modal.remove();\n }, 300);\n });\n modal.querySelector(\".bd-backdrop\").addEventListener(\"click\", () => {\n _domtools__WEBPACK_IMPORTED_MODULE_3__[\"default\"].addClass(modal, \"closing\");\n setTimeout(() => {\n modal.remove();\n }, 300);\n });\n _domtools__WEBPACK_IMPORTED_MODULE_3__[\"default\"].query(\"#app-mount\").append(modal);\n if (pluginErrors.length) modal.querySelector(\".tab-bar-item\").click();else modal.querySelectorAll(\".tab-bar-item\")[1].click();\n }\n\n static showChangelogModal(options = {}) {\n const ModalStack = _webpackModules__WEBPACK_IMPORTED_MODULE_1__[\"default\"].findByProps(\"push\", \"update\", \"pop\", \"popWithKey\");\n const ChangelogClasses = _webpackModules__WEBPACK_IMPORTED_MODULE_1__[\"default\"].findByProps(\"fixed\", \"improved\");\n const TextElement = _webpackModules__WEBPACK_IMPORTED_MODULE_1__[\"default\"].findByDisplayName(\"Text\");\n const FlexChild = _webpackModules__WEBPACK_IMPORTED_MODULE_1__[\"default\"].findByProps(\"Child\");\n const Titles = _webpackModules__WEBPACK_IMPORTED_MODULE_1__[\"default\"].findByProps(\"Tags\", \"default\");\n const Changelog = _webpackModules__WEBPACK_IMPORTED_MODULE_1__[\"default\"].find(m => m.defaultProps && m.defaultProps.selectable == false);\n const MarkdownParser = _webpackModules__WEBPACK_IMPORTED_MODULE_1__[\"default\"].findByProps(\"defaultRules\", \"parse\");\n if (!Changelog || !ModalStack || !ChangelogClasses || !TextElement || !FlexChild || !Titles || !MarkdownParser) return;\n const {\n image = \"https://repository-images.githubusercontent.com/105473537/957b5480-7c26-11e9-8401-50fa820cbae5\",\n description = \"\",\n changes = [],\n title = \"BandagedBD\",\n subtitle = `v${_0globals__WEBPACK_IMPORTED_MODULE_0__[\"bbdVersion\"]}`,\n footer\n } = options;\n const ce = _v2__WEBPACK_IMPORTED_MODULE_2__[\"default\"].React.createElement;\n const changelogItems = [ce(\"img\", {\n src: image\n })];\n if (description) changelogItems.push(ce(\"p\", null, MarkdownParser.parse(description)));\n\n for (let c = 0; c < changes.length; c++) {\n const entry = changes[c];\n const type = ChangelogClasses[entry.type] ? ChangelogClasses[entry.type] : ChangelogClasses.added;\n const margin = c == 0 ? ChangelogClasses.marginTop : \"\";\n changelogItems.push(ce(\"h1\", {\n className: `${type} ${margin}`\n }, entry.title));\n const list = ce(\"ul\", null, entry.items.map(i => ce(\"li\", null, MarkdownParser.parse(i))));\n changelogItems.push(list);\n }\n\n const renderHeader = function () {\n return ce(FlexChild.Child, {\n grow: 1,\n shrink: 1\n }, ce(Titles.default, {\n tag: Titles.Tags.H4\n }, title), ce(TextElement, {\n size: TextElement.Sizes.SMALL,\n color: TextElement.Colors.STANDARD,\n className: ChangelogClasses.date\n }, subtitle));\n };\n\n const renderFooter = () => {\n const Anchor = _webpackModules__WEBPACK_IMPORTED_MODULE_1__[\"default\"].find(m => m.displayName == \"Anchor\");\n const AnchorClasses = _webpackModules__WEBPACK_IMPORTED_MODULE_1__[\"default\"].findByProps(\"anchorUnderlineOnHover\") || {\n anchor: \"anchor-3Z-8Bb\",\n anchorUnderlineOnHover: \"anchorUnderlineOnHover-2ESHQB\"\n };\n\n const joinSupportServer = click => {\n click.preventDefault();\n click.stopPropagation();\n ModalStack.pop();\n _v2__WEBPACK_IMPORTED_MODULE_2__[\"default\"].joinBD2();\n };\n\n const supportLink = Anchor ? ce(Anchor, {\n onClick: joinSupportServer\n }, \"Join our Discord Server.\") : ce(\"a\", {\n className: `${AnchorClasses.anchor} ${AnchorClasses.anchorUnderlineOnHover}`,\n onClick: joinSupportServer\n }, \"Join our Discord Server.\");\n const defaultFooter = ce(TextElement, {\n size: TextElement.Sizes.SMALL,\n color: TextElement.Colors.STANDARD\n }, \"Need support? \", supportLink);\n return ce(FlexChild.Child, {\n grow: 1,\n shrink: 1\n }, footer ? footer : defaultFooter);\n };\n\n return ModalStack.push(function (props) {\n return ce(Changelog, Object.assign({\n className: ChangelogClasses.container,\n selectable: true,\n onScroll: _ => _,\n onClose: _ => _,\n renderHeader: renderHeader,\n renderFooter: renderFooter,\n children: changelogItems\n }, props));\n });\n }\n /**\r\n * Shows a generic but very customizable confirmation modal with optional confirm and cancel callbacks.\r\n * @param {string} title - title of the modal\r\n * @param {(string|ReactElement|Array)} children - a single or mixed array of react elements and strings. Every string is wrapped in Discord's `Markdown` component so strings will show and render properly.\r\n * @param {object} [options] - options to modify the modal\r\n * @param {boolean} [options.danger=false] - whether the main button should be red or not\r\n * @param {string} [options.confirmText=Okay] - text for the confirmation/submit button\r\n * @param {string} [options.cancelText=Cancel] - text for the cancel button\r\n * @param {callable} [options.onConfirm=NOOP] - callback to occur when clicking the submit button\r\n * @param {callable} [options.onCancel=NOOP] - callback to occur when clicking the cancel button\r\n * @param {string} [options.key] - key used to identify the modal. If not provided, one is generated and returned\r\n * @returns {string} - the key used for this modal\r\n */\n\n\n static showConfirmationModal(title, content, options = {}) {\n const ModalStack = _webpackModules__WEBPACK_IMPORTED_MODULE_1__[\"default\"].findByProps(\"push\", \"update\", \"pop\", \"popWithKey\");\n const Markdown = _webpackModules__WEBPACK_IMPORTED_MODULE_1__[\"default\"].findByDisplayName(\"Markdown\");\n const ConfirmationModal = _webpackModules__WEBPACK_IMPORTED_MODULE_1__[\"default\"].find(m => m.defaultProps && m.key && m.key() == \"confirm-modal\");\n if (!ModalStack || !ConfirmationModal || !Markdown) return Utils.alert(title, content);\n\n const emptyFunction = () => {};\n\n const {\n onConfirm = emptyFunction,\n onCancel = emptyFunction,\n confirmText = \"Okay\",\n cancelText = \"Cancel\",\n danger = false,\n key = undefined\n } = options;\n if (!Array.isArray(content)) content = [content];\n content = content.map(c => typeof c === \"string\" ? _v2__WEBPACK_IMPORTED_MODULE_2__[\"default\"].React.createElement(Markdown, null, c) : c);\n return ModalStack.push(ConfirmationModal, {\n header: title,\n children: content,\n red: danger,\n confirmText: confirmText,\n cancelText: cancelText,\n onConfirm: onConfirm,\n onCancel: onCancel\n }, key);\n }\n\n}\nUtils.showToast = Utils.suppressErrors(Utils.showToast, \"Could not show toast.\");//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiLi9zcmMvbW9kdWxlcy91dGlscy5qcy5qcyIsInNvdXJjZXMiOlsid2VicGFjazovL0JldHRlckRpc2NvcmQvLi9zcmMvbW9kdWxlcy91dGlscy5qcz9jMGY3Il0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IGJiZFZlcnNpb24sIHNldHRpbmdzQ29va2llIH0gZnJvbSBcIi4uLzBnbG9iYWxzXCI7XG5pbXBvcnQgV2VicGFja01vZHVsZXMgZnJvbSBcIi4vd2VicGFja01vZHVsZXNcIjtcbmltcG9ydCBCRFYyIGZyb20gXCIuL3YyXCI7XG5pbXBvcnQgRE9NIGZyb20gXCIuL2RvbXRvb2xzXCI7XG5leHBvcnQgZGVmYXVsdCBjbGFzcyBVdGlscyB7XG4gIC8qKiBEb2N1bWVudC93aW5kb3cgd2lkdGggKi9cbiAgc3RhdGljIGdldCBzY3JlZW5XaWR0aCgpIHtcbiAgICByZXR1cm4gTWF0aC5tYXgoZG9jdW1lbnQuZG9jdW1lbnRFbGVtZW50LmNsaWVudFdpZHRoLCB3aW5kb3cuaW5uZXJXaWR0aCB8fCAwKTtcbiAgfVxuICAvKiogRG9jdW1lbnQvd2luZG93IGhlaWdodCAqL1xuXG5cbiAgc3RhdGljIGd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YWRlck1vZHVsZS5oZWFkZXJ9XCI+XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA8ZGl2IGNsYXNzPVwidGl0bGVcIj4ke3RpdGxlfTwvZGl2PlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA8L2Rpdj5cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPGRpdiBjbGFzcz1cImJkLW1vZGFsLWJvZHlcIj5cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDxkaXYgY2xhc3M9XCJzY3JvbGxlci13cmFwIGZhZGVcIj5cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA8ZGl2IGNsYXNzPVwic2Nyb2xsZXJcIj5cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJHtjb250ZW50fVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDwvZGl2PlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPC9kaXY+XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDwvZGl2PlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA8ZGl2IGNsYXNzPVwiZm9vdGVyICR7aGVhZGVyTW9kdWxlLmZvb3Rlcn0gJHtmb290ZXIyTW9kdWxlLmZvb3Rlcn1cIj5cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDxidXR0b24gdHlwZT1cImJ1dHRvblwiPk9rYXk8L2J1dHRvbj5cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPC9kaXY+XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgPC9kaXY+XG4gICAgICAgICAgICAgICAgICAgICAgICA8L2Rpdj5cbiAgICAgICAgICAgICAgICAgICAgPC9kaXY+YCk7XG4gICAgbW9kYWwucXVlcnlTZWxlY3RvcihcIi5mb290ZXIgYnV0dG9uXCIpLmFkZEV2ZW50T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AgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA8ZGl2IGNsYXNzPVwidGFiLWJhci1pdGVtXCI+VGhlbWVzPC9kaXY+XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPC9kaXY+XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA8L2Rpdj5cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDxkaXYgY2xhc3M9XCJ0YWJsZS1oZWFkZXJcIj5cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA8ZGl2IGNsYXNzPVwidGFibGUtY29sdW1uIGNvbHVtbi1uYW1lXCI+TmFtZTwvZGl2PlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDxkaXYgY2xhc3M9XCJ0YWJsZS1jb2x1bW4gY29sdW1uLW1lc3NhZ2VcIj5NZXNzYWdlPC9kaXY+XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPGRpdiBjbGFzcz1cInRhYmxlLWNvbHVtbiBjb2x1bW4tZXJyb3JcIj5FcnJvcjwvZGl2PlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPC9kaXY+XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA8ZGl2IGNsYXNzPVwic2Nyb2xsZXItd3JhcCBmYWRlXCI+XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPGRpdiBjbGFzcz1cInNjcm9sbGVyXCI+XG4gICAgXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPC9kaXY+XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA8L2Rpdj5cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPC9kaXY+XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDxkaXYgY2xhc3M9XCJmb290ZXIgJHtoZWFkZXJNb2R1bGUuZm9vdGVyfSAke2Zvb3RlcjJNb2R1bGUuZm9vdGVyfVwiPlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPGJ1dHRvbiB0eXBlPVwiYnV0dG9uXCI+T2theTwvYnV0dG9uPlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA8L2Rpdj5cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICA8L2Rpdj5cbiAgICAgICAgICAgICAgICAgICAgICAgIDwvZGl2PlxuICAgICAgICAgICAgICAgICAgICA8L2Rpdj5gKTtcblxuICAgIGZ1bmN0aW9uIGdlbmVyYXRlVGFiKGVycm9ycykge1xuICAgICAgY29uc3QgY29udGFpbmVyID0gRE9NLmNyZWF0ZUVsZW1lbnQoYDxkaXYgY2xhc3M9XCJlcnJvcnNcIj5gKTtcblxuICAgICAgZm9yIChjb25zdCBlcnIgb2YgZXJyb3JzKSB7XG4gICAgICAgIGNvbnN0IGVycm9yID0gRE9NLmNyZWF0ZUVsZW1lbnQoYDxkaXYgY2xhc3M9XCJlcnJvclwiPlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPGRpdiBjbGFzcz1cInRhYmxlLWNvbHVtbiBjb2x1bW4tbmFtZVwiPiR7ZXJyLm5hbWUgPyBlcnIubmFtZSA6IGVyci5maWxlfTwvZGl2PlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPGRpdiBjbGFzcz1cInRhYmxlLWNvbHVtbiBjb2x1bW4tbWVzc2FnZVwiPiR7ZXJyLm1lc3NhZ2V9PC9kaXY+XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA8ZGl2IGNsYXNzPVwidGFibGUtY29sdW1uIGNvbHVtbi1lcnJvclwiPjxhIGNsYXNzPVwiZXJyb3ItbGlua1wiIGhyZWY9XCJcIj4ke2Vyci5lcnJvciA/IGVyci5lcnJvci5tZXNzYWdlIDogXCJcIn08L2E+PC9ka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Q0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///./src/modules/utils.js\n"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"default\", function() { return Utils; });\n/* harmony import */ var _0globals__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../0globals */ \"./src/0globals.js\");\n/* harmony import */ var _webpackModules__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./webpackModules */ \"./src/modules/webpackModules.js\");\n/* harmony import */ var _v2__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./v2 */ \"./src/modules/v2.js\");\n/* harmony import */ var _domtools__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./domtools */ \"./src/modules/domtools.js\");\n\n\n\n\nclass Utils {\n /** Document/window width */\n static get screenWidth() {\n return Math.max(document.documentElement.clientWidth, window.innerWidth || 0);\n }\n /** Document/window height */\n\n\n static get screenHeight() {\n return Math.max(document.documentElement.clientHeight, window.innerHeight || 0);\n }\n\n static get WindowConfigFile() {\n return this._windowConfigFile = null;\n }\n\n static getAllWindowPreferences() {\n return {\n transparent: true,\n frame: false\n };\n }\n\n static getWindowPreference(key) {\n if (key === \"transparent\") return true;\n if (key === \"frame\") return false;\n return null;\n }\n\n static setWindowPreference(key, value) {\n if (key === \"transparent\") return true;\n if (key === \"frame\") return false;\n return null;\n }\n\n static stripBOM(content) {\n if (content.charCodeAt(0) === 0xFEFF) {\n content = content.slice(1);\n }\n\n return content;\n }\n\n static getTextArea() {\n return _domtools__WEBPACK_IMPORTED_MODULE_3__[\"default\"].query(\".\" + BDModules.get(e => e.channelTextArea && e.titleWrapper)[0].channelTextArea.split(\" \")[0] + \" textarea\");\n }\n\n static insertText(textarea, text) {\n textarea.focus();\n textarea.selectionStart = 0;\n textarea.selectionEnd = textarea.value.length;\n document.execCommand(\"insertText\", false, text);\n }\n\n static escapeID(id) {\n return id.replace(/^[^a-z]+|[^\\w-]+/gi, \"-\");\n }\n\n static log(moduleName, message) {\n console.log(`%c[BandagedBD]%c [${moduleName}]%c ${message}`, \"color: #3a71c1; font-weight: 700;\", \"color: #3a71c1;\", \"\");\n }\n\n static warn(moduleName, message) {\n console.warn(`%c[BandagedBD]%c [${moduleName}]%c ${message}`, \"color: #E8A400; font-weight: 700;\", \"color: #E8A400;\", \"\");\n }\n\n static err(moduleName, message, error) {\n console.log(`%c[BandagedBD]%c [${moduleName}]%c ${message}`, \"color: red; font-weight: 700;\", \"color: red;\", \"\");\n\n if (error) {\n console.groupCollapsed(\"%cError: \" + error.message, \"color: red;\");\n console.error(error.stack);\n console.groupEnd();\n }\n }\n\n static escape(s) {\n return s.replace(/[-/\\\\^$*+?.()|[\\]{}]/g, \"\\\\$&\");\n }\n\n static testJSON(data) {\n try {\n return JSON.parse(data);\n } catch (err) {\n return false;\n }\n }\n\n static isEmpty(obj) {\n if (obj == null || obj == undefined || obj == \"\") return true;\n if (typeof obj !== \"object\") return false;\n if (Array.isArray(obj)) return obj.length == 0;\n\n for (const key in obj) {\n if (obj.hasOwnProperty(key)) return false;\n }\n\n return true;\n }\n\n static suppressErrors(method, message) {\n return (...params) => {\n try {\n return method(...params);\n } catch (e) {\n console.error(e), this.err(\"SuppressedError\", \"Error occurred in \" + message, e);\n }\n };\n }\n\n static monkeyPatch(what, methodName, options) {\n const {\n before,\n after,\n instead,\n once = false,\n silent = false,\n force = false\n } = options;\n const displayName = options.displayName || what.displayName || what[methodName].displayName || what.name || what.constructor.displayName || what.constructor.name;\n if (!silent) console.log(\"patch\", methodName, \"of\", displayName); // eslint-disable-line no-console\n\n if (!what[methodName]) {\n if (force) what[methodName] = function () {};else return console.error(methodName, \"does not exist for\", displayName); // eslint-disable-line no-console\n }\n\n const origMethod = what[methodName];\n\n const cancel = () => {\n if (!silent) console.log(\"unpatch\", methodName, \"of\", displayName); // eslint-disable-line no-console\n\n what[methodName] = origMethod;\n };\n\n what[methodName] = function () {\n const data = {\n thisObject: this,\n methodArguments: arguments,\n cancelPatch: cancel,\n originalMethod: origMethod,\n callOriginalMethod: () => data.returnValue = data.originalMethod.apply(data.thisObject, data.methodArguments)\n };\n\n if (instead) {\n const tempRet = Utils.suppressErrors(instead, \"`instead` callback of \" + what[methodName].displayName)(data);\n if (tempRet !== undefined) data.returnValue = tempRet;\n } else {\n if (before) Utils.suppressErrors(before, \"`before` callback of \" + what[methodName].displayName)(data);\n data.callOriginalMethod();\n if (after) Utils.suppressErrors(after, \"`after` callback of \" + what[methodName].displayName)(data);\n }\n\n if (once) cancel();\n return data.returnValue;\n };\n\n Object.assign(what[methodName], origMethod);\n what[methodName].__monkeyPatched = true;\n what[methodName].displayName = displayName;\n\n if (!what[methodName].__originalMethod) {\n what[methodName].__originalMethod = origMethod;\n\n what[methodName].toString = function () {\n return origMethod.toString();\n };\n }\n\n return cancel;\n }\n\n static onRemoved(node, callback) {\n const observer = new MutationObserver(mutations => {\n for (let m = 0; m < mutations.length; m++) {\n const mutation = mutations[m];\n const nodes = Array.from(mutation.removedNodes);\n const directMatch = nodes.indexOf(node) > -1;\n const parentMatch = nodes.some(parent => parent.contains(node));\n\n if (directMatch || parentMatch) {\n observer.disconnect();\n callback();\n }\n }\n });\n observer.observe(document.body, {\n subtree: true,\n childList: true\n });\n }\n\n static getNestedProp(obj, path) {\n return path.split(/\\s?\\.\\s?/).reduce(function (obj, prop) {\n return obj && obj[prop];\n }, obj);\n }\n /**\r\n * This shows a toast similar to android towards the bottom of the screen.\r\n *\r\n * @param {string} content The string to show in the toast.\r\n * @param {object} options Options object. Optional parameter.\r\n * @param {string} options.type Changes the type of the toast stylistically and semantically. Choices: \"\", \"info\", \"success\", \"danger\"/\"error\", \"warning\"/\"warn\". Default: \"\"\r\n * @param {boolean} options.icon Determines whether the icon should show corresponding to the type. A toast without type will always have no icon. Default: true\r\n * @param {number} options.timeout Adjusts the time (in ms) the toast should be shown for before disappearing automatically. Default: 3000\r\n */\n\n\n static showToast(content, options = {}) {\n if (!document.querySelector(\".bd-toasts\")) {\n const container = document.querySelector(\".\" + BDModules.get(e => e.sidebar && e.hasNotice)[0].sidebar.split(\" \")[9] + \" + div\") || null;\n const memberlist = container ? container.querySelector(\".\" + BDModules.get(e => e.membersWrap)[0].membersWrap) : null;\n const form = container ? container.querySelector(\"form\") : null;\n const left = container ? container.getBoundingClientRect().left : 310;\n const right = memberlist ? memberlist.getBoundingClientRect().left : 0;\n const width = right ? right - container.getBoundingClientRect().left : Utils.screenWidth - left - 240;\n const bottom = form ? form.offsetHeight : 80;\n const toastWrapper = document.createElement(\"div\");\n toastWrapper.classList.add(\"bd-toasts\");\n toastWrapper.style.setProperty(\"left\", left + \"px\");\n toastWrapper.style.setProperty(\"width\", width + \"px\");\n toastWrapper.style.setProperty(\"bottom\", bottom + \"px\");\n document.querySelector(\"#app-mount\").appendChild(toastWrapper);\n }\n\n const {\n type = \"\",\n icon = true,\n timeout = 3000\n } = options;\n const toastElem = document.createElement(\"div\");\n toastElem.classList.add(\"bd-toast\");\n if (type) toastElem.classList.add(\"toast-\" + type);\n if (type && icon) toastElem.classList.add(\"icon\");\n toastElem.innerText = content;\n document.querySelector(\".bd-toasts\").appendChild(toastElem);\n setTimeout(() => {\n toastElem.classList.add(\"closing\");\n setTimeout(() => {\n toastElem.remove();\n if (!document.querySelectorAll(\".bd-toasts .bd-toast\").length) document.querySelector(\".bd-toasts\").remove();\n }, 300);\n }, timeout);\n }\n\n static alert(title, content) {\n let modalModule = BDModules.get(e => e.modal && e.inner && !e.hideOnFullscreen)[0];\n let headerModule = BDModules.get(e => e.header && e.responsiveWidthMobile && e.hideOnFullscreen)[0];\n let footer2Module = BDModules.get(e => e.header && e.responsiveWidthMobile && e.focusLock)[0];\n const modal = _domtools__WEBPACK_IMPORTED_MODULE_3__[\"default\"].createElement(`
\n
e.backdrop && e.backdropWithLayer)[0].backdrop}\">
\n
\n
\n
\n
${title}
\n
\n
\n
\n
\n ${content}\n
\n
\n
\n
\n \n
\n
\n
\n
`);\n modal.querySelector(\".footer button\").addEventListener(\"click\", () => {\n _domtools__WEBPACK_IMPORTED_MODULE_3__[\"default\"].addClass(modal, \"closing\");\n setTimeout(() => {\n modal.remove();\n closingListeners.forEach(listener => {\n try {\n listener();\n } catch (e) {\n console.error(e);\n }\n });\n }, 300);\n });\n modal.querySelector(\".bd-backdrop\").addEventListener(\"click\", () => {\n _domtools__WEBPACK_IMPORTED_MODULE_3__[\"default\"].addClass(modal, \"closing\");\n setTimeout(() => {\n modal.remove();\n closingListeners.forEach(listener => {\n try {\n listener();\n } catch (e) {\n console.error(e);\n }\n });\n }, 300);\n });\n _domtools__WEBPACK_IMPORTED_MODULE_3__[\"default\"].query(\"#app-mount\").append(modal);\n const closingListeners = [];\n return {\n close: () => {\n _domtools__WEBPACK_IMPORTED_MODULE_3__[\"default\"].addClass(modal, \"closing\");\n setTimeout(() => {\n modal.remove();\n closingListeners.forEach(listener => {\n try {\n listener();\n } catch (e) {\n console.error(e);\n }\n });\n }, 300);\n },\n onClose: listener => {\n closingListeners.push(listener);\n }\n };\n }\n\n static showContentErrors({\n plugins: pluginErrors = [],\n themes: themeErrors = []\n }) {\n if (!pluginErrors || !themeErrors) return;\n if (!pluginErrors.length && !themeErrors.length) return;\n let modalModule = BDModules.get(e => e.modal && e.inner && !e.hideOnFullscreen)[0];\n let headerModule = BDModules.get(e => e.header && e.responsiveWidthMobile && e.hideOnFullscreen)[0];\n let footer2Module = BDModules.get(e => e.header && e.responsiveWidthMobile && e.focusLock)[0];\n const modal = _domtools__WEBPACK_IMPORTED_MODULE_3__[\"default\"].createElement(`
\n
e.backdrop && e.backdropWithLayer)[0].backdrop}\">
\n
\n
\n
Content Errors
\n
\n
\n
\n
Plugins
\n
Themes
\n
\n
\n
\n
Name
\n
Message
\n
Error
\n
\n
\n
\n \n
\n
\n
\n
\n \n
\n
\n
\n
`);\n\n function generateTab(errors) {\n const container = _domtools__WEBPACK_IMPORTED_MODULE_3__[\"default\"].createElement(`
`);\n\n for (const err of errors) {\n const error = _domtools__WEBPACK_IMPORTED_MODULE_3__[\"default\"].createElement(`
\n
${err.name ? err.name : err.file}
\n
${err.message}
\n \n
`);\n container.append(error);\n\n if (err.error) {\n error.querySelectorAll(\"a\").forEach(el => el.addEventListener(\"click\", e => {\n e.preventDefault();\n Utils.err(\"ContentManager\", `Error details for ${err.name ? err.name : err.file}.`, err.error);\n }));\n }\n }\n\n return container;\n }\n\n const tabs = [generateTab(pluginErrors), generateTab(themeErrors)];\n modal.querySelectorAll(\".tab-bar-item\").forEach(el => el.addEventListener(\"click\", e => {\n e.preventDefault();\n const selected = modal.querySelector(\".tab-bar-item.selected\");\n if (selected) _domtools__WEBPACK_IMPORTED_MODULE_3__[\"default\"].removeClass(selected, \"selected\");\n _domtools__WEBPACK_IMPORTED_MODULE_3__[\"default\"].addClass(e.target, \"selected\");\n const scroller = modal.querySelector(\".scroller\");\n scroller.innerHTML = \"\";\n scroller.append(tabs[_domtools__WEBPACK_IMPORTED_MODULE_3__[\"default\"].index(e.target)]);\n }));\n modal.querySelector(\".footer button\").addEventListener(\"click\", () => {\n _domtools__WEBPACK_IMPORTED_MODULE_3__[\"default\"].addClass(modal, \"closing\");\n setTimeout(() => {\n modal.remove();\n }, 300);\n });\n modal.querySelector(\".bd-backdrop\").addEventListener(\"click\", () => {\n _domtools__WEBPACK_IMPORTED_MODULE_3__[\"default\"].addClass(modal, \"closing\");\n setTimeout(() => {\n modal.remove();\n }, 300);\n });\n _domtools__WEBPACK_IMPORTED_MODULE_3__[\"default\"].query(\"#app-mount\").append(modal);\n if (pluginErrors.length) modal.querySelector(\".tab-bar-item\").click();else modal.querySelectorAll(\".tab-bar-item\")[1].click();\n }\n\n static showChangelogModal(options = {}) {\n const ModalStack = _webpackModules__WEBPACK_IMPORTED_MODULE_1__[\"default\"].findByProps(\"push\", \"update\", \"pop\", \"popWithKey\");\n const ChangelogClasses = _webpackModules__WEBPACK_IMPORTED_MODULE_1__[\"default\"].findByProps(\"fixed\", \"improved\");\n const TextElement = _webpackModules__WEBPACK_IMPORTED_MODULE_1__[\"default\"].findByDisplayName(\"Text\");\n const FlexChild = _webpackModules__WEBPACK_IMPORTED_MODULE_1__[\"default\"].findByProps(\"Child\");\n const Titles = _webpackModules__WEBPACK_IMPORTED_MODULE_1__[\"default\"].findByProps(\"Tags\", \"default\");\n const Changelog = _webpackModules__WEBPACK_IMPORTED_MODULE_1__[\"default\"].find(m => m.defaultProps && m.defaultProps.selectable == false);\n const MarkdownParser = _webpackModules__WEBPACK_IMPORTED_MODULE_1__[\"default\"].findByProps(\"defaultRules\", \"parse\");\n if (!Changelog || !ModalStack || !ChangelogClasses || !TextElement || !FlexChild || !Titles || !MarkdownParser) return;\n const {\n image = \"https://repository-images.githubusercontent.com/105473537/957b5480-7c26-11e9-8401-50fa820cbae5\",\n description = \"\",\n changes = [],\n title = \"BandagedBD\",\n subtitle = `v${_0globals__WEBPACK_IMPORTED_MODULE_0__[\"bbdVersion\"]}`,\n footer\n } = options;\n const ce = _v2__WEBPACK_IMPORTED_MODULE_2__[\"default\"].React.createElement;\n const changelogItems = [ce(\"img\", {\n src: image\n })];\n if (description) changelogItems.push(ce(\"p\", null, MarkdownParser.parse(description)));\n\n for (let c = 0; c < changes.length; c++) {\n const entry = changes[c];\n const type = ChangelogClasses[entry.type] ? ChangelogClasses[entry.type] : ChangelogClasses.added;\n const margin = c == 0 ? ChangelogClasses.marginTop : \"\";\n changelogItems.push(ce(\"h1\", {\n className: `${type} ${margin}`\n }, entry.title));\n const list = ce(\"ul\", null, entry.items.map(i => ce(\"li\", null, MarkdownParser.parse(i))));\n changelogItems.push(list);\n }\n\n const renderHeader = function () {\n return ce(FlexChild.Child, {\n grow: 1,\n shrink: 1\n }, ce(Titles.default, {\n tag: Titles.Tags.H4\n }, title), ce(TextElement, {\n size: TextElement.Sizes.SMALL,\n color: TextElement.Colors.STANDARD,\n className: ChangelogClasses.date\n }, subtitle));\n };\n\n const renderFooter = () => {\n const Anchor = _webpackModules__WEBPACK_IMPORTED_MODULE_1__[\"default\"].find(m => m.displayName == \"Anchor\");\n const AnchorClasses = _webpackModules__WEBPACK_IMPORTED_MODULE_1__[\"default\"].findByProps(\"anchorUnderlineOnHover\") || {\n anchor: \"anchor-3Z-8Bb\",\n anchorUnderlineOnHover: \"anchorUnderlineOnHover-2ESHQB\"\n };\n\n const joinSupportServer = click => {\n click.preventDefault();\n click.stopPropagation();\n ModalStack.pop();\n _v2__WEBPACK_IMPORTED_MODULE_2__[\"default\"].joinBD2();\n };\n\n const supportLink = Anchor ? ce(Anchor, {\n onClick: joinSupportServer\n }, \"Join our Discord Server.\") : ce(\"a\", {\n className: `${AnchorClasses.anchor} ${AnchorClasses.anchorUnderlineOnHover}`,\n onClick: joinSupportServer\n }, \"Join our Discord Server.\");\n const defaultFooter = ce(TextElement, {\n size: TextElement.Sizes.SMALL,\n color: TextElement.Colors.STANDARD\n }, \"Need support? \", supportLink);\n return ce(FlexChild.Child, {\n grow: 1,\n shrink: 1\n }, footer ? footer : defaultFooter);\n };\n\n return ModalStack.push(function (props) {\n return ce(Changelog, Object.assign({\n className: ChangelogClasses.container,\n selectable: true,\n onScroll: _ => _,\n onClose: _ => _,\n renderHeader: renderHeader,\n renderFooter: renderFooter,\n children: changelogItems\n }, props));\n });\n }\n /**\r\n * Shows a generic but very customizable confirmation modal with optional confirm and cancel callbacks.\r\n * @param {string} title - title of the modal\r\n * @param {(string|ReactElement|Array)} children - a single or mixed array of react elements and strings. Every string is wrapped in Discord's `Markdown` component so strings will show and render properly.\r\n * @param {object} [options] - options to modify the modal\r\n * @param {boolean} [options.danger=false] - whether the main button should be red or not\r\n * @param {string} [options.confirmText=Okay] - text for the confirmation/submit button\r\n * @param {string} [options.cancelText=Cancel] - text for the cancel button\r\n * @param {callable} [options.onConfirm=NOOP] - callback to occur when clicking the submit button\r\n * @param {callable} [options.onCancel=NOOP] - callback to occur when clicking the cancel button\r\n * @param {string} [options.key] - key used to identify the modal. If not provided, one is generated and returned\r\n * @returns {string} - the key used for this modal\r\n */\n\n\n static showConfirmationModal(title, content, options = {}) {\n const ModalStack = _webpackModules__WEBPACK_IMPORTED_MODULE_1__[\"default\"].findByProps(\"push\", \"update\", \"pop\", \"popWithKey\");\n const Markdown = _webpackModules__WEBPACK_IMPORTED_MODULE_1__[\"default\"].findByDisplayName(\"Markdown\");\n const ConfirmationModal = _webpackModules__WEBPACK_IMPORTED_MODULE_1__[\"default\"].find(m => m.defaultProps && m.key && m.key() == \"confirm-modal\");\n if (!ModalStack || !ConfirmationModal || !Markdown) return Utils.alert(title, content);\n\n const emptyFunction = () => {};\n\n const {\n onConfirm = emptyFunction,\n onCancel = emptyFunction,\n confirmText = \"Okay\",\n cancelText = \"Cancel\",\n danger = false,\n key = undefined\n } = options;\n if (!Array.isArray(content)) content = [content];\n content = content.map(c => typeof c === \"string\" ? _v2__WEBPACK_IMPORTED_MODULE_2__[\"default\"].React.createElement(Markdown, null, c) : c);\n return ModalStack.push(ConfirmationModal, {\n header: title,\n children: content,\n red: danger,\n confirmText: confirmText,\n cancelText: cancelText,\n onConfirm: onConfirm,\n onCancel: onCancel\n }, key);\n }\n\n}\nUtils.showToast = Utils.suppressErrors(Utils.showToast, \"Could not show toast.\");//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiLi9zcmMvbW9kdWxlcy91dGlscy5qcy5qcyIsInNvdXJjZXMiOlsid2VicGFjazovL0JldHRlckRpc2NvcmQvLi9zcmMvbW9kdWxlcy91dGlscy5qcz9jMGY3Il0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IGJiZFZlcnNpb24sIHNldHRpbmdzQ29va2llIH0gZnJvbSBcIi4uLzBnbG9iYWxzXCI7XG5pbXBvcnQgV2VicGFja01vZHVsZXMgZnJvbSBcIi4vd2VicGFja01vZHVsZXNcIjtcbmltcG9ydCBCRFYyIGZyb20gXCIuL3YyXCI7XG5pbXBvcnQgRE9NIGZyb20gXCIuL2RvbXRvb2xzXCI7XG5leHBvcnQgZGVmYXVsdCBjbGFzcyBVdGlscyB7XG4gIC8qKiBEb2N1bWVudC93aW5kb3cgd2lkdGggKi9cbiAgc3RhdGljIGdldCBzY3JlZW5XaWR0aCgpIHtcbiAgICByZXR1cm4gTWF0aC5tYXgoZG9jdW1lbnQuZG9jdW1lbnRFbGVtZW50Lm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AgICA8ZGl2IGNsYXNzPVwiYmQtbW9kYWwtaW5uZXIgJHttb2RhbE1vZHVsZS5pbm5lcn1cIj5cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPGRpdiBjbGFzcz1cImhlYWRlciAke2hlYWRlck1vZHVsZS5oZWFkZXJ9XCI+XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA8ZGl2IGNsYXNzPVwidGl0bGVcIj4ke3RpdGxlfTwvZGl2PlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA8L2Rpdj5cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPGRpdiBjbGFzcz1cImJkLW1vZGFsLWJvZHlcIj5cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDxkaXYgY2xhc3M9XCJzY3JvbGxlci13cmFwIGZhZGVcIj5cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA8ZGl2IGNsYXNzPVwic2Nyb2xsZXJcIj5cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJHtjb250ZW50fVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDwvZGl2PlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPC9kaXY+XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDwvZGl2PlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA8ZGl2IGNsYXNzPVwiZm9vdGVyICR7aGVhZGVyTW9kdWxlLmZvb3Rlcn0gJHtmb290ZXIyTW9kdWxlLmZvb3Rlcn1cIj5cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDxidXR0b24gdHlwZT1cImJ1dHRvblwiPk9rYXk8L2J1dHRvbj5cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPC9kaXY+XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgPC9kaXY+XG4g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aXYgY2xhc3M9XCJ0YWItYmFyIFRPUFwiPlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA8ZGl2IGNsYXNzPVwidGFiLWJhci1pdGVtXCI+UGx1Z2luczwvZGl2PlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA8ZGl2IGNsYXNzPVwidGFiLWJhci1pdGVtXCI+VGhlbWVzPC9kaXY+XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPC9kaXY+XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA8L2Rpdj5cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDxkaXYgY2xhc3M9XCJ0YWJsZS1oZWFkZXJcIj5cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA8ZGl2IGNsYXNzPVwidGFibGUtY29sdW1uIGNvbHVtbi1uYW1lXCI+TmFtZTwvZGl2PlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDxkaXYgY2xhc3M9XCJ0YWJsZS1jb2x1bW4gY29sdW1uLW1lc3NhZ2VcIj5NZXNzYWdlPC9kaXY+XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPGRpdiBjbGFzcz1cInRhYmxlLWNvbHVtbiBjb2x1bW4tZXJyb3JcIj5FcnJvcjwvZGl2PlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPC9kaXY+XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA8ZGl2IGNsYXNzPVwic2Nyb2xsZXItd3JhcCBmYWRlXCI+XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPGRpdiBjbGFzcz1cInNjcm9sbGVyXCI+XG4gICAgXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPC9kaXY+XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA8L2Rpdj5cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPC9kaXY+XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDxkaXYgY2xhc3M9XCJmb290ZXIgJHtoZWFkZXJNb2R1bGUuZm9vdGVyfSAke2Zvb3RlcjJNb2R1bGUuZm9vdGVyfVwiPlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPGJ1dHRvbiB0eXBlPVwiYnV0dG9uXCI+T2theTwvYnV0dG9uPlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA8L2Rpdj5cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICA8L2Rpdj5cbiAgICAgICAgICAgICAgICAgICAgICAgIDwvZGl2PlxuICAgICAgICAgICAgICAgICAgICA8L2Rpdj5gKTtcblxuICAgIGZ1bmN0aW9uIGdlbmVyYXRlVGFiKGVycm9ycykge1xuICAgICAgY29uc3QgY29udGFpbmVyID0gRE9NLmNyZWF0ZUVsZW1lbnQoYDxkaXYgY2xhc3M9XCJlcnJvcnNcIj5gKTtcblxuICAgICAgZm9yIChjb25zdCBlcnIgb2YgZXJyb3JzKSB7XG4gICAgICAgIGNvbnN0IGVycm9yID0gRE9NLmNyZWF0ZUVsZW1lbnQoYDxkaXYgY2xhc3M9XCJlcnJvclwiPlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPGRpdiBjbGFzcz1cInRhYmxlLWNvbHVtbiBjb2x1bW4tbmFtZVwiPiR7ZXJyLm5hbWUgPyBlcnIubmFtZSA6IGVyci5maWxlfTwvZGl2PlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgPGRpdiBjbGFzcz1cInRhYmxlLWNvbHVtbiBjb2x1bW4tbWVzc2FnZVwiPiR7ZXJyLm1lc3NhZ2V9PC9kaXY+XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA8ZGl2IGNsYXNzPVw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479,7 +479,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) * /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"default\", function() { return CardList; });\n/* harmony import */ var _errorBoundary__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./errorBoundary */ \"./src/ui/errorBoundary.js\");\n/* harmony import */ var _contentColumn__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./contentColumn */ \"./src/ui/contentColumn.js\");\n/* harmony import */ var _tools__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./tools */ \"./src/ui/tools.js\");\n/* harmony import */ var _reloadIcon__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./reloadIcon */ \"./src/ui/reloadIcon.js\");\n/* harmony import */ var _addoncard__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./addoncard */ \"./src/ui/addoncard.jsx\");\n/* harmony import */ var _scroller__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./scroller */ \"./src/ui/scroller.js\");\n/* harmony import */ var _components_dropdown__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./components/dropdown */ \"./src/ui/components/dropdown.jsx\");\n/* harmony import */ var _components_search__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./components/search */ \"./src/ui/components/search.jsx\");\n/* harmony import */ var _0globals__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../0globals */ \"./src/0globals.js\");\n/* harmony import */ var _modules_contentManager__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../modules/contentManager */ \"./src/modules/contentManager.js\");\n/* harmony import */ var _modules_v2__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../modules/v2 */ \"./src/modules/v2.js\");\n/* harmony import */ var _modules_pluginModule__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../modules/pluginModule */ \"./src/modules/pluginModule.js\");\n/* harmony import */ var _modules_themeModule__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../modules/themeModule */ \"./src/modules/themeModule.js\");\n/* harmony import */ var _modules_webpackModules__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../modules/webpackModules */ \"./src/modules/webpackModules.js\");\n/* harmony import */ var _modules_bdApi__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../modules/bdApi */ \"./src/modules/bdApi.js\");\nfunction _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nconst Tooltip = _modules_webpackModules__WEBPACK_IMPORTED_MODULE_13__[\"default\"].findByDisplayName(\"Tooltip\");\nconst React = _modules_v2__WEBPACK_IMPORTED_MODULE_10__[\"default\"].react;\nclass CardList extends _modules_v2__WEBPACK_IMPORTED_MODULE_10__[\"default\"].reactComponent {\n constructor(props) {\n super(props);\n this.state = {\n sort: \"name\",\n ascending: true,\n query: \"\"\n };\n this.isPlugins = this.props.type == \"plugins\";\n this.cookie = this.isPlugins ? _0globals__WEBPACK_IMPORTED_MODULE_8__[\"pluginCookie\"] : _0globals__WEBPACK_IMPORTED_MODULE_8__[\"themeCookie\"];\n this.manager = this.isPlugins ? _modules_pluginModule__WEBPACK_IMPORTED_MODULE_11__[\"default\"] : _modules_themeModule__WEBPACK_IMPORTED_MODULE_12__[\"default\"];\n this.sort = this.sort.bind(this);\n this.reverse = this.reverse.bind(this);\n this.search = this.search.bind(this);\n }\n\n openFolder() {\n __webpack_require__(/*! electron */ \"electron\").shell.openItem(this.isPlugins ? _modules_contentManager__WEBPACK_IMPORTED_MODULE_9__[\"default\"].pluginsFolder : _modules_contentManager__WEBPACK_IMPORTED_MODULE_9__[\"default\"].themesFolder);\n }\n\n edit(name) {\n console.log(name);\n this.manager.edit(name);\n }\n\n async delete(name) {\n const shouldDelete = await this.confirmDelete(name);\n if (!shouldDelete) return;\n this.manager.delete(name);\n }\n\n confirmDelete(name) {\n return new Promise(resolve => {\n _modules_bdApi__WEBPACK_IMPORTED_MODULE_14__[\"default\"].showConfirmationModal(\"Are You Sure?\", `Are you sure you want to delete ${name}?`, {\n danger: true,\n confirmText: \"Delete\",\n onConfirm: () => {\n resolve(true);\n },\n onCancel: () => {\n resolve(false);\n }\n });\n });\n }\n\n get sortOptions() {\n return [{\n label: \"Name\",\n value: \"name\"\n }, {\n label: \"Author\",\n value: \"author\"\n }, {\n label: \"Version\",\n value: \"version\"\n }, {\n label: \"Recently Added\",\n value: \"added\"\n }, {\n label: \"Last Modified\",\n value: \"modified\"\n }, {\n label: \"File Size\",\n value: \"size\"\n }];\n }\n\n get directions() {\n return [{\n label: \"Ascending\",\n value: true\n }, {\n label: \"Descending\",\n value: false\n }];\n }\n\n reverse(value) {\n this.setState({\n ascending: value\n });\n }\n\n sort(value) {\n this.setState({\n sort: value\n });\n }\n\n search(event) {\n this.setState({\n query: event.target.value.toLocaleLowerCase()\n });\n }\n\n getProps(addon) {\n return {\n key: this.getName(addon),\n enabled: this.cookie[this.getName(addon)],\n toggle: this.manager.toggle.bind(this.manager),\n //edit: this.edit.bind(this),\n remove: this.delete.bind(this),\n addon: addon\n };\n }\n\n getString(value) {\n if (!value) return \"???\";\n return typeof value == \"string\" ? value : value.toString();\n }\n\n getAddons() {\n const sortedAddons = this.props.list.sort((a, b) => {\n const cap = this.state.sort.charAt(0).toUpperCase() + this.state.sort.slice(1);\n const first = a.plugin && a.plugin[`get${cap}`] ? this.getString(a.plugin[`get${cap}`]()) : a[this.state.sort];\n const second = b.plugin && b.plugin[`get${cap}`] ? this.getString(b.plugin[`get${cap}`]()) : b[this.state.sort];\n if (typeof first == \"string\") return first.toLocaleLowerCase().localeCompare(second.toLocaleLowerCase());\n if (first > second) return 1;\n if (second > first) return -1;\n return 0;\n });\n if (!this.state.ascending) sortedAddons.reverse();\n const rendered = [];\n\n for (let a = 0; a < sortedAddons.length; a++) {\n const addon = sortedAddons[a];\n\n if (this.state.query) {\n let matches = null;\n const name = this.getName(addon);\n const author = this.getAuthor(addon);\n const description = this.getDescription(addon);\n const version = this.getVersion(addon);\n if (name) matches = name.toLocaleLowerCase().includes(this.state.query);\n if (author) matches = matches || author.toLocaleLowerCase().includes(this.state.query);\n if (description) matches = matches || description.toLocaleLowerCase().includes(this.state.query);\n if (version) matches = matches || version.toLocaleLowerCase().includes(this.state.query);\n if (!matches) continue;\n }\n\n const props = this.getProps(addon);\n rendered.push(React.createElement(_errorBoundary__WEBPACK_IMPORTED_MODULE_0__[\"default\"], null, React.createElement(_addoncard__WEBPACK_IMPORTED_MODULE_4__[\"default\"], _extends({}, props, {\n reload: !_0globals__WEBPACK_IMPORTED_MODULE_8__[\"settingsCookie\"][\"fork-ps-5\"] && this.manager.reload.bind(this.manager)\n }))));\n }\n\n return rendered;\n }\n\n getName(addon) {\n return this.getString(addon.plugin ? addon.plugin.getName() : addon.name);\n }\n\n getAuthor(addon) {\n return this.getString(addon.plugin ? addon.plugin.getAuthor() : addon.author);\n }\n\n getDescription(addon) {\n return this.getString(addon.plugin ? addon.plugin.getDescription() : addon.description);\n }\n\n getVersion(addon) {\n return this.getString(addon.plugin ? addon.plugin.getVersion() : addon.version);\n }\n\n render() {\n const refreshIcon = React.createElement(Tooltip, {\n color: \"black\",\n position: \"top\",\n text: \"Reload List\"\n }, props => React.createElement(_reloadIcon__WEBPACK_IMPORTED_MODULE_3__[\"default\"], _extends({}, props, {\n className: \"bd-icon bd-reload bd-reload-header\",\n size: \"18px\",\n onClick: async () => {\n if (this.isPlugins) _modules_pluginModule__WEBPACK_IMPORTED_MODULE_11__[\"default\"].updatePluginList();else _modules_themeModule__WEBPACK_IMPORTED_MODULE_12__[\"default\"].updateThemeList();\n this.forceUpdate();\n }\n })));\n const addonCards = this.getAddons();\n return React.createElement(_scroller__WEBPACK_IMPORTED_MODULE_5__[\"default\"], {\n contentColumn: true,\n fade: true,\n dark: true\n }, React.createElement(_contentColumn__WEBPACK_IMPORTED_MODULE_1__[\"default\"], {\n title: `${this.props.type.toUpperCase()}—${addonCards.length}`\n }, React.createElement(\"button\", {\n key: \"folder-button\",\n className: \"bd-button bd-pfbtn\",\n onClick: this.openFolder.bind(this)\n }, \"Open \", this.isPlugins ? \"Plugin\" : \"Theme\", \" Folder\"), !_0globals__WEBPACK_IMPORTED_MODULE_8__[\"settingsCookie\"][\"fork-ps-5\"] && refreshIcon, React.createElement(\"div\", {\n className: \"bd-controls bd-addon-controls\"\n }, React.createElement(_components_search__WEBPACK_IMPORTED_MODULE_7__[\"default\"], {\n onChange: this.search,\n placeholder: `Search ${this.props.type}...`\n }), React.createElement(\"div\", {\n className: \"bd-addon-dropdowns\"\n }, React.createElement(\"div\", {\n className: \"bd-select-wrapper\"\n }, React.createElement(\"label\", {\n className: \"bd-label\"\n }, \"Sort by:\"), React.createElement(_components_dropdown__WEBPACK_IMPORTED_MODULE_6__[\"default\"], {\n options: this.sortOptions,\n onChange: this.sort,\n style: \"transparent\"\n })), React.createElement(\"div\", {\n className: \"bd-select-wrapper\"\n }, React.createElement(\"label\", {\n className: \"bd-label\"\n }, \"Order:\"), React.createElement(_components_dropdown__WEBPACK_IMPORTED_MODULE_6__[\"default\"], {\n options: this.directions,\n onChange: this.reverse,\n style: \"transparent\"\n })))), React.createElement(\"div\", {\n className: \"bda-slist bd-addon-list\"\n }, addonCards)), React.createElement(_tools__WEBPACK_IMPORTED_MODULE_2__[\"default\"], {\n key: \"tools\"\n }));\n }\n\n}//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiLi9zcmMvdWkvYWRkb25saXN0LmpzeC5qcyIsInNvdXJjZXMiOlsid2VicGFjazov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NBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///./src/ui/addonlist.jsx\n"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"default\", function() { return CardList; });\n/* harmony import */ var _errorBoundary__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./errorBoundary */ \"./src/ui/errorBoundary.js\");\n/* harmony import */ var _contentColumn__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./contentColumn */ \"./src/ui/contentColumn.js\");\n/* harmony import */ var _tools__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./tools */ \"./src/ui/tools.js\");\n/* harmony import */ var _reloadIcon__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./reloadIcon */ \"./src/ui/reloadIcon.js\");\n/* harmony import */ var _addoncard__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./addoncard */ \"./src/ui/addoncard.jsx\");\n/* harmony import */ var _scroller__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./scroller */ \"./src/ui/scroller.js\");\n/* harmony import */ var _components_dropdown__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./components/dropdown */ \"./src/ui/components/dropdown.jsx\");\n/* harmony import */ var _components_search__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./components/search */ \"./src/ui/components/search.jsx\");\n/* harmony import */ var _0globals__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../0globals */ \"./src/0globals.js\");\n/* harmony import */ var _modules_contentManager__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../modules/contentManager */ \"./src/modules/contentManager.js\");\n/* harmony import */ var _modules_v2__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../modules/v2 */ \"./src/modules/v2.js\");\n/* harmony import */ var _modules_pluginModule__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../modules/pluginModule */ \"./src/modules/pluginModule.js\");\n/* harmony import */ var _modules_themeModule__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../modules/themeModule */ \"./src/modules/themeModule.js\");\n/* harmony import */ var _modules_webpackModules__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../modules/webpackModules */ \"./src/modules/webpackModules.js\");\n/* harmony import */ var _modules_bdApi__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../modules/bdApi */ \"./src/modules/bdApi.js\");\nfunction _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nconst Tooltip = _modules_webpackModules__WEBPACK_IMPORTED_MODULE_13__[\"default\"].findByDisplayName(\"Tooltip\");\nconst React = _modules_v2__WEBPACK_IMPORTED_MODULE_10__[\"default\"].react;\nclass CardList extends _modules_v2__WEBPACK_IMPORTED_MODULE_10__[\"default\"].reactComponent {\n constructor(props) {\n super(props);\n this.state = {\n sort: \"name\",\n ascending: true,\n query: \"\"\n };\n this.isPlugins = this.props.type == \"plugins\";\n this.cookie = this.isPlugins ? _0globals__WEBPACK_IMPORTED_MODULE_8__[\"pluginCookie\"] : _0globals__WEBPACK_IMPORTED_MODULE_8__[\"themeCookie\"];\n this.manager = this.isPlugins ? _modules_pluginModule__WEBPACK_IMPORTED_MODULE_11__[\"default\"] : _modules_themeModule__WEBPACK_IMPORTED_MODULE_12__[\"default\"];\n this.sort = this.sort.bind(this);\n this.reverse = this.reverse.bind(this);\n this.search = this.search.bind(this);\n }\n\n openFolder() {\n __webpack_require__(/*! electron */ \"electron\").shell.openItem(this.isPlugins ? _modules_contentManager__WEBPACK_IMPORTED_MODULE_9__[\"default\"].pluginsFolder : _modules_contentManager__WEBPACK_IMPORTED_MODULE_9__[\"default\"].themesFolder);\n }\n\n edit(name) {\n console.log(name);\n this.manager.edit(name);\n }\n\n async delete(name) {\n const shouldDelete = await this.confirmDelete(name);\n if (!shouldDelete) return;\n this.manager.delete(name);\n }\n\n confirmDelete(name) {\n return new Promise(resolve => {\n _modules_bdApi__WEBPACK_IMPORTED_MODULE_14__[\"default\"].showConfirmationModal(\"Are You Sure?\", `Are you sure you want to delete ${name}?`, {\n danger: true,\n confirmText: \"Delete\",\n onConfirm: () => {\n resolve(true);\n },\n onCancel: () => {\n resolve(false);\n }\n });\n });\n }\n\n get sortOptions() {\n return [{\n label: \"Name\",\n value: \"name\"\n }, {\n label: \"Author\",\n value: \"author\"\n }, {\n label: \"Version\",\n value: \"version\"\n }, {\n label: \"Recently Added\",\n value: \"added\"\n }, {\n label: \"Last Modified\",\n value: \"modified\"\n }, {\n label: \"File Size\",\n value: \"size\"\n }];\n }\n\n get directions() {\n return [{\n label: \"Ascending\",\n value: true\n }, {\n label: \"Descending\",\n value: false\n }];\n }\n\n reverse(value) {\n this.setState({\n ascending: value\n });\n }\n\n sort(value) {\n this.setState({\n sort: value\n });\n }\n\n search(event) {\n this.setState({\n query: event.target.value.toLocaleLowerCase()\n });\n }\n\n getProps(addon) {\n return {\n key: this.getName(addon),\n enabled: this.cookie[this.getName(addon)],\n toggle: this.manager.toggle.bind(this.manager),\n //edit: this.edit.bind(this),\n remove: this.delete.bind(this),\n addon: addon\n };\n }\n\n getString(value) {\n if (!value) return \"???\";\n return typeof value == \"string\" ? value : value.toString();\n }\n\n getAddons() {\n const sortedAddons = this.props.list.sort((a, b) => {\n const cap = this.state.sort.charAt(0).toUpperCase() + this.state.sort.slice(1);\n const first = a.plugin && a.plugin[`get${cap}`] ? this.getString(a.plugin[`get${cap}`]()) : a[this.state.sort];\n const second = b.plugin && b.plugin[`get${cap}`] ? this.getString(b.plugin[`get${cap}`]()) : b[this.state.sort];\n if (typeof first == \"string\") return first.toLocaleLowerCase().localeCompare(second.toLocaleLowerCase());\n if (first > second) return 1;\n if (second > first) return -1;\n return 0;\n });\n if (!this.state.ascending) sortedAddons.reverse();\n const rendered = [];\n\n for (let a = 0; a < sortedAddons.length; a++) {\n const addon = sortedAddons[a];\n\n if (this.state.query) {\n let matches = null;\n const name = this.getName(addon);\n const author = this.getAuthor(addon);\n const description = this.getDescription(addon);\n const version = this.getVersion(addon);\n if (name) matches = name.toLocaleLowerCase().includes(this.state.query);\n if (author) matches = matches || author.toLocaleLowerCase().includes(this.state.query);\n if (description) matches = matches || description.toLocaleLowerCase().includes(this.state.query);\n if (version) matches = matches || version.toLocaleLowerCase().includes(this.state.query);\n if (!matches) continue;\n }\n\n const props = this.getProps(addon);\n rendered.push(React.createElement(_errorBoundary__WEBPACK_IMPORTED_MODULE_0__[\"default\"], null, React.createElement(_addoncard__WEBPACK_IMPORTED_MODULE_4__[\"default\"], _extends({}, props, {\n reload: !_0globals__WEBPACK_IMPORTED_MODULE_8__[\"settingsCookie\"][\"fork-ps-5\"] && this.manager.reload.bind(this.manager)\n }))));\n }\n\n return rendered;\n }\n\n getName(addon) {\n return this.getString(addon.plugin ? addon.plugin.getName() : addon.name);\n }\n\n getAuthor(addon) {\n return this.getString(addon.plugin ? addon.plugin.getAuthor() : addon.author);\n }\n\n getDescription(addon) {\n return this.getString(addon.plugin ? addon.plugin.getDescription() : addon.description);\n }\n\n getVersion(addon) {\n return this.getString(addon.plugin ? addon.plugin.getVersion() : addon.version);\n }\n\n render() {\n const refreshIcon = React.createElement(Tooltip, {\n color: \"black\",\n position: \"top\",\n text: \"Reload List\"\n }, props => React.createElement(_reloadIcon__WEBPACK_IMPORTED_MODULE_3__[\"default\"], _extends({}, props, {\n className: \"bd-icon bd-reload bd-reload-header\",\n size: \"18px\",\n onClick: async () => {\n if (this.isPlugins) _modules_pluginModule__WEBPACK_IMPORTED_MODULE_11__[\"default\"].updatePluginList();else _modules_themeModule__WEBPACK_IMPORTED_MODULE_12__[\"default\"].updateThemeList();\n this.forceUpdate();\n }\n })));\n const addonCards = this.getAddons();\n return React.createElement(_scroller__WEBPACK_IMPORTED_MODULE_5__[\"default\"], {\n contentColumn: true,\n fade: true,\n dark: true\n }, React.createElement(_contentColumn__WEBPACK_IMPORTED_MODULE_1__[\"default\"], {\n title: `${this.props.type.toUpperCase()}—${addonCards.length}`\n }, React.createElement(\"button\", {\n key: \"folder-button\",\n className: \"bd-button bd-pfbtn\",\n onClick: this.openFolder.bind(this)\n }, \"Open \", this.isPlugins ? \"Plugin\" : \"Theme\", \" Folder\"), !_0globals__WEBPACK_IMPORTED_MODULE_8__[\"settingsCookie\"][\"fork-ps-5\"] && refreshIcon, React.createElement(\"div\", {\n className: \"bd-controls bd-addon-controls\"\n }, React.createElement(_components_search__WEBPACK_IMPORTED_MODULE_7__[\"default\"], {\n onChange: this.search,\n placeholder: `Search ${this.props.type}...`\n }), React.createElement(\"div\", {\n className: \"bd-addon-dropdowns\"\n }, React.createElement(\"div\", {\n className: \"bd-select-wrapper\"\n }, React.createElement(\"label\", {\n className: \"bd-label\"\n }, \"Sort by:\"), React.createElement(_components_dropdown__WEBPACK_IMPORTED_MODULE_6__[\"default\"], {\n options: this.sortOptions,\n onChange: this.sort,\n style: \"transparent\"\n })), React.createElement(\"div\", {\n className: \"bd-select-wrapper\"\n }, React.createElement(\"label\", {\n className: \"bd-label\"\n }, \"Order:\"), React.createElement(_components_dropdown__WEBPACK_IMPORTED_MODULE_6__[\"default\"], {\n options: this.directions,\n onChange: this.reverse,\n style: \"transparent\"\n })))), React.createElement(\"div\", {\n className: \"bda-slist bd-addon-list\"\n }, addonCards)), React.createElement(_tools__WEBPACK_IMPORTED_MODULE_2__[\"default\"], {\n key: \"tools\"\n }));\n }\n\n}\nconst originalRender = CardList.prototype.render;\nObject.defineProperty(CardList.prototype, \"render\", {\n enumerable: false,\n configurable: false,\n set: function () {\n console.warn(\"Addon policy for plugins #5 https://github.com/rauenzi/BetterDiscordApp/wiki/Addon-Policies#plugins\");\n },\n get: () => originalRender\n});//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiLi9zcmMvdWkvYWRkb25saXN0LmpzeC5qcyIsInNvdXJjZXMiOlsid2VicGFjazovL0JldHRlckRpc2NvcmQvLi9zcmMvdWkvYWRkb25saXN0LmpzeD80OGQxIl0sInNvdXJjZXNDb250ZW50IjpbImZ1bmN0aW9uIF9leHRlbmRzKCkgeyBfZXh0ZW5kcyA9IE9iamVjdC5hc3NpZ24gfHwgZnVuY3Rpb24gKHRhcmdldCkgeyBmb3IgKHZhciBpID0gMTsgaSA8IGFyZ3VtZW50cy5sZW5ndGg7IGkrKykgeyB2YXIgc291cmNlID0g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ony export (binding) * /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"default\", function() { return BDErrorBoundary; });\n/* harmony import */ var _modules_v2__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../modules/v2 */ \"./src/modules/v2.js\");\n\nclass BDErrorBoundary extends _modules_v2__WEBPACK_IMPORTED_MODULE_0__[\"default\"].reactComponent {\n constructor(props) {\n super(props);\n this.state = {\n hasError: false\n };\n }\n\n componentDidCatch() {\n this.setState({\n hasError: true\n });\n }\n\n render() {\n if (this.state.hasError) return _modules_v2__WEBPACK_IMPORTED_MODULE_0__[\"default\"].react.createElement(\"div\", {\n className: \"react-error\"\n }, \"Component Error\");\n return this.props.children;\n }\n\n}//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiLi9zcmMvdWkvZXJyb3JCb3VuZGFyeS5qcy5qcyIsInNvdXJjZXMiOlsid2VicGFjazovL0JldHRlckRpc2NvcmQvLi9zcmMvdWkvZXJyb3JCb3VuZGFyeS5qcz82Y2RhIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBCRFYyIGZyb20gXCIuLi9tb2R1bGVzL3YyXCI7XG5leHBvcnQgZGVmYXVsdCBjbGFzcyBCREVycm9yQm91bmRhcnkgZXh0ZW5kcyBCRFYyLnJlYWN0Q29tcG9uZW50IHtcbiAgY29uc3RydWN0b3IocHJvcHMpIHtcbiAgICBzdXBlcihwcm9wcyk7XG4gICAgdGhpcy5zdGF0ZSA9IHtcbiAgICAgIGhhc0Vycm9yOiBmYWxzZVxuICAgIH07XG4gIH1cblxuICBjb21wb25lbnREaWRDYXRjaCgpIHtcbiAgICB0aGlzLnNldFN0YXRlKHtcbiAgICAgIGhhc0Vycm9yOiB0cnVlXG4gICAgfSk7XG4gIH1cblxuICByZW5kZXIoKSB7XG4gICAgaWYgKHRoaXMuc3RhdGUuaGFzRXJyb3IpIHJldHVybiBCRFYyLnJlYWN0LmNyZWF0ZUVsZW1lbnQoXCJkaXZcIiwge1xuICAgICAgY2xhc3NOYW1lOiBcInJlYWN0LWVycm9yXCJcbiAgICB9LCBcIkNvbXBvbmVudCBFcnJvclwiKTtcbiAgICByZXR1cm4gdGhpcy5wcm9wcy5jaGlsZHJlbjtcbiAgfVxuXG59Il0sIm1hcHBpbmdzIjoiQUFBQTtBQUFBO0FBQUE7QUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBIiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///./src/ui/errorBoundary.js\n"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"default\", function() { return BDErrorBoundary; });\n/* harmony import */ var _modules_v2__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../modules/v2 */ \"./src/modules/v2.js\");\n\nclass BDErrorBoundary extends _modules_v2__WEBPACK_IMPORTED_MODULE_0__[\"default\"].reactComponent {\n constructor(props) {\n super(props);\n this.state = {\n hasError: false\n };\n }\n\n componentDidCatch() {\n this.setState({\n hasError: true\n });\n }\n\n render() {\n if (this.state.hasError) return _modules_v2__WEBPACK_IMPORTED_MODULE_0__[\"default\"].react.createElement(\"div\", {\n className: \"react-error\"\n }, \"Component Error\");\n return this.props.children;\n }\n\n}\nconst originalRender = BDErrorBoundary.prototype.render;\nObject.defineProperty(BDErrorBoundary.prototype, \"render\", {\n enumerable: false,\n configurable: false,\n set: function () {\n console.warn(\"Addon policy for plugins #5 https://github.com/rauenzi/BetterDiscordApp/wiki/Addon-Policies#plugins\");\n },\n get: () => originalRender\n});//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiLi9zcmMvdWkvZXJyb3JCb3VuZGFyeS5qcy5qcyIsInNvdXJjZXMiOlsid2VicGFjazovL0JldHRlckRpc2NvcmQvLi9zcmMvdWkvZXJyb3JCb3VuZGFyeS5qcz82Y2RhIl0sInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBCRFYyIGZyb20gXCIuLi9tb2R1bGVzL3YyXCI7XG5leHBvcnQgZGVmYXVsdCBjbGFzcyBCREVycm9yQm91bmRhcnkgZXh0ZW5kcyBCRFYyLnJlYWN0Q29tcG9uZW50IHtcbiAgY29uc3RydWN0b3IocHJvcHMpIHtcbiAgICBzdXBlcihwcm9wcyk7XG4gICAgdGhpcy5zdGF0ZSA9IHtcbiAgICAgIGhhc0Vycm9yOiBmYWxzZVxuICAgIH07XG4gIH1cblxuICBjb21wb25lbnREaWRDYXRjaCgpIHtcbiAgICB0aGlzLnNldFN0YXRlKHtcbiAgICAgIGhhc0Vycm9yOiB0cnVlXG4gICAgfSk7XG4gIH1cblxuICByZW5kZXIoKSB7XG4gICAgaWYgKHRoaXMuc3RhdGUuaGFzRXJyb3IpIHJldHVybiBCRFYyLnJlYWN0LmNyZWF0ZUVsZW1lbnQoXCJkaXZcIiwge1xuICAgICAgY2xhc3NOYW1lOiBcInJlYWN0LWVycm9yXCJcbiAgICB9LCBcIkNvbXBvbmVudCBFcnJvclwiKTtcbiAgICByZXR1cm4gdGhpcy5wcm9wcy5jaGlsZHJlbjtcbiAgfVxuXG59XG5jb25zdCBvcmlnaW5hbFJlbmRlciA9IEJERXJyb3JCb3VuZGFyeS5wcm90b3R5cGUucmVuZGVyO1xuT2JqZWN0LmRlZmluZVByb3BlcnR5KEJERXJyb3JCb3VuZGFyeS5wcm90b3R5cGUsIFwicmVuZGVyXCIsIHtcbiAgZW51bWVyYWJsZTogZmFsc2UsXG4gIGNvbmZpZ3VyYWJsZTogZmFsc2UsXG4gIHNldDogZnVuY3Rpb24gKCkge1xuICAgIGNvbnNvbGUud2FybihcIkFkZG9uIHBvbGljeSBmb3IgcGx1Z2lucyAjNSBodHRwczovL2dpdGh1Yi5jb20vcmF1ZW56aS9CZXR0ZXJEaXNjb3JkQXBwL3dpa2kvQWRkb24tUG9saWNpZXMjcGx1Z2luc1wiKTtcbiAgfSxcbiAgZ2V0OiAoKSA9PiBvcmlnaW5hbFJlbmRlclxufSk7Il0sIm1hcHBpbmdzIjoiQUFBQTtBQUFBO0FBQUE7QUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBIiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///./src/ui/errorBoundary.js\n"); /***/ }), diff --git a/BetterDiscordApp/src/0globals.js b/BetterDiscordApp/src/0globals.js index dc79934..9edb999 100644 --- a/BetterDiscordApp/src/0globals.js +++ b/BetterDiscordApp/src/0globals.js @@ -58,6 +58,7 @@ export const settings = { "Calling Ring Beat": {id: "lightcord-2", info: "Enable Discord's special calling beat.", implemented: true, hidden: false, cat: "lightcord", category: "Lightcord"}, "Developer Options": {id: "lightcord-1", info: "Enable Discord's Internal Developer Options. This allow the \"Experiments\" tab and the \"Developer Options\" tab. (must close and reopen settings)", implemented: true, hidden: false, cat: "lightcord", category: "Lightcord"}, "Ad Block": {id: "lightcord-4", info: "Block any BOT that dm you with an invite link. Even in an embed.", implemented: true, hidden: false, cat: "lightcord", category: "Lightcord"}, + "Enable Lightcord Servers": {id: "lightcord-5", info: "Disabling it erase any informations about you in our servers. But you won't see anything like custom badges.", implemented: true, hidden: false, cat: "lightcord", category: "Lightcord"}, /** Lightcord Window */ "Always-on-Top": {id: "lightcord-3", info: "Enable window's Always-on-Top mode, where Lightcord stays on top of other applications.", implemented: true, hidden: false, cat: "lightcord", category: "Window"}, @@ -103,7 +104,8 @@ export const defaultCookie = { "lightcord-2": true, "lightcord-presence-1": false, "lightcord-3": false, - "lightcord-4": false + "lightcord-4": false, + "lightcord-5": true }; diff --git a/BetterDiscordApp/src/modules/distant.js b/BetterDiscordApp/src/modules/distant.js index cfff48b..3249b20 100644 --- a/BetterDiscordApp/src/modules/distant.js +++ b/BetterDiscordApp/src/modules/distant.js @@ -27,6 +27,24 @@ export default new class DistantServer { return this._cache = Object.assign(this._cache, data) } + async delete(){ + BdApi.showToast("Deleting all infos about you on Lightcord Servers...", {type: "warn"}) + return handleRequest(Routes.delete, "delete") + .then(async res => { + if(res.status !== 200){ + BdApi.showToast("An error occured, couldn't delete informations. See console for more infos", {type: "error"}) + throw new Error(`Couldn't delete all informations: ${(res.status+" "+res.statusText+" "+await res.text())}`) + } + console.info(`Succesfully deleted informations.`) + BdApi.showToast("Succesfully deleted informations", {type: "success"}) + window.Lightcord.Api.Authorization = null + return res.json() + }).catch((err) => { + BdApi.showToast("An error occured, couldn't delete informations. See console for more infos", {type: "error"}) + throw new Error(`Couldn't delete all informations: ${err.stack}`) + }) + } + /** * Get custom badges from the user ID. * @param {string} user The user ID @@ -77,7 +95,8 @@ const handleRequest = function(route, method){ return fetch(`${Constants.SERVER_URL}/api/v1${route}`, { method, headers: { - "CLIENT": "Lightcord" + "CLIENT": "Lightcord", + "Authorization": window.Lightcord.Api.Authorization || "None::Anonymous" } }) } @@ -86,11 +105,21 @@ export const Constants = { SERVER_URL: "http://127.0.0.1", badges: [ { - name: "Bug Hunter", + name: "Lightcord User", + id: "01cfa7b0-7cdb-4b0e-8258-9c6a78235c93", + defaultUsers: [ + "696481194443014174" + ], + scopes: [ + "user" + ], + component: BugHunterBadge, + href: "https://github.com/lightcord/lightcord/wiki/badges/bug_hunter" + }, { + name: "Lightcord Bug Hunter", id: "f04698f5-816b-41e3-bd01-92291193d7a5", defaultUsers: [ - "696481194443014174", - "585858920149549067" + "696481194443014174" ], scopes: [], component: BugHunterBadge, @@ -100,7 +129,6 @@ export const Constants = { } export const Routes = { - badges(user){ - return `/${user}/badges` - } + badges: user => `/${user}/badges`, + delete: `/delete` } \ No newline at end of file