From 2fe9e0ae1d601924f4abf9d55dbb1d58bc07dd75 Mon Sep 17 00:00:00 2001 From: Travis CI Date: Sat, 9 Feb 2019 17:36:17 +0000 Subject: [PATCH] Webpack build for branch partials: 20c30686543cacaa2b54ee495b5bcb58a479df2a --- discord.partials.min.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/discord.partials.min.js b/discord.partials.min.js index 45f55e94..b7df0ed4 100644 --- a/discord.partials.min.js +++ b/discord.partials.min.js @@ -1 +1 @@ -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Discord=t():e.Discord=t()}(window,function(){return function(e){var t={};function s(i){if(t[i])return t[i].exports;var n=t[i]={i:i,l:!1,exports:{}};return e[i].call(n.exports,n,n.exports,s),n.l=!0,n.exports}return s.m=e,s.c=t,s.d=function(e,t,i){s.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},s.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},s.t=function(e,t){if(1&t&&(e=s(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(s.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)s.d(i,n,function(t){return e[t]}.bind(null,n));return i},s.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return s.d(t,"a",t),t},s.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},s.p="",s(s.s=83)}([function(e,t,s){"use strict";(function(e){const i=t.Package=s(45),{Error:n,RangeError:r}=s(4),o=t.browser="undefined"!=typeof window;t.DefaultOptions={shardCount:1,totalShardCount:1,messageCacheMaxSize:200,messageCacheLifetime:0,messageSweepInterval:0,fetchAllMembers:!1,disableEveryone:!1,partials:!1,restWsBridgeTimeout:5e3,disabledEvents:[],retryLimit:1,restTimeOffset:500,restSweepInterval:60,presence:{},ws:{large_threshold:250,compress:!1,properties:{$os:o?"browser":e.platform,$browser:"discord.js",$device:"discord.js"},version:6},http:{version:7,api:"https://discordapp.com/api",cdn:"https://cdn.discordapp.com",invite:"https://discord.gg"}},t.UserAgent=o?null:`DiscordBot (${i.homepage.split("#")[0]}, ${i.version}) Node.js/${e.version}`,t.WSCodes={1000:"WS_CLOSE_REQUESTED",4004:"TOKEN_INVALID",4010:"SHARDING_INVALID",4011:"SHARDING_REQUIRED"};const a=["webp","png","jpg","gif"],l=Array.from({length:8},(e,t)=>2**(t+4));function h(e,{format:t="webp",size:s}={}){if(t&&!a.includes(t))throw new n("IMAGE_FORMAT",t);if(s&&!l.includes(s))throw new r("IMAGE_SIZE",s);return`${e}.${t}${s?`?size=${s}`:""}`}t.Endpoints={CDN:e=>({Emoji:(t,s="png")=>`${e}/emojis/${t}.${s}`,Asset:t=>`${e}/assets/${t}`,DefaultAvatar:t=>`${e}/embed/avatars/${t}.png`,Avatar:(t,s,i="default",n)=>("default"===i&&(i=s.startsWith("a_")?"gif":"webp"),h(`${e}/avatars/${t}/${s}`,{format:i,size:n})),Icon:(t,s,i="webp",n)=>h(`${e}/icons/${t}/${s}`,{format:i,size:n}),AppIcon:(t,s,{format:i="webp",size:n}={})=>h(`${e}/app-icons/${t}/${s}`,{size:n,format:i}),AppAsset:(t,s,{format:i="webp",size:n}={})=>h(`${e}/app-assets/${t}/${s}`,{size:n,format:i}),GDMIcon:(t,s,i="webp",n)=>h(`${e}/channel-icons/${t}/${s}`,{size:n,format:i}),Splash:(t,s,i="webp",n)=>h(`${e}/splashes/${t}/${s}`,{size:n,format:i})}),invite:(e,t)=>`${e}/${t}`,botGateway:"/gateway/bot"},t.Status={READY:0,CONNECTING:1,RECONNECTING:2,IDLE:3,NEARLY:4,DISCONNECTED:5},t.VoiceStatus={CONNECTED:0,CONNECTING:1,AUTHENTICATING:2,RECONNECTING:3,DISCONNECTED:4},t.OPCodes={DISPATCH:0,HEARTBEAT:1,IDENTIFY:2,STATUS_UPDATE:3,VOICE_STATE_UPDATE:4,VOICE_GUILD_PING:5,RESUME:6,RECONNECT:7,REQUEST_GUILD_MEMBERS:8,INVALID_SESSION:9,HELLO:10,HEARTBEAT_ACK:11},t.VoiceOPCodes={IDENTIFY:0,SELECT_PROTOCOL:1,READY:2,HEARTBEAT:3,SESSION_DESCRIPTION:4,SPEAKING:5,HELLO:8,CLIENT_CONNECT:12,CLIENT_DISCONNECT:13},t.Events={RATE_LIMIT:"rateLimit",READY:"ready",RESUMED:"resumed",GUILD_CREATE:"guildCreate",GUILD_DELETE:"guildDelete",GUILD_UPDATE:"guildUpdate",GUILD_UNAVAILABLE:"guildUnavailable",GUILD_AVAILABLE:"guildAvailable",GUILD_MEMBER_ADD:"guildMemberAdd",GUILD_MEMBER_REMOVE:"guildMemberRemove",GUILD_MEMBER_UPDATE:"guildMemberUpdate",GUILD_MEMBER_AVAILABLE:"guildMemberAvailable",GUILD_MEMBER_SPEAKING:"guildMemberSpeaking",GUILD_MEMBERS_CHUNK:"guildMembersChunk",GUILD_INTEGRATIONS_UPDATE:"guildIntegrationsUpdate",GUILD_ROLE_CREATE:"roleCreate",GUILD_ROLE_DELETE:"roleDelete",GUILD_ROLE_UPDATE:"roleUpdate",GUILD_EMOJI_CREATE:"emojiCreate",GUILD_EMOJI_DELETE:"emojiDelete",GUILD_EMOJI_UPDATE:"emojiUpdate",GUILD_BAN_ADD:"guildBanAdd",GUILD_BAN_REMOVE:"guildBanRemove",CHANNEL_CREATE:"channelCreate",CHANNEL_DELETE:"channelDelete",CHANNEL_UPDATE:"channelUpdate",CHANNEL_PINS_UPDATE:"channelPinsUpdate",MESSAGE_CREATE:"message",MESSAGE_DELETE:"messageDelete",MESSAGE_UPDATE:"messageUpdate",MESSAGE_BULK_DELETE:"messageDeleteBulk",MESSAGE_REACTION_ADD:"messageReactionAdd",MESSAGE_REACTION_REMOVE:"messageReactionRemove",MESSAGE_REACTION_REMOVE_ALL:"messageReactionRemoveAll",USER_UPDATE:"userUpdate",USER_NOTE_UPDATE:"userNoteUpdate",USER_SETTINGS_UPDATE:"clientUserSettingsUpdate",PRESENCE_UPDATE:"presenceUpdate",VOICE_STATE_UPDATE:"voiceStateUpdate",VOICE_BROADCAST_SUBSCRIBE:"subscribe",VOICE_BROADCAST_UNSUBSCRIBE:"unsubscribe",TYPING_START:"typingStart",TYPING_STOP:"typingStop",WEBHOOKS_UPDATE:"webhookUpdate",DISCONNECT:"disconnect",RECONNECTING:"reconnecting",ERROR:"error",WARN:"warn",DEBUG:"debug",SHARD_READY:"shardReady",INVALIDATED:"invalidated",RAW:"raw"},t.WSEvents=function(e){let t=Object.create(null);for(const s of e)t[s]=s;return t}(["READY","RESUMED","GUILD_CREATE","GUILD_DELETE","GUILD_UPDATE","GUILD_MEMBER_ADD","GUILD_MEMBER_REMOVE","GUILD_MEMBER_UPDATE","GUILD_MEMBERS_CHUNK","GUILD_INTEGRATIONS_UPDATE","GUILD_ROLE_CREATE","GUILD_ROLE_DELETE","GUILD_ROLE_UPDATE","GUILD_BAN_ADD","GUILD_BAN_REMOVE","GUILD_EMOJIS_UPDATE","CHANNEL_CREATE","CHANNEL_DELETE","CHANNEL_UPDATE","CHANNEL_PINS_UPDATE","MESSAGE_CREATE","MESSAGE_DELETE","MESSAGE_UPDATE","MESSAGE_DELETE_BULK","MESSAGE_REACTION_ADD","MESSAGE_REACTION_REMOVE","MESSAGE_REACTION_REMOVE_ALL","USER_UPDATE","PRESENCE_UPDATE","VOICE_STATE_UPDATE","TYPING_START","VOICE_SERVER_UPDATE","WEBHOOKS_UPDATE"]),t.MessageTypes=["DEFAULT","RECIPIENT_ADD","RECIPIENT_REMOVE","CALL","CHANNEL_NAME_CHANGE","CHANNEL_ICON_CHANGE","PINS_ADD","GUILD_MEMBER_JOIN"],t.ActivityTypes=["PLAYING","STREAMING","LISTENING","WATCHING"],t.ChannelTypes={TEXT:0,DM:1,VOICE:2,GROUP:3,CATEGORY:4},t.ClientApplicationAssetTypes={SMALL:1,BIG:2},t.Colors={DEFAULT:0,WHITE:16777215,AQUA:1752220,GREEN:3066993,BLUE:3447003,PURPLE:10181046,LUMINOUS_VIVID_PINK:15277667,GOLD:15844367,ORANGE:15105570,RED:15158332,GREY:9807270,NAVY:3426654,DARK_AQUA:1146986,DARK_GREEN:2067276,DARK_BLUE:2123412,DARK_PURPLE:7419530,DARK_VIVID_PINK:11342935,DARK_GOLD:12745742,DARK_ORANGE:11027200,DARK_RED:10038562,DARK_GREY:9936031,DARKER_GREY:8359053,LIGHT_GREY:12370112,DARK_NAVY:2899536,BLURPLE:7506394,GREYPLE:10070709,DARK_BUT_NOT_BLACK:2895667,NOT_QUITE_BLACK:2303786},t.APIErrors={UNKNOWN_ACCOUNT:10001,UNKNOWN_APPLICATION:10002,UNKNOWN_CHANNEL:10003,UNKNOWN_GUILD:10004,UNKNOWN_INTEGRATION:10005,UNKNOWN_INVITE:10006,UNKNOWN_MEMBER:10007,UNKNOWN_MESSAGE:10008,UNKNOWN_OVERWRITE:10009,UNKNOWN_PROVIDER:10010,UNKNOWN_ROLE:10011,UNKNOWN_TOKEN:10012,UNKNOWN_USER:10013,UNKNOWN_EMOJI:10014,UNKNOWN_WEBHOOK:10015,BOT_PROHIBITED_ENDPOINT:20001,BOT_ONLY_ENDPOINT:20002,MAXIMUM_GUILDS:30001,MAXIMUM_FRIENDS:30002,MAXIMUM_PINS:30003,MAXIMUM_ROLES:30005,MAXIMUM_REACTIONS:30010,UNAUTHORIZED:40001,MISSING_ACCESS:50001,INVALID_ACCOUNT_TYPE:50002,CANNOT_EXECUTE_ON_DM:50003,EMBED_DISABLED:50004,CANNOT_EDIT_MESSAGE_BY_OTHER:50005,CANNOT_SEND_EMPTY_MESSAGE:50006,CANNOT_MESSAGE_USER:50007,CANNOT_SEND_MESSAGES_IN_VOICE_CHANNEL:50008,CHANNEL_VERIFICATION_LEVEL_TOO_HIGH:50009,OAUTH2_APPLICATION_BOT_ABSENT:50010,MAXIMUM_OAUTH2_APPLICATIONS:50011,INVALID_OAUTH_STATE:50012,MISSING_PERMISSIONS:50013,INVALID_AUTHENTICATION_TOKEN:50014,NOTE_TOO_LONG:50015,INVALID_BULK_DELETE_QUANTITY:50016,CANNOT_PIN_MESSAGE_IN_OTHER_CHANNEL:50019,INVALID_OR_TAKEN_INVITE_CODE:50020,CANNOT_EXECUTE_ON_SYSTEM_MESSAGE:50021,BULK_DELETE_MESSAGE_TOO_OLD:50034,INVITE_ACCEPTED_TO_GUILD_NOT_CONTAINING_BOT:50036,REACTION_BLOCKED:90001},t.DefaultMessageNotifications=["ALL","MENTIONS"]}).call(this,s(27))},function(e,t,s){"use strict";e.exports=class GenericAction{constructor(e){this.client=e}handle(e){return e}getChannel(e){const t=e.channel_id||e.id;return e.channel||(this.client.options.partials?this.client.channels.add({...e,id:t}):this.client.channels.get(t))}getMessage(e,t){const s=e.message_id||e.id;return e.message||(this.client.options.partials?t.messages.add({...e,id:s}):t.messages.get(s))}}},function(e,t,s){"use strict";const{Colors:i,DefaultOptions:n,Endpoints:r}=s(0),o=s(28),{Error:a,RangeError:l,TypeError:h}=s(4),c=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),u=e=>"object"==typeof e&&null!==e,{parse:d}=s(29);class Util{constructor(){throw new Error(`The ${this.constructor.name} class may not be instantiated.`)}static flatten(e,...t){if(!u(e))return e;t=Object.assign(...Object.keys(e).filter(e=>!e.startsWith("_")).map(e=>({[e]:!0})),...t);const i={};for(let[n,r]of Object.entries(t)){if(!r)continue;r=!0===r?n:r;const t=e[n],o=u(t),a=o&&"function"==typeof t.valueOf?t.valueOf():null;t instanceof s(3)?i[r]=Array.from(t.keys()):Array.isArray(t)?i[r]=t.map(e=>Util.flatten(e)):"object"!=typeof a?i[r]=a:o||(i[r]=t)}return i}static splitMessage(e,{maxLength:t=2e3,char:s="\n",prepend:i="",append:n=""}={}){if(e.length<=t)return e;const r=e.split(s);if(r.some(e=>e.length>t))throw new l("SPLIT_MAX_LEN");const o=[];let a="";for(const e of r)a&&(a+s+e+n).length>t&&(o.push(a+n),a=i),a+=(a&&a!==i?s:"")+e;return o.concat(a).filter(e=>e)}static escapeMarkdown(e,t=!1,s=!1){return t?e.replace(/```/g,"`​``"):s?e.replace(/\\(`|\\)/g,"$1").replace(/(`|\\)/g,"\\$1"):e.replace(/\\(\*|_|`|~|\\)/g,"$1").replace(/(\*|_|`|~|\\)/g,"\\$1")}static fetchRecommendedShards(e,t=1e3){if(!e)throw new a("TOKEN_MISSING");return o(`${n.http.api}/v${n.http.version}${r.botGateway}`,{method:"GET",headers:{Authorization:`Bot ${e.replace(/^Bot\s*/i,"")}`}}).then(e=>{if(e.ok)return e.json();throw e}).then(e=>e.shards*(1e3/t))}static parseEmoji(e){if(e.includes("%")&&(e=decodeURIComponent(e)),!e.includes(":"))return{animated:!1,name:e,id:null};const t=e.match(/?/);return t?{animated:Boolean(t[1]),name:t[2],id:t[3]}:null}static cloneObject(e){return Object.assign(Object.create(e),e)}static mergeDefault(e,t){if(!t)return e;for(const s in e)c(t,s)&&void 0!==t[s]?t[s]===Object(t[s])&&(t[s]=Util.mergeDefault(e[s],t[s])):t[s]=e[s];return t}static convertToBuffer(e){return"string"==typeof e&&(e=Util.str2ab(e)),Buffer.from(e)}static str2ab(e){const t=new ArrayBuffer(2*e.length),s=new Uint16Array(t);for(var i=0,n=e.length;i-1&&s16777215)throw new l("COLOR_RANGE");if(e&&isNaN(e))throw new h("COLOR_CONVERT");return e}static discordSort(e){return e.sort((e,t)=>e.rawPosition-t.rawPosition||parseInt(t.id.slice(0,-10))-parseInt(e.id.slice(0,-10))||parseInt(t.id.slice(10))-parseInt(e.id.slice(10)))}static setPosition(e,t,s,i,n,r){let o=i.array();return Util.moveElementInArray(o,e,t,s),o=o.map((e,t)=>({id:e.id,position:t})),n.patch({data:o,reason:r}).then(()=>o)}static basename(e,t){let s=d(e);return t&&s.ext.startsWith(t)?s.name:s.base.split("?")[0]}static idToBinary(e){let t="",s=parseInt(e.slice(0,-10))||0,i=parseInt(e.slice(-10));for(;i>0||s>0;)t=String(1&i)+t,i=Math.floor(i/2),s>0&&(i+=s%2*5e9,s=Math.floor(s/2));return t}static binaryToID(e){let t="";for(;e.length>50;){const s=parseInt(e.slice(0,-32),2),i=parseInt((s%10).toString(2)+e.slice(-32),2);t=(i%10).toString()+t,e=Math.floor(s/10).toString(2)+Math.floor(i/10).toString(2).padStart(32,"0")}for(e=parseInt(e,2);e>0;)t=(e%10).toString()+t,e=Math.floor(e/10);return t}static cleanContent(e,t){return e.replace(/@(everyone|here)/g,"@​$1").replace(/<@!?[0-9]+>/g,e=>{const s=e.replace(/<|!|>|@/g,"");if("dm"===t.channel.type){const i=t.client.users.get(s);return i?`@${i.username}`:e}const i=t.channel.guild.members.get(s);if(i)return`@${i.displayName}`;{const i=t.client.users.get(s);return i?`@${i.username}`:e}}).replace(/<#[0-9]+>/g,e=>{const s=t.client.channels.get(e.replace(/<|#|>/g,""));return s?`#${s.name}`:e}).replace(/<@&[0-9]+>/g,e=>{if("dm"===t.channel.type)return e;const s=t.guild.roles.get(e.replace(/<|@|>|&/g,""));return s?`@${s.name}`:e})}static delayFor(e){return new Promise(t=>{setTimeout(t,e)})}static mixin(e,t){const i=s(3);Object.getOwnPropertyNames(i.prototype).concat(Object.getOwnPropertyNames(Map.prototype)).forEach(s=>{if(t.includes(s))return;if("size"===s)return void Object.defineProperty(e.prototype,s,{get:function(){return this._filtered[s]}});const n=i.prototype[s];"constructor"!==s&&"function"==typeof n&&(e.prototype[s]=function(...e){return n.apply(this._filtered,e)})})}}e.exports=Util},function(e,t,s){"use strict";const i=s(2);e.exports=class Collection extends Map{constructor(e){super(e),Object.defineProperty(this,"_array",{value:null,writable:!0,configurable:!0}),Object.defineProperty(this,"_keyArray",{value:null,writable:!0,configurable:!0})}set(e,t){return this._array=null,this._keyArray=null,super.set(e,t)}delete(e){return this._array=null,this._keyArray=null,super.delete(e)}array(){return this._array&&this._array.length===this.size||(this._array=[...this.values()]),this._array}keyArray(){return this._keyArray&&this._keyArray.length===this.size||(this._keyArray=[...this.keys()]),this._keyArray}first(e){if(void 0===e)return this.values().next().value;if(e<0)return this.last(-1*e);e=Math.min(this.size,e);const t=new Array(e),s=this.values();for(let i=0;i{const i=e.get(s);return i!==t||void 0===i&&!e.has(s)}))}sort(e=((e,t)=>+(e>t)||+(e===t)-1)){return new this.constructor[Symbol.species]([...this.entries()].sort((t,s)=>e(t[1],s[1],t[0],s[0])))}toJSON(){return this.map(e=>"function"==typeof e.toJSON?e.toJSON():i.flatten(e))}}},function(e,t,s){"use strict";e.exports=s(46),e.exports.Messages=s(84)},function(e,t,s){"use strict";const i=s(3);let n;e.exports=class DataStore extends i{constructor(e,t,i){if(super(),n||(n=s(18)),Object.defineProperty(this,"client",{value:e}),Object.defineProperty(this,"holds",{value:n.get(i.name)||i}),t)for(const e of t)this.add(e)}add(e,t=!0,{id:s,extras:i=[]}={}){const n=this.get(s||e.id);if(n)return n;const r=this.holds?new this.holds(this.client,e,...i):e;return t&&this.set(s||r.id,r),r}remove(e){return this.delete(e)}resolve(e){return e instanceof this.holds?e:"string"==typeof e&&this.get(e)||null}resolveID(e){return e instanceof this.holds?e.id:"string"==typeof e?e:null}static get[Symbol.species](){return i}}},function(e,t,s){"use strict";const i=s(2);e.exports=class Base{constructor(e){Object.defineProperty(this,"client",{value:e})}_clone(){return Object.assign(Object.create(this),this)}_patch(e){return e}_update(e){const t=this._clone();return this._patch(e),t}toJSON(...e){return i.flatten(this,...e)}valueOf(){return this.id}}},function(e,t,s){"use strict";const i=s(20);class Permissions extends i{has(e,t=!0){return!(!t||!super.has(this.constructor.FLAGS.ADMINISTRATOR))||super.has(e)}}Permissions.FLAGS={CREATE_INSTANT_INVITE:1,KICK_MEMBERS:2,BAN_MEMBERS:4,ADMINISTRATOR:8,MANAGE_CHANNELS:16,MANAGE_GUILD:32,ADD_REACTIONS:64,VIEW_AUDIT_LOG:128,PRIORITY_SPEAKER:256,VIEW_CHANNEL:1024,SEND_MESSAGES:2048,SEND_TTS_MESSAGES:4096,MANAGE_MESSAGES:8192,EMBED_LINKS:16384,ATTACH_FILES:32768,READ_MESSAGE_HISTORY:65536,MENTION_EVERYONE:1<<17,USE_EXTERNAL_EMOJIS:1<<18,CONNECT:1<<20,SPEAK:1<<21,MUTE_MEMBERS:1<<22,DEAFEN_MEMBERS:1<<23,MOVE_MEMBERS:1<<24,USE_VAD:1<<25,CHANGE_NICKNAME:1<<26,MANAGE_NICKNAMES:1<<27,MANAGE_ROLES:1<<28,MANAGE_WEBHOOKS:1<<29,MANAGE_EMOJIS:1<<30},Permissions.ALL=Object.values(Permissions.FLAGS).reduce((e,t)=>e|t,0),Permissions.DEFAULT=104324097,e.exports=Permissions},function(e,t,s){"use strict";const i=s(2),n=14200704e5;let r=0;e.exports=class SnowflakeUtil{constructor(){throw new Error(`The ${this.constructor.name} class may not be instantiated.`)}static generate(e=Date.now()){if(e instanceof Date&&(e=e.getTime()),"number"!=typeof e||isNaN(e))throw new TypeError(`"timestamp" argument must be a number (received ${isNaN(e)?"NaN":typeof e})`);r>=4095&&(r=0);const t=`${(e-n).toString(2).padStart(42,"0")}0000100000${(r++).toString(2).padStart(12,"0")}`;return i.binaryToID(t)}static deconstruct(e){const t=i.idToBinary(e).toString(2).padStart(64,"0"),s={timestamp:parseInt(t.substring(0,42),2)+n,workerID:parseInt(t.substring(42,47),2),processID:parseInt(t.substring(47,52),2),increment:parseInt(t.substring(52,64),2),binary:t};return Object.defineProperty(s,"date",{get:function(){return new Date(this.timestamp)},enumerable:!0}),s}}},function(e,t,s){"use strict";const i=s(29),n=s(29),r=s(28),o=s(2),{Error:a,TypeError:l}=s(4),{browser:h}=s(0);class DataResolver{constructor(){throw new Error(`The ${this.constructor.name} class may not be instantiated.`)}static resolveInviteCode(e){const t=/discord(?:app\.com\/invite|\.gg(?:\/invite)?)\/([\w-]{2,255})/i.exec(e);return t&&t[1]?t[1]:e}static async resolveImage(e){if(!e)return null;if("string"==typeof e&&e.startsWith("data:"))return e;const t=await this.resolveFile(e);return DataResolver.resolveBase64(t)}static resolveBase64(e){return e instanceof Buffer?`data:image/jpg;base64,${e.toString("base64")}`:e}static resolveFile(e){if(!h&&e instanceof Buffer)return Promise.resolve(e);if(h&&e instanceof ArrayBuffer)return Promise.resolve(o.convertToBuffer(e));if("string"==typeof e){if(/^https?:\/\//.test(e))return r(e).then(e=>h?e.blob():e.buffer());if(!h)return new Promise((t,s)=>{const r=h?e:i.resolve(e);n.stat(r,(e,i)=>e?s(e):i&&i.isFile()?(n.readFile(r,(e,i)=>{e?s(e):t(i)}),null):s(new a("FILE_NOT_FOUND",r)))})}else if("function"==typeof e.pipe)return new Promise((t,s)=>{const i=[];e.once("error",s),e.on("data",e=>i.push(e)),e.once("end",()=>t(Buffer.concat(i)))});return Promise.reject(new l("REQ_RESOURCE_TYPE"))}}e.exports=DataResolver},function(e,t,s){"use strict";var i="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;function n(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.assign=function(e){for(var t=Array.prototype.slice.call(arguments,1);t.length;){var s=t.shift();if(s){if("object"!=typeof s)throw new TypeError(s+"must be non-object");for(var i in s)n(s,i)&&(e[i]=s[i])}}return e},t.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var r={arraySet:function(e,t,s,i,n){if(t.subarray&&e.subarray)e.set(t.subarray(s,s+i),n);else for(var r=0;rthis.client.channels?this.client.channels.get(e.channel_id).messages.add(e,!1):e)}sendSlackMessage(e){return this.client.api.webhooks(this.id,this.token).slack.post({query:{wait:!0},auth:!1,data:e}).then(e=>this.client.channels?this.client.channels.get(e.channel_id).messages.add(e,!1):e)}edit({name:e=this.name,avatar:t,channel:s},r){return t&&"string"==typeof t&&!t.startsWith("data:")?i.resolveImage(t).then(t=>this.edit({name:e,avatar:t},r)):(s&&(s=s instanceof n?s.id:s),this.client.api.webhooks(this.id,s?void 0:this.token).patch({data:{name:e,avatar:t,channel_id:s},reason:r}).then(e=>(this.name=e.name,this.avatar=e.avatar,this.channelID=e.channel_id,this)))}delete(e){return this.client.api.webhooks(this.id,this.token).delete({reason:e})}static applyToClass(e){for(const t of["send","sendSlackMessage","edit","delete"])Object.defineProperty(e.prototype,t,Object.getOwnPropertyDescriptor(Webhook.prototype,t))}}e.exports=Webhook},function(e,t,s){"use strict";const i=s(2),n=s(65),{ActivityTypes:r}=s(0);class Activity{constructor(e,t){Object.defineProperty(this,"presence",{value:e}),this.name=t.name,this.type=r[t.type],this.url=t.url||null,this.details=t.details||null,this.state=t.state||null,this.applicationID=t.application_id||null,this.timestamps=t.timestamps?{start:t.timestamps.start?new Date(Number(t.timestamps.start)):null,end:t.timestamps.end?new Date(Number(t.timestamps.end)):null}:null,this.party=t.party||null,this.assets=t.assets?new RichPresenceAssets(this,t.assets):null,this.syncID=t.sync_id,this.flags=new n(t.flags).freeze()}equals(e){return this===e||e&&this.name===e.name&&this.type===e.type&&this.url===e.url}toString(){return this.name}_clone(){return Object.assign(Object.create(this),this)}}class RichPresenceAssets{constructor(e,t){Object.defineProperty(this,"activity",{value:e}),this.largeText=t.large_text||null,this.smallText=t.small_text||null,this.largeImage=t.large_image||null,this.smallImage=t.small_image||null}smallImageURL({format:e,size:t}={}){return this.smallImage?this.activity.presence.client.rest.cdn.AppAsset(this.activity.applicationID,this.smallImage,{format:e,size:t}):null}largeImageURL({format:e,size:t}={}){return this.largeImage?/^spotify:/.test(this.largeImage)?`https://i.scdn.co/image/${this.largeImage.slice(8)}`:this.activity.presence.client.rest.cdn.AppAsset(this.activity.applicationID,this.largeImage,{format:e,size:t}):null}}t.Presence=class Presence{constructor(e,t={}){Object.defineProperty(this,"client",{value:e}),this.userID=t.user.id,this.guild=t.guild,this.patch(t)}get user(){return this.client.users.get(this.userID)||null}get member(){return this.guild.members.get(this.userID)||null}patch(e){this.status=e.status||this.status||"offline";const t=e.game||e.activity;return this.activity=t?new Activity(this,t):null,this.clientStatus=e.client_status||null,this}_clone(){const e=Object.assign(Object.create(this),this);return this.activity&&(e.activity=this.activity._clone()),e}equals(e){return this===e||(e&&this.status===e.status&&this.activity?this.activity.equals(e.activity):!e.activity&&this.clientStatus.web===e.clientStatus.web&&this.clientStatus.mobile===e.clientStatus.mobile&&this.clientStatus.desktop===e.clientStatus.desktop)}toJSON(){return i.flatten(this)}},t.Activity=Activity,t.RichPresenceAssets=RichPresenceAssets},function(e,t,s){"use strict";const i=s(22),n=s(16),r=s(7),o=s(66),a=s(6),l=s(19),{Presence:h}=s(12),{Error:c}=s(4);class GuildMember extends a{constructor(e,t,s){super(e),this.guild=s,this.user={},this.joinedTimestamp=null,this.lastMessageID=null,this.lastMessageChannelID=null,this.deleted=!1,this._roles=[],t&&this._patch(t)}_patch(e){void 0!==e.nick&&(this.nickname=e.nick),e.joined_at&&(this.joinedTimestamp=new Date(e.joined_at).getTime()),e.user&&(this.user=this.guild.client.users.add(e.user)),e.roles&&this.roles._patch(e.roles)}_clone(){const e=super._clone();return e._roles=this._roles.slice(),e}get roles(){return new o(this)}get lastMessage(){const e=this.guild.channels.get(this.lastMessageChannelID);return e&&e.messages.get(this.lastMessageID)||null}get voice(){return this.guild.voiceStates.get(this.id)||new l(this.guild,{user_id:this.id})}get joinedAt(){return this.joinedTimestamp?new Date(this.joinedTimestamp):null}get presence(){return this.guild.presences.get(this.id)||new h(this.client,{user:{id:this.id},guild:this.guild})}get displayColor(){const e=this.roles.color;return e&&e.color||0}get displayHexColor(){const e=this.roles.color;return e&&e.hexColor||"#000000"}get id(){return this.user.id}get displayName(){return this.nickname||this.user.username}get permissions(){return this.user.id===this.guild.ownerID?new r(r.ALL).freeze():new r(this.roles.map(e=>e.permissions)).freeze()}get manageable(){return this.user.id!==this.guild.ownerID&&(this.user.id!==this.client.user.id&&this.guild.me.roles.highest.comparePositionTo(this.roles.highest)>0)}get kickable(){return this.manageable&&this.guild.me.permissions.has(r.FLAGS.KICK_MEMBERS)}get bannable(){return this.manageable&&this.guild.me.permissions.has(r.FLAGS.BAN_MEMBERS)}permissionsIn(e){if(!(e=this.guild.channels.resolve(e)))throw new c("GUILD_CHANNEL_RESOLVE");return e.memberPermissions(this)}hasPermission(e,{checkAdmin:t=!0,checkOwner:s=!0}={}){return!(!s||this.user.id!==this.guild.ownerID)||this.roles.some(s=>s.permissions.has(e,t))}edit(e,t){if(e.channel){if(e.channel=this.guild.channels.resolve(e.channel),!e.channel||"voice"!==e.channel.type)throw new c("GUILD_VOICE_CHANNEL_RESOLVE");e.channel_id=e.channel.id,e.channel=null}e.roles&&(e.roles=e.roles.map(e=>e instanceof n?e.id:e));let s=this.client.api.guilds(this.guild.id);if(this.user.id===this.client.user.id){const t=Object.keys(e);s=1===t.length&&"nick"===t[0]?s.members("@me").nick:s.members(this.id)}else s=s.members(this.id);return s.patch({data:e,reason:t}).then(()=>{const t=this._clone();return e.user=this.user,t._patch(e),t})}setMute(e,t){return this.edit({mute:e},t)}setDeaf(e,t){return this.edit({deaf:e},t)}setVoiceChannel(e){return this.edit({channel:e})}setNickname(e,t){return this.edit({nick:e},t)}createDM(){return this.user.createDM()}deleteDM(){return this.user.deleteDM()}kick(e){return this.client.api.guilds(this.guild.id).members(this.user.id).delete({reason:e}).then(()=>this)}ban(e){return this.guild.members.ban(this,e)}toString(){return`<@${this.nickname?"!":""}${this.user.id}>`}toJSON(){return super.toJSON({guild:"guildID",user:"userID",displayName:!0,speaking:!1,lastMessage:!1,lastMessageID:!1,roles:!0})}send(){}}i.applyToClass(GuildMember),e.exports=GuildMember},function(e,t,s){"use strict";const i=s(8),n=s(6),{ChannelTypes:r}=s(0);e.exports=class Channel extends n{constructor(e,t){super(e);const s=Object.keys(r)[t.type];this.type=s?s.toLowerCase():"unknown",this.deleted=!1,t&&this._patch(t)}_patch(e){this.id=e.id}get createdTimestamp(){return i.deconstruct(this.id).timestamp}get createdAt(){return new Date(this.createdTimestamp)}toString(){return`<#${this.id}>`}delete(){return this.client.api.channels(this.id).delete().then(()=>this)}fetch(){return this.client.channels.fetch(this.id,!0,!0)}static create(e,t,i){const n=s(18);let o;if(t.type===r.DM||t.type!==r.GROUP&&!t.guild_id&&!i)o=new(n.get("DMChannel"))(e,t);else if(i=i||e.guilds.get(t.guild_id)){switch(t.type){case r.TEXT:o=new(n.get("TextChannel"))(i,t);break;case r.VOICE:o=new(n.get("VoiceChannel"))(i,t);break;case r.CATEGORY:o=new(n.get("CategoryChannel"))(i,t);break;default:o=new(n.get("GuildChannel"))(i,t)}i.channels.set(o.id,o)}return o}toJSON(...e){return super.toJSON({createdTimestamp:!0},...e)}}},function(e,t,s){"use strict";const i=s(22),{Presence:n}=s(12),r=s(8),o=s(6),{Error:a}=s(4);class User extends o{constructor(e,t){super(e),this.id=t.id,this.bot=Boolean(t.bot),this._patch(t)}_patch(e){e.username&&(this.username=e.username),e.discriminator&&(this.discriminator=e.discriminator),void 0!==e.avatar&&(this.avatar=e.avatar),e.locale&&(this.locale=e.locale),this.lastMessageID=null,this.lastMessageChannelID=null}get createdTimestamp(){return r.deconstruct(this.id).timestamp}get createdAt(){return new Date(this.createdTimestamp)}get lastMessage(){const e=this.client.channels.get(this.lastMessageChannelID);return e&&e.messages.get(this.lastMessageID)||null}get presence(){for(const e of this.client.guilds.values())if(e.presences.has(this.id))return e.presences.get(this.id);return new n(this.client,{user:{id:this.id}})}avatarURL({format:e,size:t}={}){return this.avatar?this.client.rest.cdn.Avatar(this.id,this.avatar,e,t):null}get defaultAvatarURL(){return this.client.rest.cdn.DefaultAvatar(this.discriminator%5)}displayAvatarURL(e){return this.avatarURL(e)||this.defaultAvatarURL}get tag(){return`${this.username}#${this.discriminator}`}typingIn(e){return(e=this.client.channels.resolve(e))._typing.has(this.id)}typingSinceIn(e){return(e=this.client.channels.resolve(e))._typing.has(this.id)?new Date(e._typing.get(this.id).since):null}typingDurationIn(e){return(e=this.client.channels.resolve(e))._typing.has(this.id)?e._typing.get(this.id).elapsedTime:-1}get dmChannel(){return this.client.channels.find(e=>"dm"===e.type&&e.recipient.id===this.id)||null}createDM(){return this.dmChannel?Promise.resolve(this.dmChannel):this.client.api.users(this.client.user.id).channels.post({data:{recipient_id:this.id}}).then(e=>this.client.actions.ChannelCreate.handle(e).channel)}deleteDM(){return this.dmChannel?this.client.api.channels(this.dmChannel.id).delete().then(e=>this.client.actions.ChannelDelete.handle(e).channel):Promise.reject(new a("USER_NO_DMCHANNEL"))}equals(e){return e&&this.id===e.id&&this.username===e.username&&this.discriminator===e.discriminator&&this.avatar===e.avatar}toString(){return`<@${this.id}>`}toJSON(...e){const t=super.toJSON({createdTimestamp:!0,defaultAvatarURL:!0,tag:!0,lastMessage:!1,lastMessageID:!1},...e);return t.avatarURL=this.avatarURL(),t.displayAvatarURL=this.displayAvatarURL(),t}send(){}}i.applyToClass(User),e.exports=User},function(e,t,s){"use strict";const i=s(8),n=s(7),r=s(2),o=s(6),{Error:a,TypeError:l}=s(4);e.exports=class Role extends o{constructor(e,t,s){super(e),this.guild=s,t&&this._patch(t)}_patch(e){this.id=e.id,this.name=e.name,this.color=e.color,this.hoist=e.hoist,this.rawPosition=e.position,this.permissions=new n(e.permissions).freeze(),this.managed=e.managed,this.mentionable=e.mentionable,this.deleted=!1}get createdTimestamp(){return i.deconstruct(this.id).timestamp}get createdAt(){return new Date(this.createdTimestamp)}get hexColor(){return`#${this.color.toString(16).padStart(6,"0")}`}get members(){return this.guild.members.filter(e=>e.roles.has(this.id))}get editable(){if(this.managed)return!1;const e=this.guild.member(this.client.user);return!!e.permissions.has(n.FLAGS.MANAGE_ROLES)&&e.roles.highest.comparePositionTo(this)>0}get position(){const e=this.guild._sortedRoles();return e.array().indexOf(e.get(this.id))}comparePositionTo(e){return(e=this.guild.roles.resolve(e))?this.constructor.comparePositions(this,e):Promise.reject(new l("INVALID_TYPE","role","Role nor a Snowflake"))}async edit(e,t){return e.permissions?e.permissions=n.resolve(e.permissions):e.permissions=this.permissions.bitfield,void 0!==e.position&&await r.setPosition(this,e.position,!1,this.guild._sortedRoles(),this.client.api.guilds(this.guild.id).roles,t).then(e=>{this.client.actions.GuildRolesPositionUpdate.handle({guild_id:this.guild.id,roles:e})}),this.client.api.guilds[this.guild.id].roles[this.id].patch({data:{name:e.name||this.name,color:null!==e.color?r.resolveColor(e.color||this.color):null,hoist:void 0!==e.hoist?e.hoist:this.hoist,permissions:e.permissions,mentionable:void 0!==e.mentionable?e.mentionable:this.mentionable},reason:t}).then(e=>{const t=this._clone();return t._patch(e),t})}permissionsIn(e){if(!(e=this.guild.channels.resolve(e)))throw new a("GUILD_CHANNEL_RESOLVE");return e.rolePermissions(this)}setName(e,t){return this.edit({name:e},t)}setColor(e,t){return this.edit({color:e},t)}setHoist(e,t){return this.edit({hoist:e},t)}setPermissions(e,t){return this.edit({permissions:e},t)}setMentionable(e,t){return this.edit({mentionable:e},t)}setPosition(e,{relative:t,reason:s}={}){return r.setPosition(this,e,t,this.guild._sortedRoles(),this.client.api.guilds(this.guild.id).roles,s).then(e=>(this.client.actions.GuildRolesPositionUpdate.handle({guild_id:this.guild.id,roles:e}),this))}delete(e){return this.client.api.guilds[this.guild.id].roles[this.id].delete({reason:e}).then(()=>(this.client.actions.GuildRoleDelete.handle({guild_id:this.guild.id,role_id:this.id}),this))}equals(e){return e&&this.id===e.id&&this.name===e.name&&this.color===e.color&&this.hoist===e.hoist&&this.position===e.position&&this.permissions.bitfield===e.permissions.bitfield&&this.managed===e.managed}toString(){return this.id===this.guild.id?"@everyone":`<@&${this.id}>`}toJSON(){return super.toJSON({createdTimestamp:!0})}static comparePositions(e,t){return e.position===t.position?t.id-e.id:e.position-t.position}}},function(e,t,s){"use strict";const i=s(14),n=s(16),r=s(26),o=s(41),a=s(2),l=s(7),h=s(3),{Error:c,TypeError:u}=s(4);e.exports=class GuildChannel extends i{constructor(e,t){super(e.client,t),this.guild=e}_patch(e){if(super._patch(e),this.name=e.name,this.rawPosition=e.position,this.parentID=e.parent_id,this.permissionOverwrites=new h,e.permission_overwrites)for(const t of e.permission_overwrites)this.permissionOverwrites.set(t.id,new o(this,t))}get parent(){return this.guild.channels.get(this.parentID)||null}get permissionsLocked(){return this.parent?this.permissionOverwrites.size===this.parent.permissionOverwrites.size&&this.permissionOverwrites.every((e,t)=>{const s=this.parent.permissionOverwrites.get(t);return void 0!==s&&s.deny.bitfield===e.deny.bitfield&&s.allow.bitfield===e.allow.bitfield}):null}get position(){const e=this.guild._sortedChannels(this);return e.array().indexOf(e.get(this.id))}permissionsFor(e){const t=this.guild.members.resolve(e);if(t)return this.memberPermissions(t);const s=this.guild.roles.resolve(e);return s?this.rolePermissions(s):null}overwritesFor(e,t=!1,s=null){if(t||(e=this.guild.members.resolve(e)),!e)return[];s=s||e.roles;const i=[];let n,r;for(const t of this.permissionOverwrites.values())t.id===this.guild.id?r=t:s.has(t.id)?i.push(t):t.id===e.id&&(n=t);return{everyone:r,roles:i,member:n}}memberPermissions(e){if(e.id===this.guild.ownerID)return new l(l.ALL).freeze();const t=e.roles,s=new l(t.map(e=>e.permissions));if(s.has(l.FLAGS.ADMINISTRATOR))return new l(l.ALL).freeze();const i=this.overwritesFor(e,!0,t);return s.remove(i.everyone?i.everyone.deny:0).add(i.everyone?i.everyone.allow:0).remove(i.roles.length>0?i.roles.map(e=>e.deny):0).add(i.roles.length>0?i.roles.map(e=>e.allow):0).remove(i.member?i.member.deny:0).add(i.member?i.member.allow:0).freeze()}rolePermissions(e){if(e.permissions.has(l.FLAGS.ADMINISTRATOR))return new l(l.ALL).freeze();const t=this.permissionOverwrites.get(this.guild.id),s=this.permissionOverwrites.get(e.id);return e.permissions.remove(t?t.deny:0).add(t?t.allow:0).remove(s?s.deny:0).add(s?s.allow:0).freeze()}overwritePermissions(e={}){return this.edit(e).then(()=>this)}updateOverwrite(e,t,s){if(!(e=this.guild.roles.resolve(e)||this.client.users.resolve(e)))return Promise.reject(new u("INVALID_TYPE","parameter","User nor a Role",!0));const i=this.permissionOverwrites.get(e.id);return i?i.update(t,s).then(()=>this):this.createOverwrite(e,t,s)}createOverwrite(e,t,s){if(!(e=this.guild.roles.resolve(e)||this.client.users.resolve(e)))return Promise.reject(new u("INVALID_TYPE","parameter","User nor a Role",!0));const i=e instanceof n?"role":"member",{allow:r,deny:a}=o.resolveOverwriteOptions(t);return this.client.api.channels(this.id).permissions[e.id].put({data:{id:e.id,type:i,allow:r.bitfield,deny:a.bitfield},reason:s}).then(()=>this)}lockPermissions(){if(!this.parent)return Promise.reject(new c("GUILD_CHANNEL_ORPHAN"));const e=this.parent.permissionOverwrites.map(e=>e.toJSON());return this.edit({permissionOverwrites:e})}get members(){const e=new h;for(const t of this.guild.members.values())this.permissionsFor(t).has("VIEW_CHANNEL",!1)&&e.set(t.id,t);return e}async edit(e,t){void 0!==e.position&&await a.setPosition(this,e.position,!1,this.guild._sortedChannels(this),this.client.api.guilds(this.guild.id).channels,t).then(e=>{this.client.actions.GuildChannelsPositionUpdate.handle({guild_id:this.guild.id,channels:e})});const s=e.permissionOverwrites&&e.permissionOverwrites.map(e=>o.resolve(e,this.guild)),i=await this.client.api.channels(this.id).patch({data:{name:(e.name||this.name).trim(),topic:e.topic,nsfw:e.nsfw,bitrate:e.bitrate||this.bitrate,user_limit:void 0!==e.userLimit?e.userLimit:this.userLimit,parent_id:e.parentID,lock_permissions:e.lockPermissions,rate_limit_per_user:e.rateLimitPerUser,permission_overwrites:s},reason:t}),n=this._clone();return n._patch(i),n}setName(e,t){return this.edit({name:e},t)}setParent(e,{lockPermissions:t=!0,reason:s}={}){return this.edit({parentID:null!==e?e.hasOwnProperty("id")?e.id:e:null,lockPermissions:t},s)}setTopic(e,t){return this.edit({topic:e},t)}setPosition(e,{relative:t,reason:s}={}){return a.setPosition(this,e,t,this.guild._sortedChannels(this),this.client.api.guilds(this.guild.id).channels,s).then(e=>(this.client.actions.GuildChannelsPositionUpdate.handle({guild_id:this.guild.id,channels:e}),this))}createInvite({temporary:e=!1,maxAge:t=86400,maxUses:s=0,unique:i,reason:n}={}){return this.client.api.channels(this.id).invites.post({data:{temporary:e,max_age:t,max_uses:s,unique:i},reason:n}).then(e=>new r(this.client,e))}async fetchInvites(){const e=await this.client.api.channels(this.id).invites.get(),t=new h;for(const s of e){const e=new r(this.client,s);t.set(e.code,e)}return t}clone(e={}){return a.mergeDefault({name:this.name,permissionOverwrites:this.permissionOverwrites,topic:this.topic,type:this.type,nsfw:this.nsfw,parent:this.parent,bitrate:this.bitrate,userLimit:this.userLimit,rateLimitPerUser:this.rateLimitPerUser,reason:null},e),this.guild.channels.create(e.name,e)}equals(e){let t=e&&this.id===e.id&&this.type===e.type&&this.topic===e.topic&&this.position===e.position&&this.name===e.name;return t&&(t=this.permissionOverwrites&&e.permissionOverwrites?this.permissionOverwrites.equals(e.permissionOverwrites):!this.permissionOverwrites&&!e.permissionOverwrites),t}get deletable(){return this.permissionsFor(this.client.user).has(l.FLAGS.MANAGE_CHANNELS,!1)}get manageable(){if(this.client.user.id===this.guild.ownerID)return!0;const e=this.permissionsFor(this.client.user);return!!e&&e.has([l.FLAGS.MANAGE_CHANNELS,l.FLAGS.VIEW_CHANNEL],!1)}delete(e){return this.client.api.channels(this.id).delete({reason:e}).then(()=>this)}}},function(e,t,s){"use strict";const i={GuildEmoji:s(21),DMChannel:s(63),TextChannel:s(70),VoiceChannel:s(71),CategoryChannel:s(72),GuildChannel:s(17),GuildMember:s(13),Guild:s(42),Message:s(25),MessageReaction:s(39),Presence:s(12).Presence,ClientPresence:s(79),VoiceState:s(19),Role:s(16),User:s(15)};e.exports=class Structures{constructor(){throw new Error(`The ${this.constructor.name} class may not be instantiated.`)}static get(e){if("string"==typeof e)return i[e];throw new TypeError(`"structure" argument must be a string (received ${typeof e})`)}static extend(e,t){if(!i[e])throw new RangeError(`"${e}" is not a valid extensible structure.`);if("function"!=typeof t)throw new TypeError(`"extender" argument must be a function that returns the extended structure class/prototype ${`(received ${typeof t})`}`);const s=t(i[e]);if("function"!=typeof s)throw new TypeError("The extender function must return the extended structure class/prototype.");if(Object.getPrototypeOf(s)!==i[e])throw new Error("The class/prototype returned from the extender function must extend the existing structure class/prototype.");return i[e]=s,s}}},function(e,t,s){"use strict";const i=s(6);e.exports=class VoiceState extends i{constructor(e,t){super(e.client),this.guild=e,this.id=t.user_id,this._patch(t)}_patch(e){return this.serverDeaf=e.deaf,this.serverMute=e.mute,this.selfDeaf=e.self_deaf,this.selfMute=e.self_mute,this.sessionID=e.session_id,this.channelID=e.channel_id,this}get member(){return this.guild.members.get(this.id)||null}get channel(){return this.guild.channels.get(this.channelID)||null}get deaf(){return this.serverDeaf||this.selfDeaf}get mute(){return this.serverMute||this.selfMute}get speaking(){return this.channel&&this.channel.connection?Boolean(this.channel.connection._speaking.get(this.id)):null}setMute(e,t){return this.member?this.member.edit({mute:e},t):Promise.reject(new Error("VOICE_STATE_UNCACHED_MEMBER"))}setDeaf(e,t){return this.member?this.member.edit({deaf:e},t):Promise.reject(new Error("VOICE_STATE_UNCACHED_MEMBER"))}toJSON(){return super.toJSON({id:!0,serverDeaf:!0,serverMute:!0,selfDeaf:!0,selfMute:!0,sessionID:!0,channelID:"channel"})}}},function(e,t,s){"use strict";const{RangeError:i}=s(4);class BitField{constructor(e){this.bitfield=this.constructor.resolve(e)}equals(e){return this.bitfield===this.constructor.resolve(e)}has(e){return e instanceof Array?e.every(e=>this.has(e)):(e=this.constructor.resolve(e),(this.bitfield&e)===e)}missing(e,...t){return e instanceof Array||(e=new this.constructor(e).toArray(!1)),e.filter(e=>!this.has(e,...t))}freeze(){return Object.freeze(this)}add(...e){let t=0;for(const s of e)t|=this.constructor.resolve(s);return Object.isFrozen(this)?new this.constructor(this.bitfield|t):(this.bitfield|=t,this)}remove(...e){let t=0;for(const s of e)t|=this.constructor.resolve(s);return Object.isFrozen(this)?new this.constructor(this.bitfield&~t):(this.bitfield&=~t,this)}serialize(...e){const t={};for(const s in this.constructor.FLAGS)t[s]=this.has(s,...e);return t}toArray(...e){return Object.keys(this.constructor.FLAGS).filter(t=>this.has(t,...e))}toJSON(){return this.bitfield}valueOf(){return this.bitfield}*[Symbol.iterator](){yield*this.toArray()}static resolve(e=0){if("number"==typeof e&&e>=0)return e;if(e instanceof BitField)return e.bitfield;if(e instanceof Array)return e.map(e=>this.resolve(e)).reduce((e,t)=>e|t,0);if("string"==typeof e)return this.FLAGS[e];throw new i("BITFIELD_INVALID")}}BitField.FLAGS={},e.exports=BitField},function(e,t,s){"use strict";const i=s(62),n=s(7),{Error:r}=s(4),o=s(33);class GuildEmoji extends o{constructor(e,t,s){super(e,t),this.guild=s,this._roles=[],this._patch(t)}_patch(e){e.name&&(this.name=e.name),void 0!==e.require_colons&&(this.requiresColons=e.require_colons),void 0!==e.managed&&(this.managed=e.managed),e.roles&&(this._roles=e.roles)}_clone(){const e=super._clone();return e._roles=this._roles.slice(),e}get deletable(){return!this.managed&&this.guild.me.hasPermission(n.FLAGS.MANAGE_EMOJIS)}get roles(){return new i(this)}fetchAuthor(){return this.managed?Promise.reject(new r("EMOJI_MANAGED")):this.guild.me.permissions.has(n.FLAGS.MANAGE_EMOJIS)?this.client.api.guilds(this.guild.id).emojis(this.id).get().then(e=>this.client.users.add(e.user)):Promise.reject(new r("MISSING_MANAGE_EMOJIS_PERMISSION",this.guild))}edit(e,t){const s=e.roles?e.roles.map(e=>e.id||e):void 0;return this.client.api.guilds(this.guild.id).emojis(this.id).patch({data:{name:e.name,roles:s},reason:t}).then(e=>{const t=this._clone();return t._patch(e),t})}setName(e,t){return this.edit({name:e},t)}delete(e){return this.client.api.guilds(this.guild.id).emojis(this.id).delete({reason:e}).then(()=>this)}equals(e){return e instanceof GuildEmoji?e.id===this.id&&e.name===this.name&&e.managed===this.managed&&e.requiresColons===this.requiresColons&&e.roles.size===this.roles.size&&e.roles.every(e=>this.roles.has(e.id)):e.id===this.id&&e.name===this.name&&e.roles.length===this.roles.size&&e.roles.every(e=>this.roles.has(e))}}e.exports=GuildEmoji},function(e,t,s){"use strict";const i=s(64),n=s(8),r=s(3),{RangeError:o,TypeError:a}=s(4),l=s(23);class TextBasedChannel{constructor(){this.messages=new h(this),this.lastMessageID=null,this.lastPinTimestamp=null}get lastMessage(){return this.messages.get(this.lastMessageID)||null}get lastPinAt(){return this.lastPinTimestamp?new Date(this.lastPinTimestamp):null}async send(e,t){const i=s(15),n=s(13);if(this instanceof i||this instanceof n)return this.createDM().then(s=>s.send(e,t));let r;if(e instanceof l)r=e.resolveData();else if((r=l.create(this,e,t).resolveData()).data.content instanceof Array)return Promise.all(r.split().map(this.send.bind(this)));const{data:o,files:a}=await r.resolveFiles();return this.client.api.channels[this.id].messages.post({data:o,files:a}).then(e=>this.client.actions.MessageCreate.handle(e).message)}startTyping(e){if(void 0!==e&&e<1)throw new o("TYPING_COUNT");if(this.client.user._typing.has(this.id)){const t=this.client.user._typing.get(this.id);return t.count=e||t.count+1,t.promise}const t={};return t.promise=new Promise((s,i)=>{const n=this.client.api.channels[this.id].typing;Object.assign(t,{count:e||1,interval:this.client.setInterval(()=>{n.post().catch(e=>{this.client.clearInterval(t.interval),this.client.user._typing.delete(this.id),i(e)})},9e3),resolve:s}),n.post().catch(e=>{this.client.clearInterval(t.interval),this.client.user._typing.delete(this.id),i(e)}),this.client.user._typing.set(this.id,t)}),t.promise}stopTyping(e=!1){if(this.client.user._typing.has(this.id)){const t=this.client.user._typing.get(this.id);t.count--,(t.count<=0||e)&&(this.client.clearInterval(t.interval),this.client.user._typing.delete(this.id),t.resolve())}}get typing(){return this.client.user._typing.has(this.id)}get typingCount(){return this.client.user._typing.has(this.id)?this.client.user._typing.get(this.id).count:0}createMessageCollector(e,t={}){return new i(this,e,t)}awaitMessages(e,t={}){return new Promise((s,i)=>{this.createMessageCollector(e,t).once("end",(e,n)=>{t.errors&&t.errors.includes(n)?i(e):s(e)})})}async bulkDelete(e,t=!1){if(e instanceof Array||e instanceof r){let s=e instanceof r?e.keyArray():e.map(e=>e.id||e);if(t&&(s=s.filter(e=>Date.now()-n.deconstruct(e).date.getTime()<12096e5)),0===s.length)return new r;if(1===s.length){await this.client.api.channels(this.id).messages(s[0]).delete();const e=this.client.actions.MessageDelete.handle({channel_id:this.id,id:s[0]}).message;return e?new r([[e.id,e]]):new r}return await this.client.api.channels[this.id].messages["bulk-delete"].post({data:{messages:s}}),this.client.actions.MessageDeleteBulk.handle({channel_id:this.id,ids:s}).messages}if(!isNaN(e)){const s=await this.messages.fetch({limit:e});return this.bulkDelete(s,t)}throw new a("MESSAGE_BULK_DELETE_TYPE")}static applyToClass(e,t=!1,s=[]){const i=["send"];t&&i.push("lastMessage","lastPinAt","bulkDelete","startTyping","stopTyping","typing","typingCount","createMessageCollector","awaitMessages");for(const t of i)s.includes(t)||Object.defineProperty(e.prototype,t,Object.getOwnPropertyDescriptor(TextBasedChannel.prototype,t))}}e.exports=TextBasedChannel;const h=s(24)},function(e,t,s){"use strict";const i=s(9),n=s(35),r=s(36),{browser:o}=s(0),a=s(2),{RangeError:l}=s(4);class APIMessage{constructor(e,t){this.target=e,this.options=t,this.data=null,this.files=null}get isWebhook(){const e=s(11),t=s(37);return this.target instanceof e||this.target instanceof t}get isUser(){const e=s(15),t=s(13);return this.target instanceof e||this.target instanceof t}makeContent(){const e=s(13);let t=a.resolveString(null==this.options.content?"":this.options.content);const i=void 0!==this.options.split&&!1!==this.options.split,n=void 0!==this.options.code&&!1!==this.options.code,r=i?{...this.options.split}:void 0;let o="";if(this.options.reply&&!this.isUser&&"dm"!==this.target.type){const t=this.target.client.users.resolveID(this.options.reply);o=`<@${this.options.reply instanceof e&&this.options.reply.nickname?"!":""}${t}>, `,i&&(r.prepend=`${o}${r.prepend||""}`)}if(t||o){if(n){const e="string"==typeof this.options.code?this.options.code:"";t=`${o}\`\`\`${e}\n${a.escapeMarkdown(t,!0)}\n\`\`\``,i&&(r.prepend=`${r.prepend||""}\`\`\`${e}\n`,r.append=`\n\`\`\`${r.append||""}`)}else o&&(t=`${o}${t}`);(void 0===this.options.disableEveryone?this.target.client.options.disableEveryone:this.options.disableEveryone)&&(t=t.replace(/@(everyone|here)/g,"@​$1")),i&&(t=a.splitMessage(t,r))}return t}resolveData(){if(this.data)return this;const e=this.makeContent(),t=Boolean(this.options.tts);let s;if(void 0!==this.options.nonce&&(s=parseInt(this.options.nonce),isNaN(s)||s<0))throw new l("MESSAGE_NONCE_TYPE");const i=[];this.isWebhook?this.options.embeds&&i.push(...this.options.embeds):this.options.embed&&i.push(this.options.embed);const r=i.map(e=>new n(e)._apiTransform());let o,a;return this.isWebhook&&(o=this.options.username||this.target.name,this.options.avatarURL&&(a=this.options.avatarURL)),this.data={content:e,tts:t,nonce:s,embed:null===this.options.embed?null:r[0],embeds:r,username:o,avatar_url:a},this}async resolveFiles(){if(this.files)return this;const e=[];this.isWebhook?this.options.embeds&&e.push(...this.options.embeds):this.options.embed&&e.push(this.options.embed);const t=[];this.options.files&&t.push(...this.options.files);for(const s of e)s.files&&t.push(...s.files);return this.files=await Promise.all(t.map(e=>this.constructor.resolveFile(e))),this}split(){if(this.data||this.resolveData(),!(this.data.content instanceof Array))return[this];const e=[];for(let t=0;t"string"==typeof e?a.basename(e):e.path?a.basename(e.path):"file.jpg";return"string"==typeof e||e instanceof(o?ArrayBuffer:Buffer)||"function"==typeof e.pipe?s=n(t=e):(t=e.attachment,s=e.name||n(t)),{attachment:t,name:s,file:await i.resolveFile(t)}}static partitionMessageAdditions(e){const t=[],s=[];for(const i of e)i instanceof n?t.push(i):i instanceof r&&s.push(i);return[t,s]}static transformOptions(e,t,s={},i=!1){if(t||"object"!=typeof e||e instanceof Array||(t=e,e=""),t){if(t instanceof n)return i?{content:e,embeds:[t],...s}:{content:e,embed:t,...s};if(t instanceof r)return{content:e,files:[t],...s}}else t={};if(t instanceof Array){const[n,r]=this.partitionMessageAdditions(t);return i?{content:e,embeds:n,files:r,...s}:{content:e,embed:n[0],files:r,...s}}if(e instanceof Array){const[t,n]=this.partitionMessageAdditions(e);if(t.length||n.length)return i?{embeds:t,files:n,...s}:{embed:t[0],files:n,...s}}return{content:e,...t,...s}}static create(e,t,i,n={}){const r=s(11),o=s(37),a=e instanceof r||e instanceof o;return new this(e,this.transformOptions(t,i,n,a))}}e.exports=APIMessage},function(e,t,s){"use strict";const i=s(5),n=s(3),r=s(25);e.exports=class MessageStore extends i{constructor(e,t){super(e.client,t,r),this.channel=e}add(e,t){return super.add(e,t,{extras:[this.channel]})}set(e,t){const s=this.client.options.messageCacheMaxSize;0!==s&&(this.size>=s&&s>0&&this.delete(this.firstKey()),super.set(e,t))}fetch(e){return"string"==typeof e?this._fetchId(e):this._fetchMany(e)}fetchPinned(){return this.client.api.channels[this.channel.id].pins.get().then(e=>{const t=new n;for(const s of e)t.set(s.id,this.add(s));return t})}async _fetchId(e){const t=await this.client.api.channels[this.channel.id].messages[e].get();return this.add(t)}async _fetchMany(e={}){const t=await this.client.api.channels[this.channel.id].messages.get({query:e}),s=new n;for(const e of t)s.set(e.id,this.add(e));return s}}},function(e,t,s){"use strict";const i=s(67),n=s(36),r=s(35),o=s(68),a=s(38),l=s(2),h=s(3),c=s(138),{MessageTypes:u}=s(0),d=s(7),p=s(6),{Error:m,TypeError:f}=s(4),_=s(23);e.exports=class Message extends p{constructor(e,t,s){super(e),this.channel=s,this.deleted=!1,t&&this._patch(t)}_patch(e){if(this.id=e.id,this.type=u[e.type],this.content=e.content,this.author=e.author?this.client.users.add(e.author,!e.webhook_id):null,this.pinned=e.pinned,this.tts=e.tts,this.nonce=e.nonce,this.system=6===e.type,this.embeds=(e.embeds||[]).map(e=>new r(e)),this.attachments=new h,e.attachments)for(const t of e.attachments)this.attachments.set(t.id,new n(t.url,t.filename,t));if(this.createdTimestamp=new Date(e.timestamp).getTime(),this.editedTimestamp=e.edited_timestamp?new Date(e.edited_timestamp).getTime():null,this.reactions=new c(this),e.reactions&&e.reactions.length>0)for(const t of e.reactions)this.reactions.add(t);this.mentions=new i(this,e.mentions,e.mention_roles,e.mention_everyone),this.webhookID=e.webhook_id||null,this.application=e.application?new a(this.client,e.application):null,this.activity=e.activity?{partyID:e.activity.party_id,type:e.activity.type}:null,this.hit="boolean"==typeof e.hit?e.hit:null,this._edits=[],this.member&&e.member?this.member._patch(e.member):e.member&&this.guild&&this.author&&this.guild.members.add(Object.assign(e.member,{user:this.author}))}get partial(){return this.channel.partial||!this.content||!this.author}patch(e){const t=this._clone();if(this._edits.unshift(t),this.editedTimestamp=new Date(e.edited_timestamp).getTime(),"content"in e&&(this.content=e.content),"pinned"in e&&(this.pinned=e.pinned),"tts"in e&&(this.tts=e.tts),this.embeds="embeds"in e?e.embeds.map(e=>new r(e)):this.embeds.slice(),"attachments"in e){this.attachments=new h;for(const t of e.attachments)this.attachments.set(t.id,new n(t.url,t.filename,t))}else this.attachments=new h(this.attachments);this.mentions=new i(this,"mentions"in e?e.mentions:this.mentions.users,"mentions_roles"in e?e.mentions_roles:this.mentions.roles,"mention_everyone"in e?e.mention_everyone:this.mentions.everyone)}get member(){return this.guild&&this.guild.member(this.author)||null}get createdAt(){return new Date(this.createdTimestamp)}get editedAt(){return this.editedTimestamp?new Date(this.editedTimestamp):null}get guild(){return this.channel.guild||null}get url(){return`https://discordapp.com/channels/${this.guild?this.guild.id:"@me"}/${this.channel.id}/${this.id}`}get cleanContent(){return l.cleanContent(this.content,this)}createReactionCollector(e,t={}){return new o(this,e,t)}awaitReactions(e,t={}){return new Promise((s,i)=>{this.createReactionCollector(e,t).once("end",(e,n)=>{t.errors&&t.errors.includes(n)?i(e):s(e)})})}get edits(){const e=this._edits.slice();return e.unshift(this),e}get editable(){return this.author.id===this.client.user.id}get deletable(){return!this.deleted&&(this.author.id===this.client.user.id||this.guild&&this.channel.permissionsFor(this.client.user).has(d.FLAGS.MANAGE_MESSAGES,!1))}get pinnable(){return!this.guild||this.channel.permissionsFor(this.client.user).has(d.FLAGS.MANAGE_MESSAGES,!1)}edit(e,t){const{data:s}=e instanceof _?e.resolveData():_.create(this,e,t).resolveData();return this.client.api.channels[this.channel.id].messages[this.id].patch({data:s}).then(e=>{const t=this._clone();return t._patch(e),t})}pin(){return this.client.api.channels(this.channel.id).pins(this.id).put().then(()=>this)}unpin(){return this.client.api.channels(this.channel.id).pins(this.id).delete().then(()=>this)}react(e){if(!(e=this.client.emojis.resolveIdentifier(e)))throw new f("EMOJI_TYPE");return this.client.api.channels(this.channel.id).messages(this.id).reactions(e,"@me").put().then(()=>this.client.actions.MessageReactionAdd.handle({user:this.client.user,channel:this.channel,message:this,emoji:l.parseEmoji(e)}).reaction)}delete({timeout:e=0,reason:t}={}){return e<=0?this.client.api.channels(this.channel.id).messages(this.id).delete({reason:t}).then(()=>this.client.actions.MessageDelete.handle({id:this.id,channel_id:this.channel.id}).message):new Promise(s=>{this.client.setTimeout(()=>{s(this.delete({reason:t}))},e)})}reply(e,t){return this.channel.send(e instanceof _?e:_.transformOptions(e,t,{reply:this.member||this.author}))}fetch(){return this.channel.messages.fetch(this.id)}fetchWebhook(){return this.webhookID?this.client.fetchWebhook(this.webhookID):Promise.reject(new m("WEBHOOK_MESSAGE"))}equals(e,t){if(!e)return!1;if(!e.author&&!e.attachments)return this.id===e.id&&this.embeds.length===e.embeds.length;let s=this.id===e.id&&this.author.id===e.author.id&&this.content===e.content&&this.tts===e.tts&&this.nonce===e.nonce&&this.embeds.length===e.embeds.length&&this.attachments.length===e.attachments.length;return s&&t&&(s=this.mentions.everyone===e.mentions.everyone&&this.createdTimestamp===new Date(t.timestamp).getTime()&&this.editedTimestamp===new Date(t.edited_timestamp).getTime()),s}toString(){return this.content}toJSON(){return super.toJSON({channel:"channelID",author:"authorID",application:"applicationID",guild:"guildID",cleanContent:!0,member:!1,reactions:!1})}}},function(e,t,s){"use strict";const{Endpoints:i}=s(0),n=s(6);e.exports=class Invite extends n{constructor(e,t){super(e),this._patch(t)}_patch(e){this.guild=e.guild?this.client.guilds.add(e.guild,!1):null,this.code=e.code,this.presenceCount="approximate_presence_count"in e?e.approximate_presence_count:null,this.memberCount="approximate_member_count"in e?e.approximate_member_count:null,this.temporary="temporary"in e?e.temporary:null,this.maxAge="max_age"in e?e.max_age:null,this.uses="uses"in e?e.uses:null,this.maxUses="max_uses"in e?e.max_uses:null,this.inviter=e.inviter?this.client.users.add(e.inviter):null,this.channel=this.client.channels.add(e.channel,this.guild,!1),this.createdTimestamp="created_at"in e?new Date(e.created_at).getTime():null}get createdAt(){return this.createdTimestamp?new Date(this.createdTimestamp):null}get expiresTimestamp(){return this.createdTimestamp&&this.maxAge?this.createdTimestamp+1e3*this.maxAge:null}get expiresAt(){const{expiresTimestamp:e}=this;return e?new Date(e):null}get url(){return i.invite(this.client.options.http.invite,this.code)}delete(e){return this.client.api.invites[this.code].delete({reason:e}).then(()=>this)}toString(){return this.url}toJSON(){return super.toJSON({url:!0,expiresTimestamp:!0,presenceCount:!1,memberCount:!1,uses:!1,channel:"channelID",inviter:"inviterID",guild:"guildID"})}}},function(e,t){var s,i,n=e.exports={};function r(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function a(e){if(s===setTimeout)return setTimeout(e,0);if((s===r||!s)&&setTimeout)return s=setTimeout,setTimeout(e,0);try{return s(e,0)}catch(t){try{return s.call(null,e,0)}catch(t){return s.call(this,e,0)}}}!function(){try{s="function"==typeof setTimeout?setTimeout:r}catch(e){s=r}try{i="function"==typeof clearTimeout?clearTimeout:o}catch(e){i=o}}();var l,h=[],c=!1,u=-1;function d(){c&&l&&(c=!1,l.length?h=l.concat(h):u=-1,h.length&&p())}function p(){if(!c){var e=a(d);c=!0;for(var t=h.length;t;){for(l=h,h=[];++u1)for(var s=1;s{e(...s),this._timeouts.delete(i)},t);return this._timeouts.add(i),i}clearTimeout(e){clearTimeout(e),this._timeouts.delete(e)}setInterval(e,t,...s){const i=setInterval(e,t,...s);return this._intervals.add(i),i}clearInterval(e){clearInterval(e),this._intervals.delete(e)}setImmediate(e,...s){const i=t(e,...s);return this._immediates.add(i),i}clearImmediate(e){i(e),this._immediates.delete(e)}toJSON(...e){return o.flatten(this,{domain:!1},...e)}}}).call(this,s(47).setImmediate,s(47).clearImmediate)},function(e,t,s){"use strict";var i,n="object"==typeof Reflect?Reflect:null,r=n&&"function"==typeof n.apply?n.apply:function(e,t,s){return Function.prototype.apply.call(e,t,s)};i=n&&"function"==typeof n.ownKeys?n.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var o=Number.isNaN||function(e){return e!=e};function a(){a.init.call(this)}e.exports=a,a.EventEmitter=a,a.prototype._events=void 0,a.prototype._eventsCount=0,a.prototype._maxListeners=void 0;var l=10;function h(e){return void 0===e._maxListeners?a.defaultMaxListeners:e._maxListeners}function c(e,t,s,i){var n,r,o,a;if("function"!=typeof s)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof s);if(void 0===(r=e._events)?(r=e._events=Object.create(null),e._eventsCount=0):(void 0!==r.newListener&&(e.emit("newListener",t,s.listener?s.listener:s),r=e._events),o=r[t]),void 0===o)o=r[t]=s,++e._eventsCount;else if("function"==typeof o?o=r[t]=i?[s,o]:[o,s]:i?o.unshift(s):o.push(s),(n=h(e))>0&&o.length>n&&!o.warned){o.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=e,l.type=t,l.count=o.length,a=l,console&&console.warn&&console.warn(a)}return e}function u(e,t,s){var i={fired:!1,wrapFn:void 0,target:e,type:t,listener:s},n=function(){for(var e=[],t=0;t0&&(o=t[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var l=n[e];if(void 0===l)return!1;if("function"==typeof l)r(l,this,t);else{var h=l.length,c=m(l,h);for(s=0;s=0;r--)if(s[r]===t||s[r].listener===t){o=s[r].listener,n=r;break}if(n<0)return this;0===n?s.shift():function(e,t){for(;t+1=0;i--)this.removeListener(e,t[i]);return this},a.prototype.listeners=function(e){return d(this,e,!0)},a.prototype.rawListeners=function(e){return d(this,e,!1)},a.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):p.call(e,t)},a.prototype.listenerCount=p,a.prototype.eventNames=function(){return this._eventsCount>0?i(this._events):[]}},function(e,t,s){"use strict";e.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},function(e,t,s){"use strict";const i=s(8),n=s(6);e.exports=class Emoji extends n{constructor(e,t){super(e),this.animated=t.animated,this.name=t.name,this.id=t.id,this.deleted=!1}get identifier(){return this.id?`${this.animated?"a:":""}${this.name}:${this.id}`:encodeURIComponent(this.name)}get url(){return this.id?this.client.rest.cdn.Emoji(this.id,this.animated?"gif":"png"):null}get createdTimestamp(){return this.id?i.deconstruct(this.id).timestamp:null}get createdAt(){return this.id?new Date(this.createdTimestamp):null}toString(){return this.id?`<${this.animated?"a":""}:${this.name}:${this.id}>`:this.name}toJSON(){return super.toJSON({guild:"guildID",createdTimestamp:!0,url:!0,identifier:!0})}}},function(e,t,s){"use strict";const i=s(3),n=s(2),r=s(31);e.exports=class Collector extends r{constructor(e,t,s={}){super(),Object.defineProperty(this,"client",{value:e}),this.filter=t,this.options=s,this.collected=new i,this.ended=!1,this._timeout=null,this.handleCollect=this.handleCollect.bind(this),this.handleDispose=this.handleDispose.bind(this),s.time&&(this._timeout=this.client.setTimeout(()=>this.stop("time"),s.time))}handleCollect(...e){const t=this.collect(...e);t&&this.filter(...e,this.collected)&&(this.collected.set(t,e[0]),this.emit("collect",...e)),this.checkEnd()}handleDispose(...e){if(!this.options.dispose)return;const t=this.dispose(...e);t&&this.filter(...e)&&this.collected.has(t)&&(this.collected.delete(t),this.emit("dispose",...e),this.checkEnd())}get next(){return new Promise((e,t)=>{if(this.ended)return void t(this.collected);const s=()=>{this.removeListener("collect",i),this.removeListener("end",n)},i=t=>{s(),e(t)},n=()=>{s(),t(this.collected)};this.on("collect",i),this.on("end",n)})}stop(e="user"){this.ended||(this._timeout&&this.client.clearTimeout(this._timeout),this.ended=!0,this.emit("end",this.collected,e))}checkEnd(){const e=this.endReason();e&&this.stop(e)}toJSON(){return n.flatten(this)}collect(){}dispose(){}endReason(){}}},function(e,t,s){"use strict";const i=s(2),{RangeError:n}=s(4);e.exports=class MessageEmbed{constructor(e={}){this.setup(e)}setup(e){this.type=e.type,this.title=e.title,this.description=e.description,this.url=e.url,this.color=e.color,this.timestamp=e.timestamp?new Date(e.timestamp).getTime():null,this.fields=e.fields?e.fields.map(i.cloneObject):[],this.thumbnail=e.thumbnail?{url:e.thumbnail.url,proxyURL:e.thumbnail.proxy_url,height:e.thumbnail.height,width:e.thumbnail.width}:null,this.image=e.image?{url:e.image.url,proxyURL:e.image.proxy_url,height:e.image.height,width:e.image.width}:null,this.video=e.video,this.author=e.author?{name:e.author.name,url:e.author.url,iconURL:e.author.iconURL||e.author.icon_url,proxyIconURL:e.author.proxyIconUrl||e.author.proxy_icon_url}:null,this.provider=e.provider,this.footer=e.footer?{text:e.footer.text,iconURL:e.footer.iconURL||e.footer.icon_url,proxyIconURL:e.footer.proxyIconURL||e.footer.proxy_icon_url}:null,this.files=[],e.files&&(this.files=e.files)}get createdAt(){return this.timestamp?new Date(this.timestamp):null}get hexColor(){return this.color?`#${this.color.toString(16).padStart(6,"0")}`:null}get length(){return(this.title?this.title.length:0)+(this.description?this.description.length:0)+(this.fields.length>=1?this.fields.reduce((e,t)=>e+t.name.length+t.value.length,0):0)+(this.footer?this.footer.text.length:0)}addField(e,t,s){return this.fields.push(this.constructor.checkField(e,t,s)),this}addBlankField(e){return this.addField("​","​",e)}spliceField(e,t,s,i,n){return s&&i?this.fields.splice(e,t,this.constructor.checkField(s,i,n)):this.fields.splice(e,t),this}attachFiles(e){return this.files=this.files.concat(e),this}setAuthor(e,t,s){return this.author={name:i.resolveString(e),iconURL:t,url:s},this}setColor(e){return this.color=i.resolveColor(e),this}setDescription(e){return e=i.resolveString(e),this.description=e,this}setFooter(e,t){return e=i.resolveString(e),this.footer={text:e,iconURL:t},this}setImage(e){return this.image={url:e},this}setThumbnail(e){return this.thumbnail={url:e},this}setTimestamp(e=Date.now()){return e instanceof Date&&(e=e.getTime()),this.timestamp=e,this}setTitle(e){return e=i.resolveString(e),this.title=e,this}setURL(e){return this.url=e,this}toJSON(){return i.flatten(this,{hexColor:!0})}_apiTransform(){return{title:this.title,type:"rich",description:this.description,url:this.url,timestamp:this.timestamp?new Date(this.timestamp):null,color:this.color,fields:this.fields,thumbnail:this.thumbnail,image:this.image,author:this.author?{name:this.author.name,url:this.author.url,icon_url:this.author.iconURL}:null,footer:this.footer?{text:this.footer.text,icon_url:this.footer.iconURL}:null}}static checkField(e,t,s=!1){if(!(e=i.resolveString(e)))throw new n("EMBED_FIELD_NAME");if(!(t=i.resolveString(t)))throw new n("EMBED_FIELD_VALUE");return{name:e,value:t,inline:s}}}},function(e,t,s){"use strict";const i=s(2);e.exports=class MessageAttachment{constructor(e,t=null,s){this.attachment=e,this.name=t,s&&this._patch(s)}setFile(e,t=null){return this.attachment=e,this.name=t,this}setName(e){return this.name=e,this}_patch(e){this.id=e.id,this.size=e.size,this.url=e.url,this.proxyURL=e.proxy_url,this.height=void 0!==e.height?e.height:null,this.width=void 0!==e.width?e.width:null}toJSON(){return i.flatten(this)}}},function(e,t,s){"use strict";const i=s(11),n=s(30);class WebhookClient extends n{constructor(e,t,s){super(s),Object.defineProperty(this,"client",{value:this}),this.id=e,Object.defineProperty(this,"token",{value:t,writable:!0,configurable:!0})}}i.applyToClass(WebhookClient),e.exports=WebhookClient},function(e,t,s){"use strict";const i=s(8),{ClientApplicationAssetTypes:n,Endpoints:r}=s(0),o=s(6),a=Object.keys(n);e.exports=class ClientApplication extends o{constructor(e,t){super(e),this._patch(t)}_patch(e){this.id=e.id,this.name=e.name,this.description=e.description,this.icon=e.icon,this.cover=e.cover_image||null,this.rpcOrigins=e.rpc_origins||[],this.botRequireCodeGrant=void 0!==e.bot_require_code_grant?e.bot_require_code_grant:null,this.botPublic=void 0!==e.bot_public?e.bot_public:null,this.owner=e.owner?this.client.users.add(e.owner):null}get createdTimestamp(){return i.deconstruct(this.id).timestamp}get createdAt(){return new Date(this.createdTimestamp)}iconURL({format:e,size:t}={}){return this.icon?this.client.rest.cdn.AppIcon(this.id,this.icon,{format:e,size:t}):null}coverImage({format:e,size:t}={}){return this.cover?r.CDN(this.client.options.http.cdn).AppIcon(this.id,this.cover,{format:e,size:t}):null}fetchAssets(){return this.client.api.oauth2.applications(this.id).assets.get().then(e=>e.map(e=>({id:e.id,name:e.name,type:a[e.type-1]})))}toString(){return this.name}toJSON(){return super.toJSON({createdTimestamp:!0})}}},function(e,t,s){"use strict";const i=s(21),n=s(2),r=s(40),o=s(69);e.exports=class MessageReaction{constructor(e,t,s){this.message=s,this.me=t.me,this.count=t.count||0,this.users=new o(e,void 0,this),this._emoji=new r(this,t.emoji)}get emoji(){if(this._emoji instanceof i)return this._emoji;if(this._emoji.id){const e=this.message.client.emojis;if(e.has(this._emoji.id)){const t=e.get(this._emoji.id);return this._emoji=t,t}}return this._emoji}toJSON(){return n.flatten(this,{emoji:"emojiID",message:"messageID"})}_add(e){this.users.set(e.id,e),this.me&&e.id===this.message.client.user.id&&0!==this.count||this.count++,this.me||(this.me=e.id===this.message.client.user.id)}_remove(e){this.users.delete(e.id),this.me&&e.id===this.message.client.user.id||this.count--,e.id===this.message.client.user.id&&(this.me=!1),this.count<=0&&0===this.users.size&&this.message.reactions.remove(this.emoji.id||this.emoji.name)}}},function(e,t,s){"use strict";const i=s(2),n=s(33);e.exports=class ReactionEmoji extends n{constructor(e,t){super(e.message.client,t),this.reaction=e}toJSON(){return i.flatten(this,{identifier:!0})}valueOf(){return this.id}}},function(e,t,s){"use strict";const i=s(16),n=s(7),r=s(2),{TypeError:o}=s(4);e.exports=class PermissionOverwrites{constructor(e,t){Object.defineProperty(this,"channel",{value:e}),t&&this._patch(t)}_patch(e){this.id=e.id,this.type=e.type,this.deny=new n(e.deny).freeze(),this.allow=new n(e.allow).freeze()}update(e,t){const{allow:s,deny:i}=this.constructor.resolveOverwriteOptions(e,this);return this.channel.client.api.channels(this.channel.id).permissions[this.id].put({data:{id:this.id,type:this.type,allow:s.bitfield,deny:i.bitfield},reason:t}).then(()=>this)}delete(e){return this.channel.client.api.channels[this.channel.id].permissions[this.id].delete({reason:e}).then(()=>this)}toJSON(){return r.flatten(this)}static resolveOverwriteOptions(e,{allow:t,deny:s}={}){t=new n(t),s=new n(s);for(const[i,r]of Object.entries(e))!0===r?(t.add(n.FLAGS[i]),s.remove(n.FLAGS[i])):!1===r?(t.remove(n.FLAGS[i]),s.add(n.FLAGS[i])):null===r&&(t.remove(n.FLAGS[i]),s.remove(n.FLAGS[i]));return{allow:t,deny:s}}static resolve(e,t){if(e instanceof this)return e.toJSON();if("string"==typeof e.id&&["role","member"].includes(e.type))return{...e,allow:n.resolve(e.allow),deny:n.resolve(e.deny)};const s=t.roles.resolve(e.id)||t.client.users.resolve(e.id);if(!s)throw new o("INVALID_TYPE","parameter","User nor a Role",!0);const r=s instanceof i?"role":"member";return{id:s.id,type:r,allow:n.resolve(e.allow),deny:n.resolve(e.deny)}}}},function(e,t,s){"use strict";const i=s(26),n=s(73),r=s(74),o=s(11),a=s(43),{ChannelTypes:l,DefaultMessageNotifications:h,browser:c}=s(0),u=s(3),d=s(2),p=s(9),m=s(8),f=s(75),_=s(76),g=s(44),E=s(77),v=s(78),b=s(139),w=s(6),{Error:y,TypeError:A}=s(4);e.exports=class Guild extends w{constructor(e,t){super(e),this.members=new f(this),this.channels=new E(this),this.roles=new _(this),this.presences=new v(this.client),this.deleted=!1,t&&(t.unavailable?(this.available=!1,this.id=t.id):(this._patch(t),t.channels||(this.available=!1)),this.shardID=t.shardID)}get shard(){return this.client.ws.shards.get(this.shardID)}_patch(e){if(this.name=e.name,this.icon=e.icon,this.splash=e.splash,this.region=e.region,this.memberCount=e.member_count||this.memberCount,this.large=Boolean("large"in e?e.large:this.large),this.features=e.features,this.applicationID=e.application_id,this.afkTimeout=e.afk_timeout,this.afkChannelID=e.afk_channel_id,this.systemChannelID=e.system_channel_id,this.embedEnabled=e.embed_enabled,this.verificationLevel=e.verification_level,this.explicitContentFilter=e.explicit_content_filter,this.mfaLevel=e.mfa_level,this.joinedTimestamp=e.joined_at?new Date(e.joined_at).getTime():this.joinedTimestamp,this.defaultMessageNotifications=h[e.default_message_notifications]||e.default_message_notifications,this.id=e.id,this.available=!e.unavailable,this.features=e.features||this.features||[],e.channels){this.channels.clear();for(const t of e.channels)this.client.channels.add(t,this)}if(e.roles){this.roles.clear();for(const t of e.roles)this.roles.add(t)}if(e.members){this.members.clear();for(const t of e.members)this.members.add(t)}if(e.owner_id&&(this.ownerID=e.owner_id),e.presences)for(const t of e.presences)this.presences.add(Object.assign(t,{guild:this}));if(this.voiceStates||(this.voiceStates=new b(this)),e.voice_states)for(const t of e.voice_states)this.voiceStates.add(t);if(this.emojis)this.client.actions.GuildEmojisUpdate.handle({guild_id:this.id,emojis:e.emojis});else if(this.emojis=new g(this),e.emojis)for(const t of e.emojis)this.emojis.add(t)}get createdTimestamp(){return m.deconstruct(this.id).timestamp}get createdAt(){return new Date(this.createdTimestamp)}get joinedAt(){return new Date(this.joinedTimestamp)}get verified(){return this.features.includes("VERIFIED")}iconURL({format:e,size:t}={}){return this.icon?this.client.rest.cdn.Icon(this.id,this.icon,e,t):null}get nameAcronym(){return this.name.replace(/\w+/g,e=>e[0]).replace(/\s/g,"")}splashURL({format:e,size:t}={}){return this.splash?this.client.rest.cdn.Splash(this.id,this.splash,e,t):null}get owner(){return this.members.get(this.ownerID)||null}get afkChannel(){return this.client.channels.get(this.afkChannelID)||null}get systemChannel(){return this.client.channels.get(this.systemChannelID)||null}get voiceConnection(){return c?null:this.client.voice.connections.get(this.id)||null}get defaultRole(){return this.roles.get(this.id)||null}get me(){return this.members.get(this.client.user.id)||null}member(e){return this.members.resolve(e)}fetchBans(){return this.client.api.guilds(this.id).bans.get().then(e=>e.reduce((e,t)=>(e.set(t.user.id,{reason:t.reason,user:this.client.users.add(t.user)}),e),new u))}fetchIntegrations(){return this.client.api.guilds(this.id).integrations.get().then(e=>e.reduce((e,t)=>e.set(t.id,new n(this.client,t,this)),new u))}createIntegration(e,t){return this.client.api.guilds(this.id).integrations.post({data:e,reason:t}).then(()=>this)}fetchInvites(){return this.client.api.guilds(this.id).invites.get().then(e=>{const t=new u;for(const s of e){const e=new i(this.client,s);t.set(e.code,e)}return t})}fetchVanityCode(){return this.features.includes("VANITY_URL")?this.client.api.guilds(this.id,"vanity-url").get().then(e=>e.code):Promise.reject(new y("VANITY_URL"))}fetchWebhooks(){return this.client.api.guilds(this.id).webhooks.get().then(e=>{const t=new u;for(const s of e)t.set(s.id,new o(this.client,s));return t})}fetchVoiceRegions(){return this.client.api.guilds(this.id).regions.get().then(e=>{const t=new u;for(const s of e)t.set(s.id,new a(s));return t})}fetchEmbed(){return this.client.api.guilds(this.id).embed.get().then(e=>({enabled:e.enabled,channel:e.channel_id?this.channels.get(e.channel_id):null}))}fetchAuditLogs(e={}){return e.before&&e.before instanceof r.Entry&&(e.before=e.before.id),e.after&&e.after instanceof r.Entry&&(e.after=e.after.id),"string"==typeof e.type&&(e.type=r.Actions[e.type]),this.client.api.guilds(this.id)["audit-logs"].get({query:{before:e.before,after:e.after,limit:e.limit,user_id:this.client.users.resolveID(e.user),action_type:e.type}}).then(e=>r.build(this,e))}addMember(e,t){if(!(e=this.client.users.resolveID(e)))return Promise.reject(new A("INVALID_TYPE","user","UserResolvable"));if(this.members.has(e))return Promise.resolve(this.members.get(e));if(t.access_token=t.accessToken,t.roles){const e=[];for(let s of t.roles instanceof u?t.roles.values():t.roles){if(!(s=this.roles.resolve(s)))return Promise.reject(new A("INVALID_TYPE","options.roles","Array or Collection of Roles or Snowflakes",!0));e.push(s.id)}}return this.client.api.guilds(this.id).members(e).put({data:t}).then(e=>this.members.add(e))}edit(e,t){const s={};return e.name&&(s.name=e.name),e.region&&(s.region=e.region),void 0!==e.verificationLevel&&(s.verification_level=Number(e.verificationLevel)),void 0!==e.afkChannel&&(s.afk_channel_id=this.client.channels.resolveID(e.afkChannel)),void 0!==e.systemChannel&&(s.system_channel_id=this.client.channels.resolveID(e.systemChannel)),e.afkTimeout&&(s.afk_timeout=Number(e.afkTimeout)),void 0!==e.icon&&(s.icon=e.icon),e.owner&&(s.owner_id=this.client.users.resolve(e.owner).id),e.splash&&(s.splash=e.splash),void 0!==e.explicitContentFilter&&(s.explicit_content_filter=Number(e.explicitContentFilter)),void 0!==e.defaultMessageNotifications&&(s.default_message_notifications="string"==typeof e.defaultMessageNotifications?h.indexOf(e.defaultMessageNotifications):Number(e.defaultMessageNotifications)),this.client.api.guilds(this.id).patch({data:s,reason:t}).then(e=>this.client.actions.GuildUpdate.handle(e).updated)}setExplicitContentFilter(e,t){return this.edit({explicitContentFilter:e},t)}setDefaultMessageNotifications(e,t){return this.edit({defaultMessageNotifications:e},t)}setName(e,t){return this.edit({name:e},t)}setRegion(e,t){return this.edit({region:e},t)}setVerificationLevel(e,t){return this.edit({verificationLevel:e},t)}setAFKChannel(e,t){return this.edit({afkChannel:e},t)}setSystemChannel(e,t){return this.edit({systemChannel:e},t)}setAFKTimeout(e,t){return this.edit({afkTimeout:e},t)}async setIcon(e,t){return this.edit({icon:await p.resolveImage(e),reason:t})}setOwner(e,t){return this.edit({owner:e},t)}async setSplash(e,t){return this.edit({splash:await p.resolveImage(e),reason:t})}setChannelPositions(e){const t=e.map(e=>({id:this.client.channels.resolveID(e.channel),position:e.position}));return this.client.api.guilds(this.id).channels.patch({data:t}).then(()=>this.client.actions.GuildChannelsPositionUpdate.handle({guild_id:this.id,channels:t}).guild)}setEmbed(e,t){return this.client.api.guilds(this.id).embed.patch({data:{enabled:e.enabled,channel_id:this.channels.resolveID(e.channel)},reason:t}).then(()=>this)}leave(){return this.ownerID===this.client.user.id?Promise.reject(new y("GUILD_OWNED")):this.client.api.users("@me").guilds(this.id).delete().then(()=>this.client.actions.GuildDelete.handle({id:this.id}).guild)}delete(){return this.client.api.guilds(this.id).delete().then(()=>this.client.actions.GuildDelete.handle({id:this.id}).guild)}equals(e){let t=e&&e instanceof this.constructor&&this.id===e.id&&this.available===e.available&&this.splash===e.splash&&this.region===e.region&&this.name===e.name&&this.memberCount===e.memberCount&&this.large===e.large&&this.icon===e.icon&&this.ownerID===e.ownerID&&this.verificationLevel===e.verificationLevel&&this.embedEnabled===e.embedEnabled&&(this.features===e.features||this.features.length===e.features.length&&this.features.every((t,s)=>t===e.features[s]));return t&&(this.embedChannel?e.embedChannel&&this.embedChannel.id===e.embedChannel.id||(t=!1):e.embedChannel&&(t=!1)),t}toString(){return this.name}toJSON(){const e=super.toJSON({available:!1,createdTimestamp:!0,nameAcronym:!0,presences:!1,voiceStates:!1});return e.iconURL=this.iconURL(),e.splashURL=this.splashURL(),e}_sortedRoles(){return d.discordSort(this.roles)}_sortedChannels(e){const t=e.type===l.CATEGORY;return d.discordSort(this.channels.filter(s=>s.type===e.type&&(t||s.parent===e.parent)))}}},function(e,t,s){"use strict";const i=s(2);e.exports=class VoiceRegion{constructor(e){this.id=e.id,this.name=e.name,this.vip=e.vip,this.deprecated=e.deprecated,this.optimal=e.optimal,this.custom=e.custom}toJSON(){return i.flatten(this)}}},function(e,t,s){"use strict";const i=s(3),n=s(5),r=s(21),o=s(40),a=s(9),{TypeError:l}=s(4);e.exports=class GuildEmojiStore extends n{constructor(e,t){super(e.client,t,r),this.guild=e}add(e,t){return super.add(e,t,{extras:[this.guild]})}create(e,t,{roles:s,reason:n}={}){if("string"==typeof e&&e.startsWith("data:")){const r={image:e,name:t};if(s){r.roles=[];for(let e of s instanceof i?s.values():s){if(!(e=this.guild.roles.resolve(e)))return Promise.reject(new l("INVALID_TYPE","options.roles","Array or Collection of Roles or Snowflakes",!0));r.roles.push(e.id)}}return this.client.api.guilds(this.guild.id).emojis.post({data:r,reason:n}).then(e=>this.client.actions.GuildEmojiCreate.handle(this.guild,e).emoji)}return a.resolveImage(e).then(e=>this.create(e,t,{roles:s,reason:n}))}resolve(e){return e instanceof o?super.resolve(e.id):super.resolve(e)}resolveID(e){return e instanceof o?e.id:super.resolveID(e)}resolveIdentifier(e){const t=this.resolve(e);return t?t.identifier:e instanceof o?e.identifier:"string"==typeof e?e.includes("%")?e:encodeURIComponent(e):null}}},function(e,t){e.exports={version:"12.0.0-dev",homepage:"https://github.com/discordjs/discord.js#readme"}},function(e,t,s){"use strict";const i=Symbol("code"),n=new Map;function r(e){return class DiscordjsError extends e{constructor(e,...t){super(function(e,t){if("string"!=typeof e)throw new Error("Error message key must be a string");const s=n.get(e);if(!s)throw new Error(`An invalid error message key was used: ${e}.`);return"function"==typeof s?s(...t):void 0===t||0===t.length?s:(t.unshift(s),String(...t))}(e,t)),this[i]=e,Error.captureStackTrace&&Error.captureStackTrace(this,DiscordjsError)}get name(){return`${super.name} [${this[i]}]`}get code(){return this[i]}}}e.exports={register:function(e,t){n.set(e,"function"==typeof t?t:String(t))},Error:r(Error),TypeError:r(TypeError),RangeError:r(RangeError)}},function(e,t,s){(function(e){var i=void 0!==e&&e||"undefined"!=typeof self&&self||window,n=Function.prototype.apply;function r(e,t){this._id=e,this._clearFn=t}t.setTimeout=function(){return new r(n.call(setTimeout,i,arguments),clearTimeout)},t.setInterval=function(){return new r(n.call(setInterval,i,arguments),clearInterval)},t.clearTimeout=t.clearInterval=function(e){e&&e.close()},r.prototype.unref=r.prototype.ref=function(){},r.prototype.close=function(){this._clearFn.call(i,this._id)},t.enroll=function(e,t){clearTimeout(e._idleTimeoutId),e._idleTimeout=t},t.unenroll=function(e){clearTimeout(e._idleTimeoutId),e._idleTimeout=-1},t._unrefActive=t.active=function(e){clearTimeout(e._idleTimeoutId);var t=e._idleTimeout;t>=0&&(e._idleTimeoutId=setTimeout(function(){e._onTimeout&&e._onTimeout()},t))},s(49),t.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==e&&e.setImmediate||this&&this.setImmediate,t.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==e&&e.clearImmediate||this&&this.clearImmediate}).call(this,s(48))},function(e,t){var s;s=function(){return this}();try{s=s||new Function("return this")()}catch(e){"object"==typeof window&&(s=window)}e.exports=s},function(e,t,s){(function(e,t){!function(e,s){"use strict";if(!e.setImmediate){var i,n,r,o,a,l=1,h={},c=!1,u=e.document,d=Object.getPrototypeOf&&Object.getPrototypeOf(e);d=d&&d.setTimeout?d:e,"[object process]"==={}.toString.call(e.process)?i=function(e){t.nextTick(function(){m(e)})}:!function(){if(e.postMessage&&!e.importScripts){var t=!0,s=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=s,t}}()?e.MessageChannel?((r=new MessageChannel).port1.onmessage=function(e){m(e.data)},i=function(e){r.port2.postMessage(e)}):u&&"onreadystatechange"in u.createElement("script")?(n=u.documentElement,i=function(e){var t=u.createElement("script");t.onreadystatechange=function(){m(e),t.onreadystatechange=null,n.removeChild(t),t=null},n.appendChild(t)}):i=function(e){setTimeout(m,0,e)}:(o="setImmediate$"+Math.random()+"$",a=function(t){t.source===e&&"string"==typeof t.data&&0===t.data.indexOf(o)&&m(+t.data.slice(o.length))},e.addEventListener?e.addEventListener("message",a,!1):e.attachEvent("onmessage",a),i=function(t){e.postMessage(o+t,"*")}),d.setImmediate=function(e){"function"!=typeof e&&(e=new Function(""+e));for(var t=new Array(arguments.length-1),s=0;se.message).join(" ")}`):n.code||n.message?s.push(`${n.code?`${n.code}: `:""}${n.message}`.trim()):"string"==typeof n?s.push(n):s=s.concat(this.flattenErrors(n,e))}return s}}},function(e,t,s){"use strict";e.exports=class HTTPError extends Error{constructor(e,t,s,i,n){super(e),this.name=t,this.code=s||500,this.method=i,this.path=n}}},function(e,t,s){"use strict";t.decode=t.parse=s(88),t.encode=t.stringify=s(89)},function(e,t,s){"use strict";const{browser:i}=s(0),n=s(52);try{var r=s(97);r.pack||(r=null)}catch(e){}if(i)t.WebSocket=window.WebSocket;else try{t.WebSocket=s(98)}catch(e){t.WebSocket=s(99)}t.encoding=r?"etf":"json",t.pack=r?r.pack:JSON.stringify,t.unpack=(e=>r&&"{"!==e[0]?(e instanceof Buffer||(e=Buffer.from(new Uint8Array(e))),r.unpack(e)):JSON.parse(e)),t.create=((e,s={},...r)=>{const[o,a]=e.split("?");s.encoding=t.encoding,a&&(s=Object.assign(n.parse(a),s));const l=new t.WebSocket(`${o}?${n.stringify(s)}`,...r);return i&&(l.binaryType="arraybuffer"),l});for(const e of["CONNECTING","OPEN","CLOSING","CLOSED"])t[e]=t.WebSocket[e]},function(e,t,s){"use strict";var i={};(0,s(10).assign)(i,s(101),s(104),s(59)),e.exports=i},function(e,t,s){"use strict";e.exports=function(e,t,s,i){for(var n=65535&e|0,r=e>>>16&65535|0,o=0;0!==s;){s-=o=s>2e3?2e3:s;do{r=r+(n=n+t[i++]|0)|0}while(--o);n%=65521,r%=65521}return n|r<<16|0}},function(e,t,s){"use strict";var i=function(){for(var e,t=[],s=0;s<256;s++){e=s;for(var i=0;i<8;i++)e=1&e?3988292384^e>>>1:e>>>1;t[s]=e}return t}();e.exports=function(e,t,s,n){var r=i,o=n+s;e^=-1;for(var a=n;a>>8^r[255&(e^t[a])];return-1^e}},function(e,t,s){"use strict";var i=s(10),n=!0,r=!0;try{String.fromCharCode.apply(null,[0])}catch(e){n=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){r=!1}for(var o=new i.Buf8(256),a=0;a<256;a++)o[a]=a>=252?6:a>=248?5:a>=240?4:a>=224?3:a>=192?2:1;function l(e,t){if(t<65534&&(e.subarray&&r||!e.subarray&&n))return String.fromCharCode.apply(null,i.shrinkBuf(e,t));for(var s="",o=0;o>>6,t[o++]=128|63&s):s<65536?(t[o++]=224|s>>>12,t[o++]=128|s>>>6&63,t[o++]=128|63&s):(t[o++]=240|s>>>18,t[o++]=128|s>>>12&63,t[o++]=128|s>>>6&63,t[o++]=128|63&s);return t},t.buf2binstring=function(e){return l(e,e.length)},t.binstring2buf=function(e){for(var t=new i.Buf8(e.length),s=0,n=t.length;s4)h[i++]=65533,s+=r-1;else{for(n&=2===r?31:3===r?15:7;r>1&&s1?h[i++]=65533:n<65536?h[i++]=n:(n-=65536,h[i++]=55296|n>>10&1023,h[i++]=56320|1023&n)}return l(h,i)},t.utf8border=function(e,t){var s;for((t=t||e.length)>e.length&&(t=e.length),s=t-1;s>=0&&128==(192&e[s]);)s--;return s<0?t:0===s?t:s+o[e[s]]>t?s:t}},function(e,t,s){"use strict";e.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},function(e,t,s){"use strict";e.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},function(e,t,s){"use strict";const{WSEvents:i}=s(0),n={};for(const e of Object.keys(i))try{n[e]=s(109)(`./${e}.js`)}catch(e){}e.exports=n},function(e,t,s){"use strict";const i=s(18),n=s(9);e.exports=class ClientUser extends(i.get("User")){_patch(e){super._patch(e),this.verified=e.verified,this.mfaEnabled="boolean"==typeof e.mfa_enabled?e.mfa_enabled:null,this._typing=new Map,e.token&&(this.client.token=e.token)}get presence(){return this.client.presence}edit(e){return this.client.api.users("@me").patch({data:e}).then(e=>{this.client.token=e.token;const{updated:t}=this.client.actions.UserUpdate.handle(e);return t||this})}setUsername(e){return this.edit({username:e})}async setAvatar(e){return this.edit({avatar:await n.resolveImage(e)})}setPresence(e){return this.client.presence.set(e)}setStatus(e,t){return this.setPresence({status:e,shardID:t})}setActivity(e,t={}){if(!e)return this.setPresence({activity:null,shardID:t.shardID});const s=Object.assign({},t,"object"==typeof e?e:{name:e});return this.setPresence({activity:s,shardID:s.shardID})}setAFK(e){return this.setPresence({afk:e})}}},function(e,t,s){"use strict";const i=s(3),n=s(2),{TypeError:r}=s(4);class GuildEmojiRoleStore extends i{constructor(e){super(),this.emoji=e,this.guild=e.guild,Object.defineProperty(this,"client",{value:e.client})}get _filtered(){return this.guild.roles.filter(e=>this.emoji._roles.includes(e.id))}add(e){if(e instanceof i)return this.add(e.keyArray());if(!(e instanceof Array))return this.add([e]);if((e=e.map(e=>this.guild.roles.resolve(e))).includes(null))return Promise.reject(new r("INVALID_TYPE","roles","Array or Collection of Roles or Snowflakes",!0));const t=[...new Set(e.concat(...this.values()))];return this.set(t)}remove(e){if(e instanceof i)return this.remove(e.keyArray());if(!(e instanceof Array))return this.remove([e]);if((e=e.map(e=>this.guild.roles.resolveID(e))).includes(null))return Promise.reject(new r("INVALID_TYPE","roles","Array or Collection of Roles or Snowflakes",!0));const t=this.keyArray().filter(t=>!e.includes(t));return this.set(t)}set(e){return this.emoji.edit({roles:e})}clone(){const e=new this.constructor(this.emoji);return e._patch(this.keyArray().slice()),e}_patch(e){this.emoji._roles=e}*[Symbol.iterator](){yield*this._filtered.entries()}valueOf(){return this._filtered}}n.mixin(GuildEmojiRoleStore,["set"]),e.exports=GuildEmojiRoleStore},function(e,t,s){"use strict";const i=s(14),n=s(22),r=s(24);class DMChannel extends i{constructor(e,t){super(e,t),this.type="dm",this.messages=new r(this),this._typing=new Map}_patch(e){super._patch(e),e.recipients&&(this.recipient=this.client.users.add(e.recipients[0])),this.lastMessageID=e.last_message_id,this.lastPinTimestamp=e.last_pin_timestamp?new Date(e.last_pin_timestamp).getTime():null}get partial(){return Boolean(this.recipient)}toString(){return this.recipient.toString()}get lastMessage(){}get lastPinAt(){}send(){}search(){}startTyping(){}stopTyping(){}get typing(){}get typingCount(){}createMessageCollector(){}awaitMessages(){}acknowledge(){}_cacheMessage(){}}n.applyToClass(DMChannel,!0,["bulkDelete"]),e.exports=DMChannel},function(e,t,s){"use strict";const i=s(34),{Events:n}=s(0);e.exports=class MessageCollector extends i{constructor(e,t,s={}){super(e.client,t,s),this.channel=e,this.received=0;const i=(e=>{for(const t of e.values())this.handleDispose(t)}).bind(this);this.client.setMaxListeners(this.client.getMaxListeners()+1),this.client.on(n.MESSAGE_CREATE,this.handleCollect),this.client.on(n.MESSAGE_DELETE,this.handleDispose),this.client.on(n.MESSAGE_BULK_DELETE,i),this.once("end",()=>{this.client.removeListener(n.MESSAGE_CREATE,this.handleCollect),this.client.removeListener(n.MESSAGE_DELETE,this.handleDispose),this.client.removeListener(n.MESSAGE_BULK_DELETE,i),this.client.setMaxListeners(this.client.getMaxListeners()-1)})}collect(e){return e.channel.id!==this.channel.id?null:(this.received++,e.id)}dispose(e){return e.channel.id===this.channel.id?e.id:null}endReason(){return this.options.max&&this.collected.size>=this.options.max?"limit":this.options.maxProcessed&&this.received===this.options.maxProcessed?"processedLimit":null}}},function(e,t,s){"use strict";const i=s(20);class ActivityFlags extends i{}ActivityFlags.FLAGS={INSTANCE:1,JOIN:2,SPECTATE:4,JOIN_REQUEST:8,SYNC:16,PLAY:32},e.exports=ActivityFlags},function(e,t,s){"use strict";const i=s(3),n=s(2),{TypeError:r}=s(4);class GuildMemberRoleStore extends i{constructor(e){super(),this.member=e,this.guild=e.guild,Object.defineProperty(this,"client",{value:e.client})}get _filtered(){const e=this.guild.defaultRole;return this.guild.roles.filter(e=>this.member._roles.includes(e.id)).set(e.id,e)}get hoist(){const e=this._filtered.filter(e=>e.hoist);return e.size?e.reduce((e,t)=>!e||t.comparePositionTo(e)>0?t:e):null}get color(){const e=this._filtered.filter(e=>e.color);return e.size?e.reduce((e,t)=>!e||t.comparePositionTo(e)>0?t:e):null}get highest(){return this._filtered.reduce((e,t)=>t.comparePositionTo(e)>0?t:e,this.first())}async add(e,t){if(e instanceof i||e instanceof Array){if((e=e.map(e=>this.guild.roles.resolve(e))).includes(null))return Promise.reject(new r("INVALID_TYPE","roles","Array or Collection of Roles or Snowflakes",!0));const s=[...new Set(e.concat(...this.values()))];return this.set(s,t)}{if(null===(e=this.guild.roles.resolve(e)))return Promise.reject(new r("INVALID_TYPE","roles","Array or Collection of Roles or Snowflakes",!0));await this.client.api.guilds[this.guild.id].members[this.member.id].roles[e.id].put({reason:t});const s=this.member._clone();return s.roles._patch([...this.keys(),e.id]),s}}async remove(e,t){if(e instanceof i||e instanceof Array){if((e=e.map(e=>this.guild.roles.resolve(e))).includes(null))return Promise.reject(new r("INVALID_TYPE","roles","Array or Collection of Roles or Snowflakes",!0));const s=this.filter(t=>!e.includes(t));return this.set(s,t)}{if(null===(e=this.guild.roles.resolve(e)))return Promise.reject(new r("INVALID_TYPE","roles","Array or Collection of Roles or Snowflakes",!0));await this.client.api.guilds[this.guild.id].members[this.member.id].roles[e.id].delete({reason:t});const s=this.member._clone(),i=this.filter(t=>t.id!==e.id);return s.roles._patch([...i.keys()]),s}}set(e,t){return this.member.edit({roles:e},t)}_patch(e){this.member._roles=e}clone(){const e=new this.constructor(this.member);return e._patch(this.keyArray()),e}*[Symbol.iterator](){yield*this._filtered.entries()}valueOf(){return this._filtered}}n.mixin(GuildMemberRoleStore,["set"]),e.exports=GuildMemberRoleStore},function(e,t,s){"use strict";const i=s(3),n=s(2),r=s(13);class MessageMentions{constructor(e,t,s,n){if(Object.defineProperty(this,"client",{value:e.client}),Object.defineProperty(this,"guild",{value:e.guild}),Object.defineProperty(this,"_content",{value:e.content}),this.everyone=Boolean(n),t)if(t instanceof i)this.users=new i(t);else{this.users=new i;for(const s of t){let t=e.client.users.add(s);this.users.set(t.id,t)}}else this.users=new i;if(s)if(s instanceof i)this.roles=new i(s);else{this.roles=new i;for(const t of s){const s=e.channel.guild.roles.get(t);s&&this.roles.set(s.id,s)}}else this.roles=new i;this._members=null,this._channels=null}get members(){return this._members?this._members:this.guild?(this._members=new i,this.users.forEach(e=>{const t=this.guild.member(e);t&&this._members.set(t.user.id,t)}),this._members):null}get channels(){if(this._channels)return this._channels;let e;for(this._channels=new i;null!==(e=this.constructor.CHANNELS_PATTERN.exec(this._content));){const t=this.client.channels.get(e[1]);t&&this._channels.set(t.id,t)}return this._channels}has(e,{ignoreDirect:t=!1,ignoreRoles:s=!1,ignoreEveryone:i=!1}={}){if(!i&&this.everyone)return!0;if(!s&&e instanceof r)for(const t of this.roles.values())if(e.roles.has(t.id))return!0;if(!t){const t=e.id||e;return this.users.has(t)||this.channels.has(t)||this.roles.has(t)}return!1}toJSON(){return n.flatten(this,{members:!0,channels:!0})}}MessageMentions.EVERYONE_PATTERN=/@(everyone|here)/g,MessageMentions.USERS_PATTERN=/<@!?(\d{17,19})>/g,MessageMentions.ROLES_PATTERN=/<@&(\d{17,19})>/g,MessageMentions.CHANNELS_PATTERN=/<#(\d{17,19})>/g,e.exports=MessageMentions},function(e,t,s){"use strict";const i=s(34),n=s(3),{Events:r}=s(0);class ReactionCollector extends i{constructor(e,t,s={}){super(e.client,t,s),this.message=e,this.users=new n,this.total=0,this.empty=this.empty.bind(this),this.client.setMaxListeners(this.client.getMaxListeners()+1),this.client.on(r.MESSAGE_REACTION_ADD,this.handleCollect),this.client.on(r.MESSAGE_REACTION_REMOVE,this.handleDispose),this.client.on(r.MESSAGE_REACTION_REMOVE_ALL,this.empty),this.once("end",()=>{this.client.removeListener(r.MESSAGE_REACTION_ADD,this.handleCollect),this.client.removeListener(r.MESSAGE_REACTION_REMOVE,this.handleDispose),this.client.removeListener(r.MESSAGE_REACTION_REMOVE_ALL,this.empty),this.client.setMaxListeners(this.client.getMaxListeners()-1)}),this.on("collect",(e,t)=>{this.total++,this.users.set(t.id,t)}),this.on("remove",(e,t)=>{this.total--,this.collected.some(e=>e.users.has(t.id))||this.users.delete(t.id)})}collect(e){return e.message.id!==this.message.id?null:ReactionCollector.key(e)}dispose(e,t){return e.message.id!==this.message.id?null:(this.collected.has(ReactionCollector.key(e))&&this.users.has(t.id)&&this.emit("remove",e,t),e.count?null:ReactionCollector.key(e))}empty(){this.total=0,this.collected.clear(),this.users.clear(),this.checkEnd()}endReason(){return this.options.max&&this.total>=this.options.max?"limit":this.options.maxEmojis&&this.collected.size>=this.options.maxEmojis?"emojiLimit":this.options.maxUsers&&this.users.size>=this.options.maxUsers?"userLimit":null}static key(e){return e.emoji.id||e.emoji.name}}e.exports=ReactionCollector},function(e,t,s){"use strict";const i=s(3),n=s(5),{Error:r}=s(4);e.exports=class ReactionUserStore extends n{constructor(e,t,i){super(e,t,s(15)),this.reaction=i}async fetch({limit:e=100,after:t,before:s}={}){const n=this.reaction.message,r=await this.client.api.channels[n.channel.id].messages[n.id].reactions[this.reaction.emoji.identifier].get({query:{limit:e,before:s,after:t}}),o=new i;for(const e of r){const t=this.client.users.add(e);this.set(t.id,t),o.set(t.id,t)}return o}remove(e=this.reaction.message.client.user){const t=this.reaction.message,s=t.client.users.resolveID(e);return s?t.client.api.channels[t.channel.id].messages[t.id].reactions[this.reaction.emoji.identifier][s===t.client.user.id?"@me":s].delete().then(()=>t.client.actions.MessageReactionRemove.handle({user_id:s,message_id:t.id,emoji:this.reaction.emoji,channel_id:t.channel.id}).reaction):Promise.reject(new r("REACTION_RESOLVE_USER"))}}},function(e,t,s){"use strict";const i=s(17),n=s(11),r=s(22),o=s(3),a=s(9),l=s(24);class TextChannel extends i{constructor(e,t){super(e,t),this.messages=new l(this),this._typing=new Map}_patch(e){if(super._patch(e),this.topic=e.topic,this.nsfw=e.nsfw||/^nsfw(-|$)/.test(this.name),this.lastMessageID=e.last_message_id,this.rateLimitPerUser=e.rate_limit_per_user||0,this.lastPinTimestamp=e.last_pin_timestamp?new Date(e.last_pin_timestamp).getTime():null,e.messages)for(const t of e.messages)this.messages.add(t)}setRateLimitPerUser(e,t){return this.edit({rateLimitPerUser:e},t)}setNSFW(e,t){return this.edit({nsfw:e},t)}fetchWebhooks(){return this.client.api.channels[this.id].webhooks.get().then(e=>{const t=new o;for(const s of e)t.set(s.id,new n(this.client,s));return t})}async createWebhook(e,{avatar:t,reason:s}={}){return"string"!=typeof t||t.startsWith("data:")||(t=await a.resolveImage(t)),this.client.api.channels[this.id].webhooks.post({data:{name:e,avatar:t},reason:s}).then(e=>new n(this.client,e))}get lastMessage(){}get lastPinAt(){}send(){}search(){}startTyping(){}stopTyping(){}get typing(){}get typingCount(){}createMessageCollector(){}awaitMessages(){}bulkDelete(){}acknowledge(){}_cacheMessage(){}}r.applyToClass(TextChannel,!0),e.exports=TextChannel},function(e,t,s){"use strict";const i=s(17),{browser:n}=s(0),r=s(7),o=s(3),{Error:a}=s(4);e.exports=class VoiceChannel extends i{_patch(e){super._patch(e),this.bitrate=e.bitrate,this.userLimit=e.user_limit}get members(){const e=new o;for(const t of this.guild.voiceStates.values())t.channelID===this.id&&t.member&&e.set(t.id,t.member);return e}get connection(){const e=this.guild.voiceConnection;return e&&e.channel.id===this.id?e:null}get full(){return this.userLimit>0&&this.members.size>=this.userLimit}get deletable(){return super.deletable&&this.permissionsFor(this.client.user).has(r.FLAGS.CONNECT,!1)}get joinable(){return!(n||!this.permissionsFor(this.client.user).has("CONNECT",!1)||this.full&&!this.permissionsFor(this.client.user).has("MOVE_MEMBERS",!1))}get speakable(){return this.permissionsFor(this.client.user).has("SPEAK",!1)}setBitrate(e,t){return this.edit({bitrate:e},t)}setUserLimit(e,t){return this.edit({userLimit:e},t)}join(){return n?Promise.reject(new a("VOICE_NO_BROWSER")):this.client.voice.joinChannel(this)}leave(){if(n)return;const e=this.client.voice.connections.get(this.guild.id);e&&e.channel.id===this.id&&e.disconnect()}}},function(e,t,s){"use strict";const i=s(17);e.exports=class CategoryChannel extends i{get children(){return this.guild.channels.filter(e=>e.parentID===this.id)}}},function(e,t,s){"use strict";const i=s(6);e.exports=class Integration extends i{constructor(e,t,s){super(e),this.guild=s,this.id=t.id,this.name=t.name,this.type=t.type,this.enabled=t.enabled,this.syncing=t.syncing,this.role=this.guild.roles.get(t.role_id),this.user=this.client.users.add(t.user),this.account=t.account,this.syncedAt=t.synced_at,this._patch(t)}_patch(e){this.expireBehavior=e.expire_behavior,this.expireGracePeriod=e.expire_grace_period}sync(){return this.syncing=!0,this.client.api.guilds(this.guild.id).integrations(this.id).post().then(()=>(this.syncing=!1,this.syncedAt=Date.now(),this))}edit(e,t){return"expireBehavior"in e&&(e.expire_behavior=e.expireBehavior,e.expireBehavior=null),"expireGracePeriod"in e&&(e.expire_grace_period=e.expireGracePeriod,e.expireGracePeriod=null),this.client.api.guilds(this.guild.id).integrations(this.id).patch({data:e,reason:t}).then(()=>(this._patch(e),this))}delete(e){return this.client.api.guilds(this.guild.id).integrations(this.id).delete({reason:e}).then(()=>this)}toJSON(){return super.toJSON({role:"roleID",guild:"guildID",user:"userID"})}}},function(e,t,s){"use strict";const i=s(3),n=s(8),r=s(11),o=s(2),a={ALL:"ALL",GUILD:"GUILD",CHANNEL:"CHANNEL",USER:"USER",ROLE:"ROLE",INVITE:"INVITE",WEBHOOK:"WEBHOOK",EMOJI:"EMOJI",MESSAGE:"MESSAGE",UNKNOWN:"UNKNOWN"},l={ALL:null,GUILD_UPDATE:1,CHANNEL_CREATE:10,CHANNEL_UPDATE:11,CHANNEL_DELETE:12,CHANNEL_OVERWRITE_CREATE:13,CHANNEL_OVERWRITE_UPDATE:14,CHANNEL_OVERWRITE_DELETE:15,MEMBER_KICK:20,MEMBER_PRUNE:21,MEMBER_BAN_ADD:22,MEMBER_BAN_REMOVE:23,MEMBER_UPDATE:24,MEMBER_ROLE_UPDATE:25,ROLE_CREATE:30,ROLE_UPDATE:31,ROLE_DELETE:32,INVITE_CREATE:40,INVITE_UPDATE:41,INVITE_DELETE:42,WEBHOOK_CREATE:50,WEBHOOK_UPDATE:51,WEBHOOK_DELETE:52,EMOJI_CREATE:60,EMOJI_UPDATE:61,EMOJI_DELETE:62,MESSAGE_DELETE:72};class GuildAuditLogs{constructor(e,t){if(t.users)for(const s of t.users)e.client.users.add(s);if(this.webhooks=new i,t.webhooks)for(const s of t.webhooks)this.webhooks.set(s.id,new r(e.client,s));this.entries=new i;for(const s of t.audit_log_entries){const t=new GuildAuditLogsEntry(this,e,s);this.entries.set(t.id,t)}}static build(...e){const t=new GuildAuditLogs(...e);return Promise.all(t.entries.map(e=>e.target)).then(()=>t)}static targetType(e){return e<10?a.GUILD:e<20?a.CHANNEL:e<30?a.USER:e<40?a.ROLE:e<50?a.INVITE:e<60?a.WEBHOOK:e<70?a.EMOJI:e<80?a.MESSAGE:a.UNKNOWN}static actionType(e){return[l.CHANNEL_CREATE,l.CHANNEL_OVERWRITE_CREATE,l.MEMBER_BAN_REMOVE,l.ROLE_CREATE,l.INVITE_CREATE,l.WEBHOOK_CREATE,l.EMOJI_CREATE].includes(e)?"CREATE":[l.CHANNEL_DELETE,l.CHANNEL_OVERWRITE_DELETE,l.MEMBER_KICK,l.MEMBER_PRUNE,l.MEMBER_BAN_ADD,l.ROLE_DELETE,l.INVITE_DELETE,l.WEBHOOK_DELETE,l.EMOJI_DELETE,l.MESSAGE_DELETE].includes(e)?"DELETE":[l.GUILD_UPDATE,l.CHANNEL_UPDATE,l.CHANNEL_OVERWRITE_UPDATE,l.MEMBER_UPDATE,l.MEMBER_ROLE_UPDATE,l.ROLE_UPDATE,l.INVITE_UPDATE,l.WEBHOOK_UPDATE,l.EMOJI_UPDATE].includes(e)?"UPDATE":"ALL"}toJSON(){return o.flatten(this)}}class GuildAuditLogsEntry{constructor(e,t,s){const i=GuildAuditLogs.targetType(s.action_type);if(this.targetType=i,this.actionType=GuildAuditLogs.actionType(s.action_type),this.action=Object.keys(l).find(e=>l[e]===s.action_type),this.reason=s.reason||null,this.executor=t.client.users.get(s.user_id),this.changes=s.changes?s.changes.map(e=>({key:e.key,old:e.old_value,new:e.new_value})):null,this.id=s.id,this.extra=null,s.options)if(s.action_type===l.MEMBER_PRUNE)this.extra={removed:s.options.members_removed,days:s.options.delete_member_days};else if(s.action_type===l.MESSAGE_DELETE)this.extra={count:s.options.count,channel:t.channels.get(s.options.channel_id)};else switch(s.options.type){case"member":this.extra=t.members.get(s.options.id),this.extra||(this.extra={id:s.options.id});break;case"role":this.extra=t.roles.get(s.options.id),this.extra||(this.extra={id:s.options.id,name:s.options.role_name})}if(i===a.UNKNOWN)this.target=this.changes.reduce((e,t)=>(e[t.key]=t.new||t.old,e),{}),this.target.id=s.target_id;else if([a.USER,a.GUILD].includes(i))this.target=t.client[`${i.toLowerCase()}s`].get(s.target_id);else if(i===a.WEBHOOK)this.target=e.webhooks.get(s.target_id)||new r(t.client,this.changes.reduce((e,t)=>(e[t.key]=t.new||t.old,e),{id:s.target_id,guild_id:t.id}));else if(i===a.INVITE)if(t.me.permissions.has("MANAGE_GUILD")){const e=this.changes.find(e=>"code"===e.key);this.target=t.fetchInvites().then(t=>(this.target=t.find(t=>t.code===(e.new||e.old)),this.target))}else this.target=this.changes.reduce((e,t)=>(e[t.key]=t.new||t.old,e),{});else i===a.MESSAGE?this.target=t.client.users.get(s.target_id):this.target=t[`${i.toLowerCase()}s`].get(s.target_id)||{id:s.target_id}}get createdTimestamp(){return n.deconstruct(this.id).timestamp}get createdAt(){return new Date(this.createdTimestamp)}toJSON(){return o.flatten(this,{createdTimestamp:!0})}}GuildAuditLogs.Actions=l,GuildAuditLogs.Targets=a,GuildAuditLogs.Entry=GuildAuditLogsEntry,e.exports=GuildAuditLogs},function(e,t,s){"use strict";const i=s(5),n=s(13),{Events:r,OPCodes:o}=s(0),a=s(3),{Error:l,TypeError:h}=s(4);e.exports=class GuildMemberStore extends i{constructor(e,t){super(e.client,t,n),this.guild=e}add(e,t=!0){return super.add(e,t,{id:e.user.id,extras:[this.guild]})}resolve(e){const t=super.resolve(e);if(t)return t;const s=this.client.users.resolveID(e);return s?super.resolve(s):null}resolveID(e){const t=super.resolveID(e);if(t)return t;const s=this.client.users.resolveID(e);return this.has(s)?s:null}fetch(e){if(!e)return this._fetchMany();const t=this.client.users.resolveID(e);return t?this._fetchSingle({user:t,cache:!0}):e.user&&(e.user=this.client.users.resolveID(e.user),e.user)?this._fetchSingle(e):this._fetchMany(e)}prune({days:e=7,dry:t=!1,reason:s}={}){if("number"!=typeof e)throw new h("PRUNE_DAYS_TYPE");return this.client.api.guilds(this.guild.id).prune[t?"get":"post"]({query:{days:e},reason:s}).then(e=>e.pruned)}ban(e,t={days:0}){t.days&&(t["delete-message-days"]=t.days);const s=this.client.users.resolveID(e);return s?this.client.api.guilds(this.guild.id).bans[s].put({query:t}).then(()=>{if(e instanceof n)return e;const t=this.client.users.resolve(s);return t?this.resolve(t)||t:s}):Promise.reject(new l("BAN_RESOLVE_ID",!0))}unban(e,t){const s=this.client.users.resolveID(e);if(!s)throw new l("BAN_RESOLVE_ID");return this.client.api.guilds(this.guild.id).bans[s].delete({reason:t}).then(()=>this.client.users.resolve(e))}_fetchSingle({user:e,cache:t}){const s=this.get(e);return s&&s.joinedTimestamp?Promise.resolve(s):this.client.api.guilds(this.guild.id).members(e).get().then(e=>this.add(e,t))}_fetchMany({query:e="",limit:t=0}={}){return new Promise((s,i)=>{if(this.guild.memberCount===this.size)return void s(e||t?new a:this);this.guild.shard.send({op:o.REQUEST_GUILD_MEMBERS,d:{guild_id:this.guild.id,query:e,limit:t}});const n=new a,h=(i,o)=>{if(o.id===this.guild.id){for(const s of i.values())(e||t)&&n.set(s.id,s);(this.guild.memberCount<=this.size||(e||t)&&i.size<1e3||t&&n.size>=t)&&(this.guild.client.removeListener(r.GUILD_MEMBERS_CHUNK,h),s(e||t?n:this))}};this.guild.client.on(r.GUILD_MEMBERS_CHUNK,h),this.guild.client.setTimeout(()=>{this.guild.client.removeListener(r.GUILD_MEMBERS_CHUNK,h),i(new l("GUILD_MEMBERS_TIMEOUT"))},12e4)})}}},function(e,t,s){"use strict";const i=s(5),n=s(16),{resolveColor:r}=s(2),o=s(7);e.exports=class RoleStore extends i{constructor(e,t){super(e.client,t,n),this.guild=e}add(e,t){return super.add(e,t,{extras:[this.guild]})}async fetch(e,t=!0){if(e){const t=this.get(e);if(t)return t}const s=await this.client.api.guilds(this.guild.id).roles.get();for(const e of s)this.add(e,t);return e?this.get(e)||null:this}create({data:e={},reason:t}={}){return e.color&&(e.color=r(e.color)),e.permissions&&(e.permissions=o.resolve(e.permissions)),this.guild.client.api.guilds(this.guild.id).roles.post({data:e,reason:t}).then(s=>{const{role:i}=this.client.actions.GuildRoleCreate.handle({guild_id:this.guild.id,role:s});return e.position?i.setPosition(e.position,t):i})}get highest(){return this.reduce((e,t)=>t.comparePositionTo(e)>0?t:e,this.first())}}},function(e,t,s){"use strict";const i=s(14),{ChannelTypes:n}=s(0),r=s(5),o=s(17),a=s(41);e.exports=class GuildChannelStore extends r{constructor(e,t){super(e.client,t,o),this.guild=e}add(e){const t=this.get(e.id);return t||i.create(this.client,e,this.guild)}async create(e,t={}){let{type:s,topic:i,nsfw:r,bitrate:o,userLimit:l,parent:h,permissionOverwrites:c,position:u,rateLimitPerUser:d,reason:p}=t;h&&(h=this.client.channels.resolveID(h)),c&&(c=c.map(e=>a.resolve(e,this.guild)));const m=await this.client.api.guilds(this.guild.id).channels.post({data:{name:e,topic:i,type:s?n[s.toUpperCase()]:"text",nsfw:r,bitrate:o,user_limit:l,parent_id:h,position:u,permission_overwrites:c,rate_limit_per_user:d},reason:p});return this.client.actions.ChannelCreate.handle(m).channel}}},function(e,t,s){"use strict";const i=s(5),{Presence:n}=s(12);e.exports=class PresenceStore extends i{constructor(e,t){super(e,t,n)}add(e,t){const s=this.get(e.user.id);return s?s.patch(e):super.add(e,t,{id:e.user.id})}resolve(e){const t=super.resolve(e);if(t)return t;const s=this.client.users.resolveID(e);return super.resolve(s)||null}resolveID(e){const t=super.resolveID(e);if(t)return t;const s=this.client.users.resolveID(e);return this.has(s)?s:null}}},function(e,t,s){"use strict";const{Presence:i}=s(12),n=s(3),{ActivityTypes:r,OPCodes:o}=s(0),{TypeError:a}=s(4);e.exports=class ClientPresence extends i{constructor(e,t={}){super(e,Object.assign(t,{status:"online",user:{id:null}}))}async set(e){const t=await this._parse(e);if(this.patch(t),void 0===e.shardID)this.client.ws.broadcast({op:o.STATUS_UPDATE,d:t});else if(Array.isArray(e.shardID))for(const s of e.shardID)this.client.ws.shards.get(s).send({op:o.STATUS_UPDATE,d:t});else this.client.ws.shards.get(e.shardID).send({op:o.STATUS_UPDATE,d:t});return this}async _parse({status:e,since:t,afk:s,activity:i}){const o=i&&(i.application?i.application.id||i.application:null);let l=new n;if(i){if("string"!=typeof i.name)throw new a("INVALID_TYPE","name","string");if(i.type||(i.type=0),i.assets&&o)try{const e=await this.client.api.oauth2.applications(o).assets.get();for(const t of e)l.set(t.name,t.id)}catch(e){}}const h={afk:null!=s&&s,since:null!=t?t:null,status:e||this.status,game:i?{type:i.type,name:i.name,url:i.url,details:i.details||void 0,state:i.state||void 0,assets:i.assets?{large_text:i.assets.largeText||void 0,small_text:i.assets.smallText||void 0,large_image:l.get(i.assets.largeImage)||i.assets.largeImage,small_image:l.get(i.assets.smallImage)||i.assets.smallImage}:void 0,timestamps:i.timestamps||void 0,party:i.party||void 0,application_id:o||void 0,secrets:i.secrets||void 0,instance:i.instance||void 0}:null};return(e||s||t)&&!i&&(h.game=this.activity),h.game&&(h.game.type="number"==typeof h.game.type?h.game.type:r.indexOf(h.game.type)),h}}},function(e,t,s){"use strict";const i=s(5),n=s(15),r=s(13),o=s(25);e.exports=class UserStore extends i{constructor(e,t){super(e,t,n)}resolve(e){return e instanceof r?e.user:e instanceof o?e.author:super.resolve(e)}resolveID(e){return e instanceof r?e.user.id:e instanceof o?e.author.id:super.resolveID(e)}fetch(e,t=!0){const s=this.get(e);return s?Promise.resolve(s):this.client.api.users(e).get().then(e=>this.add(e,t))}}},function(e,t,s){"use strict";const i=s(5),n=s(14),{Events:r}=s(0),o=Symbol("LRU"),a=["dm"];e.exports=class ChannelStore extends i{constructor(e,t={},s){if(s||"function"==typeof t[Symbol.iterator]||(s=t,t=void 0),super(e,t,n),s.lru){const e=this[o]=[];e.add=(t=>{for(e.remove(t),e.unshift(t);e.length>s.lru;)this.remove(e[e.length-1])}),e.remove=(t=>{const s=e.indexOf(t);s>-1&&e.splice(s,1)})}}get(e,t=!1){const s=super.get(e);return s&&a.includes(s.type)?(!t&&this[o]&&this[o].add(e),s):s}set(e,t){return this[o]&&a.includes(t.type)&&this[o].add(e),super.set(e,t)}delete(e){const t=this.get(e,!0);return!!t&&(this[o]&&a.includes(t.type)&&this[o].remove(e),super.delete(e))}add(e,t,s=!0){const i=this.get(e.id);if(i)return i;const o=n.create(this.client,e,t);return o?(s&&this.set(o.id,o),o):(this.client.emit(r.DEBUG,`Failed to find guild for channel ${e.id} ${e.type}`),null)}remove(e){const t=this.get(e);t.guild&&t.guild.channels.remove(e),super.remove(e)}async fetch(e,t=!0,s=!1){const i=this.get(e);if(i&&!s)return i;const n=await this.client.api.channels(e).get();return i&&i._patch(n),this.add(n,null,t)}}},function(e,t,s){"use strict";const i=s(5),n=s(9),{Events:r}=s(0),o=s(42);e.exports=class GuildStore extends i{constructor(e,t){super(e,t,o)}create(e,{region:t,icon:s=null}={}){return!s||"string"==typeof s&&s.startsWith("data:")?new Promise((i,n)=>this.client.api.guilds.post({data:{name:e,region:t,icon:s}}).then(e=>{if(this.client.guilds.has(e.id))return i(this.client.guilds.get(e.id));const t=n=>{n.id===e.id&&(this.client.removeListener(r.GUILD_CREATE,t),this.client.clearTimeout(s),i(n))};this.client.on(r.GUILD_CREATE,t);const s=this.client.setTimeout(()=>{this.client.removeListener(r.GUILD_CREATE,t),i(this.client.guilds.add(e))},1e4)},n)):n.resolveImage(s).then(s=>this.create(e,{region:t,icon:s||null}))}}},function(e,t,s){"use strict";const i=s(2);e.exports={BaseClient:s(30),Client:s(93),Shard:s(177),ShardClientUtil:s(178),ShardingManager:s(179),WebhookClient:s(37),ActivityFlags:s(65),BitField:s(20),Collection:s(3),Constants:s(0),DataResolver:s(9),DataStore:s(5),DiscordAPIError:s(50),HTTPError:s(51),Permissions:s(7),Speaking:s(180),Snowflake:s(8),SnowflakeUtil:s(8),Structures:s(18),Util:i,util:i,version:s(45).version,ChannelStore:s(81),GuildChannelStore:s(77),GuildEmojiStore:s(44),GuildEmojiRoleStore:s(62),GuildMemberStore:s(75),GuildMemberRoleStore:s(66),GuildStore:s(82),ReactionUserStore:s(69),MessageStore:s(24),PresenceStore:s(78),RoleStore:s(76),UserStore:s(80),discordSort:i.discordSort,escapeMarkdown:i.escapeMarkdown,fetchRecommendedShards:i.fetchRecommendedShards,resolveColor:i.resolveColor,resolveString:i.resolveString,splitMessage:i.splitMessage,Base:s(6),Activity:s(12).Activity,APIMessage:s(23),CategoryChannel:s(72),Channel:s(14),ClientApplication:s(38),get ClientUser(){return s(61)},Collector:s(34),DMChannel:s(63),Emoji:s(33),Guild:s(42),GuildAuditLogs:s(74),GuildChannel:s(17),GuildEmoji:s(21),GuildMember:s(13),Integration:s(73),Invite:s(26),Message:s(25),MessageAttachment:s(36),MessageCollector:s(64),MessageEmbed:s(35),MessageMentions:s(67),MessageReaction:s(39),PermissionOverwrites:s(41),Presence:s(12).Presence,ClientPresence:s(79),ReactionCollector:s(68),ReactionEmoji:s(40),RichPresenceAssets:s(12).RichPresenceAssets,Role:s(16),TextChannel:s(70),User:s(15),VoiceChannel:s(71),VoiceRegion:s(43),VoiceState:s(19),Webhook:s(11),WebSocket:s(53)}},function(e,t,s){"use strict";const{register:i}=s(46),n={CLIENT_INVALID_OPTION:(e,t)=>`The ${e} option must be ${t}`,TOKEN_INVALID:"An invalid token was provided.",TOKEN_MISSING:"Request to use token, but token was unavailable to the client.",WS_CLOSE_REQUESTED:"WebSocket closed due to user request.",WS_CONNECTION_TIMEOUT:"The connection to the gateway timed out.",WS_CONNECTION_EXISTS:"There is already an existing WebSocket connection.",WS_NOT_OPEN:(e="data")=>`Websocket not open to send ${e}`,BITFIELD_INVALID:"Invalid bitfield flag or number.",RATELIMIT_INVALID_METHOD:"Unknown rate limiting method.",SHARDING_INVALID:"Invalid shard settings were provided.",SHARDING_REQUIRED:"This session would have handled too many guilds - Sharding is required.",SHARDING_CHILD_CONNECTION:"Failed to send message to shard's process.",SHARDING_PARENT_CONNECTION:"Failed to send message to master process.",SHARDING_NO_SHARDS:"No shards have been spawned.",SHARDING_IN_PROCESS:"Shards are still being spawned.",SHARDING_ALREADY_SPAWNED:e=>`Already spawned ${e} shards.`,SHARDING_PROCESS_EXISTS:e=>`Shard ${e} already has an active process.`,SHARDING_READY_TIMEOUT:e=>`Shard ${e}'s Client took too long to become ready.`,SHARDING_READY_DISCONNECTED:e=>`Shard ${e}'s Client disconnected before becoming ready.`,SHARDING_READY_DIED:e=>`Shard ${e}'s process exited before its Client became ready.`,COLOR_RANGE:"Color must be within the range 0 - 16777215 (0xFFFFFF).",COLOR_CONVERT:"Unable to convert color to a number.",EMBED_FIELD_NAME:"MessageEmbed field names may not be empty.",EMBED_FIELD_VALUE:"MessageEmbed field values may not be empty.",FILE_NOT_FOUND:e=>`File could not be found: ${e}`,USER_NO_DMCHANNEL:"No DM Channel exists!",VOICE_INVALID_HEARTBEAT:"Tried to set voice heartbeat but no valid interval was specified.",VOICE_USER_MISSING:"Couldn't resolve the user to create stream.",VOICE_STREAM_EXISTS:"There is already an existing stream for that user.",VOICE_JOIN_CHANNEL:(e=!1)=>`You do not have permission to join this voice channel${e?"; it is full.":"."}`,VOICE_CONNECTION_TIMEOUT:"Connection not established within 15 seconds.",VOICE_TOKEN_ABSENT:"Token not provided from voice server packet.",VOICE_SESSION_ABSENT:"Session ID not supplied.",VOICE_INVALID_ENDPOINT:"Invalid endpoint received.",VOICE_NO_BROWSER:"Voice connections are not available in browsers.",VOICE_CONNECTION_ATTEMPTS_EXCEEDED:e=>`Too many connection attempts (${e}).`,VOICE_JOIN_SOCKET_CLOSED:"Tried to send join packet, but the WebSocket is not open.",VOICE_PLAY_INTERFACE_NO_BROADCAST:"A broadcast cannot be played in this context.",VOICE_PLAY_INTERFACE_BAD_TYPE:"Unknown stream type",VOICE_PRISM_DEMUXERS_NEED_STREAM:"To play a webm/ogg stream, you need to pass a ReadableStream.",VOICE_STATE_UNCACHED_MEMBER:"The member of this voice state is uncached.",OPUS_ENGINE_MISSING:"Couldn't find an Opus engine.",UDP_SEND_FAIL:"Tried to send a UDP packet, but there is no socket available.",UDP_ADDRESS_MALFORMED:"Malformed UDP address or port.",UDP_CONNECTION_EXISTS:"There is already an existing UDP connection.",REQ_BODY_TYPE:"The response body isn't a Buffer.",REQ_RESOURCE_TYPE:"The resource must be a string, Buffer or a valid file stream.",IMAGE_FORMAT:e=>`Invalid image format: ${e}`,IMAGE_SIZE:e=>`Invalid image size: ${e}`,MESSAGE_MISSING:"Message not found",MESSAGE_BULK_DELETE_TYPE:"The messages must be an Array, Collection, or number.",MESSAGE_NONCE_TYPE:"Message nonce must fit in an unsigned 64-bit integer.",TYPING_COUNT:"Count must be at least 1",SPLIT_MAX_LEN:"Chunk exceeds the max length and contains no split characters.",BAN_RESOLVE_ID:(e=!1)=>`Couldn't resolve the user ID to ${e?"ban":"unban"}.`,PRUNE_DAYS_TYPE:"Days must be a number",SEARCH_CHANNEL_TYPE:"Target must be a TextChannel, DMChannel, or Guild.",GUILD_CHANNEL_RESOLVE:"Could not resolve channel to a guild channel.",GUILD_VOICE_CHANNEL_RESOLVE:"Could not resolve channel to a guild voice channel.",GUILD_CHANNEL_ORPHAN:"Could not find a parent to this guild channel.",GUILD_OWNED:"Guild is owned by the client.",GUILD_RESTRICTED:(e=!1)=>`Guild is ${e?"already":"not"} restricted.`,GUILD_MEMBERS_TIMEOUT:"Members didn't arrive in time.",INVALID_TYPE:(e,t,s=!1)=>`Supplied ${e} is not a${s?"n":""} ${t}.`,WEBHOOK_MESSAGE:"The message was not sent by a webhook.",EMOJI_TYPE:"Emoji must be a string or GuildEmoji/ReactionEmoji",EMOJI_MANAGED:"Emoji is managed and has no Author.",MISSING_MANAGE_EMOJIS_PERMISSION:e=>`Client must have Manage Emoji permission in guild ${e} to see emoji authors.`,REACTION_RESOLVE_USER:"Couldn't resolve the user ID to remove from the reaction.",VANITY_URL:"This guild does not have the VANITY_URL feature enabled."};for(const[e,t]of Object.entries(n))i(e,t)},function(e,t,s){"use strict";const i=s(86),n=s(87),r=s(92),{Error:o}=s(4),{Endpoints:a}=s(0),l=s(3);e.exports=class RESTManager{constructor(e,t="Bot"){this.client=e,this.handlers=new l,this.tokenPrefix=t,this.versioned=!0,this.globalTimeout=null,e.options.restSweepInterval>0&&e.setInterval(()=>{this.handlers.sweep(e=>e._inactive)},1e3*e.options.restSweepInterval)}get api(){return r(this)}getAuth(){const e=this.client.token||this.client.accessToken,t=!!this.client.application||this.client.user;if(e&&t)return`${this.tokenPrefix} ${e}`;if(e)return e;throw new o("TOKEN_MISSING")}get cdn(){return a.CDN(this.client.options.http.cdn)}push(e,t){return new Promise((s,i)=>{e.push({request:t,resolve:s,reject:i,retries:0}).catch(i)})}request(e,t,s={}){const r=new n(this,e,t,s);let o=this.handlers.get(r.route);return o||(o=new i(this),this.handlers.set(r.route,o)),this.push(o,r)}set endpoint(e){this.client.options.http.api=e}}},function(e,t,s){"use strict";const i=s(50),n=s(51),r=s(2),{Events:{RATE_LIMIT:o},browser:a}=s(0);function l(e){return e.headers.get("content-type").startsWith("application/json")?e.json():a?e.blob():e.buffer()}function h(e){return new Date(e).getTime()-Date.now()}e.exports=class RequestHandler{constructor(e){this.manager=e,this.busy=!1,this.queue=[],this.reset=-1,this.remaining=-1,this.limit=-1,this.retryAfter=-1}push(e){return this.busy?(this.queue.push(e),this.run()):this.execute(e)}run(){return 0===this.queue.length?Promise.resolve():this.execute(this.queue.shift())}get limited(){return(this.manager.globalTimeout||this.remaining<=0)&&Date.now()=500&&c.status<600)return e.retries===this.manager.client.options.retryLimit?t(new n(c.statusText,c.constructor.name,c.status,e.request.method,s.path)):(e.retries++,this.queue.unshift(e),this.run());try{const e=await l(c);return c.status>=400&&c.status<500?t(new i(s.path,e,s.method)):null}catch(e){return t(new n(e.message,e.constructor.name,e.status,s.method,s.path))}}}},function(e,t,s){"use strict";const i=s(52),n=s(90),r=s(91),{browser:o,UserAgent:a}=s(0),l=s(28);if(r.Agent)var h=new r.Agent({keepAlive:!0});e.exports=class APIRequest{constructor(e,t,s,n){this.rest=e,this.client=e.client,this.method=t,this.route=n.route,this.options=n;const r=(i.stringify(n.query).match(/[^=&?]+=[^=&?]+/g)||[]).join("&");this.path=`${s}${r?`?${r}`:""}`}make(){const e=(!1===this.options.versioned?this.client.options.http.api:`${this.client.options.http.api}/v${this.client.options.http.version}`)+this.path;let t,s={};if(!1!==this.options.auth&&(s.Authorization=this.rest.getAuth()),this.options.reason&&(s["X-Audit-Log-Reason"]=encodeURIComponent(this.options.reason)),o||(s["User-Agent"]=a),this.options.headers&&(s=Object.assign(s,this.options.headers)),this.options.files){t=new n;for(const e of this.options.files)e&&e.file&&t.append(e.name,e.file,e.name);void 0!==this.options.data&&t.append("payload_json",JSON.stringify(this.options.data)),o||(s=Object.assign(s,t.getHeaders()))}else null!=this.options.data&&(t=JSON.stringify(this.options.data),s["Content-Type"]="application/json");return l(e,{method:this.method,headers:s,agent:h,body:t})}}},function(e,t,s){"use strict";function i(e,t){return Object.prototype.hasOwnProperty.call(e,t)}e.exports=function(e,t,s,r){t=t||"&",s=s||"=";var o={};if("string"!=typeof e||0===e.length)return o;var a=/\+/g;e=e.split(t);var l=1e3;r&&"number"==typeof r.maxKeys&&(l=r.maxKeys);var h=e.length;l>0&&h>l&&(h=l);for(var c=0;c=0?(u=f.substr(0,_),d=f.substr(_+1)):(u=f,d=""),p=decodeURIComponent(u),m=decodeURIComponent(d),i(o,p)?n(o[p])?o[p].push(m):o[p]=[o[p],m]:o[p]=m}return o};var n=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}},function(e,t,s){"use strict";var i=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}};e.exports=function(e,t,s,a){return t=t||"&",s=s||"=",null===e&&(e=void 0),"object"==typeof e?r(o(e),function(o){var a=encodeURIComponent(i(o))+s;return n(e[o])?r(e[o],function(e){return a+encodeURIComponent(i(e))}).join(t):a+encodeURIComponent(i(e[o]))}).join(t):a?encodeURIComponent(i(a))+s+encodeURIComponent(i(e)):""};var n=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)};function r(e,t){if(e.map)return e.map(t);for(var s=[],i=0;i{},n=["get","post","delete","patch","put"],r=["toString","valueOf","inspect","constructor",Symbol.toPrimitive,Symbol.for("util.inspect.custom")];e.exports=function(e){const t=[""],s={get:(o,a)=>r.includes(a)?()=>t.join("/"):n.includes(a)?s=>e.request(a,t.join("/"),Object.assign({versioned:e.versioned,route:t.map((e,s)=>/\d{16,19}/g.test(e)?/channels|guilds/.test(t[s-1])?e:":id":"reactions"===t[s-1]?":reaction":e).join("/")},s)):(t.push(a),new Proxy(i,s)),apply:(e,n,r)=>(t.push(...r.filter(e=>null!=e)),new Proxy(i,s))};return new Proxy(i,s)}},function(module,exports,__webpack_require__){"use strict";(function(process){const BaseClient=__webpack_require__(30),Permissions=__webpack_require__(7),ClientVoiceManager=__webpack_require__(94),WebSocketManager=__webpack_require__(95),ActionsManager=__webpack_require__(146),Collection=__webpack_require__(3),VoiceRegion=__webpack_require__(43),Webhook=__webpack_require__(11),Invite=__webpack_require__(26),ClientApplication=__webpack_require__(38),ShardClientUtil=__webpack_require__(175),VoiceBroadcast=__webpack_require__(176),UserStore=__webpack_require__(80),ChannelStore=__webpack_require__(81),GuildStore=__webpack_require__(82),GuildEmojiStore=__webpack_require__(44),{Events:Events,WSCodes:WSCodes,browser:browser,DefaultOptions:DefaultOptions}=__webpack_require__(0),{delayFor:delayFor}=__webpack_require__(2),DataResolver=__webpack_require__(9),Structures=__webpack_require__(18),{Error:Error,TypeError:TypeError,RangeError:RangeError}=__webpack_require__(4);class Client extends BaseClient{constructor(e={}){super(Object.assign({_tokenType:"Bot"},e));let t=process.env;try{t=__webpack_require__(!function(){var e=new Error("Cannot find module 'worker_threads'");throw e.code="MODULE_NOT_FOUND",e}()).workerData||t}catch(e){}if(this.options.shards===DefaultOptions.shards&&"SHARDS"in t&&(this.options.shards=JSON.parse(t.SHARDS)),this.options.totalShardCount===DefaultOptions.totalShardCount&&("TOTAL_SHARD_COUNT"in t?this.options.totalShardCount=Number(t.TOTAL_SHARD_COUNT):Array.isArray(this.options.shards)?this.options.totalShardCount=this.options.shards.length:this.options.totalShardCount=this.options.shardCount),void 0===this.options.shards&&this.options.shardCount){this.options.shards=[];for(let e=0;e0&&this.setInterval(this.sweepMessages.bind(this),1e3*this.options.messageSweepInterval)}get voiceConnections(){return browser?new Collection:this.voice.connections}get emojis(){const e=new GuildEmojiStore({client:this});for(const t of this.guilds.values())if(t.available)for(const s of t.emojis.values())e.set(s.id,s);return e}get readyTimestamp(){return this.readyAt?this.readyAt.getTime():null}get uptime(){return this.readyAt?Date.now()-this.readyAt:null}createVoiceBroadcast(){const e=new VoiceBroadcast(this);return this.broadcasts.push(e),e}async login(e=this.token){if(!e||"string"!=typeof e)throw new Error("TOKEN_INVALID");this.token=e=e.replace(/^(Bot|Bearer)\s*/i,""),this.emit(Events.DEBUG,`Authenticating using token ${e}`);let t=this.api.gateway;"auto"===this.options.shardCount&&(t=t.bot);const s=await t.get();if(this.options.presence&&(this.options.ws.presence=await this.presence._parse(this.options.presence)),s.session_start_limit&&0===s.session_start_limit.remaining){const{session_start_limit:{reset_after:e}}=s;this.emit(Events.DEBUG,`Exceeded identify threshold, setting a timeout for ${e} ms`),await delayFor(e)}const i=`${s.url}/`;if("auto"===this.options.shardCount&&(this.emit(Events.DEBUG,`Using recommended shard count ${s.shards}`),this.options.shardCount=s.shards,this.options.totalShardCount=s.shards,void 0===this.options.shards||!this.options.shards.length)){this.options.shards=[];for(let e=0;e{const s=()=>{clearTimeout(n),this.removeListener(Events.DISCONNECT,i),e()},i=e=>{clearTimeout(n),this.removeListener(Events.READY,s),this.destroy(),WSCodes[e.code]&&t(new Error(WSCodes[e.code]))},n=setTimeout(()=>{this.removeListener(Events.READY,s),this.removeListener(Events.DISCONNECT,i),this.destroy(),t(new Error("WS_CONNECTION_TIMEOUT"))},25e3*this.options.shardCount);void 0!==n.unref&&n.unref(),this.once(Events.READY,s),this.once(Events.DISCONNECT,i)}),e}destroy(){super.destroy(),this.ws.destroy(),this.token=null}fetchInvite(e){const t=DataResolver.resolveInviteCode(e);return this.api.invites(t).get({query:{with_counts:!0}}).then(e=>new Invite(this,e))}fetchWebhook(e,t){return this.api.webhooks(e,t).get().then(e=>new Webhook(this,e))}fetchVoiceRegions(){return this.api.voice.regions.get().then(e=>{const t=new Collection;for(const s of e)t.set(s.id,new VoiceRegion(s));return t})}sweepMessages(e=this.options.messageCacheLifetime){if("number"!=typeof e||isNaN(e))throw new TypeError("CLIENT_INVALID_OPTION","Lifetime","a number");if(e<=0)return this.emit(Events.DEBUG,"Didn't sweep messages - lifetime is unlimited"),-1;const t=1e3*e,s=Date.now();let i=0,n=0;for(const e of this.channels.values())e.messages&&(i++,n+=e.messages.sweep(e=>s-(e.editedTimestamp||e.createdTimestamp)>t));return this.emit(Events.DEBUG,`Swept ${n} messages older than ${e} seconds in ${i} text-based channels`),n}fetchApplication(){return this.api.oauth2.applications("@me").get().then(e=>new ClientApplication(this,e))}generateInvite(e){return e=Permissions.resolve(e),this.fetchApplication().then(t=>`https://discordapp.com/oauth2/authorize?client_id=${t.id}&permissions=${e}&scope=bot`)}toJSON(){return super.toJSON({readyAt:!1,broadcasts:!1,presences:!1})}_eval(script){return eval(script)}_validateOptions(e=this.options){if("auto"!==e.shardCount&&("number"!=typeof e.shardCount||isNaN(e.shardCount)))throw new TypeError("CLIENT_INVALID_OPTION","shardCount",'a number or "auto"');if(e.shards&&"number"!=typeof e.shards&&!Array.isArray(e.shards))throw new TypeError("CLIENT_INVALID_OPTION","shards","a number or array");if(e.shardCount<1)throw new RangeError("CLIENT_INVALID_OPTION","shardCount","at least 1");if("number"!=typeof e.messageCacheMaxSize||isNaN(e.messageCacheMaxSize))throw new TypeError("CLIENT_INVALID_OPTION","messageCacheMaxSize","a number");if("number"!=typeof e.messageCacheLifetime||isNaN(e.messageCacheLifetime))throw new TypeError("CLIENT_INVALID_OPTION","The messageCacheLifetime","a number");if("number"!=typeof e.messageSweepInterval||isNaN(e.messageSweepInterval))throw new TypeError("CLIENT_INVALID_OPTION","messageSweepInterval","a number");if("boolean"!=typeof e.fetchAllMembers)throw new TypeError("CLIENT_INVALID_OPTION","fetchAllMembers","a boolean");if("boolean"!=typeof e.disableEveryone)throw new TypeError("CLIENT_INVALID_OPTION","disableEveryone","a boolean");if("boolean"!=typeof e.partials)throw new TypeError("CLIENT_INVALID_OPTION","partials","a boolean");if("number"!=typeof e.restWsBridgeTimeout||isNaN(e.restWsBridgeTimeout))throw new TypeError("CLIENT_INVALID_OPTION","restWsBridgeTimeout","a number");if("number"!=typeof e.restSweepInterval||isNaN(e.restSweepInterval))throw new TypeError("CLIENT_INVALID_OPTION","restSweepInterval","a number");if(!(e.disabledEvents instanceof Array))throw new TypeError("CLIENT_INVALID_OPTION","disabledEvents","an Array");if("number"!=typeof e.retryLimit||isNaN(e.retryLimit))throw new TypeError("CLIENT_INVALID_OPTION","retryLimit","a number")}}module.exports=Client}).call(this,__webpack_require__(27))},function(e,t){},function(e,t,s){"use strict";const i=s(3),n=s(96),{Events:r,Status:o,WSEvents:a}=s(0),l=s(60),h=[a.READY,a.RESUMED,a.GUILD_CREATE,a.GUILD_DELETE,a.GUILD_MEMBERS_CHUNK,a.GUILD_MEMBER_ADD,a.GUILD_MEMBER_REMOVE];e.exports=class WebSocketManager{constructor(e){Object.defineProperty(this,"client",{value:e}),this.gateway=void 0,this.shards=new i,this.spawnQueue=[],this.spawning=!1,this.packetQueue=[],this.status=o.IDLE,this.sessionStartLimit=null}get ping(){return this.shards.reduce((e,t)=>e+t.ping,0)/this.shards.size}debug(e){this.client.emit(r.DEBUG,`[connection] ${e}`)}async _handleSessionLimit(e){this.sessionStartLimit=await this.client.api.gateway.bot.get().then(e=>e.session_start_limit);const{remaining:t,reset_after:s}=this.sessionStartLimit;0!==t?this.spawn():(e.debug(`Exceeded identify threshold, setting a timeout for ${s} ms`),setTimeout(()=>this.spawn(),this.sessionStartLimit.reset_after))}spawn(e){if(void 0!==e)if(Array.isArray(e))for(const t of e)this.spawnQueue.includes(t)||this.spawnQueue.push(t);else this.spawnQueue.includes(e)||this.spawnQueue.push(e);if(this.spawning||!this.spawnQueue.length)return;this.spawning=!0;let t=this.spawnQueue.shift();if("string"!=typeof t||isNaN(t)||(t=Number(t)),"number"==typeof t){const e=new n(this,t,this.shards.get(t));this.shards.set(t,e),e.once(r.READY,()=>{this.spawning=!1,this.client.setTimeout(()=>this._handleSessionLimit(e),5e3)}),e.once(r.INVALIDATED,()=>{this.spawning=!1})}else t instanceof n&&t.reconnect()}connect(e=this.gateway){if(this.gateway=e,"number"==typeof this.client.options.shards)this.debug("Spawning 1 shard"),this.spawn(this.client.options.shards);else if(Array.isArray(this.client.options.shards)){this.debug(`Spawning ${this.client.options.shards.length} shards`);for(const e of this.client.options.shards)this.spawn(e)}else{this.debug(`Spawning ${this.client.options.shardCount} shards`);for(let e=0;e{this.handlePacket(e.packet,this.shards.get(e.shardID))})}return e&&!this.client.options.disabledEvents.includes(e.t)&&l[e.t]&&l[e.t](this.client,e,t),!1}checkReady(){if(this.shards.size!==this.client.options.shardCount||this.shards.some(e=>e&&e.status!==o.READY))return!1;let e=0;for(const t of this.client.guilds.values())t.available||e++;if(0===e){if(this.status=o.NEARLY,!this.client.options.fetchAllMembers)return this.triggerReady();const e=this.client.guilds.map(e=>e.members.fetch());Promise.all(e).then(()=>this.triggerReady()).catch(e=>{this.debug(`Failed to fetch all members before ready! ${e}`),this.triggerReady()})}return!0}triggerReady(){this.status!==o.READY?(this.status=o.READY,this.client.emit(r.READY),this.handlePacket()):this.debug("Tried to mark self as ready, but already ready")}broadcast(e){for(const t of this.shards.values())t.send(e)}destroy(){this.gateway=void 0,this.spawning=!0;for(const e of this.shards.values())e.destroy()}}},function(e,t,s){"use strict";const i=s(31),n=s(53),{Status:r,Events:o,OPCodes:a,WSEvents:l,WSCodes:h}=s(0),c=s(2);let u;try{(u=s(100)).Inflate||(u=s(54))}catch(e){u=s(54)}e.exports=class WebSocketShard extends i{constructor(e,t,s){super(),this.manager=e,this.id=t,this.status=r.IDLE,this.sequence=s?s.sequence:-1,this.closeSequence=s?s.closeSequence:0,this.sessionID=s&&s.sessionID,this.pings=[],this.lastPingTimestamp=-1,this.trace=[],this.ratelimit={queue:[],total:120,remaining:120,time:6e4,timer:null},this.ws=null,this.inflate=null,this.expectingClose=!1,this.connect()}get ping(){return this.pings.reduce((e,t)=>e+t,0)/this.pings.length}debug(e){this.manager.debug(`[shard ${this.id}] ${e}`)}heartbeat(e){isNaN(e)?(this.debug("Sending a heartbeat"),this.lastPingTimestamp=Date.now(),this.send({op:a.HEARTBEAT,d:this.sequence})):-1===e?(this.debug("Clearing heartbeat interval"),this.manager.client.clearInterval(this.heartbeatInterval),this.heartbeatInterval=null):(this.debug(`Setting a heartbeat interval for ${e}ms`),this.heartbeatInterval&&this.manager.client.clearInterval(this.heartbeatInterval),this.heartbeatInterval=this.manager.client.setInterval(()=>this.heartbeat(),e))}ackHeartbeat(){const e=Date.now()-this.lastPingTimestamp;this.debug(`Heartbeat acknowledged, latency of ${e}ms`),this.pings.unshift(e),this.pings.length>3&&(this.pings.length=3)}connect(){this.inflate=new u.Inflate({chunkSize:65535,flush:u.Z_SYNC_FLUSH,to:"json"===n.encoding?"string":""});const e=this.manager.gateway;this.debug(`Connecting to ${e}`);const t=this.ws=n.create(e,{v:this.manager.client.options.ws.version,compress:"zlib-stream"});t.onopen=this.onOpen.bind(this),t.onmessage=this.onMessage.bind(this),t.onerror=this.onError.bind(this),t.onclose=this.onClose.bind(this),this.status=r.CONNECTING}onPacket(e){if(!e)return this.debug("Received null packet"),!1;switch(e.t){case l.READY:this.sessionID=e.d.session_id,this.trace=e.d._trace,this.status=r.READY,this.debug(`READY ${this.trace.join(" -> ")} ${this.sessionID}`),this.heartbeat();break;case l.RESUMED:{this.trace=e.d._trace,this.status=r.READY;const t=e.s-this.closeSequence;this.debug(`RESUMED ${this.trace.join(" -> ")} | replayed ${t} events.`),this.heartbeat();break}}switch(e.s>this.sequence&&(this.sequence=e.s),e.op){case a.HELLO:return this.identify(),this.heartbeat(e.d.heartbeat_interval);case a.RECONNECT:return this.reconnect();case a.INVALID_SESSION:return this.sequence=-1,this.debug("Session invalidated"),e.d?this.identify():this.sessionID?(this.sessionID=null,this.identify(2500)):this.identify(5e3);case a.HEARTBEAT_ACK:return this.ackHeartbeat();case a.HEARTBEAT:return this.heartbeat();default:return this.manager.handlePacket(e,this)}}onOpen(){this.debug("Connection open")}onMessage({data:e}){e instanceof ArrayBuffer&&(e=new Uint8Array(e));const t=e.length,s=t>=4&&0===e[t-4]&&0===e[t-3]&&255===e[t-2]&&255===e[t-1];if(this.inflate.push(e,s&&u.Z_SYNC_FLUSH),!s)return;let i;try{i=n.unpack(this.inflate.result),this.manager.client.emit(o.RAW,i,this.id)}catch(e){return void this.manager.client.emit(o.ERROR,e)}i.t===l.READY&&(this.emit(o.READY),this.manager.client.emit(o.SHARD_READY,this.id)),this.onPacket(i)}onError(e){e&&"uWs client connection error"===e.message?this.reconnect():(this.emit(o.INVALIDATED),this.manager.client.emit(o.ERROR,e))}onClose(e){if(this.closeSequence=this.sequence,this.emit("close",e),1e3===e.code?this.expectingClose:h[e.code])return this.manager.client.emit(o.DISCONNECT,e,this.id),this.debug(h[e.code]),void this.heartbeat(-1);this.expectingClose=!1,this.reconnect(o.INVALIDATED,5100)}identify(e=0){return e?this.manager.client.setTimeout(this.identify.bind(this),e):this.sessionID?this.identifyResume():this.identifyNew()}identifyNew(){if(!this.manager.client.token)return void this.debug("No token available to identify a new session with");const e=Object.assign({token:this.manager.client.token},this.manager.client.options.ws),{totalShardCount:t}=this.manager.client.options;e.shard=[this.id,Number(t)],this.debug("Identifying as a new session"),this.send({op:a.IDENTIFY,d:e})}identifyResume(){if(!this.sessionID)return this.debug("Warning: wanted to resume but session ID not available; identifying as a new session instead"),this.identifyNew();this.debug(`Attempting to resume session ${this.sessionID}`);const e={token:this.manager.client.token,session_id:this.sessionID,seq:this.sequence};return this.send({op:a.RESUME,d:e})}send(e){this.ratelimit.queue.push(e),this.processQueue()}_send(e){this.ws&&this.ws.readyState===n.OPEN?this.ws.send(n.pack(e),e=>{e&&this.manager.client.emit(o.ERROR,e)}):this.debug(`Tried to send packet ${e} but no WebSocket is available!`)}processQueue(){if(0!==this.ratelimit.remaining&&0!==this.ratelimit.queue.length)for(this.ratelimit.remaining===this.ratelimit.total&&(this.ratelimit.timer=this.manager.client.setTimeout(()=>{this.ratelimit.remaining=this.ratelimit.total,this.processQueue()},this.ratelimit.time));this.ratelimit.remaining>0;){const e=this.ratelimit.queue.shift();if(!e)return;this._send(e),this.ratelimit.remaining--}}async reconnect(e,t){this.heartbeat(-1),this.status=r.RECONNECTING,this.manager.client.emit(o.RECONNECTING,this.id),e===o.INVALIDATED&&this.emit(e),this.debug(t?`Reconnecting in ${t}ms`:"Reconnecting now"),t&&await c.delayFor(t),this.manager.spawn(this.id)}destroy(){this.heartbeat(-1),this.expectingClose=!0,this.ws&&this.ws.close(1e3),this.ws=null,this.status=r.DISCONNECTED,this.ratelimit.remaining=this.ratelimit.total,this.ratelimit.timer&&(this.manager.client.clearTimeout(this.ratelimit.timer),this.ratelimit.timer=null)}}},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t,s){"use strict";var i=s(102),n=s(10),r=s(57),o=s(32),a=s(58),l=Object.prototype.toString,h=0,c=-1,u=0,d=8;function p(e){if(!(this instanceof p))return new p(e);this.options=n.assign({level:c,method:d,chunkSize:16384,windowBits:15,memLevel:8,strategy:u,to:""},e||{});var t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new a,this.strm.avail_out=0;var s=i.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(s!==h)throw new Error(o[s]);if(t.header&&i.deflateSetHeader(this.strm,t.header),t.dictionary){var m;if(m="string"==typeof t.dictionary?r.string2buf(t.dictionary):"[object ArrayBuffer]"===l.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,(s=i.deflateSetDictionary(this.strm,m))!==h)throw new Error(o[s]);this._dict_set=!0}}function m(e,t){var s=new p(t);if(s.push(e,!0),s.err)throw s.msg||o[s.err];return s.result}p.prototype.push=function(e,t){var s,o,a=this.strm,c=this.options.chunkSize;if(this.ended)return!1;o=t===~~t?t:!0===t?4:0,"string"==typeof e?a.input=r.string2buf(e):"[object ArrayBuffer]"===l.call(e)?a.input=new Uint8Array(e):a.input=e,a.next_in=0,a.avail_in=a.input.length;do{if(0===a.avail_out&&(a.output=new n.Buf8(c),a.next_out=0,a.avail_out=c),1!==(s=i.deflate(a,o))&&s!==h)return this.onEnd(s),this.ended=!0,!1;0!==a.avail_out&&(0!==a.avail_in||4!==o&&2!==o)||("string"===this.options.to?this.onData(r.buf2binstring(n.shrinkBuf(a.output,a.next_out))):this.onData(n.shrinkBuf(a.output,a.next_out)))}while((a.avail_in>0||0===a.avail_out)&&1!==s);return 4===o?(s=i.deflateEnd(this.strm),this.onEnd(s),this.ended=!0,s===h):2!==o||(this.onEnd(h),a.avail_out=0,!0)},p.prototype.onData=function(e){this.chunks.push(e)},p.prototype.onEnd=function(e){e===h&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=n.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},t.Deflate=p,t.deflate=m,t.deflateRaw=function(e,t){return(t=t||{}).raw=!0,m(e,t)},t.gzip=function(e,t){return(t=t||{}).gzip=!0,m(e,t)}},function(e,t,s){"use strict";var i,n=s(10),r=s(103),o=s(55),a=s(56),l=s(32),h=0,c=1,u=3,d=4,p=5,m=0,f=1,_=-2,g=-3,E=-5,v=-1,b=1,w=2,y=3,A=4,I=0,T=2,S=8,D=9,N=15,C=8,O=286,R=30,L=19,M=2*O+1,k=15,x=3,U=258,P=U+x+1,G=32,j=42,B=69,z=73,V=91,H=103,$=113,F=666,W=1,K=2,Y=3,q=4,J=3;function Z(e,t){return e.msg=l[t],t}function Q(e){return(e<<1)-(e>4?9:0)}function X(e){for(var t=e.length;--t>=0;)e[t]=0}function ee(e){var t=e.state,s=t.pending;s>e.avail_out&&(s=e.avail_out),0!==s&&(n.arraySet(e.output,t.pending_buf,t.pending_out,s,e.next_out),e.next_out+=s,t.pending_out+=s,e.total_out+=s,e.avail_out-=s,t.pending-=s,0===t.pending&&(t.pending_out=0))}function te(e,t){r._tr_flush_block(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,ee(e.strm)}function se(e,t){e.pending_buf[e.pending++]=t}function ie(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function ne(e,t){var s,i,n=e.max_chain_length,r=e.strstart,o=e.prev_length,a=e.nice_match,l=e.strstart>e.w_size-P?e.strstart-(e.w_size-P):0,h=e.window,c=e.w_mask,u=e.prev,d=e.strstart+U,p=h[r+o-1],m=h[r+o];e.prev_length>=e.good_match&&(n>>=2),a>e.lookahead&&(a=e.lookahead);do{if(h[(s=t)+o]===m&&h[s+o-1]===p&&h[s]===h[r]&&h[++s]===h[r+1]){r+=2,s++;do{}while(h[++r]===h[++s]&&h[++r]===h[++s]&&h[++r]===h[++s]&&h[++r]===h[++s]&&h[++r]===h[++s]&&h[++r]===h[++s]&&h[++r]===h[++s]&&h[++r]===h[++s]&&ro){if(e.match_start=t,o=i,i>=a)break;p=h[r+o-1],m=h[r+o]}}}while((t=u[t&c])>l&&0!=--n);return o<=e.lookahead?o:e.lookahead}function re(e){var t,s,i,r,l,h,c,u,d,p,m=e.w_size;do{if(r=e.window_size-e.lookahead-e.strstart,e.strstart>=m+(m-P)){n.arraySet(e.window,e.window,m,m,0),e.match_start-=m,e.strstart-=m,e.block_start-=m,t=s=e.hash_size;do{i=e.head[--t],e.head[t]=i>=m?i-m:0}while(--s);t=s=m;do{i=e.prev[--t],e.prev[t]=i>=m?i-m:0}while(--s);r+=m}if(0===e.strm.avail_in)break;if(h=e.strm,c=e.window,u=e.strstart+e.lookahead,d=r,p=void 0,(p=h.avail_in)>d&&(p=d),s=0===p?0:(h.avail_in-=p,n.arraySet(c,h.input,h.next_in,p,u),1===h.state.wrap?h.adler=o(h.adler,c,p,u):2===h.state.wrap&&(h.adler=a(h.adler,c,p,u)),h.next_in+=p,h.total_in+=p,p),e.lookahead+=s,e.lookahead+e.insert>=x)for(l=e.strstart-e.insert,e.ins_h=e.window[l],e.ins_h=(e.ins_h<=x&&(e.ins_h=(e.ins_h<=x)if(i=r._tr_tally(e,e.strstart-e.match_start,e.match_length-x),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=x){e.match_length--;do{e.strstart++,e.ins_h=(e.ins_h<=x&&(e.ins_h=(e.ins_h<4096)&&(e.match_length=x-1)),e.prev_length>=x&&e.match_length<=e.prev_length){n=e.strstart+e.lookahead-x,i=r._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-x),e.lookahead-=e.prev_length-1,e.prev_length-=2;do{++e.strstart<=n&&(e.ins_h=(e.ins_h<15&&(a=2,i-=16),r<1||r>D||s!==S||i<8||i>15||t<0||t>9||o<0||o>A)return Z(e,_);8===i&&(i=9);var l=new he;return e.state=l,l.strm=e,l.wrap=a,l.gzhead=null,l.w_bits=i,l.w_size=1<e.pending_buf_size-5&&(s=e.pending_buf_size-5);;){if(e.lookahead<=1){if(re(e),0===e.lookahead&&t===h)return W;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var i=e.block_start+s;if((0===e.strstart||e.strstart>=i)&&(e.lookahead=e.strstart-i,e.strstart=i,te(e,!1),0===e.strm.avail_out))return W;if(e.strstart-e.block_start>=e.w_size-P&&(te(e,!1),0===e.strm.avail_out))return W}return e.insert=0,t===d?(te(e,!0),0===e.strm.avail_out?Y:q):(e.strstart>e.block_start&&(te(e,!1),e.strm.avail_out),W)}),new le(4,4,8,4,oe),new le(4,5,16,8,oe),new le(4,6,32,32,oe),new le(4,4,16,16,ae),new le(8,16,32,32,ae),new le(8,16,128,128,ae),new le(8,32,128,256,ae),new le(32,128,258,1024,ae),new le(32,258,258,4096,ae)],t.deflateInit=function(e,t){return de(e,t,S,N,C,I)},t.deflateInit2=de,t.deflateReset=ue,t.deflateResetKeep=ce,t.deflateSetHeader=function(e,t){return e&&e.state?2!==e.state.wrap?_:(e.state.gzhead=t,m):_},t.deflate=function(e,t){var s,n,o,l;if(!e||!e.state||t>p||t<0)return e?Z(e,_):_;if(n=e.state,!e.output||!e.input&&0!==e.avail_in||n.status===F&&t!==d)return Z(e,0===e.avail_out?E:_);if(n.strm=e,s=n.last_flush,n.last_flush=t,n.status===j)if(2===n.wrap)e.adler=0,se(n,31),se(n,139),se(n,8),n.gzhead?(se(n,(n.gzhead.text?1:0)+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),se(n,255&n.gzhead.time),se(n,n.gzhead.time>>8&255),se(n,n.gzhead.time>>16&255),se(n,n.gzhead.time>>24&255),se(n,9===n.level?2:n.strategy>=w||n.level<2?4:0),se(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(se(n,255&n.gzhead.extra.length),se(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=a(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=B):(se(n,0),se(n,0),se(n,0),se(n,0),se(n,0),se(n,9===n.level?2:n.strategy>=w||n.level<2?4:0),se(n,J),n.status=$);else{var g=S+(n.w_bits-8<<4)<<8;g|=(n.strategy>=w||n.level<2?0:n.level<6?1:6===n.level?2:3)<<6,0!==n.strstart&&(g|=G),g+=31-g%31,n.status=$,ie(n,g),0!==n.strstart&&(ie(n,e.adler>>>16),ie(n,65535&e.adler)),e.adler=1}if(n.status===B)if(n.gzhead.extra){for(o=n.pending;n.gzindex<(65535&n.gzhead.extra.length)&&(n.pending!==n.pending_buf_size||(n.gzhead.hcrc&&n.pending>o&&(e.adler=a(e.adler,n.pending_buf,n.pending-o,o)),ee(e),o=n.pending,n.pending!==n.pending_buf_size));)se(n,255&n.gzhead.extra[n.gzindex]),n.gzindex++;n.gzhead.hcrc&&n.pending>o&&(e.adler=a(e.adler,n.pending_buf,n.pending-o,o)),n.gzindex===n.gzhead.extra.length&&(n.gzindex=0,n.status=z)}else n.status=z;if(n.status===z)if(n.gzhead.name){o=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>o&&(e.adler=a(e.adler,n.pending_buf,n.pending-o,o)),ee(e),o=n.pending,n.pending===n.pending_buf_size)){l=1;break}l=n.gzindexo&&(e.adler=a(e.adler,n.pending_buf,n.pending-o,o)),0===l&&(n.gzindex=0,n.status=V)}else n.status=V;if(n.status===V)if(n.gzhead.comment){o=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>o&&(e.adler=a(e.adler,n.pending_buf,n.pending-o,o)),ee(e),o=n.pending,n.pending===n.pending_buf_size)){l=1;break}l=n.gzindexo&&(e.adler=a(e.adler,n.pending_buf,n.pending-o,o)),0===l&&(n.status=H)}else n.status=H;if(n.status===H&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&ee(e),n.pending+2<=n.pending_buf_size&&(se(n,255&e.adler),se(n,e.adler>>8&255),e.adler=0,n.status=$)):n.status=$),0!==n.pending){if(ee(e),0===e.avail_out)return n.last_flush=-1,m}else if(0===e.avail_in&&Q(t)<=Q(s)&&t!==d)return Z(e,E);if(n.status===F&&0!==e.avail_in)return Z(e,E);if(0!==e.avail_in||0!==n.lookahead||t!==h&&n.status!==F){var v=n.strategy===w?function(e,t){for(var s;;){if(0===e.lookahead&&(re(e),0===e.lookahead)){if(t===h)return W;break}if(e.match_length=0,s=r._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,s&&(te(e,!1),0===e.strm.avail_out))return W}return e.insert=0,t===d?(te(e,!0),0===e.strm.avail_out?Y:q):e.last_lit&&(te(e,!1),0===e.strm.avail_out)?W:K}(n,t):n.strategy===y?function(e,t){for(var s,i,n,o,a=e.window;;){if(e.lookahead<=U){if(re(e),e.lookahead<=U&&t===h)return W;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=x&&e.strstart>0&&(i=a[n=e.strstart-1])===a[++n]&&i===a[++n]&&i===a[++n]){o=e.strstart+U;do{}while(i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&ne.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=x?(s=r._tr_tally(e,1,e.match_length-x),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(s=r._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),s&&(te(e,!1),0===e.strm.avail_out))return W}return e.insert=0,t===d?(te(e,!0),0===e.strm.avail_out?Y:q):e.last_lit&&(te(e,!1),0===e.strm.avail_out)?W:K}(n,t):i[n.level].func(n,t);if(v!==Y&&v!==q||(n.status=F),v===W||v===Y)return 0===e.avail_out&&(n.last_flush=-1),m;if(v===K&&(t===c?r._tr_align(n):t!==p&&(r._tr_stored_block(n,0,0,!1),t===u&&(X(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),ee(e),0===e.avail_out))return n.last_flush=-1,m}return t!==d?m:n.wrap<=0?f:(2===n.wrap?(se(n,255&e.adler),se(n,e.adler>>8&255),se(n,e.adler>>16&255),se(n,e.adler>>24&255),se(n,255&e.total_in),se(n,e.total_in>>8&255),se(n,e.total_in>>16&255),se(n,e.total_in>>24&255)):(ie(n,e.adler>>>16),ie(n,65535&e.adler)),ee(e),n.wrap>0&&(n.wrap=-n.wrap),0!==n.pending?m:f)},t.deflateEnd=function(e){var t;return e&&e.state?(t=e.state.status)!==j&&t!==B&&t!==z&&t!==V&&t!==H&&t!==$&&t!==F?Z(e,_):(e.state=null,t===$?Z(e,g):m):_},t.deflateSetDictionary=function(e,t){var s,i,r,a,l,h,c,u,d=t.length;if(!e||!e.state)return _;if(2===(a=(s=e.state).wrap)||1===a&&s.status!==j||s.lookahead)return _;for(1===a&&(e.adler=o(e.adler,t,d,0)),s.wrap=0,d>=s.w_size&&(0===a&&(X(s.head),s.strstart=0,s.block_start=0,s.insert=0),u=new n.Buf8(s.w_size),n.arraySet(u,t,d-s.w_size,s.w_size,0),t=u,d=s.w_size),l=e.avail_in,h=e.next_in,c=e.input,e.avail_in=d,e.next_in=0,e.input=t,re(s);s.lookahead>=x;){i=s.strstart,r=s.lookahead-(x-1);do{s.ins_h=(s.ins_h<=0;)e[t]=0}var h=0,c=1,u=2,d=29,p=256,m=p+1+d,f=30,_=19,g=2*m+1,E=15,v=16,b=7,w=256,y=16,A=17,I=18,T=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],S=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],D=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],N=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],C=new Array(2*(m+2));l(C);var O=new Array(2*f);l(O);var R=new Array(512);l(R);var L=new Array(256);l(L);var M=new Array(d);l(M);var k,x,U,P=new Array(f);function G(e,t,s,i,n){this.static_tree=e,this.extra_bits=t,this.extra_base=s,this.elems=i,this.max_length=n,this.has_stree=e&&e.length}function j(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function B(e){return e<256?R[e]:R[256+(e>>>7)]}function z(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function V(e,t,s){e.bi_valid>v-s?(e.bi_buf|=t<>v-e.bi_valid,e.bi_valid+=s-v):(e.bi_buf|=t<>>=1,s<<=1}while(--t>0);return s>>>1}function F(e,t,s){var i,n,r=new Array(E+1),o=0;for(i=1;i<=E;i++)r[i]=o=o+s[i-1]<<1;for(n=0;n<=t;n++){var a=e[2*n+1];0!==a&&(e[2*n]=$(r[a]++,a))}}function W(e){var t;for(t=0;t8?z(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0}function Y(e,t,s,i){var n=2*t,r=2*s;return e[n]>1;s>=1;s--)q(e,r,s);n=l;do{s=e.heap[1],e.heap[1]=e.heap[e.heap_len--],q(e,r,1),i=e.heap[1],e.heap[--e.heap_max]=s,e.heap[--e.heap_max]=i,r[2*n]=r[2*s]+r[2*i],e.depth[n]=(e.depth[s]>=e.depth[i]?e.depth[s]:e.depth[i])+1,r[2*s+1]=r[2*i+1]=n,e.heap[1]=n++,q(e,r,1)}while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],function(e,t){var s,i,n,r,o,a,l=t.dyn_tree,h=t.max_code,c=t.stat_desc.static_tree,u=t.stat_desc.has_stree,d=t.stat_desc.extra_bits,p=t.stat_desc.extra_base,m=t.stat_desc.max_length,f=0;for(r=0;r<=E;r++)e.bl_count[r]=0;for(l[2*e.heap[e.heap_max]+1]=0,s=e.heap_max+1;sm&&(r=m,f++),l[2*i+1]=r,i>h||(e.bl_count[r]++,o=0,i>=p&&(o=d[i-p]),a=l[2*i],e.opt_len+=a*(r+o),u&&(e.static_len+=a*(c[2*i+1]+o)));if(0!==f){do{for(r=m-1;0===e.bl_count[r];)r--;e.bl_count[r]--,e.bl_count[r+1]+=2,e.bl_count[m]--,f-=2}while(f>0);for(r=m;0!==r;r--)for(i=e.bl_count[r];0!==i;)(n=e.heap[--s])>h||(l[2*n+1]!==r&&(e.opt_len+=(r-l[2*n+1])*l[2*n],l[2*n+1]=r),i--)}}(e,t),F(r,h,e.bl_count)}function Q(e,t,s){var i,n,r=-1,o=t[1],a=0,l=7,h=4;for(0===o&&(l=138,h=3),t[2*(s+1)+1]=65535,i=0;i<=s;i++)n=o,o=t[2*(i+1)+1],++a>=7;i0?(e.strm.data_type===a&&(e.strm.data_type=function(e){var t,s=4093624447;for(t=0;t<=31;t++,s>>>=1)if(1&s&&0!==e.dyn_ltree[2*t])return r;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return o;for(t=32;t=3&&0===e.bl_tree[2*N[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t}(e),l=e.opt_len+3+7>>>3,(h=e.static_len+3+7>>>3)<=l&&(l=h)):l=h=s+5,s+4<=l&&-1!==t?te(e,t,s,i):e.strategy===n||h===l?(V(e,(c<<1)+(i?1:0),3),J(e,C,O)):(V(e,(u<<1)+(i?1:0),3),function(e,t,s,i){var n;for(V(e,t-257,5),V(e,s-1,5),V(e,i-4,4),n=0;n>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&s,e.last_lit++,0===t?e.dyn_ltree[2*s]++:(e.matches++,t--,e.dyn_ltree[2*(L[s]+p+1)]++,e.dyn_dtree[2*B(t)]++),e.last_lit===e.lit_bufsize-1},t._tr_align=function(e){V(e,c<<1,3),H(e,w,C),function(e){16===e.bi_valid?(z(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}(e)}},function(e,t,s){"use strict";var i=s(105),n=s(10),r=s(57),o=s(59),a=s(32),l=s(58),h=s(108),c=Object.prototype.toString;function u(e){if(!(this instanceof u))return new u(e);this.options=n.assign({chunkSize:16384,windowBits:0,to:""},e||{});var t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(t.windowBits>=0&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&0==(15&t.windowBits)&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new l,this.strm.avail_out=0;var s=i.inflateInit2(this.strm,t.windowBits);if(s!==o.Z_OK)throw new Error(a[s]);if(this.header=new h,i.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=r.string2buf(t.dictionary):"[object ArrayBuffer]"===c.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(s=i.inflateSetDictionary(this.strm,t.dictionary))!==o.Z_OK))throw new Error(a[s])}function d(e,t){var s=new u(t);if(s.push(e,!0),s.err)throw s.msg||a[s.err];return s.result}u.prototype.push=function(e,t){var s,a,l,h,u,d=this.strm,p=this.options.chunkSize,m=this.options.dictionary,f=!1;if(this.ended)return!1;a=t===~~t?t:!0===t?o.Z_FINISH:o.Z_NO_FLUSH,"string"==typeof e?d.input=r.binstring2buf(e):"[object ArrayBuffer]"===c.call(e)?d.input=new Uint8Array(e):d.input=e,d.next_in=0,d.avail_in=d.input.length;do{if(0===d.avail_out&&(d.output=new n.Buf8(p),d.next_out=0,d.avail_out=p),(s=i.inflate(d,o.Z_NO_FLUSH))===o.Z_NEED_DICT&&m&&(s=i.inflateSetDictionary(this.strm,m)),s===o.Z_BUF_ERROR&&!0===f&&(s=o.Z_OK,f=!1),s!==o.Z_STREAM_END&&s!==o.Z_OK)return this.onEnd(s),this.ended=!0,!1;d.next_out&&(0!==d.avail_out&&s!==o.Z_STREAM_END&&(0!==d.avail_in||a!==o.Z_FINISH&&a!==o.Z_SYNC_FLUSH)||("string"===this.options.to?(l=r.utf8border(d.output,d.next_out),h=d.next_out-l,u=r.buf2string(d.output,l),d.next_out=h,d.avail_out=p-h,h&&n.arraySet(d.output,d.output,l,h,0),this.onData(u)):this.onData(n.shrinkBuf(d.output,d.next_out)))),0===d.avail_in&&0===d.avail_out&&(f=!0)}while((d.avail_in>0||0===d.avail_out)&&s!==o.Z_STREAM_END);return s===o.Z_STREAM_END&&(a=o.Z_FINISH),a===o.Z_FINISH?(s=i.inflateEnd(this.strm),this.onEnd(s),this.ended=!0,s===o.Z_OK):a!==o.Z_SYNC_FLUSH||(this.onEnd(o.Z_OK),d.avail_out=0,!0)},u.prototype.onData=function(e){this.chunks.push(e)},u.prototype.onEnd=function(e){e===o.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=n.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},t.Inflate=u,t.inflate=d,t.inflateRaw=function(e,t){return(t=t||{}).raw=!0,d(e,t)},t.ungzip=d},function(e,t,s){"use strict";var i=s(10),n=s(55),r=s(56),o=s(106),a=s(107),l=0,h=1,c=2,u=4,d=5,p=6,m=0,f=1,_=2,g=-2,E=-3,v=-4,b=-5,w=8,y=1,A=2,I=3,T=4,S=5,D=6,N=7,C=8,O=9,R=10,L=11,M=12,k=13,x=14,U=15,P=16,G=17,j=18,B=19,z=20,V=21,H=22,$=23,F=24,W=25,K=26,Y=27,q=28,J=29,Z=30,Q=31,X=32,ee=852,te=592,se=15;function ie(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function ne(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new i.Buf16(320),this.work=new i.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function re(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=y,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new i.Buf32(ee),t.distcode=t.distdyn=new i.Buf32(te),t.sane=1,t.back=-1,m):g}function oe(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,re(e)):g}function ae(e,t){var s,i;return e&&e.state?(i=e.state,t<0?(s=0,t=-t):(s=1+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?g:(null!==i.window&&i.wbits!==t&&(i.window=null),i.wrap=s,i.wbits=t,oe(e))):g}function le(e,t){var s,i;return e?(i=new ne,e.state=i,i.window=null,(s=ae(e,t))!==m&&(e.state=null),s):g}var he,ce,ue=!0;function de(e){if(ue){var t;for(he=new i.Buf32(512),ce=new i.Buf32(32),t=0;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(a(h,e.lens,0,288,he,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;a(c,e.lens,0,32,ce,0,e.work,{bits:5}),ue=!1}e.lencode=he,e.lenbits=9,e.distcode=ce,e.distbits=5}function pe(e,t,s,n){var r,o=e.state;return null===o.window&&(o.wsize=1<=o.wsize?(i.arraySet(o.window,t,s-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):((r=o.wsize-o.wnext)>n&&(r=n),i.arraySet(o.window,t,s-n,r,o.wnext),(n-=r)?(i.arraySet(o.window,t,s-n,n,0),o.wnext=n,o.whave=o.wsize):(o.wnext+=r,o.wnext===o.wsize&&(o.wnext=0),o.whave>>8&255,s.check=r(s.check,De,2,0),ae=0,le=0,s.mode=A;break}if(s.flags=0,s.head&&(s.head.done=!1),!(1&s.wrap)||(((255&ae)<<8)+(ae>>8))%31){e.msg="incorrect header check",s.mode=Z;break}if((15&ae)!==w){e.msg="unknown compression method",s.mode=Z;break}if(le-=4,ye=8+(15&(ae>>>=4)),0===s.wbits)s.wbits=ye;else if(ye>s.wbits){e.msg="invalid window size",s.mode=Z;break}s.dmax=1<>8&1),512&s.flags&&(De[0]=255&ae,De[1]=ae>>>8&255,s.check=r(s.check,De,2,0)),ae=0,le=0,s.mode=I;case I:for(;le<32;){if(0===re)break e;re--,ae+=ee[se++]<>>8&255,De[2]=ae>>>16&255,De[3]=ae>>>24&255,s.check=r(s.check,De,4,0)),ae=0,le=0,s.mode=T;case T:for(;le<16;){if(0===re)break e;re--,ae+=ee[se++]<>8),512&s.flags&&(De[0]=255&ae,De[1]=ae>>>8&255,s.check=r(s.check,De,2,0)),ae=0,le=0,s.mode=S;case S:if(1024&s.flags){for(;le<16;){if(0===re)break e;re--,ae+=ee[se++]<>>8&255,s.check=r(s.check,De,2,0)),ae=0,le=0}else s.head&&(s.head.extra=null);s.mode=D;case D:if(1024&s.flags&&((ue=s.length)>re&&(ue=re),ue&&(s.head&&(ye=s.head.extra_len-s.length,s.head.extra||(s.head.extra=new Array(s.head.extra_len)),i.arraySet(s.head.extra,ee,se,ue,ye)),512&s.flags&&(s.check=r(s.check,ee,ue,se)),re-=ue,se+=ue,s.length-=ue),s.length))break e;s.length=0,s.mode=N;case N:if(2048&s.flags){if(0===re)break e;ue=0;do{ye=ee[se+ue++],s.head&&ye&&s.length<65536&&(s.head.name+=String.fromCharCode(ye))}while(ye&&ue>9&1,s.head.done=!0),e.adler=s.check=0,s.mode=M;break;case R:for(;le<32;){if(0===re)break e;re--,ae+=ee[se++]<>>=7&le,le-=7&le,s.mode=Y;break}for(;le<3;){if(0===re)break e;re--,ae+=ee[se++]<>>=1)){case 0:s.mode=x;break;case 1:if(de(s),s.mode=z,t===p){ae>>>=2,le-=2;break e}break;case 2:s.mode=G;break;case 3:e.msg="invalid block type",s.mode=Z}ae>>>=2,le-=2;break;case x:for(ae>>>=7&le,le-=7≤le<32;){if(0===re)break e;re--,ae+=ee[se++]<>>16^65535)){e.msg="invalid stored block lengths",s.mode=Z;break}if(s.length=65535&ae,ae=0,le=0,s.mode=U,t===p)break e;case U:s.mode=P;case P:if(ue=s.length){if(ue>re&&(ue=re),ue>oe&&(ue=oe),0===ue)break e;i.arraySet(te,ee,se,ue,ne),re-=ue,se+=ue,oe-=ue,ne+=ue,s.length-=ue;break}s.mode=M;break;case G:for(;le<14;){if(0===re)break e;re--,ae+=ee[se++]<>>=5,le-=5,s.ndist=1+(31&ae),ae>>>=5,le-=5,s.ncode=4+(15&ae),ae>>>=4,le-=4,s.nlen>286||s.ndist>30){e.msg="too many length or distance symbols",s.mode=Z;break}s.have=0,s.mode=j;case j:for(;s.have>>=3,le-=3}for(;s.have<19;)s.lens[Ne[s.have++]]=0;if(s.lencode=s.lendyn,s.lenbits=7,Ie={bits:s.lenbits},Ae=a(l,s.lens,0,19,s.lencode,0,s.work,Ie),s.lenbits=Ie.bits,Ae){e.msg="invalid code lengths set",s.mode=Z;break}s.have=0,s.mode=B;case B:for(;s.have>>16&255,Ee=65535&Se,!((_e=Se>>>24)<=le);){if(0===re)break e;re--,ae+=ee[se++]<>>=_e,le-=_e,s.lens[s.have++]=Ee;else{if(16===Ee){for(Te=_e+2;le>>=_e,le-=_e,0===s.have){e.msg="invalid bit length repeat",s.mode=Z;break}ye=s.lens[s.have-1],ue=3+(3&ae),ae>>>=2,le-=2}else if(17===Ee){for(Te=_e+3;le>>=_e)),ae>>>=3,le-=3}else{for(Te=_e+7;le>>=_e)),ae>>>=7,le-=7}if(s.have+ue>s.nlen+s.ndist){e.msg="invalid bit length repeat",s.mode=Z;break}for(;ue--;)s.lens[s.have++]=ye}}if(s.mode===Z)break;if(0===s.lens[256]){e.msg="invalid code -- missing end-of-block",s.mode=Z;break}if(s.lenbits=9,Ie={bits:s.lenbits},Ae=a(h,s.lens,0,s.nlen,s.lencode,0,s.work,Ie),s.lenbits=Ie.bits,Ae){e.msg="invalid literal/lengths set",s.mode=Z;break}if(s.distbits=6,s.distcode=s.distdyn,Ie={bits:s.distbits},Ae=a(c,s.lens,s.nlen,s.ndist,s.distcode,0,s.work,Ie),s.distbits=Ie.bits,Ae){e.msg="invalid distances set",s.mode=Z;break}if(s.mode=z,t===p)break e;case z:s.mode=V;case V:if(re>=6&&oe>=258){e.next_out=ne,e.avail_out=oe,e.next_in=se,e.avail_in=re,s.hold=ae,s.bits=le,o(e,ce),ne=e.next_out,te=e.output,oe=e.avail_out,se=e.next_in,ee=e.input,re=e.avail_in,ae=s.hold,le=s.bits,s.mode===M&&(s.back=-1);break}for(s.back=0;ge=(Se=s.lencode[ae&(1<>>16&255,Ee=65535&Se,!((_e=Se>>>24)<=le);){if(0===re)break e;re--,ae+=ee[se++]<>ve)])>>>16&255,Ee=65535&Se,!(ve+(_e=Se>>>24)<=le);){if(0===re)break e;re--,ae+=ee[se++]<>>=ve,le-=ve,s.back+=ve}if(ae>>>=_e,le-=_e,s.back+=_e,s.length=Ee,0===ge){s.mode=K;break}if(32&ge){s.back=-1,s.mode=M;break}if(64&ge){e.msg="invalid literal/length code",s.mode=Z;break}s.extra=15&ge,s.mode=H;case H:if(s.extra){for(Te=s.extra;le>>=s.extra,le-=s.extra,s.back+=s.extra}s.was=s.length,s.mode=$;case $:for(;ge=(Se=s.distcode[ae&(1<>>16&255,Ee=65535&Se,!((_e=Se>>>24)<=le);){if(0===re)break e;re--,ae+=ee[se++]<>ve)])>>>16&255,Ee=65535&Se,!(ve+(_e=Se>>>24)<=le);){if(0===re)break e;re--,ae+=ee[se++]<>>=ve,le-=ve,s.back+=ve}if(ae>>>=_e,le-=_e,s.back+=_e,64&ge){e.msg="invalid distance code",s.mode=Z;break}s.offset=Ee,s.extra=15&ge,s.mode=F;case F:if(s.extra){for(Te=s.extra;le>>=s.extra,le-=s.extra,s.back+=s.extra}if(s.offset>s.dmax){e.msg="invalid distance too far back",s.mode=Z;break}s.mode=W;case W:if(0===oe)break e;if(ue=ce-oe,s.offset>ue){if((ue=s.offset-ue)>s.whave&&s.sane){e.msg="invalid distance too far back",s.mode=Z;break}ue>s.wnext?(ue-=s.wnext,me=s.wsize-ue):me=s.wnext-ue,ue>s.length&&(ue=s.length),fe=s.window}else fe=te,me=ne-s.offset,ue=s.length;ue>oe&&(ue=oe),oe-=ue,s.length-=ue;do{te[ne++]=fe[me++]}while(--ue);0===s.length&&(s.mode=V);break;case K:if(0===oe)break e;te[ne++]=s.length,oe--,s.mode=V;break;case Y:if(s.wrap){for(;le<32;){if(0===re)break e;re--,ae|=ee[se++]<>>=b=v>>>24,m-=b,0===(b=v>>>16&255))S[r++]=65535&v;else{if(!(16&b)){if(0==(64&b)){v=f[(65535&v)+(p&(1<>>=b,m-=b),m<15&&(p+=T[i++]<>>=b=v>>>24,m-=b,!(16&(b=v>>>16&255))){if(0==(64&b)){v=_[(65535&v)+(p&(1<l){e.msg="invalid distance too far back",s.mode=30;break e}if(p>>>=b,m-=b,y>(b=r-o)){if((b=y-b)>c&&s.sane){e.msg="invalid distance too far back",s.mode=30;break e}if(A=0,I=d,0===u){if(A+=h-b,b2;)S[r++]=I[A++],S[r++]=I[A++],S[r++]=I[A++],w-=3;w&&(S[r++]=I[A++],w>1&&(S[r++]=I[A++]))}else{A=r-y;do{S[r++]=S[A++],S[r++]=S[A++],S[r++]=S[A++],w-=3}while(w>2);w&&(S[r++]=S[A++],w>1&&(S[r++]=S[A++]))}break}}break}}while(i>3,p&=(1<<(m-=w<<3))-1,e.next_in=i,e.next_out=r,e.avail_in=i=1&&0===x[S];S--);if(D>S&&(D=S),0===S)return h[c++]=20971520,h[c++]=20971520,d.bits=1,0;for(T=1;T0&&(0===e||1!==S))return-1;for(U[1]=0,A=1;A<15;A++)U[A+1]=U[A]+x[A];for(I=0;I852||2===e&&R>592)return 1;for(;;){v=A-C,u[I]E?(b=P[G+u[I]],w=M[k+u[I]]):(b=96,w=0),p=1<>C)+(m-=p)]=v<<24|b<<16|w|0}while(0!==m);for(p=1<>=1;if(0!==p?(L&=p-1,L+=p):L=0,I++,0==--x[A]){if(A===S)break;A=t[s+u[I]]}if(A>D&&(L&_)!==f){for(0===C&&(C=D),g+=T,O=1<<(N=A-C);N+C852||2===e&&R>592)return 1;h[f=L&_]=D<<24|N<<16|g-c|0}}return 0!==L&&(h[g+L]=A-C<<24|64<<16|0),d.bits=D,0}},function(e,t,s){"use strict";e.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},function(e,t,s){var i={"./CHANNEL_CREATE.js":110,"./CHANNEL_DELETE.js":111,"./CHANNEL_PINS_UPDATE.js":112,"./CHANNEL_UPDATE.js":113,"./GUILD_BAN_ADD.js":114,"./GUILD_BAN_REMOVE.js":115,"./GUILD_CREATE.js":116,"./GUILD_DELETE.js":117,"./GUILD_EMOJIS_UPDATE.js":118,"./GUILD_INTEGRATIONS_UPDATE.js":119,"./GUILD_MEMBERS_CHUNK.js":120,"./GUILD_MEMBER_ADD.js":121,"./GUILD_MEMBER_REMOVE.js":122,"./GUILD_MEMBER_UPDATE.js":123,"./GUILD_ROLE_CREATE.js":124,"./GUILD_ROLE_DELETE.js":125,"./GUILD_ROLE_UPDATE.js":126,"./GUILD_SYNC.js":127,"./GUILD_UPDATE.js":128,"./MESSAGE_CREATE.js":129,"./MESSAGE_DELETE.js":130,"./MESSAGE_DELETE_BULK.js":131,"./MESSAGE_REACTION_ADD.js":132,"./MESSAGE_REACTION_REMOVE.js":133,"./MESSAGE_REACTION_REMOVE_ALL.js":134,"./MESSAGE_UPDATE.js":135,"./PRESENCE_UPDATE.js":136,"./READY.js":137,"./RESUMED.js":140,"./TYPING_START.js":141,"./USER_UPDATE.js":142,"./VOICE_SERVER_UPDATE.js":143,"./VOICE_STATE_UPDATE.js":144,"./WEBHOOKS_UPDATE.js":145,"./index.js":60};function n(e){var t=r(e);return s(t)}function r(e){if(!s.o(i,e)){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}return i[e]}n.keys=function(){return Object.keys(i)},n.resolve=r,e.exports=n,n.id=109},function(e,t,s){"use strict";e.exports=((e,t)=>{e.actions.ChannelCreate.handle(t.d)})},function(e,t,s){"use strict";e.exports=((e,t)=>{e.actions.ChannelDelete.handle(t.d)})},function(e,t,s){"use strict";const{Events:i}=s(0);e.exports=((e,{d:t})=>{const s=e.channels.get(t.channel_id),n=new Date(t.last_pin_timestamp);s&&n&&(s.lastPinTimestamp=n.getTime()||null,e.emit(i.CHANNEL_PINS_UPDATE,s,n))})},function(e,t,s){"use strict";const{Events:i}=s(0);e.exports=((e,t)=>{const{old:s,updated:n}=e.actions.ChannelUpdate.handle(t.d);s&&n&&e.emit(i.CHANNEL_UPDATE,s,n)})},function(e,t,s){"use strict";const{Events:i}=s(0);e.exports=((e,{d:t})=>{const s=e.guilds.get(t.guild_id),n=e.users.get(t.user.id);s&&n&&e.emit(i.GUILD_BAN_ADD,s,n)})},function(e,t,s){"use strict";e.exports=((e,t)=>{e.actions.GuildBanRemove.handle(t.d)})},function(e,t,s){"use strict";const{Events:i,Status:n}=s(0);e.exports=(async(e,{d:t},s)=>{let r=e.guilds.get(t.id);if(r)r.available||t.unavailable||(r._patch(t),e.ws.checkReady());else{t.shardID=s.id,r=e.guilds.add(t),e.ws.status===n.READY&&(e.options.fetchAllMembers&&await r.members.fetch(),e.emit(i.GUILD_CREATE,r))}})},function(e,t,s){"use strict";e.exports=((e,t)=>{e.actions.GuildDelete.handle(t.d)})},function(e,t,s){"use strict";e.exports=((e,t)=>{e.actions.GuildEmojisUpdate.handle(t.d)})},function(e,t,s){"use strict";e.exports=((e,t)=>{e.actions.GuildIntegrationsUpdate.handle(t.d)})},function(e,t,s){"use strict";const{Events:i}=s(0),n=s(3);e.exports=((e,{d:t})=>{const s=e.guilds.get(t.guild_id);if(!s)return;const r=new n;for(const e of t.members)r.set(e.user.id,s.members.add(e));e.emit(i.GUILD_MEMBERS_CHUNK,r,s)})},function(e,t,s){"use strict";const{Events:i,Status:n}=s(0);e.exports=((e,{d:t},s)=>{const r=e.guilds.get(t.guild_id);if(r){r.memberCount++;const o=r.members.add(t);s.status===n.READY&&e.emit(i.GUILD_MEMBER_ADD,o)}})},function(e,t,s){"use strict";e.exports=((e,t,s)=>{e.actions.GuildMemberRemove.handle(t.d,s)})},function(e,t,s){"use strict";const{Status:i,Events:n}=s(0);e.exports=((e,{d:t},s)=>{const r=e.guilds.get(t.guild_id);if(r){const o=r.members.get(t.user.id);if(o){const r=o._update(t);s.status===i.READY&&e.emit(n.GUILD_MEMBER_UPDATE,r,o)}}})},function(e,t,s){"use strict";e.exports=((e,t)=>{e.actions.GuildRoleCreate.handle(t.d)})},function(e,t,s){"use strict";e.exports=((e,t)=>{e.actions.GuildRoleDelete.handle(t.d)})},function(e,t,s){"use strict";e.exports=((e,t)=>{e.actions.GuildRoleUpdate.handle(t.d)})},function(e,t,s){"use strict";e.exports=((e,t)=>{e.actions.GuildSync.handle(t.d)})},function(e,t,s){"use strict";e.exports=((e,t)=>{e.actions.GuildUpdate.handle(t.d)})},function(e,t,s){"use strict";e.exports=((e,t)=>{e.actions.MessageCreate.handle(t.d)})},function(e,t,s){"use strict";e.exports=((e,t)=>{e.actions.MessageDelete.handle(t.d)})},function(e,t,s){"use strict";e.exports=((e,t)=>{e.actions.MessageDeleteBulk.handle(t.d)})},function(e,t,s){"use strict";const{Events:i}=s(0);e.exports=((e,t)=>{const{user:s,reaction:n}=e.actions.MessageReactionAdd.handle(t.d);n&&e.emit(i.MESSAGE_REACTION_ADD,n,s)})},function(e,t,s){"use strict";e.exports=((e,t)=>{e.actions.MessageReactionRemove.handle(t.d)})},function(e,t,s){"use strict";e.exports=((e,t)=>{e.actions.MessageReactionRemoveAll.handle(t.d)})},function(e,t,s){"use strict";const{Events:i}=s(0);e.exports=((e,t)=>{const{old:s,updated:n}=e.actions.MessageUpdate.handle(t.d);s&&n&&e.emit(i.MESSAGE_UPDATE,s,n)})},function(e,t,s){"use strict";e.exports=((e,t)=>{e.actions.PresenceUpdate.handle(t.d)})},function(e,t,s){"use strict";let i;e.exports=((e,{d:t},n)=>{i||(i=s(61));const r=new i(e,t.user);e.user=r,e.readyAt=new Date,e.users.set(r.id,r);for(const s of t.guilds)s.shardID=n.id,e.guilds.add(s);e.ws.checkReady()})},function(e,t,s){"use strict";const i=s(5),n=s(39);e.exports=class ReactionStore extends i{constructor(e,t){super(e.client,t,n),this.message=e}add(e,t){return super.add(e,t,{id:e.emoji.id||e.emoji.name,extras:[this.message]})}removeAll(){return this.client.api.channels(this.message.channel.id).messages(this.message.id).reactions.delete().then(()=>this.message)}}},function(e,t,s){"use strict";const i=s(5),n=s(19);e.exports=class VoiceStateStore extends i{constructor(e,t){super(e.client,t,n),this.guild=e}add(e,t=!0){const s=this.get(e.user_id);if(s)return s._patch(e);const i=new n(this.guild,e);return t&&this.set(e.user_id,i),i}}},function(e,t,s){"use strict";const{Events:i}=s(0);e.exports=((e,t,s)=>{const n=s.sequence-s.closeSequence;e.emit(i.RESUMED,n,s.id)})},function(e,t,s){"use strict";const{Events:i}=s(0);e.exports=((e,{d:t})=>{const s=e.channels.get(t.channel_id),n=e.users.get(t.user_id);s&&n&&e.emit(i.TYPING_START,s,n)})},function(e,t,s){"use strict";e.exports=((e,t)=>{e.actions.UserUpdate.handle(t.d)})},function(e,t,s){"use strict";e.exports=((e,t)=>{e.emit("self.voiceServer",t.d)})},function(e,t,s){"use strict";e.exports=((e,t)=>{e.actions.VoiceStateUpdate.handle(t.d)})},function(e,t,s){"use strict";e.exports=((e,t)=>{e.actions.WebhooksUpdate.handle(t.d)})},function(e,t,s){"use strict";e.exports=class ActionsManager{constructor(e){this.client=e,this.register(s(147)),this.register(s(148)),this.register(s(149)),this.register(s(150)),this.register(s(151)),this.register(s(152)),this.register(s(153)),this.register(s(154)),this.register(s(155)),this.register(s(156)),this.register(s(157)),this.register(s(158)),this.register(s(159)),this.register(s(160)),this.register(s(161)),this.register(s(162)),this.register(s(163)),this.register(s(164)),this.register(s(165)),this.register(s(166)),this.register(s(167)),this.register(s(168)),this.register(s(169)),this.register(s(170)),this.register(s(171)),this.register(s(172)),this.register(s(173)),this.register(s(174))}register(e){this[e.name.replace(/Action$/,"")]=new e(this.client)}}},function(e,t,s){"use strict";const i=s(1),{Events:n}=s(0);e.exports=class MessageCreateAction extends i{handle(e){const t=this.client,s=t.channels.get(e.channel_id);if(s){const i=s.messages.get(e.id);if(i)return{message:i};const r=s.messages.add(e),o=r.author;let a=null;return r.member&&s.guild?a=s.guild.members.add(r.member):s.guild&&(a=s.guild.member(o)),s.lastMessageID=e.id,o&&(o.lastMessageID=e.id,o.lastMessageChannelID=s.id),a&&(a.lastMessageID=e.id,a.lastMessageChannelID=s.id),t.emit(n.MESSAGE_CREATE,r),{message:r}}return{}}}},function(e,t,s){"use strict";const i=s(1),{Events:n}=s(0);e.exports=class MessageDeleteAction extends i{handle(e){const t=this.client,s=this.getChannel(e);let i;return s&&(i=this.getMessage(e,s))&&(s.messages.delete(i.id),i.deleted=!0,t.emit(n.MESSAGE_DELETE,i)),{message:i}}}},function(e,t,s){"use strict";const i=s(1),n=s(3),{Events:r}=s(0);e.exports=class MessageDeleteBulkAction extends i{handle(e){const t=this.client,s=t.channels.get(e.channel_id);if(s){const i=e.ids,o=new n;for(const e of i){const t=s.messages.get(e);t&&(t.deleted=!0,o.set(t.id,t),s.messages.delete(e))}return o.size>0&&t.emit(r.MESSAGE_BULK_DELETE,o),{messages:o}}return{}}}},function(e,t,s){"use strict";const i=s(1);e.exports=class MessageUpdateAction extends i{handle(e){const t=this.getChannel(e);if(t){const s=this.getMessage(e,t);if(s)return s.patch(e),{old:s._edits[0],updated:s}}return{}}}},function(e,t,s){"use strict";const i=s(1);e.exports=class MessageReactionAdd extends i{handle(e){const t=e.user||this.client.users.get(e.user_id);if(!t)return!1;const s=this.getChannel(e);if(!s||"voice"===s.type)return!1;const i=this.getMessage(e,s);if(!i)return!1;if(!e.emoji)return!1;const n=i.reactions.add({emoji:e.emoji,count:0,me:t.id===this.client.user.id});return n._add(t),{message:i,reaction:n,user:t}}}},function(e,t,s){"use strict";const i=s(1),{Events:n}=s(0);e.exports=class MessageReactionRemove extends i{handle(e){const t=this.client.users.get(e.user_id);if(!t)return!1;const s=this.client.channels.get(e.channel_id);if(!s||"voice"===s.type)return!1;const i=s.messages.get(e.message_id);if(!i)return!1;if(!e.emoji)return!1;const r=e.emoji.id||decodeURIComponent(e.emoji.name),o=i.reactions.get(r);return!!o&&(o._remove(t),this.client.emit(n.MESSAGE_REACTION_REMOVE,o,t),{message:i,reaction:o,user:t})}}},function(e,t,s){"use strict";const i=s(1),{Events:n}=s(0);e.exports=class MessageReactionRemoveAll extends i{handle(e){const t=this.client.channels.get(e.channel_id);if(!t||"voice"===t.type)return!1;const s=t.messages.get(e.message_id);return!!s&&(s.reactions.clear(),this.client.emit(n.MESSAGE_REACTION_REMOVE_ALL,s),{message:s})}}},function(e,t,s){"use strict";const i=s(1),{Events:n}=s(0);e.exports=class ChannelCreateAction extends i{handle(e){const t=this.client,s=t.channels.has(e.id),i=t.channels.add(e);return!s&&i&&t.emit(n.CHANNEL_CREATE,i),{channel:i}}}},function(e,t,s){"use strict";const i=s(1),{Events:n}=s(0);e.exports=class ChannelDeleteAction extends i{constructor(e){super(e),this.deleted=new Map}handle(e){const t=this.client;let s=t.channels.get(e.id);return s&&(t.channels.remove(s.id),s.deleted=!0,t.emit(n.CHANNEL_DELETE,s)),{channel:s}}}},function(e,t,s){"use strict";const i=s(1);e.exports=class ChannelUpdateAction extends i{handle(e){const t=this.client.channels.get(e.id);return t?{old:t._update(e),updated:t}:{}}}},function(e,t,s){"use strict";const i=s(1),{Events:n}=s(0);e.exports=class GuildDeleteAction extends i{constructor(e){super(e),this.deleted=new Map}handle(e){const t=this.client;let s=t.guilds.get(e.id);if(s){for(const e of s.channels.values())"text"===e.type&&e.stopTyping(!0);if(s.available&&e.unavailable)return s.available=!1,t.emit(n.GUILD_UNAVAILABLE,s),{guild:null};for(const e of s.channels.values())this.client.channels.remove(e.id);s.voiceConnection&&s.voiceConnection.disconnect(),t.guilds.remove(s.id),s.deleted=!0,t.emit(n.GUILD_DELETE,s),this.deleted.set(s.id,s),this.scheduleForDeletion(s.id)}else s=this.deleted.get(e.id)||null;return{guild:s}}scheduleForDeletion(e){this.client.setTimeout(()=>this.deleted.delete(e),this.client.options.restWsBridgeTimeout)}}},function(e,t,s){"use strict";const i=s(1),{Events:n}=s(0);e.exports=class GuildUpdateAction extends i{handle(e){const t=this.client,s=t.guilds.get(e.id);if(s){const i=s._update(e);return t.emit(n.GUILD_UPDATE,i,s),{old:i,updated:s}}return{old:null,updated:null}}}},function(e,t,s){"use strict";const i=s(1),{Events:n,Status:r}=s(0);e.exports=class GuildMemberRemoveAction extends i{handle(e,t){const s=this.client,i=s.guilds.get(e.guild_id);let o=null;return i&&(o=i.members.get(e.user.id),i.memberCount--,o&&(i.voiceStates.delete(o.id),o.deleted=!0,i.members.remove(o.id),t.status===r.READY&&s.emit(n.GUILD_MEMBER_REMOVE,o))),{guild:i,member:o}}}},function(e,t,s){"use strict";const i=s(1),{Events:n}=s(0);e.exports=class GuildBanRemove extends i{handle(e){const t=this.client,s=t.guilds.get(e.guild_id),i=t.users.add(e.user);s&&i&&t.emit(n.GUILD_BAN_REMOVE,s,i)}}},function(e,t,s){"use strict";const i=s(1),{Events:n}=s(0);e.exports=class GuildRoleCreate extends i{handle(e){const t=this.client,s=t.guilds.get(e.guild_id);let i;if(s){const r=s.roles.has(e.role.id);i=s.roles.add(e.role),r||t.emit(n.GUILD_ROLE_CREATE,i)}return{role:i}}}},function(e,t,s){"use strict";const i=s(1),{Events:n}=s(0);e.exports=class GuildRoleDeleteAction extends i{handle(e){const t=this.client,s=t.guilds.get(e.guild_id);let i;return s&&(i=s.roles.get(e.role_id))&&(s.roles.remove(e.role_id),i.deleted=!0,t.emit(n.GUILD_ROLE_DELETE,i)),{role:i}}}},function(e,t,s){"use strict";const i=s(1),{Events:n}=s(0);e.exports=class GuildRoleUpdateAction extends i{handle(e){const t=this.client,s=t.guilds.get(e.guild_id);if(s){let i=null;const r=s.roles.get(e.role.id);return r&&(i=r._update(e.role),t.emit(n.GUILD_ROLE_UPDATE,i,r)),{old:i,updated:r}}return{old:null,updated:null}}}},function(e,t,s){"use strict";const i=s(1),{Events:n}=s(0);e.exports=class PresenceUpdateAction extends i{handle(e){let t=this.client.users.get(e.user.id);if(!t&&e.user.username&&(t=this.client.users.add(e.user)),!t)return;e.user&&e.user.username&&(t.equals(e.user)||this.client.actions.UserUpdate.handle(e.user));const s=this.client.guilds.get(e.guild_id);if(!s)return;let i=s.members.get(t.id);if(i||"offline"===e.status||(i=s.members.add({user:t,roles:e.roles,deaf:!1,mute:!1}),this.client.emit(n.GUILD_MEMBER_AVAILABLE,i)),i){if(0===this.client.listenerCount(n.PRESENCE_UPDATE))return void s.presences.add(e);const t=i._clone();i.presence&&(t.frozenPresence=i.presence._clone()),s.presences.add(e),this.client.emit(n.PRESENCE_UPDATE,t,i)}else s.presences.add(e)}}},function(e,t,s){"use strict";const i=s(1),{Events:n}=s(0);e.exports=class UserUpdateAction extends i{handle(e){const t=this.client,s=t.users.get(e.id),i=s._update(e);return i.equals(s)?{old:null,updated:null}:(t.emit(n.USER_UPDATE,i,s),{old:i,updated:s})}}},function(e,t,s){"use strict";const i=s(1),{Events:n}=s(0),r=s(19);e.exports=class VoiceStateUpdate extends i{handle(e){const t=this.client,s=t.guilds.get(e.guild_id);if(s){const i=s.voiceStates.has(e.user_id)?s.voiceStates.get(e.user_id)._clone():new r(s,{user_id:e.user_id}),o=s.voiceStates.add(e);let a=s.members.get(e.user_id);a&&e.member?a._patch(e.member):e.member&&e.member.user&&e.member.joined_at&&(a=s.members.add(e.member)),a&&a.user.id===t.user.id&&e.channel_id&&t.emit("self.voiceStateUpdate",e),t.emit(n.VOICE_STATE_UPDATE,i,o)}}}},function(e,t,s){"use strict";const i=s(1),{Events:n}=s(0);e.exports=class GuildEmojiCreateAction extends i{handle(e,t){const s=e.emojis.add(t);return this.client.emit(n.GUILD_EMOJI_CREATE,s),{emoji:s}}}},function(e,t,s){"use strict";const i=s(1),{Events:n}=s(0);e.exports=class GuildEmojiDeleteAction extends i{handle(e){return e.guild.emojis.remove(e.id),e.deleted=!0,this.client.emit(n.GUILD_EMOJI_DELETE,e),{emoji:e}}}},function(e,t,s){"use strict";const i=s(1),{Events:n}=s(0);e.exports=class GuildEmojiUpdateAction extends i{handle(e,t){const s=e._update(t);return this.client.emit(n.GUILD_EMOJI_UPDATE,s,e),{emoji:e}}}},function(e,t,s){"use strict";const i=s(1);e.exports=class GuildEmojisUpdateAction extends i{handle(e){const t=this.client.guilds.get(e.guild_id);if(!t||!t.emojis)return;const s=new Map(t.emojis);for(const i of e.emojis){const e=t.emojis.get(i.id);e?(s.delete(i.id),e.equals(i)||this.client.actions.GuildEmojiUpdate.handle(e,i)):this.client.actions.GuildEmojiCreate.handle(t,i)}for(const e of s.values())this.client.actions.GuildEmojiDelete.handle(e)}}},function(e,t,s){"use strict";const i=s(1);e.exports=class GuildRolesPositionUpdate extends i{handle(e){const t=this.client.guilds.get(e.guild_id);if(t)for(const s of e.roles){const e=t.roles.get(s.id);e&&(e.rawPosition=s.position)}return{guild:t}}}},function(e,t,s){"use strict";const i=s(1);e.exports=class GuildChannelsPositionUpdate extends i{handle(e){const t=this.client.guilds.get(e.guild_id);if(t)for(const s of e.channels){const e=t.channels.get(s.id);e&&(e.rawPosition=s.position)}return{guild:t}}}},function(e,t,s){"use strict";const i=s(1),{Events:n}=s(0);e.exports=class GuildIntegrationsUpdate extends i{handle(e){const t=this.client,s=t.guilds.get(e.guild_id);s&&t.emit(n.GUILD_INTEGRATIONS_UPDATE,s)}}},function(e,t,s){"use strict";const i=s(1),{Events:n}=s(0);e.exports=class WebhooksUpdate extends i{handle(e){const t=this.client,s=t.channels.get(e.channel_id);s&&t.emit(n.WEBHOOKS_UPDATE,s)}}},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t,s){"use strict";const i=s(20);class Speaking extends i{}Speaking.FLAGS={SPEAKING:1,SOUNDSHARE:2},e.exports=Speaking}])}); \ No newline at end of file +!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Discord=t():e.Discord=t()}(window,function(){return function(e){var t={};function s(i){if(t[i])return t[i].exports;var n=t[i]={i:i,l:!1,exports:{}};return e[i].call(n.exports,n,n.exports,s),n.l=!0,n.exports}return s.m=e,s.c=t,s.d=function(e,t,i){s.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},s.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},s.t=function(e,t){if(1&t&&(e=s(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(s.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)s.d(i,n,function(t){return e[t]}.bind(null,n));return i},s.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return s.d(t,"a",t),t},s.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},s.p="",s(s.s=83)}([function(e,t,s){"use strict";(function(e){const i=t.Package=s(45),{Error:n,RangeError:r}=s(4),o=t.browser="undefined"!=typeof window;t.DefaultOptions={shardCount:1,totalShardCount:1,messageCacheMaxSize:200,messageCacheLifetime:0,messageSweepInterval:0,fetchAllMembers:!1,disableEveryone:!1,partials:!1,restWsBridgeTimeout:5e3,disabledEvents:[],retryLimit:1,restTimeOffset:500,restSweepInterval:60,presence:{},ws:{large_threshold:250,compress:!1,properties:{$os:o?"browser":e.platform,$browser:"discord.js",$device:"discord.js"},version:6},http:{version:7,api:"https://discordapp.com/api",cdn:"https://cdn.discordapp.com",invite:"https://discord.gg"}},t.UserAgent=o?null:`DiscordBot (${i.homepage.split("#")[0]}, ${i.version}) Node.js/${e.version}`,t.WSCodes={1000:"WS_CLOSE_REQUESTED",4004:"TOKEN_INVALID",4010:"SHARDING_INVALID",4011:"SHARDING_REQUIRED"};const a=["webp","png","jpg","gif"],l=Array.from({length:8},(e,t)=>2**(t+4));function h(e,{format:t="webp",size:s}={}){if(t&&!a.includes(t))throw new n("IMAGE_FORMAT",t);if(s&&!l.includes(s))throw new r("IMAGE_SIZE",s);return`${e}.${t}${s?`?size=${s}`:""}`}t.Endpoints={CDN:e=>({Emoji:(t,s="png")=>`${e}/emojis/${t}.${s}`,Asset:t=>`${e}/assets/${t}`,DefaultAvatar:t=>`${e}/embed/avatars/${t}.png`,Avatar:(t,s,i="default",n)=>("default"===i&&(i=s.startsWith("a_")?"gif":"webp"),h(`${e}/avatars/${t}/${s}`,{format:i,size:n})),Icon:(t,s,i="webp",n)=>h(`${e}/icons/${t}/${s}`,{format:i,size:n}),AppIcon:(t,s,{format:i="webp",size:n}={})=>h(`${e}/app-icons/${t}/${s}`,{size:n,format:i}),AppAsset:(t,s,{format:i="webp",size:n}={})=>h(`${e}/app-assets/${t}/${s}`,{size:n,format:i}),GDMIcon:(t,s,i="webp",n)=>h(`${e}/channel-icons/${t}/${s}`,{size:n,format:i}),Splash:(t,s,i="webp",n)=>h(`${e}/splashes/${t}/${s}`,{size:n,format:i})}),invite:(e,t)=>`${e}/${t}`,botGateway:"/gateway/bot"},t.Status={READY:0,CONNECTING:1,RECONNECTING:2,IDLE:3,NEARLY:4,DISCONNECTED:5},t.VoiceStatus={CONNECTED:0,CONNECTING:1,AUTHENTICATING:2,RECONNECTING:3,DISCONNECTED:4},t.OPCodes={DISPATCH:0,HEARTBEAT:1,IDENTIFY:2,STATUS_UPDATE:3,VOICE_STATE_UPDATE:4,VOICE_GUILD_PING:5,RESUME:6,RECONNECT:7,REQUEST_GUILD_MEMBERS:8,INVALID_SESSION:9,HELLO:10,HEARTBEAT_ACK:11},t.VoiceOPCodes={IDENTIFY:0,SELECT_PROTOCOL:1,READY:2,HEARTBEAT:3,SESSION_DESCRIPTION:4,SPEAKING:5,HELLO:8,CLIENT_CONNECT:12,CLIENT_DISCONNECT:13},t.Events={RATE_LIMIT:"rateLimit",READY:"ready",RESUMED:"resumed",GUILD_CREATE:"guildCreate",GUILD_DELETE:"guildDelete",GUILD_UPDATE:"guildUpdate",GUILD_UNAVAILABLE:"guildUnavailable",GUILD_AVAILABLE:"guildAvailable",GUILD_MEMBER_ADD:"guildMemberAdd",GUILD_MEMBER_REMOVE:"guildMemberRemove",GUILD_MEMBER_UPDATE:"guildMemberUpdate",GUILD_MEMBER_AVAILABLE:"guildMemberAvailable",GUILD_MEMBER_SPEAKING:"guildMemberSpeaking",GUILD_MEMBERS_CHUNK:"guildMembersChunk",GUILD_INTEGRATIONS_UPDATE:"guildIntegrationsUpdate",GUILD_ROLE_CREATE:"roleCreate",GUILD_ROLE_DELETE:"roleDelete",GUILD_ROLE_UPDATE:"roleUpdate",GUILD_EMOJI_CREATE:"emojiCreate",GUILD_EMOJI_DELETE:"emojiDelete",GUILD_EMOJI_UPDATE:"emojiUpdate",GUILD_BAN_ADD:"guildBanAdd",GUILD_BAN_REMOVE:"guildBanRemove",CHANNEL_CREATE:"channelCreate",CHANNEL_DELETE:"channelDelete",CHANNEL_UPDATE:"channelUpdate",CHANNEL_PINS_UPDATE:"channelPinsUpdate",MESSAGE_CREATE:"message",MESSAGE_DELETE:"messageDelete",MESSAGE_UPDATE:"messageUpdate",MESSAGE_BULK_DELETE:"messageDeleteBulk",MESSAGE_REACTION_ADD:"messageReactionAdd",MESSAGE_REACTION_REMOVE:"messageReactionRemove",MESSAGE_REACTION_REMOVE_ALL:"messageReactionRemoveAll",USER_UPDATE:"userUpdate",USER_NOTE_UPDATE:"userNoteUpdate",USER_SETTINGS_UPDATE:"clientUserSettingsUpdate",PRESENCE_UPDATE:"presenceUpdate",VOICE_STATE_UPDATE:"voiceStateUpdate",VOICE_BROADCAST_SUBSCRIBE:"subscribe",VOICE_BROADCAST_UNSUBSCRIBE:"unsubscribe",TYPING_START:"typingStart",TYPING_STOP:"typingStop",WEBHOOKS_UPDATE:"webhookUpdate",DISCONNECT:"disconnect",RECONNECTING:"reconnecting",ERROR:"error",WARN:"warn",DEBUG:"debug",SHARD_READY:"shardReady",INVALIDATED:"invalidated",RAW:"raw"},t.WSEvents=function(e){let t=Object.create(null);for(const s of e)t[s]=s;return t}(["READY","RESUMED","GUILD_CREATE","GUILD_DELETE","GUILD_UPDATE","GUILD_MEMBER_ADD","GUILD_MEMBER_REMOVE","GUILD_MEMBER_UPDATE","GUILD_MEMBERS_CHUNK","GUILD_INTEGRATIONS_UPDATE","GUILD_ROLE_CREATE","GUILD_ROLE_DELETE","GUILD_ROLE_UPDATE","GUILD_BAN_ADD","GUILD_BAN_REMOVE","GUILD_EMOJIS_UPDATE","CHANNEL_CREATE","CHANNEL_DELETE","CHANNEL_UPDATE","CHANNEL_PINS_UPDATE","MESSAGE_CREATE","MESSAGE_DELETE","MESSAGE_UPDATE","MESSAGE_DELETE_BULK","MESSAGE_REACTION_ADD","MESSAGE_REACTION_REMOVE","MESSAGE_REACTION_REMOVE_ALL","USER_UPDATE","PRESENCE_UPDATE","VOICE_STATE_UPDATE","TYPING_START","VOICE_SERVER_UPDATE","WEBHOOKS_UPDATE"]),t.MessageTypes=["DEFAULT","RECIPIENT_ADD","RECIPIENT_REMOVE","CALL","CHANNEL_NAME_CHANGE","CHANNEL_ICON_CHANGE","PINS_ADD","GUILD_MEMBER_JOIN"],t.ActivityTypes=["PLAYING","STREAMING","LISTENING","WATCHING"],t.ChannelTypes={TEXT:0,DM:1,VOICE:2,GROUP:3,CATEGORY:4},t.ClientApplicationAssetTypes={SMALL:1,BIG:2},t.Colors={DEFAULT:0,WHITE:16777215,AQUA:1752220,GREEN:3066993,BLUE:3447003,PURPLE:10181046,LUMINOUS_VIVID_PINK:15277667,GOLD:15844367,ORANGE:15105570,RED:15158332,GREY:9807270,NAVY:3426654,DARK_AQUA:1146986,DARK_GREEN:2067276,DARK_BLUE:2123412,DARK_PURPLE:7419530,DARK_VIVID_PINK:11342935,DARK_GOLD:12745742,DARK_ORANGE:11027200,DARK_RED:10038562,DARK_GREY:9936031,DARKER_GREY:8359053,LIGHT_GREY:12370112,DARK_NAVY:2899536,BLURPLE:7506394,GREYPLE:10070709,DARK_BUT_NOT_BLACK:2895667,NOT_QUITE_BLACK:2303786},t.APIErrors={UNKNOWN_ACCOUNT:10001,UNKNOWN_APPLICATION:10002,UNKNOWN_CHANNEL:10003,UNKNOWN_GUILD:10004,UNKNOWN_INTEGRATION:10005,UNKNOWN_INVITE:10006,UNKNOWN_MEMBER:10007,UNKNOWN_MESSAGE:10008,UNKNOWN_OVERWRITE:10009,UNKNOWN_PROVIDER:10010,UNKNOWN_ROLE:10011,UNKNOWN_TOKEN:10012,UNKNOWN_USER:10013,UNKNOWN_EMOJI:10014,UNKNOWN_WEBHOOK:10015,BOT_PROHIBITED_ENDPOINT:20001,BOT_ONLY_ENDPOINT:20002,MAXIMUM_GUILDS:30001,MAXIMUM_FRIENDS:30002,MAXIMUM_PINS:30003,MAXIMUM_ROLES:30005,MAXIMUM_REACTIONS:30010,UNAUTHORIZED:40001,MISSING_ACCESS:50001,INVALID_ACCOUNT_TYPE:50002,CANNOT_EXECUTE_ON_DM:50003,EMBED_DISABLED:50004,CANNOT_EDIT_MESSAGE_BY_OTHER:50005,CANNOT_SEND_EMPTY_MESSAGE:50006,CANNOT_MESSAGE_USER:50007,CANNOT_SEND_MESSAGES_IN_VOICE_CHANNEL:50008,CHANNEL_VERIFICATION_LEVEL_TOO_HIGH:50009,OAUTH2_APPLICATION_BOT_ABSENT:50010,MAXIMUM_OAUTH2_APPLICATIONS:50011,INVALID_OAUTH_STATE:50012,MISSING_PERMISSIONS:50013,INVALID_AUTHENTICATION_TOKEN:50014,NOTE_TOO_LONG:50015,INVALID_BULK_DELETE_QUANTITY:50016,CANNOT_PIN_MESSAGE_IN_OTHER_CHANNEL:50019,INVALID_OR_TAKEN_INVITE_CODE:50020,CANNOT_EXECUTE_ON_SYSTEM_MESSAGE:50021,BULK_DELETE_MESSAGE_TOO_OLD:50034,INVITE_ACCEPTED_TO_GUILD_NOT_CONTAINING_BOT:50036,REACTION_BLOCKED:90001},t.DefaultMessageNotifications=["ALL","MENTIONS"]}).call(this,s(27))},function(e,t,s){"use strict";e.exports=class GenericAction{constructor(e){this.client=e}handle(e){return e}getChannel(e){const t=e.channel_id||e.id;return e.channel||(this.client.options.partials?this.client.channels.add({...e,id:t}):this.client.channels.get(t))}getMessage(e,t){const s=e.message_id||e.id;return e.message||(this.client.options.partials?t.messages.add({...e,id:s}):t.messages.get(s))}}},function(e,t,s){"use strict";const{Colors:i,DefaultOptions:n,Endpoints:r}=s(0),o=s(28),{Error:a,RangeError:l,TypeError:h}=s(4),c=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),u=e=>"object"==typeof e&&null!==e,{parse:d}=s(29);class Util{constructor(){throw new Error(`The ${this.constructor.name} class may not be instantiated.`)}static flatten(e,...t){if(!u(e))return e;t=Object.assign(...Object.keys(e).filter(e=>!e.startsWith("_")).map(e=>({[e]:!0})),...t);const i={};for(let[n,r]of Object.entries(t)){if(!r)continue;r=!0===r?n:r;const t=e[n],o=u(t),a=o&&"function"==typeof t.valueOf?t.valueOf():null;t instanceof s(3)?i[r]=Array.from(t.keys()):Array.isArray(t)?i[r]=t.map(e=>Util.flatten(e)):"object"!=typeof a?i[r]=a:o||(i[r]=t)}return i}static splitMessage(e,{maxLength:t=2e3,char:s="\n",prepend:i="",append:n=""}={}){if(e.length<=t)return e;const r=e.split(s);if(r.some(e=>e.length>t))throw new l("SPLIT_MAX_LEN");const o=[];let a="";for(const e of r)a&&(a+s+e+n).length>t&&(o.push(a+n),a=i),a+=(a&&a!==i?s:"")+e;return o.concat(a).filter(e=>e)}static escapeMarkdown(e,t=!1,s=!1){return t?e.replace(/```/g,"`​``"):s?e.replace(/\\(`|\\)/g,"$1").replace(/(`|\\)/g,"\\$1"):e.replace(/\\(\*|_|`|~|\\)/g,"$1").replace(/(\*|_|`|~|\\)/g,"\\$1")}static fetchRecommendedShards(e,t=1e3){if(!e)throw new a("TOKEN_MISSING");return o(`${n.http.api}/v${n.http.version}${r.botGateway}`,{method:"GET",headers:{Authorization:`Bot ${e.replace(/^Bot\s*/i,"")}`}}).then(e=>{if(e.ok)return e.json();throw e}).then(e=>e.shards*(1e3/t))}static parseEmoji(e){if(e.includes("%")&&(e=decodeURIComponent(e)),!e.includes(":"))return{animated:!1,name:e,id:null};const t=e.match(/?/);return t?{animated:Boolean(t[1]),name:t[2],id:t[3]}:null}static cloneObject(e){return Object.assign(Object.create(e),e)}static mergeDefault(e,t){if(!t)return e;for(const s in e)c(t,s)&&void 0!==t[s]?t[s]===Object(t[s])&&(t[s]=Util.mergeDefault(e[s],t[s])):t[s]=e[s];return t}static convertToBuffer(e){return"string"==typeof e&&(e=Util.str2ab(e)),Buffer.from(e)}static str2ab(e){const t=new ArrayBuffer(2*e.length),s=new Uint16Array(t);for(var i=0,n=e.length;i-1&&s16777215)throw new l("COLOR_RANGE");if(e&&isNaN(e))throw new h("COLOR_CONVERT");return e}static discordSort(e){return e.sort((e,t)=>e.rawPosition-t.rawPosition||parseInt(t.id.slice(0,-10))-parseInt(e.id.slice(0,-10))||parseInt(t.id.slice(10))-parseInt(e.id.slice(10)))}static setPosition(e,t,s,i,n,r){let o=i.array();return Util.moveElementInArray(o,e,t,s),o=o.map((e,t)=>({id:e.id,position:t})),n.patch({data:o,reason:r}).then(()=>o)}static basename(e,t){let s=d(e);return t&&s.ext.startsWith(t)?s.name:s.base.split("?")[0]}static idToBinary(e){let t="",s=parseInt(e.slice(0,-10))||0,i=parseInt(e.slice(-10));for(;i>0||s>0;)t=String(1&i)+t,i=Math.floor(i/2),s>0&&(i+=s%2*5e9,s=Math.floor(s/2));return t}static binaryToID(e){let t="";for(;e.length>50;){const s=parseInt(e.slice(0,-32),2),i=parseInt((s%10).toString(2)+e.slice(-32),2);t=(i%10).toString()+t,e=Math.floor(s/10).toString(2)+Math.floor(i/10).toString(2).padStart(32,"0")}for(e=parseInt(e,2);e>0;)t=(e%10).toString()+t,e=Math.floor(e/10);return t}static cleanContent(e,t){return e.replace(/@(everyone|here)/g,"@​$1").replace(/<@!?[0-9]+>/g,e=>{const s=e.replace(/<|!|>|@/g,"");if("dm"===t.channel.type){const i=t.client.users.get(s);return i?`@${i.username}`:e}const i=t.channel.guild.members.get(s);if(i)return`@${i.displayName}`;{const i=t.client.users.get(s);return i?`@${i.username}`:e}}).replace(/<#[0-9]+>/g,e=>{const s=t.client.channels.get(e.replace(/<|#|>/g,""));return s?`#${s.name}`:e}).replace(/<@&[0-9]+>/g,e=>{if("dm"===t.channel.type)return e;const s=t.guild.roles.get(e.replace(/<|@|>|&/g,""));return s?`@${s.name}`:e})}static delayFor(e){return new Promise(t=>{setTimeout(t,e)})}static mixin(e,t){const i=s(3);Object.getOwnPropertyNames(i.prototype).concat(Object.getOwnPropertyNames(Map.prototype)).forEach(s=>{if(t.includes(s))return;if("size"===s)return void Object.defineProperty(e.prototype,s,{get:function(){return this._filtered[s]}});const n=i.prototype[s];"constructor"!==s&&"function"==typeof n&&(e.prototype[s]=function(...e){return n.apply(this._filtered,e)})})}}e.exports=Util},function(e,t,s){"use strict";const i=s(2);e.exports=class Collection extends Map{constructor(e){super(e),Object.defineProperty(this,"_array",{value:null,writable:!0,configurable:!0}),Object.defineProperty(this,"_keyArray",{value:null,writable:!0,configurable:!0})}set(e,t){return this._array=null,this._keyArray=null,super.set(e,t)}delete(e){return this._array=null,this._keyArray=null,super.delete(e)}array(){return this._array&&this._array.length===this.size||(this._array=[...this.values()]),this._array}keyArray(){return this._keyArray&&this._keyArray.length===this.size||(this._keyArray=[...this.keys()]),this._keyArray}first(e){if(void 0===e)return this.values().next().value;if(e<0)return this.last(-1*e);e=Math.min(this.size,e);const t=new Array(e),s=this.values();for(let i=0;i{const i=e.get(s);return i!==t||void 0===i&&!e.has(s)}))}sort(e=((e,t)=>+(e>t)||+(e===t)-1)){return new this.constructor[Symbol.species]([...this.entries()].sort((t,s)=>e(t[1],s[1],t[0],s[0])))}toJSON(){return this.map(e=>"function"==typeof e.toJSON?e.toJSON():i.flatten(e))}}},function(e,t,s){"use strict";e.exports=s(46),e.exports.Messages=s(84)},function(e,t,s){"use strict";const i=s(3);let n;e.exports=class DataStore extends i{constructor(e,t,i){if(super(),n||(n=s(18)),Object.defineProperty(this,"client",{value:e}),Object.defineProperty(this,"holds",{value:n.get(i.name)||i}),t)for(const e of t)this.add(e)}add(e,t=!0,{id:s,extras:i=[]}={}){const n=this.get(s||e.id);if(n)return n;const r=this.holds?new this.holds(this.client,e,...i):e;return t&&this.set(s||r.id,r),r}remove(e){return this.delete(e)}resolve(e){return e instanceof this.holds?e:"string"==typeof e&&this.get(e)||null}resolveID(e){return e instanceof this.holds?e.id:"string"==typeof e?e:null}static get[Symbol.species](){return i}}},function(e,t,s){"use strict";const i=s(2);e.exports=class Base{constructor(e){Object.defineProperty(this,"client",{value:e})}_clone(){return Object.assign(Object.create(this),this)}_patch(e){return e}_update(e){const t=this._clone();return this._patch(e),t}toJSON(...e){return i.flatten(this,...e)}valueOf(){return this.id}}},function(e,t,s){"use strict";const i=s(20);class Permissions extends i{has(e,t=!0){return!(!t||!super.has(this.constructor.FLAGS.ADMINISTRATOR))||super.has(e)}}Permissions.FLAGS={CREATE_INSTANT_INVITE:1,KICK_MEMBERS:2,BAN_MEMBERS:4,ADMINISTRATOR:8,MANAGE_CHANNELS:16,MANAGE_GUILD:32,ADD_REACTIONS:64,VIEW_AUDIT_LOG:128,PRIORITY_SPEAKER:256,VIEW_CHANNEL:1024,SEND_MESSAGES:2048,SEND_TTS_MESSAGES:4096,MANAGE_MESSAGES:8192,EMBED_LINKS:16384,ATTACH_FILES:32768,READ_MESSAGE_HISTORY:65536,MENTION_EVERYONE:1<<17,USE_EXTERNAL_EMOJIS:1<<18,CONNECT:1<<20,SPEAK:1<<21,MUTE_MEMBERS:1<<22,DEAFEN_MEMBERS:1<<23,MOVE_MEMBERS:1<<24,USE_VAD:1<<25,CHANGE_NICKNAME:1<<26,MANAGE_NICKNAMES:1<<27,MANAGE_ROLES:1<<28,MANAGE_WEBHOOKS:1<<29,MANAGE_EMOJIS:1<<30},Permissions.ALL=Object.values(Permissions.FLAGS).reduce((e,t)=>e|t,0),Permissions.DEFAULT=104324097,e.exports=Permissions},function(e,t,s){"use strict";const i=s(2),n=14200704e5;let r=0;e.exports=class SnowflakeUtil{constructor(){throw new Error(`The ${this.constructor.name} class may not be instantiated.`)}static generate(e=Date.now()){if(e instanceof Date&&(e=e.getTime()),"number"!=typeof e||isNaN(e))throw new TypeError(`"timestamp" argument must be a number (received ${isNaN(e)?"NaN":typeof e})`);r>=4095&&(r=0);const t=`${(e-n).toString(2).padStart(42,"0")}0000100000${(r++).toString(2).padStart(12,"0")}`;return i.binaryToID(t)}static deconstruct(e){const t=i.idToBinary(e).toString(2).padStart(64,"0"),s={timestamp:parseInt(t.substring(0,42),2)+n,workerID:parseInt(t.substring(42,47),2),processID:parseInt(t.substring(47,52),2),increment:parseInt(t.substring(52,64),2),binary:t};return Object.defineProperty(s,"date",{get:function(){return new Date(this.timestamp)},enumerable:!0}),s}}},function(e,t,s){"use strict";const i=s(29),n=s(29),r=s(28),o=s(2),{Error:a,TypeError:l}=s(4),{browser:h}=s(0);class DataResolver{constructor(){throw new Error(`The ${this.constructor.name} class may not be instantiated.`)}static resolveInviteCode(e){const t=/discord(?:app\.com\/invite|\.gg(?:\/invite)?)\/([\w-]{2,255})/i.exec(e);return t&&t[1]?t[1]:e}static async resolveImage(e){if(!e)return null;if("string"==typeof e&&e.startsWith("data:"))return e;const t=await this.resolveFile(e);return DataResolver.resolveBase64(t)}static resolveBase64(e){return e instanceof Buffer?`data:image/jpg;base64,${e.toString("base64")}`:e}static resolveFile(e){if(!h&&e instanceof Buffer)return Promise.resolve(e);if(h&&e instanceof ArrayBuffer)return Promise.resolve(o.convertToBuffer(e));if("string"==typeof e){if(/^https?:\/\//.test(e))return r(e).then(e=>h?e.blob():e.buffer());if(!h)return new Promise((t,s)=>{const r=h?e:i.resolve(e);n.stat(r,(e,i)=>e?s(e):i&&i.isFile()?(n.readFile(r,(e,i)=>{e?s(e):t(i)}),null):s(new a("FILE_NOT_FOUND",r)))})}else if("function"==typeof e.pipe)return new Promise((t,s)=>{const i=[];e.once("error",s),e.on("data",e=>i.push(e)),e.once("end",()=>t(Buffer.concat(i)))});return Promise.reject(new l("REQ_RESOURCE_TYPE"))}}e.exports=DataResolver},function(e,t,s){"use strict";var i="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;function n(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.assign=function(e){for(var t=Array.prototype.slice.call(arguments,1);t.length;){var s=t.shift();if(s){if("object"!=typeof s)throw new TypeError(s+"must be non-object");for(var i in s)n(s,i)&&(e[i]=s[i])}}return e},t.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var r={arraySet:function(e,t,s,i,n){if(t.subarray&&e.subarray)e.set(t.subarray(s,s+i),n);else for(var r=0;rthis.client.channels?this.client.channels.get(e.channel_id).messages.add(e,!1):e)}sendSlackMessage(e){return this.client.api.webhooks(this.id,this.token).slack.post({query:{wait:!0},auth:!1,data:e}).then(e=>this.client.channels?this.client.channels.get(e.channel_id).messages.add(e,!1):e)}edit({name:e=this.name,avatar:t,channel:s},r){return t&&"string"==typeof t&&!t.startsWith("data:")?i.resolveImage(t).then(t=>this.edit({name:e,avatar:t},r)):(s&&(s=s instanceof n?s.id:s),this.client.api.webhooks(this.id,s?void 0:this.token).patch({data:{name:e,avatar:t,channel_id:s},reason:r}).then(e=>(this.name=e.name,this.avatar=e.avatar,this.channelID=e.channel_id,this)))}delete(e){return this.client.api.webhooks(this.id,this.token).delete({reason:e})}static applyToClass(e){for(const t of["send","sendSlackMessage","edit","delete"])Object.defineProperty(e.prototype,t,Object.getOwnPropertyDescriptor(Webhook.prototype,t))}}e.exports=Webhook},function(e,t,s){"use strict";const i=s(2),n=s(65),{ActivityTypes:r}=s(0);class Activity{constructor(e,t){Object.defineProperty(this,"presence",{value:e}),this.name=t.name,this.type=r[t.type],this.url=t.url||null,this.details=t.details||null,this.state=t.state||null,this.applicationID=t.application_id||null,this.timestamps=t.timestamps?{start:t.timestamps.start?new Date(Number(t.timestamps.start)):null,end:t.timestamps.end?new Date(Number(t.timestamps.end)):null}:null,this.party=t.party||null,this.assets=t.assets?new RichPresenceAssets(this,t.assets):null,this.syncID=t.sync_id,this.flags=new n(t.flags).freeze()}equals(e){return this===e||e&&this.name===e.name&&this.type===e.type&&this.url===e.url}toString(){return this.name}_clone(){return Object.assign(Object.create(this),this)}}class RichPresenceAssets{constructor(e,t){Object.defineProperty(this,"activity",{value:e}),this.largeText=t.large_text||null,this.smallText=t.small_text||null,this.largeImage=t.large_image||null,this.smallImage=t.small_image||null}smallImageURL({format:e,size:t}={}){return this.smallImage?this.activity.presence.client.rest.cdn.AppAsset(this.activity.applicationID,this.smallImage,{format:e,size:t}):null}largeImageURL({format:e,size:t}={}){return this.largeImage?/^spotify:/.test(this.largeImage)?`https://i.scdn.co/image/${this.largeImage.slice(8)}`:this.activity.presence.client.rest.cdn.AppAsset(this.activity.applicationID,this.largeImage,{format:e,size:t}):null}}t.Presence=class Presence{constructor(e,t={}){Object.defineProperty(this,"client",{value:e}),this.userID=t.user.id,this.guild=t.guild,this.patch(t)}get user(){return this.client.users.get(this.userID)||null}get member(){return this.guild.members.get(this.userID)||null}patch(e){this.status=e.status||this.status||"offline";const t=e.game||e.activity;return this.activity=t?new Activity(this,t):null,this.clientStatus=e.client_status||null,this}_clone(){const e=Object.assign(Object.create(this),this);return this.activity&&(e.activity=this.activity._clone()),e}equals(e){return this===e||(e&&this.status===e.status&&this.activity?this.activity.equals(e.activity):!e.activity&&this.clientStatus.web===e.clientStatus.web&&this.clientStatus.mobile===e.clientStatus.mobile&&this.clientStatus.desktop===e.clientStatus.desktop)}toJSON(){return i.flatten(this)}},t.Activity=Activity,t.RichPresenceAssets=RichPresenceAssets},function(e,t,s){"use strict";const i=s(22),n=s(16),r=s(7),o=s(66),a=s(6),l=s(19),{Presence:h}=s(12),{Error:c}=s(4);class GuildMember extends a{constructor(e,t,s){super(e),this.guild=s,this.user={},this.joinedTimestamp=null,this.lastMessageID=null,this.lastMessageChannelID=null,this.deleted=!1,this._roles=[],t&&this._patch(t)}_patch(e){void 0!==e.nick&&(this.nickname=e.nick),e.joined_at&&(this.joinedTimestamp=new Date(e.joined_at).getTime()),e.user&&(this.user=this.guild.client.users.add(e.user)),e.roles&&this.roles._patch(e.roles)}_clone(){const e=super._clone();return e._roles=this._roles.slice(),e}get roles(){return new o(this)}get lastMessage(){const e=this.guild.channels.get(this.lastMessageChannelID);return e&&e.messages.get(this.lastMessageID)||null}get voice(){return this.guild.voiceStates.get(this.id)||new l(this.guild,{user_id:this.id})}get joinedAt(){return this.joinedTimestamp?new Date(this.joinedTimestamp):null}get presence(){return this.guild.presences.get(this.id)||new h(this.client,{user:{id:this.id},guild:this.guild})}get displayColor(){const e=this.roles.color;return e&&e.color||0}get displayHexColor(){const e=this.roles.color;return e&&e.hexColor||"#000000"}get id(){return this.user.id}get displayName(){return this.nickname||this.user.username}get permissions(){return this.user.id===this.guild.ownerID?new r(r.ALL).freeze():new r(this.roles.map(e=>e.permissions)).freeze()}get manageable(){return this.user.id!==this.guild.ownerID&&(this.user.id!==this.client.user.id&&this.guild.me.roles.highest.comparePositionTo(this.roles.highest)>0)}get kickable(){return this.manageable&&this.guild.me.permissions.has(r.FLAGS.KICK_MEMBERS)}get bannable(){return this.manageable&&this.guild.me.permissions.has(r.FLAGS.BAN_MEMBERS)}permissionsIn(e){if(!(e=this.guild.channels.resolve(e)))throw new c("GUILD_CHANNEL_RESOLVE");return e.memberPermissions(this)}hasPermission(e,{checkAdmin:t=!0,checkOwner:s=!0}={}){return!(!s||this.user.id!==this.guild.ownerID)||this.roles.some(s=>s.permissions.has(e,t))}async edit(e,t){if(e.channel){if(e.channel=this.guild.channels.resolve(e.channel),!e.channel||"voice"!==e.channel.type)throw new c("GUILD_VOICE_CHANNEL_RESOLVE");e.channel_id=e.channel.id,e.channel=null}e.roles&&(e.roles=e.roles.map(e=>e instanceof n?e.id:e));let s=this.client.api.guilds(this.guild.id);if(this.user.id===this.client.user.id){const t=Object.keys(e);s=1===t.length&&"nick"===t[0]?s.members("@me").nick:s.members(this.id)}else s=s.members(this.id);await s.patch({data:e,reason:t});const i=this._clone();return e.user=this.user,i._patch(e),i}setMute(e,t){return this.edit({mute:e},t)}setDeaf(e,t){return this.edit({deaf:e},t)}setVoiceChannel(e){return this.edit({channel:e})}setNickname(e,t){return this.edit({nick:e},t)}createDM(){return this.user.createDM()}deleteDM(){return this.user.deleteDM()}kick(e){return this.client.api.guilds(this.guild.id).members(this.user.id).delete({reason:e}).then(()=>this)}ban(e){return this.guild.members.ban(this,e)}toString(){return`<@${this.nickname?"!":""}${this.user.id}>`}toJSON(){return super.toJSON({guild:"guildID",user:"userID",displayName:!0,speaking:!1,lastMessage:!1,lastMessageID:!1,roles:!0})}send(){}}i.applyToClass(GuildMember),e.exports=GuildMember},function(e,t,s){"use strict";const i=s(8),n=s(6),{ChannelTypes:r}=s(0);e.exports=class Channel extends n{constructor(e,t){super(e);const s=Object.keys(r)[t.type];this.type=s?s.toLowerCase():"unknown",this.deleted=!1,t&&this._patch(t)}_patch(e){this.id=e.id}get createdTimestamp(){return i.deconstruct(this.id).timestamp}get createdAt(){return new Date(this.createdTimestamp)}toString(){return`<#${this.id}>`}delete(){return this.client.api.channels(this.id).delete().then(()=>this)}fetch(){return this.client.channels.fetch(this.id,!0,!0)}static create(e,t,i){const n=s(18);let o;if(t.type===r.DM||t.type!==r.GROUP&&!t.guild_id&&!i)o=new(n.get("DMChannel"))(e,t);else if(i=i||e.guilds.get(t.guild_id)){switch(t.type){case r.TEXT:o=new(n.get("TextChannel"))(i,t);break;case r.VOICE:o=new(n.get("VoiceChannel"))(i,t);break;case r.CATEGORY:o=new(n.get("CategoryChannel"))(i,t);break;default:o=new(n.get("GuildChannel"))(i,t)}i.channels.set(o.id,o)}return o}toJSON(...e){return super.toJSON({createdTimestamp:!0},...e)}}},function(e,t,s){"use strict";const i=s(22),{Presence:n}=s(12),r=s(8),o=s(6),{Error:a}=s(4);class User extends o{constructor(e,t){super(e),this.id=t.id,this.bot=Boolean(t.bot),this._patch(t)}_patch(e){e.username&&(this.username=e.username),e.discriminator&&(this.discriminator=e.discriminator),void 0!==e.avatar&&(this.avatar=e.avatar),e.locale&&(this.locale=e.locale),this.lastMessageID=null,this.lastMessageChannelID=null}get createdTimestamp(){return r.deconstruct(this.id).timestamp}get createdAt(){return new Date(this.createdTimestamp)}get lastMessage(){const e=this.client.channels.get(this.lastMessageChannelID);return e&&e.messages.get(this.lastMessageID)||null}get presence(){for(const e of this.client.guilds.values())if(e.presences.has(this.id))return e.presences.get(this.id);return new n(this.client,{user:{id:this.id}})}avatarURL({format:e,size:t}={}){return this.avatar?this.client.rest.cdn.Avatar(this.id,this.avatar,e,t):null}get defaultAvatarURL(){return this.client.rest.cdn.DefaultAvatar(this.discriminator%5)}displayAvatarURL(e){return this.avatarURL(e)||this.defaultAvatarURL}get tag(){return`${this.username}#${this.discriminator}`}typingIn(e){return(e=this.client.channels.resolve(e))._typing.has(this.id)}typingSinceIn(e){return(e=this.client.channels.resolve(e))._typing.has(this.id)?new Date(e._typing.get(this.id).since):null}typingDurationIn(e){return(e=this.client.channels.resolve(e))._typing.has(this.id)?e._typing.get(this.id).elapsedTime:-1}get dmChannel(){return this.client.channels.find(e=>"dm"===e.type&&e.recipient.id===this.id)||null}createDM(){return this.dmChannel?Promise.resolve(this.dmChannel):this.client.api.users(this.client.user.id).channels.post({data:{recipient_id:this.id}}).then(e=>this.client.actions.ChannelCreate.handle(e).channel)}deleteDM(){return this.dmChannel?this.client.api.channels(this.dmChannel.id).delete().then(e=>this.client.actions.ChannelDelete.handle(e).channel):Promise.reject(new a("USER_NO_DMCHANNEL"))}equals(e){return e&&this.id===e.id&&this.username===e.username&&this.discriminator===e.discriminator&&this.avatar===e.avatar}toString(){return`<@${this.id}>`}toJSON(...e){const t=super.toJSON({createdTimestamp:!0,defaultAvatarURL:!0,tag:!0,lastMessage:!1,lastMessageID:!1},...e);return t.avatarURL=this.avatarURL(),t.displayAvatarURL=this.displayAvatarURL(),t}send(){}}i.applyToClass(User),e.exports=User},function(e,t,s){"use strict";const i=s(8),n=s(7),r=s(2),o=s(6),{Error:a,TypeError:l}=s(4);e.exports=class Role extends o{constructor(e,t,s){super(e),this.guild=s,t&&this._patch(t)}_patch(e){this.id=e.id,this.name=e.name,this.color=e.color,this.hoist=e.hoist,this.rawPosition=e.position,this.permissions=new n(e.permissions).freeze(),this.managed=e.managed,this.mentionable=e.mentionable,this.deleted=!1}get createdTimestamp(){return i.deconstruct(this.id).timestamp}get createdAt(){return new Date(this.createdTimestamp)}get hexColor(){return`#${this.color.toString(16).padStart(6,"0")}`}get members(){return this.guild.members.filter(e=>e.roles.has(this.id))}get editable(){if(this.managed)return!1;const e=this.guild.member(this.client.user);return!!e.permissions.has(n.FLAGS.MANAGE_ROLES)&&e.roles.highest.comparePositionTo(this)>0}get position(){const e=this.guild._sortedRoles();return e.array().indexOf(e.get(this.id))}comparePositionTo(e){return(e=this.guild.roles.resolve(e))?this.constructor.comparePositions(this,e):Promise.reject(new l("INVALID_TYPE","role","Role nor a Snowflake"))}async edit(e,t){return e.permissions?e.permissions=n.resolve(e.permissions):e.permissions=this.permissions.bitfield,void 0!==e.position&&await r.setPosition(this,e.position,!1,this.guild._sortedRoles(),this.client.api.guilds(this.guild.id).roles,t).then(e=>{this.client.actions.GuildRolesPositionUpdate.handle({guild_id:this.guild.id,roles:e})}),this.client.api.guilds[this.guild.id].roles[this.id].patch({data:{name:e.name||this.name,color:null!==e.color?r.resolveColor(e.color||this.color):null,hoist:void 0!==e.hoist?e.hoist:this.hoist,permissions:e.permissions,mentionable:void 0!==e.mentionable?e.mentionable:this.mentionable},reason:t}).then(e=>{const t=this._clone();return t._patch(e),t})}permissionsIn(e){if(!(e=this.guild.channels.resolve(e)))throw new a("GUILD_CHANNEL_RESOLVE");return e.rolePermissions(this)}setName(e,t){return this.edit({name:e},t)}setColor(e,t){return this.edit({color:e},t)}setHoist(e,t){return this.edit({hoist:e},t)}setPermissions(e,t){return this.edit({permissions:e},t)}setMentionable(e,t){return this.edit({mentionable:e},t)}setPosition(e,{relative:t,reason:s}={}){return r.setPosition(this,e,t,this.guild._sortedRoles(),this.client.api.guilds(this.guild.id).roles,s).then(e=>(this.client.actions.GuildRolesPositionUpdate.handle({guild_id:this.guild.id,roles:e}),this))}delete(e){return this.client.api.guilds[this.guild.id].roles[this.id].delete({reason:e}).then(()=>(this.client.actions.GuildRoleDelete.handle({guild_id:this.guild.id,role_id:this.id}),this))}equals(e){return e&&this.id===e.id&&this.name===e.name&&this.color===e.color&&this.hoist===e.hoist&&this.position===e.position&&this.permissions.bitfield===e.permissions.bitfield&&this.managed===e.managed}toString(){return this.id===this.guild.id?"@everyone":`<@&${this.id}>`}toJSON(){return super.toJSON({createdTimestamp:!0})}static comparePositions(e,t){return e.position===t.position?t.id-e.id:e.position-t.position}}},function(e,t,s){"use strict";const i=s(14),n=s(16),r=s(26),o=s(41),a=s(2),l=s(7),h=s(3),{Error:c,TypeError:u}=s(4);e.exports=class GuildChannel extends i{constructor(e,t){super(e.client,t),this.guild=e}_patch(e){if(super._patch(e),this.name=e.name,this.rawPosition=e.position,this.parentID=e.parent_id,this.permissionOverwrites=new h,e.permission_overwrites)for(const t of e.permission_overwrites)this.permissionOverwrites.set(t.id,new o(this,t))}get parent(){return this.guild.channels.get(this.parentID)||null}get permissionsLocked(){return this.parent?this.permissionOverwrites.size===this.parent.permissionOverwrites.size&&this.permissionOverwrites.every((e,t)=>{const s=this.parent.permissionOverwrites.get(t);return void 0!==s&&s.deny.bitfield===e.deny.bitfield&&s.allow.bitfield===e.allow.bitfield}):null}get position(){const e=this.guild._sortedChannels(this);return e.array().indexOf(e.get(this.id))}permissionsFor(e){const t=this.guild.members.resolve(e);if(t)return this.memberPermissions(t);const s=this.guild.roles.resolve(e);return s?this.rolePermissions(s):null}overwritesFor(e,t=!1,s=null){if(t||(e=this.guild.members.resolve(e)),!e)return[];s=s||e.roles;const i=[];let n,r;for(const t of this.permissionOverwrites.values())t.id===this.guild.id?r=t:s.has(t.id)?i.push(t):t.id===e.id&&(n=t);return{everyone:r,roles:i,member:n}}memberPermissions(e){if(e.id===this.guild.ownerID)return new l(l.ALL).freeze();const t=e.roles,s=new l(t.map(e=>e.permissions));if(s.has(l.FLAGS.ADMINISTRATOR))return new l(l.ALL).freeze();const i=this.overwritesFor(e,!0,t);return s.remove(i.everyone?i.everyone.deny:0).add(i.everyone?i.everyone.allow:0).remove(i.roles.length>0?i.roles.map(e=>e.deny):0).add(i.roles.length>0?i.roles.map(e=>e.allow):0).remove(i.member?i.member.deny:0).add(i.member?i.member.allow:0).freeze()}rolePermissions(e){if(e.permissions.has(l.FLAGS.ADMINISTRATOR))return new l(l.ALL).freeze();const t=this.permissionOverwrites.get(this.guild.id),s=this.permissionOverwrites.get(e.id);return e.permissions.remove(t?t.deny:0).add(t?t.allow:0).remove(s?s.deny:0).add(s?s.allow:0).freeze()}overwritePermissions(e={}){return this.edit(e).then(()=>this)}updateOverwrite(e,t,s){if(!(e=this.guild.roles.resolve(e)||this.client.users.resolve(e)))return Promise.reject(new u("INVALID_TYPE","parameter","User nor a Role",!0));const i=this.permissionOverwrites.get(e.id);return i?i.update(t,s).then(()=>this):this.createOverwrite(e,t,s)}createOverwrite(e,t,s){if(!(e=this.guild.roles.resolve(e)||this.client.users.resolve(e)))return Promise.reject(new u("INVALID_TYPE","parameter","User nor a Role",!0));const i=e instanceof n?"role":"member",{allow:r,deny:a}=o.resolveOverwriteOptions(t);return this.client.api.channels(this.id).permissions[e.id].put({data:{id:e.id,type:i,allow:r.bitfield,deny:a.bitfield},reason:s}).then(()=>this)}lockPermissions(){if(!this.parent)return Promise.reject(new c("GUILD_CHANNEL_ORPHAN"));const e=this.parent.permissionOverwrites.map(e=>e.toJSON());return this.edit({permissionOverwrites:e})}get members(){const e=new h;for(const t of this.guild.members.values())this.permissionsFor(t).has("VIEW_CHANNEL",!1)&&e.set(t.id,t);return e}async edit(e,t){void 0!==e.position&&await a.setPosition(this,e.position,!1,this.guild._sortedChannels(this),this.client.api.guilds(this.guild.id).channels,t).then(e=>{this.client.actions.GuildChannelsPositionUpdate.handle({guild_id:this.guild.id,channels:e})});const s=e.permissionOverwrites&&e.permissionOverwrites.map(e=>o.resolve(e,this.guild)),i=await this.client.api.channels(this.id).patch({data:{name:(e.name||this.name).trim(),topic:e.topic,nsfw:e.nsfw,bitrate:e.bitrate||this.bitrate,user_limit:void 0!==e.userLimit?e.userLimit:this.userLimit,parent_id:e.parentID,lock_permissions:e.lockPermissions,rate_limit_per_user:e.rateLimitPerUser,permission_overwrites:s},reason:t}),n=this._clone();return n._patch(i),n}setName(e,t){return this.edit({name:e},t)}setParent(e,{lockPermissions:t=!0,reason:s}={}){return this.edit({parentID:null!==e?e.hasOwnProperty("id")?e.id:e:null,lockPermissions:t},s)}setTopic(e,t){return this.edit({topic:e},t)}setPosition(e,{relative:t,reason:s}={}){return a.setPosition(this,e,t,this.guild._sortedChannels(this),this.client.api.guilds(this.guild.id).channels,s).then(e=>(this.client.actions.GuildChannelsPositionUpdate.handle({guild_id:this.guild.id,channels:e}),this))}createInvite({temporary:e=!1,maxAge:t=86400,maxUses:s=0,unique:i,reason:n}={}){return this.client.api.channels(this.id).invites.post({data:{temporary:e,max_age:t,max_uses:s,unique:i},reason:n}).then(e=>new r(this.client,e))}async fetchInvites(){const e=await this.client.api.channels(this.id).invites.get(),t=new h;for(const s of e){const e=new r(this.client,s);t.set(e.code,e)}return t}clone(e={}){return a.mergeDefault({name:this.name,permissionOverwrites:this.permissionOverwrites,topic:this.topic,type:this.type,nsfw:this.nsfw,parent:this.parent,bitrate:this.bitrate,userLimit:this.userLimit,rateLimitPerUser:this.rateLimitPerUser,reason:null},e),this.guild.channels.create(e.name,e)}equals(e){let t=e&&this.id===e.id&&this.type===e.type&&this.topic===e.topic&&this.position===e.position&&this.name===e.name;return t&&(t=this.permissionOverwrites&&e.permissionOverwrites?this.permissionOverwrites.equals(e.permissionOverwrites):!this.permissionOverwrites&&!e.permissionOverwrites),t}get deletable(){return this.permissionsFor(this.client.user).has(l.FLAGS.MANAGE_CHANNELS,!1)}get manageable(){if(this.client.user.id===this.guild.ownerID)return!0;const e=this.permissionsFor(this.client.user);return!!e&&e.has([l.FLAGS.MANAGE_CHANNELS,l.FLAGS.VIEW_CHANNEL],!1)}delete(e){return this.client.api.channels(this.id).delete({reason:e}).then(()=>this)}}},function(e,t,s){"use strict";const i={GuildEmoji:s(21),DMChannel:s(63),TextChannel:s(70),VoiceChannel:s(71),CategoryChannel:s(72),GuildChannel:s(17),GuildMember:s(13),Guild:s(42),Message:s(25),MessageReaction:s(39),Presence:s(12).Presence,ClientPresence:s(79),VoiceState:s(19),Role:s(16),User:s(15)};e.exports=class Structures{constructor(){throw new Error(`The ${this.constructor.name} class may not be instantiated.`)}static get(e){if("string"==typeof e)return i[e];throw new TypeError(`"structure" argument must be a string (received ${typeof e})`)}static extend(e,t){if(!i[e])throw new RangeError(`"${e}" is not a valid extensible structure.`);if("function"!=typeof t)throw new TypeError(`"extender" argument must be a function that returns the extended structure class/prototype ${`(received ${typeof t})`}`);const s=t(i[e]);if("function"!=typeof s)throw new TypeError("The extender function must return the extended structure class/prototype.");if(Object.getPrototypeOf(s)!==i[e])throw new Error("The class/prototype returned from the extender function must extend the existing structure class/prototype.");return i[e]=s,s}}},function(e,t,s){"use strict";const i=s(6);e.exports=class VoiceState extends i{constructor(e,t){super(e.client),this.guild=e,this.id=t.user_id,this._patch(t)}_patch(e){return this.serverDeaf=e.deaf,this.serverMute=e.mute,this.selfDeaf=e.self_deaf,this.selfMute=e.self_mute,this.sessionID=e.session_id,this.channelID=e.channel_id,this}get member(){return this.guild.members.get(this.id)||null}get channel(){return this.guild.channels.get(this.channelID)||null}get deaf(){return this.serverDeaf||this.selfDeaf}get mute(){return this.serverMute||this.selfMute}get speaking(){return this.channel&&this.channel.connection?Boolean(this.channel.connection._speaking.get(this.id)):null}setMute(e,t){return this.member?this.member.edit({mute:e},t):Promise.reject(new Error("VOICE_STATE_UNCACHED_MEMBER"))}setDeaf(e,t){return this.member?this.member.edit({deaf:e},t):Promise.reject(new Error("VOICE_STATE_UNCACHED_MEMBER"))}toJSON(){return super.toJSON({id:!0,serverDeaf:!0,serverMute:!0,selfDeaf:!0,selfMute:!0,sessionID:!0,channelID:"channel"})}}},function(e,t,s){"use strict";const{RangeError:i}=s(4);class BitField{constructor(e){this.bitfield=this.constructor.resolve(e)}equals(e){return this.bitfield===this.constructor.resolve(e)}has(e){return e instanceof Array?e.every(e=>this.has(e)):(e=this.constructor.resolve(e),(this.bitfield&e)===e)}missing(e,...t){return e instanceof Array||(e=new this.constructor(e).toArray(!1)),e.filter(e=>!this.has(e,...t))}freeze(){return Object.freeze(this)}add(...e){let t=0;for(const s of e)t|=this.constructor.resolve(s);return Object.isFrozen(this)?new this.constructor(this.bitfield|t):(this.bitfield|=t,this)}remove(...e){let t=0;for(const s of e)t|=this.constructor.resolve(s);return Object.isFrozen(this)?new this.constructor(this.bitfield&~t):(this.bitfield&=~t,this)}serialize(...e){const t={};for(const s in this.constructor.FLAGS)t[s]=this.has(s,...e);return t}toArray(...e){return Object.keys(this.constructor.FLAGS).filter(t=>this.has(t,...e))}toJSON(){return this.bitfield}valueOf(){return this.bitfield}*[Symbol.iterator](){yield*this.toArray()}static resolve(e=0){if("number"==typeof e&&e>=0)return e;if(e instanceof BitField)return e.bitfield;if(e instanceof Array)return e.map(e=>this.resolve(e)).reduce((e,t)=>e|t,0);if("string"==typeof e)return this.FLAGS[e];throw new i("BITFIELD_INVALID")}}BitField.FLAGS={},e.exports=BitField},function(e,t,s){"use strict";const i=s(62),n=s(7),{Error:r}=s(4),o=s(33);class GuildEmoji extends o{constructor(e,t,s){super(e,t),this.guild=s,this._roles=[],this._patch(t)}_patch(e){e.name&&(this.name=e.name),void 0!==e.require_colons&&(this.requiresColons=e.require_colons),void 0!==e.managed&&(this.managed=e.managed),e.roles&&(this._roles=e.roles)}_clone(){const e=super._clone();return e._roles=this._roles.slice(),e}get deletable(){return!this.managed&&this.guild.me.hasPermission(n.FLAGS.MANAGE_EMOJIS)}get roles(){return new i(this)}fetchAuthor(){return this.managed?Promise.reject(new r("EMOJI_MANAGED")):this.guild.me.permissions.has(n.FLAGS.MANAGE_EMOJIS)?this.client.api.guilds(this.guild.id).emojis(this.id).get().then(e=>this.client.users.add(e.user)):Promise.reject(new r("MISSING_MANAGE_EMOJIS_PERMISSION",this.guild))}edit(e,t){const s=e.roles?e.roles.map(e=>e.id||e):void 0;return this.client.api.guilds(this.guild.id).emojis(this.id).patch({data:{name:e.name,roles:s},reason:t}).then(e=>{const t=this._clone();return t._patch(e),t})}setName(e,t){return this.edit({name:e},t)}delete(e){return this.client.api.guilds(this.guild.id).emojis(this.id).delete({reason:e}).then(()=>this)}equals(e){return e instanceof GuildEmoji?e.id===this.id&&e.name===this.name&&e.managed===this.managed&&e.requiresColons===this.requiresColons&&e.roles.size===this.roles.size&&e.roles.every(e=>this.roles.has(e.id)):e.id===this.id&&e.name===this.name&&e.roles.length===this.roles.size&&e.roles.every(e=>this.roles.has(e))}}e.exports=GuildEmoji},function(e,t,s){"use strict";const i=s(64),n=s(8),r=s(3),{RangeError:o,TypeError:a}=s(4),l=s(23);class TextBasedChannel{constructor(){this.messages=new h(this),this.lastMessageID=null,this.lastPinTimestamp=null}get lastMessage(){return this.messages.get(this.lastMessageID)||null}get lastPinAt(){return this.lastPinTimestamp?new Date(this.lastPinTimestamp):null}async send(e,t){const i=s(15),n=s(13);if(this instanceof i||this instanceof n)return this.createDM().then(s=>s.send(e,t));let r;if(e instanceof l)r=e.resolveData();else if((r=l.create(this,e,t).resolveData()).data.content instanceof Array)return Promise.all(r.split().map(this.send.bind(this)));const{data:o,files:a}=await r.resolveFiles();return this.client.api.channels[this.id].messages.post({data:o,files:a}).then(e=>this.client.actions.MessageCreate.handle(e).message)}startTyping(e){if(void 0!==e&&e<1)throw new o("TYPING_COUNT");if(this.client.user._typing.has(this.id)){const t=this.client.user._typing.get(this.id);return t.count=e||t.count+1,t.promise}const t={};return t.promise=new Promise((s,i)=>{const n=this.client.api.channels[this.id].typing;Object.assign(t,{count:e||1,interval:this.client.setInterval(()=>{n.post().catch(e=>{this.client.clearInterval(t.interval),this.client.user._typing.delete(this.id),i(e)})},9e3),resolve:s}),n.post().catch(e=>{this.client.clearInterval(t.interval),this.client.user._typing.delete(this.id),i(e)}),this.client.user._typing.set(this.id,t)}),t.promise}stopTyping(e=!1){if(this.client.user._typing.has(this.id)){const t=this.client.user._typing.get(this.id);t.count--,(t.count<=0||e)&&(this.client.clearInterval(t.interval),this.client.user._typing.delete(this.id),t.resolve())}}get typing(){return this.client.user._typing.has(this.id)}get typingCount(){return this.client.user._typing.has(this.id)?this.client.user._typing.get(this.id).count:0}createMessageCollector(e,t={}){return new i(this,e,t)}awaitMessages(e,t={}){return new Promise((s,i)=>{this.createMessageCollector(e,t).once("end",(e,n)=>{t.errors&&t.errors.includes(n)?i(e):s(e)})})}async bulkDelete(e,t=!1){if(e instanceof Array||e instanceof r){let s=e instanceof r?e.keyArray():e.map(e=>e.id||e);if(t&&(s=s.filter(e=>Date.now()-n.deconstruct(e).date.getTime()<12096e5)),0===s.length)return new r;if(1===s.length){await this.client.api.channels(this.id).messages(s[0]).delete();const e=this.client.actions.MessageDelete.handle({channel_id:this.id,id:s[0]}).message;return e?new r([[e.id,e]]):new r}return await this.client.api.channels[this.id].messages["bulk-delete"].post({data:{messages:s}}),this.client.actions.MessageDeleteBulk.handle({channel_id:this.id,ids:s}).messages}if(!isNaN(e)){const s=await this.messages.fetch({limit:e});return this.bulkDelete(s,t)}throw new a("MESSAGE_BULK_DELETE_TYPE")}static applyToClass(e,t=!1,s=[]){const i=["send"];t&&i.push("lastMessage","lastPinAt","bulkDelete","startTyping","stopTyping","typing","typingCount","createMessageCollector","awaitMessages");for(const t of i)s.includes(t)||Object.defineProperty(e.prototype,t,Object.getOwnPropertyDescriptor(TextBasedChannel.prototype,t))}}e.exports=TextBasedChannel;const h=s(24)},function(e,t,s){"use strict";const i=s(9),n=s(35),r=s(36),{browser:o}=s(0),a=s(2),{RangeError:l}=s(4);class APIMessage{constructor(e,t){this.target=e,this.options=t,this.data=null,this.files=null}get isWebhook(){const e=s(11),t=s(37);return this.target instanceof e||this.target instanceof t}get isUser(){const e=s(15),t=s(13);return this.target instanceof e||this.target instanceof t}makeContent(){const e=s(13);let t=a.resolveString(null==this.options.content?"":this.options.content);const i=void 0!==this.options.split&&!1!==this.options.split,n=void 0!==this.options.code&&!1!==this.options.code,r=i?{...this.options.split}:void 0;let o="";if(this.options.reply&&!this.isUser&&"dm"!==this.target.type){const t=this.target.client.users.resolveID(this.options.reply);o=`<@${this.options.reply instanceof e&&this.options.reply.nickname?"!":""}${t}>, `,i&&(r.prepend=`${o}${r.prepend||""}`)}if(t||o){if(n){const e="string"==typeof this.options.code?this.options.code:"";t=`${o}\`\`\`${e}\n${a.escapeMarkdown(t,!0)}\n\`\`\``,i&&(r.prepend=`${r.prepend||""}\`\`\`${e}\n`,r.append=`\n\`\`\`${r.append||""}`)}else o&&(t=`${o}${t}`);(void 0===this.options.disableEveryone?this.target.client.options.disableEveryone:this.options.disableEveryone)&&(t=t.replace(/@(everyone|here)/g,"@​$1")),i&&(t=a.splitMessage(t,r))}return t}resolveData(){if(this.data)return this;const e=this.makeContent(),t=Boolean(this.options.tts);let s;if(void 0!==this.options.nonce&&(s=parseInt(this.options.nonce),isNaN(s)||s<0))throw new l("MESSAGE_NONCE_TYPE");const i=[];this.isWebhook?this.options.embeds&&i.push(...this.options.embeds):this.options.embed&&i.push(this.options.embed);const r=i.map(e=>new n(e)._apiTransform());let o,a;return this.isWebhook&&(o=this.options.username||this.target.name,this.options.avatarURL&&(a=this.options.avatarURL)),this.data={content:e,tts:t,nonce:s,embed:null===this.options.embed?null:r[0],embeds:r,username:o,avatar_url:a},this}async resolveFiles(){if(this.files)return this;const e=[];this.isWebhook?this.options.embeds&&e.push(...this.options.embeds):this.options.embed&&e.push(this.options.embed);const t=[];this.options.files&&t.push(...this.options.files);for(const s of e)s.files&&t.push(...s.files);return this.files=await Promise.all(t.map(e=>this.constructor.resolveFile(e))),this}split(){if(this.data||this.resolveData(),!(this.data.content instanceof Array))return[this];const e=[];for(let t=0;t"string"==typeof e?a.basename(e):e.path?a.basename(e.path):"file.jpg";return"string"==typeof e||e instanceof(o?ArrayBuffer:Buffer)||"function"==typeof e.pipe?s=n(t=e):(t=e.attachment,s=e.name||n(t)),{attachment:t,name:s,file:await i.resolveFile(t)}}static partitionMessageAdditions(e){const t=[],s=[];for(const i of e)i instanceof n?t.push(i):i instanceof r&&s.push(i);return[t,s]}static transformOptions(e,t,s={},i=!1){if(t||"object"!=typeof e||e instanceof Array||(t=e,e=""),t){if(t instanceof n)return i?{content:e,embeds:[t],...s}:{content:e,embed:t,...s};if(t instanceof r)return{content:e,files:[t],...s}}else t={};if(t instanceof Array){const[n,r]=this.partitionMessageAdditions(t);return i?{content:e,embeds:n,files:r,...s}:{content:e,embed:n[0],files:r,...s}}if(e instanceof Array){const[t,n]=this.partitionMessageAdditions(e);if(t.length||n.length)return i?{embeds:t,files:n,...s}:{embed:t[0],files:n,...s}}return{content:e,...t,...s}}static create(e,t,i,n={}){const r=s(11),o=s(37),a=e instanceof r||e instanceof o;return new this(e,this.transformOptions(t,i,n,a))}}e.exports=APIMessage},function(e,t,s){"use strict";const i=s(5),n=s(3),r=s(25);e.exports=class MessageStore extends i{constructor(e,t){super(e.client,t,r),this.channel=e}add(e,t){return super.add(e,t,{extras:[this.channel]})}set(e,t){const s=this.client.options.messageCacheMaxSize;0!==s&&(this.size>=s&&s>0&&this.delete(this.firstKey()),super.set(e,t))}fetch(e){return"string"==typeof e?this._fetchId(e):this._fetchMany(e)}fetchPinned(){return this.client.api.channels[this.channel.id].pins.get().then(e=>{const t=new n;for(const s of e)t.set(s.id,this.add(s));return t})}async _fetchId(e){const t=await this.client.api.channels[this.channel.id].messages[e].get();return this.add(t)}async _fetchMany(e={}){const t=await this.client.api.channels[this.channel.id].messages.get({query:e}),s=new n;for(const e of t)s.set(e.id,this.add(e));return s}}},function(e,t,s){"use strict";const i=s(67),n=s(36),r=s(35),o=s(68),a=s(38),l=s(2),h=s(3),c=s(138),{MessageTypes:u}=s(0),d=s(7),p=s(6),{Error:m,TypeError:f}=s(4),_=s(23);e.exports=class Message extends p{constructor(e,t,s){super(e),this.channel=s,this.deleted=!1,t&&this._patch(t)}_patch(e){if(this.id=e.id,this.type=u[e.type],this.content=e.content,this.author=e.author?this.client.users.add(e.author,!e.webhook_id):null,this.pinned=e.pinned,this.tts=e.tts,this.nonce=e.nonce,this.system=6===e.type,this.embeds=(e.embeds||[]).map(e=>new r(e)),this.attachments=new h,e.attachments)for(const t of e.attachments)this.attachments.set(t.id,new n(t.url,t.filename,t));if(this.createdTimestamp=new Date(e.timestamp).getTime(),this.editedTimestamp=e.edited_timestamp?new Date(e.edited_timestamp).getTime():null,this.reactions=new c(this),e.reactions&&e.reactions.length>0)for(const t of e.reactions)this.reactions.add(t);this.mentions=new i(this,e.mentions,e.mention_roles,e.mention_everyone),this.webhookID=e.webhook_id||null,this.application=e.application?new a(this.client,e.application):null,this.activity=e.activity?{partyID:e.activity.party_id,type:e.activity.type}:null,this.hit="boolean"==typeof e.hit?e.hit:null,this._edits=[],this.member&&e.member?this.member._patch(e.member):e.member&&this.guild&&this.author&&this.guild.members.add(Object.assign(e.member,{user:this.author}))}get partial(){return this.channel.partial||!this.content||!this.author}patch(e){const t=this._clone();if(this._edits.unshift(t),this.editedTimestamp=new Date(e.edited_timestamp).getTime(),"content"in e&&(this.content=e.content),"pinned"in e&&(this.pinned=e.pinned),"tts"in e&&(this.tts=e.tts),this.embeds="embeds"in e?e.embeds.map(e=>new r(e)):this.embeds.slice(),"attachments"in e){this.attachments=new h;for(const t of e.attachments)this.attachments.set(t.id,new n(t.url,t.filename,t))}else this.attachments=new h(this.attachments);this.mentions=new i(this,"mentions"in e?e.mentions:this.mentions.users,"mentions_roles"in e?e.mentions_roles:this.mentions.roles,"mention_everyone"in e?e.mention_everyone:this.mentions.everyone)}get member(){return this.guild&&this.guild.member(this.author)||null}get createdAt(){return new Date(this.createdTimestamp)}get editedAt(){return this.editedTimestamp?new Date(this.editedTimestamp):null}get guild(){return this.channel.guild||null}get url(){return`https://discordapp.com/channels/${this.guild?this.guild.id:"@me"}/${this.channel.id}/${this.id}`}get cleanContent(){return l.cleanContent(this.content,this)}createReactionCollector(e,t={}){return new o(this,e,t)}awaitReactions(e,t={}){return new Promise((s,i)=>{this.createReactionCollector(e,t).once("end",(e,n)=>{t.errors&&t.errors.includes(n)?i(e):s(e)})})}get edits(){const e=this._edits.slice();return e.unshift(this),e}get editable(){return this.author.id===this.client.user.id}get deletable(){return!this.deleted&&(this.author.id===this.client.user.id||this.guild&&this.channel.permissionsFor(this.client.user).has(d.FLAGS.MANAGE_MESSAGES,!1))}get pinnable(){return!this.guild||this.channel.permissionsFor(this.client.user).has(d.FLAGS.MANAGE_MESSAGES,!1)}edit(e,t){const{data:s}=e instanceof _?e.resolveData():_.create(this,e,t).resolveData();return this.client.api.channels[this.channel.id].messages[this.id].patch({data:s}).then(e=>{const t=this._clone();return t._patch(e),t})}pin(){return this.client.api.channels(this.channel.id).pins(this.id).put().then(()=>this)}unpin(){return this.client.api.channels(this.channel.id).pins(this.id).delete().then(()=>this)}react(e){if(!(e=this.client.emojis.resolveIdentifier(e)))throw new f("EMOJI_TYPE");return this.client.api.channels(this.channel.id).messages(this.id).reactions(e,"@me").put().then(()=>this.client.actions.MessageReactionAdd.handle({user:this.client.user,channel:this.channel,message:this,emoji:l.parseEmoji(e)}).reaction)}delete({timeout:e=0,reason:t}={}){return e<=0?this.client.api.channels(this.channel.id).messages(this.id).delete({reason:t}).then(()=>this.client.actions.MessageDelete.handle({id:this.id,channel_id:this.channel.id}).message):new Promise(s=>{this.client.setTimeout(()=>{s(this.delete({reason:t}))},e)})}reply(e,t){return this.channel.send(e instanceof _?e:_.transformOptions(e,t,{reply:this.member||this.author}))}fetch(){return this.channel.messages.fetch(this.id)}fetchWebhook(){return this.webhookID?this.client.fetchWebhook(this.webhookID):Promise.reject(new m("WEBHOOK_MESSAGE"))}equals(e,t){if(!e)return!1;if(!e.author&&!e.attachments)return this.id===e.id&&this.embeds.length===e.embeds.length;let s=this.id===e.id&&this.author.id===e.author.id&&this.content===e.content&&this.tts===e.tts&&this.nonce===e.nonce&&this.embeds.length===e.embeds.length&&this.attachments.length===e.attachments.length;return s&&t&&(s=this.mentions.everyone===e.mentions.everyone&&this.createdTimestamp===new Date(t.timestamp).getTime()&&this.editedTimestamp===new Date(t.edited_timestamp).getTime()),s}toString(){return this.content}toJSON(){return super.toJSON({channel:"channelID",author:"authorID",application:"applicationID",guild:"guildID",cleanContent:!0,member:!1,reactions:!1})}}},function(e,t,s){"use strict";const{Endpoints:i}=s(0),n=s(6);e.exports=class Invite extends n{constructor(e,t){super(e),this._patch(t)}_patch(e){this.guild=e.guild?this.client.guilds.add(e.guild,!1):null,this.code=e.code,this.presenceCount="approximate_presence_count"in e?e.approximate_presence_count:null,this.memberCount="approximate_member_count"in e?e.approximate_member_count:null,this.temporary="temporary"in e?e.temporary:null,this.maxAge="max_age"in e?e.max_age:null,this.uses="uses"in e?e.uses:null,this.maxUses="max_uses"in e?e.max_uses:null,this.inviter=e.inviter?this.client.users.add(e.inviter):null,this.channel=this.client.channels.add(e.channel,this.guild,!1),this.createdTimestamp="created_at"in e?new Date(e.created_at).getTime():null}get createdAt(){return this.createdTimestamp?new Date(this.createdTimestamp):null}get expiresTimestamp(){return this.createdTimestamp&&this.maxAge?this.createdTimestamp+1e3*this.maxAge:null}get expiresAt(){const{expiresTimestamp:e}=this;return e?new Date(e):null}get url(){return i.invite(this.client.options.http.invite,this.code)}delete(e){return this.client.api.invites[this.code].delete({reason:e}).then(()=>this)}toString(){return this.url}toJSON(){return super.toJSON({url:!0,expiresTimestamp:!0,presenceCount:!1,memberCount:!1,uses:!1,channel:"channelID",inviter:"inviterID",guild:"guildID"})}}},function(e,t){var s,i,n=e.exports={};function r(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function a(e){if(s===setTimeout)return setTimeout(e,0);if((s===r||!s)&&setTimeout)return s=setTimeout,setTimeout(e,0);try{return s(e,0)}catch(t){try{return s.call(null,e,0)}catch(t){return s.call(this,e,0)}}}!function(){try{s="function"==typeof setTimeout?setTimeout:r}catch(e){s=r}try{i="function"==typeof clearTimeout?clearTimeout:o}catch(e){i=o}}();var l,h=[],c=!1,u=-1;function d(){c&&l&&(c=!1,l.length?h=l.concat(h):u=-1,h.length&&p())}function p(){if(!c){var e=a(d);c=!0;for(var t=h.length;t;){for(l=h,h=[];++u1)for(var s=1;s{e(...s),this._timeouts.delete(i)},t);return this._timeouts.add(i),i}clearTimeout(e){clearTimeout(e),this._timeouts.delete(e)}setInterval(e,t,...s){const i=setInterval(e,t,...s);return this._intervals.add(i),i}clearInterval(e){clearInterval(e),this._intervals.delete(e)}setImmediate(e,...s){const i=t(e,...s);return this._immediates.add(i),i}clearImmediate(e){i(e),this._immediates.delete(e)}toJSON(...e){return o.flatten(this,{domain:!1},...e)}}}).call(this,s(47).setImmediate,s(47).clearImmediate)},function(e,t,s){"use strict";var i,n="object"==typeof Reflect?Reflect:null,r=n&&"function"==typeof n.apply?n.apply:function(e,t,s){return Function.prototype.apply.call(e,t,s)};i=n&&"function"==typeof n.ownKeys?n.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var o=Number.isNaN||function(e){return e!=e};function a(){a.init.call(this)}e.exports=a,a.EventEmitter=a,a.prototype._events=void 0,a.prototype._eventsCount=0,a.prototype._maxListeners=void 0;var l=10;function h(e){return void 0===e._maxListeners?a.defaultMaxListeners:e._maxListeners}function c(e,t,s,i){var n,r,o,a;if("function"!=typeof s)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof s);if(void 0===(r=e._events)?(r=e._events=Object.create(null),e._eventsCount=0):(void 0!==r.newListener&&(e.emit("newListener",t,s.listener?s.listener:s),r=e._events),o=r[t]),void 0===o)o=r[t]=s,++e._eventsCount;else if("function"==typeof o?o=r[t]=i?[s,o]:[o,s]:i?o.unshift(s):o.push(s),(n=h(e))>0&&o.length>n&&!o.warned){o.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=e,l.type=t,l.count=o.length,a=l,console&&console.warn&&console.warn(a)}return e}function u(e,t,s){var i={fired:!1,wrapFn:void 0,target:e,type:t,listener:s},n=function(){for(var e=[],t=0;t0&&(o=t[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var l=n[e];if(void 0===l)return!1;if("function"==typeof l)r(l,this,t);else{var h=l.length,c=m(l,h);for(s=0;s=0;r--)if(s[r]===t||s[r].listener===t){o=s[r].listener,n=r;break}if(n<0)return this;0===n?s.shift():function(e,t){for(;t+1=0;i--)this.removeListener(e,t[i]);return this},a.prototype.listeners=function(e){return d(this,e,!0)},a.prototype.rawListeners=function(e){return d(this,e,!1)},a.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):p.call(e,t)},a.prototype.listenerCount=p,a.prototype.eventNames=function(){return this._eventsCount>0?i(this._events):[]}},function(e,t,s){"use strict";e.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},function(e,t,s){"use strict";const i=s(8),n=s(6);e.exports=class Emoji extends n{constructor(e,t){super(e),this.animated=t.animated,this.name=t.name,this.id=t.id,this.deleted=!1}get identifier(){return this.id?`${this.animated?"a:":""}${this.name}:${this.id}`:encodeURIComponent(this.name)}get url(){return this.id?this.client.rest.cdn.Emoji(this.id,this.animated?"gif":"png"):null}get createdTimestamp(){return this.id?i.deconstruct(this.id).timestamp:null}get createdAt(){return this.id?new Date(this.createdTimestamp):null}toString(){return this.id?`<${this.animated?"a":""}:${this.name}:${this.id}>`:this.name}toJSON(){return super.toJSON({guild:"guildID",createdTimestamp:!0,url:!0,identifier:!0})}}},function(e,t,s){"use strict";const i=s(3),n=s(2),r=s(31);e.exports=class Collector extends r{constructor(e,t,s={}){super(),Object.defineProperty(this,"client",{value:e}),this.filter=t,this.options=s,this.collected=new i,this.ended=!1,this._timeout=null,this.handleCollect=this.handleCollect.bind(this),this.handleDispose=this.handleDispose.bind(this),s.time&&(this._timeout=this.client.setTimeout(()=>this.stop("time"),s.time))}handleCollect(...e){const t=this.collect(...e);t&&this.filter(...e,this.collected)&&(this.collected.set(t,e[0]),this.emit("collect",...e)),this.checkEnd()}handleDispose(...e){if(!this.options.dispose)return;const t=this.dispose(...e);t&&this.filter(...e)&&this.collected.has(t)&&(this.collected.delete(t),this.emit("dispose",...e),this.checkEnd())}get next(){return new Promise((e,t)=>{if(this.ended)return void t(this.collected);const s=()=>{this.removeListener("collect",i),this.removeListener("end",n)},i=t=>{s(),e(t)},n=()=>{s(),t(this.collected)};this.on("collect",i),this.on("end",n)})}stop(e="user"){this.ended||(this._timeout&&this.client.clearTimeout(this._timeout),this.ended=!0,this.emit("end",this.collected,e))}checkEnd(){const e=this.endReason();e&&this.stop(e)}toJSON(){return n.flatten(this)}collect(){}dispose(){}endReason(){}}},function(e,t,s){"use strict";const i=s(2),{RangeError:n}=s(4);e.exports=class MessageEmbed{constructor(e={}){this.setup(e)}setup(e){this.type=e.type,this.title=e.title,this.description=e.description,this.url=e.url,this.color=e.color,this.timestamp=e.timestamp?new Date(e.timestamp).getTime():null,this.fields=e.fields?e.fields.map(i.cloneObject):[],this.thumbnail=e.thumbnail?{url:e.thumbnail.url,proxyURL:e.thumbnail.proxy_url,height:e.thumbnail.height,width:e.thumbnail.width}:null,this.image=e.image?{url:e.image.url,proxyURL:e.image.proxy_url,height:e.image.height,width:e.image.width}:null,this.video=e.video,this.author=e.author?{name:e.author.name,url:e.author.url,iconURL:e.author.iconURL||e.author.icon_url,proxyIconURL:e.author.proxyIconUrl||e.author.proxy_icon_url}:null,this.provider=e.provider,this.footer=e.footer?{text:e.footer.text,iconURL:e.footer.iconURL||e.footer.icon_url,proxyIconURL:e.footer.proxyIconURL||e.footer.proxy_icon_url}:null,this.files=[],e.files&&(this.files=e.files)}get createdAt(){return this.timestamp?new Date(this.timestamp):null}get hexColor(){return this.color?`#${this.color.toString(16).padStart(6,"0")}`:null}get length(){return(this.title?this.title.length:0)+(this.description?this.description.length:0)+(this.fields.length>=1?this.fields.reduce((e,t)=>e+t.name.length+t.value.length,0):0)+(this.footer?this.footer.text.length:0)}addField(e,t,s){return this.fields.push(this.constructor.checkField(e,t,s)),this}addBlankField(e){return this.addField("​","​",e)}spliceField(e,t,s,i,n){return s&&i?this.fields.splice(e,t,this.constructor.checkField(s,i,n)):this.fields.splice(e,t),this}attachFiles(e){return this.files=this.files.concat(e),this}setAuthor(e,t,s){return this.author={name:i.resolveString(e),iconURL:t,url:s},this}setColor(e){return this.color=i.resolveColor(e),this}setDescription(e){return e=i.resolveString(e),this.description=e,this}setFooter(e,t){return e=i.resolveString(e),this.footer={text:e,iconURL:t},this}setImage(e){return this.image={url:e},this}setThumbnail(e){return this.thumbnail={url:e},this}setTimestamp(e=Date.now()){return e instanceof Date&&(e=e.getTime()),this.timestamp=e,this}setTitle(e){return e=i.resolveString(e),this.title=e,this}setURL(e){return this.url=e,this}toJSON(){return i.flatten(this,{hexColor:!0})}_apiTransform(){return{title:this.title,type:"rich",description:this.description,url:this.url,timestamp:this.timestamp?new Date(this.timestamp):null,color:this.color,fields:this.fields,thumbnail:this.thumbnail,image:this.image,author:this.author?{name:this.author.name,url:this.author.url,icon_url:this.author.iconURL}:null,footer:this.footer?{text:this.footer.text,icon_url:this.footer.iconURL}:null}}static checkField(e,t,s=!1){if(!(e=i.resolveString(e)))throw new n("EMBED_FIELD_NAME");if(!(t=i.resolveString(t)))throw new n("EMBED_FIELD_VALUE");return{name:e,value:t,inline:s}}}},function(e,t,s){"use strict";const i=s(2);e.exports=class MessageAttachment{constructor(e,t=null,s){this.attachment=e,this.name=t,s&&this._patch(s)}setFile(e,t=null){return this.attachment=e,this.name=t,this}setName(e){return this.name=e,this}_patch(e){this.id=e.id,this.size=e.size,this.url=e.url,this.proxyURL=e.proxy_url,this.height=void 0!==e.height?e.height:null,this.width=void 0!==e.width?e.width:null}toJSON(){return i.flatten(this)}}},function(e,t,s){"use strict";const i=s(11),n=s(30);class WebhookClient extends n{constructor(e,t,s){super(s),Object.defineProperty(this,"client",{value:this}),this.id=e,Object.defineProperty(this,"token",{value:t,writable:!0,configurable:!0})}}i.applyToClass(WebhookClient),e.exports=WebhookClient},function(e,t,s){"use strict";const i=s(8),{ClientApplicationAssetTypes:n,Endpoints:r}=s(0),o=s(6),a=Object.keys(n);e.exports=class ClientApplication extends o{constructor(e,t){super(e),this._patch(t)}_patch(e){this.id=e.id,this.name=e.name,this.description=e.description,this.icon=e.icon,this.cover=e.cover_image||null,this.rpcOrigins=e.rpc_origins||[],this.botRequireCodeGrant=void 0!==e.bot_require_code_grant?e.bot_require_code_grant:null,this.botPublic=void 0!==e.bot_public?e.bot_public:null,this.owner=e.owner?this.client.users.add(e.owner):null}get createdTimestamp(){return i.deconstruct(this.id).timestamp}get createdAt(){return new Date(this.createdTimestamp)}iconURL({format:e,size:t}={}){return this.icon?this.client.rest.cdn.AppIcon(this.id,this.icon,{format:e,size:t}):null}coverImage({format:e,size:t}={}){return this.cover?r.CDN(this.client.options.http.cdn).AppIcon(this.id,this.cover,{format:e,size:t}):null}fetchAssets(){return this.client.api.oauth2.applications(this.id).assets.get().then(e=>e.map(e=>({id:e.id,name:e.name,type:a[e.type-1]})))}toString(){return this.name}toJSON(){return super.toJSON({createdTimestamp:!0})}}},function(e,t,s){"use strict";const i=s(21),n=s(2),r=s(40),o=s(69);e.exports=class MessageReaction{constructor(e,t,s){this.message=s,this.me=t.me,this.count=t.count||0,this.users=new o(e,void 0,this),this._emoji=new r(this,t.emoji)}get emoji(){if(this._emoji instanceof i)return this._emoji;if(this._emoji.id){const e=this.message.client.emojis;if(e.has(this._emoji.id)){const t=e.get(this._emoji.id);return this._emoji=t,t}}return this._emoji}toJSON(){return n.flatten(this,{emoji:"emojiID",message:"messageID"})}_add(e){this.users.set(e.id,e),this.me&&e.id===this.message.client.user.id&&0!==this.count||this.count++,this.me||(this.me=e.id===this.message.client.user.id)}_remove(e){this.users.delete(e.id),this.me&&e.id===this.message.client.user.id||this.count--,e.id===this.message.client.user.id&&(this.me=!1),this.count<=0&&0===this.users.size&&this.message.reactions.remove(this.emoji.id||this.emoji.name)}}},function(e,t,s){"use strict";const i=s(2),n=s(33);e.exports=class ReactionEmoji extends n{constructor(e,t){super(e.message.client,t),this.reaction=e}toJSON(){return i.flatten(this,{identifier:!0})}valueOf(){return this.id}}},function(e,t,s){"use strict";const i=s(16),n=s(7),r=s(2),{TypeError:o}=s(4);e.exports=class PermissionOverwrites{constructor(e,t){Object.defineProperty(this,"channel",{value:e}),t&&this._patch(t)}_patch(e){this.id=e.id,this.type=e.type,this.deny=new n(e.deny).freeze(),this.allow=new n(e.allow).freeze()}update(e,t){const{allow:s,deny:i}=this.constructor.resolveOverwriteOptions(e,this);return this.channel.client.api.channels(this.channel.id).permissions[this.id].put({data:{id:this.id,type:this.type,allow:s.bitfield,deny:i.bitfield},reason:t}).then(()=>this)}delete(e){return this.channel.client.api.channels[this.channel.id].permissions[this.id].delete({reason:e}).then(()=>this)}toJSON(){return r.flatten(this)}static resolveOverwriteOptions(e,{allow:t,deny:s}={}){t=new n(t),s=new n(s);for(const[i,r]of Object.entries(e))!0===r?(t.add(n.FLAGS[i]),s.remove(n.FLAGS[i])):!1===r?(t.remove(n.FLAGS[i]),s.add(n.FLAGS[i])):null===r&&(t.remove(n.FLAGS[i]),s.remove(n.FLAGS[i]));return{allow:t,deny:s}}static resolve(e,t){if(e instanceof this)return e.toJSON();if("string"==typeof e.id&&["role","member"].includes(e.type))return{...e,allow:n.resolve(e.allow),deny:n.resolve(e.deny)};const s=t.roles.resolve(e.id)||t.client.users.resolve(e.id);if(!s)throw new o("INVALID_TYPE","parameter","User nor a Role",!0);const r=s instanceof i?"role":"member";return{id:s.id,type:r,allow:n.resolve(e.allow),deny:n.resolve(e.deny)}}}},function(e,t,s){"use strict";const i=s(26),n=s(73),r=s(74),o=s(11),a=s(43),{ChannelTypes:l,DefaultMessageNotifications:h,browser:c}=s(0),u=s(3),d=s(2),p=s(9),m=s(8),f=s(75),_=s(76),g=s(44),E=s(77),v=s(78),b=s(139),w=s(6),{Error:y,TypeError:A}=s(4);e.exports=class Guild extends w{constructor(e,t){super(e),this.members=new f(this),this.channels=new E(this),this.roles=new _(this),this.presences=new v(this.client),this.deleted=!1,t&&(t.unavailable?(this.available=!1,this.id=t.id):(this._patch(t),t.channels||(this.available=!1)),this.shardID=t.shardID)}get shard(){return this.client.ws.shards.get(this.shardID)}_patch(e){if(this.name=e.name,this.icon=e.icon,this.splash=e.splash,this.region=e.region,this.memberCount=e.member_count||this.memberCount,this.large=Boolean("large"in e?e.large:this.large),this.features=e.features,this.applicationID=e.application_id,this.afkTimeout=e.afk_timeout,this.afkChannelID=e.afk_channel_id,this.systemChannelID=e.system_channel_id,this.embedEnabled=e.embed_enabled,this.verificationLevel=e.verification_level,this.explicitContentFilter=e.explicit_content_filter,this.mfaLevel=e.mfa_level,this.joinedTimestamp=e.joined_at?new Date(e.joined_at).getTime():this.joinedTimestamp,this.defaultMessageNotifications=h[e.default_message_notifications]||e.default_message_notifications,this.id=e.id,this.available=!e.unavailable,this.features=e.features||this.features||[],e.channels){this.channels.clear();for(const t of e.channels)this.client.channels.add(t,this)}if(e.roles){this.roles.clear();for(const t of e.roles)this.roles.add(t)}if(e.members){this.members.clear();for(const t of e.members)this.members.add(t)}if(e.owner_id&&(this.ownerID=e.owner_id),e.presences)for(const t of e.presences)this.presences.add(Object.assign(t,{guild:this}));if(this.voiceStates||(this.voiceStates=new b(this)),e.voice_states)for(const t of e.voice_states)this.voiceStates.add(t);if(this.emojis)this.client.actions.GuildEmojisUpdate.handle({guild_id:this.id,emojis:e.emojis});else if(this.emojis=new g(this),e.emojis)for(const t of e.emojis)this.emojis.add(t)}get createdTimestamp(){return m.deconstruct(this.id).timestamp}get createdAt(){return new Date(this.createdTimestamp)}get joinedAt(){return new Date(this.joinedTimestamp)}get verified(){return this.features.includes("VERIFIED")}iconURL({format:e,size:t}={}){return this.icon?this.client.rest.cdn.Icon(this.id,this.icon,e,t):null}get nameAcronym(){return this.name.replace(/\w+/g,e=>e[0]).replace(/\s/g,"")}splashURL({format:e,size:t}={}){return this.splash?this.client.rest.cdn.Splash(this.id,this.splash,e,t):null}get owner(){return this.members.get(this.ownerID)||null}get afkChannel(){return this.client.channels.get(this.afkChannelID)||null}get systemChannel(){return this.client.channels.get(this.systemChannelID)||null}get voiceConnection(){return c?null:this.client.voice.connections.get(this.id)||null}get defaultRole(){return this.roles.get(this.id)||null}get me(){return this.members.get(this.client.user.id)||null}member(e){return this.members.resolve(e)}fetchBans(){return this.client.api.guilds(this.id).bans.get().then(e=>e.reduce((e,t)=>(e.set(t.user.id,{reason:t.reason,user:this.client.users.add(t.user)}),e),new u))}fetchIntegrations(){return this.client.api.guilds(this.id).integrations.get().then(e=>e.reduce((e,t)=>e.set(t.id,new n(this.client,t,this)),new u))}createIntegration(e,t){return this.client.api.guilds(this.id).integrations.post({data:e,reason:t}).then(()=>this)}fetchInvites(){return this.client.api.guilds(this.id).invites.get().then(e=>{const t=new u;for(const s of e){const e=new i(this.client,s);t.set(e.code,e)}return t})}fetchVanityCode(){return this.features.includes("VANITY_URL")?this.client.api.guilds(this.id,"vanity-url").get().then(e=>e.code):Promise.reject(new y("VANITY_URL"))}fetchWebhooks(){return this.client.api.guilds(this.id).webhooks.get().then(e=>{const t=new u;for(const s of e)t.set(s.id,new o(this.client,s));return t})}fetchVoiceRegions(){return this.client.api.guilds(this.id).regions.get().then(e=>{const t=new u;for(const s of e)t.set(s.id,new a(s));return t})}fetchEmbed(){return this.client.api.guilds(this.id).embed.get().then(e=>({enabled:e.enabled,channel:e.channel_id?this.channels.get(e.channel_id):null}))}fetchAuditLogs(e={}){return e.before&&e.before instanceof r.Entry&&(e.before=e.before.id),e.after&&e.after instanceof r.Entry&&(e.after=e.after.id),"string"==typeof e.type&&(e.type=r.Actions[e.type]),this.client.api.guilds(this.id)["audit-logs"].get({query:{before:e.before,after:e.after,limit:e.limit,user_id:this.client.users.resolveID(e.user),action_type:e.type}}).then(e=>r.build(this,e))}addMember(e,t){if(!(e=this.client.users.resolveID(e)))return Promise.reject(new A("INVALID_TYPE","user","UserResolvable"));if(this.members.has(e))return Promise.resolve(this.members.get(e));if(t.access_token=t.accessToken,t.roles){const e=[];for(let s of t.roles instanceof u?t.roles.values():t.roles){if(!(s=this.roles.resolve(s)))return Promise.reject(new A("INVALID_TYPE","options.roles","Array or Collection of Roles or Snowflakes",!0));e.push(s.id)}}return this.client.api.guilds(this.id).members(e).put({data:t}).then(e=>this.members.add(e))}edit(e,t){const s={};return e.name&&(s.name=e.name),e.region&&(s.region=e.region),void 0!==e.verificationLevel&&(s.verification_level=Number(e.verificationLevel)),void 0!==e.afkChannel&&(s.afk_channel_id=this.client.channels.resolveID(e.afkChannel)),void 0!==e.systemChannel&&(s.system_channel_id=this.client.channels.resolveID(e.systemChannel)),e.afkTimeout&&(s.afk_timeout=Number(e.afkTimeout)),void 0!==e.icon&&(s.icon=e.icon),e.owner&&(s.owner_id=this.client.users.resolve(e.owner).id),e.splash&&(s.splash=e.splash),void 0!==e.explicitContentFilter&&(s.explicit_content_filter=Number(e.explicitContentFilter)),void 0!==e.defaultMessageNotifications&&(s.default_message_notifications="string"==typeof e.defaultMessageNotifications?h.indexOf(e.defaultMessageNotifications):Number(e.defaultMessageNotifications)),this.client.api.guilds(this.id).patch({data:s,reason:t}).then(e=>this.client.actions.GuildUpdate.handle(e).updated)}setExplicitContentFilter(e,t){return this.edit({explicitContentFilter:e},t)}setDefaultMessageNotifications(e,t){return this.edit({defaultMessageNotifications:e},t)}setName(e,t){return this.edit({name:e},t)}setRegion(e,t){return this.edit({region:e},t)}setVerificationLevel(e,t){return this.edit({verificationLevel:e},t)}setAFKChannel(e,t){return this.edit({afkChannel:e},t)}setSystemChannel(e,t){return this.edit({systemChannel:e},t)}setAFKTimeout(e,t){return this.edit({afkTimeout:e},t)}async setIcon(e,t){return this.edit({icon:await p.resolveImage(e),reason:t})}setOwner(e,t){return this.edit({owner:e},t)}async setSplash(e,t){return this.edit({splash:await p.resolveImage(e),reason:t})}setChannelPositions(e){const t=e.map(e=>({id:this.client.channels.resolveID(e.channel),position:e.position}));return this.client.api.guilds(this.id).channels.patch({data:t}).then(()=>this.client.actions.GuildChannelsPositionUpdate.handle({guild_id:this.id,channels:t}).guild)}setEmbed(e,t){return this.client.api.guilds(this.id).embed.patch({data:{enabled:e.enabled,channel_id:this.channels.resolveID(e.channel)},reason:t}).then(()=>this)}leave(){return this.ownerID===this.client.user.id?Promise.reject(new y("GUILD_OWNED")):this.client.api.users("@me").guilds(this.id).delete().then(()=>this.client.actions.GuildDelete.handle({id:this.id}).guild)}delete(){return this.client.api.guilds(this.id).delete().then(()=>this.client.actions.GuildDelete.handle({id:this.id}).guild)}equals(e){let t=e&&e instanceof this.constructor&&this.id===e.id&&this.available===e.available&&this.splash===e.splash&&this.region===e.region&&this.name===e.name&&this.memberCount===e.memberCount&&this.large===e.large&&this.icon===e.icon&&this.ownerID===e.ownerID&&this.verificationLevel===e.verificationLevel&&this.embedEnabled===e.embedEnabled&&(this.features===e.features||this.features.length===e.features.length&&this.features.every((t,s)=>t===e.features[s]));return t&&(this.embedChannel?e.embedChannel&&this.embedChannel.id===e.embedChannel.id||(t=!1):e.embedChannel&&(t=!1)),t}toString(){return this.name}toJSON(){const e=super.toJSON({available:!1,createdTimestamp:!0,nameAcronym:!0,presences:!1,voiceStates:!1});return e.iconURL=this.iconURL(),e.splashURL=this.splashURL(),e}_sortedRoles(){return d.discordSort(this.roles)}_sortedChannels(e){const t=e.type===l.CATEGORY;return d.discordSort(this.channels.filter(s=>s.type===e.type&&(t||s.parent===e.parent)))}}},function(e,t,s){"use strict";const i=s(2);e.exports=class VoiceRegion{constructor(e){this.id=e.id,this.name=e.name,this.vip=e.vip,this.deprecated=e.deprecated,this.optimal=e.optimal,this.custom=e.custom}toJSON(){return i.flatten(this)}}},function(e,t,s){"use strict";const i=s(3),n=s(5),r=s(21),o=s(40),a=s(9),{TypeError:l}=s(4);e.exports=class GuildEmojiStore extends n{constructor(e,t){super(e.client,t,r),this.guild=e}add(e,t){return super.add(e,t,{extras:[this.guild]})}create(e,t,{roles:s,reason:n}={}){if("string"==typeof e&&e.startsWith("data:")){const r={image:e,name:t};if(s){r.roles=[];for(let e of s instanceof i?s.values():s){if(!(e=this.guild.roles.resolve(e)))return Promise.reject(new l("INVALID_TYPE","options.roles","Array or Collection of Roles or Snowflakes",!0));r.roles.push(e.id)}}return this.client.api.guilds(this.guild.id).emojis.post({data:r,reason:n}).then(e=>this.client.actions.GuildEmojiCreate.handle(this.guild,e).emoji)}return a.resolveImage(e).then(e=>this.create(e,t,{roles:s,reason:n}))}resolve(e){return e instanceof o?super.resolve(e.id):super.resolve(e)}resolveID(e){return e instanceof o?e.id:super.resolveID(e)}resolveIdentifier(e){const t=this.resolve(e);return t?t.identifier:e instanceof o?e.identifier:"string"==typeof e?e.includes("%")?e:encodeURIComponent(e):null}}},function(e,t){e.exports={version:"12.0.0-dev",homepage:"https://github.com/discordjs/discord.js#readme"}},function(e,t,s){"use strict";const i=Symbol("code"),n=new Map;function r(e){return class DiscordjsError extends e{constructor(e,...t){super(function(e,t){if("string"!=typeof e)throw new Error("Error message key must be a string");const s=n.get(e);if(!s)throw new Error(`An invalid error message key was used: ${e}.`);return"function"==typeof s?s(...t):void 0===t||0===t.length?s:(t.unshift(s),String(...t))}(e,t)),this[i]=e,Error.captureStackTrace&&Error.captureStackTrace(this,DiscordjsError)}get name(){return`${super.name} [${this[i]}]`}get code(){return this[i]}}}e.exports={register:function(e,t){n.set(e,"function"==typeof t?t:String(t))},Error:r(Error),TypeError:r(TypeError),RangeError:r(RangeError)}},function(e,t,s){(function(e){var i=void 0!==e&&e||"undefined"!=typeof self&&self||window,n=Function.prototype.apply;function r(e,t){this._id=e,this._clearFn=t}t.setTimeout=function(){return new r(n.call(setTimeout,i,arguments),clearTimeout)},t.setInterval=function(){return new r(n.call(setInterval,i,arguments),clearInterval)},t.clearTimeout=t.clearInterval=function(e){e&&e.close()},r.prototype.unref=r.prototype.ref=function(){},r.prototype.close=function(){this._clearFn.call(i,this._id)},t.enroll=function(e,t){clearTimeout(e._idleTimeoutId),e._idleTimeout=t},t.unenroll=function(e){clearTimeout(e._idleTimeoutId),e._idleTimeout=-1},t._unrefActive=t.active=function(e){clearTimeout(e._idleTimeoutId);var t=e._idleTimeout;t>=0&&(e._idleTimeoutId=setTimeout(function(){e._onTimeout&&e._onTimeout()},t))},s(49),t.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==e&&e.setImmediate||this&&this.setImmediate,t.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==e&&e.clearImmediate||this&&this.clearImmediate}).call(this,s(48))},function(e,t){var s;s=function(){return this}();try{s=s||new Function("return this")()}catch(e){"object"==typeof window&&(s=window)}e.exports=s},function(e,t,s){(function(e,t){!function(e,s){"use strict";if(!e.setImmediate){var i,n,r,o,a,l=1,h={},c=!1,u=e.document,d=Object.getPrototypeOf&&Object.getPrototypeOf(e);d=d&&d.setTimeout?d:e,"[object process]"==={}.toString.call(e.process)?i=function(e){t.nextTick(function(){m(e)})}:!function(){if(e.postMessage&&!e.importScripts){var t=!0,s=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=s,t}}()?e.MessageChannel?((r=new MessageChannel).port1.onmessage=function(e){m(e.data)},i=function(e){r.port2.postMessage(e)}):u&&"onreadystatechange"in u.createElement("script")?(n=u.documentElement,i=function(e){var t=u.createElement("script");t.onreadystatechange=function(){m(e),t.onreadystatechange=null,n.removeChild(t),t=null},n.appendChild(t)}):i=function(e){setTimeout(m,0,e)}:(o="setImmediate$"+Math.random()+"$",a=function(t){t.source===e&&"string"==typeof t.data&&0===t.data.indexOf(o)&&m(+t.data.slice(o.length))},e.addEventListener?e.addEventListener("message",a,!1):e.attachEvent("onmessage",a),i=function(t){e.postMessage(o+t,"*")}),d.setImmediate=function(e){"function"!=typeof e&&(e=new Function(""+e));for(var t=new Array(arguments.length-1),s=0;se.message).join(" ")}`):n.code||n.message?s.push(`${n.code?`${n.code}: `:""}${n.message}`.trim()):"string"==typeof n?s.push(n):s=s.concat(this.flattenErrors(n,e))}return s}}},function(e,t,s){"use strict";e.exports=class HTTPError extends Error{constructor(e,t,s,i,n){super(e),this.name=t,this.code=s||500,this.method=i,this.path=n}}},function(e,t,s){"use strict";t.decode=t.parse=s(88),t.encode=t.stringify=s(89)},function(e,t,s){"use strict";const{browser:i}=s(0),n=s(52);try{var r=s(97);r.pack||(r=null)}catch(e){}if(i)t.WebSocket=window.WebSocket;else try{t.WebSocket=s(98)}catch(e){t.WebSocket=s(99)}t.encoding=r?"etf":"json",t.pack=r?r.pack:JSON.stringify,t.unpack=(e=>r&&"{"!==e[0]?(e instanceof Buffer||(e=Buffer.from(new Uint8Array(e))),r.unpack(e)):JSON.parse(e)),t.create=((e,s={},...r)=>{const[o,a]=e.split("?");s.encoding=t.encoding,a&&(s=Object.assign(n.parse(a),s));const l=new t.WebSocket(`${o}?${n.stringify(s)}`,...r);return i&&(l.binaryType="arraybuffer"),l});for(const e of["CONNECTING","OPEN","CLOSING","CLOSED"])t[e]=t.WebSocket[e]},function(e,t,s){"use strict";var i={};(0,s(10).assign)(i,s(101),s(104),s(59)),e.exports=i},function(e,t,s){"use strict";e.exports=function(e,t,s,i){for(var n=65535&e|0,r=e>>>16&65535|0,o=0;0!==s;){s-=o=s>2e3?2e3:s;do{r=r+(n=n+t[i++]|0)|0}while(--o);n%=65521,r%=65521}return n|r<<16|0}},function(e,t,s){"use strict";var i=function(){for(var e,t=[],s=0;s<256;s++){e=s;for(var i=0;i<8;i++)e=1&e?3988292384^e>>>1:e>>>1;t[s]=e}return t}();e.exports=function(e,t,s,n){var r=i,o=n+s;e^=-1;for(var a=n;a>>8^r[255&(e^t[a])];return-1^e}},function(e,t,s){"use strict";var i=s(10),n=!0,r=!0;try{String.fromCharCode.apply(null,[0])}catch(e){n=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){r=!1}for(var o=new i.Buf8(256),a=0;a<256;a++)o[a]=a>=252?6:a>=248?5:a>=240?4:a>=224?3:a>=192?2:1;function l(e,t){if(t<65534&&(e.subarray&&r||!e.subarray&&n))return String.fromCharCode.apply(null,i.shrinkBuf(e,t));for(var s="",o=0;o>>6,t[o++]=128|63&s):s<65536?(t[o++]=224|s>>>12,t[o++]=128|s>>>6&63,t[o++]=128|63&s):(t[o++]=240|s>>>18,t[o++]=128|s>>>12&63,t[o++]=128|s>>>6&63,t[o++]=128|63&s);return t},t.buf2binstring=function(e){return l(e,e.length)},t.binstring2buf=function(e){for(var t=new i.Buf8(e.length),s=0,n=t.length;s4)h[i++]=65533,s+=r-1;else{for(n&=2===r?31:3===r?15:7;r>1&&s1?h[i++]=65533:n<65536?h[i++]=n:(n-=65536,h[i++]=55296|n>>10&1023,h[i++]=56320|1023&n)}return l(h,i)},t.utf8border=function(e,t){var s;for((t=t||e.length)>e.length&&(t=e.length),s=t-1;s>=0&&128==(192&e[s]);)s--;return s<0?t:0===s?t:s+o[e[s]]>t?s:t}},function(e,t,s){"use strict";e.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},function(e,t,s){"use strict";e.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},function(e,t,s){"use strict";const{WSEvents:i}=s(0),n={};for(const e of Object.keys(i))try{n[e]=s(109)(`./${e}.js`)}catch(e){}e.exports=n},function(e,t,s){"use strict";const i=s(18),n=s(9);e.exports=class ClientUser extends(i.get("User")){_patch(e){super._patch(e),this.verified=e.verified,this.mfaEnabled="boolean"==typeof e.mfa_enabled?e.mfa_enabled:null,this._typing=new Map,e.token&&(this.client.token=e.token)}get presence(){return this.client.presence}edit(e){return this.client.api.users("@me").patch({data:e}).then(e=>{this.client.token=e.token;const{updated:t}=this.client.actions.UserUpdate.handle(e);return t||this})}setUsername(e){return this.edit({username:e})}async setAvatar(e){return this.edit({avatar:await n.resolveImage(e)})}setPresence(e){return this.client.presence.set(e)}setStatus(e,t){return this.setPresence({status:e,shardID:t})}setActivity(e,t={}){if(!e)return this.setPresence({activity:null,shardID:t.shardID});const s=Object.assign({},t,"object"==typeof e?e:{name:e});return this.setPresence({activity:s,shardID:s.shardID})}setAFK(e){return this.setPresence({afk:e})}}},function(e,t,s){"use strict";const i=s(3),n=s(2),{TypeError:r}=s(4);class GuildEmojiRoleStore extends i{constructor(e){super(),this.emoji=e,this.guild=e.guild,Object.defineProperty(this,"client",{value:e.client})}get _filtered(){return this.guild.roles.filter(e=>this.emoji._roles.includes(e.id))}add(e){if(e instanceof i)return this.add(e.keyArray());if(!(e instanceof Array))return this.add([e]);if((e=e.map(e=>this.guild.roles.resolve(e))).includes(null))return Promise.reject(new r("INVALID_TYPE","roles","Array or Collection of Roles or Snowflakes",!0));const t=[...new Set(e.concat(...this.values()))];return this.set(t)}remove(e){if(e instanceof i)return this.remove(e.keyArray());if(!(e instanceof Array))return this.remove([e]);if((e=e.map(e=>this.guild.roles.resolveID(e))).includes(null))return Promise.reject(new r("INVALID_TYPE","roles","Array or Collection of Roles or Snowflakes",!0));const t=this.keyArray().filter(t=>!e.includes(t));return this.set(t)}set(e){return this.emoji.edit({roles:e})}clone(){const e=new this.constructor(this.emoji);return e._patch(this.keyArray().slice()),e}_patch(e){this.emoji._roles=e}*[Symbol.iterator](){yield*this._filtered.entries()}valueOf(){return this._filtered}}n.mixin(GuildEmojiRoleStore,["set"]),e.exports=GuildEmojiRoleStore},function(e,t,s){"use strict";const i=s(14),n=s(22),r=s(24);class DMChannel extends i{constructor(e,t){super(e,t),this.type="dm",this.messages=new r(this),this._typing=new Map}_patch(e){super._patch(e),e.recipients&&(this.recipient=this.client.users.add(e.recipients[0])),this.lastMessageID=e.last_message_id,this.lastPinTimestamp=e.last_pin_timestamp?new Date(e.last_pin_timestamp).getTime():null}get partial(){return Boolean(this.recipient)}toString(){return this.recipient.toString()}get lastMessage(){}get lastPinAt(){}send(){}search(){}startTyping(){}stopTyping(){}get typing(){}get typingCount(){}createMessageCollector(){}awaitMessages(){}acknowledge(){}_cacheMessage(){}}n.applyToClass(DMChannel,!0,["bulkDelete"]),e.exports=DMChannel},function(e,t,s){"use strict";const i=s(34),{Events:n}=s(0);e.exports=class MessageCollector extends i{constructor(e,t,s={}){super(e.client,t,s),this.channel=e,this.received=0;const i=(e=>{for(const t of e.values())this.handleDispose(t)}).bind(this);this.client.setMaxListeners(this.client.getMaxListeners()+1),this.client.on(n.MESSAGE_CREATE,this.handleCollect),this.client.on(n.MESSAGE_DELETE,this.handleDispose),this.client.on(n.MESSAGE_BULK_DELETE,i),this.once("end",()=>{this.client.removeListener(n.MESSAGE_CREATE,this.handleCollect),this.client.removeListener(n.MESSAGE_DELETE,this.handleDispose),this.client.removeListener(n.MESSAGE_BULK_DELETE,i),this.client.setMaxListeners(this.client.getMaxListeners()-1)})}collect(e){return e.channel.id!==this.channel.id?null:(this.received++,e.id)}dispose(e){return e.channel.id===this.channel.id?e.id:null}endReason(){return this.options.max&&this.collected.size>=this.options.max?"limit":this.options.maxProcessed&&this.received===this.options.maxProcessed?"processedLimit":null}}},function(e,t,s){"use strict";const i=s(20);class ActivityFlags extends i{}ActivityFlags.FLAGS={INSTANCE:1,JOIN:2,SPECTATE:4,JOIN_REQUEST:8,SYNC:16,PLAY:32},e.exports=ActivityFlags},function(e,t,s){"use strict";const i=s(3),n=s(2),{TypeError:r}=s(4);class GuildMemberRoleStore extends i{constructor(e){super(),this.member=e,this.guild=e.guild,Object.defineProperty(this,"client",{value:e.client})}get _filtered(){const e=this.guild.defaultRole;return this.guild.roles.filter(e=>this.member._roles.includes(e.id)).set(e.id,e)}get hoist(){const e=this._filtered.filter(e=>e.hoist);return e.size?e.reduce((e,t)=>!e||t.comparePositionTo(e)>0?t:e):null}get color(){const e=this._filtered.filter(e=>e.color);return e.size?e.reduce((e,t)=>!e||t.comparePositionTo(e)>0?t:e):null}get highest(){return this._filtered.reduce((e,t)=>t.comparePositionTo(e)>0?t:e,this.first())}async add(e,t){if(e instanceof i||e instanceof Array){if((e=e.map(e=>this.guild.roles.resolve(e))).includes(null))throw new r("INVALID_TYPE","roles","Array or Collection of Roles or Snowflakes",!0);const s=[...new Set(e.concat(...this.values()))];return this.set(s,t)}{if(null===(e=this.guild.roles.resolve(e)))throw new r("INVALID_TYPE","roles","Array or Collection of Roles or Snowflakes",!0);await this.client.api.guilds[this.guild.id].members[this.member.id].roles[e.id].put({reason:t});const s=this.member._clone();return s.roles._patch([...this.keys(),e.id]),s}}async remove(e,t){if(e instanceof i||e instanceof Array){if((e=e.map(e=>this.guild.roles.resolve(e))).includes(null))throw new r("INVALID_TYPE","roles","Array or Collection of Roles or Snowflakes",!0);const s=this.filter(t=>!e.includes(t));return this.set(s,t)}{if(null===(e=this.guild.roles.resolve(e)))throw new r("INVALID_TYPE","roles","Array or Collection of Roles or Snowflakes",!0);await this.client.api.guilds[this.guild.id].members[this.member.id].roles[e.id].delete({reason:t});const s=this.member._clone(),i=this.filter(t=>t.id!==e.id);return s.roles._patch([...i.keys()]),s}}set(e,t){return this.member.edit({roles:e},t)}_patch(e){this.member._roles=e}clone(){const e=new this.constructor(this.member);return e._patch(this.keyArray()),e}*[Symbol.iterator](){yield*this._filtered.entries()}valueOf(){return this._filtered}}n.mixin(GuildMemberRoleStore,["set"]),e.exports=GuildMemberRoleStore},function(e,t,s){"use strict";const i=s(3),n=s(2),r=s(13);class MessageMentions{constructor(e,t,s,n){if(Object.defineProperty(this,"client",{value:e.client}),Object.defineProperty(this,"guild",{value:e.guild}),Object.defineProperty(this,"_content",{value:e.content}),this.everyone=Boolean(n),t)if(t instanceof i)this.users=new i(t);else{this.users=new i;for(const s of t){let t=e.client.users.add(s);this.users.set(t.id,t)}}else this.users=new i;if(s)if(s instanceof i)this.roles=new i(s);else{this.roles=new i;for(const t of s){const s=e.channel.guild.roles.get(t);s&&this.roles.set(s.id,s)}}else this.roles=new i;this._members=null,this._channels=null}get members(){return this._members?this._members:this.guild?(this._members=new i,this.users.forEach(e=>{const t=this.guild.member(e);t&&this._members.set(t.user.id,t)}),this._members):null}get channels(){if(this._channels)return this._channels;let e;for(this._channels=new i;null!==(e=this.constructor.CHANNELS_PATTERN.exec(this._content));){const t=this.client.channels.get(e[1]);t&&this._channels.set(t.id,t)}return this._channels}has(e,{ignoreDirect:t=!1,ignoreRoles:s=!1,ignoreEveryone:i=!1}={}){if(!i&&this.everyone)return!0;if(!s&&e instanceof r)for(const t of this.roles.values())if(e.roles.has(t.id))return!0;if(!t){const t=e.id||e;return this.users.has(t)||this.channels.has(t)||this.roles.has(t)}return!1}toJSON(){return n.flatten(this,{members:!0,channels:!0})}}MessageMentions.EVERYONE_PATTERN=/@(everyone|here)/g,MessageMentions.USERS_PATTERN=/<@!?(\d{17,19})>/g,MessageMentions.ROLES_PATTERN=/<@&(\d{17,19})>/g,MessageMentions.CHANNELS_PATTERN=/<#(\d{17,19})>/g,e.exports=MessageMentions},function(e,t,s){"use strict";const i=s(34),n=s(3),{Events:r}=s(0);class ReactionCollector extends i{constructor(e,t,s={}){super(e.client,t,s),this.message=e,this.users=new n,this.total=0,this.empty=this.empty.bind(this),this.client.setMaxListeners(this.client.getMaxListeners()+1),this.client.on(r.MESSAGE_REACTION_ADD,this.handleCollect),this.client.on(r.MESSAGE_REACTION_REMOVE,this.handleDispose),this.client.on(r.MESSAGE_REACTION_REMOVE_ALL,this.empty),this.once("end",()=>{this.client.removeListener(r.MESSAGE_REACTION_ADD,this.handleCollect),this.client.removeListener(r.MESSAGE_REACTION_REMOVE,this.handleDispose),this.client.removeListener(r.MESSAGE_REACTION_REMOVE_ALL,this.empty),this.client.setMaxListeners(this.client.getMaxListeners()-1)}),this.on("collect",(e,t)=>{this.total++,this.users.set(t.id,t)}),this.on("remove",(e,t)=>{this.total--,this.collected.some(e=>e.users.has(t.id))||this.users.delete(t.id)})}collect(e){return e.message.id!==this.message.id?null:ReactionCollector.key(e)}dispose(e,t){return e.message.id!==this.message.id?null:(this.collected.has(ReactionCollector.key(e))&&this.users.has(t.id)&&this.emit("remove",e,t),e.count?null:ReactionCollector.key(e))}empty(){this.total=0,this.collected.clear(),this.users.clear(),this.checkEnd()}endReason(){return this.options.max&&this.total>=this.options.max?"limit":this.options.maxEmojis&&this.collected.size>=this.options.maxEmojis?"emojiLimit":this.options.maxUsers&&this.users.size>=this.options.maxUsers?"userLimit":null}static key(e){return e.emoji.id||e.emoji.name}}e.exports=ReactionCollector},function(e,t,s){"use strict";const i=s(3),n=s(5),{Error:r}=s(4);e.exports=class ReactionUserStore extends n{constructor(e,t,i){super(e,t,s(15)),this.reaction=i}async fetch({limit:e=100,after:t,before:s}={}){const n=this.reaction.message,r=await this.client.api.channels[n.channel.id].messages[n.id].reactions[this.reaction.emoji.identifier].get({query:{limit:e,before:s,after:t}}),o=new i;for(const e of r){const t=this.client.users.add(e);this.set(t.id,t),o.set(t.id,t)}return o}remove(e=this.reaction.message.client.user){const t=this.reaction.message,s=t.client.users.resolveID(e);return s?t.client.api.channels[t.channel.id].messages[t.id].reactions[this.reaction.emoji.identifier][s===t.client.user.id?"@me":s].delete().then(()=>t.client.actions.MessageReactionRemove.handle({user_id:s,message_id:t.id,emoji:this.reaction.emoji,channel_id:t.channel.id}).reaction):Promise.reject(new r("REACTION_RESOLVE_USER"))}}},function(e,t,s){"use strict";const i=s(17),n=s(11),r=s(22),o=s(3),a=s(9),l=s(24);class TextChannel extends i{constructor(e,t){super(e,t),this.messages=new l(this),this._typing=new Map}_patch(e){if(super._patch(e),this.topic=e.topic,this.nsfw=e.nsfw||/^nsfw(-|$)/.test(this.name),this.lastMessageID=e.last_message_id,this.rateLimitPerUser=e.rate_limit_per_user||0,this.lastPinTimestamp=e.last_pin_timestamp?new Date(e.last_pin_timestamp).getTime():null,e.messages)for(const t of e.messages)this.messages.add(t)}setRateLimitPerUser(e,t){return this.edit({rateLimitPerUser:e},t)}setNSFW(e,t){return this.edit({nsfw:e},t)}fetchWebhooks(){return this.client.api.channels[this.id].webhooks.get().then(e=>{const t=new o;for(const s of e)t.set(s.id,new n(this.client,s));return t})}async createWebhook(e,{avatar:t,reason:s}={}){return"string"!=typeof t||t.startsWith("data:")||(t=await a.resolveImage(t)),this.client.api.channels[this.id].webhooks.post({data:{name:e,avatar:t},reason:s}).then(e=>new n(this.client,e))}get lastMessage(){}get lastPinAt(){}send(){}search(){}startTyping(){}stopTyping(){}get typing(){}get typingCount(){}createMessageCollector(){}awaitMessages(){}bulkDelete(){}acknowledge(){}_cacheMessage(){}}r.applyToClass(TextChannel,!0),e.exports=TextChannel},function(e,t,s){"use strict";const i=s(17),{browser:n}=s(0),r=s(7),o=s(3),{Error:a}=s(4);e.exports=class VoiceChannel extends i{_patch(e){super._patch(e),this.bitrate=e.bitrate,this.userLimit=e.user_limit}get members(){const e=new o;for(const t of this.guild.voiceStates.values())t.channelID===this.id&&t.member&&e.set(t.id,t.member);return e}get connection(){const e=this.guild.voiceConnection;return e&&e.channel.id===this.id?e:null}get full(){return this.userLimit>0&&this.members.size>=this.userLimit}get deletable(){return super.deletable&&this.permissionsFor(this.client.user).has(r.FLAGS.CONNECT,!1)}get joinable(){return!(n||!this.permissionsFor(this.client.user).has("CONNECT",!1)||this.full&&!this.permissionsFor(this.client.user).has("MOVE_MEMBERS",!1))}get speakable(){return this.permissionsFor(this.client.user).has("SPEAK",!1)}setBitrate(e,t){return this.edit({bitrate:e},t)}setUserLimit(e,t){return this.edit({userLimit:e},t)}join(){return n?Promise.reject(new a("VOICE_NO_BROWSER")):this.client.voice.joinChannel(this)}leave(){if(n)return;const e=this.client.voice.connections.get(this.guild.id);e&&e.channel.id===this.id&&e.disconnect()}}},function(e,t,s){"use strict";const i=s(17);e.exports=class CategoryChannel extends i{get children(){return this.guild.channels.filter(e=>e.parentID===this.id)}}},function(e,t,s){"use strict";const i=s(6);e.exports=class Integration extends i{constructor(e,t,s){super(e),this.guild=s,this.id=t.id,this.name=t.name,this.type=t.type,this.enabled=t.enabled,this.syncing=t.syncing,this.role=this.guild.roles.get(t.role_id),this.user=this.client.users.add(t.user),this.account=t.account,this.syncedAt=t.synced_at,this._patch(t)}_patch(e){this.expireBehavior=e.expire_behavior,this.expireGracePeriod=e.expire_grace_period}sync(){return this.syncing=!0,this.client.api.guilds(this.guild.id).integrations(this.id).post().then(()=>(this.syncing=!1,this.syncedAt=Date.now(),this))}edit(e,t){return"expireBehavior"in e&&(e.expire_behavior=e.expireBehavior,e.expireBehavior=null),"expireGracePeriod"in e&&(e.expire_grace_period=e.expireGracePeriod,e.expireGracePeriod=null),this.client.api.guilds(this.guild.id).integrations(this.id).patch({data:e,reason:t}).then(()=>(this._patch(e),this))}delete(e){return this.client.api.guilds(this.guild.id).integrations(this.id).delete({reason:e}).then(()=>this)}toJSON(){return super.toJSON({role:"roleID",guild:"guildID",user:"userID"})}}},function(e,t,s){"use strict";const i=s(3),n=s(8),r=s(11),o=s(2),a={ALL:"ALL",GUILD:"GUILD",CHANNEL:"CHANNEL",USER:"USER",ROLE:"ROLE",INVITE:"INVITE",WEBHOOK:"WEBHOOK",EMOJI:"EMOJI",MESSAGE:"MESSAGE",UNKNOWN:"UNKNOWN"},l={ALL:null,GUILD_UPDATE:1,CHANNEL_CREATE:10,CHANNEL_UPDATE:11,CHANNEL_DELETE:12,CHANNEL_OVERWRITE_CREATE:13,CHANNEL_OVERWRITE_UPDATE:14,CHANNEL_OVERWRITE_DELETE:15,MEMBER_KICK:20,MEMBER_PRUNE:21,MEMBER_BAN_ADD:22,MEMBER_BAN_REMOVE:23,MEMBER_UPDATE:24,MEMBER_ROLE_UPDATE:25,ROLE_CREATE:30,ROLE_UPDATE:31,ROLE_DELETE:32,INVITE_CREATE:40,INVITE_UPDATE:41,INVITE_DELETE:42,WEBHOOK_CREATE:50,WEBHOOK_UPDATE:51,WEBHOOK_DELETE:52,EMOJI_CREATE:60,EMOJI_UPDATE:61,EMOJI_DELETE:62,MESSAGE_DELETE:72};class GuildAuditLogs{constructor(e,t){if(t.users)for(const s of t.users)e.client.users.add(s);if(this.webhooks=new i,t.webhooks)for(const s of t.webhooks)this.webhooks.set(s.id,new r(e.client,s));this.entries=new i;for(const s of t.audit_log_entries){const t=new GuildAuditLogsEntry(this,e,s);this.entries.set(t.id,t)}}static build(...e){const t=new GuildAuditLogs(...e);return Promise.all(t.entries.map(e=>e.target)).then(()=>t)}static targetType(e){return e<10?a.GUILD:e<20?a.CHANNEL:e<30?a.USER:e<40?a.ROLE:e<50?a.INVITE:e<60?a.WEBHOOK:e<70?a.EMOJI:e<80?a.MESSAGE:a.UNKNOWN}static actionType(e){return[l.CHANNEL_CREATE,l.CHANNEL_OVERWRITE_CREATE,l.MEMBER_BAN_REMOVE,l.ROLE_CREATE,l.INVITE_CREATE,l.WEBHOOK_CREATE,l.EMOJI_CREATE].includes(e)?"CREATE":[l.CHANNEL_DELETE,l.CHANNEL_OVERWRITE_DELETE,l.MEMBER_KICK,l.MEMBER_PRUNE,l.MEMBER_BAN_ADD,l.ROLE_DELETE,l.INVITE_DELETE,l.WEBHOOK_DELETE,l.EMOJI_DELETE,l.MESSAGE_DELETE].includes(e)?"DELETE":[l.GUILD_UPDATE,l.CHANNEL_UPDATE,l.CHANNEL_OVERWRITE_UPDATE,l.MEMBER_UPDATE,l.MEMBER_ROLE_UPDATE,l.ROLE_UPDATE,l.INVITE_UPDATE,l.WEBHOOK_UPDATE,l.EMOJI_UPDATE].includes(e)?"UPDATE":"ALL"}toJSON(){return o.flatten(this)}}class GuildAuditLogsEntry{constructor(e,t,s){const i=GuildAuditLogs.targetType(s.action_type);if(this.targetType=i,this.actionType=GuildAuditLogs.actionType(s.action_type),this.action=Object.keys(l).find(e=>l[e]===s.action_type),this.reason=s.reason||null,this.executor=t.client.users.get(s.user_id),this.changes=s.changes?s.changes.map(e=>({key:e.key,old:e.old_value,new:e.new_value})):null,this.id=s.id,this.extra=null,s.options)if(s.action_type===l.MEMBER_PRUNE)this.extra={removed:s.options.members_removed,days:s.options.delete_member_days};else if(s.action_type===l.MESSAGE_DELETE)this.extra={count:s.options.count,channel:t.channels.get(s.options.channel_id)};else switch(s.options.type){case"member":this.extra=t.members.get(s.options.id),this.extra||(this.extra={id:s.options.id});break;case"role":this.extra=t.roles.get(s.options.id),this.extra||(this.extra={id:s.options.id,name:s.options.role_name})}if(i===a.UNKNOWN)this.target=this.changes.reduce((e,t)=>(e[t.key]=t.new||t.old,e),{}),this.target.id=s.target_id;else if([a.USER,a.GUILD].includes(i))this.target=t.client[`${i.toLowerCase()}s`].get(s.target_id);else if(i===a.WEBHOOK)this.target=e.webhooks.get(s.target_id)||new r(t.client,this.changes.reduce((e,t)=>(e[t.key]=t.new||t.old,e),{id:s.target_id,guild_id:t.id}));else if(i===a.INVITE)if(t.me.permissions.has("MANAGE_GUILD")){const e=this.changes.find(e=>"code"===e.key);this.target=t.fetchInvites().then(t=>(this.target=t.find(t=>t.code===(e.new||e.old)),this.target))}else this.target=this.changes.reduce((e,t)=>(e[t.key]=t.new||t.old,e),{});else i===a.MESSAGE?this.target=t.client.users.get(s.target_id):this.target=t[`${i.toLowerCase()}s`].get(s.target_id)||{id:s.target_id}}get createdTimestamp(){return n.deconstruct(this.id).timestamp}get createdAt(){return new Date(this.createdTimestamp)}toJSON(){return o.flatten(this,{createdTimestamp:!0})}}GuildAuditLogs.Actions=l,GuildAuditLogs.Targets=a,GuildAuditLogs.Entry=GuildAuditLogsEntry,e.exports=GuildAuditLogs},function(e,t,s){"use strict";const i=s(5),n=s(13),{Events:r,OPCodes:o}=s(0),a=s(3),{Error:l,TypeError:h}=s(4);e.exports=class GuildMemberStore extends i{constructor(e,t){super(e.client,t,n),this.guild=e}add(e,t=!0){return super.add(e,t,{id:e.user.id,extras:[this.guild]})}resolve(e){const t=super.resolve(e);if(t)return t;const s=this.client.users.resolveID(e);return s?super.resolve(s):null}resolveID(e){const t=super.resolveID(e);if(t)return t;const s=this.client.users.resolveID(e);return this.has(s)?s:null}fetch(e){if(!e)return this._fetchMany();const t=this.client.users.resolveID(e);return t?this._fetchSingle({user:t,cache:!0}):e.user&&(e.user=this.client.users.resolveID(e.user),e.user)?this._fetchSingle(e):this._fetchMany(e)}prune({days:e=7,dry:t=!1,reason:s}={}){if("number"!=typeof e)throw new h("PRUNE_DAYS_TYPE");return this.client.api.guilds(this.guild.id).prune[t?"get":"post"]({query:{days:e},reason:s}).then(e=>e.pruned)}ban(e,t={days:0}){t.days&&(t["delete-message-days"]=t.days);const s=this.client.users.resolveID(e);return s?this.client.api.guilds(this.guild.id).bans[s].put({query:t}).then(()=>{if(e instanceof n)return e;const t=this.client.users.resolve(s);return t?this.resolve(t)||t:s}):Promise.reject(new l("BAN_RESOLVE_ID",!0))}unban(e,t){const s=this.client.users.resolveID(e);if(!s)throw new l("BAN_RESOLVE_ID");return this.client.api.guilds(this.guild.id).bans[s].delete({reason:t}).then(()=>this.client.users.resolve(e))}_fetchSingle({user:e,cache:t}){const s=this.get(e);return s&&s.joinedTimestamp?Promise.resolve(s):this.client.api.guilds(this.guild.id).members(e).get().then(e=>this.add(e,t))}_fetchMany({query:e="",limit:t=0}={}){return new Promise((s,i)=>{if(this.guild.memberCount===this.size)return void s(e||t?new a:this);this.guild.shard.send({op:o.REQUEST_GUILD_MEMBERS,d:{guild_id:this.guild.id,query:e,limit:t}});const n=new a,h=(i,o)=>{if(o.id===this.guild.id){for(const s of i.values())(e||t)&&n.set(s.id,s);(this.guild.memberCount<=this.size||(e||t)&&i.size<1e3||t&&n.size>=t)&&(this.guild.client.removeListener(r.GUILD_MEMBERS_CHUNK,h),s(e||t?n:this))}};this.guild.client.on(r.GUILD_MEMBERS_CHUNK,h),this.guild.client.setTimeout(()=>{this.guild.client.removeListener(r.GUILD_MEMBERS_CHUNK,h),i(new l("GUILD_MEMBERS_TIMEOUT"))},12e4)})}}},function(e,t,s){"use strict";const i=s(5),n=s(16),{resolveColor:r}=s(2),o=s(7);e.exports=class RoleStore extends i{constructor(e,t){super(e.client,t,n),this.guild=e}add(e,t){return super.add(e,t,{extras:[this.guild]})}async fetch(e,t=!0){if(e){const t=this.get(e);if(t)return t}const s=await this.client.api.guilds(this.guild.id).roles.get();for(const e of s)this.add(e,t);return e?this.get(e)||null:this}create({data:e={},reason:t}={}){return e.color&&(e.color=r(e.color)),e.permissions&&(e.permissions=o.resolve(e.permissions)),this.guild.client.api.guilds(this.guild.id).roles.post({data:e,reason:t}).then(s=>{const{role:i}=this.client.actions.GuildRoleCreate.handle({guild_id:this.guild.id,role:s});return e.position?i.setPosition(e.position,t):i})}get highest(){return this.reduce((e,t)=>t.comparePositionTo(e)>0?t:e,this.first())}}},function(e,t,s){"use strict";const i=s(14),{ChannelTypes:n}=s(0),r=s(5),o=s(17),a=s(41);e.exports=class GuildChannelStore extends r{constructor(e,t){super(e.client,t,o),this.guild=e}add(e){const t=this.get(e.id);return t||i.create(this.client,e,this.guild)}async create(e,t={}){let{type:s,topic:i,nsfw:r,bitrate:o,userLimit:l,parent:h,permissionOverwrites:c,position:u,rateLimitPerUser:d,reason:p}=t;h&&(h=this.client.channels.resolveID(h)),c&&(c=c.map(e=>a.resolve(e,this.guild)));const m=await this.client.api.guilds(this.guild.id).channels.post({data:{name:e,topic:i,type:s?n[s.toUpperCase()]:"text",nsfw:r,bitrate:o,user_limit:l,parent_id:h,position:u,permission_overwrites:c,rate_limit_per_user:d},reason:p});return this.client.actions.ChannelCreate.handle(m).channel}}},function(e,t,s){"use strict";const i=s(5),{Presence:n}=s(12);e.exports=class PresenceStore extends i{constructor(e,t){super(e,t,n)}add(e,t){const s=this.get(e.user.id);return s?s.patch(e):super.add(e,t,{id:e.user.id})}resolve(e){const t=super.resolve(e);if(t)return t;const s=this.client.users.resolveID(e);return super.resolve(s)||null}resolveID(e){const t=super.resolveID(e);if(t)return t;const s=this.client.users.resolveID(e);return this.has(s)?s:null}}},function(e,t,s){"use strict";const{Presence:i}=s(12),n=s(3),{ActivityTypes:r,OPCodes:o}=s(0),{TypeError:a}=s(4);e.exports=class ClientPresence extends i{constructor(e,t={}){super(e,Object.assign(t,{status:"online",user:{id:null}}))}async set(e){const t=await this._parse(e);if(this.patch(t),void 0===e.shardID)this.client.ws.broadcast({op:o.STATUS_UPDATE,d:t});else if(Array.isArray(e.shardID))for(const s of e.shardID)this.client.ws.shards.get(s).send({op:o.STATUS_UPDATE,d:t});else this.client.ws.shards.get(e.shardID).send({op:o.STATUS_UPDATE,d:t});return this}async _parse({status:e,since:t,afk:s,activity:i}){const o=i&&(i.application?i.application.id||i.application:null);let l=new n;if(i){if("string"!=typeof i.name)throw new a("INVALID_TYPE","name","string");if(i.type||(i.type=0),i.assets&&o)try{const e=await this.client.api.oauth2.applications(o).assets.get();for(const t of e)l.set(t.name,t.id)}catch(e){}}const h={afk:null!=s&&s,since:null!=t?t:null,status:e||this.status,game:i?{type:i.type,name:i.name,url:i.url,details:i.details||void 0,state:i.state||void 0,assets:i.assets?{large_text:i.assets.largeText||void 0,small_text:i.assets.smallText||void 0,large_image:l.get(i.assets.largeImage)||i.assets.largeImage,small_image:l.get(i.assets.smallImage)||i.assets.smallImage}:void 0,timestamps:i.timestamps||void 0,party:i.party||void 0,application_id:o||void 0,secrets:i.secrets||void 0,instance:i.instance||void 0}:null};return(e||s||t)&&!i&&(h.game=this.activity),h.game&&(h.game.type="number"==typeof h.game.type?h.game.type:r.indexOf(h.game.type)),h}}},function(e,t,s){"use strict";const i=s(5),n=s(15),r=s(13),o=s(25);e.exports=class UserStore extends i{constructor(e,t){super(e,t,n)}resolve(e){return e instanceof r?e.user:e instanceof o?e.author:super.resolve(e)}resolveID(e){return e instanceof r?e.user.id:e instanceof o?e.author.id:super.resolveID(e)}fetch(e,t=!0){const s=this.get(e);return s?Promise.resolve(s):this.client.api.users(e).get().then(e=>this.add(e,t))}}},function(e,t,s){"use strict";const i=s(5),n=s(14),{Events:r}=s(0),o=Symbol("LRU"),a=["dm"];e.exports=class ChannelStore extends i{constructor(e,t={},s){if(s||"function"==typeof t[Symbol.iterator]||(s=t,t=void 0),super(e,t,n),s.lru){const e=this[o]=[];e.add=(t=>{for(e.remove(t),e.unshift(t);e.length>s.lru;)this.remove(e[e.length-1])}),e.remove=(t=>{const s=e.indexOf(t);s>-1&&e.splice(s,1)})}}get(e,t=!1){const s=super.get(e);return s&&a.includes(s.type)?(!t&&this[o]&&this[o].add(e),s):s}set(e,t){return this[o]&&a.includes(t.type)&&this[o].add(e),super.set(e,t)}delete(e){const t=this.get(e,!0);return!!t&&(this[o]&&a.includes(t.type)&&this[o].remove(e),super.delete(e))}add(e,t,s=!0){const i=this.get(e.id);if(i)return i;const o=n.create(this.client,e,t);return o?(s&&this.set(o.id,o),o):(this.client.emit(r.DEBUG,`Failed to find guild for channel ${e.id} ${e.type}`),null)}remove(e){const t=this.get(e);t.guild&&t.guild.channels.remove(e),super.remove(e)}async fetch(e,t=!0,s=!1){const i=this.get(e);if(i&&!s)return i;const n=await this.client.api.channels(e).get();return i&&i._patch(n),this.add(n,null,t)}}},function(e,t,s){"use strict";const i=s(5),n=s(9),{Events:r}=s(0),o=s(42);e.exports=class GuildStore extends i{constructor(e,t){super(e,t,o)}create(e,{region:t,icon:s=null}={}){return!s||"string"==typeof s&&s.startsWith("data:")?new Promise((i,n)=>this.client.api.guilds.post({data:{name:e,region:t,icon:s}}).then(e=>{if(this.client.guilds.has(e.id))return i(this.client.guilds.get(e.id));const t=n=>{n.id===e.id&&(this.client.removeListener(r.GUILD_CREATE,t),this.client.clearTimeout(s),i(n))};this.client.on(r.GUILD_CREATE,t);const s=this.client.setTimeout(()=>{this.client.removeListener(r.GUILD_CREATE,t),i(this.client.guilds.add(e))},1e4)},n)):n.resolveImage(s).then(s=>this.create(e,{region:t,icon:s||null}))}}},function(e,t,s){"use strict";const i=s(2);e.exports={BaseClient:s(30),Client:s(93),Shard:s(177),ShardClientUtil:s(178),ShardingManager:s(179),WebhookClient:s(37),ActivityFlags:s(65),BitField:s(20),Collection:s(3),Constants:s(0),DataResolver:s(9),DataStore:s(5),DiscordAPIError:s(50),HTTPError:s(51),Permissions:s(7),Speaking:s(180),Snowflake:s(8),SnowflakeUtil:s(8),Structures:s(18),Util:i,util:i,version:s(45).version,ChannelStore:s(81),GuildChannelStore:s(77),GuildEmojiStore:s(44),GuildEmojiRoleStore:s(62),GuildMemberStore:s(75),GuildMemberRoleStore:s(66),GuildStore:s(82),ReactionUserStore:s(69),MessageStore:s(24),PresenceStore:s(78),RoleStore:s(76),UserStore:s(80),discordSort:i.discordSort,escapeMarkdown:i.escapeMarkdown,fetchRecommendedShards:i.fetchRecommendedShards,resolveColor:i.resolveColor,resolveString:i.resolveString,splitMessage:i.splitMessage,Base:s(6),Activity:s(12).Activity,APIMessage:s(23),CategoryChannel:s(72),Channel:s(14),ClientApplication:s(38),get ClientUser(){return s(61)},Collector:s(34),DMChannel:s(63),Emoji:s(33),Guild:s(42),GuildAuditLogs:s(74),GuildChannel:s(17),GuildEmoji:s(21),GuildMember:s(13),Integration:s(73),Invite:s(26),Message:s(25),MessageAttachment:s(36),MessageCollector:s(64),MessageEmbed:s(35),MessageMentions:s(67),MessageReaction:s(39),PermissionOverwrites:s(41),Presence:s(12).Presence,ClientPresence:s(79),ReactionCollector:s(68),ReactionEmoji:s(40),RichPresenceAssets:s(12).RichPresenceAssets,Role:s(16),TextChannel:s(70),User:s(15),VoiceChannel:s(71),VoiceRegion:s(43),VoiceState:s(19),Webhook:s(11),WebSocket:s(53)}},function(e,t,s){"use strict";const{register:i}=s(46),n={CLIENT_INVALID_OPTION:(e,t)=>`The ${e} option must be ${t}`,TOKEN_INVALID:"An invalid token was provided.",TOKEN_MISSING:"Request to use token, but token was unavailable to the client.",WS_CLOSE_REQUESTED:"WebSocket closed due to user request.",WS_CONNECTION_TIMEOUT:"The connection to the gateway timed out.",WS_CONNECTION_EXISTS:"There is already an existing WebSocket connection.",WS_NOT_OPEN:(e="data")=>`Websocket not open to send ${e}`,BITFIELD_INVALID:"Invalid bitfield flag or number.",RATELIMIT_INVALID_METHOD:"Unknown rate limiting method.",SHARDING_INVALID:"Invalid shard settings were provided.",SHARDING_REQUIRED:"This session would have handled too many guilds - Sharding is required.",SHARDING_CHILD_CONNECTION:"Failed to send message to shard's process.",SHARDING_PARENT_CONNECTION:"Failed to send message to master process.",SHARDING_NO_SHARDS:"No shards have been spawned.",SHARDING_IN_PROCESS:"Shards are still being spawned.",SHARDING_ALREADY_SPAWNED:e=>`Already spawned ${e} shards.`,SHARDING_PROCESS_EXISTS:e=>`Shard ${e} already has an active process.`,SHARDING_READY_TIMEOUT:e=>`Shard ${e}'s Client took too long to become ready.`,SHARDING_READY_DISCONNECTED:e=>`Shard ${e}'s Client disconnected before becoming ready.`,SHARDING_READY_DIED:e=>`Shard ${e}'s process exited before its Client became ready.`,COLOR_RANGE:"Color must be within the range 0 - 16777215 (0xFFFFFF).",COLOR_CONVERT:"Unable to convert color to a number.",EMBED_FIELD_NAME:"MessageEmbed field names may not be empty.",EMBED_FIELD_VALUE:"MessageEmbed field values may not be empty.",FILE_NOT_FOUND:e=>`File could not be found: ${e}`,USER_NO_DMCHANNEL:"No DM Channel exists!",VOICE_INVALID_HEARTBEAT:"Tried to set voice heartbeat but no valid interval was specified.",VOICE_USER_MISSING:"Couldn't resolve the user to create stream.",VOICE_STREAM_EXISTS:"There is already an existing stream for that user.",VOICE_JOIN_CHANNEL:(e=!1)=>`You do not have permission to join this voice channel${e?"; it is full.":"."}`,VOICE_CONNECTION_TIMEOUT:"Connection not established within 15 seconds.",VOICE_TOKEN_ABSENT:"Token not provided from voice server packet.",VOICE_SESSION_ABSENT:"Session ID not supplied.",VOICE_INVALID_ENDPOINT:"Invalid endpoint received.",VOICE_NO_BROWSER:"Voice connections are not available in browsers.",VOICE_CONNECTION_ATTEMPTS_EXCEEDED:e=>`Too many connection attempts (${e}).`,VOICE_JOIN_SOCKET_CLOSED:"Tried to send join packet, but the WebSocket is not open.",VOICE_PLAY_INTERFACE_NO_BROADCAST:"A broadcast cannot be played in this context.",VOICE_PLAY_INTERFACE_BAD_TYPE:"Unknown stream type",VOICE_PRISM_DEMUXERS_NEED_STREAM:"To play a webm/ogg stream, you need to pass a ReadableStream.",VOICE_STATE_UNCACHED_MEMBER:"The member of this voice state is uncached.",OPUS_ENGINE_MISSING:"Couldn't find an Opus engine.",UDP_SEND_FAIL:"Tried to send a UDP packet, but there is no socket available.",UDP_ADDRESS_MALFORMED:"Malformed UDP address or port.",UDP_CONNECTION_EXISTS:"There is already an existing UDP connection.",REQ_BODY_TYPE:"The response body isn't a Buffer.",REQ_RESOURCE_TYPE:"The resource must be a string, Buffer or a valid file stream.",IMAGE_FORMAT:e=>`Invalid image format: ${e}`,IMAGE_SIZE:e=>`Invalid image size: ${e}`,MESSAGE_MISSING:"Message not found",MESSAGE_BULK_DELETE_TYPE:"The messages must be an Array, Collection, or number.",MESSAGE_NONCE_TYPE:"Message nonce must fit in an unsigned 64-bit integer.",TYPING_COUNT:"Count must be at least 1",SPLIT_MAX_LEN:"Chunk exceeds the max length and contains no split characters.",BAN_RESOLVE_ID:(e=!1)=>`Couldn't resolve the user ID to ${e?"ban":"unban"}.`,PRUNE_DAYS_TYPE:"Days must be a number",SEARCH_CHANNEL_TYPE:"Target must be a TextChannel, DMChannel, or Guild.",GUILD_CHANNEL_RESOLVE:"Could not resolve channel to a guild channel.",GUILD_VOICE_CHANNEL_RESOLVE:"Could not resolve channel to a guild voice channel.",GUILD_CHANNEL_ORPHAN:"Could not find a parent to this guild channel.",GUILD_OWNED:"Guild is owned by the client.",GUILD_RESTRICTED:(e=!1)=>`Guild is ${e?"already":"not"} restricted.`,GUILD_MEMBERS_TIMEOUT:"Members didn't arrive in time.",INVALID_TYPE:(e,t,s=!1)=>`Supplied ${e} is not a${s?"n":""} ${t}.`,WEBHOOK_MESSAGE:"The message was not sent by a webhook.",EMOJI_TYPE:"Emoji must be a string or GuildEmoji/ReactionEmoji",EMOJI_MANAGED:"Emoji is managed and has no Author.",MISSING_MANAGE_EMOJIS_PERMISSION:e=>`Client must have Manage Emoji permission in guild ${e} to see emoji authors.`,REACTION_RESOLVE_USER:"Couldn't resolve the user ID to remove from the reaction.",VANITY_URL:"This guild does not have the VANITY_URL feature enabled."};for(const[e,t]of Object.entries(n))i(e,t)},function(e,t,s){"use strict";const i=s(86),n=s(87),r=s(92),{Error:o}=s(4),{Endpoints:a}=s(0),l=s(3);e.exports=class RESTManager{constructor(e,t="Bot"){this.client=e,this.handlers=new l,this.tokenPrefix=t,this.versioned=!0,this.globalTimeout=null,e.options.restSweepInterval>0&&e.setInterval(()=>{this.handlers.sweep(e=>e._inactive)},1e3*e.options.restSweepInterval)}get api(){return r(this)}getAuth(){const e=this.client.token||this.client.accessToken,t=!!this.client.application||this.client.user;if(e&&t)return`${this.tokenPrefix} ${e}`;if(e)return e;throw new o("TOKEN_MISSING")}get cdn(){return a.CDN(this.client.options.http.cdn)}push(e,t){return new Promise((s,i)=>{e.push({request:t,resolve:s,reject:i,retries:0}).catch(i)})}request(e,t,s={}){const r=new n(this,e,t,s);let o=this.handlers.get(r.route);return o||(o=new i(this),this.handlers.set(r.route,o)),this.push(o,r)}set endpoint(e){this.client.options.http.api=e}}},function(e,t,s){"use strict";const i=s(50),n=s(51),r=s(2),{Events:{RATE_LIMIT:o},browser:a}=s(0);function l(e){return e.headers.get("content-type").startsWith("application/json")?e.json():a?e.blob():e.buffer()}function h(e){return new Date(e).getTime()-Date.now()}e.exports=class RequestHandler{constructor(e){this.manager=e,this.busy=!1,this.queue=[],this.reset=-1,this.remaining=-1,this.limit=-1,this.retryAfter=-1}push(e){return this.busy?(this.queue.push(e),this.run()):this.execute(e)}run(){return 0===this.queue.length?Promise.resolve():this.execute(this.queue.shift())}get limited(){return(this.manager.globalTimeout||this.remaining<=0)&&Date.now()=500&&c.status<600)return e.retries===this.manager.client.options.retryLimit?t(new n(c.statusText,c.constructor.name,c.status,e.request.method,s.path)):(e.retries++,this.queue.unshift(e),this.run());try{const e=await l(c);return c.status>=400&&c.status<500?t(new i(s.path,e,s.method)):null}catch(e){return t(new n(e.message,e.constructor.name,e.status,s.method,s.path))}}}},function(e,t,s){"use strict";const i=s(52),n=s(90),r=s(91),{browser:o,UserAgent:a}=s(0),l=s(28);if(r.Agent)var h=new r.Agent({keepAlive:!0});e.exports=class APIRequest{constructor(e,t,s,n){this.rest=e,this.client=e.client,this.method=t,this.route=n.route,this.options=n;const r=(i.stringify(n.query).match(/[^=&?]+=[^=&?]+/g)||[]).join("&");this.path=`${s}${r?`?${r}`:""}`}make(){const e=(!1===this.options.versioned?this.client.options.http.api:`${this.client.options.http.api}/v${this.client.options.http.version}`)+this.path;let t,s={};if(!1!==this.options.auth&&(s.Authorization=this.rest.getAuth()),this.options.reason&&(s["X-Audit-Log-Reason"]=encodeURIComponent(this.options.reason)),o||(s["User-Agent"]=a),this.options.headers&&(s=Object.assign(s,this.options.headers)),this.options.files){t=new n;for(const e of this.options.files)e&&e.file&&t.append(e.name,e.file,e.name);void 0!==this.options.data&&t.append("payload_json",JSON.stringify(this.options.data)),o||(s=Object.assign(s,t.getHeaders()))}else null!=this.options.data&&(t=JSON.stringify(this.options.data),s["Content-Type"]="application/json");return l(e,{method:this.method,headers:s,agent:h,body:t})}}},function(e,t,s){"use strict";function i(e,t){return Object.prototype.hasOwnProperty.call(e,t)}e.exports=function(e,t,s,r){t=t||"&",s=s||"=";var o={};if("string"!=typeof e||0===e.length)return o;var a=/\+/g;e=e.split(t);var l=1e3;r&&"number"==typeof r.maxKeys&&(l=r.maxKeys);var h=e.length;l>0&&h>l&&(h=l);for(var c=0;c=0?(u=f.substr(0,_),d=f.substr(_+1)):(u=f,d=""),p=decodeURIComponent(u),m=decodeURIComponent(d),i(o,p)?n(o[p])?o[p].push(m):o[p]=[o[p],m]:o[p]=m}return o};var n=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}},function(e,t,s){"use strict";var i=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}};e.exports=function(e,t,s,a){return t=t||"&",s=s||"=",null===e&&(e=void 0),"object"==typeof e?r(o(e),function(o){var a=encodeURIComponent(i(o))+s;return n(e[o])?r(e[o],function(e){return a+encodeURIComponent(i(e))}).join(t):a+encodeURIComponent(i(e[o]))}).join(t):a?encodeURIComponent(i(a))+s+encodeURIComponent(i(e)):""};var n=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)};function r(e,t){if(e.map)return e.map(t);for(var s=[],i=0;i{},n=["get","post","delete","patch","put"],r=["toString","valueOf","inspect","constructor",Symbol.toPrimitive,Symbol.for("util.inspect.custom")];e.exports=function(e){const t=[""],s={get:(o,a)=>r.includes(a)?()=>t.join("/"):n.includes(a)?s=>e.request(a,t.join("/"),Object.assign({versioned:e.versioned,route:t.map((e,s)=>/\d{16,19}/g.test(e)?/channels|guilds/.test(t[s-1])?e:":id":"reactions"===t[s-1]?":reaction":e).join("/")},s)):(t.push(a),new Proxy(i,s)),apply:(e,n,r)=>(t.push(...r.filter(e=>null!=e)),new Proxy(i,s))};return new Proxy(i,s)}},function(module,exports,__webpack_require__){"use strict";(function(process){const BaseClient=__webpack_require__(30),Permissions=__webpack_require__(7),ClientVoiceManager=__webpack_require__(94),WebSocketManager=__webpack_require__(95),ActionsManager=__webpack_require__(146),Collection=__webpack_require__(3),VoiceRegion=__webpack_require__(43),Webhook=__webpack_require__(11),Invite=__webpack_require__(26),ClientApplication=__webpack_require__(38),ShardClientUtil=__webpack_require__(175),VoiceBroadcast=__webpack_require__(176),UserStore=__webpack_require__(80),ChannelStore=__webpack_require__(81),GuildStore=__webpack_require__(82),GuildEmojiStore=__webpack_require__(44),{Events:Events,WSCodes:WSCodes,browser:browser,DefaultOptions:DefaultOptions}=__webpack_require__(0),{delayFor:delayFor}=__webpack_require__(2),DataResolver=__webpack_require__(9),Structures=__webpack_require__(18),{Error:Error,TypeError:TypeError,RangeError:RangeError}=__webpack_require__(4);class Client extends BaseClient{constructor(e={}){super(Object.assign({_tokenType:"Bot"},e));let t=process.env;try{t=__webpack_require__(!function(){var e=new Error("Cannot find module 'worker_threads'");throw e.code="MODULE_NOT_FOUND",e}()).workerData||t}catch(e){}if(this.options.shards===DefaultOptions.shards&&"SHARDS"in t&&(this.options.shards=JSON.parse(t.SHARDS)),this.options.totalShardCount===DefaultOptions.totalShardCount&&("TOTAL_SHARD_COUNT"in t?this.options.totalShardCount=Number(t.TOTAL_SHARD_COUNT):Array.isArray(this.options.shards)?this.options.totalShardCount=this.options.shards.length:this.options.totalShardCount=this.options.shardCount),void 0===this.options.shards&&this.options.shardCount){this.options.shards=[];for(let e=0;e0&&this.setInterval(this.sweepMessages.bind(this),1e3*this.options.messageSweepInterval)}get voiceConnections(){return browser?new Collection:this.voice.connections}get emojis(){const e=new GuildEmojiStore({client:this});for(const t of this.guilds.values())if(t.available)for(const s of t.emojis.values())e.set(s.id,s);return e}get readyTimestamp(){return this.readyAt?this.readyAt.getTime():null}get uptime(){return this.readyAt?Date.now()-this.readyAt:null}createVoiceBroadcast(){const e=new VoiceBroadcast(this);return this.broadcasts.push(e),e}async login(e=this.token){if(!e||"string"!=typeof e)throw new Error("TOKEN_INVALID");this.token=e=e.replace(/^(Bot|Bearer)\s*/i,""),this.emit(Events.DEBUG,`Authenticating using token ${e}`);let t=this.api.gateway;"auto"===this.options.shardCount&&(t=t.bot);const s=await t.get();if(this.options.presence&&(this.options.ws.presence=await this.presence._parse(this.options.presence)),s.session_start_limit&&0===s.session_start_limit.remaining){const{session_start_limit:{reset_after:e}}=s;this.emit(Events.DEBUG,`Exceeded identify threshold, setting a timeout for ${e} ms`),await delayFor(e)}const i=`${s.url}/`;if("auto"===this.options.shardCount&&(this.emit(Events.DEBUG,`Using recommended shard count ${s.shards}`),this.options.shardCount=s.shards,this.options.totalShardCount=s.shards,void 0===this.options.shards||!this.options.shards.length)){this.options.shards=[];for(let e=0;e{const s=()=>{clearTimeout(n),this.removeListener(Events.DISCONNECT,i),e()},i=e=>{clearTimeout(n),this.removeListener(Events.READY,s),this.destroy(),WSCodes[e.code]&&t(new Error(WSCodes[e.code]))},n=setTimeout(()=>{this.removeListener(Events.READY,s),this.removeListener(Events.DISCONNECT,i),this.destroy(),t(new Error("WS_CONNECTION_TIMEOUT"))},25e3*this.options.shardCount);void 0!==n.unref&&n.unref(),this.once(Events.READY,s),this.once(Events.DISCONNECT,i)}),e}destroy(){super.destroy(),this.ws.destroy(),this.token=null}fetchInvite(e){const t=DataResolver.resolveInviteCode(e);return this.api.invites(t).get({query:{with_counts:!0}}).then(e=>new Invite(this,e))}fetchWebhook(e,t){return this.api.webhooks(e,t).get().then(e=>new Webhook(this,e))}fetchVoiceRegions(){return this.api.voice.regions.get().then(e=>{const t=new Collection;for(const s of e)t.set(s.id,new VoiceRegion(s));return t})}sweepMessages(e=this.options.messageCacheLifetime){if("number"!=typeof e||isNaN(e))throw new TypeError("CLIENT_INVALID_OPTION","Lifetime","a number");if(e<=0)return this.emit(Events.DEBUG,"Didn't sweep messages - lifetime is unlimited"),-1;const t=1e3*e,s=Date.now();let i=0,n=0;for(const e of this.channels.values())e.messages&&(i++,n+=e.messages.sweep(e=>s-(e.editedTimestamp||e.createdTimestamp)>t));return this.emit(Events.DEBUG,`Swept ${n} messages older than ${e} seconds in ${i} text-based channels`),n}fetchApplication(){return this.api.oauth2.applications("@me").get().then(e=>new ClientApplication(this,e))}generateInvite(e){return e=Permissions.resolve(e),this.fetchApplication().then(t=>`https://discordapp.com/oauth2/authorize?client_id=${t.id}&permissions=${e}&scope=bot`)}toJSON(){return super.toJSON({readyAt:!1,broadcasts:!1,presences:!1})}_eval(script){return eval(script)}_validateOptions(e=this.options){if("auto"!==e.shardCount&&("number"!=typeof e.shardCount||isNaN(e.shardCount)))throw new TypeError("CLIENT_INVALID_OPTION","shardCount",'a number or "auto"');if(e.shards&&"number"!=typeof e.shards&&!Array.isArray(e.shards))throw new TypeError("CLIENT_INVALID_OPTION","shards","a number or array");if(e.shardCount<1)throw new RangeError("CLIENT_INVALID_OPTION","shardCount","at least 1");if("number"!=typeof e.messageCacheMaxSize||isNaN(e.messageCacheMaxSize))throw new TypeError("CLIENT_INVALID_OPTION","messageCacheMaxSize","a number");if("number"!=typeof e.messageCacheLifetime||isNaN(e.messageCacheLifetime))throw new TypeError("CLIENT_INVALID_OPTION","The messageCacheLifetime","a number");if("number"!=typeof e.messageSweepInterval||isNaN(e.messageSweepInterval))throw new TypeError("CLIENT_INVALID_OPTION","messageSweepInterval","a number");if("boolean"!=typeof e.fetchAllMembers)throw new TypeError("CLIENT_INVALID_OPTION","fetchAllMembers","a boolean");if("boolean"!=typeof e.disableEveryone)throw new TypeError("CLIENT_INVALID_OPTION","disableEveryone","a boolean");if("boolean"!=typeof e.partials)throw new TypeError("CLIENT_INVALID_OPTION","partials","a boolean");if("number"!=typeof e.restWsBridgeTimeout||isNaN(e.restWsBridgeTimeout))throw new TypeError("CLIENT_INVALID_OPTION","restWsBridgeTimeout","a number");if("number"!=typeof e.restSweepInterval||isNaN(e.restSweepInterval))throw new TypeError("CLIENT_INVALID_OPTION","restSweepInterval","a number");if(!(e.disabledEvents instanceof Array))throw new TypeError("CLIENT_INVALID_OPTION","disabledEvents","an Array");if("number"!=typeof e.retryLimit||isNaN(e.retryLimit))throw new TypeError("CLIENT_INVALID_OPTION","retryLimit","a number")}}module.exports=Client}).call(this,__webpack_require__(27))},function(e,t){},function(e,t,s){"use strict";const i=s(3),n=s(96),{Events:r,Status:o,WSEvents:a}=s(0),l=s(60),h=[a.READY,a.RESUMED,a.GUILD_CREATE,a.GUILD_DELETE,a.GUILD_MEMBERS_CHUNK,a.GUILD_MEMBER_ADD,a.GUILD_MEMBER_REMOVE];e.exports=class WebSocketManager{constructor(e){Object.defineProperty(this,"client",{value:e}),this.gateway=void 0,this.shards=new i,this.spawnQueue=[],this.spawning=!1,this.packetQueue=[],this.status=o.IDLE,this.sessionStartLimit=null}get ping(){return this.shards.reduce((e,t)=>e+t.ping,0)/this.shards.size}debug(e){this.client.emit(r.DEBUG,`[connection] ${e}`)}async _handleSessionLimit(e){this.sessionStartLimit=await this.client.api.gateway.bot.get().then(e=>e.session_start_limit);const{remaining:t,reset_after:s}=this.sessionStartLimit;0!==t?this.spawn():(e.debug(`Exceeded identify threshold, setting a timeout for ${s} ms`),setTimeout(()=>this.spawn(),this.sessionStartLimit.reset_after))}spawn(e){if(void 0!==e)if(Array.isArray(e))for(const t of e)this.spawnQueue.includes(t)||this.spawnQueue.push(t);else this.spawnQueue.includes(e)||this.spawnQueue.push(e);if(this.spawning||!this.spawnQueue.length)return;this.spawning=!0;let t=this.spawnQueue.shift();if("string"!=typeof t||isNaN(t)||(t=Number(t)),"number"==typeof t){const e=new n(this,t,this.shards.get(t));this.shards.set(t,e),e.once(r.READY,()=>{this.spawning=!1,this.client.setTimeout(()=>this._handleSessionLimit(e),5e3)}),e.once(r.INVALIDATED,()=>{this.spawning=!1})}else t instanceof n&&t.reconnect()}connect(e=this.gateway){if(this.gateway=e,"number"==typeof this.client.options.shards)this.debug("Spawning 1 shard"),this.spawn(this.client.options.shards);else if(Array.isArray(this.client.options.shards)){this.debug(`Spawning ${this.client.options.shards.length} shards`);for(const e of this.client.options.shards)this.spawn(e)}else{this.debug(`Spawning ${this.client.options.shardCount} shards`);for(let e=0;e{this.handlePacket(e.packet,this.shards.get(e.shardID))})}return e&&!this.client.options.disabledEvents.includes(e.t)&&l[e.t]&&l[e.t](this.client,e,t),!1}checkReady(){if(this.shards.size!==this.client.options.shardCount||this.shards.some(e=>e&&e.status!==o.READY))return!1;let e=0;for(const t of this.client.guilds.values())t.available||e++;if(0===e){if(this.status=o.NEARLY,!this.client.options.fetchAllMembers)return this.triggerReady();const e=this.client.guilds.map(e=>e.members.fetch());Promise.all(e).then(()=>this.triggerReady()).catch(e=>{this.debug(`Failed to fetch all members before ready! ${e}`),this.triggerReady()})}return!0}triggerReady(){this.status!==o.READY?(this.status=o.READY,this.client.emit(r.READY),this.handlePacket()):this.debug("Tried to mark self as ready, but already ready")}broadcast(e){for(const t of this.shards.values())t.send(e)}destroy(){this.gateway=void 0,this.spawning=!0;for(const e of this.shards.values())e.destroy()}}},function(e,t,s){"use strict";const i=s(31),n=s(53),{Status:r,Events:o,OPCodes:a,WSEvents:l,WSCodes:h}=s(0),c=s(2);let u;try{(u=s(100)).Inflate||(u=s(54))}catch(e){u=s(54)}e.exports=class WebSocketShard extends i{constructor(e,t,s){super(),this.manager=e,this.id=t,this.status=r.IDLE,this.sequence=s?s.sequence:-1,this.closeSequence=s?s.closeSequence:0,this.sessionID=s&&s.sessionID,this.pings=[],this.lastPingTimestamp=-1,this.trace=[],this.ratelimit={queue:[],total:120,remaining:120,time:6e4,timer:null},this.ws=null,this.inflate=null,this.expectingClose=!1,this.connect()}get ping(){return this.pings.reduce((e,t)=>e+t,0)/this.pings.length}debug(e){this.manager.debug(`[shard ${this.id}] ${e}`)}heartbeat(e){isNaN(e)?(this.debug("Sending a heartbeat"),this.lastPingTimestamp=Date.now(),this.send({op:a.HEARTBEAT,d:this.sequence})):-1===e?(this.debug("Clearing heartbeat interval"),this.manager.client.clearInterval(this.heartbeatInterval),this.heartbeatInterval=null):(this.debug(`Setting a heartbeat interval for ${e}ms`),this.heartbeatInterval&&this.manager.client.clearInterval(this.heartbeatInterval),this.heartbeatInterval=this.manager.client.setInterval(()=>this.heartbeat(),e))}ackHeartbeat(){const e=Date.now()-this.lastPingTimestamp;this.debug(`Heartbeat acknowledged, latency of ${e}ms`),this.pings.unshift(e),this.pings.length>3&&(this.pings.length=3)}connect(){this.inflate=new u.Inflate({chunkSize:65535,flush:u.Z_SYNC_FLUSH,to:"json"===n.encoding?"string":""});const e=this.manager.gateway;this.debug(`Connecting to ${e}`);const t=this.ws=n.create(e,{v:this.manager.client.options.ws.version,compress:"zlib-stream"});t.onopen=this.onOpen.bind(this),t.onmessage=this.onMessage.bind(this),t.onerror=this.onError.bind(this),t.onclose=this.onClose.bind(this),this.status=r.CONNECTING}onPacket(e){if(!e)return this.debug("Received null packet"),!1;switch(e.t){case l.READY:this.sessionID=e.d.session_id,this.trace=e.d._trace,this.status=r.READY,this.debug(`READY ${this.trace.join(" -> ")} ${this.sessionID}`),this.heartbeat();break;case l.RESUMED:{this.trace=e.d._trace,this.status=r.READY;const t=e.s-this.closeSequence;this.debug(`RESUMED ${this.trace.join(" -> ")} | replayed ${t} events.`),this.heartbeat();break}}switch(e.s>this.sequence&&(this.sequence=e.s),e.op){case a.HELLO:return this.identify(),this.heartbeat(e.d.heartbeat_interval);case a.RECONNECT:return this.reconnect();case a.INVALID_SESSION:return this.sequence=-1,this.debug("Session invalidated"),e.d?this.identify():this.sessionID?(this.sessionID=null,this.identify(2500)):this.identify(5e3);case a.HEARTBEAT_ACK:return this.ackHeartbeat();case a.HEARTBEAT:return this.heartbeat();default:return this.manager.handlePacket(e,this)}}onOpen(){this.debug("Connection open")}onMessage({data:e}){e instanceof ArrayBuffer&&(e=new Uint8Array(e));const t=e.length,s=t>=4&&0===e[t-4]&&0===e[t-3]&&255===e[t-2]&&255===e[t-1];if(this.inflate.push(e,s&&u.Z_SYNC_FLUSH),!s)return;let i;try{i=n.unpack(this.inflate.result),this.manager.client.emit(o.RAW,i,this.id)}catch(e){return void this.manager.client.emit(o.ERROR,e)}i.t===l.READY&&(this.emit(o.READY),this.manager.client.emit(o.SHARD_READY,this.id)),this.onPacket(i)}onError(e){e&&"uWs client connection error"===e.message?this.reconnect():(this.emit(o.INVALIDATED),this.manager.client.emit(o.ERROR,e))}onClose(e){if(this.closeSequence=this.sequence,this.emit("close",e),1e3===e.code?this.expectingClose:h[e.code])return this.manager.client.emit(o.DISCONNECT,e,this.id),this.debug(h[e.code]),void this.heartbeat(-1);this.expectingClose=!1,this.reconnect(o.INVALIDATED,5100)}identify(e=0){return e?this.manager.client.setTimeout(this.identify.bind(this),e):this.sessionID?this.identifyResume():this.identifyNew()}identifyNew(){if(!this.manager.client.token)return void this.debug("No token available to identify a new session with");const e=Object.assign({token:this.manager.client.token},this.manager.client.options.ws),{totalShardCount:t}=this.manager.client.options;e.shard=[this.id,Number(t)],this.debug("Identifying as a new session"),this.send({op:a.IDENTIFY,d:e})}identifyResume(){if(!this.sessionID)return this.debug("Warning: wanted to resume but session ID not available; identifying as a new session instead"),this.identifyNew();this.debug(`Attempting to resume session ${this.sessionID}`);const e={token:this.manager.client.token,session_id:this.sessionID,seq:this.sequence};return this.send({op:a.RESUME,d:e})}send(e){this.ratelimit.queue.push(e),this.processQueue()}_send(e){this.ws&&this.ws.readyState===n.OPEN?this.ws.send(n.pack(e),e=>{e&&this.manager.client.emit(o.ERROR,e)}):this.debug(`Tried to send packet ${e} but no WebSocket is available!`)}processQueue(){if(0!==this.ratelimit.remaining&&0!==this.ratelimit.queue.length)for(this.ratelimit.remaining===this.ratelimit.total&&(this.ratelimit.timer=this.manager.client.setTimeout(()=>{this.ratelimit.remaining=this.ratelimit.total,this.processQueue()},this.ratelimit.time));this.ratelimit.remaining>0;){const e=this.ratelimit.queue.shift();if(!e)return;this._send(e),this.ratelimit.remaining--}}async reconnect(e,t){this.heartbeat(-1),this.status=r.RECONNECTING,this.manager.client.emit(o.RECONNECTING,this.id),e===o.INVALIDATED&&this.emit(e),this.debug(t?`Reconnecting in ${t}ms`:"Reconnecting now"),t&&await c.delayFor(t),this.manager.spawn(this.id)}destroy(){this.heartbeat(-1),this.expectingClose=!0,this.ws&&this.ws.close(1e3),this.ws=null,this.status=r.DISCONNECTED,this.ratelimit.remaining=this.ratelimit.total,this.ratelimit.timer&&(this.manager.client.clearTimeout(this.ratelimit.timer),this.ratelimit.timer=null)}}},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t,s){"use strict";var i=s(102),n=s(10),r=s(57),o=s(32),a=s(58),l=Object.prototype.toString,h=0,c=-1,u=0,d=8;function p(e){if(!(this instanceof p))return new p(e);this.options=n.assign({level:c,method:d,chunkSize:16384,windowBits:15,memLevel:8,strategy:u,to:""},e||{});var t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new a,this.strm.avail_out=0;var s=i.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(s!==h)throw new Error(o[s]);if(t.header&&i.deflateSetHeader(this.strm,t.header),t.dictionary){var m;if(m="string"==typeof t.dictionary?r.string2buf(t.dictionary):"[object ArrayBuffer]"===l.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,(s=i.deflateSetDictionary(this.strm,m))!==h)throw new Error(o[s]);this._dict_set=!0}}function m(e,t){var s=new p(t);if(s.push(e,!0),s.err)throw s.msg||o[s.err];return s.result}p.prototype.push=function(e,t){var s,o,a=this.strm,c=this.options.chunkSize;if(this.ended)return!1;o=t===~~t?t:!0===t?4:0,"string"==typeof e?a.input=r.string2buf(e):"[object ArrayBuffer]"===l.call(e)?a.input=new Uint8Array(e):a.input=e,a.next_in=0,a.avail_in=a.input.length;do{if(0===a.avail_out&&(a.output=new n.Buf8(c),a.next_out=0,a.avail_out=c),1!==(s=i.deflate(a,o))&&s!==h)return this.onEnd(s),this.ended=!0,!1;0!==a.avail_out&&(0!==a.avail_in||4!==o&&2!==o)||("string"===this.options.to?this.onData(r.buf2binstring(n.shrinkBuf(a.output,a.next_out))):this.onData(n.shrinkBuf(a.output,a.next_out)))}while((a.avail_in>0||0===a.avail_out)&&1!==s);return 4===o?(s=i.deflateEnd(this.strm),this.onEnd(s),this.ended=!0,s===h):2!==o||(this.onEnd(h),a.avail_out=0,!0)},p.prototype.onData=function(e){this.chunks.push(e)},p.prototype.onEnd=function(e){e===h&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=n.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},t.Deflate=p,t.deflate=m,t.deflateRaw=function(e,t){return(t=t||{}).raw=!0,m(e,t)},t.gzip=function(e,t){return(t=t||{}).gzip=!0,m(e,t)}},function(e,t,s){"use strict";var i,n=s(10),r=s(103),o=s(55),a=s(56),l=s(32),h=0,c=1,u=3,d=4,p=5,m=0,f=1,_=-2,g=-3,E=-5,v=-1,b=1,w=2,y=3,A=4,I=0,T=2,S=8,D=9,N=15,C=8,O=286,R=30,L=19,M=2*O+1,k=15,x=3,U=258,P=U+x+1,G=32,j=42,B=69,z=73,V=91,H=103,$=113,F=666,W=1,K=2,Y=3,q=4,J=3;function Z(e,t){return e.msg=l[t],t}function Q(e){return(e<<1)-(e>4?9:0)}function X(e){for(var t=e.length;--t>=0;)e[t]=0}function ee(e){var t=e.state,s=t.pending;s>e.avail_out&&(s=e.avail_out),0!==s&&(n.arraySet(e.output,t.pending_buf,t.pending_out,s,e.next_out),e.next_out+=s,t.pending_out+=s,e.total_out+=s,e.avail_out-=s,t.pending-=s,0===t.pending&&(t.pending_out=0))}function te(e,t){r._tr_flush_block(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,ee(e.strm)}function se(e,t){e.pending_buf[e.pending++]=t}function ie(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function ne(e,t){var s,i,n=e.max_chain_length,r=e.strstart,o=e.prev_length,a=e.nice_match,l=e.strstart>e.w_size-P?e.strstart-(e.w_size-P):0,h=e.window,c=e.w_mask,u=e.prev,d=e.strstart+U,p=h[r+o-1],m=h[r+o];e.prev_length>=e.good_match&&(n>>=2),a>e.lookahead&&(a=e.lookahead);do{if(h[(s=t)+o]===m&&h[s+o-1]===p&&h[s]===h[r]&&h[++s]===h[r+1]){r+=2,s++;do{}while(h[++r]===h[++s]&&h[++r]===h[++s]&&h[++r]===h[++s]&&h[++r]===h[++s]&&h[++r]===h[++s]&&h[++r]===h[++s]&&h[++r]===h[++s]&&h[++r]===h[++s]&&ro){if(e.match_start=t,o=i,i>=a)break;p=h[r+o-1],m=h[r+o]}}}while((t=u[t&c])>l&&0!=--n);return o<=e.lookahead?o:e.lookahead}function re(e){var t,s,i,r,l,h,c,u,d,p,m=e.w_size;do{if(r=e.window_size-e.lookahead-e.strstart,e.strstart>=m+(m-P)){n.arraySet(e.window,e.window,m,m,0),e.match_start-=m,e.strstart-=m,e.block_start-=m,t=s=e.hash_size;do{i=e.head[--t],e.head[t]=i>=m?i-m:0}while(--s);t=s=m;do{i=e.prev[--t],e.prev[t]=i>=m?i-m:0}while(--s);r+=m}if(0===e.strm.avail_in)break;if(h=e.strm,c=e.window,u=e.strstart+e.lookahead,d=r,p=void 0,(p=h.avail_in)>d&&(p=d),s=0===p?0:(h.avail_in-=p,n.arraySet(c,h.input,h.next_in,p,u),1===h.state.wrap?h.adler=o(h.adler,c,p,u):2===h.state.wrap&&(h.adler=a(h.adler,c,p,u)),h.next_in+=p,h.total_in+=p,p),e.lookahead+=s,e.lookahead+e.insert>=x)for(l=e.strstart-e.insert,e.ins_h=e.window[l],e.ins_h=(e.ins_h<=x&&(e.ins_h=(e.ins_h<=x)if(i=r._tr_tally(e,e.strstart-e.match_start,e.match_length-x),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=x){e.match_length--;do{e.strstart++,e.ins_h=(e.ins_h<=x&&(e.ins_h=(e.ins_h<4096)&&(e.match_length=x-1)),e.prev_length>=x&&e.match_length<=e.prev_length){n=e.strstart+e.lookahead-x,i=r._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-x),e.lookahead-=e.prev_length-1,e.prev_length-=2;do{++e.strstart<=n&&(e.ins_h=(e.ins_h<15&&(a=2,i-=16),r<1||r>D||s!==S||i<8||i>15||t<0||t>9||o<0||o>A)return Z(e,_);8===i&&(i=9);var l=new he;return e.state=l,l.strm=e,l.wrap=a,l.gzhead=null,l.w_bits=i,l.w_size=1<e.pending_buf_size-5&&(s=e.pending_buf_size-5);;){if(e.lookahead<=1){if(re(e),0===e.lookahead&&t===h)return W;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var i=e.block_start+s;if((0===e.strstart||e.strstart>=i)&&(e.lookahead=e.strstart-i,e.strstart=i,te(e,!1),0===e.strm.avail_out))return W;if(e.strstart-e.block_start>=e.w_size-P&&(te(e,!1),0===e.strm.avail_out))return W}return e.insert=0,t===d?(te(e,!0),0===e.strm.avail_out?Y:q):(e.strstart>e.block_start&&(te(e,!1),e.strm.avail_out),W)}),new le(4,4,8,4,oe),new le(4,5,16,8,oe),new le(4,6,32,32,oe),new le(4,4,16,16,ae),new le(8,16,32,32,ae),new le(8,16,128,128,ae),new le(8,32,128,256,ae),new le(32,128,258,1024,ae),new le(32,258,258,4096,ae)],t.deflateInit=function(e,t){return de(e,t,S,N,C,I)},t.deflateInit2=de,t.deflateReset=ue,t.deflateResetKeep=ce,t.deflateSetHeader=function(e,t){return e&&e.state?2!==e.state.wrap?_:(e.state.gzhead=t,m):_},t.deflate=function(e,t){var s,n,o,l;if(!e||!e.state||t>p||t<0)return e?Z(e,_):_;if(n=e.state,!e.output||!e.input&&0!==e.avail_in||n.status===F&&t!==d)return Z(e,0===e.avail_out?E:_);if(n.strm=e,s=n.last_flush,n.last_flush=t,n.status===j)if(2===n.wrap)e.adler=0,se(n,31),se(n,139),se(n,8),n.gzhead?(se(n,(n.gzhead.text?1:0)+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),se(n,255&n.gzhead.time),se(n,n.gzhead.time>>8&255),se(n,n.gzhead.time>>16&255),se(n,n.gzhead.time>>24&255),se(n,9===n.level?2:n.strategy>=w||n.level<2?4:0),se(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(se(n,255&n.gzhead.extra.length),se(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=a(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=B):(se(n,0),se(n,0),se(n,0),se(n,0),se(n,0),se(n,9===n.level?2:n.strategy>=w||n.level<2?4:0),se(n,J),n.status=$);else{var g=S+(n.w_bits-8<<4)<<8;g|=(n.strategy>=w||n.level<2?0:n.level<6?1:6===n.level?2:3)<<6,0!==n.strstart&&(g|=G),g+=31-g%31,n.status=$,ie(n,g),0!==n.strstart&&(ie(n,e.adler>>>16),ie(n,65535&e.adler)),e.adler=1}if(n.status===B)if(n.gzhead.extra){for(o=n.pending;n.gzindex<(65535&n.gzhead.extra.length)&&(n.pending!==n.pending_buf_size||(n.gzhead.hcrc&&n.pending>o&&(e.adler=a(e.adler,n.pending_buf,n.pending-o,o)),ee(e),o=n.pending,n.pending!==n.pending_buf_size));)se(n,255&n.gzhead.extra[n.gzindex]),n.gzindex++;n.gzhead.hcrc&&n.pending>o&&(e.adler=a(e.adler,n.pending_buf,n.pending-o,o)),n.gzindex===n.gzhead.extra.length&&(n.gzindex=0,n.status=z)}else n.status=z;if(n.status===z)if(n.gzhead.name){o=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>o&&(e.adler=a(e.adler,n.pending_buf,n.pending-o,o)),ee(e),o=n.pending,n.pending===n.pending_buf_size)){l=1;break}l=n.gzindexo&&(e.adler=a(e.adler,n.pending_buf,n.pending-o,o)),0===l&&(n.gzindex=0,n.status=V)}else n.status=V;if(n.status===V)if(n.gzhead.comment){o=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>o&&(e.adler=a(e.adler,n.pending_buf,n.pending-o,o)),ee(e),o=n.pending,n.pending===n.pending_buf_size)){l=1;break}l=n.gzindexo&&(e.adler=a(e.adler,n.pending_buf,n.pending-o,o)),0===l&&(n.status=H)}else n.status=H;if(n.status===H&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&ee(e),n.pending+2<=n.pending_buf_size&&(se(n,255&e.adler),se(n,e.adler>>8&255),e.adler=0,n.status=$)):n.status=$),0!==n.pending){if(ee(e),0===e.avail_out)return n.last_flush=-1,m}else if(0===e.avail_in&&Q(t)<=Q(s)&&t!==d)return Z(e,E);if(n.status===F&&0!==e.avail_in)return Z(e,E);if(0!==e.avail_in||0!==n.lookahead||t!==h&&n.status!==F){var v=n.strategy===w?function(e,t){for(var s;;){if(0===e.lookahead&&(re(e),0===e.lookahead)){if(t===h)return W;break}if(e.match_length=0,s=r._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,s&&(te(e,!1),0===e.strm.avail_out))return W}return e.insert=0,t===d?(te(e,!0),0===e.strm.avail_out?Y:q):e.last_lit&&(te(e,!1),0===e.strm.avail_out)?W:K}(n,t):n.strategy===y?function(e,t){for(var s,i,n,o,a=e.window;;){if(e.lookahead<=U){if(re(e),e.lookahead<=U&&t===h)return W;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=x&&e.strstart>0&&(i=a[n=e.strstart-1])===a[++n]&&i===a[++n]&&i===a[++n]){o=e.strstart+U;do{}while(i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&ne.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=x?(s=r._tr_tally(e,1,e.match_length-x),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(s=r._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),s&&(te(e,!1),0===e.strm.avail_out))return W}return e.insert=0,t===d?(te(e,!0),0===e.strm.avail_out?Y:q):e.last_lit&&(te(e,!1),0===e.strm.avail_out)?W:K}(n,t):i[n.level].func(n,t);if(v!==Y&&v!==q||(n.status=F),v===W||v===Y)return 0===e.avail_out&&(n.last_flush=-1),m;if(v===K&&(t===c?r._tr_align(n):t!==p&&(r._tr_stored_block(n,0,0,!1),t===u&&(X(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),ee(e),0===e.avail_out))return n.last_flush=-1,m}return t!==d?m:n.wrap<=0?f:(2===n.wrap?(se(n,255&e.adler),se(n,e.adler>>8&255),se(n,e.adler>>16&255),se(n,e.adler>>24&255),se(n,255&e.total_in),se(n,e.total_in>>8&255),se(n,e.total_in>>16&255),se(n,e.total_in>>24&255)):(ie(n,e.adler>>>16),ie(n,65535&e.adler)),ee(e),n.wrap>0&&(n.wrap=-n.wrap),0!==n.pending?m:f)},t.deflateEnd=function(e){var t;return e&&e.state?(t=e.state.status)!==j&&t!==B&&t!==z&&t!==V&&t!==H&&t!==$&&t!==F?Z(e,_):(e.state=null,t===$?Z(e,g):m):_},t.deflateSetDictionary=function(e,t){var s,i,r,a,l,h,c,u,d=t.length;if(!e||!e.state)return _;if(2===(a=(s=e.state).wrap)||1===a&&s.status!==j||s.lookahead)return _;for(1===a&&(e.adler=o(e.adler,t,d,0)),s.wrap=0,d>=s.w_size&&(0===a&&(X(s.head),s.strstart=0,s.block_start=0,s.insert=0),u=new n.Buf8(s.w_size),n.arraySet(u,t,d-s.w_size,s.w_size,0),t=u,d=s.w_size),l=e.avail_in,h=e.next_in,c=e.input,e.avail_in=d,e.next_in=0,e.input=t,re(s);s.lookahead>=x;){i=s.strstart,r=s.lookahead-(x-1);do{s.ins_h=(s.ins_h<=0;)e[t]=0}var h=0,c=1,u=2,d=29,p=256,m=p+1+d,f=30,_=19,g=2*m+1,E=15,v=16,b=7,w=256,y=16,A=17,I=18,T=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],S=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],D=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],N=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],C=new Array(2*(m+2));l(C);var O=new Array(2*f);l(O);var R=new Array(512);l(R);var L=new Array(256);l(L);var M=new Array(d);l(M);var k,x,U,P=new Array(f);function G(e,t,s,i,n){this.static_tree=e,this.extra_bits=t,this.extra_base=s,this.elems=i,this.max_length=n,this.has_stree=e&&e.length}function j(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function B(e){return e<256?R[e]:R[256+(e>>>7)]}function z(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function V(e,t,s){e.bi_valid>v-s?(e.bi_buf|=t<>v-e.bi_valid,e.bi_valid+=s-v):(e.bi_buf|=t<>>=1,s<<=1}while(--t>0);return s>>>1}function F(e,t,s){var i,n,r=new Array(E+1),o=0;for(i=1;i<=E;i++)r[i]=o=o+s[i-1]<<1;for(n=0;n<=t;n++){var a=e[2*n+1];0!==a&&(e[2*n]=$(r[a]++,a))}}function W(e){var t;for(t=0;t8?z(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0}function Y(e,t,s,i){var n=2*t,r=2*s;return e[n]>1;s>=1;s--)q(e,r,s);n=l;do{s=e.heap[1],e.heap[1]=e.heap[e.heap_len--],q(e,r,1),i=e.heap[1],e.heap[--e.heap_max]=s,e.heap[--e.heap_max]=i,r[2*n]=r[2*s]+r[2*i],e.depth[n]=(e.depth[s]>=e.depth[i]?e.depth[s]:e.depth[i])+1,r[2*s+1]=r[2*i+1]=n,e.heap[1]=n++,q(e,r,1)}while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],function(e,t){var s,i,n,r,o,a,l=t.dyn_tree,h=t.max_code,c=t.stat_desc.static_tree,u=t.stat_desc.has_stree,d=t.stat_desc.extra_bits,p=t.stat_desc.extra_base,m=t.stat_desc.max_length,f=0;for(r=0;r<=E;r++)e.bl_count[r]=0;for(l[2*e.heap[e.heap_max]+1]=0,s=e.heap_max+1;sm&&(r=m,f++),l[2*i+1]=r,i>h||(e.bl_count[r]++,o=0,i>=p&&(o=d[i-p]),a=l[2*i],e.opt_len+=a*(r+o),u&&(e.static_len+=a*(c[2*i+1]+o)));if(0!==f){do{for(r=m-1;0===e.bl_count[r];)r--;e.bl_count[r]--,e.bl_count[r+1]+=2,e.bl_count[m]--,f-=2}while(f>0);for(r=m;0!==r;r--)for(i=e.bl_count[r];0!==i;)(n=e.heap[--s])>h||(l[2*n+1]!==r&&(e.opt_len+=(r-l[2*n+1])*l[2*n],l[2*n+1]=r),i--)}}(e,t),F(r,h,e.bl_count)}function Q(e,t,s){var i,n,r=-1,o=t[1],a=0,l=7,h=4;for(0===o&&(l=138,h=3),t[2*(s+1)+1]=65535,i=0;i<=s;i++)n=o,o=t[2*(i+1)+1],++a>=7;i0?(e.strm.data_type===a&&(e.strm.data_type=function(e){var t,s=4093624447;for(t=0;t<=31;t++,s>>>=1)if(1&s&&0!==e.dyn_ltree[2*t])return r;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return o;for(t=32;t=3&&0===e.bl_tree[2*N[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t}(e),l=e.opt_len+3+7>>>3,(h=e.static_len+3+7>>>3)<=l&&(l=h)):l=h=s+5,s+4<=l&&-1!==t?te(e,t,s,i):e.strategy===n||h===l?(V(e,(c<<1)+(i?1:0),3),J(e,C,O)):(V(e,(u<<1)+(i?1:0),3),function(e,t,s,i){var n;for(V(e,t-257,5),V(e,s-1,5),V(e,i-4,4),n=0;n>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&s,e.last_lit++,0===t?e.dyn_ltree[2*s]++:(e.matches++,t--,e.dyn_ltree[2*(L[s]+p+1)]++,e.dyn_dtree[2*B(t)]++),e.last_lit===e.lit_bufsize-1},t._tr_align=function(e){V(e,c<<1,3),H(e,w,C),function(e){16===e.bi_valid?(z(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}(e)}},function(e,t,s){"use strict";var i=s(105),n=s(10),r=s(57),o=s(59),a=s(32),l=s(58),h=s(108),c=Object.prototype.toString;function u(e){if(!(this instanceof u))return new u(e);this.options=n.assign({chunkSize:16384,windowBits:0,to:""},e||{});var t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(t.windowBits>=0&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&0==(15&t.windowBits)&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new l,this.strm.avail_out=0;var s=i.inflateInit2(this.strm,t.windowBits);if(s!==o.Z_OK)throw new Error(a[s]);if(this.header=new h,i.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=r.string2buf(t.dictionary):"[object ArrayBuffer]"===c.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(s=i.inflateSetDictionary(this.strm,t.dictionary))!==o.Z_OK))throw new Error(a[s])}function d(e,t){var s=new u(t);if(s.push(e,!0),s.err)throw s.msg||a[s.err];return s.result}u.prototype.push=function(e,t){var s,a,l,h,u,d=this.strm,p=this.options.chunkSize,m=this.options.dictionary,f=!1;if(this.ended)return!1;a=t===~~t?t:!0===t?o.Z_FINISH:o.Z_NO_FLUSH,"string"==typeof e?d.input=r.binstring2buf(e):"[object ArrayBuffer]"===c.call(e)?d.input=new Uint8Array(e):d.input=e,d.next_in=0,d.avail_in=d.input.length;do{if(0===d.avail_out&&(d.output=new n.Buf8(p),d.next_out=0,d.avail_out=p),(s=i.inflate(d,o.Z_NO_FLUSH))===o.Z_NEED_DICT&&m&&(s=i.inflateSetDictionary(this.strm,m)),s===o.Z_BUF_ERROR&&!0===f&&(s=o.Z_OK,f=!1),s!==o.Z_STREAM_END&&s!==o.Z_OK)return this.onEnd(s),this.ended=!0,!1;d.next_out&&(0!==d.avail_out&&s!==o.Z_STREAM_END&&(0!==d.avail_in||a!==o.Z_FINISH&&a!==o.Z_SYNC_FLUSH)||("string"===this.options.to?(l=r.utf8border(d.output,d.next_out),h=d.next_out-l,u=r.buf2string(d.output,l),d.next_out=h,d.avail_out=p-h,h&&n.arraySet(d.output,d.output,l,h,0),this.onData(u)):this.onData(n.shrinkBuf(d.output,d.next_out)))),0===d.avail_in&&0===d.avail_out&&(f=!0)}while((d.avail_in>0||0===d.avail_out)&&s!==o.Z_STREAM_END);return s===o.Z_STREAM_END&&(a=o.Z_FINISH),a===o.Z_FINISH?(s=i.inflateEnd(this.strm),this.onEnd(s),this.ended=!0,s===o.Z_OK):a!==o.Z_SYNC_FLUSH||(this.onEnd(o.Z_OK),d.avail_out=0,!0)},u.prototype.onData=function(e){this.chunks.push(e)},u.prototype.onEnd=function(e){e===o.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=n.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},t.Inflate=u,t.inflate=d,t.inflateRaw=function(e,t){return(t=t||{}).raw=!0,d(e,t)},t.ungzip=d},function(e,t,s){"use strict";var i=s(10),n=s(55),r=s(56),o=s(106),a=s(107),l=0,h=1,c=2,u=4,d=5,p=6,m=0,f=1,_=2,g=-2,E=-3,v=-4,b=-5,w=8,y=1,A=2,I=3,T=4,S=5,D=6,N=7,C=8,O=9,R=10,L=11,M=12,k=13,x=14,U=15,P=16,G=17,j=18,B=19,z=20,V=21,H=22,$=23,F=24,W=25,K=26,Y=27,q=28,J=29,Z=30,Q=31,X=32,ee=852,te=592,se=15;function ie(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function ne(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new i.Buf16(320),this.work=new i.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function re(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=y,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new i.Buf32(ee),t.distcode=t.distdyn=new i.Buf32(te),t.sane=1,t.back=-1,m):g}function oe(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,re(e)):g}function ae(e,t){var s,i;return e&&e.state?(i=e.state,t<0?(s=0,t=-t):(s=1+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?g:(null!==i.window&&i.wbits!==t&&(i.window=null),i.wrap=s,i.wbits=t,oe(e))):g}function le(e,t){var s,i;return e?(i=new ne,e.state=i,i.window=null,(s=ae(e,t))!==m&&(e.state=null),s):g}var he,ce,ue=!0;function de(e){if(ue){var t;for(he=new i.Buf32(512),ce=new i.Buf32(32),t=0;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(a(h,e.lens,0,288,he,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;a(c,e.lens,0,32,ce,0,e.work,{bits:5}),ue=!1}e.lencode=he,e.lenbits=9,e.distcode=ce,e.distbits=5}function pe(e,t,s,n){var r,o=e.state;return null===o.window&&(o.wsize=1<=o.wsize?(i.arraySet(o.window,t,s-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):((r=o.wsize-o.wnext)>n&&(r=n),i.arraySet(o.window,t,s-n,r,o.wnext),(n-=r)?(i.arraySet(o.window,t,s-n,n,0),o.wnext=n,o.whave=o.wsize):(o.wnext+=r,o.wnext===o.wsize&&(o.wnext=0),o.whave>>8&255,s.check=r(s.check,De,2,0),ae=0,le=0,s.mode=A;break}if(s.flags=0,s.head&&(s.head.done=!1),!(1&s.wrap)||(((255&ae)<<8)+(ae>>8))%31){e.msg="incorrect header check",s.mode=Z;break}if((15&ae)!==w){e.msg="unknown compression method",s.mode=Z;break}if(le-=4,ye=8+(15&(ae>>>=4)),0===s.wbits)s.wbits=ye;else if(ye>s.wbits){e.msg="invalid window size",s.mode=Z;break}s.dmax=1<>8&1),512&s.flags&&(De[0]=255&ae,De[1]=ae>>>8&255,s.check=r(s.check,De,2,0)),ae=0,le=0,s.mode=I;case I:for(;le<32;){if(0===re)break e;re--,ae+=ee[se++]<>>8&255,De[2]=ae>>>16&255,De[3]=ae>>>24&255,s.check=r(s.check,De,4,0)),ae=0,le=0,s.mode=T;case T:for(;le<16;){if(0===re)break e;re--,ae+=ee[se++]<>8),512&s.flags&&(De[0]=255&ae,De[1]=ae>>>8&255,s.check=r(s.check,De,2,0)),ae=0,le=0,s.mode=S;case S:if(1024&s.flags){for(;le<16;){if(0===re)break e;re--,ae+=ee[se++]<>>8&255,s.check=r(s.check,De,2,0)),ae=0,le=0}else s.head&&(s.head.extra=null);s.mode=D;case D:if(1024&s.flags&&((ue=s.length)>re&&(ue=re),ue&&(s.head&&(ye=s.head.extra_len-s.length,s.head.extra||(s.head.extra=new Array(s.head.extra_len)),i.arraySet(s.head.extra,ee,se,ue,ye)),512&s.flags&&(s.check=r(s.check,ee,ue,se)),re-=ue,se+=ue,s.length-=ue),s.length))break e;s.length=0,s.mode=N;case N:if(2048&s.flags){if(0===re)break e;ue=0;do{ye=ee[se+ue++],s.head&&ye&&s.length<65536&&(s.head.name+=String.fromCharCode(ye))}while(ye&&ue>9&1,s.head.done=!0),e.adler=s.check=0,s.mode=M;break;case R:for(;le<32;){if(0===re)break e;re--,ae+=ee[se++]<>>=7&le,le-=7&le,s.mode=Y;break}for(;le<3;){if(0===re)break e;re--,ae+=ee[se++]<>>=1)){case 0:s.mode=x;break;case 1:if(de(s),s.mode=z,t===p){ae>>>=2,le-=2;break e}break;case 2:s.mode=G;break;case 3:e.msg="invalid block type",s.mode=Z}ae>>>=2,le-=2;break;case x:for(ae>>>=7&le,le-=7≤le<32;){if(0===re)break e;re--,ae+=ee[se++]<>>16^65535)){e.msg="invalid stored block lengths",s.mode=Z;break}if(s.length=65535&ae,ae=0,le=0,s.mode=U,t===p)break e;case U:s.mode=P;case P:if(ue=s.length){if(ue>re&&(ue=re),ue>oe&&(ue=oe),0===ue)break e;i.arraySet(te,ee,se,ue,ne),re-=ue,se+=ue,oe-=ue,ne+=ue,s.length-=ue;break}s.mode=M;break;case G:for(;le<14;){if(0===re)break e;re--,ae+=ee[se++]<>>=5,le-=5,s.ndist=1+(31&ae),ae>>>=5,le-=5,s.ncode=4+(15&ae),ae>>>=4,le-=4,s.nlen>286||s.ndist>30){e.msg="too many length or distance symbols",s.mode=Z;break}s.have=0,s.mode=j;case j:for(;s.have>>=3,le-=3}for(;s.have<19;)s.lens[Ne[s.have++]]=0;if(s.lencode=s.lendyn,s.lenbits=7,Ie={bits:s.lenbits},Ae=a(l,s.lens,0,19,s.lencode,0,s.work,Ie),s.lenbits=Ie.bits,Ae){e.msg="invalid code lengths set",s.mode=Z;break}s.have=0,s.mode=B;case B:for(;s.have>>16&255,Ee=65535&Se,!((_e=Se>>>24)<=le);){if(0===re)break e;re--,ae+=ee[se++]<>>=_e,le-=_e,s.lens[s.have++]=Ee;else{if(16===Ee){for(Te=_e+2;le>>=_e,le-=_e,0===s.have){e.msg="invalid bit length repeat",s.mode=Z;break}ye=s.lens[s.have-1],ue=3+(3&ae),ae>>>=2,le-=2}else if(17===Ee){for(Te=_e+3;le>>=_e)),ae>>>=3,le-=3}else{for(Te=_e+7;le>>=_e)),ae>>>=7,le-=7}if(s.have+ue>s.nlen+s.ndist){e.msg="invalid bit length repeat",s.mode=Z;break}for(;ue--;)s.lens[s.have++]=ye}}if(s.mode===Z)break;if(0===s.lens[256]){e.msg="invalid code -- missing end-of-block",s.mode=Z;break}if(s.lenbits=9,Ie={bits:s.lenbits},Ae=a(h,s.lens,0,s.nlen,s.lencode,0,s.work,Ie),s.lenbits=Ie.bits,Ae){e.msg="invalid literal/lengths set",s.mode=Z;break}if(s.distbits=6,s.distcode=s.distdyn,Ie={bits:s.distbits},Ae=a(c,s.lens,s.nlen,s.ndist,s.distcode,0,s.work,Ie),s.distbits=Ie.bits,Ae){e.msg="invalid distances set",s.mode=Z;break}if(s.mode=z,t===p)break e;case z:s.mode=V;case V:if(re>=6&&oe>=258){e.next_out=ne,e.avail_out=oe,e.next_in=se,e.avail_in=re,s.hold=ae,s.bits=le,o(e,ce),ne=e.next_out,te=e.output,oe=e.avail_out,se=e.next_in,ee=e.input,re=e.avail_in,ae=s.hold,le=s.bits,s.mode===M&&(s.back=-1);break}for(s.back=0;ge=(Se=s.lencode[ae&(1<>>16&255,Ee=65535&Se,!((_e=Se>>>24)<=le);){if(0===re)break e;re--,ae+=ee[se++]<>ve)])>>>16&255,Ee=65535&Se,!(ve+(_e=Se>>>24)<=le);){if(0===re)break e;re--,ae+=ee[se++]<>>=ve,le-=ve,s.back+=ve}if(ae>>>=_e,le-=_e,s.back+=_e,s.length=Ee,0===ge){s.mode=K;break}if(32&ge){s.back=-1,s.mode=M;break}if(64&ge){e.msg="invalid literal/length code",s.mode=Z;break}s.extra=15&ge,s.mode=H;case H:if(s.extra){for(Te=s.extra;le>>=s.extra,le-=s.extra,s.back+=s.extra}s.was=s.length,s.mode=$;case $:for(;ge=(Se=s.distcode[ae&(1<>>16&255,Ee=65535&Se,!((_e=Se>>>24)<=le);){if(0===re)break e;re--,ae+=ee[se++]<>ve)])>>>16&255,Ee=65535&Se,!(ve+(_e=Se>>>24)<=le);){if(0===re)break e;re--,ae+=ee[se++]<>>=ve,le-=ve,s.back+=ve}if(ae>>>=_e,le-=_e,s.back+=_e,64&ge){e.msg="invalid distance code",s.mode=Z;break}s.offset=Ee,s.extra=15&ge,s.mode=F;case F:if(s.extra){for(Te=s.extra;le>>=s.extra,le-=s.extra,s.back+=s.extra}if(s.offset>s.dmax){e.msg="invalid distance too far back",s.mode=Z;break}s.mode=W;case W:if(0===oe)break e;if(ue=ce-oe,s.offset>ue){if((ue=s.offset-ue)>s.whave&&s.sane){e.msg="invalid distance too far back",s.mode=Z;break}ue>s.wnext?(ue-=s.wnext,me=s.wsize-ue):me=s.wnext-ue,ue>s.length&&(ue=s.length),fe=s.window}else fe=te,me=ne-s.offset,ue=s.length;ue>oe&&(ue=oe),oe-=ue,s.length-=ue;do{te[ne++]=fe[me++]}while(--ue);0===s.length&&(s.mode=V);break;case K:if(0===oe)break e;te[ne++]=s.length,oe--,s.mode=V;break;case Y:if(s.wrap){for(;le<32;){if(0===re)break e;re--,ae|=ee[se++]<>>=b=v>>>24,m-=b,0===(b=v>>>16&255))S[r++]=65535&v;else{if(!(16&b)){if(0==(64&b)){v=f[(65535&v)+(p&(1<>>=b,m-=b),m<15&&(p+=T[i++]<>>=b=v>>>24,m-=b,!(16&(b=v>>>16&255))){if(0==(64&b)){v=_[(65535&v)+(p&(1<l){e.msg="invalid distance too far back",s.mode=30;break e}if(p>>>=b,m-=b,y>(b=r-o)){if((b=y-b)>c&&s.sane){e.msg="invalid distance too far back",s.mode=30;break e}if(A=0,I=d,0===u){if(A+=h-b,b2;)S[r++]=I[A++],S[r++]=I[A++],S[r++]=I[A++],w-=3;w&&(S[r++]=I[A++],w>1&&(S[r++]=I[A++]))}else{A=r-y;do{S[r++]=S[A++],S[r++]=S[A++],S[r++]=S[A++],w-=3}while(w>2);w&&(S[r++]=S[A++],w>1&&(S[r++]=S[A++]))}break}}break}}while(i>3,p&=(1<<(m-=w<<3))-1,e.next_in=i,e.next_out=r,e.avail_in=i=1&&0===x[S];S--);if(D>S&&(D=S),0===S)return h[c++]=20971520,h[c++]=20971520,d.bits=1,0;for(T=1;T0&&(0===e||1!==S))return-1;for(U[1]=0,A=1;A<15;A++)U[A+1]=U[A]+x[A];for(I=0;I852||2===e&&R>592)return 1;for(;;){v=A-C,u[I]E?(b=P[G+u[I]],w=M[k+u[I]]):(b=96,w=0),p=1<>C)+(m-=p)]=v<<24|b<<16|w|0}while(0!==m);for(p=1<>=1;if(0!==p?(L&=p-1,L+=p):L=0,I++,0==--x[A]){if(A===S)break;A=t[s+u[I]]}if(A>D&&(L&_)!==f){for(0===C&&(C=D),g+=T,O=1<<(N=A-C);N+C852||2===e&&R>592)return 1;h[f=L&_]=D<<24|N<<16|g-c|0}}return 0!==L&&(h[g+L]=A-C<<24|64<<16|0),d.bits=D,0}},function(e,t,s){"use strict";e.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},function(e,t,s){var i={"./CHANNEL_CREATE.js":110,"./CHANNEL_DELETE.js":111,"./CHANNEL_PINS_UPDATE.js":112,"./CHANNEL_UPDATE.js":113,"./GUILD_BAN_ADD.js":114,"./GUILD_BAN_REMOVE.js":115,"./GUILD_CREATE.js":116,"./GUILD_DELETE.js":117,"./GUILD_EMOJIS_UPDATE.js":118,"./GUILD_INTEGRATIONS_UPDATE.js":119,"./GUILD_MEMBERS_CHUNK.js":120,"./GUILD_MEMBER_ADD.js":121,"./GUILD_MEMBER_REMOVE.js":122,"./GUILD_MEMBER_UPDATE.js":123,"./GUILD_ROLE_CREATE.js":124,"./GUILD_ROLE_DELETE.js":125,"./GUILD_ROLE_UPDATE.js":126,"./GUILD_SYNC.js":127,"./GUILD_UPDATE.js":128,"./MESSAGE_CREATE.js":129,"./MESSAGE_DELETE.js":130,"./MESSAGE_DELETE_BULK.js":131,"./MESSAGE_REACTION_ADD.js":132,"./MESSAGE_REACTION_REMOVE.js":133,"./MESSAGE_REACTION_REMOVE_ALL.js":134,"./MESSAGE_UPDATE.js":135,"./PRESENCE_UPDATE.js":136,"./READY.js":137,"./RESUMED.js":140,"./TYPING_START.js":141,"./USER_UPDATE.js":142,"./VOICE_SERVER_UPDATE.js":143,"./VOICE_STATE_UPDATE.js":144,"./WEBHOOKS_UPDATE.js":145,"./index.js":60};function n(e){var t=r(e);return s(t)}function r(e){if(!s.o(i,e)){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}return i[e]}n.keys=function(){return Object.keys(i)},n.resolve=r,e.exports=n,n.id=109},function(e,t,s){"use strict";e.exports=((e,t)=>{e.actions.ChannelCreate.handle(t.d)})},function(e,t,s){"use strict";e.exports=((e,t)=>{e.actions.ChannelDelete.handle(t.d)})},function(e,t,s){"use strict";const{Events:i}=s(0);e.exports=((e,{d:t})=>{const s=e.channels.get(t.channel_id),n=new Date(t.last_pin_timestamp);s&&n&&(s.lastPinTimestamp=n.getTime()||null,e.emit(i.CHANNEL_PINS_UPDATE,s,n))})},function(e,t,s){"use strict";const{Events:i}=s(0);e.exports=((e,t)=>{const{old:s,updated:n}=e.actions.ChannelUpdate.handle(t.d);s&&n&&e.emit(i.CHANNEL_UPDATE,s,n)})},function(e,t,s){"use strict";const{Events:i}=s(0);e.exports=((e,{d:t})=>{const s=e.guilds.get(t.guild_id),n=e.users.get(t.user.id);s&&n&&e.emit(i.GUILD_BAN_ADD,s,n)})},function(e,t,s){"use strict";e.exports=((e,t)=>{e.actions.GuildBanRemove.handle(t.d)})},function(e,t,s){"use strict";const{Events:i,Status:n}=s(0);e.exports=(async(e,{d:t},s)=>{let r=e.guilds.get(t.id);if(r)r.available||t.unavailable||(r._patch(t),e.ws.checkReady());else{t.shardID=s.id,r=e.guilds.add(t),e.ws.status===n.READY&&(e.options.fetchAllMembers&&await r.members.fetch(),e.emit(i.GUILD_CREATE,r))}})},function(e,t,s){"use strict";e.exports=((e,t)=>{e.actions.GuildDelete.handle(t.d)})},function(e,t,s){"use strict";e.exports=((e,t)=>{e.actions.GuildEmojisUpdate.handle(t.d)})},function(e,t,s){"use strict";e.exports=((e,t)=>{e.actions.GuildIntegrationsUpdate.handle(t.d)})},function(e,t,s){"use strict";const{Events:i}=s(0),n=s(3);e.exports=((e,{d:t})=>{const s=e.guilds.get(t.guild_id);if(!s)return;const r=new n;for(const e of t.members)r.set(e.user.id,s.members.add(e));e.emit(i.GUILD_MEMBERS_CHUNK,r,s)})},function(e,t,s){"use strict";const{Events:i,Status:n}=s(0);e.exports=((e,{d:t},s)=>{const r=e.guilds.get(t.guild_id);if(r){r.memberCount++;const o=r.members.add(t);s.status===n.READY&&e.emit(i.GUILD_MEMBER_ADD,o)}})},function(e,t,s){"use strict";e.exports=((e,t,s)=>{e.actions.GuildMemberRemove.handle(t.d,s)})},function(e,t,s){"use strict";const{Status:i,Events:n}=s(0);e.exports=((e,{d:t},s)=>{const r=e.guilds.get(t.guild_id);if(r){const o=r.members.get(t.user.id);if(o){const r=o._update(t);s.status===i.READY&&e.emit(n.GUILD_MEMBER_UPDATE,r,o)}}})},function(e,t,s){"use strict";e.exports=((e,t)=>{e.actions.GuildRoleCreate.handle(t.d)})},function(e,t,s){"use strict";e.exports=((e,t)=>{e.actions.GuildRoleDelete.handle(t.d)})},function(e,t,s){"use strict";e.exports=((e,t)=>{e.actions.GuildRoleUpdate.handle(t.d)})},function(e,t,s){"use strict";e.exports=((e,t)=>{e.actions.GuildSync.handle(t.d)})},function(e,t,s){"use strict";e.exports=((e,t)=>{e.actions.GuildUpdate.handle(t.d)})},function(e,t,s){"use strict";e.exports=((e,t)=>{e.actions.MessageCreate.handle(t.d)})},function(e,t,s){"use strict";e.exports=((e,t)=>{e.actions.MessageDelete.handle(t.d)})},function(e,t,s){"use strict";e.exports=((e,t)=>{e.actions.MessageDeleteBulk.handle(t.d)})},function(e,t,s){"use strict";const{Events:i}=s(0);e.exports=((e,t)=>{const{user:s,reaction:n}=e.actions.MessageReactionAdd.handle(t.d);n&&e.emit(i.MESSAGE_REACTION_ADD,n,s)})},function(e,t,s){"use strict";e.exports=((e,t)=>{e.actions.MessageReactionRemove.handle(t.d)})},function(e,t,s){"use strict";e.exports=((e,t)=>{e.actions.MessageReactionRemoveAll.handle(t.d)})},function(e,t,s){"use strict";const{Events:i}=s(0);e.exports=((e,t)=>{const{old:s,updated:n}=e.actions.MessageUpdate.handle(t.d);s&&n&&e.emit(i.MESSAGE_UPDATE,s,n)})},function(e,t,s){"use strict";e.exports=((e,t)=>{e.actions.PresenceUpdate.handle(t.d)})},function(e,t,s){"use strict";let i;e.exports=((e,{d:t},n)=>{i||(i=s(61));const r=new i(e,t.user);e.user=r,e.readyAt=new Date,e.users.set(r.id,r);for(const s of t.guilds)s.shardID=n.id,e.guilds.add(s);e.ws.checkReady()})},function(e,t,s){"use strict";const i=s(5),n=s(39);e.exports=class ReactionStore extends i{constructor(e,t){super(e.client,t,n),this.message=e}add(e,t){return super.add(e,t,{id:e.emoji.id||e.emoji.name,extras:[this.message]})}removeAll(){return this.client.api.channels(this.message.channel.id).messages(this.message.id).reactions.delete().then(()=>this.message)}}},function(e,t,s){"use strict";const i=s(5),n=s(19);e.exports=class VoiceStateStore extends i{constructor(e,t){super(e.client,t,n),this.guild=e}add(e,t=!0){const s=this.get(e.user_id);if(s)return s._patch(e);const i=new n(this.guild,e);return t&&this.set(e.user_id,i),i}}},function(e,t,s){"use strict";const{Events:i}=s(0);e.exports=((e,t,s)=>{const n=s.sequence-s.closeSequence;e.emit(i.RESUMED,n,s.id)})},function(e,t,s){"use strict";const{Events:i}=s(0);e.exports=((e,{d:t})=>{const s=e.channels.get(t.channel_id),n=e.users.get(t.user_id);s&&n&&e.emit(i.TYPING_START,s,n)})},function(e,t,s){"use strict";e.exports=((e,t)=>{e.actions.UserUpdate.handle(t.d)})},function(e,t,s){"use strict";e.exports=((e,t)=>{e.emit("self.voiceServer",t.d)})},function(e,t,s){"use strict";e.exports=((e,t)=>{e.actions.VoiceStateUpdate.handle(t.d)})},function(e,t,s){"use strict";e.exports=((e,t)=>{e.actions.WebhooksUpdate.handle(t.d)})},function(e,t,s){"use strict";e.exports=class ActionsManager{constructor(e){this.client=e,this.register(s(147)),this.register(s(148)),this.register(s(149)),this.register(s(150)),this.register(s(151)),this.register(s(152)),this.register(s(153)),this.register(s(154)),this.register(s(155)),this.register(s(156)),this.register(s(157)),this.register(s(158)),this.register(s(159)),this.register(s(160)),this.register(s(161)),this.register(s(162)),this.register(s(163)),this.register(s(164)),this.register(s(165)),this.register(s(166)),this.register(s(167)),this.register(s(168)),this.register(s(169)),this.register(s(170)),this.register(s(171)),this.register(s(172)),this.register(s(173)),this.register(s(174))}register(e){this[e.name.replace(/Action$/,"")]=new e(this.client)}}},function(e,t,s){"use strict";const i=s(1),{Events:n}=s(0);e.exports=class MessageCreateAction extends i{handle(e){const t=this.client,s=t.channels.get(e.channel_id);if(s){const i=s.messages.get(e.id);if(i)return{message:i};const r=s.messages.add(e),o=r.author;let a=null;return r.member&&s.guild?a=s.guild.members.add(r.member):s.guild&&(a=s.guild.member(o)),s.lastMessageID=e.id,o&&(o.lastMessageID=e.id,o.lastMessageChannelID=s.id),a&&(a.lastMessageID=e.id,a.lastMessageChannelID=s.id),t.emit(n.MESSAGE_CREATE,r),{message:r}}return{}}}},function(e,t,s){"use strict";const i=s(1),{Events:n}=s(0);e.exports=class MessageDeleteAction extends i{handle(e){const t=this.client,s=this.getChannel(e);let i;return s&&(i=this.getMessage(e,s))&&(s.messages.delete(i.id),i.deleted=!0,t.emit(n.MESSAGE_DELETE,i)),{message:i}}}},function(e,t,s){"use strict";const i=s(1),n=s(3),{Events:r}=s(0);e.exports=class MessageDeleteBulkAction extends i{handle(e){const t=this.client,s=t.channels.get(e.channel_id);if(s){const i=e.ids,o=new n;for(const e of i){const t=s.messages.get(e);t&&(t.deleted=!0,o.set(t.id,t),s.messages.delete(e))}return o.size>0&&t.emit(r.MESSAGE_BULK_DELETE,o),{messages:o}}return{}}}},function(e,t,s){"use strict";const i=s(1);e.exports=class MessageUpdateAction extends i{handle(e){const t=this.getChannel(e);if(t){const s=this.getMessage(e,t);if(s)return s.patch(e),{old:s._edits[0],updated:s}}return{}}}},function(e,t,s){"use strict";const i=s(1);e.exports=class MessageReactionAdd extends i{handle(e){const t=e.user||this.client.users.get(e.user_id);if(!t)return!1;const s=this.getChannel(e);if(!s||"voice"===s.type)return!1;const i=this.getMessage(e,s);if(!i)return!1;if(!e.emoji)return!1;const n=i.reactions.add({emoji:e.emoji,count:0,me:t.id===this.client.user.id});return n._add(t),{message:i,reaction:n,user:t}}}},function(e,t,s){"use strict";const i=s(1),{Events:n}=s(0);e.exports=class MessageReactionRemove extends i{handle(e){const t=this.client.users.get(e.user_id);if(!t)return!1;const s=this.client.channels.get(e.channel_id);if(!s||"voice"===s.type)return!1;const i=s.messages.get(e.message_id);if(!i)return!1;if(!e.emoji)return!1;const r=e.emoji.id||decodeURIComponent(e.emoji.name),o=i.reactions.get(r);return!!o&&(o._remove(t),this.client.emit(n.MESSAGE_REACTION_REMOVE,o,t),{message:i,reaction:o,user:t})}}},function(e,t,s){"use strict";const i=s(1),{Events:n}=s(0);e.exports=class MessageReactionRemoveAll extends i{handle(e){const t=this.client.channels.get(e.channel_id);if(!t||"voice"===t.type)return!1;const s=t.messages.get(e.message_id);return!!s&&(s.reactions.clear(),this.client.emit(n.MESSAGE_REACTION_REMOVE_ALL,s),{message:s})}}},function(e,t,s){"use strict";const i=s(1),{Events:n}=s(0);e.exports=class ChannelCreateAction extends i{handle(e){const t=this.client,s=t.channels.has(e.id),i=t.channels.add(e);return!s&&i&&t.emit(n.CHANNEL_CREATE,i),{channel:i}}}},function(e,t,s){"use strict";const i=s(1),{Events:n}=s(0);e.exports=class ChannelDeleteAction extends i{constructor(e){super(e),this.deleted=new Map}handle(e){const t=this.client;let s=t.channels.get(e.id);return s&&(t.channels.remove(s.id),s.deleted=!0,t.emit(n.CHANNEL_DELETE,s)),{channel:s}}}},function(e,t,s){"use strict";const i=s(1);e.exports=class ChannelUpdateAction extends i{handle(e){const t=this.client.channels.get(e.id);return t?{old:t._update(e),updated:t}:{}}}},function(e,t,s){"use strict";const i=s(1),{Events:n}=s(0);e.exports=class GuildDeleteAction extends i{constructor(e){super(e),this.deleted=new Map}handle(e){const t=this.client;let s=t.guilds.get(e.id);if(s){for(const e of s.channels.values())"text"===e.type&&e.stopTyping(!0);if(s.available&&e.unavailable)return s.available=!1,t.emit(n.GUILD_UNAVAILABLE,s),{guild:null};for(const e of s.channels.values())this.client.channels.remove(e.id);s.voiceConnection&&s.voiceConnection.disconnect(),t.guilds.remove(s.id),s.deleted=!0,t.emit(n.GUILD_DELETE,s),this.deleted.set(s.id,s),this.scheduleForDeletion(s.id)}else s=this.deleted.get(e.id)||null;return{guild:s}}scheduleForDeletion(e){this.client.setTimeout(()=>this.deleted.delete(e),this.client.options.restWsBridgeTimeout)}}},function(e,t,s){"use strict";const i=s(1),{Events:n}=s(0);e.exports=class GuildUpdateAction extends i{handle(e){const t=this.client,s=t.guilds.get(e.id);if(s){const i=s._update(e);return t.emit(n.GUILD_UPDATE,i,s),{old:i,updated:s}}return{old:null,updated:null}}}},function(e,t,s){"use strict";const i=s(1),{Events:n,Status:r}=s(0);e.exports=class GuildMemberRemoveAction extends i{handle(e,t){const s=this.client,i=s.guilds.get(e.guild_id);let o=null;return i&&(o=i.members.get(e.user.id),i.memberCount--,o&&(i.voiceStates.delete(o.id),o.deleted=!0,i.members.remove(o.id),t.status===r.READY&&s.emit(n.GUILD_MEMBER_REMOVE,o))),{guild:i,member:o}}}},function(e,t,s){"use strict";const i=s(1),{Events:n}=s(0);e.exports=class GuildBanRemove extends i{handle(e){const t=this.client,s=t.guilds.get(e.guild_id),i=t.users.add(e.user);s&&i&&t.emit(n.GUILD_BAN_REMOVE,s,i)}}},function(e,t,s){"use strict";const i=s(1),{Events:n}=s(0);e.exports=class GuildRoleCreate extends i{handle(e){const t=this.client,s=t.guilds.get(e.guild_id);let i;if(s){const r=s.roles.has(e.role.id);i=s.roles.add(e.role),r||t.emit(n.GUILD_ROLE_CREATE,i)}return{role:i}}}},function(e,t,s){"use strict";const i=s(1),{Events:n}=s(0);e.exports=class GuildRoleDeleteAction extends i{handle(e){const t=this.client,s=t.guilds.get(e.guild_id);let i;return s&&(i=s.roles.get(e.role_id))&&(s.roles.remove(e.role_id),i.deleted=!0,t.emit(n.GUILD_ROLE_DELETE,i)),{role:i}}}},function(e,t,s){"use strict";const i=s(1),{Events:n}=s(0);e.exports=class GuildRoleUpdateAction extends i{handle(e){const t=this.client,s=t.guilds.get(e.guild_id);if(s){let i=null;const r=s.roles.get(e.role.id);return r&&(i=r._update(e.role),t.emit(n.GUILD_ROLE_UPDATE,i,r)),{old:i,updated:r}}return{old:null,updated:null}}}},function(e,t,s){"use strict";const i=s(1),{Events:n}=s(0);e.exports=class PresenceUpdateAction extends i{handle(e){let t=this.client.users.get(e.user.id);if(!t&&e.user.username&&(t=this.client.users.add(e.user)),!t)return;e.user&&e.user.username&&(t.equals(e.user)||this.client.actions.UserUpdate.handle(e.user));const s=this.client.guilds.get(e.guild_id);if(!s)return;let i=s.members.get(t.id);if(i||"offline"===e.status||(i=s.members.add({user:t,roles:e.roles,deaf:!1,mute:!1}),this.client.emit(n.GUILD_MEMBER_AVAILABLE,i)),i){if(0===this.client.listenerCount(n.PRESENCE_UPDATE))return void s.presences.add(e);const t=i._clone();i.presence&&(t.frozenPresence=i.presence._clone()),s.presences.add(e),this.client.emit(n.PRESENCE_UPDATE,t,i)}else s.presences.add(e)}}},function(e,t,s){"use strict";const i=s(1),{Events:n}=s(0);e.exports=class UserUpdateAction extends i{handle(e){const t=this.client,s=t.users.get(e.id),i=s._update(e);return i.equals(s)?{old:null,updated:null}:(t.emit(n.USER_UPDATE,i,s),{old:i,updated:s})}}},function(e,t,s){"use strict";const i=s(1),{Events:n}=s(0),r=s(19);e.exports=class VoiceStateUpdate extends i{handle(e){const t=this.client,s=t.guilds.get(e.guild_id);if(s){const i=s.voiceStates.has(e.user_id)?s.voiceStates.get(e.user_id)._clone():new r(s,{user_id:e.user_id}),o=s.voiceStates.add(e);let a=s.members.get(e.user_id);a&&e.member?a._patch(e.member):e.member&&e.member.user&&e.member.joined_at&&(a=s.members.add(e.member)),a&&a.user.id===t.user.id&&e.channel_id&&t.emit("self.voiceStateUpdate",e),t.emit(n.VOICE_STATE_UPDATE,i,o)}}}},function(e,t,s){"use strict";const i=s(1),{Events:n}=s(0);e.exports=class GuildEmojiCreateAction extends i{handle(e,t){const s=e.emojis.add(t);return this.client.emit(n.GUILD_EMOJI_CREATE,s),{emoji:s}}}},function(e,t,s){"use strict";const i=s(1),{Events:n}=s(0);e.exports=class GuildEmojiDeleteAction extends i{handle(e){return e.guild.emojis.remove(e.id),e.deleted=!0,this.client.emit(n.GUILD_EMOJI_DELETE,e),{emoji:e}}}},function(e,t,s){"use strict";const i=s(1),{Events:n}=s(0);e.exports=class GuildEmojiUpdateAction extends i{handle(e,t){const s=e._update(t);return this.client.emit(n.GUILD_EMOJI_UPDATE,s,e),{emoji:e}}}},function(e,t,s){"use strict";const i=s(1);e.exports=class GuildEmojisUpdateAction extends i{handle(e){const t=this.client.guilds.get(e.guild_id);if(!t||!t.emojis)return;const s=new Map(t.emojis);for(const i of e.emojis){const e=t.emojis.get(i.id);e?(s.delete(i.id),e.equals(i)||this.client.actions.GuildEmojiUpdate.handle(e,i)):this.client.actions.GuildEmojiCreate.handle(t,i)}for(const e of s.values())this.client.actions.GuildEmojiDelete.handle(e)}}},function(e,t,s){"use strict";const i=s(1);e.exports=class GuildRolesPositionUpdate extends i{handle(e){const t=this.client.guilds.get(e.guild_id);if(t)for(const s of e.roles){const e=t.roles.get(s.id);e&&(e.rawPosition=s.position)}return{guild:t}}}},function(e,t,s){"use strict";const i=s(1);e.exports=class GuildChannelsPositionUpdate extends i{handle(e){const t=this.client.guilds.get(e.guild_id);if(t)for(const s of e.channels){const e=t.channels.get(s.id);e&&(e.rawPosition=s.position)}return{guild:t}}}},function(e,t,s){"use strict";const i=s(1),{Events:n}=s(0);e.exports=class GuildIntegrationsUpdate extends i{handle(e){const t=this.client,s=t.guilds.get(e.guild_id);s&&t.emit(n.GUILD_INTEGRATIONS_UPDATE,s)}}},function(e,t,s){"use strict";const i=s(1),{Events:n}=s(0);e.exports=class WebhooksUpdate extends i{handle(e){const t=this.client,s=t.channels.get(e.channel_id);s&&t.emit(n.WEBHOOKS_UPDATE,s)}}},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t,s){"use strict";const i=s(20);class Speaking extends i{}Speaking.FLAGS={SPEAKING:1,SOUNDSHARE:2},e.exports=Speaking}])}); \ No newline at end of file