From dbcf2f9cefb3f2c82e21a58a7ef54e9c56ac3619 Mon Sep 17 00:00:00 2001 From: Zack Rauen Date: Fri, 27 Mar 2020 23:31:28 -0400 Subject: [PATCH] fix transparency --- js/main.js | 6 +++--- js/main.min.js | 2 +- src/modules/bdApi.js | 27 ++++----------------------- src/modules/settingsPanel.js | 6 +++--- src/modules/utils.js | 33 +++++++++++++++++++++++++++++++++ 5 files changed, 44 insertions(+), 30 deletions(-) diff --git a/js/main.js b/js/main.js index 8ed69d17..f1d6e4cb 100644 --- a/js/main.js +++ b/js/main.js @@ -155,7 +155,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _0gl /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _0globals__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../0globals */ \"./src/0globals.js\");\n/* harmony import */ var _core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./core */ \"./src/modules/core.js\");\n/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./utils */ \"./src/modules/utils.js\");\n/* harmony import */ var _v2__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./v2 */ \"./src/modules/v2.js\");\n/* harmony import */ var _dataStore__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./dataStore */ \"./src/modules/dataStore.js\");\n/* harmony import */ var _pluginModule__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./pluginModule */ \"./src/modules/pluginModule.js\");\n/* harmony import */ var _themeModule__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./themeModule */ \"./src/modules/themeModule.js\");\n/* harmony import */ var _settingsPanel__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./settingsPanel */ \"./src/modules/settingsPanel.js\");\n\n\n\n\n\n\n\n\nconst BdApi = {\n get React() {\n return _v2__WEBPACK_IMPORTED_MODULE_3__[\"default\"].React;\n },\n\n get ReactDOM() {\n return _v2__WEBPACK_IMPORTED_MODULE_3__[\"default\"].ReactDom;\n },\n\n get ReactComponent() {\n return _v2__WEBPACK_IMPORTED_MODULE_3__[\"default\"].ReactComponent;\n },\n\n get WindowConfigFile() {\n if (this._windowConfigFile) return this._windowConfigFile;\n\n const electron = __webpack_require__(/*! electron */ \"electron\").remote.app;\n\n const path = __webpack_require__(/*! path */ \"path\");\n\n const base = electron.getAppPath();\n const roamingBase = electron.getPath(\"userData\");\n const roamingLocation = path.resolve(roamingBase, electron.getVersion(), \"modules\", \"discord_desktop_core\", \"injector\", \"config.json\");\n const location = path.resolve(base, \"..\", \"app\", \"config.json\");\n\n const fs = __webpack_require__(/*! fs */ \"fs\");\n\n const realLocation = fs.existsSync(location) ? location : fs.existsSync(roamingLocation) ? roamingLocation : null;\n if (!realLocation) return this._windowConfigFile = null;\n return this._windowConfigFile = realLocation;\n },\n\n get settings() {\n return _0globals__WEBPACK_IMPORTED_MODULE_0__[\"settings\"];\n },\n\n get emotes() {\n return _0globals__WEBPACK_IMPORTED_MODULE_0__[\"bdEmotes\"];\n },\n\n get screenWidth() {\n return Math.max(document.documentElement.clientWidth, window.innerWidth || 0);\n },\n\n get screenHeight() {\n return Math.max(document.documentElement.clientHeight, window.innerHeight || 0);\n }\n\n};\n\nBdApi.getAllWindowPreferences = function () {\n if (!this.WindowConfigFile) return {}; // Tempfix until new injection on other platforms\n\n return require(this.WindowConfigFile);\n};\n\nBdApi.getWindowPreference = function (key) {\n if (!this.WindowConfigFile) return undefined; // Tempfix until new injection on other platforms\n\n return this.getAllWindowPreferences()[key];\n};\n\nBdApi.setWindowPreference = function (key, value) {\n if (!this.WindowConfigFile) return; // Tempfix until new injection on other platforms\n\n const fs = __webpack_require__(/*! fs */ \"fs\");\n\n const prefs = this.getAllWindowPreferences();\n prefs[key] = value;\n delete require.cache[this.WindowConfigFile];\n fs.writeFileSync(this.WindowConfigFile, JSON.stringify(prefs, null, 4));\n}; //Inject CSS to document head\n//id = id of element\n//css = custom css\n\n\nBdApi.injectCSS = function (id, css) {\n $(\"head\").append($(\"'),$("#customcss").text(this.editor.session.getValue()).detach().appendTo(document.head)}saveCss(){ee.setBDData("bdcustomcss",btoa(this.editor.session.getValue()))}}class Ye extends j.reactComponent{constructor(e){super(e);this.props.lines=0,this.setInitialState(),this.attach=this.attach.bind(this),this.detachedEditor=j.react.createElement(Qe,{attach:this.attach}),this.onClick=this.onClick.bind(this),this.updateCss=this.updateCss.bind(this),this.saveCss=this.saveCss.bind(this),this.detach=this.detach.bind(this)}setInitialState(){this.state={detached:this.props.detached||j.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",()=>{h["bda-css-0"]&&(this.saveCss(),this.updateCss())})}componentWillUnmount(){this.editor.destroy()}componentDidUpdate(e,t){const n=this;t.detached&&!n.state.detached&&j.reactDom.unmountComponentAtNode(n.detachedRoot)}codeMirror(){}get options(){return{lineNumbers:!0,mode:"css",indentUnit:4,theme:"material",scrollbarStyle:"simple"}}get css(){const e=ee.getBDData("bdcustomcss");let t="";return e&&""!==e&&(t=atob(e)),t}updateLineCount(){const e=this.refs.editor.value.split("\n").length;e!=this.props.lines&&(this.refs.lines.textContent=Array.from(new Array(e),(e,t)=>t+1).join(".\n")+".",this.props.lines=e)}render(){const e=this,{detached:t}=e.state;return j.react.createElement("div",{className:"contentColumn-2hrIYH contentColumnDefault-1VQkGM content-column default",style:{padding:"60px 40px 0px"}},t&&j.react.createElement("div",{id:"editor-detached"},j.react.createElement(Fe,{text:"Custom CSS Editor"}),j.react.createElement("h3",null,"Editor Detached"),j.react.createElement("button",{className:"btn btn-primary",onClick:()=>{e.attach()}},"Attach")),!t&&j.react.createElement("div",null,j.react.createElement(Fe,{text:"Custom CSS Editor"}),j.react.createElement("div",{className:"editor-wrapper"},j.react.createElement("div",{id:"bd-customcss-editor",className:"editor",ref:"editor"},e.css)),j.react.createElement("div",{id:"bd-customcss-attach-controls"},j.react.createElement("ul",{className:"checkbox-group"},j.react.createElement(Ze,{id:"live-update",text:"Live Update",onChange:this.onChange,checked:h["bda-css-0"]})),j.react.createElement("div",{id:"bd-customcss-detach-controls-button"},j.react.createElement("button",{style:{borderRadius:"3px 0 0 3px",borderRight:"1px solid #3f4146"},className:"btn btn-primary",onClick:()=>{e.onClick("update")}},"Update"),j.react.createElement("button",{style:{borderRadius:"0",borderLeft:"1px solid #2d2d2d",borderRight:"1px solid #2d2d2d"},className:"btn btn-primary",onClick:()=>{e.onClick("save")}},"Save"),j.react.createElement("button",{style:{borderRadius:"0 3px 3px 0",borderLeft:"1px solid #3f4146"},className:"btn btn-primary",onClick:()=>{e.onClick("detach")}},"Detach"),j.react.createElement("span",{style:{fontSize:"10px",marginLeft:"5px"}},"Unsaved changes are lost on detach"),j.react.createElement("div",{className:"help-text"},"Press ",j.react.createElement("code",{className:"inline"},"ctrl"),"+",j.react.createElement("span",{className:"inline"},",")," with the editor focused to access the editor's settings.")))))}onClick(e){const t=this;switch(e){case"update":t.updateCss();break;case"save":t.saveCss();break;case"detach":t.detach()}}onChange(e,t){switch(e){case"live-update":h["bda-css-0"]=t,yt.saveSettings()}}updateCss(){0==$("#customcss").length&&$("head").append(''),$("#customcss").text(this.editor.session.getValue()).detach().appendTo(document.head)}saveCss(){ee.setBDData("bdcustomcss",btoa(this.editor.session.getValue()))}detach(){this.setState({detached:!0});const e=this.detachedRoot;e?j.reactDom.render(this.detachedEditor,e):console.log("FAILED TO INJECT ROOT: .app")}get detachedRoot(){const e=$("#bd-customcss-detach-container");return e.length?e[0]:this.injectDetachedRoot()?this.detachedRoot:null}injectDetachedRoot(){return!!$(".app, .app-2rEoOp").length&&($("
",{id:"bd-customcss-detach-container"}).insertAfter($(".app, .app-2rEoOp")),!0)}attach(){this.setState({detached:!1})}}class Ke extends j.reactComponent{constructor(e){super(e),this.state={hasError:!1}}componentDidCatch(){this.setState({hasError:!0})}render(){return this.state.hasError?j.react.createElement("div",{className:"react-error"},"Component Error"):this.props.children}}class Xe extends j.reactComponent{constructor(e){super(e)}static get displayName(){return"ContentColumn"}render(){return j.react.createElement("div",{className:"contentColumn-2hrIYH contentColumnDefault-1VQkGM content-column default"},j.react.createElement("h2",{className:"ui-form-title h2 margin-reset margin-bottom-20"},this.props.title),this.props.children)}}class et extends j.reactComponent{constructor(e){super(e)}render(){return j.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"}},j.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"}),j.react.createElement("path",{fill:"none",d:"M0 0h24v24H0z"}))}}const tt=j.React;class nt extends tt.Component{render(){const e=this.props.size||"24px";return tt.createElement("svg",{className:this.props.className||"",viewBox:"0 0 24 24",fill:"#FFFFFF",style:{width:e,height:e},onClick:this.props.onClick},tt.createElement("path",{d:"M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34c-.39-.39-1.02-.39-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z"}),tt.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}))}}const st=j.React;class ot extends st.Component{render(){const e=this.props.size||"24px";return st.createElement("svg",{className:this.props.className||"",fill:"#FFFFFF",viewBox:"0 0 24 24",style:{width:e,height:e},onClick:this.props.onClick},st.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),st.createElement("path",{d:"M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zm2.46-7.12l1.41-1.41L12 12.59l2.12-2.12 1.41 1.41L13.41 14l2.12 2.12-1.41 1.41L12 15.41l-2.12 2.12-1.41-1.41L10.59 14l-2.13-2.12zM15.5 4l-1-1h-5l-1 1H5v2h14V4z"}),st.createElement("path",{fill:"none",d:"M0 0h24v24H0z"}))}}const it=j.React;class rt extends j.reactComponent{constructor(e){super(e),this.onChange=this.onChange.bind(this),this.showSettings=this.showSettings.bind(this),this.setInitialState(),this.hasSettings="function"==typeof this.props.addon.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(){if(!this.state.settings)return;if("object"==typeof this.settingsPanel&&this.refs.settingspanel.appendChild(this.settingsPanel),!h["fork-ps-3"])return;const e=$(j.reactDom.findDOMNode(this)),t=e.parents(".scroller");((e,t)=>{const n=e.scrollTop,s=n+e.clientHeight,o=t.offsetTop,i=o+t.clientHeight;return os})(t[0],e[0])&&t.animate({scrollTop:e.offset().top-t.offset().top+t.scrollTop()-30},300)}getString(e){return e?"string"==typeof e?e:e.toString():"???"}get settingsComponent(){const e=this.getString(this.props.addon.name);try{this.settingsPanel=this.props.addon.getSettingsPanel()}catch(e){O.err("Plugins","Unable to get settings panel for "+this.props.addon.name+".",e)}return j.react.createElement("div",{className:"bd-card bd-addon-card settings-open ui-switch-item"},j.react.createElement("div",{style:{float:"right",cursor:"pointer"},onClick:()=>{this.refs.settingspanel.innerHTML="",this.setState({settings:!1})}},j.react.createElement(Pe,null)),"object"==typeof this.settingsPanel&&j.react.createElement("div",{id:`plugin-settings-${e}`,className:"plugin-settings",ref:"settingspanel"}),"object"!=typeof this.settingsPanel&&j.react.createElement("div",{id:`plugin-settings-${e}`,className:"plugin-settings",ref:"settingspanel",dangerouslySetInnerHTML:{__html:this.settingsPanel}}))}buildTitle(e,t,n){const s="{{name}} v{{version}} by {{author}}".split(/({{[A-Za-z]+}})/),o=s.findIndex(e=>"{{name}}"==e);o&&(s[o]=it.createElement("span",{className:"name bda-name"},e));const i=s.findIndex(e=>"{{version}}"==e);o&&(s[i]=it.createElement("span",{className:"version bda-version"},t));const r=s.findIndex(e=>"{{author}}"==e);if(o){const e={className:"author bda-author"};(n.link||n.id)&&(e.className+=` ${j.anchorClasses.anchor} ${j.anchorClasses.anchorUnderlineOnHover}`,e.target="_blank",n.link&&(e.href=n.link),n.id&&(e.onClick=()=>{j.LayerStack.popLayer(),j.openDM(n.id)})),s[r]=it.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()}),j.react.createElement("a",n,e)}makeButton(e,t,n){return it.createElement(ve,{color:"black",side:"top",text:e},it.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]),j.LayerStack.popLayer(),j.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)&&j.react.createElement("div",{className:"bd-card-footer bda-footer"},j.react.createElement("span",{className:"bd-addon-links bda-links"},...e.map((t,n)=>n{document.addEventListener("click",this.hideMenu)})}hideMenu(){this.setState({open:!1},()=>{document.removeEventListener("click",this.hideMenu)})}onChange(e){this.setState({value:e}),this.props.onChange&&this.props.onChange(e)}get selected(){return this.props.options.find(e=>e.value==this.state.value)}get options(){const e=this.selected;return ct.createElement("div",{className:"bd-select-options"},this.props.options.map(t=>ct.createElement("div",{className:`bd-select-option${e.value==t.value?" selected":""}`,onClick:this.onChange.bind(this,t.value)},t.label)))}render(){const e="transparent"==this.props.style?" bd-select-transparent":"",t=this.state.open?" menu-open":"";return ct.createElement("div",{className:`bd-select${e}${t}`,onClick:this.showMenu,ref:this.dropdown},ct.createElement("div",{className:"bd-select-value"},this.selected.label),ct.createElement(lt,{className:"bd-select-arrow"}),this.state.open&&this.options)}}const ht=j.React;class ut extends ht.Component{render(){const e=this.props.size||"16px";return ht.createElement("svg",{className:this.props.className||"",fill:"#FFFFFF",viewBox:"0 0 24 24",style:{width:e,height:e}},ht.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),ht.createElement("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"}))}}const pt=j.React;class mt extends pt.Component{render(){return pt.createElement("div",{className:"bd-search-wrapper"},pt.createElement("input",{onChange:this.props.onChange,onKeyDown:this.props.onKeyDown,type:"text",className:"bd-search",placeholder:this.props.placeholder,maxLength:"50"}),pt.createElement(ut,null))}}function gt(){return(gt=Object.assign||function(e){for(var t=1;t{St.showConfirmationModal("Are You Sure?",`Are you sure you want to delete ${e}?`,{danger:!0,confirmText:"Delete",onConfirm:()=>{t(!0)},onCancel:()=>{t(!1)}})})}get sortOptions(){return[{label:"Name",value:"name"},{label:"Author",value:"author"},{label:"Version",value:"version"},{label:"Recently Added",value:"added"},{label:"Last Modified",value:"modified"},{label:"File Size",value:"size"}]}get directions(){return[{label:"Ascending",value:!0},{label:"Descending",value:!1}]}reverse(e){this.setState({ascending:e})}sort(e){this.setState({sort:e})}search(e){this.setState({query:e.target.value.toLocaleLowerCase()})}getProps(e){return{key:e.name,enabled:this.cookie[e.name],toggle:this.manager.toggle.bind(this.manager),edit:this.edit.bind(this),remove:this.delete.bind(this),addon:e}}getAddons(){const e=this.props.list.sort((e,t)=>{const n=e[this.state.sort],s=t[this.state.sort];return"string"==typeof n?n.toLocaleLowerCase().localeCompare(s.toLocaleLowerCase()):n>s?1:s>n?-1:0});return this.state.ascending||e.reverse(),e.map(e=>{if(this.state.query){let t=null;if(e.name&&(t=e.name.toLocaleLowerCase().includes(this.state.query)),e.author&&(t=t||e.author.toLocaleLowerCase().includes(this.state.query)),e.description&&(t=t||e.description.toLocaleLowerCase().includes(this.state.query)),e.version&&(t=t||e.version.toLocaleLowerCase().includes(this.state.query)),!t)return null}const t=this.getProps(e);return bt.createElement(Ke,null,bt.createElement(rt,gt({},t,{reload:!h["fork-ps-5"]&&this.manager.reload.bind(this.manager)})))})}render(){const e=bt.createElement(ft,{color:"black",position:"top",text:"Reload List"},e=>bt.createElement(et,gt({},e,{className:"bd-icon bd-reload bd-reload-header",size:"18px",onClick:async()=>{this.isPlugins?I.updatePluginList():q.updateThemeList(),this.forceUpdate()}}))),t=this.getAddons().filter(e=>e);return bt.createElement(Me,{contentColumn:!0,fade:!0,dark:!0},bt.createElement(Xe,{title:`${this.props.type.toUpperCase()}—${t.length}`},bt.createElement("button",{key:"folder-button",className:"bd-button bd-pfbtn",onClick:this.openFolder.bind(this)},"Open ",this.isPlugins?"Plugin":"Theme"," Folder"),!h["fork-ps-5"]&&e,bt.createElement("div",{className:"bd-controls bd-addon-controls"},bt.createElement(mt,{onChange:this.search,placeholder:`Search ${this.props.type}...`}),bt.createElement("div",{className:"bd-addon-dropdowns"},bt.createElement("div",{className:"bd-select-wrapper"},bt.createElement("label",{className:"bd-label"},"Sort by:"),bt.createElement(dt,{options:this.sortOptions,onChange:this.sort,style:"transparent"})),bt.createElement("div",{className:"bd-select-wrapper"},bt.createElement("label",{className:"bd-label"},"Order:"),bt.createElement(dt,{options:this.directions,onChange:this.reverse,style:"transparent"})))),bt.createElement("div",{className:"bda-slist bd-addon-list"},t)),bt.createElement($e,{key:"tools"}))}}var yt=new class{constructor(){this.sideBarOnClick=this.sideBarOnClick.bind(this),this.onChange=this.onChange.bind(this),this.updateSettings=this.updateSettings.bind(this),this.sidebar=new ye(this.sideBarOnClick),this.buildPluginProps=this.buildPluginProps.bind(this),this.buildThemeProps=this.buildThemeProps.bind(this)}get root(){const e=$("#bd-settingspane-container");return e.length?e[0]:this.injectRoot()?this.root:null}injectRoot(){if(!$(".layer-3QrUeG .standardSidebarView-3F1I7i, .layer-3QrUeG .ui-standard-sidebar-view").length)return!1;const e=$("
",{class:"contentRegion-3nDuYy content-region",id:"bd-settingspane-container"});return $(".layer-3QrUeG .standardSidebarView-3F1I7i, .layer-3QrUeG .ui-standard-sidebar-view").append(e),O.onRemoved(e[0],()=>{j.reactDom.unmountComponentAtNode(e[0])}),!0}get coreSettings(){const e=this.getSettings("core");return[...new Set(e.map(e=>e.category))].map(t=>({title:t,settings:e.filter(e=>e.category==t)}))}get emoteSettings(){return this.getSettings("emote")}getSettings(e){return Object.keys(c).reduce((t,n)=>{const s=c[n];return s.cat===e&&s.implemented&&!s.hidden&&(s.text=n,t.push(s)),t},[])}sideBarOnClick(e){const t=this;switch($(".contentRegion-3nDuYy, .content-region").first().hide(),$(t.root).show(),e){case"core":t.renderCoreSettings();break;case"emotes":t.renderEmoteSettings();break;case"customcss":t.renderCustomCssEditor();break;case"plugins":t.renderPluginPane();break;case"themes":t.renderThemePane()}}onClick(){}onChange(e,t){this.updateSettings(e,t)}updateSettings(e,t){h[e]=t,"bda-gs-2"==e&&(t?$("body").addClass("bd-minimal"):$("body").removeClass("bd-minimal")),"bda-gs-3"==e&&(t?$("body").addClass("bd-minimal-chan"):$("body").removeClass("bd-minimal-chan")),"bda-gs-1"==e&&(t?Le.addButton():Le.removeButton()),"bda-gs-4"==e&&(t?Re.enable():Re.disable()),"bda-gs-5"==e&&(t?$("#app-mount").addClass("bda-dark"):$("#app-mount").removeClass("bda-dark")),t&&"bda-gs-6"==e&&we.inject24Hour(),"bda-gs-7"==e&&(t?Ce.injectColoredText():Ce.removeColoredText()),"bda-es-4"==e&&(t?ie.autoCapitalize():ie.disableAutoCapitalize()),"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"))),"bda-gs-8"==e&&(t?ze.enable(h["fork-dm-1"]):ze.disable()),"fork-dm-1"==e&&h["bda-gs-8"]&&ze.enable(t),"reactDevTools"===e&&(t?Te.start():Te.stop()),this.saveSettings()}async initializeSettings(){h["bda-gs-2"]&&$("body").addClass("bd-minimal"),h["bda-gs-3"]&&$("body").addClass("bd-minimal-chan"),h["bda-gs-1"]&&Le.addButton(),h["bda-gs-4"]&&Re.enable(),h["bda-gs-5"]&&$("#app-mount").addClass("bda-dark"),h["bda-gs-6"]&&we.inject24Hour(),h["bda-gs-7"]&&Ce.injectColoredText(),h["bda-es-4"]&&ie.autoCapitalize(),h["fork-ps-4"]&&_e.start(),h["fork-ps-5"]&&(Q.watchContent("plugin"),Q.watchContent("theme")),h["bda-gs-8"]&&ze.enable(h["fork-dm-1"]),h.reactDevTools&&Te.start(),this.saveSettings()}saveSettings(){ee.setSettingGroup("settings",h)}loadSettings(){Object.assign(h,ee.getSettingGroup("settings"))}renderSidebar(){const e=this;$("[class*='side-'] > [class*='item-']").off("click.v2settingspanel").on("click.v2settingspanel",()=>{j.reactDom.unmountComponentAtNode(e.root),$(e.root).hide(),$(".contentRegion-3nDuYy, .content-region").first().show()}),e.sidebar.render()}get coreComponent(){return j.react.createElement(Me,{contentColumn:!0,fade:!0,dark:!0},j.react.createElement(Ue,{key:"cspanel",onChange:this.onChange,sections:this.coreSettings}),j.react.createElement($e,{key:"tools"}))}get emoteComponent(){return j.react.createElement(Me,{contentColumn:!0,fade:!0,dark:!0},j.react.createElement(Je,{key:"espanel",title:"Emote Settings",onChange:this.onChange,settings:this.emoteSettings,button:{title:"Clear Emote Cache",onClick:()=>{ie.clearEmoteData(),ie.init(),ne.init()}}}),j.react.createElement($e,{key:"tools"}))}get customCssComponent(){return j.react.createElement(Me,{contentColumn:!0,fade:!0,dark:!0},j.react.createElement(Ye,{key:"csseditor"}),j.react.createElement($e,{key:"tools"}))}contentComponent(e){const t=this.getAddonList(e),n=e.replace("s",""),s=this;class o extends j.react.Component{constructor(e){super(e),this.onChange=this.onChange.bind(this)}componentDidMount(){A.on(`${n}-reloaded`,this.onChange),A.on(`${n}-loaded`,this.onChange),A.on(`${n}-unloaded`,this.onChange)}componentWillUnmount(){A.off(`${n}-reloaded`,this.onChange),A.off(`${n}-loaded`,this.onChange),A.off(`${n}-unloaded`,this.onChange)}onChange(){s.sideBarOnClick(e)}render(){return t}}return j.react.createElement(o)}getString(e){return e?"string"==typeof e?e:e.toString():"???"}buildPluginProps(e){const t=e.plugin;return Object.assign({},e,{name:this.getString(t.getName()),author:this.getString(t.getAuthor()),description:this.getString(t.getDescription()),version:this.getString(t.getVersion()),getSettingsPanel:t.getSettingsPanel&&t.getSettingsPanel.bind(t)})}buildThemeProps(e){return Object.assign({},e,{name:this.getString(e.name),author:this.getString(e.author),description:this.getString(e.description),version:this.getString(e.version)})}getAddonList(e){const t="plugins"===e?Object.values(x).map(this.buildPluginProps):Object.values(E).map(this.buildThemeProps);return j.react.createElement(vt,{type:e,list:t})}renderCoreSettings(){const e=this.root;e?j.reactDom.render(this.coreComponent,e):console.log("FAILED TO LOCATE ROOT: .layer-3QrUeG .standardSidebarView-3F1I7i")}renderEmoteSettings(){const e=this.root;e?j.reactDom.render(this.emoteComponent,e):console.log("FAILED TO LOCATE ROOT: .layer-3QrUeG .standardSidebarView-3F1I7i")}renderCustomCssEditor(){const e=this.root;e?j.reactDom.render(this.customCssComponent,e):console.log("FAILED TO LOCATE ROOT: .layer-3QrUeG .standardSidebarView-3F1I7i")}renderPluginPane(){const e=this.root;e?j.reactDom.render(this.contentComponent("plugins"),e):console.log("FAILED TO LOCATE ROOT: .layer-3QrUeG .standardSidebarView-3F1I7i")}renderThemePane(){const e=this.root;e?j.reactDom.render(this.contentComponent("themes"),e):console.log("FAILED TO LOCATE ROOT: .layer-3QrUeG .standardSidebarView-3F1I7i")}};class Ct extends j.reactComponent{render(){return j.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"},j.react.createElement("metadata",null),j.react.createElement("defs",null,j.react.createElement("filter",{id:"shadow1"},j.react.createElement("feDropShadow",{dx:"20",dy:"0",stdDeviation:"20","flood-color":"rgba(0,0,0,0.35)"})),j.react.createElement("filter",{id:"shadow2"},j.react.createElement("feDropShadow",{dx:"15",dy:"0",stdDeviation:"20","flood-color":"rgba(255,255,255,0.15)"})),j.react.createElement("filter",{id:"shadow3"},j.react.createElement("feDropShadow",{dx:"10",dy:"0",stdDeviation:"20","flood-color":"rgba(0,0,0,0.35)"}))),j.react.createElement("g",null,j.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"}),j.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"}),j.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 wt(){}wt.prototype.setConfig=function(e){Object.assign(m,e)},wt.prototype.init=async function(){if(m.version
Please download the latest version from GitHub");if(window.ED)return void O.alert("Not Supported","BandagedBD does not work with EnhancedDiscord. Please uninstall one of them.");if(window.WebSocket&&window.WebSocket.name&&window.WebSocket.name.includes("Patched"))return void O.alert("Not Supported","BandagedBD does not work with Powercord. Please uninstall one of them.");const e=m.updater?m.updater.LatestVersion:m.latestVersion;e>m.version&&O.alert("Update Available",`\n An update for BandagedBD is available (${e})! Please Reinstall!

