Guest User

Untitled

a guest
Apr 22nd, 2019
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 150.76 KB | None | 0 0
  1. // WARNING! This file contains some subset of JS that is not supported by type inference.
  2. // You can try checking 'Transpile to ES5' checkbox if you want the types to be inferred
  3. /**
  4. * @license
  5. Yusuke Kawasaki
  6. @license MIT
  7. @constructor
  8. @see https://github.com/kawanet/event-lite
  9. @see http://kawanet.github.io/event-lite/EventLite.html
  10. @example
  11. var EventLite = require("event-lite");
  12.  
  13. function MyClass() {...} // your class
  14.  
  15. EventLite.mixin(MyClass.prototype); // import event methods
  16.  
  17. var obj = new MyClass();
  18. obj.on("foo", function() {...}); // add event listener
  19. obj.once("bar", function() {...}); // add one-time event listener
  20. obj.emit("foo"); // dispatch event
  21. obj.emit("bar"); // dispatch another event
  22. obj.off("foo"); // remove event listener
  23. The buffer module from node.js, for the browser.
  24.  
  25. @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
  26. @license MIT
  27. */
  28. 'use strict';
  29. !function(m) {
  30. function t(i) {
  31. if (n[i]) {
  32. return n[i].exports;
  33. }
  34. var module = n[i] = {
  35. i : i,
  36. l : false,
  37. exports : {}
  38. };
  39. return m[i].call(module.exports, module, module.exports, t), module.l = true, module.exports;
  40. }
  41. var n = {};
  42. t.m = m;
  43. t.c = n;
  44. t.d = function(i, name, n) {
  45. if (!t.o(i, name)) {
  46. Object.defineProperty(i, name, {
  47. enumerable : true,
  48. get : n
  49. });
  50. }
  51. };
  52. t.r = function(input) {
  53. if ("undefined" != typeof Symbol && Symbol.toStringTag) {
  54. Object.defineProperty(input, Symbol.toStringTag, {
  55. value : "Module"
  56. });
  57. }
  58. Object.defineProperty(input, "__esModule", {
  59. value : true
  60. });
  61. };
  62. t.t = function(val, byteOffset) {
  63. if (1 & byteOffset && (val = t(val)), 8 & byteOffset) {
  64. return val;
  65. }
  66. if (4 & byteOffset && "object" == typeof val && val && val.__esModule) {
  67. return val;
  68. }
  69. var d = Object.create(null);
  70. if (t.r(d), Object.defineProperty(d, "default", {
  71. enumerable : true,
  72. value : val
  73. }), 2 & byteOffset && "string" != typeof val) {
  74. var s;
  75. for (s in val) {
  76. t.d(d, s, function(attrPropertyName) {
  77. return val[attrPropertyName];
  78. }.bind(null, s));
  79. }
  80. }
  81. return d;
  82. };
  83. t.n = function(module) {
  84. var n = module && module.__esModule ? function() {
  85. return module.default;
  86. } : function() {
  87. return module;
  88. };
  89. return t.d(n, "a", n), n;
  90. };
  91. t.o = function(e, input) {
  92. return Object.prototype.hasOwnProperty.call(e, input);
  93. };
  94. t.p = "";
  95. t(t.s = 112);
  96. }([function(canCreateDiscussions, exports, require) {
  97. function alloc(obj) {
  98. return auto(this).alloc(obj);
  99. }
  100. function auto(that) {
  101. return isBuffer(that) ? BufferBuffer : isView(that) ? BufferUint8Array : isArray(that) ? BufferArray : hasBuffer ? BufferBuffer : hasArrayBuffer ? BufferUint8Array : BufferArray;
  102. }
  103. function _false() {
  104. return false;
  105. }
  106. function _is(o, key) {
  107. return o = "[object " + o + "]", function(object) {
  108. return null != object && {}.toString.call(key ? object[key] : object) === o;
  109. };
  110. }
  111. var Buffer = exports.global = require(27);
  112. var hasBuffer = exports.hasBuffer = Buffer && !!Buffer.isBuffer;
  113. var hasArrayBuffer = exports.hasArrayBuffer = "undefined" != typeof ArrayBuffer;
  114. var isArray = exports.isArray = require(9);
  115. exports.isArrayBuffer = hasArrayBuffer ? function(value) {
  116. return value instanceof ArrayBuffer || _isArrayBuffer(value);
  117. } : _false;
  118. var isBuffer = exports.isBuffer = hasBuffer ? Buffer.isBuffer : _false;
  119. var isView = exports.isView = hasArrayBuffer ? ArrayBuffer.isView || _is("ArrayBuffer", "buffer") : _false;
  120. exports.alloc = alloc;
  121. exports.concat = function(object, length) {
  122. if (!length) {
  123. length = 0;
  124. Array.prototype.forEach.call(object, function(spu_tag) {
  125. length = length + spu_tag.length;
  126. });
  127. }
  128. var ref = this !== exports && this || object[0];
  129. var result = alloc.call(ref, length);
  130. var i = 0;
  131. return Array.prototype.forEach.call(object, function(stat) {
  132. i = i + p.copy.call(stat, result, i);
  133. }), result;
  134. };
  135. exports.from = function(a) {
  136. return "string" == typeof a ? function(fields) {
  137. var parent = 3 * fields.length;
  138. var element = alloc.call(this, parent);
  139. var document = p.write.call(element, fields);
  140. return parent !== document && (element = p.slice.call(element, 0, document)), element;
  141. }.call(this, a) : auto(this).from(a);
  142. };
  143. var BufferArray = exports.Array = require(30);
  144. var BufferBuffer = exports.Buffer = require(31);
  145. var BufferUint8Array = exports.Uint8Array = require(32);
  146. var p = exports.prototype = require(10);
  147. var _isArrayBuffer = _is("ArrayBuffer");
  148. }, function(data, canCreateDiscussions, moment) {
  149. (function(eslint) {
  150. data.exports.isProd = void 0 !== eslint && !!eslint.env.IS_PROD || "undefined" != typeof location && "127.0.0.1" !== location.hostname && "localhost" !== location.hostname && !location.hostname.startsWith("192.168.");
  151. data.exports.enableHttps = data.exports.isProd;
  152. data.exports.serverTickRate = 1e3 / 30;
  153. data.exports.serverSendRate = 100;
  154. data.exports.clientSendRate = 1e3 / 30;
  155. data.exports.dltMx = Math.round(1e3 / 30);
  156. data.exports.streamUpdate = 1e4;
  157. data.exports.maxPlayers = 8;
  158. data.exports.serverSpread = 3;
  159. data.exports.minServerSpace = 3;
  160. data.exports.gamesPerServer = 5;
  161. data.exports.serverBrowserRate = 1e4;
  162. data.exports.maxPlayersTotal = data.exports.maxPlayers * data.exports.gamesPerServer + 50;
  163. data.exports.kickTimer = 9e4;
  164. data.exports.apiURL = void 0 === eslint ? data.exports.isProd ? "krunker.io" == location.hostname ? "https://api.krunker.io" : "https://api_beta.krunker.io" : "http://127.0.0.1:5060" : data.exports.isProd ? "krunker_prod" == eslint.env.VULTR_SCHEME ? "https://api.krunker.io" : "https://api_beta.krunker.io" : "http://127.0.0.1:5060";
  165. data.exports.needsRestart = false;
  166. data.exports.rewardTime = 432e5;
  167. data.exports.rewardMinLvl = 5;
  168. data.exports.endTimer = 2e4;
  169. data.exports.endAnim = 5e3;
  170. data.exports.thirdPZ = 14;
  171. data.exports.thirdPX = 5;
  172. data.exports.serverConfig = [{
  173. name : "Players",
  174. varN : "maxPlayers",
  175. def : 2,
  176. max : 10,
  177. maxF : 16,
  178. min : 1,
  179. step : 1
  180. }, {
  181. name : "Min Players",
  182. varN : "minPlayers",
  183. def : 0,
  184. max : 10,
  185. maxF : 16,
  186. min : 0,
  187. step : 1
  188. }, {
  189. name : "Lives",
  190. varN : "lives",
  191. def : 0,
  192. max : 10,
  193. min : 0,
  194. step : 1
  195. }, {
  196. name : "Minutes",
  197. varN : "gameTime",
  198. def : 4,
  199. max : 60,
  200. min : 0,
  201. step : 1
  202. }, {
  203. name : "Gravity",
  204. varN : "gravMlt",
  205. dontChange : true,
  206. def : 1,
  207. max : 2,
  208. min : .1,
  209. step : .1
  210. }, {
  211. name : "Jump Force",
  212. varN : "jumpMlt",
  213. dontChange : true,
  214. def : 1,
  215. max : 3,
  216. min : .1,
  217. step : .1
  218. }, {
  219. name : "Time Scale",
  220. varN : "deltaMlt",
  221. dontChange : true,
  222. def : 1,
  223. max : 1.5,
  224. min : .1,
  225. step : .1
  226. }, {
  227. name : "Strafe Speed",
  228. varN : "strafeSpd",
  229. dontChange : true,
  230. def : 1.2,
  231. max : 2,
  232. min : 1,
  233. step : .1
  234. }, {
  235. name : "Health Multiplier",
  236. varN : "healthMlt",
  237. dontChange : true,
  238. def : 1,
  239. max : 3,
  240. min : .1,
  241. step : .1
  242. }, {
  243. name : "Spectating",
  244. varN : "allowSpect",
  245. def : true,
  246. bool : true
  247. }, {
  248. name : "Kill Rewards",
  249. varN : "killRewards",
  250. dontChange : true,
  251. def : true,
  252. bool : true
  253. }, {
  254. name : "Sliding",
  255. varN : "canSlide",
  256. def : true,
  257. bool : true
  258. }, {
  259. name : "Auto Jump",
  260. varN : "autoJump",
  261. bool : true
  262. }, {
  263. name : "3rd Person",
  264. varN : "thirdPerson",
  265. bool : true
  266. }, {
  267. name : "Hide Nametags",
  268. varN : "nameTags",
  269. bool : true
  270. }];
  271. data.exports.prefabIDS = ["CUBE", "CRATE", "BARREL", "LADDER", "PLANE", "SPAWN_POINT", "CAMERA_POSITION", "VEHICLE", "STACK", "RAMP", "SCORE_ZONE", "BILLBOARD", "DEATH_ZONE", "PARTICLES", "OBJECTIVE", "TREE", "CONE", "CONTAINER", "GRASS", "CONTAINERR", "ACIDBARREL", "DOOR", "WINDOW", "FLAG"];
  272. data.exports.textureIDS = ["WALL", "DIRT", "FLOOR", "GRID", "GREY", "DEFAULT", "ROOF", "FLAG", "GRASS", "CHECK", "LINES", "BRICK"];
  273. data.exports.objectLimit = 3500;
  274. data.exports.objectLimitF = 6e3;
  275. data.exports.spawnLimit = 20;
  276. data.exports.gravity = 15e-5;
  277. data.exports.deathY = -100;
  278. data.exports.skyScale = 18e3;
  279. data.exports.shadowDst = 1200;
  280. data.exports.shadowRes = 1024;
  281. data.exports.shadowOff = .004;
  282. data.exports.lightDistance = 500;
  283. data.exports.cornerPad = 1;
  284. data.exports.cornerScl = 2.5;
  285. data.exports.cornerH = 7;
  286. data.exports.wallH = 5;
  287. data.exports.wallW = .8;
  288. data.exports.crateScale = 6;
  289. data.exports.stackScale = 6;
  290. data.exports.barrelScale = 4;
  291. data.exports.acidbarrelScale = data.exports.barrelScale;
  292. data.exports.treeScale = 10;
  293. data.exports.doorScale = 5;
  294. data.exports.windowScale = 6;
  295. data.exports.coneScale = 4;
  296. data.exports.containerScale = 7;
  297. data.exports.containerrScale = data.exports.containerScale;
  298. data.exports.grassScale = 32;
  299. data.exports.vehicleScale = 20;
  300. data.exports.barrelMlt = 1;
  301. data.exports.ladderWidth = 3.2;
  302. data.exports.ladderScale = .5;
  303. data.exports.terrainGrid = 8;
  304. data.exports.maxTerrainS = 4e3;
  305. data.exports.otherSoundMlt = .55;
  306. data.exports.maxParticles = 100;
  307. data.exports.explosionRange = 200;
  308. data.exports.chatMaxLength = 70;
  309. data.exports.chatInterval = 800;
  310. data.exports.voiceChatInterval = 2e3;
  311. data.exports.voiceChatMaxLength = 5;
  312. data.exports.movDirs = [];
  313. var counter = 0;
  314. for (; 8 > counter; ++counter) {
  315. data.exports.movDirs.push(-Math.PI + (counter + 1) * Math.PI / 4);
  316. }
  317. data.exports.interpolation = 1.1;
  318. data.exports.stateHistory = 1e3;
  319. data.exports.syncFreq = 800;
  320. data.exports.pingCount = 10;
  321. data.exports.mouseSens = .0024;
  322. data.exports.camChaseTrn = .0022;
  323. data.exports.camChaseSpd = .0012;
  324. data.exports.camChaseSen = .2;
  325. data.exports.camChaseDst = 24;
  326. data.exports.menuCamDist = 200;
  327. data.exports.menuCamAngle = -.5;
  328. data.exports.menuCamSpeed = .1;
  329. data.exports.idleAnimS = .0019;
  330. data.exports.animMult = 1.2;
  331. data.exports.leanPull = .99;
  332. data.exports.leanSens = .05;
  333. data.exports.leanMax = .16;
  334. data.exports.leanPullZ = .99;
  335. data.exports.leanMltZ = .03;
  336. data.exports.bobMltY = .024;
  337. data.exports.bobMltZ = .02;
  338. data.exports.bobPullY = .985;
  339. data.exports.bobPullZ = .99;
  340. data.exports.landPull = .994;
  341. data.exports.landPullV = .985;
  342. data.exports.landOff = .15;
  343. data.exports.aimAnimMlt = .18;
  344. data.exports.aimSlow = .55;
  345. data.exports.aimJumpSlow = .85;
  346. data.exports.stepAnim = .075;
  347. data.exports.stepMlt = .25;
  348. data.exports.stepPull = .995;
  349. data.exports.maxHealth = 100;
  350. data.exports.passiveInc = 500;
  351. data.exports.cameraHeight = 1.5;
  352. data.exports.playerSpeed = 42e-5;
  353. data.exports.ladderSpeed = .035;
  354. data.exports.ladderDecel = .97;
  355. data.exports.slideDecel = .999;
  356. data.exports.groundDecel = .99;
  357. data.exports.airSpeed = 47e-6;
  358. data.exports.airDecel = .9996;
  359. data.exports.jumpVel = .072;
  360. data.exports.jumpPush = .1;
  361. data.exports.decelMin = 1e-4;
  362. data.exports.climbHeight = 3;
  363. data.exports.wpnSpin = .018;
  364. data.exports.materialDens = {
  365. flesh : .2,
  366. default : .5
  367. };
  368. data.exports.nameOffset = .6;
  369. data.exports.nameOffsetHat = .8;
  370. data.exports.maxNameLength = 14;
  371. data.exports.maxPassLength = 16;
  372. data.exports.playerHeight = 11;
  373. data.exports.chestWidth = 2.6;
  374. data.exports.chestScale = 1.3;
  375. data.exports.armScale = 1.3;
  376. data.exports.legScale = 1.3;
  377. data.exports.uArmLength = 2.7;
  378. data.exports.armInset = -.1;
  379. data.exports.lArmLength = 2.7;
  380. data.exports.headScale = 2;
  381. data.exports.armOff = -.8;
  382. data.exports.legHeight = 4.2;
  383. data.exports.playerScale = (2 * data.exports.armScale + data.exports.chestWidth + data.exports.armInset) / 2;
  384. data.exports.hitBoxPad = 1;
  385. data.exports.tracerMinDst = 20;
  386. data.exports.tracerMaxDst = 500;
  387. data.exports.tracerChance = 1;
  388. data.exports.crouchLean = -.1 * Math.PI;
  389. data.exports.crouchDst = 3;
  390. data.exports.crouchSlow = .3;
  391. data.exports.crouchSpeed = .007;
  392. data.exports.crouchJump = .25;
  393. data.exports.crouchSpread = .4;
  394. data.exports.crouchAnim = 8e-4;
  395. data.exports.crouchAnimMlt = .5;
  396. data.exports.spreadMove = 30;
  397. data.exports.spreadFall = 35;
  398. data.exports.spreadRecover = .985;
  399. data.exports.spreadAdj = 63e-5;
  400. data.exports.spreadMlt = 400;
  401. data.exports.recoilMlt = .3;
  402. data.exports.flagMsg = "You have the Flag";
  403. data.exports.flagZoneS = 24;
  404. data.exports.flagZoneH = 36;
  405. data.exports.flagScale = 12;
  406. data.exports.flagOff = 6;
  407. data.exports.flagHOff = 15;
  408. data.exports.maxLevel = 102;
  409. data.exports.assistTime = 5e3;
  410. data.exports.assistScore = 25;
  411. data.exports.assistMin = 20;
  412. data.exports.medalAnim = 1e3;
  413. data.exports.medalDelay = 900;
  414. data.exports.scoreStreak = 2e3;
  415. data.exports.feedTimer = 2e3;
  416. data.exports.spinTimer = 1800;
  417. data.exports.endStats = ["sid", "name", "score", "kills", "deaths", "reward"];
  418. data.exports.endForm = {
  419. reward : function(value) {
  420. return value ? "<span style='color:#F8C55C'>+" + value + "</span> KR" : "NONE";
  421. },
  422. time : function(options, settings, callback) {
  423. return callback.timer || "DNF";
  424. },
  425. infected : function($sealed, $struct, $key) {
  426. return $key.convs;
  427. },
  428. found : function(token, position, callback) {
  429. return callback.convs;
  430. }
  431. };
  432. data.exports.hitLife = 2e3;
  433. data.exports.regenDelay = 5e3;
  434. data.exports.regenVal = .1;
  435. data.exports.sprayTimer = 1e3;
  436. data.exports.sprayRange = 25;
  437. data.exports.sprayScale = 15;
  438. data.exports.deathDelay = 2800;
  439. data.exports.deathFollowD = 100;
  440. data.exports.suicides = ["suicide", "uninstall life", "toaster bath", "alt f4", "not alive", "neck rope", "sudoku", "scooter ankle", "death.exe"];
  441. data.exports.fov = 70;
  442. data.exports.viewDist = 2e3;
  443. data.exports.nameVisRate = 200;
  444. data.exports.worldUV = 60;
  445. data.exports.ambientVal = .8;
  446. data.exports.ambD = 2;
  447. data.exports.ambMlt = 15;
  448. data.exports.ambOff = .09;
  449. data.exports.ambScale = 10;
  450. data.exports.ambDiv = 20;
  451. data.exports.ambSFactor = 1;
  452. data.exports.ambBleed = 0;
  453. data.exports.boosterSpd = .002;
  454. data.exports.rankVar = .03;
  455. data.exports.newDataInterval = 12e4;
  456. data.exports.socials = ["leaders", "profile", "maps"];
  457. data.exports.leaderQueries = ["score", "kills", "wins", "timeplayed", "funds", "clan"];
  458. data.exports.leaderCal = {
  459. player_score : function(numRays) {
  460. var r = Math.max(1, Math.floor(data.exports.rankVar * Math.sqrt(numRays)));
  461. return "<span class='floatR'><img src='./img/levels/" + Math.max(Math.min(data.exports.maxLevel - 2, r.roundToNearest(3) - 2), 0) + ".png' class='rnkIcon'>" + r + "</span>";
  462. },
  463. player_kills : function(canCreateDiscussions) {
  464. return canCreateDiscussions + "<span class='lName'> kills</span>";
  465. },
  466. player_wins : function(canCreateDiscussions) {
  467. return canCreateDiscussions + "<span class='lName'> wins</span>";
  468. },
  469. player_funds : function(canCreateDiscussions) {
  470. return canCreateDiscussions + " KR";
  471. },
  472. player_timeplayed : function(canCreateDiscussions) {
  473. var time = canCreateDiscussions / 1e3 / 60;
  474. var whiteRating = parseInt(time % 60);
  475. time = time / 60;
  476. var minutes = parseInt(time % 24);
  477. time = time / 24;
  478. var hours = parseInt(time);
  479. return (hours ? hours + "d " : "") + (minutes ? minutes + "h " : "") + (whiteRating || 0) + "m ";
  480. }
  481. };
  482. data.exports.regionNames = {
  483. local : "Local",
  484. "us-nj" : "New Jersey",
  485. "us-il" : "Chicago",
  486. "us-tx" : "Dallas",
  487. "us-wa" : "Seattle",
  488. "us-ca-la" : "Los Angeles",
  489. "us-ga" : "Atlanta",
  490. "nl-ams" : "Amsterdam",
  491. "gb-lon" : "London",
  492. "de-fra" : "Frankfurt",
  493. "us-ca-sv" : "Silicon Valley",
  494. "au-syd" : "Sydney",
  495. "fr-par" : "Paris",
  496. "jb-hnd" : "Tokyo",
  497. "us-fl" : "Miami",
  498. sgp : "Singapore"
  499. };
  500. }).call(this, moment(13));
  501. }, , function(self, canCreateDiscussions, moment) {
  502. (function(toStage) {
  503. const target = moment(1);
  504. self.exports.keyboardMap = ["", "", "", "CANCEL", "", "", "HELP", "", "BACK_SPACE", "TAB", "", "", "CLEAR", "ENTER", "ENTER_SPECIAL", "", "SHIFT", "CONTROL", "ALT", "PAUSE", "CAPS_LOCK", "KANA", "EISU", "JUNJA", "FINAL", "HANJA", "", "ESCAPE", "CONVERT", "NONCONVERT", "ACCEPT", "MODECHANGE", "SPACE", "PAGE_UP", "PAGE_DOWN", "END", "HOME", "LEFT", "UP", "RIGHT", "DOWN", "SELECT", "PRINT", "EXECUTE", "PRINTSCREEN", "INSERT", "DELETE", "", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "COLON",
  505. "SEMICOLON", "LESS_THAN", "EQUALS", "GREATER_THAN", "QUESTION_MARK", "AT", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "OS_KEY", "", "CONTEXT_MENU", "", "SLEEP", "NUMPAD0", "NUMPAD1", "NUMPAD2", "NUMPAD3", "NUMPAD4", "NUMPAD5", "NUMPAD6", "NUMPAD7", "NUMPAD8", "NUMPAD9", "MULTIPLY", "ADD", "SEPARATOR", "SUBTRACT", "DECIMAL", "DIVIDE", "F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9", "F10", "F11", "F12",
  506. "F13", "F14", "F15", "F16", "F17", "F18", "F19", "F20", "F21", "F22", "F23", "F24", "", "", "", "", "", "", "", "", "NUM_LOCK", "SCROLL_LOCK", "WIN_OEM_FJ_JISHO", "WIN_OEM_FJ_MASSHOU", "WIN_OEM_FJ_TOUROKU", "WIN_OEM_FJ_LOYA", "WIN_OEM_FJ_ROYA", "", "", "", "", "", "", "", "", "", "CIRCUMFLEX", "EXCLAMATION", "DOUBLE_QUOTE", "HASH", "DOLLAR", "PERCENT", "AMPERSAND", "UNDERSCORE", "OPEN_PAREN", "CLOSE_PAREN", "ASTERISK", "PLUS", "PIPE", "HYPHEN_MINUS", "OPEN_CURLY_BRACKET", "CLOSE_CURLY_BRACKET",
  507. "TILDE", "", "", "", "", "VOLUME_MUTE", "VOLUME_DOWN", "VOLUME_UP", "", "", "SEMICOLON", "EQUALS", "COMMA", "MINUS", "PERIOD", "SLASH", "BACK_QUOTE", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "OPEN_BRACKET", "BACK_SLASH", "CLOSE_BRACKET", "QUOTE", "", "META", "ALTGR", "", "WIN_ICO_HELP", "WIN_ICO_00", "", "WIN_ICO_CLEAR", "", "", "WIN_OEM_RESET", "WIN_OEM_JUMP", "WIN_OEM_PA1", "WIN_OEM_PA2", "WIN_OEM_PA3", "WIN_OEM_WSCTRL", "WIN_OEM_CUSEL",
  508. "WIN_OEM_ATTN", "WIN_OEM_FINISH", "WIN_OEM_COPY", "WIN_OEM_AUTO", "WIN_OEM_ENLW", "WIN_OEM_BACKTAB", "ATTN", "CRSEL", "EXSEL", "EREOF", "PLAY", "ZOOM", "", "PA1", "WIN_OEM_CLEAR", ""];
  509. self.exports.getB64Size = function() {
  510. };
  511. Number.prototype.round = function(val) {
  512. return +this.toFixed(val);
  513. };
  514. String.prototype.escape = function() {
  515. return (this + "").replace(/[\\"']/g, "\\$&").replace(/\u0000/g, "\\0");
  516. };
  517. Number.prototype.roundToNearest = function(num) {
  518. return 0 < this ? Math.ceil(this / num) * num : 0 > this ? Math.floor(this / num) * num : this;
  519. };
  520. self.exports.isURL = function(str_url) {
  521. try {
  522. return /^(https?:\/\/)?((([a-z\d]([a-z\d-]*[a-z\d])*)\.)+[a-z]{2,}|((\d{1,3}\.){3}\d{1,3}))(:\d+)?(\/[-a-z\d%@_.~+&:]*)*(\?[;&a-z\d%@_.,~+&:=-]*)?(#[-a-z\d_]*)?$/i.test(str_url);
  523. } catch (t) {
  524. }
  525. return false;
  526. };
  527. self.exports.arrayAverage = function(array) {
  528. var sum = 0;
  529. var i = 0;
  530. for (; i < array.length; i++) {
  531. sum = sum + array[i];
  532. }
  533. return sum / array.length;
  534. };
  535. self.exports.countInArray = function(val, arr) {
  536. var count = 0;
  537. var bufferIdx = 0;
  538. for (; bufferIdx < val.length; bufferIdx++) {
  539. if (val[bufferIdx] === arr) {
  540. count++;
  541. }
  542. }
  543. return count;
  544. };
  545. self.exports.formatNum = function(n) {
  546. var base = Math.floor(Math.log(Math.abs(n)) / Math.log(1e3));
  547. var suffix = "kmb"[base - 1];
  548. return suffix ? (n / Math.pow(1e3, base)).toFixed(1) + suffix : "" + n;
  549. };
  550. self.exports.randInt = function(min, max) {
  551. return Math.floor(Math.random() * (max - min + 1)) + min;
  552. };
  553. self.exports.randFloat = function(min, max) {
  554. return Math.random() * (max - min) + min;
  555. };
  556. self.exports.getRandom = function(array) {
  557. return array[self.exports.randInt(0, array.length - 1)];
  558. };
  559. self.exports.getDistance = function(b, p, a, x) {
  560. return Math.sqrt((a = a - b) * a + (x = x - p) * x);
  561. };
  562. self.exports.getDistance3D = function(y, size, k, dist, t, j) {
  563. var b = y - dist;
  564. var c = size - t;
  565. var i = k - j;
  566. return Math.sqrt(b * b + c * c + i * i);
  567. };
  568. self.exports.getAnglesSSS = function(g, s, r) {
  569. var as = Math.acos((s * s + r * r - g * g) / (2 * s * r));
  570. var o = Math.acos((r * r + g * g - s * s) / (2 * r * g));
  571. var distance = Math.PI - as - o;
  572. return [-as - Math.PI / 2, o, distance];
  573. };
  574. self.exports.getXDir = function(u, r, c, val, n, s) {
  575. var z = Math.abs(r - n);
  576. var m = self.exports.getDistance3D(u, r, c, val, n, s);
  577. return Math.asin(z / m) * (r > n ? -1 : 1);
  578. };
  579. self.exports.getAngleDist = function(angle, startAngle) {
  580. return Math.atan2(Math.sin(startAngle - angle), Math.cos(angle - startAngle));
  581. };
  582. self.exports.getAngleDist2 = function(y2, t) {
  583. var difference = Math.abs(t - y2) % (2 * Math.PI);
  584. return difference > Math.PI ? 2 * Math.PI - difference : difference;
  585. };
  586. self.exports.toRad = function(n) {
  587. return n * (Math.PI / 180);
  588. };
  589. self.exports.getDirection = function(point1X, point1Y, point2X, point2Y) {
  590. return Math.atan2(point1Y - point2Y, point1X - point2X);
  591. };
  592. self.exports.lerp = function(minIn, maxIn, minOut) {
  593. return minIn + (maxIn - minIn) * minOut;
  594. };
  595. self.exports.orderByScore = function(a, b) {
  596. return b.score - a.score;
  597. };
  598. self.exports.orderByKills = function(player, data) {
  599. return data.kills - player.kills;
  600. };
  601. self.exports.orderByDst = function(_pointA, _pointM) {
  602. return _pointA.dst - _pointM.dst;
  603. };
  604. self.exports.orderByNum = function(p, n) {
  605. return p - n;
  606. };
  607. self.exports.capFirst = function(string) {
  608. return string.charAt(0).toUpperCase() + string.slice(1);
  609. };
  610. self.exports.truncateText = function(str, length) {
  611. return str.length > length ? str.substring(0, length) + "..." : str;
  612. };
  613. self.exports.randomString = function(max) {
  614. var token = "";
  615. var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
  616. var i = 0;
  617. for (; i < max; i++) {
  618. token = token + possible.charAt(Math.floor(Math.random() * possible.length));
  619. }
  620. return token;
  621. };
  622. self.exports.formatNumCash = function(litresInCubicFeet) {
  623. return parseFloat(Math.round(100 * litresInCubicFeet) / 100).toFixed(2);
  624. };
  625. self.exports.getKeyName = function(name) {
  626. return self.exports.keyboardMap[name];
  627. };
  628. self.exports.getTime = function(index, e) {
  629. var B = parseInt(index % 1e3 / 100);
  630. var limit = parseInt(index / 1e3 % 60);
  631. var b = parseInt(index / 6e4 % 60);
  632. return (b = 10 > b ? "0" + b : b) + ":" + (limit = 10 > limit ? "0" + limit : limit) + (e ? "." + B : "");
  633. };
  634. self.exports.getReadableTime = function(type) {
  635. var time = type / 1e3 / 60;
  636. var whiteRating = parseInt(time % 60);
  637. time = time / 60;
  638. var minutes = parseInt(time % 24);
  639. time = time / 24;
  640. var hours = parseInt(time);
  641. return (hours ? hours + "d " : "") + (minutes ? minutes + "h " : "") + (whiteRating || 0) + "m ";
  642. };
  643. self.exports.getTimeH = function(canCreateDiscussions) {
  644. parseInt(canCreateDiscussions % 1e3 / 100);
  645. var b = Math.floor(canCreateDiscussions / 1e3 % 60);
  646. var ry = Math.floor(canCreateDiscussions / 6e4 % 60);
  647. var limit = Math.floor(canCreateDiscussions / 36e5 % 24);
  648. return (limit = 10 > limit ? "0" + limit : limit) + ":" + (ry = 10 > ry ? "0" + ry : ry) + ":" + (b = 10 > b ? "0" + b : b);
  649. };
  650. self.exports.scrambleS = function(data) {
  651. return data && data.replace ? data.replace(/.(.)?/g, "$1") + ("d" + data).replace(/.(.)?/g, "$1") : data;
  652. };
  653. self.exports.fixTo = function(options, length) {
  654. return parseFloat(options.toFixed(length));
  655. };
  656. self.exports.limit = function(x, max) {
  657. return x < -max ? -max : x > max ? max : x;
  658. };
  659. self.exports.limitMM = function(left, limitLeft, limitRight) {
  660. return left < limitLeft ? limitLeft : left > limitRight ? limitRight : left;
  661. };
  662. self.exports.cropVal = function(c, e) {
  663. return c <= e && c >= -e ? 0 : c;
  664. };
  665. self.exports.isNumber = function(value) {
  666. return null != value && "number" == typeof value && !isNaN(value) && isFinite(value);
  667. };
  668. self.exports.arrayInts = function(indices) {
  669. var i = 0;
  670. for (; i < indices.length; ++i) {
  671. if (!self.exports.isNumber(indices[i])) {
  672. return false;
  673. }
  674. }
  675. return true;
  676. };
  677. self.exports.isArray = function(value) {
  678. return !!value && value.constructor === Array;
  679. };
  680. self.exports.isString = function(string) {
  681. return string && "string" == typeof string;
  682. };
  683. self.exports.lineInRect = function(first, depth, pos, n, scale, i, time, value, to, j, y2, size) {
  684. var y = (time - first) * n;
  685. var x = (j - first) * n;
  686. var top = (to - pos) * i;
  687. var progress = (size - pos) * i;
  688. var imageHeight = (value - depth) * scale;
  689. var newX = (y2 - depth) * scale;
  690. var costSum = Math.max(Math.max(Math.min(y, x), Math.min(top, progress)), Math.min(imageHeight, newX));
  691. var gasSum = Math.min(Math.min(Math.max(y, x), Math.max(top, progress)), Math.max(imageHeight, newX));
  692. return !(0 > gasSum) && !(costSum > gasSum) && costSum;
  693. };
  694. self.exports.pointInBox3D = function(comparisonY, comparisonX, y, b, dist) {
  695. return dist = dist || 0, comparisonY >= b.x - b.width - dist && comparisonY <= b.x + b.width + dist && comparisonX >= b.y - b.height - dist && comparisonX <= b.y + b.height + dist && y >= b.z - b.length - dist && y <= b.z + b.length + dist;
  696. };
  697. self.exports.similar = function(b, a, opts) {
  698. return opts = opts || 0, Math.abs(b - a) <= opts;
  699. };
  700. self.exports.pointInBox = function(pos, e, start, n, end, el, box) {
  701. return box ? pos >= start && pos <= end && e >= n && e <= el : pos > start && pos < end && e > n && e < el;
  702. };
  703. self.exports.sharePos = function(a, b, tolerance) {
  704. return tolerance = tolerance || 0, Math.abs(a.x - b.x) <= tolerance && Math.abs(a.y - b.y) <= tolerance && Math.abs(a.z - b.z) <= tolerance && Math.abs(a.d - b.d) <= tolerance;
  705. };
  706. self.exports.cdv = {
  707. x : "width",
  708. y : "height",
  709. z : "length"
  710. };
  711. self.exports.boxIntersection = function(size, r, i, axis, m) {
  712. var z = self.exports.cdv[i];
  713. var dim = self.exports.cdv[axis];
  714. var length = size[i] - size[z] - .1;
  715. var start = r[i] - r[z] - .1;
  716. var x = size[i] + size[z] + .1;
  717. var y = r[i] + r[z] + .1;
  718. var value = size[axis] - size[dim] - .1;
  719. var val = r[axis] - r[dim] - .1;
  720. var a = size[axis] + size[dim] + .1;
  721. var b = r[axis] + r[dim] + .1;
  722. var total = Math.max(length, start);
  723. var target = Math.min(x, y);
  724. if (target >= total) {
  725. var ast = Math.max(value, val);
  726. var merger = Math.min(a, b);
  727. if (merger >= ast) {
  728. var lines = [{
  729. [i]:total,
  730. [axis]:ast,
  731. d : m[0]
  732. }, {
  733. [i]:target,
  734. [axis]:merger,
  735. d : m[1]
  736. }, {
  737. [i]:total,
  738. [axis]:merger,
  739. d : m[2]
  740. }, {
  741. [i]:target,
  742. [axis]:ast,
  743. d : m[3]
  744. }];
  745. var j = lines.length - 1;
  746. for (; 0 <= j; --j) {
  747. if (lines[j][i] == x && lines[j][i] == y || lines[j][i] == length && lines[j][i] == start || lines[j][axis] == a && lines[j][axis] == b || lines[j][axis] == value && lines[j][axis] == val || self.exports.pointInBox(lines[j][i], lines[j][axis], length, value, x, a) || self.exports.pointInBox(lines[j][i], lines[j][axis], start, val, y, b)) {
  748. lines[j].dontUse = true;
  749. }
  750. }
  751. return lines;
  752. }
  753. }
  754. return null;
  755. };
  756. self.exports.boxCornerIntersection = function(size, r, x, axis) {
  757. var z = self.exports.cdv[x];
  758. var dim = self.exports.cdv[axis];
  759. var y = size[x] - size[z];
  760. var valueBeginIndex = r[x] - r[z];
  761. var u = size[x] + size[z];
  762. var DLF = r[x] + r[z];
  763. var l = size[axis] - size[dim];
  764. var mayaK2Icon = r[axis] - r[dim];
  765. var h = size[axis] + size[dim];
  766. var $noRangeMsg = r[axis] + r[dim];
  767. var data = [{
  768. [x]:y,
  769. [axis]:l,
  770. d : Math.PI / 2
  771. }, {
  772. [x]:y,
  773. [axis]:h,
  774. d : Math.PI
  775. }, {
  776. [x]:u,
  777. [axis]:l,
  778. d : 0
  779. }, {
  780. [x]:u,
  781. [axis]:h,
  782. d : -Math.PI / 2
  783. }];
  784. var i = data.length - 1;
  785. for (; 0 <= i; --i) {
  786. data[i].i = i;
  787. if (!self.exports.pointInBox(data[i][x], data[i][axis], valueBeginIndex, mayaK2Icon, DLF, $noRangeMsg, true)) {
  788. data.splice(i, 1);
  789. }
  790. }
  791. return data.length ? data : null;
  792. };
  793. self.exports.getIntersection = function(pos, b, k) {
  794. var i = self.exports.cdv[k];
  795. var fromIndex = pos[k] - pos[i];
  796. var a = b[k] - b[i];
  797. var deltaTime = pos[k] + pos[i];
  798. var gl = b[k] + b[i];
  799. var u = Math.max(fromIndex, a);
  800. var v = Math.min(deltaTime, gl);
  801. if (v >= u) {
  802. var pagesNum = (v - u) / 2;
  803. return {
  804. [k]:u + pagesNum,
  805. [i]:pagesNum
  806. };
  807. }
  808. return null;
  809. };
  810. self.exports.limitRectVal = function(values, array, i) {
  811. var j = self.exports.cdv[i];
  812. if (values[i] - values[j] < array[i] - array[j]) {
  813. var dx = (array[i] - array[j] - (values[i] - values[j])) / 2;
  814. values[j] -= dx;
  815. values[i] += dx;
  816. }
  817. if (values[i] + values[j] > array[i] + array[j]) {
  818. dx = (values[i] + values[j] - (array[i] + array[j])) / 2;
  819. values[j] -= dx;
  820. values[i] -= dx;
  821. }
  822. };
  823. self.exports.getMaxRect = function(data, p, i) {
  824. var x;
  825. var lastY;
  826. var b;
  827. var y;
  828. var d = self.exports.cdv[p];
  829. var k = self.exports.cdv[i];
  830. var s = 0;
  831. for (; s < data.length; ++s) {
  832. x = null == x ? data[s][p] - data[s][d] : Math.min(data[s][p] - data[s][d], x);
  833. b = null == b ? data[s][p] + data[s][d] : Math.max(data[s][p] + data[s][d], b);
  834. lastY = null == lastY ? data[s][i] - data[s][k] : Math.min(data[s][i] - data[s][k], lastY);
  835. y = null == y ? data[s][i] + data[s][k] : Math.max(data[s][i] + data[s][k], y);
  836. }
  837. return {
  838. [p]:(x + b) / 2,
  839. [i]:(lastY + y) / 2,
  840. [d]:Math.abs(b - x) / 2,
  841. [k]:Math.abs(y - lastY) / 2
  842. };
  843. };
  844. self.exports.limitRect = function(o, f, i, m, b, status, index, name) {
  845. var output = self.exports.getMaxRect(status, index, name);
  846. var key = self.exports.cdv[index];
  847. var prop = self.exports.cdv[name];
  848. var data = {};
  849. if (data[index] = o, data[name] = f, data[key] = i, data[prop] = m, self.exports.limitRectVal(data, output, index), self.exports.limitRectVal(data, output, name), 0 == b || b == Math.PI) {
  850. var fieldValue = data[key];
  851. data[key] = data[prop];
  852. data[prop] = fieldValue;
  853. }
  854. return data;
  855. };
  856. self.exports.progressOnLine = function(l, p, r, i, v, n) {
  857. var w = r - l;
  858. var x = i - p;
  859. var scale = Math.sqrt(w * w + x * x);
  860. return ((w = w / scale) * (v - l) + (x = x / scale) * (n - p)) / Math.sqrt(Math.pow(r - l, 2) + Math.pow(i - p, 2));
  861. };
  862. self.exports.generateSID = function(bones) {
  863. var sid = 0;
  864. var r = true;
  865. for (; r;) {
  866. r = false;
  867. sid++;
  868. var i = 0;
  869. for (; i < bones.length; ++i) {
  870. if (bones[i].sid == sid) {
  871. r = true;
  872. break;
  873. }
  874. }
  875. }
  876. return sid;
  877. };
  878. self.exports.levelIconId = function(canCreateDiscussions) {
  879. return Math.max(Math.min(target.maxLevel - 2, canCreateDiscussions.roundToNearest(3) - 2), 0);
  880. };
  881. self.exports.copyToClipboard = function(data) {
  882. const textarea = document.createElement("textarea");
  883. textarea.value = data;
  884. textarea.setAttribute("readonly", "");
  885. textarea.style.position = "absolute";
  886. textarea.style.left = "-9999px";
  887. document.body.appendChild(textarea);
  888. const stored_selection = !!(0 < document.getSelection().rangeCount) && document.getSelection().getRangeAt(0);
  889. textarea.select();
  890. document.execCommand("copy");
  891. document.body.removeChild(textarea);
  892. if (stored_selection) {
  893. document.getSelection().removeAllRanges();
  894. document.getSelection().addRange(stored_selection);
  895. }
  896. };
  897. var o = function(e, l) {
  898. return e.concat(l);
  899. };
  900. Array.prototype.flatMap = function(a) {
  901. return function(name, e) {
  902. return e.map(name).reduce(o, []);
  903. }(a, this);
  904. };
  905. var privateMethods = moment(26);
  906. self.exports.encodeNetworkMessage = function(value, key) {
  907. let n = privateMethods.encode(value);
  908. let o = new Uint8Array(n.length + 2);
  909. return o.set(self.exports.encodeShort(key), 0), o.set(n, 2), o;
  910. };
  911. self.exports.decodeNetworkMessage = function(basic_data) {
  912. basic_data = new Uint8Array(basic_data);
  913. let r = self.exports.decodeShort(basic_data[0], basic_data[1]);
  914. let s = basic_data.slice(2);
  915. return [privateMethods.decode(s), r];
  916. };
  917. self.exports.rotateNumber = function(preventPushState, id) {
  918. return 255 & preventPushState + id;
  919. };
  920. self.exports.encodeShort = function(s) {
  921. return [15 & s >> 4, 15 & s];
  922. };
  923. self.exports.decodeShort = function(byte1, byte2) {
  924. return (byte1 << 4) + byte2;
  925. };
  926. self.exports.restartIfNeeded = function(data) {
  927. if (target.needsRestart) {
  928. var i;
  929. for (i in data.sockets) {
  930. var host = data.sockets[i];
  931. host.send("error", "GAME UPDATING");
  932. host.close();
  933. }
  934. setTimeout(function() {
  935. toStage.exit();
  936. }, 1e3);
  937. }
  938. };
  939. }).call(this, moment(13));
  940. }, function(canCreateDiscussions, exports, require) {
  941. function Scope(options) {
  942. return this instanceof Scope ? (this.options = options, void this.init()) : new Scope(options);
  943. }
  944. function extend(a, b) {
  945. return a && b ? function() {
  946. return a.apply(this, arguments), b.apply(this, arguments);
  947. } : a || b;
  948. }
  949. function createCodec(options) {
  950. return new Scope(options);
  951. }
  952. var IS_ARRAY = require(9);
  953. exports.createCodec = createCodec;
  954. exports.install = function(object) {
  955. var name;
  956. for (name in object) {
  957. Scope.prototype[name] = extend(Scope.prototype[name], object[name]);
  958. }
  959. };
  960. exports.filter = function(filter) {
  961. return IS_ARRAY(filter) ? function(model) {
  962. function toDate(type, format) {
  963. return format(type);
  964. }
  965. return model = model.slice(), function(unLegalValue) {
  966. return model.reduce(toDate, unLegalValue);
  967. };
  968. }(filter) : filter;
  969. };
  970. var Bufferish = require(0);
  971. Scope.prototype.init = function() {
  972. var options = this.options;
  973. return options && options.uint8array && (this.bufferish = Bufferish.Uint8Array), this;
  974. };
  975. exports.preset = createCodec({
  976. preset : true
  977. });
  978. }, , function(canCreateDiscussions, proxy, require) {
  979. function init() {
  980. var options = this.options;
  981. return this.encode = function(options) {
  982. var grasshopper = WriteType.getWriteType(options);
  983. return function(tile, end) {
  984. var channelRiver = grasshopper[typeof end];
  985. if (!channelRiver) {
  986. throw new Error('Unsupported type "' + typeof end + '": ' + end);
  987. }
  988. channelRiver(tile, end);
  989. };
  990. }(options), options && options.preset && ExtPacker.setExtPackers(this), this;
  991. }
  992. var ExtBuffer = require(7).ExtBuffer;
  993. var ExtPacker = require(34);
  994. var WriteType = require(35);
  995. var CodecBase = require(4);
  996. CodecBase.install({
  997. addExtPacker : function(etype, Class, packer) {
  998. function extPacker(value) {
  999. return packer && (value = packer(value)), new ExtBuffer(value, etype);
  1000. }
  1001. packer = CodecBase.filter(packer);
  1002. var name = Class.name;
  1003. if (name && "Object" !== name) {
  1004. var packers = this.extPackers || (this.extPackers = {});
  1005. packers[name] = extPacker;
  1006. } else {
  1007. var list = this.extEncoderList || (this.extEncoderList = []);
  1008. list.unshift([Class, extPacker]);
  1009. }
  1010. },
  1011. getExtPacker : function(value) {
  1012. var packers = this.extPackers || (this.extPackers = {});
  1013. var c = value.constructor;
  1014. var e = c && c.name && packers[c.name];
  1015. if (e) {
  1016. return e;
  1017. }
  1018. var b;
  1019. var list = this.extEncoderList || (this.extEncoderList = []);
  1020. var dataLen = list.length;
  1021. var j = 0;
  1022. for (; j < dataLen; j++) {
  1023. if (b = list[j], c === b[0]) {
  1024. return b[1];
  1025. }
  1026. }
  1027. },
  1028. init : init
  1029. });
  1030. proxy.preset = init.call(CodecBase.preset);
  1031. }, function(canCreateDiscussions, exports, nextValFn) {
  1032. exports.ExtBuffer = function Wysiwyg(element, options) {
  1033. return this instanceof Wysiwyg ? (this.buffer = val.from(element), void(this.type = options)) : new Wysiwyg(element, options);
  1034. };
  1035. var val = nextValFn(0);
  1036. }, function(canCreateDiscussions, asyncFile) {
  1037. asyncFile.read = function(index, offset, n, b, a) {
  1038. var i;
  1039. var j;
  1040. var saltLen = 8 * a - b - 1;
  1041. var ms_controller = (1 << saltLen) - 1;
  1042. var TIMEOUT_POLL_DECREMENT = ms_controller >> 1;
  1043. var c = -7;
  1044. var k = n ? a - 1 : 0;
  1045. var m = n ? -1 : 1;
  1046. var g = index[offset + k];
  1047. k = k + m;
  1048. i = g & (1 << -c) - 1;
  1049. g = g >> -c;
  1050. c = c + saltLen;
  1051. for (; 0 < c; i = 256 * i + index[offset + k], k = k + m, c = c - 8) {
  1052. }
  1053. j = i & (1 << -c) - 1;
  1054. i = i >> -c;
  1055. c = c + b;
  1056. for (; 0 < c; j = 256 * j + index[offset + k], k = k + m, c = c - 8) {
  1057. }
  1058. if (0 === i) {
  1059. i = 1 - TIMEOUT_POLL_DECREMENT;
  1060. } else {
  1061. if (i === ms_controller) {
  1062. return j ? NaN : 1 / 0 * (g ? -1 : 1);
  1063. }
  1064. j = j + Math.pow(2, b);
  1065. i = i - TIMEOUT_POLL_DECREMENT;
  1066. }
  1067. return (g ? -1 : 1) * j * Math.pow(2, i - b);
  1068. };
  1069. asyncFile.write = function(a, v, offset, isLE, mLen, nBytes) {
  1070. var x;
  1071. var m;
  1072. var c;
  1073. var eLen = 8 * nBytes - mLen - 1;
  1074. var j = (1 << eLen) - 1;
  1075. var level = j >> 1;
  1076. var rt = 23 === mLen ? Math.pow(2, -24) - Math.pow(2, -77) : 0;
  1077. var i = isLE ? 0 : nBytes - 1;
  1078. var d = isLE ? 1 : -1;
  1079. var y = 0 > v || 0 === v && 0 > 1 / v ? 1 : 0;
  1080. v = Math.abs(v);
  1081. if (isNaN(v) || v === 1 / 0) {
  1082. m = isNaN(v) ? 1 : 0;
  1083. x = j;
  1084. } else {
  1085. x = Math.floor(Math.log(v) / Math.LN2);
  1086. if (1 > v * (c = Math.pow(2, -x))) {
  1087. x--;
  1088. c = c * 2;
  1089. }
  1090. if (2 <= (v = v + (1 <= x + level ? rt / c : rt * Math.pow(2, 1 - level))) * c) {
  1091. x++;
  1092. c = c / 2;
  1093. }
  1094. if (x + level >= j) {
  1095. m = 0;
  1096. x = j;
  1097. } else {
  1098. if (1 <= x + level) {
  1099. m = (v * c - 1) * Math.pow(2, mLen);
  1100. x = x + level;
  1101. } else {
  1102. m = v * Math.pow(2, level - 1) * Math.pow(2, mLen);
  1103. x = 0;
  1104. }
  1105. }
  1106. }
  1107. for (; 8 <= mLen; a[offset + i] = 255 & m, i = i + d, m = m / 256, mLen = mLen - 8) {
  1108. }
  1109. x = x << mLen | m;
  1110. eLen = eLen + mLen;
  1111. for (; 0 < eLen; a[offset + i] = 255 & x, i = i + d, x = x / 256, eLen = eLen - 8) {
  1112. }
  1113. a[offset + i - d] |= 128 * y;
  1114. };
  1115. }, function(mixin, canCreateDiscussions) {
  1116. var check = {}.toString;
  1117. mixin.exports = Array.isArray || function(t) {
  1118. return "[object Array]" == check.call(t);
  1119. };
  1120. }, function(canCreateDiscussions, exports, require) {
  1121. function copy(target, targetStart, start, end) {
  1122. var thisIsBuffer = Bufferish.isBuffer(this);
  1123. var targetIsBuffer = Bufferish.isBuffer(target);
  1124. if (thisIsBuffer && targetIsBuffer) {
  1125. return this.copy(target, targetStart, start, end);
  1126. }
  1127. if (!brokenTypedArray && !thisIsBuffer && !targetIsBuffer && Bufferish.isView(this) && Bufferish.isView(target)) {
  1128. var blimbs = start || null != end ? slice.call(this, start, end) : this;
  1129. return target.set(blimbs, targetStart), blimbs.length;
  1130. }
  1131. return d.copy.call(this, target, targetStart, start, end);
  1132. }
  1133. function slice(start, end) {
  1134. var f = this.slice || !brokenTypedArray && this.subarray;
  1135. if (f) {
  1136. return f.call(this, start, end);
  1137. }
  1138. var value = Bufferish.alloc.call(this, end - start);
  1139. return copy.call(this, value, 0, start, end), value;
  1140. }
  1141. var p;
  1142. var d = require(33);
  1143. exports.copy = copy;
  1144. exports.slice = slice;
  1145. exports.toString = function() {
  1146. return (!isBufferShim && Bufferish.isBuffer(this) ? this.toString : d.toString).apply(this, arguments);
  1147. };
  1148. exports.write = (p = "write", function() {
  1149. var oldSetupComputes = this[p] || d[p];
  1150. return oldSetupComputes.apply(this, arguments);
  1151. });
  1152. var Bufferish = require(0);
  1153. var Buffer = Bufferish.global;
  1154. var isBufferShim = Bufferish.hasBuffer && "TYPED_ARRAY_SUPPORT" in Buffer;
  1155. var brokenTypedArray = isBufferShim && !Buffer.TYPED_ARRAY_SUPPORT;
  1156. }, function(canCreateDiscussions, innerDOMObject, require) {
  1157. (function(Buffer) {
  1158. !function(lp) {
  1159. function factory(name, v, _) {
  1160. function load(buf, start, success, uuid) {
  1161. return this instanceof load ? function(file, buffer, offset, value, raddix) {
  1162. if (UINT8ARRAY && ARRAYBUFFER && (buffer instanceof ARRAYBUFFER && (buffer = new UINT8ARRAY(buffer)), value instanceof ARRAYBUFFER && (value = new UINT8ARRAY(value))), !(buffer || offset || value || storage)) {
  1163. return void(file.buffer = parse(value, 0));
  1164. }
  1165. if (!isValidBuffer(buffer, offset)) {
  1166. var _storage = storage || Array;
  1167. raddix = offset;
  1168. value = buffer;
  1169. offset = 0;
  1170. buffer = new _storage(8);
  1171. }
  1172. file.buffer = buffer;
  1173. file.offset = offset = offset | 0;
  1174. if (!(void 0 === value)) {
  1175. if ("string" == typeof value) {
  1176. (function(data, offset, match, raddix) {
  1177. var index = 0;
  1178. var pos = match.length;
  1179. var high = 0;
  1180. var low = 0;
  1181. if ("-" === match[0]) {
  1182. index++;
  1183. }
  1184. var chr;
  1185. var lastCutIndex = index;
  1186. for (; index < pos && 0 <= (chr = parseInt(match[index++], raddix));) {
  1187. low = low * raddix + chr;
  1188. high = high * raddix + Math.floor(low / 4294967296);
  1189. low = low % 4294967296;
  1190. }
  1191. if (lastCutIndex) {
  1192. high = ~high;
  1193. if (low) {
  1194. low = 4294967296 - low;
  1195. } else {
  1196. high++;
  1197. }
  1198. }
  1199. writeInt32(data, offset + posL, high);
  1200. writeInt32(data, offset + posH, low);
  1201. })(buffer, offset, value, raddix || 10);
  1202. } else {
  1203. if (isValidBuffer(value, raddix)) {
  1204. fromArray(buffer, offset, value, raddix);
  1205. } else {
  1206. if ("number" == typeof raddix) {
  1207. writeInt32(buffer, offset + posL, value);
  1208. writeInt32(buffer, offset + posH, raddix);
  1209. } else {
  1210. if (0 < value) {
  1211. fn(buffer, offset, value);
  1212. } else {
  1213. if (0 > value) {
  1214. start(buffer, offset, value);
  1215. } else {
  1216. fromArray(buffer, offset, value, 0);
  1217. }
  1218. }
  1219. }
  1220. }
  1221. }
  1222. }
  1223. }(this, buf, start, success, uuid) : new load(buf, start, success, uuid);
  1224. }
  1225. function toNumber() {
  1226. var buffer = this.buffer;
  1227. var offset = this.offset;
  1228. var high = readInt32(buffer, offset + posL);
  1229. var low = readInt32(buffer, offset + posH);
  1230. return _ || (high = high | 0), high ? 4294967296 * high + low : low;
  1231. }
  1232. function writeInt32(data, i, value) {
  1233. data[i + s] = 255 & value;
  1234. value = value >> 8;
  1235. data[i + y] = 255 & value;
  1236. value = value >> 8;
  1237. data[i + x] = 255 & value;
  1238. value = value >> 8;
  1239. data[i + n] = 255 & value;
  1240. }
  1241. function readInt32(data, _) {
  1242. return 16777216 * data[_ + n] + (data[_ + x] << 16) + (data[_ + y] << 8) + data[_ + s];
  1243. }
  1244. var posL = v ? 0 : 4;
  1245. var posH = v ? 4 : 0;
  1246. var n = v ? 0 : 3;
  1247. var x = v ? 1 : 2;
  1248. var y = v ? 2 : 1;
  1249. var s = v ? 3 : 0;
  1250. var fn = v ? height : hide;
  1251. var start = v ? from : wrap;
  1252. var proto = load.prototype;
  1253. var isName = "is" + name;
  1254. var _isInt64 = "_" + isName;
  1255. return proto.buffer = void 0, proto.offset = 0, proto[_isInt64] = true, proto.toNumber = toNumber, proto.toString = function(radix) {
  1256. var buffer = this.buffer;
  1257. var offset = this.offset;
  1258. var high = readInt32(buffer, offset + posL);
  1259. var low = readInt32(buffer, offset + posH);
  1260. var str = "";
  1261. var data = !_ && 2147483648 & high;
  1262. if (data) {
  1263. high = ~high;
  1264. low = 4294967296 - low;
  1265. }
  1266. radix = radix || 10;
  1267. for (;;) {
  1268. var mod = high % radix * 4294967296 + low;
  1269. if (high = Math.floor(high / radix), low = Math.floor(mod / radix), str = (mod % radix).toString(radix) + str, !high && !low) {
  1270. break;
  1271. }
  1272. }
  1273. return data && (str = "-" + str), str;
  1274. }, proto.toJSON = toNumber, proto.toArray = toArray, BUFFER && (proto.toBuffer = toBuffer), UINT8ARRAY && (proto.toArrayBuffer = toArrayBuffer), load[isName] = function(b) {
  1275. return !(!b || !b[_isInt64]);
  1276. }, lp[name] = load, load;
  1277. }
  1278. function toArray(array_like) {
  1279. var child = this.buffer;
  1280. var x = this.offset;
  1281. return storage = null, false !== array_like && 0 === x && 8 === child.length && _dispatchToArray(child) ? child : parse(child, x);
  1282. }
  1283. function toBuffer(size) {
  1284. var value = this.buffer;
  1285. var offset = this.offset;
  1286. if (storage = BUFFER, false !== size && 0 === offset && 8 === value.length && Buffer.isBuffer(value)) {
  1287. return value;
  1288. }
  1289. var result = new BUFFER(8);
  1290. return fromArray(result, 0, value, offset), result;
  1291. }
  1292. function toArrayBuffer(raw) {
  1293. var buffer = this.buffer;
  1294. var offset = this.offset;
  1295. var arrbuf = buffer.buffer;
  1296. if (storage = UINT8ARRAY, false !== raw && 0 === offset && arrbuf instanceof ARRAYBUFFER && 8 === arrbuf.byteLength) {
  1297. return arrbuf;
  1298. }
  1299. var dest = new UINT8ARRAY(8);
  1300. return fromArray(dest, 0, buffer, offset), dest.buffer;
  1301. }
  1302. function isValidBuffer(buffer, offset) {
  1303. var len = buffer && buffer.length;
  1304. return offset = offset | 0, len && offset + 8 <= len && "string" != typeof buffer[offset];
  1305. }
  1306. function fromArray(value, key, data, offset) {
  1307. key = key | 0;
  1308. offset = offset | 0;
  1309. var o = 0;
  1310. for (; 8 > o; o++) {
  1311. value[key++] = 255 & data[offset++];
  1312. }
  1313. }
  1314. function parse(t, x) {
  1315. return Array.prototype.slice.call(t, x, x + 8);
  1316. }
  1317. function height(data, a, value) {
  1318. var b = a + 8;
  1319. for (; b > a;) {
  1320. data[--b] = 255 & value;
  1321. value = value / 256;
  1322. }
  1323. }
  1324. function from(event, start, width) {
  1325. var stop = start + 8;
  1326. width++;
  1327. for (; stop > start;) {
  1328. event[--stop] = 255 ^ 255 & -width;
  1329. width = width / 256;
  1330. }
  1331. }
  1332. function hide(data, offset, value) {
  1333. var extend = offset + 8;
  1334. for (; offset < extend;) {
  1335. data[offset++] = 255 & value;
  1336. value = value / 256;
  1337. }
  1338. }
  1339. function wrap(name, n, width) {
  1340. var nid = n + 8;
  1341. width++;
  1342. for (; n < nid;) {
  1343. name[n++] = 255 ^ 255 & -width;
  1344. width = width / 256;
  1345. }
  1346. }
  1347. var storage;
  1348. var BUFFER = void 0 !== Buffer && Buffer;
  1349. var UINT8ARRAY = "undefined" != typeof Uint8Array && Uint8Array;
  1350. var ARRAYBUFFER = "undefined" != typeof ArrayBuffer && ArrayBuffer;
  1351. var value = [0, 0, 0, 0, 0, 0, 0, 0];
  1352. var _dispatchToArray = Array.isArray || function(_root) {
  1353. return !!_root && "[object Array]" == Object.prototype.toString.call(_root);
  1354. };
  1355. factory("Uint64BE", true, true);
  1356. factory("Int64BE", true, false);
  1357. factory("Uint64LE", false, true);
  1358. factory("Int64LE", false, false);
  1359. }("string" != typeof innerDOMObject.nodeName ? innerDOMObject : this || {});
  1360. }).call(this, require(16).Buffer);
  1361. }, function(canCreateDiscussions, proxy, require) {
  1362. function init() {
  1363. var options = this.options;
  1364. return this.decode = function(options) {
  1365. var code = ReadToken.getReadToken(options);
  1366. return function(a) {
  1367. var k = f(a);
  1368. var type = code[k];
  1369. if (!type) {
  1370. throw new Error("Invalid type: " + (k ? "0x" + k.toString(16) : k));
  1371. }
  1372. return type(a);
  1373. };
  1374. }(options), options && options.preset && ExtUnpacker.setExtUnpackers(this), this;
  1375. }
  1376. var ExtBuffer = require(7).ExtBuffer;
  1377. var ExtUnpacker = require(37);
  1378. var f = require(21).readUint8;
  1379. var ReadToken = require(38);
  1380. var CodecBase = require(4);
  1381. CodecBase.install({
  1382. addExtUnpacker : function(etype, unpacker) {
  1383. (this.extUnpackers || (this.extUnpackers = []))[etype] = CodecBase.filter(unpacker);
  1384. },
  1385. getExtUnpacker : function(type) {
  1386. return (this.extUnpackers || (this.extUnpackers = []))[type] || function(buffer) {
  1387. return new ExtBuffer(buffer, type);
  1388. };
  1389. },
  1390. init : init
  1391. });
  1392. proxy.preset = init.call(CodecBase.preset);
  1393. }, function(mixin, canCreateDiscussions) {
  1394. function defaultSetTimout() {
  1395. throw new Error("setTimeout has not been defined");
  1396. }
  1397. function defaultClearTimeout() {
  1398. throw new Error("clearTimeout has not been defined");
  1399. }
  1400. function runTimeout(fun) {
  1401. if (cachedSetTimeout === setTimeout) {
  1402. return setTimeout(fun, 0);
  1403. }
  1404. if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
  1405. return cachedSetTimeout = setTimeout, setTimeout(fun, 0);
  1406. }
  1407. try {
  1408. return cachedSetTimeout(fun, 0);
  1409. } catch (e) {
  1410. try {
  1411. return cachedSetTimeout.call(null, fun, 0);
  1412. } catch (e) {
  1413. return cachedSetTimeout.call(this, fun, 0);
  1414. }
  1415. }
  1416. }
  1417. function cleanUpNextTick() {
  1418. if (fm && f) {
  1419. fm = false;
  1420. if (f.length) {
  1421. self = f.concat(self);
  1422. } else {
  1423. _testNo = -1;
  1424. }
  1425. if (self.length) {
  1426. drainQueue();
  1427. }
  1428. }
  1429. }
  1430. function drainQueue() {
  1431. if (!fm) {
  1432. var timeout = runTimeout(cleanUpNextTick);
  1433. fm = true;
  1434. var _testLength = self.length;
  1435. for (; _testLength;) {
  1436. f = self;
  1437. self = [];
  1438. for (; ++_testNo < _testLength;) {
  1439. if (f) {
  1440. f[_testNo].run();
  1441. }
  1442. }
  1443. _testNo = -1;
  1444. _testLength = self.length;
  1445. }
  1446. f = null;
  1447. fm = false;
  1448. (function(marker) {
  1449. if (cachedClearTimeout === clearTimeout) {
  1450. return clearTimeout(marker);
  1451. }
  1452. if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
  1453. return cachedClearTimeout = clearTimeout, clearTimeout(marker);
  1454. }
  1455. try {
  1456. cachedClearTimeout(marker);
  1457. } catch (e) {
  1458. try {
  1459. return cachedClearTimeout.call(null, marker);
  1460. } catch (e) {
  1461. return cachedClearTimeout.call(this, marker);
  1462. }
  1463. }
  1464. })(timeout);
  1465. }
  1466. }
  1467. function Item(fun, array) {
  1468. this.fun = fun;
  1469. this.array = array;
  1470. }
  1471. function noop() {
  1472. }
  1473. var cachedSetTimeout;
  1474. var cachedClearTimeout;
  1475. var process = mixin.exports = {};
  1476. !function() {
  1477. try {
  1478. cachedSetTimeout = "function" == typeof setTimeout ? setTimeout : defaultSetTimout;
  1479. } catch (t) {
  1480. cachedSetTimeout = defaultSetTimout;
  1481. }
  1482. try {
  1483. cachedClearTimeout = "function" == typeof clearTimeout ? clearTimeout : defaultClearTimeout;
  1484. } catch (t) {
  1485. cachedClearTimeout = defaultClearTimeout;
  1486. }
  1487. }();
  1488. var f;
  1489. var self = [];
  1490. var fm = false;
  1491. var _testNo = -1;
  1492. process.nextTick = function(value) {
  1493. var args = Array(arguments.length - 1);
  1494. if (1 < arguments.length) {
  1495. var i = 1;
  1496. for (; i < arguments.length; i++) {
  1497. args[i - 1] = arguments[i];
  1498. }
  1499. }
  1500. self.push(new Item(value, args));
  1501. if (!(1 !== self.length || fm)) {
  1502. runTimeout(drainQueue);
  1503. }
  1504. };
  1505. Item.prototype.run = function() {
  1506. this.fun.apply(null, this.array);
  1507. };
  1508. process.title = "browser";
  1509. process.browser = true;
  1510. process.env = {};
  1511. process.argv = [];
  1512. process.version = "";
  1513. process.versions = {};
  1514. process.on = noop;
  1515. process.addListener = noop;
  1516. process.once = noop;
  1517. process.off = noop;
  1518. process.removeListener = noop;
  1519. process.removeAllListeners = noop;
  1520. process.emit = noop;
  1521. process.prependListener = noop;
  1522. process.prependOnceListener = noop;
  1523. process.listeners = function() {
  1524. return [];
  1525. };
  1526. process.binding = function() {
  1527. throw new Error("process.binding is not supported");
  1528. };
  1529. process.cwd = function() {
  1530. return "/";
  1531. };
  1532. process.chdir = function() {
  1533. throw new Error("process.chdir is not supported");
  1534. };
  1535. process.umask = function() {
  1536. return 0;
  1537. };
  1538. }, function(canCreateDiscussions, colorsProto, require) {
  1539. colorsProto.encode = function(object, options) {
  1540. var encoder = new EncodeBuffer(options);
  1541. return encoder.write(object), encoder.read();
  1542. };
  1543. var EncodeBuffer = require(15).EncodeBuffer;
  1544. }, function(canCreateDiscussions, exports, require) {
  1545. function EncodeBuffer(options) {
  1546. if (!(this instanceof EncodeBuffer)) {
  1547. return new EncodeBuffer(options);
  1548. }
  1549. if (options && (this.options = options, options.codec)) {
  1550. var codec = this.codec = options.codec;
  1551. if (codec.bufferish) {
  1552. this.bufferish = codec.bufferish;
  1553. }
  1554. }
  1555. }
  1556. exports.EncodeBuffer = EncodeBuffer;
  1557. var preset = require(6).preset;
  1558. require(18).FlexEncoder.mixin(EncodeBuffer.prototype);
  1559. EncodeBuffer.prototype.codec = preset;
  1560. EncodeBuffer.prototype.write = function(type) {
  1561. this.codec.encode(this, type);
  1562. };
  1563. }, function(canCreateDiscussions, exports, require) {
  1564. (function(global) {
  1565. function kMaxLength() {
  1566. return Buffer.TYPED_ARRAY_SUPPORT ? 2147483647 : 1073741823;
  1567. }
  1568. function callback(target, x) {
  1569. if (kMaxLength() < x) {
  1570. throw new RangeError("Invalid typed array length");
  1571. }
  1572. return Buffer.TYPED_ARRAY_SUPPORT ? (target = new Uint8Array(x)).__proto__ = Buffer.prototype : (null === target && (target = new Buffer(x)), target.length = x), target;
  1573. }
  1574. function Buffer(arg, type, length) {
  1575. if (!(Buffer.TYPED_ARRAY_SUPPORT || this instanceof Buffer)) {
  1576. return new Buffer(arg, type, length);
  1577. }
  1578. if ("number" == typeof arg) {
  1579. if ("string" == typeof type) {
  1580. throw new Error("If encoding is specified then the first argument must be a string");
  1581. }
  1582. return allocUnsafe(this, arg);
  1583. }
  1584. return parse(this, arg, type, length);
  1585. }
  1586. function parse(a, obj, v, x) {
  1587. if ("number" == typeof obj) {
  1588. throw new TypeError('"value" argument must not be a number');
  1589. }
  1590. return "undefined" != typeof ArrayBuffer && obj instanceof ArrayBuffer ? function(result, source, byteOffset, number) {
  1591. if (source.byteLength, 0 > byteOffset || source.byteLength < byteOffset) {
  1592. throw new RangeError("'offset' is out of bounds");
  1593. }
  1594. if (source.byteLength < byteOffset + (number || 0)) {
  1595. throw new RangeError("'length' is out of bounds");
  1596. }
  1597. return source = void 0 === byteOffset && void 0 === number ? new Uint8Array(source) : void 0 === number ? new Uint8Array(source, byteOffset) : new Uint8Array(source, byteOffset, number), Buffer.TYPED_ARRAY_SUPPORT ? (result = source).__proto__ = Buffer.prototype : result = next(result, source), result;
  1598. }(a, obj, v, x) : "string" == typeof obj ? function(result, string, value) {
  1599. if (("string" != typeof value || "" === value) && (value = "utf8"), !Buffer.isEncoding(value)) {
  1600. throw new TypeError('"encoding" must be a valid string encoding');
  1601. }
  1602. var undefined = 0 | byteLength(string, value);
  1603. var i = (result = callback(result, undefined)).write(string, value);
  1604. return i !== undefined && (result = result.slice(0, i)), result;
  1605. }(a, obj, v) : function(result, obj) {
  1606. if (Buffer.isBuffer(obj)) {
  1607. var len = 0 | checked(obj.length);
  1608. return 0 === (result = callback(result, len)).length ? result : (obj.copy(result, 0, 0, len), result);
  1609. }
  1610. if (obj) {
  1611. if ("undefined" != typeof ArrayBuffer && obj.buffer instanceof ArrayBuffer || "length" in obj) {
  1612. return "number" != typeof obj.length || function(value) {
  1613. return value != value;
  1614. }(obj.length) ? callback(result, 0) : next(result, obj);
  1615. }
  1616. if ("Buffer" === obj.type && copy(obj.data)) {
  1617. return next(result, obj.data);
  1618. }
  1619. }
  1620. throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.");
  1621. }(a, obj);
  1622. }
  1623. function assertSize(length) {
  1624. if ("number" != typeof length) {
  1625. throw new TypeError('"size" argument must be a number');
  1626. }
  1627. if (0 > length) {
  1628. throw new RangeError('"size" argument must not be negative');
  1629. }
  1630. }
  1631. function allocUnsafe(that, size) {
  1632. if (assertSize(size), that = callback(that, 0 > size ? 0 : 0 | checked(size)), !Buffer.TYPED_ARRAY_SUPPORT) {
  1633. var i = 0;
  1634. for (; i < size; ++i) {
  1635. that[i] = 0;
  1636. }
  1637. }
  1638. return that;
  1639. }
  1640. function next(val, obj) {
  1641. var progress = 0 > obj.length ? 0 : 0 | checked(obj.length);
  1642. val = callback(val, progress);
  1643. var i = 0;
  1644. for (; i < progress; i = i + 1) {
  1645. val[i] = 255 & obj[i];
  1646. }
  1647. return val;
  1648. }
  1649. function checked(length) {
  1650. if (length >= kMaxLength()) {
  1651. throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x" + kMaxLength().toString(16) + " bytes");
  1652. }
  1653. return 0 | length;
  1654. }
  1655. function byteLength(string, encoding) {
  1656. if (Buffer.isBuffer(string)) {
  1657. return string.length;
  1658. }
  1659. if ("undefined" != typeof ArrayBuffer && "function" == typeof ArrayBuffer.isView && (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {
  1660. return string.byteLength;
  1661. }
  1662. if ("string" != typeof string) {
  1663. string = "" + string;
  1664. }
  1665. var length = string.length;
  1666. if (0 === length) {
  1667. return 0;
  1668. }
  1669. var n = false;
  1670. for (;;) {
  1671. switch(encoding) {
  1672. case "ascii":
  1673. case "latin1":
  1674. case "binary":
  1675. return length;
  1676. case "utf8":
  1677. case "utf-8":
  1678. case void 0:
  1679. return get(string).length;
  1680. case "ucs2":
  1681. case "ucs-2":
  1682. case "utf16le":
  1683. case "utf-16le":
  1684. return 2 * length;
  1685. case "hex":
  1686. return length >>> 1;
  1687. case "base64":
  1688. return init(string).length;
  1689. default:
  1690. if (n) {
  1691. return get(string).length;
  1692. }
  1693. encoding = ("" + encoding).toLowerCase();
  1694. n = true;
  1695. }
  1696. }
  1697. }
  1698. function swap(a, i, k) {
  1699. var v = a[i];
  1700. a[i] = a[k];
  1701. a[k] = v;
  1702. }
  1703. function bidirectionalIndexOf(d, e, r, value, isInteger) {
  1704. if (0 === d.length) {
  1705. return -1;
  1706. }
  1707. if ("string" == typeof r ? (value = r, r = 0) : 2147483647 < r ? r = 2147483647 : -2147483648 > r && (r = -2147483648), r = +r, isNaN(r) && (r = isInteger ? 0 : d.length - 1), 0 > r && (r = d.length + r), r >= d.length) {
  1708. if (isInteger) {
  1709. return -1;
  1710. }
  1711. r = d.length - 1;
  1712. } else {
  1713. if (0 > r) {
  1714. if (!isInteger) {
  1715. return -1;
  1716. }
  1717. r = 0;
  1718. }
  1719. }
  1720. if ("string" == typeof e && (e = Buffer.from(e, value)), Buffer.isBuffer(e)) {
  1721. return 0 === e.length ? -1 : toString(d, e, r, value, isInteger);
  1722. }
  1723. if ("number" == typeof e) {
  1724. return e = e & 255, Buffer.TYPED_ARRAY_SUPPORT && "function" == typeof Uint8Array.prototype.indexOf ? isInteger ? Uint8Array.prototype.indexOf.call(d, e, r) : Uint8Array.prototype.lastIndexOf.call(d, e, r) : toString(d, [e], r, value, isInteger);
  1725. }
  1726. throw new TypeError("val must be string, number or Buffer");
  1727. }
  1728. function toString(obj, el, y, value, p) {
  1729. function get(v, i) {
  1730. return 1 === indexSize ? v[i] : v.readUInt16BE(i * indexSize);
  1731. }
  1732. var a;
  1733. var indexSize = 1;
  1734. var b = obj.length;
  1735. var offset = el.length;
  1736. if (void 0 !== value && ("ucs2" === (value = (value + "").toLowerCase()) || "ucs-2" === value || "utf16le" === value || "utf-16le" === value)) {
  1737. if (2 > obj.length || 2 > el.length) {
  1738. return -1;
  1739. }
  1740. indexSize = 2;
  1741. b = b / 2;
  1742. offset = offset / 2;
  1743. y = y / 2;
  1744. }
  1745. if (p) {
  1746. var b = -1;
  1747. a = y;
  1748. for (; a < b; a++) {
  1749. if (get(obj, a) !== get(el, -1 === b ? 0 : a - b)) {
  1750. if (-1 !== b) {
  1751. a = a - (a - b);
  1752. }
  1753. b = -1;
  1754. } else {
  1755. if (-1 === b && (b = a), a - b + 1 === offset) {
  1756. return b * indexSize;
  1757. }
  1758. }
  1759. }
  1760. } else {
  1761. if (y + offset > b) {
  1762. y = b - offset;
  1763. }
  1764. a = y;
  1765. for (; 0 <= a; a--) {
  1766. var l = true;
  1767. var key = 0;
  1768. for (; key < offset; key++) {
  1769. if (get(obj, a + key) !== get(el, key)) {
  1770. l = false;
  1771. break;
  1772. }
  1773. }
  1774. if (l) {
  1775. return a;
  1776. }
  1777. }
  1778. }
  1779. return -1;
  1780. }
  1781. function push(arr, line, idx, val) {
  1782. idx = +idx || 0;
  1783. var len = arr.length - idx;
  1784. if (val) {
  1785. if ((val = +val) > len) {
  1786. val = len;
  1787. }
  1788. } else {
  1789. val = len;
  1790. }
  1791. var dy = line.length;
  1792. if (0 != dy % 2) {
  1793. throw new TypeError("Invalid hex string");
  1794. }
  1795. if (val > dy / 2) {
  1796. val = dy / 2;
  1797. }
  1798. var i;
  1799. var j = 0;
  1800. for (; j < val; ++j) {
  1801. if (i = parseInt(line.substr(2 * j, 2), 16), isNaN(i)) {
  1802. return j;
  1803. }
  1804. arr[idx + j] = i;
  1805. }
  1806. return j;
  1807. }
  1808. function read(str, value, count, type) {
  1809. return fn(get(value, str.length - count), str, count, type);
  1810. }
  1811. function add(type, tree, name, status) {
  1812. return fn(function(contents) {
  1813. var result = [];
  1814. var i = 0;
  1815. for (; i < contents.length; ++i) {
  1816. result.push(255 & contents.charCodeAt(i));
  1817. }
  1818. return result;
  1819. }(tree), type, name, status);
  1820. }
  1821. function update(text, left, start, end) {
  1822. return add(text, left, start, end);
  1823. }
  1824. function append(tx, id, name, type) {
  1825. return fn(init(id), tx, name, type);
  1826. }
  1827. function map(param, data, i, status) {
  1828. return fn(function(t, val) {
  1829. var i;
  1830. var index;
  1831. var slice;
  1832. var result = [];
  1833. var k = 0;
  1834. for (; k < t.length && !(0 > (val = val - 2)); ++k) {
  1835. i = t.charCodeAt(k);
  1836. index = i >> 8;
  1837. slice = i % 256;
  1838. result.push(slice);
  1839. result.push(index);
  1840. }
  1841. return result;
  1842. }(data, param.length - i), param, i, status);
  1843. }
  1844. function cb(buf, start, end) {
  1845. return 0 === start && end === buf.length ? base64.fromByteArray(buf) : base64.fromByteArray(buf.slice(start, end));
  1846. }
  1847. function format(buf, start, count) {
  1848. count = Math.min(buf.length, count);
  1849. var result = [];
  1850. var i = start;
  1851. for (; i < count;) {
  1852. var buf2;
  1853. var toLine;
  1854. var fromLine;
  1855. var x;
  1856. var intVal = buf[i];
  1857. var h = null;
  1858. var len = 239 < intVal ? 4 : 223 < intVal ? 3 : 191 < intVal ? 2 : 1;
  1859. if (i + len <= count) {
  1860. if (1 === len) {
  1861. if (128 > intVal) {
  1862. h = intVal;
  1863. }
  1864. } else {
  1865. if (2 === len) {
  1866. if (128 == (192 & (buf2 = buf[i + 1]))) {
  1867. if (127 < (x = (31 & intVal) << 6 | 63 & buf2)) {
  1868. h = x;
  1869. }
  1870. }
  1871. } else {
  1872. if (3 === len) {
  1873. buf2 = buf[i + 1];
  1874. toLine = buf[i + 2];
  1875. if (128 == (192 & buf2) && 128 == (192 & toLine)) {
  1876. if (2047 < (x = (15 & intVal) << 12 | (63 & buf2) << 6 | 63 & toLine) && (55296 > x || 57343 < x)) {
  1877. h = x;
  1878. }
  1879. }
  1880. } else {
  1881. if (4 === len) {
  1882. buf2 = buf[i + 1];
  1883. toLine = buf[i + 2];
  1884. fromLine = buf[i + 3];
  1885. if (128 == (192 & buf2) && 128 == (192 & toLine) && 128 == (192 & fromLine)) {
  1886. if (65535 < (x = (15 & intVal) << 18 | (63 & buf2) << 12 | (63 & toLine) << 6 | 63 & fromLine) && 1114112 > x) {
  1887. h = x;
  1888. }
  1889. }
  1890. }
  1891. }
  1892. }
  1893. }
  1894. }
  1895. if (null === h) {
  1896. h = 65533;
  1897. len = 1;
  1898. } else {
  1899. if (65535 < h) {
  1900. h = h - 65536;
  1901. result.push(55296 | 1023 & h >>> 10);
  1902. h = 56320 | 1023 & h;
  1903. }
  1904. }
  1905. result.push(h);
  1906. i = i + len;
  1907. }
  1908. return function(codePoints) {
  1909. var length = codePoints.length;
  1910. if (length <= limit) {
  1911. return String.fromCharCode.apply(String, codePoints);
  1912. }
  1913. var str = "";
  1914. var i = 0;
  1915. for (; i < length;) {
  1916. str = str + String.fromCharCode.apply(String, codePoints.slice(i, i = i + limit));
  1917. }
  1918. return str;
  1919. }(result);
  1920. }
  1921. function slice(set, type, end) {
  1922. var buffer = "";
  1923. end = Math.min(set.length, end);
  1924. var val = type;
  1925. for (; val < end; ++val) {
  1926. buffer = buffer + String.fromCharCode(127 & set[val]);
  1927. }
  1928. return buffer;
  1929. }
  1930. function ord(args, n, c) {
  1931. var code = "";
  1932. c = Math.min(args.length, c);
  1933. var i = n;
  1934. for (; i < c; ++i) {
  1935. code = code + String.fromCharCode(args[i]);
  1936. }
  1937. return code;
  1938. }
  1939. function sprintf(tokens, s, index) {
  1940. var length = tokens.length;
  1941. if (!s || 0 > s) {
  1942. s = 0;
  1943. }
  1944. if (!index || 0 > index || index > length) {
  1945. index = length;
  1946. }
  1947. var str = "";
  1948. var i = s;
  1949. for (; i < index; ++i) {
  1950. str = str + parseFloat(tokens[i]);
  1951. }
  1952. return str;
  1953. }
  1954. function p(p, c, n) {
  1955. var m = p.slice(c, n);
  1956. var s = "";
  1957. var i = 0;
  1958. for (; i < m.length; i = i + 2) {
  1959. s = s + String.fromCharCode(m[i] + 256 * m[i + 1]);
  1960. }
  1961. return s;
  1962. }
  1963. function checkOffset(offset, ext, length) {
  1964. if (0 != offset % 1 || 0 > offset) {
  1965. throw new RangeError("offset is not uint");
  1966. }
  1967. if (offset + ext > length) {
  1968. throw new RangeError("Trying to access beyond buffer length");
  1969. }
  1970. }
  1971. function checkInt(buf, value, offset, ext, max, min) {
  1972. if (!Buffer.isBuffer(buf)) {
  1973. throw new TypeError('"buffer" argument must be a Buffer instance');
  1974. }
  1975. if (value > max || value < min) {
  1976. throw new RangeError('"value" argument is out of bounds');
  1977. }
  1978. if (offset + ext > buf.length) {
  1979. throw new RangeError("Index out of range");
  1980. }
  1981. }
  1982. function objectWriteUInt16(buf, value, offset, littleEndian) {
  1983. if (0 > value) {
  1984. value = 65535 + value + 1;
  1985. }
  1986. var i = 0;
  1987. var cell_amount = Math.min(buf.length - offset, 2);
  1988. for (; i < cell_amount; ++i) {
  1989. buf[offset + i] = (value & 255 << 8 * (littleEndian ? i : 1 - i)) >>> 8 * (littleEndian ? i : 1 - i);
  1990. }
  1991. }
  1992. function objectWriteUInt32(buf, value, offset, littleEndian) {
  1993. if (0 > value) {
  1994. value = 4294967295 + value + 1;
  1995. }
  1996. var i = 0;
  1997. var cell_amount = Math.min(buf.length - offset, 4);
  1998. for (; i < cell_amount; ++i) {
  1999. buf[offset + i] = 255 & value >>> 8 * (littleEndian ? i : 3 - i);
  2000. }
  2001. }
  2002. function write(items, cb, start, count) {
  2003. if (start + count > items.length) {
  2004. throw new RangeError("Index out of range");
  2005. }
  2006. if (0 > start) {
  2007. throw new RangeError("Index out of range");
  2008. }
  2009. }
  2010. function writeFloat(buffer, value, offset, littleEndian, noAssert) {
  2011. return noAssert || write(buffer, 0, offset, 4), ieee754.write(buffer, value, offset, littleEndian, 23, 4), offset + 4;
  2012. }
  2013. function writeDouble(buffer, value, offset, littleEndian, noAssert) {
  2014. return noAssert || write(buffer, 0, offset, 8), ieee754.write(buffer, value, offset, littleEndian, 52, 8), offset + 8;
  2015. }
  2016. function parseFloat(text) {
  2017. return 16 > text ? "0" + text.toString(16) : text.toString(16);
  2018. }
  2019. function get(string, units) {
  2020. units = units || 1 / 0;
  2021. var data;
  2022. var length = string.length;
  2023. var blockReceived = null;
  2024. var bytes = [];
  2025. var i = 0;
  2026. for (; i < length; ++i) {
  2027. if (55295 < (data = string.charCodeAt(i)) && 57344 > data) {
  2028. if (!blockReceived) {
  2029. if (56319 < data) {
  2030. if (-1 < (units = units - 3)) {
  2031. bytes.push(239, 191, 189);
  2032. }
  2033. continue;
  2034. }
  2035. if (i + 1 === length) {
  2036. if (-1 < (units = units - 3)) {
  2037. bytes.push(239, 191, 189);
  2038. }
  2039. continue;
  2040. }
  2041. blockReceived = data;
  2042. continue;
  2043. }
  2044. if (56320 > data) {
  2045. if (-1 < (units = units - 3)) {
  2046. bytes.push(239, 191, 189);
  2047. }
  2048. blockReceived = data;
  2049. continue;
  2050. }
  2051. data = 65536 + (blockReceived - 55296 << 10 | data - 56320);
  2052. } else {
  2053. if (blockReceived && -1 < (units = units - 3)) {
  2054. bytes.push(239, 191, 189);
  2055. }
  2056. }
  2057. if (blockReceived = null, 128 > data) {
  2058. if (0 > (units = units - 1)) {
  2059. break;
  2060. }
  2061. bytes.push(data);
  2062. } else {
  2063. if (2048 > data) {
  2064. if (0 > (units = units - 2)) {
  2065. break;
  2066. }
  2067. bytes.push(192 | data >> 6, 128 | 63 & data);
  2068. } else {
  2069. if (65536 > data) {
  2070. if (0 > (units = units - 3)) {
  2071. break;
  2072. }
  2073. bytes.push(224 | data >> 12, 128 | 63 & data >> 6, 128 | 63 & data);
  2074. } else {
  2075. if (!(1114112 > data)) {
  2076. throw new Error("Invalid code point");
  2077. }
  2078. if (0 > (units = units - 4)) {
  2079. break;
  2080. }
  2081. bytes.push(240 | data >> 18, 128 | 63 & data >> 12, 128 | 63 & data >> 6, 128 | 63 & data);
  2082. }
  2083. }
  2084. }
  2085. }
  2086. return bytes;
  2087. }
  2088. function init(str) {
  2089. return base64.toByteArray(function(text) {
  2090. if (2 > (text = function(s) {
  2091. return s.trim ? s.trim() : s.replace(/^\s+|\s+$/g, "");
  2092. }(text).replace(footnotePattern, "")).length) {
  2093. return "";
  2094. }
  2095. for (; 0 != text.length % 4;) {
  2096. text = text + "=";
  2097. }
  2098. return text;
  2099. }(str));
  2100. }
  2101. function fn(self, data, index, value) {
  2102. var i = 0;
  2103. for (; i < value && !(i + index >= data.length || i >= self.length); ++i) {
  2104. data[i + index] = self[i];
  2105. }
  2106. return i;
  2107. }
  2108. var base64 = require(28);
  2109. var ieee754 = require(8);
  2110. var copy = require(29);
  2111. exports.Buffer = Buffer;
  2112. exports.SlowBuffer = function(length) {
  2113. return +length != length && (length = 0), Buffer.alloc(+length);
  2114. };
  2115. exports.INSPECT_MAX_BYTES = 50;
  2116. Buffer.TYPED_ARRAY_SUPPORT = void 0 === global.TYPED_ARRAY_SUPPORT ? function() {
  2117. try {
  2118. var arr = new Uint8Array(1);
  2119. return arr.__proto__ = {
  2120. __proto__ : Uint8Array.prototype,
  2121. foo : function() {
  2122. return 42;
  2123. }
  2124. }, 42 === arr.foo() && "function" == typeof arr.subarray && 0 === arr.subarray(1, 1).byteLength;
  2125. } catch (t) {
  2126. return false;
  2127. }
  2128. }() : global.TYPED_ARRAY_SUPPORT;
  2129. exports.kMaxLength = kMaxLength();
  2130. Buffer.poolSize = 8192;
  2131. Buffer._augment = function(arr) {
  2132. return arr.__proto__ = Buffer.prototype, arr;
  2133. };
  2134. Buffer.from = function(obj, config, val) {
  2135. return parse(null, obj, config, val);
  2136. };
  2137. if (Buffer.TYPED_ARRAY_SUPPORT) {
  2138. Buffer.prototype.__proto__ = Uint8Array.prototype;
  2139. Buffer.__proto__ = Uint8Array;
  2140. if ("undefined" != typeof Symbol && Symbol.species && Buffer[Symbol.species] === Buffer) {
  2141. Object.defineProperty(Buffer, Symbol.species, {
  2142. value : null,
  2143. configurable : true
  2144. });
  2145. }
  2146. }
  2147. Buffer.alloc = function(value, length, attr) {
  2148. return function(s, size, a, val) {
  2149. return assertSize(size), 0 >= size ? callback(s, size) : void 0 === a ? callback(s, size) : "string" == typeof val ? callback(s, size).fill(a, val) : callback(s, size).fill(a);
  2150. }(null, value, length, attr);
  2151. };
  2152. Buffer.allocUnsafe = function(size) {
  2153. return allocUnsafe(null, size);
  2154. };
  2155. Buffer.allocUnsafeSlow = function(size) {
  2156. return allocUnsafe(null, size);
  2157. };
  2158. Buffer.isBuffer = function(obj) {
  2159. return !(null == obj || !obj._isBuffer);
  2160. };
  2161. Buffer.compare = function(path, e) {
  2162. if (!Buffer.isBuffer(path) || !Buffer.isBuffer(e)) {
  2163. throw new TypeError("Arguments must be Buffers");
  2164. }
  2165. if (path === e) {
  2166. return 0;
  2167. }
  2168. var c = path.length;
  2169. var a = e.length;
  2170. var j = 0;
  2171. var num = Math.min(c, a);
  2172. for (; j < num; ++j) {
  2173. if (path[j] !== e[j]) {
  2174. c = path[j];
  2175. a = e[j];
  2176. break;
  2177. }
  2178. }
  2179. return c < a ? -1 : a < c ? 1 : 0;
  2180. };
  2181. Buffer.isEncoding = function(encoding) {
  2182. switch((encoding + "").toLowerCase()) {
  2183. case "hex":
  2184. case "utf8":
  2185. case "utf-8":
  2186. case "ascii":
  2187. case "latin1":
  2188. case "binary":
  2189. case "base64":
  2190. case "ucs2":
  2191. case "ucs-2":
  2192. case "utf16le":
  2193. case "utf-16le":
  2194. return true;
  2195. default:
  2196. return false;
  2197. }
  2198. };
  2199. Buffer.concat = function(a, size) {
  2200. if (!copy(a)) {
  2201. throw new TypeError('"list" argument must be an Array of Buffers');
  2202. }
  2203. if (0 === a.length) {
  2204. return Buffer.alloc(0);
  2205. }
  2206. var i;
  2207. if (void 0 === size) {
  2208. size = 0;
  2209. i = 0;
  2210. for (; i < a.length; ++i) {
  2211. size = size + a[i].length;
  2212. }
  2213. }
  2214. var buffer = Buffer.allocUnsafe(size);
  2215. var b = 0;
  2216. i = 0;
  2217. for (; i < a.length; ++i) {
  2218. var p = a[i];
  2219. if (!Buffer.isBuffer(p)) {
  2220. throw new TypeError('"list" argument must be an Array of Buffers');
  2221. }
  2222. p.copy(buffer, b);
  2223. b = b + p.length;
  2224. }
  2225. return buffer;
  2226. };
  2227. Buffer.byteLength = byteLength;
  2228. Buffer.prototype._isBuffer = true;
  2229. Buffer.prototype.swap16 = function() {
  2230. var i = this.length;
  2231. if (0 != i % 2) {
  2232. throw new RangeError("Buffer size must be a multiple of 16-bits");
  2233. }
  2234. var l = 0;
  2235. for (; l < i; l = l + 2) {
  2236. swap(this, l, l + 1);
  2237. }
  2238. return this;
  2239. };
  2240. Buffer.prototype.swap32 = function() {
  2241. var l = this.length;
  2242. if (0 != l % 4) {
  2243. throw new RangeError("Buffer size must be a multiple of 32-bits");
  2244. }
  2245. var i = 0;
  2246. for (; i < l; i = i + 4) {
  2247. swap(this, i, i + 3);
  2248. swap(this, i + 1, i + 2);
  2249. }
  2250. return this;
  2251. };
  2252. Buffer.prototype.swap64 = function() {
  2253. var l = this.length;
  2254. if (0 != l % 8) {
  2255. throw new RangeError("Buffer size must be a multiple of 64-bits");
  2256. }
  2257. var i = 0;
  2258. for (; i < l; i = i + 8) {
  2259. swap(this, i, i + 7);
  2260. swap(this, i + 1, i + 6);
  2261. swap(this, i + 2, i + 5);
  2262. swap(this, i + 3, i + 4);
  2263. }
  2264. return this;
  2265. };
  2266. Buffer.prototype.toString = function() {
  2267. var n = 0 | this.length;
  2268. return 0 == n ? "" : 0 === arguments.length ? format(this, 0, n) : function(encoding, n, i) {
  2269. var j = false;
  2270. if ((void 0 === n || 0 > n) && (n = 0), n > this.length) {
  2271. return "";
  2272. }
  2273. if ((void 0 === i || i > this.length) && (i = this.length), 0 >= i) {
  2274. return "";
  2275. }
  2276. if ((i = i >>> 0) <= (n = n >>> 0)) {
  2277. return "";
  2278. }
  2279. if (!encoding) {
  2280. encoding = "utf8";
  2281. }
  2282. for (;;) {
  2283. switch(encoding) {
  2284. case "hex":
  2285. return sprintf(this, n, i);
  2286. case "utf8":
  2287. case "utf-8":
  2288. return format(this, n, i);
  2289. case "ascii":
  2290. return slice(this, n, i);
  2291. case "latin1":
  2292. case "binary":
  2293. return ord(this, n, i);
  2294. case "base64":
  2295. return cb(this, n, i);
  2296. case "ucs2":
  2297. case "ucs-2":
  2298. case "utf16le":
  2299. case "utf-16le":
  2300. return p(this, n, i);
  2301. default:
  2302. if (j) {
  2303. throw new TypeError("Unknown encoding: " + encoding);
  2304. }
  2305. encoding = (encoding + "").toLowerCase();
  2306. j = true;
  2307. }
  2308. }
  2309. }.apply(this, arguments);
  2310. };
  2311. Buffer.prototype.equals = function(a) {
  2312. if (!Buffer.isBuffer(a)) {
  2313. throw new TypeError("Argument must be a Buffer");
  2314. }
  2315. return this === a || 0 === Buffer.compare(this, a);
  2316. };
  2317. Buffer.prototype.inspect = function() {
  2318. var pix_color = "";
  2319. var max = exports.INSPECT_MAX_BYTES;
  2320. return 0 < this.length && (pix_color = this.toString("hex", 0, max).match(/.{2}/g).join(" "), this.length > max && (pix_color = pix_color + " ... ")), "<Buffer " + pix_color + ">";
  2321. };
  2322. Buffer.prototype.compare = function(target, start, end, thisStart, thisEnd) {
  2323. if (!Buffer.isBuffer(target)) {
  2324. throw new TypeError("Argument must be a Buffer");
  2325. }
  2326. if (void 0 === start && (start = 0), void 0 === end && (end = target ? target.length : 0), void 0 === thisStart && (thisStart = 0), void 0 === thisEnd && (thisEnd = this.length), 0 > start || end > target.length || 0 > thisStart || thisEnd > this.length) {
  2327. throw new RangeError("out of range index");
  2328. }
  2329. if (thisStart >= thisEnd && start >= end) {
  2330. return 0;
  2331. }
  2332. if (thisStart >= thisEnd) {
  2333. return -1;
  2334. }
  2335. if (start >= end) {
  2336. return 1;
  2337. }
  2338. if (this === target) {
  2339. return 0;
  2340. }
  2341. var x = (thisEnd = thisEnd >>> 0) - (thisStart = thisStart >>> 0);
  2342. var y = (end = end >>> 0) - (start = start >>> 0);
  2343. var spaceClick = Math.min(x, y);
  2344. var thisCopy = this.slice(thisStart, thisEnd);
  2345. var targetCopy = target.slice(start, end);
  2346. var i = 0;
  2347. for (; i < spaceClick; ++i) {
  2348. if (thisCopy[i] !== targetCopy[i]) {
  2349. x = thisCopy[i];
  2350. y = targetCopy[i];
  2351. break;
  2352. }
  2353. }
  2354. return x < y ? -1 : y < x ? 1 : 0;
  2355. };
  2356. Buffer.prototype.includes = function(val, byteOffset, encoding) {
  2357. return -1 !== this.indexOf(val, byteOffset, encoding);
  2358. };
  2359. Buffer.prototype.indexOf = function(val, byteOffset, encoding) {
  2360. return bidirectionalIndexOf(this, val, byteOffset, encoding, true);
  2361. };
  2362. Buffer.prototype.lastIndexOf = function(val, byteOffset, encoding) {
  2363. return bidirectionalIndexOf(this, val, byteOffset, encoding, false);
  2364. };
  2365. Buffer.prototype.write = function(value, start, end, encoding) {
  2366. if (void 0 === start) {
  2367. encoding = "utf8";
  2368. end = this.length;
  2369. start = 0;
  2370. } else {
  2371. if (void 0 === end && "string" == typeof start) {
  2372. encoding = start;
  2373. end = this.length;
  2374. start = 0;
  2375. } else {
  2376. if (!isFinite(start)) {
  2377. throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");
  2378. }
  2379. start = start | 0;
  2380. if (isFinite(end)) {
  2381. end = end | 0;
  2382. if (void 0 === encoding) {
  2383. encoding = "utf8";
  2384. }
  2385. } else {
  2386. encoding = end;
  2387. end = void 0;
  2388. }
  2389. }
  2390. }
  2391. var len = this.length - start;
  2392. if ((void 0 === end || end > len) && (end = len), 0 < value.length && (0 > end || 0 > start) || start > this.length) {
  2393. throw new RangeError("Attempt to write outside buffer bounds");
  2394. }
  2395. if (!encoding) {
  2396. encoding = "utf8";
  2397. }
  2398. var i = false;
  2399. for (;;) {
  2400. switch(encoding) {
  2401. case "hex":
  2402. return push(this, value, start, end);
  2403. case "utf8":
  2404. case "utf-8":
  2405. return read(this, value, start, end);
  2406. case "ascii":
  2407. return add(this, value, start, end);
  2408. case "latin1":
  2409. case "binary":
  2410. return update(this, value, start, end);
  2411. case "base64":
  2412. return append(this, value, start, end);
  2413. case "ucs2":
  2414. case "ucs-2":
  2415. case "utf16le":
  2416. case "utf-16le":
  2417. return map(this, value, start, end);
  2418. default:
  2419. if (i) {
  2420. throw new TypeError("Unknown encoding: " + encoding);
  2421. }
  2422. encoding = ("" + encoding).toLowerCase();
  2423. i = true;
  2424. }
  2425. }
  2426. };
  2427. Buffer.prototype.toJSON = function() {
  2428. return {
  2429. type : "Buffer",
  2430. data : Array.prototype.slice.call(this._arr || this, 0)
  2431. };
  2432. };
  2433. var limit = 4096;
  2434. Buffer.prototype.slice = function(start, end) {
  2435. var newBuf;
  2436. var len = this.length;
  2437. if (0 > (start = ~~start) ? 0 > (start = start + len) && (start = 0) : start > len && (start = len), 0 > (end = void 0 === end ? len : ~~end) ? 0 > (end = end + len) && (end = 0) : end > len && (end = len), end < start && (end = start), Buffer.TYPED_ARRAY_SUPPORT) {
  2438. (newBuf = this.subarray(start, end)).__proto__ = Buffer.prototype;
  2439. } else {
  2440. var sliceLen = end - start;
  2441. newBuf = new Buffer(sliceLen, void 0);
  2442. var i = 0;
  2443. for (; i < sliceLen; ++i) {
  2444. newBuf[i] = this[i + start];
  2445. }
  2446. }
  2447. return newBuf;
  2448. };
  2449. Buffer.prototype.readUIntLE = function(offset, byteLength, noAssert) {
  2450. offset = offset | 0;
  2451. byteLength = byteLength | 0;
  2452. if (!noAssert) {
  2453. checkOffset(offset, byteLength, this.length);
  2454. }
  2455. var val = this[offset];
  2456. var mul = 1;
  2457. var i = 0;
  2458. for (; ++i < byteLength && (mul = mul * 256);) {
  2459. val = val + this[offset + i] * mul;
  2460. }
  2461. return val;
  2462. };
  2463. Buffer.prototype.readUIntBE = function(offset, byteLength, noAssert) {
  2464. offset = offset | 0;
  2465. byteLength = byteLength | 0;
  2466. if (!noAssert) {
  2467. checkOffset(offset, byteLength, this.length);
  2468. }
  2469. var val = this[offset + --byteLength];
  2470. var mul = 1;
  2471. for (; 0 < byteLength && (mul = mul * 256);) {
  2472. val = val + this[offset + --byteLength] * mul;
  2473. }
  2474. return val;
  2475. };
  2476. Buffer.prototype.readUInt8 = function(offset, limit) {
  2477. return limit || checkOffset(offset, 1, this.length), this[offset];
  2478. };
  2479. Buffer.prototype.readUInt16LE = function(offset, limit) {
  2480. return limit || checkOffset(offset, 2, this.length), this[offset] | this[offset + 1] << 8;
  2481. };
  2482. Buffer.prototype.readUInt16BE = function(offset, limit) {
  2483. return limit || checkOffset(offset, 2, this.length), this[offset] << 8 | this[offset + 1];
  2484. };
  2485. Buffer.prototype.readUInt32LE = function(offset, limit) {
  2486. return limit || checkOffset(offset, 4, this.length), (this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16) + 16777216 * this[offset + 3];
  2487. };
  2488. Buffer.prototype.readUInt32BE = function(offset, limit) {
  2489. return limit || checkOffset(offset, 4, this.length), 16777216 * this[offset] + (this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3]);
  2490. };
  2491. Buffer.prototype.readIntLE = function(offset, byteLength, noAssert) {
  2492. offset = offset | 0;
  2493. byteLength = byteLength | 0;
  2494. if (!noAssert) {
  2495. checkOffset(offset, byteLength, this.length);
  2496. }
  2497. var val = this[offset];
  2498. var mul = 1;
  2499. var i = 0;
  2500. for (; ++i < byteLength && (mul = mul * 256);) {
  2501. val = val + this[offset + i] * mul;
  2502. }
  2503. return val >= (mul = mul * 128) && (val = val - Math.pow(2, 8 * byteLength)), val;
  2504. };
  2505. Buffer.prototype.readIntBE = function(offset, byteLength, noAssert) {
  2506. offset = offset | 0;
  2507. byteLength = byteLength | 0;
  2508. if (!noAssert) {
  2509. checkOffset(offset, byteLength, this.length);
  2510. }
  2511. var i = byteLength;
  2512. var top = 1;
  2513. var value = this[offset + --i];
  2514. for (; 0 < i && (top = top * 256);) {
  2515. value = value + this[offset + --i] * top;
  2516. }
  2517. return value >= (top = top * 128) && (value = value - Math.pow(2, 8 * byteLength)), value;
  2518. };
  2519. Buffer.prototype.readInt8 = function(offset, limit) {
  2520. return limit || checkOffset(offset, 1, this.length), 128 & this[offset] ? -1 * (255 - this[offset] + 1) : this[offset];
  2521. };
  2522. Buffer.prototype.readInt16LE = function(offset, noAssert) {
  2523. if (!noAssert) {
  2524. checkOffset(offset, 2, this.length);
  2525. }
  2526. var r = this[offset] | this[offset + 1] << 8;
  2527. return 32768 & r ? 4294901760 | r : r;
  2528. };
  2529. Buffer.prototype.readInt16BE = function(offset, noAssert) {
  2530. if (!noAssert) {
  2531. checkOffset(offset, 2, this.length);
  2532. }
  2533. var r = this[offset + 1] | this[offset] << 8;
  2534. return 32768 & r ? 4294901760 | r : r;
  2535. };
  2536. Buffer.prototype.readInt32LE = function(offset, limit) {
  2537. return limit || checkOffset(offset, 4, this.length), this[offset] | this[offset + 1] << 8 | this[offset + 2] << 16 | this[offset + 3] << 24;
  2538. };
  2539. Buffer.prototype.readInt32BE = function(offset, limit) {
  2540. return limit || checkOffset(offset, 4, this.length), this[offset] << 24 | this[offset + 1] << 16 | this[offset + 2] << 8 | this[offset + 3];
  2541. };
  2542. Buffer.prototype.readFloatLE = function(offset, limit) {
  2543. return limit || checkOffset(offset, 4, this.length), ieee754.read(this, offset, true, 23, 4);
  2544. };
  2545. Buffer.prototype.readFloatBE = function(offset, limit) {
  2546. return limit || checkOffset(offset, 4, this.length), ieee754.read(this, offset, false, 23, 4);
  2547. };
  2548. Buffer.prototype.readDoubleLE = function(offset, limit) {
  2549. return limit || checkOffset(offset, 8, this.length), ieee754.read(this, offset, true, 52, 8);
  2550. };
  2551. Buffer.prototype.readDoubleBE = function(offset, limit) {
  2552. return limit || checkOffset(offset, 8, this.length), ieee754.read(this, offset, false, 52, 8);
  2553. };
  2554. Buffer.prototype.writeUIntLE = function(value, offset, byteLength, noAssert) {
  2555. if (!(value = +value, offset = offset | 0, byteLength = byteLength | 0, noAssert)) {
  2556. checkInt(this, value, offset, byteLength, Math.pow(2, 8 * byteLength) - 1, 0);
  2557. }
  2558. var mul = 1;
  2559. var i = 0;
  2560. this[offset] = 255 & value;
  2561. for (; ++i < byteLength && (mul = mul * 256);) {
  2562. this[offset + i] = 255 & value / mul;
  2563. }
  2564. return offset + byteLength;
  2565. };
  2566. Buffer.prototype.writeUIntBE = function(value, offset, byteLength, noAssert) {
  2567. if (!(value = +value, offset = offset | 0, byteLength = byteLength | 0, noAssert)) {
  2568. checkInt(this, value, offset, byteLength, Math.pow(2, 8 * byteLength) - 1, 0);
  2569. }
  2570. var i = byteLength - 1;
  2571. var mul = 1;
  2572. this[offset + i] = 255 & value;
  2573. for (; 0 <= --i && (mul = mul * 256);) {
  2574. this[offset + i] = 255 & value / mul;
  2575. }
  2576. return offset + byteLength;
  2577. };
  2578. Buffer.prototype.writeUInt8 = function(value, offset, noAssert) {
  2579. return value = +value, offset = offset | 0, noAssert || checkInt(this, value, offset, 1, 255, 0), Buffer.TYPED_ARRAY_SUPPORT || (value = Math.floor(value)), this[offset] = 255 & value, offset + 1;
  2580. };
  2581. Buffer.prototype.writeUInt16LE = function(value, offset, noAssert) {
  2582. return value = +value, offset = offset | 0, noAssert || checkInt(this, value, offset, 2, 65535, 0), Buffer.TYPED_ARRAY_SUPPORT ? (this[offset] = 255 & value, this[offset + 1] = value >>> 8) : objectWriteUInt16(this, value, offset, true), offset + 2;
  2583. };
  2584. Buffer.prototype.writeUInt16BE = function(value, offset, noAssert) {
  2585. return value = +value, offset = offset | 0, noAssert || checkInt(this, value, offset, 2, 65535, 0), Buffer.TYPED_ARRAY_SUPPORT ? (this[offset] = value >>> 8, this[offset + 1] = 255 & value) : objectWriteUInt16(this, value, offset, false), offset + 2;
  2586. };
  2587. Buffer.prototype.writeUInt32LE = function(value, offset, noAssert) {
  2588. return value = +value, offset = offset | 0, noAssert || checkInt(this, value, offset, 4, 4294967295, 0), Buffer.TYPED_ARRAY_SUPPORT ? (this[offset + 3] = value >>> 24, this[offset + 2] = value >>> 16, this[offset + 1] = value >>> 8, this[offset] = 255 & value) : objectWriteUInt32(this, value, offset, true), offset + 4;
  2589. };
  2590. Buffer.prototype.writeUInt32BE = function(value, offset, noAssert) {
  2591. return value = +value, offset = offset | 0, noAssert || checkInt(this, value, offset, 4, 4294967295, 0), Buffer.TYPED_ARRAY_SUPPORT ? (this[offset] = value >>> 24, this[offset + 1] = value >>> 16, this[offset + 2] = value >>> 8, this[offset + 3] = 255 & value) : objectWriteUInt32(this, value, offset, false), offset + 4;
  2592. };
  2593. Buffer.prototype.writeIntLE = function(value, offset, byteLength, noAssert) {
  2594. if (value = +value, offset = offset | 0, !noAssert) {
  2595. var limit = Math.pow(2, 8 * byteLength - 1);
  2596. checkInt(this, value, offset, byteLength, limit - 1, -limit);
  2597. }
  2598. var i = 0;
  2599. var mul = 1;
  2600. var s = 0;
  2601. this[offset] = 255 & value;
  2602. for (; ++i < byteLength && (mul = mul * 256);) {
  2603. if (0 > value && 0 === s && 0 !== this[offset + i - 1]) {
  2604. s = 1;
  2605. }
  2606. this[offset + i] = 255 & (value / mul >> 0) - s;
  2607. }
  2608. return offset + byteLength;
  2609. };
  2610. Buffer.prototype.writeIntBE = function(value, offset, byteLength, noAssert) {
  2611. if (value = +value, offset = offset | 0, !noAssert) {
  2612. var limit = Math.pow(2, 8 * byteLength - 1);
  2613. checkInt(this, value, offset, byteLength, limit - 1, -limit);
  2614. }
  2615. var i = byteLength - 1;
  2616. var mul = 1;
  2617. var s = 0;
  2618. this[offset + i] = 255 & value;
  2619. for (; 0 <= --i && (mul = mul * 256);) {
  2620. if (0 > value && 0 === s && 0 !== this[offset + i + 1]) {
  2621. s = 1;
  2622. }
  2623. this[offset + i] = 255 & (value / mul >> 0) - s;
  2624. }
  2625. return offset + byteLength;
  2626. };
  2627. Buffer.prototype.writeInt8 = function(value, offset, noAssert) {
  2628. return value = +value, offset = offset | 0, noAssert || checkInt(this, value, offset, 1, 127, -128), Buffer.TYPED_ARRAY_SUPPORT || (value = Math.floor(value)), 0 > value && (value = 255 + value + 1), this[offset] = 255 & value, offset + 1;
  2629. };
  2630. Buffer.prototype.writeInt16LE = function(value, offset, noAssert) {
  2631. return value = +value, offset = offset | 0, noAssert || checkInt(this, value, offset, 2, 32767, -32768), Buffer.TYPED_ARRAY_SUPPORT ? (this[offset] = 255 & value, this[offset + 1] = value >>> 8) : objectWriteUInt16(this, value, offset, true), offset + 2;
  2632. };
  2633. Buffer.prototype.writeInt16BE = function(value, offset, noAssert) {
  2634. return value = +value, offset = offset | 0, noAssert || checkInt(this, value, offset, 2, 32767, -32768), Buffer.TYPED_ARRAY_SUPPORT ? (this[offset] = value >>> 8, this[offset + 1] = 255 & value) : objectWriteUInt16(this, value, offset, false), offset + 2;
  2635. };
  2636. Buffer.prototype.writeInt32LE = function(value, offset, noAssert) {
  2637. return value = +value, offset = offset | 0, noAssert || checkInt(this, value, offset, 4, 2147483647, -2147483648), Buffer.TYPED_ARRAY_SUPPORT ? (this[offset] = 255 & value, this[offset + 1] = value >>> 8, this[offset + 2] = value >>> 16, this[offset + 3] = value >>> 24) : objectWriteUInt32(this, value, offset, true), offset + 4;
  2638. };
  2639. Buffer.prototype.writeInt32BE = function(value, offset, noAssert) {
  2640. return value = +value, offset = offset | 0, noAssert || checkInt(this, value, offset, 4, 2147483647, -2147483648), 0 > value && (value = 4294967295 + value + 1), Buffer.TYPED_ARRAY_SUPPORT ? (this[offset] = value >>> 24, this[offset + 1] = value >>> 16, this[offset + 2] = value >>> 8, this[offset + 3] = 255 & value) : objectWriteUInt32(this, value, offset, false), offset + 4;
  2641. };
  2642. Buffer.prototype.writeFloatLE = function(value, offset, noAssert) {
  2643. return writeFloat(this, value, offset, true, noAssert);
  2644. };
  2645. Buffer.prototype.writeFloatBE = function(value, offset, noAssert) {
  2646. return writeFloat(this, value, offset, false, noAssert);
  2647. };
  2648. Buffer.prototype.writeDoubleLE = function(value, offset, noAssert) {
  2649. return writeDouble(this, value, offset, true, noAssert);
  2650. };
  2651. Buffer.prototype.writeDoubleBE = function(value, offset, noAssert) {
  2652. return writeDouble(this, value, offset, false, noAssert);
  2653. };
  2654. Buffer.prototype.copy = function(target, targetStart, start, end) {
  2655. if (start || (start = 0), end || 0 === end || (end = this.length), targetStart >= target.length && (targetStart = target.length), targetStart || (targetStart = 0), 0 < end && end < start && (end = start), end === start) {
  2656. return 0;
  2657. }
  2658. if (0 === target.length || 0 === this.length) {
  2659. return 0;
  2660. }
  2661. if (0 > targetStart) {
  2662. throw new RangeError("targetStart out of bounds");
  2663. }
  2664. if (0 > start || start >= this.length) {
  2665. throw new RangeError("sourceStart out of bounds");
  2666. }
  2667. if (0 > end) {
  2668. throw new RangeError("sourceEnd out of bounds");
  2669. }
  2670. if (end > this.length) {
  2671. end = this.length;
  2672. }
  2673. if (target.length - targetStart < end - start) {
  2674. end = target.length - targetStart + start;
  2675. }
  2676. var i;
  2677. var len = end - start;
  2678. if (this === target && start < targetStart && targetStart < end) {
  2679. i = len - 1;
  2680. for (; 0 <= i; --i) {
  2681. target[i + targetStart] = this[i + start];
  2682. }
  2683. } else {
  2684. if (1e3 > len || !Buffer.TYPED_ARRAY_SUPPORT) {
  2685. i = 0;
  2686. for (; i < len; ++i) {
  2687. target[i + targetStart] = this[i + start];
  2688. }
  2689. } else {
  2690. Uint8Array.prototype.set.call(target, this.subarray(start, start + len), targetStart);
  2691. }
  2692. }
  2693. return len;
  2694. };
  2695. Buffer.prototype.fill = function(value, start, end, encoding) {
  2696. if ("string" == typeof value) {
  2697. if ("string" == typeof start ? (encoding = start, start = 0, end = this.length) : "string" == typeof end && (encoding = end, end = this.length), 1 === value.length) {
  2698. var test_value = value.charCodeAt(0);
  2699. if (256 > test_value) {
  2700. value = test_value;
  2701. }
  2702. }
  2703. if (void 0 !== encoding && "string" != typeof encoding) {
  2704. throw new TypeError("encoding must be a string");
  2705. }
  2706. if ("string" == typeof encoding && !Buffer.isEncoding(encoding)) {
  2707. throw new TypeError("Unknown encoding: " + encoding);
  2708. }
  2709. } else {
  2710. if ("number" == typeof value) {
  2711. value = value & 255;
  2712. }
  2713. }
  2714. if (0 > start || this.length < start || this.length < end) {
  2715. throw new RangeError("Out of range index");
  2716. }
  2717. if (end <= start) {
  2718. return this;
  2719. }
  2720. var i;
  2721. if (start = start >>> 0, end = void 0 === end ? this.length : end >>> 0, value || (value = 0), "number" == typeof value) {
  2722. i = start;
  2723. for (; i < end; ++i) {
  2724. this[i] = value;
  2725. }
  2726. } else {
  2727. var colorPool = Buffer.isBuffer(value) ? value : get((new Buffer(value, encoding)).toString());
  2728. var colorPoolSize = colorPool.length;
  2729. i = 0;
  2730. for (; i < end - start; ++i) {
  2731. this[i + start] = colorPool[i % colorPoolSize];
  2732. }
  2733. }
  2734. return this;
  2735. };
  2736. var footnotePattern = /[^+\/0-9A-Za-z-_]/g;
  2737. }).call(this, require(24));
  2738. }, function(canCreateDiscussions, $ctx16) {
  2739. function write0(type) {
  2740. return function(options) {
  2741. var name = options.reserve(1);
  2742. options.buffer[name] = type;
  2743. };
  2744. }
  2745. var constant = $ctx16.uint8 = Array(256);
  2746. var i = 0;
  2747. for (; 255 >= i; i++) {
  2748. constant[i] = write0(i);
  2749. }
  2750. }, function(canCreateDiscussions, exports, require) {
  2751. function FlexDecoder() {
  2752. if (!(this instanceof FlexDecoder)) {
  2753. return new FlexDecoder;
  2754. }
  2755. }
  2756. function FlexEncoder() {
  2757. if (!(this instanceof FlexEncoder)) {
  2758. return new FlexEncoder;
  2759. }
  2760. }
  2761. function writeSerial() {
  2762. throw new Error("method not implemented: write()");
  2763. }
  2764. function _fetch() {
  2765. throw new Error("method not implemented: fetch()");
  2766. }
  2767. function read() {
  2768. return this.buffers && this.buffers.length ? (this.flush(), this.pull()) : this.fetch();
  2769. }
  2770. function push(num) {
  2771. (this.buffers || (this.buffers = [])).push(num);
  2772. }
  2773. function pull() {
  2774. return (this.buffers || (this.buffers = [])).shift();
  2775. }
  2776. function mixinFactory(obj) {
  2777. return function(klass) {
  2778. var prop;
  2779. for (prop in obj) {
  2780. klass[prop] = obj[prop];
  2781. }
  2782. return klass;
  2783. };
  2784. }
  2785. exports.FlexDecoder = FlexDecoder;
  2786. exports.FlexEncoder = FlexEncoder;
  2787. var Bufferish = require(0);
  2788. var MIN_BUFFER_SIZE = 2048;
  2789. var MAX_BUFFER_SIZE = 65536;
  2790. var BUFFER_SHORTAGE = "BUFFER_SHORTAGE";
  2791. FlexDecoder.mixin = mixinFactory({
  2792. bufferish : Bufferish,
  2793. write : function(chunk) {
  2794. var prev = this.offset ? Bufferish.prototype.slice.call(this.buffer, this.offset) : this.buffer;
  2795. this.buffer = prev ? chunk ? this.bufferish.concat([prev, chunk]) : prev : chunk;
  2796. this.offset = 0;
  2797. },
  2798. fetch : _fetch,
  2799. flush : function() {
  2800. for (; this.offset < this.buffer.length;) {
  2801. var value;
  2802. var offset = this.offset;
  2803. try {
  2804. value = this.fetch();
  2805. } catch (e) {
  2806. if (e && e.message != BUFFER_SHORTAGE) {
  2807. throw e;
  2808. }
  2809. this.offset = offset;
  2810. break;
  2811. }
  2812. this.push(value);
  2813. }
  2814. },
  2815. push : push,
  2816. pull : pull,
  2817. read : read,
  2818. reserve : function(length) {
  2819. var offset = this.offset;
  2820. var end = offset + length;
  2821. if (end > this.buffer.length) {
  2822. throw new Error(BUFFER_SHORTAGE);
  2823. }
  2824. return this.offset = end, offset;
  2825. },
  2826. offset : 0
  2827. });
  2828. FlexDecoder.mixin(FlexDecoder.prototype);
  2829. FlexEncoder.mixin = mixinFactory({
  2830. bufferish : Bufferish,
  2831. write : writeSerial,
  2832. fetch : function() {
  2833. var start = this.start;
  2834. if (start < this.offset) {
  2835. var end = this.start = this.offset;
  2836. return Bufferish.prototype.slice.call(this.buffer, start, end);
  2837. }
  2838. },
  2839. flush : function() {
  2840. for (; this.start < this.offset;) {
  2841. var value = this.fetch();
  2842. if (value) {
  2843. this.push(value);
  2844. }
  2845. }
  2846. },
  2847. push : push,
  2848. pull : function() {
  2849. var length = this.buffers || (this.buffers = []);
  2850. var e = 1 < length.length ? this.bufferish.concat(length) : length[0];
  2851. return length.length = 0, e;
  2852. },
  2853. read : read,
  2854. reserve : function(length) {
  2855. var offset = 0 | length;
  2856. if (this.buffer) {
  2857. var n = this.buffer.length;
  2858. var pageIndex = 0 | this.offset;
  2859. var index = pageIndex + offset;
  2860. if (index < n) {
  2861. return this.offset = index, pageIndex;
  2862. }
  2863. this.flush();
  2864. length = Math.max(length, Math.min(2 * n, this.maxBufferSize));
  2865. }
  2866. return length = Math.max(length, this.minBufferSize), this.buffer = this.bufferish.alloc(length), this.start = 0, this.offset = offset, 0;
  2867. },
  2868. send : function(obj) {
  2869. var length = obj.length;
  2870. if (length > this.minBufferSize) {
  2871. this.flush();
  2872. this.push(obj);
  2873. } else {
  2874. var offset = this.reserve(length);
  2875. Bufferish.prototype.copy.call(obj, this.buffer, offset);
  2876. }
  2877. },
  2878. maxBufferSize : MAX_BUFFER_SIZE,
  2879. minBufferSize : MIN_BUFFER_SIZE,
  2880. offset : 0,
  2881. start : 0
  2882. });
  2883. FlexEncoder.mixin(FlexEncoder.prototype);
  2884. }, function(canCreateDiscussions, yeast, require) {
  2885. yeast.decode = function(input, options) {
  2886. var decoder = new DecodeBuffer(options);
  2887. return decoder.write(input), decoder.read();
  2888. };
  2889. var DecodeBuffer = require(20).DecodeBuffer;
  2890. }, function(canCreateDiscussions, exports, require) {
  2891. function DecodeBuffer(options) {
  2892. if (!(this instanceof DecodeBuffer)) {
  2893. return new DecodeBuffer(options);
  2894. }
  2895. if (options && (this.options = options, options.codec)) {
  2896. var codec = this.codec = options.codec;
  2897. if (codec.bufferish) {
  2898. this.bufferish = codec.bufferish;
  2899. }
  2900. }
  2901. }
  2902. exports.DecodeBuffer = DecodeBuffer;
  2903. var preset = require(12).preset;
  2904. require(18).FlexDecoder.mixin(DecodeBuffer.prototype);
  2905. DecodeBuffer.prototype.codec = preset;
  2906. DecodeBuffer.prototype.fetch = function() {
  2907. return this.codec.decode(this);
  2908. };
  2909. }, function(canCreateDiscussions, exports, require) {
  2910. function array(decoder, node) {
  2911. var i;
  2912. var result = {};
  2913. var v = Array(node);
  2914. var value = Array(node);
  2915. var decode = decoder.codec.decode;
  2916. i = 0;
  2917. for (; i < node; i++) {
  2918. v[i] = decode(decoder);
  2919. value[i] = decode(decoder);
  2920. }
  2921. i = 0;
  2922. for (; i < node; i++) {
  2923. result[v[i]] = value[i];
  2924. }
  2925. return result;
  2926. }
  2927. function map_to_map(decoder, value) {
  2928. var i;
  2929. var result = new Map;
  2930. var v = Array(value);
  2931. var params = Array(value);
  2932. var decode = decoder.codec.decode;
  2933. i = 0;
  2934. for (; i < value; i++) {
  2935. v[i] = decode(decoder);
  2936. params[i] = decode(decoder);
  2937. }
  2938. i = 0;
  2939. for (; i < value; i++) {
  2940. result.set(v[i], params[i]);
  2941. }
  2942. return result;
  2943. }
  2944. function parse(c, length) {
  2945. var result = Array(length);
  2946. var fn = c.codec.decode;
  2947. var i = 0;
  2948. for (; i < length; i++) {
  2949. result[i] = fn(c);
  2950. }
  2951. return result;
  2952. }
  2953. function str(decoder, len) {
  2954. var index = decoder.reserve(len);
  2955. return BufferProto.toString.call(decoder.buffer, "utf-8", index, index + len);
  2956. }
  2957. function bin_buffer(decoder, len) {
  2958. var start = decoder.reserve(len);
  2959. var value = BufferProto.slice.call(decoder.buffer, start, start + len);
  2960. return Bufferish.from(value);
  2961. }
  2962. function bin_arraybuffer(decoder, len) {
  2963. var start = decoder.reserve(len);
  2964. var i = BufferProto.slice.call(decoder.buffer, start, start + len);
  2965. return Bufferish.Uint8Array.from(i).buffer;
  2966. }
  2967. function ext(decoder, len) {
  2968. var start = decoder.reserve(len + 1);
  2969. var type = decoder.buffer[start++];
  2970. var end = start + len;
  2971. var decodeUtf8 = decoder.codec.getExtUnpacker(type);
  2972. if (!decodeUtf8) {
  2973. throw new Error("Invalid ext type: " + (type ? "0x" + type.toString(16) : type));
  2974. }
  2975. return decodeUtf8(BufferProto.slice.call(decoder.buffer, start, end));
  2976. }
  2977. function uint8(options) {
  2978. var command = options.reserve(1);
  2979. return options.buffer[command];
  2980. }
  2981. function int8(options) {
  2982. var id = options.reserve(1);
  2983. var itemm = options.buffer[id];
  2984. return 128 & itemm ? itemm - 256 : itemm;
  2985. }
  2986. function uint16(tag) {
  2987. var openFileIdIndex = tag.reserve(2);
  2988. var openFilesIds = tag.buffer;
  2989. return openFilesIds[openFileIdIndex++] << 8 | openFilesIds[openFileIdIndex];
  2990. }
  2991. function int16(tag) {
  2992. var openFileIdIndex = tag.reserve(2);
  2993. var openFilesIds = tag.buffer;
  2994. var n = openFilesIds[openFileIdIndex++] << 8 | openFilesIds[openFileIdIndex];
  2995. return 32768 & n ? n - 65536 : n;
  2996. }
  2997. function uint32(tag) {
  2998. var openFileIdIndex = tag.reserve(4);
  2999. var openFilesIds = tag.buffer;
  3000. return 16777216 * openFilesIds[openFileIdIndex++] + (openFilesIds[openFileIdIndex++] << 16) + (openFilesIds[openFileIdIndex++] << 8) + openFilesIds[openFileIdIndex];
  3001. }
  3002. function int32(tag) {
  3003. var openFileIdIndex = tag.reserve(4);
  3004. var openFilesIds = tag.buffer;
  3005. return openFilesIds[openFileIdIndex++] << 24 | openFilesIds[openFileIdIndex++] << 16 | openFilesIds[openFileIdIndex++] << 8 | openFilesIds[openFileIdIndex];
  3006. }
  3007. function read(len, method) {
  3008. return function(decoder) {
  3009. var start = decoder.reserve(len);
  3010. return method.call(decoder.buffer, start, lastRow);
  3011. };
  3012. }
  3013. function readUInt64BE(start) {
  3014. return (new Uint64BE(this, start)).toNumber();
  3015. }
  3016. function readInt64BE(start) {
  3017. return (new Int64BE(this, start)).toNumber();
  3018. }
  3019. function readUInt64BE_int64(start) {
  3020. return new Uint64BE(this, start);
  3021. }
  3022. function readInt64BE_int64(start) {
  3023. return new Int64BE(this, start);
  3024. }
  3025. function readFloatBE(offset) {
  3026. return textUtils.read(this, offset, false, 23, 4);
  3027. }
  3028. function readDoubleBE(offset) {
  3029. return textUtils.read(this, offset, false, 52, 8);
  3030. }
  3031. var textUtils = require(8);
  3032. var Int64Buffer = require(11);
  3033. var Uint64BE = Int64Buffer.Uint64BE;
  3034. var Int64BE = Int64Buffer.Int64BE;
  3035. exports.getReadFormat = function(options) {
  3036. var binarraybuffer = Bufferish.hasArrayBuffer && options && options.binarraybuffer;
  3037. var int64 = options && options.int64;
  3038. return {
  3039. map : HAS_MAP && options && options.usemap ? map_to_map : array,
  3040. array : parse,
  3041. str : str,
  3042. bin : binarraybuffer ? bin_arraybuffer : bin_buffer,
  3043. ext : ext,
  3044. uint8 : uint8,
  3045. uint16 : uint16,
  3046. uint32 : uint32,
  3047. uint64 : read(8, int64 ? readUInt64BE_int64 : readUInt64BE),
  3048. int8 : int8,
  3049. int16 : int16,
  3050. int32 : int32,
  3051. int64 : read(8, int64 ? readInt64BE_int64 : readInt64BE),
  3052. float32 : read(4, readFloatBE),
  3053. float64 : read(8, readDoubleBE)
  3054. };
  3055. };
  3056. exports.readUint8 = uint8;
  3057. var Bufferish = require(0);
  3058. var BufferProto = require(10);
  3059. var HAS_MAP = "undefined" != typeof Map;
  3060. var lastRow = true;
  3061. }, function(module, canCreateDiscussions, isSlidingUp) {
  3062. !function(a) {
  3063. function r(s) {
  3064. var i;
  3065. for (i in methods) {
  3066. s[i] = methods[i];
  3067. }
  3068. return s;
  3069. }
  3070. function off(type, func) {
  3071. var data;
  3072. var self = this;
  3073. if (arguments.length) {
  3074. if (func) {
  3075. if (data = get(self, type, true)) {
  3076. if (!(data = data.filter(function(test) {
  3077. return test !== func && test.originalListener !== func;
  3078. })).length) {
  3079. return off.call(self, type);
  3080. }
  3081. self.listeners[type] = data;
  3082. }
  3083. } else {
  3084. if ((data = self.listeners) && (delete data[type], !Object.keys(data).length)) {
  3085. return off.call(self);
  3086. }
  3087. }
  3088. } else {
  3089. delete self.listeners;
  3090. }
  3091. return self;
  3092. }
  3093. function get(data, event, element) {
  3094. if (!element || data.listeners) {
  3095. var animationConfigs = data.listeners || (data.listeners = {});
  3096. return animationConfigs[event] || (animationConfigs[event] = []);
  3097. }
  3098. }
  3099. module.exports = a;
  3100. var methods = {
  3101. on : function(type, name) {
  3102. return get(this, type).push(name), this;
  3103. },
  3104. once : function(type, func) {
  3105. function wrap() {
  3106. off.call(context, type, wrap);
  3107. func.apply(this, arguments);
  3108. }
  3109. var context = this;
  3110. return wrap.originalListener = func, get(context, type).push(wrap), context;
  3111. },
  3112. off : off,
  3113. emit : function(e, name) {
  3114. var data = this;
  3115. var state = get(data, e, true);
  3116. if (!state) {
  3117. return false;
  3118. }
  3119. var _len8 = arguments.length;
  3120. if (1 === _len8) {
  3121. state.forEach(function(t) {
  3122. t.call(data);
  3123. });
  3124. } else {
  3125. if (2 === _len8) {
  3126. state.forEach(function(t) {
  3127. t.call(data, name);
  3128. });
  3129. } else {
  3130. var cmd_args = Array.prototype.slice.call(arguments, 1);
  3131. state.forEach(function(t) {
  3132. t.apply(data, cmd_args);
  3133. });
  3134. }
  3135. }
  3136. return !!state.length;
  3137. }
  3138. };
  3139. r(a.prototype);
  3140. a.mixin = r;
  3141. }(function Range() {
  3142. if (!(this instanceof Range)) {
  3143. return new Range;
  3144. }
  3145. });
  3146. }, , function(module, canCreateDiscussions) {
  3147. var g = function() {
  3148. return this;
  3149. }();
  3150. try {
  3151. g = g || (new Function("return this"))();
  3152. } catch (t) {
  3153. if ("object" == typeof window) {
  3154. g = window;
  3155. }
  3156. }
  3157. module.exports = g;
  3158. }, , function(canCreateDiscussions, exports, require) {
  3159. exports.encode = require(14).encode;
  3160. exports.decode = require(19).decode;
  3161. exports.Encoder = require(39).Encoder;
  3162. exports.Decoder = require(40).Decoder;
  3163. exports.createCodec = require(41).createCodec;
  3164. exports.codec = require(42).codec;
  3165. }, function(module, canCreateDiscussions, require) {
  3166. (function(Buffer) {
  3167. function c(B) {
  3168. return B && B.isBuffer && B;
  3169. }
  3170. module.exports = c(void 0 !== Buffer && Buffer) || c(this.Buffer) || c("undefined" != typeof window && window.Buffer) || this.Buffer;
  3171. }).call(this, require(16).Buffer);
  3172. }, function(canCreateDiscussions, exports, isSlidingUp) {
  3173. function placeHoldersCount(b64) {
  3174. var len = b64.length;
  3175. if (0 < len % 4) {
  3176. throw new Error("Invalid string. Length must be a multiple of 4");
  3177. }
  3178. var j = b64.indexOf("=");
  3179. return -1 === j && (j = len), [j, j === len ? 0 : 4 - j % 4];
  3180. }
  3181. function tripletToBase64(num) {
  3182. return c[63 & num >> 18] + c[63 & num >> 12] + c[63 & num >> 6] + c[63 & num];
  3183. }
  3184. function encodeChunk(uint8, start, end) {
  3185. var temp;
  3186. var output = [];
  3187. var i = start;
  3188. for (; i < end; i = i + 3) {
  3189. temp = (16711680 & uint8[i] << 16) + (65280 & uint8[i + 1] << 8) + (255 & uint8[i + 2]);
  3190. output.push(tripletToBase64(temp));
  3191. }
  3192. return output.join("");
  3193. }
  3194. exports.byteLength = function(string) {
  3195. var parts = placeHoldersCount(string);
  3196. var url = parts[0];
  3197. var app = parts[1];
  3198. return 3 * (url + app) / 4 - app;
  3199. };
  3200. exports.toByteArray = function(b64) {
  3201. var MASK;
  3202. var _range$toJSON2 = placeHoldersCount(b64);
  3203. var begin = _range$toJSON2[0];
  3204. var end = _range$toJSON2[1];
  3205. var result = new ByteArray(function(addedRenderer, isBegin, end2) {
  3206. return 3 * (isBegin + end2) / 4 - end2;
  3207. }(0, begin, end));
  3208. var j = 0;
  3209. var b = 0 < end ? begin - 4 : begin;
  3210. var i = 0;
  3211. for (; i < b; i = i + 4) {
  3212. MASK = revLookup[b64.charCodeAt(i)] << 18 | revLookup[b64.charCodeAt(i + 1)] << 12 | revLookup[b64.charCodeAt(i + 2)] << 6 | revLookup[b64.charCodeAt(i + 3)];
  3213. result[j++] = 255 & MASK >> 16;
  3214. result[j++] = 255 & MASK >> 8;
  3215. result[j++] = 255 & MASK;
  3216. }
  3217. return 2 === end && (MASK = revLookup[b64.charCodeAt(i)] << 2 | revLookup[b64.charCodeAt(i + 1)] >> 4, result[j++] = 255 & MASK), 1 === end && (MASK = revLookup[b64.charCodeAt(i)] << 10 | revLookup[b64.charCodeAt(i + 1)] << 4 | revLookup[b64.charCodeAt(i + 2)] >> 2, result[j++] = 255 & MASK >> 8, result[j++] = 255 & MASK), result;
  3218. };
  3219. exports.fromByteArray = function(uint8) {
  3220. var f;
  3221. var len = uint8.length;
  3222. var extraBytes = len % 3;
  3223. var parts = [];
  3224. var maxChunkLength = 16383;
  3225. var i = 0;
  3226. var len2 = len - extraBytes;
  3227. for (; i < len2; i = i + maxChunkLength) {
  3228. parts.push(encodeChunk(uint8, i, i + maxChunkLength > len2 ? len2 : i + maxChunkLength));
  3229. }
  3230. return 1 === extraBytes ? (f = uint8[len - 1], parts.push(c[f >> 2] + c[63 & f << 4] + "==")) : 2 === extraBytes && (f = (uint8[len - 2] << 8) + uint8[len - 1], parts.push(c[f >> 10] + c[63 & f >> 4] + c[63 & f << 2] + "=")), parts.join("");
  3231. };
  3232. var c = [];
  3233. var revLookup = [];
  3234. var ByteArray = "undefined" == typeof Uint8Array ? Array : Uint8Array;
  3235. var obj = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
  3236. var i = 0;
  3237. var patchLen = obj.length;
  3238. for (; i < patchLen; ++i) {
  3239. c[i] = obj[i];
  3240. revLookup[obj.charCodeAt(i)] = i;
  3241. }
  3242. revLookup[45] = 62;
  3243. revLookup[95] = 63;
  3244. }, function(mixin, canCreateDiscussions) {
  3245. var check = {}.toString;
  3246. mixin.exports = Array.isArray || function(t) {
  3247. return "[object Array]" == check.call(t);
  3248. };
  3249. }, function(config, exports, require) {
  3250. function _toArray(obj) {
  3251. return Array(obj);
  3252. }
  3253. var Bufferish = require(0);
  3254. (exports = config.exports = _toArray(0)).alloc = _toArray;
  3255. exports.concat = Bufferish.concat;
  3256. exports.from = function(value) {
  3257. if (!Bufferish.isBuffer(value) && Bufferish.isView(value)) {
  3258. value = Bufferish.Uint8Array.from(value);
  3259. } else {
  3260. if (Bufferish.isArrayBuffer(value)) {
  3261. value = new Uint8Array(value);
  3262. } else {
  3263. if ("string" == typeof value) {
  3264. return Bufferish.from.call(exports, value);
  3265. }
  3266. if ("number" == typeof value) {
  3267. throw new TypeError('"value" argument must not be a number');
  3268. }
  3269. }
  3270. }
  3271. return Array.prototype.slice.call(value);
  3272. };
  3273. }, function(mixin, exports, require) {
  3274. function alloc(obj) {
  3275. return new Buffer(obj);
  3276. }
  3277. var Bufferish = require(0);
  3278. var Buffer = Bufferish.global;
  3279. (exports = mixin.exports = Bufferish.hasBuffer ? alloc(0) : []).alloc = Bufferish.hasBuffer && Buffer.alloc || alloc;
  3280. exports.concat = Bufferish.concat;
  3281. exports.from = function(value) {
  3282. if (!Bufferish.isBuffer(value) && Bufferish.isView(value)) {
  3283. value = Bufferish.Uint8Array.from(value);
  3284. } else {
  3285. if (Bufferish.isArrayBuffer(value)) {
  3286. value = new Uint8Array(value);
  3287. } else {
  3288. if ("string" == typeof value) {
  3289. return Bufferish.from.call(exports, value);
  3290. }
  3291. if ("number" == typeof value) {
  3292. throw new TypeError('"value" argument must not be a number');
  3293. }
  3294. }
  3295. }
  3296. return Buffer.from && 1 !== Buffer.from.length ? Buffer.from(value) : new Buffer(value);
  3297. };
  3298. }, function(mixin, exports, require) {
  3299. function alloc(obj) {
  3300. return new Uint8Array(obj);
  3301. }
  3302. var Bufferish = require(0);
  3303. (exports = mixin.exports = Bufferish.hasArrayBuffer ? alloc(0) : []).alloc = alloc;
  3304. exports.concat = Bufferish.concat;
  3305. exports.from = function(value) {
  3306. if (Bufferish.isView(value)) {
  3307. var byteOffset = value.byteOffset;
  3308. var byteLength = value.byteLength;
  3309. if ((value = value.buffer).byteLength !== byteLength) {
  3310. if (value.slice) {
  3311. value = value.slice(byteOffset, byteOffset + byteLength);
  3312. } else {
  3313. if ((value = new Uint8Array(value)).byteLength !== byteLength) {
  3314. value = Array.prototype.slice.call(value, byteOffset, byteOffset + byteLength);
  3315. }
  3316. }
  3317. }
  3318. } else {
  3319. if ("string" == typeof value) {
  3320. return Bufferish.from.call(exports, value);
  3321. }
  3322. if ("number" == typeof value) {
  3323. throw new TypeError('"value" argument must not be a number');
  3324. }
  3325. }
  3326. return new Uint8Array(value);
  3327. };
  3328. }, function(canCreateDiscussions, e) {
  3329. e.copy = function(target, targetStart, start, end) {
  3330. var i;
  3331. if (!start) {
  3332. start = 0;
  3333. }
  3334. if (!(end || 0 === end)) {
  3335. end = this.length;
  3336. }
  3337. if (!targetStart) {
  3338. targetStart = 0;
  3339. }
  3340. var count = end - start;
  3341. if (target === this && start < targetStart && targetStart < end) {
  3342. i = count - 1;
  3343. for (; 0 <= i; i--) {
  3344. target[i + targetStart] = this[i + start];
  3345. }
  3346. } else {
  3347. i = 0;
  3348. for (; i < count; i++) {
  3349. target[i + targetStart] = this[i + start];
  3350. }
  3351. }
  3352. return count;
  3353. };
  3354. e.toString = function(radix, digits, n) {
  3355. var values = this;
  3356. var index = 0 | digits;
  3357. if (!n) {
  3358. n = values.length;
  3359. }
  3360. var msg = "";
  3361. var end = 0;
  3362. for (; index < n;) {
  3363. if (128 > (end = values[index++])) {
  3364. msg = msg + String.fromCharCode(end);
  3365. } else {
  3366. if (192 == (224 & end)) {
  3367. end = (31 & end) << 6 | 63 & values[index++];
  3368. } else {
  3369. if (224 == (240 & end)) {
  3370. end = (15 & end) << 12 | (63 & values[index++]) << 6 | 63 & values[index++];
  3371. } else {
  3372. if (240 == (248 & end)) {
  3373. end = (7 & end) << 18 | (63 & values[index++]) << 12 | (63 & values[index++]) << 6 | 63 & values[index++];
  3374. }
  3375. }
  3376. }
  3377. if (65536 <= end) {
  3378. end = end - 65536;
  3379. msg = msg + String.fromCharCode(55296 + (end >>> 10), 56320 + (1023 & end));
  3380. } else {
  3381. msg = msg + String.fromCharCode(end);
  3382. }
  3383. }
  3384. }
  3385. return msg;
  3386. };
  3387. e.write = function(t, offset) {
  3388. var reverseItemData = this;
  3389. var currentPage = offset || (offset = offset | 0);
  3390. var cs = t.length;
  3391. var updatedReverseItemControlData = 0;
  3392. var c = 0;
  3393. for (; c < cs;) {
  3394. if (128 > (updatedReverseItemControlData = t.charCodeAt(c++))) {
  3395. reverseItemData[currentPage++] = updatedReverseItemControlData;
  3396. } else {
  3397. if (2048 > updatedReverseItemControlData) {
  3398. reverseItemData[currentPage++] = 192 | updatedReverseItemControlData >>> 6;
  3399. reverseItemData[currentPage++] = 128 | 63 & updatedReverseItemControlData;
  3400. } else {
  3401. if (55296 > updatedReverseItemControlData || 57343 < updatedReverseItemControlData) {
  3402. reverseItemData[currentPage++] = 224 | updatedReverseItemControlData >>> 12;
  3403. reverseItemData[currentPage++] = 128 | 63 & updatedReverseItemControlData >>> 6;
  3404. reverseItemData[currentPage++] = 128 | 63 & updatedReverseItemControlData;
  3405. } else {
  3406. updatedReverseItemControlData = 65536 + (updatedReverseItemControlData - 55296 << 10 | t.charCodeAt(c++) - 56320);
  3407. reverseItemData[currentPage++] = 240 | updatedReverseItemControlData >>> 18;
  3408. reverseItemData[currentPage++] = 128 | 63 & updatedReverseItemControlData >>> 12;
  3409. reverseItemData[currentPage++] = 128 | 63 & updatedReverseItemControlData >>> 6;
  3410. reverseItemData[currentPage++] = 128 | 63 & updatedReverseItemControlData;
  3411. }
  3412. }
  3413. }
  3414. }
  3415. return currentPage - offset;
  3416. };
  3417. }, function(canCreateDiscussions, exports, require) {
  3418. function encode(name) {
  3419. return encoder || (encoder = require(14).encode), encoder(name);
  3420. }
  3421. function packValueOf(value) {
  3422. return value.valueOf();
  3423. }
  3424. function packRegExp(value) {
  3425. (value = RegExp.prototype.toString.call(value).split("/")).shift();
  3426. var htmlArray = [value.pop()];
  3427. return htmlArray.unshift(value.join("/")), htmlArray;
  3428. }
  3429. function packError(res) {
  3430. var out = {};
  3431. var key;
  3432. for (key in ERROR_COLUMNS) {
  3433. out[key] = res[key];
  3434. }
  3435. return out;
  3436. }
  3437. exports.setExtPackers = function(codec) {
  3438. codec.addExtPacker(14, Error, [packError, encode]);
  3439. codec.addExtPacker(1, EvalError, [packError, encode]);
  3440. codec.addExtPacker(2, RangeError, [packError, encode]);
  3441. codec.addExtPacker(3, ReferenceError, [packError, encode]);
  3442. codec.addExtPacker(4, SyntaxError, [packError, encode]);
  3443. codec.addExtPacker(5, TypeError, [packError, encode]);
  3444. codec.addExtPacker(6, URIError, [packError, encode]);
  3445. codec.addExtPacker(10, RegExp, [packRegExp, encode]);
  3446. codec.addExtPacker(11, Boolean, [packValueOf, encode]);
  3447. codec.addExtPacker(12, String, [packValueOf, encode]);
  3448. codec.addExtPacker(13, Date, [Number, encode]);
  3449. codec.addExtPacker(15, Number, [packValueOf, encode]);
  3450. if ("undefined" != typeof Uint8Array) {
  3451. codec.addExtPacker(17, Int8Array, packTypedArray);
  3452. codec.addExtPacker(18, Uint8Array, packTypedArray);
  3453. codec.addExtPacker(19, Int16Array, packTypedArray);
  3454. codec.addExtPacker(20, Uint16Array, packTypedArray);
  3455. codec.addExtPacker(21, Int32Array, packTypedArray);
  3456. codec.addExtPacker(22, Uint32Array, packTypedArray);
  3457. codec.addExtPacker(23, Float32Array, packTypedArray);
  3458. if ("undefined" != typeof Float64Array) {
  3459. codec.addExtPacker(24, Float64Array, packTypedArray);
  3460. }
  3461. if ("undefined" != typeof Uint8ClampedArray) {
  3462. codec.addExtPacker(25, Uint8ClampedArray, packTypedArray);
  3463. }
  3464. codec.addExtPacker(26, ArrayBuffer, packTypedArray);
  3465. codec.addExtPacker(29, DataView, packTypedArray);
  3466. }
  3467. if (Bufferish.hasBuffer) {
  3468. codec.addExtPacker(27, Buffer, Bufferish.from);
  3469. }
  3470. };
  3471. var encoder;
  3472. var Bufferish = require(0);
  3473. var Buffer = Bufferish.global;
  3474. var packTypedArray = Bufferish.Uint8Array.from;
  3475. var ERROR_COLUMNS = {
  3476. name : 1,
  3477. message : 1,
  3478. stack : 1,
  3479. columnNumber : 1,
  3480. fileName : 1,
  3481. lineNumber : 1
  3482. };
  3483. }, function(canCreateDiscussions, exports, require) {
  3484. var getName = require(9);
  3485. var Int64Buffer = require(11);
  3486. var Uint64BE = Int64Buffer.Uint64BE;
  3487. var Int64BE = Int64Buffer.Int64BE;
  3488. var Bufferish = require(0);
  3489. var f = require(10);
  3490. var WriteToken = require(36);
  3491. var uint8 = require(17).uint8;
  3492. var Date = require(7).ExtBuffer;
  3493. var HAS_UINT8ARRAY = "undefined" != typeof Uint8Array;
  3494. var HAS_MAP = "undefined" != typeof Map;
  3495. var shapePathsCollection = [];
  3496. shapePathsCollection[1] = 212;
  3497. shapePathsCollection[2] = 213;
  3498. shapePathsCollection[4] = 214;
  3499. shapePathsCollection[8] = 215;
  3500. shapePathsCollection[16] = 216;
  3501. exports.getWriteType = function(options) {
  3502. function object(encoder, value) {
  3503. if (null === value) {
  3504. return nil(encoder, value);
  3505. }
  3506. if (isBuffer(value)) {
  3507. return bin(encoder, value);
  3508. }
  3509. if (getName(value)) {
  3510. return function(encoder, data) {
  3511. var length = data.length;
  3512. token[16 > length ? 144 + length : 65535 >= length ? 220 : 221](encoder, length);
  3513. var encode = encoder.codec.encode;
  3514. var i = 0;
  3515. for (; i < length; i++) {
  3516. encode(encoder, data[i]);
  3517. }
  3518. }(encoder, value);
  3519. }
  3520. if (Uint64BE.isUint64BE(value)) {
  3521. return function(encoder, in_value) {
  3522. token[207](encoder, in_value.toArray());
  3523. }(encoder, value);
  3524. }
  3525. if (Int64BE.isInt64BE(value)) {
  3526. return function(encoder, in_value) {
  3527. token[211](encoder, in_value.toArray());
  3528. }(encoder, value);
  3529. }
  3530. var string = encoder.codec.getExtPacker(value);
  3531. return string && (value = string(value)), value instanceof Date ? function(encoder, value) {
  3532. var data = value.buffer;
  3533. var length = data.length;
  3534. var type = shapePathsCollection[length] || (255 > length ? 199 : 65535 >= length ? 200 : 201);
  3535. token[type](encoder, length);
  3536. uint8[value.type](encoder);
  3537. encoder.send(data);
  3538. }(encoder, value) : void map(encoder, value);
  3539. }
  3540. function nil(encoder, value) {
  3541. token[192](encoder, value);
  3542. }
  3543. function bin_buffer(encoder, value) {
  3544. var length = value.length;
  3545. var type = 255 > length ? 196 : 65535 >= length ? 197 : 198;
  3546. token[type](encoder, length);
  3547. encoder.send(value);
  3548. }
  3549. function obj_to_map(encoder, value) {
  3550. var r = Object.keys(value);
  3551. var i = r.length;
  3552. var type = 16 > i ? 128 + i : 65535 >= i ? 222 : 223;
  3553. token[type](encoder, i);
  3554. var encode = encoder.codec.encode;
  3555. r.forEach(function(i) {
  3556. encode(encoder, i);
  3557. encode(encoder, value[i]);
  3558. });
  3559. }
  3560. var token = WriteToken.getWriteToken(options);
  3561. var useraw = options && options.useraw;
  3562. var binarraybuffer = HAS_UINT8ARRAY && options && options.binarraybuffer;
  3563. var isBuffer = binarraybuffer ? Bufferish.isArrayBuffer : Bufferish.isBuffer;
  3564. var bin = binarraybuffer ? function(encoder, value) {
  3565. bin_buffer(encoder, new Uint8Array(value));
  3566. } : bin_buffer;
  3567. var map = HAS_MAP && options && options.usemap ? function(encoder, value) {
  3568. if (!(value instanceof Map)) {
  3569. return obj_to_map(encoder, value);
  3570. }
  3571. var i = value.size;
  3572. var type = 16 > i ? 128 + i : 65535 >= i ? 222 : 223;
  3573. token[type](encoder, i);
  3574. var encode = encoder.codec.encode;
  3575. value.forEach(function(password, version) {
  3576. encode(encoder, version);
  3577. encode(encoder, password);
  3578. });
  3579. } : obj_to_map;
  3580. return {
  3581. boolean : function(key, value) {
  3582. var type = value ? 195 : 194;
  3583. token[type](key, value);
  3584. },
  3585. function : nil,
  3586. number : function(encoder, value) {
  3587. var rbd = 0 | value;
  3588. if (value === rbd) {
  3589. token[-32 <= rbd && 127 >= rbd ? 255 & rbd : 0 <= rbd ? 255 >= rbd ? 204 : 65535 >= rbd ? 205 : 206 : -128 <= rbd ? 208 : -32768 <= rbd ? 209 : 210](encoder, rbd);
  3590. } else {
  3591. token[203](encoder, value);
  3592. }
  3593. },
  3594. object : useraw ? function(encoder, value) {
  3595. return isBuffer(value) ? function(encoder, properties) {
  3596. var length = properties.length;
  3597. token[32 > length ? 160 + length : 65535 >= length ? 218 : 219](encoder, length);
  3598. encoder.send(properties);
  3599. }(encoder, value) : void object(encoder, value);
  3600. } : object,
  3601. string : function($) {
  3602. return function(options, line) {
  3603. var n = line.length;
  3604. var size = 5 + 3 * n;
  3605. options.offset = options.reserve(size);
  3606. var data = options.buffer;
  3607. var start = $(n);
  3608. var i = options.offset + start;
  3609. n = f.write.call(data, line, i);
  3610. var stop = $(n);
  3611. if (start !== stop) {
  3612. var end = i + n;
  3613. f.copy.call(data, data, i + stop - start, i, end);
  3614. }
  3615. var method = 1 === stop ? 160 + n : 3 >= stop ? 215 + stop : 219;
  3616. token[method](options, n);
  3617. options.offset += n;
  3618. };
  3619. }(useraw ? function(canCreateDiscussions) {
  3620. return 32 > canCreateDiscussions ? 1 : 65535 >= canCreateDiscussions ? 3 : 5;
  3621. } : function(canCreateDiscussions) {
  3622. return 32 > canCreateDiscussions ? 1 : 255 >= canCreateDiscussions ? 2 : 65535 >= canCreateDiscussions ? 3 : 5;
  3623. }),
  3624. symbol : nil,
  3625. undefined : nil
  3626. };
  3627. };
  3628. }, function(canCreateDiscussions, exports, require) {
  3629. function init_token() {
  3630. var token = a.slice();
  3631. return token[196] = write4(196), token[197] = write1(197), token[198] = write2(198), token[199] = write4(199), token[200] = write1(200), token[201] = write2(201), token[202] = writeN(202, 4, Buffer_prototype.writeFloatBE || writeFloatBE, true), token[203] = writeN(203, 8, Buffer_prototype.writeDoubleBE || writeDoubleBE, true), token[204] = write4(204), token[205] = write1(205), token[206] = write2(206), token[207] = writeN(207, 8, writeUInt64BE), token[208] = write4(208), token[209] = write1(209),
  3632. token[210] = write2(210), token[211] = writeN(211, 8, writeInt64BE), token[217] = write4(217), token[218] = write1(218), token[219] = write2(219), token[220] = write1(220), token[221] = write2(221), token[222] = write1(222), token[223] = write2(223), token;
  3633. }
  3634. function write4(type) {
  3635. return function(options, red) {
  3636. var p = options.reserve(2);
  3637. var data = options.buffer;
  3638. data[p++] = type;
  3639. data[p] = red;
  3640. };
  3641. }
  3642. function write1(type) {
  3643. return function(options, num) {
  3644. var j = options.reserve(3);
  3645. var data = options.buffer;
  3646. data[j++] = type;
  3647. data[j++] = num >>> 8;
  3648. data[j] = num;
  3649. };
  3650. }
  3651. function write2(type) {
  3652. return function(options, num) {
  3653. var j = options.reserve(5);
  3654. var data = options.buffer;
  3655. data[j++] = type;
  3656. data[j++] = num >>> 24;
  3657. data[j++] = num >>> 16;
  3658. data[j++] = num >>> 8;
  3659. data[j] = num;
  3660. };
  3661. }
  3662. function writeN(type, len, method, noAssert) {
  3663. return function(encoder, query) {
  3664. var offset = encoder.reserve(len + 1);
  3665. encoder.buffer[offset++] = type;
  3666. method.call(encoder.buffer, query, offset, noAssert);
  3667. };
  3668. }
  3669. function writeUInt64BE(value, offset) {
  3670. new Uint64BE(this, offset, value);
  3671. }
  3672. function writeInt64BE(value, offset) {
  3673. new Int64BE(this, offset, value);
  3674. }
  3675. function writeFloatBE(value, offset) {
  3676. ieee754.write(this, value, offset, false, 23, 4);
  3677. }
  3678. function writeDoubleBE(value, offset) {
  3679. ieee754.write(this, value, offset, false, 52, 8);
  3680. }
  3681. var ieee754 = require(8);
  3682. var Int64Buffer = require(11);
  3683. var Uint64BE = Int64Buffer.Uint64BE;
  3684. var Int64BE = Int64Buffer.Int64BE;
  3685. var a = require(17).uint8;
  3686. var Bufferish = require(0);
  3687. var Buffer = Bufferish.global;
  3688. var c = Bufferish.hasBuffer && "TYPED_ARRAY_SUPPORT" in Buffer && !Buffer.TYPED_ARRAY_SUPPORT;
  3689. var Buffer_prototype = Bufferish.hasBuffer && Buffer.prototype || {};
  3690. exports.getWriteToken = function(options) {
  3691. return options && options.uint8array ? function() {
  3692. var token = init_token();
  3693. return token[202] = writeN(202, 4, writeFloatBE), token[203] = writeN(203, 8, writeDoubleBE), token;
  3694. }() : c || Bufferish.hasBuffer && options && options.safe ? function() {
  3695. var token = a.slice();
  3696. return token[196] = writeN(196, 1, Buffer.prototype.writeUInt8), token[197] = writeN(197, 2, Buffer.prototype.writeUInt16BE), token[198] = writeN(198, 4, Buffer.prototype.writeUInt32BE), token[199] = writeN(199, 1, Buffer.prototype.writeUInt8), token[200] = writeN(200, 2, Buffer.prototype.writeUInt16BE), token[201] = writeN(201, 4, Buffer.prototype.writeUInt32BE), token[202] = writeN(202, 4, Buffer.prototype.writeFloatBE), token[203] = writeN(203, 8, Buffer.prototype.writeDoubleBE), token[204] =
  3697. writeN(204, 1, Buffer.prototype.writeUInt8), token[205] = writeN(205, 2, Buffer.prototype.writeUInt16BE), token[206] = writeN(206, 4, Buffer.prototype.writeUInt32BE), token[207] = writeN(207, 8, writeUInt64BE), token[208] = writeN(208, 1, Buffer.prototype.writeInt8), token[209] = writeN(209, 2, Buffer.prototype.writeInt16BE), token[210] = writeN(210, 4, Buffer.prototype.writeInt32BE), token[211] = writeN(211, 8, writeInt64BE), token[217] = writeN(217, 1, Buffer.prototype.writeUInt8), token[218] =
  3698. writeN(218, 2, Buffer.prototype.writeUInt16BE), token[219] = writeN(219, 4, Buffer.prototype.writeUInt32BE), token[220] = writeN(220, 2, Buffer.prototype.writeUInt16BE), token[221] = writeN(221, 4, Buffer.prototype.writeUInt32BE), token[222] = writeN(222, 2, Buffer.prototype.writeUInt16BE), token[223] = writeN(223, 4, Buffer.prototype.writeUInt32BE), token;
  3699. }() : init_token();
  3700. };
  3701. }, function(canCreateDiscussions, exports, require) {
  3702. function decode(params) {
  3703. return serialize || (serialize = require(19).decode), serialize(params);
  3704. }
  3705. function unpackRegExp(value) {
  3706. return RegExp.apply(null, value);
  3707. }
  3708. function unpackError(Class) {
  3709. return function(savedObject) {
  3710. var out = new Class;
  3711. var key;
  3712. for (key in ERROR_COLUMNS) {
  3713. out[key] = savedObject[key];
  3714. }
  3715. return out;
  3716. };
  3717. }
  3718. function unpackClass(Class) {
  3719. return function(deliver) {
  3720. return new Class(deliver);
  3721. };
  3722. }
  3723. function unpackArrayBuffer(value) {
  3724. return (new Uint8Array(value)).buffer;
  3725. }
  3726. exports.setExtUnpackers = function(codec) {
  3727. codec.addExtUnpacker(14, [decode, unpackError(Error)]);
  3728. codec.addExtUnpacker(1, [decode, unpackError(EvalError)]);
  3729. codec.addExtUnpacker(2, [decode, unpackError(RangeError)]);
  3730. codec.addExtUnpacker(3, [decode, unpackError(ReferenceError)]);
  3731. codec.addExtUnpacker(4, [decode, unpackError(SyntaxError)]);
  3732. codec.addExtUnpacker(5, [decode, unpackError(TypeError)]);
  3733. codec.addExtUnpacker(6, [decode, unpackError(URIError)]);
  3734. codec.addExtUnpacker(10, [decode, unpackRegExp]);
  3735. codec.addExtUnpacker(11, [decode, unpackClass(Boolean)]);
  3736. codec.addExtUnpacker(12, [decode, unpackClass(String)]);
  3737. codec.addExtUnpacker(13, [decode, unpackClass(Date)]);
  3738. codec.addExtUnpacker(15, [decode, unpackClass(Number)]);
  3739. if ("undefined" != typeof Uint8Array) {
  3740. codec.addExtUnpacker(17, unpackClass(Int8Array));
  3741. codec.addExtUnpacker(18, unpackClass(Uint8Array));
  3742. codec.addExtUnpacker(19, [unpackArrayBuffer, unpackClass(Int16Array)]);
  3743. codec.addExtUnpacker(20, [unpackArrayBuffer, unpackClass(Uint16Array)]);
  3744. codec.addExtUnpacker(21, [unpackArrayBuffer, unpackClass(Int32Array)]);
  3745. codec.addExtUnpacker(22, [unpackArrayBuffer, unpackClass(Uint32Array)]);
  3746. codec.addExtUnpacker(23, [unpackArrayBuffer, unpackClass(Float32Array)]);
  3747. if ("undefined" != typeof Float64Array) {
  3748. codec.addExtUnpacker(24, [unpackArrayBuffer, unpackClass(Float64Array)]);
  3749. }
  3750. if ("undefined" != typeof Uint8ClampedArray) {
  3751. codec.addExtUnpacker(25, unpackClass(Uint8ClampedArray));
  3752. }
  3753. codec.addExtUnpacker(26, unpackArrayBuffer);
  3754. codec.addExtUnpacker(29, [unpackArrayBuffer, unpackClass(DataView)]);
  3755. }
  3756. if (Bufferish.hasBuffer) {
  3757. codec.addExtUnpacker(27, unpackClass(Buffer));
  3758. }
  3759. };
  3760. var serialize;
  3761. var Bufferish = require(0);
  3762. var Buffer = Bufferish.global;
  3763. var ERROR_COLUMNS = {
  3764. name : 1,
  3765. message : 1,
  3766. stack : 1,
  3767. columnNumber : 1,
  3768. fileName : 1,
  3769. lineNumber : 1
  3770. };
  3771. }, function(canCreateDiscussions, exports, require) {
  3772. function init_token(format) {
  3773. var i;
  3774. var token = Array(256);
  3775. i = 0;
  3776. for (; 127 >= i; i++) {
  3777. token[i] = constant(i);
  3778. }
  3779. i = 128;
  3780. for (; 143 >= i; i++) {
  3781. token[i] = fix(i - 128, format.map);
  3782. }
  3783. i = 144;
  3784. for (; 159 >= i; i++) {
  3785. token[i] = fix(i - 144, format.array);
  3786. }
  3787. i = 160;
  3788. for (; 191 >= i; i++) {
  3789. token[i] = fix(i - 160, format.str);
  3790. }
  3791. token[192] = constant(null);
  3792. token[193] = null;
  3793. token[194] = constant(false);
  3794. token[195] = constant(true);
  3795. token[196] = flex(format.uint8, format.bin);
  3796. token[197] = flex(format.uint16, format.bin);
  3797. token[198] = flex(format.uint32, format.bin);
  3798. token[199] = flex(format.uint8, format.ext);
  3799. token[200] = flex(format.uint16, format.ext);
  3800. token[201] = flex(format.uint32, format.ext);
  3801. token[202] = format.float32;
  3802. token[203] = format.float64;
  3803. token[204] = format.uint8;
  3804. token[205] = format.uint16;
  3805. token[206] = format.uint32;
  3806. token[207] = format.uint64;
  3807. token[208] = format.int8;
  3808. token[209] = format.int16;
  3809. token[210] = format.int32;
  3810. token[211] = format.int64;
  3811. token[212] = fix(1, format.ext);
  3812. token[213] = fix(2, format.ext);
  3813. token[214] = fix(4, format.ext);
  3814. token[215] = fix(8, format.ext);
  3815. token[216] = fix(16, format.ext);
  3816. token[217] = flex(format.uint8, format.str);
  3817. token[218] = flex(format.uint16, format.str);
  3818. token[219] = flex(format.uint32, format.str);
  3819. token[220] = flex(format.uint16, format.array);
  3820. token[221] = flex(format.uint32, format.array);
  3821. token[222] = flex(format.uint16, format.map);
  3822. token[223] = flex(format.uint32, format.map);
  3823. i = 224;
  3824. for (; 255 >= i; i++) {
  3825. token[i] = constant(i - 256);
  3826. }
  3827. return token;
  3828. }
  3829. function constant(name) {
  3830. return function() {
  3831. return name;
  3832. };
  3833. }
  3834. function flex(lenFunc, decodeFunc) {
  3835. return function(decoder) {
  3836. var len = lenFunc(decoder);
  3837. return decodeFunc(decoder, len);
  3838. };
  3839. }
  3840. function fix(index, method) {
  3841. return function(Q98038813) {
  3842. return method(Q98038813, index);
  3843. };
  3844. }
  3845. var ReadFormat = require(21);
  3846. exports.getReadToken = function(options) {
  3847. var json = ReadFormat.getReadFormat(options);
  3848. return options && options.useraw ? function(format) {
  3849. var i;
  3850. var obj = init_token(format).slice();
  3851. obj[217] = obj[196];
  3852. obj[218] = obj[197];
  3853. obj[219] = obj[198];
  3854. i = 160;
  3855. for (; 191 >= i; i++) {
  3856. obj[i] = fix(i - 160, format.bin);
  3857. }
  3858. return obj;
  3859. }(json) : init_token(json);
  3860. };
  3861. }, function(canCreateDiscussions, exports, require) {
  3862. function Encoder(options) {
  3863. return this instanceof Encoder ? void EncodeBuffer.call(this, options) : new Encoder(options);
  3864. }
  3865. exports.Encoder = Encoder;
  3866. var EventLite = require(22);
  3867. var EncodeBuffer = require(15).EncodeBuffer;
  3868. Encoder.prototype = new EncodeBuffer;
  3869. EventLite.mixin(Encoder.prototype);
  3870. Encoder.prototype.encode = function(chunk) {
  3871. this.write(chunk);
  3872. this.emit("data", this.read());
  3873. };
  3874. Encoder.prototype.end = function(data) {
  3875. if (arguments.length) {
  3876. this.encode(data);
  3877. }
  3878. this.flush();
  3879. this.emit("end");
  3880. };
  3881. }, function(canCreateDiscussions, exports, require) {
  3882. function Decoder(options) {
  3883. return this instanceof Decoder ? void DecodeBuffer.call(this, options) : new Decoder(options);
  3884. }
  3885. exports.Decoder = Decoder;
  3886. var EventLite = require(22);
  3887. var DecodeBuffer = require(20).DecodeBuffer;
  3888. Decoder.prototype = new DecodeBuffer;
  3889. EventLite.mixin(Decoder.prototype);
  3890. Decoder.prototype.decode = function(a) {
  3891. if (arguments.length) {
  3892. this.write(a);
  3893. }
  3894. this.flush();
  3895. };
  3896. Decoder.prototype.push = function(type) {
  3897. this.emit("data", type);
  3898. };
  3899. Decoder.prototype.end = function(raw) {
  3900. this.decode(raw);
  3901. this.emit("end");
  3902. };
  3903. }, function(canCreateDiscussions, exports, require) {
  3904. require(12);
  3905. require(6);
  3906. exports.createCodec = require(4).createCodec;
  3907. }, function(canCreateDiscussions, exports, require) {
  3908. require(12);
  3909. require(6);
  3910. exports.codec = {
  3911. preset : require(4).preset
  3912. };
  3913. }, , , , , , function(module, canCreateDiscussions, _resolveReferenceNode) {
  3914. var child = _resolveReferenceNode(1);
  3915. var o = _resolveReferenceNode(3);
  3916. var obj = _resolveReferenceNode(49);
  3917. module.exports = {
  3918. ahNum : 0,
  3919. socket : null,
  3920. connected : false,
  3921. socketId : -1,
  3922. sendQueue : [],
  3923. connect : function(baseUrl, done, num) {
  3924. if (!this.socket) {
  3925. var protocol = child.enableHttps ? "wss:" : "ws:";
  3926. var self = this;
  3927. try {
  3928. var s = false;
  3929. this.socket = new WebSocket(protocol + baseUrl);
  3930. this.socket.binaryType = "arraybuffer";
  3931. this.socket.onmessage = function(event) {
  3932. var name_list = o.decodeNetworkMessage(event.data)[0];
  3933. var name = name_list[0];
  3934. var item = name_list[1];
  3935. if ("io-init" == name) {
  3936. self.socketId = item[0];
  3937. } else {
  3938. num[name].apply(void 0, item);
  3939. }
  3940. };
  3941. this.socket.onopen = function() {
  3942. self.connected = true;
  3943. done();
  3944. for (let encodedPackets of self.sendQueue) {
  3945. self.send(encodedPackets[0], ...encodedPackets[1]);
  3946. }
  3947. };
  3948. this.socket.onclose = function() {
  3949. self.connected = false;
  3950. if (!s) {
  3951. done("Disconnected. Try connecting to another server.");
  3952. }
  3953. };
  3954. this.socket.onerror = function() {
  3955. if (this.socket.readyState != WebSocket.OPEN) {
  3956. s = true;
  3957. console.error("Socket error", arguments);
  3958. done("Socket error");
  3959. }
  3960. };
  3961. } catch (host) {
  3962. console.error("Socket connection error:", host);
  3963. done(host);
  3964. }
  3965. }
  3966. },
  3967. send : function(key, ...j) {
  3968. if (!this.socket || this.socket.readyState !== WebSocket.OPEN) {
  3969. return console.warn("Socket not open yet", key, j), void this.sendQueue.push([key, j]);
  3970. }
  3971. this.ahNum = o.rotateNumber(this.ahNum, obj);
  3972. var data = o.encodeNetworkMessage([key, j], this.ahNum);
  3973. this.socket.send(data);
  3974. },
  3975. socketReady : function() {
  3976. return this.socket && this.connected;
  3977. }
  3978. };
  3979. }, function(mixin) {
  3980. mixin.exports = 60133;
  3981. }, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , function(canCreateDiscussions, isSlidingUp, require) {
  3982. function shortcutUrl(url) {
  3983. return uri.searchParams.get(url);
  3984. }
  3985. var client = require(48);
  3986. var config = require(1);
  3987. var exports = require(3);
  3988. var isNonIntegerStep = "undefined" != typeof Storage;
  3989. window.getSavedVal = function(step) {
  3990. return isNonIntegerStep ? localStorage.getItem(step) : null;
  3991. };
  3992. window.saveVal = function(b, status) {
  3993. if (isNonIntegerStep) {
  3994. localStorage.setItem(b, status);
  3995. }
  3996. };
  3997. var state = getSavedVal("krunker_username");
  3998. var PORT_SERVER_MESSAGES = getSavedVal("krunker_id");
  3999. getSavedVal("krunker_token");
  4000. if (state) {
  4001. profileName.innerHTML = state;
  4002. }
  4003. var uri = new URL(window.location.href);
  4004. window.openLink = function(event) {
  4005. window.open(event, "_self");
  4006. };
  4007. window.searchMap = function() {
  4008. var params = searchInput.value;
  4009. if (params && "" != params) {
  4010. window.open("./social.html?p=maps&q=search&s=" + params, "_self");
  4011. }
  4012. };
  4013. window.playMap = function(loading) {
  4014. window.saveVal("mapToLoad", loading);
  4015. window.open("/", "_blank");
  4016. };
  4017. var boothId = shortcutUrl("p") || "leaders";
  4018. var key = shortcutUrl("q");
  4019. var cb = shortcutUrl("s") || null;
  4020. if (!(key || "leaders" != boothId)) {
  4021. key = "score";
  4022. }
  4023. if (!(key || "profile" != boothId)) {
  4024. key = state;
  4025. }
  4026. if (!(key || "maps" != boothId)) {
  4027. key = "votes";
  4028. }
  4029. document.getElementById(boothId).style.opacity = .5;
  4030. var masterVideoId = config.isProd ? "krunker_social.krunker.io" : "127.0.0.1";
  4031. var _ddoc = config.isProd ? 443 : 5070;
  4032. client.connect("//" + masterVideoId + ":" + _ddoc + "/", function(canCreateDiscussions) {
  4033. if (!canCreateDiscussions) {
  4034. client.send("r", boothId, key, PORT_SERVER_MESSAGES, cb);
  4035. }
  4036. }, {
  4037. 0 : function(clickRepeater, e, data, headers) {
  4038. if ("profile" == clickRepeater) {
  4039. if (data) {
  4040. profileHolder.style.display = "block";
  4041. var fsHTML = "";
  4042. var d = Math.max(1, Math.floor(config.rankVar * Math.sqrt(data.player_score)));
  4043. fsHTML = fsHTML + ("<div class='profileName'>" + data.player_name + (data.player_clan ? "<span style='color:rgba(0,0,0,0.4)'> [" + data.player_clan + "]</span>" : "") + (data.player_featured ? "<i class='material-icons' style='margin-left:5px;font-size:32px;color:rgba(0,0,0,0.4)'>check_circle</i>" : "") + "<img style='float:right' src='./img/levels/" + Math.max(Math.min(config.maxLevel - 2, d.roundToNearest(3) - 2), 0) + ".png' class='rnkIconL'></div>");
  4044. fsHTML = fsHTML + "<div id='statHolder'>";
  4045. fsHTML = fsHTML + ("<div class='pSt'>LVL<strong>" + d + "</strong></div>");
  4046. fsHTML = fsHTML + ("<div class='pSt'>KR<strong>" + data.player_funds + "</strong></div>");
  4047. fsHTML = fsHTML + ("<div class='pSt'>Score<strong>" + data.player_score + "</strong></div>");
  4048. fsHTML = fsHTML + ("<div class='pSt'>SPK<strong>" + (data.player_score / Math.max(data.player_kills, 1)).toFixed(2) + "</strong></div>");
  4049. fsHTML = fsHTML + ("<div class='pSt'>Kills<strong>" + data.player_kills + "</strong></div>");
  4050. fsHTML = fsHTML + ("<div class='pSt'>Deaths<strong>" + data.player_deaths + "</strong></div>");
  4051. fsHTML = fsHTML + ("<div class='pSt'>KDR<strong>" + (data.player_kills / Math.max(data.player_deaths, 1)).toFixed(2) + "</strong></div>");
  4052. fsHTML = fsHTML + ("<div class='pSt'>Games<strong>" + data.player_games_played + "</strong></div>");
  4053. fsHTML = fsHTML + ("<div class='pSt'>Wins<strong>" + data.player_wins + "</strong></div>");
  4054. fsHTML = fsHTML + ("<div class='pSt'>W/L<strong>" + (data.player_wins / Math.max(data.player_games_played, 1)).toFixed(2) + "</strong></div>");
  4055. fsHTML = fsHTML + ("<div class='pSt'>Time<strong>" + exports.getReadableTime(data.player_timeplayed) + "</strong></div>");
  4056. fsHTML = fsHTML + "</div>";
  4057. hackerText.innerHTML = data.player_hack ? "HACKER" : "";
  4058. profileData.innerHTML = fsHTML;
  4059. }
  4060. if (profileMaps.style.display = "none", headers && headers.length) {
  4061. fsHTML = "<div style='font-size:24px;margin-top:-10px;margin-bottom:10px'>User Maps</div>";
  4062. var i = 0;
  4063. for (; i < headers.length; ++i) {
  4064. fsHTML = fsHTML + ("<div style='height:40px'><div style='display:inline-block'><a style='color:#2196F3' href='javascript:;' onclick='playMap(&quot;" + headers[i].map_name.escape() + "&quot;)' class='lName'>" + headers[i].map_name + "</a></div><div style='float:right'><span>" + headers[i].map_votes + "</span></div></div>");
  4065. }
  4066. profileMaps.style.display = "inline-block";
  4067. profileMaps.innerHTML = fsHTML;
  4068. }
  4069. } else {
  4070. if ("maps" == clickRepeater) {
  4071. mapsHolder.style.display = "block";
  4072. fsHTML = "<div class='scrollItem'>";
  4073. if (!data.length) {
  4074. fsHTML = fsHTML + "<span style='color:rgba(0,0,0,0.4);'>No Maps found...</span>";
  4075. }
  4076. i = 0;
  4077. for (; i < data.length; ++i) {
  4078. fsHTML = fsHTML + ("<div style='height:80px'><div style='display:inline-block'><a style='color:#000' href='javascript:;' onclick='playMap(&quot;" + data[i].map_name.escape() + "&quot;)' class='lName'>" + data[i].map_name + "</a><div style='color:rgba(0,0,0,0.25)'> by <a style='color:rgba(0,0,0,0.5)' href='/social.html?p=profile&q=" + data[i].creatorname + "' class='lName'>" + data[i].creatorname + "</a></div></div><div style='float:right'><span id='mapVotes" + data[i].map_id + "'>" +
  4079. data[i].map_votes + "</span></div></div>");
  4080. }
  4081. fsHTML = fsHTML + "</div>";
  4082. mapList.innerHTML = fsHTML;
  4083. } else {
  4084. if ("leaders" == clickRepeater) {
  4085. leaderHolder.style.display = "block";
  4086. fsHTML = "<div class='scrollItem'>";
  4087. i = 0;
  4088. for (; i < data.length; ++i) {
  4089. fsHTML = fsHTML + ("player_clan" == e ? "<div>" + (i + 1) + ". <a class='lName'>[" + data[i].clan_name + "]</a> (" + data[i].clan_membercount + ") " + (data[i].clan_hackcount ? "<span style='color:#E85656'>" + data[i].clan_hackcount + "</span>" : "") + "<span style='color:rgba(0,0,0,0.3)'> by <a href='/social.html?p=profile&q=" + data[i].creatorname + "' class='lName'>" + data[i].creatorname + "</a></span><div style='float:right'>" + data[i].clan_score + "</div></div>" : "<div>" + (i +
  4090. 1) + ". <a href='/social.html?p=profile&q=" + data[i].player_name + "' class='lName' style='" + (data[i].player_hack ? "color:#E85656" : "") + "'>" + data[i].player_name + "</a>" + (data[i].player_clan ? "<span style='color:rgba(0,0,0,0.4)'> [" + data[i].player_clan + "]</span>" : "") + (data[i].player_featured ? "<i class='material-icons' style='margin-left:5px;font-size:26px;color:rgba(0,0,0,0.4)'>check_circle</i>" : "") + "<div style='float:right'>" + (config.leaderCal[e] ? config.leaderCal[e](data[i][e]) :
  4091. data[i][e]) + "</div></div>");
  4092. }
  4093. fsHTML = fsHTML + "</div>";
  4094. leaderList.innerHTML = fsHTML;
  4095. }
  4096. }
  4097. }
  4098. },
  4099. 1 : function(bbls) {
  4100. alert(bbls);
  4101. }
  4102. });
  4103. }]);
Add Comment
Please, Sign In to add comment