Lightcord/BetterDiscordApp/dist/index.min.js

2 lines
196 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

module.exports=function(e){var t={};function n(s){if(t[s])return t[s].exports;var r=t[s]={i:s,l:!1,exports:{}};return e[s].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,s){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:s})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var s=Object.create(null);if(n.r(s),Object.defineProperty(s,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(s,r,function(t){return e[t]}.bind(null,r));return s},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=7)}([function(e,t){e.exports=require("electron")},function(e,t){e.exports=require("path")},function(e,t){e.exports=require("fs")},function(e,t){e.exports=require("crypto")},function(e,t){e.exports=require("node-fetch")},function(e,t){e.exports=require("events")},function(e,t){e.exports=require("module")},function(e,t,n){"use strict";n.r(t),n.d(t,"default",(function(){return Us}));var s={};n.r(s),n.d(s,"minimumDiscordVersion",(function(){return r})),n.d(s,"currentDiscordVersion",(function(){return i})),n.d(s,"minSupportedVersion",(function(){return o})),n.d(s,"bbdVersion",(function(){return a})),n.d(s,"bbdChangelog",(function(){return l})),n.d(s,"settings",(function(){return c})),n.d(s,"defaultCookie",(function(){return d})),n.d(s,"settingsCookie",(function(){return h})),n.d(s,"settingsRPC",(function(){return u})),n.d(s,"defaultRPC",(function(){return p})),n.d(s,"lightcordSettings",(function(){return m})),n.d(s,"defaultLightcordSettings",(function(){return g})),n.d(s,"bdpluginErrors",(function(){return f})),n.d(s,"bdthemeErrors",(function(){return b})),n.d(s,"bdConfig",(function(){return y})),n.d(s,"bdthemes",(function(){return v})),n.d(s,"bdplugins",(function(){return w})),n.d(s,"pluginCookie",(function(){return C})),n.d(s,"themeCookie",(function(){return E}));const r="0.0.308",i=window.DiscordNative&&window.DiscordNative.remoteApp&&window.DiscordNative.remoteApp.getVersion&&window.DiscordNative.remoteApp.getVersion()||"0.0.308",o="0.3.0",a="0.3.5",l={description:"Big things are coming.",changes:[{title:"Bug Fixes",type:"fixed",items:["Some fixes related to showing modals in the `BdApi`.","Fixed the open folder buttons for plugins and themes"]}]},c={"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"},"Scan Plugins":{id:"fork-ps-6",info:"Scan plugins for any threat that can be hidden inside.",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"},"Enable Edit Button":{id:"fork-ps-7",info:"Enable an Edit Button on the plugin and theme panel.",implemented:!0,hidden:!1,cat:"core",category:"content manager"},"Themes in Popout Window":{id:"lightcord-9",info:"Enable themes in Popout Window. (For example, when detaching screenshare.)",implemented:!0,hidden:!1,cat:"core",category:"content manager",experimental:!0},"Developer Mode":{id:"bda-gs-8",info:"Developer Mode Toggle",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"},"Disable BetterDiscord":{id:"bd-disable",info:"Disable Betterdiscord (plugins, themes, etc) (Not implemented).",implemented:!1,hidden:!1,cat:"lightcord",category:"Lightcord"},"Blur Personal Information":{id:"lightcord-6",info:"Blur sensitive informations like email, payment infos and more.",implemented:!0,hidden:!1,cat:"lightcord",category:"Lightcord"},"Calling Ring Beat":{id:"lightcord-2",info:"Enable Discord's special calling beat.",implemented:!0,hidden:!1,cat:"lightcord",category:"Lightcord"},"Developer Options":{id:"lightcord-1",info:'Enable Discord\'s & Lightcord\'s Internal Developer Options. This allow the "Experiments" tab, the "Developer Options" tab and the "Lightcord Api" section.',implemented:!0,hidden:!1,cat:"lightcord",category:"Lightcord"},"Ad Block":{id:"lightcord-4",info:"Block any BOT that dms you with an invite link. Even in an embed.",implemented:!0,hidden:!1,cat:"lightcord",category:"Lightcord"},"Enable Lightcord Servers":{id:"lightcord-5",info:"Enable Lightcord's servers. Disabling this will disable custom badges.",implemented:!0,hidden:!1,cat:"lightcord",category:"Lightcord"},"Disable typing":{id:"lightcord-7",info:"Don't let other see you're typing.",implemented:!0,hidden:!1,cat:"lightcord",category:"Lightcord"},"Lightcord Tabs":{id:"lightcord-8",info:"Allows you to launch multiple instances of Lightcord in the same window.",implemented:!0,hidden:!1,cat:"lightcord",category:"Lightcord",experimental:!0},"Use Notification Shim":{id:"lightcord-10",info:"Basically don't use Windows's Notifications.",implemented:!0,hidden:"win32"!==process.platform,cat:"lightcord",category:"Lightcord"},"Emoji Prefix":{id:"lightcord-11",info:"Change the prefix used for free nitros emojis. Please put only one character. Default: .",implemented:!0,hidden:!1,cat:"lightcord",category:"Lightcord",default:"."},"Always-on-Top":{id:"lightcord-3",info:"Enable the window's Always-on-Top mode, where Lightcord stays on top of other applications.",implemented:!0,hidden:!1,cat:"lightcord",category:"Window"},"No Window Bounds":{id:"no_window_bound",info:"Disable Window Bounds. Can be useful if you use a window manager.",implemented:!0,hidden:"linux"!==process.platform,cat:"lightcord",category:"Window"},"Enable Glasstron":{id:"enable_glasstron",info:"Enable Glasstron. If you're not using transparent themes, this can reduce lag.",implemented:!0,hidden:!1,cat:"lightcord",category:"Window"},Enable:{id:"lightcord-presence-1",info:"Enable RichPresence below.",implemented:!0,hidden:!1,cat:"status"}},d={"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-ps-6":!0,"fork-ps-7":!1,"fork-es-2":!1,"fork-es-3":!0,"fork-wp-1":!1,"fork-wp-2":!1,"fork-beta":!0,"lightcord-1":!1,"lightcord-2":!0,"lightcord-presence-1":!1,"lightcord-3":!1,"lightcord-4":!1,"lightcord-5":!0,"lightcord-6":!0,"lightcord-7":!1,"lightcord-8":!1,"lightcord-9":!1,"lightcord-10":!1,no_window_bound:!1},h={},u={},p={name:"Lightcord",application_id:"711416957718757418",state:"Lightcord Client",details:"Browsing Discord","timestamps.start":Date.now(),"assets.small":null,"assets.large":"712323821037682791"},m={},g={},f=[],b=[],y=Object.create(BetterDiscordConfig),v={},w={},C={},E={},S=webpackJsonp.push([[],{__extra_id__:(e,t,n)=>e.exports=n},[["__extra_id__"]]]);delete S.m.__extra_id__,delete S.c.__extra_id__;const x=e=>{for(const t in S.c)if(S.c.hasOwnProperty(t)){const n=S.c[t].exports;if(n&&n.__esModule&&n.default&&e(n.default))return n.default;if(n&&e(n))return n}return null};let k={find:x,findAll:e=>{const t=[];for(const n in S.c)if(S.c.hasOwnProperty(n)){const s=S.c[n].exports;s&&s.__esModule&&s.default&&e(s.default)?t.push(s.default):s&&e(s)&&t.push(s)}return t},findByProps:(...e)=>x(t=>e.every(e=>void 0!==t[e])),findByPrototypes:(...e)=>x(t=>t.prototype&&e.every(e=>void 0!==t.prototype[e])),findByDisplayName:e=>x(t=>t.displayName===e)};var D=k;window.Lightcord.BetterDiscord.WebpackModules=k;const M=n(2),B=n(1),L=DiscordNative.globals?DiscordNative.globals.releaseChannel:DiscordNative.app?DiscordNative.app.getReleaseChannel():"stable";let N="";N="win32"===process.platform?process.env.APPDATA:"darwin"===process.platform?B.join(process.env.HOME,"Library","Preferences"):process.env.XDG_CONFIG_HOME?process.env.XDG_CONFIG_HOME:B.join(process.env.HOME,".config"),N=B.join(N,"BetterDiscord");var A=new class{constructor(){this.data={settings:{stable:{},canary:{},ptb:{}}},this.pluginData={},window.Lightcord.BetterDiscord.DataStore=this}initialize(){try{M.existsSync(this.BDFile)||M.writeFileSync(this.BDFile,JSON.stringify(this.data,null,4),"utf-8");const e=JSON.parse(M.readFileSync(this.BDFile,"utf-8"));if(e.hasOwnProperty("settings")&&(this.data=e),!M.existsSync(this.settingsFile))return;let t=require(this.settingsFile);M.unlinkSync(this.settingsFile),t=t.hasOwnProperty("settings")?Object.assign({stable:{},canary:{},ptb:{}},{[L]:t}):Object.assign({stable:{},canary:{},ptb:{}},t),this.setBDData("settings",t)}catch(e){console.error(e),Be.alert("Corrupt Storage","The bd storage has somehow become corrupt. You may either try to salvage the file or delete it then reload.")}}get injectionPath(){return this._injectionPath=null}get configFile(){return this._configFile||(this._configFile=B.resolve(this.injectionPath,"betterdiscord","config.json"))}get BDFile(){return this._BDFile||(this._BDFile=B.resolve(N,"bdstorage.json"))}get settingsFile(){return this._settingsFile||(this._settingsFile=B.resolve(N,"bdsettings.json"))}getPluginFile(e){return B.resolve(Se.pluginsFolder,e+".config.json")}getSettingGroup(e){return this.data.settings[L][e]||null}setSettingGroup(e,t){this.data.settings[L][e]=t,M.writeFileSync(this.BDFile,JSON.stringify(this.data,null,4),"utf-8")}getBDData(e){return this.data[e]||""}setBDData(e,t){this.data[e]=t,M.writeFileSync(this.BDFile,JSON.stringify(this.data,null,4),"utf-8")}getPluginData(e,t){return void 0!==this.pluginData[e]?this.pluginData[e][t]:M.existsSync(this.getPluginFile(e))?(this.pluginData[e]=JSON.parse(M.readFileSync(this.getPluginFile(e))),this.pluginData[e][t]):void 0}setPluginData(e,t,n){void 0!==n&&(void 0===this.pluginData[e]&&(this.pluginData[e]={}),this.pluginData[e][t]=n,M.writeFileSync(this.getPluginFile(e),JSON.stringify(this.pluginData[e],null,4),"utf-8"))}deletePluginData(e,t){void 0===this.pluginData[e]&&(this.pluginData[e]={}),delete this.pluginData[e][t],M.writeFileSync(this.getPluginFile(e),JSON.stringify(this.pluginData[e],null,4),"utf-8")}};const P=n(5);var T=new class extends P{constructor(){super(),window.Lightcord.BetterDiscord.BDEvents=this}dispatch(e,...t){this.emit(e,...t)}off(e,t){this.removeListener(e,t)}};class R{constructor(){window.Lightcord.BetterDiscord.PluginModule=this}get folder(){return Se.pluginsFolder}}R.prototype.loadPlugins=async function(){this.loadPluginData(),f.splice(0,0,...await Se.loadPlugins());const e=Object.keys(w);for(let t=0;t<e.length;t++){let n,s;try{n=w[e[t]].plugin,s=n.getName(),n.load&&"function"==typeof n.load&&n.load()}catch(n){C[s]=!1,Be.err("Plugins",s+" could not be loaded.",n),f.push({name:s,file:w[e[t]].filename,message:"load() could not be fired.",error:{message:n.message,stack:n.stack}});continue}if(C[s]||(C[s]=!1),C[s])try{n.start(),h["fork-ps-2"]&&Be.showToast(`${n.getName()} v${n.getVersion()} has started.`)}catch(n){C[s]=!1,Be.err("Plugins",s+" could not be started.",n),f.push({name:s,file:w[e[t]].filename,message:"start() could not be fired.",error:{message:n.message,stack:n.stack}})}await new Promise(e=>setTimeout(e,10))}this.savePluginData(),n(0).remote.getCurrentWebContents().on("did-navigate-in-page",this.channelSwitch.bind(this))},R.prototype.startPlugin=function(e,t=!1){try{w[e].plugin.start(),h["fork-ps-2"]&&!t&&Be.showToast(`${w[e].plugin.getName()} v${w[e].plugin.getVersion()} has started.`)}catch(n){h["fork-ps-2"]&&!t&&Be.showToast(`${w[e].plugin.getName()} v${w[e].plugin.getVersion()} could not be started.`,{type:"error"}),C[e]=!1,this.savePluginData(),Be.err("Plugins",e+" could not be started.",n)}},R.prototype.stopPlugin=function(e,t=!1){try{w[e].plugin.stop(),h["fork-ps-2"]&&!t&&Be.showToast(`${w[e].plugin.getName()} v${w[e].plugin.getVersion()} has stopped.`)}catch(n){h["fork-ps-2"]&&!t&&Be.showToast(`${w[e].plugin.getName()} v${w[e].plugin.getVersion()} could not be stopped.`,{type:"error"}),Be.err("Plugins",w[e].plugin.getName()+" could not be stopped.",n)}},R.prototype.enablePlugin=function(e,t=!1){C[e]||(C[e]=!0,this.savePluginData(),this.startPlugin(e,t))},R.prototype.enable=function(e,t=!1){return this.enablePlugin(e,t)},R.prototype.disablePlugin=function(e,t=!1){C[e]&&(C[e]=!1,this.savePluginData(),this.stopPlugin(e,t))},R.prototype.disable=function(e,t=!1){return this.disablePlugin(e,t)},R.prototype.togglePlugin=function(e){C[e]?this.disablePlugin(e):this.enablePlugin(e)},R.prototype.toggle=function(e,t=!1){return this.togglePlugin(e,t)},R.prototype.loadPlugin=async function(e){const t=await Se.loadContent(e,"plugin");if(t)return h["fork-ps-1"]&&Be.showContentErrors({plugins:[t]}),h["fork-ps-2"]&&Be.showToast(e+" could not be loaded.",{type:"error"}),Be.err("ContentManager",e+" could not be loaded.",t);const n=Object.values(w).find(t=>console.log(t.filename,e)||t.filename==e).plugin;try{n.load&&"function"==typeof n.load&&n.load()}catch(e){h["fork-ps-1"]&&Be.showContentErrors({plugins:[e]})}Be.log("ContentManager",`${n.getName()} v${n.getVersion()} was loaded.`),h["fork-ps-2"]&&Be.showToast(`${n.getName()} v${n.getVersion()} was loaded.`,{type:"success"}),T.dispatch("plugin-loaded",n.getName())},R.prototype.unloadPlugin=function(e){const t=Object.values(w).find(t=>t.filename==e)||w[e];if(!t)return;const n=t.plugin.getName();C[n]&&this.disablePlugin(n,!0);const s=Se.unloadContent(w[n].filename,"plugin");if(delete w[n],s)return h["fork-ps-1"]&&Be.showContentErrors({plugins:[s]}),h["fork-ps-2"]&&Be.showToast(n+" could not be unloaded. It may have not been loaded yet.",{type:"error"}),Be.err("ContentManager",n+" could not be unloaded. It may have not been loaded yet.",s);Be.log("ContentManager",n+" was unloaded."),h["fork-ps-2"]&&Be.showToast(n+" was unloaded.",{type:"success"}),T.dispatch("plugin-unloaded",n)},R.prototype.delete=function(e){const t=Object.values(w).find(t=>t.filename==e)||w[e];if(!t)return;this.unloadPlugin(t.filename);const s=n(1).resolve(Se.pluginsFolder,t.filename);n(2).unlinkSync(s)},R.prototype.reloadPlugin=async function(e){const t=Object.values(w).find(t=>t.filename==e)||w[e];if(!t)return this.loadPlugin(e);const n=t.plugin.getName(),s=C[n];s&&this.stopPlugin(n,!0);const r=await Se.reloadContent(w[n].filename,"plugin");if(r)return h["fork-ps-1"]&&Be.showContentErrors({plugins:[r]}),h["fork-ps-2"]&&Be.showToast(n+" could not be reloaded.",{type:"error"}),Be.err("ContentManager",n+" could not be reloaded.",r);w[n].plugin.load&&"function"==typeof w[n].plugin.load&&w[n].plugin.load(),s&&this.startPlugin(n,!0),Be.log("ContentManager",`${n} v${w[n].plugin.getVersion()} was reloaded.`),h["fork-ps-2"]&&Be.showToast(`${n} v${w[n].plugin.getVersion()} was reloaded.`,{type:"success"}),T.dispatch("plugin-reloaded",n)},R.prototype.reload=function(e){return this.reloadPlugin(e)},R.prototype.edit=function(e){const t=Object.values(w).find(t=>t.filename==e)||w[e];if(!t)return;const s=n(1).resolve(Se.pluginsFolder,t.filename);n(0).shell.openExternal(""+s)},R.prototype.updatePluginList=function(){const e=Se.loadNewContent("plugin");for(const t of e.added)this.loadPlugin(t);for(const t of e.removed)this.unloadPlugin(t)},R.prototype.loadPluginData=function(){const e=A.getSettingGroup("plugins");e&&Object.assign(C,e)},R.prototype.savePluginData=function(){A.setSettingGroup("plugins",C)},R.prototype.newMessage=function(){const e=Object.keys(w);for(let t=0;t<e.length;t++){const n=w[e[t]].plugin;if(C[n.getName()]&&"function"==typeof n.onMessage)try{n.onMessage()}catch(e){Be.err("Plugins","Unable to fire onMessage for "+n.getName()+".",e)}}},R.prototype.channelSwitch=function(){const e=Object.keys(w);for(let t=0;t<e.length;t++){const n=w[e[t]].plugin;if(C[n.getName()]&&"function"==typeof n.onSwitch)try{n.onSwitch()}catch(e){Be.err("Plugins","Unable to fire onSwitch for "+n.getName()+".",e)}}},R.prototype.rawObserver=function(e){const t=Object.keys(w);for(let n=0;n<t.length;n++){const s=w[t[n]].plugin;if(C[s.getName()]&&"function"==typeof s.observer)try{s.observer(e)}catch(e){Be.err("Plugins","Unable to fire observer for "+s.getName()+".",e)}}};var O=new R,_=n(4),j=n.n(_),I=n(0),$=n(3);let W,F;function H(){return W||(W=D.findByProps("tooltip","tooltipBlack"))}function U(){return F||(F=D.findByProps("layer","layerContainer"))}const z=function(e){const t=e[0].toUpperCase()+e.slice(1),n=H()["tooltip"+t];return n||null},G=function(e){return!!z(e)},q=function(e){return e+"px"};class V{constructor(e,t,n={}){const{style:s="black",side:r="top",preventFlip:i=!1,disabled:o=!1,attachEvents:a=!0}=n;if(this.node=e instanceof jQuery?e[0]:e,this.label=t,this.style=s.toLowerCase(),this.side=r.toLowerCase(),this.preventFlip=i,this.disabled=o,!G(this.side))return Be.err("EmulatedTooltip",`Side ${this.side} does not exist.`);if(!G(this.style))return Be.err("EmulatedTooltip",`Style ${this.style} does not exist.`);this.element=document.createElement("div"),this.element.className=U().layer+" "+U().disabledPointerEvents,this.tooltipElement=document.createElement("div"),this.tooltipElement.className=`${H().tooltip} ${z(this.style)}`,this.labelElement=document.createElement("div"),this.labelElement.className=H().tooltipContent;const l=document.createElement("div");l.className=H().tooltipPointer,this.tooltipElement.append(l),this.tooltipElement.append(this.labelElement),this.element.append(this.tooltipElement),a&&(this.node.addEventListener("mouseenter",()=>{if(this.disabled)return;this.show();const e=new MutationObserver(t=>{t.forEach(t=>{const n=Array.from(t.removedNodes),s=n.indexOf(this.node)>-1,r=n.some(e=>e.contains(this.node));(s||r)&&(this.hide(),e.disconnect())})});e.observe(document.body,{subtree:!0,childList:!0})}),this.node.addEventListener("mouseleave",()=>{this.hide()}))}get container(){return document.querySelector("."+Be.removeDa(BDModules.get(e=>e.popouts)[0].popouts)+" ~ ."+Be.removeDa(BDModules.get(e=>e.layerContainer)[0].layerContainer))}get canShowAbove(){return this.node.getBoundingClientRect().top-this.element.offsetHeight>=0}get canShowBelow(){return this.node.getBoundingClientRect().top+this.node.offsetHeight+this.element.offsetHeight<=Be.screenHeight}get canShowLeft(){return this.node.getBoundingClientRect().left-this.element.offsetWidth>=0}get canShowRight(){return this.node.getBoundingClientRect().left+this.node.offsetWidth+this.element.offsetWidth<=Be.screenWidth}hide(){this.element.remove(),this.tooltipElement.className=this._className}show(){this.tooltipElement.className=`${H().tooltip} ${z(this.style)}`,this.labelElement.textContent=this.label,this.container.append(this.element),"top"==this.side&&(this.canShowAbove||!this.canShowAbove&&this.preventFlip?this.showAbove():this.showBelow()),"bottom"==this.side&&(this.canShowBelow||!this.canShowBelow&&this.preventFlip?this.showBelow():this.showAbove()),"left"==this.side&&(this.canShowLeft||!this.canShowLeft&&this.preventFlip?this.showLeft():this.showRight()),"right"==this.side&&(this.canShowRight||!this.canShowRight&&this.preventFlip?this.showRight():this.showLeft())}showAbove(){this.tooltipElement.classList.add(z("top")),this.element.style.setProperty("top",q(this.node.getBoundingClientRect().top-this.element.offsetHeight-10)),this.centerHorizontally()}showBelow(){this.tooltipElement.classList.add(z("bottom")),this.element.style.setProperty("top",q(this.node.getBoundingClientRect().top+this.node.offsetHeight+10)),this.centerHorizontally()}showLeft(){this.tooltipElement.classList.add(z("left")),this.element.style.setProperty("left",q(this.node.getBoundingClientRect().left-this.element.offsetWidth-10)),this.centerVertically()}showRight(){this.tooltipElement.classList.add(z("right")),this.element.style.setProperty("left",q(this.node.getBoundingClientRect().left+this.node.offsetWidth+10)),this.centerVertically()}centerHorizontally(){const e=this.node.getBoundingClientRect().left+this.node.offsetWidth/2;this.element.style.setProperty("left",q(e-this.element.offsetWidth/2))}centerVertically(){const e=this.node.getBoundingClientRect().top+this.node.offsetHeight/2;this.element.style.setProperty("top",q(e-this.element.offsetHeight/2))}}var J=class extends React.Component{constructor(e){super(e)}async componentDidMount(){const{style:e="black",side:t="top",text:n=""}=this.props;this.node=Me.reactDom.findDOMNode(this),this.tooltip=new V(this.node,n,{style:e,side:t})}componentWillUnmount(){this.tooltip.hide(),delete this.tooltip}render(){return this.props.children}},Y=n(2),Z=n(1);const K={},X={};var Q=new class{constructor(){window.Lightcord.BetterDiscord.PluginCertifier=this}patch(e,t){process.nextTick(()=>{!function(e,t){if(!document.getElementById(t))return;if(!e.url.startsWith("https://cdn.discordapp.com/"))return document.getElementById(t).remove();if(!e.filename.endsWith(".plugin.js")&&!e.filename.endsWith(".theme.css"))return document.getElementById(t).remove();j()(e.url,{headers:{"User-Agent":I.ipcRenderer.sendSync("LIGHTCORD_GET_USER_AGENT")}}).then(n=>{if(200!==n.status)throw new Error("File doesn't exist.");const s=$.createHash("sha256");let r=Buffer.alloc(0);n.body.on("data",e=>{r=Buffer.concat([r,e]),s.update(e)}),n.body.on("end",()=>{const n=s.digest("hex");X[e.url]=n,se[n]=e.url,re(n,r,e.filename,n=>{!function(e,t,n){const s=document.getElementById(e);if(!s||s.childNodes.length>0)return;oe||(oe=BDModules.get(e=>e.flowerStarContainer)[0]);ae||(ae=BDModules.get(e=>e.childContainer)[0]);if(t.suspect){try{s.parentNode.style.borderColor="rgb(240, 71, 71)";let e=s=>{for(let r of s.children)"A"===r.tagName?r.addEventListener("click",e=>{e.preventDefault(),e.stopImmediatePropagation(),Be.showConfirmationModal("Are you sure you want to download this ?","The "+t.type.toLowerCase()+" **"+n+"** might be dangerous **("+t.harm+")**. \n\n**We don't recommand to download it**. However, you can still do it below.",{confirmText:"Download Anyway",cancelText:"Don't !",danger:!0,onCancel:()=>{},onConfirm:()=>{I.ipcRenderer.sendSync("LIGHTCORD_OPEN_EXTERNAL",r.href)}})}):["div"].includes(r.tagName.toLowerCase())&&e(r)};e(s.parentNode)}catch(e){console.error(e)}Me.reactDom.render(Me.react.createElement(J,{text:t.type+" "+t.name+" is potentially dangerous."},Me.react.createElement("div",{className:oe.flowerStarContainer,style:{width:"20px",height:"20px"}},Me.react.createElement("svg",{className:BDModules.get(e=>e.svg)[0].svg,"aria-hidden":"false",width:"20px",height:"20px",viewBox:"0 0 40 32"},Me.react.createElement("rect",{x:"0",y:"0",width:"32",height:"32",mask:"url(#svg-mask-avatar-status-round-32)",fill:"#f04747",mask:"url(#svg-mask-status-dnd)",className:BDModules.get(e=>e.pointerEvents)[0].pointerEvents})))),s)}else if(t.official){s.parentNode.style.borderColor="#4087ed";let e=Me.react.createElement("span",{style:{display:"inherit"}},[Me.react.createElement(J,{text:t.type+" "+t.name+" was made by the developers of Lightcord.",style:"brand"},Me.react.createElement("div",{className:oe.flowerStarContainer,style:{width:"20px",height:"20px",float:"left"}},Me.react.createElement("svg",{className:oe.flowerStar,"aria-hidden":"false",width:"20px",height:"20px",viewBox:"0 0 16 15.2",stroke:"#36393f",style:{color:"#4087ed"}},Me.react.createElement("path",{fill:"currentColor","fill-rule":"evenodd",d:"m16 7.6c0 .79-1.28 1.38-1.52 2.09s.44 2 0 2.59-1.84.35-2.46.8-.79 1.84-1.54 2.09-1.67-.8-2.47-.8-1.75 1-2.47.8-.92-1.64-1.54-2.09-2-.18-2.46-.8.23-1.84 0-2.59-1.54-1.3-1.54-2.09 1.28-1.38 1.52-2.09-.44-2 0-2.59 1.85-.35 2.48-.8.78-1.84 1.53-2.12 1.67.83 2.47.83 1.75-1 2.47-.8.91 1.64 1.53 2.09 2 .18 2.46.8-.23 1.84 0 2.59 1.54 1.3 1.54 2.09z"})),Me.react.createElement("div",{className:ae.childContainer},Me.react.createElement("svg",{"aria-hidden":"false",width:"20px",height:"20px",viewBox:"0 0 16 15.2"},Me.react.createElement("path",{fill:"#ffffff",d:"M10.7,5.28a2.9,2.9,0,0,0-2.11.86.11.11,0,0,0,0,.16l1.05.94a.11.11,0,0,0,.15,0,1.27,1.27,0,0,1,.9-.33c.65,0,.65.73.65.73a.64.64,0,0,1-.65.65,1.73,1.73,0,0,1-1.18-.54c-.31-.26-.36-.32-.73-.66S7.06,5.28,5.65,5.28A2.26,2.26,0,0,0,3.37,7.56,2.59,2.59,0,0,0,3.82,9a2.18,2.18,0,0,0,1.83.89,2.94,2.94,0,0,0,2.1-.81.11.11,0,0,0,0-.16L6.74,8A.11.11,0,0,0,6.6,8a1.58,1.58,0,0,1-.94.29h0A.71.71,0,0,1,5,7.56H5a.63.63,0,0,1,.65-.64c.71,0,1.42.75,1.94,1.27.75.76,1.66,1.79,3.11,1.74A2.28,2.28,0,0,0,13,7.64a2.59,2.59,0,0,0-.45-1.47A2.14,2.14,0,0,0,10.7,5.28Z"}))))),Me.react.createElement(J,{text:"Install this "+t.type.toLowerCase()+" on Lightcord."},Me.react.createElement("div",{className:oe.flowerStarContainer,style:{width:"20px",height:"20px"},onClick(){Be.showConfirmationModal("Are you sure you want to download this "+t.type.toLowerCase()+" ?","Lightcord will automatically download and load this "+t.type.toLowerCase()+". You must enable it in the settings.",{confirmText:"Download and Install",cancelText:"I've changed my mind",danger:!1,onCancel:()=>{},onConfirm:()=>{let e=le(X).find(e=>e[1]===t.hash)[0];j()(e).then(async e=>{if(200!==e.status)throw new Error("Status was not 200");let n=await e.buffer(),s=Object(Z.join)("Plugin"===t.type?Se._pluginsFolder:Se._themesFolder,t.filename);Object(Y.writeFileSync)(s,n),Be.showToast(t.type+" succesfully installed.")}).catch(e=>{e=e instanceof Error?e:new Error(e),Be.showToast(e.message,{type:"error"})})}})}},Me.react.createElement("svg",{className:oe.flowerStar,"aria-hidden":"false",width:"20px",height:"20px",viewBox:"0 0 24 24",style:{color:"rgb(67, 181, 129)",cursor:"pointer"}},React.createElement("g",{fill:"none","fill-rule":"evenodd"},React.createElement("path",{d:"M0 0h24v24H0z"}),React.createElement("path",{class:"fill",fill:"currentColor",d:"M19 9h-4V3H9v6H5l7 7 7-7zM5 18v2h14v-2H5z"})))))]);Me.reactDom.render(e,s)}else{s.parentNode.style.borderColor="#4087ed";let e=Me.react.createElement("span",{style:{display:"inherit"}},[Me.react.createElement(J,{text:t.type+" "+t.name+" is certified by Lightcord."},Me.react.createElement("div",{className:oe.flowerStarContainer,style:{width:"20px",height:"20px",float:"left"}},Me.react.createElement("svg",{className:oe.flowerStar,"aria-hidden":"false",width:"20px",height:"20px",viewBox:"0 0 16 15.2"},Me.react.createElement("path",{fill:"#4f545c","fill-rule":"evenodd",d:"m16 7.6c0 .79-1.28 1.38-1.52 2.09s.44 2 0 2.59-1.84.35-2.46.8-.79 1.84-1.54 2.09-1.67-.8-2.47-.8-1.75 1-2.47.8-.92-1.64-1.54-2.09-2-.18-2.46-.8.23-1.84 0-2.59-1.54-1.3-1.54-2.09 1.28-1.38 1.52-2.09-.44-2 0-2.59 1.85-.35 2.48-.8.78-1.84 1.53-2.12 1.67.83 2.47.83 1.75-1 2.47-.8.91 1.64 1.53 2.09 2 .18 2.46.8-.23 1.84 0 2.59 1.54 1.3 1.54 2.09z"})),Me.react.createElement("div",{className:ae.childContainer},Me.react.createElement("svg",{"aria-hidden":"false",width:"20px",height:"20px",viewBox:"0 0 16 15.2"},Me.react.createElement("path",{fill:"#ffffff",d:"M7.4,11.17,4,8.62,5,7.26l2,1.53L10.64,4l1.36,1Z"}))))),Me.react.createElement(J,{text:"Install this "+t.type.toLowerCase()+" on Lightcord."},Me.react.createElement("div",{className:oe.flowerStarContainer,style:{width:"20px",height:"20px"},onClick(){Be.showConfirmationModal("Are you sure you want to download this "+t.type.toLowerCase()+" ?","Lightcord will automatically install and launch this "+t.type.toLowerCase()+". You don't have anything to do.",{confirmText:"Download and Install",cancelText:"I've changed my mind",danger:!1,onCancel:()=>{},onConfirm:()=>{let e=le(X).find(e=>e[1]===t.hash)[0];console.log(e),j()(e).then(async e=>{if(200!==e.status)throw new Error("Status was not 200");let n=await e.buffer(),s=Object(Z.join)("Plugin"===t.type?Se._pluginsFolder:Se._themesFolder,t.filename);console.log(s),Object(Y.writeFileSync)(s,n),Be.showToast(t.type+" succesfully installed.")}).catch(e=>{e=e instanceof Error?e:new Error(e),Be.showToast(e.message,{type:"error"})})}})}},Me.react.createElement("svg",{className:oe.flowerStar,"aria-hidden":"false",width:"20px",height:"20px",viewBox:"0 0 24 24",style:{color:"rgb(67, 181, 129)",cursor:"pointer"}},React.createElement("g",{fill:"none","fill-rule":"evenodd"},React.createElement("path",{d:"M0 0h24v24H0z"}),React.createElement("path",{class:"fill",fill:"currentColor",d:"M19 9h-4V3H9v6H5l7 7 7-7zM5 18v2h14v-2H5z"})))))]);Me.reactDom.render(e,s)}}(t,n,e.filename)},()=>{let e=document.getElementById(t);e&&e.remove()})})}).catch(()=>{})}(e,t)})}start(){}isTrusted(e){return K[e]&&!K[e].suspect}};const ee=[[/token/gi,0,0],[/email/gi,0,0],[/mfa\./gi,0,0],[/2fa/gi,0,0],[/phone/gi,0,0],[/child_process/gi,0,0],[/localStorage/gi,0,0],[/getGlobal/gi,0,0],[/BrowserWindow/gi,0,0],[/system32/gi,0,0],[/password/gi,0,0],[/eval/gi,0,0],[/WebAssembly/gi,0,0],[/XMLHttpRequest(\.|\[["'`])prototype/gi,0,0],[/window\.fetch( +)?=/gi,0,0],[/(["'`]\+)["'`]\w["'`]/gi,1,1],[/["'`]\w["'`](\+["'`])/gi,1,1],[/\${["'`]\w+["'`]}/gi,1,1],[/_0x\w{4}\('0x[\dabcdef]+'\)/g,1,1],[/_0x\w{4}\('0x[\dabcdef]+'( +)?,( +)?'[^']{4}'\)/g,1,1],[/\w+\('0x[\dabcdef]+'\)/g,1,1],[/\w+\('0x[\dabcdef]+'( +)?,( +)?'[^']{4}'\)/g,1,1],[/^var [\w\d_$]+=\["/gi,1,1]],te=["Account Stealer/Virus","Obfuscation/Hidden code"];function ne(e,t,n,s,r){let i=!1;const o=(t=t.toString("utf8")).replace(/\/\*[\s\S]*?\*\/|([^\\:]|^)\/\/.*$/gm,"").trim();for(const[n,s,r]of ee){const a=1===r?o:t;if(n.exec(a)){i=te[s],console.log(se[e].split("/").pop()+" failed at test",n,". Marked as",te[s]);break}}if(!i)return s(e);K[e]={suspect:!0,name:se[e].split("/").pop(),type:se[e].endsWith(".js")?"Plugin":"Theme",harm:i,hash:e,filename:r},console.log(`Found potentially dangerous ${K[e].type.toLowerCase()}: ${K[e].name}`),n(K[e])}const se={};function re(e,t,n,s,r){if(console.log(`File: ${n} hash: ${e}`),K[e]){const t=K[e];s(t)}else j()("https://cdn.jsdelivr.net/gh/Lightcord/filehashes@master/hashes/"+e,{headers:{"User-Agent":I.ipcRenderer.sendSync("LIGHTCORD_GET_USER_AGENT")}}).then(async i=>{if(200!==i.status){if(n.endsWith(".theme.css"))return r(e);try{ne(e,t,s,r,n)}catch(e){console.error(e),r()}return}const o=await i.json();o.hash=e,o.filename=n,K[e]=o,s(o)}).catch(i=>{if(console.error("Could not read from github. "+i),n.endsWith(".theme.css"))return r(e);ne(e,t,s,r,n)})}function ie(e,t,n=(e=>{}),s=!1){const r=$.createHash("sha256");let i=Buffer.alloc(0);Object(Y.createReadStream)(e).on("data",e=>{i=Buffer.concat([i,e]),r.update(e)}).on("end",()=>{const o=r.digest("hex");if(se[o]=e,s&&Ce[o]){let e=Ce[o];if(!(e.timestamp<Date.now()-6048e5))return void t(e.result);delete Ce[o],Se.saveAddonCache()}re(o,i,Object(Z.basename)(e),t,n)})}let oe=BDModules.get(e=>e.flowerStarContainer)[0],ae=BDModules.get(e=>e.childContainer)[0];function le(e){let t=[];return Object.keys(e).forEach(n=>{t.push([n,e[n]])}),t}let ce=null,de=null;function he(){ce=[$.randomBytes(16).toString("base64"),$.randomBytes(32).toString("base64")]}function ue(e){let t=[Buffer.from(ce[1],"base64"),Buffer.from(ce[0],"base64")],n=$.createCipheriv("aes-256-cbc",...t),s=n.update(Buffer.from(e,"utf8"));return s=Buffer.concat([s,n.final()]),s.toString("base64")}window.Lightcord.Api.ensureExported(e=>e.ObjectStorage).then(e=>{let t=e.impl;de=function(){t.set("PluginCertifierKeyEncryption__",btoa(JSON.stringify(ce)))},setInterval(()=>{de()},1e5);try{let e=function(e){try{return JSON.parse(e)}catch(e){return e instanceof Error?new Error(e):e}}(atob(t.get("PluginCertifierKeyEncryption__")));if(e instanceof Error||!Array.isArray(e)||2!==e.length||e.find(e=>"string"!=typeof e)||16!==Buffer.from(e[0],"base64").length||32!==Buffer.from(e[1],"base64").length)return he(),void de();ce=e}catch(e){he(),de()}});const pe=n(1),me=n(2),ge=n(6).Module;ge.globalPaths.push(pe.resolve(I.ipcRenderer.sendSync("LIGHTCORD_GET_APP_PATH"),"node_modules"));class fe extends Error{constructor(e){super(e),this.name="MetaError"}}const be=ge._extensions[".js"],ye=ge._extensions[".css"]?ge._extensions[".css"]:()=>null,ve=/[^\S\r\n]*?(?:\r\n|\n)[^\S\r\n]*?\*[^\S\r\n]?/,we=/^\\@/;let Ce={},Ee=!1;var Se=new class{constructor(){this.timeCache={},this.watchers={}}patchExtensions(){Ee||(Ee=!0,ge._extensions[".js"]=this.getContentRequire("plugin"),ge._extensions[".css"]=this.getContentRequire("theme"))}get pluginsFolder(){return this._pluginsFolder||(this._pluginsFolder=me.realpathSync(pe.resolve(y.dataPath+"plugins/")))}get themesFolder(){return this._themesFolder||(this._themesFolder=me.realpathSync(pe.resolve(y.dataPath+"themes/")))}loadAddonCertifierCache(){if("string"!=typeof A.getSettingGroup("PluginCertifierHashes"))A.setSettingGroup("PluginCertifierHashes",ue("{}"));else try{Ce=JSON.parse(function(e){try{let t=$.createDecipheriv("aes-256-cbc",Buffer.from(ce[1],"base64"),Buffer.from(ce[0],"base64")),n=t.update(Buffer.from(e,"base64"));return n=Buffer.concat([n,t.final()]),n.toString("utf8")}catch(e){return"{}"}}(A.getSettingGroup("PluginCertifierHashes")))}catch(e){A.setSettingGroup("PluginCertifierHashes",ue("{}")),Ce={}}Object.keys(Ce).forEach(e=>{let t=Ce[e];if(!t||"object"!=typeof t||Array.isArray(t))return delete Ce[e];let n=[{key:"timestamp",type:"number"},{key:"result",type:"object"},{key:"hash",type:"string"}];for(let s of n)if(!(s.key in t)||typeof t[s.key]!==s.type)return void delete Ce[e];t.hash===e?t.result.suspect&&delete Ce[e]:delete Ce[e]}),this.saveAddonCache()}saveAddonCache(){A.setSettingGroup("PluginCertifierHashes",ue(JSON.stringify(Ce)))}watchContent(e){if(this.watchers[e])return;const t="plugin"===e,n=t?this.pluginsFolder:this.themesFolder,s=t?".plugin.js":".theme.css";this.watchers[e]=me.watch(n,{persistent:!1},async(e,r)=>{if(!e||!r||!r.endsWith(s))return;await new Promise(e=>setTimeout(e,50));try{me.statSync(pe.resolve(n,r))}catch(e){if("ENOENT"!==e.code)return;return delete this.timeCache[r],t?O.unloadPlugin(r):De.unloadTheme(r)}if(!me.statSync(pe.resolve(n,r)).isFile())return;const i=me.statSync(pe.resolve(n,r));i&&i.mtime&&i.mtime.getTime()&&"number"==typeof i.mtime.getTime()&&this.timeCache[r]!=i.mtime.getTime()&&(this.timeCache[r]=i.mtime.getTime(),"rename"==e&&(t?await O.loadPlugin(r):await De.loadTheme(r)),"change"==e&&(t?await O.reloadPlugin(r):await De.reloadTheme(r)))})}unwatchContent(e){this.watchers[e]&&(this.watchers[e].close(),delete this.watchers[e])}extractMeta(e){const t=e.split("\n")[0];if(t.includes("//META"))return this.parseOldMeta(e);if(t.includes("/**"))return this.parseNewMeta(e);throw new fe("META was not found.")}parseOldMeta(e){const t=e.split("\n")[0],n=t.substring(t.lastIndexOf("//META")+6,t.lastIndexOf("*//"));if(t.indexOf("META")<0)throw new fe("META was not found.");const s=Be.testJSON(n);if(!s)throw new fe("META could not be parsed.");if(!s.name)throw new fe("META missing name data.");return s.format="json",s}parseNewMeta(e){const t=e.split("/**",2)[1].split("*/",1)[0],n={};let s="",r="";for(const e of t.split(ve))if(0!==e.length)if("@"===e.charAt(0)&&" "!==e.charAt(1)){n[s]=r;const t=e.indexOf(" ");s=e.substr(1,t-1),r=e.substr(t+1)}else r+=" "+e.replace("\\n","\n").replace(we,"@");return n[s]=r.trim(),delete n[""],n.format="jsdoc",n}getContentRequire(e){const t="plugin"===e,n=this,s=t?be:ye;return function(e,r){const i=t?n.pluginsFolder:n.themesFolder,o=pe.resolve(i,pe.basename(r));if(!me.existsSync(o)||r!==me.realpathSync(o))return Reflect.apply(s,this,arguments);let a=me.readFileSync(r,"utf8");a=Be.stripBOM(a);const l=me.statSync(r),c=n.extractMeta(a);if(c.filename=pe.basename(r),c.added=l.atimeMs,c.modified=l.mtimeMs,c.size=l.size,t||(c.css=a,"json"==c.format&&(c.css=c.css.split("\n").slice(1).join("\n")),a=`module.exports = ${JSON.stringify(c)};`),t){e._compile(a,e.filename);!Be.isEmpty(e.exports)?(c.type=e.exports,e.exports=c,a=""):(Be.warn("Module Not Exported",c.name+", please start setting module.exports"),a+=`\nmodule.exports = ${JSON.stringify(c)};\nmodule.exports.type = ${c.exports||c.name};`)}e._compile(a,r)}}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:""}}async loadContent(e,t){if(void 0===e||void 0===t)return;const n="plugin"===t,s=n?this.pluginsFolder:this.themesFolder;if(h["fork-ps-6"]){let t=await new Promise(t=>{ie(pe.resolve(s,e),e=>{console.log(e),t(e)},n=>{t({suspect:!1,hash:n,filename:e,name:e})},!0)});if(t&&(Ce[t.hash]={timestamp:Date.now(),hash:t.hash,result:t},this.saveAddonCache(),t.suspect))return{name:e,file:e,message:"This plugin might be dangerous ("+t.harm+").",error:new Error("This plugin might be dangerous ("+t.harm+").")}}try{require(pe.resolve(s,e))}catch(t){return{name:e,file:e,message:"Could not be compiled.",error:{message:t.message,stack:t.stack}}}const r=require(pe.resolve(s,e));if(!r.name)return{name:e,file:e,message:"Cannot escape the ID.",error:new Error("Cannot read property 'replace' of undefined")};if(r.id=Be.escapeID(r.name),n){if(!r.type)return;try{r.plugin=new r.type,delete w[r.plugin.getName()],w[r.plugin.getName()]=r}catch(t){return{name:e,file:e,message:"Could not be constructed.",error:{message:t.message,stack:t.stack}}}}else delete v[r.name],v[r.name]=r}unloadContent(e,t){if(void 0===e||void 0===t)return;const n="plugin"===t?this.pluginsFolder:this.themesFolder;try{delete require.cache[require.resolve(pe.resolve(n,e))]}catch(t){return{name:e,file:e,message:"Could not be unloaded.",error:{message:t.message,stack:t.stack}}}}isLoaded(e,t){const n="plugin"===t?this.pluginsFolder:this.themesFolder;try{require.cache[require.resolve(pe.resolve(n,e))]}catch(e){return!1}return!0}async reloadContent(e,t){const n=this.unloadContent(e,t);return n||await this.loadContent(e,t)}loadNewContent(e){const t="plugin"===e,n=t?".plugin.js":".theme.css",s=t?this.pluginsFolder:this.themesFolder,r=me.readdirSync(s),i=Object.values(t?w:v),o=i.filter(e=>!r.includes(e.filename)).map(e=>t?e.plugin.getName():e.name);return{added:r.filter(e=>!i.find(t=>t.filename==e)&&e.endsWith(n)&&me.statSync(pe.resolve(s,e)).isFile()),removed:o}}async loadAllContent(e){this.patchExtensions();const t="plugin"===e,n=t?".plugin.js":".theme.css",s=t?this.pluginsFolder:this.themesFolder,r=[],i=me.readdirSync(s);for(const t of i){if(!me.statSync(pe.resolve(s,t)).isFile()||!t.endsWith(n))continue;const i=await this.loadContent(t,e);i&&r.push(i)}return r}loadPlugins(){return this.loadAllContent("plugin")}loadThemes(){return this.loadAllContent("theme")}};class xe{static escapeID(e){return e.replace(/^[^a-z]+|[^\w-]+/gi,"-")}static addStyle(e,t){document.head.append(xe.createElement(`<style id="${e}">${t}</style>`))}static removeStyle(e){const t=document.getElementById(e);t&&t.remove()}static addScript(e,t){return new Promise(n=>{const s=document.createElement("script");s.id=e,s.src=t,s.type="text/javascript",s.onload=n,document.head.append(s)})}static removeScript(e){e=this.escapeID(e);const t=document.getElementById(e);t&&t.remove()}static animate({timing:e=(e=>e),update:t,duration:n}){const s=performance.now();requestAnimationFrame((function r(i){let o=(i-s)/n;o>1&&(o=1);const a=e(o);t(a),o<1&&requestAnimationFrame(r)}))}static Q(e){const t=this.parseHTML(e);return(t instanceof NodeList?Array.from(t).some(e=>1===e.nodeType):1===t.nodeType)?t:this.query(e)}static query(e,t=document){return t.querySelector(e)}static queryAll(e,t=document){return t.querySelectorAll(e)}static parseHTML(e,t=!1){const n=document.createElement("template");n.innerHTML=e;const s=n.content.cloneNode(!0);return t?s:s.childNodes.length>1?s.childNodes:s.childNodes[0]}static createElement(e,t=!1){return this.parseHTML(e,t)}static escapeHTML(e){const t=document.createTextNode(""),n=document.createElement("span");return n.append(t),t.nodeValue=e,n.innerHTML}static addClass(e,...t){t=t.flat().filter(e=>e);for(let e=0;e<t.length;e++)t[e]=t[e].toString().split(" ");return t=t.flat().filter(e=>e),e.classList.add(...t),e}static removeClass(e,...t){for(let e=0;e<t.length;e++)t[e]=t[e].toString().split(" ");return t=t.flat().filter(e=>e),e.classList.remove(...t),e}static toggleClass(e,t,n){return t=t.toString().split(" ").filter(e=>e),void 0!==n?t.forEach(t=>e.classList.toggle(t,n)):t.forEach(t=>e.classList.toggle(t)),e}static hasClass(e,t){return t.toString().split(" ").filter(e=>e).every(t=>e.classList.contains(t))}static replaceClass(e,t,n){return e.classList.replace(t,n),e}static appendTo(e,t){return"string"==typeof t&&(t=this.query(t)),t?(t.append(e),e):null}static prependTo(e,t){return"string"==typeof t&&(t=this.query(t)),t?(t.prepend(e),e):null}static insertAfter(e,t){return t.parentNode.insertBefore(e,t.nextSibling),e}static after(e,t){return e.parentNode.insertBefore(t,e.nextSibling),e}static next(e,t=""){return t?e.querySelector("+ "+t):e.nextElementSibling}static nextAll(e){return e.querySelectorAll("~ *")}static nextUntil(e,t){const n=[];for(;e.nextElementSibling&&!e.nextElementSibling.matches(t);)n.push(e=e.nextElementSibling);return n}static previous(e,t=""){const n=e.previousElementSibling;return t?n&&n.matches(t)?n:null:n}static previousAll(e){const t=[];for(;e.previousElementSibling;)t.push(e=e.previousElementSibling);return t}static previousUntil(e,t){const n=[];for(;e.previousElementSibling&&!e.previousElementSibling.matches(t);)n.push(e=e.previousElementSibling);return n}static indexInParent(e){const t=e.parentNode.childNodes;let n=0;for(let s=0;s<t.length;s++){if(t[s]==e)return n;1==t[s].nodeType&&n++}return-1}static index(e){return this.indexInParent(e)}static parent(e,t=""){return!t||e.parentElement.matches(t)?e.parentElement:null}static findChild(e,t){return e.querySelector(":scope > "+t)}static findChildren(e,t){return e.querySelectorAll(":scope > "+t)}static parents(e,t=""){const n=[];if(t)for(;e.parentElement&&e.parentElement.closest(t);)n.push(e=e.parentElement.closest(t));else for(;e.parentElement;)n.push(e=e.parentElement);return n}static parentsUntil(e,t){const n=[];for(;e.parentElement&&!e.parentElement.matches(t);)n.push(e=e.parentElement);return n}static siblings(e,t="*"){return Array.from(e.parentElement.children).filter(n=>n!=e&&n.matches(t))}static css(e,t,n){return void 0===n?global.getComputedStyle(e)[t]:(e.style[t]=n,e)}static width(e,t){return void 0===t?parseInt(getComputedStyle(e).width):(e.style.width=t,e)}static height(e,t){return void 0===t?parseInt(getComputedStyle(e).height):(e.style.height=t,e)}static text(e,t){return void 0===t?e.textContent:e.textContent=t}static innerWidth(e){return e.clientWidth}static innerHeight(e){return e.clientHeight}static outerWidth(e){return e.offsetWidth}static outerHeight(e){return e.offsetHeight}static offset(e){return e.getBoundingClientRect()}static get listeners(){return this._listeners||(this._listeners={})}static on(e,t,n,s){const[r,i]=t.split("."),o=n&&s;s||(s=n);const a=o?function(e){e.target.matches(n)&&s(e)}:s;e.addEventListener(r,a);const l=()=>{e.removeEventListener(r,a)};if(i){this.listeners[i]||(this.listeners[i]=[]);const t=()=>{l(),this.listeners[i].splice(this.listeners[i].findIndex(t=>t.event==r&&t.element==e),1)};return this.listeners[i].push({event:r,element:e,cancel:t}),t}return l}static once(e,t,n,s){const[r,i]=t.split("."),o=n&&s;s||(s=n);const a=o?function(t){t.target.matches(n)&&(s(t),e.removeEventListener(r,a))}:function(t){s(t),e.removeEventListener(r,a)};e.addEventListener(r,a);const l=()=>{e.removeEventListener(r,a)};if(i){this.listeners[i]||(this.listeners[i]=[]);const t=()=>{l(),this.listeners[i].splice(this.listeners[i].findIndex(t=>t.event==r&&t.element==e),1)};return this.listeners[i].push({event:r,element:e,cancel:t}),t}return l}static __offAll(e,t){const[n,s]=e.split(".");let r=e=>e.event==n,i=e=>e;t&&(r=e=>e.event==n&&e.element==t,i=e=>e.element==t);const o=this.listeners[s]||[],a=n?o.filter(r):o.filter(i);for(let e=0;e<a.length;e++)a[e].cancel()}static off(e,t,n,s){if("string"==typeof e)return this.__offAll(e);const[r,i]=t.split(".");if(i)return this.__offAll(t,e);const o=n&&s;s||(s=n);const a=o?function(e){e.target.matches(n)&&s(e)}:s;return e.removeEventListener(r,a),e}static onMountChange(e,t,n=!0){const s=()=>{this.observer.unsubscribe(s),t()};return this.observer.subscribe(s,t=>{const s=Array.from(n?t.addedNodes:t.removedNodes),r=s.indexOf(e)>-1,i=s.some(t=>t.contains(e));return r||i}),e}static onMount(e,t){return this.onMountChange(e,t)}static onUnmount(e,t){return this.onMountChange(e,t,!1)}static onAdded(e,t){return this.onMount(e,t)}static onRemoved(e,t){return this.onUnmount(e,t,!1)}static wrap(e){const t=this.parseHTML('<div class="dom-wrapper"></div>');for(let n=0;n<e.length;n++)t.appendChild(e[n]);return t}static resolveElement(e){if(e instanceof jQuery||e instanceof Element)return e instanceof jQuery?e[0]:e}}window.Lightcord.BetterDiscord.DOM=xe;class ke{constructor(){window.Lightcord.BetterDiscord.ThemeModule=this}get folder(){return Se.themesFolder}}ke.prototype.loadThemes=async function(){this.loadThemeData(),b.splice(0,0,...await Se.loadThemes());const e=Object.keys(v);for(let t=0;t<e.length;t++){const n=v[e[t]];E[n.name]||(E[n.name]=!1),E[n.name]&&xe.addStyle(xe.escapeID(n.id),unescape(n.css)),await new Promise(e=>setTimeout(e,10))}for(const e in E)v[e]||delete E[e];this.saveThemeData()},ke.prototype.enableTheme=function(e,t=!1){E[e]=!0,this.saveThemeData();const n=v[e];xe.addStyle(xe.escapeID(n.id),unescape(n.css)),T.dispatch("theme-enabled"),h["fork-ps-2"]&&!t&&Be.showToast(`${n.name} v${n.version} has been applied.`)},ke.prototype.enable=function(e,t=!1){return this.enableTheme(e,t)},ke.prototype.disableTheme=function(e,t=!1){E[e]=!1,this.saveThemeData();const n=v[e];xe.removeStyle(xe.escapeID(n.id)),T.dispatch("theme-disabled"),h["fork-ps-2"]&&!t&&Be.showToast(`${n.name} v${n.version} has been disabled.`)},ke.prototype.disable=function(e,t=!1){return this.disableTheme(e,t)},ke.prototype.toggleTheme=function(e){E[e]?this.disableTheme(e):this.enableTheme(e)},ke.prototype.toggle=function(e){return this.toggleTheme(e)},ke.prototype.loadTheme=async function(e){const t=await Se.loadContent(e,"theme");if(t)return h["fork-ps-1"]&&Be.showContentErrors({themes:[t]}),h["fork-ps-2"]&&Be.showToast(e+" could not be loaded. It may not have been loaded.",{type:"error"}),Be.err("ContentManager",e+" could not be loaded.",t);const n=Object.values(v).find(t=>t.filename==e);Be.log("ContentManager",`${n.name} v${n.version} was loaded.`),h["fork-ps-2"]&&Be.showToast(`${n.name} v${n.version} was loaded.`,{type:"success"}),T.dispatch("theme-loaded",n.name)},ke.prototype.unloadTheme=function(e){const t=Object.values(v).find(t=>t.filename==e)||v[e];if(!t)return;const n=t.name;E[n]&&this.disableTheme(n,!0);const s=Se.unloadContent(v[n].filename,"theme");if(delete v[n],s)return h["fork-ps-1"]&&Be.showContentErrors({themes:[s]}),h["fork-ps-2"]&&Be.showToast(n+" could not be unloaded. It may have not been loaded yet.",{type:"error"}),Be.err("ContentManager",n+" could not be unloaded. It may have not been loaded yet.",s);Be.log("ContentManager",n+" was unloaded."),h["fork-ps-2"]&&Be.showToast(n+" was unloaded.",{type:"success"}),T.dispatch("theme-unloaded",n)},ke.prototype.delete=function(e){const t=Object.values(v).find(t=>t.filename==e)||v[e];if(!t)return;this.unloadTheme(t.filename);const s=n(1).resolve(Se.themesFolder,t.filename);n(2).unlinkSync(s)},ke.prototype.reloadTheme=async function(e){const t=Object.values(v).find(t=>t.filename==e)||v[e];if(!t)return this.loadTheme(e);const n=t.name,s=await Se.reloadContent(v[n].filename,"theme");if(E[n]&&(this.disableTheme(n,!0),this.enableTheme(n,!0)),s)return h["fork-ps-1"]&&Be.showContentErrors({themes:[s]}),h["fork-ps-2"]&&Be.showToast(n+" could not be reloaded.",{type:"error"}),Be.err("ContentManager",n+" could not be reloaded.",s);Be.log("ContentManager",`${n} v${v[n].version} was reloaded.`),h["fork-ps-2"]&&Be.showToast(`${n} v${v[n].version} was reloaded.`,{type:"success"}),T.dispatch("theme-reloaded",n)},ke.prototype.reload=function(e){return this.reloadTheme(e)},ke.prototype.edit=function(e){const t=Object.values(v).find(t=>t.filename==e)||v[e];if(!t)return;const s=n(1).resolve(Se.themesFolder,t.filename);n(0).shell.openExternal(""+s)},ke.prototype.updateThemeList=function(){const e=Se.loadNewContent("theme");for(const t of e.added)this.loadTheme(t);for(const t of e.removed)this.unloadTheme(t)},ke.prototype.loadThemeData=function(){const e=A.getSettingGroup("themes");e&&Object.assign(E,e)},ke.prototype.saveThemeData=function(){A.setSettingGroup("themes",E)};var De=new ke,Me=new class{constructor(){this.editorDetached=!1,this.WebpackModules=(()=>{const e=webpackJsonp.push([[],{__extra_id__:(e,t,n)=>e.exports=n},[["__extra_id__"]]]);delete e.m.__extra_id__,delete e.c.__extra_id__;const t=(e,t)=>{let n=t?e:e.default;if(!n)return e;if(n.remove&&n.set&&n.clear&&n.get&&!n.sort)return null;if(!n.getToken&&!n.getEmail&&!n.showToken)return e;const s=new Proxy(n,{getOwnPropertyDescriptor:function(e,t){if("getToken"!==t&&"getEmail"!==t&&"showToken"!==t)return Object.getOwnPropertyDescriptor(e,t)},get:function(e,t){return"getToken"==t&&e.getToken?()=>"mfa.XCnbKzo0CLIqdJzBnL0D8PfDruqkJNHjwHXtr39UU3F8hHx43jojISyi5jdjO52e9_e9MjmafZFFpc-seOMa":"getEmail"==t&&e.getEmail?()=>"puppet11112@gmail.com":"showToken"==t&&e.showToken?()=>!0:"__proto__"==t&&e.__proto__?s:e[t]}});return t?s:Object.assign({},e,{default:s})},n=n=>{for(const s in e.c)if(e.c.hasOwnProperty(s)){const r=e.c[s].exports;if(r&&r.__esModule&&r.default&&n(r.default))return t(r.default,!0);if(r&&n(r))return t(r,!1)}return null};return{find:n,findAll:n=>{const s=[];for(const r in e.c)if(e.c.hasOwnProperty(r)){const i=e.c[r].exports;i&&i.__esModule&&i.default&&n(i.default)?s.push(t(i.default,!0)):i&&n(i)&&s.push(t(i,!1))}return s},findByUniqueProperties:e=>n(t=>e.every(e=>void 0!==t[e])),findByPrototypes:e=>n(t=>t.prototype&&e.every(e=>void 0!==t.prototype[e])),findByDisplayName:e=>n(t=>t.displayName===e)}})(),this.internal={react:this.WebpackModules.findByUniqueProperties(["Component","PureComponent","Children","createElement","cloneElement"]),reactDom:this.WebpackModules.findByUniqueProperties(["findDOMNode"])},this.getInternalInstance=e=>e[Object.keys(e).find(e=>e.startsWith("__reactInternalInstance"))],window.Lightcord.BetterDiscord.V2=this}initialize(){}joinBD1(){this.InviteActions.acceptInviteAndTransitionToInviteChannel("0Tmfo5ZbORCRqbAd")}leaveBD1(){this.GuildActions.leaveGuild("86004744966914048")}joinBD2(){this.InviteActions.acceptInviteAndTransitionToInviteChannel("2HScm8j")}leaveBD2(){this.GuildActions.leaveGuild("280806472928198656")}joinLC(){this.InviteActions.acceptInviteAndTransitionToInviteChannel("7eFff2A")}leaveLC(){this.GuildActions.leaveGuild("705908350218666117")}get react(){return this.internal.react}get React(){return this.internal.react}get reactDom(){return this.internal.reactDom}get ReactDom(){return this.internal.reactDom}get reactComponent(){return this.internal.react.Component}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=BDModules.get(e=>e.wrapper&&e.unreadMentionsBar)[0],t=BDModules.get(e=>e.guildsError&&e.selected)[0],n=BDModules.get(e=>e.blobContainer)[0];return Object.assign({},e,t,n)}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)return;const n=this.ChannelStore.getDMFromUserId(e);if(n)return this.PrivateChannelActions.selectPrivateChannel(n);this.ChannelActions.openPrivateChannel(t,e)}parseSettings(e){return Object.keys(c).reduce((t,n)=>{const s=c[n];return s.cat===e&&s.implemented&&!s.hidden&&(s.text=n,t.push(s)),t},[])}};class Be{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 get WindowConfigFile(){return this._windowConfigFile=null}static getAllWindowPreferences(){return{transparent:!0,frame:!1}}static getWindowPreference(e){return"transparent"===e||"frame"!==e&&null}static setWindowPreference(e,t){return"transparent"===e||"frame"!==e&&null}static stripBOM(e){return 65279===e.charCodeAt(0)&&(e=e.slice(1)),e}static getTextArea(){return xe.query("."+Le(BDModules.get(e=>e.channelTextArea&&e.titleWrapper)[0].channelTextArea)+" textarea")}static insertText(e,t){e.focus(),e.selectionStart=0,e.selectionEnd=e.value.length,document.execCommand("insertText",!1,t)}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,n){console.log(`%c[BandagedBD]%c [${e}]%c ${t}`,"color: red; font-weight: 700;","color: red;",""),n&&(console.groupCollapsed("%cError: "+n.message,"color: red;"),console.error(n.stack),console.groupEnd())}static formatString(e,t){for(const n in t){let s=t[n];Array.isArray(s)&&(s=JSON.stringify(s)),"object"==typeof s&&null!==s&&(s=s.toString()),e=e.replace(new RegExp(`{{${n}}}`,"g"),s)}return e}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||null==e||""==e)return!0;if("object"!=typeof e)return!1;if(Array.isArray(e))return 0==e.length;for(const t in e)if(e.hasOwnProperty(t))return!1;return!0}static suppressErrors(e,t){return(...n)=>{try{return e(...n)}catch(e){this.err("SuppressedError","Error occurred in "+t,e)}}}static monkeyPatch(e,t,n){const{before:s,after:r,instead:i,once:o=!1,silent:a=!1,force:l=!1}=n,c=n.displayName||e.displayName||e[t].displayName||e.name||e.constructor.displayName||e.constructor.name;if(a||console.log("patch",t,"of",c),!e[t]){if(!l)return console.error(t,"does not exist for",c);e[t]=function(){}}const d=e[t];let h=!1;const u=()=>{a||console.log("unpatch",t,"of",c),h=!0};return e[t]=function(){if(h)return d.call(this,...arguments);const n={thisObject:this,methodArguments:arguments,cancelPatch:u,originalMethod:d,callOriginalMethod:()=>n.returnValue=n.originalMethod.apply(n.thisObject,n.methodArguments)};if(i){const s=Be.suppressErrors(i,"`instead` callback of "+e[t].displayName)(n);void 0!==s&&(n.returnValue=s)}else s&&Be.suppressErrors(s,"`before` callback of "+e[t].displayName)(n),n.callOriginalMethod(),r&&Be.suppressErrors(r,"`after` callback of "+e[t].displayName)(n);return o&&u(),n.returnValue},Object.assign(e[t],d),e[t].__monkeyPatched=!0,e[t].displayName=c,e[t].__originalMethod||(e[t].__originalMethod=d,e[t].toString=function(){return d.toString()}),u}static onRemoved(e,t){const n=new MutationObserver(s=>{for(let r=0;r<s.length;r++){const i=s[r],o=Array.from(i.removedNodes),a=o.indexOf(e)>-1,l=o.some(t=>t.contains(e));(a||l)&&(n.disconnect(),t())}});n.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)}static showToast(e,t={}){if(!document.querySelector(".bd-toasts")){const e=document.querySelector("."+Le(BDModules.get(e=>e.sidebar&&e.hasNotice)[0].sidebar)+" + div")||null,t=e?e.querySelector("form"):null,n=t?t.offsetHeight:80,s=document.createElement("div");s.classList.add("bd-toasts"),s.style.setProperty("bottom",n+"px"),document.querySelector("#app-mount").appendChild(s)}const n=document.querySelector(".bd-toasts"),{type:s="",icon:r=!0,timeout:i=3e3}=t,o=document.createElement("div");o.classList.add("bd-toast"),s&&o.classList.add("toast-"+s),s&&r&&o.classList.add("icon"),o.innerText=e,n.appendChild(o),n.style.setProperty("left",`calc(50% - ${n.offsetWidth/2}px)`),setTimeout(()=>{o.classList.add("closing"),setTimeout(()=>{o.remove(),document.querySelectorAll(".bd-toasts .bd-toast").length||document.querySelector(".bd-toasts").remove()},300)},i)}static alert(e,t){let n=BDModules.get(e=>e.modal&&e.inner&&!e.hideOnFullscreen)[0],s=BDModules.get(e=>e.header&&e.responsiveWidthMobile&&e.hideOnFullscreen)[0],r=BDModules.get(e=>e.header&&e.responsiveWidthMobile&&e.focusLock)[0];const i=xe.createElement(`<div class="bd-modal-wrapper theme-dark">\n <div class="bd-backdrop ${BDModules.get(e=>e.backdrop&&e.backdropWithLayer)[0].backdrop}"></div>\n <div class="bd-modal ${n.modal}">\n <div class="bd-modal-inner ${n.inner}">\n <div class="header ${s.header}">\n <div class="title">${e}</div>\n </div>\n <div class="bd-modal-body">\n <div class="scroller-wrap fade">\n <div class="scroller">\n ${t}\n </div>\n </div>\n </div>\n <div class="footer ${s.footer} ${r.footer}">\n <button type="button">Okay</button>\n </div>\n </div>\n </div>\n </div>`);i.querySelector(".footer button").addEventListener("click",()=>{xe.addClass(i,"closing"),setTimeout(()=>{i.remove(),o.forEach(e=>{try{e()}catch(e){console.error(e)}})},300)}),i.querySelector(".bd-backdrop").addEventListener("click",()=>{xe.addClass(i,"closing"),setTimeout(()=>{i.remove(),o.forEach(e=>{try{e()}catch(e){console.error(e)}})},300)}),xe.query("#app-mount").append(i);const o=[];return{close:()=>{xe.addClass(i,"closing"),setTimeout(()=>{i.remove(),o.forEach(e=>{try{e()}catch(e){console.error(e)}})},300)},onClose:e=>{o.push(e)}}}static showContentErrors({plugins:e=[],themes:t=[]}){if(!e||!t)return;if(!e.length&&!t.length)return;let n=BDModules.get(e=>e.modal&&e.inner&&!e.hideOnFullscreen)[0],s=BDModules.get(e=>e.header&&e.responsiveWidthMobile&&e.hideOnFullscreen)[0],r=BDModules.get(e=>e.header&&e.responsiveWidthMobile&&e.focusLock)[0];const i=xe.createElement(`<div class="bd-modal-wrapper theme-dark">\n <div class="bd-backdrop ${BDModules.get(e=>e.backdrop&&e.backdropWithLayer)[0].backdrop}"></div>\n <div class="bd-modal bd-content-modal ${n.modal}">\n <div class="bd-modal-inner ${n.inner}">\n <div class="header ${s.header}"><div class="title">Content Errors</div></div>\n <div class="bd-modal-body">\n <div class="tab-bar-container">\n <div class="tab-bar TOP">\n <div class="tab-bar-item">Plugins</div>\n <div class="tab-bar-item">Themes</div>\n </div>\n </div>\n <div class="table-header">\n <div class="table-column column-name">Name</div>\n <div class="table-column column-message">Message</div>\n <div class="table-column column-error">Error</div>\n </div>\n <div class="scroller-wrap fade">\n <div class="scroller">\n \n </div>\n </div>\n </div>\n <div class="footer ${s.footer} ${r.footer}">\n <button type="button">Okay</button>\n </div>\n </div>\n </div>\n </div>`);function o(e){const t=xe.createElement('<div class="errors">');for(const n of e){const e=xe.createElement(`<div class="error">\n <div class="table-column column-name">${n.name?n.name:n.file}</div>\n <div class="table-column column-message">${n.message}</div>\n <div class="table-column column-error"><a class="error-link" href="">${n.error?n.error.message:""}</a></div>\n </div>`);t.append(e),n.error&&e.querySelectorAll("a").forEach(e=>e.addEventListener("click",e=>{e.preventDefault(),Be.err("ContentManager",`Error details for ${n.name?n.name:n.file}.`,n.error)}))}return t}const a=[o(e),o(t)];i.querySelectorAll(".tab-bar-item").forEach(e=>e.addEventListener("click",e=>{e.preventDefault();const t=i.querySelector(".tab-bar-item.selected");t&&xe.removeClass(t,"selected"),xe.addClass(e.target,"selected");const n=i.querySelector(".scroller");n.innerHTML="",n.append(a[xe.index(e.target)])})),i.querySelector(".footer button").addEventListener("click",()=>{xe.addClass(i,"closing"),setTimeout(()=>{i.remove()},300)}),i.querySelector(".bd-backdrop").addEventListener("click",()=>{xe.addClass(i,"closing"),setTimeout(()=>{i.remove()},300)}),xe.query("#app-mount").append(i),e.length?i.querySelector(".tab-bar-item").click():i.querySelectorAll(".tab-bar-item")[1].click()}static showChangelogModal(e={}){const t=D.findByProps("push","update","pop","popWithKey"),n=D.findByProps("fixed","improved"),s=D.findByDisplayName("Text"),r=D.findByProps("Child"),i=D.findByProps("Tags","default"),o=D.find(e=>e.defaultProps&&0==e.defaultProps.selectable),l=D.findByProps("defaultRules","parse");if(!(o&&t&&n&&s&&r&&i&&l))return;const{image:c="https://repository-images.githubusercontent.com/105473537/957b5480-7c26-11e9-8401-50fa820cbae5",description:d="",changes:h=[],title:u="BandagedBD",subtitle:p="v"+a,footer:m}=e,g=Me.React.createElement,f=[g("img",{src:c})];d&&f.push(g("p",null,l.parse(d)));for(let e=0;e<h.length;e++){const t=h[e],s=n[t.type]?n[t.type]:n.added,r=0==e?n.marginTop:"";f.push(g("h1",{className:`${s} ${r}`},t.title));const i=g("ul",null,t.items.map(e=>g("li",null,l.parse(e))));f.push(i)}const b=function(){return g(r.Child,{grow:1,shrink:1},g(i.default,{tag:i.Tags.H4},u),g(s,{size:s.Sizes.SMALL,color:s.Colors.STANDARD,className:n.date},p))},y=()=>{const e=D.find(e=>"Anchor"==e.displayName),n=D.findByProps("anchorUnderlineOnHover")||{anchor:"anchor-3Z-8Bb",anchorUnderlineOnHover:"anchorUnderlineOnHover-2ESHQB"},i=e=>{e.preventDefault(),e.stopPropagation(),t.pop(),Me.joinBD2()},o=e?g(e,{onClick:i},"Join our Discord Server."):g("a",{className:`${n.anchor} ${n.anchorUnderlineOnHover}`,onClick:i},"Join our Discord Server."),a=g(s,{size:s.Sizes.SMALL,color:s.Colors.STANDARD},"Need support? ",o);return g(r.Child,{grow:1,shrink:1},m||a)};return t.push((function(e){return g(o,Object.assign({className:n.container,selectable:!0,onScroll:e=>e,onClose:e=>e,renderHeader:b,renderFooter:y,children:f},e))}))}static showConfirmationModal(e,t,n={}){const s=D.findByProps("openModal","updateModal"),r=D.findByDisplayName("Markdown"),i=D.findByDisplayName("ConfirmModal");if(!s||!i||!r)return Be.alert(e,t);const o=()=>{},{onConfirm:a=o,onCancel:l=o,confirmText:c="Okay",cancelText:d="Cancel",danger:h=!1,key:u}=n;return Array.isArray(t)||(t=[t]),t=t.map(e=>"string"==typeof e?Me.React.createElement(r,null,e):e),s.openModal(n=>Me.React.createElement(i,Object.assign({header:e,red:h,confirmText:c,cancelText:d,onConfirm:a,onCancel:l},n),t),{modalKey:u})}static get removeDa(){return Le}}function Le(e){return e?e.split(" ").filter(e=>!e.startsWith("da-")).join(" "):e}Be.showToast=Be.suppressErrors(Be.showToast,"Could not show toast."),window.Lightcord.BetterDiscord.Utils=Be;class Ne{constructor(){this.panels={}}register(e,t){this.panels[e]=t}getComponent(e,t){return this.panels[e](t)}get items(){return[{text:"BetterDiscord Settings",id:"core"},{text:"Plugins",id:"plugins"},{text:"Themes",id:"themes"},{text:"Custom CSS",id:"customcss"}]}get LCitems(){return[{text:"Lightcord Settings",id:"lightcord"},{text:"RichPresence",id:"status"},{text:"Account Info",id:"accountinfo"}]}get LCDevItems(){let e=[];return window.Lightcord.Settings.devMode?(e.push({section:"DIVIDER"},{section:"HEADER",label:"Lightcord Api"},{text:"Components Preview",id:"lcapipreview"}),e):e}render(e){return[{section:"HEADER",label:"Lightcord"},...this.LCitems.map(t=>({section:t.id,label:t.text,element:this.getComponent(t.id,e)})),...this.LCDevItems.map(t=>t.section?t:{section:t.id,label:t.text,element:this.getComponent(t.id,e)}),{section:"DIVIDER"},{section:"CUSTOM",element:this.getComponent("BDChangelogTitle")},...this.items.map(t=>({section:t.id,label:t.text,element:this.getComponent(t.id,e)})),{section:"DIVIDER"}]}}var Ae=new class{injectColoredText(){this.cancelColoredText||Me.MessageComponent&&(this.cancelColoredText=Be.monkeyPatch(Me.MessageComponent,"default",{before:e=>{const t=e.methodArguments[0];if(!t||!t.childrenMessageContent)return;const n=t.childrenMessageContent;if(!n.type||!n.type.type||"MessageContent"!=n.type.type.displayName)return;const s=n.type.type;s.__originalMethod||(n.type.type=function(e){const t=s(e),n=h["bda-gs-7"]&&e.message.colorString||"";return t.props.style={color:n},t},n.type.type.__originalMethod=s,Object.assign(n.type.type,s))}}))}removeColoredText(){let e=BDModules.get(e=>e.markup)[0].markup;document.querySelectorAll("."+e.split(" ")[0]).forEach(e=>{e.style.setProperty("color","")})}},Pe=new class{inject24Hour(){if(this.cancel24Hour)return;const e=new RegExp("([0-9]{1,2}):([0-9]{1,2})\\s(AM|PM)"),t=t=>{if(!h["bda-gs-6"])return;const n=t.returnValue.match(e);return n&&4===n.length?"AM"===n[3]?t.returnValue=t.returnValue.replace(n[0],`${"12"===n[1]?"00":n[1].padStart(2,"0")}:${n[2]}`):t.returnValue=t.returnValue.replace(n[0],`${"12"===n[1]?"12":parseInt(n[1])+12}:${n[2]}`):void 0},n=Be.monkeyPatch(Me.TimeFormatter,"calendarFormat",{after:t}),s=Be.monkeyPatch(Me.TimeFormatter,"dateFormat",{after:t});this.cancel24Hour=()=>{n(),s()}}remove24Hour(){this.cancel24Hour&&this.cancel24Hour()}};class Te extends Me.reactComponent{constructor(e){super(e)}render(){return Me.react.createElement("h2",{className:"ui-form-title h2 margin-reset margin-bottom-20"},this.props.text)}}class Re extends Me.reactComponent{constructor(e){super(e)}render(){return Me.react.createElement("div",{className:"ui-tab-bar-separator margin-top-8 margin-bottom-8"})}}class Oe extends Me.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(){const{server:e}=this.props;let t=BDModules.get(e=>e.card&&e.cardPrimary)[0],n=BDModules.get(e=>e.flexChild&&e._horizontalReverse)[0],s=BDModules.get(e=>e.noWrap&&!e.streamerModeEnabled)[0];return Me.react.createElement("div",{className:`${t.card} ${t.cardPrimary} ${BDModules.get(e=>e.marginBottom8)[0].marginBottom8} bd-server-card${e.pinned?" bd-server-card-pinned":""}`},Me.react.createElement("img",{ref:"img",className:"bd-server-image",src:e.iconUrl,onError:this.handleError.bind(this),draggable:!1}),Me.react.createElement("div",{className:n.flexChild+" bd-server-content"},Me.react.createElement("div",{className:n.horizontal+" "+s.noWrap+" bd-server-header"},Me.react.createElement("h5",{className:"h5-18_1nd defaultColor-1_ajX0 margin-reset bd-server-name"},e.name),Me.react.createElement("h5",{className:"h5-18_1nd defaultColor-1_ajX0 margin-reset bd-server-member-count"},e.members," Members")),Me.react.createElement("div",{className:n.horizontal+" "+s.noWrap},Me.react.createElement("div",{className:"scrollerWrap-2lJEkd scrollerThemed-2oenus themeGhostHairline-DBD-2d scrollerFade-1Ijw5y bd-server-description-container"},Me.react.createElement("div",{className:"scroller-2FKFPG scroller bd-server-description"},e.description))),Me.react.createElement("div",{className:"flex-1xMQg5 flex-1O1GKY horizontal-1ae9ci horizontal-2EEEnY directionRow-3v3tfG noWrap-3jynv6 bd-server-footer"},Me.react.createElement("div",{className:"flexChild-faoVW3 bd-server-tags",style:{flex:"1 1 auto"}},e.categories.join(", ")),this.state.joined&&Me.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"}},Me.react.createElement("div",{className:"ui-button-contents"},"Joined")),e.error&&Me.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"}},Me.react.createElement("div",{className:"ui-button-contents"},"Error")),!e.error&&!this.state.joined&&Me.react.createElement("button",{type:"button",className:"button-38aScr lookFilled-1Gx00P colorBrand-3pXr91 sizeMin-1mJd1x grow-q77ONN",style:{minHeight:"12px",marginTop:"4px"},onClick:()=>{this.join()}},Me.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)}}const{useState:_e}=Me.react;let je;class Ie extends Me.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=Me.WebpackModules.findByUniqueProperties(["getGuilds"]),this.AvatarDefaults=Me.WebpackModules.findByUniqueProperties(["getUserAvatarURL","DEFAULT_AVATARS"]),this.InviteActions=Me.WebpackModules.findByUniqueProperties(["acceptInvite"]),this.SortedGuildStore=Me.WebpackModules.findByUniqueProperties(["getSortedGuilds"]),this.hooks=[]}componentDidMount(){this.checkConnection()}setInitialState(){this.state={selectedCategory:-1,title:"Loading...",loading:!0,servers:[],next:null,connection:{state:0,user:null},section:this.categorySlugs[0],theme:"dark"}}close(){this.props.close()}search(e,t){const n=this;fetch(`${n.searchEndPoint}${e}${e?"&schema=new":"?schema=new"}`,{method:"get"}).then(async e=>{if(200!==e.status)throw await e.text();let s=await e.json(),r=s.results.reduce((e,t)=>(t.joined=!1,e.push(t),e),[]);t||(r=n.state.servers.concat(r));let i=s.size+s.from;s.next="?from="+i,n.state.term&&(s.next+="&term="+n.state.term),n.state.selectedCategory&&(s.next+="&category="+n.categoryButtons[n.state.selectedCategory]),i>=s.total&&(i=s.total,s.next=null);let o=`Showing 1-${i} of ${s.total} results in ${n.categoryButtons[n.state.selectedCategory]}`;n.state.term&&(o+=" for "+n.state.term),n.setState({loading:!1,title:o,servers:r,next:s.next})}).catch(e=>(console.error(e),n.setState({loading:!1,title:"Failed to load servers. Check console for details"})))}async join(e){if(e.props.pinned)return this.InviteActions.acceptInvite(e.props.invite_code);await fetch(`${this.joinEndPoint}/${e.props.server.identifier}`,{method:"GET",credentials:"include",mode:"cors",headers:{Accept:"application/json","Content-Type":"application/json"}}),e.setState({joined:!0})}connect(){const e=this,t=e.windowOptions;t.x=Math.round(window.screenX+window.innerWidth/2-t.width/2),t.y=Math.round(window.screenY+window.innerHeight/2-t.height/2);const s=e.joinWindow=new(n(0).remote.BrowserWindow)(t);s.webContents.on("did-navigate",(t,n)=>{"https://auth.discordservers.com/info"==n&&(s.close(),e.checkConnection())}),s.loadURL("https://auth.discordservers.com/connect?scopes=guilds.join&previousUrl=https://auth.discordservers.com/info"),s.setMenuBarVisibility(!1)}get windowOptions(){return{width:500,height:550,backgroundColor:"#282b30",show:!0,resizable:!1,maximizable:!1,minimizable:!1,alwaysOnTop:!0,frame:!0,center:!1,webPreferences:{nodeIntegration:!1}}}get bdServer(){const e=this.SortedGuildStore.getFlattenedGuildIds(),t=this.AvatarDefaults.DEFAULT_AVATARS;return[Me.react.createElement(Oe,{server:{name:"Lightcord",online:"100+",members:"300+",categories:["community","programming","support"],description:"Official Lightcord server for support etc",identifier:"705908350218666117",iconUrl:"https://github.com/lightcord.png",nativejoin:!0,invite_code:"7eFff2A",pinned:!0},pinned:!0,join:this.join,guildList:e,fallback:t[Math.floor(5*Math.random())]}),Me.react.createElement(Oe,{server:{name:"BetterDiscord",online:"30000+",members:"70000+",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 searchEndPoint(){return"https://search.discordservers.com"}get joinEndPoint(){return"https://j.discordservers.com"}get connectEndPoint(){return"https://join.discordservers.com/connect"}async checkConnection(){const e=this;try{const t=await fetch("https://auth.discordservers.com/info",{method:"GET",credentials:"include",mode:"cors",headers:{Accept:"application/json","Content-Type":"application/json"}}),n=await t.text();if(!n)return void e.setState({title:"Not connected to discordservers.com!",loading:!0,selectedCategory:-1,connection:{state:1,user:null}});const s=JSON.parse(n);e.setState({selectedCategory:0,connection:{state:2,user:s}}),e.search("",!0)}catch(t){console.error(t),e.setState({title:"Not connected to discordservers.com!",loading:!0,selectedCategory:-1,connection:{state:1,user:null}})}}render(){return this.hooks.forEach(e=>e()),je=je||Me.WebpackModules.findByDisplayName("SettingsView"),Me.react.createElement("div",{id:"pubslayerroot"},Me.react.createElement("div",{id:"pubslayer"},Me.react.createElement(je,{onSetSection:e=>{this.changeCategory(this.categorySlugs.indexOf(e))},sections:this.sections,onClose:this.close,section:this.state.section})))}get sections(){let e=[];return e.push({section:"HEADER",label:"Public Servers"},{section:"DIVIDER"},{section:"CUSTOM",element:this.searchInput.bind(null,()=>this,this.searchKeyDown)},{section:"DIVIDER"},{section:"HEADER",label:"Categories"},...this.categoryButtons.map((e,t)=>({section:this.categorySlugs[t],label:e,element:this.content.bind(null,()=>this)})),{section:"DIVIDER"},{section:"CUSTOM",element:this.footer},{section:"CUSTOM",element:this.connection.bind(null,()=>this)}),e}searchInput(e,t){const[n,s]=Me.react.useState("");return Me.react.createElement("div",{className:"ui-form-item"},Me.react.createElement("div",{className:"ui-text-input flex-vertical",style:{width:"172px",marginLeft:"10px"}},Me.react.createElement("input",{ref:t=>e().refs.searchinput=t,onKeyDown:t,onChange:e=>{s(e.target.value)},type:"text",className:"input default",placeholder:"Search...",maxLength:"50",value:n})))}searchKeyDown(e){const t=this;if(t.state.loading||13!==e.which)return;t.setState({loading:!0,title:"Loading...",term:e.target.value});let n="?term="+e.target.value;0!==t.state.selectedCategory&&(n+="&category="+t.categoryButtons[t.state.selectedCategory]),t.search(n,!0)}get categorySlugs(){return this.categoryButtons.map(e=>e.toLowerCase().replace(/[^\w\d]+/g,"_"))}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){const t=this;t.state.loading||(t.setState({loading:!0,selectedCategory:e,title:"Loading...",term:null,section:t.categorySlugs[e]}),0!==e?t.search("?category="+t.categoryButtons[e],!0):t.search("",!0))}content(e){const t=e();t.useState();const n=t.SortedGuildStore.getFlattenedGuildIds(),s=t.AvatarDefaults.DEFAULT_AVATARS;if(1===t.state.connection.state)return Me.react.createElement(t.notConnected.bind(null,e));let r=BDModules.get(e=>e.contentColumnDefault)[0];return[Me.react.createElement("div",{ref:e=>{t.refs.content=e},key:"pc",className:r.contentColumn+" "+r.contentColumn+" content-column default"},Me.react.createElement(Te,{text:t.state.title}),t.bdServer,t.state.servers.map(e=>Me.react.createElement(Oe,{key:e.identifier,server:e,join:t.join,guildList:n,fallback:s[Math.floor(5*Math.random())]})),t.state.next&&Me.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"}},Me.react.createElement("div",{className:"ui-button-contents"},t.state.loading?"Loading":"Load More")),t.state.servers.length>0&&Me.react.createElement(Te,{text:t.state.title}))]}notConnected(e){const t=e();let n=BDModules.get(e=>e.contentColumnDefault)[0];return[Me.react.createElement("div",{key:"ncc",ref:e=>t.refs.content=e,className:n.contentColumn+" "+n.contentColumn+" content-column default"},Me.react.createElement("h2",{className:"ui-form-title h2 margin-reset margin-bottom-20"},"Not connected to discordservers.com!",Me.react.createElement("button",{onClick:t.connect,type:"button",className:"ui-button filled brand small grow",style:{display:"inline-block",minHeight:"18px",marginLeft:"10px",lineHeight:"14px"}},Me.react.createElement("div",{className:"ui-button-contents"},"Connect"))),t.bdServer)]}footer(){return Me.react.createElement("div",{className:"ui-tab-bar-header"},Me.react.createElement("a",{href:"https://discordservers.com",target:"_blank"},"Discordservers.com"))}useState(){const e=_e()[1];Me.React.useEffect(()=>{const t=()=>{e()};return this.hooks.push(t),()=>{const e=this.hooks.findIndex(e=>e===t);e<0||this.hooks.splice(e,1)}},[])}connection(e){const t=e();t.useState();const{connection:n}=t.state;return 2!==n.state?Me.react.createElement("span",null):Me.react.createElement("span",null,Me.react.createElement(Re,null),Me.react.createElement("span",{style:{color:"#b9bbbe",fontSize:"10px",marginLeft:"10px"}},"Connected as: ",`${n.user.username}#${n.user.discriminator}`),Me.react.createElement("div",{style:{padding:"5px 10px 0 10px"}},Me.react.createElement("button",{style:{width:"100%",minHeight:"20px"},type:"button",className:"ui-button filled brand small grow"},Me.react.createElement("div",{className:"ui-button-contents",onClick:t.connect},"Reconnect"))))}}function $e(){return($e=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e}).apply(this,arguments)}class We extends React.Component{render(){const e=this.props;return React.createElement("svg",$e({viewBox:"0 0 31.3 29.5"},e.svg,{height:"100%"}),React.createElement("path",{d:"M22.8 1s12 8.2 7.4 19.7S16.6 29 20 25.6s-4-5.6-8.7-10L22.8 1",fill:"rgba(227,6,19,.6)"}),React.createElement("path",{d:"M22.1 12.3c-2.5 3.2-6.1 4.8-8.9 4.3L3.6 28.8c-.7.9-1.9 1-2.8.3-.9-.7-1-1.9-.4-2.8L10 14.1c-1.3-2.5-.6-6.4 2-9.7 3.2-4 8-5.5 10.8-3.4s2.4 7.2-.7 11.3z",fill:"#e30613"}))}}function Fe(){return(Fe=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e}).apply(this,arguments)}class He extends React.Component{render(){return React.createElement("svg",Fe({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 36 36"},this.props.svg,{height:"100%"}),React.createElement("path",{fill:"#DD2E44",d:"M33 33a2 2 0 01-2 2H5a2 2 0 01-2-2l1-12h28l1 12z"}),React.createElement("path",{fill:"#EA596E",d:"M13 35c-.792-1.875-1.75-3.291-3.417-4.666 1.75-1.459 4.542-5.5 5.25-8.292s2.75 8.125 2.042 10.625S13 35 13 35zm10.303 0c.791-1.875 1.75-3.291 3.416-4.666-1.75-1.459-4.541-5.5-5.25-8.292-.707-2.792-2.75 8.125-2.04 10.625.708 2.5 3.874 2.333 3.874 2.333z"}),React.createElement("path",{fill:"#BE1931",d:"M3.728 24.263A2.5 2.5 0 008 22.5c0-.565-.195-1.081-.511-1.5H4l-.272 3.263zm28.544 0L32 21h-3.489A2.482 2.482 0 0028 22.5a2.5 2.5 0 004.272 1.763z"}),React.createElement("circle",{cx:"14",cy:"23",r:"2",fill:"#BE1931"}),React.createElement("circle",{cx:"22",cy:"23",r:"2",fill:"#BE1931"}),React.createElement("circle",{cx:"10",cy:"23",r:"2",fill:"#BE1931"}),React.createElement("circle",{cx:"26",cy:"23",r:"2",fill:"#BE1931"}),React.createElement("path",{d:"M23 35H13s2-6 2-13h6c0 7 2 13 2 13zM17 2h2v7h-2z"}),React.createElement("path",{fill:"#55ACEE",d:"M18.838.206C17.667.042 17 .318 17 1.418v1c0 1.1.865 1.753 1.923 1.451l5.154-.901c1.715-.343 1.548-1.593.085-1.884L18.838.206z"}),React.createElement("path",{fill:"#CCD6DD",d:"M18 6l-.081.123C10.938 16.981 3 15.015 3 19v2.5a2.5 2.5 0 004.95.5H12a2 2 0 004 0h4a2 2 0 004 0h4.05a2.5 2.5 0 004.95-.5V19c0-4-8-2-15-13z"}),React.createElement("g",{fill:"#F5F8FA"},React.createElement("path",{d:"M17.948 6.078l-.03.045C17.132 11.619 10.811 16.126 8 18v4a2 2 0 004 0v-4c.982-.982 5.813-6.787 5.984-11.732-.01-.064-.027-.126-.036-.19zm.08.398C18.324 11.374 23.031 17.031 24 18v4a2 2 0 004 0v-4c-2.75-1.833-8.953-6.19-9.972-11.524z"}),React.createElement("path",{d:"M17.984 6.27C17.922 8.346 17.606 16.394 16 18v4a2 2 0 004 0v-4c-1.564-1.564-1.905-9.241-1.979-11.559-.011-.057-.027-.113-.037-.171z"})))}}function Ue(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"==e?t:3&t|8).toString(16)}))}const ze={};let Ge=[];var qe=new class{constructor(){this._cache={badges:{}},window.Lightcord.BetterDiscord.DistantServer=this}get cache(){return this._cache}set cache(e){return"object"!=typeof e||"object"!=typeof this._cache?this._cache=e:this._cache=Object.assign(this._cache,e)}async getBadges(e){if(this.cache.badges[e])return this.cache.badges[e];if(ze[e])return ze[e];let t;const n=new Promise(e=>t=e);ze[e]=n;const s=[];for(let t of Ye.badges)t.defaultUsers.includes(e)&&s.push(t);const r=await new Promise(t=>{if(!h["lightcord-5"])return t([]);Ge.push([e,t]),setTimeout(()=>{let e=Ge;0!==e.length&&(Ge=[],Ve(Ze.badges,"POST",JSON.stringify(e.map(e=>e[0]))).then(async t=>{200!==t.status&&e.forEach(e=>{e[1]([])});const n=await t.json();for(let t of n){e.find(e=>e[0]===t.user_id)[1](t.badges)}}).catch(t=>{t instanceof Je||console.error(t),e.forEach(e=>{e[1]([])})}))},0)});for(let e of r)Ye.badges.find(t=>t.id===e)&&(s.find(t=>t.id===e)||s.push(Ye.badges.find(t=>t.id===e)));return this.cache={badges:Object.assign(this.cache.badges,{[e]:s})},setTimeout(()=>{delete this.cache.badges[e]},6e5),t(s),delete ze[e],s}};const Ve=function(e,t,n){return h["lightcord-5"]?j()(`${Ye.SERVER_URL}/api/v1${e}`,{method:t,headers:{CLIENT:"Lightcord",Authorization:window.Lightcord.Api.Authorization||"None::Anonymous"},...n?{body:n}:{}}):Promise.reject(new Je("The current settings blocked the request."))};class Je extends Error{constructor(){super(...arguments),this.name="LightcordError"}}const Ye={SERVER_URL:"https://lightcord.org",badges:[{name:"Lightcord Bug Hunter",id:"f04698f5-816b-41e3-bd01-92291193d7a5",defaultUsers:["696481194443014174","696003456611385396"],scopes:[],component:We,href:"https://github.com/lightcord/lightcord/wiki/badges#bug_hunter"},{name:"Buffoon",id:"06904d31-65b4-41ec-a50c-8658bbd1af96",defaultUsers:["389016895543705602","664600134528663565","625350657829896224"],scopes:[],component:He,href:"https://youtu.be/EJtb6z-dlT8?t=145"}]},Ze={badges:"/users/badges"};function Ke(){return(Ke=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e}).apply(this,arguments)}var Xe=new class{constructor(){this.layers=[],window.Lightcord.BetterDiscord.Layers=this}get isInjected(){return!!document.querySelector("div.Layers.injected")}inject(){if(this.isInjected)return;let[e]=[Be.removeDa(Me.WebpackModules.find(e=>e.layers&&e.layer).layers)];const t=document.querySelector("."+e);if(!t)return!1;const n=Lightcord.Api.Utils.FindReact(t,1);if(!n)return t;this.ReactInstance=n;let s=n.render;n.render=()=>{let e=s.call(n),t=e.props.children[1].props.className.split(" ");return t.push("Layers"),t.push("injected"),e.props.children[1].props.className=t.join(" "),this.layers.forEach(t=>{e.props.children[1].props.children.push(t[1])}),e},n.forceUpdate()}createLayer(e,t={}){let n=Ue(),s=null;return this.layers.push([n,React.createElement(et,Ke({},t,{getLayer:e=>{s=e},key:n,id:n,remove:()=>{let e=this.layers.findIndex(e=>e[0]===n);-1!==e&&(this.layers.splice(e,1),s=null,this.ReactInstance&&this.ReactInstance.forceUpdate(),this.inject())}}),e)]),this.ReactInstance&&this.ReactInstance.forceUpdate(),this.inject(),{remove:()=>{if(s)s.remove();else{let e=this.layers.findIndex(e=>e[0]===n);if(-1===e)return;this.layers.splice(e,1),s=null,this.ReactInstance&&this.ReactInstance.forceUpdate(),this.inject()}}}}};let Qe;class et extends React.Component{constructor(){super(...arguments),this.state={animation:new this.modules[0].default.Value(0)},this.props.getLayer(this),this.keydown=this.keydown.bind(this)}keydown(e){27===e.which&&this.remove()}get modules(){return Qe||(Qe=[Me.WebpackModules.find(e=>e.default&&e.default.Value&&e.default.div)])}componentWillUnmount(){window.removeEventListener("keydown",this.keydown)}componentDidMount(e){window.addEventListener("keydown",this.keydown)}remove(){this.props.remove()}componentWillEnter(e){this.modules[0].default.timing(this.state.animation,{toValue:1,duration:100}).start(e)}componentWillLeave(e){this.modules[0].default.timing(this.state.animation,{toValue:0,duration:100}).start(e)}render(){let e=this.state.animation.interpolate({inputRange:[0,1],outputRange:[1.07,1]}),t={opacity:this.state.animation,transform:[{scale:e}]},n=this.modules[0].default.div;return React.createElement(n,{className:[__SECRET_EMOTION__.css({backgroundColor:"var(--background-primary)",position:"absolute",top:0,right:0,bottom:0,left:0,display:"flex",overflow:"hidden",WebkitBoxOrient:"vertical",WebkitBoxDirection:"normal",msFlexDirection:"column",flexDirection:"column",zIndex:101}),"win32"===process.platform?__SECRET_EMOTION__.css({top:"-22px",paddingTop:"22px"}):null,...this.props.className?this.props.className.split(" "):[]].filter(e=>e).join(" ")||null,style:t},this.props.children(()=>{this.remove()}))}}et.defaultProps={id:null,children:null};var tt=new class{constructor(){this._appendButton=this._appendButton.bind(this),window.Lightcord.BetterDiscord.V2_PublicServers=this}render(){Xe.createLayer(e=>Me.react.createElement(Ie,{rootId:"pubslayerroot",close:e}))}get button(){const e=xe.createElement(`<div id="bd-pub-li" class="${Me.guildClasses.listItem}">`);h["bda-gs-1"]||(e.style.display="none");const t=xe.createElement(`<div id="bd-pub-button" class="${"wrapper-25eVIn "+Me.guildClasses.circleButtonMask}">public</div>`);return t.addEventListener("click",()=>{this.render()}),e.append(t),e}_appendButton(){let[e]=[Be.removeDa(BDModules.get(e=>e.downloadProgress&&e.tutorialContainer)[0].tutorialContainer)];if(xe.query("#bd-pub-li"))return;const t=xe.query(`div.${e} > div`);xe.after(t,this.button)}addButton(){if(this.guildPatch)return;const e=D.find(e=>e.default&&"NavigableGuilds"==e.default.displayName),t=D.findByDisplayName("Guilds");e||t||Be.warn("PublicServer","Can't find GuildList component"),this.guildPatch=Be.monkeyPatch(e||t.prototype,e?"default":"render",{after:this._appendButton}),this._appendButton()}removeButton(){this.guildPatch(),delete this.guildPatch;const e=xe.query("#bd-pub-li");e&&e.remove()}};var nt=new class{start(){xe.addStyle("VoiceMode","\n .container-2Rl01u {\n display: none!important;\n }\n\n .chat-3bRxxu {\n display: none!important;\n }\n\n .sidebar-2K8pFh {\n flex-grow: 1!important;\n }\n")}stop(){xe.removeStyle("VoiceMode")}};const st=new RegExp("^(?!da-)((?:[A-Za-z]|[0-9]|-)+)-(?:[A-Za-z]|[0-9]|-|_){6}$");var rt=new class{constructor(){window.Lightcord.BetterDiscord.ClassNormalizer=this}stop(){this.hasPatched&&(this.unpatchClassModules(D.findAll(this.moduleFilter.bind(this))),this.revertElement(document.querySelector("#app-mount")),this.hasPatched=!1)}start(){this.hasPatched||(this.patchClassModules(D.findAll(this.moduleFilter.bind(this))),this.normalizeElement(document.querySelector("#app-mount")),this.hasPatched=!0,this.patchDOMMethods())}patchClassModules(e){for(const t of e)this.patchClassModule("da",t)}unpatchClassModules(e){for(const t of e)this.unpatchClassModule("da",t)}shouldIgnore(e){return!isNaN(e)||(!!(e.endsWith("px")||e.endsWith("ch")||e.endsWith("em")||e.endsWith("ms"))||(!!e.startsWith("layerContainer-")||(!(!e.startsWith("#")||7!=e.length&&4!=e.length)||!(!e.includes("calc(")&&!e.includes("rgba")))))}moduleFilter(e){if("object"!=typeof e||Array.isArray(e))return!1;if(e.__esModule)return!1;if(!Object.keys(e).length)return!1;for(const t in e){const n=e[t];if("string"!=typeof n)return!1;if(!this.shouldIgnore(n)){if(1===n.split("-").length)return!1;if(!st.test(n.split(" ")[0]))return!1}}return!0}patchClassModule(e,t){for(const n in t){const s=t[n];if(this.shouldIgnore(s))continue;const r=s.split(" ");for(const s of r){const r=s.match(st);if(!r||!r.length||r.length<2)continue;const i=r[1].split("-").map((e,t)=>t?e[0].toUpperCase()+e.slice(1):e).join("");t[n]+=` ${e}-${i}`}}}unpatchClassModule(e,t){for(const n in t){const s=t[n];if(this.shouldIgnore(s))continue;let r="";const i=s.split(" ");for(const t of i)t.startsWith(e+"-")||(r+=" "+t);t[n]=r.trim()}}normalizeElement(e){if(!(e instanceof Element))return;const t=e.classList;for(let n=0,s=t.length;n<s;n++){if(!st.test(t[n]))continue;const s=t[n].match(st)[1].split("-").map((e,t)=>t?e[0].toUpperCase()+e.slice(1):e).join("");e.classList.add("da-"+s)}for(const t of e.children)this.normalizeElement(t)}revertElement(e){if(!(e instanceof Element))return;e.children&&e.children.length&&this.revertElement(e.children[0]),e.nextElementSibling&&this.revertElement(e.nextElementSibling);const t=e.classList,n=[];for(let e=0;e<t.length;e++)t[e].startsWith("da-")&&n.push(t[e]);e.classList.remove(...n)}patchDOMMethods(){const e=DOMTokenList.prototype.contains;DOMTokenList.prototype.contains=function(t){return Reflect.apply(e,this,[t.split(" ")[0]])};const t=DOMTokenList.prototype.add;DOMTokenList.prototype.add=function(...e){for(let t=0;t<e.length;t++)e[t]=e[t].split(" ")[0];return Reflect.apply(t,this,e)};const n=DOMTokenList.prototype.remove;DOMTokenList.prototype.remove=function(...e){for(let t=0;t<e.length;t++)e[t]=e[t].split(" ")[0];return Reflect.apply(n,this,e)}}},it=new class{constructor(){this.debugListener=this.debugListener.bind(this),this.copySelectorListener=this.copySelectorListener.bind(this)}start(){this.startDebugListener(),h["fork-dm-1"]&&this.startCopySelector()}stop(){this.stopDebugListener(),this.stopCopySelector()}startDebugListener(){this.stopDebugListener(),document.addEventListener("keydown",this.debugListener)}stopDebugListener(){document.removeEventListener("keydown",this.debugListener)}startCopySelector(){this.stopCopySelector(),document.addEventListener("contextmenu",this.copySelectorListener)}stopCopySelector(){document.removeEventListener("contextmenu",this.copySelectorListener)}debugListener(e){if(119===e.which||118==e.which){console.log("%c[%cDevMode%c] %cBreak/Resume","color: red;","color: #303030; font-weight:700;","color:red;","");debugger;e.preventDefault(),e.stopImmediatePropagation()}}copySelectorListener(e){try{e.stopPropagation();const t=this.getSelector(e.target);let[n,s]=[BDModules.get(e=>e.layer&&"string"==typeof e.layer&&e.disabledPointerEvents)[0],BDModules.get(e=>e.menu)[0]];setTimeout((function(){if(!s||!n.layer)return console.log(s,n.layer);let r=xe.query("."+Be.removeDa(s.menu));if(!r){const t=xe.query("#app-mount > ."+Be.removeDa(n.layerContainer)),i=xe.createElement(`<div class="${n.layer}">`);r=xe.createElement(`<div class="${s.menu} ${s.styleFlexible} ${s.accommodateScrollbar} bd-context-menu" style=""></div>`),i.append(r),t.append(i),i.style.top=e.clientY+"px",i.style.left=e.clientX+"px",i.setAttribute("role","menu"),i.setAttribute("tabindex","-1"),i.id="bd-copy-selector-context",i.setAttribute("aria-label","Copy Selector Actions");const o=BDModules.get(e=>e.scrollerWrap)[0],a=xe.createElement(`<div class="${o.scrollerWrap} ${o.scrollerThemed} ${o.themeGhostHairline}"></div>`),l=xe.createElement(`<div class="${BDModules.get(e=>e.scroller)[0].scroller} ${s.scroller}"></div>`);a.append(l),r.append(a);const c=function(e){e.keyCode&&27!==e.keyCode||(i.remove(),document.removeEventListener("click",c),document.removeEventListener("contextmenu",c),document.removeEventListener("keyup",c))};document.addEventListener("click",c),document.addEventListener("contextmenu",c),document.addEventListener("keyup",c)}const i=r.parentElement,o=r.childNodes[0].childNodes[0],a=xe.createElement('<div role="group"></div>'),l=xe.createElement(`<div class="${s.item} ${s.labelContainer} ${s.colorDefault}" role="menuitem" id="bd-copy-selector-item-cm"></div>`);if(l.append(xe.createElement(`<div class="${s.label}">Copy Selector</div>`)),l.addEventListener("click",()=>{Me.NativeModule.copy(t),i.style.display="none"}),l.addEventListener("mouseover",e=>{let t=xe.queryAll("div[role=menuitem]."+Be.removeDa(s.focused));t&&t.forEach(e=>e.classList.remove(s.focused)),l.classList.add(s.focused)}),l.addEventListener("mouseout",e=>{l.classList.remove(s.focused)}),a.append(l),o.childNodes.length){const e=xe.createElement(`<div role="separator" class="${s.separator}"></div>`);o.append(e)}o.append(a),i.clientHeight<i.scrollHeight&&(console.log("overflowing "+i.style.top),i.style.top=i.style.top-a.clientHeight+"px",console.log("overflowing"+i.style.top))}),1)}catch(e){console.error(e)}}getSelector(e){if(e.id)return"#"+e.id;return function(e){for(var t=[];e.parentNode;){if(e.id){t.unshift("#"+e.id);break}if(e==e.ownerDocument.documentElement)t.unshift(e.tagName.toLowerCase()+Array.from(e.classList.entries()).map(e=>"."+e).join(""));else{for(var n=1,s=e;s.previousElementSibling;s=s.previousElementSibling,n++);t.unshift(e.tagName.toLowerCase()+("string"==typeof e.className&&e.className||"").split(" ").filter(e=>!!e).map(e=>"."+e).join("")+":nth-child("+n+")")}e=e.parentNode}return t.join(" > ")}(e)}};const ot=Me.React;class at extends ot.Component{constructor(e){super(e),this.state={checked:this.props.checked},this.onChange=this.onChange.bind(this),this.switch=ot.createElement(Lightcord.Api.Components.inputs.Switch,{onChange:this.onChange,value:this.state.checked})}onChange(e){this.props.disabled||(this.props.onChange(e),this.setState({checked:e}))}render(){return this.switch}}let lt=[];function ct(e){let t=lt.find(t=>t.startsWith(e+"-"));return t||(t=BDModules.get(t=>t[e])[0][e],lt.push(t),t)}class dt extends Me.reactComponent{constructor(e){super(e),this.onChange=this.onChange.bind(this)}onChange(){this.props.checked=!this.props.checked,this.props.onChange(this.props.id,this.props.checked)}render(){let{text:e,info:t}=this.props.data;return this.props.data.experimental&&(lt.find(e=>e.startsWith("beta-"))||lt.push(BDModules.get(e=>e.beta&&!e.container&&!e.userSettingsVoice)[0].beta),t=[t,React.createElement("sup",{className:ct("beta")},"(EXPERIMENTAL)")]),Me.react.createElement("div",{className:"ui-flex flex-vertical flex-justify-start flex-align-stretch flex-nowrap ui-switch-item"},Me.react.createElement("div",{className:"ui-flex flex-horizontal flex-justify-start flex-align-stretch flex-nowrap"},Me.react.createElement("h3",{key:"title",className:"ui-form-title h3 margin-reset margin-reset ui-flex-child"},e),Me.react.createElement(at,{key:"switch",onChange:this.onChange,checked:this.props.checked})),Me.react.createElement("div",{className:"ui-form-text style-description margin-top-4",style:{flex:"1 1 auto"}},t))}}let ht,ut,pt,mt=BDModules.get(e=>e.marginTop60)[0];class gt extends React.Component{render(){return mt||(mt=BDModules.get(e=>e.marginTop60)[0]),React.createElement("div",{className:mt.marginTop60})}}class ft extends Me.reactComponent{constructor(e){super(e),this.state={error:!1}}renderOldSettings(){const{title:e,settings:t,button:n}=this.props,s=n?Me.react.createElement("button",{key:"title-button",className:"bd-pfbtn",onClick:n.onClick},n.title):null;return[Me.react.createElement(Te,{text:e}),s,t.map(e=>Me.react.createElement(dt,{id:e.id,key:e.id,data:e,checked:h[e.id],onChange:(e,t)=>{this.props.onChange(e,t),this.forceUpdate()}}))]}componentDidCatch(e,t){console.log(e,t),this.setState({error:!0})}render(){if(this.state.error)try{return this.renderOldSettings()}catch(e){return console.error(e),null}else try{ht||(ht=Me.WebpackModules.find(e=>e.FormSection)),ut||(ut=Me.WebpackModules.find(e=>e.default&&"SwitchItem"===e.default.displayName)),pt||(pt=Me.WebpackModules.find(e=>e.beta&&!e.container&&!e.userSettingsVoice));let e=[];return this.props.description&&e.push(React.createElement(ht.FormText,{type:"description",selectable:!1},this.props.description),React.createElement(gt,null)),e.push(...this.props.settings.map(e=>{let t=[e.text];return e.experimental&&t.push(React.createElement("sup",{className:pt.beta},"(EXPERIMENTAL)")),React.createElement(ut.default,{onChange:t=>{this.props.onChange(e.id,t.target.checked),this.forceUpdate()},key:e.id,value:h[e.id],className:__SECRET_EMOTION__.css({marginBottom:"20px"}),disabled:!1,hideBorder:!1,note:e.info,tooltipNote:null},t)})),React.createElement(ht.FormSection,{tag:"h2",title:this.props.title},e)}catch(e){return console.error(e),setImmediate(()=>{this.setState({error:!0})}),null}}}class bt extends Me.reactComponent{constructor(e){super(e)}render(){return this.props.sections.map((e,t)=>[0!==t?Me.react.createElement(gt,{}):null,Me.react.createElement(ft,Object.assign({},e,{onChange:this.props.onChange}))])}}class yt extends Me.reactComponent{constructor(e){super(e),this.onClick=this.onClick.bind(this),this.setInitialState()}setInitialState(){this.state={checked:this.props.checked||!1}}render(){return Me.react.createElement("li",null,Me.react.createElement("div",{className:"checkbox "+BDModules.get(e=>e.checkboxElement)[0].checkbox,onClick:this.onClick},Me.react.createElement("div",{className:"checkbox-inner "+BDModules.get(e=>e.checkboxInner)[0].checkboxInner},Me.react.createElement("input",{className:BDModules.get(e=>e.checkboxElement)[0].checkboxElement,checked:this.state.checked,onChange:()=>{},type:"checkbox"}),Me.react.createElement("span",null)),Me.react.createElement("span",null,this.props.text)))}onClick(){this.props.onChange(this.props.id,!this.state.checked),this.setState({checked:!this.state.checked})}}class vt extends Me.reactComponent{constructor(e){super(e);this.onClick=this.onClick.bind(this),this.updateCss=this.updateCss.bind(this),this.saveCss=this.saveCss.bind(this),this.onChange=this.onChange.bind(this)}componentDidMount(){xe.addClass(xe.query("#app-mount"),"bd-detached-editor"),Me.editorDetached=!0,this.editor=ace.edit("bd-customcss-editor-detached"),this.editor.setTheme("ace/theme/discord"),this.editor.session.setMode("ace/mode/css"),this.editor.setShowPrintMargin(!1),this.editor.setFontSize(14),this.editor.on("change",()=>{h["bda-css-0"]&&(this.saveCss(),this.updateCss())})}componentWillUnmount(){xe.removeClass(xe.query("#app-mount"),"bd-detached-editor"),Me.editorDetached=!1,this.editor.destroy()}updateLineCount(){const e=this.refs.editor.value.split("\n").length;e!=this.props.lines&&(this.refs.lines.textContent=Array.from(new 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(){const e=A.getBDData("bdcustomcss");let t="";return e&&""!==e&&(t=Buffer.from(e,"base64").toString("utf8")),t}get root(){const e=xe.query("#bd-customcss-detach-container");return e||(this.injectRoot()?this.detachedRoot:null)}injectRoot(){const e=xe.query(".app, ."+Be.removeDa(BDModules.get(e=>e.app&&e.layers)[0].app));return!!e&&(xe.insertAfter(xe.createElement('<div id="bd-customcss-detach-container">'),e),!0)}render(){const e=this;return Me.react.createElement("div",{className:"bd-detached-css-editor",id:"bd-customcss-detach-editor"},Me.react.createElement("div",{id:"bd-customcss-innerpane"},Me.react.createElement("div",{className:"editor-wrapper"},Me.react.createElement("div",{id:"bd-customcss-editor-detached",className:"editor",ref:"editor"},e.css)),Me.react.createElement("div",{id:"bd-customcss-attach-controls"},Me.react.createElement("ul",{className:"checkbox-group"},Me.react.createElement(yt,{id:"live-update",text:"Live Update",onChange:e.onChange,checked:h["bda-css-0"]})),Me.react.createElement("div",{id:"bd-customcss-detach-controls-button"},Me.react.createElement("button",{style:{borderRadius:"3px 0 0 3px",borderRight:"1px solid #3f4146"},className:"btn btn-primary",onClick:()=>{e.onClick("update")}},"Update"),Me.react.createElement("button",{style:{borderRadius:"0",borderLeft:"1px solid #2d2d2d",borderRight:"1px solid #2d2d2d"},className:"btn btn-primary",onClick:()=>{e.onClick("save")}},"Save"),Me.react.createElement("button",{style:{borderRadius:"0 3px 3px 0",borderLeft:"1px solid #3f4146"},className:"btn btn-primary",onClick:()=>{e.onClick("attach")}},"Attach"),Me.react.createElement("span",{style:{fontSize:"10px",marginLeft:"5px"}},"Unsaved changes are lost on attach")))))}onChange(e,t){switch(e){case"live-update":h["bda-css-0"]=t,ls.saveSettings()}}onClick(e){const t=this;switch(e){case"attach":xe.query("#editor-detached")&&t.props.attach(),Me.reactDom.unmountComponentAtNode(t.root),t.root.remove();break;case"update":t.updateCss();break;case"save":t.saveCss()}}updateCss(){xe.removeStyle("customcss"),xe.addStyle("customcss",this.editor.session.getValue())}saveCss(){A.setBDData("bdcustomcss",Buffer.from(this.editor.session.getValue(),"utf-8").toString("base64"))}}class wt extends Me.reactComponent{constructor(e){super(e);this.props.lines=0,this.setInitialState(),this.attach=this.attach.bind(this),this.detachedEditor=Me.react.createElement(vt,{attach:this.attach}),this.onClick=this.onClick.bind(this),this.updateCss=this.updateCss.bind(this),this.saveCss=this.saveCss.bind(this),this.detach=this.detach.bind(this)}setInitialState(){this.state={detached:this.props.detached||Me.editorDetached}}componentDidMount(){this.editor=ace.edit("bd-customcss-editor"),this.editor.setTheme("ace/theme/discord"),this.editor.session.setMode("ace/mode/css"),this.editor.setShowPrintMargin(!1),this.editor.setFontSize(14),this.editor.on("change",()=>{h["bda-css-0"]&&(this.saveCss(),this.updateCss())})}componentWillUnmount(){this.editor.destroy()}componentDidUpdate(e,t){const n=this;t.detached&&!n.state.detached&&Me.reactDom.unmountComponentAtNode(n.detachedRoot)}codeMirror(){}get options(){return{lineNumbers:!0,mode:"css",indentUnit:4,theme:"material",scrollbarStyle:"simple"}}get css(){const e=A.getBDData("bdcustomcss");let t="";return e&&""!==e&&(t=Buffer.from(e,"base64").toString("utf8")),t}updateLineCount(){const e=this.refs.editor.value.split("\n").length;e!=this.props.lines&&(this.refs.lines.textContent=Array.from(new Array(e),(e,t)=>t+1).join(".\n")+".",this.props.lines=e)}render(){const e=this,{detached:t}=e.state;return[t&&Me.react.createElement("div",{id:"editor-detached"},Me.react.createElement(Te,{text:"Custom CSS Editor"}),Me.react.createElement("h3",null,"Editor Detached"),Me.react.createElement("button",{className:"btn btn-primary",onClick:()=>{e.attach()}},"Attach")),!t&&Me.react.createElement("div",null,Me.react.createElement(Te,{text:"Custom CSS Editor"}),Me.react.createElement("div",{className:"editor-wrapper"},Me.react.createElement("div",{id:"bd-customcss-editor",className:"editor",ref:"editor"},e.css)),Me.react.createElement("div",{id:"bd-customcss-attach-controls"},Me.react.createElement("ul",{className:"checkbox-group"},Me.react.createElement(yt,{id:"live-update",text:"Live Update",onChange:this.onChange,checked:h["bda-css-0"]})),Me.react.createElement("div",{id:"bd-customcss-detach-controls-button"},Me.react.createElement("button",{style:{borderRadius:"3px 0 0 3px",borderRight:"1px solid #3f4146"},className:"btn btn-primary",onClick:()=>{e.onClick("update")}},"Update"),Me.react.createElement("button",{style:{borderRadius:"0",borderLeft:"1px solid #2d2d2d",borderRight:"1px solid #2d2d2d"},className:"btn btn-primary",onClick:()=>{e.onClick("save")}},"Save"),Me.react.createElement("button",{style:{borderRadius:"0 3px 3px 0",borderLeft:"1px solid #3f4146"},className:"btn btn-primary",onClick:()=>{e.onClick("detach")}},"Detach"),Me.react.createElement("span",{style:{fontSize:"10px",marginLeft:"5px"}},"Unsaved changes are lost on detach"),Me.react.createElement("div",{className:"help-text"},"Press ",Me.react.createElement("code",{className:"inline"},"ctrl"),"+",Me.react.createElement("span",{className:"inline"},",")," with the editor focused to access the editor's settings."))))]}onClick(e){const t=this;switch(e){case"update":t.updateCss();break;case"save":t.saveCss();break;case"detach":t.detach()}}onChange(e,t){switch(e){case"live-update":h["bda-css-0"]=t,ls.saveSettings()}}updateCss(){xe.removeStyle("customcss"),xe.addStyle("customcss",this.editor.session.getValue())}saveCss(){A.setBDData("bdcustomcss",Buffer.from(this.editor.session.getValue(),"utf-8").toString("base64"))}detach(){this.setState({detached:!0});const e=this.detachedRoot;e?Me.reactDom.render(this.detachedEditor,e):console.log("FAILED TO INJECT ROOT: .app")}get detachedRoot(){const e=xe.query("#bd-customcss-detach-container");return e||(this.injectDetachedRoot()?this.detachedRoot:null)}injectDetachedRoot(){const e=xe.query(".app, ."+Be.removeDa(BDModules.get(e=>e.app&&e.layers)[0].app));return!!e&&(xe.insertAfter(xe.createElement('<div id="bd-customcss-detach-container">'),e),!0)}attach(){this.setState({detached:!1})}}class Ct extends Me.reactComponent{constructor(e){super(e),this.state={hasError:!1}}componentDidCatch(){this.setState({hasError:!0})}render(){return this.state.hasError?Me.react.createElement("div",{className:"react-error"},"Component Error"):this.props.children}}const Et=Ct.prototype.render;Object.defineProperty(Ct.prototype,"render",{enumerable:!1,configurable:!1,set:function(){console.warn("Addon policy for plugins #5 https://github.com/rauenzi/BetterDiscordApp/wiki/Addon-Policies#plugins")},get:()=>Et});class St extends Me.reactComponent{constructor(e){super(e)}static get displayName(){return"ContentColumn"}render(){let e=this.props.title?Me.react.createElement("h2",{className:"ui-form-title h2 margin-reset margin-bottom-20"},this.props.title):null;return[e,this.props.children]}}class xt extends Me.reactComponent{constructor(e){super(e)}render(){return Me.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"}},Me.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"}),Me.react.createElement("path",{fill:"none",d:"M0 0h24v24H0z"}))}}class kt extends Me.reactComponent{constructor(e){super(e)}render(){return Me.react.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 12 12",style:{width:"18px",height:"18px"}},Me.react.createElement("g",{className:"background",fill:"none",fillRule:"evenodd"},Me.react.createElement("path",{d:"M0 0h12v12H0"}),Me.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"})))}}const Dt=Me.React;class Mt extends Dt.Component{render(){const e=this.props.size||"24px";return Dt.createElement("svg",{className:this.props.className||"",viewBox:"0 0 24 24",fill:"var(--text-normal)",style:{width:e,height:e},onClick:this.props.onClick},Dt.createElement("path",{d:"M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34c-.39-.39-1.02-.39-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z"}),Dt.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}))}}const Bt=Me.React;class Lt extends Bt.Component{render(){const e=this.props.size||"24px";return Bt.createElement("svg",{className:this.props.className||"",fill:"var(--text-normal)",viewBox:"0 0 24 24",style:{width:e,height:e},onClick:this.props.onClick},Bt.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),Bt.createElement("path",{d:"M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zm2.46-7.12l1.41-1.41L12 12.59l2.12-2.12 1.41 1.41L13.41 14l2.12 2.12-1.41 1.41L12 15.41l-2.12 2.12-1.41-1.41L10.59 14l-2.13-2.12zM15.5 4l-1-1h-5l-1 1H5v2h14V4z"}),Bt.createElement("path",{fill:"none",d:"M0 0h24v24H0z"}))}}const Nt=Me.React,At=Me.anchorClasses;class Pt extends Me.reactComponent{constructor(e){super(e),this.onChange=this.onChange.bind(this),this.showSettings=this.showSettings.bind(this),this.setInitialState(),this.hasSettings=this.props.addon.plugin&&"function"==typeof this.props.addon.plugin.getSettingsPanel,this.settingsPanel="",this.edit=this.edit.bind(this),this.delete=this.delete.bind(this),this.reload=this.reload.bind(this)}setInitialState(){this.state={checked:this.props.enabled,settings:!1,reloads:0,trusted:!1}}showSettings(){this.hasSettings&&this.setState({settings:!0})}closeSettings(){this.panelRef.current.innerHTML="",this.setState({settingsOpen:!1})}componentDidUpdate(){this.state.settings&&("object"==typeof this.settingsPanel&&this.refs.settingspanel.appendChild(this.settingsPanel),h["fork-ps-3"]&&setImmediate(()=>{const e=this.refs.cardNode,t=e.closest('div[class*="contentRegionScroller-"]');if(!((e,t)=>{if(!e)return console.error(new Error("Container is undefined.")),!1;const n=e.scrollTop,s=n+e.clientHeight,r=t.offsetTop,i=r+t.clientHeight;return r<n||i>s})(t,e))return;const n=xe.offset(e),s=xe.offset(t),r=t.scrollTop,i=n.top-s.top+t.scrollTop-30;xe.animate({duration:300,update:function(e){t.scrollTop=i>r?r+e*(i-r):r-e*(r-i)}})}))}getString(e){return e?"string"==typeof e?e:e.toString():"???"}get settingsComponent(){try{this.settingsPanel=this.props.addon.plugin.getSettingsPanel()}catch(e){Be.err("Plugins","Unable to get settings panel for "+this.name+".",e)}return Me.react.createElement("div",{className:"bd-card bd-addon-card settings-open ui-switch-item",ref:"cardNode"},Me.react.createElement("div",{style:{float:"right",cursor:"pointer"},onClick:()=>{this.refs.settingspanel.innerHTML="",this.setState({settings:!1})}},Me.react.createElement(kt,null)),"object"==typeof this.settingsPanel&&Me.react.createElement("div",{id:"plugin-settings-"+this.name,className:"plugin-settings",ref:"settingspanel"}),"object"!=typeof this.settingsPanel&&Me.react.createElement("div",{id:"plugin-settings-"+this.name,className:"plugin-settings",ref:"settingspanel",dangerouslySetInnerHTML:{__html:this.settingsPanel}}))}buildTitle(e,t,n){const s="{{name}} v{{version}} by {{author}}".split(/({{[A-Za-z]+}})/),r=s.findIndex(e=>"{{name}}"==e);r&&(s[r]=Nt.createElement("span",{className:"name bda-name"},e));const i=s.findIndex(e=>"{{version}}"==e);r&&(s[i]=Nt.createElement("span",{className:"version bda-version"},t));const o=s.findIndex(e=>"{{author}}"==e);if(r){const e={className:"author bda-author"};(n.link||n.id)&&(e.className+=` ${At.anchor} ${At.anchorUnderlineOnHover}`,e.target="_blank",n.link&&(e.href=n.link),n.id&&(e.onClick=()=>{Me.LayerStack.popLayer(),Me.openDM(n.id)})),s[o]=Nt.createElement(n.link||n.id?"a":"span",e,n.name)}return s.flat()}makeLink(e,t){const n={className:"bda-link bda-link-website",target:"_blank"};return"string"==typeof t&&(n.href=t),"function"==typeof t&&(n.onClick=e=>{e.preventDefault(),e.stopPropagation(),t()}),Me.react.createElement("a",n,e)}makeButton(e,t,n){return Nt.createElement(J,{color:"black",side:"top",text:e},Nt.createElement("div",{className:"bd-addon-button",onClick:n},t))}componentWillUnmount(){this.unmounted=!0}get links(){const e=[],t=this.props.addon;return t.website&&e.push(this.makeLink("Website",t.website)),t.source&&e.push(this.makeLink("Source",t.source)),t.invite&&e.push(this.makeLink("Support Server",()=>{const e=/\.gg\/(.*)$/;let n=t.invite;e.test(n)&&(n=n.match(e)[1]),Me.LayerStack.popLayer(),Me.InviteActions.acceptInviteAndTransitionToInviteChannel(n)})),t.donate&&e.push(this.makeLink("Donate",t.donate)),t.patreon&&e.push(this.makeLink("Patreon",t.patreon)),e}get footer(){const e=this.links;return(e.length||this.hasSettings)&&Me.react.createElement("div",{className:"bd-card-footer bda-footer"},Me.react.createElement("span",{className:"bd-addon-links bda-links"},...e.map((t,n)=>n<e.length-1?[t," | "]:t).flat()),this.hasSettings&&Me.react.createElement("button",{onClick:this.showSettings,className:"bd-button bda-settings-button",disabled:!this.state.checked},"Settings"))}onChange(){this.props.toggle&&this.props.toggle(this.name),this.setState({checked:!this.state.checked})}edit(){this.props.edit(this.name)}delete(){this.props.remove(this.name)}reload(){this.props.reload(this.name)}get name(){return this.getString(this.props.addon.plugin?this.props.addon.plugin.getName():this.props.addon.name)}get author(){return this.getString(this.props.addon.plugin?this.props.addon.plugin.getAuthor():this.props.addon.author)}get description(){return this.getString(this.props.addon.plugin?this.props.addon.plugin.getDescription():this.props.addon.description)}get version(){return this.getString(this.props.addon.plugin?this.props.addon.plugin.getVersion():this.props.addon.version)}render(){if(this.state.settings)return this.settingsComponent;const{authorId:e,authorLink:t}=this.props.addon,n={};return h["fork-ps-6"]&&(this.isScanning?(!0===this.state.isTrusted&&(n.borderColor="#4087ed"),"suspect"===this.state.isTrusted&&(n.borderColor="rgb(240, 71, 71)")):(this.isScanning=!0,ie(Object(Z.resolve)(this.props.addon.filename.endsWith(".plugin.js")?Se.pluginsFolder:Se.themesFolder,this.props.addon.filename),e=>{this.unmounted||this.setState({isTrusted:!e.suspect||"suspect"})},()=>{}))),Me.react.createElement("div",{className:"bd-card bd-addon-card settings-closed ui-switch-item",style:n},Me.react.createElement("div",{className:"bd-addon-header bda-header"},Me.react.createElement("div",{className:"bd-card-title bda-header-title"},this.buildTitle(this.name,this.version,{name:this.author,id:e,link:t})),Me.react.createElement("div",{className:"bd-addon-controls bda-controls"},this.props.edit&&this.makeButton("Edit",Nt.createElement(Mt,{className:"bd-icon"}),this.edit),this.props.remove&&this.makeButton("Delete",Nt.createElement(Lt,{className:"bd-icon"}),this.delete),this.props.reload&&this.makeButton("Reload",Nt.createElement(xt,{className:"bd-icon"}),this.reload),Nt.createElement(at,{onChange:this.onChange,checked:this.state.checked}))),Me.react.createElement("div",{className:"bd-scroller-wrap bda-description-wrap scroller-wrap fade"},Me.react.createElement("div",{className:"bd-scroller bd-addon-description bda-description scroller"},this.description)),this.footer)}}const Tt=Pt.prototype.render;Object.defineProperty(Pt.prototype,"render",{enumerable:!1,configurable:!1,set:function(){console.warn("Addon policy for plugins #5 https://github.com/rauenzi/BetterDiscordApp/wiki/Addon-Policies#plugins")},get:()=>Tt});const Rt=Me.React;class Ot extends Rt.Component{render(){const e=this.props.size||"16px";return Rt.createElement("svg",{className:this.props.className||"",fill:"var(--text-normal)",viewBox:"0 0 24 24",style:{width:e,height:e}},Rt.createElement("path",{d:"M8.12 9.29L12 13.17l3.88-3.88c.39-.39 1.02-.39 1.41 0 .39.39.39 1.02 0 1.41l-4.59 4.59c-.39.39-1.02.39-1.41 0L6.7 10.7c-.39-.39-.39-1.02 0-1.41.39-.38 1.03-.39 1.42 0z"}))}}const _t=Me.React;class jt extends _t.Component{constructor(e){super(e),this.state={open:!1,value:this.props.value||this.props.options[0].value},this.dropdown=_t.createRef(),this.onChange=this.onChange.bind(this),this.showMenu=this.showMenu.bind(this),this.hideMenu=this.hideMenu.bind(this)}showMenu(e){e.preventDefault(),this.setState({open:!0},()=>{document.addEventListener("click",this.hideMenu)})}hideMenu(){this.setState({open:!1},()=>{document.removeEventListener("click",this.hideMenu)})}onChange(e){this.setState({value:e}),this.props.onChange&&this.props.onChange(e)}get selected(){return this.props.options.find(e=>e.value==this.state.value)}get options(){const e=this.selected;return _t.createElement("div",{className:"bd-select-options"},this.props.options.map(t=>_t.createElement("div",{className:"bd-select-option"+(e.value==t.value?" selected":""),onClick:this.onChange.bind(this,t.value)},t.label)))}render(){const e="transparent"==this.props.style?" bd-select-transparent":"",t=this.state.open?" menu-open":"";return _t.createElement("div",{className:`bd-select${e}${t}`,onClick:this.showMenu,ref:this.dropdown},_t.createElement("div",{className:"bd-select-value"},this.selected.label),_t.createElement(Ot,{className:"bd-select-arrow"}),this.state.open&&this.options)}}const It=Me.React;class $t extends It.Component{render(){const e=this.props.size||"16px";return It.createElement("svg",{className:this.props.className||"",fill:"var(--text-normal)",viewBox:"0 0 24 24",style:{width:e,height:e}},It.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),It.createElement("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"}))}}const Wt=Me.React;class Ft extends Wt.Component{constructor(e){super(e),this.state={focused:!1}}render(){const e=["bd-search-wrapper"];return this.state.focused&&e.push("focused"),Wt.createElement("div",{className:e.join(" ")},Wt.createElement("input",{onChange:this.props.onChange,onKeyDown:this.props.onKeyDown,type:"text",className:"bd-search",placeholder:this.props.placeholder,maxLength:"50",onFocus:()=>{this.setState({focused:!0})},onBlur:()=>{this.setState({focused:!1})}}),Wt.createElement($t,null))}}function Ht(){return(Ht=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e}).apply(this,arguments)}const Ut=D.findByDisplayName("Tooltip"),zt=Me.react;class Gt extends Me.reactComponent{constructor(e){super(e),this.state={sort:"name",ascending:!0,query:""},this.isPlugins="plugins"==this.props.type,this.cookie=this.isPlugins?C:E,this.manager=this.isPlugins?O:De,this.sort=this.sort.bind(this),this.reverse=this.reverse.bind(this),this.search=this.search.bind(this),this.onAddonChanges=function(){this.forceUpdate()},this.onAddonChanges=this.onAddonChanges.bind(this)}componentDidMount(){const e=(this.isPlugins?"plugin":"theme")+"-";T.on(e+"loaded",this.onAddonChanges),T.on(e+"unloaded",this.onAddonChanges),T.on(e+"reloaded",this.onAddonChanges)}componentWillUnmount(){const e=(this.isPlugins?"plugin":"theme")+"-";T.off(e+"loaded",this.onAddonChanges),T.off(e+"unloaded",this.onAddonChanges),T.off(e+"reloaded",this.onAddonChanges)}openFolder(){const e=n(0).shell;(e.openPath||e.openItem)(this.isPlugins?Se.pluginsFolder:Se.themesFolder)}edit(e){console.log(e),this.manager.edit(e)}async delete(e){await this.confirmDelete(e)&&this.manager.delete(e)}confirmDelete(e){return new Promise(t=>{Ws.showConfirmationModal("Are You Sure?",`Are you sure you want to delete ${e}?`,{danger:!0,confirmText:"Delete",onConfirm:()=>{t(!0)},onCancel:()=>{t(!1)}})})}get sortOptions(){return[{label:"Name",value:"name"},{label:"Author",value:"author"},{label:"Version",value:"version"},{label:"Recently Added",value:"added"},{label:"Last Modified",value:"modified"},{label:"File Size",value:"size"}]}get directions(){return[{label:"Ascending",value:!0},{label:"Descending",value:!1}]}reverse(e){this.setState({ascending:e})}sort(e){this.setState({sort:e})}search(e){this.setState({query:e.target.value.toLocaleLowerCase()})}getProps(e){return{key:this.getName(e),enabled:this.cookie[this.getName(e)],toggle:this.manager.toggle.bind(this.manager),edit:h["fork-ps-7"]?this.edit.bind(this):null,remove:this.delete.bind(this),addon:e,hash:e.hash}}getString(e){return e?"string"==typeof e?e:e.toString():"???"}get list(){return"plugins"===this.props.type?Object.values(w):Object.values(v)}getAddons(){const e=this.list.sort((e,t)=>{const n=this.state.sort.charAt(0).toUpperCase()+this.state.sort.slice(1),s=e.plugin&&e.plugin["get"+n]?this.getString(e.plugin["get"+n]()):this.getString(e[this.state.sort]),r=t.plugin&&t.plugin["get"+n]?this.getString(t.plugin["get"+n]()):this.getString(t[this.state.sort]);return"string"==typeof s?s.toLocaleLowerCase().localeCompare(r.toLocaleLowerCase()):s>r?1:r>s?-1:0});this.state.ascending||e.reverse();const t=[];for(let n=0;n<e.length;n++){const s=e[n];if(this.state.query){let e=null;const t=this.getName(s),n=this.getAuthor(s),r=this.getDescription(s),i=this.getVersion(s);if(t&&(e=t.toLocaleLowerCase().includes(this.state.query)),n&&(e=e||n.toLocaleLowerCase().includes(this.state.query)),r&&(e=e||r.toLocaleLowerCase().includes(this.state.query)),i&&(e=e||i.toLocaleLowerCase().includes(this.state.query)),!e)continue}const r=this.getProps(s);t.push(zt.createElement(Ct,null,zt.createElement(Pt,Ht({},r,{reload:!h["fork-ps-5"]&&this.manager.reload.bind(this.manager)}))))}return t}getName(e){return this.getString(e.plugin?e.plugin.getName():e.name)}getAuthor(e){return this.getString(e.plugin?e.plugin.getAuthor():e.author)}getDescription(e){return this.getString(e.plugin?e.plugin.getDescription():e.description)}getVersion(e){return this.getString(e.plugin?e.plugin.getVersion():e.version)}renderCheckUpdates(){if(!window.ZeresPluginLibrary)return null;if(!window.PluginUpdates)return null;if("function"!=typeof window.PluginUpdates.checkAll)return null;if(!this.isPlugins)return null;let e,t=!1;return zt.createElement(J,{text:"Checks for updates of plugins that support this feature. Right-click for a list."},zt.createElement("span",{style:{marginLeft:"10px"},onMouseLeave:()=>{t=!1,e.hide()}},zt.createElement(Lightcord.Api.Components.inputs.Button,{ref:"checkUpdateButton",color:"brand",look:"filled",size:"min",hoverColor:"default",onClick:()=>{try{Be.showToast("Plugin update check in progress.",{type:"info"}),window.PluginUpdates.checkAll().then(()=>{Be.showToast("Plugin update check complete.",{type:"success"})}).catch(e=>{console.error(e),Be.showToast("An error occured while checking update.",{type:"error"})})}catch(e){console.error(e),Be.showToast("An error occured while checking update.",{type:"error"})}},wrapper:!1,disabled:!1,onRightClick:()=>{this.refs.checkUpdateButton&&window.PluginUpdates&&window.PluginUpdates.plugins&&(t||(e=new V(this.refs.checkUpdateButton.refs.original.refs.button,Object.values(window.PluginUpdates.plugins).map(e=>e.name).join(", "),{side:"bottom",attachEvents:!1}),e.show(),t=!0))}},"Check for Updates")))}render(){const e=zt.createElement(Ut,{color:"black",position:"top",text:"Reload List"},e=>zt.createElement(xt,Ht({},e,{className:"bd-icon bd-reload bd-reload-header",size:"18px",onClick:async()=>{this.isPlugins?O.updatePluginList():De.updateThemeList(),this.forceUpdate()}}))),t=this.getAddons();return zt.createElement(St,{title:`${this.props.type.toUpperCase()}${t.length}`},zt.createElement(Lightcord.Api.Components.inputs.Button,{key:"folder-button",color:"brand",look:"filled",size:"min",hoverColor:"default",onClick:this.openFolder.bind(this),wrapper:!1,style:{marginLeft:"10px"}},"Open ",this.isPlugins?"Plugin":"Theme"," Folder"),this.renderCheckUpdates(),!h["fork-ps-5"]&&e,zt.createElement("div",{className:"bd-controls bd-addon-controls"},zt.createElement(Ft,{onChange:this.search,placeholder:`Search ${this.props.type}...`}),zt.createElement("div",{className:"bd-addon-dropdowns"},zt.createElement("div",{className:"bd-select-wrapper"},zt.createElement("label",{className:"bd-label"},"Sort by:"),zt.createElement(jt,{options:this.sortOptions,onChange:this.sort,style:"transparent"})),zt.createElement("div",{className:"bd-select-wrapper"},zt.createElement("label",{className:"bd-label"},"Order:"),zt.createElement(jt,{options:this.directions,onChange:this.reverse,style:"transparent"})))),zt.createElement("div",{className:"bda-slist bd-addon-list"},t))}}const qt=Gt.prototype.render;Object.defineProperty(Gt.prototype,"render",{enumerable:!1,configurable:!1,set:function(){console.warn("Addon policy for plugins #5 https://github.com/rauenzi/BetterDiscordApp/wiki/Addon-Policies#plugins")},get:()=>qt});const Vt=BDModules.get(e=>e.Dispatcher&&e.default&&e.default.dispatch)[0].default,Jt=BDModules.get(e=>e.ActionTypes)[0].ActionTypes,Yt=process.pid;var Zt=new class{constructor(){this.enabled=!1,this.game=u}get formatedGame(){if(!this.game)return null;if(!1===this.enabled)return null;return{name:this.game.name||p.name,application_id:this.game.application_id||p.application_id,details:this.game.details||void 0,state:this.game.state||void 0,timestamps:this.game["timestamps.start"]?{start:this.game["timestamps.start"]}:void 0,assets:this.game["assets.large"]?{large_image:this.game["assets.large"],small_image:this.game["assets.small"]||void 0}:void 0}}sendGame(){Vt.dispatch({type:Jt.LOCAL_ACTIVITY_UPDATE,socketId:"lightcord-spoof-socket",pid:Yt,activity:this.formatedGame})}enable(){this.enabled||(this.enabled=!0,console.log("Enabling custom RichPresence"),this.set(u||Object.create(p)),this.sendGame())}disable(){this.enabled&&(this.enabled=!1,console.log("Disabling custom RichPresence"),this.sendGame())}async fetchAssets(e){let t=await BDModules.get(e=>e.getAssets)[0].getAssets(e);if(t.undefined&&"number"==typeof t.undefined)throw new Error("Unknown Application");return t}set(e){this.game=e,this.sendGame()}};const Kt=Me.React;let Xt;class Qt extends Kt.Component{constructor(e){super(e),this.state={data:A.getSettingGroup("rpc")||p,assets:[]},this.preview=null,this.isfetching=!1,this.state.data.application_id&&this.fetchAssets(),this.assetComponents=new Set}updateWhenFetched(e){this.assetComponents.add(e)}onChange(e,t){let n=en.find(t=>t.id===e.props.id);this.setState({data:Object.assign(u,this.state.data,{[n.id]:t||null}),assets:this.state.assets}),"application_id"===e.props.id&&this.fetchAssets(),A.setSettingGroup("rpc",u),this.preview.forceUpdate(),Zt.set(u)}fetchAssets(){if(!0===this.isfetching){let e=this.state.data.application_id;setTimeout(()=>{this.state.data.application_id===e&&this.fetchAssets()},5e3)}if(!this.state.data.application_id)return this.setState({data:this.state.data,assets:[]}),this.forceUpdate(),void this.assetComponents.forEach(e=>e.forceUpdate());this.isfetching=!0,Zt.fetchAssets(this.state.data.application_id).then(e=>{this.isfetching=!1,this.setState({data:this.state.data,assets:Object.keys(e).map(t=>{let n=e[t];return{id:n.id,name:n.name,type:n.type}})}),this.forceUpdate(),this.assetComponents.forEach(e=>e.forceUpdate())}).catch(()=>{this.isfetching=!1,this.setState({data:this.state.data,assets:[]}),this.forceUpdate(),this.assetComponents.forEach(e=>e.forceUpdate())})}updatePreview(e){this.setState({data:e})}get modules(){return Xt||(Xt=[BDModules.get(e=>e.marginBottom20)[0]])}render(){let[e]=this.modules;return[Kt.createElement(ft,{title:"RichPresence Settings",settings:this.props.settings,onChange:this.props.onChange}),Kt.createElement(gt,null),Kt.createElement(Te,{text:"RichPresence"}),Kt.createElement("div",null,this.optionsComponents),Kt.createElement("div",null,Kt.createElement(gt,null),Kt.createElement(Te,{text:"Preview"}),Kt.createElement(yn,{settings:this})),Kt.createElement("div",{className:e.marginBottom20}),Kt.createElement("button",{style:{opacity:.01},onClick:window.ohgodohfuck},"Oh god Oh fuck"),Kt.createElement("button",{style:{opacity:.01},onClick:()=>{I.remote.shell.openExternal("https://www.youtube.com/watch?v=LkYa7rps_g4")}},"See ? I pulled a litle sneaky on ya")]}get optionsComponents(){return this._optionsComponents||(this._optionsComponents=en.map(e=>{if("text"===e.type)return Kt.createElement(rn,{setting:e,manager:this,id:e.id});if("number"===e.type){return[Kt.createElement(on,{setting:e,manager:this,id:e.id})]}return"choice"===e.type?["assets.small","assets.large"].includes(e.id)?Kt.createElement(an,{setting:e,manager:this,id:e.id,choices:[{value:"none",label:"No assets"}].concat(this.state.assets.map(e=>({value:"asset-"+e.id,label:e.name})))}):"Unknown choice.":void 0}))}}const en=[{title:"Application ID",id:"application_id",type:"number",placeholder:"711416957718757418"},{title:"Name",id:"name",type:"text",placeholder:"Lightcord"},{title:"Details",id:"details",type:"text",placeholder:"Browsing Discord"},{title:"State",id:"state",type:"text",placeholder:"Lightcord Client"},{title:"Timestamp Start",id:"timestamps.start",type:"number",get placeholder(){return Date.now()}},{title:"LargeAsset",id:"assets.large",type:"choice"},{title:"SmallAsset",id:"assets.small",type:"choice"}];let tn,nn,sn;class rn extends Kt.PureComponent{get modules(){return tn&&tn[0]?tn:tn=[BDModules.get(e=>e.removeKeybind)[0],BDModules.get(e=>e.marginBottom20)[0],BDModules.get(e=>e.defaultMarginh5)[0],BDModules.get(e=>e.colorStandard)[0],BDModules.get(e=>e.size32)[0],BDModules.get(e=>e._horizontal)[0],BDModules.get(e=>e.inputMini)[0],BDModules.get(e=>e.size16&&e.size20)[0]]}constructor(e){super(e);let t=this.props.setting;this.state={data:this.props.manager.state.data[t.id]},this.input=Kt.createElement(window.Lightcord.Api.Components.inputs.TextInput,{placeholder:t.placeholder,name:t.id,value:this.state.data,onChange:e=>{this.setState({data:e}),!this.lastEdited||this.lastEdited<Date.now()-500?(this.props.manager.onChange(this,e),this.lastEdited=Date.now()):this.isTiming||(this.isTiming=setTimeout(()=>{this.props.manager.onChange(this,this.state.data),this.isTiming=null,this.lastEdited=Date.now()},500))},type:"text"})}render(){let e=this.props.setting,[t,n,s,r,i,o,a,l]=this.modules;return Kt.createElement("div",{className:t.row+" "+n.marginBottom20},Kt.createElement("div",{className:`${t.item} ${o.flexChild}`},Kt.createElement("h5",{className:r.colorStandard+" "+i.size14+" "+s.h5+" "+s.defaultMarginh5},e.title),this.input),Kt.createElement(bn,null))}}class on extends Kt.PureComponent{get modules(){return nn||(nn=[BDModules.get(e=>e.removeKeybind)[0],BDModules.get(e=>e.marginBottom20)[0],BDModules.get(e=>e.defaultMarginh5)[0],BDModules.get(e=>e.colorStandard)[0],BDModules.get(e=>e.size32)[0],BDModules.get(e=>e._horizontal)[0],BDModules.get(e=>e.inputMini)[0],BDModules.get(e=>e.size16&&e.size20)[0],BDModules.get(e=>e.colorTransparent)[0]])}constructor(e){super(e);let t=this.props.setting;this.state={data:this.props.manager.state.data[t.id]},this.input=Kt.createElement(window.Lightcord.Api.Components.inputs.TextInput,{placeholder:t.placeholder,name:t.id,value:this.state.data,type:"number",onChange:(e,t,n)=>{(e=e.replace(/[^\d]+/g,""))!=this.state.data?(!this.lastEdited||this.lastEdited<Date.now()-500?(this.props.manager.onChange(this,e),this.lastEdited=Date.now()):this.isTiming||(this.isTiming=setTimeout(()=>{this.props.manager.onChange(this,this.state.data),this.isTiming=null,this.lastEdited=Date.now()},500)),this.setState({data:e})):n.setValue(e)},type:"text"})}render(){let e=this.props.setting,[t,n,s,r,i,o]=this.modules;return Kt.createElement("div",{className:t.row+" "+n.marginBottom20},Kt.createElement("div",{className:`${t.item} ${o.flexChild}`},Kt.createElement("h5",{className:r.colorStandard+" "+i.size14+" "+s.h5+" "+s.defaultMarginh5},e.title),this.input,"timestamps.start"===e.id?Kt.createElement(Lightcord.Api.Components.inputs.Button,{onClick:()=>{DiscordNative.clipboard.copy(Date.now()+"")},color:"brand"},"Copy current timestamp"):null),Kt.createElement(bn,null))}}class an extends Kt.PureComponent{constructor(e){super(e);let t=this.props.setting;this.state={data:this.props.manager.state.data[t.id]?"asset-"+this.props.manager.state.data[t.id]:"none"},this.props.manager.updateWhenFetched(this)}onChange(e){!this.lastEdited||this.lastEdited<Date.now()-500?(this.props.manager.onChange(this,"none"===e?null:e.replace("asset-","")),this.lastEdited=Date.now()):this.isTiming||(this.isTiming=setTimeout(()=>{this.props.manager.onChange(this,"none"===this.state.data?null:this.state.data.replace("asset-","")),this.isTiming=null,this.lastEdited=Date.now()},500)),this.setState({data:e}),this.forceUpdate()}get modules(){return sn||(sn=[BDModules.get(e=>e.removeKeybind)[0],BDModules.get(e=>e.marginBottom20)[0],BDModules.get(e=>e.defaultMarginh5)[0],BDModules.get(e=>e.colorStandard)[0],BDModules.get(e=>e.size32)[0],BDModules.get(e=>e._horizontal)[0]])}render(){let e=this.props.setting,[t,n,s,r,i,o]=this.modules,a=this.props.manager.state.assets.map(e=>({value:"asset-"+e.id,label:e.name}));return a.unshift({value:"none",label:"No assets"}),Kt.createElement("div",{className:t.row+" "+n.marginBottom20},Kt.createElement("div",{className:`${t.item} ${o.flexChild}`},Kt.createElement("h5",{className:r.colorStandard+" "+i.size14+" "+s.h5+" "+s.defaultMarginh5},e.title),Kt.createElement(window.Lightcord.Api.Components.inputs.Dropdown,{value:this.state.data,options:a,onChange:this.onChange.bind(this)})),Kt.createElement(bn,null))}}let ln,cn,dn,hn,un,pn,mn,gn,fn=[];class bn extends Kt.PureComponent{get modules(){return fn&&fn[0]?fn:fn=[BDModules.get(e=>e.divider&&1===Object.keys(e).length)[0],BDModules.get(e=>e.dividerDefault)[0]]}render(){let[e,t]=this.modules;return Kt.createElement("div",{class:`${e.divider} ${t.dividerDefault}`})}}Kt.Component;class yn extends Kt.Component{constructor(e={}){super(e),this.state={active:"profile"},this.tabs=[],this.props.settings.preview=this}changeTab(e){this.state.active!==e.props.id&&(this.tabs.forEach(e=>{e.setActive(!1)}),e.setActive(!0),this.setState({active:e.props.id}))}render(){return Kt.createElement("div",{className:"lc-tabWrapper"},Kt.createElement("div",{className:"lc-tabnav",style:{flex:"0 1 auto"}},Kt.createElement(vn,{preview:this,title:"Full Profile",id:"profile"}),Kt.createElement(vn,{preview:this,title:"User Popout",id:"popout"})),Kt.createElement(wn,{preview:this.preview,state:this.state.rpc,props:{preview:this},key:this.state.active}))}isActive(e){return this.state.active===e}get preview(){return"profile"===this.state.active?En:Cn}}class vn extends Kt.Component{constructor(e){super(e),this.state={active:e.preview.isActive(e.id)},e.preview.tabs.push(this)}setActive(e){this.setState({active:!!e})}render(){let e="lc-navItem";return this.state.active?e+=" lc-navItemActive":e+=" lc-navItemInactive",Kt.createElement("div",{className:e,onClick:()=>{this.props.preview.changeTab(this)}},this.props.title)}}class wn extends Kt.Component{componentDidCatch(e,t){console.error(e,t),this.setState({error:!0})}render(){if(this.state||(this.state={error:!1}),this.state.error)return ln=ln||Me.WebpackModules.find(e=>e.emptyStateImage&&e.emptyState),ln?Kt.createElement("div",{style:{margin:"20px"}},Kt.createElement("div",{style:{backgroundColor:"var(--background-primary)",padding:"30px 30px",borderRadius:"8px"},className:"lc-tab-box-shadow "+ln.emptyState},Kt.createElement("div",{className:ln.emptyStateImage,style:{marginTop:"20px"}}),Kt.createElement("div",{className:ln.emptyStateHeader},"An error occured"),Kt.createElement("p",{className:ln.emptyStateSubtext},"Please check the console for more informations. Join our ­",Kt.createElement("a",{className:`${Me.anchorClasses.anchor} ${Me.anchorClasses.anchorUnderlineOnHover}`,role:"button",tabindex:0,onClick:()=>{Me.joinLC()}},"support server"),"­ for help."))):(Be.showToast("An error occured. Please check the console for more informations."),null);try{const e=new this.props.preview(this.props.props);return e.setState(this.props.state),e.render()}catch(e){return console.error(e),this.state.error=!0,this.render()}}}class Cn extends Kt.Component{get modules(){return cn||(cn=[Me.WebpackModules.find(e=>e.default&&"UserPopout"===e.default.displayName),Me.WebpackModules.find(e=>e.default&&e.default.getCurrentUser)])}getComponent(){let[e,t]=this.modules;const n=t.default.getCurrentUser();return Kt.createElement(()=>{let t=e.default({userId:n.id,guildId:null,channelId:null,disableUserProfileLink:!0});return dn=t.type,hn=t.props,this.render()},null)}render(){if(!dn)return this.getComponent();let[e,t]=this.modules;const n=t.default.getCurrentUser();let s=Object.assign({},p,this.props.preview.props.settings.state.data);const r=function(){if(!this.game)return null;return{name:this.game.name||p.name,application_id:this.game.application_id||p.application_id,details:this.game.details||void 0,state:this.game.state||void 0,timestamps:this.game["timestamps.start"]?{start:this.game["timestamps.start"]}:void 0,assets:this.game["assets.large"]?{large_image:this.game["assets.large"],small_image:this.game["assets.small"]||void 0}:void 0,type:0}}.call({game:s}),i=new dn(Object.assign({},hn,{activity:r,userId:n.id})).render().props.children,o=Kt.createElement("div",window.Lightcord.Api._.excludeProperties(i.props,["onClick","onContextMenu"]));return Kt.createElement("div",{className:"lc-userPopout lc-tab-box-shadow"},o)}}class En extends Kt.Component{get modules(){return un||(un=[Me.WebpackModules.find(e=>e.default&&"UserProfile"===e.default.displayName),Me.WebpackModules.find(e=>e.default&&e.default.getCurrentUser)])}render(){let[e,t]=this.modules;const n=t.default.getCurrentUser();if(!pn){const t=new e.default({user:n}).render();gn=t.type;const s=new t.type(t.props).render(),r=s.type.render(s.props,null),i=new r.type(r.props).render();pn=i.type}if(!pn)throw new Error("Couldn't find the UserProfileComponent component.");let s=Object.assign({},p,this.props.preview.props.settings.state.data);const r=function(){if(!this.game)return null;return{name:this.game.name||p.name,application_id:this.game.application_id||p.application_id,details:this.game.details||void 0,state:this.game.state||void 0,timestamps:this.game["timestamps.start"]?{start:this.game["timestamps.start"]}:void 0,assets:this.game["assets.large"]?{large_image:this.game["assets.large"],small_image:this.game["assets.small"]||void 0}:void 0,type:0}}.call({game:s});mn=new gn({user:n,close:()=>{}}).render().props;const i=new pn(Object.assign({},mn,{activity:r})).render().props.children;return i.props.style={width:"auto"},Kt.createElement("div",{className:"lc-tab lc-tab-box-shadow"},i)}}const Sn=Me.React;let xn=BDModules.get(e=>e.defaultMarginh5)[0],kn=BDModules.get(e=>e.colorStandard)[0],Dn=BDModules.get(e=>e.size32)[0],Mn=BDModules.get(e=>e.scrollbarGhostHairline)[0];const Bn=BDModules.get(e=>e.default&&e.default.getGuilds)[0].default,Ln=BDModules.get(e=>e.default&&e.default.getRelationships)[0].default,Nn=BDModules.get(e=>e.default&&e.default.getSessions)[0].default,An=BDModules.get(e=>e.default&&e.default.getCurrentUser)[0].default;class Pn extends Sn.Component{constructor(e){super(e)}render(){return xn||(xn=BDModules.get(e=>e.defaultMarginh5)[0]),kn||(kn=BDModules.get(e=>e.colorStandard)[0]),Dn||(Dn=BDModules.get(e=>e.size32)[0]),[Sn.createElement(Te,{text:"Account Infos"}),Sn.createElement("div",null,Sn.createElement("h5",{className:kn.colorStandard+" "+Dn.size14+" "+xn.h5+" "+xn.defaultMarginh5},"Profile"),Sn.createElement(_n,{content:this.getProfileValue(),language:"diff"}),Sn.createElement("h5",{className:kn.colorStandard+" "+Dn.size14+" "+xn.h5+" "+xn.defaultMarginh5},"Statistics"),Sn.createElement(_n,{content:this.getStatistics(),language:"diff"}),Sn.createElement("h5",{className:kn.colorStandard+" "+Dn.size14+" "+xn.h5+" "+xn.defaultMarginh5},"Connected Sessions"),Sn.createElement(_n,{content:this.getSessionValue(),language:"diff"})),Sn.createElement("div",{className:BDModules.get(e=>e.marginBottom20)[0].marginBottom20})]}getSessionValue(){const e=Nn.getSessions(),t=Object.keys(e).filter(e=>"all"!==e).map(t=>e[t]);return 0===t.length?"- No session detected. Please try in a few seconds":t.map(e=>`+ id: ${e.sessionId}\n+ os: ${e.clientInfo.os[0].toUpperCase()+e.clientInfo.os.slice(1)}\n+ client: ${e.clientInfo.client}\n+ status: ${e.status}\n+ Activities: ${e.activities.length}`).join("\n"+"-".repeat(38)+"\n")}getProfileValue(){const e=An.getCurrentUser(),t=e.createdAt;let n=e.avatarURL;return e.avatar&&e.avatar.startsWith("a_")&&(n=e.getAvatarURL("gif")),n.startsWith("/")&&(n="https://discord.com"+n),n.endsWith("?size=128")&&(n=n.replace("?size=128","?size=4096")),`+ Username: ${e.username}\n+ Discriminator: ${e.discriminator}\n+ Tag: ${e.tag}\n+ ID: ${e.id}\n+ Avatar: ${e.avatar}\n+ Avatar URL: ${n}\n+ Creation Date: ${t.getDate().toString().padStart(2,"0")}/${(t.getMonth()+1).toString().padStart(2,"0")}/${t.getFullYear().toString().padStart(2,"0")} ${t.getHours().toString().padStart(2,"0")}h ${t.getMinutes().toString().padStart(2,"0")}min ${t.getSeconds()}s\n+ Flags: ${e.flags}\n+ Has Nitro: ${e.hasPremiumSubscription?"Yes":"No"}\n- Email: ${e.email}\n- 2FA: ${e.mfaEnabled?"Yes":"No"}\n- Has Been On Mobile: ${e.mobile?"Yes":"No"}\n- Phone: ${e.phone||"None"}\n- Verified: ${e.verified}\n- Can See NSFW Channels: ${e.nsfwAllowed}`}getStatistics(){const e=Object.values(Bn.getGuilds()),t=Object.keys(Ln.getRelationships()),n=t.filter(e=>Ln.isFriend(e)),s=t.filter(e=>Ln.isBlocked(e));return`+ Server Count: ${e.length} servers\n+ Relations: ${t.length} relations\n+ Friends Count: ${n.length} friends\n- Blocked Users Count: ${s.length} blocked users`}}let Tn=BDModules.get(e=>e.highlight)[0],Rn=BDModules.get(e=>e.markup)[0],On=BDModules.get(e=>e.messageContent)[0];class _n extends Sn.Component{render(){return Rn||(Rn=BDModules.get(e=>e.markup)[0]),On||(On=BDModules.get(e=>e.messageContent)[0]),Mn||(Mn=BDModules.get(e=>e.scrollbarGhostHairline)[0]),Tn||(Tn=BDModules.get(e=>e.listLanguages)[0]),Sn.createElement("div",{class:`${Rn.markup} ${On.messageContent}`},Sn.createElement("pre",null,Sn.createElement("code",{class:Mn.scrollbarGhostHairline+" hljs",dangerouslySetInnerHTML:{__html:Tn.highlight(this.props.language,this.props.content).value}})),Sn.createElement("div",{className:BDModules.get(e=>e.marginBottom8)[0].marginBottom8}))}}const jn=window.Lightcord.DiscordModules.dispatcher,In=BDModules.get(e=>e.default&&e.default.getChannel&&e.default.hasChannel)[0].default;let $n=BDModules.get(e=>e.default&&e.default.addRelationship)[0],Wn=BDModules.get(e=>e.default&&e.default.closePrivateChannel)[0];const Fn={};let Hn=BDModules.get(e=>e.default&&e.default.getCurrentUser)[0];var Un=new class{constructor(){this.antiDM=this.antiDM.bind(this),this.enabled=!1}enable(){this.enabled||(this.enabled=!0,jn.subscribe("MESSAGE_CREATE",this.antiDM))}disable(){this.enabled&&(this.enabled=!1,jn.unsubscribe("MESSAGE_CREATE",this.antiDM))}antiDM(e){if(!e.message.author.bot)return;if(e.message.author.id===(Hn?Hn.default.getCurrentUser():null).id&&e.message.guild_id)return;const t=In.getChannel(e.message.channel_id);var n;t&&(1===t.type&&(Fn[e.message.author.id]||(n=e.message,(/(discord\.gg|discord\.com\/invite\/|discordapp\.com\/invite\/)/g.test(n.content)||zn(n,"discord.gg/")||zn(n,"discord.com/invite/")||zn(n,"discordapp.com/invite/"))&&(Fn[e.message.author.id]=!0,Be.showToast(`[AdBlock]: Blocked ${e.message.author.username}#${e.message.author.discriminator}`,{type:"warning"}),$n||($n=BDModules.get(e=>e.default&&e.default.addRelationship)[0]),$n.default.addRelationship(e.message.author.id,{location:"ContextMenu"},2),Wn||(Wn=BDModules.get(e=>e.default&&e.default.closePrivateChannel)[0]),Wn.default.closePrivateChannel(t.id,!1)))))}};function zn(e,t){let n=e.embeds||[];return 0!==n.length&&n.map(e=>"rich"===e.type&&(!!(e.title||"").includes(t)||(!!(e.description||"").includes(t)||(!!((e.footer?e.footer.text:"")||"").includes(t)||!!(e.fields||[]).map(e=>e.value.includes(t)||e.name.includes(t)).includes(!0))))).includes(!0)}let Gn;const qn=Be.removeDa;var Vn=new class{constructor(){this.enabled=!1}enable(){this.enabled||(this.enabled=!0,Gn=Gn||function(){let e=BDModules.get(e=>e.standardSidebarView)[0];if(!e)return null;let t=qn(e.standardSidebarView),n=[],s=BDModules.get(e=>e.userSettingsAccount)[0];const r=BDModules.get(e=>"string"==typeof e.children)[0];return n.push(`#app-mount .${t} .payment-info .${qn(BDModules.get(e=>e.description&&"string"==typeof e.description&&e.description.includes("formText"))[0].description)}`),n.push(`#app-mount .${t} .${qn(BDModules.get(e=>e.paymentSourceRow)[0].paymentSourceRow)} .${qn(BDModules.get(e=>e.subText&&e.descriptionWrapper)[0].subText)}`),s&&(n.push(`#app-mount .${t} .${qn(s.userSettingsAccount)} div:nth-child(2)>div:nth-child(2)>.${qn(BDModules.get(e=>e.viewBody)[0].viewBody)}`),n.push(`.${qn(s.userSettingsSecurity)} .${qn(r.children)} > div:nth-child(2)`)),n}(),Gn||console.error(new Error("Couldn't find selectors to blur personnal informations.")),xe.addStyle("blurPrivate",`\n${Gn.join(", ")} {\n transition: all 150ms cubic-bezier(.55,.085,.68,.53);\n filter: blur(4px);\n opacity: .8;\n}\n\n${Gn.map(e=>e+":hover").join(", ")} {\n transition: all 150ms cubic-bezier(.55,.09,.68,.53);\n filter: none;\n opacity: 1;\n}`))}disable(){this.enabled&&(this.enabled=!1,xe.removeStyle("blurPrivate"))}},Jn=new class{constructor(){window.Lightcord.Api.ensureExported(e=>e.default&&e.default.startTyping).then(e=>{let t=this;const n=e.default.startTyping;e.default.startTyping=function(){if(t.disabled)return n.call(this,...arguments)};const s=e.default.stopTyping;e.default.stopTyping=function(){if(t.disabled)return s.call(this,...arguments)},this.disabled=!0}),window.Lightcord.BetterDiscord.DisableTyping=this}disable(){this.disabled=!0}enable(){this.disabled=!1}};let Yn;class Zn extends React.PureComponent{constructor(){super(...arguments),this.state={states:[]}}render(){Yn||(Yn=D.find(e=>e.FormSection));const e=[...new Set(Object.keys(window.Lightcord.Api.Components).map(e=>Object.keys(window.Lightcord.Api.Components[e]).map(t=>window.Lightcord.Api.Components[e][t])).flat())];return[React.createElement(Yn.FormSection,{tag:"h2",title:"Lightcord's Api Availlable components"},React.createElement(Yn.FormText,{type:"description",className:"",selectable:!1},"These components are here for the plugin devs. They can quickly embed any component below with this panel.",React.createElement("div",{style:{marginTop:"20px"}}),React.createElement(Lightcord.Api.Components.general.AlertBox,{type:"info"},"All these components have error handling. If you want none, add `.original` after the component path."),React.createElement(Lightcord.Api.Components.general.AlertBox,{type:"warn"},"We do not recommend modifying these component with plugins. Only do this if you know what you are doing.")),React.createElement(gt,null),React.createElement(Lightcord.Api.Components.inputs.Button,{color:"brand",look:"outlined",size:"medium",hoverColor:"green",onClick:()=>{I.remote.shell.openExternal("https://lightcord.org/LightcordApi/")},wrapper:!1},"Documentation")),e.map(e=>{const t=e.displayName||e.name,n=`Lightcord.Api.Components.${Object.keys(window.Lightcord.Api.Components).find(e=>window.Lightcord.Api.Components[e][t])}.${t}`;return React.createElement(Kn,{key:n,comp:e})})]}get renders(){}}class Kn extends React.Component{constructor(e){super(e),this.state={tab:"preview",elem:e.comp,options:{}}}render(){const e=this.props.comp;let t=[];e.AllPreviews&&(t=e.AllPreviews);let n=this.state,s=()=>{let e={};return t.forEach(t=>{e[Object.keys(t[0])[0]]=t[0][Object.keys(t[0])[0]]}),Object.keys(n.options).forEach(s=>{e[s]=t.find(e=>e.find(e=>e[s]))[n.options[s]][s]}),e},r=(e,t,n)=>{if("string"==typeof e)return e;if("boolean"==typeof e)return String(e);if("function"==typeof e)return e.toString();if("object"==typeof e){if(e&&e.$$typeof&&(e.$$typeof===Symbol.for("react.element")||60103===e.$$typeof)){if("Lightcord.Api.Components.general.Tabs"===t){if("react"===n)return'React.createElement("div", {style: {\nmarginTop: "20px", marginBottom: "20px"\n}},\nReact.createElement("div", {style: {\nbackgroundColor: "var(--background-secondary)",\npadding: "30px 30px",\nborderRadius: "8px"\n}, className: "lc-tab-box-shadow" },\nReact.createElement(Lightcord.Api.Components.general.Title, null, "Preview tabs")\n)\n)';if("jsx"===n)return'<div style={{\nmarginTop: "20px", marginBottom: "20px"\n}}>\n<div style={{\n backgroundColor: "var(--background-secondary)", \n padding: "30px 30px", \n borderRadius: "8px"\n}} className="lc-tab-box-shadow">\n <Lightcord.Api.Components.general.Title>Preview tabs</Lightcord.Api.Components.general.Title>\n</div>\n</div>'}return"Your components here."}return JSON.stringify(e,null," ")}return String(e)},i=function(t){const n=e.displayName||e.name;const i=`Lightcord.Api.Components.${Object.keys(window.Lightcord.Api.Components).find(e=>window.Lightcord.Api.Components[e][n])}.${n}`,o=s();if("jsx"===t){let e,n=[],s=null;if(Object.keys(o).forEach(e=>{if("children"==e)s=r(o[e],i,t);else{let s=e+"=";"string"==typeof o[e]?s+=JSON.stringify(o[e]):s+=`{${r(o[e],i,t)}}`,n.push(s)}}),s){return e=`<${i} ${n.join(" ")}>`,`${e}\n ${s}\n${`</${i}>`}`}return e=`<${i} ${n.join(" ")}/>`,e}if("react"===t){let e=o.children||null;delete o.children,e&&e.$$typeof&&(e.$$typeof===Symbol.for("react.element")||60103===e.$$typeof)&&(e=r(e,i,t));let n=[];Object.keys(o).forEach(e=>{let s=(/[^\w\d_]/g.test(e)?JSON.stringify(e):e)+": ";"string"==typeof o[e]?s+=JSON.stringify(o[e]):s+=r(o[e],i,t).split("\n").map((e,t)=>0===t?e:" "+e).join("\n"),n.push(s)});let s="{";n.length?n.forEach((e,t)=>{let r=t===n.length-1;0===t||(s+=","),s+="\n ",s+=e,r&&(s+="\n}")}):s+="}";let a="string"==typeof e&&e.startsWith("React.createElement")?e:JSON.stringify(e);return`React.createElement(${i}, ${s}, ${a})`}},o=e.help||{},a=o.info?React.createElement(window.Lightcord.Api.Components.general.AlertBox,{type:"info"},o.info):null,l=o.warn?React.createElement(window.Lightcord.Api.Components.general.AlertBox,{type:"warn"},o.warn):null,c=o.danger?React.createElement(window.Lightcord.Api.Components.general.AlertBox,{type:"danger"},o.danger):null,d=o.error?React.createElement(window.Lightcord.Api.Components.general.AlertBox,{type:"error"},o.error):null,h=o.success?React.createElement(window.Lightcord.Api.Components.general.AlertBox,{type:"success"},o.success):null;return React.createElement("div",null,React.createElement(window.Lightcord.Api.Components.general.SettingsTitle,null,e.displayName||e.name),a,h,l,d,c,t.map(e=>{if(e[0].onClick)return null;if(e[0].text)return null;if(e[0].children)return null;if(1===e.length)return null;let t=Object.keys(e[0])[0];return[React.createElement(window.Lightcord.Api.Components.general.SettingSubTitle,null,t),React.createElement(window.Lightcord.Api.Components.inputs.Dropdown,{options:e.map((e,t)=>({value:"opt-"+t,label:JSON.stringify(e[Object.keys(e)[0]])})),value:"opt-"+(n.options[t]||"0"),onChange:e=>{this.setState({options:Object.assign({},n.options,{[t]:(e.value||"0").replace("opt-","")})})},searchable:!0}),React.createElement("div",{style:{marginBottom:"8px"}})]}),React.createElement(window.Lightcord.Api.Components.general.Tabs,{tabs:[{label:"Preview",id:"preview"},{label:"Code",id:"code"}],active:n.tab,children:"preview"===n.tab?React.createElement("div",{style:{margin:"20px"}},React.createElement("div",{style:{backgroundColor:"var(--background-secondary)",padding:"30px 30px",borderRadius:"8px"},className:"lc-tab-box-shadow"},React.createElement(e,s()))):React.createElement("div",{style:{margin:"20px"}},React.createElement("div",{style:{backgroundColor:"var(--background-secondary)",padding:"30px 30px",borderRadius:"8px"},className:"lc-tab-box-shadow"},React.createElement(window.Lightcord.Api.Components.general.SettingSubTitle,null,"JSX"),React.createElement(window.Lightcord.Api.Components.general.ErrorCatcher,null,React.createElement(()=>React.createElement(window.Lightcord.Api.Components.general.CodeBlock,{language:"jsx",content:i("jsx")}))),React.createElement(window.Lightcord.Api.Components.general.SettingSubTitle,null,"React"),React.createElement(window.Lightcord.Api.Components.general.ErrorCatcher,null,React.createElement(()=>React.createElement(window.Lightcord.Api.Components.general.CodeBlock,{language:"js",content:i("react")}))))),onChange:e=>{this.setState({tab:e})}}))}}const Xn=Me.React;class Qn extends Xn.Component{render(){const e=this.props.size||"18px";return Xn.createElement("svg",{viewBox:"0 0 24 24",fill:"var(--text-normal)",className:this.props.className||"",style:{width:e,height:e},onClick:this.props.onClick},Xn.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),Xn.createElement("path",{d:"M13 3c-4.97 0-9 4.03-9 9H1l3.89 3.89.07.14L9 12H6c0-3.87 3.13-7 7-7s7 3.13 7 7-3.13 7-7 7c-1.93 0-3.68-.79-4.94-2.06l-1.42 1.42C8.27 19.99 10.51 21 13 21c4.97 0 9-4.03 9-9s-4.03-9-9-9zm-1 5v5l4.28 2.54.72-1.21-3.5-2.08V8H12z"}))}}var es=new class{constructor(){this.windows=new Map,this.enabled=!1,this.init()}async init(){let e=await window.Lightcord.Api.ensureExported(e=>e.default&&e.default.getWindow);window.Lightcord.DiscordModules.dispatcher.subscribe("POPOUT_WINDOW_OPEN",t=>{setImmediate(()=>{const n=e.default.getWindow(t.key);this.windows.set(t.key,n);let s=n.document.body.classList;s.add("window-popout"),s.add("lightcord"),s.add("lightcord"),this.update(t.key)})}),window.Lightcord.DiscordModules.dispatcher.subscribe("POPOUT_WINDOW_CLOSE",e=>{setImmediate(()=>{this.windows.delete(e.key)})}),T.on("theme-enabled",()=>{this.update()}),T.on("theme-disabled",()=>{this.update()}),T.on("theme-reloaded",()=>{this.update()}),T.on("theme-unloaded",()=>{this.update()}),T.on("theme-loaded",()=>{this.update()})}enable(){this.enabled=!0,this.update()}disable(){this.enabled=!1,this.update()}update(e){if(this.windows.size)return this.enabled?this.applyThemes(e):this.removeThemes(e)}removeThemes(e){if(!this.enabled)if(e){let t=this.windows.get(e);if(!t)return;let n=t.document;for(let e of n.querySelectorAll("style[data-lightcord-theme=true]"))e.remove()}else for(let e of this.windows.keys())this.removeThemes(e)}applyThemes(e){if(this.enabled)if(e){let t=this.windows.get(e);if(!t)return;let n=t.document;for(let e of n.querySelectorAll("style[data-lightcord-theme=true]"))e.setAttribute("will-remove","true");Object.keys(bdthemes).forEach(e=>{if(!E[e])return;const t=bdthemes[e];if(!t)return;let s=n.querySelector("style[data-lightcord-theme=true]#"+xe.escapeID(t.id));if(s)s.innerHTML=unescape(t.css),s.removeAttribute("will-remove");else{const e=n.createElement("style");e.id=xe.escapeID(t.id),e.innerHTML=unescape(t.css),e.setAttribute("data-lightcord-theme","true"),n.head.append(e)}});for(let e of n.querySelectorAll("style[will-remove=true]"))e.remove()}else for(let e of this.windows.keys())this.applyThemes(e)}};const ts=Me.React;class ns extends ts.Component{constructor(e){super(e),this.state={value:this.props.value},this.onChange=this.onChange.bind(this),this.emitChange=this.emitChange.bind(this),this.input=ts.createElement(Lightcord.Api.Components.inputs.TextInput.original,{ref:console.log,onChange:this.onChange,value:this.state.value,placeholder:this.props.placeholder,onBlur:this.emitChange})}onChange(e){console.log(e,this.props),this.props.disabled||(this.props.onChange(e),this.setState({value:e}))}emitChange(){console.log("Should emit changes.")}render(){return this.input}}let ss=[];function rs(e){let t=ss.find(t=>t.startsWith(e+"-"));return t||(t=BDModules.get(t=>t[e])[0][e],ss.push(t),t)}class is extends Me.reactComponent{constructor(e){super(e),this.onChange=this.onChange.bind(this)}onChange(e){this.props.onChange(this.props.id,e)}render(){let{text:e,info:t}=this.props.data;return this.props.data.experimental&&(ss.find(e=>e.startsWith("beta-"))||ss.push(BDModules.get(e=>e.beta&&!e.container&&!e.userSettingsVoice)[0].beta),t=[t,React.createElement("sup",{className:rs("beta")},"(EXPERIMENTAL)")]),React.createElement("div",{className:"ui-flex flex-vertical flex-justify-start flex-align-stretch flex-nowrap ui-switch-item"},React.createElement("div",{className:"ui-flex flex-horizontal flex-justify-start flex-align-stretch flex-nowrap"},React.createElement("h3",{key:"title",className:"ui-form-title h3 margin-reset margin-reset ui-flex-child"},e),React.createElement(ns,{key:"input",onChange:this.onChange,value:this.props.value,placeholder:this.props.placeholder||null})),React.createElement("div",{className:"ui-form-text style-description margin-top-4",style:{flex:"1 1 auto"}},t))}}class os extends React.PureComponent{render(){let e=D.find(e=>e.Separator&&e.Header&&e.Item);const t=React.createElement(J,{color:"black",side:"top",text:"Changelog"},React.createElement("span",{style:{float:"right",cursor:"pointer"},className:"bd-changelog-button",onClick:()=>{Be.showChangelogModal(bbdChangelog)}},React.createElement(Qn,{className:"bd-icon",size:"16px"})));return new e.Header({children:React.createElement("span",null,"Bandaged BD",t),className:"ui-tab-bar-header"})}}let as=!1;var ls=new class{constructor(){this.onChange=this.onChange.bind(this),this.updateSettings=this.updateSettings.bind(this),this.sidebar=new Ne,this.registerComponents()}registerComponents(){this.sidebar.register("lightcord",cs(this.lightcordComponent.bind(this))),this.sidebar.register("status",cs(this.PresenceComponent.bind(this))),this.sidebar.register("accountinfo",cs(this.AccountInfosComponent.bind(this))),this.sidebar.register("lcapipreview",cs(this.ApiPreviewComponent.bind(this))),this.sidebar.register("BDChangelogTitle",cs(()=>(new os).render())),this.sidebar.register("core",cs(this.coreComponent.bind(this))),this.sidebar.register("customcss",cs(this.customCssComponent.bind(this))),this.sidebar.register("plugins",cs(this.renderAddonPane("plugins"))),this.sidebar.register("themes",cs(this.renderAddonPane("themes")))}get coreSettings(){const e=this.getSettings("core");return[...new Set(e.map(e=>e.category))].map(t=>({title:t,settings:e.filter(e=>e.category==t)}))}get lightcordSettings(){const e=this.getSettings("lightcord");return[...new Set(e.map(e=>e.category))].map(t=>({title:t,settings:e.filter(e=>e.category==t)}))}get PresenceSettings(){return this.getSettings("status")}getSettings(e){return Object.keys(c).reduce((t,n)=>{const s=c[n];return s.cat===e&&s.implemented&&!s.hidden&&(s.text=n,t.push(s)),t},[])}onChange(e,t,n){this.updateSettings(e,t,n)}updateSettings(e,t,n){if(["lightcord-8","no_window_bound","enable_glasstron","lightcord-10","lightcord-11"].includes(e)||(h[e]=t),"bda-gs-2"==e&&(t?xe.addClass(document.body,"bd-minimal"):xe.removeClass(document.body,"bd-minimal")),"bda-gs-3"==e&&(t?xe.addClass(document.body,"bd-minimal-chan"):xe.removeClass(document.body,"bd-minimal-chan")),"bda-gs-1"==e&&(t?tt.addButton():tt.removeButton()),"bda-gs-4"==e&&(t?nt.start():nt.stop()),"bda-gs-5"==e&&(t?xe.addClass(xe.query("#app-mount"),"bda-dark"):xe.removeClass(xe.query("#app-mount"),"bda-dark")),t&&"bda-gs-6"==e&&Pe.inject24Hour(),"bda-gs-7"==e&&(t?Ae.injectColoredText():Ae.removeColoredText()),"fork-ps-4"==e&&(t?rt.start():rt.stop()),"fork-ps-5"==e&&(t?(Se.watchContent("plugin"),Se.watchContent("theme")):(Se.unwatchContent("plugin"),Se.unwatchContent("theme"))),"fork-wp-1"==e&&(Be.setWindowPreference("transparent",t),t?Be.setWindowPreference("backgroundColor",null):Be.setWindowPreference("backgroundColor","#2f3136")),"bda-gs-8"==e&&(t?it.startDebugListener():it.stopDebugListener()),"fork-dm-1"==e&&(t?it.startCopySelector():it.stopCopySelector()),"lightcord-1"===e&&(window.Lightcord.Settings.devMode=!!t,n.forceUpdate()),"lightcord-2"===e&&(window.Lightcord.Settings.callRingingBeat=!!t),"lightcord-presence-1"===e)if(t){Zt.enable();const e=BDModules.get(e=>e.default&&"object"==typeof e.default&&"showCurrentGame"in e.default)[0];e&&!e.default.showCurrentGame&&BDModules.get(e=>e.default&&e.default.updateRemoteSettings)[0].default.updateRemoteSettings({showCurrentGame:!0})}else Zt.disable();if("lightcord-3"===e&&I.ipcRenderer.sendSync("LIGHTCORD_SET_ALWAYS_ON_TOP",t),"lightcord-4"===e&&(t?Un.enable():Un.disable()),"lightcord-6"===e&&(t?Vn.enable():Vn.disable()),"lightcord-7"===e&&(t?Jn.enable():Jn.disable()),"lightcord-8"===e){let e=window.Lightcord.Api.settings;e.set("isTabs",t),e.save(),DiscordNative.app.relaunch()}if("lightcord-9"===e&&es[t?"enable":"disable"](),"lightcord-10"!==e){if("no_window_bound"===e){let e=window.Lightcord.Api.settings;e.set("NO_WINDOWS_BOUND",t),e.delete("IS_MAXIMIZED"),e.delete("IS_MINIMIZED"),e.delete("WINDOW_BOUNDS"),e.save(),DiscordNative.app.relaunch()}if("enable_glasstron"===e){let e=window.Lightcord.Api.settings;e.set("GLASSTRON",t),e.save(),DiscordNative.app.relaunch()}if("lightcord-11"===e){let n=window.Lightcord.Api.settings;return t?(n.set("BD_"+e,t),void n.save()):(n.delete("BD_"+e),void n.save())}this.saveSettings()}else js.methods.NotificationsUseShim(t)}async initializeSettings(){h["bda-gs-2"]&&xe.addClass(document.body,"bd-minimal"),h["bda-gs-3"]&&xe.addClass(document.body,"bd-minimal-chan"),h["bda-gs-1"]&&tt.addButton(),h["bda-gs-4"]&&nt.start(),h["bda-gs-5"]&&xe.addClass(xe.query("#app-mount"),"bda-dark"),h["bda-gs-6"]&&Pe.inject24Hour(),h["bda-gs-7"]&&Ae.injectColoredText(),h["fork-ps-4"]&&rt.start(),h["lightcord-1"]&&(window.Lightcord.Settings.devMode=!0),h["lightcord-2"]&&(window.Lightcord.Settings.callRingingBeat=!0),h["lightcord-presence-1"]&&Zt.enable(),h["lightcord-3"]&&I.ipcRenderer.sendSync("LIGHTCORD_SET_ALWAYS_ON_TOP",!0),h["lightcord-4"]&&Un.enable(),h["lightcord-6"]&&Vn.enable(),h["lightcord-7"]&&Jn.enable(),h["lightcord-9"]&&es.enable(),h["fork-ps-5"]&&(Se.watchContent("plugin"),Se.watchContent("theme")),h["bda-gs-8"]&&it.startDebugListener(),h["fork-dm-1"]&&it.startCopySelector(),this.saveSettings()}saveSettings(){A.setSettingGroup("settings",h),A.setSettingGroup("rpc",u)}loadSettings(){Object.assign(h,A.getSettingGroup("settings")),Object.assign(u,A.getSettingGroup("rpc"))}renderSidebar(e){return this.sidebar.render(e)}coreComponent(){return Me.react.createElement(bt,{key:"cspanel",onChange:this.onChange,sections:this.coreSettings})}lightcordComponent(e,t){let n=window.Lightcord.Api.settings;return[this.lightcordSettings.map((t,s)=>[0===s?null:Me.react.createElement(gt),Me.react.createElement("h2",{className:"ui-form-title h2 margin-reset margin-bottom-20"},t.title),t.settings.map(t=>{let s,r=h[t.id],i=n.get("BD_"+t.id,t.default||"");if("lightcord-8"===t.id&&(r=n.get("isTabs",!1)),"no_window_bound"===t.id&&(r=n.get("NO_WINDOWS_BOUND",!1)),"enable_glasstron"===t.id&&(r=n.get("GLASSTRON",!0)),"lightcord-10"===t.id&&(r=!n.get("DEFAULT_NOTIFICATIONS",!0)),s=["lightcord-11"].includes(t.id)?Me.react.createElement(is,{id:t.id,key:t.id,data:t,value:i,placeholder:t.default||null,onChange:(t,n)=>{this.onChange(t,n,e)}}):Me.react.createElement(dt,{id:t.id,key:t.id,data:t,checked:r,onChange:(t,n)=>{this.onChange(t,n,e)}}),"lightcord-8"==t.id&&r)return[s,React.createElement(Lightcord.Api.Components.inputs.Button,{color:"green",look:"outlined",size:"small",hoverColor:"brand",onClick:()=>{DiscordNative.ipc.send("NEW_TAB")},wrapper:!1,disabled:!1},"Open a new Tab")];if("enable_glasstron"===t.id&&r&&"linux"!==process.platform){let e=[],t=null;return"win32"===process.platform?(e.push("blurbehind","acrylic","transparent"),t=n.get("GLASSTRON_BLUR","blurbehind")):"darwin"===process.platform&&(e.push("titlebar","selection","menu","popover","sidebar","header","sheet","window","hud","fullscreen-ui","tooltip","content","under-window","under-page","none"),t=n.get("GLASSTRON_VIBRANCY","fullscreen-ui")),[s,React.createElement(Lightcord.Api.Components.general.SettingSubTitle,{},"Glasstron Blur"),React.createElement(Lightcord.Api.Components.inputs.Dropdown,{options:e.map(e=>({value:e,label:e})),value:t,disabled:!1,searchable:!0,clearable:!1,onChange:e=>{"win32"===process.platform?I.ipcRenderer.invoke("LIGHTCORD_SET_BLUR_TYPE",e):I.ipcRenderer.invoke("LIGHTCORD_SET_VIBRANCY",e)}},null)]}return s})]),Me.react.createElement(window.Lightcord.Api.Components.inputs.Button,{color:"yellow",look:"ghost",size:"medium",hoverColor:"red",onClick(){I.ipcRenderer.sendSync("LIGHTCORD_RELAUNCH_APP",{args:I.remote.process.argv.slice(1).concat(["--disable-betterdiscord"])})},wrapper:!0},"Relaunch without BetterDiscord"),React.createElement(Lightcord.Api.Components.inputs.Button,{color:"yellow",look:"ghost",size:"medium",hoverColor:"red",onClick:()=>{as||(as=!0,Be.showToast("Clearing cache...",{type:"info"}),t(),I.remote.getCurrentWebContents().session.clearCache().then(()=>{Be.showToast("Cache is cleared !",{type:"success"}),as=!1,t()}).catch(e=>{console.error(e),Be.showToast("An error occured. Check console for more informations.",{type:"error"}),as=!1,t()}))},wrapper:!0,disabled:as},"Clear cache")]}PresenceComponent(){return Me.react.createElement(Qt,{key:"lppannel",onChange:this.onChange,settings:this.PresenceSettings})}AccountInfosComponent(){return Me.react.createElement(Pn,{key:"lapannel"})}ApiPreviewComponent(){return Me.react.createElement(Zn,{key:"lapipannel"})}customCssComponent(){return Me.react.createElement(wt,{key:"csseditor"})}renderAddonPane(e){class t extends Me.react.Component{constructor(e){super(e),this.prefix=this.props.type.replace("s","")}onChange(){this.props.onChange(this.props.type)}render(){return this.props.children}}const n=t.prototype.render;return Object.defineProperty(t.prototype,"render",{enumerable:!1,configurable:!1,set:function(){console.warn("Addon policy for plugins #5 https://github.com/rauenzi/BetterDiscordApp/wiki/Addon-Policies#plugins")},get:()=>n}),function(){return Me.react.createElement(t,{type:e},Me.react.createElement(Gt,{type:e}))}}};function cs(e){class t extends React.Component{render(){return e(n,()=>this.forceUpdate())}}let n;return e=>(n=e,t)}class ds extends Me.reactComponent{render(){return Me.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"},Me.react.createElement("metadata",null),Me.react.createElement("defs",null,Me.react.createElement("filter",{id:"shadow1"},Me.react.createElement("feDropShadow",{dx:"20",dy:"0",stdDeviation:"20","flood-color":"rgba(0,0,0,0.35)"})),Me.react.createElement("filter",{id:"shadow2"},Me.react.createElement("feDropShadow",{dx:"15",dy:"0",stdDeviation:"20","flood-color":"rgba(255,255,255,0.15)"})),Me.react.createElement("filter",{id:"shadow3"},Me.react.createElement("feDropShadow",{dx:"10",dy:"0",stdDeviation:"20","flood-color":"rgba(0,0,0,0.35)"}))),Me.react.createElement("g",null,Me.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"}),Me.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"}),Me.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"})))}}function hs(){return(hs=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e}).apply(this,arguments)}class us extends React.Component{render(){const e=this.props;return React.createElement("svg",hs({viewBox:"0 0 168 168.69"},e,{height:"100%",width:e.size}),React.createElement("defs",null,React.createElement("linearGradient",{id:"prefix__a",x1:66.7,y1:-487.7,x2:66.7,y2:-508.73,gradientTransform:"matrix(1 0 0 -1 0 -408)",gradientUnits:"userSpaceOnUse"},React.createElement("stop",{offset:0,stopColor:"#e30613"}),React.createElement("stop",{offset:1,stopColor:"#731a14"})),React.createElement("linearGradient",{id:"prefix__b",x1:101.7,y1:-487.7,x2:101.7,y2:-508.73,gradientTransform:"matrix(1 0 0 -1 0 -408)",gradientUnits:"userSpaceOnUse"},React.createElement("stop",{offset:0,stopColor:"#e20613"}),React.createElement("stop",{offset:1,stopColor:"#731a13"})),React.createElement("linearGradient",{id:"prefix__c",x1:84,y1:-408,x2:84,y2:-576.69,gradientTransform:"matrix(1 0 0 -1 0 -408)",gradientUnits:"userSpaceOnUse"},React.createElement("stop",{offset:0,stopColor:"#e30613"}),React.createElement("stop",{offset:1,stopColor:"#731a13"}))),React.createElement("path",{fill:"#fff",d:"M14.9 35.3h139.2V133H14.9z"}),React.createElement("path",{d:"M66.7 79.7c-5.4 0-9.8 4.7-9.8 10.5s4.4 10.5 9.8 10.5 9.8-4.7 9.8-10.5-4.4-10.5-9.8-10.5z",fill:"url(#prefix__a)"}),React.createElement("path",{d:"M101.7 79.7c-5.4 0-9.8 4.7-9.8 10.5s4.4 10.5 9.8 10.5 9.8-4.7 9.8-10.5-4.4-10.5-9.8-10.5z",fill:"url(#prefix__b)"}),React.createElement("path",{d:"M0 0v168l168 .69V0zm111.3 124.1s-3.4-4.1-6.3-7.7c12.6-3.5 17.4-11.3 17.4-11.3a52.52 52.52 0 01-11.1 5.6 68.63 68.63 0 01-38.9 4 70.12 70.12 0 01-14.1-4.1 48.88 48.88 0 01-7.1-3.3c-.3-.2-.6-.3-.9-.5a.76.76 0 00-.4-.2c-1.7-1-2.6-1.6-2.6-1.6s4.6 7.6 16.8 11.2c-2.9 3.6-6.4 7.9-6.4 7.9-21.2-.6-29.3-14.5-29.3-14.5 0-30.6 13.8-55.4 13.8-55.4 13.8-10.3 26.9-10 26.9-10l1 1.1C52.8 50.3 45 57.9 45 57.9a56.2 56.2 0 015.7-2.7 72.19 72.19 0 0121.8-6 8.75 8.75 0 011.6-.2 89.1 89.1 0 0119.4-.2 78.45 78.45 0 0128.9 9.1s-7.5-7.2-23.9-12.1l1.3-1.5s13.1-.3 26.9 10c0 0 13.8 24.8 13.8 55.4.1-.1-8 13.8-29.2 14.4z",fill:"url(#prefix__c)"}))}}const ps={EmojiRegex:/<a?\.(\w+)\.(\d+)>/g};let ms=BDModules.get(e=>e.CustomEmoji)[0],gs=BDModules.get(e=>e.default&&e.default.getCustomEmojiById)[0],fs=BDModules.get(e=>e.default&&"Autocomplete"===e.default.displayName)[0],bs=BDModules.get(e=>e.getAutocompleteOptions)[0],ys=BDModules.get(e=>e.default&&e.default.queryEmojiResults)[0],vs=BDModules.get(e=>e.default&&e.default.Messages&&e.default.Messages.EMOJI_MATCHING)[0],ws=BDModules.get(e=>e.default&&e.default.getGuild&&e.default.getGuilds&&!e.default.isFetching)[0],Cs=BDModules.get(e=>e.default&&e.default.getDisambiguatedEmojiContext);const Es=Lightcord.Api.settings;var Ss=new class{constructor(){this.init().catch(e=>Be.err("EmojiModule","An error occured",e))}async init(){fs||(fs=await window.Lightcord.Api.ensureExported(e=>e.default&&"Autocomplete"===e.default.displayName)),bs||(bs=await window.Lightcord.Api.ensureExported(e=>e.getAutocompleteOptions)),ys||(ys=await window.Lightcord.Api.ensureExported(e=>e.default&&e.default.queryEmojiResults)),vs||(vs=await window.Lightcord.Api.ensureExported(e=>e.default&&e.default.Messages&&e.default.Messages.EMOJI_MATCHING)),ws||(ws=await window.Lightcord.Api.ensureExported(e=>e.default&&e.default.getGuild&&e.default.getGuilds&&!e.default.isFetching)),Cs||(Cs=await window.Lightcord.Api.ensureExported(e=>e.default&&e.default.getDisambiguatedEmojiContext));const e=c["Emoji Prefix"],t=()=>{const t=Es.get("BD_"+e.id,e.default);return"string"!=typeof t?e.default:t};if(fs&&bs&&ys&&vs&&ws&&Cs){console.log("Patching getAutocompleteOptions of AutoCompletionTemplates",bs);const e=bs.getAutocompleteOptions;bs.getAutocompleteOptions=function(n,s,r,i,o){const a=e.call(this,...arguments);return a.LIGHTCORD_EMOJIS={matches(e,n){let s=n.length>1&&t()===e;return Rs(s),s},queryResults:e=>ys.default.queryEmojiResults(e,n),renderResults:(e,n,s,r,i)=>xs(e,n,i.emojis,s,r,vs.default.Messages.EMOJI_MATCHING,vs.default.Messages.EMOJI,fs.default.Emoji,(function(e){return{emoji:e,key:e.id||e.uniqueName||e.name,sentinel:t(),guild:null!=e.guildId?ws.default.getGuild(e.guildId):null}}),(function(e){return t()+e+t()})),getPlainText(e,t){var n=t.emojis;if(null==n||null==n[e])return"";var s=n[e],r=s.animated?"a":"";return s.managed||null==s.id?"."+s.name+".":"<"+r+"."+(s.originalName||s.name)+"."+s.id+">"},getRawText(e,t){var n=t.emojis;if(null==n||null==n[e])return"";var s=n[e],r=s.animated?"a":"";return s.managed||null==s.id?"."+s.name+".":"<"+r+"."+(s.originalName||s.name)+"."+s.id+">"}},a}}else console.error(new Error("Couldn't start autocompletion of Lightcord's emojis."));for(;!Me.MessageComponent;)await new Promise(e=>setTimeout(e,100));this.cancelEmojiRender||(this.cancelEmoteRender=Be.monkeyPatch(Me.MessageComponent,"default",{before:e=>{if(!Be.getNestedProp(e.methodArguments[0],"childrenMessageContent.props.message"))return;const n=Be.getNestedProp(e.methodArguments[0],"childrenMessageContent.props.content");if(!n||!n.length)return;let s=[];const r=[];for(let e of n){if("string"!=typeof e){r.push(e);continue}let i,o=!1;do{if(i=ps.EmojiRegex.exec(e),i){o=!0,gs||(gs=BDModules.get(e=>e.default&&e.default.getCustomEmojiById)[0]);const e=gs.default.getCustomEmojiById(i[2]);e?s.push({animated:e.animated,name:e.name,id:e.id,raw:i[0]}):s.push({animated:i[0].startsWith("<a"),name:i[1],id:i[2],raw:i[0]})}}while(i);if(o){const i=e.split(" ").map((e,r,i)=>{if(!e)return"";const o=s.find(t=>t.raw==e);return o?(ms||(ms=BDModules.get(e=>e.CustomEmoji)[0]),React.createElement(ms.CustomEmoji,{emoji:{name:`${t()}${o.name}${t()}`,emojiId:o.id,animated:o.animated,jumboable:1===i.length&&1===n.length}})):e}).reduce((e,t)=>0===e.length?[t]:"string"==typeof t?"string"==typeof e[e.length-1]?(e[e.length-1]+=" "+t,e):(e.push(" "+t),e):(e.push(" ",t),e),[]);r.push(...i)}else r.push(e)}for(;e.methodArguments[0].childrenMessageContent.props.content[0];)e.methodArguments[0].childrenMessageContent.props.content.shift();for(;r[0];)e.methodArguments[0].childrenMessageContent.props.content.push(r.shift())}}))}disable(){this.cancelEmoteRender&&(this.cancelEmoteRender(),this.cancelEmoteRender=null)}start(){}};function xs(e,t,n,s,r,i,o,a,l,c){if(null==n||0===n.length)return null;var d=n.map((function(e,n){return React.createElement(a,Object.assign({onClick:r,onHover:s,selected:t===n,index:n},l(e,n)))}));return[ks(i,o,e,c),d]}function ks(e,t,n,s){var r=n.length>0?e.format({prefix:s(n)}):t;return Array.isArray(r)?r.unshift(React.createElement("strong",{},"[Lightcord] ")):r="[LIGHTCORD] "+r,React.createElement(fs.default.Title,{title:r},r)}ks.displayName="renderHeader";let Ds,Ms,Bs,Ls,Ns=BDModules.get(e=>e.default&&e.default.isEmojiDisabled)[0],As=Ns&&Ns.default.isEmojiDisabled,Ps=!1,Ts=!1;function Rs(e){Ps=e,Ts||(Ns||(Ns=BDModules.get(e=>e.default&&e.default.isEmojiDisabled)[0]),Ns&&(As||(As=Ns.default.isEmojiDisabled),Ts=!0,Ns.default.isEmojiDisabled=function(e){return Ps?!(!e.surrogates&&!e.diversity):As.call(this,...arguments)}))}function Os(){}Os.prototype.setConfig=function(e){this.hasStarted||Object.assign(y,e)},Object.defineProperty(Os.prototype,"methods",{get:()=>Ds}),Os.prototype.setMethods=function(e){this.hasStarted||(Ds=e)},Os.prototype.init=async function(){if(this.hasStarted)return;if(this.hasStarted=!0,!Array.prototype.flat)return void Be.alert("Not Supported","BetterDiscord v"+a+" does not support this old version ("+i+") of Discord. Please update your Discord installation before proceeding.");if(y.version<o)return void Be.alert("Not Supported","BetterDiscord v"+y.version+" (your version) is not supported by the latest js ("+a+").<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 Be.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 Be.alert("Not Supported","BandagedBD does not work with Powercord. Please uninstall one of them.");Be.suppressErrors(this.patchAttributes.bind(this),"LC Plugin Certifier Patch")(),Be.log("Startup","Initializing Settings"),this.initSettings(),await this.checkForGuilds(),Me.initialize(),Be.log("Startup","Updating Settings"),ls.initializeSettings(),Be.log("Startup","Loading Addons Cache"),await Se.loadAddonCertifierCache(),Be.log("Startup","Loading Plugins"),await O.loadPlugins(),Be.log("Startup","Loading Themes"),await De.loadThemes(),xe.addStyle("customcss",Buffer.from(A.getBDData("bdcustomcss"),"base64").toString("utf8")),window.addEventListener("beforeunload",(function(){h["bda-dc-0"]&&document.querySelector(".btn.btn-disconnect").click()})),Q.start(),Be.log("Startup","Removing Loading Icon"),document.getElementsByClassName("bd-loaderv2").length&&document.getElementsByClassName("bd-loaderv2")[0].remove(),Be.log("Startup","Initializing Main Observer"),this.initObserver(),h["fork-ps-1"]&&(Be.log("Startup","Collecting Startup Errors"),Be.showContentErrors({plugins:f,themes:b}));const e=A.getBDData("version");if(a>e&&(l&&this.showChangelogModal(l),A.setBDData("version",a)),Ss.start(),Be.suppressErrors(this.patchSocial.bind(this),"BD Social Patch")(),Be.suppressErrors(this.patchGuildPills.bind(this),"BD Guild Pills Patch")(),Be.suppressErrors(this.patchGuildListItems.bind(this),"BD Guild List Items Patch")(),Be.suppressErrors(this.patchGuildSeparator.bind(this),"BD Guild Separator Patch")(),Be.suppressErrors(this.patchMessageHeader.bind(this),"BD Badge Chat Patch")(),Be.suppressErrors(this.patchMemberList.bind(this),"BD Badge Member List Patch")(),Be.suppressErrors(this.patchAttachment.bind(this),"LC Plugin Certifier Patch")(),y.haveInstalledDefault){let e=Be.alert("First Installation","As it is the first time you install Lightcord, We added two default themes and one default plugin in your plugin/theme folder. Check it in the Plugin/Theme settings.");await new Promise(t=>{e.onClose(t)})}const t=document.querySelector("#app-mount > div.typeWindows-1za-n7.withFrame-haYltI.titleBar-AC4pGV.horizontalReverse-3tRjY7.flex-1O1GKY.directionRowReverse-m8IjIq.justifyStart-2NDFzi.alignStretch-DpGPf3.da-typeWindows.da-withFrame.da-titleBar.da-horizontalReverse.da-flex.da-directionRowReverse.da-justifyStart.da-alignStretch > div.wordmarkWindows-1v0lYD.wordmark-2iDDfm.da-wordmarkWindows.da-wordmark");t&&(t.style.top="3px",t.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" height="10" width="70" viewBox="0 0 72.54 10" style="margin-left: -5px, margin-top: 10px">\n <path fill="currentColor" d="M44.81,9.67V6.33c0-1.21,2.13-1.49,2.78-.28l2-.81A3.53,3.53,0,0,0,46.2,3c-1.92,0-3.81,1.13-3.81,3.33V9.67c0,2.21,1.89,3.33,3.77,3.33a3.87,3.87,0,0,0,3.45-2.18l-2.12-1C47,11.17,44.81,10.85,44.81,9.67ZM10.68,12.89h2.41V3.17H10.68ZM71.76,3.14H68.19V7.23L70.57,9.4v-4h1.27c.81,0,1.21.41,1.21,1v3c0,.63-.38,1.05-1.21,1.05H68.18v2.31h3.57c1.92,0,3.72-1,3.72-3.2V6.39C75.48,4.13,73.68,3.14,71.76,3.14ZM54.22,3c-2,0-4,1.1-4,3.34V9.66c0,2.23,2,3.34,4,3.34s3.95-1.11,3.95-3.34V6.34C58.19,4.11,56.2,3,54.22,3Zm1.55,6.66c0,.7-.78,1.06-1.54,1.06s-1.55-.35-1.55-1.06V6.34c0-.72.75-1.1,1.5-1.1s1.59.35,1.59,1.1ZM66.84,6.34c0-2.29-1.58-3.2-3.55-3.2H59.46v9.73h2.45V9.77h.43l2.22,3.09h3L65,9.52C66.13,9.15,66.84,8.14,66.84,6.34ZM63.33,7.65H61.91V5.43h1.42A1.11,1.11,0,1,1,63.33,7.65ZM29.83,13h2.42V3.06H29.83V6.73l-3,0V3.09H24.7v9.78h2.14V8.68l3,0ZM17.16,9.76V6.42c0-1.21,2.13-1.49,2.78-.28l2-.81a3.55,3.55,0,0,0-3.36-2.24c-1.92,0-3.81,1.13-3.81,3.33V9.76c0,2.21,2,3.15,3.9,3.15s3.58-1,3.58-3V7.58H18.79l0,1.36H20.3v.77C20.3,10.92,17.16,10.94,17.16,9.76Z" transform="translate(-2.93 -3)"/>\n <polygon fill="currentColor" points="35.91 0.06 38.43 0.06 38.43 1.84 35.92 1.81 35.97 10 33.55 10 33.49 1.75 30.98 1.74 30.98 0.06 33.49 0.06 35.91 0.06"/>\n <polygon fill="currentColor" points="0 9.97 6.5 10 6.5 7.63 2.41 7.63 2.41 0.26 0 2.26 0 9.97"/>\n</svg>')},Os.prototype.patchAttributes=async function(){let e=[];for(this.cancelPatchAttributes=function(){e.forEach(e=>e())};!Me.MessageComponent;)await new Promise(e=>setTimeout(e,100));const t=D.find(e=>"Anchor"==e.displayName);window.Lightcord.Api.ensureExported(e=>e.default&&"DiscordTag"===e.default.displayName).then(e=>{let n=e.default;e.default=function(e){let s=n(e),r=Ue(),i=Me.React.createElement("div",{style:{display:"inline",marginTop:"5px"}},Me.React.createElement("span",{id:"badges-"+r,key:"badges-"+r,style:{display:"inherit"}})),o=[s];"249746236008169473"===e.user.id?o.push(Me.React.createElement(J,{color:"black",side:"top",text:"BandagedBD Developer"},Me.React.createElement(t,{className:"bd-chat-badge",href:"https://github.com/rauenzi/BetterDiscordApp",title:"BandagedBD",target:"_blank"},Me.React.createElement(ds,{size:"16px",className:"bd-logo"})))):"696481194443014174"!==e.user.id&&"696003456611385396"!==e.user.id||o.push(Me.React.createElement(J,{color:"black",side:"top",text:"Lightcord Developer"},Me.React.createElement(t,{className:"bd-chat-badge",href:"https://github.com/Lightcord/Lightcord",title:"Lightcord",target:"_blank"},Me.React.createElement(us,{size:"16px",className:"bd-logo"})))),o.push(i);let a=Me.React.createElement("div",{style:{display:"block"}},o);return _s(r,e.user,!1),a},e.default.displayName=n.displayName}),e.push(Be.monkeyPatch(Me.MessageComponent,"default",{after:e=>{e.methodArguments[0].childrenMessageContent.props.message&&(e.returnValue.props["data-message-id"]=e.methodArguments[0].childrenMessageContent.props.message.id)}}))},Os.prototype.checkForGuilds=function(){let e=0;return new Promise(t=>{const n=function(){const s=Me.guildClasses.wrapper.split(" ")[0];document.querySelectorAll("."+s).length>0&&e++;const r=Me.guildClasses.listItem.split(" ")[0],i=Me.guildClasses.blobContainer.split(" ")[0];return document.querySelectorAll(`.${s} .${r} .${i}`).length>0||e>=50?t(y.deferLoaded=!0):void setTimeout(n,100)};"loading"!=document.readyState&&setTimeout(n,100),document.addEventListener("DOMContentLoaded",()=>{setTimeout(n,100)})})},Os.prototype.injectExternals=async function(){},Os.prototype.initSettings=function(){if(A.initialize(),A.getSettingGroup("rpc")||Object.assign(u,p),A.getSettingGroup("settings")){ls.loadSettings();for(const e in d)null==h[e]&&(h[e]=d[e],ls.saveSettings())}else Object.assign(h,d),ls.saveSettings();window.Lightcord.Api.ensureExported(e=>e.default&&e.default.prototype&&e.default.prototype.getPredicateSections).then(e=>{let t=e.default.prototype.getPredicateSections;e.default.prototype.getPredicateSections=function(){let e=t.call(this,...arguments);if(!e[1])return e;if("My Account"===e[1].section){let t=[];for(t.push(e.pop()),t.push(e.pop()),t.push(e.pop()),t.push(e.pop()),e.push(...ls.renderSidebar(this));t[0];)e.push(t.pop())}return console.log(e),e}})},Os.prototype.initObserver=function(){new MutationObserver(e=>{for(let t=0,n=e.length;t<n;t++){const n=e[t];if(void 0!==O&&O.rawObserver(n),!(n.addedNodes.length&&n.addedNodes[0]instanceof Element))continue;const s=n.addedNodes[0];Ms||(Ms=BDModules.get(e=>e.layer&&"string"==typeof e.layer&&e.animating)[0].layer),Bs||(Bs=BDModules.get(e=>e.socialLinks&&"string"==typeof e.socialLinks)[0].socialLinks),Ls||(Ls=BDModules.get(e=>e.modal&&"string"==typeof e.modal&&e.inner&&"string"==typeof e.inner&&!e.responsiveWidthMobile)[0].modal),s.classList.contains(Ms)&&("GUILD_SETTINGS"===s.getAttribute("aria-label")&&(s.setAttribute("layer-id","server-settings"),s.setAttribute("id","server-settings")),s.getElementsByClassName(Bs).length&&(s.setAttribute("layer-id","user-settings"),s.setAttribute("id","user-settings"))),s.parentElement==document.body&&s.querySelector("#ace_settingsmenu")&&(s.id="ace_settingsmenu_container")}}).observe(document,{childList:!0,subtree:!0})},Os.prototype.showChangelogModal=function(e={}){return Be.showChangelogModal(e)},Os.prototype.alert=function(e,t){return Be.alert(e,t)},Os.prototype.patchSocial=function(){if(this.socialPatch)return;const e=D.find(e=>"TabBar"==e.displayName),t=D.find(e=>"Anchor"==e.displayName);e&&(this.socialPatch=Be.monkeyPatch(e.prototype,"render",{after:e=>{const n=e.returnValue.props.children;if(!n||!n.length||n.length<3)return;if("Separator"!==n[n.length-3].type.displayName)return;if(!n[n.length-2].type.toString().includes("socialLinks"))return;if(t){let e=BDModules.get(e=>e.socialLinks)[0];const s=n[n.length-2].type,r=function(){const n=s(...arguments);return n.props.children.push(Me.React.createElement(J,{color:"black",side:"top",text:"Lightcord"},Me.React.createElement(t,{className:"bd-social-link "+e.link,href:"https://github.com/Lightcord/Lightcord",title:"Lightcord",target:"_blank"},Me.React.createElement(us,{size:"16px",className:"bd-social-logo"})))),n.props.children.push(Me.React.createElement(J,{color:"black",side:"top",text:"BandagedBD"},Me.React.createElement(t,{className:"bd-social-link "+e.link,href:"https://github.com/rauenzi/BetterDiscordApp",title:"BandagedBD",target:"_blank"},Me.React.createElement(ds,{size:"16px",className:"bd-social-logo"})))),n};n[n.length-2].type=r}let[s,r,i]=[BDModules.get(e=>e.colorMuted)[0].colorMuted,BDModules.get(e=>e.size32)[0],BDModules.get(e=>e.versionHash)[0].versionHash];const o=`(${y.hash?y.hash.substring(0,7):y.branch})`,l=I.ipcRenderer.sendSync("LIGHTCORD_GET_BUILD_INFOS"),c=[Me.react.createElement("div",{className:`${s} ${r.size12}`},`Lightcord ${l.version} `,Me.react.createElement("span",{className:i+" da-versionHash"},`(${(l.commit||"Unknown").slice(0,7)})`)),Me.react.createElement("div",{className:`${s} ${r.size12}`},`BBD ${a} `,Me.react.createElement("span",{className:i+" da-versionHash"},o))],d=n[n.length-1].type;n[n.length-1].type=function(){const e=d(...arguments);return e.props.children.splice(1,0,c),e}}}))};function _s(e,t,n){process.nextTick(()=>{const s=document.getElementById("badges-"+e);if(!s||s.childNodes.length>0)return;if(s.childNodes.length)return;let r=document.createElement("div");r.style.display="none",s.appendChild(r);const i=D.find(e=>"Anchor"==e.displayName);qe.getBadges(t.id).then(e=>{e.forEach(e=>{const r={svg:{size:"16px",className:"bd-logo",width:"16px"}};e.scopes.forEach(e=>{"user"===e&&(r.user=t)}),e.href||(r.Anchor=i,r.href={className:n?"bd-chat-badge":"bd-member-badge",title:e.name,target:"_blank"});const o=Me.React.createElement(J,{color:"black",side:"top",text:e.name},e.href?Me.react.createElement(i,{href:e.href,className:n?"bd-chat-badge":"bd-member-badge",title:e.name,target:"_blank"},Me.React.createElement(e.component,r)):Me.React.createElement(e.component,r)),a=document.createElement("div");Me.reactDom.render(o,a),a.childNodes.forEach(e=>{s.appendChild(e)})})})})}Os.prototype.patchGuildListItems=function(){if(this.guildListItemsPatch)return;const e=function(){const e=D.findByProps("wrapper","unreadMentionsBar"),t=D.findByProps("guildsError","selected"),n=D.findByProps("blobContainer");return Object.assign({},e,t,n)}(),t=e.listItem.split(" ")[0],n=e.blobContainer.split(" ")[0],s=Me.getInternalInstance(document.querySelector(`.${t} .${n}`).parentElement).return.type;s&&(this.guildListItemsPatch=Be.monkeyPatch(s.prototype,"render",{after:e=>{if(e.returnValue&&e.thisObject){const t=e.returnValue,n=e.thisObject.props;let s=t.props.className;return s+=" bd-guild",n.unread&&(s+=" bd-unread"),n.selected&&(s+=" bd-selected"),n.audio&&(s+=" bd-audio"),n.video&&(s+=" bd-video"),n.badge&&(s+=" bd-badge"),n.animatable&&(s+=" bd-animatable"),t.props.className=s,t}}}))},Os.prototype.patchGuildPills=function(){if(this.guildPillPatch)return;const e=D.find(e=>e.default&&!e.default.displayName&&e.default.toString&&e.default.toString().includes("translate3d"));e&&(this.guildPillPatch=Be.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}}))},Os.prototype.patchGuildSeparator=function(){if(this.guildSeparatorPatch)return;const e=D.findByDisplayName("Guilds"),t=D.findByProps("renderListItem");if(!t||!e)return;const n=function(){const e=t.Separator(...arguments);return e.props.className+=" bd-guild-separator",e};this.guildSeparatorPatch=Be.monkeyPatch(e.prototype,"render",{after:e=>{e.returnValue.props.children[1].props.children[3].type=n}})},Os.prototype.patchAttachment=function(){if(this.AttachmentPatch)return;const e=BDModules.get(e=>e.default&&"Attachment"===e.default.displayName)[0];D.find(e=>"Anchor"==e.displayName)&&e&&e.default&&(this.AttachmentPatch=Be.monkeyPatch(e,"default",{after:e=>{if(!h["fork-ps-6"])return;const t=e.methodArguments[0]||null,n=Be.getNestedProp(e.returnValue,"props.children");if(!n||!t||!t.url)return;if(!Array.isArray(n))return;const s=Ue();n.push(Me.react.createElement("span",{id:"certified-"+s})),Q.patch(t,"certified-"+s)}}))},Os.prototype.patchMessageHeader=function(){if(this.messageHeaderPatch)return;const e=D.findByProps("MessageTimestamp"),t=D.find(e=>"Anchor"==e.displayName);t&&e&&e.default&&(this.messageHeaderPatch=Be.monkeyPatch(e,"default",{after:e=>{const n=Be.getNestedProp(e.methodArguments[0],"message.author"),s=Be.getNestedProp(e.returnValue,"props.children.1.props.children.1.props.children");if(!s||!n||!n.id)return;if(!Array.isArray(s))return;"249746236008169473"===n.id?s.push(Me.React.createElement(J,{color:"black",side:"top",text:"BandagedBD Developer"},Me.React.createElement(t,{className:"bd-chat-badge",href:"https://github.com/rauenzi/BetterDiscordApp",title:"BandagedBD",target:"_blank"},Me.React.createElement(ds,{size:"16px",className:"bd-logo"})))):"696481194443014174"!==n.id&&"696003456611385396"!==n.id||s.push(Me.React.createElement(J,{color:"black",side:"top",text:"Lightcord Developer"},Me.React.createElement(t,{className:"bd-chat-badge",href:"https://github.com/Lightcord/Lightcord",title:"Lightcord",target:"_blank"},Me.React.createElement(us,{size:"16px",className:"bd-logo"}))));const r=Ue();s.push(Me.React.createElement("div",{id:"badges-"+r,style:{display:"inline"}})),_s(r,n,!0)}}))},Os.prototype.patchMemberList=function(){if(this.memberListPatch)return;const e=D.findByDisplayName("MemberListItem"),t=D.find(e=>"Anchor"==e.displayName);t&&e&&e.prototype&&e.prototype.renderDecorators&&(this.memberListPatch=Be.monkeyPatch(e.prototype,"renderDecorators",{after:e=>{const n=Be.getNestedProp(e.thisObject,"props.user"),s=Be.getNestedProp(e.returnValue,"props.children");if(!s||!n||!n.id)return;if(!Array.isArray(s))return;"249746236008169473"===n.id?s.push(Me.React.createElement(J,{color:"black",side:"top",text:"BandagedBD Developer"},Me.React.createElement(t,{className:"bd-member-badge",href:"https://github.com/rauenzi/BetterDiscordApp",title:"BandagedBD",target:"_blank"},Me.React.createElement(ds,{size:"16px",className:"bd-logo"})))):"696481194443014174"!==n.id&&"696003456611385396"!==n.id||s.push(Me.React.createElement(J,{color:"black",side:"top",text:"Lightcord Developer"},Me.React.createElement(t,{className:"bd-member-badge",href:"https://github.com/Lightcord/Lightcord",title:"Lightcord",target:"_blank"},Me.React.createElement(us,{size:"16px",className:"bd-logo"}))));const r=Ue();s.push(Me.React.createElement("div",{id:"badges-"+r})),_s(r,n,!1)}}))},Os.prototype.updateInjector=async function(){if(!A.injectionPath)return!1};var js=new Os;const Is={get React(){return Me.React},get ReactDOM(){return Me.ReactDom},get ReactComponent(){return Me.ReactComponent},get WindowConfigFile(){return Be.WindowConfigFile},get settings(){return c},get emotes(){return null},get screenWidth(){return Math.max(document.documentElement.clientWidth,window.innerWidth||0)},get screenHeight(){return Math.max(document.documentElement.clientHeight,window.innerHeight||0)},getAllWindowPreferences:function(){return Be.getAllWindowPreferences()},getWindowPreference:function(e){return Be.getWindowPreference(e)},setWindowPreference:function(e,t){return Be.setWindowPreference(e,t)},injectCSS:function(e,t){xe.addStyle(xe.escapeID(e),t)},clearCSS:function(e){xe.removeStyle(xe.escapeID(e))},linkJS:function(e,t){xe.addScript(xe.escapeID(e),t)},unlinkJS:function(e){xe.removeScript(xe.escapeID(e))},getPlugin:function(e){return w.hasOwnProperty(e)?w[e].plugin:null},getCore:function(){return Be.warn("Deprecation Notice","BdApi.getCore() will be removed in future versions."),js},alert:function(e,t){return Be.showConfirmationModal(e,t,{cancelText:null})},showConfirmationModal:function(e,t,n={}){return Be.showConfirmationModal(e,t,n)},showToast:function(e,t={}){Be.showToast(e,t)},findModule:function(e){return Me.WebpackModules.find(e)},findAllModules:function(e){return Me.WebpackModules.findAll(e)},findModuleByProps:function(...e){return Me.WebpackModules.findByUniqueProperties(e)},findModuleByPrototypes:function(...e){return Me.WebpackModules.findByPrototypes(e)},findModuleByDisplayName:function(e){return Me.WebpackModules.findByDisplayName(e)},getInternalInstance:function(e){if(e instanceof window.jQuery||e instanceof Element)return e instanceof jQuery&&(e=e[0]),Me.getInternalInstance(e)},loadData:function(e,t){return A.getPluginData(e,t)}};Is.getData=Is.loadData,Is.saveData=function(e,t,n){return A.setPluginData(e,t,n)},Is.setData=Is.saveData,Is.deleteData=function(e,t){return A.deletePluginData(e,t)},Is.monkeyPatch=function(e,t,n){return Be.monkeyPatch(e,t,n)},Is.onRemoved=function(e,t){return Be.onRemoved(e,t)},Is.suppressErrors=function(e,t){return Be.suppressErrors(e,t)},Is.testJSON=function(e){return Be.testJSON(e)},Is.isPluginEnabled=function(e){return!!C[e]},Is.isThemeEnabled=function(e){return!!E[e]},Is.isSettingEnabled=function(e){return!!h[e]},Is.enableSetting=function(e){return ls.onChange(e,!0)},Is.disableSetting=function(e){return ls.onChange(e,!1)},Is.toggleSetting=function(e){return ls.onChange(e,!h[e])},Is.getBDData=function(e){return A.getBDData(e)},Is.setBDData=function(e,t){return A.setBDData(e,t)};const $s=(e,t,n)=>new class{get folder(){return n.folder}isEnabled(t){return!!e[t]}enable(e){return n.enable(e)}disable(e){return n.disable(e)}toggle(t){e[t]?this.disable(t):this.enable(t)}reload(e){return n.reload(e)}get(e){return t.hasOwnProperty(e)?t[e].plugin?t[e].plugin:t[e]:null}getAll(){return Object.keys(t).map(e=>this.get(e)).filter(e=>e)}};Is.Plugins=$s(C,w,O),Is.Themes=$s(E,v,De);var Ws=Is;window.Lightcord.BetterDiscord.BdApi=Is,function(){const e=Object.getOwnPropertyDescriptor(HTMLIFrameElement.prototype,"contentWindow").get;Object.defineProperty(HTMLIFrameElement.prototype,"contentWindow",{get:function(){const t=Reflect.apply(e,this,arguments);return new Proxy(t,{getOwnPropertyDescriptor:function(e,t){if("localStorage"!==t)return Object.getOwnPropertyDescriptor(e,t)},get:function(e,t){if("localStorage"===t)return null;const n=e[t];return"function"==typeof n?n.bind(e):n}})}}),Object.defineProperty(Reflect,"apply",{value:Reflect.apply,writable:!1,configurable:!1}),Object.defineProperty(Function.prototype,"bind",{value:Function.prototype.bind,writable:!1,configurable:!1});const t=XMLHttpRequest.prototype.open;XMLHttpRequest.prototype.open=function(){const e=arguments[1];return e.toLowerCase().includes("api/webhooks")?null:Reflect.apply(t,this,arguments)}}(),(()=>{const e=document.createElement("div");e.className="bd-loaderv2",e.title="BandagedBD is loading...",document.body.appendChild(e)})();const Fs=(e,t)=>{Object.defineProperty(window,e,{get:()=>(Be.warn("Deprecated Global",`"${e}" will be removed in future versions. Please only use BdApi.`),t)})},Hs=Object.keys(s);for(const e of Hs)Fs(e,s[e]);Fs("BDV2",Me),Fs("pluginModule",O),Fs("themeModule",De),Fs("Utils",Be),Fs("BDEvents",T),Fs("settingsPanel",ls),Fs("DataStore",A),Fs("ContentManager",Se),Fs("ClassNormalizer",rt),window.BdApi=Ws,Fs("mainCore",js);class Us{constructor(e,t){js.setConfig(e),js.setMethods(t)}init(){js.init()}}}]);
//# sourceMappingURL=index.min.js.map