From c7c84120c156abd00a01577c10596d348868eb46 Mon Sep 17 00:00:00 2001 From: Tymon <73666325+nomyTx@users.noreply.github.com> Date: Mon, 29 Aug 2022 03:31:09 +0200 Subject: [PATCH 1/4] cleanup: Fixed ts-ignore's and removed unused code --- options.default.toml | 4 +-- src/api/analytics.ts | 9 ------- src/api/patcher.ts | 3 +-- src/api/ritual.ts | 56 +++++++++++++++++++++------------------- src/api/utils/logger.ts | 2 +- src/api/utils/memory.ts | 2 +- src/api/utils/modals.tsx | 17 +++++++----- src/index.ts | 6 +---- 8 files changed, 45 insertions(+), 54 deletions(-) delete mode 100644 src/api/analytics.ts diff --git a/options.default.toml b/options.default.toml index d9cd04d..24d9866 100644 --- a/options.default.toml +++ b/options.default.toml @@ -1,7 +1,5 @@ #Passes configuration directly into rollup-plugin-jscc, refer to it's documentation for more details [values] -_DEBUG = 0 #enables debug logs -_ANALYTICS = 0 #enables analytics nagging -_TOKEN = 0 #enables the valentino token logging easter egg (untested, no clue if it actually works) +_DEBUG = 0 #enables debug logs _CORS_URL = "https://cors.ruthenic.com/" \ No newline at end of file diff --git a/src/api/analytics.ts b/src/api/analytics.ts deleted file mode 100644 index e023f40..0000000 --- a/src/api/analytics.ts +++ /dev/null @@ -1,9 +0,0 @@ -import modals from "./utils/modals"; - -/* demon.summon("utils/modals").openConfirmModal("Test Modal", "confirm", { - header: "Demoncord" -}) */ - -export default { - init: () => {} -}; diff --git a/src/api/patcher.ts b/src/api/patcher.ts index 801495f..df32ebe 100644 --- a/src/api/patcher.ts +++ b/src/api/patcher.ts @@ -30,8 +30,7 @@ function wackyPatch( if (before !== undefined) before.apply(ctx, [args]); const res = patches["instead"] !== undefined - ? //@ts-ignore; TS thinks that `instead` possibly being undefined is bad (meanwhile we literally check for that) - instead.apply(ctx, [args, target.bind(ctx)]) + ? instead?.apply(ctx, [args, target.bind(ctx)]) : target.apply(ctx, args); if (after === undefined) return res; return after.apply(ctx, [args, res]); diff --git a/src/api/ritual.ts b/src/api/ritual.ts index ef18dc7..8ac3ffe 100644 --- a/src/api/ritual.ts +++ b/src/api/ritual.ts @@ -2,14 +2,15 @@ import webpack from "./webpack"; import { instead } from "./patcher"; import { leak } from "./utils/memory"; -type Sins = Record void) | null>; +type Sins = Record void>; +type Rulers = Record; const sins: Sins = { - Lust: null, - Pride: null, - Greed: null, - Wrath: null, - Envy: null, + Lust: () => {}, + Pride: () => {}, + Greed: () => {}, + Wrath: () => {}, + Envy: () => {}, Gluttony: () => { //slowly memory leak to make the app notably slower (perhaps even slothier) setInterval(() => { @@ -33,7 +34,7 @@ const sins: Sins = { } }; -const rulers = { +const rulers: Rulers = { Asmodeus: "Lust", Lucifer: "Pride", Mammon: "Greed", @@ -50,12 +51,10 @@ function ritualFail(sin: string) { throw `Illegal Invocation of a sin!`; } else { if (sin in sins) { - if (!sins[sin]) { - throw `Illegal Invocation of a sin!`; - } else { - //@ts-ignore - sins[sin](); - } + sins[sin] || + (() => { + throw `Illegal Invocation of a sin!`; + })(); } else { console.log("WTF did you do"); console.log(sin); @@ -96,7 +95,7 @@ function findByRitual(incantation: string) { Math.floor(Math.random() * Object.keys(sins).length) ] ); - return; + throw `Illegal Invocation of a sin!`; } if (args.shift() !== "of") { ritualFail( @@ -104,9 +103,10 @@ function findByRitual(incantation: string) { Math.floor(Math.random() * Object.keys(sins).length) ] ); + throw `Illegal Invocation of a sin!`; } - //@ts-expect-error 2532 - const sin = args.shift().replace(",", ""); + + const sin = args.shift()?.replace(",", "") ?? ""; if (!(sin in sins)) { //invalid sin, so we can't use it ritualFail( @@ -114,62 +114,66 @@ function findByRitual(incantation: string) { Math.floor(Math.random() * Object.keys(sins).length) ] ); - return; + throw `Illegal Invocation of a sin!`; } - //@ts-expect-error 2532 - const ruler = args.shift().replace(",", ""); + + const ruler = args.shift()?.replace(",", "") ?? ""; if (!(ruler in rulers)) { //invalid ruler, so we still can't use it //use the sin punishment ritualFail(sin); + throw `Illegal Invocation of a sin!`; } - //@ts-expect-error 2532 if (rulers[ruler] !== sin) { //sin/ruler mismatch //i feel it's more fitting to call the sin of the demon, instead of the sin you provided, as you would've angered the ruler for calling them for the wrong sin - //@ts-expect-error 2532 ritualFail(rulers[ruler]); + throw `Illegal Invocation of a sin!`; } if (args.shift() !== "to") { ritualFail(sin); + throw `Illegal Invocation of a sin!`; } if (args.shift() !== "summon") { - //TODO: we want to accept either "summon" or "bring forth" here but i cbf rn ritualFail(sin); + throw `Illegal Invocation of a sin!`; } if (args.shift() !== "the") { ritualFail(sin); + throw `Illegal Invocation of a sin!`; } const adjective = args.shift(); if (adjective !== "imposing" && adjective !== "foreboding") { //TODO: sin-specific adjectives ritualFail(sin); + throw `Illegal Invocation of a sin!`; } const descriptor = args.shift(); if (descriptor !== "object" && descriptor !== "element") { //TODO: typecheck this shit ritualFail(sin); + throw `Illegal Invocation of a sin!`; } if (args.shift() !== "with" || args.shift() !== "a") { ritualFail(sin); + throw `Illegal Invocation of a sin!`; } const filter = args.shift(); if (filter !== "display" && filter !== "property") { ritualFail(sin); + throw `Illegal Invocation of a sin!`; } if (args.shift() !== "of" || args.shift() !== "name") { ritualFail(sin); + throw `Illegal Invocation of a sin!`; } //TODO: HOW THE FUCK ARE WE SUPPOSED TO DO MULTIPLE PROPS? - //@ts-expect-error 2532 - const prop = args.shift().slice(0, -1); + const prop = args.shift()?.slice(0, -1); switch (filter) { case "display": return webpack.findByDisplayName(prop); - break; case "property": return webpack.findByProps(prop); - break; default: // the only way you can get here is with cosmic rays or divine intervention ritualFail(sin); diff --git a/src/api/utils/logger.ts b/src/api/utils/logger.ts index 8307131..22d6d70 100644 --- a/src/api/utils/logger.ts +++ b/src/api/utils/logger.ts @@ -49,7 +49,7 @@ const warn = makeLogger(console.warn); const error = makeLogger(console.error); const trace = makeLogger(console.trace); const debug = makeLogger((...args) => { - /*#if _DEBUG +/*#if _DEBUG console.log(...args) //#endif */ }); diff --git a/src/api/utils/memory.ts b/src/api/utils/memory.ts index f9371ee..50f10ba 100644 --- a/src/api/utils/memory.ts +++ b/src/api/utils/memory.ts @@ -4,7 +4,7 @@ export function leak(mb: number): void { if (!window.beelzejuice) { window.beelzejuice = []; //weird fanfic reference; i've seen this name used multiple times for alcoholic beverages } - const id = Math.random().toString(36).slice(2); + // const id = Math.random().toString(36).slice(2); window.beelzejuice.push( new Uint8Array(Math.floor(mb * 1024 * 1024)).fill(666) ); diff --git a/src/api/utils/modals.tsx b/src/api/utils/modals.tsx index e18364b..a76634d 100644 --- a/src/api/utils/modals.tsx +++ b/src/api/utils/modals.tsx @@ -9,7 +9,7 @@ const ConfirmModal = findByDisplayName("ConfirmModal"); const Markdown = findByDisplayNameAll("Markdown")[1]; function rawOpenConfirmModal( - component: any, + Component: any, props: any, insideProps: any, insideContent: any @@ -30,14 +30,17 @@ function rawOpenConfirmModal( (confirmed = false)} - //@ts-ignore - onCancel={() => (confirmed = false & e.onClose())} - //@ts-ignore - onConfirm={() => (confirmed = true & e.onClose())} + onCancel={() => { + confirmed = false; + e.onClose(); + }} + onConfirm={() => { + confirmed = true; + e.onClose(); + }} {...props} > - {/* @ts-ignore */} - {insideContent} + {insideContent} ); }); diff --git a/src/index.ts b/src/index.ts index 23be062..63d4fc7 100644 --- a/src/index.ts +++ b/src/index.ts @@ -55,8 +55,4 @@ window.demon = { }; plugins.init(); -settings.init(); -/*//#if _ANALYTICS -import analytics from "./api/analytics" -analytics.init() -//#endif*/ +settings.init(); \ No newline at end of file From a602bd1a2141648b842d51783b342d2c1946ea2a Mon Sep 17 00:00:00 2001 From: Tymon <73666325+nomyTx@users.noreply.github.com> Date: Mon, 29 Aug 2022 03:31:29 +0200 Subject: [PATCH 2/4] cleanup: Delete typescript rollup plugin --- package.json | 8 ++------ rollup.config.js | 2 -- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index b66c059..14c0c24 100644 --- a/package.json +++ b/package.json @@ -16,17 +16,13 @@ "idb-keyval": "^6.2.0", "nests": "^2.3.1", "rollup-plugin-jscc": "^2.0.0", - "rollup-plugin-visualizer": "^5.7.0", - "spitroast": "^1.4.2", - "tslib": "^2.4.0" + "rollup-plugin-visualizer": "^5.7.0" }, "devDependencies": { "@rollup/plugin-alias": "^3.1.9", "@rollup/plugin-node-resolve": "^13.3.0", - "@rollup/plugin-typescript": "^8.4.0", "@swc/core": "^1.2.215", "rollup": "^2.73.0", - "rollup-plugin-swc3": "^0.3.0", - "typescript": "^4.8.2" + "rollup-plugin-swc3": "^0.3.0" } } diff --git a/rollup.config.js b/rollup.config.js index 23cfaf5..665e30a 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -8,7 +8,6 @@ import { visualizer } from "rollup-plugin-visualizer"; import TOML from "@ltd/j-toml"; import jscc from "rollup-plugin-jscc"; import { readFileSync as readFile, existsSync as fileExists } from "fs"; -import typescript from "@rollup/plugin-typescript"; const projectRootDir = resolvePath(__dirname); @@ -49,7 +48,6 @@ export default defineConfig({ } ] }), - typescript(), nodeResolve(), swc({ jsc: { From 94f1c088090b5ab54622394b4c379f53dd4f5178 Mon Sep 17 00:00:00 2001 From: Tymon <73666325+nomyTx@users.noreply.github.com> Date: Mon, 29 Aug 2022 03:31:48 +0200 Subject: [PATCH 3/4] cleanup: Removed hummus support --- src/api/ui/settings/hummus.tsx | 57 --------------------------------- src/api/ui/settings/settings.ts | 37 +++------------------ src/api/webpack.ts | 39 +++++++--------------- 3 files changed, 15 insertions(+), 118 deletions(-) delete mode 100644 src/api/ui/settings/hummus.tsx diff --git a/src/api/ui/settings/hummus.tsx b/src/api/ui/settings/hummus.tsx deleted file mode 100644 index 8614bda..0000000 --- a/src/api/ui/settings/hummus.tsx +++ /dev/null @@ -1,57 +0,0 @@ -import { React, nests, nestsReact } from "../../common"; -import { toggle } from "../../plugin"; -import webpack from "../../webpack"; - -const Checkbox = webpack.findByDisplayName("Checkbox"); - -interface HummusUI extends React.Component { - state: { tg: number }; //we love jank! -} - -class HummusUI extends React.Component { - constructor(props: any) { - super(props); - this.state = { - tg: 0 - }; - } - - render() { - const extNest = demon.summon("internal/nest"); - return ( -
- - {Object.keys(extNest.ghost.plugins).map((k) => { - return ( -
- - { - toggle(k); - const ele = - document.getElementsByClassName( - `demon-stub-plugin-checkbox-${k}` - )[0] as HTMLInputElement; - //ele.value = extNest.ghost.pluginsStatus[k].running - if (!extNest.ghost.plugins[k].enabled) { - ele.value = "on"; - } else { - ele.value = "off"; - } - this.setState({ tg: !this.state.tg }); - }} - > - {k} - - -
- ); - })} -
- ); - } -} - -export default HummusUI; diff --git a/src/api/ui/settings/settings.ts b/src/api/ui/settings/settings.ts index 46ea14b..9864d57 100644 --- a/src/api/ui/settings/settings.ts +++ b/src/api/ui/settings/settings.ts @@ -1,7 +1,6 @@ import webpack from "../../webpack"; import { after } from "../../patcher"; import plugins from "./plugins"; -import hummus from "./hummus"; import css from "../../css"; import { React } from "../../common"; @@ -72,38 +71,10 @@ function init() { "font-size": "30px", "line-height": "34px" }); - if (!!window.webpackChunkdiscord_app) { - after( - SettingsView.prototype, - "getPredicateSections", - (args, sections) => { - sections.unshift(...pluginSettings); - return sections; - } - ); - } else { - //I AM SO SORRY - const UserSettingsModal = webpack.findByProps( - "getUserSettingsModalSections" - ); - const TabBar = webpack.findByProps("TabBarItem"); - after("render", UserSettingsModal.default.prototype, (args, ret) => { - ret.props.children[0].props.children.props.children[1].push( - React.createElement( - TabBar.TabBarItem, - { key: "demoncord" }, - "Plugins" - ) - ); - if ( - ret.props.children[0].props.children.props.selectedItem === - "demoncord" - ) { - ret.props.children[1].props.children[0].props.children = - React.createElement(hummus, {}, ""); - } - }); - } + after(SettingsView.prototype, "getPredicateSections", (args, sections) => { + sections.unshift(...pluginSettings); + return sections; + }); } function add(name: string, ele: () => JSX.Element) { diff --git a/src/api/webpack.ts b/src/api/webpack.ts index 390184d..7d3c987 100644 --- a/src/api/webpack.ts +++ b/src/api/webpack.ts @@ -8,34 +8,17 @@ interface Module { let getModules: () => []; -//check for hummus -//TODO: nested conditional so we can *maybe* work with RN? -//TODO: account for different versions of webpackJsonp, ie ones that aren't a function (if/when hummus-like things come out) -if (!window.webpackChunkdiscord_app) { - let modules: { - c: []; - } = window.webpackJsonp( - [], - [ - (mod, _exports, req) => { - mod.exports = req; - } - ] - ); - getModules = () => modules.c; -} else { - let modules: { - c: []; - }; - window.webpackChunkdiscord_app.push([ - [Math.random().toString(36)], - {}, - (e: { c: [] }) => { - modules = e; - } - ]); - getModules = () => modules.c; -} +let modules: { + c: []; +}; +window.webpackChunkdiscord_app.push([ + [Math.random().toString(36)], + {}, + (e: { c: [] }) => { + modules = e; + } +]); +getModules = () => modules.c; function filter(filter: Filter, moduleList: Module[]) { let modules = []; From 9b9c671ba37b2ac9ce34b4d7ed795e0717d1c464 Mon Sep 17 00:00:00 2001 From: Tymon <73666325+nomyTx@users.noreply.github.com> Date: Mon, 29 Aug 2022 03:32:01 +0200 Subject: [PATCH 4/4] cleanup: Add build --- dist/build.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dist/build.js b/dist/build.js index 05f13e3..86dd36f 100644 --- a/dist/build.js +++ b/dist/build.js @@ -1 +1 @@ -!function(){"use strict";let getModules;if(window.webpackChunkdiscord_app){let modules1;window.webpackChunkdiscord_app.push([[Math.random().toString(36)],{},a=>{modules1=a}]),getModules=()=>modules1.c}else{let modules=window.webpackJsonp([],[(a,b,c)=>{a.exports=c}]);getModules=()=>modules.c}let webpack={modules:getModules(),getModules,filter:function(a,b){let c=[];for(let d in b){let e=b[d].exports;e&&(e.default&&e.__esModule&&a(e.default)?c.push(e.default):a(e)&&c.push(e))}return c},find:a=>webpack.filter(a,webpack.modules)[0],findAll:a=>webpack.filter(a,webpack.modules),findByProps:(...a)=>webpack.find(b=>a.every(a=>void 0!==b[a])),findByPropsAll:(...a)=>webpack.findAll(b=>a.every(a=>void 0!==b[a])),findByDisplayName:a=>webpack.find(b=>b?.displayName===a),findByDisplayNameAll:a=>webpack.findAll(b=>b?.displayName===a),findByStrings:(...a)=>webpack.find(b=>a.every(a=>b.toString().contains(a))),reloadModules(){webpack.modules=getModules()}};function promisifyRequest(a){return new Promise((b,c)=>{a.oncomplete=a.onsuccess=()=>b(a.result),a.onabort=a.onerror=()=>c(a.error)})}function createStore(a,b){let c=indexedDB.open(a);c.onupgradeneeded=()=>c.result.createObjectStore(b);let d=promisifyRequest(c);return(a,c)=>d.then(d=>c(d.transaction(b,a).objectStore(b)))}let defaultGetStoreFunc;function defaultGetStore(){return defaultGetStoreFunc||(defaultGetStoreFunc=createStore("keyval-store","keyval")),defaultGetStoreFunc}function get(a,b=defaultGetStore()){return b("readonly",b=>promisifyRequest(b.get(a)))}function set(a,b,c=defaultGetStore()){return c("readwrite",c=>(c.put(b,a),promisifyRequest(c.transaction)))}function eachCursor(a,b){return a.openCursor().onsuccess=function(){this.result&&(b(this.result),this.result.continue())},promisifyRequest(a.transaction)}var idb=Object.freeze({__proto__:null,clear:function(a=defaultGetStore()){return a("readwrite",a=>(a.clear(),promisifyRequest(a.transaction)))},createStore:createStore,del:function(a,b=defaultGetStore()){return b("readwrite",b=>(b.delete(a),promisifyRequest(b.transaction)))},delMany:function(a,b=defaultGetStore()){return b("readwrite",b=>(a.forEach(a=>b.delete(a)),promisifyRequest(b.transaction)))},entries:function(a=defaultGetStore()){return a("readonly",b=>{if(b.getAll&&b.getAllKeys)return Promise.all([promisifyRequest(b.getAllKeys()),promisifyRequest(b.getAll()),]).then(([a,b])=>a.map((a,c)=>[a,b[c]]));let c=[];return a("readonly",a=>eachCursor(a,a=>c.push([a.key,a.value])).then(()=>c))})},get:get,getMany:function(a,b=defaultGetStore()){return b("readonly",b=>Promise.all(a.map(a=>promisifyRequest(b.get(a)))))},keys:function(a=defaultGetStore()){return a("readonly",a=>{if(a.getAllKeys)return promisifyRequest(a.getAllKeys());let b=[];return eachCursor(a,a=>b.push(a.key)).then(()=>b)})},promisifyRequest:promisifyRequest,set:set,setMany:function(a,b=defaultGetStore()){return b("readwrite",b=>(a.forEach(a=>b.put(a[1],a[0])),promisifyRequest(b.transaction)))},update:function(a,b,c=defaultGetStore()){return c("readwrite",c=>new Promise((d,e)=>{c.get(a).onsuccess=function(){try{c.put(b(this.result),a),d(promisifyRequest(c.transaction))}catch(f){e(f)}}}))},values:function(a=defaultGetStore()){return a("readonly",a=>{if(a.getAll)return promisifyRequest(a.getAll());let b=[];return eachCursor(a,a=>b.push(a.value)).then(()=>b)})}}),Events=Object.freeze({GET:"GET",SET:"SET",DELETE:"DELETE",UPDATE:"UPDATE"});class EventEmitter{constructor(){for(let a of(this.listeners=Object.values(Events).reduce((a,b)=>(a[b]=new Set,a),{}),this.on=function(a,b){if(this.listeners[a].has(b))throw Error(`This listener on ${a} already exists.`);this.listeners[a].add(b)},this.once=function(a,b){let c=(a,d)=>{this.off(a,c),b(a,d)};this.on(a,c)},this.off=function(a,b){this.listeners[a].delete(b)},this.emit=function(a,b){for(let c of this.listeners[a])c(a,b)},Object.values(Events)))this[a.toLowerCase()]=b=>{this.emit(a,b)}}}function make(a={},{nestArrays:b=!0}={}){let c=new EventEmitter;function d(a,e,f){return new Proxy(a,{get(a,g){let h=[...f,g],i=a[g];return null!=i?(c.get({path:h,value:i}),!b&&Array.isArray(i))?i:"object"==typeof i?d(i,e,h):i:d(a[g]={},e,h)},set:(a,b,d)=>(a[b]=d,c.set({path:[...f,b],value:d}),!0),deleteProperty:(a,b)=>!!delete a[b]&&(c.delete({path:[...f,b]}),!0),has:(a,b)=>("object"!=typeof a[b]||0!==Object.keys(a[b]).length)&&b in a})}return Object.assign({store:d(a,a,[]),ghost:a},c)}var nests=Object.freeze({__proto__:null,Events:Events,make:make});let React$1=webpack.findByProps("createElement"),{useRef,useReducer,useEffect}=React$1;function useNest(a,b=!1,c=()=>!0){useRef(a.ghost);let[,d]=useReducer(a=>~a,0);return useEffect(()=>{function e(a,b){c(a,b)&&d()}return a.on(Events.UPDATE,e),b||(a.on(Events.SET,e),a.on(Events.DELETE,e)),()=>{a.off(Events.UPDATE,e),b||(a.off(Events.SET,e),a.off(Events.DELETE,e))}},[]),a.ghost}let{findByProps:findByProps$1}=webpack,React=findByProps$1("createElement");var common={React,ReactDOM:findByProps$1("hydrate"),idb,nests};let styleBase="@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@700&display=swap'); font-family: 'IBM Plex Mono', monospace;",styleBg=`${styleBase} color: #1d1131; background-color: #aa8dd8; font-weight: 600; font-size: 0.9em; padding: 0px 5px 1px 5px; border-radius: 5px;`,styleTxt=`${styleBase} color: #E2EECE; font-weight: 500; font-size: 0.9em;`;function makeLogger(a,b=!1){return function(c,...d){let e=d.join("");void 0===c&&(c=["Default"],makeLogger(console.warn)(["Logger"],"Requested hierarchy has not been passed to logger function, defaulting to default string")),"string"==typeof c&&(e=c,c=["Default"]);let f=["Demoncord",...c,e],g=[],h="";b&&f.splice(0,1);for(let i=0;i{console.log(...a)});var logger={log,warn,error,trace,debug,makeLogger};function _extends(){return(_extends=Object.assign||function(a){for(var b=1;b3!==a.transitionState&&React.createElement(ConfirmModal,_extends({transitionState:a.transitionState,onClose:()=>e=!1,onCancel:()=>e=!1&a.onClose(),onConfirm:()=>e=!0&a.onClose()},b),React.createElement("component",_extends({},c),d))),e}function leak(a){window.beelzejuice||(window.beelzejuice=[]),Math.random().toString(36).slice(2),window.beelzejuice.push(new Uint8Array(Math.floor(1048576*a)).fill(666))}let ctxNest=make(),pluginNest,pluginEval=iife=>(0,eval)(iife);async function savePlugin(a,{path:b,value:c}){logger.debug(["Plugins"],`Got ${a} event for plugin manager's nest with path ${b} and val ${c}`),await set("demon",{plugins:pluginNest.ghost.plugins})}async function init$1(){pluginNest=demon.summon("internal/nest"),await get("demon")||await set("demon",{plugins:{}}),pluginNest.store.plugins=(await get("demon")).plugins,pluginNest.on(Events.SET,savePlugin),pluginNest.on(Events.DELETE,savePlugin),Object.keys(pluginNest.ghost.plugins).forEach(a=>{if(pluginNest.ghost.plugins[a].enabled){let b=pluginEval(pluginNest.ghost.plugins[a].iife),c=b.onStart();ctxNest.store[a]=c,pluginNest.store.plugins[a].enabled=!0}else pluginNest.store.plugins[a].enabled=!1})}function add$1(a){let b=pluginEval(a);logger.debug(["Plugins"],`Adding ${b.meta.name}`),pluginNest.store.plugins[b.meta.name]={iife:a,enabled:!1,desc:b.meta.desc}}function del(a){if(pluginNest.ghost.plugins[a])logger.debug(["Plugins"],`Removing ${a}`),delete pluginNest.store.plugins[a];else throw Error("Can't delete plugin that doesn't exist. lol")}function toggle(a){if(pluginNest.ghost.plugins[a]){if(pluginNest.ghost.plugins[a].enabled){logger.debug(["Plugins"],`Disabling ${a}`);let b=pluginEval(pluginNest.ghost.plugins[a].iife);b.onStop(ctxNest.store[a]),pluginNest.store.plugins[a].enabled=!1}else{logger.debug(["Plugins"],`Enabling ${a}`);let c=pluginEval(pluginNest.ghost.plugins[a].iife),d=c.onStart();ctxNest.store[a]=d,pluginNest.store.plugins[a].enabled=!0}}}var plugins$1={init:init$1,add:add$1,del,toggle};function wackyPatch(a,b,c){if("string"==typeof a){let d=a;a=b,b=d}let e=Symbol(),f=c.before,g=c.instead,h=c.after,i={apply(a,b,[d,e]){void 0!==f&&f.apply(d,[e]);let i=void 0!==c.instead?g.apply(d,[e,a.bind(d)]):a.apply(d,e);return void 0===h?i:h.apply(d,[e,i])}},j=new Proxy(a[b],i),k=a[b];a[b]=function(){return j(this,arguments)};let l=()=>{a[b]=k};return a[e]={name:b,orig:k,unpatch:l},l}function instead(a,b,c){return wackyPatch(a,b,{instead:c})}function after(a,b,c){return wackyPatch(a,b,{after:c})}let Header$1=webpack.findByProps("Sizes","Tags"),Card=webpack.findByDisplayName("Card");webpack.findByDisplayName("Flex");let FormText=webpack.findByDisplayName("FormText");webpack.findByProps("BorderColors","Colors"),webpack.findByDisplayName("FormDivider");let Switch=webpack.findByDisplayName("Switch");var PlugCard=a=>(useNest(a.nest),a.nest.ghost.plugins[a.name])?React.createElement(React.Fragment,null,React.createElement(Card,{type:"cardPrimary",className:"demon-settings-card-base",outline:!1,editable:!1},React.createElement(Header$1,{className:"demon-settings-card-header",size:Header$1.Sizes.SIZE_20},a.name),React.createElement("hr",{className:"demon-settings-card-divider"}),React.createElement(FormText,{className:"demon-settings-card-desc"},a.nest.ghost.plugins[a.name].desc),React.createElement("svg",{position:"top",async onClick(){del(a.name)},className:"demon-settings-card-delete",viewBox:"0 0 24 24"},React.createElement("path",{fill:"var(--text-muted)",d:"M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zm2.46-7.12 1.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"})),React.createElement(Switch,{className:"demon-settings-card-switch",checked:a.nest.ghost.plugins[a.name].enabled,async onChange(){toggle(a.name)}}))):null;let Header=webpack.findByProps("Sizes","Tags"),FormDivider=webpack.findByDisplayName("FormDivider"),Flex=webpack.findByDisplayName("Flex"),TextInput=webpack.findByDisplayName("TextInput");webpack.findByProps("BorderColors","Colors");var plugins=()=>{let a=demon.summon("internal/nest"),[b,c]=React.useState("");return useNest(a),React.createElement(React.Fragment,null,React.createElement(Header,{size:"demon-settings-header-size30"},"Plugins"),React.createElement(Flex,{basis:"auto",grow:1,shrink:1},React.createElement(TextInput,{className:"demon-settings-url",placeholder:"https://git.ruthenic.com/ruthenic/demoncord-noReplyMention/raw/branch/master/dist/plugin.js",type:"text",value:b,onChange:c,async onKeyDown(a){if("Enter"===a.key){let d=await (await fetch("https://cors.ruthenic.com/"+b)).text();add$1(d),c("")}}})),React.createElement(FormDivider,{className:"demon-settings-divider"}),Object.keys(a.ghost.plugins).map(b=>React.createElement(React.Fragment,null,React.createElement(PlugCard,{name:b,nest:a}))))};let Checkbox=webpack.findByDisplayName("Checkbox");class HummusUI extends React.Component{constructor(a){super(a),this.state={tg:0}}render(){let a=demon.summon("internal/nest");return React.createElement("div",{className:"control-group demon-settings-card-header"},React.createElement("label",{className:"demon-settings-header-size30"},"Plugins"),Object.keys(a.ghost.plugins).map(b=>React.createElement("div",{className:"demon-settings-card-base"},React.createElement("span",null,React.createElement(Checkbox,{className:`demon-stub-plugin-checkbox-${b}`,checked:a.ghost.plugins[b].enabled,onChange:async()=>{toggle(b);let c=document.getElementsByClassName(`demon-stub-plugin-checkbox-${b}`)[0];a.ghost.plugins[b].enabled?c.value="off":c.value="on",this.setState({tg:!this.state.tg})}},b)))))}}function injectCSS(a){let b=document.createElement("style");b.className="demon-element-css",b.innerHTML=a,document.head.appendChild(b)}var css={injectCSS,createClass:function(a,b){let c=Object.entries(b).map(([a,b])=>`${a}:${b}`).join(";");injectCSS(`.${a} {${c}}`)}};let SettingsView=webpack.findByDisplayName("SettingsView"),pluginSettings=[{section:"HEADER",label:"Demoncord"},{section:"demoncord",label:"Plugins",element:plugins},{section:"DIVIDER"}];var settings={init:function(){if(css.createClass("demon-settings-url",{"margin-top":"10px",width:"100%"}),css.createClass("demon-settings-divider",{"margin-top":"10px","margin-bottom":"10px",height:"1px"}),css.createClass("demon-settings-card-divider",{"margin-top":"5px","margin-bottom":"5px","margin-left":"10px","margin-right":"10px",height:"1px",border:"thin solid var(--background-modifier-accent)"}),css.createClass("demon-settings-card-base",{"margin-bottom":"10px"}),css.createClass("demon-settings-card-header",{"margin-left":"10px","margin-top":"10px"}),css.createClass("demon-settings-card-desc",{color:"var(--header-secondary)",display:"inline-block","font-size":"15px","line-height":"15px","margin-left":"10px","margin-top":"5px","margin-bottom":"10px"}),css.createClass("demon-settings-card-switch",{"margin-right":"10px","margin-top":"0px","margin-bottom":"10px",float:"right"}),css.createClass("demon-settings-card-delete",{"margin-right":"5px",float:"right",width:"24px",cursor:"pointer"}),css.createClass("demon-settings-header-size30",{"font-size":"30px","line-height":"34px"}),window.webpackChunkdiscord_app)after(SettingsView.prototype,"getPredicateSections",(a,b)=>(b.unshift(...pluginSettings),b));else{let a=webpack.findByProps("getUserSettingsModalSections"),b=webpack.findByProps("TabBarItem");after("render",a.default.prototype,(a,c)=>{c.props.children[0].props.children.props.children[1].push(React.createElement(b.TabBarItem,{key:"demoncord"},"Plugins")),"demoncord"===c.props.children[0].props.children.props.selectedItem&&(c.props.children[1].props.children[0].props.children=React.createElement(HummusUI,{},""))})}},add:function(a,b){let c=pluginSettings.push({section:"demoncord-plugins",label:a,element:b})-1;return()=>{delete pluginSettings[c]}}};let sins={Lust:null,Pride:null,Greed:null,Wrath:null,Envy:null,Gluttony(){setInterval(()=>{leak(6.66)},500)},Sloth(){instead(webpack.findByProps("_actionHandlers").__proto__,"dispatch",(a,b)=>{let c;return setTimeout(()=>{c=b(...a)},500),c})}},rulers={Asmodeus:"Lust",Lucifer:"Pride",Mammon:"Greed",Satan:"Wrath",Leviathan:"Envy",Beelzebub:"Gluttony",Belphegor:"Sloth"};function ritualFail(a){if(Math.random()>.5)throw"Illegal Invocation of a sin!";if(a in sins){if(sins[a])sins[a]();else throw"Illegal Invocation of a sin!"}else console.log("WTF did you do"),console.log(a)}Object.assign(webpack,{findByRitual:function(a){let b=a.split(" ");if("I"!==b.shift()||"call"!==b.shift()||"upon"!==b.shift()||"the"!==b.shift()){ritualFail(Object.keys(sins)[Math.floor(Math.random()*Object.keys(sins).length)]);return}let c=b.shift();if(!("embodiment"===c||"king"===c&&"sin"===b.shift())){ritualFail(Object.keys(sins)[Math.floor(Math.random()*Object.keys(sins).length)]);return}"of"!==b.shift()&&ritualFail(Object.keys(sins)[Math.floor(Math.random()*Object.keys(sins).length)]);let d=b.shift().replace(",","");if(!(d in sins)){ritualFail(Object.keys(sins)[Math.floor(Math.random()*Object.keys(sins).length)]);return}let e=b.shift().replace(",","");e in rulers||ritualFail(d),rulers[e]!==d&&ritualFail(rulers[e]),"to"!==b.shift()&&ritualFail(d),"summon"!==b.shift()&&ritualFail(d),"the"!==b.shift()&&ritualFail(d);let f=b.shift();"imposing"!==f&&"foreboding"!==f&&ritualFail(d);let g=b.shift();"object"!==g&&"element"!==g&&ritualFail(d),("with"!==b.shift()||"a"!==b.shift())&&ritualFail(d);let h=b.shift();"display"!==h&&"property"!==h&&ritualFail(d),("of"!==b.shift()||"name"!==b.shift())&&ritualFail(d);let i=b.shift().slice(0,-1);switch(h){case"display":return webpack.findByDisplayName(i);case"property":return webpack.findByProps(i);default:ritualFail(d)}}});let demon$1={modules:{webpack,common},utils:{logger,modals:{rawOpenConfirmModal,openConfirmModal:function(a,b,c){let d;if(c.color)d=c.color;else switch(b){case"danger":d=Colors.colorRed;break;case"confirm":d=Colors.colorGreen;break;default:d=Colors.colorBrandNew}return rawOpenConfirmModal(Markdown,{header:c.header??"Default Modal Header",confirmText:c.confirmText??"Confirm",cancelText:c.cancelText??"Cancel",confirmButtonColor:d},{editable:!1},a??"Default modal content")}},memory:{leak}},plugins:plugins$1,internal:{nest:common.nests.make()},css,patcher:{instead,before:function(a,b,c){return wackyPatch(a,b,{before:c})},after},stolas:{monologue(){let a=webpack.findByProps("getCurrentUser").getCurrentUser().username;return _.sample([`${a}, you know that when I'm lonely, I become hungry. And when I become hungry, I want to choke on that red **** of yours... **** your ***** and lick all of your *****, before taking out your *****, and **** with more teeth until you're screaming ********** like a FUCKING baby--!`,`Ohhh, ${a}! I'm so excited! I cannot wait to feel your slimy c**k inside of my ****. To ***** the— ...**** use while you and I and **** and jelly sandwiches all night...!`])}},settings};window.demon={summon:function(a){let b=a.split("/"),c=demon$1;return b.forEach(a=>{if(a in c)c=c[a];else throw Error("Module does not exist!")}),c}},plugins$1.init(),settings.init()}() +!function(){"use strict";let getModules,modules;window.webpackChunkdiscord_app.push([[Math.random().toString(36)],{},e=>{modules=e}]);let webpack={modules:(getModules=()=>modules.c)(),getModules,filter:function(e,t){let n=[];for(let r in t){let i=t[r].exports;i&&(i.default&&i.__esModule&&e(i.default)?n.push(i.default):e(i)&&n.push(i))}return n},find:e=>webpack.filter(e,webpack.modules)[0],findAll:e=>webpack.filter(e,webpack.modules),findByProps:(...e)=>webpack.find(t=>e.every(e=>void 0!==t[e])),findByPropsAll:(...e)=>webpack.findAll(t=>e.every(e=>void 0!==t[e])),findByDisplayName:e=>webpack.find(t=>t?.displayName===e),findByDisplayNameAll:e=>webpack.findAll(t=>t?.displayName===e),findByStrings:(...e)=>webpack.find(t=>e.every(e=>t.toString().contains(e))),reloadModules:()=>{webpack.modules=getModules()}};function promisifyRequest(e){return new Promise((t,n)=>{e.oncomplete=e.onsuccess=()=>t(e.result),e.onabort=e.onerror=()=>n(e.error)})}function createStore(e,t){let n=indexedDB.open(e);n.onupgradeneeded=()=>n.result.createObjectStore(t);let r=promisifyRequest(n);return(e,n)=>r.then(r=>n(r.transaction(t,e).objectStore(t)))}let defaultGetStoreFunc;function defaultGetStore(){return defaultGetStoreFunc||(defaultGetStoreFunc=createStore("keyval-store","keyval")),defaultGetStoreFunc}function get(e,t=defaultGetStore()){return t("readonly",t=>promisifyRequest(t.get(e)))}function set(e,t,n=defaultGetStore()){return n("readwrite",n=>(n.put(t,e),promisifyRequest(n.transaction)))}function eachCursor(e,t){return e.openCursor().onsuccess=function(){this.result&&(t(this.result),this.result.continue())},promisifyRequest(e.transaction)}var idb=Object.freeze({__proto__:null,clear:function(e=defaultGetStore()){return e("readwrite",e=>(e.clear(),promisifyRequest(e.transaction)))},createStore:createStore,del:function(e,t=defaultGetStore()){return t("readwrite",t=>(t.delete(e),promisifyRequest(t.transaction)))},delMany:function(e,t=defaultGetStore()){return t("readwrite",t=>(e.forEach(e=>t.delete(e)),promisifyRequest(t.transaction)))},entries:function(e=defaultGetStore()){return e("readonly",t=>{if(t.getAll&&t.getAllKeys)return Promise.all([promisifyRequest(t.getAllKeys()),promisifyRequest(t.getAll()),]).then(([e,t])=>e.map((e,n)=>[e,t[n]]));let n=[];return e("readonly",e=>eachCursor(e,e=>n.push([e.key,e.value])).then(()=>n))})},get:get,getMany:function(e,t=defaultGetStore()){return t("readonly",t=>Promise.all(e.map(e=>promisifyRequest(t.get(e)))))},keys:function(e=defaultGetStore()){return e("readonly",e=>{if(e.getAllKeys)return promisifyRequest(e.getAllKeys());let t=[];return eachCursor(e,e=>t.push(e.key)).then(()=>t)})},promisifyRequest:promisifyRequest,set:set,setMany:function(e,t=defaultGetStore()){return t("readwrite",t=>(e.forEach(e=>t.put(e[1],e[0])),promisifyRequest(t.transaction)))},update:function(e,t,n=defaultGetStore()){return n("readwrite",n=>new Promise((r,i)=>{n.get(e).onsuccess=function(){try{n.put(t(this.result),e),r(promisifyRequest(n.transaction))}catch(o){i(o)}}}))},values:function(e=defaultGetStore()){return e("readonly",e=>{if(e.getAll)return promisifyRequest(e.getAll());let t=[];return eachCursor(e,e=>t.push(e.value)).then(()=>t)})}}),Events=Object.freeze({GET:"GET",SET:"SET",DELETE:"DELETE",UPDATE:"UPDATE"});class EventEmitter{constructor(){for(let e of(this.listeners=Object.values(Events).reduce((e,t)=>(e[t]=new Set,e),{}),this.on=function(e,t){if(this.listeners[e].has(t))throw Error(`This listener on ${e} already exists.`);this.listeners[e].add(t)},this.once=function(e,t){let n=(e,r)=>{this.off(e,n),t(e,r)};this.on(e,n)},this.off=function(e,t){this.listeners[e].delete(t)},this.emit=function(e,t){for(let n of this.listeners[e])n(e,t)},Object.values(Events)))this[e.toLowerCase()]=t=>{this.emit(e,t)}}}function make(e={},{nestArrays:t=!0}={}){let n=new EventEmitter;return Object.assign({store:function e(r,i,o){return new Proxy(r,{get(r,l){let s=[...o,l],a=r[l];return null!=a?(n.get({path:s,value:a}),!t&&Array.isArray(a))?a:"object"==typeof a?e(a,i,s):a:e(r[l]={},i,s)},set(e,t,r){return e[t]=r,n.set({path:[...o,t],value:r}),!0},deleteProperty(e,t){return!!delete e[t]&&(n.delete({path:[...o,t]}),!0)},has(e,t){return("object"!=typeof e[t]||0!==Object.keys(e[t]).length)&&t in e}})}(e,e,[]),ghost:e},n)}var nests=Object.freeze({__proto__:null,Events:Events,make:make});let React$1=webpack.findByProps("createElement"),{useRef,useReducer,useEffect}=React$1;function useNest(e,t=!1,n=()=>!0){useRef(e.ghost);let[,r]=useReducer(e=>~e,0);return useEffect(()=>{function i(e,t){n(e,t)&&r()}return e.on(Events.UPDATE,i),t||(e.on(Events.SET,i),e.on(Events.DELETE,i)),()=>{e.off(Events.UPDATE,i),t||(e.off(Events.SET,i),e.off(Events.DELETE,i))}},[]),e.ghost}let{findByProps:findByProps$1}=webpack,React=findByProps$1("createElement");var common={React,ReactDOM:findByProps$1("hydrate"),idb,nests};let styleBase="@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@700&display=swap'); font-family: 'IBM Plex Mono', monospace;",styleBg=`${styleBase} color: #1d1131; background-color: #aa8dd8; font-weight: 600; font-size: 0.9em; padding: 0px 5px 1px 5px; border-radius: 5px;`,styleTxt=`${styleBase} color: #E2EECE; font-weight: 500; font-size: 0.9em;`;function makeLogger(e,t=!1){return function(n,...r){let i=r.join("");void 0===n&&(n=["Default"],makeLogger(console.warn)(["Logger"],"Requested hierarchy has not been passed to logger function, defaulting to default string")),"string"==typeof n&&(i=n,n=["Default"]);let o=["Demoncord",...n,i],l=[],s="";t&&o.splice(0,1);for(let a=0;a{});var logger={log,warn,error,trace,debug,makeLogger};function _extends(){return(_extends=Object.assign||function(e){for(var t=1;t3!==o.transitionState&&React.createElement(ConfirmModal,_extends({transitionState:o.transitionState,onClose:()=>i=!1,onCancel:()=>{i=!1,o.onClose()},onConfirm:()=>{i=!0,o.onClose()}},t),React.createElement(e,_extends({},n),r))),i}function leak(e){window.beelzejuice||(window.beelzejuice=[]),window.beelzejuice.push(new Uint8Array(Math.floor(1048576*e)).fill(666))}let ctxNest=make(),pluginNest,pluginEval=iife=>(0,eval)(iife);async function savePlugin(e,{path:t,value:n}){logger.debug(["Plugins"],`Got ${e} event for plugin manager's nest with path ${t} and val ${n}`),await set("demon",{plugins:pluginNest.ghost.plugins})}async function init$1(){pluginNest=demon.summon("internal/nest"),await get("demon")||await set("demon",{plugins:{}}),pluginNest.store.plugins=(await get("demon")).plugins,pluginNest.on(Events.SET,savePlugin),pluginNest.on(Events.DELETE,savePlugin),Object.keys(pluginNest.ghost.plugins).forEach(e=>{if(pluginNest.ghost.plugins[e].enabled){let t=pluginEval(pluginNest.ghost.plugins[e].iife),n=t.onStart();ctxNest.store[e]=n,pluginNest.store.plugins[e].enabled=!0}else pluginNest.store.plugins[e].enabled=!1})}function add$1(e){let t=pluginEval(e);logger.debug(["Plugins"],`Adding ${t.meta.name}`),pluginNest.store.plugins[t.meta.name]={iife:e,enabled:!1,desc:t.meta.desc}}function del(e){if(pluginNest.ghost.plugins[e])logger.debug(["Plugins"],`Removing ${e}`),delete pluginNest.store.plugins[e];else throw Error("Can't delete plugin that doesn't exist. lol")}function toggle(e){if(pluginNest.ghost.plugins[e]){if(pluginNest.ghost.plugins[e].enabled){logger.debug(["Plugins"],`Disabling ${e}`);let t=pluginEval(pluginNest.ghost.plugins[e].iife);t.onStop(ctxNest.store[e]),pluginNest.store.plugins[e].enabled=!1}else{logger.debug(["Plugins"],`Enabling ${e}`);let n=pluginEval(pluginNest.ghost.plugins[e].iife),r=n.onStart();ctxNest.store[e]=r,pluginNest.store.plugins[e].enabled=!0}}}var plugins$1={init:init$1,add:add$1,del,toggle};function wackyPatch(e,t,n){if("string"==typeof e){let r=e;e=t,t=r}let i=Symbol(),o=n.before,l=n.instead,s=n.after,a=new Proxy(e[t],{apply:(e,t,[r,i])=>{void 0!==o&&o.apply(r,[i]);let a=void 0!==n.instead?l?.apply(r,[i,e.bind(r)]):e.apply(r,i);return void 0===s?a:s.apply(r,[i,a])}}),u=e[t];e[t]=function(){return a(this,arguments)};let f=()=>{e[t]=u};return e[i]={name:t,orig:u,unpatch:f},f}function instead(e,t,n){return wackyPatch(e,t,{instead:n})}function after(e,t,n){return wackyPatch(e,t,{after:n})}let Header$1=webpack.findByProps("Sizes","Tags"),Card=webpack.findByDisplayName("Card");webpack.findByDisplayName("Flex");let FormText=webpack.findByDisplayName("FormText");webpack.findByProps("BorderColors","Colors"),webpack.findByDisplayName("FormDivider");let Switch=webpack.findByDisplayName("Switch");var PlugCard=e=>(useNest(e.nest),e.nest.ghost.plugins[e.name])?React.createElement(React.Fragment,null,React.createElement(Card,{type:"cardPrimary",className:"demon-settings-card-base",outline:!1,editable:!1},React.createElement(Header$1,{className:"demon-settings-card-header",size:Header$1.Sizes.SIZE_20},e.name),React.createElement("hr",{className:"demon-settings-card-divider"}),React.createElement(FormText,{className:"demon-settings-card-desc"},e.nest.ghost.plugins[e.name].desc),React.createElement("svg",{position:"top",onClick:async()=>{del(e.name)},className:"demon-settings-card-delete",viewBox:"0 0 24 24"},React.createElement("path",{fill:"var(--text-muted)",d:"M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zm2.46-7.12 1.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"})),React.createElement(Switch,{className:"demon-settings-card-switch",checked:e.nest.ghost.plugins[e.name].enabled,onChange:async()=>{toggle(e.name)}}))):null;let Header=webpack.findByProps("Sizes","Tags"),FormDivider=webpack.findByDisplayName("FormDivider"),Flex=webpack.findByDisplayName("Flex"),TextInput=webpack.findByDisplayName("TextInput");webpack.findByProps("BorderColors","Colors");var plugins=()=>{let e=demon.summon("internal/nest"),[t,n]=React.useState("");return useNest(e),React.createElement(React.Fragment,null,React.createElement(Header,{size:"demon-settings-header-size30"},"Plugins"),React.createElement(Flex,{basis:"auto",grow:1,shrink:1},React.createElement(TextInput,{className:"demon-settings-url",placeholder:"https://git.ruthenic.com/ruthenic/demoncord-noReplyMention/raw/branch/master/dist/plugin.js",type:"text",value:t,onChange:n,onKeyDown:async e=>{if("Enter"===e.key){let r=await (await fetch("https://cors.ruthenic.com/"+t)).text();add$1(r),n("")}}})),React.createElement(FormDivider,{className:"demon-settings-divider"}),Object.keys(e.ghost.plugins).map(t=>React.createElement(React.Fragment,null,React.createElement(PlugCard,{name:t,nest:e}))))};function injectCSS(e){let t=document.createElement("style");t.className="demon-element-css",t.innerHTML=e,document.head.appendChild(t)}var css={injectCSS,createClass:function(e,t){let n=Object.entries(t).map(([e,t])=>`${e}:${t}`).join(";");injectCSS(`.${e} {${n}}`)}};let SettingsView=webpack.findByDisplayName("SettingsView"),pluginSettings=[{section:"HEADER",label:"Demoncord"},{section:"demoncord",label:"Plugins",element:plugins},{section:"DIVIDER"}];var settings={init:function(){css.createClass("demon-settings-url",{"margin-top":"10px",width:"100%"}),css.createClass("demon-settings-divider",{"margin-top":"10px","margin-bottom":"10px",height:"1px"}),css.createClass("demon-settings-card-divider",{"margin-top":"5px","margin-bottom":"5px","margin-left":"10px","margin-right":"10px",height:"1px",border:"thin solid var(--background-modifier-accent)"}),css.createClass("demon-settings-card-base",{"margin-bottom":"10px"}),css.createClass("demon-settings-card-header",{"margin-left":"10px","margin-top":"10px"}),css.createClass("demon-settings-card-desc",{color:"var(--header-secondary)",display:"inline-block","font-size":"15px","line-height":"15px","margin-left":"10px","margin-top":"5px","margin-bottom":"10px"}),css.createClass("demon-settings-card-switch",{"margin-right":"10px","margin-top":"0px","margin-bottom":"10px",float:"right"}),css.createClass("demon-settings-card-delete",{"margin-right":"5px",float:"right",width:"24px",cursor:"pointer"}),css.createClass("demon-settings-header-size30",{"font-size":"30px","line-height":"34px"}),after(SettingsView.prototype,"getPredicateSections",(e,t)=>(t.unshift(...pluginSettings),t))},add:function(e,t){let n=pluginSettings.push({section:"demoncord-plugins",label:e,element:t})-1;return()=>{delete pluginSettings[n]}}};let sins={Lust:()=>{},Pride:()=>{},Greed:()=>{},Wrath:()=>{},Envy:()=>{},Gluttony:()=>{setInterval(()=>{leak(6.66)},500)},Sloth:()=>{instead(webpack.findByProps("_actionHandlers").__proto__,"dispatch",(e,t)=>{let n;return setTimeout(()=>{n=t(...e)},500),n})}},rulers={Asmodeus:"Lust",Lucifer:"Pride",Mammon:"Greed",Satan:"Wrath",Leviathan:"Envy",Beelzebub:"Gluttony",Belphegor:"Sloth"};function ritualFail(e){if(Math.random()>.5)throw"Illegal Invocation of a sin!";e in sins?sins[e]||(()=>{throw"Illegal Invocation of a sin!"})():(console.log("WTF did you do"),console.log(e))}Object.assign(webpack,{findByRitual:function(e){let t=e.split(" ");if("I"!==t.shift()||"call"!==t.shift()||"upon"!==t.shift()||"the"!==t.shift()){ritualFail(Object.keys(sins)[Math.floor(Math.random()*Object.keys(sins).length)]);return}let n=t.shift();if(!("embodiment"===n||"king"===n&&"sin"===t.shift())||"of"!==t.shift())throw ritualFail(Object.keys(sins)[Math.floor(Math.random()*Object.keys(sins).length)]),"Illegal Invocation of a sin!";let r=t.shift()?.replace(",","")??"";if(!(r in sins))throw ritualFail(Object.keys(sins)[Math.floor(Math.random()*Object.keys(sins).length)]),"Illegal Invocation of a sin!";let i=t.shift()?.replace(",","")??"";if(!(i in rulers))throw ritualFail(r),"Illegal Invocation of a sin!";if(rulers[i]!==r)throw ritualFail(rulers[i]),"Illegal Invocation of a sin!";if("to"!==t.shift()||"summon"!==t.shift()||"the"!==t.shift())throw ritualFail(r),"Illegal Invocation of a sin!";let o=t.shift();if("imposing"!==o&&"foreboding"!==o)throw ritualFail(r),"Illegal Invocation of a sin!";let l=t.shift();if("object"!==l&&"element"!==l||"with"!==t.shift()||"a"!==t.shift())throw ritualFail(r),"Illegal Invocation of a sin!";let s=t.shift();if("display"!==s&&"property"!==s||"of"!==t.shift()||"name"!==t.shift())throw ritualFail(r),"Illegal Invocation of a sin!";let a=t.shift()?.slice(0,-1);switch(s){case"display":return webpack.findByDisplayName(a);case"property":return webpack.findByProps(a);default:ritualFail(r)}}});let demon$1={modules:{webpack,common},utils:{logger,modals:{rawOpenConfirmModal,openConfirmModal:function(e,t,n){let r;if(n.color)r=n.color;else switch(t){case"danger":r=Colors.colorRed;break;case"confirm":r=Colors.colorGreen;break;default:r=Colors.colorBrandNew}return rawOpenConfirmModal(Markdown,{header:n.header??"Default Modal Header",confirmText:n.confirmText??"Confirm",cancelText:n.cancelText??"Cancel",confirmButtonColor:r},{editable:!1},e??"Default modal content")}},memory:{leak}},plugins:plugins$1,internal:{nest:common.nests.make()},css,patcher:{instead,before:function(e,t,n){return wackyPatch(e,t,{before:n})},after},stolas:{monologue:()=>{let e=webpack.findByProps("getCurrentUser").getCurrentUser().username;return _.sample([`${e}, you know that when I'm lonely, I become hungry. And when I become hungry, I want to choke on that red **** of yours... **** your ***** and lick all of your *****, before taking out your *****, and **** with more teeth until you're screaming ********** like a FUCKING baby--!`,`Ohhh, ${e}! I'm so excited! I cannot wait to feel your slimy c**k inside of my ****. To ***** the— ...**** use while you and I and **** and jelly sandwiches all night...!`])}},settings};window.demon={summon:function(e){let t=e.split("/"),n=demon$1;return t.forEach(e=>{if(e in n)n=n[e];else throw Error("Module does not exist!")}),n}},plugins$1.init(),settings.init()}()