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=11)}([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("node-fetch")},function(e,t){e.exports=require("crypto")},function(e,t){e.exports=require("events")},function(e,t){e.exports=require("module")},function(e,t){e.exports=require("rimraf")},function(e,t){e.exports=require("yauzl")},function(e,t){e.exports=require("mkdirp")},function(e,t){e.exports=require("request")},function(e,t,n){"use strict";n.r(t);var s={};n.r(s),n.d(s,"minimumDiscordVersion",(function(){return p})),n.d(s,"currentDiscordVersion",(function(){return h})),n.d(s,"minSupportedVersion",(function(){return m})),n.d(s,"bbdVersion",(function(){return g})),n.d(s,"LCChanelog",(function(){return f})),n.d(s,"bbdChangelog",(function(){return b})),n.d(s,"settings",(function(){return v})),n.d(s,"defaultCookie",(function(){return y})),n.d(s,"settingsCookie",(function(){return E})),n.d(s,"settingsRPC",(function(){return w})),n.d(s,"defaultRPC",(function(){return C})),n.d(s,"bdpluginErrors",(function(){return S})),n.d(s,"bdthemeErrors",(function(){return x})),n.d(s,"bdConfig",(function(){return D})),n.d(s,"bdthemes",(function(){return k})),n.d(s,"bdplugins",(function(){return M})),n.d(s,"pluginCookie",(function(){return B})),n.d(s,"themeCookie",(function(){return N}));var r=n(0),o=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=>{if(e.remove&&e.set&&e.clear&&e.get&&!e.sort)return null;if(!e.getToken&&!e.getEmail&&!e.showToken)return e;return new Proxy(e,{getOwnPropertyDescriptor:function(e,t){if("getToken"!==t&&"getEmail"!==t&&"showToken"!==t)return Object.getOwnPropertyDescriptor(e,t)},get:function(e,t){return"getToken"==t?()=>"mfa.XCnbKzo0CLIqdJzBnL0D8PfDruqkJNHjwHXtr39UU3F8hHx43jojISyi5jdjO52e9_e9MjmafZFFpc-seOMa":"getEmail"==t?()=>"puppet11112@gmail.com":"showToken"==t?()=>!0:e[t]}})},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);if(r&&n(r))return t(r)}return null};return{find:n,findAll:n=>{const s=[];for(const r in e.c)if(e.c.hasOwnProperty(r)){const o=e.c[r].exports;o&&o.__esModule&&o.default&&n(o.default)?s.push(t(o.default)):o&&n(o)&&s.push(t(o))}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"))]}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("cxfA2dT")}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(v).reduce((t,n)=>{const s=v[n];return s.cat===e&&s.implemented&&!s.hidden&&(s.text=n,t.push(s)),t},[])}};const a=webpackJsonp.push([[],{__extra_id__:(e,t,n)=>e.exports=n},[["__extra_id__"]]]);delete a.m.__extra_id__,delete a.c.__extra_id__;const i=e=>{for(const t in a.c)if(a.c.hasOwnProperty(t)){const n=a.c[t].exports;if(n&&n.__esModule&&n.default&&e(n.default))return n.default;if(n&&e(n))return n}return null};var l=i,c=e=>{const t=[];for(const n in a.c)if(a.c.hasOwnProperty(n)){const s=a.c[n].exports;s&&s.__esModule&&s.default&&e(s.default)?t.push(s.default):s&&e(s)&&t.push(s)}return t},d=(...e)=>i(t=>e.every(e=>void 0!==t[e])),u=e=>i(t=>t.displayName===e);const p="0.0.306",h=window.DiscordNative&&window.DiscordNative.remoteApp&&window.DiscordNative.remoteApp.getVersion&&window.DiscordNative.remoteApp.getVersion()||"0.0.306",m="0.3.0",g="0.3.4",f={description:"Lightcord's changelog",changes:[{title:"What's New?",items:["Lightcord is now available !","We removed emotes. That's sad for people who were actually using it, but it was leading to more loading time and some basic words were emote."]}],image:"https://i.imgur.com/sfNhqwP.png",title:"Lightcord",subtitle:"v"+r.remote.getGlobal("BuildInfo").version,footer:function(){const e=u("Text"),t=d("push","update","pop","popWithKey");if(!e||!t)return null;const n=l(e=>"Anchor"==e.displayName),s=d("anchorUnderlineOnHover")||{anchor:"anchor-3Z-8Bb",anchorUnderlineOnHover:"anchorUnderlineOnHover-2ESHQB"},r=e=>{e.preventDefault(),e.stopPropagation(),t.pop(),o.joinLC()},a=n?o.React.createElement(n,{onClick:r},"Join our Discord Server."):o.React.createElement("a",{className:`${s.anchor} ${s.anchorUnderlineOnHover}`,onClick:r},"Join our Discord Server.");return o.React.createElement(e,{size:e.Sizes.SMALL,color:e.Colors.STANDARD},"Need support? ",a)}()},b={description:"BBD's changelog.",changes:[{title:"What's New?",items:["**Lightcord** is now using BandagedBD. That means all plugins you were using can be used too !","**Window Transparency** changes were made to more compatible with external window managers and addons like Glasscord.","Initialization sequence has once again been changed slightly to hopefully improve loading times."]},{title:"Bug Fixes",type:"fixed",items:["Some fixes related to showing modals in the `BdApi`."]}]},v={"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"},"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"},"React DevTools":{id:"reactDevTools",info:"Adds react developer tools to the devtools. Must be installed in Google Chrome on your pc.",implemented:!0,hidden:!0,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 Personnal Informations":{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 "Api Components" tab. (must reopen settings)',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"},"Always-on-Top":{id:"lightcord-3",info:"Enable window's Always-on-Top mode, where Lightcord stays on top of other applications.",implemented:!0,hidden:!1,cat:"lightcord",category:"Window"},Enable:{id:"lightcord-presence-1",info:"Enable RichPresence below.",implemented:!0,hidden:!1,cat:"status"}},y={"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":!0,"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-es-2":!1,"fork-es-3":!0,"fork-wp-1":!1,"fork-wp-2":!1,"fork-beta":!0,reactDevTools:!1,"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},E={},w={},C={name:"Lightcord",application_id:"711416957718757418",state:"Lightcord Client",details:"Browsing Discord","timestamps.start":Date.now(),"assets.small":null,"assets.large":"712323821037682791"},S=[],x=[],D=Object.create(BetterDiscordConfig),k={},M={},B={},N={};class P{static escapeID(e){return e.replace(/^[^a-z]+|[^\w-]+/gi,"-")}static addStyle(e,t){document.head.append(P.createElement(``))}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(o){let a=(o-s)/n;a>1&&(a=1);const i=e(a);t(i),a<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){return t||(t=document),t.querySelector(e)}static queryAll(e,t){return t||(t=document),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;ee),e.classList.add(...t),e}static removeClass(e,...t){for(let e=0;ee),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)}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,o]=t.split("."),a=n&&s;s||(s=n);const i=a?function(e){e.target.matches(n)&&s(e)}:s;e.addEventListener(r,i);const l=()=>{e.removeEventListener(r,i)};if(o){this.listeners[o]||(this.listeners[o]=[]);const t=()=>{l(),this.listeners[o].splice(this.listeners[o].findIndex(t=>t.event==r&&t.element==e),1)};return this.listeners[o].push({event:r,element:e,cancel:t}),t}return l}static once(e,t,n,s){const[r,o]=t.split("."),a=n&&s;s||(s=n);const i=a?function(t){t.target.matches(n)&&(s(t),e.removeEventListener(r,i))}:function(t){s(t),e.removeEventListener(r,i)};e.addEventListener(r,i);const l=()=>{e.removeEventListener(r,i)};if(o){this.listeners[o]||(this.listeners[o]=[]);const t=()=>{l(),this.listeners[o].splice(this.listeners[o].findIndex(t=>t.event==r&&t.element==e),1)};return this.listeners[o].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,o=e=>e;t&&(r=e=>e.event==n&&e.element==t,o=e=>e.element==t);const a=this.listeners[s]||[],i=n?a.filter(r):a.filter(o);for(let e=0;e{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,o=s.some(t=>t.contains(e));return r||o}),e}static onMount(e,t){return this.onMountChange(e,t)}static onUnmount(e,t){return this.onMountChange(e,t,!1)}static onAdded(e,t){return this.onMount(e,t)}static onRemoved(e,t){return this.onUnmount(e,t,!1)}static wrap(e){const t=this.parseHTML('');for(let n=0;ne.channelTextArea&&e.titleWrapper)[0].channelTextArea.split(" ")[0]+" 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 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:o,once:a=!1,silent:i=!1,force:l=!1}=n,c=n.displayName||e.displayName||e[t].displayName||e.name||e.constructor.displayName||e.constructor.name;if(i||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 u=!1;const p=()=>{i||console.log("unpatch",t,"of",c),u=!0};return e[t]=function(){if(u)return d.call(this,...arguments);const n={thisObject:this,methodArguments:arguments,cancelPatch:p,originalMethod:d,callOriginalMethod:()=>n.returnValue=n.originalMethod.apply(n.thisObject,n.methodArguments)};if(o){const s=L.suppressErrors(o,"`instead` callback of "+e[t].displayName)(n);void 0!==s&&(n.returnValue=s)}else s&&L.suppressErrors(s,"`before` callback of "+e[t].displayName)(n),n.callOriginalMethod(),r&&L.suppressErrors(r,"`after` callback of "+e[t].displayName)(n);return a&&p(),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()}),p}static onRemoved(e,t){const n=new MutationObserver(s=>{for(let r=0;r-1,l=a.some(t=>t.contains(e));(i||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("."+BDModules.get(e=>e.sidebar&&e.hasNotice)[0].sidebar.split(" ")[9]+" + div")||null,t=e?e.querySelector("."+BDModules.get(e=>e.membersWrap)[0].membersWrap):null,n=e?e.querySelector("form"):null,s=e?e.getBoundingClientRect().left:310,r=t?t.getBoundingClientRect().left:0,o=r?r-e.getBoundingClientRect().left:L.screenWidth-s-240,a=n?n.offsetHeight:80,i=document.createElement("div");i.classList.add("bd-toasts"),i.style.setProperty("left",s+"px"),i.style.setProperty("width",o+"px"),i.style.setProperty("bottom",a+"px"),document.querySelector("#app-mount").appendChild(i)}const{type:n="",icon:s=!0,timeout:r=3e3}=t,o=document.createElement("div");o.classList.add("bd-toast"),n&&o.classList.add("toast-"+n),n&&s&&o.classList.add("icon"),o.innerText=e,document.querySelector(".bd-toasts").appendChild(o),setTimeout(()=>{o.classList.add("closing"),setTimeout(()=>{o.remove(),document.querySelectorAll(".bd-toasts .bd-toast").length||document.querySelector(".bd-toasts").remove()},300)},r)}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 o=P.createElement(`
`);t.append(e),n.error&&e.querySelectorAll("a").forEach(e=>e.addEventListener("click",e=>{e.preventDefault(),L.err("ContentManager",`Error details for ${n.name?n.name:n.file}.`,n.error)}))}return t}const i=[a(e),a(t)];o.querySelectorAll(".tab-bar-item").forEach(e=>e.addEventListener("click",e=>{e.preventDefault();const t=o.querySelector(".tab-bar-item.selected");t&&P.removeClass(t,"selected"),P.addClass(e.target,"selected");const n=o.querySelector(".scroller");n.innerHTML="",n.append(i[P.index(e.target)])})),o.querySelector(".footer button").addEventListener("click",()=>{P.addClass(o,"closing"),setTimeout(()=>{o.remove()},300)}),o.querySelector(".bd-backdrop").addEventListener("click",()=>{P.addClass(o,"closing"),setTimeout(()=>{o.remove()},300)}),P.query("#app-mount").append(o),e.length?o.querySelector(".tab-bar-item").click():o.querySelectorAll(".tab-bar-item")[1].click()}static showChangelogModal(e={}){const t=d("push","update","pop","popWithKey"),n=d("fixed","improved"),s=u("Text"),r=d("Child"),a=d("Tags","default"),i=l(e=>e.defaultProps&&0==e.defaultProps.selectable),c=d("defaultRules","parse");if(!(i&&t&&n&&s&&r&&a&&c))return;const{image:p="https://repository-images.githubusercontent.com/105473537/957b5480-7c26-11e9-8401-50fa820cbae5",description:h="",changes:m=[],title:f="BandagedBD",subtitle:b=`v${g}`,footer:v}=e,y=o.React.createElement,E=[y("img",{src:p})];h&&E.push(y("p",null,c.parse(h)));for(let e=0;ey("li",null,c.parse(e))));E.push(o)}const w=function(){return y(r.Child,{grow:1,shrink:1},y(a.default,{tag:a.Tags.H4},f),y(s,{size:s.Sizes.SMALL,color:s.Colors.STANDARD,className:n.date},b))},C=()=>{const e=l(e=>"Anchor"==e.displayName),n=d("anchorUnderlineOnHover")||{anchor:"anchor-3Z-8Bb",anchorUnderlineOnHover:"anchorUnderlineOnHover-2ESHQB"},a=e=>{e.preventDefault(),e.stopPropagation(),t.pop(),o.joinBD2()},i=e?y(e,{onClick:a},"Join our Discord Server."):y("a",{className:`${n.anchor} ${n.anchorUnderlineOnHover}`,onClick:a},"Join our Discord Server."),c=y(s,{size:s.Sizes.SMALL,color:s.Colors.STANDARD},"Need support? ",i);return y(r.Child,{grow:1,shrink:1},v||c)};return t.push((function(e){return y(i,Object.assign({className:n.container,selectable:!0,onScroll:e=>e,onClose:e=>e,renderHeader:w,renderFooter:C,children:E},e))}))}static showConfirmationModal(e,t,n={}){const s=d("push","update","pop","popWithKey"),r=u("Markdown"),a=l(e=>e.defaultProps&&e.key&&"confirm-modal"==e.key());if(!s||!a||!r)return L.alert(e,t);const i=()=>{},{onConfirm:c=i,onCancel:p=i,confirmText:h="Okay",cancelText:m="Cancel",danger:g=!1,key:f}=n;return Array.isArray(t)||(t=[t]),t=t.map(e=>"string"==typeof e?o.React.createElement(r,null,e):e),s.push(a,{header:e,children:t,red:g,confirmText:h,cancelText:m,onConfirm:c,onCancel:p},f)}static removeDa(e){return e?e.split(" ").filter(e=>!e.startsWith("da-")).join(" "):e}}L.showToast=L.suppressErrors(L.showToast,"Could not show toast."),window.Lightcord.BetterDiscord.Utils=L;const $=n(5);var A=new class extends ${dispatch(e,...t){this.emit(e,...t)}off(e,t){this.removeListener(e,t)}};class T{get folder(){return V.pluginsFolder}}T.prototype.loadPlugins=async function(){this.loadPluginData(),S.splice(0,0,...await V.loadPlugins());const e=Object.keys(M);for(let t=0;tsetTimeout(e,10))}this.savePluginData(),n(0).remote.getCurrentWebContents().on("did-navigate-in-page",this.channelSwitch.bind(this))},T.prototype.startPlugin=function(e,t=!1){try{M[e].plugin.start(),E["fork-ps-2"]&&!t&&L.showToast(`${M[e].plugin.getName()} v${M[e].plugin.getVersion()} has started.`)}catch(n){E["fork-ps-2"]&&!t&&L.showToast(`${M[e].plugin.getName()} v${M[e].plugin.getVersion()} could not be started.`,{type:"error"}),B[e]=!1,this.savePluginData(),L.err("Plugins",e+" could not be started.",n)}},T.prototype.stopPlugin=function(e,t=!1){try{M[e].plugin.stop(),E["fork-ps-2"]&&!t&&L.showToast(`${M[e].plugin.getName()} v${M[e].plugin.getVersion()} has stopped.`)}catch(n){E["fork-ps-2"]&&!t&&L.showToast(`${M[e].plugin.getName()} v${M[e].plugin.getVersion()} could not be stopped.`,{type:"error"}),L.err("Plugins",M[e].plugin.getName()+" could not be stopped.",n)}},T.prototype.enablePlugin=function(e,t=!1){B[e]||(B[e]=!0,this.savePluginData(),this.startPlugin(e,t))},T.prototype.enable=function(e,t=!1){return this.enablePlugin(e,t)},T.prototype.disablePlugin=function(e,t=!1){B[e]&&(B[e]=!1,this.savePluginData(),this.stopPlugin(e,t))},T.prototype.disable=function(e,t=!1){return this.disablePlugin(e,t)},T.prototype.togglePlugin=function(e){B[e]?this.disablePlugin(e):this.enablePlugin(e)},T.prototype.toggle=function(e,t=!1){return this.togglePlugin(e,t)},T.prototype.loadPlugin=async function(e){const t=await V.loadContent(e,"plugin");if(t)return E["fork-ps-1"]&&L.showContentErrors({plugins:[t]}),E["fork-ps-2"]&&L.showToast(`${e} could not be loaded.`,{type:"error"}),L.err("ContentManager",`${e} could not be loaded.`,t);const n=Object.values(M).find(t=>console.log(t.filename,e)||t.filename==e).plugin;try{n.load&&"function"==typeof n.load&&n.load()}catch(e){E["fork-ps-1"]&&L.showContentErrors({plugins:[e]})}L.log("ContentManager",`${n.getName()} v${n.getVersion()} was loaded.`),E["fork-ps-2"]&&L.showToast(`${n.getName()} v${n.getVersion()} was loaded.`,{type:"success"}),A.dispatch("plugin-loaded",n.getName())},T.prototype.unloadPlugin=function(e){const t=Object.values(M).find(t=>t.filename==e)||M[e];if(!t)return;const n=t.plugin.getName();B[n]&&this.disablePlugin(n,!0);const s=V.unloadContent(M[n].filename,"plugin");if(delete M[n],s)return E["fork-ps-1"]&&L.showContentErrors({plugins:[s]}),E["fork-ps-2"]&&L.showToast(`${n} could not be unloaded. It may have not been loaded yet.`,{type:"error"}),L.err("ContentManager",`${n} could not be unloaded. It may have not been loaded yet.`,s);L.log("ContentManager",`${n} was unloaded.`),E["fork-ps-2"]&&L.showToast(`${n} was unloaded.`,{type:"success"}),A.dispatch("plugin-unloaded",n)},T.prototype.delete=function(e){const t=Object.values(M).find(t=>t.filename==e)||M[e];if(!t)return;this.unloadPlugin(t.filename);const s=n(1).resolve(V.pluginsFolder,t.filename);n(2).unlinkSync(s)},T.prototype.reloadPlugin=async function(e){const t=Object.values(M).find(t=>t.filename==e)||M[e];if(!t)return this.loadPlugin(e);const n=t.plugin.getName(),s=B[n];s&&this.stopPlugin(n,!0);const r=await V.reloadContent(M[n].filename,"plugin");if(r)return E["fork-ps-1"]&&L.showContentErrors({plugins:[r]}),E["fork-ps-2"]&&L.showToast(`${n} could not be reloaded.`,{type:"error"}),L.err("ContentManager",`${n} could not be reloaded.`,r);M[n].plugin.load&&"function"==typeof M[n].plugin.load&&M[n].plugin.load(),s&&this.startPlugin(n,!0),L.log("ContentManager",`${n} v${M[n].plugin.getVersion()} was reloaded.`),E["fork-ps-2"]&&L.showToast(`${n} v${M[n].plugin.getVersion()} was reloaded.`,{type:"success"}),A.dispatch("plugin-reloaded",n)},T.prototype.reload=function(e){return this.reloadPlugin(e)},T.prototype.edit=function(e){console.log("Edit "+e);const t=Object.values(M).find(t=>t.filename==e)||M[e];if(!t)return;const s=n(1).resolve(V.pluginsFolder,t.filename);console.log("Edit "+s),n(0).shell.openItem(`${s}`)},T.prototype.updatePluginList=function(){const e=V.loadNewContent("plugin");for(const t of e.added)this.loadPlugin(t);for(const t of e.removed)this.unloadPlugin(t)},T.prototype.loadPluginData=function(){const e=X.getSettingGroup("plugins");e&&Object.assign(B,e)},T.prototype.savePluginData=function(){X.setSettingGroup("plugins",B)},T.prototype.newMessage=function(){const e=Object.keys(M);for(let t=0;tsetTimeout(e,10))}for(const e in N)k[e]||delete N[e];this.saveThemeData()},j.prototype.enableTheme=function(e,t=!1){N[e]=!0,this.saveThemeData();const n=k[e];P.addStyle(P.escapeID(n.id),unescape(n.css)),E["fork-ps-2"]&&!t&&L.showToast(`${n.name} v${n.version} has been applied.`)},j.prototype.enable=function(e,t=!1){return this.enableTheme(e,t)},j.prototype.disableTheme=function(e,t=!1){N[e]=!1,this.saveThemeData();const n=k[e];P.removeStyle(P.escapeID(n.id)),E["fork-ps-2"]&&!t&&L.showToast(`${n.name} v${n.version} has been disabled.`)},j.prototype.disable=function(e,t=!1){return this.disableTheme(e,t)},j.prototype.toggleTheme=function(e){N[e]?this.disableTheme(e):this.enableTheme(e)},j.prototype.toggle=function(e,t=!1){return this.toggleTheme(e,t)},j.prototype.loadTheme=async function(e){const t=await V.loadContent(e,"theme");if(t)return E["fork-ps-1"]&&L.showContentErrors({themes:[t]}),E["fork-ps-2"]&&L.showToast(`${e} could not be loaded. It may not have been loaded.`,{type:"error"}),L.err("ContentManager",`${e} could not be loaded.`,t);const n=Object.values(k).find(t=>t.filename==e);L.log("ContentManager",`${n.name} v${n.version} was loaded.`),E["fork-ps-2"]&&L.showToast(`${n.name} v${n.version} was loaded.`,{type:"success"}),A.dispatch("theme-loaded",n.name)},j.prototype.unloadTheme=function(e){const t=Object.values(k).find(t=>t.filename==e)||k[e];if(!t)return;const n=t.name;N[n]&&this.disableTheme(n,!0);const s=V.unloadContent(k[n].filename,"theme");if(delete k[n],s)return E["fork-ps-1"]&&L.showContentErrors({themes:[s]}),E["fork-ps-2"]&&L.showToast(`${n} could not be unloaded. It may have not been loaded yet.`,{type:"error"}),L.err("ContentManager",`${n} could not be unloaded. It may have not been loaded yet.`,s);L.log("ContentManager",`${n} was unloaded.`),E["fork-ps-2"]&&L.showToast(`${n} was unloaded.`,{type:"success"}),A.dispatch("theme-unloaded",n)},j.prototype.delete=function(e){const t=Object.values(k).find(t=>t.filename==e)||k[e];if(!t)return;this.unloadTheme(t.filename);const s=n(1).resolve(V.pluginsFolder,t.filename);n(2).unlinkSync(s)},j.prototype.reloadTheme=async function(e){const t=Object.values(k).find(t=>t.filename==e)||k[e];if(!t)return this.loadTheme(e);const n=t.name,s=await V.reloadContent(k[n].filename,"theme");if(N[n]&&(this.disableTheme(n,!0),this.enableTheme(n,!0)),s)return E["fork-ps-1"]&&L.showContentErrors({themes:[s]}),E["fork-ps-2"]&&L.showToast(`${n} could not be reloaded.`,{type:"error"}),L.err("ContentManager",`${n} could not be reloaded.`,s);L.log("ContentManager",`${n} v${k[n].version} was reloaded.`),E["fork-ps-2"]&&L.showToast(`${n} v${k[n].version} was reloaded.`,{type:"success"}),A.dispatch("theme-reloaded",n)},j.prototype.reload=function(e){return this.reloadTheme(e)},j.prototype.edit=function(e){const t=Object.values(k).find(t=>t.filename==e)||k[e];if(!t)return;const s=n(1).resolve(V.themesFolder,t.filename);n(0).shell.openItem(`${s}`)},j.prototype.updateThemeList=function(){const e=V.loadNewContent("theme");for(const t of e.added)this.loadTheme(t);for(const t of e.removed)this.unloadTheme(t)},j.prototype.loadThemeData=function(){const e=X.getSettingGroup("themes");e&&Object.assign(N,e)},j.prototype.saveThemeData=function(){X.setSettingGroup("themes",N)};var O=new j,I=n(4);const _=n(1),F=n(2),W=n(6).Module;W.globalPaths.push(_.resolve(n(0).remote.app.getAppPath(),"node_modules"));class H extends Error{constructor(e){super(e),this.name="MetaError"}}const z=W._extensions[".js"],U=W._extensions[".css"]?W._extensions[".css"]:()=>null,q=/[^\S\r\n]*?(?:\r\n|\n)[^\S\r\n]*?\*[^\S\r\n]?/,G=/^\\@/;var V=new class{constructor(){this.timeCache={},this.watchers={},W._extensions[".js"]=this.getContentRequire("plugin"),W._extensions[".css"]=this.getContentRequire("theme")}get pluginsFolder(){return this._pluginsFolder||(this._pluginsFolder=F.realpathSync(_.resolve(D.dataPath+"plugins/")))}get themesFolder(){return this._themesFolder||(this._themesFolder=F.realpathSync(_.resolve(D.dataPath+"themes/")))}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]=F.watch(n,{persistent:!1},async(e,r)=>{if(!e||!r||!r.endsWith(s))return;await new Promise(e=>setTimeout(e,50));try{F.statSync(_.resolve(n,r))}catch(e){if("ENOENT"!==e.code)return;return delete this.timeCache[r],t?R.unloadPlugin(r):O.unloadTheme(r)}if(!F.statSync(_.resolve(n,r)).isFile())return;const o=F.statSync(_.resolve(n,r));o&&o.mtime&&o.mtime.getTime()&&"number"==typeof o.mtime.getTime()&&this.timeCache[r]!=o.mtime.getTime()&&(this.timeCache[r]=o.mtime.getTime(),"rename"==e&&(t?await R.loadPlugin(r):await O.loadTheme(r)),"change"==e&&(t?await R.reloadPlugin(r):await O.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 H("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 H("META was not found.");const s=L.testJSON(n);if(!s)throw new H("META could not be parsed.");if(!s.name)throw new H("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(q))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(G,"@");return n[s]=r.trim(),delete n[""],n.format="jsdoc",n}getContentRequire(e){const t="plugin"===e,n=this,s=t?z:U;return function(e,r){const o=t?n.pluginsFolder:n.themesFolder,a=_.resolve(o,_.basename(r));if(!F.existsSync(a)||r!==F.realpathSync(a))return Reflect.apply(s,this,arguments);let i=F.readFileSync(r,"utf8");i=L.stripBOM(i);const l=F.statSync(r),c=n.extractMeta(i);if(c.filename=_.basename(r),c.added=l.atimeMs,c.modified=l.mtimeMs,c.size=l.size,t||(c.css=i,"json"==c.format&&(c.css=c.css.split("\n").slice(1).join("\n")),i=`module.exports = ${JSON.stringify(c)};`),t){e._compile(i,e.filename),!L.isEmpty(e.exports)?(c.type=e.exports,e.exports=c,i=""):i+=`\nmodule.exports = ${JSON.stringify(c)};\nmodule.exports.type = ${c.exports||c.name};`}e._compile(i,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;try{window.require(_.resolve(s,e))}catch(t){return{name:e,file:e,message:"Could not be compiled.",error:{message:t.message,stack:t.stack}}}const r=window.require(_.resolve(s,e));if(!r.name)return{name:e,file:e,message:"Cannot escape the ID.",error:{message:"Cannot read property 'replace' of undefined",stack:"Cannot read property 'replace' of undefined"}};if(r.id=L.escapeID(r.name),n){if(!r.type)return;try{r.plugin=new r.type,delete M[r.plugin.getName()],M[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 k[r.name],k[r.name]=r}unloadContent(e,t){if(void 0===e||void 0===t)return;const n="plugin"===t?this.pluginsFolder:this.themesFolder;try{delete window.require.cache[window.require.resolve(_.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{window.require.cache[window.require.resolve(_.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=F.readdirSync(s),o=Object.values(t?M:k),a=o.filter(e=>!r.includes(e.filename)).map(e=>t?e.plugin.getName():e.name);return{added:r.filter(e=>!o.find(t=>t.filename==e)&&e.endsWith(n)&&F.statSync(_.resolve(s,e)).isFile()),removed:a}}async loadAllContent(e){const t="plugin"===e,n=t?".plugin.js":".theme.css",s=t?this.pluginsFolder:this.themesFolder,r=[],o=F.readdirSync(s);for(const t of o){if(!F.statSync(_.resolve(s,t)).isFile()||!t.endsWith(n))continue;const o=await this.loadContent(t,e);o&&r.push(o)}return r}loadPlugins(){return this.loadAllContent("plugin")}loadThemes(){return this.loadAllContent("theme")}};const J=window.require,Z=n(2),Y=n(1),K=DiscordNative.globals?DiscordNative.globals.releaseChannel:DiscordNative.app?DiscordNative.app.getReleaseChannel():"stable";var X=new class{constructor(){this.data={settings:{stable:{},canary:{},ptb:{}}},this.pluginData={}}initialize(){try{Z.existsSync(this.BDFile)||Z.writeFileSync(this.BDFile,JSON.stringify(this.data,null,4),"binary");const e=JSON.parse(Z.readFileSync(this.BDFile,"binary"));if(e.hasOwnProperty("settings")&&(this.data=e),!Z.existsSync(this.settingsFile))return;let t=J(this.settingsFile);Z.unlinkSync(this.settingsFile),t=t.hasOwnProperty("settings")?Object.assign({stable:{},canary:{},ptb:{}},{[K]:t}):Object.assign({stable:{},canary:{},ptb:{}},t),this.setBDData("settings",t)}catch(e){console.error(e),L.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=Y.resolve(this.injectionPath,"betterdiscord","config.json"))}get BDFile(){return this._BDFile||(this._BDFile=Y.resolve(D.dataPath,"bdstorage.json"))}get settingsFile(){return this._settingsFile||(this._settingsFile=Y.resolve(D.dataPath,"bdsettings.json"))}getPluginFile(e){return Y.resolve(V.pluginsFolder,e+".config.json")}getSettingGroup(e){return this.data.settings[K][e]||null}setSettingGroup(e,t){this.data.settings[K][e]=t,Z.writeFileSync(this.BDFile,JSON.stringify(this.data,null,4),"binary")}getBDData(e){return this.data[e]||""}setBDData(e,t){this.data[e]=t,Z.writeFileSync(this.BDFile,JSON.stringify(this.data,null,4),"binary")}getPluginData(e,t){return void 0!==this.pluginData[e]?this.pluginData[e][t]:Z.existsSync(this.getPluginFile(e))?(this.pluginData[e]=JSON.parse(Z.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,Z.writeFileSync(this.getPluginFile(e),JSON.stringify(this.pluginData[e],null,4),"binary"))}deletePluginData(e,t){void 0===this.pluginData[e]&&(this.pluginData[e]={}),delete this.pluginData[e][t],Z.writeFileSync(this.getPluginFile(e),JSON.stringify(this.pluginData[e],null,4),"binary")}};class Q extends o.reactComponent{constructor(e){super(e)}render(){return o.react.createElement("div",{className:"ui-tab-bar-separator margin-top-8 margin-bottom-8"})}}class ee extends o.reactComponent{constructor(e){super(e)}render(){return o.react.createElement("div",{className:"ui-tab-bar-header"},this.props.text,this.props.button)}}class te extends o.reactComponent{constructor(e){super(e),this.setInitialState(),this.onClick=this.onClick.bind(this)}setInitialState(){this.state={selected:this.props.selected||!1}}render(){return o.react.createElement("div",{className:`ui-tab-bar-item${this.props.selected?" selected":""}`,onClick:this.onClick},this.props.text)}onClick(){this.props.onClick&&this.props.onClick(this.props.id)}}o.reactComponent;const ne=o.React;ne.Component;let se,re;function oe(){return se||(se=d("tooltip","tooltipBlack"))}function ae(){return re||(re=d("layer","layerContainer"))}const ie=function(e){const t=e[0].toUpperCase()+e.slice(1),n=oe()[`tooltip${t}`];return n||null},le=function(e){return!!ie(e)},ce=function(e){return`${e}px`};class de{constructor(e,t,n={}){const{style:s="black",side:r="top",preventFlip:o=!1,disabled:a=!1}=n;if(this.node=e instanceof jQuery?e[0]:e,this.label=t,this.style=s.toLowerCase(),this.side=r.toLowerCase(),this.preventFlip=o,this.disabled=a,!le(this.side))return L.err("EmulatedTooltip",`Side ${this.side} does not exist.`);if(!le(this.style))return L.err("EmulatedTooltip",`Style ${this.style} does not exist.`);this.element=document.createElement("div"),this.element.className=ae().layer+" "+ae().disabledPointerEvents,this.tooltipElement=document.createElement("div"),this.tooltipElement.className=`${oe().tooltip} ${ie(this.style)}`,this.labelElement=document.createElement("div"),this.labelElement.className=oe().tooltipContent;const i=document.createElement("div");i.className=oe().tooltipPointer,this.tooltipElement.append(i),this.tooltipElement.append(this.labelElement),this.element.append(this.tooltipElement),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("."+BDModules.get(e=>e.popouts)[0].popouts.split(" ")[0]+" ~ ."+BDModules.get(e=>e.layerContainer)[0].layerContainer.split(" ")[0])}get canShowAbove(){return this.node.getBoundingClientRect().top-this.element.offsetHeight>=0}get canShowBelow(){return this.node.getBoundingClientRect().top+this.node.offsetHeight+this.element.offsetHeight<=L.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<=L.screenWidth}hide(){this.element.remove(),this.tooltipElement.className=this._className}show(){this.tooltipElement.className=`${oe().tooltip} ${ie(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(ie("top")),this.element.style.setProperty("top",ce(this.node.getBoundingClientRect().top-this.element.offsetHeight-10)),this.centerHorizontally()}showBelow(){this.tooltipElement.classList.add(ie("bottom")),this.element.style.setProperty("top",ce(this.node.getBoundingClientRect().top+this.node.offsetHeight+10)),this.centerHorizontally()}showLeft(){this.tooltipElement.classList.add(ie("left")),this.element.style.setProperty("left",ce(this.node.getBoundingClientRect().left-this.element.offsetWidth-10)),this.centerVertically()}showRight(){this.tooltipElement.classList.add(ie("right")),this.element.style.setProperty("left",ce(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",ce(e-this.element.offsetWidth/2))}centerVertically(){const e=this.node.getBoundingClientRect().top+this.node.offsetHeight/2;this.element.style.setProperty("top",ce(e-this.element.offsetHeight/2))}}var ue=class extends o.reactComponent{constructor(e){super(e)}async componentDidMount(){const{style:e="black",side:t="top",text:n=""}=this.props;this.node=o.reactDom.findDOMNode(this),this.tooltip=new de(this.node,n,{style:e,side:t})}componentWillUnmount(){this.tooltip.hide(),delete this.tooltip}render(){return this.props.children}};class pe{constructor(){this.panels={}}register(e,t){this.panels[e]=t}getComponent(e){return this.panels[e]}get items(){return[{text:"BetterDiscord Settings",id:"core"},{text:"Plugins",id:"plugins"},{text:"Themes",id:"themes"},{text:"Custom CSS",id:"customcss"}]}get LCitems(){let e=[{text:"Lightcord Settings",id:"lightcord"},{text:"RichPresence",id:"status"},{text:"Account Info",id:"accountinfo"}];return window.Lightcord.Settings.devMode&&e.push({text:"Api Components Preview",id:"lcapipreview"}),e}render(){return[{section:"HEADER",label:"Lightcord"},...this.LCitems.map(e=>({section:e.id,label:e.text,element:this.getComponent(e.id)})),{section:"DIVIDER"},{section:"HEADER",label:"Bandaged BD"},...this.items.map(e=>({section:e.id,label:e.text,element:this.getComponent(e.id)})),{section:"DIVIDER"}]}}var he=new class{injectColoredText(){this.cancelColoredText||o.MessageComponent&&(this.cancelColoredText=L.monkeyPatch(o.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=E["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","")})}},me=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(!E["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=L.monkeyPatch(o.TimeFormatter,"calendarFormat",{after:t}),s=L.monkeyPatch(o.TimeFormatter,"dateFormat",{after:t});this.cancel24Hour=()=>{n(),s()}}remove24Hour(){this.cancel24Hour&&this.cancel24Hour()}};const ge=n(0),fe=n(2),be=n(1),ve=ge.remote.BrowserWindow,ye=ge.remote.getCurrentWebContents();var Ee=new class{constructor(){let e="";if(e="win32"===process.platform?be.resolve(process.env.LOCALAPPDATA,"Google/Chrome/User Data"):"linux"===process.platform?be.resolve(process.env.HOME,".config/google-chrome"):"darwin"===process.platform?be.resolve(process.env.HOME,"Library/Application Support/Google/Chrome"):be.resolve(process.env.HOME,".config/chromium"),e+="/Default/Extensions/fmkadmapgofadopljbjfkapdkoienihi/",fe.existsSync(e)){const t=fe.readdirSync(e);e=be.resolve(e,t[t.length-1])}this.extensionPath=e,this.isExtensionInstalled=fe.existsSync(e),this.listener=this.listener.bind(this),v["React DevTools"].hidden=!this.isExtensionInstalled}listener(){if(!this.isExtensionInstalled)return;ve.removeDevToolsExtension("React Developer Tools"),ve.addDevToolsExtension(this.extensionPath)?L.log("React DevTools","Successfully installed react devtools."):L.err("React DevTools","Couldn't find react devtools in chrome extensions!")}start(){setImmediate(()=>ye.on("devtools-opened",this.listener)),ye.isDevToolsOpened()&&this.listener()}stop(){ye.removeListener("devtools-opened",this.listener)}};class we extends o.reactComponent{constructor(e){super(e)}render(){return o.react.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 12 12",style:{width:"18px",height:"18px"}},o.react.createElement("g",{className:"background",fill:"none",fillRule:"evenodd"},o.react.createElement("path",{d:"M0 0h12v12H0"}),o.react.createElement("path",{className:"fill",fill:"#dcddde",d:"M9.5 3.205L8.795 2.5 6 5.295 3.205 2.5l-.705.705L5.295 6 2.5 8.795l.705.705L6 6.705 8.795 9.5l.705-.705L6.705 6"})))}}class Ce extends o.reactComponent{constructor(e){super(e),this.onClick=this.onClick.bind(this)}render(){let e=BDModules.get(e=>e.toolsContainer)[0],t=BDModules.get(e=>e.container&&e.closeButton&&e.closeButtonBold)[0];return o.react.createElement("div",{className:"tools-container "+e.toolsContainer},o.react.createElement("div",{className:"tools "+e.tools},o.react.createElement("div",{className:t.container},o.react.createElement("div",{className:"btn-close "+t.closeButton,onClick:this.onClick},o.react.createElement(we,null)),o.react.createElement("div",{className:"esc-text "+t.keybind},"ESC"))))}onClick(){this.props.onClick&&this.props.onClick();const e=document.querySelector("."+BDModules.get(e=>e.closeButton&&e.keybindBold)[0].closeButton.split(" ")[0]);e&&e.click()}}class Se extends o.reactComponent{constructor(e){super(e)}render(){return o.react.createElement("h2",{className:"ui-form-title h2 margin-reset margin-bottom-20"},this.props.text)}}class xe extends o.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 o.react.createElement("div",{className:`${t.card} ${t.cardPrimary} ${BDModules.get(e=>e.marginBottom8)[0].marginBottom8} bd-server-card${e.pinned?" bd-server-card-pinned":""}`},o.react.createElement("img",{ref:"img",className:"bd-server-image",src:e.iconUrl,onError:this.handleError.bind(this),draggable:!1}),o.react.createElement("div",{className:n.flexChild+" bd-server-content"},o.react.createElement("div",{className:n.horizontal+" "+s.noWrap+" bd-server-header"},o.react.createElement("h5",{className:"h5-18_1nd defaultColor-1_ajX0 margin-reset bd-server-name"},e.name),o.react.createElement("h5",{className:"h5-18_1nd defaultColor-1_ajX0 margin-reset bd-server-member-count"},e.members," Members")),o.react.createElement("div",{className:n.horizontal+" "+s.noWrap},o.react.createElement("div",{className:"scrollerWrap-2lJEkd scrollerThemed-2oenus themeGhostHairline-DBD-2d scrollerFade-1Ijw5y bd-server-description-container"},o.react.createElement("div",{className:"scroller-2FKFPG scroller bd-server-description"},e.description))),o.react.createElement("div",{className:"flex-1xMQg5 flex-1O1GKY horizontal-1ae9ci horizontal-2EEEnY directionRow-3v3tfG noWrap-3jynv6 bd-server-footer"},o.react.createElement("div",{className:"flexChild-faoVW3 bd-server-tags",style:{flex:"1 1 auto"}},e.categories.join(", ")),this.state.joined&&o.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"}},o.react.createElement("div",{className:"ui-button-contents"},"Joined")),e.error&&o.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"}},o.react.createElement("div",{className:"ui-button-contents"},"Error")),!e.error&&!this.state.joined&&o.react.createElement("button",{type:"button",className:"button-38aScr lookFilled-1Gx00P colorBrand-3pXr91 sizeMin-1mJd1x grow-q77ONN",style:{minHeight:"12px",marginTop:"4px"},onClick:()=>{this.join()}},o.react.createElement("div",{className:"ui-button-contents"},"Join")))))}handleError(){this.props.server.iconUrl=this.props.fallback,this.setState({imageError:!0})}join(){this.props.join(this)}}class De extends o.reactComponent{constructor(e){super(e)}render(){let e=BDModules.get(e=>e.scrollerHorizontal)[0],t=BDModules.get(e=>e.sidebarRegionScroller)[0],n=`${e.scrollerWrap} ${e.scrollerThemed} ${e.themeGhostHairline}${this.props.fade?" "+e.scrollerFade:""}`,s=e.scroller+" scroller";this.props.sidebar&&(s+=` ${t.sidebarRegionScroller} sidebar-region-scroller`),this.props.contentColumn&&(s+=" "+t.contentRegionScroller+" content-region-scroller",n=`${e.scrollerWrap} ${t.contentRegionScrollerWrap} content-region-scroller-wrap ${e.scrollerThemed} ${e.themeGhost} ${e.scrollerTrack}`);const{children:r}=this.props;return o.react.createElement("div",{key:"scrollerwrap",className:n},o.react.createElement("div",{key:"scroller",ref:"scroller",className:s},r))}}class ke extends o.reactComponent{constructor(e){super(e)}render(){const{sidebar:e,content:t,tools:n}=this.props.children;return o.react.createElement("div",{className:"standardSidebarView-3F1I7i ui-standard-sidebar-view"},o.react.createElement("div",{className:"sidebarRegion-VFTUkN sidebar-region"},o.react.createElement(De,{key:"sidebarScroller",ref:"sidebarScroller",sidebar:!0,fade:e.fade||!0,dark:e.dark||!0},e.component)),o.react.createElement("div",{className:"contentRegion-3nDuYy content-region"},o.react.createElement("div",{className:"contentTransitionWrap-3hqOEW content-transition-wrap"},o.react.createElement("div",{className:"scrollerWrap-2lJEkd firefoxFixScrollFlex-cnI2ix contentRegionScrollerWrap-3YZXdm content-region-scroller-wrap scrollerThemed-2oenus themeGhost-28MSn0 scrollerTrack-1ZIpsv"},o.react.createElement("div",{className:"scroller-2FKFPG firefoxFixScrollFlex-cnI2ix contentRegionScroller-26nc1e content-region-scroller scroller",ref:"contentScroller"},o.react.createElement("div",{className:"contentColumn-2hrIYH contentColumnDefault-1VQkGM content-column default"},t.component),n.component)))))}}class Me extends o.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=o.WebpackModules.findByUniqueProperties(["getGuilds"]),this.AvatarDefaults=o.WebpackModules.findByUniqueProperties(["getUserAvatarURL","DEFAULT_AVATARS"]),this.InviteActions=o.WebpackModules.findByUniqueProperties(["acceptInvite"]),this.SortedGuildStore=o.WebpackModules.findByUniqueProperties(["getSortedGuilds"])}componentDidMount(){this.checkConnection()}setInitialState(){this.state={selectedCategory:-1,title:"Loading...",loading:!0,servers:[],next:null,connection:{state:0,user:null}}}close(){o.reactDom.unmountComponentAtNode(document.getElementById(this.props.rootId))}search(e,t){const n=this;fetch(`${n.endPoint}${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 o=s.size+s.from;s.next=`?from=${o}`,n.state.term&&(s.next+=`&term=${n.state.term}`),n.state.selectedCategory&&(s.next+=`&category=${n.categoryButtons[n.state.selectedCategory]}`),o>=s.total&&(o=s.total,s.next=null);let a=`Showing 1-${o} of ${s.total} results in ${n.categoryButtons[n.state.selectedCategory]}`;n.state.term&&(a+=` for ${n.state.term}`),n.setState({loading:!1,title:a,servers:r,next:s.next}),t&&(n.refs.sbv.refs.contentScroller.scrollTop=0)}).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),e.joinWindow=new(window.require("electron").remote.BrowserWindow)(t);e.joinWindow.webContents.on("did-navigate",(t,n)=>{"https://auth.discordservers.com/info"==n&&(e.joinWindow.close(),e.checkConnection())}),e.joinWindow.loadURL("https://auth.discordservers.com/connect?scopes=guilds.join&previousUrl=https://auth.discordservers.com/info")}get windowOptions(){return{width:500,height:550,backgroundColor:"#282b30",show:!0,resizable:!1,maximizable:!1,minimizable:!1,alwaysOnTop:!0,frame:!1,center:!1,webPreferences:{nodeIntegration:!1}}}get bdServer(){const e=this.SortedGuildStore.getFlattenedGuildIds(),t=this.AvatarDefaults.DEFAULT_AVATARS;return[o.react.createElement(xe,{server:{name:"Lightcord",online:"30+",members:"50+",categories:["community","programming","support"],description:"Official Lightcord server for support etc",identifier:"86004744966914048",iconUrl:"https://avatars3.githubusercontent.com/u/65690058?s=200&v=4",nativejoin:!0,invite_code:"7eFff2A",pinned:!0},pinned:!0,join:this.join,guildList:e,fallback:t[Math.floor(5*Math.random())]}),o.react.createElement(xe,{server:{name:"BetterDiscord",online:"7500+",members:"20000+",categories:["community","programming","support"],description:"Official BetterDiscord server for support etc",identifier:"86004744966914048",iconUrl:"https://cdn.discordapp.com/icons/86004744966914048/292e7f6bfff2b71dfd13e508a859aedd.webp",nativejoin:!0,invite_code:"0Tmfo5ZbORCRqbAd",pinned:!0},pinned:!0,join:this.join,guildList:e,fallback:t[Math.floor(5*Math.random())]})]}get endPoint(){return"https://search.discordservers.com"}get joinEndPoint(){return"https://j.discordservers.com"}get connectEndPoint(){return"https://join.discordservers.com/connect"}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.json();e.setState({selectedCategory:0,connection:{state:2,user:n}}),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 o.react.createElement(ke,{ref:"sbv"},this.component)}get component(){return{sidebar:{component:this.sidebar},content:{component:this.content},tools:{component:o.react.createElement(Ce,{key:"pt",ref:"tools",onClick:this.close})}}}get sidebar(){return o.react.createElement("div",{className:"sidebar",key:"ps"},o.react.createElement("div",{className:"ui-tab-bar SIDE"},o.react.createElement("div",{className:"ui-tab-bar-header",style:{fontSize:"16px"}},"Public Servers"),o.react.createElement(Q,null),this.searchInput,o.react.createElement(Q,null),o.react.createElement(ee,{text:"Categories"}),this.categoryButtons.map((e,t)=>o.react.createElement(te,{id:t,onClick:this.changeCategory,key:t,text:e,selected:this.state.selectedCategory===t})),o.react.createElement(Q,null),this.footer,this.connection))}get searchInput(){return o.react.createElement("div",{className:"ui-form-item"},o.react.createElement("div",{className:"ui-text-input flex-vertical",style:{width:"172px",marginLeft:"10px"}},o.react.createElement("input",{ref:"searchinput",onKeyDown:this.searchKeyDown,onChange:()=>{},type:"text",className:"input default",placeholder:"Search...",maxLength:"50"})))}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 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.refs.searchinput.value="",t.setState({loading:!0,selectedCategory:e,title:"Loading...",term:null}),0!==e?t.search(`?category=${t.categoryButtons[e]}`,!0):t.search("",!0))}get content(){const e=this,t=this.SortedGuildStore.getFlattenedGuildIds(),n=this.AvatarDefaults.DEFAULT_AVATARS;if(1===e.state.connection.state)return e.notConnected;let s=BDModules.get(e=>e.contentColumnDefault)[0];return[o.react.createElement("div",{ref:"content",key:"pc",className:s.contentColumn+" "+s.contentColumn+" content-column default"},o.react.createElement(Se,{text:e.state.title}),e.bdServer,e.state.servers.map(s=>o.react.createElement(xe,{key:s.identifier,server:s,join:e.join,guildList:t,fallback:n[Math.floor(5*Math.random())]})),e.state.next&&o.react.createElement("button",{type:"button",onClick:()=>{e.state.loading||(e.setState({loading:!0}),e.search(e.state.next,!1))},className:"ui-button filled brand small grow",style:{width:"100%",marginTop:"10px",marginBottom:"10px"}},o.react.createElement("div",{className:"ui-button-contents"},e.state.loading?"Loading":"Load More")),e.state.servers.length>0&&o.react.createElement(Se,{text:e.state.title}))]}get notConnected(){let e=BDModules.get(e=>e.contentColumnDefault)[0];return[o.react.createElement("div",{key:"ncc",ref:"content",className:e.contentColumn+" "+e.contentColumn+" content-column default"},o.react.createElement("h2",{className:"ui-form-title h2 margin-reset margin-bottom-20"},"Not connected to discordservers.com!",o.react.createElement("button",{onClick:this.connect,type:"button",className:"ui-button filled brand small grow",style:{display:"inline-block",minHeight:"18px",marginLeft:"10px",lineHeight:"14px"}},o.react.createElement("div",{className:"ui-button-contents"},"Connect"))),this.bdServer)]}get footer(){return o.react.createElement("div",{className:"ui-tab-bar-header"},o.react.createElement("a",{href:"https://discordservers.com",target:"_blank"},"Discordservers.com"))}get connection(){const{connection:e}=this.state;return 2!==e.state?o.react.createElement("span",null):o.react.createElement("span",null,o.react.createElement(Q,null),o.react.createElement("span",{style:{color:"#b9bbbe",fontSize:"10px",marginLeft:"10px"}},"Connected as: ",`${e.user.username}#${e.user.discriminator}`),o.react.createElement("div",{style:{padding:"5px 10px 0 10px"}},o.react.createElement("button",{style:{width:"100%",minHeight:"20px"},type:"button",className:"ui-button filled brand small grow"},o.react.createElement("div",{className:"ui-button-contents",onClick:this.connect},"Reconnect"))))}}class Be extends o.reactComponent{constructor(e){super(e),this.keyupListener=this.keyupListener.bind(this)}keyupListener(e){27===e.which&&o.reactDom.unmountComponentAtNode(this.refs.root.parentNode)}componentDidMount(){window.addEventListener("keyup",this.keyupListener);const e=P.query(`#${this.props.id}`);P.animate({duration:200,update:function(t){e.style.transform=`scale(${1.1-.1*t}) translateZ(0px)`,e.style.opacity=t,1==t&&setImmediate(()=>{e.style.transform="",e.style.opacity=""})}})}componentWillUnmount(){window.removeEventListener("keyup",this.keyupListener);const e=P.query(`#${this.props.id}`);P.animate({duration:200,update:function(t){e.style.transform=`scale(${1.1-.1*(1-t)}) translateZ(0px)`,e.style.opacity=1-t,1==t&&setImmediate(()=>{e.remove()})}});const t=P.query(".publicServersOpen");t.classList.remove("publicServersOpen"),P.animate({duration:200,update:function(e){t.style.transform=`scale(${.07*e+.93}) translateZ(0px)`,t.style.opacity=e,1==e&&setImmediate(()=>{t.style.transform="",t.style.opacity=""})}})}componentWillMount(){const e=P.query('[class*="layer-"]');e.classList.add("publicServersOpen"),P.animate({duration:200,update:function(t){e.style.transform=`scale(${.07*(1-t)+.93}) translateZ(0px)`,e.style.opacity=1-t}})}render(){return o.react.createElement("div",{className:"layer bd-layer "+BDModules.get(e=>e.layer&&e.animating)[0].layer,id:this.props.id,ref:"root",style:{opacity:0,transform:"scale(1.1) translateZ(0px)"}},this.props.children)}}var Ne=new class{constructor(){this._appendButton=this._appendButton.bind(this)}get component(){return o.react.createElement(Be,{rootId:"pubslayerroot",id:"pubslayer"},o.react.createElement(Me,{rootId:"pubslayerroot"}))}get root(){const e=document.getElementById("pubslayerroot");return e||(this.injectRoot()?this.root:null)}injectRoot(){let[e]=[BDModules.get(e=>e.layers&&e.layer)[0].layers.split(" ")[0]];const t=P.query(".layers, ."+e);return!!t&&(t.append(P.createElement("
")),!0)}render(){const e=this.root;e?o.reactDom.render(this.component,e):console.log("FAILED TO LOCATE ROOT: .layers")}get button(){const e=P.createElement(`