diff --git a/discord.indev.js b/discord.indev.js index 6fa14abb..930997eb 100644 --- a/discord.indev.js +++ b/discord.indev.js @@ -21863,8 +21863,8 @@ class WebSocketPacketManager { } if (packet.op === Constants.OPCodes.HEARTBEAT) { - this.client.ws.send({ op: Constants.OPCodes.HEARTBEAT_ACK }); - this.ws.client.emit('debug', 'ACKed gateway heartbeat!'); + this.client.ws.send({ op: Constants.OPCodes.HEARTBEAT }); + this.ws.client.emit('debug', 'Recieved gateway heartbeat!'); } if (this.ws.status === Constants.Status.RECONNECTING) { diff --git a/discord.indev.min.js b/discord.indev.min.js index 90437648..2b9da76c 100644 --- a/discord.indev.min.js +++ b/discord.indev.min.js @@ -16,4 +16,4 @@ var J=n(63),X=n(65),Q=n(66);e.Buffer=o,e.SlowBuffer=g,e.INSPECT_MAX_BYTES=50,o.T return e?this.recipients.equals(t.recipients):e}toString(){return this.name}sendMessage(){}sendTTSMessage(){}sendEmbed(){}sendFile(){}sendCode(){}fetchMessage(){}fetchMessages(){}fetchPinnedMessages(){}startTyping(){}stopTyping(){}get typing(){}get typingCount(){}createCollector(){}awaitMessages(){}bulkDelete(){}_cacheMessage(){}}s.applyToClass(o,!0),t.exports=o},function(t,e,n){const i=n(38),s=n(39),r=n(0);class o{constructor(t,e){Object.defineProperty(this,"client",{value:t}),this.setup(e)}setup(t){this.guild=this.client.guilds.get(t.guild.id)||new i(this.client,t.guild),this.code=t.code,this.temporary=t.temporary,this.maxAge=t.max_age,this.uses=t.uses,this.maxUses=t.max_uses,t.inviter&&(this.inviter=this.client.dataManager.newUser(t.inviter)),this.channel=this.client.channels.get(t.channel.id)||new s(this.client,t.channel),this.createdTimestamp=new Date(t.created_at).getTime()}get createdAt(){return new Date(this.createdTimestamp)}get expiresTimestamp(){return this.createdTimestamp+1e3*this.maxAge}get expiresAt(){return new Date(this.expiresTimestamp)}get url(){return r.Endpoints.inviteLink(this.code)}delete(){return this.client.rest.methods.deleteInvite(this)}toString(){return this.url}}t.exports=o},function(t,e){class n{constructor(t,e){Object.defineProperty(this,"client",{value:t.client}),this.message=t,this.setup(e)}setup(t){this.id=t.id,this.filename=t.filename,this.filesize=t.size,this.url=t.url,this.proxyURL=t.proxy_url,this.height=t.height,this.width=t.width}}t.exports=n},function(t,e,n){const i=n(21).EventEmitter,s=n(3);class r extends i{constructor(t,e,n={}){super(),this.channel=t,this.filter=e,this.options=n,this.ended=!1,this.collected=new s,this.listener=(t=>this.verify(t)),this.channel.client.on("message",this.listener),n.time&&this.channel.client.setTimeout(()=>this.stop("time"),n.time)}verify(t){return(!this.channel||this.channel.id===t.channel.id)&&(!!this.filter(t,this)&&(this.collected.set(t.id,t),this.emit("message",t,this),this.collected.size>=this.options.maxMatches?this.stop("matchesLimit"):this.options.max&&this.collected.size===this.options.max&&this.stop("limit"),!0))}get next(){return new Promise((t,e)=>{if(this.ended)return void e(this.collected);const n=()=>{this.removeListener("message",i),this.removeListener("end",s)},i=(...e)=>{n(),t(...e)},s=(...t)=>{n(),e(...t)};this.once("message",i),this.once("end",s)})}stop(t="user"){this.ended||(this.ended=!0,this.channel.client.removeListener("message",this.listener),this.emit("end",this.collected,t))}}t.exports=r},function(t,e){class n{constructor(t,e){Object.defineProperty(this,"client",{value:t.client}),this.message=t,this.setup(e)}setup(t){if(this.type=t.type,this.title=t.title,this.description=t.description,this.url=t.url,this.color=t.color,this.fields=[],t.fields)for(const e of t.fields)this.fields.push(new o(this,e));this.createdTimestamp=t.timestamp,this.thumbnail=t.thumbnail?new i(this,t.thumbnail):null,this.author=t.author?new r(this,t.author):null,this.provider=t.provider?new s(this,t.provider):null,this.footer=t.footer?new a(this,t.footer):null}get createdAt(){return new Date(this.createdTimestamp)}get hexColor(){let t=this.color.toString(16);for(;t.length<6;)t=`0${t}`;return`#${t}`}}class i{constructor(t,e){this.embed=t,this.setup(e)}setup(t){this.url=t.url,this.proxyURL=t.proxy_url,this.height=t.height,this.width=t.width}}class s{constructor(t,e){this.embed=t,this.setup(e)}setup(t){this.name=t.name,this.url=t.url}}class r{constructor(t,e){this.embed=t,this.setup(e)}setup(t){this.name=t.name,this.url=t.url,this.iconURL=t.icon_url}}class o{constructor(t,e){this.embed=t,this.setup(e)}setup(t){this.name=t.name,this.value=t.value,this.inline=t.inline}}class a{constructor(t,e){this.embed=t,this.setup(e)}setup(t){this.text=t.text,this.iconURL=t.icon_url,this.proxyIconUrl=t.proxy_icon_url}}n.Thumbnail=i,n.Provider=s,n.Author=r,n.Field=o,n.Footer=a,t.exports=n},function(t,e,n){const i=n(3),s=n(10),r=n(18);class o{constructor(t,e,n,s){this.message=t,this.me=s,this.count=n||0,this.users=new i,this._emoji=new r(this,e.name,e.id)}get emoji(){if(this._emoji instanceof s)return this._emoji;if(this._emoji.id){const t=this.message.client.emojis;if(t.has(this._emoji.id)){const e=t.get(this._emoji.id);return this._emoji=e,e}}return this._emoji}remove(t=this.message.client.user){const e=this.message;return t=this.message.client.resolver.resolveUserID(t),t?e.client.rest.methods.removeMessageReaction(e,this.emoji.identifier,t):Promise.reject("Couldn't resolve the user ID to remove from the reaction.")}fetchUsers(t=100){const e=this.message;return e.client.rest.methods.getMessageReactionUsers(e,this.emoji.identifier,t).then(t=>{this.users=new i;for(const e of t){const t=this.message.client.dataManager.newUser(e);this.users.set(t.id,t)}return this.count=this.users.size,t})}}t.exports=o},function(t,e){class n{constructor(t,e){Object.defineProperty(this,"client",{value:t}),this.setup(e)}setup(t){this.id=t.id,this.name=t.name,this.description=t.description,this.icon=t.icon,this.iconURL=`https://cdn.discordapp.com/app-icons/${this.id}/${this.icon}.jpg`,this.rpcOrigins=t.rpc_origins}get createdTimestamp(){return this.id/4194304+14200704e5}get createdAt(){return new Date(this.createdTimestamp)}toString(){return this.name}}t.exports=n},function(t,e){class n{constructor(t,e){Object.defineProperty(this,"client",{value:t}),this.setup(e)}setup(t){this.id=t.id,this.name=t.name,this.icon=t.icon,this.splash=t.splash}}t.exports=n},function(t,e,n){const i=n(0);class s{constructor(t,e){Object.defineProperty(this,"client",{value:t}),this.setup(e)}setup(t){this.id=t.id,this.name=t.name,this.type=i.ChannelTypes.text===t.type?"text":"voice"}}t.exports=s},function(t,e){class n{constructor(t,e){Object.defineProperty(this,"channel",{value:t}),e&&this.setup(e)}setup(t){this.id=t.id,this.type=t.type,this.deny=t.deny,this.allow=t.allow}delete(){return this.channel.client.rest.methods.deletePermissionOverwrites(this)}}t.exports=n},function(t,e){function n(t){return"string"==typeof t?t:t instanceof Array?t.join("\n"):String(t)}class i{constructor(t={}){this.title=t.title,this.description=t.description,this.url=t.url,this.color=t.color,this.author=t.author,this.timestamp=t.timestamp,this.fields=t.fields||[],this.thumbnail=t.thumbnail,this.image=t.image,this.footer=t.footer}setTitle(t){if(t=n(t),t.length>256)throw new RangeError("RichEmbed titles may not exceed 256 characters.");return this.title=t,this}setDescription(t){if(t=n(t),t.length>2048)throw new RangeError("RichEmbed descriptions may not exceed 2048 characters.");return this.description=t,this}setURL(t){return this.url=t,this}setColor(t){let e=10;if(t instanceof Array?t=(t[0]<<16)+(t[1]<<8)+t[2]:"string"==typeof t&&t.startsWith("#")&&(e=16,t=t.replace("#","")),t=parseInt(t,e),t<0||t>16777215)throw new RangeError("RichEmbed color must be within the range 0 - 16777215 (0xFFFFFF).");if(t&&isNaN(t))throw new TypeError("Unable to convert RichEmbed color to a number.");return this.color=t,this}setAuthor(t,e,i){return this.author={name:n(t),icon_url:e,url:i},this}setTimestamp(t=new Date){return this.timestamp=t,this}addField(t,e,i=false){if(this.fields.length>=25)throw new RangeError("RichEmbeds may not exceed 25 fields.");if(t=n(t),t.length>256)throw new RangeError("RichEmbed field names may not exceed 256 characters.");if(e=n(e),e.length>1024)throw new RangeError("RichEmbed field values may not exceed 1024 characters.");return this.fields.push({name:String(t),value:e,inline:i}),this}setThumbnail(t){return this.thumbnail={url:t},this}setImage(t){return this.image={url:t},this}setFooter(t,e){if(t=n(t),t.length>2048)throw new RangeError("RichEmbed footer text may not exceed 2048 characters.");return this.footer={text:t,icon_url:e},this}}t.exports=i},function(t,e,n){const i=n(13),s=n(12),r=n(3);class o extends i{constructor(t,e){super(t,e),this.type="text",this.messages=new r,this._typing=new Map}setup(t){super.setup(t),this.topic=t.topic,this.lastMessageID=t.last_message_id}get members(){const t=new r;for(const e of this.guild.members.values())this.permissionsFor(e).hasPermission("READ_MESSAGES")&&t.set(e.id,e);return t}fetchWebhooks(){return this.client.rest.methods.getChannelWebhooks(this)}createWebhook(t,e){return new Promise(n=>{e.startsWith("data:")?n(this.client.rest.methods.createWebhook(this,t,e)):this.client.resolver.resolveBuffer(e).then(e=>n(this.client.rest.methods.createWebhook(this,t,e)))})}sendMessage(){}sendTTSMessage(){}sendEmbed(){}sendFile(){}sendCode(){}fetchMessage(){}fetchMessages(){}fetchPinnedMessages(){}startTyping(){}stopTyping(){}get typing(){}get typingCount(){}createCollector(){}awaitMessages(){}bulkDelete(){}_cacheMessage(){}}s.applyToClass(o,!0),t.exports=o},function(t,e,n){const i=n(13),s=n(3);class r extends i{constructor(t,e){super(t,e),this.members=new s,this.type="voice"}setup(t){super.setup(t),this.bitrate=t.bitrate,this.userLimit=t.user_limit}get connection(){const t=this.guild.voiceConnection;return t&&t.channel.id===this.id?t:null}get joinable(){return!this.client.browser&&this.permissionsFor(this.client.user).hasPermission("CONNECT")}get speakable(){return this.permissionsFor(this.client.user).hasPermission("SPEAK")}setBitrate(t){return this.edit({bitrate:t})}setUserLimit(t){return this.edit({userLimit:t})}join(){return this.client.browser?Promise.reject(new Error("Voice connections are not available in browsers.")):this.client.voice.joinChannel(this)}leave(){if(!this.client.browser){const t=this.client.voice.connections.get(this.guild.id);t&&t.channel.id===this.id&&t.disconnect()}}}t.exports=r},function(t,e){t.exports=function(t,{maxLength=1950,char="\n",prepend="",append=""}={}){if(t.length<=maxLength)return t;const e=t.split(char);if(1===e.length)throw new Error("Message exceeds the max length and contains no split characters.");const n=[""];let i=0;for(let s=0;smaxLength&&(n[i]+=append,n.push(prepend),i++),n[i]+=(n[i].length>0&&n[i]!==prepend?char:"")+e[s];return n}},function(t,e,n){"use strict";function i(t,e){if(e<65537&&(t.subarray&&o||!t.subarray&&r))return String.fromCharCode.apply(null,s.shrinkBuf(t,e));for(var n="",i=0;i=252?6:h>=248?5:h>=240?4:h>=224?3:h>=192?2:1;a[254]=a[254]=1,e.string2buf=function(t){var e,n,i,r,o,a=t.length,h=0;for(r=0;r>>6,e[o++]=128|63&n):n<65536?(e[o++]=224|n>>>12,e[o++]=128|n>>>6&63,e[o++]=128|63&n):(e[o++]=240|n>>>18,e[o++]=128|n>>>12&63,e[o++]=128|n>>>6&63,e[o++]=128|63&n);return e},e.buf2binstring=function(t){return i(t,t.length)},e.binstring2buf=function(t){for(var e=new s.Buf8(t.length),n=0,i=e.length;n4)u[s++]=65533,n+=o-1;else{for(r&=2===o?31:3===o?15:7;o>1&&n1?u[s++]=65533:r<65536?u[s++]=r:(r-=65536,u[s++]=55296|r>>10&1023,u[s++]=56320|1023&r)}return i(u,s)},e.utf8border=function(t,e){var n;for(e=e||t.length,e>t.length&&(e=t.length),n=e-1;n>=0&&128===(192&t[n]);)n--;return n<0?e:0===n?e:n+a[t[n]]>e?n:e}},function(t,e,n){"use strict";function i(t,e,n,i){for(var s=65535&t|0,r=t>>>16&65535|0,o=0;0!==n;){o=n>2e3?2e3:n,n-=o;do s=s+e[i++]|0,r=r+s|0;while(--o);s%=65521,r%=65521}return s|r<<16|0}t.exports=i},function(t,e,n){"use strict";t.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(t,e,n){"use strict";function i(){for(var t,e=[],n=0;n<256;n++){t=n;for(var i=0;i<8;i++)t=1&t?3988292384^t>>>1:t>>>1;e[n]=t}return e}function s(t,e,n,i){var s=r,o=i+n;t^=-1;for(var a=i;a>>8^s[255&(t^e[a])];return t^-1}var r=i();t.exports=s},function(t,e,n){"use strict";function i(){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}t.exports=i},function(t,e){},function(t,e,n){(function(e){const i=n(23),s=n(50),r=n(25),o=n(0),a=n(54),h=n(6),u=n(11),c=n(17),l=n(9),d=n(14),f=n(10),p=n(18);class m{constructor(t){this.client=t}resolveUser(t){return t instanceof h?t:"string"==typeof t?this.client.users.get(t)||null:t instanceof d?t.user:t instanceof u?t.author:t instanceof c?t.owner:null}resolveUserID(t){return t instanceof h||t instanceof d?t.id:"string"==typeof t?t||null:t instanceof u?t.author.id:t instanceof c?t.ownerID:null}resolveGuild(t){return t instanceof c?t:"string"==typeof t?this.client.guilds.get(t)||null:null}resolveGuildMember(t,e){return e instanceof d?e:(t=this.resolveGuild(t),e=this.resolveUser(e),t&&e?t.members.get(e.id)||null:null)}resolveChannel(t){return t instanceof l?t:t instanceof u?t.channel:t instanceof c?t.channels.get(t.id)||null:"string"==typeof t?this.client.channels.get(t)||null:null}resolveInviteCode(t){const e=/discord(?:app)?\.(?:gg|com\/invite)\/([a-z0-9]{5})/i,n=e.exec(t);return n&&n[1]?n[1]:t}resolvePermission(t){if("string"==typeof t&&(t=o.PermissionFlags[t]),"number"!=typeof t||t<1)throw new Error(o.Errors.NOT_A_PERMISSION);return t}resolvePermissions(t){let e=0;for(const n of t)e|=this.resolvePermission(n);return e}resolveString(t){return"string"==typeof t?t:t instanceof Array?t.join("\n"):String(t)}resolveBase64(t){return t instanceof e?`data:image/jpg;base64,${t.toString("base64")}`:t}resolveBuffer(t){return t instanceof e?Promise.resolve(t):this.client.browser&&t instanceof ArrayBuffer?Promise.resolve(a(t)):"string"==typeof t?new Promise((n,o)=>{if(/^https?:\/\//.test(t)){const i=r.get(t).set("Content-Type","blob");this.client.browser&&i.responseType("arraybuffer"),i.end((t,i)=>{return t?o(t):this.client.browser?n(a(i.xhr.response)):i.body instanceof e?n(i.body):o(new TypeError("The response body isn't a Buffer."))})}else{const e=i.resolve(t);s.stat(e,(t,i)=>{if(t&&o(t),!i||!i.isFile())throw new Error(`The file could not be found: ${e}`);s.readFile(e,(t,e)=>{t?o(t):n(e)})})}}):Promise.reject(new TypeError("The resource must be a string or Buffer."))}resolveEmojiIdentifier(t){return t instanceof f||t instanceof p?t.identifier:"string"!=typeof t||t.includes("%")?null:encodeURIComponent(t)}}t.exports=m}).call(e,n(20).Buffer)},function(t,e,n){const i=n(114),s=n(111),r=n(113),o=n(112),a=n(110),h=n(0);class u{constructor(t){this.client=t,this.handlers={},this.userAgentManager=new i(this),this.methods=new s(this),this.rateLimitedEndpoints={},this.globallyRateLimited=!1}push(t,e){return new Promise((n,i)=>{t.push({request:e,resolve:n,reject:i})})}getRequestHandler(){switch(this.client.options.apiRequestMethod){case"sequential":return r;case"burst":return o;default:throw new Error(h.Errors.INVALID_RATE_LIMIT_METHOD)}}makeRequest(t,e,n,i,s){const r=new a(this,t,e,n,i,s);if(!this.handlers[r.route]){const t=this.getRequestHandler();this.handlers[r.route]=new t(this,r.route)}return this.push(this.handlers[r.route],r)}}t.exports=u},function(t,e){class n{constructor(t){this.restManager=t,this.queue=[]}get globalLimit(){return this.restManager.globallyRateLimited}set globalLimit(t){this.restManager.globallyRateLimited=t}push(t){this.queue.push(t)}handle(){}}t.exports=n},function(t,e,n){(function(e){function n(t){const n=new e(t.byteLength),i=new Uint8Array(t);for(var s=0;s0&&this.setInterval(this.sweepMessages.bind(this),1e3*this.options.messageSweepInterval)}get status(){return this.ws.status}get uptime(){return this.readyAt?Date.now()-this.readyAt:null}get ping(){return this.pings.reduce((t,e)=>t+e,0)/this.pings.length}get voiceConnections(){return this.browser?new Collection:this.voice.connections}get emojis(){const t=new Collection;for(const e of this.guilds.values())for(const n of e.emojis.values())t.set(n.id,n);return t}get readyTimestamp(){return this.readyAt?this.readyAt.getTime():null}get browser(){return"undefined"!=typeof window}login(t){return this.rest.methods.login(t)}destroy(){for(const t of this._timeouts)clearTimeout(t);for(const e of this._intervals)clearInterval(e);return this._timeouts.clear(),this._intervals.clear(),this.manager.destroy()}syncGuilds(t=this.guilds){this.user.bot||this.ws.send({op:12,d:t instanceof Collection?t.keyArray():t.map(t=>t.id)})}fetchUser(t){return this.users.has(t)?Promise.resolve(this.users.get(t)):this.rest.methods.getUser(t)}fetchInvite(t){const e=this.resolver.resolveInviteCode(t);return this.rest.methods.getInvite(e)}fetchWebhook(t,e){return this.rest.methods.getWebhook(t,e)}sweepMessages(t=this.options.messageCacheLifetime){if("number"!=typeof t||isNaN(t))throw new TypeError("The lifetime must be a number.");if(t<=0)return this.emit("debug","Didn't sweep messages - lifetime is unlimited"),-1;const e=1e3*t,n=Date.now();let i=0,s=0;for(const r of this.channels.values())if(r.messages){i++;for(const t of r.messages.values())n-(t.editedTimestamp||t.createdTimestamp)>e&&(r.messages.delete(t.id),s++)}return this.emit("debug",`Swept ${s} messages older than ${t} seconds in ${i} text-based channels`),s}fetchApplication(){if(!this.user.bot)throw new Error(Constants.Errors.NO_BOT_ACCOUNT);return this.rest.methods.getMyApplication()}generateInvite(t){return t?t instanceof Array&&(t=this.resolver.resolvePermissions(t)):t=0,this.fetchApplication().then(e=>`https://discordapp.com/oauth2/authorize?client_id=${e.id}&permissions=${t}&scope=bot`)}setTimeout(t,e,...n){const i=setTimeout(()=>{t(),this._timeouts.delete(i)},e,...n);return this._timeouts.add(i),i}clearTimeout(t){clearTimeout(t),this._timeouts.delete(t)}setInterval(t,e,...n){const i=setInterval(t,e,...n);return this._intervals.add(i),i}clearInterval(t){clearInterval(t),this._intervals.delete(t)}_pong(t){this.pings.unshift(Date.now()-t),this.pings.length>3&&(this.pings.length=3),this.ws.lastHeartbeatAck=!0}_setPresence(t,e){return this.presences.get(t)?void this.presences.get(t).update(e):void this.presences.set(t,new Presence(e))}_eval(script){return eval(script)}_validateOptions(t=this.options){if("number"!=typeof t.shardCount||isNaN(t.shardCount))throw new TypeError("The shardCount option must be a number.");if("number"!=typeof t.shardId||isNaN(t.shardId))throw new TypeError("The shardId option must be a number.");if(t.shardCount<0)throw new RangeError("The shardCount option must be at least 0.");if(t.shardId<0)throw new RangeError("The shardId option must be at least 0.");if(0!==t.shardId&&t.shardId>=t.shardCount)throw new RangeError("The shardId option must be less than shardCount.");if("number"!=typeof t.messageCacheMaxSize||isNaN(t.messageCacheMaxSize))throw new TypeError("The messageCacheMaxSize option must be a number.");if("number"!=typeof t.messageCacheLifetime||isNaN(t.messageCacheLifetime))throw new TypeError("The messageCacheLifetime option must be a number.");if("number"!=typeof t.messageSweepInterval||isNaN(t.messageSweepInterval))throw new TypeError("The messageSweepInterval option must be a number.");if("boolean"!=typeof t.fetchAllMembers)throw new TypeError("The fetchAllMembers option must be a boolean.");if("boolean"!=typeof t.disableEveryone)throw new TypeError("The disableEveryone option must be a boolean.");if("number"!=typeof t.restWsBridgeTimeout||isNaN(t.restWsBridgeTimeout))throw new TypeError("The restWsBridgeTimeout option must be a number.");if(!(t.disabledEvents instanceof Array))throw new TypeError("The disabledEvents option must be an Array.")}}module.exports=Client}).call(exports,__webpack_require__(24))},function(t,e,n){const i=n(19),s=n(52),r=n(51),o=n(55),a=n(0);class h extends i{constructor(t,e,n){super(null,t,e),this.options=o(a.DefaultOptions,n),this.rest=new s(this),this.resolver=new r(this)}}t.exports=h},function(t,e,n){t.exports={Client:n(56),WebhookClient:n(57),Shard:n(60),ShardClientUtil:n(61),ShardingManager:n(62),Collection:n(3),splitMessage:n(44),escapeMarkdown:n(15),fetchRecommendedShards:n(59),Channel:n(9),ClientOAuth2Application:n(28),ClientUser:n(29),DMChannel:n(30),Emoji:n(10),EvaluatedPermissions:n(16),Game:n(7).Game,GroupDMChannel:n(31),Guild:n(17),GuildChannel:n(13),GuildMember:n(14),Invite:n(32),Message:n(11),MessageAttachment:n(33),MessageCollector:n(34),MessageEmbed:n(35),MessageReaction:n(36),OAuth2Application:n(37),PartialGuild:n(38),PartialGuildChannel:n(39),PermissionOverwrites:n(40),Presence:n(7).Presence,ReactionEmoji:n(18),RichEmbed:n(41),Role:n(8),TextChannel:n(42),User:n(6),VoiceChannel:n(43),Webhook:n(19),version:n(27).version,Constants:n(0)},"undefined"!=typeof window&&(window.Discord=t.exports)},function(t,e,n){const i=n(25),s=n(0).Endpoints.botGateway;t.exports=function(t){return new Promise((e,n)=>{if(!t)throw new Error("A token must be provided.");i.get(s).set("Authorization",`Bot ${t.replace(/^Bot\s*/i,"")}`).end((t,i)=>{t&&n(t),e(i.body.shards)})})}},function(t,e){},function(t,e){},function(t,e){},function(t,e,n){"use strict";function i(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===t[e-2]?2:"="===t[e-1]?1:0}function s(t){return 3*t.length/4-i(t)}function r(t){var e,n,s,r,o,a,h=t.length;o=i(t),a=new l(3*h/4-o),s=o>0?h-4:h;var u=0;for(e=0,n=0;e>16&255,a[u++]=r>>8&255,a[u++]=255&r;return 2===o?(r=c[t.charCodeAt(e)]<<2|c[t.charCodeAt(e+1)]>>4,a[u++]=255&r):1===o&&(r=c[t.charCodeAt(e)]<<10|c[t.charCodeAt(e+1)]<<4|c[t.charCodeAt(e+2)]>>2,a[u++]=r>>8&255,a[u++]=255&r),a}function o(t){return u[t>>18&63]+u[t>>12&63]+u[t>>6&63]+u[63&t]}function a(t,e,n){for(var i,s=[],r=e;rc?c:h+o));return 1===i?(e=t[n-1],s+=u[e>>2],s+=u[e<<4&63],s+="=="):2===i&&(e=(t[n-2]<<8)+t[n-1],s+=u[e>>10],s+=u[e>>4&63],s+=u[e<<2&63],s+="="),r.push(s),r.join("")}e.byteLength=s,e.toByteArray=r,e.fromByteArray=h;for(var u=[],c=[],l="undefined"!=typeof Uint8Array?Uint8Array:Array,d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",f=0,p=d.length;f>1,c=-7,l=n?s-1:0,d=n?-1:1,f=t[e+l];for(l+=d,r=f&(1<<-c)-1,f>>=-c,c+=a;c>0;r=256*r+t[e+l],l+=d,c-=8);for(o=r&(1<<-c)-1,r>>=-c,c+=i;c>0;o=256*o+t[e+l],l+=d,c-=8);if(0===r)r=1-u;else{if(r===h)return o?NaN:(f?-1:1)*(1/0);o+=Math.pow(2,i),r-=u}return(f?-1:1)*o*Math.pow(2,r-i)},e.write=function(t,e,n,i,s,r){var o,a,h,u=8*r-s-1,c=(1<>1,d=23===s?Math.pow(2,-24)-Math.pow(2,-77):0,f=i?0:r-1,p=i?1:-1,m=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,o=c):(o=Math.floor(Math.log(e)/Math.LN2),e*(h=Math.pow(2,-o))<1&&(o--,h*=2),e+=o+l>=1?d/h:d*Math.pow(2,1-l),e*h>=2&&(o++,h/=2),o+l>=c?(a=0,o=c):o+l>=1?(a=(e*h-1)*Math.pow(2,s),o+=l):(a=e*Math.pow(2,l-1)*Math.pow(2,s),o=0));s>=8;t[n+f]=255&a,f+=p,a/=256,s-=8);for(o=o<0;t[n+f]=255&o,f+=p,o/=256,u-=8);t[n+f-p]|=128*m}},function(t,e){var n={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==n.call(t)}},function(t,e,n){"use strict";var i=n(5).assign,s=n(68),r=n(69),o=n(47),a={};i(a,s,r,o),t.exports=a},function(t,e,n){"use strict";function i(t){if(!(this instanceof i))return new i(t);this.options=h.assign({level:E,method:v,chunkSize:16384,windowBits:15,memLevel:8,strategy:w,to:""},t||{});var e=this.options;e.raw&&e.windowBits>0?e.windowBits=-e.windowBits:e.gzip&&e.windowBits>0&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new l,this.strm.avail_out=0;var n=a.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(n!==m)throw new Error(c[n]);if(e.header&&a.deflateSetHeader(this.strm,e.header),e.dictionary){var s;if(s="string"==typeof e.dictionary?u.string2buf(e.dictionary):"[object ArrayBuffer]"===d.call(e.dictionary)?new Uint8Array(e.dictionary):e.dictionary,n=a.deflateSetDictionary(this.strm,s),n!==m)throw new Error(c[n]);this._dict_set=!0}}function s(t,e){var n=new i(e);if(n.push(t,!0),n.err)throw n.msg||c[n.err];return n.result}function r(t,e){return e=e||{},e.raw=!0,s(t,e)}function o(t,e){return e=e||{},e.gzip=!0,s(t,e)}var a=n(70),h=n(5),u=n(45),c=n(22),l=n(49),d=Object.prototype.toString,f=0,p=4,m=0,g=1,_=2,E=-1,w=0,v=8;i.prototype.push=function(t,e){var n,i,s=this.strm,r=this.options.chunkSize;if(this.ended)return!1;i=e===~~e?e:e===!0?p:f,"string"==typeof t?s.input=u.string2buf(t):"[object ArrayBuffer]"===d.call(t)?s.input=new Uint8Array(t):s.input=t,s.next_in=0,s.avail_in=s.input.length;do{if(0===s.avail_out&&(s.output=new h.Buf8(r),s.next_out=0,s.avail_out=r),n=a.deflate(s,i),n!==g&&n!==m)return this.onEnd(n),this.ended=!0,!1;0!==s.avail_out&&(0!==s.avail_in||i!==p&&i!==_)||("string"===this.options.to?this.onData(u.buf2binstring(h.shrinkBuf(s.output,s.next_out))):this.onData(h.shrinkBuf(s.output,s.next_out)))}while((s.avail_in>0||0===s.avail_out)&&n!==g);return i===p?(n=a.deflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===m):i!==_||(this.onEnd(m),s.avail_out=0,!0)},i.prototype.onData=function(t){this.chunks.push(t)},i.prototype.onEnd=function(t){t===m&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=h.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},e.Deflate=i,e.deflate=s,e.deflateRaw=r,e.gzip=o},function(t,e,n){"use strict";function i(t){if(!(this instanceof i))return new i(t);this.options=a.assign({chunkSize:16384,windowBits:0,to:""},t||{});var e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,0===e.windowBits&&(e.windowBits=-15)),!(e.windowBits>=0&&e.windowBits<16)||t&&t.windowBits||(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&0===(15&e.windowBits)&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new l,this.strm.avail_out=0;var n=o.inflateInit2(this.strm,e.windowBits);if(n!==u.Z_OK)throw new Error(c[n]);this.header=new d,o.inflateGetHeader(this.strm,this.header)}function s(t,e){var n=new i(e);if(n.push(t,!0),n.err)throw n.msg||c[n.err];return n.result}function r(t,e){return e=e||{},e.raw=!0,s(t,e)}var o=n(73),a=n(5),h=n(45),u=n(47),c=n(22),l=n(49),d=n(71),f=Object.prototype.toString;i.prototype.push=function(t,e){var n,i,s,r,c,l,d=this.strm,p=this.options.chunkSize,m=this.options.dictionary,g=!1;if(this.ended)return!1;i=e===~~e?e:e===!0?u.Z_FINISH:u.Z_NO_FLUSH,"string"==typeof t?d.input=h.binstring2buf(t):"[object ArrayBuffer]"===f.call(t)?d.input=new Uint8Array(t):d.input=t,d.next_in=0,d.avail_in=d.input.length;do{if(0===d.avail_out&&(d.output=new a.Buf8(p),d.next_out=0,d.avail_out=p),n=o.inflate(d,u.Z_NO_FLUSH),n===u.Z_NEED_DICT&&m&&(l="string"==typeof m?h.string2buf(m):"[object ArrayBuffer]"===f.call(m)?new Uint8Array(m):m,n=o.inflateSetDictionary(this.strm,l)),n===u.Z_BUF_ERROR&&g===!0&&(n=u.Z_OK,g=!1),n!==u.Z_STREAM_END&&n!==u.Z_OK)return this.onEnd(n),this.ended=!0,!1;d.next_out&&(0!==d.avail_out&&n!==u.Z_STREAM_END&&(0!==d.avail_in||i!==u.Z_FINISH&&i!==u.Z_SYNC_FLUSH)||("string"===this.options.to?(s=h.utf8border(d.output,d.next_out),r=d.next_out-s,c=h.buf2string(d.output,s),d.next_out=r,d.avail_out=p-r,r&&a.arraySet(d.output,d.output,s,r,0),this.onData(c)):this.onData(a.shrinkBuf(d.output,d.next_out)))),0===d.avail_in&&0===d.avail_out&&(g=!0)}while((d.avail_in>0||0===d.avail_out)&&n!==u.Z_STREAM_END);return n===u.Z_STREAM_END&&(i=u.Z_FINISH),i===u.Z_FINISH?(n=o.inflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===u.Z_OK):i!==u.Z_SYNC_FLUSH||(this.onEnd(u.Z_OK),d.avail_out=0,!0)},i.prototype.onData=function(t){this.chunks.push(t)},i.prototype.onEnd=function(t){t===u.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=a.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg},e.Inflate=i,e.inflate=s,e.inflateRaw=r, e.ungzip=s},function(t,e,n){"use strict";function i(t,e){return t.msg=U[e],e}function s(t){return(t<<1)-(t>4?9:0)}function r(t){for(var e=t.length;--e>=0;)t[e]=0}function o(t){var e=t.state,n=e.pending;n>t.avail_out&&(n=t.avail_out),0!==n&&(I.arraySet(t.output,e.pending_buf,e.pending_out,n,t.next_out),t.next_out+=n,e.pending_out+=n,t.total_out+=n,t.avail_out-=n,e.pending-=n,0===e.pending&&(e.pending_out=0))}function a(t,e){C._tr_flush_block(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,o(t.strm)}function h(t,e){t.pending_buf[t.pending++]=e}function u(t,e){t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e}function c(t,e,n,i){var s=t.avail_in;return s>i&&(s=i),0===s?0:(t.avail_in-=s,I.arraySet(e,t.input,t.next_in,s,n),1===t.state.wrap?t.adler=x(t.adler,e,s,n):2===t.state.wrap&&(t.adler=L(t.adler,e,s,n)),t.next_in+=s,t.total_in+=s,s)}function l(t,e){var n,i,s=t.max_chain_length,r=t.strstart,o=t.prev_length,a=t.nice_match,h=t.strstart>t.w_size-lt?t.strstart-(t.w_size-lt):0,u=t.window,c=t.w_mask,l=t.prev,d=t.strstart+ct,f=u[r+o-1],p=u[r+o];t.prev_length>=t.good_match&&(s>>=2),a>t.lookahead&&(a=t.lookahead);do if(n=e,u[n+o]===p&&u[n+o-1]===f&&u[n]===u[r]&&u[++n]===u[r+1]){r+=2,n++;do;while(u[++r]===u[++n]&&u[++r]===u[++n]&&u[++r]===u[++n]&&u[++r]===u[++n]&&u[++r]===u[++n]&&u[++r]===u[++n]&&u[++r]===u[++n]&&u[++r]===u[++n]&&ro){if(t.match_start=e,o=i,i>=a)break;f=u[r+o-1],p=u[r+o]}}while((e=l[e&c])>h&&0!==--s);return o<=t.lookahead?o:t.lookahead}function d(t){var e,n,i,s,r,o=t.w_size;do{if(s=t.window_size-t.lookahead-t.strstart,t.strstart>=o+(o-lt)){I.arraySet(t.window,t.window,o,o,0),t.match_start-=o,t.strstart-=o,t.block_start-=o,n=t.hash_size,e=n;do i=t.head[--e],t.head[e]=i>=o?i-o:0;while(--n);n=o,e=n;do i=t.prev[--e],t.prev[e]=i>=o?i-o:0;while(--n);s+=o}if(0===t.strm.avail_in)break;if(n=c(t.strm,t.window,t.strstart+t.lookahead,s),t.lookahead+=n,t.lookahead+t.insert>=ut)for(r=t.strstart-t.insert,t.ins_h=t.window[r],t.ins_h=(t.ins_h<t.pending_buf_size-5&&(n=t.pending_buf_size-5);;){if(t.lookahead<=1){if(d(t),0===t.lookahead&&e===P)return vt;if(0===t.lookahead)break}t.strstart+=t.lookahead,t.lookahead=0;var i=t.block_start+n;if((0===t.strstart||t.strstart>=i)&&(t.lookahead=t.strstart-i,t.strstart=i,a(t,!1),0===t.strm.avail_out))return vt;if(t.strstart-t.block_start>=t.w_size-lt&&(a(t,!1),0===t.strm.avail_out))return vt}return t.insert=0,e===B?(a(t,!0),0===t.strm.avail_out?yt:At):t.strstart>t.block_start&&(a(t,!1),0===t.strm.avail_out)?vt:vt}function p(t,e){for(var n,i;;){if(t.lookahead=ut&&(t.ins_h=(t.ins_h<=ut)if(i=C._tr_tally(t,t.strstart-t.match_start,t.match_length-ut),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=ut){t.match_length--;do t.strstart++,t.ins_h=(t.ins_h<=ut&&(t.ins_h=(t.ins_h<4096)&&(t.match_length=ut-1)),t.prev_length>=ut&&t.match_length<=t.prev_length){s=t.strstart+t.lookahead-ut,i=C._tr_tally(t,t.strstart-1-t.prev_match,t.prev_length-ut),t.lookahead-=t.prev_length-1,t.prev_length-=2;do++t.strstart<=s&&(t.ins_h=(t.ins_h<=ut&&t.strstart>0&&(s=t.strstart-1,i=o[s],i===o[++s]&&i===o[++s]&&i===o[++s])){r=t.strstart+ct;do;while(i===o[++s]&&i===o[++s]&&i===o[++s]&&i===o[++s]&&i===o[++s]&&i===o[++s]&&i===o[++s]&&i===o[++s]&&st.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=ut?(n=C._tr_tally(t,1,t.match_length-ut),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(n=C._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),n&&(a(t,!1),0===t.strm.avail_out))return vt}return t.insert=0,e===B?(a(t,!0),0===t.strm.avail_out?yt:At):t.last_lit&&(a(t,!1),0===t.strm.avail_out)?vt:bt}function _(t,e){for(var n;;){if(0===t.lookahead&&(d(t),0===t.lookahead)){if(e===P)return vt;break}if(t.match_length=0,n=C._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,n&&(a(t,!1),0===t.strm.avail_out))return vt}return t.insert=0,e===B?(a(t,!0),0===t.strm.avail_out?yt:At):t.last_lit&&(a(t,!1),0===t.strm.avail_out)?vt:bt}function E(t,e,n,i,s){this.good_length=t,this.max_lazy=e,this.nice_length=n,this.max_chain=i,this.func=s}function w(t){t.window_size=2*t.w_size,r(t.head),t.max_lazy_match=S[t.level].max_lazy,t.good_match=S[t.level].good_length,t.nice_match=S[t.level].nice_length,t.max_chain_length=S[t.level].max_chain,t.strstart=0,t.block_start=0,t.lookahead=0,t.insert=0,t.match_length=t.prev_length=ut-1,t.match_available=0,t.ins_h=0}function v(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=X,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new I.Buf16(2*at),this.dyn_dtree=new I.Buf16(2*(2*rt+1)),this.bl_tree=new I.Buf16(2*(2*ot+1)),r(this.dyn_ltree),r(this.dyn_dtree),r(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new I.Buf16(ht+1),this.heap=new I.Buf16(2*st+1),r(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new I.Buf16(2*st+1),r(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function b(t){var e;return t&&t.state?(t.total_in=t.total_out=0,t.data_type=J,e=t.state,e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap?ft:Et,t.adler=2===e.wrap?0:1,e.last_flush=P,C._tr_init(e),j):i(t,z)}function y(t){var e=b(t);return e===j&&w(t.state),e}function A(t,e){return t&&t.state?2!==t.state.wrap?z:(t.state.gzhead=e,j):z}function k(t,e,n,s,r,o){if(!t)return z;var a=1;if(e===F&&(e=6),s<0?(a=0,s=-s):s>15&&(a=2,s-=16),r<1||r>Q||n!==X||s<8||s>15||e<0||e>9||o<0||o>Z)return i(t,z);8===s&&(s=9);var h=new v;return t.state=h,h.strm=t,h.wrap=a,h.gzhead=null,h.w_bits=s,h.w_size=1<G||e<0)return t?i(t,z):z;if(a=t.state,!t.output||!t.input&&0!==t.avail_in||a.status===wt&&e!==B)return i(t,0===t.avail_out?W:z);if(a.strm=t,n=a.last_flush,a.last_flush=e,a.status===ft)if(2===a.wrap)t.adler=0,h(a,31),h(a,139),h(a,8),a.gzhead?(h(a,(a.gzhead.text?1:0)+(a.gzhead.hcrc?2:0)+(a.gzhead.extra?4:0)+(a.gzhead.name?8:0)+(a.gzhead.comment?16:0)),h(a,255&a.gzhead.time),h(a,a.gzhead.time>>8&255),h(a,a.gzhead.time>>16&255),h(a,a.gzhead.time>>24&255),h(a,9===a.level?2:a.strategy>=V||a.level<2?4:0),h(a,255&a.gzhead.os),a.gzhead.extra&&a.gzhead.extra.length&&(h(a,255&a.gzhead.extra.length),h(a,a.gzhead.extra.length>>8&255)),a.gzhead.hcrc&&(t.adler=L(t.adler,a.pending_buf,a.pending,0)),a.gzindex=0,a.status=pt):(h(a,0),h(a,0),h(a,0),h(a,0),h(a,0),h(a,9===a.level?2:a.strategy>=V||a.level<2?4:0),h(a,kt),a.status=Et);else{var d=X+(a.w_bits-8<<4)<<8,f=-1;f=a.strategy>=V||a.level<2?0:a.level<6?1:6===a.level?2:3,d|=f<<6,0!==a.strstart&&(d|=dt),d+=31-d%31,a.status=Et,u(a,d),0!==a.strstart&&(u(a,t.adler>>>16),u(a,65535&t.adler)),t.adler=1}if(a.status===pt)if(a.gzhead.extra){for(c=a.pending;a.gzindex<(65535&a.gzhead.extra.length)&&(a.pending!==a.pending_buf_size||(a.gzhead.hcrc&&a.pending>c&&(t.adler=L(t.adler,a.pending_buf,a.pending-c,c)),o(t),c=a.pending,a.pending!==a.pending_buf_size));)h(a,255&a.gzhead.extra[a.gzindex]),a.gzindex++;a.gzhead.hcrc&&a.pending>c&&(t.adler=L(t.adler,a.pending_buf,a.pending-c,c)),a.gzindex===a.gzhead.extra.length&&(a.gzindex=0,a.status=mt)}else a.status=mt;if(a.status===mt)if(a.gzhead.name){c=a.pending;do{if(a.pending===a.pending_buf_size&&(a.gzhead.hcrc&&a.pending>c&&(t.adler=L(t.adler,a.pending_buf,a.pending-c,c)),o(t),c=a.pending,a.pending===a.pending_buf_size)){l=1;break}l=a.gzindexc&&(t.adler=L(t.adler,a.pending_buf,a.pending-c,c)),0===l&&(a.gzindex=0,a.status=gt)}else a.status=gt;if(a.status===gt)if(a.gzhead.comment){c=a.pending;do{if(a.pending===a.pending_buf_size&&(a.gzhead.hcrc&&a.pending>c&&(t.adler=L(t.adler,a.pending_buf,a.pending-c,c)),o(t),c=a.pending,a.pending===a.pending_buf_size)){l=1;break}l=a.gzindexc&&(t.adler=L(t.adler,a.pending_buf,a.pending-c,c)),0===l&&(a.status=_t)}else a.status=_t;if(a.status===_t&&(a.gzhead.hcrc?(a.pending+2>a.pending_buf_size&&o(t),a.pending+2<=a.pending_buf_size&&(h(a,255&t.adler),h(a,t.adler>>8&255),t.adler=0,a.status=Et)):a.status=Et),0!==a.pending){if(o(t),0===t.avail_out)return a.last_flush=-1,j}else if(0===t.avail_in&&s(e)<=s(n)&&e!==B)return i(t,W);if(a.status===wt&&0!==t.avail_in)return i(t,W);if(0!==t.avail_in||0!==a.lookahead||e!==P&&a.status!==wt){var p=a.strategy===V?_(a,e):a.strategy===K?g(a,e):S[a.level].func(a,e);if(p!==yt&&p!==At||(a.status=wt),p===vt||p===yt)return 0===t.avail_out&&(a.last_flush=-1),j;if(p===bt&&(e===N?C._tr_align(a):e!==G&&(C._tr_stored_block(a,0,0,!1),e===O&&(r(a.head),0===a.lookahead&&(a.strstart=0,a.block_start=0,a.insert=0))),o(t),0===t.avail_out))return a.last_flush=-1,j}return e!==B?j:a.wrap<=0?q:(2===a.wrap?(h(a,255&t.adler),h(a,t.adler>>8&255),h(a,t.adler>>16&255),h(a,t.adler>>24&255),h(a,255&t.total_in),h(a,t.total_in>>8&255),h(a,t.total_in>>16&255),h(a,t.total_in>>24&255)):(u(a,t.adler>>>16),u(a,65535&t.adler)),o(t),a.wrap>0&&(a.wrap=-a.wrap),0!==a.pending?j:q)}function D(t){var e;return t&&t.state?(e=t.state.status,e!==ft&&e!==pt&&e!==mt&&e!==gt&&e!==_t&&e!==Et&&e!==wt?i(t,z):(t.state=null,e===Et?i(t,H):j)):z}function M(t,e){var n,i,s,o,a,h,u,c,l=e.length;if(!t||!t.state)return z;if(n=t.state,o=n.wrap,2===o||1===o&&n.status!==ft||n.lookahead)return z;for(1===o&&(t.adler=x(t.adler,e,l,0)),n.wrap=0,l>=n.w_size&&(0===o&&(r(n.head),n.strstart=0,n.block_start=0,n.insert=0),c=new I.Buf8(n.w_size),I.arraySet(c,e,l-n.w_size,n.w_size,0),e=c,l=n.w_size),a=t.avail_in,h=t.next_in,u=t.input,t.avail_in=l,t.next_in=0,t.input=e,d(n);n.lookahead>=ut;){i=n.strstart,s=n.lookahead-(ut-1);do n.ins_h=(n.ins_h<>>24,m>>>=y,g-=y,y=b>>>16&255,0===y)M[a++]=65535&b;else{if(!(16&y)){if(0===(64&y)){b=_[(65535&b)+(m&(1<>>=y,g-=y),g<15&&(m+=D[r++]<>>24,m>>>=y,g-=y,y=b>>>16&255,!(16&y)){if(0===(64&y)){b=E[(65535&b)+(m&(1<c){t.msg="invalid distance too far back",n.mode=i;break t}if(m>>>=y,g-=y,y=a-h,k>y){if(y=k-y,y>d&&n.sane){t.msg="invalid distance too far back",n.mode=i;break t}if(R=0,T=p,0===f){if(R+=l-y,y2;)M[a++]=T[R++],M[a++]=T[R++],M[a++]=T[R++],A-=3;A&&(M[a++]=T[R++],A>1&&(M[a++]=T[R++]))}else{R=a-k;do M[a++]=M[R++],M[a++]=M[R++],M[a++]=M[R++],A-=3;while(A>2);A&&(M[a++]=M[R++],A>1&&(M[a++]=M[R++]))}break}}break}}while(r>3,r-=A,g-=A<<3,m&=(1<>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24)}function s(){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 E.Buf16(320),this.work=new E.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function r(t){var e;return t&&t.state?(e=t.state,t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=1&e.wrap),e.mode=O,e.last=0,e.havedict=0,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new E.Buf32(mt),e.distcode=e.distdyn=new E.Buf32(gt),e.sane=1,e.back=-1,S):x}function o(t){var e;return t&&t.state?(e=t.state,e.wsize=0,e.whave=0,e.wnext=0,r(t)):x}function a(t,e){var n,i;return t&&t.state?(i=t.state,e<0?(n=0,e=-e):(n=(e>>4)+1,e<48&&(e&=15)),e&&(e<8||e>15)?x:(null!==i.window&&i.wbits!==e&&(i.window=null),i.wrap=n,i.wbits=e,o(t))):x}function h(t,e){var n,i;return t?(i=new s,t.state=i,i.window=null,n=a(t,e),n!==S&&(t.state=null),n):x}function u(t){return h(t,Et)}function c(t){if(wt){var e;for(g=new E.Buf32(512),_=new E.Buf32(32),e=0;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(y(k,t.lens,0,288,g,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;y(R,t.lens,0,32,_,0,t.work,{bits:5}),wt=!1}t.lencode=g,t.lenbits=9,t.distcode=_,t.distbits=5}function l(t,e,n,i){var s,r=t.state;return null===r.window&&(r.wsize=1<=r.wsize?(E.arraySet(r.window,e,n-r.wsize,r.wsize,0),r.wnext=0,r.whave=r.wsize):(s=r.wsize-r.wnext,s>i&&(s=i),E.arraySet(r.window,e,n-i,s,r.wnext),i-=s,i?(E.arraySet(r.window,e,n-i,i,0),r.wnext=i,r.whave=r.wsize):(r.wnext+=s,r.wnext===r.wsize&&(r.wnext=0),r.whave>>8&255,n.check=v(n.check,Dt,2,0),d=0,f=0,n.mode=B;break}if(n.flags=0,n.head&&(n.head.done=!1),!(1&n.wrap)||(((255&d)<<8)+(d>>8))%31){t.msg="incorrect header check",n.mode=dt;break}if((15&d)!==N){t.msg="unknown compression method",n.mode=dt;break}if(d>>>=4,f-=4,yt=(15&d)+8,0===n.wbits)n.wbits=yt;else if(yt>n.wbits){t.msg="invalid window size",n.mode=dt;break}n.dmax=1<>8&1),512&n.flags&&(Dt[0]=255&d,Dt[1]=d>>>8&255,n.check=v(n.check,Dt,2,0)),d=0,f=0,n.mode=G;case G:for(;f<32;){if(0===h)break t;h--,d+=s[o++]<>>8&255,Dt[2]=d>>>16&255,Dt[3]=d>>>24&255,n.check=v(n.check,Dt,4,0)),d=0,f=0,n.mode=j;case j:for(;f<16;){if(0===h)break t;h--,d+=s[o++]<>8),512&n.flags&&(Dt[0]=255&d,Dt[1]=d>>>8&255,n.check=v(n.check,Dt,2,0)),d=0,f=0,n.mode=q;case q:if(1024&n.flags){for(;f<16;){if(0===h)break t;h--,d+=s[o++]<>>8&255,n.check=v(n.check,Dt,2,0)),d=0,f=0}else n.head&&(n.head.extra=null);n.mode=z;case z:if(1024&n.flags&&(g=n.length,g>h&&(g=h),g&&(n.head&&(yt=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Array(n.head.extra_len)),E.arraySet(n.head.extra,s,o,g,yt)),512&n.flags&&(n.check=v(n.check,s,g,o)),h-=g,o+=g,n.length-=g),n.length))break t;n.length=0,n.mode=H;case H:if(2048&n.flags){if(0===h)break t;g=0;do yt=s[o+g++],n.head&&yt&&n.length<65536&&(n.head.name+=String.fromCharCode(yt));while(yt&&g>9&1,n.head.done=!0),t.adler=n.check=0,n.mode=K;break;case Y:for(;f<32;){if(0===h)break t;h--,d+=s[o++]<>>=7&f,f-=7&f,n.mode=ut;break}for(;f<3;){if(0===h)break t;h--,d+=s[o++]<>>=1,f-=1,3&d){case 0:n.mode=$;break;case 1:if(c(n),n.mode=nt,e===M){d>>>=2,f-=2;break t}break;case 2:n.mode=Q;break;case 3:t.msg="invalid block type",n.mode=dt}d>>>=2,f-=2;break;case $:for(d>>>=7&f,f-=7&f;f<32;){if(0===h)break t;h--,d+=s[o++]<>>16^65535)){t.msg="invalid stored block lengths",n.mode=dt;break}if(n.length=65535&d,d=0,f=0,n.mode=J,e===M)break t;case J:n.mode=X;case X:if(g=n.length){if(g>h&&(g=h),g>u&&(g=u),0===g)break t;E.arraySet(r,s,o,g,a),h-=g,o+=g,u-=g,a+=g,n.length-=g;break}n.mode=K;break;case Q:for(;f<14;){if(0===h)break t;h--,d+=s[o++]<>>=5,f-=5,n.ndist=(31&d)+1,d>>>=5,f-=5,n.ncode=(15&d)+4,d>>>=4,f-=4,n.nlen>286||n.ndist>30){t.msg="too many length or distance symbols",n.mode=dt;break}n.have=0,n.mode=tt;case tt:for(;n.have>>=3,f-=3}for(;n.have<19;)n.lens[Mt[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,kt={bits:n.lenbits},At=y(A,n.lens,0,19,n.lencode,0,n.work,kt),n.lenbits=kt.bits,At){t.msg="invalid code lengths set",n.mode=dt;break}n.have=0,n.mode=et;case et:for(;n.have>>24,_t=Tt>>>16&255,Et=65535&Tt,!(gt<=f);){if(0===h)break t;h--,d+=s[o++]<>>=gt,f-=gt,n.lens[n.have++]=Et;else{if(16===Et){for(Rt=gt+2;f>>=gt,f-=gt,0===n.have){t.msg="invalid bit length repeat",n.mode=dt;break}yt=n.lens[n.have-1],g=3+(3&d),d>>>=2,f-=2}else if(17===Et){for(Rt=gt+3;f>>=gt,f-=gt,yt=0,g=3+(7&d),d>>>=3,f-=3}else{for(Rt=gt+7;f>>=gt,f-=gt,yt=0,g=11+(127&d),d>>>=7,f-=7}if(n.have+g>n.nlen+n.ndist){t.msg="invalid bit length repeat",n.mode=dt;break}for(;g--;)n.lens[n.have++]=yt}}if(n.mode===dt)break;if(0===n.lens[256]){t.msg="invalid code -- missing end-of-block",n.mode=dt;break}if(n.lenbits=9,kt={bits:n.lenbits},At=y(k,n.lens,0,n.nlen,n.lencode,0,n.work,kt),n.lenbits=kt.bits,At){t.msg="invalid literal/lengths set",n.mode=dt;break}if(n.distbits=6,n.distcode=n.distdyn,kt={bits:n.distbits},At=y(R,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,kt),n.distbits=kt.bits,At){t.msg="invalid distances set",n.mode=dt;break}if(n.mode=nt,e===M)break t;case nt:n.mode=it;case it:if(h>=6&&u>=258){t.next_out=a,t.avail_out=u,t.next_in=o,t.avail_in=h,n.hold=d,n.bits=f,b(t,m),a=t.next_out,r=t.output,u=t.avail_out,o=t.next_in,s=t.input,h=t.avail_in,d=n.hold,f=n.bits,n.mode===K&&(n.back=-1);break}for(n.back=0;Tt=n.lencode[d&(1<>>24,_t=Tt>>>16&255,Et=65535&Tt,!(gt<=f);){if(0===h)break t;h--,d+=s[o++]<>wt)],gt=Tt>>>24,_t=Tt>>>16&255,Et=65535&Tt,!(wt+gt<=f);){if(0===h)break t;h--,d+=s[o++]<>>=wt,f-=wt,n.back+=wt}if(d>>>=gt,f-=gt,n.back+=gt,n.length=Et,0===_t){n.mode=ht;break}if(32&_t){n.back=-1,n.mode=K;break}if(64&_t){t.msg="invalid literal/length code",n.mode=dt;break}n.extra=15&_t,n.mode=st;case st:if(n.extra){for(Rt=n.extra;f>>=n.extra,f-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=rt;case rt:for(;Tt=n.distcode[d&(1<>>24,_t=Tt>>>16&255,Et=65535&Tt,!(gt<=f);){if(0===h)break t;h--,d+=s[o++]<>wt)],gt=Tt>>>24,_t=Tt>>>16&255,Et=65535&Tt,!(wt+gt<=f);){if(0===h)break t;h--,d+=s[o++]<>>=wt,f-=wt,n.back+=wt}if(d>>>=gt,f-=gt,n.back+=gt,64&_t){t.msg="invalid distance code",n.mode=dt;break}n.offset=Et,n.extra=15&_t,n.mode=ot;case ot:if(n.extra){for(Rt=n.extra;f>>=n.extra,f-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){t.msg="invalid distance too far back",n.mode=dt;break}n.mode=at;case at:if(0===u)break t;if(g=m-u,n.offset>g){if(g=n.offset-g,g>n.whave&&n.sane){t.msg="invalid distance too far back",n.mode=dt;break}g>n.wnext?(g-=n.wnext,_=n.wsize-g):_=n.wnext-g,g>n.length&&(g=n.length),mt=n.window}else mt=r,_=a-n.offset,g=n.length;g>u&&(g=u),u-=g,n.length-=g;do r[a++]=mt[_++];while(--g);0===n.length&&(n.mode=it);break;case ht:if(0===u)break t;r[a++]=n.length,u--,n.mode=it;break;case ut:if(n.wrap){for(;f<32;){if(0===h)break t;h--,d|=s[o++]<=1&&0===q[x];x--);if(L>x&&(L=x),0===x)return m[g++]=20971520,m[g++]=20971520,E.bits=1,0;for(C=1;C0&&(t===a||1!==x))return-1;for(z[1]=0,S=1;Sr||t===u&&O>o)return 1;for(;;){R=S-P,_[I]k?(T=H[W+_[I]],D=G[j+_[I]]):(T=96,D=0),w=1<>P)+v]=R<<24|T<<16|D|0;while(0!==v);for(w=1<>=1;if(0!==w?(B&=w-1,B+=w):B=0,I++,0===--q[S]){if(S===x)break;S=e[n+_[I]]}if(S>L&&(B&y)!==b){for(0===P&&(P=L),A+=C,U=S-P,N=1<r||t===u&&O>o)return 1;b=B&y,m[b]=L<<24|U<<16|A-g|0}}return 0!==B&&(m[A+B]=S-P<<24|64<<16|0),E.bits=L,0}},function(t,e,n){"use strict";function i(t){for(var e=t.length;--e>=0;)t[e]=0}function s(t,e,n,i,s){this.static_tree=t,this.extra_bits=e,this.extra_base=n,this.elems=i,this.max_length=s,this.has_stree=t&&t.length}function r(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}function o(t){return t<256?ht[t]:ht[256+(t>>>7)]}function a(t,e){t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255}function h(t,e,n){t.bi_valid>Z-n?(t.bi_buf|=e<>Z-t.bi_valid,t.bi_valid+=n-Z):(t.bi_buf|=e<>>=1,n<<=1;while(--e>0);return n>>>1}function l(t){16===t.bi_valid?(a(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8)}function d(t,e){var n,i,s,r,o,a,h=e.dyn_tree,u=e.max_code,c=e.stat_desc.static_tree,l=e.stat_desc.has_stree,d=e.stat_desc.extra_bits,f=e.stat_desc.extra_base,p=e.stat_desc.max_length,m=0;for(r=0;r<=K;r++)t.bl_count[r]=0;for(h[2*t.heap[t.heap_max]+1]=0,n=t.heap_max+1;np&&(r=p,m++),h[2*i+1]=r,i>u||(t.bl_count[r]++,o=0,i>=f&&(o=d[i-f]),a=h[2*i],t.opt_len+=a*(r+o),l&&(t.static_len+=a*(c[2*i+1]+o)));if(0!==m){do{for(r=p-1;0===t.bl_count[r];)r--;t.bl_count[r]--,t.bl_count[r+1]+=2,t.bl_count[p]--,m-=2}while(m>0);for(r=p;0!==r;r--)for(i=t.bl_count[r];0!==i;)s=t.heap[--n],s>u||(h[2*s+1]!==r&&(t.opt_len+=(r-h[2*s+1])*h[2*s],h[2*s+1]=r),i--)}}function f(t,e,n){var i,s,r=new Array(K+1),o=0;for(i=1;i<=K;i++)r[i]=o=o+n[i-1]<<1;for(s=0;s<=e;s++){var a=t[2*s+1];0!==a&&(t[2*s]=c(r[a]++,a))}}function p(){var t,e,n,i,r,o=new Array(K+1);for(n=0,i=0;i>=7;i8?a(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0}function _(t,e,n,i){g(t),i&&(a(t,n),a(t,~n)),x.arraySet(t.pending_buf,t.window,e,n,t.pending),t.pending+=n}function E(t,e,n,i){var s=2*e,r=2*n;return t[s]>1;n>=1;n--)w(t,r,n);s=h;do n=t.heap[1],t.heap[1]=t.heap[t.heap_len--],w(t,r,1),i=t.heap[1],t.heap[--t.heap_max]=n,t.heap[--t.heap_max]=i,r[2*s]=r[2*n]+r[2*i],t.depth[s]=(t.depth[n]>=t.depth[i]?t.depth[n]:t.depth[i])+1,r[2*n+1]=r[2*i+1]=s,t.heap[1]=s++,w(t,r,1);while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],d(t,e),f(r,u,t.bl_count)}function y(t,e,n){var i,s,r=-1,o=e[1],a=0,h=7,u=4;for(0===o&&(h=138,u=3),e[2*(n+1)+1]=65535,i=0;i<=n;i++)s=o,o=e[2*(i+1)+1],++a=3&&0===t.bl_tree[2*st[e]+1];e--);return t.opt_len+=3*(e+1)+5+5+4,e}function R(t,e,n,i){var s;for(h(t,e-257,5),h(t,n-1,5),h(t,i-4,4),s=0;s>>=1)if(1&n&&0!==t.dyn_ltree[2*e])return U;if(0!==t.dyn_ltree[18]||0!==t.dyn_ltree[20]||0!==t.dyn_ltree[26])return P;for(e=32;e0?(t.strm.data_type===N&&(t.strm.data_type=T(t)),b(t,t.l_desc),b(t,t.d_desc),o=k(t),s=t.opt_len+3+7>>>3,r=t.static_len+3+7>>>3,r<=s&&(s=r)):s=r=n+5,n+4<=s&&e!==-1?M(t,e,n,i):t.strategy===L||r===s?(h(t,(B<<1)+(i?1:0),3),v(t,ot,at)):(h(t,(G<<1)+(i?1:0),3),R(t,t.l_desc.max_code+1,t.d_desc.max_code+1,o+1),v(t,t.dyn_ltree,t.dyn_dtree)),m(t),i&&g(t)}function C(t,e,n){return t.pending_buf[t.d_buf+2*t.last_lit]=e>>>8&255,t.pending_buf[t.d_buf+2*t.last_lit+1]=255&e,t.pending_buf[t.l_buf+t.last_lit]=255&n,t.last_lit++,0===e?t.dyn_ltree[2*n]++:(t.matches++,e--,t.dyn_ltree[2*(ut[n]+H+1)]++,t.dyn_dtree[2*o(e)]++),t.last_lit===t.lit_bufsize-1}var x=n(5),L=4,U=0,P=1,N=2,O=0,B=1,G=2,j=3,q=258,z=29,H=256,W=H+1+z,F=30,Y=19,V=2*W+1,K=15,Z=16,$=7,J=256,X=16,Q=17,tt=18,et=[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],nt=[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],it=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],st=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],rt=512,ot=new Array(2*(W+2));i(ot);var at=new Array(2*F);i(at);var ht=new Array(rt);i(ht);var ut=new Array(q-j+1);i(ut);var ct=new Array(z);i(ct);var lt=new Array(F);i(lt);var dt,ft,pt,mt=!1;e._tr_init=D,e._tr_stored_block=M,e._tr_flush_block=I,e._tr_tally=C,e._tr_align=S},function(t,e,n){function i(t){var e=s(t)?Object.prototype.toString.call(t):"";return"[object Function]"===e}var s=n(26);t.exports=i},function(t,e,n){function i(t){if(t)return s(t)}function s(t){for(var e in i.prototype)t[e]=i.prototype[e];return t}var r=n(26);t.exports=i,i.prototype.clearTimeout=function(){return this._timeout=0,this._responseTimeout=0,clearTimeout(this._timer),clearTimeout(this._responseTimeoutTimer),this},i.prototype.parse=function(t){return this._parser=t,this},i.prototype.responseType=function(t){return this._responseType=t,this},i.prototype.serialize=function(t){return this._serializer=t,this},i.prototype.timeout=function(t){return t&&"object"==typeof t?("undefined"!=typeof t.deadline&&(this._timeout=t.deadline),"undefined"!=typeof t.response&&(this._responseTimeout=t.response),this):(this._timeout=t,this._responseTimeout=0,this)},i.prototype.then=function(t,e){if(!this._fullfilledPromise){var n=this;this._endCalled&&console.warn("Warning: superagent request was sent twice, because both .end() and .then() were called. Never call .end() if you use promises"),this._fullfilledPromise=new Promise(function(t,e){n.end(function(n,i){n?e(n):t(i)})})}return this._fullfilledPromise.then(t,e)},i.prototype.catch=function(t){return this.then(void 0,t)},i.prototype.use=function(t){return t(this),this},i.prototype.ok=function(t){if("function"!=typeof t)throw Error("Callback required");return this._okCallback=t,this},i.prototype._isResponseOK=function(t){return!!t&&(this._okCallback?this._okCallback(t):t.status>=200&&t.status<300)},i.prototype.get=function(t){return this._header[t.toLowerCase()]},i.prototype.getHeader=i.prototype.get,i.prototype.set=function(t,e){if(r(t)){for(var n in t)this.set(n,t[n]);return this}return this._header[t.toLowerCase()]=e,this.header[t]=e,this},i.prototype.unset=function(t){return delete this._header[t.toLowerCase()],delete this.header[t],this},i.prototype.field=function(t,e){if(null===t||void 0===t)throw new Error(".field(name, val) name can not be empty");if(r(t)){for(var n in t)this.field(n,t[n]);return this}if(Array.isArray(e)){for(var i in e)this.field(t,e[i]);return this}if(null===e||void 0===e)throw new Error(".field(name, val) val can not be empty");return"boolean"==typeof e&&(e=""+e),this._getFormData().append(t,e),this},i.prototype.abort=function(){return this._aborted?this:(this._aborted=!0,this.xhr&&this.xhr.abort(),this.req&&this.req.abort(),this.clearTimeout(),this.emit("abort"),this)},i.prototype.withCredentials=function(){return this._withCredentials=!0,this},i.prototype.redirects=function(t){return this._maxRedirects=t,this},i.prototype.toJSON=function(){return{method:this.method,url:this.url,data:this._data,headers:this._header}},i.prototype.send=function(t){var e=r(t),n=this._header["content-type"];if(e&&!this._data)Array.isArray(t)?this._data=[]:this._isHost(t)||(this._data={});else if(t&&this._data&&this._isHost(this._data))throw Error("Can't merge these send calls");if(e&&r(this._data))for(var i in t)this._data[i]=t[i];else"string"==typeof t?(n||this.type("form"),n=this._header["content-type"],"application/x-www-form-urlencoded"==n?this._data=this._data?this._data+"&"+t:t:this._data=(this._data||"")+t):this._data=t;return!e||this._isHost(t)?this:(n||this.type("json"),this)},i.prototype.sortQuery=function(t){return this._sort="undefined"==typeof t||t,this},i.prototype._timeoutError=function(t,e){if(!this._aborted){var n=new Error(t+e+"ms exceeded");n.timeout=e,n.code="ECONNABORTED",this.timedout=!0,this.abort(),this.callback(n)}},i.prototype._setTimeouts=function(){var t=this;this._timeout&&!this._timer&&(this._timer=setTimeout(function(){t._timeoutError("Timeout of ",t._timeout)},this._timeout)),this._responseTimeout&&!this._responseTimeoutTimer&&(this._responseTimeoutTimer=setTimeout(function(){t._timeoutError("Response timeout of ",t._responseTimeout)},this._responseTimeout))}},function(t,e,n){function i(t){if(t)return s(t)}function s(t){for(var e in i.prototype)t[e]=i.prototype[e];return t}var r=n(79);t.exports=i,i.prototype.get=function(t){return this.header[t.toLowerCase()]},i.prototype._setHeaderProperties=function(t){var e=t["content-type"]||"";this.type=r.type(e);var n=r.params(e);for(var i in n)this[i]=n[i];this.links={};try{t.link&&(this.links=r.parseLinks(t.link))}catch(t){}},i.prototype._setStatusProperties=function(t){var e=t/100|0;this.status=this.statusCode=t,this.statusType=e,this.info=1==e,this.ok=2==e,this.redirect=3==e,this.clientError=4==e,this.serverError=5==e,this.error=(4==e||5==e)&&this.toError(),this.accepted=202==t,this.noContent=204==t,this.badRequest=400==t,this.unauthorized=401==t,this.notAcceptable=406==t,this.forbidden=403==t,this.notFound=404==t}},function(t,e){e.type=function(t){return t.split(/ *; */).shift()},e.params=function(t){return t.split(/ *; */).reduce(function(t,e){var n=e.split(/ *= */),i=n.shift(),s=n.shift();return i&&s&&(t[i]=s),t},{})},e.parseLinks=function(t){return t.split(/ *, */).reduce(function(t,e){var n=e.split(/ *; */),i=n[0].slice(1,-1),s=n[1].split(/ *= */)[1].slice(1,-1);return t[s]=i,t},{})},e.cleanHeader=function(t,e){return delete t["content-type"],delete t["content-length"],delete t["transfer-encoding"],delete t.host,e&&delete t.cookie,t}},function(t,e){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e,n){const i=n(0),s=n(4),r=n(17),o=n(6),a=n(30),h=n(10),u=n(42),c=n(43),l=n(13),d=n(31);class f{constructor(t){this.client=t}get pastReady(){return this.client.ws.status===i.Status.READY}newGuild(t){const e=this.client.guilds.has(t.id),n=new r(this.client,t);return this.client.guilds.set(n.id,n),this.pastReady&&!e&&(this.client.options.fetchAllMembers?n.fetchMembers().then(()=>{this.client.emit(i.Events.GUILD_CREATE,n)}):this.client.emit(i.Events.GUILD_CREATE,n)),n}newUser(t){if(this.client.users.has(t.id))return this.client.users.get(t.id);const e=new o(this.client,t);return this.client.users.set(e.id,e),e}newChannel(t,e){const n=this.client.channels.has(t.id);let s;return t.type===i.ChannelTypes.DM?s=new a(this.client,t):t.type===i.ChannelTypes.groupDM?s=new d(this.client,t):(e=e||this.client.guilds.get(t.guild_id),e&&(t.type===i.ChannelTypes.text?(s=new u(e,t),e.channels.set(s.id,s)):t.type===i.ChannelTypes.voice&&(s=new c(e,t),e.channels.set(s.id,s)))),s?(this.pastReady&&!n&&this.client.emit(i.Events.CHANNEL_CREATE,s),this.client.channels.set(s.id,s),s):null}newEmoji(t,e){const n=e.emojis.has(t.id);if(t&&!n){let n=new h(e,t);return this.client.emit(i.Events.GUILD_EMOJI_CREATE,n),e.emojis.set(n.id,n),n}return n?e.emojis.get(t.id):null}killEmoji(t){t instanceof h&&t.guild&&(this.client.emit(i.Events.GUILD_EMOJI_DELETE,t),t.guild.emojis.delete(t.id))}killGuild(t){const e=this.client.guilds.has(t.id);this.client.guilds.delete(t.id),e&&this.pastReady&&this.client.emit(i.Events.GUILD_DELETE,t)}killUser(t){this.client.users.delete(t.id)}killChannel(t){this.client.channels.delete(t.id),t instanceof l&&t.guild.channels.delete(t.id)}updateGuild(t,e){const n=s(t);t.setup(e),this.pastReady&&this.client.emit(i.Events.GUILD_UPDATE,n,t)}updateChannel(t,e){t.setup(e)}updateEmoji(t,e){const n=s(t);t.setup(e),this.client.emit(i.Events.GUILD_EMOJI_UPDATE,n,t)}}t.exports=f},function(t,e,n){const i=n(0);class s{constructor(t){this.client=t,this.heartbeatInterval=null}connectToWebSocket(t,e,n){this.client.emit(i.Events.DEBUG,`Authenticated using token ${t}`),this.client.token=t;const s=this.client.setTimeout(()=>n(new Error(i.Errors.TOOK_TOO_LONG)),3e5);this.client.rest.methods.getGateway().then(r=>{this.client.emit(i.Events.DEBUG,`Using gateway ${r}`),this.client.ws.connect(r),this.client.ws.once("close",t=>{4004===t.code&&n(new Error(i.Errors.BAD_LOGIN)),4010===t.code&&n(new Error(i.Errors.INVALID_SHARD))}),this.client.once(i.Events.READY,()=>{e(t),this.client.clearTimeout(s)})},n)}setupKeepAlive(t){this.heartbeatInterval=this.client.setInterval(()=>this.client.ws.heartbeat(!0),t)}destroy(){return this.client.ws.destroy(),this.client.user.bot?(this.client.token=null,Promise.resolve()):this.client.rest.methods.logout().then(()=>{this.client.token=null})}}t.exports=s},function(t,e,n){class i{constructor(t){this.client=t,this.register(n(100)),this.register(n(101)),this.register(n(102)),this.register(n(106)),this.register(n(103)),this.register(n(104)),this.register(n(105)),this.register(n(84)),this.register(n(85)),this.register(n(86)),this.register(n(88)),this.register(n(99)),this.register(n(92)),this.register(n(93)),this.register(n(87)),this.register(n(94)),this.register(n(95)),this.register(n(96)),this.register(n(107)),this.register(n(109)),this.register(n(108)),this.register(n(98)),this.register(n(89)),this.register(n(90)),this.register(n(91)),this.register(n(97))}register(t){this[t.name.replace(/Action$/,"")]=new t(this.client)}}t.exports=i},function(t,e,n){const i=n(2);class s extends i{handle(t){const e=this.client,n=e.dataManager.newChannel(t);return{channel:n}}}t.exports=s},function(t,e,n){const i=n(2);class s extends i{constructor(t){super(t),this.deleted=new Map}handle(t){const e=this.client;let n=e.channels.get(t.id);return n?(e.dataManager.killChannel(n),this.deleted.set(n.id,n),this.scheduleForDeletion(n.id)):n=this.deleted.get(t.id)||null,{channel:n}}scheduleForDeletion(t){this.client.setTimeout(()=>this.deleted.delete(t),this.client.options.restWsBridgeTimeout)}}t.exports=s},function(t,e,n){const i=n(2),s=n(0),r=n(4);class o extends i{handle(t){const e=this.client,n=e.channels.get(t.id);if(n){const i=r(n);return n.setup(t),e.emit(s.Events.CHANNEL_UPDATE,i,n),{old:i,updated:n}}return{old:null,updated:null}}}t.exports=o},function(t,e,n){const i=n(2),s=n(0);class r extends i{handle(t){const e=this.client,n=e.guilds.get(t.guild_id),i=e.dataManager.newUser(t.user);n&&i&&e.emit(s.Events.GUILD_BAN_REMOVE,n,i)}}t.exports=r},function(t,e,n){const i=n(2),s=n(0);class r extends i{constructor(t){super(t),this.deleted=new Map}handle(t){const e=this.client;let n=e.guilds.get(t.id);if(n){if(n.available&&t.unavailable)return n.available=!1,e.emit(s.Events.GUILD_UNAVAILABLE,n),{guild:null};e.guilds.delete(n.id),this.deleted.set(n.id,n),this.scheduleForDeletion(n.id)}else n=this.deleted.get(t.id)||null;return{guild:n}}scheduleForDeletion(t){this.client.setTimeout(()=>this.deleted.delete(t),this.client.options.restWsBridgeTimeout)}}t.exports=r},function(t,e,n){const i=n(2);class s extends i{handle(t,e){const n=this.client,i=n.dataManager.newEmoji(e,t);return{emoji:i}}}t.exports=s},function(t,e,n){const i=n(2);class s extends i{handle(t){const e=this.client;return e.dataManager.killEmoji(t),{emoji:t}}}t.exports=s},function(t,e,n){const i=n(2);class s extends i{handle(t,e){this.client.dataManager.updateEmoji(t,e)}}t.exports=s},function(t,e,n){const i=n(2);class s extends i{handle(t,e){const n=t._addMember(e,!1);return{member:n}}}t.exports=s},function(t,e,n){const i=n(2),s=n(0);class r extends i{constructor(t){super(t),this.deleted=new Map}handle(t){const e=this.client,n=e.guilds.get(t.guild_id);if(n){let i=n.members.get(t.user.id);return i?(n.memberCount--,n._removeMember(i),this.deleted.set(n.id+t.user.id,i),e.status===s.Status.READY&&e.emit(s.Events.GUILD_MEMBER_REMOVE,i),this.scheduleForDeletion(n.id,t.user.id)):i=this.deleted.get(n.id+t.user.id)||null,{guild:n,member:i}}return{guild:n,member:null}}scheduleForDeletion(t,e){this.client.setTimeout(()=>this.deleted.delete(t+e),this.client.options.restWsBridgeTimeout)}}t.exports=r},function(t,e,n){const i=n(2),s=n(0),r=n(8);class o extends i{handle(t){const e=this.client,n=e.guilds.get(t.guild_id);if(n){const i=n.roles.has(t.role.id),o=new r(n,t.role);return n.roles.set(o.id,o),i||e.emit(s.Events.GUILD_ROLE_CREATE,o),{role:o}}return{role:null}}}t.exports=o},function(t,e,n){const i=n(2),s=n(0);class r extends i{constructor(t){super(t),this.deleted=new Map}handle(t){const e=this.client,n=e.guilds.get(t.guild_id);if(n){let i=n.roles.get(t.role_id);return i?(n.roles.delete(t.role_id),this.deleted.set(n.id+t.role_id,i),this.scheduleForDeletion(n.id,t.role_id),e.emit(s.Events.GUILD_ROLE_DELETE,i)):i=this.deleted.get(n.id+t.role_id)||null,{role:i}}return{role:null}}scheduleForDeletion(t,e){this.client.setTimeout(()=>this.deleted.delete(t+e),this.client.options.restWsBridgeTimeout)}}t.exports=r},function(t,e,n){const i=n(2),s=n(0),r=n(4);class o extends i{handle(t){const e=this.client,n=e.guilds.get(t.guild_id);if(n){const i=t.role;let o=null;const a=n.roles.get(i.id);return a&&(o=r(a),a.setup(t.role),e.emit(s.Events.GUILD_ROLE_UPDATE,o,a)),{old:o,updated:a}}return{old:null,updated:null}}}t.exports=o},function(t,e,n){const i=n(2);class s extends i{handle(t){const e=this.client,n=e.guilds.get(t.guild_id);if(n)for(const i of t.roles){const t=n.roles.get(i.id);t&&(t.position=i.position)}return{guild:n}}}t.exports=s},function(t,e,n){const i=n(2);class s extends i{handle(t){const e=this.client,n=e.guilds.get(t.id);if(n){t.presences=t.presences||[];for(const e of t.presences)n._setPresence(e.user.id,e);t.members=t.members||[];for(const i of t.members){const t=n.members.get(i.user.id);t?n._updateMember(t,i):n._addMember(i,!1)}}}}t.exports=s},function(t,e,n){const i=n(2),s=n(0),r=n(4);class o extends i{handle(t){const e=this.client,n=e.guilds.get(t.id);if(n){const i=r(n);return n.setup(t),e.emit(s.Events.GUILD_UPDATE,i,n),{old:i,updated:n}}return{old:null,updated:null}}}t.exports=o},function(t,e,n){const i=n(2),s=n(11);class r extends i{handle(t){const e=this.client,n=e.channels.get((t instanceof Array?t[0]:t).channel_id),i=e.users.get((t instanceof Array?t[0]:t).author.id);if(n){const r=n.guild?n.guild.member(i):null;if(t instanceof Array){const o=new Array(t.length);for(let a=0;athis.deleted.delete(t+e),this.client.options.restWsBridgeTimeout)}}t.exports=s},function(t,e,n){const i=n(2),s=n(3),r=n(0);class o extends i{handle(t){const e=this.client,n=e.channels.get(t.channel_id),i=t.ids,o=new s;for(const a of i){const t=n.messages.get(a);t&&o.set(t.id,t)}return o.size>0&&e.emit(r.Events.MESSAGE_BULK_DELETE,o),{messages:o}}}t.exports=o},function(t,e,n){const i=n(2),s=n(0);class r extends i{handle(t){const e=this.client.users.get(t.user_id);if(!e)return!1;const n=this.client.channels.get(t.channel_id);if(!n||"voice"===n.type)return!1;const i=n.messages.get(t.message_id);if(!i)return!1;if(!t.emoji)return!1;const r=i._addReaction(t.emoji,e);return r&&this.client.emit(s.Events.MESSAGE_REACTION_ADD,r,e),{message:i,reaction:r,user:e}}}t.exports=r},function(t,e,n){const i=n(2),s=n(0);class r extends i{handle(t){const e=this.client.users.get(t.user_id);if(!e)return!1;const n=this.client.channels.get(t.channel_id);if(!n||"voice"===n.type)return!1;const i=n.messages.get(t.message_id);if(!i)return!1;if(!t.emoji)return!1;const r=i._removeReaction(t.emoji,e);return r&&this.client.emit(s.Events.MESSAGE_REACTION_REMOVE,r,e),{message:i,reaction:r,user:e}}}t.exports=r},function(t,e,n){const i=n(2),s=n(0);class r extends i{handle(t){const e=this.client.channels.get(t.channel_id);if(!e||"voice"===e.type)return!1;const n=e.messages.get(t.message_id);return!!n&&(n._clearReactions(),this.client.emit(s.Events.MESSAGE_REACTION_REMOVE_ALL,n),{message:n})}}t.exports=r},function(t,e,n){const i=n(2),s=n(0),r=n(4);class o extends i{handle(t){const e=this.client,n=e.channels.get(t.channel_id);if(n){const i=n.messages.get(t.id);if(i){const n=r(i);return i.patch(t),i._edits.unshift(n),e.emit(s.Events.MESSAGE_UPDATE,n,i),{old:n,updated:i}}return{old:i,updated:i}}return{old:null,updated:null}}}t.exports=o},function(t,e,n){const i=n(2);class s extends i{handle(t){const e=this.client,n=e.dataManager.newUser(t);return{user:n}}}t.exports=s},function(t,e,n){const i=n(2),s=n(0);class r extends i{handle(t){const e=this.client,n=e.user.notes.get(t.id),i=t.note.length?t.note:null;return e.user.notes.set(t.id,i),e.emit(s.Events.USER_NOTE_UPDATE,t.id,n,i),{old:n,updated:i}}}t.exports=r},function(t,e,n){const i=n(2),s=n(0),r=n(4);class o extends i{handle(t){const e=this.client;if(e.user){if(e.user.equals(t))return{old:e.user,updated:e.user};const n=r(e.user);return e.user.patch(t),e.emit(s.Events.USER_UPDATE,n,e.user),{old:n,updated:e.user}}return{old:null,updated:null}}}t.exports=o},function(t,e,n){function i(t){let e=t.split("?")[0];if(e.includes("/channels/")||e.includes("/guilds/")){const t=e.includes("/channels/")?e.indexOf("/channels/"):e.indexOf("/guilds/"),n=e.substring(t).split("/")[2];e=e.replace(/(\d{8,})/g,":id").replace(":id",n)}return e}const s=n(25),r=n(0);class o{constructor(t,e,n,s,r,o){this.rest=t,this.method=e,this.url=n,this.auth=s,this.data=r,this.file=o,this.route=i(this.url)}getAuth(){if(this.rest.client.token&&this.rest.client.user&&this.rest.client.user.bot)return`Bot ${this.rest.client.token}`;if(this.rest.client.token)return this.rest.client.token;throw new Error(r.Errors.NO_TOKEN)}gen(){const t=s[this.method](this.url);return this.auth&&t.set("authorization",this.getAuth()),this.file&&this.file.file?(t.attach("file",this.file.file,this.file.name),this.data=this.data||{},t.field("payload_json",JSON.stringify(this.data))):this.data&&t.send(this.data),this.rest.client.browser||t.set("User-Agent",this.rest.userAgentManager.userAgent),t}}t.exports=o},function(t,e,n){const i=n(0),s=n(3),r=n(44),o=n(154),a=n(6),h=n(14),u=n(11),c=n(8),l=n(32),d=n(19),f=n(152),p=n(28);class m{constructor(t){this.rest=t}login(t=this.rest.client.token){return new Promise((e,n)=>{if("string"!=typeof t)throw new Error(i.Errors.INVALID_TOKEN);t=t.replace(/^Bot\s*/i,""),this.rest.client.manager.connectToWebSocket(t,e,n)})}logout(){return this.rest.makeRequest("post",i.Endpoints.logout,!0,{})}getGateway(){return this.rest.makeRequest("get",i.Endpoints.gateway,!0).then(t=>{return this.rest.client.ws.gateway=`${t.url}/?v=${i.PROTOCOL_VERSION}`,this.rest.client.ws.gateway})}getBotGateway(){return this.rest.makeRequest("get",i.Endpoints.botGateway,!0)}sendMessage(t,e,{tts,nonce,embed,disableEveryone,split}={},n=null){return new Promise((i,s)=>{"undefined"!=typeof e&&(e=this.rest.client.resolver.resolveString(e)),e&&((disableEveryone||"undefined"==typeof disableEveryone&&this.rest.client.options.disableEveryone)&&(e=e.replace(/@(everyone|here)/g,"@​$1")),split&&(e=r(e,"object"==typeof split?split:{}))),t instanceof a||t instanceof h?this.createDM(t).then(t=>{this._sendMessageRequest(t,e,n,tts,nonce,embed,i,s)},s):this._sendMessageRequest(t,e,n,tts,nonce,embed,i,s)})}_sendMessageRequest(t,e,n,s,r,o,a,h){if(e instanceof Array){const u=[];let c=this.rest.makeRequest("post",i.Endpoints.channelMessages(t.id),!0,{content:e[0],tts:s,nonce:r},n).catch(h);for(let l=1;l<=e.length;l++)if(l{return u.push(h),this.rest.makeRequest("post",i.Endpoints.channelMessages(t.id),!0,{content:e[a],tts:s,nonce:r,embed:o},n)},h)}else c.then(t=>{u.push(t),a(this.rest.client.actions.MessageCreate.handle(u).messages)},h)}else this.rest.makeRequest("post",i.Endpoints.channelMessages(t.id),!0,{content:e,tts:s,nonce:r,embed:o},n).then(t=>a(this.rest.client.actions.MessageCreate.handle(t).message),h)}deleteMessage(t){return this.rest.makeRequest("del",i.Endpoints.channelMessage(t.channel.id,t.id),!0).then(()=>this.rest.client.actions.MessageDelete.handle({id:t.id,channel_id:t.channel.id}).message)}bulkDeleteMessages(t,e){return this.rest.makeRequest("post",`${i.Endpoints.channelMessages(t.id)}/bulk_delete`,!0,{messages:e}).then(()=>this.rest.client.actions.MessageDeleteBulk.handle({channel_id:t.id,ids:e}).messages)}updateMessage(t,e,{embed}={}){return e=this.rest.client.resolver.resolveString(e),this.rest.makeRequest("patch",i.Endpoints.channelMessage(t.channel.id,t.id),!0,{content:e,embed:embed}).then(t=>this.rest.client.actions.MessageUpdate.handle(t).updated)}createChannel(t,e,n,r){return r instanceof s&&(r=r.array()),this.rest.makeRequest("post",i.Endpoints.guildChannels(t.id),!0,{name:e,type:n,permission_overwrites:r}).then(t=>this.rest.client.actions.ChannelCreate.handle(t).channel)}createDM(t){const e=this.getExistingDM(t);return e?Promise.resolve(e):this.rest.makeRequest("post",i.Endpoints.userChannels(this.rest.client.user.id),!0,{recipient_id:t.id}).then(t=>this.rest.client.actions.ChannelCreate.handle(t).channel)}getExistingDM(t){return this.rest.client.channels.find(e=>e.recipient&&e.recipient.id===t.id)}deleteChannel(t){return(t instanceof a||t instanceof h)&&(t=this.getExistingDM(t)),t?this.rest.makeRequest("del",i.Endpoints.channel(t.id),!0).then(e=>{return e.id=t.id,this.rest.client.actions.ChannelDelete.handle(e).channel}):Promise.reject(new Error("No channel to delete."))}updateChannel(t,e){const n={};return n.name=(e.name||t.name).trim(),n.topic=e.topic||t.topic,n.position=e.position||t.position,n.bitrate=e.bitrate||t.bitrate,n.user_limit=e.userLimit||t.userLimit,this.rest.makeRequest("patch",i.Endpoints.channel(t.id),!0,n).then(t=>this.rest.client.actions.ChannelUpdate.handle(t).updated)}leaveGuild(t){return t.ownerID===this.rest.client.user.id?Promise.reject(new Error("Guild is owned by the client.")):this.rest.makeRequest("del",i.Endpoints.meGuild(t.id),!0).then(()=>this.rest.client.actions.GuildDelete.handle({id:t.id}).guild)}createGuild(t){return t.icon=this.rest.client.resolver.resolveBase64(t.icon)||null,t.region=t.region||"us-central",new Promise((e,n)=>{this.rest.makeRequest("post",i.Endpoints.guilds,!0,t).then(t=>{if(this.rest.client.guilds.has(t.id))return void e(this.rest.client.guilds.get(t.id));const i=n=>{n.id===t.id&&(this.rest.client.removeListener("guildCreate",i),this.rest.client.clearTimeout(s),e(n))};this.rest.client.on("guildCreate",i);const s=this.rest.client.setTimeout(()=>{this.rest.client.removeListener("guildCreate",i),n(new Error("Took too long to receive guild data."))},1e4)},n)})}deleteGuild(t){return this.rest.makeRequest("del",i.Endpoints.guild(t.id),!0).then(()=>this.rest.client.actions.GuildDelete.handle({id:t.id}).guild)}getUser(t){return this.rest.makeRequest("get",i.Endpoints.user(t),!0).then(t=>this.rest.client.actions.UserGet.handle(t).user)}updateCurrentUser(t,e){const n=this.rest.client.user,s={};return s.username=t.username||n.username,s.avatar=this.rest.client.resolver.resolveBase64(t.avatar)||n.avatar,n.bot||(s.email=t.email||n.email,s.password=e,t.new_password&&(s.new_password=t.newPassword)),this.rest.makeRequest("patch",i.Endpoints.me,!0,s).then(t=>this.rest.client.actions.UserUpdate.handle(t).updated)}updateGuild(t,e){const n={};return e.name&&(n.name=e.name),e.region&&(n.region=e.region),e.verificationLevel&&(n.verification_level=Number(e.verificationLevel)),e.afkChannel&&(n.afk_channel_id=this.rest.client.resolver.resolveChannel(e.afkChannel).id),e.afkTimeout&&(n.afk_timeout=Number(e.afkTimeout)),e.icon&&(n.icon=this.rest.client.resolver.resolveBase64(e.icon)),e.owner&&(n.owner_id=this.rest.client.resolver.resolveUser(e.owner).id),e.splash&&(n.splash=this.rest.client.resolver.resolveBase64(e.splash)),this.rest.makeRequest("patch",i.Endpoints.guild(t.id),!0,n).then(t=>this.rest.client.actions.GuildUpdate.handle(t).updated)}kickGuildMember(t,e){return this.rest.makeRequest("del",i.Endpoints.guildMember(t.id,e.id),!0).then(()=>this.rest.client.actions.GuildMemberRemove.handle({guild_id:t.id,user:e.user}).member)}createGuildRole(t){return this.rest.makeRequest("post",i.Endpoints.guildRoles(t.id),!0).then(e=>this.rest.client.actions.GuildRoleCreate.handle({guild_id:t.id,role:e}).role)}deleteGuildRole(t){return this.rest.makeRequest("del",i.Endpoints.guildRole(t.guild.id,t.id),!0).then(()=>this.rest.client.actions.GuildRoleDelete.handle({guild_id:t.guild.id,role_id:t.id}).role)}setChannelOverwrite(t,e){return this.rest.makeRequest("put",`${i.Endpoints.channelPermissions(t.id)}/${e.id}`,!0,e)}deletePermissionOverwrites(t){return this.rest.makeRequest("del",`${i.Endpoints.channelPermissions(t.channel.id)}/${t.id}`,!0).then(()=>t)}getChannelMessages(t,e={}){const n=[];e.limit&&n.push(`limit=${e.limit}`),e.around?n.push(`around=${e.around}`):e.before?n.push(`before=${e.before}`):e.after&&n.push(`after=${e.after}`);let s=i.Endpoints.channelMessages(t.id);return n.length>0&&(s+=`?${n.join("&")}`),this.rest.makeRequest("get",s,!0)}getChannelMessage(t,e){const n=t.messages.get(e);return n?Promise.resolve(n):this.rest.makeRequest("get",i.Endpoints.channelMessage(t.id,e),!0)}getGuildMember(t,e){return this.rest.makeRequest("get",i.Endpoints.guildMember(t.id,e.id),!0).then(e=>this.rest.client.actions.GuildMemberGet.handle(t,e).member)}updateGuildMember(t,e){e.channel&&(e.channel_id=this.rest.client.resolver.resolveChannel(e.channel).id),e.roles&&(e.roles=e.roles.map(t=>t instanceof c?t.id:t));let n=i.Endpoints.guildMember(t.guild.id,t.id);if(t.id===this.rest.client.user.id){const s=Object.keys(e);1===s.length&&"nick"===s[0]&&(n=i.Endpoints.guildMemberNickname(t.guild.id))}return this.rest.makeRequest("patch",n,!0,e).then(e=>t.guild._updateMember(t,e).mem)}addMemberRole(t,e){return this.rest.makeRequest("put",i.Endpoints.guildMemberRole(t.guild.id,t.id,e.id),!0).then(()=>{return t._roles.includes(e.id)||t._roles.push(e.id),t})}removeMemberRole(t,e){return this.rest.makeRequest("delete",i.Endpoints.guildMemberRole(t.guild.id,t.id,e.id),!0).then(()=>{const n=t._roles.indexOf(e.id);return n>=0&&t._roles.splice(n,1),t})}sendTyping(t){return this.rest.makeRequest("post",`${i.Endpoints.channel(t)}/typing`,!0)}banGuildMember(t,e,n=0){const s=this.rest.client.resolver.resolveUserID(e);return s?this.rest.makeRequest("put",`${i.Endpoints.guildBans(t.id)}/${s}?delete-message-days=${n}`,!0,{"delete-message-days":n}).then(()=>{if(e instanceof h)return e;const n=this.rest.client.resolver.resolveUser(s);return n?(e=this.rest.client.resolver.resolveGuildMember(t,n),e||n):s}):Promise.reject(new Error("Couldn't resolve the user ID to ban."))}unbanGuildMember(t,e){return new Promise((n,s)=>{const r=this.rest.client.resolver.resolveUserID(e);if(!r)throw new Error("Couldn't resolve the user ID to unban.");const o=(e,s)=>{e.id===t.id&&s.id===r&&(this.rest.client.removeListener(i.Events.GUILD_BAN_REMOVE,o),this.rest.client.clearTimeout(a),n(s))};this.rest.client.on(i.Events.GUILD_BAN_REMOVE,o);const a=this.rest.client.setTimeout(()=>{this.rest.client.removeListener(i.Events.GUILD_BAN_REMOVE,o),s(new Error("Took too long to receive the ban remove event."))},1e4);this.rest.makeRequest("del",`${i.Endpoints.guildBans(t.id)}/${r}`,!0).catch(t=>{this.rest.client.removeListener(i.Events.GUILD_BAN_REMOVE,o),this.rest.client.clearTimeout(a),s(t)})})}getGuildBans(t){return this.rest.makeRequest("get",i.Endpoints.guildBans(t.id),!0).then(t=>{const e=new s;for(const n of t){const t=this.rest.client.dataManager.newUser(n.user);e.set(t.id,t)}return e})}updateGuildRole(t,e){const n={};if(n.name=e.name||t.name,n.position="undefined"!=typeof e.position?e.position:t.position,n.color=e.color||t.color,"string"==typeof n.color&&n.color.startsWith("#")&&(n.color=parseInt(n.color.replace("#",""),16)), -n.hoist="undefined"!=typeof e.hoist?e.hoist:t.hoist,n.mentionable="undefined"!=typeof e.mentionable?e.mentionable:t.mentionable,e.permissions){let t=0;for(let s of e.permissions)"string"==typeof s&&(s=i.PermissionFlags[s]),t|=s;n.permissions=t}else n.permissions=t.permissions;return this.rest.makeRequest("patch",i.Endpoints.guildRole(t.guild.id,t.id),!0,n).then(e=>this.rest.client.actions.GuildRoleUpdate.handle({role:e,guild_id:t.guild.id}).updated)}pinMessage(t){return this.rest.makeRequest("put",`${i.Endpoints.channel(t.channel.id)}/pins/${t.id}`,!0).then(()=>t)}unpinMessage(t){return this.rest.makeRequest("del",`${i.Endpoints.channel(t.channel.id)}/pins/${t.id}`,!0).then(()=>t)}getChannelPinnedMessages(t){return this.rest.makeRequest("get",`${i.Endpoints.channel(t.id)}/pins`,!0)}createChannelInvite(t,e){const n={};return n.temporary=e.temporary,n.max_age=e.maxAge,n.max_uses=e.maxUses,this.rest.makeRequest("post",`${i.Endpoints.channelInvites(t.id)}`,!0,n).then(t=>new l(this.rest.client,t))}deleteInvite(t){return this.rest.makeRequest("del",i.Endpoints.invite(t.code),!0).then(()=>t)}getInvite(t){return this.rest.makeRequest("get",i.Endpoints.invite(t),!0).then(t=>new l(this.rest.client,t))}getGuildInvites(t){return this.rest.makeRequest("get",i.Endpoints.guildInvites(t.id),!0).then(t=>{const e=new s;for(const n of t){const t=new l(this.rest.client,n);e.set(t.code,t)}return e})}pruneGuildMembers(t,e,n){return this.rest.makeRequest(n?"get":"post",`${i.Endpoints.guildPrune(t.id)}?days=${e}`,!0).then(t=>t.pruned)}createEmoji(t,e,n){return this.rest.makeRequest("post",`${i.Endpoints.guildEmojis(t.id)}`,!0,{name:n,image:e}).then(e=>this.rest.client.actions.EmojiCreate.handle(e,t).emoji)}deleteEmoji(t){return this.rest.makeRequest("delete",`${i.Endpoints.guildEmojis(t.guild.id)}/${t.id}`,!0).then(()=>this.rest.client.actions.EmojiDelete.handle(t).data)}getWebhook(t,e){return this.rest.makeRequest("get",i.Endpoints.webhook(t,e),!e).then(t=>new d(this.rest.client,t))}getGuildWebhooks(t){return this.rest.makeRequest("get",i.Endpoints.guildWebhooks(t.id),!0).then(t=>{const e=new s;for(const n of t)e.set(n.id,new d(this.rest.client,n));return e})}getChannelWebhooks(t){return this.rest.makeRequest("get",i.Endpoints.channelWebhooks(t.id),!0).then(t=>{const e=new s;for(const n of t)e.set(n.id,new d(this.rest.client,n));return e})}createWebhook(t,e,n){return this.rest.makeRequest("post",i.Endpoints.channelWebhooks(t.id),!0,{name:e,avatar:n}).then(t=>new d(this.rest.client,t))}editWebhook(t,e,n){return this.rest.makeRequest("patch",i.Endpoints.webhook(t.id,t.token),!1,{name:e,avatar:n}).then(e=>{return t.name=e.name,t.avatar=e.avatar,t})}deleteWebhook(t){return this.rest.makeRequest("delete",i.Endpoints.webhook(t.id,t.token),!1)}sendWebhookMessage(t,e,{avatarURL,tts,disableEveryone,embeds}={},n=null){return"undefined"!=typeof e&&(e=this.rest.client.resolver.resolveString(e)),e&&(disableEveryone||"undefined"==typeof disableEveryone&&this.rest.client.options.disableEveryone)&&(e=e.replace(/@(everyone|here)/g,"@​$1")),this.rest.makeRequest("post",`${i.Endpoints.webhook(t.id,t.token)}?wait=true`,!1,{username:t.name,avatar_url:avatarURL,content:e,tts:tts,file:n,embeds:embeds})}sendSlackWebhookMessage(t,e){return this.rest.makeRequest("post",`${i.Endpoints.webhook(t.id,t.token)}/slack?wait=true`,!1,e)}fetchUserProfile(t){return this.rest.makeRequest("get",i.Endpoints.userProfile(t.id),!0).then(e=>new f(t,e))}fetchMeMentions(t){return t.guild&&(t.guild=t.guild.id?t.guild.id:t.guild),this.rest.makeRequest("get",i.Endpoints.meMentions(t.limit,t.roles,t.everyone,t.guild)).then(t=>t.body.map(t=>new u(this.rest.client.channels.get(t.channel_id),t,this.rest.client)))}addFriend(t){return this.rest.makeRequest("post",i.Endpoints.relationships("@me"),!0,{username:t.username,discriminator:t.discriminator}).then(()=>t)}removeFriend(t){return this.rest.makeRequest("delete",`${i.Endpoints.relationships("@me")}/${t.id}`,!0).then(()=>t)}blockUser(t){return this.rest.makeRequest("put",`${i.Endpoints.relationships("@me")}/${t.id}`,!0,{type:2}).then(()=>t)}unblockUser(t){return this.rest.makeRequest("delete",`${i.Endpoints.relationships("@me")}/${t.id}`,!0).then(()=>t)}setRolePositions(t,e){return this.rest.makeRequest("patch",i.Endpoints.guildRoles(t),!0,e).then(()=>this.rest.client.actions.GuildRolesPositionUpdate.handle({guild_id:t,roles:e}).guild)}addMessageReaction(t,e){return this.rest.makeRequest("put",i.Endpoints.selfMessageReaction(t.channel.id,t.id,e),!0).then(()=>this.rest.client.actions.MessageReactionAdd.handle({user_id:this.rest.client.user.id,message_id:t.id,emoji:o(e),channel_id:t.channel.id}).reaction)}removeMessageReaction(t,e,n){let s=i.Endpoints.selfMessageReaction(t.channel.id,t.id,e);return n.id!==this.rest.client.user.id&&(s=i.Endpoints.userMessageReaction(t.channel.id,t.id,e,null,n.id)),this.rest.makeRequest("delete",s,!0).then(()=>this.rest.client.actions.MessageReactionRemove.handle({user_id:n.id,message_id:t.id,emoji:o(e),channel_id:t.channel.id}).reaction)}removeMessageReactions(t){return this.rest.makeRequest("delete",i.Endpoints.messageReactions(t.channel.id,t.id),!0).then(()=>t)}getMessageReactionUsers(t,e,n=100){return this.rest.makeRequest("get",i.Endpoints.messageReaction(t.channel.id,t.id,e,n),!0)}getMyApplication(){return this.rest.makeRequest("get",i.Endpoints.myApplication,!0).then(t=>new p(this.rest.client,t))}setNote(t,e){return this.rest.makeRequest("put",i.Endpoints.note(t.id),!0,{note:e}).then(()=>t)}}t.exports=m},function(t,e,n){const i=n(53);class s extends i{constructor(t,e){super(t,e),this.requestRemaining=1,this.first=!0}push(t){super.push(t),this.handle()}handleNext(t){this.waiting||(this.waiting=!0,this.restManager.client.setTimeout(()=>{this.requestRemaining=this.requestLimit,this.waiting=!1,this.handle()},t))}execute(t){t.request.gen().end((e,n)=>{if(n&&n.headers&&(this.requestLimit=n.headers["x-ratelimit-limit"],this.requestResetTime=1e3*Number(n.headers["x-ratelimit-reset"]),this.requestRemaining=Number(n.headers["x-ratelimit-remaining"]),this.timeDifference=Date.now()-new Date(n.headers.date).getTime(),this.handleNext(this.requestResetTime-Date.now()+this.timeDifference+this.restManager.client.options.restTimeOffset)),e)429===e.status?(this.requestRemaining=0,this.queue.unshift(t),this.restManager.client.setTimeout(()=>{this.globalLimit=!1,this.handle()},Number(n.headers["retry-after"])+this.restManager.client.options.restTimeOffset),n.headers["x-ratelimit-global"]&&(this.globalLimit=!0)):t.reject(e);else{this.globalLimit=!1;const e=n&&n.body?n.body:{};t.resolve(e),this.first&&(this.first=!1,this.handle())}})}handle(){if(super.handle(),!(this.requestRemaining<1||0===this.queue.length||this.globalLimit))for(;this.queue.length>0&&this.requestRemaining>0;)this.execute(this.queue.shift()),this.requestRemaining--}}t.exports=s},function(t,e,n){const i=n(53);class s extends i{constructor(t,e){super(t,e),this.waiting=!1,this.endpoint=e,this.timeDifference=0}push(t){super.push(t),this.handle()}execute(t){return new Promise(e=>{t.request.gen().end((n,i)=>{if(i&&i.headers&&(this.requestLimit=i.headers["x-ratelimit-limit"],this.requestResetTime=1e3*Number(i.headers["x-ratelimit-reset"]),this.requestRemaining=Number(i.headers["x-ratelimit-remaining"]),this.timeDifference=Date.now()-new Date(i.headers.date).getTime()),n)429===n.status?(this.restManager.client.setTimeout(()=>{this.waiting=!1,this.globalLimit=!1,e()},Number(i.headers["retry-after"])+this.restManager.client.options.restTimeOffset),i.headers["x-ratelimit-global"]&&(this.globalLimit=!0)):(this.queue.shift(),this.waiting=!1,t.reject(n),e(n));else{this.queue.shift(),this.globalLimit=!1;const n=i&&i.body?i.body:{};t.resolve(n),0===this.requestRemaining?this.restManager.client.setTimeout(()=>{this.waiting=!1,e(n)},this.requestResetTime-Date.now()+this.timeDifference+this.restManager.client.options.restTimeOffset):(this.waiting=!1,e(n))}})})}handle(){if(super.handle(),!this.waiting&&0!==this.queue.length&&!this.globalLimit){this.waiting=!0;const t=this.queue[0];this.execute(t).then(()=>this.handle())}}}t.exports=s},function(t,e,n){const i=n(0);class s{constructor(t){this.restManager=t,this._userAgent={url:"https://github.com/hydrabolt/discord.js",version:i.Package.version}}set(t){this._userAgent.url=t.url||"https://github.com/hydrabolt/discord.js",this._userAgent.version=t.version||i.Package.version}get userAgent(){return`DiscordBot (${this._userAgent.url}, ${this._userAgent.version})`}}t.exports=s},function(t,e,n){(function(e){const i="undefined"!=typeof window,s=n(21).EventEmitter,r=n(0),o=n(54),a=n(67),h=n(50),u=n(116);let c,l,d=JSON.stringify;if(i)c=window.WebSocket;else{try{c=n(158)}catch(t){c=n(159)}try{l=n(157),d=l.pack}catch(t){l=null}}class f extends s{constructor(t){super(),this.client=t,this.packetManager=new u(this),this.status=r.Status.IDLE,this.sessionID=null,this.sequence=-1,this.gateway=null,this.normalReady=!1,this.ws=null,this.disabledEvents={};for(const e of t.options.disabledEvents)this.disabledEvents[e]=!0;this.first=!0,this.lastHeartbeatAck=!0}_connect(t){this.client.emit("debug",`Connecting to gateway ${t}`),this.normalReady=!1,this.status!==r.Status.RECONNECTING&&(this.status=r.Status.CONNECTING),this.ws=new c(t),i&&(this.ws.binaryType="arraybuffer"),this.ws.onopen=this.eventOpen.bind(this),this.ws.onmessage=this.eventMessage.bind(this),this.ws.onclose=this.eventClose.bind(this),this.ws.onerror=this.eventError.bind(this),this._queue=[],this._remaining=120,this.client.setInterval(()=>{this._remaining=120,this._remainingReset=Date.now()},6e4)}connect(t){t=`${t}&encoding=${l?"etf":"json"}`,this.first?(this._connect(t),this.first=!1):this.client.setTimeout(()=>this._connect(t),5500)}heartbeat(t){return t&&!this.lastHeartbeatAck?void this.ws.close(1007):(this.client.emit("debug","Sending heartbeat"),this.client._pingTimestamp=Date.now(),this.client.ws.send({op:r.OPCodes.HEARTBEAT,d:this.sequence},!0),void(this.lastHeartbeatAck=!1))}send(t,e=false){return e?void this._send(d(t)):(this._queue.push(d(t)),void this.doQueue())}destroy(){this.ws.close(1e3),this._queue=[],this.status=r.Status.IDLE}_send(t){this.ws.readyState===c.OPEN&&(this.emit("send",t),this.ws.send(t))}doQueue(){const t=this._queue[0];if(this.ws.readyState===c.OPEN&&t){if(0===this.remaining)return void this.client.setTimeout(this.doQueue.bind(this),Date.now()-this.remainingReset);this._remaining--,this._send(t),this._queue.shift(),this.doQueue()}}eventOpen(){this.client.emit("debug","Connection to gateway opened"),this.lastHeartbeatAck=!0,this.status===r.Status.RECONNECTING?this._sendResume():this._sendNewIdentify()}_sendResume(){if(!this.sessionID)return void this._sendNewIdentify();this.client.emit("debug","Identifying as resumed session");const t={token:this.client.token,session_id:this.sessionID,seq:this.sequence};this.send({op:r.OPCodes.RESUME,d:t})}_sendNewIdentify(){this.reconnecting=!1;const t=this.client.options.ws;t.token=this.client.token,this.client.options.shardCount>0&&(t.shard=[Number(this.client.options.shardId),Number(this.client.options.shardCount)]),this.client.emit("debug","Identifying as new session"),this.send({op:r.OPCodes.IDENTIFY,d:t}),this.sequence=-1}eventClose(t){this.emit("close",t),this.client.clearInterval(this.client.manager.heartbeatInterval),this.status=r.Status.DISCONNECTED,this._queue=[],this.reconnecting||this.client.emit(r.Events.DISCONNECT,t),4004!==t.code&&4010!==t.code&&(this.reconnecting||1e3===t.code||this.tryReconnect())}eventMessage(t){const e=this.tryParseEventData(t.data);return null===e?(this.eventError(new Error(r.Errors.BAD_WS_MESSAGE)),!1):(this.client.emit("raw",e),e.op===r.OPCodes.HELLO&&this.client.manager.setupKeepAlive(e.d.heartbeat_interval),this.packetManager.handle(e))}parseEventData(t){return l?(t instanceof ArrayBuffer&&(t=o(t)),l.unpack(t)):(t instanceof ArrayBuffer?t=a.inflate(t,{to:"string"}):t instanceof e&&(t=h.inflateSync(t).toString()),JSON.parse(t))}tryParseEventData(t){try{return this.parseEventData(t)}catch(t){return null}}eventError(t){this.client.listenerCount("error")>0&&this.client.emit("error",t),this.tryReconnect()}_emitReady(t=true){this.status=r.Status.READY,this.client.emit(r.Events.READY),this.packetManager.handleQueue(),this.normalReady=t}checkIfReady(){if(this.status!==r.Status.READY&&this.status!==r.Status.NEARLY){let t=0;for(const e of this.client.guilds.keys())t+=this.client.guilds.get(e).available?0:1;if(0===t){if(this.status=r.Status.NEARLY,this.client.options.fetchAllMembers){const t=this.client.guilds.map(t=>t.fetchMembers());return void Promise.all(t).then(()=>this._emitReady(),t=>{this.client.emit(r.Events.WARN,"Error in pre-ready guild member fetching"),this.client.emit(r.Events.ERROR,t),this._emitReady()})}this._emitReady()}}}tryReconnect(){this.status!==r.Status.RECONNECTING&&this.status!==r.Status.CONNECTING&&(this.status=r.Status.RECONNECTING,this.ws.close(),this.packetManager.handleQueue(),this.client.emit(r.Events.RECONNECTING),this.connect(this.client.ws.gateway))}}t.exports=f}).call(e,n(20).Buffer)},function(t,e,n){const i=n(0),s=[i.WSEvents.READY,i.WSEvents.GUILD_CREATE,i.WSEvents.GUILD_DELETE,i.WSEvents.GUILD_MEMBERS_CHUNK,i.WSEvents.GUILD_MEMBER_ADD,i.WSEvents.GUILD_MEMBER_REMOVE];class r{constructor(t){this.ws=t,this.handlers={},this.queue=[],this.register(i.WSEvents.READY,n(143)),this.register(i.WSEvents.GUILD_CREATE,n(123)),this.register(i.WSEvents.GUILD_DELETE,n(124)),this.register(i.WSEvents.GUILD_UPDATE,n(134)),this.register(i.WSEvents.GUILD_BAN_ADD,n(121)),this.register(i.WSEvents.GUILD_BAN_REMOVE,n(122)),this.register(i.WSEvents.GUILD_MEMBER_ADD,n(126)),this.register(i.WSEvents.GUILD_MEMBER_REMOVE,n(127)),this.register(i.WSEvents.GUILD_MEMBER_UPDATE,n(128)),this.register(i.WSEvents.GUILD_ROLE_CREATE,n(130)),this.register(i.WSEvents.GUILD_ROLE_DELETE,n(131)),this.register(i.WSEvents.GUILD_ROLE_UPDATE,n(132)),this.register(i.WSEvents.GUILD_EMOJIS_UPDATE,n(125)),this.register(i.WSEvents.GUILD_MEMBERS_CHUNK,n(129)),this.register(i.WSEvents.CHANNEL_CREATE,n(117)),this.register(i.WSEvents.CHANNEL_DELETE,n(118)),this.register(i.WSEvents.CHANNEL_UPDATE,n(120)),this.register(i.WSEvents.CHANNEL_PINS_UPDATE,n(119)),this.register(i.WSEvents.PRESENCE_UPDATE,n(142)),this.register(i.WSEvents.USER_UPDATE,n(148)),this.register(i.WSEvents.USER_NOTE_UPDATE,n(147)),this.register(i.WSEvents.VOICE_STATE_UPDATE,n(150)),this.register(i.WSEvents.TYPING_START,n(146)),this.register(i.WSEvents.MESSAGE_CREATE,n(135)),this.register(i.WSEvents.MESSAGE_DELETE,n(136)),this.register(i.WSEvents.MESSAGE_UPDATE,n(141)),this.register(i.WSEvents.MESSAGE_DELETE_BULK,n(137)),this.register(i.WSEvents.VOICE_SERVER_UPDATE,n(149)),this.register(i.WSEvents.GUILD_SYNC,n(133)),this.register(i.WSEvents.RELATIONSHIP_ADD,n(144)),this.register(i.WSEvents.RELATIONSHIP_REMOVE,n(145)),this.register(i.WSEvents.MESSAGE_REACTION_ADD,n(138)),this.register(i.WSEvents.MESSAGE_REACTION_REMOVE,n(139)),this.register(i.WSEvents.MESSAGE_REACTION_REMOVE_ALL,n(140))}get client(){return this.ws.client}register(t,e){this.handlers[t]=new e(this)}handleQueue(){this.queue.forEach((t,e)=>{this.handle(this.queue[e]),this.queue.splice(e,1)})}setSequence(t){t&&t>this.ws.sequence&&(this.ws.sequence=t)}handle(t){return t.op===i.OPCodes.RECONNECT?(this.setSequence(t.s),this.ws.tryReconnect(),!1):t.op===i.OPCodes.INVALID_SESSION?(t.d?setTimeout(()=>{this.ws._sendResume()},2500):(this.ws.sessionID=null,this.ws._sendNewIdentify()),!1):(t.op===i.OPCodes.HEARTBEAT_ACK&&(this.ws.client._pong(this.ws.client._pingTimestamp),this.ws.lastHeartbeatAck=!0,this.ws.client.emit("debug","Heartbeat acknowledged")),t.op===i.OPCodes.HEARTBEAT&&(this.client.ws.send({op:i.OPCodes.HEARTBEAT_ACK}),this.ws.client.emit("debug","ACKed gateway heartbeat!")),this.ws.status===i.Status.RECONNECTING&&(this.ws.reconnecting=!1,this.ws.checkIfReady()),this.setSequence(t.s),void 0===this.ws.disabledEvents[t.t]&&(this.ws.status!==i.Status.READY&&s.indexOf(t.t)===-1?(this.queue.push(t),!1):!!this.handlers[t.t]&&this.handlers[t.t].handle(t)))}}t.exports=r},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.actions.ChannelCreate.handle(n)}}t.exports=s},function(t,e,n){const i=n(1),s=n(0);class r extends i{handle(t){const e=this.packetManager.client,n=t.d,i=e.actions.ChannelDelete.handle(n);i.channel&&e.emit(s.Events.CHANNEL_DELETE,i.channel)}}t.exports=r},function(t,e,n){const i=n(1),s=n(0);class r extends i{handle(t){const e=this.packetManager.client,n=t.d,i=e.channels.get(n.channel_id),r=new Date(n.last_pin_timestamp);i&&r&&e.emit(s.Events.CHANNEL_PINS_UPDATE,i,r)}}t.exports=r},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.actions.ChannelUpdate.handle(n)}}t.exports=s},function(t,e,n){const i=n(1),s=n(0);class r extends i{handle(t){const e=this.packetManager.client,n=t.d,i=e.guilds.get(n.guild_id),r=e.users.get(n.user.id);i&&r&&e.emit(s.Events.GUILD_BAN_ADD,i,r)}}t.exports=r},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.actions.GuildBanRemove.handle(n)}}t.exports=s},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d,i=e.guilds.get(n.id);i?i.available||n.unavailable||(i.setup(n),this.packetManager.ws.checkIfReady()):e.dataManager.newGuild(n)}}t.exports=s},function(t,e,n){const i=n(1),s=n(0);class r extends i{handle(t){const e=this.packetManager.client,n=t.d,i=e.actions.GuildDelete.handle(n);i.guild&&e.emit(s.Events.GUILD_DELETE,i.guild)}}t.exports=r},function(t,e,n){function i(t){const e=new Map;for(const n of t)e.set(...n);return e}const s=n(1);class r extends s{handle(t){const e=this.packetManager.client,n=t.d,s=e.guilds.get(n.guild_id);if(s&&s.emojis){const t=i(s.emojis.entries());for(const r of n.emojis){const n=s.emojis.get(r.id);n?(t.delete(r.id),n.equals(r,!0)||e.actions.GuildEmojiUpdate.handle(n,r)):e.actions.GuildEmojiCreate.handle(s,r)}for(const r of t.values())e.actions.GuildEmojiDelete.handle(r)}}}t.exports=r},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d,i=e.guilds.get(n.guild_id);i&&(i.memberCount++,i._addMember(n))}}t.exports=s},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.actions.GuildMemberRemove.handle(n)}}t.exports=s},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d,i=e.guilds.get(n.guild_id);if(i){const t=i.members.get(n.user.id);t&&i._updateMember(t,n)}}}t.exports=s},function(t,e,n){const i=n(1),s=n(0);class r extends i{handle(t){const e=this.packetManager.client,n=t.d,i=e.guilds.get(n.guild_id);if(i){const t=n.members.map(t=>i._addMember(t,!1));i._checkChunks(),e.emit(s.Events.GUILD_MEMBERS_CHUNK,t),e.ws.lastHeartbeatAck=!0}}}t.exports=r},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.actions.GuildRoleCreate.handle(n)}}t.exports=s},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.actions.GuildRoleDelete.handle(n)}}t.exports=s},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.actions.GuildRoleUpdate.handle(n)}}t.exports=s},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.actions.GuildSync.handle(n)}}t.exports=s},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.actions.GuildUpdate.handle(n)}}t.exports=s},function(t,e,n){const i=n(1),s=n(0);class r extends i{handle(t){const e=this.packetManager.client,n=t.d,i=e.actions.MessageCreate.handle(n);i.message&&e.emit(s.Events.MESSAGE_CREATE,i.message)}}t.exports=r},function(t,e,n){const i=n(1),s=n(0);class r extends i{handle(t){const e=this.packetManager.client,n=t.d,i=e.actions.MessageDelete.handle(n);i.message&&e.emit(s.Events.MESSAGE_DELETE,i.message)}}t.exports=r},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.actions.MessageDeleteBulk.handle(n)}}t.exports=s},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.actions.MessageReactionAdd.handle(n)}}t.exports=s},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.actions.MessageReactionRemove.handle(n)}}t.exports=s},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.actions.MessageReactionRemoveAll.handle(n)}}t.exports=s},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.actions.MessageUpdate.handle(n)}}t.exports=s},function(t,e,n){const i=n(1),s=n(0),r=n(4);class o extends i{handle(t){const e=this.packetManager.client,n=t.d;let i=e.users.get(n.user.id);const o=e.guilds.get(n.guild_id);if(!i){if(!n.user.username)return;i=e.dataManager.newUser(n.user)}const a=r(i);if(i.patch(n.user),i.equals(a)||e.emit(s.Events.USER_UPDATE,a,i),o){let t=o.members.get(i.id);if(t||"offline"===n.status||(t=o._addMember({user:i,roles:n.roles,deaf:!1,mute:!1},!1),e.emit(s.Events.GUILD_MEMBER_AVAILABLE,t)),t){const a=r(t);t.presence&&(a.frozenPresence=r(t.presence)),o._setPresence(i.id,n),e.emit(s.Events.PRESENCE_UPDATE,a,t)}else o._setPresence(i.id,n)}}}t.exports=o},function(t,e,n){const i=n(1),s=n(29);class r extends i{handle(t){const e=this.packetManager.client,n=t.d;e.ws.heartbeat();const i=new s(e,n.user);e.user=i,e.readyAt=new Date,e.users.set(i.id,i);for(const r of n.guilds)e.dataManager.newGuild(r);for(const o of n.private_channels)e.dataManager.newChannel(o);for(const a of n.relationships){const t=e.dataManager.newUser(a.user);1===a.type?e.user.friends.set(t.id,t):2===a.type&&e.user.blocked.set(t.id,t)}n.presences=n.presences||[];for(const h of n.presences)e.dataManager.newUser(h.user),e._setPresence(h.user.id,h);if(n.notes)for(const u in n.notes){let t=n.notes[u];t.length||(t=null),e.user.notes.set(u,t)}!e.user.bot&&e.options.sync&&e.setInterval(e.syncGuilds.bind(e),3e4),e.once("ready",e.syncGuilds.bind(e)),e.users.has("1")||e.dataManager.newUser({id:"1",username:"Clyde",discriminator:"0000",avatar:"https://discordapp.com/assets/f78426a064bc9dd24847519259bc42af.png",bot:!0,status:"online",game:null,verified:!0}),e.setTimeout(()=>{e.ws.normalReady||e.ws._emitReady(!1)},1200*n.guilds.length),this.packetManager.ws.sessionID=n.session_id,this.packetManager.ws.checkIfReady()}}t.exports=r},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;1===n.type?e.fetchUser(n.id).then(t=>{e.user.friends.set(t.id,t)}):2===n.type&&e.fetchUser(n.id).then(t=>{e.user.blocked.set(t.id,t)})}}t.exports=s},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;2===n.type?e.user.blocked.has(n.id)&&e.user.blocked.delete(n.id):1===n.type&&e.user.friends.has(n.id)&&e.user.friends.delete(n.id)}}t.exports=s},function(t,e,n){function i(t,e){return t.client.setTimeout(()=>{t.client.emit(r.Events.TYPING_STOP,t,e,t._typing.get(e.id)),t._typing.delete(e.id)},6e3)}const s=n(1),r=n(0);class o extends s{handle(t){const e=this.packetManager.client,n=t.d,s=e.channels.get(n.channel_id),o=e.users.get(n.user_id),h=new Date(1e3*n.timestamp);if(s&&o){if("voice"===s.type)return void e.emit(r.Events.WARN,`Discord sent a typing packet to voice channel ${s.id}`);if(s._typing.has(o.id)){const t=s._typing.get(o.id);t.lastTimestamp=h,t.resetTimeout(i(s,o))}else s._typing.set(o.id,new a(e,h,h,i(s,o))),e.emit(r.Events.TYPING_START,s,o)}}}class a{constructor(t,e,n,i){this.client=t,this.since=e,this.lastTimestamp=n,this._timeout=i}resetTimeout(t){this.client.clearTimeout(this._timeout),this._timeout=t}get elapsedTime(){return Date.now()-this.since}}t.exports=o},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.actions.UserNoteUpdate.handle(n)}}t.exports=s},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.actions.UserUpdate.handle(n)}}t.exports=s},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.emit("self.voiceServer",n)}}t.exports=s},function(t,e,n){const i=n(1),s=n(0),r=n(4);class o extends i{handle(t){const e=this.packetManager.client,n=t.d,i=e.guilds.get(n.guild_id);if(i){const t=i.members.get(n.user_id);if(t){const i=r(t);t.voiceChannel&&t.voiceChannel.id!==n.channel_id&&t.voiceChannel.members.delete(i.id),n.channel_id||(t.speaking=null),t.user.id===e.user.id&&n.channel_id&&e.emit("self.voiceStateUpdate",n);const o=e.channels.get(n.channel_id);o&&o.members.set(t.user.id,t),t.serverMute=n.mute,t.serverDeaf=n.deaf,t.selfMute=n.self_mute,t.selfDeaf=n.self_deaf,t.voiceSessionID=n.session_id,t.voiceChannelID=n.channel_id,e.emit(s.Events.VOICE_STATE_UPDATE,i,t)}}}}t.exports=o},function(t,e){class n{constructor(t,e){this.user=t,this.setup(e)}setup(t){this.type=t.type,this.name=t.name,this.id=t.id,this.revoked=t.revoked,this.integrations=t.integrations}}t.exports=n},function(t,e,n){const i=n(3),s=n(151);class r{constructor(t,e){this.user=t,Object.defineProperty(this,"client",{value:t.client}),this.mutualGuilds=new i,this.connections=new i,this.setup(e)}setup(t){this.premium=t.premium;for(const e of t.mutual_guilds)this.client.guilds.has(e.id)&&this.mutualGuilds.set(e.id,this.client.guilds.get(e.id));for(const n of t.connected_accounts)this.connections.set(n.id,new s(this.user,n))}}t.exports=r},function(t,e){t.exports=function(t,e){if(t===e)return!0;if(t.length!==e.length)return!1;for(const n in t){const i=t[n],s=e.indexOf(i);s&&e.splice(s,1)}return 0===e.length}},function(t,e){t.exports=function(t){if(t.includes("%")&&(t=decodeURIComponent(t)),t.includes(":")){const[e,n]=t.split(":");return{name:e,id:n}}return{name:t,id:null}}},function(t,e){},function(t,e){},function(t,e){},function(t,e){},function(t,e){}]); \ No newline at end of file +n.hoist="undefined"!=typeof e.hoist?e.hoist:t.hoist,n.mentionable="undefined"!=typeof e.mentionable?e.mentionable:t.mentionable,e.permissions){let t=0;for(let s of e.permissions)"string"==typeof s&&(s=i.PermissionFlags[s]),t|=s;n.permissions=t}else n.permissions=t.permissions;return this.rest.makeRequest("patch",i.Endpoints.guildRole(t.guild.id,t.id),!0,n).then(e=>this.rest.client.actions.GuildRoleUpdate.handle({role:e,guild_id:t.guild.id}).updated)}pinMessage(t){return this.rest.makeRequest("put",`${i.Endpoints.channel(t.channel.id)}/pins/${t.id}`,!0).then(()=>t)}unpinMessage(t){return this.rest.makeRequest("del",`${i.Endpoints.channel(t.channel.id)}/pins/${t.id}`,!0).then(()=>t)}getChannelPinnedMessages(t){return this.rest.makeRequest("get",`${i.Endpoints.channel(t.id)}/pins`,!0)}createChannelInvite(t,e){const n={};return n.temporary=e.temporary,n.max_age=e.maxAge,n.max_uses=e.maxUses,this.rest.makeRequest("post",`${i.Endpoints.channelInvites(t.id)}`,!0,n).then(t=>new l(this.rest.client,t))}deleteInvite(t){return this.rest.makeRequest("del",i.Endpoints.invite(t.code),!0).then(()=>t)}getInvite(t){return this.rest.makeRequest("get",i.Endpoints.invite(t),!0).then(t=>new l(this.rest.client,t))}getGuildInvites(t){return this.rest.makeRequest("get",i.Endpoints.guildInvites(t.id),!0).then(t=>{const e=new s;for(const n of t){const t=new l(this.rest.client,n);e.set(t.code,t)}return e})}pruneGuildMembers(t,e,n){return this.rest.makeRequest(n?"get":"post",`${i.Endpoints.guildPrune(t.id)}?days=${e}`,!0).then(t=>t.pruned)}createEmoji(t,e,n){return this.rest.makeRequest("post",`${i.Endpoints.guildEmojis(t.id)}`,!0,{name:n,image:e}).then(e=>this.rest.client.actions.EmojiCreate.handle(e,t).emoji)}deleteEmoji(t){return this.rest.makeRequest("delete",`${i.Endpoints.guildEmojis(t.guild.id)}/${t.id}`,!0).then(()=>this.rest.client.actions.EmojiDelete.handle(t).data)}getWebhook(t,e){return this.rest.makeRequest("get",i.Endpoints.webhook(t,e),!e).then(t=>new d(this.rest.client,t))}getGuildWebhooks(t){return this.rest.makeRequest("get",i.Endpoints.guildWebhooks(t.id),!0).then(t=>{const e=new s;for(const n of t)e.set(n.id,new d(this.rest.client,n));return e})}getChannelWebhooks(t){return this.rest.makeRequest("get",i.Endpoints.channelWebhooks(t.id),!0).then(t=>{const e=new s;for(const n of t)e.set(n.id,new d(this.rest.client,n));return e})}createWebhook(t,e,n){return this.rest.makeRequest("post",i.Endpoints.channelWebhooks(t.id),!0,{name:e,avatar:n}).then(t=>new d(this.rest.client,t))}editWebhook(t,e,n){return this.rest.makeRequest("patch",i.Endpoints.webhook(t.id,t.token),!1,{name:e,avatar:n}).then(e=>{return t.name=e.name,t.avatar=e.avatar,t})}deleteWebhook(t){return this.rest.makeRequest("delete",i.Endpoints.webhook(t.id,t.token),!1)}sendWebhookMessage(t,e,{avatarURL,tts,disableEveryone,embeds}={},n=null){return"undefined"!=typeof e&&(e=this.rest.client.resolver.resolveString(e)),e&&(disableEveryone||"undefined"==typeof disableEveryone&&this.rest.client.options.disableEveryone)&&(e=e.replace(/@(everyone|here)/g,"@​$1")),this.rest.makeRequest("post",`${i.Endpoints.webhook(t.id,t.token)}?wait=true`,!1,{username:t.name,avatar_url:avatarURL,content:e,tts:tts,file:n,embeds:embeds})}sendSlackWebhookMessage(t,e){return this.rest.makeRequest("post",`${i.Endpoints.webhook(t.id,t.token)}/slack?wait=true`,!1,e)}fetchUserProfile(t){return this.rest.makeRequest("get",i.Endpoints.userProfile(t.id),!0).then(e=>new f(t,e))}fetchMeMentions(t){return t.guild&&(t.guild=t.guild.id?t.guild.id:t.guild),this.rest.makeRequest("get",i.Endpoints.meMentions(t.limit,t.roles,t.everyone,t.guild)).then(t=>t.body.map(t=>new u(this.rest.client.channels.get(t.channel_id),t,this.rest.client)))}addFriend(t){return this.rest.makeRequest("post",i.Endpoints.relationships("@me"),!0,{username:t.username,discriminator:t.discriminator}).then(()=>t)}removeFriend(t){return this.rest.makeRequest("delete",`${i.Endpoints.relationships("@me")}/${t.id}`,!0).then(()=>t)}blockUser(t){return this.rest.makeRequest("put",`${i.Endpoints.relationships("@me")}/${t.id}`,!0,{type:2}).then(()=>t)}unblockUser(t){return this.rest.makeRequest("delete",`${i.Endpoints.relationships("@me")}/${t.id}`,!0).then(()=>t)}setRolePositions(t,e){return this.rest.makeRequest("patch",i.Endpoints.guildRoles(t),!0,e).then(()=>this.rest.client.actions.GuildRolesPositionUpdate.handle({guild_id:t,roles:e}).guild)}addMessageReaction(t,e){return this.rest.makeRequest("put",i.Endpoints.selfMessageReaction(t.channel.id,t.id,e),!0).then(()=>this.rest.client.actions.MessageReactionAdd.handle({user_id:this.rest.client.user.id,message_id:t.id,emoji:o(e),channel_id:t.channel.id}).reaction)}removeMessageReaction(t,e,n){let s=i.Endpoints.selfMessageReaction(t.channel.id,t.id,e);return n.id!==this.rest.client.user.id&&(s=i.Endpoints.userMessageReaction(t.channel.id,t.id,e,null,n.id)),this.rest.makeRequest("delete",s,!0).then(()=>this.rest.client.actions.MessageReactionRemove.handle({user_id:n.id,message_id:t.id,emoji:o(e),channel_id:t.channel.id}).reaction)}removeMessageReactions(t){return this.rest.makeRequest("delete",i.Endpoints.messageReactions(t.channel.id,t.id),!0).then(()=>t)}getMessageReactionUsers(t,e,n=100){return this.rest.makeRequest("get",i.Endpoints.messageReaction(t.channel.id,t.id,e,n),!0)}getMyApplication(){return this.rest.makeRequest("get",i.Endpoints.myApplication,!0).then(t=>new p(this.rest.client,t))}setNote(t,e){return this.rest.makeRequest("put",i.Endpoints.note(t.id),!0,{note:e}).then(()=>t)}}t.exports=m},function(t,e,n){const i=n(53);class s extends i{constructor(t,e){super(t,e),this.requestRemaining=1,this.first=!0}push(t){super.push(t),this.handle()}handleNext(t){this.waiting||(this.waiting=!0,this.restManager.client.setTimeout(()=>{this.requestRemaining=this.requestLimit,this.waiting=!1,this.handle()},t))}execute(t){t.request.gen().end((e,n)=>{if(n&&n.headers&&(this.requestLimit=n.headers["x-ratelimit-limit"],this.requestResetTime=1e3*Number(n.headers["x-ratelimit-reset"]),this.requestRemaining=Number(n.headers["x-ratelimit-remaining"]),this.timeDifference=Date.now()-new Date(n.headers.date).getTime(),this.handleNext(this.requestResetTime-Date.now()+this.timeDifference+this.restManager.client.options.restTimeOffset)),e)429===e.status?(this.requestRemaining=0,this.queue.unshift(t),this.restManager.client.setTimeout(()=>{this.globalLimit=!1,this.handle()},Number(n.headers["retry-after"])+this.restManager.client.options.restTimeOffset),n.headers["x-ratelimit-global"]&&(this.globalLimit=!0)):t.reject(e);else{this.globalLimit=!1;const e=n&&n.body?n.body:{};t.resolve(e),this.first&&(this.first=!1,this.handle())}})}handle(){if(super.handle(),!(this.requestRemaining<1||0===this.queue.length||this.globalLimit))for(;this.queue.length>0&&this.requestRemaining>0;)this.execute(this.queue.shift()),this.requestRemaining--}}t.exports=s},function(t,e,n){const i=n(53);class s extends i{constructor(t,e){super(t,e),this.waiting=!1,this.endpoint=e,this.timeDifference=0}push(t){super.push(t),this.handle()}execute(t){return new Promise(e=>{t.request.gen().end((n,i)=>{if(i&&i.headers&&(this.requestLimit=i.headers["x-ratelimit-limit"],this.requestResetTime=1e3*Number(i.headers["x-ratelimit-reset"]),this.requestRemaining=Number(i.headers["x-ratelimit-remaining"]),this.timeDifference=Date.now()-new Date(i.headers.date).getTime()),n)429===n.status?(this.restManager.client.setTimeout(()=>{this.waiting=!1,this.globalLimit=!1,e()},Number(i.headers["retry-after"])+this.restManager.client.options.restTimeOffset),i.headers["x-ratelimit-global"]&&(this.globalLimit=!0)):(this.queue.shift(),this.waiting=!1,t.reject(n),e(n));else{this.queue.shift(),this.globalLimit=!1;const n=i&&i.body?i.body:{};t.resolve(n),0===this.requestRemaining?this.restManager.client.setTimeout(()=>{this.waiting=!1,e(n)},this.requestResetTime-Date.now()+this.timeDifference+this.restManager.client.options.restTimeOffset):(this.waiting=!1,e(n))}})})}handle(){if(super.handle(),!this.waiting&&0!==this.queue.length&&!this.globalLimit){this.waiting=!0;const t=this.queue[0];this.execute(t).then(()=>this.handle())}}}t.exports=s},function(t,e,n){const i=n(0);class s{constructor(t){this.restManager=t,this._userAgent={url:"https://github.com/hydrabolt/discord.js",version:i.Package.version}}set(t){this._userAgent.url=t.url||"https://github.com/hydrabolt/discord.js",this._userAgent.version=t.version||i.Package.version}get userAgent(){return`DiscordBot (${this._userAgent.url}, ${this._userAgent.version})`}}t.exports=s},function(t,e,n){(function(e){const i="undefined"!=typeof window,s=n(21).EventEmitter,r=n(0),o=n(54),a=n(67),h=n(50),u=n(116);let c,l,d=JSON.stringify;if(i)c=window.WebSocket;else{try{c=n(158)}catch(t){c=n(159)}try{l=n(157),d=l.pack}catch(t){l=null}}class f extends s{constructor(t){super(),this.client=t,this.packetManager=new u(this),this.status=r.Status.IDLE,this.sessionID=null,this.sequence=-1,this.gateway=null,this.normalReady=!1,this.ws=null,this.disabledEvents={};for(const e of t.options.disabledEvents)this.disabledEvents[e]=!0;this.first=!0,this.lastHeartbeatAck=!0}_connect(t){this.client.emit("debug",`Connecting to gateway ${t}`),this.normalReady=!1,this.status!==r.Status.RECONNECTING&&(this.status=r.Status.CONNECTING),this.ws=new c(t),i&&(this.ws.binaryType="arraybuffer"),this.ws.onopen=this.eventOpen.bind(this),this.ws.onmessage=this.eventMessage.bind(this),this.ws.onclose=this.eventClose.bind(this),this.ws.onerror=this.eventError.bind(this),this._queue=[],this._remaining=120,this.client.setInterval(()=>{this._remaining=120,this._remainingReset=Date.now()},6e4)}connect(t){t=`${t}&encoding=${l?"etf":"json"}`,this.first?(this._connect(t),this.first=!1):this.client.setTimeout(()=>this._connect(t),5500)}heartbeat(t){return t&&!this.lastHeartbeatAck?void this.ws.close(1007):(this.client.emit("debug","Sending heartbeat"),this.client._pingTimestamp=Date.now(),this.client.ws.send({op:r.OPCodes.HEARTBEAT,d:this.sequence},!0),void(this.lastHeartbeatAck=!1))}send(t,e=false){return e?void this._send(d(t)):(this._queue.push(d(t)),void this.doQueue())}destroy(){this.ws.close(1e3),this._queue=[],this.status=r.Status.IDLE}_send(t){this.ws.readyState===c.OPEN&&(this.emit("send",t),this.ws.send(t))}doQueue(){const t=this._queue[0];if(this.ws.readyState===c.OPEN&&t){if(0===this.remaining)return void this.client.setTimeout(this.doQueue.bind(this),Date.now()-this.remainingReset);this._remaining--,this._send(t),this._queue.shift(),this.doQueue()}}eventOpen(){this.client.emit("debug","Connection to gateway opened"),this.lastHeartbeatAck=!0,this.status===r.Status.RECONNECTING?this._sendResume():this._sendNewIdentify()}_sendResume(){if(!this.sessionID)return void this._sendNewIdentify();this.client.emit("debug","Identifying as resumed session");const t={token:this.client.token,session_id:this.sessionID,seq:this.sequence};this.send({op:r.OPCodes.RESUME,d:t})}_sendNewIdentify(){this.reconnecting=!1;const t=this.client.options.ws;t.token=this.client.token,this.client.options.shardCount>0&&(t.shard=[Number(this.client.options.shardId),Number(this.client.options.shardCount)]),this.client.emit("debug","Identifying as new session"),this.send({op:r.OPCodes.IDENTIFY,d:t}),this.sequence=-1}eventClose(t){this.emit("close",t),this.client.clearInterval(this.client.manager.heartbeatInterval),this.status=r.Status.DISCONNECTED,this._queue=[],this.reconnecting||this.client.emit(r.Events.DISCONNECT,t),4004!==t.code&&4010!==t.code&&(this.reconnecting||1e3===t.code||this.tryReconnect())}eventMessage(t){const e=this.tryParseEventData(t.data);return null===e?(this.eventError(new Error(r.Errors.BAD_WS_MESSAGE)),!1):(this.client.emit("raw",e),e.op===r.OPCodes.HELLO&&this.client.manager.setupKeepAlive(e.d.heartbeat_interval),this.packetManager.handle(e))}parseEventData(t){return l?(t instanceof ArrayBuffer&&(t=o(t)),l.unpack(t)):(t instanceof ArrayBuffer?t=a.inflate(t,{to:"string"}):t instanceof e&&(t=h.inflateSync(t).toString()),JSON.parse(t))}tryParseEventData(t){try{return this.parseEventData(t)}catch(t){return null}}eventError(t){this.client.listenerCount("error")>0&&this.client.emit("error",t),this.tryReconnect()}_emitReady(t=true){this.status=r.Status.READY,this.client.emit(r.Events.READY),this.packetManager.handleQueue(),this.normalReady=t}checkIfReady(){if(this.status!==r.Status.READY&&this.status!==r.Status.NEARLY){let t=0;for(const e of this.client.guilds.keys())t+=this.client.guilds.get(e).available?0:1;if(0===t){if(this.status=r.Status.NEARLY,this.client.options.fetchAllMembers){const t=this.client.guilds.map(t=>t.fetchMembers());return void Promise.all(t).then(()=>this._emitReady(),t=>{this.client.emit(r.Events.WARN,"Error in pre-ready guild member fetching"),this.client.emit(r.Events.ERROR,t),this._emitReady()})}this._emitReady()}}}tryReconnect(){this.status!==r.Status.RECONNECTING&&this.status!==r.Status.CONNECTING&&(this.status=r.Status.RECONNECTING,this.ws.close(),this.packetManager.handleQueue(),this.client.emit(r.Events.RECONNECTING),this.connect(this.client.ws.gateway))}}t.exports=f}).call(e,n(20).Buffer)},function(t,e,n){const i=n(0),s=[i.WSEvents.READY,i.WSEvents.GUILD_CREATE,i.WSEvents.GUILD_DELETE,i.WSEvents.GUILD_MEMBERS_CHUNK,i.WSEvents.GUILD_MEMBER_ADD,i.WSEvents.GUILD_MEMBER_REMOVE];class r{constructor(t){this.ws=t,this.handlers={},this.queue=[],this.register(i.WSEvents.READY,n(143)),this.register(i.WSEvents.GUILD_CREATE,n(123)),this.register(i.WSEvents.GUILD_DELETE,n(124)),this.register(i.WSEvents.GUILD_UPDATE,n(134)),this.register(i.WSEvents.GUILD_BAN_ADD,n(121)),this.register(i.WSEvents.GUILD_BAN_REMOVE,n(122)),this.register(i.WSEvents.GUILD_MEMBER_ADD,n(126)),this.register(i.WSEvents.GUILD_MEMBER_REMOVE,n(127)),this.register(i.WSEvents.GUILD_MEMBER_UPDATE,n(128)),this.register(i.WSEvents.GUILD_ROLE_CREATE,n(130)),this.register(i.WSEvents.GUILD_ROLE_DELETE,n(131)),this.register(i.WSEvents.GUILD_ROLE_UPDATE,n(132)),this.register(i.WSEvents.GUILD_EMOJIS_UPDATE,n(125)),this.register(i.WSEvents.GUILD_MEMBERS_CHUNK,n(129)),this.register(i.WSEvents.CHANNEL_CREATE,n(117)),this.register(i.WSEvents.CHANNEL_DELETE,n(118)),this.register(i.WSEvents.CHANNEL_UPDATE,n(120)),this.register(i.WSEvents.CHANNEL_PINS_UPDATE,n(119)),this.register(i.WSEvents.PRESENCE_UPDATE,n(142)),this.register(i.WSEvents.USER_UPDATE,n(148)),this.register(i.WSEvents.USER_NOTE_UPDATE,n(147)),this.register(i.WSEvents.VOICE_STATE_UPDATE,n(150)),this.register(i.WSEvents.TYPING_START,n(146)),this.register(i.WSEvents.MESSAGE_CREATE,n(135)),this.register(i.WSEvents.MESSAGE_DELETE,n(136)),this.register(i.WSEvents.MESSAGE_UPDATE,n(141)),this.register(i.WSEvents.MESSAGE_DELETE_BULK,n(137)),this.register(i.WSEvents.VOICE_SERVER_UPDATE,n(149)),this.register(i.WSEvents.GUILD_SYNC,n(133)),this.register(i.WSEvents.RELATIONSHIP_ADD,n(144)),this.register(i.WSEvents.RELATIONSHIP_REMOVE,n(145)),this.register(i.WSEvents.MESSAGE_REACTION_ADD,n(138)),this.register(i.WSEvents.MESSAGE_REACTION_REMOVE,n(139)),this.register(i.WSEvents.MESSAGE_REACTION_REMOVE_ALL,n(140))}get client(){return this.ws.client}register(t,e){this.handlers[t]=new e(this)}handleQueue(){this.queue.forEach((t,e)=>{this.handle(this.queue[e]),this.queue.splice(e,1)})}setSequence(t){t&&t>this.ws.sequence&&(this.ws.sequence=t)}handle(t){return t.op===i.OPCodes.RECONNECT?(this.setSequence(t.s),this.ws.tryReconnect(),!1):t.op===i.OPCodes.INVALID_SESSION?(t.d?setTimeout(()=>{this.ws._sendResume()},2500):(this.ws.sessionID=null,this.ws._sendNewIdentify()),!1):(t.op===i.OPCodes.HEARTBEAT_ACK&&(this.ws.client._pong(this.ws.client._pingTimestamp),this.ws.lastHeartbeatAck=!0,this.ws.client.emit("debug","Heartbeat acknowledged")),t.op===i.OPCodes.HEARTBEAT&&(this.client.ws.send({op:i.OPCodes.HEARTBEAT}),this.ws.client.emit("debug","Recieved gateway heartbeat!")),this.ws.status===i.Status.RECONNECTING&&(this.ws.reconnecting=!1,this.ws.checkIfReady()),this.setSequence(t.s),void 0===this.ws.disabledEvents[t.t]&&(this.ws.status!==i.Status.READY&&s.indexOf(t.t)===-1?(this.queue.push(t),!1):!!this.handlers[t.t]&&this.handlers[t.t].handle(t)))}}t.exports=r},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.actions.ChannelCreate.handle(n)}}t.exports=s},function(t,e,n){const i=n(1),s=n(0);class r extends i{handle(t){const e=this.packetManager.client,n=t.d,i=e.actions.ChannelDelete.handle(n);i.channel&&e.emit(s.Events.CHANNEL_DELETE,i.channel)}}t.exports=r},function(t,e,n){const i=n(1),s=n(0);class r extends i{handle(t){const e=this.packetManager.client,n=t.d,i=e.channels.get(n.channel_id),r=new Date(n.last_pin_timestamp);i&&r&&e.emit(s.Events.CHANNEL_PINS_UPDATE,i,r)}}t.exports=r},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.actions.ChannelUpdate.handle(n)}}t.exports=s},function(t,e,n){const i=n(1),s=n(0);class r extends i{handle(t){const e=this.packetManager.client,n=t.d,i=e.guilds.get(n.guild_id),r=e.users.get(n.user.id);i&&r&&e.emit(s.Events.GUILD_BAN_ADD,i,r)}}t.exports=r},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.actions.GuildBanRemove.handle(n)}}t.exports=s},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d,i=e.guilds.get(n.id);i?i.available||n.unavailable||(i.setup(n),this.packetManager.ws.checkIfReady()):e.dataManager.newGuild(n)}}t.exports=s},function(t,e,n){const i=n(1),s=n(0);class r extends i{handle(t){const e=this.packetManager.client,n=t.d,i=e.actions.GuildDelete.handle(n);i.guild&&e.emit(s.Events.GUILD_DELETE,i.guild)}}t.exports=r},function(t,e,n){function i(t){const e=new Map;for(const n of t)e.set(...n);return e}const s=n(1);class r extends s{handle(t){const e=this.packetManager.client,n=t.d,s=e.guilds.get(n.guild_id);if(s&&s.emojis){const t=i(s.emojis.entries());for(const r of n.emojis){const n=s.emojis.get(r.id);n?(t.delete(r.id),n.equals(r,!0)||e.actions.GuildEmojiUpdate.handle(n,r)):e.actions.GuildEmojiCreate.handle(s,r)}for(const r of t.values())e.actions.GuildEmojiDelete.handle(r)}}}t.exports=r},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d,i=e.guilds.get(n.guild_id);i&&(i.memberCount++,i._addMember(n))}}t.exports=s},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.actions.GuildMemberRemove.handle(n)}}t.exports=s},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d,i=e.guilds.get(n.guild_id);if(i){const t=i.members.get(n.user.id);t&&i._updateMember(t,n)}}}t.exports=s},function(t,e,n){const i=n(1),s=n(0);class r extends i{handle(t){const e=this.packetManager.client,n=t.d,i=e.guilds.get(n.guild_id);if(i){const t=n.members.map(t=>i._addMember(t,!1));i._checkChunks(),e.emit(s.Events.GUILD_MEMBERS_CHUNK,t),e.ws.lastHeartbeatAck=!0}}}t.exports=r},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.actions.GuildRoleCreate.handle(n)}}t.exports=s},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.actions.GuildRoleDelete.handle(n)}}t.exports=s},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.actions.GuildRoleUpdate.handle(n)}}t.exports=s},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.actions.GuildSync.handle(n)}}t.exports=s},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.actions.GuildUpdate.handle(n)}}t.exports=s},function(t,e,n){const i=n(1),s=n(0);class r extends i{handle(t){const e=this.packetManager.client,n=t.d,i=e.actions.MessageCreate.handle(n);i.message&&e.emit(s.Events.MESSAGE_CREATE,i.message)}}t.exports=r},function(t,e,n){const i=n(1),s=n(0);class r extends i{handle(t){const e=this.packetManager.client,n=t.d,i=e.actions.MessageDelete.handle(n);i.message&&e.emit(s.Events.MESSAGE_DELETE,i.message)}}t.exports=r},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.actions.MessageDeleteBulk.handle(n)}}t.exports=s},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.actions.MessageReactionAdd.handle(n)}}t.exports=s},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.actions.MessageReactionRemove.handle(n)}}t.exports=s},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.actions.MessageReactionRemoveAll.handle(n)}}t.exports=s},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.actions.MessageUpdate.handle(n)}}t.exports=s},function(t,e,n){const i=n(1),s=n(0),r=n(4);class o extends i{handle(t){const e=this.packetManager.client,n=t.d;let i=e.users.get(n.user.id);const o=e.guilds.get(n.guild_id);if(!i){if(!n.user.username)return;i=e.dataManager.newUser(n.user)}const a=r(i);if(i.patch(n.user),i.equals(a)||e.emit(s.Events.USER_UPDATE,a,i),o){let t=o.members.get(i.id);if(t||"offline"===n.status||(t=o._addMember({user:i,roles:n.roles,deaf:!1,mute:!1},!1),e.emit(s.Events.GUILD_MEMBER_AVAILABLE,t)),t){const a=r(t);t.presence&&(a.frozenPresence=r(t.presence)),o._setPresence(i.id,n),e.emit(s.Events.PRESENCE_UPDATE,a,t)}else o._setPresence(i.id,n)}}}t.exports=o},function(t,e,n){const i=n(1),s=n(29);class r extends i{handle(t){const e=this.packetManager.client,n=t.d;e.ws.heartbeat();const i=new s(e,n.user);e.user=i,e.readyAt=new Date,e.users.set(i.id,i);for(const r of n.guilds)e.dataManager.newGuild(r);for(const o of n.private_channels)e.dataManager.newChannel(o);for(const a of n.relationships){const t=e.dataManager.newUser(a.user);1===a.type?e.user.friends.set(t.id,t):2===a.type&&e.user.blocked.set(t.id,t)}n.presences=n.presences||[];for(const h of n.presences)e.dataManager.newUser(h.user),e._setPresence(h.user.id,h);if(n.notes)for(const u in n.notes){let t=n.notes[u];t.length||(t=null),e.user.notes.set(u,t)}!e.user.bot&&e.options.sync&&e.setInterval(e.syncGuilds.bind(e),3e4),e.once("ready",e.syncGuilds.bind(e)),e.users.has("1")||e.dataManager.newUser({id:"1",username:"Clyde",discriminator:"0000",avatar:"https://discordapp.com/assets/f78426a064bc9dd24847519259bc42af.png",bot:!0,status:"online",game:null,verified:!0}),e.setTimeout(()=>{e.ws.normalReady||e.ws._emitReady(!1)},1200*n.guilds.length),this.packetManager.ws.sessionID=n.session_id,this.packetManager.ws.checkIfReady()}}t.exports=r},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;1===n.type?e.fetchUser(n.id).then(t=>{e.user.friends.set(t.id,t)}):2===n.type&&e.fetchUser(n.id).then(t=>{e.user.blocked.set(t.id,t)})}}t.exports=s},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;2===n.type?e.user.blocked.has(n.id)&&e.user.blocked.delete(n.id):1===n.type&&e.user.friends.has(n.id)&&e.user.friends.delete(n.id)}}t.exports=s},function(t,e,n){function i(t,e){return t.client.setTimeout(()=>{t.client.emit(r.Events.TYPING_STOP,t,e,t._typing.get(e.id)),t._typing.delete(e.id)},6e3)}const s=n(1),r=n(0);class o extends s{handle(t){const e=this.packetManager.client,n=t.d,s=e.channels.get(n.channel_id),o=e.users.get(n.user_id),h=new Date(1e3*n.timestamp);if(s&&o){if("voice"===s.type)return void e.emit(r.Events.WARN,`Discord sent a typing packet to voice channel ${s.id}`);if(s._typing.has(o.id)){const t=s._typing.get(o.id);t.lastTimestamp=h,t.resetTimeout(i(s,o))}else s._typing.set(o.id,new a(e,h,h,i(s,o))),e.emit(r.Events.TYPING_START,s,o)}}}class a{constructor(t,e,n,i){this.client=t,this.since=e,this.lastTimestamp=n,this._timeout=i}resetTimeout(t){this.client.clearTimeout(this._timeout),this._timeout=t}get elapsedTime(){return Date.now()-this.since}}t.exports=o},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.actions.UserNoteUpdate.handle(n)}}t.exports=s},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.actions.UserUpdate.handle(n)}}t.exports=s},function(t,e,n){const i=n(1);class s extends i{handle(t){const e=this.packetManager.client,n=t.d;e.emit("self.voiceServer",n)}}t.exports=s},function(t,e,n){const i=n(1),s=n(0),r=n(4);class o extends i{handle(t){const e=this.packetManager.client,n=t.d,i=e.guilds.get(n.guild_id);if(i){const t=i.members.get(n.user_id);if(t){const i=r(t);t.voiceChannel&&t.voiceChannel.id!==n.channel_id&&t.voiceChannel.members.delete(i.id),n.channel_id||(t.speaking=null),t.user.id===e.user.id&&n.channel_id&&e.emit("self.voiceStateUpdate",n);const o=e.channels.get(n.channel_id);o&&o.members.set(t.user.id,t),t.serverMute=n.mute,t.serverDeaf=n.deaf,t.selfMute=n.self_mute,t.selfDeaf=n.self_deaf,t.voiceSessionID=n.session_id,t.voiceChannelID=n.channel_id,e.emit(s.Events.VOICE_STATE_UPDATE,i,t)}}}}t.exports=o},function(t,e){class n{constructor(t,e){this.user=t,this.setup(e)}setup(t){this.type=t.type,this.name=t.name,this.id=t.id,this.revoked=t.revoked,this.integrations=t.integrations}}t.exports=n},function(t,e,n){const i=n(3),s=n(151);class r{constructor(t,e){this.user=t,Object.defineProperty(this,"client",{value:t.client}),this.mutualGuilds=new i,this.connections=new i,this.setup(e)}setup(t){this.premium=t.premium;for(const e of t.mutual_guilds)this.client.guilds.has(e.id)&&this.mutualGuilds.set(e.id,this.client.guilds.get(e.id));for(const n of t.connected_accounts)this.connections.set(n.id,new s(this.user,n))}}t.exports=r},function(t,e){t.exports=function(t,e){if(t===e)return!0;if(t.length!==e.length)return!1;for(const n in t){const i=t[n],s=e.indexOf(i);s&&e.splice(s,1)}return 0===e.length}},function(t,e){t.exports=function(t){if(t.includes("%")&&(t=decodeURIComponent(t)),t.includes(":")){const[e,n]=t.split(":");return{name:e,id:n}}return{name:t,id:null}}},function(t,e){},function(t,e){},function(t,e){},function(t,e){},function(t,e){}]); \ No newline at end of file