!function(){"use strict";class e{static byProps(e,t=(e=>e)){return s=>{if(!s)return!1;if("object"!=typeof s&&"function"!=typeof s)return!1;const n=t(s);if(!n)return!1;for(let t=0;te)){return s=>{if(!s)return!1;if("object"!=typeof s&&"function"!=typeof s)return!1;const n=t(s);if(!n)return!1;if(!n.prototype)return!1;for(let t=0;te)){return s=>{const n=t(s);if(!n)return!1;let r="";try{r=n.toString([])}catch(e){r=n.toString()}return-1!==r.search(e)}}static byStrings(...e){return t=>{if(!t?.toString||"function"!=typeof t?.toString)return;let s="";try{s=t?.toString([])}catch(e){s=t?.toString()}if(!s)return!1;for(const t of e)if(!s.includes(t))return!1;return!0}}static byDisplayName(e){return t=>t&&t.displayName===e}static combine(...e){return t=>e.every((e=>e(t)))}}const t=new WeakSet,s=e=>(s,n,r)=>{try{return!(s?.default?.remove&&s?.default?.set&&s?.default?.clear&&s?.default?.get&&!s?.default?.sort)&&(!(s.remove&&s.set&&s.clear&&s.get&&!s.sort)&&(!(s?.default?.getToken||s?.default?.getEmail||s?.default?.showToken)&&(!(s.getToken||s.getEmail||s.showToken)&&e(s,n,r))))}catch(s){return t.has(e)||Logger.warn("WebpackModules~getModule","Module filter threw an exception.",e,s),t.add(e),!1}};class n{static find(e,t=!0){return this.getModule(e,{first:t})}static findAll(e){return this.getModule(e,{first:!1})}static findByUniqueProperties(e,t=!0){return t?this.getByProps(...e):this.getAllByProps(...e)}static findByDisplayName(e){return this.getByDisplayName(e)}static getModule(e,t={}){const{first:n=!0,defaultExport:r=!0,searchExports:i=!1}=t,o=s(e),l=this.getAllModules(),a=[],d=Object.keys(l);for(let e=0;e{const t=()=>this.removeListener(s),s=function(s){if(!s||s===window||s===document.documentElement)return;let n=null;if("object"==typeof s&&i)for(const e in s){n=null;const t=s[e];t&&(l(t)&&(n=t))}else s.Z&&l(s.Z)&&(n=r?s.Z:s),s.ZP&&l(s.ZP)&&(n=r?s.ZP:s),s.__esModule&&s.default&&l(s.default)&&(n=r?s.default:s),l(s)&&(n=s);n&&(t(),e(n))};this.addListener(s),n?.addEventListener("abort",(()=>{t(),e()}))}))}static get require(){if(this._require)return this._require;const e="bd-webpackmodules";let t;return"undefined"!=typeof webpackJsonp?t=window.webpackJsonp.push([[],{[e]:(e,t,s)=>e.exports=s},[[e]]]):void 0!==window[this.chunkName]&&window[this.chunkName].push([[e],{},e=>t=e]),delete t.m[e],delete t.c[e],this._require=t}static getAllModules(){return this.require.c}static get chunkName(){return"webpackChunkdiscord_app"}static initialize(){this.handlePush=this.handlePush.bind(this),this.listeners=new Set,this.__ORIGINAL_PUSH__=window[this.chunkName].push,Object.defineProperty(window[this.chunkName],"push",{configurable:!0,get:()=>this.handlePush,set:e=>{this.__ORIGINAL_PUSH__=e,Object.defineProperty(window[this.chunkName],"push",{value:this.handlePush,configurable:!0,writable:!0})}})}static addListener(e){return this.listeners.add(e),this.removeListener.bind(this,e)}static removeListener(e){return this.listeners.delete(e)}static handlePush(e){const[,t]=e;for(const e in t){const s=t[e];t[e]=(e,t,n)=>{try{Reflect.apply(s,null,[e,t,n]);const r=[...this.listeners];for(let e=0;es.toString()})}return Reflect.apply(this.__ORIGINAL_PUSH__,window[this.chunkName],[e])}}function r(e){return new Promise((t=>setTimeout(t,e)))}function i(e,t){return new Promise(((s,n)=>{e(t).then((e=>s(e.body))).catch((r=>{429==r.status?setTimeout((()=>i(e,t).then(s)),1e3*r.body.retry_after):n(r)}))}))}n.initialize();const o=n.getByProps("Inflate").Inflate;n.getByProps("createElement","cloneElement"),n.getByProps("render","findDOMNode");const l=n.getByProps("getAPIBaseURL");n.getByProps("getToken");const a=n.getByProps("getCurrentUser");n.getByProps("receiveMessage","sendBotMessage");const d=n.getByProps("getMember"),u=n.getByProps("getChannel");n.getByProps("getChannels");const c=n.getByProps("getMessages"),h=n.getByProps("getLastSelectedGuildId"),g=n.getByProps("getLastSelectedChannelId"),p=n.getByProps("getUsers"),f=n.getByProps("getActivityMetadata").getState(),y=(()=>{for(let e of Object.keys(n.getAllModules()[461061].exports)){let t=n.getAllModules()[461061].exports[e];if(t?.SEARCH_GUILD)return{Endpoints:t}}})();function m(){const e=Promise.all([new Promise((e=>{const t=WebSocket.prototype.send;WebSocket.prototype.send=function(){return this.url.includes("gateway.discord.gg")&&(WebSocket.prototype.send=t,e(this)),t.apply(this,arguments)}})),new Promise((e=>{const t=o.prototype.push;o.prototype.push=function(){return o.prototype.push=t,e(this),t.apply(this,arguments)}}))]);return e.then((([e,t])=>{let s={pack:JSON.stringify,unpack:e=>e},n=t.onEnd;return{ws:e,setSpotifyStatus(e={}){this.send({op:3,d:{status:"dnd",since:0,activities:[{type:2,name:"Spotify",assets:{large_image:`spotify:${e.image}`,large_text:e.title},details:e.title,state:e.authors,timestamps:{start:Date.now(),end:Date.now()+864e5},party:{id:"spotify:"},sync_id:null,flags:48,metadata:{album_id:null,artist_ids:[]}}],afk:!1}})},setVoiceState(e={}){this.send({op:4,d:{guild_id:e.guild??DISTOOLS.selectedGuildId,channel_id:e.channel??DISTOOLS.selectedChannelId,self_mute:mute??!1,self_deaf:deaf??!1,self_video:video??!1}})},fetchGuildMembers(){for(let e=0;e<5e3;e+=100)this.send({op:14,d:{guild_id:DISTOOLS.selectedGuildId,channels:{[DISTOOLS.selectedChannelId]:[[0,99],[e,e-1]]}}})},send(t){e.send(s.pack(t))},receive(e){n=t.onEnd,t.onEnd=function(){return this.chunks.map((t=>{e(s.unpack(t))})),n.apply(this,arguments)}},stop(){t.onEnd=n}}}))}const w={hijack(){m().then((e=>{window.Trampoline=e,console.log("HIJACKED.")}))},fetchRelationships:e=>i(l.get,y.Endpoints.USER_RELATIONSHIPS(e)),async searchSharedFriends(e){let t=Object.values(w.users),s=[];for(let e of t)e.relationships?s.push(Promise.resolve(e)):(s.push(w.fetchRelationships(e.id).then((t=>(e.relationships=t,e)))),await r(20));return Promise.all(s).then((t=>t.filter((({relationships:t})=>t.find((({id:t})=>t===e))))))},getUserActivities(e){let t=f.clientStatuses[e];return t&&{id:e,activities:f.activities[e],status:t}},searchGuildMessages:(e=w.selectedGuildId,t=w.user.id,s=0)=>i(l.get,y.Endpoints.SEARCH_GUILD(e)+`?author_id=${t}&include_nsfw=true&offset=${s}`),searchChannelMessages:(e=w.selectedChannelId,t=w.user.id,s=0)=>i(l.get,y.Endpoints.SEARCH_CHANNEL(e)+`?author_id=${t}&offset=${s}`),async searchAllMessages(e,t,s,n=!0){let r,i=[],o=0;for(;(r=await e(t,s,o)).messages.length&&(i.push(...r.messages),o+=r.messages.length,!(i.length>=1500)););return n?i.map((e=>e.find((e=>e.hit)))):i},searchAllGuildMessages:(e=w.selectedGuildId,t=w.user.id,s=!0)=>w.searchAllMessages(w.searchGuildMessages,e,t,s),searchAllChannelMessages:(e=w.selectedChannelId,t=w.user.id,s=!0)=>w.searchAllMessages(w.searchChannelMessages,e,t,s),deleteMessage:(e,t)=>i(l.delete,y.Endpoints.MESSAGES(e)+"/"+t),async deleteSearchMessages(e,t,s){let n=await w.searchAllMessages(e,t,s),i=0;w.progressBar.setSteps(n.length);for(let e of n)w.progressBar.setProgress(++i),console.log(`[DISTOOLS][🗑️] ${i} / ${n.length} messages.`),0!=e.type&&19!=e.type||(await w.deleteMessage(e.channel_id,e.id),await r(150));console.log("Done."),await r(2e3),w.progressBar.setProgress(0)},deleteGuildMessages:(e=w.selectedGuildId,t=w.user.id)=>w.deleteSearchMessages(w.searchGuildMessages,e,t),deleteChannelMessages:(e=w.selectedChannelId,t=w.user.id)=>w.deleteSearchMessages(w.searchChannelMessages,e,t),async fetchAllMessages(e=w.selectedChannelId){let t=[],s=[];do{s.push(...t),t=await i(l.get,{url:y.Endpoints.MESSAGES(e),query:{before:t.length?t[t.length-1].id:null,limit:100}})}while(t.length>0);return s.reverse()},saveMessages(e=w.selectedChannelId){alert("Starting downloading conversation.\nPlease do not click any buttons of the menu !"),w.fetchAllMessages(e).then((t=>{const s=new Map;t=t.map((e=>(s.set(e.author.id,e.author),(e={...e}).author=e.author.id,delete e.channel_id,e))),function(e,t){let s=window.URL.createObjectURL(new Blob([t],{type:"octet/stream"})),n=document.createElement("a");n.href=s,n.download=e,n.style.display="none",n.click(),window.URL.revokeObjectURL(s)}(`${e}.json`,JSON.stringify({channel:e,users:[...s.values()],messages:t}))}))},get members(){return w.selectedGuildId?d.getMembers(w.selectedGuildId):u.getChannel(w.selectedChannelId).rawRecipients},get users(){return p.getUsers()},get selectedGuildId(){return h.getGuildId()},get selectedChannelId(){return g.getChannelId()},get selectedChannel(){return u.getChannel(w.selectedChannelId)},get messages(){return c.getMessages(w.selectedChannelId).toArray()},get user(){return a.getCurrentUser()}};w.progressBar=new Proxy({},{get:()=>()=>{}}),window.DISTOOLS=w}();