You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2 lines
17 KiB

!function(){"use strict";let getModules,modules,defaultGetStoreFunc,pluginNest;window.webpackChunkdiscord_app.push([[Math.random().toString(36)],{},e=>{modules=e}]);let webpack={modules:(getModules=()=>modules.c)(),getModules,filter:function(e,t,n=!1){let o,i=[];for(let r in t){let l=t[r].exports;if(l){if(l.default&&l.__esModule&&e(l.default)){if(n){o=l.default;break}i.push(l.default)}else if(e(l)){if(n){o=l;break}i.push(l)}}}return n?o:i},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 o=promisifyRequest(n);return(e,n)=>o.then(o=>n(o.transaction(t,e).objectStore(t)))}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((o,i)=>{n.get(e).onsuccess=function(){try{n.put(t(this.result),e),o(promisifyRequest(n.transaction))}catch(r){i(r)}}}))},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,o)=>{this.off(e,n),t(e,o)};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(o,i,r){return new Proxy(o,{get(o,l){let a=[...r,l],s=o[l];return null!=s?(n.get({path:a,value:s}),!t&&Array.isArray(s))?s:"object"==typeof s?e(s,i,a):s:e(o[l]={},i,a)},set:(e,t,o)=>(e[t]=o,n.set({path:[...r,t],value:o}),!0),deleteProperty:(e,t)=>!!delete e[t]&&(n.delete({path:[...r,t]}),!0),has:(e,t)=>("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[,o]=useReducer(e=>~e,0);return useEffect(()=>{function i(e,t){n(e,t)&&o()}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,lodash:findByProps$1("sample")};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,...o){let i=o.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 r=["Demoncord",...n,i],l=[],a="";t&&r.splice(0,1);for(let s=0;s<r.length;s++)s===r.length-1?(a+="%c"+r[s],l.push(styleTxt)):(a+="%c"+r[s]+"%c ",l.push(styleBg,""));e(a,...l)}}let log=makeLogger(console.log),warn=makeLogger(console.warn),error=makeLogger(console.error),trace=makeLogger(console.trace),debug=makeLogger((...e)=>{});var logger={log,warn,error,trace,debug,makeLogger};function _extends(){return(_extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e}).apply(this,arguments)}let{findByProps,findByDisplayName,findByDisplayNameAll}=webpack,{openModal}=findByProps("openModalLazy"),Colors=findByProps("button","colorRed"),ConfirmModal=findByDisplayName("ConfirmModal"),Markdown=findByDisplayNameAll("Markdown")[1];function rawOpenConfirmModal(e,t,n,o){let i;return void 0===n&&(n={}),void 0===o&&(o=""),openModal(r=>3!==r.transitionState&&React.createElement(ConfirmModal,_extends({transitionState:r.transitionState,onClose:()=>i=!1,onCancel(){i=!1,r.onClose()},onConfirm(){i=!0,r.onClose()}},t),React.createElement(e,_extends({},n),o))),i}function leak(e){window.beelzejuice||(window.beelzejuice=[]),window.beelzejuice.push(new Uint8Array(Math.floor(1048576*e)).fill(666))}let ctxNest=make(),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,t={}){let n=pluginEval(e);logger.debug(["Plugins"],`Adding ${n.meta.name}`),pluginNest.store.plugins[n.meta.name]={iife:e,enabled:!1,desc:n.meta.desc},Object.assign(pluginNest.store.plugins[n.meta.name],t)}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),o=n.onStart();ctxNest.store[e]=o,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 o=e;e=t,t=o}let i=Symbol(),r=n.before,l=n.instead,a=n.after,s=new Proxy(e[t],{apply(e,t,[o,i]){console.log(t),void 0!==r&&r.apply(o,[i]);let s=void 0!==n.instead?l?.apply(o,[i,e.bind(o),o]):e.apply(o,i);return void 0===a?s:a.apply(o,[i,s])}}),c=e[t];e[t]=function(){return s(this,arguments)};let d=()=>{e[t]=c};return e[i]={name:t,orig:c,unpatch:d},d}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",async onClick(){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,async onChange(){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:"Raw link to plugin",type:"text",value:t,onChange:n,async onKeyDown(e){if("Enter"===e.key){let o=await (await fetch("https://cors.ruthenic.com/"+t)).text();add$1(o,{url:t}),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 o=t.shift()?.replace(",","")??"";if(!(o 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(o),"Illegal Invocation of a sin!";if(rulers[i]!==o)throw ritualFail(rulers[i]),"Illegal Invocation of a sin!";if("to"!==t.shift()||"summon"!==t.shift()||"the"!==t.shift())throw ritualFail(o),"Illegal Invocation of a sin!";let r=t.shift();if("imposing"!==r&&"foreboding"!==r)throw ritualFail(o),"Illegal Invocation of a sin!";let l=t.shift();if("object"!==l&&"element"!==l||"with"!==t.shift()||"a"!==t.shift())throw ritualFail(o),"Illegal Invocation of a sin!";let a=t.shift();if("display"!==a&&"property"!==a||"of"!==t.shift()||"name"!==t.shift())throw ritualFail(o),"Illegal Invocation of a sin!";let s=t.shift()?.slice(0,-1);switch(a){case"display":return webpack.findByDisplayName(s);case"property":return webpack.findByProps(s);default:ritualFail(o)}}});let demon$1={modules:{webpack,common},utils:{logger,modals:{rawOpenConfirmModal,openConfirmModal:function(e,t,n){let o;if(n.color)o=n.color;else switch(t){case"danger":o=Colors.colorRed;break;case"confirm":o=Colors.colorGreen;break;default:o=Colors.colorBrandNew}return rawOpenConfirmModal(Markdown,{header:n.header??"Default Modal Header",confirmText:n.confirmText??"Confirm",cancelText:n.cancelText??"Cancel",confirmButtonColor:o},{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,regexPatch:function(match,replace,obj,prop){let oldFunc=obj[prop],injId=Symbol(),prox=new Proxy(obj[prop],{apply(target,thisArg,[ctx,args]){let str=oldFunc.toString();str=str.replaceAll(match,replace),console.log("("+str+")");let newfunc=eval.apply(ctx,["("+str+")"]);return console.log(ctx),newfunc.apply(ctx,args)}}),orig=obj[prop];obj[prop]=prox;let unpatch=()=>{obj[prop]=orig};return obj[injId]={name:prop,orig:orig,unpatch:unpatch},unpatch}},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()}();