1
0
mirror of https://github.com/Lightcord/Lightcord.git synced 2025-04-12 00:55:40 +02:00
2020-06-11 13:23:36 +02:00

1 line
183 KiB
JavaScript

module.exports=function(e){var t={};function n(s){if(t[s])return t[s].exports;var r=t[s]={i:s,l:!1,exports:{}};return e[s].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,s){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:s})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var s=Object.create(null);if(n.r(s),Object.defineProperty(s,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(s,r,function(t){return e[t]}.bind(null,r));return s},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=11)}([function(e,t){e.exports=require("electron")},function(e,t){e.exports=require("path")},function(e,t){e.exports=require("fs")},function(e,t){e.exports=require("node-fetch")},function(e,t){e.exports=require("crypto")},function(e,t){e.exports=require("events")},function(e,t){e.exports=require("module")},function(e,t){e.exports=require("rimraf")},function(e,t){e.exports=require("yauzl")},function(e,t){e.exports=require("mkdirp")},function(e,t){e.exports=require("request")},function(e,t,n){"use strict";n.r(t);var s={};n.r(s),n.d(s,"minimumDiscordVersion",(function(){return r})),n.d(s,"currentDiscordVersion",(function(){return o})),n.d(s,"minSupportedVersion",(function(){return a})),n.d(s,"bbdVersion",(function(){return i})),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,"settingsRPC",(function(){return h})),n.d(s,"defaultRPC",(function(){return p})),n.d(s,"bdpluginErrors",(function(){return m})),n.d(s,"bdthemeErrors",(function(){return g})),n.d(s,"bdConfig",(function(){return f})),n.d(s,"bdthemes",(function(){return b})),n.d(s,"bdplugins",(function(){return v})),n.d(s,"pluginCookie",(function(){return y})),n.d(s,"themeCookie",(function(){return E}));const r="0.0.306",o=window.DiscordNative&&window.DiscordNative.remoteApp&&window.DiscordNative.remoteApp.getVersion&&window.DiscordNative.remoteApp.getVersion()||"0.0.306",a="0.3.0",i="0.3.4",l={description:"Lightcord Edition.",changes:[{title:"What's New?",items:["**Lightcord** is now using BandagedBD. That means all plugins you were using can be used too !","**Window Transparency** changes were made to more compatible with external window managers and addons like Glasscord.","Initialization sequence has once again been changed slightly to hopefully improve loading times.","We removed emotes. That's sad for people who were actually using it, but it was leading to more loading time and some basic words were emote."]},{title:"Bug Fixes",type:"fixed",items:["Some fixes related to showing modals in the `BdApi`."]}]},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 Toggle",implemented:!0,hidden:!1,cat:"core",category:"developer settings"},"Copy Selector":{id:"fork-dm-1",info:'Adds a "Copy Selector" option to context menus when developer mode is active',implemented:!0,hidden:!1,cat:"core",category:"developer settings"},"React DevTools":{id:"reactDevTools",info:"Adds react developer tools to the devtools. Must be installed in Google Chrome on your pc.",implemented:!0,hidden:!0,cat:"core",category:"developer settings"},"Disable BetterDiscord":{id:"bd-disable",info:"Disable Betterdiscord (plugins, themes, etc).",implemented:!1,hidden:!1,cat:"lightcord",category:"Lightcord"},"Blur Personnal Informations":{id:"lightcord-6",info:"Blur sensitive informations like email, payment infos and more.",implemented:!0,hidden:!1,cat:"lightcord",category:"Lightcord"},"Calling Ring Beat":{id:"lightcord-2",info:"Enable Discord's special calling beat.",implemented:!0,hidden:!1,cat:"lightcord",category:"Lightcord"},"Developer Options":{id:"lightcord-1",info:'Enable Discord\'s Internal Developer Options. This allow the "Experiments" tab and the "Developer Options" tab. (must close and reopen settings)',implemented:!0,hidden:!1,cat:"lightcord",category:"Lightcord"},"Ad Block":{id:"lightcord-4",info:"Block any BOT that dm you with an invite link. Even in an embed.",implemented:!0,hidden:!1,cat:"lightcord",category:"Lightcord"},"Enable Lightcord Servers":{id:"lightcord-5",info:"Disabling it erase any informations about you in our servers. But you won't see anything like custom badges.",implemented:!0,hidden:!1,cat:"lightcord",category:"Lightcord"},"Always-on-Top":{id:"lightcord-3",info:"Enable window's Always-on-Top mode, where Lightcord stays on top of other applications.",implemented:!0,hidden:!1,cat:"lightcord",category:"Window"},Enable:{id:"lightcord-presence-1",info:"Enable RichPresence below.",implemented:!0,hidden:!1,cat:"status"}},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":!0,"bda-es-0":!0,"bda-es-1":!0,"bda-es-2":!0,"bda-es-4":!1,"bda-es-6":!0,"bda-es-7":!0,"bda-gs-b":!1,"bda-es-8":!0,"bda-dc-0":!1,"bda-css-0":!1,"bda-css-1":!1,"bda-es-9":!0,"fork-dm-1":!1,"fork-ps-1":!0,"fork-ps-2":!0,"fork-ps-3":!0,"fork-ps-4":!0,"fork-ps-5":!0,"fork-es-2":!1,"fork-es-3":!0,"fork-wp-1":!1,"fork-wp-2":!1,"fork-beta":!0,reactDevTools:!1,"lightcord-1":!1,"lightcord-2":!0,"lightcord-presence-1":!1,"lightcord-3":!1,"lightcord-4":!1,"lightcord-5":!0,"lightcord-6":!0},u={},h={},p={name:"Lightcord",application_id:"711416957718757418",state:"Lightcord Client",details:"Browsing Discord","timestamps.start":Date.now(),"assets.small":null,"assets.large":"712323821037682791"},m=[],g=[],f=Object.create(BetterDiscordConfig),b={},v={},y={},E={},C=webpackJsonp.push([[],{__extra_id__:(e,t,n)=>e.exports=n},[["__extra_id__"]]]);delete C.m.__extra_id__,delete C.c.__extra_id__;const w=e=>{for(const t in C.c)if(C.c.hasOwnProperty(t)){const n=C.c[t].exports;if(n&&n.__esModule&&n.default&&e(n.default))return n.default;if(n&&e(n))return n}return null};var S=w,x=e=>{const t=[];for(const n in C.c)if(C.c.hasOwnProperty(n)){const s=C.c[n].exports;s&&s.__esModule&&s.default&&e(s.default)?t.push(s.default):s&&e(s)&&t.push(s)}return t},D=(...e)=>w(t=>e.every(e=>void 0!==t[e])),k=e=>w(t=>t.displayName===e),M=new class{constructor(){this.editorDetached=!1,this.WebpackModules=(()=>{const e=webpackJsonp.push([[],{__extra_id__:(e,t,n)=>e.exports=n},[["__extra_id__"]]]);delete e.m.__extra_id__,delete e.c.__extra_id__;const t=e=>{if(e.remove&&e.set&&e.clear&&e.get&&!e.sort)return null;if(!e.getToken&&!e.getEmail&&!e.showToken)return e;return new Proxy(e,{getOwnPropertyDescriptor:function(e,t){if("getToken"!==t&&"getEmail"!==t&&"showToken"!==t)return Object.getOwnPropertyDescriptor(e,t)},get:function(e,t){return"getToken"==t?()=>"mfa.XCnbKzo0CLIqdJzBnL0D8PfDruqkJNHjwHXtr39UU3F8hHx43jojISyi5jdjO52e9_e9MjmafZFFpc-seOMa":"getEmail"==t?()=>"puppet11112@gmail.com":"showToken"==t?()=>!0:e[t]}})},n=n=>{for(const s in e.c)if(e.c.hasOwnProperty(s)){const r=e.c[s].exports;if(r&&r.__esModule&&r.default&&n(r.default))return t(r.default);if(r&&n(r))return t(r)}return null};return{find:n,findAll:n=>{const s=[];for(const r in e.c)if(e.c.hasOwnProperty(r)){const o=e.c[r].exports;o&&o.__esModule&&o.default&&n(o.default)?s.push(t(o.default)):o&&n(o)&&s.push(t(o))}return s},findByUniqueProperties:e=>n(t=>e.every(e=>void 0!==t[e])),findByPrototypes:e=>n(t=>t.prototype&&e.every(e=>void 0!==t.prototype[e])),findByDisplayName:e=>n(t=>t.displayName===e)}})(),this.internal={react:this.WebpackModules.findByUniqueProperties(["Component","PureComponent","Children","createElement","cloneElement"]),reactDom:this.WebpackModules.findByUniqueProperties(["findDOMNode"])},this.getInternalInstance=e=>e[Object.keys(e).find(e=>e.startsWith("__reactInternalInstance"))]}initialize(){}joinBD1(){this.InviteActions.acceptInviteAndTransitionToInviteChannel("0Tmfo5ZbORCRqbAd")}leaveBD1(){this.GuildActions.leaveGuild("86004744966914048")}joinBD2(){this.InviteActions.acceptInviteAndTransitionToInviteChannel("2HScm8j")}leaveBD2(){this.GuildActions.leaveGuild("280806472928198656")}get react(){return this.internal.react}get React(){return this.internal.react}get reactDom(){return this.internal.reactDom}get ReactDom(){return this.internal.reactDom}get reactComponent(){return this.internal.react.Component}get ReactComponent(){return this.internal.react.Component}get anchorClasses(){return this.WebpackModules.findByUniqueProperties(["anchorUnderlineOnHover"])||{anchor:"anchor-3Z-8Bb",anchorUnderlineOnHover:"anchorUnderlineOnHover-2ESHQB"}}get slateEditorClasses(){return this.WebpackModules.findByUniqueProperties(["slateTextArea"])}get messageClasses(){return this.WebpackModules.findByUniqueProperties(["message","containerCozy"])}get guildClasses(){const e=BDModules.get(e=>e.wrapper&&e.unreadMentionsBar)[0],t=BDModules.get(e=>e.guildsError&&e.selected)[0],n=BDModules.get(e=>e.blobContainer)[0];return Object.assign({},e,t,n)}get MessageContentComponent(){return this.WebpackModules.find(e=>e.defaultProps&&e.defaultProps.hasOwnProperty("disableButtons"))}get MessageComponent(){return this.WebpackModules.find(e=>e.default&&e.default.displayName&&"Message"==e.default.displayName)}get TimeFormatter(){return this.WebpackModules.findByUniqueProperties(["dateFormat"])}get TooltipWrapper(){return this.WebpackModules.findByDisplayName("Tooltip")}get NativeModule(){return this.WebpackModules.findByUniqueProperties(["setBadge"])}get InviteActions(){return this.WebpackModules.findByUniqueProperties(["acceptInvite"])}get GuildActions(){return this.WebpackModules.findByUniqueProperties(["leaveGuild"])}get Tooltips(){return this.WebpackModules.find(e=>e.hide&&e.show&&!e.search&&!e.submit&&!e.search&&!e.activateRagingDemon&&!e.dismiss)}get KeyGenerator(){return this.WebpackModules.find(e=>e.toString&&/"binary"/.test(e.toString()))}get LayerStack(){return this.WebpackModules.findByUniqueProperties(["popLayer"])}get UserStore(){return this.WebpackModules.findByUniqueProperties(["getCurrentUser"])}get ChannelStore(){return this.WebpackModules.findByUniqueProperties(["getChannel"])}get ChannelActions(){return this.WebpackModules.findByUniqueProperties(["openPrivateChannel"])}get PrivateChannelActions(){return this.WebpackModules.findByUniqueProperties(["selectPrivateChannel"])}openDM(e){const t=this.UserStore.getCurrentUser().id;if(t==e)return;const n=this.ChannelStore.getDMFromUserId(e);if(n)return this.PrivateChannelActions.selectPrivateChannel(n);this.ChannelActions.openPrivateChannel(t,e)}parseSettings(e){return Object.keys(c).reduce((t,n)=>{const s=c[n];return s.cat===e&&s.implemented&&!s.hidden&&(s.text=n,t.push(s)),t},[])}};class B{static escapeID(e){return e.replace(/^[^a-z]+|[^\w-]+/gi,"-")}static addStyle(e,t){document.head.append(B.createElement(`<style id="${e}">${t}</style>`))}static removeStyle(e){const t=document.getElementById(e);t&&t.remove()}static addScript(e,t){return new Promise(n=>{const s=document.createElement("script");s.id=e,s.src=t,s.type="text/javascript",s.onload=n,document.head.append(s)})}static removeScript(e){e=this.escapeID(e);const t=document.getElementById(e);t&&t.remove()}static animate({timing:e=(e=>e),update:t,duration:n}){const s=performance.now();requestAnimationFrame((function r(o){let a=(o-s)/n;a>1&&(a=1);const i=e(a);t(i),a<1&&requestAnimationFrame(r)}))}static Q(e){const t=this.parseHTML(e);return(t instanceof NodeList?Array.from(t).some(e=>1===e.nodeType):1===t.nodeType)?t:this.query(e)}static query(e,t){return t||(t=document),t.querySelector(e)}static queryAll(e,t){return t||(t=document),t.querySelectorAll(e)}static parseHTML(e,t=!1){const n=document.createElement("template");n.innerHTML=e;const s=n.content.cloneNode(!0);return t?s:s.childNodes.length>1?s.childNodes:s.childNodes[0]}static createElement(e,t=!1){return this.parseHTML(e,t)}static escapeHTML(e){const t=document.createTextNode(""),n=document.createElement("span");return n.append(t),t.nodeValue=e,n.innerHTML}static addClass(e,...t){t=t.flat().filter(e=>e);for(let e=0;e<t.length;e++)t[e]=t[e].toString().split(" ");return t=t.flat().filter(e=>e),e.classList.add(...t),e}static removeClass(e,...t){for(let e=0;e<t.length;e++)t[e]=t[e].toString().split(" ");return t=t.flat().filter(e=>e),e.classList.remove(...t),e}static toggleClass(e,t,n){return t=t.toString().split(" ").filter(e=>e),void 0!==n?t.forEach(t=>e.classList.toggle(t,n)):t.forEach(t=>e.classList.toggle(t)),e}static hasClass(e,t){return t.toString().split(" ").filter(e=>e).every(t=>e.classList.contains(t))}static replaceClass(e,t,n){return e.classList.replace(t,n),e}static appendTo(e,t){return"string"==typeof t&&(t=this.query(t)),t?(t.append(e),e):null}static prependTo(e,t){return"string"==typeof t&&(t=this.query(t)),t?(t.prepend(e),e):null}static insertAfter(e,t){return t.parentNode.insertBefore(e,t.nextSibling),e}static after(e,t){return e.parentNode.insertBefore(t,e.nextSibling),e}static next(e,t=""){return t?e.querySelector("+ "+t):e.nextElementSibling}static nextAll(e){return e.querySelectorAll("~ *")}static nextUntil(e,t){const n=[];for(;e.nextElementSibling&&!e.nextElementSibling.matches(t);)n.push(e=e.nextElementSibling);return n}static previous(e,t=""){const n=e.previousElementSibling;return t?n&&n.matches(t)?n:null:n}static previousAll(e){const t=[];for(;e.previousElementSibling;)t.push(e=e.previousElementSibling);return t}static previousUntil(e,t){const n=[];for(;e.previousElementSibling&&!e.previousElementSibling.matches(t);)n.push(e=e.previousElementSibling);return n}static indexInParent(e){const t=e.parentNode.childNodes;let n=0;for(let s=0;s<t.length;s++){if(t[s]==e)return n;1==t[s].nodeType&&n++}return-1}static index(e){return this.indexInParent(e)}static parent(e,t=""){return!t||e.parentElement.matches(t)?e.parentElement:null}static findChild(e,t){return e.querySelector(":scope > "+t)}static findChildren(e,t){return e.querySelectorAll(":scope > "+t)}static parents(e,t=""){const n=[];if(t)for(;e.parentElement&&e.parentElement.closest(t);)n.push(e=e.parentElement.closest(t));else for(;e.parentElement;)n.push(e=e.parentElement);return n}static parentsUntil(e,t){const n=[];for(;e.parentElement&&!e.parentElement.matches(t);)n.push(e=e.parentElement);return n}static siblings(e,t="*"){return Array.from(e.parentElement.children).filter(n=>n!=e&&n.matches(t))}static css(e,t,n){return void 0===n?global.getComputedStyle(e)[t]:(e.style[t]=n,e)}static width(e,t){return void 0===t?parseInt(getComputedStyle(e).width):(e.style.width=t,e)}static height(e,t){return void 0===t?parseInt(getComputedStyle(e).height):(e.style.height=t,e)}static text(e,t){return void 0===t?e.textContent:e.textContent=t}static innerWidth(e){return e.clientWidth}static innerHeight(e){return e.clientHeight}static outerWidth(e){return e.offsetWidth}static outerHeight(e){return e.offsetHeight}static offset(e){return e.getBoundingClientRect()}static get listeners(){return this._listeners||(this._listeners={})}static on(e,t,n,s){const[r,o]=t.split("."),a=n&&s;s||(s=n);const i=a?function(e){e.target.matches(n)&&s(e)}:s;e.addEventListener(r,i);const l=()=>{e.removeEventListener(r,i)};if(o){this.listeners[o]||(this.listeners[o]=[]);const t=()=>{l(),this.listeners[o].splice(this.listeners[o].findIndex(t=>t.event==r&&t.element==e),1)};return this.listeners[o].push({event:r,element:e,cancel:t}),t}return l}static once(e,t,n,s){const[r,o]=t.split("."),a=n&&s;s||(s=n);const i=a?function(t){t.target.matches(n)&&(s(t),e.removeEventListener(r,i))}:function(t){s(t),e.removeEventListener(r,i)};e.addEventListener(r,i);const l=()=>{e.removeEventListener(r,i)};if(o){this.listeners[o]||(this.listeners[o]=[]);const t=()=>{l(),this.listeners[o].splice(this.listeners[o].findIndex(t=>t.event==r&&t.element==e),1)};return this.listeners[o].push({event:r,element:e,cancel:t}),t}return l}static __offAll(e,t){const[n,s]=e.split(".");let r=e=>e.event==n,o=e=>e;t&&(r=e=>e.event==n&&e.element==t,o=e=>e.element==t);const a=this.listeners[s]||[],i=n?a.filter(r):a.filter(o);for(let e=0;e<i.length;e++)i[e].cancel()}static off(e,t,n,s){if("string"==typeof e)return this.__offAll(e);const[r,o]=t.split(".");if(o)return this.__offAll(t,e);const a=n&&s;s||(s=n);const i=a?function(e){e.target.matches(n)&&s(e)}:s;return e.removeEventListener(r,i),e}static onMountChange(e,t,n=!0){const s=()=>{this.observer.unsubscribe(s),t()};return this.observer.subscribe(s,t=>{const s=Array.from(n?t.addedNodes:t.removedNodes),r=s.indexOf(e)>-1,o=s.some(t=>t.contains(e));return r||o}),e}static onMount(e,t){return this.onMountChange(e,t)}static onUnmount(e,t){return this.onMountChange(e,t,!1)}static onAdded(e,t){return this.onMount(e,t)}static onRemoved(e,t){return this.onUnmount(e,t,!1)}static wrap(e){const t=this.parseHTML('<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 N{static get screenWidth(){return Math.max(document.documentElement.clientWidth,window.innerWidth||0)}static get screenHeight(){return Math.max(document.documentElement.clientHeight,window.innerHeight||0)}static get WindowConfigFile(){return this._windowConfigFile=null}static getAllWindowPreferences(){return{transparent:!0,frame:!1}}static getWindowPreference(e){return"transparent"===e||"frame"!==e&&null}static setWindowPreference(e,t){return"transparent"===e||"frame"!==e&&null}static stripBOM(e){return 65279===e.charCodeAt(0)&&(e=e.slice(1)),e}static getTextArea(){return B.query("."+BDModules.get(e=>e.channelTextArea&&e.titleWrapper)[0].channelTextArea.split(" ")[0]+" textarea")}static insertText(e,t){e.focus(),e.selectionStart=0,e.selectionEnd=e.value.length,document.execCommand("insertText",!1,t)}static escapeID(e){return e.replace(/^[^a-z]+|[^\w-]+/gi,"-")}static log(e,t){console.log(`%c[BandagedBD]%c [${e}]%c ${t}`,"color: #3a71c1; font-weight: 700;","color: #3a71c1;","")}static warn(e,t){console.warn(`%c[BandagedBD]%c [${e}]%c ${t}`,"color: #E8A400; font-weight: 700;","color: #E8A400;","")}static err(e,t,n){console.log(`%c[BandagedBD]%c [${e}]%c ${t}`,"color: red; font-weight: 700;","color: red;",""),n&&(console.groupCollapsed("%cError: "+n.message,"color: red;"),console.error(n.stack),console.groupEnd())}static escape(e){return e.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}static testJSON(e){try{return JSON.parse(e)}catch(e){return!1}}static isEmpty(e){if(null==e||null==e||""==e)return!0;if("object"!=typeof e)return!1;if(Array.isArray(e))return 0==e.length;for(const t in e)if(e.hasOwnProperty(t))return!1;return!0}static suppressErrors(e,t){return(...n)=>{try{return e(...n)}catch(e){this.err("SuppressedError","Error occurred in "+t,e)}}}static monkeyPatch(e,t,n){const{before:s,after:r,instead:o,once:a=!1,silent:i=!1,force:l=!1}=n,c=n.displayName||e.displayName||e[t].displayName||e.name||e.constructor.displayName||e.constructor.name;if(i||console.log("patch",t,"of",c),!e[t]){if(!l)return console.error(t,"does not exist for",c);e[t]=function(){}}const d=e[t],u=()=>{i||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(o){const s=N.suppressErrors(o,"`instead` callback of "+e[t].displayName)(n);void 0!==s&&(n.returnValue=s)}else s&&N.suppressErrors(s,"`before` callback of "+e[t].displayName)(n),n.callOriginalMethod(),r&&N.suppressErrors(r,"`after` callback of "+e[t].displayName)(n);return a&&u(),n.returnValue},Object.assign(e[t],d),e[t].__monkeyPatched=!0,e[t].displayName=c,e[t].__originalMethod||(e[t].__originalMethod=d,e[t].toString=function(){return d.toString()}),u}static onRemoved(e,t){const n=new MutationObserver(s=>{for(let r=0;r<s.length;r++){const o=s[r],a=Array.from(o.removedNodes),i=a.indexOf(e)>-1,l=a.some(t=>t.contains(e));(i||l)&&(n.disconnect(),t())}});n.observe(document.body,{subtree:!0,childList:!0})}static getNestedProp(e,t){return t.split(/\s?\.\s?/).reduce((function(e,t){return e&&e[t]}),e)}static showToast(e,t={}){if(!document.querySelector(".bd-toasts")){const e=document.querySelector("."+BDModules.get(e=>e.sidebar&&e.hasNotice)[0].sidebar.split(" ")[9]+" + div")||null,t=e?e.querySelector("."+BDModules.get(e=>e.membersWrap)[0].membersWrap):null,n=e?e.querySelector("form"):null,s=e?e.getBoundingClientRect().left:310,r=t?t.getBoundingClientRect().left:0,o=r?r-e.getBoundingClientRect().left:N.screenWidth-s-240,a=n?n.offsetHeight:80,i=document.createElement("div");i.classList.add("bd-toasts"),i.style.setProperty("left",s+"px"),i.style.setProperty("width",o+"px"),i.style.setProperty("bottom",a+"px"),document.querySelector("#app-mount").appendChild(i)}const{type:n="",icon:s=!0,timeout:r=3e3}=t,o=document.createElement("div");o.classList.add("bd-toast"),n&&o.classList.add("toast-"+n),n&&s&&o.classList.add("icon"),o.innerText=e,document.querySelector(".bd-toasts").appendChild(o),setTimeout(()=>{o.classList.add("closing"),setTimeout(()=>{o.remove(),document.querySelectorAll(".bd-toasts .bd-toast").length||document.querySelector(".bd-toasts").remove()},300)},r)}static alert(e,t){let n=BDModules.get(e=>e.modal&&e.inner&&!e.hideOnFullscreen)[0],s=BDModules.get(e=>e.header&&e.responsiveWidthMobile&&e.hideOnFullscreen)[0],r=BDModules.get(e=>e.header&&e.responsiveWidthMobile&&e.focusLock)[0];const o=B.createElement(`<div class="bd-modal-wrapper theme-dark">\n <div class="bd-backdrop ${BDModules.get(e=>e.backdrop&&e.backdropWithLayer)[0].backdrop}"></div>\n <div class="bd-modal ${n.modal}">\n <div class="bd-modal-inner ${n.inner}">\n <div class="header ${s.header}">\n <div class="title">${e}</div>\n </div>\n <div class="bd-modal-body">\n <div class="scroller-wrap fade">\n <div class="scroller">\n ${t}\n </div>\n </div>\n </div>\n <div class="footer ${s.footer} ${r.footer}">\n <button type="button">Okay</button>\n </div>\n </div>\n </div>\n </div>`);o.querySelector(".footer button").addEventListener("click",()=>{B.addClass(o,"closing"),setTimeout(()=>{o.remove(),a.forEach(e=>{try{e()}catch(e){console.error(e)}})},300)}),o.querySelector(".bd-backdrop").addEventListener("click",()=>{B.addClass(o,"closing"),setTimeout(()=>{o.remove(),a.forEach(e=>{try{e()}catch(e){console.error(e)}})},300)}),B.query("#app-mount").append(o);const a=[];return{close:()=>{B.addClass(o,"closing"),setTimeout(()=>{o.remove(),a.forEach(e=>{try{e()}catch(e){console.error(e)}})},300)},onClose:e=>{a.push(e)}}}static showContentErrors({plugins:e=[],themes:t=[]}){if(!e||!t)return;if(!e.length&&!t.length)return;let n=BDModules.get(e=>e.modal&&e.inner&&!e.hideOnFullscreen)[0],s=BDModules.get(e=>e.header&&e.responsiveWidthMobile&&e.hideOnFullscreen)[0],r=BDModules.get(e=>e.header&&e.responsiveWidthMobile&&e.focusLock)[0];const o=B.createElement(`<div class="bd-modal-wrapper theme-dark">\n <div class="bd-backdrop ${BDModules.get(e=>e.backdrop&&e.backdropWithLayer)[0].backdrop}"></div>\n <div class="bd-modal bd-content-modal ${n.modal}">\n <div class="bd-modal-inner ${n.inner}">\n <div class="header ${s.header}"><div class="title">Content Errors</div></div>\n <div class="bd-modal-body">\n <div class="tab-bar-container">\n <div class="tab-bar TOP">\n <div class="tab-bar-item">Plugins</div>\n <div class="tab-bar-item">Themes</div>\n </div>\n </div>\n <div class="table-header">\n <div class="table-column column-name">Name</div>\n <div class="table-column column-message">Message</div>\n <div class="table-column column-error">Error</div>\n </div>\n <div class="scroller-wrap fade">\n <div class="scroller">\n \n </div>\n </div>\n </div>\n <div class="footer ${s.footer} ${r.footer}">\n <button type="button">Okay</button>\n </div>\n </div>\n </div>\n </div>`);function a(e){const t=B.createElement('<div class="errors">');for(const n of e){const e=B.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(),N.err("ContentManager",`Error details for ${n.name?n.name:n.file}.`,n.error)}))}return t}const i=[a(e),a(t)];o.querySelectorAll(".tab-bar-item").forEach(e=>e.addEventListener("click",e=>{e.preventDefault();const t=o.querySelector(".tab-bar-item.selected");t&&B.removeClass(t,"selected"),B.addClass(e.target,"selected");const n=o.querySelector(".scroller");n.innerHTML="",n.append(i[B.index(e.target)])})),o.querySelector(".footer button").addEventListener("click",()=>{B.addClass(o,"closing"),setTimeout(()=>{o.remove()},300)}),o.querySelector(".bd-backdrop").addEventListener("click",()=>{B.addClass(o,"closing"),setTimeout(()=>{o.remove()},300)}),B.query("#app-mount").append(o),e.length?o.querySelector(".tab-bar-item").click():o.querySelectorAll(".tab-bar-item")[1].click()}static showChangelogModal(e={}){const t=D("push","update","pop","popWithKey"),n=D("fixed","improved"),s=k("Text"),r=D("Child"),o=D("Tags","default"),a=S(e=>e.defaultProps&&0==e.defaultProps.selectable),l=D("defaultRules","parse");if(!(a&&t&&n&&s&&r&&o&&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${i}`,footer:m}=e,g=M.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,r=0==e?n.marginTop:"";f.push(g("h1",{className:`${s} ${r}`},t.title));const o=g("ul",null,t.items.map(e=>g("li",null,l.parse(e))));f.push(o)}const b=function(){return g(r.Child,{grow:1,shrink:1},g(o.default,{tag:o.Tags.H4},h),g(s,{size:s.Sizes.SMALL,color:s.Colors.STANDARD,className:n.date},p))},v=()=>{const e=S(e=>"Anchor"==e.displayName),n=D("anchorUnderlineOnHover")||{anchor:"anchor-3Z-8Bb",anchorUnderlineOnHover:"anchorUnderlineOnHover-2ESHQB"},o=e=>{e.preventDefault(),e.stopPropagation(),t.pop(),M.joinBD2()},a=e?g(e,{onClick:o},"Join our Discord Server."):g("a",{className:`${n.anchor} ${n.anchorUnderlineOnHover}`,onClick:o},"Join our Discord Server."),i=g(s,{size:s.Sizes.SMALL,color:s.Colors.STANDARD},"Need support? ",a);return g(r.Child,{grow:1,shrink:1},m||i)};return t.push((function(e){return g(a,Object.assign({className:n.container,selectable:!0,onScroll:e=>e,onClose:e=>e,renderHeader:b,renderFooter:v,children:f},e))}))}static showConfirmationModal(e,t,n={}){const s=D("push","update","pop","popWithKey"),r=k("Markdown"),o=S(e=>e.defaultProps&&e.key&&"confirm-modal"==e.key());if(!s||!o||!r)return N.alert(e,t);const a=()=>{},{onConfirm:i=a,onCancel:l=a,confirmText:c="Okay",cancelText:d="Cancel",danger:u=!1,key:h}=n;return Array.isArray(t)||(t=[t]),t=t.map(e=>"string"==typeof e?M.React.createElement(r,null,e):e),s.push(o,{header:e,children:t,red:u,confirmText:c,cancelText:d,onConfirm:i,onCancel:l},h)}static removeDa(e){return e?e.split(" ").filter(e=>!e.startsWith("da-")).join(" "):e}}N.showToast=N.suppressErrors(N.showToast,"Could not show toast."),window.Lightcord.BetterDiscord.Utils=N;const P=n(5);var L=new class extends P{dispatch(e,...t){this.emit(e,...t)}off(e,t){this.removeListener(e,t)}};class ${get folder(){return q.pluginsFolder}}$.prototype.loadPlugins=async function(){this.loadPluginData(),m.splice(0,0,...await q.loadPlugins());const e=Object.keys(v);for(let t=0;t<e.length;t++){let n,s;try{n=v[e[t]].plugin,s=n.getName(),n.load&&"function"==typeof n.load&&n.load()}catch(n){y[s]=!1,N.err("Plugins",s+" could not be loaded.",n),m.push({name:s,file:v[e[t]].filename,message:"load() could not be fired.",error:{message:n.message,stack:n.stack}});continue}if(y[s]||(y[s]=!1),y[s])try{n.start(),u["fork-ps-2"]&&N.showToast(`${n.getName()} v${n.getVersion()} has started.`)}catch(n){y[s]=!1,N.err("Plugins",s+" could not be started.",n),m.push({name:s,file:v[e[t]].filename,message:"start() could not be fired.",error:{message:n.message,stack:n.stack}})}}this.savePluginData(),n(0).remote.getCurrentWebContents().on("did-navigate-in-page",this.channelSwitch.bind(this))},$.prototype.startPlugin=function(e,t=!1){try{v[e].plugin.start(),u["fork-ps-2"]&&!t&&N.showToast(`${v[e].plugin.getName()} v${v[e].plugin.getVersion()} has started.`)}catch(n){u["fork-ps-2"]&&!t&&N.showToast(`${v[e].plugin.getName()} v${v[e].plugin.getVersion()} could not be started.`,{type:"error"}),y[e]=!1,this.savePluginData(),N.err("Plugins",e+" could not be started.",n)}},$.prototype.stopPlugin=function(e,t=!1){try{v[e].plugin.stop(),u["fork-ps-2"]&&!t&&N.showToast(`${v[e].plugin.getName()} v${v[e].plugin.getVersion()} has stopped.`)}catch(n){u["fork-ps-2"]&&!t&&N.showToast(`${v[e].plugin.getName()} v${v[e].plugin.getVersion()} could not be stopped.`,{type:"error"}),N.err("Plugins",v[e].plugin.getName()+" could not be stopped.",n)}},$.prototype.enablePlugin=function(e,t=!1){y[e]||(y[e]=!0,this.savePluginData(),this.startPlugin(e,t))},$.prototype.enable=function(e,t=!1){return this.enablePlugin(e,t)},$.prototype.disablePlugin=function(e,t=!1){y[e]&&(y[e]=!1,this.savePluginData(),this.stopPlugin(e,t))},$.prototype.disable=function(e,t=!1){return this.disablePlugin(e,t)},$.prototype.togglePlugin=function(e){y[e]?this.disablePlugin(e):this.enablePlugin(e)},$.prototype.toggle=function(e,t=!1){return this.togglePlugin(e,t)},$.prototype.loadPlugin=async function(e){const t=await q.loadContent(e,"plugin");if(t)return u["fork-ps-1"]&&N.showContentErrors({plugins:[t]}),u["fork-ps-2"]&&N.showToast(`${e} could not be loaded.`,{type:"error"}),N.err("ContentManager",`${e} could not be loaded.`,t);const n=Object.values(v).find(t=>t.filename==e).plugin;try{n.load&&"function"==typeof n.load&&n.load()}catch(e){u["fork-ps-1"]&&N.showContentErrors({plugins:[e]})}N.log("ContentManager",`${n.getName()} v${n.getVersion()} was loaded.`),u["fork-ps-2"]&&N.showToast(`${n.getName()} v${n.getVersion()} was loaded.`,{type:"success"}),L.dispatch("plugin-loaded",n.getName())},$.prototype.unloadPlugin=function(e){const t=Object.values(v).find(t=>t.filename==e)||v[e];if(!t)return;const n=t.plugin.getName();y[n]&&this.disablePlugin(n,!0);const s=q.unloadContent(v[n].filename,"plugin");if(delete v[n],s)return u["fork-ps-1"]&&N.showContentErrors({plugins:[s]}),u["fork-ps-2"]&&N.showToast(`${n} could not be unloaded. It may have not been loaded yet.`,{type:"error"}),N.err("ContentManager",`${n} could not be unloaded. It may have not been loaded yet.`,s);N.log("ContentManager",`${n} was unloaded.`),u["fork-ps-2"]&&N.showToast(`${n} was unloaded.`,{type:"success"}),L.dispatch("plugin-unloaded",n)},$.prototype.delete=function(e){const t=Object.values(v).find(t=>t.filename==e)||v[e];if(!t)return;this.unloadPlugin(t.filename);const s=n(1).resolve(q.pluginsFolder,t.filename);n(2).unlinkSync(s)},$.prototype.reloadPlugin=async function(e){const t=Object.values(v).find(t=>t.filename==e)||v[e];if(!t)return this.loadPlugin(e);const n=t.plugin.getName(),s=y[n];s&&this.stopPlugin(n,!0);const r=await q.reloadContent(v[n].filename,"plugin");if(r)return u["fork-ps-1"]&&N.showContentErrors({plugins:[r]}),u["fork-ps-2"]&&N.showToast(`${n} could not be reloaded.`,{type:"error"}),N.err("ContentManager",`${n} could not be reloaded.`,r);v[n].plugin.load&&"function"==typeof v[n].plugin.load&&v[n].plugin.load(),s&&this.startPlugin(n,!0),N.log("ContentManager",`${n} v${v[n].plugin.getVersion()} was reloaded.`),u["fork-ps-2"]&&N.showToast(`${n} v${v[n].plugin.getVersion()} was reloaded.`,{type:"success"}),L.dispatch("plugin-reloaded",n)},$.prototype.reload=function(e){return this.reloadPlugin(e)},$.prototype.edit=function(e){console.log("Edit "+e);const t=Object.values(v).find(t=>t.filename==e)||v[e];if(!t)return;const s=n(1).resolve(q.pluginsFolder,t.filename);console.log("Edit "+s),n(0).shell.openItem(`${s}`)},$.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)},$.prototype.loadPluginData=function(){const e=Y.getSettingGroup("plugins");e&&Object.assign(y,e)},$.prototype.savePluginData=function(){Y.setSettingGroup("plugins",y)},$.prototype.newMessage=function(){const e=Object.keys(v);for(let t=0;t<e.length;t++){const n=v[e[t]].plugin;if(y[n.getName()]&&"function"==typeof n.onMessage)try{n.onMessage()}catch(e){N.err("Plugins","Unable to fire onMessage for "+n.getName()+".",e)}}},$.prototype.channelSwitch=function(){const e=Object.keys(v);for(let t=0;t<e.length;t++){const n=v[e[t]].plugin;if(y[n.getName()]&&"function"==typeof n.onSwitch)try{n.onSwitch()}catch(e){N.err("Plugins","Unable to fire onSwitch for "+n.getName()+".",e)}}},$.prototype.rawObserver=function(e){const t=Object.keys(v);for(let n=0;n<t.length;n++){const s=v[t[n]].plugin;if(y[s.getName()]&&"function"==typeof s.observer)try{s.observer(e)}catch(e){N.err("Plugins","Unable to fire observer for "+s.getName()+".",e)}}};var A=new $;class T{get folder(){return q.themesFolder}}T.prototype.loadThemes=async function(){this.loadThemeData(),g.splice(0,0,...await q.loadThemes());const e=Object.keys(b);for(let t=0;t<e.length;t++){const n=b[e[t]];E[n.name]||(E[n.name]=!1),E[n.name]&&B.addStyle(B.escapeID(n.id),unescape(n.css))}for(const e in E)b[e]||delete E[e];this.saveThemeData()},T.prototype.enableTheme=function(e,t=!1){E[e]=!0,this.saveThemeData();const n=b[e];B.addStyle(B.escapeID(n.id),unescape(n.css)),u["fork-ps-2"]&&!t&&N.showToast(`${n.name} v${n.version} has been applied.`)},T.prototype.enable=function(e,t=!1){return this.enableTheme(e,t)},T.prototype.disableTheme=function(e,t=!1){E[e]=!1,this.saveThemeData();const n=b[e];B.removeStyle(B.escapeID(n.id)),u["fork-ps-2"]&&!t&&N.showToast(`${n.name} v${n.version} has been disabled.`)},T.prototype.disable=function(e,t=!1){return this.disableTheme(e,t)},T.prototype.toggleTheme=function(e){E[e]?this.disableTheme(e):this.enableTheme(e)},T.prototype.toggle=function(e,t=!1){return this.toggleTheme(e,t)},T.prototype.loadTheme=async function(e){const t=await q.loadContent(e,"theme");if(t)return u["fork-ps-1"]&&N.showContentErrors({themes:[t]}),u["fork-ps-2"]&&N.showToast(`${e} could not be loaded. It may not have been loaded.`,{type:"error"}),N.err("ContentManager",`${e} could not be loaded.`,t);const n=Object.values(b).find(t=>t.filename==e);N.log("ContentManager",`${n.name} v${n.version} was loaded.`),u["fork-ps-2"]&&N.showToast(`${n.name} v${n.version} was loaded.`,{type:"success"}),L.dispatch("theme-loaded",n.name)},T.prototype.unloadTheme=function(e){const t=Object.values(b).find(t=>t.filename==e)||b[e];if(!t)return;const n=t.name;E[n]&&this.disableTheme(n,!0);const s=q.unloadContent(b[n].filename,"theme");if(delete b[n],s)return u["fork-ps-1"]&&N.showContentErrors({themes:[s]}),u["fork-ps-2"]&&N.showToast(`${n} could not be unloaded. It may have not been loaded yet.`,{type:"error"}),N.err("ContentManager",`${n} could not be unloaded. It may have not been loaded yet.`,s);N.log("ContentManager",`${n} was unloaded.`),u["fork-ps-2"]&&N.showToast(`${n} was unloaded.`,{type:"success"}),L.dispatch("theme-unloaded",n)},T.prototype.delete=function(e){const t=Object.values(b).find(t=>t.filename==e)||b[e];if(!t)return;this.unloadTheme(t.filename);const s=n(1).resolve(q.pluginsFolder,t.filename);n(2).unlinkSync(s)},T.prototype.reloadTheme=async function(e){const t=Object.values(b).find(t=>t.filename==e)||b[e];if(!t)return this.loadTheme(e);const n=t.name,s=await q.reloadContent(b[n].filename,"theme");if(E[n]&&(this.disableTheme(n,!0),this.enableTheme(n,!0)),s)return u["fork-ps-1"]&&N.showContentErrors({themes:[s]}),u["fork-ps-2"]&&N.showToast(`${n} could not be reloaded.`,{type:"error"}),N.err("ContentManager",`${n} could not be reloaded.`,s);N.log("ContentManager",`${n} v${b[n].version} was reloaded.`),u["fork-ps-2"]&&N.showToast(`${n} v${b[n].version} was reloaded.`,{type:"success"}),L.dispatch("theme-reloaded",n)},T.prototype.reload=function(e){return this.reloadTheme(e)},T.prototype.edit=function(e){const t=Object.values(b).find(t=>t.filename==e)||b[e];if(!t)return;const s=n(1).resolve(q.themesFolder,t.filename);n(0).shell.openItem(`${s}`)},T.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)},T.prototype.loadThemeData=function(){const e=Y.getSettingGroup("themes");e&&Object.assign(E,e)},T.prototype.saveThemeData=function(){Y.setSettingGroup("themes",E)};var O=new T;const j=window.require,R=n(1),I=n(2),_=n(6).Module;_.globalPaths.push(R.resolve(n(0).remote.app.getAppPath(),"node_modules"));class F extends Error{constructor(e){super(e),this.name="MetaError"}}const W=_._extensions[".js"],z=_._extensions[".css"]?_._extensions[".css"]:()=>null,U=/[^\S\r\n]*?(?:\r\n|\n)[^\S\r\n]*?\*[^\S\r\n]?/,H=/^\\@/;var q=new class{constructor(){this.timeCache={},this.watchers={},_._extensions[".js"]=this.getContentRequire("plugin"),_._extensions[".css"]=this.getContentRequire("theme")}get pluginsFolder(){return this._pluginsFolder||(this._pluginsFolder=I.realpathSync(R.resolve(f.dataPath+"plugins/")))}get themesFolder(){return this._themesFolder||(this._themesFolder=I.realpathSync(R.resolve(f.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]=I.watch(n,{persistent:!1},async(e,r)=>{if(!e||!r||!r.endsWith(s))return;await new Promise(e=>setTimeout(e,50));try{I.statSync(R.resolve(n,r))}catch(e){if("ENOENT"!==e.code)return;return delete this.timeCache[r],t?A.unloadPlugin(r):O.unloadTheme(r)}if(!I.statSync(R.resolve(n,r)).isFile())return;const o=I.statSync(R.resolve(n,r));o&&o.mtime&&o.mtime.getTime()&&"number"==typeof o.mtime.getTime()&&this.timeCache[r]!=o.mtime.getTime()&&(this.timeCache[r]=o.mtime.getTime(),"rename"==e&&(t?await A.loadPlugin(r):await O.loadTheme(r)),"change"==e&&(t?await A.reloadPlugin(r):await O.reloadTheme(r)))})}unwatchContent(e){this.watchers[e]&&(this.watchers[e].close(),delete this.watchers[e])}extractMeta(e){const t=e.split("\n")[0];if(t.includes("//META"))return this.parseOldMeta(e);if(t.includes("/**"))return this.parseNewMeta(e);throw new F("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 F("META was not found.");const s=N.testJSON(n);if(!s)throw new F("META could not be parsed.");if(!s.name)throw new F("META missing name data.");return s.format="json",s}parseNewMeta(e){const t=e.split("/**",2)[1].split("*/",1)[0],n={};let s="",r="";for(const e of t.split(U))if(0!==e.length)if("@"===e.charAt(0)&&" "!==e.charAt(1)){n[s]=r;const t=e.indexOf(" ");s=e.substr(1,t-1),r=e.substr(t+1)}else r+=" "+e.replace("\\n","\n").replace(H,"@");return n[s]=r.trim(),delete n[""],n.format="jsdoc",n}getContentRequire(e){const t="plugin"===e,n=this,s=t?W:z;return function(e,r){const o=t?n.pluginsFolder:n.themesFolder,a=R.resolve(o,R.basename(r));if(!I.existsSync(a)||r!==I.realpathSync(a))return Reflect.apply(s,this,arguments);let i=I.readFileSync(r,"utf8");i=N.stripBOM(i);const l=I.statSync(r),c=n.extractMeta(i);if(c.filename=R.basename(r),c.added=l.atimeMs,c.modified=l.mtimeMs,c.size=l.size,t||(c.css=i,"json"==c.format&&(c.css=c.css.split("\n").slice(1).join("\n")),i=`module.exports = ${JSON.stringify(c)};`),t){e._compile(i,e.filename),!N.isEmpty(e.exports)?(c.type=e.exports,e.exports=c,i=""):i+=`\nmodule.exports = ${JSON.stringify(c)};\nmodule.exports.type = ${c.exports||c.name};`}e._compile(i,r)}}makePlaceholderPlugin(e){return{plugin:{start:()=>{},getName:()=>e.name||e.filename,getAuthor:()=>"???",getDescription:()=>e.message?e.message:"This plugin was unable to be loaded. Check the author's page for updates.",getVersion:()=>"???"},name:e.name||e.filename,filename:e.filename,source:e.source?e.source:"",website:e.website?e.website:""}}async loadContent(e,t){if(void 0===e||void 0===t)return;const n="plugin"===t,s=n?this.pluginsFolder:this.themesFolder;try{j(R.resolve(s,e))}catch(t){return{name:e,file:e,message:"Could not be compiled.",error:{message:t.message,stack:t.stack}}}const r=j(R.resolve(s,e));if(!r.name)return{name:e,file:e,message:"Cannot escape the ID.",error:{message:"Cannot read property 'replace' of undefined",stack:"Cannot read property 'replace' of undefined"}};if(r.id=N.escapeID(r.name),n){if(!r.type)return;try{r.plugin=new r.type,delete v[r.plugin.getName()],v[r.plugin.getName()]=r}catch(t){return{name:e,file:e,message:"Could not be constructed.",error:{message:t.message,stack:t.stack}}}}else delete b[r.name],b[r.name]=r}unloadContent(e,t){if(void 0===e||void 0===t)return;const n="plugin"===t?this.pluginsFolder:this.themesFolder;try{delete j.cache[j.resolve(R.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{j.cache[j.resolve(R.resolve(n,e))]}catch(e){return!1}return!0}async reloadContent(e,t){const n=this.unloadContent(e,t);return n||await this.loadContent(e,t)}loadNewContent(e){const t="plugin"===e,n=t?".plugin.js":".theme.css",s=t?this.pluginsFolder:this.themesFolder,r=I.readdirSync(s),o=Object.values(t?v:b),a=o.filter(e=>!r.includes(e.filename)).map(e=>t?e.plugin.getName():e.name);return{added:r.filter(e=>!o.find(t=>t.filename==e)&&e.endsWith(n)&&I.statSync(R.resolve(s,e)).isFile()),removed:a}}async loadAllContent(e){const t="plugin"===e,n=t?".plugin.js":".theme.css",s=t?this.pluginsFolder:this.themesFolder,r=[],o=I.readdirSync(s);for(const t of o){if(!I.statSync(R.resolve(s,t)).isFile()||!t.endsWith(n))continue;const o=await this.loadContent(t,e);o&&r.push(o)}return r}loadPlugins(){return this.loadAllContent("plugin")}loadThemes(){return this.loadAllContent("theme")}};const G=window.require,V=n(2),J=n(1),Z=DiscordNative.globals?DiscordNative.globals.releaseChannel:DiscordNative.app?DiscordNative.app.getReleaseChannel():"stable";var Y=new class{constructor(){this.data={settings:{stable:{},canary:{},ptb:{}}},this.pluginData={}}initialize(){try{V.existsSync(this.BDFile)||V.writeFileSync(this.BDFile,JSON.stringify(this.data,null,4),"binary");const e=JSON.parse(V.readFileSync(this.BDFile,"binary"));if(e.hasOwnProperty("settings")&&(this.data=e),!V.existsSync(this.settingsFile))return;let t=G(this.settingsFile);V.unlinkSync(this.settingsFile),t=t.hasOwnProperty("settings")?Object.assign({stable:{},canary:{},ptb:{}},{[Z]:t}):Object.assign({stable:{},canary:{},ptb:{}},t),this.setBDData("settings",t)}catch(e){console.error(e),N.alert("Corrupt Storage","The bd storage has somehow become corrupt. You may either try to salvage the file or delete it then reload.")}}get injectionPath(){return this._injectionPath=null}get configFile(){return this._configFile||(this._configFile=J.resolve(this.injectionPath,"betterdiscord","config.json"))}get BDFile(){return this._BDFile||(this._BDFile=J.resolve(f.dataPath,"bdstorage.json"))}get settingsFile(){return this._settingsFile||(this._settingsFile=J.resolve(f.dataPath,"bdsettings.json"))}getPluginFile(e){return J.resolve(q.pluginsFolder,e+".config.json")}getSettingGroup(e){return this.data.settings[Z][e]||null}setSettingGroup(e,t){this.data.settings[Z][e]=t,V.writeFileSync(this.BDFile,JSON.stringify(this.data,null,4),"binary")}getBDData(e){return this.data[e]||""}setBDData(e,t){this.data[e]=t,V.writeFileSync(this.BDFile,JSON.stringify(this.data,null,4),"binary")}getPluginData(e,t){return void 0!==this.pluginData[e]?this.pluginData[e][t]:V.existsSync(this.getPluginFile(e))?(this.pluginData[e]=JSON.parse(V.readFileSync(this.getPluginFile(e))),this.pluginData[e][t]):void 0}setPluginData(e,t,n){void 0!==n&&(void 0===this.pluginData[e]&&(this.pluginData[e]={}),this.pluginData[e][t]=n,V.writeFileSync(this.getPluginFile(e),JSON.stringify(this.pluginData[e],null,4),"binary"))}deletePluginData(e,t){void 0===this.pluginData[e]&&(this.pluginData[e]={}),delete this.pluginData[e][t],V.writeFileSync(this.getPluginFile(e),JSON.stringify(this.pluginData[e],null,4),"binary")}};class K extends M.reactComponent{constructor(e){super(e)}render(){return M.react.createElement("div",{className:"ui-tab-bar-separator margin-top-8 margin-bottom-8"})}}class Q extends M.reactComponent{constructor(e){super(e)}render(){return M.react.createElement("div",{className:"ui-tab-bar-header"},this.props.text,this.props.button)}}class X extends M.reactComponent{constructor(e){super(e),this.setInitialState(),this.onClick=this.onClick.bind(this)}setInitialState(){this.state={selected:this.props.selected||!1}}render(){return M.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 ee extends M.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 M.react.createElement("div",null,M.react.createElement(K,null),M.react.createElement(Q,{text:t,button:this.props.headerButton}),n.map(t=>{const{id:n,text:r}=t;return M.react.createElement(X,{key:n,selected:s===n,text:r,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 te=M.React;class ne extends te.Component{render(){const e=this.props.size||"18px";return te.createElement("svg",{viewBox:"0 0 24 24",fill:"#FFFFFF",className:this.props.className||"",style:{width:e,height:e},onClick:this.props.onClick},te.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}),te.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"}))}}let se,re;function oe(){return se||(se=D("tooltip","tooltipBlack"))}function ae(){return re||(re=D("layer","layerContainer"))}const ie=function(e){const t=e[0].toUpperCase()+e.slice(1),n=oe()[`tooltip${t}`];return n||null},le=function(e){return!!ie(e)},ce=function(e){return`${e}px`};class de{constructor(e,t,n={}){const{style:s="black",side:r="top",preventFlip:o=!1,disabled:a=!1}=n;if(this.node=e instanceof jQuery?e[0]:e,this.label=t,this.style=s.toLowerCase(),this.side=r.toLowerCase(),this.preventFlip=o,this.disabled=a,!le(this.side))return N.err("EmulatedTooltip",`Side ${this.side} does not exist.`);if(!le(this.style))return N.err("EmulatedTooltip",`Style ${this.style} does not exist.`);this.element=document.createElement("div"),this.element.className=ae().layer+" "+ae().disabledPointerEvents,this.tooltipElement=document.createElement("div"),this.tooltipElement.className=`${oe().tooltip} ${ie(this.style)}`,this.labelElement=document.createElement("div"),this.labelElement.className=oe().tooltipContent;const i=document.createElement("div");i.className=oe().tooltipPointer,this.tooltipElement.append(i),this.tooltipElement.append(this.labelElement),this.element.append(this.tooltipElement),this.node.addEventListener("mouseenter",()=>{if(this.disabled)return;this.show();const e=new MutationObserver(t=>{t.forEach(t=>{const n=Array.from(t.removedNodes),s=n.indexOf(this.node)>-1,r=n.some(e=>e.contains(this.node));(s||r)&&(this.hide(),e.disconnect())})});e.observe(document.body,{subtree:!0,childList:!0})}),this.node.addEventListener("mouseleave",()=>{this.hide()})}get container(){return document.querySelector("."+BDModules.get(e=>e.popouts)[0].popouts.split(" ")[0]+" ~ ."+BDModules.get(e=>e.layerContainer)[0].layerContainer.split(" ")[0])}get canShowAbove(){return this.node.getBoundingClientRect().top-this.element.offsetHeight>=0}get canShowBelow(){return this.node.getBoundingClientRect().top+this.node.offsetHeight+this.element.offsetHeight<=N.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<=N.screenWidth}hide(){this.element.remove(),this.tooltipElement.className=this._className}show(){this.tooltipElement.className=`${oe().tooltip} ${ie(this.style)}`,this.labelElement.textContent=this.label,this.container.append(this.element),"top"==this.side&&(this.canShowAbove||!this.canShowAbove&&this.preventFlip?this.showAbove():this.showBelow()),"bottom"==this.side&&(this.canShowBelow||!this.canShowBelow&&this.preventFlip?this.showBelow():this.showAbove()),"left"==this.side&&(this.canShowLeft||!this.canShowLeft&&this.preventFlip?this.showLeft():this.showRight()),"right"==this.side&&(this.canShowRight||!this.canShowRight&&this.preventFlip?this.showRight():this.showLeft())}showAbove(){this.tooltipElement.classList.add(ie("top")),this.element.style.setProperty("top",ce(this.node.getBoundingClientRect().top-this.element.offsetHeight-10)),this.centerHorizontally()}showBelow(){this.tooltipElement.classList.add(ie("bottom")),this.element.style.setProperty("top",ce(this.node.getBoundingClientRect().top+this.node.offsetHeight+10)),this.centerHorizontally()}showLeft(){this.tooltipElement.classList.add(ie("left")),this.element.style.setProperty("left",ce(this.node.getBoundingClientRect().left-this.element.offsetWidth-10)),this.centerVertically()}showRight(){this.tooltipElement.classList.add(ie("right")),this.element.style.setProperty("left",ce(this.node.getBoundingClientRect().left+this.node.offsetWidth+10)),this.centerVertically()}centerHorizontally(){const e=this.node.getBoundingClientRect().left+this.node.offsetWidth/2;this.element.style.setProperty("left",ce(e-this.element.offsetWidth/2))}centerVertically(){const e=this.node.getBoundingClientRect().top+this.node.offsetHeight/2;this.element.style.setProperty("top",ce(e-this.element.offsetHeight/2))}}var ue=class extends M.reactComponent{constructor(e){super(e)}async componentDidMount(){const{style:e="black",side:t="top",text:n=""}=this.props;this.node=M.reactDom.findDOMNode(this),this.tooltip=new de(this.node,n,{style:e,side:t})}componentWillUnmount(){this.tooltip.hide(),delete this.tooltip}render(){return this.props.children}};class he{constructor(e){this.onClick=e}get items(){return[{text:"Lightcord Settings",id:"lightcord"},{text:"BetterDiscord Settings",id:"core"},{text:"Plugins",id:"plugins"},{text:"Themes",id:"themes"},{text:"Custom CSS",id:"customcss"},{text:"RichPresence",id:"status"},{text:"Account Info",id:"accountinfo"}]}get component(){const e=M.react.createElement(ue,{color:"black",side:"top",text:"Changelog"},M.react.createElement("div",{className:"bd-changelog-button",onClick:()=>{N.showChangelogModal(l)}},M.react.createElement(ne,{className:"bd-icon",size:"16px"})));return M.react.createElement("span",null,M.react.createElement(ee,{onClick:this.onClick,headerText:"Bandaged BD",headerButton:e,items:this.items}))}get root(){const e=B.query("#bd-settings-sidebar");return e||(this.injectRoot()?this.root:null)}injectRoot(){const e=B.queryAll("[class*='side-'] > [class*='item-']:not([class*=Danger])"),t=e[e.length-1];return!!t&&(t.parentElement.insertBefore(B.createElement('<div id="bd-settings-sidebar">'),t.previousElementSibling),!0)}render(){const e=this.root;e?(M.reactDom.render(this.component,e),N.onRemoved(e,()=>{M.reactDom.unmountComponentAtNode(e)})):console.log("FAILED TO LOCATE ROOT: [class*='side-'] > [class*='item-']:not([class*=Danger])")}}var pe=new class{injectColoredText(){this.cancelColoredText||M.MessageComponent&&(this.cancelColoredText=N.monkeyPatch(M.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(){let e=BDModules.get(e=>e.markup)[0].markup;document.querySelectorAll("."+e.split(" ")[0]).forEach(e=>{e.style.setProperty("color","")})}},me=new class{inject24Hour(){if(this.cancel24Hour)return;const e=new RegExp("([0-9]{1,2}):([0-9]{1,2})\\s(AM|PM)"),t=t=>{if(!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=N.monkeyPatch(M.TimeFormatter,"calendarFormat",{after:t}),s=N.monkeyPatch(M.TimeFormatter,"dateFormat",{after:t});this.cancel24Hour=()=>{n(),s()}}remove24Hour(){this.cancel24Hour&&this.cancel24Hour()}};const ge=n(0),fe=n(2),be=n(1),ve=ge.remote.BrowserWindow,ye=ge.remote.getCurrentWebContents();var Ee=new class{constructor(){let e="";if(e="win32"===process.platform?be.resolve(process.env.LOCALAPPDATA,"Google/Chrome/User Data"):"linux"===process.platform?be.resolve(process.env.HOME,".config/google-chrome"):"darwin"===process.platform?be.resolve(process.env.HOME,"Library/Application Support/Google/Chrome"):be.resolve(process.env.HOME,".config/chromium"),e+="/Default/Extensions/fmkadmapgofadopljbjfkapdkoienihi/",fe.existsSync(e)){const t=fe.readdirSync(e);e=be.resolve(e,t[t.length-1])}this.extensionPath=e,this.isExtensionInstalled=fe.existsSync(e),this.listener=this.listener.bind(this),c["React DevTools"].hidden=!this.isExtensionInstalled}listener(){if(!this.isExtensionInstalled)return;ve.removeDevToolsExtension("React Developer Tools"),ve.addDevToolsExtension(this.extensionPath)?N.log("React DevTools","Successfully installed react devtools."):N.err("React DevTools","Couldn't find react devtools in chrome extensions!")}start(){setImmediate(()=>ye.on("devtools-opened",this.listener)),ye.isDevToolsOpened()&&this.listener()}stop(){ye.removeListener("devtools-opened",this.listener)}};class Ce extends M.reactComponent{constructor(e){super(e)}render(){return M.react.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 12 12",style:{width:"18px",height:"18px"}},M.react.createElement("g",{className:"background",fill:"none",fillRule:"evenodd"},M.react.createElement("path",{d:"M0 0h12v12H0"}),M.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 we extends M.reactComponent{constructor(e){super(e),this.onClick=this.onClick.bind(this)}render(){let e=BDModules.get(e=>e.toolsContainer)[0],t=BDModules.get(e=>e.container&&e.closeButton&&e.closeButtonBold)[0];return M.react.createElement("div",{className:"tools-container "+e.toolsContainer},M.react.createElement("div",{className:"tools "+e.tools},M.react.createElement("div",{className:t.container},M.react.createElement("div",{className:"btn-close "+t.closeButton,onClick:this.onClick},M.react.createElement(Ce,null)),M.react.createElement("div",{className:"esc-text "+t.keybind},"ESC"))))}onClick(){this.props.onClick&&this.props.onClick();const e=document.querySelector("."+BDModules.get(e=>e.closeButton&&e.keybindBold)[0].closeButton.split(" ")[0]);e&&e.click()}}class Se extends M.reactComponent{constructor(e){super(e)}render(){return M.react.createElement("h2",{className:"ui-form-title h2 margin-reset margin-bottom-20 "+BDModules.get(e=>e.marginTop60)[0].marginTop60},this.props.text)}}class xe extends M.reactComponent{constructor(e){super(e),this.props.server.iconUrl||(this.props.server.iconUrl=this.props.fallback),this.state={imageError:!1,joined:this.props.guildList.includes(this.props.server.identifier)}}render(){const{server:e}=this.props;let t=BDModules.get(e=>e.card&&e.cardPrimary)[0],n=BDModules.get(e=>e.flexChild&&e._horizontalReverse)[0],s=BDModules.get(e=>e.noWrap&&!e.streamerModeEnabled)[0];return M.react.createElement("div",{className:`${t.card} ${t.cardPrimary} ${BDModules.get(e=>e.marginBottom8)[0].marginBottom8} bd-server-card${e.pinned?" bd-server-card-pinned":""}`},M.react.createElement("img",{ref:"img",className:"bd-server-image",src:e.iconUrl,onError:this.handleError.bind(this)}),M.react.createElement("div",{className:n.flexChild+" bd-server-content"},M.react.createElement("div",{className:n.horizontal+" "+s.noWrap+" bd-server-header"},M.react.createElement("h5",{className:"h5-18_1nd defaultColor-1_ajX0 margin-reset bd-server-name"},e.name),M.react.createElement("h5",{className:"h5-18_1nd defaultColor-1_ajX0 margin-reset bd-server-member-count"},e.members," Members")),M.react.createElement("div",{className:n.horizontal+" "+s.noWrap},M.react.createElement("div",{className:"scrollerWrap-2lJEkd scrollerThemed-2oenus themeGhostHairline-DBD-2d scrollerFade-1Ijw5y bd-server-description-container"},M.react.createElement("div",{className:"scroller-2FKFPG scroller bd-server-description"},e.description))),M.react.createElement("div",{className:"flex-1xMQg5 flex-1O1GKY horizontal-1ae9ci horizontal-2EEEnY directionRow-3v3tfG noWrap-3jynv6 bd-server-footer"},M.react.createElement("div",{className:"flexChild-faoVW3 bd-server-tags",style:{flex:"1 1 auto"}},e.categories.join(", ")),this.state.joined&&M.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"}},M.react.createElement("div",{className:"ui-button-contents"},"Joined")),e.error&&M.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"}},M.react.createElement("div",{className:"ui-button-contents"},"Error")),!e.error&&!this.state.joined&&M.react.createElement("button",{type:"button",className:"button-38aScr lookFilled-1Gx00P colorBrand-3pXr91 sizeMin-1mJd1x grow-q77ONN",style:{minHeight:"12px",marginTop:"4px"},onClick:()=>{this.join()}},M.react.createElement("div",{className:"ui-button-contents"},"Join")))))}handleError(){this.props.server.iconUrl=this.props.fallback,this.setState({imageError:!0})}join(){this.props.join(this)}}class De extends M.reactComponent{constructor(e){super(e)}render(){let e=BDModules.get(e=>e.scrollerHorizontal)[0],t=BDModules.get(e=>e.sidebarRegionScroller)[0],n=`${e.scrollerWrap} ${e.scrollerThemed} ${e.themeGhostHairline}${this.props.fade?" "+e.scrollerFade:""}`,s=e.scroller+" scroller";this.props.sidebar&&(s+=` ${t.sidebarRegionScroller} sidebar-region-scroller`),this.props.contentColumn&&(s+=" "+t.contentRegionScroller+" content-region-scroller",n=`${e.scrollerWrap} ${t.contentRegionScrollerWrap} content-region-scroller-wrap ${e.scrollerThemed} ${e.themeGhost} ${e.scrollerTrack}`);const{children:r}=this.props;return M.react.createElement("div",{key:"scrollerwrap",className:n},M.react.createElement("div",{key:"scroller",ref:"scroller",className:s},r))}}class ke extends M.reactComponent{constructor(e){super(e)}render(){const{sidebar:e,content:t,tools:n}=this.props.children;return M.react.createElement("div",{className:"standardSidebarView-3F1I7i ui-standard-sidebar-view"},M.react.createElement("div",{className:"sidebarRegion-VFTUkN sidebar-region"},M.react.createElement(De,{key:"sidebarScroller",ref:"sidebarScroller",sidebar:!0,fade:e.fade||!0,dark:e.dark||!0},e.component)),M.react.createElement("div",{className:"contentRegion-3nDuYy content-region"},M.react.createElement("div",{className:"contentTransitionWrap-3hqOEW content-transition-wrap"},M.react.createElement("div",{className:"scrollerWrap-2lJEkd firefoxFixScrollFlex-cnI2ix contentRegionScrollerWrap-3YZXdm content-region-scroller-wrap scrollerThemed-2oenus themeGhost-28MSn0 scrollerTrack-1ZIpsv"},M.react.createElement("div",{className:"scroller-2FKFPG firefoxFixScrollFlex-cnI2ix contentRegionScroller-26nc1e content-region-scroller scroller",ref:"contentScroller"},M.react.createElement("div",{className:"contentColumn-2hrIYH contentColumnDefault-1VQkGM content-column default"},t.component),n.component)))))}}class Me extends M.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=M.WebpackModules.findByUniqueProperties(["getGuilds"]),this.AvatarDefaults=M.WebpackModules.findByUniqueProperties(["getUserAvatarURL","DEFAULT_AVATARS"]),this.InviteActions=M.WebpackModules.findByUniqueProperties(["acceptInvite"]),this.SortedGuildStore=M.WebpackModules.findByUniqueProperties(["getSortedGuilds"])}componentDidMount(){this.checkConnection()}setInitialState(){this.state={selectedCategory:-1,title:"Loading...",loading:!0,servers:[],next:null,connection:{state:0,user:null}}}close(){M.reactDom.unmountComponentAtNode(document.getElementById(this.props.rootId))}search(e,t){const n=this;fetch(`${n.endPoint}${e}${e?"&schema=new":"?schema=new"}`,{method:"get"}).then(async e=>{if(200!==e.status)throw await e.text();let s=await e.json(),r=s.results.reduce((e,t)=>(t.joined=!1,e.push(t),e),[]);t||(r=n.state.servers.concat(r));let o=s.size+s.from;s.next=`?from=${o}`,n.state.term&&(s.next+=`&term=${n.state.term}`),n.state.selectedCategory&&(s.next+=`&category=${n.categoryButtons[n.state.selectedCategory]}`),o>=s.total&&(o=s.total,s.next=null);let a=`Showing 1-${o} of ${s.total} results in ${n.categoryButtons[n.state.selectedCategory]}`;n.state.term&&(a+=` for ${n.state.term}`),n.setState({loading:!1,title:a,servers:r,next:s.next}),t&&(n.refs.sbv.refs.contentScroller.scrollTop=0)}).catch(e=>(console.error(e),n.setState({loading:!1,title:"Failed to load servers. Check console for details"})))}async join(e){if(e.props.pinned)return this.InviteActions.acceptInvite(e.props.invite_code);await fetch(`${this.joinEndPoint}/${e.props.server.identifier}`,{method:"GET",credentials:"include",mode:"cors",headers:{Accept:"application/json","Content-Type":"application/json"}}),e.setState({joined:!0})}connect(){const e=this,t=e.windowOptions;t.x=Math.round(window.screenX+window.innerWidth/2-t.width/2),t.y=Math.round(window.screenY+window.innerHeight/2-t.height/2),e.joinWindow=new(window.require("electron").remote.BrowserWindow)(t);e.joinWindow.webContents.on("did-navigate",(t,n)=>{"https://auth.discordservers.com/info"==n&&(e.joinWindow.close(),e.checkConnection())}),e.joinWindow.loadURL("https://auth.discordservers.com/connect?scopes=guilds.join&previousUrl=https://auth.discordservers.com/info")}get windowOptions(){return{width:500,height:550,backgroundColor:"#282b30",show:!0,resizable:!1,maximizable:!1,minimizable:!1,alwaysOnTop:!0,frame:!1,center:!1,webPreferences:{nodeIntegration:!1}}}get bdServer(){const e=this.SortedGuildStore.getFlattenedGuildIds(),t=this.AvatarDefaults.DEFAULT_AVATARS;return[M.react.createElement(xe,{server:{name:"Lightcord",online:"30+",members:"50+",categories:["community","programming","support"],description:"Official Lightcord server for support etc",identifier:"86004744966914048",iconUrl:"https://cdn.discordapp.com/icons/705908350218666117/05a5652f7d1d0ae328ca7d6e2354a82a.webp",nativejoin:!0,invite_code:"7eFff2A",pinned:!0},pinned:!0,join:this.join,guildList:e,fallback:t[Math.floor(5*Math.random())]}),M.react.createElement(xe,{server:{name:"BetterDiscord",online:"7500+",members:"20000+",categories:["community","programming","support"],description:"Official BetterDiscord server for support etc",identifier:"86004744966914048",iconUrl:"https://cdn.discordapp.com/icons/86004744966914048/292e7f6bfff2b71dfd13e508a859aedd.webp",nativejoin:!0,invite_code:"0Tmfo5ZbORCRqbAd",pinned:!0},pinned:!0,join:this.join,guildList:e,fallback:t[Math.floor(5*Math.random())]})]}get endPoint(){return"https://search.discordservers.com"}get joinEndPoint(){return"https://j.discordservers.com"}get connectEndPoint(){return"https://join.discordservers.com/connect"}async checkConnection(){const e=this;try{const t=await fetch("https://auth.discordservers.com/info",{method:"GET",credentials:"include",mode:"cors",headers:{Accept:"application/json","Content-Type":"application/json"}}),n=await t.json();e.setState({selectedCategory:0,connection:{state:2,user:n}}),e.search("",!0)}catch(t){console.error(t),e.setState({title:"Not connected to discordservers.com!",loading:!0,selectedCategory:-1,connection:{state:1,user:null}})}}render(){return M.react.createElement(ke,{ref:"sbv"},this.component)}get component(){return{sidebar:{component:this.sidebar},content:{component:this.content},tools:{component:M.react.createElement(we,{key:"pt",ref:"tools",onClick:this.close})}}}get sidebar(){return M.react.createElement("div",{className:"sidebar",key:"ps"},M.react.createElement("div",{className:"ui-tab-bar SIDE"},M.react.createElement("div",{className:"ui-tab-bar-header",style:{fontSize:"16px"}},"Public Servers"),M.react.createElement(K,null),this.searchInput,M.react.createElement(K,null),M.react.createElement(Q,{text:"Categories"}),this.categoryButtons.map((e,t)=>M.react.createElement(X,{id:t,onClick:this.changeCategory,key:t,text:e,selected:this.state.selectedCategory===t})),M.react.createElement(K,null),this.footer,this.connection))}get searchInput(){return M.react.createElement("div",{className:"ui-form-item"},M.react.createElement("div",{className:"ui-text-input flex-vertical",style:{width:"172px",marginLeft:"10px"}},M.react.createElement("input",{ref:"searchinput",onKeyDown:this.searchKeyDown,onChange:()=>{},type:"text",className:"input default",placeholder:"Search...",maxLength:"50"})))}searchKeyDown(e){const t=this;if(t.state.loading||13!==e.which)return;t.setState({loading:!0,title:"Loading...",term:e.target.value});let n=`?term=${e.target.value}`;0!==t.state.selectedCategory&&(n+=`&category=${t.categoryButtons[t.state.selectedCategory]}`),t.search(n,!0)}get categoryButtons(){return["All","FPS Games","MMO Games","Strategy Games","MOBA Games","RPG Games","Tabletop Games","Sandbox Games","Simulation Games","Music","Community","Language","Programming","Other"]}changeCategory(e){const t=this;t.state.loading||(t.refs.searchinput.value="",t.setState({loading:!0,selectedCategory:e,title:"Loading...",term:null}),0!==e?t.search(`?category=${t.categoryButtons[e]}`,!0):t.search("",!0))}get content(){const e=this,t=this.SortedGuildStore.getFlattenedGuildIds(),n=this.AvatarDefaults.DEFAULT_AVATARS;if(1===e.state.connection.state)return e.notConnected;let s=BDModules.get(e=>e.contentColumnDefault)[0];return[M.react.createElement("div",{ref:"content",key:"pc",className:s.contentColumn+" "+s.contentColumn+" content-column default"},M.react.createElement(Se,{text:e.state.title}),e.bdServer,e.state.servers.map(s=>M.react.createElement(xe,{key:s.identifier,server:s,join:e.join,guildList:t,fallback:n[Math.floor(5*Math.random())]})),e.state.next&&M.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"}},M.react.createElement("div",{className:"ui-button-contents"},e.state.loading?"Loading":"Load More")),e.state.servers.length>0&&M.react.createElement(Se,{text:e.state.title}))]}get notConnected(){let e=BDModules.get(e=>e.contentColumnDefault)[0];return[M.react.createElement("div",{key:"ncc",ref:"content",className:e.contentColumn+" "+e.contentColumn+" content-column default"},M.react.createElement("h2",{className:"ui-form-title h2 margin-reset margin-bottom-20"},"Not connected to discordservers.com!",M.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"}},M.react.createElement("div",{className:"ui-button-contents"},"Connect"))),this.bdServer)]}get footer(){return M.react.createElement("div",{className:"ui-tab-bar-header"},M.react.createElement("a",{href:"https://discordservers.com",target:"_blank"},"Discordservers.com"))}get connection(){const{connection:e}=this.state;return 2!==e.state?M.react.createElement("span",null):M.react.createElement("span",null,M.react.createElement(K,null),M.react.createElement("span",{style:{color:"#b9bbbe",fontSize:"10px",marginLeft:"10px"}},"Connected as: ",`${e.user.username}#${e.user.discriminator}`),M.react.createElement("div",{style:{padding:"5px 10px 0 10px"}},M.react.createElement("button",{style:{width:"100%",minHeight:"20px"},type:"button",className:"ui-button filled brand small grow"},M.react.createElement("div",{className:"ui-button-contents",onClick:this.connect},"Reconnect"))))}}class Be extends M.reactComponent{constructor(e){super(e),this.keyupListener=this.keyupListener.bind(this)}keyupListener(e){27===e.which&&M.reactDom.unmountComponentAtNode(this.refs.root.parentNode)}componentDidMount(){window.addEventListener("keyup",this.keyupListener);const e=B.query(`#${this.props.id}`);B.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=B.query(`#${this.props.id}`);B.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=B.query(".publicServersOpen");t.classList.remove("publicServersOpen"),B.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=B.query('[class*="layer-"]');e.classList.add("publicServersOpen"),B.animate({duration:200,update:function(t){e.style.transform=`scale(${.07*(1-t)+.93}) translateZ(0px)`,e.style.opacity=1-t}})}render(){return M.react.createElement("div",{className:"layer bd-layer "+BDModules.get(e=>e.layer&&e.animating)[0].layer,id:this.props.id,ref:"root",style:{opacity:0,transform:"scale(1.1) translateZ(0px)"}},this.props.children)}}var Ne=new class{constructor(){this._appendButton=this._appendButton.bind(this)}get component(){return M.react.createElement(Be,{rootId:"pubslayerroot",id:"pubslayer"},M.react.createElement(Me,{rootId:"pubslayerroot"}))}get root(){const e=document.getElementById("pubslayerroot");return e||(this.injectRoot()?this.root:null)}injectRoot(){let[e]=[BDModules.get(e=>e.layers&&e.layer)[0].layers.split(" ")[0]];const t=B.query(".layers, ."+e);return!!t&&(t.append(B.createElement("<div id='pubslayerroot'>")),!0)}render(){const e=this.root;e?M.reactDom.render(this.component,e):console.log("FAILED TO LOCATE ROOT: .layers")}get button(){const e=B.createElement(`<div id="bd-pub-li" class="${M.guildClasses.listItem}">`);u["bda-gs-1"]||(e.style.display="none");const t=B.createElement(`<div id="bd-pub-button" class="${"wrapper-25eVIn "+M.guildClasses.circleButtonMask}">public</div>`);return t.addEventListener("click",()=>{this.render()}),e.append(t),e}_appendButton(){let[e]=[BDModules.get(e=>e.scroller&&e.scrollbarWidth)[0].scroller];if(B.query("#bd-pub-li"))return;const t=M.guildClasses.wrapper.split(" ")[0],n=B.query(`.${t} .${e} >:first-child`);B.after(n,this.button)}addButton(){if(this.guildPatch)return;const e=S(e=>e.default&&"NavigableGuilds"==e.default.displayName),t=k("Guilds");e||t||N.warn("PublicServer","Can't find GuildList component"),this.guildPatch=N.monkeyPatch(e||t.prototype,e?"default":"render",{after:this._appendButton}),this._appendButton()}removeButton(){this.guildPatch(),delete this.guildPatch,B.query("#bd-pub-li").remove()}};var Pe=new class{start(){B.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(){B.removeStyle("VoiceMode")}};const Le=new RegExp("^(?!da-)((?:[A-Za-z]|[0-9]|-)+)-(?:[A-Za-z]|[0-9]|-|_){6}$");var $e=new class{stop(){this.hasPatched&&(this.unpatchClassModules(x(this.moduleFilter.bind(this))),this.revertElement(document.querySelector("#app-mount")),this.hasPatched=!1)}start(){this.hasPatched||(this.patchClassModules(x(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(!Le.test(n.split(" ")[0]))return!1}}return!0}patchClassModule(e,t){for(const n in t){const s=t[n];if(this.shouldIgnore(s))continue;const r=s.split(" ");for(const s of r){const r=s.match(Le);if(!r||!r.length||r.length<2)continue;const o=r[1].split("-").map((e,t)=>t?e[0].toUpperCase()+e.slice(1):e).join("");t[n]+=` ${e}-${o}`}}}unpatchClassModule(e,t){for(const n in t){const s=t[n];if(this.shouldIgnore(s))continue;let r="";const o=s.split(" ");for(const t of o)t.startsWith(`${e}-`)||(r+=` ${t}`);t[n]=r.trim()}}normalizeElement(e){if(!(e instanceof Element))return;const t=e.classList;for(let n=0,s=t.length;n<s;n++){if(!Le.test(t[n]))continue;const s=t[n].match(Le)[1].split("-").map((e,t)=>t?e[0].toUpperCase()+e.slice(1):e).join("");e.classList.add(`da-${s}`)}for(const t of e.children)this.normalizeElement(t)}revertElement(e){if(!(e instanceof Element))return;e.children&&e.children.length&&this.revertElement(e.children[0]),e.nextElementSibling&&this.revertElement(e.nextElementSibling);const t=e.classList,n=[];for(let e=0;e<t.length;e++)t[e].startsWith("da-")&&n.push(t[e]);e.classList.remove(...n)}patchDOMMethods(){const e=DOMTokenList.prototype.contains;DOMTokenList.prototype.contains=function(t){return Reflect.apply(e,this,[t.split(" ")[0]])};const t=DOMTokenList.prototype.add;DOMTokenList.prototype.add=function(...e){for(let t=0;t<e.length;t++)e[t]=e[t].split(" ")[0];return Reflect.apply(t,this,e)};const n=DOMTokenList.prototype.remove;DOMTokenList.prototype.remove=function(...e){for(let t=0;t<e.length;t++)e[t]=e[t].split(" ")[0];return Reflect.apply(n,this,e)}}},Ae=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){if(119===e.which||118==e.which){console.log("%c[%cDevMode%c] %cBreak/Resume","color: red;","color: #303030; font-weight:700;","color:red;","");debugger;e.preventDefault(),e.stopImmediatePropagation()}}copySelectorListener(e){try{e.stopPropagation();const t=this.getSelector(e.target);let[n,s]=[BDModules.get(e=>e.layer&&"string"==typeof e.layer&&e.disabledPointerEvents)[0].layer,BDModules.get(e=>e.contextMenu)[0]];setTimeout((function(){let r=B.query("."+s.contextMenu.split(" ")[0]);if(!r){const t=B.query("#app-mount"),o=B.createElement(`<div class="${n}">`);r=B.createElement(`<div class="${s.contextMenu} bd-context-menu"></div>`),o.append(r),t.append(o),o.style.top=e.clientY+"px",o.style.left=e.clientX+"px",o.style.zIndex="1002";const a=function(e){e.keyCode&&27!==e.keyCode||(o.remove(),document.removeEventListener("click",a),document.removeEventListener("contextmenu",a),document.removeEventListener("keyup",a))};document.addEventListener("click",a),document.addEventListener("contextmenu",a),document.addEventListener("keyup",a)}const o=B.query("."+n.split(" ")[0]),a=B.createElement(`<div class="${s.itemGroup}">`),i=B.createElement(`<div class="${s.item} ${s.clickable}">`);i.append(B.createElement(`<div class="${s.label}">Copy Selector</div>`)),i.addEventListener("click",()=>{M.NativeModule.copy(t),r.style.display="none"}),a.append(i),r.append(a),o.clientHeight<o.scrollHeight&&(console.log("overflowing "+o.style.top),o.style.top=o.style.top-a.clientHeight+"px",console.log("overflowing"+o.style.top))}),1)}catch(e){console.error(e)}}getSelector(e){if(e.id)return`#${e.id}`;return function(e){for(var t=[];e.parentNode;){if(e.id){t.unshift("#"+e.id);break}if(e==e.ownerDocument.documentElement)t.unshift(e.tagName.toLowerCase()+Array.from(e.classList.entries()).map(e=>"."+e).join(""));else{for(var n=1,s=e;s.previousElementSibling;s=s.previousElementSibling,n++);t.unshift(e.tagName.toLowerCase()+(e.className||"").split(" ").map(e=>"."+e).join("")+":nth-child("+n+")")}e=e.parentNode}return t.join(" > ")}(e)}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 Te=M.React;class Oe extends Te.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 Te.createElement("div",{className:"bd-switch"+e+t},Te.createElement("input",{type:"checkbox",id:this.props.id,className:"bd-checkbox",disabled:this.props.disabled,checked:this.state.checked,onChange:this.onChange}))}}class je extends M.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 M.react.createElement("div",{className:"ui-flex flex-vertical flex-justify-start flex-align-stretch flex-nowrap ui-switch-item"},M.react.createElement("div",{className:"ui-flex flex-horizontal flex-justify-start flex-align-stretch flex-nowrap"},M.react.createElement("h3",{className:"ui-form-title h3 margin-reset margin-reset ui-flex-child"},e),M.react.createElement(Oe,{onChange:this.onChange,checked:this.props.checked})),M.react.createElement("div",{className:"ui-form-text style-description margin-top-4",style:{flex:"1 1 auto"}},t))}}class Re extends M.reactComponent{constructor(e){super(e)}render(){const{title:e,settings:t,button:n}=this.props,s=n?M.react.createElement("button",{key:"title-button",className:"bd-pfbtn",onClick:n.onClick},n.title):null;return[M.react.createElement(Se,{text:e}),s,t.map(e=>M.react.createElement(je,{id:e.id,key:e.id,data:e,checked:u[e.id],onChange:(e,t)=>{this.props.onChange(e,t)}}))]}}class Ie extends M.reactComponent{constructor(e){super(e)}render(){let e=BDModules.get(e=>e.contentColumnDefault)[0];return M.react.createElement("div",{className:e.contentColumn+" "+e.contentColumnDefault+" content-column default"},this.props.sections.map(e=>M.react.createElement(Re,Object.assign({},e,{onChange:this.props.onChange}))))}}M.reactComponent;class _e extends M.reactComponent{constructor(e){super(e),this.onClick=this.onClick.bind(this),this.setInitialState()}setInitialState(){this.state={checked:this.props.checked||!1}}render(){return M.react.createElement("li",null,M.react.createElement("div",{className:"checkbox "+BDModules.get(e=>e.checkboxElement)[0].checkbox,onClick:this.onClick},M.react.createElement("div",{className:"checkbox-inner "+BDModules.get(e=>e.checkboxInner)[0].checkboxInner},M.react.createElement("input",{className:BDModules.get(e=>e.checkboxElement)[0].checkboxElement,checked:this.state.checked,onChange:()=>{},type:"checkbox"}),M.react.createElement("span",null)),M.react.createElement("span",null,this.props.text)))}onClick(){this.props.onChange(this.props.id,!this.state.checked),this.setState({checked:!this.state.checked})}}class Fe extends M.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(){B.addClass(B.query("#app-mount"),"bd-detached-editor"),M.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(){B.removeClass(B.query("#app-mount"),"bd-detached-editor"),M.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=Y.getBDData("bdcustomcss");let t="";return e&&""!==e&&(t=atob(e)),t}get root(){const e=B.query("#bd-customcss-detach-container");return e||(this.injectRoot()?this.detachedRoot:null)}injectRoot(){const e=B.query(".app, ."+BDModules.get(e=>e.app&&e.layers)[0].app.split(" ")[0]);return!!e&&(B.insertAfter(B.createElement('<div id="bd-customcss-detach-container">'),e),!0)}render(){const e=this;return M.react.createElement("div",{className:"bd-detached-css-editor",id:"bd-customcss-detach-editor"},M.react.createElement("div",{id:"bd-customcss-innerpane"},M.react.createElement("div",{className:"editor-wrapper"},M.react.createElement("div",{id:"bd-customcss-editor-detached",className:"editor",ref:"editor"},e.css)),M.react.createElement("div",{id:"bd-customcss-attach-controls"},M.react.createElement("ul",{className:"checkbox-group"},M.react.createElement(_e,{id:"live-update",text:"Live Update",onChange:e.onChange,checked:u["bda-css-0"]})),M.react.createElement("div",{id:"bd-customcss-detach-controls-button"},M.react.createElement("button",{style:{borderRadius:"3px 0 0 3px",borderRight:"1px solid #3f4146"},className:"btn btn-primary",onClick:()=>{e.onClick("update")}},"Update"),M.react.createElement("button",{style:{borderRadius:"0",borderLeft:"1px solid #2d2d2d",borderRight:"1px solid #2d2d2d"},className:"btn btn-primary",onClick:()=>{e.onClick("save")}},"Save"),M.react.createElement("button",{style:{borderRadius:"0 3px 3px 0",borderLeft:"1px solid #3f4146"},className:"btn btn-primary",onClick:()=>{e.onClick("attach")}},"Attach"),M.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,mn.saveSettings()}}onClick(e){const t=this;switch(e){case"attach":B.query("#editor-detached")&&t.props.attach(),M.reactDom.unmountComponentAtNode(t.root),t.root.remove();break;case"update":t.updateCss();break;case"save":t.saveCss()}}updateCss(){B.removeStyle("customcss"),B.addStyle("customcss",this.editor.session.getValue())}saveCss(){Y.setBDData("bdcustomcss",btoa(this.editor.session.getValue()))}}class We extends M.reactComponent{constructor(e){super(e);this.props.lines=0,this.setInitialState(),this.attach=this.attach.bind(this),this.detachedEditor=M.react.createElement(Fe,{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||M.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&&M.reactDom.unmountComponentAtNode(n.detachedRoot)}codeMirror(){}get options(){return{lineNumbers:!0,mode:"css",indentUnit:4,theme:"material",scrollbarStyle:"simple"}}get css(){const e=Y.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;let n=BDModules.get(e=>e.contentColumn)[0];return M.react.createElement("div",{className:n.contentColumn+" "+n.contentColumnDefault+" content-column default",style:{padding:"60px 40px 0px"}},t&&M.react.createElement("div",{id:"editor-detached"},M.react.createElement(Se,{text:"Custom CSS Editor"}),M.react.createElement("h3",null,"Editor Detached"),M.react.createElement("button",{className:"btn btn-primary",onClick:()=>{e.attach()}},"Attach")),!t&&M.react.createElement("div",null,M.react.createElement(Se,{text:"Custom CSS Editor"}),M.react.createElement("div",{className:"editor-wrapper"},M.react.createElement("div",{id:"bd-customcss-editor",className:"editor",ref:"editor"},e.css)),M.react.createElement("div",{id:"bd-customcss-attach-controls"},M.react.createElement("ul",{className:"checkbox-group"},M.react.createElement(_e,{id:"live-update",text:"Live Update",onChange:this.onChange,checked:u["bda-css-0"]})),M.react.createElement("div",{id:"bd-customcss-detach-controls-button"},M.react.createElement("button",{style:{borderRadius:"3px 0 0 3px",borderRight:"1px solid #3f4146"},className:"btn btn-primary",onClick:()=>{e.onClick("update")}},"Update"),M.react.createElement("button",{style:{borderRadius:"0",borderLeft:"1px solid #2d2d2d",borderRight:"1px solid #2d2d2d"},className:"btn btn-primary",onClick:()=>{e.onClick("save")}},"Save"),M.react.createElement("button",{style:{borderRadius:"0 3px 3px 0",borderLeft:"1px solid #3f4146"},className:"btn btn-primary",onClick:()=>{e.onClick("detach")}},"Detach"),M.react.createElement("span",{style:{fontSize:"10px",marginLeft:"5px"}},"Unsaved changes are lost on detach"),M.react.createElement("div",{className:"help-text"},"Press ",M.react.createElement("code",{className:"inline"},"ctrl"),"+",M.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,mn.saveSettings()}}updateCss(){B.removeStyle("customcss"),B.addStyle("customcss",this.editor.session.getValue())}saveCss(){Y.setBDData("bdcustomcss",btoa(this.editor.session.getValue()))}detach(){this.setState({detached:!0});const e=this.detachedRoot;e?M.reactDom.render(this.detachedEditor,e):console.log("FAILED TO INJECT ROOT: .app")}get detachedRoot(){const e=B.query("#bd-customcss-detach-container");return e||(this.injectDetachedRoot()?this.detachedRoot:null)}injectDetachedRoot(){const e=B.query(".app, ."+BDModules.get(e=>e.app&&e.layers)[0].app.split(" ")[0]);return!!e&&(B.insertAfter(B.createElement('<div id="bd-customcss-detach-container">'),e),!0)}attach(){this.setState({detached:!1})}}class ze extends M.reactComponent{constructor(e){super(e),this.state={hasError:!1}}componentDidCatch(){this.setState({hasError:!0})}render(){return this.state.hasError?M.react.createElement("div",{className:"react-error"},"Component Error"):this.props.children}}const Ue=ze.prototype.render;Object.defineProperty(ze.prototype,"render",{enumerable:!1,configurable:!1,set:function(){console.warn("Addon policy for plugins #5 https://github.com/rauenzi/BetterDiscordApp/wiki/Addon-Policies#plugins")},get:()=>Ue});class He extends M.reactComponent{constructor(e){super(e)}static get displayName(){return"ContentColumn"}render(){let e=BDModules.get(e=>e.contentColumn)[0];return M.react.createElement("div",{className:e.contentColumn+" "+e.contentColumnDefault+" content-column default"},M.react.createElement("h2",{className:"ui-form-title h2 margin-reset margin-bottom-20"},this.props.title),this.props.children)}}class qe extends M.reactComponent{constructor(e){super(e)}render(){return M.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"}},M.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"}),M.react.createElement("path",{fill:"none",d:"M0 0h24v24H0z"}))}}const Ge=M.React;class Ve extends Ge.Component{render(){const e=this.props.size||"24px";return Ge.createElement("svg",{className:this.props.className||"",viewBox:"0 0 24 24",fill:"#FFFFFF",style:{width:e,height:e},onClick:this.props.onClick},Ge.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"}),Ge.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}))}}const Je=M.React;class Ze extends Je.Component{render(){const e=this.props.size||"24px";return Je.createElement("svg",{className:this.props.className||"",fill:"#FFFFFF",viewBox:"0 0 24 24",style:{width:e,height:e},onClick:this.props.onClick},Je.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),Je.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"}),Je.createElement("path",{fill:"none",d:"M0 0h24v24H0z"}))}}const Ye=M.React,Ke=M.anchorClasses;class Qe extends M.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,r=t.offsetTop,o=r+t.clientHeight;return r<n||o>s})(t,e))return;const n=B.offset(e),s=B.offset(t),r=t.scrollTop,o=n.top-s.top+t.scrollTop-30;B.animate({duration:300,update:function(e){t.scrollTop=o>r?r+e*(o-r):r-e*(r-o)}})}))}getString(e){return e?"string"==typeof e?e:e.toString():"???"}get settingsComponent(){try{this.settingsPanel=this.props.addon.plugin.getSettingsPanel()}catch(e){N.err("Plugins","Unable to get settings panel for "+this.name+".",e)}return M.react.createElement("div",{className:"bd-card bd-addon-card settings-open ui-switch-item",ref:"cardNode"},M.react.createElement("div",{style:{float:"right",cursor:"pointer"},onClick:()=>{this.refs.settingspanel.innerHTML="",this.setState({settings:!1})}},M.react.createElement(Ce,null)),"object"==typeof this.settingsPanel&&M.react.createElement("div",{id:`plugin-settings-${this.name}`,className:"plugin-settings",ref:"settingspanel"}),"object"!=typeof this.settingsPanel&&M.react.createElement("div",{id:`plugin-settings-${this.name}`,className:"plugin-settings",ref:"settingspanel",dangerouslySetInnerHTML:{__html:this.settingsPanel}}))}buildTitle(e,t,n){const s="{{name}} v{{version}} by {{author}}".split(/({{[A-Za-z]+}})/),r=s.findIndex(e=>"{{name}}"==e);r&&(s[r]=Ye.createElement("span",{className:"name bda-name"},e));const o=s.findIndex(e=>"{{version}}"==e);r&&(s[o]=Ye.createElement("span",{className:"version bda-version"},t));const a=s.findIndex(e=>"{{author}}"==e);if(r){const e={className:"author bda-author"};(n.link||n.id)&&(e.className+=` ${Ke.anchor} ${Ke.anchorUnderlineOnHover}`,e.target="_blank",n.link&&(e.href=n.link),n.id&&(e.onClick=()=>{M.LayerStack.popLayer(),M.openDM(n.id)})),s[a]=Ye.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()}),M.react.createElement("a",n,e)}makeButton(e,t,n){return Ye.createElement(ue,{color:"black",side:"top",text:e},Ye.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]),M.LayerStack.popLayer(),M.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)&&M.react.createElement("div",{className:"bd-card-footer bda-footer"},M.react.createElement("span",{className:"bd-addon-links bda-links"},...e.map((t,n)=>n<e.length-1?[t," | "]:t).flat()),this.hasSettings&&M.react.createElement("button",{onClick:this.showSettings,className:"bd-button bda-settings-button",disabled:!this.state.checked},"Settings"))}onChange(){this.props.toggle&&this.props.toggle(this.name),this.setState({checked:!this.state.checked})}edit(){this.props.edit(this.name)}delete(){this.props.remove(this.name)}reload(){this.props.reload(this.name)}get name(){return this.getString(this.props.addon.plugin?this.props.addon.plugin.getName():this.props.addon.name)}get author(){return this.getString(this.props.addon.plugin?this.props.addon.plugin.getAuthor():this.props.addon.author)}get description(){return this.getString(this.props.addon.plugin?this.props.addon.plugin.getDescription():this.props.addon.description)}get version(){return this.getString(this.props.addon.plugin?this.props.addon.plugin.getVersion():this.props.addon.version)}render(){if(this.state.settings)return this.settingsComponent;const{authorId:e,authorLink:t}=this.props.addon;return M.react.createElement("div",{className:"bd-card bd-addon-card settings-closed ui-switch-item"},M.react.createElement("div",{className:"bd-addon-header bda-header"},M.react.createElement("div",{className:"bd-card-title bda-header-title"},this.buildTitle(this.name,this.version,{name:this.author,id:e,link:t})),M.react.createElement("div",{className:"bd-addon-controls bda-controls"},this.props.edit&&this.makeButton("Edit",Ye.createElement(Ve,{className:"bd-icon"}),this.edit),this.props.remove&&this.makeButton("Delete",Ye.createElement(Ze,{className:"bd-icon"}),this.delete),this.props.reload&&this.makeButton("Reload",Ye.createElement(qe,{className:"bd-icon"}),this.reload),Ye.createElement(Oe,{onChange:this.onChange,checked:this.state.checked}))),M.react.createElement("div",{className:"bd-scroller-wrap bda-description-wrap scroller-wrap fade"},M.react.createElement("div",{className:"bd-scroller bd-addon-description bda-description scroller"},this.description)),this.footer)}}const Xe=Qe.prototype.render;Object.defineProperty(Qe.prototype,"render",{enumerable:!1,configurable:!1,set:function(){console.warn("Addon policy for plugins #5 https://github.com/rauenzi/BetterDiscordApp/wiki/Addon-Policies#plugins")},get:()=>Xe});const et=M.React;class tt extends et.Component{render(){const e=this.props.size||"16px";return et.createElement("svg",{className:this.props.className||"",fill:"#FFFFFF",viewBox:"0 0 24 24",style:{width:e,height:e}},et.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 nt=M.React;class st extends nt.Component{constructor(e){super(e),this.state={open:!1,value:this.props.value||this.props.options[0].value},this.dropdown=nt.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 nt.createElement("div",{className:"bd-select-options"},this.props.options.map(t=>nt.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 nt.createElement("div",{className:`bd-select${e}${t}`,onClick:this.showMenu,ref:this.dropdown},nt.createElement("div",{className:"bd-select-value"},this.selected.label),nt.createElement(tt,{className:"bd-select-arrow"}),this.state.open&&this.options)}}const rt=M.React;class ot extends rt.Component{render(){const e=this.props.size||"16px";return rt.createElement("svg",{className:this.props.className||"",fill:"#FFFFFF",viewBox:"0 0 24 24",style:{width:e,height:e}},rt.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),rt.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 at=M.React;class it extends at.Component{render(){return at.createElement("div",{className:"bd-search-wrapper"},at.createElement("input",{onChange:this.props.onChange,onKeyDown:this.props.onKeyDown,type:"text",className:"bd-search",placeholder:this.props.placeholder,maxLength:"50"}),at.createElement(ot,null))}}function lt(){return(lt=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 ct=k("Tooltip"),dt=M.react;class ut extends M.reactComponent{constructor(e){super(e),this.state={sort:"name",ascending:!0,query:""},this.isPlugins="plugins"==this.props.type,this.cookie=this.isPlugins?y:E,this.manager=this.isPlugins?A:O,this.sort=this.sort.bind(this),this.reverse=this.reverse.bind(this),this.search=this.search.bind(this)}openFolder(){n(0).shell.openItem(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=>{is.showConfirmationModal("Are You Sure?",`Are you sure you want to delete ${e}?`,{danger:!0,confirmText:"Delete",onConfirm:()=>{t(!0)},onCancel:()=>{t(!1)}})})}get sortOptions(){return[{label:"Name",value:"name"},{label:"Author",value:"author"},{label:"Version",value:"version"},{label:"Recently Added",value:"added"},{label:"Last Modified",value:"modified"},{label:"File Size",value:"size"}]}get directions(){return[{label:"Ascending",value:!0},{label:"Descending",value:!1}]}reverse(e){this.setState({ascending:e})}sort(e){this.setState({sort:e})}search(e){this.setState({query:e.target.value.toLocaleLowerCase()})}getProps(e){return{key:this.getName(e),enabled:this.cookie[this.getName(e)],toggle:this.manager.toggle.bind(this.manager),remove:this.delete.bind(this),addon:e}}getString(e){return e?"string"==typeof e?e:e.toString():"???"}getAddons(){const e=this.props.list.sort((e,t)=>{const n=this.state.sort.charAt(0).toUpperCase()+this.state.sort.slice(1),s=e.plugin&&e.plugin[`get${n}`]?this.getString(e.plugin[`get${n}`]()):e[this.state.sort],r=t.plugin&&t.plugin[`get${n}`]?this.getString(t.plugin[`get${n}`]()):t[this.state.sort];return"string"==typeof s?s.toLocaleLowerCase().localeCompare(r.toLocaleLowerCase()):s>r?1:r>s?-1:0});this.state.ascending||e.reverse();const t=[];for(let n=0;n<e.length;n++){const s=e[n];if(this.state.query){let e=null;const t=this.getName(s),n=this.getAuthor(s),r=this.getDescription(s),o=this.getVersion(s);if(t&&(e=t.toLocaleLowerCase().includes(this.state.query)),n&&(e=e||n.toLocaleLowerCase().includes(this.state.query)),r&&(e=e||r.toLocaleLowerCase().includes(this.state.query)),o&&(e=e||o.toLocaleLowerCase().includes(this.state.query)),!e)continue}const r=this.getProps(s);t.push(dt.createElement(ze,null,dt.createElement(Qe,lt({},r,{reload:!u["fork-ps-5"]&&this.manager.reload.bind(this.manager)}))))}return t}getName(e){return this.getString(e.plugin?e.plugin.getName():e.name)}getAuthor(e){return this.getString(e.plugin?e.plugin.getAuthor():e.author)}getDescription(e){return this.getString(e.plugin?e.plugin.getDescription():e.description)}getVersion(e){return this.getString(e.plugin?e.plugin.getVersion():e.version)}render(){const e=dt.createElement(ct,{color:"black",position:"top",text:"Reload List"},e=>dt.createElement(qe,lt({},e,{className:"bd-icon bd-reload bd-reload-header",size:"18px",onClick:async()=>{this.isPlugins?A.updatePluginList():O.updateThemeList(),this.forceUpdate()}}))),t=this.getAddons();return dt.createElement(De,{contentColumn:!0,fade:!0,dark:!0},dt.createElement(He,{title:`${this.props.type.toUpperCase()}${t.length}`},dt.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,dt.createElement("div",{className:"bd-controls bd-addon-controls"},dt.createElement(it,{onChange:this.search,placeholder:`Search ${this.props.type}...`}),dt.createElement("div",{className:"bd-addon-dropdowns"},dt.createElement("div",{className:"bd-select-wrapper"},dt.createElement("label",{className:"bd-label"},"Sort by:"),dt.createElement(st,{options:this.sortOptions,onChange:this.sort,style:"transparent"})),dt.createElement("div",{className:"bd-select-wrapper"},dt.createElement("label",{className:"bd-label"},"Order:"),dt.createElement(st,{options:this.directions,onChange:this.reverse,style:"transparent"})))),dt.createElement("div",{className:"bda-slist bd-addon-list"},t)),dt.createElement(we,{key:"tools"}))}}const ht=ut.prototype.render;Object.defineProperty(ut.prototype,"render",{enumerable:!1,configurable:!1,set:function(){console.warn("Addon policy for plugins #5 https://github.com/rauenzi/BetterDiscordApp/wiki/Addon-Policies#plugins")},get:()=>ht});const pt=BDModules.get(e=>e.Dispatcher&&e.default&&e.default.dispatch)[0].default,mt=BDModules.get(e=>e.ActionTypes)[0].ActionTypes,gt=process.pid;var ft=new class{constructor(){this.enabled=!1,this.game=h}get formatedGame(){if(!this.game)return null;if(!1===this.enabled)return null;return{name:this.game.name||p.name,application_id:this.game.application_id||p.application_id,details:this.game.details||void 0,state:this.game.state||void 0,timestamps:this.game["timestamps.start"]?{start:this.game["timestamps.start"]}:void 0,assets:this.game["assets.large"]?{large_image:this.game["assets.large"],small_image:this.game["assets.small"]||void 0}:void 0}}sendGame(){pt.dispatch({type:mt.LOCAL_ACTIVITY_UPDATE,socketId:"lightcord-spoof-socket",pid:gt,activity:this.formatedGame})}enable(){this.enabled||(this.enabled=!0,console.log("Enabling custom RichPresence"),this.set(h||Object.create(p)),this.sendGame())}disable(){this.enabled&&(this.enabled=!1,console.log("Disabling custom RichPresence"),this.sendGame())}async fetchAssets(e){let t=await BDModules.get(e=>e.getAssets)[0].getAssets(e);if(t.undefined&&"number"==typeof t.undefined)throw new Error("Unknown Application");return t}set(e){this.game=e,this.sendGame()}};const bt=M.react;class vt extends bt.Component{handleChange(e){this.props.value=e,"function"==typeof this.props.onChange&&this.props.onChange(e,this),this.forceUpdate()}render(){let e=BDModules.get(e=>e.default&&e.default.Wrap&&e.default.Direction&&e.default.Child)[0].default,t=BDModules.get(e=>e.default&&"SelectTempWrapper"===e.default.displayName)[0].default;return bt.createElement("flex",{direction:e.Direction.HORIZONTAL,align:e.Align.CENTER},bt.createElement(t,Object.assign({},this.props,{onChange:this.handleChange.bind(this)})))}}const yt=M.react,Et=BDModules.get(e=>e.Interval)[0];var Ct=function(e,t){class n extends yt.PureComponent{constructor(e){super(e),this._interval=new Et.Interval,this.state=Object.assign({},this.getUpdatedTime())}componentDidMount(){let e=this;this._interval.start(1e3,(function(){return e.setState(e.getUpdatedTime())}))}componentWillUnmount(){this._interval.stop()}componentDidUpdate(e){e.timestamps.end===this.props.timestamps.end&&e.timestamps.start===this.props.timestamps.start||this.setState(this.getUpdatedTime())}getUpdatedTime(){let e=this.props.timestamps,t=Date.now()/1e3;return null!=e.end?this.getDiff(t,wt(e.end)/1e3):null!=e.start?this.getDiff(wt(e.start)/1e3,t):{hours:0,minutes:0,seconds:0}}renderTime(e,t){return void 0===t&&(t=!1),t&&e<=0?-1:e<10?"0"+e:e}getDiff(e,t){let n=Math.max(t-e,0),s=Math.floor(n)%60,r=Math.floor(n/60)%60;return{hours:Math.floor(n/3600)%24,minutes:r,seconds:s}}render(){let n=this.props,s=n.timestamps,r=function(e,t){if(null==e)return{};let n={},s=Object.keys(e);for(let r=0;r<s.length;r++){let o=s[r];!t.indexOf(o)>=0&&(n[o]=e[o])}return n}(n,["timestamps"]),o=this.state,a=o.hours,i=o.minutes,l=o.seconds,c={hours:this.renderTime(a,!0),minutes:this.renderTime(i),seconds:this.renderTime(l)};return null!==s.end?yt.createElement(e,Object.assign({},r,{message:t.USER_ACTIVITY_TIMESTAMP_END.format(c)})):null!==s.start?yt.createElement(e,Object.assign({},r,{message:t.USER_ACTIVITY_TIMESTAMP_START.format(c)})):null}}return n};function wt(e){return(""+e).length<13?1e3*e:e}var St=n(0);const xt=M.React;class Dt extends xt.Component{constructor(e){super(e),this.state={data:Y.getSettingGroup("rpc")||p,assets:[]},this.preview=null,this.isfetching=!1,this.state.data.application_id&&this.fetchAssets()}onChange(e,t){let n=kt.find(t=>t.id===e.props.id);this.setState({data:Object.assign(h,this.state.data,{[n.id]:t||null}),assets:this.state.assets}),"application_id"===e.props.id&&this.fetchAssets(),Y.setSettingGroup("rpc",h),this.preview.forceUpdate(),ft.set(h)}fetchAssets(){if(!0===this.isfetching){let e=this.state.data.application_id;setTimeout(()=>{this.state.data.application_id===e&&this.fetchAssets()},5e3)}this.state.data.application_id?(this.isfetching=!0,ft.fetchAssets(this.state.data.application_id).then(e=>{this.isfetching=!1,this.setState({data:this.state.data,assets:Object.keys(e).map(t=>{let n=e[t];return{id:n.id,name:n.name,type:n.type}})}),this.forceUpdate()}).catch(()=>{this.isfetching=!1,this.setState({data:this.state.data,assets:[]}),this.forceUpdate()})):this.setState({data:this.state.data,assets:[]})}updatePreview(e){this.setState({data:e})}render(){let e=BDModules.get(e=>e.contentColumn)[0];return xt.createElement("div",{className:e.contentColumn+" "+e.contentColumnDefault+" content-column default",style:{padding:"60px 40px 0px"}},xt.createElement(Re,{title:"RichPresence Settings",settings:this.props.settings,onChange:this.props.onChange}),xt.createElement(Se,{text:"RichPresence"}),xt.createElement("div",null,kt.map(e=>{if("text"===e.type)return xt.createElement(Mt,{setting:e,manager:this,id:e.id});if("number"===e.type){return[xt.createElement(Bt,{setting:e,manager:this,id:e.id})]}return"choice"===e.type?["assets.small","assets.large"].includes(e.id)?xt.createElement(Nt,{setting:e,manager:this,id:e.id,choices:[{value:"none",label:"No assets"}].concat(this.state.assets.map(e=>({value:"asset-"+e.id,label:e.name})))}):"Unknown choice.":void 0})),xt.createElement("div",null,xt.createElement(Se,{text:"Preview"}),xt.createElement(Pt,{settings:this})),xt.createElement("div",{className:BDModules.get(e=>e.marginBottom20)[0].marginBottom20}),xt.createElement("button",{style:{opacity:.01},onClick:window.ohgodohfuck},"Oh god Oh fuck"),xt.createElement("button",{style:{opacity:.01},onclick:()=>{St.remote.shell.openExternal("https://www.youtube.com/watch?v=LkYa7rps_g4",{activate:!0})}},"See ? I pulled a litle sneaky on ya"))}}const kt=[{title:"Application ID",id:"application_id",type:"number"},{title:"Name",id:"name",type:"text"},{title:"Details",id:"details",type:"text"},{title:"State",id:"state",type:"text"},{title:"Timestamp Start",id:"timestamps.start",type:"number"},{title:"LargeAsset",id:"assets.large",type:"choice"},{title:"SmallAsset",id:"assets.small",type:"choice"}];class Mt extends xt.Component{render(){let e=this.props.setting,t=BDModules.get(e=>e.removeKeybind)[0],n=BDModules.get(e=>e.marginBottom20)[0],s=BDModules.get(e=>e.defaultMarginh5)[0],r=BDModules.get(e=>e.colorStandard)[0],o=BDModules.get(e=>e.size32)[0],a=BDModules.get(e=>e._horizontal)[0],i=BDModules.get(e=>e.inputMini)[0],l=BDModules.get(e=>e.size16&&e.size20)[0];return xt.createElement("div",{className:t.row+" "+n.marginBottom20},xt.createElement("div",{className:`${t.item} ${a.flexChild}`},xt.createElement("h5",{className:r.colorStandard+" "+o.size14+" "+s.h5+" "+s.defaultMarginh5},e.title),xt.createElement("div",{className:i.inputWrapper},xt.createElement("input",{class:`${i.inputDefault} ${l.size16}`,name:"state",type:"text",placeholder:"",maxlength:"999",value:this.props.manager.state.data[e.id],onChange:e=>{this.props.manager.onChange(this,e.target.value)}}))),xt.createElement("div",{class:`${BDModules.get(e=>e.divider&&1===Object.keys(e).length)[0].divider} ${BDModules.get(e=>e.dividerDefault)[0].dividerDefault}`}))}}class Bt extends xt.Component{render(){let e=this.props.setting,t=BDModules.get(e=>e.removeKeybind)[0],n=BDModules.get(e=>e.marginBottom20)[0],s=BDModules.get(e=>e.defaultMarginh5)[0],r=BDModules.get(e=>e.colorStandard)[0],o=BDModules.get(e=>e.size32)[0],a=BDModules.get(e=>e._horizontal)[0],i=BDModules.get(e=>e.inputMini)[0],l=BDModules.get(e=>e.size16&&e.size20)[0],c=BDModules.get(e=>e.colorTransparent)[0];return xt.createElement("div",{className:t.row+" "+n.marginBottom20},xt.createElement("div",{className:`${t.item} ${a.flexChild}`},xt.createElement("h5",{className:r.colorStandard+" "+o.size14+" "+s.h5+" "+s.defaultMarginh5},e.title),xt.createElement("div",{className:i.inputWrapper},xt.createElement("input",{class:`${i.inputDefault} ${l.size16}`,name:"state",type:"text",placeholder:"",maxlength:"999",value:this.props.manager.state.data[e.id],onChange:e=>{let t=e.target.value.replace(/[^\d]+/g,"");t!==e.target.value&&(e.target.value=t),this.props.manager.onChange(this,t)}})),"timestamps.start"===e.id?xt.createElement("div",{className:BDModules.get(e=>e.buttonWrapper)[0].buttonWrapper},xt.createElement("button",{type:"button",class:`${a.flexChild} ${c.button} ${c.lookFilled} ${c.colorBrand} ${c.sizeSmall} ${c.grow}`,style:{flex:"0 1 auto"},onClick:()=>{DiscordNative.clipboard.copy(Date.now()+"")}},xt.createElement("div",{class:c.contents},"Copy current timestamp"))):null),xt.createElement("div",{class:`${BDModules.get(e=>e.divider&&1===Object.keys(e).length)[0].divider} ${BDModules.get(e=>e.dividerDefault)[0].dividerDefault}`}))}}class Nt extends xt.Component{onChange(e){this.props.manager.onChange(this,"none"===e.value?null:e.value.replace("asset-",""))}render(){let e=this.props.setting,t=BDModules.get(e=>e.removeKeybind)[0],n=BDModules.get(e=>e.marginBottom20)[0],s=BDModules.get(e=>e.defaultMarginh5)[0],r=BDModules.get(e=>e.colorStandard)[0],o=BDModules.get(e=>e.size32)[0],a=BDModules.get(e=>e._horizontal)[0],i=this.props.choices;return xt.createElement("div",{className:t.row+" "+n.marginBottom20},xt.createElement("div",{className:`${t.item} ${a.flexChild}`},xt.createElement("h5",{className:r.colorStandard+" "+o.size14+" "+s.h5+" "+s.defaultMarginh5},e.title),xt.createElement(vt,{value:"asset-"+this.props.manager.state.data[e.id]||!1,onChange:this.onChange.bind(this),options:i})),xt.createElement("div",{class:`${BDModules.get(e=>e.divider&&1===Object.keys(e).length)[0].divider} ${BDModules.get(e=>e.dividerDefault)[0].dividerDefault}`}))}}xt.Component;class Pt extends xt.Component{constructor(e={}){super(e),this.state={active:"profile"},this.tabs=[],this.props.settings.preview=this}changeTab(e){this.state.active!==e.props.id&&(this.tabs.forEach(e=>{e.setActive(!1)}),e.setActive(!0),this.setState({active:e.props.id}))}render(){let e=new this.preview({preview:this});return e.setState(this.state.rpc),xt.createElement("div",{className:"lc-tabWrapper"},xt.createElement("div",{className:"lc-tabnav",style:{flex:"0 1 auto"}},xt.createElement(Lt,{preview:this,title:"Full Profile",id:"profile"}),xt.createElement(Lt,{preview:this,title:"User Popout",id:"popout"})),e.render())}isActive(e){return this.state.active===e}get preview(){return"profile"===this.state.active?Ot:$t}}class Lt extends xt.Component{constructor(e){super(e),this.state={active:e.preview.isActive(e.id)},e.preview.tabs.push(this)}setActive(e){this.setState({active:!!e})}render(){let e="lc-navItem";return this.state.active?e+=" lc-navItemActive":e+=" lc-navItemInactive",xt.createElement("div",{className:e,onClick:()=>{this.props.preview.changeTab(this)}},this.props.title)}}class $t extends xt.Component{render(){let e=BDModules.get(e=>e.default&&e.default.getCurrentUser)[0].default.getCurrentUser(),t=e.getAvatarURL(e.avatar.startsWith("a_")?"gif":"png"),[n,s,r,o,a,i,l,c,d,u,h,m,g]=[BDModules.get(e=>e.userPopout)[0],BDModules.get(e=>e._horizontal)[0],BDModules.get(e=>e.vertical&&e.alignStretch&&!e.streamerModeEnabledBtn)[0],BDModules.get(e=>e.bot)[0],BDModules.get(e=>e.activityUserPopout)[0],BDModules.get(e=>e.muted&&e.wrapper&&e.base)[0],BDModules.get(e=>e.size32)[0],BDModules.get(e=>e.themeGhostHairlineChannels)[0],BDModules.get(e=>e.note&&1===Object.keys(e).length)[0],BDModules.get(e=>e.pro&&e.inline)[0],BDModules.get(e=>e.colorStandard)[0],BDModules.get(e=>e.default&&e.default.Messages)[0].default.Messages,BDModules.get(e=>e.pointerEvents)[0]],f=Object.assign({},p,this.props.preview.props.settings.state.data);return Tt=Tt||a.timestamp,xt.createElement("div",{className:"lc-userPopout"},xt.createElement("div",{class:n.userPopout,role:"dialog",tabindex:"-1"},xt.createElement("div",{class:n.headerPlaying},xt.createElement("div",{class:`${s.flex} ${r.vertical} ${r.justifyCenter} ${r.alignCenter} ${r.noWrap} ${n.headerTop}`,style:{flex:"1 1 auto"}},xt.createElement("div",{class:n.avatarWrapperNormal,role:"button",tabindex:"0"},xt.createElement("div",{class:g,role:"img",style:{width:"80px",height:"80px"}},xt.createElement("svg",{width:"92",height:"80",viewBox:"0 0 92 80",class:`${g.mask} ${g.svg}`},xt.createElement("foreignObject",{x:"0",y:"0",width:"80",height:"80",mask:"url(#svg-mask-avatar-status-round-80)"},xt.createElement("img",{src:t,alt:" ",class:g.avatar})),xt.createElement(At,null))),xt.createElement("svg",{width:"80",height:"80",class:n.avatarHint,viewBox:"0 0 80 80"},xt.createElement("foreignObject",{x:"0",y:"0",width:"80",height:"80",mask:"url(#svg-mask-avatar-status-round-80)"},xt.createElement("div",{class:n.avatarHintInner},m.VIEW_PROFILE)))),xt.createElement("div",{class:n.headerText},xt.createElement("div",{class:`${s.flex} ${r.horizontal} ${r.justifyStart} ${r.alignCenter} ${r.noWrap}`,style:{flex:"1 1 auto"}},xt.createElement("div",{class:`${n.headerTagNoNickname} ${o.nameTag}`},xt.createElement("span",{class:`${o.username} ${n.headerTagUsernameNoNickname}`},e.username),xt.createElement("span",null,"#",e.discriminator))))),xt.createElement("div",{class:`${a.activityUserPopout} ${n.activity}`},xt.createElement("h3",{class:`${a.headerTextNormal} ${i.base} ${l.size12}`},m.USER_ACTIVITY_HEADER_PLAYING),xt.createElement("div",{class:a.bodyNormal},(()=>{if(!f["assets.large"])return null;let e=[];return f["assets.large"]&&e.push(xt.createElement("img",{alt:"",src:`https://cdn.discordapp.com/app-assets/${f.application_id}/${f["assets.large"]}.png`,class:`${a.assetsLargeImageUserPopout} ${f["assets.small"]?a.assetsLargeMaskUserPopout:""}`})),f["assets.small"]&&e.push(xt.createElement("img",{alt:"",src:`https://cdn.discordapp.com/app-assets/${f.application_id}/${f["assets.small"]}.png`,class:a.assetsSmallImageUserPopout})),xt.createElement("div",{class:a.assets},e)})(),xt.createElement("div",{class:a.contentImagesUserPopout,style:{flex:"1 1 auto"}},f.name?xt.createElement("h3",{class:`${a.nameNormal} ${i.base} ${l.size14}`,title:f.name},xt.createElement("span",{class:a.activityName},f.name)):null,f.details?xt.createElement("div",{title:f.title,class:a.details},f.details):null,f.state?xt.createElement("div",{class:a.state},xt.createElement("span",{title:f.state},f.state)):null,(()=>{if(!f["timestamps.start"])return null;let e=Ct(Ft,m);return xt.createElement("div",{class:a.timestamp},xt.createElement(e,{timestamps:{end:null,start:f["timestamps.start"]}}))})())))),xt.createElement("div",{class:`${c.scrollerWrap} ${n.body} ${c.scrollerThemed} ${c.themeGhostHairline} ${c.scrollerFade}`},xt.createElement("div",{class:`${c.scroller} ${n.bodyInner}`},xt.createElement("div",{class:n.bodyTitle},m.NOTE),xt.createElement("div",{class:`${d.note} ${n.note}`},xt.createElement("textarea",{placeholder:m.NOTE_PLACEHOLDER,maxlength:"256",autocorrect:"off",class:BDModules.get(e=>e.scrollbarGhostHairline)[0].scrollbarGhostHairline,style:{height:"36px"},disabled:!0})))),xt.createElement("div",{class:n.footer},xt.createElement("div",{class:`${n.protip} ${u.inline}`},xt.createElement("h3",{class:`${u.pro} ${i.base} ${l.size12}`,style:{color:"rgb(67, 181, 129)"}},m.PINNED_MESSAGES_PRO_TIP),xt.createElement("div",{class:`${h.colorStandard} ${l.size14} ${u.tip}`},m.CONTEXT_MENU_HINT)))))}}class At extends xt.Component{render(){let e=BDModules.get(e=>e.default&&e.default.getPresence)[0].default.getPresence().status;"invisible"===e&&(e="offline");let t=BDModules.get(e=>e.pointerEvents)[0].pointerEvents;return xt.createElement("rect",{width:"16",height:"16",x:"60",y:"60",fill:"#ffffff",mask:`url(#svg-mask-status-${e})`,className:t})}}let Tt="";class Ot extends xt.Component{render(){let e=BDModules.get(e=>e.default&&e.default.getCurrentUser)[0].default.getCurrentUser(),t=e.getAvatarURL(e.avatar.startsWith("a_")?"gif":"png"),[n,s,r,o,a,i,l,c,d,u,h]=[BDModules.get(e=>e.flex&&e._horizontal)[0],BDModules.get(e=>e.vertical&&e.alignStretch&&!e.streamerModeEnabledBtn)[0],BDModules.get(e=>e.topSectionStreaming)[0],BDModules.get(e=>e.pointerEvents)[0],BDModules.get(e=>e.bot)[0],BDModules.get(e=>e.activityProfile)[0],BDModules.get(e=>e.muted&&e.wrapper&&e.base)[0],BDModules.get(e=>e.size32)[0],BDModules.get(e=>e.scrollerFade)[0],BDModules.get(e=>e.note&&1===Object.keys(e).length)[0],BDModules.get(e=>e.default&&e.default.Messages)[0].default.Messages],m=Object.assign({},p,this.props.preview.props.settings.state.data);return Tt=Tt||i.timestamp,[xt.createElement("div",{className:"lc-tab"},xt.createElement("div",{class:`${n.flex} ${s.vertical} ${s.justifyStart} ${s.alignStretch} ${s.noWrap} ${r.root}`,style:{flex:"1 1 auto"}},xt.createElement("div",{class:r.topSectionPlaying},xt.createElement("header",{class:r.header},xt.createElement("div",{class:`${r.avatar} ${o.wrapper}`,role:"img",style:{width:"80px",height:"80px"}},xt.createElement("svg",{width:"92",height:"80",viewBox:"0 0 92 80",class:`${o.mask} ${o.svg}`},xt.createElement("foreignObject",{x:"0",y:"0",width:"80",height:"80",mask:"url(#svg-mask-avatar-status-round-80)"},xt.createElement("img",{src:t,alt:" ",class:o.avatar})),xt.createElement(At,null))),xt.createElement("div",{class:`${r.headerInfo}`},xt.createElement("div",{class:`${r.nameTag} ${a.nameTag}`},xt.createElement("span",{class:`${r.username} ${r.username}`},e.username),xt.createElement("span",{class:r.discriminator},"#",e.discriminator)),xt.createElement("div",{class:`${n.flex} ${n.horizontal} ${s.justifyStart} ${s.alignStretch} ${s.noWrap} ${r.profileBadges}`,style:{flex:"1 1 auto"}},xt.createElement(It,null)))),xt.createElement("div",{class:r.headerFill},xt.createElement("div",{class:`${i.activityProfile} ${r.activity}`},xt.createElement("h3",{class:`${i.headerTextNormal} ${l.base} ${c.size12}`},h.USER_ACTIVITY_HEADER_PLAYING),xt.createElement("div",{class:i.bodyNormal},(()=>{if(!m["assets.large"])return null;let e=[];return m["assets.large"]&&e.push(xt.createElement("img",{alt:"",src:`https://cdn.discordapp.com/app-assets/${m.application_id}/${m["assets.large"]}.png`,class:`${i.assetsLargeImageProfile} ${m["assets.small"]?i.assetsLargeMaskProfile:""}`})),m["assets.small"]&&e.push(xt.createElement("img",{alt:"",src:`https://cdn.discordapp.com/app-assets/${m.application_id}/${m["assets.small"]}.png`,class:i.assetsSmallImageProfile})),xt.createElement("div",{class:i.assets},e)})(),xt.createElement("div",{class:i.contentImagesProfile,style:{flex:"1 1 auto"}},m.name?xt.createElement("h3",{class:`${i.nameNormal} ${l.base} ${c.size14}`,title:m.name},xt.createElement("span",{class:i.activityName},m.name)):null,m.details?xt.createElement("div",{title:m.title,class:i.details},m.details):null,m.state?xt.createElement("div",{class:i.state},xt.createElement("span",{title:m.state},m.state)):null,(()=>{if(!m["timestamps.start"])return null;let e=Ct(Ft,h);return xt.createElement("div",{class:i.timestamp},xt.createElement(e,{timestamps:{end:null,start:m["timestamps.start"]}}))})()))))),xt.createElement("div",{class:r.body},xt.createElement("div",{class:`${d.scrollerWrap} ${d.scrollerFade}`},xt.createElement("div",{class:d.scroller},xt.createElement("div",{class:r.userInfoSection},xt.createElement("div",{class:r.userInfoSectionHeader},h.NOTE),xt.createElement("div",{class:`${r.note} ${u.note}`},xt.createElement("textarea",{placeholder:h.NOTE_PLACEHOLDER,maxlength:"256",autocorrect:"off",class:BDModules.get(e=>e.scrollbarGhostHairline)[0].scrollbarGhostHairline,style:{height:"40px"},disabled:!0}))),xt.createElement(jt,null)))))),xt.createElement("div",{class:"lc- "})]}}class jt extends xt.Component{render(){let e=[],t=BDModules.get(e=>e.topSectionStreaming)[0],n=BDModules.get(e=>e.default&&e.default.getAccounts)[0].default.getAccounts().filter(e=>1===e.visibility);for(let t of n)e.push(xt.createElement(Rt,{acc:t}));return e.length>0?xt.createElement("div",{class:t.userInfoSection},xt.createElement("div",{class:t.connectedAccounts},e)):null}}class Rt extends xt.Component{render(){let[e,t,n,s,r,o]=[BDModules.get(e=>e.flex&&e._horizontal)[0],BDModules.get(e=>e.vertical&&e.alignStretch&&!e.streamerModeEnabledBtn)[0],BDModules.get(e=>e.topSectionStreaming)[0],BDModules.get(e=>e.flowerStarContainer)[0],BDModules.get(e=>e.anchor)[0],BDModules.get(e=>e.default&&e.default.get&&e.default.map)[0].default],a=this.props.acc,i=o.get(a.type);return xt.createElement("div",{class:`${e.flex} ${e.horizontal} ${t.justifyStart} ${t.alignCenter} ${t.noWrap} ${n.connectedAccount}`,style:{flex:"0 1 auto"}},xt.createElement("img",{alt:`Logo ${i.name}`,class:n.connectedAccountIcon,src:i.icon.color||i.icon.white||i.icon.grey}),xt.createElement("div",{class:n.connectedAccountNameInner},xt.createElement("div",{class:n.connectedAccountName},a.name),a.verified?xt.createElement("span",null,xt.createElement("div",{class:`${s.flowerStarContainer} ${n.connectedAccountVerifiedIcon}`,style:{width:"16px",height:"16px"}},xt.createElement("svg",{class:s.flowerStar,width:"16",height:"16",viewBox:"0 0 16 15.2"},xt.createElement("path",{fill:"#4f545c","fill-rule":"evenodd",d:"m16 7.6c0 .79-1.28 1.38-1.52 2.09s.44 2 0 2.59-1.84.35-2.46.8-.79 1.84-1.54 2.09-1.67-.8-2.47-.8-1.75 1-2.47.8-.92-1.64-1.54-2.09-2-.18-2.46-.8.23-1.84 0-2.59-1.54-1.3-1.54-2.09 1.28-1.38 1.52-2.09-.44-2 0-2.59 1.85-.35 2.48-.8.78-1.84 1.53-2.12 1.67.83 2.47.83 1.75-1 2.47-.8.91 1.64 1.53 2.09 2 .18 2.46.8-.23 1.84 0 2.59 1.54 1.3 1.54 2.09z"})),xt.createElement("div",{class:s.childContainer},xt.createElement("svg",{width:"16",height:"16",viewBox:"0 0 16 15.2"},xt.createElement("path",{d:"M7.4,11.17,4,8.62,5,7.26l2,1.53L10.64,4l1.36,1Z",fill:"#ffffff"}))))):null),xt.createElement("a",{class:`${r.anchor} ${r.anchorUnderlineOnHover}`,rel:"noreferrer noopener",target:"_blank",role:"button",tabindex:"0"},xt.createElement("svg",{class:n.connectedAccountOpenIcon,width:"24",height:"24",viewBox:"0 0 24 24"},xt.createElement("path",{fill:"currentColor",d:"M10 5V3H5.375C4.06519 3 3 4.06519 3 5.375V18.625C3 19.936 4.06519 21 5.375 21H18.625C19.936 21 21 19.936 21 18.625V14H19V19H5V5H10Z"}),xt.createElement("path",{fill:"currentColor",d:"M21 2.99902H14V4.99902H17.586L9.29297 13.292L10.707 14.706L19 6.41302V9.99902H21V2.99902Z"}))))}}class It extends xt.Component{render(){let e=BDModules.get(e=>e.default&&e.default.getCurrentUser)[0].default.getCurrentUser(),t=BDModules.get(e=>e.topSectionStreaming)[0],n=BDModules.get(e=>e.UserFlags)[0].UserFlags,s=[],r=[];for(let t in n)e.hasFlag(n[t])&&r.push(t);for(let e of r){let n=`profileBadge${e.toLowerCase().replace(/_/g," ").split(" ").map(e=>e[0].toUpperCase()+e.slice(1)).join("")}`;n=n.replace("HypesquadOnline","HypeSquadOnline"),t[n]&&s.push(xt.createElement(_t,{name:n}))}return e.hasPremiumSubscription&&s.push(xt.createElement(_t,{name:"profileBadgePremium"})),s}}class _t extends xt.Component{render(){let e=BDModules.get(e=>e.topSectionStreaming)[0];return xt.createElement("div",{class:e.profileBadgeWrapper},xt.createElement("div",null,xt.createElement("div",{class:"",role:"button",tabindex:"0"},xt.createElement("div",{class:`${e.profileBadge} ${e[this.props.name]}`}))))}}class Ft extends xt.Component{render(){return xt.createElement("div",{className:Tt},this.props.message)}}const Wt=M.React;let zt=BDModules.get(e=>e.contentColumn)[0],Ut=BDModules.get(e=>e.defaultMarginh5)[0],Ht=BDModules.get(e=>e.colorStandard)[0],qt=BDModules.get(e=>e.size32)[0],Gt=BDModules.get(e=>e.scrollbarGhostHairline)[0];const Vt=BDModules.get(e=>e.default&&e.default.getGuilds)[0].default,Jt=BDModules.get(e=>e.default&&e.default.getRelationships)[0].default,Zt=BDModules.get(e=>e.default&&e.default.getSessions)[0].default,Yt=BDModules.get(e=>e.default&&e.default.getCurrentUser)[0].default;class Kt extends Wt.Component{constructor(e){super(e)}render(){return zt||(zt=BDModules.get(e=>e.contentColumn)[0]),Ut||(Ut=BDModules.get(e=>e.defaultMarginh5)[0]),Ht||(Ht=BDModules.get(e=>e.colorStandard)[0]),qt||(qt=BDModules.get(e=>e.size32)[0]),Wt.createElement("div",{className:zt.contentColumn+" "+zt.contentColumnDefault+" content-column default",style:{padding:"60px 40px 0px"}},Wt.createElement(Se,{text:"Account Infos"}),Wt.createElement("div",null,Wt.createElement("h5",{className:Ht.colorStandard+" "+qt.size14+" "+Ut.h5+" "+Ut.defaultMarginh5},"Profile"),Wt.createElement(tn,{content:this.getProfileValue(),language:"diff"}),Wt.createElement("h5",{className:Ht.colorStandard+" "+qt.size14+" "+Ut.h5+" "+Ut.defaultMarginh5},"Statistics"),Wt.createElement(tn,{content:this.getStatistics(),language:"diff"}),Wt.createElement("h5",{className:Ht.colorStandard+" "+qt.size14+" "+Ut.h5+" "+Ut.defaultMarginh5},"Connected Sessions"),Wt.createElement(tn,{content:this.getSessionValue(),language:"diff"})),Wt.createElement("div",{className:BDModules.get(e=>e.marginBottom20)[0].marginBottom20}))}getSessionValue(){const e=Zt.getSessions(),t=Object.keys(e).filter(e=>"all"!==e).map(t=>e[t]);return 0===t.length?"- No session detected. Please try in a few seconds":t.map(e=>`+ id: ${e.sessionId}\n+ os: ${e.clientInfo.os[0].toUpperCase()+e.clientInfo.os.slice(1)}\n+ client: ${e.clientInfo.client}\n+ status: ${e.status}\n+ active: ${e.active?"Yes":"No"}\n+ Activities: ${e.activities.length}`).join("\n"+"-".repeat(38)+"\n")}getProfileValue(){const e=Yt.getCurrentUser(),t=e.createdAt;return`+ Username: ${e.username}\n+ Discriminator: ${e.discriminator}\n+ Tag: ${e.tag}\n+ ID: ${e.id}\n+ Avatar: ${e.avatar}\n+ Avatar URL: https://cdn.discordapp.com/avatars/${e.id}/${e.avatar}.${e.avatar.startsWith("a_")?"gif":"png"}?size=4096\n+ Creation Date: ${t.getDate().toString().padStart(2,"0")}/${(t.getMonth()+1).toString().padStart(2,"0")}/${t.getFullYear().toString().padStart(2,"0")} ${t.getHours().toString().padStart(2,"0")}h ${t.getMinutes().toString().padStart(2,"0")}min ${t.getSeconds()}s\n+ Flags: ${e.flags}\n+ Has Nitro: ${e.hasPremiumSubscription?"Yes":"No"}\n- Email: ${e.email}\n- 2FA: ${e.mfaEnabled?"Yes":"No"}\n- Has Been On Mobile: ${e.mobile?"Yes":"No"}\n- Phone: ${e.phone||"None"}\n- Verified: ${e.verified}`}getStatistics(){const e=Object.values(Vt.getGuilds()),t=Object.keys(Jt.getRelationships()),n=t.filter(e=>Jt.isFriend(e)),s=t.filter(e=>Jt.isBlocked(e));return`+ Server Count: ${e.length} servers\n+ Relations: ${t.length} relations\n+ Friends Count: ${n.length} friends\n- Blocked Users Count: ${s.length} blocked users`}}let Qt=BDModules.get(e=>e.highlight)[0],Xt=BDModules.get(e=>e.markup)[0],en=BDModules.get(e=>e.messageContent)[0];class tn extends Wt.Component{render(){return Xt||(Xt=BDModules.get(e=>e.markup)[0]),en||(en=BDModules.get(e=>e.messageContent)[0]),Gt||(Gt=BDModules.get(e=>e.scrollbarGhostHairline)[0]),Qt||(Qt=BDModules.get(e=>e.highlight)[0]),Wt.createElement("div",{class:`${Xt.markup} ${en.messageContent}`},Wt.createElement("pre",null,Wt.createElement("code",{class:`${Gt.scrollbarGhostHairline} hljs`,dangerouslySetInnerHTML:{__html:Qt.highlight(this.props.language,this.props.content).value}})),Wt.createElement("div",{className:BDModules.get(e=>e.marginBottom8)[0].marginBottom8}))}}const nn=window.Lightcord.DiscordModules.dispatcher,sn=BDModules.get(e=>e.default&&e.default.getChannel&&e.default.hasChannel)[0].default;let rn=BDModules.get(e=>e.default&&e.default.addRelationship)[0],on=BDModules.get(e=>e.default&&e.default.closePrivateChannel)[0];const an={};let ln=BDModules.get(e=>e.default&&e.default.getCurrentUser)[0];var cn=new class{constructor(){this.antiDM=this.antiDM.bind(this),this.enabled=!1}enable(){this.enabled||(this.enabled=!0,nn.subscribe("MESSAGE_CREATE",this.antiDM))}disable(){this.enabled&&(this.enabled=!1,nn.unsubscribe("MESSAGE_CREATE",this.antiDM))}antiDM(e){if(!e.message.author.bot)return;if(e.message.author.id===(ln?ln.default.getCurrentUser():null).id&&e.message.guild_id)return;const t=sn.getChannel(e.message.channel_id);var n;t&&(1===t.type&&(an[e.message.author.id]||(n=e.message,(/(discord\.gg|discord\.com\/invite\/|discordapp\.com\/invite\/)/g.test(n.content)||dn(n,"discord.gg/")||dn(n,"discord.com/invite/")||dn(n,"discordapp.com/invite/"))&&(an[e.message.author.id]=!0,N.showToast(`[AdBlock]: Blocked ${e.message.author.username}#${e.message.author.discriminator}`,{type:"warning"}),rn||(rn=BDModules.get(e=>e.default&&e.default.addRelationship)[0]),rn.default.addRelationship(e.message.author.id,{location:"ContextMenu"},2),on||(on=BDModules.get(e=>e.default&&e.default.closePrivateChannel)[0]),on.default.closePrivateChannel(t.id,!1)))))}};function dn(e,t){let n=e.embeds;return 0!==n.length&&n.map(e=>"rich"===e.type&&(!!(e.title||"").includes(t)||(!!(e.description||"").includes(t)||(!!((e.footer?e.footer.text:"")||"").includes(t)||!!e.fields.map(e=>e.value.includes(t)||e.name.includes(t)).includes(!0))))).includes(!0)}let un;const hn=N.removeDa;var pn=new class{constructor(){this.enabled=!1}enable(){this.enabled||(this.enabled=!0,un=un||function(){let e=BDModules.get(e=>e.standardSidebarView)[0];if(!e)return null;let t=hn(e.standardSidebarView),n=[];return n.push(`#app-mount .${t} .payment-info .${hn(BDModules.get(e=>e.description&&"string"==typeof e.description&&e.description.includes("formText"))[0].description)}`),n.push(`#app-mount .${t} .${hn(BDModules.get(e=>e.paymentSourceRow)[0].paymentSourceRow)} .${hn(BDModules.get(e=>e.subText&&e.descriptionWrapper)[0].subText)}`),n.push(`#app-mount .${t} .${hn(BDModules.get(e=>e.userSettingsAccount)[0].userSettingsAccount)} div:nth-child(2)>div:nth-child(2)>.${hn(BDModules.get(e=>e.viewBody)[0].viewBody)}`),n}(),un||console.error(new Error("Couldn't find selectors to blur personnal informations.")),B.addStyle("blurPrivate",`\n${un[0]}, ${un[1]}, ${un[2]} {\n transition: all 150ms cubic-bezier(.55,.085,.68,.53);\n filter: blur(4px);\n opacity: .8;\n}\n\n${un[0]}:hover, ${un[1]}:hover, ${un[2]}:hover {\n transition: all 150ms cubic-bezier(.55,.09,.68,.53);\n filter: none;\n opacity: 1;\n}`))}disable(){this.enabled&&(this.enabled=!1,B.removeStyle("blurPrivate"))}},mn=new class{constructor(){this.sideBarOnClick=this.sideBarOnClick.bind(this),this.onChange=this.onChange.bind(this),this.updateSettings=this.updateSettings.bind(this),this.sidebar=new he(this.sideBarOnClick),this.showOriginal=this.showOriginal.bind(this)}get root(){const e=B.query("#bd-settingspane-container");return e||(this.injectRoot()?this.root:null)}injectRoot(){let[e,t]=[BDModules.get(e=>e.layer&&e.animating)[0].layer.split(" ")[0],BDModules.get(e=>e.standardSidebarView)[0]];const n=B.query("."+e+" ."+t.standardSidebarView.split(" ")[0]+", ."+e+" .ui-standard-sidebar-view");if(!n)return!1;const s=B.createElement(`<div id="bd-settingspane-container" class="${t.contentRegion} content-region">`);return n.append(s),N.onRemoved(s,()=>{M.reactDom.unmountComponentAtNode(s)}),!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 lightcordSettings(){const e=this.getSettings("lightcord");return[...new Set(e.map(e=>e.category))].map(t=>({title:t,settings:e.filter(e=>e.category==t)}))}get PresenceSettings(){return this.getSettings("status")}get MsgLogSettings(){return this.getSettings("msglog")}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(B.query(".contentRegion-3nDuYy, .content-region").style.display="none",this.root.style.display="",e){case"core":this.renderCoreSettings();break;case"customcss":this.renderCustomCssEditor();break;case"plugins":case"themes":this.renderAddonPane(e);break;case"lightcord":this.renderLightcordSettings();break;case"status":this.renderPresenceSettings();break;case"accountinfo":this.renderAccountInfos()}}onClick(){}onChange(e,t){this.updateSettings(e,t)}updateSettings(e,t){if(u[e]=t,"bda-gs-2"==e&&(t?B.addClass(document.body,"bd-minimal"):B.removeClass(document.body,"bd-minimal")),"bda-gs-3"==e&&(t?B.addClass(document.body,"bd-minimal-chan"):B.removeClass(document.body,"bd-minimal-chan")),"bda-gs-1"==e&&(t?Ne.addButton():Ne.removeButton()),"bda-gs-4"==e&&(t?Pe.start():Pe.stop()),"bda-gs-5"==e&&(t?B.addClass(B.query("#app-mount"),"bda-dark"):B.removeClass(B.query("#app-mount"),"bda-dark")),t&&"bda-gs-6"==e&&me.inject24Hour(),"bda-gs-7"==e&&(t?pe.injectColoredText():pe.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&&(N.setWindowPreference("transparent",t),t?N.setWindowPreference("backgroundColor",null):N.setWindowPreference("backgroundColor","#2f3136")),"bda-gs-8"==e&&(t?Ae.startDebugListener():Ae.stopDebugListener()),"fork-dm-1"==e&&(t?Ae.startCopySelector():Ae.stopCopySelector()),"reactDevTools"===e&&(t?Ee.start():Ee.stop()),"lightcord-1"===e&&(window.Lightcord.Settings.devMode=!!t),"lightcord-2"===e&&(window.Lightcord.Settings.callRingingBeat=!!t),"lightcord-presence-1"===e)if(t){ft.enable();const e=BDModules.get(e=>e.default&&"object"==typeof e.default&&"showCurrentGame"in e.default)[0];e&&!e.default.showCurrentGame&&BDModules.get(e=>e.default&&e.default.updateRemoteSettings)[0].default.updateRemoteSettings({showCurrentGame:!0})}else ft.disable();"lightcord-3"===e&&(t?St.remote.getCurrentWindow().setAlwaysOnTop(!0):St.remote.getCurrentWindow().setAlwaysOnTop(!1)),"lightcord-4"===e&&(t?cn.enable():cn.disable()),"lightcord-6"===e&&(t?pn.enable():pn.disable()),this.saveSettings()}async initializeSettings(){u.reactDevTools&&Ee.start(),u["bda-gs-2"]&&B.addClass(document.body,"bd-minimal"),u["bda-gs-3"]&&B.addClass(document.body,"bd-minimal-chan"),u["bda-gs-1"]&&Ne.addButton(),u["bda-gs-4"]&&Pe.start(),u["bda-gs-5"]&&B.addClass(B.query("#app-mount"),"bda-dark"),u["bda-gs-6"]&&me.inject24Hour(),u["bda-gs-7"]&&pe.injectColoredText(),u["fork-ps-4"]&&$e.start(),u["lightcord-1"]&&(window.Lightcord.Settings.devMode=!0),u["lightcord-2"]&&(window.Lightcord.Settings.callRingingBeat=!0),u["lightcord-presence-1"]&&ft.enable(),u["lightcord-3"]&&St.remote.getCurrentWindow().setAlwaysOnTop(!0),u["lightcord-4"]&&cn.enable(),u["lightcord-6"]&&pn.enable(),u["fork-ps-5"]&&(q.watchContent("plugin"),q.watchContent("theme")),u["bda-gs-8"]&&Ae.startDebugListener(),u["fork-dm-1"]&&Ae.startCopySelector(),this.saveSettings()}saveSettings(){Y.setSettingGroup("settings",u),Y.setSettingGroup("rpc",h)}loadSettings(){Object.assign(u,Y.getSettingGroup("settings")),Object.assign(h,Y.getSettingGroup("rpc"))}showOriginal(){M.reactDom.unmountComponentAtNode(this.root),this.root.style.display="none",B.query("."+BDModules.get(e=>e.contentRegion)[0].contentRegion.split(" ")[0]+", .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 M.react.createElement(De,{contentColumn:!0,fade:!0,dark:!0},M.react.createElement(Ie,{key:"cspanel",onChange:this.onChange,sections:this.coreSettings}),M.react.createElement(we,{key:"tools"}))}get lightcordComponent(){return M.react.createElement(De,{contentColumn:!0,fade:!0,dark:!0},M.react.createElement(Ie,{key:"lspannel",onChange:this.onChange,sections:this.lightcordSettings}),M.react.createElement(we,{key:"tools"}))}get PresenceComponent(){return M.react.createElement(De,{contentColumn:!0,fade:!0,dark:!0},M.react.createElement(Dt,{key:"lppannel",onChange:this.onChange,settings:this.PresenceSettings}),M.react.createElement(we,{key:"tools"}))}get AccountInfosComponent(){return M.react.createElement(De,{contentColumn:!0,fade:!0,dark:!0},M.react.createElement(Kt,{key:"lapannel"}),M.react.createElement(we,{key:"tools"}))}get customCssComponent(){return M.react.createElement(De,{contentColumn:!0,fade:!0,dark:!0},M.react.createElement(We,{key:"csseditor"}),M.react.createElement(we,{key:"tools"}))}renderCoreSettings(){const e=this.root;if(!e)return N.err("SettingsPanel","FAILED TO LOCATE ROOT: .layer-3QrUeG .standardSidebarView-3F1I7i");M.reactDom.render(this.coreComponent,e)}renderLightcordSettings(){const e=this.root;if(!e)return N.err("SettingsPanel","FAILED TO LOCATE ROOT: .layer-3QrUeG .standardSidebarView-3F1I7i");M.reactDom.render(this.lightcordComponent,e)}renderPresenceSettings(){const e=this.root;if(!e)return N.err("SettingsPanel","FAILED TO LOCATE ROOT: .layer-3QrUeG .standardSidebarView-3F1I7i");M.reactDom.render(this.PresenceComponent,e)}renderAccountInfos(){const e=this.root;if(!e)return N.err("SettingsPanel","FAILED TO LOCATE ROOT: .layer-3QrUeG .standardSidebarView-3F1I7i");M.reactDom.render(this.AccountInfosComponent,e)}renderCustomCssEditor(){const e=this.root;if(!e)return N.err("SettingsPanel","FAILED TO LOCATE ROOT: .layer-3QrUeG .standardSidebarView-3F1I7i");M.reactDom.render(this.customCssComponent,e)}renderAddonPane(e){if(!this.root)return N.err("SettingsPanel","FAILED TO LOCATE ROOT: .layer-3QrUeG .standardSidebarView-3F1I7i");class t extends M.react.Component{constructor(e){super(e),this.prefix=this.props.type.replace("s",""),this.onChange=this.onChange.bind(this)}componentDidMount(){L.on(`${this.prefix}-reloaded`,this.onChange),L.on(`${this.prefix}-loaded`,this.onChange),L.on(`${this.prefix}-unloaded`,this.onChange)}componentWillUnmount(){L.off(`${this.prefix}-reloaded`,this.onChange),L.off(`${this.prefix}-loaded`,this.onChange),L.off(`${this.prefix}-unloaded`,this.onChange)}onChange(){this.props.onChange(this.props.type)}render(){return this.props.children}}const n=t.prototype.render;Object.defineProperty(t.prototype,"render",{enumerable:!1,configurable:!1,set:function(){console.warn("Addon policy for plugins #5 https://github.com/rauenzi/BetterDiscordApp/wiki/Addon-Policies#plugins")},get:()=>n});const s="plugins"===e?Object.values(v):Object.values(b);return M.reactDom.render(M.react.createElement(t,{type:e,onChange:this.sideBarOnClick},M.react.createElement(ut,{type:e,list:s})),this.root)}};class gn extends M.reactComponent{render(){return M.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"},M.react.createElement("metadata",null),M.react.createElement("defs",null,M.react.createElement("filter",{id:"shadow1"},M.react.createElement("feDropShadow",{dx:"20",dy:"0",stdDeviation:"20","flood-color":"rgba(0,0,0,0.35)"})),M.react.createElement("filter",{id:"shadow2"},M.react.createElement("feDropShadow",{dx:"15",dy:"0",stdDeviation:"20","flood-color":"rgba(255,255,255,0.15)"})),M.react.createElement("filter",{id:"shadow3"},M.react.createElement("feDropShadow",{dx:"10",dy:"0",stdDeviation:"20","flood-color":"rgba(0,0,0,0.35)"}))),M.react.createElement("g",null,M.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"}),M.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"}),M.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 fn(){return(fn=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e}).apply(this,arguments)}class bn extends React.Component{render(){const e=this.props;return React.createElement("svg",fn({viewBox:"0 0 168 168.69"},e,{height:"100%",width:e.size}),React.createElement("defs",null,React.createElement("linearGradient",{id:"prefix__a",x1:66.7,y1:-487.7,x2:66.7,y2:-508.73,gradientTransform:"matrix(1 0 0 -1 0 -408)",gradientUnits:"userSpaceOnUse"},React.createElement("stop",{offset:0,stopColor:"#e30613"}),React.createElement("stop",{offset:1,stopColor:"#731a14"})),React.createElement("linearGradient",{id:"prefix__b",x1:101.7,y1:-487.7,x2:101.7,y2:-508.73,gradientTransform:"matrix(1 0 0 -1 0 -408)",gradientUnits:"userSpaceOnUse"},React.createElement("stop",{offset:0,stopColor:"#e20613"}),React.createElement("stop",{offset:1,stopColor:"#731a13"})),React.createElement("linearGradient",{id:"prefix__c",x1:84,y1:-408,x2:84,y2:-576.69,gradientTransform:"matrix(1 0 0 -1 0 -408)",gradientUnits:"userSpaceOnUse"},React.createElement("stop",{offset:0,stopColor:"#e30613"}),React.createElement("stop",{offset:1,stopColor:"#731a13"}))),React.createElement("path",{fill:"#fff",d:"M14.9 35.3h139.2V133H14.9z"}),React.createElement("path",{d:"M66.7 79.7c-5.4 0-9.8 4.7-9.8 10.5s4.4 10.5 9.8 10.5 9.8-4.7 9.8-10.5-4.4-10.5-9.8-10.5z",fill:"url(#prefix__a)"}),React.createElement("path",{d:"M101.7 79.7c-5.4 0-9.8 4.7-9.8 10.5s4.4 10.5 9.8 10.5 9.8-4.7 9.8-10.5-4.4-10.5-9.8-10.5z",fill:"url(#prefix__b)"}),React.createElement("path",{d:"M0 0v168l168 .69V0zm111.3 124.1s-3.4-4.1-6.3-7.7c12.6-3.5 17.4-11.3 17.4-11.3a52.52 52.52 0 01-11.1 5.6 68.63 68.63 0 01-38.9 4 70.12 70.12 0 01-14.1-4.1 48.88 48.88 0 01-7.1-3.3c-.3-.2-.6-.3-.9-.5a.76.76 0 00-.4-.2c-1.7-1-2.6-1.6-2.6-1.6s4.6 7.6 16.8 11.2c-2.9 3.6-6.4 7.9-6.4 7.9-21.2-.6-29.3-14.5-29.3-14.5 0-30.6 13.8-55.4 13.8-55.4 13.8-10.3 26.9-10 26.9-10l1 1.1C52.8 50.3 45 57.9 45 57.9a56.2 56.2 0 015.7-2.7 72.19 72.19 0 0121.8-6 8.75 8.75 0 011.6-.2 89.1 89.1 0 0119.4-.2 78.45 78.45 0 0128.9 9.1s-7.5-7.2-23.9-12.1l1.3-1.5s13.1-.3 26.9 10c0 0 13.8 24.8 13.8 55.4.1-.1-8 13.8-29.2 14.4z",fill:"url(#prefix__c)"}))}}var vn=n(3),yn=n.n(vn),En=n(4);const Cn={},wn={};var Sn=new class{constructor(){}patch(e,t){process.nextTick(()=>{!function(e,t){if(!document.getElementById(t))return;if(!e.url.startsWith("https://cdn.discordapp.com/"))return document.getElementById(t).remove();if(!e.filename.endsWith(".plugin.js")&&!e.filename.endsWith(".theme.css"))return document.getElementById(t).remove();let n=(n,s)=>{if(Cn[n]){const s=Cn[n];Mn(t,s,e.filename)}else yn()("https://cdn.jsdelivr.net/gh/Lightcord/filehashes@master/hashes/"+n,{headers:{"User-Agent":St.remote.getCurrentWebContents().userAgent}}).then(async r=>{if(200!==r.status)return function(e,t,n){t=t.toString("utf8").split(/[^\w\d]+/g);let s=!1;for(let e of t){for(let t of["token","email","phone","MFA","2fa","process","child_process","localStorage","eval","getGlobal","BrowserWindow"])if(e.toLowerCase().includes(t.toLowerCase())){s="token stealer/virus";break}if(s)break}if(!s){const e=t.replace(/\/\*[\s\S]*?\*\/|([^\\:]|^)\/\/.*$/gm,"").trim();if(/var [\w\d_$]+=\["/gi.test(e)&&(s="obfuscation/hidden code"),!s){const t=[/_0x\w{4}\('0x[\dabcdef]+'\)/g,/_0x\w{4}\('0x[\dabcdef]+'[, ]+'[^']{4}'\)/g,/\w+\('0x[\dabcdef]+'\)/g,/\w+\('0x[\dabcdef]+'[, ]+'[^']{4}'\)/g];for(let n of t){if(s)break;s=!!n.test(e)&&"obfuscation/hidden code"}}}if(!s)return;Cn[e]={suspect:!0,name:xn[e].split("/").pop(),type:xn[e].endsWith(".js")?"Plugin":"Theme",harm:s},console.log(`Found potentially dangerous ${Cn[e].type.toLowerCase()}: ${Cn[e].name}`),Mn(n,Cn[e],Cn[e].name)}(n,s,t);const o=await r.json();Cn[n]=o,Mn(t,o,e.filename)}).catch(()=>{})};if(wn[e.url])return n(wn[e.url]);yn()(e.url,{headers:{"User-Agent":St.remote.getCurrentWebContents().userAgent}}).then(t=>{if(200!==t.status)throw new Error("File doesn't exist.");const s=En.createHash("sha256");let r=Buffer.alloc(0);t.body.on("data",e=>{r=Buffer.concat([r,e]),s.update(e)}),t.body.on("end",()=>{const t=s.digest("hex");wn[e.url]=t,xn[t]=e.url,n(t,r)})}).catch(()=>{})}(e,t)})}start(){}};const xn={};let Dn=BDModules.get(e=>e.flowerStarContainer)[0],kn=BDModules.get(e=>e.childContainer)[0];function Mn(e,t,n){const s=document.getElementById(e);if(s&&!(s.childNodes.length>0))if(Dn||(Dn=BDModules.get(e=>e.flowerStarContainer)[0]),kn||(kn=BDModules.get(e=>e.childContainer)[0]),console.log(t),t.suspect){try{s.parentNode.style.borderColor="rgb(240, 71, 71)";let e=s=>{for(let r of s.children)"A"===r.tagName?r.addEventListener("click",e=>{e.preventDefault(),e.stopImmediatePropagation(),N.showConfirmationModal("Are you sure you want to download this ?","The "+t.type.toLowerCase()+" **"+n+"** might be dangerous **("+t.harm+")**. \n\n**We don't recommand to download it**. However, you can still do it below.",{confirmText:"Download Anyway",cancelText:"Don't !",danger:!0,onCancel:()=>{},onConfirm:()=>{St.remote.shell.openExternal(r.href)}})}):["div"].includes(r.tagName.toLowerCase())&&e(r)};e(s.parentNode)}catch(e){console.error(e)}M.reactDom.render(M.react.createElement(ue,{text:t.type+" "+t.name+" is potentially dangerous."},M.react.createElement("div",{className:Dn.flowerStarContainer,style:{width:"16px",height:"16px"}},M.react.createElement("svg",{className:BDModules.get(e=>e.svg)[0].svg,"aria-hidden":"false",width:"16px",height:"16px",viewBox:"0 0 40 32"},M.react.createElement("rect",{x:"0",y:"0",width:"32",height:"32",mask:"url(#svg-mask-avatar-status-round-32)",fill:"#f04747",mask:"url(#svg-mask-status-dnd)",className:BDModules.get(e=>e.pointerEvents)[0].pointerEvents})))),s)}else t.official?(s.parentNode.style.borderColor="#4087ed",M.reactDom.render(M.react.createElement(ue,{text:t.type+" "+t.name+" was made by the developers of Lightcord.",style:"brand"},M.react.createElement("div",{className:Dn.flowerStarContainer,style:{width:"16px",height:"16px"}},M.react.createElement("svg",{className:Dn.flowerStar,"aria-hidden":"false",width:"16px",height:"16px",viewBox:"0 0 16 15.2",stroke:"#36393f",style:{color:"#4087ed"}},M.react.createElement("path",{fill:"currentColor","fill-rule":"evenodd",d:"m16 7.6c0 .79-1.28 1.38-1.52 2.09s.44 2 0 2.59-1.84.35-2.46.8-.79 1.84-1.54 2.09-1.67-.8-2.47-.8-1.75 1-2.47.8-.92-1.64-1.54-2.09-2-.18-2.46-.8.23-1.84 0-2.59-1.54-1.3-1.54-2.09 1.28-1.38 1.52-2.09-.44-2 0-2.59 1.85-.35 2.48-.8.78-1.84 1.53-2.12 1.67.83 2.47.83 1.75-1 2.47-.8.91 1.64 1.53 2.09 2 .18 2.46.8-.23 1.84 0 2.59 1.54 1.3 1.54 2.09z"})),M.react.createElement("div",{className:kn.childContainer},M.react.createElement("svg",{"aria-hidden":"false",width:"16px",height:"16px",viewBox:"0 0 16 15.2"},M.react.createElement("path",{fill:"#ffffff",d:"M10.7,5.28a2.9,2.9,0,0,0-2.11.86.11.11,0,0,0,0,.16l1.05.94a.11.11,0,0,0,.15,0,1.27,1.27,0,0,1,.9-.33c.65,0,.65.73.65.73a.64.64,0,0,1-.65.65,1.73,1.73,0,0,1-1.18-.54c-.31-.26-.36-.32-.73-.66S7.06,5.28,5.65,5.28A2.26,2.26,0,0,0,3.37,7.56,2.59,2.59,0,0,0,3.82,9a2.18,2.18,0,0,0,1.83.89,2.94,2.94,0,0,0,2.1-.81.11.11,0,0,0,0-.16L6.74,8A.11.11,0,0,0,6.6,8a1.58,1.58,0,0,1-.94.29h0A.71.71,0,0,1,5,7.56H5a.63.63,0,0,1,.65-.64c.71,0,1.42.75,1.94,1.27.75.76,1.66,1.79,3.11,1.74A2.28,2.28,0,0,0,13,7.64a2.59,2.59,0,0,0-.45-1.47A2.14,2.14,0,0,0,10.7,5.28Z"}))))),s)):(s.parentNode.style.borderColor="#4087ed",M.reactDom.render(M.react.createElement(ue,{text:t.type+" "+t.name+" is certified by Lightcord."},M.react.createElement("div",{className:Dn.flowerStarContainer,style:{width:"16px",height:"16px"}},M.react.createElement("svg",{className:Dn.flowerStar,"aria-hidden":"false",width:"16px",height:"16px",viewBox:"0 0 16 15.2"},M.react.createElement("path",{fill:"#4f545c","fill-rule":"evenodd",d:"m16 7.6c0 .79-1.28 1.38-1.52 2.09s.44 2 0 2.59-1.84.35-2.46.8-.79 1.84-1.54 2.09-1.67-.8-2.47-.8-1.75 1-2.47.8-.92-1.64-1.54-2.09-2-.18-2.46-.8.23-1.84 0-2.59-1.54-1.3-1.54-2.09 1.28-1.38 1.52-2.09-.44-2 0-2.59 1.85-.35 2.48-.8.78-1.84 1.53-2.12 1.67.83 2.47.83 1.75-1 2.47-.8.91 1.64 1.53 2.09 2 .18 2.46.8-.23 1.84 0 2.59 1.54 1.3 1.54 2.09z"})),M.react.createElement("div",{className:kn.childContainer},M.react.createElement("svg",{"aria-hidden":"false",width:"16px",height:"16px",viewBox:"0 0 16 15.2"},M.react.createElement("path",{fill:"#ffffff",d:"M7.4,11.17,4,8.62,5,7.26l2,1.53L10.64,4l1.36,1Z"}))))),s))}function Bn(){return(Bn=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e}).apply(this,arguments)}class Nn extends React.Component{render(){const e=this.props;return React.createElement("svg",Bn({viewBox:"0 0 31.3 29.5"},e.svg,{height:"100%"}),React.createElement("path",{d:"M22.8 1s12 8.2 7.4 19.7S16.6 29 20 25.6s-4-5.6-8.7-10L22.8 1",fill:"rgba(227,6,19,.6)"}),React.createElement("path",{d:"M22.1 12.3c-2.5 3.2-6.1 4.8-8.9 4.3L3.6 28.8c-.7.9-1.9 1-2.8.3-.9-.7-1-1.9-.4-2.8L10 14.1c-1.3-2.5-.6-6.4 2-9.7 3.2-4 8-5.5 10.8-3.4s2.4 7.2-.7 11.3z",fill:"#e30613"}))}}function Pn(){return(Pn=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)}let Ln=BDModules.get(e=>e.default&&e.default.open&&e.default.fetchMutualFriends)[0];class $n extends React.Component{render(){const e=this.props;return delete e.href.target,console.log(e),React.createElement(e.Anchor,Pn({href:"/users/"+e.user.id},e.href,{onClick:t=>{t.preventDefault(),Ln||(Ln=BDModules.get(e=>e.default&&e.default.open&&e.default.fetchMutualFriends)[0]),Ln.default.open(e.user.id)}}),React.createElement("svg",Pn({viewBox:"0 0 31.3 29.5"},e.svg,{height:"100%"}),React.createElement("path",{d:"M22.8 1s12 8.2 7.4 19.7S16.6 29 20 25.6s-4-5.6-8.7-10L22.8 1",fill:"rgba(227,6,19,.6)"}),React.createElement("path",{d:"M22.1 12.3c-2.5 3.2-6.1 4.8-8.9 4.3L3.6 28.8c-.7.9-1.9 1-2.8.3-.9-.7-1-1.9-.4-2.8L10 14.1c-1.3-2.5-.6-6.4 2-9.7 3.2-4 8-5.5 10.8-3.4s2.4 7.2-.7 11.3z",fill:"#e30613"})))}}function An(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"==e?t:3&t|8).toString(16)}))}const Tn={};let On=[];var jn=new class{constructor(){this._cache={badges:{}}}get cache(){return this._cache}set cache(e){return"object"!=typeof e||"object"!=typeof this._cache?this._cache=e:this._cache=Object.assign(this._cache,e)}async delete(){return BdApi.showToast("Deleting all infos about you on Lightcord Servers...",{type:"warn"}),Rn(_n.delete,"delete").then(async e=>{if(200!==e.status)throw BdApi.showToast("An error occured, couldn't delete informations. See console for more infos",{type:"error"}),new Error(`Couldn't delete all informations: ${e.status+" "+e.statusText+" "+await e.text()}`);return console.info("Succesfully deleted informations."),BdApi.showToast("Succesfully deleted informations",{type:"success"}),window.Lightcord.Api.Authorization=null,e.json()}).catch(e=>{throw BdApi.showToast("An error occured, couldn't delete informations. See console for more infos",{type:"error"}),new Error(`Couldn't delete all informations: ${e.stack}`)})}async getBadges(e){if(this.cache.badges[e])return this.cache.badges[e];if(Tn[e])return Tn[e];let t;const n=new Promise(e=>t=e);Tn[e]=n;const s=[];for(let t of In.badges)t.defaultUsers.includes(e)&&s.push(t);const r=await new Promise(t=>{On.push([e,t]),setImmediate(()=>{let e=On;0!==e.length&&(On=[],Rn(_n.badges,"POST",JSON.stringify(e.map(e=>e[0]))).then(async t=>{200!==t.status&&e.forEach(e=>{e[1]([])});const n=await t.json();console.log(n);for(let t of n){e.find(e=>e[0]===t.user_id)[1](t.badges)}}).catch(t=>{console.error(t),e.forEach(e=>{e[1]([])})}))})});for(let e of r)In.badges.find(t=>t.id===e)&&(s.find(t=>t.id===e)||s.push(In.badges.find(t=>t.id===e)));return this.cache={badges:Object.assign(this.cache.badges,{[e]:s})},setTimeout(()=>{delete this.cache.badges[e]},6e5),t(s),delete Tn[e],s}};const Rn=function(e,t,n){return console.log(`Sending request on ${e} with method ${t} and body`,n),yn()(`${In.SERVER_URL}/api/v1${e}`,{method:t,headers:{CLIENT:"Lightcord",Authorization:window.Lightcord.Api.Authorization||"None::Anonymous"},...n?{body:n}:{}})},In={SERVER_URL:"http://127.0.0.1",badges:[{name:"Lightcord User",id:"01cfa7b0-7cdb-4b0e-8258-9c6a78235c93",defaultUsers:[],scopes:["user"],component:$n},{name:"Lightcord Bug Hunter",id:"f04698f5-816b-41e3-bd01-92291193d7a5",defaultUsers:[],scopes:[],component:Nn,href:"https://github.com/lightcord/lightcord/wiki/badges/bug_hunter"}]},_n={badges:"/users/badges",delete:"/delete"},Fn={EmojiRegex:/<a?\.(\w+)\.(\d+)>/g};let Wn=BDModules.get(e=>e.CustomEmoji)[0],zn=BDModules.get(e=>e.default&&e.default.getCustomEmojiById)[0],Un=BDModules.get(e=>e.default&&"Autocomplete"===e.default.displayName)[0],Hn=BDModules.get(e=>e.getAutocompleteOptions)[0],qn=BDModules.get(e=>e.default&&e.default.queryEmojiResults)[0],Gn=BDModules.get(e=>e.default&&e.default.Messages&&e.default.Messages.EMOJI_MATCHING)[0],Vn=BDModules.get(e=>e.default&&e.default.getGuild&&e.default.getGuilds&&!e.default.isFetching)[0],Jn=BDModules.get(e=>e.default&&e.default.getDisambiguatedEmojiContext);new class{constructor(){this.init()}async init(){if(Un||(Un=await window.Lightcord.Api.ensureExported(e=>e.default&&"Autocomplete"===e.default.displayName)),Hn||(Hn=await window.Lightcord.Api.ensureExported(e=>e.getAutocompleteOptions)),qn||(qn=await window.Lightcord.Api.ensureExported(e=>e.default&&e.default.queryEmojiResults)),Gn||(Gn=await window.Lightcord.Api.ensureExported(e=>e.default&&e.default.Messages&&e.default.Messages.EMOJI_MATCHING)),Vn||(Vn=await window.Lightcord.Api.ensureExported(e=>e.default&&e.default.getGuild&&e.default.getGuilds&&!e.default.isFetching)),Jn||(Jn=await window.Lightcord.Api.ensureExported(e=>e.default&&e.default.getDisambiguatedEmojiContext)),Un&&Hn&&qn&&Gn&&Vn&&Jn){console.log("Patching getAutocompleteOptions of AutoCompletionTemplates",Hn);const e=Hn.getAutocompleteOptions;Hn.getAutocompleteOptions=function(t,n,s,r,o){const a=e.call(this,...arguments);return a.LIGHTCORD_EMOJIS={matches(e,t){let n=t.length>1&&"."===e;return ts(n),n},queryResults:e=>qn.default.queryEmojiResults(e,t),renderResults:(e,t,n,s,r)=>Zn(e,t,r.emojis,n,s,Gn.default.Messages.EMOJI_MATCHING,Gn.default.Messages.EMOJI,Un.default.Emoji,(function(e){return{emoji:e,key:e.id||e.uniqueName||e.name,sentinel:".",guild:null!=e.guildId?Vn.default.getGuild(e.guildId):null}}),(function(e){return"."+e+"."})),getPlainText(e,t){var n=t.emojis;if(null==n||null==n[e])return"";var s=n[e],r=s.animated?"a":"";return s.managed||null==s.id?"."+s.name+".":"<"+r+"."+(s.originalName||s.name)+"."+s.id+">"},getRawText(e,t){var n=t.emojis;if(null==n||null==n[e])return"";var s=n[e],r=s.animated?"a":"";return s.managed||null==s.id?"."+s.name+".":"<"+r+"."+(s.originalName||s.name)+"."+s.id+">"}},a}}else console.error(new Error("Couldn't start autocompletion of Lightcord's emojis."));for(;!M.MessageComponent;)await new Promise(e=>setTimeout(e,100));this.cancelEmojiRender||(this.cancelEmoteRender=N.monkeyPatch(M.MessageComponent,"default",{before:e=>{if(!N.getNestedProp(e.methodArguments[0],"childrenMessageContent.props.message"))return;const t=N.getNestedProp(e.methodArguments[0],"childrenMessageContent.props.content");if(!t||!t.length)return;let n=[];const s=[];for(let e of t){if("string"!=typeof e){s.push(e);continue}let r,o=!1;do{if(r=Fn.EmojiRegex.exec(e),r){o=!0,zn||(zn=BDModules.get(e=>e.default&&e.default.getCustomEmojiById)[0]);const e=zn.default.getCustomEmojiById(r[2]);e?n.push({animated:e.animated,name:e.name,id:e.id,raw:r[0]}):n.push({animated:r[0].startsWith("<a"),name:r[1],id:r[2],raw:r[0]})}}while(r);if(o){const r=e.split(" ").map((e,s,r)=>{if(!e)return"";const o=n.find(t=>t.raw==e);return o?(Wn||(Wn=BDModules.get(e=>e.CustomEmoji)[0]),React.createElement(Wn.CustomEmoji,{emoji:{name:`.${o.name}.`,emojiId:o.id,animated:o.animated,jumboable:1===r.length&&1===t.length}})):e}).reduce((e,t)=>0===e.length?[t]:"string"==typeof t?"string"==typeof e[e.length-1]?(e[e.length-1]+=` ${t}`,e):(e.push(" "+t),e):(e.push(" ",t),e),[]);s.push(...r)}else s.push(e)}for(;e.methodArguments[0].childrenMessageContent.props.content[0];)e.methodArguments[0].childrenMessageContent.props.content.shift();for(;s[0];)e.methodArguments[0].childrenMessageContent.props.content.push(s.shift())}}))}disable(){this.cancelEmoteRender&&(this.cancelEmoteRender(),this.cancelEmoteRender=null)}};function Zn(e,t,n,s,r,o,a,i,l,c){if(null==n||0===n.length)return null;var d=n.map((function(e,n){return React.createElement(i,Object.assign({onClick:r,onHover:s,selected:t===n,index:n},l(e,n)))}));return[Yn(o,a,e,c),d]}function Yn(e,t,n,s){var r=n.length>0?e.format({prefix:s(n)}):t;return Array.isArray(r)?r.unshift(React.createElement("strong",{},"[Lightcord] ")):r="[LIGHTCORD] "+r,React.createElement(Un.default.Title,{title:r},r)}Yn.displayName="renderHeader";let Kn=BDModules.get(e=>e.default&&e.default.isEmojiDisabled)[0],Qn=Kn&&Kn.default.isEmojiDisabled,Xn=!1,es=!1;function ts(e){Xn=e,es||(Kn||(Kn=BDModules.get(e=>e.default&&e.default.isEmojiDisabled)[0]),Kn&&(Qn||(Qn=Kn.default.isEmojiDisabled),es=!0,Kn.default.isEmojiDisabled=function(e){return Xn?!(!e.surrogates&&!e.diversity):Qn.call(this,...arguments)}))}function ns(){}ns.prototype.setConfig=function(e){Object.assign(f,e)},ns.prototype.init=async function(){if(!Array.prototype.flat)return void N.alert("Not Supported","BetterDiscord v"+i+" does not support this old version ("+o+") of Discord. Please update your Discord installation before proceeding.");if(f.version<a)return void N.alert("Not Supported","BetterDiscord v"+f.version+" (your version) is not supported by the latest js ("+i+").<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 N.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 N.alert("Not Supported","BandagedBD does not work with Powercord. Please uninstall one of them.");const e=f.updater?f.updater.LatestVersion:f.latestVersion;e>f.version&&N.showConfirmationModal("Update Available",[`There is an update available for BandagedBD's Injector (${e}).`,"You can either update and restart now, or later."],{confirmText:"Update Now",cancelText:"Maybe Later",onConfirm:async()=>{const e=()=>{N.alert("Could Not Update","Unable to update automatically, please download the installer and reinstall normally.<br /><br /><a href='https://github.com/rauenzi/BetterDiscordApp/releases/latest' target='_blank'>Download Installer</a>")};try{if(!await this.updateInjector())return e();const t=n(0).remote.app;t.relaunch(),t.exit()}catch(t){e()}}}),N.log("Startup","Initializing Settings"),this.initSettings(),await this.checkForGuilds(),M.initialize(),N.log("Startup","Updating Settings"),mn.initializeSettings(),N.log("Startup","Loading Plugins"),await A.loadPlugins(),N.log("Startup","Loading Themes"),await O.loadThemes(),B.addStyle("customcss",atob(Y.getBDData("bdcustomcss"))),window.addEventListener("beforeunload",(function(){u["bda-dc-0"]&&document.querySelector(".btn.btn-disconnect").click()})),Sn.start(),N.log("Startup","Removing Loading Icon"),document.getElementsByClassName("bd-loaderv2").length&&document.getElementsByClassName("bd-loaderv2")[0].remove(),N.log("Startup","Initializing Main Observer"),this.initObserver(),u["fork-ps-1"]&&(N.log("Startup","Collecting Startup Errors"),N.showContentErrors({plugins:m,themes:g}));const t=Y.getBDData("version");i>t&&(l&&this.showChangelogModal(l),Y.setBDData("version",i));if(N.suppressErrors(this.patchSocial.bind(this),"BD Social Patch")(),N.suppressErrors(this.patchGuildPills.bind(this),"BD Guild Pills Patch")(),N.suppressErrors(this.patchGuildListItems.bind(this),"BD Guild List Items Patch")(),N.suppressErrors(this.patchGuildSeparator.bind(this),"BD Guild Separator Patch")(),N.suppressErrors(this.patchMessageHeader.bind(this),"BD Badge Chat Patch")(),N.suppressErrors(this.patchMemberList.bind(this),"BD Badge Member List Patch")(),N.suppressErrors(this.patchAttachment.bind(this),"LC Plugin Certifier Patch")(),f.haveInstalledDefault){let e=N.alert("First Installation","As it is the first time you install Lightcord, We added two default themes and one default plugin in your plugin/theme folder. Check it in the Plugin/Theme settings.");await new Promise(t=>{e.onClose(t)})}const s=document.querySelector("#app-mount > div.typeWindows-1za-n7.withFrame-haYltI.titleBar-AC4pGV.horizontalReverse-3tRjY7.flex-1O1GKY.directionRowReverse-m8IjIq.justifyStart-2NDFzi.alignStretch-DpGPf3.da-typeWindows.da-withFrame.da-titleBar.da-horizontalReverse.da-flex.da-directionRowReverse.da-justifyStart.da-alignStretch > div.wordmarkWindows-1v0lYD.wordmark-2iDDfm.da-wordmarkWindows.da-wordmark");s&&(s.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" height="10" width="70" viewBox="0 0 72.54 10" style="margin-left: -5px, margin-top: 10px">\n <path fill="currentColor" d="M44.81,9.67V6.33c0-1.21,2.13-1.49,2.78-.28l2-.81A3.53,3.53,0,0,0,46.2,3c-1.92,0-3.81,1.13-3.81,3.33V9.67c0,2.21,1.89,3.33,3.77,3.33a3.87,3.87,0,0,0,3.45-2.18l-2.12-1C47,11.17,44.81,10.85,44.81,9.67ZM10.68,12.89h2.41V3.17H10.68ZM71.76,3.14H68.19V7.23L70.57,9.4v-4h1.27c.81,0,1.21.41,1.21,1v3c0,.63-.38,1.05-1.21,1.05H68.18v2.31h3.57c1.92,0,3.72-1,3.72-3.2V6.39C75.48,4.13,73.68,3.14,71.76,3.14ZM54.22,3c-2,0-4,1.1-4,3.34V9.66c0,2.23,2,3.34,4,3.34s3.95-1.11,3.95-3.34V6.34C58.19,4.11,56.2,3,54.22,3Zm1.55,6.66c0,.7-.78,1.06-1.54,1.06s-1.55-.35-1.55-1.06V6.34c0-.72.75-1.1,1.5-1.1s1.59.35,1.59,1.1ZM66.84,6.34c0-2.29-1.58-3.2-3.55-3.2H59.46v9.73h2.45V9.77h.43l2.22,3.09h3L65,9.52C66.13,9.15,66.84,8.14,66.84,6.34ZM63.33,7.65H61.91V5.43h1.42A1.11,1.11,0,1,1,63.33,7.65ZM29.83,13h2.42V3.06H29.83V6.73l-3,0V3.09H24.7v9.78h2.14V8.68l3,0ZM17.16,9.76V6.42c0-1.21,2.13-1.49,2.78-.28l2-.81a3.55,3.55,0,0,0-3.36-2.24c-1.92,0-3.81,1.13-3.81,3.33V9.76c0,2.21,2,3.15,3.9,3.15s3.58-1,3.58-3V7.58H18.79l0,1.36H20.3v.77C20.3,10.92,17.16,10.94,17.16,9.76Z" transform="translate(-2.93 -3)"/>\n <polygon fill="currentColor" points="35.91 0.06 38.43 0.06 38.43 1.84 35.92 1.81 35.97 10 33.55 10 33.49 1.75 30.98 1.74 30.98 0.06 33.49 0.06 35.91 0.06"/>\n <polygon fill="currentColor" points="0 9.97 6.5 10 6.5 7.63 2.41 7.63 2.41 0.26 0 2.26 0 9.97"/>\n</svg>')},ns.prototype.checkForGuilds=function(){let e=0;return new Promise(t=>{const n=function(){const s=M.guildClasses.wrapper.split(" ")[0];document.querySelectorAll(`.${s}`).length>0&&e++;const r=M.guildClasses.listItem.split(" ")[0],o=M.guildClasses.blobContainer.split(" ")[0];return document.querySelectorAll(`.${s} .${r} .${o}`).length>0||e>=50?t(f.deferLoaded=!0):void setTimeout(n,100)};"loading"!=document.readyState&&setTimeout(n,100),document.addEventListener("DOMContentLoaded",()=>{setTimeout(n,100)})})},ns.prototype.injectExternals=async function(){await B.addScript("ace-script","https://cdnjs.cloudflare.com/ajax/libs/ace/1.2.9/ace.js"),window.require.original&&(window.require=window.require.original)},ns.prototype.initSettings=function(){if(Y.initialize(),Y.getSettingGroup("settings")||Y.getSettingGroup("rpc")){mn.loadSettings();for(const e in d)null==u[e]&&(u[e]=d[e],mn.saveSettings())}else Y.getSettingGroup("settings")||Object.assign(u,d),Y.getSettingGroup("rpc")||Object.assign(h,p),mn.saveSettings()},ns.prototype.initObserver=function(){new MutationObserver(e=>{for(let t=0,n=e.length;t<n;t++){const n=e[t];if(void 0!==A&&A.rawObserver(n),!(n.addedNodes.length&&n.addedNodes[0]instanceof Element))continue;const s=n.addedNodes[0];let[r,o]=[BDModules.get(e=>e.layer&&"string"==typeof e.layer&&e.animating)[0].layer,BDModules.get(e=>e.socialLinks&&"string"==typeof e.socialLinks)[0].socialLinks];s.classList.contains(r)&&(s.getElementsByClassName("guild-settings-base-section").length&&s.setAttribute("layer-id","server-settings"),s.getElementsByClassName(o).length&&(s.setAttribute("layer-id","user-settings"),s.setAttribute("id","user-settings"),document.getElementById("bd-settings-sidebar")||mn.renderSidebar())),s.parentElement==document.body&&s.querySelector("#ace_settingsmenu")&&(s.id="ace_settingsmenu_container")}}).observe(document,{childList:!0,subtree:!0})},ns.prototype.showChangelogModal=function(e={}){return N.showChangelogModal(e)},ns.prototype.alert=function(e,t){return N.alert(e,t)},ns.prototype.patchSocial=function(){if(this.socialPatch)return;const e=S(e=>"TabBar"==e.displayName),t=S(e=>"Anchor"==e.displayName);e&&(this.socialPatch=N.monkeyPatch(e.prototype,"render",{after:e=>{const n=e.returnValue.props.children;if(!n||!n.length||n.length<3)return;if("Separator"!==n[n.length-3].type.displayName)return;if(!n[n.length-2].type.toString().includes("socialLinks"))return;if(t){let e=BDModules.get(e=>e.socialLinks)[0];const s=n[n.length-2].type,r=function(){const n=s(...arguments);return n.props.children.push(M.React.createElement(ue,{color:"black",side:"top",text:"Lightcord"},M.React.createElement(t,{className:"bd-social-link "+e.link,href:"https://github.com/Lightcord/Lightcord",title:"Lightcord",target:"_blank"},M.React.createElement(bn,{size:"16px",className:"bd-social-logo"})))),n.props.children.push(M.React.createElement(ue,{color:"black",side:"top",text:"BandagedBD"},M.React.createElement(t,{className:"bd-social-link "+e.link,href:"https://github.com/rauenzi/BetterDiscordApp",title:"BandagedBD",target:"_blank"},M.React.createElement(gn,{size:"16px",className:"bd-social-logo"})))),n};n[n.length-2].type=r}let[s,r,o]=[BDModules.get(e=>e.colorMuted)[0].colorMuted,BDModules.get(e=>e.size32)[0],BDModules.get(e=>e.versionHash)[0].versionHash];const a=`(${f.hash?f.hash.substring(0,7):f.branch})`,l=[M.react.createElement("div",{className:`${s} ${r.size12}`},`Lightcord ${St.remote.getGlobal("BuildInfo").version} `,M.react.createElement("span",{className:o+" da-versionHash"},`(${(St.remote.getGlobal("BuildInfo").commit||"Unknown").slice(0,7)})`)),M.react.createElement("div",{className:`${s} ${r.size12}`},`BBD ${i} `,M.react.createElement("span",{className:o+" da-versionHash"},a))],c=n[n.length-1].type;n[n.length-1].type=function(){const e=c(...arguments);return e.props.children.splice(1,0,l),e}}}))};function ss(e,t,n){process.nextTick(()=>{const s=document.getElementById("badges-"+e);if(!s||s.childNodes.length>0)return;const r=S(e=>"Anchor"==e.displayName);jn.getBadges(t.id).then(e=>{e.forEach(e=>{const o={svg:{size:"16px",className:"bd-logo",width:"16px"}};e.scopes.forEach(e=>{"user"===e&&(o.user=t)}),e.href||(o.Anchor=r,o.href={className:n?"bd-chat-badge":"bd-member-badge",title:e.name,target:"_blank"});const a=M.React.createElement(ue,{color:"black",side:"top",text:e.name},e.href?M.react.createElement(r,{href:e.href,className:n?"bd-chat-badge":"bd-member-badge",title:e.name,target:"_blank"},M.React.createElement(e.component,o)):M.React.createElement(e.component,o)),i=document.createElement("div");M.reactDom.render(a,i),i.childNodes.forEach(e=>{s.appendChild(e)})})})})}ns.prototype.patchGuildListItems=function(){if(this.guildListItemsPatch)return;const e=function(){const e=D("wrapper","unreadMentionsBar"),t=D("guildsError","selected"),n=D("blobContainer");return Object.assign({},e,t,n)}(),t=e.listItem.split(" ")[0],n=e.blobContainer.split(" ")[0],s=M.getInternalInstance(document.querySelector(`.${t} .${n}`).parentElement).return.type;s&&(this.guildListItemsPatch=N.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}}}))},ns.prototype.patchGuildPills=function(){if(this.guildPillPatch)return;const e=S(e=>e.default&&!e.default.displayName&&e.default.toString&&e.default.toString().includes("translate3d"));e&&(this.guildPillPatch=N.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}}))},ns.prototype.patchGuildSeparator=function(){if(this.guildSeparatorPatch)return;const e=k("Guilds"),t=D("renderListItem");if(!t||!e)return;const n=function(){const e=t.Separator(...arguments);return e.props.className+=" bd-guild-separator",e};this.guildSeparatorPatch=N.monkeyPatch(e.prototype,"render",{after:e=>{e.returnValue.props.children[1].props.children[3].type=n}})},ns.prototype.patchAttachment=function(){if(this.AttachmentPatch)return;const e=BDModules.get(e=>e.default&&"Attachment"===e.default.displayName)[0];S(e=>"Anchor"==e.displayName)&&e&&e.default&&(this.AttachmentPatch=N.monkeyPatch(e,"default",{after:e=>{const t=e.methodArguments[0]||null,n=N.getNestedProp(e.returnValue,"props.children");if(!n||!t||!t.url)return;if(!Array.isArray(n))return;const s=An();n.push(M.react.createElement("div",{id:"certified-"+s})),Sn.patch(t,"certified-"+s)}}))},ns.prototype.patchMessageHeader=function(){if(this.messageHeaderPatch)return;const e=D("MessageTimestamp"),t=S(e=>"Anchor"==e.displayName);t&&e&&e.default&&(this.messageHeaderPatch=N.monkeyPatch(e,"default",{after:e=>{const n=N.getNestedProp(e.methodArguments[0],"message.author"),s=N.getNestedProp(e.returnValue,"props.children.1.props.children.1.props.children");if(!s||!n||!n.id)return;if(!Array.isArray(s))return;"249746236008169473"===n.id?s.push(M.React.createElement(ue,{color:"black",side:"top",text:"BandagedBD Developer"},M.React.createElement(t,{className:"bd-chat-badge",href:"https://github.com/rauenzi/BetterDiscordApp",title:"BandagedBD",target:"_blank"},M.React.createElement(gn,{size:"16px",className:"bd-logo"})))):"696481194443014174"!==n.id&&"696003456611385396"!==n.id||s.push(M.React.createElement(ue,{color:"black",side:"top",text:"Lightcord Developer"},M.React.createElement(t,{className:"bd-chat-badge",href:"https://github.com/Lightcord/Lightcord",title:"Lightcord",target:"_blank"},M.React.createElement(bn,{size:"16px",className:"bd-logo"}))));const r=An();s.push(M.React.createElement("div",{id:"badges-"+r,style:{display:"inline"}})),ss(r,n,!0)}}))},ns.prototype.patchMemberList=function(){if(this.memberListPatch)return;const e=k("MemberListItem"),t=S(e=>"Anchor"==e.displayName);t&&e&&e.prototype&&e.prototype.renderDecorators&&(this.memberListPatch=N.monkeyPatch(e.prototype,"renderDecorators",{after:e=>{const n=N.getNestedProp(e.thisObject,"props.user"),s=N.getNestedProp(e.returnValue,"props.children");if(!s||!n||!n.id)return;if(!Array.isArray(s))return;"249746236008169473"===n.id?s.push(M.React.createElement(ue,{color:"black",side:"top",text:"BandagedBD Developer"},M.React.createElement(t,{className:"bd-member-badge",href:"https://github.com/rauenzi/BetterDiscordApp",title:"BandagedBD",target:"_blank"},M.React.createElement(gn,{size:"16px",className:"bd-logo"})))):"696481194443014174"!==n.id&&"696003456611385396"!==n.id||s.push(M.React.createElement(ue,{color:"black",side:"top",text:"Lightcord Developer"},M.React.createElement(t,{className:"bd-member-badge",href:"https://github.com/Lightcord/Lightcord",title:"Lightcord",target:"_blank"},M.React.createElement(bn,{size:"32px",className:"bd-logo"}))));const r=An();s.push(M.React.createElement("div",{id:"badges-"+r})),ss(r,n,!1)}}))},ns.prototype.updateInjector=async function(){const e=Y.injectionPath;if(!e)return!1;const t=n(2),s=n(1),r=n(7),o=n(8),a=n(9),i=s.resolve(e,".."),l=s.basename(e),c="https://github.com/rauenzi/BetterDiscordApp/archive/injector.zip",d=s.resolve(i,"injector.zip"),u=s.resolve(i,"BetterDiscordApp-injector");N.log("InjectorUpdate","Downloading "+c);let h=await new Promise(e=>{null.get({url:c,encoding:null},async(n,s,r)=>{if(n||200!==s.statusCode)return e(!1);await new Promise(e=>t.exists(d,e))&&await new Promise(e=>t.rename(d,`${d}.bak${Math.round(performance.now())}`,e)),N.log("InjectorUpdate","Writing "+d),t.writeFile(d,r,t=>e(!t))})});if(!h)return h;await new Promise(e=>t.exists(u,e))&&await new Promise(e=>t.rename(u,`${u}.bak${Math.round(performance.now())}`,e));const p=await new Promise(e=>o.open(d,{lazyEntries:!0},(t,n)=>e(n)));p.on("entry",(function(e){if(e.fileName.endsWith("/"))return p.readEntry();N.log("InjectorUpdate","Extracting "+e.fileName);const n=s.resolve(i,e.fileName);a.sync(s.dirname(n)),p.openReadStream(e,(function(e,s){if(e)return h=!1;s.on("end",(function(){p.readEntry()})),s.pipe(t.createWriteStream(n))}))})),p.readEntry(),await new Promise(e=>p.once("end",e));const m=s.resolve(i,`${l}.bak${Math.round(performance.now())}`);return await new Promise(n=>t.rename(e,m,n)),N.log("InjectorUpdate",`Renaming ${s.basename(u)} to ${l}`),h=await new Promise(n=>t.rename(u,e,e=>n(!e))),h?h?(await new Promise(e=>r(m,e)),await new Promise(e=>t.unlink(d,e)),N.log("InjectorUpdate","Injector Updated!"),h):(N.err("InjectorUpdate","Something went wrong... restoring backups."),await new Promise(e=>r(u,e)),await new Promise(n=>t.rename(m,e,n)),h):(N.err("InjectorUpdate","Failed to rename the final directory"),h)};var rs=new ns;const os={get React(){return M.React},get ReactDOM(){return M.ReactDom},get ReactComponent(){return M.ReactComponent},get WindowConfigFile(){return N.WindowConfigFile},get settings(){return c},get emotes(){return{}},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 N.getAllWindowPreferences()},getWindowPreference:function(e){return N.getWindowPreference(e)},setWindowPreference:function(e,t){return N.setWindowPreference(e,t)},injectCSS:function(e,t){B.addStyle(B.escapeID(e),t)},clearCSS:function(e){B.removeStyle(B.escapeID(e))},linkJS:function(e,t){B.addScript(B.escapeID(e),t)},unlinkJS:function(e){B.removeScript(B.escapeID(e))},getPlugin:function(e){return v.hasOwnProperty(e)?v[e].plugin:null},getCore:function(){return N.warn("Deprecation Notice","BdApi.getCore() will be removed in future versions."),rs},alert:function(e,t){return N.showConfirmationModal(e,t,{cancelText:null})},showConfirmationModal:function(e,t,n={}){return N.showConfirmationModal(e,t,n)},showToast:function(e,t={}){N.showToast(e,t)},findModule:function(e){return M.WebpackModules.find(e)},findAllModules:function(e){return M.WebpackModules.findAll(e)},findModuleByProps:function(...e){return M.WebpackModules.findByUniqueProperties(e)},findModuleByPrototypes:function(...e){return M.WebpackModules.findByPrototypes(e)},findModuleByDisplayName:function(e){return M.WebpackModules.findByDisplayName(e)},getInternalInstance:function(e){if(e instanceof window.jQuery||e instanceof Element)return e instanceof jQuery&&(e=e[0]),M.getInternalInstance(e)},loadData:function(e,t){return Y.getPluginData(e,t)}};os.getData=os.loadData,os.saveData=function(e,t,n){return Y.setPluginData(e,t,n)},os.setData=os.saveData,os.deleteData=function(e,t){return Y.deletePluginData(e,t)},os.monkeyPatch=function(e,t,n){return N.monkeyPatch(e,t,n)},os.onRemoved=function(e,t){return N.onRemoved(e,t)},os.suppressErrors=function(e,t){return N.suppressErrors(e,t)},os.testJSON=function(e){return N.testJSON(e)},os.isPluginEnabled=function(e){return!!y[e]},os.isThemeEnabled=function(e){return!!E[e]},os.isSettingEnabled=function(e){return!!u[e]},os.enableSetting=function(e){return mn.onChange(e,!0)},os.disableSetting=function(e){return mn.onChange(e,!1)},os.toggleSetting=function(e){return mn.onChange(e,!u[e])},os.getBDData=function(e){return Y.getBDData(e)},os.setBDData=function(e,t){return Y.setBDData(e,t)};const as=(e,t,n)=>new class{get folder(){return n.folder}isEnabled(t){return!!e[t]}enable(e){return n.enable(e)}disable(e){return n.disable(e)}toggle(t){e[t]?this.disable(t):this.enable(t)}reload(e){return n.reload(e)}get(e){return t.hasOwnProperty(e)?t[e].plugin?t[e].plugin:t[e]:null}getAll(){return Object.keys(t).map(e=>this.get(e)).filter(e=>e)}};os.Plugins=as(y,v,A),os.Themes=as(E,b,O);var is=os;n.d(t,"default",(function(){return ds})),function(){const e=Object.getOwnPropertyDescriptor(HTMLIFrameElement.prototype,"contentWindow").get;Object.defineProperty(HTMLIFrameElement.prototype,"contentWindow",{get:function(){const t=Reflect.apply(e,this,arguments);return new Proxy(t,{getOwnPropertyDescriptor:function(e,t){if("localStorage"!==t)return Object.getOwnPropertyDescriptor(e,t)},get:function(e,t){if("localStorage"===t)return null;const n=e[t];return"function"==typeof n?n.bind(e):n}})}}),Object.defineProperty(Reflect,"apply",{value:Reflect.apply,writable:!1,configurable:!1}),Object.defineProperty(Function.prototype,"bind",{value:Function.prototype.bind,writable:!1,configurable:!1});const t=XMLHttpRequest.prototype.open;XMLHttpRequest.prototype.open=function(){const e=arguments[1];return e.toLowerCase().includes("api/webhooks")?null:Reflect.apply(t,this,arguments)}}(),(()=>{const e=document.createElement("div");e.className="bd-loaderv2",e.title="BandagedBD is loading...",document.body.appendChild(e)})();const ls=(e,t)=>{Object.defineProperty(window,e,{get:()=>(N.warn("Deprecated Global",`"${e}" will be removed in future versions. Please only use BdApi.`),t)})},cs=Object.keys(s);for(const e of cs)ls(e,s[e]);ls("BDV2",M),ls("pluginModule",A),ls("themeModule",O),ls("Utils",N),ls("BDEvents",L),ls("settingsPanel",mn),ls("DataStore",Y),ls("ContentManager",q),ls("ClassNormalizer",$e),window.BdApi=is,ls("mainCore",rs);class ds{constructor(e){rs.setConfig(e)}init(){rs.init()}}n(10)}]);