Please download the latest version from GitHub");
+ ui__WEBPACK_IMPORTED_MODULE_8__["Modals"].alert("Not Supported", "BetterDiscord v" + data__WEBPACK_IMPORTED_MODULE_2__["Config"].version + " (your version)" + " is not supported by the latest js (" + data__WEBPACK_IMPORTED_MODULE_2__["Config"].bbdVersion + ").
Please download the latest version from GitHub");
return;
}
const latestLocalVersion = data__WEBPACK_IMPORTED_MODULE_2__["Config"].updater ? data__WEBPACK_IMPORTED_MODULE_2__["Config"].updater.LatestVersion : data__WEBPACK_IMPORTED_MODULE_2__["Config"].latestVersion;
if (latestLocalVersion > data__WEBPACK_IMPORTED_MODULE_2__["Config"].version) {
- this.alert("Update Available", `
+ ui__WEBPACK_IMPORTED_MODULE_8__["Modals"].alert("Update Available", `
An update for BandagedBD is available (${latestLocalVersion})! Please Reinstall!
Download Installer
`);
}
_utilities__WEBPACK_IMPORTED_MODULE_1__["default"].log("Startup", "Initializing Settings");
- this.initSettings();
+ _settingspanel__WEBPACK_IMPORTED_MODULE_6__["default"].initialize();
_utilities__WEBPACK_IMPORTED_MODULE_1__["default"].log("Startup", "Initializing EmoteModule");
window.emotePromise = _emotes__WEBPACK_IMPORTED_MODULE_3__["default"].init().then(() => {
_emotes__WEBPACK_IMPORTED_MODULE_3__["default"].initialized = true;
_utilities__WEBPACK_IMPORTED_MODULE_1__["default"].log("Startup", "Initializing QuickEmoteMenu");
- _emotemenu__WEBPACK_IMPORTED_MODULE_4__["default"].init();
+ _emitter__WEBPACK_IMPORTED_MODULE_9__["default"].dispatch("emotes-loaded"); // QuickEmoteMenu.init();
});
this.injectExternals();
await this.checkForGuilds();
_bdv2__WEBPACK_IMPORTED_MODULE_0__["default"].initialize();
_utilities__WEBPACK_IMPORTED_MODULE_1__["default"].log("Startup", "Updating Settings");
- _settingspanel__WEBPACK_IMPORTED_MODULE_8__["default"].initializeSettings();
+ _settingspanel__WEBPACK_IMPORTED_MODULE_6__["default"].initializeSettings();
- for (const module in builtins__WEBPACK_IMPORTED_MODULE_9__) builtins__WEBPACK_IMPORTED_MODULE_9__[module].initialize();
+ for (const module in builtins__WEBPACK_IMPORTED_MODULE_7__) builtins__WEBPACK_IMPORTED_MODULE_7__[module].initialize();
_utilities__WEBPACK_IMPORTED_MODULE_1__["default"].log("Startup", "Loading Plugins");
- const pluginErrors = _pluginmanager__WEBPACK_IMPORTED_MODULE_5__["default"].loadPlugins();
+ const pluginErrors = _pluginmanager__WEBPACK_IMPORTED_MODULE_4__["default"].loadPlugins();
_utilities__WEBPACK_IMPORTED_MODULE_1__["default"].log("Startup", "Loading Themes");
- const themeErrors = _thememanager__WEBPACK_IMPORTED_MODULE_6__["default"].loadThemes();
- $("#customcss").detach().appendTo(document.head);
- window.addEventListener("beforeunload", function () {
- if (data__WEBPACK_IMPORTED_MODULE_2__["SettingsCookie"]["bda-dc-0"]) document.querySelector(".btn.btn-disconnect").click();
- }); // PublicServers.initialize();
+ const themeErrors = _thememanager__WEBPACK_IMPORTED_MODULE_5__["default"].loadThemes();
+ $("#customcss").detach().appendTo(document.head); // PublicServers.initialize();
_emotes__WEBPACK_IMPORTED_MODULE_3__["default"].autoCapitalize();
_utilities__WEBPACK_IMPORTED_MODULE_1__["default"].log("Startup", "Removing Loading Icon");
@@ -1922,15 +2211,11 @@ Core.prototype.init = async function () {
if (data__WEBPACK_IMPORTED_MODULE_2__["SettingsCookie"]["fork-ps-1"]) {
_utilities__WEBPACK_IMPORTED_MODULE_1__["default"].log("Startup", "Collecting Startup Errors");
- this.showContentErrors({
+ ui__WEBPACK_IMPORTED_MODULE_8__["Modals"].showContentErrors({
plugins: pluginErrors,
themes: themeErrors
});
- } // if (!DataStore.getBDData(bbdVersion)) {
- // BdApi.alert("BBD Updated!", ["Lots of things were fixed in this update like Public Servers, Minimal Mode, Dark Mode and 24 Hour Timestamps.", BdApi.React.createElement("br"), BdApi.React.createElement("br"), "Feel free to test them all out!"]);
- // DataStore.setBDData(bbdVersion, true);
- // }
-
+ }
};
Core.prototype.checkForGuilds = function () {
@@ -1954,32 +2239,11 @@ Core.prototype.injectExternals = async function () {
if (window.require.original) window.require = window.require.original;
};
-Core.prototype.initSettings = function () {
- _datastore__WEBPACK_IMPORTED_MODULE_7__["default"].initialize();
- if (!_datastore__WEBPACK_IMPORTED_MODULE_7__["default"].getSettingGroup("settings")) return this.saveSettings();
- const savedSettings = this.loadSettings();
- $("'),$("#customcss").text(this.editor.session.getValue()).detach().appendTo(document.head)}saveCss(){w.setBDData("bdcustomcss",btoa(this.editor.session.getValue()))}}class ge extends g.React.Component{constructor(e){super(e),this.props.lines=0,this.setInitialState(),this.attach=this.attach.bind(this),this.detachedEditor=g.React.createElement(me,{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||W.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",()=>{i["bda-css-0"]&&(this.saveCss(),this.updateCss())})}componentWillUnmount(){this.editor.destroy()}componentDidUpdate(e,t){t.detached&&!this.state.detached&&g.ReactDOM.unmountComponentAtNode(this.detachedRoot)}codeMirror(){}get options(){return{lineNumbers:!0,mode:"css",indentUnit:4,theme:"material",scrollbarStyle:"simple"}}get css(){const e=w.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 g.React.createElement("div",{className:"contentColumn-2hrIYH contentColumnDefault-1VQkGM content-column default",style:{padding:"60px 40px 0px"}},t&&g.React.createElement("div",{id:"editor-detached"},g.React.createElement(ne,{text:"Custom CSS Editor"}),g.React.createElement("h3",null,"Editor Detached"),g.React.createElement("button",{className:"btn btn-primary",onClick:()=>{e.attach()}},"Attach")),!t&&g.React.createElement("div",null,g.React.createElement(ne,{text:"Custom CSS Editor"}),g.React.createElement("div",{className:"editor-wrapper"},g.React.createElement("div",{id:"bd-customcss-editor",className:"editor",ref:"editor"},e.css)),g.React.createElement("div",{id:"bd-customcss-attach-controls"},g.React.createElement("ul",{className:"checkbox-group"},g.React.createElement(pe,{id:"live-update",text:"Live Update",onChange:this.onChange,checked:i["bda-css-0"]})),g.React.createElement("div",{id:"bd-customcss-detach-controls-button"},g.React.createElement("button",{style:{borderRadius:"3px 0 0 3px",borderRight:"1px solid #3f4146"},className:"btn btn-primary",onClick:()=>{e.onClick("update")}},"Update"),g.React.createElement("button",{style:{borderRadius:"0",borderLeft:"1px solid #2d2d2d",borderRight:"1px solid #2d2d2d"},className:"btn btn-primary",onClick:()=>{e.onClick("save")}},"Save"),g.React.createElement("button",{style:{borderRadius:"0 3px 3px 0",borderLeft:"1px solid #3f4146"},className:"btn btn-primary",onClick:()=>{e.onClick("detach")}},"Detach"),g.React.createElement("span",{style:{fontSize:"10px",marginLeft:"5px"}},"Unsaved changes are lost on detach"),g.React.createElement("div",{className:"help-text"},"Press ",g.React.createElement("code",{className:"inline"},"ctrl"),"+",g.React.createElement("span",{className:"inline"},",")," with the editor focused to access the editor's settings.")))))}onClick(e){switch(e){case"update":this.updateCss();break;case"save":this.saveCss();break;case"detach":this.detach()}}onChange(e,t){switch(e){case"live-update":i["bda-css-0"]=t,je.saveSettings()}}updateCss(){0==$("#customcss").length&&$("head").append(''),$("#customcss").text(this.editor.session.getValue()).detach().appendTo(document.head)}saveCss(){w.setBDData("bdcustomcss",btoa(this.editor.session.getValue()))}detach(){this.setState({detached:!0});const e=this.detachedRoot;e?g.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 fe{constructor(e){this.sideBarOnClick=this.sideBarOnClick.bind(this),this.onChange=e.onChange,this.sidebar=new X(this.sideBarOnClick)}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),m.onRemoved(e[0],()=>{_.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(r).reduce((t,s)=>{const n=r[s];return n.cat===e&&n.implemented&&!n.hidden&&(n.text=s,t.push(n)),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()}}renderSidebar(){const e=this;$("[class*='side-'] > [class*='item-']").off("click.v2settingspanel").on("click.v2settingspanel",()=>{_.unmountComponentAtNode(e.root),$(e.root).hide(),$(".contentRegion-3nDuYy, .content-region").first().show()}),e.sidebar.render()}get coreComponent(){return U.createElement(ee,{contentColumn:!0,fade:!0,dark:!0,children:[U.createElement(ie,{key:"cspanel",onChange:this.onChange,sections:this.coreSettings}),U.createElement(le,{key:"tools"})]})}get emoteComponent(){return U.createElement(ee,{contentColumn:!0,fade:!0,dark:!0,children:[U.createElement(ce,{key:"espanel",title:"Emote Settings",onChange:this.onChange,settings:this.emoteSettings,button:{title:"Clear Emote Cache",onClick:()=>{q.clearEmoteData(),q.init(),L.init()}}}),U.createElement(le,{key:"tools"})]})}get customCssComponent(){return U.createElement(ee,{contentColumn:!0,fade:!0,dark:!0,children:[U.createElement(ge,{key:"csseditor"}),U.createElement(le,{key:"tools"})]})}contentComponent(e){const t="plugins"==e?this.pluginsComponent:this.themesComponent,s=e.replace("s",""),n=this;return U.createElement(class extends U.Component{constructor(e){super(e),this.onChange=this.onChange.bind(this)}componentDidMount(){x.on(`${s}-reloaded`,this.onChange),x.on(`${s}-loaded`,this.onChange),x.on(`${s}-unloaded`,this.onChange)}componentWillUnmount(){x.off(`${s}-reloaded`,this.onChange),x.off(`${s}-loaded`,this.onChange),x.off(`${s}-unloaded`,this.onChange)}onChange(){n.sideBarOnClick(e)}render(){return t}})}get pluginsComponent(){const e=Object.keys(u).sort((e,t)=>e.toLowerCase().localeCompare(t.toLowerCase())).reduce((e,t)=>(e.push(U.createElement(ue,{key:t,plugin:u[t].plugin})),e),[]),t=U.createElement(te,{key:"plugin-list",className:"bda-slist",children:e}),n=!i["fork-ps-5"]&&U.createElement(de,{className:"bd-reload-header",size:"18px",onClick:async()=>{D.updatePluginList(),this.sideBarOnClick("plugins")}}),o=U.createElement("button",{key:"folder-button",className:"bd-pfbtn",onClick:()=>{s(1).shell.openItem(A.pluginsFolder)}},"Open Plugin Folder"),r=U.createElement(se,{key:"pcolumn",title:"Plugins",children:[n,o,t]});return U.createElement(ee,{contentColumn:!0,fade:!0,dark:!0,children:[r,U.createElement(le,{key:"tools"})]})}get themesComponent(){const e=Object.keys(d).sort((e,t)=>e.toLowerCase().localeCompare(t.toLowerCase())).reduce((e,t)=>(e.push(U.createElement(he,{key:t,theme:d[t]})),e),[]),t=U.createElement(te,{key:"theme-list",className:"bda-slist",children:e}),n=!i["fork-ps-5"]&&U.createElement(de,{className:"bd-reload-header",size:"18px",onClick:async()=>{T.updateThemeList(),this.sideBarOnClick("themes")}}),o=U.createElement("button",{key:"folder-button",className:"bd-pfbtn",onClick:()=>{s(1).shell.openItem(A.themesFolder)}},"Open Theme Folder"),r=U.createElement(se,{key:"tcolumn",title:"Themes",children:[n,o,t]});return U.createElement(ee,{contentColumn:!0,fade:!0,dark:!0,children:[r,U.createElement(le,{key:"tools"})]})}renderCoreSettings(){const e=this.root;e?_.render(this.coreComponent,e):console.log("FAILED TO LOCATE ROOT: .layer-3QrUeG .standardSidebarView-3F1I7i")}renderEmoteSettings(){const e=this.root;e?_.render(this.emoteComponent,e):console.log("FAILED TO LOCATE ROOT: .layer-3QrUeG .standardSidebarView-3F1I7i")}renderCustomCssEditor(){const e=this.root;e?_.render(this.customCssComponent,e):console.log("FAILED TO LOCATE ROOT: .layer-3QrUeG .standardSidebarView-3F1I7i")}renderPluginPane(){const e=this.root;e?_.render(this.contentComponent("plugins"),e):console.log("FAILED TO LOCATE ROOT: .layer-3QrUeG .standardSidebarView-3F1I7i")}renderThemePane(){const e=this.root;e?_.render(this.contentComponent("themes"),e):console.log("FAILED TO LOCATE ROOT: .layer-3QrUeG .standardSidebarView-3F1I7i")}}class be extends U.Component{constructor(e){super(e)}render(){const{sidebar:e,content:t,tools:s}=this.props.children;return U.createElement("div",{className:"standardSidebarView-3F1I7i ui-standard-sidebar-view"},U.createElement("div",{className:"sidebarRegion-VFTUkN sidebar-region"},U.createElement(ee,{key:"sidebarScroller",ref:"sidebarScroller",sidebar:!0,fade:e.fade||!0,dark:e.dark||!0,children:e.component})),U.createElement("div",{className:"contentRegion-3nDuYy content-region"},U.createElement("div",{className:"contentTransitionWrap-3hqOEW content-transition-wrap"},U.createElement("div",{className:"scrollerWrap-2lJEkd firefoxFixScrollFlex-cnI2ix contentRegionScrollerWrap-3YZXdm content-region-scroller-wrap scrollerThemed-2oenus themeGhost-28MSn0 scrollerTrack-1ZIpsv"},U.createElement("div",{className:"scroller-2FKFPG firefoxFixScrollFlex-cnI2ix contentRegionScroller-26nc1e content-region-scroller scroller",ref:"contentScroller"},U.createElement("div",{className:"contentColumn-2hrIYH contentColumnDefault-1VQkGM content-column default"},t.component),s.component)))))}}class ye extends U.Component{constructor(e){super(e),this.props.server.iconUrl||(this.props.server.iconUrl=this.props.fallback),this.state={imageError:!1,joined:this.props.guildList.includes(this.props.server.identifier)}}render(){const{server:e}=this.props;return U.createElement("div",{className:`card-3Qj_Yx cardPrimary-1Hv-to marginBottom8-AtZOdT bd-server-card${e.pinned?" bd-server-card-pinned":""}`},U.createElement("img",{ref:"img",className:"bd-server-image",src:e.iconUrl,onError:this.handleError.bind(this)}),U.createElement("div",{className:"flexChild-faoVW3 bd-server-content"},U.createElement("div",{className:"flex-1xMQg5 flex-1O1GKY horizontal-1ae9ci horizontal-2EEEnY directionRow-3v3tfG noWrap-3jynv6 bd-server-header"},U.createElement("h5",{className:"h5-18_1nd defaultColor-1_ajX0 margin-reset bd-server-name"},e.name),U.createElement("h5",{className:"h5-18_1nd defaultColor-1_ajX0 margin-reset bd-server-member-count"},e.members," Members")),U.createElement("div",{className:"flex-1xMQg5 flex-1O1GKY horizontal-1ae9ci horizontal-2EEEnY directionRow-3v3tfG noWrap-3jynv6"},U.createElement("div",{className:"scrollerWrap-2lJEkd scrollerThemed-2oenus themeGhostHairline-DBD-2d scrollerFade-1Ijw5y bd-server-description-container"},U.createElement("div",{className:"scroller-2FKFPG scroller bd-server-description"},e.description))),U.createElement("div",{className:"flex-1xMQg5 flex-1O1GKY horizontal-1ae9ci horizontal-2EEEnY directionRow-3v3tfG noWrap-3jynv6 bd-server-footer"},U.createElement("div",{className:"flexChild-faoVW3 bd-server-tags",style:{flex:"1 1 auto"}},e.categories.join(", ")),this.state.joined&&U.createElement("button",{type:"button",className:"button-38aScr lookFilled-1Gx00P colorBrand-3pXr91 sizeMin-1mJd1x grow-q77ONN colorGreen-29iAKY",style:{minHeight:"12px",marginTop:"4px",backgroundColor:"#3ac15c"}},U.createElement("div",{className:"ui-button-contents"},"Joined")),e.error&&U.createElement("button",{type:"button",className:"button-38aScr lookFilled-1Gx00P colorBrand-3pXr91 sizeMin-1mJd1x grow-q77ONN disabled-9aF2ug",style:{minHeight:"12px",marginTop:"4px",backgroundColor:"#c13a3a"}},U.createElement("div",{className:"ui-button-contents"},"Error")),!e.error&&!this.state.joined&&U.createElement("button",{type:"button",className:"button-38aScr lookFilled-1Gx00P colorBrand-3pXr91 sizeMin-1mJd1x grow-q77ONN",style:{minHeight:"12px",marginTop:"4px"},onClick:()=>{this.join()}},U.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 ve extends U.Component{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=b.getByProps("getGuilds"),this.AvatarDefaults=b.getByProps("getUserAvatarURL","DEFAULT_AVATARS"),this.InviteActions=b.getByProps("acceptInvite"),this.SortedGuildStore=b.getByProps("getSortedGuilds")}componentDidMount(){this.checkConnection()}setInitialState(){this.state={selectedCategory:-1,title:"Loading...",loading:!0,servers:[],next:null,connection:{state:0,user:null}}}close(){_.unmountComponentAtNode(document.getElementById(this.props.rootId))}search(e,t){const s=this;$.ajax({method:"GET",url:`${s.endPoint}${e}${e?"&schema=new":"?schema=new"}`,success:e=>{let n=e.results.reduce((e,t)=>(t.joined=!1,e.push(t),e),[]);t||(n=s.state.servers.concat(n));let o=e.size+e.from;e.next=`?from=${o}`,s.state.term&&(e.next+=`&term=${s.state.term}`),s.state.selectedCategory&&(e.next+=`&category=${s.categoryButtons[s.state.selectedCategory]}`),o>=e.total&&(o=e.total,e.next=null);let r=`Showing 1-${o} of ${e.total} results in ${s.categoryButtons[s.state.selectedCategory]}`;s.state.term&&(r+=` for ${s.state.term}`),s.setState({loading:!1,title:r,servers:n,next:e.next}),t&&(s.refs.sbv.refs.contentScroller.scrollTop=0)},error:()=>{s.setState({loading:!1,title:"Failed to load servers. Check console for details"})}})}join(e){if(e.props.pinned)return this.InviteActions.acceptInvite(e.props.invite_code);$.ajax({method:"GET",url:`${this.joinEndPoint}/${e.props.server.identifier}`,headers:{Accept:"application/json;","Content-Type":"application/json;","x-discord-token":this.state.connection.user.accessToken},crossDomain:!0,xhrFields:{withCredentials:!0},success:()=>{e.setState({joined:!0})}})}connect(){const e=this.windowOptions;e.x=Math.round(window.screenX+window.innerWidth/2-e.width/2),e.y=Math.round(window.screenY+window.innerHeight/2-e.height/2),this.joinWindow=new(window.require("electron").remote.BrowserWindow)(e);this.joinWindow.webContents.on("did-navigate",(e,t)=>{"https://auth.discordservers.com/info"==t&&(this.joinWindow.close(),this.checkConnection())}),this.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.guildPositions,t=this.AvatarDefaults.DEFAULT_AVATARS;return U.createElement(ye,{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"}checkConnection(){const e=this;try{$.ajax({method:"GET",url:"https://auth.discordservers.com/info",headers:{Accept:"application/json;","Content-Type":"application/json;"},crossDomain:!0,xhrFields:{withCredentials:!0},success:t=>{e.setState({selectedCategory:0,connection:{state:2,user:t}}),e.search("",!0)},error:()=>{e.setState({title:"Not connected to discordservers.com!",loading:!0,selectedCategory:-1,connection:{state:1,user:null}})}})}catch(t){e.setState({title:"Not connected to discordservers.com!",loading:!0,selectedCategory:-1,connection:{state:1,user:null}})}}render(){return U.createElement(be,{ref:"sbv",children:this.component})}get component(){return{sidebar:{component:this.sidebar},content:{component:this.content},tools:{component:U.createElement(le,{key:"pt",ref:"tools",onClick:this.close})}}}get sidebar(){return U.createElement("div",{className:"sidebar",key:"ps"},U.createElement("div",{className:"ui-tab-bar SIDE"},U.createElement("div",{className:"ui-tab-bar-header",style:{fontSize:"16px"}},"Public Servers"),U.createElement(Q.Separator,null),this.searchInput,U.createElement(Q.Separator,null),U.createElement(Q.Header,{text:"Categories"}),this.categoryButtons.map((e,t)=>U.createElement(Q.Item,{id:t,onClick:this.changeCategory,key:t,text:e,selected:this.state.selectedCategory===t})),U.createElement(Q.Separator,null),this.footer,this.connection))}get searchInput(){return U.createElement("div",{className:"ui-form-item"},U.createElement("div",{className:"ui-text-input flex-vertical",style:{width:"172px",marginLeft:"10px"}},U.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 s=`?term=${e.target.value}`;0!==t.state.selectedCategory&&(s+=`&category=${t.categoryButtons[t.state.selectedCategory]}`),t.search(s,!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.guildPositions,s=this.AvatarDefaults.DEFAULT_AVATARS;return 1===e.state.connection.state?e.notConnected:[U.createElement("div",{ref:"content",key:"pc",className:"contentColumn-2hrIYH contentColumnDefault-1VQkGM content-column default"},U.createElement(ne,{text:e.state.title}),e.bdServer,e.state.servers.map(n=>U.createElement(ye,{key:n.identifier,server:n,join:e.join,guildList:t,fallback:s[Math.floor(5*Math.random())]})),e.state.next&&U.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"}},U.createElement("div",{className:"ui-button-contents"},e.state.loading?"Loading":"Load More")),e.state.servers.length>0&&U.createElement(ne,{text:e.state.title}))]}get notConnected(){return[U.createElement("div",{key:"ncc",ref:"content",className:"contentColumn-2hrIYH contentColumnDefault-1VQkGM content-column default"},U.createElement("h2",{className:"ui-form-title h2 margin-reset margin-bottom-20"},"Not connected to discordservers.com!",U.createElement("button",{onClick:this.connect,type:"button",className:"ui-button filled brand small grow",style:{display:"inline-block",minHeight:"18px",marginLeft:"10px",lineHeight:"14px"}},U.createElement("div",{className:"ui-button-contents"},"Connect"))),this.bdServer)]}get footer(){return U.createElement("div",{className:"ui-tab-bar-header"},U.createElement("a",{href:"https://discordservers.com",target:"_blank"},"Discordservers.com"))}get connection(){const{connection:e}=this.state;return 2!==e.state?U.createElement("span",null):U.createElement("span",null,U.createElement(Q.Separator,null),U.createElement("span",{style:{color:"#b9bbbe",fontSize:"10px",marginLeft:"10px"}},"Connected as: ",`${e.user.username}#${e.user.discriminator}`),U.createElement("div",{style:{padding:"5px 10px 0 10px"}},U.createElement("button",{style:{width:"100%",minHeight:"20px"},type:"button",className:"ui-button filled brand small grow"},U.createElement("div",{className:"ui-button-contents",onClick:this.connect},"Reconnect"))))}}class Ce extends U.Component{constructor(e){super(e)}componentDidMount(){$(window).on(`keyup.${this.props.id}`,e=>{27===e.which&&_.unmountComponentAtNode(this.refs.root.parentNode)}),$(`#${this.props.id}`).animate({opacity:1},{step:function(e){$(this).css("transform",`scale(${1.1-.1*e}) translateZ(0px)`)},duration:200,done:()=>{$(`#${this.props.id}`).css("opacity","").css("transform","")}})}componentWillUnmount(){$(window).off(`keyup.${this.props.id}`),$(`#${this.props.id}`).animate({opacity:0},{step:function(e){$(this).css("transform",`scale(${1.1-.1*e}) translateZ(0px)`)},duration:200,done:()=>{$(`#${this.props.rootId}`).remove()}}),$('[class*="layer-"]').removeClass("publicServersOpen").animate({opacity:1},{step:function(e){$(this).css("transform",`scale(${.07*e+.93}) translateZ(0px)`)},duration:200,done:()=>{$('[class*="layer-"]').css("opacity","").css("transform","")}})}componentWillMount(){$('[class*="layer-"]').addClass("publicServersOpen").animate({opacity:0},{step:function(e){$(this).css("transform",`scale(${.07*e+.93}) translateZ(0px)`)},duration:200})}render(){return U.createElement("div",{className:"layer bd-layer layer-3QrUeG",id:this.props.id,ref:"root",style:{opacity:0,transform:"scale(1.1) translateZ(0px)"}},this.props.children)}}var we=new class{constructor(){this.renderer=new fe({onChange:this.updateSettings.bind(this)})}renderSidebar(){this.renderer.renderSidebar()}updateSettings(e,t){x.dispatch("setting-updated","Modules",e,t),i[e]=t,"bda-es-4"==e&&(t?q.autoCapitalize():q.disableAutoCapitalize()),"fork-ps-5"==e&&(t?(A.watchContent("plugin"),A.watchContent("theme")):(A.unwatchContent("plugin"),A.unwatchContent("theme"))),"fork-wp-1"==e&&(k.setWindowPreference("transparent",t),t?k.setWindowPreference("backgroundColor",null):k.setWindowPreference("backgroundColor","#2f3136")),je.saveSettings()}initializeSettings(){i["bda-es-4"]&&q.autoCapitalize(),i["fork-ps-5"]&&(A.watchContent("plugin"),A.watchContent("theme")),je.saveSettings()}};function Ee(e,t,s,n){const o=(o,r,i)=>{e===o&&r===t&&(i?s():n())};return x.on("setting-updated",o),()=>{x.off("setting-updated",o)}}class ke{get name(){return"Unnamed Builtin"}get category(){return"Modules"}get id(){return"None"}async initialize(){i[this.id]&&await this.enable(),x.on("setting-updated",(e,t,s)=>{e===this.category&&t===this.id&&(s?this.enable():this.disable())})}async enable(){this.log("Enabled"),await this.enabled()}async disable(){this.log("Disabled"),await this.disabled()}async enabled(){}async disabled(){}log(...e){m.log(this.name,...e)}warn(...e){m.warn(this.name,...e)}error(...e){m.err(this.name,...e)}}var Se=new class extends ke{get name(){return"VoiceMode"}get category(){return"Modules"}get id(){return"bda-gs-4"}enabled(){$(".scroller.guild-channels ul").first().css("display","none"),$(".scroller.guild-channels header").first().css("display","none"),$(".app.flex-vertical, .app-2rEoOp").first().css("overflow","hidden"),$(".chat-3bRxxu").first().css("visibility","hidden").css("min-width","0px"),$(".flex-vertical.channels-wrap").first().css("flex-grow","100000"),$(".guild-header .btn.btn-hamburger").first().css("visibility","hidden")}disabled(){$(".scroller.guild-channels ul").first().css("display",""),$(".scroller.guild-channels header").first().css("display",""),$(".app.flex-vertical, .app-2rEoOp").first().css("overflow",""),$(".chat-3bRxxu").first().css("visibility","").css("min-width",""),$(".flex-vertical.channels-wrap").first().css("flex-grow",""),$(".guild-header .btn.btn-hamburger").first().css("visibility","")}};const xe=new RegExp("^(?!da-)((?:[A-Za-z]|[0-9]|-)+)-(?:[A-Za-z]|[0-9]|-|_){6}$");var Pe=new class extends ke{get id(){return"fork-ps-4"}get category(){return"Modules"}get name(){return"ClassNormalizer"}disabled(){this.hasPatched&&(this.unpatchClassModules(b.getModules(this.moduleFilter.bind(this))),this.revertElement(document.querySelector("#app-mount")),this.hasPatched=!1)}enabled(){this.hasPatched||(this.patchClassModules(b.getModules(this.moduleFilter.bind(this))),this.normalizeElement(document.querySelector("#app-mount")),this.hasPatched=!0)}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 s=e[t];if("string"!=typeof s)return!1;if(!this.shouldIgnore(s)){if(1===s.split("-").length)return!1;if(!xe.test(s.split(" ")[0]))return!1}}return!0}patchClassModule(e,t){for(const s in t){const n=t[s];if(this.shouldIgnore(n))continue;const o=n.split(" ");for(const n of o){const o=n.match(xe)[1];if(!o)continue;const r=o.split("-").map((e,t)=>t?e[0].toUpperCase()+e.slice(1):e).join("");t[s]+=` ${e}-${r}`}}}unpatchClassModule(e,t){for(const s in t){const n=t[s];if(this.shouldIgnore(n))continue;let o="";const r=n.split(" ");for(const t of r)t.startsWith(`${e}-`)||(o+=` ${t}`);t[s]=o.trim()}}normalizeElement(e){if(!(e instanceof Element))return;const t=e.classList;for(let s=0,n=t.length;st?e[0].toUpperCase()+e.slice(1):e).join("");e.classList.add(`da-${n}`)}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,s=[];for(let e=0;e{119!==e.which&&118!=e.which||this.log("Debugger Activated")}),this.selectorMode&&this.enableSelectors(),this.selectorCancel=Ee(this.category,this.selectorModeID,this.enableSelectors,this.disableSelectors)}disabled(){$(window).off("keydown.bdDevmode"),this.selectorMode&&this.disableSelectors(),this.selectorCancel&&this.selectorCancel()}enableSelectors(){$(document).on("contextmenu.bdDevmode",e=>{this.lastSelector=this.getSelector(e.toElement);setImmediate(()=>{let t=$(".contextMenu-HLZMGh");t.length<=0&&((t=$('')).addClass($(".app, .app-2rEoOp").hasClass("theme-dark")?"theme-dark":"theme-light"),t.appendTo(".app, .app-2rEoOp"),t.css("top",e.clientY),t.css("left",e.clientX),$(document).on("click.bdDevModeCtx",()=>{t.remove(),$(document).off(".bdDevModeCtx")}),$(document).on("contextmenu.bdDevModeCtx",()=>{t.remove(),$(document).off(".bdDevModeCtx")}),$(document).on("keyup.bdDevModeCtx",e=>{27===e.keyCode&&(t.remove(),$(document).off(".bdDevModeCtx"))}));const s=$("",{class:"itemGroup-1tL0uz"}),n=$("",{class:"item-1Yvehc",click:()=>{g.ElectronModule.copy(this.lastSelector),t.hide()}}).append($("",{text:"Copy Selector"}));s.append(n),t.append(s),t.hasClass("undefined")&&t.css("top","-="+s.outerHeight())}),e.stopPropagation()})}disableSelectors(){$(document).off("contextmenu.bdDevmode"),$(document).off("contextmenu.bdDevModeCtx")}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("*"))}getSelector(e){if(e.id)return`#${e.id}`;const t=this.getRules(e),s=t[t.length-1];return s?s.selectorText:e.classList.length?`.${Array.from(e.classList).join(".")}`:`.${Array.from(e.parentElement.classList).join(".")}`}},Ne=new class extends ke{get name(){return"PublicServers"}get category(){return"Modules"}get id(){return"bda-gs-1"}enabled(){const e=W.guildClasses.wrapper.split(" ")[0];$(`.${e} .scroller-2FKFPG >:first-child`).after(this.button)}disabled(){$("#bd-pub-li").remove()}get component(){return g.React.createElement(n.Layer,{rootId:"pubslayerroot",id:"pubslayer"},g.React.createElement(n.Menu,{rootId:"pubslayerroot"}))}get root(){const e=document.getElementById("pubslayerroot");return e||(this.injectRoot()?this.root:null)}injectRoot(){return!!$(".layers, .layers-3iHuyZ").length&&($(".layers, .layers-3iHuyZ").append($("",{id:"pubslayerroot"})),!0)}render(){const e=this.root;e?g.ReactDOM.render(this.component,e):console.log("FAILED TO LOCATE ROOT: .layers")}get button(){return $("",{class:W.guildClasses.listItem,id:"bd-pub-li",style:i["bda-gs-1"]?"":"display: none;"}).append($("",{class:"wrapper-25eVIn "+W.guildClasses.circleButtonMask,text:"public",id:"bd-pub-button",click:()=>{this.render()}}))}},Te=new class extends ke{get name(){return"DarkMode"}get category(){return"Modules"}get id(){return"bda-gs-5"}enabled(){$("#app-mount").addClass("bda-dark").addClass("bd-dark")}disabled(){$("#app-mount").removeClass("bda-dark").removeClass("bd-dark")}},$e=new class extends ke{get name(){return"MinimalMode"}get category(){return"Modules"}get id(){return"bda-gs-2"}get hideChannelsID(){return"bda-gs-3"}get hideChannels(){return i[this.hideChannelsID]}constructor(){super(),this.enableHideChannels=this.enableHideChannels.bind(this),this.disableHideChannels=this.disableHideChannels.bind(this)}enabled(){$("body").addClass("bd-minimal"),this.hideChannels&&this.enableHideChannels(),this.hideChannelCancel=Ee(this.category,this.hideChannelsID,this.enableHideChannels,this.disableHideChannels)}disabled(){$("body").removeClass("bd-minimal"),this.hideChannels&&this.disableHideChannels(),this.hideChannelCancel&&this.hideChannelCancel()}enableHideChannels(){$("body").addClass("bd-minimal-chan")}disableHideChannels(){$("body").removeClass("bd-minimal-chan")}},Be=new class extends ke{get name(){return"24Hour"}get category(){return"Modules"}get id(){return"bda-gs-6"}enabled(){this.inject24Hour()}disabled(){this.cancel24Hour&&this.cancel24Hour()}inject24Hour(){if(this.cancel24Hour)return;const e=new RegExp("([0-9]{1,2}):([0-9]{1,2})\\s(AM|PM)"),t=t=>{const s=t.returnValue.match(e);if(s&&4===s.length)return"AM"===s[3]?t.returnValue=t.returnValue.replace(s[0],`${"12"===s[1]?"00":s[1].padStart(2,"0")}:${s[2]}`):t.returnValue=t.returnValue.replace(s[0],`${"12"===s[1]?"12":parseInt(s[1])+12}:${s[2]}`)},s=m.monkeyPatch(g.TimeFormatter,"calendarFormat",{after:t}),n=m.monkeyPatch(g.TimeFormatter,"dateFormat",{after:t});this.cancel24Hour=()=>{s(),n()}}};const Me=b.getModule(e=>e.defaultProps&&e.defaultProps.hasOwnProperty("disableButtons"));var Oe=new class extends ke{get name(){return"ColoredText"}get category(){return"Modules"}get id(){return"bda-gs-7"}enabled(){this.injectColoredText()}disabled(){this.cancelColoredText&&this.cancelColoredText()}injectColoredText(){this.cancelColoredText||(this.cancelColoredText=m.monkeyPatch(Me.prototype,"render",{after:e=>{m.monkeyPatch(e.returnValue.props,"children",{silent:!0,after:({returnValue:t})=>{const s=t.props.children[1],n=e.thisObject.props.message.colorString;return s&&n&&(s.props.style={color:n}),t}})}}))}removeColoredText(){document.querySelectorAll(".markup-2BOw-j").forEach(e=>{e.style.setProperty("color","")})}};function Fe(){}Fe.prototype.setConfig=function(e){Object.assign(a,e)},Fe.prototype.init=async function(){if(a.version Please download the latest version from GitHub");const e=a.updater?a.updater.LatestVersion:a.latestVersion;e>a.version&&this.alert("Update Available",`\n An update for BandagedBD is available (${e})! Please Reinstall!