\n Download Installer\n `),O.log("Startup","Initializing Settings"),this.initSettings(),O.log("Startup","Initializing EmoteModule"),window.emotePromise=ie.init().then(()=>{ie.initialized=!0,O.log("Startup","Initializing QuickEmoteMenu"),ne.init()}),this.injectExternals(),await this.checkForGuilds(),j.initialize(),O.log("Startup","Updating Settings"),yt.initializeSettings(),O.log("Startup","Loading Plugins"),I.loadPlugins(),O.log("Startup","Loading Themes"),q.loadThemes(),$("#customcss").detach().appendTo(document.head),window.addEventListener("beforeunload",(function(){h["bda-dc-0"]&&document.querySelector(".btn.btn-disconnect").click()})),ie.autoCapitalize(),O.log("Startup","Removing Loading Icon"),document.getElementsByClassName("bd-loaderv2").length&&document.getElementsByClassName("bd-loaderv2")[0].remove(),O.log("Startup","Initializing Main Observer"),this.initObserver(),h["fork-ps-1"]&&(O.log("Startup","Collecting Startup Errors"),O.showContentErrors({plugins:u,themes:p}));const t=ee.getBDData("version");a>t&&(l&&this.showChangelogModal(l),ee.setBDData("version",a)),O.suppressErrors(this.patchSocial.bind(this),"BD Social Patch")(),O.suppressErrors(this.patchGuildPills.bind(this),"BD Guild Pills Patch")(),O.suppressErrors(this.patchGuildListItems.bind(this),"BD Guild List Items Patch")(),O.suppressErrors(this.patchGuildSeparator.bind(this),"BD Guild Separator Patch")()},wt.prototype.checkForGuilds=function(){let e=0;return new Promise(t=>{const n=function(){const s=j.guildClasses.wrapper.split(" ")[0];document.querySelectorAll(`.${s}`).length>0&&e++;const o=j.guildClasses.listItem.split(" ")[0],i=j.guildClasses.blobContainer.split(" ")[0];return document.querySelectorAll(`.${s} .${o} .${i}`).length>0||e>=50?t(m.deferLoaded=!0):void setTimeout(n,100)};$(document).ready((function(){setTimeout(n,100)}))})},wt.prototype.injectExternals=async function(){await O.injectJs("https://cdnjs.cloudflare.com/ajax/libs/ace/1.2.9/ace.js"),window.require.original&&(window.require=window.require.original)},wt.prototype.initSettings=function(){if(ee.initialize(),ee.getSettingGroup("settings")){yt.loadSettings(),$(''),$("#customcss").text(this.editor.session.getValue()).detach().appendTo(document.head)}saveCss(){ee.setBDData("bdcustomcss",btoa(this.editor.session.getValue()))}}class Ye extends j.reactComponent{constructor(e){super(e);this.props.lines=0,this.setInitialState(),this.attach=this.attach.bind(this),this.detachedEditor=j.react.createElement(Qe,{attach:this.attach}),this.onClick=this.onClick.bind(this),this.updateCss=this.updateCss.bind(this),this.saveCss=this.saveCss.bind(this),this.detach=this.detach.bind(this)}setInitialState(){this.state={detached:this.props.detached||j.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",()=>{h["bda-css-0"]&&(this.saveCss(),this.updateCss())})}componentWillUnmount(){this.editor.destroy()}componentDidUpdate(e,t){const n=this;t.detached&&!n.state.detached&&j.reactDom.unmountComponentAtNode(n.detachedRoot)}codeMirror(){}get options(){return{lineNumbers:!0,mode:"css",indentUnit:4,theme:"material",scrollbarStyle:"simple"}}get css(){const e=ee.getBDData("bdcustomcss");let t="";return e&&""!==e&&(t=atob(e)),t}updateLineCount(){const e=this.refs.editor.value.split("\n").length;e!=this.props.lines&&(this.refs.lines.textContent=Array.from(new Array(e),(e,t)=>t+1).join(".\n")+".",this.props.lines=e)}render(){const e=this,{detached:t}=e.state;return j.react.createElement("div",{className:"contentColumn-2hrIYH contentColumnDefault-1VQkGM content-column default",style:{padding:"60px 40px 0px"}},t&&j.react.createElement("div",{id:"editor-detached"},j.react.createElement(Fe,{text:"Custom CSS Editor"}),j.react.createElement("h3",null,"Editor Detached"),j.react.createElement("button",{className:"btn btn-primary",onClick:()=>{e.attach()}},"Attach")),!t&&j.react.createElement("div",null,j.react.createElement(Fe,{text:"Custom CSS Editor"}),j.react.createElement("div",{className:"editor-wrapper"},j.react.createElement("div",{id:"bd-customcss-editor",className:"editor",ref:"editor"},e.css)),j.react.createElement("div",{id:"bd-customcss-attach-controls"},j.react.createElement("ul",{className:"checkbox-group"},j.react.createElement(Ze,{id:"live-update",text:"Live Update",onChange:this.onChange,checked:h["bda-css-0"]})),j.react.createElement("div",{id:"bd-customcss-detach-controls-button"},j.react.createElement("button",{style:{borderRadius:"3px 0 0 3px",borderRight:"1px solid #3f4146"},className:"btn btn-primary",onClick:()=>{e.onClick("update")}},"Update"),j.react.createElement("button",{style:{borderRadius:"0",borderLeft:"1px solid #2d2d2d",borderRight:"1px solid #2d2d2d"},className:"btn btn-primary",onClick:()=>{e.onClick("save")}},"Save"),j.react.createElement("button",{style:{borderRadius:"0 3px 3px 0",borderLeft:"1px solid #3f4146"},className:"btn btn-primary",onClick:()=>{e.onClick("detach")}},"Detach"),j.react.createElement("span",{style:{fontSize:"10px",marginLeft:"5px"}},"Unsaved changes are lost on detach"),j.react.createElement("div",{className:"help-text"},"Press ",j.react.createElement("code",{className:"inline"},"ctrl"),"+",j.react.createElement("span",{className:"inline"},",")," with the editor focused to access the editor's settings.")))))}onClick(e){const t=this;switch(e){case"update":t.updateCss();break;case"save":t.saveCss();break;case"detach":t.detach()}}onChange(e,t){switch(e){case"live-update":h["bda-css-0"]=t,yt.saveSettings()}}updateCss(){0==$("#customcss").length&&$("head").append(''),$("#customcss").text(this.editor.session.getValue()).detach().appendTo(document.head)}saveCss(){ee.setBDData("bdcustomcss",btoa(this.editor.session.getValue()))}detach(){this.setState({detached:!0});const e=this.detachedRoot;e?j.reactDom.render(this.detachedEditor,e):console.log("FAILED TO INJECT ROOT: .app")}get detachedRoot(){const e=$("#bd-customcss-detach-container");return e.length?e[0]:this.injectDetachedRoot()?this.detachedRoot:null}injectDetachedRoot(){return!!$(".app, .app-2rEoOp").length&&($("
",{id:"bd-customcss-detach-container"}).insertAfter($(".app, .app-2rEoOp")),!0)}attach(){this.setState({detached:!1})}}class Ke extends j.reactComponent{constructor(e){super(e),this.state={hasError:!1}}componentDidCatch(){this.setState({hasError:!0})}render(){return this.state.hasError?j.react.createElement("div",{className:"react-error"},"Component Error"):this.props.children}}class Xe extends j.reactComponent{constructor(e){super(e)}static get displayName(){return"ContentColumn"}render(){return j.react.createElement("div",{className:"contentColumn-2hrIYH contentColumnDefault-1VQkGM content-column default"},j.react.createElement("h2",{className:"ui-form-title h2 margin-reset margin-bottom-20"},this.props.title),this.props.children)}}class et extends j.reactComponent{constructor(e){super(e)}render(){return j.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"}},j.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"}),j.react.createElement("path",{fill:"none",d:"M0 0h24v24H0z"}))}}const tt=j.React;class nt extends tt.Component{render(){const e=this.props.size||"24px";return tt.createElement("svg",{className:this.props.className||"",viewBox:"0 0 24 24",fill:"#FFFFFF",style:{width:e,height:e},onClick:this.props.onClick},tt.createElement("path",{d:"M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34c-.39-.39-1.02-.39-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z"}),tt.createElement("path",{d:"M0 0h24v24H0z",fill:"none"}))}}const st=j.React;class ot extends st.Component{render(){const e=this.props.size||"24px";return st.createElement("svg",{className:this.props.className||"",fill:"#FFFFFF",viewBox:"0 0 24 24",style:{width:e,height:e},onClick:this.props.onClick},st.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),st.createElement("path",{d:"M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zm2.46-7.12l1.41-1.41L12 12.59l2.12-2.12 1.41 1.41L13.41 14l2.12 2.12-1.41 1.41L12 15.41l-2.12 2.12-1.41-1.41L10.59 14l-2.13-2.12zM15.5 4l-1-1h-5l-1 1H5v2h14V4z"}),st.createElement("path",{fill:"none",d:"M0 0h24v24H0z"}))}}const it=j.React;class rt extends j.reactComponent{constructor(e){super(e),this.onChange=this.onChange.bind(this),this.showSettings=this.showSettings.bind(this),this.setInitialState(),this.hasSettings="function"==typeof this.props.addon.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(){if(!this.state.settings)return;if("object"==typeof this.settingsPanel&&this.refs.settingspanel.appendChild(this.settingsPanel),!h["fork-ps-3"])return;const e=$(j.reactDom.findDOMNode(this)),t=e.parents(".scroller");((e,t)=>{const n=e.scrollTop,s=n+e.clientHeight,o=t.offsetTop,i=o+t.clientHeight;return os})(t[0],e[0])&&t.animate({scrollTop:e.offset().top-t.offset().top+t.scrollTop()-30},300)}getString(e){return e?"string"==typeof e?e:e.toString():"???"}get settingsComponent(){const e=this.getString(this.props.addon.name);try{this.settingsPanel=this.props.addon.getSettingsPanel()}catch(e){O.err("Plugins","Unable to get settings panel for "+this.props.addon.name+".",e)}return j.react.createElement("div",{className:"bd-card bd-addon-card settings-open ui-switch-item"},j.react.createElement("div",{style:{float:"right",cursor:"pointer"},onClick:()=>{this.refs.settingspanel.innerHTML="",this.setState({settings:!1})}},j.react.createElement(Te,null)),"object"==typeof this.settingsPanel&&j.react.createElement("div",{id:`plugin-settings-${e}`,className:"plugin-settings",ref:"settingspanel"}),"object"!=typeof this.settingsPanel&&j.react.createElement("div",{id:`plugin-settings-${e}`,className:"plugin-settings",ref:"settingspanel",dangerouslySetInnerHTML:{__html:this.settingsPanel}}))}buildTitle(e,t,n){const s="{{name}} v{{version}} by {{author}}".split(/({{[A-Za-z]+}})/),o=s.findIndex(e=>"{{name}}"==e);o&&(s[o]=it.createElement("span",{className:"name bda-name"},e));const i=s.findIndex(e=>"{{version}}"==e);o&&(s[i]=it.createElement("span",{className:"version bda-version"},t));const r=s.findIndex(e=>"{{author}}"==e);if(o){const e={className:"author bda-author"};(n.link||n.id)&&(e.className+=` ${j.anchorClasses.anchor} ${j.anchorClasses.anchorUnderlineOnHover}`,e.target="_blank",n.link&&(e.href=n.link),n.id&&(e.onClick=()=>{j.LayerStack.popLayer(),j.openDM(n.id)})),s[r]=it.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()}),j.react.createElement("a",n,e)}makeButton(e,t,n){return it.createElement(ve,{color:"black",side:"top",text:e},it.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]),j.LayerStack.popLayer(),j.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)&&j.react.createElement("div",{className:"bd-card-footer bda-footer"},j.react.createElement("span",{className:"bd-addon-links bda-links"},...e.map((t,n)=>n{document.addEventListener("click",this.hideMenu)})}hideMenu(){this.setState({open:!1},()=>{document.removeEventListener("click",this.hideMenu)})}onChange(e){this.setState({value:e}),this.props.onChange&&this.props.onChange(e)}get selected(){return this.props.options.find(e=>e.value==this.state.value)}get options(){const e=this.selected;return ct.createElement("div",{className:"bd-select-options"},this.props.options.map(t=>ct.createElement("div",{className:`bd-select-option${e.value==t.value?" selected":""}`,onClick:this.onChange.bind(this,t.value)},t.label)))}render(){const e="transparent"==this.props.style?" bd-select-transparent":"",t=this.state.open?" menu-open":"";return ct.createElement("div",{className:`bd-select${e}${t}`,onClick:this.showMenu,ref:this.dropdown},ct.createElement("div",{className:"bd-select-value"},this.selected.label),ct.createElement(lt,{className:"bd-select-arrow"}),this.state.open&&this.options)}}const ht=j.React;class ut extends ht.Component{render(){const e=this.props.size||"16px";return ht.createElement("svg",{className:this.props.className||"",fill:"#FFFFFF",viewBox:"0 0 24 24",style:{width:e,height:e}},ht.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),ht.createElement("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"}))}}const pt=j.React;class mt extends pt.Component{render(){return pt.createElement("div",{className:"bd-search-wrapper"},pt.createElement("input",{onChange:this.props.onChange,onKeyDown:this.props.onKeyDown,type:"text",className:"bd-search",placeholder:this.props.placeholder,maxLength:"50"}),pt.createElement(ut,null))}}function gt(){return(gt=Object.assign||function(e){for(var t=1;t{St.showConfirmationModal("Are You Sure?",`Are you sure you want to delete ${e}?`,{danger:!0,confirmText:"Delete",onConfirm:()=>{t(!0)},onCancel:()=>{t(!1)}})})}get sortOptions(){return[{label:"Name",value:"name"},{label:"Author",value:"author"},{label:"Version",value:"version"},{label:"Recently Added",value:"added"},{label:"Last Modified",value:"modified"},{label:"File Size",value:"size"}]}get directions(){return[{label:"Ascending",value:!0},{label:"Descending",value:!1}]}reverse(e){this.setState({ascending:e})}sort(e){this.setState({sort:e})}search(e){this.setState({query:e.target.value.toLocaleLowerCase()})}getProps(e){return{key:e.name,enabled:this.cookie[e.name],toggle:this.manager.toggle.bind(this.manager),edit:this.edit.bind(this),remove:this.delete.bind(this),addon:e}}getAddons(){const e=this.props.list.sort((e,t)=>{const n=e[this.state.sort],s=t[this.state.sort];return"string"==typeof n?n.toLocaleLowerCase().localeCompare(s.toLocaleLowerCase()):n>s?1:s>n?-1:0});return this.state.ascending||e.reverse(),e.map(e=>{if(this.state.query){let t=null;if(e.name&&(t=e.name.toLocaleLowerCase().includes(this.state.query)),e.author&&(t=t||e.author.toLocaleLowerCase().includes(this.state.query)),e.description&&(t=t||e.description.toLocaleLowerCase().includes(this.state.query)),e.version&&(t=t||e.version.toLocaleLowerCase().includes(this.state.query)),!t)return null}const t=this.getProps(e);return bt.createElement(Ke,null,bt.createElement(rt,gt({},t,{reload:!h["fork-ps-5"]&&this.manager.reload.bind(this.manager)})))})}render(){const e=bt.createElement(ft,{color:"black",position:"top",text:"Reload List"},e=>bt.createElement(et,gt({},e,{className:"bd-icon bd-reload bd-reload-header",size:"18px",onClick:async()=>{this.isPlugins?I.updatePluginList():W.updateThemeList(),this.forceUpdate()}}))),t=this.getAddons().filter(e=>e);return bt.createElement(Me,{contentColumn:!0,fade:!0,dark:!0},bt.createElement(Xe,{title:`${this.props.type.toUpperCase()}—${t.length}`},bt.createElement("button",{key:"folder-button",className:"bd-button bd-pfbtn",onClick:this.openFolder.bind(this)},"Open ",this.isPlugins?"Plugin":"Theme"," Folder"),!h["fork-ps-5"]&&e,bt.createElement("div",{className:"bd-controls bd-addon-controls"},bt.createElement(mt,{onChange:this.search,placeholder:`Search ${this.props.type}...`}),bt.createElement("div",{className:"bd-addon-dropdowns"},bt.createElement("div",{className:"bd-select-wrapper"},bt.createElement("label",{className:"bd-label"},"Sort by:"),bt.createElement(dt,{options:this.sortOptions,onChange:this.sort,style:"transparent"})),bt.createElement("div",{className:"bd-select-wrapper"},bt.createElement("label",{className:"bd-label"},"Order:"),bt.createElement(dt,{options:this.directions,onChange:this.reverse,style:"transparent"})))),bt.createElement("div",{className:"bda-slist bd-addon-list"},t)),bt.createElement($e,{key:"tools"}))}}var yt=new class{constructor(){this.sideBarOnClick=this.sideBarOnClick.bind(this),this.onChange=this.onChange.bind(this),this.updateSettings=this.updateSettings.bind(this),this.sidebar=new ye(this.sideBarOnClick),this.buildPluginProps=this.buildPluginProps.bind(this),this.buildThemeProps=this.buildThemeProps.bind(this)}get root(){const e=$("#bd-settingspane-container");return e.length?e[0]:this.injectRoot()?this.root:null}injectRoot(){if(!$(".layer-3QrUeG .standardSidebarView-3F1I7i, .layer-3QrUeG .ui-standard-sidebar-view").length)return!1;const e=$("
",{class:"contentRegion-3nDuYy content-region",id:"bd-settingspane-container"});return $(".layer-3QrUeG .standardSidebarView-3F1I7i, .layer-3QrUeG .ui-standard-sidebar-view").append(e),O.onRemoved(e[0],()=>{j.reactDom.unmountComponentAtNode(e[0])}),!0}get coreSettings(){const e=this.getSettings("core");return[...new Set(e.map(e=>e.category))].map(t=>({title:t,settings:e.filter(e=>e.category==t)}))}get emoteSettings(){return this.getSettings("emote")}getSettings(e){return Object.keys(c).reduce((t,n)=>{const s=c[n];return s.cat===e&&s.implemented&&!s.hidden&&(s.text=n,t.push(s)),t},[])}sideBarOnClick(e){const t=this;switch($(".contentRegion-3nDuYy, .content-region").first().hide(),$(t.root).show(),e){case"core":t.renderCoreSettings();break;case"emotes":t.renderEmoteSettings();break;case"customcss":t.renderCustomCssEditor();break;case"plugins":t.renderPluginPane();break;case"themes":t.renderThemePane()}}onClick(){}onChange(e,t){this.updateSettings(e,t)}updateSettings(e,t){h[e]=t,"bda-gs-2"==e&&(t?$("body").addClass("bd-minimal"):$("body").removeClass("bd-minimal")),"bda-gs-3"==e&&(t?$("body").addClass("bd-minimal-chan"):$("body").removeClass("bd-minimal-chan")),"bda-gs-1"==e&&(t?Le.addButton():Le.removeButton()),"bda-gs-4"==e&&(t?Re.enable():Re.disable()),"bda-gs-5"==e&&(t?$("#app-mount").addClass("bda-dark"):$("#app-mount").removeClass("bda-dark")),t&&"bda-gs-6"==e&&we.inject24Hour(),"bda-gs-7"==e&&(t?Ce.injectColoredText():Ce.removeColoredText()),"bda-es-4"==e&&(t?ie.autoCapitalize():ie.disableAutoCapitalize()),"fork-ps-4"==e&&(t?_e.start():_e.stop()),"fork-ps-5"==e&&(t?(Q.watchContent("plugin"),Q.watchContent("theme")):(Q.unwatchContent("plugin"),Q.unwatchContent("theme"))),"fork-wp-1"==e&&(O.setWindowPreference("transparent",t),t?O.setWindowPreference("backgroundColor",null):O.setWindowPreference("backgroundColor","#2f3136")),"bda-gs-8"==e&&(t?qe.enable(h["fork-dm-1"]):qe.disable()),"fork-dm-1"==e&&h["bda-gs-8"]&&qe.enable(t),"reactDevTools"===e&&(t?Pe.start():Pe.stop()),this.saveSettings()}async initializeSettings(){h["bda-gs-2"]&&$("body").addClass("bd-minimal"),h["bda-gs-3"]&&$("body").addClass("bd-minimal-chan"),h["bda-gs-1"]&&Le.addButton(),h["bda-gs-4"]&&Re.enable(),h["bda-gs-5"]&&$("#app-mount").addClass("bda-dark"),h["bda-gs-6"]&&we.inject24Hour(),h["bda-gs-7"]&&Ce.injectColoredText(),h["bda-es-4"]&&ie.autoCapitalize(),h["fork-ps-4"]&&_e.start(),h["fork-ps-5"]&&(Q.watchContent("plugin"),Q.watchContent("theme")),h["bda-gs-8"]&&qe.enable(h["fork-dm-1"]),h.reactDevTools&&Pe.start(),this.saveSettings()}saveSettings(){ee.setSettingGroup("settings",h)}loadSettings(){Object.assign(h,ee.getSettingGroup("settings"))}renderSidebar(){const e=this;$("[class*='side-'] > [class*='item-']").off("click.v2settingspanel").on("click.v2settingspanel",()=>{j.reactDom.unmountComponentAtNode(e.root),$(e.root).hide(),$(".contentRegion-3nDuYy, .content-region").first().show()}),e.sidebar.render()}get coreComponent(){return j.react.createElement(Me,{contentColumn:!0,fade:!0,dark:!0},j.react.createElement(Ue,{key:"cspanel",onChange:this.onChange,sections:this.coreSettings}),j.react.createElement($e,{key:"tools"}))}get emoteComponent(){return j.react.createElement(Me,{contentColumn:!0,fade:!0,dark:!0},j.react.createElement(Je,{key:"espanel",title:"Emote Settings",onChange:this.onChange,settings:this.emoteSettings,button:{title:"Clear Emote Cache",onClick:()=>{ie.clearEmoteData(),ie.init(),ne.init()}}}),j.react.createElement($e,{key:"tools"}))}get customCssComponent(){return j.react.createElement(Me,{contentColumn:!0,fade:!0,dark:!0},j.react.createElement(Ye,{key:"csseditor"}),j.react.createElement($e,{key:"tools"}))}contentComponent(e){const t=this.getAddonList(e),n=e.replace("s",""),s=this;class o extends j.react.Component{constructor(e){super(e),this.onChange=this.onChange.bind(this)}componentDidMount(){A.on(`${n}-reloaded`,this.onChange),A.on(`${n}-loaded`,this.onChange),A.on(`${n}-unloaded`,this.onChange)}componentWillUnmount(){A.off(`${n}-reloaded`,this.onChange),A.off(`${n}-loaded`,this.onChange),A.off(`${n}-unloaded`,this.onChange)}onChange(){s.sideBarOnClick(e)}render(){return t}}return j.react.createElement(o)}getString(e){return e?"string"==typeof e?e:e.toString():"???"}buildPluginProps(e){const t=e.plugin;return Object.assign({},e,{name:this.getString(t.getName()),author:this.getString(t.getAuthor()),description:this.getString(t.getDescription()),version:this.getString(t.getVersion()),getSettingsPanel:t.getSettingsPanel&&t.getSettingsPanel.bind(t)})}buildThemeProps(e){return Object.assign({},e,{name:this.getString(e.name),author:this.getString(e.author),description:this.getString(e.description),version:this.getString(e.version)})}getAddonList(e){const t="plugins"===e?Object.values(x).map(this.buildPluginProps):Object.values(E).map(this.buildThemeProps);return j.react.createElement(vt,{type:e,list:t})}renderCoreSettings(){const e=this.root;e?j.reactDom.render(this.coreComponent,e):console.log("FAILED TO LOCATE ROOT: .layer-3QrUeG .standardSidebarView-3F1I7i")}renderEmoteSettings(){const e=this.root;e?j.reactDom.render(this.emoteComponent,e):console.log("FAILED TO LOCATE ROOT: .layer-3QrUeG .standardSidebarView-3F1I7i")}renderCustomCssEditor(){const e=this.root;e?j.reactDom.render(this.customCssComponent,e):console.log("FAILED TO LOCATE ROOT: .layer-3QrUeG .standardSidebarView-3F1I7i")}renderPluginPane(){const e=this.root;e?j.reactDom.render(this.contentComponent("plugins"),e):console.log("FAILED TO LOCATE ROOT: .layer-3QrUeG .standardSidebarView-3F1I7i")}renderThemePane(){const e=this.root;e?j.reactDom.render(this.contentComponent("themes"),e):console.log("FAILED TO LOCATE ROOT: .layer-3QrUeG .standardSidebarView-3F1I7i")}};class Ct extends j.reactComponent{render(){return j.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"},j.react.createElement("metadata",null),j.react.createElement("defs",null,j.react.createElement("filter",{id:"shadow1"},j.react.createElement("feDropShadow",{dx:"20",dy:"0",stdDeviation:"20","flood-color":"rgba(0,0,0,0.35)"})),j.react.createElement("filter",{id:"shadow2"},j.react.createElement("feDropShadow",{dx:"15",dy:"0",stdDeviation:"20","flood-color":"rgba(255,255,255,0.15)"})),j.react.createElement("filter",{id:"shadow3"},j.react.createElement("feDropShadow",{dx:"10",dy:"0",stdDeviation:"20","flood-color":"rgba(0,0,0,0.35)"}))),j.react.createElement("g",null,j.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"}),j.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"}),j.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 wt(){}wt.prototype.setConfig=function(e){Object.assign(m,e)},wt.prototype.init=async function(){if(m.version
Please download the latest version from GitHub");if(window.ED)return void O.alert("Not Supported","BandagedBD does not work with EnhancedDiscord. Please uninstall one of them.");if(window.WebSocket&&window.WebSocket.name&&window.WebSocket.name.includes("Patched"))return void O.alert("Not Supported","BandagedBD does not work with Powercord. Please uninstall one of them.");const e=m.updater?m.updater.LatestVersion:m.latestVersion;e>m.version&&O.alert("Update Available",`\n An update for BandagedBD is available (${e})! Please Reinstall!

