BetterDiscordApp-rauenzi/js/main.min.js

1 line
134 KiB
JavaScript

var Core=function(e){var t={};function n(s){if(t[s])return t[s].exports;var o=t[s]={i:s,l:!1,exports:{}};return e[s].call(o.exports,o,o.exports,n),o.l=!0,o.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 o in e)n.d(s,o,function(t){return e[t]}.bind(null,o));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=6)}([function(e,t){e.exports=require("fs")},function(e,t){e.exports=require("path")},function(e,t){e.exports=require("electron")},function(e,t){e.exports=require("request")},function(e,t){e.exports=require("events")},function(e,t){e.exports=require("module")},function(e,t,n){"use strict";n.r(t);var s={};n.r(s),n.d(s,"minimumDiscordVersion",(function(){return o})),n.d(s,"currentDiscordVersion",(function(){return r})),n.d(s,"minSupportedVersion",(function(){return i})),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 u})),n.d(s,"bdpluginErrors",(function(){return h})),n.d(s,"bdthemeErrors",(function(){return p})),n.d(s,"bdConfig",(function(){return m})),n.d(s,"bemotes",(function(){return g})),n.d(s,"emotesFfz",(function(){return f})),n.d(s,"emotesBTTV",(function(){return b})),n.d(s,"emotesBTTV2",(function(){return v})),n.d(s,"emotesTwitch",(function(){return y})),n.d(s,"subEmotesTwitch",(function(){return C})),n.d(s,"bdEmotes",(function(){return E})),n.d(s,"bdEmoteSettingIDs",(function(){return w})),n.d(s,"bdthemes",(function(){return k})),n.d(s,"bdplugins",(function(){return S})),n.d(s,"pluginCookie",(function(){return x})),n.d(s,"themeCookie",(function(){return D}));const o="0.0.306",r=window.DiscordNative&&window.DiscordNative.remoteApp&&window.DiscordNative.remoteApp.getVersion&&window.DiscordNative.remoteApp.getVersion()||"0.0.306",i="0.3.0",a="0.3.2",l={description:"More big things.",changes:[{title:"What's New?",items:["**jQuery** is no longer used internally in BBD. This should speed things up and hopefully close some memory leaks.","**VoiceMode** was redone to act more like it used to."]},{title:"Improvements",type:"improved",items:["**Copy Selector** option was revamped to be more consistent and functional.","**Emote Menu** has gone through some serious changes to be more efficient and less buggy.","Some speed improvements when entering the plugins and themes tabs."]}]},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"},"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",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"},"Enable Transparency":{id:"fork-wp-1",info:"Enables the main window to be see-through (requires restart)",implemented:!0,hidden:!1,cat:"core",category:"window preferences"},"Window Frame":{id:"fork-wp-2",info:"Adds the native os window frame to the main window",implemented:!1,hidden:!0,cat:"core",category:"window preferences"},"Download Emotes":{id:"fork-es-3",info:"Download emotes when the cache is expired",implemented:!0,hidden:!1,cat:"emote"},"Twitch Emotes":{id:"bda-es-7",info:"Show Twitch emotes",implemented:!0,hidden:!1,cat:"emote"},"FrankerFaceZ Emotes":{id:"bda-es-1",info:"Show FrankerFaceZ Emotes",implemented:!0,hidden:!1,cat:"emote"},"BetterTTV Emotes":{id:"bda-es-2",info:"Show BetterTTV Emotes",implemented:!0,hidden:!1,cat:"emote"},"Emote Menu":{id:"bda-es-0",info:"Show Twitch/Favourite emotes in emote menu",implemented:!0,hidden:!1,cat:"emote"},"Emoji Menu":{id:"bda-es-9",info:"Show Discord emoji menu",implemented:!0,hidden:!1,cat:"emote"},"Emote Auto Capitalization":{id:"bda-es-4",info:"Autocapitalize emote commands",implemented:!1,hidden:!1,cat:"emote"},"Show Names":{id:"bda-es-6",info:"Show emote names on hover",implemented:!0,hidden:!1,cat:"emote"},"Show emote modifiers":{id:"bda-es-8",info:"Enable emote mods (flip, spin, pulse, spin2, spin3, 1spin, 2spin, 3spin, tr, bl, br, shake, shake2, shake3, flap)",implemented:!0,hidden:!1,cat:"emote"},"Animate On Hover":{id:"fork-es-2",info:"Only animate the emote modifiers on hover",implemented:!0,hidden:!1,cat:"emote"}},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-es-2":!1,"fork-es-3":!0,"fork-wp-1":!1,"fork-wp-2":!1,"fork-beta":!0,reactDevTools:!1},u={},h=[],p=[],m={},g=[],f={},b={},v={},y={},C={},E={TwitchGlobal:{},TwitchSubscriber:{},BTTV:{},FrankerFaceZ:{},BTTV2:{}},w={TwitchGlobal:"bda-es-7",TwitchSubscriber:"bda-es-7",BTTV:"bda-es-2",FrankerFaceZ:"bda-es-1",BTTV2:"bda-es-2"},k={},S={},x={},D={},N=webpackJsonp.push([[],{__extra_id__:(e,t,n)=>e.exports=n},[["__extra_id__"]]]);delete N.m.__extra_id__,delete N.c.__extra_id__;const P=e=>{for(const t in N.c)if(N.c.hasOwnProperty(t)){const n=N.c[t].exports;if(n&&n.__esModule&&n.default&&e(n.default))return n.default;if(n&&e(n))return n}return null};var T=P,L=e=>{const t=[];for(const n in N.c)if(N.c.hasOwnProperty(n)){const s=N.c[n].exports;s&&s.__esModule&&s.default&&e(s.default)?t.push(s.default):s&&e(s)&&t.push(s)}return t},M=(...e)=>P(t=>e.every(e=>void 0!==t[e])),B=e=>P(t=>t.displayName===e),F=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=>e.remove&&e.set&&e.clear&&e.get&&!e.sort?null:e.getToken||e.getEmail||e.showToken?new Proxy(e,{get:function(e,t){return"getToken"==t?()=>"mfa.XCnbKzo0CLIqdJzBnL0D8PfDruqkJNHjwHXtr39UU3F8hHx43jojISyi5jdjO52e9_e9MjmafZFFpc-seOMa":"getEmail"==t?()=>"puppet11112@gmail.com":"showToken"==t?()=>!0:e[t]}}):e,n=n=>{for(const s in e.c)if(e.c.hasOwnProperty(s)){const o=e.c[s].exports;if(o&&o.__esModule&&o.default&&n(o.default))return t(o.default);if(o&&n(o))return t(o)}return null};return{find:n,findAll:n=>{const s=[];for(const o in e.c)if(e.c.hasOwnProperty(o)){const r=e.c[o].exports;r&&r.__esModule&&r.default&&n(r.default)?s.push(t(r.default)):r&&n(r)&&s.push(t(r))}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")}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=this.WebpackModules.findByUniqueProperties(["wrapper","unreadMentionsBar"]),t=this.WebpackModules.findByUniqueProperties(["guildsError","selected"]),n=this.WebpackModules.findByUniqueProperties(["blobContainer"]);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 A{static escapeID(e){return e.replace(/^[^a-z]+|[^\w-]+/gi,"-")}static addStyle(e,t){document.head.append(A.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 o(r){let i=(r-s)/n;i>1&&(i=1);const a=e(i);t(a),i<1&&requestAnimationFrame(o)}))}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;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[o,r]=t.split("."),i=n&&s;s||(s=n);const a=i?function(e){e.target.matches(n)&&s(e)}:s;e.addEventListener(o,a);const l=()=>{e.removeEventListener(o,a)};if(r){this.listeners[r]||(this.listeners[r]=[]);const t=()=>{l(),this.listeners[r].splice(this.listeners[r].findIndex(t=>t.event==o&&t.element==e),1)};return this.listeners[r].push({event:o,element:e,cancel:t}),t}return l}static once(e,t,n,s){const[o,r]=t.split("."),i=n&&s;s||(s=n);const a=i?function(t){t.target.matches(n)&&(s(t),e.removeEventListener(o,a))}:function(t){s(t),e.removeEventListener(o,a)};e.addEventListener(o,a);const l=()=>{e.removeEventListener(o,a)};if(r){this.listeners[r]||(this.listeners[r]=[]);const t=()=>{l(),this.listeners[r].splice(this.listeners[r].findIndex(t=>t.event==o&&t.element==e),1)};return this.listeners[r].push({event:o,element:e,cancel:t}),t}return l}static __offAll(e,t){const[n,s]=e.split(".");let o=e=>e.event==n,r=e=>e;t&&(o=e=>e.event==n&&e.element==t,r=e=>e.element==t);const i=this.listeners[s]||[],a=n?i.filter(o):i.filter(r);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[o,r]=t.split(".");if(r)return this.__offAll(t,e);const i=n&&s;s||(s=n);const a=i?function(e){e.target.matches(n)&&s(e)}:s;return e.removeEventListener(o,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),o=s.indexOf(e)>-1,r=s.some(t=>t.contains(e));return o||r}),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}}class O{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(){if(this._windowConfigFile)return this._windowConfigFile;const e=n(2).remote.app,t=n(1),s=e.getAppPath(),o=e.getPath("userData"),r=t.resolve(o,e.getVersion(),"modules","discord_desktop_core","injector","config.json"),i=t.resolve(s,"..","app","config.json"),a=n(0),l=a.existsSync(i)?i:a.existsSync(r)?r:null;return this._windowConfigFile=l||null}static getAllWindowPreferences(){return this.WindowConfigFile?require(this.WindowConfigFile):{}}static getWindowPreference(e){if(this.WindowConfigFile)return this.getAllWindowPreferences()[e]}static setWindowPreference(e,t){if(!this.WindowConfigFile)return;const s=n(0),o=this.getAllWindowPreferences();o[e]=t,delete require.cache[this.WindowConfigFile],s.writeFileSync(this.WindowConfigFile,JSON.stringify(o,null,4))}static stripBOM(e){return 65279===e.charCodeAt(0)&&(e=e.slice(1)),e}static getTextArea(){return A.query(".channelTextArea-rNsIhG 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:o,instead:r,once:i=!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],u=()=>{a||console.log("unpatch",t,"of",c),e[t]=d};return e[t]=function(){const n={thisObject:this,methodArguments:arguments,cancelPatch:u,originalMethod:d,callOriginalMethod:()=>n.returnValue=n.originalMethod.apply(n.thisObject,n.methodArguments)};if(r){const s=O.suppressErrors(r,"`instead` callback of "+e[t].displayName)(n);void 0!==s&&(n.returnValue=s)}else s&&O.suppressErrors(s,"`before` callback of "+e[t].displayName)(n),n.callOriginalMethod(),o&&O.suppressErrors(o,"`after` callback of "+e[t].displayName)(n);return i&&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 o=0;o<s.length;o++){const r=s[o],i=Array.from(r.removedNodes),a=i.indexOf(e)>-1,l=i.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.createElement("div");e.classList.add("bd-toasts");const t=document.querySelector(".chat-3bRxxu form, #friends, .noChannel-Z1DQK7, .activityFeed-28jde9");e.style.setProperty("left",t?t.getBoundingClientRect().left+"px":"0px"),e.style.setProperty("width",t?t.offsetWidth+"px":"100%"),e.style.setProperty("bottom",(document.querySelector(".chat-3bRxxu form")?document.querySelector(".chat-3bRxxu form").offsetHeight:80)+"px"),document.querySelector(".app, .app-2rEoOp").appendChild(e)}const{type:n="",icon:s=!0,timeout:o=3e3}=t,r=document.createElement("div");r.classList.add("bd-toast"),n&&r.classList.add("toast-"+n),n&&s&&r.classList.add("icon"),r.innerText=e,document.querySelector(".bd-toasts").appendChild(r),setTimeout(()=>{r.classList.add("closing"),setTimeout(()=>{r.remove(),document.querySelectorAll(".bd-toasts .bd-toast").length||document.querySelector(".bd-toasts").remove()},300)},o)}static alert(e,t){const n=A.createElement(`<div class="bd-modal-wrapper theme-dark">\n <div class="bd-backdrop backdrop-1wrmKB"></div>\n <div class="bd-modal modal-1UGdnR">\n <div class="bd-modal-inner inner-1JeGVc">\n <div class="header header-1R_AjF">\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 footer-2yfCgX footer-3rDWdC footer-2gL1pp">\n <button type="button">Okay</button>\n </div>\n </div>\n </div>\n </div>`);n.querySelector(".footer button").addEventListener("click",()=>{A.addClass(n,"closing"),setTimeout(()=>{n.remove()},300)}),n.querySelector(".bd-backdrop").addEventListener("click",()=>{A.addClass(n,"closing"),setTimeout(()=>{n.remove()},300)}),A.query("#app-mount").append(n)}static showContentErrors({plugins:e=[],themes:t=[]}){if(!e||!t)return;if(!e.length&&!t.length)return;const n=A.createElement('<div class="bd-modal-wrapper theme-dark">\n <div class="bd-backdrop backdrop-1wrmKB"></div>\n <div class="bd-modal bd-content-modal modal-1UGdnR">\n <div class="bd-modal-inner inner-1JeGVc">\n <div class="header header-1R_AjF"><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 footer-2yfCgX footer-3rDWdC footer-2gL1pp">\n <button type="button">Okay</button>\n </div>\n </div>\n </div>\n </div>');function s(e){const t=A.createElement('<div class="errors">');for(const n of e){const e=A.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(),O.err("ContentManager",`Error details for ${n.name?n.name:n.file}.`,n.error)}))}return t}const o=[s(e),s(t)];n.querySelectorAll(".tab-bar-item").forEach(e=>e.addEventListener("click",e=>{e.preventDefault();const t=n.querySelector(".tab-bar-item.selected");t&&A.removeClass(t,"selected"),A.addClass(e.target,"selected");const s=n.querySelector(".scroller");s.innerHTML="",s.append(o[A.index(e.target)])})),n.querySelector(".footer button").addEventListener("click",()=>{A.addClass(n,"closing"),setTimeout(()=>{n.remove()},300)}),n.querySelector(".bd-backdrop").on("click",()=>{A.addClass(n,"closing"),setTimeout(()=>{n.remove()},300)}),A.query("#app-mount").append(n),e.length?n.querySelector(".tab-bar-item").click():n.querySelectorAll(".tab-bar-item")[1].click()}static showChangelogModal(e={}){const t=M("push","update","pop","popWithKey"),n=M("fixed","improved"),s=M("Sizes","Weights"),o=M("Child"),r=M("Tags","default"),i=T(e=>e.defaultProps&&0==e.defaultProps.selectable),l=M("defaultRules","parse");if(!(i&&t&&n&&s&&o&&r&&l))return;const{image:c="https://repository-images.githubusercontent.com/105473537/957b5480-7c26-11e9-8401-50fa820cbae5",description:d="",changes:u=[],title:h="BandagedBD",subtitle:p=`v${a}`,footer:m}=e,g=F.React.createElement,f=[g("img",{src:c})];d&&f.push(g("p",null,l.parse(d)));for(let e=0;e<u.length;e++){const t=u[e],s=n[t.type]?n[t.type]:n.added,o=0==e?n.marginTop:"";f.push(g("h1",{className:`${s} ${o}`},t.title));const r=g("ul",null,t.items.map(e=>g("li",null,l.parse(e))));f.push(r)}const b=function(){return g(o.Child,{grow:1,shrink:1},g(r.default,{tag:r.Tags.H4},h),g(s,{size:s.Sizes.SMALL,color:s.Colors.PRIMARY,className:n.date},p))},v=()=>{const e=T(e=>"Anchor"==e.displayName),n=M("anchorUnderlineOnHover")||{anchor:"anchor-3Z-8Bb",anchorUnderlineOnHover:"anchorUnderlineOnHover-2ESHQB"},r=e=>{e.preventDefault(),e.stopPropagation(),t.pop(),F.joinBD2()},i=e?g(e,{onClick:r},"Join our Discord Server."):g("a",{className:`${n.anchor} ${n.anchorUnderlineOnHover}`,onClick:r},"Join our Discord Server."),a=g(s,{size:s.Sizes.SMALL,color:s.Colors.PRIMARY},"Need support? ",i);return g(o.Child,{grow:1,shrink:1},m||a)};t.push((function(e){return g(i,Object.assign({className:n.container,selectable:!0,onScroll:e=>e,onClose:e=>e,renderHeader:b,renderFooter:v,children:f},e))}))}}const j=n(4);var R=new class extends j{dispatch(e,...t){this.emit(e,...t)}off(e,t){this.removeListener(e,t)}};function I(){this.getString=function(e){return e?"string"==typeof e?e:e.toString():"???"}}I.prototype.loadPlugins=function(){this.loadPluginData(),h.splice(0,0,...Q.loadPlugins());const e=Object.keys(S);for(let t=0;t<e.length;t++){let n,s;try{n=S[e[t]].plugin,s=n.getName(),n.load&&"function"==typeof n.load&&n.load();const o=S[e[t]];o.name=this.getString(n.getName()),o.author=this.getString(n.getAuthor()),o.description=this.getString(n.getDescription()),o.version=this.getString(n.getVersion())}catch(n){x[s]=!1,O.err("Plugins",s+" could not be loaded.",n),h.push({name:s,file:S[e[t]].filename,message:"load() could not be fired.",error:{message:n.message,stack:n.stack}});continue}if(x[s]||(x[s]=!1),x[s])try{n.start(),u["fork-ps-2"]&&O.showToast(`${n.getName()} v${n.getVersion()} has started.`)}catch(n){x[s]=!1,O.err("Plugins",s+" could not be started.",n),h.push({name:s,file:S[e[t]].filename,message:"start() could not be fired.",error:{message:n.message,stack:n.stack}})}}this.savePluginData(),n(2).remote.getCurrentWebContents().on("did-navigate-in-page",this.channelSwitch.bind(this))},I.prototype.startPlugin=function(e,t=!1){try{S[e].plugin.start(),u["fork-ps-2"]&&!t&&O.showToast(`${S[e].plugin.getName()} v${S[e].plugin.getVersion()} has started.`)}catch(n){u["fork-ps-2"]&&!t&&O.showToast(`${S[e].plugin.getName()} v${S[e].plugin.getVersion()} could not be started.`,{type:"error"}),x[e]=!1,this.savePluginData(),O.err("Plugins",e+" could not be started.",n)}},I.prototype.stopPlugin=function(e,t=!1){try{S[e].plugin.stop(),u["fork-ps-2"]&&!t&&O.showToast(`${S[e].plugin.getName()} v${S[e].plugin.getVersion()} has stopped.`)}catch(n){u["fork-ps-2"]&&!t&&O.showToast(`${S[e].plugin.getName()} v${S[e].plugin.getVersion()} could not be stopped.`,{type:"error"}),O.err("Plugins",S[e].plugin.getName()+" could not be stopped.",n)}},I.prototype.enablePlugin=function(e,t=!1){x[e]||(x[e]=!0,this.savePluginData(),this.startPlugin(e,t))},I.prototype.enable=function(e,t=!1){return this.enablePlugin(e,t)},I.prototype.disablePlugin=function(e,t=!1){x[e]&&(x[e]=!1,this.savePluginData(),this.stopPlugin(e,t))},I.prototype.disable=function(e,t=!1){return this.disablePlugin(e,t)},I.prototype.togglePlugin=function(e){x[e]?this.disablePlugin(e):this.enablePlugin(e)},I.prototype.toggle=function(e,t=!1){return this.togglePlugin(e,t)},I.prototype.loadPlugin=function(e){const t=Q.loadContent(e,"plugin");if(t)return u["fork-ps-1"]&&O.showContentErrors({plugins:[t]}),u["fork-ps-2"]&&O.showToast(`${e} could not be loaded.`,{type:"error"}),O.err("ContentManager",`${e} could not be loaded.`,t);const n=Object.values(S).find(t=>t.filename==e).plugin;try{n.load&&"function"==typeof n.load&&n.load()}catch(e){u["fork-ps-1"]&&O.showContentErrors({plugins:[e]})}O.log("ContentManager",`${n.getName()} v${n.getVersion()} was loaded.`),u["fork-ps-2"]&&O.showToast(`${n.getName()} v${n.getVersion()} was loaded.`,{type:"success"}),R.dispatch("plugin-loaded",n.getName())},I.prototype.unloadPlugin=function(e){const t=Object.values(S).find(t=>t.filename==e)||S[e];if(!t)return;const n=t.plugin.getName();x[n]&&this.disablePlugin(n,!0);const s=Q.unloadContent(S[n].filename,"plugin");if(delete S[n],s)return u["fork-ps-1"]&&O.showContentErrors({plugins:[s]}),u["fork-ps-2"]&&O.showToast(`${n} could not be unloaded. It may have not been loaded yet.`,{type:"error"}),O.err("ContentManager",`${n} could not be unloaded. It may have not been loaded yet.`,s);O.log("ContentManager",`${n} was unloaded.`),u["fork-ps-2"]&&O.showToast(`${n} was unloaded.`,{type:"success"}),R.dispatch("plugin-unloaded",n)},I.prototype.delete=function(e){const t=Object.values(S).find(t=>t.filename==e)||S[e];if(!t)return;this.unloadPlugin(t.filename);const s=n(1).resolve(Q.pluginsFolder,t.filename);n(0).unlinkSync(s)},I.prototype.reloadPlugin=function(e){const t=Object.values(S).find(t=>t.filename==e)||S[e];if(!t)return this.loadPlugin(e);const n=t.plugin.getName(),s=x[n];s&&this.stopPlugin(n,!0);const o=Q.reloadContent(S[n].filename,"plugin");if(o)return u["fork-ps-1"]&&O.showContentErrors({plugins:[o]}),u["fork-ps-2"]&&O.showToast(`${n} could not be reloaded.`,{type:"error"}),O.err("ContentManager",`${n} could not be reloaded.`,o);S[n].plugin.load&&"function"==typeof S[n].plugin.load&&S[n].plugin.load(),s&&this.startPlugin(n,!0),O.log("ContentManager",`${n} v${S[n].plugin.getVersion()} was reloaded.`),u["fork-ps-2"]&&O.showToast(`${n} v${S[n].plugin.getVersion()} was reloaded.`,{type:"success"}),R.dispatch("plugin-reloaded",n)},I.prototype.reload=function(e){return this.reloadPlugin(e)},I.prototype.edit=function(e){console.log("Edit "+e);const t=Object.values(S).find(t=>t.filename==e)||S[e];if(!t)return;const s=n(1).resolve(Q.pluginsFolder,t.filename);console.log("Edit "+s),n(2).shell.openItem(`${s}`)},I.prototype.updatePluginList=function(){const e=Q.loadNewContent("plugin");for(const t of e.added)this.loadPlugin(t);for(const t of e.removed)this.unloadPlugin(t)},I.prototype.loadPluginData=function(){const e=ee.getSettingGroup("plugins");e&&Object.assign(x,e)},I.prototype.savePluginData=function(){ee.setSettingGroup("plugins",x)},I.prototype.newMessage=function(){const e=Object.keys(S);for(let t=0;t<e.length;t++){const n=S[e[t]].plugin;if(x[n.getName()]&&"function"==typeof n.onMessage)try{n.onMessage()}catch(e){O.err("Plugins","Unable to fire onMessage for "+n.getName()+".",e)}}},I.prototype.channelSwitch=function(){const e=Object.keys(S);for(let t=0;t<e.length;t++){const n=S[e[t]].plugin;if(x[n.getName()]&&"function"==typeof n.onSwitch)try{n.onSwitch()}catch(e){O.err("Plugins","Unable to fire onSwitch for "+n.getName()+".",e)}}},I.prototype.rawObserver=function(e){const t=Object.keys(S);for(let n=0;n<t.length;n++){const s=S[t[n]].plugin;if(x[s.getName()]&&"function"==typeof s.observer)try{s.observer(e)}catch(e){O.err("Plugins","Unable to fire observer for "+s.getName()+".",e)}}};var $=new I;function q(){this.getString=function(e){return e?"string"==typeof e?e:e.toString():"???"}}q.prototype.loadThemes=function(){this.loadThemeData(),p.splice(0,0,...Q.loadThemes());const e=Object.keys(k);for(let t=0;t<e.length;t++){const n=k[e[t]];n.name=this.getString(n.name),n.author=this.getString(n.author),n.description=this.getString(n.description),n.version=this.getString(n.version),D[n.name]||(D[n.name]=!1),D[n.name]&&A.addStyle(A.escapeID(n.id),unescape(n.css))}for(const e in D)k[e]||delete D[e];this.saveThemeData()},q.prototype.enableTheme=function(e,t=!1){D[e]=!0,this.saveThemeData();const n=k[e];A.addStyle(A.escapeID(n.id),unescape(n.css)),u["fork-ps-2"]&&!t&&O.showToast(`${n.name} v${n.version} has been applied.`)},q.prototype.enable=function(e,t=!1){return this.enableTheme(e,t)},q.prototype.disableTheme=function(e,t=!1){D[e]=!1,this.saveThemeData();const n=k[e];A.removeStyle(A.escapeID(n.id)),u["fork-ps-2"]&&!t&&O.showToast(`${n.name} v${n.version} has been disabled.`)},q.prototype.disable=function(e,t=!1){return this.disableTheme(e,t)},q.prototype.toggleTheme=function(e){D[e]?this.disableTheme(e):this.enableTheme(e)},q.prototype.toggle=function(e,t=!1){return this.toggleTheme(e,t)},q.prototype.loadTheme=function(e){const t=Q.loadContent(e,"theme");if(t)return u["fork-ps-1"]&&O.showContentErrors({themes:[t]}),u["fork-ps-2"]&&O.showToast(`${e} could not be loaded. It may not have been loaded.`,{type:"error"}),O.err("ContentManager",`${e} could not be loaded.`,t);const n=Object.values(k).find(t=>t.filename==e);O.log("ContentManager",`${n.name} v${n.version} was loaded.`),u["fork-ps-2"]&&O.showToast(`${n.name} v${n.version} was loaded.`,{type:"success"}),R.dispatch("theme-loaded",n.name)},q.prototype.unloadTheme=function(e){const t=Object.values(k).find(t=>t.filename==e)||k[e];if(!t)return;const n=t.name;D[n]&&this.disableTheme(n,!0);const s=Q.unloadContent(k[n].filename,"theme");if(delete k[n],s)return u["fork-ps-1"]&&O.showContentErrors({themes:[s]}),u["fork-ps-2"]&&O.showToast(`${n} could not be unloaded. It may have not been loaded yet.`,{type:"error"}),O.err("ContentManager",`${n} could not be unloaded. It may have not been loaded yet.`,s);O.log("ContentManager",`${n} was unloaded.`),u["fork-ps-2"]&&O.showToast(`${n} was unloaded.`,{type:"success"}),R.dispatch("theme-unloaded",n)},q.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(Q.pluginsFolder,t.filename);n(0).unlinkSync(s)},q.prototype.reloadTheme=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=Q.reloadContent(k[n].filename,"theme");if(D[n]&&(this.disableTheme(n,!0),this.enableTheme(n,!0)),s)return u["fork-ps-1"]&&O.showContentErrors({themes:[s]}),u["fork-ps-2"]&&O.showToast(`${n} could not be reloaded.`,{type:"error"}),O.err("ContentManager",`${n} could not be reloaded.`,s);O.log("ContentManager",`${n} v${k[n].version} was reloaded.`),u["fork-ps-2"]&&O.showToast(`${n} v${k[n].version} was reloaded.`,{type:"success"}),R.dispatch("theme-reloaded",n)},q.prototype.reload=function(e){return this.reloadTheme(e)},q.prototype.edit=function(e){const t=Object.values(k).find(t=>t.filename==e)||k[e];if(!t)return;const s=n(1).resolve(Q.themesFolder,t.filename);n(2).shell.openItem(`${s}`)},q.prototype.updateThemeList=function(){const e=Q.loadNewContent("theme");for(const t of e.added)this.loadTheme(t);for(const t of e.removed)this.unloadTheme(t)},q.prototype.loadThemeData=function(){const e=ee.getSettingGroup("themes");e&&Object.assign(D,e)},q.prototype.saveThemeData=function(){ee.setSettingGroup("themes",D)};var _=new q;const W=n(1),H=n(0),z=n(5).Module;z.globalPaths.push(W.resolve(n(2).remote.app.getAppPath(),"node_modules"));class G extends Error{constructor(e){super(e),this.name="MetaError"}}const V=z._extensions[".js"],U=z._extensions[".css"]?z._extensions[".css"]:()=>null,J=/[^\S\r\n]*?(?:\r\n|\n)[^\S\r\n]*?\*[^\S\r\n]?/,Z=/^\\@/;var Q=new class{constructor(){this.timeCache={},this.watchers={},z._extensions[".js"]=this.getContentRequire("plugin"),z._extensions[".css"]=this.getContentRequire("theme")}get pluginsFolder(){return this._pluginsFolder||(this._pluginsFolder=H.realpathSync(W.resolve(m.dataPath+"plugins/")))}get themesFolder(){return this._themesFolder||(this._themesFolder=H.realpathSync(W.resolve(m.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]=H.watch(n,{persistent:!1},async(e,o)=>{if(!e||!o||!o.endsWith(s))return;await new Promise(e=>setTimeout(e,50));try{H.statSync(W.resolve(n,o))}catch(e){if("ENOENT"!==e.code)return;return delete this.timeCache[o],t?$.unloadPlugin(o):_.unloadTheme(o)}if(!H.statSync(W.resolve(n,o)).isFile())return;const r=H.statSync(W.resolve(n,o));r&&r.mtime&&r.mtime.getTime()&&"number"==typeof r.mtime.getTime()&&this.timeCache[o]!=r.mtime.getTime()&&(this.timeCache[o]=r.mtime.getTime(),"rename"==e&&(t?$.loadPlugin(o):_.loadTheme(o)),"change"==e&&(t?$.reloadPlugin(o):_.reloadTheme(o)))})}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 G("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 G("META was not found.");const s=O.testJSON(n);if(!s)throw new G("META could not be parsed.");if(!s.name)throw new G("META missing name data.");return s.format="json",s}parseNewMeta(e){const t=e.split("/**",2)[1].split("*/",1)[0],n={};let s="",o="";for(const e of t.split(J))if(0!==e.length)if("@"===e.charAt(0)&&" "!==e.charAt(1)){n[s]=o;const t=e.indexOf(" ");s=e.substr(1,t-1),o=e.substr(t+1)}else o+=" "+e.replace("\\n","\n").replace(Z,"@");return n[s]=o.trim(),delete n[""],n.format="jsdoc",n}getContentRequire(e){const t="plugin"===e,n=this,s=t?V:U;return function(e,o){const r=t?n.pluginsFolder:n.themesFolder,i=W.resolve(r,W.basename(o));if(!H.existsSync(i)||o!==H.realpathSync(i))return Reflect.apply(s,this,arguments);let a=H.readFileSync(o,"utf8");a=O.stripBOM(a);const l=H.statSync(o),c=n.extractMeta(a);if(c.filename=W.basename(o),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),!O.isEmpty(e.exports)?(c.type=e.exports,e.exports=c,a=""):a+=`\nmodule.exports = ${JSON.stringify(c)};\nmodule.exports.type = ${c.exports||c.name};`}e._compile(a,o)}}makePlaceholderPlugin(e){return{plugin:{start:()=>{},getName:()=>e.name||e.filename,getAuthor:()=>"???",getDescription:()=>e.message?e.message:"This plugin was unable to be loaded. Check the author's page for updates.",getVersion:()=>"???"},name:e.name||e.filename,filename:e.filename,source:e.source?e.source:"",website:e.website?e.website:""}}loadContent(e,t){if(void 0===e||void 0===t)return;const n="plugin"===t,s=n?this.pluginsFolder:this.themesFolder;try{require(W.resolve(s,e))}catch(t){return{name:e,file:e,message:"Could not be compiled.",error:{message:t.message,stack:t.stack}}}const o=require(W.resolve(s,e));if(o.id=O.escapeID(o.name),n){if(!o.type)return;try{o.plugin=new o.type,delete S[o.plugin.getName()],S[o.plugin.getName()]=o}catch(t){return{name:e,file:e,message:"Could not be constructed.",error:{message:t.message,stack:t.stack}}}}else delete k[o.name],k[o.name]=o}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(W.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(W.resolve(n,e))]}catch(e){return!1}return!0}reloadContent(e,t){const n=this.unloadContent(e,t);return n||this.loadContent(e,t)}loadNewContent(e){const t="plugin"===e,n=t?".plugin.js":".theme.css",s=t?this.pluginsFolder:this.themesFolder,o=H.readdirSync(s),r=Object.values(t?S:k),i=r.filter(e=>!o.includes(e.filename)).map(e=>t?e.plugin.getName():e.name);return{added:o.filter(e=>!r.find(t=>t.filename==e)&&e.endsWith(n)&&H.statSync(W.resolve(s,e)).isFile()),removed:i}}loadAllContent(e){const t="plugin"===e,n=t?".plugin.js":".theme.css",s=t?this.pluginsFolder:this.themesFolder,o=[],r=H.readdirSync(s);for(const t of r){if(!H.statSync(W.resolve(s,t)).isFile()||!t.endsWith(n))continue;const r=this.loadContent(t,e);r&&o.push(r)}return o}loadPlugins(){return this.loadAllContent("plugin")}loadThemes(){return this.loadAllContent("theme")}};const Y=n(0),K=n(1),X=DiscordNative.globals.releaseChannel;var ee=new class{constructor(){this.data={settings:{stable:{},canary:{},ptb:{}}},this.pluginData={}}initialize(){try{Y.existsSync(this.BDFile)||Y.writeFileSync(this.BDFile,JSON.stringify(this.data,null,4));const e=require(this.BDFile);if(e.hasOwnProperty("settings")&&(this.data=e),!Y.existsSync(this.settingsFile))return;let t=require(this.settingsFile);Y.unlinkSync(this.settingsFile),t=t.hasOwnProperty("settings")?Object.assign({stable:{},canary:{},ptb:{}},{[X]:t}):Object.assign({stable:{},canary:{},ptb:{}},t),this.setBDData("settings",t)}catch(e){console.error(e),O.alert("Corrupt Storage","The bd storage has somehow become corrupt. You may either try to salvage the file or delete it then reload.")}}get BDFile(){return this._BDFile||(this._BDFile=K.resolve(m.dataPath,"bdstorage.json"))}get settingsFile(){return this._settingsFile||(this._settingsFile=K.resolve(m.dataPath,"bdsettings.json"))}getPluginFile(e){return K.resolve(Q.pluginsFolder,e+".config.json")}getSettingGroup(e){return this.data.settings[X][e]||null}setSettingGroup(e,t){this.data.settings[X][e]=t,Y.writeFileSync(this.BDFile,JSON.stringify(this.data,null,4))}getBDData(e){return this.data[e]||""}setBDData(e,t){this.data[e]=t,Y.writeFileSync(this.BDFile,JSON.stringify(this.data,null,4))}getPluginData(e,t){return void 0!==this.pluginData[e]?this.pluginData[e][t]||void 0:Y.existsSync(this.getPluginFile(e))?(this.pluginData[e]=JSON.parse(Y.readFileSync(this.getPluginFile(e))),this.pluginData[e][t]||void 0):void 0}setPluginData(e,t,n){void 0!==n&&(void 0===this.pluginData[e]&&(this.pluginData[e]={}),this.pluginData[e][t]=n,Y.writeFileSync(this.getPluginFile(e),JSON.stringify(this.pluginData[e],null,4)))}deletePluginData(e,t){void 0===this.pluginData[e]&&(this.pluginData[e]={}),delete this.pluginData[e][t],Y.writeFileSync(this.getPluginFile(e),JSON.stringify(this.pluginData[e],null,4))}};function te(){this.switchHandler=this.switchHandler.bind(this),this.favContext=this.favContext.bind(this)}const ne=function(e){const t=e.target.getAttribute("title"),n=document.querySelector(`.${F.slateEditorClasses.slateTextArea.split(" ")[0]}`);if(n){const e=F.getInternalInstance(n),s=O.getNestedProp(e,"memoizedProps.children.props.editor.insertText");s&&s(` ${t} `)}else{const e=O.getTextArea();O.insertText(e," "==e.value.slice(-1)?e.value+t:e.value+" "+t)}},se=function(e,t,{click:n=ne,contextmenu:s}={}){const o=A.createElement(`<div class="emote-container"><img class="emote-icon" alt="${e}" src="${t}" title="${e}"></div>`);return n&&o.addEventListener("click",n),s&&o.addEventListener("contextmenu",s),o};te.prototype.init=function(){this.initialized=!0,this.favoriteEmotes={};const e=ee.getBDData("bdfavemotes");""!==e&&null!==e&&(this.favoriteEmotes=JSON.parse(atob(e))),this.qmeHeader=A.createElement('<div id="bda-qem">'),this.twitchButton=A.createElement('<button class="active" id="bda-qem-twitch">Twitch</button>'),this.favoriteButton=A.createElement('<button id="bda-qem-favourite">Favorite</button>'),this.emojiButton=A.createElement('<button id="bda-qem-emojis">Emojis</buttond>'),this.twitchButton.addEventListener("click",this.switchHandler),this.favoriteButton.addEventListener("click",this.switchHandler),this.emojiButton.addEventListener("click",this.switchHandler),this.qmeHeader.append(this.twitchButton,this.favoriteButton,this.emojiButton),this.teContainer=A.createElement('<div id="bda-qem-twitch-container"><div class="scroller-wrap scrollerWrap-2lJEkd fade"><div class="scroller scroller-2FKFPG"><div class="emote-menu-inner"></div></div></div></div>'),this.teInner=this.teContainer.querySelector(".emote-menu-inner");for(const e in E.TwitchGlobal)E.TwitchGlobal.hasOwnProperty(e)&&this.teInner.append(se(e,E.TwitchGlobal[e]));this.faContainer=A.createElement('<div id="bda-qem-favourite-container"><div class="scroller-wrap scrollerWrap-2lJEkd fade"><div class="scroller scroller-2FKFPG"><div class="emote-menu-inner"></div></div></div></div>'),this.faInner=this.faContainer.querySelector(".emote-menu-inner");for(const e in this.favoriteEmotes)this.faInner.append(se(e,this.favoriteEmotes[e],{contextmenu:this.favContext}))},te.prototype.favContext=function(e){e.stopPropagation();const t=A.query("#app-mount"),n=A.createElement('<div class="layer-v9HyYc da-layer">'),s=A.createElement('<div class="contextMenu-HLZMGh da-contextMenu bd-context-menu"></div>');n.append(s),t.append(n),n.style.top=e.clientY+"px",n.style.left=e.clientX+"px",n.style.zIndex="1002";const o=function(e){e&&e.keyCode&&27!==e.keyCode||(n.remove(),document.removeEventListener("click",o),document.removeEventListener("contextmenu",o),document.removeEventListener("keyup",o))};document.addEventListener("click",o),document.addEventListener("contextmenu",o),document.addEventListener("keyup",o);const r=A.createElement('<div class="itemGroup-1tL0uz da-itemGroup">'),i=A.createElement('<div class="item-1Yvehc itemBase-tz5SeC da-item da-itemBase clickable-11uBi- da-clickable">');i.append(A.createElement('<div class="label-JWQiNe da-label">Remove</div>')),i.addEventListener("click",()=>{delete this.favoriteEmotes[e.target.getAttribute("title")],e.target.parentElement.remove(),this.saveFavorites(),o()}),r.append(i),s.append(r)},te.prototype.switchHandler=function(e){this.switchQem(e.target.id)},te.prototype.switchQem=function(e){this.twitchButton.classList.remove("active"),this.favoriteButton.classList.remove("active"),this.emojiButton.classList.remove("active");const t=A.query(".emojiPicker-3m1S-j");switch(t.style.display="none",this.faContainer.style.display="none",this.teContainer.style.display="none",e){case"bda-qem-twitch":this.twitchButton.classList.add("active"),this.teContainer.style.display="";break;case"bda-qem-favourite":this.favoriteButton.classList.add("active"),this.faContainer.style.display="";break;case"bda-qem-emojis":this.emojiButton.classList.add("active"),t.style.display="",t.querySelector("input").focus()}},te.prototype.obsCallback=function(e){this.initialized&&(u["bda-es-9"]?e.classList.remove("bda-qme-hidden"):e.classList.add("bda-qme-hidden"),u["bda-es-0"]&&(A.prependTo(this.qmeHeader,e),e.append(this.teContainer),e.append(this.faContainer),this.switchQem("bda-qem-emojis")))},te.prototype.favorite=function(e,t){this.favoriteEmotes.hasOwnProperty(e)||(this.favoriteEmotes[e]=t),this.updateFavorites()},te.prototype.saveFavorites=function(){ee.setBDData("bdfavemotes",btoa(JSON.stringify(this.favoriteEmotes)))},te.prototype.updateFavorites=function(){this.faInner.innerHTML="";for(const e in this.favoriteEmotes)this.faInner.append(se(e,this.favoriteEmotes[e],{contextmenu:this.favContext}));this.saveFavorites()};var oe=new te;class re extends F.reactComponent{constructor(e){super(e);const t=!!(oe&&oe.favoriteEmotes&&oe.favoriteEmotes[this.label]);this.state={shouldAnimate:!this.animateOnHover,isFavorite:t},this.onMouseEnter=this.onMouseEnter.bind(this),this.onMouseLeave=this.onMouseLeave.bind(this),this.onClick=this.onClick.bind(this)}get animateOnHover(){return u["fork-es-2"]}get label(){return this.props.modifier?`${this.props.name}:${this.props.modifier}`:this.props.name}get modifierClass(){return this.props.modifier?` emote${this.props.modifier}`:""}onMouseEnter(){!this.state.shouldAnimate&&this.animateOnHover&&this.setState({shouldAnimate:!0}),!this.state.isFavorite&&oe.favoriteEmotes[this.label]?this.setState({isFavorite:!0}):this.state.isFavorite&&!oe.favoriteEmotes[this.label]&&this.setState({isFavorite:!1})}onMouseLeave(){this.state.shouldAnimate&&this.animateOnHover&&this.setState({shouldAnimate:!1})}onClick(e){this.props.onClick&&this.props.onClick(e)}render(){return F.react.createElement(F.TooltipWrapper,{color:"black",position:"top",text:this.label,delay:750},e=>F.react.createElement("div",Object.assign({className:"emotewrapper"+(this.props.jumboable?" jumboable":""),onMouseEnter:this.onMouseEnter,onMouseLeave:this.onMouseLeave,onClick:this.onClick},e),F.react.createElement("img",{draggable:!1,className:"emote"+this.modifierClass+(this.props.jumboable?" jumboable":"")+(this.state.shouldAnimate?"":" stop-animation"),dataModifier:this.props.modifier,alt:this.label,src:this.props.url}),F.react.createElement("input",{className:"fav"+(this.state.isFavorite?" active":""),title:"Favorite!",type:"button",onClick:e=>{e.preventDefault(),e.stopPropagation(),this.state.isFavorite?(delete oe.favoriteEmotes[this.label],oe.updateFavorites()):oe.favorite(this.label,this.props.url),this.setState({isFavorite:!this.state.isFavorite})}})))}}function ie(){Object.defineProperty(this,"categories",{get:function(){const e=[];for(const t in w)u[w[t]]&&e.push(t);return e}})}ie.prototype.init=async function(){this.modifiers=["flip","spin","pulse","spin2","spin3","1spin","2spin","3spin","tr","bl","br","shake","shake2","shake3","flap"],this.overrides=["twitch","bttv","ffz"];const e={TwitchGlobal:{url:"https://rauenzi.github.io/BetterDiscordApp/data/emotedata_twitch_global.json",variable:"TwitchGlobal",oldVariable:"emotesTwitch",getEmoteURL:e=>`https://static-cdn.jtvnw.net/emoticons/v1/${e}/1.0`},TwitchSubscriber:{url:"https://rauenzi.github.io/BetterDiscordApp/data/emotedata_twitch_subscriber.json",variable:"TwitchSubscriber",oldVariable:"subEmotesTwitch",getEmoteURL:e=>`https://static-cdn.jtvnw.net/emoticons/v1/${e}/1.0`},FrankerFaceZ:{url:"https://rauenzi.github.io/BetterDiscordApp/data/emotedata_ffz.json",variable:"FrankerFaceZ",oldVariable:"emotesFfz",getEmoteURL:e=>`https://cdn.frankerfacez.com/emoticon/${e}/1`},BTTV:{url:"https://rauenzi.github.io/BetterDiscordApp/data/emotedata_bttv.json",variable:"BTTV",oldVariable:"emotesBTTV",getEmoteURL:e=>`https://cdn.betterttv.net/emote/${e}/1x`},BTTV2:{url:"https://rauenzi.github.io/BetterDiscordApp/data/emotedata_bttv2.json",variable:"BTTV2",oldVariable:"emotesBTTV2",getEmoteURL:e=>`https://cdn.betterttv.net/emote/${e}/1x`}};for(await this.getBlacklist(),await this.loadEmoteData(e);!F.MessageComponent;)await new Promise(e=>setTimeout(e,100));this.cancelEmoteRender||(this.cancelEmoteRender=O.monkeyPatch(F.MessageComponent,"default",{before:({methodArguments:e})=>{const t=e[0].childrenMessageContent.props.content;if(t&&t.length){for(let e=0;e<t.length;e++){const n=t[e];if("string"!=typeof n)continue;const s=n.split(/([^\s]+)([\s]|$)/g);for(let n=0,o=this.categories.length;n<o;n++)for(let o=0,r=s.length;o<r;o++){const r=s[o].split(":"),i=r[0];let a=r[1]?r[1]:"",l=a.slice(0);if(i.length<4||g.includes(i))continue;this.modifiers.includes(a)&&u["bda-es-8"]||(a=""),this.overrides.includes(l)?a=l:l="";let c=this.categories[n];if("twitch"===l?E.TwitchGlobal[i]?c="TwitchGlobal":E.TwitchSubscriber[i]&&(c="TwitchSubscriber"):"bttv"===l?E.BTTV[i]?c="BTTV":E.BTTV2[i]&&(c="BTTV2"):"ffz"===l&&E.FrankerFaceZ[i]&&(c="FrankerFaceZ"),!E[c][i]||!u[w[c]])continue;const d=t[e].match(new RegExp(`([\\s]|^)${O.escape(a?i+":"+a:i)}([\\s]|$)`));if(!d)continue;const h=t[e].substring(0,d.index+d[1].length),p=t[e].substring(d.index+d[0].length-d[2].length);t[e]=h;const m=F.react.createElement(re,{name:i,url:E[c][i],modifier:a});t.splice(e+1,0,p),t.splice(e+1,0,m)}}if(t.every(e=>"string"==typeof e&&""==e.replace(/\s*/,"")||(!(!e.type||"BDEmote"!=e.type.name)||!!(e.props&&e.props.children&&e.props.children.props&&e.props.children.props.emojiName))))for(const e of t)"object"==typeof e&&("BDEmote"==e.type.name?e.props.jumboable=!0:e.props&&e.props.children&&e.props.children.props&&e.props.children.props.emojiName&&(e.props.children.props.jumboable=!0))}}}))},ie.prototype.disable=function(){this.cancelEmoteRender||(this.cancelEmoteRender(),this.cancelEmoteRender=null)},ie.prototype.clearEmoteData=async function(){const e=n(0),t=m.dataPath+"emote_data.json";e.existsSync(t)&&e.unlinkSync(t),ee.setBDData("emoteCacheDate",(new Date).toJSON()),Object.assign(E,{TwitchGlobal:{},TwitchSubscriber:{},BTTV:{},FrankerFaceZ:{},BTTV2:{}})},ie.prototype.isCacheValid=function(){const e=ee.getBDData("emoteCacheDays")||ee.setBDData("emoteCacheDays",7)||7,t=new Date(ee.getBDData("emoteCacheDate")||null),n=new Date;return!(Math.round(Math.abs((n.getTime()-t.getTime())/864e5))>e)||(ee.setBDData("emoteCacheDate",n.toJSON()),!1)},ie.prototype.loadEmoteData=async function(e){const t=n(0),s=m.dataPath+"emote_data.json";if(await new Promise(e=>t.exists(s,e))&&this.isCacheValid()){u["fork-ps-2"]&&O.showToast("Loading emotes from cache.",{type:"info"}),O.log("Emotes","Loading emotes from local cache.");const n=await new Promise(e=>{t.readFile(s,"utf8",(t,n)=>{O.log("Emotes","Emote file read."),t&&(n={}),e(n)})}),o=O.testJSON(n);let r=!!o;r&&Object.assign(E,o);for(const t in e)r=Object.keys(E[e[t].variable]).length>0;if(r)return void(u["fork-ps-2"]&&O.showToast("Emotes successfully loaded.",{type:"success"}));O.log("Emotes","Cache was corrupt, downloading..."),await new Promise(e=>t.unlink(s,e))}if(u["fork-es-3"]){u["fork-ps-2"]&&O.showToast("Downloading emotes in the background do not reload.",{type:"info"});for(const t in e){await new Promise(e=>setTimeout(e,1e3));const n=await this.downloadEmotes(e[t]);E[e[t].variable]=n}u["fork-ps-2"]&&O.showToast("All emotes successfully downloaded.",{type:"success"});try{await new Promise(e=>t.writeFile(s,JSON.stringify(E),"utf8",e))}catch(e){O.err("Emotes","Could not save emote data.",e)}}},ie.prototype.downloadEmotes=function(e){const t=n(3),s={url:e.url,timeout:e.timeout?e.timeout:5e3,json:!0};return O.log("Emotes",`Downloading: ${e.variable} (${e.url})`),new Promise((n,o)=>{t(s,(t,s,r)=>{if(t)return O.err("Emotes","Could not download "+e.variable,t),e.backup?(e.url=e.backup,e.backup=null,e.backupParser&&(e.parser=e.backupParser),n(this.downloadEmotes(e))):o({});"function"==typeof e.parser&&(r=e.parser(r));for(const t in r)t.length<4||g.includes(t)?delete r[t]:r[t]=e.getEmoteURL(r[t]);n(r),O.log("Emotes","Downloaded: "+e.variable)})})},ie.prototype.getBlacklist=function(){return new Promise(e=>{n(3).get({url:"https://rauenzi.github.io/BetterDiscordApp/data/emotefilter.json",json:!0},(function(t,n,s){if(t)return e(g);e(g.splice(0,0,...s.blacklist))}))})};var ae=new ie;class le extends F.reactComponent{constructor(e){super(e)}render(){return F.react.createElement("div",{className:"ui-tab-bar-separator margin-top-8 margin-bottom-8"})}}class ce extends F.reactComponent{constructor(e){super(e)}render(){return F.react.createElement("div",{className:"ui-tab-bar-header"},this.props.text,this.props.button)}}class de extends F.reactComponent{constructor(e){super(e),this.setInitialState(),this.onClick=this.onClick.bind(this)}setInitialState(){this.state={selected:this.props.selected||!1}}render(){return F.react.createElement("div",{className:`ui-tab-bar-item${this.props.selected?" selected":""}`,onClick:this.onClick},this.props.text)}onClick(){this.props.onClick&&this.props.onClick(this.props.id)}}class ue extends F.reactComponent{constructor(e){super(e);const t=document.querySelector("[class*=side-] > [class*=selected]");t&&(this.scn=t.className);const n=document.querySelector("[class*=side-] > [class*='item-']:not([class*=selected])");n&&(this.nscn=n.className);const s=document.querySelectorAll("[class*='side-'] > [class*='item-']");for(const e of s)e.addEventListener("click",()=>{this.setState({selected:null})});this.setInitialState(),this.onClick=this.onClick.bind(this),this.setSelected=this.setSelected.bind(this)}setInitialState(){const e=this;e.state={selected:null,items:e.props.items};const t=e.props.items.find(e=>e.selected);t&&(e.state.selected=t.id)}render(){const e=this,{headerText:t}=e.props,{items:n,selected:s}=e.state;return F.react.createElement("div",null,F.react.createElement(le,null),F.react.createElement(ce,{text:t,button:this.props.headerButton}),n.map(t=>{const{id:n,text:o}=t;return F.react.createElement(de,{key:n,selected:s===n,text:o,id:n,onClick:e.onClick})}))}setSelected(e){e.target.className=this.scn}onClick(e){const t=document.querySelector("[class*=side] > [class*=selected]");t&&(t.removeEventListener("click",this.setSelected),t.addEventListener("click",this.setSelected),t.className=this.nscn),this.setState({selected:null}),this.setState({selected:e}),this.props.onClick&&this.props.onClick(e)}}const he=F.React;class pe extends he.Component{render(){const e=this.props.size||"18px";return he.createElement("svg",{viewBox:"0 0 24 24",fill:"#FFFFFF",className:this.props.className||"",style:{width:e,height:e},onClick:this.props.onClick},he.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),he.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"}))}}const me=M("tooltip","tooltipBlack"),ge=M("layer","layerContainer"),fe=function(e){const t=e[0].toUpperCase()+e.slice(1),n=me[`tooltip${t}`];return n||null},be=function(e){return!!fe(e)},ve=function(e){return`${e}px`};class ye{constructor(e,t,n={}){const{style:s="black",side:o="top",preventFlip:r=!1,disabled:i=!1}=n;return this.node=e instanceof jQuery?e[0]:e,this.label=t,this.style=s.toLowerCase(),this.side=o.toLowerCase(),this.preventFlip=r,this.disabled=i,be(this.side)?be(this.style)?(this.element=A.createElement(`<div class="${ge.layer}">`),this.tooltipElement=A.createElement(`<div class="${me.tooltip} ${fe(this.style)}"><div class="${me.tooltipPointer}"></div>${this.label}</div>`),this.labelElement=this.tooltipElement.childNodes[1],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,o=n.some(e=>e.contains(this.node));(s||o)&&(this.hide(),e.disconnect())})});e.observe(document.body,{subtree:!0,childList:!0})}),void this.node.addEventListener("mouseleave",()=>{this.hide()})):O.err("EmulatedTooltip",`Style ${this.style} does not exist.`):O.err("EmulatedTooltip",`Side ${this.side} does not exist.`)}get container(){return document.querySelector(".popouts-2bnG9Z ~ .layerContainer-yqaFcK")}get canShowAbove(){return this.node.getBoundingClientRect().top-this.element.offsetHeight>=0}get canShowBelow(){return this.node.getBoundingClientRect().top+this.node.offsetHeight+this.element.offsetHeight<=O.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<=O.screenWidth}hide(){this.element.remove(),this.tooltipElement.className=this._className}show(){this.tooltipElement.className=`${me.tooltip} ${fe(this.style)}`,this.labelElement.textContent=this.label,this.element.appendTo(this.container),"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.addClass(fe("top")),this.element.style.setProperty("top",ve(this.node.getBoundingClientRect().top-this.element.offsetHeight-10)),this.centerHorizontally()}showBelow(){this.tooltipElement.addClass(fe("bottom")),this.element.style.setProperty("top",ve(this.node.getBoundingClientRect().top+this.node.offsetHeight+10)),this.centerHorizontally()}showLeft(){this.tooltipElement.addClass(fe("left")),this.element.style.setProperty("left",ve(this.node.getBoundingClientRect().left-this.element.offsetWidth-10)),this.centerVertically()}showRight(){this.tooltipElement.addClass(fe("right")),this.element.style.setProperty("left",ve(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",ve(e-this.element.offsetWidth/2))}centerVertically(){const e=this.node.getBoundingClientRect().top+this.node.offsetHeight/2;this.element.style.setProperty("top",ve(e-this.element.offsetHeight/2))}}var Ce=class extends F.reactComponent{constructor(e){super(e),this.onMouseEnter=this.onMouseEnter.bind(this),this.onMouseLeave=this.onMouseLeave.bind(this)}componentDidMount(){const{style:e="black",side:t="top",text:n=""}=this.props;this.node=F.reactDom.findDOMNode(this),this.tooltip=new ye(this.node,n,{style:e,side:t})}componentWillUnmount(){this.tooltip.hide(),delete this.tooltip}onMouseEnter(){}onMouseLeave(){}render(){return this.props.children}};class Ee{constructor(e){this.onClick=e}get items(){return[{text:"Settings",id:"core"},{text:"Emotes",id:"emotes"},{text:"Plugins",id:"plugins"},{text:"Themes",id:"themes"},{text:"Custom CSS",id:"customcss"}]}get component(){const e=F.react.createElement(Ce,{color:"black",side:"top",text:"Changelog"},F.react.createElement("div",{className:"bd-changelog-button",onClick:()=>{O.showChangelogModal(l)}},F.react.createElement(pe,{className:"bd-icon",size:"16px"})));return F.react.createElement("span",null,F.react.createElement(ue,{onClick:this.onClick,headerText:"Bandaged BD",headerButton:e,items:this.items}))}get root(){const e=A.query("#bd-settings-sidebar");return e||(this.injectRoot()?this.root:null)}injectRoot(){const e=A.queryAll("[class*='side-'] > [class*='item-']:not([class*=Danger])"),t=e[e.length-1];return!!t&&(t.parentElement.insertBefore(A.createElement('<div id="bd-settings-sidebar">'),t.previousElementSibling),!0)}render(){const e=this.root;e?(F.reactDom.render(this.component,e),O.onRemoved(e,()=>{F.reactDom.unmountComponentAtNode(e)})):console.log("FAILED TO LOCATE ROOT: [class*='side-'] > [class*='item-']:not([class*=Danger])")}}var we=new class{injectColoredText(){this.cancelColoredText||F.MessageComponent&&(this.cancelColoredText=O.monkeyPatch(F.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=u["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(){document.querySelectorAll(".markup-2BOw-j").forEach(e=>{e.style.setProperty("color","")})}},ke=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(!u["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=O.monkeyPatch(F.TimeFormatter,"calendarFormat",{after:t}),s=O.monkeyPatch(F.TimeFormatter,"dateFormat",{after:t});this.cancel24Hour=()=>{n(),s()}}remove24Hour(){this.cancel24Hour&&this.cancel24Hour()}};const Se=n(2),xe=n(0),De=n(1),Ne=Se.remote.BrowserWindow,Pe=Ne.getAllWindows()[0];var Te=new class{constructor(){let e="";if("win32"===process.platform&&(e=De.resolve(process.env.LOCALAPPDATA,"Google/Chrome/User Data")),"linux"===process.platform&&(e=De.resolve(process.env.HOME,".config/google-chrome")),"darwin"===process.platform&&(e=De.resolve(process.env.HOME,"Library/Application Support/Google/Chrome")),e+="/Default/Extensions/fmkadmapgofadopljbjfkapdkoienihi/",xe.existsSync(e)){const t=xe.readdirSync(e);e=De.resolve(e,t[t.length-1])}this.extensionPath=e,this.isExtensionInstalled=xe.existsSync(e),this.listener=this.listener.bind(this),c["React DevTools"].hidden=!this.isExtensionInstalled}listener(){if(!this.isExtensionInstalled)return;Ne.removeDevToolsExtension("React Developer Tools"),Ne.addDevToolsExtension(this.extensionPath)?O.log("React DevTools","Successfully installed react devtools."):O.err("React DevTools","Couldn't find react devtools in chrome extensions!")}start(){Pe.webContents.on("devtools-opened",this.listener)}stop(){Pe.webContents.removeListener("devtools-opened",this.listener)}};class Le extends F.reactComponent{constructor(e){super(e)}render(){return F.react.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 12 12",style:{width:"18px",height:"18px"}},F.react.createElement("g",{className:"background",fill:"none",fillRule:"evenodd"},F.react.createElement("path",{d:"M0 0h12v12H0"}),F.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 Me extends F.reactComponent{constructor(e){super(e),this.onClick=this.onClick.bind(this)}render(){return F.react.createElement("div",{className:"tools-container toolsContainer-1edPuj"},F.react.createElement("div",{className:"tools tools-3-3s-N"},F.react.createElement("div",{className:"container-1sFeqf"},F.react.createElement("div",{className:"btn-close closeButton-1tv5uR",onClick:this.onClick},F.react.createElement(Le,null)),F.react.createElement("div",{className:"esc-text keybind-KpFkfr"},"ESC"))))}onClick(){this.props.onClick&&this.props.onClick();const e=document.querySelector(".closeButton-1tv5uR");e&&e.click()}}class Be extends F.reactComponent{constructor(e){super(e)}render(){return F.react.createElement("h2",{className:"ui-form-title h2 margin-reset margin-bottom-20 marginTop60-3PGbtK da-marginTop6"},this.props.text)}}class Fe extends F.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;return F.react.createElement("div",{className:`card-3Qj_Yx cardPrimary-1Hv-to marginBottom8-AtZOdT bd-server-card${e.pinned?" bd-server-card-pinned":""}`},F.react.createElement("img",{ref:"img",className:"bd-server-image",src:e.iconUrl,onError:this.handleError.bind(this)}),F.react.createElement("div",{className:"flexChild-faoVW3 bd-server-content"},F.react.createElement("div",{className:"flex-1xMQg5 flex-1O1GKY horizontal-1ae9ci horizontal-2EEEnY directionRow-3v3tfG noWrap-3jynv6 bd-server-header"},F.react.createElement("h5",{className:"h5-18_1nd defaultColor-1_ajX0 margin-reset bd-server-name"},e.name),F.react.createElement("h5",{className:"h5-18_1nd defaultColor-1_ajX0 margin-reset bd-server-member-count"},e.members," Members")),F.react.createElement("div",{className:"flex-1xMQg5 flex-1O1GKY horizontal-1ae9ci horizontal-2EEEnY directionRow-3v3tfG noWrap-3jynv6"},F.react.createElement("div",{className:"scrollerWrap-2lJEkd scrollerThemed-2oenus themeGhostHairline-DBD-2d scrollerFade-1Ijw5y bd-server-description-container"},F.react.createElement("div",{className:"scroller-2FKFPG scroller bd-server-description"},e.description))),F.react.createElement("div",{className:"flex-1xMQg5 flex-1O1GKY horizontal-1ae9ci horizontal-2EEEnY directionRow-3v3tfG noWrap-3jynv6 bd-server-footer"},F.react.createElement("div",{className:"flexChild-faoVW3 bd-server-tags",style:{flex:"1 1 auto"}},e.categories.join(", ")),this.state.joined&&F.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"}},F.react.createElement("div",{className:"ui-button-contents"},"Joined")),e.error&&F.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"}},F.react.createElement("div",{className:"ui-button-contents"},"Error")),!e.error&&!this.state.joined&&F.react.createElement("button",{type:"button",className:"button-38aScr lookFilled-1Gx00P colorBrand-3pXr91 sizeMin-1mJd1x grow-q77ONN",style:{minHeight:"12px",marginTop:"4px"},onClick:()=>{this.join()}},F.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 Ae extends F.reactComponent{constructor(e){super(e)}render(){let e=`scrollerWrap-2lJEkd scrollerThemed-2oenus themeGhostHairline-DBD-2d${this.props.fade?" scrollerFade-1Ijw5y":""}`,t="scroller-2FKFPG scroller";this.props.sidebar&&(t="scroller-2FKFPG firefoxFixScrollFlex-cnI2ix sidebarRegionScroller-3MXcoP sidebar-region-scroller scroller"),this.props.contentColumn&&(t="scroller-2FKFPG firefoxFixScrollFlex-cnI2ix contentRegionScroller-26nc1e content-region-scroller scroller",e="scrollerWrap-2lJEkd firefoxFixScrollFlex-cnI2ix contentRegionScrollerWrap-3YZXdm content-region-scroller-wrap scrollerThemed-2oenus themeGhost-28MSn0 scrollerTrack-1ZIpsv");const{children:n}=this.props;return F.react.createElement("div",{key:"scrollerwrap",className:e},F.react.createElement("div",{key:"scroller",ref:"scroller",className:t},n))}}class Oe extends F.reactComponent{constructor(e){super(e)}render(){const{sidebar:e,content:t,tools:n}=this.props.children;return F.react.createElement("div",{className:"standardSidebarView-3F1I7i ui-standard-sidebar-view"},F.react.createElement("div",{className:"sidebarRegion-VFTUkN sidebar-region"},F.react.createElement(Ae,{key:"sidebarScroller",ref:"sidebarScroller",sidebar:!0,fade:e.fade||!0,dark:e.dark||!0},e.component)),F.react.createElement("div",{className:"contentRegion-3nDuYy content-region"},F.react.createElement("div",{className:"contentTransitionWrap-3hqOEW content-transition-wrap"},F.react.createElement("div",{className:"scrollerWrap-2lJEkd firefoxFixScrollFlex-cnI2ix contentRegionScrollerWrap-3YZXdm content-region-scroller-wrap scrollerThemed-2oenus themeGhost-28MSn0 scrollerTrack-1ZIpsv"},F.react.createElement("div",{className:"scroller-2FKFPG firefoxFixScrollFlex-cnI2ix contentRegionScroller-26nc1e content-region-scroller scroller",ref:"contentScroller"},F.react.createElement("div",{className:"contentColumn-2hrIYH contentColumnDefault-1VQkGM content-column default"},t.component),n.component)))))}}class je extends F.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=F.WebpackModules.findByUniqueProperties(["getGuilds"]),this.AvatarDefaults=F.WebpackModules.findByUniqueProperties(["getUserAvatarURL","DEFAULT_AVATARS"]),this.InviteActions=F.WebpackModules.findByUniqueProperties(["acceptInvite"]),this.SortedGuildStore=F.WebpackModules.findByUniqueProperties(["getSortedGuilds"])}componentDidMount(){this.checkConnection()}setInitialState(){this.state={selectedCategory:-1,title:"Loading...",loading:!0,servers:[],next:null,connection:{state:0,user:null}}}close(){F.reactDom.unmountComponentAtNode(document.getElementById(this.props.rootId))}search(e,t){const s=this;n(3).get({url:`${s.endPoint}${e}${e?"&schema=new":"?schema=new"}`,json:!0},(function(e,n,o){if(e)return s.setState({loading:!1,title:"Failed to load servers. Check console for details"});let r=o.results.reduce((e,t)=>(t.joined=!1,e.push(t),e),[]);t||(r=s.state.servers.concat(r));let i=o.size+o.from;o.next=`?from=${i}`,s.state.term&&(o.next+=`&term=${s.state.term}`),s.state.selectedCategory&&(o.next+=`&category=${s.categoryButtons[s.state.selectedCategory]}`),i>=o.total&&(i=o.total,o.next=null);let a=`Showing 1-${i} of ${o.total} results in ${s.categoryButtons[s.state.selectedCategory]}`;s.state.term&&(a+=` for ${s.state.term}`),s.setState({loading:!1,title:a,servers:r,next:o.next}),t&&(s.refs.sbv.refs.contentScroller.scrollTop=0)}))}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 F.react.createElement(Fe,{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){e.setState({title:"Not connected to discordservers.com!",loading:!0,selectedCategory:-1,connection:{state:1,user:null}})}}render(){return F.react.createElement(Oe,{ref:"sbv"},this.component)}get component(){return{sidebar:{component:this.sidebar},content:{component:this.content},tools:{component:F.react.createElement(Me,{key:"pt",ref:"tools",onClick:this.close})}}}get sidebar(){return F.react.createElement("div",{className:"sidebar",key:"ps"},F.react.createElement("div",{className:"ui-tab-bar SIDE"},F.react.createElement("div",{className:"ui-tab-bar-header",style:{fontSize:"16px"}},"Public Servers"),F.react.createElement(le,null),this.searchInput,F.react.createElement(le,null),F.react.createElement(ce,{text:"Categories"}),this.categoryButtons.map((e,t)=>F.react.createElement(de,{id:t,onClick:this.changeCategory,key:t,text:e,selected:this.state.selectedCategory===t})),F.react.createElement(le,null),this.footer,this.connection))}get searchInput(){return F.react.createElement("div",{className:"ui-form-item"},F.react.createElement("div",{className:"ui-text-input flex-vertical",style:{width:"172px",marginLeft:"10px"}},F.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;return 1===e.state.connection.state?e.notConnected:[F.react.createElement("div",{ref:"content",key:"pc",className:"contentColumn-2hrIYH contentColumnDefault-1VQkGM content-column default"},F.react.createElement(Be,{text:e.state.title}),e.bdServer,e.state.servers.map(s=>F.react.createElement(Fe,{key:s.identifier,server:s,join:e.join,guildList:t,fallback:n[Math.floor(5*Math.random())]})),e.state.next&&F.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"}},F.react.createElement("div",{className:"ui-button-contents"},e.state.loading?"Loading":"Load More")),e.state.servers.length>0&&F.react.createElement(Be,{text:e.state.title}))]}get notConnected(){return[F.react.createElement("div",{key:"ncc",ref:"content",className:"contentColumn-2hrIYH contentColumnDefault-1VQkGM content-column default"},F.react.createElement("h2",{className:"ui-form-title h2 margin-reset margin-bottom-20"},"Not connected to discordservers.com!",F.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"}},F.react.createElement("div",{className:"ui-button-contents"},"Connect"))),this.bdServer)]}get footer(){return F.react.createElement("div",{className:"ui-tab-bar-header"},F.react.createElement("a",{href:"https://discordservers.com",target:"_blank"},"Discordservers.com"))}get connection(){const{connection:e}=this.state;return 2!==e.state?F.react.createElement("span",null):F.react.createElement("span",null,F.react.createElement(le,null),F.react.createElement("span",{style:{color:"#b9bbbe",fontSize:"10px",marginLeft:"10px"}},"Connected as: ",`${e.user.username}#${e.user.discriminator}`),F.react.createElement("div",{style:{padding:"5px 10px 0 10px"}},F.react.createElement("button",{style:{width:"100%",minHeight:"20px"},type:"button",className:"ui-button filled brand small grow"},F.react.createElement("div",{className:"ui-button-contents",onClick:this.connect},"Reconnect"))))}}class Re extends F.reactComponent{constructor(e){super(e),this.keyupListener=this.keyupListener.bind(this)}keyupListener(e){27===e.which&&F.reactDom.unmountComponentAtNode(this.refs.root.parentNode)}componentDidMount(){window.addEventListener("keyup",this.keyupListener);const e=A.query(`#${this.props.id}`);A.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=A.query(`#${this.props.id}`);A.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=A.query(".publicServersOpen");t.classList.remove("publicServersOpen"),A.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=A.query('[class*="layer-"]');e.classList.add("publicServersOpen"),A.animate({duration:200,update:function(t){e.style.transform=`scale(${.07*(1-t)+.93}) translateZ(0px)`,e.style.opacity=1-t}})}render(){return F.react.createElement("div",{className:"layer bd-layer layer-3QrUeG",id:this.props.id,ref:"root",style:{opacity:0,transform:"scale(1.1) translateZ(0px)"}},this.props.children)}}var Ie=new class{constructor(){this._appendButton=this._appendButton.bind(this)}get component(){return F.react.createElement(Re,{rootId:"pubslayerroot",id:"pubslayer"},F.react.createElement(je,{rootId:"pubslayerroot"}))}get root(){const e=document.getElementById("pubslayerroot");return e||(this.injectRoot()?this.root:null)}injectRoot(){const e=A.query(".layers, .layers-3iHuyZ");return!!e&&(e.append(A.createElement("<div id='pubslayerroot'>")),!0)}render(){const e=this.root;e?F.reactDom.render(this.component,e):console.log("FAILED TO LOCATE ROOT: .layers")}get button(){const e=A.createElement(`<div id="bd-pub-li" class="${F.guildClasses.listItem}">`);u["bda-gs-1"]||(e.style.display="none");const t=A.createElement(`<div id="bd-pub-button" class="${"wrapper-25eVIn "+F.guildClasses.circleButtonMask}">public</div>`);return t.addEventListener("click",()=>{this.render()}),e.append(t),e}_appendButton(){if(A.query("#bd-pub-li"))return;const e=F.guildClasses.wrapper.split(" ")[0],t=A.query(`.${e} .scroller-2FKFPG >:first-child`);A.after(t,this.button)}addButton(){if(this.guildPatch)return;const e=B("Guilds");this.guildPatch=O.monkeyPatch(e.prototype,"render",{after:this._appendButton}),this._appendButton()}removeButton(){this.guildPatch(),delete this.guildPatch,A.query("#bd-pub-li").remove()}};var $e=new class{start(){A.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(){A.removeStyle("VoiceMode")}};const qe=new RegExp("^(?!da-)((?:[A-Za-z]|[0-9]|-)+)-(?:[A-Za-z]|[0-9]|-|_){6}$");var _e=new class{stop(){this.hasPatched&&(this.unpatchClassModules(L(this.moduleFilter.bind(this))),this.revertElement(document.querySelector("#app-mount")),this.hasPatched=!1)}start(){this.hasPatched||(this.patchClassModules(L(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(!qe.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 o=s.split(" ");for(const s of o){const o=s.match(qe);if(!o||!o.length||o.length<2)continue;const r=o[1].split("-").map((e,t)=>t?e[0].toUpperCase()+e.slice(1):e).join("");t[n]+=` ${e}-${r}`}}}unpatchClassModule(e,t){for(const n in t){const s=t[n];if(this.shouldIgnore(s))continue;let o="";const r=s.split(" ");for(const t of r)t.startsWith(`${e}-`)||(o+=` ${t}`);t[n]=o.trim()}}normalizeElement(e){if(!(e instanceof Element))return;const t=e.classList;for(let n=0,s=t.length;n<s;n++){if(!qe.test(t[n]))continue;const s=t[n].match(qe)[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 t.split(" ").every(t=>e.call(this,t))}}},We=new class{constructor(){this.debugListener=this.debugListener.bind(this),this.copySelectorListener=this.copySelectorListener.bind(this)}start(){this.startDebugListener(),u["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){119!==e.which&&118!=e.which||(console.log("%c[%cDevMode%c] %cBreak/Resume","color: red;","color: #303030; font-weight:700;","color:red;",""),e.preventDefault(),e.stopImmediatePropagation())}copySelectorListener(e){e.stopPropagation();const t=this.getSelector(e.target);setImmediate((function(){let n=A.query(".contextMenu-HLZMGh");if(!n){const t=A.query("#app-mount"),s=A.createElement('<div class="layer-v9HyYc da-layer">');n=A.createElement('<div class="contextMenu-HLZMGh da-contextMenu bd-context-menu"></div>'),s.append(n),t.append(s),s.style.top=e.clientY+"px",s.style.left=e.clientX+"px",s.style.zIndex="1002";const o=function(e){e.keyCode&&27!==e.keyCode||(s.remove(),document.removeEventListener("click",o),document.removeEventListener("contextmenu",o),document.removeEventListener("keyup",o))};document.addEventListener("click",o),document.addEventListener("contextmenu",o),document.addEventListener("keyup",o)}const s=A.createElement('<div class="itemGroup-1tL0uz da-itemGroup">'),o=A.createElement('<div class="item-1Yvehc itemBase-tz5SeC da-item da-itemBase clickable-11uBi- da-clickable">');o.append(A.createElement('<div class="label-JWQiNe da-label">Copy Selector</div>')),o.addEventListener("click",()=>{F.NativeModule.copy(t),n.style.display="none"}),s.append(o),n.append(s)}))}getSelector(e){if(e.id)return`#${e.id}`;const t=this.getRules(e),n=t[t.length-1];return n?n.selectorText:e.classList.length?`.${Array.from(e.classList).join(".")}`:`.${Array.from(e.parentElement.classList).join(".")}`}getRules(e,t=e.ownerDocument.styleSheets){return[...t].filter(e=>!e.href||!e.href.includes("BetterDiscordApp")).map(e=>[...e.cssRules||[]]).flat().filter(t=>t&&t.selectorText&&e.matches(t.selectorText)&&t.style.length&&t.selectorText.split(", ").length<8&&!t.selectorText.split(", ").includes("*"))}};const He=F.React;class ze extends He.Component{constructor(e){super(e),this.state={checked:this.props.checked},this.onChange=this.onChange.bind(this)}onChange(){this.props.disabled||(this.props.onChange(!this.state.checked),this.setState({checked:!this.state.checked}))}render(){const e=this.props.disabled?" bd-switch-disabled":"",t=this.state.checked?" bd-switch-checked":"";return He.createElement("div",{className:"bd-switch"+e+t},He.createElement("input",{type:"checkbox",id:this.props.id,className:"bd-checkbox",disabled:this.props.disabled,checked:this.state.checked,onChange:this.onChange}))}}class Ge extends F.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(){const{text:e,info:t}=this.props.data;return F.react.createElement("div",{className:"ui-flex flex-vertical flex-justify-start flex-align-stretch flex-nowrap ui-switch-item"},F.react.createElement("div",{className:"ui-flex flex-horizontal flex-justify-start flex-align-stretch flex-nowrap"},F.react.createElement("h3",{className:"ui-form-title h3 margin-reset margin-reset ui-flex-child"},e),F.react.createElement(ze,{onChange:this.onChange,checked:this.props.checked})),F.react.createElement("div",{className:"ui-form-text style-description margin-top-4",style:{flex:"1 1 auto"}},t))}}class Ve extends F.reactComponent{constructor(e){super(e)}render(){const{title:e,settings:t,button:n}=this.props,s=n?F.react.createElement("button",{key:"title-button",className:"bd-pfbtn",onClick:n.onClick},n.title):null;return[F.react.createElement(Be,{text:e}),s,t.map(e=>F.react.createElement(Ge,{id:e.id,key:e.id,data:e,checked:u[e.id],onChange:(e,t)=>{this.props.onChange(e,t)}}))]}}class Ue extends F.reactComponent{constructor(e){super(e)}render(){return F.react.createElement("div",{className:"contentColumn-2hrIYH contentColumnDefault-1VQkGM content-column default"},this.props.sections.map(e=>F.react.createElement(Ve,Object.assign({},e,{onChange:this.props.onChange}))))}}class Je extends F.reactComponent{constructor(e){super(e)}render(){const{settings:e}=this.props;return F.react.createElement("div",{className:"contentColumn-2hrIYH contentColumnDefault-1VQkGM content-column default"},F.react.createElement(Be,{text:this.props.title}),this.props.button&&F.react.createElement("button",{key:"title-button",className:"bd-pfbtn",onClick:this.props.button.onClick},this.props.button.title),e.map(e=>F.react.createElement(Ge,{id:e.id,key:e.id,data:e,checked:u[e.id],onChange:(e,t)=>{this.props.onChange(e,t)}})))}}class Ze extends F.reactComponent{constructor(e){super(e),this.onClick=this.onClick.bind(this),this.setInitialState()}setInitialState(){this.state={checked:this.props.checked||!1}}render(){return F.react.createElement("li",null,F.react.createElement("div",{className:"checkbox checkbox-3kaeSU da-checkbox",onClick:this.onClick},F.react.createElement("div",{className:"checkbox-inner checkboxInner-3yjcPe da-checkboxInner"},F.react.createElement("input",{className:"checkboxElement-1qV33p da-checkboxElement",checked:this.state.checked,onChange:()=>{},type:"checkbox"}),F.react.createElement("span",null)),F.react.createElement("span",null,this.props.text)))}onClick(){this.props.onChange(this.props.id,!this.state.checked),this.setState({checked:!this.state.checked})}}class Qe extends F.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(){A.addClass(A.query("#app-mount"),"bd-detached-editor"),F.editorDetached=!0,this.editor=ace.edit("bd-customcss-editor-detached"),this.editor.setTheme("ace/theme/monokai"),this.editor.session.setMode("ace/mode/css"),this.editor.setShowPrintMargin(!1),this.editor.setFontSize(14),this.editor.on("change",()=>{u["bda-css-0"]&&(this.saveCss(),this.updateCss())})}componentWillUnmount(){A.removeClass(A.query("#app-mount"),"bd-detached-editor"),F.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=ee.getBDData("bdcustomcss");let t="";return e&&""!==e&&(t=atob(e)),t}get root(){const e=A.query("#bd-customcss-detach-container");return e||(this.injectRoot()?this.detachedRoot:null)}injectRoot(){const e=A.query(".app, .app-2rEoOp");return!!e&&(A.insertAfter(A.createElement('<div id="bd-customcss-detach-container">'),e),!0)}render(){const e=this;return F.react.createElement("div",{className:"bd-detached-css-editor",id:"bd-customcss-detach-editor"},F.react.createElement("div",{id:"bd-customcss-innerpane"},F.react.createElement("div",{className:"editor-wrapper"},F.react.createElement("div",{id:"bd-customcss-editor-detached",className:"editor",ref:"editor"},e.css)),F.react.createElement("div",{id:"bd-customcss-attach-controls"},F.react.createElement("ul",{className:"checkbox-group"},F.react.createElement(Ze,{id:"live-update",text:"Live Update",onChange:e.onChange,checked:u["bda-css-0"]})),F.react.createElement("div",{id:"bd-customcss-detach-controls-button"},F.react.createElement("button",{style:{borderRadius:"3px 0 0 3px",borderRight:"1px solid #3f4146"},className:"btn btn-primary",onClick:()=>{e.onClick("update")}},"Update"),F.react.createElement("button",{style:{borderRadius:"0",borderLeft:"1px solid #2d2d2d",borderRight:"1px solid #2d2d2d"},className:"btn btn-primary",onClick:()=>{e.onClick("save")}},"Save"),F.react.createElement("button",{style:{borderRadius:"0 3px 3px 0",borderLeft:"1px solid #3f4146"},className:"btn btn-primary",onClick:()=>{e.onClick("attach")}},"Attach"),F.react.createElement("span",{style:{fontSize:"10px",marginLeft:"5px"}},"Unsaved changes are lost on attach")))))}onChange(e,t){switch(e){case"live-update":u["bda-css-0"]=t,yt.saveSettings()}}onClick(e){const t=this;switch(e){case"attach":A.query("#editor-detached")&&t.props.attach(),F.reactDom.unmountComponentAtNode(t.root),t.root.remove();break;case"update":t.updateCss();break;case"save":t.saveCss()}}updateCss(){A.removeStyle("customcss"),A.addStyle("customcss",this.editor.session.getValue())}saveCss(){ee.setBDData("bdcustomcss",btoa(this.editor.session.getValue()))}}class Ye extends F.reactComponent{constructor(e){super(e);this.props.lines=0,this.setInitialState(),this.attach=this.attach.bind(this),this.detachedEditor=F.react.createElement(Qe,{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||F.editorDetached}}componentDidMount(){this.editor=ace.edit("bd-customcss-editor"),this.editor.setTheme("ace/theme/monokai"),this.editor.session.setMode("ace/mode/css"),this.editor.setShowPrintMargin(!1),this.editor.setFontSize(14),this.editor.on("change",()=>{u["bda-css-0"]&&(this.saveCss(),this.updateCss())})}componentWillUnmount(){this.editor.destroy()}componentDidUpdate(e,t){const n=this;t.detached&&!n.state.detached&&F.reactDom.unmountComponentAtNode(n.detachedRoot)}codeMirror(){}get options(){return{lineNumbers:!0,mode:"css",indentUnit:4,theme:"material",scrollbarStyle:"simple"}}get css(){const e=ee.getBDData("bdcustomcss");let t="";return e&&""!==e&&(t=atob(e)),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 F.react.createElement("div",{className:"contentColumn-2hrIYH contentColumnDefault-1VQkGM content-column default",style:{padding:"60px 40px 0px"}},t&&F.react.createElement("div",{id:"editor-detached"},F.react.createElement(Be,{text:"Custom CSS Editor"}),F.react.createElement("h3",null,"Editor Detached"),F.react.createElement("button",{className:"btn btn-primary",onClick:()=>{e.attach()}},"Attach")),!t&&F.react.createElement("div",null,F.react.createElement(Be,{text:"Custom CSS Editor"}),F.react.createElement("div",{className:"editor-wrapper"},F.react.createElement("div",{id:"bd-customcss-editor",className:"editor",ref:"editor"},e.css)),F.react.createElement("div",{id:"bd-customcss-attach-controls"},F.react.createElement("ul",{className:"checkbox-group"},F.react.createElement(Ze,{id:"live-update",text:"Live Update",onChange:this.onChange,checked:u["bda-css-0"]})),F.react.createElement("div",{id:"bd-customcss-detach-controls-button"},F.react.createElement("button",{style:{borderRadius:"3px 0 0 3px",borderRight:"1px solid #3f4146"},className:"btn btn-primary",onClick:()=>{e.onClick("update")}},"Update"),F.react.createElement("button",{style:{borderRadius:"0",borderLeft:"1px solid #2d2d2d",borderRight:"1px solid #2d2d2d"},className:"btn btn-primary",onClick:()=>{e.onClick("save")}},"Save"),F.react.createElement("button",{style:{borderRadius:"0 3px 3px 0",borderLeft:"1px solid #3f4146"},className:"btn btn-primary",onClick:()=>{e.onClick("detach")}},"Detach"),F.react.createElement("span",{style:{fontSize:"10px",marginLeft:"5px"}},"Unsaved changes are lost on detach"),F.react.createElement("div",{className:"help-text"},"Press ",F.react.createElement("code",{className:"inline"},"ctrl"),"+",F.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":u["bda-css-0"]=t,yt.saveSettings()}}updateCss(){A.removeStyle("customcss"),A.addStyle("customcss",this.editor.session.getValue())}saveCss(){ee.setBDData("bdcustomcss",btoa(this.editor.session.getValue()))}detach(){this.setState({detached:!0});const e=this.detachedRoot;e?F.reactDom.render(this.detachedEditor,e):console.log("FAILED TO INJECT ROOT: .app")}get detachedRoot(){const e=A.query("#bd-customcss-detach-container");return e||(this.injectDetachedRoot()?this.detachedRoot:null)}injectDetachedRoot(){const e=A.query(".app, .app-2rEoOp");return!!e&&(A.insertAfter(A.createElement('<div id="bd-customcss-detach-container">'),e),!0)}attach(){this.setState({detached:!1})}}class Ke extends F.reactComponent{constructor(e){super(e),this.state={hasError:!1}}componentDidCatch(){this.setState({hasError:!0})}render(){return this.state.hasError?F.react.createElement("div",{className:"react-error"},"Component Error"):this.props.children}}class Xe extends F.reactComponent{constructor(e){super(e)}static get displayName(){return"ContentColumn"}render(){return F.react.createElement("div",{className:"contentColumn-2hrIYH contentColumnDefault-1VQkGM content-column default"},F.react.createElement("h2",{className:"ui-form-title h2 margin-reset margin-bottom-20"},this.props.title),this.props.children)}}class et extends F.reactComponent{constructor(e){super(e)}render(){return F.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"}},F.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"}),F.react.createElement("path",{fill:"none",d:"M0 0h24v24H0z"}))}}const tt=F.React;class nt extends tt.Component{render(){const e=this.props.size||"24px";return tt.createElement("svg",{className:this.props.className||"",viewBox:"0 0 24 24",fill:"#FFFFFF",style:{width:e,height:e},onClick:this.props.onClick},tt.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"}),tt.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}))}}const st=F.React;class ot extends st.Component{render(){const e=this.props.size||"24px";return st.createElement("svg",{className:this.props.className||"",fill:"#FFFFFF",viewBox:"0 0 24 24",style:{width:e,height:e},onClick:this.props.onClick},st.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),st.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"}),st.createElement("path",{fill:"none",d:"M0 0h24v24H0z"}))}}const rt=F.React;class it extends F.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}}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),u["fork-ps-3"]&&setImmediate(()=>{const e=this.refs.cardNode,t=e.closest(".scroller");if(!((e,t)=>{const n=e.scrollTop,s=n+e.clientHeight,o=t.offsetTop,r=o+t.clientHeight;return o<n||r>s})(t,e))return;const n=A.offset(e),s=A.offset(t),o=t.scrollTop,r=n.top-s.top+t.scrollTop-30;A.animate({duration:300,update:function(e){t.scrollTop=r>o?o+e*(r-o):o-e*(o-r)}})}))}getString(e){return e?"string"==typeof e?e:e.toString():"???"}get settingsComponent(){const e=this.getString(this.props.addon.name);try{this.settingsPanel=this.props.addon.plugin.getSettingsPanel()}catch(e){O.err("Plugins","Unable to get settings panel for "+this.props.addon.name+".",e)}return F.react.createElement("div",{className:"bd-card bd-addon-card settings-open ui-switch-item",ref:"cardNode"},F.react.createElement("div",{style:{float:"right",cursor:"pointer"},onClick:()=>{this.refs.settingspanel.innerHTML="",this.setState({settings:!1})}},F.react.createElement(Le,null)),"object"==typeof this.settingsPanel&&F.react.createElement("div",{id:`plugin-settings-${e}`,className:"plugin-settings",ref:"settingspanel"}),"object"!=typeof this.settingsPanel&&F.react.createElement("div",{id:`plugin-settings-${e}`,className:"plugin-settings",ref:"settingspanel",dangerouslySetInnerHTML:{__html:this.settingsPanel}}))}buildTitle(e,t,n){const s="{{name}} v{{version}} by {{author}}".split(/({{[A-Za-z]+}})/),o=s.findIndex(e=>"{{name}}"==e);o&&(s[o]=rt.createElement("span",{className:"name bda-name"},e));const r=s.findIndex(e=>"{{version}}"==e);o&&(s[r]=rt.createElement("span",{className:"version bda-version"},t));const i=s.findIndex(e=>"{{author}}"==e);if(o){const e={className:"author bda-author"};(n.link||n.id)&&(e.className+=` ${F.anchorClasses.anchor} ${F.anchorClasses.anchorUnderlineOnHover}`,e.target="_blank",n.link&&(e.href=n.link),n.id&&(e.onClick=()=>{F.LayerStack.popLayer(),F.openDM(n.id)})),s[i]=rt.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()}),F.react.createElement("a",n,e)}makeButton(e,t,n){return rt.createElement(Ce,{color:"black",side:"top",text:e},rt.createElement("div",{className:"bd-addon-button",onClick:n},t))}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]),F.LayerStack.popLayer(),F.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)&&F.react.createElement("div",{className:"bd-card-footer bda-footer"},F.react.createElement("span",{className:"bd-addon-links bda-links"},...e.map((t,n)=>n<e.length-1?[t," | "]:t).flat()),this.hasSettings&&F.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.props.addon.name),this.props.enabled=!this.props.enabled}edit(){this.props.edit(this.props.addon.name)}delete(){this.props.remove(this.props.addon.name)}reload(){this.props.reload(this.props.addon.name)}render(){if(this.state.settings)return this.settingsComponent;const{name:e,author:t,description:n,version:s,authorId:o,authorLink:r}=this.props.addon;return F.react.createElement("div",{className:"bd-card bd-addon-card settings-closed ui-switch-item"},F.react.createElement("div",{className:"bd-addon-header bda-header"},F.react.createElement("div",{className:"bd-card-title bda-header-title"},this.buildTitle(e,s,{name:t,id:o,link:r})),F.react.createElement("div",{className:"bd-addon-controls bda-controls"},this.props.edit&&this.makeButton("Edit",rt.createElement(nt,{className:"bd-icon"}),this.edit),this.props.remove&&this.makeButton("Delete",rt.createElement(ot,{className:"bd-icon"}),this.delete),this.props.reload&&this.makeButton("Reload",rt.createElement(et,{className:"bd-icon"}),this.reload),rt.createElement(ze,{onChange:this.onChange,checked:this.props.enabled}))),F.react.createElement("div",{className:"bd-scroller-wrap bda-description-wrap scroller-wrap fade"},F.react.createElement("div",{className:"bd-scroller bd-addon-description bda-description scroller"},n)),this.footer)}}const at=F.React;class lt extends at.Component{render(){const e=this.props.size||"16px";return at.createElement("svg",{className:this.props.className||"",fill:"#FFFFFF",viewBox:"0 0 24 24",style:{width:e,height:e}},at.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 ct=F.React;class dt extends ct.Component{constructor(e){super(e),this.state={open:!1,value:this.props.value||this.props.options[0].value},this.dropdown=ct.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 ct.createElement("div",{className:"bd-select-options"},this.props.options.map(t=>ct.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 ct.createElement("div",{className:`bd-select${e}${t}`,onClick:this.showMenu,ref:this.dropdown},ct.createElement("div",{className:"bd-select-value"},this.selected.label),ct.createElement(lt,{className:"bd-select-arrow"}),this.state.open&&this.options)}}const ut=F.React;class ht extends ut.Component{render(){const e=this.props.size||"16px";return ut.createElement("svg",{className:this.props.className||"",fill:"#FFFFFF",viewBox:"0 0 24 24",style:{width:e,height:e}},ut.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),ut.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 pt=F.React;class mt extends pt.Component{render(){return pt.createElement("div",{className:"bd-search-wrapper"},pt.createElement("input",{onChange:this.props.onChange,onKeyDown:this.props.onKeyDown,type:"text",className:"bd-search",placeholder:this.props.placeholder,maxLength:"50"}),pt.createElement(ht,null))}}function gt(){return(gt=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 ft=B("Tooltip"),bt=F.react;class vt extends F.reactComponent{constructor(e){super(e),this.state={sort:"name",ascending:!0,query:""},this.isPlugins="plugins"==this.props.type,this.cookie=this.isPlugins?x:D,this.manager=this.isPlugins?$:_,this.sort=this.sort.bind(this),this.reverse=this.reverse.bind(this),this.search=this.search.bind(this)}openFolder(){n(2).shell.showItemInFolder(this.isPlugins?Q.pluginsFolder:Q.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=>{xt.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:e.name,enabled:this.cookie[e.name],toggle:this.manager.toggle.bind(this.manager),edit:this.edit.bind(this),remove:this.delete.bind(this),addon:e}}getAddons(){const e=this.props.list.sort((e,t)=>{const n=e[this.state.sort],s=t[this.state.sort];return"string"==typeof n?n.toLocaleLowerCase().localeCompare(s.toLocaleLowerCase()):n>s?1:s>n?-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;if(s.name&&(e=s.name.toLocaleLowerCase().includes(this.state.query)),s.author&&(e=e||s.author.toLocaleLowerCase().includes(this.state.query)),s.description&&(e=e||s.description.toLocaleLowerCase().includes(this.state.query)),s.version&&(e=e||s.version.toLocaleLowerCase().includes(this.state.query)),!e)continue}const o=this.getProps(s);t.push(bt.createElement(Ke,null,bt.createElement(it,gt({},o,{reload:!u["fork-ps-5"]&&this.manager.reload.bind(this.manager)}))))}return t}render(){const e=bt.createElement(ft,{color:"black",position:"top",text:"Reload List"},e=>bt.createElement(et,gt({},e,{className:"bd-icon bd-reload bd-reload-header",size:"18px",onClick:async()=>{this.isPlugins?$.updatePluginList():_.updateThemeList(),this.forceUpdate()}}))),t=this.getAddons();return bt.createElement(Ae,{contentColumn:!0,fade:!0,dark:!0},bt.createElement(Xe,{title:`${this.props.type.toUpperCase()}${t.length}`},bt.createElement("button",{key:"folder-button",className:"bd-button bd-pfbtn",onClick:this.openFolder.bind(this)},"Open ",this.isPlugins?"Plugin":"Theme"," Folder"),!u["fork-ps-5"]&&e,bt.createElement("div",{className:"bd-controls bd-addon-controls"},bt.createElement(mt,{onChange:this.search,placeholder:`Search ${this.props.type}...`}),bt.createElement("div",{className:"bd-addon-dropdowns"},bt.createElement("div",{className:"bd-select-wrapper"},bt.createElement("label",{className:"bd-label"},"Sort by:"),bt.createElement(dt,{options:this.sortOptions,onChange:this.sort,style:"transparent"})),bt.createElement("div",{className:"bd-select-wrapper"},bt.createElement("label",{className:"bd-label"},"Order:"),bt.createElement(dt,{options:this.directions,onChange:this.reverse,style:"transparent"})))),bt.createElement("div",{className:"bda-slist bd-addon-list"},t)),bt.createElement(Me,{key:"tools"}))}}var yt=new class{constructor(){this.sideBarOnClick=this.sideBarOnClick.bind(this),this.onChange=this.onChange.bind(this),this.updateSettings=this.updateSettings.bind(this),this.sidebar=new Ee(this.sideBarOnClick),this.buildPluginProps=this.buildPluginProps.bind(this),this.buildThemeProps=this.buildThemeProps.bind(this),this.showOriginal=this.showOriginal.bind(this)}get root(){const e=A.query("#bd-settingspane-container");return e||(this.injectRoot()?this.root:null)}injectRoot(){const e=A.query(".layer-3QrUeG .standardSidebarView-3F1I7i, .layer-3QrUeG .ui-standard-sidebar-view");if(!e)return!1;const t=A.createElement('<div id="bd-settingspane-container" class="contentRegion-3nDuYy content-region">');return e.append(t),O.onRemoved(t,()=>{F.reactDom.unmountComponentAtNode(t)}),!0}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 emoteSettings(){return this.getSettings("emote")}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},[])}sideBarOnClick(e){switch(A.query(".contentRegion-3nDuYy, .content-region").style.display="none",this.root.style.display="",e){case"core":this.renderCoreSettings();break;case"emotes":this.renderEmoteSettings();break;case"customcss":this.renderCustomCssEditor();break;case"plugins":this.renderPluginPane();break;case"themes":this.renderThemePane()}}onClick(){}onChange(e,t){this.updateSettings(e,t)}updateSettings(e,t){u[e]=t,"bda-gs-2"==e&&(t?A.addClass(document.body,"bd-minimal"):A.removeClass(document.body,"bd-minimal")),"bda-gs-3"==e&&(t?A.addClass(document.body,"bd-minimal-chan"):A.removeClass(document.body,"bd-minimal-chan")),"bda-gs-1"==e&&(t?Ie.addButton():Ie.removeButton()),"bda-gs-4"==e&&(t?$e.start():$e.stop()),"bda-gs-5"==e&&(t?A.addClass(A.query("#app-mount"),"bda-dark"):A.removeClass(A.query("#app-mount"),"bda-dark")),t&&"bda-gs-6"==e&&ke.inject24Hour(),"bda-gs-7"==e&&(t?we.injectColoredText():we.removeColoredText()),"fork-ps-4"==e&&(t?_e.start():_e.stop()),"fork-ps-5"==e&&(t?(Q.watchContent("plugin"),Q.watchContent("theme")):(Q.unwatchContent("plugin"),Q.unwatchContent("theme"))),"fork-wp-1"==e&&(O.setWindowPreference("transparent",t),t?O.setWindowPreference("backgroundColor",null):O.setWindowPreference("backgroundColor","#2f3136")),"bda-gs-8"==e&&(t?We.startDebugListener():We.stopDebugListener()),"fork-dm-1"==e&&(t?We.startCopySelector():We.stopCopySelector()),"reactDevTools"===e&&(t?Te.start():Te.stop()),this.saveSettings()}async initializeSettings(){u["bda-gs-2"]&&A.addClass(document.body,"bd-minimal"),u["bda-gs-3"]&&A.addClass(document.body,"bd-minimal-chan"),u["bda-gs-1"]&&Ie.addButton(),u["bda-gs-4"]&&$e.start(),u["bda-gs-5"]&&A.addClass(A.query("#app-mount"),"bda-dark"),u["bda-gs-6"]&&ke.inject24Hour(),u["bda-gs-7"]&&we.injectColoredText(),u["fork-ps-4"]&&_e.start(),u["fork-ps-5"]&&(Q.watchContent("plugin"),Q.watchContent("theme")),u["bda-gs-8"]&&We.startDebugListener(),u["fork-dm-1"]&&We.startCopySelector(),u.reactDevTools&&Te.start(),this.saveSettings()}saveSettings(){ee.setSettingGroup("settings",u)}loadSettings(){Object.assign(u,ee.getSettingGroup("settings"))}showOriginal(){F.reactDom.unmountComponentAtNode(this.root),this.root.style.display="none",A.query(".contentRegion-3nDuYy, .content-region").style.display=""}renderSidebar(){const e=document.querySelectorAll("[class*='side-'] > [class*='item-']");for(const t of e)t.removeEventListener("click",this.showOriginal),t.addEventListener("click",this.showOriginal);this.sidebar.render()}get coreComponent(){return F.react.createElement(Ae,{contentColumn:!0,fade:!0,dark:!0},F.react.createElement(Ue,{key:"cspanel",onChange:this.onChange,sections:this.coreSettings}),F.react.createElement(Me,{key:"tools"}))}get emoteComponent(){return F.react.createElement(Ae,{contentColumn:!0,fade:!0,dark:!0},F.react.createElement(Je,{key:"espanel",title:"Emote Settings",onChange:this.onChange,settings:this.emoteSettings,button:{title:"Clear Emote Cache",onClick:()=>{ae.clearEmoteData(),ae.init(),oe.init()}}}),F.react.createElement(Me,{key:"tools"}))}get customCssComponent(){return F.react.createElement(Ae,{contentColumn:!0,fade:!0,dark:!0},F.react.createElement(Ye,{key:"csseditor"}),F.react.createElement(Me,{key:"tools"}))}contentComponent(e){const t=this.getAddonList(e),n=e.replace("s",""),s=this;class o extends F.react.Component{constructor(e){super(e),this.onChange=this.onChange.bind(this)}componentDidMount(){R.on(`${n}-reloaded`,this.onChange),R.on(`${n}-loaded`,this.onChange),R.on(`${n}-unloaded`,this.onChange)}componentWillUnmount(){R.off(`${n}-reloaded`,this.onChange),R.off(`${n}-loaded`,this.onChange),R.off(`${n}-unloaded`,this.onChange)}onChange(){s.sideBarOnClick(e)}render(){return t}}return F.react.createElement(o)}getString(e){return e?"string"==typeof e?e:e.toString():"???"}buildPluginProps(e){const t=e.plugin;return Object.assign({},e,{name:this.getString(t.getName()),author:this.getString(t.getAuthor()),description:this.getString(t.getDescription()),version:this.getString(t.getVersion()),getSettingsPanel:t.getSettingsPanel&&t.getSettingsPanel.bind(t)})}buildThemeProps(e){return Object.assign({},e,{name:this.getString(e.name),author:this.getString(e.author),description:this.getString(e.description),version:this.getString(e.version)})}getAddonList(e){const t="plugins"===e?Object.values(S):Object.values(k);return F.react.createElement(vt,{type:e,list:t})}renderCoreSettings(){const e=this.root;e?F.reactDom.render(this.coreComponent,e):console.log("FAILED TO LOCATE ROOT: .layer-3QrUeG .standardSidebarView-3F1I7i")}renderEmoteSettings(){const e=this.root;e?F.reactDom.render(this.emoteComponent,e):console.log("FAILED TO LOCATE ROOT: .layer-3QrUeG .standardSidebarView-3F1I7i")}renderCustomCssEditor(){const e=this.root;e?F.reactDom.render(this.customCssComponent,e):console.log("FAILED TO LOCATE ROOT: .layer-3QrUeG .standardSidebarView-3F1I7i")}renderPluginPane(){const e=this.root;e?F.reactDom.render(this.contentComponent("plugins"),e):console.log("FAILED TO LOCATE ROOT: .layer-3QrUeG .standardSidebarView-3F1I7i")}renderThemePane(){const e=this.root;e?F.reactDom.render(this.contentComponent("themes"),e):console.log("FAILED TO LOCATE ROOT: .layer-3QrUeG .standardSidebarView-3F1I7i")}};class Ct extends F.reactComponent{render(){return F.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"},F.react.createElement("metadata",null),F.react.createElement("defs",null,F.react.createElement("filter",{id:"shadow1"},F.react.createElement("feDropShadow",{dx:"20",dy:"0",stdDeviation:"20","flood-color":"rgba(0,0,0,0.35)"})),F.react.createElement("filter",{id:"shadow2"},F.react.createElement("feDropShadow",{dx:"15",dy:"0",stdDeviation:"20","flood-color":"rgba(255,255,255,0.15)"})),F.react.createElement("filter",{id:"shadow3"},F.react.createElement("feDropShadow",{dx:"10",dy:"0",stdDeviation:"20","flood-color":"rgba(0,0,0,0.35)"}))),F.react.createElement("g",null,F.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"}),F.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"}),F.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 Et(){}Et.prototype.setConfig=function(e){Object.assign(m,e)},Et.prototype.init=async function(){if(!Array.prototype.flat)return void O.alert("Not Supported","BetterDiscord v"+a+" does not support this old version ("+r+") of Discord. Please update your Discord installation before proceeding.");if(m.version<i)return void O.alert("Not Supported","BetterDiscord v"+m.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 O.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 O.alert("Not Supported","BandagedBD does not work with Powercord. Please uninstall one of them.");const e=m.updater?m.updater.LatestVersion:m.latestVersion;e>m.version&&O.alert("Update Available",`\n An update for BandagedBD is available (${e})! Please Reinstall!<br /><br />\n <a href='https://github.com/rauenzi/BetterDiscordApp/releases/latest' target='_blank'>Download Installer</a>\n `),O.log("Startup","Initializing Settings"),this.initSettings(),O.log("Startup","Initializing EmoteModule"),window.emotePromise=ae.init().then(()=>{ae.initialized=!0,O.log("Startup","Initializing QuickEmoteMenu"),oe.init()}),this.injectExternals(),await this.checkForGuilds(),F.initialize(),O.log("Startup","Updating Settings"),yt.initializeSettings(),O.log("Startup","Loading Plugins"),$.loadPlugins(),O.log("Startup","Loading Themes"),_.loadThemes(),A.addStyle("customcss",atob(ee.getBDData("bdcustomcss"))),window.addEventListener("beforeunload",(function(){u["bda-dc-0"]&&document.querySelector(".btn.btn-disconnect").click()})),O.log("Startup","Removing Loading Icon"),document.getElementsByClassName("bd-loaderv2").length&&document.getElementsByClassName("bd-loaderv2")[0].remove(),O.log("Startup","Initializing Main Observer"),this.initObserver(),u["fork-ps-1"]&&(O.log("Startup","Collecting Startup Errors"),O.showContentErrors({plugins:h,themes:p}));const t=ee.getBDData("version");a>t&&(l&&this.showChangelogModal(l),ee.setBDData("version",a)),O.suppressErrors(this.patchSocial.bind(this),"BD Social Patch")(),O.suppressErrors(this.patchGuildPills.bind(this),"BD Guild Pills Patch")(),O.suppressErrors(this.patchGuildListItems.bind(this),"BD Guild List Items Patch")(),O.suppressErrors(this.patchGuildSeparator.bind(this),"BD Guild Separator Patch")()},Et.prototype.checkForGuilds=function(){let e=0;return new Promise(t=>{const n=function(){const s=F.guildClasses.wrapper.split(" ")[0];document.querySelectorAll(`.${s}`).length>0&&e++;const o=F.guildClasses.listItem.split(" ")[0],r=F.guildClasses.blobContainer.split(" ")[0];return document.querySelectorAll(`.${s} .${o} .${r}`).length>0||e>=50?t(m.deferLoaded=!0):void setTimeout(n,100)};"loading"!=document.readyState&&setTimeout(n,100),document.addEventListener("DOMContentLoaded",()=>{setTimeout(n,100)})})},Et.prototype.injectExternals=async function(){await A.addScript("ace-script","https://cdnjs.cloudflare.com/ajax/libs/ace/1.2.9/ace.js"),window.require.original&&(window.require=window.require.original)},Et.prototype.initSettings=function(){if(ee.initialize(),ee.getSettingGroup("settings")){yt.loadSettings();for(const e in d)null==u[e]&&(u[e]=d[e],yt.saveSettings())}else Object.assign(u,d),yt.saveSettings()},Et.prototype.initObserver=function(){new MutationObserver(e=>{for(let t=0,n=e.length;t<n;t++){const n=e[t];if(void 0!==$&&$.rawObserver(n),!(n.addedNodes.length&&n.addedNodes[0]instanceof Element))continue;const s=n.addedNodes[0];s.classList.contains("layer-3QrUeG")&&(s.getElementsByClassName("guild-settings-base-section").length&&s.setAttribute("layer-id","server-settings"),s.getElementsByClassName("socialLinks-3jqNFy").length&&(s.setAttribute("layer-id","user-settings"),s.setAttribute("id","user-settings"),document.getElementById("bd-settings-sidebar")||yt.renderSidebar())),s.parentElement==document.body&&s.querySelector("#ace_settingsmenu")&&(s.id="ace_settingsmenu_container"),s.classList.contains("layer-v9HyYc")&&s.getElementsByClassName("emojiPicker-3m1S-j").length&&!s.querySelector(".emojiPicker-3m1S-j").parentElement.classList.contains("animatorLeft-1EQxU0")&&oe.obsCallback(s)}}).observe(document,{childList:!0,subtree:!0})},Et.prototype.showChangelogModal=function(e={}){return O.showChangelogModal(e)},Et.prototype.patchSocial=function(){if(this.socialPatch)return;const e=T(e=>"TabBar"==e.displayName),t=T(e=>"Anchor"==e.displayName);e&&t&&(this.socialPatch=O.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;const s=n[n.length-2].type;n[n.length-2].type=function(){const e=s(...arguments);return e.props.children.push(F.React.createElement(Ce,{color:"black",side:"top",text:"BandagedBD"},F.React.createElement(t,{className:"bd-social-link",href:"https://github.com/rauenzi/BetterDiscordApp",title:"BandagedBD",target:"_blank"},F.React.createElement(Ct,{size:"16px",className:"bd-social-logo"})))),e};const o=F.React.createElement(t,{className:"bd-social-link",href:"https://twitter.com/BandagedBD",title:"BandagedBD",target:"_blank"},"BandagedBD"),r=F.React.createElement(t,{className:"bd-social-link",href:"https://twitter.com/ZackRauen",title:"Zerebos",target:"_blank"},"Zerebos"),i=F.react.createElement("div",{className:"colorMuted-HdFt4q size12-3cLvbJ"},[o,` ${a} by `,r]),l=F.react.createElement("div",{className:"colorMuted-HdFt4q size12-3cLvbJ"},["BBD Injector",` ${m.version} by `,r]),c=n[n.length-1].type;n[n.length-1].type=function(){const e=c(...arguments);return e.props.children.push(l),e.props.children.push(i),e}}}))};Et.prototype.patchGuildListItems=function(){if(this.guildListItemsPatch)return;const e=function(){const e=M("wrapper","unreadMentionsBar"),t=M("guildsError","selected"),n=M("blobContainer");return Object.assign({},e,t,n)}(),t=e.listItem.split(" ")[0],n=e.blobContainer.split(" ")[0],s=F.getInternalInstance(document.querySelector(`.${t} .${n}`).parentElement).return.type;s&&(this.guildListItemsPatch=O.monkeyPatch(s.prototype,"render",{after:e=>{if(e.returnValue&&e.thisObject){const t=e.returnValue,n=e.thisObject.props;return t.props.className+=" bd-guild",n.unread&&(t.props.className+=" bd-unread"),n.selected&&(t.props.className+=" bd-selected"),n.audio&&(t.props.className+=" bd-audio"),n.video&&(t.props.className+=" bd-video"),n.badge&&(t.props.className+=" bd-badge"),n.animatable&&(t.props.className+=" bd-animatable"),t}}}))},Et.prototype.patchGuildPills=function(){if(this.guildPillPatch)return;const e=T(e=>e.default&&!e.default.displayName&&e.default.toString&&e.default.toString().includes("translate3d"));e&&(this.guildPillPatch=O.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}}))},Et.prototype.patchGuildSeparator=function(){if(this.guildSeparatorPatch)return;const e=B("Guilds"),t=M("renderListItem");if(!t||!e)return;const n=function(){const e=t.Separator(...arguments);return e.props.className+=" bd-guild-separator",e};this.guildSeparatorPatch=O.monkeyPatch(e.prototype,"render",{after:e=>{e.returnValue.props.children[1].props.children[3].type=n}})};var wt=new Et;const kt={get React(){return F.React},get ReactDOM(){return F.ReactDom},get ReactComponent(){return F.ReactComponent},get WindowConfigFile(){return O.WindowConfigFile},get settings(){return c},get emotes(){return E},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 O.getAllWindowPreferences()},getWindowPreference:function(e){return O.getWindowPreference(e)},setWindowPreference:function(e,t){return O.setWindowPreference(e,t)},injectCSS:function(e,t){A.addStyle(A.escapeID(e),t)},clearCSS:function(e){A.removeStyle(A.escapeID(e))},linkJS:function(e,t){A.addScript(A.escapeID(e),t)},unlinkJS:function(e){A.removeScript(A.escapeID(e))},getPlugin:function(e){return S.hasOwnProperty(e)?S[e].plugin:null},getCore:function(){return O.warn("Deprecation Notice","BdApi.getCore() will be removed in future versions."),wt},alert:function(e,t){const n=kt.findModuleByProps("push","update","pop","popWithKey"),s=kt.findModuleByPrototypes("handleCancel","handleSubmit","handleMinorConfirm");if(!n||!s)return wt.alert(e,t);n.push((function(n){return kt.React.createElement(s,Object.assign({title:e,body:t},n))}))},showConfirmationModal:function(e,t,n={}){const s=kt.findModuleByProps("push","update","pop","popWithKey"),o=kt.findModuleByProps("Sizes","Weights"),r=kt.findModule(e=>e.defaultProps&&e.key&&"confirm-modal"==e.key());if(!s||!r||!o)return wt.alert(e,t);const{onConfirm:i,onCancel:a,confirmText:l,cancelText:c,danger:d=!1}=n;"string"==typeof t?t=o({color:o.Colors.PRIMARY,children:[t]}):Array.isArray(t)&&(t=o({color:o.Colors.PRIMARY,children:t})),t=[t];const u=()=>{};s.push((function(n){return kt.React.createElement(r,Object.assign({header:e,children:t,red:d,confirmText:l||"Okay",cancelText:c||"Cancel",onConfirm:i||u,onCancel:a||u},n))}))},showToast:function(e,t={}){O.showToast(e,t)},findModule:function(e){return F.WebpackModules.find(e)},findAllModules:function(e){return F.WebpackModules.findAll(e)},findModuleByProps:function(...e){return F.WebpackModules.findByUniqueProperties(e)},findModuleByPrototypes:function(...e){return F.WebpackModules.findByPrototypes(e)},findModuleByDisplayName:function(e){return F.WebpackModules.findByDisplayName(e)},getInternalInstance:function(e){if(e instanceof window.jQuery||e instanceof Element)return e instanceof jQuery&&(e=e[0]),F.getInternalInstance(e)},loadData:function(e,t){return ee.getPluginData(e,t)}};kt.getData=kt.loadData,kt.saveData=function(e,t,n){return ee.setPluginData(e,t,n)},kt.setData=kt.saveData,kt.deleteData=function(e,t){return ee.deletePluginData(e,t)},kt.monkeyPatch=function(e,t,n){return O.monkeyPatch(e,t,n)},kt.onRemoved=function(e,t){return O.onRemoved(e,t)},kt.suppressErrors=function(e,t){return O.suppressErrors(e,t)},kt.testJSON=function(e){return O.testJSON(e)},kt.isPluginEnabled=function(e){return!!x[e]},kt.isThemeEnabled=function(e){return!!D[e]},kt.isSettingEnabled=function(e){return!!u[e]},kt.enableSetting=function(e){return yt.onChange(e,!0)},kt.disableSetting=function(e){return yt.onChange(e,!1)},kt.toggleSetting=function(e){return yt.onChange(e,!u[e])},kt.getBDData=function(e){return ee.getBDData(e)},kt.setBDData=function(e,t){return ee.setBDData(e,t)};const St=(e,t,n)=>new class{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)}};kt.Plugins=St(x,S,$),kt.Themes=St(D,k,_);var xt=kt;n.d(t,"default",(function(){return Pt})),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,{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 Dt=(e,t)=>{Object.defineProperty(window,e,{get:()=>(O.warn("Deprecation Notice",`"${e}" will be removed in future versions. Please only use BdApi.`),t)})},Nt=Object.keys(s);for(const e of Nt)Dt(e,s[e]);Dt("BDV2",F),Dt("pluginModule",$),Dt("themeModule",_),Dt("Utils",O),Dt("BDEvents",R),Dt("settingsPanel",yt),Dt("DataStore",ee),Dt("emoteModule",ae),Dt("ContentManager",Q),Dt("ClassNormalizer",_e),window.BdApi=xt;class Pt{constructor(e){wt.setConfig(e)}init(){wt.init()}}}]).default;