(function(){let s=window.require("fs"),r=window.require("process"),n=r.platform,o=("win32"===n?r.env.APPDATA:"darwin"===n?r.env.HOME+"/Library/Preferences":process.env.HOME+"/.config")+"/BetterDiscord/",d={};if(s.existsSync(`${o}localStorage.json`))try{d=JSON.parse(s.readFileSync(`${o}localStorage.json`))}catch(u){console.log(u)}else if(s.existsSync("localStorage.json"))try{d=JSON.parse(s.readFileSync("localStorage.json"))}catch(u){console.log(u)}var c=d;c.setItem=function(u,h){c[u]=h,this.save()},c.getItem=function(u){return c[u]||null},c.save=function(){s.writeFileSync(`${o}/localStorage.json`,JSON.stringify(this),null,4)};var l=new Proxy(c,{set:function(u,h,g){c[h]=g,c.save()},get:function(u,h){return c[h]||null}});window.localStorage=l})(),(()=>{let s=document.createElement("div");s.className="bd-loaderv2",s.title="BetterDiscord is loading...",document.body.appendChild(s)})(),window.bdStorage={},window.bdStorage.get=function(s){return betterDiscordIPC.sendSync("synchronous-message",{arg:"storage",cmd:"get","var":s})},window.bdStorage.set=function(s,r){betterDiscordIPC.sendSync("synchronous-message",{arg:"storage",cmd:"set","var":s,data:r})},window.bdPluginStorage={},window.bdPluginStorage.get=function(s,r){return betterDiscordIPC.sendSync("synchronous-message",{arg:"pluginstorage",cmd:"get",pn:s,"var":r})},window.bdPluginStorage.set=function(s,r,n){betterDiscordIPC.sendSync("synchronous-message",{arg:"pluginstorage",cmd:"set",pn:s,"var":r,data:n})},betterDiscordIPC.on("asynchronous-reply",(s,r)=>{console.log(s),console.log(r)});var settingsPanel,emoteModule,utils,quickEmoteMenu,voiceMode,pluginModule,themeModule,dMode,jsVersion=1.792,supportedVersion="0.2.81",mainObserver,twitchEmoteUrlStart="https://static-cdn.jtvnw.net/emoticons/v1/",twitchEmoteUrlEnd="/1.0",ffzEmoteUrlStart="https://cdn.frankerfacez.com/emoticon/",ffzEmoteUrlEnd="/1",bttvEmoteUrlStart="https://cdn.betterttv.net/emote/",bttvEmoteUrlEnd="/1x",mainCore,settings={"Startup Error Modal":{id:"bda-gs-9",info:"Show a modal with plugin/theme errors on startup.",implemented:!0,hidden:!1,cat:"core"},"Show Toasts":{id:"bda-gs-10",info:"Shows a small notification for starting and stopping plugins & themes.",implemented:!0,hidden:!1,cat:"core"},"Save logs locally":{id:"bda-gs-0",info:"Saves chat logs locally",implemented:!1,hidden:!1,cat:"core"},"Public Servers":{id:"bda-gs-1",info:"Display public servers button",implemented:!1,hidden:!1,cat:"core"},"Minimal Mode":{id:"bda-gs-2",info:"Hide elements and reduce the size of elements.",implemented:!0,hidden:!1,cat:"core"},"Voice Mode":{id:"bda-gs-4",info:"Only show voice chat",implemented:!0,hidden:!1,cat:"core"},"Hide Channels":{id:"bda-gs-3",info:"Hide channels in minimal mode",implemented:!0,hidden:!1,cat:"core"},"Dark Mode":{id:"bda-gs-5",info:"Make certain elements dark by default(wip)",implemented:!0,hidden:!1,cat:"core"},"Override Default Emotes":{id:"bda-es-5",info:"Override default emotes",implemented:!1,hidden:!1,cat:"core"},"Voice Disconnect":{id:"bda-dc-0",info:"Disconnect from voice server when closing Discord",implemented:!0,hidden:!1,cat:"core"},"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"},"24 Hour Timestamps":{id:"bda-gs-6",info:"Replace 12hr timestamps with proper ones",implemented:!0,hidden:!1,cat:"core"},"Coloured Text":{id:"bda-gs-7",info:"Make text colour the same as role colour",implemented:!0,hidden:!1,cat:"core"},"BetterDiscord Blue":{id:"bda-gs-b",info:"Replace Discord blue with BD Blue",implemented:!0,hidden:!1,cat:"core"},"Developer Mode":{id:"bda-gs-8",info:"Developer Mode",implemented:!0,hidden:!1,cat:"core"},"Twitch Emotes":{id:"bda-es-7",info:"Show Twitch emotes",implemented:!0,hidden:!1,cat:"emote"},"FrankerFaceZ Emotes":{id:"bda-es-1",info:"Show FrankerFaceZ Emotes",implemented:!0,hidden:!1,cat:"emote"},"BetterTTV Emotes":{id:"bda-es-2",info:"Show BetterTTV Emotes",implemented:!0,hidden:!1,cat:"emote"},"Emote Menu":{id:"bda-es-0",info:"Show Twitch/Favourite emotes in emote menu",implemented:!0,hidden:!1,cat:"emote"},"Emoji Menu":{id:"bda-es-9",info:"Show Discord emoji menu",implemented:!0,hidden:!1,cat:"emote"},"Emote Autocomplete":{id:"bda-es-3",info:"Autocomplete emote commands",implemented:!1,hidden:!1,cat:"emote"},"Emote Auto Capitalization":{id:"bda-es-4",info:"Autocapitalize emote commands",implemented:!0,hidden:!1,cat:"emote"},"Show Names":{id:"bda-es-6",info:"Show emote names on hover",implemented:!0,hidden:!1,cat:"emote"},"Show emote modifiers":{id:"bda-es-8",info:"Enable emote mods",implemented:!0,hidden:!1,cat:"emote"}},defaultCookie={version:jsVersion,"bda-gs-0":!1,"bda-gs-1":!1,"bda-gs-2":!1,"bda-gs-3":!1,"bda-gs-4":!1,"bda-gs-5":!0,"bda-gs-6":!1,"bda-gs-7":!1,"bda-gs-8":!1,"bda-gs-9":!0,"bda-gs-10":!0,"bda-es-0":!0,"bda-es-1":!0,"bda-es-2":!0,"bda-es-3":!1,"bda-es-4":!1,"bda-es-5":!0,"bda-es-6":!0,"bda-es-7":!0,"bda-gs-b":!0,"bda-es-8":!0,"bda-jd":!0,"bda-dc-0":!1,"bda-css-0":!1,"bda-css-1":!1,"bda-es-9":!0},settingsCookie={},bdpluginErrors,bdthemeErrors;function Core(){}Core.prototype.init=function(){function s(){console.log(new Date().getTime()+" Defer"),0.CodeMirror{ min-width:100%; }"),$("head").append(""),document.getElementsByClassName("bd-loaderv2")[0].remove(),settingsCookie["bda-gs-9"]&&r.showStartupErrors(),r.initObserver()):setTimeout(s,100)}var r=this,n="undefined"==typeof version?bdVersion:version;return n
Please download the latest version from BetterDiscord.net"):void(utils=new Utils,utils.getHash(),emoteModule=new EmoteModule,quickEmoteMenu=new QuickEmoteMenu,voiceMode=new VoiceMode,dMode=new devMode,emoteModule.init(),this.initSettings(),$(document).ready(function(){setTimeout(s,1e3)}))},Core.prototype.injectExternals=function(){utils.injectJs("https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.25.0/codemirror.min.js"),utils.injectJs("https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.25.0/mode/css/css.min.js"),utils.injectJs("https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.25.0/addon/scroll/simplescrollbars.min.js"),utils.injectCss("https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.25.0/addon/scroll/simplescrollbars.min.css"),utils.injectCss("https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.25.0/theme/material.min.css"),utils.injectJs("https://cdnjs.cloudflare.com/ajax/libs/Sortable/1.4.2/Sortable.min.js")},Core.prototype.initSettings=function(){if(void 0==$.cookie("better-discord"))settingsCookie=defaultCookie,this.saveSettings();else for(var s in this.loadSettings(),$("`),settingsCookie["bda-gs-10"]&&mainCore.showToast(`${bdthemes[s].name} v${bdthemes[s].version} has been applied.`)},ThemeModule.prototype.disableTheme=function(s){themeCookie[s]=!1,this.saveThemeData(),$(`#${utils.escapeID(bdthemes[s].name)}`).remove(),settingsCookie["bda-gs-10"]&&mainCore.showToast(`${bdthemes[s].name} v${bdthemes[s].version} has been removed.`)},ThemeModule.prototype.toggleTheme=function(s){themeCookie[s]?this.disableTheme(s):this.enableTheme(s)},ThemeModule.prototype.loadThemeData=function(){var s=$.cookie("bd-themes");s!=void 0&&(themeCookie=JSON.parse($.cookie("bd-themes")))},ThemeModule.prototype.saveThemeData=function(){$.cookie("bd-themes",JSON.stringify(themeCookie),{expires:365,path:"/"})};function BdApi(){}BdApi.injectCSS=function(s,r){$("head").append($(""),$("#customcss").html(s.editor.getValue())}saveCss(){let s=this;window.bdStorage.set("bdcustomcss",btoa(s.editor.getValue()))}}class V2C_CssEditor extends BDV2.reactComponent{constructor(s){super(s);let r=this;r.setInitialState(),r.attach=r.attach.bind(r),r.detachedEditor=BDV2.react.createElement(V2C_CssEditorDetached,{attach:r.attach}),r.onClick=r.onClick.bind(r),r.updateCss=r.updateCss.bind(r),r.saveCss=r.saveCss.bind(r),r.detach=r.detach.bind(r),r.codeMirror=r.codeMirror.bind(r)}setInitialState(){this.state={detached:this.props.detached||window.bdtemp.editorDetached}}componentDidMount(){let s=this;s.codeMirror()}componentDidUpdate(s,r){let n=this;r.detached&&!n.state.detached&&(BDV2.reactDom.unmountComponentAtNode(n.detachedRoot),n.codeMirror())}codeMirror(){let s=this;s.state.detached||(s.editor=CodeMirror.fromTextArea(s.refs.editor,s.options),s.editor.on("change",()=>{settingsCookie["bda-css-0"]&&s.updateCss()}))}get options(){return{lineNumbers:!0,mode:"css",indentUnit:4,theme:"material",scrollbarStyle:"simple"}}get css(){let s=window.bdStorage.get("bdcustomcss"),r="";return s&&""!==s&&(r=atob(s)),r}render(){let s=this,{detached:r}=s.state;return BDV2.react.createElement("div",{className:"content-column default",style:{padding:"60px 40px 0px"}},r&&BDV2.react.createElement("div",{id:"editor-detached"},BDV2.react.createElement(V2Components.SettingsTitle,{text:"Custom CSS Editor"}),BDV2.react.createElement("h3",null,"Editor Detached"),BDV2.react.createElement("button",{className:"btn btn-primary",onClick:()=>{s.attach()}},"Attach")),!r&&BDV2.react.createElement("div",null,BDV2.react.createElement(V2Components.SettingsTitle,{text:"Custom CSS Editor"}),BDV2.react.createElement("textarea",{ref:"editor",value:s.css,onChange:()=>{}}),BDV2.react.createElement("div",{id:"bd-customcss-attach-controls"},BDV2.react.createElement("ul",{className:"checkbox-group"},BDV2.react.createElement(V2Components.Checkbox,{id:"live-update",text:"Live Update",onChange:this.onChange,checked:settingsCookie["bda-css-0"]})),BDV2.react.createElement("div",{id:"bd-customcss-detach-controls-button"},BDV2.react.createElement("button",{style:{borderRadius:"3px 0 0 3px",borderRight:"1px solid #3f4146"},className:"btn btn-primary",onClick:()=>{s.onClick("update")}},"Update"),BDV2.react.createElement("button",{style:{borderRadius:"0",borderLeft:"1px solid #2d2d2d",borderRight:"1px solid #2d2d2d"},className:"btn btn-primary",onClick:()=>{s.onClick("save")}},"Save"),BDV2.react.createElement("button",{style:{borderRadius:"0 3px 3px 0",borderLeft:"1px solid #3f4146"},className:"btn btn-primary",onClick:()=>{s.onClick("detach")}},"Detach"),BDV2.react.createElement("span",{style:{fontSize:"10px",marginLeft:"5px"}},"Unsaved changes are lost on detach")))))}onClick(s){let r=this;"update"===s?r.updateCss():"save"===s?r.saveCss():"detach"===s?r.detach():void 0}onChange(s,r){"live-update"===s?(settingsCookie["bda-css-0"]=r,mainCore.saveSettings()):void 0}updateCss(){let s=this;0==$("#customcss").length&&$("head").append(""),$("#customcss").html(s.editor.getValue())}saveCss(){let s=this;window.bdStorage.set("bdcustomcss",btoa(s.editor.getValue()))}detach(){let s=this;s.setState({detached:!0});let r=s.detachedRoot;return r?void BDV2.reactDom.render(s.detachedEditor,r):void console.log("FAILED TO INJECT ROOT: .app")}get detachedRoot(){let s=$("#bd-customcss-detach-container");return s.length?s[0]:this.injectDetachedRoot()?this.detachedRoot:null}injectDetachedRoot(){return!!$(".app").length&&($("
",{id:"bd-customcss-detach-container"}).insertAfter($(".app")),!0)}attach(){let s=this;s.setState({detached:!1})}}class V2C_List extends BDV2.reactComponent{constructor(s){super(s)}render(){return BDV2.react.createElement("ul",{className:this.props.className},this.props.children)}}class V2C_ContentColumn extends BDV2.reactComponent{constructor(s){super(s)}render(){return BDV2.react.createElement("div",{className:"content-column default"},BDV2.react.createElement("h2",{className:"ui-form-title h2 margin-reset margin-bottom-20"},this.props.title),this.props.children)}}class V2C_PluginCard extends BDV2.reactComponent{constructor(s){super(s);let r=this;"function"==typeof r.props.plugin.getSettingsPanel&&(r.settingsPanel=r.props.plugin.getSettingsPanel()),r.onChange=r.onChange.bind(r),r.showSettings=r.showSettings.bind(r),r.setInitialState()}setInitialState(){this.state={checked:pluginCookie[this.props.plugin.getName()],settings:!1}}componentDidUpdate(){this.state.settings&&"object"==typeof this.settingsPanel&&this.refs.settingspanel.appendChild(this.settingsPanel)}render(){let s=this,{plugin:r}=this.props,n=r.getName(),o=r.getAuthor(),d=r.getDescription(),c=r.getVersion(),l=bdplugins[n].website,u=bdplugins[n].source,{settingsPanel:h}=this;return this.state.settings?BDV2.react.createElement("li",{className:"settings-open ui-switch-item"},BDV2.react.createElement("div",{style:{float:"right",cursor:"pointer"},onClick:()=>{this.refs.settingspanel.innerHTML="",s.setState({settings:!1})}},BDV2.react.createElement(V2Components.XSvg,null)),"object"==typeof h&&BDV2.react.createElement("div",{id:`plugin-settings-${n}`,className:"plugin-settings",ref:"settingspanel"}),"object"!=typeof h&&BDV2.react.createElement("div",{id:`plugin-settings-${n}`,className:"plugin-settings",ref:"settingspanel",dangerouslySetInnerHTML:{__html:this.settingsPanel}})):BDV2.react.createElement("li",{"data-name":n,"data-version":c,className:"settings-closed ui-switch-item"},BDV2.react.createElement("div",{className:"bda-header"},BDV2.react.createElement("span",{className:"bda-header-title"},BDV2.react.createElement("span",{className:"bda-name"},n)," v",BDV2.react.createElement("span",{className:"bda-version"},c)," by ",BDV2.react.createElement("span",{className:"bda-author"},o)),BDV2.react.createElement("label",{className:"ui-switch-wrapper ui-flex-child",style:{flex:"0 0 auto"}},BDV2.react.createElement("input",{checked:this.state.checked,onChange:this.onChange,className:"ui-switch-checkbox",type:"checkbox"}),BDV2.react.createElement("div",{className:this.state.checked?"ui-switch checked":"ui-switch"}))),BDV2.react.createElement("div",{className:"bda-description-wrap scroller-wrap fade"},BDV2.react.createElement("div",{className:"bda-description scroller"},d)),BDV2.react.createElement("div",{className:"bda-footer"},BDV2.react.createElement("span",{className:"bda-links"},l&&BDV2.react.createElement("a",{className:"bda-link",href:l,target:"_blank"},"Website"),l&&u&&" | ",u&&BDV2.react.createElement("a",{className:"bda-link",href:u,target:"_blank"},"Source")),this.settingsPanel&&BDV2.react.createElement("button",{onClick:this.showSettings,className:"bda-settings-button",disabled:!this.state.checked},"Settings")))}onChange(){this.setState({checked:!this.state.checked}),pluginModule.togglePlugin(this.props.plugin.getName())}showSettings(){if(this.settingsPanel){this.setState({settings:!0});let s=$(BDV2.reactDom.findDOMNode(this)),r=s.parents(".scroller");r.animate({scrollTop:s.offset().top-r.offset().top+r.scrollTop()-30},1e3)}}}class V2C_ThemeCard extends BDV2.reactComponent{constructor(s){super(s),this.setInitialState(),this.onChange=this.onChange.bind(this)}setInitialState(){this.state={checked:themeCookie[this.props.theme.name]}}render(){let{theme:s}=this.props,r=s.name,n=s.description,o=s.version,d=s.author,c=bdthemes[r].website,l=bdthemes[r].source;return BDV2.react.createElement("li",{"data-name":r,"data-version":o,className:"settings-closed ui-switch-item"},BDV2.react.createElement("div",{className:"bda-header"},BDV2.react.createElement("span",{className:"bda-header-title"},BDV2.react.createElement("span",{className:"bda-name"},r)," v",BDV2.react.createElement("span",{className:"bda-version"},o)," by ",BDV2.react.createElement("span",{className:"bda-author"},d)),BDV2.react.createElement("label",{className:"ui-switch-wrapper ui-flex-child",style:{flex:"0 0 auto"}},BDV2.react.createElement("input",{checked:this.state.checked,onChange:this.onChange,className:"ui-switch-checkbox",type:"checkbox"}),BDV2.react.createElement("div",{className:this.state.checked?"ui-switch checked":"ui-switch"}))),BDV2.react.createElement("div",{className:"bda-description-wrap scroller-wrap fade"},BDV2.react.createElement("div",{className:"bda-description scroller"},n)),BDV2.react.createElement("div",{className:"bda-footer"},BDV2.react.createElement("span",{className:"bda-links"},c&&BDV2.react.createElement("a",{className:"bda-link",href:c,target:"_blank"},"Website"),c&&l&&" | ",l&&BDV2.react.createElement("a",{className:"bda-link",href:l,target:"_blank"},"Source"))))}onChange(){this.setState({checked:!this.state.checked}),themeModule.toggleTheme(this.props.theme.name)}}class V2Cs_TabBar{static get Item(){return V2C_TabBarItem}static get Header(){return V2C_TabBarHeader}static get Separator(){return V2C_TabBarSeparator}}class V2C_Layer extends BDV2.reactComponent{constructor(s){super(s)}componentDidMount(){$(window).on(`keyup.${this.props.id}`,s=>{27===s.which&&BDV2.reactDom.unmountComponentAtNode(this.refs.root.parentNode)})}componentWillUnmount(){$(window).off(`keyup.${this.props.id}`),$(`#${this.props.rootId}`).remove()}render(){return BDV2.react.createElement("div",{className:"layer",id:this.props.id,ref:"root"},this.props.children)}}class V2C_SidebarView extends BDV2.reactComponent{constructor(s){super(s)}render(){let{sidebar:s,content:r}=this.props.children;return BDV2.react.createElement("div",{className:"ui-standard-sidebar-view"},BDV2.react.createElement("div",{className:"sidebar-region"},BDV2.react.createElement(V2Components.Scroller,{key:"sidebarScroller",ref:"sidebarScroller",fade:s.fade||!0,dark:s.dark||!0,children:s.component})),BDV2.react.createElement("div",{className:"content-region"},BDV2.react.createElement(V2Components.Scroller,{key:"contentScroller",ref:"contentScroller",fade:r.fade||!0,dark:r.dark||!0,children:r.component})))}}class V2C_ServerCard extends BDV2.reactComponent{constructor(s){super(s)}render(){let{server:s}=this.props;return BDV2.react.createElement("div",{className:`ui-card ui-card-primary bd-server-card${s.pinned?" bd-server-card-pinned":""}`,style:{marginTop:"5px"}},BDV2.react.createElement("div",{className:"ui-flex horizontal",style:{display:"flex",flexFlow:"row nowrap",justifyContent:"flex-start",alignItems:"stretch",flex:"1 1 auto"}},BDV2.react.createElement("div",{className:"ui-flex-child",style:{flex:"0 1 auto",padding:"5px"}},BDV2.react.createElement("div",{className:"bd-pubs-server-icon",style:{width:"100px",height:"100px",backgroundSize:"cover",backgroundImage:`url(${s.icon})`}})),BDV2.react.createElement("div",{className:"ui-flex-child",style:{flex:"1 1 auto",padding:"5px"}},BDV2.react.createElement("div",{className:"ui-flex horizontal"},BDV2.react.createElement("div",{className:"ui-form-item",style:{flex:"1 1 auto"}},BDV2.react.createElement("h5",{className:"ui-form-title h5 margin-reset"},s.name)),BDV2.react.createElement("div",{className:"ui-form-item"},BDV2.react.createElement("h5",{className:"ui-form-title h5 margin-reset"},s.online,"/",s.members," Members"))),BDV2.react.createElement("div",{className:"ui-flex horizontal"},BDV2.react.createElement("div",{className:"scroller-wrap fade dark",style:{minHeight:"60px",maxHeight:"60px",borderTop:"1px solid #3f4146",borderBottom:"1px solid #3f4146",paddingTop:"5px"}},BDV2.react.createElement("div",{className:"scroller"},BDV2.react.createElement("div",{style:{fontSize:"13px",color:"#b9bbbe"}},s.description)))),BDV2.react.createElement("div",{className:"ui-flex horizontal"},BDV2.react.createElement("div",{className:"ui-flex-child bd-server-tags",style:{flex:"1 1 auto"}},s.categories.join(", ")),s.joined&&BDV2.react.createElement("button",{type:"button",className:"ui-button filled brand small grow disabled",style:{minHeight:"12px",marginTop:"4px",backgroundColor:"#3ac15c"}},BDV2.react.createElement("div",{className:"ui-button-contents"},"Joined")),s.error&&BDV2.react.createElement("button",{type:"button",className:"ui-button filled brand small grow disabled",style:{minHeight:"12px",marginTop:"4px",backgroundColor:"#c13a3a"}},BDV2.react.createElement("div",{className:"ui-button-contents"},"Error")),!s.error&&!s.joined&&BDV2.react.createElement("button",{type:"button",className:"ui-button filled brand small grow",style:{minHeight:"12px",marginTop:"4px"},onClick:()=>{this.join(s.identifier)}},BDV2.react.createElement("div",{className:"ui-button-contents"},"Join"))))))}join(){let s=this;s.props.join(s.props.server)}}class V2Components{static get SettingsPanel(){return V2C_SettingsPanel}static get Switch(){return V2C_Switch}static get Scroller(){return V2C_Scroller}static get TabBar(){return V2Cs_TabBar}static get SideBar(){return V2C_SideBar}static get Tools(){return V2C_Tools}static get SettingsTitle(){return V2C_SettingsTitle}static get CssEditor(){return V2C_CssEditor}static get Checkbox(){return V2C_Checkbox}static get List(){return V2C_List}static get PluginCard(){return V2C_PluginCard}static get ThemeCard(){return V2C_ThemeCard}static get ContentColumn(){return V2C_ContentColumn}static get XSvg(){return V2C_XSvg}static get Layer(){return V2C_Layer}static get SidebarView(){return V2C_SidebarView}static get ServerCard(){return V2C_ServerCard}}class V2_SettingsPanel_Sidebar{constructor(s){this.onClick=s}get items(){return[{text:"Core",id:"core"},{text:"Emotes",id:"emotes"},{text:"Custom CSS",id:"customcss"},{text:"Plugins",id:"plugins"},{text:"Themes",id:"themes"}]}get component(){return BDV2.react.createElement("span",null,BDV2.react.createElement(V2Components.SideBar,{onClick:this.onClick,headerText:"BetterDiscord",items:this.items}),BDV2.react.createElement("span",{style:{fontSize:"12px",fontWeight:"600",color:"#72767d",padding:"6px 10px"}},`v${bdVersion}:${jsVersion} by `,BDV2.react.createElement("a",{href:"https://github.com/Jiiks/",target:"_blank"},"Jiiks")))}get root(){let s=$("#bd-settings-sidebar");return s.length?s[0]:this.injectRoot()?this.root:null}injectRoot(){let s=$("[class*=side] > [class*=item]:not([class*=Danger])").last();return!!s.length&&($("",{id:"bd-settings-sidebar"}).insertBefore(s.prev()),!0)}render(){let s=this.root;return s?void BDV2.reactDom.render(this.component,s):void console.log("FAILED TO LOCATE ROOT: [class*=side] > [class*=item]:not([class*=Danger])")}}class V2_SettingsPanel{constructor(){let s=this;s.sideBarOnClick=s.sideBarOnClick.bind(s),s.onChange=s.onChange.bind(s),s.updateSettings=this.updateSettings.bind(s),s.sidebar=new V2_SettingsPanel_Sidebar(s.sideBarOnClick)}get root(){let s=$("#bd-settingspane-container");return s.length?s[0]:this.injectRoot()?this.root:null}injectRoot(){return!!$(".layer .ui-standard-sidebar-view").length&&($(".layer .ui-standard-sidebar-view").append($("
",{class:"content-region",id:"bd-settingspane-container"})),!0)}get coreSettings(){return this.getSettings("core")}get emoteSettings(){return this.getSettings("emote")}getSettings(s){return Object.keys(settings).reduce((r,n)=>{let o=settings[n];return o.cat===s&&o.implemented&&!o.hidden&&(o.text=n,r.push(o)),r},[])}sideBarOnClick(s){let r=this;$(".content-region").first().hide(),$(r.root).show();"core"===s?r.renderCoreSettings():"emotes"===s?r.renderEmoteSettings():"customcss"===s?r.renderCustomCssEditor():"plugins"===s?r.renderPluginPane():"themes"===s?r.renderThemePane():void 0}onClick(){}onChange(s,r){settingsCookie[s]=r,this.updateSettings()}updateSettings(){let s=settingsCookie;if(s["bda-es-0"]?$("#twitchcord-button-container").show():$("#twitchcord-button-container").hide(),s["bda-gs-b"]?$("body").addClass("bd-blue"):$("body").removeClass("bd-blue"),s["bda-gs-2"]?$("body").addClass("bd-minimal"):$("body").removeClass("bd-minimal"),s["bda-gs-3"]?$("body").addClass("bd-minimal-chan"):$("body").removeClass("bd-minimal-chan"),s["bda-gs-1"]?$("#bd-pub-li").show():$("#bd-pub-li").hide(),s["bda-gs-4"]?voiceMode.enable():voiceMode.disable(),s["bda-gs-5"]?$("#app-mount").addClass("bda-dark"):$("#app-mount").removeClass("bda-dark"),document.querySelector(".messages")){let n=document.querySelector(".messages");s["bda-gs-6"]?mainCore.inject24Hour(n):mainCore.remove24Hour(n),s["bda-gs-7"]&&document.querySelector(".messages")?mainCore.injectColoredText(n):mainCore.removeColoredText(n)}if(s["bda-es-6"]){var r=$("
");$(document).on("mouseover",".emote",function(){var n=$(this),o=n.offset(),d=n.attr("alt");r.find(".tipsy-inner").text(d),$(".app").append($(r));var c=o.left+n.outerWidth()/2;r.css("left",c-r.outerWidth()/2),r.css("top",o.top-r.outerHeight())}),$(document).on("mouseleave",".emote",function(){$(".tipsy").remove()})}else $(document).off("mouseover",".emote");s["bda-gs-8"]?dMode.enable():dMode.disable(),mainCore.saveSettings()}renderSidebar(){let s=this;$("[class*=side] > [class*=item]").off("click.v2settingspanel").on("click.v2settingspanel",()=>{BDV2.reactDom.unmountComponentAtNode(s.root),$(s.root).hide(),$(".content-region").first().show()}),s.sidebar.render()}get coreComponent(){return BDV2.react.createElement(V2Components.Scroller,{fade:!0,dark:!0,children:[BDV2.react.createElement(V2Components.SettingsPanel,{key:"cspanel",title:"Core Settings",onChange:this.onChange,settings:this.coreSettings}),BDV2.react.createElement(V2Components.Tools,{key:"tools"})]})}get emoteComponent(){return BDV2.react.createElement(V2Components.Scroller,{fade:!0,dark:!0,children:[BDV2.react.createElement(V2Components.SettingsPanel,{key:"espanel",title:"Emote Settings",onChange:this.onChange,settings:this.emoteSettings}),BDV2.react.createElement(V2Components.Tools,{key:"tools"})]})}get customCssComponent(){return BDV2.react.createElement(V2Components.Scroller,{fade:!0,dark:!0,children:[BDV2.react.createElement(V2Components.CssEditor,{key:"csseditor"}),BDV2.react.createElement(V2Components.Tools,{key:"tools"})]})}get pluginsComponent(){let s=Object.keys(bdplugins).reduce((d,c)=>{return d.push(BDV2.react.createElement(V2Components.PluginCard,{key:c,plugin:bdplugins[c].plugin})),d},[]),r=BDV2.react.createElement(V2Components.List,{key:"plugin-list",className:"bda-slist",children:s}),n=BDV2.react.createElement("button",{key:"folder-button",className:"bd-pfbtn",onClick:()=>{betterDiscordIPC.send("asynchronous-message",{arg:"opendir",path:"plugindir"})}},"Open Plugin Folder"),o=BDV2.react.createElement(V2Components.ContentColumn,{key:"pcolumn",title:"Plugins",children:[n,r]});return BDV2.react.createElement(V2Components.Scroller,{fade:!0,dark:!0,children:[o,BDV2.react.createElement(V2Components.Tools,{key:"tools"})]})}get themesComponent(){let s=Object.keys(bdthemes).reduce((d,c)=>{return d.push(BDV2.react.createElement(V2Components.ThemeCard,{key:c,theme:bdthemes[c]})),d},[]),r=BDV2.react.createElement(V2Components.List,{key:"theme-list",className:"bda-slist",children:s}),n=BDV2.react.createElement("button",{key:"folder-button",className:"bd-pfbtn",onClick:()=>{betterDiscordIPC.send("asynchronous-message",{arg:"opendir",path:"themedir"})}},"Open Theme Folder"),o=BDV2.react.createElement(V2Components.ContentColumn,{key:"tcolumn",title:"Themes",children:[n,r]});return BDV2.react.createElement(V2Components.Scroller,{fade:!0,dark:!0,children:[o,BDV2.react.createElement(V2Components.Tools,{key:"tools"})]})}renderCoreSettings(){let s=this.root;return s?void BDV2.reactDom.render(this.coreComponent,s):void console.log("FAILED TO LOCATE ROOT: .layer .ui-standard-sidebar-view")}renderEmoteSettings(){let s=this.root;return s?void BDV2.reactDom.render(this.emoteComponent,s):void console.log("FAILED TO LOCATE ROOT: .layer .ui-standard-sidebar-view")}renderCustomCssEditor(){let s=this.root;return s?void BDV2.reactDom.render(this.customCssComponent,s):void console.log("FAILED TO LOCATE ROOT: .layer .ui-standard-sidebar-view")}renderPluginPane(){let s=this.root;return s?void BDV2.reactDom.render(this.pluginsComponent,s):void console.log("FAILED TO LOCATE ROOT: .layer .ui-standard-sidebar-view")}renderThemePane(){let s=this.root;return s?void BDV2.reactDom.render(this.themesComponent,s):void console.log("FAILED TO LOCATE ROOT: .layer .ui-standard-sidebar-view")}}