\n Download Installer\n `),O.log("Startup","Initializing Settings"),this.initSettings(),O.log("Startup","Initializing EmoteModule"),window.emotePromise=ie.init().then(()=>{ie.initialized=!0,O.log("Startup","Initializing QuickEmoteMenu"),ne.init()}),this.injectExternals(),await this.checkForGuilds(),j.initialize(),O.log("Startup","Updating Settings"),yt.initializeSettings(),O.log("Startup","Loading Plugins"),I.loadPlugins(),O.log("Startup","Loading Themes"),W.loadThemes(),$("#customcss").detach().appendTo(document.head),window.addEventListener("beforeunload",(function(){h["bda-dc-0"]&&document.querySelector(".btn.btn-disconnect").click()})),ie.autoCapitalize(),O.log("Startup","Removing Loading Icon"),document.getElementsByClassName("bd-loaderv2").length&&document.getElementsByClassName("bd-loaderv2")[0].remove(),O.log("Startup","Initializing Main Observer"),this.initObserver(),h["fork-ps-1"]&&(O.log("Startup","Collecting Startup Errors"),O.showContentErrors({plugins:u,themes:p}));const t=ee.getBDData("version");a>t&&(l&&this.showChangelogModal(l),ee.setBDData("version",a)),O.suppressErrors(this.patchSocial.bind(this),"BD Social Patch")(),O.suppressErrors(this.patchGuildPills.bind(this),"BD Guild Pills Patch")(),O.suppressErrors(this.patchGuildListItems.bind(this),"BD Guild List Items Patch")(),O.suppressErrors(this.patchGuildSeparator.bind(this),"BD Guild Separator Patch")()},wt.prototype.checkForGuilds=function(){let e=0;return new Promise(t=>{const n=function(){const s=j.guildClasses.wrapper.split(" ")[0];document.querySelectorAll(`.${s}`).length>0&&e++;const o=j.guildClasses.listItem.split(" ")[0],i=j.guildClasses.blobContainer.split(" ")[0];return document.querySelectorAll(`.${s} .${o} .${i}`).length>0||e>=50?t(m.deferLoaded=!0):void setTimeout(n,100)};$(document).ready((function(){setTimeout(n,100)}))})},wt.prototype.injectExternals=async function(){await O.injectJs("https://cdnjs.cloudflare.com/ajax/libs/ace/1.2.9/ace.js"),window.require.original&&(window.require=window.require.original)},wt.prototype.initSettings=function(){if(ee.initialize(),ee.getSettingGroup("settings")){yt.loadSettings(),$('