BetterDiscordApp-v1/js/main.min.js

55 lines
123 KiB
JavaScript

(function(){const e=window.require("fs"),t=window.require("process"),a=t.platform,n=("win32"===a?t.env.APPDATA:"darwin"===a?t.env.HOME+"/Library/Preferences":process.env.HOME+"/.config")+"/BetterDiscord/",o="localStorage.json";let s={};if(e.existsSync(`${n}${o}`))try{s=JSON.parse(e.readFileSync(`${n}${o}`))}catch(e){console.log(e)}else if(e.existsSync(o))try{s=JSON.parse(e.readFileSync(o))}catch(e){console.log(e)}const r=s;r.setItem=function(e,t){r[e]=t,this.save()},r.getItem=function(e){return r[e]||null},r.save=function(){e.writeFileSync(`${n}${o}`,JSON.stringify(this),null,4)};const i=new Proxy(r,{set:function(e,t,a){r[t]=a,r.save()},get:function(e,t){return r[t]||null}});window.localStorage=i})(),(()=>{const e=document.createElement("div");e.className="bd-loaderv2",e.title="BandagedBD is loading...",document.body.appendChild(e)})();var DataStore=(()=>{const e=require("fs"),t=require("path"),a=DiscordNative.globals.releaseChannel;return new class{constructor(){this.data={settings:{stable:{},canary:{},ptb:{}}},this.pluginData={}}initialize(){try{e.existsSync(this.BDFile)||e.writeFileSync(this.BDFile,JSON.stringify(this.data,null,4));const t=require(this.BDFile);if(t.hasOwnProperty("settings")&&(this.data=t),!e.existsSync(this.settingsFile))return;let n=require(this.settingsFile);e.unlinkSync(this.settingsFile),n=n.hasOwnProperty("settings")?Object.assign({stable:{},canary:{},ptb:{}},{[a]:n}):Object.assign({stable:{},canary:{},ptb:{}},n),this.setBDData("settings",n)}catch(e){BdApi.alert("Corrupt Storage","The bd storage has somehow become corrupt. You may either try to salvage the file or delete it then reload.")}}get BDFile(){return this._BDFile||(this._BDFile=t.resolve(bdConfig.dataPath,"bdstorage.json"))}get settingsFile(){return this._settingsFile||(this._settingsFile=t.resolve(bdConfig.dataPath,"bdsettings.json"))}getPluginFile(e){return t.resolve(ContentManager.pluginsFolder,e+".config.json")}getSettingGroup(e){return this.data.settings[a][e]||null}setSettingGroup(t,n){this.data.settings[a][t]=n,e.writeFileSync(this.BDFile,JSON.stringify(this.data,null,4))}getBDData(e){return this.data[e]||""}setBDData(t,a){this.data[t]=a,e.writeFileSync(this.BDFile,JSON.stringify(this.data,null,4))}getPluginData(t,a){return void 0===this.pluginData[t]?e.existsSync(this.getPluginFile(t))?(this.pluginData[t]=JSON.parse(e.readFileSync(this.getPluginFile(t))),this.pluginData[t][a]||void 0):void 0:this.pluginData[t][a]||void 0}setPluginData(t,a,n){void 0===n||(this.pluginData[t]===void 0&&(this.pluginData[t]={}),this.pluginData[t][a]=n,e.writeFileSync(this.getPluginFile(t),JSON.stringify(this.pluginData[t],null,4)))}deletePluginData(t,a){this.pluginData[t]===void 0&&(this.pluginData[t]={}),delete this.pluginData[t][a],e.writeFileSync(this.getPluginFile(t),JSON.stringify(this.pluginData[t],null,4))}}})(),BDEvents=(()=>{const e=require("events");return new class extends e{dispatch(e,...t){this.emit(e,...t)}off(e,t){this.removeListener(e,t)}}})();window.bdStorage=class{static get(e){return Utils.warn("Deprecation Notice","Please use BdApi.getBDData(). bdStorage may be removed in future versions."),DataStore.getBDData(e)}static set(e,t){Utils.warn("Deprecation Notice","Please use BdApi.setBDData(). bdStorage may be removed in future versions."),DataStore.setBDData(e,t)}},window.bdPluginStorage=class{static get(e,t){return Utils.warn("Deprecation Notice",`${e}, please use BdApi.loadData() or BdApi.getData(). bdPluginStorage may be removed in future versions.`),DataStore.getPluginData(e,t)||null}static set(e,t,a){return Utils.warn("Deprecation Notice",`${e}, please use BdApi.saveData() or BdApi.setData(). bdPluginStorage may be removed in future versions.`),"undefined"==typeof a?Utils.warn("Deprecation Notice","Trying to set undefined value in plugin "+e):void DataStore.setPluginData(e,t,a)}static delete(e,t){Utils.warn("Deprecation Notice",`${e}, please use BdApi.deleteData(). bdPluginStorage may be removed in future versions.`),DataStore.deletePluginData(e,t)}};var settingsPanel,emoteModule,quickEmoteMenu,voiceMode,pluginModule,themeModule,dMode,publicServersModule,mainCore,minSupportedVersion="0.3.0",bbdVersion="0.2.24",bbdChangelog={description:"Mostly behind the scenes changes here.",changes:[{title:"What's New?",items:["**Dark Mode is back!** Or rather... it's toggleable again and no longer forced on.","**Changes for developers!** Plugin and theme developers will now have more options to customize their plugin cards in their METAs and also a new META structure."]},{title:"Fixes",type:"fixed",items:["**Emote Menu** should now show both Twich Global emotes and your favorites, you should even be able to click on them again!"]},{title:"Minor Stuff",type:"improved",items:["**Clean Code.** Well not really. But BD's code is starting to be cleaned up to make it easier to maintain and better performing."]}]},settings={"Custom css live update":{id:"bda-css-0",info:"",implemented:!0,hidden:!0,cat:"core"},"Custom css auto udpate":{id:"bda-css-1",info:"",implemented:!0,hidden:!0,cat:"core"},"BetterDiscord Blue":{id:"bda-gs-b",info:"Replace Discord blue with BD Blue",implemented:!1,hidden:!1,cat:"core"},"Public Servers":{id:"bda-gs-1",info:"Display public servers button",implemented:!0,hidden:!1,cat:"core",category:"modules"},"Minimal Mode":{id:"bda-gs-2",info:"Hide elements and reduce the size of elements.",implemented:!0,hidden:!1,cat:"core",category:"modules"},"Voice Mode":{id:"bda-gs-4",info:"Only show voice chat",implemented:!0,hidden:!1,cat:"core",category:"modules"},"Hide Channels":{id:"bda-gs-3",info:"Hide channels in minimal mode",implemented:!0,hidden:!1,cat:"core",category:"modules"},"Dark Mode":{id:"bda-gs-5",info:"Make certain elements dark by default(wip)",implemented:!0,hidden:!1,cat:"core",category:"modules"},"Voice Disconnect":{id:"bda-dc-0",info:"Disconnect from voice server when closing Discord",implemented:!0,hidden:!1,cat:"core",category:"modules"},"24 Hour Timestamps":{id:"bda-gs-6",info:"Replace 12hr timestamps with proper ones",implemented:!0,hidden:!1,cat:"core",category:"modules"},"Colored Text":{id:"bda-gs-7",info:"Make text color the same as role color",implemented:!0,hidden:!1,cat:"core",category:"modules"},"Normalize Classes":{id:"fork-ps-4",info:"Adds stable classes to elements to help themes. (e.g. adds .da-channels to .channels-Ie2l6A)",implemented:!0,hidden:!1,cat:"core",category:"modules"},"Content Error Modal":{id:"fork-ps-1",info:"Shows a modal with plugin/theme errors",implemented:!0,hidden:!1,cat:"core",category:"content manager"},"Show Toasts":{id:"fork-ps-2",info:"Shows a small notification for important information",implemented:!0,hidden:!1,cat:"core",category:"content manager"},"Scroll To Settings":{id:"fork-ps-3",info:"Auto-scrolls to a plugin's settings when the button is clicked (only if out of view)",implemented:!0,hidden:!1,cat:"core",category:"content manager"},"Automatic Loading":{id:"fork-ps-5",info:"Automatically loads, reloads, and unloads plugins and themes",implemented:!0,hidden:!1,cat:"core",category:"content manager"},"BBD Beta":{id:"fork-beta",info:"Gives access to BBD beta. (Requires full restart after changing.)",implemented:!0,hidden:!0,cat:"core",category:"donors"},"Developer Mode":{id:"bda-gs-8",info:"Developer Mode",implemented:!0,hidden:!1,cat:"core",category:"developer settings"},"Copy Selector":{id:"fork-dm-1",info:"Adds a \"Copy Selector\" option to context menus when developer mode is active",implemented:!0,hidden:!1,cat:"core",category:"developer settings"},"Enable Transparency":{id:"fork-wp-1",info:"Enables the main window to be see-through (requires restart)",implemented:!0,hidden:!1,cat:"core",category:"window preferences"},"Window Frame":{id:"fork-wp-2",info:"Adds the native os window frame to the main window",implemented:!1,hidden:!0,cat:"core",category:"window preferences"},"Download Emotes":{id:"fork-es-3",info:"Download emotes when the cache is expired",implemented:!0,hidden:!1,cat:"emote"},"Twitch Emotes":{id:"bda-es-7",info:"Show Twitch emotes",implemented:!0,hidden:!1,cat:"emote"},"FrankerFaceZ Emotes":{id:"bda-es-1",info:"Show FrankerFaceZ Emotes",implemented:!0,hidden:!1,cat:"emote"},"BetterTTV Emotes":{id:"bda-es-2",info:"Show BetterTTV Emotes",implemented:!0,hidden:!1,cat:"emote"},"Emote Menu":{id:"bda-es-0",info:"Show Twitch/Favourite emotes in emote menu",implemented:!0,hidden:!1,cat:"emote"},"Emoji Menu":{id:"bda-es-9",info:"Show Discord emoji menu",implemented:!0,hidden:!1,cat:"emote"},"Emote Auto Capitalization":{id:"bda-es-4",info:"Autocapitalize emote commands",implemented:!0,hidden:!1,cat:"emote"},"Show Names":{id:"bda-es-6",info:"Show emote names on hover",implemented:!0,hidden:!1,cat:"emote"},"Show emote modifiers":{id:"bda-es-8",info:"Enable emote mods (flip, spin, pulse, spin2, spin3, 1spin, 2spin, 3spin, tr, bl, br, shake, shake2, shake3, flap)",implemented:!0,hidden:!1,cat:"emote"},"Animate On Hover":{id:"fork-es-2",info:"Only animate the emote modifiers on hover",implemented:!0,hidden:!1,cat:"emote"}},defaultCookie={"bda-gs-1":!0,"bda-gs-2":!1,"bda-gs-3":!1,"bda-gs-4":!1,"bda-gs-5":!0,"bda-gs-6":!1,"bda-gs-7":!1,"bda-gs-8":!1,"bda-es-0":!0,"bda-es-1":!0,"bda-es-2":!0,"bda-es-4":!1,"bda-es-6":!0,"bda-es-7":!0,"bda-gs-b":!1,"bda-es-8":!0,"bda-dc-0":!1,"bda-css-0":!1,"bda-css-1":!1,"bda-es-9":!0,"fork-dm-1":!1,"fork-ps-1":!0,"fork-ps-2":!0,"fork-ps-3":!0,"fork-ps-4":!0,"fork-ps-5":!0,"fork-es-2":!1,"fork-es-3":!0,"fork-wp-1":!1,"fork-wp-2":!1,"fork-beta":!1},settingsCookie={},bdpluginErrors=[],bdthemeErrors=[],bdConfig=null;function Core(e){window.bdConfig=e}Core.prototype.init=async function(){if(bdConfig.version<minSupportedVersion)return void this.alert("Not Supported","BetterDiscord v"+bdConfig.version+" (your version) is not supported by the latest js ("+bbdVersion+").<br><br> Please download the latest version from <a href='https://github.com/rauenzi/BetterDiscordApp/releases/latest' target='_blank'>GitHub</a>");if(window.ED)return void this.alert("Not Supported","BandagedBD does not work with EnhancedDiscord. Please uninstall one of them.");if(window.WebSocket&&window.WebSocket.name&&window.WebSocket.name.includes("Patched"))return void this.alert("Not Supported","BandagedBD does not work with Powercord. Please uninstall one of them.");const e=bdConfig.updater?bdConfig.updater.LatestVersion:bdConfig.latestVersion;e>bdConfig.version&&this.alert("Update Available",`
An update for BandagedBD is available (${e})! Please Reinstall!<br /><br />
<a href='https://github.com/rauenzi/BetterDiscordApp/releases/latest' target='_blank'>Download Installer</a>
`),Utils.log("Startup","Initializing Settings"),this.initSettings(),emoteModule=new EmoteModule,quickEmoteMenu=new QuickEmoteMenu,Utils.log("Startup","Initializing EmoteModule"),window.emotePromise=emoteModule.init().then(()=>{emoteModule.initialized=!0,Utils.log("Startup","Initializing QuickEmoteMenu"),quickEmoteMenu.init()}),publicServersModule=new V2_PublicServers,voiceMode=new VoiceMode,dMode=new devMode,this.injectExternals(),await this.checkForGuilds(),BDV2.initialize(),Utils.log("Startup","Updating Settings"),settingsPanel=new V2_SettingsPanel,settingsPanel.initializeSettings(),Utils.log("Startup","Loading Plugins"),pluginModule=new PluginModule,pluginModule.loadPlugins(),Utils.log("Startup","Loading Themes"),themeModule=new ThemeModule,themeModule.loadThemes(),$("#customcss").detach().appendTo(document.head),window.addEventListener("beforeunload",function(){settingsCookie["bda-dc-0"]&&document.querySelector(".btn.btn-disconnect").click()}),emoteModule.autoCapitalize(),Utils.log("Startup","Removing Loading Icon"),document.getElementsByClassName("bd-loaderv2")[0].remove(),Utils.log("Startup","Initializing Main Observer"),this.initObserver(),settingsCookie["fork-ps-1"]&&(Utils.log("Startup","Collecting Startup Errors"),this.showContentErrors({plugins:bdpluginErrors,themes:bdthemeErrors}));const t=DataStore.getBDData("version");bbdVersion>t&&(bbdChangelog&&this.showChangelogModal(bbdChangelog),DataStore.setBDData("version",bbdVersion))},Core.prototype.checkForGuilds=function(){let e=0;return new Promise(t=>{const a=function(){const n=BDV2.guildClasses.wrapper.split(" ")[0];0<document.querySelectorAll(`.${n}`).length&&e++;const o=BDV2.guildClasses.listItem.split(" ")[0],s=BDV2.guildClasses.blobContainer.split(" ")[0];if(0<document.querySelectorAll(`.${n} .${o} .${s}`).length)return t(bdConfig.deferLoaded=!0);return 50<=e?t(bdConfig.deferLoaded=!0):void setTimeout(a,100)};$(document).ready(function(){setTimeout(a,100)})})},Core.prototype.injectExternals=async function(){await Utils.injectJs("https://cdnjs.cloudflare.com/ajax/libs/ace/1.2.9/ace.js"),require.original&&(window.require=require.original)},Core.prototype.initSettings=function(){if(DataStore.initialize(),!DataStore.getSettingGroup("settings"))settingsCookie=defaultCookie,this.saveSettings();else for(var e in this.loadSettings(),$("<style id=\"customcss\">").text(atob(DataStore.getBDData("bdcustomcss"))).appendTo(document.head),defaultCookie)null==settingsCookie[e]&&(settingsCookie[e]=defaultCookie[e],this.saveSettings())},Core.prototype.saveSettings=function(){DataStore.setSettingGroup("settings",settingsCookie)},Core.prototype.loadSettings=function(){settingsCookie=DataStore.getSettingGroup("settings")},Core.prototype.initObserver=function(){const e=new MutationObserver(e=>{for(let t,a=0,n=e.length;a<n;a++){if(t=e[a],"undefined"!=typeof pluginModule&&pluginModule.rawObserver(t),!t.addedNodes.length||!(t.addedNodes[0]instanceof Element))continue;let n=t.addedNodes[0];n.classList.contains("layer-3QrUeG")&&(n.getElementsByClassName("guild-settings-base-section").length&&n.setAttribute("layer-id","server-settings"),n.getElementsByClassName("socialLinks-3jqNFy").length&&(n.setAttribute("layer-id","user-settings"),n.setAttribute("id","user-settings"),!document.getElementById("bd-settings-sidebar")&&settingsPanel.renderSidebar())),n.parentElement==document.body&&n.querySelector("#ace_settingsmenu")&&(n.id="ace_settingsmenu_container"),n.classList.contains("layer-v9HyYc")&&n.getElementsByClassName("emojiPicker-3m1S-j").length&&!n.querySelector(".emojiPicker-3m1S-j").parentElement.classList.contains("animatorLeft-1EQxU0")&&quickEmoteMenu.obsCallback(n)}});e.observe(document,{childList:!0,subtree:!0})},Core.prototype.inject24Hour=function(){if(this.cancel24Hour)return;const e=/([0-9]{1,2}):([0-9]{1,2})\s(AM|PM)/,t=t=>{if(settingsCookie["bda-gs-6"]){const a=t.returnValue.match(e);return a&&4===a.length?"AM"===a[3]?t.returnValue=t.returnValue.replace(a[0],`${"12"===a[1]?"00":a[1].padStart(2,"0")}:${a[2]}`):t.returnValue=t.returnValue.replace(a[0],`${"12"===a[1]?"12":parseInt(a[1])+12}:${a[2]}`):void 0}},a=Utils.monkeyPatch(BDV2.TimeFormatter,"calendarFormat",{after:t}),n=Utils.monkeyPatch(BDV2.TimeFormatter,"dateFormat",{after:t});this.cancel24Hour=()=>{a(),n()}},Core.prototype.injectColoredText=function(){this.cancelColoredText||!BDV2.MessageComponent||(this.cancelColoredText=Utils.monkeyPatch(BDV2.MessageComponent,"default",{before:e=>{const t=e.methodArguments[0];if(!t||!t.childrenMessageContent)return;const a=t.childrenMessageContent;if(!a.type||!a.type.type||"MessageContent"!=a.type.type.displayName)return;const n=a.type.type;n.__originalMethod||(a.type.type=function(e){const t=n(e),a=settingsCookie["bda-gs-7"]?e.message.colorString||"":"";return t.props.style={color:a},t},a.type.type.__originalMethod=n,Object.assign(a.type.type,n))}}))},Core.prototype.removeColoredText=function(){document.querySelectorAll(".markup-2BOw-j").forEach(e=>{e.style.setProperty("color","")})},Core.prototype.alert=function(e,t){let a=$(`<div class="bd-modal-wrapper theme-dark">
<div class="bd-backdrop backdrop-1wrmKB"></div>
<div class="bd-modal modal-1UGdnR">
<div class="bd-modal-inner inner-1JeGVc">
<div class="header header-1R_AjF">
<div class="title">${e}</div>
</div>
<div class="bd-modal-body">
<div class="scroller-wrap fade">
<div class="scroller">
${t}
</div>
</div>
</div>
<div class="footer footer-2yfCgX">
<button type="button">Okay</button>
</div>
</div>
</div>
</div>`);a.find(".footer button").on("click",()=>{a.addClass("closing"),setTimeout(()=>{a.remove()},300)}),a.find(".bd-backdrop").on("click",()=>{a.addClass("closing"),setTimeout(()=>{a.remove()},300)}),a.appendTo("#app-mount")},Core.prototype.showContentErrors=function({plugins:e=[],themes:t=[]}){function a(e){let t=$(`<div class="errors">`);for(let a of e){let e=$(`<div class="error">
<div class="table-column column-name">${a.name?a.name:a.file}</div>
<div class="table-column column-message">${a.message}</div>
<div class="table-column column-error"><a class="error-link" href="">${a.error?a.error.message:""}</a></div>
</div>`);t.append(e),a.error&&e.find("a").on("click",t=>{t.preventDefault(),Utils.err("ContentManager",`Error details for ${a.name?a.name:a.file}.`,a.error)})}return t}if(!e||!t)return;if(!e.length&&!t.length)return;let n=$(`<div class="bd-modal-wrapper theme-dark">
<div class="bd-backdrop backdrop-1wrmKB"></div>
<div class="bd-modal bd-content-modal modal-1UGdnR">
<div class="bd-modal-inner inner-1JeGVc">
<div class="header header-1R_AjF"><div class="title">Content Errors</div></div>
<div class="bd-modal-body">
<div class="tab-bar-container">
<div class="tab-bar TOP">
<div class="tab-bar-item">Plugins</div>
<div class="tab-bar-item">Themes</div>
</div>
</div>
<div class="table-header">
<div class="table-column column-name">Name</div>
<div class="table-column column-message">Message</div>
<div class="table-column column-error">Error</div>
</div>
<div class="scroller-wrap fade">
<div class="scroller">
</div>
</div>
</div>
<div class="footer footer-2yfCgX">
<button type="button">Okay</button>
</div>
</div>
</div>
</div>`),o=[a(e),a(t)];n.find(".tab-bar-item").on("click",t=>{t.preventDefault(),n.find(".tab-bar-item").removeClass("selected"),$(t.target).addClass("selected"),n.find(".scroller").empty().append(o[$(t.target).index()])}),n.find(".footer button").on("click",()=>{n.addClass("closing"),setTimeout(()=>{n.remove()},300)}),n.find(".bd-backdrop").on("click",()=>{n.addClass("closing"),setTimeout(()=>{n.remove()},300)}),n.appendTo("#app-mount"),e.length?n.find(".tab-bar-item")[0].click():n.find(".tab-bar-item")[1].click()},Core.prototype.showToast=function(e,t={}){if(!bdConfig.deferLoaded)return;if(!document.querySelector(".bd-toasts")){let e=document.createElement("div");e.classList.add("bd-toasts");let t=document.querySelector(".chat-3bRxxu form, #friends, .noChannel-Z1DQK7, .activityFeed-28jde9");e.style.setProperty("left",t?t.getBoundingClientRect().left+"px":"0px"),e.style.setProperty("width",t?t.offsetWidth+"px":"100%"),e.style.setProperty("bottom",(document.querySelector(".chat-3bRxxu form")?document.querySelector(".chat-3bRxxu form").offsetHeight:80)+"px"),document.querySelector(".app, .app-2rEoOp").appendChild(e)}const{type:a="",icon:n=!0,timeout:o=3e3}=t;let s=document.createElement("div");s.classList.add("bd-toast"),a&&s.classList.add("toast-"+a),a&&n&&s.classList.add("icon"),s.innerText=e,document.querySelector(".bd-toasts").appendChild(s),setTimeout(()=>{s.classList.add("closing"),setTimeout(()=>{s.remove(),document.querySelectorAll(".bd-toasts .bd-toast").length||document.querySelector(".bd-toasts").remove()},300)},o)},Core.prototype.showChangelogModal=function(e={}){const t=BdApi.findModuleByProps("push","update","pop","popWithKey"),a=BdApi.findModuleByProps("fixed","improved"),n=BdApi.findModuleByProps("Sizes","Weights"),o=BdApi.findModuleByProps("Child"),s=BdApi.findModuleByProps("Tags","default"),r=BdApi.findModule(e=>e.defaultProps&&!1==e.defaultProps.selectable),l=BdApi.findModuleByProps("defaultRules","parse");if(!r||!t||!a||!n||!o||!s||!l)return;const{image:c="https://repository-images.githubusercontent.com/105473537/957b5480-7c26-11e9-8401-50fa820cbae5",description:p="",changes:m=[],title:u="BandagedBD",subtitle:h=`v${bbdVersion}`,footer:d}=e,g=BdApi.React.createElement,i=[g("img",{src:c})];p&&i.push(g("p",null,l.parse(p)));for(let t=0;t<m.length;t++){const e=m[t],n=a[e.type]?a[e.type]:a.added,o=0==t?a.marginTop:"";i.push(g("h1",{className:`${n} ${o}`},e.title));const s=g("ul",null,e.items.map(e=>g("li",null,l.parse(e))));i.push(s)}const f=function(){return g(o.Child,{grow:1,shrink:1},g(s.default,{tag:s.Tags.H4},u),g(n,{size:n.Sizes.SMALL,color:n.Colors.PRIMARY,className:a.date},h))},b=()=>{const e=BdApi.findModule(e=>"Anchor"==e.displayName),a=BdApi.findModuleByProps("anchorUnderlineOnHover")||{anchor:"anchor-3Z-8Bb",anchorUnderlineOnHover:"anchorUnderlineOnHover-2ESHQB"},s=e=>{e.preventDefault(),e.stopPropagation(),t.pop(),BDV2.joinBD2()},r=e?g(e,{onClick:s},"Join our Discord Server."):g("a",{className:`${a.anchor} ${a.anchorUnderlineOnHover}`,onClick:s},"Join our Discord Server."),i=g(n,{size:n.Sizes.SMALL,color:n.Colors.PRIMARY},"Need support? ",r);return g(o.Child,{grow:1,shrink:1},d?d:i)};t.push(function(e){return g(r,Object.assign({className:a.container,selectable:!0,onScroll:e=>e,onClose:e=>e,renderHeader:f,renderFooter:b,children:i},e))})},window.emotesFfz={},window.emotesBTTV={},window.emotesBTTV2={},window.emotesTwitch={},window.subEmotesTwitch={},window.bdEmotes={TwitchGlobal:{},TwitchSubscriber:{},BTTV:{},FrankerFaceZ:{},BTTV2:{}},window.bdEmoteSettingIDs={TwitchGlobal:"bda-es-7",TwitchSubscriber:"bda-es-7",BTTV:"bda-es-2",FrankerFaceZ:"bda-es-1",BTTV2:"bda-es-2"};function EmoteModule(){Object.defineProperty(this,"categories",{get:function(){const e=[];for(const t in window.bdEmoteSettingIDs)settingsCookie[window.bdEmoteSettingIDs[t]]&&e.push(t);return e}})}EmoteModule.prototype.init=async function(){this.modifiers=["flip","spin","pulse","spin2","spin3","1spin","2spin","3spin","tr","bl","br","shake","shake2","shake3","flap"],this.overrides=["twitch","bttv","ffz"];let e={TwitchGlobal:{url:`https://rauenzi.github.io/BetterDiscordApp/data/emotedata_twitch_global.json`,variable:"TwitchGlobal",oldVariable:"emotesTwitch",getEmoteURL:t=>`https://static-cdn.jtvnw.net/emoticons/v1/${t}/1.0`},TwitchSubscriber:{url:`https://rauenzi.github.io/BetterDiscordApp/data/emotedata_twitch_subscriber.json`,variable:"TwitchSubscriber",oldVariable:"subEmotesTwitch",getEmoteURL:t=>`https://static-cdn.jtvnw.net/emoticons/v1/${t}/1.0`},FrankerFaceZ:{url:`https://rauenzi.github.io/BetterDiscordApp/data/emotedata_ffz.json`,variable:"FrankerFaceZ",oldVariable:"emotesFfz",getEmoteURL:t=>`https://cdn.frankerfacez.com/emoticon/${t}/1`},BTTV:{url:`https://rauenzi.github.io/BetterDiscordApp/data/emotedata_bttv.json`,variable:"BTTV",oldVariable:"emotesBTTV",getEmoteURL:t=>`https://cdn.betterttv.net/emote/${t}/1x`},BTTV2:{url:`https://rauenzi.github.io/BetterDiscordApp/data/emotedata_bttv2.json`,variable:"BTTV2",oldVariable:"emotesBTTV2",getEmoteURL:t=>`https://cdn.betterttv.net/emote/${t}/1x`}};for(await this.getBlacklist(),await this.loadEmoteData(e);!BDV2.MessageComponent;)await new Promise(e=>setTimeout(e,100));this.cancelEmoteRender||(this.cancelEmoteRender=Utils.monkeyPatch(BDV2.MessageComponent,"default",{before:({methodArguments:e})=>{const t=e[0].childrenMessageContent.props.content;if(t&&t.length){for(let e=0;e<t.length;e++){const a=t[e];if("string"!=typeof a)continue;const n=a.split(/([^\s]+)([\s]|$)/g);for(let a=0,o=this.categories.length;a<o;a++)for(let o=0,s=n.length;o<s;o++){let s=n[o],r=s.split(":"),i=r[0],l=r[1]?r[1]:"",d=l.slice(0);if(4>i.length||bemotes.includes(i))continue;this.modifiers.includes(l)&&settingsCookie["bda-es-8"]||(l=""),this.overrides.includes(d)?l=d:d="";let c=this.categories[a];if("twitch"===d?window.bdEmotes.TwitchGlobal[i]?c="TwitchGlobal":window.bdEmotes.TwitchSubscriber[i]&&(c="TwitchSubscriber"):"bttv"===d?window.bdEmotes.BTTV[i]?c="BTTV":window.bdEmotes.BTTV2[i]&&(c="BTTV2"):"ffz"===d&&window.bdEmotes.FrankerFaceZ[i]&&(c="FrankerFaceZ"),!window.bdEmotes[c][i]||!settingsCookie[window.bdEmoteSettingIDs[c]])continue;const p=t[e].match(new RegExp(`([\\s]|^)${Utils.escape(l?i+":"+l:i)}([\\s]|$)`));if(!p)continue;const m=t[e].substring(0,p.index+p[1].length),u=t[e].substring(p.index+p[0].length-p[2].length);t[e]=m;const h=BDV2.react.createElement(BDEmote,{name:i,url:window.bdEmotes[c][i],modifier:l});t.splice(e+1,0,u),t.splice(e+1,0,h)}}const e=t.every(e=>"string"==typeof e&&""==e.replace(/\s*/,"")||!!(e.type&&"BDEmote"==e.type.name)||!!(e.props&&e.props.children&&e.props.children.props&&e.props.children.props.emojiName));if(e)for(let e of t)"object"==typeof e&&("BDEmote"==e.type.name?e.props.jumboable=!0:e.props&&e.props.children&&e.props.children.props&&e.props.children.props.emojiName&&(e.props.children.props.jumboable=!0))}}}))},EmoteModule.prototype.disable=function(){this.disableAutoCapitalize();this.cancelEmoteRender||(this.cancelEmoteRender(),this.cancelEmoteRender=null)},EmoteModule.prototype.clearEmoteData=async function(){let e=require("fs"),t=bdConfig.dataPath+"emote_data.json",a=e.existsSync(t);a&&e.unlinkSync(t),DataStore.setBDData("emoteCacheDate",new Date().toJSON()),window.bdEmotes={TwitchGlobal:{},TwitchSubscriber:{},BTTV:{},FrankerFaceZ:{},BTTV2:{}}},EmoteModule.prototype.isCacheValid=function(){const e=DataStore.getBDData("emoteCacheDays")||DataStore.setBDData("emoteCacheDays",7)||7,t=new Date(DataStore.getBDData("emoteCacheDate")||null),a=new Date,n=Math.round(Math.abs((a.getTime()-t.getTime())/86400000));return!(n>e)||(DataStore.setBDData("emoteCacheDate",a.toJSON()),!1)},EmoteModule.prototype.loadEmoteData=async function(t){const a=require("fs"),e=bdConfig.dataPath+"emote_data.json",n=await new Promise(t=>a.exists(e,t));if(n&&this.isCacheValid()){settingsCookie["fork-ps-2"]&&mainCore.showToast("Loading emotes from cache.",{type:"info"}),Utils.log("Emotes","Loading emotes from local cache.");const n=await new Promise(t=>{a.readFile(e,"utf8",(e,a)=>{Utils.log("Emotes","Emote file read."),e&&(a={}),t(a)})}),o=Utils.testJSON(n);let s=!!o;for(const a in s&&(window.bdEmotes=o),t)s=0<Object.keys(window.bdEmotes[t[a].variable]).length;if(s)return void(settingsCookie["fork-ps-2"]&&mainCore.showToast("Emotes successfully loaded.",{type:"success"}));Utils.log("Emotes","Cache was corrupt, downloading..."),await new Promise(t=>a.unlink(e,t))}if(settingsCookie["fork-es-3"]){for(let a in settingsCookie["fork-ps-2"]&&mainCore.showToast("Downloading emotes in the background do not reload.",{type:"info"}),t){await new Promise(e=>setTimeout(e,1e3));let e=await this.downloadEmotes(t[a]);window.bdEmotes[t[a].variable]=e}settingsCookie["fork-ps-2"]&&mainCore.showToast("All emotes successfully downloaded.",{type:"success"});try{await new Promise(t=>a.writeFile(e,JSON.stringify(window.bdEmotes),"utf8",t))}catch(e){Utils.err("Emotes","Could not save emote data.",e)}}},EmoteModule.prototype.downloadEmotes=function(e){let t=require("request"),a={url:e.url,timeout:e.timeout?e.timeout:5e3,json:!0};return Utils.log("Emotes",`Downloading: ${e.variable} (${e.url})`),new Promise((n,o)=>{t(a,(t,a,s)=>{if(t)return Utils.err("Emotes","Could not download "+e.variable,t),e.backup?(e.url=e.backup,e.backup=null,e.backupParser&&(e.parser=e.backupParser),n(this.downloadEmotes(e))):o({});for(let n in"function"==typeof e.parser&&(s=e.parser(s)),s){if(4>n.length||bemotes.includes(n)){delete s[n];continue}s[n]=e.getEmoteURL(s[n])}n(s),Utils.log("Emotes","Downloaded: "+e.variable)})})},EmoteModule.prototype.getBlacklist=function(){return new Promise(e=>{$.getJSON(`https://rauenzi.github.io/BetterDiscordApp/data/emotefilter.json`,function(t){e(bemotes=t.blacklist)})})};var bemotes=[];EmoteModule.prototype.autoCapitalize=function(){!settingsCookie["bda-es-4"]||this.autoCapitalizeActive||($("body").on("keyup.bdac change.bdac paste.bdac",$(".channelTextArea-rNsIhG textarea:first"),()=>{var e=$(".channelTextArea-rNsIhG textarea:first").val();if(null!=e){var t=e.split(" ").pop();if(3<t.length){if("danSgame"==t)return;var a=this.capitalize(t.toLowerCase());null!==a&&void 0!==a&&Utils.insertText(Utils.getTextArea()[0],e.replace(t,a))}}}),this.autoCapitalizeActive=!0)},EmoteModule.prototype.capitalize=function(e){var t=window.bdEmotes.TwitchGlobal;for(var a in t)if(t.hasOwnProperty(a)&&e==(a+"").toLowerCase())return a},EmoteModule.prototype.disableAutoCapitalize=function(){this.autoCapitalizeActive=!1,$("body").off(".bdac")};function QuickEmoteMenu(){}QuickEmoteMenu.prototype.init=function(){this.initialized=!0,$(document).on("mousedown",function(t){"rmenu"!=t.target.id&&$("#rmenu").remove()}),this.favoriteEmotes={};var e=DataStore.getBDData("bdfavemotes");""!==e&&null!==e&&(this.favoriteEmotes=JSON.parse(atob(e)));var t="";t+="<div id=\"bda-qem\">",t+=" <button class=\"active\" id=\"bda-qem-twitch\" onclick='quickEmoteMenu.switchHandler(this); return false;'>Twitch</button>",t+=" <button id=\"bda-qem-favourite\" onclick='quickEmoteMenu.switchHandler(this); return false;'>Favourite</button>",t+=" <button id=\"bda-qem-emojis\" onclick='quickEmoteMenu.switchHandler(this); return false;'>Emojis</buttond>",t+="</div>",this.qmeHeader=t;var a="";a+="<div id=\"bda-qem-twitch-container\">",a+=" <div class=\"scroller-wrap scrollerWrap-2lJEkd fade\">",a+=" <div class=\"scroller scroller-2FKFPG\">",a+=" <div class=\"emote-menu-inner\">";var n="";for(let e in window.bdEmotes.TwitchGlobal)window.bdEmotes.TwitchGlobal.hasOwnProperty(e)&&(n=window.bdEmotes.TwitchGlobal[e],a+="<div class=\"emote-container\">",a+=" <img class=\"emote-icon\" alt=\"\" src=\""+n+"\" title=\""+e+"\">",a+=" </img>",a+="</div>");a+=" </div>",a+=" </div>",a+=" </div>",a+="</div>",this.teContainer=a;var o="";for(let e in o+="<div id=\"bda-qem-favourite-container\">",o+=" <div class=\"scroller-wrap scrollerWrap-2lJEkd fade\">",o+=" <div class=\"scroller scroller-2FKFPG\">",o+=" <div class=\"emote-menu-inner\">",this.favoriteEmotes)n=this.favoriteEmotes[e],o+="<div class=\"emote-container\">",o+=" <img class=\"emote-icon\" alt=\"\" src=\""+n+"\" title=\""+e+"\" oncontextmenu='quickEmoteMenu.favContext(event, this);'>",o+=" </img>",o+="</div>";o+=" </div>",o+=" </div>",o+=" </div>",o+="</div>",this.faContainer=o},QuickEmoteMenu.prototype.favContext=function(t,e){t.stopPropagation();var a=$("<div>",{id:"removemenu","data-emoteid":$(e).prop("title"),text:"Remove",class:"bd-context-menu context-menu theme-dark"});return a.css({top:t.pageY-$("#bda-qem-favourite-container").offset().top,left:t.pageX-$("#bda-qem-favourite-container").offset().left}),$(e).parent().append(a),a.on("click",function(t){return t.preventDefault(),t.stopPropagation(),$(this).remove(),delete quickEmoteMenu.favoriteEmotes[$(this).data("emoteid")],quickEmoteMenu.updateFavorites(),!1}),!1},QuickEmoteMenu.prototype.switchHandler=function(t){this.switchQem($(t).attr("id"))},QuickEmoteMenu.prototype.switchQem=function(e){var t=$("#bda-qem-twitch"),a=$("#bda-qem-favourite"),n=$("#bda-qem-emojis");t.removeClass("active"),a.removeClass("active"),n.removeClass("active"),$(".emojiPicker-3m1S-j").hide(),$("#bda-qem-favourite-container").hide(),$("#bda-qem-twitch-container").hide();"bda-qem-twitch"===e?(t.addClass("active"),$("#bda-qem-twitch-container").show()):"bda-qem-favourite"===e?(a.addClass("active"),$("#bda-qem-favourite-container").show()):"bda-qem-emojis"===e?(n.addClass("active"),$(".emojiPicker-3m1S-j").show(),$(".emojiPicker-3m1S-j input").focus()):void 0;this.lastTab=e;var o=$(".emote-icon");o.off(),o.on("click",function(){var e=$(this).attr("title");const t=document.querySelector(`.${BDV2.slateEditorClasses.slateTextArea.split(" ")[0]}`);if(t){const a=BdApi.getInternalInstance(t),n=Utils.getNestedProp(a,"memoizedProps.children.props.editor.insertText");n&&n(` ${e} `)}else{var a=Utils.getTextArea();Utils.insertText(a[0]," "==a.val().slice(-1)?a.val()+e:a.val()+" "+e)}})},QuickEmoteMenu.prototype.obsCallback=function(t){if(this.initialized){var a=$(t);settingsCookie["bda-es-9"]?a.removeClass("bda-qme-hidden"):a.addClass("bda-qme-hidden"),settingsCookie["bda-es-0"]&&(a.prepend(this.qmeHeader),a.append(this.teContainer),a.append(this.faContainer),null==this.lastTab&&(this.lastTab="bda-qem-emojis"),this.switchQem(this.lastTab))}},QuickEmoteMenu.prototype.favorite=function(e,t){this.favoriteEmotes.hasOwnProperty(e)||(this.favoriteEmotes[e]=t),this.updateFavorites()},QuickEmoteMenu.prototype.updateFavorites=function(){var e="";for(var t in e+="<div id=\"bda-qem-favourite-container\">",e+=" <div class=\"scroller-wrap scrollerWrap-2lJEkd fade\">",e+=" <div class=\"scroller scroller-2FKFPG\">",e+=" <div class=\"emote-menu-inner\">",this.favoriteEmotes){var a=this.favoriteEmotes[t];e+="<div class=\"emote-container\">",e+=" <img class=\"emote-icon\" alt=\"\" src=\""+a+"\" title=\""+t+"\" oncontextmenu=\"quickEmoteMenu.favContext(event, this);\">",e+=" </img>",e+="</div>"}e+=" </div>",e+=" </div>",e+=" </div>",e+="</div>",this.faContainer=e,$("#bda-qem-favourite-container").replaceWith(e),DataStore.setBDData("bdfavemotes",btoa(JSON.stringify(this.favoriteEmotes)))};var Utils=class{static get screenWidth(){return Math.max(document.documentElement.clientWidth,window.innerWidth||0)}static get screenHeight(){return Math.max(document.documentElement.clientHeight,window.innerHeight||0)}static stripBOM(e){return 65279===e.charCodeAt(0)&&(e=e.slice(1)),e}static getTextArea(){return $(".channelTextArea-rNsIhG textarea")}static insertText(e,t){e.focus(),e.selectionStart=0,e.selectionEnd=e.value.length,document.execCommand("insertText",!1,t)}static injectCss(e){$("<link/>",{type:"text/css",rel:"stylesheet",href:e}).appendTo($("head"))}static injectJs(e){return new Promise(t=>{$("<script/>",{type:"text/javascript",src:e,onload:t}).appendTo($("body"))})}static escapeID(e){return e.replace(/^[^a-z]+|[^\w-]+/gi,"-")}static log(e,t){console.log(`%c[BandagedBD]%c [${e}]%c ${t}`,"color: #3a71c1; font-weight: 700;","color: #3a71c1;","")}static warn(e,t){console.warn(`%c[BandagedBD]%c [${e}]%c ${t}`,"color: #E8A400; font-weight: 700;","color: #E8A400;","")}static err(e,t,a){console.log(`%c[BandagedBD]%c [${e}]%c ${t}`,"color: red; font-weight: 700;","color: red;",""),a&&(console.groupCollapsed("%cError: "+a.message,"color: red;"),console.error(a.stack),console.groupEnd())}static escape(e){return e.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}static testJSON(e){try{return JSON.parse(e)}catch(e){return!1}}static isEmpty(e){if(null==e||e==null||""==e)return!0;if("object"!=typeof e)return!1;if(Array.isArray(e))return 0==e.length;for(const t in e)if(e.hasOwnProperty(t))return!1;return!0}static suppressErrors(e,t){return(...a)=>{try{return e(...a)}catch(a){this.err("SuppressedError","Error occurred in "+t,a)}}}static monkeyPatch(e,t,a){const{before:n,after:o,instead:s,once:r=!1,silent:i=!1,force:l=!1}=a,d=a.displayName||e.displayName||e[t].displayName||e.name||e.constructor.displayName||e.constructor.name;if(i||console.log("patch",t,"of",d),!e[t])if(l)e[t]=function(){};else return console.error(t,"does not exist for",d);const c=e[t],p=()=>{i||console.log("unpatch",t,"of",d),e[t]=c};return e[t]=function(){const a={thisObject:this,methodArguments:arguments,cancelPatch:p,originalMethod:c,callOriginalMethod:()=>a.returnValue=a.originalMethod.apply(a.thisObject,a.methodArguments)};if(s){const n=Utils.suppressErrors(s,"`instead` callback of "+e[t].displayName)(a);void 0!==n&&(a.returnValue=n)}else n&&Utils.suppressErrors(n,"`before` callback of "+e[t].displayName)(a),a.callOriginalMethod(),o&&Utils.suppressErrors(o,"`after` callback of "+e[t].displayName)(a);return r&&p(),a.returnValue},Object.assign(e[t],c),e[t].__monkeyPatched=!0,e[t].displayName=d,e[t].__originalMethod||(e[t].__originalMethod=c,e[t].toString=function(){return c.toString()}),p}static onRemoved(e,t){const a=new MutationObserver(n=>{for(let o=0;o<n.length;o++){const s=n[o],r=Array.from(s.removedNodes),i=-1<r.indexOf(e),l=r.some(t=>t.contains(e));(i||l)&&(a.disconnect(),t())}});a.observe(document.body,{subtree:!0,childList:!0})}static getNestedProp(e,t){return t.split(/\s?\.\s?/).reduce(function(e,t){return e&&e[t]},e)}};function VoiceMode(){}VoiceMode.prototype.enable=function(){$(".scroller.guild-channels ul").first().css("display","none"),$(".scroller.guild-channels header").first().css("display","none"),$(".app.flex-vertical, .app-2rEoOp").first().css("overflow","hidden"),$(".chat-3bRxxu").first().css("visibility","hidden").css("min-width","0px"),$(".flex-vertical.channels-wrap").first().css("flex-grow","100000"),$(".guild-header .btn.btn-hamburger").first().css("visibility","hidden")},VoiceMode.prototype.disable=function(){$(".scroller.guild-channels ul").first().css("display",""),$(".scroller.guild-channels header").first().css("display",""),$(".app.flex-vertical, .app-2rEoOp").first().css("overflow",""),$(".chat-3bRxxu").first().css("visibility","").css("min-width",""),$(".flex-vertical.channels-wrap").first().css("flex-grow",""),$(".guild-header .btn.btn-hamburger").first().css("visibility","")},window.bdthemes={},window.bdplugins={};var ContentManager=(()=>{const e=require("path"),t=require("fs"),a=require("module").Module;a.globalPaths.push(e.resolve(require("electron").remote.app.getAppPath(),"node_modules"));class MetaError extends Error{constructor(e){super(e),this.name="MetaError"}}const n=a._extensions[".js"],o=a._extensions[".css"]?a._extensions[".css"]:()=>null,s=/[^\S\r\n]*?(?:\r\n|\n)[^\S\r\n]*?\*[^\S\r\n]?/,r=/^\\@/;return new class{constructor(){this.timeCache={},this.watchers={},a._extensions[".js"]=this.getContentRequire("plugin"),a._extensions[".css"]=this.getContentRequire("theme")}get pluginsFolder(){return this._pluginsFolder||(this._pluginsFolder=t.realpathSync(e.resolve(bdConfig.dataPath+"plugins/")))}get themesFolder(){return this._themesFolder||(this._themesFolder=t.realpathSync(e.resolve(bdConfig.dataPath+"themes/")))}watchContent(a){if(this.watchers[a])return;const n="plugin"===a,o=n?this.pluginsFolder:this.themesFolder,s=n?".plugin.js":".theme.css";this.watchers[a]=t.watch(o,{persistent:!1},async(a,r)=>{if(a&&r&&r.endsWith(s)){await new Promise(e=>setTimeout(e,50));try{t.statSync(e.resolve(o,r))}catch(e){return"ENOENT"===e.code?(delete this.timeCache[r],n?pluginModule.unloadPlugin(r):themeModule.unloadTheme(r)):void 0}if(t.statSync(e.resolve(o,r)).isFile()){const s=t.statSync(e.resolve(o,r));s&&s.mtime&&s.mtime.getTime()&&"number"==typeof s.mtime.getTime()&&this.timeCache[r]!=s.mtime.getTime()&&(this.timeCache[r]=s.mtime.getTime(),"rename"==a&&(n?pluginModule.loadPlugin(r):themeModule.loadTheme(r)),"change"==a&&(n?pluginModule.reloadPlugin(r):themeModule.reloadTheme(r)))}}})}unwatchContent(e){this.watchers[e]&&(this.watchers[e].close(),delete this.watchers[e])}extractMeta(e){const t=e.split("\n")[0],a=t.includes("//META");if(a)return this.parseOldMeta(e);const n=t.includes("/**");if(n)return this.parseNewMeta(e);throw new MetaError("META was not found.")}parseOldMeta(e){const t=e.split("\n")[0],a=t.substring(t.lastIndexOf("//META")+6,t.lastIndexOf("*//"));if(0>t.indexOf("META"))throw new MetaError("META was not found.");const n=Utils.testJSON(a);if(!n)throw new MetaError("META could not be parsed.");if(!n.name)throw new MetaError("META missing name data.");return n.format="json",n}parseNewMeta(e){const t=e.split("/**",2)[1].split("*/",1)[0],a={};let n="",o="";for(const i of t.split(s))if(0!==i.length)if("@"===i.charAt(0)&&" "!==i.charAt(1)){a[n]=o;const e=i.indexOf(" ");n=i.substr(1,e-1),o=i.substr(e+1)}else o+=" "+i.replace("\\n","\n").replace(r,"@");return a[n]=o.trim(),delete a[""],a.format="jsdoc",a}getContentRequire(a){const s="plugin"===a,r=this,i=s?n:o;return function(a,n){const o=s?r.pluginsFolder:r.themesFolder,l=e.resolve(o,e.basename(n));if(!t.existsSync(l)||n!==t.realpathSync(l))return Reflect.apply(i,this,arguments);let d=t.readFileSync(n,"utf8");d=Utils.stripBOM(d);const c=r.extractMeta(d);if(c.filename=e.basename(n),s||(c.css=d,"json"==c.format&&(c.css=c.css.split("\n").slice(1).join("\n")),d=`module.exports = ${JSON.stringify(c)};`),s){a._compile(d,a.filename);const e=!Utils.isEmpty(a.exports);e?(c.type=a.exports,a.exports=c,d=""):d+=`\nmodule.exports = ${JSON.stringify(c)};\nmodule.exports.type = ${c.exports||c.name};`}a._compile(d,n)}}makePlaceholderPlugin(e){return{plugin:{start:()=>{},getName:()=>e.name||e.filename,getAuthor:()=>"???",getDescription:()=>e.message?e.message:"This plugin was unable to be loaded. Check the author's page for updates.",getVersion:()=>"???"},name:e.name||e.filename,filename:e.filename,source:e.source?e.source:"",website:e.website?e.website:""}}loadContent(t,a){if("undefined"==typeof t||"undefined"==typeof a)return;const n="plugin"===a,o=n?this.pluginsFolder:this.themesFolder;try{require(e.resolve(o,t))}catch(e){return{name:t,file:t,message:"Could not be compiled.",error:{message:e.message,stack:e.stack}}}const s=require(e.resolve(o,t));if(s.id=Utils.escapeID(s.name),n){if(!s.type)return;try{s.plugin=new s.type,delete bdplugins[s.plugin.getName()],bdplugins[s.plugin.getName()]=s}catch(e){return{name:t,file:t,message:"Could not be constructed.",error:{message:e.message,stack:e.stack}}}}else delete bdthemes[s.name],bdthemes[s.name]=s}unloadContent(t,a){if("undefined"==typeof t||"undefined"==typeof a)return;const n="plugin"===a?this.pluginsFolder:this.themesFolder;try{delete require.cache[require.resolve(e.resolve(n,t))]}catch(e){return{name:t,file:t,message:"Could not be unloaded.",error:{message:e.message,stack:e.stack}}}}isLoaded(t,a){const n="plugin"===a?this.pluginsFolder:this.themesFolder;try{require.cache[require.resolve(e.resolve(n,t))]}catch(e){return!1}return!0}reloadContent(e,t){const a=this.unloadContent(e,t);return a?a:this.loadContent(e,t)}loadNewContent(a){const n="plugin"===a,o=n?".plugin.js":".theme.css",s=n?this.pluginsFolder:this.themesFolder,r=t.readdirSync(s),i=Object.values(n?bdplugins:bdthemes),l=i.filter(e=>!r.includes(e.filename)).map(e=>n?e.plugin.getName():e.name),d=r.filter(a=>!i.find(e=>e.filename==a)&&a.endsWith(o)&&t.statSync(e.resolve(s,a)).isFile());return{added:d,removed:l}}loadAllContent(a){const n="plugin"===a,o=n?".plugin.js":".theme.css",s=n?this.pluginsFolder:this.themesFolder,r=[],i=t.readdirSync(s);for(const n of i){if(!t.statSync(e.resolve(s,n)).isFile()||!n.endsWith(o))continue;const i=this.loadContent(n,a);i&&r.push(i)}return r}loadPlugins(){return this.loadAllContent("plugin")}loadThemes(){return this.loadAllContent("theme")}}})(),pluginCookie={};function PluginModule(){}PluginModule.prototype.loadPlugins=function(){this.loadPluginData(),bdpluginErrors=ContentManager.loadPlugins();for(var e=Object.keys(bdplugins),t=0;t<e.length;t++){var a,n;try{a=bdplugins[e[t]].plugin,n=a.getName(),a.load&&"function"==typeof a.load&&a.load()}catch(a){pluginCookie[n]=!1,Utils.err("Plugins",n+" could not be loaded.",a),bdpluginErrors.push({name:n,file:bdplugins[e[t]].filename,message:"load() could not be fired.",error:{message:a.message,stack:a.stack}});continue}if(pluginCookie[n]||(pluginCookie[n]=!1),pluginCookie[n])try{a.start(),settingsCookie["fork-ps-2"]&&mainCore.showToast(`${a.getName()} v${a.getVersion()} has started.`)}catch(a){pluginCookie[n]=!1,Utils.err("Plugins",n+" could not be started.",a),bdpluginErrors.push({name:n,file:bdplugins[e[t]].filename,message:"start() could not be fired.",error:{message:a.message,stack:a.stack}})}}this.savePluginData(),require("electron").remote.getCurrentWebContents().on("did-navigate-in-page",this.channelSwitch.bind(this))},PluginModule.prototype.startPlugin=function(e,t=!1){try{bdplugins[e].plugin.start(),settingsCookie["fork-ps-2"]&&!t&&mainCore.showToast(`${bdplugins[e].plugin.getName()} v${bdplugins[e].plugin.getVersion()} has started.`)}catch(a){settingsCookie["fork-ps-2"]&&!t&&mainCore.showToast(`${bdplugins[e].plugin.getName()} v${bdplugins[e].plugin.getVersion()} could not be started.`,{type:"error"}),pluginCookie[e]=!1,this.savePluginData(),Utils.err("Plugins",e+" could not be started.",a)}},PluginModule.prototype.stopPlugin=function(e,t=!1){try{bdplugins[e].plugin.stop(),settingsCookie["fork-ps-2"]&&!t&&mainCore.showToast(`${bdplugins[e].plugin.getName()} v${bdplugins[e].plugin.getVersion()} has stopped.`)}catch(a){settingsCookie["fork-ps-2"]&&!t&&mainCore.showToast(`${bdplugins[e].plugin.getName()} v${bdplugins[e].plugin.getVersion()} could not be stopped.`,{type:"error"}),Utils.err("Plugins",bdplugins[e].plugin.getName()+" could not be stopped.",a)}},PluginModule.prototype.enablePlugin=function(e,t=!1){pluginCookie[e]||(pluginCookie[e]=!0,this.savePluginData(),this.startPlugin(e,t))},PluginModule.prototype.disablePlugin=function(e,t=!1){pluginCookie[e]&&(pluginCookie[e]=!1,this.savePluginData(),this.stopPlugin(e,t))},PluginModule.prototype.togglePlugin=function(e){pluginCookie[e]?this.disablePlugin(e):this.enablePlugin(e)},PluginModule.prototype.loadPlugin=function(e){const t=ContentManager.loadContent(e,"plugin");if(t)return settingsCookie["fork-ps-1"]&&mainCore.showContentErrors({plugins:[t]}),settingsCookie["fork-ps-2"]&&BdApi.showToast(`${e} could not be loaded.`,{type:"error"}),Utils.err("ContentManager",`${e} could not be loaded.`,t);const a=Object.values(bdplugins).find(t=>t.filename==e).plugin;try{a.load&&"function"==typeof a.load&&a.load()}catch(e){settingsCookie["fork-ps-1"]&&mainCore.showContentErrors({plugins:[e]})}Utils.log("ContentManager",`${a.getName()} v${a.getVersion()} was loaded.`),settingsCookie["fork-ps-2"]&&BdApi.showToast(`${a.getName()} v${a.getVersion()} was loaded.`,{type:"success"}),BDEvents.dispatch("plugin-loaded",a.getName())},PluginModule.prototype.unloadPlugin=function(e){const t=Object.values(bdplugins).find(t=>t.filename==e)||bdplugins[e];if(t){const e=t.plugin.getName();pluginCookie[e]&&this.disablePlugin(e,!0);const a=ContentManager.unloadContent(bdplugins[e].filename,"plugin");return delete bdplugins[e],a?(settingsCookie["fork-ps-1"]&&mainCore.showContentErrors({plugins:[a]}),settingsCookie["fork-ps-2"]&&BdApi.showToast(`${e} could not be unloaded. It may have not been loaded yet.`,{type:"error"}),Utils.err("ContentManager",`${e} could not be unloaded. It may have not been loaded yet.`,a)):void(Utils.log("ContentManager",`${e} was unloaded.`),settingsCookie["fork-ps-2"]&&BdApi.showToast(`${e} was unloaded.`,{type:"success"}),BDEvents.dispatch("plugin-unloaded",e))}},PluginModule.prototype.reloadPlugin=function(e){const t=Object.values(bdplugins).find(t=>t.filename==e)||bdplugins[e];if(!t)return this.loadPlugin(e);const a=t.plugin.getName(),n=pluginCookie[a];n&&this.stopPlugin(a,!0);const o=ContentManager.reloadContent(bdplugins[a].filename,"plugin");return o?(settingsCookie["fork-ps-1"]&&mainCore.showContentErrors({plugins:[o]}),settingsCookie["fork-ps-2"]&&BdApi.showToast(`${a} could not be reloaded.`,{type:"error"}),Utils.err("ContentManager",`${a} could not be reloaded.`,o)):void(bdplugins[a].plugin.load&&"function"==typeof bdplugins[a].plugin.load&&bdplugins[a].plugin.load(),n&&this.startPlugin(a,!0),Utils.log("ContentManager",`${a} v${bdplugins[a].plugin.getVersion()} was reloaded.`),settingsCookie["fork-ps-2"]&&BdApi.showToast(`${a} v${bdplugins[a].plugin.getVersion()} was reloaded.`,{type:"success"}),BDEvents.dispatch("plugin-reloaded",a))},PluginModule.prototype.updatePluginList=function(){const e=ContentManager.loadNewContent("plugin");for(const t of e.added)this.loadPlugin(t);for(const t of e.removed)this.unloadPlugin(t)},PluginModule.prototype.loadPluginData=function(){let e=DataStore.getSettingGroup("plugins");e&&(pluginCookie=e)},PluginModule.prototype.savePluginData=function(){DataStore.setSettingGroup("plugins",pluginCookie)},PluginModule.prototype.newMessage=function(){for(var e,t=Object.keys(bdplugins),a=0;a<t.length;a++)if(e=bdplugins[t[a]].plugin,pluginCookie[e.getName()]&&"function"==typeof e.onMessage)try{e.onMessage()}catch(t){Utils.err("Plugins","Unable to fire onMessage for "+e.getName()+".",t)}},PluginModule.prototype.channelSwitch=function(){for(var e,t=Object.keys(bdplugins),a=0;a<t.length;a++)if(e=bdplugins[t[a]].plugin,pluginCookie[e.getName()]&&"function"==typeof e.onSwitch)try{e.onSwitch()}catch(t){Utils.err("Plugins","Unable to fire onSwitch for "+e.getName()+".",t)}},PluginModule.prototype.rawObserver=function(t){for(var e,a=Object.keys(bdplugins),n=0;n<a.length;n++)if(e=bdplugins[a[n]].plugin,pluginCookie[e.getName()]&&"function"==typeof e.observer)try{e.observer(t)}catch(t){Utils.err("Plugins","Unable to fire observer for "+e.getName()+".",t)}};var themeCookie={};function ThemeModule(){}ThemeModule.prototype.loadThemes=function(){this.loadThemeData(),bdthemeErrors=ContentManager.loadThemes();for(var e,t=Object.keys(bdthemes),a=0;a<t.length;a++)e=bdthemes[t[a]],themeCookie[e.name]||(themeCookie[e.name]=!1),themeCookie[e.name]&&$("head").append($("<style>",{id:e.id,text:unescape(e.css)}));for(let e in themeCookie)bdthemes[e]||delete themeCookie[e];this.saveThemeData()},ThemeModule.prototype.enableTheme=function(e,t=!1){themeCookie[e]=!0,this.saveThemeData();const a=bdthemes[e];$("head").append($("<style>",{id:a.id,text:unescape(a.css)})),settingsCookie["fork-ps-2"]&&!t&&mainCore.showToast(`${a.name} v${a.version} has been applied.`)},ThemeModule.prototype.disableTheme=function(e,t=!1){themeCookie[e]=!1,this.saveThemeData();const a=bdthemes[e];$(`#${a.id}`).remove(),settingsCookie["fork-ps-2"]&&!t&&mainCore.showToast(`${a.name} v${a.version} has been disabled.`)},ThemeModule.prototype.toggleTheme=function(e){themeCookie[e]?this.disableTheme(e):this.enableTheme(e)},ThemeModule.prototype.loadTheme=function(e){const t=ContentManager.loadContent(e,"theme");if(t)return settingsCookie["fork-ps-1"]&&mainCore.showContentErrors({themes:[t]}),settingsCookie["fork-ps-2"]&&BdApi.showToast(`${e} could not be loaded. It may not have been loaded.`,{type:"error"}),Utils.err("ContentManager",`${e} could not be loaded.`,t);const a=Object.values(bdthemes).find(t=>t.filename==e);Utils.log("ContentManager",`${a.name} v${a.version} was loaded.`),settingsCookie["fork-ps-2"]&&BdApi.showToast(`${a.name} v${a.version} was loaded.`,{type:"success"}),BDEvents.dispatch("theme-loaded",a.name)},ThemeModule.prototype.unloadTheme=function(e){const t=Object.values(bdthemes).find(t=>t.filename==e)||bdthemes[e];if(t){const e=t.name;themeCookie[e]&&this.disableTheme(e,!0);const a=ContentManager.unloadContent(bdthemes[e].filename,"theme");return delete bdthemes[e],a?(settingsCookie["fork-ps-1"]&&mainCore.showContentErrors({themes:[a]}),settingsCookie["fork-ps-2"]&&BdApi.showToast(`${e} could not be unloaded. It may have not been loaded yet.`,{type:"error"}),Utils.err("ContentManager",`${e} could not be unloaded. It may have not been loaded yet.`,a)):void(Utils.log("ContentManager",`${e} was unloaded.`),settingsCookie["fork-ps-2"]&&BdApi.showToast(`${e} was unloaded.`,{type:"success"}),BDEvents.dispatch("theme-unloaded",e))}},ThemeModule.prototype.reloadTheme=function(e){const t=Object.values(bdthemes).find(t=>t.filename==e)||bdthemes[e];if(!t)return this.loadTheme(e);const a=t.name,n=ContentManager.reloadContent(bdthemes[a].filename,"theme");return themeCookie[a]&&(this.disableTheme(a,!0),this.enableTheme(a,!0)),n?(settingsCookie["fork-ps-1"]&&mainCore.showContentErrors({themes:[n]}),settingsCookie["fork-ps-2"]&&BdApi.showToast(`${a} could not be reloaded.`,{type:"error"}),Utils.err("ContentManager",`${a} could not be reloaded.`,n)):void(Utils.log("ContentManager",`${a} v${bdthemes[a].version} was reloaded.`),settingsCookie["fork-ps-2"]&&BdApi.showToast(`${a} v${bdthemes[a].version} was reloaded.`,{type:"success"}),BDEvents.dispatch("theme-reloaded",a))},ThemeModule.prototype.updateThemeList=function(){const e=ContentManager.loadNewContent("theme");for(const t of e.added)this.loadTheme(t);for(const t of e.removed)this.unloadTheme(t)},ThemeModule.prototype.loadThemeData=function(){let e=DataStore.getSettingGroup("themes");e&&(themeCookie=e)},ThemeModule.prototype.saveThemeData=function(){DataStore.setSettingGroup("themes",themeCookie)};var BdApi={get React(){return BDV2.react},get ReactDOM(){return BDV2.reactDom},get WindowConfigFile(){if(this._windowConfigFile)return this._windowConfigFile;const e=require("electron").remote.app,t=require("path"),a=e.getAppPath(),n=e.getPath("userData"),o=t.resolve(n,e.getVersion(),"modules","discord_desktop_core","injector","config.json"),s=t.resolve(a,"..","app","config.json"),r=require("fs"),i=r.existsSync(s)?s:r.existsSync(o)?o:null;return i?this._windowConfigFile=i:this._windowConfigFile=null},getAllWindowPreferences:function(){return this.WindowConfigFile?require(this.WindowConfigFile):{}},getWindowPreference:function(e){return this.WindowConfigFile?this.getAllWindowPreferences()[e]:void 0},setWindowPreference:function(e,t){if(!this.WindowConfigFile)return;const a=require("fs"),n=this.getAllWindowPreferences();n[e]=t,delete require.cache[this.WindowConfigFile],a.writeFileSync(this.WindowConfigFile,JSON.stringify(n,null,4))},injectCSS:function(e,t){$("head").append($("<style>",{id:Utils.escapeID(e),text:t}))},clearCSS:function(e){$("#"+Utils.escapeID(e)).remove()},linkJS:function(e,t){$("head").append($("<script>",{id:Utils.escapeID(e),src:t,type:"text/javascript"}))},unlinkJS:function(e){$("#"+Utils.escapeID(e)).remove()},getPlugin:function(e){return bdplugins.hasOwnProperty(e)?bdplugins[e].plugin:null}},betterDiscordIPC=require("electron").ipcRenderer;BdApi.getIpc=function(){return Utils.warn("Deprecation Notice","BetterDiscord's IPC has been deprecated and may be removed in future versions."),betterDiscordIPC},BdApi.getCore=function(){return mainCore},BdApi.alert=function(e,t){const a=BdApi.findModuleByProps("push","update","pop","popWithKey"),n=BdApi.findModuleByPrototypes("handleCancel","handleSubmit","handleMinorConfirm");return a&&n?void a.push(function(a){return BdApi.React.createElement(n,Object.assign({title:e,body:t},a))}):mainCore.alert(e,t)},BdApi.showConfirmationModal=function(e,t,a={}){const n=BdApi.findModuleByProps("push","update","pop","popWithKey"),o=BdApi.findModuleByProps("Sizes","Weights"),s=BdApi.findModule(e=>e.defaultProps&&e.key&&"confirm-modal"==e.key());if(!n||!s||!o)return mainCore.alert(e,t);const{onConfirm:r,onCancel:i,confirmText:l,cancelText:d,danger:c=!1}=a;"string"==typeof t?t=o({color:o.Colors.PRIMARY,children:[t]}):Array.isArray(t)&&(t=o({color:o.Colors.PRIMARY,children:t})),t=[t];const p=()=>{};n.push(function(a){return BdApi.React.createElement(s,Object.assign({header:e,children:t,red:c,confirmText:l?l:"Okay",cancelText:d?d:"Cancel",onConfirm:r?r:p,onCancel:i?i:p},a))})},BdApi.showToast=function(e,t={}){mainCore.showToast(e,t)},BdApi.findModule=function(e){return BDV2.WebpackModules.find(e)},BdApi.findAllModules=function(e){return BDV2.WebpackModules.findAll(e)},BdApi.findModuleByProps=function(...e){return BDV2.WebpackModules.findByUniqueProperties(e)},BdApi.findModuleByPrototypes=function(...e){return BDV2.WebpackModules.findByPrototypes(e)},BdApi.findModuleByDisplayName=function(e){return BDV2.WebpackModules.findByDisplayName(e)},BdApi.getInternalInstance=function(e){if(e instanceof window.jQuery||e instanceof Element)return e instanceof jQuery&&(e=e[0]),BDV2.getInternalInstance(e)},BdApi.loadData=function(e,t){return DataStore.getPluginData(e,t)},BdApi.getData=BdApi.loadData,BdApi.saveData=function(e,t,a){return DataStore.setPluginData(e,t,a)},BdApi.setData=BdApi.saveData,BdApi.deleteData=function(e,t){return DataStore.deletePluginData(e,t)},BdApi.monkeyPatch=function(e,t,a){return Utils.monkeyPatch(e,t,a)},BdApi.onRemoved=function(e,t){return Utils.onRemoved(e,t)},BdApi.suppressErrors=function(e,t){return Utils.suppressErrors(e,t)},BdApi.testJSON=function(e){return Utils.testJSON(e)},BdApi.isPluginEnabled=function(e){return!!pluginCookie[e]},BdApi.isThemeEnabled=function(e){return!!themeCookie[e]},BdApi.isSettingEnabled=function(e){return!!settingsCookie[e]},BdApi.getBDData=function(e){return DataStore.getBDData(e)},BdApi.setBDData=function(e,t){return DataStore.setBDData(e,t)};function devMode(){}devMode.prototype.enable=function(e){var t=this;this.disable(),$(document).on("keydown.bdDevmode",function(t){if(119===t.which||118==t.which){console.log("%c[%cDevMode%c] %cBreak/Resume","color: red;","color: #303030; font-weight:700;","color:red;","");debugger;t.preventDefault(),t.stopImmediatePropagation()}});e&&$(document).on("contextmenu.bdDevmode",function(a){t.lastSelector=t.getSelector(a.toElement),setImmediate(function(){var n=$(".contextMenu-HLZMGh");0>=n.length&&(n=$("<div class=\"contextMenu-HLZMGh bd-context-menu\"></div>"),n.addClass($(".app, .app-2rEoOp").hasClass("theme-dark")?"theme-dark":"theme-light"),n.appendTo(".app, .app-2rEoOp"),n.css("top",a.clientY),n.css("left",a.clientX),$(document).on("click.bdDevModeCtx",()=>{n.remove(),$(document).off(".bdDevModeCtx")}),$(document).on("contextmenu.bdDevModeCtx",()=>{n.remove(),$(document).off(".bdDevModeCtx")}),$(document).on("keyup.bdDevModeCtx",t=>{27===t.keyCode&&(n.remove(),$(document).off(".bdDevModeCtx"))}));var e=$("<div/>",{class:"itemGroup-1tL0uz"}),o=$("<div/>",{class:"item-1Yvehc",click:function(){BDV2.NativeModule.copy(t.lastSelector),n.hide()}}).append($("<span/>",{text:"Copy Selector"}));e.append(o),n.append(e),n.hasClass("undefined")&&n.css("top","-="+e.outerHeight())}),a.stopPropagation()})},devMode.prototype.getRules=function(e,t=e.ownerDocument.styleSheets){const a=[...t].filter(e=>!e.href||!e.href.includes("BetterDiscordApp")),n=a.map(e=>[...(e.cssRules||[])]).flat(),o=n.filter(t=>t&&t.selectorText&&e.matches(t.selectorText)&&t.style.length&&8>t.selectorText.split(", ").length&&!t.selectorText.split(", ").includes("*"));return o},devMode.prototype.getSelector=function(e){if(e.id)return`#${e.id}`;const t=this.getRules(e),a=t[t.length-1];if(a)return a.selectorText;return e.classList.length?`.${Array.from(e.classList).join(".")}`:`.${Array.from(e.parentElement.classList).join(".")}`},devMode.prototype.disable=function(){$(document).off("keydown.bdDevmode"),$(document).off("contextmenu.bdDevmode"),$(document).off("contextmenu.bdDevModeCtx")};var ClassNormalizer=(()=>{const e="da",t=/^(?!da-)((?:[A-Za-z]|[0-9]|-)+)-(?:[A-Za-z]|[0-9]|-|_){6}$/;return new class{stop(){this.hasPatched&&(this.unpatchClassModules(BdApi.findAllModules(this.moduleFilter.bind(this))),this.revertElement(document.querySelector("#app-mount")),this.hasPatched=!1)}start(){this.hasPatched||(this.patchClassModules(BdApi.findAllModules(this.moduleFilter.bind(this))),this.normalizeElement(document.querySelector("#app-mount")),this.hasPatched=!0,this.patchDOMMethods())}patchClassModules(t){for(const a of t)this.patchClassModule(e,a)}unpatchClassModules(t){for(const a of t)this.unpatchClassModule(e,a)}shouldIgnore(e){return!isNaN(e)||!!(e.endsWith("px")||e.endsWith("ch")||e.endsWith("em")||e.endsWith("ms"))||!!e.startsWith("layerContainer-")||!!(e.startsWith("#")&&(7==e.length||4==e.length))||!!(e.includes("calc(")||e.includes("rgba"))}moduleFilter(e){if("object"!=typeof e||Array.isArray(e))return!1;if(e.__esModule)return!1;if(!Object.keys(e).length)return!1;for(const a in e){const n=e[a];if("string"!=typeof n)return!1;if(!this.shouldIgnore(n)){if(1===n.split("-").length)return!1;if(!t.test(n.split(" ")[0]))return!1}}return!0}patchClassModule(e,a){for(const n in a){const o=a[n];if(this.shouldIgnore(o))continue;const s=o.split(" ");for(const o of s){const s=o.match(t);if(!s||!s.length||2>s.length)continue;const r=s[1].split("-").map((e,t)=>t?e[0].toUpperCase()+e.slice(1):e).join("");a[n]+=` ${e}-${r}`}}}unpatchClassModule(e,t){for(const a in t){const n=t[a];if(this.shouldIgnore(n))continue;let o="";const s=n.split(" ");for(const t of s)t.startsWith(`${e}-`)||(o+=` ${t}`);t[a]=o.trim()}}normalizeElement(a){if(a instanceof Element){const n=a.classList;for(let o=0,s=n.length;o<s;o++){if(!t.test(n[o]))continue;const s=n[o].match(t)[1],r=s.split("-").map((e,t)=>t?e[0].toUpperCase()+e.slice(1):e).join("");a.classList.add(`${e}-${r}`)}for(const e of a.children)this.normalizeElement(e)}}revertElement(t){if(!(t instanceof Element))return;t.children&&t.children.length&&this.revertElement(t.children[0]),t.nextElementSibling&&this.revertElement(t.nextElementSibling);const a=t.classList,n=[];for(let o=0;o<a.length;o++)a[o].startsWith(`${e}-`)&&n.push(a[o]);t.classList.remove(...n)}patchDOMMethods(){const e=DOMTokenList.prototype.contains;DOMTokenList.prototype.contains=function(t){const a=t.split(" ");return a.every(a=>e.call(this,a))}}}})();class V2{constructor(){this.editorDetached=!1,this.WebpackModules=(()=>{const e=webpackJsonp.push([[],{__extra_id__:(e,t,a)=>e.exports=a},[["__extra_id__"]]]);delete e.m.__extra_id__,delete e.c.__extra_id__;const t=t=>{for(let a in e.c)if(e.c.hasOwnProperty(a)){let n=e.c[a].exports;if(n&&n.__esModule&&n.default&&t(n.default))return n.default;if(n&&t(n))return n}return null};return{find:t,findAll:t=>{const a=[];for(let n in e.c)if(e.c.hasOwnProperty(n)){let o=e.c[n].exports;o&&o.__esModule&&o.default&&t(o.default)?a.push(o.default):o&&t(o)&&a.push(o)}return a},findByUniqueProperties:e=>t(t=>e.every(e=>t[e]!==void 0)),findByPrototypes:e=>t(t=>t.prototype&&e.every(e=>t.prototype[e]!==void 0)),findByDisplayName:e=>t(t=>t.displayName===e)}})(),this.internal={react:this.WebpackModules.findByUniqueProperties(["Component","PureComponent","Children","createElement","cloneElement"]),reactDom:this.WebpackModules.findByUniqueProperties(["findDOMNode"])},this.getInternalInstance=t=>t[Object.keys(t).find(e=>e.startsWith("__reactInternalInstance"))]}initialize(){BdApi.suppressErrors(this.patchSocial.bind(this),"BD Social Patch")(),BdApi.suppressErrors(this.patchGuildPills.bind(this),"BD Guild Pills Patch")(),BdApi.suppressErrors(this.patchGuildListItems.bind(this),"BD Guild List Items Patch")(),BdApi.suppressErrors(this.patchGuildSeparator.bind(this),"BD Guild Separator Patch")()}joinBD1(){this.InviteActions.acceptInviteAndTransitionToInviteChannel("0Tmfo5ZbORCRqbAd")}leaveBD1(){this.GuildActions.leaveGuild("86004744966914048")}joinBD2(){this.InviteActions.acceptInviteAndTransitionToInviteChannel("2HScm8j")}leaveBD2(){this.GuildActions.leaveGuild("280806472928198656")}get react(){return this.internal.react}get reactDom(){return this.internal.reactDom}get reactComponent(){return this.internal.react.Component}get anchorClasses(){return this.WebpackModules.findByUniqueProperties(["anchorUnderlineOnHover"])||{anchor:"anchor-3Z-8Bb",anchorUnderlineOnHover:"anchorUnderlineOnHover-2ESHQB"}}get slateEditorClasses(){return this.WebpackModules.findByUniqueProperties(["slateTextArea"])}get messageClasses(){return this.WebpackModules.findByUniqueProperties(["message","containerCozy"])}get guildClasses(){const e=this.WebpackModules.findByUniqueProperties(["wrapper","unreadMentionsBar"]),t=this.WebpackModules.findByUniqueProperties(["guildsError","selected"]),a=this.WebpackModules.findByUniqueProperties(["blobContainer"]);return Object.assign({},e,t,a)}get MessageContentComponent(){return this.WebpackModules.find(e=>e.defaultProps&&e.defaultProps.hasOwnProperty("disableButtons"))}get MessageComponent(){return this.WebpackModules.find(e=>e.default&&e.default.displayName&&"Message"==e.default.displayName)}get TimeFormatter(){return this.WebpackModules.findByUniqueProperties(["dateFormat"])}get TooltipWrapper(){return this.WebpackModules.findByDisplayName("Tooltip")}get NativeModule(){return this.WebpackModules.findByUniqueProperties(["setBadge"])}get InviteActions(){return this.WebpackModules.findByUniqueProperties(["acceptInvite"])}get GuildActions(){return this.WebpackModules.findByUniqueProperties(["leaveGuild"])}get Tooltips(){return this.WebpackModules.find(e=>e.hide&&e.show&&!e.search&&!e.submit&&!e.search&&!e.activateRagingDemon&&!e.dismiss)}get KeyGenerator(){return this.WebpackModules.find(e=>e.toString&&/"binary"/.test(e.toString()))}get LayerStack(){return this.WebpackModules.findByUniqueProperties(["popLayer"])}get UserStore(){return this.WebpackModules.findByUniqueProperties(["getCurrentUser"])}get ChannelStore(){return this.WebpackModules.findByUniqueProperties(["getChannel"])}get ChannelActions(){return this.WebpackModules.findByUniqueProperties(["openPrivateChannel"])}get PrivateChannelActions(){return this.WebpackModules.findByUniqueProperties(["selectPrivateChannel"])}openDM(e){const t=this.UserStore.getCurrentUser().id;if(t!=e){const a=this.ChannelStore.getDMFromUserId(e);return a?this.PrivateChannelActions.selectPrivateChannel(a):void this.ChannelActions.openPrivateChannel(t,e)}}parseSettings(e){return Object.keys(settings).reduce((t,a)=>{let n=settings[a];return n.cat===e&&n.implemented&&!n.hidden&&(n.text=a,t.push(n)),t},[])}patchSocial(){if(this.socialPatch)return;const e=BdApi.findModule(e=>"TabBar"==e.displayName),t=BdApi.findModule(e=>"Anchor"==e.displayName);e&&t&&(this.socialPatch=BdApi.monkeyPatch(e.prototype,"render",{after:e=>{const a=e.returnValue.props.children;if(!a||!a.length||3>a.length)return;if("Separator"!==a[a.length-3].type.displayName)return;if(!a[a.length-2].type.toString().includes("socialLinks"))return;const n=a[a.length-2].type;a[a.length-2].type=function(){const e=n(...arguments);return e.props.children.push(BdApi.React.createElement(t,{className:"bd-social-link",href:"https://github.com/rauenzi/BetterDiscordApp",title:"BandagedBD",target:"_blank"},BdApi.React.createElement(BDLogo,{size:"16px",className:"bd-social-logo"}))),e};const o=BdApi.React.createElement(t,{className:"bd-social-link",href:"https://twitter.com/BandagedBD",title:"BandagedBD",target:"_blank"},"BandagedBD"),s=BdApi.React.createElement(t,{className:"bd-social-link",href:"https://twitter.com/ZackRauen",title:"Zerebos",target:"_blank"},"Zerebos"),r=BDV2.react.createElement("div",{className:"colorMuted-HdFt4q size12-3cLvbJ"},[o,` ${bbdVersion} by `,s]),i=a[a.length-1].type;a[a.length-1].type=function(){const e=i(...arguments);return e.props.children.push(r),e}}}))}patchGuildListItems(){if(this.guildListItemsPatch)return;const e=this.guildClasses.listItem.split(" ")[0],t=this.guildClasses.blobContainer.split(" ")[0],a=BdApi.getInternalInstance(document.querySelector(`.${e} .${t}`).parentElement),n=a.return.type;n&&(this.guildListItemsPatch=BdApi.monkeyPatch(n.prototype,"render",{after:e=>{if(e.returnValue&&e.thisObject){const t=e.returnValue,a=e.thisObject.props;return t.props.className+=" bd-guild",a.unread&&(t.props.className+=" bd-unread"),a.selected&&(t.props.className+=" bd-selected"),a.audio&&(t.props.className+=" bd-audio"),a.video&&(t.props.className+=" bd-video"),a.badge&&(t.props.className+=" bd-badge"),a.animatable&&(t.props.className+=" bd-animatable"),t}}}))}patchGuildPills(){if(!this.guildPillPatch){const e=BdApi.findModule(e=>e.default&&!e.default.displayName&&e.default.toString&&e.default.toString().includes("translate3d"));e&&(this.guildPillPatch=BdApi.monkeyPatch(e,"default",{after:e=>{const t=e.methodArguments[0];return t.unread&&(e.returnValue.props.className+=" bd-unread"),t.selected&&(e.returnValue.props.className+=" bd-selected"),t.hovered&&(e.returnValue.props.className+=" bd-hovered"),e.returnValue}}))}}patchGuildSeparator(){if(this.guildSeparatorPatch)return;const e=BdApi.findModuleByDisplayName("Guilds"),t=BdApi.findModuleByProps("renderListItem");if(!t||!e)return;const a=function(){const e=t.Separator(...arguments);return e.props.className+=" bd-guild-separator",e};this.guildSeparatorPatch=BdApi.monkeyPatch(e.prototype,"render",{after:e=>{e.returnValue.props.children[1].props.children[3].type=a}})}}var BDV2=new V2;class BDLogo extends BDV2.reactComponent{render(){return BDV2.react.createElement("svg",{height:"100%",width:this.props.size||"16px",className:"bd-logo "+this.props.className,style:{fillRule:"evenodd",clipRule:"evenodd",strokeLinecap:"round",strokeLinejoin:"round"},viewBox:"0 0 2000 2000"},BDV2.react.createElement("metadata",null),BDV2.react.createElement("defs",null,BDV2.react.createElement("filter",{id:"shadow1"},BDV2.react.createElement("feDropShadow",{dx:"20",dy:"0",stdDeviation:"20","flood-color":"rgba(0,0,0,0.35)"})),BDV2.react.createElement("filter",{id:"shadow2"},BDV2.react.createElement("feDropShadow",{dx:"15",dy:"0",stdDeviation:"20","flood-color":"rgba(255,255,255,0.15)"})),BDV2.react.createElement("filter",{id:"shadow3"},BDV2.react.createElement("feDropShadow",{dx:"10",dy:"0",stdDeviation:"20","flood-color":"rgba(0,0,0,0.35)"}))),BDV2.react.createElement("g",null,BDV2.react.createElement("path",{style:{filter:"url(#shadow3)"},d:"M1195.44+135.442L1195.44+135.442L997.6+136.442C1024.2+149.742+1170.34+163.542+1193.64+179.742C1264.34+228.842+1319.74+291.242+1358.24+365.042C1398.14+441.642+1419.74+530.642+1422.54+629.642L1422.54+630.842L1422.54+632.042C1422.54+773.142+1422.54+1228.14+1422.54+1369.14L1422.54+1370.34L1422.54+1371.54C1419.84+1470.54+1398.24+1559.54+1358.24+1636.14C1319.74+1709.94+1264.44+1772.34+1193.64+1821.44C1171.04+1837.14+1025.7+1850.54+1000+1863.54L1193.54+1864.54C1539.74+1866.44+1864.54+1693.34+1864.54+1296.64L1864.54+716.942C1866.44+312.442+1541.64+135.442+1195.44+135.442Z",fill:"#171717",opacity:"1"}),BDV2.react.createElement("path",{style:{filter:"url(#shadow2)"},d:"M1695.54+631.442C1685.84+278.042+1409.34+135.442+1052.94+135.442L361.74+136.442L803.74+490.442L1060.74+490.442C1335.24+490.442+1335.24+835.342+1060.74+835.342L1060.74+1164.84C1150.22+1164.84+1210.53+1201.48+1241.68+1250.87C1306.07+1353+1245.76+1509.64+1060.74+1509.64L361.74+1863.54L1052.94+1864.54C1409.24+1864.54+1685.74+1721.94+1695.54+1368.54C1695.54+1205.94+1651.04+1084.44+1572.64+999.942C1651.04+915.542+1695.54+794.042+1695.54+631.442Z",fill:"#3E82E5",opacity:"1"}),BDV2.react.createElement("path",{style:{filter:"url(#shadow1)"},d:"M1469.25+631.442C1459.55+278.042+1183.05+135.442+826.65+135.442L135.45+135.442L135.45+1004C135.45+1004+135.427+1255.21+355.626+1255.21C575.825+1255.21+575.848+1004+575.848+1004L577.45+490.442L834.45+490.442C1108.95+490.442+1108.95+835.342+834.45+835.342L664.65+835.342L664.65+1164.84L834.45+1164.84C923.932+1164.84+984.244+1201.48+1015.39+1250.87C1079.78+1353+1019.47+1509.64+834.45+1509.64L135.45+1509.64L135.45+1864.54L826.65+1864.54C1182.95+1864.54+1459.45+1721.94+1469.25+1368.54C1469.25+1205.94+1424.75+1084.44+1346.35+999.942C1424.75+915.542+1469.25+794.042+1469.25+631.442Z",fill:"#FFFFFF",opacity:"1"})))}}class BDEmote extends BDV2.reactComponent{constructor(e){super(e);const t=!!(quickEmoteMenu&&quickEmoteMenu.favoriteEmotes&&quickEmoteMenu.favoriteEmotes[this.label]);this.state={shouldAnimate:!this.animateOnHover,isFavorite:t},this.onMouseEnter=this.onMouseEnter.bind(this),this.onMouseLeave=this.onMouseLeave.bind(this),this.onClick=this.onClick.bind(this)}get animateOnHover(){return settingsCookie["fork-es-2"]}get label(){return this.props.modifier?`${this.props.name}:${this.props.modifier}`:this.props.name}get modifierClass(){return this.props.modifier?` emote${this.props.modifier}`:""}onMouseEnter(){!this.state.shouldAnimate&&this.animateOnHover&&this.setState({shouldAnimate:!0}),!this.state.isFavorite&&quickEmoteMenu.favoriteEmotes[this.label]?this.setState({isFavorite:!0}):this.state.isFavorite&&!quickEmoteMenu.favoriteEmotes[this.label]&&this.setState({isFavorite:!1})}onMouseLeave(){this.state.shouldAnimate&&this.animateOnHover&&this.setState({shouldAnimate:!1})}onClick(t){this.props.onClick&&this.props.onClick(t)}render(){return BDV2.react.createElement(BDV2.TooltipWrapper,{color:"black",position:"top",text:this.label,delay:750},e=>BDV2.react.createElement("div",Object.assign({className:"emotewrapper"+(this.props.jumboable?" jumboable":""),onMouseEnter:this.onMouseEnter,onMouseLeave:this.onMouseLeave,onClick:this.onClick},e),BDV2.react.createElement("img",{draggable:!1,className:"emote"+this.modifierClass+(this.props.jumboable?" jumboable":"")+(this.state.shouldAnimate?"":" stop-animation"),dataModifier:this.props.modifier,alt:this.label,src:this.props.url}),BDV2.react.createElement("input",{className:"fav"+(this.state.isFavorite?" active":""),title:"Favorite!",type:"button",onClick:t=>{t.preventDefault(),t.stopPropagation(),this.state.isFavorite?(delete quickEmoteMenu.favoriteEmotes[this.label],quickEmoteMenu.updateFavorites()):quickEmoteMenu.favorite(this.label,this.props.url),this.setState({isFavorite:!this.state.isFavorite})}})))}}class V2C_SettingsPanel extends BDV2.reactComponent{constructor(e){super(e)}render(){let{settings:e}=this.props;return BDV2.react.createElement("div",{className:"contentColumn-2hrIYH contentColumnDefault-1VQkGM content-column default"},BDV2.react.createElement(V2Components.SettingsTitle,{text:this.props.title}),this.props.button&&BDV2.react.createElement("button",{key:"title-button",className:"bd-pfbtn",onClick:this.props.button.onClick},this.props.button.title),e.map(e=>BDV2.react.createElement(V2Components.Switch,{id:e.id,key:e.id,data:e,checked:settingsCookie[e.id],onChange:(e,t)=>{this.props.onChange(e,t)}})))}}class V2C_SettingsGroup extends BDV2.reactComponent{constructor(e){super(e)}render(){const{title:e,settings:t,button:a}=this.props,n=a?BDV2.react.createElement("button",{key:"title-button",className:"bd-pfbtn",onClick:a.onClick},a.title):null;return[BDV2.react.createElement(V2Components.SettingsTitle,{text:e}),n,t.map(e=>BDV2.react.createElement(V2Components.Switch,{id:e.id,key:e.id,data:e,checked:settingsCookie[e.id],onChange:(e,t)=>{this.props.onChange(e,t)}}))]}}class V2C_SectionedSettingsPanel extends BDV2.reactComponent{constructor(e){super(e)}render(){return BDV2.react.createElement("div",{className:"contentColumn-2hrIYH contentColumnDefault-1VQkGM content-column default"},this.props.sections.map(e=>BDV2.react.createElement(V2Components.SettingsGroup,Object.assign({},e,{onChange:this.props.onChange}))))}}class V2C_Switch extends BDV2.reactComponent{constructor(e){super(e),this.setInitialState(),this.onChange=this.onChange.bind(this)}setInitialState(){this.state={checked:this.props.checked}}render(){let{text:e,info:t}=this.props.data,{checked:a}=this.state;return BDV2.react.createElement("div",{className:"ui-flex flex-vertical flex-justify-start flex-align-stretch flex-nowrap ui-switch-item"},BDV2.react.createElement("div",{className:"ui-flex flex-horizontal flex-justify-start flex-align-stretch flex-nowrap"},BDV2.react.createElement("h3",{className:"ui-form-title h3 margin-reset margin-reset ui-flex-child"},e),BDV2.react.createElement("label",{className:"ui-switch-wrapper ui-flex-child",style:{flex:"0 0 auto"}},BDV2.react.createElement("input",{className:"ui-switch-checkbox",type:"checkbox",checked:a,onChange:t=>this.onChange(t)}),BDV2.react.createElement("div",{className:`ui-switch ${a?"checked":""}`}))),BDV2.react.createElement("div",{className:"ui-form-text style-description margin-top-4",style:{flex:"1 1 auto"}},t))}onChange(){this.props.onChange(this.props.id,!this.state.checked),this.setState({checked:!this.state.checked})}}class V2C_Scroller extends BDV2.reactComponent{constructor(e){super(e)}render(){let e=`scrollerWrap-2lJEkd scrollerThemed-2oenus themeGhostHairline-DBD-2d${this.props.fade?" scrollerFade-1Ijw5y":""}`,t="scroller-2FKFPG scroller";this.props.sidebar&&(t="scroller-2FKFPG firefoxFixScrollFlex-cnI2ix sidebarRegionScroller-3MXcoP sidebar-region-scroller scroller"),this.props.contentColumn&&(t="scroller-2FKFPG firefoxFixScrollFlex-cnI2ix contentRegionScroller-26nc1e content-region-scroller scroller",e="scrollerWrap-2lJEkd firefoxFixScrollFlex-cnI2ix contentRegionScrollerWrap-3YZXdm content-region-scroller-wrap scrollerThemed-2oenus themeGhost-28MSn0 scrollerTrack-1ZIpsv");let{children:a}=this.props;return BDV2.react.createElement("div",{key:"scrollerwrap",className:e},BDV2.react.createElement("div",{key:"scroller",ref:"scroller",className:t},a))}}class V2C_TabBarItem extends BDV2.reactComponent{constructor(e){super(e),this.setInitialState(),this.onClick=this.onClick.bind(this)}setInitialState(){this.state={selected:this.props.selected||!1}}render(){return BDV2.react.createElement("div",{className:`ui-tab-bar-item${this.props.selected?" selected":""}`,onClick:this.onClick},this.props.text)}onClick(){this.props.onClick&&this.props.onClick(this.props.id)}}class V2C_TabBarSeparator extends BDV2.reactComponent{constructor(e){super(e)}render(){return BDV2.react.createElement("div",{className:"ui-tab-bar-separator margin-top-8 margin-bottom-8"})}}class V2C_TabBarHeader extends BDV2.reactComponent{constructor(e){super(e)}render(){return BDV2.react.createElement("div",{className:"ui-tab-bar-header"},this.props.text)}}class V2C_SideBar extends BDV2.reactComponent{constructor(e){super(e);let t=this;const a=$("[class*=side-] > [class*=selected]");a.length&&(t.scn=a.attr("class"));const n=$("[class*=side-] > [class*='item-']:not([class*=selected])");n.length&&(t.nscn=n.attr("class")),$("[class*='side-'] > [class*='item-']").on("click",()=>{t.setState({selected:null})}),t.setInitialState(),t.onClick=t.onClick.bind(t)}setInitialState(){let e=this;e.state={selected:null,items:e.props.items};let t=e.props.items.find(e=>e.selected);t&&(e.state.selected=t.id)}render(){let e=this,{headerText:t}=e.props,{items:a,selected:n}=e.state;return BDV2.react.createElement("div",null,BDV2.react.createElement(V2Components.TabBar.Separator,null),BDV2.react.createElement(V2Components.TabBar.Header,{text:t}),a.map(t=>{let{id:a,text:o}=t;return BDV2.react.createElement(V2Components.TabBar.Item,{key:a,selected:n===a,text:o,id:a,onClick:e.onClick})}))}onClick(e){let t=this;const a=$("[class*=side] > [class*=selected]");a.length&&(a.off("click.bdsb").on("click.bsb",a=>{$(a.target).attr("class",t.scn)}),a.attr("class",t.nscn)),t.setState({selected:null}),t.setState({selected:e}),t.props.onClick&&t.props.onClick(e)}}class V2C_ReloadIcon extends BDV2.reactComponent{constructor(e){super(e)}render(){return BDV2.react.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"#dcddde",className:"bd-reload "+this.props.className,onClick:this.props.onClick,style:{width:this.props.size||"24px",height:this.props.size||"24px"}},BDV2.react.createElement("path",{d:"M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4l-2.35 2.35z"}),BDV2.react.createElement("path",{fill:"none",d:"M0 0h24v24H0z"}))}}class V2C_XSvg extends BDV2.reactComponent{constructor(e){super(e)}render(){return BDV2.react.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 12 12",style:{width:"18px",height:"18px"}},BDV2.react.createElement("g",{className:"background",fill:"none",fillRule:"evenodd"},BDV2.react.createElement("path",{d:"M0 0h12v12H0"}),BDV2.react.createElement("path",{className:"fill",fill:"#dcddde",d:"M9.5 3.205L8.795 2.5 6 5.295 3.205 2.5l-.705.705L5.295 6 2.5 8.795l.705.705L6 6.705 8.795 9.5l.705-.705L6.705 6"})))}}class V2C_Tools extends BDV2.reactComponent{constructor(e){super(e),this.onClick=this.onClick.bind(this)}render(){return BDV2.react.createElement("div",{className:"tools-container toolsContainer-1edPuj"},BDV2.react.createElement("div",{className:"tools tools-3-3s-N"},BDV2.react.createElement("div",{className:"container-1sFeqf"},BDV2.react.createElement("div",{className:"btn-close closeButton-1tv5uR",onClick:this.onClick},BDV2.react.createElement(V2Components.XSvg,null)),BDV2.react.createElement("div",{className:"esc-text keybind-KpFkfr"},"ESC"))))}onClick(){this.props.onClick&&this.props.onClick(),$(".closeButton-1tv5uR").first().click()}}class V2C_SettingsTitle extends BDV2.reactComponent{constructor(e){super(e)}render(){return BDV2.react.createElement("h2",{className:"ui-form-title h2 margin-reset margin-bottom-20 marginTop60-3PGbtK da-marginTop6"},this.props.text)}}class V2C_Checkbox extends BDV2.reactComponent{constructor(e){super(e),this.onClick=this.onClick.bind(this),this.setInitialState()}setInitialState(){this.state={checked:this.props.checked||!1}}render(){return BDV2.react.createElement("li",null,BDV2.react.createElement("div",{className:"checkbox checkbox-3kaeSU da-checkbox",onClick:this.onClick},BDV2.react.createElement("div",{className:"checkbox-inner checkboxInner-3yjcPe da-checkboxInner"},BDV2.react.createElement("input",{className:"checkboxElement-1qV33p da-checkboxElement",checked:this.state.checked,onChange:()=>{},type:"checkbox"}),BDV2.react.createElement("span",null)),BDV2.react.createElement("span",null,this.props.text)))}onClick(){this.props.onChange(this.props.id,!this.state.checked),this.setState({checked:!this.state.checked})}}class V2C_CssEditorDetached extends BDV2.reactComponent{constructor(e){super(e);let t=this;t.onClick=t.onClick.bind(t),t.updateCss=t.updateCss.bind(t),t.saveCss=t.saveCss.bind(t),t.onChange=t.onChange.bind(t)}componentDidMount(){$("#app-mount").addClass("bd-detached-editor"),BDV2.editorDetached=!0,this.editor=ace.edit("bd-customcss-editor-detached"),this.editor.setTheme("ace/theme/monokai"),this.editor.session.setMode("ace/mode/css"),this.editor.setShowPrintMargin(!1),this.editor.setFontSize(14),this.editor.on("change",()=>{settingsCookie["bda-css-0"]&&(this.saveCss(),this.updateCss())})}componentWillUnmount(){$("#app-mount").removeClass("bd-detached-editor"),BDV2.editorDetached=!1,this.editor.destroy()}updateLineCount(){let e=this.refs.editor.value.split("\n").length;e==this.props.lines||(this.refs.lines.textContent=Array.from(Array(e),(e,t)=>t+1).join(".\n")+".",this.props.lines=e)}get options(){return{lineNumbers:!0,mode:"css",indentUnit:4,theme:"material",scrollbarStyle:"simple"}}get css(){let e=DataStore.getBDData("bdcustomcss"),t="";return e&&""!==e&&(t=atob(e)),t}get root(){let e=$("#bd-customcss-detach-container");return e.length?e[0]:this.injectRoot()?this.detachedRoot:null}injectRoot(){return!!$(".app, .app-2rEoOp").length&&($("<div/>",{id:"bd-customcss-detach-container"}).insertAfter($(".app, .app-2rEoOp")),!0)}render(){let e=this;return BDV2.react.createElement("div",{className:"bd-detached-css-editor",id:"bd-customcss-detach-editor"},BDV2.react.createElement("div",{id:"bd-customcss-innerpane"},BDV2.react.createElement("div",{className:"editor-wrapper"},BDV2.react.createElement("div",{id:"bd-customcss-editor-detached",className:"editor",ref:"editor"},e.css)),BDV2.react.createElement("div",{id:"bd-customcss-attach-controls"},BDV2.react.createElement("ul",{className:"checkbox-group"},BDV2.react.createElement(V2Components.Checkbox,{id:"live-update",text:"Live Update",onChange:e.onChange,checked:settingsCookie["bda-css-0"]})),BDV2.react.createElement("div",{id:"bd-customcss-detach-controls-button"},BDV2.react.createElement("button",{style:{borderRadius:"3px 0 0 3px",borderRight:"1px solid #3f4146"},className:"btn btn-primary",onClick:()=>{e.onClick("update")}},"Update"),BDV2.react.createElement("button",{style:{borderRadius:"0",borderLeft:"1px solid #2d2d2d",borderRight:"1px solid #2d2d2d"},className:"btn btn-primary",onClick:()=>{e.onClick("save")}},"Save"),BDV2.react.createElement("button",{style:{borderRadius:"0 3px 3px 0",borderLeft:"1px solid #3f4146"},className:"btn btn-primary",onClick:()=>{e.onClick("attach")}},"Attach"),BDV2.react.createElement("span",{style:{fontSize:"10px",marginLeft:"5px"}},"Unsaved changes are lost on attach")))))}onChange(e,t){"live-update"===e?(settingsCookie["bda-css-0"]=t,mainCore.saveSettings()):void 0}onClick(e){let t=this;"attach"===e?($("#editor-detached").length&&t.props.attach(),BDV2.reactDom.unmountComponentAtNode(t.root),t.root.remove()):"update"===e?t.updateCss():"save"===e?t.saveCss():void 0}updateCss(){0==$("#customcss").length&&$("head").append("<style id=\"customcss\"></style>"),$("#customcss").text(this.editor.session.getValue()).detach().appendTo(document.head)}saveCss(){DataStore.setBDData("bdcustomcss",btoa(this.editor.session.getValue()))}}class V2C_CssEditor extends BDV2.reactComponent{constructor(e){super(e);let t=this;t.props.lines=0,t.setInitialState(),t.attach=t.attach.bind(t),t.detachedEditor=BDV2.react.createElement(V2C_CssEditorDetached,{attach:t.attach}),t.onClick=t.onClick.bind(t),t.updateCss=t.updateCss.bind(t),t.saveCss=t.saveCss.bind(t),t.detach=t.detach.bind(t)}setInitialState(){this.state={detached:this.props.detached||BDV2.editorDetached}}componentDidMount(){this.editor=ace.edit("bd-customcss-editor"),this.editor.setTheme("ace/theme/monokai"),this.editor.session.setMode("ace/mode/css"),this.editor.setShowPrintMargin(!1),this.editor.setFontSize(14),this.editor.on("change",()=>{settingsCookie["bda-css-0"]&&(this.saveCss(),this.updateCss())})}componentWillUnmount(){this.editor.destroy()}componentDidUpdate(e,t){let a=this;t.detached&&!a.state.detached&&BDV2.reactDom.unmountComponentAtNode(a.detachedRoot)}codeMirror(){}get options(){return{lineNumbers:!0,mode:"css",indentUnit:4,theme:"material",scrollbarStyle:"simple"}}get css(){let e=DataStore.getBDData("bdcustomcss"),t="";return e&&""!==e&&(t=atob(e)),t}updateLineCount(){let e=this.refs.editor.value.split("\n").length;e==this.props.lines||(this.refs.lines.textContent=Array.from(Array(e),(e,t)=>t+1).join(".\n")+".",this.props.lines=e)}render(){let e=this,{detached:t}=e.state;return BDV2.react.createElement("div",{className:"contentColumn-2hrIYH contentColumnDefault-1VQkGM content-column default",style:{padding:"60px 40px 0px"}},t&&BDV2.react.createElement("div",{id:"editor-detached"},BDV2.react.createElement(V2Components.SettingsTitle,{text:"Custom CSS Editor"}),BDV2.react.createElement("h3",null,"Editor Detached"),BDV2.react.createElement("button",{className:"btn btn-primary",onClick:()=>{e.attach()}},"Attach")),!t&&BDV2.react.createElement("div",null,BDV2.react.createElement(V2Components.SettingsTitle,{text:"Custom CSS Editor"}),BDV2.react.createElement("div",{className:"editor-wrapper"},BDV2.react.createElement("div",{id:"bd-customcss-editor",className:"editor",ref:"editor"},e.css)),BDV2.react.createElement("div",{id:"bd-customcss-attach-controls"},BDV2.react.createElement("ul",{className:"checkbox-group"},BDV2.react.createElement(V2Components.Checkbox,{id:"live-update",text:"Live Update",onChange:this.onChange,checked:settingsCookie["bda-css-0"]})),BDV2.react.createElement("div",{id:"bd-customcss-detach-controls-button"},BDV2.react.createElement("button",{style:{borderRadius:"3px 0 0 3px",borderRight:"1px solid #3f4146"},className:"btn btn-primary",onClick:()=>{e.onClick("update")}},"Update"),BDV2.react.createElement("button",{style:{borderRadius:"0",borderLeft:"1px solid #2d2d2d",borderRight:"1px solid #2d2d2d"},className:"btn btn-primary",onClick:()=>{e.onClick("save")}},"Save"),BDV2.react.createElement("button",{style:{borderRadius:"0 3px 3px 0",borderLeft:"1px solid #3f4146"},className:"btn btn-primary",onClick:()=>{e.onClick("detach")}},"Detach"),BDV2.react.createElement("span",{style:{fontSize:"10px",marginLeft:"5px"}},"Unsaved changes are lost on detach"),BDV2.react.createElement("div",{className:"help-text"},"Press ",BDV2.react.createElement("code",{className:"inline"},"ctrl"),"+",BDV2.react.createElement("span",{className:"inline"},",")," with the editor focused to access the editor's settings.")))))}onClick(e){let t=this;"update"===e?t.updateCss():"save"===e?t.saveCss():"detach"===e?t.detach():void 0}onChange(e,t){"live-update"===e?(settingsCookie["bda-css-0"]=t,mainCore.saveSettings()):void 0}updateCss(){0==$("#customcss").length&&$("head").append("<style id=\"customcss\"></style>"),$("#customcss").text(this.editor.session.getValue()).detach().appendTo(document.head)}saveCss(){DataStore.setBDData("bdcustomcss",btoa(this.editor.session.getValue()))}detach(){let e=this;e.setState({detached:!0});let t=e.detachedRoot;return t?void BDV2.reactDom.render(e.detachedEditor,t):void console.log("FAILED TO INJECT ROOT: .app")}get detachedRoot(){let e=$("#bd-customcss-detach-container");return e.length?e[0]:this.injectDetachedRoot()?this.detachedRoot:null}injectDetachedRoot(){return!!$(".app, .app-2rEoOp").length&&($("<div/>",{id:"bd-customcss-detach-container"}).insertAfter($(".app, .app-2rEoOp")),!0)}attach(){let e=this;e.setState({detached:!1})}}class V2C_List extends BDV2.reactComponent{constructor(e){super(e)}render(){return BDV2.react.createElement("ul",{className:this.props.className},this.props.children)}}class V2C_ContentColumn extends BDV2.reactComponent{constructor(e){super(e)}render(){return BDV2.react.createElement("div",{className:"contentColumn-2hrIYH contentColumnDefault-1VQkGM content-column default"},BDV2.react.createElement("h2",{className:"ui-form-title h2 margin-reset margin-bottom-20"},this.props.title),this.props.children)}}class V2C_PluginCard extends BDV2.reactComponent{constructor(e){super(e);let t=this;t.onChange=t.onChange.bind(t),t.showSettings=t.showSettings.bind(t),t.setInitialState(),t.hasSettings="function"==typeof t.props.plugin.getSettingsPanel,t.settingsPanel="",this.reload=this.reload.bind(this),this.onReload=this.onReload.bind(this)}setInitialState(){this.state={checked:pluginCookie[this.props.plugin.getName()],settings:!1,reloads:0}}onReload(e){e!==this.props.plugin.getName()||this.setState({reloads:this.state.reloads+1})}componentDidUpdate(){if(this.state.settings){if("object"==typeof this.settingsPanel&&this.refs.settingspanel.appendChild(this.settingsPanel),!settingsCookie["fork-ps-3"])return;const e=$(BDV2.reactDom.findDOMNode(this)),t=e.parents(".scroller");if(!((e,t)=>{const a=e.scrollTop,n=a+e.clientHeight,o=t.offsetTop,s=o+t.clientHeight;return o<a||s>n})(t[0],e[0]))return;t.animate({scrollTop:e.offset().top-t.offset().top+t.scrollTop()-30},300)}}reload(){const e=this.props.plugin.getName();pluginModule.reloadPlugin(e),this.props.plugin=bdplugins[e].plugin,this.onReload(this.props.plugin.getName())}getString(e){return"string"==typeof e?e:e.toString()}makeLink(e,t){const a={className:"bda-link bda-link-website",target:"_blank"};return"string"==typeof t&&(a.href=t),"function"==typeof t&&(a.onClick=e=>{e.preventDefault(),e.stopPropagation(),t()}),BDV2.react.createElement("a",a,e)}render(){const e=this,{plugin:t}=this.props,a=this.getString(t.getName()),n=this.getString(t.getAuthor()),o=this.getString(t.getDescription()),s=this.getString(t.getVersion()),r=bdplugins[a];if(this.state.settings){try{e.settingsPanel=t.getSettingsPanel()}catch(e){Utils.err("Plugins","Unable to get settings panel for "+t.getName()+".",e)}return BDV2.react.createElement("li",{className:"settings-open ui-switch-item"},BDV2.react.createElement("div",{style:{float:"right",cursor:"pointer"},onClick:()=>{this.refs.settingspanel.innerHTML="",e.setState({settings:!1})}},BDV2.react.createElement(V2Components.XSvg,null)),"object"==typeof e.settingsPanel&&BDV2.react.createElement("div",{id:`plugin-settings-${a}`,className:"plugin-settings",ref:"settingspanel"}),"object"!=typeof e.settingsPanel&&BDV2.react.createElement("div",{id:`plugin-settings-${a}`,className:"plugin-settings",ref:"settingspanel",dangerouslySetInnerHTML:{__html:e.settingsPanel}}))}const i=[];r.website&&i.push(this.makeLink("Website",r.website)),r.source&&i.push(this.makeLink("Source",r.source)),r.invite&&i.push(this.makeLink("Support Server",()=>{const e=/\.gg\/(.*)$/;let t=r.invite;e.test(t)&&(t=t.match(e)[1]),BDV2.LayerStack.popLayer(),BDV2.InviteActions.acceptInviteAndTransitionToInviteChannel(t)})),r.donate&&i.push(this.makeLink("Donate",r.donate)),r.patreon&&i.push(this.makeLink("Patreon",r.patreon));const l={className:"bda-author"};return(r.authorLink||r.authorId)&&(l.className+=` ${BDV2.anchorClasses.anchor} ${BDV2.anchorClasses.anchorUnderlineOnHover}`,l.target="_blank",r.authorLink&&(l.href=r.authorLink),r.authorId&&(l.onClick=()=>{BDV2.LayerStack.popLayer(),BDV2.openDM(r.authorId)})),BDV2.react.createElement("li",{"data-name":a,"data-version":s,className:"settings-closed ui-switch-item"},BDV2.react.createElement("div",{className:"bda-header"},BDV2.react.createElement("span",{className:"bda-header-title"},BDV2.react.createElement("span",{className:"bda-name"},a)," v",BDV2.react.createElement("span",{className:"bda-version"},s)," by ",BDV2.react.createElement(r.authorLink||r.authorId?"a":"span",l,n)),BDV2.react.createElement("div",{className:"bda-controls"},!settingsCookie["fork-ps-5"]&&BDV2.react.createElement(V2Components.TooltipWrap(V2Components.ReloadIcon,{color:"black",side:"top",text:"Reload"}),{className:"bd-reload-card",onClick:this.reload}),BDV2.react.createElement("label",{className:"ui-switch-wrapper ui-flex-child",style:{flex:"0 0 auto"}},BDV2.react.createElement("input",{checked:this.state.checked,onChange:this.onChange,className:"ui-switch-checkbox",type:"checkbox"}),BDV2.react.createElement("div",{className:this.state.checked?"ui-switch checked":"ui-switch"})))),BDV2.react.createElement("div",{className:"bda-description-wrap scroller-wrap fade"},BDV2.react.createElement("div",{className:"bda-description scroller"},o)),(i.length||this.hasSettings)&&BDV2.react.createElement("div",{className:"bda-footer"},BDV2.react.createElement("span",{className:"bda-links"},...i.map((e,t)=>t<i.length-1?[e," | "]:e).flat()),this.hasSettings&&BDV2.react.createElement("button",{onClick:this.showSettings,className:"bda-settings-button",disabled:!this.state.checked},"Settings")))}onChange(){this.setState({checked:!this.state.checked}),pluginModule.togglePlugin(this.props.plugin.getName())}showSettings(){this.hasSettings&&this.setState({settings:!0})}}class V2C_ThemeCard extends BDV2.reactComponent{constructor(e){super(e),this.setInitialState(),this.onChange=this.onChange.bind(this),this.reload=this.reload.bind(this)}setInitialState(){this.state={checked:themeCookie[this.props.theme.name],reloads:0}}onReload(e){e!==this.props.theme.name||this.setState({reloads:this.state.reloads+1})}reload(){const e=this.props.theme.name,t=themeModule.reloadTheme(e);t?mainCore.showToast(`Could not reload ${bdthemes[e].name}. Check console for details.`,{type:"error"}):mainCore.showToast(`${bdthemes[e].name} v${bdthemes[e].version} has been reloaded.`,{type:"success"}),this.props.theme=bdthemes[e],this.onReload(this.props.theme.name)}makeLink(e,t){const a={className:"bda-link bda-link-website",target:"_blank"};return"string"==typeof t&&(a.href=t),"function"==typeof t&&(a.onClick=e=>{e.preventDefault(),e.stopPropagation(),t()}),BDV2.react.createElement("a",a,e)}render(){const{theme:e}=this.props,t=e.name,a=e.description,n=e.version,o=e.author,s=bdthemes[t],r=[];s.website&&r.push(this.makeLink("Website",s.website)),s.source&&r.push(this.makeLink("Source",s.source)),s.invite&&r.push(this.makeLink("Support Server",()=>{const e=/\.gg\/(.*)$/;let t=s.invite;e.test(t)&&(t=t.match(e)[1]),BDV2.LayerStack.popLayer(),BDV2.InviteActions.acceptInviteAndTransitionToInviteChannel(t)})),s.donate&&r.push(this.makeLink("Donate",s.donate)),s.patreon&&r.push(this.makeLink("Patreon",s.patreon));const i={className:"bda-author"};return(s.authorLink||s.authorId)&&(i.className+=` ${BDV2.anchorClasses.anchor} ${BDV2.anchorClasses.anchorUnderlineOnHover}`,i.target="_blank",s.authorLink&&(i.href=s.authorLink),s.authorId&&(i.onClick=()=>{BDV2.LayerStack.popLayer(),BDV2.openDM(s.authorId)})),BDV2.react.createElement("li",{"data-name":t,"data-version":n,className:"settings-closed ui-switch-item"},BDV2.react.createElement("div",{className:"bda-header"},BDV2.react.createElement("span",{className:"bda-header-title"},BDV2.react.createElement("span",{className:"bda-name"},t)," v",BDV2.react.createElement("span",{className:"bda-version"},n)," by ",BDV2.react.createElement(s.authorLink||s.authorId?"a":"span",i,o)),BDV2.react.createElement("div",{className:"bda-controls"},!settingsCookie["fork-ps-5"]&&BDV2.react.createElement(V2Components.TooltipWrap(V2Components.ReloadIcon,{color:"black",side:"top",text:"Reload"}),{className:"bd-reload-card",onClick:this.reload}),BDV2.react.createElement("label",{className:"ui-switch-wrapper ui-flex-child",style:{flex:"0 0 auto"}},BDV2.react.createElement("input",{checked:this.state.checked,onChange:this.onChange,className:"ui-switch-checkbox",type:"checkbox"}),BDV2.react.createElement("div",{className:this.state.checked?"ui-switch checked":"ui-switch"})))),BDV2.react.createElement("div",{className:"bda-description-wrap scroller-wrap fade"},BDV2.react.createElement("div",{className:"bda-description scroller"},a)),!!r.length&&BDV2.react.createElement("div",{className:"bda-footer"},BDV2.react.createElement("span",{className:"bda-links"},...r.map((e,t)=>t<r.length-1?[e," | "]:e).flat())))}onChange(){this.setState({checked:!this.state.checked}),themeModule.toggleTheme(this.props.theme.name)}}class V2Cs_TabBar{static get Item(){return V2C_TabBarItem}static get Header(){return V2C_TabBarHeader}static get Separator(){return V2C_TabBarSeparator}}class V2Components{static get SettingsGroup(){return V2C_SettingsGroup}static get SectionedSettingsPanel(){return V2C_SectionedSettingsPanel}static get SettingsPanel(){return V2C_SettingsPanel}static get Switch(){return V2C_Switch}static get Scroller(){return V2C_Scroller}static get TabBar(){return V2Cs_TabBar}static get SideBar(){return V2C_SideBar}static get Tools(){return V2C_Tools}static get SettingsTitle(){return V2C_SettingsTitle}static get CssEditor(){return V2C_CssEditor}static get Checkbox(){return V2C_Checkbox}static get List(){return V2C_List}static get PluginCard(){return V2C_PluginCard}static get ThemeCard(){return V2C_ThemeCard}static get ContentColumn(){return V2C_ContentColumn}static get ReloadIcon(){return V2C_ReloadIcon}static get XSvg(){return V2C_XSvg}static get Layer(){return V2C_Layer}static get SidebarView(){return V2C_SidebarView}static get ServerCard(){return V2C_ServerCard}static TooltipWrap(e,t){const{style:a="black",side:n="top",text:o=""}=t,s=BDV2.KeyGenerator();return class extends BDV2.reactComponent{constructor(e){super(e),this.onMouseEnter=this.onMouseEnter.bind(this),this.onMouseLeave=this.onMouseLeave.bind(this)}componentDidMount(){this.node=BDV2.reactDom.findDOMNode(this),this.node.addEventListener("mouseenter",this.onMouseEnter),this.node.addEventListener("mouseleave",this.onMouseLeave)}componentWillUnmount(){this.node.removeEventListener("mouseenter",this.onMouseEnter),this.node.removeEventListener("mouseleave",this.onMouseLeave)}onMouseEnter(){if(!BDV2.Tooltips)return;const{left:e,top:t,width:r,height:i}=this.node.getBoundingClientRect();BDV2.Tooltips.show(s,{position:n,text:o,color:a,targetWidth:r,targetHeight:i,windowWidth:Utils.screenWidth,windowHeight:Utils.screenHeight,x:e,y:t});const l=new MutationObserver(e=>{e.forEach(e=>{const t=Array.from(e.removedNodes),a=-1<t.indexOf(this.node),n=t.some(e=>e.contains(this.node));(a||n)&&(this.onMouseLeave(),l.disconnect())})});l.observe(document.body,{subtree:!0,childList:!0})}onMouseLeave(){BDV2.Tooltips&&BDV2.Tooltips.hide(s)}render(){return BDV2.react.createElement(e,this.props)}}}}class V2_SettingsPanel_Sidebar{constructor(e){this.onClick=e}get items(){return[{text:"Settings",id:"core"},{text:"Emotes",id:"emotes"},{text:"Plugins",id:"plugins"},{text:"Themes",id:"themes"},{text:"Custom CSS",id:"customcss"}]}get component(){return BDV2.react.createElement("span",null,BDV2.react.createElement(V2Components.SideBar,{onClick:this.onClick,headerText:"Bandaged BD",items:this.items}))}get root(){let e=$("#bd-settings-sidebar");return e.length?e[0]:this.injectRoot()?this.root:null}injectRoot(){let e=$("[class*='side-'] > [class*='item-']:not([class*=Danger])").last();return!!e.length&&($("<span/>",{id:"bd-settings-sidebar"}).insertBefore(e.prev()),!0)}render(){let e=this.root;return e?void(BDV2.reactDom.render(this.component,e),Utils.onRemoved(e,()=>{BDV2.reactDom.unmountComponentAtNode(e)})):void console.log("FAILED TO LOCATE ROOT: [class*='side-'] > [class*='item-']:not([class*=Danger])")}}class V2_SettingsPanel{constructor(){let e=this;e.sideBarOnClick=e.sideBarOnClick.bind(e),e.onChange=e.onChange.bind(e),e.updateSettings=this.updateSettings.bind(e),e.sidebar=new V2_SettingsPanel_Sidebar(e.sideBarOnClick)}get root(){let e=$("#bd-settingspane-container");return e.length?e[0]:this.injectRoot()?this.root:null}injectRoot(){if(!$(".layer-3QrUeG .standardSidebarView-3F1I7i, .layer-3QrUeG .ui-standard-sidebar-view").length)return!1;const e=$("<div/>",{class:"contentRegion-3nDuYy content-region",id:"bd-settingspane-container"});return $(".layer-3QrUeG .standardSidebarView-3F1I7i, .layer-3QrUeG .ui-standard-sidebar-view").append(e),Utils.onRemoved(e[0],()=>{BDV2.reactDom.unmountComponentAtNode(e[0])}),!0}get coreSettings(){const e=this.getSettings("core"),t=[...new Set(e.map(e=>e.category))],a=t.map(t=>({title:t,settings:e.filter(e=>e.category==t)}));return a}get emoteSettings(){return this.getSettings("emote")}getSettings(e){return Object.keys(settings).reduce((t,a)=>{let n=settings[a];return n.cat===e&&n.implemented&&!n.hidden&&(n.text=a,t.push(n)),t},[])}sideBarOnClick(e){let t=this;$(".contentRegion-3nDuYy, .content-region").first().hide(),$(t.root).show();"core"===e?t.renderCoreSettings():"emotes"===e?t.renderEmoteSettings():"customcss"===e?t.renderCustomCssEditor():"plugins"===e?t.renderPluginPane():"themes"===e?t.renderThemePane():void 0}onClick(){}onChange(e,t){this.updateSettings(e,t)}updateSettings(e,t){if(settingsCookie[e]=t,"fork-beta"==e)try{const e=require("fs"),a=require("path"),n=a.join(DiscordNative.process.remote.resourcesPath,"app","betterdiscord","config.json"),o=require(n);o.branch=t?"modularize":"master",e.writeFileSync(n,JSON.stringify(o,null,4))}catch(e){console.error(e)}"bda-gs-2"==e&&(t?$("body").addClass("bd-minimal"):$("body").removeClass("bd-minimal")),"bda-gs-3"==e&&(t?$("body").addClass("bd-minimal-chan"):$("body").removeClass("bd-minimal-chan")),"bda-gs-1"==e&&(t?publicServersModule.addButton():publicServersModule.removeButton()),"bda-gs-4"==e&&(t?voiceMode.enable():voiceMode.disable()),"bda-gs-5"==e&&(t?$("#app-mount").addClass("bda-dark"):$("#app-mount").removeClass("bda-dark")),t&&"bda-gs-6"==e&&mainCore.inject24Hour(),"bda-gs-7"==e&&(t?mainCore.injectColoredText():mainCore.removeColoredText()),"bda-es-4"==e&&(t?emoteModule.autoCapitalize():emoteModule.disableAutoCapitalize()),"fork-ps-4"==e&&(t?ClassNormalizer.start():ClassNormalizer.stop()),"fork-ps-5"==e&&(t?(ContentManager.watchContent("plugin"),ContentManager.watchContent("theme")):(ContentManager.unwatchContent("plugin"),ContentManager.unwatchContent("theme"))),"fork-wp-1"==e&&(BdApi.setWindowPreference("transparent",t),t?BdApi.setWindowPreference("backgroundColor",null):BdApi.setWindowPreference("backgroundColor","#2f3136")),"bda-gs-8"==e&&(t?dMode.enable(settingsCookie["fork-dm-1"]):dMode.disable()),"fork-dm-1"==e&&settingsCookie["bda-gs-8"]&&dMode.enable(t),mainCore.saveSettings()}initializeSettings(){settingsCookie["bda-gs-2"]&&$("body").addClass("bd-minimal"),settingsCookie["bda-gs-3"]&&$("body").addClass("bd-minimal-chan"),settingsCookie["bda-gs-1"]&&publicServersModule.addButton(),settingsCookie["bda-gs-4"]&&voiceMode.enable(),settingsCookie["bda-gs-5"]&&$("#app-mount").addClass("bda-dark"),settingsCookie["bda-gs-6"]&&mainCore.inject24Hour(),settingsCookie["bda-gs-7"]&&mainCore.injectColoredText(),settingsCookie["bda-es-4"]&&emoteModule.autoCapitalize(),settingsCookie["fork-ps-4"]&&ClassNormalizer.start(),settingsCookie["fork-ps-5"]&&(ContentManager.watchContent("plugin"),ContentManager.watchContent("theme")),settingsCookie["bda-gs-8"]&&dMode.enable(settingsCookie["fork-dm-1"]),(async()=>{const e=BDV2.WebpackModules.findByUniqueProperties(["getSortedGuilds"]),t=BDV2.WebpackModules.findByUniqueProperties(["getMember"]),a=e.getFlattenedGuildIds().includes("292141134614888448"),n=BDV2.UserStore.getCurrentUser().id,o=t.getMember("292141134614888448",n),s=!!(a&&o)&&o.roles.includes("452687773678436354");s&&(settings["BBD Beta"].hidden=!1)})(),mainCore.saveSettings()}renderSidebar(){let e=this;$("[class*='side-'] > [class*='item-']").off("click.v2settingspanel").on("click.v2settingspanel",()=>{BDV2.reactDom.unmountComponentAtNode(e.root),$(e.root).hide(),$(".contentRegion-3nDuYy, .content-region").first().show()}),e.sidebar.render()}get coreComponent(){return BDV2.react.createElement(V2Components.Scroller,{contentColumn:!0,fade:!0,dark:!0,children:[BDV2.react.createElement(V2Components.SectionedSettingsPanel,{key:"cspanel",onChange:this.onChange,sections:this.coreSettings}),BDV2.react.createElement(V2Components.Tools,{key:"tools"})]})}get emoteComponent(){return BDV2.react.createElement(V2Components.Scroller,{contentColumn:!0,fade:!0,dark:!0,children:[BDV2.react.createElement(V2Components.SettingsPanel,{key:"espanel",title:"Emote Settings",onChange:this.onChange,settings:this.emoteSettings,button:{title:"Clear Emote Cache",onClick:()=>{emoteModule.clearEmoteData(),emoteModule.init(),quickEmoteMenu.init()}}}),BDV2.react.createElement(V2Components.Tools,{key:"tools"})]})}get customCssComponent(){return BDV2.react.createElement(V2Components.Scroller,{contentColumn:!0,fade:!0,dark:!0,children:[BDV2.react.createElement(V2Components.CssEditor,{key:"csseditor"}),BDV2.react.createElement(V2Components.Tools,{key:"tools"})]})}contentComponent(e){const t="plugins"==e?this.pluginsComponent:this.themesComponent,a=e.replace("s",""),n=this;class ContentList extends BDV2.react.Component{constructor(e){super(e),this.onChange=this.onChange.bind(this)}componentDidMount(){BDEvents.on(`${a}-reloaded`,this.onChange),BDEvents.on(`${a}-loaded`,this.onChange),BDEvents.on(`${a}-unloaded`,this.onChange)}componentWillUnmount(){BDEvents.off(`${a}-reloaded`,this.onChange),BDEvents.off(`${a}-loaded`,this.onChange),BDEvents.off(`${a}-unloaded`,this.onChange)}onChange(){n.sideBarOnClick(e)}render(){return t}}return BDV2.react.createElement(ContentList)}get pluginsComponent(){let e=Object.keys(bdplugins).sort((e,t)=>e.toLowerCase().localeCompare(t.toLowerCase())).reduce((e,t)=>(e.push(BDV2.react.createElement(V2Components.PluginCard,{key:t,plugin:bdplugins[t].plugin})),e),[]),t=BDV2.react.createElement(V2Components.List,{key:"plugin-list",className:"bda-slist",children:e}),a=!settingsCookie["fork-ps-5"]&&BDV2.react.createElement(V2Components.TooltipWrap(V2Components.ReloadIcon,{color:"black",side:"top",text:"Reload Plugin List"}),{className:"bd-reload-header",size:"18px",onClick:async()=>{pluginModule.updatePluginList(),this.sideBarOnClick("plugins")}}),n=BDV2.react.createElement("button",{key:"folder-button",className:"bd-pfbtn",onClick:()=>{require("electron").shell.openItem(ContentManager.pluginsFolder)}},"Open Plugin Folder"),o=BDV2.react.createElement(V2Components.ContentColumn,{key:"pcolumn",title:"Plugins",children:[a,n,t]});return BDV2.react.createElement(V2Components.Scroller,{contentColumn:!0,fade:!0,dark:!0,children:[o,BDV2.react.createElement(V2Components.Tools,{key:"tools"})]})}get themesComponent(){let e=Object.keys(bdthemes).sort((e,t)=>e.toLowerCase().localeCompare(t.toLowerCase())).reduce((e,t)=>(e.push(BDV2.react.createElement(V2Components.ThemeCard,{key:t,theme:bdthemes[t]})),e),[]),t=BDV2.react.createElement(V2Components.List,{key:"theme-list",className:"bda-slist",children:e}),a=!settingsCookie["fork-ps-5"]&&BDV2.react.createElement(V2Components.TooltipWrap(V2Components.ReloadIcon,{color:"black",side:"top",text:"Reload Theme List"}),{className:"bd-reload-header",size:"18px",onClick:async()=>{themeModule.updateThemeList(),this.sideBarOnClick("themes")}}),n=BDV2.react.createElement("button",{key:"folder-button",className:"bd-pfbtn",onClick:()=>{require("electron").shell.openItem(ContentManager.themesFolder)}},"Open Theme Folder"),o=BDV2.react.createElement(V2Components.ContentColumn,{key:"tcolumn",title:"Themes",children:[a,n,t]});return BDV2.react.createElement(V2Components.Scroller,{contentColumn:!0,fade:!0,dark:!0,children:[o,BDV2.react.createElement(V2Components.Tools,{key:"tools"})]})}renderCoreSettings(){let e=this.root;return e?void BDV2.reactDom.render(this.coreComponent,e):void console.log("FAILED TO LOCATE ROOT: .layer-3QrUeG .standardSidebarView-3F1I7i")}renderEmoteSettings(){let e=this.root;return e?void BDV2.reactDom.render(this.emoteComponent,e):void console.log("FAILED TO LOCATE ROOT: .layer-3QrUeG .standardSidebarView-3F1I7i")}renderCustomCssEditor(){let e=this.root;return e?void BDV2.reactDom.render(this.customCssComponent,e):void console.log("FAILED TO LOCATE ROOT: .layer-3QrUeG .standardSidebarView-3F1I7i")}renderPluginPane(){let e=this.root;return e?void BDV2.reactDom.render(this.contentComponent("plugins"),e):void console.log("FAILED TO LOCATE ROOT: .layer-3QrUeG .standardSidebarView-3F1I7i")}renderThemePane(){let e=this.root;return e?void BDV2.reactDom.render(this.contentComponent("themes"),e):void console.log("FAILED TO LOCATE ROOT: .layer-3QrUeG .standardSidebarView-3F1I7i")}}class V2C_Layer extends BDV2.reactComponent{constructor(e){super(e)}componentDidMount(){$(window).on(`keyup.${this.props.id}`,t=>{27===t.which&&BDV2.reactDom.unmountComponentAtNode(this.refs.root.parentNode)}),$(`#${this.props.id}`).animate({opacity:1},{step:function(e){$(this).css("transform",`scale(${1.1-.1*e}) translateZ(0px)`)},duration:200,done:()=>{$(`#${this.props.id}`).css("opacity","").css("transform","")}})}componentWillUnmount(){$(window).off(`keyup.${this.props.id}`),$(`#${this.props.id}`).animate({opacity:0},{step:function(e){$(this).css("transform",`scale(${1.1-.1*e}) translateZ(0px)`)},duration:200,done:()=>{$(`#${this.props.rootId}`).remove()}}),$("[class*=\"layer-\"]").removeClass("publicServersOpen").animate({opacity:1},{step:function(e){$(this).css("transform",`scale(${.07*e+.93}) translateZ(0px)`)},duration:200,done:()=>{$("[class*=\"layer-\"]").css("opacity","").css("transform","")}})}componentWillMount(){$("[class*=\"layer-\"]").addClass("publicServersOpen").animate({opacity:0},{step:function(e){$(this).css("transform",`scale(${.07*e+.93}) translateZ(0px)`)},duration:200})}render(){return BDV2.react.createElement("div",{className:"layer bd-layer layer-3QrUeG",id:this.props.id,ref:"root",style:{opacity:0,transform:"scale(1.1) translateZ(0px)"}},this.props.children)}}class V2C_SidebarView extends BDV2.reactComponent{constructor(e){super(e)}render(){let{sidebar:e,content:t,tools:a}=this.props.children;return BDV2.react.createElement("div",{className:"standardSidebarView-3F1I7i ui-standard-sidebar-view"},BDV2.react.createElement("div",{className:"sidebarRegion-VFTUkN sidebar-region"},BDV2.react.createElement(V2Components.Scroller,{key:"sidebarScroller",ref:"sidebarScroller",sidebar:!0,fade:e.fade||!0,dark:e.dark||!0,children:e.component})),BDV2.react.createElement("div",{className:"contentRegion-3nDuYy content-region"},BDV2.react.createElement("div",{className:"contentTransitionWrap-3hqOEW content-transition-wrap"},BDV2.react.createElement("div",{className:"scrollerWrap-2lJEkd firefoxFixScrollFlex-cnI2ix contentRegionScrollerWrap-3YZXdm content-region-scroller-wrap scrollerThemed-2oenus themeGhost-28MSn0 scrollerTrack-1ZIpsv"},BDV2.react.createElement("div",{className:"scroller-2FKFPG firefoxFixScrollFlex-cnI2ix contentRegionScroller-26nc1e content-region-scroller scroller",ref:"contentScroller"},BDV2.react.createElement("div",{className:"contentColumn-2hrIYH contentColumnDefault-1VQkGM content-column default"},t.component),a.component)))))}}class V2_PublicServers{constructor(){this._appendButton=this._appendButton.bind(this)}get component(){return BDV2.react.createElement(V2Components.Layer,{rootId:"pubslayerroot",id:"pubslayer",children:BDV2.react.createElement(V2C_PublicServers,{rootId:"pubslayerroot"})})}get root(){let e=document.getElementById("pubslayerroot");return e?e:this.injectRoot()?this.root:null}injectRoot(){return!!$(".layers, .layers-3iHuyZ").length&&($(".layers, .layers-3iHuyZ").append($("<div/>",{id:"pubslayerroot"})),!0)}render(){let e=this.root;return e?void BDV2.reactDom.render(this.component,e):void console.log("FAILED TO LOCATE ROOT: .layers")}get button(){let e=$("<div/>",{class:BDV2.guildClasses.listItem,id:"bd-pub-li",style:settingsCookie["bda-gs-1"]?"":"display: none;"}).append($("<div/>",{class:"wrapper-25eVIn "+BDV2.guildClasses.circleButtonMask,text:"public",id:"bd-pub-button",click:()=>{this.render()}}));return e}_appendButton(){if($("#bd-pub-li").length)return;const e=BDV2.guildClasses.wrapper.split(" ")[0],t=$(`.${e} .scroller-2FKFPG >:first-child`);t.after(this.button)}addButton(){if(!this.guildPatch){const e=BdApi.findModuleByDisplayName("Guilds");this.guildPatch=BdApi.monkeyPatch(e.prototype,"render",{after:this._appendButton}),this._appendButton()}}removeButton(){this.guildPatch(),delete this.guildPatch,$("#bd-pub-li").remove()}}class V2C_ServerCard extends BDV2.reactComponent{constructor(e){super(e),this.props.server.iconUrl||(this.props.server.iconUrl=this.props.fallback),this.state={imageError:!1,joined:this.props.guildList.includes(this.props.server.identifier)}}render(){let{server:e}=this.props;return BDV2.react.createElement("div",{className:`card-3Qj_Yx cardPrimary-1Hv-to marginBottom8-AtZOdT bd-server-card${e.pinned?" bd-server-card-pinned":""}`},BDV2.react.createElement("img",{ref:"img",className:"bd-server-image",src:e.iconUrl,onError:this.handleError.bind(this)}),BDV2.react.createElement("div",{className:"flexChild-faoVW3 bd-server-content"},BDV2.react.createElement("div",{className:"flex-1xMQg5 flex-1O1GKY horizontal-1ae9ci horizontal-2EEEnY directionRow-3v3tfG noWrap-3jynv6 bd-server-header"},BDV2.react.createElement("h5",{className:"h5-18_1nd defaultColor-1_ajX0 margin-reset bd-server-name"},e.name),BDV2.react.createElement("h5",{className:"h5-18_1nd defaultColor-1_ajX0 margin-reset bd-server-member-count"},e.members," Members")),BDV2.react.createElement("div",{className:"flex-1xMQg5 flex-1O1GKY horizontal-1ae9ci horizontal-2EEEnY directionRow-3v3tfG noWrap-3jynv6"},BDV2.react.createElement("div",{className:"scrollerWrap-2lJEkd scrollerThemed-2oenus themeGhostHairline-DBD-2d scrollerFade-1Ijw5y bd-server-description-container"},BDV2.react.createElement("div",{className:"scroller-2FKFPG scroller bd-server-description"},e.description))),BDV2.react.createElement("div",{className:"flex-1xMQg5 flex-1O1GKY horizontal-1ae9ci horizontal-2EEEnY directionRow-3v3tfG noWrap-3jynv6 bd-server-footer"},BDV2.react.createElement("div",{className:"flexChild-faoVW3 bd-server-tags",style:{flex:"1 1 auto"}},e.categories.join(", ")),this.state.joined&&BDV2.react.createElement("button",{type:"button",className:"button-38aScr lookFilled-1Gx00P colorBrand-3pXr91 sizeMin-1mJd1x grow-q77ONN colorGreen-29iAKY",style:{minHeight:"12px",marginTop:"4px",backgroundColor:"#3ac15c"}},BDV2.react.createElement("div",{className:"ui-button-contents"},"Joined")),e.error&&BDV2.react.createElement("button",{type:"button",className:"button-38aScr lookFilled-1Gx00P colorBrand-3pXr91 sizeMin-1mJd1x grow-q77ONN disabled-9aF2ug",style:{minHeight:"12px",marginTop:"4px",backgroundColor:"#c13a3a"}},BDV2.react.createElement("div",{className:"ui-button-contents"},"Error")),!e.error&&!this.state.joined&&BDV2.react.createElement("button",{type:"button",className:"button-38aScr lookFilled-1Gx00P colorBrand-3pXr91 sizeMin-1mJd1x grow-q77ONN",style:{minHeight:"12px",marginTop:"4px"},onClick:()=>{this.join()}},BDV2.react.createElement("div",{className:"ui-button-contents"},"Join")))))}handleError(){this.props.server.iconUrl=this.props.fallback,this.setState({imageError:!0})}join(){this.props.join(this)}}class V2C_PublicServers extends BDV2.reactComponent{constructor(e){super(e),this.setInitialState(),this.close=this.close.bind(this),this.changeCategory=this.changeCategory.bind(this),this.search=this.search.bind(this),this.searchKeyDown=this.searchKeyDown.bind(this),this.checkConnection=this.checkConnection.bind(this),this.join=this.join.bind(this),this.connect=this.connect.bind(this),this.GuildStore=BDV2.WebpackModules.findByUniqueProperties(["getGuilds"]),this.AvatarDefaults=BDV2.WebpackModules.findByUniqueProperties(["getUserAvatarURL","DEFAULT_AVATARS"]),this.InviteActions=BDV2.WebpackModules.findByUniqueProperties(["acceptInvite"]),this.SortedGuildStore=BDV2.WebpackModules.findByUniqueProperties(["getSortedGuilds"])}componentDidMount(){this.checkConnection()}setInitialState(){this.state={selectedCategory:-1,title:"Loading...",loading:!0,servers:[],next:null,connection:{state:0,user:null}}}close(){BDV2.reactDom.unmountComponentAtNode(document.getElementById(this.props.rootId))}search(e,t){let a=this;$.ajax({method:"GET",url:`${a.endPoint}${e}${e?"&schema=new":"?schema=new"}`,success:e=>{let n=e.results.reduce((e,t)=>(t.joined=!1,e.push(t),e),[]);t||(n=a.state.servers.concat(n));let o=e.size+e.from;e.next=`?from=${o}`,a.state.term&&(e.next+=`&term=${a.state.term}`),a.state.selectedCategory&&(e.next+=`&category=${a.categoryButtons[a.state.selectedCategory]}`),o>=e.total&&(o=e.total,e.next=null);let s=`Showing 1-${o} of ${e.total} results in ${a.categoryButtons[a.state.selectedCategory]}`;a.state.term&&(s+=` for ${a.state.term}`),a.setState({loading:!1,title:s,servers:n,next:e.next}),t&&(a.refs.sbv.refs.contentScroller.scrollTop=0)},error:()=>{a.setState({loading:!1,title:"Failed to load servers. Check console for details"})}})}join(e){return e.props.pinned?this.InviteActions.acceptInvite(e.props.invite_code):void $.ajax({method:"GET",url:`${this.joinEndPoint}/${e.props.server.identifier}`,headers:{Accept:"application/json;","Content-Type":"application/json;","x-discord-token":this.state.connection.user.accessToken},crossDomain:!0,xhrFields:{withCredentials:!0},success:()=>{e.setState({joined:!0})}})}connect(){var e=Math.round;let t=this,a=t.windowOptions;a.x=e(window.screenX+window.innerWidth/2-a.width/2),a.y=e(window.screenY+window.innerHeight/2-a.height/2),t.joinWindow=new(window.require("electron").remote.BrowserWindow)(a);t.joinWindow.webContents.on("did-navigate",(e,a)=>{"https://auth.discordservers.com/info"!=a||(t.joinWindow.close(),t.checkConnection())}),t.joinWindow.loadURL("https://auth.discordservers.com/connect?scopes=guilds.join&previousUrl=https://auth.discordservers.com/info")}get windowOptions(){return{width:500,height:550,backgroundColor:"#282b30",show:!0,resizable:!1,maximizable:!1,minimizable:!1,alwaysOnTop:!0,frame:!1,center:!1,webPreferences:{nodeIntegration:!1}}}get bdServer(){let e=this.SortedGuildStore.getFlattenedGuildIds(),t=this.AvatarDefaults.DEFAULT_AVATARS;return BDV2.react.createElement(V2Components.ServerCard,{server:{name:"BetterDiscord",online:"7500+",members:"20000+",categories:["community","programming","support"],description:"Official BetterDiscord server for support etc",identifier:"86004744966914048",iconUrl:"https://cdn.discordapp.com/icons/86004744966914048/292e7f6bfff2b71dfd13e508a859aedd.webp",nativejoin:!0,invite_code:"0Tmfo5ZbORCRqbAd",pinned:!0},pinned:!0,join:this.join,guildList:e,fallback:t[Math.floor(5*Math.random())]})}get endPoint(){return"https://search.discordservers.com"}get joinEndPoint(){return"https://j.discordservers.com"}get connectEndPoint(){return"https://join.discordservers.com/connect"}checkConnection(){let e=this;try{$.ajax({method:"GET",url:`https://auth.discordservers.com/info`,headers:{Accept:"application/json;","Content-Type":"application/json;"},crossDomain:!0,xhrFields:{withCredentials:!0},success:t=>{e.setState({selectedCategory:0,connection:{state:2,user:t}}),e.search("",!0)},error:()=>{e.setState({title:"Not connected to discordservers.com!",loading:!0,selectedCategory:-1,connection:{state:1,user:null}})}})}catch(t){e.setState({title:"Not connected to discordservers.com!",loading:!0,selectedCategory:-1,connection:{state:1,user:null}})}}render(){return BDV2.react.createElement(V2Components.SidebarView,{ref:"sbv",children:this.component})}get component(){return{sidebar:{component:this.sidebar},content:{component:this.content},tools:{component:BDV2.react.createElement(V2Components.Tools,{key:"pt",ref:"tools",onClick:this.close})}}}get sidebar(){return BDV2.react.createElement("div",{className:"sidebar",key:"ps"},BDV2.react.createElement("div",{className:"ui-tab-bar SIDE"},BDV2.react.createElement("div",{className:"ui-tab-bar-header",style:{fontSize:"16px"}},"Public Servers"),BDV2.react.createElement(V2Components.TabBar.Separator,null),this.searchInput,BDV2.react.createElement(V2Components.TabBar.Separator,null),BDV2.react.createElement(V2Components.TabBar.Header,{text:"Categories"}),this.categoryButtons.map((e,t)=>BDV2.react.createElement(V2Components.TabBar.Item,{id:t,onClick:this.changeCategory,key:t,text:e,selected:this.state.selectedCategory===t})),BDV2.react.createElement(V2Components.TabBar.Separator,null),this.footer,this.connection))}get searchInput(){return BDV2.react.createElement("div",{className:"ui-form-item"},BDV2.react.createElement("div",{className:"ui-text-input flex-vertical",style:{width:"172px",marginLeft:"10px"}},BDV2.react.createElement("input",{ref:"searchinput",onKeyDown:this.searchKeyDown,onChange:()=>{},type:"text",className:"input default",placeholder:"Search...",maxLength:"50"})))}searchKeyDown(t){let e=this;if(e.state.loading||13!==t.which)return;e.setState({loading:!0,title:"Loading...",term:t.target.value});let a=`?term=${t.target.value}`;0!==e.state.selectedCategory&&(a+=`&category=${e.categoryButtons[e.state.selectedCategory]}`),e.search(a,!0)}get categoryButtons(){return["All","FPS Games","MMO Games","Strategy Games","MOBA Games","RPG Games","Tabletop Games","Sandbox Games","Simulation Games","Music","Community","Language","Programming","Other"]}changeCategory(e){let t=this;if(!t.state.loading)return t.refs.searchinput.value="",t.setState({loading:!0,selectedCategory:e,title:"Loading...",term:null}),0===e?void t.search("",!0):void t.search(`?category=${t.categoryButtons[e]}`,!0)}get content(){var e=Math.floor;let t=this,a=this.SortedGuildStore.getFlattenedGuildIds(),n=this.AvatarDefaults.DEFAULT_AVATARS;return 1===t.state.connection.state?t.notConnected:[BDV2.react.createElement("div",{ref:"content",key:"pc",className:"contentColumn-2hrIYH contentColumnDefault-1VQkGM content-column default"},BDV2.react.createElement(V2Components.SettingsTitle,{text:t.state.title}),t.bdServer,t.state.servers.map(o=>BDV2.react.createElement(V2Components.ServerCard,{key:o.identifier,server:o,join:t.join,guildList:a,fallback:n[e(5*Math.random())]})),t.state.next&&BDV2.react.createElement("button",{type:"button",onClick:()=>{t.state.loading||(t.setState({loading:!0}),t.search(t.state.next,!1))},className:"ui-button filled brand small grow",style:{width:"100%",marginTop:"10px",marginBottom:"10px"}},BDV2.react.createElement("div",{className:"ui-button-contents"},t.state.loading?"Loading":"Load More")),0<t.state.servers.length&&BDV2.react.createElement(V2Components.SettingsTitle,{text:t.state.title}))]}get notConnected(){let e=this;return[BDV2.react.createElement("div",{key:"ncc",ref:"content",className:"contentColumn-2hrIYH contentColumnDefault-1VQkGM content-column default"},BDV2.react.createElement("h2",{className:"ui-form-title h2 margin-reset margin-bottom-20"},"Not connected to discordservers.com!",BDV2.react.createElement("button",{onClick:e.connect,type:"button",className:"ui-button filled brand small grow",style:{display:"inline-block",minHeight:"18px",marginLeft:"10px",lineHeight:"14px"}},BDV2.react.createElement("div",{className:"ui-button-contents"},"Connect"))),e.bdServer)]}get footer(){return BDV2.react.createElement("div",{className:"ui-tab-bar-header"},BDV2.react.createElement("a",{href:"https://discordservers.com",target:"_blank"},"Discordservers.com"))}get connection(){let e=this,{connection:t}=e.state;return 2===t.state?BDV2.react.createElement("span",null,BDV2.react.createElement(V2Components.TabBar.Separator,null),BDV2.react.createElement("span",{style:{color:"#b9bbbe",fontSize:"10px",marginLeft:"10px"}},"Connected as: ",`${t.user.username}#${t.user.discriminator}`),BDV2.react.createElement("div",{style:{padding:"5px 10px 0 10px"}},BDV2.react.createElement("button",{style:{width:"100%",minHeight:"20px"},type:"button",className:"ui-button filled brand small grow"},BDV2.react.createElement("div",{className:"ui-button-contents",onClick:e.connect},"Reconnect")))):BDV2.react.createElement("span",null)}}