UNPKG

entity-serves

Version:

Backend for entity.works, a Dead by Daylight wiki.

6 lines 31.4 kB
#!/usr/bin/env node /*! *** EntityServes 3.0.0 *** Copyright © 2020, Jaid <jaid.jsx@gmail.com> (https://github.com/Jaid) *** @license MIT !*/!function(t){var e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={i:n,l:!1,exports:{}};return t[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}r.m=t,r.c=e,r.d=function(t,e,n){r.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,e){if(1&e&&(t=r(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)r.d(n,o,function(e){return t[e]}.bind(null,o));return n},r.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(e,"a",e),e},r.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},r.p="",r(r.s=74)}([function(t,e){t.exports=require("sequelize")},function(t,e,r){"use strict";r.r(e),r.d(e,"schema",(function(){return s}));var n=r(39),o=r(0),i=r.n(o),a=r(69),u=r.n(a);class c extends i.a.Model{static associate(t){c.belongsTo(t.User,{foreignKey:{allowNull:!1}})}static async addBuild(t,e,r){return await c.create({type:t,UserId:e,data:r,linkId:u.a.time(),seoLinkId:Object(n.paramCase)(r.title||Object(n.paramCase)(t))})}}const s={type:{type:i.a.STRING(32),allowNull:!1},data:{type:i.a.JSONB,allowNull:!1},linkId:{type:i.a.STRING(64),allowNull:!1,unique:!0},seoLinkId:i.a.STRING};e.default=c},function(t,e,r){"use strict";r.r(e),r.d(e,"schema",(function(){return u}));var n=r(0),o=r.n(n),i=r(14);class a extends o.a.Model{static associate(t){}async createLogin(){return await i.default.create({UserId:this.id})}}const u={title:{type:o.a.STRING(64),allowNull:!1},name:{type:o.a.STRING(64),allowNull:!1,unique:!0},password:{type:o.a.CHAR(60),allowNull:!1}};e.default=a},function(t,e,r){var n=r(42),o="object"==typeof self&&self&&self.Object===Object&&self,i=n||o||Function("return this")();t.exports=i},function(t,e){var r=Array.isArray;t.exports=r},function(t,e,r){"use strict";r.d(e,"b",(function(){return c}));var n=r(11),o=r.n(n),i=r(67),a=r.n(i);const u=new o.a({name:"EntityServes",version:"3.0.0",insecurePort:13251,database:"entityServes",useGot:!0,databaseExtensions:"hstore",koaSession:{key:"abc"},configSetup:{defaults:a()}}),c=u.logger;u.got,u.config,u.appFolder,u.koa,e.a=u},function(t,e){t.exports=function(t){return null!=t&&"object"==typeof t}},function(t,e,r){var n=r(91),o=r(94);t.exports=function(t,e){var r=o(t,e);return n(r)?r:void 0}},function(t,e,r){var n=r(4),o=r(82),i=r(85),a=r(109);t.exports=function(t,e){return n(t)?t:o(t,e)?[t]:i(a(t))}},function(t,e,r){var n=r(12),o=r(83),i=r(84),a=n?n.toStringTag:void 0;t.exports=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":a&&a in Object(t)?o(t):i(t)}},function(t,e){t.exports=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}},function(t,e){t.exports=require("jaid-core")},function(t,e,r){var n=r(3).Symbol;t.exports=n},function(t,e,r){var n=r(24),o=r(48);t.exports=function(t,e,r,i){var a=!r;r||(r={});for(var u=-1,c=e.length;++u<c;){var s=e[u],f=i?i(r[s],t[s],s,r,t):void 0;void 0===f&&(f=t[s]),a?o(r,s,f):n(r,s,f)}return r}},function(t,e,r){"use strict";r.r(e),r.d(e,"schema",(function(){return a}));var n=r(0),o=r.n(n);class i extends o.a.Model{static associate(t){i.belongsTo(t.User,{foreignKey:{allowNull:!1}})}}const a={apiKey:{type:o.a.UUID,defaultValue:o.a.UUIDV4,allowNull:!1,unique:!0}};e.default=i},function(t,e,r){var n=r(7)(Object,"create");t.exports=n},function(t,e,r){var n=r(99),o=r(100),i=r(101),a=r(102),u=r(103);function c(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}c.prototype.clear=n,c.prototype.delete=o,c.prototype.get=i,c.prototype.has=a,c.prototype.set=u,t.exports=c},function(t,e,r){var n=r(46);t.exports=function(t,e){for(var r=t.length;r--;)if(n(t[r][0],e))return r;return-1}},function(t,e,r){var n=r(105);t.exports=function(t,e){var r=t.__data__;return n(e)?r["string"==typeof e?"string":"hash"]:r.map}},function(t,e,r){var n=r(22);t.exports=function(t){if("string"==typeof t||n(t))return t;var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}},function(t,e,r){var n=r(47),o=r(126),i=r(167),a=r(8),u=r(13),c=r(170),s=r(50),f=r(60),l=s((function(t,e){var r={};if(null==t)return r;var s=!1;e=n(e,(function(e){return e=a(e,t),s||(s=e.length>1),e})),u(t,f(t),r),s&&(r=o(r,7,c));for(var l=e.length;l--;)i(r,e[l]);return r}));t.exports=l},function(t,e){t.exports=require("bcrypt")},function(t,e,r){var n=r(9),o=r(6);t.exports=function(t){return"symbol"==typeof t||o(t)&&"[object Symbol]"==n(t)}},function(t,e,r){var n=r(7)(r(3),"Map");t.exports=n},function(t,e,r){var n=r(48),o=r(46),i=Object.prototype.hasOwnProperty;t.exports=function(t,e,r){var a=t[e];i.call(t,e)&&o(a,r)&&(void 0!==r||e in t)||n(t,e,r)}},function(t,e){var r=/^(?:0|[1-9]\d*)$/;t.exports=function(t,e){var n=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==n||"symbol"!=n&&r.test(t))&&t>-1&&t%1==0&&e>t}},function(t,e,r){var n=r(115),o=r(6),i=Object.prototype,a=i.hasOwnProperty,u=i.propertyIsEnumerable,c=n(function(){return arguments}())?n:function(t){return o(t)&&a.call(t,"callee")&&!u.call(t,"callee")};t.exports=c},function(t,e){t.exports=function(t){return"number"==typeof t&&t>-1&&t%1==0&&9007199254740991>=t}},function(t,e){t.exports=function(t,e){for(var r=-1,n=e.length,o=t.length;++r<n;)t[o+r]=e[r];return t}},function(t,e,r){var n=r(52),o=r(139),i=r(55);t.exports=function(t){return i(t)?n(t):o(t)}},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}},function(t,e){t.exports=function(t){return function(e){return t(e)}}},function(t,e,r){(function(t){var n=r(42),o=e&&!e.nodeType&&e,i=o&&"object"==typeof t&&t&&!t.nodeType&&t,a=i&&i.exports===o&&n.process,u=function(){try{return i&&i.require&&i.require("util").types||a&&a.binding&&a.binding("util")}catch(t){}}();t.exports=u}).call(this,r(30)(t))},function(t,e){var r=Object.prototype;t.exports=function(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||r)}},function(t,e,r){var n=r(147),o=r(57),i=Object.prototype.propertyIsEnumerable,a=Object.getOwnPropertySymbols,u=a?function(t){return null==t?[]:(t=Object(t),n(a(t),(function(e){return i.call(t,e)})))}:o;t.exports=u},function(t,e,r){var n=r(54)(Object.getPrototypeOf,Object);t.exports=n},function(t,e,r){var n=r(150),o=r(23),i=r(151),a=r(152),u=r(153),c=r(9),s=r(45),f=s(n),l=s(o),p=s(i),d=s(a),v=s(u),y=c;(n&&"[object DataView]"!=y(new n(new ArrayBuffer(1)))||o&&"[object Map]"!=y(new o)||i&&"[object Promise]"!=y(i.resolve())||a&&"[object Set]"!=y(new a)||u&&"[object WeakMap]"!=y(new u))&&(y=function(t){var e=c(t),r="[object Object]"==e?t.constructor:void 0,n=r?s(r):"";if(n)switch(n){case f:return"[object DataView]";case l:return"[object Map]";case p:return"[object Promise]";case d:return"[object Set]";case v:return"[object WeakMap]"}return e}),t.exports=y},function(t,e,r){var n=r(156);t.exports=function(t){var e=new t.constructor(t.byteLength);return new n(e).set(new n(t)),e}},function(t,e){t.exports=function(t){var e=null==t?0:t.length;return e?t[e-1]:void 0}},function(t,e){t.exports=require("param-case")},function(t,e,r){"use strict";r.r(e);var n=r(73),o=r.n(n),i=r(1),a=r(2);e.default=async(t,e)=>{if(!t.userId)return{error:"Not logged in!"};const r=await a.default.findByPk(t.userId),n=await i.default.addBuild(e.formType,r.id,e.formData);return o()(n,["linkId","seoLinkId"])}},function(t,e,r){var n=r(8),o=r(19);t.exports=function(t,e){for(var r=0,i=(e=n(e,t)).length;null!=t&&i>r;)t=t[o(e[r++])];return r&&r==i?t:void 0}},function(t,e){var r="object"==typeof global&&global&&global.Object===Object&&global;t.exports=r},function(t,e,r){var n=r(88),o=r(104),i=r(106),a=r(107),u=r(108);function c(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}c.prototype.clear=n,c.prototype.delete=o,c.prototype.get=i,c.prototype.has=a,c.prototype.set=u,t.exports=c},function(t,e,r){var n=r(9),o=r(10);t.exports=function(t){if(!o(t))return!1;var e=n(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e}},function(t,e){var r=Function.prototype.toString;t.exports=function(t){if(null!=t){try{return r.call(t)}catch(t){}try{return t+""}catch(t){}}return""}},function(t,e){t.exports=function(t,e){return t===e||t!=t&&e!=e}},function(t,e){t.exports=function(t,e){for(var r=-1,n=null==t?0:t.length,o=Array(n);++r<n;)o[r]=e(t[r],r,t);return o}},function(t,e,r){var n=r(49);t.exports=function(t,e,r){"__proto__"==e&&n?n(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}},function(t,e,r){var n=r(7),o=function(){try{var t=n(Object,"defineProperty");return t({},"",{}),t}catch(t){}}();t.exports=o},function(t,e,r){var n=r(116),o=r(119),i=r(121);t.exports=function(t){return i(o(t,void 0,n),t+"")}},function(t,e,r){"use strict";r.r(e);var n=r(20),o=r.n(n),i=r(1),a=r(2);e.default=async(t,e)=>{const r=await i.default.findOne({where:{linkId:e},attributes:["UserId","data","type","createdAt","updatedAt"],raw:!0});if(!r)return null;const n=await a.default.findByPk(r.UserId,{attributes:["name","title"],raw:!0});return{...o()(r,"UserId"),userName:n.name,userTitle:n.title}}},function(t,e,r){var n=r(135),o=r(26),i=r(4),a=r(53),u=r(25),c=r(137),s=Object.prototype.hasOwnProperty;t.exports=function(t,e){var r=i(t),f=!r&&o(t),l=!r&&!f&&a(t),p=!r&&!f&&!l&&c(t),d=r||f||l||p,v=d?n(t.length,String):[],y=v.length;for(var b in t)!e&&!s.call(t,b)||d&&("length"==b||l&&("offset"==b||"parent"==b)||p&&("buffer"==b||"byteLength"==b||"byteOffset"==b)||u(b,y))||v.push(b);return v}},function(t,e,r){(function(t){var n=r(3),o=r(136),i=e&&!e.nodeType&&e,a=i&&"object"==typeof t&&t&&!t.nodeType&&t,u=a&&a.exports===i?n.Buffer:void 0,c=(u?u.isBuffer:void 0)||o;t.exports=c}).call(this,r(30)(t))},function(t,e){t.exports=function(t,e){return function(r){return t(e(r))}}},function(t,e,r){var n=r(44),o=r(27);t.exports=function(t){return null!=t&&o(t.length)&&!n(t)}},function(t,e,r){var n=r(52),o=r(142),i=r(55);t.exports=function(t){return i(t)?n(t,!0):o(t)}},function(t,e){t.exports=function(){return[]}},function(t,e,r){var n=r(28),o=r(35),i=r(34),a=r(57),u=Object.getOwnPropertySymbols?function(t){for(var e=[];t;)n(e,i(t)),t=o(t);return e}:a;t.exports=u},function(t,e,r){var n=r(28),o=r(4);t.exports=function(t,e,r){var i=e(t);return o(t)?i:n(i,r(t))}},function(t,e,r){var n=r(59),o=r(58),i=r(56);t.exports=function(t){return n(t,i,o)}},function(t,e,r){"use strict";r.r(e);var n=r(0),o=r.n(n),i=r(1);e.default=async()=>{const t=await i.default.findAll({attributes:["type",[o.a.fn("COUNT","id"),"count"]],group:["type"],raw:!0});return Object.values(t)}},function(t,e,r){"use strict";r.r(e);var n=r(1);e.default=async(t,e)=>{const r=await n.default.findAll({where:e.where,limit:e.limit||10,attributes:["data","type","linkId","seoLinkId","createdAt","updatedAt"],include:[{association:"User",attributes:["name","title"]}],order:[["updatedAt","DESC"]],raw:!0});return Object.values(r)}},function(t,e,r){"use strict";r.r(e);var n=r(20),o=r.n(n),i=r(1),a=r(2);e.default=async(t,e)=>{const r=e.toLowerCase(),n=await a.default.findOne({where:{name:r},attributes:["id","title","name","createdAt"],raw:!0});if(!n)return null;const u=await i.default.findAll({where:{UserId:n.id},limit:10,attributes:["data","type","linkId","seoLinkId","createdAt","updatedAt"],order:[["updatedAt","DESC"]],raw:!0});return{user:o()(n,"id"),latestBuilds:u}}},function(t,e,r){"use strict";r.r(e);var n=r(21),o=r.n(n),i=r(2);e.default=async(t,e)=>{const r=e.user.toLowerCase(),n=await i.default.findOne({where:{name:r}});if(!n)return{error:"User not found!"};if(!await o.a.compare(e.password,n.password))return{error:"Incorrect password!"};const a=await n.createLogin();return t.apiKey=a.apiKey,t.userId=n.id,{title:n.title,name:n.name,key:a.apiKey}}},function(t,e,r){"use strict";r.r(e);var n=r(21),o=r.n(n),i=r(2);e.default=async(t,e)=>{const r=e.user.toLowerCase();if(await i.default.findOne({where:{name:r}}))return{error:"Already exists!"};const n=await o.a.hash(e.password,5),a=await i.default.create({title:e.user,name:r,password:n}),u=await a.createLogin();return{title:a.title,name:a.name,key:u.apiKey}}},function(t,e){t.exports=require("yargs")},function(t,e){t.exports={twitchClientCallbackUrl:"https://server.preis.farm/auth/twitch/callback",loginRedirectUrl:"https://preis.farm",frontendHost:"entity.works"}},function(t,e){t.exports=require("jaid-core-dashboard")},function(t,e){t.exports=require("uniqid")},function(t,e){t.exports=require("cookie")},function(t,e){t.exports=require("socket.io")},function(t,e){t.exports=require("socket-enhance")},function(t,e,r){var n=r(80),o=r(50)((function(t,e){return null==t?{}:n(t,e)}));t.exports=o},function(t,e,r){"use strict";r.r(e);var n=r(66),o=r.n(n),i=r(5);function a(t){var e;(null===i.a||void 0===i.a||null===(e=i.a.logger)||void 0===e?void 0:e.error)?i.a.logger.error(t):console.error(t)}process.on("unhandledRejection",t=>{a(t?`Unhandled promise rejection: ${(null==t?void 0:t.message)||t}`:"Unhandled promise rejection"),(null==t?void 0:t.stack)&&a(t.stack)}),o.a.scriptName("entity-serves").version("3.0.0").command("$0","Backend for entity.works, a Dead by Daylight wiki.",{},(function(){(async function(){const t={},e=r(75);for(const r of e.keys()){const{pluginName:n}=r.match(/[/\\](?<pluginName>.+?)[/\\]index\.js$/).groups;t[n]=e(r).default}await i.a.init(t)})().catch(t=>{a("Core process crashed"),a(t),process.exit(1)})})).argv},function(t,e,r){var n={"./dashboard/index.js":76,"./main/index.js":77,"./socketServer/index.js":172};function o(t){var e=i(t);return r(e)}function i(t){if(!r.o(n,t)){var e=new Error("Cannot find module '"+t+"'");throw e.code="MODULE_NOT_FOUND",e}return n[t]}o.keys=function(){return Object.keys(n)},o.resolve=i,t.exports=o,o.id=75},function(t,e,r){"use strict";r.r(e);var n=r(68),o=r.n(n);e.default=new o.a},function(t,e,r){"use strict";r.r(e),r.d(e,"default",(function(){return o}));var n=r(11);r(0),r(1);class o extends n.JaidCorePlugin{collectModels(){const t={},e=r(78);for(const r of e.keys())t[r.match(/\.\/(?<key>[\da-z]+)\./i).groups.key]=e(r);return t}}},function(t,e,r){var n={"./Build.js":1,"./Login.js":14,"./User.js":2};function o(t){var e=i(t);return r(e)}function i(t){if(!r.o(n,t)){var e=new Error("Cannot find module '"+t+"'");throw e.code="MODULE_NOT_FOUND",e}return n[t]}o.keys=function(){return Object.keys(n)},o.resolve=i,t.exports=o,o.id=78},function(t,e,r){var n={"./addBuild":40,"./addBuild.js":40,"./getBuild":51,"./getBuild.js":51,"./getBuildTypes":61,"./getBuildTypes.js":61,"./getLatestBuilds":62,"./getLatestBuilds.js":62,"./getProfile":63,"./getProfile.js":63,"./login":64,"./login.js":64,"./register":65,"./register.js":65};function o(t){var e=i(t);return r(e)}function i(t){if(!r.o(n,t)){var e=new Error("Cannot find module '"+t+"'");throw e.code="MODULE_NOT_FOUND",e}return n[t]}o.keys=function(){return Object.keys(n)},o.resolve=i,t.exports=o,o.id=79},function(t,e,r){var n=r(81),o=r(112);t.exports=function(t,e){return n(t,e,(function(e,r){return o(t,r)}))}},function(t,e,r){var n=r(41),o=r(111),i=r(8);t.exports=function(t,e,r){for(var a=-1,u=e.length,c={};++a<u;){var s=e[a],f=n(t,s);r(f,s)&&o(c,i(s,t),f)}return c}},function(t,e,r){var n=r(4),o=r(22),i=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,a=/^\w*$/;t.exports=function(t,e){if(n(t))return!1;var r=typeof t;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=t&&!o(t))||a.test(t)||!i.test(t)||null!=e&&t in Object(e)}},function(t,e,r){var n=r(12),o=Object.prototype,i=o.hasOwnProperty,a=o.toString,u=n?n.toStringTag:void 0;t.exports=function(t){var e=i.call(t,u),r=t[u];try{t[u]=void 0;var n=!0}catch(t){}var o=a.call(t);return n&&(e?t[u]=r:delete t[u]),o}},function(t,e){var r=Object.prototype.toString;t.exports=function(t){return r.call(t)}},function(t,e,r){var n=r(86)((function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,(function(t,r,n,o){e.push(n?o.replace(/\\(\\)?/g,"$1"):r||t)})),e}));t.exports=n},function(t,e,r){var n=r(87);t.exports=function(t){var e=n(t,(function(t){return 500===r.size&&r.clear(),t})),r=e.cache;return e}},function(t,e,r){var n=r(43);function o(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new TypeError("Expected a function");var r=function(){var n=arguments,o=e?e.apply(this,n):n[0],i=r.cache;if(i.has(o))return i.get(o);var a=t.apply(this,n);return r.cache=i.set(o,a)||i,a};return r.cache=new(o.Cache||n),r}o.Cache=n,t.exports=o},function(t,e,r){var n=r(89),o=r(16),i=r(23);t.exports=function(){this.size=0,this.__data__={hash:new n,map:new(i||o),string:new n}}},function(t,e,r){var n=r(90),o=r(95),i=r(96),a=r(97),u=r(98);function c(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}c.prototype.clear=n,c.prototype.delete=o,c.prototype.get=i,c.prototype.has=a,c.prototype.set=u,t.exports=c},function(t,e,r){var n=r(15);t.exports=function(){this.__data__=n?n(null):{},this.size=0}},function(t,e,r){var n=r(44),o=r(92),i=r(10),a=r(45),u=Function.prototype,c=Object.prototype,s=u.toString,f=c.hasOwnProperty,l=RegExp("^"+s.call(f).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");t.exports=function(t){return!(!i(t)||o(t))&&(n(t)?l:/^\[object .+?Constructor\]$/).test(a(t))}},function(t,e,r){var n,o=r(93),i=(n=/[^.]+$/.exec(o&&o.keys&&o.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"";t.exports=function(t){return!!i&&i in t}},function(t,e,r){var n=r(3)["__core-js_shared__"];t.exports=n},function(t,e){t.exports=function(t,e){return null==t?void 0:t[e]}},function(t,e){t.exports=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}},function(t,e,r){var n=r(15),o=Object.prototype.hasOwnProperty;t.exports=function(t){var e=this.__data__;if(n){var r=e[t];return"__lodash_hash_undefined__"===r?void 0:r}return o.call(e,t)?e[t]:void 0}},function(t,e,r){var n=r(15),o=Object.prototype.hasOwnProperty;t.exports=function(t){var e=this.__data__;return n?void 0!==e[t]:o.call(e,t)}},function(t,e,r){var n=r(15);t.exports=function(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=n&&void 0===e?"__lodash_hash_undefined__":e,this}},function(t,e){t.exports=function(){this.__data__=[],this.size=0}},function(t,e,r){var n=r(17),o=Array.prototype.splice;t.exports=function(t){var e=this.__data__,r=n(e,t);return r>=0&&(r==e.length-1?e.pop():o.call(e,r,1),--this.size,!0)}},function(t,e,r){var n=r(17);t.exports=function(t){var e=this.__data__,r=n(e,t);return 0>r?void 0:e[r][1]}},function(t,e,r){var n=r(17);t.exports=function(t){return n(this.__data__,t)>-1}},function(t,e,r){var n=r(17);t.exports=function(t,e){var r=this.__data__,o=n(r,t);return 0>o?(++this.size,r.push([t,e])):r[o][1]=e,this}},function(t,e,r){var n=r(18);t.exports=function(t){var e=n(this,t).delete(t);return this.size-=e?1:0,e}},function(t,e){t.exports=function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t}},function(t,e,r){var n=r(18);t.exports=function(t){return n(this,t).get(t)}},function(t,e,r){var n=r(18);t.exports=function(t){return n(this,t).has(t)}},function(t,e,r){var n=r(18);t.exports=function(t,e){var r=n(this,t),o=r.size;return r.set(t,e),this.size+=r.size==o?0:1,this}},function(t,e,r){var n=r(110);t.exports=function(t){return null==t?"":n(t)}},function(t,e,r){var n=r(12),o=r(47),i=r(4),a=r(22),u=n?n.prototype:void 0,c=u?u.toString:void 0;t.exports=function t(e){if("string"==typeof e)return e;if(i(e))return o(e,t)+"";if(a(e))return c?c.call(e):"";var r=e+"";return"0"==r&&1/e==-1/0?"-0":r}},function(t,e,r){var n=r(24),o=r(8),i=r(25),a=r(10),u=r(19);t.exports=function(t,e,r,c){if(!a(t))return t;for(var s=-1,f=(e=o(e,t)).length,l=f-1,p=t;null!=p&&++s<f;){var d=u(e[s]),v=r;if(s!=l){var y=p[d];void 0===(v=c?c(y,d,p):void 0)&&(v=a(y)?y:i(e[s+1])?[]:{})}n(p,d,v),p=p[d]}return t}},function(t,e,r){var n=r(113),o=r(114);t.exports=function(t,e){return null!=t&&o(t,e,n)}},function(t,e){t.exports=function(t,e){return null!=t&&e in Object(t)}},function(t,e,r){var n=r(8),o=r(26),i=r(4),a=r(25),u=r(27),c=r(19);t.exports=function(t,e,r){for(var s=-1,f=(e=n(e,t)).length,l=!1;++s<f;){var p=c(e[s]);if(!(l=null!=t&&r(t,p)))break;t=t[p]}return l||++s!=f?l:!!(f=null==t?0:t.length)&&u(f)&&a(p,f)&&(i(t)||o(t))}},function(t,e,r){var n=r(9),o=r(6);t.exports=function(t){return o(t)&&"[object Arguments]"==n(t)}},function(t,e,r){var n=r(117);t.exports=function(t){return null!=t&&t.length?n(t,1):[]}},function(t,e,r){var n=r(28),o=r(118);t.exports=function t(e,r,i,a,u){var c=-1,s=e.length;for(i||(i=o),u||(u=[]);++c<s;){var f=e[c];r>0&&i(f)?r>1?t(f,r-1,i,a,u):n(u,f):a||(u[u.length]=f)}return u}},function(t,e,r){var n=r(12),o=r(26),i=r(4),a=n?n.isConcatSpreadable:void 0;t.exports=function(t){return i(t)||o(t)||!!(a&&t&&t[a])}},function(t,e,r){var n=r(120),o=Math.max;t.exports=function(t,e,r){return e=o(void 0===e?t.length-1:e,0),function(){for(var i=arguments,a=-1,u=o(i.length-e,0),c=Array(u);++a<u;)c[a]=i[e+a];a=-1;for(var s=Array(e+1);++a<e;)s[a]=i[a];return s[e]=r(c),n(t,this,s)}}},function(t,e){t.exports=function(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}},function(t,e,r){var n=r(122),o=r(125)(n);t.exports=o},function(t,e,r){var n=r(123),o=r(49),i=r(124),a=o?function(t,e){return o(t,"toString",{configurable:!0,enumerable:!1,value:n(e),writable:!0})}:i;t.exports=a},function(t,e){t.exports=function(t){return function(){return t}}},function(t,e){t.exports=function(t){return t}},function(t,e){var r=Date.now;t.exports=function(t){var e=0,n=0;return function(){var o=r(),i=16-(o-n);if(n=o,i>0){if(++e>=800)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}},function(t,e,r){var n=r(127),o=r(133),i=r(24),a=r(134),u=r(141),c=r(144),s=r(145),f=r(146),l=r(148),p=r(149),d=r(60),v=r(36),y=r(154),b=r(155),h=r(161),x=r(4),j=r(53),g=r(163),w=r(10),_=r(165),O=r(29),m={};m["[object Arguments]"]=m["[object Array]"]=m["[object ArrayBuffer]"]=m["[object DataView]"]=m["[object Boolean]"]=m["[object Date]"]=m["[object Float32Array]"]=m["[object Float64Array]"]=m["[object Int8Array]"]=m["[object Int16Array]"]=m["[object Int32Array]"]=m["[object Map]"]=m["[object Number]"]=m["[object Object]"]=m["[object RegExp]"]=m["[object Set]"]=m["[object String]"]=m["[object Symbol]"]=m["[object Uint8Array]"]=m["[object Uint8ClampedArray]"]=m["[object Uint16Array]"]=m["[object Uint32Array]"]=!0,m["[object Error]"]=m["[object Function]"]=m["[object WeakMap]"]=!1,t.exports=function t(e,r,k,A,S,I){var U,P=1&r,N=2&r,T=4&r;if(k&&(U=S?k(e,A,S,I):k(e)),void 0!==U)return U;if(!w(e))return e;var B=x(e);if(B){if(U=y(e),!P)return s(e,U)}else{var C=v(e),M="[object Function]"==C||"[object GeneratorFunction]"==C;if(j(e))return c(e,P);if("[object Object]"==C||"[object Arguments]"==C||M&&!S){if(U=N||M?{}:h(e),!P)return N?l(e,u(U,e)):f(e,a(U,e))}else{if(!m[C])return S?e:{};U=b(e,C,P)}}I||(I=new n);var z=I.get(e);if(z)return z;I.set(e,U),_(e)?e.forEach((function(n){U.add(t(n,r,k,n,e,I))})):g(e)&&e.forEach((function(n,o){U.set(o,t(n,r,k,o,e,I))}));var D=T?N?d:p:N?keysIn:O,E=B?void 0:D(e);return o(E||e,(function(n,o){E&&(n=e[o=n]),i(U,o,t(n,r,k,o,e,I))})),U}},function(t,e,r){var n=r(16),o=r(128),i=r(129),a=r(130),u=r(131),c=r(132);function s(t){var e=this.__data__=new n(t);this.size=e.size}s.prototype.clear=o,s.prototype.delete=i,s.prototype.get=a,s.prototype.has=u,s.prototype.set=c,t.exports=s},function(t,e,r){var n=r(16);t.exports=function(){this.__data__=new n,this.size=0}},function(t,e){t.exports=function(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}},function(t,e){t.exports=function(t){return this.__data__.get(t)}},function(t,e){t.exports=function(t){return this.__data__.has(t)}},function(t,e,r){var n=r(16),o=r(23),i=r(43);t.exports=function(t,e){var r=this.__data__;if(r instanceof n){var a=r.__data__;if(!o||199>a.length)return a.push([t,e]),this.size=++r.size,this;r=this.__data__=new i(a)}return r.set(t,e),this.size=r.size,this}},function(t,e){t.exports=function(t,e){for(var r=-1,n=null==t?0:t.length;++r<n&&!1!==e(t[r],r,t););return t}},function(t,e,r){var n=r(13),o=r(29);t.exports=function(t,e){return t&&n(e,o(e),t)}},function(t,e){t.exports=function(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}},function(t,e){t.exports=function(){return!1}},function(t,e,r){var n=r(138),o=r(31),i=r(32),a=i&&i.isTypedArray,u=a?o(a):n;t.exports=u},function(t,e,r){var n=r(9),o=r(27),i=r(6),a={};a["[object Float32Array]"]=a["[object Float64Array]"]=a["[object Int8Array]"]=a["[object Int16Array]"]=a["[object Int32Array]"]=a["[object Uint8Array]"]=a["[object Uint8ClampedArray]"]=a["[object Uint16Array]"]=a["[object Uint32Array]"]=!0,a["[object Arguments]"]=a["[object Array]"]=a["[object ArrayBuffer]"]=a["[object Boolean]"]=a["[object DataView]"]=a["[object Date]"]=a["[object Error]"]=a["[object Function]"]=a["[object Map]"]=a["[object Number]"]=a["[object Object]"]=a["[object RegExp]"]=a["[object Set]"]=a["[object String]"]=a["[object WeakMap]"]=!1,t.exports=function(t){return i(t)&&o(t.length)&&!!a[n(t)]}},function(t,e,r){var n=r(33),o=r(140),i=Object.prototype.hasOwnProperty;t.exports=function(t){if(!n(t))return o(t);var e=[];for(var r in Object(t))i.call(t,r)&&"constructor"!=r&&e.push(r);return e}},function(t,e,r){var n=r(54)(Object.keys,Object);t.exports=n},function(t,e,r){var n=r(13),o=r(56);t.exports=function(t,e){return t&&n(e,o(e),t)}},function(t,e,r){var n=r(10),o=r(33),i=r(143),a=Object.prototype.hasOwnProperty;t.exports=function(t){if(!n(t))return i(t);var e=o(t),r=[];for(var u in t)("constructor"!=u||!e&&a.call(t,u))&&r.push(u);return r}},function(t,e){t.exports=function(t){var e=[];if(null!=t)for(var r in Object(t))e.push(r);return e}},function(t,e,r){(function(t){var n=r(3),o=e&&!e.nodeType&&e,i=o&&"object"==typeof t&&t&&!t.nodeType&&t,a=i&&i.exports===o?n.Buffer:void 0,u=a?a.allocUnsafe:void 0;t.exports=function(t,e){if(e)return t.slice();var r=t.length,n=u?u(r):new t.constructor(r);return t.copy(n),n}}).call(this,r(30)(t))},function(t,e){t.exports=function(t,e){var r=-1,n=t.length;for(e||(e=Array(n));++r<n;)e[r]=t[r];return e}},function(t,e,r){var n=r(13),o=r(34);t.exports=function(t,e){return n(t,o(t),e)}},function(t,e){t.exports=function(t,e){for(var r=-1,n=null==t?0:t.length,o=0,i=[];++r<n;){var a=t[r];e(a,r,t)&&(i[o++]=a)}return i}},function(t,e,r){var n=r(13),o=r(58);t.exports=function(t,e){return n(t,o(t),e)}},function(t,e,r){var n=r(59),o=r(34),i=r(29);t.exports=function(t){return n(t,i,o)}},function(t,e,r){var n=r(7)(r(3),"DataView");t.exports=n},function(t,e,r){var n=r(7)(r(3),"Promise");t.exports=n},function(t,e,r){var n=r(7)(r(3),"Set");t.exports=n},function(t,e,r){var n=r(7)(r(3),"WeakMap");t.exports=n},function(t,e){var r=Object.prototype.hasOwnProperty;t.exports=function(t){var e=t.length,n=new t.constructor(e);return e&&"string"==typeof t[0]&&r.call(t,"index")&&(n.index=t.index,n.input=t.input),n}},function(t,e,r){var n=r(37),o=r(157),i=r(158),a=r(159),u=r(160);t.exports=function(t,e,r){var c=t.constructor;switch(e){case"[object ArrayBuffer]":return n(t);case"[object Boolean]":case"[object Date]":return new c(+t);case"[object DataView]":return o(t,r);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return u(t,r);case"[object Map]":return new c;case"[object Number]":case"[object String]":return new c(t);case"[object RegExp]":return i(t);case"[object Set]":return new c;case"[object Symbol]":return a(t)}}},function(t,e,r){var n=r(3).Uint8Array;t.exports=n},function(t,e,r){var n=r(37);t.exports=function(t,e){var r=e?n(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}},function(t,e){var r=/\w*$/;t.exports=function(t){var e=new t.constructor(t.source,r.exec(t));return e.lastIndex=t.lastIndex,e}},function(t,e,r){var n=r(12),o=n?n.prototype:void 0,i=o?o.valueOf:void 0;t.exports=function(t){return i?Object(i.call(t)):{}}},function(t,e,r){var n=r(37);t.exports=function(t,e){var r=e?n(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}},function(t,e,r){var n=r(162),o=r(35),i=r(33);t.exports=function(t){return"function"!=typeof t.constructor||i(t)?{}:n(o(t))}},function(t,e,r){var n=r(10),o=Object.create,i=function(){function t(){}return function(e){if(!n(e))return{};if(o)return o(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}}();t.exports=i},function(t,e,r){var n=r(164),o=r(31),i=r(32),a=i&&i.isMap,u=a?o(a):n;t.exports=u},function(t,e,r){var n=r(36),o=r(6);t.exports=function(t){return o(t)&&"[object Map]"==n(t)}},function(t,e,r){var n=r(166),o=r(31),i=r(32),a=i&&i.isSet,u=a?o(a):n;t.exports=u},function(t,e,r){var n=r(36),o=r(6);t.exports=function(t){return o(t)&&"[object Set]"==n(t)}},function(t,e,r){var n=r(8),o=r(38),i=r(168),a=r(19);t.exports=function(t,e){return e=n(e,t),null==(t=i(t,e))||delete t[a(o(e))]}},function(t,e,r){var n=r(41),o=r(169);t.exports=function(t,e){return 2>e.length?t:n(t,o(e,0,-1))}},function(t,e){t.exports=function(t,e,r){var n=-1,o=t.length;0>e&&(e=-e>o?0:o+e),0>(r=r>o?o:r)&&(r+=o),o=e>r?0:r-e>>>0,e>>>=0;for(var i=Array(o);++n<o;)i[n]=t[n+e];return i}},function(t,e,r){var n=r(171);t.exports=function(t){return n(t)?void 0:t}},function(t,e,r){var n=r(9),o=r(35),i=r(6),a=Function.prototype,u=Object.prototype,c=a.toString,s=u.hasOwnProperty,f=c.call(Object);t.exports=function(t){if(!i(t)||"[object Object]"!=n(t))return!1;var e=o(t);if(null===e)return!0;var r=s.call(e,"constructor")&&e.constructor;return"function"==typeof r&&r instanceof r&&c.call(r)==f}},function(t,e,r){"use strict";r.r(e);var n=r(38),o=r.n(n),i=r(70),a=r.n(i),u=r(11),c=r(71),s=r.n(c),f=r(72),l=r.n(f),p=r(5),d=new l.a({logger:p.b}),v=r(14);r.d(e,"default",(function(){return b}));const y=r(79);class b extends u.JaidCorePlugin{init(){this.socketServer=s()(this.core.insecureServer),this.socketServer.on("connection",async t=>{if(t.handshake.headers.cookie){const e=a.a.parse(t.handshake.headers.cookie).login;if(e){const r=JSON.parse(e);if(r.key){t.apiKey=r.key;const e=await v.default.findOne({where:{apiKey:t.apiKey},attributes:["UserId"],raw:!0});e?t.userId=e.UserId:t.emit("invalidateLogin")}}}for(const[e,r]of Object.entries(this.commands))t.on(e,async(...e)=>{const n={client:t,userId:t.userId},i=await r.default(n,...e);void 0!==i&&o()(e)(i)})}),d.enhanceServer(this.socketServer),this.commands=y.keys().reduce((t,e)=>(t[e.match(/\.\/(?<key>[\da-z]+)/i).groups.key]=y(e),t),{})}}}]);