From 583bcaa96e5ece03d8c761c5d2b48b6cbba40636 Mon Sep 17 00:00:00 2001 From: Travis CI Date: Mon, 21 Nov 2016 01:21:59 +0000 Subject: [PATCH] Webpack build: 411c9bd32c94c3164a08cfc196463cb969c9d47b --- discord.indev.js | 85938 +++++++++++++++++++++++------------------ discord.indev.min.js | 267 +- 2 files changed, 48870 insertions(+), 37335 deletions(-) diff --git a/discord.indev.js b/discord.indev.js index a70e445a..d55049aa 100644 --- a/discord.indev.js +++ b/discord.indev.js @@ -11,16 +11,16 @@ /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { -/******/ exports: {}, -/******/ id: moduleId, -/******/ loaded: false +/******/ i: moduleId, +/******/ l: false, +/******/ exports: {} /******/ }; /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ // Flag the module as loaded -/******/ module.loaded = true; +/******/ module.l = true; /******/ // Return the exports of the module /******/ return module.exports; @@ -33,39772 +33,51306 @@ /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; +/******/ // identity function for calling harmory imports with the correct context +/******/ __webpack_require__.i = function(value) { return value; }; + +/******/ // define getter function for harmory exports +/******/ __webpack_require__.d = function(exports, name, getter) { +/******/ Object.defineProperty(exports, name, { +/******/ configurable: false, +/******/ enumerable: true, +/******/ get: getter +/******/ }); +/******/ }; + +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function getDefault() { return module['default']; } : +/******/ function getModuleExports() { return module; }; +/******/ __webpack_require__.d(getter, 'a', getter); +/******/ return getter; +/******/ }; + +/******/ // Object.prototype.hasOwnProperty.call +/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; + /******/ // __webpack_public_path__ /******/ __webpack_require__.p = ""; /******/ // Load entry module and return exports -/******/ return __webpack_require__(0); +/******/ return __webpack_require__(__webpack_require__.s = 281); /******/ }) /************************************************************************/ /******/ ([ /* 0 */ /***/ function(module, exports, __webpack_require__) { - module.exports = { - Client: __webpack_require__(1), - WebhookClient: __webpack_require__(248), - Shard: __webpack_require__(249), - ShardClientUtil: __webpack_require__(245), - ShardingManager: __webpack_require__(250), +"use strict"; +/* WEBPACK VAR INJECTION */(function(Buffer, global) {/*! + * The buffer module from node.js, for the browser. + * + * @author Feross Aboukhadijeh + * @license MIT + */ +/* eslint-disable no-proto */ - Collection: __webpack_require__(10), - splitMessage: __webpack_require__(11), - escapeMarkdown: __webpack_require__(19), - fetchRecommendedShards: __webpack_require__(251), +'use strict' - Channel: __webpack_require__(50), - ClientOAuth2Application: __webpack_require__(34), - ClientUser: __webpack_require__(208), - DMChannel: __webpack_require__(49), - Emoji: __webpack_require__(21), - EvaluatedPermissions: __webpack_require__(27), - Game: __webpack_require__(24).Game, - GroupDMChannel: __webpack_require__(55), - Guild: __webpack_require__(47), - GuildChannel: __webpack_require__(52), - GuildMember: __webpack_require__(25), - Invite: __webpack_require__(28), - Message: __webpack_require__(16), - MessageAttachment: __webpack_require__(17), - MessageCollector: __webpack_require__(23), - MessageEmbed: __webpack_require__(18), - MessageReaction: __webpack_require__(20), - OAuth2Application: __webpack_require__(35), - PartialGuild: __webpack_require__(29), - PartialGuildChannel: __webpack_require__(30), - PermissionOverwrites: __webpack_require__(53), - Presence: __webpack_require__(24).Presence, - ReactionEmoji: __webpack_require__(22), - Role: __webpack_require__(26), - TextChannel: __webpack_require__(51), - User: __webpack_require__(13), - VoiceChannel: __webpack_require__(54), - Webhook: __webpack_require__(31), +var base64 = __webpack_require__(148) +var ieee754 = __webpack_require__(198) +var isArray = __webpack_require__(102) - version: __webpack_require__(6).version, - }; +exports.Buffer = Buffer +exports.SlowBuffer = SlowBuffer +exports.INSPECT_MAX_BYTES = 50 - if (typeof window !== 'undefined') window.Discord = module.exports; // eslint-disable-line no-undef +/** + * If `Buffer.TYPED_ARRAY_SUPPORT`: + * === true Use Uint8Array implementation (fastest) + * === false Use Object implementation (most compatible, even IE6) + * + * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+, + * Opera 11.6+, iOS 4.2+. + * + * Due to various browser bugs, sometimes the Object implementation will be used even + * when the browser supports typed arrays. + * + * Note: + * + * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances, + * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438. + * + * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function. + * + * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of + * incorrect length in some situations. + * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they + * get the Object implementation, which is slower but behaves correctly. + */ +Buffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined + ? global.TYPED_ARRAY_SUPPORT + : typedArraySupport() + +/* + * Export kMaxLength after typed array support is determined. + */ +exports.kMaxLength = kMaxLength() + +function typedArraySupport () { + try { + var arr = new Uint8Array(1) + arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }} + return arr.foo() === 42 && // typed array instances can be augmented + typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray` + arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray` + } catch (e) { + return false + } +} + +function kMaxLength () { + return Buffer.TYPED_ARRAY_SUPPORT + ? 0x7fffffff + : 0x3fffffff +} + +function createBuffer (that, length) { + if (kMaxLength() < length) { + throw new RangeError('Invalid typed array length') + } + if (Buffer.TYPED_ARRAY_SUPPORT) { + // Return an augmented `Uint8Array` instance, for best performance + that = new Uint8Array(length) + that.__proto__ = Buffer.prototype + } else { + // Fallback: Return an object instance of the Buffer class + if (that === null) { + that = new Buffer(length) + } + that.length = length + } + + return that +} + +/** + * The Buffer constructor returns instances of `Uint8Array` that have their + * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of + * `Uint8Array`, so the returned instances will have all the node `Buffer` methods + * and the `Uint8Array` methods. Square bracket notation works as expected -- it + * returns a single octet. + * + * The `Uint8Array` prototype remains unmodified. + */ + +function Buffer (arg, encodingOrOffset, length) { + if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) { + return new Buffer(arg, encodingOrOffset, length) + } + + // Common case. + if (typeof arg === 'number') { + if (typeof encodingOrOffset === 'string') { + throw new Error( + 'If encoding is specified then the first argument must be a string' + ) + } + return allocUnsafe(this, arg) + } + return from(this, arg, encodingOrOffset, length) +} + +Buffer.poolSize = 8192 // not used by this implementation + +// TODO: Legacy, not needed anymore. Remove in next major version. +Buffer._augment = function (arr) { + arr.__proto__ = Buffer.prototype + return arr +} + +function from (that, value, encodingOrOffset, length) { + if (typeof value === 'number') { + throw new TypeError('"value" argument must not be a number') + } + + if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) { + return fromArrayBuffer(that, value, encodingOrOffset, length) + } + + if (typeof value === 'string') { + return fromString(that, value, encodingOrOffset) + } + + return fromObject(that, value) +} + +/** + * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError + * if value is a number. + * Buffer.from(str[, encoding]) + * Buffer.from(array) + * Buffer.from(buffer) + * Buffer.from(arrayBuffer[, byteOffset[, length]]) + **/ +Buffer.from = function (value, encodingOrOffset, length) { + return from(null, value, encodingOrOffset, length) +} + +if (Buffer.TYPED_ARRAY_SUPPORT) { + Buffer.prototype.__proto__ = Uint8Array.prototype + Buffer.__proto__ = Uint8Array + if (typeof Symbol !== 'undefined' && Symbol.species && + Buffer[Symbol.species] === Buffer) { + // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97 + Object.defineProperty(Buffer, Symbol.species, { + value: null, + configurable: true + }) + } +} + +function assertSize (size) { + if (typeof size !== 'number') { + throw new TypeError('"size" argument must be a number') + } else if (size < 0) { + throw new RangeError('"size" argument must not be negative') + } +} + +function alloc (that, size, fill, encoding) { + assertSize(size) + if (size <= 0) { + return createBuffer(that, size) + } + if (fill !== undefined) { + // Only pay attention to encoding if it's a string. This + // prevents accidentally sending in a number that would + // be interpretted as a start offset. + return typeof encoding === 'string' + ? createBuffer(that, size).fill(fill, encoding) + : createBuffer(that, size).fill(fill) + } + return createBuffer(that, size) +} + +/** + * Creates a new filled Buffer instance. + * alloc(size[, fill[, encoding]]) + **/ +Buffer.alloc = function (size, fill, encoding) { + return alloc(null, size, fill, encoding) +} + +function allocUnsafe (that, size) { + assertSize(size) + that = createBuffer(that, size < 0 ? 0 : checked(size) | 0) + if (!Buffer.TYPED_ARRAY_SUPPORT) { + for (var i = 0; i < size; ++i) { + that[i] = 0 + } + } + return that +} + +/** + * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance. + * */ +Buffer.allocUnsafe = function (size) { + return allocUnsafe(null, size) +} +/** + * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance. + */ +Buffer.allocUnsafeSlow = function (size) { + return allocUnsafe(null, size) +} + +function fromString (that, string, encoding) { + if (typeof encoding !== 'string' || encoding === '') { + encoding = 'utf8' + } + + if (!Buffer.isEncoding(encoding)) { + throw new TypeError('"encoding" must be a valid string encoding') + } + + var length = byteLength(string, encoding) | 0 + that = createBuffer(that, length) + + var actual = that.write(string, encoding) + + if (actual !== length) { + // Writing a hex string, for example, that contains invalid characters will + // cause everything after the first invalid character to be ignored. (e.g. + // 'abxxcd' will be treated as 'ab') + that = that.slice(0, actual) + } + + return that +} + +function fromArrayLike (that, array) { + var length = array.length < 0 ? 0 : checked(array.length) | 0 + that = createBuffer(that, length) + for (var i = 0; i < length; i += 1) { + that[i] = array[i] & 255 + } + return that +} + +function fromArrayBuffer (that, array, byteOffset, length) { + array.byteLength // this throws if `array` is not a valid ArrayBuffer + + if (byteOffset < 0 || array.byteLength < byteOffset) { + throw new RangeError('\'offset\' is out of bounds') + } + + if (array.byteLength < byteOffset + (length || 0)) { + throw new RangeError('\'length\' is out of bounds') + } + + if (byteOffset === undefined && length === undefined) { + array = new Uint8Array(array) + } else if (length === undefined) { + array = new Uint8Array(array, byteOffset) + } else { + array = new Uint8Array(array, byteOffset, length) + } + + if (Buffer.TYPED_ARRAY_SUPPORT) { + // Return an augmented `Uint8Array` instance, for best performance + that = array + that.__proto__ = Buffer.prototype + } else { + // Fallback: Return an object instance of the Buffer class + that = fromArrayLike(that, array) + } + return that +} + +function fromObject (that, obj) { + if (Buffer.isBuffer(obj)) { + var len = checked(obj.length) | 0 + that = createBuffer(that, len) + + if (that.length === 0) { + return that + } + + obj.copy(that, 0, 0, len) + return that + } + + if (obj) { + if ((typeof ArrayBuffer !== 'undefined' && + obj.buffer instanceof ArrayBuffer) || 'length' in obj) { + if (typeof obj.length !== 'number' || isnan(obj.length)) { + return createBuffer(that, 0) + } + return fromArrayLike(that, obj) + } + + if (obj.type === 'Buffer' && isArray(obj.data)) { + return fromArrayLike(that, obj.data) + } + } + + throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.') +} + +function checked (length) { + // Note: cannot use `length < kMaxLength()` here because that fails when + // length is NaN (which is otherwise coerced to zero.) + if (length >= kMaxLength()) { + throw new RangeError('Attempt to allocate Buffer larger than maximum ' + + 'size: 0x' + kMaxLength().toString(16) + ' bytes') + } + return length | 0 +} + +function SlowBuffer (length) { + if (+length != length) { // eslint-disable-line eqeqeq + length = 0 + } + return Buffer.alloc(+length) +} + +Buffer.isBuffer = function isBuffer (b) { + return !!(b != null && b._isBuffer) +} + +Buffer.compare = function compare (a, b) { + if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) { + throw new TypeError('Arguments must be Buffers') + } + + if (a === b) return 0 + + var x = a.length + var y = b.length + + for (var i = 0, len = Math.min(x, y); i < len; ++i) { + if (a[i] !== b[i]) { + x = a[i] + y = b[i] + break + } + } + + if (x < y) return -1 + if (y < x) return 1 + return 0 +} + +Buffer.isEncoding = function isEncoding (encoding) { + switch (String(encoding).toLowerCase()) { + case 'hex': + case 'utf8': + case 'utf-8': + case 'ascii': + case 'latin1': + case 'binary': + case 'base64': + case 'ucs2': + case 'ucs-2': + case 'utf16le': + case 'utf-16le': + return true + default: + return false + } +} + +Buffer.concat = function concat (list, length) { + if (!isArray(list)) { + throw new TypeError('"list" argument must be an Array of Buffers') + } + + if (list.length === 0) { + return Buffer.alloc(0) + } + + var i + if (length === undefined) { + length = 0 + for (i = 0; i < list.length; ++i) { + length += list[i].length + } + } + + var buffer = Buffer.allocUnsafe(length) + var pos = 0 + for (i = 0; i < list.length; ++i) { + var buf = list[i] + if (!Buffer.isBuffer(buf)) { + throw new TypeError('"list" argument must be an Array of Buffers') + } + buf.copy(buffer, pos) + pos += buf.length + } + return buffer +} + +function byteLength (string, encoding) { + if (Buffer.isBuffer(string)) { + return string.length + } + if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' && + (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) { + return string.byteLength + } + if (typeof string !== 'string') { + string = '' + string + } + + var len = string.length + if (len === 0) return 0 + + // Use a for loop to avoid recursion + var loweredCase = false + for (;;) { + switch (encoding) { + case 'ascii': + case 'latin1': + case 'binary': + return len + case 'utf8': + case 'utf-8': + case undefined: + return utf8ToBytes(string).length + case 'ucs2': + case 'ucs-2': + case 'utf16le': + case 'utf-16le': + return len * 2 + case 'hex': + return len >>> 1 + case 'base64': + return base64ToBytes(string).length + default: + if (loweredCase) return utf8ToBytes(string).length // assume utf8 + encoding = ('' + encoding).toLowerCase() + loweredCase = true + } + } +} +Buffer.byteLength = byteLength + +function slowToString (encoding, start, end) { + var loweredCase = false + + // No need to verify that "this.length <= MAX_UINT32" since it's a read-only + // property of a typed array. + + // This behaves neither like String nor Uint8Array in that we set start/end + // to their upper/lower bounds if the value passed is out of range. + // undefined is handled specially as per ECMA-262 6th Edition, + // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization. + if (start === undefined || start < 0) { + start = 0 + } + // Return early if start > this.length. Done here to prevent potential uint32 + // coercion fail below. + if (start > this.length) { + return '' + } + + if (end === undefined || end > this.length) { + end = this.length + } + + if (end <= 0) { + return '' + } + + // Force coersion to uint32. This will also coerce falsey/NaN values to 0. + end >>>= 0 + start >>>= 0 + + if (end <= start) { + return '' + } + + if (!encoding) encoding = 'utf8' + + while (true) { + switch (encoding) { + case 'hex': + return hexSlice(this, start, end) + + case 'utf8': + case 'utf-8': + return utf8Slice(this, start, end) + + case 'ascii': + return asciiSlice(this, start, end) + + case 'latin1': + case 'binary': + return latin1Slice(this, start, end) + + case 'base64': + return base64Slice(this, start, end) + + case 'ucs2': + case 'ucs-2': + case 'utf16le': + case 'utf-16le': + return utf16leSlice(this, start, end) + + default: + if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding) + encoding = (encoding + '').toLowerCase() + loweredCase = true + } + } +} + +// The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect +// Buffer instances. +Buffer.prototype._isBuffer = true + +function swap (b, n, m) { + var i = b[n] + b[n] = b[m] + b[m] = i +} + +Buffer.prototype.swap16 = function swap16 () { + var len = this.length + if (len % 2 !== 0) { + throw new RangeError('Buffer size must be a multiple of 16-bits') + } + for (var i = 0; i < len; i += 2) { + swap(this, i, i + 1) + } + return this +} + +Buffer.prototype.swap32 = function swap32 () { + var len = this.length + if (len % 4 !== 0) { + throw new RangeError('Buffer size must be a multiple of 32-bits') + } + for (var i = 0; i < len; i += 4) { + swap(this, i, i + 3) + swap(this, i + 1, i + 2) + } + return this +} + +Buffer.prototype.swap64 = function swap64 () { + var len = this.length + if (len % 8 !== 0) { + throw new RangeError('Buffer size must be a multiple of 64-bits') + } + for (var i = 0; i < len; i += 8) { + swap(this, i, i + 7) + swap(this, i + 1, i + 6) + swap(this, i + 2, i + 5) + swap(this, i + 3, i + 4) + } + return this +} + +Buffer.prototype.toString = function toString () { + var length = this.length | 0 + if (length === 0) return '' + if (arguments.length === 0) return utf8Slice(this, 0, length) + return slowToString.apply(this, arguments) +} + +Buffer.prototype.equals = function equals (b) { + if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer') + if (this === b) return true + return Buffer.compare(this, b) === 0 +} + +Buffer.prototype.inspect = function inspect () { + var str = '' + var max = exports.INSPECT_MAX_BYTES + if (this.length > 0) { + str = this.toString('hex', 0, max).match(/.{2}/g).join(' ') + if (this.length > max) str += ' ... ' + } + return '' +} + +Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) { + if (!Buffer.isBuffer(target)) { + throw new TypeError('Argument must be a Buffer') + } + + if (start === undefined) { + start = 0 + } + if (end === undefined) { + end = target ? target.length : 0 + } + if (thisStart === undefined) { + thisStart = 0 + } + if (thisEnd === undefined) { + thisEnd = this.length + } + + if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) { + throw new RangeError('out of range index') + } + + if (thisStart >= thisEnd && start >= end) { + return 0 + } + if (thisStart >= thisEnd) { + return -1 + } + if (start >= end) { + return 1 + } + + start >>>= 0 + end >>>= 0 + thisStart >>>= 0 + thisEnd >>>= 0 + + if (this === target) return 0 + + var x = thisEnd - thisStart + var y = end - start + var len = Math.min(x, y) + + var thisCopy = this.slice(thisStart, thisEnd) + var targetCopy = target.slice(start, end) + + for (var i = 0; i < len; ++i) { + if (thisCopy[i] !== targetCopy[i]) { + x = thisCopy[i] + y = targetCopy[i] + break + } + } + + if (x < y) return -1 + if (y < x) return 1 + return 0 +} + +// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`, +// OR the last index of `val` in `buffer` at offset <= `byteOffset`. +// +// Arguments: +// - buffer - a Buffer to search +// - val - a string, Buffer, or number +// - byteOffset - an index into `buffer`; will be clamped to an int32 +// - encoding - an optional encoding, relevant is val is a string +// - dir - true for indexOf, false for lastIndexOf +function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) { + // Empty buffer means no match + if (buffer.length === 0) return -1 + + // Normalize byteOffset + if (typeof byteOffset === 'string') { + encoding = byteOffset + byteOffset = 0 + } else if (byteOffset > 0x7fffffff) { + byteOffset = 0x7fffffff + } else if (byteOffset < -0x80000000) { + byteOffset = -0x80000000 + } + byteOffset = +byteOffset // Coerce to Number. + if (isNaN(byteOffset)) { + // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer + byteOffset = dir ? 0 : (buffer.length - 1) + } + + // Normalize byteOffset: negative offsets start from the end of the buffer + if (byteOffset < 0) byteOffset = buffer.length + byteOffset + if (byteOffset >= buffer.length) { + if (dir) return -1 + else byteOffset = buffer.length - 1 + } else if (byteOffset < 0) { + if (dir) byteOffset = 0 + else return -1 + } + + // Normalize val + if (typeof val === 'string') { + val = Buffer.from(val, encoding) + } + + // Finally, search either indexOf (if dir is true) or lastIndexOf + if (Buffer.isBuffer(val)) { + // Special case: looking for empty string/buffer always fails + if (val.length === 0) { + return -1 + } + return arrayIndexOf(buffer, val, byteOffset, encoding, dir) + } else if (typeof val === 'number') { + val = val & 0xFF // Search for a byte value [0-255] + if (Buffer.TYPED_ARRAY_SUPPORT && + typeof Uint8Array.prototype.indexOf === 'function') { + if (dir) { + return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset) + } else { + return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset) + } + } + return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir) + } + + throw new TypeError('val must be string, number or Buffer') +} + +function arrayIndexOf (arr, val, byteOffset, encoding, dir) { + var indexSize = 1 + var arrLength = arr.length + var valLength = val.length + + if (encoding !== undefined) { + encoding = String(encoding).toLowerCase() + if (encoding === 'ucs2' || encoding === 'ucs-2' || + encoding === 'utf16le' || encoding === 'utf-16le') { + if (arr.length < 2 || val.length < 2) { + return -1 + } + indexSize = 2 + arrLength /= 2 + valLength /= 2 + byteOffset /= 2 + } + } + + function read (buf, i) { + if (indexSize === 1) { + return buf[i] + } else { + return buf.readUInt16BE(i * indexSize) + } + } + + var i + if (dir) { + var foundIndex = -1 + for (i = byteOffset; i < arrLength; i++) { + if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) { + if (foundIndex === -1) foundIndex = i + if (i - foundIndex + 1 === valLength) return foundIndex * indexSize + } else { + if (foundIndex !== -1) i -= i - foundIndex + foundIndex = -1 + } + } + } else { + if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength + for (i = byteOffset; i >= 0; i--) { + var found = true + for (var j = 0; j < valLength; j++) { + if (read(arr, i + j) !== read(val, j)) { + found = false + break + } + } + if (found) return i + } + } + + return -1 +} + +Buffer.prototype.includes = function includes (val, byteOffset, encoding) { + return this.indexOf(val, byteOffset, encoding) !== -1 +} + +Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) { + return bidirectionalIndexOf(this, val, byteOffset, encoding, true) +} + +Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) { + return bidirectionalIndexOf(this, val, byteOffset, encoding, false) +} + +function hexWrite (buf, string, offset, length) { + offset = Number(offset) || 0 + var remaining = buf.length - offset + if (!length) { + length = remaining + } else { + length = Number(length) + if (length > remaining) { + length = remaining + } + } + + // must be an even number of digits + var strLen = string.length + if (strLen % 2 !== 0) throw new TypeError('Invalid hex string') + + if (length > strLen / 2) { + length = strLen / 2 + } + for (var i = 0; i < length; ++i) { + var parsed = parseInt(string.substr(i * 2, 2), 16) + if (isNaN(parsed)) return i + buf[offset + i] = parsed + } + return i +} + +function utf8Write (buf, string, offset, length) { + return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length) +} + +function asciiWrite (buf, string, offset, length) { + return blitBuffer(asciiToBytes(string), buf, offset, length) +} + +function latin1Write (buf, string, offset, length) { + return asciiWrite(buf, string, offset, length) +} + +function base64Write (buf, string, offset, length) { + return blitBuffer(base64ToBytes(string), buf, offset, length) +} + +function ucs2Write (buf, string, offset, length) { + return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length) +} + +Buffer.prototype.write = function write (string, offset, length, encoding) { + // Buffer#write(string) + if (offset === undefined) { + encoding = 'utf8' + length = this.length + offset = 0 + // Buffer#write(string, encoding) + } else if (length === undefined && typeof offset === 'string') { + encoding = offset + length = this.length + offset = 0 + // Buffer#write(string, offset[, length][, encoding]) + } else if (isFinite(offset)) { + offset = offset | 0 + if (isFinite(length)) { + length = length | 0 + if (encoding === undefined) encoding = 'utf8' + } else { + encoding = length + length = undefined + } + // legacy write(string, encoding, offset, length) - remove in v0.13 + } else { + throw new Error( + 'Buffer.write(string, encoding, offset[, length]) is no longer supported' + ) + } + + var remaining = this.length - offset + if (length === undefined || length > remaining) length = remaining + + if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) { + throw new RangeError('Attempt to write outside buffer bounds') + } + + if (!encoding) encoding = 'utf8' + + var loweredCase = false + for (;;) { + switch (encoding) { + case 'hex': + return hexWrite(this, string, offset, length) + + case 'utf8': + case 'utf-8': + return utf8Write(this, string, offset, length) + + case 'ascii': + return asciiWrite(this, string, offset, length) + + case 'latin1': + case 'binary': + return latin1Write(this, string, offset, length) + + case 'base64': + // Warning: maxLength not taken into account in base64Write + return base64Write(this, string, offset, length) + + case 'ucs2': + case 'ucs-2': + case 'utf16le': + case 'utf-16le': + return ucs2Write(this, string, offset, length) + + default: + if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding) + encoding = ('' + encoding).toLowerCase() + loweredCase = true + } + } +} + +Buffer.prototype.toJSON = function toJSON () { + return { + type: 'Buffer', + data: Array.prototype.slice.call(this._arr || this, 0) + } +} + +function base64Slice (buf, start, end) { + if (start === 0 && end === buf.length) { + return base64.fromByteArray(buf) + } else { + return base64.fromByteArray(buf.slice(start, end)) + } +} + +function utf8Slice (buf, start, end) { + end = Math.min(buf.length, end) + var res = [] + + var i = start + while (i < end) { + var firstByte = buf[i] + var codePoint = null + var bytesPerSequence = (firstByte > 0xEF) ? 4 + : (firstByte > 0xDF) ? 3 + : (firstByte > 0xBF) ? 2 + : 1 + + if (i + bytesPerSequence <= end) { + var secondByte, thirdByte, fourthByte, tempCodePoint + + switch (bytesPerSequence) { + case 1: + if (firstByte < 0x80) { + codePoint = firstByte + } + break + case 2: + secondByte = buf[i + 1] + if ((secondByte & 0xC0) === 0x80) { + tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F) + if (tempCodePoint > 0x7F) { + codePoint = tempCodePoint + } + } + break + case 3: + secondByte = buf[i + 1] + thirdByte = buf[i + 2] + if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) { + tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F) + if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) { + codePoint = tempCodePoint + } + } + break + case 4: + secondByte = buf[i + 1] + thirdByte = buf[i + 2] + fourthByte = buf[i + 3] + if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) { + tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F) + if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) { + codePoint = tempCodePoint + } + } + } + } + + if (codePoint === null) { + // we did not generate a valid codePoint so insert a + // replacement char (U+FFFD) and advance only 1 byte + codePoint = 0xFFFD + bytesPerSequence = 1 + } else if (codePoint > 0xFFFF) { + // encode to utf16 (surrogate pair dance) + codePoint -= 0x10000 + res.push(codePoint >>> 10 & 0x3FF | 0xD800) + codePoint = 0xDC00 | codePoint & 0x3FF + } + + res.push(codePoint) + i += bytesPerSequence + } + + return decodeCodePointsArray(res) +} + +// Based on http://stackoverflow.com/a/22747272/680742, the browser with +// the lowest limit is Chrome, with 0x10000 args. +// We go 1 magnitude less, for safety +var MAX_ARGUMENTS_LENGTH = 0x1000 + +function decodeCodePointsArray (codePoints) { + var len = codePoints.length + if (len <= MAX_ARGUMENTS_LENGTH) { + return String.fromCharCode.apply(String, codePoints) // avoid extra slice() + } + + // Decode in chunks to avoid "call stack size exceeded". + var res = '' + var i = 0 + while (i < len) { + res += String.fromCharCode.apply( + String, + codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH) + ) + } + return res +} + +function asciiSlice (buf, start, end) { + var ret = '' + end = Math.min(buf.length, end) + + for (var i = start; i < end; ++i) { + ret += String.fromCharCode(buf[i] & 0x7F) + } + return ret +} + +function latin1Slice (buf, start, end) { + var ret = '' + end = Math.min(buf.length, end) + + for (var i = start; i < end; ++i) { + ret += String.fromCharCode(buf[i]) + } + return ret +} + +function hexSlice (buf, start, end) { + var len = buf.length + + if (!start || start < 0) start = 0 + if (!end || end < 0 || end > len) end = len + + var out = '' + for (var i = start; i < end; ++i) { + out += toHex(buf[i]) + } + return out +} + +function utf16leSlice (buf, start, end) { + var bytes = buf.slice(start, end) + var res = '' + for (var i = 0; i < bytes.length; i += 2) { + res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256) + } + return res +} + +Buffer.prototype.slice = function slice (start, end) { + var len = this.length + start = ~~start + end = end === undefined ? len : ~~end + + if (start < 0) { + start += len + if (start < 0) start = 0 + } else if (start > len) { + start = len + } + + if (end < 0) { + end += len + if (end < 0) end = 0 + } else if (end > len) { + end = len + } + + if (end < start) end = start + + var newBuf + if (Buffer.TYPED_ARRAY_SUPPORT) { + newBuf = this.subarray(start, end) + newBuf.__proto__ = Buffer.prototype + } else { + var sliceLen = end - start + newBuf = new Buffer(sliceLen, undefined) + for (var i = 0; i < sliceLen; ++i) { + newBuf[i] = this[i + start] + } + } + + return newBuf +} + +/* + * Need to make sure that buffer isn't trying to write out of bounds. + */ +function checkOffset (offset, ext, length) { + if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint') + if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length') +} + +Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) { + offset = offset | 0 + byteLength = byteLength | 0 + if (!noAssert) checkOffset(offset, byteLength, this.length) + + var val = this[offset] + var mul = 1 + var i = 0 + while (++i < byteLength && (mul *= 0x100)) { + val += this[offset + i] * mul + } + + return val +} + +Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) { + offset = offset | 0 + byteLength = byteLength | 0 + if (!noAssert) { + checkOffset(offset, byteLength, this.length) + } + + var val = this[offset + --byteLength] + var mul = 1 + while (byteLength > 0 && (mul *= 0x100)) { + val += this[offset + --byteLength] * mul + } + + return val +} + +Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) { + if (!noAssert) checkOffset(offset, 1, this.length) + return this[offset] +} + +Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) { + if (!noAssert) checkOffset(offset, 2, this.length) + return this[offset] | (this[offset + 1] << 8) +} + +Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) { + if (!noAssert) checkOffset(offset, 2, this.length) + return (this[offset] << 8) | this[offset + 1] +} + +Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) { + if (!noAssert) checkOffset(offset, 4, this.length) + + return ((this[offset]) | + (this[offset + 1] << 8) | + (this[offset + 2] << 16)) + + (this[offset + 3] * 0x1000000) +} + +Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) { + if (!noAssert) checkOffset(offset, 4, this.length) + + return (this[offset] * 0x1000000) + + ((this[offset + 1] << 16) | + (this[offset + 2] << 8) | + this[offset + 3]) +} + +Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) { + offset = offset | 0 + byteLength = byteLength | 0 + if (!noAssert) checkOffset(offset, byteLength, this.length) + + var val = this[offset] + var mul = 1 + var i = 0 + while (++i < byteLength && (mul *= 0x100)) { + val += this[offset + i] * mul + } + mul *= 0x80 + + if (val >= mul) val -= Math.pow(2, 8 * byteLength) + + return val +} + +Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) { + offset = offset | 0 + byteLength = byteLength | 0 + if (!noAssert) checkOffset(offset, byteLength, this.length) + + var i = byteLength + var mul = 1 + var val = this[offset + --i] + while (i > 0 && (mul *= 0x100)) { + val += this[offset + --i] * mul + } + mul *= 0x80 + + if (val >= mul) val -= Math.pow(2, 8 * byteLength) + + return val +} + +Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) { + if (!noAssert) checkOffset(offset, 1, this.length) + if (!(this[offset] & 0x80)) return (this[offset]) + return ((0xff - this[offset] + 1) * -1) +} + +Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) { + if (!noAssert) checkOffset(offset, 2, this.length) + var val = this[offset] | (this[offset + 1] << 8) + return (val & 0x8000) ? val | 0xFFFF0000 : val +} + +Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) { + if (!noAssert) checkOffset(offset, 2, this.length) + var val = this[offset + 1] | (this[offset] << 8) + return (val & 0x8000) ? val | 0xFFFF0000 : val +} + +Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) { + if (!noAssert) checkOffset(offset, 4, this.length) + + return (this[offset]) | + (this[offset + 1] << 8) | + (this[offset + 2] << 16) | + (this[offset + 3] << 24) +} + +Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) { + if (!noAssert) checkOffset(offset, 4, this.length) + + return (this[offset] << 24) | + (this[offset + 1] << 16) | + (this[offset + 2] << 8) | + (this[offset + 3]) +} + +Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) { + if (!noAssert) checkOffset(offset, 4, this.length) + return ieee754.read(this, offset, true, 23, 4) +} + +Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) { + if (!noAssert) checkOffset(offset, 4, this.length) + return ieee754.read(this, offset, false, 23, 4) +} + +Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) { + if (!noAssert) checkOffset(offset, 8, this.length) + return ieee754.read(this, offset, true, 52, 8) +} + +Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) { + if (!noAssert) checkOffset(offset, 8, this.length) + return ieee754.read(this, offset, false, 52, 8) +} + +function checkInt (buf, value, offset, ext, max, min) { + if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance') + if (value > max || value < min) throw new RangeError('"value" argument is out of bounds') + if (offset + ext > buf.length) throw new RangeError('Index out of range') +} + +Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) { + value = +value + offset = offset | 0 + byteLength = byteLength | 0 + if (!noAssert) { + var maxBytes = Math.pow(2, 8 * byteLength) - 1 + checkInt(this, value, offset, byteLength, maxBytes, 0) + } + + var mul = 1 + var i = 0 + this[offset] = value & 0xFF + while (++i < byteLength && (mul *= 0x100)) { + this[offset + i] = (value / mul) & 0xFF + } + + return offset + byteLength +} + +Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) { + value = +value + offset = offset | 0 + byteLength = byteLength | 0 + if (!noAssert) { + var maxBytes = Math.pow(2, 8 * byteLength) - 1 + checkInt(this, value, offset, byteLength, maxBytes, 0) + } + + var i = byteLength - 1 + var mul = 1 + this[offset + i] = value & 0xFF + while (--i >= 0 && (mul *= 0x100)) { + this[offset + i] = (value / mul) & 0xFF + } + + return offset + byteLength +} + +Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) { + value = +value + offset = offset | 0 + if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0) + if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value) + this[offset] = (value & 0xff) + return offset + 1 +} + +function objectWriteUInt16 (buf, value, offset, littleEndian) { + if (value < 0) value = 0xffff + value + 1 + for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) { + buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>> + (littleEndian ? i : 1 - i) * 8 + } +} + +Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) { + value = +value + offset = offset | 0 + if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0) + if (Buffer.TYPED_ARRAY_SUPPORT) { + this[offset] = (value & 0xff) + this[offset + 1] = (value >>> 8) + } else { + objectWriteUInt16(this, value, offset, true) + } + return offset + 2 +} + +Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) { + value = +value + offset = offset | 0 + if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0) + if (Buffer.TYPED_ARRAY_SUPPORT) { + this[offset] = (value >>> 8) + this[offset + 1] = (value & 0xff) + } else { + objectWriteUInt16(this, value, offset, false) + } + return offset + 2 +} + +function objectWriteUInt32 (buf, value, offset, littleEndian) { + if (value < 0) value = 0xffffffff + value + 1 + for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) { + buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff + } +} + +Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) { + value = +value + offset = offset | 0 + if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0) + if (Buffer.TYPED_ARRAY_SUPPORT) { + this[offset + 3] = (value >>> 24) + this[offset + 2] = (value >>> 16) + this[offset + 1] = (value >>> 8) + this[offset] = (value & 0xff) + } else { + objectWriteUInt32(this, value, offset, true) + } + return offset + 4 +} + +Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) { + value = +value + offset = offset | 0 + if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0) + if (Buffer.TYPED_ARRAY_SUPPORT) { + this[offset] = (value >>> 24) + this[offset + 1] = (value >>> 16) + this[offset + 2] = (value >>> 8) + this[offset + 3] = (value & 0xff) + } else { + objectWriteUInt32(this, value, offset, false) + } + return offset + 4 +} + +Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) { + value = +value + offset = offset | 0 + if (!noAssert) { + var limit = Math.pow(2, 8 * byteLength - 1) + + checkInt(this, value, offset, byteLength, limit - 1, -limit) + } + + var i = 0 + var mul = 1 + var sub = 0 + this[offset] = value & 0xFF + while (++i < byteLength && (mul *= 0x100)) { + if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) { + sub = 1 + } + this[offset + i] = ((value / mul) >> 0) - sub & 0xFF + } + + return offset + byteLength +} + +Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) { + value = +value + offset = offset | 0 + if (!noAssert) { + var limit = Math.pow(2, 8 * byteLength - 1) + + checkInt(this, value, offset, byteLength, limit - 1, -limit) + } + + var i = byteLength - 1 + var mul = 1 + var sub = 0 + this[offset + i] = value & 0xFF + while (--i >= 0 && (mul *= 0x100)) { + if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) { + sub = 1 + } + this[offset + i] = ((value / mul) >> 0) - sub & 0xFF + } + + return offset + byteLength +} + +Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) { + value = +value + offset = offset | 0 + if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80) + if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value) + if (value < 0) value = 0xff + value + 1 + this[offset] = (value & 0xff) + return offset + 1 +} + +Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) { + value = +value + offset = offset | 0 + if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000) + if (Buffer.TYPED_ARRAY_SUPPORT) { + this[offset] = (value & 0xff) + this[offset + 1] = (value >>> 8) + } else { + objectWriteUInt16(this, value, offset, true) + } + return offset + 2 +} + +Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) { + value = +value + offset = offset | 0 + if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000) + if (Buffer.TYPED_ARRAY_SUPPORT) { + this[offset] = (value >>> 8) + this[offset + 1] = (value & 0xff) + } else { + objectWriteUInt16(this, value, offset, false) + } + return offset + 2 +} + +Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) { + value = +value + offset = offset | 0 + if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000) + if (Buffer.TYPED_ARRAY_SUPPORT) { + this[offset] = (value & 0xff) + this[offset + 1] = (value >>> 8) + this[offset + 2] = (value >>> 16) + this[offset + 3] = (value >>> 24) + } else { + objectWriteUInt32(this, value, offset, true) + } + return offset + 4 +} + +Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) { + value = +value + offset = offset | 0 + if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000) + if (value < 0) value = 0xffffffff + value + 1 + if (Buffer.TYPED_ARRAY_SUPPORT) { + this[offset] = (value >>> 24) + this[offset + 1] = (value >>> 16) + this[offset + 2] = (value >>> 8) + this[offset + 3] = (value & 0xff) + } else { + objectWriteUInt32(this, value, offset, false) + } + return offset + 4 +} + +function checkIEEE754 (buf, value, offset, ext, max, min) { + if (offset + ext > buf.length) throw new RangeError('Index out of range') + if (offset < 0) throw new RangeError('Index out of range') +} + +function writeFloat (buf, value, offset, littleEndian, noAssert) { + if (!noAssert) { + checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38) + } + ieee754.write(buf, value, offset, littleEndian, 23, 4) + return offset + 4 +} + +Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) { + return writeFloat(this, value, offset, true, noAssert) +} + +Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) { + return writeFloat(this, value, offset, false, noAssert) +} + +function writeDouble (buf, value, offset, littleEndian, noAssert) { + if (!noAssert) { + checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308) + } + ieee754.write(buf, value, offset, littleEndian, 52, 8) + return offset + 8 +} + +Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) { + return writeDouble(this, value, offset, true, noAssert) +} + +Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) { + return writeDouble(this, value, offset, false, noAssert) +} + +// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length) +Buffer.prototype.copy = function copy (target, targetStart, start, end) { + if (!start) start = 0 + if (!end && end !== 0) end = this.length + if (targetStart >= target.length) targetStart = target.length + if (!targetStart) targetStart = 0 + if (end > 0 && end < start) end = start + + // Copy 0 bytes; we're done + if (end === start) return 0 + if (target.length === 0 || this.length === 0) return 0 + + // Fatal error conditions + if (targetStart < 0) { + throw new RangeError('targetStart out of bounds') + } + if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds') + if (end < 0) throw new RangeError('sourceEnd out of bounds') + + // Are we oob? + if (end > this.length) end = this.length + if (target.length - targetStart < end - start) { + end = target.length - targetStart + start + } + + var len = end - start + var i + + if (this === target && start < targetStart && targetStart < end) { + // descending copy from end + for (i = len - 1; i >= 0; --i) { + target[i + targetStart] = this[i + start] + } + } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) { + // ascending copy from start + for (i = 0; i < len; ++i) { + target[i + targetStart] = this[i + start] + } + } else { + Uint8Array.prototype.set.call( + target, + this.subarray(start, start + len), + targetStart + ) + } + + return len +} + +// Usage: +// buffer.fill(number[, offset[, end]]) +// buffer.fill(buffer[, offset[, end]]) +// buffer.fill(string[, offset[, end]][, encoding]) +Buffer.prototype.fill = function fill (val, start, end, encoding) { + // Handle string cases: + if (typeof val === 'string') { + if (typeof start === 'string') { + encoding = start + start = 0 + end = this.length + } else if (typeof end === 'string') { + encoding = end + end = this.length + } + if (val.length === 1) { + var code = val.charCodeAt(0) + if (code < 256) { + val = code + } + } + if (encoding !== undefined && typeof encoding !== 'string') { + throw new TypeError('encoding must be a string') + } + if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) { + throw new TypeError('Unknown encoding: ' + encoding) + } + } else if (typeof val === 'number') { + val = val & 255 + } + + // Invalid ranges are not set to a default, so can range check early. + if (start < 0 || this.length < start || this.length < end) { + throw new RangeError('Out of range index') + } + + if (end <= start) { + return this + } + + start = start >>> 0 + end = end === undefined ? this.length : end >>> 0 + + if (!val) val = 0 + + var i + if (typeof val === 'number') { + for (i = start; i < end; ++i) { + this[i] = val + } + } else { + var bytes = Buffer.isBuffer(val) + ? val + : utf8ToBytes(new Buffer(val, encoding).toString()) + var len = bytes.length + for (i = 0; i < end - start; ++i) { + this[i + start] = bytes[i % len] + } + } + + return this +} + +// HELPER FUNCTIONS +// ================ + +var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g + +function base64clean (str) { + // Node strips out invalid characters like \n and \t from the string, base64-js does not + str = stringtrim(str).replace(INVALID_BASE64_RE, '') + // Node converts strings with length < 2 to '' + if (str.length < 2) return '' + // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not + while (str.length % 4 !== 0) { + str = str + '=' + } + return str +} + +function stringtrim (str) { + if (str.trim) return str.trim() + return str.replace(/^\s+|\s+$/g, '') +} + +function toHex (n) { + if (n < 16) return '0' + n.toString(16) + return n.toString(16) +} + +function utf8ToBytes (string, units) { + units = units || Infinity + var codePoint + var length = string.length + var leadSurrogate = null + var bytes = [] + + for (var i = 0; i < length; ++i) { + codePoint = string.charCodeAt(i) + + // is surrogate component + if (codePoint > 0xD7FF && codePoint < 0xE000) { + // last char was a lead + if (!leadSurrogate) { + // no lead yet + if (codePoint > 0xDBFF) { + // unexpected trail + if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) + continue + } else if (i + 1 === length) { + // unpaired lead + if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) + continue + } + + // valid lead + leadSurrogate = codePoint + + continue + } + + // 2 leads in a row + if (codePoint < 0xDC00) { + if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) + leadSurrogate = codePoint + continue + } + + // valid surrogate pair + codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000 + } else if (leadSurrogate) { + // valid bmp char, but last char was a lead + if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) + } + + leadSurrogate = null + + // encode utf8 + if (codePoint < 0x80) { + if ((units -= 1) < 0) break + bytes.push(codePoint) + } else if (codePoint < 0x800) { + if ((units -= 2) < 0) break + bytes.push( + codePoint >> 0x6 | 0xC0, + codePoint & 0x3F | 0x80 + ) + } else if (codePoint < 0x10000) { + if ((units -= 3) < 0) break + bytes.push( + codePoint >> 0xC | 0xE0, + codePoint >> 0x6 & 0x3F | 0x80, + codePoint & 0x3F | 0x80 + ) + } else if (codePoint < 0x110000) { + if ((units -= 4) < 0) break + bytes.push( + codePoint >> 0x12 | 0xF0, + codePoint >> 0xC & 0x3F | 0x80, + codePoint >> 0x6 & 0x3F | 0x80, + codePoint & 0x3F | 0x80 + ) + } else { + throw new Error('Invalid code point') + } + } + + return bytes +} + +function asciiToBytes (str) { + var byteArray = [] + for (var i = 0; i < str.length; ++i) { + // Node's code seems to be doing this and not & 0x7F.. + byteArray.push(str.charCodeAt(i) & 0xFF) + } + return byteArray +} + +function utf16leToBytes (str, units) { + var c, hi, lo + var byteArray = [] + for (var i = 0; i < str.length; ++i) { + if ((units -= 2) < 0) break + + c = str.charCodeAt(i) + hi = c >> 8 + lo = c % 256 + byteArray.push(lo) + byteArray.push(hi) + } + + return byteArray +} + +function base64ToBytes (str) { + return base64.toByteArray(base64clean(str)) +} + +function blitBuffer (src, dst, offset, length) { + for (var i = 0; i < length; ++i) { + if ((i + offset >= dst.length) || (i >= src.length)) break + dst[i + offset] = src[i] + } + return i +} + +function isnan (val) { + return val !== val // eslint-disable-line no-self-compare +} + +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer, __webpack_require__(16))) /***/ }, /* 1 */ -/***/ function(module, exports, __webpack_require__) { +/***/ function(module, exports) { - /* WEBPACK VAR INJECTION */(function(process) {const EventEmitter = __webpack_require__(3).EventEmitter; - const mergeDefault = __webpack_require__(4); - const Constants = __webpack_require__(5); - const RESTManager = __webpack_require__(7); - const ClientDataManager = __webpack_require__(45); - const ClientManager = __webpack_require__(56); - const ClientDataResolver = __webpack_require__(57); - const ClientVoiceManager = __webpack_require__(64); - const WebSocketManager = __webpack_require__(176); - const ActionsManager = __webpack_require__(216); - const Collection = __webpack_require__(10); - const Presence = __webpack_require__(24).Presence; - const ShardClientUtil = __webpack_require__(245); +if (typeof Object.create === 'function') { + // implementation from standard node.js 'util' module + module.exports = function inherits(ctor, superCtor) { + ctor.super_ = superCtor + ctor.prototype = Object.create(superCtor.prototype, { + constructor: { + value: ctor, + enumerable: false, + writable: true, + configurable: true + } + }); + }; +} else { + // old school shim for old browsers + module.exports = function inherits(ctor, superCtor) { + ctor.super_ = superCtor + var TempCtor = function () {} + TempCtor.prototype = superCtor.prototype + ctor.prototype = new TempCtor() + ctor.prototype.constructor = ctor + } +} - /** - * The starting point for making a Discord Bot. - * @extends {EventEmitter} - */ - class Client extends EventEmitter { - /** - * @param {ClientOptions} [options] Options for the client - */ - constructor(options = {}) { - super(); - - /** - * Whether the client is in a browser environment - * @type {boolean} - */ - this.browser = typeof window !== 'undefined'; - - // Obtain shard details from environment - if (!options.shardId && 'SHARD_ID' in process.env) options.shardId = Number(process.env.SHARD_ID); - if (!options.shardCount && 'SHARD_COUNT' in process.env) options.shardCount = Number(process.env.SHARD_COUNT); - - /** - * The options the client was instantiated with - * @type {ClientOptions} - */ - this.options = mergeDefault(Constants.DefaultOptions, options); - this._validateOptions(); - - /** - * The REST manager of the client - * @type {RESTManager} - * @private - */ - this.rest = new RESTManager(this); - - /** - * The data manager of the Client - * @type {ClientDataManager} - * @private - */ - this.dataManager = new ClientDataManager(this); - - /** - * The manager of the Client - * @type {ClientManager} - * @private - */ - this.manager = new ClientManager(this); - - /** - * The WebSocket Manager of the Client - * @type {WebSocketManager} - * @private - */ - this.ws = new WebSocketManager(this); - - /** - * The Data Resolver of the Client - * @type {ClientDataResolver} - * @private - */ - this.resolver = new ClientDataResolver(this); - - /** - * The Action Manager of the Client - * @type {ActionsManager} - * @private - */ - this.actions = new ActionsManager(this); - - /** - * The Voice Manager of the Client - * @type {ClientVoiceManager} - * @private - */ - this.voice = new ClientVoiceManager(this); - - /** - * The shard helpers for the client (only if the process was spawned as a child, such as from a ShardingManager) - * @type {?ShardClientUtil} - */ - this.shard = process.send ? ShardClientUtil.singleton(this) : null; - - /** - * A collection of the Client's stored users - * @type {Collection} - */ - this.users = new Collection(); - - /** - * A collection of the Client's stored guilds - * @type {Collection} - */ - this.guilds = new Collection(); - - /** - * A collection of the Client's stored channels - * @type {Collection} - */ - this.channels = new Collection(); - - /** - * A collection of presences for friends of the logged in user. - * This is only filled when using a user account. - * @type {Collection} - */ - this.presences = new Collection(); - - if (!this.token && 'CLIENT_TOKEN' in process.env) { - /** - * The authorization token for the logged in user/bot. - * @type {?string} - */ - this.token = process.env.CLIENT_TOKEN; - } else { - this.token = null; - } - - /** - * The email, if there is one, for the logged in Client - * @type {?string} - */ - this.email = null; - - /** - * The password, if there is one, for the logged in Client - * @type {?string} - */ - this.password = null; - - /** - * The ClientUser representing the logged in Client - * @type {?ClientUser} - */ - this.user = null; - - /** - * The date at which the Client was regarded as being in the `READY` state. - * @type {?Date} - */ - this.readyAt = null; - - this._timeouts = new Set(); - this._intervals = new Set(); - - if (this.options.messageSweepInterval > 0) { - this.setInterval(this.sweepMessages.bind(this), this.options.messageSweepInterval * 1000); - } - } - - /** - * The status for the logged in Client. - * @type {?number} - * @readonly - */ - get status() { - return this.ws.status; - } - - /** - * The uptime for the logged in Client. - * @type {?number} - * @readonly - */ - get uptime() { - return this.readyAt ? Date.now() - this.readyAt : null; - } - - /** - * Returns a collection, mapping guild ID to voice connections. - * @type {Collection} - * @readonly - */ - get voiceConnections() { - return this.voice.connections; - } - - /** - * The emojis that the client can use. Mapped by emoji ID. - * @type {Collection} - * @readonly - */ - get emojis() { - const emojis = new Collection(); - for (const guild of this.guilds.values()) { - for (const emoji of guild.emojis.values()) emojis.set(emoji.id, emoji); - } - return emojis; - } - - /** - * The timestamp that the client was last ready at - * @type {?number} - * @readonly - */ - get readyTimestamp() { - return this.readyAt ? this.readyAt.getTime() : null; - } - - /** - * Logs the client in. If successful, resolves with the account's token. If you're making a bot, it's - * much better to use a bot account rather than a user account. - * Bot accounts have higher rate limits and have access to some features user accounts don't have. User bots - * that are making a lot of API requests can even be banned. - * @param {string} tokenOrEmail The token or email used for the account. If it is an email, a password _must_ be - * provided. - * @param {string} [password] The password for the account, only needed if an email was provided. - * @returns {Promise} - * @example - * // log the client in using a token - * const token = 'my token'; - * client.login(token); - * @example - * // log the client in using email and password - * const email = 'user@email.com'; - * const password = 'supersecret123'; - * client.login(email, password); - */ - login(tokenOrEmail, password = null) { - if (password) return this.rest.methods.loginEmailPassword(tokenOrEmail, password); - return this.rest.methods.loginToken(tokenOrEmail); - } - - /** - * Destroys the client and logs out. - * @returns {Promise} - */ - destroy() { - for (const t of this._timeouts) clearTimeout(t); - for (const i of this._intervals) clearInterval(i); - this._timeouts.clear(); - this._intervals.clear(); - this.token = null; - this.email = null; - this.password = null; - return this.manager.destroy(); - } - - /** - * This shouldn't really be necessary to most developers as it is automatically invoked every 30 seconds, however - * if you wish to force a sync of guild data, you can use this. - * This is only available when using a user account. - * @param {Guild[]|Collection} [guilds=this.guilds] An array or collection of guilds to sync - */ - syncGuilds(guilds = this.guilds) { - if (this.user.bot) return; - this.ws.send({ - op: 12, - d: guilds instanceof Collection ? guilds.keyArray() : guilds.map(g => g.id), - }); - } - - /** - * Caches a user, or obtains it from the cache if it's already cached. - * This is only available when using a bot account. - * @param {string} id The ID of the user to obtain - * @returns {Promise} - */ - fetchUser(id) { - if (this.users.has(id)) return Promise.resolve(this.users.get(id)); - return this.rest.methods.getUser(id); - } - - /** - * Fetches an invite object from an invite code. - * @param {InviteResolvable} invite An invite code or URL - * @returns {Promise} - */ - fetchInvite(invite) { - const code = this.resolver.resolveInviteCode(invite); - return this.rest.methods.getInvite(code); - } - - /** - * Fetch a webhook by ID. - * @param {string} id ID of the webhook - * @param {string} [token] Token for the webhook - * @returns {Promise} - */ - fetchWebhook(id, token) { - return this.rest.methods.getWebhook(id, token); - } - - /** - * Sweeps all channels' messages and removes the ones older than the max message lifetime. - * If the message has been edited, the time of the edit is used rather than the time of the original message. - * @param {number} [lifetime=this.options.messageCacheLifetime] Messages that are older than this (in seconds) - * will be removed from the caches. The default is based on the client's `messageCacheLifetime` option. - * @returns {number} Amount of messages that were removed from the caches, - * or -1 if the message cache lifetime is unlimited - */ - sweepMessages(lifetime = this.options.messageCacheLifetime) { - if (typeof lifetime !== 'number' || isNaN(lifetime)) throw new TypeError('The lifetime must be a number.'); - if (lifetime <= 0) { - this.emit('debug', 'Didn\'t sweep messages - lifetime is unlimited'); - return -1; - } - - const lifetimeMs = lifetime * 1000; - const now = Date.now(); - let channels = 0; - let messages = 0; - - for (const channel of this.channels.values()) { - if (!channel.messages) continue; - channels++; - - for (const message of channel.messages.values()) { - if (now - (message.editedTimestamp || message.createdTimestamp) > lifetimeMs) { - channel.messages.delete(message.id); - messages++; - } - } - } - - this.emit('debug', `Swept ${messages} messages older than ${lifetime} seconds in ${channels} text-based channels`); - return messages; - } - - /** - * Gets the bot's OAuth2 application. - * This is only available when using a bot account. - * @returns {Promise} - */ - fetchApplication() { - if (!this.user.bot) throw new Error(Constants.Errors.NO_BOT_ACCOUNT); - return this.rest.methods.getMyApplication(); - } - - /** - * Sets a timeout that will be automatically cancelled if the client is destroyed. - * @param {Function} fn Function to execute - * @param {number} delay Time to wait before executing (in milliseconds) - * @param {args} args Arguments for the function (infinite/rest argument, not an array) - * @returns {Timeout} - */ - setTimeout(fn, delay, ...args) { - const timeout = setTimeout(() => { - fn(); - this._timeouts.delete(timeout); - }, delay, ...args); - this._timeouts.add(timeout); - return timeout; - } - - /** - * Clears a timeout - * @param {Timeout} timeout Timeout to cancel - */ - clearTimeout(timeout) { - clearTimeout(timeout); - this._timeouts.delete(timeout); - } - - /** - * Sets an interval that will be automatically cancelled if the client is destroyed. - * @param {Function} fn Function to execute - * @param {number} delay Time to wait before executing (in milliseconds) - * @param {args} args Arguments for the function (infinite/rest argument, not an array) - * @returns {Timeout} - */ - setInterval(fn, delay, ...args) { - const interval = setInterval(fn, delay, ...args); - this._intervals.add(interval); - return interval; - } - - /** - * Clears an interval - * @param {Timeout} interval Interval to cancel - */ - clearInterval(interval) { - clearInterval(interval); - this._intervals.delete(interval); - } - - _setPresence(id, presence) { - if (this.presences.get(id)) { - this.presences.get(id).update(presence); - return; - } - this.presences.set(id, new Presence(presence)); - } - - _eval(script) { - return eval(script); - } - - _validateOptions(options = this.options) { - if (typeof options.shardCount !== 'number' || isNaN(options.shardCount)) { - throw new TypeError('The shardCount option must be a number.'); - } - if (typeof options.shardId !== 'number' || isNaN(options.shardId)) { - throw new TypeError('The shardId option must be a number.'); - } - if (options.shardCount < 0) throw new RangeError('The shardCount option must be at least 0.'); - if (options.shardId < 0) throw new RangeError('The shardId option must be at least 0.'); - if (options.shardId !== 0 && options.shardId >= options.shardCount) { - throw new RangeError('The shardId option must be less than shardCount.'); - } - if (typeof options.messageCacheMaxSize !== 'number' || isNaN(options.messageCacheMaxSize)) { - throw new TypeError('The messageCacheMaxSize option must be a number.'); - } - if (typeof options.messageCacheLifetime !== 'number' || isNaN(options.messageCacheLifetime)) { - throw new TypeError('The messageCacheLifetime option must be a number.'); - } - if (typeof options.messageSweepInterval !== 'number' || isNaN(options.messageSweepInterval)) { - throw new TypeError('The messageSweepInterval option must be a number.'); - } - if (typeof options.fetchAllMembers !== 'boolean') { - throw new TypeError('The fetchAllMembers option must be a boolean.'); - } - if (typeof options.disableEveryone !== 'boolean') { - throw new TypeError('The disableEveryone option must be a boolean.'); - } - if (typeof options.restWsBridgeTimeout !== 'number' || isNaN(options.restWsBridgeTimeout)) { - throw new TypeError('The restWsBridgeTimeout option must be a number.'); - } - if (!(options.disabledEvents instanceof Array)) throw new TypeError('The disabledEvents option must be an Array.'); - } - } - - module.exports = Client; - - /** - * Emitted for general warnings - * @event Client#warn - * @param {string} The warning - */ - - /** - * Emitted for general debugging information - * @event Client#debug - * @param {string} The debug information - */ - - /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2))) /***/ }, /* 2 */ -/***/ function(module, exports) { +/***/ function(module, exports, __webpack_require__) { - // shim for using process in browser - var process = module.exports = {}; +/* WEBPACK VAR INJECTION */(function(process) {exports.Package = __webpack_require__(61); - // cached from whatever global is present so that test runners that stub it - // don't break things. But we need to wrap it in a try catch in case it is - // wrapped in strict mode code which doesn't define any globals. It's inside a - // function because try/catches deoptimize in certain engines. +/** + * Options for a Client. + * @typedef {Object} ClientOptions + * @property {string} [apiRequestMethod='sequential'] 'sequential' or 'burst'. Sequential executes all requests in + * the order they are triggered, whereas burst runs multiple at a time, and doesn't guarantee a particular order. + * @property {number} [shardId=0] The ID of this shard + * @property {number} [shardCount=0] The number of shards + * @property {number} [messageCacheMaxSize=200] Maximum number of messages to cache per channel + * (-1 or Infinity for unlimited - don't do this without message sweeping, otherwise memory usage will climb + * indefinitely) + * @property {number} [messageCacheLifetime=0] How long until a message should be uncached by the message sweeping + * (in seconds, 0 for forever) + * @property {number} [messageSweepInterval=0] How frequently to remove messages from the cache that are older than + * the message cache lifetime (in seconds, 0 for never) + * @property {boolean} [fetchAllMembers=false] Whether to cache all guild members and users upon startup, as well as + * upon joining a guild + * @property {boolean} [disableEveryone=false] Default value for MessageOptions.disableEveryone + * @property {boolean} [sync=false] Whether to periodically sync guilds (for userbots) + * @property {number} [restWsBridgeTimeout=5000] Maximum time permitted between REST responses and their + * corresponding websocket events + * @property {string[]} [disabledEvents] An array of disabled websocket events. Events in this array will not be + * processed. Disabling useless events such as 'TYPING_START' can result in significant performance increases on + * large-scale bots. + * @property {WebsocketOptions} [ws] Options for the websocket + */ +exports.DefaultOptions = { + apiRequestMethod: 'sequential', + shardId: 0, + shardCount: 0, + messageCacheMaxSize: 200, + messageCacheLifetime: 0, + messageSweepInterval: 0, + fetchAllMembers: false, + disableEveryone: false, + sync: false, + restWsBridgeTimeout: 5000, + disabledEvents: [], - var cachedSetTimeout; - var cachedClearTimeout; + /** + * Websocket options. These are left as snake_case to match the API. + * @typedef {Object} WebsocketOptions + * @property {number} [large_threshold=250] Number of members in a guild to be considered large + * @property {boolean} [compress=true] Whether to compress data sent on the connection. + * Defaults to `false` for browsers. + */ + ws: { + large_threshold: 250, + compress: typeof window === 'undefined', + properties: { + $os: process ? process.platform : 'discord.js', + $browser: 'discord.js', + $device: 'discord.js', + $referrer: '', + $referring_domain: '', + }, + }, +}; - function defaultSetTimout() { - throw new Error('setTimeout has not been defined'); - } - function defaultClearTimeout () { - throw new Error('clearTimeout has not been defined'); - } - (function () { - try { - if (typeof setTimeout === 'function') { - cachedSetTimeout = setTimeout; - } else { - cachedSetTimeout = defaultSetTimout; - } - } catch (e) { - cachedSetTimeout = defaultSetTimout; - } - try { - if (typeof clearTimeout === 'function') { - cachedClearTimeout = clearTimeout; - } else { - cachedClearTimeout = defaultClearTimeout; - } - } catch (e) { - cachedClearTimeout = defaultClearTimeout; - } - } ()) - function runTimeout(fun) { - if (cachedSetTimeout === setTimeout) { - //normal enviroments in sane situations - return setTimeout(fun, 0); - } - // if setTimeout wasn't available but was latter defined - if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { - cachedSetTimeout = setTimeout; - return setTimeout(fun, 0); - } - try { - // when when somebody has screwed with setTimeout but no I.E. maddness - return cachedSetTimeout(fun, 0); - } catch(e){ - try { - // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally - return cachedSetTimeout.call(null, fun, 0); - } catch(e){ - // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error - return cachedSetTimeout.call(this, fun, 0); - } - } +exports.Errors = { + NO_TOKEN: 'Request to use token, but token was unavailable to the client.', + NO_BOT_ACCOUNT: 'Only bot accounts are able to make use of this feature.', + NO_USER_ACCOUNT: 'Only user accounts are able to make use of this feature.', + BAD_WS_MESSAGE: 'A bad message was received from the websocket; either bad compression, or not JSON.', + TOOK_TOO_LONG: 'Something took too long to do.', + NOT_A_PERMISSION: 'Invalid permission string or number.', + INVALID_RATE_LIMIT_METHOD: 'Unknown rate limiting method.', + BAD_LOGIN: 'Incorrect login details were provided.', + INVALID_SHARD: 'Invalid shard settings were provided.', +}; +const PROTOCOL_VERSION = exports.PROTOCOL_VERSION = 6; +const API = exports.API = `https://discordapp.com/api/v${PROTOCOL_VERSION}`; +const Endpoints = exports.Endpoints = { + // general + login: `${API}/auth/login`, + logout: `${API}/auth/logout`, + gateway: `${API}/gateway`, + botGateway: `${API}/gateway/bot`, + invite: (id) => `${API}/invite/${id}`, + inviteLink: (id) => `https://discord.gg/${id}`, + CDN: 'https://cdn.discordapp.com', - } - function runClearTimeout(marker) { - if (cachedClearTimeout === clearTimeout) { - //normal enviroments in sane situations - return clearTimeout(marker); - } - // if clearTimeout wasn't available but was latter defined - if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { - cachedClearTimeout = clearTimeout; - return clearTimeout(marker); - } - try { - // when when somebody has screwed with setTimeout but no I.E. maddness - return cachedClearTimeout(marker); - } catch (e){ - try { - // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally - return cachedClearTimeout.call(null, marker); - } catch (e){ - // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. - // Some versions of I.E. have different rules for clearTimeout vs setTimeout - return cachedClearTimeout.call(this, marker); - } - } + // users + user: (userID) => `${API}/users/${userID}`, + userChannels: (userID) => `${Endpoints.user(userID)}/channels`, + userProfile: (userID) => `${Endpoints.user(userID)}/profile`, + avatar: (userID, avatar) => userID === '1' ? avatar : `${Endpoints.user(userID)}/avatars/${avatar}.jpg`, + me: `${API}/users/@me`, + meGuild: (guildID) => `${Endpoints.me}/guilds/${guildID}`, + relationships: (userID) => `${Endpoints.user(userID)}/relationships`, + note: (userID) => `${Endpoints.me}/notes/${userID}`, + // guilds + guilds: `${API}/guilds`, + guild: (guildID) => `${Endpoints.guilds}/${guildID}`, + guildIcon: (guildID, hash) => `${Endpoints.guild(guildID)}/icons/${hash}.jpg`, + guildPrune: (guildID) => `${Endpoints.guild(guildID)}/prune`, + guildEmbed: (guildID) => `${Endpoints.guild(guildID)}/embed`, + guildInvites: (guildID) => `${Endpoints.guild(guildID)}/invites`, + guildRoles: (guildID) => `${Endpoints.guild(guildID)}/roles`, + guildRole: (guildID, roleID) => `${Endpoints.guildRoles(guildID)}/${roleID}`, + guildBans: (guildID) => `${Endpoints.guild(guildID)}/bans`, + guildIntegrations: (guildID) => `${Endpoints.guild(guildID)}/integrations`, + guildMembers: (guildID) => `${Endpoints.guild(guildID)}/members`, + guildMember: (guildID, memberID) => `${Endpoints.guildMembers(guildID)}/${memberID}`, + stupidInconsistentGuildEndpoint: (guildID) => `${Endpoints.guildMember(guildID, '@me')}/nick`, + guildChannels: (guildID) => `${Endpoints.guild(guildID)}/channels`, + guildEmojis: (guildID) => `${Endpoints.guild(guildID)}/emojis`, + // channels + channels: `${API}/channels`, + channel: (channelID) => `${Endpoints.channels}/${channelID}`, + channelMessages: (channelID) => `${Endpoints.channel(channelID)}/messages`, + channelInvites: (channelID) => `${Endpoints.channel(channelID)}/invites`, + channelTyping: (channelID) => `${Endpoints.channel(channelID)}/typing`, + channelPermissions: (channelID) => `${Endpoints.channel(channelID)}/permissions`, + channelMessage: (channelID, messageID) => `${Endpoints.channelMessages(channelID)}/${messageID}`, + channelWebhooks: (channelID) => `${Endpoints.channel(channelID)}/webhooks`, - } - var queue = []; - var draining = false; - var currentQueue; - var queueIndex = -1; + // message reactions + messageReactions: (channelID, messageID) => `${Endpoints.channelMessage(channelID, messageID)}/reactions`, + messageReaction: + (channel, msg, emoji, limit) => + `${Endpoints.messageReactions(channel, msg)}/${emoji}` + + `${limit ? `?limit=${limit}` : ''}`, + selfMessageReaction: (channel, msg, emoji, limit) => + `${Endpoints.messageReaction(channel, msg, emoji, limit)}/@me`, + userMessageReaction: (channel, msg, emoji, limit, id) => + `${Endpoints.messageReaction(channel, msg, emoji, limit)}/${id}`, - function cleanUpNextTick() { - if (!draining || !currentQueue) { - return; - } - draining = false; - if (currentQueue.length) { - queue = currentQueue.concat(queue); - } else { - queueIndex = -1; - } - if (queue.length) { - drainQueue(); - } - } + // webhooks + webhook: (webhookID, token) => `${API}/webhooks/${webhookID}${token ? `/${token}` : ''}`, - function drainQueue() { - if (draining) { - return; - } - var timeout = runTimeout(cleanUpNextTick); - draining = true; + // oauth + myApplication: `${API}/oauth2/applications/@me`, + getApp: (id) => `${API}/oauth2/authorize?client_id=${id}`, +}; - var len = queue.length; - while(len) { - currentQueue = queue; - queue = []; - while (++queueIndex < len) { - if (currentQueue) { - currentQueue[queueIndex].run(); - } - } - queueIndex = -1; - len = queue.length; - } - currentQueue = null; - draining = false; - runClearTimeout(timeout); - } +exports.Status = { + READY: 0, + CONNECTING: 1, + RECONNECTING: 2, + IDLE: 3, + NEARLY: 4, +}; - process.nextTick = function (fun) { - var args = new Array(arguments.length - 1); - if (arguments.length > 1) { - for (var i = 1; i < arguments.length; i++) { - args[i - 1] = arguments[i]; - } - } - queue.push(new Item(fun, args)); - if (queue.length === 1 && !draining) { - runTimeout(drainQueue); - } - }; +exports.ChannelTypes = { + text: 0, + DM: 1, + voice: 2, + groupDM: 3, +}; - // v8 likes predictible objects - function Item(fun, array) { - this.fun = fun; - this.array = array; - } - Item.prototype.run = function () { - this.fun.apply(null, this.array); - }; - process.title = 'browser'; - process.browser = true; - process.env = {}; - process.argv = []; - process.version = ''; // empty string to avoid regexp issues - process.versions = {}; +exports.OPCodes = { + DISPATCH: 0, + HEARTBEAT: 1, + IDENTIFY: 2, + STATUS_UPDATE: 3, + VOICE_STATE_UPDATE: 4, + VOICE_GUILD_PING: 5, + RESUME: 6, + RECONNECT: 7, + REQUEST_GUILD_MEMBERS: 8, + INVALID_SESSION: 9, + HELLO: 10, + HEARTBEAT_ACK: 11, +}; - function noop() {} +exports.VoiceOPCodes = { + IDENTIFY: 0, + SELECT_PROTOCOL: 1, + READY: 2, + HEARTBEAT: 3, + SESSION_DESCRIPTION: 4, + SPEAKING: 5, +}; - process.on = noop; - process.addListener = noop; - process.once = noop; - process.off = noop; - process.removeListener = noop; - process.removeAllListeners = noop; - process.emit = noop; +exports.Events = { + READY: 'ready', + GUILD_CREATE: 'guildCreate', + GUILD_DELETE: 'guildDelete', + GUILD_UPDATE: 'guildUpdate', + GUILD_UNAVAILABLE: 'guildUnavailable', + GUILD_AVAILABLE: 'guildAvailable', + GUILD_MEMBER_ADD: 'guildMemberAdd', + GUILD_MEMBER_REMOVE: 'guildMemberRemove', + GUILD_MEMBER_UPDATE: 'guildMemberUpdate', + GUILD_MEMBER_AVAILABLE: 'guildMemberAvailable', + GUILD_MEMBER_SPEAKING: 'guildMemberSpeaking', + GUILD_MEMBERS_CHUNK: 'guildMembersChunk', + GUILD_ROLE_CREATE: 'roleCreate', + GUILD_ROLE_DELETE: 'roleDelete', + GUILD_ROLE_UPDATE: 'roleUpdate', + GUILD_EMOJI_CREATE: 'guildEmojiCreate', + GUILD_EMOJI_DELETE: 'guildEmojiDelete', + GUILD_EMOJI_UPDATE: 'guildEmojiUpdate', + GUILD_BAN_ADD: 'guildBanAdd', + GUILD_BAN_REMOVE: 'guildBanRemove', + CHANNEL_CREATE: 'channelCreate', + CHANNEL_DELETE: 'channelDelete', + CHANNEL_UPDATE: 'channelUpdate', + CHANNEL_PINS_UPDATE: 'channelPinsUpdate', + MESSAGE_CREATE: 'message', + MESSAGE_DELETE: 'messageDelete', + MESSAGE_UPDATE: 'messageUpdate', + MESSAGE_BULK_DELETE: 'messageDeleteBulk', + MESSAGE_REACTION_ADD: 'messageReactionAdd', + MESSAGE_REACTION_REMOVE: 'messageReactionRemove', + MESSAGE_REACTION_REMOVE_ALL: 'messageReactionRemoveAll', + USER_UPDATE: 'userUpdate', + USER_NOTE_UPDATE: 'userNoteUpdate', + PRESENCE_UPDATE: 'presenceUpdate', + VOICE_STATE_UPDATE: 'voiceStateUpdate', + TYPING_START: 'typingStart', + TYPING_STOP: 'typingStop', + DISCONNECT: 'disconnect', + RECONNECTING: 'reconnecting', + ERROR: 'error', + WARN: 'warn', + DEBUG: 'debug', +}; - process.binding = function (name) { - throw new Error('process.binding is not supported'); - }; +exports.WSEvents = { + READY: 'READY', + GUILD_SYNC: 'GUILD_SYNC', + GUILD_CREATE: 'GUILD_CREATE', + GUILD_DELETE: 'GUILD_DELETE', + GUILD_UPDATE: 'GUILD_UPDATE', + GUILD_MEMBER_ADD: 'GUILD_MEMBER_ADD', + GUILD_MEMBER_REMOVE: 'GUILD_MEMBER_REMOVE', + GUILD_MEMBER_UPDATE: 'GUILD_MEMBER_UPDATE', + GUILD_MEMBERS_CHUNK: 'GUILD_MEMBERS_CHUNK', + GUILD_ROLE_CREATE: 'GUILD_ROLE_CREATE', + GUILD_ROLE_DELETE: 'GUILD_ROLE_DELETE', + GUILD_ROLE_UPDATE: 'GUILD_ROLE_UPDATE', + GUILD_BAN_ADD: 'GUILD_BAN_ADD', + GUILD_BAN_REMOVE: 'GUILD_BAN_REMOVE', + CHANNEL_CREATE: 'CHANNEL_CREATE', + CHANNEL_DELETE: 'CHANNEL_DELETE', + CHANNEL_UPDATE: 'CHANNEL_UPDATE', + CHANNEL_PINS_UPDATE: 'CHANNEL_PINS_UPDATE', + MESSAGE_CREATE: 'MESSAGE_CREATE', + MESSAGE_DELETE: 'MESSAGE_DELETE', + MESSAGE_UPDATE: 'MESSAGE_UPDATE', + MESSAGE_DELETE_BULK: 'MESSAGE_DELETE_BULK', + MESSAGE_REACTION_ADD: 'MESSAGE_REACTION_ADD', + MESSAGE_REACTION_REMOVE: 'MESSAGE_REACTION_REMOVE', + MESSAGE_REACTION_REMOVE_ALL: 'MESSAGE_REACTION_REMOVE_ALL', + USER_UPDATE: 'USER_UPDATE', + USER_NOTE_UPDATE: 'USER_NOTE_UPDATE', + PRESENCE_UPDATE: 'PRESENCE_UPDATE', + VOICE_STATE_UPDATE: 'VOICE_STATE_UPDATE', + TYPING_START: 'TYPING_START', + FRIEND_ADD: 'RELATIONSHIP_ADD', + FRIEND_REMOVE: 'RELATIONSHIP_REMOVE', + VOICE_SERVER_UPDATE: 'VOICE_SERVER_UPDATE', + RELATIONSHIP_ADD: 'RELATIONSHIP_ADD', + RELATIONSHIP_REMOVE: 'RELATIONSHIP_REMOVE', +}; - process.cwd = function () { return '/' }; - process.chdir = function (dir) { - throw new Error('process.chdir is not supported'); - }; - process.umask = function() { return 0; }; +exports.MessageTypes = { + 0: 'DEFAULT', + 1: 'RECIPIENT_ADD', + 2: 'RECIPIENT_REMOVE', + 3: 'CALL', + 4: 'CHANNEL_NAME_CHANGE', + 5: 'CHANNEL_ICON_CHANGE', + 6: 'PINS_ADD', +}; +const PermissionFlags = exports.PermissionFlags = { + CREATE_INSTANT_INVITE: 1 << 0, + KICK_MEMBERS: 1 << 1, + BAN_MEMBERS: 1 << 2, + ADMINISTRATOR: 1 << 3, + MANAGE_CHANNELS: 1 << 4, + MANAGE_GUILD: 1 << 5, + ADD_REACTIONS: 1 << 6, + + READ_MESSAGES: 1 << 10, + SEND_MESSAGES: 1 << 11, + SEND_TTS_MESSAGES: 1 << 12, + MANAGE_MESSAGES: 1 << 13, + EMBED_LINKS: 1 << 14, + ATTACH_FILES: 1 << 15, + READ_MESSAGE_HISTORY: 1 << 16, + MENTION_EVERYONE: 1 << 17, + EXTERNAL_EMOJIS: 1 << 18, + + CONNECT: 1 << 20, + SPEAK: 1 << 21, + MUTE_MEMBERS: 1 << 22, + DEAFEN_MEMBERS: 1 << 23, + MOVE_MEMBERS: 1 << 24, + USE_VAD: 1 << 25, + + CHANGE_NICKNAME: 1 << 26, + MANAGE_NICKNAMES: 1 << 27, + MANAGE_ROLES_OR_PERMISSIONS: 1 << 28, + MANAGE_WEBHOOKS: 1 << 29, + MANAGE_EMOJIS: 1 << 30, +}; + +let _ALL_PERMISSIONS = 0; +for (const key in PermissionFlags) _ALL_PERMISSIONS |= PermissionFlags[key]; +exports.ALL_PERMISSIONS = _ALL_PERMISSIONS; +exports.DEFAULT_PERMISSIONS = 104324097; + +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) /***/ }, /* 3 */ /***/ function(module, exports) { - // Copyright Joyent, Inc. and other Node contributors. - // - // Permission is hereby granted, free of charge, to any person obtaining a - // copy of this software and associated documentation files (the - // "Software"), to deal in the Software without restriction, including - // without limitation the rights to use, copy, modify, merge, publish, - // distribute, sublicense, and/or sell copies of the Software, and to permit - // persons to whom the Software is furnished to do so, subject to the - // following conditions: - // - // The above copyright notice and this permission notice shall be included - // in all copies or substantial portions of the Software. - // - // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN - // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE - // USE OR OTHER DEALINGS IN THE SOFTWARE. +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. - function EventEmitter() { - this._events = this._events || {}; - this._maxListeners = this._maxListeners || undefined; - } - module.exports = EventEmitter; +function EventEmitter() { + this._events = this._events || {}; + this._maxListeners = this._maxListeners || undefined; +} +module.exports = EventEmitter; - // Backwards-compat with node 0.10.x - EventEmitter.EventEmitter = EventEmitter; +// Backwards-compat with node 0.10.x +EventEmitter.EventEmitter = EventEmitter; - EventEmitter.prototype._events = undefined; - EventEmitter.prototype._maxListeners = undefined; +EventEmitter.prototype._events = undefined; +EventEmitter.prototype._maxListeners = undefined; - // By default EventEmitters will print a warning if more than 10 listeners are - // added to it. This is a useful default which helps finding memory leaks. - EventEmitter.defaultMaxListeners = 10; +// By default EventEmitters will print a warning if more than 10 listeners are +// added to it. This is a useful default which helps finding memory leaks. +EventEmitter.defaultMaxListeners = 10; - // Obviously not all Emitters should be limited to 10. This function allows - // that to be increased. Set to zero for unlimited. - EventEmitter.prototype.setMaxListeners = function(n) { - if (!isNumber(n) || n < 0 || isNaN(n)) - throw TypeError('n must be a positive number'); - this._maxListeners = n; - return this; - }; +// Obviously not all Emitters should be limited to 10. This function allows +// that to be increased. Set to zero for unlimited. +EventEmitter.prototype.setMaxListeners = function(n) { + if (!isNumber(n) || n < 0 || isNaN(n)) + throw TypeError('n must be a positive number'); + this._maxListeners = n; + return this; +}; - EventEmitter.prototype.emit = function(type) { - var er, handler, len, args, i, listeners; +EventEmitter.prototype.emit = function(type) { + var er, handler, len, args, i, listeners; - if (!this._events) - this._events = {}; + if (!this._events) + this._events = {}; - // If there is no 'error' event listener then throw. - if (type === 'error') { - if (!this._events.error || - (isObject(this._events.error) && !this._events.error.length)) { - er = arguments[1]; - if (er instanceof Error) { - throw er; // Unhandled 'error' event - } else { - // At least give some kind of context to the user - var err = new Error('Uncaught, unspecified "error" event. (' + er + ')'); - err.context = er; - throw err; - } - } - } + // If there is no 'error' event listener then throw. + if (type === 'error') { + if (!this._events.error || + (isObject(this._events.error) && !this._events.error.length)) { + er = arguments[1]; + if (er instanceof Error) { + throw er; // Unhandled 'error' event + } else { + // At least give some kind of context to the user + var err = new Error('Uncaught, unspecified "error" event. (' + er + ')'); + err.context = er; + throw err; + } + } + } - handler = this._events[type]; + handler = this._events[type]; - if (isUndefined(handler)) - return false; + if (isUndefined(handler)) + return false; - if (isFunction(handler)) { - switch (arguments.length) { - // fast cases - case 1: - handler.call(this); - break; - case 2: - handler.call(this, arguments[1]); - break; - case 3: - handler.call(this, arguments[1], arguments[2]); - break; - // slower - default: - args = Array.prototype.slice.call(arguments, 1); - handler.apply(this, args); - } - } else if (isObject(handler)) { - args = Array.prototype.slice.call(arguments, 1); - listeners = handler.slice(); - len = listeners.length; - for (i = 0; i < len; i++) - listeners[i].apply(this, args); - } + if (isFunction(handler)) { + switch (arguments.length) { + // fast cases + case 1: + handler.call(this); + break; + case 2: + handler.call(this, arguments[1]); + break; + case 3: + handler.call(this, arguments[1], arguments[2]); + break; + // slower + default: + args = Array.prototype.slice.call(arguments, 1); + handler.apply(this, args); + } + } else if (isObject(handler)) { + args = Array.prototype.slice.call(arguments, 1); + listeners = handler.slice(); + len = listeners.length; + for (i = 0; i < len; i++) + listeners[i].apply(this, args); + } - return true; - }; + return true; +}; - EventEmitter.prototype.addListener = function(type, listener) { - var m; +EventEmitter.prototype.addListener = function(type, listener) { + var m; - if (!isFunction(listener)) - throw TypeError('listener must be a function'); + if (!isFunction(listener)) + throw TypeError('listener must be a function'); - if (!this._events) - this._events = {}; + if (!this._events) + this._events = {}; - // To avoid recursion in the case that type === "newListener"! Before - // adding it to the listeners, first emit "newListener". - if (this._events.newListener) - this.emit('newListener', type, - isFunction(listener.listener) ? - listener.listener : listener); + // To avoid recursion in the case that type === "newListener"! Before + // adding it to the listeners, first emit "newListener". + if (this._events.newListener) + this.emit('newListener', type, + isFunction(listener.listener) ? + listener.listener : listener); - if (!this._events[type]) - // Optimize the case of one listener. Don't need the extra array object. - this._events[type] = listener; - else if (isObject(this._events[type])) - // If we've already got an array, just append. - this._events[type].push(listener); - else - // Adding the second element, need to change to array. - this._events[type] = [this._events[type], listener]; + if (!this._events[type]) + // Optimize the case of one listener. Don't need the extra array object. + this._events[type] = listener; + else if (isObject(this._events[type])) + // If we've already got an array, just append. + this._events[type].push(listener); + else + // Adding the second element, need to change to array. + this._events[type] = [this._events[type], listener]; - // Check for listener leak - if (isObject(this._events[type]) && !this._events[type].warned) { - if (!isUndefined(this._maxListeners)) { - m = this._maxListeners; - } else { - m = EventEmitter.defaultMaxListeners; - } + // Check for listener leak + if (isObject(this._events[type]) && !this._events[type].warned) { + if (!isUndefined(this._maxListeners)) { + m = this._maxListeners; + } else { + m = EventEmitter.defaultMaxListeners; + } - if (m && m > 0 && this._events[type].length > m) { - this._events[type].warned = true; - console.error('(node) warning: possible EventEmitter memory ' + - 'leak detected. %d listeners added. ' + - 'Use emitter.setMaxListeners() to increase limit.', - this._events[type].length); - if (typeof console.trace === 'function') { - // not supported in IE 10 - console.trace(); - } - } - } + if (m && m > 0 && this._events[type].length > m) { + this._events[type].warned = true; + console.error('(node) warning: possible EventEmitter memory ' + + 'leak detected. %d listeners added. ' + + 'Use emitter.setMaxListeners() to increase limit.', + this._events[type].length); + if (typeof console.trace === 'function') { + // not supported in IE 10 + console.trace(); + } + } + } - return this; - }; + return this; +}; - EventEmitter.prototype.on = EventEmitter.prototype.addListener; +EventEmitter.prototype.on = EventEmitter.prototype.addListener; - EventEmitter.prototype.once = function(type, listener) { - if (!isFunction(listener)) - throw TypeError('listener must be a function'); +EventEmitter.prototype.once = function(type, listener) { + if (!isFunction(listener)) + throw TypeError('listener must be a function'); - var fired = false; + var fired = false; - function g() { - this.removeListener(type, g); + function g() { + this.removeListener(type, g); - if (!fired) { - fired = true; - listener.apply(this, arguments); - } - } + if (!fired) { + fired = true; + listener.apply(this, arguments); + } + } - g.listener = listener; - this.on(type, g); + g.listener = listener; + this.on(type, g); - return this; - }; + return this; +}; - // emits a 'removeListener' event iff the listener was removed - EventEmitter.prototype.removeListener = function(type, listener) { - var list, position, length, i; +// emits a 'removeListener' event iff the listener was removed +EventEmitter.prototype.removeListener = function(type, listener) { + var list, position, length, i; - if (!isFunction(listener)) - throw TypeError('listener must be a function'); + if (!isFunction(listener)) + throw TypeError('listener must be a function'); - if (!this._events || !this._events[type]) - return this; + if (!this._events || !this._events[type]) + return this; - list = this._events[type]; - length = list.length; - position = -1; + list = this._events[type]; + length = list.length; + position = -1; - if (list === listener || - (isFunction(list.listener) && list.listener === listener)) { - delete this._events[type]; - if (this._events.removeListener) - this.emit('removeListener', type, listener); + if (list === listener || + (isFunction(list.listener) && list.listener === listener)) { + delete this._events[type]; + if (this._events.removeListener) + this.emit('removeListener', type, listener); - } else if (isObject(list)) { - for (i = length; i-- > 0;) { - if (list[i] === listener || - (list[i].listener && list[i].listener === listener)) { - position = i; - break; - } - } + } else if (isObject(list)) { + for (i = length; i-- > 0;) { + if (list[i] === listener || + (list[i].listener && list[i].listener === listener)) { + position = i; + break; + } + } - if (position < 0) - return this; + if (position < 0) + return this; - if (list.length === 1) { - list.length = 0; - delete this._events[type]; - } else { - list.splice(position, 1); - } + if (list.length === 1) { + list.length = 0; + delete this._events[type]; + } else { + list.splice(position, 1); + } - if (this._events.removeListener) - this.emit('removeListener', type, listener); - } + if (this._events.removeListener) + this.emit('removeListener', type, listener); + } - return this; - }; + return this; +}; - EventEmitter.prototype.removeAllListeners = function(type) { - var key, listeners; +EventEmitter.prototype.removeAllListeners = function(type) { + var key, listeners; - if (!this._events) - return this; + if (!this._events) + return this; - // not listening for removeListener, no need to emit - if (!this._events.removeListener) { - if (arguments.length === 0) - this._events = {}; - else if (this._events[type]) - delete this._events[type]; - return this; - } + // not listening for removeListener, no need to emit + if (!this._events.removeListener) { + if (arguments.length === 0) + this._events = {}; + else if (this._events[type]) + delete this._events[type]; + return this; + } - // emit removeListener for all listeners on all events - if (arguments.length === 0) { - for (key in this._events) { - if (key === 'removeListener') continue; - this.removeAllListeners(key); - } - this.removeAllListeners('removeListener'); - this._events = {}; - return this; - } + // emit removeListener for all listeners on all events + if (arguments.length === 0) { + for (key in this._events) { + if (key === 'removeListener') continue; + this.removeAllListeners(key); + } + this.removeAllListeners('removeListener'); + this._events = {}; + return this; + } - listeners = this._events[type]; + listeners = this._events[type]; - if (isFunction(listeners)) { - this.removeListener(type, listeners); - } else if (listeners) { - // LIFO order - while (listeners.length) - this.removeListener(type, listeners[listeners.length - 1]); - } - delete this._events[type]; + if (isFunction(listeners)) { + this.removeListener(type, listeners); + } else if (listeners) { + // LIFO order + while (listeners.length) + this.removeListener(type, listeners[listeners.length - 1]); + } + delete this._events[type]; - return this; - }; + return this; +}; - EventEmitter.prototype.listeners = function(type) { - var ret; - if (!this._events || !this._events[type]) - ret = []; - else if (isFunction(this._events[type])) - ret = [this._events[type]]; - else - ret = this._events[type].slice(); - return ret; - }; +EventEmitter.prototype.listeners = function(type) { + var ret; + if (!this._events || !this._events[type]) + ret = []; + else if (isFunction(this._events[type])) + ret = [this._events[type]]; + else + ret = this._events[type].slice(); + return ret; +}; - EventEmitter.prototype.listenerCount = function(type) { - if (this._events) { - var evlistener = this._events[type]; +EventEmitter.prototype.listenerCount = function(type) { + if (this._events) { + var evlistener = this._events[type]; - if (isFunction(evlistener)) - return 1; - else if (evlistener) - return evlistener.length; - } - return 0; - }; + if (isFunction(evlistener)) + return 1; + else if (evlistener) + return evlistener.length; + } + return 0; +}; - EventEmitter.listenerCount = function(emitter, type) { - return emitter.listenerCount(type); - }; +EventEmitter.listenerCount = function(emitter, type) { + return emitter.listenerCount(type); +}; - function isFunction(arg) { - return typeof arg === 'function'; - } +function isFunction(arg) { + return typeof arg === 'function'; +} - function isNumber(arg) { - return typeof arg === 'number'; - } +function isNumber(arg) { + return typeof arg === 'number'; +} - function isObject(arg) { - return typeof arg === 'object' && arg !== null; - } +function isObject(arg) { + return typeof arg === 'object' && arg !== null; +} - function isUndefined(arg) { - return arg === void 0; - } +function isUndefined(arg) { + return arg === void 0; +} /***/ }, /* 4 */ -/***/ function(module, exports) { +/***/ function(module, exports, __webpack_require__) { - module.exports = function merge(def, given) { - if (!given) return def; - for (const key in def) { - if (!{}.hasOwnProperty.call(given, key)) { - given[key] = def[key]; - } else if (given[key] === Object(given[key])) { - given[key] = merge(def[key], given[key]); - } - } +/* WEBPACK VAR INJECTION */(function(module) {(function (module, exports) { + 'use strict'; - return given; - }; + // Utils + function assert (val, msg) { + if (!val) throw new Error(msg || 'Assertion failed'); + } + // Could use `inherits` module, but don't want to move from single file + // architecture yet. + function inherits (ctor, superCtor) { + ctor.super_ = superCtor; + var TempCtor = function () {}; + TempCtor.prototype = superCtor.prototype; + ctor.prototype = new TempCtor(); + ctor.prototype.constructor = ctor; + } + + // BN + + function BN (number, base, endian) { + if (BN.isBN(number)) { + return number; + } + + this.negative = 0; + this.words = null; + this.length = 0; + + // Reduction context + this.red = null; + + if (number !== null) { + if (base === 'le' || base === 'be') { + endian = base; + base = 10; + } + + this._init(number || 0, base || 10, endian || 'be'); + } + } + if (typeof module === 'object') { + module.exports = BN; + } else { + exports.BN = BN; + } + + BN.BN = BN; + BN.wordSize = 26; + + var Buffer; + try { + Buffer = __webpack_require__(0).Buffer; + } catch (e) { + } + + BN.isBN = function isBN (num) { + if (num instanceof BN) { + return true; + } + + return num !== null && typeof num === 'object' && + num.constructor.wordSize === BN.wordSize && Array.isArray(num.words); + }; + + BN.max = function max (left, right) { + if (left.cmp(right) > 0) return left; + return right; + }; + + BN.min = function min (left, right) { + if (left.cmp(right) < 0) return left; + return right; + }; + + BN.prototype._init = function init (number, base, endian) { + if (typeof number === 'number') { + return this._initNumber(number, base, endian); + } + + if (typeof number === 'object') { + return this._initArray(number, base, endian); + } + + if (base === 'hex') { + base = 16; + } + assert(base === (base | 0) && base >= 2 && base <= 36); + + number = number.toString().replace(/\s+/g, ''); + var start = 0; + if (number[0] === '-') { + start++; + } + + if (base === 16) { + this._parseHex(number, start); + } else { + this._parseBase(number, base, start); + } + + if (number[0] === '-') { + this.negative = 1; + } + + this.strip(); + + if (endian !== 'le') return; + + this._initArray(this.toArray(), base, endian); + }; + + BN.prototype._initNumber = function _initNumber (number, base, endian) { + if (number < 0) { + this.negative = 1; + number = -number; + } + if (number < 0x4000000) { + this.words = [ number & 0x3ffffff ]; + this.length = 1; + } else if (number < 0x10000000000000) { + this.words = [ + number & 0x3ffffff, + (number / 0x4000000) & 0x3ffffff + ]; + this.length = 2; + } else { + assert(number < 0x20000000000000); // 2 ^ 53 (unsafe) + this.words = [ + number & 0x3ffffff, + (number / 0x4000000) & 0x3ffffff, + 1 + ]; + this.length = 3; + } + + if (endian !== 'le') return; + + // Reverse the bytes + this._initArray(this.toArray(), base, endian); + }; + + BN.prototype._initArray = function _initArray (number, base, endian) { + // Perhaps a Uint8Array + assert(typeof number.length === 'number'); + if (number.length <= 0) { + this.words = [ 0 ]; + this.length = 1; + return this; + } + + this.length = Math.ceil(number.length / 3); + this.words = new Array(this.length); + for (var i = 0; i < this.length; i++) { + this.words[i] = 0; + } + + var j, w; + var off = 0; + if (endian === 'be') { + for (i = number.length - 1, j = 0; i >= 0; i -= 3) { + w = number[i] | (number[i - 1] << 8) | (number[i - 2] << 16); + this.words[j] |= (w << off) & 0x3ffffff; + this.words[j + 1] = (w >>> (26 - off)) & 0x3ffffff; + off += 24; + if (off >= 26) { + off -= 26; + j++; + } + } + } else if (endian === 'le') { + for (i = 0, j = 0; i < number.length; i += 3) { + w = number[i] | (number[i + 1] << 8) | (number[i + 2] << 16); + this.words[j] |= (w << off) & 0x3ffffff; + this.words[j + 1] = (w >>> (26 - off)) & 0x3ffffff; + off += 24; + if (off >= 26) { + off -= 26; + j++; + } + } + } + return this.strip(); + }; + + function parseHex (str, start, end) { + var r = 0; + var len = Math.min(str.length, end); + for (var i = start; i < len; i++) { + var c = str.charCodeAt(i) - 48; + + r <<= 4; + + // 'a' - 'f' + if (c >= 49 && c <= 54) { + r |= c - 49 + 0xa; + + // 'A' - 'F' + } else if (c >= 17 && c <= 22) { + r |= c - 17 + 0xa; + + // '0' - '9' + } else { + r |= c & 0xf; + } + } + return r; + } + + BN.prototype._parseHex = function _parseHex (number, start) { + // Create possibly bigger array to ensure that it fits the number + this.length = Math.ceil((number.length - start) / 6); + this.words = new Array(this.length); + for (var i = 0; i < this.length; i++) { + this.words[i] = 0; + } + + var j, w; + // Scan 24-bit chunks and add them to the number + var off = 0; + for (i = number.length - 6, j = 0; i >= start; i -= 6) { + w = parseHex(number, i, i + 6); + this.words[j] |= (w << off) & 0x3ffffff; + // NOTE: `0x3fffff` is intentional here, 26bits max shift + 24bit hex limb + this.words[j + 1] |= w >>> (26 - off) & 0x3fffff; + off += 24; + if (off >= 26) { + off -= 26; + j++; + } + } + if (i + 6 !== start) { + w = parseHex(number, start, i + 6); + this.words[j] |= (w << off) & 0x3ffffff; + this.words[j + 1] |= w >>> (26 - off) & 0x3fffff; + } + this.strip(); + }; + + function parseBase (str, start, end, mul) { + var r = 0; + var len = Math.min(str.length, end); + for (var i = start; i < len; i++) { + var c = str.charCodeAt(i) - 48; + + r *= mul; + + // 'a' + if (c >= 49) { + r += c - 49 + 0xa; + + // 'A' + } else if (c >= 17) { + r += c - 17 + 0xa; + + // '0' - '9' + } else { + r += c; + } + } + return r; + } + + BN.prototype._parseBase = function _parseBase (number, base, start) { + // Initialize as zero + this.words = [ 0 ]; + this.length = 1; + + // Find length of limb in base + for (var limbLen = 0, limbPow = 1; limbPow <= 0x3ffffff; limbPow *= base) { + limbLen++; + } + limbLen--; + limbPow = (limbPow / base) | 0; + + var total = number.length - start; + var mod = total % limbLen; + var end = Math.min(total, total - mod) + start; + + var word = 0; + for (var i = start; i < end; i += limbLen) { + word = parseBase(number, i, i + limbLen, base); + + this.imuln(limbPow); + if (this.words[0] + word < 0x4000000) { + this.words[0] += word; + } else { + this._iaddn(word); + } + } + + if (mod !== 0) { + var pow = 1; + word = parseBase(number, i, number.length, base); + + for (i = 0; i < mod; i++) { + pow *= base; + } + + this.imuln(pow); + if (this.words[0] + word < 0x4000000) { + this.words[0] += word; + } else { + this._iaddn(word); + } + } + }; + + BN.prototype.copy = function copy (dest) { + dest.words = new Array(this.length); + for (var i = 0; i < this.length; i++) { + dest.words[i] = this.words[i]; + } + dest.length = this.length; + dest.negative = this.negative; + dest.red = this.red; + }; + + BN.prototype.clone = function clone () { + var r = new BN(null); + this.copy(r); + return r; + }; + + BN.prototype._expand = function _expand (size) { + while (this.length < size) { + this.words[this.length++] = 0; + } + return this; + }; + + // Remove leading `0` from `this` + BN.prototype.strip = function strip () { + while (this.length > 1 && this.words[this.length - 1] === 0) { + this.length--; + } + return this._normSign(); + }; + + BN.prototype._normSign = function _normSign () { + // -0 = 0 + if (this.length === 1 && this.words[0] === 0) { + this.negative = 0; + } + return this; + }; + + BN.prototype.inspect = function inspect () { + return (this.red ? ''; + }; + + /* + + var zeros = []; + var groupSizes = []; + var groupBases = []; + + var s = ''; + var i = -1; + while (++i < BN.wordSize) { + zeros[i] = s; + s += '0'; + } + groupSizes[0] = 0; + groupSizes[1] = 0; + groupBases[0] = 0; + groupBases[1] = 0; + var base = 2 - 1; + while (++base < 36 + 1) { + var groupSize = 0; + var groupBase = 1; + while (groupBase < (1 << BN.wordSize) / base) { + groupBase *= base; + groupSize += 1; + } + groupSizes[base] = groupSize; + groupBases[base] = groupBase; + } + + */ + + var zeros = [ + '', + '0', + '00', + '000', + '0000', + '00000', + '000000', + '0000000', + '00000000', + '000000000', + '0000000000', + '00000000000', + '000000000000', + '0000000000000', + '00000000000000', + '000000000000000', + '0000000000000000', + '00000000000000000', + '000000000000000000', + '0000000000000000000', + '00000000000000000000', + '000000000000000000000', + '0000000000000000000000', + '00000000000000000000000', + '000000000000000000000000', + '0000000000000000000000000' + ]; + + var groupSizes = [ + 0, 0, + 25, 16, 12, 11, 10, 9, 8, + 8, 7, 7, 7, 7, 6, 6, + 6, 6, 6, 6, 6, 5, 5, + 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5 + ]; + + var groupBases = [ + 0, 0, + 33554432, 43046721, 16777216, 48828125, 60466176, 40353607, 16777216, + 43046721, 10000000, 19487171, 35831808, 62748517, 7529536, 11390625, + 16777216, 24137569, 34012224, 47045881, 64000000, 4084101, 5153632, + 6436343, 7962624, 9765625, 11881376, 14348907, 17210368, 20511149, + 24300000, 28629151, 33554432, 39135393, 45435424, 52521875, 60466176 + ]; + + BN.prototype.toString = function toString (base, padding) { + base = base || 10; + padding = padding | 0 || 1; + + var out; + if (base === 16 || base === 'hex') { + out = ''; + var off = 0; + var carry = 0; + for (var i = 0; i < this.length; i++) { + var w = this.words[i]; + var word = (((w << off) | carry) & 0xffffff).toString(16); + carry = (w >>> (24 - off)) & 0xffffff; + if (carry !== 0 || i !== this.length - 1) { + out = zeros[6 - word.length] + word + out; + } else { + out = word + out; + } + off += 2; + if (off >= 26) { + off -= 26; + i--; + } + } + if (carry !== 0) { + out = carry.toString(16) + out; + } + while (out.length % padding !== 0) { + out = '0' + out; + } + if (this.negative !== 0) { + out = '-' + out; + } + return out; + } + + if (base === (base | 0) && base >= 2 && base <= 36) { + // var groupSize = Math.floor(BN.wordSize * Math.LN2 / Math.log(base)); + var groupSize = groupSizes[base]; + // var groupBase = Math.pow(base, groupSize); + var groupBase = groupBases[base]; + out = ''; + var c = this.clone(); + c.negative = 0; + while (!c.isZero()) { + var r = c.modn(groupBase).toString(base); + c = c.idivn(groupBase); + + if (!c.isZero()) { + out = zeros[groupSize - r.length] + r + out; + } else { + out = r + out; + } + } + if (this.isZero()) { + out = '0' + out; + } + while (out.length % padding !== 0) { + out = '0' + out; + } + if (this.negative !== 0) { + out = '-' + out; + } + return out; + } + + assert(false, 'Base should be between 2 and 36'); + }; + + BN.prototype.toNumber = function toNumber () { + var ret = this.words[0]; + if (this.length === 2) { + ret += this.words[1] * 0x4000000; + } else if (this.length === 3 && this.words[2] === 0x01) { + // NOTE: at this stage it is known that the top bit is set + ret += 0x10000000000000 + (this.words[1] * 0x4000000); + } else if (this.length > 2) { + assert(false, 'Number can only safely store up to 53 bits'); + } + return (this.negative !== 0) ? -ret : ret; + }; + + BN.prototype.toJSON = function toJSON () { + return this.toString(16); + }; + + BN.prototype.toBuffer = function toBuffer (endian, length) { + assert(typeof Buffer !== 'undefined'); + return this.toArrayLike(Buffer, endian, length); + }; + + BN.prototype.toArray = function toArray (endian, length) { + return this.toArrayLike(Array, endian, length); + }; + + BN.prototype.toArrayLike = function toArrayLike (ArrayType, endian, length) { + var byteLength = this.byteLength(); + var reqLength = length || Math.max(1, byteLength); + assert(byteLength <= reqLength, 'byte array longer than desired length'); + assert(reqLength > 0, 'Requested array length <= 0'); + + this.strip(); + var littleEndian = endian === 'le'; + var res = new ArrayType(reqLength); + + var b, i; + var q = this.clone(); + if (!littleEndian) { + // Assume big-endian + for (i = 0; i < reqLength - byteLength; i++) { + res[i] = 0; + } + + for (i = 0; !q.isZero(); i++) { + b = q.andln(0xff); + q.iushrn(8); + + res[reqLength - i - 1] = b; + } + } else { + for (i = 0; !q.isZero(); i++) { + b = q.andln(0xff); + q.iushrn(8); + + res[i] = b; + } + + for (; i < reqLength; i++) { + res[i] = 0; + } + } + + return res; + }; + + if (Math.clz32) { + BN.prototype._countBits = function _countBits (w) { + return 32 - Math.clz32(w); + }; + } else { + BN.prototype._countBits = function _countBits (w) { + var t = w; + var r = 0; + if (t >= 0x1000) { + r += 13; + t >>>= 13; + } + if (t >= 0x40) { + r += 7; + t >>>= 7; + } + if (t >= 0x8) { + r += 4; + t >>>= 4; + } + if (t >= 0x02) { + r += 2; + t >>>= 2; + } + return r + t; + }; + } + + BN.prototype._zeroBits = function _zeroBits (w) { + // Short-cut + if (w === 0) return 26; + + var t = w; + var r = 0; + if ((t & 0x1fff) === 0) { + r += 13; + t >>>= 13; + } + if ((t & 0x7f) === 0) { + r += 7; + t >>>= 7; + } + if ((t & 0xf) === 0) { + r += 4; + t >>>= 4; + } + if ((t & 0x3) === 0) { + r += 2; + t >>>= 2; + } + if ((t & 0x1) === 0) { + r++; + } + return r; + }; + + // Return number of used bits in a BN + BN.prototype.bitLength = function bitLength () { + var w = this.words[this.length - 1]; + var hi = this._countBits(w); + return (this.length - 1) * 26 + hi; + }; + + function toBitArray (num) { + var w = new Array(num.bitLength()); + + for (var bit = 0; bit < w.length; bit++) { + var off = (bit / 26) | 0; + var wbit = bit % 26; + + w[bit] = (num.words[off] & (1 << wbit)) >>> wbit; + } + + return w; + } + + // Number of trailing zero bits + BN.prototype.zeroBits = function zeroBits () { + if (this.isZero()) return 0; + + var r = 0; + for (var i = 0; i < this.length; i++) { + var b = this._zeroBits(this.words[i]); + r += b; + if (b !== 26) break; + } + return r; + }; + + BN.prototype.byteLength = function byteLength () { + return Math.ceil(this.bitLength() / 8); + }; + + BN.prototype.toTwos = function toTwos (width) { + if (this.negative !== 0) { + return this.abs().inotn(width).iaddn(1); + } + return this.clone(); + }; + + BN.prototype.fromTwos = function fromTwos (width) { + if (this.testn(width - 1)) { + return this.notn(width).iaddn(1).ineg(); + } + return this.clone(); + }; + + BN.prototype.isNeg = function isNeg () { + return this.negative !== 0; + }; + + // Return negative clone of `this` + BN.prototype.neg = function neg () { + return this.clone().ineg(); + }; + + BN.prototype.ineg = function ineg () { + if (!this.isZero()) { + this.negative ^= 1; + } + + return this; + }; + + // Or `num` with `this` in-place + BN.prototype.iuor = function iuor (num) { + while (this.length < num.length) { + this.words[this.length++] = 0; + } + + for (var i = 0; i < num.length; i++) { + this.words[i] = this.words[i] | num.words[i]; + } + + return this.strip(); + }; + + BN.prototype.ior = function ior (num) { + assert((this.negative | num.negative) === 0); + return this.iuor(num); + }; + + // Or `num` with `this` + BN.prototype.or = function or (num) { + if (this.length > num.length) return this.clone().ior(num); + return num.clone().ior(this); + }; + + BN.prototype.uor = function uor (num) { + if (this.length > num.length) return this.clone().iuor(num); + return num.clone().iuor(this); + }; + + // And `num` with `this` in-place + BN.prototype.iuand = function iuand (num) { + // b = min-length(num, this) + var b; + if (this.length > num.length) { + b = num; + } else { + b = this; + } + + for (var i = 0; i < b.length; i++) { + this.words[i] = this.words[i] & num.words[i]; + } + + this.length = b.length; + + return this.strip(); + }; + + BN.prototype.iand = function iand (num) { + assert((this.negative | num.negative) === 0); + return this.iuand(num); + }; + + // And `num` with `this` + BN.prototype.and = function and (num) { + if (this.length > num.length) return this.clone().iand(num); + return num.clone().iand(this); + }; + + BN.prototype.uand = function uand (num) { + if (this.length > num.length) return this.clone().iuand(num); + return num.clone().iuand(this); + }; + + // Xor `num` with `this` in-place + BN.prototype.iuxor = function iuxor (num) { + // a.length > b.length + var a; + var b; + if (this.length > num.length) { + a = this; + b = num; + } else { + a = num; + b = this; + } + + for (var i = 0; i < b.length; i++) { + this.words[i] = a.words[i] ^ b.words[i]; + } + + if (this !== a) { + for (; i < a.length; i++) { + this.words[i] = a.words[i]; + } + } + + this.length = a.length; + + return this.strip(); + }; + + BN.prototype.ixor = function ixor (num) { + assert((this.negative | num.negative) === 0); + return this.iuxor(num); + }; + + // Xor `num` with `this` + BN.prototype.xor = function xor (num) { + if (this.length > num.length) return this.clone().ixor(num); + return num.clone().ixor(this); + }; + + BN.prototype.uxor = function uxor (num) { + if (this.length > num.length) return this.clone().iuxor(num); + return num.clone().iuxor(this); + }; + + // Not ``this`` with ``width`` bitwidth + BN.prototype.inotn = function inotn (width) { + assert(typeof width === 'number' && width >= 0); + + var bytesNeeded = Math.ceil(width / 26) | 0; + var bitsLeft = width % 26; + + // Extend the buffer with leading zeroes + this._expand(bytesNeeded); + + if (bitsLeft > 0) { + bytesNeeded--; + } + + // Handle complete words + for (var i = 0; i < bytesNeeded; i++) { + this.words[i] = ~this.words[i] & 0x3ffffff; + } + + // Handle the residue + if (bitsLeft > 0) { + this.words[i] = ~this.words[i] & (0x3ffffff >> (26 - bitsLeft)); + } + + // And remove leading zeroes + return this.strip(); + }; + + BN.prototype.notn = function notn (width) { + return this.clone().inotn(width); + }; + + // Set `bit` of `this` + BN.prototype.setn = function setn (bit, val) { + assert(typeof bit === 'number' && bit >= 0); + + var off = (bit / 26) | 0; + var wbit = bit % 26; + + this._expand(off + 1); + + if (val) { + this.words[off] = this.words[off] | (1 << wbit); + } else { + this.words[off] = this.words[off] & ~(1 << wbit); + } + + return this.strip(); + }; + + // Add `num` to `this` in-place + BN.prototype.iadd = function iadd (num) { + var r; + + // negative + positive + if (this.negative !== 0 && num.negative === 0) { + this.negative = 0; + r = this.isub(num); + this.negative ^= 1; + return this._normSign(); + + // positive + negative + } else if (this.negative === 0 && num.negative !== 0) { + num.negative = 0; + r = this.isub(num); + num.negative = 1; + return r._normSign(); + } + + // a.length > b.length + var a, b; + if (this.length > num.length) { + a = this; + b = num; + } else { + a = num; + b = this; + } + + var carry = 0; + for (var i = 0; i < b.length; i++) { + r = (a.words[i] | 0) + (b.words[i] | 0) + carry; + this.words[i] = r & 0x3ffffff; + carry = r >>> 26; + } + for (; carry !== 0 && i < a.length; i++) { + r = (a.words[i] | 0) + carry; + this.words[i] = r & 0x3ffffff; + carry = r >>> 26; + } + + this.length = a.length; + if (carry !== 0) { + this.words[this.length] = carry; + this.length++; + // Copy the rest of the words + } else if (a !== this) { + for (; i < a.length; i++) { + this.words[i] = a.words[i]; + } + } + + return this; + }; + + // Add `num` to `this` + BN.prototype.add = function add (num) { + var res; + if (num.negative !== 0 && this.negative === 0) { + num.negative = 0; + res = this.sub(num); + num.negative ^= 1; + return res; + } else if (num.negative === 0 && this.negative !== 0) { + this.negative = 0; + res = num.sub(this); + this.negative = 1; + return res; + } + + if (this.length > num.length) return this.clone().iadd(num); + + return num.clone().iadd(this); + }; + + // Subtract `num` from `this` in-place + BN.prototype.isub = function isub (num) { + // this - (-num) = this + num + if (num.negative !== 0) { + num.negative = 0; + var r = this.iadd(num); + num.negative = 1; + return r._normSign(); + + // -this - num = -(this + num) + } else if (this.negative !== 0) { + this.negative = 0; + this.iadd(num); + this.negative = 1; + return this._normSign(); + } + + // At this point both numbers are positive + var cmp = this.cmp(num); + + // Optimization - zeroify + if (cmp === 0) { + this.negative = 0; + this.length = 1; + this.words[0] = 0; + return this; + } + + // a > b + var a, b; + if (cmp > 0) { + a = this; + b = num; + } else { + a = num; + b = this; + } + + var carry = 0; + for (var i = 0; i < b.length; i++) { + r = (a.words[i] | 0) - (b.words[i] | 0) + carry; + carry = r >> 26; + this.words[i] = r & 0x3ffffff; + } + for (; carry !== 0 && i < a.length; i++) { + r = (a.words[i] | 0) + carry; + carry = r >> 26; + this.words[i] = r & 0x3ffffff; + } + + // Copy rest of the words + if (carry === 0 && i < a.length && a !== this) { + for (; i < a.length; i++) { + this.words[i] = a.words[i]; + } + } + + this.length = Math.max(this.length, i); + + if (a !== this) { + this.negative = 1; + } + + return this.strip(); + }; + + // Subtract `num` from `this` + BN.prototype.sub = function sub (num) { + return this.clone().isub(num); + }; + + function smallMulTo (self, num, out) { + out.negative = num.negative ^ self.negative; + var len = (self.length + num.length) | 0; + out.length = len; + len = (len - 1) | 0; + + // Peel one iteration (compiler can't do it, because of code complexity) + var a = self.words[0] | 0; + var b = num.words[0] | 0; + var r = a * b; + + var lo = r & 0x3ffffff; + var carry = (r / 0x4000000) | 0; + out.words[0] = lo; + + for (var k = 1; k < len; k++) { + // Sum all words with the same `i + j = k` and accumulate `ncarry`, + // note that ncarry could be >= 0x3ffffff + var ncarry = carry >>> 26; + var rword = carry & 0x3ffffff; + var maxJ = Math.min(k, num.length - 1); + for (var j = Math.max(0, k - self.length + 1); j <= maxJ; j++) { + var i = (k - j) | 0; + a = self.words[i] | 0; + b = num.words[j] | 0; + r = a * b + rword; + ncarry += (r / 0x4000000) | 0; + rword = r & 0x3ffffff; + } + out.words[k] = rword | 0; + carry = ncarry | 0; + } + if (carry !== 0) { + out.words[k] = carry | 0; + } else { + out.length--; + } + + return out.strip(); + } + + // TODO(indutny): it may be reasonable to omit it for users who don't need + // to work with 256-bit numbers, otherwise it gives 20% improvement for 256-bit + // multiplication (like elliptic secp256k1). + var comb10MulTo = function comb10MulTo (self, num, out) { + var a = self.words; + var b = num.words; + var o = out.words; + var c = 0; + var lo; + var mid; + var hi; + var a0 = a[0] | 0; + var al0 = a0 & 0x1fff; + var ah0 = a0 >>> 13; + var a1 = a[1] | 0; + var al1 = a1 & 0x1fff; + var ah1 = a1 >>> 13; + var a2 = a[2] | 0; + var al2 = a2 & 0x1fff; + var ah2 = a2 >>> 13; + var a3 = a[3] | 0; + var al3 = a3 & 0x1fff; + var ah3 = a3 >>> 13; + var a4 = a[4] | 0; + var al4 = a4 & 0x1fff; + var ah4 = a4 >>> 13; + var a5 = a[5] | 0; + var al5 = a5 & 0x1fff; + var ah5 = a5 >>> 13; + var a6 = a[6] | 0; + var al6 = a6 & 0x1fff; + var ah6 = a6 >>> 13; + var a7 = a[7] | 0; + var al7 = a7 & 0x1fff; + var ah7 = a7 >>> 13; + var a8 = a[8] | 0; + var al8 = a8 & 0x1fff; + var ah8 = a8 >>> 13; + var a9 = a[9] | 0; + var al9 = a9 & 0x1fff; + var ah9 = a9 >>> 13; + var b0 = b[0] | 0; + var bl0 = b0 & 0x1fff; + var bh0 = b0 >>> 13; + var b1 = b[1] | 0; + var bl1 = b1 & 0x1fff; + var bh1 = b1 >>> 13; + var b2 = b[2] | 0; + var bl2 = b2 & 0x1fff; + var bh2 = b2 >>> 13; + var b3 = b[3] | 0; + var bl3 = b3 & 0x1fff; + var bh3 = b3 >>> 13; + var b4 = b[4] | 0; + var bl4 = b4 & 0x1fff; + var bh4 = b4 >>> 13; + var b5 = b[5] | 0; + var bl5 = b5 & 0x1fff; + var bh5 = b5 >>> 13; + var b6 = b[6] | 0; + var bl6 = b6 & 0x1fff; + var bh6 = b6 >>> 13; + var b7 = b[7] | 0; + var bl7 = b7 & 0x1fff; + var bh7 = b7 >>> 13; + var b8 = b[8] | 0; + var bl8 = b8 & 0x1fff; + var bh8 = b8 >>> 13; + var b9 = b[9] | 0; + var bl9 = b9 & 0x1fff; + var bh9 = b9 >>> 13; + + out.negative = self.negative ^ num.negative; + out.length = 19; + /* k = 0 */ + lo = Math.imul(al0, bl0); + mid = Math.imul(al0, bh0); + mid = (mid + Math.imul(ah0, bl0)) | 0; + hi = Math.imul(ah0, bh0); + var w0 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w0 >>> 26)) | 0; + w0 &= 0x3ffffff; + /* k = 1 */ + lo = Math.imul(al1, bl0); + mid = Math.imul(al1, bh0); + mid = (mid + Math.imul(ah1, bl0)) | 0; + hi = Math.imul(ah1, bh0); + lo = (lo + Math.imul(al0, bl1)) | 0; + mid = (mid + Math.imul(al0, bh1)) | 0; + mid = (mid + Math.imul(ah0, bl1)) | 0; + hi = (hi + Math.imul(ah0, bh1)) | 0; + var w1 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w1 >>> 26)) | 0; + w1 &= 0x3ffffff; + /* k = 2 */ + lo = Math.imul(al2, bl0); + mid = Math.imul(al2, bh0); + mid = (mid + Math.imul(ah2, bl0)) | 0; + hi = Math.imul(ah2, bh0); + lo = (lo + Math.imul(al1, bl1)) | 0; + mid = (mid + Math.imul(al1, bh1)) | 0; + mid = (mid + Math.imul(ah1, bl1)) | 0; + hi = (hi + Math.imul(ah1, bh1)) | 0; + lo = (lo + Math.imul(al0, bl2)) | 0; + mid = (mid + Math.imul(al0, bh2)) | 0; + mid = (mid + Math.imul(ah0, bl2)) | 0; + hi = (hi + Math.imul(ah0, bh2)) | 0; + var w2 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w2 >>> 26)) | 0; + w2 &= 0x3ffffff; + /* k = 3 */ + lo = Math.imul(al3, bl0); + mid = Math.imul(al3, bh0); + mid = (mid + Math.imul(ah3, bl0)) | 0; + hi = Math.imul(ah3, bh0); + lo = (lo + Math.imul(al2, bl1)) | 0; + mid = (mid + Math.imul(al2, bh1)) | 0; + mid = (mid + Math.imul(ah2, bl1)) | 0; + hi = (hi + Math.imul(ah2, bh1)) | 0; + lo = (lo + Math.imul(al1, bl2)) | 0; + mid = (mid + Math.imul(al1, bh2)) | 0; + mid = (mid + Math.imul(ah1, bl2)) | 0; + hi = (hi + Math.imul(ah1, bh2)) | 0; + lo = (lo + Math.imul(al0, bl3)) | 0; + mid = (mid + Math.imul(al0, bh3)) | 0; + mid = (mid + Math.imul(ah0, bl3)) | 0; + hi = (hi + Math.imul(ah0, bh3)) | 0; + var w3 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w3 >>> 26)) | 0; + w3 &= 0x3ffffff; + /* k = 4 */ + lo = Math.imul(al4, bl0); + mid = Math.imul(al4, bh0); + mid = (mid + Math.imul(ah4, bl0)) | 0; + hi = Math.imul(ah4, bh0); + lo = (lo + Math.imul(al3, bl1)) | 0; + mid = (mid + Math.imul(al3, bh1)) | 0; + mid = (mid + Math.imul(ah3, bl1)) | 0; + hi = (hi + Math.imul(ah3, bh1)) | 0; + lo = (lo + Math.imul(al2, bl2)) | 0; + mid = (mid + Math.imul(al2, bh2)) | 0; + mid = (mid + Math.imul(ah2, bl2)) | 0; + hi = (hi + Math.imul(ah2, bh2)) | 0; + lo = (lo + Math.imul(al1, bl3)) | 0; + mid = (mid + Math.imul(al1, bh3)) | 0; + mid = (mid + Math.imul(ah1, bl3)) | 0; + hi = (hi + Math.imul(ah1, bh3)) | 0; + lo = (lo + Math.imul(al0, bl4)) | 0; + mid = (mid + Math.imul(al0, bh4)) | 0; + mid = (mid + Math.imul(ah0, bl4)) | 0; + hi = (hi + Math.imul(ah0, bh4)) | 0; + var w4 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w4 >>> 26)) | 0; + w4 &= 0x3ffffff; + /* k = 5 */ + lo = Math.imul(al5, bl0); + mid = Math.imul(al5, bh0); + mid = (mid + Math.imul(ah5, bl0)) | 0; + hi = Math.imul(ah5, bh0); + lo = (lo + Math.imul(al4, bl1)) | 0; + mid = (mid + Math.imul(al4, bh1)) | 0; + mid = (mid + Math.imul(ah4, bl1)) | 0; + hi = (hi + Math.imul(ah4, bh1)) | 0; + lo = (lo + Math.imul(al3, bl2)) | 0; + mid = (mid + Math.imul(al3, bh2)) | 0; + mid = (mid + Math.imul(ah3, bl2)) | 0; + hi = (hi + Math.imul(ah3, bh2)) | 0; + lo = (lo + Math.imul(al2, bl3)) | 0; + mid = (mid + Math.imul(al2, bh3)) | 0; + mid = (mid + Math.imul(ah2, bl3)) | 0; + hi = (hi + Math.imul(ah2, bh3)) | 0; + lo = (lo + Math.imul(al1, bl4)) | 0; + mid = (mid + Math.imul(al1, bh4)) | 0; + mid = (mid + Math.imul(ah1, bl4)) | 0; + hi = (hi + Math.imul(ah1, bh4)) | 0; + lo = (lo + Math.imul(al0, bl5)) | 0; + mid = (mid + Math.imul(al0, bh5)) | 0; + mid = (mid + Math.imul(ah0, bl5)) | 0; + hi = (hi + Math.imul(ah0, bh5)) | 0; + var w5 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w5 >>> 26)) | 0; + w5 &= 0x3ffffff; + /* k = 6 */ + lo = Math.imul(al6, bl0); + mid = Math.imul(al6, bh0); + mid = (mid + Math.imul(ah6, bl0)) | 0; + hi = Math.imul(ah6, bh0); + lo = (lo + Math.imul(al5, bl1)) | 0; + mid = (mid + Math.imul(al5, bh1)) | 0; + mid = (mid + Math.imul(ah5, bl1)) | 0; + hi = (hi + Math.imul(ah5, bh1)) | 0; + lo = (lo + Math.imul(al4, bl2)) | 0; + mid = (mid + Math.imul(al4, bh2)) | 0; + mid = (mid + Math.imul(ah4, bl2)) | 0; + hi = (hi + Math.imul(ah4, bh2)) | 0; + lo = (lo + Math.imul(al3, bl3)) | 0; + mid = (mid + Math.imul(al3, bh3)) | 0; + mid = (mid + Math.imul(ah3, bl3)) | 0; + hi = (hi + Math.imul(ah3, bh3)) | 0; + lo = (lo + Math.imul(al2, bl4)) | 0; + mid = (mid + Math.imul(al2, bh4)) | 0; + mid = (mid + Math.imul(ah2, bl4)) | 0; + hi = (hi + Math.imul(ah2, bh4)) | 0; + lo = (lo + Math.imul(al1, bl5)) | 0; + mid = (mid + Math.imul(al1, bh5)) | 0; + mid = (mid + Math.imul(ah1, bl5)) | 0; + hi = (hi + Math.imul(ah1, bh5)) | 0; + lo = (lo + Math.imul(al0, bl6)) | 0; + mid = (mid + Math.imul(al0, bh6)) | 0; + mid = (mid + Math.imul(ah0, bl6)) | 0; + hi = (hi + Math.imul(ah0, bh6)) | 0; + var w6 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w6 >>> 26)) | 0; + w6 &= 0x3ffffff; + /* k = 7 */ + lo = Math.imul(al7, bl0); + mid = Math.imul(al7, bh0); + mid = (mid + Math.imul(ah7, bl0)) | 0; + hi = Math.imul(ah7, bh0); + lo = (lo + Math.imul(al6, bl1)) | 0; + mid = (mid + Math.imul(al6, bh1)) | 0; + mid = (mid + Math.imul(ah6, bl1)) | 0; + hi = (hi + Math.imul(ah6, bh1)) | 0; + lo = (lo + Math.imul(al5, bl2)) | 0; + mid = (mid + Math.imul(al5, bh2)) | 0; + mid = (mid + Math.imul(ah5, bl2)) | 0; + hi = (hi + Math.imul(ah5, bh2)) | 0; + lo = (lo + Math.imul(al4, bl3)) | 0; + mid = (mid + Math.imul(al4, bh3)) | 0; + mid = (mid + Math.imul(ah4, bl3)) | 0; + hi = (hi + Math.imul(ah4, bh3)) | 0; + lo = (lo + Math.imul(al3, bl4)) | 0; + mid = (mid + Math.imul(al3, bh4)) | 0; + mid = (mid + Math.imul(ah3, bl4)) | 0; + hi = (hi + Math.imul(ah3, bh4)) | 0; + lo = (lo + Math.imul(al2, bl5)) | 0; + mid = (mid + Math.imul(al2, bh5)) | 0; + mid = (mid + Math.imul(ah2, bl5)) | 0; + hi = (hi + Math.imul(ah2, bh5)) | 0; + lo = (lo + Math.imul(al1, bl6)) | 0; + mid = (mid + Math.imul(al1, bh6)) | 0; + mid = (mid + Math.imul(ah1, bl6)) | 0; + hi = (hi + Math.imul(ah1, bh6)) | 0; + lo = (lo + Math.imul(al0, bl7)) | 0; + mid = (mid + Math.imul(al0, bh7)) | 0; + mid = (mid + Math.imul(ah0, bl7)) | 0; + hi = (hi + Math.imul(ah0, bh7)) | 0; + var w7 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w7 >>> 26)) | 0; + w7 &= 0x3ffffff; + /* k = 8 */ + lo = Math.imul(al8, bl0); + mid = Math.imul(al8, bh0); + mid = (mid + Math.imul(ah8, bl0)) | 0; + hi = Math.imul(ah8, bh0); + lo = (lo + Math.imul(al7, bl1)) | 0; + mid = (mid + Math.imul(al7, bh1)) | 0; + mid = (mid + Math.imul(ah7, bl1)) | 0; + hi = (hi + Math.imul(ah7, bh1)) | 0; + lo = (lo + Math.imul(al6, bl2)) | 0; + mid = (mid + Math.imul(al6, bh2)) | 0; + mid = (mid + Math.imul(ah6, bl2)) | 0; + hi = (hi + Math.imul(ah6, bh2)) | 0; + lo = (lo + Math.imul(al5, bl3)) | 0; + mid = (mid + Math.imul(al5, bh3)) | 0; + mid = (mid + Math.imul(ah5, bl3)) | 0; + hi = (hi + Math.imul(ah5, bh3)) | 0; + lo = (lo + Math.imul(al4, bl4)) | 0; + mid = (mid + Math.imul(al4, bh4)) | 0; + mid = (mid + Math.imul(ah4, bl4)) | 0; + hi = (hi + Math.imul(ah4, bh4)) | 0; + lo = (lo + Math.imul(al3, bl5)) | 0; + mid = (mid + Math.imul(al3, bh5)) | 0; + mid = (mid + Math.imul(ah3, bl5)) | 0; + hi = (hi + Math.imul(ah3, bh5)) | 0; + lo = (lo + Math.imul(al2, bl6)) | 0; + mid = (mid + Math.imul(al2, bh6)) | 0; + mid = (mid + Math.imul(ah2, bl6)) | 0; + hi = (hi + Math.imul(ah2, bh6)) | 0; + lo = (lo + Math.imul(al1, bl7)) | 0; + mid = (mid + Math.imul(al1, bh7)) | 0; + mid = (mid + Math.imul(ah1, bl7)) | 0; + hi = (hi + Math.imul(ah1, bh7)) | 0; + lo = (lo + Math.imul(al0, bl8)) | 0; + mid = (mid + Math.imul(al0, bh8)) | 0; + mid = (mid + Math.imul(ah0, bl8)) | 0; + hi = (hi + Math.imul(ah0, bh8)) | 0; + var w8 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w8 >>> 26)) | 0; + w8 &= 0x3ffffff; + /* k = 9 */ + lo = Math.imul(al9, bl0); + mid = Math.imul(al9, bh0); + mid = (mid + Math.imul(ah9, bl0)) | 0; + hi = Math.imul(ah9, bh0); + lo = (lo + Math.imul(al8, bl1)) | 0; + mid = (mid + Math.imul(al8, bh1)) | 0; + mid = (mid + Math.imul(ah8, bl1)) | 0; + hi = (hi + Math.imul(ah8, bh1)) | 0; + lo = (lo + Math.imul(al7, bl2)) | 0; + mid = (mid + Math.imul(al7, bh2)) | 0; + mid = (mid + Math.imul(ah7, bl2)) | 0; + hi = (hi + Math.imul(ah7, bh2)) | 0; + lo = (lo + Math.imul(al6, bl3)) | 0; + mid = (mid + Math.imul(al6, bh3)) | 0; + mid = (mid + Math.imul(ah6, bl3)) | 0; + hi = (hi + Math.imul(ah6, bh3)) | 0; + lo = (lo + Math.imul(al5, bl4)) | 0; + mid = (mid + Math.imul(al5, bh4)) | 0; + mid = (mid + Math.imul(ah5, bl4)) | 0; + hi = (hi + Math.imul(ah5, bh4)) | 0; + lo = (lo + Math.imul(al4, bl5)) | 0; + mid = (mid + Math.imul(al4, bh5)) | 0; + mid = (mid + Math.imul(ah4, bl5)) | 0; + hi = (hi + Math.imul(ah4, bh5)) | 0; + lo = (lo + Math.imul(al3, bl6)) | 0; + mid = (mid + Math.imul(al3, bh6)) | 0; + mid = (mid + Math.imul(ah3, bl6)) | 0; + hi = (hi + Math.imul(ah3, bh6)) | 0; + lo = (lo + Math.imul(al2, bl7)) | 0; + mid = (mid + Math.imul(al2, bh7)) | 0; + mid = (mid + Math.imul(ah2, bl7)) | 0; + hi = (hi + Math.imul(ah2, bh7)) | 0; + lo = (lo + Math.imul(al1, bl8)) | 0; + mid = (mid + Math.imul(al1, bh8)) | 0; + mid = (mid + Math.imul(ah1, bl8)) | 0; + hi = (hi + Math.imul(ah1, bh8)) | 0; + lo = (lo + Math.imul(al0, bl9)) | 0; + mid = (mid + Math.imul(al0, bh9)) | 0; + mid = (mid + Math.imul(ah0, bl9)) | 0; + hi = (hi + Math.imul(ah0, bh9)) | 0; + var w9 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w9 >>> 26)) | 0; + w9 &= 0x3ffffff; + /* k = 10 */ + lo = Math.imul(al9, bl1); + mid = Math.imul(al9, bh1); + mid = (mid + Math.imul(ah9, bl1)) | 0; + hi = Math.imul(ah9, bh1); + lo = (lo + Math.imul(al8, bl2)) | 0; + mid = (mid + Math.imul(al8, bh2)) | 0; + mid = (mid + Math.imul(ah8, bl2)) | 0; + hi = (hi + Math.imul(ah8, bh2)) | 0; + lo = (lo + Math.imul(al7, bl3)) | 0; + mid = (mid + Math.imul(al7, bh3)) | 0; + mid = (mid + Math.imul(ah7, bl3)) | 0; + hi = (hi + Math.imul(ah7, bh3)) | 0; + lo = (lo + Math.imul(al6, bl4)) | 0; + mid = (mid + Math.imul(al6, bh4)) | 0; + mid = (mid + Math.imul(ah6, bl4)) | 0; + hi = (hi + Math.imul(ah6, bh4)) | 0; + lo = (lo + Math.imul(al5, bl5)) | 0; + mid = (mid + Math.imul(al5, bh5)) | 0; + mid = (mid + Math.imul(ah5, bl5)) | 0; + hi = (hi + Math.imul(ah5, bh5)) | 0; + lo = (lo + Math.imul(al4, bl6)) | 0; + mid = (mid + Math.imul(al4, bh6)) | 0; + mid = (mid + Math.imul(ah4, bl6)) | 0; + hi = (hi + Math.imul(ah4, bh6)) | 0; + lo = (lo + Math.imul(al3, bl7)) | 0; + mid = (mid + Math.imul(al3, bh7)) | 0; + mid = (mid + Math.imul(ah3, bl7)) | 0; + hi = (hi + Math.imul(ah3, bh7)) | 0; + lo = (lo + Math.imul(al2, bl8)) | 0; + mid = (mid + Math.imul(al2, bh8)) | 0; + mid = (mid + Math.imul(ah2, bl8)) | 0; + hi = (hi + Math.imul(ah2, bh8)) | 0; + lo = (lo + Math.imul(al1, bl9)) | 0; + mid = (mid + Math.imul(al1, bh9)) | 0; + mid = (mid + Math.imul(ah1, bl9)) | 0; + hi = (hi + Math.imul(ah1, bh9)) | 0; + var w10 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w10 >>> 26)) | 0; + w10 &= 0x3ffffff; + /* k = 11 */ + lo = Math.imul(al9, bl2); + mid = Math.imul(al9, bh2); + mid = (mid + Math.imul(ah9, bl2)) | 0; + hi = Math.imul(ah9, bh2); + lo = (lo + Math.imul(al8, bl3)) | 0; + mid = (mid + Math.imul(al8, bh3)) | 0; + mid = (mid + Math.imul(ah8, bl3)) | 0; + hi = (hi + Math.imul(ah8, bh3)) | 0; + lo = (lo + Math.imul(al7, bl4)) | 0; + mid = (mid + Math.imul(al7, bh4)) | 0; + mid = (mid + Math.imul(ah7, bl4)) | 0; + hi = (hi + Math.imul(ah7, bh4)) | 0; + lo = (lo + Math.imul(al6, bl5)) | 0; + mid = (mid + Math.imul(al6, bh5)) | 0; + mid = (mid + Math.imul(ah6, bl5)) | 0; + hi = (hi + Math.imul(ah6, bh5)) | 0; + lo = (lo + Math.imul(al5, bl6)) | 0; + mid = (mid + Math.imul(al5, bh6)) | 0; + mid = (mid + Math.imul(ah5, bl6)) | 0; + hi = (hi + Math.imul(ah5, bh6)) | 0; + lo = (lo + Math.imul(al4, bl7)) | 0; + mid = (mid + Math.imul(al4, bh7)) | 0; + mid = (mid + Math.imul(ah4, bl7)) | 0; + hi = (hi + Math.imul(ah4, bh7)) | 0; + lo = (lo + Math.imul(al3, bl8)) | 0; + mid = (mid + Math.imul(al3, bh8)) | 0; + mid = (mid + Math.imul(ah3, bl8)) | 0; + hi = (hi + Math.imul(ah3, bh8)) | 0; + lo = (lo + Math.imul(al2, bl9)) | 0; + mid = (mid + Math.imul(al2, bh9)) | 0; + mid = (mid + Math.imul(ah2, bl9)) | 0; + hi = (hi + Math.imul(ah2, bh9)) | 0; + var w11 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w11 >>> 26)) | 0; + w11 &= 0x3ffffff; + /* k = 12 */ + lo = Math.imul(al9, bl3); + mid = Math.imul(al9, bh3); + mid = (mid + Math.imul(ah9, bl3)) | 0; + hi = Math.imul(ah9, bh3); + lo = (lo + Math.imul(al8, bl4)) | 0; + mid = (mid + Math.imul(al8, bh4)) | 0; + mid = (mid + Math.imul(ah8, bl4)) | 0; + hi = (hi + Math.imul(ah8, bh4)) | 0; + lo = (lo + Math.imul(al7, bl5)) | 0; + mid = (mid + Math.imul(al7, bh5)) | 0; + mid = (mid + Math.imul(ah7, bl5)) | 0; + hi = (hi + Math.imul(ah7, bh5)) | 0; + lo = (lo + Math.imul(al6, bl6)) | 0; + mid = (mid + Math.imul(al6, bh6)) | 0; + mid = (mid + Math.imul(ah6, bl6)) | 0; + hi = (hi + Math.imul(ah6, bh6)) | 0; + lo = (lo + Math.imul(al5, bl7)) | 0; + mid = (mid + Math.imul(al5, bh7)) | 0; + mid = (mid + Math.imul(ah5, bl7)) | 0; + hi = (hi + Math.imul(ah5, bh7)) | 0; + lo = (lo + Math.imul(al4, bl8)) | 0; + mid = (mid + Math.imul(al4, bh8)) | 0; + mid = (mid + Math.imul(ah4, bl8)) | 0; + hi = (hi + Math.imul(ah4, bh8)) | 0; + lo = (lo + Math.imul(al3, bl9)) | 0; + mid = (mid + Math.imul(al3, bh9)) | 0; + mid = (mid + Math.imul(ah3, bl9)) | 0; + hi = (hi + Math.imul(ah3, bh9)) | 0; + var w12 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w12 >>> 26)) | 0; + w12 &= 0x3ffffff; + /* k = 13 */ + lo = Math.imul(al9, bl4); + mid = Math.imul(al9, bh4); + mid = (mid + Math.imul(ah9, bl4)) | 0; + hi = Math.imul(ah9, bh4); + lo = (lo + Math.imul(al8, bl5)) | 0; + mid = (mid + Math.imul(al8, bh5)) | 0; + mid = (mid + Math.imul(ah8, bl5)) | 0; + hi = (hi + Math.imul(ah8, bh5)) | 0; + lo = (lo + Math.imul(al7, bl6)) | 0; + mid = (mid + Math.imul(al7, bh6)) | 0; + mid = (mid + Math.imul(ah7, bl6)) | 0; + hi = (hi + Math.imul(ah7, bh6)) | 0; + lo = (lo + Math.imul(al6, bl7)) | 0; + mid = (mid + Math.imul(al6, bh7)) | 0; + mid = (mid + Math.imul(ah6, bl7)) | 0; + hi = (hi + Math.imul(ah6, bh7)) | 0; + lo = (lo + Math.imul(al5, bl8)) | 0; + mid = (mid + Math.imul(al5, bh8)) | 0; + mid = (mid + Math.imul(ah5, bl8)) | 0; + hi = (hi + Math.imul(ah5, bh8)) | 0; + lo = (lo + Math.imul(al4, bl9)) | 0; + mid = (mid + Math.imul(al4, bh9)) | 0; + mid = (mid + Math.imul(ah4, bl9)) | 0; + hi = (hi + Math.imul(ah4, bh9)) | 0; + var w13 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w13 >>> 26)) | 0; + w13 &= 0x3ffffff; + /* k = 14 */ + lo = Math.imul(al9, bl5); + mid = Math.imul(al9, bh5); + mid = (mid + Math.imul(ah9, bl5)) | 0; + hi = Math.imul(ah9, bh5); + lo = (lo + Math.imul(al8, bl6)) | 0; + mid = (mid + Math.imul(al8, bh6)) | 0; + mid = (mid + Math.imul(ah8, bl6)) | 0; + hi = (hi + Math.imul(ah8, bh6)) | 0; + lo = (lo + Math.imul(al7, bl7)) | 0; + mid = (mid + Math.imul(al7, bh7)) | 0; + mid = (mid + Math.imul(ah7, bl7)) | 0; + hi = (hi + Math.imul(ah7, bh7)) | 0; + lo = (lo + Math.imul(al6, bl8)) | 0; + mid = (mid + Math.imul(al6, bh8)) | 0; + mid = (mid + Math.imul(ah6, bl8)) | 0; + hi = (hi + Math.imul(ah6, bh8)) | 0; + lo = (lo + Math.imul(al5, bl9)) | 0; + mid = (mid + Math.imul(al5, bh9)) | 0; + mid = (mid + Math.imul(ah5, bl9)) | 0; + hi = (hi + Math.imul(ah5, bh9)) | 0; + var w14 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w14 >>> 26)) | 0; + w14 &= 0x3ffffff; + /* k = 15 */ + lo = Math.imul(al9, bl6); + mid = Math.imul(al9, bh6); + mid = (mid + Math.imul(ah9, bl6)) | 0; + hi = Math.imul(ah9, bh6); + lo = (lo + Math.imul(al8, bl7)) | 0; + mid = (mid + Math.imul(al8, bh7)) | 0; + mid = (mid + Math.imul(ah8, bl7)) | 0; + hi = (hi + Math.imul(ah8, bh7)) | 0; + lo = (lo + Math.imul(al7, bl8)) | 0; + mid = (mid + Math.imul(al7, bh8)) | 0; + mid = (mid + Math.imul(ah7, bl8)) | 0; + hi = (hi + Math.imul(ah7, bh8)) | 0; + lo = (lo + Math.imul(al6, bl9)) | 0; + mid = (mid + Math.imul(al6, bh9)) | 0; + mid = (mid + Math.imul(ah6, bl9)) | 0; + hi = (hi + Math.imul(ah6, bh9)) | 0; + var w15 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w15 >>> 26)) | 0; + w15 &= 0x3ffffff; + /* k = 16 */ + lo = Math.imul(al9, bl7); + mid = Math.imul(al9, bh7); + mid = (mid + Math.imul(ah9, bl7)) | 0; + hi = Math.imul(ah9, bh7); + lo = (lo + Math.imul(al8, bl8)) | 0; + mid = (mid + Math.imul(al8, bh8)) | 0; + mid = (mid + Math.imul(ah8, bl8)) | 0; + hi = (hi + Math.imul(ah8, bh8)) | 0; + lo = (lo + Math.imul(al7, bl9)) | 0; + mid = (mid + Math.imul(al7, bh9)) | 0; + mid = (mid + Math.imul(ah7, bl9)) | 0; + hi = (hi + Math.imul(ah7, bh9)) | 0; + var w16 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w16 >>> 26)) | 0; + w16 &= 0x3ffffff; + /* k = 17 */ + lo = Math.imul(al9, bl8); + mid = Math.imul(al9, bh8); + mid = (mid + Math.imul(ah9, bl8)) | 0; + hi = Math.imul(ah9, bh8); + lo = (lo + Math.imul(al8, bl9)) | 0; + mid = (mid + Math.imul(al8, bh9)) | 0; + mid = (mid + Math.imul(ah8, bl9)) | 0; + hi = (hi + Math.imul(ah8, bh9)) | 0; + var w17 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w17 >>> 26)) | 0; + w17 &= 0x3ffffff; + /* k = 18 */ + lo = Math.imul(al9, bl9); + mid = Math.imul(al9, bh9); + mid = (mid + Math.imul(ah9, bl9)) | 0; + hi = Math.imul(ah9, bh9); + var w18 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w18 >>> 26)) | 0; + w18 &= 0x3ffffff; + o[0] = w0; + o[1] = w1; + o[2] = w2; + o[3] = w3; + o[4] = w4; + o[5] = w5; + o[6] = w6; + o[7] = w7; + o[8] = w8; + o[9] = w9; + o[10] = w10; + o[11] = w11; + o[12] = w12; + o[13] = w13; + o[14] = w14; + o[15] = w15; + o[16] = w16; + o[17] = w17; + o[18] = w18; + if (c !== 0) { + o[19] = c; + out.length++; + } + return out; + }; + + // Polyfill comb + if (!Math.imul) { + comb10MulTo = smallMulTo; + } + + function bigMulTo (self, num, out) { + out.negative = num.negative ^ self.negative; + out.length = self.length + num.length; + + var carry = 0; + var hncarry = 0; + for (var k = 0; k < out.length - 1; k++) { + // Sum all words with the same `i + j = k` and accumulate `ncarry`, + // note that ncarry could be >= 0x3ffffff + var ncarry = hncarry; + hncarry = 0; + var rword = carry & 0x3ffffff; + var maxJ = Math.min(k, num.length - 1); + for (var j = Math.max(0, k - self.length + 1); j <= maxJ; j++) { + var i = k - j; + var a = self.words[i] | 0; + var b = num.words[j] | 0; + var r = a * b; + + var lo = r & 0x3ffffff; + ncarry = (ncarry + ((r / 0x4000000) | 0)) | 0; + lo = (lo + rword) | 0; + rword = lo & 0x3ffffff; + ncarry = (ncarry + (lo >>> 26)) | 0; + + hncarry += ncarry >>> 26; + ncarry &= 0x3ffffff; + } + out.words[k] = rword; + carry = ncarry; + ncarry = hncarry; + } + if (carry !== 0) { + out.words[k] = carry; + } else { + out.length--; + } + + return out.strip(); + } + + function jumboMulTo (self, num, out) { + var fftm = new FFTM(); + return fftm.mulp(self, num, out); + } + + BN.prototype.mulTo = function mulTo (num, out) { + var res; + var len = this.length + num.length; + if (this.length === 10 && num.length === 10) { + res = comb10MulTo(this, num, out); + } else if (len < 63) { + res = smallMulTo(this, num, out); + } else if (len < 1024) { + res = bigMulTo(this, num, out); + } else { + res = jumboMulTo(this, num, out); + } + + return res; + }; + + // Cooley-Tukey algorithm for FFT + // slightly revisited to rely on looping instead of recursion + + function FFTM (x, y) { + this.x = x; + this.y = y; + } + + FFTM.prototype.makeRBT = function makeRBT (N) { + var t = new Array(N); + var l = BN.prototype._countBits(N) - 1; + for (var i = 0; i < N; i++) { + t[i] = this.revBin(i, l, N); + } + + return t; + }; + + // Returns binary-reversed representation of `x` + FFTM.prototype.revBin = function revBin (x, l, N) { + if (x === 0 || x === N - 1) return x; + + var rb = 0; + for (var i = 0; i < l; i++) { + rb |= (x & 1) << (l - i - 1); + x >>= 1; + } + + return rb; + }; + + // Performs "tweedling" phase, therefore 'emulating' + // behaviour of the recursive algorithm + FFTM.prototype.permute = function permute (rbt, rws, iws, rtws, itws, N) { + for (var i = 0; i < N; i++) { + rtws[i] = rws[rbt[i]]; + itws[i] = iws[rbt[i]]; + } + }; + + FFTM.prototype.transform = function transform (rws, iws, rtws, itws, N, rbt) { + this.permute(rbt, rws, iws, rtws, itws, N); + + for (var s = 1; s < N; s <<= 1) { + var l = s << 1; + + var rtwdf = Math.cos(2 * Math.PI / l); + var itwdf = Math.sin(2 * Math.PI / l); + + for (var p = 0; p < N; p += l) { + var rtwdf_ = rtwdf; + var itwdf_ = itwdf; + + for (var j = 0; j < s; j++) { + var re = rtws[p + j]; + var ie = itws[p + j]; + + var ro = rtws[p + j + s]; + var io = itws[p + j + s]; + + var rx = rtwdf_ * ro - itwdf_ * io; + + io = rtwdf_ * io + itwdf_ * ro; + ro = rx; + + rtws[p + j] = re + ro; + itws[p + j] = ie + io; + + rtws[p + j + s] = re - ro; + itws[p + j + s] = ie - io; + + /* jshint maxdepth : false */ + if (j !== l) { + rx = rtwdf * rtwdf_ - itwdf * itwdf_; + + itwdf_ = rtwdf * itwdf_ + itwdf * rtwdf_; + rtwdf_ = rx; + } + } + } + } + }; + + FFTM.prototype.guessLen13b = function guessLen13b (n, m) { + var N = Math.max(m, n) | 1; + var odd = N & 1; + var i = 0; + for (N = N / 2 | 0; N; N = N >>> 1) { + i++; + } + + return 1 << i + 1 + odd; + }; + + FFTM.prototype.conjugate = function conjugate (rws, iws, N) { + if (N <= 1) return; + + for (var i = 0; i < N / 2; i++) { + var t = rws[i]; + + rws[i] = rws[N - i - 1]; + rws[N - i - 1] = t; + + t = iws[i]; + + iws[i] = -iws[N - i - 1]; + iws[N - i - 1] = -t; + } + }; + + FFTM.prototype.normalize13b = function normalize13b (ws, N) { + var carry = 0; + for (var i = 0; i < N / 2; i++) { + var w = Math.round(ws[2 * i + 1] / N) * 0x2000 + + Math.round(ws[2 * i] / N) + + carry; + + ws[i] = w & 0x3ffffff; + + if (w < 0x4000000) { + carry = 0; + } else { + carry = w / 0x4000000 | 0; + } + } + + return ws; + }; + + FFTM.prototype.convert13b = function convert13b (ws, len, rws, N) { + var carry = 0; + for (var i = 0; i < len; i++) { + carry = carry + (ws[i] | 0); + + rws[2 * i] = carry & 0x1fff; carry = carry >>> 13; + rws[2 * i + 1] = carry & 0x1fff; carry = carry >>> 13; + } + + // Pad with zeroes + for (i = 2 * len; i < N; ++i) { + rws[i] = 0; + } + + assert(carry === 0); + assert((carry & ~0x1fff) === 0); + }; + + FFTM.prototype.stub = function stub (N) { + var ph = new Array(N); + for (var i = 0; i < N; i++) { + ph[i] = 0; + } + + return ph; + }; + + FFTM.prototype.mulp = function mulp (x, y, out) { + var N = 2 * this.guessLen13b(x.length, y.length); + + var rbt = this.makeRBT(N); + + var _ = this.stub(N); + + var rws = new Array(N); + var rwst = new Array(N); + var iwst = new Array(N); + + var nrws = new Array(N); + var nrwst = new Array(N); + var niwst = new Array(N); + + var rmws = out.words; + rmws.length = N; + + this.convert13b(x.words, x.length, rws, N); + this.convert13b(y.words, y.length, nrws, N); + + this.transform(rws, _, rwst, iwst, N, rbt); + this.transform(nrws, _, nrwst, niwst, N, rbt); + + for (var i = 0; i < N; i++) { + var rx = rwst[i] * nrwst[i] - iwst[i] * niwst[i]; + iwst[i] = rwst[i] * niwst[i] + iwst[i] * nrwst[i]; + rwst[i] = rx; + } + + this.conjugate(rwst, iwst, N); + this.transform(rwst, iwst, rmws, _, N, rbt); + this.conjugate(rmws, _, N); + this.normalize13b(rmws, N); + + out.negative = x.negative ^ y.negative; + out.length = x.length + y.length; + return out.strip(); + }; + + // Multiply `this` by `num` + BN.prototype.mul = function mul (num) { + var out = new BN(null); + out.words = new Array(this.length + num.length); + return this.mulTo(num, out); + }; + + // Multiply employing FFT + BN.prototype.mulf = function mulf (num) { + var out = new BN(null); + out.words = new Array(this.length + num.length); + return jumboMulTo(this, num, out); + }; + + // In-place Multiplication + BN.prototype.imul = function imul (num) { + return this.clone().mulTo(num, this); + }; + + BN.prototype.imuln = function imuln (num) { + assert(typeof num === 'number'); + assert(num < 0x4000000); + + // Carry + var carry = 0; + for (var i = 0; i < this.length; i++) { + var w = (this.words[i] | 0) * num; + var lo = (w & 0x3ffffff) + (carry & 0x3ffffff); + carry >>= 26; + carry += (w / 0x4000000) | 0; + // NOTE: lo is 27bit maximum + carry += lo >>> 26; + this.words[i] = lo & 0x3ffffff; + } + + if (carry !== 0) { + this.words[i] = carry; + this.length++; + } + + return this; + }; + + BN.prototype.muln = function muln (num) { + return this.clone().imuln(num); + }; + + // `this` * `this` + BN.prototype.sqr = function sqr () { + return this.mul(this); + }; + + // `this` * `this` in-place + BN.prototype.isqr = function isqr () { + return this.imul(this.clone()); + }; + + // Math.pow(`this`, `num`) + BN.prototype.pow = function pow (num) { + var w = toBitArray(num); + if (w.length === 0) return new BN(1); + + // Skip leading zeroes + var res = this; + for (var i = 0; i < w.length; i++, res = res.sqr()) { + if (w[i] !== 0) break; + } + + if (++i < w.length) { + for (var q = res.sqr(); i < w.length; i++, q = q.sqr()) { + if (w[i] === 0) continue; + + res = res.mul(q); + } + } + + return res; + }; + + // Shift-left in-place + BN.prototype.iushln = function iushln (bits) { + assert(typeof bits === 'number' && bits >= 0); + var r = bits % 26; + var s = (bits - r) / 26; + var carryMask = (0x3ffffff >>> (26 - r)) << (26 - r); + var i; + + if (r !== 0) { + var carry = 0; + + for (i = 0; i < this.length; i++) { + var newCarry = this.words[i] & carryMask; + var c = ((this.words[i] | 0) - newCarry) << r; + this.words[i] = c | carry; + carry = newCarry >>> (26 - r); + } + + if (carry) { + this.words[i] = carry; + this.length++; + } + } + + if (s !== 0) { + for (i = this.length - 1; i >= 0; i--) { + this.words[i + s] = this.words[i]; + } + + for (i = 0; i < s; i++) { + this.words[i] = 0; + } + + this.length += s; + } + + return this.strip(); + }; + + BN.prototype.ishln = function ishln (bits) { + // TODO(indutny): implement me + assert(this.negative === 0); + return this.iushln(bits); + }; + + // Shift-right in-place + // NOTE: `hint` is a lowest bit before trailing zeroes + // NOTE: if `extended` is present - it will be filled with destroyed bits + BN.prototype.iushrn = function iushrn (bits, hint, extended) { + assert(typeof bits === 'number' && bits >= 0); + var h; + if (hint) { + h = (hint - (hint % 26)) / 26; + } else { + h = 0; + } + + var r = bits % 26; + var s = Math.min((bits - r) / 26, this.length); + var mask = 0x3ffffff ^ ((0x3ffffff >>> r) << r); + var maskedWords = extended; + + h -= s; + h = Math.max(0, h); + + // Extended mode, copy masked part + if (maskedWords) { + for (var i = 0; i < s; i++) { + maskedWords.words[i] = this.words[i]; + } + maskedWords.length = s; + } + + if (s === 0) { + // No-op, we should not move anything at all + } else if (this.length > s) { + this.length -= s; + for (i = 0; i < this.length; i++) { + this.words[i] = this.words[i + s]; + } + } else { + this.words[0] = 0; + this.length = 1; + } + + var carry = 0; + for (i = this.length - 1; i >= 0 && (carry !== 0 || i >= h); i--) { + var word = this.words[i] | 0; + this.words[i] = (carry << (26 - r)) | (word >>> r); + carry = word & mask; + } + + // Push carried bits as a mask + if (maskedWords && carry !== 0) { + maskedWords.words[maskedWords.length++] = carry; + } + + if (this.length === 0) { + this.words[0] = 0; + this.length = 1; + } + + return this.strip(); + }; + + BN.prototype.ishrn = function ishrn (bits, hint, extended) { + // TODO(indutny): implement me + assert(this.negative === 0); + return this.iushrn(bits, hint, extended); + }; + + // Shift-left + BN.prototype.shln = function shln (bits) { + return this.clone().ishln(bits); + }; + + BN.prototype.ushln = function ushln (bits) { + return this.clone().iushln(bits); + }; + + // Shift-right + BN.prototype.shrn = function shrn (bits) { + return this.clone().ishrn(bits); + }; + + BN.prototype.ushrn = function ushrn (bits) { + return this.clone().iushrn(bits); + }; + + // Test if n bit is set + BN.prototype.testn = function testn (bit) { + assert(typeof bit === 'number' && bit >= 0); + var r = bit % 26; + var s = (bit - r) / 26; + var q = 1 << r; + + // Fast case: bit is much higher than all existing words + if (this.length <= s) return false; + + // Check bit and return + var w = this.words[s]; + + return !!(w & q); + }; + + // Return only lowers bits of number (in-place) + BN.prototype.imaskn = function imaskn (bits) { + assert(typeof bits === 'number' && bits >= 0); + var r = bits % 26; + var s = (bits - r) / 26; + + assert(this.negative === 0, 'imaskn works only with positive numbers'); + + if (this.length <= s) { + return this; + } + + if (r !== 0) { + s++; + } + this.length = Math.min(s, this.length); + + if (r !== 0) { + var mask = 0x3ffffff ^ ((0x3ffffff >>> r) << r); + this.words[this.length - 1] &= mask; + } + + return this.strip(); + }; + + // Return only lowers bits of number + BN.prototype.maskn = function maskn (bits) { + return this.clone().imaskn(bits); + }; + + // Add plain number `num` to `this` + BN.prototype.iaddn = function iaddn (num) { + assert(typeof num === 'number'); + assert(num < 0x4000000); + if (num < 0) return this.isubn(-num); + + // Possible sign change + if (this.negative !== 0) { + if (this.length === 1 && (this.words[0] | 0) < num) { + this.words[0] = num - (this.words[0] | 0); + this.negative = 0; + return this; + } + + this.negative = 0; + this.isubn(num); + this.negative = 1; + return this; + } + + // Add without checks + return this._iaddn(num); + }; + + BN.prototype._iaddn = function _iaddn (num) { + this.words[0] += num; + + // Carry + for (var i = 0; i < this.length && this.words[i] >= 0x4000000; i++) { + this.words[i] -= 0x4000000; + if (i === this.length - 1) { + this.words[i + 1] = 1; + } else { + this.words[i + 1]++; + } + } + this.length = Math.max(this.length, i + 1); + + return this; + }; + + // Subtract plain number `num` from `this` + BN.prototype.isubn = function isubn (num) { + assert(typeof num === 'number'); + assert(num < 0x4000000); + if (num < 0) return this.iaddn(-num); + + if (this.negative !== 0) { + this.negative = 0; + this.iaddn(num); + this.negative = 1; + return this; + } + + this.words[0] -= num; + + if (this.length === 1 && this.words[0] < 0) { + this.words[0] = -this.words[0]; + this.negative = 1; + } else { + // Carry + for (var i = 0; i < this.length && this.words[i] < 0; i++) { + this.words[i] += 0x4000000; + this.words[i + 1] -= 1; + } + } + + return this.strip(); + }; + + BN.prototype.addn = function addn (num) { + return this.clone().iaddn(num); + }; + + BN.prototype.subn = function subn (num) { + return this.clone().isubn(num); + }; + + BN.prototype.iabs = function iabs () { + this.negative = 0; + + return this; + }; + + BN.prototype.abs = function abs () { + return this.clone().iabs(); + }; + + BN.prototype._ishlnsubmul = function _ishlnsubmul (num, mul, shift) { + var len = num.length + shift; + var i; + + this._expand(len); + + var w; + var carry = 0; + for (i = 0; i < num.length; i++) { + w = (this.words[i + shift] | 0) + carry; + var right = (num.words[i] | 0) * mul; + w -= right & 0x3ffffff; + carry = (w >> 26) - ((right / 0x4000000) | 0); + this.words[i + shift] = w & 0x3ffffff; + } + for (; i < this.length - shift; i++) { + w = (this.words[i + shift] | 0) + carry; + carry = w >> 26; + this.words[i + shift] = w & 0x3ffffff; + } + + if (carry === 0) return this.strip(); + + // Subtraction overflow + assert(carry === -1); + carry = 0; + for (i = 0; i < this.length; i++) { + w = -(this.words[i] | 0) + carry; + carry = w >> 26; + this.words[i] = w & 0x3ffffff; + } + this.negative = 1; + + return this.strip(); + }; + + BN.prototype._wordDiv = function _wordDiv (num, mode) { + var shift = this.length - num.length; + + var a = this.clone(); + var b = num; + + // Normalize + var bhi = b.words[b.length - 1] | 0; + var bhiBits = this._countBits(bhi); + shift = 26 - bhiBits; + if (shift !== 0) { + b = b.ushln(shift); + a.iushln(shift); + bhi = b.words[b.length - 1] | 0; + } + + // Initialize quotient + var m = a.length - b.length; + var q; + + if (mode !== 'mod') { + q = new BN(null); + q.length = m + 1; + q.words = new Array(q.length); + for (var i = 0; i < q.length; i++) { + q.words[i] = 0; + } + } + + var diff = a.clone()._ishlnsubmul(b, 1, m); + if (diff.negative === 0) { + a = diff; + if (q) { + q.words[m] = 1; + } + } + + for (var j = m - 1; j >= 0; j--) { + var qj = (a.words[b.length + j] | 0) * 0x4000000 + + (a.words[b.length + j - 1] | 0); + + // NOTE: (qj / bhi) is (0x3ffffff * 0x4000000 + 0x3ffffff) / 0x2000000 max + // (0x7ffffff) + qj = Math.min((qj / bhi) | 0, 0x3ffffff); + + a._ishlnsubmul(b, qj, j); + while (a.negative !== 0) { + qj--; + a.negative = 0; + a._ishlnsubmul(b, 1, j); + if (!a.isZero()) { + a.negative ^= 1; + } + } + if (q) { + q.words[j] = qj; + } + } + if (q) { + q.strip(); + } + a.strip(); + + // Denormalize + if (mode !== 'div' && shift !== 0) { + a.iushrn(shift); + } + + return { + div: q || null, + mod: a + }; + }; + + // NOTE: 1) `mode` can be set to `mod` to request mod only, + // to `div` to request div only, or be absent to + // request both div & mod + // 2) `positive` is true if unsigned mod is requested + BN.prototype.divmod = function divmod (num, mode, positive) { + assert(!num.isZero()); + + if (this.isZero()) { + return { + div: new BN(0), + mod: new BN(0) + }; + } + + var div, mod, res; + if (this.negative !== 0 && num.negative === 0) { + res = this.neg().divmod(num, mode); + + if (mode !== 'mod') { + div = res.div.neg(); + } + + if (mode !== 'div') { + mod = res.mod.neg(); + if (positive && mod.negative !== 0) { + mod.iadd(num); + } + } + + return { + div: div, + mod: mod + }; + } + + if (this.negative === 0 && num.negative !== 0) { + res = this.divmod(num.neg(), mode); + + if (mode !== 'mod') { + div = res.div.neg(); + } + + return { + div: div, + mod: res.mod + }; + } + + if ((this.negative & num.negative) !== 0) { + res = this.neg().divmod(num.neg(), mode); + + if (mode !== 'div') { + mod = res.mod.neg(); + if (positive && mod.negative !== 0) { + mod.isub(num); + } + } + + return { + div: res.div, + mod: mod + }; + } + + // Both numbers are positive at this point + + // Strip both numbers to approximate shift value + if (num.length > this.length || this.cmp(num) < 0) { + return { + div: new BN(0), + mod: this + }; + } + + // Very short reduction + if (num.length === 1) { + if (mode === 'div') { + return { + div: this.divn(num.words[0]), + mod: null + }; + } + + if (mode === 'mod') { + return { + div: null, + mod: new BN(this.modn(num.words[0])) + }; + } + + return { + div: this.divn(num.words[0]), + mod: new BN(this.modn(num.words[0])) + }; + } + + return this._wordDiv(num, mode); + }; + + // Find `this` / `num` + BN.prototype.div = function div (num) { + return this.divmod(num, 'div', false).div; + }; + + // Find `this` % `num` + BN.prototype.mod = function mod (num) { + return this.divmod(num, 'mod', false).mod; + }; + + BN.prototype.umod = function umod (num) { + return this.divmod(num, 'mod', true).mod; + }; + + // Find Round(`this` / `num`) + BN.prototype.divRound = function divRound (num) { + var dm = this.divmod(num); + + // Fast case - exact division + if (dm.mod.isZero()) return dm.div; + + var mod = dm.div.negative !== 0 ? dm.mod.isub(num) : dm.mod; + + var half = num.ushrn(1); + var r2 = num.andln(1); + var cmp = mod.cmp(half); + + // Round down + if (cmp < 0 || r2 === 1 && cmp === 0) return dm.div; + + // Round up + return dm.div.negative !== 0 ? dm.div.isubn(1) : dm.div.iaddn(1); + }; + + BN.prototype.modn = function modn (num) { + assert(num <= 0x3ffffff); + var p = (1 << 26) % num; + + var acc = 0; + for (var i = this.length - 1; i >= 0; i--) { + acc = (p * acc + (this.words[i] | 0)) % num; + } + + return acc; + }; + + // In-place division by number + BN.prototype.idivn = function idivn (num) { + assert(num <= 0x3ffffff); + + var carry = 0; + for (var i = this.length - 1; i >= 0; i--) { + var w = (this.words[i] | 0) + carry * 0x4000000; + this.words[i] = (w / num) | 0; + carry = w % num; + } + + return this.strip(); + }; + + BN.prototype.divn = function divn (num) { + return this.clone().idivn(num); + }; + + BN.prototype.egcd = function egcd (p) { + assert(p.negative === 0); + assert(!p.isZero()); + + var x = this; + var y = p.clone(); + + if (x.negative !== 0) { + x = x.umod(p); + } else { + x = x.clone(); + } + + // A * x + B * y = x + var A = new BN(1); + var B = new BN(0); + + // C * x + D * y = y + var C = new BN(0); + var D = new BN(1); + + var g = 0; + + while (x.isEven() && y.isEven()) { + x.iushrn(1); + y.iushrn(1); + ++g; + } + + var yp = y.clone(); + var xp = x.clone(); + + while (!x.isZero()) { + for (var i = 0, im = 1; (x.words[0] & im) === 0 && i < 26; ++i, im <<= 1); + if (i > 0) { + x.iushrn(i); + while (i-- > 0) { + if (A.isOdd() || B.isOdd()) { + A.iadd(yp); + B.isub(xp); + } + + A.iushrn(1); + B.iushrn(1); + } + } + + for (var j = 0, jm = 1; (y.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1); + if (j > 0) { + y.iushrn(j); + while (j-- > 0) { + if (C.isOdd() || D.isOdd()) { + C.iadd(yp); + D.isub(xp); + } + + C.iushrn(1); + D.iushrn(1); + } + } + + if (x.cmp(y) >= 0) { + x.isub(y); + A.isub(C); + B.isub(D); + } else { + y.isub(x); + C.isub(A); + D.isub(B); + } + } + + return { + a: C, + b: D, + gcd: y.iushln(g) + }; + }; + + // This is reduced incarnation of the binary EEA + // above, designated to invert members of the + // _prime_ fields F(p) at a maximal speed + BN.prototype._invmp = function _invmp (p) { + assert(p.negative === 0); + assert(!p.isZero()); + + var a = this; + var b = p.clone(); + + if (a.negative !== 0) { + a = a.umod(p); + } else { + a = a.clone(); + } + + var x1 = new BN(1); + var x2 = new BN(0); + + var delta = b.clone(); + + while (a.cmpn(1) > 0 && b.cmpn(1) > 0) { + for (var i = 0, im = 1; (a.words[0] & im) === 0 && i < 26; ++i, im <<= 1); + if (i > 0) { + a.iushrn(i); + while (i-- > 0) { + if (x1.isOdd()) { + x1.iadd(delta); + } + + x1.iushrn(1); + } + } + + for (var j = 0, jm = 1; (b.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1); + if (j > 0) { + b.iushrn(j); + while (j-- > 0) { + if (x2.isOdd()) { + x2.iadd(delta); + } + + x2.iushrn(1); + } + } + + if (a.cmp(b) >= 0) { + a.isub(b); + x1.isub(x2); + } else { + b.isub(a); + x2.isub(x1); + } + } + + var res; + if (a.cmpn(1) === 0) { + res = x1; + } else { + res = x2; + } + + if (res.cmpn(0) < 0) { + res.iadd(p); + } + + return res; + }; + + BN.prototype.gcd = function gcd (num) { + if (this.isZero()) return num.abs(); + if (num.isZero()) return this.abs(); + + var a = this.clone(); + var b = num.clone(); + a.negative = 0; + b.negative = 0; + + // Remove common factor of two + for (var shift = 0; a.isEven() && b.isEven(); shift++) { + a.iushrn(1); + b.iushrn(1); + } + + do { + while (a.isEven()) { + a.iushrn(1); + } + while (b.isEven()) { + b.iushrn(1); + } + + var r = a.cmp(b); + if (r < 0) { + // Swap `a` and `b` to make `a` always bigger than `b` + var t = a; + a = b; + b = t; + } else if (r === 0 || b.cmpn(1) === 0) { + break; + } + + a.isub(b); + } while (true); + + return b.iushln(shift); + }; + + // Invert number in the field F(num) + BN.prototype.invm = function invm (num) { + return this.egcd(num).a.umod(num); + }; + + BN.prototype.isEven = function isEven () { + return (this.words[0] & 1) === 0; + }; + + BN.prototype.isOdd = function isOdd () { + return (this.words[0] & 1) === 1; + }; + + // And first word and num + BN.prototype.andln = function andln (num) { + return this.words[0] & num; + }; + + // Increment at the bit position in-line + BN.prototype.bincn = function bincn (bit) { + assert(typeof bit === 'number'); + var r = bit % 26; + var s = (bit - r) / 26; + var q = 1 << r; + + // Fast case: bit is much higher than all existing words + if (this.length <= s) { + this._expand(s + 1); + this.words[s] |= q; + return this; + } + + // Add bit and propagate, if needed + var carry = q; + for (var i = s; carry !== 0 && i < this.length; i++) { + var w = this.words[i] | 0; + w += carry; + carry = w >>> 26; + w &= 0x3ffffff; + this.words[i] = w; + } + if (carry !== 0) { + this.words[i] = carry; + this.length++; + } + return this; + }; + + BN.prototype.isZero = function isZero () { + return this.length === 1 && this.words[0] === 0; + }; + + BN.prototype.cmpn = function cmpn (num) { + var negative = num < 0; + + if (this.negative !== 0 && !negative) return -1; + if (this.negative === 0 && negative) return 1; + + this.strip(); + + var res; + if (this.length > 1) { + res = 1; + } else { + if (negative) { + num = -num; + } + + assert(num <= 0x3ffffff, 'Number is too big'); + + var w = this.words[0] | 0; + res = w === num ? 0 : w < num ? -1 : 1; + } + if (this.negative !== 0) return -res | 0; + return res; + }; + + // Compare two numbers and return: + // 1 - if `this` > `num` + // 0 - if `this` == `num` + // -1 - if `this` < `num` + BN.prototype.cmp = function cmp (num) { + if (this.negative !== 0 && num.negative === 0) return -1; + if (this.negative === 0 && num.negative !== 0) return 1; + + var res = this.ucmp(num); + if (this.negative !== 0) return -res | 0; + return res; + }; + + // Unsigned comparison + BN.prototype.ucmp = function ucmp (num) { + // At this point both numbers have the same sign + if (this.length > num.length) return 1; + if (this.length < num.length) return -1; + + var res = 0; + for (var i = this.length - 1; i >= 0; i--) { + var a = this.words[i] | 0; + var b = num.words[i] | 0; + + if (a === b) continue; + if (a < b) { + res = -1; + } else if (a > b) { + res = 1; + } + break; + } + return res; + }; + + BN.prototype.gtn = function gtn (num) { + return this.cmpn(num) === 1; + }; + + BN.prototype.gt = function gt (num) { + return this.cmp(num) === 1; + }; + + BN.prototype.gten = function gten (num) { + return this.cmpn(num) >= 0; + }; + + BN.prototype.gte = function gte (num) { + return this.cmp(num) >= 0; + }; + + BN.prototype.ltn = function ltn (num) { + return this.cmpn(num) === -1; + }; + + BN.prototype.lt = function lt (num) { + return this.cmp(num) === -1; + }; + + BN.prototype.lten = function lten (num) { + return this.cmpn(num) <= 0; + }; + + BN.prototype.lte = function lte (num) { + return this.cmp(num) <= 0; + }; + + BN.prototype.eqn = function eqn (num) { + return this.cmpn(num) === 0; + }; + + BN.prototype.eq = function eq (num) { + return this.cmp(num) === 0; + }; + + // + // A reduce context, could be using montgomery or something better, depending + // on the `m` itself. + // + BN.red = function red (num) { + return new Red(num); + }; + + BN.prototype.toRed = function toRed (ctx) { + assert(!this.red, 'Already a number in reduction context'); + assert(this.negative === 0, 'red works only with positives'); + return ctx.convertTo(this)._forceRed(ctx); + }; + + BN.prototype.fromRed = function fromRed () { + assert(this.red, 'fromRed works only with numbers in reduction context'); + return this.red.convertFrom(this); + }; + + BN.prototype._forceRed = function _forceRed (ctx) { + this.red = ctx; + return this; + }; + + BN.prototype.forceRed = function forceRed (ctx) { + assert(!this.red, 'Already a number in reduction context'); + return this._forceRed(ctx); + }; + + BN.prototype.redAdd = function redAdd (num) { + assert(this.red, 'redAdd works only with red numbers'); + return this.red.add(this, num); + }; + + BN.prototype.redIAdd = function redIAdd (num) { + assert(this.red, 'redIAdd works only with red numbers'); + return this.red.iadd(this, num); + }; + + BN.prototype.redSub = function redSub (num) { + assert(this.red, 'redSub works only with red numbers'); + return this.red.sub(this, num); + }; + + BN.prototype.redISub = function redISub (num) { + assert(this.red, 'redISub works only with red numbers'); + return this.red.isub(this, num); + }; + + BN.prototype.redShl = function redShl (num) { + assert(this.red, 'redShl works only with red numbers'); + return this.red.shl(this, num); + }; + + BN.prototype.redMul = function redMul (num) { + assert(this.red, 'redMul works only with red numbers'); + this.red._verify2(this, num); + return this.red.mul(this, num); + }; + + BN.prototype.redIMul = function redIMul (num) { + assert(this.red, 'redMul works only with red numbers'); + this.red._verify2(this, num); + return this.red.imul(this, num); + }; + + BN.prototype.redSqr = function redSqr () { + assert(this.red, 'redSqr works only with red numbers'); + this.red._verify1(this); + return this.red.sqr(this); + }; + + BN.prototype.redISqr = function redISqr () { + assert(this.red, 'redISqr works only with red numbers'); + this.red._verify1(this); + return this.red.isqr(this); + }; + + // Square root over p + BN.prototype.redSqrt = function redSqrt () { + assert(this.red, 'redSqrt works only with red numbers'); + this.red._verify1(this); + return this.red.sqrt(this); + }; + + BN.prototype.redInvm = function redInvm () { + assert(this.red, 'redInvm works only with red numbers'); + this.red._verify1(this); + return this.red.invm(this); + }; + + // Return negative clone of `this` % `red modulo` + BN.prototype.redNeg = function redNeg () { + assert(this.red, 'redNeg works only with red numbers'); + this.red._verify1(this); + return this.red.neg(this); + }; + + BN.prototype.redPow = function redPow (num) { + assert(this.red && !num.red, 'redPow(normalNum)'); + this.red._verify1(this); + return this.red.pow(this, num); + }; + + // Prime numbers with efficient reduction + var primes = { + k256: null, + p224: null, + p192: null, + p25519: null + }; + + // Pseudo-Mersenne prime + function MPrime (name, p) { + // P = 2 ^ N - K + this.name = name; + this.p = new BN(p, 16); + this.n = this.p.bitLength(); + this.k = new BN(1).iushln(this.n).isub(this.p); + + this.tmp = this._tmp(); + } + + MPrime.prototype._tmp = function _tmp () { + var tmp = new BN(null); + tmp.words = new Array(Math.ceil(this.n / 13)); + return tmp; + }; + + MPrime.prototype.ireduce = function ireduce (num) { + // Assumes that `num` is less than `P^2` + // num = HI * (2 ^ N - K) + HI * K + LO = HI * K + LO (mod P) + var r = num; + var rlen; + + do { + this.split(r, this.tmp); + r = this.imulK(r); + r = r.iadd(this.tmp); + rlen = r.bitLength(); + } while (rlen > this.n); + + var cmp = rlen < this.n ? -1 : r.ucmp(this.p); + if (cmp === 0) { + r.words[0] = 0; + r.length = 1; + } else if (cmp > 0) { + r.isub(this.p); + } else { + r.strip(); + } + + return r; + }; + + MPrime.prototype.split = function split (input, out) { + input.iushrn(this.n, 0, out); + }; + + MPrime.prototype.imulK = function imulK (num) { + return num.imul(this.k); + }; + + function K256 () { + MPrime.call( + this, + 'k256', + 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f'); + } + inherits(K256, MPrime); + + K256.prototype.split = function split (input, output) { + // 256 = 9 * 26 + 22 + var mask = 0x3fffff; + + var outLen = Math.min(input.length, 9); + for (var i = 0; i < outLen; i++) { + output.words[i] = input.words[i]; + } + output.length = outLen; + + if (input.length <= 9) { + input.words[0] = 0; + input.length = 1; + return; + } + + // Shift by 9 limbs + var prev = input.words[9]; + output.words[output.length++] = prev & mask; + + for (i = 10; i < input.length; i++) { + var next = input.words[i] | 0; + input.words[i - 10] = ((next & mask) << 4) | (prev >>> 22); + prev = next; + } + prev >>>= 22; + input.words[i - 10] = prev; + if (prev === 0 && input.length > 10) { + input.length -= 10; + } else { + input.length -= 9; + } + }; + + K256.prototype.imulK = function imulK (num) { + // K = 0x1000003d1 = [ 0x40, 0x3d1 ] + num.words[num.length] = 0; + num.words[num.length + 1] = 0; + num.length += 2; + + // bounded at: 0x40 * 0x3ffffff + 0x3d0 = 0x100000390 + var lo = 0; + for (var i = 0; i < num.length; i++) { + var w = num.words[i] | 0; + lo += w * 0x3d1; + num.words[i] = lo & 0x3ffffff; + lo = w * 0x40 + ((lo / 0x4000000) | 0); + } + + // Fast length reduction + if (num.words[num.length - 1] === 0) { + num.length--; + if (num.words[num.length - 1] === 0) { + num.length--; + } + } + return num; + }; + + function P224 () { + MPrime.call( + this, + 'p224', + 'ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001'); + } + inherits(P224, MPrime); + + function P192 () { + MPrime.call( + this, + 'p192', + 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff'); + } + inherits(P192, MPrime); + + function P25519 () { + // 2 ^ 255 - 19 + MPrime.call( + this, + '25519', + '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed'); + } + inherits(P25519, MPrime); + + P25519.prototype.imulK = function imulK (num) { + // K = 0x13 + var carry = 0; + for (var i = 0; i < num.length; i++) { + var hi = (num.words[i] | 0) * 0x13 + carry; + var lo = hi & 0x3ffffff; + hi >>>= 26; + + num.words[i] = lo; + carry = hi; + } + if (carry !== 0) { + num.words[num.length++] = carry; + } + return num; + }; + + // Exported mostly for testing purposes, use plain name instead + BN._prime = function prime (name) { + // Cached version of prime + if (primes[name]) return primes[name]; + + var prime; + if (name === 'k256') { + prime = new K256(); + } else if (name === 'p224') { + prime = new P224(); + } else if (name === 'p192') { + prime = new P192(); + } else if (name === 'p25519') { + prime = new P25519(); + } else { + throw new Error('Unknown prime ' + name); + } + primes[name] = prime; + + return prime; + }; + + // + // Base reduction engine + // + function Red (m) { + if (typeof m === 'string') { + var prime = BN._prime(m); + this.m = prime.p; + this.prime = prime; + } else { + assert(m.gtn(1), 'modulus must be greater than 1'); + this.m = m; + this.prime = null; + } + } + + Red.prototype._verify1 = function _verify1 (a) { + assert(a.negative === 0, 'red works only with positives'); + assert(a.red, 'red works only with red numbers'); + }; + + Red.prototype._verify2 = function _verify2 (a, b) { + assert((a.negative | b.negative) === 0, 'red works only with positives'); + assert(a.red && a.red === b.red, + 'red works only with red numbers'); + }; + + Red.prototype.imod = function imod (a) { + if (this.prime) return this.prime.ireduce(a)._forceRed(this); + return a.umod(this.m)._forceRed(this); + }; + + Red.prototype.neg = function neg (a) { + if (a.isZero()) { + return a.clone(); + } + + return this.m.sub(a)._forceRed(this); + }; + + Red.prototype.add = function add (a, b) { + this._verify2(a, b); + + var res = a.add(b); + if (res.cmp(this.m) >= 0) { + res.isub(this.m); + } + return res._forceRed(this); + }; + + Red.prototype.iadd = function iadd (a, b) { + this._verify2(a, b); + + var res = a.iadd(b); + if (res.cmp(this.m) >= 0) { + res.isub(this.m); + } + return res; + }; + + Red.prototype.sub = function sub (a, b) { + this._verify2(a, b); + + var res = a.sub(b); + if (res.cmpn(0) < 0) { + res.iadd(this.m); + } + return res._forceRed(this); + }; + + Red.prototype.isub = function isub (a, b) { + this._verify2(a, b); + + var res = a.isub(b); + if (res.cmpn(0) < 0) { + res.iadd(this.m); + } + return res; + }; + + Red.prototype.shl = function shl (a, num) { + this._verify1(a); + return this.imod(a.ushln(num)); + }; + + Red.prototype.imul = function imul (a, b) { + this._verify2(a, b); + return this.imod(a.imul(b)); + }; + + Red.prototype.mul = function mul (a, b) { + this._verify2(a, b); + return this.imod(a.mul(b)); + }; + + Red.prototype.isqr = function isqr (a) { + return this.imul(a, a.clone()); + }; + + Red.prototype.sqr = function sqr (a) { + return this.mul(a, a); + }; + + Red.prototype.sqrt = function sqrt (a) { + if (a.isZero()) return a.clone(); + + var mod3 = this.m.andln(3); + assert(mod3 % 2 === 1); + + // Fast case + if (mod3 === 3) { + var pow = this.m.add(new BN(1)).iushrn(2); + return this.pow(a, pow); + } + + // Tonelli-Shanks algorithm (Totally unoptimized and slow) + // + // Find Q and S, that Q * 2 ^ S = (P - 1) + var q = this.m.subn(1); + var s = 0; + while (!q.isZero() && q.andln(1) === 0) { + s++; + q.iushrn(1); + } + assert(!q.isZero()); + + var one = new BN(1).toRed(this); + var nOne = one.redNeg(); + + // Find quadratic non-residue + // NOTE: Max is such because of generalized Riemann hypothesis. + var lpow = this.m.subn(1).iushrn(1); + var z = this.m.bitLength(); + z = new BN(2 * z * z).toRed(this); + + while (this.pow(z, lpow).cmp(nOne) !== 0) { + z.redIAdd(nOne); + } + + var c = this.pow(z, q); + var r = this.pow(a, q.addn(1).iushrn(1)); + var t = this.pow(a, q); + var m = s; + while (t.cmp(one) !== 0) { + var tmp = t; + for (var i = 0; tmp.cmp(one) !== 0; i++) { + tmp = tmp.redSqr(); + } + assert(i < m); + var b = this.pow(c, new BN(1).iushln(m - i - 1)); + + r = r.redMul(b); + c = b.redSqr(); + t = t.redMul(c); + m = i; + } + + return r; + }; + + Red.prototype.invm = function invm (a) { + var inv = a._invmp(this.m); + if (inv.negative !== 0) { + inv.negative = 0; + return this.imod(inv).redNeg(); + } else { + return this.imod(inv); + } + }; + + Red.prototype.pow = function pow (a, num) { + if (num.isZero()) return new BN(1); + if (num.cmpn(1) === 0) return a.clone(); + + var windowSize = 4; + var wnd = new Array(1 << windowSize); + wnd[0] = new BN(1).toRed(this); + wnd[1] = a; + for (var i = 2; i < wnd.length; i++) { + wnd[i] = this.mul(wnd[i - 1], a); + } + + var res = wnd[0]; + var current = 0; + var currentLen = 0; + var start = num.bitLength() % 26; + if (start === 0) { + start = 26; + } + + for (i = num.length - 1; i >= 0; i--) { + var word = num.words[i]; + for (var j = start - 1; j >= 0; j--) { + var bit = (word >> j) & 1; + if (res !== wnd[0]) { + res = this.sqr(res); + } + + if (bit === 0 && current === 0) { + currentLen = 0; + continue; + } + + current <<= 1; + current |= bit; + currentLen++; + if (currentLen !== windowSize && (i !== 0 || j !== 0)) continue; + + res = this.mul(res, wnd[current]); + currentLen = 0; + current = 0; + } + start = 26; + } + + return res; + }; + + Red.prototype.convertTo = function convertTo (num) { + var r = num.umod(this.m); + + return r === num ? r.clone() : r; + }; + + Red.prototype.convertFrom = function convertFrom (num) { + var res = num.clone(); + res.red = null; + return res; + }; + + // + // Montgomery method engine + // + + BN.mont = function mont (num) { + return new Mont(num); + }; + + function Mont (m) { + Red.call(this, m); + + this.shift = this.m.bitLength(); + if (this.shift % 26 !== 0) { + this.shift += 26 - (this.shift % 26); + } + + this.r = new BN(1).iushln(this.shift); + this.r2 = this.imod(this.r.sqr()); + this.rinv = this.r._invmp(this.m); + + this.minv = this.rinv.mul(this.r).isubn(1).div(this.m); + this.minv = this.minv.umod(this.r); + this.minv = this.r.sub(this.minv); + } + inherits(Mont, Red); + + Mont.prototype.convertTo = function convertTo (num) { + return this.imod(num.ushln(this.shift)); + }; + + Mont.prototype.convertFrom = function convertFrom (num) { + var r = this.imod(num.mul(this.rinv)); + r.red = null; + return r; + }; + + Mont.prototype.imul = function imul (a, b) { + if (a.isZero() || b.isZero()) { + a.words[0] = 0; + a.length = 1; + return a; + } + + var t = a.imul(b); + var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m); + var u = t.isub(c).iushrn(this.shift); + var res = u; + + if (u.cmp(this.m) >= 0) { + res = u.isub(this.m); + } else if (u.cmpn(0) < 0) { + res = u.iadd(this.m); + } + + return res._forceRed(this); + }; + + Mont.prototype.mul = function mul (a, b) { + if (a.isZero() || b.isZero()) return new BN(0)._forceRed(this); + + var t = a.mul(b); + var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m); + var u = t.isub(c).iushrn(this.shift); + var res = u; + if (u.cmp(this.m) >= 0) { + res = u.isub(this.m); + } else if (u.cmpn(0) < 0) { + res = u.iadd(this.m); + } + + return res._forceRed(this); + }; + + Mont.prototype.invm = function invm (a) { + // (AR)^-1 * R^2 = (A^-1 * R^-1) * R^2 = A^-1 * R + var res = this.imod(a._invmp(this.m).mul(this.r2)); + return res._forceRed(this); + }; +})(typeof module === 'undefined' || module, this); + +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(117)(module))) /***/ }, /* 5 */ -/***/ function(module, exports, __webpack_require__) { +/***/ function(module, exports) { - /* WEBPACK VAR INJECTION */(function(process) {exports.Package = __webpack_require__(6); +// shim for using process in browser +var process = module.exports = {}; - /** - * Options for a Client. - * @typedef {Object} ClientOptions - * @property {string} [apiRequestMethod='sequential'] 'sequential' or 'burst'. Sequential executes all requests in - * the order they are triggered, whereas burst runs multiple at a time, and doesn't guarantee a particular order. - * @property {number} [shardId=0] The ID of this shard - * @property {number} [shardCount=0] The number of shards - * @property {number} [messageCacheMaxSize=200] Maximum number of messages to cache per channel - * (-1 or Infinity for unlimited - don't do this without message sweeping, otherwise memory usage will climb - * indefinitely) - * @property {number} [messageCacheLifetime=0] How long until a message should be uncached by the message sweeping - * (in seconds, 0 for forever) - * @property {number} [messageSweepInterval=0] How frequently to remove messages from the cache that are older than - * the message cache lifetime (in seconds, 0 for never) - * @property {boolean} [fetchAllMembers=false] Whether to cache all guild members and users upon startup, as well as - * upon joining a guild - * @property {boolean} [disableEveryone=false] Default value for MessageOptions.disableEveryone - * @property {boolean} [sync=false] Whether to periodically sync guilds (for userbots) - * @property {number} [restWsBridgeTimeout=5000] Maximum time permitted between REST responses and their - * corresponding websocket events - * @property {string[]} [disabledEvents] An array of disabled websocket events. Events in this array will not be - * processed. Disabling useless events such as 'TYPING_START' can result in significant performance increases on - * large-scale bots. - * @property {WebsocketOptions} [ws] Options for the websocket - */ - exports.DefaultOptions = { - apiRequestMethod: 'sequential', - shardId: 0, - shardCount: 0, - messageCacheMaxSize: 200, - messageCacheLifetime: 0, - messageSweepInterval: 0, - fetchAllMembers: false, - disableEveryone: false, - sync: false, - restWsBridgeTimeout: 5000, - disabledEvents: [], +// cached from whatever global is present so that test runners that stub it +// don't break things. But we need to wrap it in a try catch in case it is +// wrapped in strict mode code which doesn't define any globals. It's inside a +// function because try/catches deoptimize in certain engines. - /** - * Websocket options. These are left as snake_case to match the API. - * @typedef {Object} WebsocketOptions - * @property {number} [large_threshold=250] Number of members in a guild to be considered large - * @property {boolean} [compress=true] Whether to compress data sent on the connection. - * Defaults to `false` for browsers. - */ - ws: { - large_threshold: 250, - compress: typeof window === 'undefined', - properties: { - $os: process ? process.platform : 'discord.js', - $browser: 'discord.js', - $device: 'discord.js', - $referrer: '', - $referring_domain: '', - }, - }, - }; +var cachedSetTimeout; +var cachedClearTimeout; - exports.Errors = { - NO_TOKEN: 'Request to use token, but token was unavailable to the client.', - NO_BOT_ACCOUNT: 'Only bot accounts are able to make use of this feature.', - NO_USER_ACCOUNT: 'Only user accounts are able to make use of this feature.', - BAD_WS_MESSAGE: 'A bad message was received from the websocket; either bad compression, or not JSON.', - TOOK_TOO_LONG: 'Something took too long to do.', - NOT_A_PERMISSION: 'Invalid permission string or number.', - INVALID_RATE_LIMIT_METHOD: 'Unknown rate limiting method.', - BAD_LOGIN: 'Incorrect login details were provided.', - INVALID_SHARD: 'Invalid shard settings were provided.', - }; +function defaultSetTimout() { + throw new Error('setTimeout has not been defined'); +} +function defaultClearTimeout () { + throw new Error('clearTimeout has not been defined'); +} +(function () { + try { + if (typeof setTimeout === 'function') { + cachedSetTimeout = setTimeout; + } else { + cachedSetTimeout = defaultSetTimout; + } + } catch (e) { + cachedSetTimeout = defaultSetTimout; + } + try { + if (typeof clearTimeout === 'function') { + cachedClearTimeout = clearTimeout; + } else { + cachedClearTimeout = defaultClearTimeout; + } + } catch (e) { + cachedClearTimeout = defaultClearTimeout; + } +} ()) +function runTimeout(fun) { + if (cachedSetTimeout === setTimeout) { + //normal enviroments in sane situations + return setTimeout(fun, 0); + } + // if setTimeout wasn't available but was latter defined + if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { + cachedSetTimeout = setTimeout; + return setTimeout(fun, 0); + } + try { + // when when somebody has screwed with setTimeout but no I.E. maddness + return cachedSetTimeout(fun, 0); + } catch(e){ + try { + // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally + return cachedSetTimeout.call(null, fun, 0); + } catch(e){ + // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error + return cachedSetTimeout.call(this, fun, 0); + } + } - const PROTOCOL_VERSION = exports.PROTOCOL_VERSION = 6; - const API = exports.API = `https://discordapp.com/api/v${PROTOCOL_VERSION}`; - const Endpoints = exports.Endpoints = { - // general - login: `${API}/auth/login`, - logout: `${API}/auth/logout`, - gateway: `${API}/gateway`, - botGateway: `${API}/gateway/bot`, - invite: (id) => `${API}/invite/${id}`, - inviteLink: (id) => `https://discord.gg/${id}`, - CDN: 'https://cdn.discordapp.com', - // users - user: (userID) => `${API}/users/${userID}`, - userChannels: (userID) => `${Endpoints.user(userID)}/channels`, - userProfile: (userID) => `${Endpoints.user(userID)}/profile`, - avatar: (userID, avatar) => userID === '1' ? avatar : `${Endpoints.user(userID)}/avatars/${avatar}.jpg`, - me: `${API}/users/@me`, - meGuild: (guildID) => `${Endpoints.me}/guilds/${guildID}`, - relationships: (userID) => `${Endpoints.user(userID)}/relationships`, - note: (userID) => `${Endpoints.me}/notes/${userID}`, +} +function runClearTimeout(marker) { + if (cachedClearTimeout === clearTimeout) { + //normal enviroments in sane situations + return clearTimeout(marker); + } + // if clearTimeout wasn't available but was latter defined + if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { + cachedClearTimeout = clearTimeout; + return clearTimeout(marker); + } + try { + // when when somebody has screwed with setTimeout but no I.E. maddness + return cachedClearTimeout(marker); + } catch (e){ + try { + // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally + return cachedClearTimeout.call(null, marker); + } catch (e){ + // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. + // Some versions of I.E. have different rules for clearTimeout vs setTimeout + return cachedClearTimeout.call(this, marker); + } + } - // guilds - guilds: `${API}/guilds`, - guild: (guildID) => `${Endpoints.guilds}/${guildID}`, - guildIcon: (guildID, hash) => `${Endpoints.guild(guildID)}/icons/${hash}.jpg`, - guildPrune: (guildID) => `${Endpoints.guild(guildID)}/prune`, - guildEmbed: (guildID) => `${Endpoints.guild(guildID)}/embed`, - guildInvites: (guildID) => `${Endpoints.guild(guildID)}/invites`, - guildRoles: (guildID) => `${Endpoints.guild(guildID)}/roles`, - guildRole: (guildID, roleID) => `${Endpoints.guildRoles(guildID)}/${roleID}`, - guildBans: (guildID) => `${Endpoints.guild(guildID)}/bans`, - guildIntegrations: (guildID) => `${Endpoints.guild(guildID)}/integrations`, - guildMembers: (guildID) => `${Endpoints.guild(guildID)}/members`, - guildMember: (guildID, memberID) => `${Endpoints.guildMembers(guildID)}/${memberID}`, - stupidInconsistentGuildEndpoint: (guildID) => `${Endpoints.guildMember(guildID, '@me')}/nick`, - guildChannels: (guildID) => `${Endpoints.guild(guildID)}/channels`, - guildEmojis: (guildID) => `${Endpoints.guild(guildID)}/emojis`, - // channels - channels: `${API}/channels`, - channel: (channelID) => `${Endpoints.channels}/${channelID}`, - channelMessages: (channelID) => `${Endpoints.channel(channelID)}/messages`, - channelInvites: (channelID) => `${Endpoints.channel(channelID)}/invites`, - channelTyping: (channelID) => `${Endpoints.channel(channelID)}/typing`, - channelPermissions: (channelID) => `${Endpoints.channel(channelID)}/permissions`, - channelMessage: (channelID, messageID) => `${Endpoints.channelMessages(channelID)}/${messageID}`, - channelWebhooks: (channelID) => `${Endpoints.channel(channelID)}/webhooks`, - // message reactions - messageReactions: (channelID, messageID) => `${Endpoints.channelMessage(channelID, messageID)}/reactions`, - messageReaction: - (channel, msg, emoji, limit) => - `${Endpoints.messageReactions(channel, msg)}/${emoji}` + - `${limit ? `?limit=${limit}` : ''}`, - selfMessageReaction: (channel, msg, emoji, limit) => - `${Endpoints.messageReaction(channel, msg, emoji, limit)}/@me`, - userMessageReaction: (channel, msg, emoji, limit, id) => - `${Endpoints.messageReaction(channel, msg, emoji, limit)}/${id}`, +} +var queue = []; +var draining = false; +var currentQueue; +var queueIndex = -1; - // webhooks - webhook: (webhookID, token) => `${API}/webhooks/${webhookID}${token ? `/${token}` : ''}`, +function cleanUpNextTick() { + if (!draining || !currentQueue) { + return; + } + draining = false; + if (currentQueue.length) { + queue = currentQueue.concat(queue); + } else { + queueIndex = -1; + } + if (queue.length) { + drainQueue(); + } +} - // oauth - myApplication: `${API}/oauth2/applications/@me`, - getApp: (id) => `${API}/oauth2/authorize?client_id=${id}`, - }; +function drainQueue() { + if (draining) { + return; + } + var timeout = runTimeout(cleanUpNextTick); + draining = true; - exports.Status = { - READY: 0, - CONNECTING: 1, - RECONNECTING: 2, - IDLE: 3, - NEARLY: 4, - }; + var len = queue.length; + while(len) { + currentQueue = queue; + queue = []; + while (++queueIndex < len) { + if (currentQueue) { + currentQueue[queueIndex].run(); + } + } + queueIndex = -1; + len = queue.length; + } + currentQueue = null; + draining = false; + runClearTimeout(timeout); +} - exports.ChannelTypes = { - text: 0, - DM: 1, - voice: 2, - groupDM: 3, - }; +process.nextTick = function (fun) { + var args = new Array(arguments.length - 1); + if (arguments.length > 1) { + for (var i = 1; i < arguments.length; i++) { + args[i - 1] = arguments[i]; + } + } + queue.push(new Item(fun, args)); + if (queue.length === 1 && !draining) { + runTimeout(drainQueue); + } +}; - exports.OPCodes = { - DISPATCH: 0, - HEARTBEAT: 1, - IDENTIFY: 2, - STATUS_UPDATE: 3, - VOICE_STATE_UPDATE: 4, - VOICE_GUILD_PING: 5, - RESUME: 6, - RECONNECT: 7, - REQUEST_GUILD_MEMBERS: 8, - INVALID_SESSION: 9, - HELLO: 10, - HEARTBEAT_ACK: 11, - }; +// v8 likes predictible objects +function Item(fun, array) { + this.fun = fun; + this.array = array; +} +Item.prototype.run = function () { + this.fun.apply(null, this.array); +}; +process.title = 'browser'; +process.browser = true; +process.env = {}; +process.argv = []; +process.version = ''; // empty string to avoid regexp issues +process.versions = {}; - exports.VoiceOPCodes = { - IDENTIFY: 0, - SELECT_PROTOCOL: 1, - READY: 2, - HEARTBEAT: 3, - SESSION_DESCRIPTION: 4, - SPEAKING: 5, - }; +function noop() {} - exports.Events = { - READY: 'ready', - GUILD_CREATE: 'guildCreate', - GUILD_DELETE: 'guildDelete', - GUILD_UPDATE: 'guildUpdate', - GUILD_UNAVAILABLE: 'guildUnavailable', - GUILD_AVAILABLE: 'guildAvailable', - GUILD_MEMBER_ADD: 'guildMemberAdd', - GUILD_MEMBER_REMOVE: 'guildMemberRemove', - GUILD_MEMBER_UPDATE: 'guildMemberUpdate', - GUILD_MEMBER_AVAILABLE: 'guildMemberAvailable', - GUILD_MEMBER_SPEAKING: 'guildMemberSpeaking', - GUILD_MEMBERS_CHUNK: 'guildMembersChunk', - GUILD_ROLE_CREATE: 'roleCreate', - GUILD_ROLE_DELETE: 'roleDelete', - GUILD_ROLE_UPDATE: 'roleUpdate', - GUILD_EMOJI_CREATE: 'guildEmojiCreate', - GUILD_EMOJI_DELETE: 'guildEmojiDelete', - GUILD_EMOJI_UPDATE: 'guildEmojiUpdate', - GUILD_BAN_ADD: 'guildBanAdd', - GUILD_BAN_REMOVE: 'guildBanRemove', - CHANNEL_CREATE: 'channelCreate', - CHANNEL_DELETE: 'channelDelete', - CHANNEL_UPDATE: 'channelUpdate', - CHANNEL_PINS_UPDATE: 'channelPinsUpdate', - MESSAGE_CREATE: 'message', - MESSAGE_DELETE: 'messageDelete', - MESSAGE_UPDATE: 'messageUpdate', - MESSAGE_BULK_DELETE: 'messageDeleteBulk', - MESSAGE_REACTION_ADD: 'messageReactionAdd', - MESSAGE_REACTION_REMOVE: 'messageReactionRemove', - MESSAGE_REACTION_REMOVE_ALL: 'messageReactionRemoveAll', - USER_UPDATE: 'userUpdate', - USER_NOTE_UPDATE: 'userNoteUpdate', - PRESENCE_UPDATE: 'presenceUpdate', - VOICE_STATE_UPDATE: 'voiceStateUpdate', - TYPING_START: 'typingStart', - TYPING_STOP: 'typingStop', - DISCONNECT: 'disconnect', - RECONNECTING: 'reconnecting', - ERROR: 'error', - WARN: 'warn', - DEBUG: 'debug', - }; +process.on = noop; +process.addListener = noop; +process.once = noop; +process.off = noop; +process.removeListener = noop; +process.removeAllListeners = noop; +process.emit = noop; - exports.WSEvents = { - READY: 'READY', - GUILD_SYNC: 'GUILD_SYNC', - GUILD_CREATE: 'GUILD_CREATE', - GUILD_DELETE: 'GUILD_DELETE', - GUILD_UPDATE: 'GUILD_UPDATE', - GUILD_MEMBER_ADD: 'GUILD_MEMBER_ADD', - GUILD_MEMBER_REMOVE: 'GUILD_MEMBER_REMOVE', - GUILD_MEMBER_UPDATE: 'GUILD_MEMBER_UPDATE', - GUILD_MEMBERS_CHUNK: 'GUILD_MEMBERS_CHUNK', - GUILD_ROLE_CREATE: 'GUILD_ROLE_CREATE', - GUILD_ROLE_DELETE: 'GUILD_ROLE_DELETE', - GUILD_ROLE_UPDATE: 'GUILD_ROLE_UPDATE', - GUILD_BAN_ADD: 'GUILD_BAN_ADD', - GUILD_BAN_REMOVE: 'GUILD_BAN_REMOVE', - CHANNEL_CREATE: 'CHANNEL_CREATE', - CHANNEL_DELETE: 'CHANNEL_DELETE', - CHANNEL_UPDATE: 'CHANNEL_UPDATE', - CHANNEL_PINS_UPDATE: 'CHANNEL_PINS_UPDATE', - MESSAGE_CREATE: 'MESSAGE_CREATE', - MESSAGE_DELETE: 'MESSAGE_DELETE', - MESSAGE_UPDATE: 'MESSAGE_UPDATE', - MESSAGE_DELETE_BULK: 'MESSAGE_DELETE_BULK', - MESSAGE_REACTION_ADD: 'MESSAGE_REACTION_ADD', - MESSAGE_REACTION_REMOVE: 'MESSAGE_REACTION_REMOVE', - MESSAGE_REACTION_REMOVE_ALL: 'MESSAGE_REACTION_REMOVE_ALL', - USER_UPDATE: 'USER_UPDATE', - USER_NOTE_UPDATE: 'USER_NOTE_UPDATE', - PRESENCE_UPDATE: 'PRESENCE_UPDATE', - VOICE_STATE_UPDATE: 'VOICE_STATE_UPDATE', - TYPING_START: 'TYPING_START', - FRIEND_ADD: 'RELATIONSHIP_ADD', - FRIEND_REMOVE: 'RELATIONSHIP_REMOVE', - VOICE_SERVER_UPDATE: 'VOICE_SERVER_UPDATE', - RELATIONSHIP_ADD: 'RELATIONSHIP_ADD', - RELATIONSHIP_REMOVE: 'RELATIONSHIP_REMOVE', - }; +process.binding = function (name) { + throw new Error('process.binding is not supported'); +}; - exports.MessageTypes = { - 0: 'DEFAULT', - 1: 'RECIPIENT_ADD', - 2: 'RECIPIENT_REMOVE', - 3: 'CALL', - 4: 'CHANNEL_NAME_CHANGE', - 5: 'CHANNEL_ICON_CHANGE', - 6: 'PINS_ADD', - }; +process.cwd = function () { return '/' }; +process.chdir = function (dir) { + throw new Error('process.chdir is not supported'); +}; +process.umask = function() { return 0; }; - const PermissionFlags = exports.PermissionFlags = { - CREATE_INSTANT_INVITE: 1 << 0, - KICK_MEMBERS: 1 << 1, - BAN_MEMBERS: 1 << 2, - ADMINISTRATOR: 1 << 3, - MANAGE_CHANNELS: 1 << 4, - MANAGE_GUILD: 1 << 5, - ADD_REACTIONS: 1 << 6, - - READ_MESSAGES: 1 << 10, - SEND_MESSAGES: 1 << 11, - SEND_TTS_MESSAGES: 1 << 12, - MANAGE_MESSAGES: 1 << 13, - EMBED_LINKS: 1 << 14, - ATTACH_FILES: 1 << 15, - READ_MESSAGE_HISTORY: 1 << 16, - MENTION_EVERYONE: 1 << 17, - EXTERNAL_EMOJIS: 1 << 18, - - CONNECT: 1 << 20, - SPEAK: 1 << 21, - MUTE_MEMBERS: 1 << 22, - DEAFEN_MEMBERS: 1 << 23, - MOVE_MEMBERS: 1 << 24, - USE_VAD: 1 << 25, - - CHANGE_NICKNAME: 1 << 26, - MANAGE_NICKNAMES: 1 << 27, - MANAGE_ROLES_OR_PERMISSIONS: 1 << 28, - MANAGE_WEBHOOKS: 1 << 29, - MANAGE_EMOJIS: 1 << 30, - }; - - let _ALL_PERMISSIONS = 0; - for (const key in PermissionFlags) _ALL_PERMISSIONS |= PermissionFlags[key]; - exports.ALL_PERMISSIONS = _ALL_PERMISSIONS; - exports.DEFAULT_PERMISSIONS = 104324097; - - /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2))) /***/ }, /* 6 */ /***/ function(module, exports) { - module.exports = { - "name": "discord.js", - "version": "10.0.1", - "description": "A powerful library for interacting with the Discord API", - "main": "./src/index", - "scripts": { - "test": "eslint src && node docs/generator test", - "docs": "node docs/generator", - "test-docs": "node docs/generator test", - "lint": "eslint src", - "web-dist": "npm install && ./node_modules/parallel-webpack/bin/run.js" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/hydrabolt/discord.js.git" - }, - "keywords": [ - "discord", - "api", - "bot", - "client", - "node", - "discordapp" - ], - "author": "Amish Shah ", - "license": "Apache-2.0", - "bugs": { - "url": "https://github.com/hydrabolt/discord.js/issues" - }, - "homepage": "https://github.com/hydrabolt/discord.js#readme", - "dependencies": { - "superagent": "^3.0.0", - "tweetnacl": "^0.14.3", - "ws": "^1.1.1" - }, - "peerDependencies": { - "node-opus": "^0.2.0", - "opusscript": "^0.0.1" - }, - "devDependencies": { - "bufferutil": "^1.2.1", - "eslint": "^3.10.0", - "jsdoc-to-markdown": "^2.0.0", - "json-loader": "^0.5.4", - "parallel-webpack": "^1.5.0", - "uglify-js": "github:mishoo/UglifyJS2#harmony", - "utf-8-validate": "^1.2.1", - "webpack": "^1.13.3", - "zlibjs": "github:imaya/zlib.js" - }, - "engines": { - "node": ">=6.0.0" - } - }; +/** + * A Map with additional utility methods. This is used throughout discord.js rather than Arrays for anything that has + * an ID, for significantly improved performance and ease-of-use. + * @extends {Map} + */ +class Collection extends Map { + constructor(iterable) { + super(iterable); + + /** + * Cached array for the `array()` method - will be reset to `null` whenever `set()` or `delete()` are called. + * @type {?Array} + * @private + */ + this._array = null; + + /** + * Cached array for the `keyArray()` method - will be reset to `null` whenever `set()` or `delete()` are called. + * @type {?Array} + * @private + */ + this._keyArray = null; + } + + set(key, val) { + super.set(key, val); + this._array = null; + this._keyArray = null; + } + + delete(key) { + super.delete(key); + this._array = null; + this._keyArray = null; + } + + /** + * Creates an ordered array of the values of this collection, and caches it internally. The array will only be + * reconstructed if an item is added to or removed from the collection, or if you change the length of the array + * itself. If you don't want this caching behaviour, use `Array.from(collection.values())` instead. + * @returns {Array} + */ + array() { + if (!this._array || this._array.length !== this.size) this._array = Array.from(this.values()); + return this._array; + } + + /** + * Creates an ordered array of the keys of this collection, and caches it internally. The array will only be + * reconstructed if an item is added to or removed from the collection, or if you change the length of the array + * itself. If you don't want this caching behaviour, use `Array.from(collection.keys())` instead. + * @returns {Array} + */ + keyArray() { + if (!this._keyArray || this._keyArray.length !== this.size) this._keyArray = Array.from(this.keys()); + return this._keyArray; + } + + /** + * Obtains the first item in this collection. + * @returns {*} + */ + first() { + return this.values().next().value; + } + + /** + * Obtains the first key in this collection. + * @returns {*} + */ + firstKey() { + return this.keys().next().value; + } + + /** + * Obtains the last item in this collection. This relies on the `array()` method, and thus the caching mechanism + * applies here as well. + * @returns {*} + */ + last() { + const arr = this.array(); + return arr[arr.length - 1]; + } + + /** + * Obtains the last key in this collection. This relies on the `keyArray()` method, and thus the caching mechanism + * applies here as well. + * @returns {*} + */ + lastKey() { + const arr = this.keyArray(); + return arr[arr.length - 1]; + } + + /** + * Obtains a random item from this collection. This relies on the `array()` method, and thus the caching mechanism + * applies here as well. + * @returns {*} + */ + random() { + const arr = this.array(); + return arr[Math.floor(Math.random() * arr.length)]; + } + + /** + * Obtains a random key from this collection. This relies on the `keyArray()` method, and thus the caching mechanism + * applies here as well. + * @returns {*} + */ + randomKey() { + const arr = this.keyArray(); + return arr[Math.floor(Math.random() * arr.length)]; + } + + /** + * Searches for all items where their specified property's value is identical to the given value + * (`item[prop] === value`). + * @param {string} prop The property to test against + * @param {*} value The expected value + * @returns {Array} + * @example + * collection.findAll('username', 'Bob'); + */ + findAll(prop, value) { + if (typeof prop !== 'string') throw new TypeError('Key must be a string.'); + if (typeof value === 'undefined') throw new Error('Value must be specified.'); + const results = []; + for (const item of this.values()) { + if (item[prop] === value) results.push(item); + } + return results; + } + + /** + * Searches for a single item where its specified property's value is identical to the given value + * (`item[prop] === value`), or the given function returns a truthy value. In the latter case, this is identical to + * [Array.find()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find). + * Do not use this to obtain an item by its ID. Instead, use `collection.get(id)`. See + * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/get) for details. + * @param {string|Function} propOrFn The property to test against, or the function to test with + * @param {*} [value] The expected value - only applicable and required if using a property for the first argument + * @returns {*} + * @example + * collection.find('username', 'Bob'); + * @example + * collection.find(val => val.username === 'Bob'); + */ + find(propOrFn, value) { + if (typeof propOrFn === 'string') { + if (typeof value === 'undefined') throw new Error('Value must be specified.'); + if (propOrFn === 'id') throw new RangeError('Don\'t use .find() with IDs. Instead, use .get(id).'); + for (const item of this.values()) { + if (item[propOrFn] === value) return item; + } + return null; + } else if (typeof propOrFn === 'function') { + for (const [key, val] of this) { + if (propOrFn(val, key, this)) return val; + } + return null; + } else { + throw new Error('First argument must be a property string or a function.'); + } + } + + /* eslint-disable max-len */ + /** + * Searches for the key of a single item where its specified property's value is identical to the given value + * (`item[prop] === value`), or the given function returns a truthy value. In the latter case, this is identical to + * [Array.findIndex()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/findIndex). + * @param {string|Function} propOrFn The property to test against, or the function to test with + * @param {*} [value] The expected value - only applicable and required if using a property for the first argument + * @returns {*} + * @example + * collection.findKey('username', 'Bob'); + * @example + * collection.findKey(val => val.username === 'Bob'); + */ + /* eslint-enable max-len */ + findKey(propOrFn, value) { + if (typeof propOrFn === 'string') { + if (typeof value === 'undefined') throw new Error('Value must be specified.'); + for (const [key, val] of this) { + if (val[propOrFn] === value) return key; + } + return null; + } else if (typeof propOrFn === 'function') { + for (const [key, val] of this) { + if (propOrFn(val, key, this)) return key; + } + return null; + } else { + throw new Error('First argument must be a property string or a function.'); + } + } + + /** + * Searches for the existence of a single item where its specified property's value is identical to the given value + * (`item[prop] === value`). + * Do not use this to check for an item by its ID. Instead, use `collection.has(id)`. See + * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/has) for details. + * @param {string} prop The property to test against + * @param {*} value The expected value + * @returns {boolean} + * @example + * if (collection.exists('username', 'Bob')) { + * console.log('user here!'); + * } + */ + exists(prop, value) { + if (prop === 'id') throw new RangeError('Don\'t use .exists() with IDs. Instead, use .has(id).'); + return Boolean(this.find(prop, value)); + } + + /** + * Identical to + * [Array.filter()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter), + * but returns a Collection instead of an Array. + * @param {Function} fn Function used to test (should return a boolean) + * @param {Object} [thisArg] Value to use as `this` when executing function + * @returns {Collection} + */ + filter(fn, thisArg) { + if (thisArg) fn = fn.bind(thisArg); + const results = new Collection(); + for (const [key, val] of this) { + if (fn(val, key, this)) results.set(key, val); + } + return results; + } + + /** + * Identical to + * [Array.filter()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter). + * @param {Function} fn Function used to test (should return a boolean) + * @param {Object} [thisArg] Value to use as `this` when executing function + * @returns {Array} + */ + filterArray(fn, thisArg) { + if (thisArg) fn = fn.bind(thisArg); + const results = []; + for (const [key, val] of this) { + if (fn(val, key, this)) results.push(val); + } + return results; + } + + /** + * Identical to + * [Array.map()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map). + * @param {Function} fn Function that produces an element of the new array, taking three arguments + * @param {*} [thisArg] Value to use as `this` when executing function + * @returns {Array} + */ + map(fn, thisArg) { + if (thisArg) fn = fn.bind(thisArg); + const arr = new Array(this.size); + let i = 0; + for (const [key, val] of this) arr[i++] = fn(val, key, this); + return arr; + } + + /** + * Identical to + * [Array.some()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/some). + * @param {Function} fn Function used to test (should return a boolean) + * @param {Object} [thisArg] Value to use as `this` when executing function + * @returns {boolean} + */ + some(fn, thisArg) { + if (thisArg) fn = fn.bind(thisArg); + for (const [key, val] of this) { + if (fn(val, key, this)) return true; + } + return false; + } + + /** + * Identical to + * [Array.every()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/every). + * @param {Function} fn Function used to test (should return a boolean) + * @param {Object} [thisArg] Value to use as `this` when executing function + * @returns {boolean} + */ + every(fn, thisArg) { + if (thisArg) fn = fn.bind(thisArg); + for (const [key, val] of this) { + if (!fn(val, key, this)) return false; + } + return true; + } + + /** + * Identical to + * [Array.reduce()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce). + * @param {Function} fn Function used to reduce + * @param {*} [startVal] The starting value + * @returns {*} + */ + reduce(fn, startVal) { + let currentVal = startVal; + for (const [key, val] of this) currentVal = fn(currentVal, val, key, this); + return currentVal; + } + + /** + * Combines this collection with others into a new collection. None of the source collections are modified. + * @param {Collection} collections Collections to merge (infinite/rest argument, not an array) + * @returns {Collection} + * @example const newColl = someColl.concat(someOtherColl, anotherColl, ohBoyAColl); + */ + concat(...collections) { + const newColl = new this.constructor(); + for (const [key, val] of this) newColl.set(key, val); + for (const coll of collections) { + for (const [key, val] of coll) newColl.set(key, val); + } + return newColl; + } + + /** + * Calls the `delete()` method on all items that have it. + * @returns {Promise[]} + */ + deleteAll() { + const returns = []; + for (const item of this.values()) { + if (item.delete) returns.push(item.delete()); + } + return returns; + } +} + +module.exports = Collection; + /***/ }, /* 7 */ /***/ function(module, exports, __webpack_require__) { - const UserAgentManager = __webpack_require__(8); - const RESTMethods = __webpack_require__(9); - const SequentialRequestHandler = __webpack_require__(36); - const BurstRequestHandler = __webpack_require__(38); - const APIRequest = __webpack_require__(39); - const Constants = __webpack_require__(5); +"use strict"; +'use strict'; - class RESTManager { - constructor(client) { - this.client = client; - this.handlers = {}; - this.userAgentManager = new UserAgentManager(this); - this.methods = new RESTMethods(this); - this.rateLimitedEndpoints = {}; - this.globallyRateLimited = false; - } +var elliptic = exports; - push(handler, apiRequest) { - return new Promise((resolve, reject) => { - handler.push({ - request: apiRequest, - resolve, - reject, - }); - }); - } +elliptic.version = __webpack_require__(201).version; +elliptic.utils = __webpack_require__(190); +elliptic.rand = __webpack_require__(86); +elliptic.hmacDRBG = __webpack_require__(188); +elliptic.curve = __webpack_require__(36); +elliptic.curves = __webpack_require__(181); - getRequestHandler() { - switch (this.client.options.apiRequestMethod) { - case 'sequential': - return SequentialRequestHandler; - case 'burst': - return BurstRequestHandler; - default: - throw new Error(Constants.Errors.INVALID_RATE_LIMIT_METHOD); - } - } - - makeRequest(method, url, auth, data, file) { - const apiRequest = new APIRequest(this, method, url, auth, data, file); - - if (!this.handlers[apiRequest.route]) { - const RequestHandlerType = this.getRequestHandler(); - this.handlers[apiRequest.route] = new RequestHandlerType(this, apiRequest.route); - } - - return this.push(this.handlers[apiRequest.route], apiRequest); - } - } - - module.exports = RESTManager; +// Protocols +elliptic.ec = __webpack_require__(182); +elliptic.eddsa = __webpack_require__(185); /***/ }, /* 8 */ /***/ function(module, exports, __webpack_require__) { - const Constants = __webpack_require__(5); +/* WEBPACK VAR INJECTION */(function(global, process) {// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. - class UserAgentManager { - constructor(restManager) { - this.restManager = restManager; - this._userAgent = { - url: 'https://github.com/hydrabolt/discord.js', - version: Constants.Package.version, - }; - } +var formatRegExp = /%[sdj%]/g; +exports.format = function(f) { + if (!isString(f)) { + var objects = []; + for (var i = 0; i < arguments.length; i++) { + objects.push(inspect(arguments[i])); + } + return objects.join(' '); + } - set(info) { - this._userAgent.url = info.url || 'https://github.com/hydrabolt/discord.js'; - this._userAgent.version = info.version || Constants.Package.version; - } + var i = 1; + var args = arguments; + var len = args.length; + var str = String(f).replace(formatRegExp, function(x) { + if (x === '%%') return '%'; + if (i >= len) return x; + switch (x) { + case '%s': return String(args[i++]); + case '%d': return Number(args[i++]); + case '%j': + try { + return JSON.stringify(args[i++]); + } catch (_) { + return '[Circular]'; + } + default: + return x; + } + }); + for (var x = args[i]; i < len; x = args[++i]) { + if (isNull(x) || !isObject(x)) { + str += ' ' + x; + } else { + str += ' ' + inspect(x); + } + } + return str; +}; - get userAgent() { - return `DiscordBot (${this._userAgent.url}, ${this._userAgent.version})`; - } - } - module.exports = UserAgentManager; +// Mark that a method should not be used. +// Returns a modified function which warns once by default. +// If --no-deprecation is set, then it is a no-op. +exports.deprecate = function(fn, msg) { + // Allow for deprecating things in the process of starting up. + if (isUndefined(global.process)) { + return function() { + return exports.deprecate(fn, msg).apply(this, arguments); + }; + } + if (process.noDeprecation === true) { + return fn; + } + + var warned = false; + function deprecated() { + if (!warned) { + if (process.throwDeprecation) { + throw new Error(msg); + } else if (process.traceDeprecation) { + console.trace(msg); + } else { + console.error(msg); + } + warned = true; + } + return fn.apply(this, arguments); + } + + return deprecated; +}; + + +var debugs = {}; +var debugEnviron; +exports.debuglog = function(set) { + if (isUndefined(debugEnviron)) + debugEnviron = process.env.NODE_DEBUG || ''; + set = set.toUpperCase(); + if (!debugs[set]) { + if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) { + var pid = process.pid; + debugs[set] = function() { + var msg = exports.format.apply(exports, arguments); + console.error('%s %d: %s', set, pid, msg); + }; + } else { + debugs[set] = function() {}; + } + } + return debugs[set]; +}; + + +/** + * Echos the value of a value. Trys to print the value out + * in the best way possible given the different types. + * + * @param {Object} obj The object to print out. + * @param {Object} opts Optional options object that alters the output. + */ +/* legacy: obj, showHidden, depth, colors*/ +function inspect(obj, opts) { + // default options + var ctx = { + seen: [], + stylize: stylizeNoColor + }; + // legacy... + if (arguments.length >= 3) ctx.depth = arguments[2]; + if (arguments.length >= 4) ctx.colors = arguments[3]; + if (isBoolean(opts)) { + // legacy... + ctx.showHidden = opts; + } else if (opts) { + // got an "options" object + exports._extend(ctx, opts); + } + // set default options + if (isUndefined(ctx.showHidden)) ctx.showHidden = false; + if (isUndefined(ctx.depth)) ctx.depth = 2; + if (isUndefined(ctx.colors)) ctx.colors = false; + if (isUndefined(ctx.customInspect)) ctx.customInspect = true; + if (ctx.colors) ctx.stylize = stylizeWithColor; + return formatValue(ctx, obj, ctx.depth); +} +exports.inspect = inspect; + + +// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics +inspect.colors = { + 'bold' : [1, 22], + 'italic' : [3, 23], + 'underline' : [4, 24], + 'inverse' : [7, 27], + 'white' : [37, 39], + 'grey' : [90, 39], + 'black' : [30, 39], + 'blue' : [34, 39], + 'cyan' : [36, 39], + 'green' : [32, 39], + 'magenta' : [35, 39], + 'red' : [31, 39], + 'yellow' : [33, 39] +}; + +// Don't use 'blue' not visible on cmd.exe +inspect.styles = { + 'special': 'cyan', + 'number': 'yellow', + 'boolean': 'yellow', + 'undefined': 'grey', + 'null': 'bold', + 'string': 'green', + 'date': 'magenta', + // "name": intentionally not styling + 'regexp': 'red' +}; + + +function stylizeWithColor(str, styleType) { + var style = inspect.styles[styleType]; + + if (style) { + return '\u001b[' + inspect.colors[style][0] + 'm' + str + + '\u001b[' + inspect.colors[style][1] + 'm'; + } else { + return str; + } +} + + +function stylizeNoColor(str, styleType) { + return str; +} + + +function arrayToHash(array) { + var hash = {}; + + array.forEach(function(val, idx) { + hash[val] = true; + }); + + return hash; +} + + +function formatValue(ctx, value, recurseTimes) { + // Provide a hook for user-specified inspect functions. + // Check that value is an object with an inspect function on it + if (ctx.customInspect && + value && + isFunction(value.inspect) && + // Filter out the util module, it's inspect function is special + value.inspect !== exports.inspect && + // Also filter out any prototype objects using the circular check. + !(value.constructor && value.constructor.prototype === value)) { + var ret = value.inspect(recurseTimes, ctx); + if (!isString(ret)) { + ret = formatValue(ctx, ret, recurseTimes); + } + return ret; + } + + // Primitive types cannot have properties + var primitive = formatPrimitive(ctx, value); + if (primitive) { + return primitive; + } + + // Look up the keys of the object. + var keys = Object.keys(value); + var visibleKeys = arrayToHash(keys); + + if (ctx.showHidden) { + keys = Object.getOwnPropertyNames(value); + } + + // IE doesn't make error fields non-enumerable + // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx + if (isError(value) + && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) { + return formatError(value); + } + + // Some type of object without properties can be shortcutted. + if (keys.length === 0) { + if (isFunction(value)) { + var name = value.name ? ': ' + value.name : ''; + return ctx.stylize('[Function' + name + ']', 'special'); + } + if (isRegExp(value)) { + return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); + } + if (isDate(value)) { + return ctx.stylize(Date.prototype.toString.call(value), 'date'); + } + if (isError(value)) { + return formatError(value); + } + } + + var base = '', array = false, braces = ['{', '}']; + + // Make Array say that they are Array + if (isArray(value)) { + array = true; + braces = ['[', ']']; + } + + // Make functions say that they are functions + if (isFunction(value)) { + var n = value.name ? ': ' + value.name : ''; + base = ' [Function' + n + ']'; + } + + // Make RegExps say that they are RegExps + if (isRegExp(value)) { + base = ' ' + RegExp.prototype.toString.call(value); + } + + // Make dates with properties first say the date + if (isDate(value)) { + base = ' ' + Date.prototype.toUTCString.call(value); + } + + // Make error with message first say the error + if (isError(value)) { + base = ' ' + formatError(value); + } + + if (keys.length === 0 && (!array || value.length == 0)) { + return braces[0] + base + braces[1]; + } + + if (recurseTimes < 0) { + if (isRegExp(value)) { + return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); + } else { + return ctx.stylize('[Object]', 'special'); + } + } + + ctx.seen.push(value); + + var output; + if (array) { + output = formatArray(ctx, value, recurseTimes, visibleKeys, keys); + } else { + output = keys.map(function(key) { + return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array); + }); + } + + ctx.seen.pop(); + + return reduceToSingleString(output, base, braces); +} + + +function formatPrimitive(ctx, value) { + if (isUndefined(value)) + return ctx.stylize('undefined', 'undefined'); + if (isString(value)) { + var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '') + .replace(/'/g, "\\'") + .replace(/\\"/g, '"') + '\''; + return ctx.stylize(simple, 'string'); + } + if (isNumber(value)) + return ctx.stylize('' + value, 'number'); + if (isBoolean(value)) + return ctx.stylize('' + value, 'boolean'); + // For some reason typeof null is "object", so special case here. + if (isNull(value)) + return ctx.stylize('null', 'null'); +} + + +function formatError(value) { + return '[' + Error.prototype.toString.call(value) + ']'; +} + + +function formatArray(ctx, value, recurseTimes, visibleKeys, keys) { + var output = []; + for (var i = 0, l = value.length; i < l; ++i) { + if (hasOwnProperty(value, String(i))) { + output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, + String(i), true)); + } else { + output.push(''); + } + } + keys.forEach(function(key) { + if (!key.match(/^\d+$/)) { + output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, + key, true)); + } + }); + return output; +} + + +function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) { + var name, str, desc; + desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] }; + if (desc.get) { + if (desc.set) { + str = ctx.stylize('[Getter/Setter]', 'special'); + } else { + str = ctx.stylize('[Getter]', 'special'); + } + } else { + if (desc.set) { + str = ctx.stylize('[Setter]', 'special'); + } + } + if (!hasOwnProperty(visibleKeys, key)) { + name = '[' + key + ']'; + } + if (!str) { + if (ctx.seen.indexOf(desc.value) < 0) { + if (isNull(recurseTimes)) { + str = formatValue(ctx, desc.value, null); + } else { + str = formatValue(ctx, desc.value, recurseTimes - 1); + } + if (str.indexOf('\n') > -1) { + if (array) { + str = str.split('\n').map(function(line) { + return ' ' + line; + }).join('\n').substr(2); + } else { + str = '\n' + str.split('\n').map(function(line) { + return ' ' + line; + }).join('\n'); + } + } + } else { + str = ctx.stylize('[Circular]', 'special'); + } + } + if (isUndefined(name)) { + if (array && key.match(/^\d+$/)) { + return str; + } + name = JSON.stringify('' + key); + if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) { + name = name.substr(1, name.length - 2); + name = ctx.stylize(name, 'name'); + } else { + name = name.replace(/'/g, "\\'") + .replace(/\\"/g, '"') + .replace(/(^"|"$)/g, "'"); + name = ctx.stylize(name, 'string'); + } + } + + return name + ': ' + str; +} + + +function reduceToSingleString(output, base, braces) { + var numLinesEst = 0; + var length = output.reduce(function(prev, cur) { + numLinesEst++; + if (cur.indexOf('\n') >= 0) numLinesEst++; + return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1; + }, 0); + + if (length > 60) { + return braces[0] + + (base === '' ? '' : base + '\n ') + + ' ' + + output.join(',\n ') + + ' ' + + braces[1]; + } + + return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1]; +} + + +// NOTE: These type checking functions intentionally don't use `instanceof` +// because it is fragile and can be easily faked with `Object.create()`. +function isArray(ar) { + return Array.isArray(ar); +} +exports.isArray = isArray; + +function isBoolean(arg) { + return typeof arg === 'boolean'; +} +exports.isBoolean = isBoolean; + +function isNull(arg) { + return arg === null; +} +exports.isNull = isNull; + +function isNullOrUndefined(arg) { + return arg == null; +} +exports.isNullOrUndefined = isNullOrUndefined; + +function isNumber(arg) { + return typeof arg === 'number'; +} +exports.isNumber = isNumber; + +function isString(arg) { + return typeof arg === 'string'; +} +exports.isString = isString; + +function isSymbol(arg) { + return typeof arg === 'symbol'; +} +exports.isSymbol = isSymbol; + +function isUndefined(arg) { + return arg === void 0; +} +exports.isUndefined = isUndefined; + +function isRegExp(re) { + return isObject(re) && objectToString(re) === '[object RegExp]'; +} +exports.isRegExp = isRegExp; + +function isObject(arg) { + return typeof arg === 'object' && arg !== null; +} +exports.isObject = isObject; + +function isDate(d) { + return isObject(d) && objectToString(d) === '[object Date]'; +} +exports.isDate = isDate; + +function isError(e) { + return isObject(e) && + (objectToString(e) === '[object Error]' || e instanceof Error); +} +exports.isError = isError; + +function isFunction(arg) { + return typeof arg === 'function'; +} +exports.isFunction = isFunction; + +function isPrimitive(arg) { + return arg === null || + typeof arg === 'boolean' || + typeof arg === 'number' || + typeof arg === 'string' || + typeof arg === 'symbol' || // ES6 symbol + typeof arg === 'undefined'; +} +exports.isPrimitive = isPrimitive; + +exports.isBuffer = __webpack_require__(234); + +function objectToString(o) { + return Object.prototype.toString.call(o); +} + + +function pad(n) { + return n < 10 ? '0' + n.toString(10) : n.toString(10); +} + + +var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', + 'Oct', 'Nov', 'Dec']; + +// 26 Feb 16:19:34 +function timestamp() { + var d = new Date(); + var time = [pad(d.getHours()), + pad(d.getMinutes()), + pad(d.getSeconds())].join(':'); + return [d.getDate(), months[d.getMonth()], time].join(' '); +} + + +// log is just a thin wrapper to console.log that prepends a timestamp +exports.log = function() { + console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments)); +}; + + +/** + * Inherit the prototype methods from one constructor into another. + * + * The Function.prototype.inherits from lang.js rewritten as a standalone + * function (not on Function.prototype). NOTE: If this file is to be loaded + * during bootstrapping this function needs to be rewritten using some native + * functions as prototype setup using normal JavaScript does not work as + * expected during bootstrapping (see mirror.js in r114903). + * + * @param {function} ctor Constructor function which needs to inherit the + * prototype. + * @param {function} superCtor Constructor function to inherit prototype from. + */ +exports.inherits = __webpack_require__(233); + +exports._extend = function(origin, add) { + // Don't do anything if add isn't an object + if (!add || !isObject(add)) return origin; + + var keys = Object.keys(add); + var i = keys.length; + while (i--) { + origin[keys[i]] = add[keys[i]]; + } + return origin; +}; + +function hasOwnProperty(obj, prop) { + return Object.prototype.hasOwnProperty.call(obj, prop); +} + +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(16), __webpack_require__(5))) /***/ }, /* 9 */ /***/ function(module, exports, __webpack_require__) { - const Constants = __webpack_require__(5); - const Collection = __webpack_require__(10); - const splitMessage = __webpack_require__(11); - const parseEmoji = __webpack_require__(12); +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +module.exports = Stream; + +var EE = __webpack_require__(3).EventEmitter; +var inherits = __webpack_require__(1); + +inherits(Stream, EE); +Stream.Readable = __webpack_require__(225); +Stream.Writable = __webpack_require__(226); +Stream.Duplex = __webpack_require__(222); +Stream.Transform = __webpack_require__(114); +Stream.PassThrough = __webpack_require__(224); + +// Backwards-compat with node 0.4.x +Stream.Stream = Stream; + + + +// old-style streams. Note that the pipe method (the only relevant +// part of this class) is overridden in the Readable class. + +function Stream() { + EE.call(this); +} + +Stream.prototype.pipe = function(dest, options) { + var source = this; + + function ondata(chunk) { + if (dest.writable) { + if (false === dest.write(chunk) && source.pause) { + source.pause(); + } + } + } + + source.on('data', ondata); + + function ondrain() { + if (source.readable && source.resume) { + source.resume(); + } + } + + dest.on('drain', ondrain); + + // If the 'end' option is not supplied, dest.end() will be called when + // source gets the 'end' or 'close' events. Only dest.end() once. + if (!dest._isStdio && (!options || options.end !== false)) { + source.on('end', onend); + source.on('close', onclose); + } + + var didOnEnd = false; + function onend() { + if (didOnEnd) return; + didOnEnd = true; + + dest.end(); + } + + + function onclose() { + if (didOnEnd) return; + didOnEnd = true; + + if (typeof dest.destroy === 'function') dest.destroy(); + } + + // don't leave dangling pipes when there are errors. + function onerror(er) { + cleanup(); + if (EE.listenerCount(this, 'error') === 0) { + throw er; // Unhandled stream error in pipe. + } + } + + source.on('error', onerror); + dest.on('error', onerror); + + // remove all the event listeners that were added. + function cleanup() { + source.removeListener('data', ondata); + dest.removeListener('drain', ondrain); - const User = __webpack_require__(13); - const GuildMember = __webpack_require__(25); - const Role = __webpack_require__(26); - const Invite = __webpack_require__(28); - const Webhook = __webpack_require__(31); - const UserProfile = __webpack_require__(32); - const ClientOAuth2Application = __webpack_require__(34); + source.removeListener('end', onend); + source.removeListener('close', onclose); - class RESTMethods { - constructor(restManager) { - this.rest = restManager; - } + source.removeListener('error', onerror); + dest.removeListener('error', onerror); - loginToken(token = this.rest.client.token) { - return new Promise((resolve, reject) => { - token = token.replace(/^Bot\s*/i, ''); - this.rest.client.manager.connectToWebSocket(token, resolve, reject); - }); - } + source.removeListener('end', cleanup); + source.removeListener('close', cleanup); - loginEmailPassword(email, password) { - this.rest.client.emit('warn', 'Client launched using email and password - should use token instead'); - this.rest.client.email = email; - this.rest.client.password = password; - return this.rest.makeRequest('post', Constants.Endpoints.login, false, { email, password }).then(data => - this.loginToken(data.token) - ); - } + dest.removeListener('close', cleanup); + } - logout() { - return this.rest.makeRequest('post', Constants.Endpoints.logout, true, {}); - } + source.on('end', cleanup); + source.on('close', cleanup); - getGateway() { - return this.rest.makeRequest('get', Constants.Endpoints.gateway, true).then(res => { - this.rest.client.ws.gateway = `${res.url}/?encoding=json&v=${Constants.PROTOCOL_VERSION}`; - return this.rest.client.ws.gateway; - }); - } + dest.on('close', cleanup); - getBotGateway() { - return this.rest.makeRequest('get', Constants.Endpoints.botGateway, true); - } + dest.emit('pipe', source); - sendMessage(channel, content, { tts, nonce, embed, disableEveryone, split } = {}, file = null) { - return new Promise((resolve, reject) => { - if (typeof content !== 'undefined') content = this.rest.client.resolver.resolveString(content); - - if (content) { - if (disableEveryone || (typeof disableEveryone === 'undefined' && this.rest.client.options.disableEveryone)) { - content = content.replace(/@(everyone|here)/g, '@\u200b$1'); - } - - if (split) content = splitMessage(content, typeof split === 'object' ? split : {}); - } - - if (channel instanceof User || channel instanceof GuildMember) { - this.createDM(channel).then(chan => { - this._sendMessageRequest(chan, content, file, tts, nonce, embed, resolve, reject); - }, reject); - } else { - this._sendMessageRequest(channel, content, file, tts, nonce, embed, resolve, reject); - } - }); - } - - _sendMessageRequest(channel, content, file, tts, nonce, embed, resolve, reject) { - if (content instanceof Array) { - const datas = []; - let promise = this.rest.makeRequest('post', Constants.Endpoints.channelMessages(channel.id), true, { - content: content[0], tts, nonce, - }, file).catch(reject); - - for (let i = 1; i <= content.length; i++) { - if (i < content.length) { - const i2 = i; - promise = promise.then(data => { - datas.push(data); - return this.rest.makeRequest('post', Constants.Endpoints.channelMessages(channel.id), true, { - content: content[i2], tts, nonce, embed, - }, file); - }, reject); - } else { - promise.then(data => { - datas.push(data); - resolve(this.rest.client.actions.MessageCreate.handle(datas).messages); - }, reject); - } - } - } else { - this.rest.makeRequest('post', Constants.Endpoints.channelMessages(channel.id), true, { - content, tts, nonce, embed, - }, file) - .then(data => resolve(this.rest.client.actions.MessageCreate.handle(data).message), reject); - } - } - - deleteMessage(message) { - return this.rest.makeRequest('del', Constants.Endpoints.channelMessage(message.channel.id, message.id), true) - .then(() => - this.rest.client.actions.MessageDelete.handle({ - id: message.id, - channel_id: message.channel.id, - }).message - ); - } - - bulkDeleteMessages(channel, messages) { - return this.rest.makeRequest('post', `${Constants.Endpoints.channelMessages(channel.id)}/bulk_delete`, true, { - messages, - }).then(() => - this.rest.client.actions.MessageDeleteBulk.handle({ - channel_id: channel.id, - ids: messages, - }).messages - ); - } - - updateMessage(message, content, { embed } = {}) { - content = this.rest.client.resolver.resolveString(content); - return this.rest.makeRequest('patch', Constants.Endpoints.channelMessage(message.channel.id, message.id), true, { - content, embed, - }).then(data => this.rest.client.actions.MessageUpdate.handle(data).updated); - } - - createChannel(guild, channelName, channelType) { - return this.rest.makeRequest('post', Constants.Endpoints.guildChannels(guild.id), true, { - name: channelName, - type: channelType, - }).then(data => this.rest.client.actions.ChannelCreate.handle(data).channel); - } - - createDM(recipient) { - const dmChannel = this.getExistingDM(recipient); - if (dmChannel) return Promise.resolve(dmChannel); - return this.rest.makeRequest('post', Constants.Endpoints.userChannels(this.rest.client.user.id), true, { - recipient_id: recipient.id, - }).then(data => this.rest.client.actions.ChannelCreate.handle(data).channel); - } - - getExistingDM(recipient) { - return this.rest.client.channels.find(channel => - channel.recipient && channel.recipient.id === recipient.id - ); - } - - deleteChannel(channel) { - if (channel instanceof User || channel instanceof GuildMember) channel = this.getExistingDM(channel); - if (!channel) return Promise.reject(new Error('No channel to delete.')); - return this.rest.makeRequest('del', Constants.Endpoints.channel(channel.id), true).then(data => { - data.id = channel.id; - return this.rest.client.actions.ChannelDelete.handle(data).channel; - }); - } - - updateChannel(channel, _data) { - const data = {}; - data.name = (_data.name || channel.name).trim(); - data.topic = _data.topic || channel.topic; - data.position = _data.position || channel.position; - data.bitrate = _data.bitrate || channel.bitrate; - data.user_limit = _data.userLimit || channel.userLimit; - return this.rest.makeRequest('patch', Constants.Endpoints.channel(channel.id), true, data).then(newData => - this.rest.client.actions.ChannelUpdate.handle(newData).updated - ); - } - - leaveGuild(guild) { - if (guild.ownerID === this.rest.client.user.id) return Promise.reject(new Error('Guild is owned by the client.')); - return this.rest.makeRequest('del', Constants.Endpoints.meGuild(guild.id), true).then(() => - this.rest.client.actions.GuildDelete.handle({ id: guild.id }).guild - ); - } - - createGuild(options) { - options.icon = this.rest.client.resolver.resolveBase64(options.icon) || null; - options.region = options.region || 'us-central'; - return new Promise((resolve, reject) => { - this.rest.makeRequest('post', Constants.Endpoints.guilds, true, options).then(data => { - if (this.rest.client.guilds.has(data.id)) { - resolve(this.rest.client.guilds.get(data.id)); - return; - } - - const handleGuild = guild => { - if (guild.id === data.id) { - this.rest.client.removeListener('guildCreate', handleGuild); - this.rest.client.clearTimeout(timeout); - resolve(guild); - } - }; - this.rest.client.on('guildCreate', handleGuild); - - const timeout = this.rest.client.setTimeout(() => { - this.rest.client.removeListener('guildCreate', handleGuild); - reject(new Error('Took too long to receive guild data.')); - }, 10000); - }, reject); - }); - } - - // untested but probably will work - deleteGuild(guild) { - return this.rest.makeRequest('del', Constants.Endpoints.guild(guild.id), true).then(() => - this.rest.client.actions.GuildDelete.handle({ id: guild.id }).guild - ); - } - - getUser(userID) { - return this.rest.makeRequest('get', Constants.Endpoints.user(userID), true).then(data => - this.rest.client.actions.UserGet.handle(data).user - ); - } - - updateCurrentUser(_data) { - const user = this.rest.client.user; - const data = {}; - data.username = _data.username || user.username; - data.avatar = this.rest.client.resolver.resolveBase64(_data.avatar) || user.avatar; - if (!user.bot) { - data.email = _data.email || user.email; - data.password = this.rest.client.password; - if (_data.new_password) data.new_password = _data.newPassword; - } - return this.rest.makeRequest('patch', Constants.Endpoints.me, true, data).then(newData => - this.rest.client.actions.UserUpdate.handle(newData).updated - ); - } - - updateGuild(guild, _data) { - const data = {}; - if (_data.name) data.name = _data.name; - if (_data.region) data.region = _data.region; - if (_data.verificationLevel) data.verification_level = Number(_data.verificationLevel); - if (_data.afkChannel) data.afk_channel_id = this.rest.client.resolver.resolveChannel(_data.afkChannel).id; - if (_data.afkTimeout) data.afk_timeout = Number(_data.afkTimeout); - if (_data.icon) data.icon = this.rest.client.resolver.resolveBase64(_data.icon); - if (_data.owner) data.owner_id = this.rest.client.resolver.resolveUser(_data.owner).id; - if (_data.splash) data.splash = this.rest.client.resolver.resolveBase64(_data.splash); - return this.rest.makeRequest('patch', Constants.Endpoints.guild(guild.id), true, data).then(newData => - this.rest.client.actions.GuildUpdate.handle(newData).updated - ); - } - - kickGuildMember(guild, member) { - return this.rest.makeRequest('del', Constants.Endpoints.guildMember(guild.id, member.id), true).then(() => - this.rest.client.actions.GuildMemberRemove.handle({ - guild_id: guild.id, - user: member.user, - }).member - ); - } - - createGuildRole(guild) { - return this.rest.makeRequest('post', Constants.Endpoints.guildRoles(guild.id), true).then(role => - this.rest.client.actions.GuildRoleCreate.handle({ - guild_id: guild.id, - role, - }).role - ); - } - - deleteGuildRole(role) { - return this.rest.makeRequest('del', Constants.Endpoints.guildRole(role.guild.id, role.id), true).then(() => - this.rest.client.actions.GuildRoleDelete.handle({ - guild_id: role.guild.id, - role_id: role.id, - }).role - ); - } - - setChannelOverwrite(channel, payload) { - return this.rest.makeRequest( - 'put', `${Constants.Endpoints.channelPermissions(channel.id)}/${payload.id}`, true, payload - ); - } - - deletePermissionOverwrites(overwrite) { - return this.rest.makeRequest( - 'del', `${Constants.Endpoints.channelPermissions(overwrite.channel.id)}/${overwrite.id}`, true - ).then(() => overwrite); - } - - getChannelMessages(channel, payload = {}) { - const params = []; - if (payload.limit) params.push(`limit=${payload.limit}`); - if (payload.around) params.push(`around=${payload.around}`); - else if (payload.before) params.push(`before=${payload.before}`); - else if (payload.after) params.push(`after=${payload.after}`); - - let endpoint = Constants.Endpoints.channelMessages(channel.id); - if (params.length > 0) endpoint += `?${params.join('&')}`; - return this.rest.makeRequest('get', endpoint, true); - } - - getChannelMessage(channel, messageID) { - const msg = channel.messages.get(messageID); - if (msg) return Promise.resolve(msg); - return this.rest.makeRequest('get', Constants.Endpoints.channelMessage(channel.id, messageID), true); - } - - getGuildMember(guild, user) { - return this.rest.makeRequest('get', Constants.Endpoints.guildMember(guild.id, user.id), true).then(data => - this.rest.client.actions.GuildMemberGet.handle(guild, data).member - ); - } - - updateGuildMember(member, data) { - if (data.channel) data.channel_id = this.rest.client.resolver.resolveChannel(data.channel).id; - if (data.roles) data.roles = data.roles.map(role => role instanceof Role ? role.id : role); - - let endpoint = Constants.Endpoints.guildMember(member.guild.id, member.id); - // fix your endpoints, discord ;-; - if (member.id === this.rest.client.user.id) { - const keys = Object.keys(data); - if (keys.length === 1 && keys[0] === 'nick') { - endpoint = Constants.Endpoints.stupidInconsistentGuildEndpoint(member.guild.id); - } - } - - return this.rest.makeRequest('patch', endpoint, true, data).then(newData => - member.guild._updateMember(member, newData).mem - ); - } - - sendTyping(channelID) { - return this.rest.makeRequest('post', `${Constants.Endpoints.channel(channelID)}/typing`, true); - } - - banGuildMember(guild, member, deleteDays = 0) { - const id = this.rest.client.resolver.resolveUserID(member); - if (!id) return Promise.reject(new Error('Couldn\'t resolve the user ID to ban.')); - return this.rest.makeRequest( - 'put', `${Constants.Endpoints.guildBans(guild.id)}/${id}?delete-message-days=${deleteDays}`, true, { - 'delete-message-days': deleteDays, - } - ).then(() => { - if (member instanceof GuildMember) return member; - const user = this.rest.client.resolver.resolveUser(id); - if (user) { - member = this.rest.client.resolver.resolveGuildMember(guild, user); - return member || user; - } - return id; - }); - } - - unbanGuildMember(guild, member) { - return new Promise((resolve, reject) => { - const id = this.rest.client.resolver.resolveUserID(member); - if (!id) throw new Error('Couldn\'t resolve the user ID to unban.'); - - const listener = (eGuild, eUser) => { - if (eGuild.id === guild.id && eUser.id === id) { - this.rest.client.removeListener(Constants.Events.GUILD_BAN_REMOVE, listener); - this.rest.client.clearTimeout(timeout); - resolve(eUser); - } - }; - this.rest.client.on(Constants.Events.GUILD_BAN_REMOVE, listener); - - const timeout = this.rest.client.setTimeout(() => { - this.rest.client.removeListener(Constants.Events.GUILD_BAN_REMOVE, listener); - reject(new Error('Took too long to receive the ban remove event.')); - }, 10000); - - this.rest.makeRequest('del', `${Constants.Endpoints.guildBans(guild.id)}/${id}`, true).catch(err => { - this.rest.client.removeListener(Constants.Events.GUILD_BAN_REMOVE, listener); - this.rest.client.clearTimeout(timeout); - reject(err); - }); - }); - } - - getGuildBans(guild) { - return this.rest.makeRequest('get', Constants.Endpoints.guildBans(guild.id), true).then(banItems => { - const bannedUsers = new Collection(); - for (const banItem of banItems) { - const user = this.rest.client.dataManager.newUser(banItem.user); - bannedUsers.set(user.id, user); - } - return bannedUsers; - }); - } - - updateGuildRole(role, _data) { - const data = {}; - data.name = _data.name || role.name; - data.position = typeof _data.position !== 'undefined' ? _data.position : role.position; - data.color = _data.color || role.color; - if (typeof data.color === 'string' && data.color.startsWith('#')) { - data.color = parseInt(data.color.replace('#', ''), 16); - } - data.hoist = typeof _data.hoist !== 'undefined' ? _data.hoist : role.hoist; - data.mentionable = typeof _data.mentionable !== 'undefined' ? _data.mentionable : role.mentionable; - - if (_data.permissions) { - let perms = 0; - for (let perm of _data.permissions) { - if (typeof perm === 'string') perm = Constants.PermissionFlags[perm]; - perms |= perm; - } - data.permissions = perms; - } else { - data.permissions = role.permissions; - } - - return this.rest.makeRequest( - 'patch', Constants.Endpoints.guildRole(role.guild.id, role.id), true, data - ).then(_role => - this.rest.client.actions.GuildRoleUpdate.handle({ - role: _role, - guild_id: role.guild.id, - }).updated - ); - } - - pinMessage(message) { - return this.rest.makeRequest('put', `${Constants.Endpoints.channel(message.channel.id)}/pins/${message.id}`, true) - .then(() => message); - } - - unpinMessage(message) { - return this.rest.makeRequest('del', `${Constants.Endpoints.channel(message.channel.id)}/pins/${message.id}`, true) - .then(() => message); - } - - getChannelPinnedMessages(channel) { - return this.rest.makeRequest('get', `${Constants.Endpoints.channel(channel.id)}/pins`, true); - } - - createChannelInvite(channel, options) { - const payload = {}; - payload.temporary = options.temporary; - payload.max_age = options.maxAge; - payload.max_uses = options.maxUses; - return this.rest.makeRequest('post', `${Constants.Endpoints.channelInvites(channel.id)}`, true, payload) - .then(invite => new Invite(this.rest.client, invite)); - } - - deleteInvite(invite) { - return this.rest.makeRequest('del', Constants.Endpoints.invite(invite.code), true).then(() => invite); - } - - getInvite(code) { - return this.rest.makeRequest('get', Constants.Endpoints.invite(code), true).then(invite => - new Invite(this.rest.client, invite) - ); - } - - getGuildInvites(guild) { - return this.rest.makeRequest('get', Constants.Endpoints.guildInvites(guild.id), true).then(inviteItems => { - const invites = new Collection(); - for (const inviteItem of inviteItems) { - const invite = new Invite(this.rest.client, inviteItem); - invites.set(invite.code, invite); - } - return invites; - }); - } - - pruneGuildMembers(guild, days, dry) { - return this.rest.makeRequest(dry ? 'get' : 'post', `${Constants.Endpoints.guildPrune(guild.id)}?days=${days}`, true) - .then(data => data.pruned); - } - - createEmoji(guild, image, name) { - return this.rest.makeRequest('post', `${Constants.Endpoints.guildEmojis(guild.id)}`, true, { name, image }) - .then(data => this.rest.client.actions.EmojiCreate.handle(data, guild).emoji); - } - - deleteEmoji(emoji) { - return this.rest.makeRequest('delete', `${Constants.Endpoints.guildEmojis(emoji.guild.id)}/${emoji.id}`, true) - .then(() => this.rest.client.actions.EmojiDelete.handle(emoji).data); - } - - getWebhook(id, token) { - return this.rest.makeRequest('get', Constants.Endpoints.webhook(id, token), !token).then(data => - new Webhook(this.rest.client, data) - ); - } - - getGuildWebhooks(guild) { - return this.rest.makeRequest('get', Constants.Endpoints.guildWebhooks(guild.id), true).then(data => { - const hooks = new Collection(); - for (const hook of data) hooks.set(hook.id, new Webhook(this.rest.client, hook)); - return hooks; - }); - } - - getChannelWebhooks(channel) { - return this.rest.makeRequest('get', Constants.Endpoints.channelWebhooks(channel.id), true).then(data => { - const hooks = new Collection(); - for (const hook of data) hooks.set(hook.id, new Webhook(this.rest.client, hook)); - return hooks; - }); - } - - createWebhook(channel, name, avatar) { - return this.rest.makeRequest('post', Constants.Endpoints.channelWebhooks(channel.id), true, { name, avatar }) - .then(data => new Webhook(this.rest.client, data)); - } - - editWebhook(webhook, name, avatar) { - return this.rest.makeRequest('patch', Constants.Endpoints.webhook(webhook.id, webhook.token), false, { - name, - avatar, - }).then(data => { - webhook.name = data.name; - webhook.avatar = data.avatar; - return webhook; - }); - } - - deleteWebhook(webhook) { - return this.rest.makeRequest('delete', Constants.Endpoints.webhook(webhook.id, webhook.token), false); - } - - sendWebhookMessage(webhook, content, { avatarURL, tts, disableEveryone, embeds } = {}, file = null) { - if (typeof content !== 'undefined') content = this.rest.client.resolver.resolveString(content); - if (content) { - if (disableEveryone || (typeof disableEveryone === 'undefined' && this.rest.client.options.disableEveryone)) { - content = content.replace(/@(everyone|here)/g, '@\u200b$1'); - } - } - return this.rest.makeRequest('post', `${Constants.Endpoints.webhook(webhook.id, webhook.token)}?wait=true`, false, { - username: webhook.name, - avatar_url: avatarURL, - content, - tts, - file, - embeds, - }); - } - - sendSlackWebhookMessage(webhook, body) { - return this.rest.makeRequest( - 'post', `${Constants.Endpoints.webhook(webhook.id, webhook.token)}/slack?wait=true`, false, body - ); - } - - fetchUserProfile(user) { - return this.rest.makeRequest('get', Constants.Endpoints.userProfile(user.id), true).then(data => - new UserProfile(user, data) - ); - } - - addFriend(user) { - return this.rest.makeRequest('post', Constants.Endpoints.relationships('@me'), true, { - username: user.username, - discriminator: user.discriminator, - }).then(() => user); - } - - removeFriend(user) { - return this.rest.makeRequest('delete', `${Constants.Endpoints.relationships('@me')}/${user.id}`, true) - .then(() => user); - } - - blockUser(user) { - return this.rest.makeRequest('put', `${Constants.Endpoints.relationships('@me')}/${user.id}`, true, { type: 2 }) - .then(() => user); - } - - unblockUser(user) { - return this.rest.makeRequest('delete', `${Constants.Endpoints.relationships('@me')}/${user.id}`, true) - .then(() => user); - } - - setRolePositions(guildID, roles) { - return this.rest.makeRequest('patch', Constants.Endpoints.guildRoles(guildID), true, roles).then(() => - this.rest.client.actions.GuildRolesPositionUpdate.handle({ - guild_id: guildID, - roles, - }).guild - ); - } - - addMessageReaction(message, emoji) { - return this.rest.makeRequest( - 'put', Constants.Endpoints.selfMessageReaction(message.channel.id, message.id, emoji), true - ).then(() => - this.rest.client.actions.MessageReactionAdd.handle({ - user_id: this.rest.client.user.id, - message_id: message.id, - emoji: parseEmoji(emoji), - channel_id: message.channel.id, - }).reaction - ); - } - - removeMessageReaction(message, emoji, user) { - let endpoint = Constants.Endpoints.selfMessageReaction(message.channel.id, message.id, emoji); - if (user.id !== this.rest.client.user.id) { - endpoint = Constants.Endpoints.userMessageReaction(message.channel.id, message.id, emoji, null, user.id); - } - return this.rest.makeRequest('delete', endpoint, true).then(() => - this.rest.client.actions.MessageReactionRemove.handle({ - user_id: user.id, - message_id: message.id, - emoji: parseEmoji(emoji), - channel_id: message.channel.id, - }).reaction - ); - } - - removeMessageReactions(message) { - this.rest.makeRequest('delete', Constants.Endpoints.messageReactions(message.channel.id, message.id), true) - .then(() => message); - } - - getMessageReactionUsers(message, emoji, limit = 100) { - return this.rest.makeRequest( - 'get', Constants.Endpoints.messageReaction(message.channel.id, message.id, emoji, limit), true - ); - } - - getMyApplication() { - return this.rest.makeRequest('get', Constants.Endpoints.myApplication, true).then(app => - new ClientOAuth2Application(this.rest.client, app) - ); - } - - setNote(user, note) { - return this.rest.makeRequest('put', Constants.Endpoints.note(user.id), true, { note }).then(() => user); - } - } - - module.exports = RESTMethods; + // Allow for unix-like usage: A.pipe(B).pipe(C) + return dest; +}; /***/ }, /* 10 */ /***/ function(module, exports) { - /** - * A Map with additional utility methods. This is used throughout discord.js rather than Arrays for anything that has - * an ID, for significantly improved performance and ease-of-use. - * @extends {Map} - */ - class Collection extends Map { - constructor(iterable) { - super(iterable); - - /** - * Cached array for the `array()` method - will be reset to `null` whenever `set()` or `delete()` are called. - * @type {?Array} - * @private - */ - this._array = null; - - /** - * Cached array for the `keyArray()` method - will be reset to `null` whenever `set()` or `delete()` are called. - * @type {?Array} - * @private - */ - this._keyArray = null; - } - - set(key, val) { - super.set(key, val); - this._array = null; - this._keyArray = null; - } - - delete(key) { - super.delete(key); - this._array = null; - this._keyArray = null; - } - - /** - * Creates an ordered array of the values of this collection, and caches it internally. The array will only be - * reconstructed if an item is added to or removed from the collection, or if you change the length of the array - * itself. If you don't want this caching behaviour, use `Array.from(collection.values())` instead. - * @returns {Array} - */ - array() { - if (!this._array || this._array.length !== this.size) this._array = Array.from(this.values()); - return this._array; - } - - /** - * Creates an ordered array of the keys of this collection, and caches it internally. The array will only be - * reconstructed if an item is added to or removed from the collection, or if you change the length of the array - * itself. If you don't want this caching behaviour, use `Array.from(collection.keys())` instead. - * @returns {Array} - */ - keyArray() { - if (!this._keyArray || this._keyArray.length !== this.size) this._keyArray = Array.from(this.keys()); - return this._keyArray; - } - - /** - * Obtains the first item in this collection. - * @returns {*} - */ - first() { - return this.values().next().value; - } - - /** - * Obtains the first key in this collection. - * @returns {*} - */ - firstKey() { - return this.keys().next().value; - } - - /** - * Obtains the last item in this collection. This relies on the `array()` method, and thus the caching mechanism - * applies here as well. - * @returns {*} - */ - last() { - const arr = this.array(); - return arr[arr.length - 1]; - } - - /** - * Obtains the last key in this collection. This relies on the `keyArray()` method, and thus the caching mechanism - * applies here as well. - * @returns {*} - */ - lastKey() { - const arr = this.keyArray(); - return arr[arr.length - 1]; - } - - /** - * Obtains a random item from this collection. This relies on the `array()` method, and thus the caching mechanism - * applies here as well. - * @returns {*} - */ - random() { - const arr = this.array(); - return arr[Math.floor(Math.random() * arr.length)]; - } - - /** - * Obtains a random key from this collection. This relies on the `keyArray()` method, and thus the caching mechanism - * applies here as well. - * @returns {*} - */ - randomKey() { - const arr = this.keyArray(); - return arr[Math.floor(Math.random() * arr.length)]; - } - - /** - * Searches for all items where their specified property's value is identical to the given value - * (`item[prop] === value`). - * @param {string} prop The property to test against - * @param {*} value The expected value - * @returns {Array} - * @example - * collection.findAll('username', 'Bob'); - */ - findAll(prop, value) { - if (typeof prop !== 'string') throw new TypeError('Key must be a string.'); - if (typeof value === 'undefined') throw new Error('Value must be specified.'); - const results = []; - for (const item of this.values()) { - if (item[prop] === value) results.push(item); - } - return results; - } - - /** - * Searches for a single item where its specified property's value is identical to the given value - * (`item[prop] === value`), or the given function returns a truthy value. In the latter case, this is identical to - * [Array.find()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find). - * Do not use this to obtain an item by its ID. Instead, use `collection.get(id)`. See - * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/get) for details. - * @param {string|Function} propOrFn The property to test against, or the function to test with - * @param {*} [value] The expected value - only applicable and required if using a property for the first argument - * @returns {*} - * @example - * collection.find('username', 'Bob'); - * @example - * collection.find(val => val.username === 'Bob'); - */ - find(propOrFn, value) { - if (typeof propOrFn === 'string') { - if (typeof value === 'undefined') throw new Error('Value must be specified.'); - if (propOrFn === 'id') throw new RangeError('Don\'t use .find() with IDs. Instead, use .get(id).'); - for (const item of this.values()) { - if (item[propOrFn] === value) return item; - } - return null; - } else if (typeof propOrFn === 'function') { - for (const [key, val] of this) { - if (propOrFn(val, key, this)) return val; - } - return null; - } else { - throw new Error('First argument must be a property string or a function.'); - } - } - - /* eslint-disable max-len */ - /** - * Searches for the key of a single item where its specified property's value is identical to the given value - * (`item[prop] === value`), or the given function returns a truthy value. In the latter case, this is identical to - * [Array.findIndex()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/findIndex). - * @param {string|Function} propOrFn The property to test against, or the function to test with - * @param {*} [value] The expected value - only applicable and required if using a property for the first argument - * @returns {*} - * @example - * collection.findKey('username', 'Bob'); - * @example - * collection.findKey(val => val.username === 'Bob'); - */ - /* eslint-enable max-len */ - findKey(propOrFn, value) { - if (typeof propOrFn === 'string') { - if (typeof value === 'undefined') throw new Error('Value must be specified.'); - for (const [key, val] of this) { - if (val[propOrFn] === value) return key; - } - return null; - } else if (typeof propOrFn === 'function') { - for (const [key, val] of this) { - if (propOrFn(val, key, this)) return key; - } - return null; - } else { - throw new Error('First argument must be a property string or a function.'); - } - } - - /** - * Searches for the existence of a single item where its specified property's value is identical to the given value - * (`item[prop] === value`). - * Do not use this to check for an item by its ID. Instead, use `collection.has(id)`. See - * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map/has) for details. - * @param {string} prop The property to test against - * @param {*} value The expected value - * @returns {boolean} - * @example - * if (collection.exists('username', 'Bob')) { - * console.log('user here!'); - * } - */ - exists(prop, value) { - if (prop === 'id') throw new RangeError('Don\'t use .exists() with IDs. Instead, use .has(id).'); - return Boolean(this.find(prop, value)); - } - - /** - * Identical to - * [Array.filter()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter), - * but returns a Collection instead of an Array. - * @param {Function} fn Function used to test (should return a boolean) - * @param {Object} [thisArg] Value to use as `this` when executing function - * @returns {Collection} - */ - filter(fn, thisArg) { - if (thisArg) fn = fn.bind(thisArg); - const results = new Collection(); - for (const [key, val] of this) { - if (fn(val, key, this)) results.set(key, val); - } - return results; - } - - /** - * Identical to - * [Array.filter()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter). - * @param {Function} fn Function used to test (should return a boolean) - * @param {Object} [thisArg] Value to use as `this` when executing function - * @returns {Array} - */ - filterArray(fn, thisArg) { - if (thisArg) fn = fn.bind(thisArg); - const results = []; - for (const [key, val] of this) { - if (fn(val, key, this)) results.push(val); - } - return results; - } - - /** - * Identical to - * [Array.map()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map). - * @param {Function} fn Function that produces an element of the new array, taking three arguments - * @param {*} [thisArg] Value to use as `this` when executing function - * @returns {Array} - */ - map(fn, thisArg) { - if (thisArg) fn = fn.bind(thisArg); - const arr = new Array(this.size); - let i = 0; - for (const [key, val] of this) arr[i++] = fn(val, key, this); - return arr; - } - - /** - * Identical to - * [Array.some()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/some). - * @param {Function} fn Function used to test (should return a boolean) - * @param {Object} [thisArg] Value to use as `this` when executing function - * @returns {boolean} - */ - some(fn, thisArg) { - if (thisArg) fn = fn.bind(thisArg); - for (const [key, val] of this) { - if (fn(val, key, this)) return true; - } - return false; - } - - /** - * Identical to - * [Array.every()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/every). - * @param {Function} fn Function used to test (should return a boolean) - * @param {Object} [thisArg] Value to use as `this` when executing function - * @returns {boolean} - */ - every(fn, thisArg) { - if (thisArg) fn = fn.bind(thisArg); - for (const [key, val] of this) { - if (!fn(val, key, this)) return false; - } - return true; - } - - /** - * Identical to - * [Array.reduce()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce). - * @param {Function} fn Function used to reduce - * @param {*} [startVal] The starting value - * @returns {*} - */ - reduce(fn, startVal) { - let currentVal = startVal; - for (const [key, val] of this) currentVal = fn(currentVal, val, key, this); - return currentVal; - } - - /** - * Combines this collection with others into a new collection. None of the source collections are modified. - * @param {Collection} collections Collections to merge (infinite/rest argument, not an array) - * @returns {Collection} - * @example const newColl = someColl.concat(someOtherColl, anotherColl, ohBoyAColl); - */ - concat(...collections) { - const newColl = new this.constructor(); - for (const [key, val] of this) newColl.set(key, val); - for (const coll of collections) { - for (const [key, val] of coll) newColl.set(key, val); - } - return newColl; - } - - /** - * Calls the `delete()` method on all items that have it. - * @returns {Promise[]} - */ - deleteAll() { - const returns = []; - for (const item of this.values()) { - if (item.delete) returns.push(item.delete()); - } - return returns; - } - } - - module.exports = Collection; /***/ }, /* 11 */ -/***/ function(module, exports) { +/***/ function(module, exports, __webpack_require__) { - module.exports = function splitMessage(text, { maxLength = 1950, char = '\n', prepend = '', append = '' } = {}) { - if (text.length <= maxLength) return text; - const splitText = text.split(char); - if (splitText.length === 1) throw new Error('Message exceeds the max length and contains no split characters.'); - const messages = ['']; - let msg = 0; - for (let i = 0; i < splitText.length; i++) { - if (messages[msg].length + splitText[i].length + 1 > maxLength) { - messages[msg] += append; - messages.push(prepend); - msg++; - } - messages[msg] += (messages[msg].length > 0 && messages[msg] !== prepend ? char : '') + splitText[i]; - } - return messages; - }; +const TextBasedChannel = __webpack_require__(28); +const Constants = __webpack_require__(2); +const Presence = __webpack_require__(12).Presence; + +/** + * Represents a user on Discord. + * @implements {TextBasedChannel} + */ +class User { + constructor(client, data) { + /** + * The Client that created the instance of the the User. + * @type {Client} + */ + this.client = client; + Object.defineProperty(this, 'client', { enumerable: false, configurable: false }); + + if (data) this.setup(data); + } + + setup(data) { + /** + * The ID of the user + * @type {string} + */ + this.id = data.id; + + /** + * The username of the user + * @type {string} + */ + this.username = data.username; + + /** + * A discriminator based on username for the user + * @type {string} + */ + this.discriminator = data.discriminator; + + /** + * The ID of the user's avatar + * @type {string} + */ + this.avatar = data.avatar; + + /** + * Whether or not the user is a bot. + * @type {boolean} + */ + this.bot = Boolean(data.bot); + } + + patch(data) { + for (const prop of ['id', 'username', 'discriminator', 'avatar', 'bot']) { + if (typeof data[prop] !== 'undefined') this[prop] = data[prop]; + } + } + + /** + * The timestamp the user was created at + * @type {number} + * @readonly + */ + get createdTimestamp() { + return (this.id / 4194304) + 1420070400000; + } + + /** + * The time the user was created + * @type {Date} + * @readonly + */ + get createdAt() { + return new Date(this.createdTimestamp); + } + + /** + * The presence of this user + * @type {Presence} + * @readonly + */ + get presence() { + if (this.client.presences.has(this.id)) return this.client.presences.get(this.id); + for (const guild of this.client.guilds.values()) { + if (guild.presences.has(this.id)) return guild.presences.get(this.id); + } + return new Presence(); + } + + /** + * A link to the user's avatar (if they have one, otherwise null) + * @type {?string} + * @readonly + */ + get avatarURL() { + if (!this.avatar) return null; + return Constants.Endpoints.avatar(this.id, this.avatar); + } + + /** + * The note that is set for the user + * This is only available when using a user account. + * @type {?string} + * @readonly + */ + get note() { + return this.client.user.notes.get(this.id) || null; + } + + /** + * Check whether the user is typing in a channel. + * @param {ChannelResolvable} channel The channel to check in + * @returns {boolean} + */ + typingIn(channel) { + channel = this.client.resolver.resolveChannel(channel); + return channel._typing.has(this.id); + } + + /** + * Get the time that the user started typing. + * @param {ChannelResolvable} channel The channel to get the time in + * @returns {?Date} + */ + typingSinceIn(channel) { + channel = this.client.resolver.resolveChannel(channel); + return channel._typing.has(this.id) ? new Date(channel._typing.get(this.id).since) : null; + } + + /** + * Get the amount of time the user has been typing in a channel for (in milliseconds), or -1 if they're not typing. + * @param {ChannelResolvable} channel The channel to get the time in + * @returns {number} + */ + typingDurationIn(channel) { + channel = this.client.resolver.resolveChannel(channel); + return channel._typing.has(this.id) ? channel._typing.get(this.id).elapsedTime : -1; + } + + /** + * Deletes a DM channel (if one exists) between the client and the user. Resolves with the channel if successful. + * @returns {Promise} + */ + deleteDM() { + return this.client.rest.methods.deleteChannel(this); + } + + /** + * Sends a friend request to the user + * This is only available when using a user account. + * @returns {Promise} + */ + addFriend() { + return this.client.rest.methods.addFriend(this); + } + + /** + * Removes the user from your friends + * This is only available when using a user account. + * @returns {Promise} + */ + removeFriend() { + return this.client.rest.methods.removeFriend(this); + } + + /** + * Blocks the user + * This is only available when using a user account. + * @returns {Promise} + */ + block() { + return this.client.rest.methods.blockUser(this); + } + + /** + * Unblocks the user + * This is only available when using a user account. + * @returns {Promise} + */ + unblock() { + return this.client.rest.methods.unblockUser(this); + } + + /** + * Get the profile of the user + * This is only available when using a user account. + * @returns {Promise} + */ + fetchProfile() { + return this.client.rest.methods.fetchUserProfile(this); + } + + /** + * Sets a note for the user + * This is only available when using a user account. + * @param {string} note The note to set for the user + * @returns {Promise} + */ + setNote(note) { + return this.client.rest.methods.setNote(this, note); + } + + /** + * Checks if the user is equal to another. It compares username, ID, discriminator, status and the game being played. + * It is recommended to compare equality by using `user.id === user2.id` unless you want to compare all properties. + * @param {User} user The user to compare + * @returns {boolean} + */ + equals(user) { + let equal = user && + this.id === user.id && + this.username === user.username && + this.discriminator === user.discriminator && + this.avatar === user.avatar && + this.bot === Boolean(user.bot); + + return equal; + } + + /** + * When concatenated with a string, this automatically concatenates the user's mention instead of the User object. + * @returns {string} + * @example + * // logs: Hello from <@123456789>! + * console.log(`Hello from ${user}!`); + */ + toString() { + return `<@${this.id}>`; + } + + // These are here only for documentation purposes - they are implemented by TextBasedChannel + sendMessage() { return; } + sendTTSMessage() { return; } + sendFile() { return; } + sendCode() { return; } +} + +TextBasedChannel.applyToClass(User); + +module.exports = User; /***/ }, /* 12 */ /***/ function(module, exports) { - module.exports = function parseEmoji(text) { - if (text.includes('%')) { - text = decodeURIComponent(text); - } - if (text.includes(':')) { - const [name, id] = text.split(':'); - return { name, id }; - } else { - return { - name: text, - id: null, - }; - } - }; +/** + * Represents a user's presence + */ +class Presence { + constructor(data = {}) { + /** + * The status of the presence: + * + * * **`online`** - user is online + * * **`offline`** - user is offline or invisible + * * **`idle`** - user is AFK + * * **`dnd`** - user is in Do not Disturb + * @type {string} + */ + this.status = data.status || 'offline'; + + /** + * The game that the user is playing, `null` if they aren't playing a game. + * @type {?Game} + */ + this.game = data.game ? new Game(data.game) : null; + } + + update(data) { + this.status = data.status || this.status; + this.game = data.game ? new Game(data.game) : null; + } + + /** + * Whether this presence is equal to another + * @param {Presence} other the presence to compare + * @returns {boolean} + */ + equals(other) { + return ( + other && + this.status === other.status && + this.game ? this.game.equals(other.game) : !other.game + ); + } +} + +/** + * Represents a game that is part of a user's presence. + */ +class Game { + constructor(data) { + /** + * The name of the game being played + * @type {string} + */ + this.name = data.name; + + /** + * The type of the game status + * @type {number} + */ + this.type = data.type; + + /** + * If the game is being streamed, a link to the stream + * @type {?string} + */ + this.url = data.url || null; + } + + /** + * Whether or not the game is being streamed + * @type {boolean} + * @readonly + */ + get streaming() { + return this.type === 1; + } + + /** + * Whether this game is equal to another game + * @param {Game} other the other game to compare + * @returns {boolean} + */ + equals(other) { + return ( + other && + this.name === other.name && + this.type === other.type && + this.url === other.url + ); + } +} + +exports.Presence = Presence; +exports.Game = Game; /***/ }, /* 13 */ /***/ function(module, exports, __webpack_require__) { - const TextBasedChannel = __webpack_require__(14); - const Constants = __webpack_require__(5); - const Presence = __webpack_require__(24).Presence; +var hash = exports; - /** - * Represents a user on Discord. - * @implements {TextBasedChannel} - */ - class User { - constructor(client, data) { - /** - * The Client that created the instance of the the User. - * @type {Client} - */ - this.client = client; - Object.defineProperty(this, 'client', { enumerable: false, configurable: false }); +hash.utils = __webpack_require__(195); +hash.common = __webpack_require__(191); +hash.sha = __webpack_require__(194); +hash.ripemd = __webpack_require__(193); +hash.hmac = __webpack_require__(192); - if (data) this.setup(data); - } - - setup(data) { - /** - * The ID of the user - * @type {string} - */ - this.id = data.id; - - /** - * The username of the user - * @type {string} - */ - this.username = data.username; - - /** - * A discriminator based on username for the user - * @type {string} - */ - this.discriminator = data.discriminator; - - /** - * The ID of the user's avatar - * @type {string} - */ - this.avatar = data.avatar; - - /** - * Whether or not the user is a bot. - * @type {boolean} - */ - this.bot = Boolean(data.bot); - } - - patch(data) { - for (const prop of ['id', 'username', 'discriminator', 'avatar', 'bot']) { - if (typeof data[prop] !== 'undefined') this[prop] = data[prop]; - } - } - - /** - * The timestamp the user was created at - * @type {number} - * @readonly - */ - get createdTimestamp() { - return (this.id / 4194304) + 1420070400000; - } - - /** - * The time the user was created - * @type {Date} - * @readonly - */ - get createdAt() { - return new Date(this.createdTimestamp); - } - - /** - * The presence of this user - * @type {Presence} - * @readonly - */ - get presence() { - if (this.client.presences.has(this.id)) return this.client.presences.get(this.id); - for (const guild of this.client.guilds.values()) { - if (guild.presences.has(this.id)) return guild.presences.get(this.id); - } - return new Presence(); - } - - /** - * A link to the user's avatar (if they have one, otherwise null) - * @type {?string} - * @readonly - */ - get avatarURL() { - if (!this.avatar) return null; - return Constants.Endpoints.avatar(this.id, this.avatar); - } - - /** - * The note that is set for the user - * This is only available when using a user account. - * @type {?string} - * @readonly - */ - get note() { - return this.client.user.notes.get(this.id) || null; - } - - /** - * Check whether the user is typing in a channel. - * @param {ChannelResolvable} channel The channel to check in - * @returns {boolean} - */ - typingIn(channel) { - channel = this.client.resolver.resolveChannel(channel); - return channel._typing.has(this.id); - } - - /** - * Get the time that the user started typing. - * @param {ChannelResolvable} channel The channel to get the time in - * @returns {?Date} - */ - typingSinceIn(channel) { - channel = this.client.resolver.resolveChannel(channel); - return channel._typing.has(this.id) ? new Date(channel._typing.get(this.id).since) : null; - } - - /** - * Get the amount of time the user has been typing in a channel for (in milliseconds), or -1 if they're not typing. - * @param {ChannelResolvable} channel The channel to get the time in - * @returns {number} - */ - typingDurationIn(channel) { - channel = this.client.resolver.resolveChannel(channel); - return channel._typing.has(this.id) ? channel._typing.get(this.id).elapsedTime : -1; - } - - /** - * Deletes a DM channel (if one exists) between the client and the user. Resolves with the channel if successful. - * @returns {Promise} - */ - deleteDM() { - return this.client.rest.methods.deleteChannel(this); - } - - /** - * Sends a friend request to the user - * This is only available when using a user account. - * @returns {Promise} - */ - addFriend() { - return this.client.rest.methods.addFriend(this); - } - - /** - * Removes the user from your friends - * This is only available when using a user account. - * @returns {Promise} - */ - removeFriend() { - return this.client.rest.methods.removeFriend(this); - } - - /** - * Blocks the user - * This is only available when using a user account. - * @returns {Promise} - */ - block() { - return this.client.rest.methods.blockUser(this); - } - - /** - * Unblocks the user - * This is only available when using a user account. - * @returns {Promise} - */ - unblock() { - return this.client.rest.methods.unblockUser(this); - } - - /** - * Get the profile of the user - * This is only available when using a user account. - * @returns {Promise} - */ - fetchProfile() { - return this.client.rest.methods.fetchUserProfile(this); - } - - /** - * Sets a note for the user - * This is only available when using a user account. - * @param {string} note The note to set for the user - * @returns {Promise} - */ - setNote(note) { - return this.client.rest.methods.setNote(this, note); - } - - /** - * Checks if the user is equal to another. It compares username, ID, discriminator, status and the game being played. - * It is recommended to compare equality by using `user.id === user2.id` unless you want to compare all properties. - * @param {User} user The user to compare - * @returns {boolean} - */ - equals(user) { - let equal = user && - this.id === user.id && - this.username === user.username && - this.discriminator === user.discriminator && - this.avatar === user.avatar && - this.bot === Boolean(user.bot); - - return equal; - } - - /** - * When concatenated with a string, this automatically concatenates the user's mention instead of the User object. - * @returns {string} - * @example - * // logs: Hello from <@123456789>! - * console.log(`Hello from ${user}!`); - */ - toString() { - return `<@${this.id}>`; - } - - // These are here only for documentation purposes - they are implemented by TextBasedChannel - sendMessage() { return; } - sendTTSMessage() { return; } - sendFile() { return; } - sendCode() { return; } - } - - TextBasedChannel.applyToClass(User); - - module.exports = User; +// Proxy hash functions to the main object +hash.sha1 = hash.sha.sha1; +hash.sha256 = hash.sha.sha256; +hash.sha224 = hash.sha.sha224; +hash.sha384 = hash.sha.sha384; +hash.sha512 = hash.sha.sha512; +hash.ripemd160 = hash.ripemd.ripemd160; /***/ }, /* 14 */ /***/ function(module, exports, __webpack_require__) { - const path = __webpack_require__(15); - const Message = __webpack_require__(16); - const MessageCollector = __webpack_require__(23); - const Collection = __webpack_require__(10); - const escapeMarkdown = __webpack_require__(19); +/* WEBPACK VAR INJECTION */(function(process) {// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. - /** - * Interface for classes that have text-channel-like features - * @interface - */ - class TextBasedChannel { - constructor() { - /** - * A collection containing the messages sent to this channel. - * @type {Collection} - */ - this.messages = new Collection(); +// resolves . and .. elements in a path array with directory names there +// must be no slashes, empty elements, or device names (c:\) in the array +// (so also no leading and trailing slashes - it does not distinguish +// relative and absolute paths) +function normalizeArray(parts, allowAboveRoot) { + // if the path tries to go above the root, `up` ends up > 0 + var up = 0; + for (var i = parts.length - 1; i >= 0; i--) { + var last = parts[i]; + if (last === '.') { + parts.splice(i, 1); + } else if (last === '..') { + parts.splice(i, 1); + up++; + } else if (up) { + parts.splice(i, 1); + up--; + } + } - /** - * The ID of the last message in the channel, if one was sent. - * @type {?string} - */ - this.lastMessageID = null; - } + // if the path is allowed to go above the root, restore leading ..s + if (allowAboveRoot) { + for (; up--; up) { + parts.unshift('..'); + } + } - /** - * Options that can be passed into sendMessage, sendTTSMessage, sendFile, sendCode, or Message.reply - * @typedef {Object} MessageOptions - * @property {boolean} [tts=false] Whether or not the message should be spoken aloud - * @property {string} [nonce=''] The nonce for the message - * @property {Object} [embed] An embed for the message - * (see [here](https://discordapp.com/developers/docs/resources/channel#embed-object) for more details) - * @property {boolean} [disableEveryone=this.client.options.disableEveryone] Whether or not @everyone and @here - * should be replaced with plain-text - * @property {boolean|SplitOptions} [split=false] Whether or not the message should be split into multiple messages if - * it exceeds the character limit. If an object is provided, these are the options for splitting the message. - */ + return parts; +} - /** - * Options for splitting a message - * @typedef {Object} SplitOptions - * @property {number} [maxLength=1950] Maximum character length per message piece - * @property {string} [char='\n'] Character to split the message with - * @property {string} [prepend=''] Text to prepend to every piece except the first - * @property {string} [append=''] Text to append to every piece except the last - */ +// Split a filename into [root, dir, basename, ext], unix version +// 'root' is just a slash, or nothing. +var splitPathRe = + /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/; +var splitPath = function(filename) { + return splitPathRe.exec(filename).slice(1); +}; - /** - * Send a message to this channel - * @param {StringResolvable} content The content to send - * @param {MessageOptions} [options={}] The options to provide - * @returns {Promise} - * @example - * // send a message - * channel.sendMessage('hello!') - * .then(message => console.log(`Sent message: ${message.content}`)) - * .catch(console.error); - */ - sendMessage(content, options = {}) { - return this.client.rest.methods.sendMessage(this, content, options); - } +// path.resolve([from ...], to) +// posix version +exports.resolve = function() { + var resolvedPath = '', + resolvedAbsolute = false; - /** - * Send a text-to-speech message to this channel - * @param {StringResolvable} content The content to send - * @param {MessageOptions} [options={}] The options to provide - * @returns {Promise} - * @example - * // send a TTS message - * channel.sendTTSMessage('hello!') - * .then(message => console.log(`Sent tts message: ${message.content}`)) - * .catch(console.error); - */ - sendTTSMessage(content, options = {}) { - Object.assign(options, { tts: true }); - return this.client.rest.methods.sendMessage(this, content, options); - } + for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) { + var path = (i >= 0) ? arguments[i] : process.cwd(); - /** - * Send a file to this channel - * @param {BufferResolvable} attachment The file to send - * @param {string} [fileName="file.jpg"] The name and extension of the file - * @param {StringResolvable} [content] Text message to send with the attachment - * @param {MessageOptions} [options] The options to provide - * @returns {Promise} - */ - sendFile(attachment, fileName, content, options = {}) { - if (!fileName) { - if (typeof attachment === 'string') { - fileName = path.basename(attachment); - } else if (attachment && attachment.path) { - fileName = path.basename(attachment.path); - } else { - fileName = 'file.jpg'; - } - } - return this.client.resolver.resolveBuffer(attachment).then(file => - this.client.rest.methods.sendMessage(this, content, options, { - file, - name: fileName, - }) - ); - } + // Skip empty and invalid entries + if (typeof path !== 'string') { + throw new TypeError('Arguments to path.resolve must be strings'); + } else if (!path) { + continue; + } - /** - * Send a code block to this channel - * @param {string} lang Language for the code block - * @param {StringResolvable} content Content of the code block - * @param {MessageOptions} options The options to provide - * @returns {Promise} - */ - sendCode(lang, content, options = {}) { - if (options.split) { - if (typeof options.split !== 'object') options.split = {}; - if (!options.split.prepend) options.split.prepend = `\`\`\`${lang || ''}\n`; - if (!options.split.append) options.split.append = '\n```'; - } - content = escapeMarkdown(this.client.resolver.resolveString(content), true); - return this.sendMessage(`\`\`\`${lang || ''}\n${content}\n\`\`\``, options); - } + resolvedPath = path + '/' + resolvedPath; + resolvedAbsolute = path.charAt(0) === '/'; + } - /** - * Gets a single message from this channel, regardless of it being cached or not. - * This is only available when using a bot account. - * @param {string} messageID The ID of the message to get - * @returns {Promise} - * @example - * // get message - * channel.fetchMessage('99539446449315840') - * .then(message => console.log(message.content)) - * .catch(console.error); - */ - fetchMessage(messageID) { - return this.client.rest.methods.getChannelMessage(this, messageID).then(data => { - const msg = data instanceof Message ? data : new Message(this, data, this.client); - this._cacheMessage(msg); - return msg; - }); - } + // At this point the path should be resolved to a full absolute path, but + // handle relative paths to be safe (might happen when process.cwd() fails) - /** - * The parameters to pass in when requesting previous messages from a channel. `around`, `before` and - * `after` are mutually exclusive. All the parameters are optional. - * @typedef {Object} ChannelLogsQueryOptions - * @property {number} [limit=50] Number of messages to acquire - * @property {string} [before] ID of a message to get the messages that were posted before it - * @property {string} [after] ID of a message to get the messages that were posted after it - * @property {string} [around] ID of a message to get the messages that were posted around it - */ + // Normalize the path + resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function(p) { + return !!p; + }), !resolvedAbsolute).join('/'); - /** - * Gets the past messages sent in this channel. Resolves with a collection mapping message ID's to Message objects. - * @param {ChannelLogsQueryOptions} [options={}] The query parameters to pass in - * @returns {Promise>} - * @example - * // get messages - * channel.fetchMessages({limit: 10}) - * .then(messages => console.log(`Received ${messages.size} messages`)) - * .catch(console.error); - */ - fetchMessages(options = {}) { - return this.client.rest.methods.getChannelMessages(this, options).then(data => { - const messages = new Collection(); - for (const message of data) { - const msg = new Message(this, message, this.client); - messages.set(message.id, msg); - this._cacheMessage(msg); - } - return messages; - }); - } + return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.'; +}; - /** - * Fetches the pinned messages of this channel and returns a collection of them. - * @returns {Promise>} - */ - fetchPinnedMessages() { - return this.client.rest.methods.getChannelPinnedMessages(this).then(data => { - const messages = new Collection(); - for (const message of data) { - const msg = new Message(this, message, this.client); - messages.set(message.id, msg); - this._cacheMessage(msg); - } - return messages; - }); - } +// path.normalize(path) +// posix version +exports.normalize = function(path) { + var isAbsolute = exports.isAbsolute(path), + trailingSlash = substr(path, -1) === '/'; - /** - * Starts a typing indicator in the channel. - * @param {number} [count] The number of times startTyping should be considered to have been called - * @example - * // start typing in a channel - * channel.startTyping(); - */ - startTyping(count) { - if (typeof count !== 'undefined' && count < 1) throw new RangeError('Count must be at least 1.'); - if (!this.client.user._typing.has(this.id)) { - this.client.user._typing.set(this.id, { - count: count || 1, - interval: this.client.setInterval(() => { - this.client.rest.methods.sendTyping(this.id); - }, 4000), - }); - this.client.rest.methods.sendTyping(this.id); - } else { - const entry = this.client.user._typing.get(this.id); - entry.count = count || entry.count + 1; - } - } + // Normalize the path + path = normalizeArray(filter(path.split('/'), function(p) { + return !!p; + }), !isAbsolute).join('/'); - /** - * Stops the typing indicator in the channel. - * The indicator will only stop if this is called as many times as startTyping(). - * It can take a few seconds for the client user to stop typing. - * @param {boolean} [force=false] Whether or not to reset the call count and force the indicator to stop - * @example - * // stop typing in a channel - * channel.stopTyping(); - * @example - * // force typing to fully stop in a channel - * channel.stopTyping(true); - */ - stopTyping(force = false) { - if (this.client.user._typing.has(this.id)) { - const entry = this.client.user._typing.get(this.id); - entry.count--; - if (entry.count <= 0 || force) { - this.client.clearInterval(entry.interval); - this.client.user._typing.delete(this.id); - } - } - } + if (!path && !isAbsolute) { + path = '.'; + } + if (path && trailingSlash) { + path += '/'; + } - /** - * Whether or not the typing indicator is being shown in the channel. - * @type {boolean} - * @readonly - */ - get typing() { - return this.client.user._typing.has(this.id); - } + return (isAbsolute ? '/' : '') + path; +}; - /** - * Number of times `startTyping` has been called. - * @type {number} - * @readonly - */ - get typingCount() { - if (this.client.user._typing.has(this.id)) return this.client.user._typing.get(this.id).count; - return 0; - } +// posix version +exports.isAbsolute = function(path) { + return path.charAt(0) === '/'; +}; - /** - * Creates a Message Collector - * @param {CollectorFilterFunction} filter The filter to create the collector with - * @param {CollectorOptions} [options={}] The options to pass to the collector - * @returns {MessageCollector} - * @example - * // create a message collector - * const collector = channel.createCollector( - * m => m.content.includes('discord'), - * { time: 15000 } - * ); - * collector.on('message', m => console.log(`Collected ${m.content}`)); - * collector.on('end', collected => console.log(`Collected ${collected.size} items`)); - */ - createCollector(filter, options = {}) { - return new MessageCollector(this, filter, options); - } +// posix version +exports.join = function() { + var paths = Array.prototype.slice.call(arguments, 0); + return exports.normalize(filter(paths, function(p, index) { + if (typeof p !== 'string') { + throw new TypeError('Arguments to path.join must be strings'); + } + return p; + }).join('/')); +}; - /** - * An object containing the same properties as CollectorOptions, but a few more: - * @typedef {CollectorOptions} AwaitMessagesOptions - * @property {string[]} [errors] Stop/end reasons that cause the promise to reject - */ - /** - * Similar to createCollector but in promise form. Resolves with a collection of messages that pass the specified - * filter. - * @param {CollectorFilterFunction} filter The filter function to use - * @param {AwaitMessagesOptions} [options={}] Optional options to pass to the internal collector - * @returns {Promise>} - * @example - * // await !vote messages - * const filter = m => m.content.startsWith('!vote'); - * // errors: ['time'] treats ending because of the time limit as an error - * channel.awaitMessages(filter, { max: 4, time: 60000, errors: ['time'] }) - * .then(collected => console.log(collected.size)) - * .catch(collected => console.log(`After a minute, only ${collected.size} out of 4 voted.`)); - */ - awaitMessages(filter, options = {}) { - return new Promise((resolve, reject) => { - const collector = this.createCollector(filter, options); - collector.on('end', (collection, reason) => { - if (options.errors && options.errors.includes(reason)) { - reject(collection); - } else { - resolve(collection); - } - }); - }); - } +// path.relative(from, to) +// posix version +exports.relative = function(from, to) { + from = exports.resolve(from).substr(1); + to = exports.resolve(to).substr(1); - /** - * Bulk delete given messages. - * This is only available when using a bot account. - * @param {Collection|Message[]|number} messages Messages to delete, or number of messages to delete - * @returns {Promise>} Deleted messages - */ - bulkDelete(messages) { - if (!isNaN(messages)) return this.fetchMessages({ limit: messages }).then(msgs => this.bulkDelete(msgs)); - if (messages instanceof Array || messages instanceof Collection) { - const messageIDs = messages instanceof Collection ? messages.keyArray() : messages.map(m => m.id); - return this.client.rest.methods.bulkDeleteMessages(this, messageIDs); - } - throw new TypeError('The messages must be an Array, Collection, or number.'); - } + function trim(arr) { + var start = 0; + for (; start < arr.length; start++) { + if (arr[start] !== '') break; + } - _cacheMessage(message) { - const maxSize = this.client.options.messageCacheMaxSize; - if (maxSize === 0) return null; - if (this.messages.size >= maxSize && maxSize > 0) this.messages.delete(this.messages.firstKey()); - this.messages.set(message.id, message); - return message; - } - } + var end = arr.length - 1; + for (; end >= 0; end--) { + if (arr[end] !== '') break; + } - exports.applyToClass = (structure, full = false) => { - const props = ['sendMessage', 'sendTTSMessage', 'sendFile', 'sendCode']; - if (full) { - props.push('_cacheMessage'); - props.push('fetchMessages'); - props.push('fetchMessage'); - props.push('bulkDelete'); - props.push('startTyping'); - props.push('stopTyping'); - props.push('typing'); - props.push('typingCount'); - props.push('fetchPinnedMessages'); - props.push('createCollector'); - props.push('awaitMessages'); - } - for (const prop of props) applyProp(structure, prop); - }; + if (start > end) return []; + return arr.slice(start, end - start + 1); + } - function applyProp(structure, prop) { - Object.defineProperty(structure.prototype, prop, Object.getOwnPropertyDescriptor(TextBasedChannel.prototype, prop)); - } + var fromParts = trim(from.split('/')); + var toParts = trim(to.split('/')); + var length = Math.min(fromParts.length, toParts.length); + var samePartsLength = length; + for (var i = 0; i < length; i++) { + if (fromParts[i] !== toParts[i]) { + samePartsLength = i; + break; + } + } + + var outputParts = []; + for (var i = samePartsLength; i < fromParts.length; i++) { + outputParts.push('..'); + } + + outputParts = outputParts.concat(toParts.slice(samePartsLength)); + + return outputParts.join('/'); +}; + +exports.sep = '/'; +exports.delimiter = ':'; + +exports.dirname = function(path) { + var result = splitPath(path), + root = result[0], + dir = result[1]; + + if (!root && !dir) { + // No dirname whatsoever + return '.'; + } + + if (dir) { + // It has a dirname, strip trailing slash + dir = dir.substr(0, dir.length - 1); + } + + return root + dir; +}; + + +exports.basename = function(path, ext) { + var f = splitPath(path)[2]; + // TODO: make this comparison case-insensitive on windows? + if (ext && f.substr(-1 * ext.length) === ext) { + f = f.substr(0, f.length - ext.length); + } + return f; +}; + + +exports.extname = function(path) { + return splitPath(path)[3]; +}; + +function filter (xs, f) { + if (xs.filter) return xs.filter(f); + var res = []; + for (var i = 0; i < xs.length; i++) { + if (f(xs[i], i, xs)) res.push(xs[i]); + } + return res; +} + +// String.prototype.substr - negative index don't work in IE8 +var substr = 'ab'.substr(-1) === 'b' + ? function (str, start, len) { return str.substr(start, len) } + : function (str, start, len) { + if (start < 0) start = str.length + start; + return str.substr(start, len); + } +; + +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) /***/ }, /* 15 */ /***/ function(module, exports, __webpack_require__) { - /* WEBPACK VAR INJECTION */(function(process) {// Copyright Joyent, Inc. and other Node contributors. - // - // Permission is hereby granted, free of charge, to any person obtaining a - // copy of this software and associated documentation files (the - // "Software"), to deal in the Software without restriction, including - // without limitation the rights to use, copy, modify, merge, publish, - // distribute, sublicense, and/or sell copies of the Software, and to permit - // persons to whom the Software is furnished to do so, subject to the - // following conditions: - // - // The above copyright notice and this permission notice shall be included - // in all copies or substantial portions of the Software. - // - // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN - // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE - // USE OR OTHER DEALINGS IN THE SOFTWARE. +"use strict"; +// a duplex stream is just a stream that is both readable and writable. +// Since JS doesn't have multiple prototypal inheritance, this class +// prototypally inherits from Readable, and then parasitically from +// Writable. - // resolves . and .. elements in a path array with directory names there - // must be no slashes, empty elements, or device names (c:\) in the array - // (so also no leading and trailing slashes - it does not distinguish - // relative and absolute paths) - function normalizeArray(parts, allowAboveRoot) { - // if the path tries to go above the root, `up` ends up > 0 - var up = 0; - for (var i = parts.length - 1; i >= 0; i--) { - var last = parts[i]; - if (last === '.') { - parts.splice(i, 1); - } else if (last === '..') { - parts.splice(i, 1); - up++; - } else if (up) { - parts.splice(i, 1); - up--; - } - } +'use strict'; - // if the path is allowed to go above the root, restore leading ..s - if (allowAboveRoot) { - for (; up--; up) { - parts.unshift('..'); - } - } +/**/ - return parts; - } +var objectKeys = Object.keys || function (obj) { + var keys = []; + for (var key in obj) { + keys.push(key); + }return keys; +}; +/**/ - // Split a filename into [root, dir, basename, ext], unix version - // 'root' is just a slash, or nothing. - var splitPathRe = - /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/; - var splitPath = function(filename) { - return splitPathRe.exec(filename).slice(1); - }; +module.exports = Duplex; - // path.resolve([from ...], to) - // posix version - exports.resolve = function() { - var resolvedPath = '', - resolvedAbsolute = false; +/**/ +var processNextTick = __webpack_require__(53); +/**/ - for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) { - var path = (i >= 0) ? arguments[i] : process.cwd(); +/**/ +var util = __webpack_require__(25); +util.inherits = __webpack_require__(1); +/**/ - // Skip empty and invalid entries - if (typeof path !== 'string') { - throw new TypeError('Arguments to path.resolve must be strings'); - } else if (!path) { - continue; - } +var Readable = __webpack_require__(113); +var Writable = __webpack_require__(55); - resolvedPath = path + '/' + resolvedPath; - resolvedAbsolute = path.charAt(0) === '/'; - } +util.inherits(Duplex, Readable); - // At this point the path should be resolved to a full absolute path, but - // handle relative paths to be safe (might happen when process.cwd() fails) +var keys = objectKeys(Writable.prototype); +for (var v = 0; v < keys.length; v++) { + var method = keys[v]; + if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method]; +} - // Normalize the path - resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function(p) { - return !!p; - }), !resolvedAbsolute).join('/'); +function Duplex(options) { + if (!(this instanceof Duplex)) return new Duplex(options); - return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.'; - }; + Readable.call(this, options); + Writable.call(this, options); - // path.normalize(path) - // posix version - exports.normalize = function(path) { - var isAbsolute = exports.isAbsolute(path), - trailingSlash = substr(path, -1) === '/'; + if (options && options.readable === false) this.readable = false; - // Normalize the path - path = normalizeArray(filter(path.split('/'), function(p) { - return !!p; - }), !isAbsolute).join('/'); + if (options && options.writable === false) this.writable = false; - if (!path && !isAbsolute) { - path = '.'; - } - if (path && trailingSlash) { - path += '/'; - } + this.allowHalfOpen = true; + if (options && options.allowHalfOpen === false) this.allowHalfOpen = false; - return (isAbsolute ? '/' : '') + path; - }; + this.once('end', onend); +} - // posix version - exports.isAbsolute = function(path) { - return path.charAt(0) === '/'; - }; +// the no-half-open enforcer +function onend() { + // if we allow half-open state, or if the writable side ended, + // then we're ok. + if (this.allowHalfOpen || this._writableState.ended) return; - // posix version - exports.join = function() { - var paths = Array.prototype.slice.call(arguments, 0); - return exports.normalize(filter(paths, function(p, index) { - if (typeof p !== 'string') { - throw new TypeError('Arguments to path.join must be strings'); - } - return p; - }).join('/')); - }; + // no more data can be written. + // But allow more writes to happen in this tick. + processNextTick(onEndNT, this); +} +function onEndNT(self) { + self.end(); +} - // path.relative(from, to) - // posix version - exports.relative = function(from, to) { - from = exports.resolve(from).substr(1); - to = exports.resolve(to).substr(1); - - function trim(arr) { - var start = 0; - for (; start < arr.length; start++) { - if (arr[start] !== '') break; - } - - var end = arr.length - 1; - for (; end >= 0; end--) { - if (arr[end] !== '') break; - } - - if (start > end) return []; - return arr.slice(start, end - start + 1); - } - - var fromParts = trim(from.split('/')); - var toParts = trim(to.split('/')); - - var length = Math.min(fromParts.length, toParts.length); - var samePartsLength = length; - for (var i = 0; i < length; i++) { - if (fromParts[i] !== toParts[i]) { - samePartsLength = i; - break; - } - } - - var outputParts = []; - for (var i = samePartsLength; i < fromParts.length; i++) { - outputParts.push('..'); - } - - outputParts = outputParts.concat(toParts.slice(samePartsLength)); - - return outputParts.join('/'); - }; - - exports.sep = '/'; - exports.delimiter = ':'; - - exports.dirname = function(path) { - var result = splitPath(path), - root = result[0], - dir = result[1]; - - if (!root && !dir) { - // No dirname whatsoever - return '.'; - } - - if (dir) { - // It has a dirname, strip trailing slash - dir = dir.substr(0, dir.length - 1); - } - - return root + dir; - }; - - - exports.basename = function(path, ext) { - var f = splitPath(path)[2]; - // TODO: make this comparison case-insensitive on windows? - if (ext && f.substr(-1 * ext.length) === ext) { - f = f.substr(0, f.length - ext.length); - } - return f; - }; - - - exports.extname = function(path) { - return splitPath(path)[3]; - }; - - function filter (xs, f) { - if (xs.filter) return xs.filter(f); - var res = []; - for (var i = 0; i < xs.length; i++) { - if (f(xs[i], i, xs)) res.push(xs[i]); - } - return res; - } - - // String.prototype.substr - negative index don't work in IE8 - var substr = 'ab'.substr(-1) === 'b' - ? function (str, start, len) { return str.substr(start, len) } - : function (str, start, len) { - if (start < 0) start = str.length + start; - return str.substr(start, len); - } - ; - - /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2))) +function forEach(xs, f) { + for (var i = 0, l = xs.length; i < l; i++) { + f(xs[i], i); + } +} /***/ }, /* 16 */ -/***/ function(module, exports, __webpack_require__) { +/***/ function(module, exports) { - const Attachment = __webpack_require__(17); - const Embed = __webpack_require__(18); - const Collection = __webpack_require__(10); - const Constants = __webpack_require__(5); - const escapeMarkdown = __webpack_require__(19); - const MessageReaction = __webpack_require__(20); - - /** - * Represents a message on Discord - */ - class Message { - constructor(channel, data, client) { - /** - * The Client that instantiated the Message - * @type {Client} - */ - this.client = client; - Object.defineProperty(this, 'client', { enumerable: false, configurable: false }); - - /** - * The channel that the message was sent in - * @type {TextChannel|DMChannel|GroupDMChannel} - */ - this.channel = channel; - - if (data) this.setup(data); - } - - setup(data) { // eslint-disable-line complexity - /** - * The ID of the message (unique in the channel it was sent) - * @type {string} - */ - this.id = data.id; - - /** - * The type of the message - * @type {string} - */ - this.type = Constants.MessageTypes[data.type]; - - /** - * The content of the message - * @type {string} - */ - this.content = data.content; - - /** - * The author of the message - * @type {User} - */ - this.author = this.client.dataManager.newUser(data.author); - - /** - * Represents the author of the message as a guild member. Only available if the message comes from a guild - * where the author is still a member. - * @type {GuildMember} - */ - this.member = this.guild ? this.guild.member(this.author) || null : null; - - /** - * Whether or not this message is pinned - * @type {boolean} - */ - this.pinned = data.pinned; - - /** - * Whether or not the message was Text-To-Speech - * @type {boolean} - */ - this.tts = data.tts; - - /** - * A random number used for checking message delivery - * @type {string} - */ - this.nonce = data.nonce; - - /** - * Whether or not this message was sent by Discord, not actually a user (e.g. pin notifications) - * @type {boolean} - */ - this.system = data.type === 6; - - /** - * A list of embeds in the message - e.g. YouTube Player - * @type {MessageEmbed[]} - */ - this.embeds = data.embeds.map(e => new Embed(this, e)); - - /** - * A collection of attachments in the message - e.g. Pictures - mapped by their ID. - * @type {Collection} - */ - this.attachments = new Collection(); - for (const attachment of data.attachments) this.attachments.set(attachment.id, new Attachment(this, attachment)); - - /** - * The timestamp the message was sent at - * @type {number} - */ - this.createdTimestamp = new Date(data.timestamp).getTime(); - - /** - * The timestamp the message was last edited at (if applicable) - * @type {?number} - */ - this.editedTimestamp = data.edited_timestamp ? new Date(data.edited_timestamp).getTime() : null; - - /** - * An object containing a further users, roles or channels collections - * @type {Object} - * @property {Collection} mentions.users Mentioned users, maps their ID to the user object. - * @property {Collection} mentions.roles Mentioned roles, maps their ID to the role object. - * @property {Collection} mentions.channels Mentioned channels, - * maps their ID to the channel object. - * @property {boolean} mentions.everyone Whether or not @everyone was mentioned. - */ - this.mentions = { - users: new Collection(), - roles: new Collection(), - channels: new Collection(), - everyone: data.mention_everyone, - }; - - for (const mention of data.mentions) { - let user = this.client.users.get(mention.id); - if (user) { - this.mentions.users.set(user.id, user); - } else { - user = this.client.dataManager.newUser(mention); - this.mentions.users.set(user.id, user); - } - } - - if (data.mention_roles) { - for (const mention of data.mention_roles) { - const role = this.channel.guild.roles.get(mention); - if (role) this.mentions.roles.set(role.id, role); - } - } - - if (this.channel.guild) { - const channMentionsRaw = data.content.match(/<#([0-9]{14,20})>/g) || []; - for (const raw of channMentionsRaw) { - const chan = this.channel.guild.channels.get(raw.match(/([0-9]{14,20})/g)[0]); - if (chan) this.mentions.channels.set(chan.id, chan); - } - } - - this._edits = []; - - /** - * A collection of reactions to this message, mapped by the reaction "id". - * @type {Collection} - */ - this.reactions = new Collection(); - - if (data.reactions && data.reactions.length > 0) { - for (const reaction of data.reactions) { - const id = reaction.emoji.id ? `${reaction.emoji.name}:${reaction.emoji.id}` : reaction.emoji.name; - this.reactions.set(id, new MessageReaction(this, reaction.emoji, reaction.count, reaction.me)); - } - } - } - - patch(data) { // eslint-disable-line complexity - if (data.author) { - this.author = this.client.users.get(data.author.id); - if (this.guild) this.member = this.guild.member(this.author); - } - if (data.content) this.content = data.content; - if (data.timestamp) this.createdTimestamp = new Date(data.timestamp).getTime(); - if (data.edited_timestamp) { - this.editedTimestamp = data.edited_timestamp ? new Date(data.edited_timestamp).getTime() : null; - } - if ('tts' in data) this.tts = data.tts; - if ('mention_everyone' in data) this.mentions.everyone = data.mention_everyone; - if (data.nonce) this.nonce = data.nonce; - if (data.embeds) this.embeds = data.embeds.map(e => new Embed(this, e)); - if (data.type > -1) { - this.system = false; - if (data.type === 6) this.system = true; - } - if (data.attachments) { - this.attachments = new Collection(); - for (const attachment of data.attachments) { - this.attachments.set(attachment.id, new Attachment(this, attachment)); - } - } - if (data.mentions) { - for (const mention of data.mentions) { - let user = this.client.users.get(mention.id); - if (user) { - this.mentions.users.set(user.id, user); - } else { - user = this.client.dataManager.newUser(mention); - this.mentions.users.set(user.id, user); - } - } - } - if (data.mention_roles) { - for (const mention of data.mention_roles) { - const role = this.channel.guild.roles.get(mention); - if (role) this.mentions.roles.set(role.id, role); - } - } - if (data.id) this.id = data.id; - if (this.channel.guild && data.content) { - const channMentionsRaw = data.content.match(/<#([0-9]{14,20})>/g) || []; - for (const raw of channMentionsRaw) { - const chan = this.channel.guild.channels.get(raw.match(/([0-9]{14,20})/g)[0]); - if (chan) this.mentions.channels.set(chan.id, chan); - } - } - if (data.reactions) { - this.reactions = new Collection(); - if (data.reactions.length > 0) { - for (const reaction of data.reactions) { - const id = reaction.emoji.id ? `${reaction.emoji.name}:${reaction.emoji.id}` : reaction.emoji.name; - this.reactions.set(id, new MessageReaction(this, data.emoji, data.count, data.me)); - } - } - } - } - - /** - * The time the message was sent - * @type {Date} - * @readonly - */ - get createdAt() { - return new Date(this.createdTimestamp); - } - - /** - * The time the message was last edited at (if applicable) - * @type {?Date} - * @readonly - */ - get editedAt() { - return this.editedTimestamp ? new Date(this.editedTimestamp) : null; - } - - /** - * The guild the message was sent in (if in a guild channel) - * @type {?Guild} - * @readonly - */ - get guild() { - return this.channel.guild || null; - } - - /** - * The message contents with all mentions replaced by the equivalent text. If mentions cannot be resolved to a name, - * the relevant mention in the message content will not be converted. - * @type {string} - * @readonly - */ - get cleanContent() { - return this.content - .replace(/@(everyone|here)/g, '@\u200b$1') - .replace(/<@!?[0-9]+>/g, (input) => { - const id = input.replace(/<|!|>|@/g, ''); - if (this.channel.type === 'dm' || this.channel.type === 'group') { - return this.client.users.has(id) ? `@${this.client.users.get(id).username}` : input; - } - - const member = this.channel.guild.members.get(id); - if (member) { - if (member.nickname) return `@${member.nickname}`; - return `@${member.user.username}`; - } else { - const user = this.client.users.get(id); - if (user) return `@${user.username}`; - return input; - } - }) - .replace(/<#[0-9]+>/g, (input) => { - const channel = this.client.channels.get(input.replace(/<|#|>/g, '')); - if (channel) return `#${channel.name}`; - return input; - }) - .replace(/<@&[0-9]+>/g, (input) => { - if (this.channel.type === 'dm' || this.channel.type === 'group') return input; - const role = this.guild.roles.get(input.replace(/<|@|>|&/g, '')); - if (role) return `@${role.name}`; - return input; - }); - } - - /** - * An array of cached versions of the message, including the current version. - * Sorted from latest (first) to oldest (last). - * @type {Message[]} - * @readonly - */ - get edits() { - return this._edits.slice().unshift(this); - } - - /** - * Whether the message is editable by the client user. - * @type {boolean} - * @readonly - */ - get editable() { - return this.author.id === this.client.user.id; - } - - /** - * Whether the message is deletable by the client user. - * @type {boolean} - * @readonly - */ - get deletable() { - return this.author.id === this.client.user.id || (this.guild && - this.channel.permissionsFor(this.client.user).hasPermission(Constants.PermissionFlags.MANAGE_MESSAGES) - ); - } - - /** - * Whether the message is pinnable by the client user. - * @type {boolean} - * @readonly - */ - get pinnable() { - return !this.guild || - this.channel.permissionsFor(this.client.user).hasPermission(Constants.PermissionFlags.MANAGE_MESSAGES); - } - - /** - * Whether or not a user, channel or role is mentioned in this message. - * @param {GuildChannel|User|Role|string} data either a guild channel, user or a role object, or a string representing - * the ID of any of these. - * @returns {boolean} - */ - isMentioned(data) { - data = data && data.id ? data.id : data; - return this.mentions.users.has(data) || this.mentions.channels.has(data) || this.mentions.roles.has(data); - } - - /** - * Options that can be passed into editMessage - * @typedef {Object} MessageEditOptions - * @property {Object} [embed] An embed to be added/edited - */ - - /** - * Edit the content of the message - * @param {StringResolvable} content The new content for the message - * @param {MessageEditOptions} [options={}] The options to provide - * @returns {Promise} - * @example - * // update the content of a message - * message.edit('This is my new content!') - * .then(msg => console.log(`Updated the content of a message from ${msg.author}`)) - * .catch(console.error); - */ - edit(content, options = {}) { - return this.client.rest.methods.updateMessage(this, content, options); - } - - /** - * Edit the content of the message, with a code block - * @param {string} lang Language for the code block - * @param {StringResolvable} content The new content for the message - * @returns {Promise} - */ - editCode(lang, content) { - content = escapeMarkdown(this.client.resolver.resolveString(content), true); - return this.edit(`\`\`\`${lang || ''}\n${content}\n\`\`\``); - } - - /** - * Pins this message to the channel's pinned messages - * @returns {Promise} - */ - pin() { - return this.client.rest.methods.pinMessage(this); - } - - /** - * Unpins this message from the channel's pinned messages - * @returns {Promise} - */ - unpin() { - return this.client.rest.methods.unpinMessage(this); - } - - /** - * Add a reaction to the message - * @param {string|Emoji|ReactionEmoji} emoji Emoji to react with - * @returns {Promise} - */ - react(emoji) { - emoji = this.client.resolver.resolveEmojiIdentifier(emoji); - if (!emoji) throw new TypeError('Emoji must be a string or Emoji/ReactionEmoji'); - - return this.client.rest.methods.addMessageReaction(this, emoji); - } - - /** - * Remove all reactions from a message - * @returns {Promise} - */ - clearReactions() { - return this.client.rest.methods.removeMessageReactions(this); - } - - /** - * Deletes the message - * @param {number} [timeout=0] How long to wait to delete the message in milliseconds - * @returns {Promise} - * @example - * // delete a message - * message.delete() - * .then(msg => console.log(`Deleted message from ${msg.author}`)) - * .catch(console.error); - */ - delete(timeout = 0) { - if (timeout <= 0) { - return this.client.rest.methods.deleteMessage(this); - } else { - return new Promise(resolve => { - this.client.setTimeout(() => { - resolve(this.delete()); - }, timeout); - }); - } - } - - /** - * Reply to the message - * @param {StringResolvable} content The content for the message - * @param {MessageOptions} [options = {}] The options to provide - * @returns {Promise} - * @example - * // reply to a message - * message.reply('Hey, I\'m a reply!') - * .then(msg => console.log(`Sent a reply to ${msg.author}`)) - * .catch(console.error); - */ - reply(content, options = {}) { - content = this.client.resolver.resolveString(content); - const prepend = this.guild ? `${this.author}, ` : ''; - content = `${prepend}${content}`; - - if (options.split) { - if (typeof options.split !== 'object') options.split = {}; - if (!options.split.prepend) options.split.prepend = prepend; - } - - return this.client.rest.methods.sendMessage(this.channel, content, options); - } - - /** - * Used mainly internally. Whether two messages are identical in properties. If you want to compare messages - * without checking all the properties, use `message.id === message2.id`, which is much more efficient. This - * method allows you to see if there are differences in content, embeds, attachments, nonce and tts properties. - * @param {Message} message The message to compare it to - * @param {Object} rawData Raw data passed through the WebSocket about this message - * @returns {boolean} - */ - equals(message, rawData) { - if (!message) return false; - const embedUpdate = !message.author && !message.attachments; - if (embedUpdate) return this.id === message.id && this.embeds.length === message.embeds.length; - - let equal = this.id === message.id && - this.author.id === message.author.id && - this.content === message.content && - this.tts === message.tts && - this.nonce === message.nonce && - this.embeds.length === message.embeds.length && - this.attachments.length === message.attachments.length; - - if (equal && rawData) { - equal = this.mentions.everyone === message.mentions.everyone && - this.createdTimestamp === new Date(rawData.timestamp).getTime() && - this.editedTimestamp === new Date(rawData.edited_timestamp).getTime(); - } - - return equal; - } - - /** - * When concatenated with a string, this automatically concatenates the message's content instead of the object. - * @returns {string} - * @example - * // logs: Message: This is a message! - * console.log(`Message: ${message}`); - */ - toString() { - return this.content; - } - - _addReaction(emoji, user) { - const emojiID = emoji.id ? `${emoji.name}:${emoji.id}` : emoji.name; - let reaction; - if (this.reactions.has(emojiID)) { - reaction = this.reactions.get(emojiID); - if (!reaction.me) reaction.me = user.id === this.client.user.id; - } else { - reaction = new MessageReaction(this, emoji, 0, user.id === this.client.user.id); - this.reactions.set(emojiID, reaction); - } - if (!reaction.users.has(user.id)) { - reaction.users.set(user.id, user); - reaction.count++; - return reaction; - } - return null; - } - - _removeReaction(emoji, user) { - const emojiID = emoji.id || emoji; - if (this.reactions.has(emojiID)) { - const reaction = this.reactions.get(emojiID); - if (reaction.users.has(user.id)) { - reaction.users.delete(user.id); - reaction.count--; - if (user.id === this.client.user.id) reaction.me = false; - return reaction; - } - } - return null; - } - - _clearReactions() { - this.reactions.clear(); - } - } - - module.exports = Message; +var g; + +// This works in non-strict mode +g = (function() { return this; })(); + +try { + // This works if eval is allowed (see CSP) + g = g || Function("return this")() || (1,eval)("this"); +} catch(e) { + // This works if the window reference is available + if(typeof window === "object") + g = window; +} + +// g can still be undefined, but nothing to do about it... +// We return undefined, instead of nothing here, so it's +// easier to handle this case. if(!global) { ...} + +module.exports = g; /***/ }, /* 17 */ -/***/ function(module, exports) { +/***/ function(module, exports, __webpack_require__) { - /** - * Represents an attachment in a message - */ - class MessageAttachment { - constructor(message, data) { - /** - * The Client that instantiated this MessageAttachment. - * @type {Client} - */ - this.client = message.client; - Object.defineProperty(this, 'client', { enumerable: false, configurable: false }); +/* WEBPACK VAR INJECTION */(function(Buffer) {var Transform = __webpack_require__(9).Transform +var inherits = __webpack_require__(1) +var StringDecoder = __webpack_require__(56).StringDecoder +module.exports = CipherBase +inherits(CipherBase, Transform) +function CipherBase (hashMode) { + Transform.call(this) + this.hashMode = typeof hashMode === 'string' + if (this.hashMode) { + this[hashMode] = this._finalOrDigest + } else { + this.final = this._finalOrDigest + } + this._decoder = null + this._encoding = null +} +CipherBase.prototype.update = function (data, inputEnc, outputEnc) { + if (typeof data === 'string') { + data = new Buffer(data, inputEnc) + } + var outData = this._update(data) + if (this.hashMode) { + return this + } + if (outputEnc) { + outData = this._toString(outData, outputEnc) + } + return outData +} - /** - * The message this attachment is part of. - * @type {Message} - */ - this.message = message; +CipherBase.prototype.setAutoPadding = function () {} - this.setup(data); - } +CipherBase.prototype.getAuthTag = function () { + throw new Error('trying to get auth tag in unsupported state') +} - setup(data) { - /** - * The ID of this attachment - * @type {string} - */ - this.id = data.id; +CipherBase.prototype.setAuthTag = function () { + throw new Error('trying to set auth tag in unsupported state') +} - /** - * The file name of this attachment - * @type {string} - */ - this.filename = data.filename; +CipherBase.prototype.setAAD = function () { + throw new Error('trying to set aad in unsupported state') +} - /** - * The size of this attachment in bytes - * @type {number} - */ - this.filesize = data.size; +CipherBase.prototype._transform = function (data, _, next) { + var err + try { + if (this.hashMode) { + this._update(data) + } else { + this.push(this._update(data)) + } + } catch (e) { + err = e + } finally { + next(err) + } +} +CipherBase.prototype._flush = function (done) { + var err + try { + this.push(this._final()) + } catch (e) { + err = e + } finally { + done(err) + } +} +CipherBase.prototype._finalOrDigest = function (outputEnc) { + var outData = this._final() || new Buffer('') + if (outputEnc) { + outData = this._toString(outData, outputEnc, true) + } + return outData +} - /** - * The URL to this attachment - * @type {string} - */ - this.url = data.url; - - /** - * The Proxy URL to this attachment - * @type {string} - */ - this.proxyURL = data.proxy_url; - - /** - * The height of this attachment (if an image) - * @type {?number} - */ - this.height = data.height; - - /** - * The width of this attachment (if an image) - * @type {?number} - */ - this.width = data.width; - } - } - - module.exports = MessageAttachment; +CipherBase.prototype._toString = function (value, enc, fin) { + if (!this._decoder) { + this._decoder = new StringDecoder(enc) + this._encoding = enc + } + if (this._encoding !== enc) { + throw new Error('can\'t switch encodings') + } + var out = this._decoder.write(value) + if (fin) { + out += this._decoder.end() + } + return out +} +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer)) /***/ }, /* 18 */ -/***/ function(module, exports) { +/***/ function(module, exports, __webpack_require__) { - /** - * Represents an embed in a message (image/video preview, rich embed, etc.) - */ - class MessageEmbed { - constructor(message, data) { - /** - * The client that instantiated this embed - * @type {Client} - */ - this.client = message.client; - Object.defineProperty(this, 'client', { enumerable: false, configurable: false }); +"use strict"; +/* WEBPACK VAR INJECTION */(function(Buffer) {'use strict'; +var inherits = __webpack_require__(1) +var md5 = __webpack_require__(98) +var rmd160 = __webpack_require__(164) +var sha = __webpack_require__(165) - /** - * The message this embed is part of - * @type {Message} - */ - this.message = message; +var Base = __webpack_require__(17) - this.setup(data); - } +function HashNoConstructor(hash) { + Base.call(this, 'digest') - setup(data) { - /** - * The title of this embed, if there is one - * @type {?string} - */ - this.title = data.title; + this._hash = hash + this.buffers = [] +} - /** - * The type of this embed - * @type {string} - */ - this.type = data.type; +inherits(HashNoConstructor, Base) - /** - * The description of this embed, if there is one - * @type {?string} - */ - this.description = data.description; +HashNoConstructor.prototype._update = function (data) { + this.buffers.push(data) +} - /** - * The URL of this embed - * @type {string} - */ - this.url = data.url; +HashNoConstructor.prototype._final = function () { + var buf = Buffer.concat(this.buffers) + var r = this._hash(buf) + this.buffers = null - /** - * The fields of this embed - * @type {MessageEmbedField[]} - */ - this.fields = []; - if (data.fields) for (const field of data.fields) this.fields.push(new MessageEmbedField(this, field)); + return r +} - /** - * The timestamp of this embed - * @type {number} - */ - this.createdTimestamp = data.timestamp; +function Hash(hash) { + Base.call(this, 'digest') - /** - * The thumbnail of this embed, if there is one - * @type {MessageEmbedThumbnail} - */ - this.thumbnail = data.thumbnail ? new MessageEmbedThumbnail(this, data.thumbnail) : null; + this._hash = hash +} - /** - * The author of this embed, if there is one - * @type {MessageEmbedAuthor} - */ - this.author = data.author ? new MessageEmbedAuthor(this, data.author) : null; +inherits(Hash, Base) - /** - * The provider of this embed, if there is one - * @type {MessageEmbedProvider} - */ - this.provider = data.provider ? new MessageEmbedProvider(this, data.provider) : null; +Hash.prototype._update = function (data) { + this._hash.update(data) +} - /** - * The footer of this embed - * @type {MessageEmbedFooter} - */ - this.footer = data.footer ? new MessageEmbedFooter(this, data.footer) : null; - } +Hash.prototype._final = function () { + return this._hash.digest() +} - /** - * The date this embed was created - * @type {Date} - */ - get createdAt() { - return new Date(this.createdTimestamp); - } - } +module.exports = function createHash (alg) { + alg = alg.toLowerCase() + if ('md5' === alg) return new HashNoConstructor(md5) + if ('rmd160' === alg || 'ripemd160' === alg) return new HashNoConstructor(rmd160) - /** - * Represents a thumbnail for a message embed - */ - class MessageEmbedThumbnail { - constructor(embed, data) { - /** - * The embed this thumbnail is part of - * @type {MessageEmbed} - */ - this.embed = embed; - - this.setup(data); - } - - setup(data) { - /** - * The URL for this thumbnail - * @type {string} - */ - this.url = data.url; - - /** - * The Proxy URL for this thumbnail - * @type {string} - */ - this.proxyURL = data.proxy_url; - - /** - * The height of the thumbnail - * @type {number} - */ - this.height = data.height; - - /** - * The width of the thumbnail - * @type {number} - */ - this.width = data.width; - } - } - - /** - * Represents a provider for a message embed - */ - class MessageEmbedProvider { - constructor(embed, data) { - /** - * The embed this provider is part of - * @type {MessageEmbed} - */ - this.embed = embed; - - this.setup(data); - } - - setup(data) { - /** - * The name of this provider - * @type {string} - */ - this.name = data.name; - - /** - * The URL of this provider - * @type {string} - */ - this.url = data.url; - } - } - - /** - * Represents an author for a message embed - */ - class MessageEmbedAuthor { - constructor(embed, data) { - /** - * The embed this author is part of - * @type {MessageEmbed} - */ - this.embed = embed; - - this.setup(data); - } - - setup(data) { - /** - * The name of this author - * @type {string} - */ - this.name = data.name; - - /** - * The URL of this author - * @type {string} - */ - this.url = data.url; - } - } - - /** - * Represents a field for a message embed - */ - class MessageEmbedField { - constructor(embed, data) { - /** - * The embed this footer is part of - * @type {MessageEmbed} - */ - this.embed = embed; - - this.setup(data); - } - - setup(data) { - /** - * The name of this field - * @type {string} - */ - this.name = data.name; - - /** - * The value of this field - * @type {string} - */ - this.value = data.value; - - /** - * If this field is displayed inline - * @type {boolean} - */ - this.inline = data.inline; - } - } - - /** - * Represents the footer of a message embed - */ - class MessageEmbedFooter { - constructor(embed, data) { - /** - * The embed this footer is part of - * @type {MessageEmbed} - */ - this.embed = embed; - - this.setup(data); - } - - setup(data) { - /** - * The text in this footer - * @type {string} - */ - this.text = data.text; - - /** - * The icon URL of this footer - * @type {string} - */ - this.iconUrl = data.icon_url; - - /** - * The proxy icon URL of this footer - * @type {string} - */ - this.proxyIconUrl = data.proxy_icon_url; - } - } - - MessageEmbed.Thumbnail = MessageEmbedThumbnail; - MessageEmbed.Provider = MessageEmbedProvider; - MessageEmbed.Author = MessageEmbedAuthor; - MessageEmbed.Field = MessageEmbedField; - MessageEmbed.Footer = MessageEmbedFooter; - - module.exports = MessageEmbed; + return new Hash(sha(alg)) +} +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer)) /***/ }, /* 19 */ -/***/ function(module, exports) { +/***/ function(module, exports, __webpack_require__) { - module.exports = function escapeMarkdown(text, onlyCodeBlock = false, onlyInlineCode = false) { - if (onlyCodeBlock) return text.replace(/```/g, '`\u200b``'); - if (onlyInlineCode) return text.replace(/\\(`|\\)/g, '$1').replace(/(`|\\)/g, '\\$1'); - return text.replace(/\\(\*|_|`|~|\\)/g, '$1').replace(/(\*|_|`|~|\\)/g, '\\$1'); - }; +/* WEBPACK VAR INJECTION */(function(Buffer) {// prototype class for hash functions +function Hash (blockSize, finalSize) { + this._block = new Buffer(blockSize) + this._finalSize = finalSize + this._blockSize = blockSize + this._len = 0 + this._s = 0 +} +Hash.prototype.update = function (data, enc) { + if (typeof data === 'string') { + enc = enc || 'utf8' + data = new Buffer(data, enc) + } + + var l = this._len += data.length + var s = this._s || 0 + var f = 0 + var buffer = this._block + + while (s < l) { + var t = Math.min(data.length, f + this._blockSize - (s % this._blockSize)) + var ch = (t - f) + + for (var i = 0; i < ch; i++) { + buffer[(s % this._blockSize) + i] = data[i + f] + } + + s += ch + f += ch + + if ((s % this._blockSize) === 0) { + this._update(buffer) + } + } + this._s = s + + return this +} + +Hash.prototype.digest = function (enc) { + // Suppose the length of the message M, in bits, is l + var l = this._len * 8 + + // Append the bit 1 to the end of the message + this._block[this._len % this._blockSize] = 0x80 + + // and then k zero bits, where k is the smallest non-negative solution to the equation (l + 1 + k) === finalSize mod blockSize + this._block.fill(0, this._len % this._blockSize + 1) + + if (l % (this._blockSize * 8) >= this._finalSize * 8) { + this._update(this._block) + this._block.fill(0) + } + + // to this append the block which is equal to the number l written in binary + // TODO: handle case where l is > Math.pow(2, 29) + this._block.writeInt32BE(l, this._blockSize - 4) + + var hash = this._update(this._block) || this._hash() + + return enc ? hash.toString(enc) : hash +} + +Hash.prototype._update = function () { + throw new Error('_update must be implemented by subclass') +} + +module.exports = Hash + +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer)) /***/ }, /* 20 */ -/***/ function(module, exports, __webpack_require__) { +/***/ function(module, exports) { - const Collection = __webpack_require__(10); - const Emoji = __webpack_require__(21); - const ReactionEmoji = __webpack_require__(22); +/** + * Represents any channel on Discord + */ +class Channel { + constructor(client, data) { + /** + * The client that instantiated the Channel + * @type {Client} + */ + this.client = client; + Object.defineProperty(this, 'client', { enumerable: false, configurable: false }); - /** - * Represents a reaction to a message - */ - class MessageReaction { - constructor(message, emoji, count, me) { - /** - * The message that this reaction refers to - * @type {Message} - */ - this.message = message; + /** + * The type of the channel, either: + * * `dm` - a DM channel + * * `group` - a Group DM channel + * * `text` - a guild text channel + * * `voice` - a guild voice channel + * @type {string} + */ + this.type = null; - /** - * Whether the client has given this reaction - * @type {boolean} - */ - this.me = me; + if (data) this.setup(data); + } - /** - * The number of people that have given the same reaction. - * @type {number} - */ - this.count = count || 0; + setup(data) { + /** + * The unique ID of the channel + * @type {string} + */ + this.id = data.id; + } - /** - * The users that have given this reaction, mapped by their ID. - * @type {Collection} - */ - this.users = new Collection(); + /** + * The timestamp the channel was created at + * @type {number} + * @readonly + */ + get createdTimestamp() { + return (this.id / 4194304) + 1420070400000; + } - this._emoji = new ReactionEmoji(this, emoji.name, emoji.id); - } + /** + * The time the channel was created + * @type {Date} + * @readonly + */ + get createdAt() { + return new Date(this.createdTimestamp); + } - /** - * The emoji of this reaction, either an Emoji object for known custom emojis, or a ReactionEmoji - * object which has fewer properties. Whatever the prototype of the emoji, it will still have - * `name`, `id`, `identifier` and `toString()` - * @type {Emoji|ReactionEmoji} - */ - get emoji() { - if (this._emoji instanceof Emoji) return this._emoji; - // check to see if the emoji has become known to the client - if (this._emoji.id) { - const emojis = this.message.client.emojis; - if (emojis.has(this._emoji.id)) { - const emoji = emojis.get(this._emoji.id); - this._emoji = emoji; - return emoji; - } - } - return this._emoji; - } + /** + * Deletes the channel + * @returns {Promise} + * @example + * // delete the channel + * channel.delete() + * .then() // success + * .catch(console.error); // log error + */ + delete() { + return this.client.rest.methods.deleteChannel(this); + } +} - /** - * Removes a user from this reaction. - * @param {UserResolvable} [user] the user that you want to remove the reaction, defaults to the client. - * @returns {Promise} - */ - remove(user = this.message.client.user) { - const message = this.message; - user = this.message.client.resolver.resolveUserID(user); - if (!user) return Promise.reject('Couldn\'t resolve the user ID to remove from the reaction.'); - return message.client.rest.methods.removeMessageReaction( - message, this.emoji.identifier, user - ); - } - - /** - * Fetch all the users that gave this reaction. Resolves with a collection of users, - * mapped by their IDs. - * @param {number} [limit=100] the maximum amount of users to fetch, defaults to 100 - * @returns {Promise>} - */ - fetchUsers(limit = 100) { - const message = this.message; - return message.client.rest.methods.getMessageReactionUsers( - message, this.emoji.identifier, limit - ).then(users => { - this.users = new Collection(); - for (const rawUser of users) { - const user = this.message.client.dataManager.newUser(rawUser); - this.users.set(user.id, user); - } - this.count = this.users.size; - return users; - }); - } - } - - module.exports = MessageReaction; +module.exports = Channel; /***/ }, /* 21 */ /***/ function(module, exports, __webpack_require__) { - const Constants = __webpack_require__(5); - const Collection = __webpack_require__(10); +const Constants = __webpack_require__(2); +const Collection = __webpack_require__(6); - /** - * Represents a custom emoji - */ - class Emoji { - constructor(guild, data) { - /** - * The Client that instantiated this object - * @type {Client} - */ - this.client = guild.client; - Object.defineProperty(this, 'client', { enumerable: false, configurable: false }); +/** + * Represents a custom emoji + */ +class Emoji { + constructor(guild, data) { + /** + * The Client that instantiated this object + * @type {Client} + */ + this.client = guild.client; + Object.defineProperty(this, 'client', { enumerable: false, configurable: false }); - /** - * The guild this emoji is part of - * @type {Guild} - */ - this.guild = guild; + /** + * The guild this emoji is part of + * @type {Guild} + */ + this.guild = guild; - this.setup(data); - } + this.setup(data); + } - setup(data) { - /** - * The ID of the emoji - * @type {string} - */ - this.id = data.id; + setup(data) { + /** + * The ID of the emoji + * @type {string} + */ + this.id = data.id; - /** - * The name of the emoji - * @type {string} - */ - this.name = data.name; + /** + * The name of the emoji + * @type {string} + */ + this.name = data.name; - /** - * Whether or not this emoji requires colons surrounding it - * @type {boolean} - */ - this.requiresColons = data.require_colons; + /** + * Whether or not this emoji requires colons surrounding it + * @type {boolean} + */ + this.requiresColons = data.require_colons; - /** - * Whether this emoji is managed by an external service - * @type {boolean} - */ - this.managed = data.managed; + /** + * Whether this emoji is managed by an external service + * @type {boolean} + */ + this.managed = data.managed; - this._roles = data.roles; - } + this._roles = data.roles; + } - /** - * The timestamp the emoji was created at - * @type {number} - * @readonly - */ - get createdTimestamp() { - return (this.id / 4194304) + 1420070400000; - } + /** + * The timestamp the emoji was created at + * @type {number} + * @readonly + */ + get createdTimestamp() { + return (this.id / 4194304) + 1420070400000; + } - /** - * The time the emoji was created - * @type {Date} - * @readonly - */ - get createdAt() { - return new Date(this.createdTimestamp); - } + /** + * The time the emoji was created + * @type {Date} + * @readonly + */ + get createdAt() { + return new Date(this.createdTimestamp); + } - /** - * A collection of roles this emoji is active for (empty if all), mapped by role ID. - * @type {Collection} - * @readonly - */ - get roles() { - const roles = new Collection(); - for (const role of this._roles) { - if (this.guild.roles.has(role)) roles.set(role, this.guild.roles.get(role)); - } - return roles; - } + /** + * A collection of roles this emoji is active for (empty if all), mapped by role ID. + * @type {Collection} + * @readonly + */ + get roles() { + const roles = new Collection(); + for (const role of this._roles) { + if (this.guild.roles.has(role)) roles.set(role, this.guild.roles.get(role)); + } + return roles; + } - /** - * The URL to the emoji file - * @type {string} - * @readonly - */ - get url() { - return `${Constants.Endpoints.CDN}/emojis/${this.id}.png`; - } + /** + * The URL to the emoji file + * @type {string} + * @readonly + */ + get url() { + return `${Constants.Endpoints.CDN}/emojis/${this.id}.png`; + } - /** - * When concatenated with a string, this automatically returns the emoji mention rather than the object. - * @returns {string} - * @example - * // send an emoji: - * const emoji = guild.emojis.first(); - * msg.reply(`Hello! ${emoji}`); - */ - toString() { - return this.requiresColons ? `<:${this.name}:${this.id}>` : this.name; - } + /** + * When concatenated with a string, this automatically returns the emoji mention rather than the object. + * @returns {string} + * @example + * // send an emoji: + * const emoji = guild.emojis.first(); + * msg.reply(`Hello! ${emoji}`); + */ + toString() { + return this.requiresColons ? `<:${this.name}:${this.id}>` : this.name; + } - /** - * The identifier of this emoji, used for message reactions - * @readonly - * @type {string} - */ - get identifier() { - if (this.id) { - return `${this.name}:${this.id}`; - } - return encodeURIComponent(this.name); - } - } + /** + * The identifier of this emoji, used for message reactions + * @readonly + * @type {string} + */ + get identifier() { + if (this.id) { + return `${this.name}:${this.id}`; + } + return encodeURIComponent(this.name); + } +} - module.exports = Emoji; +module.exports = Emoji; /***/ }, /* 22 */ -/***/ function(module, exports) { +/***/ function(module, exports, __webpack_require__) { - /** - * Represents a limited emoji set used for both custom and unicode emojis. Custom emojis - * will use this class opposed to the Emoji class when the client doesn't know enough - * information about them. - */ - class ReactionEmoji { - constructor(reaction, name, id) { - /** - * The message reaction this emoji refers to - * @type {MessageReaction} - */ - this.reaction = reaction; +const Constants = __webpack_require__(2); - /** - * The name of this reaction emoji. - * @type {string} - */ - this.name = name; +/** + * Represents a role on Discord + */ +class Role { + constructor(guild, data) { + /** + * The client that instantiated the role + * @type {Client} + */ + this.client = guild.client; + Object.defineProperty(this, 'client', { enumerable: false, configurable: false }); - /** - * The ID of this reaction emoji. - * @type {string} - */ - this.id = id; - } + /** + * The guild that the role belongs to + * @type {Guild} + */ + this.guild = guild; - /** - * The identifier of this emoji, used for message reactions - * @readonly - * @type {string} - */ - get identifier() { - if (this.id) return `${this.name}:${this.id}`; - return encodeURIComponent(this.name); - } + if (data) this.setup(data); + } - /** - * Creates the text required to form a graphical emoji on Discord. - * @example - * // send the emoji used in a reaction to the channel the reaction is part of - * reaction.message.channel.sendMessage(`The emoji used is ${reaction.emoji}`); - * @returns {string} - */ - toString() { - return this.id ? `<:${this.name}:${this.id}>` : this.name; - } - } + setup(data) { + /** + * The ID of the role (unique to the guild it is part of) + * @type {string} + */ + this.id = data.id; - module.exports = ReactionEmoji; + /** + * The name of the role + * @type {string} + */ + this.name = data.name; + + /** + * The base 10 color of the role + * @type {number} + */ + this.color = data.color; + + /** + * If true, users that are part of this role will appear in a separate category in the users list + * @type {boolean} + */ + this.hoist = data.hoist; + + /** + * The position of the role in the role manager + * @type {number} + */ + this.position = data.position; + + /** + * The evaluated permissions number + * @type {number} + */ + this.permissions = data.permissions; + + /** + * Whether or not the role is managed by an external service + * @type {boolean} + */ + this.managed = data.managed; + + /** + * Whether or not the role can be mentioned by anyone + * @type {boolean} + */ + this.mentionable = data.mentionable; + } + + /** + * The timestamp the role was created at + * @type {number} + * @readonly + */ + get createdTimestamp() { + return (this.id / 4194304) + 1420070400000; + } + + /** + * The time the role was created + * @type {Date} + * @readonly + */ + get createdAt() { + return new Date(this.createdTimestamp); + } + + /** + * The hexadecimal version of the role color, with a leading hashtag. + * @type {string} + * @readonly + */ + get hexColor() { + let col = this.color.toString(16); + while (col.length < 6) col = `0${col}`; + return `#${col}`; + } + + /** + * The cached guild members that have this role. + * @type {Collection} + * @readonly + */ + get members() { + return this.guild.members.filter(m => m.roles.has(this.id)); + } + + /** + * Get an object mapping permission names to whether or not the role enables that permission + * @returns {Object} + * @example + * // print the serialized role + * console.log(role.serialize()); + */ + serialize() { + const serializedPermissions = {}; + for (const permissionName in Constants.PermissionFlags) { + serializedPermissions[permissionName] = this.hasPermission(permissionName); + } + return serializedPermissions; + } + + /** + * Checks if the role has a permission. + * @param {PermissionResolvable} permission The permission to check for + * @param {boolean} [explicit=false] Whether to require the role to explicitly have the exact permission + * @returns {boolean} + * @example + * // see if a role can ban a member + * if (role.hasPermission('BAN_MEMBERS')) { + * console.log('This role can ban members'); + * } else { + * console.log('This role can\'t ban members'); + * } + */ + hasPermission(permission, explicit = false) { + permission = this.client.resolver.resolvePermission(permission); + if (!explicit && (this.permissions & Constants.PermissionFlags.ADMINISTRATOR) > 0) return true; + return (this.permissions & permission) > 0; + } + + /** + * Checks if the role has all specified permissions. + * @param {PermissionResolvable[]} permissions The permissions to check for + * @param {boolean} [explicit=false] Whether to require the role to explicitly have the exact permissions + * @returns {boolean} + */ + hasPermissions(permissions, explicit = false) { + return permissions.every(p => this.hasPermission(p, explicit)); + } + + /** + * Compares this role's position to another role's. + * @param {Role} role Role to compare to this one + * @returns {number} Negative number if the this role's position is lower (other role's is higher), + * positive number if the this one is higher (other's is lower), 0 if equal + */ + comparePositionTo(role) { + return this.constructor.comparePositions(this, role); + } + + /** + * The data for a role + * @typedef {Object} RoleData + * @property {string} [name] The name of the role + * @property {number|string} [color] The color of the role, either a hex string or a base 10 number + * @property {boolean} [hoist] Whether or not the role should be hoisted + * @property {number} [position] The position of the role + * @property {string[]} [permissions] The permissions of the role + * @property {boolean} [mentionable] Whether or not the role should be mentionable + */ + + /** + * Edits the role + * @param {RoleData} data The new data for the role + * @returns {Promise} + * @example + * // edit a role + * role.edit({name: 'new role'}) + * .then(r => console.log(`Edited role ${r}`)) + * .catch(console.error); + */ + edit(data) { + return this.client.rest.methods.updateGuildRole(this, data); + } + + /** + * Set a new name for the role + * @param {string} name The new name of the role + * @returns {Promise} + * @example + * // set the name of the role + * role.setName('new role') + * .then(r => console.log(`Edited name of role ${r}`)) + * .catch(console.error); + */ + setName(name) { + return this.edit({ name }); + } + + /** + * Set a new color for the role + * @param {number|string} color The new color for the role, either a hex string or a base 10 number + * @returns {Promise} + * @example + * // set the color of a role + * role.setColor('#FF0000') + * .then(r => console.log(`Set color of role ${r}`)) + * .catch(console.error); + */ + setColor(color) { + return this.edit({ color }); + } + + /** + * Set whether or not the role should be hoisted + * @param {boolean} hoist Whether or not to hoist the role + * @returns {Promise} + * @example + * // set the hoist of the role + * role.setHoist(true) + * .then(r => console.log(`Role hoisted: ${r.hoist}`)) + * .catch(console.error); + */ + setHoist(hoist) { + return this.edit({ hoist }); + } + + /** + * Set the position of the role + * @param {number} position The position of the role + * @returns {Promise} + * @example + * // set the position of the role + * role.setPosition(1) + * .then(r => console.log(`Role position: ${r.position}`)) + * .catch(console.error); + */ + setPosition(position) { + return this.guild.setRolePosition(this, position); + } + + /** + * Set the permissions of the role + * @param {string[]} permissions The permissions of the role + * @returns {Promise} + * @example + * // set the permissions of the role + * role.setPermissions(['KICK_MEMBERS', 'BAN_MEMBERS']) + * .then(r => console.log(`Role updated ${r}`)) + * .catch(console.error); + */ + setPermissions(permissions) { + return this.edit({ permissions }); + } + + /** + * Set whether this role is mentionable + * @param {boolean} mentionable Whether this role should be mentionable + * @returns {Promise} + * @example + * // make the role mentionable + * role.setMentionable(true) + * .then(r => console.log(`Role updated ${r}`)) + * .catch(console.error); + */ + setMentionable(mentionable) { + return this.edit({ mentionable }); + } + + /** + * Deletes the role + * @returns {Promise} + * @example + * // delete a role + * role.delete() + * .then(r => console.log(`Deleted role ${r}`)) + * .catch(console.error); + */ + delete() { + return this.client.rest.methods.deleteGuildRole(this); + } + + /** + * Whether the role is managable by the client user. + * @type {boolean} + * @readonly + */ + get editable() { + if (this.managed) return false; + const clientMember = this.guild.member(this.client.user); + if (!clientMember.hasPermission(Constants.PermissionFlags.MANAGE_ROLES_OR_PERMISSIONS)) return false; + return clientMember.highestRole.comparePositionTo(this) > 0; + } + + /** + * Whether this role equals another role. It compares all properties, so for most operations + * it is advisable to just compare `role.id === role2.id` as it is much faster and is often + * what most users need. + * @param {Role} role The role to compare to + * @returns {boolean} + */ + equals(role) { + return role && + this.id === role.id && + this.name === role.name && + this.color === role.color && + this.hoist === role.hoist && + this.position === role.position && + this.permissions === role.permissions && + this.managed === role.managed; + } + + /** + * When concatenated with a string, this automatically concatenates the role mention rather than the Role object. + * @returns {string} + */ + toString() { + return `<@&${this.id}>`; + } + + /** + * Compares the positions of two roles. + * @param {Role} role1 First role to compare + * @param {Role} role2 Second role to compare + * @returns {number} Negative number if the first role's position is lower (second role's is higher), + * positive number if the first's is higher (second's is lower), 0 if equal + */ + static comparePositions(role1, role2) { + if (role1.position === role2.position) return role2.id - role1.id; + return role1.position - role2.position; + } +} + +module.exports = Role; /***/ }, /* 23 */ /***/ function(module, exports, __webpack_require__) { - const EventEmitter = __webpack_require__(3).EventEmitter; - const Collection = __webpack_require__(10); +var base = exports; - /** - * Collects messages based on a specified filter, then emits them. - * @extends {EventEmitter} - */ - class MessageCollector extends EventEmitter { - /** - * A function that takes a Message object and a MessageCollector and returns a boolean. - * ```js - * function(message, collector) { - * if (message.content.includes('discord')) { - * return true; // passed the filter test - * } - * return false; // failed the filter test - * } - * ``` - * @typedef {function} CollectorFilterFunction - */ - - /** - * An object containing options used to configure a MessageCollector. All properties are optional. - * @typedef {Object} CollectorOptions - * @property {number} [time] Duration for the collector in milliseconds - * @property {number} [max] Maximum number of messages to handle - * @property {number} [maxMatches] Maximum number of successfully filtered messages to obtain - */ - - /** - * @param {Channel} channel The channel to collect messages in - * @param {CollectorFilterFunction} filter The filter function - * @param {CollectorOptions} [options] Options for the collector - */ - constructor(channel, filter, options = {}) { - super(); - - /** - * The channel this collector is operating on - * @type {Channel} - */ - this.channel = channel; - - /** - * A function used to filter messages that the collector collects. - * @type {CollectorFilterFunction} - */ - this.filter = filter; - - /** - * Options for the collecor. - * @type {CollectorOptions} - */ - this.options = options; - - /** - * Whether this collector has stopped collecting messages. - * @type {boolean} - */ - this.ended = false; - - /** - * A collection of collected messages, mapped by message ID. - * @type {Collection} - */ - this.collected = new Collection(); - - this.listener = message => this.verify(message); - this.channel.client.on('message', this.listener); - if (options.time) this.channel.client.setTimeout(() => this.stop('time'), options.time); - } - - /** - * Verifies a message against the filter and options - * @private - * @param {Message} message The message - * @returns {boolean} - */ - verify(message) { - if (this.channel ? this.channel.id !== message.channel.id : false) return false; - if (this.filter(message, this)) { - this.collected.set(message.id, message); - /** - * Emitted whenever the collector receives a message that passes the filter test. - * @param {Message} message The received message - * @param {MessageCollector} collector The collector the message passed through - * @event MessageCollector#message - */ - this.emit('message', message, this); - if (this.collected.size >= this.options.maxMatches) this.stop('matchesLimit'); - else if (this.options.max && this.collected.size === this.options.max) this.stop('limit'); - return true; - } - return false; - } - - /** - * Returns a promise that resolves when a valid message is sent. Rejects - * with collected messages if the Collector ends before receiving a message. - * @type {Promise} - * @readonly - */ - get next() { - return new Promise((resolve, reject) => { - if (this.ended) { - reject(this.collected); - return; - } - - const cleanup = () => { - this.removeListener('message', onMessage); - this.removeListener('end', onEnd); - }; - - const onMessage = (...args) => { - cleanup(); - resolve(...args); - }; - - const onEnd = (...args) => { - cleanup(); - reject(...args); - }; - - this.once('message', onMessage); - this.once('end', onEnd); - }); - } - - /** - * Stops the collector and emits `end`. - * @param {string} [reason='user'] An optional reason for stopping the collector - */ - stop(reason = 'user') { - if (this.ended) return; - this.ended = true; - this.channel.client.removeListener('message', this.listener); - /** - * Emitted when the Collector stops collecting. - * @param {Collection} collection A collection of messages collected - * during the lifetime of the collector, mapped by the ID of the messages. - * @param {string} reason The reason for the end of the collector. If it ended because it reached the specified time - * limit, this would be `time`. If you invoke `.stop()` without specifying a reason, this would be `user`. If it - * ended because it reached its message limit, it will be `limit`. - * @event MessageCollector#end - */ - this.emit('end', this.collected, reason); - } - } - - module.exports = MessageCollector; +base.Reporter = __webpack_require__(141).Reporter; +base.DecoderBuffer = __webpack_require__(80).DecoderBuffer; +base.EncoderBuffer = __webpack_require__(80).EncoderBuffer; +base.Node = __webpack_require__(140); /***/ }, /* 24 */ -/***/ function(module, exports) { +/***/ function(module, exports, __webpack_require__) { - /** - * Represents a user's presence - */ - class Presence { - constructor(data = {}) { - /** - * The status of the presence: - * - * * **`online`** - user is online - * * **`offline`** - user is offline or invisible - * * **`idle`** - user is AFK - * * **`dnd`** - user is in Do not Disturb - * @type {string} - */ - this.status = data.status || 'offline'; +/* WEBPACK VAR INJECTION */(function(Buffer) {module.exports = function xor (a, b) { + var length = Math.min(a.length, b.length) + var buffer = new Buffer(length) - /** - * The game that the user is playing, `null` if they aren't playing a game. - * @type {?Game} - */ - this.game = data.game ? new Game(data.game) : null; - } + for (var i = 0; i < length; ++i) { + buffer[i] = a[i] ^ b[i] + } - update(data) { - this.status = data.status || this.status; - this.game = data.game ? new Game(data.game) : null; - } - - /** - * Whether this presence is equal to another - * @param {Presence} other the presence to compare - * @returns {boolean} - */ - equals(other) { - return ( - other && - this.status === other.status && - this.game ? this.game.equals(other.game) : !other.game - ); - } - } - - /** - * Represents a game that is part of a user's presence. - */ - class Game { - constructor(data) { - /** - * The name of the game being played - * @type {string} - */ - this.name = data.name; - - /** - * The type of the game status - * @type {number} - */ - this.type = data.type; - - /** - * If the game is being streamed, a link to the stream - * @type {?string} - */ - this.url = data.url || null; - } - - /** - * Whether or not the game is being streamed - * @type {boolean} - * @readonly - */ - get streaming() { - return this.type === 1; - } - - /** - * Whether this game is equal to another game - * @param {Game} other the other game to compare - * @returns {boolean} - */ - equals(other) { - return ( - other && - this.name === other.name && - this.type === other.type && - this.url === other.url - ); - } - } - - exports.Presence = Presence; - exports.Game = Game; + return buffer +} +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer)) /***/ }, /* 25 */ /***/ function(module, exports, __webpack_require__) { - const TextBasedChannel = __webpack_require__(14); - const Role = __webpack_require__(26); - const EvaluatedPermissions = __webpack_require__(27); - const Constants = __webpack_require__(5); - const Collection = __webpack_require__(10); - const Presence = __webpack_require__(24).Presence; +/* WEBPACK VAR INJECTION */(function(Buffer) {// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. - /** - * Represents a member of a guild on Discord - * @implements {TextBasedChannel} - */ - class GuildMember { - constructor(guild, data) { - /** - * The Client that instantiated this GuildMember - * @type {Client} - */ - this.client = guild.client; - Object.defineProperty(this, 'client', { enumerable: false, configurable: false }); +// NOTE: These type checking functions intentionally don't use `instanceof` +// because it is fragile and can be easily faked with `Object.create()`. - /** - * The guild that this member is part of - * @type {Guild} - */ - this.guild = guild; +function isArray(arg) { + if (Array.isArray) { + return Array.isArray(arg); + } + return objectToString(arg) === '[object Array]'; +} +exports.isArray = isArray; - /** - * The user that this guild member instance Represents - * @type {User} - */ - this.user = {}; +function isBoolean(arg) { + return typeof arg === 'boolean'; +} +exports.isBoolean = isBoolean; - this._roles = []; - if (data) this.setup(data); - } +function isNull(arg) { + return arg === null; +} +exports.isNull = isNull; - setup(data) { - /** - * Whether this member is deafened server-wide - * @type {boolean} - */ - this.serverDeaf = data.deaf; +function isNullOrUndefined(arg) { + return arg == null; +} +exports.isNullOrUndefined = isNullOrUndefined; - /** - * Whether this member is muted server-wide - * @type {boolean} - */ - this.serverMute = data.mute; +function isNumber(arg) { + return typeof arg === 'number'; +} +exports.isNumber = isNumber; - /** - * Whether this member is self-muted - * @type {boolean} - */ - this.selfMute = data.self_mute; +function isString(arg) { + return typeof arg === 'string'; +} +exports.isString = isString; - /** - * Whether this member is self-deafened - * @type {boolean} - */ - this.selfDeaf = data.self_deaf; +function isSymbol(arg) { + return typeof arg === 'symbol'; +} +exports.isSymbol = isSymbol; - /** - * The voice session ID of this member, if any - * @type {?string} - */ - this.voiceSessionID = data.session_id; +function isUndefined(arg) { + return arg === void 0; +} +exports.isUndefined = isUndefined; - /** - * The voice channel ID of this member, if any - * @type {?string} - */ - this.voiceChannelID = data.channel_id; +function isRegExp(re) { + return objectToString(re) === '[object RegExp]'; +} +exports.isRegExp = isRegExp; - /** - * Whether this member is speaking - * @type {boolean} - */ - this.speaking = false; +function isObject(arg) { + return typeof arg === 'object' && arg !== null; +} +exports.isObject = isObject; - /** - * The nickname of this guild member, if they have one - * @type {?string} - */ - this.nickname = data.nick || null; +function isDate(d) { + return objectToString(d) === '[object Date]'; +} +exports.isDate = isDate; - /** - * The timestamp the member joined the guild at - * @type {number} - */ - this.joinedTimestamp = new Date(data.joined_at).getTime(); +function isError(e) { + return (objectToString(e) === '[object Error]' || e instanceof Error); +} +exports.isError = isError; - this.user = data.user; - this._roles = data.roles; - } +function isFunction(arg) { + return typeof arg === 'function'; +} +exports.isFunction = isFunction; - /** - * The time the member joined the guild - * @type {Date} - * @readonly - */ - get joinedAt() { - return new Date(this.joinedTimestamp); - } +function isPrimitive(arg) { + return arg === null || + typeof arg === 'boolean' || + typeof arg === 'number' || + typeof arg === 'string' || + typeof arg === 'symbol' || // ES6 symbol + typeof arg === 'undefined'; +} +exports.isPrimitive = isPrimitive; - /** - * The presence of this guild member - * @type {Presence} - * @readonly - */ - get presence() { - return this.frozenPresence || this.guild.presences.get(this.id) || new Presence(); - } +exports.isBuffer = Buffer.isBuffer; - /** - * A list of roles that are applied to this GuildMember, mapped by the role ID. - * @type {Collection} - * @readonly - */ - get roles() { - const list = new Collection(); - const everyoneRole = this.guild.roles.get(this.guild.id); - - if (everyoneRole) list.set(everyoneRole.id, everyoneRole); - - for (const roleID of this._roles) { - const role = this.guild.roles.get(roleID); - if (role) list.set(role.id, role); - } - - return list; - } - - /** - * The role of the member with the highest position. - * @type {Role} - * @readonly - */ - get highestRole() { - return this.roles.reduce((prev, role) => !prev || role.comparePositionTo(prev) > 0 ? role : prev); - } - - /** - * Whether this member is muted in any way - * @type {boolean} - * @readonly - */ - get mute() { - return this.selfMute || this.serverMute; - } - - /** - * Whether this member is deafened in any way - * @type {boolean} - * @readonly - */ - get deaf() { - return this.selfDeaf || this.serverDeaf; - } - - /** - * The voice channel this member is in, if any - * @type {?VoiceChannel} - * @readonly - */ - get voiceChannel() { - return this.guild.channels.get(this.voiceChannelID); - } - - /** - * The ID of this user - * @type {string} - * @readonly - */ - get id() { - return this.user.id; - } - - /** - * The overall set of permissions for the guild member, taking only roles into account - * @type {EvaluatedPermissions} - * @readonly - */ - get permissions() { - if (this.user.id === this.guild.ownerID) return new EvaluatedPermissions(this, Constants.ALL_PERMISSIONS); - - let permissions = 0; - const roles = this.roles; - for (const role of roles.values()) permissions |= role.permissions; - - const admin = Boolean(permissions & Constants.PermissionFlags.ADMINISTRATOR); - if (admin) permissions = Constants.ALL_PERMISSIONS; - - return new EvaluatedPermissions(this, permissions); - } - - /** - * Whether the member is kickable by the client user. - * @type {boolean} - * @readonly - */ - get kickable() { - if (this.user.id === this.guild.ownerID) return false; - if (this.user.id === this.client.user.id) return false; - const clientMember = this.guild.member(this.client.user); - if (!clientMember.hasPermission(Constants.PermissionFlags.KICK_MEMBERS)) return false; - return clientMember.highestRole.comparePositionTo(this.highestRole) > 0; - } - - /** - * Whether the member is bannable by the client user. - * @type {boolean} - * @readonly - */ - get bannable() { - if (this.user.id === this.guild.ownerID) return false; - if (this.user.id === this.client.user.id) return false; - const clientMember = this.guild.member(this.client.user); - if (!clientMember.hasPermission(Constants.PermissionFlags.BAN_MEMBERS)) return false; - return clientMember.highestRole.comparePositionTo(this.highestRole) > 0; - } - - /** - * Returns `channel.permissionsFor(guildMember)`. Returns evaluated permissions for a member in a guild channel. - * @param {ChannelResolvable} channel Guild channel to use as context - * @returns {?EvaluatedPermissions} - */ - permissionsIn(channel) { - channel = this.client.resolver.resolveChannel(channel); - if (!channel || !channel.guild) throw new Error('Could not resolve channel to a guild channel.'); - return channel.permissionsFor(this); - } - - /** - * Checks if any of the member's roles have a permission. - * @param {PermissionResolvable} permission The permission to check for - * @param {boolean} [explicit=false] Whether to require the roles to explicitly have the exact permission - * @returns {boolean} - */ - hasPermission(permission, explicit = false) { - if (!explicit && this.user.id === this.guild.ownerID) return true; - return this.roles.some(r => r.hasPermission(permission, explicit)); - } - - /** - * Checks whether the roles of the member allows them to perform specific actions. - * @param {PermissionResolvable[]} permissions The permissions to check for - * @param {boolean} [explicit=false] Whether to require the member to explicitly have the exact permissions - * @returns {boolean} - */ - hasPermissions(permissions, explicit = false) { - if (!explicit && this.user.id === this.guild.ownerID) return true; - return permissions.every(p => this.hasPermission(p, explicit)); - } - - /** - * Checks whether the roles of the member allows them to perform specific actions, and lists any missing permissions. - * @param {PermissionResolvable[]} permissions The permissions to check for - * @param {boolean} [explicit=false] Whether to require the member to explicitly have the exact permissions - * @returns {PermissionResolvable[]} - */ - missingPermissions(permissions, explicit = false) { - return permissions.filter(p => !this.hasPermission(p, explicit)); - } - - /** - * Edit a guild member - * @param {GuildmemberEditData} data The data to edit the member with - * @returns {Promise} - */ - edit(data) { - return this.client.rest.methods.updateGuildMember(this, data); - } - - /** - * Mute/unmute a user - * @param {boolean} mute Whether or not the member should be muted - * @returns {Promise} - */ - setMute(mute) { - return this.edit({ mute }); - } - - /** - * Deafen/undeafen a user - * @param {boolean} deaf Whether or not the member should be deafened - * @returns {Promise} - */ - setDeaf(deaf) { - return this.edit({ deaf }); - } - - /** - * Moves the guild member to the given channel. - * @param {ChannelResolvable} channel The channel to move the member to - * @returns {Promise} - */ - setVoiceChannel(channel) { - return this.edit({ channel }); - } - - /** - * Sets the roles applied to the member. - * @param {Collection|Role[]|string[]} roles The roles or role IDs to apply - * @returns {Promise} - */ - setRoles(roles) { - return this.edit({ roles }); - } - - /** - * Adds a single role to the member. - * @param {Role|string} role The role or ID of the role to add - * @returns {Promise} - */ - addRole(role) { - return this.addRoles([role]); - } - - /** - * Adds multiple roles to the member. - * @param {Collection|Role[]|string[]} roles The roles or role IDs to add - * @returns {Promise} - */ - addRoles(roles) { - let allRoles; - if (roles instanceof Collection) { - allRoles = this._roles.slice(); - for (const role of roles.values()) allRoles.push(role.id); - } else { - allRoles = this._roles.concat(roles); - } - return this.edit({ roles: allRoles }); - } - - /** - * Removes a single role from the member. - * @param {Role|string} role The role or ID of the role to remove - * @returns {Promise} - */ - removeRole(role) { - return this.removeRoles([role]); - } - - /** - * Removes multiple roles from the member. - * @param {Collection|Role[]|string[]} roles The roles or role IDs to remove - * @returns {Promise} - */ - removeRoles(roles) { - const allRoles = this._roles.slice(); - if (roles instanceof Collection) { - for (const role of roles.values()) { - const index = allRoles.indexOf(role.id); - if (index >= 0) allRoles.splice(index, 1); - } - } else { - for (const role of roles) { - const index = allRoles.indexOf(role instanceof Role ? role.id : role); - if (index >= 0) allRoles.splice(index, 1); - } - } - return this.edit({ roles: allRoles }); - } - - /** - * Set the nickname for the guild member - * @param {string} nick The nickname for the guild member - * @returns {Promise} - */ - setNickname(nick) { - return this.edit({ nick }); - } - - /** - * Deletes any DMs with this guild member - * @returns {Promise} - */ - deleteDM() { - return this.client.rest.methods.deleteChannel(this); - } - - /** - * Kick this member from the guild - * @returns {Promise} - */ - kick() { - return this.client.rest.methods.kickGuildMember(this.guild, this); - } - - /** - * Ban this guild member - * @param {number} [deleteDays=0] The amount of days worth of messages from this member that should - * also be deleted. Between `0` and `7`. - * @returns {Promise} - * @example - * // ban a guild member - * guildMember.ban(7); - */ - ban(deleteDays = 0) { - return this.client.rest.methods.banGuildMember(this.guild, this, deleteDays); - } - - /** - * When concatenated with a string, this automatically concatenates the user's mention instead of the Member object. - * @returns {string} - * @example - * // logs: Hello from <@123456789>! - * console.log(`Hello from ${member}!`); - */ - toString() { - return `<@${this.nickname ? '!' : ''}${this.user.id}>`; - } - - // These are here only for documentation purposes - they are implemented by TextBasedChannel - sendMessage() { return; } - sendTTSMessage() { return; } - sendFile() { return; } - sendCode() { return; } - } - - TextBasedChannel.applyToClass(GuildMember); - - module.exports = GuildMember; +function objectToString(o) { + return Object.prototype.toString.call(o); +} +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer)) /***/ }, /* 26 */ -/***/ function(module, exports, __webpack_require__) { +/***/ function(module, exports) { - const Constants = __webpack_require__(5); +module.exports = assert; - /** - * Represents a role on Discord - */ - class Role { - constructor(guild, data) { - /** - * The client that instantiated the role - * @type {Client} - */ - this.client = guild.client; - Object.defineProperty(this, 'client', { enumerable: false, configurable: false }); +function assert(val, msg) { + if (!val) + throw new Error(msg || 'Assertion failed'); +} - /** - * The guild that the role belongs to - * @type {Guild} - */ - this.guild = guild; - - if (data) this.setup(data); - } - - setup(data) { - /** - * The ID of the role (unique to the guild it is part of) - * @type {string} - */ - this.id = data.id; - - /** - * The name of the role - * @type {string} - */ - this.name = data.name; - - /** - * The base 10 color of the role - * @type {number} - */ - this.color = data.color; - - /** - * If true, users that are part of this role will appear in a separate category in the users list - * @type {boolean} - */ - this.hoist = data.hoist; - - /** - * The position of the role in the role manager - * @type {number} - */ - this.position = data.position; - - /** - * The evaluated permissions number - * @type {number} - */ - this.permissions = data.permissions; - - /** - * Whether or not the role is managed by an external service - * @type {boolean} - */ - this.managed = data.managed; - - /** - * Whether or not the role can be mentioned by anyone - * @type {boolean} - */ - this.mentionable = data.mentionable; - } - - /** - * The timestamp the role was created at - * @type {number} - * @readonly - */ - get createdTimestamp() { - return (this.id / 4194304) + 1420070400000; - } - - /** - * The time the role was created - * @type {Date} - * @readonly - */ - get createdAt() { - return new Date(this.createdTimestamp); - } - - /** - * The hexadecimal version of the role color, with a leading hashtag. - * @type {string} - * @readonly - */ - get hexColor() { - let col = this.color.toString(16); - while (col.length < 6) col = `0${col}`; - return `#${col}`; - } - - /** - * The cached guild members that have this role. - * @type {Collection} - * @readonly - */ - get members() { - return this.guild.members.filter(m => m.roles.has(this.id)); - } - - /** - * Get an object mapping permission names to whether or not the role enables that permission - * @returns {Object} - * @example - * // print the serialized role - * console.log(role.serialize()); - */ - serialize() { - const serializedPermissions = {}; - for (const permissionName in Constants.PermissionFlags) { - serializedPermissions[permissionName] = this.hasPermission(permissionName); - } - return serializedPermissions; - } - - /** - * Checks if the role has a permission. - * @param {PermissionResolvable} permission The permission to check for - * @param {boolean} [explicit=false] Whether to require the role to explicitly have the exact permission - * @returns {boolean} - * @example - * // see if a role can ban a member - * if (role.hasPermission('BAN_MEMBERS')) { - * console.log('This role can ban members'); - * } else { - * console.log('This role can\'t ban members'); - * } - */ - hasPermission(permission, explicit = false) { - permission = this.client.resolver.resolvePermission(permission); - if (!explicit && (this.permissions & Constants.PermissionFlags.ADMINISTRATOR) > 0) return true; - return (this.permissions & permission) > 0; - } - - /** - * Checks if the role has all specified permissions. - * @param {PermissionResolvable[]} permissions The permissions to check for - * @param {boolean} [explicit=false] Whether to require the role to explicitly have the exact permissions - * @returns {boolean} - */ - hasPermissions(permissions, explicit = false) { - return permissions.every(p => this.hasPermission(p, explicit)); - } - - /** - * Compares this role's position to another role's. - * @param {Role} role Role to compare to this one - * @returns {number} Negative number if the this role's position is lower (other role's is higher), - * positive number if the this one is higher (other's is lower), 0 if equal - */ - comparePositionTo(role) { - return this.constructor.comparePositions(this, role); - } - - /** - * The data for a role - * @typedef {Object} RoleData - * @property {string} [name] The name of the role - * @property {number|string} [color] The color of the role, either a hex string or a base 10 number - * @property {boolean} [hoist] Whether or not the role should be hoisted - * @property {number} [position] The position of the role - * @property {string[]} [permissions] The permissions of the role - * @property {boolean} [mentionable] Whether or not the role should be mentionable - */ - - /** - * Edits the role - * @param {RoleData} data The new data for the role - * @returns {Promise} - * @example - * // edit a role - * role.edit({name: 'new role'}) - * .then(r => console.log(`Edited role ${r}`)) - * .catch(console.error); - */ - edit(data) { - return this.client.rest.methods.updateGuildRole(this, data); - } - - /** - * Set a new name for the role - * @param {string} name The new name of the role - * @returns {Promise} - * @example - * // set the name of the role - * role.setName('new role') - * .then(r => console.log(`Edited name of role ${r}`)) - * .catch(console.error); - */ - setName(name) { - return this.edit({ name }); - } - - /** - * Set a new color for the role - * @param {number|string} color The new color for the role, either a hex string or a base 10 number - * @returns {Promise} - * @example - * // set the color of a role - * role.setColor('#FF0000') - * .then(r => console.log(`Set color of role ${r}`)) - * .catch(console.error); - */ - setColor(color) { - return this.edit({ color }); - } - - /** - * Set whether or not the role should be hoisted - * @param {boolean} hoist Whether or not to hoist the role - * @returns {Promise} - * @example - * // set the hoist of the role - * role.setHoist(true) - * .then(r => console.log(`Role hoisted: ${r.hoist}`)) - * .catch(console.error); - */ - setHoist(hoist) { - return this.edit({ hoist }); - } - - /** - * Set the position of the role - * @param {number} position The position of the role - * @returns {Promise} - * @example - * // set the position of the role - * role.setPosition(1) - * .then(r => console.log(`Role position: ${r.position}`)) - * .catch(console.error); - */ - setPosition(position) { - return this.guild.setRolePosition(this, position); - } - - /** - * Set the permissions of the role - * @param {string[]} permissions The permissions of the role - * @returns {Promise} - * @example - * // set the permissions of the role - * role.setPermissions(['KICK_MEMBERS', 'BAN_MEMBERS']) - * .then(r => console.log(`Role updated ${r}`)) - * .catch(console.error); - */ - setPermissions(permissions) { - return this.edit({ permissions }); - } - - /** - * Set whether this role is mentionable - * @param {boolean} mentionable Whether this role should be mentionable - * @returns {Promise} - * @example - * // make the role mentionable - * role.setMentionable(true) - * .then(r => console.log(`Role updated ${r}`)) - * .catch(console.error); - */ - setMentionable(mentionable) { - return this.edit({ mentionable }); - } - - /** - * Deletes the role - * @returns {Promise} - * @example - * // delete a role - * role.delete() - * .then(r => console.log(`Deleted role ${r}`)) - * .catch(console.error); - */ - delete() { - return this.client.rest.methods.deleteGuildRole(this); - } - - /** - * Whether the role is managable by the client user. - * @type {boolean} - * @readonly - */ - get editable() { - if (this.managed) return false; - const clientMember = this.guild.member(this.client.user); - if (!clientMember.hasPermission(Constants.PermissionFlags.MANAGE_ROLES_OR_PERMISSIONS)) return false; - return clientMember.highestRole.comparePositionTo(this) > 0; - } - - /** - * Whether this role equals another role. It compares all properties, so for most operations - * it is advisable to just compare `role.id === role2.id` as it is much faster and is often - * what most users need. - * @param {Role} role The role to compare to - * @returns {boolean} - */ - equals(role) { - return role && - this.id === role.id && - this.name === role.name && - this.color === role.color && - this.hoist === role.hoist && - this.position === role.position && - this.permissions === role.permissions && - this.managed === role.managed; - } - - /** - * When concatenated with a string, this automatically concatenates the role mention rather than the Role object. - * @returns {string} - */ - toString() { - return `<@&${this.id}>`; - } - - /** - * Compares the positions of two roles. - * @param {Role} role1 First role to compare - * @param {Role} role2 Second role to compare - * @returns {number} Negative number if the first role's position is lower (second role's is higher), - * positive number if the first's is higher (second's is lower), 0 if equal - */ - static comparePositions(role1, role2) { - if (role1.position === role2.position) return role2.id - role1.id; - return role1.position - role2.position; - } - } - - module.exports = Role; +assert.equal = function assertEqual(l, r, msg) { + if (l != r) + throw new Error(msg || ('Assertion failed: ' + l + ' != ' + r)); +}; /***/ }, /* 27 */ /***/ function(module, exports, __webpack_require__) { - const Constants = __webpack_require__(5); +"use strict"; +/* WEBPACK VAR INJECTION */(function(global, Buffer, process) {'use strict' - /** - * The final evaluated permissions for a member in a channel - */ - class EvaluatedPermissions { - constructor(member, raw) { - /** - * The member this permissions refer to - * @type {GuildMember} - */ - this.member = member; +function oldBrowser () { + throw new Error('secure random number generation not supported by this browser\nuse chrome, FireFox or Internet Explorer 11') +} - /** - * A number representing the packed permissions - * @type {number} - */ - this.raw = raw; - } +var crypto = global.crypto || global.msCrypto - /** - * Get an object mapping permission name, e.g. `READ_MESSAGES` to a boolean - whether the user - * can perform this or not. - * @returns {Object} - */ - serialize() { - const serializedPermissions = {}; - for (const permissionName in Constants.PermissionFlags) { - serializedPermissions[permissionName] = this.hasPermission(permissionName); - } - return serializedPermissions; - } +if (crypto && crypto.getRandomValues) { + module.exports = randomBytes +} else { + module.exports = oldBrowser +} - /** - * Checks whether the user has a certain permission, e.g. `READ_MESSAGES`. - * @param {PermissionResolvable} permission The permission to check for - * @param {boolean} [explicit=false] Whether to require the user to explicitly have the exact permission - * @returns {boolean} - */ - hasPermission(permission, explicit = false) { - permission = this.member.client.resolver.resolvePermission(permission); - if (!explicit && (this.raw & Constants.PermissionFlags.ADMINISTRATOR) > 0) return true; - return (this.raw & permission) > 0; - } +function randomBytes (size, cb) { + // phantomjs needs to throw + if (size > 65536) throw new Error('requested too many random bytes') + // in case browserify isn't using the Uint8Array version + var rawBytes = new global.Uint8Array(size) - /** - * Checks whether the user has all specified permissions. - * @param {PermissionResolvable[]} permissions The permissions to check for - * @param {boolean} [explicit=false] Whether to require the user to explicitly have the exact permissions - * @returns {boolean} - */ - hasPermissions(permissions, explicit = false) { - return permissions.every(p => this.hasPermission(p, explicit)); - } + // This will not work in older browsers. + // See https://developer.mozilla.org/en-US/docs/Web/API/window.crypto.getRandomValues + if (size > 0) { // getRandomValues fails on IE if size == 0 + crypto.getRandomValues(rawBytes) + } + // phantomjs doesn't like a buffer being passed here + var bytes = new Buffer(rawBytes.buffer) - /** - * Checks whether the user has all specified permissions, and lists any missing permissions. - * @param {PermissionResolvable[]} permissions The permissions to check for - * @param {boolean} [explicit=false] Whether to require the user to explicitly have the exact permissions - * @returns {PermissionResolvable[]} - */ - missingPermissions(permissions, explicit = false) { - return permissions.filter(p => !this.hasPermission(p, explicit)); - } - } + if (typeof cb === 'function') { + return process.nextTick(function () { + cb(null, bytes) + }) + } - module.exports = EvaluatedPermissions; + return bytes +} +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(16), __webpack_require__(0).Buffer, __webpack_require__(5))) /***/ }, /* 28 */ /***/ function(module, exports, __webpack_require__) { - const PartialGuild = __webpack_require__(29); - const PartialGuildChannel = __webpack_require__(30); - const Constants = __webpack_require__(5); +const path = __webpack_require__(14); +const Message = __webpack_require__(44); +const MessageCollector = __webpack_require__(69); +const Collection = __webpack_require__(6); +const escapeMarkdown = __webpack_require__(31); - /* - { max_age: 86400, - code: 'CG9A5', - guild: - { splash: null, - id: '123123123', - icon: '123123123', - name: 'name' }, - created_at: '2016-08-28T19:07:04.763368+00:00', - temporary: false, - uses: 0, - max_uses: 0, - inviter: - { username: '123', - discriminator: '4204', - bot: true, - id: '123123123', - avatar: '123123123' }, - channel: { type: 0, id: '123123', name: 'heavy-testing' } } - */ +/** + * Interface for classes that have text-channel-like features + * @interface + */ +class TextBasedChannel { + constructor() { + /** + * A collection containing the messages sent to this channel. + * @type {Collection} + */ + this.messages = new Collection(); - /** - * Represents an invitation to a guild channel. - * The only guaranteed properties are `code`, `guild` and `channel`. Other properties can be missing. - */ - class Invite { - constructor(client, data) { - /** - * The client that instantiated the invite - * @type {Client} - */ - this.client = client; - Object.defineProperty(this, 'client', { enumerable: false, configurable: false }); + /** + * The ID of the last message in the channel, if one was sent. + * @type {?string} + */ + this.lastMessageID = null; + } - this.setup(data); - } + /** + * Options that can be passed into sendMessage, sendTTSMessage, sendFile, sendCode, or Message.reply + * @typedef {Object} MessageOptions + * @property {boolean} [tts=false] Whether or not the message should be spoken aloud + * @property {string} [nonce=''] The nonce for the message + * @property {Object} [embed] An embed for the message + * (see [here](https://discordapp.com/developers/docs/resources/channel#embed-object) for more details) + * @property {boolean} [disableEveryone=this.client.options.disableEveryone] Whether or not @everyone and @here + * should be replaced with plain-text + * @property {boolean|SplitOptions} [split=false] Whether or not the message should be split into multiple messages if + * it exceeds the character limit. If an object is provided, these are the options for splitting the message. + */ - setup(data) { - /** - * The guild the invite is for. If this guild is already known, this will be a Guild object. If the guild is - * unknown, this will be a PartialGuild object. - * @type {Guild|PartialGuild} - */ - this.guild = this.client.guilds.get(data.guild.id) || new PartialGuild(this.client, data.guild); + /** + * Options for splitting a message + * @typedef {Object} SplitOptions + * @property {number} [maxLength=1950] Maximum character length per message piece + * @property {string} [char='\n'] Character to split the message with + * @property {string} [prepend=''] Text to prepend to every piece except the first + * @property {string} [append=''] Text to append to every piece except the last + */ - /** - * The code for this invite - * @type {string} - */ - this.code = data.code; + /** + * Send a message to this channel + * @param {StringResolvable} content The content to send + * @param {MessageOptions} [options={}] The options to provide + * @returns {Promise} + * @example + * // send a message + * channel.sendMessage('hello!') + * .then(message => console.log(`Sent message: ${message.content}`)) + * .catch(console.error); + */ + sendMessage(content, options = {}) { + return this.client.rest.methods.sendMessage(this, content, options); + } - /** - * Whether or not this invite is temporary - * @type {boolean} - */ - this.temporary = data.temporary; + /** + * Send a text-to-speech message to this channel + * @param {StringResolvable} content The content to send + * @param {MessageOptions} [options={}] The options to provide + * @returns {Promise} + * @example + * // send a TTS message + * channel.sendTTSMessage('hello!') + * .then(message => console.log(`Sent tts message: ${message.content}`)) + * .catch(console.error); + */ + sendTTSMessage(content, options = {}) { + Object.assign(options, { tts: true }); + return this.client.rest.methods.sendMessage(this, content, options); + } - /** - * The maximum age of the invite, in seconds - * @type {?number} - */ - this.maxAge = data.max_age; + /** + * Send a file to this channel + * @param {BufferResolvable} attachment The file to send + * @param {string} [fileName="file.jpg"] The name and extension of the file + * @param {StringResolvable} [content] Text message to send with the attachment + * @param {MessageOptions} [options] The options to provide + * @returns {Promise} + */ + sendFile(attachment, fileName, content, options = {}) { + if (!fileName) { + if (typeof attachment === 'string') { + fileName = path.basename(attachment); + } else if (attachment && attachment.path) { + fileName = path.basename(attachment.path); + } else { + fileName = 'file.jpg'; + } + } + return this.client.resolver.resolveBuffer(attachment).then(file => + this.client.rest.methods.sendMessage(this, content, options, { + file, + name: fileName, + }) + ); + } - /** - * How many times this invite has been used - * @type {number} - */ - this.uses = data.uses; + /** + * Send a code block to this channel + * @param {string} lang Language for the code block + * @param {StringResolvable} content Content of the code block + * @param {MessageOptions} options The options to provide + * @returns {Promise} + */ + sendCode(lang, content, options = {}) { + if (options.split) { + if (typeof options.split !== 'object') options.split = {}; + if (!options.split.prepend) options.split.prepend = `\`\`\`${lang || ''}\n`; + if (!options.split.append) options.split.append = '\n```'; + } + content = escapeMarkdown(this.client.resolver.resolveString(content), true); + return this.sendMessage(`\`\`\`${lang || ''}\n${content}\n\`\`\``, options); + } - /** - * The maximum uses of this invite - * @type {number} - */ - this.maxUses = data.max_uses; + /** + * Gets a single message from this channel, regardless of it being cached or not. + * This is only available when using a bot account. + * @param {string} messageID The ID of the message to get + * @returns {Promise} + * @example + * // get message + * channel.fetchMessage('99539446449315840') + * .then(message => console.log(message.content)) + * .catch(console.error); + */ + fetchMessage(messageID) { + return this.client.rest.methods.getChannelMessage(this, messageID).then(data => { + const msg = data instanceof Message ? data : new Message(this, data, this.client); + this._cacheMessage(msg); + return msg; + }); + } - if (data.inviter) { - /** - * The user who created this invite - * @type {User} - */ - this.inviter = this.client.dataManager.newUser(data.inviter); - } + /** + * The parameters to pass in when requesting previous messages from a channel. `around`, `before` and + * `after` are mutually exclusive. All the parameters are optional. + * @typedef {Object} ChannelLogsQueryOptions + * @property {number} [limit=50] Number of messages to acquire + * @property {string} [before] ID of a message to get the messages that were posted before it + * @property {string} [after] ID of a message to get the messages that were posted after it + * @property {string} [around] ID of a message to get the messages that were posted around it + */ - /** - * The channel the invite is for. If this channel is already known, this will be a GuildChannel object. - * If the channel is unknown, this will be a PartialGuildChannel object. - * @type {GuildChannel|PartialGuildChannel} - */ - this.channel = this.client.channels.get(data.channel.id) || new PartialGuildChannel(this.client, data.channel); + /** + * Gets the past messages sent in this channel. Resolves with a collection mapping message ID's to Message objects. + * @param {ChannelLogsQueryOptions} [options={}] The query parameters to pass in + * @returns {Promise>} + * @example + * // get messages + * channel.fetchMessages({limit: 10}) + * .then(messages => console.log(`Received ${messages.size} messages`)) + * .catch(console.error); + */ + fetchMessages(options = {}) { + return this.client.rest.methods.getChannelMessages(this, options).then(data => { + const messages = new Collection(); + for (const message of data) { + const msg = new Message(this, message, this.client); + messages.set(message.id, msg); + this._cacheMessage(msg); + } + return messages; + }); + } - /** - * The timestamp the invite was created at - * @type {number} - */ - this.createdTimestamp = new Date(data.created_at).getTime(); - } + /** + * Fetches the pinned messages of this channel and returns a collection of them. + * @returns {Promise>} + */ + fetchPinnedMessages() { + return this.client.rest.methods.getChannelPinnedMessages(this).then(data => { + const messages = new Collection(); + for (const message of data) { + const msg = new Message(this, message, this.client); + messages.set(message.id, msg); + this._cacheMessage(msg); + } + return messages; + }); + } - /** - * The time the invite was created - * @type {Date} - * @readonly - */ - get createdAt() { - return new Date(this.createdTimestamp); - } + /** + * Starts a typing indicator in the channel. + * @param {number} [count] The number of times startTyping should be considered to have been called + * @example + * // start typing in a channel + * channel.startTyping(); + */ + startTyping(count) { + if (typeof count !== 'undefined' && count < 1) throw new RangeError('Count must be at least 1.'); + if (!this.client.user._typing.has(this.id)) { + this.client.user._typing.set(this.id, { + count: count || 1, + interval: this.client.setInterval(() => { + this.client.rest.methods.sendTyping(this.id); + }, 4000), + }); + this.client.rest.methods.sendTyping(this.id); + } else { + const entry = this.client.user._typing.get(this.id); + entry.count = count || entry.count + 1; + } + } - /** - * The timestamp the invite will expire at - * @type {number} - * @readonly - */ - get expiresTimestamp() { - return this.createdTimestamp + (this.maxAge * 1000); - } + /** + * Stops the typing indicator in the channel. + * The indicator will only stop if this is called as many times as startTyping(). + * It can take a few seconds for the client user to stop typing. + * @param {boolean} [force=false] Whether or not to reset the call count and force the indicator to stop + * @example + * // stop typing in a channel + * channel.stopTyping(); + * @example + * // force typing to fully stop in a channel + * channel.stopTyping(true); + */ + stopTyping(force = false) { + if (this.client.user._typing.has(this.id)) { + const entry = this.client.user._typing.get(this.id); + entry.count--; + if (entry.count <= 0 || force) { + this.client.clearInterval(entry.interval); + this.client.user._typing.delete(this.id); + } + } + } - /** - * The time the invite will expire - * @type {Date} - * @readonly - */ - get expiresAt() { - return new Date(this.expiresTimestamp); - } + /** + * Whether or not the typing indicator is being shown in the channel. + * @type {boolean} + * @readonly + */ + get typing() { + return this.client.user._typing.has(this.id); + } - /** - * The URL to the invite - * @type {string} - * @readonly - */ - get url() { - return Constants.Endpoints.inviteLink(this.code); - } + /** + * Number of times `startTyping` has been called. + * @type {number} + * @readonly + */ + get typingCount() { + if (this.client.user._typing.has(this.id)) return this.client.user._typing.get(this.id).count; + return 0; + } - /** - * Deletes this invite - * @returns {Promise} - */ - delete() { - return this.client.rest.methods.deleteInvite(this); - } + /** + * Creates a Message Collector + * @param {CollectorFilterFunction} filter The filter to create the collector with + * @param {CollectorOptions} [options={}] The options to pass to the collector + * @returns {MessageCollector} + * @example + * // create a message collector + * const collector = channel.createCollector( + * m => m.content.includes('discord'), + * { time: 15000 } + * ); + * collector.on('message', m => console.log(`Collected ${m.content}`)); + * collector.on('end', collected => console.log(`Collected ${collected.size} items`)); + */ + createCollector(filter, options = {}) { + return new MessageCollector(this, filter, options); + } - /** - * When concatenated with a string, this automatically concatenates the invite's URL instead of the object. - * @returns {string} - * @example - * // logs: Invite: https://discord.gg/A1b2C3 - * console.log(`Invite: ${invite}`); - */ - toString() { - return this.url; - } - } + /** + * An object containing the same properties as CollectorOptions, but a few more: + * @typedef {CollectorOptions} AwaitMessagesOptions + * @property {string[]} [errors] Stop/end reasons that cause the promise to reject + */ - module.exports = Invite; + /** + * Similar to createCollector but in promise form. Resolves with a collection of messages that pass the specified + * filter. + * @param {CollectorFilterFunction} filter The filter function to use + * @param {AwaitMessagesOptions} [options={}] Optional options to pass to the internal collector + * @returns {Promise>} + * @example + * // await !vote messages + * const filter = m => m.content.startsWith('!vote'); + * // errors: ['time'] treats ending because of the time limit as an error + * channel.awaitMessages(filter, { max: 4, time: 60000, errors: ['time'] }) + * .then(collected => console.log(collected.size)) + * .catch(collected => console.log(`After a minute, only ${collected.size} out of 4 voted.`)); + */ + awaitMessages(filter, options = {}) { + return new Promise((resolve, reject) => { + const collector = this.createCollector(filter, options); + collector.on('end', (collection, reason) => { + if (options.errors && options.errors.includes(reason)) { + reject(collection); + } else { + resolve(collection); + } + }); + }); + } + + /** + * Bulk delete given messages. + * This is only available when using a bot account. + * @param {Collection|Message[]|number} messages Messages to delete, or number of messages to delete + * @returns {Promise>} Deleted messages + */ + bulkDelete(messages) { + if (!isNaN(messages)) return this.fetchMessages({ limit: messages }).then(msgs => this.bulkDelete(msgs)); + if (messages instanceof Array || messages instanceof Collection) { + const messageIDs = messages instanceof Collection ? messages.keyArray() : messages.map(m => m.id); + return this.client.rest.methods.bulkDeleteMessages(this, messageIDs); + } + throw new TypeError('The messages must be an Array, Collection, or number.'); + } + + _cacheMessage(message) { + const maxSize = this.client.options.messageCacheMaxSize; + if (maxSize === 0) return null; + if (this.messages.size >= maxSize && maxSize > 0) this.messages.delete(this.messages.firstKey()); + this.messages.set(message.id, message); + return message; + } +} + +exports.applyToClass = (structure, full = false) => { + const props = ['sendMessage', 'sendTTSMessage', 'sendFile', 'sendCode']; + if (full) { + props.push('_cacheMessage'); + props.push('fetchMessages'); + props.push('fetchMessage'); + props.push('bulkDelete'); + props.push('startTyping'); + props.push('stopTyping'); + props.push('typing'); + props.push('typingCount'); + props.push('fetchPinnedMessages'); + props.push('createCollector'); + props.push('awaitMessages'); + } + for (const prop of props) applyProp(structure, prop); +}; + +function applyProp(structure, prop) { + Object.defineProperty(structure.prototype, prop, Object.getOwnPropertyDescriptor(TextBasedChannel.prototype, prop)); +} /***/ }, /* 29 */ -/***/ function(module, exports) { +/***/ function(module, exports, __webpack_require__) { - /* - { splash: null, - id: '123123123', - icon: '123123123', - name: 'name' } - */ +const Channel = __webpack_require__(20); +const Role = __webpack_require__(22); +const PermissionOverwrites = __webpack_require__(75); +const EvaluatedPermissions = __webpack_require__(42); +const Constants = __webpack_require__(2); +const Collection = __webpack_require__(6); +const arraysEqual = __webpack_require__(60); - /** - * Represents a guild that the client only has limited information for - e.g. from invites. - */ - class PartialGuild { - constructor(client, data) { - /** - * The Client that instantiated this PartialGuild - * @type {Client} - */ - this.client = client; - Object.defineProperty(this, 'client', { enumerable: false, configurable: false }); +/** + * Represents a guild channel (i.e. text channels and voice channels) + * @extends {Channel} + */ +class GuildChannel extends Channel { + constructor(guild, data) { + super(guild.client, data); - this.setup(data); - } + /** + * The guild the channel is in + * @type {Guild} + */ + this.guild = guild; + } - setup(data) { - /** - * The ID of this guild - * @type {string} - */ - this.id = data.id; + setup(data) { + super.setup(data); - /** - * The name of this guild - * @type {string} - */ - this.name = data.name; + /** + * The name of the guild channel + * @type {string} + */ + this.name = data.name; - /** - * The hash of this guild's icon, or null if there is none. - * @type {?string} - */ - this.icon = data.icon; + /** + * The position of the channel in the list. + * @type {number} + */ + this.position = data.position; - /** - * The hash of the guild splash image, or null if no splash (VIP only) - * @type {?string} - */ - this.splash = data.splash; - } - } + /** + * A map of permission overwrites in this channel for roles and users. + * @type {Collection} + */ + this.permissionOverwrites = new Collection(); + if (data.permission_overwrites) { + for (const overwrite of data.permission_overwrites) { + this.permissionOverwrites.set(overwrite.id, new PermissionOverwrites(this, overwrite)); + } + } + } - module.exports = PartialGuild; + /** + * Gets the overall set of permissions for a user in this channel, taking into account roles and permission + * overwrites. + * @param {GuildMemberResolvable} member The user that you want to obtain the overall permissions for + * @returns {?EvaluatedPermissions} + */ + permissionsFor(member) { + member = this.client.resolver.resolveGuildMember(this.guild, member); + if (!member) return null; + if (member.id === this.guild.ownerID) return new EvaluatedPermissions(member, Constants.ALL_PERMISSIONS); + + let permissions = 0; + + const roles = member.roles; + for (const role of roles.values()) permissions |= role.permissions; + + const overwrites = this.overwritesFor(member, true, roles); + for (const overwrite of overwrites.role.concat(overwrites.member)) { + permissions &= ~overwrite.denyData; + permissions |= overwrite.allowData; + } + + const admin = Boolean(permissions & Constants.PermissionFlags.ADMINISTRATOR); + if (admin) permissions = Constants.ALL_PERMISSIONS; + + return new EvaluatedPermissions(member, permissions); + } + + overwritesFor(member, verified = false, roles = null) { + if (!verified) member = this.client.resolver.resolveGuildMember(this.guild, member); + if (!member) return []; + + roles = roles || member.roles; + const roleOverwrites = []; + const memberOverwrites = []; + + for (const overwrite of this.permissionOverwrites.values()) { + if (overwrite.id === member.id) { + memberOverwrites.push(overwrite); + } else if (roles.has(overwrite.id)) { + roleOverwrites.push(overwrite); + } + } + + return { + role: roleOverwrites, + member: memberOverwrites, + }; + } + + /** + * An object mapping permission flags to `true` (enabled) or `false` (disabled) + * ```js + * { + * 'SEND_MESSAGES': true, + * 'ATTACH_FILES': false, + * } + * ``` + * @typedef {Object} PermissionOverwriteOptions + */ + + /** + * Overwrites the permissions for a user or role in this channel. + * @param {RoleResolvable|UserResolvable} userOrRole The user or role to update + * @param {PermissionOverwriteOptions} options The configuration for the update + * @returns {Promise} + * @example + * // overwrite permissions for a message author + * message.channel.overwritePermissions(message.author, { + * SEND_MESSAGES: false + * }) + * .then(() => console.log('Done!')) + * .catch(console.error); + */ + overwritePermissions(userOrRole, options) { + const payload = { + allow: 0, + deny: 0, + }; + + if (userOrRole instanceof Role) { + payload.type = 'role'; + } else if (this.guild.roles.has(userOrRole)) { + userOrRole = this.guild.roles.get(userOrRole); + payload.type = 'role'; + } else { + userOrRole = this.client.resolver.resolveUser(userOrRole); + payload.type = 'member'; + if (!userOrRole) return Promise.reject(new TypeError('Supplied parameter was neither a User nor a Role.')); + } + + payload.id = userOrRole.id; + + const prevOverwrite = this.permissionOverwrites.get(userOrRole.id); + + if (prevOverwrite) { + payload.allow = prevOverwrite.allowData; + payload.deny = prevOverwrite.denyData; + } + + for (const perm in options) { + if (options[perm] === true) { + payload.allow |= Constants.PermissionFlags[perm] || 0; + payload.deny &= ~(Constants.PermissionFlags[perm] || 0); + } else if (options[perm] === false) { + payload.allow &= ~(Constants.PermissionFlags[perm] || 0); + payload.deny |= Constants.PermissionFlags[perm] || 0; + } else if (options[perm] === null) { + payload.allow &= ~(Constants.PermissionFlags[perm] || 0); + payload.deny &= ~(Constants.PermissionFlags[perm] || 0); + } + } + + return this.client.rest.methods.setChannelOverwrite(this, payload); + } + + /** + * The data for a guild channel + * @typedef {Object} ChannelData + * @property {string} [name] The name of the channel + * @property {number} [position] The position of the channel + * @property {string} [topic] The topic of the text channel + * @property {number} [bitrate] The bitrate of the voice channel + * @property {number} [userLimit] The user limit of the channel + */ + + /** + * Edits the channel + * @param {ChannelData} data The new data for the channel + * @returns {Promise} + * @example + * // edit a channel + * channel.edit({name: 'new-channel'}) + * .then(c => console.log(`Edited channel ${c}`)) + * .catch(console.error); + */ + edit(data) { + return this.client.rest.methods.updateChannel(this, data); + } + + /** + * Set a new name for the guild channel + * @param {string} name The new name for the guild channel + * @returns {Promise} + * @example + * // set a new channel name + * channel.setName('not_general') + * .then(newChannel => console.log(`Channel's new name is ${newChannel.name}`)) + * .catch(console.error); + */ + setName(name) { + return this.edit({ name }); + } + + /** + * Set a new position for the guild channel + * @param {number} position The new position for the guild channel + * @returns {Promise} + * @example + * // set a new channel position + * channel.setPosition(2) + * .then(newChannel => console.log(`Channel's new position is ${newChannel.position}`)) + * .catch(console.error); + */ + setPosition(position) { + return this.client.rest.methods.updateChannel(this, { position }); + } + + /** + * Set a new topic for the guild channel + * @param {string} topic The new topic for the guild channel + * @returns {Promise} + * @example + * // set a new channel topic + * channel.setTopic('needs more rate limiting') + * .then(newChannel => console.log(`Channel's new topic is ${newChannel.topic}`)) + * .catch(console.error); + */ + setTopic(topic) { + return this.client.rest.methods.updateChannel(this, { topic }); + } + + /** + * Options given when creating a guild channel invite + * @typedef {Object} InviteOptions + * @property {boolean} [temporary=false] Whether the invite should kick users after 24hrs if they are not given a role + * @property {number} [maxAge=0] Time in seconds the invite expires in + * @property {number} [maxUses=0] Maximum amount of uses for this invite + */ + + /** + * Create an invite to this guild channel + * @param {InviteOptions} [options={}] The options for the invite + * @returns {Promise} + */ + createInvite(options = {}) { + return this.client.rest.methods.createChannelInvite(this, options); + } + + /** + * Checks if this channel has the same type, topic, position, name, overwrites and ID as another channel. + * In most cases, a simple `channel.id === channel2.id` will do, and is much faster too. + * @param {GuildChannel} channel The channel to compare this channel to + * @returns {boolean} + */ + equals(channel) { + let equal = channel && + this.id === channel.id && + this.type === channel.type && + this.topic === channel.topic && + this.position === channel.position && + this.name === channel.name; + + if (equal) { + if (this.permissionOverwrites && channel.permissionOverwrites) { + const thisIDSet = this.permissionOverwrites.keyArray(); + const otherIDSet = channel.permissionOverwrites.keyArray(); + equal = arraysEqual(thisIDSet, otherIDSet); + } else { + equal = !this.permissionOverwrites && !channel.permissionOverwrites; + } + } + + return equal; + } + + /** + * When concatenated with a string, this automatically returns the channel's mention instead of the Channel object. + * @returns {string} + * @example + * // Outputs: Hello from #general + * console.log(`Hello from ${channel}`); + * @example + * // Outputs: Hello from #general + * console.log('Hello from ' + channel); + */ + toString() { + return `<#${this.id}>`; + } +} + +module.exports = GuildChannel; /***/ }, /* 30 */ /***/ function(module, exports, __webpack_require__) { - const Constants = __webpack_require__(5); +const TextBasedChannel = __webpack_require__(28); +const Role = __webpack_require__(22); +const EvaluatedPermissions = __webpack_require__(42); +const Constants = __webpack_require__(2); +const Collection = __webpack_require__(6); +const Presence = __webpack_require__(12).Presence; - /* - { type: 0, id: '123123', name: 'heavy-testing' } } - */ +/** + * Represents a member of a guild on Discord + * @implements {TextBasedChannel} + */ +class GuildMember { + constructor(guild, data) { + /** + * The Client that instantiated this GuildMember + * @type {Client} + */ + this.client = guild.client; + Object.defineProperty(this, 'client', { enumerable: false, configurable: false }); - /** - * Represents a guild channel that the client only has limited information for - e.g. from invites. - */ - class PartialGuildChannel { - constructor(client, data) { - /** - * The Client that instantiated this PartialGuildChannel - * @type {Client} - */ - this.client = client; - Object.defineProperty(this, 'client', { enumerable: false, configurable: false }); + /** + * The guild that this member is part of + * @type {Guild} + */ + this.guild = guild; - this.setup(data); - } + /** + * The user that this guild member instance Represents + * @type {User} + */ + this.user = {}; - setup(data) { - /** - * The ID of this guild channel - * @type {string} - */ - this.id = data.id; + this._roles = []; + if (data) this.setup(data); + } - /** - * The name of this guild channel - * @type {string} - */ - this.name = data.name; + setup(data) { + /** + * Whether this member is deafened server-wide + * @type {boolean} + */ + this.serverDeaf = data.deaf; - /** - * The type of this guild channel - `text` or `voice` - * @type {string} - */ - this.type = Constants.ChannelTypes.text === data.type ? 'text' : 'voice'; - } - } + /** + * Whether this member is muted server-wide + * @type {boolean} + */ + this.serverMute = data.mute; - module.exports = PartialGuildChannel; + /** + * Whether this member is self-muted + * @type {boolean} + */ + this.selfMute = data.self_mute; + + /** + * Whether this member is self-deafened + * @type {boolean} + */ + this.selfDeaf = data.self_deaf; + + /** + * The voice session ID of this member, if any + * @type {?string} + */ + this.voiceSessionID = data.session_id; + + /** + * The voice channel ID of this member, if any + * @type {?string} + */ + this.voiceChannelID = data.channel_id; + + /** + * Whether this member is speaking + * @type {boolean} + */ + this.speaking = false; + + /** + * The nickname of this guild member, if they have one + * @type {?string} + */ + this.nickname = data.nick || null; + + /** + * The timestamp the member joined the guild at + * @type {number} + */ + this.joinedTimestamp = new Date(data.joined_at).getTime(); + + this.user = data.user; + this._roles = data.roles; + } + + /** + * The time the member joined the guild + * @type {Date} + * @readonly + */ + get joinedAt() { + return new Date(this.joinedTimestamp); + } + + /** + * The presence of this guild member + * @type {Presence} + * @readonly + */ + get presence() { + return this.frozenPresence || this.guild.presences.get(this.id) || new Presence(); + } + + /** + * A list of roles that are applied to this GuildMember, mapped by the role ID. + * @type {Collection} + * @readonly + */ + get roles() { + const list = new Collection(); + const everyoneRole = this.guild.roles.get(this.guild.id); + + if (everyoneRole) list.set(everyoneRole.id, everyoneRole); + + for (const roleID of this._roles) { + const role = this.guild.roles.get(roleID); + if (role) list.set(role.id, role); + } + + return list; + } + + /** + * The role of the member with the highest position. + * @type {Role} + * @readonly + */ + get highestRole() { + return this.roles.reduce((prev, role) => !prev || role.comparePositionTo(prev) > 0 ? role : prev); + } + + /** + * Whether this member is muted in any way + * @type {boolean} + * @readonly + */ + get mute() { + return this.selfMute || this.serverMute; + } + + /** + * Whether this member is deafened in any way + * @type {boolean} + * @readonly + */ + get deaf() { + return this.selfDeaf || this.serverDeaf; + } + + /** + * The voice channel this member is in, if any + * @type {?VoiceChannel} + * @readonly + */ + get voiceChannel() { + return this.guild.channels.get(this.voiceChannelID); + } + + /** + * The ID of this user + * @type {string} + * @readonly + */ + get id() { + return this.user.id; + } + + /** + * The overall set of permissions for the guild member, taking only roles into account + * @type {EvaluatedPermissions} + * @readonly + */ + get permissions() { + if (this.user.id === this.guild.ownerID) return new EvaluatedPermissions(this, Constants.ALL_PERMISSIONS); + + let permissions = 0; + const roles = this.roles; + for (const role of roles.values()) permissions |= role.permissions; + + const admin = Boolean(permissions & Constants.PermissionFlags.ADMINISTRATOR); + if (admin) permissions = Constants.ALL_PERMISSIONS; + + return new EvaluatedPermissions(this, permissions); + } + + /** + * Whether the member is kickable by the client user. + * @type {boolean} + * @readonly + */ + get kickable() { + if (this.user.id === this.guild.ownerID) return false; + if (this.user.id === this.client.user.id) return false; + const clientMember = this.guild.member(this.client.user); + if (!clientMember.hasPermission(Constants.PermissionFlags.KICK_MEMBERS)) return false; + return clientMember.highestRole.comparePositionTo(this.highestRole) > 0; + } + + /** + * Whether the member is bannable by the client user. + * @type {boolean} + * @readonly + */ + get bannable() { + if (this.user.id === this.guild.ownerID) return false; + if (this.user.id === this.client.user.id) return false; + const clientMember = this.guild.member(this.client.user); + if (!clientMember.hasPermission(Constants.PermissionFlags.BAN_MEMBERS)) return false; + return clientMember.highestRole.comparePositionTo(this.highestRole) > 0; + } + + /** + * Returns `channel.permissionsFor(guildMember)`. Returns evaluated permissions for a member in a guild channel. + * @param {ChannelResolvable} channel Guild channel to use as context + * @returns {?EvaluatedPermissions} + */ + permissionsIn(channel) { + channel = this.client.resolver.resolveChannel(channel); + if (!channel || !channel.guild) throw new Error('Could not resolve channel to a guild channel.'); + return channel.permissionsFor(this); + } + + /** + * Checks if any of the member's roles have a permission. + * @param {PermissionResolvable} permission The permission to check for + * @param {boolean} [explicit=false] Whether to require the roles to explicitly have the exact permission + * @returns {boolean} + */ + hasPermission(permission, explicit = false) { + if (!explicit && this.user.id === this.guild.ownerID) return true; + return this.roles.some(r => r.hasPermission(permission, explicit)); + } + + /** + * Checks whether the roles of the member allows them to perform specific actions. + * @param {PermissionResolvable[]} permissions The permissions to check for + * @param {boolean} [explicit=false] Whether to require the member to explicitly have the exact permissions + * @returns {boolean} + */ + hasPermissions(permissions, explicit = false) { + if (!explicit && this.user.id === this.guild.ownerID) return true; + return permissions.every(p => this.hasPermission(p, explicit)); + } + + /** + * Checks whether the roles of the member allows them to perform specific actions, and lists any missing permissions. + * @param {PermissionResolvable[]} permissions The permissions to check for + * @param {boolean} [explicit=false] Whether to require the member to explicitly have the exact permissions + * @returns {PermissionResolvable[]} + */ + missingPermissions(permissions, explicit = false) { + return permissions.filter(p => !this.hasPermission(p, explicit)); + } + + /** + * Edit a guild member + * @param {GuildmemberEditData} data The data to edit the member with + * @returns {Promise} + */ + edit(data) { + return this.client.rest.methods.updateGuildMember(this, data); + } + + /** + * Mute/unmute a user + * @param {boolean} mute Whether or not the member should be muted + * @returns {Promise} + */ + setMute(mute) { + return this.edit({ mute }); + } + + /** + * Deafen/undeafen a user + * @param {boolean} deaf Whether or not the member should be deafened + * @returns {Promise} + */ + setDeaf(deaf) { + return this.edit({ deaf }); + } + + /** + * Moves the guild member to the given channel. + * @param {ChannelResolvable} channel The channel to move the member to + * @returns {Promise} + */ + setVoiceChannel(channel) { + return this.edit({ channel }); + } + + /** + * Sets the roles applied to the member. + * @param {Collection|Role[]|string[]} roles The roles or role IDs to apply + * @returns {Promise} + */ + setRoles(roles) { + return this.edit({ roles }); + } + + /** + * Adds a single role to the member. + * @param {Role|string} role The role or ID of the role to add + * @returns {Promise} + */ + addRole(role) { + return this.addRoles([role]); + } + + /** + * Adds multiple roles to the member. + * @param {Collection|Role[]|string[]} roles The roles or role IDs to add + * @returns {Promise} + */ + addRoles(roles) { + let allRoles; + if (roles instanceof Collection) { + allRoles = this._roles.slice(); + for (const role of roles.values()) allRoles.push(role.id); + } else { + allRoles = this._roles.concat(roles); + } + return this.edit({ roles: allRoles }); + } + + /** + * Removes a single role from the member. + * @param {Role|string} role The role or ID of the role to remove + * @returns {Promise} + */ + removeRole(role) { + return this.removeRoles([role]); + } + + /** + * Removes multiple roles from the member. + * @param {Collection|Role[]|string[]} roles The roles or role IDs to remove + * @returns {Promise} + */ + removeRoles(roles) { + const allRoles = this._roles.slice(); + if (roles instanceof Collection) { + for (const role of roles.values()) { + const index = allRoles.indexOf(role.id); + if (index >= 0) allRoles.splice(index, 1); + } + } else { + for (const role of roles) { + const index = allRoles.indexOf(role instanceof Role ? role.id : role); + if (index >= 0) allRoles.splice(index, 1); + } + } + return this.edit({ roles: allRoles }); + } + + /** + * Set the nickname for the guild member + * @param {string} nick The nickname for the guild member + * @returns {Promise} + */ + setNickname(nick) { + return this.edit({ nick }); + } + + /** + * Deletes any DMs with this guild member + * @returns {Promise} + */ + deleteDM() { + return this.client.rest.methods.deleteChannel(this); + } + + /** + * Kick this member from the guild + * @returns {Promise} + */ + kick() { + return this.client.rest.methods.kickGuildMember(this.guild, this); + } + + /** + * Ban this guild member + * @param {number} [deleteDays=0] The amount of days worth of messages from this member that should + * also be deleted. Between `0` and `7`. + * @returns {Promise} + * @example + * // ban a guild member + * guildMember.ban(7); + */ + ban(deleteDays = 0) { + return this.client.rest.methods.banGuildMember(this.guild, this, deleteDays); + } + + /** + * When concatenated with a string, this automatically concatenates the user's mention instead of the Member object. + * @returns {string} + * @example + * // logs: Hello from <@123456789>! + * console.log(`Hello from ${member}!`); + */ + toString() { + return `<@${this.nickname ? '!' : ''}${this.user.id}>`; + } + + // These are here only for documentation purposes - they are implemented by TextBasedChannel + sendMessage() { return; } + sendTTSMessage() { return; } + sendFile() { return; } + sendCode() { return; } +} + +TextBasedChannel.applyToClass(GuildMember); + +module.exports = GuildMember; /***/ }, /* 31 */ -/***/ function(module, exports, __webpack_require__) { +/***/ function(module, exports) { - const path = __webpack_require__(15); - const escapeMarkdown = __webpack_require__(19); - - /** - * Represents a webhook - */ - class Webhook { - constructor(client, dataOrID, token) { - if (client) { - /** - * The Client that instantiated the Webhook - * @type {Client} - */ - this.client = client; - Object.defineProperty(this, 'client', { enumerable: false, configurable: false }); - if (dataOrID) this.setup(dataOrID); - } else { - this.id = dataOrID; - this.token = token; - this.client = this; - } - } - - setup(data) { - /** - * The name of the webhook - * @type {string} - */ - this.name = data.name; - - /** - * The token for the webhook - * @type {string} - */ - this.token = data.token; - - /** - * The avatar for the webhook - * @type {string} - */ - this.avatar = data.avatar; - - /** - * The ID of the webhook - * @type {string} - */ - this.id = data.id; - - /** - * The guild the webhook belongs to - * @type {string} - */ - this.guildID = data.guild_id; - - /** - * The channel the webhook belongs to - * @type {string} - */ - this.channelID = data.channel_id; - - /** - * The owner of the webhook - * @type {User} - */ - if (data.user) this.owner = data.user; - } - - /** - * Options that can be passed into sendMessage, sendTTSMessage, sendFile, sendCode - * @typedef {Object} WebhookMessageOptions - * @property {boolean} [tts=false] Whether or not the message should be spoken aloud - * @property {boolean} [disableEveryone=this.options.disableEveryone] Whether or not @everyone and @here - * should be replaced with plain-text - */ - - /** - * Send a message with this webhook - * @param {StringResolvable} content The content to send. - * @param {WebhookMessageOptions} [options={}] The options to provide. - * @returns {Promise} - * @example - * // send a message - * webhook.sendMessage('hello!') - * .then(message => console.log(`Sent message: ${message.content}`)) - * .catch(console.error); - */ - sendMessage(content, options = {}) { - return this.client.rest.methods.sendWebhookMessage(this, content, options); - } - - /** - * Send a raw slack message with this webhook - * @param {Object} body The raw body to send. - * @returns {Promise} - * @example - * // send a slack message - * webhook.sendSlackMessage({ - * 'username': 'Wumpus', - * 'attachments': [{ - * 'pretext': 'this looks pretty cool', - * 'color': '#F0F', - * 'footer_icon': 'http://snek.s3.amazonaws.com/topSnek.png', - * 'footer': 'Powered by sneks', - * 'ts': new Date().getTime() / 1000 - * }] - * }).catch(console.error); - */ - sendSlackMessage(body) { - return this.client.rest.methods.sendSlackWebhookMessage(this, body); - } - - /** - * Send a text-to-speech message with this webhook - * @param {StringResolvable} content The content to send - * @param {WebhookMessageOptions} [options={}] The options to provide - * @returns {Promise} - * @example - * // send a TTS message - * webhook.sendTTSMessage('hello!') - * .then(message => console.log(`Sent tts message: ${message.content}`)) - * .catch(console.error); - */ - sendTTSMessage(content, options = {}) { - Object.assign(options, { tts: true }); - return this.client.rest.methods.sendWebhookMessage(this, content, options); - } - - /** - * Send a file with this webhook - * @param {BufferResolvable} attachment The file to send - * @param {string} [fileName="file.jpg"] The name and extension of the file - * @param {StringResolvable} [content] Text message to send with the attachment - * @param {WebhookMessageOptions} [options] The options to provide - * @returns {Promise} - */ - sendFile(attachment, fileName, content, options = {}) { - if (!fileName) { - if (typeof attachment === 'string') { - fileName = path.basename(attachment); - } else if (attachment && attachment.path) { - fileName = path.basename(attachment.path); - } else { - fileName = 'file.jpg'; - } - } - return this.client.resolver.resolveBuffer(attachment).then(file => - this.client.rest.methods.sendWebhookMessage(this, content, options, { - file, - name: fileName, - }) - ); - } - - /** - * Send a code block with this webhook - * @param {string} lang Language for the code block - * @param {StringResolvable} content Content of the code block - * @param {WebhookMessageOptions} options The options to provide - * @returns {Promise} - */ - sendCode(lang, content, options = {}) { - if (options.split) { - if (typeof options.split !== 'object') options.split = {}; - if (!options.split.prepend) options.split.prepend = `\`\`\`${lang || ''}\n`; - if (!options.split.append) options.split.append = '\n```'; - } - content = escapeMarkdown(this.client.resolver.resolveString(content), true); - return this.sendMessage(`\`\`\`${lang || ''}\n${content}\n\`\`\``, options); - } - - /** - * Edit the webhook. - * @param {string} name The new name for the Webhook - * @param {BufferResolvable} avatar The new avatar for the Webhook. - * @returns {Promise} - */ - edit(name = this.name, avatar) { - if (avatar) { - return this.client.resolver.resolveBuffer(avatar).then(file => { - const dataURI = this.client.resolver.resolveBase64(file); - return this.client.rest.methods.editWebhook(this, name, dataURI); - }); - } - return this.client.rest.methods.editWebhook(this, name).then(data => { - this.setup(data); - return this; - }); - } - - /** - * Delete the webhook - * @returns {Promise} - */ - delete() { - return this.client.rest.methods.deleteWebhook(this); - } - } - - module.exports = Webhook; +module.exports = function escapeMarkdown(text, onlyCodeBlock = false, onlyInlineCode = false) { + if (onlyCodeBlock) return text.replace(/```/g, '`\u200b``'); + if (onlyInlineCode) return text.replace(/\\(`|\\)/g, '$1').replace(/(`|\\)/g, '\\$1'); + return text.replace(/\\(\*|_|`|~|\\)/g, '$1').replace(/(\*|_|`|~|\\)/g, '\\$1'); +}; /***/ }, /* 32 */ /***/ function(module, exports, __webpack_require__) { - const Collection = __webpack_require__(10); - const UserConnection = __webpack_require__(33); +var asn1 = exports; - /** - * Represents a user's profile on Discord. - */ - class UserProfile { - constructor(user, data) { - /** - * The owner of the profile - * @type {User} - */ - this.user = user; +asn1.bignum = __webpack_require__(4); - /** - * The Client that created the instance of the the UserProfile. - * @type {Client} - */ - this.client = this.user.client; - Object.defineProperty(this, 'client', { enumerable: false, configurable: false }); - - /** - * Guilds that the client user and the user share - * @type {Collection} - */ - this.mutualGuilds = new Collection(); - - /** - * The user's connections - * @type {Collection} - */ - this.connections = new Collection(); - - this.setup(data); - } - - setup(data) { - for (const guild of data.mutual_guilds) { - if (this.client.guilds.has(guild.id)) { - this.mutualGuilds.set(guild.id, this.client.guilds.get(guild.id)); - } - } - for (const connection of data.connected_accounts) { - this.connections.set(connection.id, new UserConnection(this.user, connection)); - } - } - } - - module.exports = UserProfile; +asn1.define = __webpack_require__(139).define; +asn1.base = __webpack_require__(23); +asn1.constants = __webpack_require__(81); +asn1.decoders = __webpack_require__(143); +asn1.encoders = __webpack_require__(145); /***/ }, /* 33 */ -/***/ function(module, exports) { +/***/ function(module, exports, __webpack_require__) { - /** - * Represents a user connection (or "platform identity") - */ - class UserConnection { - constructor(user, data) { - /** - * The user that owns the Connection - * @type {User} - */ - this.user = user; +/* WEBPACK VAR INJECTION */(function(Buffer) {// based on the aes implimentation in triple sec +// https://github.com/keybase/triplesec - this.setup(data); - } +// which is in turn based on the one from crypto-js +// https://code.google.com/p/crypto-js/ - setup(data) { - /** - * The type of the Connection - * @type {string} - */ - this.type = data.type; +var uint_max = Math.pow(2, 32) +function fixup_uint32 (x) { + var ret, x_pos + ret = x > uint_max || x < 0 ? (x_pos = Math.abs(x) % uint_max, x < 0 ? uint_max - x_pos : x_pos) : x + return ret +} +function scrub_vec (v) { + for (var i = 0; i < v.length; v++) { + v[i] = 0 + } + return false +} - /** - * The username of the connection account - * @type {string} - */ - this.name = data.name; +function Global () { + this.SBOX = [] + this.INV_SBOX = [] + this.SUB_MIX = [[], [], [], []] + this.INV_SUB_MIX = [[], [], [], []] + this.init() + this.RCON = [0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36] +} - /** - * The id of the connection account - * @type {string} - */ - this.id = data.id; +Global.prototype.init = function () { + var d, i, sx, t, x, x2, x4, x8, xi, _i + d = (function () { + var _i, _results + _results = [] + for (i = _i = 0; _i < 256; i = ++_i) { + if (i < 128) { + _results.push(i << 1) + } else { + _results.push((i << 1) ^ 0x11b) + } + } + return _results + })() + x = 0 + xi = 0 + for (i = _i = 0; _i < 256; i = ++_i) { + sx = xi ^ (xi << 1) ^ (xi << 2) ^ (xi << 3) ^ (xi << 4) + sx = (sx >>> 8) ^ (sx & 0xff) ^ 0x63 + this.SBOX[x] = sx + this.INV_SBOX[sx] = x + x2 = d[x] + x4 = d[x2] + x8 = d[x4] + t = (d[sx] * 0x101) ^ (sx * 0x1010100) + this.SUB_MIX[0][x] = (t << 24) | (t >>> 8) + this.SUB_MIX[1][x] = (t << 16) | (t >>> 16) + this.SUB_MIX[2][x] = (t << 8) | (t >>> 24) + this.SUB_MIX[3][x] = t + t = (x8 * 0x1010101) ^ (x4 * 0x10001) ^ (x2 * 0x101) ^ (x * 0x1010100) + this.INV_SUB_MIX[0][sx] = (t << 24) | (t >>> 8) + this.INV_SUB_MIX[1][sx] = (t << 16) | (t >>> 16) + this.INV_SUB_MIX[2][sx] = (t << 8) | (t >>> 24) + this.INV_SUB_MIX[3][sx] = t + if (x === 0) { + x = xi = 1 + } else { + x = x2 ^ d[d[d[x8 ^ x2]]] + xi ^= d[d[xi]] + } + } + return true +} - /** - * Whether the connection is revoked - * @type {Boolean} - */ - this.revoked = data.revoked; +var G = new Global() - /** - * an array of partial server integrations (not yet implemented in this lib) - * @type {Object[]} - */ - this.integrations = data.integrations; - } - } +AES.blockSize = 4 * 4 - module.exports = UserConnection; +AES.prototype.blockSize = AES.blockSize +AES.keySize = 256 / 8 + +AES.prototype.keySize = AES.keySize + +function bufferToArray (buf) { + var len = buf.length / 4 + var out = new Array(len) + var i = -1 + while (++i < len) { + out[i] = buf.readUInt32BE(i * 4) + } + return out +} +function AES (key) { + this._key = bufferToArray(key) + this._doReset() +} + +AES.prototype._doReset = function () { + var invKsRow, keySize, keyWords, ksRow, ksRows, t + keyWords = this._key + keySize = keyWords.length + this._nRounds = keySize + 6 + ksRows = (this._nRounds + 1) * 4 + this._keySchedule = [] + for (ksRow = 0; ksRow < ksRows; ksRow++) { + this._keySchedule[ksRow] = ksRow < keySize ? keyWords[ksRow] : (t = this._keySchedule[ksRow - 1], (ksRow % keySize) === 0 ? (t = (t << 8) | (t >>> 24), t = (G.SBOX[t >>> 24] << 24) | (G.SBOX[(t >>> 16) & 0xff] << 16) | (G.SBOX[(t >>> 8) & 0xff] << 8) | G.SBOX[t & 0xff], t ^= G.RCON[(ksRow / keySize) | 0] << 24) : keySize > 6 && ksRow % keySize === 4 ? t = (G.SBOX[t >>> 24] << 24) | (G.SBOX[(t >>> 16) & 0xff] << 16) | (G.SBOX[(t >>> 8) & 0xff] << 8) | G.SBOX[t & 0xff] : void 0, this._keySchedule[ksRow - keySize] ^ t) + } + this._invKeySchedule = [] + for (invKsRow = 0; invKsRow < ksRows; invKsRow++) { + ksRow = ksRows - invKsRow + t = this._keySchedule[ksRow - (invKsRow % 4 ? 0 : 4)] + this._invKeySchedule[invKsRow] = invKsRow < 4 || ksRow <= 4 ? t : G.INV_SUB_MIX[0][G.SBOX[t >>> 24]] ^ G.INV_SUB_MIX[1][G.SBOX[(t >>> 16) & 0xff]] ^ G.INV_SUB_MIX[2][G.SBOX[(t >>> 8) & 0xff]] ^ G.INV_SUB_MIX[3][G.SBOX[t & 0xff]] + } + return true +} + +AES.prototype.encryptBlock = function (M) { + M = bufferToArray(new Buffer(M)) + var out = this._doCryptBlock(M, this._keySchedule, G.SUB_MIX, G.SBOX) + var buf = new Buffer(16) + buf.writeUInt32BE(out[0], 0) + buf.writeUInt32BE(out[1], 4) + buf.writeUInt32BE(out[2], 8) + buf.writeUInt32BE(out[3], 12) + return buf +} + +AES.prototype.decryptBlock = function (M) { + M = bufferToArray(new Buffer(M)) + var temp = [M[3], M[1]] + M[1] = temp[0] + M[3] = temp[1] + var out = this._doCryptBlock(M, this._invKeySchedule, G.INV_SUB_MIX, G.INV_SBOX) + var buf = new Buffer(16) + buf.writeUInt32BE(out[0], 0) + buf.writeUInt32BE(out[3], 4) + buf.writeUInt32BE(out[2], 8) + buf.writeUInt32BE(out[1], 12) + return buf +} + +AES.prototype.scrub = function () { + scrub_vec(this._keySchedule) + scrub_vec(this._invKeySchedule) + scrub_vec(this._key) +} + +AES.prototype._doCryptBlock = function (M, keySchedule, SUB_MIX, SBOX) { + var ksRow, s0, s1, s2, s3, t0, t1, t2, t3 + + s0 = M[0] ^ keySchedule[0] + s1 = M[1] ^ keySchedule[1] + s2 = M[2] ^ keySchedule[2] + s3 = M[3] ^ keySchedule[3] + ksRow = 4 + for (var round = 1; round < this._nRounds; round++) { + t0 = SUB_MIX[0][s0 >>> 24] ^ SUB_MIX[1][(s1 >>> 16) & 0xff] ^ SUB_MIX[2][(s2 >>> 8) & 0xff] ^ SUB_MIX[3][s3 & 0xff] ^ keySchedule[ksRow++] + t1 = SUB_MIX[0][s1 >>> 24] ^ SUB_MIX[1][(s2 >>> 16) & 0xff] ^ SUB_MIX[2][(s3 >>> 8) & 0xff] ^ SUB_MIX[3][s0 & 0xff] ^ keySchedule[ksRow++] + t2 = SUB_MIX[0][s2 >>> 24] ^ SUB_MIX[1][(s3 >>> 16) & 0xff] ^ SUB_MIX[2][(s0 >>> 8) & 0xff] ^ SUB_MIX[3][s1 & 0xff] ^ keySchedule[ksRow++] + t3 = SUB_MIX[0][s3 >>> 24] ^ SUB_MIX[1][(s0 >>> 16) & 0xff] ^ SUB_MIX[2][(s1 >>> 8) & 0xff] ^ SUB_MIX[3][s2 & 0xff] ^ keySchedule[ksRow++] + s0 = t0 + s1 = t1 + s2 = t2 + s3 = t3 + } + t0 = ((SBOX[s0 >>> 24] << 24) | (SBOX[(s1 >>> 16) & 0xff] << 16) | (SBOX[(s2 >>> 8) & 0xff] << 8) | SBOX[s3 & 0xff]) ^ keySchedule[ksRow++] + t1 = ((SBOX[s1 >>> 24] << 24) | (SBOX[(s2 >>> 16) & 0xff] << 16) | (SBOX[(s3 >>> 8) & 0xff] << 8) | SBOX[s0 & 0xff]) ^ keySchedule[ksRow++] + t2 = ((SBOX[s2 >>> 24] << 24) | (SBOX[(s3 >>> 16) & 0xff] << 16) | (SBOX[(s0 >>> 8) & 0xff] << 8) | SBOX[s1 & 0xff]) ^ keySchedule[ksRow++] + t3 = ((SBOX[s3 >>> 24] << 24) | (SBOX[(s0 >>> 16) & 0xff] << 16) | (SBOX[(s1 >>> 8) & 0xff] << 8) | SBOX[s2 & 0xff]) ^ keySchedule[ksRow++] + return [ + fixup_uint32(t0), + fixup_uint32(t1), + fixup_uint32(t2), + fixup_uint32(t3) + ] +} + +exports.AES = AES + +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer)) /***/ }, /* 34 */ -/***/ function(module, exports, __webpack_require__) { +/***/ function(module, exports) { - const User = __webpack_require__(13); - const OAuth2Application = __webpack_require__(35); - - /** - * Represents the client's OAuth2 Application - * @extends {OAuth2Application} - */ - class ClientOAuth2Application extends OAuth2Application { - setup(data) { - super.setup(data); - - /** - * The app's flags - * @type {number} - */ - this.flags = data.flags; - - /** - * The app's owner - * @type {User} - */ - this.owner = new User(this.client, data.owner); - } - } - - module.exports = ClientOAuth2Application; +exports['aes-128-ecb'] = { + cipher: 'AES', + key: 128, + iv: 0, + mode: 'ECB', + type: 'block' +} +exports['aes-192-ecb'] = { + cipher: 'AES', + key: 192, + iv: 0, + mode: 'ECB', + type: 'block' +} +exports['aes-256-ecb'] = { + cipher: 'AES', + key: 256, + iv: 0, + mode: 'ECB', + type: 'block' +} +exports['aes-128-cbc'] = { + cipher: 'AES', + key: 128, + iv: 16, + mode: 'CBC', + type: 'block' +} +exports['aes-192-cbc'] = { + cipher: 'AES', + key: 192, + iv: 16, + mode: 'CBC', + type: 'block' +} +exports['aes-256-cbc'] = { + cipher: 'AES', + key: 256, + iv: 16, + mode: 'CBC', + type: 'block' +} +exports['aes128'] = exports['aes-128-cbc'] +exports['aes192'] = exports['aes-192-cbc'] +exports['aes256'] = exports['aes-256-cbc'] +exports['aes-128-cfb'] = { + cipher: 'AES', + key: 128, + iv: 16, + mode: 'CFB', + type: 'stream' +} +exports['aes-192-cfb'] = { + cipher: 'AES', + key: 192, + iv: 16, + mode: 'CFB', + type: 'stream' +} +exports['aes-256-cfb'] = { + cipher: 'AES', + key: 256, + iv: 16, + mode: 'CFB', + type: 'stream' +} +exports['aes-128-cfb8'] = { + cipher: 'AES', + key: 128, + iv: 16, + mode: 'CFB8', + type: 'stream' +} +exports['aes-192-cfb8'] = { + cipher: 'AES', + key: 192, + iv: 16, + mode: 'CFB8', + type: 'stream' +} +exports['aes-256-cfb8'] = { + cipher: 'AES', + key: 256, + iv: 16, + mode: 'CFB8', + type: 'stream' +} +exports['aes-128-cfb1'] = { + cipher: 'AES', + key: 128, + iv: 16, + mode: 'CFB1', + type: 'stream' +} +exports['aes-192-cfb1'] = { + cipher: 'AES', + key: 192, + iv: 16, + mode: 'CFB1', + type: 'stream' +} +exports['aes-256-cfb1'] = { + cipher: 'AES', + key: 256, + iv: 16, + mode: 'CFB1', + type: 'stream' +} +exports['aes-128-ofb'] = { + cipher: 'AES', + key: 128, + iv: 16, + mode: 'OFB', + type: 'stream' +} +exports['aes-192-ofb'] = { + cipher: 'AES', + key: 192, + iv: 16, + mode: 'OFB', + type: 'stream' +} +exports['aes-256-ofb'] = { + cipher: 'AES', + key: 256, + iv: 16, + mode: 'OFB', + type: 'stream' +} +exports['aes-128-ctr'] = { + cipher: 'AES', + key: 128, + iv: 16, + mode: 'CTR', + type: 'stream' +} +exports['aes-192-ctr'] = { + cipher: 'AES', + key: 192, + iv: 16, + mode: 'CTR', + type: 'stream' +} +exports['aes-256-ctr'] = { + cipher: 'AES', + key: 256, + iv: 16, + mode: 'CTR', + type: 'stream' +} +exports['aes-128-gcm'] = { + cipher: 'AES', + key: 128, + iv: 12, + mode: 'GCM', + type: 'auth' +} +exports['aes-192-gcm'] = { + cipher: 'AES', + key: 192, + iv: 12, + mode: 'GCM', + type: 'auth' +} +exports['aes-256-gcm'] = { + cipher: 'AES', + key: 256, + iv: 12, + mode: 'GCM', + type: 'auth' +} /***/ }, /* 35 */ -/***/ function(module, exports) { +/***/ function(module, exports, __webpack_require__) { - /** - * Represents an OAuth2 Application - */ - class OAuth2Application { - constructor(client, data) { - /** - * The client that instantiated the application - * @type {Client} - */ - this.client = client; - Object.defineProperty(this, 'client', { enumerable: false, configurable: false }); +/* WEBPACK VAR INJECTION */(function(Buffer) {var xor = __webpack_require__(24) - this.setup(data); - } +function incr32 (iv) { + var len = iv.length + var item + while (len--) { + item = iv.readUInt8(len) + if (item === 255) { + iv.writeUInt8(0, len) + } else { + item++ + iv.writeUInt8(item, len) + break + } + } +} - setup(data) { - /** - * The ID of the app - * @type {string} - */ - this.id = data.id; +function getBlock (self) { + var out = self._cipher.encryptBlock(self._prev) + incr32(self._prev) + return out +} - /** - * The name of the app - * @type {string} - */ - this.name = data.name; - - /** - * The app's description - * @type {string} - */ - this.description = data.description; - - /** - * The app's icon hash - * @type {string} - */ - this.icon = data.icon; - - /** - * The app's icon URL - * @type {string} - */ - this.iconURL = `https://cdn.discordapp.com/app-icons/${this.id}/${this.icon}.jpg`; - - /** - * The app's RPC origins - * @type {Array} - */ - this.rpcOrigins = data.rpc_origins; - } - - /** - * The timestamp the app was created at - * @type {number} - * @readonly - */ - get createdTimestamp() { - return (this.id / 4194304) + 1420070400000; - } - - /** - * The time the app was created - * @type {Date} - * @readonly - */ - get createdAt() { - return new Date(this.createdTimestamp); - } - - /** - * When concatenated with a string, this automatically concatenates the app name rather than the app object. - * @returns {string} - */ - toString() { - return this.name; - } - } - - module.exports = OAuth2Application; +exports.encrypt = function (self, chunk) { + while (self._cache.length < chunk.length) { + self._cache = Buffer.concat([self._cache, getBlock(self)]) + } + var pad = self._cache.slice(0, chunk.length) + self._cache = self._cache.slice(chunk.length) + return xor(chunk, pad) +} +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer)) /***/ }, /* 36 */ /***/ function(module, exports, __webpack_require__) { - const RequestHandler = __webpack_require__(37); +"use strict"; +'use strict'; - /** - * Handles API Requests sequentially, i.e. we wait until the current request is finished before moving onto - * the next. This plays a _lot_ nicer in terms of avoiding 429's when there is more than one session of the account, - * but it can be slower. - * @extends {RequestHandler} - * @private - */ - class SequentialRequestHandler extends RequestHandler { - /** - * @param {RESTManager} restManager The REST manager to use - * @param {string} endpoint The endpoint to handle - */ - constructor(restManager, endpoint) { - super(restManager, endpoint); +var curve = exports; - /** - * Whether this rate limiter is waiting for a response from a request - * @type {boolean} - */ - this.waiting = false; - - /** - * The endpoint that this handler is handling - * @type {string} - */ - this.endpoint = endpoint; - - /** - * The time difference between Discord's Dates and the local computer's Dates. A positive number means the local - * computer's time is ahead of Discord's. - * @type {number} - */ - this.timeDifference = 0; - } - - push(request) { - super.push(request); - this.handle(); - } - - /** - * Performs a request then resolves a promise to indicate its readiness for a new request - * @param {APIRequest} item The item to execute - * @returns {Promise} - */ - execute(item) { - return new Promise(resolve => { - item.request.gen().end((err, res) => { - if (res && res.headers) { - this.requestLimit = res.headers['x-ratelimit-limit']; - this.requestResetTime = Number(res.headers['x-ratelimit-reset']) * 1000; - this.requestRemaining = Number(res.headers['x-ratelimit-remaining']); - this.timeDifference = Date.now() - new Date(res.headers.date).getTime(); - } - if (err) { - if (err.status === 429) { - this.restManager.client.setTimeout(() => { - this.waiting = false; - this.globalLimit = false; - resolve(); - }, Number(res.headers['retry-after']) + 500); - if (res.headers['x-ratelimit-global']) { - this.globalLimit = true; - } - } else { - this.queue.shift(); - this.waiting = false; - item.reject(err); - resolve(err); - } - } else { - this.queue.shift(); - this.globalLimit = false; - const data = res && res.body ? res.body : {}; - item.resolve(data); - if (this.requestRemaining === 0) { - this.restManager.client.setTimeout(() => { - this.waiting = false; - resolve(data); - }, (this.requestResetTime - Date.now()) + this.timeDifference + 1000); - } else { - this.waiting = false; - resolve(data); - } - } - }); - }); - } - - handle() { - super.handle(); - - if (this.waiting || this.queue.length === 0 || this.globalLimit) return; - this.waiting = true; - - const item = this.queue[0]; - this.execute(item).then(() => this.handle()); - } - } - - module.exports = SequentialRequestHandler; +curve.base = __webpack_require__(177); +curve.short = __webpack_require__(180); +curve.mont = __webpack_require__(179); +curve.edwards = __webpack_require__(178); /***/ }, /* 37 */ -/***/ function(module, exports) { +/***/ function(module, exports, __webpack_require__) { - /** - * A base class for different types of rate limiting handlers for the REST API. - * @private - */ - class RequestHandler { - /** - * @param {RESTManager} restManager The REST manager to use - */ - constructor(restManager) { - /** - * The RESTManager that instantiated this RequestHandler - * @type {RESTManager} - */ - this.restManager = restManager; - - /** - * A list of requests that have yet to be processed. - * @type {APIRequest[]} - */ - this.queue = []; - } - - /** - * Whether or not the client is being rate limited on every endpoint. - * @type {boolean} - */ - get globalLimit() { - return this.restManager.globallyRateLimited; - } - - set globalLimit(value) { - this.restManager.globallyRateLimited = value; - } - - /** - * Push a new API request into this bucket - * @param {APIRequest} request The new request to push into the queue - */ - push(request) { - this.queue.push(request); - } - - /** - * Attempts to get this RequestHandler to process its current queue - */ - handle() { - return; - } - } - - module.exports = RequestHandler; +/* WEBPACK VAR INJECTION */(function(Buffer) {var md5 = __webpack_require__(98) +module.exports = EVP_BytesToKey +function EVP_BytesToKey (password, salt, keyLen, ivLen) { + if (!Buffer.isBuffer(password)) { + password = new Buffer(password, 'binary') + } + if (salt && !Buffer.isBuffer(salt)) { + salt = new Buffer(salt, 'binary') + } + keyLen = keyLen / 8 + ivLen = ivLen || 0 + var ki = 0 + var ii = 0 + var key = new Buffer(keyLen) + var iv = new Buffer(ivLen) + var addmd = 0 + var md_buf + var i + var bufs = [] + while (true) { + if (addmd++ > 0) { + bufs.push(md_buf) + } + bufs.push(password) + if (salt) { + bufs.push(salt) + } + md_buf = md5(Buffer.concat(bufs)) + bufs = [] + i = 0 + if (keyLen > 0) { + while (true) { + if (keyLen === 0) { + break + } + if (i === md_buf.length) { + break + } + key[ki++] = md_buf[i] + keyLen-- + i++ + } + } + if (ivLen > 0 && i !== md_buf.length) { + while (true) { + if (ivLen === 0) { + break + } + if (i === md_buf.length) { + break + } + iv[ii++] = md_buf[i] + ivLen-- + i++ + } + } + if (keyLen === 0 && ivLen === 0) { + break + } + } + for (i = 0; i < md_buf.length; i++) { + md_buf[i] = 0 + } + return { + key: key, + iv: iv + } +} +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer)) /***/ }, /* 38 */ -/***/ function(module, exports, __webpack_require__) { +/***/ function(module, exports) { - const RequestHandler = __webpack_require__(37); +"use strict"; +'use strict'; - class BurstRequestHandler extends RequestHandler { - constructor(restManager, endpoint) { - super(restManager, endpoint); - this.requestRemaining = 1; - this.first = true; - } - push(request) { - super.push(request); - this.handle(); - } +var TYPED_OK = (typeof Uint8Array !== 'undefined') && + (typeof Uint16Array !== 'undefined') && + (typeof Int32Array !== 'undefined'); - handleNext(time) { - if (this.waiting) return; - this.waiting = true; - this.restManager.client.setTimeout(() => { - this.requestRemaining = this.requestLimit; - this.waiting = false; - this.handle(); - }, time); - } - execute(item) { - item.request.gen().end((err, res) => { - if (res && res.headers) { - this.requestLimit = res.headers['x-ratelimit-limit']; - this.requestResetTime = Number(res.headers['x-ratelimit-reset']) * 1000; - this.requestRemaining = Number(res.headers['x-ratelimit-remaining']); - this.timeDifference = Date.now() - new Date(res.headers.date).getTime(); - this.handleNext((this.requestResetTime - Date.now()) + this.timeDifference + 1000); - } - if (err) { - if (err.status === 429) { - this.requestRemaining = 0; - this.queue.unshift(item); - this.restManager.client.setTimeout(() => { - this.globalLimit = false; - this.handle(); - }, Number(res.headers['retry-after']) + 500); - if (res.headers['x-ratelimit-global']) { - this.globalLimit = true; - } - } else { - item.reject(err); - } - } else { - this.globalLimit = false; - const data = res && res.body ? res.body : {}; - item.resolve(data); - if (this.first) { - this.first = false; - this.handle(); - } - } - }); - } +exports.assign = function (obj /*from1, from2, from3, ...*/) { + var sources = Array.prototype.slice.call(arguments, 1); + while (sources.length) { + var source = sources.shift(); + if (!source) { continue; } - handle() { - super.handle(); - if (this.requestRemaining < 1 || this.queue.length === 0 || this.globalLimit) return; - while (this.queue.length > 0 && this.requestRemaining > 0) { - this.execute(this.queue.shift()); - this.requestRemaining--; - } - } - } + if (typeof source !== 'object') { + throw new TypeError(source + 'must be non-object'); + } - module.exports = BurstRequestHandler; + for (var p in source) { + if (source.hasOwnProperty(p)) { + obj[p] = source[p]; + } + } + } + + return obj; +}; + + +// reduce buffer size, avoiding mem copy +exports.shrinkBuf = function (buf, size) { + if (buf.length === size) { return buf; } + if (buf.subarray) { return buf.subarray(0, size); } + buf.length = size; + return buf; +}; + + +var fnTyped = { + arraySet: function (dest, src, src_offs, len, dest_offs) { + if (src.subarray && dest.subarray) { + dest.set(src.subarray(src_offs, src_offs + len), dest_offs); + return; + } + // Fallback to ordinary array + for (var i = 0; i < len; i++) { + dest[dest_offs + i] = src[src_offs + i]; + } + }, + // Join array of chunks to single array. + flattenChunks: function (chunks) { + var i, l, len, pos, chunk, result; + + // calculate data length + len = 0; + for (i = 0, l = chunks.length; i < l; i++) { + len += chunks[i].length; + } + + // join chunks + result = new Uint8Array(len); + pos = 0; + for (i = 0, l = chunks.length; i < l; i++) { + chunk = chunks[i]; + result.set(chunk, pos); + pos += chunk.length; + } + + return result; + } +}; + +var fnUntyped = { + arraySet: function (dest, src, src_offs, len, dest_offs) { + for (var i = 0; i < len; i++) { + dest[dest_offs + i] = src[src_offs + i]; + } + }, + // Join array of chunks to single array. + flattenChunks: function (chunks) { + return [].concat.apply([], chunks); + } +}; + + +// Enable/Disable typed arrays use, for testing +// +exports.setTyped = function (on) { + if (on) { + exports.Buf8 = Uint8Array; + exports.Buf16 = Uint16Array; + exports.Buf32 = Int32Array; + exports.assign(exports, fnTyped); + } else { + exports.Buf8 = Array; + exports.Buf16 = Array; + exports.Buf32 = Array; + exports.assign(exports, fnUntyped); + } +}; + +exports.setTyped(TYPED_OK); /***/ }, /* 39 */ /***/ function(module, exports, __webpack_require__) { - const request = __webpack_require__(40); - const Constants = __webpack_require__(5); +/* WEBPACK VAR INJECTION */(function(Buffer) {var asn1 = __webpack_require__(212) +var aesid = __webpack_require__(202) +var fixProc = __webpack_require__(213) +var ciphers = __webpack_require__(47) +var compat = __webpack_require__(108) +module.exports = parseKeys - function getRoute(url) { - let route = url.split('?')[0]; - if (route.includes('/channels/') || route.includes('/guilds/')) { - const startInd = ~route.indexOf('/channels/') ? route.indexOf('/channels/') : route.indexOf('/guilds/'); - const majorID = route.substring(startInd).split('/')[2]; - route = route.replace(/(\d{8,})/g, ':id').replace(':id', majorID); - } - return route; - } +function parseKeys (buffer) { + var password + if (typeof buffer === 'object' && !Buffer.isBuffer(buffer)) { + password = buffer.passphrase + buffer = buffer.key + } + if (typeof buffer === 'string') { + buffer = new Buffer(buffer) + } - class APIRequest { - constructor(rest, method, url, auth, data, file) { - this.rest = rest; - this.method = method; - this.url = url; - this.auth = auth; - this.data = data; - this.file = file; - this.route = getRoute(this.url); - } + var stripped = fixProc(buffer, password) - getAuth() { - if (this.rest.client.token && this.rest.client.user && this.rest.client.user.bot) { - return `Bot ${this.rest.client.token}`; - } else if (this.rest.client.token) { - return this.rest.client.token; - } - throw new Error(Constants.Errors.NO_TOKEN); - } - - gen() { - const apiRequest = request[this.method](this.url); - if (this.auth) apiRequest.set('authorization', this.getAuth()); - if (this.file && this.file.file) { - apiRequest.attach('file', this.file.file, this.file.name); - this.data = this.data || {}; - for (const key in this.data) { - if (this.data[key]) { - apiRequest.field(key, this.data[key]); - } - } - } else if (this.data) { - apiRequest.send(this.data); - } - apiRequest.set('User-Agent', this.rest.userAgentManager.userAgent); - return apiRequest; - } - } - - module.exports = APIRequest; + var type = stripped.tag + var data = stripped.data + var subtype, ndata + switch (type) { + case 'PUBLIC KEY': + ndata = asn1.PublicKey.decode(data, 'der') + subtype = ndata.algorithm.algorithm.join('.') + switch (subtype) { + case '1.2.840.113549.1.1.1': + return asn1.RSAPublicKey.decode(ndata.subjectPublicKey.data, 'der') + case '1.2.840.10045.2.1': + ndata.subjectPrivateKey = ndata.subjectPublicKey + return { + type: 'ec', + data: ndata + } + case '1.2.840.10040.4.1': + ndata.algorithm.params.pub_key = asn1.DSAparam.decode(ndata.subjectPublicKey.data, 'der') + return { + type: 'dsa', + data: ndata.algorithm.params + } + default: throw new Error('unknown key id ' + subtype) + } + throw new Error('unknown key type ' + type) + case 'ENCRYPTED PRIVATE KEY': + data = asn1.EncryptedPrivateKey.decode(data, 'der') + data = decrypt(data, password) + // falls through + case 'PRIVATE KEY': + ndata = asn1.PrivateKey.decode(data, 'der') + subtype = ndata.algorithm.algorithm.join('.') + switch (subtype) { + case '1.2.840.113549.1.1.1': + return asn1.RSAPrivateKey.decode(ndata.subjectPrivateKey, 'der') + case '1.2.840.10045.2.1': + return { + curve: ndata.algorithm.curve, + privateKey: asn1.ECPrivateKey.decode(ndata.subjectPrivateKey, 'der').privateKey + } + case '1.2.840.10040.4.1': + ndata.algorithm.params.priv_key = asn1.DSAparam.decode(ndata.subjectPrivateKey, 'der') + return { + type: 'dsa', + params: ndata.algorithm.params + } + default: throw new Error('unknown key id ' + subtype) + } + throw new Error('unknown key type ' + type) + case 'RSA PUBLIC KEY': + return asn1.RSAPublicKey.decode(data, 'der') + case 'RSA PRIVATE KEY': + return asn1.RSAPrivateKey.decode(data, 'der') + case 'DSA PRIVATE KEY': + return { + type: 'dsa', + params: asn1.DSAPrivateKey.decode(data, 'der') + } + case 'EC PRIVATE KEY': + data = asn1.ECPrivateKey.decode(data, 'der') + return { + curve: data.parameters.value, + privateKey: data.privateKey + } + default: throw new Error('unknown key type ' + type) + } +} +parseKeys.signature = asn1.signature +function decrypt (data, password) { + var salt = data.algorithm.decrypt.kde.kdeparams.salt + var iters = parseInt(data.algorithm.decrypt.kde.kdeparams.iters.toString(), 10) + var algo = aesid[data.algorithm.decrypt.cipher.algo.join('.')] + var iv = data.algorithm.decrypt.cipher.iv + var cipherText = data.subjectPrivateKey + var keylen = parseInt(algo.split('-')[1], 10) / 8 + var key = compat.pbkdf2Sync(password, salt, iters, keylen) + var cipher = ciphers.createDecipheriv(algo, key, iv) + var out = [] + out.push(cipher.update(cipherText)) + out.push(cipher.final()) + return Buffer.concat(out) +} +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer)) /***/ }, /* 40 */ /***/ function(module, exports, __webpack_require__) { - /** - * Root reference for iframes. - */ - - var root; - if (typeof window !== 'undefined') { // Browser window - root = window; - } else if (typeof self !== 'undefined') { // Web Worker - root = self; - } else { // Other environments - console.warn("Using browser-only version of superagent in non-browser environment"); - root = this; - } - - var Emitter = __webpack_require__(41); - var RequestBase = __webpack_require__(42); - var isObject = __webpack_require__(43); - - /** - * Noop. - */ - - function noop(){}; - - /** - * Expose `request`. - */ - - var request = module.exports = __webpack_require__(44).bind(null, Request); - - /** - * Determine XHR. - */ - - request.getXHR = function () { - if (root.XMLHttpRequest - && (!root.location || 'file:' != root.location.protocol - || !root.ActiveXObject)) { - return new XMLHttpRequest; - } else { - try { return new ActiveXObject('Microsoft.XMLHTTP'); } catch(e) {} - try { return new ActiveXObject('Msxml2.XMLHTTP.6.0'); } catch(e) {} - try { return new ActiveXObject('Msxml2.XMLHTTP.3.0'); } catch(e) {} - try { return new ActiveXObject('Msxml2.XMLHTTP'); } catch(e) {} - } - throw Error("Browser-only verison of superagent could not find XHR"); - }; - - /** - * Removes leading and trailing whitespace, added to support IE. - * - * @param {String} s - * @return {String} - * @api private - */ - - var trim = ''.trim - ? function(s) { return s.trim(); } - : function(s) { return s.replace(/(^\s*|\s*$)/g, ''); }; - - /** - * Serialize the given `obj`. - * - * @param {Object} obj - * @return {String} - * @api private - */ - - function serialize(obj) { - if (!isObject(obj)) return obj; - var pairs = []; - for (var key in obj) { - pushEncodedKeyValuePair(pairs, key, obj[key]); - } - return pairs.join('&'); - } - - /** - * Helps 'serialize' with serializing arrays. - * Mutates the pairs array. - * - * @param {Array} pairs - * @param {String} key - * @param {Mixed} val - */ - - function pushEncodedKeyValuePair(pairs, key, val) { - if (val != null) { - if (Array.isArray(val)) { - val.forEach(function(v) { - pushEncodedKeyValuePair(pairs, key, v); - }); - } else if (isObject(val)) { - for(var subkey in val) { - pushEncodedKeyValuePair(pairs, key + '[' + subkey + ']', val[subkey]); - } - } else { - pairs.push(encodeURIComponent(key) - + '=' + encodeURIComponent(val)); - } - } else if (val === null) { - pairs.push(encodeURIComponent(key)); - } - } - - /** - * Expose serialization method. - */ - - request.serializeObject = serialize; - - /** - * Parse the given x-www-form-urlencoded `str`. - * - * @param {String} str - * @return {Object} - * @api private - */ - - function parseString(str) { - var obj = {}; - var pairs = str.split('&'); - var pair; - var pos; - - for (var i = 0, len = pairs.length; i < len; ++i) { - pair = pairs[i]; - pos = pair.indexOf('='); - if (pos == -1) { - obj[decodeURIComponent(pair)] = ''; - } else { - obj[decodeURIComponent(pair.slice(0, pos))] = - decodeURIComponent(pair.slice(pos + 1)); - } - } - - return obj; - } - - /** - * Expose parser. - */ - - request.parseString = parseString; - - /** - * Default MIME type map. - * - * superagent.types.xml = 'application/xml'; - * - */ - - request.types = { - html: 'text/html', - json: 'application/json', - xml: 'application/xml', - urlencoded: 'application/x-www-form-urlencoded', - 'form': 'application/x-www-form-urlencoded', - 'form-data': 'application/x-www-form-urlencoded' - }; - - /** - * Default serialization map. - * - * superagent.serialize['application/xml'] = function(obj){ - * return 'generated xml here'; - * }; - * - */ - - request.serialize = { - 'application/x-www-form-urlencoded': serialize, - 'application/json': JSON.stringify - }; - - /** - * Default parsers. - * - * superagent.parse['application/xml'] = function(str){ - * return { object parsed from str }; - * }; - * - */ - - request.parse = { - 'application/x-www-form-urlencoded': parseString, - 'application/json': JSON.parse - }; - - /** - * Parse the given header `str` into - * an object containing the mapped fields. - * - * @param {String} str - * @return {Object} - * @api private - */ - - function parseHeader(str) { - var lines = str.split(/\r?\n/); - var fields = {}; - var index; - var line; - var field; - var val; - - lines.pop(); // trailing CRLF - - for (var i = 0, len = lines.length; i < len; ++i) { - line = lines[i]; - index = line.indexOf(':'); - field = line.slice(0, index).toLowerCase(); - val = trim(line.slice(index + 1)); - fields[field] = val; - } - - return fields; - } - - /** - * Check if `mime` is json or has +json structured syntax suffix. - * - * @param {String} mime - * @return {Boolean} - * @api private - */ - - function isJSON(mime) { - return /[\/+]json\b/.test(mime); - } - - /** - * Return the mime type for the given `str`. - * - * @param {String} str - * @return {String} - * @api private - */ - - function type(str){ - return str.split(/ *; */).shift(); - }; - - /** - * Return header field parameters. - * - * @param {String} str - * @return {Object} - * @api private - */ - - function params(str){ - return str.split(/ *; */).reduce(function(obj, str){ - var parts = str.split(/ *= */), - key = parts.shift(), - val = parts.shift(); - - if (key && val) obj[key] = val; - return obj; - }, {}); - }; - - /** - * Initialize a new `Response` with the given `xhr`. - * - * - set flags (.ok, .error, etc) - * - parse header - * - * Examples: - * - * Aliasing `superagent` as `request` is nice: - * - * request = superagent; - * - * We can use the promise-like API, or pass callbacks: - * - * request.get('/').end(function(res){}); - * request.get('/', function(res){}); - * - * Sending data can be chained: - * - * request - * .post('/user') - * .send({ name: 'tj' }) - * .end(function(res){}); - * - * Or passed to `.send()`: - * - * request - * .post('/user') - * .send({ name: 'tj' }, function(res){}); - * - * Or passed to `.post()`: - * - * request - * .post('/user', { name: 'tj' }) - * .end(function(res){}); - * - * Or further reduced to a single call for simple cases: - * - * request - * .post('/user', { name: 'tj' }, function(res){}); - * - * @param {XMLHTTPRequest} xhr - * @param {Object} options - * @api private - */ - - function Response(req, options) { - options = options || {}; - this.req = req; - this.xhr = this.req.xhr; - // responseText is accessible only if responseType is '' or 'text' and on older browsers - this.text = ((this.req.method !='HEAD' && (this.xhr.responseType === '' || this.xhr.responseType === 'text')) || typeof this.xhr.responseType === 'undefined') - ? this.xhr.responseText - : null; - this.statusText = this.req.xhr.statusText; - this._setStatusProperties(this.xhr.status); - this.header = this.headers = parseHeader(this.xhr.getAllResponseHeaders()); - // getAllResponseHeaders sometimes falsely returns "" for CORS requests, but - // getResponseHeader still works. so we get content-type even if getting - // other headers fails. - this.header['content-type'] = this.xhr.getResponseHeader('content-type'); - this._setHeaderProperties(this.header); - this.body = this.req.method != 'HEAD' - ? this._parseBody(this.text ? this.text : this.xhr.response) - : null; - } - - /** - * Get case-insensitive `field` value. - * - * @param {String} field - * @return {String} - * @api public - */ - - Response.prototype.get = function(field){ - return this.header[field.toLowerCase()]; - }; - - /** - * Set header related properties: - * - * - `.type` the content type without params - * - * A response of "Content-Type: text/plain; charset=utf-8" - * will provide you with a `.type` of "text/plain". - * - * @param {Object} header - * @api private - */ - - Response.prototype._setHeaderProperties = function(header){ - // content-type - var ct = this.header['content-type'] || ''; - this.type = type(ct); - - // params - var obj = params(ct); - for (var key in obj) this[key] = obj[key]; - }; - - /** - * Parse the given body `str`. - * - * Used for auto-parsing of bodies. Parsers - * are defined on the `superagent.parse` object. - * - * @param {String} str - * @return {Mixed} - * @api private - */ - - Response.prototype._parseBody = function(str){ - var parse = request.parse[this.type]; - if (!parse && isJSON(this.type)) { - parse = request.parse['application/json']; - } - return parse && str && (str.length || str instanceof Object) - ? parse(str) - : null; - }; - - /** - * Set flags such as `.ok` based on `status`. - * - * For example a 2xx response will give you a `.ok` of __true__ - * whereas 5xx will be __false__ and `.error` will be __true__. The - * `.clientError` and `.serverError` are also available to be more - * specific, and `.statusType` is the class of error ranging from 1..5 - * sometimes useful for mapping respond colors etc. - * - * "sugar" properties are also defined for common cases. Currently providing: - * - * - .noContent - * - .badRequest - * - .unauthorized - * - .notAcceptable - * - .notFound - * - * @param {Number} status - * @api private - */ - - Response.prototype._setStatusProperties = function(status){ - // handle IE9 bug: http://stackoverflow.com/questions/10046972/msie-returns-status-code-of-1223-for-ajax-request - if (status === 1223) { - status = 204; - } - - var type = status / 100 | 0; - - // status / class - this.status = this.statusCode = status; - this.statusType = type; - - // basics - this.info = 1 == type; - this.ok = 2 == type; - this.clientError = 4 == type; - this.serverError = 5 == type; - this.error = (4 == type || 5 == type) - ? this.toError() - : false; - - // sugar - this.accepted = 202 == status; - this.noContent = 204 == status; - this.badRequest = 400 == status; - this.unauthorized = 401 == status; - this.notAcceptable = 406 == status; - this.notFound = 404 == status; - this.forbidden = 403 == status; - }; - - /** - * Return an `Error` representative of this response. - * - * @return {Error} - * @api public - */ - - Response.prototype.toError = function(){ - var req = this.req; - var method = req.method; - var url = req.url; - - var msg = 'cannot ' + method + ' ' + url + ' (' + this.status + ')'; - var err = new Error(msg); - err.status = this.status; - err.method = method; - err.url = url; - - return err; - }; - - /** - * Expose `Response`. - */ - - request.Response = Response; - - /** - * Initialize a new `Request` with the given `method` and `url`. - * - * @param {String} method - * @param {String} url - * @api public - */ - - function Request(method, url) { - var self = this; - this._query = this._query || []; - this.method = method; - this.url = url; - this.header = {}; // preserves header name case - this._header = {}; // coerces header names to lowercase - this.on('end', function(){ - var err = null; - var res = null; - - try { - res = new Response(self); - } catch(e) { - err = new Error('Parser is unable to parse the response'); - err.parse = true; - err.original = e; - // issue #675: return the raw response if the response parsing fails - if (self.xhr) { - // ie9 doesn't have 'response' property - err.rawResponse = typeof self.xhr.responseType == 'undefined' ? self.xhr.responseText : self.xhr.response; - // issue #876: return the http status code if the response parsing fails - err.statusCode = self.xhr.status ? self.xhr.status : null; - } else { - err.rawResponse = null; - err.statusCode = null; - } - - return self.callback(err); - } - - self.emit('response', res); - - var new_err; - try { - if (res.status < 200 || res.status >= 300) { - new_err = new Error(res.statusText || 'Unsuccessful HTTP response'); - new_err.original = err; - new_err.response = res; - new_err.status = res.status; - } - } catch(e) { - new_err = e; // #985 touching res may cause INVALID_STATE_ERR on old Android - } - - // #1000 don't catch errors from the callback to avoid double calling it - if (new_err) { - self.callback(new_err, res); - } else { - self.callback(null, res); - } - }); - } - - /** - * Mixin `Emitter` and `RequestBase`. - */ - - Emitter(Request.prototype); - RequestBase(Request.prototype); - - /** - * Set Content-Type to `type`, mapping values from `request.types`. - * - * Examples: - * - * superagent.types.xml = 'application/xml'; - * - * request.post('/') - * .type('xml') - * .send(xmlstring) - * .end(callback); - * - * request.post('/') - * .type('application/xml') - * .send(xmlstring) - * .end(callback); - * - * @param {String} type - * @return {Request} for chaining - * @api public - */ - - Request.prototype.type = function(type){ - this.set('Content-Type', request.types[type] || type); - return this; - }; - - /** - * Set responseType to `val`. Presently valid responseTypes are 'blob' and - * 'arraybuffer'. - * - * Examples: - * - * req.get('/') - * .responseType('blob') - * .end(callback); - * - * @param {String} val - * @return {Request} for chaining - * @api public - */ - - Request.prototype.responseType = function(val){ - this._responseType = val; - return this; - }; - - /** - * Set Accept to `type`, mapping values from `request.types`. - * - * Examples: - * - * superagent.types.json = 'application/json'; - * - * request.get('/agent') - * .accept('json') - * .end(callback); - * - * request.get('/agent') - * .accept('application/json') - * .end(callback); - * - * @param {String} accept - * @return {Request} for chaining - * @api public - */ - - Request.prototype.accept = function(type){ - this.set('Accept', request.types[type] || type); - return this; - }; - - /** - * Set Authorization field value with `user` and `pass`. - * - * @param {String} user - * @param {String} pass - * @param {Object} options with 'type' property 'auto' or 'basic' (default 'basic') - * @return {Request} for chaining - * @api public - */ - - Request.prototype.auth = function(user, pass, options){ - if (!options) { - options = { - type: 'basic' - } - } - - switch (options.type) { - case 'basic': - var str = btoa(user + ':' + pass); - this.set('Authorization', 'Basic ' + str); - break; - - case 'auto': - this.username = user; - this.password = pass; - break; - } - return this; - }; - - /** - * Add query-string `val`. - * - * Examples: - * - * request.get('/shoes') - * .query('size=10') - * .query({ color: 'blue' }) - * - * @param {Object|String} val - * @return {Request} for chaining - * @api public - */ - - Request.prototype.query = function(val){ - if ('string' != typeof val) val = serialize(val); - if (val) this._query.push(val); - return this; - }; - - /** - * Queue the given `file` as an attachment to the specified `field`, - * with optional `options` (or filename). - * - * ``` js - * request.post('/upload') - * .attach('content', new Blob(['hey!'], { type: "text/html"})) - * .end(callback); - * ``` - * - * @param {String} field - * @param {Blob|File} file - * @param {String|Object} options - * @return {Request} for chaining - * @api public - */ - - Request.prototype.attach = function(field, file, options){ - if (this._data) { - throw Error("superagent can't mix .send() and .attach()"); - } - - this._getFormData().append(field, file, options || file.name); - return this; - }; - - Request.prototype._getFormData = function(){ - if (!this._formData) { - this._formData = new root.FormData(); - } - return this._formData; - }; - - /** - * Invoke the callback with `err` and `res` - * and handle arity check. - * - * @param {Error} err - * @param {Response} res - * @api private - */ - - Request.prototype.callback = function(err, res){ - var fn = this._callback; - this.clearTimeout(); - - if (err) { - this.emit('error', err); - } - - fn(err, res); - }; - - /** - * Invoke callback with x-domain error. - * - * @api private - */ - - Request.prototype.crossDomainError = function(){ - var err = new Error('Request has been terminated\nPossible causes: the network is offline, Origin is not allowed by Access-Control-Allow-Origin, the page is being unloaded, etc.'); - err.crossDomain = true; - - err.status = this.status; - err.method = this.method; - err.url = this.url; - - this.callback(err); - }; - - // This only warns, because the request is still likely to work - Request.prototype.buffer = Request.prototype.ca = Request.prototype.agent = function(){ - console.warn("This is not supported in browser version of superagent"); - return this; - }; - - // This throws, because it can't send/receive data as expected - Request.prototype.pipe = Request.prototype.write = function(){ - throw Error("Streaming is not supported in browser version of superagent"); - }; - - /** - * Invoke callback with timeout error. - * - * @api private - */ - - Request.prototype._timeoutError = function(){ - var timeout = this._timeout; - var err = new Error('timeout of ' + timeout + 'ms exceeded'); - err.timeout = timeout; - this.callback(err); - }; - - /** - * Compose querystring to append to req.url - * - * @api private - */ - - Request.prototype._appendQueryString = function(){ - var query = this._query.join('&'); - if (query) { - this.url += ~this.url.indexOf('?') - ? '&' + query - : '?' + query; - } - }; - - /** - * Check if `obj` is a host object, - * we don't want to serialize these :) - * - * @param {Object} obj - * @return {Boolean} - * @api private - */ - Request.prototype._isHost = function _isHost(obj) { - // Native objects stringify to [object File], [object Blob], [object FormData], etc. - return obj && 'object' === typeof obj && !Array.isArray(obj) && Object.prototype.toString.call(obj) !== '[object Object]'; - } - - /** - * Initiate request, invoking callback `fn(res)` - * with an instanceof `Response`. - * - * @param {Function} fn - * @return {Request} for chaining - * @api public - */ - - Request.prototype.end = function(fn){ - var self = this; - var xhr = this.xhr = request.getXHR(); - var timeout = this._timeout; - var data = this._formData || this._data; - - // store callback - this._callback = fn || noop; - - // state change - xhr.onreadystatechange = function(){ - if (4 != xhr.readyState) return; - - // In IE9, reads to any property (e.g. status) off of an aborted XHR will - // result in the error "Could not complete the operation due to error c00c023f" - var status; - try { status = xhr.status } catch(e) { status = 0; } - - if (0 == status) { - if (self.timedout) return self._timeoutError(); - if (self._aborted) return; - return self.crossDomainError(); - } - self.emit('end'); - }; - - // progress - var handleProgress = function(direction, e) { - if (e.total > 0) { - e.percent = e.loaded / e.total * 100; - } - e.direction = direction; - self.emit('progress', e); - } - if (this.hasListeners('progress')) { - try { - xhr.onprogress = handleProgress.bind(null, 'download'); - if (xhr.upload) { - xhr.upload.onprogress = handleProgress.bind(null, 'upload'); - } - } catch(e) { - // Accessing xhr.upload fails in IE from a web worker, so just pretend it doesn't exist. - // Reported here: - // https://connect.microsoft.com/IE/feedback/details/837245/xmlhttprequest-upload-throws-invalid-argument-when-used-from-web-worker-context - } - } - - // timeout - if (timeout && !this._timer) { - this._timer = setTimeout(function(){ - self.timedout = true; - self.abort(); - }, timeout); - } - - // querystring - this._appendQueryString(); - - // initiate request - if (this.username && this.password) { - xhr.open(this.method, this.url, true, this.username, this.password); - } else { - xhr.open(this.method, this.url, true); - } - - // CORS - if (this._withCredentials) xhr.withCredentials = true; - - // body - if ('GET' != this.method && 'HEAD' != this.method && 'string' != typeof data && !this._isHost(data)) { - // serialize stuff - var contentType = this._header['content-type']; - var serialize = this._serializer || request.serialize[contentType ? contentType.split(';')[0] : '']; - if (!serialize && isJSON(contentType)) serialize = request.serialize['application/json']; - if (serialize) data = serialize(data); - } - - // set header fields - for (var field in this.header) { - if (null == this.header[field]) continue; - xhr.setRequestHeader(field, this.header[field]); - } - - if (this._responseType) { - xhr.responseType = this._responseType; - } - - // send stuff - this.emit('request', this); - - // IE11 xhr.send(undefined) sends 'undefined' string as POST payload (instead of nothing) - // We need null here if data is undefined - xhr.send(typeof data !== 'undefined' ? data : null); - return this; - }; - - - /** - * Expose `Request`. - */ - - request.Request = Request; - - /** - * GET `url` with optional callback `fn(res)`. - * - * @param {String} url - * @param {Mixed|Function} [data] or fn - * @param {Function} [fn] - * @return {Request} - * @api public - */ - - request.get = function(url, data, fn){ - var req = request('GET', url); - if ('function' == typeof data) fn = data, data = null; - if (data) req.query(data); - if (fn) req.end(fn); - return req; - }; - - /** - * HEAD `url` with optional callback `fn(res)`. - * - * @param {String} url - * @param {Mixed|Function} [data] or fn - * @param {Function} [fn] - * @return {Request} - * @api public - */ - - request.head = function(url, data, fn){ - var req = request('HEAD', url); - if ('function' == typeof data) fn = data, data = null; - if (data) req.send(data); - if (fn) req.end(fn); - return req; - }; - - /** - * OPTIONS query to `url` with optional callback `fn(res)`. - * - * @param {String} url - * @param {Mixed|Function} [data] or fn - * @param {Function} [fn] - * @return {Request} - * @api public - */ - - request.options = function(url, data, fn){ - var req = request('OPTIONS', url); - if ('function' == typeof data) fn = data, data = null; - if (data) req.send(data); - if (fn) req.end(fn); - return req; - }; - - /** - * DELETE `url` with optional callback `fn(res)`. - * - * @param {String} url - * @param {Function} [fn] - * @return {Request} - * @api public - */ - - function del(url, fn){ - var req = request('DELETE', url); - if (fn) req.end(fn); - return req; - }; - - request['del'] = del; - request['delete'] = del; - - /** - * PATCH `url` with optional `data` and callback `fn(res)`. - * - * @param {String} url - * @param {Mixed} [data] - * @param {Function} [fn] - * @return {Request} - * @api public - */ - - request.patch = function(url, data, fn){ - var req = request('PATCH', url); - if ('function' == typeof data) fn = data, data = null; - if (data) req.send(data); - if (fn) req.end(fn); - return req; - }; - - /** - * POST `url` with optional `data` and callback `fn(res)`. - * - * @param {String} url - * @param {Mixed} [data] - * @param {Function} [fn] - * @return {Request} - * @api public - */ - - request.post = function(url, data, fn){ - var req = request('POST', url); - if ('function' == typeof data) fn = data, data = null; - if (data) req.send(data); - if (fn) req.end(fn); - return req; - }; - - /** - * PUT `url` with optional `data` and callback `fn(res)`. - * - * @param {String} url - * @param {Mixed|Function} [data] or fn - * @param {Function} [fn] - * @return {Request} - * @api public - */ - - request.put = function(url, data, fn){ - var req = request('PUT', url); - if ('function' == typeof data) fn = data, data = null; - if (data) req.send(data); - if (fn) req.end(fn); - return req; - }; - +/* WEBPACK VAR INJECTION */(function(Buffer) { +var zlib = __webpack_require__(97); + +var AVAILABLE_WINDOW_BITS = [8, 9, 10, 11, 12, 13, 14, 15]; +var DEFAULT_WINDOW_BITS = 15; +var DEFAULT_MEM_LEVEL = 8; + +PerMessageDeflate.extensionName = 'permessage-deflate'; + +/** + * Per-message Compression Extensions implementation + */ + +function PerMessageDeflate(options, isServer,maxPayload) { + if (this instanceof PerMessageDeflate === false) { + throw new TypeError("Classes can't be function-called"); + } + + this._options = options || {}; + this._isServer = !!isServer; + this._inflate = null; + this._deflate = null; + this.params = null; + this._maxPayload = maxPayload || 0; +} + +/** + * Create extension parameters offer + * + * @api public + */ + +PerMessageDeflate.prototype.offer = function() { + var params = {}; + if (this._options.serverNoContextTakeover) { + params.server_no_context_takeover = true; + } + if (this._options.clientNoContextTakeover) { + params.client_no_context_takeover = true; + } + if (this._options.serverMaxWindowBits) { + params.server_max_window_bits = this._options.serverMaxWindowBits; + } + if (this._options.clientMaxWindowBits) { + params.client_max_window_bits = this._options.clientMaxWindowBits; + } else if (this._options.clientMaxWindowBits == null) { + params.client_max_window_bits = true; + } + return params; +}; + +/** + * Accept extension offer + * + * @api public + */ + +PerMessageDeflate.prototype.accept = function(paramsList) { + paramsList = this.normalizeParams(paramsList); + + var params; + if (this._isServer) { + params = this.acceptAsServer(paramsList); + } else { + params = this.acceptAsClient(paramsList); + } + + this.params = params; + return params; +}; + +/** + * Releases all resources used by the extension + * + * @api public + */ + +PerMessageDeflate.prototype.cleanup = function() { + if (this._inflate) { + if (this._inflate.writeInProgress) { + this._inflate.pendingClose = true; + } else { + if (this._inflate.close) this._inflate.close(); + this._inflate = null; + } + } + if (this._deflate) { + if (this._deflate.writeInProgress) { + this._deflate.pendingClose = true; + } else { + if (this._deflate.close) this._deflate.close(); + this._deflate = null; + } + } +}; + +/** + * Accept extension offer from client + * + * @api private + */ + +PerMessageDeflate.prototype.acceptAsServer = function(paramsList) { + var accepted = {}; + var result = paramsList.some(function(params) { + accepted = {}; + if (this._options.serverNoContextTakeover === false && params.server_no_context_takeover) { + return; + } + if (this._options.serverMaxWindowBits === false && params.server_max_window_bits) { + return; + } + if (typeof this._options.serverMaxWindowBits === 'number' && + typeof params.server_max_window_bits === 'number' && + this._options.serverMaxWindowBits > params.server_max_window_bits) { + return; + } + if (typeof this._options.clientMaxWindowBits === 'number' && !params.client_max_window_bits) { + return; + } + + if (this._options.serverNoContextTakeover || params.server_no_context_takeover) { + accepted.server_no_context_takeover = true; + } + if (this._options.clientNoContextTakeover) { + accepted.client_no_context_takeover = true; + } + if (this._options.clientNoContextTakeover !== false && params.client_no_context_takeover) { + accepted.client_no_context_takeover = true; + } + if (typeof this._options.serverMaxWindowBits === 'number') { + accepted.server_max_window_bits = this._options.serverMaxWindowBits; + } else if (typeof params.server_max_window_bits === 'number') { + accepted.server_max_window_bits = params.server_max_window_bits; + } + if (typeof this._options.clientMaxWindowBits === 'number') { + accepted.client_max_window_bits = this._options.clientMaxWindowBits; + } else if (this._options.clientMaxWindowBits !== false && typeof params.client_max_window_bits === 'number') { + accepted.client_max_window_bits = params.client_max_window_bits; + } + return true; + }, this); + + if (!result) { + throw new Error('Doesn\'t support the offered configuration'); + } + + return accepted; +}; + +/** + * Accept extension response from server + * + * @api privaye + */ + +PerMessageDeflate.prototype.acceptAsClient = function(paramsList) { + var params = paramsList[0]; + if (this._options.clientNoContextTakeover != null) { + if (this._options.clientNoContextTakeover === false && params.client_no_context_takeover) { + throw new Error('Invalid value for "client_no_context_takeover"'); + } + } + if (this._options.clientMaxWindowBits != null) { + if (this._options.clientMaxWindowBits === false && params.client_max_window_bits) { + throw new Error('Invalid value for "client_max_window_bits"'); + } + if (typeof this._options.clientMaxWindowBits === 'number' && + (!params.client_max_window_bits || params.client_max_window_bits > this._options.clientMaxWindowBits)) { + throw new Error('Invalid value for "client_max_window_bits"'); + } + } + return params; +}; + +/** + * Normalize extensions parameters + * + * @api private + */ + +PerMessageDeflate.prototype.normalizeParams = function(paramsList) { + return paramsList.map(function(params) { + Object.keys(params).forEach(function(key) { + var value = params[key]; + if (value.length > 1) { + throw new Error('Multiple extension parameters for ' + key); + } + + value = value[0]; + + switch (key) { + case 'server_no_context_takeover': + case 'client_no_context_takeover': + if (value !== true) { + throw new Error('invalid extension parameter value for ' + key + ' (' + value + ')'); + } + params[key] = true; + break; + case 'server_max_window_bits': + case 'client_max_window_bits': + if (typeof value === 'string') { + value = parseInt(value, 10); + if (!~AVAILABLE_WINDOW_BITS.indexOf(value)) { + throw new Error('invalid extension parameter value for ' + key + ' (' + value + ')'); + } + } + if (!this._isServer && value === true) { + throw new Error('Missing extension parameter value for ' + key); + } + params[key] = value; + break; + default: + throw new Error('Not defined extension parameter (' + key + ')'); + } + }, this); + return params; + }, this); +}; + +/** + * Decompress message + * + * @api public + */ + +PerMessageDeflate.prototype.decompress = function (data, fin, callback) { + var endpoint = this._isServer ? 'client' : 'server'; + + if (!this._inflate) { + var maxWindowBits = this.params[endpoint + '_max_window_bits']; + this._inflate = zlib.createInflateRaw({ + windowBits: 'number' === typeof maxWindowBits ? maxWindowBits : DEFAULT_WINDOW_BITS + }); + } + this._inflate.writeInProgress = true; + + var self = this; + var buffers = []; + var cumulativeBufferLength=0; + + this._inflate.on('error', onError).on('data', onData); + this._inflate.write(data); + if (fin) { + this._inflate.write(new Buffer([0x00, 0x00, 0xff, 0xff])); + } + this._inflate.flush(function() { + cleanup(); + callback(null, Buffer.concat(buffers)); + }); + + function onError(err) { + cleanup(); + callback(err); + } + + function onData(data) { + if(self._maxPayload!==undefined && self._maxPayload!==null && self._maxPayload>0){ + cumulativeBufferLength+=data.length; + if(cumulativeBufferLength>self._maxPayload){ + buffers=[]; + cleanup(); + var err={type:1009}; + callback(err); + return; + } + } + buffers.push(data); + } + + function cleanup() { + if (!self._inflate) return; + self._inflate.removeListener('error', onError); + self._inflate.removeListener('data', onData); + self._inflate.writeInProgress = false; + if ((fin && self.params[endpoint + '_no_context_takeover']) || self._inflate.pendingClose) { + if (self._inflate.close) self._inflate.close(); + self._inflate = null; + } + } +}; + +/** + * Compress message + * + * @api public + */ + +PerMessageDeflate.prototype.compress = function (data, fin, callback) { + var endpoint = this._isServer ? 'server' : 'client'; + + if (!this._deflate) { + var maxWindowBits = this.params[endpoint + '_max_window_bits']; + this._deflate = zlib.createDeflateRaw({ + flush: zlib.Z_SYNC_FLUSH, + windowBits: 'number' === typeof maxWindowBits ? maxWindowBits : DEFAULT_WINDOW_BITS, + memLevel: this._options.memLevel || DEFAULT_MEM_LEVEL + }); + } + this._deflate.writeInProgress = true; + + var self = this; + var buffers = []; + + this._deflate.on('error', onError).on('data', onData); + this._deflate.write(data); + this._deflate.flush(function() { + cleanup(); + var data = Buffer.concat(buffers); + if (fin) { + data = data.slice(0, data.length - 4); + } + callback(null, data); + }); + + function onError(err) { + cleanup(); + callback(err); + } + + function onData(data) { + buffers.push(data); + } + + function cleanup() { + if (!self._deflate) return; + self._deflate.removeListener('error', onError); + self._deflate.removeListener('data', onData); + self._deflate.writeInProgress = false; + if ((fin && self.params[endpoint + '_no_context_takeover']) || self._deflate.pendingClose) { + if (self._deflate.close) self._deflate.close(); + self._deflate = null; + } + } +}; + +module.exports = PerMessageDeflate; + +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer)) /***/ }, /* 41 */ -/***/ function(module, exports, __webpack_require__) { +/***/ function(module, exports) { - - /** - * Expose `Emitter`. - */ - - if (true) { - module.exports = Emitter; - } - - /** - * Initialize a new `Emitter`. - * - * @api public - */ - - function Emitter(obj) { - if (obj) return mixin(obj); - }; - - /** - * Mixin the emitter properties. - * - * @param {Object} obj - * @return {Object} - * @api private - */ - - function mixin(obj) { - for (var key in Emitter.prototype) { - obj[key] = Emitter.prototype[key]; - } - return obj; - } - - /** - * Listen on the given `event` with `fn`. - * - * @param {String} event - * @param {Function} fn - * @return {Emitter} - * @api public - */ - - Emitter.prototype.on = - Emitter.prototype.addEventListener = function(event, fn){ - this._callbacks = this._callbacks || {}; - (this._callbacks['$' + event] = this._callbacks['$' + event] || []) - .push(fn); - return this; - }; - - /** - * Adds an `event` listener that will be invoked a single - * time then automatically removed. - * - * @param {String} event - * @param {Function} fn - * @return {Emitter} - * @api public - */ - - Emitter.prototype.once = function(event, fn){ - function on() { - this.off(event, on); - fn.apply(this, arguments); - } - - on.fn = fn; - this.on(event, on); - return this; - }; - - /** - * Remove the given callback for `event` or all - * registered callbacks. - * - * @param {String} event - * @param {Function} fn - * @return {Emitter} - * @api public - */ - - Emitter.prototype.off = - Emitter.prototype.removeListener = - Emitter.prototype.removeAllListeners = - Emitter.prototype.removeEventListener = function(event, fn){ - this._callbacks = this._callbacks || {}; - - // all - if (0 == arguments.length) { - this._callbacks = {}; - return this; - } - - // specific event - var callbacks = this._callbacks['$' + event]; - if (!callbacks) return this; - - // remove all handlers - if (1 == arguments.length) { - delete this._callbacks['$' + event]; - return this; - } - - // remove specific handler - var cb; - for (var i = 0; i < callbacks.length; i++) { - cb = callbacks[i]; - if (cb === fn || cb.fn === fn) { - callbacks.splice(i, 1); - break; - } - } - return this; - }; - - /** - * Emit `event` with the given args. - * - * @param {String} event - * @param {Mixed} ... - * @return {Emitter} - */ - - Emitter.prototype.emit = function(event){ - this._callbacks = this._callbacks || {}; - var args = [].slice.call(arguments, 1) - , callbacks = this._callbacks['$' + event]; - - if (callbacks) { - callbacks = callbacks.slice(0); - for (var i = 0, len = callbacks.length; i < len; ++i) { - callbacks[i].apply(this, args); - } - } - - return this; - }; - - /** - * Return array of callbacks for `event`. - * - * @param {String} event - * @return {Array} - * @api public - */ - - Emitter.prototype.listeners = function(event){ - this._callbacks = this._callbacks || {}; - return this._callbacks['$' + event] || []; - }; - - /** - * Check if this emitter has `event` handlers. - * - * @param {String} event - * @return {Boolean} - * @api public - */ - - Emitter.prototype.hasListeners = function(event){ - return !! this.listeners(event).length; - }; +module.exports = function merge(def, given) { + if (!given) return def; + for (const key in def) { + if (!{}.hasOwnProperty.call(given, key)) { + given[key] = def[key]; + } else if (given[key] === Object(given[key])) { + given[key] = merge(def[key], given[key]); + } + } + + return given; +}; /***/ }, /* 42 */ /***/ function(module, exports, __webpack_require__) { - /** - * Module of mixed-in functions shared between node and client code - */ - var isObject = __webpack_require__(43); +const Constants = __webpack_require__(2); - /** - * Expose `RequestBase`. - */ +/** + * The final evaluated permissions for a member in a channel + */ +class EvaluatedPermissions { + constructor(member, raw) { + /** + * The member this permissions refer to + * @type {GuildMember} + */ + this.member = member; - module.exports = RequestBase; + /** + * A number representing the packed permissions + * @type {number} + */ + this.raw = raw; + } - /** - * Initialize a new `RequestBase`. - * - * @api public - */ + /** + * Get an object mapping permission name, e.g. `READ_MESSAGES` to a boolean - whether the user + * can perform this or not. + * @returns {Object} + */ + serialize() { + const serializedPermissions = {}; + for (const permissionName in Constants.PermissionFlags) { + serializedPermissions[permissionName] = this.hasPermission(permissionName); + } + return serializedPermissions; + } - function RequestBase(obj) { - if (obj) return mixin(obj); - } + /** + * Checks whether the user has a certain permission, e.g. `READ_MESSAGES`. + * @param {PermissionResolvable} permission The permission to check for + * @param {boolean} [explicit=false] Whether to require the user to explicitly have the exact permission + * @returns {boolean} + */ + hasPermission(permission, explicit = false) { + permission = this.member.client.resolver.resolvePermission(permission); + if (!explicit && (this.raw & Constants.PermissionFlags.ADMINISTRATOR) > 0) return true; + return (this.raw & permission) > 0; + } - /** - * Mixin the prototype properties. - * - * @param {Object} obj - * @return {Object} - * @api private - */ + /** + * Checks whether the user has all specified permissions. + * @param {PermissionResolvable[]} permissions The permissions to check for + * @param {boolean} [explicit=false] Whether to require the user to explicitly have the exact permissions + * @returns {boolean} + */ + hasPermissions(permissions, explicit = false) { + return permissions.every(p => this.hasPermission(p, explicit)); + } - function mixin(obj) { - for (var key in RequestBase.prototype) { - obj[key] = RequestBase.prototype[key]; - } - return obj; - } + /** + * Checks whether the user has all specified permissions, and lists any missing permissions. + * @param {PermissionResolvable[]} permissions The permissions to check for + * @param {boolean} [explicit=false] Whether to require the user to explicitly have the exact permissions + * @returns {PermissionResolvable[]} + */ + missingPermissions(permissions, explicit = false) { + return permissions.filter(p => !this.hasPermission(p, explicit)); + } +} - /** - * Clear previous timeout. - * - * @return {Request} for chaining - * @api public - */ - - RequestBase.prototype.clearTimeout = function _clearTimeout(){ - this._timeout = 0; - clearTimeout(this._timer); - return this; - }; - - /** - * Override default response body parser - * - * This function will be called to convert incoming data into request.body - * - * @param {Function} - * @api public - */ - - RequestBase.prototype.parse = function parse(fn){ - this._parser = fn; - return this; - }; - - /** - * Override default request body serializer - * - * This function will be called to convert data set via .send or .attach into payload to send - * - * @param {Function} - * @api public - */ - - RequestBase.prototype.serialize = function serialize(fn){ - this._serializer = fn; - return this; - }; - - /** - * Set timeout to `ms`. - * - * @param {Number} ms - * @return {Request} for chaining - * @api public - */ - - RequestBase.prototype.timeout = function timeout(ms){ - this._timeout = ms; - return this; - }; - - /** - * Promise support - * - * @param {Function} resolve - * @param {Function} reject - * @return {Request} - */ - - RequestBase.prototype.then = function then(resolve, reject) { - if (!this._fullfilledPromise) { - var self = this; - this._fullfilledPromise = new Promise(function(innerResolve, innerReject){ - self.end(function(err, res){ - if (err) innerReject(err); else innerResolve(res); - }); - }); - } - return this._fullfilledPromise.then(resolve, reject); - } - - RequestBase.prototype.catch = function(cb) { - return this.then(undefined, cb); - }; - - /** - * Allow for extension - */ - - RequestBase.prototype.use = function use(fn) { - fn(this); - return this; - } - - - /** - * Get request header `field`. - * Case-insensitive. - * - * @param {String} field - * @return {String} - * @api public - */ - - RequestBase.prototype.get = function(field){ - return this._header[field.toLowerCase()]; - }; - - /** - * Get case-insensitive header `field` value. - * This is a deprecated internal API. Use `.get(field)` instead. - * - * (getHeader is no longer used internally by the superagent code base) - * - * @param {String} field - * @return {String} - * @api private - * @deprecated - */ - - RequestBase.prototype.getHeader = RequestBase.prototype.get; - - /** - * Set header `field` to `val`, or multiple fields with one object. - * Case-insensitive. - * - * Examples: - * - * req.get('/') - * .set('Accept', 'application/json') - * .set('X-API-Key', 'foobar') - * .end(callback); - * - * req.get('/') - * .set({ Accept: 'application/json', 'X-API-Key': 'foobar' }) - * .end(callback); - * - * @param {String|Object} field - * @param {String} val - * @return {Request} for chaining - * @api public - */ - - RequestBase.prototype.set = function(field, val){ - if (isObject(field)) { - for (var key in field) { - this.set(key, field[key]); - } - return this; - } - this._header[field.toLowerCase()] = val; - this.header[field] = val; - return this; - }; - - /** - * Remove header `field`. - * Case-insensitive. - * - * Example: - * - * req.get('/') - * .unset('User-Agent') - * .end(callback); - * - * @param {String} field - */ - RequestBase.prototype.unset = function(field){ - delete this._header[field.toLowerCase()]; - delete this.header[field]; - return this; - }; - - /** - * Write the field `name` and `val`, or multiple fields with one object - * for "multipart/form-data" request bodies. - * - * ``` js - * request.post('/upload') - * .field('foo', 'bar') - * .end(callback); - * - * request.post('/upload') - * .field({ foo: 'bar', baz: 'qux' }) - * .end(callback); - * ``` - * - * @param {String|Object} name - * @param {String|Blob|File|Buffer|fs.ReadStream} val - * @return {Request} for chaining - * @api public - */ - RequestBase.prototype.field = function(name, val) { - - // name should be either a string or an object. - if (null === name || undefined === name) { - throw new Error('.field(name, val) name can not be empty'); - } - - if (isObject(name)) { - for (var key in name) { - this.field(key, name[key]); - } - return this; - } - - // val should be defined now - if (null === val || undefined === val) { - throw new Error('.field(name, val) val can not be empty'); - } - this._getFormData().append(name, val); - return this; - }; - - /** - * Abort the request, and clear potential timeout. - * - * @return {Request} - * @api public - */ - RequestBase.prototype.abort = function(){ - if (this._aborted) { - return this; - } - this._aborted = true; - this.xhr && this.xhr.abort(); // browser - this.req && this.req.abort(); // node - this.clearTimeout(); - this.emit('abort'); - return this; - }; - - /** - * Enable transmission of cookies with x-domain requests. - * - * Note that for this to work the origin must not be - * using "Access-Control-Allow-Origin" with a wildcard, - * and also must set "Access-Control-Allow-Credentials" - * to "true". - * - * @api public - */ - - RequestBase.prototype.withCredentials = function(){ - // This is browser-only functionality. Node side is no-op. - this._withCredentials = true; - return this; - }; - - /** - * Set the max redirects to `n`. Does noting in browser XHR implementation. - * - * @param {Number} n - * @return {Request} for chaining - * @api public - */ - - RequestBase.prototype.redirects = function(n){ - this._maxRedirects = n; - return this; - }; - - /** - * Convert to a plain javascript object (not JSON string) of scalar properties. - * Note as this method is designed to return a useful non-this value, - * it cannot be chained. - * - * @return {Object} describing method, url, and data of this request - * @api public - */ - - RequestBase.prototype.toJSON = function(){ - return { - method: this.method, - url: this.url, - data: this._data, - headers: this._header - }; - }; - - - /** - * Send `data` as the request body, defaulting the `.type()` to "json" when - * an object is given. - * - * Examples: - * - * // manual json - * request.post('/user') - * .type('json') - * .send('{"name":"tj"}') - * .end(callback) - * - * // auto json - * request.post('/user') - * .send({ name: 'tj' }) - * .end(callback) - * - * // manual x-www-form-urlencoded - * request.post('/user') - * .type('form') - * .send('name=tj') - * .end(callback) - * - * // auto x-www-form-urlencoded - * request.post('/user') - * .type('form') - * .send({ name: 'tj' }) - * .end(callback) - * - * // defaults to x-www-form-urlencoded - * request.post('/user') - * .send('name=tobi') - * .send('species=ferret') - * .end(callback) - * - * @param {String|Object} data - * @return {Request} for chaining - * @api public - */ - - RequestBase.prototype.send = function(data){ - var isObj = isObject(data); - var type = this._header['content-type']; - - if (isObj && !this._data) { - if (Array.isArray(data)) { - this._data = []; - } else if (!this._isHost(data)) { - this._data = {}; - } - } else if (data && this._data && this._isHost(this._data)) { - throw Error("Can't merge these send calls"); - } - - // merge - if (isObj && isObject(this._data)) { - for (var key in data) { - this._data[key] = data[key]; - } - } else if ('string' == typeof data) { - // default to x-www-form-urlencoded - if (!type) this.type('form'); - type = this._header['content-type']; - if ('application/x-www-form-urlencoded' == type) { - this._data = this._data - ? this._data + '&' + data - : data; - } else { - this._data = (this._data || '') + data; - } - } else { - this._data = data; - } - - if (!isObj || this._isHost(data)) return this; - - // default to json - if (!type) this.type('json'); - return this; - }; +module.exports = EvaluatedPermissions; /***/ }, /* 43 */ -/***/ function(module, exports) { +/***/ function(module, exports, __webpack_require__) { - /** - * Check if `obj` is an object. - * - * @param {Object} obj - * @return {Boolean} - * @api private - */ +const User = __webpack_require__(11); +const Role = __webpack_require__(22); +const Emoji = __webpack_require__(21); +const Presence = __webpack_require__(12).Presence; +const GuildMember = __webpack_require__(30); +const Constants = __webpack_require__(2); +const Collection = __webpack_require__(6); +const cloneObject = __webpack_require__(130); +const arraysEqual = __webpack_require__(60); - function isObject(obj) { - return null !== obj && 'object' === typeof obj; - } +/** + * Represents a guild (or a server) on Discord. + * It's recommended to see if a guild is available before performing operations or reading data from it. You can + * check this with `guild.available`. + */ +class Guild { + constructor(client, data) { + /** + * The Client that created the instance of the the Guild. + * @type {Client} + */ + this.client = client; + Object.defineProperty(this, 'client', { enumerable: false, configurable: false }); - module.exports = isObject; + /** + * A collection of members that are in this guild. The key is the member's ID, the value is the member. + * @type {Collection} + */ + this.members = new Collection(); + + /** + * A collection of channels that are in this guild. The key is the channel's ID, the value is the channel. + * @type {Collection} + */ + this.channels = new Collection(); + + /** + * A collection of roles that are in this guild. The key is the role's ID, the value is the role. + * @type {Collection} + */ + this.roles = new Collection(); + + if (!data) return; + if (data.unavailable) { + /** + * Whether the guild is available to access. If it is not available, it indicates a server outage. + * @type {boolean} + */ + this.available = false; + + /** + * The Unique ID of the Guild, useful for comparisons. + * @type {string} + */ + this.id = data.id; + } else { + this.available = true; + this.setup(data); + } + } + + /** + * Sets up the Guild + * @param {*} data The raw data of the guild + * @private + */ + setup(data) { + /** + * The name of the guild + * @type {string} + */ + this.name = data.name; + + /** + * The hash of the guild icon, or null if there is no icon. + * @type {?string} + */ + this.icon = data.icon; + + /** + * The hash of the guild splash image, or null if no splash (VIP only) + * @type {?string} + */ + this.splash = data.splash; + + /** + * The region the guild is located in + * @type {string} + */ + this.region = data.region; + + /** + * The full amount of members in this guild as of `READY` + * @type {number} + */ + this.memberCount = data.member_count || this.memberCount; + + /** + * Whether the guild is "large" (has more than 250 members) + * @type {boolean} + */ + this.large = data.large || this.large; + + /** + * A collection of presences in this guild + * @type {Collection} + */ + this.presences = new Collection(); + + /** + * An array of guild features. + * @type {Object[]} + */ + this.features = data.features; + + /** + * A collection of emojis that are in this guild. The key is the emoji's ID, the value is the emoji. + * @type {Collection} + */ + this.emojis = new Collection(); + for (const emoji of data.emojis) this.emojis.set(emoji.id, new Emoji(this, emoji)); + + /** + * The time in seconds before a user is counted as "away from keyboard". + * @type {?number} + */ + this.afkTimeout = data.afk_timeout; + + /** + * The ID of the voice channel where AFK members are moved. + * @type {?string} + */ + this.afkChannelID = data.afk_channel_id; + + /** + * Whether embedded images are enabled on this guild. + * @type {boolean} + */ + this.embedEnabled = data.embed_enabled; + + /** + * The verification level of the guild. + * @type {number} + */ + this.verificationLevel = data.verification_level; + + /** + * The timestamp the client user joined the guild at + * @type {number} + */ + this.joinedTimestamp = data.joined_at ? new Date(data.joined_at).getTime() : this.joinedTimestamp; + + this.id = data.id; + this.available = !data.unavailable; + this.features = data.features || this.features || []; + + if (data.members) { + this.members.clear(); + for (const guildUser of data.members) this._addMember(guildUser, false); + } + + if (data.owner_id) { + /** + * The user ID of this guild's owner. + * @type {string} + */ + this.ownerID = data.owner_id; + } + + if (data.channels) { + this.channels.clear(); + for (const channel of data.channels) this.client.dataManager.newChannel(channel, this); + } + + if (data.roles) { + this.roles.clear(); + for (const role of data.roles) { + const newRole = new Role(this, role); + this.roles.set(newRole.id, newRole); + } + } + + if (data.presences) { + for (const presence of data.presences) { + this._setPresence(presence.user.id, presence); + } + } + + this._rawVoiceStates = new Collection(); + if (data.voice_states) { + for (const voiceState of data.voice_states) { + this._rawVoiceStates.set(voiceState.user_id, voiceState); + const member = this.members.get(voiceState.user_id); + if (member) { + member.serverMute = voiceState.mute; + member.serverDeaf = voiceState.deaf; + member.selfMute = voiceState.self_mute; + member.selfDeaf = voiceState.self_deaf; + member.voiceSessionID = voiceState.session_id; + member.voiceChannelID = voiceState.channel_id; + this.channels.get(voiceState.channel_id).members.set(member.user.id, member); + } + } + } + } + + /** + * The timestamp the guild was created at + * @type {number} + * @readonly + */ + get createdTimestamp() { + return (this.id / 4194304) + 1420070400000; + } + + /** + * The time the guild was created + * @type {Date} + * @readonly + */ + get createdAt() { + return new Date(this.createdTimestamp); + } + + /** + * The time the client user joined the guild + * @type {Date} + * @readonly + */ + get joinedAt() { + return new Date(this.joinedTimestamp); + } + + /** + * Gets the URL to this guild's icon (if it has one, otherwise it returns null) + * @type {?string} + * @readonly + */ + get iconURL() { + if (!this.icon) return null; + return Constants.Endpoints.guildIcon(this.id, this.icon); + } + + /** + * The owner of the guild + * @type {GuildMember} + * @readonly + */ + get owner() { + return this.members.get(this.ownerID); + } + + /** + * If the client is connected to any voice channel in this guild, this will be the relevant VoiceConnection. + * @type {?VoiceConnection} + * @readonly + */ + get voiceConnection() { + return this.client.voice.connections.get(this.id) || null; + } + + /** + * The `#general` GuildChannel of the server. + * @type {GuildChannel} + * @readonly + */ + get defaultChannel() { + return this.channels.get(this.id); + } + + /** + * Returns the GuildMember form of a User object, if the user is present in the guild. + * @param {UserResolvable} user The user that you want to obtain the GuildMember of + * @returns {?GuildMember} + * @example + * // get the guild member of a user + * const member = guild.member(message.author); + */ + member(user) { + return this.client.resolver.resolveGuildMember(this, user); + } + + /** + * Fetch a collection of banned users in this guild. + * @returns {Promise>} + */ + fetchBans() { + return this.client.rest.methods.getGuildBans(this); + } + + /** + * Fetch a collection of invites to this guild. Resolves with a collection mapping invites by their codes. + * @returns {Promise>} + */ + fetchInvites() { + return this.client.rest.methods.getGuildInvites(this); + } + + /** + * Fetch all webhooks for the guild. + * @returns {Collection} + */ + fetchWebhooks() { + return this.client.rest.methods.getGuildWebhooks(this); + } + + /** + * Fetch a single guild member from a user. + * @param {UserResolvable} user The user to fetch the member for + * @returns {Promise} + */ + fetchMember(user) { + if (this._fetchWaiter) return Promise.reject(new Error('Already fetching guild members.')); + user = this.client.resolver.resolveUser(user); + if (!user) return Promise.reject(new Error('User is not cached. Use Client.fetchUser first.')); + if (this.members.has(user.id)) return Promise.resolve(this.members.get(user.id)); + return this.client.rest.methods.getGuildMember(this, user); + } + + /** + * Fetches all the members in the guild, even if they are offline. If the guild has less than 250 members, + * this should not be necessary. + * @param {string} [query=''] An optional query to provide when fetching members + * @returns {Promise} + */ + fetchMembers(query = '') { + return new Promise((resolve, reject) => { + if (this._fetchWaiter) throw new Error('Already fetching guild members in ${this.id}.'); + if (this.memberCount === this.members.size) { + resolve(this); + return; + } + this._fetchWaiter = resolve; + this.client.ws.send({ + op: Constants.OPCodes.REQUEST_GUILD_MEMBERS, + d: { + guild_id: this.id, + query, + limit: 0, + }, + }); + this._checkChunks(); + this.client.setTimeout(() => reject(new Error('Members didn\'t arrive in time.')), 120 * 1000); + }); + } + + /** + * The data for editing a guild + * @typedef {Object} GuildEditData + * @property {string} [name] The name of the guild + * @property {string} [region] The region of the guild + * @property {number} [verificationLevel] The verification level of the guild + * @property {ChannelResolvable} [afkChannel] The AFK channel of the guild + * @property {number} [afkTimeout] The AFK timeout of the guild + * @property {Base64Resolvable} [icon] The icon of the guild + * @property {GuildMemberResolvable} [owner] The owner of the guild + * @property {Base64Resolvable} [splash] The splash screen of the guild + */ + + /** + * Updates the Guild with new information - e.g. a new name. + * @param {GuildEditData} data The data to update the guild with + * @returns {Promise} + * @example + * // set the guild name and region + * guild.edit({ + * name: 'Discord Guild', + * region: 'london', + * }) + * .then(updated => console.log(`New guild name ${updated.name} in region ${updated.region}`)) + * .catch(console.error); + */ + edit(data) { + return this.client.rest.methods.updateGuild(this, data); + } + + /** + * Edit the name of the guild. + * @param {string} name The new name of the guild + * @returns {Promise} + * @example + * // edit the guild name + * guild.setName('Discord Guild') + * .then(updated => console.log(`Updated guild name to ${guild.name}`)) + * .catch(console.error); + */ + setName(name) { + return this.edit({ name }); + } + + /** + * Edit the region of the guild. + * @param {string} region The new region of the guild. + * @returns {Promise} + * @example + * // edit the guild region + * guild.setRegion('london') + * .then(updated => console.log(`Updated guild region to ${guild.region}`)) + * .catch(console.error); + */ + setRegion(region) { + return this.edit({ region }); + } + + /** + * Edit the verification level of the guild. + * @param {number} verificationLevel The new verification level of the guild + * @returns {Promise} + * @example + * // edit the guild verification level + * guild.setVerificationLevel(1) + * .then(updated => console.log(`Updated guild verification level to ${guild.verificationLevel}`)) + * .catch(console.error); + */ + setVerificationLevel(verificationLevel) { + return this.edit({ verificationLevel }); + } + + /** + * Edit the AFK channel of the guild. + * @param {ChannelResolvable} afkChannel The new AFK channel + * @returns {Promise} + * @example + * // edit the guild AFK channel + * guild.setAFKChannel(channel) + * .then(updated => console.log(`Updated guild AFK channel to ${guild.afkChannel}`)) + * .catch(console.error); + */ + setAFKChannel(afkChannel) { + return this.edit({ afkChannel }); + } + + /** + * Edit the AFK timeout of the guild. + * @param {number} afkTimeout The time in seconds that a user must be idle to be considered AFK + * @returns {Promise} + * @example + * // edit the guild AFK channel + * guild.setAFKTimeout(60) + * .then(updated => console.log(`Updated guild AFK timeout to ${guild.afkTimeout}`)) + * .catch(console.error); + */ + setAFKTimeout(afkTimeout) { + return this.edit({ afkTimeout }); + } + + /** + * Set a new guild icon. + * @param {Base64Resolvable} icon The new icon of the guild + * @returns {Promise} + * @example + * // edit the guild icon + * guild.setIcon(fs.readFileSync('./icon.png')) + * .then(updated => console.log('Updated the guild icon')) + * .catch(console.error); + */ + setIcon(icon) { + return this.edit({ icon }); + } + + /** + * Sets a new owner of the guild. + * @param {GuildMemberResolvable} owner The new owner of the guild + * @returns {Promise} + * @example + * // edit the guild owner + * guild.setOwner(guilds.members[0]) + * .then(updated => console.log(`Updated the guild owner to ${updated.owner.username}`)) + * .catch(console.error); + */ + setOwner(owner) { + return this.edit({ owner }); + } + + /** + * Set a new guild splash screen. + * @param {Base64Resolvable} splash The new splash screen of the guild + * @returns {Promise} + * @example + * // edit the guild splash + * guild.setIcon(fs.readFileSync('./splash.png')) + * .then(updated => console.log('Updated the guild splash')) + * .catch(console.error); + */ + setSplash(splash) { + return this.edit({ splash }); + } + + /** + * Bans a user from the guild. + * @param {UserResolvable} user The user to ban + * @param {number} [deleteDays=0] The amount of days worth of messages from this user that should + * also be deleted. Between `0` and `7`. + * @returns {Promise} Result object will be resolved as specifically as possible. + * If the GuildMember cannot be resolved, the User will instead be attempted to be resolved. If that also cannot + * be resolved, the user ID will be the result. + * @example + * // ban a user + * guild.ban('123123123123'); + */ + ban(user, deleteDays = 0) { + return this.client.rest.methods.banGuildMember(this, user, deleteDays); + } + + /** + * Unbans a user from the guild. + * @param {UserResolvable} user The user to unban + * @returns {Promise} + * @example + * // unban a user + * guild.unban('123123123123') + * .then(user => console.log(`Unbanned ${user.username} from ${guild.name}`)) + * .catch(reject); + */ + unban(user) { + return this.client.rest.methods.unbanGuildMember(this, user); + } + + /** + * Prunes members from the guild based on how long they have been inactive. + * @param {number} days Number of days of inactivity required to kick + * @param {boolean} [dry=false] If true, will return number of users that will be kicked, without actually doing it + * @returns {Promise} The number of members that were/will be kicked + * @example + * // see how many members will be pruned + * guild.pruneMembers(12, true) + * .then(pruned => console.log(`This will prune ${pruned} people!`); + * .catch(console.error); + * @example + * // actually prune the members + * guild.pruneMembers(12) + * .then(pruned => console.log(`I just pruned ${pruned} people!`); + * .catch(console.error); + */ + pruneMembers(days, dry = false) { + if (typeof days !== 'number') throw new TypeError('Days must be a number.'); + return this.client.rest.methods.pruneGuildMembers(this, days, dry); + } + + /** + * Syncs this guild (already done automatically every 30 seconds). + * This is only available when using a user account. + */ + sync() { + if (!this.client.user.bot) this.client.syncGuilds([this]); + } + + /** + * Creates a new channel in the guild. + * @param {string} name The name of the new channel + * @param {string} type The type of the new channel, either `text` or `voice` + * @returns {Promise} + * @example + * // create a new text channel + * guild.createChannel('new-general', 'text') + * .then(channel => console.log(`Created new channel ${channel}`)) + * .catch(console.error); + */ + createChannel(name, type) { + return this.client.rest.methods.createChannel(this, name, type); + } + + /** + * Creates a new role in the guild, and optionally updates it with the given information. + * @param {RoleData} [data] The data to update the role with + * @returns {Promise} + * @example + * // create a new role + * guild.createRole() + * .then(role => console.log(`Created role ${role}`)) + * .catch(console.error); + * @example + * // create a new role with data + * guild.createRole({ name: 'Super Cool People' }) + * .then(role => console.log(`Created role ${role}`)) + * .catch(console.error) + */ + createRole(data) { + const create = this.client.rest.methods.createGuildRole(this); + if (!data) return create; + return create.then(role => role.edit(data)); + } + + /** + * Creates a new custom emoji in the guild. + * @param {BufferResolvable} attachment The image for the emoji. + * @param {string} name The name for the emoji. + * @returns {Promise} The created emoji. + * @example + * // create a new emoji from a url + * guild.createEmoji('https://i.imgur.com/w3duR07.png', 'rip') + * .then(emoji => console.log(`Created new emoji with name ${emoji.name}!`)) + * .catch(console.error); + * @example + * // create a new emoji from a file on your computer + * guild.createEmoji('./memes/banana.png', 'banana') + * .then(emoji => console.log(`Created new emoji with name ${emoji.name}!`)) + * .catch(console.error); + */ + createEmoji(attachment, name) { + return new Promise(resolve => { + if (attachment.startsWith('data:')) { + resolve(this.client.rest.methods.createEmoji(this, attachment, name)); + } else { + this.client.resolver.resolveBuffer(attachment).then(data => + resolve(this.client.rest.methods.createEmoji(this, data, name)) + ); + } + }); + } + + /** + * Delete an emoji. + * @param {Emoji|string} emoji The emoji to delete. + * @returns {Promise} + */ + deleteEmoji(emoji) { + if (!(emoji instanceof Emoji)) emoji = this.emojis.get(emoji); + return this.client.rest.methods.deleteEmoji(emoji); + } + + /** + * Causes the Client to leave the guild. + * @returns {Promise} + * @example + * // leave a guild + * guild.leave() + * .then(g => console.log(`Left the guild ${g}`)) + * .catch(console.error); + */ + leave() { + return this.client.rest.methods.leaveGuild(this); + } + + /** + * Causes the Client to delete the guild. + * @returns {Promise} + * @example + * // delete a guild + * guild.delete() + * .then(g => console.log(`Deleted the guild ${g}`)) + * .catch(console.error); + */ + delete() { + return this.client.rest.methods.deleteGuild(this); + } + + /** + * Set the position of a role in this guild + * @param {string|Role} role the role to edit, can be a role object or a role ID. + * @param {number} position the new position of the role + * @returns {Promise} + */ + setRolePosition(role, position) { + if (role instanceof Role) { + role = role.id; + } else if (typeof role !== 'string') { + return Promise.reject(new Error('Supplied role is not a role or string')); + } + + position = Number(position); + if (isNaN(position)) { + return Promise.reject(new Error('Supplied position is not a number')); + } + + const updatedRoles = this.roles.array().map(r => ({ + id: r.id, + position: r.id === role ? position : r.position < position ? r.position : r.position + 1, + })); + + return this.client.rest.methods.setRolePositions(this.id, updatedRoles); + } + + /** + * Whether this Guild equals another Guild. It compares all properties, so for most operations + * it is advisable to just compare `guild.id === guild2.id` as it is much faster and is often + * what most users need. + * @param {Guild} guild The guild to compare + * @returns {boolean} + */ + equals(guild) { + let equal = + guild && + this.id === guild.id && + this.available === !guild.unavailable && + this.splash === guild.splash && + this.region === guild.region && + this.name === guild.name && + this.memberCount === guild.member_count && + this.large === guild.large && + this.icon === guild.icon && + arraysEqual(this.features, guild.features) && + this.ownerID === guild.owner_id && + this.verificationLevel === guild.verification_level && + this.embedEnabled === guild.embed_enabled; + + if (equal) { + if (this.embedChannel) { + if (this.embedChannel.id !== guild.embed_channel_id) equal = false; + } else if (guild.embed_channel_id) { + equal = false; + } + } + + return equal; + } + + /** + * When concatenated with a string, this automatically concatenates the guild's name instead of the Guild object. + * @returns {string} + * @example + * // logs: Hello from My Guild! + * console.log(`Hello from ${guild}!`); + * @example + * // logs: Hello from My Guild! + * console.log(`Hello from ' + guild + '!'); + */ + toString() { + return this.name; + } + + _addMember(guildUser, emitEvent = true) { + const existing = this.members.has(guildUser.user.id); + if (!(guildUser.user instanceof User)) guildUser.user = this.client.dataManager.newUser(guildUser.user); + + guildUser.joined_at = guildUser.joined_at || 0; + const member = new GuildMember(this, guildUser); + this.members.set(member.id, member); + + if (this._rawVoiceStates && this._rawVoiceStates.get(member.user.id)) { + const voiceState = this._rawVoiceStates.get(member.user.id); + member.serverMute = voiceState.mute; + member.serverDeaf = voiceState.deaf; + member.selfMute = voiceState.self_mute; + member.selfDeaf = voiceState.self_deaf; + member.voiceSessionID = voiceState.session_id; + member.voiceChannelID = voiceState.channel_id; + this.channels.get(voiceState.channel_id).members.set(member.user.id, member); + } + + /** + * Emitted whenever a user joins a guild. + * @event Client#guildMemberAdd + * @param {GuildMember} member The member that has joined a guild + */ + if (this.client.ws.status === Constants.Status.READY && emitEvent && !existing) { + this.client.emit(Constants.Events.GUILD_MEMBER_ADD, member); + } + + this._checkChunks(); + return member; + } + + _updateMember(member, data) { + const oldMember = cloneObject(member); + + if (data.roles) member._roles = data.roles; + if (typeof data.nick !== 'undefined') member.nickname = data.nick; + + const notSame = member.nickname !== oldMember.nickname || !arraysEqual(member._roles, oldMember._roles); + + if (this.client.ws.status === Constants.Status.READY && notSame) { + /** + * Emitted whenever a guild member changes - i.e. new role, removed role, nickname + * @event Client#guildMemberUpdate + * @param {GuildMember} oldMember The member before the update + * @param {GuildMember} newMember The member after the update + */ + this.client.emit(Constants.Events.GUILD_MEMBER_UPDATE, oldMember, member); + } + + return { + old: oldMember, + mem: member, + }; + } + + _removeMember(guildMember) { + this.members.delete(guildMember.id); + this._checkChunks(); + } + + _memberSpeakUpdate(user, speaking) { + const member = this.members.get(user); + if (member && member.speaking !== speaking) { + member.speaking = speaking; + /** + * Emitted once a guild member starts/stops speaking + * @event Client#guildMemberSpeaking + * @param {GuildMember} member The member that started/stopped speaking + * @param {boolean} speaking Whether or not the member is speaking + */ + this.client.emit(Constants.Events.GUILD_MEMBER_SPEAKING, member, speaking); + } + } + + _setPresence(id, presence) { + if (this.presences.get(id)) { + this.presences.get(id).update(presence); + return; + } + this.presences.set(id, new Presence(presence)); + } + + _checkChunks() { + if (this._fetchWaiter) { + if (this.members.size === this.memberCount) { + this._fetchWaiter(this); + this._fetchWaiter = null; + } + } + } +} + +module.exports = Guild; /***/ }, /* 44 */ -/***/ function(module, exports) { +/***/ function(module, exports, __webpack_require__) { - // The node and browser modules expose versions of this with the - // appropriate constructor function bound as first argument - /** - * Issue a request: - * - * Examples: - * - * request('GET', '/users').end(callback) - * request('/users').end(callback) - * request('/users', callback) - * - * @param {String} method - * @param {String|Function} url or callback - * @return {Request} - * @api public - */ +const Attachment = __webpack_require__(68); +const Embed = __webpack_require__(70); +const Collection = __webpack_require__(6); +const Constants = __webpack_require__(2); +const escapeMarkdown = __webpack_require__(31); +const MessageReaction = __webpack_require__(71); - function request(RequestConstructor, method, url) { - // callback - if ('function' == typeof url) { - return new RequestConstructor('GET', method).end(url); - } +/** + * Represents a message on Discord + */ +class Message { + constructor(channel, data, client) { + /** + * The Client that instantiated the Message + * @type {Client} + */ + this.client = client; + Object.defineProperty(this, 'client', { enumerable: false, configurable: false }); - // url first - if (2 == arguments.length) { - return new RequestConstructor('GET', method); - } + /** + * The channel that the message was sent in + * @type {TextChannel|DMChannel|GroupDMChannel} + */ + this.channel = channel; - return new RequestConstructor(method, url); - } + if (data) this.setup(data); + } - module.exports = request; + setup(data) { // eslint-disable-line complexity + /** + * The ID of the message (unique in the channel it was sent) + * @type {string} + */ + this.id = data.id; + + /** + * The type of the message + * @type {string} + */ + this.type = Constants.MessageTypes[data.type]; + + /** + * The content of the message + * @type {string} + */ + this.content = data.content; + + /** + * The author of the message + * @type {User} + */ + this.author = this.client.dataManager.newUser(data.author); + + /** + * Represents the author of the message as a guild member. Only available if the message comes from a guild + * where the author is still a member. + * @type {GuildMember} + */ + this.member = this.guild ? this.guild.member(this.author) || null : null; + + /** + * Whether or not this message is pinned + * @type {boolean} + */ + this.pinned = data.pinned; + + /** + * Whether or not the message was Text-To-Speech + * @type {boolean} + */ + this.tts = data.tts; + + /** + * A random number used for checking message delivery + * @type {string} + */ + this.nonce = data.nonce; + + /** + * Whether or not this message was sent by Discord, not actually a user (e.g. pin notifications) + * @type {boolean} + */ + this.system = data.type === 6; + + /** + * A list of embeds in the message - e.g. YouTube Player + * @type {MessageEmbed[]} + */ + this.embeds = data.embeds.map(e => new Embed(this, e)); + + /** + * A collection of attachments in the message - e.g. Pictures - mapped by their ID. + * @type {Collection} + */ + this.attachments = new Collection(); + for (const attachment of data.attachments) this.attachments.set(attachment.id, new Attachment(this, attachment)); + + /** + * The timestamp the message was sent at + * @type {number} + */ + this.createdTimestamp = new Date(data.timestamp).getTime(); + + /** + * The timestamp the message was last edited at (if applicable) + * @type {?number} + */ + this.editedTimestamp = data.edited_timestamp ? new Date(data.edited_timestamp).getTime() : null; + + /** + * An object containing a further users, roles or channels collections + * @type {Object} + * @property {Collection} mentions.users Mentioned users, maps their ID to the user object. + * @property {Collection} mentions.roles Mentioned roles, maps their ID to the role object. + * @property {Collection} mentions.channels Mentioned channels, + * maps their ID to the channel object. + * @property {boolean} mentions.everyone Whether or not @everyone was mentioned. + */ + this.mentions = { + users: new Collection(), + roles: new Collection(), + channels: new Collection(), + everyone: data.mention_everyone, + }; + + for (const mention of data.mentions) { + let user = this.client.users.get(mention.id); + if (user) { + this.mentions.users.set(user.id, user); + } else { + user = this.client.dataManager.newUser(mention); + this.mentions.users.set(user.id, user); + } + } + + if (data.mention_roles) { + for (const mention of data.mention_roles) { + const role = this.channel.guild.roles.get(mention); + if (role) this.mentions.roles.set(role.id, role); + } + } + + if (this.channel.guild) { + const channMentionsRaw = data.content.match(/<#([0-9]{14,20})>/g) || []; + for (const raw of channMentionsRaw) { + const chan = this.channel.guild.channels.get(raw.match(/([0-9]{14,20})/g)[0]); + if (chan) this.mentions.channels.set(chan.id, chan); + } + } + + this._edits = []; + + /** + * A collection of reactions to this message, mapped by the reaction "id". + * @type {Collection} + */ + this.reactions = new Collection(); + + if (data.reactions && data.reactions.length > 0) { + for (const reaction of data.reactions) { + const id = reaction.emoji.id ? `${reaction.emoji.name}:${reaction.emoji.id}` : reaction.emoji.name; + this.reactions.set(id, new MessageReaction(this, reaction.emoji, reaction.count, reaction.me)); + } + } + } + + patch(data) { // eslint-disable-line complexity + if (data.author) { + this.author = this.client.users.get(data.author.id); + if (this.guild) this.member = this.guild.member(this.author); + } + if (data.content) this.content = data.content; + if (data.timestamp) this.createdTimestamp = new Date(data.timestamp).getTime(); + if (data.edited_timestamp) { + this.editedTimestamp = data.edited_timestamp ? new Date(data.edited_timestamp).getTime() : null; + } + if ('tts' in data) this.tts = data.tts; + if ('mention_everyone' in data) this.mentions.everyone = data.mention_everyone; + if (data.nonce) this.nonce = data.nonce; + if (data.embeds) this.embeds = data.embeds.map(e => new Embed(this, e)); + if (data.type > -1) { + this.system = false; + if (data.type === 6) this.system = true; + } + if (data.attachments) { + this.attachments = new Collection(); + for (const attachment of data.attachments) { + this.attachments.set(attachment.id, new Attachment(this, attachment)); + } + } + if (data.mentions) { + for (const mention of data.mentions) { + let user = this.client.users.get(mention.id); + if (user) { + this.mentions.users.set(user.id, user); + } else { + user = this.client.dataManager.newUser(mention); + this.mentions.users.set(user.id, user); + } + } + } + if (data.mention_roles) { + for (const mention of data.mention_roles) { + const role = this.channel.guild.roles.get(mention); + if (role) this.mentions.roles.set(role.id, role); + } + } + if (data.id) this.id = data.id; + if (this.channel.guild && data.content) { + const channMentionsRaw = data.content.match(/<#([0-9]{14,20})>/g) || []; + for (const raw of channMentionsRaw) { + const chan = this.channel.guild.channels.get(raw.match(/([0-9]{14,20})/g)[0]); + if (chan) this.mentions.channels.set(chan.id, chan); + } + } + if (data.reactions) { + this.reactions = new Collection(); + if (data.reactions.length > 0) { + for (const reaction of data.reactions) { + const id = reaction.emoji.id ? `${reaction.emoji.name}:${reaction.emoji.id}` : reaction.emoji.name; + this.reactions.set(id, new MessageReaction(this, data.emoji, data.count, data.me)); + } + } + } + } + + /** + * The time the message was sent + * @type {Date} + * @readonly + */ + get createdAt() { + return new Date(this.createdTimestamp); + } + + /** + * The time the message was last edited at (if applicable) + * @type {?Date} + * @readonly + */ + get editedAt() { + return this.editedTimestamp ? new Date(this.editedTimestamp) : null; + } + + /** + * The guild the message was sent in (if in a guild channel) + * @type {?Guild} + * @readonly + */ + get guild() { + return this.channel.guild || null; + } + + /** + * The message contents with all mentions replaced by the equivalent text. If mentions cannot be resolved to a name, + * the relevant mention in the message content will not be converted. + * @type {string} + * @readonly + */ + get cleanContent() { + return this.content + .replace(/@(everyone|here)/g, '@\u200b$1') + .replace(/<@!?[0-9]+>/g, (input) => { + const id = input.replace(/<|!|>|@/g, ''); + if (this.channel.type === 'dm' || this.channel.type === 'group') { + return this.client.users.has(id) ? `@${this.client.users.get(id).username}` : input; + } + + const member = this.channel.guild.members.get(id); + if (member) { + if (member.nickname) return `@${member.nickname}`; + return `@${member.user.username}`; + } else { + const user = this.client.users.get(id); + if (user) return `@${user.username}`; + return input; + } + }) + .replace(/<#[0-9]+>/g, (input) => { + const channel = this.client.channels.get(input.replace(/<|#|>/g, '')); + if (channel) return `#${channel.name}`; + return input; + }) + .replace(/<@&[0-9]+>/g, (input) => { + if (this.channel.type === 'dm' || this.channel.type === 'group') return input; + const role = this.guild.roles.get(input.replace(/<|@|>|&/g, '')); + if (role) return `@${role.name}`; + return input; + }); + } + + /** + * An array of cached versions of the message, including the current version. + * Sorted from latest (first) to oldest (last). + * @type {Message[]} + * @readonly + */ + get edits() { + return this._edits.slice().unshift(this); + } + + /** + * Whether the message is editable by the client user. + * @type {boolean} + * @readonly + */ + get editable() { + return this.author.id === this.client.user.id; + } + + /** + * Whether the message is deletable by the client user. + * @type {boolean} + * @readonly + */ + get deletable() { + return this.author.id === this.client.user.id || (this.guild && + this.channel.permissionsFor(this.client.user).hasPermission(Constants.PermissionFlags.MANAGE_MESSAGES) + ); + } + + /** + * Whether the message is pinnable by the client user. + * @type {boolean} + * @readonly + */ + get pinnable() { + return !this.guild || + this.channel.permissionsFor(this.client.user).hasPermission(Constants.PermissionFlags.MANAGE_MESSAGES); + } + + /** + * Whether or not a user, channel or role is mentioned in this message. + * @param {GuildChannel|User|Role|string} data either a guild channel, user or a role object, or a string representing + * the ID of any of these. + * @returns {boolean} + */ + isMentioned(data) { + data = data && data.id ? data.id : data; + return this.mentions.users.has(data) || this.mentions.channels.has(data) || this.mentions.roles.has(data); + } + + /** + * Options that can be passed into editMessage + * @typedef {Object} MessageEditOptions + * @property {Object} [embed] An embed to be added/edited + */ + + /** + * Edit the content of the message + * @param {StringResolvable} content The new content for the message + * @param {MessageEditOptions} [options={}] The options to provide + * @returns {Promise} + * @example + * // update the content of a message + * message.edit('This is my new content!') + * .then(msg => console.log(`Updated the content of a message from ${msg.author}`)) + * .catch(console.error); + */ + edit(content, options = {}) { + return this.client.rest.methods.updateMessage(this, content, options); + } + + /** + * Edit the content of the message, with a code block + * @param {string} lang Language for the code block + * @param {StringResolvable} content The new content for the message + * @returns {Promise} + */ + editCode(lang, content) { + content = escapeMarkdown(this.client.resolver.resolveString(content), true); + return this.edit(`\`\`\`${lang || ''}\n${content}\n\`\`\``); + } + + /** + * Pins this message to the channel's pinned messages + * @returns {Promise} + */ + pin() { + return this.client.rest.methods.pinMessage(this); + } + + /** + * Unpins this message from the channel's pinned messages + * @returns {Promise} + */ + unpin() { + return this.client.rest.methods.unpinMessage(this); + } + + /** + * Add a reaction to the message + * @param {string|Emoji|ReactionEmoji} emoji Emoji to react with + * @returns {Promise} + */ + react(emoji) { + emoji = this.client.resolver.resolveEmojiIdentifier(emoji); + if (!emoji) throw new TypeError('Emoji must be a string or Emoji/ReactionEmoji'); + + return this.client.rest.methods.addMessageReaction(this, emoji); + } + + /** + * Remove all reactions from a message + * @returns {Promise} + */ + clearReactions() { + return this.client.rest.methods.removeMessageReactions(this); + } + + /** + * Deletes the message + * @param {number} [timeout=0] How long to wait to delete the message in milliseconds + * @returns {Promise} + * @example + * // delete a message + * message.delete() + * .then(msg => console.log(`Deleted message from ${msg.author}`)) + * .catch(console.error); + */ + delete(timeout = 0) { + if (timeout <= 0) { + return this.client.rest.methods.deleteMessage(this); + } else { + return new Promise(resolve => { + this.client.setTimeout(() => { + resolve(this.delete()); + }, timeout); + }); + } + } + + /** + * Reply to the message + * @param {StringResolvable} content The content for the message + * @param {MessageOptions} [options = {}] The options to provide + * @returns {Promise} + * @example + * // reply to a message + * message.reply('Hey, I\'m a reply!') + * .then(msg => console.log(`Sent a reply to ${msg.author}`)) + * .catch(console.error); + */ + reply(content, options = {}) { + content = this.client.resolver.resolveString(content); + const prepend = this.guild ? `${this.author}, ` : ''; + content = `${prepend}${content}`; + + if (options.split) { + if (typeof options.split !== 'object') options.split = {}; + if (!options.split.prepend) options.split.prepend = prepend; + } + + return this.client.rest.methods.sendMessage(this.channel, content, options); + } + + /** + * Used mainly internally. Whether two messages are identical in properties. If you want to compare messages + * without checking all the properties, use `message.id === message2.id`, which is much more efficient. This + * method allows you to see if there are differences in content, embeds, attachments, nonce and tts properties. + * @param {Message} message The message to compare it to + * @param {Object} rawData Raw data passed through the WebSocket about this message + * @returns {boolean} + */ + equals(message, rawData) { + if (!message) return false; + const embedUpdate = !message.author && !message.attachments; + if (embedUpdate) return this.id === message.id && this.embeds.length === message.embeds.length; + + let equal = this.id === message.id && + this.author.id === message.author.id && + this.content === message.content && + this.tts === message.tts && + this.nonce === message.nonce && + this.embeds.length === message.embeds.length && + this.attachments.length === message.attachments.length; + + if (equal && rawData) { + equal = this.mentions.everyone === message.mentions.everyone && + this.createdTimestamp === new Date(rawData.timestamp).getTime() && + this.editedTimestamp === new Date(rawData.edited_timestamp).getTime(); + } + + return equal; + } + + /** + * When concatenated with a string, this automatically concatenates the message's content instead of the object. + * @returns {string} + * @example + * // logs: Message: This is a message! + * console.log(`Message: ${message}`); + */ + toString() { + return this.content; + } + + _addReaction(emoji, user) { + const emojiID = emoji.id ? `${emoji.name}:${emoji.id}` : emoji.name; + let reaction; + if (this.reactions.has(emojiID)) { + reaction = this.reactions.get(emojiID); + if (!reaction.me) reaction.me = user.id === this.client.user.id; + } else { + reaction = new MessageReaction(this, emoji, 0, user.id === this.client.user.id); + this.reactions.set(emojiID, reaction); + } + if (!reaction.users.has(user.id)) { + reaction.users.set(user.id, user); + reaction.count++; + return reaction; + } + return null; + } + + _removeReaction(emoji, user) { + const emojiID = emoji.id || emoji; + if (this.reactions.has(emojiID)) { + const reaction = this.reactions.get(emojiID); + if (reaction.users.has(user.id)) { + reaction.users.delete(user.id); + reaction.count--; + if (user.id === this.client.user.id) reaction.me = false; + return reaction; + } + } + return null; + } + + _clearReactions() { + this.reactions.clear(); + } +} + +module.exports = Message; /***/ }, /* 45 */ -/***/ function(module, exports, __webpack_require__) { +/***/ function(module, exports) { - const Constants = __webpack_require__(5); - const cloneObject = __webpack_require__(46); - const Guild = __webpack_require__(47); - const User = __webpack_require__(13); - const DMChannel = __webpack_require__(49); - const Emoji = __webpack_require__(21); - const TextChannel = __webpack_require__(51); - const VoiceChannel = __webpack_require__(54); - const GuildChannel = __webpack_require__(52); - const GroupDMChannel = __webpack_require__(55); +/** + * Represents a limited emoji set used for both custom and unicode emojis. Custom emojis + * will use this class opposed to the Emoji class when the client doesn't know enough + * information about them. + */ +class ReactionEmoji { + constructor(reaction, name, id) { + /** + * The message reaction this emoji refers to + * @type {MessageReaction} + */ + this.reaction = reaction; - class ClientDataManager { - constructor(client) { - this.client = client; - } + /** + * The name of this reaction emoji. + * @type {string} + */ + this.name = name; - get pastReady() { - return this.client.ws.status === Constants.Status.READY; - } + /** + * The ID of this reaction emoji. + * @type {string} + */ + this.id = id; + } - newGuild(data) { - const already = this.client.guilds.has(data.id); - const guild = new Guild(this.client, data); - this.client.guilds.set(guild.id, guild); - if (this.pastReady && !already) { - /** - * Emitted whenever the client joins a guild. - * @event Client#guildCreate - * @param {Guild} guild The created guild - */ - if (this.client.options.fetchAllMembers) { - guild.fetchMembers().then(() => { this.client.emit(Constants.Events.GUILD_CREATE, guild); }); - } else { - this.client.emit(Constants.Events.GUILD_CREATE, guild); - } - } + /** + * The identifier of this emoji, used for message reactions + * @readonly + * @type {string} + */ + get identifier() { + if (this.id) return `${this.name}:${this.id}`; + return encodeURIComponent(this.name); + } - return guild; - } + /** + * Creates the text required to form a graphical emoji on Discord. + * @example + * // send the emoji used in a reaction to the channel the reaction is part of + * reaction.message.channel.sendMessage(`The emoji used is ${reaction.emoji}`); + * @returns {string} + */ + toString() { + return this.id ? `<:${this.name}:${this.id}>` : this.name; + } +} - newUser(data) { - if (this.client.users.has(data.id)) return this.client.users.get(data.id); - const user = new User(this.client, data); - this.client.users.set(user.id, user); - return user; - } - - newChannel(data, guild) { - const already = this.client.channels.has(data.id); - let channel; - if (data.type === Constants.ChannelTypes.DM) { - channel = new DMChannel(this.client, data); - } else if (data.type === Constants.ChannelTypes.groupDM) { - channel = new GroupDMChannel(this.client, data); - } else { - guild = guild || this.client.guilds.get(data.guild_id); - if (guild) { - if (data.type === Constants.ChannelTypes.text) { - channel = new TextChannel(guild, data); - guild.channels.set(channel.id, channel); - } else if (data.type === Constants.ChannelTypes.voice) { - channel = new VoiceChannel(guild, data); - guild.channels.set(channel.id, channel); - } - } - } - - if (channel) { - if (this.pastReady && !already) this.client.emit(Constants.Events.CHANNEL_CREATE, channel); - this.client.channels.set(channel.id, channel); - return channel; - } - - return null; - } - - newEmoji(data, guild) { - const already = guild.emojis.has(data.id); - if (data && !already) { - let emoji = new Emoji(guild, data); - this.client.emit(Constants.Events.EMOJI_CREATE, emoji); - guild.emojis.set(emoji.id, emoji); - return emoji; - } else if (already) { - return guild.emojis.get(data.id); - } - - return null; - } - - killEmoji(emoji) { - if (!(emoji instanceof Emoji && emoji.guild)) return; - this.client.emit(Constants.Events.EMOJI_DELETE, emoji); - emoji.guild.emojis.delete(emoji.id); - } - - killGuild(guild) { - const already = this.client.guilds.has(guild.id); - this.client.guilds.delete(guild.id); - if (already && this.pastReady) this.client.emit(Constants.Events.GUILD_DELETE, guild); - } - - killUser(user) { - this.client.users.delete(user.id); - } - - killChannel(channel) { - this.client.channels.delete(channel.id); - if (channel instanceof GuildChannel) channel.guild.channels.delete(channel.id); - } - - updateGuild(currentGuild, newData) { - const oldGuild = cloneObject(currentGuild); - currentGuild.setup(newData); - if (this.pastReady) this.client.emit(Constants.Events.GUILD_UPDATE, oldGuild, currentGuild); - } - - updateChannel(currentChannel, newData) { - currentChannel.setup(newData); - } - - updateEmoji(currentEmoji, newData) { - const oldEmoji = cloneObject(currentEmoji); - currentEmoji.setup(newData); - this.client.emit(Constants.Events.GUILD_EMOJI_UPDATE, oldEmoji, currentEmoji); - } - } - - module.exports = ClientDataManager; +module.exports = ReactionEmoji; /***/ }, /* 46 */ -/***/ function(module, exports) { +/***/ function(module, exports, __webpack_require__) { - module.exports = function cloneObject(obj) { - const cloned = Object.create(obj); - Object.assign(cloned, obj); - return cloned; - }; +const path = __webpack_require__(14); +const escapeMarkdown = __webpack_require__(31); + +/** + * Represents a webhook + */ +class Webhook { + constructor(client, dataOrID, token) { + if (client) { + /** + * The Client that instantiated the Webhook + * @type {Client} + */ + this.client = client; + Object.defineProperty(this, 'client', { enumerable: false, configurable: false }); + if (dataOrID) this.setup(dataOrID); + } else { + this.id = dataOrID; + this.token = token; + this.client = this; + } + } + + setup(data) { + /** + * The name of the webhook + * @type {string} + */ + this.name = data.name; + + /** + * The token for the webhook + * @type {string} + */ + this.token = data.token; + + /** + * The avatar for the webhook + * @type {string} + */ + this.avatar = data.avatar; + + /** + * The ID of the webhook + * @type {string} + */ + this.id = data.id; + + /** + * The guild the webhook belongs to + * @type {string} + */ + this.guildID = data.guild_id; + + /** + * The channel the webhook belongs to + * @type {string} + */ + this.channelID = data.channel_id; + + /** + * The owner of the webhook + * @type {User} + */ + if (data.user) this.owner = data.user; + } + + /** + * Options that can be passed into sendMessage, sendTTSMessage, sendFile, sendCode + * @typedef {Object} WebhookMessageOptions + * @property {boolean} [tts=false] Whether or not the message should be spoken aloud + * @property {boolean} [disableEveryone=this.options.disableEveryone] Whether or not @everyone and @here + * should be replaced with plain-text + */ + + /** + * Send a message with this webhook + * @param {StringResolvable} content The content to send. + * @param {WebhookMessageOptions} [options={}] The options to provide. + * @returns {Promise} + * @example + * // send a message + * webhook.sendMessage('hello!') + * .then(message => console.log(`Sent message: ${message.content}`)) + * .catch(console.error); + */ + sendMessage(content, options = {}) { + return this.client.rest.methods.sendWebhookMessage(this, content, options); + } + + /** + * Send a raw slack message with this webhook + * @param {Object} body The raw body to send. + * @returns {Promise} + * @example + * // send a slack message + * webhook.sendSlackMessage({ + * 'username': 'Wumpus', + * 'attachments': [{ + * 'pretext': 'this looks pretty cool', + * 'color': '#F0F', + * 'footer_icon': 'http://snek.s3.amazonaws.com/topSnek.png', + * 'footer': 'Powered by sneks', + * 'ts': new Date().getTime() / 1000 + * }] + * }).catch(console.error); + */ + sendSlackMessage(body) { + return this.client.rest.methods.sendSlackWebhookMessage(this, body); + } + + /** + * Send a text-to-speech message with this webhook + * @param {StringResolvable} content The content to send + * @param {WebhookMessageOptions} [options={}] The options to provide + * @returns {Promise} + * @example + * // send a TTS message + * webhook.sendTTSMessage('hello!') + * .then(message => console.log(`Sent tts message: ${message.content}`)) + * .catch(console.error); + */ + sendTTSMessage(content, options = {}) { + Object.assign(options, { tts: true }); + return this.client.rest.methods.sendWebhookMessage(this, content, options); + } + + /** + * Send a file with this webhook + * @param {BufferResolvable} attachment The file to send + * @param {string} [fileName="file.jpg"] The name and extension of the file + * @param {StringResolvable} [content] Text message to send with the attachment + * @param {WebhookMessageOptions} [options] The options to provide + * @returns {Promise} + */ + sendFile(attachment, fileName, content, options = {}) { + if (!fileName) { + if (typeof attachment === 'string') { + fileName = path.basename(attachment); + } else if (attachment && attachment.path) { + fileName = path.basename(attachment.path); + } else { + fileName = 'file.jpg'; + } + } + return this.client.resolver.resolveBuffer(attachment).then(file => + this.client.rest.methods.sendWebhookMessage(this, content, options, { + file, + name: fileName, + }) + ); + } + + /** + * Send a code block with this webhook + * @param {string} lang Language for the code block + * @param {StringResolvable} content Content of the code block + * @param {WebhookMessageOptions} options The options to provide + * @returns {Promise} + */ + sendCode(lang, content, options = {}) { + if (options.split) { + if (typeof options.split !== 'object') options.split = {}; + if (!options.split.prepend) options.split.prepend = `\`\`\`${lang || ''}\n`; + if (!options.split.append) options.split.append = '\n```'; + } + content = escapeMarkdown(this.client.resolver.resolveString(content), true); + return this.sendMessage(`\`\`\`${lang || ''}\n${content}\n\`\`\``, options); + } + + /** + * Edit the webhook. + * @param {string} name The new name for the Webhook + * @param {BufferResolvable} avatar The new avatar for the Webhook. + * @returns {Promise} + */ + edit(name = this.name, avatar) { + if (avatar) { + return this.client.resolver.resolveBuffer(avatar).then(file => { + const dataURI = this.client.resolver.resolveBase64(file); + return this.client.rest.methods.editWebhook(this, name, dataURI); + }); + } + return this.client.rest.methods.editWebhook(this, name).then(data => { + this.setup(data); + return this; + }); + } + + /** + * Delete the webhook + * @returns {Promise} + */ + delete() { + return this.client.rest.methods.deleteWebhook(this); + } +} + +module.exports = Webhook; /***/ }, /* 47 */ /***/ function(module, exports, __webpack_require__) { - const User = __webpack_require__(13); - const Role = __webpack_require__(26); - const Emoji = __webpack_require__(21); - const Presence = __webpack_require__(24).Presence; - const GuildMember = __webpack_require__(25); - const Constants = __webpack_require__(5); - const Collection = __webpack_require__(10); - const cloneObject = __webpack_require__(46); - const arraysEqual = __webpack_require__(48); - - /** - * Represents a guild (or a server) on Discord. - * It's recommended to see if a guild is available before performing operations or reading data from it. You can - * check this with `guild.available`. - */ - class Guild { - constructor(client, data) { - /** - * The Client that created the instance of the the Guild. - * @type {Client} - */ - this.client = client; - Object.defineProperty(this, 'client', { enumerable: false, configurable: false }); - - /** - * A collection of members that are in this guild. The key is the member's ID, the value is the member. - * @type {Collection} - */ - this.members = new Collection(); - - /** - * A collection of channels that are in this guild. The key is the channel's ID, the value is the channel. - * @type {Collection} - */ - this.channels = new Collection(); - - /** - * A collection of roles that are in this guild. The key is the role's ID, the value is the role. - * @type {Collection} - */ - this.roles = new Collection(); - - if (!data) return; - if (data.unavailable) { - /** - * Whether the guild is available to access. If it is not available, it indicates a server outage. - * @type {boolean} - */ - this.available = false; - - /** - * The Unique ID of the Guild, useful for comparisons. - * @type {string} - */ - this.id = data.id; - } else { - this.available = true; - this.setup(data); - } - } - - /** - * Sets up the Guild - * @param {*} data The raw data of the guild - * @private - */ - setup(data) { - /** - * The name of the guild - * @type {string} - */ - this.name = data.name; - - /** - * The hash of the guild icon, or null if there is no icon. - * @type {?string} - */ - this.icon = data.icon; - - /** - * The hash of the guild splash image, or null if no splash (VIP only) - * @type {?string} - */ - this.splash = data.splash; - - /** - * The region the guild is located in - * @type {string} - */ - this.region = data.region; - - /** - * The full amount of members in this guild as of `READY` - * @type {number} - */ - this.memberCount = data.member_count || this.memberCount; - - /** - * Whether the guild is "large" (has more than 250 members) - * @type {boolean} - */ - this.large = data.large || this.large; - - /** - * A collection of presences in this guild - * @type {Collection} - */ - this.presences = new Collection(); - - /** - * An array of guild features. - * @type {Object[]} - */ - this.features = data.features; - - /** - * A collection of emojis that are in this guild. The key is the emoji's ID, the value is the emoji. - * @type {Collection} - */ - this.emojis = new Collection(); - for (const emoji of data.emojis) this.emojis.set(emoji.id, new Emoji(this, emoji)); - - /** - * The time in seconds before a user is counted as "away from keyboard". - * @type {?number} - */ - this.afkTimeout = data.afk_timeout; - - /** - * The ID of the voice channel where AFK members are moved. - * @type {?string} - */ - this.afkChannelID = data.afk_channel_id; - - /** - * Whether embedded images are enabled on this guild. - * @type {boolean} - */ - this.embedEnabled = data.embed_enabled; - - /** - * The verification level of the guild. - * @type {number} - */ - this.verificationLevel = data.verification_level; - - /** - * The timestamp the client user joined the guild at - * @type {number} - */ - this.joinedTimestamp = data.joined_at ? new Date(data.joined_at).getTime() : this.joinedTimestamp; - - this.id = data.id; - this.available = !data.unavailable; - this.features = data.features || this.features || []; - - if (data.members) { - this.members.clear(); - for (const guildUser of data.members) this._addMember(guildUser, false); - } - - if (data.owner_id) { - /** - * The user ID of this guild's owner. - * @type {string} - */ - this.ownerID = data.owner_id; - } - - if (data.channels) { - this.channels.clear(); - for (const channel of data.channels) this.client.dataManager.newChannel(channel, this); - } - - if (data.roles) { - this.roles.clear(); - for (const role of data.roles) { - const newRole = new Role(this, role); - this.roles.set(newRole.id, newRole); - } - } - - if (data.presences) { - for (const presence of data.presences) { - this._setPresence(presence.user.id, presence); - } - } - - this._rawVoiceStates = new Collection(); - if (data.voice_states) { - for (const voiceState of data.voice_states) { - this._rawVoiceStates.set(voiceState.user_id, voiceState); - const member = this.members.get(voiceState.user_id); - if (member) { - member.serverMute = voiceState.mute; - member.serverDeaf = voiceState.deaf; - member.selfMute = voiceState.self_mute; - member.selfDeaf = voiceState.self_deaf; - member.voiceSessionID = voiceState.session_id; - member.voiceChannelID = voiceState.channel_id; - this.channels.get(voiceState.channel_id).members.set(member.user.id, member); - } - } - } - } - - /** - * The timestamp the guild was created at - * @type {number} - * @readonly - */ - get createdTimestamp() { - return (this.id / 4194304) + 1420070400000; - } - - /** - * The time the guild was created - * @type {Date} - * @readonly - */ - get createdAt() { - return new Date(this.createdTimestamp); - } - - /** - * The time the client user joined the guild - * @type {Date} - * @readonly - */ - get joinedAt() { - return new Date(this.joinedTimestamp); - } - - /** - * Gets the URL to this guild's icon (if it has one, otherwise it returns null) - * @type {?string} - * @readonly - */ - get iconURL() { - if (!this.icon) return null; - return Constants.Endpoints.guildIcon(this.id, this.icon); - } - - /** - * The owner of the guild - * @type {GuildMember} - * @readonly - */ - get owner() { - return this.members.get(this.ownerID); - } - - /** - * If the client is connected to any voice channel in this guild, this will be the relevant VoiceConnection. - * @type {?VoiceConnection} - * @readonly - */ - get voiceConnection() { - return this.client.voice.connections.get(this.id) || null; - } - - /** - * The `#general` GuildChannel of the server. - * @type {GuildChannel} - * @readonly - */ - get defaultChannel() { - return this.channels.get(this.id); - } - - /** - * Returns the GuildMember form of a User object, if the user is present in the guild. - * @param {UserResolvable} user The user that you want to obtain the GuildMember of - * @returns {?GuildMember} - * @example - * // get the guild member of a user - * const member = guild.member(message.author); - */ - member(user) { - return this.client.resolver.resolveGuildMember(this, user); - } - - /** - * Fetch a collection of banned users in this guild. - * @returns {Promise>} - */ - fetchBans() { - return this.client.rest.methods.getGuildBans(this); - } - - /** - * Fetch a collection of invites to this guild. Resolves with a collection mapping invites by their codes. - * @returns {Promise>} - */ - fetchInvites() { - return this.client.rest.methods.getGuildInvites(this); - } - - /** - * Fetch all webhooks for the guild. - * @returns {Collection} - */ - fetchWebhooks() { - return this.client.rest.methods.getGuildWebhooks(this); - } - - /** - * Fetch a single guild member from a user. - * @param {UserResolvable} user The user to fetch the member for - * @returns {Promise} - */ - fetchMember(user) { - if (this._fetchWaiter) return Promise.reject(new Error('Already fetching guild members.')); - user = this.client.resolver.resolveUser(user); - if (!user) return Promise.reject(new Error('User is not cached. Use Client.fetchUser first.')); - if (this.members.has(user.id)) return Promise.resolve(this.members.get(user.id)); - return this.client.rest.methods.getGuildMember(this, user); - } - - /** - * Fetches all the members in the guild, even if they are offline. If the guild has less than 250 members, - * this should not be necessary. - * @param {string} [query=''] An optional query to provide when fetching members - * @returns {Promise} - */ - fetchMembers(query = '') { - return new Promise((resolve, reject) => { - if (this._fetchWaiter) throw new Error('Already fetching guild members in ${this.id}.'); - if (this.memberCount === this.members.size) { - resolve(this); - return; - } - this._fetchWaiter = resolve; - this.client.ws.send({ - op: Constants.OPCodes.REQUEST_GUILD_MEMBERS, - d: { - guild_id: this.id, - query, - limit: 0, - }, - }); - this._checkChunks(); - this.client.setTimeout(() => reject(new Error('Members didn\'t arrive in time.')), 120 * 1000); - }); - } - - /** - * The data for editing a guild - * @typedef {Object} GuildEditData - * @property {string} [name] The name of the guild - * @property {string} [region] The region of the guild - * @property {number} [verificationLevel] The verification level of the guild - * @property {ChannelResolvable} [afkChannel] The AFK channel of the guild - * @property {number} [afkTimeout] The AFK timeout of the guild - * @property {Base64Resolvable} [icon] The icon of the guild - * @property {GuildMemberResolvable} [owner] The owner of the guild - * @property {Base64Resolvable} [splash] The splash screen of the guild - */ - - /** - * Updates the Guild with new information - e.g. a new name. - * @param {GuildEditData} data The data to update the guild with - * @returns {Promise} - * @example - * // set the guild name and region - * guild.edit({ - * name: 'Discord Guild', - * region: 'london', - * }) - * .then(updated => console.log(`New guild name ${updated.name} in region ${updated.region}`)) - * .catch(console.error); - */ - edit(data) { - return this.client.rest.methods.updateGuild(this, data); - } - - /** - * Edit the name of the guild. - * @param {string} name The new name of the guild - * @returns {Promise} - * @example - * // edit the guild name - * guild.setName('Discord Guild') - * .then(updated => console.log(`Updated guild name to ${guild.name}`)) - * .catch(console.error); - */ - setName(name) { - return this.edit({ name }); - } - - /** - * Edit the region of the guild. - * @param {string} region The new region of the guild. - * @returns {Promise} - * @example - * // edit the guild region - * guild.setRegion('london') - * .then(updated => console.log(`Updated guild region to ${guild.region}`)) - * .catch(console.error); - */ - setRegion(region) { - return this.edit({ region }); - } - - /** - * Edit the verification level of the guild. - * @param {number} verificationLevel The new verification level of the guild - * @returns {Promise} - * @example - * // edit the guild verification level - * guild.setVerificationLevel(1) - * .then(updated => console.log(`Updated guild verification level to ${guild.verificationLevel}`)) - * .catch(console.error); - */ - setVerificationLevel(verificationLevel) { - return this.edit({ verificationLevel }); - } - - /** - * Edit the AFK channel of the guild. - * @param {ChannelResolvable} afkChannel The new AFK channel - * @returns {Promise} - * @example - * // edit the guild AFK channel - * guild.setAFKChannel(channel) - * .then(updated => console.log(`Updated guild AFK channel to ${guild.afkChannel}`)) - * .catch(console.error); - */ - setAFKChannel(afkChannel) { - return this.edit({ afkChannel }); - } - - /** - * Edit the AFK timeout of the guild. - * @param {number} afkTimeout The time in seconds that a user must be idle to be considered AFK - * @returns {Promise} - * @example - * // edit the guild AFK channel - * guild.setAFKTimeout(60) - * .then(updated => console.log(`Updated guild AFK timeout to ${guild.afkTimeout}`)) - * .catch(console.error); - */ - setAFKTimeout(afkTimeout) { - return this.edit({ afkTimeout }); - } - - /** - * Set a new guild icon. - * @param {Base64Resolvable} icon The new icon of the guild - * @returns {Promise} - * @example - * // edit the guild icon - * guild.setIcon(fs.readFileSync('./icon.png')) - * .then(updated => console.log('Updated the guild icon')) - * .catch(console.error); - */ - setIcon(icon) { - return this.edit({ icon }); - } - - /** - * Sets a new owner of the guild. - * @param {GuildMemberResolvable} owner The new owner of the guild - * @returns {Promise} - * @example - * // edit the guild owner - * guild.setOwner(guilds.members[0]) - * .then(updated => console.log(`Updated the guild owner to ${updated.owner.username}`)) - * .catch(console.error); - */ - setOwner(owner) { - return this.edit({ owner }); - } - - /** - * Set a new guild splash screen. - * @param {Base64Resolvable} splash The new splash screen of the guild - * @returns {Promise} - * @example - * // edit the guild splash - * guild.setIcon(fs.readFileSync('./splash.png')) - * .then(updated => console.log('Updated the guild splash')) - * .catch(console.error); - */ - setSplash(splash) { - return this.edit({ splash }); - } - - /** - * Bans a user from the guild. - * @param {UserResolvable} user The user to ban - * @param {number} [deleteDays=0] The amount of days worth of messages from this user that should - * also be deleted. Between `0` and `7`. - * @returns {Promise} Result object will be resolved as specifically as possible. - * If the GuildMember cannot be resolved, the User will instead be attempted to be resolved. If that also cannot - * be resolved, the user ID will be the result. - * @example - * // ban a user - * guild.ban('123123123123'); - */ - ban(user, deleteDays = 0) { - return this.client.rest.methods.banGuildMember(this, user, deleteDays); - } - - /** - * Unbans a user from the guild. - * @param {UserResolvable} user The user to unban - * @returns {Promise} - * @example - * // unban a user - * guild.unban('123123123123') - * .then(user => console.log(`Unbanned ${user.username} from ${guild.name}`)) - * .catch(reject); - */ - unban(user) { - return this.client.rest.methods.unbanGuildMember(this, user); - } - - /** - * Prunes members from the guild based on how long they have been inactive. - * @param {number} days Number of days of inactivity required to kick - * @param {boolean} [dry=false] If true, will return number of users that will be kicked, without actually doing it - * @returns {Promise} The number of members that were/will be kicked - * @example - * // see how many members will be pruned - * guild.pruneMembers(12, true) - * .then(pruned => console.log(`This will prune ${pruned} people!`); - * .catch(console.error); - * @example - * // actually prune the members - * guild.pruneMembers(12) - * .then(pruned => console.log(`I just pruned ${pruned} people!`); - * .catch(console.error); - */ - pruneMembers(days, dry = false) { - if (typeof days !== 'number') throw new TypeError('Days must be a number.'); - return this.client.rest.methods.pruneGuildMembers(this, days, dry); - } - - /** - * Syncs this guild (already done automatically every 30 seconds). - * This is only available when using a user account. - */ - sync() { - if (!this.client.user.bot) this.client.syncGuilds([this]); - } - - /** - * Creates a new channel in the guild. - * @param {string} name The name of the new channel - * @param {string} type The type of the new channel, either `text` or `voice` - * @returns {Promise} - * @example - * // create a new text channel - * guild.createChannel('new-general', 'text') - * .then(channel => console.log(`Created new channel ${channel}`)) - * .catch(console.error); - */ - createChannel(name, type) { - return this.client.rest.methods.createChannel(this, name, type); - } - - /** - * Creates a new role in the guild, and optionally updates it with the given information. - * @param {RoleData} [data] The data to update the role with - * @returns {Promise} - * @example - * // create a new role - * guild.createRole() - * .then(role => console.log(`Created role ${role}`)) - * .catch(console.error); - * @example - * // create a new role with data - * guild.createRole({ name: 'Super Cool People' }) - * .then(role => console.log(`Created role ${role}`)) - * .catch(console.error) - */ - createRole(data) { - const create = this.client.rest.methods.createGuildRole(this); - if (!data) return create; - return create.then(role => role.edit(data)); - } - - /** - * Creates a new custom emoji in the guild. - * @param {BufferResolvable} attachment The image for the emoji. - * @param {string} name The name for the emoji. - * @returns {Promise} The created emoji. - * @example - * // create a new emoji from a url - * guild.createEmoji('https://i.imgur.com/w3duR07.png', 'rip') - * .then(emoji => console.log(`Created new emoji with name ${emoji.name}!`)) - * .catch(console.error); - * @example - * // create a new emoji from a file on your computer - * guild.createEmoji('./memes/banana.png', 'banana') - * .then(emoji => console.log(`Created new emoji with name ${emoji.name}!`)) - * .catch(console.error); - */ - createEmoji(attachment, name) { - return new Promise(resolve => { - if (attachment.startsWith('data:')) { - resolve(this.client.rest.methods.createEmoji(this, attachment, name)); - } else { - this.client.resolver.resolveBuffer(attachment).then(data => - resolve(this.client.rest.methods.createEmoji(this, data, name)) - ); - } - }); - } - - /** - * Delete an emoji. - * @param {Emoji|string} emoji The emoji to delete. - * @returns {Promise} - */ - deleteEmoji(emoji) { - if (!(emoji instanceof Emoji)) emoji = this.emojis.get(emoji); - return this.client.rest.methods.deleteEmoji(emoji); - } - - /** - * Causes the Client to leave the guild. - * @returns {Promise} - * @example - * // leave a guild - * guild.leave() - * .then(g => console.log(`Left the guild ${g}`)) - * .catch(console.error); - */ - leave() { - return this.client.rest.methods.leaveGuild(this); - } - - /** - * Causes the Client to delete the guild. - * @returns {Promise} - * @example - * // delete a guild - * guild.delete() - * .then(g => console.log(`Deleted the guild ${g}`)) - * .catch(console.error); - */ - delete() { - return this.client.rest.methods.deleteGuild(this); - } - - /** - * Set the position of a role in this guild - * @param {string|Role} role the role to edit, can be a role object or a role ID. - * @param {number} position the new position of the role - * @returns {Promise} - */ - setRolePosition(role, position) { - if (role instanceof Role) { - role = role.id; - } else if (typeof role !== 'string') { - return Promise.reject(new Error('Supplied role is not a role or string')); - } - - position = Number(position); - if (isNaN(position)) { - return Promise.reject(new Error('Supplied position is not a number')); - } - - const updatedRoles = this.roles.array().map(r => ({ - id: r.id, - position: r.id === role ? position : r.position < position ? r.position : r.position + 1, - })); - - return this.client.rest.methods.setRolePositions(this.id, updatedRoles); - } - - /** - * Whether this Guild equals another Guild. It compares all properties, so for most operations - * it is advisable to just compare `guild.id === guild2.id` as it is much faster and is often - * what most users need. - * @param {Guild} guild The guild to compare - * @returns {boolean} - */ - equals(guild) { - let equal = - guild && - this.id === guild.id && - this.available === !guild.unavailable && - this.splash === guild.splash && - this.region === guild.region && - this.name === guild.name && - this.memberCount === guild.member_count && - this.large === guild.large && - this.icon === guild.icon && - arraysEqual(this.features, guild.features) && - this.ownerID === guild.owner_id && - this.verificationLevel === guild.verification_level && - this.embedEnabled === guild.embed_enabled; - - if (equal) { - if (this.embedChannel) { - if (this.embedChannel.id !== guild.embed_channel_id) equal = false; - } else if (guild.embed_channel_id) { - equal = false; - } - } - - return equal; - } - - /** - * When concatenated with a string, this automatically concatenates the guild's name instead of the Guild object. - * @returns {string} - * @example - * // logs: Hello from My Guild! - * console.log(`Hello from ${guild}!`); - * @example - * // logs: Hello from My Guild! - * console.log(`Hello from ' + guild + '!'); - */ - toString() { - return this.name; - } - - _addMember(guildUser, emitEvent = true) { - const existing = this.members.has(guildUser.user.id); - if (!(guildUser.user instanceof User)) guildUser.user = this.client.dataManager.newUser(guildUser.user); - - guildUser.joined_at = guildUser.joined_at || 0; - const member = new GuildMember(this, guildUser); - this.members.set(member.id, member); - - if (this._rawVoiceStates && this._rawVoiceStates.get(member.user.id)) { - const voiceState = this._rawVoiceStates.get(member.user.id); - member.serverMute = voiceState.mute; - member.serverDeaf = voiceState.deaf; - member.selfMute = voiceState.self_mute; - member.selfDeaf = voiceState.self_deaf; - member.voiceSessionID = voiceState.session_id; - member.voiceChannelID = voiceState.channel_id; - this.channels.get(voiceState.channel_id).members.set(member.user.id, member); - } - - /** - * Emitted whenever a user joins a guild. - * @event Client#guildMemberAdd - * @param {GuildMember} member The member that has joined a guild - */ - if (this.client.ws.status === Constants.Status.READY && emitEvent && !existing) { - this.client.emit(Constants.Events.GUILD_MEMBER_ADD, member); - } - - this._checkChunks(); - return member; - } - - _updateMember(member, data) { - const oldMember = cloneObject(member); - - if (data.roles) member._roles = data.roles; - if (typeof data.nick !== 'undefined') member.nickname = data.nick; - - const notSame = member.nickname !== oldMember.nickname || !arraysEqual(member._roles, oldMember._roles); - - if (this.client.ws.status === Constants.Status.READY && notSame) { - /** - * Emitted whenever a guild member changes - i.e. new role, removed role, nickname - * @event Client#guildMemberUpdate - * @param {GuildMember} oldMember The member before the update - * @param {GuildMember} newMember The member after the update - */ - this.client.emit(Constants.Events.GUILD_MEMBER_UPDATE, oldMember, member); - } - - return { - old: oldMember, - mem: member, - }; - } - - _removeMember(guildMember) { - this.members.delete(guildMember.id); - this._checkChunks(); - } - - _memberSpeakUpdate(user, speaking) { - const member = this.members.get(user); - if (member && member.speaking !== speaking) { - member.speaking = speaking; - /** - * Emitted once a guild member starts/stops speaking - * @event Client#guildMemberSpeaking - * @param {GuildMember} member The member that started/stopped speaking - * @param {boolean} speaking Whether or not the member is speaking - */ - this.client.emit(Constants.Events.GUILD_MEMBER_SPEAKING, member, speaking); - } - } - - _setPresence(id, presence) { - if (this.presences.get(id)) { - this.presences.get(id).update(presence); - return; - } - this.presences.set(id, new Presence(presence)); - } - - _checkChunks() { - if (this._fetchWaiter) { - if (this.members.size === this.memberCount) { - this._fetchWaiter(this); - this._fetchWaiter = null; - } - } - } - } - - module.exports = Guild; +var ciphers = __webpack_require__(150) +exports.createCipher = exports.Cipher = ciphers.createCipher +exports.createCipheriv = exports.Cipheriv = ciphers.createCipheriv +var deciphers = __webpack_require__(149) +exports.createDecipher = exports.Decipher = deciphers.createDecipher +exports.createDecipheriv = exports.Decipheriv = deciphers.createDecipheriv +var modes = __webpack_require__(34) +function getCiphers () { + return Object.keys(modes) +} +exports.listCiphers = exports.getCiphers = getCiphers /***/ }, /* 48 */ -/***/ function(module, exports) { +/***/ function(module, exports, __webpack_require__) { - module.exports = function arraysEqual(a, b) { - if (a === b) return true; - if (a.length !== b.length) return false; - - for (const itemInd in a) { - const item = a[itemInd]; - const ind = b.indexOf(item); - if (ind) { - b.splice(ind, 1); - } - } - - return b.length === 0; - }; +/* WEBPACK VAR INJECTION */(function(Buffer) {var bn = __webpack_require__(4); +var randomBytes = __webpack_require__(27); +module.exports = crt; +function blind(priv) { + var r = getr(priv); + var blinder = r.toRed(bn.mont(priv.modulus)) + .redPow(new bn(priv.publicExponent)).fromRed(); + return { + blinder: blinder, + unblinder:r.invm(priv.modulus) + }; +} +function crt(msg, priv) { + var blinds = blind(priv); + var len = priv.modulus.byteLength(); + var mod = bn.mont(priv.modulus); + var blinded = new bn(msg).mul(blinds.blinder).umod(priv.modulus); + var c1 = blinded.toRed(bn.mont(priv.prime1)); + var c2 = blinded.toRed(bn.mont(priv.prime2)); + var qinv = priv.coefficient; + var p = priv.prime1; + var q = priv.prime2; + var m1 = c1.redPow(priv.exponent1); + var m2 = c2.redPow(priv.exponent2); + m1 = m1.fromRed(); + m2 = m2.fromRed(); + var h = m1.isub(m2).imul(qinv).umod(p); + h.imul(q); + m2.iadd(h); + return new Buffer(m2.imul(blinds.unblinder).umod(priv.modulus).toArray(false, len)); +} +crt.getr = getr; +function getr(priv) { + var len = priv.modulus.byteLength(); + var r = new bn(randomBytes(len)); + while (r.cmp(priv.modulus) >= 0 || !r.umod(priv.prime1) || !r.umod(priv.prime2)) { + r = new bn(randomBytes(len)); + } + return r; +} +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer)) /***/ }, /* 49 */ /***/ function(module, exports, __webpack_require__) { - const Channel = __webpack_require__(50); - const TextBasedChannel = __webpack_require__(14); - const Collection = __webpack_require__(10); +"use strict"; +/* WEBPACK VAR INJECTION */(function(global) {'use strict'; - /** - * Represents a direct message channel between two users. - * @extends {Channel} - * @implements {TextBasedChannel} - */ - class DMChannel extends Channel { - constructor(client, data) { - super(client, data); - this.type = 'dm'; - this.messages = new Collection(); - this._typing = new Map(); - } +var buffer = __webpack_require__(0); +var Buffer = buffer.Buffer; +var SlowBuffer = buffer.SlowBuffer; +var MAX_LEN = buffer.kMaxLength || 2147483647; +exports.alloc = function alloc(size, fill, encoding) { + if (typeof Buffer.alloc === 'function') { + return Buffer.alloc(size, fill, encoding); + } + if (typeof encoding === 'number') { + throw new TypeError('encoding must not be number'); + } + if (typeof size !== 'number') { + throw new TypeError('size must be a number'); + } + if (size > MAX_LEN) { + throw new RangeError('size is too large'); + } + var enc = encoding; + var _fill = fill; + if (_fill === undefined) { + enc = undefined; + _fill = 0; + } + var buf = new Buffer(size); + if (typeof _fill === 'string') { + var fillBuf = new Buffer(_fill, enc); + var flen = fillBuf.length; + var i = -1; + while (++i < size) { + buf[i] = fillBuf[i % flen]; + } + } else { + buf.fill(_fill); + } + return buf; +} +exports.allocUnsafe = function allocUnsafe(size) { + if (typeof Buffer.allocUnsafe === 'function') { + return Buffer.allocUnsafe(size); + } + if (typeof size !== 'number') { + throw new TypeError('size must be a number'); + } + if (size > MAX_LEN) { + throw new RangeError('size is too large'); + } + return new Buffer(size); +} +exports.from = function from(value, encodingOrOffset, length) { + if (typeof Buffer.from === 'function' && (!global.Uint8Array || Uint8Array.from !== Buffer.from)) { + return Buffer.from(value, encodingOrOffset, length); + } + if (typeof value === 'number') { + throw new TypeError('"value" argument must not be a number'); + } + if (typeof value === 'string') { + return new Buffer(value, encodingOrOffset); + } + if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) { + var offset = encodingOrOffset; + if (arguments.length === 1) { + return new Buffer(value); + } + if (typeof offset === 'undefined') { + offset = 0; + } + var len = length; + if (typeof len === 'undefined') { + len = value.byteLength - offset; + } + if (offset >= value.byteLength) { + throw new RangeError('\'offset\' is out of bounds'); + } + if (len > value.byteLength - offset) { + throw new RangeError('\'length\' is out of bounds'); + } + return new Buffer(value.slice(offset, offset + len)); + } + if (Buffer.isBuffer(value)) { + var out = new Buffer(value.length); + value.copy(out, 0, 0, value.length); + return out; + } + if (value) { + if (Array.isArray(value) || (typeof ArrayBuffer !== 'undefined' && value.buffer instanceof ArrayBuffer) || 'length' in value) { + return new Buffer(value); + } + if (value.type === 'Buffer' && Array.isArray(value.data)) { + return new Buffer(value.data); + } + } - setup(data) { - super.setup(data); - - /** - * The recipient on the other end of the DM - * @type {User} - */ - this.recipient = this.client.dataManager.newUser(data.recipients[0]); - - this.lastMessageID = data.last_message_id; - } - - /** - * When concatenated with a string, this automatically concatenates the recipient's mention instead of the - * DM channel object. - * @returns {string} - */ - toString() { - return this.recipient.toString(); - } - - // These are here only for documentation purposes - they are implemented by TextBasedChannel - sendMessage() { return; } - sendTTSMessage() { return; } - sendFile() { return; } - sendCode() { return; } - fetchMessage() { return; } - fetchMessages() { return; } - fetchPinnedMessages() { return; } - startTyping() { return; } - stopTyping() { return; } - get typing() { return; } - get typingCount() { return; } - createCollector() { return; } - awaitMessages() { return; } - bulkDelete() { return; } - _cacheMessage() { return; } - } - - TextBasedChannel.applyToClass(DMChannel, true); - - module.exports = DMChannel; + throw new TypeError('First argument must be a string, Buffer, ' + 'ArrayBuffer, Array, or array-like object.'); +} +exports.allocUnsafeSlow = function allocUnsafeSlow(size) { + if (typeof Buffer.allocUnsafeSlow === 'function') { + return Buffer.allocUnsafeSlow(size); + } + if (typeof size !== 'number') { + throw new TypeError('size must be a number'); + } + if (size >= MAX_LEN) { + throw new RangeError('size is too large'); + } + return new SlowBuffer(size); +} +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(16))) /***/ }, /* 50 */ -/***/ function(module, exports) { +/***/ function(module, exports, __webpack_require__) { - /** - * Represents any channel on Discord - */ - class Channel { - constructor(client, data) { - /** - * The client that instantiated the Channel - * @type {Client} - */ - this.client = client; - Object.defineProperty(this, 'client', { enumerable: false, configurable: false }); +"use strict"; +/* WEBPACK VAR INJECTION */(function(Buffer) {'use strict'; +var createHash = __webpack_require__(18); +var inherits = __webpack_require__(1) - /** - * The type of the channel, either: - * * `dm` - a DM channel - * * `group` - a Group DM channel - * * `text` - a guild text channel - * * `voice` - a guild voice channel - * @type {string} - */ - this.type = null; +var Transform = __webpack_require__(9).Transform - if (data) this.setup(data); - } +var ZEROS = new Buffer(128) +ZEROS.fill(0) - setup(data) { - /** - * The unique ID of the channel - * @type {string} - */ - this.id = data.id; - } +function Hmac(alg, key) { + Transform.call(this) + alg = alg.toLowerCase() + if (typeof key === 'string') { + key = new Buffer(key) + } - /** - * The timestamp the channel was created at - * @type {number} - * @readonly - */ - get createdTimestamp() { - return (this.id / 4194304) + 1420070400000; - } + var blocksize = (alg === 'sha512' || alg === 'sha384') ? 128 : 64 - /** - * The time the channel was created - * @type {Date} - * @readonly - */ - get createdAt() { - return new Date(this.createdTimestamp); - } + this._alg = alg + this._key = key - /** - * Deletes the channel - * @returns {Promise} - * @example - * // delete the channel - * channel.delete() - * .then() // success - * .catch(console.error); // log error - */ - delete() { - return this.client.rest.methods.deleteChannel(this); - } - } + if (key.length > blocksize) { + key = createHash(alg).update(key).digest() - module.exports = Channel; + } else if (key.length < blocksize) { + key = Buffer.concat([key, ZEROS], blocksize) + } + var ipad = this._ipad = new Buffer(blocksize) + var opad = this._opad = new Buffer(blocksize) + + for (var i = 0; i < blocksize; i++) { + ipad[i] = key[i] ^ 0x36 + opad[i] = key[i] ^ 0x5C + } + + this._hash = createHash(alg).update(ipad) +} + +inherits(Hmac, Transform) + +Hmac.prototype.update = function (data, enc) { + this._hash.update(data, enc) + + return this +} + +Hmac.prototype._transform = function (data, _, next) { + this._hash.update(data) + + next() +} + +Hmac.prototype._flush = function (next) { + this.push(this.digest()) + + next() +} + +Hmac.prototype.digest = function (enc) { + var h = this._hash.digest() + + return createHash(this._alg).update(this._opad).update(h).digest(enc) +} + +module.exports = function createHmac(alg, key) { + return new Hmac(alg, key) +} + +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer)) /***/ }, /* 51 */ /***/ function(module, exports, __webpack_require__) { - const GuildChannel = __webpack_require__(52); - const TextBasedChannel = __webpack_require__(14); - const Collection = __webpack_require__(10); +"use strict"; +'use strict'; - /** - * Represents a guild text channel on Discord. - * @extends {GuildChannel} - * @implements {TextBasedChannel} - */ - class TextChannel extends GuildChannel { - constructor(guild, data) { - super(guild, data); - this.type = 'text'; - this.messages = new Collection(); - this._typing = new Map(); - } - - setup(data) { - super.setup(data); - - /** - * The topic of the text channel, if there is one. - * @type {?string} - */ - this.topic = data.topic; - - this.lastMessageID = data.last_message_id; - } - - /** - * A collection of members that can see this channel, mapped by their ID. - * @type {Collection} - * @readonly - */ - get members() { - const members = new Collection(); - for (const member of this.guild.members.values()) { - if (this.permissionsFor(member).hasPermission('READ_MESSAGES')) { - members.set(member.id, member); - } - } - return members; - } - - /** - * Fetch all webhooks for the channel. - * @returns {Promise>} - */ - fetchWebhooks() { - return this.client.rest.methods.getChannelWebhooks(this); - } - - /** - * Create a webhook for the channel. - * @param {string} name The name of the webhook. - * @param {BufferResolvable} avatar The avatar for the webhook. - * @returns {Promise} webhook The created webhook. - * @example - * channel.createWebhook('Snek', 'http://snek.s3.amazonaws.com/topSnek.png') - * .then(webhook => console.log(`Created Webhook ${webhook}`)) - * .catch(console.error) - */ - createWebhook(name, avatar) { - return new Promise(resolve => { - if (avatar.startsWith('data:')) { - resolve(this.client.rest.methods.createWebhook(this, name, avatar)); - } else { - this.client.resolver.resolveBuffer(avatar).then(data => - resolve(this.client.rest.methods.createWebhook(this, name, data)) - ); - } - }); - } - - // These are here only for documentation purposes - they are implemented by TextBasedChannel - sendMessage() { return; } - sendTTSMessage() { return; } - sendFile() { return; } - sendCode() { return; } - fetchMessage() { return; } - fetchMessages() { return; } - fetchPinnedMessages() { return; } - startTyping() { return; } - stopTyping() { return; } - get typing() { return; } - get typingCount() { return; } - createCollector() { return; } - awaitMessages() { return; } - bulkDelete() { return; } - _cacheMessage() { return; } - } - - TextBasedChannel.applyToClass(TextChannel, true); - - module.exports = TextChannel; +exports.utils = __webpack_require__(174); +exports.Cipher = __webpack_require__(171); +exports.DES = __webpack_require__(172); +exports.CBC = __webpack_require__(170); +exports.EDE = __webpack_require__(173); /***/ }, /* 52 */ /***/ function(module, exports, __webpack_require__) { - const Channel = __webpack_require__(50); - const Role = __webpack_require__(26); - const PermissionOverwrites = __webpack_require__(53); - const EvaluatedPermissions = __webpack_require__(27); - const Constants = __webpack_require__(5); - const Collection = __webpack_require__(10); - const arraysEqual = __webpack_require__(48); +var http = module.exports; +var EventEmitter = __webpack_require__(3).EventEmitter; +var Request = __webpack_require__(196); +var url = __webpack_require__(59) - /** - * Represents a guild channel (i.e. text channels and voice channels) - * @extends {Channel} - */ - class GuildChannel extends Channel { - constructor(guild, data) { - super(guild.client, data); +http.request = function (params, cb) { + if (typeof params === 'string') { + params = url.parse(params) + } + if (!params) params = {}; + if (!params.host && !params.port) { + params.port = parseInt(window.location.port, 10); + } + if (!params.host && params.hostname) { + params.host = params.hostname; + } - /** - * The guild the channel is in - * @type {Guild} - */ - this.guild = guild; - } + if (!params.protocol) { + if (params.scheme) { + params.protocol = params.scheme + ':'; + } else { + params.protocol = window.location.protocol; + } + } - setup(data) { - super.setup(data); + if (!params.host) { + params.host = window.location.hostname || window.location.host; + } + if (/:/.test(params.host)) { + if (!params.port) { + params.port = params.host.split(':')[1]; + } + params.host = params.host.split(':')[0]; + } + if (!params.port) params.port = params.protocol == 'https:' ? 443 : 80; + + var req = new Request(new xhrHttp, params); + if (cb) req.on('response', cb); + return req; +}; - /** - * The name of the guild channel - * @type {string} - */ - this.name = data.name; +http.get = function (params, cb) { + params.method = 'GET'; + var req = http.request(params, cb); + req.end(); + return req; +}; - /** - * The position of the channel in the list. - * @type {number} - */ - this.position = data.position; +http.Agent = function () {}; +http.Agent.defaultMaxSockets = 4; - /** - * A map of permission overwrites in this channel for roles and users. - * @type {Collection} - */ - this.permissionOverwrites = new Collection(); - if (data.permission_overwrites) { - for (const overwrite of data.permission_overwrites) { - this.permissionOverwrites.set(overwrite.id, new PermissionOverwrites(this, overwrite)); - } - } - } - - /** - * Gets the overall set of permissions for a user in this channel, taking into account roles and permission - * overwrites. - * @param {GuildMemberResolvable} member The user that you want to obtain the overall permissions for - * @returns {?EvaluatedPermissions} - */ - permissionsFor(member) { - member = this.client.resolver.resolveGuildMember(this.guild, member); - if (!member) return null; - if (member.id === this.guild.ownerID) return new EvaluatedPermissions(member, Constants.ALL_PERMISSIONS); - - let permissions = 0; - - const roles = member.roles; - for (const role of roles.values()) permissions |= role.permissions; - - const overwrites = this.overwritesFor(member, true, roles); - for (const overwrite of overwrites.role.concat(overwrites.member)) { - permissions &= ~overwrite.denyData; - permissions |= overwrite.allowData; - } - - const admin = Boolean(permissions & Constants.PermissionFlags.ADMINISTRATOR); - if (admin) permissions = Constants.ALL_PERMISSIONS; - - return new EvaluatedPermissions(member, permissions); - } - - overwritesFor(member, verified = false, roles = null) { - if (!verified) member = this.client.resolver.resolveGuildMember(this.guild, member); - if (!member) return []; - - roles = roles || member.roles; - const roleOverwrites = []; - const memberOverwrites = []; - - for (const overwrite of this.permissionOverwrites.values()) { - if (overwrite.id === member.id) { - memberOverwrites.push(overwrite); - } else if (roles.has(overwrite.id)) { - roleOverwrites.push(overwrite); - } - } - - return { - role: roleOverwrites, - member: memberOverwrites, - }; - } - - /** - * An object mapping permission flags to `true` (enabled) or `false` (disabled) - * ```js - * { - * 'SEND_MESSAGES': true, - * 'ATTACH_FILES': false, - * } - * ``` - * @typedef {Object} PermissionOverwriteOptions - */ - - /** - * Overwrites the permissions for a user or role in this channel. - * @param {RoleResolvable|UserResolvable} userOrRole The user or role to update - * @param {PermissionOverwriteOptions} options The configuration for the update - * @returns {Promise} - * @example - * // overwrite permissions for a message author - * message.channel.overwritePermissions(message.author, { - * SEND_MESSAGES: false - * }) - * .then(() => console.log('Done!')) - * .catch(console.error); - */ - overwritePermissions(userOrRole, options) { - const payload = { - allow: 0, - deny: 0, - }; - - if (userOrRole instanceof Role) { - payload.type = 'role'; - } else if (this.guild.roles.has(userOrRole)) { - userOrRole = this.guild.roles.get(userOrRole); - payload.type = 'role'; - } else { - userOrRole = this.client.resolver.resolveUser(userOrRole); - payload.type = 'member'; - if (!userOrRole) return Promise.reject(new TypeError('Supplied parameter was neither a User nor a Role.')); - } - - payload.id = userOrRole.id; - - const prevOverwrite = this.permissionOverwrites.get(userOrRole.id); - - if (prevOverwrite) { - payload.allow = prevOverwrite.allowData; - payload.deny = prevOverwrite.denyData; - } - - for (const perm in options) { - if (options[perm] === true) { - payload.allow |= Constants.PermissionFlags[perm] || 0; - payload.deny &= ~(Constants.PermissionFlags[perm] || 0); - } else if (options[perm] === false) { - payload.allow &= ~(Constants.PermissionFlags[perm] || 0); - payload.deny |= Constants.PermissionFlags[perm] || 0; - } else if (options[perm] === null) { - payload.allow &= ~(Constants.PermissionFlags[perm] || 0); - payload.deny &= ~(Constants.PermissionFlags[perm] || 0); - } - } - - return this.client.rest.methods.setChannelOverwrite(this, payload); - } - - /** - * The data for a guild channel - * @typedef {Object} ChannelData - * @property {string} [name] The name of the channel - * @property {number} [position] The position of the channel - * @property {string} [topic] The topic of the text channel - * @property {number} [bitrate] The bitrate of the voice channel - * @property {number} [userLimit] The user limit of the channel - */ - - /** - * Edits the channel - * @param {ChannelData} data The new data for the channel - * @returns {Promise} - * @example - * // edit a channel - * channel.edit({name: 'new-channel'}) - * .then(c => console.log(`Edited channel ${c}`)) - * .catch(console.error); - */ - edit(data) { - return this.client.rest.methods.updateChannel(this, data); - } - - /** - * Set a new name for the guild channel - * @param {string} name The new name for the guild channel - * @returns {Promise} - * @example - * // set a new channel name - * channel.setName('not_general') - * .then(newChannel => console.log(`Channel's new name is ${newChannel.name}`)) - * .catch(console.error); - */ - setName(name) { - return this.edit({ name }); - } - - /** - * Set a new position for the guild channel - * @param {number} position The new position for the guild channel - * @returns {Promise} - * @example - * // set a new channel position - * channel.setPosition(2) - * .then(newChannel => console.log(`Channel's new position is ${newChannel.position}`)) - * .catch(console.error); - */ - setPosition(position) { - return this.client.rest.methods.updateChannel(this, { position }); - } - - /** - * Set a new topic for the guild channel - * @param {string} topic The new topic for the guild channel - * @returns {Promise} - * @example - * // set a new channel topic - * channel.setTopic('needs more rate limiting') - * .then(newChannel => console.log(`Channel's new topic is ${newChannel.topic}`)) - * .catch(console.error); - */ - setTopic(topic) { - return this.client.rest.methods.updateChannel(this, { topic }); - } - - /** - * Options given when creating a guild channel invite - * @typedef {Object} InviteOptions - * @property {boolean} [temporary=false] Whether the invite should kick users after 24hrs if they are not given a role - * @property {number} [maxAge=0] Time in seconds the invite expires in - * @property {number} [maxUses=0] Maximum amount of uses for this invite - */ - - /** - * Create an invite to this guild channel - * @param {InviteOptions} [options={}] The options for the invite - * @returns {Promise} - */ - createInvite(options = {}) { - return this.client.rest.methods.createChannelInvite(this, options); - } - - /** - * Checks if this channel has the same type, topic, position, name, overwrites and ID as another channel. - * In most cases, a simple `channel.id === channel2.id` will do, and is much faster too. - * @param {GuildChannel} channel The channel to compare this channel to - * @returns {boolean} - */ - equals(channel) { - let equal = channel && - this.id === channel.id && - this.type === channel.type && - this.topic === channel.topic && - this.position === channel.position && - this.name === channel.name; - - if (equal) { - if (this.permissionOverwrites && channel.permissionOverwrites) { - const thisIDSet = this.permissionOverwrites.keyArray(); - const otherIDSet = channel.permissionOverwrites.keyArray(); - equal = arraysEqual(thisIDSet, otherIDSet); - } else { - equal = !this.permissionOverwrites && !channel.permissionOverwrites; - } - } - - return equal; - } - - /** - * When concatenated with a string, this automatically returns the channel's mention instead of the Channel object. - * @returns {string} - * @example - * // Outputs: Hello from #general - * console.log(`Hello from ${channel}`); - * @example - * // Outputs: Hello from #general - * console.log('Hello from ' + channel); - */ - toString() { - return `<#${this.id}>`; - } - } - - module.exports = GuildChannel; +var xhrHttp = (function () { + if (typeof window === 'undefined') { + throw new Error('no window object present'); + } + else if (window.XMLHttpRequest) { + return window.XMLHttpRequest; + } + else if (window.ActiveXObject) { + var axs = [ + 'Msxml2.XMLHTTP.6.0', + 'Msxml2.XMLHTTP.3.0', + 'Microsoft.XMLHTTP' + ]; + for (var i = 0; i < axs.length; i++) { + try { + var ax = new(window.ActiveXObject)(axs[i]); + return function () { + if (ax) { + var ax_ = ax; + ax = null; + return ax_; + } + else { + return new(window.ActiveXObject)(axs[i]); + } + }; + } + catch (e) {} + } + throw new Error('ajax not supported in this browser') + } + else { + throw new Error('ajax not supported in this browser'); + } +})(); +http.STATUS_CODES = { + 100 : 'Continue', + 101 : 'Switching Protocols', + 102 : 'Processing', // RFC 2518, obsoleted by RFC 4918 + 200 : 'OK', + 201 : 'Created', + 202 : 'Accepted', + 203 : 'Non-Authoritative Information', + 204 : 'No Content', + 205 : 'Reset Content', + 206 : 'Partial Content', + 207 : 'Multi-Status', // RFC 4918 + 300 : 'Multiple Choices', + 301 : 'Moved Permanently', + 302 : 'Moved Temporarily', + 303 : 'See Other', + 304 : 'Not Modified', + 305 : 'Use Proxy', + 307 : 'Temporary Redirect', + 400 : 'Bad Request', + 401 : 'Unauthorized', + 402 : 'Payment Required', + 403 : 'Forbidden', + 404 : 'Not Found', + 405 : 'Method Not Allowed', + 406 : 'Not Acceptable', + 407 : 'Proxy Authentication Required', + 408 : 'Request Time-out', + 409 : 'Conflict', + 410 : 'Gone', + 411 : 'Length Required', + 412 : 'Precondition Failed', + 413 : 'Request Entity Too Large', + 414 : 'Request-URI Too Large', + 415 : 'Unsupported Media Type', + 416 : 'Requested Range Not Satisfiable', + 417 : 'Expectation Failed', + 418 : 'I\'m a teapot', // RFC 2324 + 422 : 'Unprocessable Entity', // RFC 4918 + 423 : 'Locked', // RFC 4918 + 424 : 'Failed Dependency', // RFC 4918 + 425 : 'Unordered Collection', // RFC 4918 + 426 : 'Upgrade Required', // RFC 2817 + 428 : 'Precondition Required', // RFC 6585 + 429 : 'Too Many Requests', // RFC 6585 + 431 : 'Request Header Fields Too Large',// RFC 6585 + 500 : 'Internal Server Error', + 501 : 'Not Implemented', + 502 : 'Bad Gateway', + 503 : 'Service Unavailable', + 504 : 'Gateway Time-out', + 505 : 'HTTP Version Not Supported', + 506 : 'Variant Also Negotiates', // RFC 2295 + 507 : 'Insufficient Storage', // RFC 4918 + 509 : 'Bandwidth Limit Exceeded', + 510 : 'Not Extended', // RFC 2774 + 511 : 'Network Authentication Required' // RFC 6585 +}; /***/ }, /* 53 */ -/***/ function(module, exports) { +/***/ function(module, exports, __webpack_require__) { - /** - * Represents a permission overwrite for a role or member in a guild channel. - */ - class PermissionOverwrites { - constructor(guildChannel, data) { - /** - * The GuildChannel this overwrite is for - * @type {GuildChannel} - */ - this.channel = guildChannel; +"use strict"; +/* WEBPACK VAR INJECTION */(function(process) {'use strict'; - if (data) this.setup(data); - } +if (!process.version || + process.version.indexOf('v0.') === 0 || + process.version.indexOf('v1.') === 0 && process.version.indexOf('v1.8.') !== 0) { + module.exports = nextTick; +} else { + module.exports = process.nextTick; +} - setup(data) { - /** - * The ID of this overwrite, either a user ID or a role ID - * @type {string} - */ - this.id = data.id; - - /** - * The type of this overwrite - * @type {string} - */ - this.type = data.type; - - this.denyData = data.deny; - this.allowData = data.allow; - } - - /** - * Delete this Permission Overwrite. - * @returns {Promise} - */ - delete() { - return this.channel.client.rest.methods.deletePermissionOverwrites(this); - } - } - - module.exports = PermissionOverwrites; +function nextTick(fn, arg1, arg2, arg3) { + if (typeof fn !== 'function') { + throw new TypeError('"callback" argument must be a function'); + } + var len = arguments.length; + var args, i; + switch (len) { + case 0: + case 1: + return process.nextTick(fn); + case 2: + return process.nextTick(function afterTickOne() { + fn.call(null, arg1); + }); + case 3: + return process.nextTick(function afterTickTwo() { + fn.call(null, arg1, arg2); + }); + case 4: + return process.nextTick(function afterTickThree() { + fn.call(null, arg1, arg2, arg3); + }); + default: + args = new Array(len - 1); + i = 0; + while (i < args.length) { + args[i++] = arguments[i]; + } + return process.nextTick(function afterTick() { + fn.apply(null, args); + }); + } +} +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) /***/ }, /* 54 */ /***/ function(module, exports, __webpack_require__) { - const GuildChannel = __webpack_require__(52); - const Collection = __webpack_require__(10); +"use strict"; +// a transform stream is a readable/writable stream where you do +// something with the data. Sometimes it's called a "filter", +// but that's not a great name for it, since that implies a thing where +// some bits pass through, and others are simply ignored. (That would +// be a valid example of a transform, of course.) +// +// While the output is causally related to the input, it's not a +// necessarily symmetric or synchronous transformation. For example, +// a zlib stream might take multiple plain-text writes(), and then +// emit a single compressed chunk some time in the future. +// +// Here's how this works: +// +// The Transform stream has all the aspects of the readable and writable +// stream classes. When you write(chunk), that calls _write(chunk,cb) +// internally, and returns false if there's a lot of pending writes +// buffered up. When you call read(), that calls _read(n) until +// there's enough pending readable data buffered up. +// +// In a transform stream, the written data is placed in a buffer. When +// _read(n) is called, it transforms the queued up data, calling the +// buffered _write cb's as it consumes chunks. If consuming a single +// written chunk would result in multiple output chunks, then the first +// outputted bit calls the readcb, and subsequent chunks just go into +// the read buffer, and will cause it to emit 'readable' if necessary. +// +// This way, back-pressure is actually determined by the reading side, +// since _read has to be called to start processing a new chunk. However, +// a pathological inflate type of transform can cause excessive buffering +// here. For example, imagine a stream where every byte of input is +// interpreted as an integer from 0-255, and then results in that many +// bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in +// 1kb of data being output. In this case, you could write a very small +// amount of input, and end up with a very large amount of output. In +// such a pathological inflating mechanism, there'd be no way to tell +// the system to stop doing the transform. A single 4MB write could +// cause the system to run out of memory. +// +// However, even in such a pathological case, only a single written chunk +// would be consumed, and then the rest would wait (un-transformed) until +// the results of the previous transformed chunk were consumed. - /** - * Represents a guild voice channel on Discord. - * @extends {GuildChannel} - */ - class VoiceChannel extends GuildChannel { - constructor(guild, data) { - super(guild, data); +'use strict'; - /** - * The members in this voice channel. - * @type {Collection} - */ - this.members = new Collection(); +module.exports = Transform; - this.type = 'voice'; - } +var Duplex = __webpack_require__(15); - setup(data) { - super.setup(data); +/**/ +var util = __webpack_require__(25); +util.inherits = __webpack_require__(1); +/**/ - /** - * The bitrate of this voice channel - * @type {number} - */ - this.bitrate = data.bitrate; +util.inherits(Transform, Duplex); - /** - * The maximum amount of users allowed in this channel - 0 means unlimited. - * @type {number} - */ - this.userLimit = data.user_limit; - } +function TransformState(stream) { + this.afterTransform = function (er, data) { + return afterTransform(stream, er, data); + }; - /** - * The voice connection for this voice channel, if the client is connected - * @type {?VoiceConnection} - * @readonly - */ - get connection() { - const connection = this.guild.voiceConnection; - if (connection && connection.channel.id === this.id) return connection; - return null; - } + this.needTransform = false; + this.transforming = false; + this.writecb = null; + this.writechunk = null; + this.writeencoding = null; +} - /** - * Checks if the client has permission join the voice channel - * @type {boolean} - */ - get joinable() { - return this.permissionsFor(this.client.user).hasPermission('CONNECT'); - } +function afterTransform(stream, er, data) { + var ts = stream._transformState; + ts.transforming = false; - /** - * Checks if the client has permission to send audio to the voice channel - * @type {boolean} - */ - get speakable() { - return this.permissionsFor(this.client.user).hasPermission('SPEAK'); - } + var cb = ts.writecb; - /** - * Sets the bitrate of the channel - * @param {number} bitrate The new bitrate - * @returns {Promise} - * @example - * // set the bitrate of a voice channel - * voiceChannel.setBitrate(48000) - * .then(vc => console.log(`Set bitrate to ${vc.bitrate} for ${vc.name}`)) - * .catch(console.error); - */ - setBitrate(bitrate) { - return this.edit({ bitrate }); - } + if (!cb) return stream.emit('error', new Error('no writecb in Transform class')); - /** - * Sets the user limit of the channel - * @param {number} userLimit The new user limit - * @returns {Promise} - * @example - * // set the user limit of a voice channel - * voiceChannel.setUserLimit(42) - * .then(vc => console.log(`Set user limit to ${vc.userLimit} for ${vc.name}`)) - * .catch(console.error); - */ - setUserLimit(userLimit) { - return this.edit({ userLimit }); - } + ts.writechunk = null; + ts.writecb = null; - /** - * Attempts to join this voice channel - * @returns {Promise} - * @example - * // join a voice channel - * voiceChannel.join() - * .then(connection => console.log('Connected!')) - * .catch(console.error); - */ - join() { - return this.client.voice.joinChannel(this); - } + if (data !== null && data !== undefined) stream.push(data); - /** - * Leaves this voice channel - * @example - * // leave a voice channel - * voiceChannel.leave(); - */ - leave() { - const connection = this.client.voice.connections.get(this.guild.id); - if (connection && connection.channel.id === this.id) connection.disconnect(); - } - } + cb(er); - module.exports = VoiceChannel; + var rs = stream._readableState; + rs.reading = false; + if (rs.needReadable || rs.length < rs.highWaterMark) { + stream._read(rs.highWaterMark); + } +} +function Transform(options) { + if (!(this instanceof Transform)) return new Transform(options); + + Duplex.call(this, options); + + this._transformState = new TransformState(this); + + // when the writable side finishes, then flush out anything remaining. + var stream = this; + + // start out asking for a readable event once data is transformed. + this._readableState.needReadable = true; + + // we have implemented the _read method, and done the other things + // that Readable wants before the first _read call, so unset the + // sync guard flag. + this._readableState.sync = false; + + if (options) { + if (typeof options.transform === 'function') this._transform = options.transform; + + if (typeof options.flush === 'function') this._flush = options.flush; + } + + this.once('prefinish', function () { + if (typeof this._flush === 'function') this._flush(function (er) { + done(stream, er); + });else done(stream); + }); +} + +Transform.prototype.push = function (chunk, encoding) { + this._transformState.needTransform = false; + return Duplex.prototype.push.call(this, chunk, encoding); +}; + +// This is the part where you do stuff! +// override this function in implementation classes. +// 'chunk' is an input chunk. +// +// Call `push(newChunk)` to pass along transformed output +// to the readable side. You may call 'push' zero or more times. +// +// Call `cb(err)` when you are done with this chunk. If you pass +// an error, then that'll put the hurt on the whole operation. If you +// never call cb(), then you'll never get another chunk. +Transform.prototype._transform = function (chunk, encoding, cb) { + throw new Error('Not implemented'); +}; + +Transform.prototype._write = function (chunk, encoding, cb) { + var ts = this._transformState; + ts.writecb = cb; + ts.writechunk = chunk; + ts.writeencoding = encoding; + if (!ts.transforming) { + var rs = this._readableState; + if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark); + } +}; + +// Doesn't matter what the args are here. +// _transform does all the work. +// That we got here means that the readable side wants more data. +Transform.prototype._read = function (n) { + var ts = this._transformState; + + if (ts.writechunk !== null && ts.writecb && !ts.transforming) { + ts.transforming = true; + this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform); + } else { + // mark that we need a transform, so that any data that comes in + // will get processed, now that we've asked for it. + ts.needTransform = true; + } +}; + +function done(stream, er) { + if (er) return stream.emit('error', er); + + // if there's nothing in the write buffer, then that means + // that nothing more will ever be provided + var ws = stream._writableState; + var ts = stream._transformState; + + if (ws.length) throw new Error('Calling transform done when ws.length != 0'); + + if (ts.transforming) throw new Error('Calling transform done when still transforming'); + + return stream.push(null); +} /***/ }, /* 55 */ /***/ function(module, exports, __webpack_require__) { - const Channel = __webpack_require__(50); - const TextBasedChannel = __webpack_require__(14); - const Collection = __webpack_require__(10); - const arraysEqual = __webpack_require__(48); +"use strict"; +/* WEBPACK VAR INJECTION */(function(process, setImmediate) {// A bit simpler than readable streams. +// Implement an async ._write(chunk, encoding, cb), and it'll handle all +// the drain event emission and buffering. - /* - { type: 3, - recipients: - [ { username: 'Charlie', - id: '123', - discriminator: '6631', - avatar: '123' }, - { username: 'Ben', - id: '123', - discriminator: '2055', - avatar: '123' }, - { username: 'Adam', - id: '123', - discriminator: '2406', - avatar: '123' } ], - owner_id: '123', - name: null, - last_message_id: '123', - id: '123', - icon: null } - */ +'use strict'; - /** - * Represents a Group DM on Discord - * @extends {Channel} - * @implements {TextBasedChannel} - */ - class GroupDMChannel extends Channel { - constructor(client, data) { - super(client, data); - this.type = 'group'; - this.messages = new Collection(); - this._typing = new Map(); - } +module.exports = Writable; - setup(data) { - super.setup(data); +/**/ +var processNextTick = __webpack_require__(53); +/**/ - /** - * The name of this Group DM, can be null if one isn't set. - * @type {string} - */ - this.name = data.name; +/**/ +var asyncWrite = !process.browser && ['v0.10', 'v0.9.'].indexOf(process.version.slice(0, 5)) > -1 ? setImmediate : processNextTick; +/**/ - /** - * A hash of the Group DM icon. - * @type {string} - */ - this.icon = data.icon; +Writable.WritableState = WritableState; - /** - * The user ID of this Group DM's owner. - * @type {string} - */ - this.ownerID = data.owner_id; +/**/ +var util = __webpack_require__(25); +util.inherits = __webpack_require__(1); +/**/ - if (!this.recipients) { - /** - * A collection of the recipients of this DM, mapped by their ID. - * @type {Collection} - */ - this.recipients = new Collection(); - } +/**/ +var internalUtil = { + deprecate: __webpack_require__(232) +}; +/**/ - if (data.recipients) { - for (const recipient of data.recipients) { - const user = this.client.dataManager.newUser(recipient); - this.recipients.set(user.id, user); - } - } +/**/ +var Stream; +(function () { + try { + Stream = __webpack_require__(9); + } catch (_) {} finally { + if (!Stream) Stream = __webpack_require__(3).EventEmitter; + } +})(); +/**/ - this.lastMessageID = data.last_message_id; - } +var Buffer = __webpack_require__(0).Buffer; +/**/ +var bufferShim = __webpack_require__(49); +/**/ - /** - * The owner of this Group DM. - * @type {User} - * @readonly - */ - get owner() { - return this.client.users.get(this.ownerID); - } +util.inherits(Writable, Stream); - /** - * Whether this channel equals another channel. It compares all properties, so for most operations - * it is advisable to just compare `channel.id === channel2.id` as it is much faster and is often - * what most users need. - * @param {GroupDMChannel} channel The channel to compare to - * @returns {boolean} - */ - equals(channel) { - const equal = channel && - this.id === channel.id && - this.name === channel.name && - this.icon === channel.icon && - this.ownerID === channel.ownerID; +function nop() {} - if (equal) { - const thisIDs = this.recipients.keyArray(); - const otherIDs = channel.recipients.keyArray(); - return arraysEqual(thisIDs, otherIDs); - } +function WriteReq(chunk, encoding, cb) { + this.chunk = chunk; + this.encoding = encoding; + this.callback = cb; + this.next = null; +} - return equal; - } +var Duplex; +function WritableState(options, stream) { + Duplex = Duplex || __webpack_require__(15); - /** - * When concatenated with a string, this automatically concatenates the channel's name instead of the Channel object. - * @returns {string} - * @example - * // logs: Hello from My Group DM! - * console.log(`Hello from ${channel}!`); - * @example - * // logs: Hello from My Group DM! - * console.log(`Hello from ' + channel + '!'); - */ - toString() { - return this.name; - } + options = options || {}; - // These are here only for documentation purposes - they are implemented by TextBasedChannel - sendMessage() { return; } - sendTTSMessage() { return; } - sendFile() { return; } - sendCode() { return; } - fetchMessage() { return; } - fetchMessages() { return; } - fetchPinnedMessages() { return; } - startTyping() { return; } - stopTyping() { return; } - get typing() { return; } - get typingCount() { return; } - createCollector() { return; } - awaitMessages() { return; } - bulkDelete() { return; } - _cacheMessage() { return; } - } + // object stream flag to indicate whether or not this stream + // contains buffers or objects. + this.objectMode = !!options.objectMode; - TextBasedChannel.applyToClass(GroupDMChannel, true); + if (stream instanceof Duplex) this.objectMode = this.objectMode || !!options.writableObjectMode; - module.exports = GroupDMChannel; + // the point at which write() starts returning false + // Note: 0 is a valid value, means that we always return false if + // the entire buffer is not flushed immediately on write() + var hwm = options.highWaterMark; + var defaultHwm = this.objectMode ? 16 : 16 * 1024; + this.highWaterMark = hwm || hwm === 0 ? hwm : defaultHwm; + // cast to ints. + this.highWaterMark = ~ ~this.highWaterMark; + + this.needDrain = false; + // at the start of calling end() + this.ending = false; + // when end() has been called, and returned + this.ended = false; + // when 'finish' is emitted + this.finished = false; + + // should we decode strings into buffers before passing to _write? + // this is here so that some node-core streams can optimize string + // handling at a lower level. + var noDecode = options.decodeStrings === false; + this.decodeStrings = !noDecode; + + // Crypto is kind of old and crusty. Historically, its default string + // encoding is 'binary' so we have to make this configurable. + // Everything else in the universe uses 'utf8', though. + this.defaultEncoding = options.defaultEncoding || 'utf8'; + + // not an actual buffer we keep track of, but a measurement + // of how much we're waiting to get pushed to some underlying + // socket or file. + this.length = 0; + + // a flag to see when we're in the middle of a write. + this.writing = false; + + // when true all writes will be buffered until .uncork() call + this.corked = 0; + + // a flag to be able to tell if the onwrite cb is called immediately, + // or on a later tick. We set this to true at first, because any + // actions that shouldn't happen until "later" should generally also + // not happen before the first write call. + this.sync = true; + + // a flag to know if we're processing previously buffered items, which + // may call the _write() callback in the same tick, so that we don't + // end up in an overlapped onwrite situation. + this.bufferProcessing = false; + + // the callback that's passed to _write(chunk,cb) + this.onwrite = function (er) { + onwrite(stream, er); + }; + + // the callback that the user supplies to write(chunk,encoding,cb) + this.writecb = null; + + // the amount that is being written when _write is called. + this.writelen = 0; + + this.bufferedRequest = null; + this.lastBufferedRequest = null; + + // number of pending user-supplied write callbacks + // this must be 0 before 'finish' can be emitted + this.pendingcb = 0; + + // emit prefinish if the only thing we're waiting for is _write cbs + // This is relevant for synchronous Transform streams + this.prefinished = false; + + // True if the error was already emitted and should not be thrown again + this.errorEmitted = false; + + // count buffered requests + this.bufferedRequestCount = 0; + + // allocate the first CorkedRequest, there is always + // one allocated and free to use, and we maintain at most two + this.corkedRequestsFree = new CorkedRequest(this); +} + +WritableState.prototype.getBuffer = function writableStateGetBuffer() { + var current = this.bufferedRequest; + var out = []; + while (current) { + out.push(current); + current = current.next; + } + return out; +}; + +(function () { + try { + Object.defineProperty(WritableState.prototype, 'buffer', { + get: internalUtil.deprecate(function () { + return this.getBuffer(); + }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.') + }); + } catch (_) {} +})(); + +var Duplex; +function Writable(options) { + Duplex = Duplex || __webpack_require__(15); + + // Writable ctor is applied to Duplexes, though they're not + // instanceof Writable, they're instanceof Readable. + if (!(this instanceof Writable) && !(this instanceof Duplex)) return new Writable(options); + + this._writableState = new WritableState(options, this); + + // legacy. + this.writable = true; + + if (options) { + if (typeof options.write === 'function') this._write = options.write; + + if (typeof options.writev === 'function') this._writev = options.writev; + } + + Stream.call(this); +} + +// Otherwise people can pipe Writable streams, which is just wrong. +Writable.prototype.pipe = function () { + this.emit('error', new Error('Cannot pipe, not readable')); +}; + +function writeAfterEnd(stream, cb) { + var er = new Error('write after end'); + // TODO: defer error events consistently everywhere, not just the cb + stream.emit('error', er); + processNextTick(cb, er); +} + +// If we get something that is not a buffer, string, null, or undefined, +// and we're not in objectMode, then that's an error. +// Otherwise stream chunks are all considered to be of length=1, and the +// watermarks determine how many objects to keep in the buffer, rather than +// how many bytes or characters. +function validChunk(stream, state, chunk, cb) { + var valid = true; + var er = false; + // Always throw error if a null is written + // if we are not in object mode then throw + // if it is not a buffer, string, or undefined. + if (chunk === null) { + er = new TypeError('May not write null values to stream'); + } else if (!Buffer.isBuffer(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) { + er = new TypeError('Invalid non-string/buffer chunk'); + } + if (er) { + stream.emit('error', er); + processNextTick(cb, er); + valid = false; + } + return valid; +} + +Writable.prototype.write = function (chunk, encoding, cb) { + var state = this._writableState; + var ret = false; + + if (typeof encoding === 'function') { + cb = encoding; + encoding = null; + } + + if (Buffer.isBuffer(chunk)) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding; + + if (typeof cb !== 'function') cb = nop; + + if (state.ended) writeAfterEnd(this, cb);else if (validChunk(this, state, chunk, cb)) { + state.pendingcb++; + ret = writeOrBuffer(this, state, chunk, encoding, cb); + } + + return ret; +}; + +Writable.prototype.cork = function () { + var state = this._writableState; + + state.corked++; +}; + +Writable.prototype.uncork = function () { + var state = this._writableState; + + if (state.corked) { + state.corked--; + + if (!state.writing && !state.corked && !state.finished && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state); + } +}; + +Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) { + // node::ParseEncoding() requires lower case. + if (typeof encoding === 'string') encoding = encoding.toLowerCase(); + if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64', 'ucs2', 'ucs-2', 'utf16le', 'utf-16le', 'raw'].indexOf((encoding + '').toLowerCase()) > -1)) throw new TypeError('Unknown encoding: ' + encoding); + this._writableState.defaultEncoding = encoding; + return this; +}; + +function decodeChunk(state, chunk, encoding) { + if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') { + chunk = bufferShim.from(chunk, encoding); + } + return chunk; +} + +// if we're already writing something, then just put this +// in the queue, and wait our turn. Otherwise, call _write +// If we return false, then we need a drain event, so set that flag. +function writeOrBuffer(stream, state, chunk, encoding, cb) { + chunk = decodeChunk(state, chunk, encoding); + + if (Buffer.isBuffer(chunk)) encoding = 'buffer'; + var len = state.objectMode ? 1 : chunk.length; + + state.length += len; + + var ret = state.length < state.highWaterMark; + // we must ensure that previous needDrain will not be reset to false. + if (!ret) state.needDrain = true; + + if (state.writing || state.corked) { + var last = state.lastBufferedRequest; + state.lastBufferedRequest = new WriteReq(chunk, encoding, cb); + if (last) { + last.next = state.lastBufferedRequest; + } else { + state.bufferedRequest = state.lastBufferedRequest; + } + state.bufferedRequestCount += 1; + } else { + doWrite(stream, state, false, len, chunk, encoding, cb); + } + + return ret; +} + +function doWrite(stream, state, writev, len, chunk, encoding, cb) { + state.writelen = len; + state.writecb = cb; + state.writing = true; + state.sync = true; + if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite); + state.sync = false; +} + +function onwriteError(stream, state, sync, er, cb) { + --state.pendingcb; + if (sync) processNextTick(cb, er);else cb(er); + + stream._writableState.errorEmitted = true; + stream.emit('error', er); +} + +function onwriteStateUpdate(state) { + state.writing = false; + state.writecb = null; + state.length -= state.writelen; + state.writelen = 0; +} + +function onwrite(stream, er) { + var state = stream._writableState; + var sync = state.sync; + var cb = state.writecb; + + onwriteStateUpdate(state); + + if (er) onwriteError(stream, state, sync, er, cb);else { + // Check if we're actually ready to finish, but don't emit yet + var finished = needFinish(state); + + if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) { + clearBuffer(stream, state); + } + + if (sync) { + /**/ + asyncWrite(afterWrite, stream, state, finished, cb); + /**/ + } else { + afterWrite(stream, state, finished, cb); + } + } +} + +function afterWrite(stream, state, finished, cb) { + if (!finished) onwriteDrain(stream, state); + state.pendingcb--; + cb(); + finishMaybe(stream, state); +} + +// Must force callback to be called on nextTick, so that we don't +// emit 'drain' before the write() consumer gets the 'false' return +// value, and has a chance to attach a 'drain' listener. +function onwriteDrain(stream, state) { + if (state.length === 0 && state.needDrain) { + state.needDrain = false; + stream.emit('drain'); + } +} + +// if there's something in the buffer waiting, then process it +function clearBuffer(stream, state) { + state.bufferProcessing = true; + var entry = state.bufferedRequest; + + if (stream._writev && entry && entry.next) { + // Fast case, write everything using _writev() + var l = state.bufferedRequestCount; + var buffer = new Array(l); + var holder = state.corkedRequestsFree; + holder.entry = entry; + + var count = 0; + while (entry) { + buffer[count] = entry; + entry = entry.next; + count += 1; + } + + doWrite(stream, state, true, state.length, buffer, '', holder.finish); + + // doWrite is almost always async, defer these to save a bit of time + // as the hot path ends with doWrite + state.pendingcb++; + state.lastBufferedRequest = null; + if (holder.next) { + state.corkedRequestsFree = holder.next; + holder.next = null; + } else { + state.corkedRequestsFree = new CorkedRequest(state); + } + } else { + // Slow case, write chunks one-by-one + while (entry) { + var chunk = entry.chunk; + var encoding = entry.encoding; + var cb = entry.callback; + var len = state.objectMode ? 1 : chunk.length; + + doWrite(stream, state, false, len, chunk, encoding, cb); + entry = entry.next; + // if we didn't call the onwrite immediately, then + // it means that we need to wait until it does. + // also, that means that the chunk and cb are currently + // being processed, so move the buffer counter past them. + if (state.writing) { + break; + } + } + + if (entry === null) state.lastBufferedRequest = null; + } + + state.bufferedRequestCount = 0; + state.bufferedRequest = entry; + state.bufferProcessing = false; +} + +Writable.prototype._write = function (chunk, encoding, cb) { + cb(new Error('not implemented')); +}; + +Writable.prototype._writev = null; + +Writable.prototype.end = function (chunk, encoding, cb) { + var state = this._writableState; + + if (typeof chunk === 'function') { + cb = chunk; + chunk = null; + encoding = null; + } else if (typeof encoding === 'function') { + cb = encoding; + encoding = null; + } + + if (chunk !== null && chunk !== undefined) this.write(chunk, encoding); + + // .end() fully uncorks + if (state.corked) { + state.corked = 1; + this.uncork(); + } + + // ignore unnecessary end() calls. + if (!state.ending && !state.finished) endWritable(this, state, cb); +}; + +function needFinish(state) { + return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing; +} + +function prefinish(stream, state) { + if (!state.prefinished) { + state.prefinished = true; + stream.emit('prefinish'); + } +} + +function finishMaybe(stream, state) { + var need = needFinish(state); + if (need) { + if (state.pendingcb === 0) { + prefinish(stream, state); + state.finished = true; + stream.emit('finish'); + } else { + prefinish(stream, state); + } + } + return need; +} + +function endWritable(stream, state, cb) { + state.ending = true; + finishMaybe(stream, state); + if (cb) { + if (state.finished) processNextTick(cb);else stream.once('finish', cb); + } + state.ended = true; + stream.writable = false; +} + +// It seems a linked list but it is not +// there will be only 2 of these for each stream +function CorkedRequest(state) { + var _this = this; + + this.next = null; + this.entry = null; + + this.finish = function (err) { + var entry = _this.entry; + _this.entry = null; + while (entry) { + var cb = entry.callback; + state.pendingcb--; + cb(err); + entry = entry.next; + } + if (state.corkedRequestsFree) { + state.corkedRequestsFree.next = _this; + } else { + state.corkedRequestsFree = _this; + } + }; +} +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5), __webpack_require__(58).setImmediate)) /***/ }, /* 56 */ /***/ function(module, exports, __webpack_require__) { - const Constants = __webpack_require__(5); +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. - /** - * Manages the State and Background Tasks of the Client - * @private - */ - class ClientManager { - constructor(client) { - /** - * The Client that instantiated this Manager - * @type {Client} - */ - this.client = client; +var Buffer = __webpack_require__(0).Buffer; - /** - * The heartbeat interval, null if not yet set - * @type {?number} - */ - this.heartbeatInterval = null; - } +var isBufferEncoding = Buffer.isEncoding + || function(encoding) { + switch (encoding && encoding.toLowerCase()) { + case 'hex': case 'utf8': case 'utf-8': case 'ascii': case 'binary': case 'base64': case 'ucs2': case 'ucs-2': case 'utf16le': case 'utf-16le': case 'raw': return true; + default: return false; + } + } - /** - * Connects the Client to the WebSocket - * @param {string} token The authorization token - * @param {Function} resolve Function to run when connection is successful - * @param {Function} reject Function to run when connection fails - */ - connectToWebSocket(token, resolve, reject) { - this.client.emit(Constants.Events.DEBUG, `Authenticated using token ${token}`); - this.client.token = token; - const timeout = this.client.setTimeout(() => reject(new Error(Constants.Errors.TOOK_TOO_LONG)), 1000 * 300); - this.client.rest.methods.getGateway().then(gateway => { - this.client.emit(Constants.Events.DEBUG, `Using gateway ${gateway}`); - this.client.ws.connect(gateway); - this.client.ws.once('close', event => { - if (event.code === 4004) reject(new Error(Constants.Errors.BAD_LOGIN)); - if (event.code === 4010) reject(new Error(Constants.Errors.INVALID_SHARD)); - }); - this.client.once(Constants.Events.READY, () => { - resolve(token); - this.client.clearTimeout(timeout); - }); - }, reject); - } - /** - * Sets up a keep-alive interval to keep the Client's connection valid - * @param {number} time The interval in milliseconds at which heartbeat packets should be sent - */ - setupKeepAlive(time) { - this.heartbeatInterval = this.client.setInterval(() => { - this.client.emit('debug', 'Sending heartbeat'); - this.client.ws.send({ - op: Constants.OPCodes.HEARTBEAT, - d: this.client.ws.sequence, - }, true); - }, time); - } +function assertEncoding(encoding) { + if (encoding && !isBufferEncoding(encoding)) { + throw new Error('Unknown encoding: ' + encoding); + } +} - destroy() { - return new Promise(resolve => { - this.client.ws.destroy(); - if (!this.client.user.bot) { - resolve(this.client.rest.methods.logout()); - } else { - resolve(); - } - }); - } - } +// StringDecoder provides an interface for efficiently splitting a series of +// buffers into a series of JS strings without breaking apart multi-byte +// characters. CESU-8 is handled as part of the UTF-8 encoding. +// +// @TODO Handling all encodings inside a single object makes it very difficult +// to reason about this code, so it should be split up in the future. +// @TODO There should be a utf8-strict encoding that rejects invalid UTF-8 code +// points as used by CESU-8. +var StringDecoder = exports.StringDecoder = function(encoding) { + this.encoding = (encoding || 'utf8').toLowerCase().replace(/[-_]/, ''); + assertEncoding(encoding); + switch (this.encoding) { + case 'utf8': + // CESU-8 represents each of Surrogate Pair by 3-bytes + this.surrogateSize = 3; + break; + case 'ucs2': + case 'utf16le': + // UTF-16 represents each of Surrogate Pair by 2-bytes + this.surrogateSize = 2; + this.detectIncompleteChar = utf16DetectIncompleteChar; + break; + case 'base64': + // Base-64 stores 3 bytes in 4 chars, and pads the remainder. + this.surrogateSize = 3; + this.detectIncompleteChar = base64DetectIncompleteChar; + break; + default: + this.write = passThroughWrite; + return; + } - module.exports = ClientManager; + // Enough space to store all bytes of a single character. UTF-8 needs 4 + // bytes, but CESU-8 may require up to 6 (3 bytes per surrogate). + this.charBuffer = new Buffer(6); + // Number of bytes received for the current incomplete multi-byte character. + this.charReceived = 0; + // Number of bytes expected for the current incomplete multi-byte character. + this.charLength = 0; +}; + + +// write decodes the given buffer and returns it as JS string that is +// guaranteed to not contain any partial multi-byte characters. Any partial +// character found at the end of the buffer is buffered up, and will be +// returned when calling write again with the remaining bytes. +// +// Note: Converting a Buffer containing an orphan surrogate to a String +// currently works, but converting a String to a Buffer (via `new Buffer`, or +// Buffer#write) will replace incomplete surrogates with the unicode +// replacement character. See https://codereview.chromium.org/121173009/ . +StringDecoder.prototype.write = function(buffer) { + var charStr = ''; + // if our last write ended with an incomplete multibyte character + while (this.charLength) { + // determine how many remaining bytes this buffer has to offer for this char + var available = (buffer.length >= this.charLength - this.charReceived) ? + this.charLength - this.charReceived : + buffer.length; + + // add the new bytes to the char buffer + buffer.copy(this.charBuffer, this.charReceived, 0, available); + this.charReceived += available; + + if (this.charReceived < this.charLength) { + // still not enough chars in this buffer? wait for more ... + return ''; + } + + // remove bytes belonging to the current character from the buffer + buffer = buffer.slice(available, buffer.length); + + // get the character that was split + charStr = this.charBuffer.slice(0, this.charLength).toString(this.encoding); + + // CESU-8: lead surrogate (D800-DBFF) is also the incomplete character + var charCode = charStr.charCodeAt(charStr.length - 1); + if (charCode >= 0xD800 && charCode <= 0xDBFF) { + this.charLength += this.surrogateSize; + charStr = ''; + continue; + } + this.charReceived = this.charLength = 0; + + // if there are no more bytes in this buffer, just emit our char + if (buffer.length === 0) { + return charStr; + } + break; + } + + // determine and set charLength / charReceived + this.detectIncompleteChar(buffer); + + var end = buffer.length; + if (this.charLength) { + // buffer the incomplete character bytes we got + buffer.copy(this.charBuffer, 0, buffer.length - this.charReceived, end); + end -= this.charReceived; + } + + charStr += buffer.toString(this.encoding, 0, end); + + var end = charStr.length - 1; + var charCode = charStr.charCodeAt(end); + // CESU-8: lead surrogate (D800-DBFF) is also the incomplete character + if (charCode >= 0xD800 && charCode <= 0xDBFF) { + var size = this.surrogateSize; + this.charLength += size; + this.charReceived += size; + this.charBuffer.copy(this.charBuffer, size, 0, size); + buffer.copy(this.charBuffer, 0, 0, size); + return charStr.substring(0, end); + } + + // or just emit the charStr + return charStr; +}; + +// detectIncompleteChar determines if there is an incomplete UTF-8 character at +// the end of the given buffer. If so, it sets this.charLength to the byte +// length that character, and sets this.charReceived to the number of bytes +// that are available for this character. +StringDecoder.prototype.detectIncompleteChar = function(buffer) { + // determine how many bytes we have to check at the end of this buffer + var i = (buffer.length >= 3) ? 3 : buffer.length; + + // Figure out if one of the last i bytes of our buffer announces an + // incomplete char. + for (; i > 0; i--) { + var c = buffer[buffer.length - i]; + + // See http://en.wikipedia.org/wiki/UTF-8#Description + + // 110XXXXX + if (i == 1 && c >> 5 == 0x06) { + this.charLength = 2; + break; + } + + // 1110XXXX + if (i <= 2 && c >> 4 == 0x0E) { + this.charLength = 3; + break; + } + + // 11110XXX + if (i <= 3 && c >> 3 == 0x1E) { + this.charLength = 4; + break; + } + } + this.charReceived = i; +}; + +StringDecoder.prototype.end = function(buffer) { + var res = ''; + if (buffer && buffer.length) + res = this.write(buffer); + + if (this.charReceived) { + var cr = this.charReceived; + var buf = this.charBuffer; + var enc = this.encoding; + res += buf.slice(0, cr).toString(enc); + } + + return res; +}; + +function passThroughWrite(buffer) { + return buffer.toString(this.encoding); +} + +function utf16DetectIncompleteChar(buffer) { + this.charReceived = buffer.length % 2; + this.charLength = this.charReceived ? 2 : 0; +} + +function base64DetectIncompleteChar(buffer) { + this.charReceived = buffer.length % 3; + this.charLength = this.charReceived ? 3 : 0; +} /***/ }, /* 57 */ /***/ function(module, exports, __webpack_require__) { - /* WEBPACK VAR INJECTION */(function(Buffer) {const path = __webpack_require__(15); - const fs = __webpack_require__(62); - const request = __webpack_require__(40); +/** + * Root reference for iframes. + */ - const Constants = __webpack_require__(5); - const convertArrayBuffer = __webpack_require__(63); - const User = __webpack_require__(13); - const Message = __webpack_require__(16); - const Guild = __webpack_require__(47); - const Channel = __webpack_require__(50); - const GuildMember = __webpack_require__(25); - const Emoji = __webpack_require__(21); - const ReactionEmoji = __webpack_require__(22); +var root; +if (typeof window !== 'undefined') { // Browser window + root = window; +} else if (typeof self !== 'undefined') { // Web Worker + root = self; +} else { // Other environments + console.warn("Using browser-only version of superagent in non-browser environment"); + root = this; +} - /** - * The DataResolver identifies different objects and tries to resolve a specific piece of information from them, e.g. - * extracting a User from a Message object. - * @private - */ - class ClientDataResolver { - /** - * @param {Client} client The client the resolver is for - */ - constructor(client) { - this.client = client; - } +var Emitter = __webpack_require__(161); +var RequestBase = __webpack_require__(227); +var isObject = __webpack_require__(115); - /** - * Data that resolves to give a User object. This can be: - * * A User object - * * A user ID - * * A Message object (resolves to the message author) - * * A Guild object (owner of the guild) - * * A GuildMember object - * @typedef {User|string|Message|Guild|GuildMember} UserResolvable - */ +/** + * Noop. + */ - /** - * Resolves a UserResolvable to a User object - * @param {UserResolvable} user The UserResolvable to identify - * @returns {?User} - */ - resolveUser(user) { - if (user instanceof User) return user; - if (typeof user === 'string') return this.client.users.get(user) || null; - if (user instanceof GuildMember) return user.user; - if (user instanceof Message) return user.author; - if (user instanceof Guild) return user.owner; - return null; - } +function noop(){}; - /** - * Resolves a UserResolvable to a user ID string - * @param {UserResolvable} user The UserResolvable to identify - * @returns {?string} - */ - resolveUserID(user) { - if (user instanceof User || user instanceof GuildMember) return user.id; - if (typeof user === 'string') return user || null; - if (user instanceof Message) return user.author.id; - if (user instanceof Guild) return user.ownerID; - return null; - } +/** + * Expose `request`. + */ - /** - * Data that resolves to give a Guild object. This can be: - * * A Guild object - * @typedef {Guild} GuildResolvable - */ +var request = module.exports = __webpack_require__(228).bind(null, Request); - /** - * Resolves a GuildResolvable to a Guild object - * @param {GuildResolvable} guild The GuildResolvable to identify - * @returns {?Guild} - */ - resolveGuild(guild) { - if (guild instanceof Guild) return guild; - if (typeof guild === 'string') return this.client.guilds.get(guild) || null; - return null; - } +/** + * Determine XHR. + */ - /** - * Data that resolves to give a GuildMember object. This can be: - * * A GuildMember object - * * A User object - * @typedef {Guild} GuildMemberResolvable - */ +request.getXHR = function () { + if (root.XMLHttpRequest + && (!root.location || 'file:' != root.location.protocol + || !root.ActiveXObject)) { + return new XMLHttpRequest; + } else { + try { return new ActiveXObject('Microsoft.XMLHTTP'); } catch(e) {} + try { return new ActiveXObject('Msxml2.XMLHTTP.6.0'); } catch(e) {} + try { return new ActiveXObject('Msxml2.XMLHTTP.3.0'); } catch(e) {} + try { return new ActiveXObject('Msxml2.XMLHTTP'); } catch(e) {} + } + throw Error("Browser-only verison of superagent could not find XHR"); +}; - /** - * Resolves a GuildMemberResolvable to a GuildMember object - * @param {GuildResolvable} guild The guild that the member is part of - * @param {UserResolvable} user The user that is part of the guild - * @returns {?GuildMember} - */ - resolveGuildMember(guild, user) { - if (user instanceof GuildMember) return user; - guild = this.resolveGuild(guild); - user = this.resolveUser(user); - if (!guild || !user) return null; - return guild.members.get(user.id) || null; - } +/** + * Removes leading and trailing whitespace, added to support IE. + * + * @param {String} s + * @return {String} + * @api private + */ - /** - * Data that can be resolved to give a Channel. This can be: - * * A Channel object - * * A Message object (the channel the message was sent in) - * * A Guild object (the #general channel) - * * A channel ID - * @typedef {Channel|Guild|Message|string} ChannelResolvable - */ +var trim = ''.trim + ? function(s) { return s.trim(); } + : function(s) { return s.replace(/(^\s*|\s*$)/g, ''); }; - /** - * Resolves a ChannelResolvable to a Channel object - * @param {ChannelResolvable} channel The channel resolvable to resolve - * @returns {?Channel} - */ - resolveChannel(channel) { - if (channel instanceof Channel) return channel; - if (channel instanceof Message) return channel.channel; - if (channel instanceof Guild) return channel.channels.get(channel.id) || null; - if (typeof channel === 'string') return this.client.channels.get(channel) || null; - return null; - } +/** + * Serialize the given `obj`. + * + * @param {Object} obj + * @return {String} + * @api private + */ - /** - * Data that can be resolved to give an invite code. This can be: - * * An invite code - * * An invite URL - * @typedef {string} InviteResolvable - */ +function serialize(obj) { + if (!isObject(obj)) return obj; + var pairs = []; + for (var key in obj) { + pushEncodedKeyValuePair(pairs, key, obj[key]); + } + return pairs.join('&'); +} - /** - * Resolves InviteResolvable to an invite code - * @param {InviteResolvable} data The invite resolvable to resolve - * @returns {string} - */ - resolveInviteCode(data) { - const inviteRegex = /discord(?:app)?\.(?:gg|com\/invite)\/([a-z0-9]{5})/i; - const match = inviteRegex.exec(data); - if (match && match[1]) return match[1]; - return data; - } +/** + * Helps 'serialize' with serializing arrays. + * Mutates the pairs array. + * + * @param {Array} pairs + * @param {String} key + * @param {Mixed} val + */ - /** - * Data that can be resolved to give a permission number. This can be: - * * A string - * * A permission number - * - * Possible strings: - * ```js - * [ - * "CREATE_INSTANT_INVITE", - * "KICK_MEMBERS", - * "BAN_MEMBERS", - * "ADMINISTRATOR", - * "MANAGE_CHANNELS", - * "MANAGE_GUILD", - * "ADD_REACTIONS", // add reactions to messages - * "READ_MESSAGES", - * "SEND_MESSAGES", - * "SEND_TTS_MESSAGES", - * "MANAGE_MESSAGES", - * "EMBED_LINKS", - * "ATTACH_FILES", - * "READ_MESSAGE_HISTORY", - * "MENTION_EVERYONE", - * "EXTERNAL_EMOJIS", // use external emojis - * "CONNECT", // connect to voice - * "SPEAK", // speak on voice - * "MUTE_MEMBERS", // globally mute members on voice - * "DEAFEN_MEMBERS", // globally deafen members on voice - * "MOVE_MEMBERS", // move member's voice channels - * "USE_VAD", // use voice activity detection - * "CHANGE_NICKNAME", - * "MANAGE_NICKNAMES", // change nicknames of others - * "MANAGE_ROLES_OR_PERMISSIONS" - * ] - * ``` - * @typedef {string|number} PermissionResolvable - */ +function pushEncodedKeyValuePair(pairs, key, val) { + if (val != null) { + if (Array.isArray(val)) { + val.forEach(function(v) { + pushEncodedKeyValuePair(pairs, key, v); + }); + } else if (isObject(val)) { + for(var subkey in val) { + pushEncodedKeyValuePair(pairs, key + '[' + subkey + ']', val[subkey]); + } + } else { + pairs.push(encodeURIComponent(key) + + '=' + encodeURIComponent(val)); + } + } else if (val === null) { + pairs.push(encodeURIComponent(key)); + } +} - /** - * Resolves a PermissionResolvable to a permission number - * @param {PermissionResolvable} permission The permission resolvable to resolve - * @returns {number} - */ - resolvePermission(permission) { - if (typeof permission === 'string') permission = Constants.PermissionFlags[permission]; - if (typeof permission !== 'number' || permission < 1) throw new Error(Constants.Errors.NOT_A_PERMISSION); - return permission; - } +/** + * Expose serialization method. + */ - /** - * Data that can be resolved to give a string. This can be: - * * A string - * * An array (joined with a new line delimiter to give a string) - * * Any value - * @typedef {string|Array|*} StringResolvable - */ + request.serializeObject = serialize; - /** - * Resolves a StringResolvable to a string - * @param {StringResolvable} data The string resolvable to resolve - * @returns {string} - */ - resolveString(data) { - if (typeof data === 'string') return data; - if (data instanceof Array) return data.join('\n'); - return String(data); - } + /** + * Parse the given x-www-form-urlencoded `str`. + * + * @param {String} str + * @return {Object} + * @api private + */ - /** - * Data that resolves to give a Base64 string, typically for image uploading. This can be: - * * A Buffer - * * A base64 string - * @typedef {Buffer|string} Base64Resolvable - */ +function parseString(str) { + var obj = {}; + var pairs = str.split('&'); + var pair; + var pos; - /** - * Resolves a Base64Resolvable to a Base 64 image - * @param {Base64Resolvable} data The base 64 resolvable you want to resolve - * @returns {?string} - */ - resolveBase64(data) { - if (data instanceof Buffer) return `data:image/jpg;base64,${data.toString('base64')}`; - return data; - } + for (var i = 0, len = pairs.length; i < len; ++i) { + pair = pairs[i]; + pos = pair.indexOf('='); + if (pos == -1) { + obj[decodeURIComponent(pair)] = ''; + } else { + obj[decodeURIComponent(pair.slice(0, pos))] = + decodeURIComponent(pair.slice(pos + 1)); + } + } - /** - * Data that can be resolved to give a Buffer. This can be: - * * A Buffer - * * The path to a local file - * * A URL - * @typedef {string|Buffer} BufferResolvable - */ + return obj; +} - /** - * Resolves a BufferResolvable to a Buffer - * @param {BufferResolvable} resource The buffer resolvable to resolve - * @returns {Promise} - */ - resolveBuffer(resource) { - if (resource instanceof Buffer) return Promise.resolve(resource); - if (this.client.browser && resource instanceof ArrayBuffer) return Promise.resolve(convertArrayBuffer(resource)); +/** + * Expose parser. + */ - if (typeof resource === 'string') { - return new Promise((resolve, reject) => { - if (/^https?:\/\//.test(resource)) { - const req = request.get(resource).set('Content-Type', 'blob'); - if (this.client.browser) req.responseType('arraybuffer'); - req.end((err, res) => { - if (err) return reject(err); - if (this.client.browser) return resolve(convertArrayBuffer(res.xhr.response)); - if (!(res.body instanceof Buffer)) return reject(new TypeError('Body is not a Buffer')); - return resolve(res.body); - }); - } else { - const file = path.resolve(resource); - fs.stat(file, (err, stats) => { - if (err) reject(err); - if (!stats || !stats.isFile()) throw new Error(`The file could not be found: ${file}`); - fs.readFile(file, (err2, data) => { - if (err2) reject(err2); else resolve(data); - }); - }); - } - }); - } +request.parseString = parseString; - return Promise.reject(new TypeError('The resource must be a string or Buffer.')); - } +/** + * Default MIME type map. + * + * superagent.types.xml = 'application/xml'; + * + */ - /** - * Data that can be resolved to give an emoji identifier. This can be: - * * A string - * * An Emoji - * * A ReactionEmoji - * @typedef {string|Emoji|ReactionEmoji} EmojiIdentifierResolvable - */ +request.types = { + html: 'text/html', + json: 'application/json', + xml: 'application/xml', + urlencoded: 'application/x-www-form-urlencoded', + 'form': 'application/x-www-form-urlencoded', + 'form-data': 'application/x-www-form-urlencoded' +}; - /** - * Resolves an EmojiResolvable to an emoji identifier - * @param {EmojiIdentifierResolvable} emoji The emoji resolvable to resolve - * @returns {string} - */ - resolveEmojiIdentifier(emoji) { - if (emoji instanceof Emoji || emoji instanceof ReactionEmoji) return emoji.identifier; - if (typeof emoji === 'string') { - if (!emoji.includes('%')) return encodeURIComponent(emoji); - } - return null; - } - } +/** + * Default serialization map. + * + * superagent.serialize['application/xml'] = function(obj){ + * return 'generated xml here'; + * }; + * + */ - module.exports = ClientDataResolver; + request.serialize = { + 'application/x-www-form-urlencoded': serialize, + 'application/json': JSON.stringify + }; + + /** + * Default parsers. + * + * superagent.parse['application/xml'] = function(str){ + * return { object parsed from str }; + * }; + * + */ + +request.parse = { + 'application/x-www-form-urlencoded': parseString, + 'application/json': JSON.parse +}; + +/** + * Parse the given header `str` into + * an object containing the mapped fields. + * + * @param {String} str + * @return {Object} + * @api private + */ + +function parseHeader(str) { + var lines = str.split(/\r?\n/); + var fields = {}; + var index; + var line; + var field; + var val; + + lines.pop(); // trailing CRLF + + for (var i = 0, len = lines.length; i < len; ++i) { + line = lines[i]; + index = line.indexOf(':'); + field = line.slice(0, index).toLowerCase(); + val = trim(line.slice(index + 1)); + fields[field] = val; + } + + return fields; +} + +/** + * Check if `mime` is json or has +json structured syntax suffix. + * + * @param {String} mime + * @return {Boolean} + * @api private + */ + +function isJSON(mime) { + return /[\/+]json\b/.test(mime); +} + +/** + * Return the mime type for the given `str`. + * + * @param {String} str + * @return {String} + * @api private + */ + +function type(str){ + return str.split(/ *; */).shift(); +}; + +/** + * Return header field parameters. + * + * @param {String} str + * @return {Object} + * @api private + */ + +function params(str){ + return str.split(/ *; */).reduce(function(obj, str){ + var parts = str.split(/ *= */), + key = parts.shift(), + val = parts.shift(); + + if (key && val) obj[key] = val; + return obj; + }, {}); +}; + +/** + * Initialize a new `Response` with the given `xhr`. + * + * - set flags (.ok, .error, etc) + * - parse header + * + * Examples: + * + * Aliasing `superagent` as `request` is nice: + * + * request = superagent; + * + * We can use the promise-like API, or pass callbacks: + * + * request.get('/').end(function(res){}); + * request.get('/', function(res){}); + * + * Sending data can be chained: + * + * request + * .post('/user') + * .send({ name: 'tj' }) + * .end(function(res){}); + * + * Or passed to `.send()`: + * + * request + * .post('/user') + * .send({ name: 'tj' }, function(res){}); + * + * Or passed to `.post()`: + * + * request + * .post('/user', { name: 'tj' }) + * .end(function(res){}); + * + * Or further reduced to a single call for simple cases: + * + * request + * .post('/user', { name: 'tj' }, function(res){}); + * + * @param {XMLHTTPRequest} xhr + * @param {Object} options + * @api private + */ + +function Response(req, options) { + options = options || {}; + this.req = req; + this.xhr = this.req.xhr; + // responseText is accessible only if responseType is '' or 'text' and on older browsers + this.text = ((this.req.method !='HEAD' && (this.xhr.responseType === '' || this.xhr.responseType === 'text')) || typeof this.xhr.responseType === 'undefined') + ? this.xhr.responseText + : null; + this.statusText = this.req.xhr.statusText; + this._setStatusProperties(this.xhr.status); + this.header = this.headers = parseHeader(this.xhr.getAllResponseHeaders()); + // getAllResponseHeaders sometimes falsely returns "" for CORS requests, but + // getResponseHeader still works. so we get content-type even if getting + // other headers fails. + this.header['content-type'] = this.xhr.getResponseHeader('content-type'); + this._setHeaderProperties(this.header); + this.body = this.req.method != 'HEAD' + ? this._parseBody(this.text ? this.text : this.xhr.response) + : null; +} + +/** + * Get case-insensitive `field` value. + * + * @param {String} field + * @return {String} + * @api public + */ + +Response.prototype.get = function(field){ + return this.header[field.toLowerCase()]; +}; + +/** + * Set header related properties: + * + * - `.type` the content type without params + * + * A response of "Content-Type: text/plain; charset=utf-8" + * will provide you with a `.type` of "text/plain". + * + * @param {Object} header + * @api private + */ + +Response.prototype._setHeaderProperties = function(header){ + // content-type + var ct = this.header['content-type'] || ''; + this.type = type(ct); + + // params + var obj = params(ct); + for (var key in obj) this[key] = obj[key]; +}; + +/** + * Parse the given body `str`. + * + * Used for auto-parsing of bodies. Parsers + * are defined on the `superagent.parse` object. + * + * @param {String} str + * @return {Mixed} + * @api private + */ + +Response.prototype._parseBody = function(str){ + var parse = request.parse[this.type]; + if (!parse && isJSON(this.type)) { + parse = request.parse['application/json']; + } + return parse && str && (str.length || str instanceof Object) + ? parse(str) + : null; +}; + +/** + * Set flags such as `.ok` based on `status`. + * + * For example a 2xx response will give you a `.ok` of __true__ + * whereas 5xx will be __false__ and `.error` will be __true__. The + * `.clientError` and `.serverError` are also available to be more + * specific, and `.statusType` is the class of error ranging from 1..5 + * sometimes useful for mapping respond colors etc. + * + * "sugar" properties are also defined for common cases. Currently providing: + * + * - .noContent + * - .badRequest + * - .unauthorized + * - .notAcceptable + * - .notFound + * + * @param {Number} status + * @api private + */ + +Response.prototype._setStatusProperties = function(status){ + // handle IE9 bug: http://stackoverflow.com/questions/10046972/msie-returns-status-code-of-1223-for-ajax-request + if (status === 1223) { + status = 204; + } + + var type = status / 100 | 0; + + // status / class + this.status = this.statusCode = status; + this.statusType = type; + + // basics + this.info = 1 == type; + this.ok = 2 == type; + this.clientError = 4 == type; + this.serverError = 5 == type; + this.error = (4 == type || 5 == type) + ? this.toError() + : false; + + // sugar + this.accepted = 202 == status; + this.noContent = 204 == status; + this.badRequest = 400 == status; + this.unauthorized = 401 == status; + this.notAcceptable = 406 == status; + this.notFound = 404 == status; + this.forbidden = 403 == status; +}; + +/** + * Return an `Error` representative of this response. + * + * @return {Error} + * @api public + */ + +Response.prototype.toError = function(){ + var req = this.req; + var method = req.method; + var url = req.url; + + var msg = 'cannot ' + method + ' ' + url + ' (' + this.status + ')'; + var err = new Error(msg); + err.status = this.status; + err.method = method; + err.url = url; + + return err; +}; + +/** + * Expose `Response`. + */ + +request.Response = Response; + +/** + * Initialize a new `Request` with the given `method` and `url`. + * + * @param {String} method + * @param {String} url + * @api public + */ + +function Request(method, url) { + var self = this; + this._query = this._query || []; + this.method = method; + this.url = url; + this.header = {}; // preserves header name case + this._header = {}; // coerces header names to lowercase + this.on('end', function(){ + var err = null; + var res = null; + + try { + res = new Response(self); + } catch(e) { + err = new Error('Parser is unable to parse the response'); + err.parse = true; + err.original = e; + // issue #675: return the raw response if the response parsing fails + if (self.xhr) { + // ie9 doesn't have 'response' property + err.rawResponse = typeof self.xhr.responseType == 'undefined' ? self.xhr.responseText : self.xhr.response; + // issue #876: return the http status code if the response parsing fails + err.statusCode = self.xhr.status ? self.xhr.status : null; + } else { + err.rawResponse = null; + err.statusCode = null; + } + + return self.callback(err); + } + + self.emit('response', res); + + var new_err; + try { + if (res.status < 200 || res.status >= 300) { + new_err = new Error(res.statusText || 'Unsuccessful HTTP response'); + new_err.original = err; + new_err.response = res; + new_err.status = res.status; + } + } catch(e) { + new_err = e; // #985 touching res may cause INVALID_STATE_ERR on old Android + } + + // #1000 don't catch errors from the callback to avoid double calling it + if (new_err) { + self.callback(new_err, res); + } else { + self.callback(null, res); + } + }); +} + +/** + * Mixin `Emitter` and `RequestBase`. + */ + +Emitter(Request.prototype); +RequestBase(Request.prototype); + +/** + * Set Content-Type to `type`, mapping values from `request.types`. + * + * Examples: + * + * superagent.types.xml = 'application/xml'; + * + * request.post('/') + * .type('xml') + * .send(xmlstring) + * .end(callback); + * + * request.post('/') + * .type('application/xml') + * .send(xmlstring) + * .end(callback); + * + * @param {String} type + * @return {Request} for chaining + * @api public + */ + +Request.prototype.type = function(type){ + this.set('Content-Type', request.types[type] || type); + return this; +}; + +/** + * Set responseType to `val`. Presently valid responseTypes are 'blob' and + * 'arraybuffer'. + * + * Examples: + * + * req.get('/') + * .responseType('blob') + * .end(callback); + * + * @param {String} val + * @return {Request} for chaining + * @api public + */ + +Request.prototype.responseType = function(val){ + this._responseType = val; + return this; +}; + +/** + * Set Accept to `type`, mapping values from `request.types`. + * + * Examples: + * + * superagent.types.json = 'application/json'; + * + * request.get('/agent') + * .accept('json') + * .end(callback); + * + * request.get('/agent') + * .accept('application/json') + * .end(callback); + * + * @param {String} accept + * @return {Request} for chaining + * @api public + */ + +Request.prototype.accept = function(type){ + this.set('Accept', request.types[type] || type); + return this; +}; + +/** + * Set Authorization field value with `user` and `pass`. + * + * @param {String} user + * @param {String} pass + * @param {Object} options with 'type' property 'auto' or 'basic' (default 'basic') + * @return {Request} for chaining + * @api public + */ + +Request.prototype.auth = function(user, pass, options){ + if (!options) { + options = { + type: 'basic' + } + } + + switch (options.type) { + case 'basic': + var str = btoa(user + ':' + pass); + this.set('Authorization', 'Basic ' + str); + break; + + case 'auto': + this.username = user; + this.password = pass; + break; + } + return this; +}; + +/** +* Add query-string `val`. +* +* Examples: +* +* request.get('/shoes') +* .query('size=10') +* .query({ color: 'blue' }) +* +* @param {Object|String} val +* @return {Request} for chaining +* @api public +*/ + +Request.prototype.query = function(val){ + if ('string' != typeof val) val = serialize(val); + if (val) this._query.push(val); + return this; +}; + +/** + * Queue the given `file` as an attachment to the specified `field`, + * with optional `options` (or filename). + * + * ``` js + * request.post('/upload') + * .attach('content', new Blob(['hey!'], { type: "text/html"})) + * .end(callback); + * ``` + * + * @param {String} field + * @param {Blob|File} file + * @param {String|Object} options + * @return {Request} for chaining + * @api public + */ + +Request.prototype.attach = function(field, file, options){ + if (this._data) { + throw Error("superagent can't mix .send() and .attach()"); + } + + this._getFormData().append(field, file, options || file.name); + return this; +}; + +Request.prototype._getFormData = function(){ + if (!this._formData) { + this._formData = new root.FormData(); + } + return this._formData; +}; + +/** + * Invoke the callback with `err` and `res` + * and handle arity check. + * + * @param {Error} err + * @param {Response} res + * @api private + */ + +Request.prototype.callback = function(err, res){ + var fn = this._callback; + this.clearTimeout(); + + if (err) { + this.emit('error', err); + } + + fn(err, res); +}; + +/** + * Invoke callback with x-domain error. + * + * @api private + */ + +Request.prototype.crossDomainError = function(){ + var err = new Error('Request has been terminated\nPossible causes: the network is offline, Origin is not allowed by Access-Control-Allow-Origin, the page is being unloaded, etc.'); + err.crossDomain = true; + + err.status = this.status; + err.method = this.method; + err.url = this.url; + + this.callback(err); +}; + +// This only warns, because the request is still likely to work +Request.prototype.buffer = Request.prototype.ca = Request.prototype.agent = function(){ + console.warn("This is not supported in browser version of superagent"); + return this; +}; + +// This throws, because it can't send/receive data as expected +Request.prototype.pipe = Request.prototype.write = function(){ + throw Error("Streaming is not supported in browser version of superagent"); +}; + +/** + * Invoke callback with timeout error. + * + * @api private + */ + +Request.prototype._timeoutError = function(){ + var timeout = this._timeout; + var err = new Error('timeout of ' + timeout + 'ms exceeded'); + err.timeout = timeout; + this.callback(err); +}; + +/** + * Compose querystring to append to req.url + * + * @api private + */ + +Request.prototype._appendQueryString = function(){ + var query = this._query.join('&'); + if (query) { + this.url += ~this.url.indexOf('?') + ? '&' + query + : '?' + query; + } +}; + +/** + * Check if `obj` is a host object, + * we don't want to serialize these :) + * + * @param {Object} obj + * @return {Boolean} + * @api private + */ +Request.prototype._isHost = function _isHost(obj) { + // Native objects stringify to [object File], [object Blob], [object FormData], etc. + return obj && 'object' === typeof obj && !Array.isArray(obj) && Object.prototype.toString.call(obj) !== '[object Object]'; +} + +/** + * Initiate request, invoking callback `fn(res)` + * with an instanceof `Response`. + * + * @param {Function} fn + * @return {Request} for chaining + * @api public + */ + +Request.prototype.end = function(fn){ + var self = this; + var xhr = this.xhr = request.getXHR(); + var timeout = this._timeout; + var data = this._formData || this._data; + + // store callback + this._callback = fn || noop; + + // state change + xhr.onreadystatechange = function(){ + if (4 != xhr.readyState) return; + + // In IE9, reads to any property (e.g. status) off of an aborted XHR will + // result in the error "Could not complete the operation due to error c00c023f" + var status; + try { status = xhr.status } catch(e) { status = 0; } + + if (0 == status) { + if (self.timedout) return self._timeoutError(); + if (self._aborted) return; + return self.crossDomainError(); + } + self.emit('end'); + }; + + // progress + var handleProgress = function(direction, e) { + if (e.total > 0) { + e.percent = e.loaded / e.total * 100; + } + e.direction = direction; + self.emit('progress', e); + } + if (this.hasListeners('progress')) { + try { + xhr.onprogress = handleProgress.bind(null, 'download'); + if (xhr.upload) { + xhr.upload.onprogress = handleProgress.bind(null, 'upload'); + } + } catch(e) { + // Accessing xhr.upload fails in IE from a web worker, so just pretend it doesn't exist. + // Reported here: + // https://connect.microsoft.com/IE/feedback/details/837245/xmlhttprequest-upload-throws-invalid-argument-when-used-from-web-worker-context + } + } + + // timeout + if (timeout && !this._timer) { + this._timer = setTimeout(function(){ + self.timedout = true; + self.abort(); + }, timeout); + } + + // querystring + this._appendQueryString(); + + // initiate request + if (this.username && this.password) { + xhr.open(this.method, this.url, true, this.username, this.password); + } else { + xhr.open(this.method, this.url, true); + } + + // CORS + if (this._withCredentials) xhr.withCredentials = true; + + // body + if ('GET' != this.method && 'HEAD' != this.method && 'string' != typeof data && !this._isHost(data)) { + // serialize stuff + var contentType = this._header['content-type']; + var serialize = this._serializer || request.serialize[contentType ? contentType.split(';')[0] : '']; + if (!serialize && isJSON(contentType)) serialize = request.serialize['application/json']; + if (serialize) data = serialize(data); + } + + // set header fields + for (var field in this.header) { + if (null == this.header[field]) continue; + xhr.setRequestHeader(field, this.header[field]); + } + + if (this._responseType) { + xhr.responseType = this._responseType; + } + + // send stuff + this.emit('request', this); + + // IE11 xhr.send(undefined) sends 'undefined' string as POST payload (instead of nothing) + // We need null here if data is undefined + xhr.send(typeof data !== 'undefined' ? data : null); + return this; +}; + + +/** + * Expose `Request`. + */ + +request.Request = Request; + +/** + * GET `url` with optional callback `fn(res)`. + * + * @param {String} url + * @param {Mixed|Function} [data] or fn + * @param {Function} [fn] + * @return {Request} + * @api public + */ + +request.get = function(url, data, fn){ + var req = request('GET', url); + if ('function' == typeof data) fn = data, data = null; + if (data) req.query(data); + if (fn) req.end(fn); + return req; +}; + +/** + * HEAD `url` with optional callback `fn(res)`. + * + * @param {String} url + * @param {Mixed|Function} [data] or fn + * @param {Function} [fn] + * @return {Request} + * @api public + */ + +request.head = function(url, data, fn){ + var req = request('HEAD', url); + if ('function' == typeof data) fn = data, data = null; + if (data) req.send(data); + if (fn) req.end(fn); + return req; +}; + +/** + * OPTIONS query to `url` with optional callback `fn(res)`. + * + * @param {String} url + * @param {Mixed|Function} [data] or fn + * @param {Function} [fn] + * @return {Request} + * @api public + */ + +request.options = function(url, data, fn){ + var req = request('OPTIONS', url); + if ('function' == typeof data) fn = data, data = null; + if (data) req.send(data); + if (fn) req.end(fn); + return req; +}; + +/** + * DELETE `url` with optional callback `fn(res)`. + * + * @param {String} url + * @param {Function} [fn] + * @return {Request} + * @api public + */ + +function del(url, fn){ + var req = request('DELETE', url); + if (fn) req.end(fn); + return req; +}; + +request['del'] = del; +request['delete'] = del; + +/** + * PATCH `url` with optional `data` and callback `fn(res)`. + * + * @param {String} url + * @param {Mixed} [data] + * @param {Function} [fn] + * @return {Request} + * @api public + */ + +request.patch = function(url, data, fn){ + var req = request('PATCH', url); + if ('function' == typeof data) fn = data, data = null; + if (data) req.send(data); + if (fn) req.end(fn); + return req; +}; + +/** + * POST `url` with optional `data` and callback `fn(res)`. + * + * @param {String} url + * @param {Mixed} [data] + * @param {Function} [fn] + * @return {Request} + * @api public + */ + +request.post = function(url, data, fn){ + var req = request('POST', url); + if ('function' == typeof data) fn = data, data = null; + if (data) req.send(data); + if (fn) req.end(fn); + return req; +}; + +/** + * PUT `url` with optional `data` and callback `fn(res)`. + * + * @param {String} url + * @param {Mixed|Function} [data] or fn + * @param {Function} [fn] + * @return {Request} + * @api public + */ + +request.put = function(url, data, fn){ + var req = request('PUT', url); + if ('function' == typeof data) fn = data, data = null; + if (data) req.send(data); + if (fn) req.end(fn); + return req; +}; - /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(58).Buffer)) /***/ }, /* 58 */ /***/ function(module, exports, __webpack_require__) { - /* WEBPACK VAR INJECTION */(function(Buffer, global) {/*! - * The buffer module from node.js, for the browser. - * - * @author Feross Aboukhadijeh - * @license MIT - */ - /* eslint-disable no-proto */ - - 'use strict' - - var base64 = __webpack_require__(59) - var ieee754 = __webpack_require__(60) - var isArray = __webpack_require__(61) - - exports.Buffer = Buffer - exports.SlowBuffer = SlowBuffer - exports.INSPECT_MAX_BYTES = 50 - - /** - * If `Buffer.TYPED_ARRAY_SUPPORT`: - * === true Use Uint8Array implementation (fastest) - * === false Use Object implementation (most compatible, even IE6) - * - * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+, - * Opera 11.6+, iOS 4.2+. - * - * Due to various browser bugs, sometimes the Object implementation will be used even - * when the browser supports typed arrays. - * - * Note: - * - * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances, - * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438. - * - * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function. - * - * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of - * incorrect length in some situations. - - * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they - * get the Object implementation, which is slower but behaves correctly. - */ - Buffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined - ? global.TYPED_ARRAY_SUPPORT - : typedArraySupport() - - /* - * Export kMaxLength after typed array support is determined. - */ - exports.kMaxLength = kMaxLength() - - function typedArraySupport () { - try { - var arr = new Uint8Array(1) - arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }} - return arr.foo() === 42 && // typed array instances can be augmented - typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray` - arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray` - } catch (e) { - return false - } - } - - function kMaxLength () { - return Buffer.TYPED_ARRAY_SUPPORT - ? 0x7fffffff - : 0x3fffffff - } - - function createBuffer (that, length) { - if (kMaxLength() < length) { - throw new RangeError('Invalid typed array length') - } - if (Buffer.TYPED_ARRAY_SUPPORT) { - // Return an augmented `Uint8Array` instance, for best performance - that = new Uint8Array(length) - that.__proto__ = Buffer.prototype - } else { - // Fallback: Return an object instance of the Buffer class - if (that === null) { - that = new Buffer(length) - } - that.length = length - } - - return that - } - - /** - * The Buffer constructor returns instances of `Uint8Array` that have their - * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of - * `Uint8Array`, so the returned instances will have all the node `Buffer` methods - * and the `Uint8Array` methods. Square bracket notation works as expected -- it - * returns a single octet. - * - * The `Uint8Array` prototype remains unmodified. - */ - - function Buffer (arg, encodingOrOffset, length) { - if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) { - return new Buffer(arg, encodingOrOffset, length) - } - - // Common case. - if (typeof arg === 'number') { - if (typeof encodingOrOffset === 'string') { - throw new Error( - 'If encoding is specified then the first argument must be a string' - ) - } - return allocUnsafe(this, arg) - } - return from(this, arg, encodingOrOffset, length) - } - - Buffer.poolSize = 8192 // not used by this implementation - - // TODO: Legacy, not needed anymore. Remove in next major version. - Buffer._augment = function (arr) { - arr.__proto__ = Buffer.prototype - return arr - } - - function from (that, value, encodingOrOffset, length) { - if (typeof value === 'number') { - throw new TypeError('"value" argument must not be a number') - } - - if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) { - return fromArrayBuffer(that, value, encodingOrOffset, length) - } - - if (typeof value === 'string') { - return fromString(that, value, encodingOrOffset) - } - - return fromObject(that, value) - } - - /** - * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError - * if value is a number. - * Buffer.from(str[, encoding]) - * Buffer.from(array) - * Buffer.from(buffer) - * Buffer.from(arrayBuffer[, byteOffset[, length]]) - **/ - Buffer.from = function (value, encodingOrOffset, length) { - return from(null, value, encodingOrOffset, length) - } - - if (Buffer.TYPED_ARRAY_SUPPORT) { - Buffer.prototype.__proto__ = Uint8Array.prototype - Buffer.__proto__ = Uint8Array - if (typeof Symbol !== 'undefined' && Symbol.species && - Buffer[Symbol.species] === Buffer) { - // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97 - Object.defineProperty(Buffer, Symbol.species, { - value: null, - configurable: true - }) - } - } - - function assertSize (size) { - if (typeof size !== 'number') { - throw new TypeError('"size" argument must be a number') - } else if (size < 0) { - throw new RangeError('"size" argument must not be negative') - } - } - - function alloc (that, size, fill, encoding) { - assertSize(size) - if (size <= 0) { - return createBuffer(that, size) - } - if (fill !== undefined) { - // Only pay attention to encoding if it's a string. This - // prevents accidentally sending in a number that would - // be interpretted as a start offset. - return typeof encoding === 'string' - ? createBuffer(that, size).fill(fill, encoding) - : createBuffer(that, size).fill(fill) - } - return createBuffer(that, size) - } - - /** - * Creates a new filled Buffer instance. - * alloc(size[, fill[, encoding]]) - **/ - Buffer.alloc = function (size, fill, encoding) { - return alloc(null, size, fill, encoding) - } - - function allocUnsafe (that, size) { - assertSize(size) - that = createBuffer(that, size < 0 ? 0 : checked(size) | 0) - if (!Buffer.TYPED_ARRAY_SUPPORT) { - for (var i = 0; i < size; ++i) { - that[i] = 0 - } - } - return that - } - - /** - * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance. - * */ - Buffer.allocUnsafe = function (size) { - return allocUnsafe(null, size) - } - /** - * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance. - */ - Buffer.allocUnsafeSlow = function (size) { - return allocUnsafe(null, size) - } - - function fromString (that, string, encoding) { - if (typeof encoding !== 'string' || encoding === '') { - encoding = 'utf8' - } - - if (!Buffer.isEncoding(encoding)) { - throw new TypeError('"encoding" must be a valid string encoding') - } - - var length = byteLength(string, encoding) | 0 - that = createBuffer(that, length) - - var actual = that.write(string, encoding) - - if (actual !== length) { - // Writing a hex string, for example, that contains invalid characters will - // cause everything after the first invalid character to be ignored. (e.g. - // 'abxxcd' will be treated as 'ab') - that = that.slice(0, actual) - } - - return that - } - - function fromArrayLike (that, array) { - var length = array.length < 0 ? 0 : checked(array.length) | 0 - that = createBuffer(that, length) - for (var i = 0; i < length; i += 1) { - that[i] = array[i] & 255 - } - return that - } - - function fromArrayBuffer (that, array, byteOffset, length) { - array.byteLength // this throws if `array` is not a valid ArrayBuffer - - if (byteOffset < 0 || array.byteLength < byteOffset) { - throw new RangeError('\'offset\' is out of bounds') - } - - if (array.byteLength < byteOffset + (length || 0)) { - throw new RangeError('\'length\' is out of bounds') - } - - if (byteOffset === undefined && length === undefined) { - array = new Uint8Array(array) - } else if (length === undefined) { - array = new Uint8Array(array, byteOffset) - } else { - array = new Uint8Array(array, byteOffset, length) - } - - if (Buffer.TYPED_ARRAY_SUPPORT) { - // Return an augmented `Uint8Array` instance, for best performance - that = array - that.__proto__ = Buffer.prototype - } else { - // Fallback: Return an object instance of the Buffer class - that = fromArrayLike(that, array) - } - return that - } - - function fromObject (that, obj) { - if (Buffer.isBuffer(obj)) { - var len = checked(obj.length) | 0 - that = createBuffer(that, len) - - if (that.length === 0) { - return that - } - - obj.copy(that, 0, 0, len) - return that - } - - if (obj) { - if ((typeof ArrayBuffer !== 'undefined' && - obj.buffer instanceof ArrayBuffer) || 'length' in obj) { - if (typeof obj.length !== 'number' || isnan(obj.length)) { - return createBuffer(that, 0) - } - return fromArrayLike(that, obj) - } - - if (obj.type === 'Buffer' && isArray(obj.data)) { - return fromArrayLike(that, obj.data) - } - } - - throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.') - } - - function checked (length) { - // Note: cannot use `length < kMaxLength()` here because that fails when - // length is NaN (which is otherwise coerced to zero.) - if (length >= kMaxLength()) { - throw new RangeError('Attempt to allocate Buffer larger than maximum ' + - 'size: 0x' + kMaxLength().toString(16) + ' bytes') - } - return length | 0 - } - - function SlowBuffer (length) { - if (+length != length) { // eslint-disable-line eqeqeq - length = 0 - } - return Buffer.alloc(+length) - } - - Buffer.isBuffer = function isBuffer (b) { - return !!(b != null && b._isBuffer) - } - - Buffer.compare = function compare (a, b) { - if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) { - throw new TypeError('Arguments must be Buffers') - } - - if (a === b) return 0 - - var x = a.length - var y = b.length - - for (var i = 0, len = Math.min(x, y); i < len; ++i) { - if (a[i] !== b[i]) { - x = a[i] - y = b[i] - break - } - } - - if (x < y) return -1 - if (y < x) return 1 - return 0 - } - - Buffer.isEncoding = function isEncoding (encoding) { - switch (String(encoding).toLowerCase()) { - case 'hex': - case 'utf8': - case 'utf-8': - case 'ascii': - case 'latin1': - case 'binary': - case 'base64': - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return true - default: - return false - } - } - - Buffer.concat = function concat (list, length) { - if (!isArray(list)) { - throw new TypeError('"list" argument must be an Array of Buffers') - } - - if (list.length === 0) { - return Buffer.alloc(0) - } - - var i - if (length === undefined) { - length = 0 - for (i = 0; i < list.length; ++i) { - length += list[i].length - } - } - - var buffer = Buffer.allocUnsafe(length) - var pos = 0 - for (i = 0; i < list.length; ++i) { - var buf = list[i] - if (!Buffer.isBuffer(buf)) { - throw new TypeError('"list" argument must be an Array of Buffers') - } - buf.copy(buffer, pos) - pos += buf.length - } - return buffer - } - - function byteLength (string, encoding) { - if (Buffer.isBuffer(string)) { - return string.length - } - if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' && - (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) { - return string.byteLength - } - if (typeof string !== 'string') { - string = '' + string - } - - var len = string.length - if (len === 0) return 0 - - // Use a for loop to avoid recursion - var loweredCase = false - for (;;) { - switch (encoding) { - case 'ascii': - case 'latin1': - case 'binary': - return len - case 'utf8': - case 'utf-8': - case undefined: - return utf8ToBytes(string).length - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return len * 2 - case 'hex': - return len >>> 1 - case 'base64': - return base64ToBytes(string).length - default: - if (loweredCase) return utf8ToBytes(string).length // assume utf8 - encoding = ('' + encoding).toLowerCase() - loweredCase = true - } - } - } - Buffer.byteLength = byteLength - - function slowToString (encoding, start, end) { - var loweredCase = false - - // No need to verify that "this.length <= MAX_UINT32" since it's a read-only - // property of a typed array. - - // This behaves neither like String nor Uint8Array in that we set start/end - // to their upper/lower bounds if the value passed is out of range. - // undefined is handled specially as per ECMA-262 6th Edition, - // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization. - if (start === undefined || start < 0) { - start = 0 - } - // Return early if start > this.length. Done here to prevent potential uint32 - // coercion fail below. - if (start > this.length) { - return '' - } - - if (end === undefined || end > this.length) { - end = this.length - } - - if (end <= 0) { - return '' - } - - // Force coersion to uint32. This will also coerce falsey/NaN values to 0. - end >>>= 0 - start >>>= 0 - - if (end <= start) { - return '' - } - - if (!encoding) encoding = 'utf8' - - while (true) { - switch (encoding) { - case 'hex': - return hexSlice(this, start, end) - - case 'utf8': - case 'utf-8': - return utf8Slice(this, start, end) - - case 'ascii': - return asciiSlice(this, start, end) - - case 'latin1': - case 'binary': - return latin1Slice(this, start, end) - - case 'base64': - return base64Slice(this, start, end) - - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return utf16leSlice(this, start, end) - - default: - if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding) - encoding = (encoding + '').toLowerCase() - loweredCase = true - } - } - } - - // The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect - // Buffer instances. - Buffer.prototype._isBuffer = true - - function swap (b, n, m) { - var i = b[n] - b[n] = b[m] - b[m] = i - } - - Buffer.prototype.swap16 = function swap16 () { - var len = this.length - if (len % 2 !== 0) { - throw new RangeError('Buffer size must be a multiple of 16-bits') - } - for (var i = 0; i < len; i += 2) { - swap(this, i, i + 1) - } - return this - } - - Buffer.prototype.swap32 = function swap32 () { - var len = this.length - if (len % 4 !== 0) { - throw new RangeError('Buffer size must be a multiple of 32-bits') - } - for (var i = 0; i < len; i += 4) { - swap(this, i, i + 3) - swap(this, i + 1, i + 2) - } - return this - } - - Buffer.prototype.swap64 = function swap64 () { - var len = this.length - if (len % 8 !== 0) { - throw new RangeError('Buffer size must be a multiple of 64-bits') - } - for (var i = 0; i < len; i += 8) { - swap(this, i, i + 7) - swap(this, i + 1, i + 6) - swap(this, i + 2, i + 5) - swap(this, i + 3, i + 4) - } - return this - } - - Buffer.prototype.toString = function toString () { - var length = this.length | 0 - if (length === 0) return '' - if (arguments.length === 0) return utf8Slice(this, 0, length) - return slowToString.apply(this, arguments) - } - - Buffer.prototype.equals = function equals (b) { - if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer') - if (this === b) return true - return Buffer.compare(this, b) === 0 - } - - Buffer.prototype.inspect = function inspect () { - var str = '' - var max = exports.INSPECT_MAX_BYTES - if (this.length > 0) { - str = this.toString('hex', 0, max).match(/.{2}/g).join(' ') - if (this.length > max) str += ' ... ' - } - return '' - } - - Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) { - if (!Buffer.isBuffer(target)) { - throw new TypeError('Argument must be a Buffer') - } - - if (start === undefined) { - start = 0 - } - if (end === undefined) { - end = target ? target.length : 0 - } - if (thisStart === undefined) { - thisStart = 0 - } - if (thisEnd === undefined) { - thisEnd = this.length - } - - if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) { - throw new RangeError('out of range index') - } - - if (thisStart >= thisEnd && start >= end) { - return 0 - } - if (thisStart >= thisEnd) { - return -1 - } - if (start >= end) { - return 1 - } - - start >>>= 0 - end >>>= 0 - thisStart >>>= 0 - thisEnd >>>= 0 - - if (this === target) return 0 - - var x = thisEnd - thisStart - var y = end - start - var len = Math.min(x, y) - - var thisCopy = this.slice(thisStart, thisEnd) - var targetCopy = target.slice(start, end) - - for (var i = 0; i < len; ++i) { - if (thisCopy[i] !== targetCopy[i]) { - x = thisCopy[i] - y = targetCopy[i] - break - } - } - - if (x < y) return -1 - if (y < x) return 1 - return 0 - } - - // Finds either the first index of `val` in `buffer` at offset >= `byteOffset`, - // OR the last index of `val` in `buffer` at offset <= `byteOffset`. - // - // Arguments: - // - buffer - a Buffer to search - // - val - a string, Buffer, or number - // - byteOffset - an index into `buffer`; will be clamped to an int32 - // - encoding - an optional encoding, relevant is val is a string - // - dir - true for indexOf, false for lastIndexOf - function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) { - // Empty buffer means no match - if (buffer.length === 0) return -1 - - // Normalize byteOffset - if (typeof byteOffset === 'string') { - encoding = byteOffset - byteOffset = 0 - } else if (byteOffset > 0x7fffffff) { - byteOffset = 0x7fffffff - } else if (byteOffset < -0x80000000) { - byteOffset = -0x80000000 - } - byteOffset = +byteOffset // Coerce to Number. - if (isNaN(byteOffset)) { - // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer - byteOffset = dir ? 0 : (buffer.length - 1) - } - - // Normalize byteOffset: negative offsets start from the end of the buffer - if (byteOffset < 0) byteOffset = buffer.length + byteOffset - if (byteOffset >= buffer.length) { - if (dir) return -1 - else byteOffset = buffer.length - 1 - } else if (byteOffset < 0) { - if (dir) byteOffset = 0 - else return -1 - } - - // Normalize val - if (typeof val === 'string') { - val = Buffer.from(val, encoding) - } - - // Finally, search either indexOf (if dir is true) or lastIndexOf - if (Buffer.isBuffer(val)) { - // Special case: looking for empty string/buffer always fails - if (val.length === 0) { - return -1 - } - return arrayIndexOf(buffer, val, byteOffset, encoding, dir) - } else if (typeof val === 'number') { - val = val & 0xFF // Search for a byte value [0-255] - if (Buffer.TYPED_ARRAY_SUPPORT && - typeof Uint8Array.prototype.indexOf === 'function') { - if (dir) { - return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset) - } else { - return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset) - } - } - return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir) - } - - throw new TypeError('val must be string, number or Buffer') - } - - function arrayIndexOf (arr, val, byteOffset, encoding, dir) { - var indexSize = 1 - var arrLength = arr.length - var valLength = val.length - - if (encoding !== undefined) { - encoding = String(encoding).toLowerCase() - if (encoding === 'ucs2' || encoding === 'ucs-2' || - encoding === 'utf16le' || encoding === 'utf-16le') { - if (arr.length < 2 || val.length < 2) { - return -1 - } - indexSize = 2 - arrLength /= 2 - valLength /= 2 - byteOffset /= 2 - } - } - - function read (buf, i) { - if (indexSize === 1) { - return buf[i] - } else { - return buf.readUInt16BE(i * indexSize) - } - } - - var i - if (dir) { - var foundIndex = -1 - for (i = byteOffset; i < arrLength; i++) { - if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) { - if (foundIndex === -1) foundIndex = i - if (i - foundIndex + 1 === valLength) return foundIndex * indexSize - } else { - if (foundIndex !== -1) i -= i - foundIndex - foundIndex = -1 - } - } - } else { - if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength - for (i = byteOffset; i >= 0; i--) { - var found = true - for (var j = 0; j < valLength; j++) { - if (read(arr, i + j) !== read(val, j)) { - found = false - break - } - } - if (found) return i - } - } - - return -1 - } - - Buffer.prototype.includes = function includes (val, byteOffset, encoding) { - return this.indexOf(val, byteOffset, encoding) !== -1 - } - - Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) { - return bidirectionalIndexOf(this, val, byteOffset, encoding, true) - } - - Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) { - return bidirectionalIndexOf(this, val, byteOffset, encoding, false) - } - - function hexWrite (buf, string, offset, length) { - offset = Number(offset) || 0 - var remaining = buf.length - offset - if (!length) { - length = remaining - } else { - length = Number(length) - if (length > remaining) { - length = remaining - } - } - - // must be an even number of digits - var strLen = string.length - if (strLen % 2 !== 0) throw new TypeError('Invalid hex string') - - if (length > strLen / 2) { - length = strLen / 2 - } - for (var i = 0; i < length; ++i) { - var parsed = parseInt(string.substr(i * 2, 2), 16) - if (isNaN(parsed)) return i - buf[offset + i] = parsed - } - return i - } - - function utf8Write (buf, string, offset, length) { - return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length) - } - - function asciiWrite (buf, string, offset, length) { - return blitBuffer(asciiToBytes(string), buf, offset, length) - } - - function latin1Write (buf, string, offset, length) { - return asciiWrite(buf, string, offset, length) - } - - function base64Write (buf, string, offset, length) { - return blitBuffer(base64ToBytes(string), buf, offset, length) - } - - function ucs2Write (buf, string, offset, length) { - return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length) - } - - Buffer.prototype.write = function write (string, offset, length, encoding) { - // Buffer#write(string) - if (offset === undefined) { - encoding = 'utf8' - length = this.length - offset = 0 - // Buffer#write(string, encoding) - } else if (length === undefined && typeof offset === 'string') { - encoding = offset - length = this.length - offset = 0 - // Buffer#write(string, offset[, length][, encoding]) - } else if (isFinite(offset)) { - offset = offset | 0 - if (isFinite(length)) { - length = length | 0 - if (encoding === undefined) encoding = 'utf8' - } else { - encoding = length - length = undefined - } - // legacy write(string, encoding, offset, length) - remove in v0.13 - } else { - throw new Error( - 'Buffer.write(string, encoding, offset[, length]) is no longer supported' - ) - } - - var remaining = this.length - offset - if (length === undefined || length > remaining) length = remaining - - if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) { - throw new RangeError('Attempt to write outside buffer bounds') - } - - if (!encoding) encoding = 'utf8' - - var loweredCase = false - for (;;) { - switch (encoding) { - case 'hex': - return hexWrite(this, string, offset, length) - - case 'utf8': - case 'utf-8': - return utf8Write(this, string, offset, length) - - case 'ascii': - return asciiWrite(this, string, offset, length) - - case 'latin1': - case 'binary': - return latin1Write(this, string, offset, length) - - case 'base64': - // Warning: maxLength not taken into account in base64Write - return base64Write(this, string, offset, length) - - case 'ucs2': - case 'ucs-2': - case 'utf16le': - case 'utf-16le': - return ucs2Write(this, string, offset, length) - - default: - if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding) - encoding = ('' + encoding).toLowerCase() - loweredCase = true - } - } - } - - Buffer.prototype.toJSON = function toJSON () { - return { - type: 'Buffer', - data: Array.prototype.slice.call(this._arr || this, 0) - } - } - - function base64Slice (buf, start, end) { - if (start === 0 && end === buf.length) { - return base64.fromByteArray(buf) - } else { - return base64.fromByteArray(buf.slice(start, end)) - } - } - - function utf8Slice (buf, start, end) { - end = Math.min(buf.length, end) - var res = [] - - var i = start - while (i < end) { - var firstByte = buf[i] - var codePoint = null - var bytesPerSequence = (firstByte > 0xEF) ? 4 - : (firstByte > 0xDF) ? 3 - : (firstByte > 0xBF) ? 2 - : 1 - - if (i + bytesPerSequence <= end) { - var secondByte, thirdByte, fourthByte, tempCodePoint - - switch (bytesPerSequence) { - case 1: - if (firstByte < 0x80) { - codePoint = firstByte - } - break - case 2: - secondByte = buf[i + 1] - if ((secondByte & 0xC0) === 0x80) { - tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F) - if (tempCodePoint > 0x7F) { - codePoint = tempCodePoint - } - } - break - case 3: - secondByte = buf[i + 1] - thirdByte = buf[i + 2] - if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) { - tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F) - if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) { - codePoint = tempCodePoint - } - } - break - case 4: - secondByte = buf[i + 1] - thirdByte = buf[i + 2] - fourthByte = buf[i + 3] - if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) { - tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F) - if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) { - codePoint = tempCodePoint - } - } - } - } - - if (codePoint === null) { - // we did not generate a valid codePoint so insert a - // replacement char (U+FFFD) and advance only 1 byte - codePoint = 0xFFFD - bytesPerSequence = 1 - } else if (codePoint > 0xFFFF) { - // encode to utf16 (surrogate pair dance) - codePoint -= 0x10000 - res.push(codePoint >>> 10 & 0x3FF | 0xD800) - codePoint = 0xDC00 | codePoint & 0x3FF - } - - res.push(codePoint) - i += bytesPerSequence - } - - return decodeCodePointsArray(res) - } - - // Based on http://stackoverflow.com/a/22747272/680742, the browser with - // the lowest limit is Chrome, with 0x10000 args. - // We go 1 magnitude less, for safety - var MAX_ARGUMENTS_LENGTH = 0x1000 - - function decodeCodePointsArray (codePoints) { - var len = codePoints.length - if (len <= MAX_ARGUMENTS_LENGTH) { - return String.fromCharCode.apply(String, codePoints) // avoid extra slice() - } - - // Decode in chunks to avoid "call stack size exceeded". - var res = '' - var i = 0 - while (i < len) { - res += String.fromCharCode.apply( - String, - codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH) - ) - } - return res - } - - function asciiSlice (buf, start, end) { - var ret = '' - end = Math.min(buf.length, end) - - for (var i = start; i < end; ++i) { - ret += String.fromCharCode(buf[i] & 0x7F) - } - return ret - } - - function latin1Slice (buf, start, end) { - var ret = '' - end = Math.min(buf.length, end) - - for (var i = start; i < end; ++i) { - ret += String.fromCharCode(buf[i]) - } - return ret - } - - function hexSlice (buf, start, end) { - var len = buf.length - - if (!start || start < 0) start = 0 - if (!end || end < 0 || end > len) end = len - - var out = '' - for (var i = start; i < end; ++i) { - out += toHex(buf[i]) - } - return out - } - - function utf16leSlice (buf, start, end) { - var bytes = buf.slice(start, end) - var res = '' - for (var i = 0; i < bytes.length; i += 2) { - res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256) - } - return res - } - - Buffer.prototype.slice = function slice (start, end) { - var len = this.length - start = ~~start - end = end === undefined ? len : ~~end - - if (start < 0) { - start += len - if (start < 0) start = 0 - } else if (start > len) { - start = len - } - - if (end < 0) { - end += len - if (end < 0) end = 0 - } else if (end > len) { - end = len - } - - if (end < start) end = start - - var newBuf - if (Buffer.TYPED_ARRAY_SUPPORT) { - newBuf = this.subarray(start, end) - newBuf.__proto__ = Buffer.prototype - } else { - var sliceLen = end - start - newBuf = new Buffer(sliceLen, undefined) - for (var i = 0; i < sliceLen; ++i) { - newBuf[i] = this[i + start] - } - } - - return newBuf - } - - /* - * Need to make sure that buffer isn't trying to write out of bounds. - */ - function checkOffset (offset, ext, length) { - if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint') - if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length') - } - - Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) { - offset = offset | 0 - byteLength = byteLength | 0 - if (!noAssert) checkOffset(offset, byteLength, this.length) - - var val = this[offset] - var mul = 1 - var i = 0 - while (++i < byteLength && (mul *= 0x100)) { - val += this[offset + i] * mul - } - - return val - } - - Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) { - offset = offset | 0 - byteLength = byteLength | 0 - if (!noAssert) { - checkOffset(offset, byteLength, this.length) - } - - var val = this[offset + --byteLength] - var mul = 1 - while (byteLength > 0 && (mul *= 0x100)) { - val += this[offset + --byteLength] * mul - } - - return val - } - - Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) { - if (!noAssert) checkOffset(offset, 1, this.length) - return this[offset] - } - - Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) { - if (!noAssert) checkOffset(offset, 2, this.length) - return this[offset] | (this[offset + 1] << 8) - } - - Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) { - if (!noAssert) checkOffset(offset, 2, this.length) - return (this[offset] << 8) | this[offset + 1] - } - - Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) { - if (!noAssert) checkOffset(offset, 4, this.length) - - return ((this[offset]) | - (this[offset + 1] << 8) | - (this[offset + 2] << 16)) + - (this[offset + 3] * 0x1000000) - } - - Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) { - if (!noAssert) checkOffset(offset, 4, this.length) - - return (this[offset] * 0x1000000) + - ((this[offset + 1] << 16) | - (this[offset + 2] << 8) | - this[offset + 3]) - } - - Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) { - offset = offset | 0 - byteLength = byteLength | 0 - if (!noAssert) checkOffset(offset, byteLength, this.length) - - var val = this[offset] - var mul = 1 - var i = 0 - while (++i < byteLength && (mul *= 0x100)) { - val += this[offset + i] * mul - } - mul *= 0x80 - - if (val >= mul) val -= Math.pow(2, 8 * byteLength) - - return val - } - - Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) { - offset = offset | 0 - byteLength = byteLength | 0 - if (!noAssert) checkOffset(offset, byteLength, this.length) - - var i = byteLength - var mul = 1 - var val = this[offset + --i] - while (i > 0 && (mul *= 0x100)) { - val += this[offset + --i] * mul - } - mul *= 0x80 - - if (val >= mul) val -= Math.pow(2, 8 * byteLength) - - return val - } - - Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) { - if (!noAssert) checkOffset(offset, 1, this.length) - if (!(this[offset] & 0x80)) return (this[offset]) - return ((0xff - this[offset] + 1) * -1) - } - - Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) { - if (!noAssert) checkOffset(offset, 2, this.length) - var val = this[offset] | (this[offset + 1] << 8) - return (val & 0x8000) ? val | 0xFFFF0000 : val - } - - Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) { - if (!noAssert) checkOffset(offset, 2, this.length) - var val = this[offset + 1] | (this[offset] << 8) - return (val & 0x8000) ? val | 0xFFFF0000 : val - } - - Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) { - if (!noAssert) checkOffset(offset, 4, this.length) - - return (this[offset]) | - (this[offset + 1] << 8) | - (this[offset + 2] << 16) | - (this[offset + 3] << 24) - } - - Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) { - if (!noAssert) checkOffset(offset, 4, this.length) - - return (this[offset] << 24) | - (this[offset + 1] << 16) | - (this[offset + 2] << 8) | - (this[offset + 3]) - } - - Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) { - if (!noAssert) checkOffset(offset, 4, this.length) - return ieee754.read(this, offset, true, 23, 4) - } - - Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) { - if (!noAssert) checkOffset(offset, 4, this.length) - return ieee754.read(this, offset, false, 23, 4) - } - - Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) { - if (!noAssert) checkOffset(offset, 8, this.length) - return ieee754.read(this, offset, true, 52, 8) - } - - Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) { - if (!noAssert) checkOffset(offset, 8, this.length) - return ieee754.read(this, offset, false, 52, 8) - } - - function checkInt (buf, value, offset, ext, max, min) { - if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance') - if (value > max || value < min) throw new RangeError('"value" argument is out of bounds') - if (offset + ext > buf.length) throw new RangeError('Index out of range') - } - - Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) { - value = +value - offset = offset | 0 - byteLength = byteLength | 0 - if (!noAssert) { - var maxBytes = Math.pow(2, 8 * byteLength) - 1 - checkInt(this, value, offset, byteLength, maxBytes, 0) - } - - var mul = 1 - var i = 0 - this[offset] = value & 0xFF - while (++i < byteLength && (mul *= 0x100)) { - this[offset + i] = (value / mul) & 0xFF - } - - return offset + byteLength - } - - Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) { - value = +value - offset = offset | 0 - byteLength = byteLength | 0 - if (!noAssert) { - var maxBytes = Math.pow(2, 8 * byteLength) - 1 - checkInt(this, value, offset, byteLength, maxBytes, 0) - } - - var i = byteLength - 1 - var mul = 1 - this[offset + i] = value & 0xFF - while (--i >= 0 && (mul *= 0x100)) { - this[offset + i] = (value / mul) & 0xFF - } - - return offset + byteLength - } - - Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) { - value = +value - offset = offset | 0 - if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0) - if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value) - this[offset] = (value & 0xff) - return offset + 1 - } - - function objectWriteUInt16 (buf, value, offset, littleEndian) { - if (value < 0) value = 0xffff + value + 1 - for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) { - buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>> - (littleEndian ? i : 1 - i) * 8 - } - } - - Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) { - value = +value - offset = offset | 0 - if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0) - if (Buffer.TYPED_ARRAY_SUPPORT) { - this[offset] = (value & 0xff) - this[offset + 1] = (value >>> 8) - } else { - objectWriteUInt16(this, value, offset, true) - } - return offset + 2 - } - - Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) { - value = +value - offset = offset | 0 - if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0) - if (Buffer.TYPED_ARRAY_SUPPORT) { - this[offset] = (value >>> 8) - this[offset + 1] = (value & 0xff) - } else { - objectWriteUInt16(this, value, offset, false) - } - return offset + 2 - } - - function objectWriteUInt32 (buf, value, offset, littleEndian) { - if (value < 0) value = 0xffffffff + value + 1 - for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) { - buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff - } - } - - Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) { - value = +value - offset = offset | 0 - if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0) - if (Buffer.TYPED_ARRAY_SUPPORT) { - this[offset + 3] = (value >>> 24) - this[offset + 2] = (value >>> 16) - this[offset + 1] = (value >>> 8) - this[offset] = (value & 0xff) - } else { - objectWriteUInt32(this, value, offset, true) - } - return offset + 4 - } - - Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) { - value = +value - offset = offset | 0 - if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0) - if (Buffer.TYPED_ARRAY_SUPPORT) { - this[offset] = (value >>> 24) - this[offset + 1] = (value >>> 16) - this[offset + 2] = (value >>> 8) - this[offset + 3] = (value & 0xff) - } else { - objectWriteUInt32(this, value, offset, false) - } - return offset + 4 - } - - Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) { - value = +value - offset = offset | 0 - if (!noAssert) { - var limit = Math.pow(2, 8 * byteLength - 1) - - checkInt(this, value, offset, byteLength, limit - 1, -limit) - } - - var i = 0 - var mul = 1 - var sub = 0 - this[offset] = value & 0xFF - while (++i < byteLength && (mul *= 0x100)) { - if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) { - sub = 1 - } - this[offset + i] = ((value / mul) >> 0) - sub & 0xFF - } - - return offset + byteLength - } - - Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) { - value = +value - offset = offset | 0 - if (!noAssert) { - var limit = Math.pow(2, 8 * byteLength - 1) - - checkInt(this, value, offset, byteLength, limit - 1, -limit) - } - - var i = byteLength - 1 - var mul = 1 - var sub = 0 - this[offset + i] = value & 0xFF - while (--i >= 0 && (mul *= 0x100)) { - if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) { - sub = 1 - } - this[offset + i] = ((value / mul) >> 0) - sub & 0xFF - } - - return offset + byteLength - } - - Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) { - value = +value - offset = offset | 0 - if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80) - if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value) - if (value < 0) value = 0xff + value + 1 - this[offset] = (value & 0xff) - return offset + 1 - } - - Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) { - value = +value - offset = offset | 0 - if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000) - if (Buffer.TYPED_ARRAY_SUPPORT) { - this[offset] = (value & 0xff) - this[offset + 1] = (value >>> 8) - } else { - objectWriteUInt16(this, value, offset, true) - } - return offset + 2 - } - - Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) { - value = +value - offset = offset | 0 - if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000) - if (Buffer.TYPED_ARRAY_SUPPORT) { - this[offset] = (value >>> 8) - this[offset + 1] = (value & 0xff) - } else { - objectWriteUInt16(this, value, offset, false) - } - return offset + 2 - } - - Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) { - value = +value - offset = offset | 0 - if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000) - if (Buffer.TYPED_ARRAY_SUPPORT) { - this[offset] = (value & 0xff) - this[offset + 1] = (value >>> 8) - this[offset + 2] = (value >>> 16) - this[offset + 3] = (value >>> 24) - } else { - objectWriteUInt32(this, value, offset, true) - } - return offset + 4 - } - - Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) { - value = +value - offset = offset | 0 - if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000) - if (value < 0) value = 0xffffffff + value + 1 - if (Buffer.TYPED_ARRAY_SUPPORT) { - this[offset] = (value >>> 24) - this[offset + 1] = (value >>> 16) - this[offset + 2] = (value >>> 8) - this[offset + 3] = (value & 0xff) - } else { - objectWriteUInt32(this, value, offset, false) - } - return offset + 4 - } - - function checkIEEE754 (buf, value, offset, ext, max, min) { - if (offset + ext > buf.length) throw new RangeError('Index out of range') - if (offset < 0) throw new RangeError('Index out of range') - } - - function writeFloat (buf, value, offset, littleEndian, noAssert) { - if (!noAssert) { - checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38) - } - ieee754.write(buf, value, offset, littleEndian, 23, 4) - return offset + 4 - } - - Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) { - return writeFloat(this, value, offset, true, noAssert) - } - - Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) { - return writeFloat(this, value, offset, false, noAssert) - } - - function writeDouble (buf, value, offset, littleEndian, noAssert) { - if (!noAssert) { - checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308) - } - ieee754.write(buf, value, offset, littleEndian, 52, 8) - return offset + 8 - } - - Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) { - return writeDouble(this, value, offset, true, noAssert) - } - - Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) { - return writeDouble(this, value, offset, false, noAssert) - } - - // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length) - Buffer.prototype.copy = function copy (target, targetStart, start, end) { - if (!start) start = 0 - if (!end && end !== 0) end = this.length - if (targetStart >= target.length) targetStart = target.length - if (!targetStart) targetStart = 0 - if (end > 0 && end < start) end = start - - // Copy 0 bytes; we're done - if (end === start) return 0 - if (target.length === 0 || this.length === 0) return 0 - - // Fatal error conditions - if (targetStart < 0) { - throw new RangeError('targetStart out of bounds') - } - if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds') - if (end < 0) throw new RangeError('sourceEnd out of bounds') - - // Are we oob? - if (end > this.length) end = this.length - if (target.length - targetStart < end - start) { - end = target.length - targetStart + start - } - - var len = end - start - var i - - if (this === target && start < targetStart && targetStart < end) { - // descending copy from end - for (i = len - 1; i >= 0; --i) { - target[i + targetStart] = this[i + start] - } - } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) { - // ascending copy from start - for (i = 0; i < len; ++i) { - target[i + targetStart] = this[i + start] - } - } else { - Uint8Array.prototype.set.call( - target, - this.subarray(start, start + len), - targetStart - ) - } - - return len - } - - // Usage: - // buffer.fill(number[, offset[, end]]) - // buffer.fill(buffer[, offset[, end]]) - // buffer.fill(string[, offset[, end]][, encoding]) - Buffer.prototype.fill = function fill (val, start, end, encoding) { - // Handle string cases: - if (typeof val === 'string') { - if (typeof start === 'string') { - encoding = start - start = 0 - end = this.length - } else if (typeof end === 'string') { - encoding = end - end = this.length - } - if (val.length === 1) { - var code = val.charCodeAt(0) - if (code < 256) { - val = code - } - } - if (encoding !== undefined && typeof encoding !== 'string') { - throw new TypeError('encoding must be a string') - } - if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) { - throw new TypeError('Unknown encoding: ' + encoding) - } - } else if (typeof val === 'number') { - val = val & 255 - } - - // Invalid ranges are not set to a default, so can range check early. - if (start < 0 || this.length < start || this.length < end) { - throw new RangeError('Out of range index') - } - - if (end <= start) { - return this - } - - start = start >>> 0 - end = end === undefined ? this.length : end >>> 0 - - if (!val) val = 0 - - var i - if (typeof val === 'number') { - for (i = start; i < end; ++i) { - this[i] = val - } - } else { - var bytes = Buffer.isBuffer(val) - ? val - : utf8ToBytes(new Buffer(val, encoding).toString()) - var len = bytes.length - for (i = 0; i < end - start; ++i) { - this[i + start] = bytes[i % len] - } - } - - return this - } - - // HELPER FUNCTIONS - // ================ - - var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g - - function base64clean (str) { - // Node strips out invalid characters like \n and \t from the string, base64-js does not - str = stringtrim(str).replace(INVALID_BASE64_RE, '') - // Node converts strings with length < 2 to '' - if (str.length < 2) return '' - // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not - while (str.length % 4 !== 0) { - str = str + '=' - } - return str - } - - function stringtrim (str) { - if (str.trim) return str.trim() - return str.replace(/^\s+|\s+$/g, '') - } - - function toHex (n) { - if (n < 16) return '0' + n.toString(16) - return n.toString(16) - } - - function utf8ToBytes (string, units) { - units = units || Infinity - var codePoint - var length = string.length - var leadSurrogate = null - var bytes = [] - - for (var i = 0; i < length; ++i) { - codePoint = string.charCodeAt(i) - - // is surrogate component - if (codePoint > 0xD7FF && codePoint < 0xE000) { - // last char was a lead - if (!leadSurrogate) { - // no lead yet - if (codePoint > 0xDBFF) { - // unexpected trail - if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) - continue - } else if (i + 1 === length) { - // unpaired lead - if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) - continue - } - - // valid lead - leadSurrogate = codePoint - - continue - } - - // 2 leads in a row - if (codePoint < 0xDC00) { - if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) - leadSurrogate = codePoint - continue - } - - // valid surrogate pair - codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000 - } else if (leadSurrogate) { - // valid bmp char, but last char was a lead - if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) - } - - leadSurrogate = null - - // encode utf8 - if (codePoint < 0x80) { - if ((units -= 1) < 0) break - bytes.push(codePoint) - } else if (codePoint < 0x800) { - if ((units -= 2) < 0) break - bytes.push( - codePoint >> 0x6 | 0xC0, - codePoint & 0x3F | 0x80 - ) - } else if (codePoint < 0x10000) { - if ((units -= 3) < 0) break - bytes.push( - codePoint >> 0xC | 0xE0, - codePoint >> 0x6 & 0x3F | 0x80, - codePoint & 0x3F | 0x80 - ) - } else if (codePoint < 0x110000) { - if ((units -= 4) < 0) break - bytes.push( - codePoint >> 0x12 | 0xF0, - codePoint >> 0xC & 0x3F | 0x80, - codePoint >> 0x6 & 0x3F | 0x80, - codePoint & 0x3F | 0x80 - ) - } else { - throw new Error('Invalid code point') - } - } - - return bytes - } - - function asciiToBytes (str) { - var byteArray = [] - for (var i = 0; i < str.length; ++i) { - // Node's code seems to be doing this and not & 0x7F.. - byteArray.push(str.charCodeAt(i) & 0xFF) - } - return byteArray - } - - function utf16leToBytes (str, units) { - var c, hi, lo - var byteArray = [] - for (var i = 0; i < str.length; ++i) { - if ((units -= 2) < 0) break - - c = str.charCodeAt(i) - hi = c >> 8 - lo = c % 256 - byteArray.push(lo) - byteArray.push(hi) - } - - return byteArray - } - - function base64ToBytes (str) { - return base64.toByteArray(base64clean(str)) - } - - function blitBuffer (src, dst, offset, length) { - for (var i = 0; i < length; ++i) { - if ((i + offset >= dst.length) || (i >= src.length)) break - dst[i + offset] = src[i] - } - return i - } - - function isnan (val) { - return val !== val // eslint-disable-line no-self-compare - } - - /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(58).Buffer, (function() { return this; }()))) +/* WEBPACK VAR INJECTION */(function(setImmediate, clearImmediate) {var nextTick = __webpack_require__(5).nextTick; +var apply = Function.prototype.apply; +var slice = Array.prototype.slice; +var immediateIds = {}; +var nextImmediateId = 0; + +// DOM APIs, for completeness + +exports.setTimeout = function() { + return new Timeout(apply.call(setTimeout, window, arguments), clearTimeout); +}; +exports.setInterval = function() { + return new Timeout(apply.call(setInterval, window, arguments), clearInterval); +}; +exports.clearTimeout = +exports.clearInterval = function(timeout) { timeout.close(); }; + +function Timeout(id, clearFn) { + this._id = id; + this._clearFn = clearFn; +} +Timeout.prototype.unref = Timeout.prototype.ref = function() {}; +Timeout.prototype.close = function() { + this._clearFn.call(window, this._id); +}; + +// Does not start the time, just sets up the members needed. +exports.enroll = function(item, msecs) { + clearTimeout(item._idleTimeoutId); + item._idleTimeout = msecs; +}; + +exports.unenroll = function(item) { + clearTimeout(item._idleTimeoutId); + item._idleTimeout = -1; +}; + +exports._unrefActive = exports.active = function(item) { + clearTimeout(item._idleTimeoutId); + + var msecs = item._idleTimeout; + if (msecs >= 0) { + item._idleTimeoutId = setTimeout(function onTimeout() { + if (item._onTimeout) + item._onTimeout(); + }, msecs); + } +}; + +// That's not how node.js implements it but the exposed api is the same. +exports.setImmediate = typeof setImmediate === "function" ? setImmediate : function(fn) { + var id = nextImmediateId++; + var args = arguments.length < 2 ? false : slice.call(arguments, 1); + + immediateIds[id] = true; + + nextTick(function onNextTick() { + if (immediateIds[id]) { + // fn.call() is faster so we optimize for the common use-case + // @see http://jsperf.com/call-apply-segu + if (args) { + fn.apply(null, args); + } else { + fn.call(null); + } + // Prevent ids from leaking + exports.clearImmediate(id); + } + }); + + return id; +}; + +exports.clearImmediate = typeof clearImmediate === "function" ? clearImmediate : function(id) { + delete immediateIds[id]; +}; +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(58).setImmediate, __webpack_require__(58).clearImmediate)) /***/ }, /* 59 */ -/***/ function(module, exports) { +/***/ function(module, exports, __webpack_require__) { - 'use strict' +"use strict"; +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. - exports.byteLength = byteLength - exports.toByteArray = toByteArray - exports.fromByteArray = fromByteArray +'use strict'; - var lookup = [] - var revLookup = [] - var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array +var punycode = __webpack_require__(218); +var util = __webpack_require__(239); - var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/' - for (var i = 0, len = code.length; i < len; ++i) { - lookup[i] = code[i] - revLookup[code.charCodeAt(i)] = i - } +exports.parse = urlParse; +exports.resolve = urlResolve; +exports.resolveObject = urlResolveObject; +exports.format = urlFormat; - revLookup['-'.charCodeAt(0)] = 62 - revLookup['_'.charCodeAt(0)] = 63 +exports.Url = Url; - function placeHoldersCount (b64) { - var len = b64.length - if (len % 4 > 0) { - throw new Error('Invalid string. Length must be a multiple of 4') - } +function Url() { + this.protocol = null; + this.slashes = null; + this.auth = null; + this.host = null; + this.port = null; + this.hostname = null; + this.hash = null; + this.search = null; + this.query = null; + this.pathname = null; + this.path = null; + this.href = null; +} - // the number of equal signs (place holders) - // if there are two placeholders, than the two characters before it - // represent one byte - // if there is only one, then the three characters before it represent 2 bytes - // this is just a cheap hack to not do indexOf twice - return b64[len - 2] === '=' ? 2 : b64[len - 1] === '=' ? 1 : 0 - } +// Reference: RFC 3986, RFC 1808, RFC 2396 - function byteLength (b64) { - // base64 is 4/3 + up to two characters of the original data - return b64.length * 3 / 4 - placeHoldersCount(b64) - } +// define these here so at least they only have to be +// compiled once on the first module load. +var protocolPattern = /^([a-z0-9.+-]+:)/i, + portPattern = /:[0-9]*$/, - function toByteArray (b64) { - var i, j, l, tmp, placeHolders, arr - var len = b64.length - placeHolders = placeHoldersCount(b64) + // Special case for a simple path URL + simplePathPattern = /^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/, - arr = new Arr(len * 3 / 4 - placeHolders) + // RFC 2396: characters reserved for delimiting URLs. + // We actually just auto-escape these. + delims = ['<', '>', '"', '`', ' ', '\r', '\n', '\t'], - // if there are placeholders, only get up to the last complete 4 chars - l = placeHolders > 0 ? len - 4 : len + // RFC 2396: characters not allowed for various reasons. + unwise = ['{', '}', '|', '\\', '^', '`'].concat(delims), - var L = 0 + // Allowed by RFCs, but cause of XSS attacks. Always escape these. + autoEscape = ['\''].concat(unwise), + // Characters that are never ever allowed in a hostname. + // Note that any invalid chars are also handled, but these + // are the ones that are *expected* to be seen, so we fast-path + // them. + nonHostChars = ['%', '/', '?', ';', '#'].concat(autoEscape), + hostEndingChars = ['/', '?', '#'], + hostnameMaxLen = 255, + hostnamePartPattern = /^[+a-z0-9A-Z_-]{0,63}$/, + hostnamePartStart = /^([+a-z0-9A-Z_-]{0,63})(.*)$/, + // protocols that can allow "unsafe" and "unwise" chars. + unsafeProtocol = { + 'javascript': true, + 'javascript:': true + }, + // protocols that never have a hostname. + hostlessProtocol = { + 'javascript': true, + 'javascript:': true + }, + // protocols that always contain a // bit. + slashedProtocol = { + 'http': true, + 'https': true, + 'ftp': true, + 'gopher': true, + 'file': true, + 'http:': true, + 'https:': true, + 'ftp:': true, + 'gopher:': true, + 'file:': true + }, + querystring = __webpack_require__(221); - for (i = 0, j = 0; i < l; i += 4, j += 3) { - tmp = (revLookup[b64.charCodeAt(i)] << 18) | (revLookup[b64.charCodeAt(i + 1)] << 12) | (revLookup[b64.charCodeAt(i + 2)] << 6) | revLookup[b64.charCodeAt(i + 3)] - arr[L++] = (tmp >> 16) & 0xFF - arr[L++] = (tmp >> 8) & 0xFF - arr[L++] = tmp & 0xFF - } +function urlParse(url, parseQueryString, slashesDenoteHost) { + if (url && util.isObject(url) && url instanceof Url) return url; - if (placeHolders === 2) { - tmp = (revLookup[b64.charCodeAt(i)] << 2) | (revLookup[b64.charCodeAt(i + 1)] >> 4) - arr[L++] = tmp & 0xFF - } else if (placeHolders === 1) { - tmp = (revLookup[b64.charCodeAt(i)] << 10) | (revLookup[b64.charCodeAt(i + 1)] << 4) | (revLookup[b64.charCodeAt(i + 2)] >> 2) - arr[L++] = (tmp >> 8) & 0xFF - arr[L++] = tmp & 0xFF - } + var u = new Url; + u.parse(url, parseQueryString, slashesDenoteHost); + return u; +} - return arr - } +Url.prototype.parse = function(url, parseQueryString, slashesDenoteHost) { + if (!util.isString(url)) { + throw new TypeError("Parameter 'url' must be a string, not " + typeof url); + } - function tripletToBase64 (num) { - return lookup[num >> 18 & 0x3F] + lookup[num >> 12 & 0x3F] + lookup[num >> 6 & 0x3F] + lookup[num & 0x3F] - } + // Copy chrome, IE, opera backslash-handling behavior. + // Back slashes before the query string get converted to forward slashes + // See: https://code.google.com/p/chromium/issues/detail?id=25916 + var queryIndex = url.indexOf('?'), + splitter = + (queryIndex !== -1 && queryIndex < url.indexOf('#')) ? '?' : '#', + uSplit = url.split(splitter), + slashRegex = /\\/g; + uSplit[0] = uSplit[0].replace(slashRegex, '/'); + url = uSplit.join(splitter); - function encodeChunk (uint8, start, end) { - var tmp - var output = [] - for (var i = start; i < end; i += 3) { - tmp = (uint8[i] << 16) + (uint8[i + 1] << 8) + (uint8[i + 2]) - output.push(tripletToBase64(tmp)) - } - return output.join('') - } + var rest = url; - function fromByteArray (uint8) { - var tmp - var len = uint8.length - var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes - var output = '' - var parts = [] - var maxChunkLength = 16383 // must be multiple of 3 + // trim before proceeding. + // This is to support parse stuff like " http://foo.com \n" + rest = rest.trim(); - // go through the array every three bytes, we'll deal with trailing stuff later - for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) { - parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength))) - } + if (!slashesDenoteHost && url.split('#').length === 1) { + // Try fast path regexp + var simplePath = simplePathPattern.exec(rest); + if (simplePath) { + this.path = rest; + this.href = rest; + this.pathname = simplePath[1]; + if (simplePath[2]) { + this.search = simplePath[2]; + if (parseQueryString) { + this.query = querystring.parse(this.search.substr(1)); + } else { + this.query = this.search.substr(1); + } + } else if (parseQueryString) { + this.search = ''; + this.query = {}; + } + return this; + } + } - // pad the end with zeros, but make sure to not forget the extra bytes - if (extraBytes === 1) { - tmp = uint8[len - 1] - output += lookup[tmp >> 2] - output += lookup[(tmp << 4) & 0x3F] - output += '==' - } else if (extraBytes === 2) { - tmp = (uint8[len - 2] << 8) + (uint8[len - 1]) - output += lookup[tmp >> 10] - output += lookup[(tmp >> 4) & 0x3F] - output += lookup[(tmp << 2) & 0x3F] - output += '=' - } + var proto = protocolPattern.exec(rest); + if (proto) { + proto = proto[0]; + var lowerProto = proto.toLowerCase(); + this.protocol = lowerProto; + rest = rest.substr(proto.length); + } - parts.push(output) + // figure out if it's got a host + // user@server is *always* interpreted as a hostname, and url + // resolution will treat //foo/bar as host=foo,path=bar because that's + // how the browser resolves relative URLs. + if (slashesDenoteHost || proto || rest.match(/^\/\/[^@\/]+@[^@\/]+/)) { + var slashes = rest.substr(0, 2) === '//'; + if (slashes && !(proto && hostlessProtocol[proto])) { + rest = rest.substr(2); + this.slashes = true; + } + } - return parts.join('') - } + if (!hostlessProtocol[proto] && + (slashes || (proto && !slashedProtocol[proto]))) { + + // there's a hostname. + // the first instance of /, ?, ;, or # ends the host. + // + // If there is an @ in the hostname, then non-host chars *are* allowed + // to the left of the last @ sign, unless some host-ending character + // comes *before* the @-sign. + // URLs are obnoxious. + // + // ex: + // http://a@b@c/ => user:a@b host:c + // http://a@b?@c => user:a host:c path:/?@c + + // v0.12 TODO(isaacs): This is not quite how Chrome does things. + // Review our test case against browsers more comprehensively. + + // find the first instance of any hostEndingChars + var hostEnd = -1; + for (var i = 0; i < hostEndingChars.length; i++) { + var hec = rest.indexOf(hostEndingChars[i]); + if (hec !== -1 && (hostEnd === -1 || hec < hostEnd)) + hostEnd = hec; + } + + // at this point, either we have an explicit point where the + // auth portion cannot go past, or the last @ char is the decider. + var auth, atSign; + if (hostEnd === -1) { + // atSign can be anywhere. + atSign = rest.lastIndexOf('@'); + } else { + // atSign must be in auth portion. + // http://a@b/c@d => host:b auth:a path:/c@d + atSign = rest.lastIndexOf('@', hostEnd); + } + + // Now we have a portion which is definitely the auth. + // Pull that off. + if (atSign !== -1) { + auth = rest.slice(0, atSign); + rest = rest.slice(atSign + 1); + this.auth = decodeURIComponent(auth); + } + + // the host is the remaining to the left of the first non-host char + hostEnd = -1; + for (var i = 0; i < nonHostChars.length; i++) { + var hec = rest.indexOf(nonHostChars[i]); + if (hec !== -1 && (hostEnd === -1 || hec < hostEnd)) + hostEnd = hec; + } + // if we still have not hit it, then the entire thing is a host. + if (hostEnd === -1) + hostEnd = rest.length; + + this.host = rest.slice(0, hostEnd); + rest = rest.slice(hostEnd); + + // pull out port. + this.parseHost(); + + // we've indicated that there is a hostname, + // so even if it's empty, it has to be present. + this.hostname = this.hostname || ''; + + // if hostname begins with [ and ends with ] + // assume that it's an IPv6 address. + var ipv6Hostname = this.hostname[0] === '[' && + this.hostname[this.hostname.length - 1] === ']'; + + // validate a little. + if (!ipv6Hostname) { + var hostparts = this.hostname.split(/\./); + for (var i = 0, l = hostparts.length; i < l; i++) { + var part = hostparts[i]; + if (!part) continue; + if (!part.match(hostnamePartPattern)) { + var newpart = ''; + for (var j = 0, k = part.length; j < k; j++) { + if (part.charCodeAt(j) > 127) { + // we replace non-ASCII char with a temporary placeholder + // we need this to make sure size of hostname is not + // broken by replacing non-ASCII by nothing + newpart += 'x'; + } else { + newpart += part[j]; + } + } + // we test again with ASCII char only + if (!newpart.match(hostnamePartPattern)) { + var validParts = hostparts.slice(0, i); + var notHost = hostparts.slice(i + 1); + var bit = part.match(hostnamePartStart); + if (bit) { + validParts.push(bit[1]); + notHost.unshift(bit[2]); + } + if (notHost.length) { + rest = '/' + notHost.join('.') + rest; + } + this.hostname = validParts.join('.'); + break; + } + } + } + } + + if (this.hostname.length > hostnameMaxLen) { + this.hostname = ''; + } else { + // hostnames are always lower case. + this.hostname = this.hostname.toLowerCase(); + } + + if (!ipv6Hostname) { + // IDNA Support: Returns a punycoded representation of "domain". + // It only converts parts of the domain name that + // have non-ASCII characters, i.e. it doesn't matter if + // you call it with a domain that already is ASCII-only. + this.hostname = punycode.toASCII(this.hostname); + } + + var p = this.port ? ':' + this.port : ''; + var h = this.hostname || ''; + this.host = h + p; + this.href += this.host; + + // strip [ and ] from the hostname + // the host field still retains them, though + if (ipv6Hostname) { + this.hostname = this.hostname.substr(1, this.hostname.length - 2); + if (rest[0] !== '/') { + rest = '/' + rest; + } + } + } + + // now rest is set to the post-host stuff. + // chop off any delim chars. + if (!unsafeProtocol[lowerProto]) { + + // First, make 100% sure that any "autoEscape" chars get + // escaped, even if encodeURIComponent doesn't think they + // need to be. + for (var i = 0, l = autoEscape.length; i < l; i++) { + var ae = autoEscape[i]; + if (rest.indexOf(ae) === -1) + continue; + var esc = encodeURIComponent(ae); + if (esc === ae) { + esc = escape(ae); + } + rest = rest.split(ae).join(esc); + } + } + + + // chop off from the tail first. + var hash = rest.indexOf('#'); + if (hash !== -1) { + // got a fragment string. + this.hash = rest.substr(hash); + rest = rest.slice(0, hash); + } + var qm = rest.indexOf('?'); + if (qm !== -1) { + this.search = rest.substr(qm); + this.query = rest.substr(qm + 1); + if (parseQueryString) { + this.query = querystring.parse(this.query); + } + rest = rest.slice(0, qm); + } else if (parseQueryString) { + // no query string, but parseQueryString still requested + this.search = ''; + this.query = {}; + } + if (rest) this.pathname = rest; + if (slashedProtocol[lowerProto] && + this.hostname && !this.pathname) { + this.pathname = '/'; + } + + //to support http.request + if (this.pathname || this.search) { + var p = this.pathname || ''; + var s = this.search || ''; + this.path = p + s; + } + + // finally, reconstruct the href based on what has been validated. + this.href = this.format(); + return this; +}; + +// format a parsed object into a url string +function urlFormat(obj) { + // ensure it's an object, and not a string url. + // If it's an obj, this is a no-op. + // this way, you can call url_format() on strings + // to clean up potentially wonky urls. + if (util.isString(obj)) obj = urlParse(obj); + if (!(obj instanceof Url)) return Url.prototype.format.call(obj); + return obj.format(); +} + +Url.prototype.format = function() { + var auth = this.auth || ''; + if (auth) { + auth = encodeURIComponent(auth); + auth = auth.replace(/%3A/i, ':'); + auth += '@'; + } + + var protocol = this.protocol || '', + pathname = this.pathname || '', + hash = this.hash || '', + host = false, + query = ''; + + if (this.host) { + host = auth + this.host; + } else if (this.hostname) { + host = auth + (this.hostname.indexOf(':') === -1 ? + this.hostname : + '[' + this.hostname + ']'); + if (this.port) { + host += ':' + this.port; + } + } + + if (this.query && + util.isObject(this.query) && + Object.keys(this.query).length) { + query = querystring.stringify(this.query); + } + + var search = this.search || (query && ('?' + query)) || ''; + + if (protocol && protocol.substr(-1) !== ':') protocol += ':'; + + // only the slashedProtocols get the //. Not mailto:, xmpp:, etc. + // unless they had them to begin with. + if (this.slashes || + (!protocol || slashedProtocol[protocol]) && host !== false) { + host = '//' + (host || ''); + if (pathname && pathname.charAt(0) !== '/') pathname = '/' + pathname; + } else if (!host) { + host = ''; + } + + if (hash && hash.charAt(0) !== '#') hash = '#' + hash; + if (search && search.charAt(0) !== '?') search = '?' + search; + + pathname = pathname.replace(/[?#]/g, function(match) { + return encodeURIComponent(match); + }); + search = search.replace('#', '%23'); + + return protocol + host + pathname + search + hash; +}; + +function urlResolve(source, relative) { + return urlParse(source, false, true).resolve(relative); +} + +Url.prototype.resolve = function(relative) { + return this.resolveObject(urlParse(relative, false, true)).format(); +}; + +function urlResolveObject(source, relative) { + if (!source) return relative; + return urlParse(source, false, true).resolveObject(relative); +} + +Url.prototype.resolveObject = function(relative) { + if (util.isString(relative)) { + var rel = new Url(); + rel.parse(relative, false, true); + relative = rel; + } + + var result = new Url(); + var tkeys = Object.keys(this); + for (var tk = 0; tk < tkeys.length; tk++) { + var tkey = tkeys[tk]; + result[tkey] = this[tkey]; + } + + // hash is always overridden, no matter what. + // even href="" will remove it. + result.hash = relative.hash; + + // if the relative url is empty, then there's nothing left to do here. + if (relative.href === '') { + result.href = result.format(); + return result; + } + + // hrefs like //foo/bar always cut to the protocol. + if (relative.slashes && !relative.protocol) { + // take everything except the protocol from relative + var rkeys = Object.keys(relative); + for (var rk = 0; rk < rkeys.length; rk++) { + var rkey = rkeys[rk]; + if (rkey !== 'protocol') + result[rkey] = relative[rkey]; + } + + //urlParse appends trailing / to urls like http://www.example.com + if (slashedProtocol[result.protocol] && + result.hostname && !result.pathname) { + result.path = result.pathname = '/'; + } + + result.href = result.format(); + return result; + } + + if (relative.protocol && relative.protocol !== result.protocol) { + // if it's a known url protocol, then changing + // the protocol does weird things + // first, if it's not file:, then we MUST have a host, + // and if there was a path + // to begin with, then we MUST have a path. + // if it is file:, then the host is dropped, + // because that's known to be hostless. + // anything else is assumed to be absolute. + if (!slashedProtocol[relative.protocol]) { + var keys = Object.keys(relative); + for (var v = 0; v < keys.length; v++) { + var k = keys[v]; + result[k] = relative[k]; + } + result.href = result.format(); + return result; + } + + result.protocol = relative.protocol; + if (!relative.host && !hostlessProtocol[relative.protocol]) { + var relPath = (relative.pathname || '').split('/'); + while (relPath.length && !(relative.host = relPath.shift())); + if (!relative.host) relative.host = ''; + if (!relative.hostname) relative.hostname = ''; + if (relPath[0] !== '') relPath.unshift(''); + if (relPath.length < 2) relPath.unshift(''); + result.pathname = relPath.join('/'); + } else { + result.pathname = relative.pathname; + } + result.search = relative.search; + result.query = relative.query; + result.host = relative.host || ''; + result.auth = relative.auth; + result.hostname = relative.hostname || relative.host; + result.port = relative.port; + // to support http.request + if (result.pathname || result.search) { + var p = result.pathname || ''; + var s = result.search || ''; + result.path = p + s; + } + result.slashes = result.slashes || relative.slashes; + result.href = result.format(); + return result; + } + + var isSourceAbs = (result.pathname && result.pathname.charAt(0) === '/'), + isRelAbs = ( + relative.host || + relative.pathname && relative.pathname.charAt(0) === '/' + ), + mustEndAbs = (isRelAbs || isSourceAbs || + (result.host && relative.pathname)), + removeAllDots = mustEndAbs, + srcPath = result.pathname && result.pathname.split('/') || [], + relPath = relative.pathname && relative.pathname.split('/') || [], + psychotic = result.protocol && !slashedProtocol[result.protocol]; + + // if the url is a non-slashed url, then relative + // links like ../.. should be able + // to crawl up to the hostname, as well. This is strange. + // result.protocol has already been set by now. + // Later on, put the first path part into the host field. + if (psychotic) { + result.hostname = ''; + result.port = null; + if (result.host) { + if (srcPath[0] === '') srcPath[0] = result.host; + else srcPath.unshift(result.host); + } + result.host = ''; + if (relative.protocol) { + relative.hostname = null; + relative.port = null; + if (relative.host) { + if (relPath[0] === '') relPath[0] = relative.host; + else relPath.unshift(relative.host); + } + relative.host = null; + } + mustEndAbs = mustEndAbs && (relPath[0] === '' || srcPath[0] === ''); + } + + if (isRelAbs) { + // it's absolute. + result.host = (relative.host || relative.host === '') ? + relative.host : result.host; + result.hostname = (relative.hostname || relative.hostname === '') ? + relative.hostname : result.hostname; + result.search = relative.search; + result.query = relative.query; + srcPath = relPath; + // fall through to the dot-handling below. + } else if (relPath.length) { + // it's relative + // throw away the existing file, and take the new path instead. + if (!srcPath) srcPath = []; + srcPath.pop(); + srcPath = srcPath.concat(relPath); + result.search = relative.search; + result.query = relative.query; + } else if (!util.isNullOrUndefined(relative.search)) { + // just pull out the search. + // like href='?foo'. + // Put this after the other two cases because it simplifies the booleans + if (psychotic) { + result.hostname = result.host = srcPath.shift(); + //occationaly the auth can get stuck only in host + //this especially happens in cases like + //url.resolveObject('mailto:local1@domain1', 'local2@domain2') + var authInHost = result.host && result.host.indexOf('@') > 0 ? + result.host.split('@') : false; + if (authInHost) { + result.auth = authInHost.shift(); + result.host = result.hostname = authInHost.shift(); + } + } + result.search = relative.search; + result.query = relative.query; + //to support http.request + if (!util.isNull(result.pathname) || !util.isNull(result.search)) { + result.path = (result.pathname ? result.pathname : '') + + (result.search ? result.search : ''); + } + result.href = result.format(); + return result; + } + + if (!srcPath.length) { + // no path at all. easy. + // we've already handled the other stuff above. + result.pathname = null; + //to support http.request + if (result.search) { + result.path = '/' + result.search; + } else { + result.path = null; + } + result.href = result.format(); + return result; + } + + // if a url ENDs in . or .., then it must get a trailing slash. + // however, if it ends in anything else non-slashy, + // then it must NOT get a trailing slash. + var last = srcPath.slice(-1)[0]; + var hasTrailingSlash = ( + (result.host || relative.host || srcPath.length > 1) && + (last === '.' || last === '..') || last === ''); + + // strip single dots, resolve double dots to parent dir + // if the path tries to go above the root, `up` ends up > 0 + var up = 0; + for (var i = srcPath.length; i >= 0; i--) { + last = srcPath[i]; + if (last === '.') { + srcPath.splice(i, 1); + } else if (last === '..') { + srcPath.splice(i, 1); + up++; + } else if (up) { + srcPath.splice(i, 1); + up--; + } + } + + // if the path is allowed to go above the root, restore leading ..s + if (!mustEndAbs && !removeAllDots) { + for (; up--; up) { + srcPath.unshift('..'); + } + } + + if (mustEndAbs && srcPath[0] !== '' && + (!srcPath[0] || srcPath[0].charAt(0) !== '/')) { + srcPath.unshift(''); + } + + if (hasTrailingSlash && (srcPath.join('/').substr(-1) !== '/')) { + srcPath.push(''); + } + + var isAbsolute = srcPath[0] === '' || + (srcPath[0] && srcPath[0].charAt(0) === '/'); + + // put the host back + if (psychotic) { + result.hostname = result.host = isAbsolute ? '' : + srcPath.length ? srcPath.shift() : ''; + //occationaly the auth can get stuck only in host + //this especially happens in cases like + //url.resolveObject('mailto:local1@domain1', 'local2@domain2') + var authInHost = result.host && result.host.indexOf('@') > 0 ? + result.host.split('@') : false; + if (authInHost) { + result.auth = authInHost.shift(); + result.host = result.hostname = authInHost.shift(); + } + } + + mustEndAbs = mustEndAbs || (result.host && srcPath.length); + + if (mustEndAbs && !isAbsolute) { + srcPath.unshift(''); + } + + if (!srcPath.length) { + result.pathname = null; + result.path = null; + } else { + result.pathname = srcPath.join('/'); + } + + //to support request.http + if (!util.isNull(result.pathname) || !util.isNull(result.search)) { + result.path = (result.pathname ? result.pathname : '') + + (result.search ? result.search : ''); + } + result.auth = relative.auth || result.auth; + result.slashes = result.slashes || relative.slashes; + result.href = result.format(); + return result; +}; + +Url.prototype.parseHost = function() { + var host = this.host; + var port = portPattern.exec(host); + if (port) { + port = port[0]; + if (port !== ':') { + this.port = port.substr(1); + } + host = host.substr(0, host.length - port.length); + } + if (host) this.hostname = host; +}; /***/ }, /* 60 */ /***/ function(module, exports) { - exports.read = function (buffer, offset, isLE, mLen, nBytes) { - var e, m - var eLen = nBytes * 8 - mLen - 1 - var eMax = (1 << eLen) - 1 - var eBias = eMax >> 1 - var nBits = -7 - var i = isLE ? (nBytes - 1) : 0 - var d = isLE ? -1 : 1 - var s = buffer[offset + i] +module.exports = function arraysEqual(a, b) { + if (a === b) return true; + if (a.length !== b.length) return false; - i += d + for (const itemInd in a) { + const item = a[itemInd]; + const ind = b.indexOf(item); + if (ind) { + b.splice(ind, 1); + } + } - e = s & ((1 << (-nBits)) - 1) - s >>= (-nBits) - nBits += eLen - for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {} - - m = e & ((1 << (-nBits)) - 1) - e >>= (-nBits) - nBits += mLen - for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {} - - if (e === 0) { - e = 1 - eBias - } else if (e === eMax) { - return m ? NaN : ((s ? -1 : 1) * Infinity) - } else { - m = m + Math.pow(2, mLen) - e = e - eBias - } - return (s ? -1 : 1) * m * Math.pow(2, e - mLen) - } - - exports.write = function (buffer, value, offset, isLE, mLen, nBytes) { - var e, m, c - var eLen = nBytes * 8 - mLen - 1 - var eMax = (1 << eLen) - 1 - var eBias = eMax >> 1 - var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0) - var i = isLE ? 0 : (nBytes - 1) - var d = isLE ? 1 : -1 - var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0 - - value = Math.abs(value) - - if (isNaN(value) || value === Infinity) { - m = isNaN(value) ? 1 : 0 - e = eMax - } else { - e = Math.floor(Math.log(value) / Math.LN2) - if (value * (c = Math.pow(2, -e)) < 1) { - e-- - c *= 2 - } - if (e + eBias >= 1) { - value += rt / c - } else { - value += rt * Math.pow(2, 1 - eBias) - } - if (value * c >= 2) { - e++ - c /= 2 - } - - if (e + eBias >= eMax) { - m = 0 - e = eMax - } else if (e + eBias >= 1) { - m = (value * c - 1) * Math.pow(2, mLen) - e = e + eBias - } else { - m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen) - e = 0 - } - } - - for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {} - - e = (e << mLen) | m - eLen += mLen - for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {} - - buffer[offset + i - d] |= s * 128 - } + return b.length === 0; +}; /***/ }, /* 61 */ /***/ function(module, exports) { - var toString = {}.toString; - - module.exports = Array.isArray || function (arr) { - return toString.call(arr) == '[object Array]'; - }; - +module.exports = { + "name": "discord.js", + "version": "10.0.1", + "description": "A powerful library for interacting with the Discord API", + "main": "./src/index", + "scripts": { + "test": "eslint src && node docs/generator test", + "docs": "node docs/generator", + "test-docs": "node docs/generator test", + "lint": "eslint src", + "web-dist": "npm install && node ./node_modules/parallel-webpack/bin/run.js" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/hydrabolt/discord.js.git" + }, + "keywords": [ + "discord", + "api", + "bot", + "client", + "node", + "discordapp" + ], + "author": "Amish Shah ", + "license": "Apache-2.0", + "bugs": { + "url": "https://github.com/hydrabolt/discord.js/issues" + }, + "homepage": "https://github.com/hydrabolt/discord.js#readme", + "dependencies": { + "superagent": "^3.0.0", + "tweetnacl": "^0.14.3", + "ws": "^1.1.1" + }, + "peerDependencies": { + "node-opus": "^0.2.0", + "opusscript": "^0.0.1" + }, + "devDependencies": { + "bufferutil": "^1.2.1", + "eslint": "^3.10.0", + "jsdoc-to-markdown": "^2.0.0", + "json-loader": "^0.5.4", + "parallel-webpack": "^1.5.0", + "uglify-js": "github:mishoo/UglifyJS2#harmony", + "utf-8-validate": "^1.2.1", + "webpack": "2.1.0-beta.27", + "zlibjs": "github:imaya/zlib.js" + }, + "engines": { + "node": ">=6.0.0" + } +}; /***/ }, /* 62 */ -/***/ function(module, exports) { +/***/ function(module, exports, __webpack_require__) { - +/* WEBPACK VAR INJECTION */(function(process) {const childProcess = __webpack_require__(10); +const path = __webpack_require__(14); +const makeError = __webpack_require__(132); +const makePlainError = __webpack_require__(133); + +/** + * Represents a Shard spawned by the ShardingManager. + */ +class Shard { + /** + * @param {ShardingManager} manager The sharding manager + * @param {number} id The ID of this shard + * @param {Array} [args=[]] Command line arguments to pass to the script + */ + constructor(manager, id, args = []) { + /** + * Manager that created the shard + * @type {ShardingManager} + */ + this.manager = manager; + + /** + * ID of the shard + * @type {number} + */ + this.id = id; + + /** + * The environment variables for the shard + * @type {Object} + */ + this.env = Object.assign({}, process.env, { + SHARD_ID: this.id, + SHARD_COUNT: this.manager.totalShards, + CLIENT_TOKEN: this.manager.token, + }); + + /** + * Process of the shard + * @type {ChildProcess} + */ + this.process = childProcess.fork(path.resolve(this.manager.file), args, { + env: this.env, + }); + this.process.on('message', this._handleMessage.bind(this)); + this.process.once('exit', () => { + if (this.manager.respawn) this.manager.createShard(this.id); + }); + + this._evals = new Map(); + this._fetches = new Map(); + } + + /** + * Sends a message to the shard's process. + * @param {*} message Message to send to the shard + * @returns {Promise} + */ + send(message) { + return new Promise((resolve, reject) => { + const sent = this.process.send(message, err => { + if (err) reject(err); else resolve(this); + }); + if (!sent) throw new Error('Failed to send message to shard\'s process.'); + }); + } + + /** + * Fetches a Client property value of the shard. + * @param {string} prop Name of the Client property to get, using periods for nesting + * @returns {Promise<*>} + * @example + * shard.fetchClientValue('guilds.size').then(count => { + * console.log(`${count} guilds in shard ${shard.id}`); + * }).catch(console.error); + */ + fetchClientValue(prop) { + if (this._fetches.has(prop)) return this._fetches.get(prop); + + const promise = new Promise((resolve, reject) => { + const listener = message => { + if (!message || message._fetchProp !== prop) return; + this.process.removeListener('message', listener); + this._fetches.delete(prop); + resolve(message._result); + }; + this.process.on('message', listener); + + this.send({ _fetchProp: prop }).catch(err => { + this.process.removeListener('message', listener); + this._fetches.delete(prop); + reject(err); + }); + }); + + this._fetches.set(prop, promise); + return promise; + } + + /** + * Evaluates a script on the shard, in the context of the Client. + * @param {string} script JavaScript to run on the shard + * @returns {Promise<*>} Result of the script execution + */ + eval(script) { + if (this._evals.has(script)) return this._evals.get(script); + + const promise = new Promise((resolve, reject) => { + const listener = message => { + if (!message || message._eval !== script) return; + this.process.removeListener('message', listener); + this._evals.delete(script); + if (!message._error) resolve(message._result); else reject(makeError(message._error)); + }; + this.process.on('message', listener); + + this.send({ _eval: script }).catch(err => { + this.process.removeListener('message', listener); + this._evals.delete(script); + reject(err); + }); + }); + + this._evals.set(script, promise); + return promise; + } + + /** + * Handles an IPC message + * @param {*} message Message received + * @private + */ + _handleMessage(message) { + if (message) { + // Shard is requesting a property fetch + if (message._sFetchProp) { + this.manager.fetchClientValues(message._sFetchProp).then( + results => this.send({ _sFetchProp: message._sFetchProp, _result: results }), + err => this.send({ _sFetchProp: message._sFetchProp, _error: makePlainError(err) }) + ); + return; + } + + // Shard is requesting an eval broadcast + if (message._sEval) { + this.manager.broadcastEval(message._sEval).then( + results => this.send({ _sEval: message._sEval, _result: results }), + err => this.send({ _sEval: message._sEval, _error: makePlainError(err) }) + ); + return; + } + } + + this.manager.emit('message', this, message); + } +} + +module.exports = Shard; + +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) /***/ }, /* 63 */ /***/ function(module, exports, __webpack_require__) { - /* WEBPACK VAR INJECTION */(function(Buffer) {function arrayBufferToBuffer(ab) { - const buffer = new Buffer(ab.byteLength); - const view = new Uint8Array(ab); - for (var i = 0; i < buffer.length; ++i) buffer[i] = view[i]; - return buffer; - } +/* WEBPACK VAR INJECTION */(function(process) {const makeError = __webpack_require__(132); +const makePlainError = __webpack_require__(133); - function str2ab(str) { - const buffer = new ArrayBuffer(str.length * 2); - const view = new Uint16Array(buffer); - for (var i = 0, strLen = str.length; i < strLen; i++) view[i] = str.charCodeAt(i); - return buffer; - } +/** + * Helper class for sharded clients spawned as a child process, such as from a ShardingManager + */ +class ShardClientUtil { + /** + * @param {Client} client Client of the current shard + */ + constructor(client) { + this.client = client; + process.on('message', this._handleMessage.bind(this)); + } - module.exports = function convertArrayBuffer(x) { - if (typeof x === 'string') x = str2ab(x); - return arrayBufferToBuffer(x); - }; + /** + * ID of this shard + * @type {number} + * @readonly + */ + get id() { + return this.client.options.shardId; + } - /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(58).Buffer)) + /** + * Total number of shards + * @type {number} + * @readonly + */ + get count() { + return this.client.options.shardCount; + } + + /** + * Sends a message to the master process + * @param {*} message Message to send + * @returns {Promise} + */ + send(message) { + return new Promise((resolve, reject) => { + const sent = process.send(message, err => { + if (err) reject(err); else resolve(); + }); + if (!sent) throw new Error('Failed to send message to master process.'); + }); + } + + /** + * Fetches a Client property value of each shard. + * @param {string} prop Name of the Client property to get, using periods for nesting + * @returns {Promise} + * @example + * client.shard.fetchClientValues('guilds.size').then(results => { + * console.log(`${results.reduce((prev, val) => prev + val, 0)} total guilds`); + * }).catch(console.error); + */ + fetchClientValues(prop) { + return new Promise((resolve, reject) => { + const listener = message => { + if (!message || message._sFetchProp !== prop) return; + process.removeListener('message', listener); + if (!message._error) resolve(message._result); else reject(makeError(message._error)); + }; + process.on('message', listener); + + this.send({ _sFetchProp: prop }).catch(err => { + process.removeListener('message', listener); + reject(err); + }); + }); + } + + /** + * Evaluates a script on all shards, in the context of the Clients. + * @param {string} script JavaScript to run on each shard + * @returns {Promise} Results of the script execution + */ + broadcastEval(script) { + return new Promise((resolve, reject) => { + const listener = message => { + if (!message || message._sEval !== script) return; + process.removeListener('message', listener); + if (!message._error) resolve(message._result); else reject(makeError(message._error)); + }; + process.on('message', listener); + + this.send({ _sEval: script }).catch(err => { + process.removeListener('message', listener); + reject(err); + }); + }); + } + + /** + * Handles an IPC message + * @param {*} message Message received + * @private + */ + _handleMessage(message) { + if (!message) return; + if (message._fetchProp) { + const props = message._fetchProp.split('.'); + let value = this.client; + for (const prop of props) value = value[prop]; + this._respond('fetchProp', { _fetchProp: message._fetchProp, _result: value }); + } else if (message._eval) { + try { + this._respond('eval', { _eval: message._eval, _result: this.client._eval(message._eval) }); + } catch (err) { + this._respond('eval', { _eval: message._eval, _error: makePlainError(err) }); + } + } + } + + /** + * Sends a message to the master process, emitting an error from the client upon failure + * @param {string} type Type of response to send + * @param {*} message Message to send + * @private + */ + _respond(type, message) { + this.send(message).catch(err => + this.client.emit('error', `Error when sending ${type} response to master process: ${err}`) + ); + } + + /** + * Creates/gets the singleton of this class + * @param {Client} client Client to use + * @returns {ShardClientUtil} + */ + static singleton(client) { + if (!this._singleton) { + this._singleton = new this(client); + } else { + client.emit('error', 'Multiple clients created in child process; only the first will handle sharding helpers.'); + } + return this._singleton; + } +} + +module.exports = ShardClientUtil; + +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) /***/ }, /* 64 */ /***/ function(module, exports, __webpack_require__) { - const Collection = __webpack_require__(10); - const mergeDefault = __webpack_require__(4); - const Constants = __webpack_require__(5); - const VoiceConnection = __webpack_require__(65); - const EventEmitter = __webpack_require__(3).EventEmitter; +const User = __webpack_require__(11); +const OAuth2Application = __webpack_require__(72); - /** - * Manages all the voice stuff for the Client - * @private - */ - class ClientVoiceManager { - constructor(client) { - /** - * The client that instantiated this voice manager - * @type {Client} - */ - this.client = client; +/** + * Represents the client's OAuth2 Application + * @extends {OAuth2Application} + */ +class ClientOAuth2Application extends OAuth2Application { + setup(data) { + super.setup(data); - /** - * A collection mapping connection IDs to the Connection objects - * @type {Collection} - */ - this.connections = new Collection(); + /** + * The app's flags + * @type {number} + */ + this.flags = data.flags; - /** - * Pending connection attempts, maps guild ID to VoiceChannel - * @type {Collection} - */ - this.pending = new Collection(); + /** + * The app's owner + * @type {User} + */ + this.owner = new User(this.client, data.owner); + } +} - this.client.on('self.voiceServer', this.onVoiceServer.bind(this)); - this.client.on('self.voiceStateUpdate', this.onVoiceStateUpdate.bind(this)); - } - - onVoiceServer(data) { - if (this.pending.has(data.guild_id)) this.pending.get(data.guild_id).setTokenAndEndpoint(data.token, data.endpoint); - } - - onVoiceStateUpdate(data) { - if (this.pending.has(data.guild_id)) this.pending.get(data.guild_id).setSessionID(data.session_id); - } - - /** - * Sends a request to the main gateway to join a voice channel - * @param {VoiceChannel} channel The channel to join - * @param {Object} [options] The options to provide - */ - sendVoiceStateUpdate(channel, options = {}) { - if (!this.client.user) throw new Error('Unable to join because there is no client user.'); - if (!channel.permissionsFor) { - throw new Error('Channel does not support permissionsFor; is it really a voice channel?'); - } - const permissions = channel.permissionsFor(this.client.user); - if (!permissions) { - throw new Error('There is no permission set for the client user in this channel - are they part of the guild?'); - } - if (!permissions.hasPermission('CONNECT')) { - throw new Error('You do not have permission to join this voice channel.'); - } - - options = mergeDefault({ - guild_id: channel.guild.id, - channel_id: channel.id, - self_mute: false, - self_deaf: false, - }, options); - - this.client.ws.send({ - op: Constants.OPCodes.VOICE_STATE_UPDATE, - d: options, - }); - } - - /** - * Sets up a request to join a voice channel - * @param {VoiceChannel} channel The voice channel to join - * @returns {Promise} - */ - joinChannel(channel) { - return new Promise((resolve, reject) => { - if (this.client.browser) throw new Error('Voice connections are not available in browsers.'); - if (this.pending.get(channel.guild.id)) throw new Error('Already connecting to this guild\'s voice server.'); - if (!channel.joinable) throw new Error('You do not have permission to join this voice channel.'); - - const existingConnection = this.connections.get(channel.guild.id); - if (existingConnection) { - if (existingConnection.channel.id !== channel.id) { - this.sendVoiceStateUpdate(channel); - this.connections.get(channel.guild.id).channel = channel; - } - resolve(existingConnection); - return; - } - - const pendingConnection = new PendingVoiceConnection(this, channel); - this.pending.set(channel.guild.id, pendingConnection); - - pendingConnection.on('fail', reason => { - this.pending.delete(channel.guild.id); - reject(reason); - }); - - pendingConnection.on('pass', voiceConnection => { - this.pending.delete(channel.guild.id); - this.connections.set(channel.guild.id, voiceConnection); - voiceConnection.once('ready', () => resolve(voiceConnection)); - voiceConnection.once('error', reject); - voiceConnection.once('disconnect', () => this.connections.delete(channel.guild.id)); - }); - }); - } - } - - /** - * Represents a Pending Voice Connection - * @private - */ - class PendingVoiceConnection extends EventEmitter { - constructor(voiceManager, channel) { - super(); - - /** - * The ClientVoiceManager that instantiated this pending connection - * @type {ClientVoiceManager} - */ - this.voiceManager = voiceManager; - - /** - * The channel that this pending voice connection will attempt to join - * @type {VoiceChannel} - */ - this.channel = channel; - - /** - * The timeout that will be invoked after 15 seconds signifying a failure to connect - * @type {Timeout} - */ - this.deathTimer = this.voiceManager.client.setTimeout( - () => this.fail(new Error('Connection not established within 15 seconds.')), 15000); - - /** - * An object containing data required to connect to the voice servers with - * @type {object} - */ - this.data = {}; - - this.sendVoiceStateUpdate(); - } - - checkReady() { - if (this.data.token && this.data.endpoint && this.data.session_id) { - this.pass(); - return true; - } else { - return false; - } - } - - /** - * Set the token and endpoint required to connect to the the voice servers - * @param {string} token the token - * @param {string} endpoint the endpoint - * @returns {void} - */ - setTokenAndEndpoint(token, endpoint) { - if (!token) { - this.fail(new Error('Token not provided from voice server packet.')); - return; - } - if (!endpoint) { - this.fail(new Error('Endpoint not provided from voice server packet.')); - return; - } - if (this.data.token) { - this.fail(new Error('There is already a registered token for this connection.')); - return; - } - if (this.data.endpoint) { - this.fail(new Error('There is already a registered endpoint for this connection.')); - return; - } - - endpoint = endpoint.match(/([^:]*)/)[0]; - - if (!endpoint) { - this.fail(new Error('Failed to find an endpoint.')); - return; - } - - this.data.token = token; - this.data.endpoint = endpoint; - - this.checkReady(); - } - - /** - * Sets the Session ID for the connection - * @param {string} sessionID the session ID - */ - setSessionID(sessionID) { - if (!sessionID) { - this.fail(new Error('Session ID not supplied.')); - return; - } - if (this.data.session_id) { - this.fail(new Error('There is already a registered session ID for this connection.')); - return; - } - this.data.session_id = sessionID; - - this.checkReady(); - } - - clean() { - clearInterval(this.deathTimer); - this.emit('fail', new Error('Clean-up triggered :fourTriggered:')); - } - - pass() { - clearInterval(this.deathTimer); - this.emit('pass', this.upgrade()); - } - - fail(reason) { - this.emit('fail', reason); - this.clean(); - } - - sendVoiceStateUpdate() { - try { - this.voiceManager.sendVoiceStateUpdate(this.channel); - } catch (error) { - this.fail(error); - } - } - - /** - * Upgrades this Pending Connection to a full Voice Connection - * @returns {VoiceConnection} - */ - upgrade() { - return new VoiceConnection(this); - } - } - - module.exports = ClientVoiceManager; +module.exports = ClientOAuth2Application; /***/ }, /* 65 */ /***/ function(module, exports, __webpack_require__) { - const VoiceWebSocket = __webpack_require__(66); - const VoiceUDP = __webpack_require__(159); - const Constants = __webpack_require__(5); - const AudioPlayer = __webpack_require__(161); - const VoiceReceiver = __webpack_require__(174); - const EventEmitter = __webpack_require__(3).EventEmitter; - const fs = __webpack_require__(62); +const Channel = __webpack_require__(20); +const TextBasedChannel = __webpack_require__(28); +const Collection = __webpack_require__(6); - /** - * Represents a connection to a voice channel in Discord. - * ```js - * // obtained using: - * voiceChannel.join().then(connection => { - * - * }); - * ``` - * @extends {EventEmitter} - */ - class VoiceConnection extends EventEmitter { - constructor(pendingConnection) { - super(); +/** + * Represents a direct message channel between two users. + * @extends {Channel} + * @implements {TextBasedChannel} + */ +class DMChannel extends Channel { + constructor(client, data) { + super(client, data); + this.type = 'dm'; + this.messages = new Collection(); + this._typing = new Map(); + } - /** - * The Voice Manager that instantiated this connection - * @type {ClientVoiceManager} - */ - this.voiceManager = pendingConnection.voiceManager; + setup(data) { + super.setup(data); - /** - * The voice channel this connection is currently serving - * @type {VoiceChannel} - */ - this.channel = pendingConnection.channel; + /** + * The recipient on the other end of the DM + * @type {User} + */ + this.recipient = this.client.dataManager.newUser(data.recipients[0]); - /** - * Whether we're currently transmitting audio - * @type {boolean} - */ - this.speaking = false; + this.lastMessageID = data.last_message_id; + } - /** - * An array of Voice Receivers that have been created for this connection - * @type {VoiceReceiver[]} - */ - this.receivers = []; + /** + * When concatenated with a string, this automatically concatenates the recipient's mention instead of the + * DM channel object. + * @returns {string} + */ + toString() { + return this.recipient.toString(); + } - /** - * The authentication data needed to connect to the voice server - * @type {object} - * @private - */ - this.authentication = pendingConnection.data; + // These are here only for documentation purposes - they are implemented by TextBasedChannel + sendMessage() { return; } + sendTTSMessage() { return; } + sendFile() { return; } + sendCode() { return; } + fetchMessage() { return; } + fetchMessages() { return; } + fetchPinnedMessages() { return; } + startTyping() { return; } + stopTyping() { return; } + get typing() { return; } + get typingCount() { return; } + createCollector() { return; } + awaitMessages() { return; } + bulkDelete() { return; } + _cacheMessage() { return; } +} - /** - * The audio player for this voice connection - * @type {AudioPlayer} - */ - this.player = new AudioPlayer(this); +TextBasedChannel.applyToClass(DMChannel, true); - this.player.on('debug', m => { - /** - * Debug info from the connection - * @event VoiceConnection#debug - * @param {string} message the debug message - */ - this.emit('debug', `audio player - ${m}`); - }); - - this.player.on('error', e => { - /** - * Warning info from the connection - * @event VoiceConnection#warn - * @param {string|Error} warning the warning - */ - this.emit('warn', e); - this.player.cleanup(); - }); - - /** - * Map SSRC to speaking values - * @type {Map} - * @private - */ - this.ssrcMap = new Map(); - - /** - * Whether this connection is ready - * @type {boolean} - * @private - */ - this.ready = false; - - /** - * Object that wraps contains the `ws` and `udp` sockets of this voice connection - * @type {object} - * @private - */ - this.sockets = {}; - this.connect(); - } - - /** - * Sets whether the voice connection should display as "speaking" or not - * @param {boolean} value whether or not to speak - * @private - */ - setSpeaking(value) { - if (this.speaking === value) return; - this.speaking = value; - this.sockets.ws.sendPacket({ - op: Constants.VoiceOPCodes.SPEAKING, - d: { - speaking: true, - delay: 0, - }, - }).catch(e => { - this.emit('debug', e); - }); - } - - /** - * Disconnect the voice connection, causing a disconnect and closing event to be emitted. - */ - disconnect() { - this.emit('closing'); - this.voiceManager.client.ws.send({ - op: Constants.OPCodes.VOICE_STATE_UPDATE, - d: { - guild_id: this.channel.guild.id, - channel_id: null, - self_mute: false, - self_deaf: false, - }, - }); - /** - * Emitted when the voice connection disconnects - * @event VoiceConnection#disconnect - */ - this.emit('disconnect'); - } - - /** - * Connect the voice connection - * @private - */ - connect() { - if (this.sockets.ws) throw new Error('There is already an existing WebSocket connection.'); - if (this.sockets.udp) throw new Error('There is already an existing UDP connection.'); - this.sockets.ws = new VoiceWebSocket(this); - this.sockets.udp = new VoiceUDP(this); - this.sockets.ws.on('error', e => this.emit('error', e)); - this.sockets.udp.on('error', e => this.emit('error', e)); - this.sockets.ws.once('ready', d => { - this.authentication.port = d.port; - this.authentication.ssrc = d.ssrc; - /** - * Emitted whenever the connection encounters an error. - * @event VoiceConnection#error - * @param {Error} error the encountered error - */ - this.sockets.udp.findEndpointAddress() - .then(address => { - this.sockets.udp.createUDPSocket(address); - }, e => this.emit('error', e)); - }); - this.sockets.ws.once('sessionDescription', (mode, secret) => { - this.authentication.encryptionMode = mode; - this.authentication.secretKey = secret; - /** - * Emitted once the connection is ready, when a promise to join a voice channel resolves, - * the connection will already be ready. - * @event VoiceConnection#ready - */ - this.emit('ready'); - this.ready = true; - }); - this.sockets.ws.on('speaking', data => { - const guild = this.channel.guild; - const user = this.voiceManager.client.users.get(data.user_id); - this.ssrcMap.set(+data.ssrc, user); - if (!data.speaking) { - for (const receiver of this.receivers) { - const opusStream = receiver.opusStreams.get(user.id); - const pcmStream = receiver.pcmStreams.get(user.id); - if (opusStream) { - opusStream.push(null); - opusStream.open = false; - receiver.opusStreams.delete(user.id); - } - if (pcmStream) { - pcmStream.push(null); - pcmStream.open = false; - receiver.pcmStreams.delete(user.id); - } - } - } - /** - * Emitted whenever a user starts/stops speaking - * @event VoiceConnection#speaking - * @param {User} user The user that has started/stopped speaking - * @param {boolean} speaking Whether or not the user is speaking - */ - if (this.ready) this.emit('speaking', user, data.speaking); - guild._memberSpeakUpdate(data.user_id, data.speaking); - }); - } - - /** - * Options that can be passed to stream-playing methods: - * @typedef {Object} StreamOptions - * @property {number} [seek=0] The time to seek to - * @property {number} [volume=1] The volume to play at - * @property {number} [passes=1] How many times to send the voice packet to reduce packet loss - */ - - /** - * Play the given file in the voice connection. - * @param {string} file The path to the file - * @param {StreamOptions} [options] Options for playing the stream - * @returns {StreamDispatcher} - * @example - * // play files natively - * voiceChannel.join() - * .then(connection => { - * const dispatcher = connection.playFile('C:/Users/Discord/Desktop/music.mp3'); - * }) - * .catch(console.error); - */ - playFile(file, options) { - return this.playStream(fs.createReadStream(file), options); - } - - /** - * Plays and converts an audio stream in the voice connection. - * @param {ReadableStream} stream The audio stream to play - * @param {StreamOptions} [options] Options for playing the stream - * @returns {StreamDispatcher} - * @example - * // play streams using ytdl-core - * const ytdl = require('ytdl-core'); - * const streamOptions = { seek: 0, volume: 1 }; - * voiceChannel.join() - * .then(connection => { - * const stream = ytdl('https://www.youtube.com/watch?v=XAWgeLF9EVQ', {filter : 'audioonly'}); - * const dispatcher = connection.playStream(stream, streamOptions); - * }) - * .catch(console.error); - */ - playStream(stream, { seek = 0, volume = 1, passes = 1 } = {}) { - const options = { seek, volume, passes }; - return this.player.playUnknownStream(stream, options); - } - - /** - * Plays a stream of 16-bit signed stereo PCM at 48KHz. - * @param {ReadableStream} stream The audio stream to play. - * @param {StreamOptions} [options] Options for playing the stream - * @returns {StreamDispatcher} - */ - playConvertedStream(stream, { seek = 0, volume = 1, passes = 1 } = {}) { - const options = { seek, volume, passes }; - return this.player.playPCMStream(stream, options); - } - - /** - * Creates a VoiceReceiver so you can start listening to voice data. It's recommended to only create one of these. - * @returns {VoiceReceiver} - */ - createReceiver() { - const receiver = new VoiceReceiver(this); - this.receivers.push(receiver); - return receiver; - } - } - - module.exports = VoiceConnection; +module.exports = DMChannel; /***/ }, /* 66 */ /***/ function(module, exports, __webpack_require__) { - const WebSocket = __webpack_require__(67); - const Constants = __webpack_require__(5); - const SecretKey = __webpack_require__(158); - const EventEmitter = __webpack_require__(3).EventEmitter; +const Channel = __webpack_require__(20); +const TextBasedChannel = __webpack_require__(28); +const Collection = __webpack_require__(6); +const arraysEqual = __webpack_require__(60); - /** - * Represents a Voice Connection's WebSocket - * @extends {EventEmitter} - * @private - */ - class VoiceWebSocket extends EventEmitter { - constructor(voiceConnection) { - super(); +/* +{ type: 3, + recipients: + [ { username: 'Charlie', + id: '123', + discriminator: '6631', + avatar: '123' }, + { username: 'Ben', + id: '123', + discriminator: '2055', + avatar: '123' }, + { username: 'Adam', + id: '123', + discriminator: '2406', + avatar: '123' } ], + owner_id: '123', + name: null, + last_message_id: '123', + id: '123', + icon: null } +*/ - /** - * The Voice Connection that this WebSocket serves - * @type {VoiceConnection} - */ - this.voiceConnection = voiceConnection; +/** + * Represents a Group DM on Discord + * @extends {Channel} + * @implements {TextBasedChannel} + */ +class GroupDMChannel extends Channel { + constructor(client, data) { + super(client, data); + this.type = 'group'; + this.messages = new Collection(); + this._typing = new Map(); + } - /** - * How many connection attempts have been made - * @type {number} - */ - this.attempts = 0; + setup(data) { + super.setup(data); - this.connect(); - this.dead = false; - this.voiceConnection.on('closing', this.shutdown.bind(this)); - } + /** + * The name of this Group DM, can be null if one isn't set. + * @type {string} + */ + this.name = data.name; - shutdown() { - this.dead = true; - this.reset(); - } + /** + * A hash of the Group DM icon. + * @type {string} + */ + this.icon = data.icon; - /** - * The client of this voice websocket - * @type {Client} - * @readonly - */ - get client() { - return this.voiceConnection.voiceManager.client; - } + /** + * The user ID of this Group DM's owner. + * @type {string} + */ + this.ownerID = data.owner_id; - /** - * Resets the current WebSocket - */ - reset() { - if (this.ws) { - if (this.ws.readyState !== WebSocket.CLOSED) this.ws.close(); - this.ws = null; - } - this.clearHeartbeat(); - } + if (!this.recipients) { + /** + * A collection of the recipients of this DM, mapped by their ID. + * @type {Collection} + */ + this.recipients = new Collection(); + } - /** - * Starts connecting to the Voice WebSocket Server. - */ - connect() { - if (this.dead) return; - if (this.ws) this.reset(); - if (this.attempts > 5) { - this.emit('error', new Error(`Too many connection attempts (${this.attempts}).`)); - return; - } + if (data.recipients) { + for (const recipient of data.recipients) { + const user = this.client.dataManager.newUser(recipient); + this.recipients.set(user.id, user); + } + } - this.attempts++; + this.lastMessageID = data.last_message_id; + } - /** - * The actual WebSocket used to connect to the Voice WebSocket Server. - * @type {WebSocket} - */ - this.ws = new WebSocket(`wss://${this.voiceConnection.authentication.endpoint}`); - this.ws.onopen = this.onOpen.bind(this); - this.ws.onmessage = this.onMessage.bind(this); - this.ws.onclose = this.onClose.bind(this); - this.ws.onerror = this.onError.bind(this); - } + /** + * The owner of this Group DM. + * @type {User} + * @readonly + */ + get owner() { + return this.client.users.get(this.ownerID); + } - /** - * Sends data to the WebSocket if it is open. - * @param {string} data the data to send to the WebSocket - * @returns {Promise} - */ - send(data) { - return new Promise((resolve, reject) => { - if (!this.ws || this.ws.readyState !== WebSocket.OPEN) { - throw new Error(`Voice websocket not open to send ${data}.`); - } - this.ws.send(data, null, error => { - if (error) reject(error); else resolve(data); - }); - }); - } + /** + * Whether this channel equals another channel. It compares all properties, so for most operations + * it is advisable to just compare `channel.id === channel2.id` as it is much faster and is often + * what most users need. + * @param {GroupDMChannel} channel The channel to compare to + * @returns {boolean} + */ + equals(channel) { + const equal = channel && + this.id === channel.id && + this.name === channel.name && + this.icon === channel.icon && + this.ownerID === channel.ownerID; - /** - * JSON.stringify's a packet and then sends it to the WebSocket Server. - * @param {Object} packet the packet to send - * @returns {Promise} - */ - sendPacket(packet) { - try { - packet = JSON.stringify(packet); - } catch (error) { - return Promise.reject(error); - } - return this.send(packet); - } + if (equal) { + const thisIDs = this.recipients.keyArray(); + const otherIDs = channel.recipients.keyArray(); + return arraysEqual(thisIDs, otherIDs); + } - /** - * Called whenever the WebSocket opens - */ - onOpen() { - this.sendPacket({ - op: Constants.OPCodes.DISPATCH, - d: { - server_id: this.voiceConnection.channel.guild.id, - user_id: this.client.user.id, - token: this.voiceConnection.authentication.token, - session_id: this.voiceConnection.authentication.session_id, - }, - }).catch(() => { - this.emit('error', new Error('Tried to send join packet, but the WebSocket is not open.')); - }); - } + return equal; + } - /** - * Called whenever a message is received from the WebSocket - * @param {MessageEvent} event the message event that was received - * @returns {void} - */ - onMessage(event) { - try { - return this.onPacket(JSON.parse(event.data)); - } catch (error) { - return this.onError(error); - } - } + /** + * When concatenated with a string, this automatically concatenates the channel's name instead of the Channel object. + * @returns {string} + * @example + * // logs: Hello from My Group DM! + * console.log(`Hello from ${channel}!`); + * @example + * // logs: Hello from My Group DM! + * console.log(`Hello from ' + channel + '!'); + */ + toString() { + return this.name; + } - /** - * Called whenever the connection to the WebSocket Server is lost - */ - onClose() { - if (!this.dead) this.client.setTimeout(this.connect.bind(this), this.attempts * 1000); - } + // These are here only for documentation purposes - they are implemented by TextBasedChannel + sendMessage() { return; } + sendTTSMessage() { return; } + sendFile() { return; } + sendCode() { return; } + fetchMessage() { return; } + fetchMessages() { return; } + fetchPinnedMessages() { return; } + startTyping() { return; } + stopTyping() { return; } + get typing() { return; } + get typingCount() { return; } + createCollector() { return; } + awaitMessages() { return; } + bulkDelete() { return; } + _cacheMessage() { return; } +} - /** - * Called whenever an error occurs with the WebSocket. - * @param {Error} error the error that occurred - */ - onError(error) { - this.emit('error', error); - } +TextBasedChannel.applyToClass(GroupDMChannel, true); - /** - * Called whenever a valid packet is received from the WebSocket - * @param {Object} packet the received packet - */ - onPacket(packet) { - switch (packet.op) { - case Constants.VoiceOPCodes.READY: - this.setHeartbeat(packet.d.heartbeat_interval); - /** - * Emitted once the voice websocket receives the ready packet - * @param {Object} packet the received packet - * @event VoiceWebSocket#ready - */ - this.emit('ready', packet.d); - break; - case Constants.VoiceOPCodes.SESSION_DESCRIPTION: - /** - * Emitted once the Voice Websocket receives a description of this voice session - * @param {string} encryptionMode the type of encryption being used - * @param {SecretKey} secretKey the secret key used for encryption - * @event VoiceWebSocket#sessionDescription - */ - this.emit('sessionDescription', packet.d.mode, new SecretKey(packet.d.secret_key)); - break; - case Constants.VoiceOPCodes.SPEAKING: - /** - * Emitted whenever a speaking packet is received - * @param {Object} data - * @event VoiceWebSocket#speaking - */ - this.emit('speaking', packet.d); - break; - default: - /** - * Emitted when an unhandled packet is received - * @param {Object} packet - * @event VoiceWebSocket#unknownPacket - */ - this.emit('unknownPacket', packet); - break; - } - } - - /** - * Sets an interval at which to send a heartbeat packet to the WebSocket - * @param {number} interval the interval at which to send a heartbeat packet - */ - setHeartbeat(interval) { - if (!interval || isNaN(interval)) { - this.onError(new Error('Tried to set voice heartbeat but no valid interval was specified.')); - return; - } - if (this.heartbeatInterval) { - /** - * Emitted whenver the voice websocket encounters a non-fatal error - * @param {string} warn the warning - * @event VoiceWebSocket#warn - */ - this.emit('warn', 'A voice heartbeat interval is being overwritten'); - clearInterval(this.heartbeatInterval); - } - this.heartbeatInterval = this.client.setInterval(this.sendHeartbeat.bind(this), interval); - } - - /** - * Clears a heartbeat interval, if one exists - */ - clearHeartbeat() { - if (!this.heartbeatInterval) { - this.emit('warn', 'Tried to clear a heartbeat interval that does not exist'); - return; - } - clearInterval(this.heartbeatInterval); - this.heartbeatInterval = null; - } - - /** - * Sends a heartbeat packet - */ - sendHeartbeat() { - this.sendPacket({ op: Constants.VoiceOPCodes.HEARTBEAT, d: null }).catch(() => { - this.emit('warn', 'Tried to send heartbeat, but connection is not open'); - this.clearHeartbeat(); - }); - } - } - - module.exports = VoiceWebSocket; +module.exports = GroupDMChannel; /***/ }, /* 67 */ /***/ function(module, exports, __webpack_require__) { - 'use strict'; +const PartialGuild = __webpack_require__(73); +const PartialGuildChannel = __webpack_require__(74); +const Constants = __webpack_require__(2); - /*! - * ws: a node.js websocket client - * Copyright(c) 2011 Einar Otto Stangvik - * MIT Licensed - */ +/* +{ max_age: 86400, + code: 'CG9A5', + guild: + { splash: null, + id: '123123123', + icon: '123123123', + name: 'name' }, + created_at: '2016-08-28T19:07:04.763368+00:00', + temporary: false, + uses: 0, + max_uses: 0, + inviter: + { username: '123', + discriminator: '4204', + bot: true, + id: '123123123', + avatar: '123123123' }, + channel: { type: 0, id: '123123', name: 'heavy-testing' } } +*/ - var WS = module.exports = __webpack_require__(68); +/** + * Represents an invitation to a guild channel. + * The only guaranteed properties are `code`, `guild` and `channel`. Other properties can be missing. + */ +class Invite { + constructor(client, data) { + /** + * The client that instantiated the invite + * @type {Client} + */ + this.client = client; + Object.defineProperty(this, 'client', { enumerable: false, configurable: false }); - WS.Server = __webpack_require__(156); - WS.Sender = __webpack_require__(116); - WS.Receiver = __webpack_require__(147); + this.setup(data); + } - /** - * Create a new WebSocket server. - * - * @param {Object} options Server options - * @param {Function} fn Optional connection listener. - * @returns {WS.Server} - * @api public - */ - WS.createServer = function createServer(options, fn) { - var server = new WS.Server(options); + setup(data) { + /** + * The guild the invite is for. If this guild is already known, this will be a Guild object. If the guild is + * unknown, this will be a PartialGuild object. + * @type {Guild|PartialGuild} + */ + this.guild = this.client.guilds.get(data.guild.id) || new PartialGuild(this.client, data.guild); - if (typeof fn === 'function') { - server.on('connection', fn); - } + /** + * The code for this invite + * @type {string} + */ + this.code = data.code; - return server; - }; + /** + * Whether or not this invite is temporary + * @type {boolean} + */ + this.temporary = data.temporary; - /** - * Create a new WebSocket connection. - * - * @param {String} address The URL/address we need to connect to. - * @param {Function} fn Open listener. - * @returns {WS} - * @api public - */ - WS.connect = WS.createConnection = function connect(address, fn) { - var client = new WS(address); + /** + * The maximum age of the invite, in seconds + * @type {?number} + */ + this.maxAge = data.max_age; - if (typeof fn === 'function') { - client.on('open', fn); - } + /** + * How many times this invite has been used + * @type {number} + */ + this.uses = data.uses; - return client; - }; + /** + * The maximum uses of this invite + * @type {number} + */ + this.maxUses = data.max_uses; + + if (data.inviter) { + /** + * The user who created this invite + * @type {User} + */ + this.inviter = this.client.dataManager.newUser(data.inviter); + } + + /** + * The channel the invite is for. If this channel is already known, this will be a GuildChannel object. + * If the channel is unknown, this will be a PartialGuildChannel object. + * @type {GuildChannel|PartialGuildChannel} + */ + this.channel = this.client.channels.get(data.channel.id) || new PartialGuildChannel(this.client, data.channel); + + /** + * The timestamp the invite was created at + * @type {number} + */ + this.createdTimestamp = new Date(data.created_at).getTime(); + } + + /** + * The time the invite was created + * @type {Date} + * @readonly + */ + get createdAt() { + return new Date(this.createdTimestamp); + } + + /** + * The timestamp the invite will expire at + * @type {number} + * @readonly + */ + get expiresTimestamp() { + return this.createdTimestamp + (this.maxAge * 1000); + } + + /** + * The time the invite will expire + * @type {Date} + * @readonly + */ + get expiresAt() { + return new Date(this.expiresTimestamp); + } + + /** + * The URL to the invite + * @type {string} + * @readonly + */ + get url() { + return Constants.Endpoints.inviteLink(this.code); + } + + /** + * Deletes this invite + * @returns {Promise} + */ + delete() { + return this.client.rest.methods.deleteInvite(this); + } + + /** + * When concatenated with a string, this automatically concatenates the invite's URL instead of the object. + * @returns {string} + * @example + * // logs: Invite: https://discord.gg/A1b2C3 + * console.log(`Invite: ${invite}`); + */ + toString() { + return this.url; + } +} + +module.exports = Invite; /***/ }, /* 68 */ -/***/ function(module, exports, __webpack_require__) { +/***/ function(module, exports) { + +/** + * Represents an attachment in a message + */ +class MessageAttachment { + constructor(message, data) { + /** + * The Client that instantiated this MessageAttachment. + * @type {Client} + */ + this.client = message.client; + Object.defineProperty(this, 'client', { enumerable: false, configurable: false }); + + /** + * The message this attachment is part of. + * @type {Message} + */ + this.message = message; + + this.setup(data); + } + + setup(data) { + /** + * The ID of this attachment + * @type {string} + */ + this.id = data.id; + + /** + * The file name of this attachment + * @type {string} + */ + this.filename = data.filename; + + /** + * The size of this attachment in bytes + * @type {number} + */ + this.filesize = data.size; + + /** + * The URL to this attachment + * @type {string} + */ + this.url = data.url; + + /** + * The Proxy URL to this attachment + * @type {string} + */ + this.proxyURL = data.proxy_url; + + /** + * The height of this attachment (if an image) + * @type {?number} + */ + this.height = data.height; + + /** + * The width of this attachment (if an image) + * @type {?number} + */ + this.width = data.width; + } +} + +module.exports = MessageAttachment; - /* WEBPACK VAR INJECTION */(function(Buffer, process) {'use strict'; - - /*! - * ws: a node.js websocket client - * Copyright(c) 2011 Einar Otto Stangvik - * MIT Licensed - */ - - var url = __webpack_require__(69) - , util = __webpack_require__(75) - , http = __webpack_require__(78) - , https = __webpack_require__(98) - , crypto = __webpack_require__(99) - , stream = __webpack_require__(80) - , Ultron = __webpack_require__(114) - , Options = __webpack_require__(115) - , Sender = __webpack_require__(116) - , Receiver = __webpack_require__(147) - , SenderHixie = __webpack_require__(153) - , ReceiverHixie = __webpack_require__(154) - , Extensions = __webpack_require__(155) - , PerMessageDeflate = __webpack_require__(125) - , EventEmitter = __webpack_require__(3).EventEmitter; - - /** - * Constants - */ - - // Default protocol version - - var protocolVersion = 13; - - // Close timeout - - var closeTimeout = 30 * 1000; // Allow 30 seconds to terminate the connection cleanly - - /** - * WebSocket implementation - * - * @constructor - * @param {String} address Connection address. - * @param {String|Array} protocols WebSocket protocols. - * @param {Object} options Additional connection options. - * @api public - */ - function WebSocket(address, protocols, options) { - if (this instanceof WebSocket === false) { - return new WebSocket(address, protocols, options); - } - - EventEmitter.call(this); - - if (protocols && !Array.isArray(protocols) && 'object' === typeof protocols) { - // accept the "options" Object as the 2nd argument - options = protocols; - protocols = null; - } - - if ('string' === typeof protocols) { - protocols = [ protocols ]; - } - - if (!Array.isArray(protocols)) { - protocols = []; - } - - this._socket = null; - this._ultron = null; - this._closeReceived = false; - this.bytesReceived = 0; - this.readyState = null; - this.supports = {}; - this.extensions = {}; - this._binaryType = 'nodebuffer'; - - if (Array.isArray(address)) { - initAsServerClient.apply(this, address.concat(options)); - } else { - initAsClient.apply(this, [address, protocols, options]); - } - } - - /** - * Inherits from EventEmitter. - */ - util.inherits(WebSocket, EventEmitter); - - /** - * Ready States - */ - ["CONNECTING", "OPEN", "CLOSING", "CLOSED"].forEach(function each(state, index) { - WebSocket.prototype[state] = WebSocket[state] = index; - }); - - /** - * Gracefully closes the connection, after sending a description message to the server - * - * @param {Object} data to be sent to the server - * @api public - */ - WebSocket.prototype.close = function close(code, data) { - if (this.readyState === WebSocket.CLOSED) return; - - if (this.readyState === WebSocket.CONNECTING) { - this.readyState = WebSocket.CLOSED; - return; - } - - if (this.readyState === WebSocket.CLOSING) { - if (this._closeReceived && this._isServer) { - this.terminate(); - } - return; - } - - var self = this; - try { - this.readyState = WebSocket.CLOSING; - this._closeCode = code; - this._closeMessage = data; - var mask = !this._isServer; - this._sender.close(code, data, mask, function(err) { - if (err) self.emit('error', err); - - if (self._closeReceived && self._isServer) { - self.terminate(); - } else { - // ensure that the connection is cleaned up even when no response of closing handshake. - clearTimeout(self._closeTimer); - self._closeTimer = setTimeout(cleanupWebsocketResources.bind(self, true), closeTimeout); - } - }); - } catch (e) { - this.emit('error', e); - } - }; - - /** - * Pause the client stream - * - * @api public - */ - WebSocket.prototype.pause = function pauser() { - if (this.readyState !== WebSocket.OPEN) throw new Error('not opened'); - - return this._socket.pause(); - }; - - /** - * Sends a ping - * - * @param {Object} data to be sent to the server - * @param {Object} Members - mask: boolean, binary: boolean - * @param {boolean} dontFailWhenClosed indicates whether or not to throw if the connection isnt open - * @api public - */ - WebSocket.prototype.ping = function ping(data, options, dontFailWhenClosed) { - if (this.readyState !== WebSocket.OPEN) { - if (dontFailWhenClosed === true) return; - throw new Error('not opened'); - } - - options = options || {}; - - if (typeof options.mask === 'undefined') options.mask = !this._isServer; - - this._sender.ping(data, options); - }; - - /** - * Sends a pong - * - * @param {Object} data to be sent to the server - * @param {Object} Members - mask: boolean, binary: boolean - * @param {boolean} dontFailWhenClosed indicates whether or not to throw if the connection isnt open - * @api public - */ - WebSocket.prototype.pong = function(data, options, dontFailWhenClosed) { - if (this.readyState !== WebSocket.OPEN) { - if (dontFailWhenClosed === true) return; - throw new Error('not opened'); - } - - options = options || {}; - - if (typeof options.mask === 'undefined') options.mask = !this._isServer; - - this._sender.pong(data, options); - }; - - /** - * Resume the client stream - * - * @api public - */ - WebSocket.prototype.resume = function resume() { - if (this.readyState !== WebSocket.OPEN) throw new Error('not opened'); - - return this._socket.resume(); - }; - - /** - * Sends a piece of data - * - * @param {Object} data to be sent to the server - * @param {Object} Members - mask: boolean, binary: boolean, compress: boolean - * @param {function} Optional callback which is executed after the send completes - * @api public - */ - - WebSocket.prototype.send = function send(data, options, cb) { - if (typeof options === 'function') { - cb = options; - options = {}; - } - - if (this.readyState !== WebSocket.OPEN) { - if (typeof cb === 'function') cb(new Error('not opened')); - else throw new Error('not opened'); - return; - } - - if (!data) data = ''; - if (this._queue) { - var self = this; - this._queue.push(function() { self.send(data, options, cb); }); - return; - } - - options = options || {}; - options.fin = true; - - if (typeof options.binary === 'undefined') { - options.binary = (data instanceof ArrayBuffer || data instanceof Buffer || - data instanceof Uint8Array || - data instanceof Uint16Array || - data instanceof Uint32Array || - data instanceof Int8Array || - data instanceof Int16Array || - data instanceof Int32Array || - data instanceof Float32Array || - data instanceof Float64Array); - } - - if (typeof options.mask === 'undefined') options.mask = !this._isServer; - if (typeof options.compress === 'undefined') options.compress = true; - if (!this.extensions[PerMessageDeflate.extensionName]) { - options.compress = false; - } - - var readable = typeof stream.Readable === 'function' - ? stream.Readable - : stream.Stream; - - if (data instanceof readable) { - startQueue(this); - var self = this; - - sendStream(this, data, options, function send(error) { - process.nextTick(function tock() { - executeQueueSends(self); - }); - - if (typeof cb === 'function') cb(error); - }); - } else { - this._sender.send(data, options, cb); - } - }; - - /** - * Streams data through calls to a user supplied function - * - * @param {Object} Members - mask: boolean, binary: boolean, compress: boolean - * @param {function} 'function (error, send)' which is executed on successive ticks of which send is 'function (data, final)'. - * @api public - */ - WebSocket.prototype.stream = function stream(options, cb) { - if (typeof options === 'function') { - cb = options; - options = {}; - } - - var self = this; - - if (typeof cb !== 'function') throw new Error('callback must be provided'); - - if (this.readyState !== WebSocket.OPEN) { - if (typeof cb === 'function') cb(new Error('not opened')); - else throw new Error('not opened'); - return; - } - - if (this._queue) { - this._queue.push(function () { self.stream(options, cb); }); - return; - } - - options = options || {}; - - if (typeof options.mask === 'undefined') options.mask = !this._isServer; - if (typeof options.compress === 'undefined') options.compress = true; - if (!this.extensions[PerMessageDeflate.extensionName]) { - options.compress = false; - } - - startQueue(this); - - function send(data, final) { - try { - if (self.readyState !== WebSocket.OPEN) throw new Error('not opened'); - options.fin = final === true; - self._sender.send(data, options); - if (!final) process.nextTick(cb.bind(null, null, send)); - else executeQueueSends(self); - } catch (e) { - if (typeof cb === 'function') cb(e); - else { - delete self._queue; - self.emit('error', e); - } - } - } - - process.nextTick(cb.bind(null, null, send)); - }; - - /** - * Immediately shuts down the connection - * - * @api public - */ - WebSocket.prototype.terminate = function terminate() { - if (this.readyState === WebSocket.CLOSED) return; - - if (this._socket) { - this.readyState = WebSocket.CLOSING; - - // End the connection - try { this._socket.end(); } - catch (e) { - // Socket error during end() call, so just destroy it right now - cleanupWebsocketResources.call(this, true); - return; - } - - // Add a timeout to ensure that the connection is completely - // cleaned up within 30 seconds, even if the clean close procedure - // fails for whatever reason - // First cleanup any pre-existing timeout from an earlier "terminate" call, - // if one exists. Otherwise terminate calls in quick succession will leak timeouts - // and hold the program open for `closeTimout` time. - if (this._closeTimer) { clearTimeout(this._closeTimer); } - this._closeTimer = setTimeout(cleanupWebsocketResources.bind(this, true), closeTimeout); - } else if (this.readyState === WebSocket.CONNECTING) { - cleanupWebsocketResources.call(this, true); - } - }; - - /** - * Expose bufferedAmount - * - * @api public - */ - Object.defineProperty(WebSocket.prototype, 'bufferedAmount', { - get: function get() { - var amount = 0; - if (this._socket) { - amount = this._socket.bufferSize || 0; - } - return amount; - } - }); - - /** - * Expose binaryType - * - * This deviates from the W3C interface since ws doesn't support the required - * default "blob" type (instead we define a custom "nodebuffer" type). - * - * @see http://dev.w3.org/html5/websockets/#the-websocket-interface - * @api public - */ - Object.defineProperty(WebSocket.prototype, 'binaryType', { - get: function get() { - return this._binaryType; - }, - set: function set(type) { - if (type === 'arraybuffer' || type === 'nodebuffer') - this._binaryType = type; - else - throw new SyntaxError('unsupported binaryType: must be either "nodebuffer" or "arraybuffer"'); - } - }); - - /** - * Emulates the W3C Browser based WebSocket interface using function members. - * - * @see http://dev.w3.org/html5/websockets/#the-websocket-interface - * @api public - */ - ['open', 'error', 'close', 'message'].forEach(function(method) { - Object.defineProperty(WebSocket.prototype, 'on' + method, { - /** - * Returns the current listener - * - * @returns {Mixed} the set function or undefined - * @api public - */ - get: function get() { - var listener = this.listeners(method)[0]; - return listener ? (listener._listener ? listener._listener : listener) : undefined; - }, - - /** - * Start listening for events - * - * @param {Function} listener the listener - * @returns {Mixed} the set function or undefined - * @api public - */ - set: function set(listener) { - this.removeAllListeners(method); - this.addEventListener(method, listener); - } - }); - }); - - /** - * Emulates the W3C Browser based WebSocket interface using addEventListener. - * - * @see https://developer.mozilla.org/en/DOM/element.addEventListener - * @see http://dev.w3.org/html5/websockets/#the-websocket-interface - * @api public - */ - WebSocket.prototype.addEventListener = function(method, listener) { - var target = this; - - function onMessage (data, flags) { - if (flags.binary && this.binaryType === 'arraybuffer') - data = new Uint8Array(data).buffer; - listener.call(target, new MessageEvent(data, !!flags.binary, target)); - } - - function onClose (code, message) { - listener.call(target, new CloseEvent(code, message, target)); - } - - function onError (event) { - event.type = 'error'; - event.target = target; - listener.call(target, event); - } - - function onOpen () { - listener.call(target, new OpenEvent(target)); - } - - if (typeof listener === 'function') { - if (method === 'message') { - // store a reference so we can return the original function from the - // addEventListener hook - onMessage._listener = listener; - this.on(method, onMessage); - } else if (method === 'close') { - // store a reference so we can return the original function from the - // addEventListener hook - onClose._listener = listener; - this.on(method, onClose); - } else if (method === 'error') { - // store a reference so we can return the original function from the - // addEventListener hook - onError._listener = listener; - this.on(method, onError); - } else if (method === 'open') { - // store a reference so we can return the original function from the - // addEventListener hook - onOpen._listener = listener; - this.on(method, onOpen); - } else { - this.on(method, listener); - } - } - }; - - module.exports = WebSocket; - module.exports.buildHostHeader = buildHostHeader - - /** - * W3C MessageEvent - * - * @see http://www.w3.org/TR/html5/comms.html - * @constructor - * @api private - */ - function MessageEvent(dataArg, isBinary, target) { - this.type = 'message'; - this.data = dataArg; - this.target = target; - this.binary = isBinary; // non-standard. - } - - /** - * W3C CloseEvent - * - * @see http://www.w3.org/TR/html5/comms.html - * @constructor - * @api private - */ - function CloseEvent(code, reason, target) { - this.type = 'close'; - this.wasClean = (typeof code === 'undefined' || code === 1000); - this.code = code; - this.reason = reason; - this.target = target; - } - - /** - * W3C OpenEvent - * - * @see http://www.w3.org/TR/html5/comms.html - * @constructor - * @api private - */ - function OpenEvent(target) { - this.type = 'open'; - this.target = target; - } - - // Append port number to Host header, only if specified in the url - // and non-default - function buildHostHeader(isSecure, hostname, port) { - var headerHost = hostname; - if (hostname) { - if ((isSecure && (port != 443)) || (!isSecure && (port != 80))){ - headerHost = headerHost + ':' + port; - } - } - return headerHost; - } - - /** - * Entirely private apis, - * which may or may not be bound to a sepcific WebSocket instance. - */ - function initAsServerClient(req, socket, upgradeHead, options) { - options = new Options({ - protocolVersion: protocolVersion, - protocol: null, - extensions: {}, - maxPayload: 0 - }).merge(options); - - // expose state properties - this.protocol = options.value.protocol; - this.protocolVersion = options.value.protocolVersion; - this.extensions = options.value.extensions; - this.supports.binary = (this.protocolVersion !== 'hixie-76'); - this.upgradeReq = req; - this.readyState = WebSocket.CONNECTING; - this._isServer = true; - this.maxPayload = options.value.maxPayload; - // establish connection - if (options.value.protocolVersion === 'hixie-76') { - establishConnection.call(this, ReceiverHixie, SenderHixie, socket, upgradeHead); - } else { - establishConnection.call(this, Receiver, Sender, socket, upgradeHead); - } - } - - function initAsClient(address, protocols, options) { - options = new Options({ - origin: null, - protocolVersion: protocolVersion, - host: null, - headers: null, - protocol: protocols.join(','), - agent: null, - - // ssl-related options - pfx: null, - key: null, - passphrase: null, - cert: null, - ca: null, - ciphers: null, - rejectUnauthorized: null, - perMessageDeflate: true, - localAddress: null - }).merge(options); - - if (options.value.protocolVersion !== 8 && options.value.protocolVersion !== 13) { - throw new Error('unsupported protocol version'); - } - - // verify URL and establish http class - var serverUrl = url.parse(address); - var isUnixSocket = serverUrl.protocol === 'ws+unix:'; - if (!serverUrl.host && !isUnixSocket) throw new Error('invalid url'); - var isSecure = serverUrl.protocol === 'wss:' || serverUrl.protocol === 'https:'; - var httpObj = isSecure ? https : http; - var port = serverUrl.port || (isSecure ? 443 : 80); - var auth = serverUrl.auth; - - // prepare extensions - var extensionsOffer = {}; - var perMessageDeflate; - if (options.value.perMessageDeflate) { - perMessageDeflate = new PerMessageDeflate(typeof options.value.perMessageDeflate !== true ? options.value.perMessageDeflate : {}, false); - extensionsOffer[PerMessageDeflate.extensionName] = perMessageDeflate.offer(); - } - - // expose state properties - this._isServer = false; - this.url = address; - this.protocolVersion = options.value.protocolVersion; - this.supports.binary = (this.protocolVersion !== 'hixie-76'); - - // begin handshake - var key = new Buffer(options.value.protocolVersion + '-' + Date.now()).toString('base64'); - var shasum = crypto.createHash('sha1'); - shasum.update(key + '258EAFA5-E914-47DA-95CA-C5AB0DC85B11'); - var expectedServerKey = shasum.digest('base64'); - - var agent = options.value.agent; - - var headerHost = buildHostHeader(isSecure, serverUrl.hostname, port) - - var requestOptions = { - port: port, - host: serverUrl.hostname, - headers: { - 'Connection': 'Upgrade', - 'Upgrade': 'websocket', - 'Host': headerHost, - 'Sec-WebSocket-Version': options.value.protocolVersion, - 'Sec-WebSocket-Key': key - } - }; - - // If we have basic auth. - if (auth) { - requestOptions.headers.Authorization = 'Basic ' + new Buffer(auth).toString('base64'); - } - - if (options.value.protocol) { - requestOptions.headers['Sec-WebSocket-Protocol'] = options.value.protocol; - } - - if (options.value.host) { - requestOptions.headers.Host = options.value.host; - } - - if (options.value.headers) { - for (var header in options.value.headers) { - if (options.value.headers.hasOwnProperty(header)) { - requestOptions.headers[header] = options.value.headers[header]; - } - } - } - - if (Object.keys(extensionsOffer).length) { - requestOptions.headers['Sec-WebSocket-Extensions'] = Extensions.format(extensionsOffer); - } - - if (options.isDefinedAndNonNull('pfx') - || options.isDefinedAndNonNull('key') - || options.isDefinedAndNonNull('passphrase') - || options.isDefinedAndNonNull('cert') - || options.isDefinedAndNonNull('ca') - || options.isDefinedAndNonNull('ciphers') - || options.isDefinedAndNonNull('rejectUnauthorized')) { - - if (options.isDefinedAndNonNull('pfx')) requestOptions.pfx = options.value.pfx; - if (options.isDefinedAndNonNull('key')) requestOptions.key = options.value.key; - if (options.isDefinedAndNonNull('passphrase')) requestOptions.passphrase = options.value.passphrase; - if (options.isDefinedAndNonNull('cert')) requestOptions.cert = options.value.cert; - if (options.isDefinedAndNonNull('ca')) requestOptions.ca = options.value.ca; - if (options.isDefinedAndNonNull('ciphers')) requestOptions.ciphers = options.value.ciphers; - if (options.isDefinedAndNonNull('rejectUnauthorized')) requestOptions.rejectUnauthorized = options.value.rejectUnauthorized; - - if (!agent) { - // global agent ignores client side certificates - agent = new httpObj.Agent(requestOptions); - } - } - - requestOptions.path = serverUrl.path || '/'; - - if (agent) { - requestOptions.agent = agent; - } - - if (isUnixSocket) { - requestOptions.socketPath = serverUrl.pathname; - } - - if (options.value.localAddress) { - requestOptions.localAddress = options.value.localAddress; - } - - if (options.value.origin) { - if (options.value.protocolVersion < 13) requestOptions.headers['Sec-WebSocket-Origin'] = options.value.origin; - else requestOptions.headers.Origin = options.value.origin; - } - - var self = this; - var req = httpObj.request(requestOptions); - - req.on('error', function onerror(error) { - self.emit('error', error); - cleanupWebsocketResources.call(self, error); - }); - - req.once('response', function response(res) { - var error; - - if (!self.emit('unexpected-response', req, res)) { - error = new Error('unexpected server response (' + res.statusCode + ')'); - req.abort(); - self.emit('error', error); - } - - cleanupWebsocketResources.call(self, error); - }); - - req.once('upgrade', function upgrade(res, socket, upgradeHead) { - if (self.readyState === WebSocket.CLOSED) { - // client closed before server accepted connection - self.emit('close'); - self.removeAllListeners(); - socket.end(); - return; - } - - var serverKey = res.headers['sec-websocket-accept']; - if (typeof serverKey === 'undefined' || serverKey !== expectedServerKey) { - self.emit('error', 'invalid server key'); - self.removeAllListeners(); - socket.end(); - return; - } - - var serverProt = res.headers['sec-websocket-protocol']; - var protList = (options.value.protocol || "").split(/, */); - var protError = null; - - if (!options.value.protocol && serverProt) { - protError = 'server sent a subprotocol even though none requested'; - } else if (options.value.protocol && !serverProt) { - protError = 'server sent no subprotocol even though requested'; - } else if (serverProt && protList.indexOf(serverProt) === -1) { - protError = 'server responded with an invalid protocol'; - } - - if (protError) { - self.emit('error', protError); - self.removeAllListeners(); - socket.end(); - return; - } else if (serverProt) { - self.protocol = serverProt; - } - - var serverExtensions = Extensions.parse(res.headers['sec-websocket-extensions']); - if (perMessageDeflate && serverExtensions[PerMessageDeflate.extensionName]) { - try { - perMessageDeflate.accept(serverExtensions[PerMessageDeflate.extensionName]); - } catch (err) { - self.emit('error', 'invalid extension parameter'); - self.removeAllListeners(); - socket.end(); - return; - } - self.extensions[PerMessageDeflate.extensionName] = perMessageDeflate; - } - - establishConnection.call(self, Receiver, Sender, socket, upgradeHead); - - // perform cleanup on http resources - req.removeAllListeners(); - req = null; - agent = null; - }); - - req.end(); - this.readyState = WebSocket.CONNECTING; - } - - function establishConnection(ReceiverClass, SenderClass, socket, upgradeHead) { - var ultron = this._ultron = new Ultron(socket) - , called = false - , self = this; - - socket.setTimeout(0); - socket.setNoDelay(true); - - this._receiver = new ReceiverClass(this.extensions,this.maxPayload); - this._socket = socket; - - // socket cleanup handlers - ultron.on('end', cleanupWebsocketResources.bind(this)); - ultron.on('close', cleanupWebsocketResources.bind(this)); - ultron.on('error', cleanupWebsocketResources.bind(this)); - - // ensure that the upgradeHead is added to the receiver - function firstHandler(data) { - if (called || self.readyState === WebSocket.CLOSED) return; - - called = true; - socket.removeListener('data', firstHandler); - ultron.on('data', realHandler); - - if (upgradeHead && upgradeHead.length > 0) { - realHandler(upgradeHead); - upgradeHead = null; - } - - if (data) realHandler(data); - } - - // subsequent packets are pushed straight to the receiver - function realHandler(data) { - self.bytesReceived += data.length; - self._receiver.add(data); - } - - ultron.on('data', firstHandler); - - // if data was passed along with the http upgrade, - // this will schedule a push of that on to the receiver. - // this has to be done on next tick, since the caller - // hasn't had a chance to set event handlers on this client - // object yet. - process.nextTick(firstHandler); - - // receiver event handlers - self._receiver.ontext = function ontext(data, flags) { - flags = flags || {}; - - self.emit('message', data, flags); - }; - - self._receiver.onbinary = function onbinary(data, flags) { - flags = flags || {}; - - flags.binary = true; - self.emit('message', data, flags); - }; - - self._receiver.onping = function onping(data, flags) { - flags = flags || {}; - - self.pong(data, { - mask: !self._isServer, - binary: flags.binary === true - }, true); - - self.emit('ping', data, flags); - }; - - self._receiver.onpong = function onpong(data, flags) { - self.emit('pong', data, flags || {}); - }; - - self._receiver.onclose = function onclose(code, data, flags) { - flags = flags || {}; - - self._closeReceived = true; - self.close(code, data); - }; - - self._receiver.onerror = function onerror(reason, errorCode) { - // close the connection when the receiver reports a HyBi error code - self.close(typeof errorCode !== 'undefined' ? errorCode : 1002, ''); - self.emit('error', (reason instanceof Error) ? reason : (new Error(reason))); - }; - - // finalize the client - this._sender = new SenderClass(socket, this.extensions); - this._sender.on('error', function onerror(error) { - self.close(1002, ''); - self.emit('error', error); - }); - - this.readyState = WebSocket.OPEN; - this.emit('open'); - } - - function startQueue(instance) { - instance._queue = instance._queue || []; - } - - function executeQueueSends(instance) { - var queue = instance._queue; - if (typeof queue === 'undefined') return; - - delete instance._queue; - for (var i = 0, l = queue.length; i < l; ++i) { - queue[i](); - } - } - - function sendStream(instance, stream, options, cb) { - stream.on('data', function incoming(data) { - if (instance.readyState !== WebSocket.OPEN) { - if (typeof cb === 'function') cb(new Error('not opened')); - else { - delete instance._queue; - instance.emit('error', new Error('not opened')); - } - return; - } - - options.fin = false; - instance._sender.send(data, options); - }); - - stream.on('end', function end() { - if (instance.readyState !== WebSocket.OPEN) { - if (typeof cb === 'function') cb(new Error('not opened')); - else { - delete instance._queue; - instance.emit('error', new Error('not opened')); - } - return; - } - - options.fin = true; - instance._sender.send(null, options); - - if (typeof cb === 'function') cb(null); - }); - } - - function cleanupWebsocketResources(error) { - if (this.readyState === WebSocket.CLOSED) return; - - this.readyState = WebSocket.CLOSED; - - clearTimeout(this._closeTimer); - this._closeTimer = null; - - // If the connection was closed abnormally (with an error), or if - // the close control frame was not received then the close code - // must default to 1006. - if (error || !this._closeReceived) { - this._closeCode = 1006; - } - this.emit('close', this._closeCode || 1000, this._closeMessage || ''); - - if (this._socket) { - if (this._ultron) this._ultron.destroy(); - this._socket.on('error', function onerror() { - try { this.destroy(); } - catch (e) {} - }); - - try { - if (!error) this._socket.end(); - else this._socket.destroy(); - } catch (e) { /* Ignore termination errors */ } - - this._socket = null; - this._ultron = null; - } - - if (this._sender) { - this._sender.removeAllListeners(); - this._sender = null; - } - - if (this._receiver) { - this._receiver.cleanup(); - this._receiver = null; - } - - if (this.extensions[PerMessageDeflate.extensionName]) { - this.extensions[PerMessageDeflate.extensionName].cleanup(); - } - - this.extensions = null; - - this.removeAllListeners(); - this.on('error', function onerror() {}); // catch all errors after this - delete this._queue; - } - - /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(58).Buffer, __webpack_require__(2))) /***/ }, /* 69 */ /***/ function(module, exports, __webpack_require__) { - // Copyright Joyent, Inc. and other Node contributors. - // - // Permission is hereby granted, free of charge, to any person obtaining a - // copy of this software and associated documentation files (the - // "Software"), to deal in the Software without restriction, including - // without limitation the rights to use, copy, modify, merge, publish, - // distribute, sublicense, and/or sell copies of the Software, and to permit - // persons to whom the Software is furnished to do so, subject to the - // following conditions: - // - // The above copyright notice and this permission notice shall be included - // in all copies or substantial portions of the Software. - // - // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN - // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE - // USE OR OTHER DEALINGS IN THE SOFTWARE. - - var punycode = __webpack_require__(70); - - exports.parse = urlParse; - exports.resolve = urlResolve; - exports.resolveObject = urlResolveObject; - exports.format = urlFormat; - - exports.Url = Url; - - function Url() { - this.protocol = null; - this.slashes = null; - this.auth = null; - this.host = null; - this.port = null; - this.hostname = null; - this.hash = null; - this.search = null; - this.query = null; - this.pathname = null; - this.path = null; - this.href = null; - } - - // Reference: RFC 3986, RFC 1808, RFC 2396 - - // define these here so at least they only have to be - // compiled once on the first module load. - var protocolPattern = /^([a-z0-9.+-]+:)/i, - portPattern = /:[0-9]*$/, - - // RFC 2396: characters reserved for delimiting URLs. - // We actually just auto-escape these. - delims = ['<', '>', '"', '`', ' ', '\r', '\n', '\t'], - - // RFC 2396: characters not allowed for various reasons. - unwise = ['{', '}', '|', '\\', '^', '`'].concat(delims), - - // Allowed by RFCs, but cause of XSS attacks. Always escape these. - autoEscape = ['\''].concat(unwise), - // Characters that are never ever allowed in a hostname. - // Note that any invalid chars are also handled, but these - // are the ones that are *expected* to be seen, so we fast-path - // them. - nonHostChars = ['%', '/', '?', ';', '#'].concat(autoEscape), - hostEndingChars = ['/', '?', '#'], - hostnameMaxLen = 255, - hostnamePartPattern = /^[a-z0-9A-Z_-]{0,63}$/, - hostnamePartStart = /^([a-z0-9A-Z_-]{0,63})(.*)$/, - // protocols that can allow "unsafe" and "unwise" chars. - unsafeProtocol = { - 'javascript': true, - 'javascript:': true - }, - // protocols that never have a hostname. - hostlessProtocol = { - 'javascript': true, - 'javascript:': true - }, - // protocols that always contain a // bit. - slashedProtocol = { - 'http': true, - 'https': true, - 'ftp': true, - 'gopher': true, - 'file': true, - 'http:': true, - 'https:': true, - 'ftp:': true, - 'gopher:': true, - 'file:': true - }, - querystring = __webpack_require__(72); - - function urlParse(url, parseQueryString, slashesDenoteHost) { - if (url && isObject(url) && url instanceof Url) return url; - - var u = new Url; - u.parse(url, parseQueryString, slashesDenoteHost); - return u; - } - - Url.prototype.parse = function(url, parseQueryString, slashesDenoteHost) { - if (!isString(url)) { - throw new TypeError("Parameter 'url' must be a string, not " + typeof url); - } - - var rest = url; - - // trim before proceeding. - // This is to support parse stuff like " http://foo.com \n" - rest = rest.trim(); - - var proto = protocolPattern.exec(rest); - if (proto) { - proto = proto[0]; - var lowerProto = proto.toLowerCase(); - this.protocol = lowerProto; - rest = rest.substr(proto.length); - } - - // figure out if it's got a host - // user@server is *always* interpreted as a hostname, and url - // resolution will treat //foo/bar as host=foo,path=bar because that's - // how the browser resolves relative URLs. - if (slashesDenoteHost || proto || rest.match(/^\/\/[^@\/]+@[^@\/]+/)) { - var slashes = rest.substr(0, 2) === '//'; - if (slashes && !(proto && hostlessProtocol[proto])) { - rest = rest.substr(2); - this.slashes = true; - } - } - - if (!hostlessProtocol[proto] && - (slashes || (proto && !slashedProtocol[proto]))) { - - // there's a hostname. - // the first instance of /, ?, ;, or # ends the host. - // - // If there is an @ in the hostname, then non-host chars *are* allowed - // to the left of the last @ sign, unless some host-ending character - // comes *before* the @-sign. - // URLs are obnoxious. - // - // ex: - // http://a@b@c/ => user:a@b host:c - // http://a@b?@c => user:a host:c path:/?@c - - // v0.12 TODO(isaacs): This is not quite how Chrome does things. - // Review our test case against browsers more comprehensively. - - // find the first instance of any hostEndingChars - var hostEnd = -1; - for (var i = 0; i < hostEndingChars.length; i++) { - var hec = rest.indexOf(hostEndingChars[i]); - if (hec !== -1 && (hostEnd === -1 || hec < hostEnd)) - hostEnd = hec; - } - - // at this point, either we have an explicit point where the - // auth portion cannot go past, or the last @ char is the decider. - var auth, atSign; - if (hostEnd === -1) { - // atSign can be anywhere. - atSign = rest.lastIndexOf('@'); - } else { - // atSign must be in auth portion. - // http://a@b/c@d => host:b auth:a path:/c@d - atSign = rest.lastIndexOf('@', hostEnd); - } - - // Now we have a portion which is definitely the auth. - // Pull that off. - if (atSign !== -1) { - auth = rest.slice(0, atSign); - rest = rest.slice(atSign + 1); - this.auth = decodeURIComponent(auth); - } - - // the host is the remaining to the left of the first non-host char - hostEnd = -1; - for (var i = 0; i < nonHostChars.length; i++) { - var hec = rest.indexOf(nonHostChars[i]); - if (hec !== -1 && (hostEnd === -1 || hec < hostEnd)) - hostEnd = hec; - } - // if we still have not hit it, then the entire thing is a host. - if (hostEnd === -1) - hostEnd = rest.length; - - this.host = rest.slice(0, hostEnd); - rest = rest.slice(hostEnd); - - // pull out port. - this.parseHost(); - - // we've indicated that there is a hostname, - // so even if it's empty, it has to be present. - this.hostname = this.hostname || ''; - - // if hostname begins with [ and ends with ] - // assume that it's an IPv6 address. - var ipv6Hostname = this.hostname[0] === '[' && - this.hostname[this.hostname.length - 1] === ']'; - - // validate a little. - if (!ipv6Hostname) { - var hostparts = this.hostname.split(/\./); - for (var i = 0, l = hostparts.length; i < l; i++) { - var part = hostparts[i]; - if (!part) continue; - if (!part.match(hostnamePartPattern)) { - var newpart = ''; - for (var j = 0, k = part.length; j < k; j++) { - if (part.charCodeAt(j) > 127) { - // we replace non-ASCII char with a temporary placeholder - // we need this to make sure size of hostname is not - // broken by replacing non-ASCII by nothing - newpart += 'x'; - } else { - newpart += part[j]; - } - } - // we test again with ASCII char only - if (!newpart.match(hostnamePartPattern)) { - var validParts = hostparts.slice(0, i); - var notHost = hostparts.slice(i + 1); - var bit = part.match(hostnamePartStart); - if (bit) { - validParts.push(bit[1]); - notHost.unshift(bit[2]); - } - if (notHost.length) { - rest = '/' + notHost.join('.') + rest; - } - this.hostname = validParts.join('.'); - break; - } - } - } - } - - if (this.hostname.length > hostnameMaxLen) { - this.hostname = ''; - } else { - // hostnames are always lower case. - this.hostname = this.hostname.toLowerCase(); - } - - if (!ipv6Hostname) { - // IDNA Support: Returns a puny coded representation of "domain". - // It only converts the part of the domain name that - // has non ASCII characters. I.e. it dosent matter if - // you call it with a domain that already is in ASCII. - var domainArray = this.hostname.split('.'); - var newOut = []; - for (var i = 0; i < domainArray.length; ++i) { - var s = domainArray[i]; - newOut.push(s.match(/[^A-Za-z0-9_-]/) ? - 'xn--' + punycode.encode(s) : s); - } - this.hostname = newOut.join('.'); - } - - var p = this.port ? ':' + this.port : ''; - var h = this.hostname || ''; - this.host = h + p; - this.href += this.host; - - // strip [ and ] from the hostname - // the host field still retains them, though - if (ipv6Hostname) { - this.hostname = this.hostname.substr(1, this.hostname.length - 2); - if (rest[0] !== '/') { - rest = '/' + rest; - } - } - } - - // now rest is set to the post-host stuff. - // chop off any delim chars. - if (!unsafeProtocol[lowerProto]) { - - // First, make 100% sure that any "autoEscape" chars get - // escaped, even if encodeURIComponent doesn't think they - // need to be. - for (var i = 0, l = autoEscape.length; i < l; i++) { - var ae = autoEscape[i]; - var esc = encodeURIComponent(ae); - if (esc === ae) { - esc = escape(ae); - } - rest = rest.split(ae).join(esc); - } - } - - - // chop off from the tail first. - var hash = rest.indexOf('#'); - if (hash !== -1) { - // got a fragment string. - this.hash = rest.substr(hash); - rest = rest.slice(0, hash); - } - var qm = rest.indexOf('?'); - if (qm !== -1) { - this.search = rest.substr(qm); - this.query = rest.substr(qm + 1); - if (parseQueryString) { - this.query = querystring.parse(this.query); - } - rest = rest.slice(0, qm); - } else if (parseQueryString) { - // no query string, but parseQueryString still requested - this.search = ''; - this.query = {}; - } - if (rest) this.pathname = rest; - if (slashedProtocol[lowerProto] && - this.hostname && !this.pathname) { - this.pathname = '/'; - } - - //to support http.request - if (this.pathname || this.search) { - var p = this.pathname || ''; - var s = this.search || ''; - this.path = p + s; - } - - // finally, reconstruct the href based on what has been validated. - this.href = this.format(); - return this; - }; - - // format a parsed object into a url string - function urlFormat(obj) { - // ensure it's an object, and not a string url. - // If it's an obj, this is a no-op. - // this way, you can call url_format() on strings - // to clean up potentially wonky urls. - if (isString(obj)) obj = urlParse(obj); - if (!(obj instanceof Url)) return Url.prototype.format.call(obj); - return obj.format(); - } - - Url.prototype.format = function() { - var auth = this.auth || ''; - if (auth) { - auth = encodeURIComponent(auth); - auth = auth.replace(/%3A/i, ':'); - auth += '@'; - } - - var protocol = this.protocol || '', - pathname = this.pathname || '', - hash = this.hash || '', - host = false, - query = ''; - - if (this.host) { - host = auth + this.host; - } else if (this.hostname) { - host = auth + (this.hostname.indexOf(':') === -1 ? - this.hostname : - '[' + this.hostname + ']'); - if (this.port) { - host += ':' + this.port; - } - } - - if (this.query && - isObject(this.query) && - Object.keys(this.query).length) { - query = querystring.stringify(this.query); - } - - var search = this.search || (query && ('?' + query)) || ''; - - if (protocol && protocol.substr(-1) !== ':') protocol += ':'; - - // only the slashedProtocols get the //. Not mailto:, xmpp:, etc. - // unless they had them to begin with. - if (this.slashes || - (!protocol || slashedProtocol[protocol]) && host !== false) { - host = '//' + (host || ''); - if (pathname && pathname.charAt(0) !== '/') pathname = '/' + pathname; - } else if (!host) { - host = ''; - } - - if (hash && hash.charAt(0) !== '#') hash = '#' + hash; - if (search && search.charAt(0) !== '?') search = '?' + search; - - pathname = pathname.replace(/[?#]/g, function(match) { - return encodeURIComponent(match); - }); - search = search.replace('#', '%23'); - - return protocol + host + pathname + search + hash; - }; - - function urlResolve(source, relative) { - return urlParse(source, false, true).resolve(relative); - } - - Url.prototype.resolve = function(relative) { - return this.resolveObject(urlParse(relative, false, true)).format(); - }; - - function urlResolveObject(source, relative) { - if (!source) return relative; - return urlParse(source, false, true).resolveObject(relative); - } - - Url.prototype.resolveObject = function(relative) { - if (isString(relative)) { - var rel = new Url(); - rel.parse(relative, false, true); - relative = rel; - } - - var result = new Url(); - Object.keys(this).forEach(function(k) { - result[k] = this[k]; - }, this); - - // hash is always overridden, no matter what. - // even href="" will remove it. - result.hash = relative.hash; - - // if the relative url is empty, then there's nothing left to do here. - if (relative.href === '') { - result.href = result.format(); - return result; - } - - // hrefs like //foo/bar always cut to the protocol. - if (relative.slashes && !relative.protocol) { - // take everything except the protocol from relative - Object.keys(relative).forEach(function(k) { - if (k !== 'protocol') - result[k] = relative[k]; - }); - - //urlParse appends trailing / to urls like http://www.example.com - if (slashedProtocol[result.protocol] && - result.hostname && !result.pathname) { - result.path = result.pathname = '/'; - } - - result.href = result.format(); - return result; - } - - if (relative.protocol && relative.protocol !== result.protocol) { - // if it's a known url protocol, then changing - // the protocol does weird things - // first, if it's not file:, then we MUST have a host, - // and if there was a path - // to begin with, then we MUST have a path. - // if it is file:, then the host is dropped, - // because that's known to be hostless. - // anything else is assumed to be absolute. - if (!slashedProtocol[relative.protocol]) { - Object.keys(relative).forEach(function(k) { - result[k] = relative[k]; - }); - result.href = result.format(); - return result; - } - - result.protocol = relative.protocol; - if (!relative.host && !hostlessProtocol[relative.protocol]) { - var relPath = (relative.pathname || '').split('/'); - while (relPath.length && !(relative.host = relPath.shift())); - if (!relative.host) relative.host = ''; - if (!relative.hostname) relative.hostname = ''; - if (relPath[0] !== '') relPath.unshift(''); - if (relPath.length < 2) relPath.unshift(''); - result.pathname = relPath.join('/'); - } else { - result.pathname = relative.pathname; - } - result.search = relative.search; - result.query = relative.query; - result.host = relative.host || ''; - result.auth = relative.auth; - result.hostname = relative.hostname || relative.host; - result.port = relative.port; - // to support http.request - if (result.pathname || result.search) { - var p = result.pathname || ''; - var s = result.search || ''; - result.path = p + s; - } - result.slashes = result.slashes || relative.slashes; - result.href = result.format(); - return result; - } - - var isSourceAbs = (result.pathname && result.pathname.charAt(0) === '/'), - isRelAbs = ( - relative.host || - relative.pathname && relative.pathname.charAt(0) === '/' - ), - mustEndAbs = (isRelAbs || isSourceAbs || - (result.host && relative.pathname)), - removeAllDots = mustEndAbs, - srcPath = result.pathname && result.pathname.split('/') || [], - relPath = relative.pathname && relative.pathname.split('/') || [], - psychotic = result.protocol && !slashedProtocol[result.protocol]; - - // if the url is a non-slashed url, then relative - // links like ../.. should be able - // to crawl up to the hostname, as well. This is strange. - // result.protocol has already been set by now. - // Later on, put the first path part into the host field. - if (psychotic) { - result.hostname = ''; - result.port = null; - if (result.host) { - if (srcPath[0] === '') srcPath[0] = result.host; - else srcPath.unshift(result.host); - } - result.host = ''; - if (relative.protocol) { - relative.hostname = null; - relative.port = null; - if (relative.host) { - if (relPath[0] === '') relPath[0] = relative.host; - else relPath.unshift(relative.host); - } - relative.host = null; - } - mustEndAbs = mustEndAbs && (relPath[0] === '' || srcPath[0] === ''); - } - - if (isRelAbs) { - // it's absolute. - result.host = (relative.host || relative.host === '') ? - relative.host : result.host; - result.hostname = (relative.hostname || relative.hostname === '') ? - relative.hostname : result.hostname; - result.search = relative.search; - result.query = relative.query; - srcPath = relPath; - // fall through to the dot-handling below. - } else if (relPath.length) { - // it's relative - // throw away the existing file, and take the new path instead. - if (!srcPath) srcPath = []; - srcPath.pop(); - srcPath = srcPath.concat(relPath); - result.search = relative.search; - result.query = relative.query; - } else if (!isNullOrUndefined(relative.search)) { - // just pull out the search. - // like href='?foo'. - // Put this after the other two cases because it simplifies the booleans - if (psychotic) { - result.hostname = result.host = srcPath.shift(); - //occationaly the auth can get stuck only in host - //this especialy happens in cases like - //url.resolveObject('mailto:local1@domain1', 'local2@domain2') - var authInHost = result.host && result.host.indexOf('@') > 0 ? - result.host.split('@') : false; - if (authInHost) { - result.auth = authInHost.shift(); - result.host = result.hostname = authInHost.shift(); - } - } - result.search = relative.search; - result.query = relative.query; - //to support http.request - if (!isNull(result.pathname) || !isNull(result.search)) { - result.path = (result.pathname ? result.pathname : '') + - (result.search ? result.search : ''); - } - result.href = result.format(); - return result; - } - - if (!srcPath.length) { - // no path at all. easy. - // we've already handled the other stuff above. - result.pathname = null; - //to support http.request - if (result.search) { - result.path = '/' + result.search; - } else { - result.path = null; - } - result.href = result.format(); - return result; - } - - // if a url ENDs in . or .., then it must get a trailing slash. - // however, if it ends in anything else non-slashy, - // then it must NOT get a trailing slash. - var last = srcPath.slice(-1)[0]; - var hasTrailingSlash = ( - (result.host || relative.host) && (last === '.' || last === '..') || - last === ''); - - // strip single dots, resolve double dots to parent dir - // if the path tries to go above the root, `up` ends up > 0 - var up = 0; - for (var i = srcPath.length; i >= 0; i--) { - last = srcPath[i]; - if (last == '.') { - srcPath.splice(i, 1); - } else if (last === '..') { - srcPath.splice(i, 1); - up++; - } else if (up) { - srcPath.splice(i, 1); - up--; - } - } - - // if the path is allowed to go above the root, restore leading ..s - if (!mustEndAbs && !removeAllDots) { - for (; up--; up) { - srcPath.unshift('..'); - } - } - - if (mustEndAbs && srcPath[0] !== '' && - (!srcPath[0] || srcPath[0].charAt(0) !== '/')) { - srcPath.unshift(''); - } - - if (hasTrailingSlash && (srcPath.join('/').substr(-1) !== '/')) { - srcPath.push(''); - } - - var isAbsolute = srcPath[0] === '' || - (srcPath[0] && srcPath[0].charAt(0) === '/'); - - // put the host back - if (psychotic) { - result.hostname = result.host = isAbsolute ? '' : - srcPath.length ? srcPath.shift() : ''; - //occationaly the auth can get stuck only in host - //this especialy happens in cases like - //url.resolveObject('mailto:local1@domain1', 'local2@domain2') - var authInHost = result.host && result.host.indexOf('@') > 0 ? - result.host.split('@') : false; - if (authInHost) { - result.auth = authInHost.shift(); - result.host = result.hostname = authInHost.shift(); - } - } - - mustEndAbs = mustEndAbs || (result.host && srcPath.length); - - if (mustEndAbs && !isAbsolute) { - srcPath.unshift(''); - } - - if (!srcPath.length) { - result.pathname = null; - result.path = null; - } else { - result.pathname = srcPath.join('/'); - } - - //to support request.http - if (!isNull(result.pathname) || !isNull(result.search)) { - result.path = (result.pathname ? result.pathname : '') + - (result.search ? result.search : ''); - } - result.auth = relative.auth || result.auth; - result.slashes = result.slashes || relative.slashes; - result.href = result.format(); - return result; - }; - - Url.prototype.parseHost = function() { - var host = this.host; - var port = portPattern.exec(host); - if (port) { - port = port[0]; - if (port !== ':') { - this.port = port.substr(1); - } - host = host.substr(0, host.length - port.length); - } - if (host) this.hostname = host; - }; - - function isString(arg) { - return typeof arg === "string"; - } - - function isObject(arg) { - return typeof arg === 'object' && arg !== null; - } - - function isNull(arg) { - return arg === null; - } - function isNullOrUndefined(arg) { - return arg == null; - } +const EventEmitter = __webpack_require__(3).EventEmitter; +const Collection = __webpack_require__(6); + +/** + * Collects messages based on a specified filter, then emits them. + * @extends {EventEmitter} + */ +class MessageCollector extends EventEmitter { + /** + * A function that takes a Message object and a MessageCollector and returns a boolean. + * ```js + * function(message, collector) { + * if (message.content.includes('discord')) { + * return true; // passed the filter test + * } + * return false; // failed the filter test + * } + * ``` + * @typedef {function} CollectorFilterFunction + */ + + /** + * An object containing options used to configure a MessageCollector. All properties are optional. + * @typedef {Object} CollectorOptions + * @property {number} [time] Duration for the collector in milliseconds + * @property {number} [max] Maximum number of messages to handle + * @property {number} [maxMatches] Maximum number of successfully filtered messages to obtain + */ + + /** + * @param {Channel} channel The channel to collect messages in + * @param {CollectorFilterFunction} filter The filter function + * @param {CollectorOptions} [options] Options for the collector + */ + constructor(channel, filter, options = {}) { + super(); + + /** + * The channel this collector is operating on + * @type {Channel} + */ + this.channel = channel; + + /** + * A function used to filter messages that the collector collects. + * @type {CollectorFilterFunction} + */ + this.filter = filter; + + /** + * Options for the collecor. + * @type {CollectorOptions} + */ + this.options = options; + + /** + * Whether this collector has stopped collecting messages. + * @type {boolean} + */ + this.ended = false; + + /** + * A collection of collected messages, mapped by message ID. + * @type {Collection} + */ + this.collected = new Collection(); + + this.listener = message => this.verify(message); + this.channel.client.on('message', this.listener); + if (options.time) this.channel.client.setTimeout(() => this.stop('time'), options.time); + } + + /** + * Verifies a message against the filter and options + * @private + * @param {Message} message The message + * @returns {boolean} + */ + verify(message) { + if (this.channel ? this.channel.id !== message.channel.id : false) return false; + if (this.filter(message, this)) { + this.collected.set(message.id, message); + /** + * Emitted whenever the collector receives a message that passes the filter test. + * @param {Message} message The received message + * @param {MessageCollector} collector The collector the message passed through + * @event MessageCollector#message + */ + this.emit('message', message, this); + if (this.collected.size >= this.options.maxMatches) this.stop('matchesLimit'); + else if (this.options.max && this.collected.size === this.options.max) this.stop('limit'); + return true; + } + return false; + } + + /** + * Returns a promise that resolves when a valid message is sent. Rejects + * with collected messages if the Collector ends before receiving a message. + * @type {Promise} + * @readonly + */ + get next() { + return new Promise((resolve, reject) => { + if (this.ended) { + reject(this.collected); + return; + } + + const cleanup = () => { + this.removeListener('message', onMessage); + this.removeListener('end', onEnd); + }; + + const onMessage = (...args) => { + cleanup(); + resolve(...args); + }; + + const onEnd = (...args) => { + cleanup(); + reject(...args); + }; + + this.once('message', onMessage); + this.once('end', onEnd); + }); + } + + /** + * Stops the collector and emits `end`. + * @param {string} [reason='user'] An optional reason for stopping the collector + */ + stop(reason = 'user') { + if (this.ended) return; + this.ended = true; + this.channel.client.removeListener('message', this.listener); + /** + * Emitted when the Collector stops collecting. + * @param {Collection} collection A collection of messages collected + * during the lifetime of the collector, mapped by the ID of the messages. + * @param {string} reason The reason for the end of the collector. If it ended because it reached the specified time + * limit, this would be `time`. If you invoke `.stop()` without specifying a reason, this would be `user`. If it + * ended because it reached its message limit, it will be `limit`. + * @event MessageCollector#end + */ + this.emit('end', this.collected, reason); + } +} + +module.exports = MessageCollector; /***/ }, /* 70 */ -/***/ function(module, exports, __webpack_require__) { +/***/ function(module, exports) { - var __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(module, global) {/*! https://mths.be/punycode v1.3.2 by @mathias */ - ;(function(root) { +/** + * Represents an embed in a message (image/video preview, rich embed, etc.) + */ +class MessageEmbed { + constructor(message, data) { + /** + * The client that instantiated this embed + * @type {Client} + */ + this.client = message.client; + Object.defineProperty(this, 'client', { enumerable: false, configurable: false }); - /** Detect free variables */ - var freeExports = typeof exports == 'object' && exports && - !exports.nodeType && exports; - var freeModule = typeof module == 'object' && module && - !module.nodeType && module; - var freeGlobal = typeof global == 'object' && global; - if ( - freeGlobal.global === freeGlobal || - freeGlobal.window === freeGlobal || - freeGlobal.self === freeGlobal - ) { - root = freeGlobal; - } + /** + * The message this embed is part of + * @type {Message} + */ + this.message = message; - /** - * The `punycode` object. - * @name punycode - * @type Object - */ - var punycode, + this.setup(data); + } - /** Highest positive signed 32-bit float value */ - maxInt = 2147483647, // aka. 0x7FFFFFFF or 2^31-1 + setup(data) { + /** + * The title of this embed, if there is one + * @type {?string} + */ + this.title = data.title; - /** Bootstring parameters */ - base = 36, - tMin = 1, - tMax = 26, - skew = 38, - damp = 700, - initialBias = 72, - initialN = 128, // 0x80 - delimiter = '-', // '\x2D' + /** + * The type of this embed + * @type {string} + */ + this.type = data.type; - /** Regular expressions */ - regexPunycode = /^xn--/, - regexNonASCII = /[^\x20-\x7E]/, // unprintable ASCII chars + non-ASCII chars - regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g, // RFC 3490 separators + /** + * The description of this embed, if there is one + * @type {?string} + */ + this.description = data.description; - /** Error messages */ - errors = { - 'overflow': 'Overflow: input needs wider integers to process', - 'not-basic': 'Illegal input >= 0x80 (not a basic code point)', - 'invalid-input': 'Invalid input' - }, + /** + * The URL of this embed + * @type {string} + */ + this.url = data.url; - /** Convenience shortcuts */ - baseMinusTMin = base - tMin, - floor = Math.floor, - stringFromCharCode = String.fromCharCode, + /** + * The fields of this embed + * @type {MessageEmbedField[]} + */ + this.fields = []; + if (data.fields) for (const field of data.fields) this.fields.push(new MessageEmbedField(this, field)); - /** Temporary variable */ - key; + /** + * The timestamp of this embed + * @type {number} + */ + this.createdTimestamp = data.timestamp; - /*--------------------------------------------------------------------------*/ + /** + * The thumbnail of this embed, if there is one + * @type {MessageEmbedThumbnail} + */ + this.thumbnail = data.thumbnail ? new MessageEmbedThumbnail(this, data.thumbnail) : null; - /** - * A generic error utility function. - * @private - * @param {String} type The error type. - * @returns {Error} Throws a `RangeError` with the applicable error message. - */ - function error(type) { - throw RangeError(errors[type]); - } + /** + * The author of this embed, if there is one + * @type {MessageEmbedAuthor} + */ + this.author = data.author ? new MessageEmbedAuthor(this, data.author) : null; - /** - * A generic `Array#map` utility function. - * @private - * @param {Array} array The array to iterate over. - * @param {Function} callback The function that gets called for every array - * item. - * @returns {Array} A new array of values returned by the callback function. - */ - function map(array, fn) { - var length = array.length; - var result = []; - while (length--) { - result[length] = fn(array[length]); - } - return result; - } + /** + * The provider of this embed, if there is one + * @type {MessageEmbedProvider} + */ + this.provider = data.provider ? new MessageEmbedProvider(this, data.provider) : null; - /** - * A simple `Array#map`-like wrapper to work with domain name strings or email - * addresses. - * @private - * @param {String} domain The domain name or email address. - * @param {Function} callback The function that gets called for every - * character. - * @returns {Array} A new string of characters returned by the callback - * function. - */ - function mapDomain(string, fn) { - var parts = string.split('@'); - var result = ''; - if (parts.length > 1) { - // In email addresses, only the domain name should be punycoded. Leave - // the local part (i.e. everything up to `@`) intact. - result = parts[0] + '@'; - string = parts[1]; - } - // Avoid `split(regex)` for IE8 compatibility. See #17. - string = string.replace(regexSeparators, '\x2E'); - var labels = string.split('.'); - var encoded = map(labels, fn).join('.'); - return result + encoded; - } + /** + * The footer of this embed + * @type {MessageEmbedFooter} + */ + this.footer = data.footer ? new MessageEmbedFooter(this, data.footer) : null; + } - /** - * Creates an array containing the numeric code points of each Unicode - * character in the string. While JavaScript uses UCS-2 internally, - * this function will convert a pair of surrogate halves (each of which - * UCS-2 exposes as separate characters) into a single code point, - * matching UTF-16. - * @see `punycode.ucs2.encode` - * @see - * @memberOf punycode.ucs2 - * @name decode - * @param {String} string The Unicode input string (UCS-2). - * @returns {Array} The new array of code points. - */ - function ucs2decode(string) { - var output = [], - counter = 0, - length = string.length, - value, - extra; - while (counter < length) { - value = string.charCodeAt(counter++); - if (value >= 0xD800 && value <= 0xDBFF && counter < length) { - // high surrogate, and there is a next character - extra = string.charCodeAt(counter++); - if ((extra & 0xFC00) == 0xDC00) { // low surrogate - output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000); - } else { - // unmatched surrogate; only append this code unit, in case the next - // code unit is the high surrogate of a surrogate pair - output.push(value); - counter--; - } - } else { - output.push(value); - } - } - return output; - } + /** + * The date this embed was created + * @type {Date} + */ + get createdAt() { + return new Date(this.createdTimestamp); + } +} - /** - * Creates a string based on an array of numeric code points. - * @see `punycode.ucs2.decode` - * @memberOf punycode.ucs2 - * @name encode - * @param {Array} codePoints The array of numeric code points. - * @returns {String} The new Unicode string (UCS-2). - */ - function ucs2encode(array) { - return map(array, function(value) { - var output = ''; - if (value > 0xFFFF) { - value -= 0x10000; - output += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800); - value = 0xDC00 | value & 0x3FF; - } - output += stringFromCharCode(value); - return output; - }).join(''); - } +/** + * Represents a thumbnail for a message embed + */ +class MessageEmbedThumbnail { + constructor(embed, data) { + /** + * The embed this thumbnail is part of + * @type {MessageEmbed} + */ + this.embed = embed; - /** - * Converts a basic code point into a digit/integer. - * @see `digitToBasic()` - * @private - * @param {Number} codePoint The basic numeric code point value. - * @returns {Number} The numeric value of a basic code point (for use in - * representing integers) in the range `0` to `base - 1`, or `base` if - * the code point does not represent a value. - */ - function basicToDigit(codePoint) { - if (codePoint - 48 < 10) { - return codePoint - 22; - } - if (codePoint - 65 < 26) { - return codePoint - 65; - } - if (codePoint - 97 < 26) { - return codePoint - 97; - } - return base; - } + this.setup(data); + } - /** - * Converts a digit/integer into a basic code point. - * @see `basicToDigit()` - * @private - * @param {Number} digit The numeric value of a basic code point. - * @returns {Number} The basic code point whose value (when used for - * representing integers) is `digit`, which needs to be in the range - * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is - * used; else, the lowercase form is used. The behavior is undefined - * if `flag` is non-zero and `digit` has no uppercase form. - */ - function digitToBasic(digit, flag) { - // 0..25 map to ASCII a..z or A..Z - // 26..35 map to ASCII 0..9 - return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5); - } + setup(data) { + /** + * The URL for this thumbnail + * @type {string} + */ + this.url = data.url; - /** - * Bias adaptation function as per section 3.4 of RFC 3492. - * http://tools.ietf.org/html/rfc3492#section-3.4 - * @private - */ - function adapt(delta, numPoints, firstTime) { - var k = 0; - delta = firstTime ? floor(delta / damp) : delta >> 1; - delta += floor(delta / numPoints); - for (/* no initialization */; delta > baseMinusTMin * tMax >> 1; k += base) { - delta = floor(delta / baseMinusTMin); - } - return floor(k + (baseMinusTMin + 1) * delta / (delta + skew)); - } + /** + * The Proxy URL for this thumbnail + * @type {string} + */ + this.proxyURL = data.proxy_url; - /** - * Converts a Punycode string of ASCII-only symbols to a string of Unicode - * symbols. - * @memberOf punycode - * @param {String} input The Punycode string of ASCII-only symbols. - * @returns {String} The resulting string of Unicode symbols. - */ - function decode(input) { - // Don't use UCS-2 - var output = [], - inputLength = input.length, - out, - i = 0, - n = initialN, - bias = initialBias, - basic, - j, - index, - oldi, - w, - k, - digit, - t, - /** Cached calculation results */ - baseMinusT; + /** + * The height of the thumbnail + * @type {number} + */ + this.height = data.height; - // Handle the basic code points: let `basic` be the number of input code - // points before the last delimiter, or `0` if there is none, then copy - // the first basic code points to the output. + /** + * The width of the thumbnail + * @type {number} + */ + this.width = data.width; + } +} - basic = input.lastIndexOf(delimiter); - if (basic < 0) { - basic = 0; - } +/** + * Represents a provider for a message embed + */ +class MessageEmbedProvider { + constructor(embed, data) { + /** + * The embed this provider is part of + * @type {MessageEmbed} + */ + this.embed = embed; - for (j = 0; j < basic; ++j) { - // if it's not a basic code point - if (input.charCodeAt(j) >= 0x80) { - error('not-basic'); - } - output.push(input.charCodeAt(j)); - } + this.setup(data); + } - // Main decoding loop: start just after the last delimiter if any basic code - // points were copied; start at the beginning otherwise. + setup(data) { + /** + * The name of this provider + * @type {string} + */ + this.name = data.name; - for (index = basic > 0 ? basic + 1 : 0; index < inputLength; /* no final expression */) { + /** + * The URL of this provider + * @type {string} + */ + this.url = data.url; + } +} - // `index` is the index of the next character to be consumed. - // Decode a generalized variable-length integer into `delta`, - // which gets added to `i`. The overflow checking is easier - // if we increase `i` as we go, then subtract off its starting - // value at the end to obtain `delta`. - for (oldi = i, w = 1, k = base; /* no condition */; k += base) { +/** + * Represents an author for a message embed + */ +class MessageEmbedAuthor { + constructor(embed, data) { + /** + * The embed this author is part of + * @type {MessageEmbed} + */ + this.embed = embed; - if (index >= inputLength) { - error('invalid-input'); - } + this.setup(data); + } - digit = basicToDigit(input.charCodeAt(index++)); + setup(data) { + /** + * The name of this author + * @type {string} + */ + this.name = data.name; - if (digit >= base || digit > floor((maxInt - i) / w)) { - error('overflow'); - } + /** + * The URL of this author + * @type {string} + */ + this.url = data.url; + } +} - i += digit * w; - t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias); +/** + * Represents a field for a message embed + */ +class MessageEmbedField { + constructor(embed, data) { + /** + * The embed this footer is part of + * @type {MessageEmbed} + */ + this.embed = embed; - if (digit < t) { - break; - } + this.setup(data); + } - baseMinusT = base - t; - if (w > floor(maxInt / baseMinusT)) { - error('overflow'); - } + setup(data) { + /** + * The name of this field + * @type {string} + */ + this.name = data.name; - w *= baseMinusT; + /** + * The value of this field + * @type {string} + */ + this.value = data.value; - } + /** + * If this field is displayed inline + * @type {boolean} + */ + this.inline = data.inline; + } +} - out = output.length + 1; - bias = adapt(i - oldi, out, oldi == 0); +/** + * Represents the footer of a message embed + */ +class MessageEmbedFooter { + constructor(embed, data) { + /** + * The embed this footer is part of + * @type {MessageEmbed} + */ + this.embed = embed; - // `i` was supposed to wrap around from `out` to `0`, - // incrementing `n` each time, so we'll fix that now: - if (floor(i / out) > maxInt - n) { - error('overflow'); - } + this.setup(data); + } - n += floor(i / out); - i %= out; + setup(data) { + /** + * The text in this footer + * @type {string} + */ + this.text = data.text; - // Insert `n` at position `i` of the output - output.splice(i++, 0, n); + /** + * The icon URL of this footer + * @type {string} + */ + this.iconUrl = data.icon_url; - } + /** + * The proxy icon URL of this footer + * @type {string} + */ + this.proxyIconUrl = data.proxy_icon_url; + } +} - return ucs2encode(output); - } +MessageEmbed.Thumbnail = MessageEmbedThumbnail; +MessageEmbed.Provider = MessageEmbedProvider; +MessageEmbed.Author = MessageEmbedAuthor; +MessageEmbed.Field = MessageEmbedField; +MessageEmbed.Footer = MessageEmbedFooter; - /** - * Converts a string of Unicode symbols (e.g. a domain name label) to a - * Punycode string of ASCII-only symbols. - * @memberOf punycode - * @param {String} input The string of Unicode symbols. - * @returns {String} The resulting Punycode string of ASCII-only symbols. - */ - function encode(input) { - var n, - delta, - handledCPCount, - basicLength, - bias, - j, - m, - q, - k, - t, - currentValue, - output = [], - /** `inputLength` will hold the number of code points in `input`. */ - inputLength, - /** Cached calculation results */ - handledCPCountPlusOne, - baseMinusT, - qMinusT; +module.exports = MessageEmbed; - // Convert the input in UCS-2 to Unicode - input = ucs2decode(input); - - // Cache the length - inputLength = input.length; - - // Initialize the state - n = initialN; - delta = 0; - bias = initialBias; - - // Handle the basic code points - for (j = 0; j < inputLength; ++j) { - currentValue = input[j]; - if (currentValue < 0x80) { - output.push(stringFromCharCode(currentValue)); - } - } - - handledCPCount = basicLength = output.length; - - // `handledCPCount` is the number of code points that have been handled; - // `basicLength` is the number of basic code points. - - // Finish the basic string - if it is not empty - with a delimiter - if (basicLength) { - output.push(delimiter); - } - - // Main encoding loop: - while (handledCPCount < inputLength) { - - // All non-basic code points < n have been handled already. Find the next - // larger one: - for (m = maxInt, j = 0; j < inputLength; ++j) { - currentValue = input[j]; - if (currentValue >= n && currentValue < m) { - m = currentValue; - } - } - - // Increase `delta` enough to advance the decoder's state to , - // but guard against overflow - handledCPCountPlusOne = handledCPCount + 1; - if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) { - error('overflow'); - } - - delta += (m - n) * handledCPCountPlusOne; - n = m; - - for (j = 0; j < inputLength; ++j) { - currentValue = input[j]; - - if (currentValue < n && ++delta > maxInt) { - error('overflow'); - } - - if (currentValue == n) { - // Represent delta as a generalized variable-length integer - for (q = delta, k = base; /* no condition */; k += base) { - t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias); - if (q < t) { - break; - } - qMinusT = q - t; - baseMinusT = base - t; - output.push( - stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0)) - ); - q = floor(qMinusT / baseMinusT); - } - - output.push(stringFromCharCode(digitToBasic(q, 0))); - bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength); - delta = 0; - ++handledCPCount; - } - } - - ++delta; - ++n; - - } - return output.join(''); - } - - /** - * Converts a Punycode string representing a domain name or an email address - * to Unicode. Only the Punycoded parts of the input will be converted, i.e. - * it doesn't matter if you call it on a string that has already been - * converted to Unicode. - * @memberOf punycode - * @param {String} input The Punycoded domain name or email address to - * convert to Unicode. - * @returns {String} The Unicode representation of the given Punycode - * string. - */ - function toUnicode(input) { - return mapDomain(input, function(string) { - return regexPunycode.test(string) - ? decode(string.slice(4).toLowerCase()) - : string; - }); - } - - /** - * Converts a Unicode string representing a domain name or an email address to - * Punycode. Only the non-ASCII parts of the domain name will be converted, - * i.e. it doesn't matter if you call it with a domain that's already in - * ASCII. - * @memberOf punycode - * @param {String} input The domain name or email address to convert, as a - * Unicode string. - * @returns {String} The Punycode representation of the given domain name or - * email address. - */ - function toASCII(input) { - return mapDomain(input, function(string) { - return regexNonASCII.test(string) - ? 'xn--' + encode(string) - : string; - }); - } - - /*--------------------------------------------------------------------------*/ - - /** Define the public API */ - punycode = { - /** - * A string representing the current Punycode.js version number. - * @memberOf punycode - * @type String - */ - 'version': '1.3.2', - /** - * An object of methods to convert from JavaScript's internal character - * representation (UCS-2) to Unicode code points, and back. - * @see - * @memberOf punycode - * @type Object - */ - 'ucs2': { - 'decode': ucs2decode, - 'encode': ucs2encode - }, - 'decode': decode, - 'encode': encode, - 'toASCII': toASCII, - 'toUnicode': toUnicode - }; - - /** Expose `punycode` */ - // Some AMD build optimizers, like r.js, check for specific condition patterns - // like the following: - if ( - true - ) { - !(__WEBPACK_AMD_DEFINE_RESULT__ = function() { - return punycode; - }.call(exports, __webpack_require__, exports, module), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); - } else if (freeExports && freeModule) { - if (module.exports == freeExports) { // in Node.js or RingoJS v0.8.0+ - freeModule.exports = punycode; - } else { // in Narwhal or RingoJS v0.7.0- - for (key in punycode) { - punycode.hasOwnProperty(key) && (freeExports[key] = punycode[key]); - } - } - } else { // in Rhino or a web browser - root.punycode = punycode; - } - - }(this)); - - /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(71)(module), (function() { return this; }()))) /***/ }, /* 71 */ -/***/ function(module, exports) { +/***/ function(module, exports, __webpack_require__) { - module.exports = function(module) { - if(!module.webpackPolyfill) { - module.deprecate = function() {}; - module.paths = []; - // module.parent = undefined by default - module.children = []; - module.webpackPolyfill = 1; - } - return module; - } +const Collection = __webpack_require__(6); +const Emoji = __webpack_require__(21); +const ReactionEmoji = __webpack_require__(45); + +/** + * Represents a reaction to a message + */ +class MessageReaction { + constructor(message, emoji, count, me) { + /** + * The message that this reaction refers to + * @type {Message} + */ + this.message = message; + + /** + * Whether the client has given this reaction + * @type {boolean} + */ + this.me = me; + + /** + * The number of people that have given the same reaction. + * @type {number} + */ + this.count = count || 0; + + /** + * The users that have given this reaction, mapped by their ID. + * @type {Collection} + */ + this.users = new Collection(); + + this._emoji = new ReactionEmoji(this, emoji.name, emoji.id); + } + + /** + * The emoji of this reaction, either an Emoji object for known custom emojis, or a ReactionEmoji + * object which has fewer properties. Whatever the prototype of the emoji, it will still have + * `name`, `id`, `identifier` and `toString()` + * @type {Emoji|ReactionEmoji} + */ + get emoji() { + if (this._emoji instanceof Emoji) return this._emoji; + // check to see if the emoji has become known to the client + if (this._emoji.id) { + const emojis = this.message.client.emojis; + if (emojis.has(this._emoji.id)) { + const emoji = emojis.get(this._emoji.id); + this._emoji = emoji; + return emoji; + } + } + return this._emoji; + } + + /** + * Removes a user from this reaction. + * @param {UserResolvable} [user] the user that you want to remove the reaction, defaults to the client. + * @returns {Promise} + */ + remove(user = this.message.client.user) { + const message = this.message; + user = this.message.client.resolver.resolveUserID(user); + if (!user) return Promise.reject('Couldn\'t resolve the user ID to remove from the reaction.'); + return message.client.rest.methods.removeMessageReaction( + message, this.emoji.identifier, user + ); + } + + /** + * Fetch all the users that gave this reaction. Resolves with a collection of users, + * mapped by their IDs. + * @param {number} [limit=100] the maximum amount of users to fetch, defaults to 100 + * @returns {Promise>} + */ + fetchUsers(limit = 100) { + const message = this.message; + return message.client.rest.methods.getMessageReactionUsers( + message, this.emoji.identifier, limit + ).then(users => { + this.users = new Collection(); + for (const rawUser of users) { + const user = this.message.client.dataManager.newUser(rawUser); + this.users.set(user.id, user); + } + this.count = this.users.size; + return users; + }); + } +} + +module.exports = MessageReaction; /***/ }, /* 72 */ -/***/ function(module, exports, __webpack_require__) { +/***/ function(module, exports) { - 'use strict'; +/** + * Represents an OAuth2 Application + */ +class OAuth2Application { + constructor(client, data) { + /** + * The client that instantiated the application + * @type {Client} + */ + this.client = client; + Object.defineProperty(this, 'client', { enumerable: false, configurable: false }); - exports.decode = exports.parse = __webpack_require__(73); - exports.encode = exports.stringify = __webpack_require__(74); + this.setup(data); + } + + setup(data) { + /** + * The ID of the app + * @type {string} + */ + this.id = data.id; + + /** + * The name of the app + * @type {string} + */ + this.name = data.name; + + /** + * The app's description + * @type {string} + */ + this.description = data.description; + + /** + * The app's icon hash + * @type {string} + */ + this.icon = data.icon; + + /** + * The app's icon URL + * @type {string} + */ + this.iconURL = `https://cdn.discordapp.com/app-icons/${this.id}/${this.icon}.jpg`; + + /** + * The app's RPC origins + * @type {Array} + */ + this.rpcOrigins = data.rpc_origins; + } + + /** + * The timestamp the app was created at + * @type {number} + * @readonly + */ + get createdTimestamp() { + return (this.id / 4194304) + 1420070400000; + } + + /** + * The time the app was created + * @type {Date} + * @readonly + */ + get createdAt() { + return new Date(this.createdTimestamp); + } + + /** + * When concatenated with a string, this automatically concatenates the app name rather than the app object. + * @returns {string} + */ + toString() { + return this.name; + } +} + +module.exports = OAuth2Application; /***/ }, /* 73 */ /***/ function(module, exports) { - // Copyright Joyent, Inc. and other Node contributors. - // - // Permission is hereby granted, free of charge, to any person obtaining a - // copy of this software and associated documentation files (the - // "Software"), to deal in the Software without restriction, including - // without limitation the rights to use, copy, modify, merge, publish, - // distribute, sublicense, and/or sell copies of the Software, and to permit - // persons to whom the Software is furnished to do so, subject to the - // following conditions: - // - // The above copyright notice and this permission notice shall be included - // in all copies or substantial portions of the Software. - // - // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN - // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE - // USE OR OTHER DEALINGS IN THE SOFTWARE. +/* +{ splash: null, + id: '123123123', + icon: '123123123', + name: 'name' } +*/ - 'use strict'; +/** + * Represents a guild that the client only has limited information for - e.g. from invites. + */ +class PartialGuild { + constructor(client, data) { + /** + * The Client that instantiated this PartialGuild + * @type {Client} + */ + this.client = client; + Object.defineProperty(this, 'client', { enumerable: false, configurable: false }); - // If obj.hasOwnProperty has been overridden, then calling - // obj.hasOwnProperty(prop) will break. - // See: https://github.com/joyent/node/issues/1707 - function hasOwnProperty(obj, prop) { - return Object.prototype.hasOwnProperty.call(obj, prop); - } + this.setup(data); + } - module.exports = function(qs, sep, eq, options) { - sep = sep || '&'; - eq = eq || '='; - var obj = {}; + setup(data) { + /** + * The ID of this guild + * @type {string} + */ + this.id = data.id; - if (typeof qs !== 'string' || qs.length === 0) { - return obj; - } + /** + * The name of this guild + * @type {string} + */ + this.name = data.name; - var regexp = /\+/g; - qs = qs.split(sep); + /** + * The hash of this guild's icon, or null if there is none. + * @type {?string} + */ + this.icon = data.icon; - var maxKeys = 1000; - if (options && typeof options.maxKeys === 'number') { - maxKeys = options.maxKeys; - } + /** + * The hash of the guild splash image, or null if no splash (VIP only) + * @type {?string} + */ + this.splash = data.splash; + } +} - var len = qs.length; - // maxKeys <= 0 means that we should not limit keys count - if (maxKeys > 0 && len > maxKeys) { - len = maxKeys; - } - - for (var i = 0; i < len; ++i) { - var x = qs[i].replace(regexp, '%20'), - idx = x.indexOf(eq), - kstr, vstr, k, v; - - if (idx >= 0) { - kstr = x.substr(0, idx); - vstr = x.substr(idx + 1); - } else { - kstr = x; - vstr = ''; - } - - k = decodeURIComponent(kstr); - v = decodeURIComponent(vstr); - - if (!hasOwnProperty(obj, k)) { - obj[k] = v; - } else if (Array.isArray(obj[k])) { - obj[k].push(v); - } else { - obj[k] = [obj[k], v]; - } - } - - return obj; - }; +module.exports = PartialGuild; /***/ }, /* 74 */ -/***/ function(module, exports) { +/***/ function(module, exports, __webpack_require__) { - // Copyright Joyent, Inc. and other Node contributors. - // - // Permission is hereby granted, free of charge, to any person obtaining a - // copy of this software and associated documentation files (the - // "Software"), to deal in the Software without restriction, including - // without limitation the rights to use, copy, modify, merge, publish, - // distribute, sublicense, and/or sell copies of the Software, and to permit - // persons to whom the Software is furnished to do so, subject to the - // following conditions: - // - // The above copyright notice and this permission notice shall be included - // in all copies or substantial portions of the Software. - // - // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN - // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE - // USE OR OTHER DEALINGS IN THE SOFTWARE. +const Constants = __webpack_require__(2); - 'use strict'; +/* +{ type: 0, id: '123123', name: 'heavy-testing' } } +*/ - var stringifyPrimitive = function(v) { - switch (typeof v) { - case 'string': - return v; +/** + * Represents a guild channel that the client only has limited information for - e.g. from invites. + */ +class PartialGuildChannel { + constructor(client, data) { + /** + * The Client that instantiated this PartialGuildChannel + * @type {Client} + */ + this.client = client; + Object.defineProperty(this, 'client', { enumerable: false, configurable: false }); - case 'boolean': - return v ? 'true' : 'false'; + this.setup(data); + } - case 'number': - return isFinite(v) ? v : ''; + setup(data) { + /** + * The ID of this guild channel + * @type {string} + */ + this.id = data.id; - default: - return ''; - } - }; + /** + * The name of this guild channel + * @type {string} + */ + this.name = data.name; - module.exports = function(obj, sep, eq, name) { - sep = sep || '&'; - eq = eq || '='; - if (obj === null) { - obj = undefined; - } + /** + * The type of this guild channel - `text` or `voice` + * @type {string} + */ + this.type = Constants.ChannelTypes.text === data.type ? 'text' : 'voice'; + } +} - if (typeof obj === 'object') { - return Object.keys(obj).map(function(k) { - var ks = encodeURIComponent(stringifyPrimitive(k)) + eq; - if (Array.isArray(obj[k])) { - return obj[k].map(function(v) { - return ks + encodeURIComponent(stringifyPrimitive(v)); - }).join(sep); - } else { - return ks + encodeURIComponent(stringifyPrimitive(obj[k])); - } - }).join(sep); - - } - - if (!name) return ''; - return encodeURIComponent(stringifyPrimitive(name)) + eq + - encodeURIComponent(stringifyPrimitive(obj)); - }; +module.exports = PartialGuildChannel; /***/ }, /* 75 */ -/***/ function(module, exports, __webpack_require__) { +/***/ function(module, exports) { + +/** + * Represents a permission overwrite for a role or member in a guild channel. + */ +class PermissionOverwrites { + constructor(guildChannel, data) { + /** + * The GuildChannel this overwrite is for + * @type {GuildChannel} + */ + this.channel = guildChannel; + + if (data) this.setup(data); + } + + setup(data) { + /** + * The ID of this overwrite, either a user ID or a role ID + * @type {string} + */ + this.id = data.id; + + /** + * The type of this overwrite + * @type {string} + */ + this.type = data.type; + + this.denyData = data.deny; + this.allowData = data.allow; + } + + /** + * Delete this Permission Overwrite. + * @returns {Promise} + */ + delete() { + return this.channel.client.rest.methods.deletePermissionOverwrites(this); + } +} + +module.exports = PermissionOverwrites; - /* WEBPACK VAR INJECTION */(function(global, process) {// Copyright Joyent, Inc. and other Node contributors. - // - // Permission is hereby granted, free of charge, to any person obtaining a - // copy of this software and associated documentation files (the - // "Software"), to deal in the Software without restriction, including - // without limitation the rights to use, copy, modify, merge, publish, - // distribute, sublicense, and/or sell copies of the Software, and to permit - // persons to whom the Software is furnished to do so, subject to the - // following conditions: - // - // The above copyright notice and this permission notice shall be included - // in all copies or substantial portions of the Software. - // - // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN - // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE - // USE OR OTHER DEALINGS IN THE SOFTWARE. - - var formatRegExp = /%[sdj%]/g; - exports.format = function(f) { - if (!isString(f)) { - var objects = []; - for (var i = 0; i < arguments.length; i++) { - objects.push(inspect(arguments[i])); - } - return objects.join(' '); - } - - var i = 1; - var args = arguments; - var len = args.length; - var str = String(f).replace(formatRegExp, function(x) { - if (x === '%%') return '%'; - if (i >= len) return x; - switch (x) { - case '%s': return String(args[i++]); - case '%d': return Number(args[i++]); - case '%j': - try { - return JSON.stringify(args[i++]); - } catch (_) { - return '[Circular]'; - } - default: - return x; - } - }); - for (var x = args[i]; i < len; x = args[++i]) { - if (isNull(x) || !isObject(x)) { - str += ' ' + x; - } else { - str += ' ' + inspect(x); - } - } - return str; - }; - - - // Mark that a method should not be used. - // Returns a modified function which warns once by default. - // If --no-deprecation is set, then it is a no-op. - exports.deprecate = function(fn, msg) { - // Allow for deprecating things in the process of starting up. - if (isUndefined(global.process)) { - return function() { - return exports.deprecate(fn, msg).apply(this, arguments); - }; - } - - if (process.noDeprecation === true) { - return fn; - } - - var warned = false; - function deprecated() { - if (!warned) { - if (process.throwDeprecation) { - throw new Error(msg); - } else if (process.traceDeprecation) { - console.trace(msg); - } else { - console.error(msg); - } - warned = true; - } - return fn.apply(this, arguments); - } - - return deprecated; - }; - - - var debugs = {}; - var debugEnviron; - exports.debuglog = function(set) { - if (isUndefined(debugEnviron)) - debugEnviron = process.env.NODE_DEBUG || ''; - set = set.toUpperCase(); - if (!debugs[set]) { - if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) { - var pid = process.pid; - debugs[set] = function() { - var msg = exports.format.apply(exports, arguments); - console.error('%s %d: %s', set, pid, msg); - }; - } else { - debugs[set] = function() {}; - } - } - return debugs[set]; - }; - - - /** - * Echos the value of a value. Trys to print the value out - * in the best way possible given the different types. - * - * @param {Object} obj The object to print out. - * @param {Object} opts Optional options object that alters the output. - */ - /* legacy: obj, showHidden, depth, colors*/ - function inspect(obj, opts) { - // default options - var ctx = { - seen: [], - stylize: stylizeNoColor - }; - // legacy... - if (arguments.length >= 3) ctx.depth = arguments[2]; - if (arguments.length >= 4) ctx.colors = arguments[3]; - if (isBoolean(opts)) { - // legacy... - ctx.showHidden = opts; - } else if (opts) { - // got an "options" object - exports._extend(ctx, opts); - } - // set default options - if (isUndefined(ctx.showHidden)) ctx.showHidden = false; - if (isUndefined(ctx.depth)) ctx.depth = 2; - if (isUndefined(ctx.colors)) ctx.colors = false; - if (isUndefined(ctx.customInspect)) ctx.customInspect = true; - if (ctx.colors) ctx.stylize = stylizeWithColor; - return formatValue(ctx, obj, ctx.depth); - } - exports.inspect = inspect; - - - // http://en.wikipedia.org/wiki/ANSI_escape_code#graphics - inspect.colors = { - 'bold' : [1, 22], - 'italic' : [3, 23], - 'underline' : [4, 24], - 'inverse' : [7, 27], - 'white' : [37, 39], - 'grey' : [90, 39], - 'black' : [30, 39], - 'blue' : [34, 39], - 'cyan' : [36, 39], - 'green' : [32, 39], - 'magenta' : [35, 39], - 'red' : [31, 39], - 'yellow' : [33, 39] - }; - - // Don't use 'blue' not visible on cmd.exe - inspect.styles = { - 'special': 'cyan', - 'number': 'yellow', - 'boolean': 'yellow', - 'undefined': 'grey', - 'null': 'bold', - 'string': 'green', - 'date': 'magenta', - // "name": intentionally not styling - 'regexp': 'red' - }; - - - function stylizeWithColor(str, styleType) { - var style = inspect.styles[styleType]; - - if (style) { - return '\u001b[' + inspect.colors[style][0] + 'm' + str + - '\u001b[' + inspect.colors[style][1] + 'm'; - } else { - return str; - } - } - - - function stylizeNoColor(str, styleType) { - return str; - } - - - function arrayToHash(array) { - var hash = {}; - - array.forEach(function(val, idx) { - hash[val] = true; - }); - - return hash; - } - - - function formatValue(ctx, value, recurseTimes) { - // Provide a hook for user-specified inspect functions. - // Check that value is an object with an inspect function on it - if (ctx.customInspect && - value && - isFunction(value.inspect) && - // Filter out the util module, it's inspect function is special - value.inspect !== exports.inspect && - // Also filter out any prototype objects using the circular check. - !(value.constructor && value.constructor.prototype === value)) { - var ret = value.inspect(recurseTimes, ctx); - if (!isString(ret)) { - ret = formatValue(ctx, ret, recurseTimes); - } - return ret; - } - - // Primitive types cannot have properties - var primitive = formatPrimitive(ctx, value); - if (primitive) { - return primitive; - } - - // Look up the keys of the object. - var keys = Object.keys(value); - var visibleKeys = arrayToHash(keys); - - if (ctx.showHidden) { - keys = Object.getOwnPropertyNames(value); - } - - // IE doesn't make error fields non-enumerable - // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx - if (isError(value) - && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) { - return formatError(value); - } - - // Some type of object without properties can be shortcutted. - if (keys.length === 0) { - if (isFunction(value)) { - var name = value.name ? ': ' + value.name : ''; - return ctx.stylize('[Function' + name + ']', 'special'); - } - if (isRegExp(value)) { - return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); - } - if (isDate(value)) { - return ctx.stylize(Date.prototype.toString.call(value), 'date'); - } - if (isError(value)) { - return formatError(value); - } - } - - var base = '', array = false, braces = ['{', '}']; - - // Make Array say that they are Array - if (isArray(value)) { - array = true; - braces = ['[', ']']; - } - - // Make functions say that they are functions - if (isFunction(value)) { - var n = value.name ? ': ' + value.name : ''; - base = ' [Function' + n + ']'; - } - - // Make RegExps say that they are RegExps - if (isRegExp(value)) { - base = ' ' + RegExp.prototype.toString.call(value); - } - - // Make dates with properties first say the date - if (isDate(value)) { - base = ' ' + Date.prototype.toUTCString.call(value); - } - - // Make error with message first say the error - if (isError(value)) { - base = ' ' + formatError(value); - } - - if (keys.length === 0 && (!array || value.length == 0)) { - return braces[0] + base + braces[1]; - } - - if (recurseTimes < 0) { - if (isRegExp(value)) { - return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); - } else { - return ctx.stylize('[Object]', 'special'); - } - } - - ctx.seen.push(value); - - var output; - if (array) { - output = formatArray(ctx, value, recurseTimes, visibleKeys, keys); - } else { - output = keys.map(function(key) { - return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array); - }); - } - - ctx.seen.pop(); - - return reduceToSingleString(output, base, braces); - } - - - function formatPrimitive(ctx, value) { - if (isUndefined(value)) - return ctx.stylize('undefined', 'undefined'); - if (isString(value)) { - var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '') - .replace(/'/g, "\\'") - .replace(/\\"/g, '"') + '\''; - return ctx.stylize(simple, 'string'); - } - if (isNumber(value)) - return ctx.stylize('' + value, 'number'); - if (isBoolean(value)) - return ctx.stylize('' + value, 'boolean'); - // For some reason typeof null is "object", so special case here. - if (isNull(value)) - return ctx.stylize('null', 'null'); - } - - - function formatError(value) { - return '[' + Error.prototype.toString.call(value) + ']'; - } - - - function formatArray(ctx, value, recurseTimes, visibleKeys, keys) { - var output = []; - for (var i = 0, l = value.length; i < l; ++i) { - if (hasOwnProperty(value, String(i))) { - output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, - String(i), true)); - } else { - output.push(''); - } - } - keys.forEach(function(key) { - if (!key.match(/^\d+$/)) { - output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, - key, true)); - } - }); - return output; - } - - - function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) { - var name, str, desc; - desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] }; - if (desc.get) { - if (desc.set) { - str = ctx.stylize('[Getter/Setter]', 'special'); - } else { - str = ctx.stylize('[Getter]', 'special'); - } - } else { - if (desc.set) { - str = ctx.stylize('[Setter]', 'special'); - } - } - if (!hasOwnProperty(visibleKeys, key)) { - name = '[' + key + ']'; - } - if (!str) { - if (ctx.seen.indexOf(desc.value) < 0) { - if (isNull(recurseTimes)) { - str = formatValue(ctx, desc.value, null); - } else { - str = formatValue(ctx, desc.value, recurseTimes - 1); - } - if (str.indexOf('\n') > -1) { - if (array) { - str = str.split('\n').map(function(line) { - return ' ' + line; - }).join('\n').substr(2); - } else { - str = '\n' + str.split('\n').map(function(line) { - return ' ' + line; - }).join('\n'); - } - } - } else { - str = ctx.stylize('[Circular]', 'special'); - } - } - if (isUndefined(name)) { - if (array && key.match(/^\d+$/)) { - return str; - } - name = JSON.stringify('' + key); - if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) { - name = name.substr(1, name.length - 2); - name = ctx.stylize(name, 'name'); - } else { - name = name.replace(/'/g, "\\'") - .replace(/\\"/g, '"') - .replace(/(^"|"$)/g, "'"); - name = ctx.stylize(name, 'string'); - } - } - - return name + ': ' + str; - } - - - function reduceToSingleString(output, base, braces) { - var numLinesEst = 0; - var length = output.reduce(function(prev, cur) { - numLinesEst++; - if (cur.indexOf('\n') >= 0) numLinesEst++; - return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1; - }, 0); - - if (length > 60) { - return braces[0] + - (base === '' ? '' : base + '\n ') + - ' ' + - output.join(',\n ') + - ' ' + - braces[1]; - } - - return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1]; - } - - - // NOTE: These type checking functions intentionally don't use `instanceof` - // because it is fragile and can be easily faked with `Object.create()`. - function isArray(ar) { - return Array.isArray(ar); - } - exports.isArray = isArray; - - function isBoolean(arg) { - return typeof arg === 'boolean'; - } - exports.isBoolean = isBoolean; - - function isNull(arg) { - return arg === null; - } - exports.isNull = isNull; - - function isNullOrUndefined(arg) { - return arg == null; - } - exports.isNullOrUndefined = isNullOrUndefined; - - function isNumber(arg) { - return typeof arg === 'number'; - } - exports.isNumber = isNumber; - - function isString(arg) { - return typeof arg === 'string'; - } - exports.isString = isString; - - function isSymbol(arg) { - return typeof arg === 'symbol'; - } - exports.isSymbol = isSymbol; - - function isUndefined(arg) { - return arg === void 0; - } - exports.isUndefined = isUndefined; - - function isRegExp(re) { - return isObject(re) && objectToString(re) === '[object RegExp]'; - } - exports.isRegExp = isRegExp; - - function isObject(arg) { - return typeof arg === 'object' && arg !== null; - } - exports.isObject = isObject; - - function isDate(d) { - return isObject(d) && objectToString(d) === '[object Date]'; - } - exports.isDate = isDate; - - function isError(e) { - return isObject(e) && - (objectToString(e) === '[object Error]' || e instanceof Error); - } - exports.isError = isError; - - function isFunction(arg) { - return typeof arg === 'function'; - } - exports.isFunction = isFunction; - - function isPrimitive(arg) { - return arg === null || - typeof arg === 'boolean' || - typeof arg === 'number' || - typeof arg === 'string' || - typeof arg === 'symbol' || // ES6 symbol - typeof arg === 'undefined'; - } - exports.isPrimitive = isPrimitive; - - exports.isBuffer = __webpack_require__(76); - - function objectToString(o) { - return Object.prototype.toString.call(o); - } - - - function pad(n) { - return n < 10 ? '0' + n.toString(10) : n.toString(10); - } - - - var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', - 'Oct', 'Nov', 'Dec']; - - // 26 Feb 16:19:34 - function timestamp() { - var d = new Date(); - var time = [pad(d.getHours()), - pad(d.getMinutes()), - pad(d.getSeconds())].join(':'); - return [d.getDate(), months[d.getMonth()], time].join(' '); - } - - - // log is just a thin wrapper to console.log that prepends a timestamp - exports.log = function() { - console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments)); - }; - - - /** - * Inherit the prototype methods from one constructor into another. - * - * The Function.prototype.inherits from lang.js rewritten as a standalone - * function (not on Function.prototype). NOTE: If this file is to be loaded - * during bootstrapping this function needs to be rewritten using some native - * functions as prototype setup using normal JavaScript does not work as - * expected during bootstrapping (see mirror.js in r114903). - * - * @param {function} ctor Constructor function which needs to inherit the - * prototype. - * @param {function} superCtor Constructor function to inherit prototype from. - */ - exports.inherits = __webpack_require__(77); - - exports._extend = function(origin, add) { - // Don't do anything if add isn't an object - if (!add || !isObject(add)) return origin; - - var keys = Object.keys(add); - var i = keys.length; - while (i--) { - origin[keys[i]] = add[keys[i]]; - } - return origin; - }; - - function hasOwnProperty(obj, prop) { - return Object.prototype.hasOwnProperty.call(obj, prop); - } - - /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()), __webpack_require__(2))) /***/ }, /* 76 */ -/***/ function(module, exports) { +/***/ function(module, exports, __webpack_require__) { + +const GuildChannel = __webpack_require__(29); +const TextBasedChannel = __webpack_require__(28); +const Collection = __webpack_require__(6); + +/** + * Represents a guild text channel on Discord. + * @extends {GuildChannel} + * @implements {TextBasedChannel} + */ +class TextChannel extends GuildChannel { + constructor(guild, data) { + super(guild, data); + this.type = 'text'; + this.messages = new Collection(); + this._typing = new Map(); + } + + setup(data) { + super.setup(data); + + /** + * The topic of the text channel, if there is one. + * @type {?string} + */ + this.topic = data.topic; + + this.lastMessageID = data.last_message_id; + } + + /** + * A collection of members that can see this channel, mapped by their ID. + * @type {Collection} + * @readonly + */ + get members() { + const members = new Collection(); + for (const member of this.guild.members.values()) { + if (this.permissionsFor(member).hasPermission('READ_MESSAGES')) { + members.set(member.id, member); + } + } + return members; + } + + /** + * Fetch all webhooks for the channel. + * @returns {Promise>} + */ + fetchWebhooks() { + return this.client.rest.methods.getChannelWebhooks(this); + } + + /** + * Create a webhook for the channel. + * @param {string} name The name of the webhook. + * @param {BufferResolvable} avatar The avatar for the webhook. + * @returns {Promise} webhook The created webhook. + * @example + * channel.createWebhook('Snek', 'http://snek.s3.amazonaws.com/topSnek.png') + * .then(webhook => console.log(`Created Webhook ${webhook}`)) + * .catch(console.error) + */ + createWebhook(name, avatar) { + return new Promise(resolve => { + if (avatar.startsWith('data:')) { + resolve(this.client.rest.methods.createWebhook(this, name, avatar)); + } else { + this.client.resolver.resolveBuffer(avatar).then(data => + resolve(this.client.rest.methods.createWebhook(this, name, data)) + ); + } + }); + } + + // These are here only for documentation purposes - they are implemented by TextBasedChannel + sendMessage() { return; } + sendTTSMessage() { return; } + sendFile() { return; } + sendCode() { return; } + fetchMessage() { return; } + fetchMessages() { return; } + fetchPinnedMessages() { return; } + startTyping() { return; } + stopTyping() { return; } + get typing() { return; } + get typingCount() { return; } + createCollector() { return; } + awaitMessages() { return; } + bulkDelete() { return; } + _cacheMessage() { return; } +} + +TextBasedChannel.applyToClass(TextChannel, true); + +module.exports = TextChannel; - module.exports = function isBuffer(arg) { - return arg && typeof arg === 'object' - && typeof arg.copy === 'function' - && typeof arg.fill === 'function' - && typeof arg.readUInt8 === 'function'; - } /***/ }, /* 77 */ -/***/ function(module, exports) { +/***/ function(module, exports, __webpack_require__) { - if (typeof Object.create === 'function') { - // implementation from standard node.js 'util' module - module.exports = function inherits(ctor, superCtor) { - ctor.super_ = superCtor - ctor.prototype = Object.create(superCtor.prototype, { - constructor: { - value: ctor, - enumerable: false, - writable: true, - configurable: true - } - }); - }; - } else { - // old school shim for old browsers - module.exports = function inherits(ctor, superCtor) { - ctor.super_ = superCtor - var TempCtor = function () {} - TempCtor.prototype = superCtor.prototype - ctor.prototype = new TempCtor() - ctor.prototype.constructor = ctor - } - } +const GuildChannel = __webpack_require__(29); +const Collection = __webpack_require__(6); + +/** + * Represents a guild voice channel on Discord. + * @extends {GuildChannel} + */ +class VoiceChannel extends GuildChannel { + constructor(guild, data) { + super(guild, data); + + /** + * The members in this voice channel. + * @type {Collection} + */ + this.members = new Collection(); + + this.type = 'voice'; + } + + setup(data) { + super.setup(data); + + /** + * The bitrate of this voice channel + * @type {number} + */ + this.bitrate = data.bitrate; + + /** + * The maximum amount of users allowed in this channel - 0 means unlimited. + * @type {number} + */ + this.userLimit = data.user_limit; + } + + /** + * The voice connection for this voice channel, if the client is connected + * @type {?VoiceConnection} + * @readonly + */ + get connection() { + const connection = this.guild.voiceConnection; + if (connection && connection.channel.id === this.id) return connection; + return null; + } + + /** + * Checks if the client has permission join the voice channel + * @type {boolean} + */ + get joinable() { + return this.permissionsFor(this.client.user).hasPermission('CONNECT'); + } + + /** + * Checks if the client has permission to send audio to the voice channel + * @type {boolean} + */ + get speakable() { + return this.permissionsFor(this.client.user).hasPermission('SPEAK'); + } + + /** + * Sets the bitrate of the channel + * @param {number} bitrate The new bitrate + * @returns {Promise} + * @example + * // set the bitrate of a voice channel + * voiceChannel.setBitrate(48000) + * .then(vc => console.log(`Set bitrate to ${vc.bitrate} for ${vc.name}`)) + * .catch(console.error); + */ + setBitrate(bitrate) { + return this.edit({ bitrate }); + } + + /** + * Sets the user limit of the channel + * @param {number} userLimit The new user limit + * @returns {Promise} + * @example + * // set the user limit of a voice channel + * voiceChannel.setUserLimit(42) + * .then(vc => console.log(`Set user limit to ${vc.userLimit} for ${vc.name}`)) + * .catch(console.error); + */ + setUserLimit(userLimit) { + return this.edit({ userLimit }); + } + + /** + * Attempts to join this voice channel + * @returns {Promise} + * @example + * // join a voice channel + * voiceChannel.join() + * .then(connection => console.log('Connected!')) + * .catch(console.error); + */ + join() { + return this.client.voice.joinChannel(this); + } + + /** + * Leaves this voice channel + * @example + * // leave a voice channel + * voiceChannel.leave(); + */ + leave() { + const connection = this.client.voice.connections.get(this.guild.id); + if (connection && connection.channel.id === this.id) connection.disconnect(); + } +} + +module.exports = VoiceChannel; /***/ }, /* 78 */ /***/ function(module, exports, __webpack_require__) { - var http = module.exports; - var EventEmitter = __webpack_require__(3).EventEmitter; - var Request = __webpack_require__(79); - var url = __webpack_require__(69) +const superagent = __webpack_require__(57); +const botGateway = __webpack_require__(2).Endpoints.botGateway; - http.request = function (params, cb) { - if (typeof params === 'string') { - params = url.parse(params) - } - if (!params) params = {}; - if (!params.host && !params.port) { - params.port = parseInt(window.location.port, 10); - } - if (!params.host && params.hostname) { - params.host = params.hostname; - } +/** + * Gets the recommended shard count from Discord + * @param {number} token Discord auth token + * @returns {Promise} the recommended number of shards + */ +module.exports = function fetchRecommendedShards(token) { + return new Promise((resolve, reject) => { + if (!token) throw new Error('A token must be provided.'); + superagent.get(botGateway) + .set('Authorization', `Bot ${token.replace(/^Bot\s*/i, '')}`) + .end((err, res) => { + if (err) reject(err); + resolve(res.body.shards); + }); + }); +}; - if (!params.protocol) { - if (params.scheme) { - params.protocol = params.scheme + ':'; - } else { - params.protocol = window.location.protocol; - } - } - - if (!params.host) { - params.host = window.location.hostname || window.location.host; - } - if (/:/.test(params.host)) { - if (!params.port) { - params.port = params.host.split(':')[1]; - } - params.host = params.host.split(':')[0]; - } - if (!params.port) params.port = params.protocol == 'https:' ? 443 : 80; - - var req = new Request(new xhrHttp, params); - if (cb) req.on('response', cb); - return req; - }; - - http.get = function (params, cb) { - params.method = 'GET'; - var req = http.request(params, cb); - req.end(); - return req; - }; - - http.Agent = function () {}; - http.Agent.defaultMaxSockets = 4; - - var xhrHttp = (function () { - if (typeof window === 'undefined') { - throw new Error('no window object present'); - } - else if (window.XMLHttpRequest) { - return window.XMLHttpRequest; - } - else if (window.ActiveXObject) { - var axs = [ - 'Msxml2.XMLHTTP.6.0', - 'Msxml2.XMLHTTP.3.0', - 'Microsoft.XMLHTTP' - ]; - for (var i = 0; i < axs.length; i++) { - try { - var ax = new(window.ActiveXObject)(axs[i]); - return function () { - if (ax) { - var ax_ = ax; - ax = null; - return ax_; - } - else { - return new(window.ActiveXObject)(axs[i]); - } - }; - } - catch (e) {} - } - throw new Error('ajax not supported in this browser') - } - else { - throw new Error('ajax not supported in this browser'); - } - })(); - - http.STATUS_CODES = { - 100 : 'Continue', - 101 : 'Switching Protocols', - 102 : 'Processing', // RFC 2518, obsoleted by RFC 4918 - 200 : 'OK', - 201 : 'Created', - 202 : 'Accepted', - 203 : 'Non-Authoritative Information', - 204 : 'No Content', - 205 : 'Reset Content', - 206 : 'Partial Content', - 207 : 'Multi-Status', // RFC 4918 - 300 : 'Multiple Choices', - 301 : 'Moved Permanently', - 302 : 'Moved Temporarily', - 303 : 'See Other', - 304 : 'Not Modified', - 305 : 'Use Proxy', - 307 : 'Temporary Redirect', - 400 : 'Bad Request', - 401 : 'Unauthorized', - 402 : 'Payment Required', - 403 : 'Forbidden', - 404 : 'Not Found', - 405 : 'Method Not Allowed', - 406 : 'Not Acceptable', - 407 : 'Proxy Authentication Required', - 408 : 'Request Time-out', - 409 : 'Conflict', - 410 : 'Gone', - 411 : 'Length Required', - 412 : 'Precondition Failed', - 413 : 'Request Entity Too Large', - 414 : 'Request-URI Too Large', - 415 : 'Unsupported Media Type', - 416 : 'Requested Range Not Satisfiable', - 417 : 'Expectation Failed', - 418 : 'I\'m a teapot', // RFC 2324 - 422 : 'Unprocessable Entity', // RFC 4918 - 423 : 'Locked', // RFC 4918 - 424 : 'Failed Dependency', // RFC 4918 - 425 : 'Unordered Collection', // RFC 4918 - 426 : 'Upgrade Required', // RFC 2817 - 428 : 'Precondition Required', // RFC 6585 - 429 : 'Too Many Requests', // RFC 6585 - 431 : 'Request Header Fields Too Large',// RFC 6585 - 500 : 'Internal Server Error', - 501 : 'Not Implemented', - 502 : 'Bad Gateway', - 503 : 'Service Unavailable', - 504 : 'Gateway Time-out', - 505 : 'HTTP Version Not Supported', - 506 : 'Variant Also Negotiates', // RFC 2295 - 507 : 'Insufficient Storage', // RFC 4918 - 509 : 'Bandwidth Limit Exceeded', - 510 : 'Not Extended', // RFC 2774 - 511 : 'Network Authentication Required' // RFC 6585 - }; /***/ }, /* 79 */ -/***/ function(module, exports, __webpack_require__) { +/***/ function(module, exports) { - var Stream = __webpack_require__(80); - var Response = __webpack_require__(96); - var Base64 = __webpack_require__(97); - var inherits = __webpack_require__(81); - - var Request = module.exports = function (xhr, params) { - var self = this; - self.writable = true; - self.xhr = xhr; - self.body = []; - - self.uri = (params.protocol || 'http:') + '//' - + params.host - + (params.port ? ':' + params.port : '') - + (params.path || '/') - ; - - if (typeof params.withCredentials === 'undefined') { - params.withCredentials = true; - } - - try { xhr.withCredentials = params.withCredentials } - catch (e) {} - - if (params.responseType) try { xhr.responseType = params.responseType } - catch (e) {} - - xhr.open( - params.method || 'GET', - self.uri, - true - ); - - xhr.onerror = function(event) { - self.emit('error', new Error('Network error')); - }; - - self._headers = {}; - - if (params.headers) { - var keys = objectKeys(params.headers); - for (var i = 0; i < keys.length; i++) { - var key = keys[i]; - if (!self.isSafeRequestHeader(key)) continue; - var value = params.headers[key]; - self.setHeader(key, value); - } - } - - if (params.auth) { - //basic auth - this.setHeader('Authorization', 'Basic ' + Base64.btoa(params.auth)); - } - - var res = new Response; - res.on('close', function () { - self.emit('close'); - }); - - res.on('ready', function () { - self.emit('response', res); - }); - - res.on('error', function (err) { - self.emit('error', err); - }); - - xhr.onreadystatechange = function () { - // Fix for IE9 bug - // SCRIPT575: Could not complete the operation due to error c00c023f - // It happens when a request is aborted, calling the success callback anyway with readyState === 4 - if (xhr.__aborted) return; - res.handle(xhr); - }; - }; - - inherits(Request, Stream); - - Request.prototype.setHeader = function (key, value) { - this._headers[key.toLowerCase()] = value - }; - - Request.prototype.getHeader = function (key) { - return this._headers[key.toLowerCase()] - }; - - Request.prototype.removeHeader = function (key) { - delete this._headers[key.toLowerCase()] - }; - - Request.prototype.write = function (s) { - this.body.push(s); - }; - - Request.prototype.destroy = function (s) { - this.xhr.__aborted = true; - this.xhr.abort(); - this.emit('close'); - }; - - Request.prototype.end = function (s) { - if (s !== undefined) this.body.push(s); - - var keys = objectKeys(this._headers); - for (var i = 0; i < keys.length; i++) { - var key = keys[i]; - var value = this._headers[key]; - if (isArray(value)) { - for (var j = 0; j < value.length; j++) { - this.xhr.setRequestHeader(key, value[j]); - } - } - else this.xhr.setRequestHeader(key, value) - } - - if (this.body.length === 0) { - this.xhr.send(''); - } - else if (typeof this.body[0] === 'string') { - this.xhr.send(this.body.join('')); - } - else if (isArray(this.body[0])) { - var body = []; - for (var i = 0; i < this.body.length; i++) { - body.push.apply(body, this.body[i]); - } - this.xhr.send(body); - } - else if (/Array/.test(Object.prototype.toString.call(this.body[0]))) { - var len = 0; - for (var i = 0; i < this.body.length; i++) { - len += this.body[i].length; - } - var body = new(this.body[0].constructor)(len); - var k = 0; - - for (var i = 0; i < this.body.length; i++) { - var b = this.body[i]; - for (var j = 0; j < b.length; j++) { - body[k++] = b[j]; - } - } - this.xhr.send(body); - } - else if (isXHR2Compatible(this.body[0])) { - this.xhr.send(this.body[0]); - } - else { - var body = ''; - for (var i = 0; i < this.body.length; i++) { - body += this.body[i].toString(); - } - this.xhr.send(body); - } - }; - - // Taken from http://dxr.mozilla.org/mozilla/mozilla-central/content/base/src/nsXMLHttpRequest.cpp.html - Request.unsafeHeaders = [ - "accept-charset", - "accept-encoding", - "access-control-request-headers", - "access-control-request-method", - "connection", - "content-length", - "cookie", - "cookie2", - "content-transfer-encoding", - "date", - "expect", - "host", - "keep-alive", - "origin", - "referer", - "te", - "trailer", - "transfer-encoding", - "upgrade", - "user-agent", - "via" - ]; - - Request.prototype.isSafeRequestHeader = function (headerName) { - if (!headerName) return false; - return indexOf(Request.unsafeHeaders, headerName.toLowerCase()) === -1; - }; - - var objectKeys = Object.keys || function (obj) { - var keys = []; - for (var key in obj) keys.push(key); - return keys; - }; - - var isArray = Array.isArray || function (xs) { - return Object.prototype.toString.call(xs) === '[object Array]'; - }; - - var indexOf = function (xs, x) { - if (xs.indexOf) return xs.indexOf(x); - for (var i = 0; i < xs.length; i++) { - if (xs[i] === x) return i; - } - return -1; - }; - - var isXHR2Compatible = function (obj) { - if (typeof Blob !== 'undefined' && obj instanceof Blob) return true; - if (typeof ArrayBuffer !== 'undefined' && obj instanceof ArrayBuffer) return true; - if (typeof FormData !== 'undefined' && obj instanceof FormData) return true; - }; +module.exports = function splitMessage(text, { maxLength = 1950, char = '\n', prepend = '', append = '' } = {}) { + if (text.length <= maxLength) return text; + const splitText = text.split(char); + if (splitText.length === 1) throw new Error('Message exceeds the max length and contains no split characters.'); + const messages = ['']; + let msg = 0; + for (let i = 0; i < splitText.length; i++) { + if (messages[msg].length + splitText[i].length + 1 > maxLength) { + messages[msg] += append; + messages.push(prepend); + msg++; + } + messages[msg] += (messages[msg].length > 0 && messages[msg] !== prepend ? char : '') + splitText[i]; + } + return messages; +}; /***/ }, /* 80 */ /***/ function(module, exports, __webpack_require__) { - // Copyright Joyent, Inc. and other Node contributors. - // - // Permission is hereby granted, free of charge, to any person obtaining a - // copy of this software and associated documentation files (the - // "Software"), to deal in the Software without restriction, including - // without limitation the rights to use, copy, modify, merge, publish, - // distribute, sublicense, and/or sell copies of the Software, and to permit - // persons to whom the Software is furnished to do so, subject to the - // following conditions: - // - // The above copyright notice and this permission notice shall be included - // in all copies or substantial portions of the Software. - // - // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN - // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE - // USE OR OTHER DEALINGS IN THE SOFTWARE. +var inherits = __webpack_require__(1); +var Reporter = __webpack_require__(23).Reporter; +var Buffer = __webpack_require__(0).Buffer; - module.exports = Stream; +function DecoderBuffer(base, options) { + Reporter.call(this, options); + if (!Buffer.isBuffer(base)) { + this.error('Input not Buffer'); + return; + } - var EE = __webpack_require__(3).EventEmitter; - var inherits = __webpack_require__(81); + this.base = base; + this.offset = 0; + this.length = base.length; +} +inherits(DecoderBuffer, Reporter); +exports.DecoderBuffer = DecoderBuffer; - inherits(Stream, EE); - Stream.Readable = __webpack_require__(82); - Stream.Writable = __webpack_require__(92); - Stream.Duplex = __webpack_require__(93); - Stream.Transform = __webpack_require__(94); - Stream.PassThrough = __webpack_require__(95); +DecoderBuffer.prototype.save = function save() { + return { offset: this.offset, reporter: Reporter.prototype.save.call(this) }; +}; - // Backwards-compat with node 0.4.x - Stream.Stream = Stream; +DecoderBuffer.prototype.restore = function restore(save) { + // Return skipped data + var res = new DecoderBuffer(this.base); + res.offset = save.offset; + res.length = this.offset; + this.offset = save.offset; + Reporter.prototype.restore.call(this, save.reporter); + return res; +}; - // old-style streams. Note that the pipe method (the only relevant - // part of this class) is overridden in the Readable class. +DecoderBuffer.prototype.isEmpty = function isEmpty() { + return this.offset === this.length; +}; - function Stream() { - EE.call(this); - } +DecoderBuffer.prototype.readUInt8 = function readUInt8(fail) { + if (this.offset + 1 <= this.length) + return this.base.readUInt8(this.offset++, true); + else + return this.error(fail || 'DecoderBuffer overrun'); +} - Stream.prototype.pipe = function(dest, options) { - var source = this; +DecoderBuffer.prototype.skip = function skip(bytes, fail) { + if (!(this.offset + bytes <= this.length)) + return this.error(fail || 'DecoderBuffer overrun'); - function ondata(chunk) { - if (dest.writable) { - if (false === dest.write(chunk) && source.pause) { - source.pause(); - } - } - } + var res = new DecoderBuffer(this.base); - source.on('data', ondata); + // Share reporter state + res._reporterState = this._reporterState; - function ondrain() { - if (source.readable && source.resume) { - source.resume(); - } - } + res.offset = this.offset; + res.length = this.offset + bytes; + this.offset += bytes; + return res; +} - dest.on('drain', ondrain); +DecoderBuffer.prototype.raw = function raw(save) { + return this.base.slice(save ? save.offset : this.offset, this.length); +} - // If the 'end' option is not supplied, dest.end() will be called when - // source gets the 'end' or 'close' events. Only dest.end() once. - if (!dest._isStdio && (!options || options.end !== false)) { - source.on('end', onend); - source.on('close', onclose); - } +function EncoderBuffer(value, reporter) { + if (Array.isArray(value)) { + this.length = 0; + this.value = value.map(function(item) { + if (!(item instanceof EncoderBuffer)) + item = new EncoderBuffer(item, reporter); + this.length += item.length; + return item; + }, this); + } else if (typeof value === 'number') { + if (!(0 <= value && value <= 0xff)) + return reporter.error('non-byte EncoderBuffer value'); + this.value = value; + this.length = 1; + } else if (typeof value === 'string') { + this.value = value; + this.length = Buffer.byteLength(value); + } else if (Buffer.isBuffer(value)) { + this.value = value; + this.length = value.length; + } else { + return reporter.error('Unsupported type: ' + typeof value); + } +} +exports.EncoderBuffer = EncoderBuffer; - var didOnEnd = false; - function onend() { - if (didOnEnd) return; - didOnEnd = true; +EncoderBuffer.prototype.join = function join(out, offset) { + if (!out) + out = new Buffer(this.length); + if (!offset) + offset = 0; - dest.end(); - } + if (this.length === 0) + return out; + if (Array.isArray(this.value)) { + this.value.forEach(function(item) { + item.join(out, offset); + offset += item.length; + }); + } else { + if (typeof this.value === 'number') + out[offset] = this.value; + else if (typeof this.value === 'string') + out.write(this.value, offset); + else if (Buffer.isBuffer(this.value)) + this.value.copy(out, offset); + offset += this.length; + } - function onclose() { - if (didOnEnd) return; - didOnEnd = true; - - if (typeof dest.destroy === 'function') dest.destroy(); - } - - // don't leave dangling pipes when there are errors. - function onerror(er) { - cleanup(); - if (EE.listenerCount(this, 'error') === 0) { - throw er; // Unhandled stream error in pipe. - } - } - - source.on('error', onerror); - dest.on('error', onerror); - - // remove all the event listeners that were added. - function cleanup() { - source.removeListener('data', ondata); - dest.removeListener('drain', ondrain); - - source.removeListener('end', onend); - source.removeListener('close', onclose); - - source.removeListener('error', onerror); - dest.removeListener('error', onerror); - - source.removeListener('end', cleanup); - source.removeListener('close', cleanup); - - dest.removeListener('close', cleanup); - } - - source.on('end', cleanup); - source.on('close', cleanup); - - dest.on('close', cleanup); - - dest.emit('pipe', source); - - // Allow for unix-like usage: A.pipe(B).pipe(C) - return dest; - }; + return out; +}; /***/ }, /* 81 */ -/***/ function(module, exports) { +/***/ function(module, exports, __webpack_require__) { - if (typeof Object.create === 'function') { - // implementation from standard node.js 'util' module - module.exports = function inherits(ctor, superCtor) { - ctor.super_ = superCtor - ctor.prototype = Object.create(superCtor.prototype, { - constructor: { - value: ctor, - enumerable: false, - writable: true, - configurable: true - } - }); - }; - } else { - // old school shim for old browsers - module.exports = function inherits(ctor, superCtor) { - ctor.super_ = superCtor - var TempCtor = function () {} - TempCtor.prototype = superCtor.prototype - ctor.prototype = new TempCtor() - ctor.prototype.constructor = ctor - } - } +var constants = exports; + +// Helper +constants._reverse = function reverse(map) { + var res = {}; + + Object.keys(map).forEach(function(key) { + // Convert key to integer if it is stringified + if ((key | 0) == key) + key = key | 0; + + var value = map[key]; + res[value] = key; + }); + + return res; +}; + +constants.der = __webpack_require__(142); /***/ }, /* 82 */ /***/ function(module, exports, __webpack_require__) { - /* WEBPACK VAR INJECTION */(function(process) {exports = module.exports = __webpack_require__(83); - exports.Stream = __webpack_require__(80); - exports.Readable = exports; - exports.Writable = __webpack_require__(88); - exports.Duplex = __webpack_require__(87); - exports.Transform = __webpack_require__(90); - exports.PassThrough = __webpack_require__(91); - if (!process.browser && process.env.READABLE_STREAM === 'disable') { - module.exports = __webpack_require__(80); - } +var inherits = __webpack_require__(1); + +var asn1 = __webpack_require__(32); +var base = asn1.base; +var bignum = asn1.bignum; + +// Import DER constants +var der = asn1.constants.der; + +function DERDecoder(entity) { + this.enc = 'der'; + this.name = entity.name; + this.entity = entity; + + // Construct base tree + this.tree = new DERNode(); + this.tree._init(entity.body); +}; +module.exports = DERDecoder; + +DERDecoder.prototype.decode = function decode(data, options) { + if (!(data instanceof base.DecoderBuffer)) + data = new base.DecoderBuffer(data, options); + + return this.tree._decode(data, options); +}; + +// Tree methods + +function DERNode(parent) { + base.Node.call(this, 'der', parent); +} +inherits(DERNode, base.Node); + +DERNode.prototype._peekTag = function peekTag(buffer, tag, any) { + if (buffer.isEmpty()) + return false; + + var state = buffer.save(); + var decodedTag = derDecodeTag(buffer, 'Failed to peek tag: "' + tag + '"'); + if (buffer.isError(decodedTag)) + return decodedTag; + + buffer.restore(state); + + return decodedTag.tag === tag || decodedTag.tagStr === tag || + (decodedTag.tagStr + 'of') === tag || any; +}; + +DERNode.prototype._decodeTag = function decodeTag(buffer, tag, any) { + var decodedTag = derDecodeTag(buffer, + 'Failed to decode tag of "' + tag + '"'); + if (buffer.isError(decodedTag)) + return decodedTag; + + var len = derDecodeLen(buffer, + decodedTag.primitive, + 'Failed to get length of "' + tag + '"'); + + // Failure + if (buffer.isError(len)) + return len; + + if (!any && + decodedTag.tag !== tag && + decodedTag.tagStr !== tag && + decodedTag.tagStr + 'of' !== tag) { + return buffer.error('Failed to match tag: "' + tag + '"'); + } + + if (decodedTag.primitive || len !== null) + return buffer.skip(len, 'Failed to match body of: "' + tag + '"'); + + // Indefinite length... find END tag + var state = buffer.save(); + var res = this._skipUntilEnd( + buffer, + 'Failed to skip indefinite length body: "' + this.tag + '"'); + if (buffer.isError(res)) + return res; + + len = buffer.offset - state.offset; + buffer.restore(state); + return buffer.skip(len, 'Failed to match body of: "' + tag + '"'); +}; + +DERNode.prototype._skipUntilEnd = function skipUntilEnd(buffer, fail) { + while (true) { + var tag = derDecodeTag(buffer, fail); + if (buffer.isError(tag)) + return tag; + var len = derDecodeLen(buffer, tag.primitive, fail); + if (buffer.isError(len)) + return len; + + var res; + if (tag.primitive || len !== null) + res = buffer.skip(len) + else + res = this._skipUntilEnd(buffer, fail); + + // Failure + if (buffer.isError(res)) + return res; + + if (tag.tagStr === 'end') + break; + } +}; + +DERNode.prototype._decodeList = function decodeList(buffer, tag, decoder, + options) { + var result = []; + while (!buffer.isEmpty()) { + var possibleEnd = this._peekTag(buffer, 'end'); + if (buffer.isError(possibleEnd)) + return possibleEnd; + + var res = decoder.decode(buffer, 'der', options); + if (buffer.isError(res) && possibleEnd) + break; + result.push(res); + } + return result; +}; + +DERNode.prototype._decodeStr = function decodeStr(buffer, tag) { + if (tag === 'bitstr') { + var unused = buffer.readUInt8(); + if (buffer.isError(unused)) + return unused; + return { unused: unused, data: buffer.raw() }; + } else if (tag === 'bmpstr') { + var raw = buffer.raw(); + if (raw.length % 2 === 1) + return buffer.error('Decoding of string type: bmpstr length mismatch'); + + var str = ''; + for (var i = 0; i < raw.length / 2; i++) { + str += String.fromCharCode(raw.readUInt16BE(i * 2)); + } + return str; + } else if (tag === 'numstr') { + var numstr = buffer.raw().toString('ascii'); + if (!this._isNumstr(numstr)) { + return buffer.error('Decoding of string type: ' + + 'numstr unsupported characters'); + } + return numstr; + } else if (tag === 'octstr') { + return buffer.raw(); + } else if (tag === 'objDesc') { + return buffer.raw(); + } else if (tag === 'printstr') { + var printstr = buffer.raw().toString('ascii'); + if (!this._isPrintstr(printstr)) { + return buffer.error('Decoding of string type: ' + + 'printstr unsupported characters'); + } + return printstr; + } else if (/str$/.test(tag)) { + return buffer.raw().toString(); + } else { + return buffer.error('Decoding of string type: ' + tag + ' unsupported'); + } +}; + +DERNode.prototype._decodeObjid = function decodeObjid(buffer, values, relative) { + var result; + var identifiers = []; + var ident = 0; + while (!buffer.isEmpty()) { + var subident = buffer.readUInt8(); + ident <<= 7; + ident |= subident & 0x7f; + if ((subident & 0x80) === 0) { + identifiers.push(ident); + ident = 0; + } + } + if (subident & 0x80) + identifiers.push(ident); + + var first = (identifiers[0] / 40) | 0; + var second = identifiers[0] % 40; + + if (relative) + result = identifiers; + else + result = [first, second].concat(identifiers.slice(1)); + + if (values) { + var tmp = values[result.join(' ')]; + if (tmp === undefined) + tmp = values[result.join('.')]; + if (tmp !== undefined) + result = tmp; + } + + return result; +}; + +DERNode.prototype._decodeTime = function decodeTime(buffer, tag) { + var str = buffer.raw().toString(); + if (tag === 'gentime') { + var year = str.slice(0, 4) | 0; + var mon = str.slice(4, 6) | 0; + var day = str.slice(6, 8) | 0; + var hour = str.slice(8, 10) | 0; + var min = str.slice(10, 12) | 0; + var sec = str.slice(12, 14) | 0; + } else if (tag === 'utctime') { + var year = str.slice(0, 2) | 0; + var mon = str.slice(2, 4) | 0; + var day = str.slice(4, 6) | 0; + var hour = str.slice(6, 8) | 0; + var min = str.slice(8, 10) | 0; + var sec = str.slice(10, 12) | 0; + if (year < 70) + year = 2000 + year; + else + year = 1900 + year; + } else { + return buffer.error('Decoding ' + tag + ' time is not supported yet'); + } + + return Date.UTC(year, mon - 1, day, hour, min, sec, 0); +}; + +DERNode.prototype._decodeNull = function decodeNull(buffer) { + return null; +}; + +DERNode.prototype._decodeBool = function decodeBool(buffer) { + var res = buffer.readUInt8(); + if (buffer.isError(res)) + return res; + else + return res !== 0; +}; + +DERNode.prototype._decodeInt = function decodeInt(buffer, values) { + // Bigint, return as it is (assume big endian) + var raw = buffer.raw(); + var res = new bignum(raw); + + if (values) + res = values[res.toString(10)] || res; + + return res; +}; + +DERNode.prototype._use = function use(entity, obj) { + if (typeof entity === 'function') + entity = entity(obj); + return entity._getDecoder('der').tree; +}; + +// Utility methods + +function derDecodeTag(buf, fail) { + var tag = buf.readUInt8(fail); + if (buf.isError(tag)) + return tag; + + var cls = der.tagClass[tag >> 6]; + var primitive = (tag & 0x20) === 0; + + // Multi-octet tag - load + if ((tag & 0x1f) === 0x1f) { + var oct = tag; + tag = 0; + while ((oct & 0x80) === 0x80) { + oct = buf.readUInt8(fail); + if (buf.isError(oct)) + return oct; + + tag <<= 7; + tag |= oct & 0x7f; + } + } else { + tag &= 0x1f; + } + var tagStr = der.tag[tag]; + + return { + cls: cls, + primitive: primitive, + tag: tag, + tagStr: tagStr + }; +} + +function derDecodeLen(buf, primitive, fail) { + var len = buf.readUInt8(fail); + if (buf.isError(len)) + return len; + + // Indefinite form + if (!primitive && len === 0x80) + return null; + + // Definite form + if ((len & 0x80) === 0) { + // Short form + return len; + } + + // Long form + var num = len & 0x7f; + if (num >= 4) + return buf.error('length octect is too long'); + + len = 0; + for (var i = 0; i < num; i++) { + len <<= 8; + var j = buf.readUInt8(fail); + if (buf.isError(j)) + return j; + len |= j; + } + + return len; +} - /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2))) /***/ }, /* 83 */ /***/ function(module, exports, __webpack_require__) { - /* WEBPACK VAR INJECTION */(function(process) {// Copyright Joyent, Inc. and other Node contributors. - // - // Permission is hereby granted, free of charge, to any person obtaining a - // copy of this software and associated documentation files (the - // "Software"), to deal in the Software without restriction, including - // without limitation the rights to use, copy, modify, merge, publish, - // distribute, sublicense, and/or sell copies of the Software, and to permit - // persons to whom the Software is furnished to do so, subject to the - // following conditions: - // - // The above copyright notice and this permission notice shall be included - // in all copies or substantial portions of the Software. - // - // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN - // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE - // USE OR OTHER DEALINGS IN THE SOFTWARE. - - module.exports = Readable; - - /**/ - var isArray = __webpack_require__(84); - /**/ - - - /**/ - var Buffer = __webpack_require__(58).Buffer; - /**/ - - Readable.ReadableState = ReadableState; - - var EE = __webpack_require__(3).EventEmitter; - - /**/ - if (!EE.listenerCount) EE.listenerCount = function(emitter, type) { - return emitter.listeners(type).length; - }; - /**/ - - var Stream = __webpack_require__(80); - - /**/ - var util = __webpack_require__(85); - util.inherits = __webpack_require__(81); - /**/ - - var StringDecoder; - - - /**/ - var debug = __webpack_require__(86); - if (debug && debug.debuglog) { - debug = debug.debuglog('stream'); - } else { - debug = function () {}; - } - /**/ - - - util.inherits(Readable, Stream); - - function ReadableState(options, stream) { - var Duplex = __webpack_require__(87); - - options = options || {}; - - // the point at which it stops calling _read() to fill the buffer - // Note: 0 is a valid value, means "don't call _read preemptively ever" - var hwm = options.highWaterMark; - var defaultHwm = options.objectMode ? 16 : 16 * 1024; - this.highWaterMark = (hwm || hwm === 0) ? hwm : defaultHwm; - - // cast to ints. - this.highWaterMark = ~~this.highWaterMark; - - this.buffer = []; - this.length = 0; - this.pipes = null; - this.pipesCount = 0; - this.flowing = null; - this.ended = false; - this.endEmitted = false; - this.reading = false; - - // a flag to be able to tell if the onwrite cb is called immediately, - // or on a later tick. We set this to true at first, because any - // actions that shouldn't happen until "later" should generally also - // not happen before the first write call. - this.sync = true; - - // whenever we return null, then we set a flag to say - // that we're awaiting a 'readable' event emission. - this.needReadable = false; - this.emittedReadable = false; - this.readableListening = false; - - - // object stream flag. Used to make read(n) ignore n and to - // make all the buffer merging and length checks go away - this.objectMode = !!options.objectMode; - - if (stream instanceof Duplex) - this.objectMode = this.objectMode || !!options.readableObjectMode; - - // Crypto is kind of old and crusty. Historically, its default string - // encoding is 'binary' so we have to make this configurable. - // Everything else in the universe uses 'utf8', though. - this.defaultEncoding = options.defaultEncoding || 'utf8'; - - // when piping, we only care about 'readable' events that happen - // after read()ing all the bytes and not getting any pushback. - this.ranOut = false; - - // the number of writers that are awaiting a drain event in .pipe()s - this.awaitDrain = 0; - - // if true, a maybeReadMore has been scheduled - this.readingMore = false; - - this.decoder = null; - this.encoding = null; - if (options.encoding) { - if (!StringDecoder) - StringDecoder = __webpack_require__(89).StringDecoder; - this.decoder = new StringDecoder(options.encoding); - this.encoding = options.encoding; - } - } - - function Readable(options) { - var Duplex = __webpack_require__(87); - - if (!(this instanceof Readable)) - return new Readable(options); - - this._readableState = new ReadableState(options, this); - - // legacy - this.readable = true; - - Stream.call(this); - } - - // Manually shove something into the read() buffer. - // This returns true if the highWaterMark has not been hit yet, - // similar to how Writable.write() returns true if you should - // write() some more. - Readable.prototype.push = function(chunk, encoding) { - var state = this._readableState; - - if (util.isString(chunk) && !state.objectMode) { - encoding = encoding || state.defaultEncoding; - if (encoding !== state.encoding) { - chunk = new Buffer(chunk, encoding); - encoding = ''; - } - } - - return readableAddChunk(this, state, chunk, encoding, false); - }; - - // Unshift should *always* be something directly out of read() - Readable.prototype.unshift = function(chunk) { - var state = this._readableState; - return readableAddChunk(this, state, chunk, '', true); - }; - - function readableAddChunk(stream, state, chunk, encoding, addToFront) { - var er = chunkInvalid(state, chunk); - if (er) { - stream.emit('error', er); - } else if (util.isNullOrUndefined(chunk)) { - state.reading = false; - if (!state.ended) - onEofChunk(stream, state); - } else if (state.objectMode || chunk && chunk.length > 0) { - if (state.ended && !addToFront) { - var e = new Error('stream.push() after EOF'); - stream.emit('error', e); - } else if (state.endEmitted && addToFront) { - var e = new Error('stream.unshift() after end event'); - stream.emit('error', e); - } else { - if (state.decoder && !addToFront && !encoding) - chunk = state.decoder.write(chunk); - - if (!addToFront) - state.reading = false; - - // if we want the data now, just emit it. - if (state.flowing && state.length === 0 && !state.sync) { - stream.emit('data', chunk); - stream.read(0); - } else { - // update the buffer info. - state.length += state.objectMode ? 1 : chunk.length; - if (addToFront) - state.buffer.unshift(chunk); - else - state.buffer.push(chunk); - - if (state.needReadable) - emitReadable(stream); - } - - maybeReadMore(stream, state); - } - } else if (!addToFront) { - state.reading = false; - } - - return needMoreData(state); - } - - - - // if it's past the high water mark, we can push in some more. - // Also, if we have no data yet, we can stand some - // more bytes. This is to work around cases where hwm=0, - // such as the repl. Also, if the push() triggered a - // readable event, and the user called read(largeNumber) such that - // needReadable was set, then we ought to push more, so that another - // 'readable' event will be triggered. - function needMoreData(state) { - return !state.ended && - (state.needReadable || - state.length < state.highWaterMark || - state.length === 0); - } - - // backwards compatibility. - Readable.prototype.setEncoding = function(enc) { - if (!StringDecoder) - StringDecoder = __webpack_require__(89).StringDecoder; - this._readableState.decoder = new StringDecoder(enc); - this._readableState.encoding = enc; - return this; - }; - - // Don't raise the hwm > 128MB - var MAX_HWM = 0x800000; - function roundUpToNextPowerOf2(n) { - if (n >= MAX_HWM) { - n = MAX_HWM; - } else { - // Get the next highest power of 2 - n--; - for (var p = 1; p < 32; p <<= 1) n |= n >> p; - n++; - } - return n; - } - - function howMuchToRead(n, state) { - if (state.length === 0 && state.ended) - return 0; - - if (state.objectMode) - return n === 0 ? 0 : 1; - - if (isNaN(n) || util.isNull(n)) { - // only flow one buffer at a time - if (state.flowing && state.buffer.length) - return state.buffer[0].length; - else - return state.length; - } - - if (n <= 0) - return 0; - - // If we're asking for more than the target buffer level, - // then raise the water mark. Bump up to the next highest - // power of 2, to prevent increasing it excessively in tiny - // amounts. - if (n > state.highWaterMark) - state.highWaterMark = roundUpToNextPowerOf2(n); - - // don't have that much. return null, unless we've ended. - if (n > state.length) { - if (!state.ended) { - state.needReadable = true; - return 0; - } else - return state.length; - } - - return n; - } - - // you can override either this method, or the async _read(n) below. - Readable.prototype.read = function(n) { - debug('read', n); - var state = this._readableState; - var nOrig = n; - - if (!util.isNumber(n) || n > 0) - state.emittedReadable = false; - - // if we're doing read(0) to trigger a readable event, but we - // already have a bunch of data in the buffer, then just trigger - // the 'readable' event and move on. - if (n === 0 && - state.needReadable && - (state.length >= state.highWaterMark || state.ended)) { - debug('read: emitReadable', state.length, state.ended); - if (state.length === 0 && state.ended) - endReadable(this); - else - emitReadable(this); - return null; - } - - n = howMuchToRead(n, state); - - // if we've ended, and we're now clear, then finish it up. - if (n === 0 && state.ended) { - if (state.length === 0) - endReadable(this); - return null; - } - - // All the actual chunk generation logic needs to be - // *below* the call to _read. The reason is that in certain - // synthetic stream cases, such as passthrough streams, _read - // may be a completely synchronous operation which may change - // the state of the read buffer, providing enough data when - // before there was *not* enough. - // - // So, the steps are: - // 1. Figure out what the state of things will be after we do - // a read from the buffer. - // - // 2. If that resulting state will trigger a _read, then call _read. - // Note that this may be asynchronous, or synchronous. Yes, it is - // deeply ugly to write APIs this way, but that still doesn't mean - // that the Readable class should behave improperly, as streams are - // designed to be sync/async agnostic. - // Take note if the _read call is sync or async (ie, if the read call - // has returned yet), so that we know whether or not it's safe to emit - // 'readable' etc. - // - // 3. Actually pull the requested chunks out of the buffer and return. - - // if we need a readable event, then we need to do some reading. - var doRead = state.needReadable; - debug('need readable', doRead); - - // if we currently have less than the highWaterMark, then also read some - if (state.length === 0 || state.length - n < state.highWaterMark) { - doRead = true; - debug('length less than watermark', doRead); - } - - // however, if we've ended, then there's no point, and if we're already - // reading, then it's unnecessary. - if (state.ended || state.reading) { - doRead = false; - debug('reading or ended', doRead); - } - - if (doRead) { - debug('do read'); - state.reading = true; - state.sync = true; - // if the length is currently zero, then we *need* a readable event. - if (state.length === 0) - state.needReadable = true; - // call internal read method - this._read(state.highWaterMark); - state.sync = false; - } - - // If _read pushed data synchronously, then `reading` will be false, - // and we need to re-evaluate how much data we can return to the user. - if (doRead && !state.reading) - n = howMuchToRead(nOrig, state); - - var ret; - if (n > 0) - ret = fromList(n, state); - else - ret = null; - - if (util.isNull(ret)) { - state.needReadable = true; - n = 0; - } - - state.length -= n; - - // If we have nothing in the buffer, then we want to know - // as soon as we *do* get something into the buffer. - if (state.length === 0 && !state.ended) - state.needReadable = true; - - // If we tried to read() past the EOF, then emit end on the next tick. - if (nOrig !== n && state.ended && state.length === 0) - endReadable(this); - - if (!util.isNull(ret)) - this.emit('data', ret); - - return ret; - }; - - function chunkInvalid(state, chunk) { - var er = null; - if (!util.isBuffer(chunk) && - !util.isString(chunk) && - !util.isNullOrUndefined(chunk) && - !state.objectMode) { - er = new TypeError('Invalid non-string/buffer chunk'); - } - return er; - } - - - function onEofChunk(stream, state) { - if (state.decoder && !state.ended) { - var chunk = state.decoder.end(); - if (chunk && chunk.length) { - state.buffer.push(chunk); - state.length += state.objectMode ? 1 : chunk.length; - } - } - state.ended = true; - - // emit 'readable' now to make sure it gets picked up. - emitReadable(stream); - } - - // Don't emit readable right away in sync mode, because this can trigger - // another read() call => stack overflow. This way, it might trigger - // a nextTick recursion warning, but that's not so bad. - function emitReadable(stream) { - var state = stream._readableState; - state.needReadable = false; - if (!state.emittedReadable) { - debug('emitReadable', state.flowing); - state.emittedReadable = true; - if (state.sync) - process.nextTick(function() { - emitReadable_(stream); - }); - else - emitReadable_(stream); - } - } - - function emitReadable_(stream) { - debug('emit readable'); - stream.emit('readable'); - flow(stream); - } - - - // at this point, the user has presumably seen the 'readable' event, - // and called read() to consume some data. that may have triggered - // in turn another _read(n) call, in which case reading = true if - // it's in progress. - // However, if we're not ended, or reading, and the length < hwm, - // then go ahead and try to read some more preemptively. - function maybeReadMore(stream, state) { - if (!state.readingMore) { - state.readingMore = true; - process.nextTick(function() { - maybeReadMore_(stream, state); - }); - } - } - - function maybeReadMore_(stream, state) { - var len = state.length; - while (!state.reading && !state.flowing && !state.ended && - state.length < state.highWaterMark) { - debug('maybeReadMore read 0'); - stream.read(0); - if (len === state.length) - // didn't get any data, stop spinning. - break; - else - len = state.length; - } - state.readingMore = false; - } - - // abstract method. to be overridden in specific implementation classes. - // call cb(er, data) where data is <= n in length. - // for virtual (non-string, non-buffer) streams, "length" is somewhat - // arbitrary, and perhaps not very meaningful. - Readable.prototype._read = function(n) { - this.emit('error', new Error('not implemented')); - }; - - Readable.prototype.pipe = function(dest, pipeOpts) { - var src = this; - var state = this._readableState; - - switch (state.pipesCount) { - case 0: - state.pipes = dest; - break; - case 1: - state.pipes = [state.pipes, dest]; - break; - default: - state.pipes.push(dest); - break; - } - state.pipesCount += 1; - debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts); - - var doEnd = (!pipeOpts || pipeOpts.end !== false) && - dest !== process.stdout && - dest !== process.stderr; - - var endFn = doEnd ? onend : cleanup; - if (state.endEmitted) - process.nextTick(endFn); - else - src.once('end', endFn); - - dest.on('unpipe', onunpipe); - function onunpipe(readable) { - debug('onunpipe'); - if (readable === src) { - cleanup(); - } - } - - function onend() { - debug('onend'); - dest.end(); - } - - // when the dest drains, it reduces the awaitDrain counter - // on the source. This would be more elegant with a .once() - // handler in flow(), but adding and removing repeatedly is - // too slow. - var ondrain = pipeOnDrain(src); - dest.on('drain', ondrain); - - function cleanup() { - debug('cleanup'); - // cleanup event handlers once the pipe is broken - dest.removeListener('close', onclose); - dest.removeListener('finish', onfinish); - dest.removeListener('drain', ondrain); - dest.removeListener('error', onerror); - dest.removeListener('unpipe', onunpipe); - src.removeListener('end', onend); - src.removeListener('end', cleanup); - src.removeListener('data', ondata); - - // if the reader is waiting for a drain event from this - // specific writer, then it would cause it to never start - // flowing again. - // So, if this is awaiting a drain, then we just call it now. - // If we don't know, then assume that we are waiting for one. - if (state.awaitDrain && - (!dest._writableState || dest._writableState.needDrain)) - ondrain(); - } - - src.on('data', ondata); - function ondata(chunk) { - debug('ondata'); - var ret = dest.write(chunk); - if (false === ret) { - debug('false write response, pause', - src._readableState.awaitDrain); - src._readableState.awaitDrain++; - src.pause(); - } - } - - // if the dest has an error, then stop piping into it. - // however, don't suppress the throwing behavior for this. - function onerror(er) { - debug('onerror', er); - unpipe(); - dest.removeListener('error', onerror); - if (EE.listenerCount(dest, 'error') === 0) - dest.emit('error', er); - } - // This is a brutally ugly hack to make sure that our error handler - // is attached before any userland ones. NEVER DO THIS. - if (!dest._events || !dest._events.error) - dest.on('error', onerror); - else if (isArray(dest._events.error)) - dest._events.error.unshift(onerror); - else - dest._events.error = [onerror, dest._events.error]; - - - - // Both close and finish should trigger unpipe, but only once. - function onclose() { - dest.removeListener('finish', onfinish); - unpipe(); - } - dest.once('close', onclose); - function onfinish() { - debug('onfinish'); - dest.removeListener('close', onclose); - unpipe(); - } - dest.once('finish', onfinish); - - function unpipe() { - debug('unpipe'); - src.unpipe(dest); - } - - // tell the dest that it's being piped to - dest.emit('pipe', src); - - // start the flow if it hasn't been started already. - if (!state.flowing) { - debug('pipe resume'); - src.resume(); - } - - return dest; - }; - - function pipeOnDrain(src) { - return function() { - var state = src._readableState; - debug('pipeOnDrain', state.awaitDrain); - if (state.awaitDrain) - state.awaitDrain--; - if (state.awaitDrain === 0 && EE.listenerCount(src, 'data')) { - state.flowing = true; - flow(src); - } - }; - } - - - Readable.prototype.unpipe = function(dest) { - var state = this._readableState; - - // if we're not piping anywhere, then do nothing. - if (state.pipesCount === 0) - return this; - - // just one destination. most common case. - if (state.pipesCount === 1) { - // passed in one, but it's not the right one. - if (dest && dest !== state.pipes) - return this; - - if (!dest) - dest = state.pipes; - - // got a match. - state.pipes = null; - state.pipesCount = 0; - state.flowing = false; - if (dest) - dest.emit('unpipe', this); - return this; - } - - // slow case. multiple pipe destinations. - - if (!dest) { - // remove all. - var dests = state.pipes; - var len = state.pipesCount; - state.pipes = null; - state.pipesCount = 0; - state.flowing = false; - - for (var i = 0; i < len; i++) - dests[i].emit('unpipe', this); - return this; - } - - // try to find the right one. - var i = indexOf(state.pipes, dest); - if (i === -1) - return this; - - state.pipes.splice(i, 1); - state.pipesCount -= 1; - if (state.pipesCount === 1) - state.pipes = state.pipes[0]; - - dest.emit('unpipe', this); - - return this; - }; - - // set up data events if they are asked for - // Ensure readable listeners eventually get something - Readable.prototype.on = function(ev, fn) { - var res = Stream.prototype.on.call(this, ev, fn); - - // If listening to data, and it has not explicitly been paused, - // then call resume to start the flow of data on the next tick. - if (ev === 'data' && false !== this._readableState.flowing) { - this.resume(); - } - - if (ev === 'readable' && this.readable) { - var state = this._readableState; - if (!state.readableListening) { - state.readableListening = true; - state.emittedReadable = false; - state.needReadable = true; - if (!state.reading) { - var self = this; - process.nextTick(function() { - debug('readable nexttick read 0'); - self.read(0); - }); - } else if (state.length) { - emitReadable(this, state); - } - } - } - - return res; - }; - Readable.prototype.addListener = Readable.prototype.on; - - // pause() and resume() are remnants of the legacy readable stream API - // If the user uses them, then switch into old mode. - Readable.prototype.resume = function() { - var state = this._readableState; - if (!state.flowing) { - debug('resume'); - state.flowing = true; - if (!state.reading) { - debug('resume read 0'); - this.read(0); - } - resume(this, state); - } - return this; - }; - - function resume(stream, state) { - if (!state.resumeScheduled) { - state.resumeScheduled = true; - process.nextTick(function() { - resume_(stream, state); - }); - } - } - - function resume_(stream, state) { - state.resumeScheduled = false; - stream.emit('resume'); - flow(stream); - if (state.flowing && !state.reading) - stream.read(0); - } - - Readable.prototype.pause = function() { - debug('call pause flowing=%j', this._readableState.flowing); - if (false !== this._readableState.flowing) { - debug('pause'); - this._readableState.flowing = false; - this.emit('pause'); - } - return this; - }; - - function flow(stream) { - var state = stream._readableState; - debug('flow', state.flowing); - if (state.flowing) { - do { - var chunk = stream.read(); - } while (null !== chunk && state.flowing); - } - } - - // wrap an old-style stream as the async data source. - // This is *not* part of the readable stream interface. - // It is an ugly unfortunate mess of history. - Readable.prototype.wrap = function(stream) { - var state = this._readableState; - var paused = false; - - var self = this; - stream.on('end', function() { - debug('wrapped end'); - if (state.decoder && !state.ended) { - var chunk = state.decoder.end(); - if (chunk && chunk.length) - self.push(chunk); - } - - self.push(null); - }); - - stream.on('data', function(chunk) { - debug('wrapped data'); - if (state.decoder) - chunk = state.decoder.write(chunk); - if (!chunk || !state.objectMode && !chunk.length) - return; - - var ret = self.push(chunk); - if (!ret) { - paused = true; - stream.pause(); - } - }); - - // proxy all the other methods. - // important when wrapping filters and duplexes. - for (var i in stream) { - if (util.isFunction(stream[i]) && util.isUndefined(this[i])) { - this[i] = function(method) { return function() { - return stream[method].apply(stream, arguments); - }}(i); - } - } - - // proxy certain important events. - var events = ['error', 'close', 'destroy', 'pause', 'resume']; - forEach(events, function(ev) { - stream.on(ev, self.emit.bind(self, ev)); - }); - - // when we try to consume some more bytes, simply unpause the - // underlying stream. - self._read = function(n) { - debug('wrapped _read', n); - if (paused) { - paused = false; - stream.resume(); - } - }; - - return self; - }; - - - - // exposed for testing purposes only. - Readable._fromList = fromList; - - // Pluck off n bytes from an array of buffers. - // Length is the combined lengths of all the buffers in the list. - function fromList(n, state) { - var list = state.buffer; - var length = state.length; - var stringMode = !!state.decoder; - var objectMode = !!state.objectMode; - var ret; - - // nothing in the list, definitely empty. - if (list.length === 0) - return null; - - if (length === 0) - ret = null; - else if (objectMode) - ret = list.shift(); - else if (!n || n >= length) { - // read it all, truncate the array. - if (stringMode) - ret = list.join(''); - else - ret = Buffer.concat(list, length); - list.length = 0; - } else { - // read just some of it. - if (n < list[0].length) { - // just take a part of the first list item. - // slice is the same for buffers and strings. - var buf = list[0]; - ret = buf.slice(0, n); - list[0] = buf.slice(n); - } else if (n === list[0].length) { - // first list is a perfect match - ret = list.shift(); - } else { - // complex case. - // we have enough to cover it, but it spans past the first buffer. - if (stringMode) - ret = ''; - else - ret = new Buffer(n); - - var c = 0; - for (var i = 0, l = list.length; i < l && c < n; i++) { - var buf = list[0]; - var cpy = Math.min(n - c, buf.length); - - if (stringMode) - ret += buf.slice(0, cpy); - else - buf.copy(ret, c, 0, cpy); - - if (cpy < buf.length) - list[0] = buf.slice(cpy); - else - list.shift(); - - c += cpy; - } - } - } - - return ret; - } - - function endReadable(stream) { - var state = stream._readableState; - - // If we get here before consuming all the bytes, then that is a - // bug in node. Should never happen. - if (state.length > 0) - throw new Error('endReadable called on non-empty stream'); - - if (!state.endEmitted) { - state.ended = true; - process.nextTick(function() { - // Check that we didn't get one last unshift. - if (!state.endEmitted && state.length === 0) { - state.endEmitted = true; - stream.readable = false; - stream.emit('end'); - } - }); - } - } - - function forEach (xs, f) { - for (var i = 0, l = xs.length; i < l; i++) { - f(xs[i], i); - } - } - - function indexOf (xs, x) { - for (var i = 0, l = xs.length; i < l; i++) { - if (xs[i] === x) return i; - } - return -1; - } - - /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2))) +var inherits = __webpack_require__(1); +var Buffer = __webpack_require__(0).Buffer; + +var asn1 = __webpack_require__(32); +var base = asn1.base; + +// Import DER constants +var der = asn1.constants.der; + +function DEREncoder(entity) { + this.enc = 'der'; + this.name = entity.name; + this.entity = entity; + + // Construct base tree + this.tree = new DERNode(); + this.tree._init(entity.body); +}; +module.exports = DEREncoder; + +DEREncoder.prototype.encode = function encode(data, reporter) { + return this.tree._encode(data, reporter).join(); +}; + +// Tree methods + +function DERNode(parent) { + base.Node.call(this, 'der', parent); +} +inherits(DERNode, base.Node); + +DERNode.prototype._encodeComposite = function encodeComposite(tag, + primitive, + cls, + content) { + var encodedTag = encodeTag(tag, primitive, cls, this.reporter); + + // Short form + if (content.length < 0x80) { + var header = new Buffer(2); + header[0] = encodedTag; + header[1] = content.length; + return this._createEncoderBuffer([ header, content ]); + } + + // Long form + // Count octets required to store length + var lenOctets = 1; + for (var i = content.length; i >= 0x100; i >>= 8) + lenOctets++; + + var header = new Buffer(1 + 1 + lenOctets); + header[0] = encodedTag; + header[1] = 0x80 | lenOctets; + + for (var i = 1 + lenOctets, j = content.length; j > 0; i--, j >>= 8) + header[i] = j & 0xff; + + return this._createEncoderBuffer([ header, content ]); +}; + +DERNode.prototype._encodeStr = function encodeStr(str, tag) { + if (tag === 'bitstr') { + return this._createEncoderBuffer([ str.unused | 0, str.data ]); + } else if (tag === 'bmpstr') { + var buf = new Buffer(str.length * 2); + for (var i = 0; i < str.length; i++) { + buf.writeUInt16BE(str.charCodeAt(i), i * 2); + } + return this._createEncoderBuffer(buf); + } else if (tag === 'numstr') { + if (!this._isNumstr(str)) { + return this.reporter.error('Encoding of string type: numstr supports ' + + 'only digits and space'); + } + return this._createEncoderBuffer(str); + } else if (tag === 'printstr') { + if (!this._isPrintstr(str)) { + return this.reporter.error('Encoding of string type: printstr supports ' + + 'only latin upper and lower case letters, ' + + 'digits, space, apostrophe, left and rigth ' + + 'parenthesis, plus sign, comma, hyphen, ' + + 'dot, slash, colon, equal sign, ' + + 'question mark'); + } + return this._createEncoderBuffer(str); + } else if (/str$/.test(tag)) { + return this._createEncoderBuffer(str); + } else if (tag === 'objDesc') { + return this._createEncoderBuffer(str); + } else { + return this.reporter.error('Encoding of string type: ' + tag + + ' unsupported'); + } +}; + +DERNode.prototype._encodeObjid = function encodeObjid(id, values, relative) { + if (typeof id === 'string') { + if (!values) + return this.reporter.error('string objid given, but no values map found'); + if (!values.hasOwnProperty(id)) + return this.reporter.error('objid not found in values map'); + id = values[id].split(/[\s\.]+/g); + for (var i = 0; i < id.length; i++) + id[i] |= 0; + } else if (Array.isArray(id)) { + id = id.slice(); + for (var i = 0; i < id.length; i++) + id[i] |= 0; + } + + if (!Array.isArray(id)) { + return this.reporter.error('objid() should be either array or string, ' + + 'got: ' + JSON.stringify(id)); + } + + if (!relative) { + if (id[1] >= 40) + return this.reporter.error('Second objid identifier OOB'); + id.splice(0, 2, id[0] * 40 + id[1]); + } + + // Count number of octets + var size = 0; + for (var i = 0; i < id.length; i++) { + var ident = id[i]; + for (size++; ident >= 0x80; ident >>= 7) + size++; + } + + var objid = new Buffer(size); + var offset = objid.length - 1; + for (var i = id.length - 1; i >= 0; i--) { + var ident = id[i]; + objid[offset--] = ident & 0x7f; + while ((ident >>= 7) > 0) + objid[offset--] = 0x80 | (ident & 0x7f); + } + + return this._createEncoderBuffer(objid); +}; + +function two(num) { + if (num < 10) + return '0' + num; + else + return num; +} + +DERNode.prototype._encodeTime = function encodeTime(time, tag) { + var str; + var date = new Date(time); + + if (tag === 'gentime') { + str = [ + two(date.getFullYear()), + two(date.getUTCMonth() + 1), + two(date.getUTCDate()), + two(date.getUTCHours()), + two(date.getUTCMinutes()), + two(date.getUTCSeconds()), + 'Z' + ].join(''); + } else if (tag === 'utctime') { + str = [ + two(date.getFullYear() % 100), + two(date.getUTCMonth() + 1), + two(date.getUTCDate()), + two(date.getUTCHours()), + two(date.getUTCMinutes()), + two(date.getUTCSeconds()), + 'Z' + ].join(''); + } else { + this.reporter.error('Encoding ' + tag + ' time is not supported yet'); + } + + return this._encodeStr(str, 'octstr'); +}; + +DERNode.prototype._encodeNull = function encodeNull() { + return this._createEncoderBuffer(''); +}; + +DERNode.prototype._encodeInt = function encodeInt(num, values) { + if (typeof num === 'string') { + if (!values) + return this.reporter.error('String int or enum given, but no values map'); + if (!values.hasOwnProperty(num)) { + return this.reporter.error('Values map doesn\'t contain: ' + + JSON.stringify(num)); + } + num = values[num]; + } + + // Bignum, assume big endian + if (typeof num !== 'number' && !Buffer.isBuffer(num)) { + var numArray = num.toArray(); + if (!num.sign && numArray[0] & 0x80) { + numArray.unshift(0); + } + num = new Buffer(numArray); + } + + if (Buffer.isBuffer(num)) { + var size = num.length; + if (num.length === 0) + size++; + + var out = new Buffer(size); + num.copy(out); + if (num.length === 0) + out[0] = 0 + return this._createEncoderBuffer(out); + } + + if (num < 0x80) + return this._createEncoderBuffer(num); + + if (num < 0x100) + return this._createEncoderBuffer([0, num]); + + var size = 1; + for (var i = num; i >= 0x100; i >>= 8) + size++; + + var out = new Array(size); + for (var i = out.length - 1; i >= 0; i--) { + out[i] = num & 0xff; + num >>= 8; + } + if(out[0] & 0x80) { + out.unshift(0); + } + + return this._createEncoderBuffer(new Buffer(out)); +}; + +DERNode.prototype._encodeBool = function encodeBool(value) { + return this._createEncoderBuffer(value ? 0xff : 0); +}; + +DERNode.prototype._use = function use(entity, obj) { + if (typeof entity === 'function') + entity = entity(obj); + return entity._getEncoder('der').tree; +}; + +DERNode.prototype._skipDefault = function skipDefault(dataBuffer, reporter, parent) { + var state = this._baseState; + var i; + if (state['default'] === null) + return false; + + var data = dataBuffer.join(); + if (state.defaultBuffer === undefined) + state.defaultBuffer = this._encodeValue(state['default'], reporter, parent).join(); + + if (data.length !== state.defaultBuffer.length) + return false; + + for (i=0; i < data.length; i++) + if (data[i] !== state.defaultBuffer[i]) + return false; + + return true; +}; + +// Utility methods + +function encodeTag(tag, primitive, cls, reporter) { + var res; + + if (tag === 'seqof') + tag = 'seq'; + else if (tag === 'setof') + tag = 'set'; + + if (der.tagByName.hasOwnProperty(tag)) + res = der.tagByName[tag]; + else if (typeof tag === 'number' && (tag | 0) === tag) + res = tag; + else + return reporter.error('Unknown tag: ' + tag); + + if (res >= 0x1f) + return reporter.error('Multi-octet tag encoding unsupported'); + + if (!primitive) + res |= 0x20; + + res |= (der.tagClassByName[cls || 'universal'] << 6); + + return res; +} + /***/ }, /* 84 */ /***/ function(module, exports) { - module.exports = Array.isArray || function (arr) { - return Object.prototype.toString.call(arr) == '[object Array]'; - }; +function webpackEmptyContext(req) { + throw new Error("Cannot find module '" + req + "'."); +} +webpackEmptyContext.keys = function() { return []; }; +webpackEmptyContext.resolve = webpackEmptyContext; +module.exports = webpackEmptyContext; +webpackEmptyContext.id = 84; /***/ }, /* 85 */ /***/ function(module, exports, __webpack_require__) { - /* WEBPACK VAR INJECTION */(function(Buffer) {// Copyright Joyent, Inc. and other Node contributors. - // - // Permission is hereby granted, free of charge, to any person obtaining a - // copy of this software and associated documentation files (the - // "Software"), to deal in the Software without restriction, including - // without limitation the rights to use, copy, modify, merge, publish, - // distribute, sublicense, and/or sell copies of the Software, and to permit - // persons to whom the Software is furnished to do so, subject to the - // following conditions: - // - // The above copyright notice and this permission notice shall be included - // in all copies or substantial portions of the Software. - // - // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN - // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE - // USE OR OTHER DEALINGS IN THE SOFTWARE. +/* WEBPACK VAR INJECTION */(function(process, __filename) { +/** + * Module dependencies. + */ - // NOTE: These type checking functions intentionally don't use `instanceof` - // because it is fragile and can be easily faked with `Object.create()`. +var fs = __webpack_require__(10) + , path = __webpack_require__(14) + , join = path.join + , dirname = path.dirname + , exists = fs.existsSync || path.existsSync + , defaults = { + arrow: process.env.NODE_BINDINGS_ARROW || ' → ' + , compiled: process.env.NODE_BINDINGS_COMPILED_DIR || 'compiled' + , platform: process.platform + , arch: process.arch + , version: process.versions.node + , bindings: 'bindings.node' + , try: [ + // node-gyp's linked version in the "build" dir + [ 'module_root', 'build', 'bindings' ] + // node-waf and gyp_addon (a.k.a node-gyp) + , [ 'module_root', 'build', 'Debug', 'bindings' ] + , [ 'module_root', 'build', 'Release', 'bindings' ] + // Debug files, for development (legacy behavior, remove for node v0.9) + , [ 'module_root', 'out', 'Debug', 'bindings' ] + , [ 'module_root', 'Debug', 'bindings' ] + // Release files, but manually compiled (legacy behavior, remove for node v0.9) + , [ 'module_root', 'out', 'Release', 'bindings' ] + , [ 'module_root', 'Release', 'bindings' ] + // Legacy from node-waf, node <= 0.4.x + , [ 'module_root', 'build', 'default', 'bindings' ] + // Production "Release" buildtype binary (meh...) + , [ 'module_root', 'compiled', 'version', 'platform', 'arch', 'bindings' ] + ] + } - function isArray(arg) { - if (Array.isArray) { - return Array.isArray(arg); - } - return objectToString(arg) === '[object Array]'; - } - exports.isArray = isArray; +/** + * The main `bindings()` function loads the compiled bindings for a given module. + * It uses V8's Error API to determine the parent filename that this function is + * being invoked from, which is then used to find the root directory. + */ - function isBoolean(arg) { - return typeof arg === 'boolean'; - } - exports.isBoolean = isBoolean; +function bindings (opts) { - function isNull(arg) { - return arg === null; - } - exports.isNull = isNull; + // Argument surgery + if (typeof opts == 'string') { + opts = { bindings: opts } + } else if (!opts) { + opts = {} + } + opts.__proto__ = defaults - function isNullOrUndefined(arg) { - return arg == null; - } - exports.isNullOrUndefined = isNullOrUndefined; + // Get the module root + if (!opts.module_root) { + opts.module_root = exports.getRoot(exports.getFileName()) + } - function isNumber(arg) { - return typeof arg === 'number'; - } - exports.isNumber = isNumber; + // Ensure the given bindings name ends with .node + if (path.extname(opts.bindings) != '.node') { + opts.bindings += '.node' + } - function isString(arg) { - return typeof arg === 'string'; - } - exports.isString = isString; + var tries = [] + , i = 0 + , l = opts.try.length + , n + , b + , err - function isSymbol(arg) { - return typeof arg === 'symbol'; - } - exports.isSymbol = isSymbol; + for (; i*/ - var objectKeys = Object.keys || function (obj) { - var keys = []; - for (var key in obj) keys.push(key); - return keys; - } - /**/ - - - /**/ - var util = __webpack_require__(85); - util.inherits = __webpack_require__(81); - /**/ - - var Readable = __webpack_require__(83); - var Writable = __webpack_require__(88); - - util.inherits(Duplex, Readable); - - forEach(objectKeys(Writable.prototype), function(method) { - if (!Duplex.prototype[method]) - Duplex.prototype[method] = Writable.prototype[method]; - }); - - function Duplex(options) { - if (!(this instanceof Duplex)) - return new Duplex(options); - - Readable.call(this, options); - Writable.call(this, options); - - if (options && options.readable === false) - this.readable = false; - - if (options && options.writable === false) - this.writable = false; - - this.allowHalfOpen = true; - if (options && options.allowHalfOpen === false) - this.allowHalfOpen = false; - - this.once('end', onend); - } - - // the no-half-open enforcer - function onend() { - // if we allow half-open state, or if the writable side ended, - // then we're ok. - if (this.allowHalfOpen || this._writableState.ended) - return; - - // no more data can be written. - // But allow more writes to happen in this tick. - process.nextTick(this.end.bind(this)); - } - - function forEach (xs, f) { - for (var i = 0, l = xs.length; i < l; i++) { - f(xs[i], i); - } - } - - /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2))) +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer)) /***/ }, /* 88 */ /***/ function(module, exports, __webpack_require__) { - /* WEBPACK VAR INJECTION */(function(process) {// Copyright Joyent, Inc. and other Node contributors. - // - // Permission is hereby granted, free of charge, to any person obtaining a - // copy of this software and associated documentation files (the - // "Software"), to deal in the Software without restriction, including - // without limitation the rights to use, copy, modify, merge, publish, - // distribute, sublicense, and/or sell copies of the Software, and to permit - // persons to whom the Software is furnished to do so, subject to the - // following conditions: - // - // The above copyright notice and this permission notice shall be included - // in all copies or substantial portions of the Software. - // - // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN - // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE - // USE OR OTHER DEALINGS IN THE SOFTWARE. +var xor = __webpack_require__(24) - // A bit simpler than readable streams. - // Implement an async ._write(chunk, cb), and it'll handle all - // the drain event emission and buffering. +exports.encrypt = function (self, block) { + var data = xor(block, self._prev) - module.exports = Writable; + self._prev = self._cipher.encryptBlock(data) + return self._prev +} - /**/ - var Buffer = __webpack_require__(58).Buffer; - /**/ +exports.decrypt = function (self, block) { + var pad = self._prev - Writable.WritableState = WritableState; + self._prev = block + var out = self._cipher.decryptBlock(block) + return xor(out, pad) +} - /**/ - var util = __webpack_require__(85); - util.inherits = __webpack_require__(81); - /**/ - - var Stream = __webpack_require__(80); - - util.inherits(Writable, Stream); - - function WriteReq(chunk, encoding, cb) { - this.chunk = chunk; - this.encoding = encoding; - this.callback = cb; - } - - function WritableState(options, stream) { - var Duplex = __webpack_require__(87); - - options = options || {}; - - // the point at which write() starts returning false - // Note: 0 is a valid value, means that we always return false if - // the entire buffer is not flushed immediately on write() - var hwm = options.highWaterMark; - var defaultHwm = options.objectMode ? 16 : 16 * 1024; - this.highWaterMark = (hwm || hwm === 0) ? hwm : defaultHwm; - - // object stream flag to indicate whether or not this stream - // contains buffers or objects. - this.objectMode = !!options.objectMode; - - if (stream instanceof Duplex) - this.objectMode = this.objectMode || !!options.writableObjectMode; - - // cast to ints. - this.highWaterMark = ~~this.highWaterMark; - - this.needDrain = false; - // at the start of calling end() - this.ending = false; - // when end() has been called, and returned - this.ended = false; - // when 'finish' is emitted - this.finished = false; - - // should we decode strings into buffers before passing to _write? - // this is here so that some node-core streams can optimize string - // handling at a lower level. - var noDecode = options.decodeStrings === false; - this.decodeStrings = !noDecode; - - // Crypto is kind of old and crusty. Historically, its default string - // encoding is 'binary' so we have to make this configurable. - // Everything else in the universe uses 'utf8', though. - this.defaultEncoding = options.defaultEncoding || 'utf8'; - - // not an actual buffer we keep track of, but a measurement - // of how much we're waiting to get pushed to some underlying - // socket or file. - this.length = 0; - - // a flag to see when we're in the middle of a write. - this.writing = false; - - // when true all writes will be buffered until .uncork() call - this.corked = 0; - - // a flag to be able to tell if the onwrite cb is called immediately, - // or on a later tick. We set this to true at first, because any - // actions that shouldn't happen until "later" should generally also - // not happen before the first write call. - this.sync = true; - - // a flag to know if we're processing previously buffered items, which - // may call the _write() callback in the same tick, so that we don't - // end up in an overlapped onwrite situation. - this.bufferProcessing = false; - - // the callback that's passed to _write(chunk,cb) - this.onwrite = function(er) { - onwrite(stream, er); - }; - - // the callback that the user supplies to write(chunk,encoding,cb) - this.writecb = null; - - // the amount that is being written when _write is called. - this.writelen = 0; - - this.buffer = []; - - // number of pending user-supplied write callbacks - // this must be 0 before 'finish' can be emitted - this.pendingcb = 0; - - // emit prefinish if the only thing we're waiting for is _write cbs - // This is relevant for synchronous Transform streams - this.prefinished = false; - - // True if the error was already emitted and should not be thrown again - this.errorEmitted = false; - } - - function Writable(options) { - var Duplex = __webpack_require__(87); - - // Writable ctor is applied to Duplexes, though they're not - // instanceof Writable, they're instanceof Readable. - if (!(this instanceof Writable) && !(this instanceof Duplex)) - return new Writable(options); - - this._writableState = new WritableState(options, this); - - // legacy. - this.writable = true; - - Stream.call(this); - } - - // Otherwise people can pipe Writable streams, which is just wrong. - Writable.prototype.pipe = function() { - this.emit('error', new Error('Cannot pipe. Not readable.')); - }; - - - function writeAfterEnd(stream, state, cb) { - var er = new Error('write after end'); - // TODO: defer error events consistently everywhere, not just the cb - stream.emit('error', er); - process.nextTick(function() { - cb(er); - }); - } - - // If we get something that is not a buffer, string, null, or undefined, - // and we're not in objectMode, then that's an error. - // Otherwise stream chunks are all considered to be of length=1, and the - // watermarks determine how many objects to keep in the buffer, rather than - // how many bytes or characters. - function validChunk(stream, state, chunk, cb) { - var valid = true; - if (!util.isBuffer(chunk) && - !util.isString(chunk) && - !util.isNullOrUndefined(chunk) && - !state.objectMode) { - var er = new TypeError('Invalid non-string/buffer chunk'); - stream.emit('error', er); - process.nextTick(function() { - cb(er); - }); - valid = false; - } - return valid; - } - - Writable.prototype.write = function(chunk, encoding, cb) { - var state = this._writableState; - var ret = false; - - if (util.isFunction(encoding)) { - cb = encoding; - encoding = null; - } - - if (util.isBuffer(chunk)) - encoding = 'buffer'; - else if (!encoding) - encoding = state.defaultEncoding; - - if (!util.isFunction(cb)) - cb = function() {}; - - if (state.ended) - writeAfterEnd(this, state, cb); - else if (validChunk(this, state, chunk, cb)) { - state.pendingcb++; - ret = writeOrBuffer(this, state, chunk, encoding, cb); - } - - return ret; - }; - - Writable.prototype.cork = function() { - var state = this._writableState; - - state.corked++; - }; - - Writable.prototype.uncork = function() { - var state = this._writableState; - - if (state.corked) { - state.corked--; - - if (!state.writing && - !state.corked && - !state.finished && - !state.bufferProcessing && - state.buffer.length) - clearBuffer(this, state); - } - }; - - function decodeChunk(state, chunk, encoding) { - if (!state.objectMode && - state.decodeStrings !== false && - util.isString(chunk)) { - chunk = new Buffer(chunk, encoding); - } - return chunk; - } - - // if we're already writing something, then just put this - // in the queue, and wait our turn. Otherwise, call _write - // If we return false, then we need a drain event, so set that flag. - function writeOrBuffer(stream, state, chunk, encoding, cb) { - chunk = decodeChunk(state, chunk, encoding); - if (util.isBuffer(chunk)) - encoding = 'buffer'; - var len = state.objectMode ? 1 : chunk.length; - - state.length += len; - - var ret = state.length < state.highWaterMark; - // we must ensure that previous needDrain will not be reset to false. - if (!ret) - state.needDrain = true; - - if (state.writing || state.corked) - state.buffer.push(new WriteReq(chunk, encoding, cb)); - else - doWrite(stream, state, false, len, chunk, encoding, cb); - - return ret; - } - - function doWrite(stream, state, writev, len, chunk, encoding, cb) { - state.writelen = len; - state.writecb = cb; - state.writing = true; - state.sync = true; - if (writev) - stream._writev(chunk, state.onwrite); - else - stream._write(chunk, encoding, state.onwrite); - state.sync = false; - } - - function onwriteError(stream, state, sync, er, cb) { - if (sync) - process.nextTick(function() { - state.pendingcb--; - cb(er); - }); - else { - state.pendingcb--; - cb(er); - } - - stream._writableState.errorEmitted = true; - stream.emit('error', er); - } - - function onwriteStateUpdate(state) { - state.writing = false; - state.writecb = null; - state.length -= state.writelen; - state.writelen = 0; - } - - function onwrite(stream, er) { - var state = stream._writableState; - var sync = state.sync; - var cb = state.writecb; - - onwriteStateUpdate(state); - - if (er) - onwriteError(stream, state, sync, er, cb); - else { - // Check if we're actually ready to finish, but don't emit yet - var finished = needFinish(stream, state); - - if (!finished && - !state.corked && - !state.bufferProcessing && - state.buffer.length) { - clearBuffer(stream, state); - } - - if (sync) { - process.nextTick(function() { - afterWrite(stream, state, finished, cb); - }); - } else { - afterWrite(stream, state, finished, cb); - } - } - } - - function afterWrite(stream, state, finished, cb) { - if (!finished) - onwriteDrain(stream, state); - state.pendingcb--; - cb(); - finishMaybe(stream, state); - } - - // Must force callback to be called on nextTick, so that we don't - // emit 'drain' before the write() consumer gets the 'false' return - // value, and has a chance to attach a 'drain' listener. - function onwriteDrain(stream, state) { - if (state.length === 0 && state.needDrain) { - state.needDrain = false; - stream.emit('drain'); - } - } - - - // if there's something in the buffer waiting, then process it - function clearBuffer(stream, state) { - state.bufferProcessing = true; - - if (stream._writev && state.buffer.length > 1) { - // Fast case, write everything using _writev() - var cbs = []; - for (var c = 0; c < state.buffer.length; c++) - cbs.push(state.buffer[c].callback); - - // count the one we are adding, as well. - // TODO(isaacs) clean this up - state.pendingcb++; - doWrite(stream, state, true, state.length, state.buffer, '', function(err) { - for (var i = 0; i < cbs.length; i++) { - state.pendingcb--; - cbs[i](err); - } - }); - - // Clear buffer - state.buffer = []; - } else { - // Slow case, write chunks one-by-one - for (var c = 0; c < state.buffer.length; c++) { - var entry = state.buffer[c]; - var chunk = entry.chunk; - var encoding = entry.encoding; - var cb = entry.callback; - var len = state.objectMode ? 1 : chunk.length; - - doWrite(stream, state, false, len, chunk, encoding, cb); - - // if we didn't call the onwrite immediately, then - // it means that we need to wait until it does. - // also, that means that the chunk and cb are currently - // being processed, so move the buffer counter past them. - if (state.writing) { - c++; - break; - } - } - - if (c < state.buffer.length) - state.buffer = state.buffer.slice(c); - else - state.buffer.length = 0; - } - - state.bufferProcessing = false; - } - - Writable.prototype._write = function(chunk, encoding, cb) { - cb(new Error('not implemented')); - - }; - - Writable.prototype._writev = null; - - Writable.prototype.end = function(chunk, encoding, cb) { - var state = this._writableState; - - if (util.isFunction(chunk)) { - cb = chunk; - chunk = null; - encoding = null; - } else if (util.isFunction(encoding)) { - cb = encoding; - encoding = null; - } - - if (!util.isNullOrUndefined(chunk)) - this.write(chunk, encoding); - - // .end() fully uncorks - if (state.corked) { - state.corked = 1; - this.uncork(); - } - - // ignore unnecessary end() calls. - if (!state.ending && !state.finished) - endWritable(this, state, cb); - }; - - - function needFinish(stream, state) { - return (state.ending && - state.length === 0 && - !state.finished && - !state.writing); - } - - function prefinish(stream, state) { - if (!state.prefinished) { - state.prefinished = true; - stream.emit('prefinish'); - } - } - - function finishMaybe(stream, state) { - var need = needFinish(stream, state); - if (need) { - if (state.pendingcb === 0) { - prefinish(stream, state); - state.finished = true; - stream.emit('finish'); - } else - prefinish(stream, state); - } - return need; - } - - function endWritable(stream, state, cb) { - state.ending = true; - finishMaybe(stream, state); - if (cb) { - if (state.finished) - process.nextTick(cb); - else - stream.once('finish', cb); - } - state.ended = true; - } - - /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2))) /***/ }, /* 89 */ /***/ function(module, exports, __webpack_require__) { - // Copyright Joyent, Inc. and other Node contributors. - // - // Permission is hereby granted, free of charge, to any person obtaining a - // copy of this software and associated documentation files (the - // "Software"), to deal in the Software without restriction, including - // without limitation the rights to use, copy, modify, merge, publish, - // distribute, sublicense, and/or sell copies of the Software, and to permit - // persons to whom the Software is furnished to do so, subject to the - // following conditions: - // - // The above copyright notice and this permission notice shall be included - // in all copies or substantial portions of the Software. - // - // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN - // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE - // USE OR OTHER DEALINGS IN THE SOFTWARE. +/* WEBPACK VAR INJECTION */(function(Buffer) {var xor = __webpack_require__(24) - var Buffer = __webpack_require__(58).Buffer; +exports.encrypt = function (self, data, decrypt) { + var out = new Buffer('') + var len - var isBufferEncoding = Buffer.isEncoding - || function(encoding) { - switch (encoding && encoding.toLowerCase()) { - case 'hex': case 'utf8': case 'utf-8': case 'ascii': case 'binary': case 'base64': case 'ucs2': case 'ucs-2': case 'utf16le': case 'utf-16le': case 'raw': return true; - default: return false; - } - } + while (data.length) { + if (self._cache.length === 0) { + self._cache = self._cipher.encryptBlock(self._prev) + self._prev = new Buffer('') + } + if (self._cache.length <= data.length) { + len = self._cache.length + out = Buffer.concat([out, encryptStart(self, data.slice(0, len), decrypt)]) + data = data.slice(len) + } else { + out = Buffer.concat([out, encryptStart(self, data, decrypt)]) + break + } + } - function assertEncoding(encoding) { - if (encoding && !isBufferEncoding(encoding)) { - throw new Error('Unknown encoding: ' + encoding); - } - } - - // StringDecoder provides an interface for efficiently splitting a series of - // buffers into a series of JS strings without breaking apart multi-byte - // characters. CESU-8 is handled as part of the UTF-8 encoding. - // - // @TODO Handling all encodings inside a single object makes it very difficult - // to reason about this code, so it should be split up in the future. - // @TODO There should be a utf8-strict encoding that rejects invalid UTF-8 code - // points as used by CESU-8. - var StringDecoder = exports.StringDecoder = function(encoding) { - this.encoding = (encoding || 'utf8').toLowerCase().replace(/[-_]/, ''); - assertEncoding(encoding); - switch (this.encoding) { - case 'utf8': - // CESU-8 represents each of Surrogate Pair by 3-bytes - this.surrogateSize = 3; - break; - case 'ucs2': - case 'utf16le': - // UTF-16 represents each of Surrogate Pair by 2-bytes - this.surrogateSize = 2; - this.detectIncompleteChar = utf16DetectIncompleteChar; - break; - case 'base64': - // Base-64 stores 3 bytes in 4 chars, and pads the remainder. - this.surrogateSize = 3; - this.detectIncompleteChar = base64DetectIncompleteChar; - break; - default: - this.write = passThroughWrite; - return; - } - - // Enough space to store all bytes of a single character. UTF-8 needs 4 - // bytes, but CESU-8 may require up to 6 (3 bytes per surrogate). - this.charBuffer = new Buffer(6); - // Number of bytes received for the current incomplete multi-byte character. - this.charReceived = 0; - // Number of bytes expected for the current incomplete multi-byte character. - this.charLength = 0; - }; - - - // write decodes the given buffer and returns it as JS string that is - // guaranteed to not contain any partial multi-byte characters. Any partial - // character found at the end of the buffer is buffered up, and will be - // returned when calling write again with the remaining bytes. - // - // Note: Converting a Buffer containing an orphan surrogate to a String - // currently works, but converting a String to a Buffer (via `new Buffer`, or - // Buffer#write) will replace incomplete surrogates with the unicode - // replacement character. See https://codereview.chromium.org/121173009/ . - StringDecoder.prototype.write = function(buffer) { - var charStr = ''; - // if our last write ended with an incomplete multibyte character - while (this.charLength) { - // determine how many remaining bytes this buffer has to offer for this char - var available = (buffer.length >= this.charLength - this.charReceived) ? - this.charLength - this.charReceived : - buffer.length; - - // add the new bytes to the char buffer - buffer.copy(this.charBuffer, this.charReceived, 0, available); - this.charReceived += available; - - if (this.charReceived < this.charLength) { - // still not enough chars in this buffer? wait for more ... - return ''; - } - - // remove bytes belonging to the current character from the buffer - buffer = buffer.slice(available, buffer.length); - - // get the character that was split - charStr = this.charBuffer.slice(0, this.charLength).toString(this.encoding); - - // CESU-8: lead surrogate (D800-DBFF) is also the incomplete character - var charCode = charStr.charCodeAt(charStr.length - 1); - if (charCode >= 0xD800 && charCode <= 0xDBFF) { - this.charLength += this.surrogateSize; - charStr = ''; - continue; - } - this.charReceived = this.charLength = 0; - - // if there are no more bytes in this buffer, just emit our char - if (buffer.length === 0) { - return charStr; - } - break; - } - - // determine and set charLength / charReceived - this.detectIncompleteChar(buffer); - - var end = buffer.length; - if (this.charLength) { - // buffer the incomplete character bytes we got - buffer.copy(this.charBuffer, 0, buffer.length - this.charReceived, end); - end -= this.charReceived; - } - - charStr += buffer.toString(this.encoding, 0, end); - - var end = charStr.length - 1; - var charCode = charStr.charCodeAt(end); - // CESU-8: lead surrogate (D800-DBFF) is also the incomplete character - if (charCode >= 0xD800 && charCode <= 0xDBFF) { - var size = this.surrogateSize; - this.charLength += size; - this.charReceived += size; - this.charBuffer.copy(this.charBuffer, size, 0, size); - buffer.copy(this.charBuffer, 0, 0, size); - return charStr.substring(0, end); - } - - // or just emit the charStr - return charStr; - }; - - // detectIncompleteChar determines if there is an incomplete UTF-8 character at - // the end of the given buffer. If so, it sets this.charLength to the byte - // length that character, and sets this.charReceived to the number of bytes - // that are available for this character. - StringDecoder.prototype.detectIncompleteChar = function(buffer) { - // determine how many bytes we have to check at the end of this buffer - var i = (buffer.length >= 3) ? 3 : buffer.length; - - // Figure out if one of the last i bytes of our buffer announces an - // incomplete char. - for (; i > 0; i--) { - var c = buffer[buffer.length - i]; - - // See http://en.wikipedia.org/wiki/UTF-8#Description - - // 110XXXXX - if (i == 1 && c >> 5 == 0x06) { - this.charLength = 2; - break; - } - - // 1110XXXX - if (i <= 2 && c >> 4 == 0x0E) { - this.charLength = 3; - break; - } - - // 11110XXX - if (i <= 3 && c >> 3 == 0x1E) { - this.charLength = 4; - break; - } - } - this.charReceived = i; - }; - - StringDecoder.prototype.end = function(buffer) { - var res = ''; - if (buffer && buffer.length) - res = this.write(buffer); - - if (this.charReceived) { - var cr = this.charReceived; - var buf = this.charBuffer; - var enc = this.encoding; - res += buf.slice(0, cr).toString(enc); - } - - return res; - }; - - function passThroughWrite(buffer) { - return buffer.toString(this.encoding); - } - - function utf16DetectIncompleteChar(buffer) { - this.charReceived = buffer.length % 2; - this.charLength = this.charReceived ? 2 : 0; - } - - function base64DetectIncompleteChar(buffer) { - this.charReceived = buffer.length % 3; - this.charLength = this.charReceived ? 3 : 0; - } + return out +} +function encryptStart (self, data, decrypt) { + var len = data.length + var out = xor(data, self._cache) + self._cache = self._cache.slice(len) + self._prev = Buffer.concat([self._prev, decrypt ? data : out]) + return out +} +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer)) /***/ }, /* 90 */ /***/ function(module, exports, __webpack_require__) { - // Copyright Joyent, Inc. and other Node contributors. - // - // Permission is hereby granted, free of charge, to any person obtaining a - // copy of this software and associated documentation files (the - // "Software"), to deal in the Software without restriction, including - // without limitation the rights to use, copy, modify, merge, publish, - // distribute, sublicense, and/or sell copies of the Software, and to permit - // persons to whom the Software is furnished to do so, subject to the - // following conditions: - // - // The above copyright notice and this permission notice shall be included - // in all copies or substantial portions of the Software. - // - // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN - // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE - // USE OR OTHER DEALINGS IN THE SOFTWARE. - - - // a transform stream is a readable/writable stream where you do - // something with the data. Sometimes it's called a "filter", - // but that's not a great name for it, since that implies a thing where - // some bits pass through, and others are simply ignored. (That would - // be a valid example of a transform, of course.) - // - // While the output is causally related to the input, it's not a - // necessarily symmetric or synchronous transformation. For example, - // a zlib stream might take multiple plain-text writes(), and then - // emit a single compressed chunk some time in the future. - // - // Here's how this works: - // - // The Transform stream has all the aspects of the readable and writable - // stream classes. When you write(chunk), that calls _write(chunk,cb) - // internally, and returns false if there's a lot of pending writes - // buffered up. When you call read(), that calls _read(n) until - // there's enough pending readable data buffered up. - // - // In a transform stream, the written data is placed in a buffer. When - // _read(n) is called, it transforms the queued up data, calling the - // buffered _write cb's as it consumes chunks. If consuming a single - // written chunk would result in multiple output chunks, then the first - // outputted bit calls the readcb, and subsequent chunks just go into - // the read buffer, and will cause it to emit 'readable' if necessary. - // - // This way, back-pressure is actually determined by the reading side, - // since _read has to be called to start processing a new chunk. However, - // a pathological inflate type of transform can cause excessive buffering - // here. For example, imagine a stream where every byte of input is - // interpreted as an integer from 0-255, and then results in that many - // bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in - // 1kb of data being output. In this case, you could write a very small - // amount of input, and end up with a very large amount of output. In - // such a pathological inflating mechanism, there'd be no way to tell - // the system to stop doing the transform. A single 4MB write could - // cause the system to run out of memory. - // - // However, even in such a pathological case, only a single written chunk - // would be consumed, and then the rest would wait (un-transformed) until - // the results of the previous transformed chunk were consumed. - - module.exports = Transform; - - var Duplex = __webpack_require__(87); - - /**/ - var util = __webpack_require__(85); - util.inherits = __webpack_require__(81); - /**/ - - util.inherits(Transform, Duplex); - - - function TransformState(options, stream) { - this.afterTransform = function(er, data) { - return afterTransform(stream, er, data); - }; - - this.needTransform = false; - this.transforming = false; - this.writecb = null; - this.writechunk = null; - } - - function afterTransform(stream, er, data) { - var ts = stream._transformState; - ts.transforming = false; - - var cb = ts.writecb; - - if (!cb) - return stream.emit('error', new Error('no writecb in Transform class')); - - ts.writechunk = null; - ts.writecb = null; - - if (!util.isNullOrUndefined(data)) - stream.push(data); - - if (cb) - cb(er); - - var rs = stream._readableState; - rs.reading = false; - if (rs.needReadable || rs.length < rs.highWaterMark) { - stream._read(rs.highWaterMark); - } - } - - - function Transform(options) { - if (!(this instanceof Transform)) - return new Transform(options); - - Duplex.call(this, options); - - this._transformState = new TransformState(options, this); - - // when the writable side finishes, then flush out anything remaining. - var stream = this; - - // start out asking for a readable event once data is transformed. - this._readableState.needReadable = true; - - // we have implemented the _read method, and done the other things - // that Readable wants before the first _read call, so unset the - // sync guard flag. - this._readableState.sync = false; - - this.once('prefinish', function() { - if (util.isFunction(this._flush)) - this._flush(function(er) { - done(stream, er); - }); - else - done(stream); - }); - } - - Transform.prototype.push = function(chunk, encoding) { - this._transformState.needTransform = false; - return Duplex.prototype.push.call(this, chunk, encoding); - }; - - // This is the part where you do stuff! - // override this function in implementation classes. - // 'chunk' is an input chunk. - // - // Call `push(newChunk)` to pass along transformed output - // to the readable side. You may call 'push' zero or more times. - // - // Call `cb(err)` when you are done with this chunk. If you pass - // an error, then that'll put the hurt on the whole operation. If you - // never call cb(), then you'll never get another chunk. - Transform.prototype._transform = function(chunk, encoding, cb) { - throw new Error('not implemented'); - }; - - Transform.prototype._write = function(chunk, encoding, cb) { - var ts = this._transformState; - ts.writecb = cb; - ts.writechunk = chunk; - ts.writeencoding = encoding; - if (!ts.transforming) { - var rs = this._readableState; - if (ts.needTransform || - rs.needReadable || - rs.length < rs.highWaterMark) - this._read(rs.highWaterMark); - } - }; - - // Doesn't matter what the args are here. - // _transform does all the work. - // That we got here means that the readable side wants more data. - Transform.prototype._read = function(n) { - var ts = this._transformState; - - if (!util.isNull(ts.writechunk) && ts.writecb && !ts.transforming) { - ts.transforming = true; - this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform); - } else { - // mark that we need a transform, so that any data that comes in - // will get processed, now that we've asked for it. - ts.needTransform = true; - } - }; - - - function done(stream, er) { - if (er) - return stream.emit('error', er); - - // if there's nothing in the write buffer, then that means - // that nothing more will ever be provided - var ws = stream._writableState; - var ts = stream._transformState; - - if (ws.length) - throw new Error('calling transform done when ws.length != 0'); - - if (ts.transforming) - throw new Error('calling transform done when still transforming'); - - return stream.push(null); - } +/* WEBPACK VAR INJECTION */(function(Buffer) {function encryptByte (self, byteParam, decrypt) { + var pad + var i = -1 + var len = 8 + var out = 0 + var bit, value + while (++i < len) { + pad = self._cipher.encryptBlock(self._prev) + bit = (byteParam & (1 << (7 - i))) ? 0x80 : 0 + value = pad[0] ^ bit + out += ((value & 0x80) >> (i % 8)) + self._prev = shiftIn(self._prev, decrypt ? bit : value) + } + return out +} +exports.encrypt = function (self, chunk, decrypt) { + var len = chunk.length + var out = new Buffer(len) + var i = -1 + while (++i < len) { + out[i] = encryptByte(self, chunk[i], decrypt) + } + return out +} +function shiftIn (buffer, value) { + var len = buffer.length + var i = -1 + var out = new Buffer(buffer.length) + buffer = Buffer.concat([buffer, new Buffer([value])]) + while (++i < len) { + out[i] = buffer[i] << 1 | buffer[i + 1] >> (7) + } + return out +} +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer)) /***/ }, /* 91 */ /***/ function(module, exports, __webpack_require__) { - // Copyright Joyent, Inc. and other Node contributors. - // - // Permission is hereby granted, free of charge, to any person obtaining a - // copy of this software and associated documentation files (the - // "Software"), to deal in the Software without restriction, including - // without limitation the rights to use, copy, modify, merge, publish, - // distribute, sublicense, and/or sell copies of the Software, and to permit - // persons to whom the Software is furnished to do so, subject to the - // following conditions: - // - // The above copyright notice and this permission notice shall be included - // in all copies or substantial portions of the Software. - // - // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN - // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE - // USE OR OTHER DEALINGS IN THE SOFTWARE. - - // a passthrough stream. - // basically just the most minimal sort of Transform stream. - // Every written chunk gets output as-is. - - module.exports = PassThrough; - - var Transform = __webpack_require__(90); - - /**/ - var util = __webpack_require__(85); - util.inherits = __webpack_require__(81); - /**/ - - util.inherits(PassThrough, Transform); - - function PassThrough(options) { - if (!(this instanceof PassThrough)) - return new PassThrough(options); - - Transform.call(this, options); - } - - PassThrough.prototype._transform = function(chunk, encoding, cb) { - cb(null, chunk); - }; +/* WEBPACK VAR INJECTION */(function(Buffer) {function encryptByte (self, byteParam, decrypt) { + var pad = self._cipher.encryptBlock(self._prev) + var out = pad[0] ^ byteParam + self._prev = Buffer.concat([self._prev.slice(1), new Buffer([decrypt ? byteParam : out])]) + return out +} +exports.encrypt = function (self, chunk, decrypt) { + var len = chunk.length + var out = new Buffer(len) + var i = -1 + while (++i < len) { + out[i] = encryptByte(self, chunk[i], decrypt) + } + return out +} +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer)) /***/ }, /* 92 */ -/***/ function(module, exports, __webpack_require__) { +/***/ function(module, exports) { - module.exports = __webpack_require__(88) +exports.encrypt = function (self, block) { + return self._cipher.encryptBlock(block) +} +exports.decrypt = function (self, block) { + return self._cipher.decryptBlock(block) +} /***/ }, /* 93 */ /***/ function(module, exports, __webpack_require__) { - module.exports = __webpack_require__(87) +/* WEBPACK VAR INJECTION */(function(Buffer) {var xor = __webpack_require__(24) +function getBlock (self) { + self._prev = self._cipher.encryptBlock(self._prev) + return self._prev +} + +exports.encrypt = function (self, chunk) { + while (self._cache.length < chunk.length) { + self._cache = Buffer.concat([self._cache, getBlock(self)]) + } + + var pad = self._cache.slice(0, chunk.length) + self._cache = self._cache.slice(chunk.length) + return xor(chunk, pad) +} + +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer)) /***/ }, /* 94 */ /***/ function(module, exports, __webpack_require__) { - module.exports = __webpack_require__(90) +/* WEBPACK VAR INJECTION */(function(Buffer) {var aes = __webpack_require__(33) +var Transform = __webpack_require__(17) +var inherits = __webpack_require__(1) +inherits(StreamCipher, Transform) +module.exports = StreamCipher +function StreamCipher (mode, key, iv, decrypt) { + if (!(this instanceof StreamCipher)) { + return new StreamCipher(mode, key, iv) + } + Transform.call(this) + this._cipher = new aes.AES(key) + this._prev = new Buffer(iv.length) + this._cache = new Buffer('') + this._secCache = new Buffer('') + this._decrypt = decrypt + iv.copy(this._prev) + this._mode = mode +} +StreamCipher.prototype._update = function (chunk) { + return this._mode.encrypt(this, chunk, this._decrypt) +} +StreamCipher.prototype._final = function () { + this._cipher.scrub() +} + +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer)) /***/ }, /* 95 */ /***/ function(module, exports, __webpack_require__) { - module.exports = __webpack_require__(91) +"use strict"; +/* WEBPACK VAR INJECTION */(function(Buffer) {'use strict' +exports['RSA-SHA224'] = exports.sha224WithRSAEncryption = { + sign: 'rsa', + hash: 'sha224', + id: new Buffer('302d300d06096086480165030402040500041c', 'hex') +} +exports['RSA-SHA256'] = exports.sha256WithRSAEncryption = { + sign: 'rsa', + hash: 'sha256', + id: new Buffer('3031300d060960864801650304020105000420', 'hex') +} +exports['RSA-SHA384'] = exports.sha384WithRSAEncryption = { + sign: 'rsa', + hash: 'sha384', + id: new Buffer('3041300d060960864801650304020205000430', 'hex') +} +exports['RSA-SHA512'] = exports.sha512WithRSAEncryption = { + sign: 'rsa', + hash: 'sha512', + id: new Buffer('3051300d060960864801650304020305000440', 'hex') +} +exports['RSA-SHA1'] = { + sign: 'rsa', + hash: 'sha1', + id: new Buffer('3021300906052b0e03021a05000414', 'hex') +} +exports['ecdsa-with-SHA1'] = { + sign: 'ecdsa', + hash: 'sha1', + id: new Buffer('', 'hex') +} +exports.DSA = exports['DSA-SHA1'] = exports['DSA-SHA'] = { + sign: 'dsa', + hash: 'sha1', + id: new Buffer('', 'hex') +} +exports['DSA-SHA224'] = exports['DSA-WITH-SHA224'] = { + sign: 'dsa', + hash: 'sha224', + id: new Buffer('', 'hex') +} +exports['DSA-SHA256'] = exports['DSA-WITH-SHA256'] = { + sign: 'dsa', + hash: 'sha256', + id: new Buffer('', 'hex') +} +exports['DSA-SHA384'] = exports['DSA-WITH-SHA384'] = { + sign: 'dsa', + hash: 'sha384', + id: new Buffer('', 'hex') +} +exports['DSA-SHA512'] = exports['DSA-WITH-SHA512'] = { + sign: 'dsa', + hash: 'sha512', + id: new Buffer('', 'hex') +} +exports['DSA-RIPEMD160'] = { + sign: 'dsa', + hash: 'rmd160', + id: new Buffer('', 'hex') +} +exports['RSA-RIPEMD160'] = exports.ripemd160WithRSA = { + sign: 'rsa', + hash: 'rmd160', + id: new Buffer('3021300906052b2403020105000414', 'hex') +} +exports['RSA-MD5'] = exports.md5WithRSAEncryption = { + sign: 'rsa', + hash: 'md5', + id: new Buffer('3020300c06082a864886f70d020505000410', 'hex') +} + +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer)) /***/ }, /* 96 */ -/***/ function(module, exports, __webpack_require__) { +/***/ function(module, exports) { - var Stream = __webpack_require__(80); - var util = __webpack_require__(75); +"use strict"; +'use strict' +exports['1.3.132.0.10'] = 'secp256k1' - var Response = module.exports = function (res) { - this.offset = 0; - this.readable = true; - }; +exports['1.3.132.0.33'] = 'p224' - util.inherits(Response, Stream); +exports['1.2.840.10045.3.1.1'] = 'p192' - var capable = { - streaming : true, - status2 : true - }; +exports['1.2.840.10045.3.1.7'] = 'p256' - function parseHeaders (res) { - var lines = res.getAllResponseHeaders().split(/\r?\n/); - var headers = {}; - for (var i = 0; i < lines.length; i++) { - var line = lines[i]; - if (line === '') continue; - - var m = line.match(/^([^:]+):\s*(.*)/); - if (m) { - var key = m[1].toLowerCase(), value = m[2]; - - if (headers[key] !== undefined) { - - if (isArray(headers[key])) { - headers[key].push(value); - } - else { - headers[key] = [ headers[key], value ]; - } - } - else { - headers[key] = value; - } - } - else { - headers[line] = true; - } - } - return headers; - } +exports['1.3.132.0.34'] = 'p384' - Response.prototype.getResponse = function (xhr) { - var respType = String(xhr.responseType).toLowerCase(); - if (respType === 'blob') return xhr.responseBlob || xhr.response; - if (respType === 'arraybuffer') return xhr.response; - return xhr.responseText; - } - - Response.prototype.getHeader = function (key) { - return this.headers[key.toLowerCase()]; - }; - - Response.prototype.handle = function (res) { - if (res.readyState === 2 && capable.status2) { - try { - this.statusCode = res.status; - this.headers = parseHeaders(res); - } - catch (err) { - capable.status2 = false; - } - - if (capable.status2) { - this.emit('ready'); - } - } - else if (capable.streaming && res.readyState === 3) { - try { - if (!this.statusCode) { - this.statusCode = res.status; - this.headers = parseHeaders(res); - this.emit('ready'); - } - } - catch (err) {} - - try { - this._emitData(res); - } - catch (err) { - capable.streaming = false; - } - } - else if (res.readyState === 4) { - if (!this.statusCode) { - this.statusCode = res.status; - this.emit('ready'); - } - this._emitData(res); - - if (res.error) { - this.emit('error', this.getResponse(res)); - } - else this.emit('end'); - - this.emit('close'); - } - }; - - Response.prototype._emitData = function (res) { - var respBody = this.getResponse(res); - if (respBody.toString().match(/ArrayBuffer/)) { - this.emit('data', new Uint8Array(respBody, this.offset)); - this.offset = respBody.byteLength; - return; - } - if (respBody.length > this.offset) { - this.emit('data', respBody.slice(this.offset)); - this.offset = respBody.length; - } - }; - - var isArray = Array.isArray || function (xs) { - return Object.prototype.toString.call(xs) === '[object Array]'; - }; +exports['1.3.132.0.35'] = 'p521' /***/ }, /* 97 */ /***/ function(module, exports, __webpack_require__) { - ;(function () { +/* WEBPACK VAR INJECTION */(function(Buffer, process) {// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. - var object = true ? exports : this; // #8: web workers - var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='; +var Transform = __webpack_require__(114); - function InvalidCharacterError(message) { - this.message = message; - } - InvalidCharacterError.prototype = new Error; - InvalidCharacterError.prototype.name = 'InvalidCharacterError'; +var binding = __webpack_require__(158); +var util = __webpack_require__(8); +var assert = __webpack_require__(147).ok; - // encoder - // [https://gist.github.com/999166] by [https://github.com/nignag] - object.btoa || ( - object.btoa = function (input) { - for ( - // initialize result and counter - var block, charCode, idx = 0, map = chars, output = ''; - // if the next input index does not exist: - // change the mapping table to "=" - // check if d has no fractional digits - input.charAt(idx | 0) || (map = '=', idx % 1); - // "8 - idx % 1 * 8" generates the sequence 2, 4, 6, 8 - output += map.charAt(63 & block >> 8 - idx % 1 * 8) - ) { - charCode = input.charCodeAt(idx += 3/4); - if (charCode > 0xFF) { - throw new InvalidCharacterError("'btoa' failed: The string to be encoded contains characters outside of the Latin1 range."); - } - block = block << 8 | charCode; - } - return output; - }); +// zlib doesn't provide these, so kludge them in following the same +// const naming scheme zlib uses. +binding.Z_MIN_WINDOWBITS = 8; +binding.Z_MAX_WINDOWBITS = 15; +binding.Z_DEFAULT_WINDOWBITS = 15; - // decoder - // [https://gist.github.com/1020396] by [https://github.com/atk] - object.atob || ( - object.atob = function (input) { - input = input.replace(/=+$/, ''); - if (input.length % 4 == 1) { - throw new InvalidCharacterError("'atob' failed: The string to be decoded is not correctly encoded."); - } - for ( - // initialize result and counters - var bc = 0, bs, buffer, idx = 0, output = ''; - // get next character - buffer = input.charAt(idx++); - // character found in table? initialize bit storage and add its ascii value; - ~buffer && (bs = bc % 4 ? bs * 64 + buffer : buffer, - // and if not first of each 4 characters, - // convert the first 8 bits to one ascii character - bc++ % 4) ? output += String.fromCharCode(255 & bs >> (-2 * bc & 6)) : 0 - ) { - // try to find character in table (0-63, not found => -1) - buffer = chars.indexOf(buffer); - } - return output; - }); +// fewer than 64 bytes per chunk is stupid. +// technically it could work with as few as 8, but even 64 bytes +// is absurdly low. Usually a MB or more is best. +binding.Z_MIN_CHUNK = 64; +binding.Z_MAX_CHUNK = Infinity; +binding.Z_DEFAULT_CHUNK = (16 * 1024); - }()); +binding.Z_MIN_MEMLEVEL = 1; +binding.Z_MAX_MEMLEVEL = 9; +binding.Z_DEFAULT_MEMLEVEL = 8; +binding.Z_MIN_LEVEL = -1; +binding.Z_MAX_LEVEL = 9; +binding.Z_DEFAULT_LEVEL = binding.Z_DEFAULT_COMPRESSION; + +// expose all the zlib constants +Object.keys(binding).forEach(function(k) { + if (k.match(/^Z/)) exports[k] = binding[k]; +}); + +// translation table for return codes. +exports.codes = { + Z_OK: binding.Z_OK, + Z_STREAM_END: binding.Z_STREAM_END, + Z_NEED_DICT: binding.Z_NEED_DICT, + Z_ERRNO: binding.Z_ERRNO, + Z_STREAM_ERROR: binding.Z_STREAM_ERROR, + Z_DATA_ERROR: binding.Z_DATA_ERROR, + Z_MEM_ERROR: binding.Z_MEM_ERROR, + Z_BUF_ERROR: binding.Z_BUF_ERROR, + Z_VERSION_ERROR: binding.Z_VERSION_ERROR +}; + +Object.keys(exports.codes).forEach(function(k) { + exports.codes[exports.codes[k]] = k; +}); + +exports.Deflate = Deflate; +exports.Inflate = Inflate; +exports.Gzip = Gzip; +exports.Gunzip = Gunzip; +exports.DeflateRaw = DeflateRaw; +exports.InflateRaw = InflateRaw; +exports.Unzip = Unzip; + +exports.createDeflate = function(o) { + return new Deflate(o); +}; + +exports.createInflate = function(o) { + return new Inflate(o); +}; + +exports.createDeflateRaw = function(o) { + return new DeflateRaw(o); +}; + +exports.createInflateRaw = function(o) { + return new InflateRaw(o); +}; + +exports.createGzip = function(o) { + return new Gzip(o); +}; + +exports.createGunzip = function(o) { + return new Gunzip(o); +}; + +exports.createUnzip = function(o) { + return new Unzip(o); +}; + + +// Convenience methods. +// compress/decompress a string or buffer in one step. +exports.deflate = function(buffer, opts, callback) { + if (typeof opts === 'function') { + callback = opts; + opts = {}; + } + return zlibBuffer(new Deflate(opts), buffer, callback); +}; + +exports.deflateSync = function(buffer, opts) { + return zlibBufferSync(new Deflate(opts), buffer); +}; + +exports.gzip = function(buffer, opts, callback) { + if (typeof opts === 'function') { + callback = opts; + opts = {}; + } + return zlibBuffer(new Gzip(opts), buffer, callback); +}; + +exports.gzipSync = function(buffer, opts) { + return zlibBufferSync(new Gzip(opts), buffer); +}; + +exports.deflateRaw = function(buffer, opts, callback) { + if (typeof opts === 'function') { + callback = opts; + opts = {}; + } + return zlibBuffer(new DeflateRaw(opts), buffer, callback); +}; + +exports.deflateRawSync = function(buffer, opts) { + return zlibBufferSync(new DeflateRaw(opts), buffer); +}; + +exports.unzip = function(buffer, opts, callback) { + if (typeof opts === 'function') { + callback = opts; + opts = {}; + } + return zlibBuffer(new Unzip(opts), buffer, callback); +}; + +exports.unzipSync = function(buffer, opts) { + return zlibBufferSync(new Unzip(opts), buffer); +}; + +exports.inflate = function(buffer, opts, callback) { + if (typeof opts === 'function') { + callback = opts; + opts = {}; + } + return zlibBuffer(new Inflate(opts), buffer, callback); +}; + +exports.inflateSync = function(buffer, opts) { + return zlibBufferSync(new Inflate(opts), buffer); +}; + +exports.gunzip = function(buffer, opts, callback) { + if (typeof opts === 'function') { + callback = opts; + opts = {}; + } + return zlibBuffer(new Gunzip(opts), buffer, callback); +}; + +exports.gunzipSync = function(buffer, opts) { + return zlibBufferSync(new Gunzip(opts), buffer); +}; + +exports.inflateRaw = function(buffer, opts, callback) { + if (typeof opts === 'function') { + callback = opts; + opts = {}; + } + return zlibBuffer(new InflateRaw(opts), buffer, callback); +}; + +exports.inflateRawSync = function(buffer, opts) { + return zlibBufferSync(new InflateRaw(opts), buffer); +}; + +function zlibBuffer(engine, buffer, callback) { + var buffers = []; + var nread = 0; + + engine.on('error', onError); + engine.on('end', onEnd); + + engine.end(buffer); + flow(); + + function flow() { + var chunk; + while (null !== (chunk = engine.read())) { + buffers.push(chunk); + nread += chunk.length; + } + engine.once('readable', flow); + } + + function onError(err) { + engine.removeListener('end', onEnd); + engine.removeListener('readable', flow); + callback(err); + } + + function onEnd() { + var buf = Buffer.concat(buffers, nread); + buffers = []; + callback(null, buf); + engine.close(); + } +} + +function zlibBufferSync(engine, buffer) { + if (typeof buffer === 'string') + buffer = new Buffer(buffer); + if (!Buffer.isBuffer(buffer)) + throw new TypeError('Not a string or buffer'); + + var flushFlag = binding.Z_FINISH; + + return engine._processChunk(buffer, flushFlag); +} + +// generic zlib +// minimal 2-byte header +function Deflate(opts) { + if (!(this instanceof Deflate)) return new Deflate(opts); + Zlib.call(this, opts, binding.DEFLATE); +} + +function Inflate(opts) { + if (!(this instanceof Inflate)) return new Inflate(opts); + Zlib.call(this, opts, binding.INFLATE); +} + + + +// gzip - bigger header, same deflate compression +function Gzip(opts) { + if (!(this instanceof Gzip)) return new Gzip(opts); + Zlib.call(this, opts, binding.GZIP); +} + +function Gunzip(opts) { + if (!(this instanceof Gunzip)) return new Gunzip(opts); + Zlib.call(this, opts, binding.GUNZIP); +} + + + +// raw - no header +function DeflateRaw(opts) { + if (!(this instanceof DeflateRaw)) return new DeflateRaw(opts); + Zlib.call(this, opts, binding.DEFLATERAW); +} + +function InflateRaw(opts) { + if (!(this instanceof InflateRaw)) return new InflateRaw(opts); + Zlib.call(this, opts, binding.INFLATERAW); +} + + +// auto-detect header. +function Unzip(opts) { + if (!(this instanceof Unzip)) return new Unzip(opts); + Zlib.call(this, opts, binding.UNZIP); +} + + +// the Zlib class they all inherit from +// This thing manages the queue of requests, and returns +// true or false if there is anything in the queue when +// you call the .write() method. + +function Zlib(opts, mode) { + this._opts = opts = opts || {}; + this._chunkSize = opts.chunkSize || exports.Z_DEFAULT_CHUNK; + + Transform.call(this, opts); + + if (opts.flush) { + if (opts.flush !== binding.Z_NO_FLUSH && + opts.flush !== binding.Z_PARTIAL_FLUSH && + opts.flush !== binding.Z_SYNC_FLUSH && + opts.flush !== binding.Z_FULL_FLUSH && + opts.flush !== binding.Z_FINISH && + opts.flush !== binding.Z_BLOCK) { + throw new Error('Invalid flush flag: ' + opts.flush); + } + } + this._flushFlag = opts.flush || binding.Z_NO_FLUSH; + + if (opts.chunkSize) { + if (opts.chunkSize < exports.Z_MIN_CHUNK || + opts.chunkSize > exports.Z_MAX_CHUNK) { + throw new Error('Invalid chunk size: ' + opts.chunkSize); + } + } + + if (opts.windowBits) { + if (opts.windowBits < exports.Z_MIN_WINDOWBITS || + opts.windowBits > exports.Z_MAX_WINDOWBITS) { + throw new Error('Invalid windowBits: ' + opts.windowBits); + } + } + + if (opts.level) { + if (opts.level < exports.Z_MIN_LEVEL || + opts.level > exports.Z_MAX_LEVEL) { + throw new Error('Invalid compression level: ' + opts.level); + } + } + + if (opts.memLevel) { + if (opts.memLevel < exports.Z_MIN_MEMLEVEL || + opts.memLevel > exports.Z_MAX_MEMLEVEL) { + throw new Error('Invalid memLevel: ' + opts.memLevel); + } + } + + if (opts.strategy) { + if (opts.strategy != exports.Z_FILTERED && + opts.strategy != exports.Z_HUFFMAN_ONLY && + opts.strategy != exports.Z_RLE && + opts.strategy != exports.Z_FIXED && + opts.strategy != exports.Z_DEFAULT_STRATEGY) { + throw new Error('Invalid strategy: ' + opts.strategy); + } + } + + if (opts.dictionary) { + if (!Buffer.isBuffer(opts.dictionary)) { + throw new Error('Invalid dictionary: it should be a Buffer instance'); + } + } + + this._binding = new binding.Zlib(mode); + + var self = this; + this._hadError = false; + this._binding.onerror = function(message, errno) { + // there is no way to cleanly recover. + // continuing only obscures problems. + self._binding = null; + self._hadError = true; + + var error = new Error(message); + error.errno = errno; + error.code = exports.codes[errno]; + self.emit('error', error); + }; + + var level = exports.Z_DEFAULT_COMPRESSION; + if (typeof opts.level === 'number') level = opts.level; + + var strategy = exports.Z_DEFAULT_STRATEGY; + if (typeof opts.strategy === 'number') strategy = opts.strategy; + + this._binding.init(opts.windowBits || exports.Z_DEFAULT_WINDOWBITS, + level, + opts.memLevel || exports.Z_DEFAULT_MEMLEVEL, + strategy, + opts.dictionary); + + this._buffer = new Buffer(this._chunkSize); + this._offset = 0; + this._closed = false; + this._level = level; + this._strategy = strategy; + + this.once('end', this.close); +} + +util.inherits(Zlib, Transform); + +Zlib.prototype.params = function(level, strategy, callback) { + if (level < exports.Z_MIN_LEVEL || + level > exports.Z_MAX_LEVEL) { + throw new RangeError('Invalid compression level: ' + level); + } + if (strategy != exports.Z_FILTERED && + strategy != exports.Z_HUFFMAN_ONLY && + strategy != exports.Z_RLE && + strategy != exports.Z_FIXED && + strategy != exports.Z_DEFAULT_STRATEGY) { + throw new TypeError('Invalid strategy: ' + strategy); + } + + if (this._level !== level || this._strategy !== strategy) { + var self = this; + this.flush(binding.Z_SYNC_FLUSH, function() { + self._binding.params(level, strategy); + if (!self._hadError) { + self._level = level; + self._strategy = strategy; + if (callback) callback(); + } + }); + } else { + process.nextTick(callback); + } +}; + +Zlib.prototype.reset = function() { + return this._binding.reset(); +}; + +// This is the _flush function called by the transform class, +// internally, when the last chunk has been written. +Zlib.prototype._flush = function(callback) { + this._transform(new Buffer(0), '', callback); +}; + +Zlib.prototype.flush = function(kind, callback) { + var ws = this._writableState; + + if (typeof kind === 'function' || (kind === void 0 && !callback)) { + callback = kind; + kind = binding.Z_FULL_FLUSH; + } + + if (ws.ended) { + if (callback) + process.nextTick(callback); + } else if (ws.ending) { + if (callback) + this.once('end', callback); + } else if (ws.needDrain) { + var self = this; + this.once('drain', function() { + self.flush(callback); + }); + } else { + this._flushFlag = kind; + this.write(new Buffer(0), '', callback); + } +}; + +Zlib.prototype.close = function(callback) { + if (callback) + process.nextTick(callback); + + if (this._closed) + return; + + this._closed = true; + + this._binding.close(); + + var self = this; + process.nextTick(function() { + self.emit('close'); + }); +}; + +Zlib.prototype._transform = function(chunk, encoding, cb) { + var flushFlag; + var ws = this._writableState; + var ending = ws.ending || ws.ended; + var last = ending && (!chunk || ws.length === chunk.length); + + if (!chunk === null && !Buffer.isBuffer(chunk)) + return cb(new Error('invalid input')); + + // If it's the last chunk, or a final flush, we use the Z_FINISH flush flag. + // If it's explicitly flushing at some other time, then we use + // Z_FULL_FLUSH. Otherwise, use Z_NO_FLUSH for maximum compression + // goodness. + if (last) + flushFlag = binding.Z_FINISH; + else { + flushFlag = this._flushFlag; + // once we've flushed the last of the queue, stop flushing and + // go back to the normal behavior. + if (chunk.length >= ws.length) { + this._flushFlag = this._opts.flush || binding.Z_NO_FLUSH; + } + } + + var self = this; + this._processChunk(chunk, flushFlag, cb); +}; + +Zlib.prototype._processChunk = function(chunk, flushFlag, cb) { + var availInBefore = chunk && chunk.length; + var availOutBefore = this._chunkSize - this._offset; + var inOff = 0; + + var self = this; + + var async = typeof cb === 'function'; + + if (!async) { + var buffers = []; + var nread = 0; + + var error; + this.on('error', function(er) { + error = er; + }); + + do { + var res = this._binding.writeSync(flushFlag, + chunk, // in + inOff, // in_off + availInBefore, // in_len + this._buffer, // out + this._offset, //out_off + availOutBefore); // out_len + } while (!this._hadError && callback(res[0], res[1])); + + if (this._hadError) { + throw error; + } + + var buf = Buffer.concat(buffers, nread); + this.close(); + + return buf; + } + + var req = this._binding.write(flushFlag, + chunk, // in + inOff, // in_off + availInBefore, // in_len + this._buffer, // out + this._offset, //out_off + availOutBefore); // out_len + + req.buffer = chunk; + req.callback = callback; + + function callback(availInAfter, availOutAfter) { + if (self._hadError) + return; + + var have = availOutBefore - availOutAfter; + assert(have >= 0, 'have should not go down'); + + if (have > 0) { + var out = self._buffer.slice(self._offset, self._offset + have); + self._offset += have; + // serve some output to the consumer. + if (async) { + self.push(out); + } else { + buffers.push(out); + nread += out.length; + } + } + + // exhausted the output buffer, or used all the input create a new one. + if (availOutAfter === 0 || self._offset >= self._chunkSize) { + availOutBefore = self._chunkSize; + self._offset = 0; + self._buffer = new Buffer(self._chunkSize); + } + + if (availOutAfter === 0) { + // Not actually done. Need to reprocess. + // Also, update the availInBefore to the availInAfter value, + // so that if we have to hit it a third (fourth, etc.) time, + // it'll have the correct byte counts. + inOff += (availInBefore - availInAfter); + availInBefore = availInAfter; + + if (!async) + return true; + + var newReq = self._binding.write(flushFlag, + chunk, + inOff, + availInBefore, + self._buffer, + self._offset, + self._chunkSize); + newReq.callback = callback; // this same function + newReq.buffer = chunk; + return; + } + + if (!async) + return false; + + // finished with the chunk. + cb(); + } +}; + +util.inherits(Deflate, Zlib); +util.inherits(Inflate, Zlib); +util.inherits(Gzip, Zlib); +util.inherits(Gunzip, Zlib); +util.inherits(DeflateRaw, Zlib); +util.inherits(InflateRaw, Zlib); +util.inherits(Unzip, Zlib); + +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer, __webpack_require__(5))) /***/ }, /* 98 */ /***/ function(module, exports, __webpack_require__) { - var http = __webpack_require__(78); +"use strict"; +'use strict'; +/* + * A JavaScript implementation of the RSA Data Security, Inc. MD5 Message + * Digest Algorithm, as defined in RFC 1321. + * Version 2.1 Copyright (C) Paul Johnston 1999 - 2002. + * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet + * Distributed under the BSD License + * See http://pajhome.org.uk/crypt/md5 for more info. + */ - var https = module.exports; +var helpers = __webpack_require__(163); - for (var key in http) { - if (http.hasOwnProperty(key)) https[key] = http[key]; - }; +/* + * Calculate the MD5 of an array of little-endian words, and a bit length + */ +function core_md5(x, len) +{ + /* append padding */ + x[len >> 5] |= 0x80 << ((len) % 32); + x[(((len + 64) >>> 9) << 4) + 14] = len; - https.request = function (params, cb) { - if (!params) params = {}; - params.scheme = 'https'; - return http.request.call(this, params, cb); - } + var a = 1732584193; + var b = -271733879; + var c = -1732584194; + var d = 271733878; + for(var i = 0; i < x.length; i += 16) + { + var olda = a; + var oldb = b; + var oldc = c; + var oldd = d; + + a = md5_ff(a, b, c, d, x[i+ 0], 7 , -680876936); + d = md5_ff(d, a, b, c, x[i+ 1], 12, -389564586); + c = md5_ff(c, d, a, b, x[i+ 2], 17, 606105819); + b = md5_ff(b, c, d, a, x[i+ 3], 22, -1044525330); + a = md5_ff(a, b, c, d, x[i+ 4], 7 , -176418897); + d = md5_ff(d, a, b, c, x[i+ 5], 12, 1200080426); + c = md5_ff(c, d, a, b, x[i+ 6], 17, -1473231341); + b = md5_ff(b, c, d, a, x[i+ 7], 22, -45705983); + a = md5_ff(a, b, c, d, x[i+ 8], 7 , 1770035416); + d = md5_ff(d, a, b, c, x[i+ 9], 12, -1958414417); + c = md5_ff(c, d, a, b, x[i+10], 17, -42063); + b = md5_ff(b, c, d, a, x[i+11], 22, -1990404162); + a = md5_ff(a, b, c, d, x[i+12], 7 , 1804603682); + d = md5_ff(d, a, b, c, x[i+13], 12, -40341101); + c = md5_ff(c, d, a, b, x[i+14], 17, -1502002290); + b = md5_ff(b, c, d, a, x[i+15], 22, 1236535329); + + a = md5_gg(a, b, c, d, x[i+ 1], 5 , -165796510); + d = md5_gg(d, a, b, c, x[i+ 6], 9 , -1069501632); + c = md5_gg(c, d, a, b, x[i+11], 14, 643717713); + b = md5_gg(b, c, d, a, x[i+ 0], 20, -373897302); + a = md5_gg(a, b, c, d, x[i+ 5], 5 , -701558691); + d = md5_gg(d, a, b, c, x[i+10], 9 , 38016083); + c = md5_gg(c, d, a, b, x[i+15], 14, -660478335); + b = md5_gg(b, c, d, a, x[i+ 4], 20, -405537848); + a = md5_gg(a, b, c, d, x[i+ 9], 5 , 568446438); + d = md5_gg(d, a, b, c, x[i+14], 9 , -1019803690); + c = md5_gg(c, d, a, b, x[i+ 3], 14, -187363961); + b = md5_gg(b, c, d, a, x[i+ 8], 20, 1163531501); + a = md5_gg(a, b, c, d, x[i+13], 5 , -1444681467); + d = md5_gg(d, a, b, c, x[i+ 2], 9 , -51403784); + c = md5_gg(c, d, a, b, x[i+ 7], 14, 1735328473); + b = md5_gg(b, c, d, a, x[i+12], 20, -1926607734); + + a = md5_hh(a, b, c, d, x[i+ 5], 4 , -378558); + d = md5_hh(d, a, b, c, x[i+ 8], 11, -2022574463); + c = md5_hh(c, d, a, b, x[i+11], 16, 1839030562); + b = md5_hh(b, c, d, a, x[i+14], 23, -35309556); + a = md5_hh(a, b, c, d, x[i+ 1], 4 , -1530992060); + d = md5_hh(d, a, b, c, x[i+ 4], 11, 1272893353); + c = md5_hh(c, d, a, b, x[i+ 7], 16, -155497632); + b = md5_hh(b, c, d, a, x[i+10], 23, -1094730640); + a = md5_hh(a, b, c, d, x[i+13], 4 , 681279174); + d = md5_hh(d, a, b, c, x[i+ 0], 11, -358537222); + c = md5_hh(c, d, a, b, x[i+ 3], 16, -722521979); + b = md5_hh(b, c, d, a, x[i+ 6], 23, 76029189); + a = md5_hh(a, b, c, d, x[i+ 9], 4 , -640364487); + d = md5_hh(d, a, b, c, x[i+12], 11, -421815835); + c = md5_hh(c, d, a, b, x[i+15], 16, 530742520); + b = md5_hh(b, c, d, a, x[i+ 2], 23, -995338651); + + a = md5_ii(a, b, c, d, x[i+ 0], 6 , -198630844); + d = md5_ii(d, a, b, c, x[i+ 7], 10, 1126891415); + c = md5_ii(c, d, a, b, x[i+14], 15, -1416354905); + b = md5_ii(b, c, d, a, x[i+ 5], 21, -57434055); + a = md5_ii(a, b, c, d, x[i+12], 6 , 1700485571); + d = md5_ii(d, a, b, c, x[i+ 3], 10, -1894986606); + c = md5_ii(c, d, a, b, x[i+10], 15, -1051523); + b = md5_ii(b, c, d, a, x[i+ 1], 21, -2054922799); + a = md5_ii(a, b, c, d, x[i+ 8], 6 , 1873313359); + d = md5_ii(d, a, b, c, x[i+15], 10, -30611744); + c = md5_ii(c, d, a, b, x[i+ 6], 15, -1560198380); + b = md5_ii(b, c, d, a, x[i+13], 21, 1309151649); + a = md5_ii(a, b, c, d, x[i+ 4], 6 , -145523070); + d = md5_ii(d, a, b, c, x[i+11], 10, -1120210379); + c = md5_ii(c, d, a, b, x[i+ 2], 15, 718787259); + b = md5_ii(b, c, d, a, x[i+ 9], 21, -343485551); + + a = safe_add(a, olda); + b = safe_add(b, oldb); + c = safe_add(c, oldc); + d = safe_add(d, oldd); + } + return Array(a, b, c, d); + +} + +/* + * These functions implement the four basic operations the algorithm uses. + */ +function md5_cmn(q, a, b, x, s, t) +{ + return safe_add(bit_rol(safe_add(safe_add(a, q), safe_add(x, t)), s),b); +} +function md5_ff(a, b, c, d, x, s, t) +{ + return md5_cmn((b & c) | ((~b) & d), a, b, x, s, t); +} +function md5_gg(a, b, c, d, x, s, t) +{ + return md5_cmn((b & d) | (c & (~d)), a, b, x, s, t); +} +function md5_hh(a, b, c, d, x, s, t) +{ + return md5_cmn(b ^ c ^ d, a, b, x, s, t); +} +function md5_ii(a, b, c, d, x, s, t) +{ + return md5_cmn(c ^ (b | (~d)), a, b, x, s, t); +} + +/* + * Add integers, wrapping at 2^32. This uses 16-bit operations internally + * to work around bugs in some JS interpreters. + */ +function safe_add(x, y) +{ + var lsw = (x & 0xFFFF) + (y & 0xFFFF); + var msw = (x >> 16) + (y >> 16) + (lsw >> 16); + return (msw << 16) | (lsw & 0xFFFF); +} + +/* + * Bitwise rotate a 32-bit number to the left. + */ +function bit_rol(num, cnt) +{ + return (num << cnt) | (num >>> (32 - cnt)); +} + +module.exports = function md5(buf) { + return helpers.hash(buf, core_md5, 16); +}; /***/ }, /* 99 */ /***/ function(module, exports, __webpack_require__) { - /* WEBPACK VAR INJECTION */(function(Buffer) {var rng = __webpack_require__(100) +/* WEBPACK VAR INJECTION */(function(Buffer) {/** + * A JavaScript implementation of the Secure Hash Algorithm, SHA-256, as defined + * in FIPS 180-2 + * Version 2.2-beta Copyright Angel Marin, Paul Johnston 2000 - 2009. + * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet + * + */ - function error () { - var m = [].slice.call(arguments).join(' ') - throw new Error([ - m, - 'we accept pull requests', - 'http://github.com/dominictarr/crypto-browserify' - ].join('\n')) - } +var inherits = __webpack_require__(1) +var Hash = __webpack_require__(19) - exports.createHash = __webpack_require__(102) +var K = [ + 0x428A2F98, 0x71374491, 0xB5C0FBCF, 0xE9B5DBA5, + 0x3956C25B, 0x59F111F1, 0x923F82A4, 0xAB1C5ED5, + 0xD807AA98, 0x12835B01, 0x243185BE, 0x550C7DC3, + 0x72BE5D74, 0x80DEB1FE, 0x9BDC06A7, 0xC19BF174, + 0xE49B69C1, 0xEFBE4786, 0x0FC19DC6, 0x240CA1CC, + 0x2DE92C6F, 0x4A7484AA, 0x5CB0A9DC, 0x76F988DA, + 0x983E5152, 0xA831C66D, 0xB00327C8, 0xBF597FC7, + 0xC6E00BF3, 0xD5A79147, 0x06CA6351, 0x14292967, + 0x27B70A85, 0x2E1B2138, 0x4D2C6DFC, 0x53380D13, + 0x650A7354, 0x766A0ABB, 0x81C2C92E, 0x92722C85, + 0xA2BFE8A1, 0xA81A664B, 0xC24B8B70, 0xC76C51A3, + 0xD192E819, 0xD6990624, 0xF40E3585, 0x106AA070, + 0x19A4C116, 0x1E376C08, 0x2748774C, 0x34B0BCB5, + 0x391C0CB3, 0x4ED8AA4A, 0x5B9CCA4F, 0x682E6FF3, + 0x748F82EE, 0x78A5636F, 0x84C87814, 0x8CC70208, + 0x90BEFFFA, 0xA4506CEB, 0xBEF9A3F7, 0xC67178F2 +] - exports.createHmac = __webpack_require__(111) +var W = new Array(64) - exports.randomBytes = function(size, callback) { - if (callback && callback.call) { - try { - callback.call(this, undefined, new Buffer(rng(size))) - } catch (err) { callback(err) } - } else { - return new Buffer(rng(size)) - } - } +function Sha256 () { + this.init() - function each(a, f) { - for(var i in a) - f(a[i], i) - } + this._w = W // new Array(64) - exports.getHashes = function () { - return ['sha1', 'sha256', 'sha512', 'md5', 'rmd160'] - } + Hash.call(this, 64, 56) +} - var p = __webpack_require__(112)(exports) - exports.pbkdf2 = p.pbkdf2 - exports.pbkdf2Sync = p.pbkdf2Sync +inherits(Sha256, Hash) +Sha256.prototype.init = function () { + this._a = 0x6a09e667 + this._b = 0xbb67ae85 + this._c = 0x3c6ef372 + this._d = 0xa54ff53a + this._e = 0x510e527f + this._f = 0x9b05688c + this._g = 0x1f83d9ab + this._h = 0x5be0cd19 - // the least I can do is make error messages for the rest of the node.js/crypto api. - each(['createCredentials' - , 'createCipher' - , 'createCipheriv' - , 'createDecipher' - , 'createDecipheriv' - , 'createSign' - , 'createVerify' - , 'createDiffieHellman' - ], function (name) { - exports[name] = function () { - error('sorry,', name, 'is not implemented yet') - } - }) + return this +} - /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(58).Buffer)) +function ch (x, y, z) { + return z ^ (x & (y ^ z)) +} + +function maj (x, y, z) { + return (x & y) | (z & (x | y)) +} + +function sigma0 (x) { + return (x >>> 2 | x << 30) ^ (x >>> 13 | x << 19) ^ (x >>> 22 | x << 10) +} + +function sigma1 (x) { + return (x >>> 6 | x << 26) ^ (x >>> 11 | x << 21) ^ (x >>> 25 | x << 7) +} + +function gamma0 (x) { + return (x >>> 7 | x << 25) ^ (x >>> 18 | x << 14) ^ (x >>> 3) +} + +function gamma1 (x) { + return (x >>> 17 | x << 15) ^ (x >>> 19 | x << 13) ^ (x >>> 10) +} + +Sha256.prototype._update = function (M) { + var W = this._w + + var a = this._a | 0 + var b = this._b | 0 + var c = this._c | 0 + var d = this._d | 0 + var e = this._e | 0 + var f = this._f | 0 + var g = this._g | 0 + var h = this._h | 0 + + for (var i = 0; i < 16; ++i) W[i] = M.readInt32BE(i * 4) + for (; i < 64; ++i) W[i] = (gamma1(W[i - 2]) + W[i - 7] + gamma0(W[i - 15]) + W[i - 16]) | 0 + + for (var j = 0; j < 64; ++j) { + var T1 = (h + sigma1(e) + ch(e, f, g) + K[j] + W[j]) | 0 + var T2 = (sigma0(a) + maj(a, b, c)) | 0 + + h = g + g = f + f = e + e = (d + T1) | 0 + d = c + c = b + b = a + a = (T1 + T2) | 0 + } + + this._a = (a + this._a) | 0 + this._b = (b + this._b) | 0 + this._c = (c + this._c) | 0 + this._d = (d + this._d) | 0 + this._e = (e + this._e) | 0 + this._f = (f + this._f) | 0 + this._g = (g + this._g) | 0 + this._h = (h + this._h) | 0 +} + +Sha256.prototype._hash = function () { + var H = new Buffer(32) + + H.writeInt32BE(this._a, 0) + H.writeInt32BE(this._b, 4) + H.writeInt32BE(this._c, 8) + H.writeInt32BE(this._d, 12) + H.writeInt32BE(this._e, 16) + H.writeInt32BE(this._f, 20) + H.writeInt32BE(this._g, 24) + H.writeInt32BE(this._h, 28) + + return H +} + +module.exports = Sha256 + +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer)) /***/ }, /* 100 */ /***/ function(module, exports, __webpack_require__) { - /* WEBPACK VAR INJECTION */(function(global, Buffer) {(function() { - var g = ('undefined' === typeof window ? global : window) || {} - _crypto = ( - g.crypto || g.msCrypto || __webpack_require__(101) - ) - module.exports = function(size) { - // Modern Browsers - if(_crypto.getRandomValues) { - var bytes = new Buffer(size); //in browserify, this is an extended Uint8Array - /* This will not work in older browsers. - * See https://developer.mozilla.org/en-US/docs/Web/API/window.crypto.getRandomValues - */ - - _crypto.getRandomValues(bytes); - return bytes; - } - else if (_crypto.randomBytes) { - return _crypto.randomBytes(size) - } - else - throw new Error( - 'secure random number generation not supported by this browser\n'+ - 'use chrome, FireFox or Internet Explorer 11' - ) - } - }()) +/* WEBPACK VAR INJECTION */(function(Buffer) {var inherits = __webpack_require__(1) +var Hash = __webpack_require__(19) - /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()), __webpack_require__(58).Buffer)) +var K = [ + 0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd, + 0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc, + 0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019, + 0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118, + 0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe, + 0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2, + 0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1, + 0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694, + 0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3, + 0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65, + 0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483, + 0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5, + 0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210, + 0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4, + 0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725, + 0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70, + 0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926, + 0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df, + 0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8, + 0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b, + 0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001, + 0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30, + 0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910, + 0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8, + 0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53, + 0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8, + 0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb, + 0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3, + 0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60, + 0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec, + 0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9, + 0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b, + 0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207, + 0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178, + 0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6, + 0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b, + 0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493, + 0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c, + 0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a, + 0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817 +] + +var W = new Array(160) + +function Sha512 () { + this.init() + this._w = W + + Hash.call(this, 128, 112) +} + +inherits(Sha512, Hash) + +Sha512.prototype.init = function () { + this._ah = 0x6a09e667 + this._bh = 0xbb67ae85 + this._ch = 0x3c6ef372 + this._dh = 0xa54ff53a + this._eh = 0x510e527f + this._fh = 0x9b05688c + this._gh = 0x1f83d9ab + this._hh = 0x5be0cd19 + + this._al = 0xf3bcc908 + this._bl = 0x84caa73b + this._cl = 0xfe94f82b + this._dl = 0x5f1d36f1 + this._el = 0xade682d1 + this._fl = 0x2b3e6c1f + this._gl = 0xfb41bd6b + this._hl = 0x137e2179 + + return this +} + +function Ch (x, y, z) { + return z ^ (x & (y ^ z)) +} + +function maj (x, y, z) { + return (x & y) | (z & (x | y)) +} + +function sigma0 (x, xl) { + return (x >>> 28 | xl << 4) ^ (xl >>> 2 | x << 30) ^ (xl >>> 7 | x << 25) +} + +function sigma1 (x, xl) { + return (x >>> 14 | xl << 18) ^ (x >>> 18 | xl << 14) ^ (xl >>> 9 | x << 23) +} + +function Gamma0 (x, xl) { + return (x >>> 1 | xl << 31) ^ (x >>> 8 | xl << 24) ^ (x >>> 7) +} + +function Gamma0l (x, xl) { + return (x >>> 1 | xl << 31) ^ (x >>> 8 | xl << 24) ^ (x >>> 7 | xl << 25) +} + +function Gamma1 (x, xl) { + return (x >>> 19 | xl << 13) ^ (xl >>> 29 | x << 3) ^ (x >>> 6) +} + +function Gamma1l (x, xl) { + return (x >>> 19 | xl << 13) ^ (xl >>> 29 | x << 3) ^ (x >>> 6 | xl << 26) +} + +function getCarry (a, b) { + return (a >>> 0) < (b >>> 0) ? 1 : 0 +} + +Sha512.prototype._update = function (M) { + var W = this._w + + var ah = this._ah | 0 + var bh = this._bh | 0 + var ch = this._ch | 0 + var dh = this._dh | 0 + var eh = this._eh | 0 + var fh = this._fh | 0 + var gh = this._gh | 0 + var hh = this._hh | 0 + + var al = this._al | 0 + var bl = this._bl | 0 + var cl = this._cl | 0 + var dl = this._dl | 0 + var el = this._el | 0 + var fl = this._fl | 0 + var gl = this._gl | 0 + var hl = this._hl | 0 + + for (var i = 0; i < 32; i += 2) { + W[i] = M.readInt32BE(i * 4) + W[i + 1] = M.readInt32BE(i * 4 + 4) + } + for (; i < 160; i += 2) { + var xh = W[i - 15 * 2] + var xl = W[i - 15 * 2 + 1] + var gamma0 = Gamma0(xh, xl) + var gamma0l = Gamma0l(xl, xh) + + xh = W[i - 2 * 2] + xl = W[i - 2 * 2 + 1] + var gamma1 = Gamma1(xh, xl) + var gamma1l = Gamma1l(xl, xh) + + // W[i] = gamma0 + W[i - 7] + gamma1 + W[i - 16] + var Wi7h = W[i - 7 * 2] + var Wi7l = W[i - 7 * 2 + 1] + + var Wi16h = W[i - 16 * 2] + var Wi16l = W[i - 16 * 2 + 1] + + var Wil = (gamma0l + Wi7l) | 0 + var Wih = (gamma0 + Wi7h + getCarry(Wil, gamma0l)) | 0 + Wil = (Wil + gamma1l) | 0 + Wih = (Wih + gamma1 + getCarry(Wil, gamma1l)) | 0 + Wil = (Wil + Wi16l) | 0 + Wih = (Wih + Wi16h + getCarry(Wil, Wi16l)) | 0 + + W[i] = Wih + W[i + 1] = Wil + } + + for (var j = 0; j < 160; j += 2) { + Wih = W[j] + Wil = W[j + 1] + + var majh = maj(ah, bh, ch) + var majl = maj(al, bl, cl) + + var sigma0h = sigma0(ah, al) + var sigma0l = sigma0(al, ah) + var sigma1h = sigma1(eh, el) + var sigma1l = sigma1(el, eh) + + // t1 = h + sigma1 + ch + K[j] + W[j] + var Kih = K[j] + var Kil = K[j + 1] + + var chh = Ch(eh, fh, gh) + var chl = Ch(el, fl, gl) + + var t1l = (hl + sigma1l) | 0 + var t1h = (hh + sigma1h + getCarry(t1l, hl)) | 0 + t1l = (t1l + chl) | 0 + t1h = (t1h + chh + getCarry(t1l, chl)) | 0 + t1l = (t1l + Kil) | 0 + t1h = (t1h + Kih + getCarry(t1l, Kil)) | 0 + t1l = (t1l + Wil) | 0 + t1h = (t1h + Wih + getCarry(t1l, Wil)) | 0 + + // t2 = sigma0 + maj + var t2l = (sigma0l + majl) | 0 + var t2h = (sigma0h + majh + getCarry(t2l, sigma0l)) | 0 + + hh = gh + hl = gl + gh = fh + gl = fl + fh = eh + fl = el + el = (dl + t1l) | 0 + eh = (dh + t1h + getCarry(el, dl)) | 0 + dh = ch + dl = cl + ch = bh + cl = bl + bh = ah + bl = al + al = (t1l + t2l) | 0 + ah = (t1h + t2h + getCarry(al, t1l)) | 0 + } + + this._al = (this._al + al) | 0 + this._bl = (this._bl + bl) | 0 + this._cl = (this._cl + cl) | 0 + this._dl = (this._dl + dl) | 0 + this._el = (this._el + el) | 0 + this._fl = (this._fl + fl) | 0 + this._gl = (this._gl + gl) | 0 + this._hl = (this._hl + hl) | 0 + + this._ah = (this._ah + ah + getCarry(this._al, al)) | 0 + this._bh = (this._bh + bh + getCarry(this._bl, bl)) | 0 + this._ch = (this._ch + ch + getCarry(this._cl, cl)) | 0 + this._dh = (this._dh + dh + getCarry(this._dl, dl)) | 0 + this._eh = (this._eh + eh + getCarry(this._el, el)) | 0 + this._fh = (this._fh + fh + getCarry(this._fl, fl)) | 0 + this._gh = (this._gh + gh + getCarry(this._gl, gl)) | 0 + this._hh = (this._hh + hh + getCarry(this._hl, hl)) | 0 +} + +Sha512.prototype._hash = function () { + var H = new Buffer(64) + + function writeInt64BE (h, l, offset) { + H.writeInt32BE(h, offset) + H.writeInt32BE(l, offset + 4) + } + + writeInt64BE(this._ah, this._al, 0) + writeInt64BE(this._bh, this._bl, 8) + writeInt64BE(this._ch, this._cl, 16) + writeInt64BE(this._dh, this._dl, 24) + writeInt64BE(this._eh, this._el, 32) + writeInt64BE(this._fh, this._fl, 40) + writeInt64BE(this._gh, this._gl, 48) + writeInt64BE(this._hh, this._hl, 56) + + return H +} + +module.exports = Sha512 + +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer)) /***/ }, /* 101 */ -/***/ function(module, exports) { +/***/ function(module, exports, __webpack_require__) { + +var randomBytes = __webpack_require__(27); +module.exports = findPrime; +findPrime.simpleSieve = simpleSieve; +findPrime.fermatTest = fermatTest; +var BN = __webpack_require__(4); +var TWENTYFOUR = new BN(24); +var MillerRabin = __webpack_require__(103); +var millerRabin = new MillerRabin(); +var ONE = new BN(1); +var TWO = new BN(2); +var FIVE = new BN(5); +var SIXTEEN = new BN(16); +var EIGHT = new BN(8); +var TEN = new BN(10); +var THREE = new BN(3); +var SEVEN = new BN(7); +var ELEVEN = new BN(11); +var FOUR = new BN(4); +var TWELVE = new BN(12); +var primes = null; + +function _getPrimes() { + if (primes !== null) + return primes; + + var limit = 0x100000; + var res = []; + res[0] = 2; + for (var i = 1, k = 3; k < limit; k += 2) { + var sqrt = Math.ceil(Math.sqrt(k)); + for (var j = 0; j < i && res[j] <= sqrt; j++) + if (k % res[j] === 0) + break; + + if (i !== j && res[j] <= sqrt) + continue; + + res[i++] = k; + } + primes = res; + return res; +} + +function simpleSieve(p) { + var primes = _getPrimes(); + + for (var i = 0; i < primes.length; i++) + if (p.modn(primes[i]) === 0) { + if (p.cmpn(primes[i]) === 0) { + return true; + } else { + return false; + } + } + + return true; +} + +function fermatTest(p) { + var red = BN.mont(p); + return TWO.toRed(red).redPow(p.subn(1)).fromRed().cmpn(1) === 0; +} + +function findPrime(bits, gen) { + if (bits < 16) { + // this is what openssl does + if (gen === 2 || gen === 5) { + return new BN([0x8c, 0x7b]); + } else { + return new BN([0x8c, 0x27]); + } + } + gen = new BN(gen); + + var num, n2; + + while (true) { + num = new BN(randomBytes(Math.ceil(bits / 8))); + while (num.bitLength() > bits) { + num.ishrn(1); + } + if (num.isEven()) { + num.iadd(ONE); + } + if (!num.testn(1)) { + num.iadd(TWO); + } + if (!gen.cmp(TWO)) { + while (num.mod(TWENTYFOUR).cmp(ELEVEN)) { + num.iadd(FOUR); + } + } else if (!gen.cmp(FIVE)) { + while (num.mod(TEN).cmp(THREE)) { + num.iadd(FOUR); + } + } + n2 = num.shrn(1); + if (simpleSieve(n2) && simpleSieve(num) && + fermatTest(n2) && fermatTest(num) && + millerRabin.test(n2) && millerRabin.test(num)) { + return num; + } + } + +} - /* (ignored) */ /***/ }, /* 102 */ -/***/ function(module, exports, __webpack_require__) { +/***/ function(module, exports) { - /* WEBPACK VAR INJECTION */(function(Buffer) {var createHash = __webpack_require__(103) +var toString = {}.toString; - var md5 = toConstructor(__webpack_require__(108)) - var rmd160 = toConstructor(__webpack_require__(110)) +module.exports = Array.isArray || function (arr) { + return toString.call(arr) == '[object Array]'; +}; - function toConstructor (fn) { - return function () { - var buffers = [] - var m= { - update: function (data, enc) { - if(!Buffer.isBuffer(data)) data = new Buffer(data, enc) - buffers.push(data) - return this - }, - digest: function (enc) { - var buf = Buffer.concat(buffers) - var r = fn(buf) - buffers = null - return enc ? r.toString(enc) : r - } - } - return m - } - } - - module.exports = function (alg) { - if('md5' === alg) return new md5() - if('rmd160' === alg) return new rmd160() - return createHash(alg) - } - - /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(58).Buffer)) /***/ }, /* 103 */ /***/ function(module, exports, __webpack_require__) { - var exports = module.exports = function (alg) { - var Alg = exports[alg] - if(!Alg) throw new Error(alg + ' is not supported (we accept pull requests)') - return new Alg() - } +var bn = __webpack_require__(4); +var brorand = __webpack_require__(86); - var Buffer = __webpack_require__(58).Buffer - var Hash = __webpack_require__(104)(Buffer) +function MillerRabin(rand) { + this.rand = rand || new brorand.Rand(); +} +module.exports = MillerRabin; - exports.sha1 = __webpack_require__(105)(Buffer, Hash) - exports.sha256 = __webpack_require__(106)(Buffer, Hash) - exports.sha512 = __webpack_require__(107)(Buffer, Hash) +MillerRabin.create = function create(rand) { + return new MillerRabin(rand); +}; + +MillerRabin.prototype._rand = function _rand(n) { + var len = n.bitLength(); + var buf = this.rand.generate(Math.ceil(len / 8)); + + // Set low bits + buf[0] |= 3; + + // Mask high bits + var mask = len & 0x7; + if (mask !== 0) + buf[buf.length - 1] >>= 7 - mask; + + return new bn(buf); +} + +MillerRabin.prototype.test = function test(n, k, cb) { + var len = n.bitLength(); + var red = bn.mont(n); + var rone = new bn(1).toRed(red); + + if (!k) + k = Math.max(1, (len / 48) | 0); + + // Find d and s, (n - 1) = (2 ^ s) * d; + var n1 = n.subn(1); + var n2 = n1.subn(1); + for (var s = 0; !n1.testn(s); s++) {} + var d = n.shrn(s); + + var rn1 = n1.toRed(red); + + var prime = true; + for (; k > 0; k--) { + var a = this._rand(n2); + if (cb) + cb(a); + + var x = a.toRed(red).redPow(d); + if (x.cmp(rone) === 0 || x.cmp(rn1) === 0) + continue; + + for (var i = 1; i < s; i++) { + x = x.redSqr(); + + if (x.cmp(rone) === 0) + return false; + if (x.cmp(rn1) === 0) + break; + } + + if (i === s) + return false; + } + + return prime; +}; + +MillerRabin.prototype.getDivisor = function getDivisor(n, k) { + var len = n.bitLength(); + var red = bn.mont(n); + var rone = new bn(1).toRed(red); + + if (!k) + k = Math.max(1, (len / 48) | 0); + + // Find d and s, (n - 1) = (2 ^ s) * d; + var n1 = n.subn(1); + var n2 = n1.subn(1); + for (var s = 0; !n1.testn(s); s++) {} + var d = n.shrn(s); + + var rn1 = n1.toRed(red); + + for (; k > 0; k--) { + var a = this._rand(n2); + + var g = n.gcd(a); + if (g.cmpn(1) !== 0) + return g; + + var x = a.toRed(red).redPow(d); + if (x.cmp(rone) === 0 || x.cmp(rn1) === 0) + continue; + + for (var i = 1; i < s; i++) { + x = x.redSqr(); + + if (x.cmp(rone) === 0) + return x.fromRed().subn(1).gcd(n); + if (x.cmp(rn1) === 0) + break; + } + + if (i === s) { + x = x.redSqr(); + return x.fromRed().subn(1).gcd(n); + } + } + + return false; +}; /***/ }, /* 104 */ -/***/ function(module, exports) { +/***/ function(module, exports, __webpack_require__) { - module.exports = function (Buffer) { +/*! + * Copyright(c) 2011 Einar Otto Stangvik + * MIT Licensed + */ - //prototype class for hash functions - function Hash (blockSize, finalSize) { - this._block = new Buffer(blockSize) //new Uint32Array(blockSize/4) - this._finalSize = finalSize - this._blockSize = blockSize - this._len = 0 - this._s = 0 - } +var fs = __webpack_require__(10); - Hash.prototype.init = function () { - this._s = 0 - this._len = 0 - } +function Options(defaults) { + var internalValues = {}; + var values = this.value = {}; + Object.keys(defaults).forEach(function(key) { + internalValues[key] = defaults[key]; + Object.defineProperty(values, key, { + get: function() { return internalValues[key]; }, + configurable: false, + enumerable: true + }); + }); + this.reset = function() { + Object.keys(defaults).forEach(function(key) { + internalValues[key] = defaults[key]; + }); + return this; + }; + this.merge = function(options, required) { + options = options || {}; + if (Object.prototype.toString.call(required) === '[object Array]') { + var missing = []; + for (var i = 0, l = required.length; i < l; ++i) { + var key = required[i]; + if (!(key in options)) { + missing.push(key); + } + } + if (missing.length > 0) { + if (missing.length > 1) { + throw new Error('options ' + + missing.slice(0, missing.length - 1).join(', ') + ' and ' + + missing[missing.length - 1] + ' must be defined'); + } + else throw new Error('option ' + missing[0] + ' must be defined'); + } + } + Object.keys(options).forEach(function(key) { + if (key in internalValues) { + internalValues[key] = options[key]; + } + }); + return this; + }; + this.copy = function(keys) { + var obj = {}; + Object.keys(defaults).forEach(function(key) { + if (keys.indexOf(key) !== -1) { + obj[key] = values[key]; + } + }); + return obj; + }; + this.read = function(filename, cb) { + if (typeof cb == 'function') { + var self = this; + fs.readFile(filename, function(error, data) { + if (error) return cb(error); + var conf = JSON.parse(data); + self.merge(conf); + cb(); + }); + } + else { + var conf = JSON.parse(fs.readFileSync(filename)); + this.merge(conf); + } + return this; + }; + this.isDefined = function(key) { + return typeof values[key] != 'undefined'; + }; + this.isDefinedAndNonNull = function(key) { + return typeof values[key] != 'undefined' && values[key] !== null; + }; + Object.freeze(values); + Object.freeze(this); +} - Hash.prototype.update = function (data, enc) { - if ("string" === typeof data) { - enc = enc || "utf8" - data = new Buffer(data, enc) - } - - var l = this._len += data.length - var s = this._s = (this._s || 0) - var f = 0 - var buffer = this._block - - while (s < l) { - var t = Math.min(data.length, f + this._blockSize - (s % this._blockSize)) - var ch = (t - f) - - for (var i = 0; i < ch; i++) { - buffer[(s % this._blockSize) + i] = data[i + f] - } - - s += ch - f += ch - - if ((s % this._blockSize) === 0) { - this._update(buffer) - } - } - this._s = s - - return this - } - - Hash.prototype.digest = function (enc) { - // Suppose the length of the message M, in bits, is l - var l = this._len * 8 - - // Append the bit 1 to the end of the message - this._block[this._len % this._blockSize] = 0x80 - - // and then k zero bits, where k is the smallest non-negative solution to the equation (l + 1 + k) === finalSize mod blockSize - this._block.fill(0, this._len % this._blockSize + 1) - - if (l % (this._blockSize * 8) >= this._finalSize * 8) { - this._update(this._block) - this._block.fill(0) - } - - // to this append the block which is equal to the number l written in binary - // TODO: handle case where l is > Math.pow(2, 29) - this._block.writeInt32BE(l, this._blockSize - 4) - - var hash = this._update(this._block) || this._hash() - - return enc ? hash.toString(enc) : hash - } - - Hash.prototype._update = function () { - throw new Error('_update must be implemented by subclass') - } - - return Hash - } +module.exports = Options; /***/ }, /* 105 */ -/***/ function(module, exports, __webpack_require__) { +/***/ function(module, exports) { - /* - * A JavaScript implementation of the Secure Hash Algorithm, SHA-1, as defined - * in FIPS PUB 180-1 - * Version 2.1a Copyright Paul Johnston 2000 - 2002. - * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet - * Distributed under the BSD License - * See http://pajhome.org.uk/crypt/md5 for details. - */ +"use strict"; +'use strict'; - var inherits = __webpack_require__(75).inherits +// Note: adler32 takes 12% for level 0 and 2% for level 6. +// It doesn't worth to make additional optimizationa as in original. +// Small size is preferable. - module.exports = function (Buffer, Hash) { +function adler32(adler, buf, len, pos) { + var s1 = (adler & 0xffff) |0, + s2 = ((adler >>> 16) & 0xffff) |0, + n = 0; - var A = 0|0 - var B = 4|0 - var C = 8|0 - var D = 12|0 - var E = 16|0 + while (len !== 0) { + // Set limit ~ twice less than 5552, to keep + // s2 in 31-bits, because we force signed ints. + // in other case %= will fail. + n = len > 2000 ? 2000 : len; + len -= n; - var W = new (typeof Int32Array === 'undefined' ? Array : Int32Array)(80) + do { + s1 = (s1 + buf[pos++]) |0; + s2 = (s2 + s1) |0; + } while (--n); - var POOL = [] + s1 %= 65521; + s2 %= 65521; + } - function Sha1 () { - if(POOL.length) - return POOL.pop().init() + return (s1 | (s2 << 16)) |0; +} - if(!(this instanceof Sha1)) return new Sha1() - this._w = W - Hash.call(this, 16*4, 14*4) - this._h = null - this.init() - } - - inherits(Sha1, Hash) - - Sha1.prototype.init = function () { - this._a = 0x67452301 - this._b = 0xefcdab89 - this._c = 0x98badcfe - this._d = 0x10325476 - this._e = 0xc3d2e1f0 - - Hash.prototype.init.call(this) - return this - } - - Sha1.prototype._POOL = POOL - Sha1.prototype._update = function (X) { - - var a, b, c, d, e, _a, _b, _c, _d, _e - - a = _a = this._a - b = _b = this._b - c = _c = this._c - d = _d = this._d - e = _e = this._e - - var w = this._w - - for(var j = 0; j < 80; j++) { - var W = w[j] = j < 16 ? X.readInt32BE(j*4) - : rol(w[j - 3] ^ w[j - 8] ^ w[j - 14] ^ w[j - 16], 1) - - var t = add( - add(rol(a, 5), sha1_ft(j, b, c, d)), - add(add(e, W), sha1_kt(j)) - ) - - e = d - d = c - c = rol(b, 30) - b = a - a = t - } - - this._a = add(a, _a) - this._b = add(b, _b) - this._c = add(c, _c) - this._d = add(d, _d) - this._e = add(e, _e) - } - - Sha1.prototype._hash = function () { - if(POOL.length < 100) POOL.push(this) - var H = new Buffer(20) - //console.log(this._a|0, this._b|0, this._c|0, this._d|0, this._e|0) - H.writeInt32BE(this._a|0, A) - H.writeInt32BE(this._b|0, B) - H.writeInt32BE(this._c|0, C) - H.writeInt32BE(this._d|0, D) - H.writeInt32BE(this._e|0, E) - return H - } - - /* - * Perform the appropriate triplet combination function for the current - * iteration - */ - function sha1_ft(t, b, c, d) { - if(t < 20) return (b & c) | ((~b) & d); - if(t < 40) return b ^ c ^ d; - if(t < 60) return (b & c) | (b & d) | (c & d); - return b ^ c ^ d; - } - - /* - * Determine the appropriate additive constant for the current iteration - */ - function sha1_kt(t) { - return (t < 20) ? 1518500249 : (t < 40) ? 1859775393 : - (t < 60) ? -1894007588 : -899497514; - } - - /* - * Add integers, wrapping at 2^32. This uses 16-bit operations internally - * to work around bugs in some JS interpreters. - * //dominictarr: this is 10 years old, so maybe this can be dropped?) - * - */ - function add(x, y) { - return (x + y ) | 0 - //lets see how this goes on testling. - // var lsw = (x & 0xFFFF) + (y & 0xFFFF); - // var msw = (x >> 16) + (y >> 16) + (lsw >> 16); - // return (msw << 16) | (lsw & 0xFFFF); - } - - /* - * Bitwise rotate a 32-bit number to the left. - */ - function rol(num, cnt) { - return (num << cnt) | (num >>> (32 - cnt)); - } - - return Sha1 - } +module.exports = adler32; /***/ }, /* 106 */ -/***/ function(module, exports, __webpack_require__) { +/***/ function(module, exports) { - - /** - * A JavaScript implementation of the Secure Hash Algorithm, SHA-256, as defined - * in FIPS 180-2 - * Version 2.2-beta Copyright Angel Marin, Paul Johnston 2000 - 2009. - * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet - * - */ +"use strict"; +'use strict'; - var inherits = __webpack_require__(75).inherits +// Note: we can't get significant speed boost here. +// So write code to minimize size - no pregenerated tables +// and array tools dependencies. - module.exports = function (Buffer, Hash) { - var K = [ - 0x428A2F98, 0x71374491, 0xB5C0FBCF, 0xE9B5DBA5, - 0x3956C25B, 0x59F111F1, 0x923F82A4, 0xAB1C5ED5, - 0xD807AA98, 0x12835B01, 0x243185BE, 0x550C7DC3, - 0x72BE5D74, 0x80DEB1FE, 0x9BDC06A7, 0xC19BF174, - 0xE49B69C1, 0xEFBE4786, 0x0FC19DC6, 0x240CA1CC, - 0x2DE92C6F, 0x4A7484AA, 0x5CB0A9DC, 0x76F988DA, - 0x983E5152, 0xA831C66D, 0xB00327C8, 0xBF597FC7, - 0xC6E00BF3, 0xD5A79147, 0x06CA6351, 0x14292967, - 0x27B70A85, 0x2E1B2138, 0x4D2C6DFC, 0x53380D13, - 0x650A7354, 0x766A0ABB, 0x81C2C92E, 0x92722C85, - 0xA2BFE8A1, 0xA81A664B, 0xC24B8B70, 0xC76C51A3, - 0xD192E819, 0xD6990624, 0xF40E3585, 0x106AA070, - 0x19A4C116, 0x1E376C08, 0x2748774C, 0x34B0BCB5, - 0x391C0CB3, 0x4ED8AA4A, 0x5B9CCA4F, 0x682E6FF3, - 0x748F82EE, 0x78A5636F, 0x84C87814, 0x8CC70208, - 0x90BEFFFA, 0xA4506CEB, 0xBEF9A3F7, 0xC67178F2 - ] +// Use ordinary array, since untyped makes no boost here +function makeTable() { + var c, table = []; - var W = new Array(64) + for (var n = 0; n < 256; n++) { + c = n; + for (var k = 0; k < 8; k++) { + c = ((c & 1) ? (0xEDB88320 ^ (c >>> 1)) : (c >>> 1)); + } + table[n] = c; + } - function Sha256() { - this.init() + return table; +} - this._w = W //new Array(64) +// Create table on load. Just 255 signed longs. Not a problem. +var crcTable = makeTable(); - Hash.call(this, 16*4, 14*4) - } - inherits(Sha256, Hash) +function crc32(crc, buf, len, pos) { + var t = crcTable, + end = pos + len; - Sha256.prototype.init = function () { + crc ^= -1; - this._a = 0x6a09e667|0 - this._b = 0xbb67ae85|0 - this._c = 0x3c6ef372|0 - this._d = 0xa54ff53a|0 - this._e = 0x510e527f|0 - this._f = 0x9b05688c|0 - this._g = 0x1f83d9ab|0 - this._h = 0x5be0cd19|0 + for (var i = pos; i < end; i++) { + crc = (crc >>> 8) ^ t[(crc ^ buf[i]) & 0xFF]; + } - this._len = this._s = 0 + return (crc ^ (-1)); // >>> 0; +} - return this - } - function S (X, n) { - return (X >>> n) | (X << (32 - n)); - } - - function R (X, n) { - return (X >>> n); - } - - function Ch (x, y, z) { - return ((x & y) ^ ((~x) & z)); - } - - function Maj (x, y, z) { - return ((x & y) ^ (x & z) ^ (y & z)); - } - - function Sigma0256 (x) { - return (S(x, 2) ^ S(x, 13) ^ S(x, 22)); - } - - function Sigma1256 (x) { - return (S(x, 6) ^ S(x, 11) ^ S(x, 25)); - } - - function Gamma0256 (x) { - return (S(x, 7) ^ S(x, 18) ^ R(x, 3)); - } - - function Gamma1256 (x) { - return (S(x, 17) ^ S(x, 19) ^ R(x, 10)); - } - - Sha256.prototype._update = function(M) { - - var W = this._w - var a, b, c, d, e, f, g, h - var T1, T2 - - a = this._a | 0 - b = this._b | 0 - c = this._c | 0 - d = this._d | 0 - e = this._e | 0 - f = this._f | 0 - g = this._g | 0 - h = this._h | 0 - - for (var j = 0; j < 64; j++) { - var w = W[j] = j < 16 - ? M.readInt32BE(j * 4) - : Gamma1256(W[j - 2]) + W[j - 7] + Gamma0256(W[j - 15]) + W[j - 16] - - T1 = h + Sigma1256(e) + Ch(e, f, g) + K[j] + w - - T2 = Sigma0256(a) + Maj(a, b, c); - h = g; g = f; f = e; e = d + T1; d = c; c = b; b = a; a = T1 + T2; - } - - this._a = (a + this._a) | 0 - this._b = (b + this._b) | 0 - this._c = (c + this._c) | 0 - this._d = (d + this._d) | 0 - this._e = (e + this._e) | 0 - this._f = (f + this._f) | 0 - this._g = (g + this._g) | 0 - this._h = (h + this._h) | 0 - - }; - - Sha256.prototype._hash = function () { - var H = new Buffer(32) - - H.writeInt32BE(this._a, 0) - H.writeInt32BE(this._b, 4) - H.writeInt32BE(this._c, 8) - H.writeInt32BE(this._d, 12) - H.writeInt32BE(this._e, 16) - H.writeInt32BE(this._f, 20) - H.writeInt32BE(this._g, 24) - H.writeInt32BE(this._h, 28) - - return H - } - - return Sha256 - - } +module.exports = crc32; /***/ }, /* 107 */ -/***/ function(module, exports, __webpack_require__) { +/***/ function(module, exports) { - var inherits = __webpack_require__(75).inherits +"use strict"; +'use strict'; - module.exports = function (Buffer, Hash) { - var K = [ - 0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd, - 0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc, - 0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019, - 0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118, - 0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe, - 0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2, - 0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1, - 0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694, - 0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3, - 0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65, - 0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483, - 0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5, - 0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210, - 0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4, - 0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725, - 0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70, - 0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926, - 0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df, - 0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8, - 0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b, - 0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001, - 0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30, - 0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910, - 0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8, - 0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53, - 0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8, - 0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb, - 0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3, - 0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60, - 0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec, - 0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9, - 0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b, - 0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207, - 0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178, - 0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6, - 0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b, - 0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493, - 0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c, - 0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a, - 0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817 - ] - - var W = new Array(160) - - function Sha512() { - this.init() - this._w = W - - Hash.call(this, 128, 112) - } - - inherits(Sha512, Hash) - - Sha512.prototype.init = function () { - - this._a = 0x6a09e667|0 - this._b = 0xbb67ae85|0 - this._c = 0x3c6ef372|0 - this._d = 0xa54ff53a|0 - this._e = 0x510e527f|0 - this._f = 0x9b05688c|0 - this._g = 0x1f83d9ab|0 - this._h = 0x5be0cd19|0 - - this._al = 0xf3bcc908|0 - this._bl = 0x84caa73b|0 - this._cl = 0xfe94f82b|0 - this._dl = 0x5f1d36f1|0 - this._el = 0xade682d1|0 - this._fl = 0x2b3e6c1f|0 - this._gl = 0xfb41bd6b|0 - this._hl = 0x137e2179|0 - - this._len = this._s = 0 - - return this - } - - function S (X, Xl, n) { - return (X >>> n) | (Xl << (32 - n)) - } - - function Ch (x, y, z) { - return ((x & y) ^ ((~x) & z)); - } - - function Maj (x, y, z) { - return ((x & y) ^ (x & z) ^ (y & z)); - } - - Sha512.prototype._update = function(M) { - - var W = this._w - var a, b, c, d, e, f, g, h - var al, bl, cl, dl, el, fl, gl, hl - - a = this._a | 0 - b = this._b | 0 - c = this._c | 0 - d = this._d | 0 - e = this._e | 0 - f = this._f | 0 - g = this._g | 0 - h = this._h | 0 - - al = this._al | 0 - bl = this._bl | 0 - cl = this._cl | 0 - dl = this._dl | 0 - el = this._el | 0 - fl = this._fl | 0 - gl = this._gl | 0 - hl = this._hl | 0 - - for (var i = 0; i < 80; i++) { - var j = i * 2 - - var Wi, Wil - - if (i < 16) { - Wi = W[j] = M.readInt32BE(j * 4) - Wil = W[j + 1] = M.readInt32BE(j * 4 + 4) - - } else { - var x = W[j - 15*2] - var xl = W[j - 15*2 + 1] - var gamma0 = S(x, xl, 1) ^ S(x, xl, 8) ^ (x >>> 7) - var gamma0l = S(xl, x, 1) ^ S(xl, x, 8) ^ S(xl, x, 7) - - x = W[j - 2*2] - xl = W[j - 2*2 + 1] - var gamma1 = S(x, xl, 19) ^ S(xl, x, 29) ^ (x >>> 6) - var gamma1l = S(xl, x, 19) ^ S(x, xl, 29) ^ S(xl, x, 6) - - // W[i] = gamma0 + W[i - 7] + gamma1 + W[i - 16] - var Wi7 = W[j - 7*2] - var Wi7l = W[j - 7*2 + 1] - - var Wi16 = W[j - 16*2] - var Wi16l = W[j - 16*2 + 1] - - Wil = gamma0l + Wi7l - Wi = gamma0 + Wi7 + ((Wil >>> 0) < (gamma0l >>> 0) ? 1 : 0) - Wil = Wil + gamma1l - Wi = Wi + gamma1 + ((Wil >>> 0) < (gamma1l >>> 0) ? 1 : 0) - Wil = Wil + Wi16l - Wi = Wi + Wi16 + ((Wil >>> 0) < (Wi16l >>> 0) ? 1 : 0) - - W[j] = Wi - W[j + 1] = Wil - } - - var maj = Maj(a, b, c) - var majl = Maj(al, bl, cl) - - var sigma0h = S(a, al, 28) ^ S(al, a, 2) ^ S(al, a, 7) - var sigma0l = S(al, a, 28) ^ S(a, al, 2) ^ S(a, al, 7) - var sigma1h = S(e, el, 14) ^ S(e, el, 18) ^ S(el, e, 9) - var sigma1l = S(el, e, 14) ^ S(el, e, 18) ^ S(e, el, 9) - - // t1 = h + sigma1 + ch + K[i] + W[i] - var Ki = K[j] - var Kil = K[j + 1] - - var ch = Ch(e, f, g) - var chl = Ch(el, fl, gl) - - var t1l = hl + sigma1l - var t1 = h + sigma1h + ((t1l >>> 0) < (hl >>> 0) ? 1 : 0) - t1l = t1l + chl - t1 = t1 + ch + ((t1l >>> 0) < (chl >>> 0) ? 1 : 0) - t1l = t1l + Kil - t1 = t1 + Ki + ((t1l >>> 0) < (Kil >>> 0) ? 1 : 0) - t1l = t1l + Wil - t1 = t1 + Wi + ((t1l >>> 0) < (Wil >>> 0) ? 1 : 0) - - // t2 = sigma0 + maj - var t2l = sigma0l + majl - var t2 = sigma0h + maj + ((t2l >>> 0) < (sigma0l >>> 0) ? 1 : 0) - - h = g - hl = gl - g = f - gl = fl - f = e - fl = el - el = (dl + t1l) | 0 - e = (d + t1 + ((el >>> 0) < (dl >>> 0) ? 1 : 0)) | 0 - d = c - dl = cl - c = b - cl = bl - b = a - bl = al - al = (t1l + t2l) | 0 - a = (t1 + t2 + ((al >>> 0) < (t1l >>> 0) ? 1 : 0)) | 0 - } - - this._al = (this._al + al) | 0 - this._bl = (this._bl + bl) | 0 - this._cl = (this._cl + cl) | 0 - this._dl = (this._dl + dl) | 0 - this._el = (this._el + el) | 0 - this._fl = (this._fl + fl) | 0 - this._gl = (this._gl + gl) | 0 - this._hl = (this._hl + hl) | 0 - - this._a = (this._a + a + ((this._al >>> 0) < (al >>> 0) ? 1 : 0)) | 0 - this._b = (this._b + b + ((this._bl >>> 0) < (bl >>> 0) ? 1 : 0)) | 0 - this._c = (this._c + c + ((this._cl >>> 0) < (cl >>> 0) ? 1 : 0)) | 0 - this._d = (this._d + d + ((this._dl >>> 0) < (dl >>> 0) ? 1 : 0)) | 0 - this._e = (this._e + e + ((this._el >>> 0) < (el >>> 0) ? 1 : 0)) | 0 - this._f = (this._f + f + ((this._fl >>> 0) < (fl >>> 0) ? 1 : 0)) | 0 - this._g = (this._g + g + ((this._gl >>> 0) < (gl >>> 0) ? 1 : 0)) | 0 - this._h = (this._h + h + ((this._hl >>> 0) < (hl >>> 0) ? 1 : 0)) | 0 - } - - Sha512.prototype._hash = function () { - var H = new Buffer(64) - - function writeInt64BE(h, l, offset) { - H.writeInt32BE(h, offset) - H.writeInt32BE(l, offset + 4) - } - - writeInt64BE(this._a, this._al, 0) - writeInt64BE(this._b, this._bl, 8) - writeInt64BE(this._c, this._cl, 16) - writeInt64BE(this._d, this._dl, 24) - writeInt64BE(this._e, this._el, 32) - writeInt64BE(this._f, this._fl, 40) - writeInt64BE(this._g, this._gl, 48) - writeInt64BE(this._h, this._hl, 56) - - return H - } - - return Sha512 - - } +module.exports = { + 2: 'need dictionary', /* Z_NEED_DICT 2 */ + 1: 'stream end', /* Z_STREAM_END 1 */ + 0: '', /* Z_OK 0 */ + '-1': 'file error', /* Z_ERRNO (-1) */ + '-2': 'stream error', /* Z_STREAM_ERROR (-2) */ + '-3': 'data error', /* Z_DATA_ERROR (-3) */ + '-4': 'insufficient memory', /* Z_MEM_ERROR (-4) */ + '-5': 'buffer error', /* Z_BUF_ERROR (-5) */ + '-6': 'incompatible version' /* Z_VERSION_ERROR (-6) */ +}; /***/ }, /* 108 */ /***/ function(module, exports, __webpack_require__) { - /* - * A JavaScript implementation of the RSA Data Security, Inc. MD5 Message - * Digest Algorithm, as defined in RFC 1321. - * Version 2.1 Copyright (C) Paul Johnston 1999 - 2002. - * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet - * Distributed under the BSD License - * See http://pajhome.org.uk/crypt/md5 for more info. - */ +/* WEBPACK VAR INJECTION */(function(process, Buffer) {var createHmac = __webpack_require__(50) +var checkParameters = __webpack_require__(214) - var helpers = __webpack_require__(109); +exports.pbkdf2 = function (password, salt, iterations, keylen, digest, callback) { + if (typeof digest === 'function') { + callback = digest + digest = undefined + } - /* - * Calculate the MD5 of an array of little-endian words, and a bit length - */ - function core_md5(x, len) - { - /* append padding */ - x[len >> 5] |= 0x80 << ((len) % 32); - x[(((len + 64) >>> 9) << 4) + 14] = len; + checkParameters(iterations, keylen) + if (typeof callback !== 'function') throw new Error('No callback provided to pbkdf2') - var a = 1732584193; - var b = -271733879; - var c = -1732584194; - var d = 271733878; + setTimeout(function () { + callback(null, exports.pbkdf2Sync(password, salt, iterations, keylen, digest)) + }) +} - for(var i = 0; i < x.length; i += 16) - { - var olda = a; - var oldb = b; - var oldc = c; - var oldd = d; +var defaultEncoding +if (process.browser) { + defaultEncoding = 'utf-8' +} else { + var pVersionMajor = parseInt(process.version.split('.')[0].slice(1), 10) - a = md5_ff(a, b, c, d, x[i+ 0], 7 , -680876936); - d = md5_ff(d, a, b, c, x[i+ 1], 12, -389564586); - c = md5_ff(c, d, a, b, x[i+ 2], 17, 606105819); - b = md5_ff(b, c, d, a, x[i+ 3], 22, -1044525330); - a = md5_ff(a, b, c, d, x[i+ 4], 7 , -176418897); - d = md5_ff(d, a, b, c, x[i+ 5], 12, 1200080426); - c = md5_ff(c, d, a, b, x[i+ 6], 17, -1473231341); - b = md5_ff(b, c, d, a, x[i+ 7], 22, -45705983); - a = md5_ff(a, b, c, d, x[i+ 8], 7 , 1770035416); - d = md5_ff(d, a, b, c, x[i+ 9], 12, -1958414417); - c = md5_ff(c, d, a, b, x[i+10], 17, -42063); - b = md5_ff(b, c, d, a, x[i+11], 22, -1990404162); - a = md5_ff(a, b, c, d, x[i+12], 7 , 1804603682); - d = md5_ff(d, a, b, c, x[i+13], 12, -40341101); - c = md5_ff(c, d, a, b, x[i+14], 17, -1502002290); - b = md5_ff(b, c, d, a, x[i+15], 22, 1236535329); + defaultEncoding = pVersionMajor >= 6 ? 'utf-8' : 'binary' +} - a = md5_gg(a, b, c, d, x[i+ 1], 5 , -165796510); - d = md5_gg(d, a, b, c, x[i+ 6], 9 , -1069501632); - c = md5_gg(c, d, a, b, x[i+11], 14, 643717713); - b = md5_gg(b, c, d, a, x[i+ 0], 20, -373897302); - a = md5_gg(a, b, c, d, x[i+ 5], 5 , -701558691); - d = md5_gg(d, a, b, c, x[i+10], 9 , 38016083); - c = md5_gg(c, d, a, b, x[i+15], 14, -660478335); - b = md5_gg(b, c, d, a, x[i+ 4], 20, -405537848); - a = md5_gg(a, b, c, d, x[i+ 9], 5 , 568446438); - d = md5_gg(d, a, b, c, x[i+14], 9 , -1019803690); - c = md5_gg(c, d, a, b, x[i+ 3], 14, -187363961); - b = md5_gg(b, c, d, a, x[i+ 8], 20, 1163531501); - a = md5_gg(a, b, c, d, x[i+13], 5 , -1444681467); - d = md5_gg(d, a, b, c, x[i+ 2], 9 , -51403784); - c = md5_gg(c, d, a, b, x[i+ 7], 14, 1735328473); - b = md5_gg(b, c, d, a, x[i+12], 20, -1926607734); +exports.pbkdf2Sync = function (password, salt, iterations, keylen, digest) { + if (!Buffer.isBuffer(password)) password = new Buffer(password, defaultEncoding) + if (!Buffer.isBuffer(salt)) salt = new Buffer(salt, defaultEncoding) - a = md5_hh(a, b, c, d, x[i+ 5], 4 , -378558); - d = md5_hh(d, a, b, c, x[i+ 8], 11, -2022574463); - c = md5_hh(c, d, a, b, x[i+11], 16, 1839030562); - b = md5_hh(b, c, d, a, x[i+14], 23, -35309556); - a = md5_hh(a, b, c, d, x[i+ 1], 4 , -1530992060); - d = md5_hh(d, a, b, c, x[i+ 4], 11, 1272893353); - c = md5_hh(c, d, a, b, x[i+ 7], 16, -155497632); - b = md5_hh(b, c, d, a, x[i+10], 23, -1094730640); - a = md5_hh(a, b, c, d, x[i+13], 4 , 681279174); - d = md5_hh(d, a, b, c, x[i+ 0], 11, -358537222); - c = md5_hh(c, d, a, b, x[i+ 3], 16, -722521979); - b = md5_hh(b, c, d, a, x[i+ 6], 23, 76029189); - a = md5_hh(a, b, c, d, x[i+ 9], 4 , -640364487); - d = md5_hh(d, a, b, c, x[i+12], 11, -421815835); - c = md5_hh(c, d, a, b, x[i+15], 16, 530742520); - b = md5_hh(b, c, d, a, x[i+ 2], 23, -995338651); + checkParameters(iterations, keylen) - a = md5_ii(a, b, c, d, x[i+ 0], 6 , -198630844); - d = md5_ii(d, a, b, c, x[i+ 7], 10, 1126891415); - c = md5_ii(c, d, a, b, x[i+14], 15, -1416354905); - b = md5_ii(b, c, d, a, x[i+ 5], 21, -57434055); - a = md5_ii(a, b, c, d, x[i+12], 6 , 1700485571); - d = md5_ii(d, a, b, c, x[i+ 3], 10, -1894986606); - c = md5_ii(c, d, a, b, x[i+10], 15, -1051523); - b = md5_ii(b, c, d, a, x[i+ 1], 21, -2054922799); - a = md5_ii(a, b, c, d, x[i+ 8], 6 , 1873313359); - d = md5_ii(d, a, b, c, x[i+15], 10, -30611744); - c = md5_ii(c, d, a, b, x[i+ 6], 15, -1560198380); - b = md5_ii(b, c, d, a, x[i+13], 21, 1309151649); - a = md5_ii(a, b, c, d, x[i+ 4], 6 , -145523070); - d = md5_ii(d, a, b, c, x[i+11], 10, -1120210379); - c = md5_ii(c, d, a, b, x[i+ 2], 15, 718787259); - b = md5_ii(b, c, d, a, x[i+ 9], 21, -343485551); + digest = digest || 'sha1' - a = safe_add(a, olda); - b = safe_add(b, oldb); - c = safe_add(c, oldc); - d = safe_add(d, oldd); - } - return Array(a, b, c, d); + var hLen + var l = 1 + var DK = new Buffer(keylen) + var block1 = new Buffer(salt.length + 4) + salt.copy(block1, 0, 0, salt.length) - } + var r + var T - /* - * These functions implement the four basic operations the algorithm uses. - */ - function md5_cmn(q, a, b, x, s, t) - { - return safe_add(bit_rol(safe_add(safe_add(a, q), safe_add(x, t)), s),b); - } - function md5_ff(a, b, c, d, x, s, t) - { - return md5_cmn((b & c) | ((~b) & d), a, b, x, s, t); - } - function md5_gg(a, b, c, d, x, s, t) - { - return md5_cmn((b & d) | (c & (~d)), a, b, x, s, t); - } - function md5_hh(a, b, c, d, x, s, t) - { - return md5_cmn(b ^ c ^ d, a, b, x, s, t); - } - function md5_ii(a, b, c, d, x, s, t) - { - return md5_cmn(c ^ (b | (~d)), a, b, x, s, t); - } + for (var i = 1; i <= l; i++) { + block1.writeUInt32BE(i, salt.length) + var U = createHmac(digest, password).update(block1).digest() - /* - * Add integers, wrapping at 2^32. This uses 16-bit operations internally - * to work around bugs in some JS interpreters. - */ - function safe_add(x, y) - { - var lsw = (x & 0xFFFF) + (y & 0xFFFF); - var msw = (x >> 16) + (y >> 16) + (lsw >> 16); - return (msw << 16) | (lsw & 0xFFFF); - } + if (!hLen) { + hLen = U.length + T = new Buffer(hLen) + l = Math.ceil(keylen / hLen) + r = keylen - (l - 1) * hLen + } - /* - * Bitwise rotate a 32-bit number to the left. - */ - function bit_rol(num, cnt) - { - return (num << cnt) | (num >>> (32 - cnt)); - } + U.copy(T, 0, 0, hLen) - module.exports = function md5(buf) { - return helpers.hash(buf, core_md5, 16); - }; + for (var j = 1; j < iterations; j++) { + U = createHmac(digest, password).update(U).digest() + for (var k = 0; k < hLen; k++) T[k] ^= U[k] + } + var destPos = (i - 1) * hLen + var len = (i === l ? r : hLen) + T.copy(DK, destPos, 0, len) + } + + return DK +} + +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5), __webpack_require__(0).Buffer)) /***/ }, /* 109 */ /***/ function(module, exports, __webpack_require__) { - /* WEBPACK VAR INJECTION */(function(Buffer) {var intSize = 4; - var zeroBuffer = new Buffer(intSize); zeroBuffer.fill(0); - var chrsz = 8; +/* WEBPACK VAR INJECTION */(function(Buffer) {var createHash = __webpack_require__(18); +module.exports = function (seed, len) { + var t = new Buffer(''); + var i = 0, c; + while (t.length < len) { + c = i2ops(i++); + t = Buffer.concat([t, createHash('sha1').update(seed).update(c).digest()]); + } + return t.slice(0, len); +}; - function toArray(buf, bigEndian) { - if ((buf.length % intSize) !== 0) { - var len = buf.length + (intSize - (buf.length % intSize)); - buf = Buffer.concat([buf, zeroBuffer], len); - } - - var arr = []; - var fn = bigEndian ? buf.readInt32BE : buf.readInt32LE; - for (var i = 0; i < buf.length; i += intSize) { - arr.push(fn.call(buf, i)); - } - return arr; - } - - function toBuffer(arr, size, bigEndian) { - var buf = new Buffer(size); - var fn = bigEndian ? buf.writeInt32BE : buf.writeInt32LE; - for (var i = 0; i < arr.length; i++) { - fn.call(buf, arr[i], i * 4, true); - } - return buf; - } - - function hash(buf, fn, hashSize, bigEndian) { - if (!Buffer.isBuffer(buf)) buf = new Buffer(buf); - var arr = fn(toArray(buf, bigEndian), buf.length * chrsz); - return toBuffer(arr, hashSize, bigEndian); - } - - module.exports = { hash: hash }; - - /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(58).Buffer)) +function i2ops(c) { + var out = new Buffer(4); + out.writeUInt32BE(c,0); + return out; +} +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer)) /***/ }, /* 110 */ /***/ function(module, exports, __webpack_require__) { - /* WEBPACK VAR INJECTION */(function(Buffer) { - module.exports = ripemd160 +/* WEBPACK VAR INJECTION */(function(Buffer) {var bn = __webpack_require__(4); +function withPublic(paddedMsg, key) { + return new Buffer(paddedMsg + .toRed(bn.mont(key.modulus)) + .redPow(new bn(key.publicExponent)) + .fromRed() + .toArray()); +} - - - /* - CryptoJS v3.1.2 - code.google.com/p/crypto-js - (c) 2009-2013 by Jeff Mott. All rights reserved. - code.google.com/p/crypto-js/wiki/License - */ - /** @preserve - (c) 2012 by Cédric Mesnil. All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - // Constants table - var zl = [ - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, - 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8, - 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12, - 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2, - 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13]; - var zr = [ - 5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12, - 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2, - 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13, - 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14, - 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11]; - var sl = [ - 11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8, - 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12, - 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5, - 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12, - 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6 ]; - var sr = [ - 8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6, - 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11, - 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5, - 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8, - 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11 ]; - - var hl = [ 0x00000000, 0x5A827999, 0x6ED9EBA1, 0x8F1BBCDC, 0xA953FD4E]; - var hr = [ 0x50A28BE6, 0x5C4DD124, 0x6D703EF3, 0x7A6D76E9, 0x00000000]; - - var bytesToWords = function (bytes) { - var words = []; - for (var i = 0, b = 0; i < bytes.length; i++, b += 8) { - words[b >>> 5] |= bytes[i] << (24 - b % 32); - } - return words; - }; - - var wordsToBytes = function (words) { - var bytes = []; - for (var b = 0; b < words.length * 32; b += 8) { - bytes.push((words[b >>> 5] >>> (24 - b % 32)) & 0xFF); - } - return bytes; - }; - - var processBlock = function (H, M, offset) { - - // Swap endian - for (var i = 0; i < 16; i++) { - var offset_i = offset + i; - var M_offset_i = M[offset_i]; - - // Swap - M[offset_i] = ( - (((M_offset_i << 8) | (M_offset_i >>> 24)) & 0x00ff00ff) | - (((M_offset_i << 24) | (M_offset_i >>> 8)) & 0xff00ff00) - ); - } - - // Working variables - var al, bl, cl, dl, el; - var ar, br, cr, dr, er; - - ar = al = H[0]; - br = bl = H[1]; - cr = cl = H[2]; - dr = dl = H[3]; - er = el = H[4]; - // Computation - var t; - for (var i = 0; i < 80; i += 1) { - t = (al + M[offset+zl[i]])|0; - if (i<16){ - t += f1(bl,cl,dl) + hl[0]; - } else if (i<32) { - t += f2(bl,cl,dl) + hl[1]; - } else if (i<48) { - t += f3(bl,cl,dl) + hl[2]; - } else if (i<64) { - t += f4(bl,cl,dl) + hl[3]; - } else {// if (i<80) { - t += f5(bl,cl,dl) + hl[4]; - } - t = t|0; - t = rotl(t,sl[i]); - t = (t+el)|0; - al = el; - el = dl; - dl = rotl(cl, 10); - cl = bl; - bl = t; - - t = (ar + M[offset+zr[i]])|0; - if (i<16){ - t += f5(br,cr,dr) + hr[0]; - } else if (i<32) { - t += f4(br,cr,dr) + hr[1]; - } else if (i<48) { - t += f3(br,cr,dr) + hr[2]; - } else if (i<64) { - t += f2(br,cr,dr) + hr[3]; - } else {// if (i<80) { - t += f1(br,cr,dr) + hr[4]; - } - t = t|0; - t = rotl(t,sr[i]) ; - t = (t+er)|0; - ar = er; - er = dr; - dr = rotl(cr, 10); - cr = br; - br = t; - } - // Intermediate hash value - t = (H[1] + cl + dr)|0; - H[1] = (H[2] + dl + er)|0; - H[2] = (H[3] + el + ar)|0; - H[3] = (H[4] + al + br)|0; - H[4] = (H[0] + bl + cr)|0; - H[0] = t; - }; - - function f1(x, y, z) { - return ((x) ^ (y) ^ (z)); - } - - function f2(x, y, z) { - return (((x)&(y)) | ((~x)&(z))); - } - - function f3(x, y, z) { - return (((x) | (~(y))) ^ (z)); - } - - function f4(x, y, z) { - return (((x) & (z)) | ((y)&(~(z)))); - } - - function f5(x, y, z) { - return ((x) ^ ((y) |(~(z)))); - } - - function rotl(x,n) { - return (x<>>(32-n)); - } - - function ripemd160(message) { - var H = [0x67452301, 0xEFCDAB89, 0x98BADCFE, 0x10325476, 0xC3D2E1F0]; - - if (typeof message == 'string') - message = new Buffer(message, 'utf8'); - - var m = bytesToWords(message); - - var nBitsLeft = message.length * 8; - var nBitsTotal = message.length * 8; - - // Add padding - m[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32); - m[(((nBitsLeft + 64) >>> 9) << 4) + 14] = ( - (((nBitsTotal << 8) | (nBitsTotal >>> 24)) & 0x00ff00ff) | - (((nBitsTotal << 24) | (nBitsTotal >>> 8)) & 0xff00ff00) - ); - - for (var i=0 ; i>> 24)) & 0x00ff00ff) | - (((H_i << 24) | (H_i >>> 8)) & 0xff00ff00); - } - - var digestbytes = wordsToBytes(H); - return new Buffer(digestbytes); - } - - - - /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(58).Buffer)) +module.exports = withPublic; +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer)) /***/ }, /* 111 */ -/***/ function(module, exports, __webpack_require__) { +/***/ function(module, exports) { - /* WEBPACK VAR INJECTION */(function(Buffer) {var createHash = __webpack_require__(102) - - var zeroBuffer = new Buffer(128) - zeroBuffer.fill(0) - - module.exports = Hmac - - function Hmac (alg, key) { - if(!(this instanceof Hmac)) return new Hmac(alg, key) - this._opad = opad - this._alg = alg - - var blocksize = (alg === 'sha512') ? 128 : 64 - - key = this._key = !Buffer.isBuffer(key) ? new Buffer(key) : key - - if(key.length > blocksize) { - key = createHash(alg).update(key).digest() - } else if(key.length < blocksize) { - key = Buffer.concat([key, zeroBuffer], blocksize) - } - - var ipad = this._ipad = new Buffer(blocksize) - var opad = this._opad = new Buffer(blocksize) - - for(var i = 0; i < blocksize; i++) { - ipad[i] = key[i] ^ 0x36 - opad[i] = key[i] ^ 0x5C - } - - this._hash = createHash(alg).update(ipad) - } - - Hmac.prototype.update = function (data, enc) { - this._hash.update(data, enc) - return this - } - - Hmac.prototype.digest = function (enc) { - var h = this._hash.digest() - return createHash(this._alg).update(this._opad).update(h).digest(enc) - } - - - /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(58).Buffer)) +module.exports = function xor(a, b) { + var len = a.length; + var i = -1; + while (++i < len) { + a[i] ^= b[i]; + } + return a +}; /***/ }, /* 112 */ /***/ function(module, exports, __webpack_require__) { - var pbkdf2Export = __webpack_require__(113) +"use strict"; +// a passthrough stream. +// basically just the most minimal sort of Transform stream. +// Every written chunk gets output as-is. - module.exports = function (crypto, exports) { - exports = exports || {} +'use strict'; - var exported = pbkdf2Export(crypto) +module.exports = PassThrough; - exports.pbkdf2 = exported.pbkdf2 - exports.pbkdf2Sync = exported.pbkdf2Sync +var Transform = __webpack_require__(54); - return exports - } +/**/ +var util = __webpack_require__(25); +util.inherits = __webpack_require__(1); +/**/ +util.inherits(PassThrough, Transform); + +function PassThrough(options) { + if (!(this instanceof PassThrough)) return new PassThrough(options); + + Transform.call(this, options); +} + +PassThrough.prototype._transform = function (chunk, encoding, cb) { + cb(null, chunk); +}; /***/ }, /* 113 */ /***/ function(module, exports, __webpack_require__) { - /* WEBPACK VAR INJECTION */(function(Buffer) {module.exports = function(crypto) { - function pbkdf2(password, salt, iterations, keylen, digest, callback) { - if ('function' === typeof digest) { - callback = digest - digest = undefined - } +"use strict"; +/* WEBPACK VAR INJECTION */(function(process) {'use strict'; - if ('function' !== typeof callback) - throw new Error('No callback provided to pbkdf2') +module.exports = Readable; - setTimeout(function() { - var result +/**/ +var processNextTick = __webpack_require__(53); +/**/ - try { - result = pbkdf2Sync(password, salt, iterations, keylen, digest) - } catch (e) { - return callback(e) - } +/**/ +var isArray = __webpack_require__(102); +/**/ - callback(undefined, result) - }) - } +Readable.ReadableState = ReadableState; - function pbkdf2Sync(password, salt, iterations, keylen, digest) { - if ('number' !== typeof iterations) - throw new TypeError('Iterations not a number') +/**/ +var EE = __webpack_require__(3).EventEmitter; - if (iterations < 0) - throw new TypeError('Bad iterations') +var EElistenerCount = function (emitter, type) { + return emitter.listeners(type).length; +}; +/**/ - if ('number' !== typeof keylen) - throw new TypeError('Key length not a number') +/**/ +var Stream; +(function () { + try { + Stream = __webpack_require__(9); + } catch (_) {} finally { + if (!Stream) Stream = __webpack_require__(3).EventEmitter; + } +})(); +/**/ - if (keylen < 0) - throw new TypeError('Bad key length') +var Buffer = __webpack_require__(0).Buffer; +/**/ +var bufferShim = __webpack_require__(49); +/**/ - digest = digest || 'sha1' +/**/ +var util = __webpack_require__(25); +util.inherits = __webpack_require__(1); +/**/ - if (!Buffer.isBuffer(password)) password = new Buffer(password) - if (!Buffer.isBuffer(salt)) salt = new Buffer(salt) +/**/ +var debugUtil = __webpack_require__(279); +var debug = void 0; +if (debugUtil && debugUtil.debuglog) { + debug = debugUtil.debuglog('stream'); +} else { + debug = function () {}; +} +/**/ - var hLen, l = 1, r, T - var DK = new Buffer(keylen) - var block1 = new Buffer(salt.length + 4) - salt.copy(block1, 0, 0, salt.length) +var BufferList = __webpack_require__(223); +var StringDecoder; - for (var i = 1; i <= l; i++) { - block1.writeUInt32BE(i, salt.length) +util.inherits(Readable, Stream); - var U = crypto.createHmac(digest, password).update(block1).digest() +function prependListener(emitter, event, fn) { + if (typeof emitter.prependListener === 'function') { + return emitter.prependListener(event, fn); + } else { + // This is a hack to make sure that our error handler is attached before any + // userland ones. NEVER DO THIS. This is here only because this code needs + // to continue to work with older versions of Node.js that do not include + // the prependListener() method. The goal is to eventually remove this hack. + if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);else if (isArray(emitter._events[event])) emitter._events[event].unshift(fn);else emitter._events[event] = [fn, emitter._events[event]]; + } +} - if (!hLen) { - hLen = U.length - T = new Buffer(hLen) - l = Math.ceil(keylen / hLen) - r = keylen - (l - 1) * hLen +var Duplex; +function ReadableState(options, stream) { + Duplex = Duplex || __webpack_require__(15); - if (keylen > (Math.pow(2, 32) - 1) * hLen) - throw new TypeError('keylen exceeds maximum length') - } + options = options || {}; - U.copy(T, 0, 0, hLen) + // object stream flag. Used to make read(n) ignore n and to + // make all the buffer merging and length checks go away + this.objectMode = !!options.objectMode; - for (var j = 1; j < iterations; j++) { - U = crypto.createHmac(digest, password).update(U).digest() + if (stream instanceof Duplex) this.objectMode = this.objectMode || !!options.readableObjectMode; - for (var k = 0; k < hLen; k++) { - T[k] ^= U[k] - } - } + // the point at which it stops calling _read() to fill the buffer + // Note: 0 is a valid value, means "don't call _read preemptively ever" + var hwm = options.highWaterMark; + var defaultHwm = this.objectMode ? 16 : 16 * 1024; + this.highWaterMark = hwm || hwm === 0 ? hwm : defaultHwm; - var destPos = (i - 1) * hLen - var len = (i == l ? r : hLen) - T.copy(DK, destPos, 0, len) - } + // cast to ints. + this.highWaterMark = ~ ~this.highWaterMark; - return DK - } + // A linked list is used to store data chunks instead of an array because the + // linked list can remove elements from the beginning faster than + // array.shift() + this.buffer = new BufferList(); + this.length = 0; + this.pipes = null; + this.pipesCount = 0; + this.flowing = null; + this.ended = false; + this.endEmitted = false; + this.reading = false; - return { - pbkdf2: pbkdf2, - pbkdf2Sync: pbkdf2Sync - } - } + // a flag to be able to tell if the onwrite cb is called immediately, + // or on a later tick. We set this to true at first, because any + // actions that shouldn't happen until "later" should generally also + // not happen before the first write call. + this.sync = true; - /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(58).Buffer)) + // whenever we return null, then we set a flag to say + // that we're awaiting a 'readable' event emission. + this.needReadable = false; + this.emittedReadable = false; + this.readableListening = false; + this.resumeScheduled = false; + + // Crypto is kind of old and crusty. Historically, its default string + // encoding is 'binary' so we have to make this configurable. + // Everything else in the universe uses 'utf8', though. + this.defaultEncoding = options.defaultEncoding || 'utf8'; + + // when piping, we only care about 'readable' events that happen + // after read()ing all the bytes and not getting any pushback. + this.ranOut = false; + + // the number of writers that are awaiting a drain event in .pipe()s + this.awaitDrain = 0; + + // if true, a maybeReadMore has been scheduled + this.readingMore = false; + + this.decoder = null; + this.encoding = null; + if (options.encoding) { + if (!StringDecoder) StringDecoder = __webpack_require__(56).StringDecoder; + this.decoder = new StringDecoder(options.encoding); + this.encoding = options.encoding; + } +} + +var Duplex; +function Readable(options) { + Duplex = Duplex || __webpack_require__(15); + + if (!(this instanceof Readable)) return new Readable(options); + + this._readableState = new ReadableState(options, this); + + // legacy + this.readable = true; + + if (options && typeof options.read === 'function') this._read = options.read; + + Stream.call(this); +} + +// Manually shove something into the read() buffer. +// This returns true if the highWaterMark has not been hit yet, +// similar to how Writable.write() returns true if you should +// write() some more. +Readable.prototype.push = function (chunk, encoding) { + var state = this._readableState; + + if (!state.objectMode && typeof chunk === 'string') { + encoding = encoding || state.defaultEncoding; + if (encoding !== state.encoding) { + chunk = bufferShim.from(chunk, encoding); + encoding = ''; + } + } + + return readableAddChunk(this, state, chunk, encoding, false); +}; + +// Unshift should *always* be something directly out of read() +Readable.prototype.unshift = function (chunk) { + var state = this._readableState; + return readableAddChunk(this, state, chunk, '', true); +}; + +Readable.prototype.isPaused = function () { + return this._readableState.flowing === false; +}; + +function readableAddChunk(stream, state, chunk, encoding, addToFront) { + var er = chunkInvalid(state, chunk); + if (er) { + stream.emit('error', er); + } else if (chunk === null) { + state.reading = false; + onEofChunk(stream, state); + } else if (state.objectMode || chunk && chunk.length > 0) { + if (state.ended && !addToFront) { + var e = new Error('stream.push() after EOF'); + stream.emit('error', e); + } else if (state.endEmitted && addToFront) { + var _e = new Error('stream.unshift() after end event'); + stream.emit('error', _e); + } else { + var skipAdd; + if (state.decoder && !addToFront && !encoding) { + chunk = state.decoder.write(chunk); + skipAdd = !state.objectMode && chunk.length === 0; + } + + if (!addToFront) state.reading = false; + + // Don't add to the buffer if we've decoded to an empty string chunk and + // we're not in object mode + if (!skipAdd) { + // if we want the data now, just emit it. + if (state.flowing && state.length === 0 && !state.sync) { + stream.emit('data', chunk); + stream.read(0); + } else { + // update the buffer info. + state.length += state.objectMode ? 1 : chunk.length; + if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk); + + if (state.needReadable) emitReadable(stream); + } + } + + maybeReadMore(stream, state); + } + } else if (!addToFront) { + state.reading = false; + } + + return needMoreData(state); +} + +// if it's past the high water mark, we can push in some more. +// Also, if we have no data yet, we can stand some +// more bytes. This is to work around cases where hwm=0, +// such as the repl. Also, if the push() triggered a +// readable event, and the user called read(largeNumber) such that +// needReadable was set, then we ought to push more, so that another +// 'readable' event will be triggered. +function needMoreData(state) { + return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0); +} + +// backwards compatibility. +Readable.prototype.setEncoding = function (enc) { + if (!StringDecoder) StringDecoder = __webpack_require__(56).StringDecoder; + this._readableState.decoder = new StringDecoder(enc); + this._readableState.encoding = enc; + return this; +}; + +// Don't raise the hwm > 8MB +var MAX_HWM = 0x800000; +function computeNewHighWaterMark(n) { + if (n >= MAX_HWM) { + n = MAX_HWM; + } else { + // Get the next highest power of 2 to prevent increasing hwm excessively in + // tiny amounts + n--; + n |= n >>> 1; + n |= n >>> 2; + n |= n >>> 4; + n |= n >>> 8; + n |= n >>> 16; + n++; + } + return n; +} + +// This function is designed to be inlinable, so please take care when making +// changes to the function body. +function howMuchToRead(n, state) { + if (n <= 0 || state.length === 0 && state.ended) return 0; + if (state.objectMode) return 1; + if (n !== n) { + // Only flow one buffer at a time + if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length; + } + // If we're asking for more than the current hwm, then raise the hwm. + if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n); + if (n <= state.length) return n; + // Don't have enough + if (!state.ended) { + state.needReadable = true; + return 0; + } + return state.length; +} + +// you can override either this method, or the async _read(n) below. +Readable.prototype.read = function (n) { + debug('read', n); + n = parseInt(n, 10); + var state = this._readableState; + var nOrig = n; + + if (n !== 0) state.emittedReadable = false; + + // if we're doing read(0) to trigger a readable event, but we + // already have a bunch of data in the buffer, then just trigger + // the 'readable' event and move on. + if (n === 0 && state.needReadable && (state.length >= state.highWaterMark || state.ended)) { + debug('read: emitReadable', state.length, state.ended); + if (state.length === 0 && state.ended) endReadable(this);else emitReadable(this); + return null; + } + + n = howMuchToRead(n, state); + + // if we've ended, and we're now clear, then finish it up. + if (n === 0 && state.ended) { + if (state.length === 0) endReadable(this); + return null; + } + + // All the actual chunk generation logic needs to be + // *below* the call to _read. The reason is that in certain + // synthetic stream cases, such as passthrough streams, _read + // may be a completely synchronous operation which may change + // the state of the read buffer, providing enough data when + // before there was *not* enough. + // + // So, the steps are: + // 1. Figure out what the state of things will be after we do + // a read from the buffer. + // + // 2. If that resulting state will trigger a _read, then call _read. + // Note that this may be asynchronous, or synchronous. Yes, it is + // deeply ugly to write APIs this way, but that still doesn't mean + // that the Readable class should behave improperly, as streams are + // designed to be sync/async agnostic. + // Take note if the _read call is sync or async (ie, if the read call + // has returned yet), so that we know whether or not it's safe to emit + // 'readable' etc. + // + // 3. Actually pull the requested chunks out of the buffer and return. + + // if we need a readable event, then we need to do some reading. + var doRead = state.needReadable; + debug('need readable', doRead); + + // if we currently have less than the highWaterMark, then also read some + if (state.length === 0 || state.length - n < state.highWaterMark) { + doRead = true; + debug('length less than watermark', doRead); + } + + // however, if we've ended, then there's no point, and if we're already + // reading, then it's unnecessary. + if (state.ended || state.reading) { + doRead = false; + debug('reading or ended', doRead); + } else if (doRead) { + debug('do read'); + state.reading = true; + state.sync = true; + // if the length is currently zero, then we *need* a readable event. + if (state.length === 0) state.needReadable = true; + // call internal read method + this._read(state.highWaterMark); + state.sync = false; + // If _read pushed data synchronously, then `reading` will be false, + // and we need to re-evaluate how much data we can return to the user. + if (!state.reading) n = howMuchToRead(nOrig, state); + } + + var ret; + if (n > 0) ret = fromList(n, state);else ret = null; + + if (ret === null) { + state.needReadable = true; + n = 0; + } else { + state.length -= n; + } + + if (state.length === 0) { + // If we have nothing in the buffer, then we want to know + // as soon as we *do* get something into the buffer. + if (!state.ended) state.needReadable = true; + + // If we tried to read() past the EOF, then emit end on the next tick. + if (nOrig !== n && state.ended) endReadable(this); + } + + if (ret !== null) this.emit('data', ret); + + return ret; +}; + +function chunkInvalid(state, chunk) { + var er = null; + if (!Buffer.isBuffer(chunk) && typeof chunk !== 'string' && chunk !== null && chunk !== undefined && !state.objectMode) { + er = new TypeError('Invalid non-string/buffer chunk'); + } + return er; +} + +function onEofChunk(stream, state) { + if (state.ended) return; + if (state.decoder) { + var chunk = state.decoder.end(); + if (chunk && chunk.length) { + state.buffer.push(chunk); + state.length += state.objectMode ? 1 : chunk.length; + } + } + state.ended = true; + + // emit 'readable' now to make sure it gets picked up. + emitReadable(stream); +} + +// Don't emit readable right away in sync mode, because this can trigger +// another read() call => stack overflow. This way, it might trigger +// a nextTick recursion warning, but that's not so bad. +function emitReadable(stream) { + var state = stream._readableState; + state.needReadable = false; + if (!state.emittedReadable) { + debug('emitReadable', state.flowing); + state.emittedReadable = true; + if (state.sync) processNextTick(emitReadable_, stream);else emitReadable_(stream); + } +} + +function emitReadable_(stream) { + debug('emit readable'); + stream.emit('readable'); + flow(stream); +} + +// at this point, the user has presumably seen the 'readable' event, +// and called read() to consume some data. that may have triggered +// in turn another _read(n) call, in which case reading = true if +// it's in progress. +// However, if we're not ended, or reading, and the length < hwm, +// then go ahead and try to read some more preemptively. +function maybeReadMore(stream, state) { + if (!state.readingMore) { + state.readingMore = true; + processNextTick(maybeReadMore_, stream, state); + } +} + +function maybeReadMore_(stream, state) { + var len = state.length; + while (!state.reading && !state.flowing && !state.ended && state.length < state.highWaterMark) { + debug('maybeReadMore read 0'); + stream.read(0); + if (len === state.length) + // didn't get any data, stop spinning. + break;else len = state.length; + } + state.readingMore = false; +} + +// abstract method. to be overridden in specific implementation classes. +// call cb(er, data) where data is <= n in length. +// for virtual (non-string, non-buffer) streams, "length" is somewhat +// arbitrary, and perhaps not very meaningful. +Readable.prototype._read = function (n) { + this.emit('error', new Error('not implemented')); +}; + +Readable.prototype.pipe = function (dest, pipeOpts) { + var src = this; + var state = this._readableState; + + switch (state.pipesCount) { + case 0: + state.pipes = dest; + break; + case 1: + state.pipes = [state.pipes, dest]; + break; + default: + state.pipes.push(dest); + break; + } + state.pipesCount += 1; + debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts); + + var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr; + + var endFn = doEnd ? onend : cleanup; + if (state.endEmitted) processNextTick(endFn);else src.once('end', endFn); + + dest.on('unpipe', onunpipe); + function onunpipe(readable) { + debug('onunpipe'); + if (readable === src) { + cleanup(); + } + } + + function onend() { + debug('onend'); + dest.end(); + } + + // when the dest drains, it reduces the awaitDrain counter + // on the source. This would be more elegant with a .once() + // handler in flow(), but adding and removing repeatedly is + // too slow. + var ondrain = pipeOnDrain(src); + dest.on('drain', ondrain); + + var cleanedUp = false; + function cleanup() { + debug('cleanup'); + // cleanup event handlers once the pipe is broken + dest.removeListener('close', onclose); + dest.removeListener('finish', onfinish); + dest.removeListener('drain', ondrain); + dest.removeListener('error', onerror); + dest.removeListener('unpipe', onunpipe); + src.removeListener('end', onend); + src.removeListener('end', cleanup); + src.removeListener('data', ondata); + + cleanedUp = true; + + // if the reader is waiting for a drain event from this + // specific writer, then it would cause it to never start + // flowing again. + // So, if this is awaiting a drain, then we just call it now. + // If we don't know, then assume that we are waiting for one. + if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain(); + } + + // If the user pushes more data while we're writing to dest then we'll end up + // in ondata again. However, we only want to increase awaitDrain once because + // dest will only emit one 'drain' event for the multiple writes. + // => Introduce a guard on increasing awaitDrain. + var increasedAwaitDrain = false; + src.on('data', ondata); + function ondata(chunk) { + debug('ondata'); + increasedAwaitDrain = false; + var ret = dest.write(chunk); + if (false === ret && !increasedAwaitDrain) { + // If the user unpiped during `dest.write()`, it is possible + // to get stuck in a permanently paused state if that write + // also returned false. + // => Check whether `dest` is still a piping destination. + if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) { + debug('false write response, pause', src._readableState.awaitDrain); + src._readableState.awaitDrain++; + increasedAwaitDrain = true; + } + src.pause(); + } + } + + // if the dest has an error, then stop piping into it. + // however, don't suppress the throwing behavior for this. + function onerror(er) { + debug('onerror', er); + unpipe(); + dest.removeListener('error', onerror); + if (EElistenerCount(dest, 'error') === 0) dest.emit('error', er); + } + + // Make sure our error handler is attached before userland ones. + prependListener(dest, 'error', onerror); + + // Both close and finish should trigger unpipe, but only once. + function onclose() { + dest.removeListener('finish', onfinish); + unpipe(); + } + dest.once('close', onclose); + function onfinish() { + debug('onfinish'); + dest.removeListener('close', onclose); + unpipe(); + } + dest.once('finish', onfinish); + + function unpipe() { + debug('unpipe'); + src.unpipe(dest); + } + + // tell the dest that it's being piped to + dest.emit('pipe', src); + + // start the flow if it hasn't been started already. + if (!state.flowing) { + debug('pipe resume'); + src.resume(); + } + + return dest; +}; + +function pipeOnDrain(src) { + return function () { + var state = src._readableState; + debug('pipeOnDrain', state.awaitDrain); + if (state.awaitDrain) state.awaitDrain--; + if (state.awaitDrain === 0 && EElistenerCount(src, 'data')) { + state.flowing = true; + flow(src); + } + }; +} + +Readable.prototype.unpipe = function (dest) { + var state = this._readableState; + + // if we're not piping anywhere, then do nothing. + if (state.pipesCount === 0) return this; + + // just one destination. most common case. + if (state.pipesCount === 1) { + // passed in one, but it's not the right one. + if (dest && dest !== state.pipes) return this; + + if (!dest) dest = state.pipes; + + // got a match. + state.pipes = null; + state.pipesCount = 0; + state.flowing = false; + if (dest) dest.emit('unpipe', this); + return this; + } + + // slow case. multiple pipe destinations. + + if (!dest) { + // remove all. + var dests = state.pipes; + var len = state.pipesCount; + state.pipes = null; + state.pipesCount = 0; + state.flowing = false; + + for (var _i = 0; _i < len; _i++) { + dests[_i].emit('unpipe', this); + }return this; + } + + // try to find the right one. + var i = indexOf(state.pipes, dest); + if (i === -1) return this; + + state.pipes.splice(i, 1); + state.pipesCount -= 1; + if (state.pipesCount === 1) state.pipes = state.pipes[0]; + + dest.emit('unpipe', this); + + return this; +}; + +// set up data events if they are asked for +// Ensure readable listeners eventually get something +Readable.prototype.on = function (ev, fn) { + var res = Stream.prototype.on.call(this, ev, fn); + + if (ev === 'data') { + // Start flowing on next tick if stream isn't explicitly paused + if (this._readableState.flowing !== false) this.resume(); + } else if (ev === 'readable') { + var state = this._readableState; + if (!state.endEmitted && !state.readableListening) { + state.readableListening = state.needReadable = true; + state.emittedReadable = false; + if (!state.reading) { + processNextTick(nReadingNextTick, this); + } else if (state.length) { + emitReadable(this, state); + } + } + } + + return res; +}; +Readable.prototype.addListener = Readable.prototype.on; + +function nReadingNextTick(self) { + debug('readable nexttick read 0'); + self.read(0); +} + +// pause() and resume() are remnants of the legacy readable stream API +// If the user uses them, then switch into old mode. +Readable.prototype.resume = function () { + var state = this._readableState; + if (!state.flowing) { + debug('resume'); + state.flowing = true; + resume(this, state); + } + return this; +}; + +function resume(stream, state) { + if (!state.resumeScheduled) { + state.resumeScheduled = true; + processNextTick(resume_, stream, state); + } +} + +function resume_(stream, state) { + if (!state.reading) { + debug('resume read 0'); + stream.read(0); + } + + state.resumeScheduled = false; + state.awaitDrain = 0; + stream.emit('resume'); + flow(stream); + if (state.flowing && !state.reading) stream.read(0); +} + +Readable.prototype.pause = function () { + debug('call pause flowing=%j', this._readableState.flowing); + if (false !== this._readableState.flowing) { + debug('pause'); + this._readableState.flowing = false; + this.emit('pause'); + } + return this; +}; + +function flow(stream) { + var state = stream._readableState; + debug('flow', state.flowing); + while (state.flowing && stream.read() !== null) {} +} + +// wrap an old-style stream as the async data source. +// This is *not* part of the readable stream interface. +// It is an ugly unfortunate mess of history. +Readable.prototype.wrap = function (stream) { + var state = this._readableState; + var paused = false; + + var self = this; + stream.on('end', function () { + debug('wrapped end'); + if (state.decoder && !state.ended) { + var chunk = state.decoder.end(); + if (chunk && chunk.length) self.push(chunk); + } + + self.push(null); + }); + + stream.on('data', function (chunk) { + debug('wrapped data'); + if (state.decoder) chunk = state.decoder.write(chunk); + + // don't skip over falsy values in objectMode + if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return; + + var ret = self.push(chunk); + if (!ret) { + paused = true; + stream.pause(); + } + }); + + // proxy all the other methods. + // important when wrapping filters and duplexes. + for (var i in stream) { + if (this[i] === undefined && typeof stream[i] === 'function') { + this[i] = function (method) { + return function () { + return stream[method].apply(stream, arguments); + }; + }(i); + } + } + + // proxy certain important events. + var events = ['error', 'close', 'destroy', 'pause', 'resume']; + forEach(events, function (ev) { + stream.on(ev, self.emit.bind(self, ev)); + }); + + // when we try to consume some more bytes, simply unpause the + // underlying stream. + self._read = function (n) { + debug('wrapped _read', n); + if (paused) { + paused = false; + stream.resume(); + } + }; + + return self; +}; + +// exposed for testing purposes only. +Readable._fromList = fromList; + +// Pluck off n bytes from an array of buffers. +// Length is the combined lengths of all the buffers in the list. +// This function is designed to be inlinable, so please take care when making +// changes to the function body. +function fromList(n, state) { + // nothing buffered + if (state.length === 0) return null; + + var ret; + if (state.objectMode) ret = state.buffer.shift();else if (!n || n >= state.length) { + // read it all, truncate the list + if (state.decoder) ret = state.buffer.join('');else if (state.buffer.length === 1) ret = state.buffer.head.data;else ret = state.buffer.concat(state.length); + state.buffer.clear(); + } else { + // read part of list + ret = fromListPartial(n, state.buffer, state.decoder); + } + + return ret; +} + +// Extracts only enough buffered data to satisfy the amount requested. +// This function is designed to be inlinable, so please take care when making +// changes to the function body. +function fromListPartial(n, list, hasStrings) { + var ret; + if (n < list.head.data.length) { + // slice is the same for buffers and strings + ret = list.head.data.slice(0, n); + list.head.data = list.head.data.slice(n); + } else if (n === list.head.data.length) { + // first chunk is a perfect match + ret = list.shift(); + } else { + // result spans more than one buffer + ret = hasStrings ? copyFromBufferString(n, list) : copyFromBuffer(n, list); + } + return ret; +} + +// Copies a specified amount of characters from the list of buffered data +// chunks. +// This function is designed to be inlinable, so please take care when making +// changes to the function body. +function copyFromBufferString(n, list) { + var p = list.head; + var c = 1; + var ret = p.data; + n -= ret.length; + while (p = p.next) { + var str = p.data; + var nb = n > str.length ? str.length : n; + if (nb === str.length) ret += str;else ret += str.slice(0, n); + n -= nb; + if (n === 0) { + if (nb === str.length) { + ++c; + if (p.next) list.head = p.next;else list.head = list.tail = null; + } else { + list.head = p; + p.data = str.slice(nb); + } + break; + } + ++c; + } + list.length -= c; + return ret; +} + +// Copies a specified amount of bytes from the list of buffered data chunks. +// This function is designed to be inlinable, so please take care when making +// changes to the function body. +function copyFromBuffer(n, list) { + var ret = bufferShim.allocUnsafe(n); + var p = list.head; + var c = 1; + p.data.copy(ret); + n -= p.data.length; + while (p = p.next) { + var buf = p.data; + var nb = n > buf.length ? buf.length : n; + buf.copy(ret, ret.length - n, 0, nb); + n -= nb; + if (n === 0) { + if (nb === buf.length) { + ++c; + if (p.next) list.head = p.next;else list.head = list.tail = null; + } else { + list.head = p; + p.data = buf.slice(nb); + } + break; + } + ++c; + } + list.length -= c; + return ret; +} + +function endReadable(stream) { + var state = stream._readableState; + + // If we get here before consuming all the bytes, then that is a + // bug in node. Should never happen. + if (state.length > 0) throw new Error('"endReadable()" called on non-empty stream'); + + if (!state.endEmitted) { + state.ended = true; + processNextTick(endReadableNT, state, stream); + } +} + +function endReadableNT(state, stream) { + // Check that we didn't get one last unshift. + if (!state.endEmitted && state.length === 0) { + state.endEmitted = true; + stream.readable = false; + stream.emit('end'); + } +} + +function forEach(xs, f) { + for (var i = 0, l = xs.length; i < l; i++) { + f(xs[i], i); + } +} + +function indexOf(xs, x) { + for (var i = 0, l = xs.length; i < l; i++) { + if (xs[i] === x) return i; + } + return -1; +} +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) /***/ }, /* 114 */ -/***/ function(module, exports) { +/***/ function(module, exports, __webpack_require__) { - 'use strict'; - - var has = Object.prototype.hasOwnProperty; - - /** - * An auto incrementing id which we can use to create "unique" Ultron instances - * so we can track the event emitters that are added through the Ultron - * interface. - * - * @type {Number} - * @private - */ - var id = 0; - - /** - * Ultron is high-intelligence robot. It gathers intelligence so it can start improving - * upon his rudimentary design. It will learn from your EventEmitting patterns - * and exterminate them. - * - * @constructor - * @param {EventEmitter} ee EventEmitter instance we need to wrap. - * @api public - */ - function Ultron(ee) { - if (!(this instanceof Ultron)) return new Ultron(ee); - - this.id = id++; - this.ee = ee; - } - - /** - * Register a new EventListener for the given event. - * - * @param {String} event Name of the event. - * @param {Functon} fn Callback function. - * @param {Mixed} context The context of the function. - * @returns {Ultron} - * @api public - */ - Ultron.prototype.on = function on(event, fn, context) { - fn.__ultron = this.id; - this.ee.on(event, fn, context); - - return this; - }; - /** - * Add an EventListener that's only called once. - * - * @param {String} event Name of the event. - * @param {Function} fn Callback function. - * @param {Mixed} context The context of the function. - * @returns {Ultron} - * @api public - */ - Ultron.prototype.once = function once(event, fn, context) { - fn.__ultron = this.id; - this.ee.once(event, fn, context); - - return this; - }; - - /** - * Remove the listeners we assigned for the given event. - * - * @returns {Ultron} - * @api public - */ - Ultron.prototype.remove = function remove() { - var args = arguments - , event; - - // - // When no event names are provided we assume that we need to clear all the - // events that were assigned through us. - // - if (args.length === 1 && 'string' === typeof args[0]) { - args = args[0].split(/[, ]+/); - } else if (!args.length) { - args = []; - - for (event in this.ee._events) { - if (has.call(this.ee._events, event)) args.push(event); - } - } - - for (var i = 0; i < args.length; i++) { - var listeners = this.ee.listeners(args[i]); - - for (var j = 0; j < listeners.length; j++) { - event = listeners[j]; - - // - // Once listeners have a `listener` property that stores the real listener - // in the EventEmitter that ships with Node.js. - // - if (event.listener) { - if (event.listener.__ultron !== this.id) continue; - delete event.listener.__ultron; - } else { - if (event.__ultron !== this.id) continue; - delete event.__ultron; - } - - this.ee.removeListener(args[i], event); - } - } - - return this; - }; - - /** - * Destroy the Ultron instance, remove all listeners and release all references. - * - * @returns {Boolean} - * @api public - */ - Ultron.prototype.destroy = function destroy() { - if (!this.ee) return false; - - this.remove(); - this.ee = null; - - return true; - }; - - // - // Expose the module. - // - module.exports = Ultron; +module.exports = __webpack_require__(54) /***/ }, /* 115 */ -/***/ function(module, exports, __webpack_require__) { +/***/ function(module, exports) { - /*! - * Copyright(c) 2011 Einar Otto Stangvik - * MIT Licensed - */ +/** + * Check if `obj` is an object. + * + * @param {Object} obj + * @return {Boolean} + * @api private + */ - var fs = __webpack_require__(62); +function isObject(obj) { + return null !== obj && 'object' === typeof obj; +} - function Options(defaults) { - var internalValues = {}; - var values = this.value = {}; - Object.keys(defaults).forEach(function(key) { - internalValues[key] = defaults[key]; - Object.defineProperty(values, key, { - get: function() { return internalValues[key]; }, - configurable: false, - enumerable: true - }); - }); - this.reset = function() { - Object.keys(defaults).forEach(function(key) { - internalValues[key] = defaults[key]; - }); - return this; - }; - this.merge = function(options, required) { - options = options || {}; - if (Object.prototype.toString.call(required) === '[object Array]') { - var missing = []; - for (var i = 0, l = required.length; i < l; ++i) { - var key = required[i]; - if (!(key in options)) { - missing.push(key); - } - } - if (missing.length > 0) { - if (missing.length > 1) { - throw new Error('options ' + - missing.slice(0, missing.length - 1).join(', ') + ' and ' + - missing[missing.length - 1] + ' must be defined'); - } - else throw new Error('option ' + missing[0] + ' must be defined'); - } - } - Object.keys(options).forEach(function(key) { - if (key in internalValues) { - internalValues[key] = options[key]; - } - }); - return this; - }; - this.copy = function(keys) { - var obj = {}; - Object.keys(defaults).forEach(function(key) { - if (keys.indexOf(key) !== -1) { - obj[key] = values[key]; - } - }); - return obj; - }; - this.read = function(filename, cb) { - if (typeof cb == 'function') { - var self = this; - fs.readFile(filename, function(error, data) { - if (error) return cb(error); - var conf = JSON.parse(data); - self.merge(conf); - cb(); - }); - } - else { - var conf = JSON.parse(fs.readFileSync(filename)); - this.merge(conf); - } - return this; - }; - this.isDefined = function(key) { - return typeof values[key] != 'undefined'; - }; - this.isDefinedAndNonNull = function(key) { - return typeof values[key] != 'undefined' && values[key] !== null; - }; - Object.freeze(values); - Object.freeze(this); - } - - module.exports = Options; +module.exports = isObject; /***/ }, /* 116 */ /***/ function(module, exports, __webpack_require__) { - /* WEBPACK VAR INJECTION */(function(Buffer) {/*! - * ws: a node.js websocket client - * Copyright(c) 2011 Einar Otto Stangvik - * MIT Licensed - */ +(function(nacl) { +'use strict'; - var events = __webpack_require__(3) - , util = __webpack_require__(75) - , EventEmitter = events.EventEmitter - , ErrorCodes = __webpack_require__(117) - , bufferUtil = __webpack_require__(118).BufferUtil - , PerMessageDeflate = __webpack_require__(125); +// Ported in 2014 by Dmitry Chestnykh and Devi Mandiri. +// Public domain. +// +// Implementation derived from TweetNaCl version 20140427. +// See for details: http://tweetnacl.cr.yp.to/ - /** - * HyBi Sender implementation - */ +var gf = function(init) { + var i, r = new Float64Array(16); + if (init) for (i = 0; i < init.length; i++) r[i] = init[i]; + return r; +}; - function Sender(socket, extensions) { - if (this instanceof Sender === false) { - throw new TypeError("Classes can't be function-called"); - } +// Pluggable, initialized in high-level API below. +var randombytes = function(/* x, n */) { throw new Error('no PRNG'); }; - events.EventEmitter.call(this); +var _0 = new Uint8Array(16); +var _9 = new Uint8Array(32); _9[0] = 9; - this._socket = socket; - this.extensions = extensions || {}; - this.firstFragment = true; - this.compress = false; - this.messageHandlers = []; - this.processing = false; - } +var gf0 = gf(), + gf1 = gf([1]), + _121665 = gf([0xdb41, 1]), + D = gf([0x78a3, 0x1359, 0x4dca, 0x75eb, 0xd8ab, 0x4141, 0x0a4d, 0x0070, 0xe898, 0x7779, 0x4079, 0x8cc7, 0xfe73, 0x2b6f, 0x6cee, 0x5203]), + D2 = gf([0xf159, 0x26b2, 0x9b94, 0xebd6, 0xb156, 0x8283, 0x149a, 0x00e0, 0xd130, 0xeef3, 0x80f2, 0x198e, 0xfce7, 0x56df, 0xd9dc, 0x2406]), + X = gf([0xd51a, 0x8f25, 0x2d60, 0xc956, 0xa7b2, 0x9525, 0xc760, 0x692c, 0xdc5c, 0xfdd6, 0xe231, 0xc0a4, 0x53fe, 0xcd6e, 0x36d3, 0x2169]), + Y = gf([0x6658, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666]), + I = gf([0xa0b0, 0x4a0e, 0x1b27, 0xc4ee, 0xe478, 0xad2f, 0x1806, 0x2f43, 0xd7a7, 0x3dfb, 0x0099, 0x2b4d, 0xdf0b, 0x4fc1, 0x2480, 0x2b83]); - /** - * Inherits from EventEmitter. - */ +function ts64(x, i, h, l) { + x[i] = (h >> 24) & 0xff; + x[i+1] = (h >> 16) & 0xff; + x[i+2] = (h >> 8) & 0xff; + x[i+3] = h & 0xff; + x[i+4] = (l >> 24) & 0xff; + x[i+5] = (l >> 16) & 0xff; + x[i+6] = (l >> 8) & 0xff; + x[i+7] = l & 0xff; +} - util.inherits(Sender, events.EventEmitter); +function vn(x, xi, y, yi, n) { + var i,d = 0; + for (i = 0; i < n; i++) d |= x[xi+i]^y[yi+i]; + return (1 & ((d - 1) >>> 8)) - 1; +} - /** - * Sends a close instruction to the remote party. - * - * @api public - */ +function crypto_verify_16(x, xi, y, yi) { + return vn(x,xi,y,yi,16); +} - Sender.prototype.close = function(code, data, mask, cb) { - if (typeof code !== 'undefined') { - if (typeof code !== 'number' || - !ErrorCodes.isValidErrorCode(code)) throw new Error('first argument must be a valid error code number'); - } - code = code || 1000; - var dataBuffer = new Buffer(2 + (data ? Buffer.byteLength(data) : 0)); - writeUInt16BE.call(dataBuffer, code, 0); - if (dataBuffer.length > 2) dataBuffer.write(data, 2); +function crypto_verify_32(x, xi, y, yi) { + return vn(x,xi,y,yi,32); +} - var self = this; - this.messageHandlers.push(function(callback) { - self.frameAndSend(0x8, dataBuffer, true, mask); - callback(); - if (typeof cb == 'function') cb(); - }); - this.flush(); - }; +function core_salsa20(o, p, k, c) { + var j0 = c[ 0] & 0xff | (c[ 1] & 0xff)<<8 | (c[ 2] & 0xff)<<16 | (c[ 3] & 0xff)<<24, + j1 = k[ 0] & 0xff | (k[ 1] & 0xff)<<8 | (k[ 2] & 0xff)<<16 | (k[ 3] & 0xff)<<24, + j2 = k[ 4] & 0xff | (k[ 5] & 0xff)<<8 | (k[ 6] & 0xff)<<16 | (k[ 7] & 0xff)<<24, + j3 = k[ 8] & 0xff | (k[ 9] & 0xff)<<8 | (k[10] & 0xff)<<16 | (k[11] & 0xff)<<24, + j4 = k[12] & 0xff | (k[13] & 0xff)<<8 | (k[14] & 0xff)<<16 | (k[15] & 0xff)<<24, + j5 = c[ 4] & 0xff | (c[ 5] & 0xff)<<8 | (c[ 6] & 0xff)<<16 | (c[ 7] & 0xff)<<24, + j6 = p[ 0] & 0xff | (p[ 1] & 0xff)<<8 | (p[ 2] & 0xff)<<16 | (p[ 3] & 0xff)<<24, + j7 = p[ 4] & 0xff | (p[ 5] & 0xff)<<8 | (p[ 6] & 0xff)<<16 | (p[ 7] & 0xff)<<24, + j8 = p[ 8] & 0xff | (p[ 9] & 0xff)<<8 | (p[10] & 0xff)<<16 | (p[11] & 0xff)<<24, + j9 = p[12] & 0xff | (p[13] & 0xff)<<8 | (p[14] & 0xff)<<16 | (p[15] & 0xff)<<24, + j10 = c[ 8] & 0xff | (c[ 9] & 0xff)<<8 | (c[10] & 0xff)<<16 | (c[11] & 0xff)<<24, + j11 = k[16] & 0xff | (k[17] & 0xff)<<8 | (k[18] & 0xff)<<16 | (k[19] & 0xff)<<24, + j12 = k[20] & 0xff | (k[21] & 0xff)<<8 | (k[22] & 0xff)<<16 | (k[23] & 0xff)<<24, + j13 = k[24] & 0xff | (k[25] & 0xff)<<8 | (k[26] & 0xff)<<16 | (k[27] & 0xff)<<24, + j14 = k[28] & 0xff | (k[29] & 0xff)<<8 | (k[30] & 0xff)<<16 | (k[31] & 0xff)<<24, + j15 = c[12] & 0xff | (c[13] & 0xff)<<8 | (c[14] & 0xff)<<16 | (c[15] & 0xff)<<24; - /** - * Sends a ping message to the remote party. - * - * @api public - */ + var x0 = j0, x1 = j1, x2 = j2, x3 = j3, x4 = j4, x5 = j5, x6 = j6, x7 = j7, + x8 = j8, x9 = j9, x10 = j10, x11 = j11, x12 = j12, x13 = j13, x14 = j14, + x15 = j15, u; - Sender.prototype.ping = function(data, options) { - var mask = options && options.mask; - var self = this; - this.messageHandlers.push(function(callback) { - self.frameAndSend(0x9, data || '', true, mask); - callback(); - }); - this.flush(); - }; + for (var i = 0; i < 20; i += 2) { + u = x0 + x12 | 0; + x4 ^= u<<7 | u>>>(32-7); + u = x4 + x0 | 0; + x8 ^= u<<9 | u>>>(32-9); + u = x8 + x4 | 0; + x12 ^= u<<13 | u>>>(32-13); + u = x12 + x8 | 0; + x0 ^= u<<18 | u>>>(32-18); - /** - * Sends a pong message to the remote party. - * - * @api public - */ + u = x5 + x1 | 0; + x9 ^= u<<7 | u>>>(32-7); + u = x9 + x5 | 0; + x13 ^= u<<9 | u>>>(32-9); + u = x13 + x9 | 0; + x1 ^= u<<13 | u>>>(32-13); + u = x1 + x13 | 0; + x5 ^= u<<18 | u>>>(32-18); - Sender.prototype.pong = function(data, options) { - var mask = options && options.mask; - var self = this; - this.messageHandlers.push(function(callback) { - self.frameAndSend(0xa, data || '', true, mask); - callback(); - }); - this.flush(); - }; + u = x10 + x6 | 0; + x14 ^= u<<7 | u>>>(32-7); + u = x14 + x10 | 0; + x2 ^= u<<9 | u>>>(32-9); + u = x2 + x14 | 0; + x6 ^= u<<13 | u>>>(32-13); + u = x6 + x2 | 0; + x10 ^= u<<18 | u>>>(32-18); - /** - * Sends text or binary data to the remote party. - * - * @api public - */ + u = x15 + x11 | 0; + x3 ^= u<<7 | u>>>(32-7); + u = x3 + x15 | 0; + x7 ^= u<<9 | u>>>(32-9); + u = x7 + x3 | 0; + x11 ^= u<<13 | u>>>(32-13); + u = x11 + x7 | 0; + x15 ^= u<<18 | u>>>(32-18); - Sender.prototype.send = function(data, options, cb) { - var finalFragment = options && options.fin === false ? false : true; - var mask = options && options.mask; - var compress = options && options.compress; - var opcode = options && options.binary ? 2 : 1; - if (this.firstFragment === false) { - opcode = 0; - compress = false; - } else { - this.firstFragment = false; - this.compress = compress; - } - if (finalFragment) this.firstFragment = true + u = x0 + x3 | 0; + x1 ^= u<<7 | u>>>(32-7); + u = x1 + x0 | 0; + x2 ^= u<<9 | u>>>(32-9); + u = x2 + x1 | 0; + x3 ^= u<<13 | u>>>(32-13); + u = x3 + x2 | 0; + x0 ^= u<<18 | u>>>(32-18); - var compressFragment = this.compress; + u = x5 + x4 | 0; + x6 ^= u<<7 | u>>>(32-7); + u = x6 + x5 | 0; + x7 ^= u<<9 | u>>>(32-9); + u = x7 + x6 | 0; + x4 ^= u<<13 | u>>>(32-13); + u = x4 + x7 | 0; + x5 ^= u<<18 | u>>>(32-18); - var self = this; - this.messageHandlers.push(function(callback) { - self.applyExtensions(data, finalFragment, compressFragment, function(err, data) { - if (err) { - if (typeof cb == 'function') cb(err); - else self.emit('error', err); - return; - } - self.frameAndSend(opcode, data, finalFragment, mask, compress, cb); - callback(); - }); - }); - this.flush(); - }; + u = x10 + x9 | 0; + x11 ^= u<<7 | u>>>(32-7); + u = x11 + x10 | 0; + x8 ^= u<<9 | u>>>(32-9); + u = x8 + x11 | 0; + x9 ^= u<<13 | u>>>(32-13); + u = x9 + x8 | 0; + x10 ^= u<<18 | u>>>(32-18); - /** - * Frames and sends a piece of data according to the HyBi WebSocket protocol. - * - * @api private - */ + u = x15 + x14 | 0; + x12 ^= u<<7 | u>>>(32-7); + u = x12 + x15 | 0; + x13 ^= u<<9 | u>>>(32-9); + u = x13 + x12 | 0; + x14 ^= u<<13 | u>>>(32-13); + u = x14 + x13 | 0; + x15 ^= u<<18 | u>>>(32-18); + } + x0 = x0 + j0 | 0; + x1 = x1 + j1 | 0; + x2 = x2 + j2 | 0; + x3 = x3 + j3 | 0; + x4 = x4 + j4 | 0; + x5 = x5 + j5 | 0; + x6 = x6 + j6 | 0; + x7 = x7 + j7 | 0; + x8 = x8 + j8 | 0; + x9 = x9 + j9 | 0; + x10 = x10 + j10 | 0; + x11 = x11 + j11 | 0; + x12 = x12 + j12 | 0; + x13 = x13 + j13 | 0; + x14 = x14 + j14 | 0; + x15 = x15 + j15 | 0; - Sender.prototype.frameAndSend = function(opcode, data, finalFragment, maskData, compressed, cb) { - var canModifyData = false; + o[ 0] = x0 >>> 0 & 0xff; + o[ 1] = x0 >>> 8 & 0xff; + o[ 2] = x0 >>> 16 & 0xff; + o[ 3] = x0 >>> 24 & 0xff; - if (!data) { - try { - this._socket.write(new Buffer([opcode | (finalFragment ? 0x80 : 0), 0 | (maskData ? 0x80 : 0)].concat(maskData ? [0, 0, 0, 0] : [])), 'binary', cb); - } - catch (e) { - if (typeof cb == 'function') cb(e); - else this.emit('error', e); - } - return; - } + o[ 4] = x1 >>> 0 & 0xff; + o[ 5] = x1 >>> 8 & 0xff; + o[ 6] = x1 >>> 16 & 0xff; + o[ 7] = x1 >>> 24 & 0xff; - if (!Buffer.isBuffer(data)) { - canModifyData = true; - if (data && (typeof data.byteLength !== 'undefined' || typeof data.buffer !== 'undefined')) { - data = getArrayBuffer(data); - } else { - // - // If people want to send a number, this would allocate the number in - // bytes as memory size instead of storing the number as buffer value. So - // we need to transform it to string in order to prevent possible - // vulnerabilities / memory attacks. - // - if (typeof data === 'number') data = data.toString(); + o[ 8] = x2 >>> 0 & 0xff; + o[ 9] = x2 >>> 8 & 0xff; + o[10] = x2 >>> 16 & 0xff; + o[11] = x2 >>> 24 & 0xff; - data = new Buffer(data); - } - } + o[12] = x3 >>> 0 & 0xff; + o[13] = x3 >>> 8 & 0xff; + o[14] = x3 >>> 16 & 0xff; + o[15] = x3 >>> 24 & 0xff; - var dataLength = data.length - , dataOffset = maskData ? 6 : 2 - , secondByte = dataLength; + o[16] = x4 >>> 0 & 0xff; + o[17] = x4 >>> 8 & 0xff; + o[18] = x4 >>> 16 & 0xff; + o[19] = x4 >>> 24 & 0xff; - if (dataLength >= 65536) { - dataOffset += 8; - secondByte = 127; - } - else if (dataLength > 125) { - dataOffset += 2; - secondByte = 126; - } + o[20] = x5 >>> 0 & 0xff; + o[21] = x5 >>> 8 & 0xff; + o[22] = x5 >>> 16 & 0xff; + o[23] = x5 >>> 24 & 0xff; - var mergeBuffers = dataLength < 32768 || (maskData && !canModifyData); - var totalLength = mergeBuffers ? dataLength + dataOffset : dataOffset; - var outputBuffer = new Buffer(totalLength); - outputBuffer[0] = finalFragment ? opcode | 0x80 : opcode; - if (compressed) outputBuffer[0] |= 0x40; + o[24] = x6 >>> 0 & 0xff; + o[25] = x6 >>> 8 & 0xff; + o[26] = x6 >>> 16 & 0xff; + o[27] = x6 >>> 24 & 0xff; - switch (secondByte) { - case 126: - writeUInt16BE.call(outputBuffer, dataLength, 2); - break; - case 127: - writeUInt32BE.call(outputBuffer, 0, 2); - writeUInt32BE.call(outputBuffer, dataLength, 6); - } + o[28] = x7 >>> 0 & 0xff; + o[29] = x7 >>> 8 & 0xff; + o[30] = x7 >>> 16 & 0xff; + o[31] = x7 >>> 24 & 0xff; - if (maskData) { - outputBuffer[1] = secondByte | 0x80; - var mask = getRandomMask(); - outputBuffer[dataOffset - 4] = mask[0]; - outputBuffer[dataOffset - 3] = mask[1]; - outputBuffer[dataOffset - 2] = mask[2]; - outputBuffer[dataOffset - 1] = mask[3]; - if (mergeBuffers) { - bufferUtil.mask(data, mask, outputBuffer, dataOffset, dataLength); - try { - this._socket.write(outputBuffer, 'binary', cb); - } - catch (e) { - if (typeof cb == 'function') cb(e); - else this.emit('error', e); - } - } - else { - bufferUtil.mask(data, mask, data, 0, dataLength); - try { - this._socket.write(outputBuffer, 'binary'); - this._socket.write(data, 'binary', cb); - } - catch (e) { - if (typeof cb == 'function') cb(e); - else this.emit('error', e); - } - } - } - else { - outputBuffer[1] = secondByte; - if (mergeBuffers) { - data.copy(outputBuffer, dataOffset); - try { - this._socket.write(outputBuffer, 'binary', cb); - } - catch (e) { - if (typeof cb == 'function') cb(e); - else this.emit('error', e); - } - } - else { - try { - this._socket.write(outputBuffer, 'binary'); - this._socket.write(data, 'binary', cb); - } - catch (e) { - if (typeof cb == 'function') cb(e); - else this.emit('error', e); - } - } - } - }; + o[32] = x8 >>> 0 & 0xff; + o[33] = x8 >>> 8 & 0xff; + o[34] = x8 >>> 16 & 0xff; + o[35] = x8 >>> 24 & 0xff; - /** - * Execute message handler buffers - * - * @api private - */ + o[36] = x9 >>> 0 & 0xff; + o[37] = x9 >>> 8 & 0xff; + o[38] = x9 >>> 16 & 0xff; + o[39] = x9 >>> 24 & 0xff; - Sender.prototype.flush = function() { - if (this.processing) return; + o[40] = x10 >>> 0 & 0xff; + o[41] = x10 >>> 8 & 0xff; + o[42] = x10 >>> 16 & 0xff; + o[43] = x10 >>> 24 & 0xff; - var handler = this.messageHandlers.shift(); - if (!handler) return; + o[44] = x11 >>> 0 & 0xff; + o[45] = x11 >>> 8 & 0xff; + o[46] = x11 >>> 16 & 0xff; + o[47] = x11 >>> 24 & 0xff; - this.processing = true; + o[48] = x12 >>> 0 & 0xff; + o[49] = x12 >>> 8 & 0xff; + o[50] = x12 >>> 16 & 0xff; + o[51] = x12 >>> 24 & 0xff; - var self = this; + o[52] = x13 >>> 0 & 0xff; + o[53] = x13 >>> 8 & 0xff; + o[54] = x13 >>> 16 & 0xff; + o[55] = x13 >>> 24 & 0xff; - handler(function() { - self.processing = false; - self.flush(); - }); - }; + o[56] = x14 >>> 0 & 0xff; + o[57] = x14 >>> 8 & 0xff; + o[58] = x14 >>> 16 & 0xff; + o[59] = x14 >>> 24 & 0xff; - /** - * Apply extensions to message - * - * @api private - */ + o[60] = x15 >>> 0 & 0xff; + o[61] = x15 >>> 8 & 0xff; + o[62] = x15 >>> 16 & 0xff; + o[63] = x15 >>> 24 & 0xff; +} - Sender.prototype.applyExtensions = function(data, fin, compress, callback) { - if (compress && data) { - if ((data.buffer || data) instanceof ArrayBuffer) { - data = getArrayBuffer(data); - } - this.extensions[PerMessageDeflate.extensionName].compress(data, fin, callback); - } else { - callback(null, data); - } - }; +function core_hsalsa20(o,p,k,c) { + var j0 = c[ 0] & 0xff | (c[ 1] & 0xff)<<8 | (c[ 2] & 0xff)<<16 | (c[ 3] & 0xff)<<24, + j1 = k[ 0] & 0xff | (k[ 1] & 0xff)<<8 | (k[ 2] & 0xff)<<16 | (k[ 3] & 0xff)<<24, + j2 = k[ 4] & 0xff | (k[ 5] & 0xff)<<8 | (k[ 6] & 0xff)<<16 | (k[ 7] & 0xff)<<24, + j3 = k[ 8] & 0xff | (k[ 9] & 0xff)<<8 | (k[10] & 0xff)<<16 | (k[11] & 0xff)<<24, + j4 = k[12] & 0xff | (k[13] & 0xff)<<8 | (k[14] & 0xff)<<16 | (k[15] & 0xff)<<24, + j5 = c[ 4] & 0xff | (c[ 5] & 0xff)<<8 | (c[ 6] & 0xff)<<16 | (c[ 7] & 0xff)<<24, + j6 = p[ 0] & 0xff | (p[ 1] & 0xff)<<8 | (p[ 2] & 0xff)<<16 | (p[ 3] & 0xff)<<24, + j7 = p[ 4] & 0xff | (p[ 5] & 0xff)<<8 | (p[ 6] & 0xff)<<16 | (p[ 7] & 0xff)<<24, + j8 = p[ 8] & 0xff | (p[ 9] & 0xff)<<8 | (p[10] & 0xff)<<16 | (p[11] & 0xff)<<24, + j9 = p[12] & 0xff | (p[13] & 0xff)<<8 | (p[14] & 0xff)<<16 | (p[15] & 0xff)<<24, + j10 = c[ 8] & 0xff | (c[ 9] & 0xff)<<8 | (c[10] & 0xff)<<16 | (c[11] & 0xff)<<24, + j11 = k[16] & 0xff | (k[17] & 0xff)<<8 | (k[18] & 0xff)<<16 | (k[19] & 0xff)<<24, + j12 = k[20] & 0xff | (k[21] & 0xff)<<8 | (k[22] & 0xff)<<16 | (k[23] & 0xff)<<24, + j13 = k[24] & 0xff | (k[25] & 0xff)<<8 | (k[26] & 0xff)<<16 | (k[27] & 0xff)<<24, + j14 = k[28] & 0xff | (k[29] & 0xff)<<8 | (k[30] & 0xff)<<16 | (k[31] & 0xff)<<24, + j15 = c[12] & 0xff | (c[13] & 0xff)<<8 | (c[14] & 0xff)<<16 | (c[15] & 0xff)<<24; - module.exports = Sender; + var x0 = j0, x1 = j1, x2 = j2, x3 = j3, x4 = j4, x5 = j5, x6 = j6, x7 = j7, + x8 = j8, x9 = j9, x10 = j10, x11 = j11, x12 = j12, x13 = j13, x14 = j14, + x15 = j15, u; - function writeUInt16BE(value, offset) { - this[offset] = (value & 0xff00)>>8; - this[offset+1] = value & 0xff; - } + for (var i = 0; i < 20; i += 2) { + u = x0 + x12 | 0; + x4 ^= u<<7 | u>>>(32-7); + u = x4 + x0 | 0; + x8 ^= u<<9 | u>>>(32-9); + u = x8 + x4 | 0; + x12 ^= u<<13 | u>>>(32-13); + u = x12 + x8 | 0; + x0 ^= u<<18 | u>>>(32-18); - function writeUInt32BE(value, offset) { - this[offset] = (value & 0xff000000)>>24; - this[offset+1] = (value & 0xff0000)>>16; - this[offset+2] = (value & 0xff00)>>8; - this[offset+3] = value & 0xff; - } + u = x5 + x1 | 0; + x9 ^= u<<7 | u>>>(32-7); + u = x9 + x5 | 0; + x13 ^= u<<9 | u>>>(32-9); + u = x13 + x9 | 0; + x1 ^= u<<13 | u>>>(32-13); + u = x1 + x13 | 0; + x5 ^= u<<18 | u>>>(32-18); - function getArrayBuffer(data) { - // data is either an ArrayBuffer or ArrayBufferView. - var array = new Uint8Array(data.buffer || data) - , l = data.byteLength || data.length - , o = data.byteOffset || 0 - , buffer = new Buffer(l); - for (var i = 0; i < l; ++i) { - buffer[i] = array[o+i]; - } - return buffer; - } + u = x10 + x6 | 0; + x14 ^= u<<7 | u>>>(32-7); + u = x14 + x10 | 0; + x2 ^= u<<9 | u>>>(32-9); + u = x2 + x14 | 0; + x6 ^= u<<13 | u>>>(32-13); + u = x6 + x2 | 0; + x10 ^= u<<18 | u>>>(32-18); - function getRandomMask() { - return new Buffer([ - ~~(Math.random() * 255), - ~~(Math.random() * 255), - ~~(Math.random() * 255), - ~~(Math.random() * 255) - ]); - } + u = x15 + x11 | 0; + x3 ^= u<<7 | u>>>(32-7); + u = x3 + x15 | 0; + x7 ^= u<<9 | u>>>(32-9); + u = x7 + x3 | 0; + x11 ^= u<<13 | u>>>(32-13); + u = x11 + x7 | 0; + x15 ^= u<<18 | u>>>(32-18); + + u = x0 + x3 | 0; + x1 ^= u<<7 | u>>>(32-7); + u = x1 + x0 | 0; + x2 ^= u<<9 | u>>>(32-9); + u = x2 + x1 | 0; + x3 ^= u<<13 | u>>>(32-13); + u = x3 + x2 | 0; + x0 ^= u<<18 | u>>>(32-18); + + u = x5 + x4 | 0; + x6 ^= u<<7 | u>>>(32-7); + u = x6 + x5 | 0; + x7 ^= u<<9 | u>>>(32-9); + u = x7 + x6 | 0; + x4 ^= u<<13 | u>>>(32-13); + u = x4 + x7 | 0; + x5 ^= u<<18 | u>>>(32-18); + + u = x10 + x9 | 0; + x11 ^= u<<7 | u>>>(32-7); + u = x11 + x10 | 0; + x8 ^= u<<9 | u>>>(32-9); + u = x8 + x11 | 0; + x9 ^= u<<13 | u>>>(32-13); + u = x9 + x8 | 0; + x10 ^= u<<18 | u>>>(32-18); + + u = x15 + x14 | 0; + x12 ^= u<<7 | u>>>(32-7); + u = x12 + x15 | 0; + x13 ^= u<<9 | u>>>(32-9); + u = x13 + x12 | 0; + x14 ^= u<<13 | u>>>(32-13); + u = x14 + x13 | 0; + x15 ^= u<<18 | u>>>(32-18); + } + + o[ 0] = x0 >>> 0 & 0xff; + o[ 1] = x0 >>> 8 & 0xff; + o[ 2] = x0 >>> 16 & 0xff; + o[ 3] = x0 >>> 24 & 0xff; + + o[ 4] = x5 >>> 0 & 0xff; + o[ 5] = x5 >>> 8 & 0xff; + o[ 6] = x5 >>> 16 & 0xff; + o[ 7] = x5 >>> 24 & 0xff; + + o[ 8] = x10 >>> 0 & 0xff; + o[ 9] = x10 >>> 8 & 0xff; + o[10] = x10 >>> 16 & 0xff; + o[11] = x10 >>> 24 & 0xff; + + o[12] = x15 >>> 0 & 0xff; + o[13] = x15 >>> 8 & 0xff; + o[14] = x15 >>> 16 & 0xff; + o[15] = x15 >>> 24 & 0xff; + + o[16] = x6 >>> 0 & 0xff; + o[17] = x6 >>> 8 & 0xff; + o[18] = x6 >>> 16 & 0xff; + o[19] = x6 >>> 24 & 0xff; + + o[20] = x7 >>> 0 & 0xff; + o[21] = x7 >>> 8 & 0xff; + o[22] = x7 >>> 16 & 0xff; + o[23] = x7 >>> 24 & 0xff; + + o[24] = x8 >>> 0 & 0xff; + o[25] = x8 >>> 8 & 0xff; + o[26] = x8 >>> 16 & 0xff; + o[27] = x8 >>> 24 & 0xff; + + o[28] = x9 >>> 0 & 0xff; + o[29] = x9 >>> 8 & 0xff; + o[30] = x9 >>> 16 & 0xff; + o[31] = x9 >>> 24 & 0xff; +} + +function crypto_core_salsa20(out,inp,k,c) { + core_salsa20(out,inp,k,c); +} + +function crypto_core_hsalsa20(out,inp,k,c) { + core_hsalsa20(out,inp,k,c); +} + +var sigma = new Uint8Array([101, 120, 112, 97, 110, 100, 32, 51, 50, 45, 98, 121, 116, 101, 32, 107]); + // "expand 32-byte k" + +function crypto_stream_salsa20_xor(c,cpos,m,mpos,b,n,k) { + var z = new Uint8Array(16), x = new Uint8Array(64); + var u, i; + for (i = 0; i < 16; i++) z[i] = 0; + for (i = 0; i < 8; i++) z[i] = n[i]; + while (b >= 64) { + crypto_core_salsa20(x,z,k,sigma); + for (i = 0; i < 64; i++) c[cpos+i] = m[mpos+i] ^ x[i]; + u = 1; + for (i = 8; i < 16; i++) { + u = u + (z[i] & 0xff) | 0; + z[i] = u & 0xff; + u >>>= 8; + } + b -= 64; + cpos += 64; + mpos += 64; + } + if (b > 0) { + crypto_core_salsa20(x,z,k,sigma); + for (i = 0; i < b; i++) c[cpos+i] = m[mpos+i] ^ x[i]; + } + return 0; +} + +function crypto_stream_salsa20(c,cpos,b,n,k) { + var z = new Uint8Array(16), x = new Uint8Array(64); + var u, i; + for (i = 0; i < 16; i++) z[i] = 0; + for (i = 0; i < 8; i++) z[i] = n[i]; + while (b >= 64) { + crypto_core_salsa20(x,z,k,sigma); + for (i = 0; i < 64; i++) c[cpos+i] = x[i]; + u = 1; + for (i = 8; i < 16; i++) { + u = u + (z[i] & 0xff) | 0; + z[i] = u & 0xff; + u >>>= 8; + } + b -= 64; + cpos += 64; + } + if (b > 0) { + crypto_core_salsa20(x,z,k,sigma); + for (i = 0; i < b; i++) c[cpos+i] = x[i]; + } + return 0; +} + +function crypto_stream(c,cpos,d,n,k) { + var s = new Uint8Array(32); + crypto_core_hsalsa20(s,n,k,sigma); + var sn = new Uint8Array(8); + for (var i = 0; i < 8; i++) sn[i] = n[i+16]; + return crypto_stream_salsa20(c,cpos,d,sn,s); +} + +function crypto_stream_xor(c,cpos,m,mpos,d,n,k) { + var s = new Uint8Array(32); + crypto_core_hsalsa20(s,n,k,sigma); + var sn = new Uint8Array(8); + for (var i = 0; i < 8; i++) sn[i] = n[i+16]; + return crypto_stream_salsa20_xor(c,cpos,m,mpos,d,sn,s); +} + +/* +* Port of Andrew Moon's Poly1305-donna-16. Public domain. +* https://github.com/floodyberry/poly1305-donna +*/ + +var poly1305 = function(key) { + this.buffer = new Uint8Array(16); + this.r = new Uint16Array(10); + this.h = new Uint16Array(10); + this.pad = new Uint16Array(8); + this.leftover = 0; + this.fin = 0; + + var t0, t1, t2, t3, t4, t5, t6, t7; + + t0 = key[ 0] & 0xff | (key[ 1] & 0xff) << 8; this.r[0] = ( t0 ) & 0x1fff; + t1 = key[ 2] & 0xff | (key[ 3] & 0xff) << 8; this.r[1] = ((t0 >>> 13) | (t1 << 3)) & 0x1fff; + t2 = key[ 4] & 0xff | (key[ 5] & 0xff) << 8; this.r[2] = ((t1 >>> 10) | (t2 << 6)) & 0x1f03; + t3 = key[ 6] & 0xff | (key[ 7] & 0xff) << 8; this.r[3] = ((t2 >>> 7) | (t3 << 9)) & 0x1fff; + t4 = key[ 8] & 0xff | (key[ 9] & 0xff) << 8; this.r[4] = ((t3 >>> 4) | (t4 << 12)) & 0x00ff; + this.r[5] = ((t4 >>> 1)) & 0x1ffe; + t5 = key[10] & 0xff | (key[11] & 0xff) << 8; this.r[6] = ((t4 >>> 14) | (t5 << 2)) & 0x1fff; + t6 = key[12] & 0xff | (key[13] & 0xff) << 8; this.r[7] = ((t5 >>> 11) | (t6 << 5)) & 0x1f81; + t7 = key[14] & 0xff | (key[15] & 0xff) << 8; this.r[8] = ((t6 >>> 8) | (t7 << 8)) & 0x1fff; + this.r[9] = ((t7 >>> 5)) & 0x007f; + + this.pad[0] = key[16] & 0xff | (key[17] & 0xff) << 8; + this.pad[1] = key[18] & 0xff | (key[19] & 0xff) << 8; + this.pad[2] = key[20] & 0xff | (key[21] & 0xff) << 8; + this.pad[3] = key[22] & 0xff | (key[23] & 0xff) << 8; + this.pad[4] = key[24] & 0xff | (key[25] & 0xff) << 8; + this.pad[5] = key[26] & 0xff | (key[27] & 0xff) << 8; + this.pad[6] = key[28] & 0xff | (key[29] & 0xff) << 8; + this.pad[7] = key[30] & 0xff | (key[31] & 0xff) << 8; +}; + +poly1305.prototype.blocks = function(m, mpos, bytes) { + var hibit = this.fin ? 0 : (1 << 11); + var t0, t1, t2, t3, t4, t5, t6, t7, c; + var d0, d1, d2, d3, d4, d5, d6, d7, d8, d9; + + var h0 = this.h[0], + h1 = this.h[1], + h2 = this.h[2], + h3 = this.h[3], + h4 = this.h[4], + h5 = this.h[5], + h6 = this.h[6], + h7 = this.h[7], + h8 = this.h[8], + h9 = this.h[9]; + + var r0 = this.r[0], + r1 = this.r[1], + r2 = this.r[2], + r3 = this.r[3], + r4 = this.r[4], + r5 = this.r[5], + r6 = this.r[6], + r7 = this.r[7], + r8 = this.r[8], + r9 = this.r[9]; + + while (bytes >= 16) { + t0 = m[mpos+ 0] & 0xff | (m[mpos+ 1] & 0xff) << 8; h0 += ( t0 ) & 0x1fff; + t1 = m[mpos+ 2] & 0xff | (m[mpos+ 3] & 0xff) << 8; h1 += ((t0 >>> 13) | (t1 << 3)) & 0x1fff; + t2 = m[mpos+ 4] & 0xff | (m[mpos+ 5] & 0xff) << 8; h2 += ((t1 >>> 10) | (t2 << 6)) & 0x1fff; + t3 = m[mpos+ 6] & 0xff | (m[mpos+ 7] & 0xff) << 8; h3 += ((t2 >>> 7) | (t3 << 9)) & 0x1fff; + t4 = m[mpos+ 8] & 0xff | (m[mpos+ 9] & 0xff) << 8; h4 += ((t3 >>> 4) | (t4 << 12)) & 0x1fff; + h5 += ((t4 >>> 1)) & 0x1fff; + t5 = m[mpos+10] & 0xff | (m[mpos+11] & 0xff) << 8; h6 += ((t4 >>> 14) | (t5 << 2)) & 0x1fff; + t6 = m[mpos+12] & 0xff | (m[mpos+13] & 0xff) << 8; h7 += ((t5 >>> 11) | (t6 << 5)) & 0x1fff; + t7 = m[mpos+14] & 0xff | (m[mpos+15] & 0xff) << 8; h8 += ((t6 >>> 8) | (t7 << 8)) & 0x1fff; + h9 += ((t7 >>> 5)) | hibit; + + c = 0; + + d0 = c; + d0 += h0 * r0; + d0 += h1 * (5 * r9); + d0 += h2 * (5 * r8); + d0 += h3 * (5 * r7); + d0 += h4 * (5 * r6); + c = (d0 >>> 13); d0 &= 0x1fff; + d0 += h5 * (5 * r5); + d0 += h6 * (5 * r4); + d0 += h7 * (5 * r3); + d0 += h8 * (5 * r2); + d0 += h9 * (5 * r1); + c += (d0 >>> 13); d0 &= 0x1fff; + + d1 = c; + d1 += h0 * r1; + d1 += h1 * r0; + d1 += h2 * (5 * r9); + d1 += h3 * (5 * r8); + d1 += h4 * (5 * r7); + c = (d1 >>> 13); d1 &= 0x1fff; + d1 += h5 * (5 * r6); + d1 += h6 * (5 * r5); + d1 += h7 * (5 * r4); + d1 += h8 * (5 * r3); + d1 += h9 * (5 * r2); + c += (d1 >>> 13); d1 &= 0x1fff; + + d2 = c; + d2 += h0 * r2; + d2 += h1 * r1; + d2 += h2 * r0; + d2 += h3 * (5 * r9); + d2 += h4 * (5 * r8); + c = (d2 >>> 13); d2 &= 0x1fff; + d2 += h5 * (5 * r7); + d2 += h6 * (5 * r6); + d2 += h7 * (5 * r5); + d2 += h8 * (5 * r4); + d2 += h9 * (5 * r3); + c += (d2 >>> 13); d2 &= 0x1fff; + + d3 = c; + d3 += h0 * r3; + d3 += h1 * r2; + d3 += h2 * r1; + d3 += h3 * r0; + d3 += h4 * (5 * r9); + c = (d3 >>> 13); d3 &= 0x1fff; + d3 += h5 * (5 * r8); + d3 += h6 * (5 * r7); + d3 += h7 * (5 * r6); + d3 += h8 * (5 * r5); + d3 += h9 * (5 * r4); + c += (d3 >>> 13); d3 &= 0x1fff; + + d4 = c; + d4 += h0 * r4; + d4 += h1 * r3; + d4 += h2 * r2; + d4 += h3 * r1; + d4 += h4 * r0; + c = (d4 >>> 13); d4 &= 0x1fff; + d4 += h5 * (5 * r9); + d4 += h6 * (5 * r8); + d4 += h7 * (5 * r7); + d4 += h8 * (5 * r6); + d4 += h9 * (5 * r5); + c += (d4 >>> 13); d4 &= 0x1fff; + + d5 = c; + d5 += h0 * r5; + d5 += h1 * r4; + d5 += h2 * r3; + d5 += h3 * r2; + d5 += h4 * r1; + c = (d5 >>> 13); d5 &= 0x1fff; + d5 += h5 * r0; + d5 += h6 * (5 * r9); + d5 += h7 * (5 * r8); + d5 += h8 * (5 * r7); + d5 += h9 * (5 * r6); + c += (d5 >>> 13); d5 &= 0x1fff; + + d6 = c; + d6 += h0 * r6; + d6 += h1 * r5; + d6 += h2 * r4; + d6 += h3 * r3; + d6 += h4 * r2; + c = (d6 >>> 13); d6 &= 0x1fff; + d6 += h5 * r1; + d6 += h6 * r0; + d6 += h7 * (5 * r9); + d6 += h8 * (5 * r8); + d6 += h9 * (5 * r7); + c += (d6 >>> 13); d6 &= 0x1fff; + + d7 = c; + d7 += h0 * r7; + d7 += h1 * r6; + d7 += h2 * r5; + d7 += h3 * r4; + d7 += h4 * r3; + c = (d7 >>> 13); d7 &= 0x1fff; + d7 += h5 * r2; + d7 += h6 * r1; + d7 += h7 * r0; + d7 += h8 * (5 * r9); + d7 += h9 * (5 * r8); + c += (d7 >>> 13); d7 &= 0x1fff; + + d8 = c; + d8 += h0 * r8; + d8 += h1 * r7; + d8 += h2 * r6; + d8 += h3 * r5; + d8 += h4 * r4; + c = (d8 >>> 13); d8 &= 0x1fff; + d8 += h5 * r3; + d8 += h6 * r2; + d8 += h7 * r1; + d8 += h8 * r0; + d8 += h9 * (5 * r9); + c += (d8 >>> 13); d8 &= 0x1fff; + + d9 = c; + d9 += h0 * r9; + d9 += h1 * r8; + d9 += h2 * r7; + d9 += h3 * r6; + d9 += h4 * r5; + c = (d9 >>> 13); d9 &= 0x1fff; + d9 += h5 * r4; + d9 += h6 * r3; + d9 += h7 * r2; + d9 += h8 * r1; + d9 += h9 * r0; + c += (d9 >>> 13); d9 &= 0x1fff; + + c = (((c << 2) + c)) | 0; + c = (c + d0) | 0; + d0 = c & 0x1fff; + c = (c >>> 13); + d1 += c; + + h0 = d0; + h1 = d1; + h2 = d2; + h3 = d3; + h4 = d4; + h5 = d5; + h6 = d6; + h7 = d7; + h8 = d8; + h9 = d9; + + mpos += 16; + bytes -= 16; + } + this.h[0] = h0; + this.h[1] = h1; + this.h[2] = h2; + this.h[3] = h3; + this.h[4] = h4; + this.h[5] = h5; + this.h[6] = h6; + this.h[7] = h7; + this.h[8] = h8; + this.h[9] = h9; +}; + +poly1305.prototype.finish = function(mac, macpos) { + var g = new Uint16Array(10); + var c, mask, f, i; + + if (this.leftover) { + i = this.leftover; + this.buffer[i++] = 1; + for (; i < 16; i++) this.buffer[i] = 0; + this.fin = 1; + this.blocks(this.buffer, 0, 16); + } + + c = this.h[1] >>> 13; + this.h[1] &= 0x1fff; + for (i = 2; i < 10; i++) { + this.h[i] += c; + c = this.h[i] >>> 13; + this.h[i] &= 0x1fff; + } + this.h[0] += (c * 5); + c = this.h[0] >>> 13; + this.h[0] &= 0x1fff; + this.h[1] += c; + c = this.h[1] >>> 13; + this.h[1] &= 0x1fff; + this.h[2] += c; + + g[0] = this.h[0] + 5; + c = g[0] >>> 13; + g[0] &= 0x1fff; + for (i = 1; i < 10; i++) { + g[i] = this.h[i] + c; + c = g[i] >>> 13; + g[i] &= 0x1fff; + } + g[9] -= (1 << 13); + + mask = (c ^ 1) - 1; + for (i = 0; i < 10; i++) g[i] &= mask; + mask = ~mask; + for (i = 0; i < 10; i++) this.h[i] = (this.h[i] & mask) | g[i]; + + this.h[0] = ((this.h[0] ) | (this.h[1] << 13) ) & 0xffff; + this.h[1] = ((this.h[1] >>> 3) | (this.h[2] << 10) ) & 0xffff; + this.h[2] = ((this.h[2] >>> 6) | (this.h[3] << 7) ) & 0xffff; + this.h[3] = ((this.h[3] >>> 9) | (this.h[4] << 4) ) & 0xffff; + this.h[4] = ((this.h[4] >>> 12) | (this.h[5] << 1) | (this.h[6] << 14)) & 0xffff; + this.h[5] = ((this.h[6] >>> 2) | (this.h[7] << 11) ) & 0xffff; + this.h[6] = ((this.h[7] >>> 5) | (this.h[8] << 8) ) & 0xffff; + this.h[7] = ((this.h[8] >>> 8) | (this.h[9] << 5) ) & 0xffff; + + f = this.h[0] + this.pad[0]; + this.h[0] = f & 0xffff; + for (i = 1; i < 8; i++) { + f = (((this.h[i] + this.pad[i]) | 0) + (f >>> 16)) | 0; + this.h[i] = f & 0xffff; + } + + mac[macpos+ 0] = (this.h[0] >>> 0) & 0xff; + mac[macpos+ 1] = (this.h[0] >>> 8) & 0xff; + mac[macpos+ 2] = (this.h[1] >>> 0) & 0xff; + mac[macpos+ 3] = (this.h[1] >>> 8) & 0xff; + mac[macpos+ 4] = (this.h[2] >>> 0) & 0xff; + mac[macpos+ 5] = (this.h[2] >>> 8) & 0xff; + mac[macpos+ 6] = (this.h[3] >>> 0) & 0xff; + mac[macpos+ 7] = (this.h[3] >>> 8) & 0xff; + mac[macpos+ 8] = (this.h[4] >>> 0) & 0xff; + mac[macpos+ 9] = (this.h[4] >>> 8) & 0xff; + mac[macpos+10] = (this.h[5] >>> 0) & 0xff; + mac[macpos+11] = (this.h[5] >>> 8) & 0xff; + mac[macpos+12] = (this.h[6] >>> 0) & 0xff; + mac[macpos+13] = (this.h[6] >>> 8) & 0xff; + mac[macpos+14] = (this.h[7] >>> 0) & 0xff; + mac[macpos+15] = (this.h[7] >>> 8) & 0xff; +}; + +poly1305.prototype.update = function(m, mpos, bytes) { + var i, want; + + if (this.leftover) { + want = (16 - this.leftover); + if (want > bytes) + want = bytes; + for (i = 0; i < want; i++) + this.buffer[this.leftover + i] = m[mpos+i]; + bytes -= want; + mpos += want; + this.leftover += want; + if (this.leftover < 16) + return; + this.blocks(this.buffer, 0, 16); + this.leftover = 0; + } + + if (bytes >= 16) { + want = bytes - (bytes % 16); + this.blocks(m, mpos, want); + mpos += want; + bytes -= want; + } + + if (bytes) { + for (i = 0; i < bytes; i++) + this.buffer[this.leftover + i] = m[mpos+i]; + this.leftover += bytes; + } +}; + +function crypto_onetimeauth(out, outpos, m, mpos, n, k) { + var s = new poly1305(k); + s.update(m, mpos, n); + s.finish(out, outpos); + return 0; +} + +function crypto_onetimeauth_verify(h, hpos, m, mpos, n, k) { + var x = new Uint8Array(16); + crypto_onetimeauth(x,0,m,mpos,n,k); + return crypto_verify_16(h,hpos,x,0); +} + +function crypto_secretbox(c,m,d,n,k) { + var i; + if (d < 32) return -1; + crypto_stream_xor(c,0,m,0,d,n,k); + crypto_onetimeauth(c, 16, c, 32, d - 32, c); + for (i = 0; i < 16; i++) c[i] = 0; + return 0; +} + +function crypto_secretbox_open(m,c,d,n,k) { + var i; + var x = new Uint8Array(32); + if (d < 32) return -1; + crypto_stream(x,0,32,n,k); + if (crypto_onetimeauth_verify(c, 16,c, 32,d - 32,x) !== 0) return -1; + crypto_stream_xor(m,0,c,0,d,n,k); + for (i = 0; i < 32; i++) m[i] = 0; + return 0; +} + +function set25519(r, a) { + var i; + for (i = 0; i < 16; i++) r[i] = a[i]|0; +} + +function car25519(o) { + var i, v, c = 1; + for (i = 0; i < 16; i++) { + v = o[i] + c + 65535; + c = Math.floor(v / 65536); + o[i] = v - c * 65536; + } + o[0] += c-1 + 37 * (c-1); +} + +function sel25519(p, q, b) { + var t, c = ~(b-1); + for (var i = 0; i < 16; i++) { + t = c & (p[i] ^ q[i]); + p[i] ^= t; + q[i] ^= t; + } +} + +function pack25519(o, n) { + var i, j, b; + var m = gf(), t = gf(); + for (i = 0; i < 16; i++) t[i] = n[i]; + car25519(t); + car25519(t); + car25519(t); + for (j = 0; j < 2; j++) { + m[0] = t[0] - 0xffed; + for (i = 1; i < 15; i++) { + m[i] = t[i] - 0xffff - ((m[i-1]>>16) & 1); + m[i-1] &= 0xffff; + } + m[15] = t[15] - 0x7fff - ((m[14]>>16) & 1); + b = (m[15]>>16) & 1; + m[14] &= 0xffff; + sel25519(t, m, 1-b); + } + for (i = 0; i < 16; i++) { + o[2*i] = t[i] & 0xff; + o[2*i+1] = t[i]>>8; + } +} + +function neq25519(a, b) { + var c = new Uint8Array(32), d = new Uint8Array(32); + pack25519(c, a); + pack25519(d, b); + return crypto_verify_32(c, 0, d, 0); +} + +function par25519(a) { + var d = new Uint8Array(32); + pack25519(d, a); + return d[0] & 1; +} + +function unpack25519(o, n) { + var i; + for (i = 0; i < 16; i++) o[i] = n[2*i] + (n[2*i+1] << 8); + o[15] &= 0x7fff; +} + +function A(o, a, b) { + for (var i = 0; i < 16; i++) o[i] = a[i] + b[i]; +} + +function Z(o, a, b) { + for (var i = 0; i < 16; i++) o[i] = a[i] - b[i]; +} + +function M(o, a, b) { + var v, c, + t0 = 0, t1 = 0, t2 = 0, t3 = 0, t4 = 0, t5 = 0, t6 = 0, t7 = 0, + t8 = 0, t9 = 0, t10 = 0, t11 = 0, t12 = 0, t13 = 0, t14 = 0, t15 = 0, + t16 = 0, t17 = 0, t18 = 0, t19 = 0, t20 = 0, t21 = 0, t22 = 0, t23 = 0, + t24 = 0, t25 = 0, t26 = 0, t27 = 0, t28 = 0, t29 = 0, t30 = 0, + b0 = b[0], + b1 = b[1], + b2 = b[2], + b3 = b[3], + b4 = b[4], + b5 = b[5], + b6 = b[6], + b7 = b[7], + b8 = b[8], + b9 = b[9], + b10 = b[10], + b11 = b[11], + b12 = b[12], + b13 = b[13], + b14 = b[14], + b15 = b[15]; + + v = a[0]; + t0 += v * b0; + t1 += v * b1; + t2 += v * b2; + t3 += v * b3; + t4 += v * b4; + t5 += v * b5; + t6 += v * b6; + t7 += v * b7; + t8 += v * b8; + t9 += v * b9; + t10 += v * b10; + t11 += v * b11; + t12 += v * b12; + t13 += v * b13; + t14 += v * b14; + t15 += v * b15; + v = a[1]; + t1 += v * b0; + t2 += v * b1; + t3 += v * b2; + t4 += v * b3; + t5 += v * b4; + t6 += v * b5; + t7 += v * b6; + t8 += v * b7; + t9 += v * b8; + t10 += v * b9; + t11 += v * b10; + t12 += v * b11; + t13 += v * b12; + t14 += v * b13; + t15 += v * b14; + t16 += v * b15; + v = a[2]; + t2 += v * b0; + t3 += v * b1; + t4 += v * b2; + t5 += v * b3; + t6 += v * b4; + t7 += v * b5; + t8 += v * b6; + t9 += v * b7; + t10 += v * b8; + t11 += v * b9; + t12 += v * b10; + t13 += v * b11; + t14 += v * b12; + t15 += v * b13; + t16 += v * b14; + t17 += v * b15; + v = a[3]; + t3 += v * b0; + t4 += v * b1; + t5 += v * b2; + t6 += v * b3; + t7 += v * b4; + t8 += v * b5; + t9 += v * b6; + t10 += v * b7; + t11 += v * b8; + t12 += v * b9; + t13 += v * b10; + t14 += v * b11; + t15 += v * b12; + t16 += v * b13; + t17 += v * b14; + t18 += v * b15; + v = a[4]; + t4 += v * b0; + t5 += v * b1; + t6 += v * b2; + t7 += v * b3; + t8 += v * b4; + t9 += v * b5; + t10 += v * b6; + t11 += v * b7; + t12 += v * b8; + t13 += v * b9; + t14 += v * b10; + t15 += v * b11; + t16 += v * b12; + t17 += v * b13; + t18 += v * b14; + t19 += v * b15; + v = a[5]; + t5 += v * b0; + t6 += v * b1; + t7 += v * b2; + t8 += v * b3; + t9 += v * b4; + t10 += v * b5; + t11 += v * b6; + t12 += v * b7; + t13 += v * b8; + t14 += v * b9; + t15 += v * b10; + t16 += v * b11; + t17 += v * b12; + t18 += v * b13; + t19 += v * b14; + t20 += v * b15; + v = a[6]; + t6 += v * b0; + t7 += v * b1; + t8 += v * b2; + t9 += v * b3; + t10 += v * b4; + t11 += v * b5; + t12 += v * b6; + t13 += v * b7; + t14 += v * b8; + t15 += v * b9; + t16 += v * b10; + t17 += v * b11; + t18 += v * b12; + t19 += v * b13; + t20 += v * b14; + t21 += v * b15; + v = a[7]; + t7 += v * b0; + t8 += v * b1; + t9 += v * b2; + t10 += v * b3; + t11 += v * b4; + t12 += v * b5; + t13 += v * b6; + t14 += v * b7; + t15 += v * b8; + t16 += v * b9; + t17 += v * b10; + t18 += v * b11; + t19 += v * b12; + t20 += v * b13; + t21 += v * b14; + t22 += v * b15; + v = a[8]; + t8 += v * b0; + t9 += v * b1; + t10 += v * b2; + t11 += v * b3; + t12 += v * b4; + t13 += v * b5; + t14 += v * b6; + t15 += v * b7; + t16 += v * b8; + t17 += v * b9; + t18 += v * b10; + t19 += v * b11; + t20 += v * b12; + t21 += v * b13; + t22 += v * b14; + t23 += v * b15; + v = a[9]; + t9 += v * b0; + t10 += v * b1; + t11 += v * b2; + t12 += v * b3; + t13 += v * b4; + t14 += v * b5; + t15 += v * b6; + t16 += v * b7; + t17 += v * b8; + t18 += v * b9; + t19 += v * b10; + t20 += v * b11; + t21 += v * b12; + t22 += v * b13; + t23 += v * b14; + t24 += v * b15; + v = a[10]; + t10 += v * b0; + t11 += v * b1; + t12 += v * b2; + t13 += v * b3; + t14 += v * b4; + t15 += v * b5; + t16 += v * b6; + t17 += v * b7; + t18 += v * b8; + t19 += v * b9; + t20 += v * b10; + t21 += v * b11; + t22 += v * b12; + t23 += v * b13; + t24 += v * b14; + t25 += v * b15; + v = a[11]; + t11 += v * b0; + t12 += v * b1; + t13 += v * b2; + t14 += v * b3; + t15 += v * b4; + t16 += v * b5; + t17 += v * b6; + t18 += v * b7; + t19 += v * b8; + t20 += v * b9; + t21 += v * b10; + t22 += v * b11; + t23 += v * b12; + t24 += v * b13; + t25 += v * b14; + t26 += v * b15; + v = a[12]; + t12 += v * b0; + t13 += v * b1; + t14 += v * b2; + t15 += v * b3; + t16 += v * b4; + t17 += v * b5; + t18 += v * b6; + t19 += v * b7; + t20 += v * b8; + t21 += v * b9; + t22 += v * b10; + t23 += v * b11; + t24 += v * b12; + t25 += v * b13; + t26 += v * b14; + t27 += v * b15; + v = a[13]; + t13 += v * b0; + t14 += v * b1; + t15 += v * b2; + t16 += v * b3; + t17 += v * b4; + t18 += v * b5; + t19 += v * b6; + t20 += v * b7; + t21 += v * b8; + t22 += v * b9; + t23 += v * b10; + t24 += v * b11; + t25 += v * b12; + t26 += v * b13; + t27 += v * b14; + t28 += v * b15; + v = a[14]; + t14 += v * b0; + t15 += v * b1; + t16 += v * b2; + t17 += v * b3; + t18 += v * b4; + t19 += v * b5; + t20 += v * b6; + t21 += v * b7; + t22 += v * b8; + t23 += v * b9; + t24 += v * b10; + t25 += v * b11; + t26 += v * b12; + t27 += v * b13; + t28 += v * b14; + t29 += v * b15; + v = a[15]; + t15 += v * b0; + t16 += v * b1; + t17 += v * b2; + t18 += v * b3; + t19 += v * b4; + t20 += v * b5; + t21 += v * b6; + t22 += v * b7; + t23 += v * b8; + t24 += v * b9; + t25 += v * b10; + t26 += v * b11; + t27 += v * b12; + t28 += v * b13; + t29 += v * b14; + t30 += v * b15; + + t0 += 38 * t16; + t1 += 38 * t17; + t2 += 38 * t18; + t3 += 38 * t19; + t4 += 38 * t20; + t5 += 38 * t21; + t6 += 38 * t22; + t7 += 38 * t23; + t8 += 38 * t24; + t9 += 38 * t25; + t10 += 38 * t26; + t11 += 38 * t27; + t12 += 38 * t28; + t13 += 38 * t29; + t14 += 38 * t30; + // t15 left as is + + // first car + c = 1; + v = t0 + c + 65535; c = Math.floor(v / 65536); t0 = v - c * 65536; + v = t1 + c + 65535; c = Math.floor(v / 65536); t1 = v - c * 65536; + v = t2 + c + 65535; c = Math.floor(v / 65536); t2 = v - c * 65536; + v = t3 + c + 65535; c = Math.floor(v / 65536); t3 = v - c * 65536; + v = t4 + c + 65535; c = Math.floor(v / 65536); t4 = v - c * 65536; + v = t5 + c + 65535; c = Math.floor(v / 65536); t5 = v - c * 65536; + v = t6 + c + 65535; c = Math.floor(v / 65536); t6 = v - c * 65536; + v = t7 + c + 65535; c = Math.floor(v / 65536); t7 = v - c * 65536; + v = t8 + c + 65535; c = Math.floor(v / 65536); t8 = v - c * 65536; + v = t9 + c + 65535; c = Math.floor(v / 65536); t9 = v - c * 65536; + v = t10 + c + 65535; c = Math.floor(v / 65536); t10 = v - c * 65536; + v = t11 + c + 65535; c = Math.floor(v / 65536); t11 = v - c * 65536; + v = t12 + c + 65535; c = Math.floor(v / 65536); t12 = v - c * 65536; + v = t13 + c + 65535; c = Math.floor(v / 65536); t13 = v - c * 65536; + v = t14 + c + 65535; c = Math.floor(v / 65536); t14 = v - c * 65536; + v = t15 + c + 65535; c = Math.floor(v / 65536); t15 = v - c * 65536; + t0 += c-1 + 37 * (c-1); + + // second car + c = 1; + v = t0 + c + 65535; c = Math.floor(v / 65536); t0 = v - c * 65536; + v = t1 + c + 65535; c = Math.floor(v / 65536); t1 = v - c * 65536; + v = t2 + c + 65535; c = Math.floor(v / 65536); t2 = v - c * 65536; + v = t3 + c + 65535; c = Math.floor(v / 65536); t3 = v - c * 65536; + v = t4 + c + 65535; c = Math.floor(v / 65536); t4 = v - c * 65536; + v = t5 + c + 65535; c = Math.floor(v / 65536); t5 = v - c * 65536; + v = t6 + c + 65535; c = Math.floor(v / 65536); t6 = v - c * 65536; + v = t7 + c + 65535; c = Math.floor(v / 65536); t7 = v - c * 65536; + v = t8 + c + 65535; c = Math.floor(v / 65536); t8 = v - c * 65536; + v = t9 + c + 65535; c = Math.floor(v / 65536); t9 = v - c * 65536; + v = t10 + c + 65535; c = Math.floor(v / 65536); t10 = v - c * 65536; + v = t11 + c + 65535; c = Math.floor(v / 65536); t11 = v - c * 65536; + v = t12 + c + 65535; c = Math.floor(v / 65536); t12 = v - c * 65536; + v = t13 + c + 65535; c = Math.floor(v / 65536); t13 = v - c * 65536; + v = t14 + c + 65535; c = Math.floor(v / 65536); t14 = v - c * 65536; + v = t15 + c + 65535; c = Math.floor(v / 65536); t15 = v - c * 65536; + t0 += c-1 + 37 * (c-1); + + o[ 0] = t0; + o[ 1] = t1; + o[ 2] = t2; + o[ 3] = t3; + o[ 4] = t4; + o[ 5] = t5; + o[ 6] = t6; + o[ 7] = t7; + o[ 8] = t8; + o[ 9] = t9; + o[10] = t10; + o[11] = t11; + o[12] = t12; + o[13] = t13; + o[14] = t14; + o[15] = t15; +} + +function S(o, a) { + M(o, a, a); +} + +function inv25519(o, i) { + var c = gf(); + var a; + for (a = 0; a < 16; a++) c[a] = i[a]; + for (a = 253; a >= 0; a--) { + S(c, c); + if(a !== 2 && a !== 4) M(c, c, i); + } + for (a = 0; a < 16; a++) o[a] = c[a]; +} + +function pow2523(o, i) { + var c = gf(); + var a; + for (a = 0; a < 16; a++) c[a] = i[a]; + for (a = 250; a >= 0; a--) { + S(c, c); + if(a !== 1) M(c, c, i); + } + for (a = 0; a < 16; a++) o[a] = c[a]; +} + +function crypto_scalarmult(q, n, p) { + var z = new Uint8Array(32); + var x = new Float64Array(80), r, i; + var a = gf(), b = gf(), c = gf(), + d = gf(), e = gf(), f = gf(); + for (i = 0; i < 31; i++) z[i] = n[i]; + z[31]=(n[31]&127)|64; + z[0]&=248; + unpack25519(x,p); + for (i = 0; i < 16; i++) { + b[i]=x[i]; + d[i]=a[i]=c[i]=0; + } + a[0]=d[0]=1; + for (i=254; i>=0; --i) { + r=(z[i>>>3]>>>(i&7))&1; + sel25519(a,b,r); + sel25519(c,d,r); + A(e,a,c); + Z(a,a,c); + A(c,b,d); + Z(b,b,d); + S(d,e); + S(f,a); + M(a,c,a); + M(c,b,e); + A(e,a,c); + Z(a,a,c); + S(b,a); + Z(c,d,f); + M(a,c,_121665); + A(a,a,d); + M(c,c,a); + M(a,d,f); + M(d,b,x); + S(b,e); + sel25519(a,b,r); + sel25519(c,d,r); + } + for (i = 0; i < 16; i++) { + x[i+16]=a[i]; + x[i+32]=c[i]; + x[i+48]=b[i]; + x[i+64]=d[i]; + } + var x32 = x.subarray(32); + var x16 = x.subarray(16); + inv25519(x32,x32); + M(x16,x16,x32); + pack25519(q,x16); + return 0; +} + +function crypto_scalarmult_base(q, n) { + return crypto_scalarmult(q, n, _9); +} + +function crypto_box_keypair(y, x) { + randombytes(x, 32); + return crypto_scalarmult_base(y, x); +} + +function crypto_box_beforenm(k, y, x) { + var s = new Uint8Array(32); + crypto_scalarmult(s, x, y); + return crypto_core_hsalsa20(k, _0, s, sigma); +} + +var crypto_box_afternm = crypto_secretbox; +var crypto_box_open_afternm = crypto_secretbox_open; + +function crypto_box(c, m, d, n, y, x) { + var k = new Uint8Array(32); + crypto_box_beforenm(k, y, x); + return crypto_box_afternm(c, m, d, n, k); +} + +function crypto_box_open(m, c, d, n, y, x) { + var k = new Uint8Array(32); + crypto_box_beforenm(k, y, x); + return crypto_box_open_afternm(m, c, d, n, k); +} + +var K = [ + 0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd, + 0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc, + 0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019, + 0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118, + 0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe, + 0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2, + 0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1, + 0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694, + 0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3, + 0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65, + 0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483, + 0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5, + 0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210, + 0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4, + 0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725, + 0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70, + 0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926, + 0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df, + 0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8, + 0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b, + 0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001, + 0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30, + 0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910, + 0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8, + 0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53, + 0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8, + 0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb, + 0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3, + 0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60, + 0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec, + 0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9, + 0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b, + 0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207, + 0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178, + 0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6, + 0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b, + 0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493, + 0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c, + 0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a, + 0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817 +]; + +function crypto_hashblocks_hl(hh, hl, m, n) { + var wh = new Int32Array(16), wl = new Int32Array(16), + bh0, bh1, bh2, bh3, bh4, bh5, bh6, bh7, + bl0, bl1, bl2, bl3, bl4, bl5, bl6, bl7, + th, tl, i, j, h, l, a, b, c, d; + + var ah0 = hh[0], + ah1 = hh[1], + ah2 = hh[2], + ah3 = hh[3], + ah4 = hh[4], + ah5 = hh[5], + ah6 = hh[6], + ah7 = hh[7], + + al0 = hl[0], + al1 = hl[1], + al2 = hl[2], + al3 = hl[3], + al4 = hl[4], + al5 = hl[5], + al6 = hl[6], + al7 = hl[7]; + + var pos = 0; + while (n >= 128) { + for (i = 0; i < 16; i++) { + j = 8 * i + pos; + wh[i] = (m[j+0] << 24) | (m[j+1] << 16) | (m[j+2] << 8) | m[j+3]; + wl[i] = (m[j+4] << 24) | (m[j+5] << 16) | (m[j+6] << 8) | m[j+7]; + } + for (i = 0; i < 80; i++) { + bh0 = ah0; + bh1 = ah1; + bh2 = ah2; + bh3 = ah3; + bh4 = ah4; + bh5 = ah5; + bh6 = ah6; + bh7 = ah7; + + bl0 = al0; + bl1 = al1; + bl2 = al2; + bl3 = al3; + bl4 = al4; + bl5 = al5; + bl6 = al6; + bl7 = al7; + + // add + h = ah7; + l = al7; + + a = l & 0xffff; b = l >>> 16; + c = h & 0xffff; d = h >>> 16; + + // Sigma1 + h = ((ah4 >>> 14) | (al4 << (32-14))) ^ ((ah4 >>> 18) | (al4 << (32-18))) ^ ((al4 >>> (41-32)) | (ah4 << (32-(41-32)))); + l = ((al4 >>> 14) | (ah4 << (32-14))) ^ ((al4 >>> 18) | (ah4 << (32-18))) ^ ((ah4 >>> (41-32)) | (al4 << (32-(41-32)))); + + a += l & 0xffff; b += l >>> 16; + c += h & 0xffff; d += h >>> 16; + + // Ch + h = (ah4 & ah5) ^ (~ah4 & ah6); + l = (al4 & al5) ^ (~al4 & al6); + + a += l & 0xffff; b += l >>> 16; + c += h & 0xffff; d += h >>> 16; + + // K + h = K[i*2]; + l = K[i*2+1]; + + a += l & 0xffff; b += l >>> 16; + c += h & 0xffff; d += h >>> 16; + + // w + h = wh[i%16]; + l = wl[i%16]; + + a += l & 0xffff; b += l >>> 16; + c += h & 0xffff; d += h >>> 16; + + b += a >>> 16; + c += b >>> 16; + d += c >>> 16; + + th = c & 0xffff | d << 16; + tl = a & 0xffff | b << 16; + + // add + h = th; + l = tl; + + a = l & 0xffff; b = l >>> 16; + c = h & 0xffff; d = h >>> 16; + + // Sigma0 + h = ((ah0 >>> 28) | (al0 << (32-28))) ^ ((al0 >>> (34-32)) | (ah0 << (32-(34-32)))) ^ ((al0 >>> (39-32)) | (ah0 << (32-(39-32)))); + l = ((al0 >>> 28) | (ah0 << (32-28))) ^ ((ah0 >>> (34-32)) | (al0 << (32-(34-32)))) ^ ((ah0 >>> (39-32)) | (al0 << (32-(39-32)))); + + a += l & 0xffff; b += l >>> 16; + c += h & 0xffff; d += h >>> 16; + + // Maj + h = (ah0 & ah1) ^ (ah0 & ah2) ^ (ah1 & ah2); + l = (al0 & al1) ^ (al0 & al2) ^ (al1 & al2); + + a += l & 0xffff; b += l >>> 16; + c += h & 0xffff; d += h >>> 16; + + b += a >>> 16; + c += b >>> 16; + d += c >>> 16; + + bh7 = (c & 0xffff) | (d << 16); + bl7 = (a & 0xffff) | (b << 16); + + // add + h = bh3; + l = bl3; + + a = l & 0xffff; b = l >>> 16; + c = h & 0xffff; d = h >>> 16; + + h = th; + l = tl; + + a += l & 0xffff; b += l >>> 16; + c += h & 0xffff; d += h >>> 16; + + b += a >>> 16; + c += b >>> 16; + d += c >>> 16; + + bh3 = (c & 0xffff) | (d << 16); + bl3 = (a & 0xffff) | (b << 16); + + ah1 = bh0; + ah2 = bh1; + ah3 = bh2; + ah4 = bh3; + ah5 = bh4; + ah6 = bh5; + ah7 = bh6; + ah0 = bh7; + + al1 = bl0; + al2 = bl1; + al3 = bl2; + al4 = bl3; + al5 = bl4; + al6 = bl5; + al7 = bl6; + al0 = bl7; + + if (i%16 === 15) { + for (j = 0; j < 16; j++) { + // add + h = wh[j]; + l = wl[j]; + + a = l & 0xffff; b = l >>> 16; + c = h & 0xffff; d = h >>> 16; + + h = wh[(j+9)%16]; + l = wl[(j+9)%16]; + + a += l & 0xffff; b += l >>> 16; + c += h & 0xffff; d += h >>> 16; + + // sigma0 + th = wh[(j+1)%16]; + tl = wl[(j+1)%16]; + h = ((th >>> 1) | (tl << (32-1))) ^ ((th >>> 8) | (tl << (32-8))) ^ (th >>> 7); + l = ((tl >>> 1) | (th << (32-1))) ^ ((tl >>> 8) | (th << (32-8))) ^ ((tl >>> 7) | (th << (32-7))); + + a += l & 0xffff; b += l >>> 16; + c += h & 0xffff; d += h >>> 16; + + // sigma1 + th = wh[(j+14)%16]; + tl = wl[(j+14)%16]; + h = ((th >>> 19) | (tl << (32-19))) ^ ((tl >>> (61-32)) | (th << (32-(61-32)))) ^ (th >>> 6); + l = ((tl >>> 19) | (th << (32-19))) ^ ((th >>> (61-32)) | (tl << (32-(61-32)))) ^ ((tl >>> 6) | (th << (32-6))); + + a += l & 0xffff; b += l >>> 16; + c += h & 0xffff; d += h >>> 16; + + b += a >>> 16; + c += b >>> 16; + d += c >>> 16; + + wh[j] = (c & 0xffff) | (d << 16); + wl[j] = (a & 0xffff) | (b << 16); + } + } + } + + // add + h = ah0; + l = al0; + + a = l & 0xffff; b = l >>> 16; + c = h & 0xffff; d = h >>> 16; + + h = hh[0]; + l = hl[0]; + + a += l & 0xffff; b += l >>> 16; + c += h & 0xffff; d += h >>> 16; + + b += a >>> 16; + c += b >>> 16; + d += c >>> 16; + + hh[0] = ah0 = (c & 0xffff) | (d << 16); + hl[0] = al0 = (a & 0xffff) | (b << 16); + + h = ah1; + l = al1; + + a = l & 0xffff; b = l >>> 16; + c = h & 0xffff; d = h >>> 16; + + h = hh[1]; + l = hl[1]; + + a += l & 0xffff; b += l >>> 16; + c += h & 0xffff; d += h >>> 16; + + b += a >>> 16; + c += b >>> 16; + d += c >>> 16; + + hh[1] = ah1 = (c & 0xffff) | (d << 16); + hl[1] = al1 = (a & 0xffff) | (b << 16); + + h = ah2; + l = al2; + + a = l & 0xffff; b = l >>> 16; + c = h & 0xffff; d = h >>> 16; + + h = hh[2]; + l = hl[2]; + + a += l & 0xffff; b += l >>> 16; + c += h & 0xffff; d += h >>> 16; + + b += a >>> 16; + c += b >>> 16; + d += c >>> 16; + + hh[2] = ah2 = (c & 0xffff) | (d << 16); + hl[2] = al2 = (a & 0xffff) | (b << 16); + + h = ah3; + l = al3; + + a = l & 0xffff; b = l >>> 16; + c = h & 0xffff; d = h >>> 16; + + h = hh[3]; + l = hl[3]; + + a += l & 0xffff; b += l >>> 16; + c += h & 0xffff; d += h >>> 16; + + b += a >>> 16; + c += b >>> 16; + d += c >>> 16; + + hh[3] = ah3 = (c & 0xffff) | (d << 16); + hl[3] = al3 = (a & 0xffff) | (b << 16); + + h = ah4; + l = al4; + + a = l & 0xffff; b = l >>> 16; + c = h & 0xffff; d = h >>> 16; + + h = hh[4]; + l = hl[4]; + + a += l & 0xffff; b += l >>> 16; + c += h & 0xffff; d += h >>> 16; + + b += a >>> 16; + c += b >>> 16; + d += c >>> 16; + + hh[4] = ah4 = (c & 0xffff) | (d << 16); + hl[4] = al4 = (a & 0xffff) | (b << 16); + + h = ah5; + l = al5; + + a = l & 0xffff; b = l >>> 16; + c = h & 0xffff; d = h >>> 16; + + h = hh[5]; + l = hl[5]; + + a += l & 0xffff; b += l >>> 16; + c += h & 0xffff; d += h >>> 16; + + b += a >>> 16; + c += b >>> 16; + d += c >>> 16; + + hh[5] = ah5 = (c & 0xffff) | (d << 16); + hl[5] = al5 = (a & 0xffff) | (b << 16); + + h = ah6; + l = al6; + + a = l & 0xffff; b = l >>> 16; + c = h & 0xffff; d = h >>> 16; + + h = hh[6]; + l = hl[6]; + + a += l & 0xffff; b += l >>> 16; + c += h & 0xffff; d += h >>> 16; + + b += a >>> 16; + c += b >>> 16; + d += c >>> 16; + + hh[6] = ah6 = (c & 0xffff) | (d << 16); + hl[6] = al6 = (a & 0xffff) | (b << 16); + + h = ah7; + l = al7; + + a = l & 0xffff; b = l >>> 16; + c = h & 0xffff; d = h >>> 16; + + h = hh[7]; + l = hl[7]; + + a += l & 0xffff; b += l >>> 16; + c += h & 0xffff; d += h >>> 16; + + b += a >>> 16; + c += b >>> 16; + d += c >>> 16; + + hh[7] = ah7 = (c & 0xffff) | (d << 16); + hl[7] = al7 = (a & 0xffff) | (b << 16); + + pos += 128; + n -= 128; + } + + return n; +} + +function crypto_hash(out, m, n) { + var hh = new Int32Array(8), + hl = new Int32Array(8), + x = new Uint8Array(256), + i, b = n; + + hh[0] = 0x6a09e667; + hh[1] = 0xbb67ae85; + hh[2] = 0x3c6ef372; + hh[3] = 0xa54ff53a; + hh[4] = 0x510e527f; + hh[5] = 0x9b05688c; + hh[6] = 0x1f83d9ab; + hh[7] = 0x5be0cd19; + + hl[0] = 0xf3bcc908; + hl[1] = 0x84caa73b; + hl[2] = 0xfe94f82b; + hl[3] = 0x5f1d36f1; + hl[4] = 0xade682d1; + hl[5] = 0x2b3e6c1f; + hl[6] = 0xfb41bd6b; + hl[7] = 0x137e2179; + + crypto_hashblocks_hl(hh, hl, m, n); + n %= 128; + + for (i = 0; i < n; i++) x[i] = m[b-n+i]; + x[n] = 128; + + n = 256-128*(n<112?1:0); + x[n-9] = 0; + ts64(x, n-8, (b / 0x20000000) | 0, b << 3); + crypto_hashblocks_hl(hh, hl, x, n); + + for (i = 0; i < 8; i++) ts64(out, 8*i, hh[i], hl[i]); + + return 0; +} + +function add(p, q) { + var a = gf(), b = gf(), c = gf(), + d = gf(), e = gf(), f = gf(), + g = gf(), h = gf(), t = gf(); + + Z(a, p[1], p[0]); + Z(t, q[1], q[0]); + M(a, a, t); + A(b, p[0], p[1]); + A(t, q[0], q[1]); + M(b, b, t); + M(c, p[3], q[3]); + M(c, c, D2); + M(d, p[2], q[2]); + A(d, d, d); + Z(e, b, a); + Z(f, d, c); + A(g, d, c); + A(h, b, a); + + M(p[0], e, f); + M(p[1], h, g); + M(p[2], g, f); + M(p[3], e, h); +} + +function cswap(p, q, b) { + var i; + for (i = 0; i < 4; i++) { + sel25519(p[i], q[i], b); + } +} + +function pack(r, p) { + var tx = gf(), ty = gf(), zi = gf(); + inv25519(zi, p[2]); + M(tx, p[0], zi); + M(ty, p[1], zi); + pack25519(r, ty); + r[31] ^= par25519(tx) << 7; +} + +function scalarmult(p, q, s) { + var b, i; + set25519(p[0], gf0); + set25519(p[1], gf1); + set25519(p[2], gf1); + set25519(p[3], gf0); + for (i = 255; i >= 0; --i) { + b = (s[(i/8)|0] >> (i&7)) & 1; + cswap(p, q, b); + add(q, p); + add(p, p); + cswap(p, q, b); + } +} + +function scalarbase(p, s) { + var q = [gf(), gf(), gf(), gf()]; + set25519(q[0], X); + set25519(q[1], Y); + set25519(q[2], gf1); + M(q[3], X, Y); + scalarmult(p, q, s); +} + +function crypto_sign_keypair(pk, sk, seeded) { + var d = new Uint8Array(64); + var p = [gf(), gf(), gf(), gf()]; + var i; + + if (!seeded) randombytes(sk, 32); + crypto_hash(d, sk, 32); + d[0] &= 248; + d[31] &= 127; + d[31] |= 64; + + scalarbase(p, d); + pack(pk, p); + + for (i = 0; i < 32; i++) sk[i+32] = pk[i]; + return 0; +} + +var L = new Float64Array([0xed, 0xd3, 0xf5, 0x5c, 0x1a, 0x63, 0x12, 0x58, 0xd6, 0x9c, 0xf7, 0xa2, 0xde, 0xf9, 0xde, 0x14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10]); + +function modL(r, x) { + var carry, i, j, k; + for (i = 63; i >= 32; --i) { + carry = 0; + for (j = i - 32, k = i - 12; j < k; ++j) { + x[j] += carry - 16 * x[i] * L[j - (i - 32)]; + carry = (x[j] + 128) >> 8; + x[j] -= carry * 256; + } + x[j] += carry; + x[i] = 0; + } + carry = 0; + for (j = 0; j < 32; j++) { + x[j] += carry - (x[31] >> 4) * L[j]; + carry = x[j] >> 8; + x[j] &= 255; + } + for (j = 0; j < 32; j++) x[j] -= carry * L[j]; + for (i = 0; i < 32; i++) { + x[i+1] += x[i] >> 8; + r[i] = x[i] & 255; + } +} + +function reduce(r) { + var x = new Float64Array(64), i; + for (i = 0; i < 64; i++) x[i] = r[i]; + for (i = 0; i < 64; i++) r[i] = 0; + modL(r, x); +} + +// Note: difference from C - smlen returned, not passed as argument. +function crypto_sign(sm, m, n, sk) { + var d = new Uint8Array(64), h = new Uint8Array(64), r = new Uint8Array(64); + var i, j, x = new Float64Array(64); + var p = [gf(), gf(), gf(), gf()]; + + crypto_hash(d, sk, 32); + d[0] &= 248; + d[31] &= 127; + d[31] |= 64; + + var smlen = n + 64; + for (i = 0; i < n; i++) sm[64 + i] = m[i]; + for (i = 0; i < 32; i++) sm[32 + i] = d[32 + i]; + + crypto_hash(r, sm.subarray(32), n+32); + reduce(r); + scalarbase(p, r); + pack(sm, p); + + for (i = 32; i < 64; i++) sm[i] = sk[i]; + crypto_hash(h, sm, n + 64); + reduce(h); + + for (i = 0; i < 64; i++) x[i] = 0; + for (i = 0; i < 32; i++) x[i] = r[i]; + for (i = 0; i < 32; i++) { + for (j = 0; j < 32; j++) { + x[i+j] += h[i] * d[j]; + } + } + + modL(sm.subarray(32), x); + return smlen; +} + +function unpackneg(r, p) { + var t = gf(), chk = gf(), num = gf(), + den = gf(), den2 = gf(), den4 = gf(), + den6 = gf(); + + set25519(r[2], gf1); + unpack25519(r[1], p); + S(num, r[1]); + M(den, num, D); + Z(num, num, r[2]); + A(den, r[2], den); + + S(den2, den); + S(den4, den2); + M(den6, den4, den2); + M(t, den6, num); + M(t, t, den); + + pow2523(t, t); + M(t, t, num); + M(t, t, den); + M(t, t, den); + M(r[0], t, den); + + S(chk, r[0]); + M(chk, chk, den); + if (neq25519(chk, num)) M(r[0], r[0], I); + + S(chk, r[0]); + M(chk, chk, den); + if (neq25519(chk, num)) return -1; + + if (par25519(r[0]) === (p[31]>>7)) Z(r[0], gf0, r[0]); + + M(r[3], r[0], r[1]); + return 0; +} + +function crypto_sign_open(m, sm, n, pk) { + var i, mlen; + var t = new Uint8Array(32), h = new Uint8Array(64); + var p = [gf(), gf(), gf(), gf()], + q = [gf(), gf(), gf(), gf()]; + + mlen = -1; + if (n < 64) return -1; + + if (unpackneg(q, pk)) return -1; + + for (i = 0; i < n; i++) m[i] = sm[i]; + for (i = 0; i < 32; i++) m[i+32] = pk[i]; + crypto_hash(h, m, n); + reduce(h); + scalarmult(p, q, h); + + scalarbase(q, sm.subarray(32)); + add(p, q); + pack(t, p); + + n -= 64; + if (crypto_verify_32(sm, 0, t, 0)) { + for (i = 0; i < n; i++) m[i] = 0; + return -1; + } + + for (i = 0; i < n; i++) m[i] = sm[i + 64]; + mlen = n; + return mlen; +} + +var crypto_secretbox_KEYBYTES = 32, + crypto_secretbox_NONCEBYTES = 24, + crypto_secretbox_ZEROBYTES = 32, + crypto_secretbox_BOXZEROBYTES = 16, + crypto_scalarmult_BYTES = 32, + crypto_scalarmult_SCALARBYTES = 32, + crypto_box_PUBLICKEYBYTES = 32, + crypto_box_SECRETKEYBYTES = 32, + crypto_box_BEFORENMBYTES = 32, + crypto_box_NONCEBYTES = crypto_secretbox_NONCEBYTES, + crypto_box_ZEROBYTES = crypto_secretbox_ZEROBYTES, + crypto_box_BOXZEROBYTES = crypto_secretbox_BOXZEROBYTES, + crypto_sign_BYTES = 64, + crypto_sign_PUBLICKEYBYTES = 32, + crypto_sign_SECRETKEYBYTES = 64, + crypto_sign_SEEDBYTES = 32, + crypto_hash_BYTES = 64; + +nacl.lowlevel = { + crypto_core_hsalsa20: crypto_core_hsalsa20, + crypto_stream_xor: crypto_stream_xor, + crypto_stream: crypto_stream, + crypto_stream_salsa20_xor: crypto_stream_salsa20_xor, + crypto_stream_salsa20: crypto_stream_salsa20, + crypto_onetimeauth: crypto_onetimeauth, + crypto_onetimeauth_verify: crypto_onetimeauth_verify, + crypto_verify_16: crypto_verify_16, + crypto_verify_32: crypto_verify_32, + crypto_secretbox: crypto_secretbox, + crypto_secretbox_open: crypto_secretbox_open, + crypto_scalarmult: crypto_scalarmult, + crypto_scalarmult_base: crypto_scalarmult_base, + crypto_box_beforenm: crypto_box_beforenm, + crypto_box_afternm: crypto_box_afternm, + crypto_box: crypto_box, + crypto_box_open: crypto_box_open, + crypto_box_keypair: crypto_box_keypair, + crypto_hash: crypto_hash, + crypto_sign: crypto_sign, + crypto_sign_keypair: crypto_sign_keypair, + crypto_sign_open: crypto_sign_open, + + crypto_secretbox_KEYBYTES: crypto_secretbox_KEYBYTES, + crypto_secretbox_NONCEBYTES: crypto_secretbox_NONCEBYTES, + crypto_secretbox_ZEROBYTES: crypto_secretbox_ZEROBYTES, + crypto_secretbox_BOXZEROBYTES: crypto_secretbox_BOXZEROBYTES, + crypto_scalarmult_BYTES: crypto_scalarmult_BYTES, + crypto_scalarmult_SCALARBYTES: crypto_scalarmult_SCALARBYTES, + crypto_box_PUBLICKEYBYTES: crypto_box_PUBLICKEYBYTES, + crypto_box_SECRETKEYBYTES: crypto_box_SECRETKEYBYTES, + crypto_box_BEFORENMBYTES: crypto_box_BEFORENMBYTES, + crypto_box_NONCEBYTES: crypto_box_NONCEBYTES, + crypto_box_ZEROBYTES: crypto_box_ZEROBYTES, + crypto_box_BOXZEROBYTES: crypto_box_BOXZEROBYTES, + crypto_sign_BYTES: crypto_sign_BYTES, + crypto_sign_PUBLICKEYBYTES: crypto_sign_PUBLICKEYBYTES, + crypto_sign_SECRETKEYBYTES: crypto_sign_SECRETKEYBYTES, + crypto_sign_SEEDBYTES: crypto_sign_SEEDBYTES, + crypto_hash_BYTES: crypto_hash_BYTES +}; + +/* High-level API */ + +function checkLengths(k, n) { + if (k.length !== crypto_secretbox_KEYBYTES) throw new Error('bad key size'); + if (n.length !== crypto_secretbox_NONCEBYTES) throw new Error('bad nonce size'); +} + +function checkBoxLengths(pk, sk) { + if (pk.length !== crypto_box_PUBLICKEYBYTES) throw new Error('bad public key size'); + if (sk.length !== crypto_box_SECRETKEYBYTES) throw new Error('bad secret key size'); +} + +function checkArrayTypes() { + var t, i; + for (i = 0; i < arguments.length; i++) { + if ((t = Object.prototype.toString.call(arguments[i])) !== '[object Uint8Array]') + throw new TypeError('unexpected type ' + t + ', use Uint8Array'); + } +} + +function cleanup(arr) { + for (var i = 0; i < arr.length; i++) arr[i] = 0; +} + +// TODO: Completely remove this in v0.15. +if (!nacl.util) { + nacl.util = {}; + nacl.util.decodeUTF8 = nacl.util.encodeUTF8 = nacl.util.encodeBase64 = nacl.util.decodeBase64 = function() { + throw new Error('nacl.util moved into separate package: https://github.com/dchest/tweetnacl-util-js'); + }; +} + +nacl.randomBytes = function(n) { + var b = new Uint8Array(n); + randombytes(b, n); + return b; +}; + +nacl.secretbox = function(msg, nonce, key) { + checkArrayTypes(msg, nonce, key); + checkLengths(key, nonce); + var m = new Uint8Array(crypto_secretbox_ZEROBYTES + msg.length); + var c = new Uint8Array(m.length); + for (var i = 0; i < msg.length; i++) m[i+crypto_secretbox_ZEROBYTES] = msg[i]; + crypto_secretbox(c, m, m.length, nonce, key); + return c.subarray(crypto_secretbox_BOXZEROBYTES); +}; + +nacl.secretbox.open = function(box, nonce, key) { + checkArrayTypes(box, nonce, key); + checkLengths(key, nonce); + var c = new Uint8Array(crypto_secretbox_BOXZEROBYTES + box.length); + var m = new Uint8Array(c.length); + for (var i = 0; i < box.length; i++) c[i+crypto_secretbox_BOXZEROBYTES] = box[i]; + if (c.length < 32) return false; + if (crypto_secretbox_open(m, c, c.length, nonce, key) !== 0) return false; + return m.subarray(crypto_secretbox_ZEROBYTES); +}; + +nacl.secretbox.keyLength = crypto_secretbox_KEYBYTES; +nacl.secretbox.nonceLength = crypto_secretbox_NONCEBYTES; +nacl.secretbox.overheadLength = crypto_secretbox_BOXZEROBYTES; + +nacl.scalarMult = function(n, p) { + checkArrayTypes(n, p); + if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error('bad n size'); + if (p.length !== crypto_scalarmult_BYTES) throw new Error('bad p size'); + var q = new Uint8Array(crypto_scalarmult_BYTES); + crypto_scalarmult(q, n, p); + return q; +}; + +nacl.scalarMult.base = function(n) { + checkArrayTypes(n); + if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error('bad n size'); + var q = new Uint8Array(crypto_scalarmult_BYTES); + crypto_scalarmult_base(q, n); + return q; +}; + +nacl.scalarMult.scalarLength = crypto_scalarmult_SCALARBYTES; +nacl.scalarMult.groupElementLength = crypto_scalarmult_BYTES; + +nacl.box = function(msg, nonce, publicKey, secretKey) { + var k = nacl.box.before(publicKey, secretKey); + return nacl.secretbox(msg, nonce, k); +}; + +nacl.box.before = function(publicKey, secretKey) { + checkArrayTypes(publicKey, secretKey); + checkBoxLengths(publicKey, secretKey); + var k = new Uint8Array(crypto_box_BEFORENMBYTES); + crypto_box_beforenm(k, publicKey, secretKey); + return k; +}; + +nacl.box.after = nacl.secretbox; + +nacl.box.open = function(msg, nonce, publicKey, secretKey) { + var k = nacl.box.before(publicKey, secretKey); + return nacl.secretbox.open(msg, nonce, k); +}; + +nacl.box.open.after = nacl.secretbox.open; + +nacl.box.keyPair = function() { + var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES); + var sk = new Uint8Array(crypto_box_SECRETKEYBYTES); + crypto_box_keypair(pk, sk); + return {publicKey: pk, secretKey: sk}; +}; + +nacl.box.keyPair.fromSecretKey = function(secretKey) { + checkArrayTypes(secretKey); + if (secretKey.length !== crypto_box_SECRETKEYBYTES) + throw new Error('bad secret key size'); + var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES); + crypto_scalarmult_base(pk, secretKey); + return {publicKey: pk, secretKey: new Uint8Array(secretKey)}; +}; + +nacl.box.publicKeyLength = crypto_box_PUBLICKEYBYTES; +nacl.box.secretKeyLength = crypto_box_SECRETKEYBYTES; +nacl.box.sharedKeyLength = crypto_box_BEFORENMBYTES; +nacl.box.nonceLength = crypto_box_NONCEBYTES; +nacl.box.overheadLength = nacl.secretbox.overheadLength; + +nacl.sign = function(msg, secretKey) { + checkArrayTypes(msg, secretKey); + if (secretKey.length !== crypto_sign_SECRETKEYBYTES) + throw new Error('bad secret key size'); + var signedMsg = new Uint8Array(crypto_sign_BYTES+msg.length); + crypto_sign(signedMsg, msg, msg.length, secretKey); + return signedMsg; +}; + +nacl.sign.open = function(signedMsg, publicKey) { + if (arguments.length !== 2) + throw new Error('nacl.sign.open accepts 2 arguments; did you mean to use nacl.sign.detached.verify?'); + checkArrayTypes(signedMsg, publicKey); + if (publicKey.length !== crypto_sign_PUBLICKEYBYTES) + throw new Error('bad public key size'); + var tmp = new Uint8Array(signedMsg.length); + var mlen = crypto_sign_open(tmp, signedMsg, signedMsg.length, publicKey); + if (mlen < 0) return null; + var m = new Uint8Array(mlen); + for (var i = 0; i < m.length; i++) m[i] = tmp[i]; + return m; +}; + +nacl.sign.detached = function(msg, secretKey) { + var signedMsg = nacl.sign(msg, secretKey); + var sig = new Uint8Array(crypto_sign_BYTES); + for (var i = 0; i < sig.length; i++) sig[i] = signedMsg[i]; + return sig; +}; + +nacl.sign.detached.verify = function(msg, sig, publicKey) { + checkArrayTypes(msg, sig, publicKey); + if (sig.length !== crypto_sign_BYTES) + throw new Error('bad signature size'); + if (publicKey.length !== crypto_sign_PUBLICKEYBYTES) + throw new Error('bad public key size'); + var sm = new Uint8Array(crypto_sign_BYTES + msg.length); + var m = new Uint8Array(crypto_sign_BYTES + msg.length); + var i; + for (i = 0; i < crypto_sign_BYTES; i++) sm[i] = sig[i]; + for (i = 0; i < msg.length; i++) sm[i+crypto_sign_BYTES] = msg[i]; + return (crypto_sign_open(m, sm, sm.length, publicKey) >= 0); +}; + +nacl.sign.keyPair = function() { + var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES); + var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES); + crypto_sign_keypair(pk, sk); + return {publicKey: pk, secretKey: sk}; +}; + +nacl.sign.keyPair.fromSecretKey = function(secretKey) { + checkArrayTypes(secretKey); + if (secretKey.length !== crypto_sign_SECRETKEYBYTES) + throw new Error('bad secret key size'); + var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES); + for (var i = 0; i < pk.length; i++) pk[i] = secretKey[32+i]; + return {publicKey: pk, secretKey: new Uint8Array(secretKey)}; +}; + +nacl.sign.keyPair.fromSeed = function(seed) { + checkArrayTypes(seed); + if (seed.length !== crypto_sign_SEEDBYTES) + throw new Error('bad seed size'); + var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES); + var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES); + for (var i = 0; i < 32; i++) sk[i] = seed[i]; + crypto_sign_keypair(pk, sk, true); + return {publicKey: pk, secretKey: sk}; +}; + +nacl.sign.publicKeyLength = crypto_sign_PUBLICKEYBYTES; +nacl.sign.secretKeyLength = crypto_sign_SECRETKEYBYTES; +nacl.sign.seedLength = crypto_sign_SEEDBYTES; +nacl.sign.signatureLength = crypto_sign_BYTES; + +nacl.hash = function(msg) { + checkArrayTypes(msg); + var h = new Uint8Array(crypto_hash_BYTES); + crypto_hash(h, msg, msg.length); + return h; +}; + +nacl.hash.hashLength = crypto_hash_BYTES; + +nacl.verify = function(x, y) { + checkArrayTypes(x, y); + // Zero length arguments are considered not equal. + if (x.length === 0 || y.length === 0) return false; + if (x.length !== y.length) return false; + return (vn(x, 0, y, 0, x.length) === 0) ? true : false; +}; + +nacl.setPRNG = function(fn) { + randombytes = fn; +}; + +(function() { + // Initialize PRNG if environment provides CSPRNG. + // If not, methods calling randombytes will throw. + var crypto = typeof self !== 'undefined' ? (self.crypto || self.msCrypto) : null; + if (crypto && crypto.getRandomValues) { + // Browsers. + var QUOTA = 65536; + nacl.setPRNG(function(x, n) { + var i, v = new Uint8Array(n); + for (i = 0; i < n; i += QUOTA) { + crypto.getRandomValues(v.subarray(i, i + Math.min(n - i, QUOTA))); + } + for (i = 0; i < n; i++) x[i] = v[i]; + cleanup(v); + }); + } else if (true) { + // Node.js. + crypto = __webpack_require__(280); + if (crypto && crypto.randomBytes) { + nacl.setPRNG(function(x, n) { + var i, v = crypto.randomBytes(n); + for (i = 0; i < n; i++) x[i] = v[i]; + cleanup(v); + }); + } + } +})(); + +})(typeof module !== 'undefined' && module.exports ? module.exports : (self.nacl = self.nacl || {})); - /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(58).Buffer)) /***/ }, /* 117 */ /***/ function(module, exports) { - /*! - * ws: a node.js websocket client - * Copyright(c) 2011 Einar Otto Stangvik - * MIT Licensed - */ +module.exports = function(module) { + if(!module.webpackPolyfill) { + module.deprecate = function() {}; + module.paths = []; + // module.parent = undefined by default + if(!module.children) module.children = []; + Object.defineProperty(module, "loaded", { + enumerable: true, + configurable: false, + get: function() { return module.l; } + }); + Object.defineProperty(module, "id", { + enumerable: true, + configurable: false, + get: function() { return module.i; } + }); + module.webpackPolyfill = 1; + } + return module; +} - module.exports = { - isValidErrorCode: function(code) { - return (code >= 1000 && code <= 1011 && code != 1004 && code != 1005 && code != 1006) || - (code >= 3000 && code <= 4999); - }, - 1000: 'normal', - 1001: 'going away', - 1002: 'protocol error', - 1003: 'unsupported data', - 1004: 'reserved', - 1005: 'reserved for extensions', - 1006: 'reserved for extensions', - 1007: 'inconsistent or invalid data', - 1008: 'policy violation', - 1009: 'message too big', - 1010: 'extension handshake missing', - 1011: 'an unexpected condition prevented the request from being fulfilled', - }; /***/ }, /* 118 */ /***/ function(module, exports, __webpack_require__) { - 'use strict'; +"use strict"; +'use strict' - /*! - * ws: a node.js websocket client - * Copyright(c) 2011 Einar Otto Stangvik - * MIT Licensed - */ +exports.randomBytes = exports.rng = exports.pseudoRandomBytes = exports.prng = __webpack_require__(27) +exports.createHash = exports.Hash = __webpack_require__(18) +exports.createHmac = exports.Hmac = __webpack_require__(50) - try { - module.exports = __webpack_require__(119); - } catch (e) { - module.exports = __webpack_require__(124); - } +var hashes = ['sha1', 'sha224', 'sha256', 'sha384', 'sha512', 'md5', 'rmd160'].concat(Object.keys(__webpack_require__(95))) +exports.getHashes = function () { + return hashes +} + +var p = __webpack_require__(108) +exports.pbkdf2 = p.pbkdf2 +exports.pbkdf2Sync = p.pbkdf2Sync + +var aes = __webpack_require__(152) +;[ + 'Cipher', + 'createCipher', + 'Cipheriv', + 'createCipheriv', + 'Decipher', + 'createDecipher', + 'Decipheriv', + 'createDecipheriv', + 'getCiphers', + 'listCiphers' +].forEach(function (key) { + exports[key] = aes[key] +}) + +var dh = __webpack_require__(175) +;[ + 'DiffieHellmanGroup', + 'createDiffieHellmanGroup', + 'getDiffieHellman', + 'createDiffieHellman', + 'DiffieHellman' +].forEach(function (key) { + exports[key] = dh[key] +}) + +var sign = __webpack_require__(155) +;[ + 'createSign', + 'Sign', + 'createVerify', + 'Verify' +].forEach(function (key) { + exports[key] = sign[key] +}) + +exports.createECDH = __webpack_require__(162) + +var publicEncrypt = __webpack_require__(215) + +;[ + 'publicEncrypt', + 'privateEncrypt', + 'publicDecrypt', + 'privateDecrypt' +].forEach(function (key) { + exports[key] = publicEncrypt[key] +}) + +// the least I can do is make error messages for the rest of the node.js/crypto api. +;[ + 'createCredentials' +].forEach(function (name) { + exports[name] = function () { + throw new Error([ + 'sorry, ' + name + ' is not implemented yet', + 'we accept pull requests', + 'https://github.com/crypto-browserify/crypto-browserify' + ].join('\n')) + } +}) /***/ }, /* 119 */ /***/ function(module, exports, __webpack_require__) { - 'use strict'; +"use strict"; +'use strict'; - try { - module.exports = __webpack_require__(120)('bufferutil'); - } catch (e) { - module.exports = __webpack_require__(123); - } +/*! + * ws: a node.js websocket client + * Copyright(c) 2011 Einar Otto Stangvik + * MIT Licensed + */ + +var WS = module.exports = __webpack_require__(125); + +WS.Server = __webpack_require__(246); +WS.Sender = __webpack_require__(124); +WS.Receiver = __webpack_require__(123); + +/** + * Create a new WebSocket server. + * + * @param {Object} options Server options + * @param {Function} fn Optional connection listener. + * @returns {WS.Server} + * @api public + */ +WS.createServer = function createServer(options, fn) { + var server = new WS.Server(options); + + if (typeof fn === 'function') { + server.on('connection', fn); + } + + return server; +}; + +/** + * Create a new WebSocket connection. + * + * @param {String} address The URL/address we need to connect to. + * @param {Function} fn Open listener. + * @returns {WS} + * @api public + */ +WS.connect = WS.createConnection = function connect(address, fn) { + var client = new WS(address); + + if (typeof fn === 'function') { + client.on('open', fn); + } + + return client; +}; /***/ }, /* 120 */ /***/ function(module, exports, __webpack_require__) { - /* WEBPACK VAR INJECTION */(function(process, __filename) { - /** - * Module dependencies. - */ +"use strict"; +'use strict'; - var fs = __webpack_require__(62) - , path = __webpack_require__(15) - , join = path.join - , dirname = path.dirname - , exists = fs.existsSync || path.existsSync - , defaults = { - arrow: process.env.NODE_BINDINGS_ARROW || ' → ' - , compiled: process.env.NODE_BINDINGS_COMPILED_DIR || 'compiled' - , platform: process.platform - , arch: process.arch - , version: process.versions.node - , bindings: 'bindings.node' - , try: [ - // node-gyp's linked version in the "build" dir - [ 'module_root', 'build', 'bindings' ] - // node-waf and gyp_addon (a.k.a node-gyp) - , [ 'module_root', 'build', 'Debug', 'bindings' ] - , [ 'module_root', 'build', 'Release', 'bindings' ] - // Debug files, for development (legacy behavior, remove for node v0.9) - , [ 'module_root', 'out', 'Debug', 'bindings' ] - , [ 'module_root', 'Debug', 'bindings' ] - // Release files, but manually compiled (legacy behavior, remove for node v0.9) - , [ 'module_root', 'out', 'Release', 'bindings' ] - , [ 'module_root', 'Release', 'bindings' ] - // Legacy from node-waf, node <= 0.4.x - , [ 'module_root', 'build', 'default', 'bindings' ] - // Production "Release" buildtype binary (meh...) - , [ 'module_root', 'compiled', 'version', 'platform', 'arch', 'bindings' ] - ] - } +/*! + * ws: a node.js websocket client + * Copyright(c) 2011 Einar Otto Stangvik + * MIT Licensed + */ - /** - * The main `bindings()` function loads the compiled bindings for a given module. - * It uses V8's Error API to determine the parent filename that this function is - * being invoked from, which is then used to find the root directory. - */ +try { + module.exports = __webpack_require__(160); +} catch (e) { + module.exports = __webpack_require__(241); +} - function bindings (opts) { - - // Argument surgery - if (typeof opts == 'string') { - opts = { bindings: opts } - } else if (!opts) { - opts = {} - } - opts.__proto__ = defaults - - // Get the module root - if (!opts.module_root) { - opts.module_root = exports.getRoot(exports.getFileName()) - } - - // Ensure the given bindings name ends with .node - if (path.extname(opts.bindings) != '.node') { - opts.bindings += '.node' - } - - var tries = [] - , i = 0 - , l = opts.try.length - , n - , b - , err - - for (; i + * MIT Licensed + */ +module.exports = { + isValidErrorCode: function(code) { + return (code >= 1000 && code <= 1011 && code != 1004 && code != 1005 && code != 1006) || + (code >= 3000 && code <= 4999); + }, + 1000: 'normal', + 1001: 'going away', + 1002: 'protocol error', + 1003: 'unsupported data', + 1004: 'reserved', + 1005: 'reserved for extensions', + 1006: 'reserved for extensions', + 1007: 'inconsistent or invalid data', + 1008: 'policy violation', + 1009: 'message too big', + 1010: 'extension handshake missing', + 1011: 'an unexpected condition prevented the request from being fulfilled', +}; /***/ }, /* 122 */ -/***/ function(module, exports) { +/***/ function(module, exports, __webpack_require__) { + + +var util = __webpack_require__(8); + +/** + * Module exports. + */ + +exports.parse = parse; +exports.format = format; + +/** + * Parse extensions header value + */ + +function parse(value) { + value = value || ''; + + var extensions = {}; + + value.split(',').forEach(function(v) { + var params = v.split(';'); + var token = params.shift().trim(); + var paramsList = extensions[token] = extensions[token] || []; + var parsedParams = {}; + + params.forEach(function(param) { + var parts = param.trim().split('='); + var key = parts[0]; + var value = parts[1]; + if (typeof value === 'undefined') { + value = true; + } else { + // unquote value + if (value[0] === '"') { + value = value.slice(1); + } + if (value[value.length - 1] === '"') { + value = value.slice(0, value.length - 1); + } + } + (parsedParams[key] = parsedParams[key] || []).push(value); + }); + + paramsList.push(parsedParams); + }); + + return extensions; +} + +/** + * Format extensions header value + */ + +function format(value) { + return Object.keys(value).map(function(token) { + var paramsList = value[token]; + if (!util.isArray(paramsList)) { + paramsList = [paramsList]; + } + return paramsList.map(function(params) { + return [token].concat(Object.keys(params).map(function(k) { + var p = params[k]; + if (!util.isArray(p)) p = [p]; + return p.map(function(v) { + return v === true ? k : k + '=' + v; + }).join('; '); + })).join('; '); + }).join(', '); + }).join(', '); +} - module.exports = { - "_args": [ - [ - { - "raw": "bindings@~1.2.1", - "scope": null, - "escapedName": "bindings", - "name": "bindings", - "rawSpec": "~1.2.1", - "spec": ">=1.2.1 <1.3.0", - "type": "range" - }, - "/home/travis/build/hydrabolt/discord.js/node_modules/node-opus" - ] - ], - "_from": "bindings@>=1.2.1 <1.3.0", - "_id": "bindings@1.2.1", - "_inCache": true, - "_installable": true, - "_location": "/bindings", - "_npmUser": { - "name": "tootallnate", - "email": "nathan@tootallnate.net" - }, - "_npmVersion": "1.4.14", - "_phantomChildren": {}, - "_requested": { - "raw": "bindings@~1.2.1", - "scope": null, - "escapedName": "bindings", - "name": "bindings", - "rawSpec": "~1.2.1", - "spec": ">=1.2.1 <1.3.0", - "type": "range" - }, - "_requiredBy": [ - "/node-opus", - "/ref" - ], - "_resolved": "https://registry.npmjs.org/bindings/-/bindings-1.2.1.tgz", - "_shasum": "14ad6113812d2d37d72e67b4cacb4bb726505f11", - "_shrinkwrap": null, - "_spec": "bindings@~1.2.1", - "_where": "/home/travis/build/hydrabolt/discord.js/node_modules/node-opus", - "author": { - "name": "Nathan Rajlich", - "email": "nathan@tootallnate.net", - "url": "http://tootallnate.net" - }, - "bugs": { - "url": "https://github.com/TooTallNate/node-bindings/issues" - }, - "dependencies": {}, - "description": "Helper module for loading your native module's .node file", - "devDependencies": {}, - "directories": {}, - "dist": { - "shasum": "14ad6113812d2d37d72e67b4cacb4bb726505f11", - "tarball": "https://registry.npmjs.org/bindings/-/bindings-1.2.1.tgz" - }, - "gitHead": "e404152ee27f8478ccbc7122ee051246e8e5ec02", - "homepage": "https://github.com/TooTallNate/node-bindings", - "keywords": [ - "native", - "addon", - "bindings", - "gyp", - "waf", - "c", - "c++" - ], - "license": "MIT", - "main": "./bindings.js", - "maintainers": [ - { - "name": "TooTallNate", - "email": "nathan@tootallnate.net" - }, - { - "name": "tootallnate", - "email": "nathan@tootallnate.net" - } - ], - "name": "bindings", - "optionalDependencies": {}, - "readme": "ERROR: No README data found!", - "repository": { - "type": "git", - "url": "git://github.com/TooTallNate/node-bindings.git" - }, - "scripts": {}, - "version": "1.2.1" - }; /***/ }, /* 123 */ -/***/ function(module, exports) { +/***/ function(module, exports, __webpack_require__) { - 'use strict'; +/* WEBPACK VAR INJECTION */(function(Buffer) {/*! + * ws: a node.js websocket client + * Copyright(c) 2011 Einar Otto Stangvik + * MIT Licensed + */ - /*! - * bufferutil: WebSocket buffer utils - * Copyright(c) 2015 Einar Otto Stangvik - * MIT Licensed - */ +var util = __webpack_require__(8) + , Validation = __webpack_require__(245).Validation + , ErrorCodes = __webpack_require__(121) + , BufferPool = __webpack_require__(240) + , bufferUtil = __webpack_require__(120).BufferUtil + , PerMessageDeflate = __webpack_require__(40); - module.exports.BufferUtil = { - merge: function(mergedBuffer, buffers) { - for (var i = 0, offset = 0, l = buffers.length; i < l; ++i) { - var buf = buffers[i]; +/** + * HyBi Receiver implementation + */ - buf.copy(mergedBuffer, offset); - offset += buf.length; - } - }, +function Receiver (extensions,maxPayload) { + if (this instanceof Receiver === false) { + throw new TypeError("Classes can't be function-called"); + } + if(typeof extensions==='number'){ + maxPayload=extensions; + extensions={}; + } - mask: function(source, mask, output, offset, length) { - var maskNum = mask.readUInt32LE(0, true) - , i = 0 - , num; - for (; i < length - 3; i += 4) { - num = maskNum ^ source.readUInt32LE(i, true); + // memory pool for fragmented messages + var fragmentedPoolPrevUsed = -1; + this.fragmentedBufferPool = new BufferPool(1024, function(db, length) { + return db.used + length; + }, function(db) { + return fragmentedPoolPrevUsed = fragmentedPoolPrevUsed >= 0 ? + Math.ceil((fragmentedPoolPrevUsed + db.used) / 2) : + db.used; + }); - if (num < 0) num = 4294967296 + num; - output.writeUInt32LE(num, offset + i, true); - } + // memory pool for unfragmented messages + var unfragmentedPoolPrevUsed = -1; + this.unfragmentedBufferPool = new BufferPool(1024, function(db, length) { + return db.used + length; + }, function(db) { + return unfragmentedPoolPrevUsed = unfragmentedPoolPrevUsed >= 0 ? + Math.ceil((unfragmentedPoolPrevUsed + db.used) / 2) : + db.used; + }); + this.extensions = extensions || {}; + this.maxPayload = maxPayload || 0; + this.currentPayloadLength = 0; + this.state = { + activeFragmentedOperation: null, + lastFragment: false, + masked: false, + opcode: 0, + fragmentedOperation: false + }; + this.overflow = []; + this.headerBuffer = new Buffer(10); + this.expectOffset = 0; + this.expectBuffer = null; + this.expectHandler = null; + this.currentMessage = []; + this.currentMessageLength = 0; + this.messageHandlers = []; + this.expectHeader(2, this.processPacket); + this.dead = false; + this.processing = false; - switch (length % 4) { - case 3: output[offset + i + 2] = source[i + 2] ^ mask[2]; - case 2: output[offset + i + 1] = source[i + 1] ^ mask[1]; - case 1: output[offset + i] = source[i] ^ mask[0]; - } - }, + this.onerror = function() {}; + this.ontext = function() {}; + this.onbinary = function() {}; + this.onclose = function() {}; + this.onping = function() {}; + this.onpong = function() {}; +} - unmask: function(data, mask) { - var maskNum = mask.readUInt32LE(0, true) - , length = data.length - , i = 0 - , num; +module.exports = Receiver; - for (; i < length - 3; i += 4) { - num = maskNum ^ data.readUInt32LE(i, true); +/** + * Add new data to the parser. + * + * @api public + */ - if (num < 0) num = 4294967296 + num; - data.writeUInt32LE(num, i, true); - } +Receiver.prototype.add = function(data) { + if (this.dead) return; + var dataLength = data.length; + if (dataLength == 0) return; + if (this.expectBuffer == null) { + this.overflow.push(data); + return; + } + var toRead = Math.min(dataLength, this.expectBuffer.length - this.expectOffset); + fastCopy(toRead, data, this.expectBuffer, this.expectOffset); + this.expectOffset += toRead; + if (toRead < dataLength) { + this.overflow.push(data.slice(toRead)); + } + while (this.expectBuffer && this.expectOffset == this.expectBuffer.length) { + var bufferForHandler = this.expectBuffer; + this.expectBuffer = null; + this.expectOffset = 0; + this.expectHandler.call(this, bufferForHandler); + } +}; - switch (length % 4) { - case 3: data[i + 2] = data[i + 2] ^ mask[2]; - case 2: data[i + 1] = data[i + 1] ^ mask[1]; - case 1: data[i] = data[i] ^ mask[0]; - } - } - }; +/** + * Releases all resources used by the receiver. + * + * @api public + */ +Receiver.prototype.cleanup = function() { + this.dead = true; + this.overflow = null; + this.headerBuffer = null; + this.expectBuffer = null; + this.expectHandler = null; + this.unfragmentedBufferPool = null; + this.fragmentedBufferPool = null; + this.state = null; + this.currentMessage = null; + this.onerror = null; + this.ontext = null; + this.onbinary = null; + this.onclose = null; + this.onping = null; + this.onpong = null; +}; + +/** + * Waits for a certain amount of header bytes to be available, then fires a callback. + * + * @api private + */ + +Receiver.prototype.expectHeader = function(length, handler) { + if (length == 0) { + handler(null); + return; + } + this.expectBuffer = this.headerBuffer.slice(this.expectOffset, this.expectOffset + length); + this.expectHandler = handler; + var toRead = length; + while (toRead > 0 && this.overflow.length > 0) { + var fromOverflow = this.overflow.pop(); + if (toRead < fromOverflow.length) this.overflow.push(fromOverflow.slice(toRead)); + var read = Math.min(fromOverflow.length, toRead); + fastCopy(read, fromOverflow, this.expectBuffer, this.expectOffset); + this.expectOffset += read; + toRead -= read; + } +}; + +/** + * Waits for a certain amount of data bytes to be available, then fires a callback. + * + * @api private + */ + +Receiver.prototype.expectData = function(length, handler) { + if (length == 0) { + handler(null); + return; + } + this.expectBuffer = this.allocateFromPool(length, this.state.fragmentedOperation); + this.expectHandler = handler; + var toRead = length; + while (toRead > 0 && this.overflow.length > 0) { + var fromOverflow = this.overflow.pop(); + if (toRead < fromOverflow.length) this.overflow.push(fromOverflow.slice(toRead)); + var read = Math.min(fromOverflow.length, toRead); + fastCopy(read, fromOverflow, this.expectBuffer, this.expectOffset); + this.expectOffset += read; + toRead -= read; + } +}; + +/** + * Allocates memory from the buffer pool. + * + * @api private + */ + +Receiver.prototype.allocateFromPool = function(length, isFragmented) { + return (isFragmented ? this.fragmentedBufferPool : this.unfragmentedBufferPool).get(length); +}; + +/** + * Start processing a new packet. + * + * @api private + */ + +Receiver.prototype.processPacket = function (data) { + if (this.extensions[PerMessageDeflate.extensionName]) { + if ((data[0] & 0x30) != 0) { + this.error('reserved fields (2, 3) must be empty', 1002); + return; + } + } else { + if ((data[0] & 0x70) != 0) { + this.error('reserved fields must be empty', 1002); + return; + } + } + this.state.lastFragment = (data[0] & 0x80) == 0x80; + this.state.masked = (data[1] & 0x80) == 0x80; + var compressed = (data[0] & 0x40) == 0x40; + var opcode = data[0] & 0xf; + if (opcode === 0) { + if (compressed) { + this.error('continuation frame cannot have the Per-message Compressed bits', 1002); + return; + } + // continuation frame + this.state.fragmentedOperation = true; + this.state.opcode = this.state.activeFragmentedOperation; + if (!(this.state.opcode == 1 || this.state.opcode == 2)) { + this.error('continuation frame cannot follow current opcode', 1002); + return; + } + } + else { + if (opcode < 3 && this.state.activeFragmentedOperation != null) { + this.error('data frames after the initial data frame must have opcode 0', 1002); + return; + } + if (opcode >= 8 && compressed) { + this.error('control frames cannot have the Per-message Compressed bits', 1002); + return; + } + this.state.compressed = compressed; + this.state.opcode = opcode; + if (this.state.lastFragment === false) { + this.state.fragmentedOperation = true; + this.state.activeFragmentedOperation = opcode; + } + else this.state.fragmentedOperation = false; + } + var handler = opcodes[this.state.opcode]; + if (typeof handler == 'undefined') this.error('no handler for opcode ' + this.state.opcode, 1002); + else { + handler.start.call(this, data); + } +}; + +/** + * Endprocessing a packet. + * + * @api private + */ + +Receiver.prototype.endPacket = function() { + if (this.dead) return; + if (!this.state.fragmentedOperation) this.unfragmentedBufferPool.reset(true); + else if (this.state.lastFragment) this.fragmentedBufferPool.reset(true); + this.expectOffset = 0; + this.expectBuffer = null; + this.expectHandler = null; + if (this.state.lastFragment && this.state.opcode === this.state.activeFragmentedOperation) { + // end current fragmented operation + this.state.activeFragmentedOperation = null; + } + this.currentPayloadLength = 0; + this.state.lastFragment = false; + this.state.opcode = this.state.activeFragmentedOperation != null ? this.state.activeFragmentedOperation : 0; + this.state.masked = false; + this.expectHeader(2, this.processPacket); +}; + +/** + * Reset the parser state. + * + * @api private + */ + +Receiver.prototype.reset = function() { + if (this.dead) return; + this.state = { + activeFragmentedOperation: null, + lastFragment: false, + masked: false, + opcode: 0, + fragmentedOperation: false + }; + this.fragmentedBufferPool.reset(true); + this.unfragmentedBufferPool.reset(true); + this.expectOffset = 0; + this.expectBuffer = null; + this.expectHandler = null; + this.overflow = []; + this.currentMessage = []; + this.currentMessageLength = 0; + this.messageHandlers = []; + this.currentPayloadLength = 0; +}; + +/** + * Unmask received data. + * + * @api private + */ + +Receiver.prototype.unmask = function (mask, buf, binary) { + if (mask != null && buf != null) bufferUtil.unmask(buf, mask); + if (binary) return buf; + return buf != null ? buf.toString('utf8') : ''; +}; + +/** + * Handles an error + * + * @api private + */ + +Receiver.prototype.error = function (reason, protocolErrorCode) { + if (this.dead) return; + this.reset(); + if(typeof reason == 'string'){ + this.onerror(new Error(reason), protocolErrorCode); + } + else if(reason.constructor == Error){ + this.onerror(reason, protocolErrorCode); + } + else{ + this.onerror(new Error("An error occured"),protocolErrorCode); + } + return this; +}; + +/** + * Execute message handler buffers + * + * @api private + */ + +Receiver.prototype.flush = function() { + if (this.processing || this.dead) return; + + var handler = this.messageHandlers.shift(); + if (!handler) return; + + this.processing = true; + var self = this; + + handler(function() { + self.processing = false; + self.flush(); + }); +}; + +/** + * Apply extensions to message + * + * @api private + */ + +Receiver.prototype.applyExtensions = function(messageBuffer, fin, compressed, callback) { + var self = this; + if (compressed) { + this.extensions[PerMessageDeflate.extensionName].decompress(messageBuffer, fin, function(err, buffer) { + if (self.dead) return; + if (err) { + callback(new Error('invalid compressed data')); + return; + } + callback(null, buffer); + }); + } else { + callback(null, messageBuffer); + } +}; + +/** +* Checks payload size, disconnects socket when it exceeds maxPayload +* +* @api private +*/ +Receiver.prototype.maxPayloadExceeded = function(length) { + if (this.maxPayload=== undefined || this.maxPayload === null || this.maxPayload < 1) { + return false; + } + var fullLength = this.currentPayloadLength + length; + if (fullLength < this.maxPayload) { + this.currentPayloadLength = fullLength; + return false; + } + this.error('payload cannot exceed ' + this.maxPayload + ' bytes', 1009); + this.messageBuffer=[]; + this.cleanup(); + + return true; +}; + +/** + * Buffer utilities + */ + +function readUInt16BE(start) { + return (this[start]<<8) + + this[start+1]; +} + +function readUInt32BE(start) { + return (this[start]<<24) + + (this[start+1]<<16) + + (this[start+2]<<8) + + this[start+3]; +} + +function fastCopy(length, srcBuffer, dstBuffer, dstOffset) { + switch (length) { + default: srcBuffer.copy(dstBuffer, dstOffset, 0, length); break; + case 16: dstBuffer[dstOffset+15] = srcBuffer[15]; + case 15: dstBuffer[dstOffset+14] = srcBuffer[14]; + case 14: dstBuffer[dstOffset+13] = srcBuffer[13]; + case 13: dstBuffer[dstOffset+12] = srcBuffer[12]; + case 12: dstBuffer[dstOffset+11] = srcBuffer[11]; + case 11: dstBuffer[dstOffset+10] = srcBuffer[10]; + case 10: dstBuffer[dstOffset+9] = srcBuffer[9]; + case 9: dstBuffer[dstOffset+8] = srcBuffer[8]; + case 8: dstBuffer[dstOffset+7] = srcBuffer[7]; + case 7: dstBuffer[dstOffset+6] = srcBuffer[6]; + case 6: dstBuffer[dstOffset+5] = srcBuffer[5]; + case 5: dstBuffer[dstOffset+4] = srcBuffer[4]; + case 4: dstBuffer[dstOffset+3] = srcBuffer[3]; + case 3: dstBuffer[dstOffset+2] = srcBuffer[2]; + case 2: dstBuffer[dstOffset+1] = srcBuffer[1]; + case 1: dstBuffer[dstOffset] = srcBuffer[0]; + } +} + +function clone(obj) { + var cloned = {}; + for (var k in obj) { + if (obj.hasOwnProperty(k)) { + cloned[k] = obj[k]; + } + } + return cloned; +} + +/** + * Opcode handlers + */ + +var opcodes = { + // text + '1': { + start: function(data) { + var self = this; + // decode length + var firstLength = data[1] & 0x7f; + if (firstLength < 126) { + if (self.maxPayloadExceeded(firstLength)){ + self.error('Maximumpayload exceeded in compressed text message. Aborting...', 1009); + return; + } + opcodes['1'].getData.call(self, firstLength); + } + else if (firstLength == 126) { + self.expectHeader(2, function(data) { + var length = readUInt16BE.call(data, 0); + if (self.maxPayloadExceeded(length)){ + self.error('Maximumpayload exceeded in compressed text message. Aborting...', 1009); + return; + } + opcodes['1'].getData.call(self, length); + }); + } + else if (firstLength == 127) { + self.expectHeader(8, function(data) { + if (readUInt32BE.call(data, 0) != 0) { + self.error('packets with length spanning more than 32 bit is currently not supported', 1008); + return; + } + var length = readUInt32BE.call(data, 4); + if (self.maxPayloadExceeded(length)){ + self.error('Maximumpayload exceeded in compressed text message. Aborting...', 1009); + return; + } + opcodes['1'].getData.call(self, readUInt32BE.call(data, 4)); + }); + } + }, + getData: function(length) { + var self = this; + if (self.state.masked) { + self.expectHeader(4, function(data) { + var mask = data; + self.expectData(length, function(data) { + opcodes['1'].finish.call(self, mask, data); + }); + }); + } + else { + self.expectData(length, function(data) { + opcodes['1'].finish.call(self, null, data); + }); + } + }, + finish: function(mask, data) { + var self = this; + var packet = this.unmask(mask, data, true) || new Buffer(0); + var state = clone(this.state); + this.messageHandlers.push(function(callback) { + self.applyExtensions(packet, state.lastFragment, state.compressed, function(err, buffer) { + if (err) { + if(err.type===1009){ + return self.error('Maximumpayload exceeded in compressed text message. Aborting...', 1009); + } + return self.error(err.message, 1007); + } + if (buffer != null) { + if( self.maxPayload==0 || (self.maxPayload > 0 && (self.currentMessageLength + buffer.length) < self.maxPayload) ){ + self.currentMessage.push(buffer); + } + else{ + self.currentMessage=null; + self.currentMessage = []; + self.currentMessageLength = 0; + self.error(new Error('Maximum payload exceeded. maxPayload: '+self.maxPayload), 1009); + return; + } + self.currentMessageLength += buffer.length; + } + if (state.lastFragment) { + var messageBuffer = Buffer.concat(self.currentMessage); + self.currentMessage = []; + self.currentMessageLength = 0; + if (!Validation.isValidUTF8(messageBuffer)) { + self.error('invalid utf8 sequence', 1007); + return; + } + self.ontext(messageBuffer.toString('utf8'), {masked: state.masked, buffer: messageBuffer}); + } + callback(); + }); + }); + this.flush(); + this.endPacket(); + } + }, + // binary + '2': { + start: function(data) { + var self = this; + // decode length + var firstLength = data[1] & 0x7f; + if (firstLength < 126) { + if (self.maxPayloadExceeded(firstLength)){ + self.error('Max payload exceeded in compressed text message. Aborting...', 1009); + return; + } + opcodes['2'].getData.call(self, firstLength); + } + else if (firstLength == 126) { + self.expectHeader(2, function(data) { + var length = readUInt16BE.call(data, 0); + if (self.maxPayloadExceeded(length)){ + self.error('Max payload exceeded in compressed text message. Aborting...', 1009); + return; + } + opcodes['2'].getData.call(self, length); + }); + } + else if (firstLength == 127) { + self.expectHeader(8, function(data) { + if (readUInt32BE.call(data, 0) != 0) { + self.error('packets with length spanning more than 32 bit is currently not supported', 1008); + return; + } + var length = readUInt32BE.call(data, 4, true); + if (self.maxPayloadExceeded(length)){ + self.error('Max payload exceeded in compressed text message. Aborting...', 1009); + return; + } + opcodes['2'].getData.call(self, length); + }); + } + }, + getData: function(length) { + var self = this; + if (self.state.masked) { + self.expectHeader(4, function(data) { + var mask = data; + self.expectData(length, function(data) { + opcodes['2'].finish.call(self, mask, data); + }); + }); + } + else { + self.expectData(length, function(data) { + opcodes['2'].finish.call(self, null, data); + }); + } + }, + finish: function(mask, data) { + var self = this; + var packet = this.unmask(mask, data, true) || new Buffer(0); + var state = clone(this.state); + this.messageHandlers.push(function(callback) { + self.applyExtensions(packet, state.lastFragment, state.compressed, function(err, buffer) { + if (err) { + if(err.type===1009){ + return self.error('Max payload exceeded in compressed binary message. Aborting...', 1009); + } + return self.error(err.message, 1007); + } + if (buffer != null) { + if( self.maxPayload==0 || (self.maxPayload > 0 && (self.currentMessageLength + buffer.length) < self.maxPayload) ){ + self.currentMessage.push(buffer); + } + else{ + self.currentMessage=null; + self.currentMessage = []; + self.currentMessageLength = 0; + self.error(new Error('Maximum payload exceeded'), 1009); + return; + } + self.currentMessageLength += buffer.length; + } + if (state.lastFragment) { + var messageBuffer = Buffer.concat(self.currentMessage); + self.currentMessage = []; + self.currentMessageLength = 0; + self.onbinary(messageBuffer, {masked: state.masked, buffer: messageBuffer}); + } + callback(); + }); + }); + this.flush(); + this.endPacket(); + } + }, + // close + '8': { + start: function(data) { + var self = this; + if (self.state.lastFragment == false) { + self.error('fragmented close is not supported', 1002); + return; + } + + // decode length + var firstLength = data[1] & 0x7f; + if (firstLength < 126) { + opcodes['8'].getData.call(self, firstLength); + } + else { + self.error('control frames cannot have more than 125 bytes of data', 1002); + } + }, + getData: function(length) { + var self = this; + if (self.state.masked) { + self.expectHeader(4, function(data) { + var mask = data; + self.expectData(length, function(data) { + opcodes['8'].finish.call(self, mask, data); + }); + }); + } + else { + self.expectData(length, function(data) { + opcodes['8'].finish.call(self, null, data); + }); + } + }, + finish: function(mask, data) { + var self = this; + data = self.unmask(mask, data, true); + + var state = clone(this.state); + this.messageHandlers.push(function() { + if (data && data.length == 1) { + self.error('close packets with data must be at least two bytes long', 1002); + return; + } + var code = data && data.length > 1 ? readUInt16BE.call(data, 0) : 1000; + if (!ErrorCodes.isValidErrorCode(code)) { + self.error('invalid error code', 1002); + return; + } + var message = ''; + if (data && data.length > 2) { + var messageBuffer = data.slice(2); + if (!Validation.isValidUTF8(messageBuffer)) { + self.error('invalid utf8 sequence', 1007); + return; + } + message = messageBuffer.toString('utf8'); + } + self.onclose(code, message, {masked: state.masked}); + self.reset(); + }); + this.flush(); + }, + }, + // ping + '9': { + start: function(data) { + var self = this; + if (self.state.lastFragment == false) { + self.error('fragmented ping is not supported', 1002); + return; + } + + // decode length + var firstLength = data[1] & 0x7f; + if (firstLength < 126) { + opcodes['9'].getData.call(self, firstLength); + } + else { + self.error('control frames cannot have more than 125 bytes of data', 1002); + } + }, + getData: function(length) { + var self = this; + if (self.state.masked) { + self.expectHeader(4, function(data) { + var mask = data; + self.expectData(length, function(data) { + opcodes['9'].finish.call(self, mask, data); + }); + }); + } + else { + self.expectData(length, function(data) { + opcodes['9'].finish.call(self, null, data); + }); + } + }, + finish: function(mask, data) { + var self = this; + data = this.unmask(mask, data, true); + var state = clone(this.state); + this.messageHandlers.push(function(callback) { + self.onping(data, {masked: state.masked, binary: true}); + callback(); + }); + this.flush(); + this.endPacket(); + } + }, + // pong + '10': { + start: function(data) { + var self = this; + if (self.state.lastFragment == false) { + self.error('fragmented pong is not supported', 1002); + return; + } + + // decode length + var firstLength = data[1] & 0x7f; + if (firstLength < 126) { + opcodes['10'].getData.call(self, firstLength); + } + else { + self.error('control frames cannot have more than 125 bytes of data', 1002); + } + }, + getData: function(length) { + var self = this; + if (this.state.masked) { + this.expectHeader(4, function(data) { + var mask = data; + self.expectData(length, function(data) { + opcodes['10'].finish.call(self, mask, data); + }); + }); + } + else { + this.expectData(length, function(data) { + opcodes['10'].finish.call(self, null, data); + }); + } + }, + finish: function(mask, data) { + var self = this; + data = self.unmask(mask, data, true); + var state = clone(this.state); + this.messageHandlers.push(function(callback) { + self.onpong(data, {masked: state.masked, binary: true}); + callback(); + }); + this.flush(); + this.endPacket(); + } + } +} + +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer)) /***/ }, /* 124 */ -/***/ function(module, exports) { +/***/ function(module, exports, __webpack_require__) { - /*! - * ws: a node.js websocket client - * Copyright(c) 2011 Einar Otto Stangvik - * MIT Licensed - */ +/* WEBPACK VAR INJECTION */(function(Buffer) {/*! + * ws: a node.js websocket client + * Copyright(c) 2011 Einar Otto Stangvik + * MIT Licensed + */ - exports.BufferUtil = { - merge: function(mergedBuffer, buffers) { - var offset = 0; - for (var i = 0, l = buffers.length; i < l; ++i) { - var buf = buffers[i]; - buf.copy(mergedBuffer, offset); - offset += buf.length; - } - }, - mask: function(source, mask, output, offset, length) { - var maskNum = mask.readUInt32LE(0, true); - var i = 0; - for (; i < length - 3; i += 4) { - var num = maskNum ^ source.readUInt32LE(i, true); - if (num < 0) num = 4294967296 + num; - output.writeUInt32LE(num, offset + i, true); - } - switch (length % 4) { - case 3: output[offset + i + 2] = source[i + 2] ^ mask[2]; - case 2: output[offset + i + 1] = source[i + 1] ^ mask[1]; - case 1: output[offset + i] = source[i] ^ mask[0]; - case 0:; - } - }, - unmask: function(data, mask) { - var maskNum = mask.readUInt32LE(0, true); - var length = data.length; - var i = 0; - for (; i < length - 3; i += 4) { - var num = maskNum ^ data.readUInt32LE(i, true); - if (num < 0) num = 4294967296 + num; - data.writeUInt32LE(num, i, true); - } - switch (length % 4) { - case 3: data[i + 2] = data[i + 2] ^ mask[2]; - case 2: data[i + 1] = data[i + 1] ^ mask[1]; - case 1: data[i] = data[i] ^ mask[0]; - case 0:; - } - } - } +var events = __webpack_require__(3) + , util = __webpack_require__(8) + , EventEmitter = events.EventEmitter + , ErrorCodes = __webpack_require__(121) + , bufferUtil = __webpack_require__(120).BufferUtil + , PerMessageDeflate = __webpack_require__(40); +/** + * HyBi Sender implementation + */ + +function Sender(socket, extensions) { + if (this instanceof Sender === false) { + throw new TypeError("Classes can't be function-called"); + } + + events.EventEmitter.call(this); + + this._socket = socket; + this.extensions = extensions || {}; + this.firstFragment = true; + this.compress = false; + this.messageHandlers = []; + this.processing = false; +} + +/** + * Inherits from EventEmitter. + */ + +util.inherits(Sender, events.EventEmitter); + +/** + * Sends a close instruction to the remote party. + * + * @api public + */ + +Sender.prototype.close = function(code, data, mask, cb) { + if (typeof code !== 'undefined') { + if (typeof code !== 'number' || + !ErrorCodes.isValidErrorCode(code)) throw new Error('first argument must be a valid error code number'); + } + code = code || 1000; + var dataBuffer = new Buffer(2 + (data ? Buffer.byteLength(data) : 0)); + writeUInt16BE.call(dataBuffer, code, 0); + if (dataBuffer.length > 2) dataBuffer.write(data, 2); + + var self = this; + this.messageHandlers.push(function(callback) { + self.frameAndSend(0x8, dataBuffer, true, mask); + callback(); + if (typeof cb == 'function') cb(); + }); + this.flush(); +}; + +/** + * Sends a ping message to the remote party. + * + * @api public + */ + +Sender.prototype.ping = function(data, options) { + var mask = options && options.mask; + var self = this; + this.messageHandlers.push(function(callback) { + self.frameAndSend(0x9, data || '', true, mask); + callback(); + }); + this.flush(); +}; + +/** + * Sends a pong message to the remote party. + * + * @api public + */ + +Sender.prototype.pong = function(data, options) { + var mask = options && options.mask; + var self = this; + this.messageHandlers.push(function(callback) { + self.frameAndSend(0xa, data || '', true, mask); + callback(); + }); + this.flush(); +}; + +/** + * Sends text or binary data to the remote party. + * + * @api public + */ + +Sender.prototype.send = function(data, options, cb) { + var finalFragment = options && options.fin === false ? false : true; + var mask = options && options.mask; + var compress = options && options.compress; + var opcode = options && options.binary ? 2 : 1; + if (this.firstFragment === false) { + opcode = 0; + compress = false; + } else { + this.firstFragment = false; + this.compress = compress; + } + if (finalFragment) this.firstFragment = true + + var compressFragment = this.compress; + + var self = this; + this.messageHandlers.push(function(callback) { + self.applyExtensions(data, finalFragment, compressFragment, function(err, data) { + if (err) { + if (typeof cb == 'function') cb(err); + else self.emit('error', err); + return; + } + self.frameAndSend(opcode, data, finalFragment, mask, compress, cb); + callback(); + }); + }); + this.flush(); +}; + +/** + * Frames and sends a piece of data according to the HyBi WebSocket protocol. + * + * @api private + */ + +Sender.prototype.frameAndSend = function(opcode, data, finalFragment, maskData, compressed, cb) { + var canModifyData = false; + + if (!data) { + try { + this._socket.write(new Buffer([opcode | (finalFragment ? 0x80 : 0), 0 | (maskData ? 0x80 : 0)].concat(maskData ? [0, 0, 0, 0] : [])), 'binary', cb); + } + catch (e) { + if (typeof cb == 'function') cb(e); + else this.emit('error', e); + } + return; + } + + if (!Buffer.isBuffer(data)) { + canModifyData = true; + if (data && (typeof data.byteLength !== 'undefined' || typeof data.buffer !== 'undefined')) { + data = getArrayBuffer(data); + } else { + // + // If people want to send a number, this would allocate the number in + // bytes as memory size instead of storing the number as buffer value. So + // we need to transform it to string in order to prevent possible + // vulnerabilities / memory attacks. + // + if (typeof data === 'number') data = data.toString(); + + data = new Buffer(data); + } + } + + var dataLength = data.length + , dataOffset = maskData ? 6 : 2 + , secondByte = dataLength; + + if (dataLength >= 65536) { + dataOffset += 8; + secondByte = 127; + } + else if (dataLength > 125) { + dataOffset += 2; + secondByte = 126; + } + + var mergeBuffers = dataLength < 32768 || (maskData && !canModifyData); + var totalLength = mergeBuffers ? dataLength + dataOffset : dataOffset; + var outputBuffer = new Buffer(totalLength); + outputBuffer[0] = finalFragment ? opcode | 0x80 : opcode; + if (compressed) outputBuffer[0] |= 0x40; + + switch (secondByte) { + case 126: + writeUInt16BE.call(outputBuffer, dataLength, 2); + break; + case 127: + writeUInt32BE.call(outputBuffer, 0, 2); + writeUInt32BE.call(outputBuffer, dataLength, 6); + } + + if (maskData) { + outputBuffer[1] = secondByte | 0x80; + var mask = getRandomMask(); + outputBuffer[dataOffset - 4] = mask[0]; + outputBuffer[dataOffset - 3] = mask[1]; + outputBuffer[dataOffset - 2] = mask[2]; + outputBuffer[dataOffset - 1] = mask[3]; + if (mergeBuffers) { + bufferUtil.mask(data, mask, outputBuffer, dataOffset, dataLength); + try { + this._socket.write(outputBuffer, 'binary', cb); + } + catch (e) { + if (typeof cb == 'function') cb(e); + else this.emit('error', e); + } + } + else { + bufferUtil.mask(data, mask, data, 0, dataLength); + try { + this._socket.write(outputBuffer, 'binary'); + this._socket.write(data, 'binary', cb); + } + catch (e) { + if (typeof cb == 'function') cb(e); + else this.emit('error', e); + } + } + } + else { + outputBuffer[1] = secondByte; + if (mergeBuffers) { + data.copy(outputBuffer, dataOffset); + try { + this._socket.write(outputBuffer, 'binary', cb); + } + catch (e) { + if (typeof cb == 'function') cb(e); + else this.emit('error', e); + } + } + else { + try { + this._socket.write(outputBuffer, 'binary'); + this._socket.write(data, 'binary', cb); + } + catch (e) { + if (typeof cb == 'function') cb(e); + else this.emit('error', e); + } + } + } +}; + +/** + * Execute message handler buffers + * + * @api private + */ + +Sender.prototype.flush = function() { + if (this.processing) return; + + var handler = this.messageHandlers.shift(); + if (!handler) return; + + this.processing = true; + + var self = this; + + handler(function() { + self.processing = false; + self.flush(); + }); +}; + +/** + * Apply extensions to message + * + * @api private + */ + +Sender.prototype.applyExtensions = function(data, fin, compress, callback) { + if (compress && data) { + if ((data.buffer || data) instanceof ArrayBuffer) { + data = getArrayBuffer(data); + } + this.extensions[PerMessageDeflate.extensionName].compress(data, fin, callback); + } else { + callback(null, data); + } +}; + +module.exports = Sender; + +function writeUInt16BE(value, offset) { + this[offset] = (value & 0xff00)>>8; + this[offset+1] = value & 0xff; +} + +function writeUInt32BE(value, offset) { + this[offset] = (value & 0xff000000)>>24; + this[offset+1] = (value & 0xff0000)>>16; + this[offset+2] = (value & 0xff00)>>8; + this[offset+3] = value & 0xff; +} + +function getArrayBuffer(data) { + // data is either an ArrayBuffer or ArrayBufferView. + var array = new Uint8Array(data.buffer || data) + , l = data.byteLength || data.length + , o = data.byteOffset || 0 + , buffer = new Buffer(l); + for (var i = 0; i < l; ++i) { + buffer[i] = array[o+i]; + } + return buffer; +} + +function getRandomMask() { + return new Buffer([ + ~~(Math.random() * 255), + ~~(Math.random() * 255), + ~~(Math.random() * 255), + ~~(Math.random() * 255) + ]); +} + +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer)) /***/ }, /* 125 */ /***/ function(module, exports, __webpack_require__) { - /* WEBPACK VAR INJECTION */(function(Buffer) { - var zlib = __webpack_require__(126); +"use strict"; +/* WEBPACK VAR INJECTION */(function(Buffer, process) {'use strict'; - var AVAILABLE_WINDOW_BITS = [8, 9, 10, 11, 12, 13, 14, 15]; - var DEFAULT_WINDOW_BITS = 15; - var DEFAULT_MEM_LEVEL = 8; +/*! + * ws: a node.js websocket client + * Copyright(c) 2011 Einar Otto Stangvik + * MIT Licensed + */ - PerMessageDeflate.extensionName = 'permessage-deflate'; +var url = __webpack_require__(59) + , util = __webpack_require__(8) + , http = __webpack_require__(52) + , https = __webpack_require__(236) + , crypto = __webpack_require__(118) + , stream = __webpack_require__(9) + , Ultron = __webpack_require__(229) + , Options = __webpack_require__(104) + , Sender = __webpack_require__(124) + , Receiver = __webpack_require__(123) + , SenderHixie = __webpack_require__(243) + , ReceiverHixie = __webpack_require__(242) + , Extensions = __webpack_require__(122) + , PerMessageDeflate = __webpack_require__(40) + , EventEmitter = __webpack_require__(3).EventEmitter; - /** - * Per-message Compression Extensions implementation - */ +/** + * Constants + */ - function PerMessageDeflate(options, isServer,maxPayload) { - if (this instanceof PerMessageDeflate === false) { - throw new TypeError("Classes can't be function-called"); - } +// Default protocol version - this._options = options || {}; - this._isServer = !!isServer; - this._inflate = null; - this._deflate = null; - this.params = null; - this._maxPayload = maxPayload || 0; - } +var protocolVersion = 13; - /** - * Create extension parameters offer - * - * @api public - */ +// Close timeout - PerMessageDeflate.prototype.offer = function() { - var params = {}; - if (this._options.serverNoContextTakeover) { - params.server_no_context_takeover = true; - } - if (this._options.clientNoContextTakeover) { - params.client_no_context_takeover = true; - } - if (this._options.serverMaxWindowBits) { - params.server_max_window_bits = this._options.serverMaxWindowBits; - } - if (this._options.clientMaxWindowBits) { - params.client_max_window_bits = this._options.clientMaxWindowBits; - } else if (this._options.clientMaxWindowBits == null) { - params.client_max_window_bits = true; - } - return params; - }; +var closeTimeout = 30 * 1000; // Allow 30 seconds to terminate the connection cleanly - /** - * Accept extension offer - * - * @api public - */ +/** + * WebSocket implementation + * + * @constructor + * @param {String} address Connection address. + * @param {String|Array} protocols WebSocket protocols. + * @param {Object} options Additional connection options. + * @api public + */ +function WebSocket(address, protocols, options) { + if (this instanceof WebSocket === false) { + return new WebSocket(address, protocols, options); + } - PerMessageDeflate.prototype.accept = function(paramsList) { - paramsList = this.normalizeParams(paramsList); + EventEmitter.call(this); - var params; - if (this._isServer) { - params = this.acceptAsServer(paramsList); - } else { - params = this.acceptAsClient(paramsList); - } + if (protocols && !Array.isArray(protocols) && 'object' === typeof protocols) { + // accept the "options" Object as the 2nd argument + options = protocols; + protocols = null; + } - this.params = params; - return params; - }; + if ('string' === typeof protocols) { + protocols = [ protocols ]; + } - /** - * Releases all resources used by the extension - * - * @api public - */ + if (!Array.isArray(protocols)) { + protocols = []; + } - PerMessageDeflate.prototype.cleanup = function() { - if (this._inflate) { - if (this._inflate.writeInProgress) { - this._inflate.pendingClose = true; - } else { - if (this._inflate.close) this._inflate.close(); - this._inflate = null; - } - } - if (this._deflate) { - if (this._deflate.writeInProgress) { - this._deflate.pendingClose = true; - } else { - if (this._deflate.close) this._deflate.close(); - this._deflate = null; - } - } - }; + this._socket = null; + this._ultron = null; + this._closeReceived = false; + this.bytesReceived = 0; + this.readyState = null; + this.supports = {}; + this.extensions = {}; + this._binaryType = 'nodebuffer'; - /** - * Accept extension offer from client - * - * @api private - */ + if (Array.isArray(address)) { + initAsServerClient.apply(this, address.concat(options)); + } else { + initAsClient.apply(this, [address, protocols, options]); + } +} - PerMessageDeflate.prototype.acceptAsServer = function(paramsList) { - var accepted = {}; - var result = paramsList.some(function(params) { - accepted = {}; - if (this._options.serverNoContextTakeover === false && params.server_no_context_takeover) { - return; - } - if (this._options.serverMaxWindowBits === false && params.server_max_window_bits) { - return; - } - if (typeof this._options.serverMaxWindowBits === 'number' && - typeof params.server_max_window_bits === 'number' && - this._options.serverMaxWindowBits > params.server_max_window_bits) { - return; - } - if (typeof this._options.clientMaxWindowBits === 'number' && !params.client_max_window_bits) { - return; - } +/** + * Inherits from EventEmitter. + */ +util.inherits(WebSocket, EventEmitter); - if (this._options.serverNoContextTakeover || params.server_no_context_takeover) { - accepted.server_no_context_takeover = true; - } - if (this._options.clientNoContextTakeover) { - accepted.client_no_context_takeover = true; - } - if (this._options.clientNoContextTakeover !== false && params.client_no_context_takeover) { - accepted.client_no_context_takeover = true; - } - if (typeof this._options.serverMaxWindowBits === 'number') { - accepted.server_max_window_bits = this._options.serverMaxWindowBits; - } else if (typeof params.server_max_window_bits === 'number') { - accepted.server_max_window_bits = params.server_max_window_bits; - } - if (typeof this._options.clientMaxWindowBits === 'number') { - accepted.client_max_window_bits = this._options.clientMaxWindowBits; - } else if (this._options.clientMaxWindowBits !== false && typeof params.client_max_window_bits === 'number') { - accepted.client_max_window_bits = params.client_max_window_bits; - } - return true; - }, this); +/** + * Ready States + */ +["CONNECTING", "OPEN", "CLOSING", "CLOSED"].forEach(function each(state, index) { + WebSocket.prototype[state] = WebSocket[state] = index; +}); - if (!result) { - throw new Error('Doesn\'t support the offered configuration'); - } +/** + * Gracefully closes the connection, after sending a description message to the server + * + * @param {Object} data to be sent to the server + * @api public + */ +WebSocket.prototype.close = function close(code, data) { + if (this.readyState === WebSocket.CLOSED) return; - return accepted; - }; + if (this.readyState === WebSocket.CONNECTING) { + this.readyState = WebSocket.CLOSED; + return; + } - /** - * Accept extension response from server - * - * @api privaye - */ + if (this.readyState === WebSocket.CLOSING) { + if (this._closeReceived && this._isServer) { + this.terminate(); + } + return; + } - PerMessageDeflate.prototype.acceptAsClient = function(paramsList) { - var params = paramsList[0]; - if (this._options.clientNoContextTakeover != null) { - if (this._options.clientNoContextTakeover === false && params.client_no_context_takeover) { - throw new Error('Invalid value for "client_no_context_takeover"'); - } - } - if (this._options.clientMaxWindowBits != null) { - if (this._options.clientMaxWindowBits === false && params.client_max_window_bits) { - throw new Error('Invalid value for "client_max_window_bits"'); - } - if (typeof this._options.clientMaxWindowBits === 'number' && - (!params.client_max_window_bits || params.client_max_window_bits > this._options.clientMaxWindowBits)) { - throw new Error('Invalid value for "client_max_window_bits"'); - } - } - return params; - }; + var self = this; + try { + this.readyState = WebSocket.CLOSING; + this._closeCode = code; + this._closeMessage = data; + var mask = !this._isServer; + this._sender.close(code, data, mask, function(err) { + if (err) self.emit('error', err); - /** - * Normalize extensions parameters - * - * @api private - */ + if (self._closeReceived && self._isServer) { + self.terminate(); + } else { + // ensure that the connection is cleaned up even when no response of closing handshake. + clearTimeout(self._closeTimer); + self._closeTimer = setTimeout(cleanupWebsocketResources.bind(self, true), closeTimeout); + } + }); + } catch (e) { + this.emit('error', e); + } +}; - PerMessageDeflate.prototype.normalizeParams = function(paramsList) { - return paramsList.map(function(params) { - Object.keys(params).forEach(function(key) { - var value = params[key]; - if (value.length > 1) { - throw new Error('Multiple extension parameters for ' + key); - } +/** + * Pause the client stream + * + * @api public + */ +WebSocket.prototype.pause = function pauser() { + if (this.readyState !== WebSocket.OPEN) throw new Error('not opened'); - value = value[0]; + return this._socket.pause(); +}; - switch (key) { - case 'server_no_context_takeover': - case 'client_no_context_takeover': - if (value !== true) { - throw new Error('invalid extension parameter value for ' + key + ' (' + value + ')'); - } - params[key] = true; - break; - case 'server_max_window_bits': - case 'client_max_window_bits': - if (typeof value === 'string') { - value = parseInt(value, 10); - if (!~AVAILABLE_WINDOW_BITS.indexOf(value)) { - throw new Error('invalid extension parameter value for ' + key + ' (' + value + ')'); - } - } - if (!this._isServer && value === true) { - throw new Error('Missing extension parameter value for ' + key); - } - params[key] = value; - break; - default: - throw new Error('Not defined extension parameter (' + key + ')'); - } - }, this); - return params; - }, this); - }; +/** + * Sends a ping + * + * @param {Object} data to be sent to the server + * @param {Object} Members - mask: boolean, binary: boolean + * @param {boolean} dontFailWhenClosed indicates whether or not to throw if the connection isnt open + * @api public + */ +WebSocket.prototype.ping = function ping(data, options, dontFailWhenClosed) { + if (this.readyState !== WebSocket.OPEN) { + if (dontFailWhenClosed === true) return; + throw new Error('not opened'); + } - /** - * Decompress message - * - * @api public - */ + options = options || {}; - PerMessageDeflate.prototype.decompress = function (data, fin, callback) { - var endpoint = this._isServer ? 'client' : 'server'; + if (typeof options.mask === 'undefined') options.mask = !this._isServer; - if (!this._inflate) { - var maxWindowBits = this.params[endpoint + '_max_window_bits']; - this._inflate = zlib.createInflateRaw({ - windowBits: 'number' === typeof maxWindowBits ? maxWindowBits : DEFAULT_WINDOW_BITS - }); - } - this._inflate.writeInProgress = true; + this._sender.ping(data, options); +}; - var self = this; - var buffers = []; - var cumulativeBufferLength=0; +/** + * Sends a pong + * + * @param {Object} data to be sent to the server + * @param {Object} Members - mask: boolean, binary: boolean + * @param {boolean} dontFailWhenClosed indicates whether or not to throw if the connection isnt open + * @api public + */ +WebSocket.prototype.pong = function(data, options, dontFailWhenClosed) { + if (this.readyState !== WebSocket.OPEN) { + if (dontFailWhenClosed === true) return; + throw new Error('not opened'); + } - this._inflate.on('error', onError).on('data', onData); - this._inflate.write(data); - if (fin) { - this._inflate.write(new Buffer([0x00, 0x00, 0xff, 0xff])); - } - this._inflate.flush(function() { - cleanup(); - callback(null, Buffer.concat(buffers)); - }); + options = options || {}; - function onError(err) { - cleanup(); - callback(err); - } + if (typeof options.mask === 'undefined') options.mask = !this._isServer; - function onData(data) { - if(self._maxPayload!==undefined && self._maxPayload!==null && self._maxPayload>0){ - cumulativeBufferLength+=data.length; - if(cumulativeBufferLength>self._maxPayload){ - buffers=[]; - cleanup(); - var err={type:1009}; - callback(err); - return; - } - } - buffers.push(data); - } + this._sender.pong(data, options); +}; - function cleanup() { - if (!self._inflate) return; - self._inflate.removeListener('error', onError); - self._inflate.removeListener('data', onData); - self._inflate.writeInProgress = false; - if ((fin && self.params[endpoint + '_no_context_takeover']) || self._inflate.pendingClose) { - if (self._inflate.close) self._inflate.close(); - self._inflate = null; - } - } - }; +/** + * Resume the client stream + * + * @api public + */ +WebSocket.prototype.resume = function resume() { + if (this.readyState !== WebSocket.OPEN) throw new Error('not opened'); - /** - * Compress message - * - * @api public - */ + return this._socket.resume(); +}; - PerMessageDeflate.prototype.compress = function (data, fin, callback) { - var endpoint = this._isServer ? 'server' : 'client'; +/** + * Sends a piece of data + * + * @param {Object} data to be sent to the server + * @param {Object} Members - mask: boolean, binary: boolean, compress: boolean + * @param {function} Optional callback which is executed after the send completes + * @api public + */ - if (!this._deflate) { - var maxWindowBits = this.params[endpoint + '_max_window_bits']; - this._deflate = zlib.createDeflateRaw({ - flush: zlib.Z_SYNC_FLUSH, - windowBits: 'number' === typeof maxWindowBits ? maxWindowBits : DEFAULT_WINDOW_BITS, - memLevel: this._options.memLevel || DEFAULT_MEM_LEVEL - }); - } - this._deflate.writeInProgress = true; +WebSocket.prototype.send = function send(data, options, cb) { + if (typeof options === 'function') { + cb = options; + options = {}; + } - var self = this; - var buffers = []; + if (this.readyState !== WebSocket.OPEN) { + if (typeof cb === 'function') cb(new Error('not opened')); + else throw new Error('not opened'); + return; + } - this._deflate.on('error', onError).on('data', onData); - this._deflate.write(data); - this._deflate.flush(function() { - cleanup(); - var data = Buffer.concat(buffers); - if (fin) { - data = data.slice(0, data.length - 4); - } - callback(null, data); - }); + if (!data) data = ''; + if (this._queue) { + var self = this; + this._queue.push(function() { self.send(data, options, cb); }); + return; + } - function onError(err) { - cleanup(); - callback(err); - } + options = options || {}; + options.fin = true; - function onData(data) { - buffers.push(data); - } + if (typeof options.binary === 'undefined') { + options.binary = (data instanceof ArrayBuffer || data instanceof Buffer || + data instanceof Uint8Array || + data instanceof Uint16Array || + data instanceof Uint32Array || + data instanceof Int8Array || + data instanceof Int16Array || + data instanceof Int32Array || + data instanceof Float32Array || + data instanceof Float64Array); + } - function cleanup() { - if (!self._deflate) return; - self._deflate.removeListener('error', onError); - self._deflate.removeListener('data', onData); - self._deflate.writeInProgress = false; - if ((fin && self.params[endpoint + '_no_context_takeover']) || self._deflate.pendingClose) { - if (self._deflate.close) self._deflate.close(); - self._deflate = null; - } - } - }; + if (typeof options.mask === 'undefined') options.mask = !this._isServer; + if (typeof options.compress === 'undefined') options.compress = true; + if (!this.extensions[PerMessageDeflate.extensionName]) { + options.compress = false; + } - module.exports = PerMessageDeflate; + var readable = typeof stream.Readable === 'function' + ? stream.Readable + : stream.Stream; - /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(58).Buffer)) + if (data instanceof readable) { + startQueue(this); + var self = this; + + sendStream(this, data, options, function send(error) { + process.nextTick(function tock() { + executeQueueSends(self); + }); + + if (typeof cb === 'function') cb(error); + }); + } else { + this._sender.send(data, options, cb); + } +}; + +/** + * Streams data through calls to a user supplied function + * + * @param {Object} Members - mask: boolean, binary: boolean, compress: boolean + * @param {function} 'function (error, send)' which is executed on successive ticks of which send is 'function (data, final)'. + * @api public + */ +WebSocket.prototype.stream = function stream(options, cb) { + if (typeof options === 'function') { + cb = options; + options = {}; + } + + var self = this; + + if (typeof cb !== 'function') throw new Error('callback must be provided'); + + if (this.readyState !== WebSocket.OPEN) { + if (typeof cb === 'function') cb(new Error('not opened')); + else throw new Error('not opened'); + return; + } + + if (this._queue) { + this._queue.push(function () { self.stream(options, cb); }); + return; + } + + options = options || {}; + + if (typeof options.mask === 'undefined') options.mask = !this._isServer; + if (typeof options.compress === 'undefined') options.compress = true; + if (!this.extensions[PerMessageDeflate.extensionName]) { + options.compress = false; + } + + startQueue(this); + + function send(data, final) { + try { + if (self.readyState !== WebSocket.OPEN) throw new Error('not opened'); + options.fin = final === true; + self._sender.send(data, options); + if (!final) process.nextTick(cb.bind(null, null, send)); + else executeQueueSends(self); + } catch (e) { + if (typeof cb === 'function') cb(e); + else { + delete self._queue; + self.emit('error', e); + } + } + } + + process.nextTick(cb.bind(null, null, send)); +}; + +/** + * Immediately shuts down the connection + * + * @api public + */ +WebSocket.prototype.terminate = function terminate() { + if (this.readyState === WebSocket.CLOSED) return; + + if (this._socket) { + this.readyState = WebSocket.CLOSING; + + // End the connection + try { this._socket.end(); } + catch (e) { + // Socket error during end() call, so just destroy it right now + cleanupWebsocketResources.call(this, true); + return; + } + + // Add a timeout to ensure that the connection is completely + // cleaned up within 30 seconds, even if the clean close procedure + // fails for whatever reason + // First cleanup any pre-existing timeout from an earlier "terminate" call, + // if one exists. Otherwise terminate calls in quick succession will leak timeouts + // and hold the program open for `closeTimout` time. + if (this._closeTimer) { clearTimeout(this._closeTimer); } + this._closeTimer = setTimeout(cleanupWebsocketResources.bind(this, true), closeTimeout); + } else if (this.readyState === WebSocket.CONNECTING) { + cleanupWebsocketResources.call(this, true); + } +}; + +/** + * Expose bufferedAmount + * + * @api public + */ +Object.defineProperty(WebSocket.prototype, 'bufferedAmount', { + get: function get() { + var amount = 0; + if (this._socket) { + amount = this._socket.bufferSize || 0; + } + return amount; + } +}); + +/** + * Expose binaryType + * + * This deviates from the W3C interface since ws doesn't support the required + * default "blob" type (instead we define a custom "nodebuffer" type). + * + * @see http://dev.w3.org/html5/websockets/#the-websocket-interface + * @api public + */ +Object.defineProperty(WebSocket.prototype, 'binaryType', { + get: function get() { + return this._binaryType; + }, + set: function set(type) { + if (type === 'arraybuffer' || type === 'nodebuffer') + this._binaryType = type; + else + throw new SyntaxError('unsupported binaryType: must be either "nodebuffer" or "arraybuffer"'); + } +}); + +/** + * Emulates the W3C Browser based WebSocket interface using function members. + * + * @see http://dev.w3.org/html5/websockets/#the-websocket-interface + * @api public + */ +['open', 'error', 'close', 'message'].forEach(function(method) { + Object.defineProperty(WebSocket.prototype, 'on' + method, { + /** + * Returns the current listener + * + * @returns {Mixed} the set function or undefined + * @api public + */ + get: function get() { + var listener = this.listeners(method)[0]; + return listener ? (listener._listener ? listener._listener : listener) : undefined; + }, + + /** + * Start listening for events + * + * @param {Function} listener the listener + * @returns {Mixed} the set function or undefined + * @api public + */ + set: function set(listener) { + this.removeAllListeners(method); + this.addEventListener(method, listener); + } + }); +}); + +/** + * Emulates the W3C Browser based WebSocket interface using addEventListener. + * + * @see https://developer.mozilla.org/en/DOM/element.addEventListener + * @see http://dev.w3.org/html5/websockets/#the-websocket-interface + * @api public + */ +WebSocket.prototype.addEventListener = function(method, listener) { + var target = this; + + function onMessage (data, flags) { + if (flags.binary && this.binaryType === 'arraybuffer') + data = new Uint8Array(data).buffer; + listener.call(target, new MessageEvent(data, !!flags.binary, target)); + } + + function onClose (code, message) { + listener.call(target, new CloseEvent(code, message, target)); + } + + function onError (event) { + event.type = 'error'; + event.target = target; + listener.call(target, event); + } + + function onOpen () { + listener.call(target, new OpenEvent(target)); + } + + if (typeof listener === 'function') { + if (method === 'message') { + // store a reference so we can return the original function from the + // addEventListener hook + onMessage._listener = listener; + this.on(method, onMessage); + } else if (method === 'close') { + // store a reference so we can return the original function from the + // addEventListener hook + onClose._listener = listener; + this.on(method, onClose); + } else if (method === 'error') { + // store a reference so we can return the original function from the + // addEventListener hook + onError._listener = listener; + this.on(method, onError); + } else if (method === 'open') { + // store a reference so we can return the original function from the + // addEventListener hook + onOpen._listener = listener; + this.on(method, onOpen); + } else { + this.on(method, listener); + } + } +}; + +module.exports = WebSocket; +module.exports.buildHostHeader = buildHostHeader + +/** + * W3C MessageEvent + * + * @see http://www.w3.org/TR/html5/comms.html + * @constructor + * @api private + */ +function MessageEvent(dataArg, isBinary, target) { + this.type = 'message'; + this.data = dataArg; + this.target = target; + this.binary = isBinary; // non-standard. +} + +/** + * W3C CloseEvent + * + * @see http://www.w3.org/TR/html5/comms.html + * @constructor + * @api private + */ +function CloseEvent(code, reason, target) { + this.type = 'close'; + this.wasClean = (typeof code === 'undefined' || code === 1000); + this.code = code; + this.reason = reason; + this.target = target; +} + +/** + * W3C OpenEvent + * + * @see http://www.w3.org/TR/html5/comms.html + * @constructor + * @api private + */ +function OpenEvent(target) { + this.type = 'open'; + this.target = target; +} + +// Append port number to Host header, only if specified in the url +// and non-default +function buildHostHeader(isSecure, hostname, port) { + var headerHost = hostname; + if (hostname) { + if ((isSecure && (port != 443)) || (!isSecure && (port != 80))){ + headerHost = headerHost + ':' + port; + } + } + return headerHost; +} + +/** + * Entirely private apis, + * which may or may not be bound to a sepcific WebSocket instance. + */ +function initAsServerClient(req, socket, upgradeHead, options) { + options = new Options({ + protocolVersion: protocolVersion, + protocol: null, + extensions: {}, + maxPayload: 0 + }).merge(options); + + // expose state properties + this.protocol = options.value.protocol; + this.protocolVersion = options.value.protocolVersion; + this.extensions = options.value.extensions; + this.supports.binary = (this.protocolVersion !== 'hixie-76'); + this.upgradeReq = req; + this.readyState = WebSocket.CONNECTING; + this._isServer = true; + this.maxPayload = options.value.maxPayload; + // establish connection + if (options.value.protocolVersion === 'hixie-76') { + establishConnection.call(this, ReceiverHixie, SenderHixie, socket, upgradeHead); + } else { + establishConnection.call(this, Receiver, Sender, socket, upgradeHead); + } +} + +function initAsClient(address, protocols, options) { + options = new Options({ + origin: null, + protocolVersion: protocolVersion, + host: null, + headers: null, + protocol: protocols.join(','), + agent: null, + + // ssl-related options + pfx: null, + key: null, + passphrase: null, + cert: null, + ca: null, + ciphers: null, + rejectUnauthorized: null, + perMessageDeflate: true, + localAddress: null + }).merge(options); + + if (options.value.protocolVersion !== 8 && options.value.protocolVersion !== 13) { + throw new Error('unsupported protocol version'); + } + + // verify URL and establish http class + var serverUrl = url.parse(address); + var isUnixSocket = serverUrl.protocol === 'ws+unix:'; + if (!serverUrl.host && !isUnixSocket) throw new Error('invalid url'); + var isSecure = serverUrl.protocol === 'wss:' || serverUrl.protocol === 'https:'; + var httpObj = isSecure ? https : http; + var port = serverUrl.port || (isSecure ? 443 : 80); + var auth = serverUrl.auth; + + // prepare extensions + var extensionsOffer = {}; + var perMessageDeflate; + if (options.value.perMessageDeflate) { + perMessageDeflate = new PerMessageDeflate(typeof options.value.perMessageDeflate !== true ? options.value.perMessageDeflate : {}, false); + extensionsOffer[PerMessageDeflate.extensionName] = perMessageDeflate.offer(); + } + + // expose state properties + this._isServer = false; + this.url = address; + this.protocolVersion = options.value.protocolVersion; + this.supports.binary = (this.protocolVersion !== 'hixie-76'); + + // begin handshake + var key = new Buffer(options.value.protocolVersion + '-' + Date.now()).toString('base64'); + var shasum = crypto.createHash('sha1'); + shasum.update(key + '258EAFA5-E914-47DA-95CA-C5AB0DC85B11'); + var expectedServerKey = shasum.digest('base64'); + + var agent = options.value.agent; + + var headerHost = buildHostHeader(isSecure, serverUrl.hostname, port) + + var requestOptions = { + port: port, + host: serverUrl.hostname, + headers: { + 'Connection': 'Upgrade', + 'Upgrade': 'websocket', + 'Host': headerHost, + 'Sec-WebSocket-Version': options.value.protocolVersion, + 'Sec-WebSocket-Key': key + } + }; + + // If we have basic auth. + if (auth) { + requestOptions.headers.Authorization = 'Basic ' + new Buffer(auth).toString('base64'); + } + + if (options.value.protocol) { + requestOptions.headers['Sec-WebSocket-Protocol'] = options.value.protocol; + } + + if (options.value.host) { + requestOptions.headers.Host = options.value.host; + } + + if (options.value.headers) { + for (var header in options.value.headers) { + if (options.value.headers.hasOwnProperty(header)) { + requestOptions.headers[header] = options.value.headers[header]; + } + } + } + + if (Object.keys(extensionsOffer).length) { + requestOptions.headers['Sec-WebSocket-Extensions'] = Extensions.format(extensionsOffer); + } + + if (options.isDefinedAndNonNull('pfx') + || options.isDefinedAndNonNull('key') + || options.isDefinedAndNonNull('passphrase') + || options.isDefinedAndNonNull('cert') + || options.isDefinedAndNonNull('ca') + || options.isDefinedAndNonNull('ciphers') + || options.isDefinedAndNonNull('rejectUnauthorized')) { + + if (options.isDefinedAndNonNull('pfx')) requestOptions.pfx = options.value.pfx; + if (options.isDefinedAndNonNull('key')) requestOptions.key = options.value.key; + if (options.isDefinedAndNonNull('passphrase')) requestOptions.passphrase = options.value.passphrase; + if (options.isDefinedAndNonNull('cert')) requestOptions.cert = options.value.cert; + if (options.isDefinedAndNonNull('ca')) requestOptions.ca = options.value.ca; + if (options.isDefinedAndNonNull('ciphers')) requestOptions.ciphers = options.value.ciphers; + if (options.isDefinedAndNonNull('rejectUnauthorized')) requestOptions.rejectUnauthorized = options.value.rejectUnauthorized; + + if (!agent) { + // global agent ignores client side certificates + agent = new httpObj.Agent(requestOptions); + } + } + + requestOptions.path = serverUrl.path || '/'; + + if (agent) { + requestOptions.agent = agent; + } + + if (isUnixSocket) { + requestOptions.socketPath = serverUrl.pathname; + } + + if (options.value.localAddress) { + requestOptions.localAddress = options.value.localAddress; + } + + if (options.value.origin) { + if (options.value.protocolVersion < 13) requestOptions.headers['Sec-WebSocket-Origin'] = options.value.origin; + else requestOptions.headers.Origin = options.value.origin; + } + + var self = this; + var req = httpObj.request(requestOptions); + + req.on('error', function onerror(error) { + self.emit('error', error); + cleanupWebsocketResources.call(self, error); + }); + + req.once('response', function response(res) { + var error; + + if (!self.emit('unexpected-response', req, res)) { + error = new Error('unexpected server response (' + res.statusCode + ')'); + req.abort(); + self.emit('error', error); + } + + cleanupWebsocketResources.call(self, error); + }); + + req.once('upgrade', function upgrade(res, socket, upgradeHead) { + if (self.readyState === WebSocket.CLOSED) { + // client closed before server accepted connection + self.emit('close'); + self.removeAllListeners(); + socket.end(); + return; + } + + var serverKey = res.headers['sec-websocket-accept']; + if (typeof serverKey === 'undefined' || serverKey !== expectedServerKey) { + self.emit('error', 'invalid server key'); + self.removeAllListeners(); + socket.end(); + return; + } + + var serverProt = res.headers['sec-websocket-protocol']; + var protList = (options.value.protocol || "").split(/, */); + var protError = null; + + if (!options.value.protocol && serverProt) { + protError = 'server sent a subprotocol even though none requested'; + } else if (options.value.protocol && !serverProt) { + protError = 'server sent no subprotocol even though requested'; + } else if (serverProt && protList.indexOf(serverProt) === -1) { + protError = 'server responded with an invalid protocol'; + } + + if (protError) { + self.emit('error', protError); + self.removeAllListeners(); + socket.end(); + return; + } else if (serverProt) { + self.protocol = serverProt; + } + + var serverExtensions = Extensions.parse(res.headers['sec-websocket-extensions']); + if (perMessageDeflate && serverExtensions[PerMessageDeflate.extensionName]) { + try { + perMessageDeflate.accept(serverExtensions[PerMessageDeflate.extensionName]); + } catch (err) { + self.emit('error', 'invalid extension parameter'); + self.removeAllListeners(); + socket.end(); + return; + } + self.extensions[PerMessageDeflate.extensionName] = perMessageDeflate; + } + + establishConnection.call(self, Receiver, Sender, socket, upgradeHead); + + // perform cleanup on http resources + req.removeAllListeners(); + req = null; + agent = null; + }); + + req.end(); + this.readyState = WebSocket.CONNECTING; +} + +function establishConnection(ReceiverClass, SenderClass, socket, upgradeHead) { + var ultron = this._ultron = new Ultron(socket) + , called = false + , self = this; + + socket.setTimeout(0); + socket.setNoDelay(true); + + this._receiver = new ReceiverClass(this.extensions,this.maxPayload); + this._socket = socket; + + // socket cleanup handlers + ultron.on('end', cleanupWebsocketResources.bind(this)); + ultron.on('close', cleanupWebsocketResources.bind(this)); + ultron.on('error', cleanupWebsocketResources.bind(this)); + + // ensure that the upgradeHead is added to the receiver + function firstHandler(data) { + if (called || self.readyState === WebSocket.CLOSED) return; + + called = true; + socket.removeListener('data', firstHandler); + ultron.on('data', realHandler); + + if (upgradeHead && upgradeHead.length > 0) { + realHandler(upgradeHead); + upgradeHead = null; + } + + if (data) realHandler(data); + } + + // subsequent packets are pushed straight to the receiver + function realHandler(data) { + self.bytesReceived += data.length; + self._receiver.add(data); + } + + ultron.on('data', firstHandler); + + // if data was passed along with the http upgrade, + // this will schedule a push of that on to the receiver. + // this has to be done on next tick, since the caller + // hasn't had a chance to set event handlers on this client + // object yet. + process.nextTick(firstHandler); + + // receiver event handlers + self._receiver.ontext = function ontext(data, flags) { + flags = flags || {}; + + self.emit('message', data, flags); + }; + + self._receiver.onbinary = function onbinary(data, flags) { + flags = flags || {}; + + flags.binary = true; + self.emit('message', data, flags); + }; + + self._receiver.onping = function onping(data, flags) { + flags = flags || {}; + + self.pong(data, { + mask: !self._isServer, + binary: flags.binary === true + }, true); + + self.emit('ping', data, flags); + }; + + self._receiver.onpong = function onpong(data, flags) { + self.emit('pong', data, flags || {}); + }; + + self._receiver.onclose = function onclose(code, data, flags) { + flags = flags || {}; + + self._closeReceived = true; + self.close(code, data); + }; + + self._receiver.onerror = function onerror(reason, errorCode) { + // close the connection when the receiver reports a HyBi error code + self.close(typeof errorCode !== 'undefined' ? errorCode : 1002, ''); + self.emit('error', (reason instanceof Error) ? reason : (new Error(reason))); + }; + + // finalize the client + this._sender = new SenderClass(socket, this.extensions); + this._sender.on('error', function onerror(error) { + self.close(1002, ''); + self.emit('error', error); + }); + + this.readyState = WebSocket.OPEN; + this.emit('open'); +} + +function startQueue(instance) { + instance._queue = instance._queue || []; +} + +function executeQueueSends(instance) { + var queue = instance._queue; + if (typeof queue === 'undefined') return; + + delete instance._queue; + for (var i = 0, l = queue.length; i < l; ++i) { + queue[i](); + } +} + +function sendStream(instance, stream, options, cb) { + stream.on('data', function incoming(data) { + if (instance.readyState !== WebSocket.OPEN) { + if (typeof cb === 'function') cb(new Error('not opened')); + else { + delete instance._queue; + instance.emit('error', new Error('not opened')); + } + return; + } + + options.fin = false; + instance._sender.send(data, options); + }); + + stream.on('end', function end() { + if (instance.readyState !== WebSocket.OPEN) { + if (typeof cb === 'function') cb(new Error('not opened')); + else { + delete instance._queue; + instance.emit('error', new Error('not opened')); + } + return; + } + + options.fin = true; + instance._sender.send(null, options); + + if (typeof cb === 'function') cb(null); + }); +} + +function cleanupWebsocketResources(error) { + if (this.readyState === WebSocket.CLOSED) return; + + this.readyState = WebSocket.CLOSED; + + clearTimeout(this._closeTimer); + this._closeTimer = null; + + // If the connection was closed abnormally (with an error), or if + // the close control frame was not received then the close code + // must default to 1006. + if (error || !this._closeReceived) { + this._closeCode = 1006; + } + this.emit('close', this._closeCode || 1000, this._closeMessage || ''); + + if (this._socket) { + if (this._ultron) this._ultron.destroy(); + this._socket.on('error', function onerror() { + try { this.destroy(); } + catch (e) {} + }); + + try { + if (!error) this._socket.end(); + else this._socket.destroy(); + } catch (e) { /* Ignore termination errors */ } + + this._socket = null; + this._ultron = null; + } + + if (this._sender) { + this._sender.removeAllListeners(); + this._sender = null; + } + + if (this._receiver) { + this._receiver.cleanup(); + this._receiver = null; + } + + if (this.extensions[PerMessageDeflate.extensionName]) { + this.extensions[PerMessageDeflate.extensionName].cleanup(); + } + + this.extensions = null; + + this.removeAllListeners(); + this.on('error', function onerror() {}); // catch all errors after this + delete this._queue; +} + +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer, __webpack_require__(5))) /***/ }, /* 126 */ /***/ function(module, exports, __webpack_require__) { - /* WEBPACK VAR INJECTION */(function(Buffer, process) {// Copyright Joyent, Inc. and other Node contributors. - // - // Permission is hereby granted, free of charge, to any person obtaining a - // copy of this software and associated documentation files (the - // "Software"), to deal in the Software without restriction, including - // without limitation the rights to use, copy, modify, merge, publish, - // distribute, sublicense, and/or sell copies of the Software, and to permit - // persons to whom the Software is furnished to do so, subject to the - // following conditions: - // - // The above copyright notice and this permission notice shall be included - // in all copies or substantial portions of the Software. - // - // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN - // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE - // USE OR OTHER DEALINGS IN THE SOFTWARE. - - var Transform = __webpack_require__(127); - - var binding = __webpack_require__(134); - var util = __webpack_require__(75); - var assert = __webpack_require__(146).ok; - - // zlib doesn't provide these, so kludge them in following the same - // const naming scheme zlib uses. - binding.Z_MIN_WINDOWBITS = 8; - binding.Z_MAX_WINDOWBITS = 15; - binding.Z_DEFAULT_WINDOWBITS = 15; - - // fewer than 64 bytes per chunk is stupid. - // technically it could work with as few as 8, but even 64 bytes - // is absurdly low. Usually a MB or more is best. - binding.Z_MIN_CHUNK = 64; - binding.Z_MAX_CHUNK = Infinity; - binding.Z_DEFAULT_CHUNK = (16 * 1024); - - binding.Z_MIN_MEMLEVEL = 1; - binding.Z_MAX_MEMLEVEL = 9; - binding.Z_DEFAULT_MEMLEVEL = 8; - - binding.Z_MIN_LEVEL = -1; - binding.Z_MAX_LEVEL = 9; - binding.Z_DEFAULT_LEVEL = binding.Z_DEFAULT_COMPRESSION; - - // expose all the zlib constants - Object.keys(binding).forEach(function(k) { - if (k.match(/^Z/)) exports[k] = binding[k]; - }); - - // translation table for return codes. - exports.codes = { - Z_OK: binding.Z_OK, - Z_STREAM_END: binding.Z_STREAM_END, - Z_NEED_DICT: binding.Z_NEED_DICT, - Z_ERRNO: binding.Z_ERRNO, - Z_STREAM_ERROR: binding.Z_STREAM_ERROR, - Z_DATA_ERROR: binding.Z_DATA_ERROR, - Z_MEM_ERROR: binding.Z_MEM_ERROR, - Z_BUF_ERROR: binding.Z_BUF_ERROR, - Z_VERSION_ERROR: binding.Z_VERSION_ERROR - }; - - Object.keys(exports.codes).forEach(function(k) { - exports.codes[exports.codes[k]] = k; - }); - - exports.Deflate = Deflate; - exports.Inflate = Inflate; - exports.Gzip = Gzip; - exports.Gunzip = Gunzip; - exports.DeflateRaw = DeflateRaw; - exports.InflateRaw = InflateRaw; - exports.Unzip = Unzip; - - exports.createDeflate = function(o) { - return new Deflate(o); - }; - - exports.createInflate = function(o) { - return new Inflate(o); - }; - - exports.createDeflateRaw = function(o) { - return new DeflateRaw(o); - }; - - exports.createInflateRaw = function(o) { - return new InflateRaw(o); - }; - - exports.createGzip = function(o) { - return new Gzip(o); - }; - - exports.createGunzip = function(o) { - return new Gunzip(o); - }; - - exports.createUnzip = function(o) { - return new Unzip(o); - }; - - - // Convenience methods. - // compress/decompress a string or buffer in one step. - exports.deflate = function(buffer, opts, callback) { - if (typeof opts === 'function') { - callback = opts; - opts = {}; - } - return zlibBuffer(new Deflate(opts), buffer, callback); - }; - - exports.deflateSync = function(buffer, opts) { - return zlibBufferSync(new Deflate(opts), buffer); - }; - - exports.gzip = function(buffer, opts, callback) { - if (typeof opts === 'function') { - callback = opts; - opts = {}; - } - return zlibBuffer(new Gzip(opts), buffer, callback); - }; - - exports.gzipSync = function(buffer, opts) { - return zlibBufferSync(new Gzip(opts), buffer); - }; - - exports.deflateRaw = function(buffer, opts, callback) { - if (typeof opts === 'function') { - callback = opts; - opts = {}; - } - return zlibBuffer(new DeflateRaw(opts), buffer, callback); - }; - - exports.deflateRawSync = function(buffer, opts) { - return zlibBufferSync(new DeflateRaw(opts), buffer); - }; - - exports.unzip = function(buffer, opts, callback) { - if (typeof opts === 'function') { - callback = opts; - opts = {}; - } - return zlibBuffer(new Unzip(opts), buffer, callback); - }; - - exports.unzipSync = function(buffer, opts) { - return zlibBufferSync(new Unzip(opts), buffer); - }; - - exports.inflate = function(buffer, opts, callback) { - if (typeof opts === 'function') { - callback = opts; - opts = {}; - } - return zlibBuffer(new Inflate(opts), buffer, callback); - }; - - exports.inflateSync = function(buffer, opts) { - return zlibBufferSync(new Inflate(opts), buffer); - }; - - exports.gunzip = function(buffer, opts, callback) { - if (typeof opts === 'function') { - callback = opts; - opts = {}; - } - return zlibBuffer(new Gunzip(opts), buffer, callback); - }; - - exports.gunzipSync = function(buffer, opts) { - return zlibBufferSync(new Gunzip(opts), buffer); - }; - - exports.inflateRaw = function(buffer, opts, callback) { - if (typeof opts === 'function') { - callback = opts; - opts = {}; - } - return zlibBuffer(new InflateRaw(opts), buffer, callback); - }; - - exports.inflateRawSync = function(buffer, opts) { - return zlibBufferSync(new InflateRaw(opts), buffer); - }; - - function zlibBuffer(engine, buffer, callback) { - var buffers = []; - var nread = 0; - - engine.on('error', onError); - engine.on('end', onEnd); - - engine.end(buffer); - flow(); - - function flow() { - var chunk; - while (null !== (chunk = engine.read())) { - buffers.push(chunk); - nread += chunk.length; - } - engine.once('readable', flow); - } - - function onError(err) { - engine.removeListener('end', onEnd); - engine.removeListener('readable', flow); - callback(err); - } - - function onEnd() { - var buf = Buffer.concat(buffers, nread); - buffers = []; - callback(null, buf); - engine.close(); - } - } - - function zlibBufferSync(engine, buffer) { - if (typeof buffer === 'string') - buffer = new Buffer(buffer); - if (!Buffer.isBuffer(buffer)) - throw new TypeError('Not a string or buffer'); - - var flushFlag = binding.Z_FINISH; - - return engine._processChunk(buffer, flushFlag); - } - - // generic zlib - // minimal 2-byte header - function Deflate(opts) { - if (!(this instanceof Deflate)) return new Deflate(opts); - Zlib.call(this, opts, binding.DEFLATE); - } - - function Inflate(opts) { - if (!(this instanceof Inflate)) return new Inflate(opts); - Zlib.call(this, opts, binding.INFLATE); - } - - - - // gzip - bigger header, same deflate compression - function Gzip(opts) { - if (!(this instanceof Gzip)) return new Gzip(opts); - Zlib.call(this, opts, binding.GZIP); - } - - function Gunzip(opts) { - if (!(this instanceof Gunzip)) return new Gunzip(opts); - Zlib.call(this, opts, binding.GUNZIP); - } - - - - // raw - no header - function DeflateRaw(opts) { - if (!(this instanceof DeflateRaw)) return new DeflateRaw(opts); - Zlib.call(this, opts, binding.DEFLATERAW); - } - - function InflateRaw(opts) { - if (!(this instanceof InflateRaw)) return new InflateRaw(opts); - Zlib.call(this, opts, binding.INFLATERAW); - } - - - // auto-detect header. - function Unzip(opts) { - if (!(this instanceof Unzip)) return new Unzip(opts); - Zlib.call(this, opts, binding.UNZIP); - } - - - // the Zlib class they all inherit from - // This thing manages the queue of requests, and returns - // true or false if there is anything in the queue when - // you call the .write() method. - - function Zlib(opts, mode) { - this._opts = opts = opts || {}; - this._chunkSize = opts.chunkSize || exports.Z_DEFAULT_CHUNK; - - Transform.call(this, opts); - - if (opts.flush) { - if (opts.flush !== binding.Z_NO_FLUSH && - opts.flush !== binding.Z_PARTIAL_FLUSH && - opts.flush !== binding.Z_SYNC_FLUSH && - opts.flush !== binding.Z_FULL_FLUSH && - opts.flush !== binding.Z_FINISH && - opts.flush !== binding.Z_BLOCK) { - throw new Error('Invalid flush flag: ' + opts.flush); - } - } - this._flushFlag = opts.flush || binding.Z_NO_FLUSH; - - if (opts.chunkSize) { - if (opts.chunkSize < exports.Z_MIN_CHUNK || - opts.chunkSize > exports.Z_MAX_CHUNK) { - throw new Error('Invalid chunk size: ' + opts.chunkSize); - } - } - - if (opts.windowBits) { - if (opts.windowBits < exports.Z_MIN_WINDOWBITS || - opts.windowBits > exports.Z_MAX_WINDOWBITS) { - throw new Error('Invalid windowBits: ' + opts.windowBits); - } - } - - if (opts.level) { - if (opts.level < exports.Z_MIN_LEVEL || - opts.level > exports.Z_MAX_LEVEL) { - throw new Error('Invalid compression level: ' + opts.level); - } - } - - if (opts.memLevel) { - if (opts.memLevel < exports.Z_MIN_MEMLEVEL || - opts.memLevel > exports.Z_MAX_MEMLEVEL) { - throw new Error('Invalid memLevel: ' + opts.memLevel); - } - } - - if (opts.strategy) { - if (opts.strategy != exports.Z_FILTERED && - opts.strategy != exports.Z_HUFFMAN_ONLY && - opts.strategy != exports.Z_RLE && - opts.strategy != exports.Z_FIXED && - opts.strategy != exports.Z_DEFAULT_STRATEGY) { - throw new Error('Invalid strategy: ' + opts.strategy); - } - } - - if (opts.dictionary) { - if (!Buffer.isBuffer(opts.dictionary)) { - throw new Error('Invalid dictionary: it should be a Buffer instance'); - } - } - - this._binding = new binding.Zlib(mode); - - var self = this; - this._hadError = false; - this._binding.onerror = function(message, errno) { - // there is no way to cleanly recover. - // continuing only obscures problems. - self._binding = null; - self._hadError = true; - - var error = new Error(message); - error.errno = errno; - error.code = exports.codes[errno]; - self.emit('error', error); - }; - - var level = exports.Z_DEFAULT_COMPRESSION; - if (typeof opts.level === 'number') level = opts.level; - - var strategy = exports.Z_DEFAULT_STRATEGY; - if (typeof opts.strategy === 'number') strategy = opts.strategy; - - this._binding.init(opts.windowBits || exports.Z_DEFAULT_WINDOWBITS, - level, - opts.memLevel || exports.Z_DEFAULT_MEMLEVEL, - strategy, - opts.dictionary); - - this._buffer = new Buffer(this._chunkSize); - this._offset = 0; - this._closed = false; - this._level = level; - this._strategy = strategy; - - this.once('end', this.close); - } - - util.inherits(Zlib, Transform); - - Zlib.prototype.params = function(level, strategy, callback) { - if (level < exports.Z_MIN_LEVEL || - level > exports.Z_MAX_LEVEL) { - throw new RangeError('Invalid compression level: ' + level); - } - if (strategy != exports.Z_FILTERED && - strategy != exports.Z_HUFFMAN_ONLY && - strategy != exports.Z_RLE && - strategy != exports.Z_FIXED && - strategy != exports.Z_DEFAULT_STRATEGY) { - throw new TypeError('Invalid strategy: ' + strategy); - } - - if (this._level !== level || this._strategy !== strategy) { - var self = this; - this.flush(binding.Z_SYNC_FLUSH, function() { - self._binding.params(level, strategy); - if (!self._hadError) { - self._level = level; - self._strategy = strategy; - if (callback) callback(); - } - }); - } else { - process.nextTick(callback); - } - }; - - Zlib.prototype.reset = function() { - return this._binding.reset(); - }; - - // This is the _flush function called by the transform class, - // internally, when the last chunk has been written. - Zlib.prototype._flush = function(callback) { - this._transform(new Buffer(0), '', callback); - }; - - Zlib.prototype.flush = function(kind, callback) { - var ws = this._writableState; - - if (typeof kind === 'function' || (kind === void 0 && !callback)) { - callback = kind; - kind = binding.Z_FULL_FLUSH; - } - - if (ws.ended) { - if (callback) - process.nextTick(callback); - } else if (ws.ending) { - if (callback) - this.once('end', callback); - } else if (ws.needDrain) { - var self = this; - this.once('drain', function() { - self.flush(callback); - }); - } else { - this._flushFlag = kind; - this.write(new Buffer(0), '', callback); - } - }; - - Zlib.prototype.close = function(callback) { - if (callback) - process.nextTick(callback); - - if (this._closed) - return; - - this._closed = true; - - this._binding.close(); - - var self = this; - process.nextTick(function() { - self.emit('close'); - }); - }; - - Zlib.prototype._transform = function(chunk, encoding, cb) { - var flushFlag; - var ws = this._writableState; - var ending = ws.ending || ws.ended; - var last = ending && (!chunk || ws.length === chunk.length); - - if (!chunk === null && !Buffer.isBuffer(chunk)) - return cb(new Error('invalid input')); - - // If it's the last chunk, or a final flush, we use the Z_FINISH flush flag. - // If it's explicitly flushing at some other time, then we use - // Z_FULL_FLUSH. Otherwise, use Z_NO_FLUSH for maximum compression - // goodness. - if (last) - flushFlag = binding.Z_FINISH; - else { - flushFlag = this._flushFlag; - // once we've flushed the last of the queue, stop flushing and - // go back to the normal behavior. - if (chunk.length >= ws.length) { - this._flushFlag = this._opts.flush || binding.Z_NO_FLUSH; - } - } - - var self = this; - this._processChunk(chunk, flushFlag, cb); - }; - - Zlib.prototype._processChunk = function(chunk, flushFlag, cb) { - var availInBefore = chunk && chunk.length; - var availOutBefore = this._chunkSize - this._offset; - var inOff = 0; - - var self = this; - - var async = typeof cb === 'function'; - - if (!async) { - var buffers = []; - var nread = 0; - - var error; - this.on('error', function(er) { - error = er; - }); - - do { - var res = this._binding.writeSync(flushFlag, - chunk, // in - inOff, // in_off - availInBefore, // in_len - this._buffer, // out - this._offset, //out_off - availOutBefore); // out_len - } while (!this._hadError && callback(res[0], res[1])); - - if (this._hadError) { - throw error; - } - - var buf = Buffer.concat(buffers, nread); - this.close(); - - return buf; - } - - var req = this._binding.write(flushFlag, - chunk, // in - inOff, // in_off - availInBefore, // in_len - this._buffer, // out - this._offset, //out_off - availOutBefore); // out_len - - req.buffer = chunk; - req.callback = callback; - - function callback(availInAfter, availOutAfter) { - if (self._hadError) - return; - - var have = availOutBefore - availOutAfter; - assert(have >= 0, 'have should not go down'); - - if (have > 0) { - var out = self._buffer.slice(self._offset, self._offset + have); - self._offset += have; - // serve some output to the consumer. - if (async) { - self.push(out); - } else { - buffers.push(out); - nread += out.length; - } - } - - // exhausted the output buffer, or used all the input create a new one. - if (availOutAfter === 0 || self._offset >= self._chunkSize) { - availOutBefore = self._chunkSize; - self._offset = 0; - self._buffer = new Buffer(self._chunkSize); - } - - if (availOutAfter === 0) { - // Not actually done. Need to reprocess. - // Also, update the availInBefore to the availInAfter value, - // so that if we have to hit it a third (fourth, etc.) time, - // it'll have the correct byte counts. - inOff += (availInBefore - availInAfter); - availInBefore = availInAfter; - - if (!async) - return true; - - var newReq = self._binding.write(flushFlag, - chunk, - inOff, - availInBefore, - self._buffer, - self._offset, - self._chunkSize); - newReq.callback = callback; // this same function - newReq.buffer = chunk; - return; - } - - if (!async) - return false; - - // finished with the chunk. - cb(); - } - }; - - util.inherits(Deflate, Zlib); - util.inherits(Inflate, Zlib); - util.inherits(Gzip, Zlib); - util.inherits(Gunzip, Zlib); - util.inherits(DeflateRaw, Zlib); - util.inherits(InflateRaw, Zlib); - util.inherits(Unzip, Zlib); - - /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(58).Buffer, __webpack_require__(2))) +/* WEBPACK VAR INJECTION */(function(Buffer) {const path = __webpack_require__(14); +const fs = __webpack_require__(10); +const request = __webpack_require__(57); + +const Constants = __webpack_require__(2); +const convertArrayBuffer = __webpack_require__(131); +const User = __webpack_require__(11); +const Message = __webpack_require__(44); +const Guild = __webpack_require__(43); +const Channel = __webpack_require__(20); +const GuildMember = __webpack_require__(30); +const Emoji = __webpack_require__(21); +const ReactionEmoji = __webpack_require__(45); + +/** + * The DataResolver identifies different objects and tries to resolve a specific piece of information from them, e.g. + * extracting a User from a Message object. + * @private + */ +class ClientDataResolver { + /** + * @param {Client} client The client the resolver is for + */ + constructor(client) { + this.client = client; + } + + /** + * Data that resolves to give a User object. This can be: + * * A User object + * * A user ID + * * A Message object (resolves to the message author) + * * A Guild object (owner of the guild) + * * A GuildMember object + * @typedef {User|string|Message|Guild|GuildMember} UserResolvable + */ + + /** + * Resolves a UserResolvable to a User object + * @param {UserResolvable} user The UserResolvable to identify + * @returns {?User} + */ + resolveUser(user) { + if (user instanceof User) return user; + if (typeof user === 'string') return this.client.users.get(user) || null; + if (user instanceof GuildMember) return user.user; + if (user instanceof Message) return user.author; + if (user instanceof Guild) return user.owner; + return null; + } + + /** + * Resolves a UserResolvable to a user ID string + * @param {UserResolvable} user The UserResolvable to identify + * @returns {?string} + */ + resolveUserID(user) { + if (user instanceof User || user instanceof GuildMember) return user.id; + if (typeof user === 'string') return user || null; + if (user instanceof Message) return user.author.id; + if (user instanceof Guild) return user.ownerID; + return null; + } + + /** + * Data that resolves to give a Guild object. This can be: + * * A Guild object + * @typedef {Guild} GuildResolvable + */ + + /** + * Resolves a GuildResolvable to a Guild object + * @param {GuildResolvable} guild The GuildResolvable to identify + * @returns {?Guild} + */ + resolveGuild(guild) { + if (guild instanceof Guild) return guild; + if (typeof guild === 'string') return this.client.guilds.get(guild) || null; + return null; + } + + /** + * Data that resolves to give a GuildMember object. This can be: + * * A GuildMember object + * * A User object + * @typedef {Guild} GuildMemberResolvable + */ + + /** + * Resolves a GuildMemberResolvable to a GuildMember object + * @param {GuildResolvable} guild The guild that the member is part of + * @param {UserResolvable} user The user that is part of the guild + * @returns {?GuildMember} + */ + resolveGuildMember(guild, user) { + if (user instanceof GuildMember) return user; + guild = this.resolveGuild(guild); + user = this.resolveUser(user); + if (!guild || !user) return null; + return guild.members.get(user.id) || null; + } + + /** + * Data that can be resolved to give a Channel. This can be: + * * A Channel object + * * A Message object (the channel the message was sent in) + * * A Guild object (the #general channel) + * * A channel ID + * @typedef {Channel|Guild|Message|string} ChannelResolvable + */ + + /** + * Resolves a ChannelResolvable to a Channel object + * @param {ChannelResolvable} channel The channel resolvable to resolve + * @returns {?Channel} + */ + resolveChannel(channel) { + if (channel instanceof Channel) return channel; + if (channel instanceof Message) return channel.channel; + if (channel instanceof Guild) return channel.channels.get(channel.id) || null; + if (typeof channel === 'string') return this.client.channels.get(channel) || null; + return null; + } + + /** + * Data that can be resolved to give an invite code. This can be: + * * An invite code + * * An invite URL + * @typedef {string} InviteResolvable + */ + + /** + * Resolves InviteResolvable to an invite code + * @param {InviteResolvable} data The invite resolvable to resolve + * @returns {string} + */ + resolveInviteCode(data) { + const inviteRegex = /discord(?:app)?\.(?:gg|com\/invite)\/([a-z0-9]{5})/i; + const match = inviteRegex.exec(data); + if (match && match[1]) return match[1]; + return data; + } + + /** + * Data that can be resolved to give a permission number. This can be: + * * A string + * * A permission number + * + * Possible strings: + * ```js + * [ + * "CREATE_INSTANT_INVITE", + * "KICK_MEMBERS", + * "BAN_MEMBERS", + * "ADMINISTRATOR", + * "MANAGE_CHANNELS", + * "MANAGE_GUILD", + * "ADD_REACTIONS", // add reactions to messages + * "READ_MESSAGES", + * "SEND_MESSAGES", + * "SEND_TTS_MESSAGES", + * "MANAGE_MESSAGES", + * "EMBED_LINKS", + * "ATTACH_FILES", + * "READ_MESSAGE_HISTORY", + * "MENTION_EVERYONE", + * "EXTERNAL_EMOJIS", // use external emojis + * "CONNECT", // connect to voice + * "SPEAK", // speak on voice + * "MUTE_MEMBERS", // globally mute members on voice + * "DEAFEN_MEMBERS", // globally deafen members on voice + * "MOVE_MEMBERS", // move member's voice channels + * "USE_VAD", // use voice activity detection + * "CHANGE_NICKNAME", + * "MANAGE_NICKNAMES", // change nicknames of others + * "MANAGE_ROLES_OR_PERMISSIONS" + * ] + * ``` + * @typedef {string|number} PermissionResolvable + */ + + /** + * Resolves a PermissionResolvable to a permission number + * @param {PermissionResolvable} permission The permission resolvable to resolve + * @returns {number} + */ + resolvePermission(permission) { + if (typeof permission === 'string') permission = Constants.PermissionFlags[permission]; + if (typeof permission !== 'number' || permission < 1) throw new Error(Constants.Errors.NOT_A_PERMISSION); + return permission; + } + + /** + * Data that can be resolved to give a string. This can be: + * * A string + * * An array (joined with a new line delimiter to give a string) + * * Any value + * @typedef {string|Array|*} StringResolvable + */ + + /** + * Resolves a StringResolvable to a string + * @param {StringResolvable} data The string resolvable to resolve + * @returns {string} + */ + resolveString(data) { + if (typeof data === 'string') return data; + if (data instanceof Array) return data.join('\n'); + return String(data); + } + + /** + * Data that resolves to give a Base64 string, typically for image uploading. This can be: + * * A Buffer + * * A base64 string + * @typedef {Buffer|string} Base64Resolvable + */ + + /** + * Resolves a Base64Resolvable to a Base 64 image + * @param {Base64Resolvable} data The base 64 resolvable you want to resolve + * @returns {?string} + */ + resolveBase64(data) { + if (data instanceof Buffer) return `data:image/jpg;base64,${data.toString('base64')}`; + return data; + } + + /** + * Data that can be resolved to give a Buffer. This can be: + * * A Buffer + * * The path to a local file + * * A URL + * @typedef {string|Buffer} BufferResolvable + */ + + /** + * Resolves a BufferResolvable to a Buffer + * @param {BufferResolvable} resource The buffer resolvable to resolve + * @returns {Promise} + */ + resolveBuffer(resource) { + if (resource instanceof Buffer) return Promise.resolve(resource); + if (this.client.browser && resource instanceof ArrayBuffer) return Promise.resolve(convertArrayBuffer(resource)); + + if (typeof resource === 'string') { + return new Promise((resolve, reject) => { + if (/^https?:\/\//.test(resource)) { + const req = request.get(resource).set('Content-Type', 'blob'); + if (this.client.browser) req.responseType('arraybuffer'); + req.end((err, res) => { + if (err) return reject(err); + if (this.client.browser) return resolve(convertArrayBuffer(res.xhr.response)); + if (!(res.body instanceof Buffer)) return reject(new TypeError('Body is not a Buffer')); + return resolve(res.body); + }); + } else { + const file = path.resolve(resource); + fs.stat(file, (err, stats) => { + if (err) reject(err); + if (!stats || !stats.isFile()) throw new Error(`The file could not be found: ${file}`); + fs.readFile(file, (err2, data) => { + if (err2) reject(err2); else resolve(data); + }); + }); + } + }); + } + + return Promise.reject(new TypeError('The resource must be a string or Buffer.')); + } + + /** + * Data that can be resolved to give an emoji identifier. This can be: + * * A string + * * An Emoji + * * A ReactionEmoji + * @typedef {string|Emoji|ReactionEmoji} EmojiIdentifierResolvable + */ + + /** + * Resolves an EmojiResolvable to an emoji identifier + * @param {EmojiIdentifierResolvable} emoji The emoji resolvable to resolve + * @returns {string} + */ + resolveEmojiIdentifier(emoji) { + if (emoji instanceof Emoji || emoji instanceof ReactionEmoji) return emoji.identifier; + if (typeof emoji === 'string') { + if (!emoji.includes('%')) return encodeURIComponent(emoji); + } + return null; + } +} + +module.exports = ClientDataResolver; + +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer)) /***/ }, /* 127 */ /***/ function(module, exports, __webpack_require__) { - module.exports = __webpack_require__(128) +const UserAgentManager = __webpack_require__(256); +const RESTMethods = __webpack_require__(253); +const SequentialRequestHandler = __webpack_require__(255); +const BurstRequestHandler = __webpack_require__(254); +const APIRequest = __webpack_require__(252); +const Constants = __webpack_require__(2); + +class RESTManager { + constructor(client) { + this.client = client; + this.handlers = {}; + this.userAgentManager = new UserAgentManager(this); + this.methods = new RESTMethods(this); + this.rateLimitedEndpoints = {}; + this.globallyRateLimited = false; + } + + push(handler, apiRequest) { + return new Promise((resolve, reject) => { + handler.push({ + request: apiRequest, + resolve, + reject, + }); + }); + } + + getRequestHandler() { + switch (this.client.options.apiRequestMethod) { + case 'sequential': + return SequentialRequestHandler; + case 'burst': + return BurstRequestHandler; + default: + throw new Error(Constants.Errors.INVALID_RATE_LIMIT_METHOD); + } + } + + makeRequest(method, url, auth, data, file) { + const apiRequest = new APIRequest(this, method, url, auth, data, file); + + if (!this.handlers[apiRequest.route]) { + const RequestHandlerType = this.getRequestHandler(); + this.handlers[apiRequest.route] = new RequestHandlerType(this, apiRequest.route); + } + + return this.push(this.handlers[apiRequest.route], apiRequest); + } +} + +module.exports = RESTManager; /***/ }, /* 128 */ -/***/ function(module, exports, __webpack_require__) { +/***/ function(module, exports) { - // Copyright Joyent, Inc. and other Node contributors. - // - // Permission is hereby granted, free of charge, to any person obtaining a - // copy of this software and associated documentation files (the - // "Software"), to deal in the Software without restriction, including - // without limitation the rights to use, copy, modify, merge, publish, - // distribute, sublicense, and/or sell copies of the Software, and to permit - // persons to whom the Software is furnished to do so, subject to the - // following conditions: - // - // The above copyright notice and this permission notice shall be included - // in all copies or substantial portions of the Software. - // - // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN - // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE - // USE OR OTHER DEALINGS IN THE SOFTWARE. +/** + * A base class for different types of rate limiting handlers for the REST API. + * @private + */ +class RequestHandler { + /** + * @param {RESTManager} restManager The REST manager to use + */ + constructor(restManager) { + /** + * The RESTManager that instantiated this RequestHandler + * @type {RESTManager} + */ + this.restManager = restManager; + /** + * A list of requests that have yet to be processed. + * @type {APIRequest[]} + */ + this.queue = []; + } - // a transform stream is a readable/writable stream where you do - // something with the data. Sometimes it's called a "filter", - // but that's not a great name for it, since that implies a thing where - // some bits pass through, and others are simply ignored. (That would - // be a valid example of a transform, of course.) - // - // While the output is causally related to the input, it's not a - // necessarily symmetric or synchronous transformation. For example, - // a zlib stream might take multiple plain-text writes(), and then - // emit a single compressed chunk some time in the future. - // - // Here's how this works: - // - // The Transform stream has all the aspects of the readable and writable - // stream classes. When you write(chunk), that calls _write(chunk,cb) - // internally, and returns false if there's a lot of pending writes - // buffered up. When you call read(), that calls _read(n) until - // there's enough pending readable data buffered up. - // - // In a transform stream, the written data is placed in a buffer. When - // _read(n) is called, it transforms the queued up data, calling the - // buffered _write cb's as it consumes chunks. If consuming a single - // written chunk would result in multiple output chunks, then the first - // outputted bit calls the readcb, and subsequent chunks just go into - // the read buffer, and will cause it to emit 'readable' if necessary. - // - // This way, back-pressure is actually determined by the reading side, - // since _read has to be called to start processing a new chunk. However, - // a pathological inflate type of transform can cause excessive buffering - // here. For example, imagine a stream where every byte of input is - // interpreted as an integer from 0-255, and then results in that many - // bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in - // 1kb of data being output. In this case, you could write a very small - // amount of input, and end up with a very large amount of output. In - // such a pathological inflating mechanism, there'd be no way to tell - // the system to stop doing the transform. A single 4MB write could - // cause the system to run out of memory. - // - // However, even in such a pathological case, only a single written chunk - // would be consumed, and then the rest would wait (un-transformed) until - // the results of the previous transformed chunk were consumed. + /** + * Whether or not the client is being rate limited on every endpoint. + * @type {boolean} + */ + get globalLimit() { + return this.restManager.globallyRateLimited; + } - module.exports = Transform; + set globalLimit(value) { + this.restManager.globallyRateLimited = value; + } - var Duplex = __webpack_require__(129); + /** + * Push a new API request into this bucket + * @param {APIRequest} request The new request to push into the queue + */ + push(request) { + this.queue.push(request); + } - /**/ - var util = __webpack_require__(85); - util.inherits = __webpack_require__(81); - /**/ + /** + * Attempts to get this RequestHandler to process its current queue + */ + handle() { + return; + } +} - util.inherits(Transform, Duplex); - - - function TransformState(options, stream) { - this.afterTransform = function(er, data) { - return afterTransform(stream, er, data); - }; - - this.needTransform = false; - this.transforming = false; - this.writecb = null; - this.writechunk = null; - } - - function afterTransform(stream, er, data) { - var ts = stream._transformState; - ts.transforming = false; - - var cb = ts.writecb; - - if (!cb) - return stream.emit('error', new Error('no writecb in Transform class')); - - ts.writechunk = null; - ts.writecb = null; - - if (!util.isNullOrUndefined(data)) - stream.push(data); - - if (cb) - cb(er); - - var rs = stream._readableState; - rs.reading = false; - if (rs.needReadable || rs.length < rs.highWaterMark) { - stream._read(rs.highWaterMark); - } - } - - - function Transform(options) { - if (!(this instanceof Transform)) - return new Transform(options); - - Duplex.call(this, options); - - this._transformState = new TransformState(options, this); - - // when the writable side finishes, then flush out anything remaining. - var stream = this; - - // start out asking for a readable event once data is transformed. - this._readableState.needReadable = true; - - // we have implemented the _read method, and done the other things - // that Readable wants before the first _read call, so unset the - // sync guard flag. - this._readableState.sync = false; - - this.once('prefinish', function() { - if (util.isFunction(this._flush)) - this._flush(function(er) { - done(stream, er); - }); - else - done(stream); - }); - } - - Transform.prototype.push = function(chunk, encoding) { - this._transformState.needTransform = false; - return Duplex.prototype.push.call(this, chunk, encoding); - }; - - // This is the part where you do stuff! - // override this function in implementation classes. - // 'chunk' is an input chunk. - // - // Call `push(newChunk)` to pass along transformed output - // to the readable side. You may call 'push' zero or more times. - // - // Call `cb(err)` when you are done with this chunk. If you pass - // an error, then that'll put the hurt on the whole operation. If you - // never call cb(), then you'll never get another chunk. - Transform.prototype._transform = function(chunk, encoding, cb) { - throw new Error('not implemented'); - }; - - Transform.prototype._write = function(chunk, encoding, cb) { - var ts = this._transformState; - ts.writecb = cb; - ts.writechunk = chunk; - ts.writeencoding = encoding; - if (!ts.transforming) { - var rs = this._readableState; - if (ts.needTransform || - rs.needReadable || - rs.length < rs.highWaterMark) - this._read(rs.highWaterMark); - } - }; - - // Doesn't matter what the args are here. - // _transform does all the work. - // That we got here means that the readable side wants more data. - Transform.prototype._read = function(n) { - var ts = this._transformState; - - if (!util.isNull(ts.writechunk) && ts.writecb && !ts.transforming) { - ts.transforming = true; - this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform); - } else { - // mark that we need a transform, so that any data that comes in - // will get processed, now that we've asked for it. - ts.needTransform = true; - } - }; - - - function done(stream, er) { - if (er) - return stream.emit('error', er); - - // if there's nothing in the write buffer, then that means - // that nothing more will ever be provided - var ws = stream._writableState; - var ts = stream._transformState; - - if (ws.length) - throw new Error('calling transform done when ws.length != 0'); - - if (ts.transforming) - throw new Error('calling transform done when still transforming'); - - return stream.push(null); - } +module.exports = RequestHandler; /***/ }, /* 129 */ -/***/ function(module, exports, __webpack_require__) { +/***/ function(module, exports) { - /* WEBPACK VAR INJECTION */(function(process) {// Copyright Joyent, Inc. and other Node contributors. - // - // Permission is hereby granted, free of charge, to any person obtaining a - // copy of this software and associated documentation files (the - // "Software"), to deal in the Software without restriction, including - // without limitation the rights to use, copy, modify, merge, publish, - // distribute, sublicense, and/or sell copies of the Software, and to permit - // persons to whom the Software is furnished to do so, subject to the - // following conditions: - // - // The above copyright notice and this permission notice shall be included - // in all copies or substantial portions of the Software. - // - // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN - // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE - // USE OR OTHER DEALINGS IN THE SOFTWARE. +class BaseOpus { + constructor(player) { + this.player = player; + } - // a duplex stream is just a stream that is both readable and writable. - // Since JS doesn't have multiple prototypal inheritance, this class - // prototypally inherits from Readable, and then parasitically from - // Writable. + encode(buffer) { + return buffer; + } - module.exports = Duplex; + decode(buffer) { + return buffer; + } +} - /**/ - var objectKeys = Object.keys || function (obj) { - var keys = []; - for (var key in obj) keys.push(key); - return keys; - } - /**/ +module.exports = BaseOpus; - /**/ - var util = __webpack_require__(85); - util.inherits = __webpack_require__(81); - /**/ - - var Readable = __webpack_require__(130); - var Writable = __webpack_require__(133); - - util.inherits(Duplex, Readable); - - forEach(objectKeys(Writable.prototype), function(method) { - if (!Duplex.prototype[method]) - Duplex.prototype[method] = Writable.prototype[method]; - }); - - function Duplex(options) { - if (!(this instanceof Duplex)) - return new Duplex(options); - - Readable.call(this, options); - Writable.call(this, options); - - if (options && options.readable === false) - this.readable = false; - - if (options && options.writable === false) - this.writable = false; - - this.allowHalfOpen = true; - if (options && options.allowHalfOpen === false) - this.allowHalfOpen = false; - - this.once('end', onend); - } - - // the no-half-open enforcer - function onend() { - // if we allow half-open state, or if the writable side ended, - // then we're ok. - if (this.allowHalfOpen || this._writableState.ended) - return; - - // no more data can be written. - // But allow more writes to happen in this tick. - process.nextTick(this.end.bind(this)); - } - - function forEach (xs, f) { - for (var i = 0, l = xs.length; i < l; i++) { - f(xs[i], i); - } - } - - /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2))) - /***/ }, /* 130 */ -/***/ function(module, exports, __webpack_require__) { +/***/ function(module, exports) { - /* WEBPACK VAR INJECTION */(function(process) {// Copyright Joyent, Inc. and other Node contributors. - // - // Permission is hereby granted, free of charge, to any person obtaining a - // copy of this software and associated documentation files (the - // "Software"), to deal in the Software without restriction, including - // without limitation the rights to use, copy, modify, merge, publish, - // distribute, sublicense, and/or sell copies of the Software, and to permit - // persons to whom the Software is furnished to do so, subject to the - // following conditions: - // - // The above copyright notice and this permission notice shall be included - // in all copies or substantial portions of the Software. - // - // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN - // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE - // USE OR OTHER DEALINGS IN THE SOFTWARE. +module.exports = function cloneObject(obj) { + const cloned = Object.create(obj); + Object.assign(cloned, obj); + return cloned; +}; - module.exports = Readable; - - /**/ - var isArray = __webpack_require__(131); - /**/ - - - /**/ - var Buffer = __webpack_require__(58).Buffer; - /**/ - - Readable.ReadableState = ReadableState; - - var EE = __webpack_require__(3).EventEmitter; - - /**/ - if (!EE.listenerCount) EE.listenerCount = function(emitter, type) { - return emitter.listeners(type).length; - }; - /**/ - - var Stream = __webpack_require__(80); - - /**/ - var util = __webpack_require__(85); - util.inherits = __webpack_require__(81); - /**/ - - var StringDecoder; - - - /**/ - var debug = __webpack_require__(132); - if (debug && debug.debuglog) { - debug = debug.debuglog('stream'); - } else { - debug = function () {}; - } - /**/ - - - util.inherits(Readable, Stream); - - function ReadableState(options, stream) { - var Duplex = __webpack_require__(129); - - options = options || {}; - - // the point at which it stops calling _read() to fill the buffer - // Note: 0 is a valid value, means "don't call _read preemptively ever" - var hwm = options.highWaterMark; - var defaultHwm = options.objectMode ? 16 : 16 * 1024; - this.highWaterMark = (hwm || hwm === 0) ? hwm : defaultHwm; - - // cast to ints. - this.highWaterMark = ~~this.highWaterMark; - - this.buffer = []; - this.length = 0; - this.pipes = null; - this.pipesCount = 0; - this.flowing = null; - this.ended = false; - this.endEmitted = false; - this.reading = false; - - // a flag to be able to tell if the onwrite cb is called immediately, - // or on a later tick. We set this to true at first, because any - // actions that shouldn't happen until "later" should generally also - // not happen before the first write call. - this.sync = true; - - // whenever we return null, then we set a flag to say - // that we're awaiting a 'readable' event emission. - this.needReadable = false; - this.emittedReadable = false; - this.readableListening = false; - - - // object stream flag. Used to make read(n) ignore n and to - // make all the buffer merging and length checks go away - this.objectMode = !!options.objectMode; - - if (stream instanceof Duplex) - this.objectMode = this.objectMode || !!options.readableObjectMode; - - // Crypto is kind of old and crusty. Historically, its default string - // encoding is 'binary' so we have to make this configurable. - // Everything else in the universe uses 'utf8', though. - this.defaultEncoding = options.defaultEncoding || 'utf8'; - - // when piping, we only care about 'readable' events that happen - // after read()ing all the bytes and not getting any pushback. - this.ranOut = false; - - // the number of writers that are awaiting a drain event in .pipe()s - this.awaitDrain = 0; - - // if true, a maybeReadMore has been scheduled - this.readingMore = false; - - this.decoder = null; - this.encoding = null; - if (options.encoding) { - if (!StringDecoder) - StringDecoder = __webpack_require__(89).StringDecoder; - this.decoder = new StringDecoder(options.encoding); - this.encoding = options.encoding; - } - } - - function Readable(options) { - var Duplex = __webpack_require__(129); - - if (!(this instanceof Readable)) - return new Readable(options); - - this._readableState = new ReadableState(options, this); - - // legacy - this.readable = true; - - Stream.call(this); - } - - // Manually shove something into the read() buffer. - // This returns true if the highWaterMark has not been hit yet, - // similar to how Writable.write() returns true if you should - // write() some more. - Readable.prototype.push = function(chunk, encoding) { - var state = this._readableState; - - if (util.isString(chunk) && !state.objectMode) { - encoding = encoding || state.defaultEncoding; - if (encoding !== state.encoding) { - chunk = new Buffer(chunk, encoding); - encoding = ''; - } - } - - return readableAddChunk(this, state, chunk, encoding, false); - }; - - // Unshift should *always* be something directly out of read() - Readable.prototype.unshift = function(chunk) { - var state = this._readableState; - return readableAddChunk(this, state, chunk, '', true); - }; - - function readableAddChunk(stream, state, chunk, encoding, addToFront) { - var er = chunkInvalid(state, chunk); - if (er) { - stream.emit('error', er); - } else if (util.isNullOrUndefined(chunk)) { - state.reading = false; - if (!state.ended) - onEofChunk(stream, state); - } else if (state.objectMode || chunk && chunk.length > 0) { - if (state.ended && !addToFront) { - var e = new Error('stream.push() after EOF'); - stream.emit('error', e); - } else if (state.endEmitted && addToFront) { - var e = new Error('stream.unshift() after end event'); - stream.emit('error', e); - } else { - if (state.decoder && !addToFront && !encoding) - chunk = state.decoder.write(chunk); - - if (!addToFront) - state.reading = false; - - // if we want the data now, just emit it. - if (state.flowing && state.length === 0 && !state.sync) { - stream.emit('data', chunk); - stream.read(0); - } else { - // update the buffer info. - state.length += state.objectMode ? 1 : chunk.length; - if (addToFront) - state.buffer.unshift(chunk); - else - state.buffer.push(chunk); - - if (state.needReadable) - emitReadable(stream); - } - - maybeReadMore(stream, state); - } - } else if (!addToFront) { - state.reading = false; - } - - return needMoreData(state); - } - - - - // if it's past the high water mark, we can push in some more. - // Also, if we have no data yet, we can stand some - // more bytes. This is to work around cases where hwm=0, - // such as the repl. Also, if the push() triggered a - // readable event, and the user called read(largeNumber) such that - // needReadable was set, then we ought to push more, so that another - // 'readable' event will be triggered. - function needMoreData(state) { - return !state.ended && - (state.needReadable || - state.length < state.highWaterMark || - state.length === 0); - } - - // backwards compatibility. - Readable.prototype.setEncoding = function(enc) { - if (!StringDecoder) - StringDecoder = __webpack_require__(89).StringDecoder; - this._readableState.decoder = new StringDecoder(enc); - this._readableState.encoding = enc; - return this; - }; - - // Don't raise the hwm > 128MB - var MAX_HWM = 0x800000; - function roundUpToNextPowerOf2(n) { - if (n >= MAX_HWM) { - n = MAX_HWM; - } else { - // Get the next highest power of 2 - n--; - for (var p = 1; p < 32; p <<= 1) n |= n >> p; - n++; - } - return n; - } - - function howMuchToRead(n, state) { - if (state.length === 0 && state.ended) - return 0; - - if (state.objectMode) - return n === 0 ? 0 : 1; - - if (isNaN(n) || util.isNull(n)) { - // only flow one buffer at a time - if (state.flowing && state.buffer.length) - return state.buffer[0].length; - else - return state.length; - } - - if (n <= 0) - return 0; - - // If we're asking for more than the target buffer level, - // then raise the water mark. Bump up to the next highest - // power of 2, to prevent increasing it excessively in tiny - // amounts. - if (n > state.highWaterMark) - state.highWaterMark = roundUpToNextPowerOf2(n); - - // don't have that much. return null, unless we've ended. - if (n > state.length) { - if (!state.ended) { - state.needReadable = true; - return 0; - } else - return state.length; - } - - return n; - } - - // you can override either this method, or the async _read(n) below. - Readable.prototype.read = function(n) { - debug('read', n); - var state = this._readableState; - var nOrig = n; - - if (!util.isNumber(n) || n > 0) - state.emittedReadable = false; - - // if we're doing read(0) to trigger a readable event, but we - // already have a bunch of data in the buffer, then just trigger - // the 'readable' event and move on. - if (n === 0 && - state.needReadable && - (state.length >= state.highWaterMark || state.ended)) { - debug('read: emitReadable', state.length, state.ended); - if (state.length === 0 && state.ended) - endReadable(this); - else - emitReadable(this); - return null; - } - - n = howMuchToRead(n, state); - - // if we've ended, and we're now clear, then finish it up. - if (n === 0 && state.ended) { - if (state.length === 0) - endReadable(this); - return null; - } - - // All the actual chunk generation logic needs to be - // *below* the call to _read. The reason is that in certain - // synthetic stream cases, such as passthrough streams, _read - // may be a completely synchronous operation which may change - // the state of the read buffer, providing enough data when - // before there was *not* enough. - // - // So, the steps are: - // 1. Figure out what the state of things will be after we do - // a read from the buffer. - // - // 2. If that resulting state will trigger a _read, then call _read. - // Note that this may be asynchronous, or synchronous. Yes, it is - // deeply ugly to write APIs this way, but that still doesn't mean - // that the Readable class should behave improperly, as streams are - // designed to be sync/async agnostic. - // Take note if the _read call is sync or async (ie, if the read call - // has returned yet), so that we know whether or not it's safe to emit - // 'readable' etc. - // - // 3. Actually pull the requested chunks out of the buffer and return. - - // if we need a readable event, then we need to do some reading. - var doRead = state.needReadable; - debug('need readable', doRead); - - // if we currently have less than the highWaterMark, then also read some - if (state.length === 0 || state.length - n < state.highWaterMark) { - doRead = true; - debug('length less than watermark', doRead); - } - - // however, if we've ended, then there's no point, and if we're already - // reading, then it's unnecessary. - if (state.ended || state.reading) { - doRead = false; - debug('reading or ended', doRead); - } - - if (doRead) { - debug('do read'); - state.reading = true; - state.sync = true; - // if the length is currently zero, then we *need* a readable event. - if (state.length === 0) - state.needReadable = true; - // call internal read method - this._read(state.highWaterMark); - state.sync = false; - } - - // If _read pushed data synchronously, then `reading` will be false, - // and we need to re-evaluate how much data we can return to the user. - if (doRead && !state.reading) - n = howMuchToRead(nOrig, state); - - var ret; - if (n > 0) - ret = fromList(n, state); - else - ret = null; - - if (util.isNull(ret)) { - state.needReadable = true; - n = 0; - } - - state.length -= n; - - // If we have nothing in the buffer, then we want to know - // as soon as we *do* get something into the buffer. - if (state.length === 0 && !state.ended) - state.needReadable = true; - - // If we tried to read() past the EOF, then emit end on the next tick. - if (nOrig !== n && state.ended && state.length === 0) - endReadable(this); - - if (!util.isNull(ret)) - this.emit('data', ret); - - return ret; - }; - - function chunkInvalid(state, chunk) { - var er = null; - if (!util.isBuffer(chunk) && - !util.isString(chunk) && - !util.isNullOrUndefined(chunk) && - !state.objectMode) { - er = new TypeError('Invalid non-string/buffer chunk'); - } - return er; - } - - - function onEofChunk(stream, state) { - if (state.decoder && !state.ended) { - var chunk = state.decoder.end(); - if (chunk && chunk.length) { - state.buffer.push(chunk); - state.length += state.objectMode ? 1 : chunk.length; - } - } - state.ended = true; - - // emit 'readable' now to make sure it gets picked up. - emitReadable(stream); - } - - // Don't emit readable right away in sync mode, because this can trigger - // another read() call => stack overflow. This way, it might trigger - // a nextTick recursion warning, but that's not so bad. - function emitReadable(stream) { - var state = stream._readableState; - state.needReadable = false; - if (!state.emittedReadable) { - debug('emitReadable', state.flowing); - state.emittedReadable = true; - if (state.sync) - process.nextTick(function() { - emitReadable_(stream); - }); - else - emitReadable_(stream); - } - } - - function emitReadable_(stream) { - debug('emit readable'); - stream.emit('readable'); - flow(stream); - } - - - // at this point, the user has presumably seen the 'readable' event, - // and called read() to consume some data. that may have triggered - // in turn another _read(n) call, in which case reading = true if - // it's in progress. - // However, if we're not ended, or reading, and the length < hwm, - // then go ahead and try to read some more preemptively. - function maybeReadMore(stream, state) { - if (!state.readingMore) { - state.readingMore = true; - process.nextTick(function() { - maybeReadMore_(stream, state); - }); - } - } - - function maybeReadMore_(stream, state) { - var len = state.length; - while (!state.reading && !state.flowing && !state.ended && - state.length < state.highWaterMark) { - debug('maybeReadMore read 0'); - stream.read(0); - if (len === state.length) - // didn't get any data, stop spinning. - break; - else - len = state.length; - } - state.readingMore = false; - } - - // abstract method. to be overridden in specific implementation classes. - // call cb(er, data) where data is <= n in length. - // for virtual (non-string, non-buffer) streams, "length" is somewhat - // arbitrary, and perhaps not very meaningful. - Readable.prototype._read = function(n) { - this.emit('error', new Error('not implemented')); - }; - - Readable.prototype.pipe = function(dest, pipeOpts) { - var src = this; - var state = this._readableState; - - switch (state.pipesCount) { - case 0: - state.pipes = dest; - break; - case 1: - state.pipes = [state.pipes, dest]; - break; - default: - state.pipes.push(dest); - break; - } - state.pipesCount += 1; - debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts); - - var doEnd = (!pipeOpts || pipeOpts.end !== false) && - dest !== process.stdout && - dest !== process.stderr; - - var endFn = doEnd ? onend : cleanup; - if (state.endEmitted) - process.nextTick(endFn); - else - src.once('end', endFn); - - dest.on('unpipe', onunpipe); - function onunpipe(readable) { - debug('onunpipe'); - if (readable === src) { - cleanup(); - } - } - - function onend() { - debug('onend'); - dest.end(); - } - - // when the dest drains, it reduces the awaitDrain counter - // on the source. This would be more elegant with a .once() - // handler in flow(), but adding and removing repeatedly is - // too slow. - var ondrain = pipeOnDrain(src); - dest.on('drain', ondrain); - - function cleanup() { - debug('cleanup'); - // cleanup event handlers once the pipe is broken - dest.removeListener('close', onclose); - dest.removeListener('finish', onfinish); - dest.removeListener('drain', ondrain); - dest.removeListener('error', onerror); - dest.removeListener('unpipe', onunpipe); - src.removeListener('end', onend); - src.removeListener('end', cleanup); - src.removeListener('data', ondata); - - // if the reader is waiting for a drain event from this - // specific writer, then it would cause it to never start - // flowing again. - // So, if this is awaiting a drain, then we just call it now. - // If we don't know, then assume that we are waiting for one. - if (state.awaitDrain && - (!dest._writableState || dest._writableState.needDrain)) - ondrain(); - } - - src.on('data', ondata); - function ondata(chunk) { - debug('ondata'); - var ret = dest.write(chunk); - if (false === ret) { - debug('false write response, pause', - src._readableState.awaitDrain); - src._readableState.awaitDrain++; - src.pause(); - } - } - - // if the dest has an error, then stop piping into it. - // however, don't suppress the throwing behavior for this. - function onerror(er) { - debug('onerror', er); - unpipe(); - dest.removeListener('error', onerror); - if (EE.listenerCount(dest, 'error') === 0) - dest.emit('error', er); - } - // This is a brutally ugly hack to make sure that our error handler - // is attached before any userland ones. NEVER DO THIS. - if (!dest._events || !dest._events.error) - dest.on('error', onerror); - else if (isArray(dest._events.error)) - dest._events.error.unshift(onerror); - else - dest._events.error = [onerror, dest._events.error]; - - - - // Both close and finish should trigger unpipe, but only once. - function onclose() { - dest.removeListener('finish', onfinish); - unpipe(); - } - dest.once('close', onclose); - function onfinish() { - debug('onfinish'); - dest.removeListener('close', onclose); - unpipe(); - } - dest.once('finish', onfinish); - - function unpipe() { - debug('unpipe'); - src.unpipe(dest); - } - - // tell the dest that it's being piped to - dest.emit('pipe', src); - - // start the flow if it hasn't been started already. - if (!state.flowing) { - debug('pipe resume'); - src.resume(); - } - - return dest; - }; - - function pipeOnDrain(src) { - return function() { - var state = src._readableState; - debug('pipeOnDrain', state.awaitDrain); - if (state.awaitDrain) - state.awaitDrain--; - if (state.awaitDrain === 0 && EE.listenerCount(src, 'data')) { - state.flowing = true; - flow(src); - } - }; - } - - - Readable.prototype.unpipe = function(dest) { - var state = this._readableState; - - // if we're not piping anywhere, then do nothing. - if (state.pipesCount === 0) - return this; - - // just one destination. most common case. - if (state.pipesCount === 1) { - // passed in one, but it's not the right one. - if (dest && dest !== state.pipes) - return this; - - if (!dest) - dest = state.pipes; - - // got a match. - state.pipes = null; - state.pipesCount = 0; - state.flowing = false; - if (dest) - dest.emit('unpipe', this); - return this; - } - - // slow case. multiple pipe destinations. - - if (!dest) { - // remove all. - var dests = state.pipes; - var len = state.pipesCount; - state.pipes = null; - state.pipesCount = 0; - state.flowing = false; - - for (var i = 0; i < len; i++) - dests[i].emit('unpipe', this); - return this; - } - - // try to find the right one. - var i = indexOf(state.pipes, dest); - if (i === -1) - return this; - - state.pipes.splice(i, 1); - state.pipesCount -= 1; - if (state.pipesCount === 1) - state.pipes = state.pipes[0]; - - dest.emit('unpipe', this); - - return this; - }; - - // set up data events if they are asked for - // Ensure readable listeners eventually get something - Readable.prototype.on = function(ev, fn) { - var res = Stream.prototype.on.call(this, ev, fn); - - // If listening to data, and it has not explicitly been paused, - // then call resume to start the flow of data on the next tick. - if (ev === 'data' && false !== this._readableState.flowing) { - this.resume(); - } - - if (ev === 'readable' && this.readable) { - var state = this._readableState; - if (!state.readableListening) { - state.readableListening = true; - state.emittedReadable = false; - state.needReadable = true; - if (!state.reading) { - var self = this; - process.nextTick(function() { - debug('readable nexttick read 0'); - self.read(0); - }); - } else if (state.length) { - emitReadable(this, state); - } - } - } - - return res; - }; - Readable.prototype.addListener = Readable.prototype.on; - - // pause() and resume() are remnants of the legacy readable stream API - // If the user uses them, then switch into old mode. - Readable.prototype.resume = function() { - var state = this._readableState; - if (!state.flowing) { - debug('resume'); - state.flowing = true; - if (!state.reading) { - debug('resume read 0'); - this.read(0); - } - resume(this, state); - } - return this; - }; - - function resume(stream, state) { - if (!state.resumeScheduled) { - state.resumeScheduled = true; - process.nextTick(function() { - resume_(stream, state); - }); - } - } - - function resume_(stream, state) { - state.resumeScheduled = false; - stream.emit('resume'); - flow(stream); - if (state.flowing && !state.reading) - stream.read(0); - } - - Readable.prototype.pause = function() { - debug('call pause flowing=%j', this._readableState.flowing); - if (false !== this._readableState.flowing) { - debug('pause'); - this._readableState.flowing = false; - this.emit('pause'); - } - return this; - }; - - function flow(stream) { - var state = stream._readableState; - debug('flow', state.flowing); - if (state.flowing) { - do { - var chunk = stream.read(); - } while (null !== chunk && state.flowing); - } - } - - // wrap an old-style stream as the async data source. - // This is *not* part of the readable stream interface. - // It is an ugly unfortunate mess of history. - Readable.prototype.wrap = function(stream) { - var state = this._readableState; - var paused = false; - - var self = this; - stream.on('end', function() { - debug('wrapped end'); - if (state.decoder && !state.ended) { - var chunk = state.decoder.end(); - if (chunk && chunk.length) - self.push(chunk); - } - - self.push(null); - }); - - stream.on('data', function(chunk) { - debug('wrapped data'); - if (state.decoder) - chunk = state.decoder.write(chunk); - if (!chunk || !state.objectMode && !chunk.length) - return; - - var ret = self.push(chunk); - if (!ret) { - paused = true; - stream.pause(); - } - }); - - // proxy all the other methods. - // important when wrapping filters and duplexes. - for (var i in stream) { - if (util.isFunction(stream[i]) && util.isUndefined(this[i])) { - this[i] = function(method) { return function() { - return stream[method].apply(stream, arguments); - }}(i); - } - } - - // proxy certain important events. - var events = ['error', 'close', 'destroy', 'pause', 'resume']; - forEach(events, function(ev) { - stream.on(ev, self.emit.bind(self, ev)); - }); - - // when we try to consume some more bytes, simply unpause the - // underlying stream. - self._read = function(n) { - debug('wrapped _read', n); - if (paused) { - paused = false; - stream.resume(); - } - }; - - return self; - }; - - - - // exposed for testing purposes only. - Readable._fromList = fromList; - - // Pluck off n bytes from an array of buffers. - // Length is the combined lengths of all the buffers in the list. - function fromList(n, state) { - var list = state.buffer; - var length = state.length; - var stringMode = !!state.decoder; - var objectMode = !!state.objectMode; - var ret; - - // nothing in the list, definitely empty. - if (list.length === 0) - return null; - - if (length === 0) - ret = null; - else if (objectMode) - ret = list.shift(); - else if (!n || n >= length) { - // read it all, truncate the array. - if (stringMode) - ret = list.join(''); - else - ret = Buffer.concat(list, length); - list.length = 0; - } else { - // read just some of it. - if (n < list[0].length) { - // just take a part of the first list item. - // slice is the same for buffers and strings. - var buf = list[0]; - ret = buf.slice(0, n); - list[0] = buf.slice(n); - } else if (n === list[0].length) { - // first list is a perfect match - ret = list.shift(); - } else { - // complex case. - // we have enough to cover it, but it spans past the first buffer. - if (stringMode) - ret = ''; - else - ret = new Buffer(n); - - var c = 0; - for (var i = 0, l = list.length; i < l && c < n; i++) { - var buf = list[0]; - var cpy = Math.min(n - c, buf.length); - - if (stringMode) - ret += buf.slice(0, cpy); - else - buf.copy(ret, c, 0, cpy); - - if (cpy < buf.length) - list[0] = buf.slice(cpy); - else - list.shift(); - - c += cpy; - } - } - } - - return ret; - } - - function endReadable(stream) { - var state = stream._readableState; - - // If we get here before consuming all the bytes, then that is a - // bug in node. Should never happen. - if (state.length > 0) - throw new Error('endReadable called on non-empty stream'); - - if (!state.endEmitted) { - state.ended = true; - process.nextTick(function() { - // Check that we didn't get one last unshift. - if (!state.endEmitted && state.length === 0) { - state.endEmitted = true; - stream.readable = false; - stream.emit('end'); - } - }); - } - } - - function forEach (xs, f) { - for (var i = 0, l = xs.length; i < l; i++) { - f(xs[i], i); - } - } - - function indexOf (xs, x) { - for (var i = 0, l = xs.length; i < l; i++) { - if (xs[i] === x) return i; - } - return -1; - } - - /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2))) /***/ }, /* 131 */ -/***/ function(module, exports) { +/***/ function(module, exports, __webpack_require__) { - module.exports = Array.isArray || function (arr) { - return Object.prototype.toString.call(arr) == '[object Array]'; - }; +/* WEBPACK VAR INJECTION */(function(Buffer) {function arrayBufferToBuffer(ab) { + const buffer = new Buffer(ab.byteLength); + const view = new Uint8Array(ab); + for (var i = 0; i < buffer.length; ++i) buffer[i] = view[i]; + return buffer; +} +function str2ab(str) { + const buffer = new ArrayBuffer(str.length * 2); + const view = new Uint16Array(buffer); + for (var i = 0, strLen = str.length; i < strLen; i++) view[i] = str.charCodeAt(i); + return buffer; +} + +module.exports = function convertArrayBuffer(x) { + if (typeof x === 'string') x = str2ab(x); + return arrayBufferToBuffer(x); +}; + +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer)) /***/ }, /* 132 */ /***/ function(module, exports) { - /* (ignored) */ +module.exports = function makeError(obj) { + const err = new Error(obj.message); + err.name = obj.name; + err.stack = obj.stack; + return err; +}; + /***/ }, /* 133 */ -/***/ function(module, exports, __webpack_require__) { +/***/ function(module, exports) { - /* WEBPACK VAR INJECTION */(function(process) {// Copyright Joyent, Inc. and other Node contributors. - // - // Permission is hereby granted, free of charge, to any person obtaining a - // copy of this software and associated documentation files (the - // "Software"), to deal in the Software without restriction, including - // without limitation the rights to use, copy, modify, merge, publish, - // distribute, sublicense, and/or sell copies of the Software, and to permit - // persons to whom the Software is furnished to do so, subject to the - // following conditions: - // - // The above copyright notice and this permission notice shall be included - // in all copies or substantial portions of the Software. - // - // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN - // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE - // USE OR OTHER DEALINGS IN THE SOFTWARE. +module.exports = function makePlainError(err) { + const obj = {}; + obj.name = err.name; + obj.message = err.message; + obj.stack = err.stack; + return obj; +}; - // A bit simpler than readable streams. - // Implement an async ._write(chunk, cb), and it'll handle all - // the drain event emission and buffering. - - module.exports = Writable; - - /**/ - var Buffer = __webpack_require__(58).Buffer; - /**/ - - Writable.WritableState = WritableState; - - - /**/ - var util = __webpack_require__(85); - util.inherits = __webpack_require__(81); - /**/ - - var Stream = __webpack_require__(80); - - util.inherits(Writable, Stream); - - function WriteReq(chunk, encoding, cb) { - this.chunk = chunk; - this.encoding = encoding; - this.callback = cb; - } - - function WritableState(options, stream) { - var Duplex = __webpack_require__(129); - - options = options || {}; - - // the point at which write() starts returning false - // Note: 0 is a valid value, means that we always return false if - // the entire buffer is not flushed immediately on write() - var hwm = options.highWaterMark; - var defaultHwm = options.objectMode ? 16 : 16 * 1024; - this.highWaterMark = (hwm || hwm === 0) ? hwm : defaultHwm; - - // object stream flag to indicate whether or not this stream - // contains buffers or objects. - this.objectMode = !!options.objectMode; - - if (stream instanceof Duplex) - this.objectMode = this.objectMode || !!options.writableObjectMode; - - // cast to ints. - this.highWaterMark = ~~this.highWaterMark; - - this.needDrain = false; - // at the start of calling end() - this.ending = false; - // when end() has been called, and returned - this.ended = false; - // when 'finish' is emitted - this.finished = false; - - // should we decode strings into buffers before passing to _write? - // this is here so that some node-core streams can optimize string - // handling at a lower level. - var noDecode = options.decodeStrings === false; - this.decodeStrings = !noDecode; - - // Crypto is kind of old and crusty. Historically, its default string - // encoding is 'binary' so we have to make this configurable. - // Everything else in the universe uses 'utf8', though. - this.defaultEncoding = options.defaultEncoding || 'utf8'; - - // not an actual buffer we keep track of, but a measurement - // of how much we're waiting to get pushed to some underlying - // socket or file. - this.length = 0; - - // a flag to see when we're in the middle of a write. - this.writing = false; - - // when true all writes will be buffered until .uncork() call - this.corked = 0; - - // a flag to be able to tell if the onwrite cb is called immediately, - // or on a later tick. We set this to true at first, because any - // actions that shouldn't happen until "later" should generally also - // not happen before the first write call. - this.sync = true; - - // a flag to know if we're processing previously buffered items, which - // may call the _write() callback in the same tick, so that we don't - // end up in an overlapped onwrite situation. - this.bufferProcessing = false; - - // the callback that's passed to _write(chunk,cb) - this.onwrite = function(er) { - onwrite(stream, er); - }; - - // the callback that the user supplies to write(chunk,encoding,cb) - this.writecb = null; - - // the amount that is being written when _write is called. - this.writelen = 0; - - this.buffer = []; - - // number of pending user-supplied write callbacks - // this must be 0 before 'finish' can be emitted - this.pendingcb = 0; - - // emit prefinish if the only thing we're waiting for is _write cbs - // This is relevant for synchronous Transform streams - this.prefinished = false; - - // True if the error was already emitted and should not be thrown again - this.errorEmitted = false; - } - - function Writable(options) { - var Duplex = __webpack_require__(129); - - // Writable ctor is applied to Duplexes, though they're not - // instanceof Writable, they're instanceof Readable. - if (!(this instanceof Writable) && !(this instanceof Duplex)) - return new Writable(options); - - this._writableState = new WritableState(options, this); - - // legacy. - this.writable = true; - - Stream.call(this); - } - - // Otherwise people can pipe Writable streams, which is just wrong. - Writable.prototype.pipe = function() { - this.emit('error', new Error('Cannot pipe. Not readable.')); - }; - - - function writeAfterEnd(stream, state, cb) { - var er = new Error('write after end'); - // TODO: defer error events consistently everywhere, not just the cb - stream.emit('error', er); - process.nextTick(function() { - cb(er); - }); - } - - // If we get something that is not a buffer, string, null, or undefined, - // and we're not in objectMode, then that's an error. - // Otherwise stream chunks are all considered to be of length=1, and the - // watermarks determine how many objects to keep in the buffer, rather than - // how many bytes or characters. - function validChunk(stream, state, chunk, cb) { - var valid = true; - if (!util.isBuffer(chunk) && - !util.isString(chunk) && - !util.isNullOrUndefined(chunk) && - !state.objectMode) { - var er = new TypeError('Invalid non-string/buffer chunk'); - stream.emit('error', er); - process.nextTick(function() { - cb(er); - }); - valid = false; - } - return valid; - } - - Writable.prototype.write = function(chunk, encoding, cb) { - var state = this._writableState; - var ret = false; - - if (util.isFunction(encoding)) { - cb = encoding; - encoding = null; - } - - if (util.isBuffer(chunk)) - encoding = 'buffer'; - else if (!encoding) - encoding = state.defaultEncoding; - - if (!util.isFunction(cb)) - cb = function() {}; - - if (state.ended) - writeAfterEnd(this, state, cb); - else if (validChunk(this, state, chunk, cb)) { - state.pendingcb++; - ret = writeOrBuffer(this, state, chunk, encoding, cb); - } - - return ret; - }; - - Writable.prototype.cork = function() { - var state = this._writableState; - - state.corked++; - }; - - Writable.prototype.uncork = function() { - var state = this._writableState; - - if (state.corked) { - state.corked--; - - if (!state.writing && - !state.corked && - !state.finished && - !state.bufferProcessing && - state.buffer.length) - clearBuffer(this, state); - } - }; - - function decodeChunk(state, chunk, encoding) { - if (!state.objectMode && - state.decodeStrings !== false && - util.isString(chunk)) { - chunk = new Buffer(chunk, encoding); - } - return chunk; - } - - // if we're already writing something, then just put this - // in the queue, and wait our turn. Otherwise, call _write - // If we return false, then we need a drain event, so set that flag. - function writeOrBuffer(stream, state, chunk, encoding, cb) { - chunk = decodeChunk(state, chunk, encoding); - if (util.isBuffer(chunk)) - encoding = 'buffer'; - var len = state.objectMode ? 1 : chunk.length; - - state.length += len; - - var ret = state.length < state.highWaterMark; - // we must ensure that previous needDrain will not be reset to false. - if (!ret) - state.needDrain = true; - - if (state.writing || state.corked) - state.buffer.push(new WriteReq(chunk, encoding, cb)); - else - doWrite(stream, state, false, len, chunk, encoding, cb); - - return ret; - } - - function doWrite(stream, state, writev, len, chunk, encoding, cb) { - state.writelen = len; - state.writecb = cb; - state.writing = true; - state.sync = true; - if (writev) - stream._writev(chunk, state.onwrite); - else - stream._write(chunk, encoding, state.onwrite); - state.sync = false; - } - - function onwriteError(stream, state, sync, er, cb) { - if (sync) - process.nextTick(function() { - state.pendingcb--; - cb(er); - }); - else { - state.pendingcb--; - cb(er); - } - - stream._writableState.errorEmitted = true; - stream.emit('error', er); - } - - function onwriteStateUpdate(state) { - state.writing = false; - state.writecb = null; - state.length -= state.writelen; - state.writelen = 0; - } - - function onwrite(stream, er) { - var state = stream._writableState; - var sync = state.sync; - var cb = state.writecb; - - onwriteStateUpdate(state); - - if (er) - onwriteError(stream, state, sync, er, cb); - else { - // Check if we're actually ready to finish, but don't emit yet - var finished = needFinish(stream, state); - - if (!finished && - !state.corked && - !state.bufferProcessing && - state.buffer.length) { - clearBuffer(stream, state); - } - - if (sync) { - process.nextTick(function() { - afterWrite(stream, state, finished, cb); - }); - } else { - afterWrite(stream, state, finished, cb); - } - } - } - - function afterWrite(stream, state, finished, cb) { - if (!finished) - onwriteDrain(stream, state); - state.pendingcb--; - cb(); - finishMaybe(stream, state); - } - - // Must force callback to be called on nextTick, so that we don't - // emit 'drain' before the write() consumer gets the 'false' return - // value, and has a chance to attach a 'drain' listener. - function onwriteDrain(stream, state) { - if (state.length === 0 && state.needDrain) { - state.needDrain = false; - stream.emit('drain'); - } - } - - - // if there's something in the buffer waiting, then process it - function clearBuffer(stream, state) { - state.bufferProcessing = true; - - if (stream._writev && state.buffer.length > 1) { - // Fast case, write everything using _writev() - var cbs = []; - for (var c = 0; c < state.buffer.length; c++) - cbs.push(state.buffer[c].callback); - - // count the one we are adding, as well. - // TODO(isaacs) clean this up - state.pendingcb++; - doWrite(stream, state, true, state.length, state.buffer, '', function(err) { - for (var i = 0; i < cbs.length; i++) { - state.pendingcb--; - cbs[i](err); - } - }); - - // Clear buffer - state.buffer = []; - } else { - // Slow case, write chunks one-by-one - for (var c = 0; c < state.buffer.length; c++) { - var entry = state.buffer[c]; - var chunk = entry.chunk; - var encoding = entry.encoding; - var cb = entry.callback; - var len = state.objectMode ? 1 : chunk.length; - - doWrite(stream, state, false, len, chunk, encoding, cb); - - // if we didn't call the onwrite immediately, then - // it means that we need to wait until it does. - // also, that means that the chunk and cb are currently - // being processed, so move the buffer counter past them. - if (state.writing) { - c++; - break; - } - } - - if (c < state.buffer.length) - state.buffer = state.buffer.slice(c); - else - state.buffer.length = 0; - } - - state.bufferProcessing = false; - } - - Writable.prototype._write = function(chunk, encoding, cb) { - cb(new Error('not implemented')); - - }; - - Writable.prototype._writev = null; - - Writable.prototype.end = function(chunk, encoding, cb) { - var state = this._writableState; - - if (util.isFunction(chunk)) { - cb = chunk; - chunk = null; - encoding = null; - } else if (util.isFunction(encoding)) { - cb = encoding; - encoding = null; - } - - if (!util.isNullOrUndefined(chunk)) - this.write(chunk, encoding); - - // .end() fully uncorks - if (state.corked) { - state.corked = 1; - this.uncork(); - } - - // ignore unnecessary end() calls. - if (!state.ending && !state.finished) - endWritable(this, state, cb); - }; - - - function needFinish(stream, state) { - return (state.ending && - state.length === 0 && - !state.finished && - !state.writing); - } - - function prefinish(stream, state) { - if (!state.prefinished) { - state.prefinished = true; - stream.emit('prefinish'); - } - } - - function finishMaybe(stream, state) { - var need = needFinish(stream, state); - if (need) { - if (state.pendingcb === 0) { - prefinish(stream, state); - state.finished = true; - stream.emit('finish'); - } else - prefinish(stream, state); - } - return need; - } - - function endWritable(stream, state, cb) { - state.ending = true; - finishMaybe(stream, state); - if (cb) { - if (state.finished) - process.nextTick(cb); - else - stream.once('finish', cb); - } - state.ended = true; - } - - /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2))) /***/ }, /* 134 */ /***/ function(module, exports, __webpack_require__) { - /* WEBPACK VAR INJECTION */(function(process, Buffer) {var msg = __webpack_require__(135); - var zstream = __webpack_require__(136); - var zlib_deflate = __webpack_require__(137); - var zlib_inflate = __webpack_require__(142); - var constants = __webpack_require__(145); +/* WEBPACK VAR INJECTION */(function(process) {const EventEmitter = __webpack_require__(3).EventEmitter; +const mergeDefault = __webpack_require__(41); +const Constants = __webpack_require__(2); +const RESTManager = __webpack_require__(127); +const ClientDataManager = __webpack_require__(248); +const ClientManager = __webpack_require__(249); +const ClientDataResolver = __webpack_require__(126); +const ClientVoiceManager = __webpack_require__(257); +const WebSocketManager = __webpack_require__(272); +const ActionsManager = __webpack_require__(251); +const Collection = __webpack_require__(6); +const Presence = __webpack_require__(12).Presence; +const ShardClientUtil = __webpack_require__(63); - for (var key in constants) { - exports[key] = constants[key]; - } +/** + * The starting point for making a Discord Bot. + * @extends {EventEmitter} + */ +class Client extends EventEmitter { + /** + * @param {ClientOptions} [options] Options for the client + */ + constructor(options = {}) { + super(); - // zlib modes - exports.NONE = 0; - exports.DEFLATE = 1; - exports.INFLATE = 2; - exports.GZIP = 3; - exports.GUNZIP = 4; - exports.DEFLATERAW = 5; - exports.INFLATERAW = 6; - exports.UNZIP = 7; + /** + * Whether the client is in a browser environment + * @type {boolean} + */ + this.browser = typeof window !== 'undefined'; - /** - * Emulate Node's zlib C++ layer for use by the JS layer in index.js - */ - function Zlib(mode) { - if (mode < exports.DEFLATE || mode > exports.UNZIP) - throw new TypeError("Bad argument"); - - this.mode = mode; - this.init_done = false; - this.write_in_progress = false; - this.pending_close = false; - this.windowBits = 0; - this.level = 0; - this.memLevel = 0; - this.strategy = 0; - this.dictionary = null; - } + // Obtain shard details from environment + if (!options.shardId && 'SHARD_ID' in process.env) options.shardId = Number(process.env.SHARD_ID); + if (!options.shardCount && 'SHARD_COUNT' in process.env) options.shardCount = Number(process.env.SHARD_COUNT); - Zlib.prototype.init = function(windowBits, level, memLevel, strategy, dictionary) { - this.windowBits = windowBits; - this.level = level; - this.memLevel = memLevel; - this.strategy = strategy; - // dictionary not supported. - - if (this.mode === exports.GZIP || this.mode === exports.GUNZIP) - this.windowBits += 16; - - if (this.mode === exports.UNZIP) - this.windowBits += 32; - - if (this.mode === exports.DEFLATERAW || this.mode === exports.INFLATERAW) - this.windowBits = -this.windowBits; - - this.strm = new zstream(); - - switch (this.mode) { - case exports.DEFLATE: - case exports.GZIP: - case exports.DEFLATERAW: - var status = zlib_deflate.deflateInit2( - this.strm, - this.level, - exports.Z_DEFLATED, - this.windowBits, - this.memLevel, - this.strategy - ); - break; - case exports.INFLATE: - case exports.GUNZIP: - case exports.INFLATERAW: - case exports.UNZIP: - var status = zlib_inflate.inflateInit2( - this.strm, - this.windowBits - ); - break; - default: - throw new Error("Unknown mode " + this.mode); - } - - if (status !== exports.Z_OK) { - this._error(status); - return; - } - - this.write_in_progress = false; - this.init_done = true; - }; + /** + * The options the client was instantiated with + * @type {ClientOptions} + */ + this.options = mergeDefault(Constants.DefaultOptions, options); + this._validateOptions(); - Zlib.prototype.params = function() { - throw new Error("deflateParams Not supported"); - }; + /** + * The REST manager of the client + * @type {RESTManager} + * @private + */ + this.rest = new RESTManager(this); - Zlib.prototype._writeCheck = function() { - if (!this.init_done) - throw new Error("write before init"); - - if (this.mode === exports.NONE) - throw new Error("already finalized"); - - if (this.write_in_progress) - throw new Error("write already in progress"); - - if (this.pending_close) - throw new Error("close is pending"); - }; + /** + * The data manager of the Client + * @type {ClientDataManager} + * @private + */ + this.dataManager = new ClientDataManager(this); - Zlib.prototype.write = function(flush, input, in_off, in_len, out, out_off, out_len) { - this._writeCheck(); - this.write_in_progress = true; - - var self = this; - process.nextTick(function() { - self.write_in_progress = false; - var res = self._write(flush, input, in_off, in_len, out, out_off, out_len); - self.callback(res[0], res[1]); - - if (self.pending_close) - self.close(); - }); - - return this; - }; + /** + * The manager of the Client + * @type {ClientManager} + * @private + */ + this.manager = new ClientManager(this); - // set method for Node buffers, used by pako - function bufferSet(data, offset) { - for (var i = 0; i < data.length; i++) { - this[offset + i] = data[i]; - } - } + /** + * The WebSocket Manager of the Client + * @type {WebSocketManager} + * @private + */ + this.ws = new WebSocketManager(this); - Zlib.prototype.writeSync = function(flush, input, in_off, in_len, out, out_off, out_len) { - this._writeCheck(); - return this._write(flush, input, in_off, in_len, out, out_off, out_len); - }; + /** + * The Data Resolver of the Client + * @type {ClientDataResolver} + * @private + */ + this.resolver = new ClientDataResolver(this); - Zlib.prototype._write = function(flush, input, in_off, in_len, out, out_off, out_len) { - this.write_in_progress = true; - - if (flush !== exports.Z_NO_FLUSH && - flush !== exports.Z_PARTIAL_FLUSH && - flush !== exports.Z_SYNC_FLUSH && - flush !== exports.Z_FULL_FLUSH && - flush !== exports.Z_FINISH && - flush !== exports.Z_BLOCK) { - throw new Error("Invalid flush value"); - } - - if (input == null) { - input = new Buffer(0); - in_len = 0; - in_off = 0; - } - - if (out._set) - out.set = out._set; - else - out.set = bufferSet; - - var strm = this.strm; - strm.avail_in = in_len; - strm.input = input; - strm.next_in = in_off; - strm.avail_out = out_len; - strm.output = out; - strm.next_out = out_off; - - switch (this.mode) { - case exports.DEFLATE: - case exports.GZIP: - case exports.DEFLATERAW: - var status = zlib_deflate.deflate(strm, flush); - break; - case exports.UNZIP: - case exports.INFLATE: - case exports.GUNZIP: - case exports.INFLATERAW: - var status = zlib_inflate.inflate(strm, flush); - break; - default: - throw new Error("Unknown mode " + this.mode); - } - - if (status !== exports.Z_STREAM_END && status !== exports.Z_OK) { - this._error(status); - } - - this.write_in_progress = false; - return [strm.avail_in, strm.avail_out]; - }; + /** + * The Action Manager of the Client + * @type {ActionsManager} + * @private + */ + this.actions = new ActionsManager(this); - Zlib.prototype.close = function() { - if (this.write_in_progress) { - this.pending_close = true; - return; - } - - this.pending_close = false; - - if (this.mode === exports.DEFLATE || this.mode === exports.GZIP || this.mode === exports.DEFLATERAW) { - zlib_deflate.deflateEnd(this.strm); - } else { - zlib_inflate.inflateEnd(this.strm); - } - - this.mode = exports.NONE; - }; + /** + * The Voice Manager of the Client + * @type {ClientVoiceManager} + * @private + */ + this.voice = new ClientVoiceManager(this); - Zlib.prototype.reset = function() { - switch (this.mode) { - case exports.DEFLATE: - case exports.DEFLATERAW: - var status = zlib_deflate.deflateReset(this.strm); - break; - case exports.INFLATE: - case exports.INFLATERAW: - var status = zlib_inflate.inflateReset(this.strm); - break; - } - - if (status !== exports.Z_OK) { - this._error(status); - } - }; + /** + * The shard helpers for the client (only if the process was spawned as a child, such as from a ShardingManager) + * @type {?ShardClientUtil} + */ + this.shard = process.send ? ShardClientUtil.singleton(this) : null; - Zlib.prototype._error = function(status) { - this.onerror(msg[status] + ': ' + this.strm.msg, status); - - this.write_in_progress = false; - if (this.pending_close) - this.close(); - }; + /** + * A collection of the Client's stored users + * @type {Collection} + */ + this.users = new Collection(); - exports.Zlib = Zlib; + /** + * A collection of the Client's stored guilds + * @type {Collection} + */ + this.guilds = new Collection(); - /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2), __webpack_require__(58).Buffer)) + /** + * A collection of the Client's stored channels + * @type {Collection} + */ + this.channels = new Collection(); + + /** + * A collection of presences for friends of the logged in user. + * This is only filled when using a user account. + * @type {Collection} + */ + this.presences = new Collection(); + + if (!this.token && 'CLIENT_TOKEN' in process.env) { + /** + * The authorization token for the logged in user/bot. + * @type {?string} + */ + this.token = process.env.CLIENT_TOKEN; + } else { + this.token = null; + } + + /** + * The email, if there is one, for the logged in Client + * @type {?string} + */ + this.email = null; + + /** + * The password, if there is one, for the logged in Client + * @type {?string} + */ + this.password = null; + + /** + * The ClientUser representing the logged in Client + * @type {?ClientUser} + */ + this.user = null; + + /** + * The date at which the Client was regarded as being in the `READY` state. + * @type {?Date} + */ + this.readyAt = null; + + this._timeouts = new Set(); + this._intervals = new Set(); + + if (this.options.messageSweepInterval > 0) { + this.setInterval(this.sweepMessages.bind(this), this.options.messageSweepInterval * 1000); + } + } + + /** + * The status for the logged in Client. + * @type {?number} + * @readonly + */ + get status() { + return this.ws.status; + } + + /** + * The uptime for the logged in Client. + * @type {?number} + * @readonly + */ + get uptime() { + return this.readyAt ? Date.now() - this.readyAt : null; + } + + /** + * Returns a collection, mapping guild ID to voice connections. + * @type {Collection} + * @readonly + */ + get voiceConnections() { + return this.voice.connections; + } + + /** + * The emojis that the client can use. Mapped by emoji ID. + * @type {Collection} + * @readonly + */ + get emojis() { + const emojis = new Collection(); + for (const guild of this.guilds.values()) { + for (const emoji of guild.emojis.values()) emojis.set(emoji.id, emoji); + } + return emojis; + } + + /** + * The timestamp that the client was last ready at + * @type {?number} + * @readonly + */ + get readyTimestamp() { + return this.readyAt ? this.readyAt.getTime() : null; + } + + /** + * Logs the client in. If successful, resolves with the account's token. If you're making a bot, it's + * much better to use a bot account rather than a user account. + * Bot accounts have higher rate limits and have access to some features user accounts don't have. User bots + * that are making a lot of API requests can even be banned. + * @param {string} tokenOrEmail The token or email used for the account. If it is an email, a password _must_ be + * provided. + * @param {string} [password] The password for the account, only needed if an email was provided. + * @returns {Promise} + * @example + * // log the client in using a token + * const token = 'my token'; + * client.login(token); + * @example + * // log the client in using email and password + * const email = 'user@email.com'; + * const password = 'supersecret123'; + * client.login(email, password); + */ + login(tokenOrEmail, password = null) { + if (password) return this.rest.methods.loginEmailPassword(tokenOrEmail, password); + return this.rest.methods.loginToken(tokenOrEmail); + } + + /** + * Destroys the client and logs out. + * @returns {Promise} + */ + destroy() { + for (const t of this._timeouts) clearTimeout(t); + for (const i of this._intervals) clearInterval(i); + this._timeouts.clear(); + this._intervals.clear(); + this.token = null; + this.email = null; + this.password = null; + return this.manager.destroy(); + } + + /** + * This shouldn't really be necessary to most developers as it is automatically invoked every 30 seconds, however + * if you wish to force a sync of guild data, you can use this. + * This is only available when using a user account. + * @param {Guild[]|Collection} [guilds=this.guilds] An array or collection of guilds to sync + */ + syncGuilds(guilds = this.guilds) { + if (this.user.bot) return; + this.ws.send({ + op: 12, + d: guilds instanceof Collection ? guilds.keyArray() : guilds.map(g => g.id), + }); + } + + /** + * Caches a user, or obtains it from the cache if it's already cached. + * This is only available when using a bot account. + * @param {string} id The ID of the user to obtain + * @returns {Promise} + */ + fetchUser(id) { + if (this.users.has(id)) return Promise.resolve(this.users.get(id)); + return this.rest.methods.getUser(id); + } + + /** + * Fetches an invite object from an invite code. + * @param {InviteResolvable} invite An invite code or URL + * @returns {Promise} + */ + fetchInvite(invite) { + const code = this.resolver.resolveInviteCode(invite); + return this.rest.methods.getInvite(code); + } + + /** + * Fetch a webhook by ID. + * @param {string} id ID of the webhook + * @param {string} [token] Token for the webhook + * @returns {Promise} + */ + fetchWebhook(id, token) { + return this.rest.methods.getWebhook(id, token); + } + + /** + * Sweeps all channels' messages and removes the ones older than the max message lifetime. + * If the message has been edited, the time of the edit is used rather than the time of the original message. + * @param {number} [lifetime=this.options.messageCacheLifetime] Messages that are older than this (in seconds) + * will be removed from the caches. The default is based on the client's `messageCacheLifetime` option. + * @returns {number} Amount of messages that were removed from the caches, + * or -1 if the message cache lifetime is unlimited + */ + sweepMessages(lifetime = this.options.messageCacheLifetime) { + if (typeof lifetime !== 'number' || isNaN(lifetime)) throw new TypeError('The lifetime must be a number.'); + if (lifetime <= 0) { + this.emit('debug', 'Didn\'t sweep messages - lifetime is unlimited'); + return -1; + } + + const lifetimeMs = lifetime * 1000; + const now = Date.now(); + let channels = 0; + let messages = 0; + + for (const channel of this.channels.values()) { + if (!channel.messages) continue; + channels++; + + for (const message of channel.messages.values()) { + if (now - (message.editedTimestamp || message.createdTimestamp) > lifetimeMs) { + channel.messages.delete(message.id); + messages++; + } + } + } + + this.emit('debug', `Swept ${messages} messages older than ${lifetime} seconds in ${channels} text-based channels`); + return messages; + } + + /** + * Gets the bot's OAuth2 application. + * This is only available when using a bot account. + * @returns {Promise} + */ + fetchApplication() { + if (!this.user.bot) throw new Error(Constants.Errors.NO_BOT_ACCOUNT); + return this.rest.methods.getMyApplication(); + } + + /** + * Sets a timeout that will be automatically cancelled if the client is destroyed. + * @param {Function} fn Function to execute + * @param {number} delay Time to wait before executing (in milliseconds) + * @param {args} args Arguments for the function (infinite/rest argument, not an array) + * @returns {Timeout} + */ + setTimeout(fn, delay, ...args) { + const timeout = setTimeout(() => { + fn(); + this._timeouts.delete(timeout); + }, delay, ...args); + this._timeouts.add(timeout); + return timeout; + } + + /** + * Clears a timeout + * @param {Timeout} timeout Timeout to cancel + */ + clearTimeout(timeout) { + clearTimeout(timeout); + this._timeouts.delete(timeout); + } + + /** + * Sets an interval that will be automatically cancelled if the client is destroyed. + * @param {Function} fn Function to execute + * @param {number} delay Time to wait before executing (in milliseconds) + * @param {args} args Arguments for the function (infinite/rest argument, not an array) + * @returns {Timeout} + */ + setInterval(fn, delay, ...args) { + const interval = setInterval(fn, delay, ...args); + this._intervals.add(interval); + return interval; + } + + /** + * Clears an interval + * @param {Timeout} interval Interval to cancel + */ + clearInterval(interval) { + clearInterval(interval); + this._intervals.delete(interval); + } + + _setPresence(id, presence) { + if (this.presences.get(id)) { + this.presences.get(id).update(presence); + return; + } + this.presences.set(id, new Presence(presence)); + } + + _eval(script) { + return eval(script); + } + + _validateOptions(options = this.options) { + if (typeof options.shardCount !== 'number' || isNaN(options.shardCount)) { + throw new TypeError('The shardCount option must be a number.'); + } + if (typeof options.shardId !== 'number' || isNaN(options.shardId)) { + throw new TypeError('The shardId option must be a number.'); + } + if (options.shardCount < 0) throw new RangeError('The shardCount option must be at least 0.'); + if (options.shardId < 0) throw new RangeError('The shardId option must be at least 0.'); + if (options.shardId !== 0 && options.shardId >= options.shardCount) { + throw new RangeError('The shardId option must be less than shardCount.'); + } + if (typeof options.messageCacheMaxSize !== 'number' || isNaN(options.messageCacheMaxSize)) { + throw new TypeError('The messageCacheMaxSize option must be a number.'); + } + if (typeof options.messageCacheLifetime !== 'number' || isNaN(options.messageCacheLifetime)) { + throw new TypeError('The messageCacheLifetime option must be a number.'); + } + if (typeof options.messageSweepInterval !== 'number' || isNaN(options.messageSweepInterval)) { + throw new TypeError('The messageSweepInterval option must be a number.'); + } + if (typeof options.fetchAllMembers !== 'boolean') { + throw new TypeError('The fetchAllMembers option must be a boolean.'); + } + if (typeof options.disableEveryone !== 'boolean') { + throw new TypeError('The disableEveryone option must be a boolean.'); + } + if (typeof options.restWsBridgeTimeout !== 'number' || isNaN(options.restWsBridgeTimeout)) { + throw new TypeError('The restWsBridgeTimeout option must be a number.'); + } + if (!(options.disabledEvents instanceof Array)) throw new TypeError('The disabledEvents option must be an Array.'); + } +} + +module.exports = Client; + +/** + * Emitted for general warnings + * @event Client#warn + * @param {string} The warning + */ + +/** + * Emitted for general debugging information + * @event Client#debug + * @param {string} The debug information + */ + +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) /***/ }, /* 135 */ -/***/ function(module, exports) { +/***/ function(module, exports, __webpack_require__) { - 'use strict'; +const Webhook = __webpack_require__(46); +const RESTManager = __webpack_require__(127); +const ClientDataResolver = __webpack_require__(126); +const mergeDefault = __webpack_require__(41); +const Constants = __webpack_require__(2); - module.exports = { - 2: 'need dictionary', /* Z_NEED_DICT 2 */ - 1: 'stream end', /* Z_STREAM_END 1 */ - 0: '', /* Z_OK 0 */ - '-1': 'file error', /* Z_ERRNO (-1) */ - '-2': 'stream error', /* Z_STREAM_ERROR (-2) */ - '-3': 'data error', /* Z_DATA_ERROR (-3) */ - '-4': 'insufficient memory', /* Z_MEM_ERROR (-4) */ - '-5': 'buffer error', /* Z_BUF_ERROR (-5) */ - '-6': 'incompatible version' /* Z_VERSION_ERROR (-6) */ - }; +/** + * The Webhook Client + * @extends {Webhook} + */ +class WebhookClient extends Webhook { + /** + * @param {string} id The id of the webhook. + * @param {string} token the token of the webhook. + * @param {ClientOptions} [options] Options for the client + * @example + * // create a new webhook and send a message + * let hook = new Discord.WebhookClient('1234', 'abcdef') + * hook.sendMessage('This will send a message').catch(console.error) + */ + constructor(id, token, options) { + super(null, id, token); + + /** + * The options the client was instantiated with + * @type {ClientOptions} + */ + this.options = mergeDefault(Constants.DefaultOptions, options); + + /** + * The REST manager of the client + * @type {RESTManager} + * @private + */ + this.rest = new RESTManager(this); + + /** + * The Data Resolver of the Client + * @type {ClientDataResolver} + * @private + */ + this.resolver = new ClientDataResolver(this); + } +} + +module.exports = WebhookClient; /***/ }, /* 136 */ -/***/ function(module, exports) { +/***/ function(module, exports, __webpack_require__) { - 'use strict'; +/* WEBPACK VAR INJECTION */(function(process) {const path = __webpack_require__(14); +const fs = __webpack_require__(10); +const EventEmitter = __webpack_require__(3).EventEmitter; +const mergeDefault = __webpack_require__(41); +const Shard = __webpack_require__(62); +const Collection = __webpack_require__(6); +const fetchRecommendedShards = __webpack_require__(78); +/** + * This is a utility class that can be used to help you spawn shards of your Client. Each shard is completely separate + * from the other. The Shard Manager takes a path to a file and spawns it under the specified amount of shards safely. + * If you do not select an amount of shards, the manager will automatically decide the best amount. + * @extends {EventEmitter} + */ +class ShardingManager extends EventEmitter { + /** + * @param {string} file Path to your shard script file + * @param {Object} [options] Options for the sharding manager + * @param {number|string} [options.totalShards='auto'] Number of shards to spawn, or "auto" + * @param {boolean} [options.respawn=true] Whether shards should automatically respawn upon exiting + * @param {string[]} [options.shardArgs=[]] Arguments to pass to the shard script when spawning + * @param {string} [options.token] Token to use for automatic shard count and passing to shards + */ + constructor(file, options = {}) { + super(); + options = mergeDefault({ + totalShards: 'auto', + respawn: true, + shardArgs: [], + token: null, + }, options); - function ZStream() { - /* next input byte */ - this.input = null; // JS specific, because we have no pointers - this.next_in = 0; - /* number of bytes available at input */ - this.avail_in = 0; - /* total number of input bytes read so far */ - this.total_in = 0; - /* next output byte should be put there */ - this.output = null; // JS specific, because we have no pointers - this.next_out = 0; - /* remaining free space at output */ - this.avail_out = 0; - /* total number of bytes output so far */ - this.total_out = 0; - /* last error message, NULL if no error */ - this.msg = ''/*Z_NULL*/; - /* not visible by applications */ - this.state = null; - /* best guess about the data type: binary or text */ - this.data_type = 2/*Z_UNKNOWN*/; - /* adler32 value of the uncompressed data */ - this.adler = 0; - } + /** + * Path to the shard script file + * @type {string} + */ + this.file = file; + if (!file) throw new Error('File must be specified.'); + if (!path.isAbsolute(file)) this.file = path.resolve(process.cwd(), file); + const stats = fs.statSync(this.file); + if (!stats.isFile()) throw new Error('File path does not point to a file.'); - module.exports = ZStream; + /** + * Amount of shards that this manager is going to spawn + * @type {number|string} + */ + this.totalShards = options.totalShards; + if (this.totalShards !== 'auto') { + if (typeof this.totalShards !== 'number' || isNaN(this.totalShards)) { + throw new TypeError('Amount of shards must be a number.'); + } + if (this.totalShards < 1) throw new RangeError('Amount of shards must be at least 1.'); + if (this.totalShards !== Math.floor(this.totalShards)) { + throw new RangeError('Amount of shards must be an integer.'); + } + } + /** + * Whether shards should automatically respawn upon exiting + * @type {boolean} + */ + this.respawn = options.respawn; + + /** + * An array of arguments to pass to shards. + * @type {string[]} + */ + this.shardArgs = options.shardArgs; + + /** + * Token to use for obtaining the automatic shard count, and passing to shards + * @type {?string} + */ + this.token = options.token ? options.token.replace(/^Bot\s*/i, '') : null; + + /** + * A collection of shards that this manager has spawned + * @type {Collection} + */ + this.shards = new Collection(); + } + + /** + * Spawns a single shard. + * @param {number} id The ID of the shard to spawn. **This is usually not necessary.** + * @returns {Promise} + */ + createShard(id = this.shards.size) { + const shard = new Shard(this, id, this.shardArgs); + this.shards.set(id, shard); + /** + * Emitted upon launching a shard + * @event ShardingManager#launch + * @param {Shard} shard Shard that was launched + */ + this.emit('launch', shard); + return Promise.resolve(shard); + } + + /** + * Spawns multiple shards. + * @param {number} [amount=this.totalShards] Number of shards to spawn + * @param {number} [delay=5500] How long to wait in between spawning each shard (in milliseconds) + * @returns {Promise>} + */ + spawn(amount = this.totalShards, delay = 5500) { + if (amount === 'auto') { + return fetchRecommendedShards(this.token).then(count => { + this.totalShards = count; + return this._spawn(count, delay); + }); + } else { + if (typeof amount !== 'number' || isNaN(amount)) throw new TypeError('Amount of shards must be a number.'); + if (amount < 1) throw new RangeError('Amount of shards must be at least 1.'); + if (amount !== Math.floor(amount)) throw new TypeError('Amount of shards must be an integer.'); + return this._spawn(amount, delay); + } + } + + /** + * Actually spawns shards, unlike that poser above >:( + * @param {number} amount Number of shards to spawn + * @param {number} delay How long to wait in between spawning each shard (in milliseconds) + * @returns {Promise>} + * @private + */ + _spawn(amount, delay) { + return new Promise(resolve => { + if (this.shards.size >= amount) throw new Error(`Already spawned ${this.shards.size} shards.`); + this.totalShards = amount; + + this.createShard(); + if (this.shards.size >= this.totalShards) { + resolve(this.shards); + return; + } + + if (delay <= 0) { + while (this.shards.size < this.totalShards) this.createShard(); + resolve(this.shards); + } else { + const interval = setInterval(() => { + this.createShard(); + if (this.shards.size >= this.totalShards) { + clearInterval(interval); + resolve(this.shards); + } + }, delay); + } + }); + } + + /** + * Send a message to all shards. + * @param {*} message Message to be sent to the shards + * @returns {Promise} + */ + broadcast(message) { + const promises = []; + for (const shard of this.shards.values()) promises.push(shard.send(message)); + return Promise.all(promises); + } + + /** + * Evaluates a script on all shards, in the context of the Clients. + * @param {string} script JavaScript to run on each shard + * @returns {Promise} Results of the script execution + */ + broadcastEval(script) { + const promises = []; + for (const shard of this.shards.values()) promises.push(shard.eval(script)); + return Promise.all(promises); + } + + /** + * Fetches a Client property value of each shard. + * @param {string} prop Name of the Client property to get, using periods for nesting + * @returns {Promise} + * @example + * manager.fetchClientValues('guilds.size').then(results => { + * console.log(`${results.reduce((prev, val) => prev + val, 0)} total guilds`); + * }).catch(console.error); + */ + fetchClientValues(prop) { + if (this.shards.size === 0) return Promise.reject(new Error('No shards have been spawned.')); + if (this.shards.size !== this.totalShards) return Promise.reject(new Error('Still spawning shards.')); + const promises = []; + for (const shard of this.shards.values()) promises.push(shard.fetchClientValue(prop)); + return Promise.all(promises); + } +} + +module.exports = ShardingManager; + +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) /***/ }, /* 137 */ /***/ function(module, exports, __webpack_require__) { - 'use strict'; - - var utils = __webpack_require__(138); - var trees = __webpack_require__(139); - var adler32 = __webpack_require__(140); - var crc32 = __webpack_require__(141); - var msg = __webpack_require__(135); - - /* Public constants ==========================================================*/ - /* ===========================================================================*/ - - - /* Allowed flush values; see deflate() and inflate() below for details */ - var Z_NO_FLUSH = 0; - var Z_PARTIAL_FLUSH = 1; - //var Z_SYNC_FLUSH = 2; - var Z_FULL_FLUSH = 3; - var Z_FINISH = 4; - var Z_BLOCK = 5; - //var Z_TREES = 6; - - - /* Return codes for the compression/decompression functions. Negative values - * are errors, positive values are used for special but normal events. - */ - var Z_OK = 0; - var Z_STREAM_END = 1; - //var Z_NEED_DICT = 2; - //var Z_ERRNO = -1; - var Z_STREAM_ERROR = -2; - var Z_DATA_ERROR = -3; - //var Z_MEM_ERROR = -4; - var Z_BUF_ERROR = -5; - //var Z_VERSION_ERROR = -6; - - - /* compression levels */ - //var Z_NO_COMPRESSION = 0; - //var Z_BEST_SPEED = 1; - //var Z_BEST_COMPRESSION = 9; - var Z_DEFAULT_COMPRESSION = -1; - - - var Z_FILTERED = 1; - var Z_HUFFMAN_ONLY = 2; - var Z_RLE = 3; - var Z_FIXED = 4; - var Z_DEFAULT_STRATEGY = 0; - - /* Possible values of the data_type field (though see inflate()) */ - //var Z_BINARY = 0; - //var Z_TEXT = 1; - //var Z_ASCII = 1; // = Z_TEXT - var Z_UNKNOWN = 2; - - - /* The deflate compression method */ - var Z_DEFLATED = 8; - - /*============================================================================*/ - - - var MAX_MEM_LEVEL = 9; - /* Maximum value for memLevel in deflateInit2 */ - var MAX_WBITS = 15; - /* 32K LZ77 window */ - var DEF_MEM_LEVEL = 8; - - - var LENGTH_CODES = 29; - /* number of length codes, not counting the special END_BLOCK code */ - var LITERALS = 256; - /* number of literal bytes 0..255 */ - var L_CODES = LITERALS + 1 + LENGTH_CODES; - /* number of Literal or Length codes, including the END_BLOCK code */ - var D_CODES = 30; - /* number of distance codes */ - var BL_CODES = 19; - /* number of codes used to transfer the bit lengths */ - var HEAP_SIZE = 2 * L_CODES + 1; - /* maximum heap size */ - var MAX_BITS = 15; - /* All codes must not exceed MAX_BITS bits */ - - var MIN_MATCH = 3; - var MAX_MATCH = 258; - var MIN_LOOKAHEAD = (MAX_MATCH + MIN_MATCH + 1); - - var PRESET_DICT = 0x20; - - var INIT_STATE = 42; - var EXTRA_STATE = 69; - var NAME_STATE = 73; - var COMMENT_STATE = 91; - var HCRC_STATE = 103; - var BUSY_STATE = 113; - var FINISH_STATE = 666; - - var BS_NEED_MORE = 1; /* block not completed, need more input or more output */ - var BS_BLOCK_DONE = 2; /* block flush performed */ - var BS_FINISH_STARTED = 3; /* finish started, need only more output at next deflate */ - var BS_FINISH_DONE = 4; /* finish done, accept no more input or output */ - - var OS_CODE = 0x03; // Unix :) . Don't detect, use this default. - - function err(strm, errorCode) { - strm.msg = msg[errorCode]; - return errorCode; - } - - function rank(f) { - return ((f) << 1) - ((f) > 4 ? 9 : 0); - } - - function zero(buf) { var len = buf.length; while (--len >= 0) { buf[len] = 0; } } - - - /* ========================================================================= - * Flush as much pending output as possible. All deflate() output goes - * through this function so some applications may wish to modify it - * to avoid allocating a large strm->output buffer and copying into it. - * (See also read_buf()). - */ - function flush_pending(strm) { - var s = strm.state; - - //_tr_flush_bits(s); - var len = s.pending; - if (len > strm.avail_out) { - len = strm.avail_out; - } - if (len === 0) { return; } - - utils.arraySet(strm.output, s.pending_buf, s.pending_out, len, strm.next_out); - strm.next_out += len; - s.pending_out += len; - strm.total_out += len; - strm.avail_out -= len; - s.pending -= len; - if (s.pending === 0) { - s.pending_out = 0; - } - } - - - function flush_block_only(s, last) { - trees._tr_flush_block(s, (s.block_start >= 0 ? s.block_start : -1), s.strstart - s.block_start, last); - s.block_start = s.strstart; - flush_pending(s.strm); - } - - - function put_byte(s, b) { - s.pending_buf[s.pending++] = b; - } - - - /* ========================================================================= - * Put a short in the pending buffer. The 16-bit value is put in MSB order. - * IN assertion: the stream state is correct and there is enough room in - * pending_buf. - */ - function putShortMSB(s, b) { - // put_byte(s, (Byte)(b >> 8)); - // put_byte(s, (Byte)(b & 0xff)); - s.pending_buf[s.pending++] = (b >>> 8) & 0xff; - s.pending_buf[s.pending++] = b & 0xff; - } - - - /* =========================================================================== - * Read a new buffer from the current input stream, update the adler32 - * and total number of bytes read. All deflate() input goes through - * this function so some applications may wish to modify it to avoid - * allocating a large strm->input buffer and copying from it. - * (See also flush_pending()). - */ - function read_buf(strm, buf, start, size) { - var len = strm.avail_in; - - if (len > size) { len = size; } - if (len === 0) { return 0; } - - strm.avail_in -= len; - - // zmemcpy(buf, strm->next_in, len); - utils.arraySet(buf, strm.input, strm.next_in, len, start); - if (strm.state.wrap === 1) { - strm.adler = adler32(strm.adler, buf, len, start); - } - - else if (strm.state.wrap === 2) { - strm.adler = crc32(strm.adler, buf, len, start); - } - - strm.next_in += len; - strm.total_in += len; - - return len; - } - - - /* =========================================================================== - * Set match_start to the longest match starting at the given string and - * return its length. Matches shorter or equal to prev_length are discarded, - * in which case the result is equal to prev_length and match_start is - * garbage. - * IN assertions: cur_match is the head of the hash chain for the current - * string (strstart) and its distance is <= MAX_DIST, and prev_length >= 1 - * OUT assertion: the match length is not greater than s->lookahead. - */ - function longest_match(s, cur_match) { - var chain_length = s.max_chain_length; /* max hash chain length */ - var scan = s.strstart; /* current string */ - var match; /* matched string */ - var len; /* length of current match */ - var best_len = s.prev_length; /* best match length so far */ - var nice_match = s.nice_match; /* stop if match long enough */ - var limit = (s.strstart > (s.w_size - MIN_LOOKAHEAD)) ? - s.strstart - (s.w_size - MIN_LOOKAHEAD) : 0/*NIL*/; - - var _win = s.window; // shortcut - - var wmask = s.w_mask; - var prev = s.prev; - - /* Stop when cur_match becomes <= limit. To simplify the code, - * we prevent matches with the string of window index 0. - */ - - var strend = s.strstart + MAX_MATCH; - var scan_end1 = _win[scan + best_len - 1]; - var scan_end = _win[scan + best_len]; - - /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16. - * It is easy to get rid of this optimization if necessary. - */ - // Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever"); - - /* Do not waste too much time if we already have a good match: */ - if (s.prev_length >= s.good_match) { - chain_length >>= 2; - } - /* Do not look for matches beyond the end of the input. This is necessary - * to make deflate deterministic. - */ - if (nice_match > s.lookahead) { nice_match = s.lookahead; } - - // Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead"); - - do { - // Assert(cur_match < s->strstart, "no future"); - match = cur_match; - - /* Skip to next match if the match length cannot increase - * or if the match length is less than 2. Note that the checks below - * for insufficient lookahead only occur occasionally for performance - * reasons. Therefore uninitialized memory will be accessed, and - * conditional jumps will be made that depend on those values. - * However the length of the match is limited to the lookahead, so - * the output of deflate is not affected by the uninitialized values. - */ - - if (_win[match + best_len] !== scan_end || - _win[match + best_len - 1] !== scan_end1 || - _win[match] !== _win[scan] || - _win[++match] !== _win[scan + 1]) { - continue; - } - - /* The check at best_len-1 can be removed because it will be made - * again later. (This heuristic is not always a win.) - * It is not necessary to compare scan[2] and match[2] since they - * are always equal when the other bytes match, given that - * the hash keys are equal and that HASH_BITS >= 8. - */ - scan += 2; - match++; - // Assert(*scan == *match, "match[2]?"); - - /* We check for insufficient lookahead only every 8th comparison; - * the 256th check will be made at strstart+258. - */ - do { - /*jshint noempty:false*/ - } while (_win[++scan] === _win[++match] && _win[++scan] === _win[++match] && - _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && - _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && - _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && - scan < strend); - - // Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan"); - - len = MAX_MATCH - (strend - scan); - scan = strend - MAX_MATCH; - - if (len > best_len) { - s.match_start = cur_match; - best_len = len; - if (len >= nice_match) { - break; - } - scan_end1 = _win[scan + best_len - 1]; - scan_end = _win[scan + best_len]; - } - } while ((cur_match = prev[cur_match & wmask]) > limit && --chain_length !== 0); - - if (best_len <= s.lookahead) { - return best_len; - } - return s.lookahead; - } - - - /* =========================================================================== - * Fill the window when the lookahead becomes insufficient. - * Updates strstart and lookahead. - * - * IN assertion: lookahead < MIN_LOOKAHEAD - * OUT assertions: strstart <= window_size-MIN_LOOKAHEAD - * At least one byte has been read, or avail_in == 0; reads are - * performed for at least two bytes (required for the zip translate_eol - * option -- not supported here). - */ - function fill_window(s) { - var _w_size = s.w_size; - var p, n, m, more, str; - - //Assert(s->lookahead < MIN_LOOKAHEAD, "already enough lookahead"); - - do { - more = s.window_size - s.lookahead - s.strstart; - - // JS ints have 32 bit, block below not needed - /* Deal with !@#$% 64K limit: */ - //if (sizeof(int) <= 2) { - // if (more == 0 && s->strstart == 0 && s->lookahead == 0) { - // more = wsize; - // - // } else if (more == (unsigned)(-1)) { - // /* Very unlikely, but possible on 16 bit machine if - // * strstart == 0 && lookahead == 1 (input done a byte at time) - // */ - // more--; - // } - //} - - - /* If the window is almost full and there is insufficient lookahead, - * move the upper half to the lower one to make room in the upper half. - */ - if (s.strstart >= _w_size + (_w_size - MIN_LOOKAHEAD)) { - - utils.arraySet(s.window, s.window, _w_size, _w_size, 0); - s.match_start -= _w_size; - s.strstart -= _w_size; - /* we now have strstart >= MAX_DIST */ - s.block_start -= _w_size; - - /* Slide the hash table (could be avoided with 32 bit values - at the expense of memory usage). We slide even when level == 0 - to keep the hash table consistent if we switch back to level > 0 - later. (Using level 0 permanently is not an optimal usage of - zlib, so we don't care about this pathological case.) - */ - - n = s.hash_size; - p = n; - do { - m = s.head[--p]; - s.head[p] = (m >= _w_size ? m - _w_size : 0); - } while (--n); - - n = _w_size; - p = n; - do { - m = s.prev[--p]; - s.prev[p] = (m >= _w_size ? m - _w_size : 0); - /* If n is not on any hash chain, prev[n] is garbage but - * its value will never be used. - */ - } while (--n); - - more += _w_size; - } - if (s.strm.avail_in === 0) { - break; - } - - /* If there was no sliding: - * strstart <= WSIZE+MAX_DIST-1 && lookahead <= MIN_LOOKAHEAD - 1 && - * more == window_size - lookahead - strstart - * => more >= window_size - (MIN_LOOKAHEAD-1 + WSIZE + MAX_DIST-1) - * => more >= window_size - 2*WSIZE + 2 - * In the BIG_MEM or MMAP case (not yet supported), - * window_size == input_size + MIN_LOOKAHEAD && - * strstart + s->lookahead <= input_size => more >= MIN_LOOKAHEAD. - * Otherwise, window_size == 2*WSIZE so more >= 2. - * If there was sliding, more >= WSIZE. So in all cases, more >= 2. - */ - //Assert(more >= 2, "more < 2"); - n = read_buf(s.strm, s.window, s.strstart + s.lookahead, more); - s.lookahead += n; - - /* Initialize the hash value now that we have some input: */ - if (s.lookahead + s.insert >= MIN_MATCH) { - str = s.strstart - s.insert; - s.ins_h = s.window[str]; - - /* UPDATE_HASH(s, s->ins_h, s->window[str + 1]); */ - s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + 1]) & s.hash_mask; - //#if MIN_MATCH != 3 - // Call update_hash() MIN_MATCH-3 more times - //#endif - while (s.insert) { - /* UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]); */ - s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + MIN_MATCH - 1]) & s.hash_mask; - - s.prev[str & s.w_mask] = s.head[s.ins_h]; - s.head[s.ins_h] = str; - str++; - s.insert--; - if (s.lookahead + s.insert < MIN_MATCH) { - break; - } - } - } - /* If the whole input has less than MIN_MATCH bytes, ins_h is garbage, - * but this is not important since only literal bytes will be emitted. - */ - - } while (s.lookahead < MIN_LOOKAHEAD && s.strm.avail_in !== 0); - - /* If the WIN_INIT bytes after the end of the current data have never been - * written, then zero those bytes in order to avoid memory check reports of - * the use of uninitialized (or uninitialised as Julian writes) bytes by - * the longest match routines. Update the high water mark for the next - * time through here. WIN_INIT is set to MAX_MATCH since the longest match - * routines allow scanning to strstart + MAX_MATCH, ignoring lookahead. - */ - // if (s.high_water < s.window_size) { - // var curr = s.strstart + s.lookahead; - // var init = 0; - // - // if (s.high_water < curr) { - // /* Previous high water mark below current data -- zero WIN_INIT - // * bytes or up to end of window, whichever is less. - // */ - // init = s.window_size - curr; - // if (init > WIN_INIT) - // init = WIN_INIT; - // zmemzero(s->window + curr, (unsigned)init); - // s->high_water = curr + init; - // } - // else if (s->high_water < (ulg)curr + WIN_INIT) { - // /* High water mark at or above current data, but below current data - // * plus WIN_INIT -- zero out to current data plus WIN_INIT, or up - // * to end of window, whichever is less. - // */ - // init = (ulg)curr + WIN_INIT - s->high_water; - // if (init > s->window_size - s->high_water) - // init = s->window_size - s->high_water; - // zmemzero(s->window + s->high_water, (unsigned)init); - // s->high_water += init; - // } - // } - // - // Assert((ulg)s->strstart <= s->window_size - MIN_LOOKAHEAD, - // "not enough room for search"); - } - - /* =========================================================================== - * Copy without compression as much as possible from the input stream, return - * the current block state. - * This function does not insert new strings in the dictionary since - * uncompressible data is probably not useful. This function is used - * only for the level=0 compression option. - * NOTE: this function should be optimized to avoid extra copying from - * window to pending_buf. - */ - function deflate_stored(s, flush) { - /* Stored blocks are limited to 0xffff bytes, pending_buf is limited - * to pending_buf_size, and each stored block has a 5 byte header: - */ - var max_block_size = 0xffff; - - if (max_block_size > s.pending_buf_size - 5) { - max_block_size = s.pending_buf_size - 5; - } - - /* Copy as much as possible from input to output: */ - for (;;) { - /* Fill the window as much as possible: */ - if (s.lookahead <= 1) { - - //Assert(s->strstart < s->w_size+MAX_DIST(s) || - // s->block_start >= (long)s->w_size, "slide too late"); - // if (!(s.strstart < s.w_size + (s.w_size - MIN_LOOKAHEAD) || - // s.block_start >= s.w_size)) { - // throw new Error("slide too late"); - // } - - fill_window(s); - if (s.lookahead === 0 && flush === Z_NO_FLUSH) { - return BS_NEED_MORE; - } - - if (s.lookahead === 0) { - break; - } - /* flush the current block */ - } - //Assert(s->block_start >= 0L, "block gone"); - // if (s.block_start < 0) throw new Error("block gone"); - - s.strstart += s.lookahead; - s.lookahead = 0; - - /* Emit a stored block if pending_buf will be full: */ - var max_start = s.block_start + max_block_size; - - if (s.strstart === 0 || s.strstart >= max_start) { - /* strstart == 0 is possible when wraparound on 16-bit machine */ - s.lookahead = s.strstart - max_start; - s.strstart = max_start; - /*** FLUSH_BLOCK(s, 0); ***/ - flush_block_only(s, false); - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - /***/ - - - } - /* Flush if we may have to slide, otherwise block_start may become - * negative and the data will be gone: - */ - if (s.strstart - s.block_start >= (s.w_size - MIN_LOOKAHEAD)) { - /*** FLUSH_BLOCK(s, 0); ***/ - flush_block_only(s, false); - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - /***/ - } - } - - s.insert = 0; - - if (flush === Z_FINISH) { - /*** FLUSH_BLOCK(s, 1); ***/ - flush_block_only(s, true); - if (s.strm.avail_out === 0) { - return BS_FINISH_STARTED; - } - /***/ - return BS_FINISH_DONE; - } - - if (s.strstart > s.block_start) { - /*** FLUSH_BLOCK(s, 0); ***/ - flush_block_only(s, false); - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - /***/ - } - - return BS_NEED_MORE; - } - - /* =========================================================================== - * Compress as much as possible from the input stream, return the current - * block state. - * This function does not perform lazy evaluation of matches and inserts - * new strings in the dictionary only for unmatched strings or for short - * matches. It is used only for the fast compression options. - */ - function deflate_fast(s, flush) { - var hash_head; /* head of the hash chain */ - var bflush; /* set if current block must be flushed */ - - for (;;) { - /* Make sure that we always have enough lookahead, except - * at the end of the input file. We need MAX_MATCH bytes - * for the next match, plus MIN_MATCH bytes to insert the - * string following the next match. - */ - if (s.lookahead < MIN_LOOKAHEAD) { - fill_window(s); - if (s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH) { - return BS_NEED_MORE; - } - if (s.lookahead === 0) { - break; /* flush the current block */ - } - } - - /* Insert the string window[strstart .. strstart+2] in the - * dictionary, and set hash_head to the head of the hash chain: - */ - hash_head = 0/*NIL*/; - if (s.lookahead >= MIN_MATCH) { - /*** INSERT_STRING(s, s.strstart, hash_head); ***/ - s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask; - hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h]; - s.head[s.ins_h] = s.strstart; - /***/ - } - - /* Find the longest match, discarding those <= prev_length. - * At this point we have always match_length < MIN_MATCH - */ - if (hash_head !== 0/*NIL*/ && ((s.strstart - hash_head) <= (s.w_size - MIN_LOOKAHEAD))) { - /* To simplify the code, we prevent matches with the string - * of window index 0 (in particular we have to avoid a match - * of the string with itself at the start of the input file). - */ - s.match_length = longest_match(s, hash_head); - /* longest_match() sets match_start */ - } - if (s.match_length >= MIN_MATCH) { - // check_match(s, s.strstart, s.match_start, s.match_length); // for debug only - - /*** _tr_tally_dist(s, s.strstart - s.match_start, - s.match_length - MIN_MATCH, bflush); ***/ - bflush = trees._tr_tally(s, s.strstart - s.match_start, s.match_length - MIN_MATCH); - - s.lookahead -= s.match_length; - - /* Insert new strings in the hash table only if the match length - * is not too large. This saves time but degrades compression. - */ - if (s.match_length <= s.max_lazy_match/*max_insert_length*/ && s.lookahead >= MIN_MATCH) { - s.match_length--; /* string at strstart already in table */ - do { - s.strstart++; - /*** INSERT_STRING(s, s.strstart, hash_head); ***/ - s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask; - hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h]; - s.head[s.ins_h] = s.strstart; - /***/ - /* strstart never exceeds WSIZE-MAX_MATCH, so there are - * always MIN_MATCH bytes ahead. - */ - } while (--s.match_length !== 0); - s.strstart++; - } else - { - s.strstart += s.match_length; - s.match_length = 0; - s.ins_h = s.window[s.strstart]; - /* UPDATE_HASH(s, s.ins_h, s.window[s.strstart+1]); */ - s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + 1]) & s.hash_mask; - - //#if MIN_MATCH != 3 - // Call UPDATE_HASH() MIN_MATCH-3 more times - //#endif - /* If lookahead < MIN_MATCH, ins_h is garbage, but it does not - * matter since it will be recomputed at next deflate call. - */ - } - } else { - /* No match, output a literal byte */ - //Tracevv((stderr,"%c", s.window[s.strstart])); - /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/ - bflush = trees._tr_tally(s, 0, s.window[s.strstart]); - - s.lookahead--; - s.strstart++; - } - if (bflush) { - /*** FLUSH_BLOCK(s, 0); ***/ - flush_block_only(s, false); - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - /***/ - } - } - s.insert = ((s.strstart < (MIN_MATCH - 1)) ? s.strstart : MIN_MATCH - 1); - if (flush === Z_FINISH) { - /*** FLUSH_BLOCK(s, 1); ***/ - flush_block_only(s, true); - if (s.strm.avail_out === 0) { - return BS_FINISH_STARTED; - } - /***/ - return BS_FINISH_DONE; - } - if (s.last_lit) { - /*** FLUSH_BLOCK(s, 0); ***/ - flush_block_only(s, false); - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - /***/ - } - return BS_BLOCK_DONE; - } - - /* =========================================================================== - * Same as above, but achieves better compression. We use a lazy - * evaluation for matches: a match is finally adopted only if there is - * no better match at the next window position. - */ - function deflate_slow(s, flush) { - var hash_head; /* head of hash chain */ - var bflush; /* set if current block must be flushed */ - - var max_insert; - - /* Process the input block. */ - for (;;) { - /* Make sure that we always have enough lookahead, except - * at the end of the input file. We need MAX_MATCH bytes - * for the next match, plus MIN_MATCH bytes to insert the - * string following the next match. - */ - if (s.lookahead < MIN_LOOKAHEAD) { - fill_window(s); - if (s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH) { - return BS_NEED_MORE; - } - if (s.lookahead === 0) { break; } /* flush the current block */ - } - - /* Insert the string window[strstart .. strstart+2] in the - * dictionary, and set hash_head to the head of the hash chain: - */ - hash_head = 0/*NIL*/; - if (s.lookahead >= MIN_MATCH) { - /*** INSERT_STRING(s, s.strstart, hash_head); ***/ - s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask; - hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h]; - s.head[s.ins_h] = s.strstart; - /***/ - } - - /* Find the longest match, discarding those <= prev_length. - */ - s.prev_length = s.match_length; - s.prev_match = s.match_start; - s.match_length = MIN_MATCH - 1; - - if (hash_head !== 0/*NIL*/ && s.prev_length < s.max_lazy_match && - s.strstart - hash_head <= (s.w_size - MIN_LOOKAHEAD)/*MAX_DIST(s)*/) { - /* To simplify the code, we prevent matches with the string - * of window index 0 (in particular we have to avoid a match - * of the string with itself at the start of the input file). - */ - s.match_length = longest_match(s, hash_head); - /* longest_match() sets match_start */ - - if (s.match_length <= 5 && - (s.strategy === Z_FILTERED || (s.match_length === MIN_MATCH && s.strstart - s.match_start > 4096/*TOO_FAR*/))) { - - /* If prev_match is also MIN_MATCH, match_start is garbage - * but we will ignore the current match anyway. - */ - s.match_length = MIN_MATCH - 1; - } - } - /* If there was a match at the previous step and the current - * match is not better, output the previous match: - */ - if (s.prev_length >= MIN_MATCH && s.match_length <= s.prev_length) { - max_insert = s.strstart + s.lookahead - MIN_MATCH; - /* Do not insert strings in hash table beyond this. */ - - //check_match(s, s.strstart-1, s.prev_match, s.prev_length); - - /***_tr_tally_dist(s, s.strstart - 1 - s.prev_match, - s.prev_length - MIN_MATCH, bflush);***/ - bflush = trees._tr_tally(s, s.strstart - 1 - s.prev_match, s.prev_length - MIN_MATCH); - /* Insert in hash table all strings up to the end of the match. - * strstart-1 and strstart are already inserted. If there is not - * enough lookahead, the last two strings are not inserted in - * the hash table. - */ - s.lookahead -= s.prev_length - 1; - s.prev_length -= 2; - do { - if (++s.strstart <= max_insert) { - /*** INSERT_STRING(s, s.strstart, hash_head); ***/ - s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask; - hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h]; - s.head[s.ins_h] = s.strstart; - /***/ - } - } while (--s.prev_length !== 0); - s.match_available = 0; - s.match_length = MIN_MATCH - 1; - s.strstart++; - - if (bflush) { - /*** FLUSH_BLOCK(s, 0); ***/ - flush_block_only(s, false); - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - /***/ - } - - } else if (s.match_available) { - /* If there was no match at the previous position, output a - * single literal. If there was a match but the current match - * is longer, truncate the previous match to a single literal. - */ - //Tracevv((stderr,"%c", s->window[s->strstart-1])); - /*** _tr_tally_lit(s, s.window[s.strstart-1], bflush); ***/ - bflush = trees._tr_tally(s, 0, s.window[s.strstart - 1]); - - if (bflush) { - /*** FLUSH_BLOCK_ONLY(s, 0) ***/ - flush_block_only(s, false); - /***/ - } - s.strstart++; - s.lookahead--; - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - } else { - /* There is no previous match to compare with, wait for - * the next step to decide. - */ - s.match_available = 1; - s.strstart++; - s.lookahead--; - } - } - //Assert (flush != Z_NO_FLUSH, "no flush?"); - if (s.match_available) { - //Tracevv((stderr,"%c", s->window[s->strstart-1])); - /*** _tr_tally_lit(s, s.window[s.strstart-1], bflush); ***/ - bflush = trees._tr_tally(s, 0, s.window[s.strstart - 1]); - - s.match_available = 0; - } - s.insert = s.strstart < MIN_MATCH - 1 ? s.strstart : MIN_MATCH - 1; - if (flush === Z_FINISH) { - /*** FLUSH_BLOCK(s, 1); ***/ - flush_block_only(s, true); - if (s.strm.avail_out === 0) { - return BS_FINISH_STARTED; - } - /***/ - return BS_FINISH_DONE; - } - if (s.last_lit) { - /*** FLUSH_BLOCK(s, 0); ***/ - flush_block_only(s, false); - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - /***/ - } - - return BS_BLOCK_DONE; - } - - - /* =========================================================================== - * For Z_RLE, simply look for runs of bytes, generate matches only of distance - * one. Do not maintain a hash table. (It will be regenerated if this run of - * deflate switches away from Z_RLE.) - */ - function deflate_rle(s, flush) { - var bflush; /* set if current block must be flushed */ - var prev; /* byte at distance one to match */ - var scan, strend; /* scan goes up to strend for length of run */ - - var _win = s.window; - - for (;;) { - /* Make sure that we always have enough lookahead, except - * at the end of the input file. We need MAX_MATCH bytes - * for the longest run, plus one for the unrolled loop. - */ - if (s.lookahead <= MAX_MATCH) { - fill_window(s); - if (s.lookahead <= MAX_MATCH && flush === Z_NO_FLUSH) { - return BS_NEED_MORE; - } - if (s.lookahead === 0) { break; } /* flush the current block */ - } - - /* See how many times the previous byte repeats */ - s.match_length = 0; - if (s.lookahead >= MIN_MATCH && s.strstart > 0) { - scan = s.strstart - 1; - prev = _win[scan]; - if (prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan]) { - strend = s.strstart + MAX_MATCH; - do { - /*jshint noempty:false*/ - } while (prev === _win[++scan] && prev === _win[++scan] && - prev === _win[++scan] && prev === _win[++scan] && - prev === _win[++scan] && prev === _win[++scan] && - prev === _win[++scan] && prev === _win[++scan] && - scan < strend); - s.match_length = MAX_MATCH - (strend - scan); - if (s.match_length > s.lookahead) { - s.match_length = s.lookahead; - } - } - //Assert(scan <= s->window+(uInt)(s->window_size-1), "wild scan"); - } - - /* Emit match if have run of MIN_MATCH or longer, else emit literal */ - if (s.match_length >= MIN_MATCH) { - //check_match(s, s.strstart, s.strstart - 1, s.match_length); - - /*** _tr_tally_dist(s, 1, s.match_length - MIN_MATCH, bflush); ***/ - bflush = trees._tr_tally(s, 1, s.match_length - MIN_MATCH); - - s.lookahead -= s.match_length; - s.strstart += s.match_length; - s.match_length = 0; - } else { - /* No match, output a literal byte */ - //Tracevv((stderr,"%c", s->window[s->strstart])); - /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/ - bflush = trees._tr_tally(s, 0, s.window[s.strstart]); - - s.lookahead--; - s.strstart++; - } - if (bflush) { - /*** FLUSH_BLOCK(s, 0); ***/ - flush_block_only(s, false); - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - /***/ - } - } - s.insert = 0; - if (flush === Z_FINISH) { - /*** FLUSH_BLOCK(s, 1); ***/ - flush_block_only(s, true); - if (s.strm.avail_out === 0) { - return BS_FINISH_STARTED; - } - /***/ - return BS_FINISH_DONE; - } - if (s.last_lit) { - /*** FLUSH_BLOCK(s, 0); ***/ - flush_block_only(s, false); - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - /***/ - } - return BS_BLOCK_DONE; - } - - /* =========================================================================== - * For Z_HUFFMAN_ONLY, do not look for matches. Do not maintain a hash table. - * (It will be regenerated if this run of deflate switches away from Huffman.) - */ - function deflate_huff(s, flush) { - var bflush; /* set if current block must be flushed */ - - for (;;) { - /* Make sure that we have a literal to write. */ - if (s.lookahead === 0) { - fill_window(s); - if (s.lookahead === 0) { - if (flush === Z_NO_FLUSH) { - return BS_NEED_MORE; - } - break; /* flush the current block */ - } - } - - /* Output a literal byte */ - s.match_length = 0; - //Tracevv((stderr,"%c", s->window[s->strstart])); - /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/ - bflush = trees._tr_tally(s, 0, s.window[s.strstart]); - s.lookahead--; - s.strstart++; - if (bflush) { - /*** FLUSH_BLOCK(s, 0); ***/ - flush_block_only(s, false); - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - /***/ - } - } - s.insert = 0; - if (flush === Z_FINISH) { - /*** FLUSH_BLOCK(s, 1); ***/ - flush_block_only(s, true); - if (s.strm.avail_out === 0) { - return BS_FINISH_STARTED; - } - /***/ - return BS_FINISH_DONE; - } - if (s.last_lit) { - /*** FLUSH_BLOCK(s, 0); ***/ - flush_block_only(s, false); - if (s.strm.avail_out === 0) { - return BS_NEED_MORE; - } - /***/ - } - return BS_BLOCK_DONE; - } - - /* Values for max_lazy_match, good_match and max_chain_length, depending on - * the desired pack level (0..9). The values given below have been tuned to - * exclude worst case performance for pathological files. Better values may be - * found for specific files. - */ - function Config(good_length, max_lazy, nice_length, max_chain, func) { - this.good_length = good_length; - this.max_lazy = max_lazy; - this.nice_length = nice_length; - this.max_chain = max_chain; - this.func = func; - } - - var configuration_table; - - configuration_table = [ - /* good lazy nice chain */ - new Config(0, 0, 0, 0, deflate_stored), /* 0 store only */ - new Config(4, 4, 8, 4, deflate_fast), /* 1 max speed, no lazy matches */ - new Config(4, 5, 16, 8, deflate_fast), /* 2 */ - new Config(4, 6, 32, 32, deflate_fast), /* 3 */ - - new Config(4, 4, 16, 16, deflate_slow), /* 4 lazy matches */ - new Config(8, 16, 32, 32, deflate_slow), /* 5 */ - new Config(8, 16, 128, 128, deflate_slow), /* 6 */ - new Config(8, 32, 128, 256, deflate_slow), /* 7 */ - new Config(32, 128, 258, 1024, deflate_slow), /* 8 */ - new Config(32, 258, 258, 4096, deflate_slow) /* 9 max compression */ - ]; - - - /* =========================================================================== - * Initialize the "longest match" routines for a new zlib stream - */ - function lm_init(s) { - s.window_size = 2 * s.w_size; - - /*** CLEAR_HASH(s); ***/ - zero(s.head); // Fill with NIL (= 0); - - /* Set the default configuration parameters: - */ - s.max_lazy_match = configuration_table[s.level].max_lazy; - s.good_match = configuration_table[s.level].good_length; - s.nice_match = configuration_table[s.level].nice_length; - s.max_chain_length = configuration_table[s.level].max_chain; - - s.strstart = 0; - s.block_start = 0; - s.lookahead = 0; - s.insert = 0; - s.match_length = s.prev_length = MIN_MATCH - 1; - s.match_available = 0; - s.ins_h = 0; - } - - - function DeflateState() { - this.strm = null; /* pointer back to this zlib stream */ - this.status = 0; /* as the name implies */ - this.pending_buf = null; /* output still pending */ - this.pending_buf_size = 0; /* size of pending_buf */ - this.pending_out = 0; /* next pending byte to output to the stream */ - this.pending = 0; /* nb of bytes in the pending buffer */ - this.wrap = 0; /* bit 0 true for zlib, bit 1 true for gzip */ - this.gzhead = null; /* gzip header information to write */ - this.gzindex = 0; /* where in extra, name, or comment */ - this.method = Z_DEFLATED; /* can only be DEFLATED */ - this.last_flush = -1; /* value of flush param for previous deflate call */ - - this.w_size = 0; /* LZ77 window size (32K by default) */ - this.w_bits = 0; /* log2(w_size) (8..16) */ - this.w_mask = 0; /* w_size - 1 */ - - this.window = null; - /* Sliding window. Input bytes are read into the second half of the window, - * and move to the first half later to keep a dictionary of at least wSize - * bytes. With this organization, matches are limited to a distance of - * wSize-MAX_MATCH bytes, but this ensures that IO is always - * performed with a length multiple of the block size. - */ - - this.window_size = 0; - /* Actual size of window: 2*wSize, except when the user input buffer - * is directly used as sliding window. - */ - - this.prev = null; - /* Link to older string with same hash index. To limit the size of this - * array to 64K, this link is maintained only for the last 32K strings. - * An index in this array is thus a window index modulo 32K. - */ - - this.head = null; /* Heads of the hash chains or NIL. */ - - this.ins_h = 0; /* hash index of string to be inserted */ - this.hash_size = 0; /* number of elements in hash table */ - this.hash_bits = 0; /* log2(hash_size) */ - this.hash_mask = 0; /* hash_size-1 */ - - this.hash_shift = 0; - /* Number of bits by which ins_h must be shifted at each input - * step. It must be such that after MIN_MATCH steps, the oldest - * byte no longer takes part in the hash key, that is: - * hash_shift * MIN_MATCH >= hash_bits - */ - - this.block_start = 0; - /* Window position at the beginning of the current output block. Gets - * negative when the window is moved backwards. - */ - - this.match_length = 0; /* length of best match */ - this.prev_match = 0; /* previous match */ - this.match_available = 0; /* set if previous match exists */ - this.strstart = 0; /* start of string to insert */ - this.match_start = 0; /* start of matching string */ - this.lookahead = 0; /* number of valid bytes ahead in window */ - - this.prev_length = 0; - /* Length of the best match at previous step. Matches not greater than this - * are discarded. This is used in the lazy match evaluation. - */ - - this.max_chain_length = 0; - /* To speed up deflation, hash chains are never searched beyond this - * length. A higher limit improves compression ratio but degrades the - * speed. - */ - - this.max_lazy_match = 0; - /* Attempt to find a better match only when the current match is strictly - * smaller than this value. This mechanism is used only for compression - * levels >= 4. - */ - // That's alias to max_lazy_match, don't use directly - //this.max_insert_length = 0; - /* Insert new strings in the hash table only if the match length is not - * greater than this length. This saves time but degrades compression. - * max_insert_length is used only for compression levels <= 3. - */ - - this.level = 0; /* compression level (1..9) */ - this.strategy = 0; /* favor or force Huffman coding*/ - - this.good_match = 0; - /* Use a faster search when the previous match is longer than this */ - - this.nice_match = 0; /* Stop searching when current match exceeds this */ - - /* used by trees.c: */ - - /* Didn't use ct_data typedef below to suppress compiler warning */ - - // struct ct_data_s dyn_ltree[HEAP_SIZE]; /* literal and length tree */ - // struct ct_data_s dyn_dtree[2*D_CODES+1]; /* distance tree */ - // struct ct_data_s bl_tree[2*BL_CODES+1]; /* Huffman tree for bit lengths */ - - // Use flat array of DOUBLE size, with interleaved fata, - // because JS does not support effective - this.dyn_ltree = new utils.Buf16(HEAP_SIZE * 2); - this.dyn_dtree = new utils.Buf16((2 * D_CODES + 1) * 2); - this.bl_tree = new utils.Buf16((2 * BL_CODES + 1) * 2); - zero(this.dyn_ltree); - zero(this.dyn_dtree); - zero(this.bl_tree); - - this.l_desc = null; /* desc. for literal tree */ - this.d_desc = null; /* desc. for distance tree */ - this.bl_desc = null; /* desc. for bit length tree */ - - //ush bl_count[MAX_BITS+1]; - this.bl_count = new utils.Buf16(MAX_BITS + 1); - /* number of codes at each bit length for an optimal tree */ - - //int heap[2*L_CODES+1]; /* heap used to build the Huffman trees */ - this.heap = new utils.Buf16(2 * L_CODES + 1); /* heap used to build the Huffman trees */ - zero(this.heap); - - this.heap_len = 0; /* number of elements in the heap */ - this.heap_max = 0; /* element of largest frequency */ - /* The sons of heap[n] are heap[2*n] and heap[2*n+1]. heap[0] is not used. - * The same heap array is used to build all trees. - */ - - this.depth = new utils.Buf16(2 * L_CODES + 1); //uch depth[2*L_CODES+1]; - zero(this.depth); - /* Depth of each subtree used as tie breaker for trees of equal frequency - */ - - this.l_buf = 0; /* buffer index for literals or lengths */ - - this.lit_bufsize = 0; - /* Size of match buffer for literals/lengths. There are 4 reasons for - * limiting lit_bufsize to 64K: - * - frequencies can be kept in 16 bit counters - * - if compression is not successful for the first block, all input - * data is still in the window so we can still emit a stored block even - * when input comes from standard input. (This can also be done for - * all blocks if lit_bufsize is not greater than 32K.) - * - if compression is not successful for a file smaller than 64K, we can - * even emit a stored file instead of a stored block (saving 5 bytes). - * This is applicable only for zip (not gzip or zlib). - * - creating new Huffman trees less frequently may not provide fast - * adaptation to changes in the input data statistics. (Take for - * example a binary file with poorly compressible code followed by - * a highly compressible string table.) Smaller buffer sizes give - * fast adaptation but have of course the overhead of transmitting - * trees more frequently. - * - I can't count above 4 - */ - - this.last_lit = 0; /* running index in l_buf */ - - this.d_buf = 0; - /* Buffer index for distances. To simplify the code, d_buf and l_buf have - * the same number of elements. To use different lengths, an extra flag - * array would be necessary. - */ - - this.opt_len = 0; /* bit length of current block with optimal trees */ - this.static_len = 0; /* bit length of current block with static trees */ - this.matches = 0; /* number of string matches in current block */ - this.insert = 0; /* bytes at end of window left to insert */ - - - this.bi_buf = 0; - /* Output buffer. bits are inserted starting at the bottom (least - * significant bits). - */ - this.bi_valid = 0; - /* Number of valid bits in bi_buf. All bits above the last valid bit - * are always zero. - */ - - // Used for window memory init. We safely ignore it for JS. That makes - // sense only for pointers and memory check tools. - //this.high_water = 0; - /* High water mark offset in window for initialized bytes -- bytes above - * this are set to zero in order to avoid memory check warnings when - * longest match routines access bytes past the input. This is then - * updated to the new high water mark. - */ - } - - - function deflateResetKeep(strm) { - var s; - - if (!strm || !strm.state) { - return err(strm, Z_STREAM_ERROR); - } - - strm.total_in = strm.total_out = 0; - strm.data_type = Z_UNKNOWN; - - s = strm.state; - s.pending = 0; - s.pending_out = 0; - - if (s.wrap < 0) { - s.wrap = -s.wrap; - /* was made negative by deflate(..., Z_FINISH); */ - } - s.status = (s.wrap ? INIT_STATE : BUSY_STATE); - strm.adler = (s.wrap === 2) ? - 0 // crc32(0, Z_NULL, 0) - : - 1; // adler32(0, Z_NULL, 0) - s.last_flush = Z_NO_FLUSH; - trees._tr_init(s); - return Z_OK; - } - - - function deflateReset(strm) { - var ret = deflateResetKeep(strm); - if (ret === Z_OK) { - lm_init(strm.state); - } - return ret; - } - - - function deflateSetHeader(strm, head) { - if (!strm || !strm.state) { return Z_STREAM_ERROR; } - if (strm.state.wrap !== 2) { return Z_STREAM_ERROR; } - strm.state.gzhead = head; - return Z_OK; - } - - - function deflateInit2(strm, level, method, windowBits, memLevel, strategy) { - if (!strm) { // === Z_NULL - return Z_STREAM_ERROR; - } - var wrap = 1; - - if (level === Z_DEFAULT_COMPRESSION) { - level = 6; - } - - if (windowBits < 0) { /* suppress zlib wrapper */ - wrap = 0; - windowBits = -windowBits; - } - - else if (windowBits > 15) { - wrap = 2; /* write gzip wrapper instead */ - windowBits -= 16; - } - - - if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method !== Z_DEFLATED || - windowBits < 8 || windowBits > 15 || level < 0 || level > 9 || - strategy < 0 || strategy > Z_FIXED) { - return err(strm, Z_STREAM_ERROR); - } - - - if (windowBits === 8) { - windowBits = 9; - } - /* until 256-byte window bug fixed */ - - var s = new DeflateState(); - - strm.state = s; - s.strm = strm; - - s.wrap = wrap; - s.gzhead = null; - s.w_bits = windowBits; - s.w_size = 1 << s.w_bits; - s.w_mask = s.w_size - 1; - - s.hash_bits = memLevel + 7; - s.hash_size = 1 << s.hash_bits; - s.hash_mask = s.hash_size - 1; - s.hash_shift = ~~((s.hash_bits + MIN_MATCH - 1) / MIN_MATCH); - - s.window = new utils.Buf8(s.w_size * 2); - s.head = new utils.Buf16(s.hash_size); - s.prev = new utils.Buf16(s.w_size); - - // Don't need mem init magic for JS. - //s.high_water = 0; /* nothing written to s->window yet */ - - s.lit_bufsize = 1 << (memLevel + 6); /* 16K elements by default */ - - s.pending_buf_size = s.lit_bufsize * 4; - - //overlay = (ushf *) ZALLOC(strm, s->lit_bufsize, sizeof(ush)+2); - //s->pending_buf = (uchf *) overlay; - s.pending_buf = new utils.Buf8(s.pending_buf_size); - - // It is offset from `s.pending_buf` (size is `s.lit_bufsize * 2`) - //s->d_buf = overlay + s->lit_bufsize/sizeof(ush); - s.d_buf = 1 * s.lit_bufsize; - - //s->l_buf = s->pending_buf + (1+sizeof(ush))*s->lit_bufsize; - s.l_buf = (1 + 2) * s.lit_bufsize; - - s.level = level; - s.strategy = strategy; - s.method = method; - - return deflateReset(strm); - } - - function deflateInit(strm, level) { - return deflateInit2(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY); - } - - - function deflate(strm, flush) { - var old_flush, s; - var beg, val; // for gzip header write only - - if (!strm || !strm.state || - flush > Z_BLOCK || flush < 0) { - return strm ? err(strm, Z_STREAM_ERROR) : Z_STREAM_ERROR; - } - - s = strm.state; - - if (!strm.output || - (!strm.input && strm.avail_in !== 0) || - (s.status === FINISH_STATE && flush !== Z_FINISH)) { - return err(strm, (strm.avail_out === 0) ? Z_BUF_ERROR : Z_STREAM_ERROR); - } - - s.strm = strm; /* just in case */ - old_flush = s.last_flush; - s.last_flush = flush; - - /* Write the header */ - if (s.status === INIT_STATE) { - - if (s.wrap === 2) { // GZIP header - strm.adler = 0; //crc32(0L, Z_NULL, 0); - put_byte(s, 31); - put_byte(s, 139); - put_byte(s, 8); - if (!s.gzhead) { // s->gzhead == Z_NULL - put_byte(s, 0); - put_byte(s, 0); - put_byte(s, 0); - put_byte(s, 0); - put_byte(s, 0); - put_byte(s, s.level === 9 ? 2 : - (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ? - 4 : 0)); - put_byte(s, OS_CODE); - s.status = BUSY_STATE; - } - else { - put_byte(s, (s.gzhead.text ? 1 : 0) + - (s.gzhead.hcrc ? 2 : 0) + - (!s.gzhead.extra ? 0 : 4) + - (!s.gzhead.name ? 0 : 8) + - (!s.gzhead.comment ? 0 : 16) - ); - put_byte(s, s.gzhead.time & 0xff); - put_byte(s, (s.gzhead.time >> 8) & 0xff); - put_byte(s, (s.gzhead.time >> 16) & 0xff); - put_byte(s, (s.gzhead.time >> 24) & 0xff); - put_byte(s, s.level === 9 ? 2 : - (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ? - 4 : 0)); - put_byte(s, s.gzhead.os & 0xff); - if (s.gzhead.extra && s.gzhead.extra.length) { - put_byte(s, s.gzhead.extra.length & 0xff); - put_byte(s, (s.gzhead.extra.length >> 8) & 0xff); - } - if (s.gzhead.hcrc) { - strm.adler = crc32(strm.adler, s.pending_buf, s.pending, 0); - } - s.gzindex = 0; - s.status = EXTRA_STATE; - } - } - else // DEFLATE header - { - var header = (Z_DEFLATED + ((s.w_bits - 8) << 4)) << 8; - var level_flags = -1; - - if (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2) { - level_flags = 0; - } else if (s.level < 6) { - level_flags = 1; - } else if (s.level === 6) { - level_flags = 2; - } else { - level_flags = 3; - } - header |= (level_flags << 6); - if (s.strstart !== 0) { header |= PRESET_DICT; } - header += 31 - (header % 31); - - s.status = BUSY_STATE; - putShortMSB(s, header); - - /* Save the adler32 of the preset dictionary: */ - if (s.strstart !== 0) { - putShortMSB(s, strm.adler >>> 16); - putShortMSB(s, strm.adler & 0xffff); - } - strm.adler = 1; // adler32(0L, Z_NULL, 0); - } - } - - //#ifdef GZIP - if (s.status === EXTRA_STATE) { - if (s.gzhead.extra/* != Z_NULL*/) { - beg = s.pending; /* start of bytes to update crc */ - - while (s.gzindex < (s.gzhead.extra.length & 0xffff)) { - if (s.pending === s.pending_buf_size) { - if (s.gzhead.hcrc && s.pending > beg) { - strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); - } - flush_pending(strm); - beg = s.pending; - if (s.pending === s.pending_buf_size) { - break; - } - } - put_byte(s, s.gzhead.extra[s.gzindex] & 0xff); - s.gzindex++; - } - if (s.gzhead.hcrc && s.pending > beg) { - strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); - } - if (s.gzindex === s.gzhead.extra.length) { - s.gzindex = 0; - s.status = NAME_STATE; - } - } - else { - s.status = NAME_STATE; - } - } - if (s.status === NAME_STATE) { - if (s.gzhead.name/* != Z_NULL*/) { - beg = s.pending; /* start of bytes to update crc */ - //int val; - - do { - if (s.pending === s.pending_buf_size) { - if (s.gzhead.hcrc && s.pending > beg) { - strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); - } - flush_pending(strm); - beg = s.pending; - if (s.pending === s.pending_buf_size) { - val = 1; - break; - } - } - // JS specific: little magic to add zero terminator to end of string - if (s.gzindex < s.gzhead.name.length) { - val = s.gzhead.name.charCodeAt(s.gzindex++) & 0xff; - } else { - val = 0; - } - put_byte(s, val); - } while (val !== 0); - - if (s.gzhead.hcrc && s.pending > beg) { - strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); - } - if (val === 0) { - s.gzindex = 0; - s.status = COMMENT_STATE; - } - } - else { - s.status = COMMENT_STATE; - } - } - if (s.status === COMMENT_STATE) { - if (s.gzhead.comment/* != Z_NULL*/) { - beg = s.pending; /* start of bytes to update crc */ - //int val; - - do { - if (s.pending === s.pending_buf_size) { - if (s.gzhead.hcrc && s.pending > beg) { - strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); - } - flush_pending(strm); - beg = s.pending; - if (s.pending === s.pending_buf_size) { - val = 1; - break; - } - } - // JS specific: little magic to add zero terminator to end of string - if (s.gzindex < s.gzhead.comment.length) { - val = s.gzhead.comment.charCodeAt(s.gzindex++) & 0xff; - } else { - val = 0; - } - put_byte(s, val); - } while (val !== 0); - - if (s.gzhead.hcrc && s.pending > beg) { - strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); - } - if (val === 0) { - s.status = HCRC_STATE; - } - } - else { - s.status = HCRC_STATE; - } - } - if (s.status === HCRC_STATE) { - if (s.gzhead.hcrc) { - if (s.pending + 2 > s.pending_buf_size) { - flush_pending(strm); - } - if (s.pending + 2 <= s.pending_buf_size) { - put_byte(s, strm.adler & 0xff); - put_byte(s, (strm.adler >> 8) & 0xff); - strm.adler = 0; //crc32(0L, Z_NULL, 0); - s.status = BUSY_STATE; - } - } - else { - s.status = BUSY_STATE; - } - } - //#endif - - /* Flush as much pending output as possible */ - if (s.pending !== 0) { - flush_pending(strm); - if (strm.avail_out === 0) { - /* Since avail_out is 0, deflate will be called again with - * more output space, but possibly with both pending and - * avail_in equal to zero. There won't be anything to do, - * but this is not an error situation so make sure we - * return OK instead of BUF_ERROR at next call of deflate: - */ - s.last_flush = -1; - return Z_OK; - } - - /* Make sure there is something to do and avoid duplicate consecutive - * flushes. For repeated and useless calls with Z_FINISH, we keep - * returning Z_STREAM_END instead of Z_BUF_ERROR. - */ - } else if (strm.avail_in === 0 && rank(flush) <= rank(old_flush) && - flush !== Z_FINISH) { - return err(strm, Z_BUF_ERROR); - } - - /* User must not provide more input after the first FINISH: */ - if (s.status === FINISH_STATE && strm.avail_in !== 0) { - return err(strm, Z_BUF_ERROR); - } - - /* Start a new block or continue the current one. - */ - if (strm.avail_in !== 0 || s.lookahead !== 0 || - (flush !== Z_NO_FLUSH && s.status !== FINISH_STATE)) { - var bstate = (s.strategy === Z_HUFFMAN_ONLY) ? deflate_huff(s, flush) : - (s.strategy === Z_RLE ? deflate_rle(s, flush) : - configuration_table[s.level].func(s, flush)); - - if (bstate === BS_FINISH_STARTED || bstate === BS_FINISH_DONE) { - s.status = FINISH_STATE; - } - if (bstate === BS_NEED_MORE || bstate === BS_FINISH_STARTED) { - if (strm.avail_out === 0) { - s.last_flush = -1; - /* avoid BUF_ERROR next call, see above */ - } - return Z_OK; - /* If flush != Z_NO_FLUSH && avail_out == 0, the next call - * of deflate should use the same flush parameter to make sure - * that the flush is complete. So we don't have to output an - * empty block here, this will be done at next call. This also - * ensures that for a very small output buffer, we emit at most - * one empty block. - */ - } - if (bstate === BS_BLOCK_DONE) { - if (flush === Z_PARTIAL_FLUSH) { - trees._tr_align(s); - } - else if (flush !== Z_BLOCK) { /* FULL_FLUSH or SYNC_FLUSH */ - - trees._tr_stored_block(s, 0, 0, false); - /* For a full flush, this empty block will be recognized - * as a special marker by inflate_sync(). - */ - if (flush === Z_FULL_FLUSH) { - /*** CLEAR_HASH(s); ***/ /* forget history */ - zero(s.head); // Fill with NIL (= 0); - - if (s.lookahead === 0) { - s.strstart = 0; - s.block_start = 0; - s.insert = 0; - } - } - } - flush_pending(strm); - if (strm.avail_out === 0) { - s.last_flush = -1; /* avoid BUF_ERROR at next call, see above */ - return Z_OK; - } - } - } - //Assert(strm->avail_out > 0, "bug2"); - //if (strm.avail_out <= 0) { throw new Error("bug2");} - - if (flush !== Z_FINISH) { return Z_OK; } - if (s.wrap <= 0) { return Z_STREAM_END; } - - /* Write the trailer */ - if (s.wrap === 2) { - put_byte(s, strm.adler & 0xff); - put_byte(s, (strm.adler >> 8) & 0xff); - put_byte(s, (strm.adler >> 16) & 0xff); - put_byte(s, (strm.adler >> 24) & 0xff); - put_byte(s, strm.total_in & 0xff); - put_byte(s, (strm.total_in >> 8) & 0xff); - put_byte(s, (strm.total_in >> 16) & 0xff); - put_byte(s, (strm.total_in >> 24) & 0xff); - } - else - { - putShortMSB(s, strm.adler >>> 16); - putShortMSB(s, strm.adler & 0xffff); - } - - flush_pending(strm); - /* If avail_out is zero, the application will call deflate again - * to flush the rest. - */ - if (s.wrap > 0) { s.wrap = -s.wrap; } - /* write the trailer only once! */ - return s.pending !== 0 ? Z_OK : Z_STREAM_END; - } - - function deflateEnd(strm) { - var status; - - if (!strm/*== Z_NULL*/ || !strm.state/*== Z_NULL*/) { - return Z_STREAM_ERROR; - } - - status = strm.state.status; - if (status !== INIT_STATE && - status !== EXTRA_STATE && - status !== NAME_STATE && - status !== COMMENT_STATE && - status !== HCRC_STATE && - status !== BUSY_STATE && - status !== FINISH_STATE - ) { - return err(strm, Z_STREAM_ERROR); - } - - strm.state = null; - - return status === BUSY_STATE ? err(strm, Z_DATA_ERROR) : Z_OK; - } - - - /* ========================================================================= - * Initializes the compression dictionary from the given byte - * sequence without producing any compressed output. - */ - function deflateSetDictionary(strm, dictionary) { - var dictLength = dictionary.length; - - var s; - var str, n; - var wrap; - var avail; - var next; - var input; - var tmpDict; - - if (!strm/*== Z_NULL*/ || !strm.state/*== Z_NULL*/) { - return Z_STREAM_ERROR; - } - - s = strm.state; - wrap = s.wrap; - - if (wrap === 2 || (wrap === 1 && s.status !== INIT_STATE) || s.lookahead) { - return Z_STREAM_ERROR; - } - - /* when using zlib wrappers, compute Adler-32 for provided dictionary */ - if (wrap === 1) { - /* adler32(strm->adler, dictionary, dictLength); */ - strm.adler = adler32(strm.adler, dictionary, dictLength, 0); - } - - s.wrap = 0; /* avoid computing Adler-32 in read_buf */ - - /* if dictionary would fill window, just replace the history */ - if (dictLength >= s.w_size) { - if (wrap === 0) { /* already empty otherwise */ - /*** CLEAR_HASH(s); ***/ - zero(s.head); // Fill with NIL (= 0); - s.strstart = 0; - s.block_start = 0; - s.insert = 0; - } - /* use the tail */ - // dictionary = dictionary.slice(dictLength - s.w_size); - tmpDict = new utils.Buf8(s.w_size); - utils.arraySet(tmpDict, dictionary, dictLength - s.w_size, s.w_size, 0); - dictionary = tmpDict; - dictLength = s.w_size; - } - /* insert dictionary into window and hash */ - avail = strm.avail_in; - next = strm.next_in; - input = strm.input; - strm.avail_in = dictLength; - strm.next_in = 0; - strm.input = dictionary; - fill_window(s); - while (s.lookahead >= MIN_MATCH) { - str = s.strstart; - n = s.lookahead - (MIN_MATCH - 1); - do { - /* UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]); */ - s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + MIN_MATCH - 1]) & s.hash_mask; - - s.prev[str & s.w_mask] = s.head[s.ins_h]; - - s.head[s.ins_h] = str; - str++; - } while (--n); - s.strstart = str; - s.lookahead = MIN_MATCH - 1; - fill_window(s); - } - s.strstart += s.lookahead; - s.block_start = s.strstart; - s.insert = s.lookahead; - s.lookahead = 0; - s.match_length = s.prev_length = MIN_MATCH - 1; - s.match_available = 0; - strm.next_in = next; - strm.input = input; - strm.avail_in = avail; - s.wrap = wrap; - return Z_OK; - } - - - exports.deflateInit = deflateInit; - exports.deflateInit2 = deflateInit2; - exports.deflateReset = deflateReset; - exports.deflateResetKeep = deflateResetKeep; - exports.deflateSetHeader = deflateSetHeader; - exports.deflate = deflate; - exports.deflateEnd = deflateEnd; - exports.deflateSetDictionary = deflateSetDictionary; - exports.deflateInfo = 'pako deflate (from Nodeca project)'; - - /* Not implemented - exports.deflateBound = deflateBound; - exports.deflateCopy = deflateCopy; - exports.deflateParams = deflateParams; - exports.deflatePending = deflatePending; - exports.deflatePrime = deflatePrime; - exports.deflateTune = deflateTune; - */ +const User = __webpack_require__(11); +const Collection = __webpack_require__(6); + +/** + * Represents the logged in client's Discord user + * @extends {User} + */ +class ClientUser extends User { + setup(data) { + super.setup(data); + + /** + * Whether or not this account has been verified + * @type {boolean} + */ + this.verified = data.verified; + + /** + * The email of this account + * @type {string} + */ + this.email = data.email; + this.localPresence = {}; + this._typing = new Map(); + + /** + * A Collection of friends for the logged in user. + * This is only filled when using a user account. + * @type {Collection} + */ + this.friends = new Collection(); + + /** + * A Collection of blocked users for the logged in user. + * This is only filled when using a user account. + * @type {Collection} + */ + this.blocked = new Collection(); + + /** + * A Collection of notes for the logged in user. + * This is only filled when using a user account. + * @type {Collection} + */ + this.notes = new Collection(); + } + + edit(data) { + return this.client.rest.methods.updateCurrentUser(data); + } + + /** + * Set the username of the logged in Client. + * Changing usernames in Discord is heavily rate limited, with only 2 requests + * every hour. Use this sparingly! + * @param {string} username The new username + * @returns {Promise} + * @example + * // set username + * client.user.setUsername('discordjs') + * .then(user => console.log(`My new username is ${user.username}`)) + * .catch(console.error); + */ + setUsername(username) { + return this.client.rest.methods.updateCurrentUser({ username }); + } + + /** + * If this user is a "self bot" or logged in using a normal user's details (which should be avoided), you can set the + * email here. + * @param {string} email The new email + * @returns {Promise} + * @example + * // set email + * client.user.setEmail('bob@gmail.com') + * .then(user => console.log(`My new email is ${user.email}`)) + * .catch(console.error); + */ + setEmail(email) { + return this.client.rest.methods.updateCurrentUser({ email }); + } + + /** + * If this user is a "self bot" or logged in using a normal user's details (which should be avoided), you can set the + * password here. + * @param {string} password The new password + * @returns {Promise} + * @example + * // set password + * client.user.setPassword('password123') + * .then(user => console.log('New password set!')) + * .catch(console.error); + */ + setPassword(password) { + return this.client.rest.methods.updateCurrentUser({ password }); + } + + /** + * Set the avatar of the logged in Client. + * @param {BufferResolvable|Base64Resolvable} avatar The new avatar + * @returns {Promise} + * @example + * // set avatar + * client.user.setAvatar('./avatar.png') + * .then(user => console.log(`New avatar set!`)) + * .catch(console.error); + */ + setAvatar(avatar) { + if (avatar.startsWith('data:')) { + return this.client.rest.methods.updateCurrentUser({ avatar }); + } else { + return this.client.resolver.resolveBuffer(avatar).then(data => + this.client.rest.methods.updateCurrentUser({ avatar: data }) + ); + } + } + + /** + * Set the status of the logged in user. + * @param {string} status can be `online`, `idle`, `invisible` or `dnd` (do not disturb) + * @returns {Promise} + */ + setStatus(status) { + return this.setPresence({ status }); + } + + /** + * Set the current game of the logged in user. + * @param {string} game the game being played + * @param {string} [streamingURL] an optional URL to a twitch stream, if one is available. + * @returns {Promise} + */ + setGame(game, streamingURL) { + return this.setPresence({ game: { + name: game, + url: streamingURL, + } }); + } + + /** + * Set/remove the AFK flag for the current user. + * @param {boolean} afk whether or not the user is AFK. + * @returns {Promise} + */ + setAFK(afk) { + return this.setPresence({ afk }); + } + + /** + * Send a friend request + * This is only available when using a user account. + * @param {UserResolvable} user The user to send the friend request to. + * @returns {Promise} The user the friend request was sent to. + */ + addFriend(user) { + user = this.client.resolver.resolveUser(user); + return this.client.rest.methods.addFriend(user); + } + + /** + * Remove a friend + * This is only available when using a user account. + * @param {UserResolvable} user The user to remove from your friends + * @returns {Promise} The user that was removed + */ + removeFriend(user) { + user = this.client.resolver.resolveUser(user); + return this.client.rest.methods.removeFriend(user); + } + + /** + * Creates a guild + * This is only available when using a user account. + * @param {string} name The name of the guild + * @param {string} region The region for the server + * @param {BufferResolvable|Base64Resolvable} [icon=null] The icon for the guild + * @returns {Promise} The guild that was created + */ + createGuild(name, region, icon = null) { + if (!icon) return this.client.rest.methods.createGuild({ name, icon, region }); + if (icon.startsWith('data:')) { + return this.client.rest.methods.createGuild({ name, icon, region }); + } else { + return this.client.resolver.resolveBuffer(icon).then(data => + this.client.rest.methods.createGuild({ name, icon: data, region }) + ); + } + } + + /** + * Set the full presence of the current user. + * @param {Object} data the data to provide + * @returns {Promise} + */ + setPresence(data) { + // {"op":3,"d":{"status":"dnd","since":0,"game":null,"afk":false}} + return new Promise(resolve => { + let status = this.localPresence.status || this.presence.status; + let game = this.localPresence.game; + let afk = this.localPresence.afk || this.presence.afk; + + if (!game && this.presence.game) { + game = { + name: this.presence.game.name, + type: this.presence.game.type, + url: this.presence.game.url, + }; + } + + if (data.status) { + if (typeof data.status !== 'string') throw new TypeError('Status must be a string'); + status = data.status; + } + + if (data.game) { + game = data.game; + if (game.url) game.type = 1; + } + + if (typeof data.afk !== 'undefined') afk = data.afk; + afk = Boolean(afk); + + this.localPresence = { status, game, afk }; + this.localPresence.since = 0; + this.localPresence.game = this.localPresence.game || null; + + this.client.ws.send({ + op: 3, + d: this.localPresence, + }); + + this.client._setPresence(this.id, this.localPresence); + + resolve(this); + }); + } +} + +module.exports = ClientUser; /***/ }, /* 138 */ -/***/ function(module, exports) { +/***/ function(module, exports, __webpack_require__) { - 'use strict'; +;(function () { + var object = true ? exports : this; // #8: web workers + var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='; - var TYPED_OK = (typeof Uint8Array !== 'undefined') && - (typeof Uint16Array !== 'undefined') && - (typeof Int32Array !== 'undefined'); + function InvalidCharacterError(message) { + this.message = message; + } + InvalidCharacterError.prototype = new Error; + InvalidCharacterError.prototype.name = 'InvalidCharacterError'; + // encoder + // [https://gist.github.com/999166] by [https://github.com/nignag] + object.btoa || ( + object.btoa = function (input) { + for ( + // initialize result and counter + var block, charCode, idx = 0, map = chars, output = ''; + // if the next input index does not exist: + // change the mapping table to "=" + // check if d has no fractional digits + input.charAt(idx | 0) || (map = '=', idx % 1); + // "8 - idx % 1 * 8" generates the sequence 2, 4, 6, 8 + output += map.charAt(63 & block >> 8 - idx % 1 * 8) + ) { + charCode = input.charCodeAt(idx += 3/4); + if (charCode > 0xFF) { + throw new InvalidCharacterError("'btoa' failed: The string to be encoded contains characters outside of the Latin1 range."); + } + block = block << 8 | charCode; + } + return output; + }); - exports.assign = function (obj /*from1, from2, from3, ...*/) { - var sources = Array.prototype.slice.call(arguments, 1); - while (sources.length) { - var source = sources.shift(); - if (!source) { continue; } + // decoder + // [https://gist.github.com/1020396] by [https://github.com/atk] + object.atob || ( + object.atob = function (input) { + input = input.replace(/=+$/, ''); + if (input.length % 4 == 1) { + throw new InvalidCharacterError("'atob' failed: The string to be decoded is not correctly encoded."); + } + for ( + // initialize result and counters + var bc = 0, bs, buffer, idx = 0, output = ''; + // get next character + buffer = input.charAt(idx++); + // character found in table? initialize bit storage and add its ascii value; + ~buffer && (bs = bc % 4 ? bs * 64 + buffer : buffer, + // and if not first of each 4 characters, + // convert the first 8 bits to one ascii character + bc++ % 4) ? output += String.fromCharCode(255 & bs >> (-2 * bc & 6)) : 0 + ) { + // try to find character in table (0-63, not found => -1) + buffer = chars.indexOf(buffer); + } + return output; + }); - if (typeof source !== 'object') { - throw new TypeError(source + 'must be non-object'); - } - - for (var p in source) { - if (source.hasOwnProperty(p)) { - obj[p] = source[p]; - } - } - } - - return obj; - }; - - - // reduce buffer size, avoiding mem copy - exports.shrinkBuf = function (buf, size) { - if (buf.length === size) { return buf; } - if (buf.subarray) { return buf.subarray(0, size); } - buf.length = size; - return buf; - }; - - - var fnTyped = { - arraySet: function (dest, src, src_offs, len, dest_offs) { - if (src.subarray && dest.subarray) { - dest.set(src.subarray(src_offs, src_offs + len), dest_offs); - return; - } - // Fallback to ordinary array - for (var i = 0; i < len; i++) { - dest[dest_offs + i] = src[src_offs + i]; - } - }, - // Join array of chunks to single array. - flattenChunks: function (chunks) { - var i, l, len, pos, chunk, result; - - // calculate data length - len = 0; - for (i = 0, l = chunks.length; i < l; i++) { - len += chunks[i].length; - } - - // join chunks - result = new Uint8Array(len); - pos = 0; - for (i = 0, l = chunks.length; i < l; i++) { - chunk = chunks[i]; - result.set(chunk, pos); - pos += chunk.length; - } - - return result; - } - }; - - var fnUntyped = { - arraySet: function (dest, src, src_offs, len, dest_offs) { - for (var i = 0; i < len; i++) { - dest[dest_offs + i] = src[src_offs + i]; - } - }, - // Join array of chunks to single array. - flattenChunks: function (chunks) { - return [].concat.apply([], chunks); - } - }; - - - // Enable/Disable typed arrays use, for testing - // - exports.setTyped = function (on) { - if (on) { - exports.Buf8 = Uint8Array; - exports.Buf16 = Uint16Array; - exports.Buf32 = Int32Array; - exports.assign(exports, fnTyped); - } else { - exports.Buf8 = Array; - exports.Buf16 = Array; - exports.Buf32 = Array; - exports.assign(exports, fnUntyped); - } - }; - - exports.setTyped(TYPED_OK); +}()); /***/ }, /* 139 */ /***/ function(module, exports, __webpack_require__) { - 'use strict'; - - - var utils = __webpack_require__(138); - - /* Public constants ==========================================================*/ - /* ===========================================================================*/ - - - //var Z_FILTERED = 1; - //var Z_HUFFMAN_ONLY = 2; - //var Z_RLE = 3; - var Z_FIXED = 4; - //var Z_DEFAULT_STRATEGY = 0; - - /* Possible values of the data_type field (though see inflate()) */ - var Z_BINARY = 0; - var Z_TEXT = 1; - //var Z_ASCII = 1; // = Z_TEXT - var Z_UNKNOWN = 2; - - /*============================================================================*/ - - - function zero(buf) { var len = buf.length; while (--len >= 0) { buf[len] = 0; } } - - // From zutil.h - - var STORED_BLOCK = 0; - var STATIC_TREES = 1; - var DYN_TREES = 2; - /* The three kinds of block type */ - - var MIN_MATCH = 3; - var MAX_MATCH = 258; - /* The minimum and maximum match lengths */ - - // From deflate.h - /* =========================================================================== - * Internal compression state. - */ - - var LENGTH_CODES = 29; - /* number of length codes, not counting the special END_BLOCK code */ - - var LITERALS = 256; - /* number of literal bytes 0..255 */ - - var L_CODES = LITERALS + 1 + LENGTH_CODES; - /* number of Literal or Length codes, including the END_BLOCK code */ - - var D_CODES = 30; - /* number of distance codes */ - - var BL_CODES = 19; - /* number of codes used to transfer the bit lengths */ - - var HEAP_SIZE = 2 * L_CODES + 1; - /* maximum heap size */ - - var MAX_BITS = 15; - /* All codes must not exceed MAX_BITS bits */ - - var Buf_size = 16; - /* size of bit buffer in bi_buf */ - - - /* =========================================================================== - * Constants - */ - - var MAX_BL_BITS = 7; - /* Bit length codes must not exceed MAX_BL_BITS bits */ - - var END_BLOCK = 256; - /* end of block literal code */ - - var REP_3_6 = 16; - /* repeat previous bit length 3-6 times (2 bits of repeat count) */ - - var REPZ_3_10 = 17; - /* repeat a zero length 3-10 times (3 bits of repeat count) */ - - var REPZ_11_138 = 18; - /* repeat a zero length 11-138 times (7 bits of repeat count) */ - - /* eslint-disable comma-spacing,array-bracket-spacing */ - var extra_lbits = /* extra bits for each length code */ - [0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]; - - var extra_dbits = /* extra bits for each distance code */ - [0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]; - - var extra_blbits = /* extra bits for each bit length code */ - [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]; - - var bl_order = - [16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]; - /* eslint-enable comma-spacing,array-bracket-spacing */ - - /* The lengths of the bit length codes are sent in order of decreasing - * probability, to avoid transmitting the lengths for unused bit length codes. - */ - - /* =========================================================================== - * Local data. These are initialized only once. - */ - - // We pre-fill arrays with 0 to avoid uninitialized gaps - - var DIST_CODE_LEN = 512; /* see definition of array dist_code below */ - - // !!!! Use flat array insdead of structure, Freq = i*2, Len = i*2+1 - var static_ltree = new Array((L_CODES + 2) * 2); - zero(static_ltree); - /* The static literal tree. Since the bit lengths are imposed, there is no - * need for the L_CODES extra codes used during heap construction. However - * The codes 286 and 287 are needed to build a canonical tree (see _tr_init - * below). - */ - - var static_dtree = new Array(D_CODES * 2); - zero(static_dtree); - /* The static distance tree. (Actually a trivial tree since all codes use - * 5 bits.) - */ - - var _dist_code = new Array(DIST_CODE_LEN); - zero(_dist_code); - /* Distance codes. The first 256 values correspond to the distances - * 3 .. 258, the last 256 values correspond to the top 8 bits of - * the 15 bit distances. - */ - - var _length_code = new Array(MAX_MATCH - MIN_MATCH + 1); - zero(_length_code); - /* length code for each normalized match length (0 == MIN_MATCH) */ - - var base_length = new Array(LENGTH_CODES); - zero(base_length); - /* First normalized length for each code (0 = MIN_MATCH) */ - - var base_dist = new Array(D_CODES); - zero(base_dist); - /* First normalized distance for each code (0 = distance of 1) */ - - - function StaticTreeDesc(static_tree, extra_bits, extra_base, elems, max_length) { - - this.static_tree = static_tree; /* static tree or NULL */ - this.extra_bits = extra_bits; /* extra bits for each code or NULL */ - this.extra_base = extra_base; /* base index for extra_bits */ - this.elems = elems; /* max number of elements in the tree */ - this.max_length = max_length; /* max bit length for the codes */ - - // show if `static_tree` has data or dummy - needed for monomorphic objects - this.has_stree = static_tree && static_tree.length; - } - - - var static_l_desc; - var static_d_desc; - var static_bl_desc; - - - function TreeDesc(dyn_tree, stat_desc) { - this.dyn_tree = dyn_tree; /* the dynamic tree */ - this.max_code = 0; /* largest code with non zero frequency */ - this.stat_desc = stat_desc; /* the corresponding static tree */ - } - - - - function d_code(dist) { - return dist < 256 ? _dist_code[dist] : _dist_code[256 + (dist >>> 7)]; - } - - - /* =========================================================================== - * Output a short LSB first on the stream. - * IN assertion: there is enough room in pendingBuf. - */ - function put_short(s, w) { - // put_byte(s, (uch)((w) & 0xff)); - // put_byte(s, (uch)((ush)(w) >> 8)); - s.pending_buf[s.pending++] = (w) & 0xff; - s.pending_buf[s.pending++] = (w >>> 8) & 0xff; - } - - - /* =========================================================================== - * Send a value on a given number of bits. - * IN assertion: length <= 16 and value fits in length bits. - */ - function send_bits(s, value, length) { - if (s.bi_valid > (Buf_size - length)) { - s.bi_buf |= (value << s.bi_valid) & 0xffff; - put_short(s, s.bi_buf); - s.bi_buf = value >> (Buf_size - s.bi_valid); - s.bi_valid += length - Buf_size; - } else { - s.bi_buf |= (value << s.bi_valid) & 0xffff; - s.bi_valid += length; - } - } - - - function send_code(s, c, tree) { - send_bits(s, tree[c * 2]/*.Code*/, tree[c * 2 + 1]/*.Len*/); - } - - - /* =========================================================================== - * Reverse the first len bits of a code, using straightforward code (a faster - * method would use a table) - * IN assertion: 1 <= len <= 15 - */ - function bi_reverse(code, len) { - var res = 0; - do { - res |= code & 1; - code >>>= 1; - res <<= 1; - } while (--len > 0); - return res >>> 1; - } - - - /* =========================================================================== - * Flush the bit buffer, keeping at most 7 bits in it. - */ - function bi_flush(s) { - if (s.bi_valid === 16) { - put_short(s, s.bi_buf); - s.bi_buf = 0; - s.bi_valid = 0; - - } else if (s.bi_valid >= 8) { - s.pending_buf[s.pending++] = s.bi_buf & 0xff; - s.bi_buf >>= 8; - s.bi_valid -= 8; - } - } - - - /* =========================================================================== - * Compute the optimal bit lengths for a tree and update the total bit length - * for the current block. - * IN assertion: the fields freq and dad are set, heap[heap_max] and - * above are the tree nodes sorted by increasing frequency. - * OUT assertions: the field len is set to the optimal bit length, the - * array bl_count contains the frequencies for each bit length. - * The length opt_len is updated; static_len is also updated if stree is - * not null. - */ - function gen_bitlen(s, desc) - // deflate_state *s; - // tree_desc *desc; /* the tree descriptor */ - { - var tree = desc.dyn_tree; - var max_code = desc.max_code; - var stree = desc.stat_desc.static_tree; - var has_stree = desc.stat_desc.has_stree; - var extra = desc.stat_desc.extra_bits; - var base = desc.stat_desc.extra_base; - var max_length = desc.stat_desc.max_length; - var h; /* heap index */ - var n, m; /* iterate over the tree elements */ - var bits; /* bit length */ - var xbits; /* extra bits */ - var f; /* frequency */ - var overflow = 0; /* number of elements with bit length too large */ - - for (bits = 0; bits <= MAX_BITS; bits++) { - s.bl_count[bits] = 0; - } - - /* In a first pass, compute the optimal bit lengths (which may - * overflow in the case of the bit length tree). - */ - tree[s.heap[s.heap_max] * 2 + 1]/*.Len*/ = 0; /* root of the heap */ - - for (h = s.heap_max + 1; h < HEAP_SIZE; h++) { - n = s.heap[h]; - bits = tree[tree[n * 2 + 1]/*.Dad*/ * 2 + 1]/*.Len*/ + 1; - if (bits > max_length) { - bits = max_length; - overflow++; - } - tree[n * 2 + 1]/*.Len*/ = bits; - /* We overwrite tree[n].Dad which is no longer needed */ - - if (n > max_code) { continue; } /* not a leaf node */ - - s.bl_count[bits]++; - xbits = 0; - if (n >= base) { - xbits = extra[n - base]; - } - f = tree[n * 2]/*.Freq*/; - s.opt_len += f * (bits + xbits); - if (has_stree) { - s.static_len += f * (stree[n * 2 + 1]/*.Len*/ + xbits); - } - } - if (overflow === 0) { return; } - - // Trace((stderr,"\nbit length overflow\n")); - /* This happens for example on obj2 and pic of the Calgary corpus */ - - /* Find the first bit length which could increase: */ - do { - bits = max_length - 1; - while (s.bl_count[bits] === 0) { bits--; } - s.bl_count[bits]--; /* move one leaf down the tree */ - s.bl_count[bits + 1] += 2; /* move one overflow item as its brother */ - s.bl_count[max_length]--; - /* The brother of the overflow item also moves one step up, - * but this does not affect bl_count[max_length] - */ - overflow -= 2; - } while (overflow > 0); - - /* Now recompute all bit lengths, scanning in increasing frequency. - * h is still equal to HEAP_SIZE. (It is simpler to reconstruct all - * lengths instead of fixing only the wrong ones. This idea is taken - * from 'ar' written by Haruhiko Okumura.) - */ - for (bits = max_length; bits !== 0; bits--) { - n = s.bl_count[bits]; - while (n !== 0) { - m = s.heap[--h]; - if (m > max_code) { continue; } - if (tree[m * 2 + 1]/*.Len*/ !== bits) { - // Trace((stderr,"code %d bits %d->%d\n", m, tree[m].Len, bits)); - s.opt_len += (bits - tree[m * 2 + 1]/*.Len*/) * tree[m * 2]/*.Freq*/; - tree[m * 2 + 1]/*.Len*/ = bits; - } - n--; - } - } - } - - - /* =========================================================================== - * Generate the codes for a given tree and bit counts (which need not be - * optimal). - * IN assertion: the array bl_count contains the bit length statistics for - * the given tree and the field len is set for all tree elements. - * OUT assertion: the field code is set for all tree elements of non - * zero code length. - */ - function gen_codes(tree, max_code, bl_count) - // ct_data *tree; /* the tree to decorate */ - // int max_code; /* largest code with non zero frequency */ - // ushf *bl_count; /* number of codes at each bit length */ - { - var next_code = new Array(MAX_BITS + 1); /* next code value for each bit length */ - var code = 0; /* running code value */ - var bits; /* bit index */ - var n; /* code index */ - - /* The distribution counts are first used to generate the code values - * without bit reversal. - */ - for (bits = 1; bits <= MAX_BITS; bits++) { - next_code[bits] = code = (code + bl_count[bits - 1]) << 1; - } - /* Check that the bit counts in bl_count are consistent. The last code - * must be all ones. - */ - //Assert (code + bl_count[MAX_BITS]-1 == (1< length code (0..28) */ - length = 0; - for (code = 0; code < LENGTH_CODES - 1; code++) { - base_length[code] = length; - for (n = 0; n < (1 << extra_lbits[code]); n++) { - _length_code[length++] = code; - } - } - //Assert (length == 256, "tr_static_init: length != 256"); - /* Note that the length 255 (match length 258) can be represented - * in two different ways: code 284 + 5 bits or code 285, so we - * overwrite length_code[255] to use the best encoding: - */ - _length_code[length - 1] = code; - - /* Initialize the mapping dist (0..32K) -> dist code (0..29) */ - dist = 0; - for (code = 0; code < 16; code++) { - base_dist[code] = dist; - for (n = 0; n < (1 << extra_dbits[code]); n++) { - _dist_code[dist++] = code; - } - } - //Assert (dist == 256, "tr_static_init: dist != 256"); - dist >>= 7; /* from now on, all distances are divided by 128 */ - for (; code < D_CODES; code++) { - base_dist[code] = dist << 7; - for (n = 0; n < (1 << (extra_dbits[code] - 7)); n++) { - _dist_code[256 + dist++] = code; - } - } - //Assert (dist == 256, "tr_static_init: 256+dist != 512"); - - /* Construct the codes of the static literal tree */ - for (bits = 0; bits <= MAX_BITS; bits++) { - bl_count[bits] = 0; - } - - n = 0; - while (n <= 143) { - static_ltree[n * 2 + 1]/*.Len*/ = 8; - n++; - bl_count[8]++; - } - while (n <= 255) { - static_ltree[n * 2 + 1]/*.Len*/ = 9; - n++; - bl_count[9]++; - } - while (n <= 279) { - static_ltree[n * 2 + 1]/*.Len*/ = 7; - n++; - bl_count[7]++; - } - while (n <= 287) { - static_ltree[n * 2 + 1]/*.Len*/ = 8; - n++; - bl_count[8]++; - } - /* Codes 286 and 287 do not exist, but we must include them in the - * tree construction to get a canonical Huffman tree (longest code - * all ones) - */ - gen_codes(static_ltree, L_CODES + 1, bl_count); - - /* The static distance tree is trivial: */ - for (n = 0; n < D_CODES; n++) { - static_dtree[n * 2 + 1]/*.Len*/ = 5; - static_dtree[n * 2]/*.Code*/ = bi_reverse(n, 5); - } - - // Now data ready and we can init static trees - static_l_desc = new StaticTreeDesc(static_ltree, extra_lbits, LITERALS + 1, L_CODES, MAX_BITS); - static_d_desc = new StaticTreeDesc(static_dtree, extra_dbits, 0, D_CODES, MAX_BITS); - static_bl_desc = new StaticTreeDesc(new Array(0), extra_blbits, 0, BL_CODES, MAX_BL_BITS); - - //static_init_done = true; - } - - - /* =========================================================================== - * Initialize a new block. - */ - function init_block(s) { - var n; /* iterates over tree elements */ - - /* Initialize the trees. */ - for (n = 0; n < L_CODES; n++) { s.dyn_ltree[n * 2]/*.Freq*/ = 0; } - for (n = 0; n < D_CODES; n++) { s.dyn_dtree[n * 2]/*.Freq*/ = 0; } - for (n = 0; n < BL_CODES; n++) { s.bl_tree[n * 2]/*.Freq*/ = 0; } - - s.dyn_ltree[END_BLOCK * 2]/*.Freq*/ = 1; - s.opt_len = s.static_len = 0; - s.last_lit = s.matches = 0; - } - - - /* =========================================================================== - * Flush the bit buffer and align the output on a byte boundary - */ - function bi_windup(s) - { - if (s.bi_valid > 8) { - put_short(s, s.bi_buf); - } else if (s.bi_valid > 0) { - //put_byte(s, (Byte)s->bi_buf); - s.pending_buf[s.pending++] = s.bi_buf; - } - s.bi_buf = 0; - s.bi_valid = 0; - } - - /* =========================================================================== - * Copy a stored block, storing first the length and its - * one's complement if requested. - */ - function copy_block(s, buf, len, header) - //DeflateState *s; - //charf *buf; /* the input data */ - //unsigned len; /* its length */ - //int header; /* true if block header must be written */ - { - bi_windup(s); /* align on byte boundary */ - - if (header) { - put_short(s, len); - put_short(s, ~len); - } - // while (len--) { - // put_byte(s, *buf++); - // } - utils.arraySet(s.pending_buf, s.window, buf, len, s.pending); - s.pending += len; - } - - /* =========================================================================== - * Compares to subtrees, using the tree depth as tie breaker when - * the subtrees have equal frequency. This minimizes the worst case length. - */ - function smaller(tree, n, m, depth) { - var _n2 = n * 2; - var _m2 = m * 2; - return (tree[_n2]/*.Freq*/ < tree[_m2]/*.Freq*/ || - (tree[_n2]/*.Freq*/ === tree[_m2]/*.Freq*/ && depth[n] <= depth[m])); - } - - /* =========================================================================== - * Restore the heap property by moving down the tree starting at node k, - * exchanging a node with the smallest of its two sons if necessary, stopping - * when the heap property is re-established (each father smaller than its - * two sons). - */ - function pqdownheap(s, tree, k) - // deflate_state *s; - // ct_data *tree; /* the tree to restore */ - // int k; /* node to move down */ - { - var v = s.heap[k]; - var j = k << 1; /* left son of k */ - while (j <= s.heap_len) { - /* Set j to the smallest of the two sons: */ - if (j < s.heap_len && - smaller(tree, s.heap[j + 1], s.heap[j], s.depth)) { - j++; - } - /* Exit if v is smaller than both sons */ - if (smaller(tree, v, s.heap[j], s.depth)) { break; } - - /* Exchange v with the smallest son */ - s.heap[k] = s.heap[j]; - k = j; - - /* And continue down the tree, setting j to the left son of k */ - j <<= 1; - } - s.heap[k] = v; - } - - - // inlined manually - // var SMALLEST = 1; - - /* =========================================================================== - * Send the block data compressed using the given Huffman trees - */ - function compress_block(s, ltree, dtree) - // deflate_state *s; - // const ct_data *ltree; /* literal tree */ - // const ct_data *dtree; /* distance tree */ - { - var dist; /* distance of matched string */ - var lc; /* match length or unmatched char (if dist == 0) */ - var lx = 0; /* running index in l_buf */ - var code; /* the code to send */ - var extra; /* number of extra bits to send */ - - if (s.last_lit !== 0) { - do { - dist = (s.pending_buf[s.d_buf + lx * 2] << 8) | (s.pending_buf[s.d_buf + lx * 2 + 1]); - lc = s.pending_buf[s.l_buf + lx]; - lx++; - - if (dist === 0) { - send_code(s, lc, ltree); /* send a literal byte */ - //Tracecv(isgraph(lc), (stderr," '%c' ", lc)); - } else { - /* Here, lc is the match length - MIN_MATCH */ - code = _length_code[lc]; - send_code(s, code + LITERALS + 1, ltree); /* send the length code */ - extra = extra_lbits[code]; - if (extra !== 0) { - lc -= base_length[code]; - send_bits(s, lc, extra); /* send the extra length bits */ - } - dist--; /* dist is now the match distance - 1 */ - code = d_code(dist); - //Assert (code < D_CODES, "bad d_code"); - - send_code(s, code, dtree); /* send the distance code */ - extra = extra_dbits[code]; - if (extra !== 0) { - dist -= base_dist[code]; - send_bits(s, dist, extra); /* send the extra distance bits */ - } - } /* literal or match pair ? */ - - /* Check that the overlay between pending_buf and d_buf+l_buf is ok: */ - //Assert((uInt)(s->pending) < s->lit_bufsize + 2*lx, - // "pendingBuf overflow"); - - } while (lx < s.last_lit); - } - - send_code(s, END_BLOCK, ltree); - } - - - /* =========================================================================== - * Construct one Huffman tree and assigns the code bit strings and lengths. - * Update the total bit length for the current block. - * IN assertion: the field freq is set for all tree elements. - * OUT assertions: the fields len and code are set to the optimal bit length - * and corresponding code. The length opt_len is updated; static_len is - * also updated if stree is not null. The field max_code is set. - */ - function build_tree(s, desc) - // deflate_state *s; - // tree_desc *desc; /* the tree descriptor */ - { - var tree = desc.dyn_tree; - var stree = desc.stat_desc.static_tree; - var has_stree = desc.stat_desc.has_stree; - var elems = desc.stat_desc.elems; - var n, m; /* iterate over heap elements */ - var max_code = -1; /* largest code with non zero frequency */ - var node; /* new node being created */ - - /* Construct the initial heap, with least frequent element in - * heap[SMALLEST]. The sons of heap[n] are heap[2*n] and heap[2*n+1]. - * heap[0] is not used. - */ - s.heap_len = 0; - s.heap_max = HEAP_SIZE; - - for (n = 0; n < elems; n++) { - if (tree[n * 2]/*.Freq*/ !== 0) { - s.heap[++s.heap_len] = max_code = n; - s.depth[n] = 0; - - } else { - tree[n * 2 + 1]/*.Len*/ = 0; - } - } - - /* The pkzip format requires that at least one distance code exists, - * and that at least one bit should be sent even if there is only one - * possible code. So to avoid special checks later on we force at least - * two codes of non zero frequency. - */ - while (s.heap_len < 2) { - node = s.heap[++s.heap_len] = (max_code < 2 ? ++max_code : 0); - tree[node * 2]/*.Freq*/ = 1; - s.depth[node] = 0; - s.opt_len--; - - if (has_stree) { - s.static_len -= stree[node * 2 + 1]/*.Len*/; - } - /* node is 0 or 1 so it does not have extra bits */ - } - desc.max_code = max_code; - - /* The elements heap[heap_len/2+1 .. heap_len] are leaves of the tree, - * establish sub-heaps of increasing lengths: - */ - for (n = (s.heap_len >> 1/*int /2*/); n >= 1; n--) { pqdownheap(s, tree, n); } - - /* Construct the Huffman tree by repeatedly combining the least two - * frequent nodes. - */ - node = elems; /* next internal node of the tree */ - do { - //pqremove(s, tree, n); /* n = node of least frequency */ - /*** pqremove ***/ - n = s.heap[1/*SMALLEST*/]; - s.heap[1/*SMALLEST*/] = s.heap[s.heap_len--]; - pqdownheap(s, tree, 1/*SMALLEST*/); - /***/ - - m = s.heap[1/*SMALLEST*/]; /* m = node of next least frequency */ - - s.heap[--s.heap_max] = n; /* keep the nodes sorted by frequency */ - s.heap[--s.heap_max] = m; - - /* Create a new node father of n and m */ - tree[node * 2]/*.Freq*/ = tree[n * 2]/*.Freq*/ + tree[m * 2]/*.Freq*/; - s.depth[node] = (s.depth[n] >= s.depth[m] ? s.depth[n] : s.depth[m]) + 1; - tree[n * 2 + 1]/*.Dad*/ = tree[m * 2 + 1]/*.Dad*/ = node; - - /* and insert the new node in the heap */ - s.heap[1/*SMALLEST*/] = node++; - pqdownheap(s, tree, 1/*SMALLEST*/); - - } while (s.heap_len >= 2); - - s.heap[--s.heap_max] = s.heap[1/*SMALLEST*/]; - - /* At this point, the fields freq and dad are set. We can now - * generate the bit lengths. - */ - gen_bitlen(s, desc); - - /* The field len is now set, we can generate the bit codes */ - gen_codes(tree, max_code, s.bl_count); - } - - - /* =========================================================================== - * Scan a literal or distance tree to determine the frequencies of the codes - * in the bit length tree. - */ - function scan_tree(s, tree, max_code) - // deflate_state *s; - // ct_data *tree; /* the tree to be scanned */ - // int max_code; /* and its largest code of non zero frequency */ - { - var n; /* iterates over all tree elements */ - var prevlen = -1; /* last emitted length */ - var curlen; /* length of current code */ - - var nextlen = tree[0 * 2 + 1]/*.Len*/; /* length of next code */ - - var count = 0; /* repeat count of the current code */ - var max_count = 7; /* max repeat count */ - var min_count = 4; /* min repeat count */ - - if (nextlen === 0) { - max_count = 138; - min_count = 3; - } - tree[(max_code + 1) * 2 + 1]/*.Len*/ = 0xffff; /* guard */ - - for (n = 0; n <= max_code; n++) { - curlen = nextlen; - nextlen = tree[(n + 1) * 2 + 1]/*.Len*/; - - if (++count < max_count && curlen === nextlen) { - continue; - - } else if (count < min_count) { - s.bl_tree[curlen * 2]/*.Freq*/ += count; - - } else if (curlen !== 0) { - - if (curlen !== prevlen) { s.bl_tree[curlen * 2]/*.Freq*/++; } - s.bl_tree[REP_3_6 * 2]/*.Freq*/++; - - } else if (count <= 10) { - s.bl_tree[REPZ_3_10 * 2]/*.Freq*/++; - - } else { - s.bl_tree[REPZ_11_138 * 2]/*.Freq*/++; - } - - count = 0; - prevlen = curlen; - - if (nextlen === 0) { - max_count = 138; - min_count = 3; - - } else if (curlen === nextlen) { - max_count = 6; - min_count = 3; - - } else { - max_count = 7; - min_count = 4; - } - } - } - - - /* =========================================================================== - * Send a literal or distance tree in compressed form, using the codes in - * bl_tree. - */ - function send_tree(s, tree, max_code) - // deflate_state *s; - // ct_data *tree; /* the tree to be scanned */ - // int max_code; /* and its largest code of non zero frequency */ - { - var n; /* iterates over all tree elements */ - var prevlen = -1; /* last emitted length */ - var curlen; /* length of current code */ - - var nextlen = tree[0 * 2 + 1]/*.Len*/; /* length of next code */ - - var count = 0; /* repeat count of the current code */ - var max_count = 7; /* max repeat count */ - var min_count = 4; /* min repeat count */ - - /* tree[max_code+1].Len = -1; */ /* guard already set */ - if (nextlen === 0) { - max_count = 138; - min_count = 3; - } - - for (n = 0; n <= max_code; n++) { - curlen = nextlen; - nextlen = tree[(n + 1) * 2 + 1]/*.Len*/; - - if (++count < max_count && curlen === nextlen) { - continue; - - } else if (count < min_count) { - do { send_code(s, curlen, s.bl_tree); } while (--count !== 0); - - } else if (curlen !== 0) { - if (curlen !== prevlen) { - send_code(s, curlen, s.bl_tree); - count--; - } - //Assert(count >= 3 && count <= 6, " 3_6?"); - send_code(s, REP_3_6, s.bl_tree); - send_bits(s, count - 3, 2); - - } else if (count <= 10) { - send_code(s, REPZ_3_10, s.bl_tree); - send_bits(s, count - 3, 3); - - } else { - send_code(s, REPZ_11_138, s.bl_tree); - send_bits(s, count - 11, 7); - } - - count = 0; - prevlen = curlen; - if (nextlen === 0) { - max_count = 138; - min_count = 3; - - } else if (curlen === nextlen) { - max_count = 6; - min_count = 3; - - } else { - max_count = 7; - min_count = 4; - } - } - } - - - /* =========================================================================== - * Construct the Huffman tree for the bit lengths and return the index in - * bl_order of the last bit length code to send. - */ - function build_bl_tree(s) { - var max_blindex; /* index of last bit length code of non zero freq */ - - /* Determine the bit length frequencies for literal and distance trees */ - scan_tree(s, s.dyn_ltree, s.l_desc.max_code); - scan_tree(s, s.dyn_dtree, s.d_desc.max_code); - - /* Build the bit length tree: */ - build_tree(s, s.bl_desc); - /* opt_len now includes the length of the tree representations, except - * the lengths of the bit lengths codes and the 5+5+4 bits for the counts. - */ - - /* Determine the number of bit length codes to send. The pkzip format - * requires that at least 4 bit length codes be sent. (appnote.txt says - * 3 but the actual value used is 4.) - */ - for (max_blindex = BL_CODES - 1; max_blindex >= 3; max_blindex--) { - if (s.bl_tree[bl_order[max_blindex] * 2 + 1]/*.Len*/ !== 0) { - break; - } - } - /* Update opt_len to include the bit length tree and counts */ - s.opt_len += 3 * (max_blindex + 1) + 5 + 5 + 4; - //Tracev((stderr, "\ndyn trees: dyn %ld, stat %ld", - // s->opt_len, s->static_len)); - - return max_blindex; - } - - - /* =========================================================================== - * Send the header for a block using dynamic Huffman trees: the counts, the - * lengths of the bit length codes, the literal tree and the distance tree. - * IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4. - */ - function send_all_trees(s, lcodes, dcodes, blcodes) - // deflate_state *s; - // int lcodes, dcodes, blcodes; /* number of codes for each tree */ - { - var rank; /* index in bl_order */ - - //Assert (lcodes >= 257 && dcodes >= 1 && blcodes >= 4, "not enough codes"); - //Assert (lcodes <= L_CODES && dcodes <= D_CODES && blcodes <= BL_CODES, - // "too many codes"); - //Tracev((stderr, "\nbl counts: ")); - send_bits(s, lcodes - 257, 5); /* not +255 as stated in appnote.txt */ - send_bits(s, dcodes - 1, 5); - send_bits(s, blcodes - 4, 4); /* not -3 as stated in appnote.txt */ - for (rank = 0; rank < blcodes; rank++) { - //Tracev((stderr, "\nbl code %2d ", bl_order[rank])); - send_bits(s, s.bl_tree[bl_order[rank] * 2 + 1]/*.Len*/, 3); - } - //Tracev((stderr, "\nbl tree: sent %ld", s->bits_sent)); - - send_tree(s, s.dyn_ltree, lcodes - 1); /* literal tree */ - //Tracev((stderr, "\nlit tree: sent %ld", s->bits_sent)); - - send_tree(s, s.dyn_dtree, dcodes - 1); /* distance tree */ - //Tracev((stderr, "\ndist tree: sent %ld", s->bits_sent)); - } - - - /* =========================================================================== - * Check if the data type is TEXT or BINARY, using the following algorithm: - * - TEXT if the two conditions below are satisfied: - * a) There are no non-portable control characters belonging to the - * "black list" (0..6, 14..25, 28..31). - * b) There is at least one printable character belonging to the - * "white list" (9 {TAB}, 10 {LF}, 13 {CR}, 32..255). - * - BINARY otherwise. - * - The following partially-portable control characters form a - * "gray list" that is ignored in this detection algorithm: - * (7 {BEL}, 8 {BS}, 11 {VT}, 12 {FF}, 26 {SUB}, 27 {ESC}). - * IN assertion: the fields Freq of dyn_ltree are set. - */ - function detect_data_type(s) { - /* black_mask is the bit mask of black-listed bytes - * set bits 0..6, 14..25, and 28..31 - * 0xf3ffc07f = binary 11110011111111111100000001111111 - */ - var black_mask = 0xf3ffc07f; - var n; - - /* Check for non-textual ("black-listed") bytes. */ - for (n = 0; n <= 31; n++, black_mask >>>= 1) { - if ((black_mask & 1) && (s.dyn_ltree[n * 2]/*.Freq*/ !== 0)) { - return Z_BINARY; - } - } - - /* Check for textual ("white-listed") bytes. */ - if (s.dyn_ltree[9 * 2]/*.Freq*/ !== 0 || s.dyn_ltree[10 * 2]/*.Freq*/ !== 0 || - s.dyn_ltree[13 * 2]/*.Freq*/ !== 0) { - return Z_TEXT; - } - for (n = 32; n < LITERALS; n++) { - if (s.dyn_ltree[n * 2]/*.Freq*/ !== 0) { - return Z_TEXT; - } - } - - /* There are no "black-listed" or "white-listed" bytes: - * this stream either is empty or has tolerated ("gray-listed") bytes only. - */ - return Z_BINARY; - } - - - var static_init_done = false; - - /* =========================================================================== - * Initialize the tree data structures for a new zlib stream. - */ - function _tr_init(s) - { - - if (!static_init_done) { - tr_static_init(); - static_init_done = true; - } - - s.l_desc = new TreeDesc(s.dyn_ltree, static_l_desc); - s.d_desc = new TreeDesc(s.dyn_dtree, static_d_desc); - s.bl_desc = new TreeDesc(s.bl_tree, static_bl_desc); - - s.bi_buf = 0; - s.bi_valid = 0; - - /* Initialize the first block of the first file: */ - init_block(s); - } - - - /* =========================================================================== - * Send a stored block - */ - function _tr_stored_block(s, buf, stored_len, last) - //DeflateState *s; - //charf *buf; /* input block */ - //ulg stored_len; /* length of input block */ - //int last; /* one if this is the last block for a file */ - { - send_bits(s, (STORED_BLOCK << 1) + (last ? 1 : 0), 3); /* send block type */ - copy_block(s, buf, stored_len, true); /* with header */ - } - - - /* =========================================================================== - * Send one empty static block to give enough lookahead for inflate. - * This takes 10 bits, of which 7 may remain in the bit buffer. - */ - function _tr_align(s) { - send_bits(s, STATIC_TREES << 1, 3); - send_code(s, END_BLOCK, static_ltree); - bi_flush(s); - } - - - /* =========================================================================== - * Determine the best encoding for the current block: dynamic trees, static - * trees or store, and output the encoded block to the zip file. - */ - function _tr_flush_block(s, buf, stored_len, last) - //DeflateState *s; - //charf *buf; /* input block, or NULL if too old */ - //ulg stored_len; /* length of input block */ - //int last; /* one if this is the last block for a file */ - { - var opt_lenb, static_lenb; /* opt_len and static_len in bytes */ - var max_blindex = 0; /* index of last bit length code of non zero freq */ - - /* Build the Huffman trees unless a stored block is forced */ - if (s.level > 0) { - - /* Check if the file is binary or text */ - if (s.strm.data_type === Z_UNKNOWN) { - s.strm.data_type = detect_data_type(s); - } - - /* Construct the literal and distance trees */ - build_tree(s, s.l_desc); - // Tracev((stderr, "\nlit data: dyn %ld, stat %ld", s->opt_len, - // s->static_len)); - - build_tree(s, s.d_desc); - // Tracev((stderr, "\ndist data: dyn %ld, stat %ld", s->opt_len, - // s->static_len)); - /* At this point, opt_len and static_len are the total bit lengths of - * the compressed block data, excluding the tree representations. - */ - - /* Build the bit length tree for the above two trees, and get the index - * in bl_order of the last bit length code to send. - */ - max_blindex = build_bl_tree(s); - - /* Determine the best encoding. Compute the block lengths in bytes. */ - opt_lenb = (s.opt_len + 3 + 7) >>> 3; - static_lenb = (s.static_len + 3 + 7) >>> 3; - - // Tracev((stderr, "\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u ", - // opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len, - // s->last_lit)); - - if (static_lenb <= opt_lenb) { opt_lenb = static_lenb; } - - } else { - // Assert(buf != (char*)0, "lost buf"); - opt_lenb = static_lenb = stored_len + 5; /* force a stored block */ - } - - if ((stored_len + 4 <= opt_lenb) && (buf !== -1)) { - /* 4: two words for the lengths */ - - /* The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE. - * Otherwise we can't have processed more than WSIZE input bytes since - * the last block flush, because compression would have been - * successful. If LIT_BUFSIZE <= WSIZE, it is never too late to - * transform a block into a stored block. - */ - _tr_stored_block(s, buf, stored_len, last); - - } else if (s.strategy === Z_FIXED || static_lenb === opt_lenb) { - - send_bits(s, (STATIC_TREES << 1) + (last ? 1 : 0), 3); - compress_block(s, static_ltree, static_dtree); - - } else { - send_bits(s, (DYN_TREES << 1) + (last ? 1 : 0), 3); - send_all_trees(s, s.l_desc.max_code + 1, s.d_desc.max_code + 1, max_blindex + 1); - compress_block(s, s.dyn_ltree, s.dyn_dtree); - } - // Assert (s->compressed_len == s->bits_sent, "bad compressed size"); - /* The above check is made mod 2^32, for files larger than 512 MB - * and uLong implemented on 32 bits. - */ - init_block(s); - - if (last) { - bi_windup(s); - } - // Tracev((stderr,"\ncomprlen %lu(%lu) ", s->compressed_len>>3, - // s->compressed_len-7*last)); - } - - /* =========================================================================== - * Save the match info and tally the frequency counts. Return true if - * the current block must be flushed. - */ - function _tr_tally(s, dist, lc) - // deflate_state *s; - // unsigned dist; /* distance of matched string */ - // unsigned lc; /* match length-MIN_MATCH or unmatched char (if dist==0) */ - { - //var out_length, in_length, dcode; - - s.pending_buf[s.d_buf + s.last_lit * 2] = (dist >>> 8) & 0xff; - s.pending_buf[s.d_buf + s.last_lit * 2 + 1] = dist & 0xff; - - s.pending_buf[s.l_buf + s.last_lit] = lc & 0xff; - s.last_lit++; - - if (dist === 0) { - /* lc is the unmatched char */ - s.dyn_ltree[lc * 2]/*.Freq*/++; - } else { - s.matches++; - /* Here, lc is the match length - MIN_MATCH */ - dist--; /* dist = match distance - 1 */ - //Assert((ush)dist < (ush)MAX_DIST(s) && - // (ush)lc <= (ush)(MAX_MATCH-MIN_MATCH) && - // (ush)d_code(dist) < (ush)D_CODES, "_tr_tally: bad match"); - - s.dyn_ltree[(_length_code[lc] + LITERALS + 1) * 2]/*.Freq*/++; - s.dyn_dtree[d_code(dist) * 2]/*.Freq*/++; - } - - // (!) This block is disabled in zlib defailts, - // don't enable it for binary compatibility - - //#ifdef TRUNCATE_BLOCK - // /* Try to guess if it is profitable to stop the current block here */ - // if ((s.last_lit & 0x1fff) === 0 && s.level > 2) { - // /* Compute an upper bound for the compressed length */ - // out_length = s.last_lit*8; - // in_length = s.strstart - s.block_start; - // - // for (dcode = 0; dcode < D_CODES; dcode++) { - // out_length += s.dyn_dtree[dcode*2]/*.Freq*/ * (5 + extra_dbits[dcode]); - // } - // out_length >>>= 3; - // //Tracev((stderr,"\nlast_lit %u, in %ld, out ~%ld(%ld%%) ", - // // s->last_lit, in_length, out_length, - // // 100L - out_length*100L/in_length)); - // if (s.matches < (s.last_lit>>1)/*int /2*/ && out_length < (in_length>>1)/*int /2*/) { - // return true; - // } - // } - //#endif - - return (s.last_lit === s.lit_bufsize - 1); - /* We avoid equality with lit_bufsize because of wraparound at 64K - * on 16 bit machines and because stored blocks are restricted to - * 64K-1 bytes. - */ - } - - exports._tr_init = _tr_init; - exports._tr_stored_block = _tr_stored_block; - exports._tr_flush_block = _tr_flush_block; - exports._tr_tally = _tr_tally; - exports._tr_align = _tr_align; +var asn1 = __webpack_require__(32); +var inherits = __webpack_require__(1); + +var api = exports; + +api.define = function define(name, body) { + return new Entity(name, body); +}; + +function Entity(name, body) { + this.name = name; + this.body = body; + + this.decoders = {}; + this.encoders = {}; +}; + +Entity.prototype._createNamed = function createNamed(base) { + var named; + try { + named = __webpack_require__(235).runInThisContext( + '(function ' + this.name + '(entity) {\n' + + ' this._initNamed(entity);\n' + + '})' + ); + } catch (e) { + named = function (entity) { + this._initNamed(entity); + }; + } + inherits(named, base); + named.prototype._initNamed = function initnamed(entity) { + base.call(this, entity); + }; + + return new named(this); +}; + +Entity.prototype._getDecoder = function _getDecoder(enc) { + enc = enc || 'der'; + // Lazily create decoder + if (!this.decoders.hasOwnProperty(enc)) + this.decoders[enc] = this._createNamed(asn1.decoders[enc]); + return this.decoders[enc]; +}; + +Entity.prototype.decode = function decode(data, enc, options) { + return this._getDecoder(enc).decode(data, options); +}; + +Entity.prototype._getEncoder = function _getEncoder(enc) { + enc = enc || 'der'; + // Lazily create encoder + if (!this.encoders.hasOwnProperty(enc)) + this.encoders[enc] = this._createNamed(asn1.encoders[enc]); + return this.encoders[enc]; +}; + +Entity.prototype.encode = function encode(data, enc, /* internal */ reporter) { + return this._getEncoder(enc).encode(data, reporter); +}; /***/ }, /* 140 */ -/***/ function(module, exports) { +/***/ function(module, exports, __webpack_require__) { - 'use strict'; +var Reporter = __webpack_require__(23).Reporter; +var EncoderBuffer = __webpack_require__(23).EncoderBuffer; +var DecoderBuffer = __webpack_require__(23).DecoderBuffer; +var assert = __webpack_require__(26); - // Note: adler32 takes 12% for level 0 and 2% for level 6. - // It doesn't worth to make additional optimizationa as in original. - // Small size is preferable. +// Supported tags +var tags = [ + 'seq', 'seqof', 'set', 'setof', 'objid', 'bool', + 'gentime', 'utctime', 'null_', 'enum', 'int', 'objDesc', + 'bitstr', 'bmpstr', 'charstr', 'genstr', 'graphstr', 'ia5str', 'iso646str', + 'numstr', 'octstr', 'printstr', 't61str', 'unistr', 'utf8str', 'videostr' +]; - function adler32(adler, buf, len, pos) { - var s1 = (adler & 0xffff) |0, - s2 = ((adler >>> 16) & 0xffff) |0, - n = 0; +// Public methods list +var methods = [ + 'key', 'obj', 'use', 'optional', 'explicit', 'implicit', 'def', 'choice', + 'any', 'contains' +].concat(tags); - while (len !== 0) { - // Set limit ~ twice less than 5552, to keep - // s2 in 31-bits, because we force signed ints. - // in other case %= will fail. - n = len > 2000 ? 2000 : len; - len -= n; +// Overrided methods list +var overrided = [ + '_peekTag', '_decodeTag', '_use', + '_decodeStr', '_decodeObjid', '_decodeTime', + '_decodeNull', '_decodeInt', '_decodeBool', '_decodeList', - do { - s1 = (s1 + buf[pos++]) |0; - s2 = (s2 + s1) |0; - } while (--n); + '_encodeComposite', '_encodeStr', '_encodeObjid', '_encodeTime', + '_encodeNull', '_encodeInt', '_encodeBool' +]; - s1 %= 65521; - s2 %= 65521; - } +function Node(enc, parent) { + var state = {}; + this._baseState = state; - return (s1 | (s2 << 16)) |0; - } + state.enc = enc; + state.parent = parent || null; + state.children = null; - module.exports = adler32; + // State + state.tag = null; + state.args = null; + state.reverseArgs = null; + state.choice = null; + state.optional = false; + state.any = false; + state.obj = false; + state.use = null; + state.useDecoder = null; + state.key = null; + state['default'] = null; + state.explicit = null; + state.implicit = null; + state.contains = null; + + // Should create new instance on each method + if (!state.parent) { + state.children = []; + this._wrap(); + } +} +module.exports = Node; + +var stateProps = [ + 'enc', 'parent', 'children', 'tag', 'args', 'reverseArgs', 'choice', + 'optional', 'any', 'obj', 'use', 'alteredUse', 'key', 'default', 'explicit', + 'implicit', 'contains' +]; + +Node.prototype.clone = function clone() { + var state = this._baseState; + var cstate = {}; + stateProps.forEach(function(prop) { + cstate[prop] = state[prop]; + }); + var res = new this.constructor(cstate.parent); + res._baseState = cstate; + return res; +}; + +Node.prototype._wrap = function wrap() { + var state = this._baseState; + methods.forEach(function(method) { + this[method] = function _wrappedMethod() { + var clone = new this.constructor(this); + state.children.push(clone); + return clone[method].apply(clone, arguments); + }; + }, this); +}; + +Node.prototype._init = function init(body) { + var state = this._baseState; + + assert(state.parent === null); + body.call(this); + + // Filter children + state.children = state.children.filter(function(child) { + return child._baseState.parent === this; + }, this); + assert.equal(state.children.length, 1, 'Root node can have only one child'); +}; + +Node.prototype._useArgs = function useArgs(args) { + var state = this._baseState; + + // Filter children and args + var children = args.filter(function(arg) { + return arg instanceof this.constructor; + }, this); + args = args.filter(function(arg) { + return !(arg instanceof this.constructor); + }, this); + + if (children.length !== 0) { + assert(state.children === null); + state.children = children; + + // Replace parent to maintain backward link + children.forEach(function(child) { + child._baseState.parent = this; + }, this); + } + if (args.length !== 0) { + assert(state.args === null); + state.args = args; + state.reverseArgs = args.map(function(arg) { + if (typeof arg !== 'object' || arg.constructor !== Object) + return arg; + + var res = {}; + Object.keys(arg).forEach(function(key) { + if (key == (key | 0)) + key |= 0; + var value = arg[key]; + res[value] = key; + }); + return res; + }); + } +}; + +// +// Overrided methods +// + +overrided.forEach(function(method) { + Node.prototype[method] = function _overrided() { + var state = this._baseState; + throw new Error(method + ' not implemented for encoding: ' + state.enc); + }; +}); + +// +// Public methods +// + +tags.forEach(function(tag) { + Node.prototype[tag] = function _tagMethod() { + var state = this._baseState; + var args = Array.prototype.slice.call(arguments); + + assert(state.tag === null); + state.tag = tag; + + this._useArgs(args); + + return this; + }; +}); + +Node.prototype.use = function use(item) { + assert(item); + var state = this._baseState; + + assert(state.use === null); + state.use = item; + + return this; +}; + +Node.prototype.optional = function optional() { + var state = this._baseState; + + state.optional = true; + + return this; +}; + +Node.prototype.def = function def(val) { + var state = this._baseState; + + assert(state['default'] === null); + state['default'] = val; + state.optional = true; + + return this; +}; + +Node.prototype.explicit = function explicit(num) { + var state = this._baseState; + + assert(state.explicit === null && state.implicit === null); + state.explicit = num; + + return this; +}; + +Node.prototype.implicit = function implicit(num) { + var state = this._baseState; + + assert(state.explicit === null && state.implicit === null); + state.implicit = num; + + return this; +}; + +Node.prototype.obj = function obj() { + var state = this._baseState; + var args = Array.prototype.slice.call(arguments); + + state.obj = true; + + if (args.length !== 0) + this._useArgs(args); + + return this; +}; + +Node.prototype.key = function key(newKey) { + var state = this._baseState; + + assert(state.key === null); + state.key = newKey; + + return this; +}; + +Node.prototype.any = function any() { + var state = this._baseState; + + state.any = true; + + return this; +}; + +Node.prototype.choice = function choice(obj) { + var state = this._baseState; + + assert(state.choice === null); + state.choice = obj; + this._useArgs(Object.keys(obj).map(function(key) { + return obj[key]; + })); + + return this; +}; + +Node.prototype.contains = function contains(item) { + var state = this._baseState; + + assert(state.use === null); + state.contains = item; + + return this; +}; + +// +// Decoding +// + +Node.prototype._decode = function decode(input, options) { + var state = this._baseState; + + // Decode root node + if (state.parent === null) + return input.wrapResult(state.children[0]._decode(input, options)); + + var result = state['default']; + var present = true; + + var prevKey = null; + if (state.key !== null) + prevKey = input.enterKey(state.key); + + // Check if tag is there + if (state.optional) { + var tag = null; + if (state.explicit !== null) + tag = state.explicit; + else if (state.implicit !== null) + tag = state.implicit; + else if (state.tag !== null) + tag = state.tag; + + if (tag === null && !state.any) { + // Trial and Error + var save = input.save(); + try { + if (state.choice === null) + this._decodeGeneric(state.tag, input, options); + else + this._decodeChoice(input, options); + present = true; + } catch (e) { + present = false; + } + input.restore(save); + } else { + present = this._peekTag(input, tag, state.any); + + if (input.isError(present)) + return present; + } + } + + // Push object on stack + var prevObj; + if (state.obj && present) + prevObj = input.enterObject(); + + if (present) { + // Unwrap explicit values + if (state.explicit !== null) { + var explicit = this._decodeTag(input, state.explicit); + if (input.isError(explicit)) + return explicit; + input = explicit; + } + + var start = input.offset; + + // Unwrap implicit and normal values + if (state.use === null && state.choice === null) { + if (state.any) + var save = input.save(); + var body = this._decodeTag( + input, + state.implicit !== null ? state.implicit : state.tag, + state.any + ); + if (input.isError(body)) + return body; + + if (state.any) + result = input.raw(save); + else + input = body; + } + + if (options && options.track && state.tag !== null) + options.track(input.path(), start, input.length, 'tagged'); + + if (options && options.track && state.tag !== null) + options.track(input.path(), input.offset, input.length, 'content'); + + // Select proper method for tag + if (state.any) + result = result; + else if (state.choice === null) + result = this._decodeGeneric(state.tag, input, options); + else + result = this._decodeChoice(input, options); + + if (input.isError(result)) + return result; + + // Decode children + if (!state.any && state.choice === null && state.children !== null) { + state.children.forEach(function decodeChildren(child) { + // NOTE: We are ignoring errors here, to let parser continue with other + // parts of encoded data + child._decode(input, options); + }); + } + + // Decode contained/encoded by schema, only in bit or octet strings + if (state.contains && (state.tag === 'octstr' || state.tag === 'bitstr')) { + var data = new DecoderBuffer(result); + result = this._getUse(state.contains, input._reporterState.obj) + ._decode(data, options); + } + } + + // Pop object + if (state.obj && present) + result = input.leaveObject(prevObj); + + // Set key + if (state.key !== null && (result !== null || present === true)) + input.leaveKey(prevKey, state.key, result); + else if (prevKey !== null) + input.exitKey(prevKey); + + return result; +}; + +Node.prototype._decodeGeneric = function decodeGeneric(tag, input, options) { + var state = this._baseState; + + if (tag === 'seq' || tag === 'set') + return null; + if (tag === 'seqof' || tag === 'setof') + return this._decodeList(input, tag, state.args[0], options); + else if (/str$/.test(tag)) + return this._decodeStr(input, tag, options); + else if (tag === 'objid' && state.args) + return this._decodeObjid(input, state.args[0], state.args[1], options); + else if (tag === 'objid') + return this._decodeObjid(input, null, null, options); + else if (tag === 'gentime' || tag === 'utctime') + return this._decodeTime(input, tag, options); + else if (tag === 'null_') + return this._decodeNull(input, options); + else if (tag === 'bool') + return this._decodeBool(input, options); + else if (tag === 'objDesc') + return this._decodeStr(input, tag, options); + else if (tag === 'int' || tag === 'enum') + return this._decodeInt(input, state.args && state.args[0], options); + + if (state.use !== null) { + return this._getUse(state.use, input._reporterState.obj) + ._decode(input, options); + } else { + return input.error('unknown tag: ' + tag); + } +}; + +Node.prototype._getUse = function _getUse(entity, obj) { + + var state = this._baseState; + // Create altered use decoder if implicit is set + state.useDecoder = this._use(entity, obj); + assert(state.useDecoder._baseState.parent === null); + state.useDecoder = state.useDecoder._baseState.children[0]; + if (state.implicit !== state.useDecoder._baseState.implicit) { + state.useDecoder = state.useDecoder.clone(); + state.useDecoder._baseState.implicit = state.implicit; + } + return state.useDecoder; +}; + +Node.prototype._decodeChoice = function decodeChoice(input, options) { + var state = this._baseState; + var result = null; + var match = false; + + Object.keys(state.choice).some(function(key) { + var save = input.save(); + var node = state.choice[key]; + try { + var value = node._decode(input, options); + if (input.isError(value)) + return false; + + result = { type: key, value: value }; + match = true; + } catch (e) { + input.restore(save); + return false; + } + return true; + }, this); + + if (!match) + return input.error('Choice not matched'); + + return result; +}; + +// +// Encoding +// + +Node.prototype._createEncoderBuffer = function createEncoderBuffer(data) { + return new EncoderBuffer(data, this.reporter); +}; + +Node.prototype._encode = function encode(data, reporter, parent) { + var state = this._baseState; + if (state['default'] !== null && state['default'] === data) + return; + + var result = this._encodeValue(data, reporter, parent); + if (result === undefined) + return; + + if (this._skipDefault(result, reporter, parent)) + return; + + return result; +}; + +Node.prototype._encodeValue = function encode(data, reporter, parent) { + var state = this._baseState; + + // Decode root node + if (state.parent === null) + return state.children[0]._encode(data, reporter || new Reporter()); + + var result = null; + + // Set reporter to share it with a child class + this.reporter = reporter; + + // Check if data is there + if (state.optional && data === undefined) { + if (state['default'] !== null) + data = state['default'] + else + return; + } + + // Encode children first + var content = null; + var primitive = false; + if (state.any) { + // Anything that was given is translated to buffer + result = this._createEncoderBuffer(data); + } else if (state.choice) { + result = this._encodeChoice(data, reporter); + } else if (state.contains) { + content = this._getUse(state.contains, parent)._encode(data, reporter); + primitive = true; + } else if (state.children) { + content = state.children.map(function(child) { + if (child._baseState.tag === 'null_') + return child._encode(null, reporter, data); + + if (child._baseState.key === null) + return reporter.error('Child should have a key'); + var prevKey = reporter.enterKey(child._baseState.key); + + if (typeof data !== 'object') + return reporter.error('Child expected, but input is not object'); + + var res = child._encode(data[child._baseState.key], reporter, data); + reporter.leaveKey(prevKey); + + return res; + }, this).filter(function(child) { + return child; + }); + content = this._createEncoderBuffer(content); + } else { + if (state.tag === 'seqof' || state.tag === 'setof') { + // TODO(indutny): this should be thrown on DSL level + if (!(state.args && state.args.length === 1)) + return reporter.error('Too many args for : ' + state.tag); + + if (!Array.isArray(data)) + return reporter.error('seqof/setof, but data is not Array'); + + var child = this.clone(); + child._baseState.implicit = null; + content = this._createEncoderBuffer(data.map(function(item) { + var state = this._baseState; + + return this._getUse(state.args[0], data)._encode(item, reporter); + }, child)); + } else if (state.use !== null) { + result = this._getUse(state.use, parent)._encode(data, reporter); + } else { + content = this._encodePrimitive(state.tag, data); + primitive = true; + } + } + + // Encode data itself + var result; + if (!state.any && state.choice === null) { + var tag = state.implicit !== null ? state.implicit : state.tag; + var cls = state.implicit === null ? 'universal' : 'context'; + + if (tag === null) { + if (state.use === null) + reporter.error('Tag could be ommited only for .use()'); + } else { + if (state.use === null) + result = this._encodeComposite(tag, primitive, cls, content); + } + } + + // Wrap in explicit + if (state.explicit !== null) + result = this._encodeComposite(state.explicit, false, 'context', result); + + return result; +}; + +Node.prototype._encodeChoice = function encodeChoice(data, reporter) { + var state = this._baseState; + + var node = state.choice[data.type]; + if (!node) { + assert( + false, + data.type + ' not found in ' + + JSON.stringify(Object.keys(state.choice))); + } + return node._encode(data.value, reporter); +}; + +Node.prototype._encodePrimitive = function encodePrimitive(tag, data) { + var state = this._baseState; + + if (/str$/.test(tag)) + return this._encodeStr(data, tag); + else if (tag === 'objid' && state.args) + return this._encodeObjid(data, state.reverseArgs[0], state.args[1]); + else if (tag === 'objid') + return this._encodeObjid(data, null, null); + else if (tag === 'gentime' || tag === 'utctime') + return this._encodeTime(data, tag); + else if (tag === 'null_') + return this._encodeNull(); + else if (tag === 'int' || tag === 'enum') + return this._encodeInt(data, state.args && state.reverseArgs[0]); + else if (tag === 'bool') + return this._encodeBool(data); + else if (tag === 'objDesc') + return this._encodeStr(data, tag); + else + throw new Error('Unsupported tag: ' + tag); +}; + +Node.prototype._isNumstr = function isNumstr(str) { + return /^[0-9 ]*$/.test(str); +}; + +Node.prototype._isPrintstr = function isPrintstr(str) { + return /^[A-Za-z0-9 '\(\)\+,\-\.\/:=\?]*$/.test(str); +}; /***/ }, /* 141 */ -/***/ function(module, exports) { +/***/ function(module, exports, __webpack_require__) { - 'use strict'; +var inherits = __webpack_require__(1); - // Note: we can't get significant speed boost here. - // So write code to minimize size - no pregenerated tables - // and array tools dependencies. +function Reporter(options) { + this._reporterState = { + obj: null, + path: [], + options: options || {}, + errors: [] + }; +} +exports.Reporter = Reporter; +Reporter.prototype.isError = function isError(obj) { + return obj instanceof ReporterError; +}; - // Use ordinary array, since untyped makes no boost here - function makeTable() { - var c, table = []; +Reporter.prototype.save = function save() { + var state = this._reporterState; - for (var n = 0; n < 256; n++) { - c = n; - for (var k = 0; k < 8; k++) { - c = ((c & 1) ? (0xEDB88320 ^ (c >>> 1)) : (c >>> 1)); - } - table[n] = c; - } + return { obj: state.obj, pathLen: state.path.length }; +}; - return table; - } +Reporter.prototype.restore = function restore(data) { + var state = this._reporterState; - // Create table on load. Just 255 signed longs. Not a problem. - var crcTable = makeTable(); + state.obj = data.obj; + state.path = state.path.slice(0, data.pathLen); +}; +Reporter.prototype.enterKey = function enterKey(key) { + return this._reporterState.path.push(key); +}; - function crc32(crc, buf, len, pos) { - var t = crcTable, - end = pos + len; +Reporter.prototype.exitKey = function exitKey(index) { + var state = this._reporterState; - crc ^= -1; + state.path = state.path.slice(0, index - 1); +}; - for (var i = pos; i < end; i++) { - crc = (crc >>> 8) ^ t[(crc ^ buf[i]) & 0xFF]; - } +Reporter.prototype.leaveKey = function leaveKey(index, key, value) { + var state = this._reporterState; - return (crc ^ (-1)); // >>> 0; - } + this.exitKey(index); + if (state.obj !== null) + state.obj[key] = value; +}; +Reporter.prototype.path = function path() { + return this._reporterState.path.join('/'); +}; - module.exports = crc32; +Reporter.prototype.enterObject = function enterObject() { + var state = this._reporterState; + + var prev = state.obj; + state.obj = {}; + return prev; +}; + +Reporter.prototype.leaveObject = function leaveObject(prev) { + var state = this._reporterState; + + var now = state.obj; + state.obj = prev; + return now; +}; + +Reporter.prototype.error = function error(msg) { + var err; + var state = this._reporterState; + + var inherited = msg instanceof ReporterError; + if (inherited) { + err = msg; + } else { + err = new ReporterError(state.path.map(function(elem) { + return '[' + JSON.stringify(elem) + ']'; + }).join(''), msg.message || msg, msg.stack); + } + + if (!state.options.partial) + throw err; + + if (!inherited) + state.errors.push(err); + + return err; +}; + +Reporter.prototype.wrapResult = function wrapResult(result) { + var state = this._reporterState; + if (!state.options.partial) + return result; + + return { + result: this.isError(result) ? null : result, + errors: state.errors + }; +}; + +function ReporterError(path, msg) { + this.path = path; + this.rethrow(msg); +}; +inherits(ReporterError, Error); + +ReporterError.prototype.rethrow = function rethrow(msg) { + this.message = msg + ' at: ' + (this.path || '(shallow)'); + if (Error.captureStackTrace) + Error.captureStackTrace(this, ReporterError); + + if (!this.stack) { + try { + // IE only adds stack when thrown + throw new Error(this.message); + } catch (e) { + this.stack = e.stack; + } + } + return this; +}; /***/ }, /* 142 */ /***/ function(module, exports, __webpack_require__) { - 'use strict'; - - - var utils = __webpack_require__(138); - var adler32 = __webpack_require__(140); - var crc32 = __webpack_require__(141); - var inflate_fast = __webpack_require__(143); - var inflate_table = __webpack_require__(144); - - var CODES = 0; - var LENS = 1; - var DISTS = 2; - - /* Public constants ==========================================================*/ - /* ===========================================================================*/ - - - /* Allowed flush values; see deflate() and inflate() below for details */ - //var Z_NO_FLUSH = 0; - //var Z_PARTIAL_FLUSH = 1; - //var Z_SYNC_FLUSH = 2; - //var Z_FULL_FLUSH = 3; - var Z_FINISH = 4; - var Z_BLOCK = 5; - var Z_TREES = 6; - - - /* Return codes for the compression/decompression functions. Negative values - * are errors, positive values are used for special but normal events. - */ - var Z_OK = 0; - var Z_STREAM_END = 1; - var Z_NEED_DICT = 2; - //var Z_ERRNO = -1; - var Z_STREAM_ERROR = -2; - var Z_DATA_ERROR = -3; - var Z_MEM_ERROR = -4; - var Z_BUF_ERROR = -5; - //var Z_VERSION_ERROR = -6; - - /* The deflate compression method */ - var Z_DEFLATED = 8; - - - /* STATES ====================================================================*/ - /* ===========================================================================*/ - - - var HEAD = 1; /* i: waiting for magic header */ - var FLAGS = 2; /* i: waiting for method and flags (gzip) */ - var TIME = 3; /* i: waiting for modification time (gzip) */ - var OS = 4; /* i: waiting for extra flags and operating system (gzip) */ - var EXLEN = 5; /* i: waiting for extra length (gzip) */ - var EXTRA = 6; /* i: waiting for extra bytes (gzip) */ - var NAME = 7; /* i: waiting for end of file name (gzip) */ - var COMMENT = 8; /* i: waiting for end of comment (gzip) */ - var HCRC = 9; /* i: waiting for header crc (gzip) */ - var DICTID = 10; /* i: waiting for dictionary check value */ - var DICT = 11; /* waiting for inflateSetDictionary() call */ - var TYPE = 12; /* i: waiting for type bits, including last-flag bit */ - var TYPEDO = 13; /* i: same, but skip check to exit inflate on new block */ - var STORED = 14; /* i: waiting for stored size (length and complement) */ - var COPY_ = 15; /* i/o: same as COPY below, but only first time in */ - var COPY = 16; /* i/o: waiting for input or output to copy stored block */ - var TABLE = 17; /* i: waiting for dynamic block table lengths */ - var LENLENS = 18; /* i: waiting for code length code lengths */ - var CODELENS = 19; /* i: waiting for length/lit and distance code lengths */ - var LEN_ = 20; /* i: same as LEN below, but only first time in */ - var LEN = 21; /* i: waiting for length/lit/eob code */ - var LENEXT = 22; /* i: waiting for length extra bits */ - var DIST = 23; /* i: waiting for distance code */ - var DISTEXT = 24; /* i: waiting for distance extra bits */ - var MATCH = 25; /* o: waiting for output space to copy string */ - var LIT = 26; /* o: waiting for output space to write literal */ - var CHECK = 27; /* i: waiting for 32-bit check value */ - var LENGTH = 28; /* i: waiting for 32-bit length (gzip) */ - var DONE = 29; /* finished check, done -- remain here until reset */ - var BAD = 30; /* got a data error -- remain here until reset */ - var MEM = 31; /* got an inflate() memory error -- remain here until reset */ - var SYNC = 32; /* looking for synchronization bytes to restart inflate() */ - - /* ===========================================================================*/ - - - - var ENOUGH_LENS = 852; - var ENOUGH_DISTS = 592; - //var ENOUGH = (ENOUGH_LENS+ENOUGH_DISTS); - - var MAX_WBITS = 15; - /* 32K LZ77 window */ - var DEF_WBITS = MAX_WBITS; - - - function zswap32(q) { - return (((q >>> 24) & 0xff) + - ((q >>> 8) & 0xff00) + - ((q & 0xff00) << 8) + - ((q & 0xff) << 24)); - } - - - function InflateState() { - this.mode = 0; /* current inflate mode */ - this.last = false; /* true if processing last block */ - this.wrap = 0; /* bit 0 true for zlib, bit 1 true for gzip */ - this.havedict = false; /* true if dictionary provided */ - this.flags = 0; /* gzip header method and flags (0 if zlib) */ - this.dmax = 0; /* zlib header max distance (INFLATE_STRICT) */ - this.check = 0; /* protected copy of check value */ - this.total = 0; /* protected copy of output count */ - // TODO: may be {} - this.head = null; /* where to save gzip header information */ - - /* sliding window */ - this.wbits = 0; /* log base 2 of requested window size */ - this.wsize = 0; /* window size or zero if not using window */ - this.whave = 0; /* valid bytes in the window */ - this.wnext = 0; /* window write index */ - this.window = null; /* allocated sliding window, if needed */ - - /* bit accumulator */ - this.hold = 0; /* input bit accumulator */ - this.bits = 0; /* number of bits in "in" */ - - /* for string and stored block copying */ - this.length = 0; /* literal or length of data to copy */ - this.offset = 0; /* distance back to copy string from */ - - /* for table and code decoding */ - this.extra = 0; /* extra bits needed */ - - /* fixed and dynamic code tables */ - this.lencode = null; /* starting table for length/literal codes */ - this.distcode = null; /* starting table for distance codes */ - this.lenbits = 0; /* index bits for lencode */ - this.distbits = 0; /* index bits for distcode */ - - /* dynamic table building */ - this.ncode = 0; /* number of code length code lengths */ - this.nlen = 0; /* number of length code lengths */ - this.ndist = 0; /* number of distance code lengths */ - this.have = 0; /* number of code lengths in lens[] */ - this.next = null; /* next available space in codes[] */ - - this.lens = new utils.Buf16(320); /* temporary storage for code lengths */ - this.work = new utils.Buf16(288); /* work area for code table building */ - - /* - because we don't have pointers in js, we use lencode and distcode directly - as buffers so we don't need codes - */ - //this.codes = new utils.Buf32(ENOUGH); /* space for code tables */ - this.lendyn = null; /* dynamic table for length/literal codes (JS specific) */ - this.distdyn = null; /* dynamic table for distance codes (JS specific) */ - this.sane = 0; /* if false, allow invalid distance too far */ - this.back = 0; /* bits back of last unprocessed length/lit */ - this.was = 0; /* initial length of match */ - } - - function inflateResetKeep(strm) { - var state; - - if (!strm || !strm.state) { return Z_STREAM_ERROR; } - state = strm.state; - strm.total_in = strm.total_out = state.total = 0; - strm.msg = ''; /*Z_NULL*/ - if (state.wrap) { /* to support ill-conceived Java test suite */ - strm.adler = state.wrap & 1; - } - state.mode = HEAD; - state.last = 0; - state.havedict = 0; - state.dmax = 32768; - state.head = null/*Z_NULL*/; - state.hold = 0; - state.bits = 0; - //state.lencode = state.distcode = state.next = state.codes; - state.lencode = state.lendyn = new utils.Buf32(ENOUGH_LENS); - state.distcode = state.distdyn = new utils.Buf32(ENOUGH_DISTS); - - state.sane = 1; - state.back = -1; - //Tracev((stderr, "inflate: reset\n")); - return Z_OK; - } - - function inflateReset(strm) { - var state; - - if (!strm || !strm.state) { return Z_STREAM_ERROR; } - state = strm.state; - state.wsize = 0; - state.whave = 0; - state.wnext = 0; - return inflateResetKeep(strm); - - } - - function inflateReset2(strm, windowBits) { - var wrap; - var state; - - /* get the state */ - if (!strm || !strm.state) { return Z_STREAM_ERROR; } - state = strm.state; - - /* extract wrap request from windowBits parameter */ - if (windowBits < 0) { - wrap = 0; - windowBits = -windowBits; - } - else { - wrap = (windowBits >> 4) + 1; - if (windowBits < 48) { - windowBits &= 15; - } - } - - /* set number of window bits, free window if different */ - if (windowBits && (windowBits < 8 || windowBits > 15)) { - return Z_STREAM_ERROR; - } - if (state.window !== null && state.wbits !== windowBits) { - state.window = null; - } - - /* update state and reset the rest of it */ - state.wrap = wrap; - state.wbits = windowBits; - return inflateReset(strm); - } - - function inflateInit2(strm, windowBits) { - var ret; - var state; - - if (!strm) { return Z_STREAM_ERROR; } - //strm.msg = Z_NULL; /* in case we return an error */ - - state = new InflateState(); - - //if (state === Z_NULL) return Z_MEM_ERROR; - //Tracev((stderr, "inflate: allocated\n")); - strm.state = state; - state.window = null/*Z_NULL*/; - ret = inflateReset2(strm, windowBits); - if (ret !== Z_OK) { - strm.state = null/*Z_NULL*/; - } - return ret; - } - - function inflateInit(strm) { - return inflateInit2(strm, DEF_WBITS); - } - - - /* - Return state with length and distance decoding tables and index sizes set to - fixed code decoding. Normally this returns fixed tables from inffixed.h. - If BUILDFIXED is defined, then instead this routine builds the tables the - first time it's called, and returns those tables the first time and - thereafter. This reduces the size of the code by about 2K bytes, in - exchange for a little execution time. However, BUILDFIXED should not be - used for threaded applications, since the rewriting of the tables and virgin - may not be thread-safe. - */ - var virgin = true; - - var lenfix, distfix; // We have no pointers in JS, so keep tables separate - - function fixedtables(state) { - /* build fixed huffman tables if first call (may not be thread safe) */ - if (virgin) { - var sym; - - lenfix = new utils.Buf32(512); - distfix = new utils.Buf32(32); - - /* literal/length table */ - sym = 0; - while (sym < 144) { state.lens[sym++] = 8; } - while (sym < 256) { state.lens[sym++] = 9; } - while (sym < 280) { state.lens[sym++] = 7; } - while (sym < 288) { state.lens[sym++] = 8; } - - inflate_table(LENS, state.lens, 0, 288, lenfix, 0, state.work, { bits: 9 }); - - /* distance table */ - sym = 0; - while (sym < 32) { state.lens[sym++] = 5; } - - inflate_table(DISTS, state.lens, 0, 32, distfix, 0, state.work, { bits: 5 }); - - /* do this just once */ - virgin = false; - } - - state.lencode = lenfix; - state.lenbits = 9; - state.distcode = distfix; - state.distbits = 5; - } - - - /* - Update the window with the last wsize (normally 32K) bytes written before - returning. If window does not exist yet, create it. This is only called - when a window is already in use, or when output has been written during this - inflate call, but the end of the deflate stream has not been reached yet. - It is also called to create a window for dictionary data when a dictionary - is loaded. - - Providing output buffers larger than 32K to inflate() should provide a speed - advantage, since only the last 32K of output is copied to the sliding window - upon return from inflate(), and since all distances after the first 32K of - output will fall in the output data, making match copies simpler and faster. - The advantage may be dependent on the size of the processor's data caches. - */ - function updatewindow(strm, src, end, copy) { - var dist; - var state = strm.state; - - /* if it hasn't been done already, allocate space for the window */ - if (state.window === null) { - state.wsize = 1 << state.wbits; - state.wnext = 0; - state.whave = 0; - - state.window = new utils.Buf8(state.wsize); - } - - /* copy state->wsize or less output bytes into the circular window */ - if (copy >= state.wsize) { - utils.arraySet(state.window, src, end - state.wsize, state.wsize, 0); - state.wnext = 0; - state.whave = state.wsize; - } - else { - dist = state.wsize - state.wnext; - if (dist > copy) { - dist = copy; - } - //zmemcpy(state->window + state->wnext, end - copy, dist); - utils.arraySet(state.window, src, end - copy, dist, state.wnext); - copy -= dist; - if (copy) { - //zmemcpy(state->window, end - copy, copy); - utils.arraySet(state.window, src, end - copy, copy, 0); - state.wnext = copy; - state.whave = state.wsize; - } - else { - state.wnext += dist; - if (state.wnext === state.wsize) { state.wnext = 0; } - if (state.whave < state.wsize) { state.whave += dist; } - } - } - return 0; - } - - function inflate(strm, flush) { - var state; - var input, output; // input/output buffers - var next; /* next input INDEX */ - var put; /* next output INDEX */ - var have, left; /* available input and output */ - var hold; /* bit buffer */ - var bits; /* bits in bit buffer */ - var _in, _out; /* save starting available input and output */ - var copy; /* number of stored or match bytes to copy */ - var from; /* where to copy match bytes from */ - var from_source; - var here = 0; /* current decoding table entry */ - var here_bits, here_op, here_val; // paked "here" denormalized (JS specific) - //var last; /* parent table entry */ - var last_bits, last_op, last_val; // paked "last" denormalized (JS specific) - var len; /* length to copy for repeats, bits to drop */ - var ret; /* return code */ - var hbuf = new utils.Buf8(4); /* buffer for gzip header crc calculation */ - var opts; - - var n; // temporary var for NEED_BITS - - var order = /* permutation of code lengths */ - [ 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 ]; - - - if (!strm || !strm.state || !strm.output || - (!strm.input && strm.avail_in !== 0)) { - return Z_STREAM_ERROR; - } - - state = strm.state; - if (state.mode === TYPE) { state.mode = TYPEDO; } /* skip check */ - - - //--- LOAD() --- - put = strm.next_out; - output = strm.output; - left = strm.avail_out; - next = strm.next_in; - input = strm.input; - have = strm.avail_in; - hold = state.hold; - bits = state.bits; - //--- - - _in = have; - _out = left; - ret = Z_OK; - - inf_leave: // goto emulation - for (;;) { - switch (state.mode) { - case HEAD: - if (state.wrap === 0) { - state.mode = TYPEDO; - break; - } - //=== NEEDBITS(16); - while (bits < 16) { - if (have === 0) { break inf_leave; } - have--; - hold += input[next++] << bits; - bits += 8; - } - //===// - if ((state.wrap & 2) && hold === 0x8b1f) { /* gzip header */ - state.check = 0/*crc32(0L, Z_NULL, 0)*/; - //=== CRC2(state.check, hold); - hbuf[0] = hold & 0xff; - hbuf[1] = (hold >>> 8) & 0xff; - state.check = crc32(state.check, hbuf, 2, 0); - //===// - - //=== INITBITS(); - hold = 0; - bits = 0; - //===// - state.mode = FLAGS; - break; - } - state.flags = 0; /* expect zlib header */ - if (state.head) { - state.head.done = false; - } - if (!(state.wrap & 1) || /* check if zlib header allowed */ - (((hold & 0xff)/*BITS(8)*/ << 8) + (hold >> 8)) % 31) { - strm.msg = 'incorrect header check'; - state.mode = BAD; - break; - } - if ((hold & 0x0f)/*BITS(4)*/ !== Z_DEFLATED) { - strm.msg = 'unknown compression method'; - state.mode = BAD; - break; - } - //--- DROPBITS(4) ---// - hold >>>= 4; - bits -= 4; - //---// - len = (hold & 0x0f)/*BITS(4)*/ + 8; - if (state.wbits === 0) { - state.wbits = len; - } - else if (len > state.wbits) { - strm.msg = 'invalid window size'; - state.mode = BAD; - break; - } - state.dmax = 1 << len; - //Tracev((stderr, "inflate: zlib header ok\n")); - strm.adler = state.check = 1/*adler32(0L, Z_NULL, 0)*/; - state.mode = hold & 0x200 ? DICTID : TYPE; - //=== INITBITS(); - hold = 0; - bits = 0; - //===// - break; - case FLAGS: - //=== NEEDBITS(16); */ - while (bits < 16) { - if (have === 0) { break inf_leave; } - have--; - hold += input[next++] << bits; - bits += 8; - } - //===// - state.flags = hold; - if ((state.flags & 0xff) !== Z_DEFLATED) { - strm.msg = 'unknown compression method'; - state.mode = BAD; - break; - } - if (state.flags & 0xe000) { - strm.msg = 'unknown header flags set'; - state.mode = BAD; - break; - } - if (state.head) { - state.head.text = ((hold >> 8) & 1); - } - if (state.flags & 0x0200) { - //=== CRC2(state.check, hold); - hbuf[0] = hold & 0xff; - hbuf[1] = (hold >>> 8) & 0xff; - state.check = crc32(state.check, hbuf, 2, 0); - //===// - } - //=== INITBITS(); - hold = 0; - bits = 0; - //===// - state.mode = TIME; - /* falls through */ - case TIME: - //=== NEEDBITS(32); */ - while (bits < 32) { - if (have === 0) { break inf_leave; } - have--; - hold += input[next++] << bits; - bits += 8; - } - //===// - if (state.head) { - state.head.time = hold; - } - if (state.flags & 0x0200) { - //=== CRC4(state.check, hold) - hbuf[0] = hold & 0xff; - hbuf[1] = (hold >>> 8) & 0xff; - hbuf[2] = (hold >>> 16) & 0xff; - hbuf[3] = (hold >>> 24) & 0xff; - state.check = crc32(state.check, hbuf, 4, 0); - //=== - } - //=== INITBITS(); - hold = 0; - bits = 0; - //===// - state.mode = OS; - /* falls through */ - case OS: - //=== NEEDBITS(16); */ - while (bits < 16) { - if (have === 0) { break inf_leave; } - have--; - hold += input[next++] << bits; - bits += 8; - } - //===// - if (state.head) { - state.head.xflags = (hold & 0xff); - state.head.os = (hold >> 8); - } - if (state.flags & 0x0200) { - //=== CRC2(state.check, hold); - hbuf[0] = hold & 0xff; - hbuf[1] = (hold >>> 8) & 0xff; - state.check = crc32(state.check, hbuf, 2, 0); - //===// - } - //=== INITBITS(); - hold = 0; - bits = 0; - //===// - state.mode = EXLEN; - /* falls through */ - case EXLEN: - if (state.flags & 0x0400) { - //=== NEEDBITS(16); */ - while (bits < 16) { - if (have === 0) { break inf_leave; } - have--; - hold += input[next++] << bits; - bits += 8; - } - //===// - state.length = hold; - if (state.head) { - state.head.extra_len = hold; - } - if (state.flags & 0x0200) { - //=== CRC2(state.check, hold); - hbuf[0] = hold & 0xff; - hbuf[1] = (hold >>> 8) & 0xff; - state.check = crc32(state.check, hbuf, 2, 0); - //===// - } - //=== INITBITS(); - hold = 0; - bits = 0; - //===// - } - else if (state.head) { - state.head.extra = null/*Z_NULL*/; - } - state.mode = EXTRA; - /* falls through */ - case EXTRA: - if (state.flags & 0x0400) { - copy = state.length; - if (copy > have) { copy = have; } - if (copy) { - if (state.head) { - len = state.head.extra_len - state.length; - if (!state.head.extra) { - // Use untyped array for more conveniend processing later - state.head.extra = new Array(state.head.extra_len); - } - utils.arraySet( - state.head.extra, - input, - next, - // extra field is limited to 65536 bytes - // - no need for additional size check - copy, - /*len + copy > state.head.extra_max - len ? state.head.extra_max : copy,*/ - len - ); - //zmemcpy(state.head.extra + len, next, - // len + copy > state.head.extra_max ? - // state.head.extra_max - len : copy); - } - if (state.flags & 0x0200) { - state.check = crc32(state.check, input, copy, next); - } - have -= copy; - next += copy; - state.length -= copy; - } - if (state.length) { break inf_leave; } - } - state.length = 0; - state.mode = NAME; - /* falls through */ - case NAME: - if (state.flags & 0x0800) { - if (have === 0) { break inf_leave; } - copy = 0; - do { - // TODO: 2 or 1 bytes? - len = input[next + copy++]; - /* use constant limit because in js we should not preallocate memory */ - if (state.head && len && - (state.length < 65536 /*state.head.name_max*/)) { - state.head.name += String.fromCharCode(len); - } - } while (len && copy < have); - - if (state.flags & 0x0200) { - state.check = crc32(state.check, input, copy, next); - } - have -= copy; - next += copy; - if (len) { break inf_leave; } - } - else if (state.head) { - state.head.name = null; - } - state.length = 0; - state.mode = COMMENT; - /* falls through */ - case COMMENT: - if (state.flags & 0x1000) { - if (have === 0) { break inf_leave; } - copy = 0; - do { - len = input[next + copy++]; - /* use constant limit because in js we should not preallocate memory */ - if (state.head && len && - (state.length < 65536 /*state.head.comm_max*/)) { - state.head.comment += String.fromCharCode(len); - } - } while (len && copy < have); - if (state.flags & 0x0200) { - state.check = crc32(state.check, input, copy, next); - } - have -= copy; - next += copy; - if (len) { break inf_leave; } - } - else if (state.head) { - state.head.comment = null; - } - state.mode = HCRC; - /* falls through */ - case HCRC: - if (state.flags & 0x0200) { - //=== NEEDBITS(16); */ - while (bits < 16) { - if (have === 0) { break inf_leave; } - have--; - hold += input[next++] << bits; - bits += 8; - } - //===// - if (hold !== (state.check & 0xffff)) { - strm.msg = 'header crc mismatch'; - state.mode = BAD; - break; - } - //=== INITBITS(); - hold = 0; - bits = 0; - //===// - } - if (state.head) { - state.head.hcrc = ((state.flags >> 9) & 1); - state.head.done = true; - } - strm.adler = state.check = 0; - state.mode = TYPE; - break; - case DICTID: - //=== NEEDBITS(32); */ - while (bits < 32) { - if (have === 0) { break inf_leave; } - have--; - hold += input[next++] << bits; - bits += 8; - } - //===// - strm.adler = state.check = zswap32(hold); - //=== INITBITS(); - hold = 0; - bits = 0; - //===// - state.mode = DICT; - /* falls through */ - case DICT: - if (state.havedict === 0) { - //--- RESTORE() --- - strm.next_out = put; - strm.avail_out = left; - strm.next_in = next; - strm.avail_in = have; - state.hold = hold; - state.bits = bits; - //--- - return Z_NEED_DICT; - } - strm.adler = state.check = 1/*adler32(0L, Z_NULL, 0)*/; - state.mode = TYPE; - /* falls through */ - case TYPE: - if (flush === Z_BLOCK || flush === Z_TREES) { break inf_leave; } - /* falls through */ - case TYPEDO: - if (state.last) { - //--- BYTEBITS() ---// - hold >>>= bits & 7; - bits -= bits & 7; - //---// - state.mode = CHECK; - break; - } - //=== NEEDBITS(3); */ - while (bits < 3) { - if (have === 0) { break inf_leave; } - have--; - hold += input[next++] << bits; - bits += 8; - } - //===// - state.last = (hold & 0x01)/*BITS(1)*/; - //--- DROPBITS(1) ---// - hold >>>= 1; - bits -= 1; - //---// - - switch ((hold & 0x03)/*BITS(2)*/) { - case 0: /* stored block */ - //Tracev((stderr, "inflate: stored block%s\n", - // state.last ? " (last)" : "")); - state.mode = STORED; - break; - case 1: /* fixed block */ - fixedtables(state); - //Tracev((stderr, "inflate: fixed codes block%s\n", - // state.last ? " (last)" : "")); - state.mode = LEN_; /* decode codes */ - if (flush === Z_TREES) { - //--- DROPBITS(2) ---// - hold >>>= 2; - bits -= 2; - //---// - break inf_leave; - } - break; - case 2: /* dynamic block */ - //Tracev((stderr, "inflate: dynamic codes block%s\n", - // state.last ? " (last)" : "")); - state.mode = TABLE; - break; - case 3: - strm.msg = 'invalid block type'; - state.mode = BAD; - } - //--- DROPBITS(2) ---// - hold >>>= 2; - bits -= 2; - //---// - break; - case STORED: - //--- BYTEBITS() ---// /* go to byte boundary */ - hold >>>= bits & 7; - bits -= bits & 7; - //---// - //=== NEEDBITS(32); */ - while (bits < 32) { - if (have === 0) { break inf_leave; } - have--; - hold += input[next++] << bits; - bits += 8; - } - //===// - if ((hold & 0xffff) !== ((hold >>> 16) ^ 0xffff)) { - strm.msg = 'invalid stored block lengths'; - state.mode = BAD; - break; - } - state.length = hold & 0xffff; - //Tracev((stderr, "inflate: stored length %u\n", - // state.length)); - //=== INITBITS(); - hold = 0; - bits = 0; - //===// - state.mode = COPY_; - if (flush === Z_TREES) { break inf_leave; } - /* falls through */ - case COPY_: - state.mode = COPY; - /* falls through */ - case COPY: - copy = state.length; - if (copy) { - if (copy > have) { copy = have; } - if (copy > left) { copy = left; } - if (copy === 0) { break inf_leave; } - //--- zmemcpy(put, next, copy); --- - utils.arraySet(output, input, next, copy, put); - //---// - have -= copy; - next += copy; - left -= copy; - put += copy; - state.length -= copy; - break; - } - //Tracev((stderr, "inflate: stored end\n")); - state.mode = TYPE; - break; - case TABLE: - //=== NEEDBITS(14); */ - while (bits < 14) { - if (have === 0) { break inf_leave; } - have--; - hold += input[next++] << bits; - bits += 8; - } - //===// - state.nlen = (hold & 0x1f)/*BITS(5)*/ + 257; - //--- DROPBITS(5) ---// - hold >>>= 5; - bits -= 5; - //---// - state.ndist = (hold & 0x1f)/*BITS(5)*/ + 1; - //--- DROPBITS(5) ---// - hold >>>= 5; - bits -= 5; - //---// - state.ncode = (hold & 0x0f)/*BITS(4)*/ + 4; - //--- DROPBITS(4) ---// - hold >>>= 4; - bits -= 4; - //---// - //#ifndef PKZIP_BUG_WORKAROUND - if (state.nlen > 286 || state.ndist > 30) { - strm.msg = 'too many length or distance symbols'; - state.mode = BAD; - break; - } - //#endif - //Tracev((stderr, "inflate: table sizes ok\n")); - state.have = 0; - state.mode = LENLENS; - /* falls through */ - case LENLENS: - while (state.have < state.ncode) { - //=== NEEDBITS(3); - while (bits < 3) { - if (have === 0) { break inf_leave; } - have--; - hold += input[next++] << bits; - bits += 8; - } - //===// - state.lens[order[state.have++]] = (hold & 0x07);//BITS(3); - //--- DROPBITS(3) ---// - hold >>>= 3; - bits -= 3; - //---// - } - while (state.have < 19) { - state.lens[order[state.have++]] = 0; - } - // We have separate tables & no pointers. 2 commented lines below not needed. - //state.next = state.codes; - //state.lencode = state.next; - // Switch to use dynamic table - state.lencode = state.lendyn; - state.lenbits = 7; - - opts = { bits: state.lenbits }; - ret = inflate_table(CODES, state.lens, 0, 19, state.lencode, 0, state.work, opts); - state.lenbits = opts.bits; - - if (ret) { - strm.msg = 'invalid code lengths set'; - state.mode = BAD; - break; - } - //Tracev((stderr, "inflate: code lengths ok\n")); - state.have = 0; - state.mode = CODELENS; - /* falls through */ - case CODELENS: - while (state.have < state.nlen + state.ndist) { - for (;;) { - here = state.lencode[hold & ((1 << state.lenbits) - 1)];/*BITS(state.lenbits)*/ - here_bits = here >>> 24; - here_op = (here >>> 16) & 0xff; - here_val = here & 0xffff; - - if ((here_bits) <= bits) { break; } - //--- PULLBYTE() ---// - if (have === 0) { break inf_leave; } - have--; - hold += input[next++] << bits; - bits += 8; - //---// - } - if (here_val < 16) { - //--- DROPBITS(here.bits) ---// - hold >>>= here_bits; - bits -= here_bits; - //---// - state.lens[state.have++] = here_val; - } - else { - if (here_val === 16) { - //=== NEEDBITS(here.bits + 2); - n = here_bits + 2; - while (bits < n) { - if (have === 0) { break inf_leave; } - have--; - hold += input[next++] << bits; - bits += 8; - } - //===// - //--- DROPBITS(here.bits) ---// - hold >>>= here_bits; - bits -= here_bits; - //---// - if (state.have === 0) { - strm.msg = 'invalid bit length repeat'; - state.mode = BAD; - break; - } - len = state.lens[state.have - 1]; - copy = 3 + (hold & 0x03);//BITS(2); - //--- DROPBITS(2) ---// - hold >>>= 2; - bits -= 2; - //---// - } - else if (here_val === 17) { - //=== NEEDBITS(here.bits + 3); - n = here_bits + 3; - while (bits < n) { - if (have === 0) { break inf_leave; } - have--; - hold += input[next++] << bits; - bits += 8; - } - //===// - //--- DROPBITS(here.bits) ---// - hold >>>= here_bits; - bits -= here_bits; - //---// - len = 0; - copy = 3 + (hold & 0x07);//BITS(3); - //--- DROPBITS(3) ---// - hold >>>= 3; - bits -= 3; - //---// - } - else { - //=== NEEDBITS(here.bits + 7); - n = here_bits + 7; - while (bits < n) { - if (have === 0) { break inf_leave; } - have--; - hold += input[next++] << bits; - bits += 8; - } - //===// - //--- DROPBITS(here.bits) ---// - hold >>>= here_bits; - bits -= here_bits; - //---// - len = 0; - copy = 11 + (hold & 0x7f);//BITS(7); - //--- DROPBITS(7) ---// - hold >>>= 7; - bits -= 7; - //---// - } - if (state.have + copy > state.nlen + state.ndist) { - strm.msg = 'invalid bit length repeat'; - state.mode = BAD; - break; - } - while (copy--) { - state.lens[state.have++] = len; - } - } - } - - /* handle error breaks in while */ - if (state.mode === BAD) { break; } - - /* check for end-of-block code (better have one) */ - if (state.lens[256] === 0) { - strm.msg = 'invalid code -- missing end-of-block'; - state.mode = BAD; - break; - } - - /* build code tables -- note: do not change the lenbits or distbits - values here (9 and 6) without reading the comments in inftrees.h - concerning the ENOUGH constants, which depend on those values */ - state.lenbits = 9; - - opts = { bits: state.lenbits }; - ret = inflate_table(LENS, state.lens, 0, state.nlen, state.lencode, 0, state.work, opts); - // We have separate tables & no pointers. 2 commented lines below not needed. - // state.next_index = opts.table_index; - state.lenbits = opts.bits; - // state.lencode = state.next; - - if (ret) { - strm.msg = 'invalid literal/lengths set'; - state.mode = BAD; - break; - } - - state.distbits = 6; - //state.distcode.copy(state.codes); - // Switch to use dynamic table - state.distcode = state.distdyn; - opts = { bits: state.distbits }; - ret = inflate_table(DISTS, state.lens, state.nlen, state.ndist, state.distcode, 0, state.work, opts); - // We have separate tables & no pointers. 2 commented lines below not needed. - // state.next_index = opts.table_index; - state.distbits = opts.bits; - // state.distcode = state.next; - - if (ret) { - strm.msg = 'invalid distances set'; - state.mode = BAD; - break; - } - //Tracev((stderr, 'inflate: codes ok\n')); - state.mode = LEN_; - if (flush === Z_TREES) { break inf_leave; } - /* falls through */ - case LEN_: - state.mode = LEN; - /* falls through */ - case LEN: - if (have >= 6 && left >= 258) { - //--- RESTORE() --- - strm.next_out = put; - strm.avail_out = left; - strm.next_in = next; - strm.avail_in = have; - state.hold = hold; - state.bits = bits; - //--- - inflate_fast(strm, _out); - //--- LOAD() --- - put = strm.next_out; - output = strm.output; - left = strm.avail_out; - next = strm.next_in; - input = strm.input; - have = strm.avail_in; - hold = state.hold; - bits = state.bits; - //--- - - if (state.mode === TYPE) { - state.back = -1; - } - break; - } - state.back = 0; - for (;;) { - here = state.lencode[hold & ((1 << state.lenbits) - 1)]; /*BITS(state.lenbits)*/ - here_bits = here >>> 24; - here_op = (here >>> 16) & 0xff; - here_val = here & 0xffff; - - if (here_bits <= bits) { break; } - //--- PULLBYTE() ---// - if (have === 0) { break inf_leave; } - have--; - hold += input[next++] << bits; - bits += 8; - //---// - } - if (here_op && (here_op & 0xf0) === 0) { - last_bits = here_bits; - last_op = here_op; - last_val = here_val; - for (;;) { - here = state.lencode[last_val + - ((hold & ((1 << (last_bits + last_op)) - 1))/*BITS(last.bits + last.op)*/ >> last_bits)]; - here_bits = here >>> 24; - here_op = (here >>> 16) & 0xff; - here_val = here & 0xffff; - - if ((last_bits + here_bits) <= bits) { break; } - //--- PULLBYTE() ---// - if (have === 0) { break inf_leave; } - have--; - hold += input[next++] << bits; - bits += 8; - //---// - } - //--- DROPBITS(last.bits) ---// - hold >>>= last_bits; - bits -= last_bits; - //---// - state.back += last_bits; - } - //--- DROPBITS(here.bits) ---// - hold >>>= here_bits; - bits -= here_bits; - //---// - state.back += here_bits; - state.length = here_val; - if (here_op === 0) { - //Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ? - // "inflate: literal '%c'\n" : - // "inflate: literal 0x%02x\n", here.val)); - state.mode = LIT; - break; - } - if (here_op & 32) { - //Tracevv((stderr, "inflate: end of block\n")); - state.back = -1; - state.mode = TYPE; - break; - } - if (here_op & 64) { - strm.msg = 'invalid literal/length code'; - state.mode = BAD; - break; - } - state.extra = here_op & 15; - state.mode = LENEXT; - /* falls through */ - case LENEXT: - if (state.extra) { - //=== NEEDBITS(state.extra); - n = state.extra; - while (bits < n) { - if (have === 0) { break inf_leave; } - have--; - hold += input[next++] << bits; - bits += 8; - } - //===// - state.length += hold & ((1 << state.extra) - 1)/*BITS(state.extra)*/; - //--- DROPBITS(state.extra) ---// - hold >>>= state.extra; - bits -= state.extra; - //---// - state.back += state.extra; - } - //Tracevv((stderr, "inflate: length %u\n", state.length)); - state.was = state.length; - state.mode = DIST; - /* falls through */ - case DIST: - for (;;) { - here = state.distcode[hold & ((1 << state.distbits) - 1)];/*BITS(state.distbits)*/ - here_bits = here >>> 24; - here_op = (here >>> 16) & 0xff; - here_val = here & 0xffff; - - if ((here_bits) <= bits) { break; } - //--- PULLBYTE() ---// - if (have === 0) { break inf_leave; } - have--; - hold += input[next++] << bits; - bits += 8; - //---// - } - if ((here_op & 0xf0) === 0) { - last_bits = here_bits; - last_op = here_op; - last_val = here_val; - for (;;) { - here = state.distcode[last_val + - ((hold & ((1 << (last_bits + last_op)) - 1))/*BITS(last.bits + last.op)*/ >> last_bits)]; - here_bits = here >>> 24; - here_op = (here >>> 16) & 0xff; - here_val = here & 0xffff; - - if ((last_bits + here_bits) <= bits) { break; } - //--- PULLBYTE() ---// - if (have === 0) { break inf_leave; } - have--; - hold += input[next++] << bits; - bits += 8; - //---// - } - //--- DROPBITS(last.bits) ---// - hold >>>= last_bits; - bits -= last_bits; - //---// - state.back += last_bits; - } - //--- DROPBITS(here.bits) ---// - hold >>>= here_bits; - bits -= here_bits; - //---// - state.back += here_bits; - if (here_op & 64) { - strm.msg = 'invalid distance code'; - state.mode = BAD; - break; - } - state.offset = here_val; - state.extra = (here_op) & 15; - state.mode = DISTEXT; - /* falls through */ - case DISTEXT: - if (state.extra) { - //=== NEEDBITS(state.extra); - n = state.extra; - while (bits < n) { - if (have === 0) { break inf_leave; } - have--; - hold += input[next++] << bits; - bits += 8; - } - //===// - state.offset += hold & ((1 << state.extra) - 1)/*BITS(state.extra)*/; - //--- DROPBITS(state.extra) ---// - hold >>>= state.extra; - bits -= state.extra; - //---// - state.back += state.extra; - } - //#ifdef INFLATE_STRICT - if (state.offset > state.dmax) { - strm.msg = 'invalid distance too far back'; - state.mode = BAD; - break; - } - //#endif - //Tracevv((stderr, "inflate: distance %u\n", state.offset)); - state.mode = MATCH; - /* falls through */ - case MATCH: - if (left === 0) { break inf_leave; } - copy = _out - left; - if (state.offset > copy) { /* copy from window */ - copy = state.offset - copy; - if (copy > state.whave) { - if (state.sane) { - strm.msg = 'invalid distance too far back'; - state.mode = BAD; - break; - } - // (!) This block is disabled in zlib defailts, - // don't enable it for binary compatibility - //#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR - // Trace((stderr, "inflate.c too far\n")); - // copy -= state.whave; - // if (copy > state.length) { copy = state.length; } - // if (copy > left) { copy = left; } - // left -= copy; - // state.length -= copy; - // do { - // output[put++] = 0; - // } while (--copy); - // if (state.length === 0) { state.mode = LEN; } - // break; - //#endif - } - if (copy > state.wnext) { - copy -= state.wnext; - from = state.wsize - copy; - } - else { - from = state.wnext - copy; - } - if (copy > state.length) { copy = state.length; } - from_source = state.window; - } - else { /* copy from output */ - from_source = output; - from = put - state.offset; - copy = state.length; - } - if (copy > left) { copy = left; } - left -= copy; - state.length -= copy; - do { - output[put++] = from_source[from++]; - } while (--copy); - if (state.length === 0) { state.mode = LEN; } - break; - case LIT: - if (left === 0) { break inf_leave; } - output[put++] = state.length; - left--; - state.mode = LEN; - break; - case CHECK: - if (state.wrap) { - //=== NEEDBITS(32); - while (bits < 32) { - if (have === 0) { break inf_leave; } - have--; - // Use '|' insdead of '+' to make sure that result is signed - hold |= input[next++] << bits; - bits += 8; - } - //===// - _out -= left; - strm.total_out += _out; - state.total += _out; - if (_out) { - strm.adler = state.check = - /*UPDATE(state.check, put - _out, _out);*/ - (state.flags ? crc32(state.check, output, _out, put - _out) : adler32(state.check, output, _out, put - _out)); - - } - _out = left; - // NB: crc32 stored as signed 32-bit int, zswap32 returns signed too - if ((state.flags ? hold : zswap32(hold)) !== state.check) { - strm.msg = 'incorrect data check'; - state.mode = BAD; - break; - } - //=== INITBITS(); - hold = 0; - bits = 0; - //===// - //Tracev((stderr, "inflate: check matches trailer\n")); - } - state.mode = LENGTH; - /* falls through */ - case LENGTH: - if (state.wrap && state.flags) { - //=== NEEDBITS(32); - while (bits < 32) { - if (have === 0) { break inf_leave; } - have--; - hold += input[next++] << bits; - bits += 8; - } - //===// - if (hold !== (state.total & 0xffffffff)) { - strm.msg = 'incorrect length check'; - state.mode = BAD; - break; - } - //=== INITBITS(); - hold = 0; - bits = 0; - //===// - //Tracev((stderr, "inflate: length matches trailer\n")); - } - state.mode = DONE; - /* falls through */ - case DONE: - ret = Z_STREAM_END; - break inf_leave; - case BAD: - ret = Z_DATA_ERROR; - break inf_leave; - case MEM: - return Z_MEM_ERROR; - case SYNC: - /* falls through */ - default: - return Z_STREAM_ERROR; - } - } - - // inf_leave <- here is real place for "goto inf_leave", emulated via "break inf_leave" - - /* - Return from inflate(), updating the total counts and the check value. - If there was no progress during the inflate() call, return a buffer - error. Call updatewindow() to create and/or update the window state. - Note: a memory error from inflate() is non-recoverable. - */ - - //--- RESTORE() --- - strm.next_out = put; - strm.avail_out = left; - strm.next_in = next; - strm.avail_in = have; - state.hold = hold; - state.bits = bits; - //--- - - if (state.wsize || (_out !== strm.avail_out && state.mode < BAD && - (state.mode < CHECK || flush !== Z_FINISH))) { - if (updatewindow(strm, strm.output, strm.next_out, _out - strm.avail_out)) { - state.mode = MEM; - return Z_MEM_ERROR; - } - } - _in -= strm.avail_in; - _out -= strm.avail_out; - strm.total_in += _in; - strm.total_out += _out; - state.total += _out; - if (state.wrap && _out) { - strm.adler = state.check = /*UPDATE(state.check, strm.next_out - _out, _out);*/ - (state.flags ? crc32(state.check, output, _out, strm.next_out - _out) : adler32(state.check, output, _out, strm.next_out - _out)); - } - strm.data_type = state.bits + (state.last ? 64 : 0) + - (state.mode === TYPE ? 128 : 0) + - (state.mode === LEN_ || state.mode === COPY_ ? 256 : 0); - if (((_in === 0 && _out === 0) || flush === Z_FINISH) && ret === Z_OK) { - ret = Z_BUF_ERROR; - } - return ret; - } - - function inflateEnd(strm) { - - if (!strm || !strm.state /*|| strm->zfree == (free_func)0*/) { - return Z_STREAM_ERROR; - } - - var state = strm.state; - if (state.window) { - state.window = null; - } - strm.state = null; - return Z_OK; - } - - function inflateGetHeader(strm, head) { - var state; - - /* check state */ - if (!strm || !strm.state) { return Z_STREAM_ERROR; } - state = strm.state; - if ((state.wrap & 2) === 0) { return Z_STREAM_ERROR; } - - /* save header structure */ - state.head = head; - head.done = false; - return Z_OK; - } - - function inflateSetDictionary(strm, dictionary) { - var dictLength = dictionary.length; - - var state; - var dictid; - var ret; - - /* check state */ - if (!strm /* == Z_NULL */ || !strm.state /* == Z_NULL */) { return Z_STREAM_ERROR; } - state = strm.state; - - if (state.wrap !== 0 && state.mode !== DICT) { - return Z_STREAM_ERROR; - } - - /* check for correct dictionary identifier */ - if (state.mode === DICT) { - dictid = 1; /* adler32(0, null, 0)*/ - /* dictid = adler32(dictid, dictionary, dictLength); */ - dictid = adler32(dictid, dictionary, dictLength, 0); - if (dictid !== state.check) { - return Z_DATA_ERROR; - } - } - /* copy dictionary to window using updatewindow(), which will amend the - existing dictionary if appropriate */ - ret = updatewindow(strm, dictionary, dictLength, dictLength); - if (ret) { - state.mode = MEM; - return Z_MEM_ERROR; - } - state.havedict = 1; - // Tracev((stderr, "inflate: dictionary set\n")); - return Z_OK; - } - - exports.inflateReset = inflateReset; - exports.inflateReset2 = inflateReset2; - exports.inflateResetKeep = inflateResetKeep; - exports.inflateInit = inflateInit; - exports.inflateInit2 = inflateInit2; - exports.inflate = inflate; - exports.inflateEnd = inflateEnd; - exports.inflateGetHeader = inflateGetHeader; - exports.inflateSetDictionary = inflateSetDictionary; - exports.inflateInfo = 'pako inflate (from Nodeca project)'; - - /* Not implemented - exports.inflateCopy = inflateCopy; - exports.inflateGetDictionary = inflateGetDictionary; - exports.inflateMark = inflateMark; - exports.inflatePrime = inflatePrime; - exports.inflateSync = inflateSync; - exports.inflateSyncPoint = inflateSyncPoint; - exports.inflateUndermine = inflateUndermine; - */ +var constants = __webpack_require__(81); + +exports.tagClass = { + 0: 'universal', + 1: 'application', + 2: 'context', + 3: 'private' +}; +exports.tagClassByName = constants._reverse(exports.tagClass); + +exports.tag = { + 0x00: 'end', + 0x01: 'bool', + 0x02: 'int', + 0x03: 'bitstr', + 0x04: 'octstr', + 0x05: 'null_', + 0x06: 'objid', + 0x07: 'objDesc', + 0x08: 'external', + 0x09: 'real', + 0x0a: 'enum', + 0x0b: 'embed', + 0x0c: 'utf8str', + 0x0d: 'relativeOid', + 0x10: 'seq', + 0x11: 'set', + 0x12: 'numstr', + 0x13: 'printstr', + 0x14: 't61str', + 0x15: 'videostr', + 0x16: 'ia5str', + 0x17: 'utctime', + 0x18: 'gentime', + 0x19: 'graphstr', + 0x1a: 'iso646str', + 0x1b: 'genstr', + 0x1c: 'unistr', + 0x1d: 'charstr', + 0x1e: 'bmpstr' +}; +exports.tagByName = constants._reverse(exports.tag); /***/ }, /* 143 */ -/***/ function(module, exports) { +/***/ function(module, exports, __webpack_require__) { - 'use strict'; +var decoders = exports; - // See state defs from inflate.js - var BAD = 30; /* got a data error -- remain here until reset */ - var TYPE = 12; /* i: waiting for type bits, including last-flag bit */ - - /* - Decode literal, length, and distance codes and write out the resulting - literal and match bytes until either not enough input or output is - available, an end-of-block is encountered, or a data error is encountered. - When large enough input and output buffers are supplied to inflate(), for - example, a 16K input buffer and a 64K output buffer, more than 95% of the - inflate execution time is spent in this routine. - - Entry assumptions: - - state.mode === LEN - strm.avail_in >= 6 - strm.avail_out >= 258 - start >= strm.avail_out - state.bits < 8 - - On return, state.mode is one of: - - LEN -- ran out of enough output space or enough available input - TYPE -- reached end of block code, inflate() to interpret next block - BAD -- error in block data - - Notes: - - - The maximum input bits used by a length/distance pair is 15 bits for the - length code, 5 bits for the length extra, 15 bits for the distance code, - and 13 bits for the distance extra. This totals 48 bits, or six bytes. - Therefore if strm.avail_in >= 6, then there is enough input to avoid - checking for available input while decoding. - - - The maximum bytes that a single length/distance pair can output is 258 - bytes, which is the maximum length that can be coded. inflate_fast() - requires strm.avail_out >= 258 for each loop to avoid checking for - output space. - */ - module.exports = function inflate_fast(strm, start) { - var state; - var _in; /* local strm.input */ - var last; /* have enough input while in < last */ - var _out; /* local strm.output */ - var beg; /* inflate()'s initial strm.output */ - var end; /* while out < end, enough space available */ - //#ifdef INFLATE_STRICT - var dmax; /* maximum distance from zlib header */ - //#endif - var wsize; /* window size or zero if not using window */ - var whave; /* valid bytes in the window */ - var wnext; /* window write index */ - // Use `s_window` instead `window`, avoid conflict with instrumentation tools - var s_window; /* allocated sliding window, if wsize != 0 */ - var hold; /* local strm.hold */ - var bits; /* local strm.bits */ - var lcode; /* local strm.lencode */ - var dcode; /* local strm.distcode */ - var lmask; /* mask for first level of length codes */ - var dmask; /* mask for first level of distance codes */ - var here; /* retrieved table entry */ - var op; /* code bits, operation, extra bits, or */ - /* window position, window bytes to copy */ - var len; /* match length, unused bytes */ - var dist; /* match distance */ - var from; /* where to copy match from */ - var from_source; - - - var input, output; // JS specific, because we have no pointers - - /* copy state to local variables */ - state = strm.state; - //here = state.here; - _in = strm.next_in; - input = strm.input; - last = _in + (strm.avail_in - 5); - _out = strm.next_out; - output = strm.output; - beg = _out - (start - strm.avail_out); - end = _out + (strm.avail_out - 257); - //#ifdef INFLATE_STRICT - dmax = state.dmax; - //#endif - wsize = state.wsize; - whave = state.whave; - wnext = state.wnext; - s_window = state.window; - hold = state.hold; - bits = state.bits; - lcode = state.lencode; - dcode = state.distcode; - lmask = (1 << state.lenbits) - 1; - dmask = (1 << state.distbits) - 1; - - - /* decode literals and length/distances until end-of-block or not enough - input data or output space */ - - top: - do { - if (bits < 15) { - hold += input[_in++] << bits; - bits += 8; - hold += input[_in++] << bits; - bits += 8; - } - - here = lcode[hold & lmask]; - - dolen: - for (;;) { // Goto emulation - op = here >>> 24/*here.bits*/; - hold >>>= op; - bits -= op; - op = (here >>> 16) & 0xff/*here.op*/; - if (op === 0) { /* literal */ - //Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ? - // "inflate: literal '%c'\n" : - // "inflate: literal 0x%02x\n", here.val)); - output[_out++] = here & 0xffff/*here.val*/; - } - else if (op & 16) { /* length base */ - len = here & 0xffff/*here.val*/; - op &= 15; /* number of extra bits */ - if (op) { - if (bits < op) { - hold += input[_in++] << bits; - bits += 8; - } - len += hold & ((1 << op) - 1); - hold >>>= op; - bits -= op; - } - //Tracevv((stderr, "inflate: length %u\n", len)); - if (bits < 15) { - hold += input[_in++] << bits; - bits += 8; - hold += input[_in++] << bits; - bits += 8; - } - here = dcode[hold & dmask]; - - dodist: - for (;;) { // goto emulation - op = here >>> 24/*here.bits*/; - hold >>>= op; - bits -= op; - op = (here >>> 16) & 0xff/*here.op*/; - - if (op & 16) { /* distance base */ - dist = here & 0xffff/*here.val*/; - op &= 15; /* number of extra bits */ - if (bits < op) { - hold += input[_in++] << bits; - bits += 8; - if (bits < op) { - hold += input[_in++] << bits; - bits += 8; - } - } - dist += hold & ((1 << op) - 1); - //#ifdef INFLATE_STRICT - if (dist > dmax) { - strm.msg = 'invalid distance too far back'; - state.mode = BAD; - break top; - } - //#endif - hold >>>= op; - bits -= op; - //Tracevv((stderr, "inflate: distance %u\n", dist)); - op = _out - beg; /* max distance in output */ - if (dist > op) { /* see if copy from window */ - op = dist - op; /* distance back in window */ - if (op > whave) { - if (state.sane) { - strm.msg = 'invalid distance too far back'; - state.mode = BAD; - break top; - } - - // (!) This block is disabled in zlib defailts, - // don't enable it for binary compatibility - //#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR - // if (len <= op - whave) { - // do { - // output[_out++] = 0; - // } while (--len); - // continue top; - // } - // len -= op - whave; - // do { - // output[_out++] = 0; - // } while (--op > whave); - // if (op === 0) { - // from = _out - dist; - // do { - // output[_out++] = output[from++]; - // } while (--len); - // continue top; - // } - //#endif - } - from = 0; // window index - from_source = s_window; - if (wnext === 0) { /* very common case */ - from += wsize - op; - if (op < len) { /* some from window */ - len -= op; - do { - output[_out++] = s_window[from++]; - } while (--op); - from = _out - dist; /* rest from output */ - from_source = output; - } - } - else if (wnext < op) { /* wrap around window */ - from += wsize + wnext - op; - op -= wnext; - if (op < len) { /* some from end of window */ - len -= op; - do { - output[_out++] = s_window[from++]; - } while (--op); - from = 0; - if (wnext < len) { /* some from start of window */ - op = wnext; - len -= op; - do { - output[_out++] = s_window[from++]; - } while (--op); - from = _out - dist; /* rest from output */ - from_source = output; - } - } - } - else { /* contiguous in window */ - from += wnext - op; - if (op < len) { /* some from window */ - len -= op; - do { - output[_out++] = s_window[from++]; - } while (--op); - from = _out - dist; /* rest from output */ - from_source = output; - } - } - while (len > 2) { - output[_out++] = from_source[from++]; - output[_out++] = from_source[from++]; - output[_out++] = from_source[from++]; - len -= 3; - } - if (len) { - output[_out++] = from_source[from++]; - if (len > 1) { - output[_out++] = from_source[from++]; - } - } - } - else { - from = _out - dist; /* copy direct from output */ - do { /* minimum length is three */ - output[_out++] = output[from++]; - output[_out++] = output[from++]; - output[_out++] = output[from++]; - len -= 3; - } while (len > 2); - if (len) { - output[_out++] = output[from++]; - if (len > 1) { - output[_out++] = output[from++]; - } - } - } - } - else if ((op & 64) === 0) { /* 2nd level distance code */ - here = dcode[(here & 0xffff)/*here.val*/ + (hold & ((1 << op) - 1))]; - continue dodist; - } - else { - strm.msg = 'invalid distance code'; - state.mode = BAD; - break top; - } - - break; // need to emulate goto via "continue" - } - } - else if ((op & 64) === 0) { /* 2nd level length code */ - here = lcode[(here & 0xffff)/*here.val*/ + (hold & ((1 << op) - 1))]; - continue dolen; - } - else if (op & 32) { /* end-of-block */ - //Tracevv((stderr, "inflate: end of block\n")); - state.mode = TYPE; - break top; - } - else { - strm.msg = 'invalid literal/length code'; - state.mode = BAD; - break top; - } - - break; // need to emulate goto via "continue" - } - } while (_in < last && _out < end); - - /* return unused bytes (on entry, bits < 8, so in won't go too far back) */ - len = bits >> 3; - _in -= len; - bits -= len << 3; - hold &= (1 << bits) - 1; - - /* update state and return */ - strm.next_in = _in; - strm.next_out = _out; - strm.avail_in = (_in < last ? 5 + (last - _in) : 5 - (_in - last)); - strm.avail_out = (_out < end ? 257 + (end - _out) : 257 - (_out - end)); - state.hold = hold; - state.bits = bits; - return; - }; +decoders.der = __webpack_require__(82); +decoders.pem = __webpack_require__(144); /***/ }, /* 144 */ /***/ function(module, exports, __webpack_require__) { - 'use strict'; +var inherits = __webpack_require__(1); +var Buffer = __webpack_require__(0).Buffer; +var DERDecoder = __webpack_require__(82); - var utils = __webpack_require__(138); +function PEMDecoder(entity) { + DERDecoder.call(this, entity); + this.enc = 'pem'; +}; +inherits(PEMDecoder, DERDecoder); +module.exports = PEMDecoder; - var MAXBITS = 15; - var ENOUGH_LENS = 852; - var ENOUGH_DISTS = 592; - //var ENOUGH = (ENOUGH_LENS+ENOUGH_DISTS); +PEMDecoder.prototype.decode = function decode(data, options) { + var lines = data.toString().split(/[\r\n]+/g); - var CODES = 0; - var LENS = 1; - var DISTS = 2; + var label = options.label.toUpperCase(); - var lbase = [ /* Length codes 257..285 base */ - 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, - 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0 - ]; + var re = /^-----(BEGIN|END) ([^-]+)-----$/; + var start = -1; + var end = -1; + for (var i = 0; i < lines.length; i++) { + var match = lines[i].match(re); + if (match === null) + continue; - var lext = [ /* Length codes 257..285 extra */ - 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, - 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 72, 78 - ]; + if (match[2] !== label) + continue; - var dbase = [ /* Distance codes 0..29 base */ - 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, - 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, - 8193, 12289, 16385, 24577, 0, 0 - ]; + if (start === -1) { + if (match[1] !== 'BEGIN') + break; + start = i; + } else { + if (match[1] !== 'END') + break; + end = i; + break; + } + } + if (start === -1 || end === -1) + throw new Error('PEM section not found for: ' + label); - var dext = [ /* Distance codes 0..29 extra */ - 16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, - 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, - 28, 28, 29, 29, 64, 64 - ]; + var base64 = lines.slice(start + 1, end).join(''); + // Remove excessive symbols + base64.replace(/[^a-z0-9\+\/=]+/gi, ''); - module.exports = function inflate_table(type, lens, lens_index, codes, table, table_index, work, opts) - { - var bits = opts.bits; - //here = opts.here; /* table entry for duplication */ - - var len = 0; /* a code's length in bits */ - var sym = 0; /* index of code symbols */ - var min = 0, max = 0; /* minimum and maximum code lengths */ - var root = 0; /* number of index bits for root table */ - var curr = 0; /* number of index bits for current table */ - var drop = 0; /* code bits to drop for sub-table */ - var left = 0; /* number of prefix codes available */ - var used = 0; /* code entries in table used */ - var huff = 0; /* Huffman code */ - var incr; /* for incrementing code, index */ - var fill; /* index for replicating entries */ - var low; /* low bits for current root entry */ - var mask; /* mask for low root bits */ - var next; /* next available space in table */ - var base = null; /* base value table to use */ - var base_index = 0; - // var shoextra; /* extra bits table to use */ - var end; /* use base and extra for symbol > end */ - var count = new utils.Buf16(MAXBITS + 1); //[MAXBITS+1]; /* number of codes of each length */ - var offs = new utils.Buf16(MAXBITS + 1); //[MAXBITS+1]; /* offsets in table for each length */ - var extra = null; - var extra_index = 0; - - var here_bits, here_op, here_val; - - /* - Process a set of code lengths to create a canonical Huffman code. The - code lengths are lens[0..codes-1]. Each length corresponds to the - symbols 0..codes-1. The Huffman code is generated by first sorting the - symbols by length from short to long, and retaining the symbol order - for codes with equal lengths. Then the code starts with all zero bits - for the first code of the shortest length, and the codes are integer - increments for the same length, and zeros are appended as the length - increases. For the deflate format, these bits are stored backwards - from their more natural integer increment ordering, and so when the - decoding tables are built in the large loop below, the integer codes - are incremented backwards. - - This routine assumes, but does not check, that all of the entries in - lens[] are in the range 0..MAXBITS. The caller must assure this. - 1..MAXBITS is interpreted as that code length. zero means that that - symbol does not occur in this code. - - The codes are sorted by computing a count of codes for each length, - creating from that a table of starting indices for each length in the - sorted table, and then entering the symbols in order in the sorted - table. The sorted table is work[], with that space being provided by - the caller. - - The length counts are used for other purposes as well, i.e. finding - the minimum and maximum length codes, determining if there are any - codes at all, checking for a valid set of lengths, and looking ahead - at length counts to determine sub-table sizes when building the - decoding tables. - */ - - /* accumulate lengths for codes (assumes lens[] all in 0..MAXBITS) */ - for (len = 0; len <= MAXBITS; len++) { - count[len] = 0; - } - for (sym = 0; sym < codes; sym++) { - count[lens[lens_index + sym]]++; - } - - /* bound code lengths, force root to be within code lengths */ - root = bits; - for (max = MAXBITS; max >= 1; max--) { - if (count[max] !== 0) { break; } - } - if (root > max) { - root = max; - } - if (max === 0) { /* no symbols to code at all */ - //table.op[opts.table_index] = 64; //here.op = (var char)64; /* invalid code marker */ - //table.bits[opts.table_index] = 1; //here.bits = (var char)1; - //table.val[opts.table_index++] = 0; //here.val = (var short)0; - table[table_index++] = (1 << 24) | (64 << 16) | 0; - - - //table.op[opts.table_index] = 64; - //table.bits[opts.table_index] = 1; - //table.val[opts.table_index++] = 0; - table[table_index++] = (1 << 24) | (64 << 16) | 0; - - opts.bits = 1; - return 0; /* no symbols, but wait for decoding to report error */ - } - for (min = 1; min < max; min++) { - if (count[min] !== 0) { break; } - } - if (root < min) { - root = min; - } - - /* check for an over-subscribed or incomplete set of lengths */ - left = 1; - for (len = 1; len <= MAXBITS; len++) { - left <<= 1; - left -= count[len]; - if (left < 0) { - return -1; - } /* over-subscribed */ - } - if (left > 0 && (type === CODES || max !== 1)) { - return -1; /* incomplete set */ - } - - /* generate offsets into symbol table for each length for sorting */ - offs[1] = 0; - for (len = 1; len < MAXBITS; len++) { - offs[len + 1] = offs[len] + count[len]; - } - - /* sort symbols by length, by symbol order within each length */ - for (sym = 0; sym < codes; sym++) { - if (lens[lens_index + sym] !== 0) { - work[offs[lens[lens_index + sym]]++] = sym; - } - } - - /* - Create and fill in decoding tables. In this loop, the table being - filled is at next and has curr index bits. The code being used is huff - with length len. That code is converted to an index by dropping drop - bits off of the bottom. For codes where len is less than drop + curr, - those top drop + curr - len bits are incremented through all values to - fill the table with replicated entries. - - root is the number of index bits for the root table. When len exceeds - root, sub-tables are created pointed to by the root entry with an index - of the low root bits of huff. This is saved in low to check for when a - new sub-table should be started. drop is zero when the root table is - being filled, and drop is root when sub-tables are being filled. - - When a new sub-table is needed, it is necessary to look ahead in the - code lengths to determine what size sub-table is needed. The length - counts are used for this, and so count[] is decremented as codes are - entered in the tables. - - used keeps track of how many table entries have been allocated from the - provided *table space. It is checked for LENS and DIST tables against - the constants ENOUGH_LENS and ENOUGH_DISTS to guard against changes in - the initial root table size constants. See the comments in inftrees.h - for more information. - - sym increments through all symbols, and the loop terminates when - all codes of length max, i.e. all codes, have been processed. This - routine permits incomplete codes, so another loop after this one fills - in the rest of the decoding tables with invalid code markers. - */ - - /* set up for code type */ - // poor man optimization - use if-else instead of switch, - // to avoid deopts in old v8 - if (type === CODES) { - base = extra = work; /* dummy value--not used */ - end = 19; - - } else if (type === LENS) { - base = lbase; - base_index -= 257; - extra = lext; - extra_index -= 257; - end = 256; - - } else { /* DISTS */ - base = dbase; - extra = dext; - end = -1; - } - - /* initialize opts for loop */ - huff = 0; /* starting code */ - sym = 0; /* starting code symbol */ - len = min; /* starting code length */ - next = table_index; /* current table to fill in */ - curr = root; /* current table index bits */ - drop = 0; /* current bits to drop from code for index */ - low = -1; /* trigger new sub-table when len > root */ - used = 1 << root; /* use root table entries */ - mask = used - 1; /* mask for comparing low */ - - /* check available table space */ - if ((type === LENS && used > ENOUGH_LENS) || - (type === DISTS && used > ENOUGH_DISTS)) { - return 1; - } - - var i = 0; - /* process all codes and make table entries */ - for (;;) { - i++; - /* create table entry */ - here_bits = len - drop; - if (work[sym] < end) { - here_op = 0; - here_val = work[sym]; - } - else if (work[sym] > end) { - here_op = extra[extra_index + work[sym]]; - here_val = base[base_index + work[sym]]; - } - else { - here_op = 32 + 64; /* end of block */ - here_val = 0; - } - - /* replicate for those indices with low len bits equal to huff */ - incr = 1 << (len - drop); - fill = 1 << curr; - min = fill; /* save offset to next table */ - do { - fill -= incr; - table[next + (huff >> drop) + fill] = (here_bits << 24) | (here_op << 16) | here_val |0; - } while (fill !== 0); - - /* backwards increment the len-bit code huff */ - incr = 1 << (len - 1); - while (huff & incr) { - incr >>= 1; - } - if (incr !== 0) { - huff &= incr - 1; - huff += incr; - } else { - huff = 0; - } - - /* go to next symbol, update count, len */ - sym++; - if (--count[len] === 0) { - if (len === max) { break; } - len = lens[lens_index + work[sym]]; - } - - /* create new sub-table if needed */ - if (len > root && (huff & mask) !== low) { - /* if first time, transition to sub-tables */ - if (drop === 0) { - drop = root; - } - - /* increment past last table */ - next += min; /* here min is 1 << curr */ - - /* determine length of next table */ - curr = len - drop; - left = 1 << curr; - while (curr + drop < max) { - left -= count[curr + drop]; - if (left <= 0) { break; } - curr++; - left <<= 1; - } - - /* check for enough space */ - used += 1 << curr; - if ((type === LENS && used > ENOUGH_LENS) || - (type === DISTS && used > ENOUGH_DISTS)) { - return 1; - } - - /* point entry in root table to sub-table */ - low = huff & mask; - /*table.op[low] = curr; - table.bits[low] = root; - table.val[low] = next - opts.table_index;*/ - table[low] = (root << 24) | (curr << 16) | (next - table_index) |0; - } - } - - /* fill in remaining table entry if code is incomplete (guaranteed to have - at most one remaining entry, since if the code is incomplete, the - maximum code length that was allowed to get this far is one bit) */ - if (huff !== 0) { - //table.op[next + huff] = 64; /* invalid code marker */ - //table.bits[next + huff] = len - drop; - //table.val[next + huff] = 0; - table[next + huff] = ((len - drop) << 24) | (64 << 16) |0; - } - - /* set return parameters */ - //opts.table_index += used; - opts.bits = root; - return 0; - }; + var input = new Buffer(base64, 'base64'); + return DERDecoder.prototype.decode.call(this, input, options); +}; /***/ }, /* 145 */ -/***/ function(module, exports) { +/***/ function(module, exports, __webpack_require__) { - 'use strict'; +var encoders = exports; - - module.exports = { - - /* Allowed flush values; see deflate() and inflate() below for details */ - Z_NO_FLUSH: 0, - Z_PARTIAL_FLUSH: 1, - Z_SYNC_FLUSH: 2, - Z_FULL_FLUSH: 3, - Z_FINISH: 4, - Z_BLOCK: 5, - Z_TREES: 6, - - /* Return codes for the compression/decompression functions. Negative values - * are errors, positive values are used for special but normal events. - */ - Z_OK: 0, - Z_STREAM_END: 1, - Z_NEED_DICT: 2, - Z_ERRNO: -1, - Z_STREAM_ERROR: -2, - Z_DATA_ERROR: -3, - //Z_MEM_ERROR: -4, - Z_BUF_ERROR: -5, - //Z_VERSION_ERROR: -6, - - /* compression levels */ - Z_NO_COMPRESSION: 0, - Z_BEST_SPEED: 1, - Z_BEST_COMPRESSION: 9, - Z_DEFAULT_COMPRESSION: -1, - - - Z_FILTERED: 1, - Z_HUFFMAN_ONLY: 2, - Z_RLE: 3, - Z_FIXED: 4, - Z_DEFAULT_STRATEGY: 0, - - /* Possible values of the data_type field (though see inflate()) */ - Z_BINARY: 0, - Z_TEXT: 1, - //Z_ASCII: 1, // = Z_TEXT (deprecated) - Z_UNKNOWN: 2, - - /* The deflate compression method */ - Z_DEFLATED: 8 - //Z_NULL: null // Use -1 or null inline, depending on var type - }; +encoders.der = __webpack_require__(83); +encoders.pem = __webpack_require__(146); /***/ }, /* 146 */ /***/ function(module, exports, __webpack_require__) { - /* WEBPACK VAR INJECTION */(function(global) {'use strict'; +var inherits = __webpack_require__(1); - // compare and isBuffer taken from https://github.com/feross/buffer/blob/680e9e5e488f22aac27599a57dc844a6315928dd/index.js - // original notice: +var DEREncoder = __webpack_require__(83); - /*! - * The buffer module from node.js, for the browser. - * - * @author Feross Aboukhadijeh - * @license MIT - */ - function compare(a, b) { - if (a === b) { - return 0; - } +function PEMEncoder(entity) { + DEREncoder.call(this, entity); + this.enc = 'pem'; +}; +inherits(PEMEncoder, DEREncoder); +module.exports = PEMEncoder; - var x = a.length; - var y = b.length; +PEMEncoder.prototype.encode = function encode(data, options) { + var buf = DEREncoder.prototype.encode.call(this, data); - for (var i = 0, len = Math.min(x, y); i < len; ++i) { - if (a[i] !== b[i]) { - x = a[i]; - y = b[i]; - break; - } - } + var p = buf.toString('base64'); + var out = [ '-----BEGIN ' + options.label + '-----' ]; + for (var i = 0; i < p.length; i += 64) + out.push(p.slice(i, i + 64)); + out.push('-----END ' + options.label + '-----'); + return out.join('\n'); +}; - if (x < y) { - return -1; - } - if (y < x) { - return 1; - } - return 0; - } - function isBuffer(b) { - if (global.Buffer && typeof global.Buffer.isBuffer === 'function') { - return global.Buffer.isBuffer(b); - } - return !!(b != null && b._isBuffer); - } - - // based on node assert, original notice: - - // http://wiki.commonjs.org/wiki/Unit_Testing/1.0 - // - // THIS IS NOT TESTED NOR LIKELY TO WORK OUTSIDE V8! - // - // Originally from narwhal.js (http://narwhaljs.org) - // Copyright (c) 2009 Thomas Robinson <280north.com> - // - // Permission is hereby granted, free of charge, to any person obtaining a copy - // of this software and associated documentation files (the 'Software'), to - // deal in the Software without restriction, including without limitation the - // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - // sell copies of the Software, and to permit persons to whom the Software is - // furnished to do so, subject to the following conditions: - // - // The above copyright notice and this permission notice shall be included in - // all copies or substantial portions of the Software. - // - // THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - // AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN - // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - - var util = __webpack_require__(75); - var hasOwn = Object.prototype.hasOwnProperty; - var pSlice = Array.prototype.slice; - var functionsHaveNames = (function () { - return function foo() {}.name === 'foo'; - }()); - function pToString (obj) { - return Object.prototype.toString.call(obj); - } - function isView(arrbuf) { - if (isBuffer(arrbuf)) { - return false; - } - if (typeof global.ArrayBuffer !== 'function') { - return false; - } - if (typeof ArrayBuffer.isView === 'function') { - return ArrayBuffer.isView(arrbuf); - } - if (!arrbuf) { - return false; - } - if (arrbuf instanceof DataView) { - return true; - } - if (arrbuf.buffer && arrbuf.buffer instanceof ArrayBuffer) { - return true; - } - return false; - } - // 1. The assert module provides functions that throw - // AssertionError's when particular conditions are not met. The - // assert module must conform to the following interface. - - var assert = module.exports = ok; - - // 2. The AssertionError is defined in assert. - // new assert.AssertionError({ message: message, - // actual: actual, - // expected: expected }) - - var regex = /\s*function\s+([^\(\s]*)\s*/; - // based on https://github.com/ljharb/function.prototype.name/blob/adeeeec8bfcc6068b187d7d9fb3d5bb1d3a30899/implementation.js - function getName(func) { - if (!util.isFunction(func)) { - return; - } - if (functionsHaveNames) { - return func.name; - } - var str = func.toString(); - var match = str.match(regex); - return match && match[1]; - } - assert.AssertionError = function AssertionError(options) { - this.name = 'AssertionError'; - this.actual = options.actual; - this.expected = options.expected; - this.operator = options.operator; - if (options.message) { - this.message = options.message; - this.generatedMessage = false; - } else { - this.message = getMessage(this); - this.generatedMessage = true; - } - var stackStartFunction = options.stackStartFunction || fail; - if (Error.captureStackTrace) { - Error.captureStackTrace(this, stackStartFunction); - } else { - // non v8 browsers so we can have a stacktrace - var err = new Error(); - if (err.stack) { - var out = err.stack; - - // try to strip useless frames - var fn_name = getName(stackStartFunction); - var idx = out.indexOf('\n' + fn_name); - if (idx >= 0) { - // once we have located the function frame - // we need to strip out everything before it (and its line) - var next_line = out.indexOf('\n', idx + 1); - out = out.substring(next_line + 1); - } - - this.stack = out; - } - } - }; - - // assert.AssertionError instanceof Error - util.inherits(assert.AssertionError, Error); - - function truncate(s, n) { - if (typeof s === 'string') { - return s.length < n ? s : s.slice(0, n); - } else { - return s; - } - } - function inspect(something) { - if (functionsHaveNames || !util.isFunction(something)) { - return util.inspect(something); - } - var rawname = getName(something); - var name = rawname ? ': ' + rawname : ''; - return '[Function' + name + ']'; - } - function getMessage(self) { - return truncate(inspect(self.actual), 128) + ' ' + - self.operator + ' ' + - truncate(inspect(self.expected), 128); - } - - // At present only the three keys mentioned above are used and - // understood by the spec. Implementations or sub modules can pass - // other keys to the AssertionError's constructor - they will be - // ignored. - - // 3. All of the following functions must throw an AssertionError - // when a corresponding condition is not met, with a message that - // may be undefined if not provided. All assertion methods provide - // both the actual and expected values to the assertion error for - // display purposes. - - function fail(actual, expected, message, operator, stackStartFunction) { - throw new assert.AssertionError({ - message: message, - actual: actual, - expected: expected, - operator: operator, - stackStartFunction: stackStartFunction - }); - } - - // EXTENSION! allows for well behaved errors defined elsewhere. - assert.fail = fail; - - // 4. Pure assertion tests whether a value is truthy, as determined - // by !!guard. - // assert.ok(guard, message_opt); - // This statement is equivalent to assert.equal(true, !!guard, - // message_opt);. To test strictly for the value true, use - // assert.strictEqual(true, guard, message_opt);. - - function ok(value, message) { - if (!value) fail(value, true, message, '==', assert.ok); - } - assert.ok = ok; - - // 5. The equality assertion tests shallow, coercive equality with - // ==. - // assert.equal(actual, expected, message_opt); - - assert.equal = function equal(actual, expected, message) { - if (actual != expected) fail(actual, expected, message, '==', assert.equal); - }; - - // 6. The non-equality assertion tests for whether two objects are not equal - // with != assert.notEqual(actual, expected, message_opt); - - assert.notEqual = function notEqual(actual, expected, message) { - if (actual == expected) { - fail(actual, expected, message, '!=', assert.notEqual); - } - }; - - // 7. The equivalence assertion tests a deep equality relation. - // assert.deepEqual(actual, expected, message_opt); - - assert.deepEqual = function deepEqual(actual, expected, message) { - if (!_deepEqual(actual, expected, false)) { - fail(actual, expected, message, 'deepEqual', assert.deepEqual); - } - }; - - assert.deepStrictEqual = function deepStrictEqual(actual, expected, message) { - if (!_deepEqual(actual, expected, true)) { - fail(actual, expected, message, 'deepStrictEqual', assert.deepStrictEqual); - } - }; - - function _deepEqual(actual, expected, strict, memos) { - // 7.1. All identical values are equivalent, as determined by ===. - if (actual === expected) { - return true; - } else if (isBuffer(actual) && isBuffer(expected)) { - return compare(actual, expected) === 0; - - // 7.2. If the expected value is a Date object, the actual value is - // equivalent if it is also a Date object that refers to the same time. - } else if (util.isDate(actual) && util.isDate(expected)) { - return actual.getTime() === expected.getTime(); - - // 7.3 If the expected value is a RegExp object, the actual value is - // equivalent if it is also a RegExp object with the same source and - // properties (`global`, `multiline`, `lastIndex`, `ignoreCase`). - } else if (util.isRegExp(actual) && util.isRegExp(expected)) { - return actual.source === expected.source && - actual.global === expected.global && - actual.multiline === expected.multiline && - actual.lastIndex === expected.lastIndex && - actual.ignoreCase === expected.ignoreCase; - - // 7.4. Other pairs that do not both pass typeof value == 'object', - // equivalence is determined by ==. - } else if ((actual === null || typeof actual !== 'object') && - (expected === null || typeof expected !== 'object')) { - return strict ? actual === expected : actual == expected; - - // If both values are instances of typed arrays, wrap their underlying - // ArrayBuffers in a Buffer each to increase performance - // This optimization requires the arrays to have the same type as checked by - // Object.prototype.toString (aka pToString). Never perform binary - // comparisons for Float*Arrays, though, since e.g. +0 === -0 but their - // bit patterns are not identical. - } else if (isView(actual) && isView(expected) && - pToString(actual) === pToString(expected) && - !(actual instanceof Float32Array || - actual instanceof Float64Array)) { - return compare(new Uint8Array(actual.buffer), - new Uint8Array(expected.buffer)) === 0; - - // 7.5 For all other Object pairs, including Array objects, equivalence is - // determined by having the same number of owned properties (as verified - // with Object.prototype.hasOwnProperty.call), the same set of keys - // (although not necessarily the same order), equivalent values for every - // corresponding key, and an identical 'prototype' property. Note: this - // accounts for both named and indexed properties on Arrays. - } else if (isBuffer(actual) !== isBuffer(expected)) { - return false; - } else { - memos = memos || {actual: [], expected: []}; - - var actualIndex = memos.actual.indexOf(actual); - if (actualIndex !== -1) { - if (actualIndex === memos.expected.indexOf(expected)) { - return true; - } - } - - memos.actual.push(actual); - memos.expected.push(expected); - - return objEquiv(actual, expected, strict, memos); - } - } - - function isArguments(object) { - return Object.prototype.toString.call(object) == '[object Arguments]'; - } - - function objEquiv(a, b, strict, actualVisitedObjects) { - if (a === null || a === undefined || b === null || b === undefined) - return false; - // if one is a primitive, the other must be same - if (util.isPrimitive(a) || util.isPrimitive(b)) - return a === b; - if (strict && Object.getPrototypeOf(a) !== Object.getPrototypeOf(b)) - return false; - var aIsArgs = isArguments(a); - var bIsArgs = isArguments(b); - if ((aIsArgs && !bIsArgs) || (!aIsArgs && bIsArgs)) - return false; - if (aIsArgs) { - a = pSlice.call(a); - b = pSlice.call(b); - return _deepEqual(a, b, strict); - } - var ka = objectKeys(a); - var kb = objectKeys(b); - var key, i; - // having the same number of owned properties (keys incorporates - // hasOwnProperty) - if (ka.length !== kb.length) - return false; - //the same set of keys (although not necessarily the same order), - ka.sort(); - kb.sort(); - //~~~cheap key test - for (i = ka.length - 1; i >= 0; i--) { - if (ka[i] !== kb[i]) - return false; - } - //equivalent values for every corresponding key, and - //~~~possibly expensive deep test - for (i = ka.length - 1; i >= 0; i--) { - key = ka[i]; - if (!_deepEqual(a[key], b[key], strict, actualVisitedObjects)) - return false; - } - return true; - } - - // 8. The non-equivalence assertion tests for any deep inequality. - // assert.notDeepEqual(actual, expected, message_opt); - - assert.notDeepEqual = function notDeepEqual(actual, expected, message) { - if (_deepEqual(actual, expected, false)) { - fail(actual, expected, message, 'notDeepEqual', assert.notDeepEqual); - } - }; - - assert.notDeepStrictEqual = notDeepStrictEqual; - function notDeepStrictEqual(actual, expected, message) { - if (_deepEqual(actual, expected, true)) { - fail(actual, expected, message, 'notDeepStrictEqual', notDeepStrictEqual); - } - } - - - // 9. The strict equality assertion tests strict equality, as determined by ===. - // assert.strictEqual(actual, expected, message_opt); - - assert.strictEqual = function strictEqual(actual, expected, message) { - if (actual !== expected) { - fail(actual, expected, message, '===', assert.strictEqual); - } - }; - - // 10. The strict non-equality assertion tests for strict inequality, as - // determined by !==. assert.notStrictEqual(actual, expected, message_opt); - - assert.notStrictEqual = function notStrictEqual(actual, expected, message) { - if (actual === expected) { - fail(actual, expected, message, '!==', assert.notStrictEqual); - } - }; - - function expectedException(actual, expected) { - if (!actual || !expected) { - return false; - } - - if (Object.prototype.toString.call(expected) == '[object RegExp]') { - return expected.test(actual); - } - - try { - if (actual instanceof expected) { - return true; - } - } catch (e) { - // Ignore. The instanceof check doesn't work for arrow functions. - } - - if (Error.isPrototypeOf(expected)) { - return false; - } - - return expected.call({}, actual) === true; - } - - function _tryBlock(block) { - var error; - try { - block(); - } catch (e) { - error = e; - } - return error; - } - - function _throws(shouldThrow, block, expected, message) { - var actual; - - if (typeof block !== 'function') { - throw new TypeError('"block" argument must be a function'); - } - - if (typeof expected === 'string') { - message = expected; - expected = null; - } - - actual = _tryBlock(block); - - message = (expected && expected.name ? ' (' + expected.name + ').' : '.') + - (message ? ' ' + message : '.'); - - if (shouldThrow && !actual) { - fail(actual, expected, 'Missing expected exception' + message); - } - - var userProvidedMessage = typeof message === 'string'; - var isUnwantedException = !shouldThrow && util.isError(actual); - var isUnexpectedException = !shouldThrow && actual && !expected; - - if ((isUnwantedException && - userProvidedMessage && - expectedException(actual, expected)) || - isUnexpectedException) { - fail(actual, expected, 'Got unwanted exception' + message); - } - - if ((shouldThrow && actual && expected && - !expectedException(actual, expected)) || (!shouldThrow && actual)) { - throw actual; - } - } - - // 11. Expected to throw an error: - // assert.throws(block, Error_opt, message_opt); - - assert.throws = function(block, /*optional*/error, /*optional*/message) { - _throws(true, block, error, message); - }; - - // EXTENSION! This is annoying to write outside this module. - assert.doesNotThrow = function(block, /*optional*/error, /*optional*/message) { - _throws(false, block, error, message); - }; - - assert.ifError = function(err) { if (err) throw err; }; - - var objectKeys = Object.keys || function (obj) { - var keys = []; - for (var key in obj) { - if (hasOwn.call(obj, key)) keys.push(key); - } - return keys; - }; - - /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) /***/ }, /* 147 */ /***/ function(module, exports, __webpack_require__) { - /* WEBPACK VAR INJECTION */(function(Buffer) {/*! - * ws: a node.js websocket client - * Copyright(c) 2011 Einar Otto Stangvik - * MIT Licensed - */ +"use strict"; +/* WEBPACK VAR INJECTION */(function(global) {'use strict'; - var util = __webpack_require__(75) - , Validation = __webpack_require__(148).Validation - , ErrorCodes = __webpack_require__(117) - , BufferPool = __webpack_require__(152) - , bufferUtil = __webpack_require__(118).BufferUtil - , PerMessageDeflate = __webpack_require__(125); +// compare and isBuffer taken from https://github.com/feross/buffer/blob/680e9e5e488f22aac27599a57dc844a6315928dd/index.js +// original notice: - /** - * HyBi Receiver implementation - */ +/*! + * The buffer module from node.js, for the browser. + * + * @author Feross Aboukhadijeh + * @license MIT + */ +function compare(a, b) { + if (a === b) { + return 0; + } - function Receiver (extensions,maxPayload) { - if (this instanceof Receiver === false) { - throw new TypeError("Classes can't be function-called"); - } - if(typeof extensions==='number'){ - maxPayload=extensions; - extensions={}; - } + var x = a.length; + var y = b.length; + + for (var i = 0, len = Math.min(x, y); i < len; ++i) { + if (a[i] !== b[i]) { + x = a[i]; + y = b[i]; + break; + } + } + + if (x < y) { + return -1; + } + if (y < x) { + return 1; + } + return 0; +} +function isBuffer(b) { + if (global.Buffer && typeof global.Buffer.isBuffer === 'function') { + return global.Buffer.isBuffer(b); + } + return !!(b != null && b._isBuffer); +} + +// based on node assert, original notice: + +// http://wiki.commonjs.org/wiki/Unit_Testing/1.0 +// +// THIS IS NOT TESTED NOR LIKELY TO WORK OUTSIDE V8! +// +// Originally from narwhal.js (http://narwhaljs.org) +// Copyright (c) 2009 Thomas Robinson <280north.com> +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the 'Software'), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +var util = __webpack_require__(8); +var hasOwn = Object.prototype.hasOwnProperty; +var pSlice = Array.prototype.slice; +var functionsHaveNames = (function () { + return function foo() {}.name === 'foo'; +}()); +function pToString (obj) { + return Object.prototype.toString.call(obj); +} +function isView(arrbuf) { + if (isBuffer(arrbuf)) { + return false; + } + if (typeof global.ArrayBuffer !== 'function') { + return false; + } + if (typeof ArrayBuffer.isView === 'function') { + return ArrayBuffer.isView(arrbuf); + } + if (!arrbuf) { + return false; + } + if (arrbuf instanceof DataView) { + return true; + } + if (arrbuf.buffer && arrbuf.buffer instanceof ArrayBuffer) { + return true; + } + return false; +} +// 1. The assert module provides functions that throw +// AssertionError's when particular conditions are not met. The +// assert module must conform to the following interface. + +var assert = module.exports = ok; + +// 2. The AssertionError is defined in assert. +// new assert.AssertionError({ message: message, +// actual: actual, +// expected: expected }) + +var regex = /\s*function\s+([^\(\s]*)\s*/; +// based on https://github.com/ljharb/function.prototype.name/blob/adeeeec8bfcc6068b187d7d9fb3d5bb1d3a30899/implementation.js +function getName(func) { + if (!util.isFunction(func)) { + return; + } + if (functionsHaveNames) { + return func.name; + } + var str = func.toString(); + var match = str.match(regex); + return match && match[1]; +} +assert.AssertionError = function AssertionError(options) { + this.name = 'AssertionError'; + this.actual = options.actual; + this.expected = options.expected; + this.operator = options.operator; + if (options.message) { + this.message = options.message; + this.generatedMessage = false; + } else { + this.message = getMessage(this); + this.generatedMessage = true; + } + var stackStartFunction = options.stackStartFunction || fail; + if (Error.captureStackTrace) { + Error.captureStackTrace(this, stackStartFunction); + } else { + // non v8 browsers so we can have a stacktrace + var err = new Error(); + if (err.stack) { + var out = err.stack; + + // try to strip useless frames + var fn_name = getName(stackStartFunction); + var idx = out.indexOf('\n' + fn_name); + if (idx >= 0) { + // once we have located the function frame + // we need to strip out everything before it (and its line) + var next_line = out.indexOf('\n', idx + 1); + out = out.substring(next_line + 1); + } + + this.stack = out; + } + } +}; + +// assert.AssertionError instanceof Error +util.inherits(assert.AssertionError, Error); + +function truncate(s, n) { + if (typeof s === 'string') { + return s.length < n ? s : s.slice(0, n); + } else { + return s; + } +} +function inspect(something) { + if (functionsHaveNames || !util.isFunction(something)) { + return util.inspect(something); + } + var rawname = getName(something); + var name = rawname ? ': ' + rawname : ''; + return '[Function' + name + ']'; +} +function getMessage(self) { + return truncate(inspect(self.actual), 128) + ' ' + + self.operator + ' ' + + truncate(inspect(self.expected), 128); +} + +// At present only the three keys mentioned above are used and +// understood by the spec. Implementations or sub modules can pass +// other keys to the AssertionError's constructor - they will be +// ignored. + +// 3. All of the following functions must throw an AssertionError +// when a corresponding condition is not met, with a message that +// may be undefined if not provided. All assertion methods provide +// both the actual and expected values to the assertion error for +// display purposes. + +function fail(actual, expected, message, operator, stackStartFunction) { + throw new assert.AssertionError({ + message: message, + actual: actual, + expected: expected, + operator: operator, + stackStartFunction: stackStartFunction + }); +} + +// EXTENSION! allows for well behaved errors defined elsewhere. +assert.fail = fail; + +// 4. Pure assertion tests whether a value is truthy, as determined +// by !!guard. +// assert.ok(guard, message_opt); +// This statement is equivalent to assert.equal(true, !!guard, +// message_opt);. To test strictly for the value true, use +// assert.strictEqual(true, guard, message_opt);. + +function ok(value, message) { + if (!value) fail(value, true, message, '==', assert.ok); +} +assert.ok = ok; + +// 5. The equality assertion tests shallow, coercive equality with +// ==. +// assert.equal(actual, expected, message_opt); + +assert.equal = function equal(actual, expected, message) { + if (actual != expected) fail(actual, expected, message, '==', assert.equal); +}; + +// 6. The non-equality assertion tests for whether two objects are not equal +// with != assert.notEqual(actual, expected, message_opt); + +assert.notEqual = function notEqual(actual, expected, message) { + if (actual == expected) { + fail(actual, expected, message, '!=', assert.notEqual); + } +}; + +// 7. The equivalence assertion tests a deep equality relation. +// assert.deepEqual(actual, expected, message_opt); + +assert.deepEqual = function deepEqual(actual, expected, message) { + if (!_deepEqual(actual, expected, false)) { + fail(actual, expected, message, 'deepEqual', assert.deepEqual); + } +}; + +assert.deepStrictEqual = function deepStrictEqual(actual, expected, message) { + if (!_deepEqual(actual, expected, true)) { + fail(actual, expected, message, 'deepStrictEqual', assert.deepStrictEqual); + } +}; + +function _deepEqual(actual, expected, strict, memos) { + // 7.1. All identical values are equivalent, as determined by ===. + if (actual === expected) { + return true; + } else if (isBuffer(actual) && isBuffer(expected)) { + return compare(actual, expected) === 0; + + // 7.2. If the expected value is a Date object, the actual value is + // equivalent if it is also a Date object that refers to the same time. + } else if (util.isDate(actual) && util.isDate(expected)) { + return actual.getTime() === expected.getTime(); + + // 7.3 If the expected value is a RegExp object, the actual value is + // equivalent if it is also a RegExp object with the same source and + // properties (`global`, `multiline`, `lastIndex`, `ignoreCase`). + } else if (util.isRegExp(actual) && util.isRegExp(expected)) { + return actual.source === expected.source && + actual.global === expected.global && + actual.multiline === expected.multiline && + actual.lastIndex === expected.lastIndex && + actual.ignoreCase === expected.ignoreCase; + + // 7.4. Other pairs that do not both pass typeof value == 'object', + // equivalence is determined by ==. + } else if ((actual === null || typeof actual !== 'object') && + (expected === null || typeof expected !== 'object')) { + return strict ? actual === expected : actual == expected; + + // If both values are instances of typed arrays, wrap their underlying + // ArrayBuffers in a Buffer each to increase performance + // This optimization requires the arrays to have the same type as checked by + // Object.prototype.toString (aka pToString). Never perform binary + // comparisons for Float*Arrays, though, since e.g. +0 === -0 but their + // bit patterns are not identical. + } else if (isView(actual) && isView(expected) && + pToString(actual) === pToString(expected) && + !(actual instanceof Float32Array || + actual instanceof Float64Array)) { + return compare(new Uint8Array(actual.buffer), + new Uint8Array(expected.buffer)) === 0; + + // 7.5 For all other Object pairs, including Array objects, equivalence is + // determined by having the same number of owned properties (as verified + // with Object.prototype.hasOwnProperty.call), the same set of keys + // (although not necessarily the same order), equivalent values for every + // corresponding key, and an identical 'prototype' property. Note: this + // accounts for both named and indexed properties on Arrays. + } else if (isBuffer(actual) !== isBuffer(expected)) { + return false; + } else { + memos = memos || {actual: [], expected: []}; + + var actualIndex = memos.actual.indexOf(actual); + if (actualIndex !== -1) { + if (actualIndex === memos.expected.indexOf(expected)) { + return true; + } + } + + memos.actual.push(actual); + memos.expected.push(expected); + + return objEquiv(actual, expected, strict, memos); + } +} + +function isArguments(object) { + return Object.prototype.toString.call(object) == '[object Arguments]'; +} + +function objEquiv(a, b, strict, actualVisitedObjects) { + if (a === null || a === undefined || b === null || b === undefined) + return false; + // if one is a primitive, the other must be same + if (util.isPrimitive(a) || util.isPrimitive(b)) + return a === b; + if (strict && Object.getPrototypeOf(a) !== Object.getPrototypeOf(b)) + return false; + var aIsArgs = isArguments(a); + var bIsArgs = isArguments(b); + if ((aIsArgs && !bIsArgs) || (!aIsArgs && bIsArgs)) + return false; + if (aIsArgs) { + a = pSlice.call(a); + b = pSlice.call(b); + return _deepEqual(a, b, strict); + } + var ka = objectKeys(a); + var kb = objectKeys(b); + var key, i; + // having the same number of owned properties (keys incorporates + // hasOwnProperty) + if (ka.length !== kb.length) + return false; + //the same set of keys (although not necessarily the same order), + ka.sort(); + kb.sort(); + //~~~cheap key test + for (i = ka.length - 1; i >= 0; i--) { + if (ka[i] !== kb[i]) + return false; + } + //equivalent values for every corresponding key, and + //~~~possibly expensive deep test + for (i = ka.length - 1; i >= 0; i--) { + key = ka[i]; + if (!_deepEqual(a[key], b[key], strict, actualVisitedObjects)) + return false; + } + return true; +} + +// 8. The non-equivalence assertion tests for any deep inequality. +// assert.notDeepEqual(actual, expected, message_opt); + +assert.notDeepEqual = function notDeepEqual(actual, expected, message) { + if (_deepEqual(actual, expected, false)) { + fail(actual, expected, message, 'notDeepEqual', assert.notDeepEqual); + } +}; + +assert.notDeepStrictEqual = notDeepStrictEqual; +function notDeepStrictEqual(actual, expected, message) { + if (_deepEqual(actual, expected, true)) { + fail(actual, expected, message, 'notDeepStrictEqual', notDeepStrictEqual); + } +} - // memory pool for fragmented messages - var fragmentedPoolPrevUsed = -1; - this.fragmentedBufferPool = new BufferPool(1024, function(db, length) { - return db.used + length; - }, function(db) { - return fragmentedPoolPrevUsed = fragmentedPoolPrevUsed >= 0 ? - Math.ceil((fragmentedPoolPrevUsed + db.used) / 2) : - db.used; - }); +// 9. The strict equality assertion tests strict equality, as determined by ===. +// assert.strictEqual(actual, expected, message_opt); - // memory pool for unfragmented messages - var unfragmentedPoolPrevUsed = -1; - this.unfragmentedBufferPool = new BufferPool(1024, function(db, length) { - return db.used + length; - }, function(db) { - return unfragmentedPoolPrevUsed = unfragmentedPoolPrevUsed >= 0 ? - Math.ceil((unfragmentedPoolPrevUsed + db.used) / 2) : - db.used; - }); - this.extensions = extensions || {}; - this.maxPayload = maxPayload || 0; - this.currentPayloadLength = 0; - this.state = { - activeFragmentedOperation: null, - lastFragment: false, - masked: false, - opcode: 0, - fragmentedOperation: false - }; - this.overflow = []; - this.headerBuffer = new Buffer(10); - this.expectOffset = 0; - this.expectBuffer = null; - this.expectHandler = null; - this.currentMessage = []; - this.currentMessageLength = 0; - this.messageHandlers = []; - this.expectHeader(2, this.processPacket); - this.dead = false; - this.processing = false; +assert.strictEqual = function strictEqual(actual, expected, message) { + if (actual !== expected) { + fail(actual, expected, message, '===', assert.strictEqual); + } +}; - this.onerror = function() {}; - this.ontext = function() {}; - this.onbinary = function() {}; - this.onclose = function() {}; - this.onping = function() {}; - this.onpong = function() {}; - } +// 10. The strict non-equality assertion tests for strict inequality, as +// determined by !==. assert.notStrictEqual(actual, expected, message_opt); - module.exports = Receiver; +assert.notStrictEqual = function notStrictEqual(actual, expected, message) { + if (actual === expected) { + fail(actual, expected, message, '!==', assert.notStrictEqual); + } +}; - /** - * Add new data to the parser. - * - * @api public - */ +function expectedException(actual, expected) { + if (!actual || !expected) { + return false; + } - Receiver.prototype.add = function(data) { - if (this.dead) return; - var dataLength = data.length; - if (dataLength == 0) return; - if (this.expectBuffer == null) { - this.overflow.push(data); - return; - } - var toRead = Math.min(dataLength, this.expectBuffer.length - this.expectOffset); - fastCopy(toRead, data, this.expectBuffer, this.expectOffset); - this.expectOffset += toRead; - if (toRead < dataLength) { - this.overflow.push(data.slice(toRead)); - } - while (this.expectBuffer && this.expectOffset == this.expectBuffer.length) { - var bufferForHandler = this.expectBuffer; - this.expectBuffer = null; - this.expectOffset = 0; - this.expectHandler.call(this, bufferForHandler); - } - }; + if (Object.prototype.toString.call(expected) == '[object RegExp]') { + return expected.test(actual); + } - /** - * Releases all resources used by the receiver. - * - * @api public - */ + try { + if (actual instanceof expected) { + return true; + } + } catch (e) { + // Ignore. The instanceof check doesn't work for arrow functions. + } - Receiver.prototype.cleanup = function() { - this.dead = true; - this.overflow = null; - this.headerBuffer = null; - this.expectBuffer = null; - this.expectHandler = null; - this.unfragmentedBufferPool = null; - this.fragmentedBufferPool = null; - this.state = null; - this.currentMessage = null; - this.onerror = null; - this.ontext = null; - this.onbinary = null; - this.onclose = null; - this.onping = null; - this.onpong = null; - }; + if (Error.isPrototypeOf(expected)) { + return false; + } - /** - * Waits for a certain amount of header bytes to be available, then fires a callback. - * - * @api private - */ + return expected.call({}, actual) === true; +} - Receiver.prototype.expectHeader = function(length, handler) { - if (length == 0) { - handler(null); - return; - } - this.expectBuffer = this.headerBuffer.slice(this.expectOffset, this.expectOffset + length); - this.expectHandler = handler; - var toRead = length; - while (toRead > 0 && this.overflow.length > 0) { - var fromOverflow = this.overflow.pop(); - if (toRead < fromOverflow.length) this.overflow.push(fromOverflow.slice(toRead)); - var read = Math.min(fromOverflow.length, toRead); - fastCopy(read, fromOverflow, this.expectBuffer, this.expectOffset); - this.expectOffset += read; - toRead -= read; - } - }; +function _tryBlock(block) { + var error; + try { + block(); + } catch (e) { + error = e; + } + return error; +} - /** - * Waits for a certain amount of data bytes to be available, then fires a callback. - * - * @api private - */ +function _throws(shouldThrow, block, expected, message) { + var actual; - Receiver.prototype.expectData = function(length, handler) { - if (length == 0) { - handler(null); - return; - } - this.expectBuffer = this.allocateFromPool(length, this.state.fragmentedOperation); - this.expectHandler = handler; - var toRead = length; - while (toRead > 0 && this.overflow.length > 0) { - var fromOverflow = this.overflow.pop(); - if (toRead < fromOverflow.length) this.overflow.push(fromOverflow.slice(toRead)); - var read = Math.min(fromOverflow.length, toRead); - fastCopy(read, fromOverflow, this.expectBuffer, this.expectOffset); - this.expectOffset += read; - toRead -= read; - } - }; + if (typeof block !== 'function') { + throw new TypeError('"block" argument must be a function'); + } - /** - * Allocates memory from the buffer pool. - * - * @api private - */ + if (typeof expected === 'string') { + message = expected; + expected = null; + } - Receiver.prototype.allocateFromPool = function(length, isFragmented) { - return (isFragmented ? this.fragmentedBufferPool : this.unfragmentedBufferPool).get(length); - }; + actual = _tryBlock(block); - /** - * Start processing a new packet. - * - * @api private - */ + message = (expected && expected.name ? ' (' + expected.name + ').' : '.') + + (message ? ' ' + message : '.'); - Receiver.prototype.processPacket = function (data) { - if (this.extensions[PerMessageDeflate.extensionName]) { - if ((data[0] & 0x30) != 0) { - this.error('reserved fields (2, 3) must be empty', 1002); - return; - } - } else { - if ((data[0] & 0x70) != 0) { - this.error('reserved fields must be empty', 1002); - return; - } - } - this.state.lastFragment = (data[0] & 0x80) == 0x80; - this.state.masked = (data[1] & 0x80) == 0x80; - var compressed = (data[0] & 0x40) == 0x40; - var opcode = data[0] & 0xf; - if (opcode === 0) { - if (compressed) { - this.error('continuation frame cannot have the Per-message Compressed bits', 1002); - return; - } - // continuation frame - this.state.fragmentedOperation = true; - this.state.opcode = this.state.activeFragmentedOperation; - if (!(this.state.opcode == 1 || this.state.opcode == 2)) { - this.error('continuation frame cannot follow current opcode', 1002); - return; - } - } - else { - if (opcode < 3 && this.state.activeFragmentedOperation != null) { - this.error('data frames after the initial data frame must have opcode 0', 1002); - return; - } - if (opcode >= 8 && compressed) { - this.error('control frames cannot have the Per-message Compressed bits', 1002); - return; - } - this.state.compressed = compressed; - this.state.opcode = opcode; - if (this.state.lastFragment === false) { - this.state.fragmentedOperation = true; - this.state.activeFragmentedOperation = opcode; - } - else this.state.fragmentedOperation = false; - } - var handler = opcodes[this.state.opcode]; - if (typeof handler == 'undefined') this.error('no handler for opcode ' + this.state.opcode, 1002); - else { - handler.start.call(this, data); - } - }; + if (shouldThrow && !actual) { + fail(actual, expected, 'Missing expected exception' + message); + } - /** - * Endprocessing a packet. - * - * @api private - */ + var userProvidedMessage = typeof message === 'string'; + var isUnwantedException = !shouldThrow && util.isError(actual); + var isUnexpectedException = !shouldThrow && actual && !expected; - Receiver.prototype.endPacket = function() { - if (this.dead) return; - if (!this.state.fragmentedOperation) this.unfragmentedBufferPool.reset(true); - else if (this.state.lastFragment) this.fragmentedBufferPool.reset(true); - this.expectOffset = 0; - this.expectBuffer = null; - this.expectHandler = null; - if (this.state.lastFragment && this.state.opcode === this.state.activeFragmentedOperation) { - // end current fragmented operation - this.state.activeFragmentedOperation = null; - } - this.currentPayloadLength = 0; - this.state.lastFragment = false; - this.state.opcode = this.state.activeFragmentedOperation != null ? this.state.activeFragmentedOperation : 0; - this.state.masked = false; - this.expectHeader(2, this.processPacket); - }; + if ((isUnwantedException && + userProvidedMessage && + expectedException(actual, expected)) || + isUnexpectedException) { + fail(actual, expected, 'Got unwanted exception' + message); + } - /** - * Reset the parser state. - * - * @api private - */ + if ((shouldThrow && actual && expected && + !expectedException(actual, expected)) || (!shouldThrow && actual)) { + throw actual; + } +} - Receiver.prototype.reset = function() { - if (this.dead) return; - this.state = { - activeFragmentedOperation: null, - lastFragment: false, - masked: false, - opcode: 0, - fragmentedOperation: false - }; - this.fragmentedBufferPool.reset(true); - this.unfragmentedBufferPool.reset(true); - this.expectOffset = 0; - this.expectBuffer = null; - this.expectHandler = null; - this.overflow = []; - this.currentMessage = []; - this.currentMessageLength = 0; - this.messageHandlers = []; - this.currentPayloadLength = 0; - }; +// 11. Expected to throw an error: +// assert.throws(block, Error_opt, message_opt); - /** - * Unmask received data. - * - * @api private - */ +assert.throws = function(block, /*optional*/error, /*optional*/message) { + _throws(true, block, error, message); +}; - Receiver.prototype.unmask = function (mask, buf, binary) { - if (mask != null && buf != null) bufferUtil.unmask(buf, mask); - if (binary) return buf; - return buf != null ? buf.toString('utf8') : ''; - }; +// EXTENSION! This is annoying to write outside this module. +assert.doesNotThrow = function(block, /*optional*/error, /*optional*/message) { + _throws(false, block, error, message); +}; - /** - * Handles an error - * - * @api private - */ +assert.ifError = function(err) { if (err) throw err; }; - Receiver.prototype.error = function (reason, protocolErrorCode) { - if (this.dead) return; - this.reset(); - if(typeof reason == 'string'){ - this.onerror(new Error(reason), protocolErrorCode); - } - else if(reason.constructor == Error){ - this.onerror(reason, protocolErrorCode); - } - else{ - this.onerror(new Error("An error occured"),protocolErrorCode); - } - return this; - }; +var objectKeys = Object.keys || function (obj) { + var keys = []; + for (var key in obj) { + if (hasOwn.call(obj, key)) keys.push(key); + } + return keys; +}; - /** - * Execute message handler buffers - * - * @api private - */ - - Receiver.prototype.flush = function() { - if (this.processing || this.dead) return; - - var handler = this.messageHandlers.shift(); - if (!handler) return; - - this.processing = true; - var self = this; - - handler(function() { - self.processing = false; - self.flush(); - }); - }; - - /** - * Apply extensions to message - * - * @api private - */ - - Receiver.prototype.applyExtensions = function(messageBuffer, fin, compressed, callback) { - var self = this; - if (compressed) { - this.extensions[PerMessageDeflate.extensionName].decompress(messageBuffer, fin, function(err, buffer) { - if (self.dead) return; - if (err) { - callback(new Error('invalid compressed data')); - return; - } - callback(null, buffer); - }); - } else { - callback(null, messageBuffer); - } - }; - - /** - * Checks payload size, disconnects socket when it exceeds maxPayload - * - * @api private - */ - Receiver.prototype.maxPayloadExceeded = function(length) { - if (this.maxPayload=== undefined || this.maxPayload === null || this.maxPayload < 1) { - return false; - } - var fullLength = this.currentPayloadLength + length; - if (fullLength < this.maxPayload) { - this.currentPayloadLength = fullLength; - return false; - } - this.error('payload cannot exceed ' + this.maxPayload + ' bytes', 1009); - this.messageBuffer=[]; - this.cleanup(); - - return true; - }; - - /** - * Buffer utilities - */ - - function readUInt16BE(start) { - return (this[start]<<8) + - this[start+1]; - } - - function readUInt32BE(start) { - return (this[start]<<24) + - (this[start+1]<<16) + - (this[start+2]<<8) + - this[start+3]; - } - - function fastCopy(length, srcBuffer, dstBuffer, dstOffset) { - switch (length) { - default: srcBuffer.copy(dstBuffer, dstOffset, 0, length); break; - case 16: dstBuffer[dstOffset+15] = srcBuffer[15]; - case 15: dstBuffer[dstOffset+14] = srcBuffer[14]; - case 14: dstBuffer[dstOffset+13] = srcBuffer[13]; - case 13: dstBuffer[dstOffset+12] = srcBuffer[12]; - case 12: dstBuffer[dstOffset+11] = srcBuffer[11]; - case 11: dstBuffer[dstOffset+10] = srcBuffer[10]; - case 10: dstBuffer[dstOffset+9] = srcBuffer[9]; - case 9: dstBuffer[dstOffset+8] = srcBuffer[8]; - case 8: dstBuffer[dstOffset+7] = srcBuffer[7]; - case 7: dstBuffer[dstOffset+6] = srcBuffer[6]; - case 6: dstBuffer[dstOffset+5] = srcBuffer[5]; - case 5: dstBuffer[dstOffset+4] = srcBuffer[4]; - case 4: dstBuffer[dstOffset+3] = srcBuffer[3]; - case 3: dstBuffer[dstOffset+2] = srcBuffer[2]; - case 2: dstBuffer[dstOffset+1] = srcBuffer[1]; - case 1: dstBuffer[dstOffset] = srcBuffer[0]; - } - } - - function clone(obj) { - var cloned = {}; - for (var k in obj) { - if (obj.hasOwnProperty(k)) { - cloned[k] = obj[k]; - } - } - return cloned; - } - - /** - * Opcode handlers - */ - - var opcodes = { - // text - '1': { - start: function(data) { - var self = this; - // decode length - var firstLength = data[1] & 0x7f; - if (firstLength < 126) { - if (self.maxPayloadExceeded(firstLength)){ - self.error('Maximumpayload exceeded in compressed text message. Aborting...', 1009); - return; - } - opcodes['1'].getData.call(self, firstLength); - } - else if (firstLength == 126) { - self.expectHeader(2, function(data) { - var length = readUInt16BE.call(data, 0); - if (self.maxPayloadExceeded(length)){ - self.error('Maximumpayload exceeded in compressed text message. Aborting...', 1009); - return; - } - opcodes['1'].getData.call(self, length); - }); - } - else if (firstLength == 127) { - self.expectHeader(8, function(data) { - if (readUInt32BE.call(data, 0) != 0) { - self.error('packets with length spanning more than 32 bit is currently not supported', 1008); - return; - } - var length = readUInt32BE.call(data, 4); - if (self.maxPayloadExceeded(length)){ - self.error('Maximumpayload exceeded in compressed text message. Aborting...', 1009); - return; - } - opcodes['1'].getData.call(self, readUInt32BE.call(data, 4)); - }); - } - }, - getData: function(length) { - var self = this; - if (self.state.masked) { - self.expectHeader(4, function(data) { - var mask = data; - self.expectData(length, function(data) { - opcodes['1'].finish.call(self, mask, data); - }); - }); - } - else { - self.expectData(length, function(data) { - opcodes['1'].finish.call(self, null, data); - }); - } - }, - finish: function(mask, data) { - var self = this; - var packet = this.unmask(mask, data, true) || new Buffer(0); - var state = clone(this.state); - this.messageHandlers.push(function(callback) { - self.applyExtensions(packet, state.lastFragment, state.compressed, function(err, buffer) { - if (err) { - if(err.type===1009){ - return self.error('Maximumpayload exceeded in compressed text message. Aborting...', 1009); - } - return self.error(err.message, 1007); - } - if (buffer != null) { - if( self.maxPayload==0 || (self.maxPayload > 0 && (self.currentMessageLength + buffer.length) < self.maxPayload) ){ - self.currentMessage.push(buffer); - } - else{ - self.currentMessage=null; - self.currentMessage = []; - self.currentMessageLength = 0; - self.error(new Error('Maximum payload exceeded. maxPayload: '+self.maxPayload), 1009); - return; - } - self.currentMessageLength += buffer.length; - } - if (state.lastFragment) { - var messageBuffer = Buffer.concat(self.currentMessage); - self.currentMessage = []; - self.currentMessageLength = 0; - if (!Validation.isValidUTF8(messageBuffer)) { - self.error('invalid utf8 sequence', 1007); - return; - } - self.ontext(messageBuffer.toString('utf8'), {masked: state.masked, buffer: messageBuffer}); - } - callback(); - }); - }); - this.flush(); - this.endPacket(); - } - }, - // binary - '2': { - start: function(data) { - var self = this; - // decode length - var firstLength = data[1] & 0x7f; - if (firstLength < 126) { - if (self.maxPayloadExceeded(firstLength)){ - self.error('Max payload exceeded in compressed text message. Aborting...', 1009); - return; - } - opcodes['2'].getData.call(self, firstLength); - } - else if (firstLength == 126) { - self.expectHeader(2, function(data) { - var length = readUInt16BE.call(data, 0); - if (self.maxPayloadExceeded(length)){ - self.error('Max payload exceeded in compressed text message. Aborting...', 1009); - return; - } - opcodes['2'].getData.call(self, length); - }); - } - else if (firstLength == 127) { - self.expectHeader(8, function(data) { - if (readUInt32BE.call(data, 0) != 0) { - self.error('packets with length spanning more than 32 bit is currently not supported', 1008); - return; - } - var length = readUInt32BE.call(data, 4, true); - if (self.maxPayloadExceeded(length)){ - self.error('Max payload exceeded in compressed text message. Aborting...', 1009); - return; - } - opcodes['2'].getData.call(self, length); - }); - } - }, - getData: function(length) { - var self = this; - if (self.state.masked) { - self.expectHeader(4, function(data) { - var mask = data; - self.expectData(length, function(data) { - opcodes['2'].finish.call(self, mask, data); - }); - }); - } - else { - self.expectData(length, function(data) { - opcodes['2'].finish.call(self, null, data); - }); - } - }, - finish: function(mask, data) { - var self = this; - var packet = this.unmask(mask, data, true) || new Buffer(0); - var state = clone(this.state); - this.messageHandlers.push(function(callback) { - self.applyExtensions(packet, state.lastFragment, state.compressed, function(err, buffer) { - if (err) { - if(err.type===1009){ - return self.error('Max payload exceeded in compressed binary message. Aborting...', 1009); - } - return self.error(err.message, 1007); - } - if (buffer != null) { - if( self.maxPayload==0 || (self.maxPayload > 0 && (self.currentMessageLength + buffer.length) < self.maxPayload) ){ - self.currentMessage.push(buffer); - } - else{ - self.currentMessage=null; - self.currentMessage = []; - self.currentMessageLength = 0; - self.error(new Error('Maximum payload exceeded'), 1009); - return; - } - self.currentMessageLength += buffer.length; - } - if (state.lastFragment) { - var messageBuffer = Buffer.concat(self.currentMessage); - self.currentMessage = []; - self.currentMessageLength = 0; - self.onbinary(messageBuffer, {masked: state.masked, buffer: messageBuffer}); - } - callback(); - }); - }); - this.flush(); - this.endPacket(); - } - }, - // close - '8': { - start: function(data) { - var self = this; - if (self.state.lastFragment == false) { - self.error('fragmented close is not supported', 1002); - return; - } - - // decode length - var firstLength = data[1] & 0x7f; - if (firstLength < 126) { - opcodes['8'].getData.call(self, firstLength); - } - else { - self.error('control frames cannot have more than 125 bytes of data', 1002); - } - }, - getData: function(length) { - var self = this; - if (self.state.masked) { - self.expectHeader(4, function(data) { - var mask = data; - self.expectData(length, function(data) { - opcodes['8'].finish.call(self, mask, data); - }); - }); - } - else { - self.expectData(length, function(data) { - opcodes['8'].finish.call(self, null, data); - }); - } - }, - finish: function(mask, data) { - var self = this; - data = self.unmask(mask, data, true); - - var state = clone(this.state); - this.messageHandlers.push(function() { - if (data && data.length == 1) { - self.error('close packets with data must be at least two bytes long', 1002); - return; - } - var code = data && data.length > 1 ? readUInt16BE.call(data, 0) : 1000; - if (!ErrorCodes.isValidErrorCode(code)) { - self.error('invalid error code', 1002); - return; - } - var message = ''; - if (data && data.length > 2) { - var messageBuffer = data.slice(2); - if (!Validation.isValidUTF8(messageBuffer)) { - self.error('invalid utf8 sequence', 1007); - return; - } - message = messageBuffer.toString('utf8'); - } - self.onclose(code, message, {masked: state.masked}); - self.reset(); - }); - this.flush(); - }, - }, - // ping - '9': { - start: function(data) { - var self = this; - if (self.state.lastFragment == false) { - self.error('fragmented ping is not supported', 1002); - return; - } - - // decode length - var firstLength = data[1] & 0x7f; - if (firstLength < 126) { - opcodes['9'].getData.call(self, firstLength); - } - else { - self.error('control frames cannot have more than 125 bytes of data', 1002); - } - }, - getData: function(length) { - var self = this; - if (self.state.masked) { - self.expectHeader(4, function(data) { - var mask = data; - self.expectData(length, function(data) { - opcodes['9'].finish.call(self, mask, data); - }); - }); - } - else { - self.expectData(length, function(data) { - opcodes['9'].finish.call(self, null, data); - }); - } - }, - finish: function(mask, data) { - var self = this; - data = this.unmask(mask, data, true); - var state = clone(this.state); - this.messageHandlers.push(function(callback) { - self.onping(data, {masked: state.masked, binary: true}); - callback(); - }); - this.flush(); - this.endPacket(); - } - }, - // pong - '10': { - start: function(data) { - var self = this; - if (self.state.lastFragment == false) { - self.error('fragmented pong is not supported', 1002); - return; - } - - // decode length - var firstLength = data[1] & 0x7f; - if (firstLength < 126) { - opcodes['10'].getData.call(self, firstLength); - } - else { - self.error('control frames cannot have more than 125 bytes of data', 1002); - } - }, - getData: function(length) { - var self = this; - if (this.state.masked) { - this.expectHeader(4, function(data) { - var mask = data; - self.expectData(length, function(data) { - opcodes['10'].finish.call(self, mask, data); - }); - }); - } - else { - this.expectData(length, function(data) { - opcodes['10'].finish.call(self, null, data); - }); - } - }, - finish: function(mask, data) { - var self = this; - data = self.unmask(mask, data, true); - var state = clone(this.state); - this.messageHandlers.push(function(callback) { - self.onpong(data, {masked: state.masked, binary: true}); - callback(); - }); - this.flush(); - this.endPacket(); - } - } - } - - /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(58).Buffer)) +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(16))) /***/ }, /* 148 */ -/***/ function(module, exports, __webpack_require__) { +/***/ function(module, exports) { - 'use strict'; +"use strict"; +'use strict' - /*! - * ws: a node.js websocket client - * Copyright(c) 2011 Einar Otto Stangvik - * MIT Licensed - */ +exports.byteLength = byteLength +exports.toByteArray = toByteArray +exports.fromByteArray = fromByteArray - try { - module.exports = __webpack_require__(149); - } catch (e) { - module.exports = __webpack_require__(151); - } +var lookup = [] +var revLookup = [] +var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array + +var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/' +for (var i = 0, len = code.length; i < len; ++i) { + lookup[i] = code[i] + revLookup[code.charCodeAt(i)] = i +} + +revLookup['-'.charCodeAt(0)] = 62 +revLookup['_'.charCodeAt(0)] = 63 + +function placeHoldersCount (b64) { + var len = b64.length + if (len % 4 > 0) { + throw new Error('Invalid string. Length must be a multiple of 4') + } + + // the number of equal signs (place holders) + // if there are two placeholders, than the two characters before it + // represent one byte + // if there is only one, then the three characters before it represent 2 bytes + // this is just a cheap hack to not do indexOf twice + return b64[len - 2] === '=' ? 2 : b64[len - 1] === '=' ? 1 : 0 +} + +function byteLength (b64) { + // base64 is 4/3 + up to two characters of the original data + return b64.length * 3 / 4 - placeHoldersCount(b64) +} + +function toByteArray (b64) { + var i, j, l, tmp, placeHolders, arr + var len = b64.length + placeHolders = placeHoldersCount(b64) + + arr = new Arr(len * 3 / 4 - placeHolders) + + // if there are placeholders, only get up to the last complete 4 chars + l = placeHolders > 0 ? len - 4 : len + + var L = 0 + + for (i = 0, j = 0; i < l; i += 4, j += 3) { + tmp = (revLookup[b64.charCodeAt(i)] << 18) | (revLookup[b64.charCodeAt(i + 1)] << 12) | (revLookup[b64.charCodeAt(i + 2)] << 6) | revLookup[b64.charCodeAt(i + 3)] + arr[L++] = (tmp >> 16) & 0xFF + arr[L++] = (tmp >> 8) & 0xFF + arr[L++] = tmp & 0xFF + } + + if (placeHolders === 2) { + tmp = (revLookup[b64.charCodeAt(i)] << 2) | (revLookup[b64.charCodeAt(i + 1)] >> 4) + arr[L++] = tmp & 0xFF + } else if (placeHolders === 1) { + tmp = (revLookup[b64.charCodeAt(i)] << 10) | (revLookup[b64.charCodeAt(i + 1)] << 4) | (revLookup[b64.charCodeAt(i + 2)] >> 2) + arr[L++] = (tmp >> 8) & 0xFF + arr[L++] = tmp & 0xFF + } + + return arr +} + +function tripletToBase64 (num) { + return lookup[num >> 18 & 0x3F] + lookup[num >> 12 & 0x3F] + lookup[num >> 6 & 0x3F] + lookup[num & 0x3F] +} + +function encodeChunk (uint8, start, end) { + var tmp + var output = [] + for (var i = start; i < end; i += 3) { + tmp = (uint8[i] << 16) + (uint8[i + 1] << 8) + (uint8[i + 2]) + output.push(tripletToBase64(tmp)) + } + return output.join('') +} + +function fromByteArray (uint8) { + var tmp + var len = uint8.length + var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes + var output = '' + var parts = [] + var maxChunkLength = 16383 // must be multiple of 3 + + // go through the array every three bytes, we'll deal with trailing stuff later + for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) { + parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength))) + } + + // pad the end with zeros, but make sure to not forget the extra bytes + if (extraBytes === 1) { + tmp = uint8[len - 1] + output += lookup[tmp >> 2] + output += lookup[(tmp << 4) & 0x3F] + output += '==' + } else if (extraBytes === 2) { + tmp = (uint8[len - 2] << 8) + (uint8[len - 1]) + output += lookup[tmp >> 10] + output += lookup[(tmp >> 4) & 0x3F] + output += lookup[(tmp << 2) & 0x3F] + output += '=' + } + + parts.push(output) + + return parts.join('') +} /***/ }, /* 149 */ /***/ function(module, exports, __webpack_require__) { - 'use strict'; +/* WEBPACK VAR INJECTION */(function(Buffer) {var aes = __webpack_require__(33) +var Transform = __webpack_require__(17) +var inherits = __webpack_require__(1) +var modes = __webpack_require__(34) +var StreamCipher = __webpack_require__(94) +var AuthCipher = __webpack_require__(87) +var ebtk = __webpack_require__(37) - try { - module.exports = __webpack_require__(120)('validation'); - } catch (e) { - module.exports = __webpack_require__(150); - } +inherits(Decipher, Transform) +function Decipher (mode, key, iv) { + if (!(this instanceof Decipher)) { + return new Decipher(mode, key, iv) + } + Transform.call(this) + this._cache = new Splitter() + this._last = void 0 + this._cipher = new aes.AES(key) + this._prev = new Buffer(iv.length) + iv.copy(this._prev) + this._mode = mode + this._autopadding = true +} +Decipher.prototype._update = function (data) { + this._cache.add(data) + var chunk + var thing + var out = [] + while ((chunk = this._cache.get(this._autopadding))) { + thing = this._mode.decrypt(this, chunk) + out.push(thing) + } + return Buffer.concat(out) +} +Decipher.prototype._final = function () { + var chunk = this._cache.flush() + if (this._autopadding) { + return unpad(this._mode.decrypt(this, chunk)) + } else if (chunk) { + throw new Error('data not multiple of block length') + } +} +Decipher.prototype.setAutoPadding = function (setTo) { + this._autopadding = !!setTo + return this +} +function Splitter () { + if (!(this instanceof Splitter)) { + return new Splitter() + } + this.cache = new Buffer('') +} +Splitter.prototype.add = function (data) { + this.cache = Buffer.concat([this.cache, data]) +} +Splitter.prototype.get = function (autoPadding) { + var out + if (autoPadding) { + if (this.cache.length > 16) { + out = this.cache.slice(0, 16) + this.cache = this.cache.slice(16) + return out + } + } else { + if (this.cache.length >= 16) { + out = this.cache.slice(0, 16) + this.cache = this.cache.slice(16) + return out + } + } + return null +} +Splitter.prototype.flush = function () { + if (this.cache.length) { + return this.cache + } +} +function unpad (last) { + var padded = last[15] + var i = -1 + while (++i < padded) { + if (last[(i + (16 - padded))] !== padded) { + throw new Error('unable to decrypt data') + } + } + if (padded === 16) { + return + } + return last.slice(0, 16 - padded) +} + +var modelist = { + ECB: __webpack_require__(92), + CBC: __webpack_require__(88), + CFB: __webpack_require__(89), + CFB8: __webpack_require__(91), + CFB1: __webpack_require__(90), + OFB: __webpack_require__(93), + CTR: __webpack_require__(35), + GCM: __webpack_require__(35) +} + +function createDecipheriv (suite, password, iv) { + var config = modes[suite.toLowerCase()] + if (!config) { + throw new TypeError('invalid suite type') + } + if (typeof iv === 'string') { + iv = new Buffer(iv) + } + if (typeof password === 'string') { + password = new Buffer(password) + } + if (password.length !== config.key / 8) { + throw new TypeError('invalid key length ' + password.length) + } + if (iv.length !== config.iv) { + throw new TypeError('invalid iv length ' + iv.length) + } + if (config.type === 'stream') { + return new StreamCipher(modelist[config.mode], password, iv, true) + } else if (config.type === 'auth') { + return new AuthCipher(modelist[config.mode], password, iv, true) + } + return new Decipher(modelist[config.mode], password, iv) +} + +function createDecipher (suite, password) { + var config = modes[suite.toLowerCase()] + if (!config) { + throw new TypeError('invalid suite type') + } + var keys = ebtk(password, false, config.key, config.iv) + return createDecipheriv(suite, keys.key, keys.iv) +} +exports.createDecipher = createDecipher +exports.createDecipheriv = createDecipheriv + +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer)) /***/ }, /* 150 */ -/***/ function(module, exports) { +/***/ function(module, exports, __webpack_require__) { - 'use strict'; +/* WEBPACK VAR INJECTION */(function(Buffer) {var aes = __webpack_require__(33) +var Transform = __webpack_require__(17) +var inherits = __webpack_require__(1) +var modes = __webpack_require__(34) +var ebtk = __webpack_require__(37) +var StreamCipher = __webpack_require__(94) +var AuthCipher = __webpack_require__(87) +inherits(Cipher, Transform) +function Cipher (mode, key, iv) { + if (!(this instanceof Cipher)) { + return new Cipher(mode, key, iv) + } + Transform.call(this) + this._cache = new Splitter() + this._cipher = new aes.AES(key) + this._prev = new Buffer(iv.length) + iv.copy(this._prev) + this._mode = mode + this._autopadding = true +} +Cipher.prototype._update = function (data) { + this._cache.add(data) + var chunk + var thing + var out = [] + while ((chunk = this._cache.get())) { + thing = this._mode.encrypt(this, chunk) + out.push(thing) + } + return Buffer.concat(out) +} +Cipher.prototype._final = function () { + var chunk = this._cache.flush() + if (this._autopadding) { + chunk = this._mode.encrypt(this, chunk) + this._cipher.scrub() + return chunk + } else if (chunk.toString('hex') !== '10101010101010101010101010101010') { + this._cipher.scrub() + throw new Error('data not multiple of block length') + } +} +Cipher.prototype.setAutoPadding = function (setTo) { + this._autopadding = !!setTo + return this +} - /*! - * UTF-8 validate: UTF-8 validation for WebSockets. - * Copyright(c) 2015 Einar Otto Stangvik - * MIT Licensed - */ +function Splitter () { + if (!(this instanceof Splitter)) { + return new Splitter() + } + this.cache = new Buffer('') +} +Splitter.prototype.add = function (data) { + this.cache = Buffer.concat([this.cache, data]) +} - module.exports.Validation = { - isValidUTF8: function(buffer) { - return true; - } - }; +Splitter.prototype.get = function () { + if (this.cache.length > 15) { + var out = this.cache.slice(0, 16) + this.cache = this.cache.slice(16) + return out + } + return null +} +Splitter.prototype.flush = function () { + var len = 16 - this.cache.length + var padBuff = new Buffer(len) + var i = -1 + while (++i < len) { + padBuff.writeUInt8(len, i) + } + var out = Buffer.concat([this.cache, padBuff]) + return out +} +var modelist = { + ECB: __webpack_require__(92), + CBC: __webpack_require__(88), + CFB: __webpack_require__(89), + CFB8: __webpack_require__(91), + CFB1: __webpack_require__(90), + OFB: __webpack_require__(93), + CTR: __webpack_require__(35), + GCM: __webpack_require__(35) +} + +function createCipheriv (suite, password, iv) { + var config = modes[suite.toLowerCase()] + if (!config) { + throw new TypeError('invalid suite type') + } + if (typeof iv === 'string') { + iv = new Buffer(iv) + } + if (typeof password === 'string') { + password = new Buffer(password) + } + if (password.length !== config.key / 8) { + throw new TypeError('invalid key length ' + password.length) + } + if (iv.length !== config.iv) { + throw new TypeError('invalid iv length ' + iv.length) + } + if (config.type === 'stream') { + return new StreamCipher(modelist[config.mode], password, iv) + } else if (config.type === 'auth') { + return new AuthCipher(modelist[config.mode], password, iv) + } + return new Cipher(modelist[config.mode], password, iv) +} +function createCipher (suite, password) { + var config = modes[suite.toLowerCase()] + if (!config) { + throw new TypeError('invalid suite type') + } + var keys = ebtk(password, false, config.key, config.iv) + return createCipheriv(suite, keys.key, keys.iv) +} + +exports.createCipheriv = createCipheriv +exports.createCipher = createCipher + +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer)) /***/ }, /* 151 */ -/***/ function(module, exports) { +/***/ function(module, exports, __webpack_require__) { - /*! - * ws: a node.js websocket client - * Copyright(c) 2011 Einar Otto Stangvik - * MIT Licensed - */ +/* WEBPACK VAR INJECTION */(function(Buffer) {var zeros = new Buffer(16) +zeros.fill(0) +module.exports = GHASH +function GHASH (key) { + this.h = key + this.state = new Buffer(16) + this.state.fill(0) + this.cache = new Buffer('') +} +// from http://bitwiseshiftleft.github.io/sjcl/doc/symbols/src/core_gcm.js.html +// by Juho Vähä-Herttua +GHASH.prototype.ghash = function (block) { + var i = -1 + while (++i < block.length) { + this.state[i] ^= block[i] + } + this._multiply() +} - exports.Validation = { - isValidUTF8: function(buffer) { - return true; - } - }; +GHASH.prototype._multiply = function () { + var Vi = toArray(this.h) + var Zi = [0, 0, 0, 0] + var j, xi, lsb_Vi + var i = -1 + while (++i < 128) { + xi = (this.state[~~(i / 8)] & (1 << (7 - i % 8))) !== 0 + if (xi) { + // Z_i+1 = Z_i ^ V_i + Zi = xor(Zi, Vi) + } + // Store the value of LSB(V_i) + lsb_Vi = (Vi[3] & 1) !== 0 + + // V_i+1 = V_i >> 1 + for (j = 3; j > 0; j--) { + Vi[j] = (Vi[j] >>> 1) | ((Vi[j - 1] & 1) << 31) + } + Vi[0] = Vi[0] >>> 1 + + // If LSB(V_i) is 1, V_i+1 = (V_i >> 1) ^ R + if (lsb_Vi) { + Vi[0] = Vi[0] ^ (0xe1 << 24) + } + } + this.state = fromArray(Zi) +} +GHASH.prototype.update = function (buf) { + this.cache = Buffer.concat([this.cache, buf]) + var chunk + while (this.cache.length >= 16) { + chunk = this.cache.slice(0, 16) + this.cache = this.cache.slice(16) + this.ghash(chunk) + } +} +GHASH.prototype.final = function (abl, bl) { + if (this.cache.length) { + this.ghash(Buffer.concat([this.cache, zeros], 16)) + } + this.ghash(fromArray([ + 0, abl, + 0, bl + ])) + return this.state +} + +function toArray (buf) { + return [ + buf.readUInt32BE(0), + buf.readUInt32BE(4), + buf.readUInt32BE(8), + buf.readUInt32BE(12) + ] +} +function fromArray (out) { + out = out.map(fixup_uint32) + var buf = new Buffer(16) + buf.writeUInt32BE(out[0], 0) + buf.writeUInt32BE(out[1], 4) + buf.writeUInt32BE(out[2], 8) + buf.writeUInt32BE(out[3], 12) + return buf +} +var uint_max = Math.pow(2, 32) +function fixup_uint32 (x) { + var ret, x_pos + ret = x > uint_max || x < 0 ? (x_pos = Math.abs(x) % uint_max, x < 0 ? uint_max - x_pos : x_pos) : x + return ret +} +function xor (a, b) { + return [ + a[0] ^ b[0], + a[1] ^ b[1], + a[2] ^ b[2], + a[3] ^ b[3] + ] +} + +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer)) /***/ }, /* 152 */ /***/ function(module, exports, __webpack_require__) { - /* WEBPACK VAR INJECTION */(function(Buffer) {/*! - * ws: a node.js websocket client - * Copyright(c) 2011 Einar Otto Stangvik - * MIT Licensed - */ +var ebtk = __webpack_require__(37) +var aes = __webpack_require__(47) +var DES = __webpack_require__(153) +var desModes = __webpack_require__(154) +var aesModes = __webpack_require__(34) +function createCipher (suite, password) { + var keyLen, ivLen + suite = suite.toLowerCase() + if (aesModes[suite]) { + keyLen = aesModes[suite].key + ivLen = aesModes[suite].iv + } else if (desModes[suite]) { + keyLen = desModes[suite].key * 8 + ivLen = desModes[suite].iv + } else { + throw new TypeError('invalid suite type') + } + var keys = ebtk(password, false, keyLen, ivLen) + return createCipheriv(suite, keys.key, keys.iv) +} +function createDecipher (suite, password) { + var keyLen, ivLen + suite = suite.toLowerCase() + if (aesModes[suite]) { + keyLen = aesModes[suite].key + ivLen = aesModes[suite].iv + } else if (desModes[suite]) { + keyLen = desModes[suite].key * 8 + ivLen = desModes[suite].iv + } else { + throw new TypeError('invalid suite type') + } + var keys = ebtk(password, false, keyLen, ivLen) + return createDecipheriv(suite, keys.key, keys.iv) +} - var util = __webpack_require__(75); +function createCipheriv (suite, key, iv) { + suite = suite.toLowerCase() + if (aesModes[suite]) { + return aes.createCipheriv(suite, key, iv) + } else if (desModes[suite]) { + return new DES({ + key: key, + iv: iv, + mode: suite + }) + } else { + throw new TypeError('invalid suite type') + } +} +function createDecipheriv (suite, key, iv) { + suite = suite.toLowerCase() + if (aesModes[suite]) { + return aes.createDecipheriv(suite, key, iv) + } else if (desModes[suite]) { + return new DES({ + key: key, + iv: iv, + mode: suite, + decrypt: true + }) + } else { + throw new TypeError('invalid suite type') + } +} +exports.createCipher = exports.Cipher = createCipher +exports.createCipheriv = exports.Cipheriv = createCipheriv +exports.createDecipher = exports.Decipher = createDecipher +exports.createDecipheriv = exports.Decipheriv = createDecipheriv +function getCiphers () { + return Object.keys(desModes).concat(aes.getCiphers()) +} +exports.listCiphers = exports.getCiphers = getCiphers - function BufferPool(initialSize, growStrategy, shrinkStrategy) { - if (this instanceof BufferPool === false) { - throw new TypeError("Classes can't be function-called"); - } - - if (typeof initialSize === 'function') { - shrinkStrategy = growStrategy; - growStrategy = initialSize; - initialSize = 0; - } - else if (typeof initialSize === 'undefined') { - initialSize = 0; - } - this._growStrategy = (growStrategy || function(db, size) { - return db.used + size; - }).bind(null, this); - this._shrinkStrategy = (shrinkStrategy || function(db) { - return initialSize; - }).bind(null, this); - this._buffer = initialSize ? new Buffer(initialSize) : null; - this._offset = 0; - this._used = 0; - this._changeFactor = 0; - this.__defineGetter__('size', function(){ - return this._buffer == null ? 0 : this._buffer.length; - }); - this.__defineGetter__('used', function(){ - return this._used; - }); - } - - BufferPool.prototype.get = function(length) { - if (this._buffer == null || this._offset + length > this._buffer.length) { - var newBuf = new Buffer(this._growStrategy(length)); - this._buffer = newBuf; - this._offset = 0; - } - this._used += length; - var buf = this._buffer.slice(this._offset, this._offset + length); - this._offset += length; - return buf; - } - - BufferPool.prototype.reset = function(forceNewBuffer) { - var len = this._shrinkStrategy(); - if (len < this.size) this._changeFactor -= 1; - if (forceNewBuffer || this._changeFactor < -2) { - this._changeFactor = 0; - this._buffer = len ? new Buffer(len) : null; - } - this._offset = 0; - this._used = 0; - } - - module.exports = BufferPool; - - /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(58).Buffer)) /***/ }, /* 153 */ /***/ function(module, exports, __webpack_require__) { - /* WEBPACK VAR INJECTION */(function(Buffer) {/*! - * ws: a node.js websocket client - * Copyright(c) 2011 Einar Otto Stangvik - * MIT Licensed - */ +/* WEBPACK VAR INJECTION */(function(Buffer) {var CipherBase = __webpack_require__(17) +var des = __webpack_require__(51) +var inherits = __webpack_require__(1) - var events = __webpack_require__(3) - , util = __webpack_require__(75) - , EventEmitter = events.EventEmitter; +var modes = { + 'des-ede3-cbc': des.CBC.instantiate(des.EDE), + 'des-ede3': des.EDE, + 'des-ede-cbc': des.CBC.instantiate(des.EDE), + 'des-ede': des.EDE, + 'des-cbc': des.CBC.instantiate(des.DES), + 'des-ecb': des.DES +} +modes.des = modes['des-cbc'] +modes.des3 = modes['des-ede3-cbc'] +module.exports = DES +inherits(DES, CipherBase) +function DES (opts) { + CipherBase.call(this) + var modeName = opts.mode.toLowerCase() + var mode = modes[modeName] + var type + if (opts.decrypt) { + type = 'decrypt' + } else { + type = 'encrypt' + } + var key = opts.key + if (modeName === 'des-ede' || modeName === 'des-ede-cbc') { + key = Buffer.concat([key, key.slice(0, 8)]) + } + var iv = opts.iv + this._des = mode.create({ + key: key, + iv: iv, + type: type + }) +} +DES.prototype._update = function (data) { + return new Buffer(this._des.update(data)) +} +DES.prototype._final = function () { + return new Buffer(this._des.final()) +} - /** - * Hixie Sender implementation - */ - - function Sender(socket) { - if (this instanceof Sender === false) { - throw new TypeError("Classes can't be function-called"); - } - - events.EventEmitter.call(this); - - this.socket = socket; - this.continuationFrame = false; - this.isClosed = false; - } - - module.exports = Sender; - - /** - * Inherits from EventEmitter. - */ - - util.inherits(Sender, events.EventEmitter); - - /** - * Frames and writes data. - * - * @api public - */ - - Sender.prototype.send = function(data, options, cb) { - if (this.isClosed) return; - - var isString = typeof data == 'string' - , length = isString ? Buffer.byteLength(data) : data.length - , lengthbytes = (length > 127) ? 2 : 1 // assume less than 2**14 bytes - , writeStartMarker = this.continuationFrame == false - , writeEndMarker = !options || !(typeof options.fin != 'undefined' && !options.fin) - , buffer = new Buffer((writeStartMarker ? ((options && options.binary) ? (1 + lengthbytes) : 1) : 0) + length + ((writeEndMarker && !(options && options.binary)) ? 1 : 0)) - , offset = writeStartMarker ? 1 : 0; - - if (writeStartMarker) { - if (options && options.binary) { - buffer.write('\x80', 'binary'); - // assume length less than 2**14 bytes - if (lengthbytes > 1) - buffer.write(String.fromCharCode(128+length/128), offset++, 'binary'); - buffer.write(String.fromCharCode(length&0x7f), offset++, 'binary'); - } else - buffer.write('\x00', 'binary'); - } - - if (isString) buffer.write(data, offset, 'utf8'); - else data.copy(buffer, offset, 0); - - if (writeEndMarker) { - if (options && options.binary) { - // sending binary, not writing end marker - } else - buffer.write('\xff', offset + length, 'binary'); - this.continuationFrame = false; - } - else this.continuationFrame = true; - - try { - this.socket.write(buffer, 'binary', cb); - } catch (e) { - this.error(e.toString()); - } - }; - - /** - * Sends a close instruction to the remote party. - * - * @api public - */ - - Sender.prototype.close = function(code, data, mask, cb) { - if (this.isClosed) return; - this.isClosed = true; - try { - if (this.continuationFrame) this.socket.write(new Buffer([0xff], 'binary')); - this.socket.write(new Buffer([0xff, 0x00]), 'binary', cb); - } catch (e) { - this.error(e.toString()); - } - }; - - /** - * Sends a ping message to the remote party. Not available for hixie. - * - * @api public - */ - - Sender.prototype.ping = function(data, options) {}; - - /** - * Sends a pong message to the remote party. Not available for hixie. - * - * @api public - */ - - Sender.prototype.pong = function(data, options) {}; - - /** - * Handles an error - * - * @api private - */ - - Sender.prototype.error = function (reason) { - this.emit('error', reason); - return this; - }; - - /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(58).Buffer)) +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer)) /***/ }, /* 154 */ -/***/ function(module, exports, __webpack_require__) { +/***/ function(module, exports) { - /* WEBPACK VAR INJECTION */(function(Buffer) {/*! - * ws: a node.js websocket client - * Copyright(c) 2011 Einar Otto Stangvik - * MIT Licensed - */ +exports['des-ecb'] = { + key: 8, + iv: 0 +} +exports['des-cbc'] = exports.des = { + key: 8, + iv: 8 +} +exports['des-ede3-cbc'] = exports.des3 = { + key: 24, + iv: 8 +} +exports['des-ede3'] = { + key: 24, + iv: 0 +} +exports['des-ede-cbc'] = { + key: 16, + iv: 8 +} +exports['des-ede'] = { + key: 16, + iv: 0 +} - var util = __webpack_require__(75); - - /** - * State constants - */ - - var EMPTY = 0 - , BODY = 1; - var BINARYLENGTH = 2 - , BINARYBODY = 3; - - /** - * Hixie Receiver implementation - */ - - function Receiver () { - if (this instanceof Receiver === false) { - throw new TypeError("Classes can't be function-called"); - } - - this.state = EMPTY; - this.buffers = []; - this.messageEnd = -1; - this.spanLength = 0; - this.dead = false; - - this.onerror = function() {}; - this.ontext = function() {}; - this.onbinary = function() {}; - this.onclose = function() {}; - this.onping = function() {}; - this.onpong = function() {}; - } - - module.exports = Receiver; - - /** - * Add new data to the parser. - * - * @api public - */ - - Receiver.prototype.add = function(data) { - if (this.dead) return; - var self = this; - function doAdd() { - if (self.state === EMPTY) { - if (data.length == 2 && data[0] == 0xFF && data[1] == 0x00) { - self.reset(); - self.onclose(); - return; - } - if (data[0] === 0x80) { - self.messageEnd = 0; - self.state = BINARYLENGTH; - data = data.slice(1); - } else { - - if (data[0] !== 0x00) { - self.error('payload must start with 0x00 byte', true); - return; - } - data = data.slice(1); - self.state = BODY; - - } - } - if (self.state === BINARYLENGTH) { - var i = 0; - while ((i < data.length) && (data[i] & 0x80)) { - self.messageEnd = 128 * self.messageEnd + (data[i] & 0x7f); - ++i; - } - if (i < data.length) { - self.messageEnd = 128 * self.messageEnd + (data[i] & 0x7f); - self.state = BINARYBODY; - ++i; - } - if (i > 0) - data = data.slice(i); - } - if (self.state === BINARYBODY) { - var dataleft = self.messageEnd - self.spanLength; - if (data.length >= dataleft) { - // consume the whole buffer to finish the frame - self.buffers.push(data); - self.spanLength += dataleft; - self.messageEnd = dataleft; - return self.parse(); - } - // frame's not done even if we consume it all - self.buffers.push(data); - self.spanLength += data.length; - return; - } - self.buffers.push(data); - if ((self.messageEnd = bufferIndex(data, 0xFF)) != -1) { - self.spanLength += self.messageEnd; - return self.parse(); - } - else self.spanLength += data.length; - } - while(data) data = doAdd(); - }; - - /** - * Releases all resources used by the receiver. - * - * @api public - */ - - Receiver.prototype.cleanup = function() { - this.dead = true; - this.state = EMPTY; - this.buffers = []; - }; - - /** - * Process buffered data. - * - * @api public - */ - - Receiver.prototype.parse = function() { - var output = new Buffer(this.spanLength); - var outputIndex = 0; - for (var bi = 0, bl = this.buffers.length; bi < bl - 1; ++bi) { - var buffer = this.buffers[bi]; - buffer.copy(output, outputIndex); - outputIndex += buffer.length; - } - var lastBuffer = this.buffers[this.buffers.length - 1]; - if (this.messageEnd > 0) lastBuffer.copy(output, outputIndex, 0, this.messageEnd); - if (this.state !== BODY) --this.messageEnd; - var tail = null; - if (this.messageEnd < lastBuffer.length - 1) { - tail = lastBuffer.slice(this.messageEnd + 1); - } - this.reset(); - this.ontext(output.toString('utf8')); - return tail; - }; - - /** - * Handles an error - * - * @api private - */ - - Receiver.prototype.error = function (reason, terminate) { - if (this.dead) return; - this.reset(); - if(typeof reason == 'string'){ - this.onerror(new Error(reason), terminate); - } - else if(reason.constructor == Error){ - this.onerror(reason, terminate); - } - else{ - this.onerror(new Error("An error occured"),terminate); - } - return this; - }; - - /** - * Reset parser state - * - * @api private - */ - - Receiver.prototype.reset = function (reason) { - if (this.dead) return; - this.state = EMPTY; - this.buffers = []; - this.messageEnd = -1; - this.spanLength = 0; - }; - - /** - * Internal api - */ - - function bufferIndex(buffer, byte) { - for (var i = 0, l = buffer.length; i < l; ++i) { - if (buffer[i] === byte) return i; - } - return -1; - } - - /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(58).Buffer)) /***/ }, /* 155 */ /***/ function(module, exports, __webpack_require__) { - - var util = __webpack_require__(75); +/* WEBPACK VAR INJECTION */(function(Buffer) {var _algos = __webpack_require__(95) +var createHash = __webpack_require__(18) +var inherits = __webpack_require__(1) +var sign = __webpack_require__(156) +var stream = __webpack_require__(9) +var verify = __webpack_require__(157) - /** - * Module exports. - */ +var algos = {} +Object.keys(_algos).forEach(function (key) { + algos[key] = algos[key.toLowerCase()] = _algos[key] +}) - exports.parse = parse; - exports.format = format; +function Sign (algorithm) { + stream.Writable.call(this) - /** - * Parse extensions header value - */ + var data = algos[algorithm] + if (!data) { + throw new Error('Unknown message digest') + } - function parse(value) { - value = value || ''; + this._hashType = data.hash + this._hash = createHash(data.hash) + this._tag = data.id + this._signType = data.sign +} +inherits(Sign, stream.Writable) - var extensions = {}; +Sign.prototype._write = function _write (data, _, done) { + this._hash.update(data) + done() +} - value.split(',').forEach(function(v) { - var params = v.split(';'); - var token = params.shift().trim(); - var paramsList = extensions[token] = extensions[token] || []; - var parsedParams = {}; +Sign.prototype.update = function update (data, enc) { + if (typeof data === 'string') { + data = new Buffer(data, enc) + } - params.forEach(function(param) { - var parts = param.trim().split('='); - var key = parts[0]; - var value = parts[1]; - if (typeof value === 'undefined') { - value = true; - } else { - // unquote value - if (value[0] === '"') { - value = value.slice(1); - } - if (value[value.length - 1] === '"') { - value = value.slice(0, value.length - 1); - } - } - (parsedParams[key] = parsedParams[key] || []).push(value); - }); + this._hash.update(data) + return this +} - paramsList.push(parsedParams); - }); +Sign.prototype.sign = function signMethod (key, enc) { + this.end() + var hash = this._hash.digest() + var sig = sign(Buffer.concat([this._tag, hash]), key, this._hashType, this._signType) - return extensions; - } + return enc ? sig.toString(enc) : sig +} - /** - * Format extensions header value - */ +function Verify (algorithm) { + stream.Writable.call(this) - function format(value) { - return Object.keys(value).map(function(token) { - var paramsList = value[token]; - if (!util.isArray(paramsList)) { - paramsList = [paramsList]; - } - return paramsList.map(function(params) { - return [token].concat(Object.keys(params).map(function(k) { - var p = params[k]; - if (!util.isArray(p)) p = [p]; - return p.map(function(v) { - return v === true ? k : k + '=' + v; - }).join('; '); - })).join('; '); - }).join(', '); - }).join(', '); - } + var data = algos[algorithm] + if (!data) { + throw new Error('Unknown message digest') + } + this._hash = createHash(data.hash) + this._tag = data.id + this._signType = data.sign +} +inherits(Verify, stream.Writable) + +Verify.prototype._write = function _write (data, _, done) { + this._hash.update(data) + + done() +} + +Verify.prototype.update = function update (data, enc) { + if (typeof data === 'string') { + data = new Buffer(data, enc) + } + + this._hash.update(data) + return this +} + +Verify.prototype.verify = function verifyMethod (key, sig, enc) { + if (typeof sig === 'string') { + sig = new Buffer(sig, enc) + } + + this.end() + var hash = this._hash.digest() + + return verify(sig, Buffer.concat([this._tag, hash]), key, this._signType) +} + +function createSign (algorithm) { + return new Sign(algorithm) +} + +function createVerify (algorithm) { + return new Verify(algorithm) +} + +module.exports = { + Sign: createSign, + Verify: createVerify, + createSign: createSign, + createVerify: createVerify +} + +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer)) /***/ }, /* 156 */ /***/ function(module, exports, __webpack_require__) { - /* WEBPACK VAR INJECTION */(function(Buffer) {/*! - * ws: a node.js websocket client - * Copyright(c) 2011 Einar Otto Stangvik - * MIT Licensed - */ - - var util = __webpack_require__(75) - , events = __webpack_require__(3) - , http = __webpack_require__(78) - , crypto = __webpack_require__(99) - , Options = __webpack_require__(115) - , WebSocket = __webpack_require__(68) - , Extensions = __webpack_require__(155) - , PerMessageDeflate = __webpack_require__(125) - , tls = __webpack_require__(157) - , url = __webpack_require__(69); - - /** - * WebSocket Server implementation - */ - - function WebSocketServer(options, callback) { - if (this instanceof WebSocketServer === false) { - return new WebSocketServer(options, callback); - } - - events.EventEmitter.call(this); - - options = new Options({ - host: '0.0.0.0', - port: null, - server: null, - verifyClient: null, - handleProtocols: null, - path: null, - noServer: false, - disableHixie: false, - clientTracking: true, - perMessageDeflate: true, - maxPayload: 100 * 1024 * 1024 - }).merge(options); - - if (!options.isDefinedAndNonNull('port') && !options.isDefinedAndNonNull('server') && !options.value.noServer) { - throw new TypeError('`port` or a `server` must be provided'); - } - - var self = this; - - if (options.isDefinedAndNonNull('port')) { - this._server = http.createServer(function (req, res) { - var body = http.STATUS_CODES[426]; - res.writeHead(426, { - 'Content-Length': body.length, - 'Content-Type': 'text/plain' - }); - res.end(body); - }); - this._server.allowHalfOpen = false; - this._server.listen(options.value.port, options.value.host, callback); - this._closeServer = function() { if (self._server) self._server.close(); }; - } - else if (options.value.server) { - this._server = options.value.server; - if (options.value.path) { - // take note of the path, to avoid collisions when multiple websocket servers are - // listening on the same http server - if (this._server._webSocketPaths && options.value.server._webSocketPaths[options.value.path]) { - throw new Error('two instances of WebSocketServer cannot listen on the same http server path'); - } - if (typeof this._server._webSocketPaths !== 'object') { - this._server._webSocketPaths = {}; - } - this._server._webSocketPaths[options.value.path] = 1; - } - } - if (this._server) { - this._onceServerListening = function() { self.emit('listening'); }; - this._server.once('listening', this._onceServerListening); - } - - if (typeof this._server != 'undefined') { - this._onServerError = function(error) { self.emit('error', error) }; - this._server.on('error', this._onServerError); - this._onServerUpgrade = function(req, socket, upgradeHead) { - //copy upgradeHead to avoid retention of large slab buffers used in node core - var head = new Buffer(upgradeHead.length); - upgradeHead.copy(head); - - self.handleUpgrade(req, socket, head, function(client) { - self.emit('connection'+req.url, client); - self.emit('connection', client); - }); - }; - this._server.on('upgrade', this._onServerUpgrade); - } - - this.options = options.value; - this.path = options.value.path; - this.clients = []; - } - - /** - * Inherits from EventEmitter. - */ - - util.inherits(WebSocketServer, events.EventEmitter); - - /** - * Immediately shuts down the connection. - * - * @api public - */ - - WebSocketServer.prototype.close = function(callback) { - // terminate all associated clients - var error = null; - try { - for (var i = 0, l = this.clients.length; i < l; ++i) { - this.clients[i].terminate(); - } - } - catch (e) { - error = e; - } - - // remove path descriptor, if any - if (this.path && this._server._webSocketPaths) { - delete this._server._webSocketPaths[this.path]; - if (Object.keys(this._server._webSocketPaths).length == 0) { - delete this._server._webSocketPaths; - } - } - - // close the http server if it was internally created - try { - if (typeof this._closeServer !== 'undefined') { - this._closeServer(); - } - } - finally { - if (this._server) { - this._server.removeListener('listening', this._onceServerListening); - this._server.removeListener('error', this._onServerError); - this._server.removeListener('upgrade', this._onServerUpgrade); - } - delete this._server; - } - if(callback) - callback(error); - else if(error) - throw error; - } - - /** - * Handle a HTTP Upgrade request. - * - * @api public - */ - - WebSocketServer.prototype.handleUpgrade = function(req, socket, upgradeHead, cb) { - // check for wrong path - if (this.options.path) { - var u = url.parse(req.url); - if (u && u.pathname !== this.options.path) return; - } - - if (typeof req.headers.upgrade === 'undefined' || req.headers.upgrade.toLowerCase() !== 'websocket') { - abortConnection(socket, 400, 'Bad Request'); - return; - } - - if (req.headers['sec-websocket-key1']) handleHixieUpgrade.apply(this, arguments); - else handleHybiUpgrade.apply(this, arguments); - } - - module.exports = WebSocketServer; - - /** - * Entirely private apis, - * which may or may not be bound to a sepcific WebSocket instance. - */ - - function handleHybiUpgrade(req, socket, upgradeHead, cb) { - // handle premature socket errors - var errorHandler = function() { - try { socket.destroy(); } catch (e) {} - } - socket.on('error', errorHandler); - - // verify key presence - if (!req.headers['sec-websocket-key']) { - abortConnection(socket, 400, 'Bad Request'); - return; - } - - // verify version - var version = parseInt(req.headers['sec-websocket-version']); - if ([8, 13].indexOf(version) === -1) { - abortConnection(socket, 400, 'Bad Request'); - return; - } - - // verify protocol - var protocols = req.headers['sec-websocket-protocol']; - - // verify client - var origin = version < 13 ? - req.headers['sec-websocket-origin'] : - req.headers['origin']; - - // handle extensions offer - var extensionsOffer = Extensions.parse(req.headers['sec-websocket-extensions']); - - // handler to call when the connection sequence completes - var self = this; - var completeHybiUpgrade2 = function(protocol) { - - // calc key - var key = req.headers['sec-websocket-key']; - var shasum = crypto.createHash('sha1'); - shasum.update(key + "258EAFA5-E914-47DA-95CA-C5AB0DC85B11"); - key = shasum.digest('base64'); - - var headers = [ - 'HTTP/1.1 101 Switching Protocols' - , 'Upgrade: websocket' - , 'Connection: Upgrade' - , 'Sec-WebSocket-Accept: ' + key - ]; - - if (typeof protocol != 'undefined') { - headers.push('Sec-WebSocket-Protocol: ' + protocol); - } - - var extensions = {}; - try { - extensions = acceptExtensions.call(self, extensionsOffer); - } catch (err) { - abortConnection(socket, 400, 'Bad Request'); - return; - } - - if (Object.keys(extensions).length) { - var serverExtensions = {}; - Object.keys(extensions).forEach(function(token) { - serverExtensions[token] = [extensions[token].params] - }); - headers.push('Sec-WebSocket-Extensions: ' + Extensions.format(serverExtensions)); - } - - // allows external modification/inspection of handshake headers - self.emit('headers', headers); - - socket.setTimeout(0); - socket.setNoDelay(true); - try { - socket.write(headers.concat('', '').join('\r\n')); - } - catch (e) { - // if the upgrade write fails, shut the connection down hard - try { socket.destroy(); } catch (e) {} - return; - } - - var client = new WebSocket([req, socket, upgradeHead], { - protocolVersion: version, - protocol: protocol, - extensions: extensions, - maxPayload: self.options.maxPayload - }); - - if (self.options.clientTracking) { - self.clients.push(client); - client.on('close', function() { - var index = self.clients.indexOf(client); - if (index != -1) { - self.clients.splice(index, 1); - } - }); - } - - // signal upgrade complete - socket.removeListener('error', errorHandler); - cb(client); - } - - // optionally call external protocol selection handler before - // calling completeHybiUpgrade2 - var completeHybiUpgrade1 = function() { - // choose from the sub-protocols - if (typeof self.options.handleProtocols == 'function') { - var protList = (protocols || "").split(/, */); - var callbackCalled = false; - var res = self.options.handleProtocols(protList, function(result, protocol) { - callbackCalled = true; - if (!result) abortConnection(socket, 401, 'Unauthorized'); - else completeHybiUpgrade2(protocol); - }); - if (!callbackCalled) { - // the handleProtocols handler never called our callback - abortConnection(socket, 501, 'Could not process protocols'); - } - return; - } else { - if (typeof protocols !== 'undefined') { - completeHybiUpgrade2(protocols.split(/, */)[0]); - } - else { - completeHybiUpgrade2(); - } - } - } - - // optionally call external client verification handler - if (typeof this.options.verifyClient == 'function') { - var info = { - origin: origin, - secure: typeof req.connection.authorized !== 'undefined' || typeof req.connection.encrypted !== 'undefined', - req: req - }; - if (this.options.verifyClient.length == 2) { - this.options.verifyClient(info, function(result, code, name) { - if (typeof code === 'undefined') code = 401; - if (typeof name === 'undefined') name = http.STATUS_CODES[code]; - - if (!result) abortConnection(socket, code, name); - else completeHybiUpgrade1(); - }); - return; - } - else if (!this.options.verifyClient(info)) { - abortConnection(socket, 401, 'Unauthorized'); - return; - } - } - - completeHybiUpgrade1(); - } - - function handleHixieUpgrade(req, socket, upgradeHead, cb) { - // handle premature socket errors - var errorHandler = function() { - try { socket.destroy(); } catch (e) {} - } - socket.on('error', errorHandler); - - // bail if options prevent hixie - if (this.options.disableHixie) { - abortConnection(socket, 401, 'Hixie support disabled'); - return; - } - - // verify key presence - if (!req.headers['sec-websocket-key2']) { - abortConnection(socket, 400, 'Bad Request'); - return; - } - - var origin = req.headers['origin'] - , self = this; - - // setup handshake completion to run after client has been verified - var onClientVerified = function() { - var wshost; - if (!req.headers['x-forwarded-host']) - wshost = req.headers.host; - else - wshost = req.headers['x-forwarded-host']; - var location = ((req.headers['x-forwarded-proto'] === 'https' || socket.encrypted) ? 'wss' : 'ws') + '://' + wshost + req.url - , protocol = req.headers['sec-websocket-protocol']; - - // build the response header and return a Buffer - var buildResponseHeader = function() { - var headers = [ - 'HTTP/1.1 101 Switching Protocols' - , 'Upgrade: WebSocket' - , 'Connection: Upgrade' - , 'Sec-WebSocket-Location: ' + location - ]; - if (typeof protocol != 'undefined') headers.push('Sec-WebSocket-Protocol: ' + protocol); - if (typeof origin != 'undefined') headers.push('Sec-WebSocket-Origin: ' + origin); - - return new Buffer(headers.concat('', '').join('\r\n')); - }; - - // send handshake response before receiving the nonce - var handshakeResponse = function() { - - socket.setTimeout(0); - socket.setNoDelay(true); - - var headerBuffer = buildResponseHeader(); - - try { - socket.write(headerBuffer, 'binary', function(err) { - // remove listener if there was an error - if (err) socket.removeListener('data', handler); - return; - }); - } catch (e) { - try { socket.destroy(); } catch (e) {} - return; - }; - }; - - // handshake completion code to run once nonce has been successfully retrieved - var completeHandshake = function(nonce, rest, headerBuffer) { - // calculate key - var k1 = req.headers['sec-websocket-key1'] - , k2 = req.headers['sec-websocket-key2'] - , md5 = crypto.createHash('md5'); - - [k1, k2].forEach(function (k) { - var n = parseInt(k.replace(/[^\d]/g, '')) - , spaces = k.replace(/[^ ]/g, '').length; - if (spaces === 0 || n % spaces !== 0){ - abortConnection(socket, 400, 'Bad Request'); - return; - } - n /= spaces; - md5.update(String.fromCharCode( - n >> 24 & 0xFF, - n >> 16 & 0xFF, - n >> 8 & 0xFF, - n & 0xFF)); - }); - md5.update(nonce.toString('binary')); - - socket.setTimeout(0); - socket.setNoDelay(true); - - try { - var hashBuffer = new Buffer(md5.digest('binary'), 'binary'); - var handshakeBuffer = new Buffer(headerBuffer.length + hashBuffer.length); - headerBuffer.copy(handshakeBuffer, 0); - hashBuffer.copy(handshakeBuffer, headerBuffer.length); - - // do a single write, which - upon success - causes a new client websocket to be setup - socket.write(handshakeBuffer, 'binary', function(err) { - if (err) return; // do not create client if an error happens - var client = new WebSocket([req, socket, rest], { - protocolVersion: 'hixie-76', - protocol: protocol - }); - if (self.options.clientTracking) { - self.clients.push(client); - client.on('close', function() { - var index = self.clients.indexOf(client); - if (index != -1) { - self.clients.splice(index, 1); - } - }); - } - - // signal upgrade complete - socket.removeListener('error', errorHandler); - cb(client); - }); - } - catch (e) { - try { socket.destroy(); } catch (e) {} - return; - } - } - - // retrieve nonce - var nonceLength = 8; - if (upgradeHead && upgradeHead.length >= nonceLength) { - var nonce = upgradeHead.slice(0, nonceLength); - var rest = upgradeHead.length > nonceLength ? upgradeHead.slice(nonceLength) : null; - completeHandshake.call(self, nonce, rest, buildResponseHeader()); - } - else { - // nonce not present in upgradeHead - var nonce = new Buffer(nonceLength); - upgradeHead.copy(nonce, 0); - var received = upgradeHead.length; - var rest = null; - var handler = function (data) { - var toRead = Math.min(data.length, nonceLength - received); - if (toRead === 0) return; - data.copy(nonce, received, 0, toRead); - received += toRead; - if (received == nonceLength) { - socket.removeListener('data', handler); - if (toRead < data.length) rest = data.slice(toRead); - - // complete the handshake but send empty buffer for headers since they have already been sent - completeHandshake.call(self, nonce, rest, new Buffer(0)); - } - } - - // handle additional data as we receive it - socket.on('data', handler); - - // send header response before we have the nonce to fix haproxy buffering - handshakeResponse(); - } - } - - // verify client - if (typeof this.options.verifyClient == 'function') { - var info = { - origin: origin, - secure: typeof req.connection.authorized !== 'undefined' || typeof req.connection.encrypted !== 'undefined', - req: req - }; - if (this.options.verifyClient.length == 2) { - var self = this; - this.options.verifyClient(info, function(result, code, name) { - if (typeof code === 'undefined') code = 401; - if (typeof name === 'undefined') name = http.STATUS_CODES[code]; - - if (!result) abortConnection(socket, code, name); - else onClientVerified.apply(self); - }); - return; - } - else if (!this.options.verifyClient(info)) { - abortConnection(socket, 401, 'Unauthorized'); - return; - } - } - - // no client verification required - onClientVerified(); - } - - function acceptExtensions(offer) { - var extensions = {}; - var options = this.options.perMessageDeflate; - var maxPayload = this.options.maxPayload; - if (options && offer[PerMessageDeflate.extensionName]) { - var perMessageDeflate = new PerMessageDeflate(options !== true ? options : {}, true, maxPayload); - perMessageDeflate.accept(offer[PerMessageDeflate.extensionName]); - extensions[PerMessageDeflate.extensionName] = perMessageDeflate; - } - return extensions; - } - - function abortConnection(socket, code, name) { - try { - var response = [ - 'HTTP/1.1 ' + code + ' ' + name, - 'Content-type: text/html' - ]; - socket.write(response.concat('', '').join('\r\n')); - } - catch (e) { /* ignore errors - we've aborted this connection */ } - finally { - // ensure that an early aborted connection is shut down completely - try { socket.destroy(); } catch (e) {} - } - } - - /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(58).Buffer)) +/* WEBPACK VAR INJECTION */(function(Buffer) {// much of this based on https://github.com/indutny/self-signed/blob/gh-pages/lib/rsa.js +var createHmac = __webpack_require__(50) +var crt = __webpack_require__(48) +var curves = __webpack_require__(96) +var elliptic = __webpack_require__(7) +var parseKeys = __webpack_require__(39) + +var BN = __webpack_require__(4) +var EC = elliptic.ec + +function sign (hash, key, hashType, signType) { + var priv = parseKeys(key) + if (priv.curve) { + if (signType !== 'ecdsa') throw new Error('wrong private key type') + + return ecSign(hash, priv) + } else if (priv.type === 'dsa') { + if (signType !== 'dsa') { + throw new Error('wrong private key type') + } + return dsaSign(hash, priv, hashType) + } else { + if (signType !== 'rsa') throw new Error('wrong private key type') + } + + var len = priv.modulus.byteLength() + var pad = [ 0, 1 ] + while (hash.length + pad.length + 1 < len) { + pad.push(0xff) + } + pad.push(0x00) + var i = -1 + while (++i < hash.length) { + pad.push(hash[i]) + } + + var out = crt(pad, priv) + return out +} + +function ecSign (hash, priv) { + var curveId = curves[priv.curve.join('.')] + if (!curveId) throw new Error('unknown curve ' + priv.curve.join('.')) + + var curve = new EC(curveId) + var key = curve.genKeyPair() + + key._importPrivate(priv.privateKey) + var out = key.sign(hash) + + return new Buffer(out.toDER()) +} + +function dsaSign (hash, priv, algo) { + var x = priv.params.priv_key + var p = priv.params.p + var q = priv.params.q + var g = priv.params.g + var r = new BN(0) + var k + var H = bits2int(hash, q).mod(q) + var s = false + var kv = getKey(x, q, hash, algo) + while (s === false) { + k = makeKey(q, kv, algo) + r = makeR(g, k, p, q) + s = k.invm(q).imul(H.add(x.mul(r))).mod(q) + if (!s.cmpn(0)) { + s = false + r = new BN(0) + } + } + return toDER(r, s) +} + +function toDER (r, s) { + r = r.toArray() + s = s.toArray() + + // Pad values + if (r[0] & 0x80) { + r = [ 0 ].concat(r) + } + // Pad values + if (s[0] & 0x80) { + s = [0].concat(s) + } + + var total = r.length + s.length + 4 + var res = [ 0x30, total, 0x02, r.length ] + res = res.concat(r, [ 0x02, s.length ], s) + return new Buffer(res) +} + +function getKey (x, q, hash, algo) { + x = new Buffer(x.toArray()) + if (x.length < q.byteLength()) { + var zeros = new Buffer(q.byteLength() - x.length) + zeros.fill(0) + x = Buffer.concat([zeros, x]) + } + var hlen = hash.length + var hbits = bits2octets(hash, q) + var v = new Buffer(hlen) + v.fill(1) + var k = new Buffer(hlen) + k.fill(0) + k = createHmac(algo, k) + .update(v) + .update(new Buffer([0])) + .update(x) + .update(hbits) + .digest() + v = createHmac(algo, k) + .update(v) + .digest() + k = createHmac(algo, k) + .update(v) + .update(new Buffer([1])) + .update(x) + .update(hbits) + .digest() + v = createHmac(algo, k) + .update(v) + .digest() + return { + k: k, + v: v + } +} + +function bits2int (obits, q) { + var bits = new BN(obits) + var shift = (obits.length << 3) - q.bitLength() + if (shift > 0) { + bits.ishrn(shift) + } + return bits +} + +function bits2octets (bits, q) { + bits = bits2int(bits, q) + bits = bits.mod(q) + var out = new Buffer(bits.toArray()) + if (out.length < q.byteLength()) { + var zeros = new Buffer(q.byteLength() - out.length) + zeros.fill(0) + out = Buffer.concat([zeros, out]) + } + return out +} + +function makeKey (q, kv, algo) { + var t, k + + do { + t = new Buffer('') + + while (t.length * 8 < q.bitLength()) { + kv.v = createHmac(algo, kv.k) + .update(kv.v) + .digest() + t = Buffer.concat([t, kv.v]) + } + + k = bits2int(t, q) + kv.k = createHmac(algo, kv.k) + .update(kv.v) + .update(new Buffer([0])) + .digest() + kv.v = createHmac(algo, kv.k) + .update(kv.v) + .digest() + } while (k.cmp(q) !== -1) + + return k +} + +function makeR (g, k, p, q) { + return g.toRed(BN.mont(p)).redPow(k).fromRed().mod(q) +} + +module.exports = sign +module.exports.getKey = getKey +module.exports.makeKey = makeKey + +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer)) /***/ }, /* 157 */ -/***/ function(module, exports) { +/***/ function(module, exports, __webpack_require__) { - // todo +/* WEBPACK VAR INJECTION */(function(Buffer) {// much of this based on https://github.com/indutny/self-signed/blob/gh-pages/lib/rsa.js +var curves = __webpack_require__(96) +var elliptic = __webpack_require__(7) +var parseKeys = __webpack_require__(39) +var BN = __webpack_require__(4) +var EC = elliptic.ec + +function verify (sig, hash, key, signType) { + var pub = parseKeys(key) + if (pub.type === 'ec') { + if (signType !== 'ecdsa') { + throw new Error('wrong public key type') + } + return ecVerify(sig, hash, pub) + } else if (pub.type === 'dsa') { + if (signType !== 'dsa') { + throw new Error('wrong public key type') + } + return dsaVerify(sig, hash, pub) + } else { + if (signType !== 'rsa') { + throw new Error('wrong public key type') + } + } + var len = pub.modulus.byteLength() + var pad = [ 1 ] + var padNum = 0 + while (hash.length + pad.length + 2 < len) { + pad.push(0xff) + padNum++ + } + pad.push(0x00) + var i = -1 + while (++i < hash.length) { + pad.push(hash[i]) + } + pad = new Buffer(pad) + var red = BN.mont(pub.modulus) + sig = new BN(sig).toRed(red) + + sig = sig.redPow(new BN(pub.publicExponent)) + + sig = new Buffer(sig.fromRed().toArray()) + var out = 0 + if (padNum < 8) { + out = 1 + } + len = Math.min(sig.length, pad.length) + if (sig.length !== pad.length) { + out = 1 + } + + i = -1 + while (++i < len) { + out |= (sig[i] ^ pad[i]) + } + return out === 0 +} + +function ecVerify (sig, hash, pub) { + var curveId = curves[pub.data.algorithm.curve.join('.')] + if (!curveId) throw new Error('unknown curve ' + pub.data.algorithm.curve.join('.')) + + var curve = new EC(curveId) + var pubkey = pub.data.subjectPrivateKey.data + + return curve.verify(hash, sig, pubkey) +} + +function dsaVerify (sig, hash, pub) { + var p = pub.data.p + var q = pub.data.q + var g = pub.data.g + var y = pub.data.pub_key + var unpacked = parseKeys.signature.decode(sig, 'der') + var s = unpacked.s + var r = unpacked.r + checkValue(s, q) + checkValue(r, q) + var montp = BN.mont(p) + var w = s.invm(q) + var v = g.toRed(montp) + .redPow(new BN(hash).mul(w).mod(q)) + .fromRed() + .mul( + y.toRed(montp) + .redPow(r.mul(w).mod(q)) + .fromRed() + ).mod(p).mod(q) + return !v.cmp(r) +} + +function checkValue (b, q) { + if (b.cmpn(0) <= 0) { + throw new Error('invalid sig') + } + if (b.cmp(q) >= q) { + throw new Error('invalid sig') + } +} + +module.exports = verify + +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer)) /***/ }, /* 158 */ -/***/ function(module, exports) { +/***/ function(module, exports, __webpack_require__) { - /** - * Represents a Secret Key used in encryption over voice - * @private - */ - class SecretKey { - constructor(key) { - /** - * The key used for encryption - * @type {Uint8Array} - */ - this.key = new Uint8Array(new ArrayBuffer(key.length)); - for (const index in key) this.key[index] = key[index]; - } - } +/* WEBPACK VAR INJECTION */(function(process, Buffer) {var msg = __webpack_require__(107); +var zstream = __webpack_require__(211); +var zlib_deflate = __webpack_require__(206); +var zlib_inflate = __webpack_require__(208); +var constants = __webpack_require__(205); - module.exports = SecretKey; +for (var key in constants) { + exports[key] = constants[key]; +} +// zlib modes +exports.NONE = 0; +exports.DEFLATE = 1; +exports.INFLATE = 2; +exports.GZIP = 3; +exports.GUNZIP = 4; +exports.DEFLATERAW = 5; +exports.INFLATERAW = 6; +exports.UNZIP = 7; + +/** + * Emulate Node's zlib C++ layer for use by the JS layer in index.js + */ +function Zlib(mode) { + if (mode < exports.DEFLATE || mode > exports.UNZIP) + throw new TypeError("Bad argument"); + + this.mode = mode; + this.init_done = false; + this.write_in_progress = false; + this.pending_close = false; + this.windowBits = 0; + this.level = 0; + this.memLevel = 0; + this.strategy = 0; + this.dictionary = null; +} + +Zlib.prototype.init = function(windowBits, level, memLevel, strategy, dictionary) { + this.windowBits = windowBits; + this.level = level; + this.memLevel = memLevel; + this.strategy = strategy; + // dictionary not supported. + + if (this.mode === exports.GZIP || this.mode === exports.GUNZIP) + this.windowBits += 16; + + if (this.mode === exports.UNZIP) + this.windowBits += 32; + + if (this.mode === exports.DEFLATERAW || this.mode === exports.INFLATERAW) + this.windowBits = -this.windowBits; + + this.strm = new zstream(); + + switch (this.mode) { + case exports.DEFLATE: + case exports.GZIP: + case exports.DEFLATERAW: + var status = zlib_deflate.deflateInit2( + this.strm, + this.level, + exports.Z_DEFLATED, + this.windowBits, + this.memLevel, + this.strategy + ); + break; + case exports.INFLATE: + case exports.GUNZIP: + case exports.INFLATERAW: + case exports.UNZIP: + var status = zlib_inflate.inflateInit2( + this.strm, + this.windowBits + ); + break; + default: + throw new Error("Unknown mode " + this.mode); + } + + if (status !== exports.Z_OK) { + this._error(status); + return; + } + + this.write_in_progress = false; + this.init_done = true; +}; + +Zlib.prototype.params = function() { + throw new Error("deflateParams Not supported"); +}; + +Zlib.prototype._writeCheck = function() { + if (!this.init_done) + throw new Error("write before init"); + + if (this.mode === exports.NONE) + throw new Error("already finalized"); + + if (this.write_in_progress) + throw new Error("write already in progress"); + + if (this.pending_close) + throw new Error("close is pending"); +}; + +Zlib.prototype.write = function(flush, input, in_off, in_len, out, out_off, out_len) { + this._writeCheck(); + this.write_in_progress = true; + + var self = this; + process.nextTick(function() { + self.write_in_progress = false; + var res = self._write(flush, input, in_off, in_len, out, out_off, out_len); + self.callback(res[0], res[1]); + + if (self.pending_close) + self.close(); + }); + + return this; +}; + +// set method for Node buffers, used by pako +function bufferSet(data, offset) { + for (var i = 0; i < data.length; i++) { + this[offset + i] = data[i]; + } +} + +Zlib.prototype.writeSync = function(flush, input, in_off, in_len, out, out_off, out_len) { + this._writeCheck(); + return this._write(flush, input, in_off, in_len, out, out_off, out_len); +}; + +Zlib.prototype._write = function(flush, input, in_off, in_len, out, out_off, out_len) { + this.write_in_progress = true; + + if (flush !== exports.Z_NO_FLUSH && + flush !== exports.Z_PARTIAL_FLUSH && + flush !== exports.Z_SYNC_FLUSH && + flush !== exports.Z_FULL_FLUSH && + flush !== exports.Z_FINISH && + flush !== exports.Z_BLOCK) { + throw new Error("Invalid flush value"); + } + + if (input == null) { + input = new Buffer(0); + in_len = 0; + in_off = 0; + } + + if (out._set) + out.set = out._set; + else + out.set = bufferSet; + + var strm = this.strm; + strm.avail_in = in_len; + strm.input = input; + strm.next_in = in_off; + strm.avail_out = out_len; + strm.output = out; + strm.next_out = out_off; + + switch (this.mode) { + case exports.DEFLATE: + case exports.GZIP: + case exports.DEFLATERAW: + var status = zlib_deflate.deflate(strm, flush); + break; + case exports.UNZIP: + case exports.INFLATE: + case exports.GUNZIP: + case exports.INFLATERAW: + var status = zlib_inflate.inflate(strm, flush); + break; + default: + throw new Error("Unknown mode " + this.mode); + } + + if (status !== exports.Z_STREAM_END && status !== exports.Z_OK) { + this._error(status); + } + + this.write_in_progress = false; + return [strm.avail_in, strm.avail_out]; +}; + +Zlib.prototype.close = function() { + if (this.write_in_progress) { + this.pending_close = true; + return; + } + + this.pending_close = false; + + if (this.mode === exports.DEFLATE || this.mode === exports.GZIP || this.mode === exports.DEFLATERAW) { + zlib_deflate.deflateEnd(this.strm); + } else { + zlib_inflate.inflateEnd(this.strm); + } + + this.mode = exports.NONE; +}; + +Zlib.prototype.reset = function() { + switch (this.mode) { + case exports.DEFLATE: + case exports.DEFLATERAW: + var status = zlib_deflate.deflateReset(this.strm); + break; + case exports.INFLATE: + case exports.INFLATERAW: + var status = zlib_inflate.inflateReset(this.strm); + break; + } + + if (status !== exports.Z_OK) { + this._error(status); + } +}; + +Zlib.prototype._error = function(status) { + this.onerror(msg[status] + ': ' + this.strm.msg, status); + + this.write_in_progress = false; + if (this.pending_close) + this.close(); +}; + +exports.Zlib = Zlib; + +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5), __webpack_require__(0).Buffer)) /***/ }, /* 159 */ -/***/ function(module, exports, __webpack_require__) { +/***/ function(module, exports) { - /* WEBPACK VAR INJECTION */(function(Buffer) {const udp = __webpack_require__(62); - const dns = __webpack_require__(160); - const Constants = __webpack_require__(5); - const EventEmitter = __webpack_require__(3).EventEmitter; +"use strict"; +'use strict'; - /** - * Represents a UDP Client for a Voice Connection - * @extends {EventEmitter} - * @private - */ - class VoiceConnectionUDPClient extends EventEmitter { - constructor(voiceConnection) { - super(); +/*! + * bufferutil: WebSocket buffer utils + * Copyright(c) 2015 Einar Otto Stangvik + * MIT Licensed + */ - /** - * The voice connection that this UDP client serves - * @type {VoiceConnection} - */ - this.voiceConnection = voiceConnection; +module.exports.BufferUtil = { + merge: function(mergedBuffer, buffers) { + for (var i = 0, offset = 0, l = buffers.length; i < l; ++i) { + var buf = buffers[i]; - /** - * The UDP socket - * @type {?Socket} - */ - this.socket = null; + buf.copy(mergedBuffer, offset); + offset += buf.length; + } + }, - /** - * The address of the discord voice server - * @type {?string} - */ - this.discordAddress = null; + mask: function(source, mask, output, offset, length) { + var maskNum = mask.readUInt32LE(0, true) + , i = 0 + , num; - /** - * The local IP address - * @type {?string} - */ - this.localAddress = null; + for (; i < length - 3; i += 4) { + num = maskNum ^ source.readUInt32LE(i, true); - /** - * The local port - * @type {?string} - */ - this.localPort = null; + if (num < 0) num = 4294967296 + num; + output.writeUInt32LE(num, offset + i, true); + } - this.voiceConnection.on('closing', this.shutdown.bind(this)); - } + switch (length % 4) { + case 3: output[offset + i + 2] = source[i + 2] ^ mask[2]; + case 2: output[offset + i + 1] = source[i + 1] ^ mask[1]; + case 1: output[offset + i] = source[i] ^ mask[0]; + } + }, - shutdown() { - if (this.socket) { - try { - this.socket.close(); - } catch (e) { - return; - } - this.socket = null; - } - } + unmask: function(data, mask) { + var maskNum = mask.readUInt32LE(0, true) + , length = data.length + , i = 0 + , num; - /** - * The port of the discord voice server - * @type {number} - * @readonly - */ - get discordPort() { - return this.voiceConnection.authentication.port; - } + for (; i < length - 3; i += 4) { + num = maskNum ^ data.readUInt32LE(i, true); - /** - * Tries to resolve the voice server endpoint to an address - * @returns {Promise} - */ - findEndpointAddress() { - return new Promise((resolve, reject) => { - dns.lookup(this.voiceConnection.authentication.endpoint, (error, address) => { - if (error) { - reject(error); - return; - } - this.discordAddress = address; - resolve(address); - }); - }); - } + if (num < 0) num = 4294967296 + num; + data.writeUInt32LE(num, i, true); + } - /** - * Send a packet to the UDP client - * @param {Object} packet the packet to send - * @returns {Promise} - */ - send(packet) { - return new Promise((resolve, reject) => { - if (!this.socket) throw new Error('Tried to send a UDP packet, but there is no socket available.'); - if (!this.discordAddress || !this.discordPort) throw new Error('Malformed UDP address or port.'); - this.socket.send(packet, 0, packet.length, this.discordPort, this.discordAddress, error => { - if (error) reject(error); else resolve(packet); - }); - }); - } + switch (length % 4) { + case 3: data[i + 2] = data[i + 2] ^ mask[2]; + case 2: data[i + 1] = data[i + 1] ^ mask[1]; + case 1: data[i] = data[i] ^ mask[0]; + } + } +}; - createUDPSocket(address) { - this.discordAddress = address; - const socket = this.socket = udp.createSocket('udp4'); - - socket.once('message', message => { - const packet = parseLocalPacket(message); - if (packet.error) { - this.emit('error', packet.error); - return; - } - - this.localAddress = packet.address; - this.localPort = packet.port; - - this.voiceConnection.sockets.ws.sendPacket({ - op: Constants.VoiceOPCodes.SELECT_PROTOCOL, - d: { - protocol: 'udp', - data: { - address: packet.address, - port: packet.port, - mode: 'xsalsa20_poly1305', - }, - }, - }); - }); - - const blankMessage = new Buffer(70); - blankMessage.writeUIntBE(this.voiceConnection.authentication.ssrc, 0, 4); - this.send(blankMessage); - } - } - - function parseLocalPacket(message) { - try { - const packet = new Buffer(message); - let address = ''; - for (let i = 4; i < packet.indexOf(0, i); i++) address += String.fromCharCode(packet[i]); - const port = parseInt(packet.readUIntLE(packet.length - 2, 2).toString(10), 10); - return { address, port }; - } catch (error) { - return { error }; - } - } - - module.exports = VoiceConnectionUDPClient; - - /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(58).Buffer)) /***/ }, /* 160 */ -/***/ function(module, exports) { +/***/ function(module, exports, __webpack_require__) { - exports.lookup = exports.resolve4 = - exports.resolve6 = exports.resolveCname = - exports.resolveMx = exports.resolveNs = - exports.resolveTxt = exports.resolveSrv = - exports.resolveNaptr = exports.reverse = - exports.resolve = - function () { - if (!arguments.length) return; - - var callback = arguments[arguments.length - 1]; - if (callback && typeof callback === 'function') { - callback(null, '0.0.0.0') - } - } - +"use strict"; +'use strict'; + +try { + module.exports = __webpack_require__(85)('bufferutil'); +} catch (e) { + module.exports = __webpack_require__(159); +} /***/ }, /* 161 */ /***/ function(module, exports, __webpack_require__) { - const PCMConverters = __webpack_require__(162); - const OpusEncoders = __webpack_require__(165); - const EventEmitter = __webpack_require__(3).EventEmitter; - const StreamDispatcher = __webpack_require__(171); - - /** - * Represents the Audio Player of a Voice Connection - * @extends {EventEmitter} - * @private - */ - class AudioPlayer extends EventEmitter { - constructor(voiceConnection) { - super(); - /** - * The voice connection the player belongs to - * @type {VoiceConnection} - */ - this.voiceConnection = voiceConnection; - this.audioToPCM = new (PCMConverters.fetch())(); - this.opusEncoder = OpusEncoders.fetch(); - this.currentConverter = null; - /** - * The current stream dispatcher, if a stream is being played - * @type {StreamDispatcher} - */ - this.dispatcher = null; - this.audioToPCM.on('error', e => this.emit('error', e)); - this.streamingData = { - channels: 2, - count: 0, - sequence: 0, - timestamp: 0, - pausedTime: 0, - }; - this.voiceConnection.on('closing', () => this.cleanup(null, 'voice connection closing')); - } - - playUnknownStream(stream, { seek = 0, volume = 1, passes = 1 } = {}) { - const options = { seek, volume, passes }; - stream.on('end', () => { - this.emit('debug', 'Input stream to converter has ended'); - }); - stream.on('error', e => this.emit('error', e)); - const conversionProcess = this.audioToPCM.createConvertStream(options.seek); - conversionProcess.on('error', e => this.emit('error', e)); - conversionProcess.setInput(stream); - return this.playPCMStream(conversionProcess.process.stdout, conversionProcess, options); - } - - cleanup(checkStream, reason) { - // cleanup is a lot less aggressive than v9 because it doesn't try to kill every single stream it is aware of - this.emit('debug', `Clean up triggered due to ${reason}`); - const filter = checkStream && this.dispatcher && this.dispatcher.stream === checkStream; - if (this.currentConverter && (checkStream ? filter : true)) { - this.currentConverter.destroy(); - this.currentConverter = null; - } - } - - playPCMStream(stream, converter, { seek = 0, volume = 1, passes = 1 } = {}) { - const options = { seek, volume, passes }; - stream.on('end', () => this.emit('debug', 'PCM input stream ended')); - this.cleanup(null, 'outstanding play stream'); - this.currentConverter = converter; - if (this.dispatcher) { - this.streamingData = this.dispatcher.streamingData; - } - stream.on('error', e => this.emit('error', e)); - const dispatcher = new StreamDispatcher(this, stream, this.streamingData, options); - dispatcher.on('error', e => this.emit('error', e)); - dispatcher.on('end', () => this.cleanup(dispatcher.stream, 'dispatcher ended')); - dispatcher.on('speaking', value => this.voiceConnection.setSpeaking(value)); - this.dispatcher = dispatcher; - dispatcher.on('debug', m => this.emit('debug', `Stream dispatch - ${m}`)); - return dispatcher; - } - - } - - module.exports = AudioPlayer; + +/** + * Expose `Emitter`. + */ + +if (true) { + module.exports = Emitter; +} + +/** + * Initialize a new `Emitter`. + * + * @api public + */ + +function Emitter(obj) { + if (obj) return mixin(obj); +}; + +/** + * Mixin the emitter properties. + * + * @param {Object} obj + * @return {Object} + * @api private + */ + +function mixin(obj) { + for (var key in Emitter.prototype) { + obj[key] = Emitter.prototype[key]; + } + return obj; +} + +/** + * Listen on the given `event` with `fn`. + * + * @param {String} event + * @param {Function} fn + * @return {Emitter} + * @api public + */ + +Emitter.prototype.on = +Emitter.prototype.addEventListener = function(event, fn){ + this._callbacks = this._callbacks || {}; + (this._callbacks['$' + event] = this._callbacks['$' + event] || []) + .push(fn); + return this; +}; + +/** + * Adds an `event` listener that will be invoked a single + * time then automatically removed. + * + * @param {String} event + * @param {Function} fn + * @return {Emitter} + * @api public + */ + +Emitter.prototype.once = function(event, fn){ + function on() { + this.off(event, on); + fn.apply(this, arguments); + } + + on.fn = fn; + this.on(event, on); + return this; +}; + +/** + * Remove the given callback for `event` or all + * registered callbacks. + * + * @param {String} event + * @param {Function} fn + * @return {Emitter} + * @api public + */ + +Emitter.prototype.off = +Emitter.prototype.removeListener = +Emitter.prototype.removeAllListeners = +Emitter.prototype.removeEventListener = function(event, fn){ + this._callbacks = this._callbacks || {}; + + // all + if (0 == arguments.length) { + this._callbacks = {}; + return this; + } + + // specific event + var callbacks = this._callbacks['$' + event]; + if (!callbacks) return this; + + // remove all handlers + if (1 == arguments.length) { + delete this._callbacks['$' + event]; + return this; + } + + // remove specific handler + var cb; + for (var i = 0; i < callbacks.length; i++) { + cb = callbacks[i]; + if (cb === fn || cb.fn === fn) { + callbacks.splice(i, 1); + break; + } + } + return this; +}; + +/** + * Emit `event` with the given args. + * + * @param {String} event + * @param {Mixed} ... + * @return {Emitter} + */ + +Emitter.prototype.emit = function(event){ + this._callbacks = this._callbacks || {}; + var args = [].slice.call(arguments, 1) + , callbacks = this._callbacks['$' + event]; + + if (callbacks) { + callbacks = callbacks.slice(0); + for (var i = 0, len = callbacks.length; i < len; ++i) { + callbacks[i].apply(this, args); + } + } + + return this; +}; + +/** + * Return array of callbacks for `event`. + * + * @param {String} event + * @return {Array} + * @api public + */ + +Emitter.prototype.listeners = function(event){ + this._callbacks = this._callbacks || {}; + return this._callbacks['$' + event] || []; +}; + +/** + * Check if this emitter has `event` handlers. + * + * @param {String} event + * @return {Boolean} + * @api public + */ + +Emitter.prototype.hasListeners = function(event){ + return !! this.listeners(event).length; +}; /***/ }, /* 162 */ /***/ function(module, exports, __webpack_require__) { - exports.fetch = () => __webpack_require__(163); +/* WEBPACK VAR INJECTION */(function(Buffer) {var elliptic = __webpack_require__(7); +var BN = __webpack_require__(4); +module.exports = function createECDH(curve) { + return new ECDH(curve); +}; + +var aliases = { + secp256k1: { + name: 'secp256k1', + byteLength: 32 + }, + secp224r1: { + name: 'p224', + byteLength: 28 + }, + prime256v1: { + name: 'p256', + byteLength: 32 + }, + prime192v1: { + name: 'p192', + byteLength: 24 + }, + ed25519: { + name: 'ed25519', + byteLength: 32 + }, + secp384r1: { + name: 'p384', + byteLength: 48 + }, + secp521r1: { + name: 'p521', + byteLength: 66 + } +}; + +aliases.p224 = aliases.secp224r1; +aliases.p256 = aliases.secp256r1 = aliases.prime256v1; +aliases.p192 = aliases.secp192r1 = aliases.prime192v1; +aliases.p384 = aliases.secp384r1; +aliases.p521 = aliases.secp521r1; + +function ECDH(curve) { + this.curveType = aliases[curve]; + if (!this.curveType ) { + this.curveType = { + name: curve + }; + } + this.curve = new elliptic.ec(this.curveType.name); + this.keys = void 0; +} + +ECDH.prototype.generateKeys = function (enc, format) { + this.keys = this.curve.genKeyPair(); + return this.getPublicKey(enc, format); +}; + +ECDH.prototype.computeSecret = function (other, inenc, enc) { + inenc = inenc || 'utf8'; + if (!Buffer.isBuffer(other)) { + other = new Buffer(other, inenc); + } + var otherPub = this.curve.keyFromPublic(other).getPublic(); + var out = otherPub.mul(this.keys.getPrivate()).getX(); + return formatReturnValue(out, enc, this.curveType.byteLength); +}; + +ECDH.prototype.getPublicKey = function (enc, format) { + var key = this.keys.getPublic(format === 'compressed', true); + if (format === 'hybrid') { + if (key[key.length - 1] % 2) { + key[0] = 7; + } else { + key [0] = 6; + } + } + return formatReturnValue(key, enc); +}; + +ECDH.prototype.getPrivateKey = function (enc) { + return formatReturnValue(this.keys.getPrivate(), enc); +}; + +ECDH.prototype.setPublicKey = function (pub, enc) { + enc = enc || 'utf8'; + if (!Buffer.isBuffer(pub)) { + pub = new Buffer(pub, enc); + } + this.keys._importPublic(pub); + return this; +}; + +ECDH.prototype.setPrivateKey = function (priv, enc) { + enc = enc || 'utf8'; + if (!Buffer.isBuffer(priv)) { + priv = new Buffer(priv, enc); + } + var _priv = new BN(priv); + _priv = _priv.toString(16); + this.keys._importPrivate(_priv); + return this; +}; + +function formatReturnValue(bn, enc, len) { + if (!Array.isArray(bn)) { + bn = bn.toArray(); + } + var buf = new Buffer(bn); + if (len && buf.length < len) { + var zeros = new Buffer(len - buf.length); + zeros.fill(0); + buf = Buffer.concat([zeros, buf]); + } + if (!enc) { + return buf; + } else { + return buf.toString(enc); + } +} + +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer)) /***/ }, /* 163 */ /***/ function(module, exports, __webpack_require__) { - const ConverterEngine = __webpack_require__(164); - const ChildProcess = __webpack_require__(62); - const EventEmitter = __webpack_require__(3).EventEmitter; +"use strict"; +/* WEBPACK VAR INJECTION */(function(Buffer) {'use strict'; +var intSize = 4; +var zeroBuffer = new Buffer(intSize); zeroBuffer.fill(0); +var chrsz = 8; - class PCMConversionProcess extends EventEmitter { - constructor(process) { - super(); - this.process = process; - this.input = null; - this.process.on('error', e => this.emit('error', e)); - } +function toArray(buf, bigEndian) { + if ((buf.length % intSize) !== 0) { + var len = buf.length + (intSize - (buf.length % intSize)); + buf = Buffer.concat([buf, zeroBuffer], len); + } - setInput(stream) { - this.input = stream; - stream.pipe(this.process.stdin, { end: false }); - this.input.on('error', e => this.emit('error', e)); - this.process.stdin.on('error', e => this.emit('error', e)); - } + var arr = []; + var fn = bigEndian ? buf.readInt32BE : buf.readInt32LE; + for (var i = 0; i < buf.length; i += intSize) { + arr.push(fn.call(buf, i)); + } + return arr; +} - destroy() { - this.emit('debug', 'destroying a ffmpeg process:'); - if (this.input && this.input.unpipe && this.process.stdin) { - this.input.unpipe(this.process.stdin); - this.emit('unpiped the user input stream from the process input stream'); - } - if (this.process.stdin) { - this.process.stdin.end(); - this.emit('ended the process stdin'); - } - if (this.process.stdin.destroy) { - this.process.stdin.destroy(); - this.emit('destroyed the process stdin'); - } - if (this.process.kill) { - this.process.kill(); - this.emit('killed the process'); - } - } - - } - - class FfmpegConverterEngine extends ConverterEngine { - constructor(player) { - super(player); - this.command = chooseCommand(); - } - - handleError(encoder, err) { - if (encoder.destroy) encoder.destroy(); - this.emit('error', err); - } - - createConvertStream(seek = 0) { - super.createConvertStream(); - const encoder = ChildProcess.spawn(this.command, [ - '-analyzeduration', '0', - '-loglevel', '0', - '-i', '-', - '-f', 's16le', - '-ar', '48000', - '-ac', '2', - '-ss', String(seek), - 'pipe:1', - ], { stdio: ['pipe', 'pipe', 'ignore'] }); - return new PCMConversionProcess(encoder); - } - } - - function chooseCommand() { - for (const cmd of ['ffmpeg', 'avconv', './ffmpeg', './avconv']) { - if (!ChildProcess.spawnSync(cmd, ['-h']).error) return cmd; - } - throw new Error( - 'FFMPEG was not found on your system, so audio cannot be played. ' + - 'Please make sure FFMPEG is installed and in your PATH.' - ); - } - - module.exports = FfmpegConverterEngine; +function toBuffer(arr, size, bigEndian) { + var buf = new Buffer(size); + var fn = bigEndian ? buf.writeInt32BE : buf.writeInt32LE; + for (var i = 0; i < arr.length; i++) { + fn.call(buf, arr[i], i * 4, true); + } + return buf; +} +function hash(buf, fn, hashSize, bigEndian) { + if (!Buffer.isBuffer(buf)) buf = new Buffer(buf); + var arr = fn(toArray(buf, bigEndian), buf.length * chrsz); + return toBuffer(arr, hashSize, bigEndian); +} +exports.hash = hash; +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer)) /***/ }, /* 164 */ /***/ function(module, exports, __webpack_require__) { - const EventEmitter = __webpack_require__(3).EventEmitter; +/* WEBPACK VAR INJECTION */(function(Buffer) {/* +CryptoJS v3.1.2 +code.google.com/p/crypto-js +(c) 2009-2013 by Jeff Mott. All rights reserved. +code.google.com/p/crypto-js/wiki/License +*/ +/** @preserve +(c) 2012 by Cédric Mesnil. All rights reserved. - class ConverterEngine extends EventEmitter { - constructor(player) { - super(); - this.player = player; - } +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - createConvertStream() { - return; - } - } + - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - module.exports = ConverterEngine; +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ +// constants table +var zl = [ + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8, + 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12, + 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2, + 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13 +] + +var zr = [ + 5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12, + 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2, + 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13, + 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14, + 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11 +] + +var sl = [ + 11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8, + 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12, + 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5, + 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12, + 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6 +] + +var sr = [ + 8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6, + 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11, + 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5, + 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8, + 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11 +] + +var hl = [0x00000000, 0x5A827999, 0x6ED9EBA1, 0x8F1BBCDC, 0xA953FD4E] +var hr = [0x50A28BE6, 0x5C4DD124, 0x6D703EF3, 0x7A6D76E9, 0x00000000] + +function bytesToWords (bytes) { + var words = [] + for (var i = 0, b = 0; i < bytes.length; i++, b += 8) { + words[b >>> 5] |= bytes[i] << (24 - b % 32) + } + return words +} + +function wordsToBytes (words) { + var bytes = [] + for (var b = 0; b < words.length * 32; b += 8) { + bytes.push((words[b >>> 5] >>> (24 - b % 32)) & 0xFF) + } + return bytes +} + +function processBlock (H, M, offset) { + // swap endian + for (var i = 0; i < 16; i++) { + var offset_i = offset + i + var M_offset_i = M[offset_i] + + // Swap + M[offset_i] = ( + (((M_offset_i << 8) | (M_offset_i >>> 24)) & 0x00ff00ff) | + (((M_offset_i << 24) | (M_offset_i >>> 8)) & 0xff00ff00) + ) + } + + // Working variables + var al, bl, cl, dl, el + var ar, br, cr, dr, er + + ar = al = H[0] + br = bl = H[1] + cr = cl = H[2] + dr = dl = H[3] + er = el = H[4] + + // computation + var t + for (i = 0; i < 80; i += 1) { + t = (al + M[offset + zl[i]]) | 0 + if (i < 16) { + t += f1(bl, cl, dl) + hl[0] + } else if (i < 32) { + t += f2(bl, cl, dl) + hl[1] + } else if (i < 48) { + t += f3(bl, cl, dl) + hl[2] + } else if (i < 64) { + t += f4(bl, cl, dl) + hl[3] + } else {// if (i<80) { + t += f5(bl, cl, dl) + hl[4] + } + t = t | 0 + t = rotl(t, sl[i]) + t = (t + el) | 0 + al = el + el = dl + dl = rotl(cl, 10) + cl = bl + bl = t + + t = (ar + M[offset + zr[i]]) | 0 + if (i < 16) { + t += f5(br, cr, dr) + hr[0] + } else if (i < 32) { + t += f4(br, cr, dr) + hr[1] + } else if (i < 48) { + t += f3(br, cr, dr) + hr[2] + } else if (i < 64) { + t += f2(br, cr, dr) + hr[3] + } else {// if (i<80) { + t += f1(br, cr, dr) + hr[4] + } + + t = t | 0 + t = rotl(t, sr[i]) + t = (t + er) | 0 + ar = er + er = dr + dr = rotl(cr, 10) + cr = br + br = t + } + + // intermediate hash value + t = (H[1] + cl + dr) | 0 + H[1] = (H[2] + dl + er) | 0 + H[2] = (H[3] + el + ar) | 0 + H[3] = (H[4] + al + br) | 0 + H[4] = (H[0] + bl + cr) | 0 + H[0] = t +} + +function f1 (x, y, z) { + return ((x) ^ (y) ^ (z)) +} + +function f2 (x, y, z) { + return (((x) & (y)) | ((~x) & (z))) +} + +function f3 (x, y, z) { + return (((x) | (~(y))) ^ (z)) +} + +function f4 (x, y, z) { + return (((x) & (z)) | ((y) & (~(z)))) +} + +function f5 (x, y, z) { + return ((x) ^ ((y) | (~(z)))) +} + +function rotl (x, n) { + return (x << n) | (x >>> (32 - n)) +} + +function ripemd160 (message) { + var H = [0x67452301, 0xEFCDAB89, 0x98BADCFE, 0x10325476, 0xC3D2E1F0] + + if (typeof message === 'string') { + message = new Buffer(message, 'utf8') + } + + var m = bytesToWords(message) + + var nBitsLeft = message.length * 8 + var nBitsTotal = message.length * 8 + + // Add padding + m[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32) + m[(((nBitsLeft + 64) >>> 9) << 4) + 14] = ( + (((nBitsTotal << 8) | (nBitsTotal >>> 24)) & 0x00ff00ff) | + (((nBitsTotal << 24) | (nBitsTotal >>> 8)) & 0xff00ff00) + ) + + for (var i = 0; i < m.length; i += 16) { + processBlock(H, m, i) + } + + // swap endian + for (i = 0; i < 5; i++) { + // shortcut + var H_i = H[i] + + // Swap + H[i] = (((H_i << 8) | (H_i >>> 24)) & 0x00ff00ff) | + (((H_i << 24) | (H_i >>> 8)) & 0xff00ff00) + } + + var digestbytes = wordsToBytes(H) + return new Buffer(digestbytes) +} + +module.exports = ripemd160 + +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer)) /***/ }, /* 165 */ /***/ function(module, exports, __webpack_require__) { - const list = [ - __webpack_require__(166), - __webpack_require__(168), - ]; +var exports = module.exports = function SHA (algorithm) { + algorithm = algorithm.toLowerCase() - function fetch(Encoder) { - try { - return new Encoder(); - } catch (err) { - return null; - } - } + var Algorithm = exports[algorithm] + if (!Algorithm) throw new Error(algorithm + ' is not supported (we accept pull requests)') - exports.add = encoder => { - list.push(encoder); - }; + return new Algorithm() +} - exports.fetch = () => { - for (const encoder of list) { - const fetched = fetch(encoder); - if (fetched) return fetched; - } - throw new Error('Couldn\'t find an Opus engine.'); - }; +exports.sha = __webpack_require__(166) +exports.sha1 = __webpack_require__(167) +exports.sha224 = __webpack_require__(168) +exports.sha256 = __webpack_require__(99) +exports.sha384 = __webpack_require__(169) +exports.sha512 = __webpack_require__(100) /***/ }, /* 166 */ /***/ function(module, exports, __webpack_require__) { - const OpusEngine = __webpack_require__(167); +/* WEBPACK VAR INJECTION */(function(Buffer) {/* + * A JavaScript implementation of the Secure Hash Algorithm, SHA-0, as defined + * in FIPS PUB 180-1 + * This source code is derived from sha1.js of the same repository. + * The difference between SHA-0 and SHA-1 is just a bitwise rotate left + * operation was added. + */ - let opus; +var inherits = __webpack_require__(1) +var Hash = __webpack_require__(19) - class NodeOpusEngine extends OpusEngine { - constructor(player) { - super(player); - try { - opus = __webpack_require__(!(function webpackMissingModule() { var e = new Error("Cannot find module \"node-opus\""); e.code = 'MODULE_NOT_FOUND'; throw e; }())); - } catch (err) { - throw err; - } - this.encoder = new opus.OpusEncoder(48000, 2); - } +var K = [ + 0x5a827999, 0x6ed9eba1, 0x8f1bbcdc | 0, 0xca62c1d6 | 0 +] - encode(buffer) { - super.encode(buffer); - return this.encoder.encode(buffer, 1920); - } +var W = new Array(80) - decode(buffer) { - super.decode(buffer); - return this.encoder.decode(buffer, 1920); - } - } +function Sha () { + this.init() + this._w = W - module.exports = NodeOpusEngine; + Hash.call(this, 64, 56) +} +inherits(Sha, Hash) + +Sha.prototype.init = function () { + this._a = 0x67452301 + this._b = 0xefcdab89 + this._c = 0x98badcfe + this._d = 0x10325476 + this._e = 0xc3d2e1f0 + + return this +} + +function rotl5 (num) { + return (num << 5) | (num >>> 27) +} + +function rotl30 (num) { + return (num << 30) | (num >>> 2) +} + +function ft (s, b, c, d) { + if (s === 0) return (b & c) | ((~b) & d) + if (s === 2) return (b & c) | (b & d) | (c & d) + return b ^ c ^ d +} + +Sha.prototype._update = function (M) { + var W = this._w + + var a = this._a | 0 + var b = this._b | 0 + var c = this._c | 0 + var d = this._d | 0 + var e = this._e | 0 + + for (var i = 0; i < 16; ++i) W[i] = M.readInt32BE(i * 4) + for (; i < 80; ++i) W[i] = W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16] + + for (var j = 0; j < 80; ++j) { + var s = ~~(j / 20) + var t = (rotl5(a) + ft(s, b, c, d) + e + W[j] + K[s]) | 0 + + e = d + d = c + c = rotl30(b) + b = a + a = t + } + + this._a = (a + this._a) | 0 + this._b = (b + this._b) | 0 + this._c = (c + this._c) | 0 + this._d = (d + this._d) | 0 + this._e = (e + this._e) | 0 +} + +Sha.prototype._hash = function () { + var H = new Buffer(20) + + H.writeInt32BE(this._a | 0, 0) + H.writeInt32BE(this._b | 0, 4) + H.writeInt32BE(this._c | 0, 8) + H.writeInt32BE(this._d | 0, 12) + H.writeInt32BE(this._e | 0, 16) + + return H +} + +module.exports = Sha + +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer)) /***/ }, /* 167 */ -/***/ function(module, exports) { +/***/ function(module, exports, __webpack_require__) { - class BaseOpus { - constructor(player) { - this.player = player; - } +/* WEBPACK VAR INJECTION */(function(Buffer) {/* + * A JavaScript implementation of the Secure Hash Algorithm, SHA-1, as defined + * in FIPS PUB 180-1 + * Version 2.1a Copyright Paul Johnston 2000 - 2002. + * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet + * Distributed under the BSD License + * See http://pajhome.org.uk/crypt/md5 for details. + */ - encode(buffer) { - return buffer; - } +var inherits = __webpack_require__(1) +var Hash = __webpack_require__(19) - decode(buffer) { - return buffer; - } - } +var K = [ + 0x5a827999, 0x6ed9eba1, 0x8f1bbcdc | 0, 0xca62c1d6 | 0 +] - module.exports = BaseOpus; +var W = new Array(80) +function Sha1 () { + this.init() + this._w = W + + Hash.call(this, 64, 56) +} + +inherits(Sha1, Hash) + +Sha1.prototype.init = function () { + this._a = 0x67452301 + this._b = 0xefcdab89 + this._c = 0x98badcfe + this._d = 0x10325476 + this._e = 0xc3d2e1f0 + + return this +} + +function rotl1 (num) { + return (num << 1) | (num >>> 31) +} + +function rotl5 (num) { + return (num << 5) | (num >>> 27) +} + +function rotl30 (num) { + return (num << 30) | (num >>> 2) +} + +function ft (s, b, c, d) { + if (s === 0) return (b & c) | ((~b) & d) + if (s === 2) return (b & c) | (b & d) | (c & d) + return b ^ c ^ d +} + +Sha1.prototype._update = function (M) { + var W = this._w + + var a = this._a | 0 + var b = this._b | 0 + var c = this._c | 0 + var d = this._d | 0 + var e = this._e | 0 + + for (var i = 0; i < 16; ++i) W[i] = M.readInt32BE(i * 4) + for (; i < 80; ++i) W[i] = rotl1(W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16]) + + for (var j = 0; j < 80; ++j) { + var s = ~~(j / 20) + var t = (rotl5(a) + ft(s, b, c, d) + e + W[j] + K[s]) | 0 + + e = d + d = c + c = rotl30(b) + b = a + a = t + } + + this._a = (a + this._a) | 0 + this._b = (b + this._b) | 0 + this._c = (c + this._c) | 0 + this._d = (d + this._d) | 0 + this._e = (e + this._e) | 0 +} + +Sha1.prototype._hash = function () { + var H = new Buffer(20) + + H.writeInt32BE(this._a | 0, 0) + H.writeInt32BE(this._b | 0, 4) + H.writeInt32BE(this._c | 0, 8) + H.writeInt32BE(this._d | 0, 12) + H.writeInt32BE(this._e | 0, 16) + + return H +} + +module.exports = Sha1 + +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer)) /***/ }, /* 168 */ /***/ function(module, exports, __webpack_require__) { - const OpusEngine = __webpack_require__(167); +/* WEBPACK VAR INJECTION */(function(Buffer) {/** + * A JavaScript implementation of the Secure Hash Algorithm, SHA-256, as defined + * in FIPS 180-2 + * Version 2.2-beta Copyright Angel Marin, Paul Johnston 2000 - 2009. + * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet + * + */ - let OpusScript; +var inherits = __webpack_require__(1) +var Sha256 = __webpack_require__(99) +var Hash = __webpack_require__(19) - class NodeOpusEngine extends OpusEngine { - constructor(player) { - super(player); - try { - OpusScript = __webpack_require__(169); - } catch (err) { - throw err; - } - this.encoder = new OpusScript(48000, 2); - } +var W = new Array(64) - encode(buffer) { - super.encode(buffer); - return this.encoder.encode(buffer, 960); - } +function Sha224 () { + this.init() - decode(buffer) { - super.decode(buffer); - return this.encoder.decode(buffer); - } - } + this._w = W // new Array(64) - module.exports = NodeOpusEngine; + Hash.call(this, 64, 56) +} +inherits(Sha224, Sha256) + +Sha224.prototype.init = function () { + this._a = 0xc1059ed8 + this._b = 0x367cd507 + this._c = 0x3070dd17 + this._d = 0xf70e5939 + this._e = 0xffc00b31 + this._f = 0x68581511 + this._g = 0x64f98fa7 + this._h = 0xbefa4fa4 + + return this +} + +Sha224.prototype._hash = function () { + var H = new Buffer(28) + + H.writeInt32BE(this._a, 0) + H.writeInt32BE(this._b, 4) + H.writeInt32BE(this._c, 8) + H.writeInt32BE(this._d, 12) + H.writeInt32BE(this._e, 16) + H.writeInt32BE(this._f, 20) + H.writeInt32BE(this._g, 24) + + return H +} + +module.exports = Sha224 + +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer)) /***/ }, /* 169 */ /***/ function(module, exports, __webpack_require__) { - /* WEBPACK VAR INJECTION */(function(Buffer) {"use strict"; +/* WEBPACK VAR INJECTION */(function(Buffer) {var inherits = __webpack_require__(1) +var SHA512 = __webpack_require__(100) +var Hash = __webpack_require__(19) - var opusscript_native = __webpack_require__(170); +var W = new Array(160) - var OpusApplication = { - VOIP: 2048, - AUDIO: 2049, - RESTRICTED_LOWDELAY: 2051 - }; - var OpusError = { - "0": "OK", - "-1": "Bad argument", - "-2": "Buffer too small", - "-3": "Internal error", - "-4": "Invalid packet", - "-5": "Unimplemented", - "-6": "Invalid state", - "-7": "Memory allocation fail" - }; - var VALID_SAMPLING_RATES = [8000, 12000, 16000, 24000, 48000]; - var MAX_FRAME_SIZE = 48000 * 60 / 1000; - var MAX_PACKET_SIZE = 1276 * 3; - var SET_BITRATE_REQUEST = 4002; +function Sha384 () { + this.init() + this._w = W - function OpusScript(samplingRate, channels, application) { - if(!~VALID_SAMPLING_RATES.indexOf(samplingRate)) { - throw new RangeError(`${samplingRate} is an invalid sampling rate.`); - } - this.samplingRate = samplingRate; + Hash.call(this, 128, 112) +} - this.channels = channels || 1; - this.application = application || OpusApplication.AUDIO; +inherits(Sha384, SHA512) - this.handler = new opusscript_native.OpusScriptHandler(this.samplingRate, this.channels, this.application); +Sha384.prototype.init = function () { + this._ah = 0xcbbb9d5d + this._bh = 0x629a292a + this._ch = 0x9159015a + this._dh = 0x152fecd8 + this._eh = 0x67332667 + this._fh = 0x8eb44a87 + this._gh = 0xdb0c2e0d + this._hh = 0x47b5481d - this.inPCMLength = MAX_FRAME_SIZE * this.channels * 2; - this.inPCMPointer = opusscript_native._malloc(this.inPCMLength); - this.inPCM = opusscript_native.HEAPU16.subarray(this.inPCMPointer, this.inPCMPointer + this.inPCMLength); + this._al = 0xc1059ed8 + this._bl = 0x367cd507 + this._cl = 0x3070dd17 + this._dl = 0xf70e5939 + this._el = 0xffc00b31 + this._fl = 0x68581511 + this._gl = 0x64f98fa7 + this._hl = 0xbefa4fa4 - this.inOpusPointer = opusscript_native._malloc(MAX_PACKET_SIZE); - this.inOpus = opusscript_native.HEAPU8.subarray(this.inOpusPointer, this.inOpusPointer + MAX_PACKET_SIZE); + return this +} - this.outOpusPointer = opusscript_native._malloc(MAX_PACKET_SIZE); - this.outOpus = opusscript_native.HEAPU8.subarray(this.outOpusPointer, this.outOpusPointer + MAX_PACKET_SIZE); +Sha384.prototype._hash = function () { + var H = new Buffer(48) - this.outPCMLength = MAX_FRAME_SIZE * this.channels * 2; - this.outPCMPointer = opusscript_native._malloc(this.outPCMLength); - this.outPCM = opusscript_native.HEAPU16.subarray(this.outPCMPointer, this.outPCMPointer + this.outPCMLength); - }; + function writeInt64BE (h, l, offset) { + H.writeInt32BE(h, offset) + H.writeInt32BE(l, offset + 4) + } - OpusScript.prototype.setBitrate = function setBitrate(bitrate) { - this.bitrate = bitrate || 64000; - opusscript_native.setValue(this.bitratePointer, this.bitrate, "i32"); - var errCode = opusscript_native._opus_encoder_ctl(this.handler, SET_BITRATE_REQUEST, this.bitratePointer); - if(errCode < 0) { - throw new Error("Failed to set bitrate: " + OpusError["" + opusscript_native.getValue(errCode, "i32")]); - } - }; + writeInt64BE(this._ah, this._al, 0) + writeInt64BE(this._bh, this._bl, 8) + writeInt64BE(this._ch, this._cl, 16) + writeInt64BE(this._dh, this._dl, 24) + writeInt64BE(this._eh, this._el, 32) + writeInt64BE(this._fh, this._fl, 40) - OpusScript.prototype.encode = function encode(buffer, frameSize) { - this.inPCM.set(buffer); + return H +} - var len = this.handler._encode(this.inPCM.byteOffset, buffer.length, this.outOpusPointer, frameSize); - if(len < 0) { - throw new Error("Encode error: " + OpusError["" + len]); - } +module.exports = Sha384 - return new Buffer(this.outOpus.subarray(0, len)); - }; - - OpusScript.prototype.decode = function decode(buffer) { - this.inOpus.set(buffer); - - var len = this.handler._decode(this.inOpusPointer, buffer.length, this.outPCM.byteOffset); - if(len < 0) { - throw new Error("Decode error: " + OpusError["" + len]); - } - - return new Buffer(this.outPCM.subarray(0, len * this.channels * 2)); - }; - - OpusScript.Application = OpusApplication; - OpusScript.Error = OpusError; - OpusScript.VALID_SAMPLING_RATES = VALID_SAMPLING_RATES; - OpusScript.MAX_PACKET_SIZE = MAX_PACKET_SIZE; - - module.exports = OpusScript; - - /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(58).Buffer)) +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer)) /***/ }, /* 170 */ /***/ function(module, exports, __webpack_require__) { - /* WEBPACK VAR INJECTION */(function(process, __dirname, module) {var Module;if(!Module)Module=(typeof Module!=="undefined"?Module:null)||{};var moduleOverrides={};for(var key in Module){if(Module.hasOwnProperty(key)){moduleOverrides[key]=Module[key]}}var ENVIRONMENT_IS_WEB=false;var ENVIRONMENT_IS_WORKER=false;var ENVIRONMENT_IS_NODE=false;var ENVIRONMENT_IS_SHELL=false;if(Module["ENVIRONMENT"]){if(Module["ENVIRONMENT"]==="WEB"){ENVIRONMENT_IS_WEB=true}else if(Module["ENVIRONMENT"]==="WORKER"){ENVIRONMENT_IS_WORKER=true}else if(Module["ENVIRONMENT"]==="NODE"){ENVIRONMENT_IS_NODE=true}else if(Module["ENVIRONMENT"]==="SHELL"){ENVIRONMENT_IS_SHELL=true}else{throw new Error("The provided Module['ENVIRONMENT'] value is not valid. It must be one of: WEB|WORKER|NODE|SHELL.")}}else{ENVIRONMENT_IS_WEB=typeof window==="object";ENVIRONMENT_IS_WORKER=typeof importScripts==="function";ENVIRONMENT_IS_NODE=typeof process==="object"&&"function"==="function"&&!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_WORKER;ENVIRONMENT_IS_SHELL=!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_NODE&&!ENVIRONMENT_IS_WORKER}if(ENVIRONMENT_IS_NODE){if(!Module["print"])Module["print"]=console.log;if(!Module["printErr"])Module["printErr"]=console.warn;var nodeFS;var nodePath;Module["read"]=function read(filename,binary){if(!nodeFS)nodeFS=__webpack_require__(62);if(!nodePath)nodePath=__webpack_require__(15);filename=nodePath["normalize"](filename);var ret=nodeFS["readFileSync"](filename);if(!ret&&filename!=nodePath["resolve"](filename)){filename=path.join(__dirname,"..","src",filename);ret=nodeFS["readFileSync"](filename)}if(ret&&!binary)ret=ret.toString();return ret};Module["readBinary"]=function readBinary(filename){var ret=Module["read"](filename,true);if(!ret.buffer){ret=new Uint8Array(ret)}assert(ret.buffer);return ret};Module["load"]=function load(f){globalEval(read(f))};if(!Module["thisProgram"]){if(process["argv"].length>1){Module["thisProgram"]=process["argv"][1].replace(/\\/g,"/")}else{Module["thisProgram"]="unknown-program"}}Module["arguments"]=process["argv"].slice(2);if(true){module["exports"]=Module}Module["inspect"]=(function(){return"[Emscripten Module object]"})}else if(ENVIRONMENT_IS_SHELL){if(!Module["print"])Module["print"]=print;if(typeof printErr!="undefined")Module["printErr"]=printErr;if(typeof read!="undefined"){Module["read"]=read}else{Module["read"]=function read(){throw"no read() available (jsc?)"}}Module["readBinary"]=function readBinary(f){if(typeof readbuffer==="function"){return new Uint8Array(readbuffer(f))}var data=read(f,"binary");assert(typeof data==="object");return data};if(typeof scriptArgs!="undefined"){Module["arguments"]=scriptArgs}else if(typeof arguments!="undefined"){Module["arguments"]=arguments}}else if(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER){Module["read"]=function read(url){var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.send(null);return xhr.responseText};Module["readAsync"]=function readAsync(url,onload,onerror){var xhr=new XMLHttpRequest;xhr.open("GET",url,true);xhr.responseType="arraybuffer";xhr.onload=function xhr_onload(){if(xhr.status==200||xhr.status==0&&xhr.response){onload(xhr.response)}else{onerror()}};xhr.onerror=onerror;xhr.send(null)};if(typeof arguments!="undefined"){Module["arguments"]=arguments}if(typeof console!=="undefined"){if(!Module["print"])Module["print"]=function print(x){console.log(x)};if(!Module["printErr"])Module["printErr"]=function printErr(x){console.warn(x)}}else{var TRY_USE_DUMP=false;if(!Module["print"])Module["print"]=TRY_USE_DUMP&&typeof dump!=="undefined"?(function(x){dump(x)}):(function(x){})}if(ENVIRONMENT_IS_WORKER){Module["load"]=importScripts}if(typeof Module["setWindowTitle"]==="undefined"){Module["setWindowTitle"]=(function(title){document.title=title})}}else{throw"Unknown runtime environment. Where are we?"}function globalEval(x){eval.call(null,x)}if(!Module["load"]&&Module["read"]){Module["load"]=function load(f){globalEval(Module["read"](f))}}if(!Module["print"]){Module["print"]=(function(){})}if(!Module["printErr"]){Module["printErr"]=Module["print"]}if(!Module["arguments"]){Module["arguments"]=[]}if(!Module["thisProgram"]){Module["thisProgram"]="./this.program"}Module.print=Module["print"];Module.printErr=Module["printErr"];Module["preRun"]=[];Module["postRun"]=[];for(var key in moduleOverrides){if(moduleOverrides.hasOwnProperty(key)){Module[key]=moduleOverrides[key]}}moduleOverrides=undefined;var Runtime={setTempRet0:(function(value){tempRet0=value}),getTempRet0:(function(){return tempRet0}),stackSave:(function(){return STACKTOP}),stackRestore:(function(stackTop){STACKTOP=stackTop}),getNativeTypeSize:(function(type){switch(type){case"i1":case"i8":return 1;case"i16":return 2;case"i32":return 4;case"i64":return 8;case"float":return 4;case"double":return 8;default:{if(type[type.length-1]==="*"){return Runtime.QUANTUM_SIZE}else if(type[0]==="i"){var bits=parseInt(type.substr(1));assert(bits%8===0);return bits/8}else{return 0}}}}),getNativeFieldSize:(function(type){return Math.max(Runtime.getNativeTypeSize(type),Runtime.QUANTUM_SIZE)}),STACK_ALIGN:16,prepVararg:(function(ptr,type){if(type==="double"||type==="i64"){if(ptr&7){assert((ptr&7)===4);ptr+=4}}else{assert((ptr&3)===0)}return ptr}),getAlignSize:(function(type,size,vararg){if(!vararg&&(type=="i64"||type=="double"))return 8;if(!type)return Math.min(size,8);return Math.min(size||(type?Runtime.getNativeFieldSize(type):0),Runtime.QUANTUM_SIZE)}),dynCall:(function(sig,ptr,args){if(args&&args.length){if(!args.splice)args=Array.prototype.slice.call(args);args.splice(0,0,ptr);return Module["dynCall_"+sig].apply(null,args)}else{return Module["dynCall_"+sig].call(null,ptr)}}),functionPointers:[],addFunction:(function(func){for(var i=0;i=TOTAL_MEMORY){var success=enlargeMemory();if(!success){DYNAMICTOP=ret;return 0}}return ret}),alignMemory:(function(size,quantum){var ret=size=Math.ceil(size/(quantum?quantum:16))*(quantum?quantum:16);return ret}),makeBigInt:(function(low,high,unsigned){var ret=unsigned?+(low>>>0)+ +(high>>>0)*+4294967296:+(low>>>0)+ +(high|0)*+4294967296;return ret}),GLOBAL_BASE:8,QUANTUM_SIZE:4,__dummy__:0};var ABORT=false;var EXITSTATUS=0;function assert(condition,text){if(!condition){abort("Assertion failed: "+text)}}function getCFunc(ident){var func=Module["_"+ident];if(!func){try{func=eval("_"+ident)}catch(e){}}assert(func,"Cannot call unknown function "+ident+" (perhaps LLVM optimizations or closure removed it?)");return func}var ccall;((function(){var JSfuncs={"stackSave":(function(){Runtime.stackSave()}),"stackRestore":(function(){Runtime.stackRestore()}),"arrayToC":(function(arr){var ret=Runtime.stackAlloc(arr.length);writeArrayToMemory(arr,ret);return ret}),"stringToC":(function(str){var ret=0;if(str!==null&&str!==undefined&&str!==0){ret=Runtime.stackAlloc((str.length<<2)+1);writeStringToMemory(str,ret)}return ret})};var toC={"string":JSfuncs["stringToC"],"array":JSfuncs["arrayToC"]};ccall=function ccallFunc(ident,returnType,argTypes,args,opts){var func=getCFunc(ident);var cArgs=[];var stack=0;if(args){for(var i=0;i>0]=value;break;case"i8":HEAP8[ptr>>0]=value;break;case"i16":HEAP16[ptr>>1]=value;break;case"i32":HEAP32[ptr>>2]=value;break;case"i64":tempI64=[value>>>0,(tempDouble=value,+Math_abs(tempDouble)>=+1?tempDouble>+0?(Math_min(+Math_floor(tempDouble/+4294967296),+4294967295)|0)>>>0:~~+Math_ceil((tempDouble- +(~~tempDouble>>>0))/+4294967296)>>>0:0)],HEAP32[ptr>>2]=tempI64[0],HEAP32[ptr+4>>2]=tempI64[1];break;case"float":HEAPF32[ptr>>2]=value;break;case"double":HEAPF64[ptr>>3]=value;break;default:abort("invalid type for setValue: "+type)}}Module["setValue"]=setValue;function getValue(ptr,type,noSafe){type=type||"i8";if(type.charAt(type.length-1)==="*")type="i32";switch(type){case"i1":return HEAP8[ptr>>0];case"i8":return HEAP8[ptr>>0];case"i16":return HEAP16[ptr>>1];case"i32":return HEAP32[ptr>>2];case"i64":return HEAP32[ptr>>2];case"float":return HEAPF32[ptr>>2];case"double":return HEAPF64[ptr>>3];default:abort("invalid type for setValue: "+type)}return null}Module["getValue"]=getValue;var ALLOC_NORMAL=0;var ALLOC_STATIC=2;var ALLOC_DYNAMIC=3;var ALLOC_NONE=4;function allocate(slab,types,allocator,ptr){var zeroinit,size;if(typeof slab==="number"){zeroinit=true;size=slab}else{zeroinit=false;size=slab.length}var singleType=typeof types==="string"?types:null;var ret;if(allocator==ALLOC_NONE){ret=ptr}else{ret=[typeof _malloc==="function"?_malloc:Runtime.staticAlloc,Runtime.stackAlloc,Runtime.staticAlloc,Runtime.dynamicAlloc][allocator===undefined?ALLOC_STATIC:allocator](Math.max(size,singleType?1:types.length))}if(zeroinit){var ptr=ret,stop;assert((ret&3)==0);stop=ret+(size&~3);for(;ptr>2]=0}stop=ret+size;while(ptr>0]=0}return ret}if(singleType==="i8"){if(slab.subarray||slab.slice){HEAPU8.set(slab,ret)}else{HEAPU8.set(new Uint8Array(slab),ret)}return ret}var i=0,type,typeSize,previousType;while(i>0];hasUtf|=t;if(t==0&&!length)break;i++;if(length&&i==length)break}if(!length)length=i;var ret="";if(hasUtf<128){var MAX_CHUNK=1024;var curr;while(length>0){curr=String.fromCharCode.apply(String,HEAPU8.subarray(ptr,ptr+Math.min(length,MAX_CHUNK)));ret=ret?ret+curr:curr;ptr+=MAX_CHUNK;length-=MAX_CHUNK}return ret}return Module["UTF8ToString"](ptr)}function UTF8ArrayToString(u8Array,idx){var u0,u1,u2,u3,u4,u5;var str="";while(1){u0=u8Array[idx++];if(!u0)return str;if(!(u0&128)){str+=String.fromCharCode(u0);continue}u1=u8Array[idx++]&63;if((u0&224)==192){str+=String.fromCharCode((u0&31)<<6|u1);continue}u2=u8Array[idx++]&63;if((u0&240)==224){u0=(u0&15)<<12|u1<<6|u2}else{u3=u8Array[idx++]&63;if((u0&248)==240){u0=(u0&7)<<18|u1<<12|u2<<6|u3}else{u4=u8Array[idx++]&63;if((u0&252)==248){u0=(u0&3)<<24|u1<<18|u2<<12|u3<<6|u4}else{u5=u8Array[idx++]&63;u0=(u0&1)<<30|u1<<24|u2<<18|u3<<12|u4<<6|u5}}}if(u0<65536){str+=String.fromCharCode(u0)}else{var ch=u0-65536;str+=String.fromCharCode(55296|ch>>10,56320|ch&1023)}}}function stringToUTF8Array(str,outU8Array,outIdx,maxBytesToWrite){if(!(maxBytesToWrite>0))return 0;var startIdx=outIdx;var endIdx=outIdx+maxBytesToWrite-1;for(var i=0;i=55296&&u<=57343)u=65536+((u&1023)<<10)|str.charCodeAt(++i)&1023;if(u<=127){if(outIdx>=endIdx)break;outU8Array[outIdx++]=u}else if(u<=2047){if(outIdx+1>=endIdx)break;outU8Array[outIdx++]=192|u>>6;outU8Array[outIdx++]=128|u&63}else if(u<=65535){if(outIdx+2>=endIdx)break;outU8Array[outIdx++]=224|u>>12;outU8Array[outIdx++]=128|u>>6&63;outU8Array[outIdx++]=128|u&63}else if(u<=2097151){if(outIdx+3>=endIdx)break;outU8Array[outIdx++]=240|u>>18;outU8Array[outIdx++]=128|u>>12&63;outU8Array[outIdx++]=128|u>>6&63;outU8Array[outIdx++]=128|u&63}else if(u<=67108863){if(outIdx+4>=endIdx)break;outU8Array[outIdx++]=248|u>>24;outU8Array[outIdx++]=128|u>>18&63;outU8Array[outIdx++]=128|u>>12&63;outU8Array[outIdx++]=128|u>>6&63;outU8Array[outIdx++]=128|u&63}else{if(outIdx+5>=endIdx)break;outU8Array[outIdx++]=252|u>>30;outU8Array[outIdx++]=128|u>>24&63;outU8Array[outIdx++]=128|u>>18&63;outU8Array[outIdx++]=128|u>>12&63;outU8Array[outIdx++]=128|u>>6&63;outU8Array[outIdx++]=128|u&63}}outU8Array[outIdx]=0;return outIdx-startIdx}function lengthBytesUTF8(str){var len=0;for(var i=0;i=55296&&u<=57343)u=65536+((u&1023)<<10)|str.charCodeAt(++i)&1023;if(u<=127){++len}else if(u<=2047){len+=2}else if(u<=65535){len+=3}else if(u<=2097151){len+=4}else if(u<=67108863){len+=5}else{len+=6}}return len}function demangle(func){var hasLibcxxabi=!!Module["___cxa_demangle"];if(hasLibcxxabi){try{var buf=_malloc(func.length);writeStringToMemory(func.substr(1),buf);var status=_malloc(4);var ret=Module["___cxa_demangle"](buf,0,0,status);if(getValue(status,"i32")===0&&ret){return Pointer_stringify(ret)}}catch(e){return func}finally{if(buf)_free(buf);if(status)_free(status);if(ret)_free(ret)}}Runtime.warnOnce("warning: build with -s DEMANGLE_SUPPORT=1 to link in libcxxabi demangling");return func}function demangleAll(text){return text.replace(/__Z[\w\d_]+/g,(function(x){var y=demangle(x);return x===y?x:x+" ["+y+"]"}))}function jsStackTrace(){var err=new Error;if(!err.stack){try{throw new Error(0)}catch(e){err=e}if(!err.stack){return"(no stack trace available)"}}return err.stack.toString()}function stackTrace(){return demangleAll(jsStackTrace())}var PAGE_SIZE=4096;function alignMemoryPage(x){if(x%4096>0){x+=4096-x%4096}return x}var HEAP;var buffer;var HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAPF64;function updateGlobalBufferViews(){Module["HEAP8"]=HEAP8=new Int8Array(buffer);Module["HEAP16"]=HEAP16=new Int16Array(buffer);Module["HEAP32"]=HEAP32=new Int32Array(buffer);Module["HEAPU8"]=HEAPU8=new Uint8Array(buffer);Module["HEAPU16"]=HEAPU16=new Uint16Array(buffer);Module["HEAPU32"]=HEAPU32=new Uint32Array(buffer);Module["HEAPF32"]=HEAPF32=new Float32Array(buffer);Module["HEAPF64"]=HEAPF64=new Float64Array(buffer)}var STATIC_BASE=0,STATICTOP=0,staticSealed=false;var STACK_BASE=0,STACKTOP=0,STACK_MAX=0;var DYNAMIC_BASE=0,DYNAMICTOP=0;function abortOnCannotGrowMemory(){abort("Cannot enlarge memory arrays. Either (1) compile with -s TOTAL_MEMORY=X with X higher than the current value "+TOTAL_MEMORY+", (2) compile with -s ALLOW_MEMORY_GROWTH=1 which adjusts the size at runtime but prevents some optimizations, (3) set Module.TOTAL_MEMORY to a higher value before the program runs, or if you want malloc to return NULL (0) instead of this abort, compile with -s ABORTING_MALLOC=0 ")}function enlargeMemory(){abortOnCannotGrowMemory()}var TOTAL_STACK=Module["TOTAL_STACK"]||5242880;var TOTAL_MEMORY=Module["TOTAL_MEMORY"]||16777216;var totalMemory=64*1024;while(totalMemory0){var callback=callbacks.shift();if(typeof callback=="function"){callback();continue}var func=callback.func;if(typeof func==="number"){if(callback.arg===undefined){Runtime.dynCall("v",func)}else{Runtime.dynCall("vi",func,[callback.arg])}}else{func(callback.arg===undefined?null:callback.arg)}}}var __ATPRERUN__=[];var __ATINIT__=[];var __ATMAIN__=[];var __ATEXIT__=[];var __ATPOSTRUN__=[];var runtimeInitialized=false;var runtimeExited=false;function preRun(){if(Module["preRun"]){if(typeof Module["preRun"]=="function")Module["preRun"]=[Module["preRun"]];while(Module["preRun"].length){addOnPreRun(Module["preRun"].shift())}}callRuntimeCallbacks(__ATPRERUN__)}function ensureInitRuntime(){if(runtimeInitialized)return;runtimeInitialized=true;callRuntimeCallbacks(__ATINIT__)}function preMain(){callRuntimeCallbacks(__ATMAIN__)}function exitRuntime(){callRuntimeCallbacks(__ATEXIT__);runtimeExited=true}function postRun(){if(Module["postRun"]){if(typeof Module["postRun"]=="function")Module["postRun"]=[Module["postRun"]];while(Module["postRun"].length){addOnPostRun(Module["postRun"].shift())}}callRuntimeCallbacks(__ATPOSTRUN__)}function addOnPreRun(cb){__ATPRERUN__.unshift(cb)}function addOnPostRun(cb){__ATPOSTRUN__.unshift(cb)}function intArrayFromString(stringy,dontAddNull,length){var len=length>0?length:lengthBytesUTF8(stringy)+1;var u8array=new Array(len);var numBytesWritten=stringToUTF8Array(stringy,u8array,0,u8array.length);if(dontAddNull)u8array.length=numBytesWritten;return u8array}function writeStringToMemory(string,buffer,dontAddNull){var array=intArrayFromString(string,dontAddNull);var i=0;while(i>0]=chr;i=i+1}}function writeArrayToMemory(array,buffer){for(var i=0;i>0]=array[i]}}function writeAsciiToMemory(str,buffer,dontAddNull){for(var i=0;i>0]=str.charCodeAt(i)}if(!dontAddNull)HEAP8[buffer>>0]=0}if(!Math["imul"]||Math["imul"](4294967295,5)!==-5)Math["imul"]=function imul(a,b){var ah=a>>>16;var al=a&65535;var bh=b>>>16;var bl=b&65535;return al*bl+(ah*bl+al*bh<<16)|0};Math.imul=Math["imul"];if(!Math["clz32"])Math["clz32"]=(function(x){x=x>>>0;for(var i=0;i<32;i++){if(x&1<<31-i)return i}return 32});Math.clz32=Math["clz32"];var Math_abs=Math.abs;var Math_cos=Math.cos;var Math_sin=Math.sin;var Math_tan=Math.tan;var Math_acos=Math.acos;var Math_asin=Math.asin;var Math_atan=Math.atan;var Math_atan2=Math.atan2;var Math_exp=Math.exp;var Math_log=Math.log;var Math_sqrt=Math.sqrt;var Math_ceil=Math.ceil;var Math_floor=Math.floor;var Math_pow=Math.pow;var Math_imul=Math.imul;var Math_fround=Math.fround;var Math_min=Math.min;var Math_clz32=Math.clz32;var runDependencies=0;var runDependencyWatcher=null;var dependenciesFulfilled=null;Module["preloadedImages"]={};Module["preloadedAudios"]={};var ASM_CONSTS=[];STATIC_BASE=8;STATICTOP=STATIC_BASE+35488;__ATINIT__.push({func:(function(){__GLOBAL__sub_I_opusscript_encoder_cpp()})},{func:(function(){__GLOBAL__sub_I_bind_cpp()})});allocate([32,90,0,0,152,108,0,0,160,90,0,0,172,108,0,0,0,0,0,0,8,0,0,0,160,90,0,0,193,108,0,0,1,0,0,0,8,0,0,0,188,90,0,0,7,130,0,0,0,0,0,0,1,0,0,0,72,0,0,0,0,0,0,0,32,90,0,0,70,130,0,0,188,90,0,0,120,130,0,0,0,0,0,0,1,0,0,0,72,0,0,0,0,0,0,0,188,90,0,0,216,130,0,0,0,0,0,0,1,0,0,0,72,0,0,0,0,0,0,0,32,90,0,0,36,131,0,0,32,90,0,0,71,131,0,0,32,90,0,0,132,131,0,0,32,90,0,0,200,131,0,0,32,90,0,0,14,132,0,0,32,90,0,0,76,132,0,0,32,90,0,0,147,132,0,0,32,90,0,0,207,132,0,0,32,90,0,0,20,133,0,0,32,90,0,0,81,133,0,0,32,90,0,0,94,134,0,0,32,90,0,0,156,134,0,0,32,90,0,0,219,134,0,0,32,90,0,0,148,135,0,0,72,90,0,0,114,135,0,0,16,1,0,0,0,0,0,0,72,90,0,0,31,135,0,0,240,0,0,0,0,0,0,0,72,90,0,0,68,135,0,0,32,1,0,0,0,0,0,0,32,90,0,0,101,135,0,0,72,90,0,0,161,135,0,0,232,0,0,0,0,0,0,0,72,90,0,0,225,135,0,0,16,1,0,0,0,0,0,0,72,90,0,0,189,135,0,0,56,1,0,0,0,0,0,0,72,90,0,0,3,136,0,0,16,1,0,0,0,0,0,0,132,90,0,0,43,136,0,0,132,90,0,0,45,136,0,0,132,90,0,0,48,136,0,0,132,90,0,0,50,136,0,0,132,90,0,0,52,136,0,0,132,90,0,0,54,136,0,0,132,90,0,0,56,136,0,0,132,90,0,0,58,136,0,0,132,90,0,0,60,136,0,0,132,90,0,0,62,136,0,0,132,90,0,0,64,136,0,0,132,90,0,0,66,136,0,0,132,90,0,0,68,136,0,0,132,90,0,0,70,136,0,0,72,90,0,0,72,136,0,0,240,0,0,0,0,0,0,0,16,0,0,0,168,1,0,0,168,1,0,0,168,1,0,0,168,1,0,0,16,0,0,0,168,1,0,0,168,1,0,0,168,1,0,0,168,1,0,0,168,1,0,0,16,0,0,0,168,1,0,0,168,1,0,0,168,1,0,0,0,0,157,62,0,64,94,62,0,192,4,62,0,128,237,62,0,64,137,62,0,0,0,0,0,192,76,63,0,0,205,61,0,0,0,0,34,109,0,0,42,109,0,0,59,109,0,0,76,109,0,0,91,109,0,0,108,109,0,0,132,109,0,0,146,109,0,0,16,39,0,0,232,3,0,0,248,42,0,0,232,3,0,0,188,52,0,0,232,3,0,0,176,54,0,0,208,7,0,0,224,46,0,0,232,3,0,0,176,54,0,0,232,3,0,0,128,62,0,0,232,3,0,0,32,78,0,0,232,3,0,0,240,85,0,0,232,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,224,46,0,0,16,39,0,0,16,39,0,0,248,42,0,0,248,42,0,0,128,62,0,0,188,52,0,0,188,52,0,0,152,58,0,0,152,58,0,0,32,78,0,0,128,62,0,0,128,62,0,0,80,70,0,0,80,70,0,0,192,93,0,0,80,70,0,0,80,70,0,0,8,82,0,0,8,82,0,0,0,125,0,0,240,85,0,0,240,85,0,0,96,109,0,0,96,109,0,0,0,250,0,0,112,148,0,0,112,148,0,0,80,195,0,0,80,195,0,0,230,90,52,56,119,78,51,57,211,217,201,57,146,145,51,58,204,96,140,58,97,251,201,58,153,126,9,59,203,128,51,59,213,37,99,59,119,46,140,59,168,138,169,59,69,184,201,59,135,166,236,59,232,46,9,60,174,102,29,60,247,2,51,60,147,255,73,60,79,88,98,60,94,17,124,60,46,145,139,60,189,199,153,60,92,172,168,60,243,60,184,60,129,121,200,60,238,95,217,60,57,240,234,60,99,42,253,60,53,7,8,61,16,204,17,61,205,228,27,61,97,80,38,61,203,14,49,61,0,31,60,61,254,128,71,61,198,52,83,61,63,56,95,61,105,139,107,61,69,46,120,61,105,144,130,61,123,48,137,61,224,247,143,61,138,229,150,61,123,249,157,61,177,51,165,61,33,147,172,61,80,24,180,61,51,194,187,61,79,145,195,61,18,132,203,61,2,155,211,61,31,214,219,61,215,51,228,61,175,180,236,61,33,88,245,61,168,29,254,61,161,130,3,62,242,6,8,62,199,155,12,62,221,64,17,62,52,246,21,62,69,187,26,62,17,144,31,62,84,116,36,62,203,103,41,62,51,106,46,62,141,123,51,62,82,155,56,62,197,201,61,62,28,6,67,62,89,80,72,62,122,168,77,62,183,13,83,62,82,128,88,62,8,0,94,62,84,140,99,62,242,36,105,62,37,202,110,62,36,123,116,62,172,55,122,62,0,0,128,62,171,233,130,62,249,216,133,62,133,205,136,62,80,199,139,62,55,198,142,62,247,201,145,62,179,210,148,62,38,224,151,62,15,242,154,62,108,8,158,62,28,35,161,62,255,65,164,62,208,100,167,62,177,139,170,62,28,182,173,62,84,228,176,62,211,21,180,62,186,74,183,62,232,130,186,62,249,189,189,62,13,252,192,62,226,60,196,62,86,128,199,62,71,198,202,62,149,14,206,62,251,88,209,62,122,165,212,62,241,243,215,62,28,68,219,62,217,149,222,62,8,233,225,62,167,61,229,62,83,147,232,62,12,234,235,62,175,65,239,62,28,154,242,62,14,243,245,62,136,76,249,62,34,166,252,62,0,0,0,63,239,172,1,63,188,89,3,63,121,6,5,63,242,178,6,63,41,95,8,63,250,10,10,63,86,182,11,63,44,97,13,63,124,11,15,63,19,181,16,63,242,93,18,63,8,6,20,63,67,173,21,63,130,83,23,63,182,248,24,63,220,156,26,63,213,63,28,63,143,225,29,63,249,129,31,63,4,33,33,63,140,190,34,63,163,90,36,63,23,245,37,63,214,141,39,63,242,36,41,63,40,186,42,63,152,77,44,63,1,223,45,63,114,110,47,63,202,251,48,63,249,134,50,63,237,15,52,63,167,150,53,63,4,27,55,63,229,156,56,63,88,28,58,63,61,153,59,63,131,19,61,63,42,139,62,63,0,0,64,63,21,114,65,63,55,225,66,63,119,77,68,63,195,182,69,63,235,28,71,63,254,127,72,63,236,223,73,63,146,60,75,63,225,149,76,63,234,235,77,63,121,62,79,63,143,141,80,63,43,217,81,63,29,33,83,63,115,101,84,63,13,166,85,63,235,226,86,63,252,27,88,63,47,81,89,63,115,130,90,63,201,175,91,63,14,217,92,63,67,254,93,63,88,31,95,63,75,60,96,63,252,84,97,63,106,105,98,63,133,121,99,63,60,133,100,63,160,140,101,63,126,143,102,63,214,141,103,63,186,135,104,63,246,124,105,63,156,109,106,63,138,89,107,63,209,64,108,63,79,35,109,63,4,1,110,63,241,217,110,63,243,173,111,63,28,125,112,63,73,71,113,63,124,12,114,63,180,204,114,63,240,135,115,63,16,62,116,63,19,239,116,63,250,154,117,63,179,65,118,63,63,227,118,63,141,127,119,63,173,22,120,63,126,168,120,63,1,53,121,63,52,188,121,63,24,62,122,63,157,186,122,63,194,49,123,63,119,163,123,63,187,15,124,63,159,118,124,63,2,216,124,63,244,51,125,63,101,138,125,63,68,219,125,63,179,38,126,63,143,108,126,63,235,172,126,63,163,231,126,63,218,28,127,63,127,76,127,63,129,118,127,63,2,155,127,63,208,185,127,63,28,211,127,63,197,230,127,63,203,244,127,63,47,253,127,63,0,0,128,63,2,0,0,0,4,0,0,0,6,0,0,0,8,0,0,0,10,0,0,0,12,0,0,0,14,0,0,0,16,0,0,0,20,0,0,0,24,0,0,0,28,0,0,0,32,0,0,0,40,0,0,0,48,0,0,0,56,0,0,0,68,0,0,0,80,0,0,0,96,0,0,0,120,0,0,0,1,0,0,0,2,0,0,0,4,0,0,0,6,0,0,0,8,0,0,0,10,0,0,0,12,0,0,0,14,0,0,0,16,0,0,0,20,0,0,0,24,0,0,0,28,0,0,0,32,0,0,0,40,0,0,0,48,0,0,0,56,0,0,0,68,0,0,0,80,0,0,0,96,0,0,0,120,0,0,0,160,0,0,0,200,0,0,0,0,0,128,62,0,0,128,62,0,0,128,62,0,0,128,62,0,0,128,62,0,0,128,62,0,0,128,62,0,0,128,62,0,0,128,62,0,0,128,62,0,0,128,62,0,0,128,62,0,0,128,62,0,0,128,62,0,0,128,62,0,0,128,62,208,37,180,62,151,57,173,62,9,165,159,62,250,237,139,62,205,172,101,62,248,169,42,62,52,48,210,61,90,241,13,61,90,241,13,189,52,48,210,189,248,169,42,190,205,172,101,190,250,237,139,190,9,165,159,190,151,57,173,190,208,37,180,190,135,138,177,62,27,131,150,62,96,35,73,62,196,66,141,61,196,66,141,189,96,35,73,190,27,131,150,190,135,138,177,190,135,138,177,190,27,131,150,190,96,35,73,190,196,66,141,189,196,66,141,61,96,35,73,62,27,131,150,62,135,138,177,62,151,57,173,62,205,172,101,62,90,241,13,61,248,169,42,190,9,165,159,190,208,37,180,190,250,237,139,190,52,48,210,189,52,48,210,61,250,237,139,62,208,37,180,62,9,165,159,62,248,169,42,62,90,241,13,189,205,172,101,190,151,57,173,190,125,61,167,62,210,139,10,62,210,139,10,190,125,61,167,190,125,61,167,190,210,139,10,190,210,139,10,62,125,61,167,62,125,61,167,62,210,139,10,62,210,139,10,190,125,61,167,190,125,61,167,190,210,139,10,190,210,139,10,62,125,61,167,62,9,165,159,62,90,241,13,61,250,237,139,190,151,57,173,190,52,48,210,189,205,172,101,62,208,37,180,62,248,169,42,62,248,169,42,190,208,37,180,190,205,172,101,190,52,48,210,61,151,57,173,62,250,237,139,62,90,241,13,189,9,165,159,190,27,131,150,62,196,66,141,189,135,138,177,190,96,35,73,190,96,35,73,62,135,138,177,62,196,66,141,61,27,131,150,190,27,131,150,190,196,66,141,61,135,138,177,62,96,35,73,62,96,35,73,190,135,138,177,190,196,66,141,189,27,131,150,62,250,237,139,62,248,169,42,190,151,57,173,190,90,241,13,61,208,37,180,62,52,48,210,61,9,165,159,190,205,172,101,190,205,172,101,62,9,165,159,62,52,48,210,189,208,37,180,190,90,241,13,189,151,57,173,62,248,169,42,62,250,237,139,190,22,235,181,64,30,107,94,64,35,164,226,63,185,197,204,63,91,124,113,64,184,115,10,64,116,96,161,63,136,245,142,63,19,155,245,63,0,0,0,0,5,193,35,61,233,125,163,61,37,150,244,61,226,116,34,62,172,28,74,62,221,37,113,62,52,186,139,62,180,119,158,62,228,191,176,62,173,136,194,62,37,201,211,62,24,122,228,62,24,149,244,62,200,10,2,63,28,124,9,63,73,157,16,63,202,109,23,63,192,237,29,63,159,29,36,63,84,254,41,63,46,145,47,63,224,215,52,63,99,212,57,63,240,136,62,63,211,247,66,63,171,35,71,63,23,15,75,63,216,188,78,63,173,47,82,63,106,106,85,63,206,111,88,63,154,66,91,63,142,229,93,63,75,91,96,63,110,166,98,63,100,201,100,63,155,198,102,63,111,160,104,63,247,88,106,63,128,242,107,63,223,110,109,63,11,208,110,63,202,23,112,63,224,71,113,63,225,97,114,63,77,103,115,63,150,89,116,63,12,58,117,63,255,9,118,63,138,202,118,63,187,124,119,63,192,33,120,63,98,186,120,63,157,71,121,63,75,202,121,63,36,67,122,63,242,178,122,63,59,26,123,63,200,121,123,63,32,210,123,63,200,35,124,63,55,111,124,63,242,180,124,63,94,245,124,63,224,48,125,63,236,103,125,63,183,154,125,63,180,201,125,63,6,245,125,63,17,29,126,63,24,66,126,63,78,100,126,63,211,131,126,63,253,160,126,63,237,187,126,63,195,212,126,63,179,235,126,63,239,0,127,63,135,20,127,63,141,38,127,63,67,55,127,63,170,70,127,63,227,84,127,63,15,98,127,63,47,110,127,63,100,121,127,63,190,131,127,63,63,141,127,63,24,150,127,63,56,158,127,63,194,165,127,63,163,172,127,63,16,179,127,63,245,184,127,63,119,190,127,63,114,195,127,63,25,200,127,63,108,204,127,63,91,208,127,63,6,212,127,63,111,215,127,63,131,218,127,63,102,221,127,63,21,224,127,63,130,226,127,63,205,228,127,63,230,230,127,63,205,232,127,63,146,234,127,63,70,236,127,63,200,237,127,63,40,239,127,63,120,240,127,63,166,241,127,63,195,242,127,63,191,243,127,63,186,244,127,63,148,245,127,63,94,246,127,63,39,247,127,63,207,247,127,63,119,248,127,63,253,248,127,63,148,249,127,63,9,250,127,63,127,250,127,63,244,250,127,63,89,251,127,63,173,251,127,63,1,252,127,63,84,252,127,63,152,252,127,63,219,252,127,63,30,253,127,63,80,253,127,63,130,253,127,63,181,253,127,63,231,253,127,63,9,254,127,63,59,254,127,63,93,254,127,63,126,254,127,63,143,254,127,63,176,254,127,63,210,254,127,63,227,254,127,63,244,254,127,63,21,255,127,63,38,255,127,63,55,255,127,63,71,255,127,63,88,255,127,63,88,255,127,63,105,255,127,63,122,255,127,63,122,255,127,63,139,255,127,63,155,255,127,63,155,255,127,63,155,255,127,63,172,255,127,63,172,255,127,63,189,255,127,63,189,255,127,63,189,255,127,63,206,255,127,63,206,255,127,63,206,255,127,63,206,255,127,63,206,255,127,63,222,255,127,63,222,255,127,63,222,255,127,63,222,255,127,63,222,255,127,63,222,255,127,63,239,255,127,63,239,255,127,63,239,255,127,63,239,255,127,63,239,255,127,63,239,255,127,63,239,255,127,63,239,255,127,63,239,255,127,63,239,255,127,63,239,255,127,63,239,255,127,63,239,255,127,63,0,0,128,63,0,0,128,63,0,0,128,63,0,0,128,63,0,0,128,63,0,0,128,63,0,0,128,63,0,0,128,63,0,0,128,63,0,0,128,63,0,0,128,63,92,201,154,191,92,181,225,188,29,102,249,60,41,7,147,189,76,199,183,189,254,214,206,61,107,200,73,189,213,203,143,61,162,63,153,60,131,208,139,59,7,3,132,61,170,154,224,189,251,30,245,189,156,141,17,188,11,14,47,62,98,192,50,62,25,231,135,190,14,59,130,189,104,203,145,190,133,66,136,191,57,185,79,62,205,228,19,64,254,212,48,192,107,127,215,190,71,229,50,63,144,218,206,64,190,165,135,61,26,70,155,61,241,153,81,61,23,176,46,61,228,249,236,61,194,18,135,190,137,197,57,188,107,74,66,190,44,114,190,189,15,94,147,190,234,136,189,61,164,240,234,60,161,171,163,188,103,180,69,190,98,101,132,62,179,149,151,60,242,210,237,61,140,77,203,61,221,29,0,188,97,51,136,190,116,69,145,62,227,199,40,65,110,133,40,191,198,53,86,63,106,222,81,65,36,209,160,192,56,103,140,191,137,42,151,189,64,184,167,60,103,126,53,60,37,104,2,187,152,220,139,59,239,146,24,62,41,174,154,61,238,207,229,61,197,96,84,189,236,162,232,60,105,97,197,60,53,77,78,189,26,24,25,190,227,199,8,190,182,159,12,190,150,33,238,61,117,202,115,62,250,97,164,61,125,168,30,61,218,27,188,61,180,142,129,64,129,149,79,64,2,43,55,191,225,93,2,65,218,44,239,193,246,40,148,63,255,147,255,189,102,233,185,60,124,187,64,189,90,0,9,189,207,206,19,61,20,106,55,61,121,110,41,187,165,84,157,188,137,151,231,189,90,72,224,61,75,81,51,189,51,156,28,61,194,238,34,188,128,99,31,190,82,12,48,62,141,123,99,190,91,8,6,191,166,34,58,189,54,144,14,191,23,244,66,63,23,217,44,192,69,13,98,191,113,29,99,63,107,15,63,63,168,25,186,190,127,137,184,62,66,91,14,61,15,97,124,188,56,153,225,59,58,135,27,188,169,33,128,61,86,182,79,189,178,164,23,61,110,10,117,60,67,86,119,61,71,94,145,189,118,138,21,189,47,196,202,61,104,185,34,189,150,10,146,62,113,231,2,62,77,45,27,190,59,29,136,62,111,117,170,189,14,67,85,61,140,214,101,63,202,224,224,62,144,131,64,192,163,1,248,63,103,68,209,190,54,172,153,62,227,194,181,191,69,74,243,61,178,70,61,189,146,230,79,61,22,83,196,188,77,235,128,189,165,98,8,188,160,53,223,189,183,222,5,189,46,143,213,61,96,168,136,189,8,242,66,61,75,175,141,61,63,127,107,189,121,33,13,190,10,242,83,190,129,236,37,190,88,114,85,190,45,39,17,62,57,41,148,190,154,153,73,191,163,146,186,61,240,50,51,62,10,46,2,192,198,80,68,64,133,124,156,63,95,210,6,64,48,139,159,61,171,63,98,190,60,106,12,62,216,26,128,189,100,118,150,189,195,14,51,62,84,195,14,190,131,32,198,61,103,30,170,61,167,7,101,190,13,250,210,61,147,139,209,189,146,6,103,62,123,20,30,62,83,93,64,62,22,226,15,188,77,188,3,62,60,50,190,190,86,68,245,190,73,76,32,62,106,48,141,63,196,124,161,191,19,13,178,61,28,181,18,190,57,185,11,64,18,218,56,192,38,27,207,61,119,219,157,190,203,101,99,62,140,44,105,190,51,31,12,188,188,93,47,60,26,189,253,59,149,207,151,188,8,181,250,60,252,55,111,190,62,86,165,61,13,54,245,188,175,150,27,62,31,19,137,190,22,143,70,61,87,93,7,62,150,148,107,190,235,59,183,62,168,114,154,61,167,149,226,61,103,155,163,191,174,216,83,64,156,192,84,63,188,118,89,190,203,161,165,193,252,24,147,191,62,46,0,61,22,207,170,188,109,194,3,188,13,228,52,60,76,23,226,60,94,191,253,58,3,71,93,188,3,132,201,187,99,6,79,61,150,27,49,188,190,138,88,58,58,177,199,188,119,103,165,190,169,211,139,61,238,8,15,191,175,7,211,189,41,34,51,62,108,152,1,190,136,13,214,189,43,79,216,62,52,234,139,189,171,91,185,191,106,189,51,63,173,78,54,63,236,24,215,190,201,60,38,64,232,221,243,188,27,145,57,189,185,75,7,189,85,29,13,189,165,90,213,188,35,17,122,189,144,195,187,61,245,244,209,60,72,108,215,189,184,241,157,61,150,18,184,189,131,161,62,190,154,92,164,190,4,27,103,190,120,11,52,62,56,129,129,62,107,40,61,63,2,212,26,64,153,129,234,61,4,200,160,190,198,164,27,63,129,178,221,63,87,38,6,192,164,253,27,191,240,80,152,63,51,53,233,61,233,239,53,190,169,237,160,189,98,49,178,190,76,105,194,189,155,132,156,188,254,240,171,62,96,4,109,189,194,104,6,62,43,18,243,189,64,75,7,190,254,95,117,190,119,167,65,58,2,102,62,190,146,232,5,190,239,116,223,190,94,16,17,190,187,191,16,61,20,198,91,189,132,137,197,189,111,45,99,62,109,168,248,63,76,137,228,191,91,211,116,64,35,190,111,64,182,185,23,64,227,170,182,191,215,183,61,61,62,230,104,189,170,229,88,61,29,114,211,189,226,147,174,190,198,194,208,61,79,145,79,191,195,98,52,62,3,119,240,62,144,222,203,60,19,213,219,189,99,71,19,190,169,61,59,189,229,122,71,63,75,144,17,190,9,129,33,61,106,161,36,62,200,38,53,191,91,181,27,191,126,24,137,63,124,155,162,191,249,189,17,64,54,205,203,64,10,20,5,63,165,73,85,192,70,122,1,190,179,80,193,189,15,198,217,60,14,62,126,61,52,147,57,60,169,249,130,190,29,176,150,189,125,219,130,189,206,112,195,189,88,226,81,190,21,24,149,59,62,81,99,61,5,105,38,190,235,230,18,191,183,124,132,62,140,185,75,62,61,164,179,60,75,230,192,190,43,50,2,191,22,24,157,189,25,142,39,191,248,165,143,64,103,237,88,64,227,25,22,192,193,57,49,193,167,116,139,64,15,127,213,63,227,129,82,189,253,114,140,189,204,192,55,188,190,157,243,57,254,123,112,190,116,92,173,190,227,167,17,190,212,126,43,190,24,177,15,190,150,176,214,189,48,100,213,189,144,204,52,60,123,190,230,189,57,165,178,61,42,224,46,190,69,155,179,189,224,157,252,61,43,133,32,190,158,208,75,62,116,208,101,189,126,54,102,63,242,249,167,61,143,194,165,191,164,231,241,60,55,166,17,64,235,228,112,191,169,2,36,188,156,111,228,189,154,93,7,190,171,9,226,189,126,29,24,61,207,152,147,188,19,0,45,188,234,106,161,60,33,229,39,61,192,163,92,189,78,155,209,189,224,208,64,189,139,78,54,62,105,25,137,190,231,167,216,189,95,207,215,189,194,73,127,61,52,190,47,189,194,195,52,62,247,234,35,190,168,58,18,192,101,141,246,191,116,98,95,62,180,188,26,65,146,116,83,64,160,55,225,191,122,200,4,62,228,73,242,61,246,36,16,62,235,223,138,61,12,62,77,59,137,205,108,188,56,33,254,188,96,209,200,188,25,60,12,62,132,189,25,62,45,11,230,61,121,161,154,189,35,221,143,190,130,83,127,190,19,129,46,191,240,31,1,61,12,6,151,62,139,187,38,61,202,197,144,62,4,57,176,190,69,129,234,192,30,81,97,190,142,119,15,191,191,154,239,191,3,62,227,192,179,210,8,65,196,66,5,64,192,93,118,62,189,24,162,63,174,156,253,60,179,152,140,191,122,142,92,63,186,189,196,191,106,106,137,63,198,138,140,64,99,180,38,192,82,12,192,62,126,200,251,61,169,231,85,59,40,244,70,63,137,7,2,192,108,206,113,191,82,242,128,64,216,127,133,190,63,111,14,63,148,220,97,190,2,183,226,191,40,212,91,191,230,150,194,191,215,190,72,191,25,32,177,62,201,21,72,189,50,146,165,190,160,168,64,191,202,112,4,63,170,96,96,63,69,100,184,191,174,185,195,190,108,236,198,191,0,0,128,63,0,0,0,64,0,0,64,64,0,0,128,64,0,0,160,64,0,0,192,64,0,0,224,64,0,0,0,65,0,0,128,65,0,0,192,65,0,0,16,66,0,0,48,66,0,0,72,66,0,0,96,66,0,0,120,66,0,0,134,66,0,0,144,66,0,0,158,66,0,0,176,66,0,0,212,66,0,0,6,67,0,0,128,63,0,0,128,63,0,0,128,63,0,0,128,63,0,0,128,63,0,0,128,63,0,0,128,63,0,0,0,64,0,0,0,64,0,0,0,64,0,0,0,64,0,0,0,64,0,0,0,64,0,0,0,64,0,0,64,64,0,0,64,64,0,0,128,64,0,0,160,64,0,0,192,64,0,0,0,65,0,0,0,65,149,139,0,0,55,152,0,0,255,165,0,0,4,181,0,0,103,197,0,0,69,215,0,0,193,234,0,0,255,255,0,0,128,187,0,0,120,0,0,0,21,0,0,0,21,0,0,0,0,154,89,63,0,0,0,0,0,0,128,63,0,0,128,63,220,90,0,0,3,0,0,0,8,0,0,0,120,0,0,0,11,0,0,0,58,110,0,0,8,91,0,0,36,21,0,0,128,7,0,0,3,0,0,0,4,23,0,0,60,38,0,0,116,38,0,0,172,38,0,0,228,38,0,0,136,1,0,0,58,98,0,0,33,111,0,0,169,112,0,0,106,28,141,56,82,187,30,58,8,105,220,58,130,237,87,59,137,99,178,59,3,42,5,60,48,220,57,60,180,62,119,60,28,163,158,60,209,242,197,60,254,134,241,60,155,171,16,61,5,173,42,61,132,194,70,61,83,230,100,61,17,137,130,61,135,159,147,61,203,178,165,61,209,190,184,61,58,191,204,61,84,175,225,61,20,138,247,61,14,37,7,62,217,244,18,62,95,49,31,62,104,215,43,62,138,227,56,62,48,82,70,62,148,31,84,62,191,71,98,62,142,198,112,62,176,151,127,62,82,91,135,62,96,15,143,62,152,229,150,62,121,219,158,62,112,238,166,62,216,27,175,62,251,96,183,62,17,187,191,62,70,39,200,62,183,162,208,62,120,42,217,62,148,187,225,62,12,83,234,62,222,237,242,62,6,137,251,62,190,16,2,63,31,90,6,63,36,159,10,63,80,222,14,63,43,22,19,63,65,69,23,63,37,106,27,63,115,131,31,63,206,143,35,63,230,141,39,63,116,124,43,63,63,90,47,63,25,38,51,63,231,222,54,63,153,131,58,63,51,19,62,63,197,140,65,63,119,239,68,63,127,58,72,63,39,109,75,63,206,134,78,63,229,134,81,63,241,108,84,63,142,56,87,63,105,233,89,63,69,127,92,63,250,249,94,63,115,89,97,63,175,157,99,63,193,198,101,63,207,212,103,63,17,200,105,63,210,160,107,63,110,95,109,63,80,4,111,63,244,143,112,63,230,2,114,63,189,93,115,63,31,161,116,63,191,205,117,63,87,228,118,63,176,229,119,63,151,210,120,63,227,171,121,63,115,114,122,63,39,39,123,63,231,202,123,63,157,94,124,63,53,227,124,63,156,89,125,63,189,194,125,63,134,31,126,63,222,112,126,63,171,183,126,63,207,244,126,63,38,41,127,63,134,85,127,63,190,122,127,63,150,153,127,63,204,178,127,63,20,199,127,63,28,215,127,63,130,227,127,63,221,236,127,63,182,243,127,63,138,248,127,63,200,251,127,63,214,253,127,63,7,255,127,63,165,255,127,63,232,255,127,63,253,255,127,63,0,0,128,63,224,1,0,0,135,136,8,59,255,255,255,255,5,0,96,0,3,0,32,0,4,0,8,0,2,0,4,0,4,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,50,91,0,0,60,23,0,0,0,0,0,0,0,0,128,63,0,0,0,128,99,250,127,63,191,117,86,188,139,233,127,63,10,113,214,188,121,205,127,63,231,206,32,189,47,166,127,63,58,94,86,189,175,115,127,63,19,242,133,189,249,53,127,63,42,175,160,189,18,237,126,63,51,101,187,189,253,152,126,63,4,19,214,189,188,57,126,63,115,183,240,189,85,207,125,63,168,168,5,190,203,89,125,63,187,239,18,190,37,217,124,63,92,48,32,190,103,77,124,63,245,105,45,190,152,182,123,63,243,155,58,190,190,20,123,63,194,197,71,190,226,103,122,63,205,230,84,190,9,176,121,63,130,254,97,190,60,237,120,63,77,12,111,190,132,31,120,63,156,15,124,190,234,70,119,63,238,131,132,190,119,99,118,63,62,250,138,190,54,117,117,63,117,106,145,190,48,124,116,63,76,212,151,190,113,120,115,63,122,55,158,190,3,106,114,63,183,147,164,190,244,80,113,63,188,232,170,190,79,45,112,63,65,54,177,190,33,255,110,63,1,124,183,190,118,198,109,63,180,185,189,190,94,131,108,63,21,239,195,190,231,53,107,63,222,27,202,190,30,222,105,63,201,63,208,190,18,124,104,63,146,90,214,190,212,15,103,63,243,107,220,190,116,153,101,63,170,115,226,190,1,25,100,63,113,113,232,190,141,142,98,63,7,101,238,190,40,250,96,63,39,78,244,190,230,91,95,63,144,44,250,190,215,179,93,63,0,0,0,191,15,2,92,63,27,228,2,191,160,70,90,63,119,194,5,191,158,129,88,63,246,154,8,191,29,179,86,63,119,109,11,191,49,219,84,63,218,57,14,191,239,249,82,63,0,0,17,191,108,15,81,63,202,191,19,191,189,27,79,63,24,121,22,191,248,30,77,63,205,43,25,191,52,25,75,63,202,215,27,191,136,10,73,63,241,124,30,191,10,243,70,63,36,27,33,191,209,210,68,63,70,178,35,191,247,169,66,63,58,66,38,191,147,120,64,63,227,202,40,191,189,62,62,63,37,76,43,191,143,252,59,63,227,197,45,191,34,178,57,63,1,56,48,191,144,95,55,63,101,162,50,191,243,4,53,63,243,4,53,191,101,162,50,63,144,95,55,191,1,56,48,63,34,178,57,191,227,197,45,63,143,252,59,191,37,76,43,63,189,62,62,191,227,202,40,63,147,120,64,191,58,66,38,63,247,169,66,191,70,178,35,63,209,210,68,191,36,27,33,63,10,243,70,191,241,124,30,63,136,10,73,191,202,215,27,63,52,25,75,191,205,43,25,63,248,30,77,191,24,121,22,63,189,27,79,191,202,191,19,63,108,15,81,191,0,0,17,63,239,249,82,191,218,57,14,63,49,219,84,191,119,109,11,63,29,179,86,191,246,154,8,63,158,129,88,191,119,194,5,63,160,70,90,191,27,228,2,63,15,2,92,191,0,0,0,63,215,179,93,191,144,44,250,62,230,91,95,191,39,78,244,62,40,250,96,191,7,101,238,62,141,142,98,191,113,113,232,62,1,25,100,191,170,115,226,62,116,153,101,191,243,107,220,62,212,15,103,191,146,90,214,62,18,124,104,191,201,63,208,62,30,222,105,191,222,27,202,62,231,53,107,191,21,239,195,62,94,131,108,191,180,185,189,62,118,198,109,191,1,124,183,62,33,255,110,191,65,54,177,62,79,45,112,191,188,232,170,62,244,80,113,191,183,147,164,62,3,106,114,191,122,55,158,62,113,120,115,191,76,212,151,62,48,124,116,191,117,106,145,62,54,117,117,191,62,250,138,62,119,99,118,191,238,131,132,62,234,70,119,191,156,15,124,62,132,31,120,191,77,12,111,62,60,237,120,191,130,254,97,62,9,176,121,191,205,230,84,62,226,103,122,191,194,197,71,62,190,20,123,191,243,155,58,62,152,182,123,191,245,105,45,62,103,77,124,191,92,48,32,62,37,217,124,191,187,239,18,62,203,89,125,191,168,168,5,62,85,207,125,191,115,183,240,61,188,57,126,191,4,19,214,61,253,152,126,191,51,101,187,61,18,237,126,191,42,175,160,61,249,53,127,191,19,242,133,61,175,115,127,191,58,94,86,61,47,166,127,191,231,206,32,61,121,205,127,191,10,113,214,60,139,233,127,191,191,117,86,60,99,250,127,191,0,48,141,36,0,0,128,191,191,117,86,188,99,250,127,191,10,113,214,188,139,233,127,191,231,206,32,189,121,205,127,191,58,94,86,189,47,166,127,191,19,242,133,189,175,115,127,191,42,175,160,189,249,53,127,191,51,101,187,189,18,237,126,191,4,19,214,189,253,152,126,191,115,183,240,189,188,57,126,191,168,168,5,190,85,207,125,191,187,239,18,190,203,89,125,191,92,48,32,190,37,217,124,191,245,105,45,190,103,77,124,191,243,155,58,190,152,182,123,191,194,197,71,190,190,20,123,191,205,230,84,190,226,103,122,191,130,254,97,190,9,176,121,191,77,12,111,190,60,237,120,191,156,15,124,190,132,31,120,191,238,131,132,190,234,70,119,191,62,250,138,190,119,99,118,191,117,106,145,190,54,117,117,191,76,212,151,190,48,124,116,191,122,55,158,190,113,120,115,191,183,147,164,190,3,106,114,191,188,232,170,190,244,80,113,191,65,54,177,190,79,45,112,191,1,124,183,190,33,255,110,191,180,185,189,190,118,198,109,191,21,239,195,190,94,131,108,191,222,27,202,190,231,53,107,191,201,63,208,190,30,222,105,191,146,90,214,190,18,124,104,191,243,107,220,190,212,15,103,191,170,115,226,190,116,153,101,191,113,113,232,190,1,25,100,191,7,101,238,190,141,142,98,191,39,78,244,190,40,250,96,191,144,44,250,190,230,91,95,191,0,0,0,191,215,179,93,191,27,228,2,191,15,2,92,191,119,194,5,191,160,70,90,191,246,154,8,191,158,129,88,191,119,109,11,191,29,179,86,191,218,57,14,191,49,219,84,191,0,0,17,191,239,249,82,191,202,191,19,191,108,15,81,191,24,121,22,191,189,27,79,191,205,43,25,191,248,30,77,191,202,215,27,191,52,25,75,191,241,124,30,191,136,10,73,191,36,27,33,191,10,243,70,191,70,178,35,191,209,210,68,191,58,66,38,191,247,169,66,191,227,202,40,191,147,120,64,191,37,76,43,191,189,62,62,191,227,197,45,191,143,252,59,191,1,56,48,191,34,178,57,191,101,162,50,191,144,95,55,191,243,4,53,191,243,4,53,191,144,95,55,191,101,162,50,191,34,178,57,191,1,56,48,191,143,252,59,191,227,197,45,191,189,62,62,191,37,76,43,191,147,120,64,191,227,202,40,191,247,169,66,191,58,66,38,191,209,210,68,191,70,178,35,191,10,243,70,191,36,27,33,191,136,10,73,191,241,124,30,191,52,25,75,191,202,215,27,191,248,30,77,191,205,43,25,191,189,27,79,191,24,121,22,191,108,15,81,191,202,191,19,191,239,249,82,191,0,0,17,191,49,219,84,191,218,57,14,191,29,179,86,191,119,109,11,191,158,129,88,191,246,154,8,191,160,70,90,191,119,194,5,191,15,2,92,191,27,228,2,191,215,179,93,191,0,0,0,191,230,91,95,191,144,44,250,190,40,250,96,191,39,78,244,190,141,142,98,191,7,101,238,190,1,25,100,191,113,113,232,190,116,153,101,191,170,115,226,190,212,15,103,191,243,107,220,190,18,124,104,191,146,90,214,190,30,222,105,191,201,63,208,190,231,53,107,191,222,27,202,190,94,131,108,191,21,239,195,190,118,198,109,191,180,185,189,190,33,255,110,191,1,124,183,190,79,45,112,191,65,54,177,190,244,80,113,191,188,232,170,190,3,106,114,191,183,147,164,190,113,120,115,191,122,55,158,190,48,124,116,191,76,212,151,190,54,117,117,191,117,106,145,190,119,99,118,191,62,250,138,190,234,70,119,191,238,131,132,190,132,31,120,191,156,15,124,190,60,237,120,191,77,12,111,190,9,176,121,191,130,254,97,190,226,103,122,191,205,230,84,190,190,20,123,191,194,197,71,190,152,182,123,191,243,155,58,190,103,77,124,191,245,105,45,190,37,217,124,191,92,48,32,190,203,89,125,191,187,239,18,190,85,207,125,191,168,168,5,190,188,57,126,191,115,183,240,189,253,152,126,191,4,19,214,189,18,237,126,191,51,101,187,189,249,53,127,191,42,175,160,189,175,115,127,191,19,242,133,189,47,166,127,191,58,94,86,189,121,205,127,191,231,206,32,189,139,233,127,191,10,113,214,188,99,250,127,191,191,117,86,188,0,0,128,191,0,48,13,165,99,250,127,191,191,117,86,60,139,233,127,191,10,113,214,60,121,205,127,191,231,206,32,61,47,166,127,191,58,94,86,61,175,115,127,191,19,242,133,61,249,53,127,191,42,175,160,61,18,237,126,191,51,101,187,61,253,152,126,191,4,19,214,61,188,57,126,191,115,183,240,61,85,207,125,191,168,168,5,62,203,89,125,191,187,239,18,62,37,217,124,191,92,48,32,62,103,77,124,191,245,105,45,62,152,182,123,191,243,155,58,62,190,20,123,191,194,197,71,62,226,103,122,191,205,230,84,62,9,176,121,191,130,254,97,62,60,237,120,191,77,12,111,62,132,31,120,191,156,15,124,62,234,70,119,191,238,131,132,62,119,99,118,191,62,250,138,62,54,117,117,191,117,106,145,62,48,124,116,191,76,212,151,62,113,120,115,191,122,55,158,62,3,106,114,191,183,147,164,62,244,80,113,191,188,232,170,62,79,45,112,191,65,54,177,62,33,255,110,191,1,124,183,62,118,198,109,191,180,185,189,62,94,131,108,191,21,239,195,62,231,53,107,191,222,27,202,62,30,222,105,191,201,63,208,62,18,124,104,191,146,90,214,62,212,15,103,191,243,107,220,62,116,153,101,191,170,115,226,62,1,25,100,191,113,113,232,62,141,142,98,191,7,101,238,62,40,250,96,191,39,78,244,62,230,91,95,191,144,44,250,62,215,179,93,191,0,0,0,63,15,2,92,191,27,228,2,63,160,70,90,191,119,194,5,63,158,129,88,191,246,154,8,63,29,179,86,191,119,109,11,63,49,219,84,191,218,57,14,63,239,249,82,191,0,0,17,63,108,15,81,191,202,191,19,63,189,27,79,191,24,121,22,63,248,30,77,191,205,43,25,63,52,25,75,191,202,215,27,63,136,10,73,191,241,124,30,63,10,243,70,191,36,27,33,63,209,210,68,191,70,178,35,63,247,169,66,191,58,66,38,63,147,120,64,191,227,202,40,63,189,62,62,191,37,76,43,63,143,252,59,191,227,197,45,63,34,178,57,191,1,56,48,63,144,95,55,191,101,162,50,63,243,4,53,191,243,4,53,63,101,162,50,191,144,95,55,63,1,56,48,191,34,178,57,63,227,197,45,191,143,252,59,63,37,76,43,191,189,62,62,63,227,202,40,191,147,120,64,63,58,66,38,191,247,169,66,63,70,178,35,191,209,210,68,63,36,27,33,191,10,243,70,63,241,124,30,191,136,10,73,63,202,215,27,191,52,25,75,63,205,43,25,191,248,30,77,63,24,121,22,191,189,27,79,63,202,191,19,191,108,15,81,63,0,0,17,191,239,249,82,63,218,57,14,191,49,219,84,63,119,109,11,191,29,179,86,63,246,154,8,191,158,129,88,63,119,194,5,191,160,70,90,63,27,228,2,191,15,2,92,63,0,0,0,191,215,179,93,63,144,44,250,190,230,91,95,63,39,78,244,190,40,250,96,63,7,101,238,190,141,142,98,63,113,113,232,190,1,25,100,63,170,115,226,190,116,153,101,63,243,107,220,190,212,15,103,63,146,90,214,190,18,124,104,63,201,63,208,190,30,222,105,63,222,27,202,190,231,53,107,63,21,239,195,190,94,131,108,63,180,185,189,190,118,198,109,63,1,124,183,190,33,255,110,63,65,54,177,190,79,45,112,63,188,232,170,190,244,80,113,63,183,147,164,190,3,106,114,63,122,55,158,190,113,120,115,63,76,212,151,190,48,124,116,63,117,106,145,190,54,117,117,63,62,250,138,190,119,99,118,63,238,131,132,190,234,70,119,63,156,15,124,190,132,31,120,63,77,12,111,190,60,237,120,63,130,254,97,190,9,176,121,63,205,230,84,190,226,103,122,63,194,197,71,190,190,20,123,63,243,155,58,190,152,182,123,63,245,105,45,190,103,77,124,63,92,48,32,190,37,217,124,63,187,239,18,190,203,89,125,63,168,168,5,190,85,207,125,63,115,183,240,189,188,57,126,63,4,19,214,189,253,152,126,63,51,101,187,189,18,237,126,63,42,175,160,189,249,53,127,63,19,242,133,189,175,115,127,63,58,94,86,189,47,166,127,63,231,206,32,189,121,205,127,63,10,113,214,188,139,233,127,63,191,117,86,188,99,250,127,63,0,200,83,165,0,0,128,63,191,117,86,60,99,250,127,63,10,113,214,60,139,233,127,63,231,206,32,61,121,205,127,63,58,94,86,61,47,166,127,63,19,242,133,61,175,115,127,63,42,175,160,61,249,53,127,63,51,101,187,61,18,237,126,63,4,19,214,61,253,152,126,63,115,183,240,61,188,57,126,63,168,168,5,62,85,207,125,63,187,239,18,62,203,89,125,63,92,48,32,62,37,217,124,63,245,105,45,62,103,77,124,63,243,155,58,62,152,182,123,63,194,197,71,62,190,20,123,63,205,230,84,62,226,103,122,63,130,254,97,62,9,176,121,63,77,12,111,62,60,237,120,63,156,15,124,62,132,31,120,63,238,131,132,62,234,70,119,63,62,250,138,62,119,99,118,63,117,106,145,62,54,117,117,63,76,212,151,62,48,124,116,63,122,55,158,62,113,120,115,63,183,147,164,62,3,106,114,63,188,232,170,62,244,80,113,63,65,54,177,62,79,45,112,63,1,124,183,62,33,255,110,63,180,185,189,62,118,198,109,63,21,239,195,62,94,131,108,63,222,27,202,62,231,53,107,63,201,63,208,62,30,222,105,63,146,90,214,62,18,124,104,63,243,107,220,62,212,15,103,63,170,115,226,62,116,153,101,63,113,113,232,62,1,25,100,63,7,101,238,62,141,142,98,63,39,78,244,62,40,250,96,63,144,44,250,62,230,91,95,63,0,0,0,63,215,179,93,63,27,228,2,63,15,2,92,63,119,194,5,63,160,70,90,63,246,154,8,63,158,129,88,63,119,109,11,63,29,179,86,63,218,57,14,63,49,219,84,63,0,0,17,63,239,249,82,63,202,191,19,63,108,15,81,63,24,121,22,63,189,27,79,63,205,43,25,63,248,30,77,63,202,215,27,63,52,25,75,63,241,124,30,63,136,10,73,63,36,27,33,63,10,243,70,63,70,178,35,63,209,210,68,63,58,66,38,63,247,169,66,63,227,202,40,63,147,120,64,63,37,76,43,63,189,62,62,63,227,197,45,63,143,252,59,63,1,56,48,63,34,178,57,63,101,162,50,63,144,95,55,63,243,4,53,63,243,4,53,63,144,95,55,63,101,162,50,63,34,178,57,63,1,56,48,63,143,252,59,63,227,197,45,63,189,62,62,63,37,76,43,63,147,120,64,63,227,202,40,63,247,169,66,63,58,66,38,63,209,210,68,63,70,178,35,63,10,243,70,63,36,27,33,63,136,10,73,63,241,124,30,63,52,25,75,63,202,215,27,63,248,30,77,63,205,43,25,63,189,27,79,63,24,121,22,63,108,15,81,63,202,191,19,63,239,249,82,63,0,0,17,63,49,219,84,63,218,57,14,63,29,179,86,63,119,109,11,63,158,129,88,63,246,154,8,63,160,70,90,63,119,194,5,63,15,2,92,63,27,228,2,63,215,179,93,63,0,0,0,63,230,91,95,63,144,44,250,62,40,250,96,63,39,78,244,62,141,142,98,63,7,101,238,62,1,25,100,63,113,113,232,62,116,153,101,63,170,115,226,62,212,15,103,63,243,107,220,62,18,124,104,63,146,90,214,62,30,222,105,63,201,63,208,62,231,53,107,63,222,27,202,62,94,131,108,63,21,239,195,62,118,198,109,63,180,185,189,62,33,255,110,63,1,124,183,62,79,45,112,63,65,54,177,62,244,80,113,63,188,232,170,62,3,106,114,63,183,147,164,62,113,120,115,63,122,55,158,62,48,124,116,63,76,212,151,62,54,117,117,63,117,106,145,62,119,99,118,63,62,250,138,62,234,70,119,63,238,131,132,62,132,31,120,63,156,15,124,62,60,237,120,63,77,12,111,62,9,176,121,63,130,254,97,62,226,103,122,63,205,230,84,62,190,20,123,63,194,197,71,62,152,182,123,63,243,155,58,62,103,77,124,63,245,105,45,62,37,217,124,63,92,48,32,62,203,89,125,63,187,239,18,62,85,207,125,63,168,168,5,62,188,57,126,63,115,183,240,61,253,152,126,63,4,19,214,61,18,237,126,63,51,101,187,61,249,53,127,63,42,175,160,61,175,115,127,63,19,242,133,61,47,166,127,63,58,94,86,61,121,205,127,63,231,206,32,61,139,233,127,63,10,113,214,60,99,250,127,63,191,117,86,60,240,0,0,0,137,136,136,59,1,0,0,0,5,0,48,0,3,0,16,0,4,0,4,0,4,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,242,94,0,0,60,23,0,0,0,0,0,0,120,0,0,0,136,136,8,60,2,0,0,0,5,0,24,0,3,0,8,0,2,0,4,0,4,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,210,96,0,0,60,23,0,0,0,0,0,0,60,0,0,0,137,136,136,60,3,0,0,0,5,0,12,0,3,0,4,0,4,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,194,97,0,0,60,23,0,0,0,0,0,0,255,255,127,63,142,255,127,63,106,254,127,63,147,252,127,63,7,250,127,63,200,246,127,63,214,242,127,63,48,238,127,63,214,232,127,63,200,226,127,63,7,220,127,63,147,212,127,63,107,204,127,63,143,195,127,63,0,186,127,63,189,175,127,63,199,164,127,63,29,153,127,63,192,140,127,63,176,127,127,63,236,113,127,63,118,99,127,63,75,84,127,63,110,68,127,63,222,51,127,63,154,34,127,63,163,16,127,63,250,253,126,63,157,234,126,63,141,214,126,63,203,193,126,63,86,172,126,63,46,150,126,63,83,127,126,63,198,103,126,63,134,79,126,63,148,54,126,63,239,28,126,63,152,2,126,63,143,231,125,63,211,203,125,63,102,175,125,63,70,146,125,63,116,116,125,63,241,85,125,63,188,54,125,63,213,22,125,63,60,246,124,63,242,212,124,63,246,178,124,63,73,144,124,63,235,108,124,63,219,72,124,63,27,36,124,63,169,254,123,63,135,216,123,63,180,177,123,63,48,138,123,63,252,97,123,63,23,57,123,63,130,15,123,63,61,229,122,63,72,186,122,63,162,142,122,63,77,98,122,63,72,53,122,63,148,7,122,63,48,217,121,63,29,170,121,63,90,122,121,63,233,73,121,63,200,24,121,63,249,230,120,63],"i8",ALLOC_NONE,Runtime.GLOBAL_BASE);allocate([123,180,120,63,78,129,120,63,115,77,120,63,234,24,120,63,178,227,119,63,205,173,119,63,58,119,119,63,249,63,119,63,10,8,119,63,110,207,118,63,37,150,118,63,47,92,118,63,140,33,118,63,60,230,117,63,64,170,117,63,151,109,117,63,66,48,117,63,65,242,116,63,148,179,116,63,59,116,116,63,55,52,116,63,135,243,115,63,44,178,115,63,38,112,115,63,118,45,115,63,26,234,114,63,20,166,114,63,100,97,114,63,10,28,114,63,5,214,113,63,87,143,113,63,0,72,113,63,255,255,112,63,85,183,112,63,2,110,112,63,6,36,112,63,98,217,111,63,21,142,111,63,32,66,111,63,132,245,110,63,63,168,110,63,83,90,110,63,192,11,110,63,134,188,109,63,165,108,109,63,29,28,109,63,239,202,108,63,27,121,108,63,161,38,108,63,128,211,107,63,187,127,107,63,80,43,107,63,64,214,106,63,140,128,106,63,50,42,106,63,53,211,105,63,147,123,105,63,77,35,105,63,100,202,104,63,216,112,104,63,168,22,104,63,213,187,103,63,96,96,103,63,72,4,103,63,143,167,102,63,51,74,102,63,54,236,101,63,151,141,101,63,87,46,101,63,119,206,100,63,245,109,100,63,212,12,100,63,18,171,99,63,177,72,99,63,176,229,98,63,16,130,98,63,209,29,98,63,243,184,97,63,119,83,97,63,92,237,96,63,164,134,96,63,78,31,96,63,91,183,95,63,203,78,95,63,158,229,94,63,213,123,94,63,112,17,94,63,110,166,93,63,210,58,93,63,154,206,92,63,198,97,92,63,89,244,91,63,81,134,91,63,174,23,91,63,114,168,90,63,157,56,90,63,46,200,89,63,39,87,89,63,135,229,88,63,79,115,88,63,127,0,88,63,23,141,87,63,24,25,87,63,130,164,86,63,86,47,86,63,147,185,85,63,58,67,85,63,75,204,84,63,199,84,84,63,174,220,83,63,1,100,83,63,191,234,82,63,233,112,82,63,127,246,81,63,130,123,81,63,242,255,80,63,207,131,80,63,26,7,80,63,210,137,79,63,250,11,79,63,144,141,78,63,148,14,78,63,9,143,77,63,237,14,77,63,65,142,76,63,5,13,76,63,59,139,75,63,225,8,75,63,249,133,74,63,131,2,74,63,127,126,73,63,238,249,72,63,207,116,72,63,36,239,71,63,237,104,71,63,41,226,70,63,218,90,70,63,0,211,69,63,155,74,69,63,172,193,68,63,50,56,68,63,47,174,67,63,162,35,67,63,141,152,66,63,239,12,66,63,200,128,65,63,26,244,64,63,229,102,64,63,40,217,63,63,229,74,63,63,27,188,62,63,204,44,62,63,247,156,61,63,157,12,61,63,190,123,60,63,92,234,59,63,117,88,59,63,10,198,58,63,29,51,58,63,173,159,57,63,187,11,57,63,71,119,56,63,81,226,55,63,218,76,55,63,227,182,54,63,107,32,54,63,116,137,53,63,253,241,52,63,7,90,52,63,147,193,51,63,160,40,51,63,48,143,50,63,66,245,49,63,216,90,49,63,241,191,48,63,142,36,48,63,175,136,47,63,85,236,46,63,129,79,46,63,50,178,45,63,105,20,45,63,39,118,44,63,107,215,43,63,55,56,43,63,139,152,42,63,103,248,41,63,204,87,41,63,186,182,40,63,50,21,40,63,51,115,39,63,191,208,38,63,214,45,38,63,121,138,37,63,167,230,36,63,97,66,36,63,169,157,35,63,125,248,34,63,223,82,34,63,207,172,33,63,77,6,33,63,91,95,32,63,248,183,31,63,37,16,31,63,226,103,30,63,48,191,29,63,16,22,29,63,129,108,28,63,132,194,27,63,26,24,27,63,67,109,26,63,0,194,25,63,81,22,25,63,54,106,24,63,177,189,23,63,193,16,23,63,103,99,22,63,163,181,21,63,118,7,21,63,225,88,20,63,228,169,19,63,127,250,18,63,179,74,18,63,128,154,17,63,231,233,16,63,232,56,16,63,132,135,15,63,187,213,14,63,142,35,14,63,254,112,13,63,10,190,12,63,179,10,12,63,250,86,11,63,223,162,10,63,99,238,9,63,134,57,9,63,73,132,8,63,172,206,7,63,175,24,7,63,84,98,6,63,155,171,5,63,131,244,4,63,15,61,4,63,61,133,3,63,15,205,2,63,134,20,2,63,161,91,1,63,97,162,0,63,143,209,255,62,167,93,254,62,14,233,252,62,194,115,251,62,198,253,249,62,27,135,248,62,193,15,247,62,186,151,245,62,6,31,244,62,168,165,242,62,158,43,241,62,236,176,239,62,145,53,238,62,144,185,236,62,232,60,235,62,154,191,233,62,169,65,232,62,21,195,230,62,223,67,229,62,8,196,227,62,145,67,226,62,124,194,224,62,200,64,223,62,120,190,221,62,140,59,220,62,6,184,218,62,230,51,217,62,46,175,215,62,223,41,214,62,249,163,212,62,125,29,211,62,110,150,209,62,204,14,208,62,151,134,206,62,210,253,204,62,125,116,203,62,153,234,201,62,39,96,200,62,40,213,198,62,159,73,197,62,138,189,195,62,236,48,194,62,198,163,192,62,25,22,191,62,230,135,189,62,45,249,187,62,241,105,186,62,50,218,184,62,241,73,183,62,47,185,181,62,238,39,180,62,47,150,178,62,242,3,177,62,57,113,175,62,4,222,173,62,86,74,172,62,47,182,170,62,144,33,169,62,122,140,167,62,239,246,165,62,239,96,164,62,124,202,162,62,151,51,161,62,64,156,159,62,122,4,158,62,68,108,156,62,161,211,154,62,145,58,153,62,22,161,151,62,48,7,150,62,225,108,148,62,41,210,146,62,11,55,145,62,135,155,143,62,158,255,141,62,81,99,140,62,162,198,138,62,145,41,137,62,32,140,135,62,80,238,133,62,34,80,132,62,151,177,130,62,176,18,129,62,222,230,126,62,169,167,123,62,195,103,120,62,47,39,117,62,238,229,113,62,4,164,110,62,115,97,107,62,60,30,104,62,98,218,100,62,232,149,97,62,207,80,94,62,26,11,91,62,204,196,87,62,230,125,84,62,107,54,81,62,93,238,77,62,191,165,74,62,146,92,71,62,218,18,68,62,151,200,64,62,206,125,61,62,128,50,58,62,174,230,54,62,93,154,51,62,141,77,48,62,66,0,45,62,125,178,41,62,66,100,38,62,145,21,35,62,110,198,31,62,219,118,28,62,218,38,25,62,109,214,21,62,152,133,18,62,91,52,15,62,186,226,11,62,183,144,8,62,84,62,5,62,148,235,1,62,240,48,253,61,6,138,246,61,113,226,239,61,51,58,233,61,79,145,226,61,207,231,219,61,181,61,213,61,3,147,206,61,192,231,199,61,242,59,193,61,156,143,186,61,195,226,179,61,108,53,173,61,155,135,166,61,85,217,159,61,159,42,153,61,126,123,146,61,246,203,139,61,11,28,133,61,135,215,124,61,70,118,111,61,93,20,98,61,214,177,84,61,185,78,71,61,16,235,57,61,229,134,44,61,64,34,31,61,44,189,17,61,178,87,4,61,181,227,237,60,96,23,211,60,118,74,184,60,11,125,157,60,50,175,130,60,250,193,79,60,254,36,26,60,42,15,201,59,153,167,59,59,46,125,214,185,210,70,113,187,171,222,227,187,166,140,39,188,129,41,93,188,225,98,137,188,160,48,164,188,236,253,190,188,179,202,217,188,224,150,244,188,49,177,7,189,147,22,21,189,140,123,34,189,19,224,47,189,30,68,61,189,165,167,74,189,157,10,88,189,254,108,101,189,190,206,114,189,234,23,128,189,27,200,134,189,237,119,141,189,92,39,148,189,99,214,154,189,253,132,161,189,38,51,168,189,217,224,174,189,17,142,181,189,202,58,188,189,254,230,194,189,170,146,201,189,200,61,208,189,84,232,214,189,74,146,221,189,164,59,228,189,93,228,234,189,114,140,241,189,221,51,248,189,154,218,254,189,82,192,2,190,252,18,6,190,71,101,9,190,50,183,12,190,186,8,16,190,221,89,19,190,152,170,22,190,234,250,25,190,208,74,29,190,71,154,32,190,78,233,35,190,225,55,39,190,0,134,42,190,166,211,45,190,211,32,49,190,131,109,52,190,181,185,55,190,101,5,59,190,147,80,62,190,58,155,65,190,90,229,68,190,240,46,72,190,249,119,75,190,116,192,78,190,93,8,82,190,179,79,85,190,115,150,88,190,156,220,91,190,42,34,95,190,27,103,98,190,109,171,101,190,31,239,104,190,44,50,108,190,148,116,111,190,84,182,114,190,106,247,117,190,211,55,121,190,141,119,124,190,150,182,127,190,117,122,129,190,69,25,131,190,185,183,132,190,208,85,134,190,136,243,135,190,225,144,137,190,218,45,139,190,112,202,140,190,164,102,142,190,116,2,144,190,223,157,145,190,228,56,147,190,129,211,148,190,182,109,150,190,129,7,152,190,226,160,153,190,215,57,155,190,95,210,156,190,121,106,158,190,35,2,160,190,94,153,161,190,38,48,163,190,125,198,164,190,96,92,166,190,206,241,167,190,198,134,169,190,71,27,171,190,80,175,172,190,224,66,174,190,245,213,175,190,143,104,177,190,173,250,178,190,77,140,180,190,110,29,182,190,16,174,183,190,48,62,185,190,207,205,186,190,234,92,188,190,130,235,189,190,148,121,191,190,31,7,193,190,35,148,194,190,159,32,196,190,145,172,197,190,248,55,199,190,211,194,200,190,34,77,202,190,226,214,203,190,19,96,205,190,181,232,206,190,197,112,208,190,66,248,209,190,45,127,211,190,131,5,213,190,67,139,214,190,109,16,216,190,255,148,217,190,249,24,219,190,89,156,220,190,29,31,222,190,70,161,223,190,211,34,225,190,193,163,226,190,16,36,228,190,190,163,229,190,204,34,231,190,56,161,232,190,0,31,234,190,36,156,235,190,162,24,237,190,122,148,238,190,171,15,240,190,51,138,241,190,18,4,243,190,70,125,244,190,207,245,245,190,170,109,247,190,217,228,248,190,88,91,250,190,40,209,251,190,71,70,253,190,181,186,254,190,56,23,0,191,187,208,0,191,228,137,1,191,178,66,2,191,37,251,2,191,59,179,3,191,246,106,4,191,83,34,5,191,83,217,5,191,245,143,6,191,56,70,7,191,29,252,7,191,162,177,8,191,199,102,9,191,140,27,10,191,240,207,10,191,243,131,11,191,147,55,12,191,209,234,12,191,172,157,13,191,36,80,14,191,56,2,15,191,232,179,15,191,50,101,16,191,24,22,17,191,151,198,17,191,176,118,18,191,99,38,19,191,174,213,19,191,145,132,20,191,13,51,21,191,31,225,21,191,200,142,22,191,8,60,23,191,221,232,23,191,72,149,24,191,72,65,25,191,220,236,25,191,4,152,26,191,192,66,27,191,15,237,27,191,240,150,28,191,99,64,29,191,104,233,29,191,254,145,30,191,37,58,31,191,220,225,31,191,35,137,32,191,250,47,33,191,95,214,33,191,82,124,34,191,212,33,35,191,227,198,35,191,127,107,36,191,167,15,37,191,92,179,37,191,157,86,38,191,104,249,38,191,191,155,39,191,160,61,40,191,11,223,40,191,255,127,41,191,125,32,42,191,131,192,42,191,17,96,43,191,39,255,43,191,196,157,44,191,232,59,45,191,146,217,45,191,195,118,46,191,121,19,47,191,180,175,47,191,115,75,48,191,183,230,48,191,127,129,49,191,203,27,50,191,153,181,50,191,234,78,51,191,189,231,51,191,18,128,52,191,232,23,53,191,63,175,53,191,22,70,54,191,110,220,54,191,69,114,55,191,156,7,56,191,113,156,56,191,197,48,57,191,150,196,57,191,230,87,58,191,178,234,58,191,252,124,59,191,194,14,60,191,3,160,60,191,193,48,61,191,250,192,61,191,173,80,62,191,219,223,62,191,131,110,63,191,165,252,63,191,64,138,64,191,83,23,65,191,224,163,65,191,228,47,66,191,96,187,66,191,83,70,67,191,190,208,67,191,158,90,68,191,246,227,68,191,194,108,69,191,5,245,69,191,188,124,70,191,232,3,71,191,137,138,71,191,157,16,72,191,37,150,72,191,32,27,73,191,142,159,73,191,111,35,74,191,193,166,74,191,134,41,75,191,188,171,75,191,99,45,76,191,122,174,76,191,2,47,77,191,250,174,77,191,98,46,78,191,57,173,78,191,126,43,79,191,51,169,79,191,85,38,80,191,230,162,80,191,228,30,81,191,80,154,81,191,40,21,82,191,109,143,82,191,30,9,83,191,59,130,83,191,195,250,83,191,183,114,84,191,22,234,84,191,223,96,85,191,18,215,85,191,176,76,86,191,183,193,86,191,39,54,87,191,0,170,87,191,66,29,88,191,236,143,88,191,254,1,89,191,120,115,89,191,89,228,89,191,162,84,90,191,81,196,90,191,102,51,91,191,226,161,91,191,195,15,92,191,10,125,92,191,183,233,92,191,200,85,93,191,62,193,93,191,24,44,94,191,87,150,94,191,249,255,94,191,255,104,95,191,104,209,95,191,51,57,96,191,98,160,96,191,243,6,97,191,229,108,97,191,58,210,97,191,240,54,98,191,8,155,98,191,128,254,98,191,89,97,99,191,146,195,99,191,44,37,100,191,37,134,100,191,126,230,100,191,55,70,101,191,78,165,101,191,197,3,102,191,154,97,102,191,205,190,102,191,94,27,103,191,77,119,103,191,154,210,103,191,68,45,104,191,75,135,104,191,174,224,104,191,111,57,105,191,139,145,105,191,4,233,105,191,217,63,106,191,9,150,106,191,148,235,106,191,123,64,107,191,188,148,107,191,89,232,107,191,79,59,108,191,160,141,108,191,75,223,108,191,79,48,109,191,173,128,109,191,101,208,109,191,117,31,110,191,223,109,110,191,161,187,110,191,187,8,111,191,46,85,111,191,248,160,111,191,27,236,111,191,149,54,112,191,103,128,112,191,144,201,112,191,15,18,113,191,230,89,113,191,19,161,113,191,151,231,113,191,113,45,114,191,160,114,114,191,38,183,114,191,1,251,114,191,50,62,115,191,184,128,115,191,148,194,115,191,196,3,116,191,73,68,116,191,34,132,116,191,80,195,116,191,210,1,117,191,168,63,117,191,210,124,117,191,80,185,117,191,33,245,117,191,69,48,118,191,189,106,118,191,136,164,118,191,166,221,118,191,22,22,119,191,217,77,119,191,239,132,119,191,87,187,119,191,17,241,119,191,29,38,120,191,122,90,120,191,42,142,120,191,43,193,120,191,125,243,120,191,33,37,121,191,22,86,121,191,92,134,121,191,242,181,121,191,218,228,121,191,18,19,122,191,154,64,122,191,115,109,122,191,157,153,122,191,22,197,122,191,223,239,122,191,248,25,123,191,97,67,123,191,26,108,123,191,34,148,123,191,122,187,123,191,32,226,123,191,23,8,124,191,92,45,124,191,240,81,124,191,211,117,124,191,5,153,124,191,134,187,124,191,85,221,124,191,115,254,124,191,223,30,125,191,154,62,125,191,163,93,125,191,250,123,125,191,159,153,125,191,146,182,125,191,211,210,125,191,98,238,125,191,63,9,126,191,105,35,126,191,225,60,126,191,167,85,126,191,186,109,126,191,27,133,126,191,201,155,126,191,196,177,126,191,13,199,126,191,162,219,126,191,133,239,126,191,181,2,127,191,50,21,127,191,252,38,127,191,19,56,127,191,118,72,127,191,39,88,127,191,36,103,127,191,110,117,127,191,5,131,127,191,232,143,127,191,25,156,127,191,149,167,127,191,95,178,127,191,116,188,127,191,215,197,127,191,133,206,127,191,129,214,127,191,200,221,127,191,93,228,127,191,61,234,127,191,106,239,127,191,227,243,127,191,169,247,127,191,187,250,127,191,25,253,127,191,196,254,127,191,187,255,127,191,250,255,127,63,57,254,127,63,169,249,127,63,75,242,127,63,30,232,127,63,35,219,127,63,89,203,127,63,193,184,127,63,91,163,127,63,40,139,127,63,39,112,127,63,90,82,127,63,191,49,127,63,88,14,127,63,37,232,126,63,38,191,126,63,92,147,126,63,200,100,126,63,105,51,126,63,65,255,125,63,79,200,125,63,150,142,125,63,20,82,125,63,203,18,125,63,188,208,124,63,231,139,124,63,77,68,124,63,239,249,123,63,205,172,123,63,233,92,123,63,67,10,123,63,221,180,122,63,182,92,122,63,209,1,122,63,46,164,121,63,206,67,121,63,178,224,120,63,220,122,120,63,76,18,120,63,4,167,119,63,4,57,119,63,79,200,118,63,228,84,118,63,198,222,117,63,246,101,117,63,117,234,116,63,68,108,116,63,101,235,115,63,218,103,115,63,163,225,114,63,194,88,114,63,57,205,113,63,9,63,113,63,52,174,112,63,187,26,112,63,160,132,111,63,228,235,110,63,138,80,110,63,147,178,109,63,1,18,109,63,213,110,108,63,17,201,107,63,183,32,107,63,201,117,106,63,73,200,105,63,57,24,105,63,155,101,104,63,111,176,103,63,186,248,102,63,124,62,102,63,184,129,101,63,111,194,100,63,164,0,100,63,90,60,99,63,145,117,98,63,76,172,97,63,142,224,96,63,89,18,96,63,174,65,95,63,145,110,94,63,3,153,93,63,8,193,92,63,160,230,91,63,207,9,91,63,152,42,90,63,251,72,89,63,253,100,88,63,159,126,87,63,229,149,86,63,208,170,85,63,99,189,84,63,161,205,83,63,140,219,82,63,39,231,81,63,117,240,80,63,121,247,79,63,52,252,78,63,171,254,77,63,223,254,76,63,212,252,75,63,140,248,74,63,10,242,73,63,82,233,72,63,101,222,71,63,71,209,70,63,251,193,69,63,132,176,68,63,229,156,67,63,32,135,66,63,58,111,65,63,52,85,64,63,19,57,63,63,216,26,62,63,136,250,60,63,38,216,59,63,180,179,58,63,54,141,57,63,175,100,56,63,34,58,55,63,147,13,54,63,5,223,52,63,124,174,51,63,249,123,50,63,130,71,49,63,25,17,48,63,194,216,46,63,127,158,45,63,86,98,44,63,72,36,43,63,90,228,41,63,144,162,40,63,235,94,39,63,113,25,38,63,37,210,36,63,9,137,35,63,35,62,34,63,117,241,32,63,4,163,31,63,210,82,30,63,228,0,29,63,61,173,27,63,225,87,26,63,211,0,25,63,25,168,23,63,180,77,22,63,170,241,20,63,253,147,19,63,178,52,18,63,204,211,16,63,80,113,15,63,66,13,14,63,164,167,12,63,124,64,11,63,205,215,9,63,154,109,8,63,233,1,7,63,189,148,5,63,25,38,4,63,3,182,2,63,126,68,1,63,28,163,255,62,110,186,252,62,250,206,249,62,202,224,246,62,228,239,243,62,81,252,240,62,26,6,238,62,71,13,235,62,224,17,232,62,237,19,229,62,119,19,226,62,135,16,223,62,36,11,220,62,88,3,217,62,42,249,213,62,164,236,210,62,205,221,207,62,175,204,204,62,82,185,201,62,191,163,198,62,254,139,195,62,24,114,192,62,22,86,189,62,0,56,186,62,224,23,183,62,189,245,179,62,161,209,176,62,149,171,173,62,162,131,170,62,207,89,167,62,39,46,164,62,178,0,161,62,121,209,157,62,133,160,154,62,223,109,151,62,143,57,148,62,160,3,145,62,26,204,141,62,5,147,138,62,107,88,135,62,86,28,132,62,205,222,128,62,182,63,123,62,16,191,116,62,187,59,110,62,201,181,103,62,77,45,97,62,89,162,90,62,255,20,84,62,81,133,77,62,99,243,70,62,70,95,64,62,13,201,57,62,202,48,51,62,144,150,44,62,114,250,37,62,130,92,31,62,210,188,24,62,118,27,18,62,127,120,11,62,1,212,4,62,29,92,252,61,114,13,239,61,41,188,225,61,102,104,212,61,78,18,199,61,8,186,185,61,184,95,172,61,132,3,159,61,146,165,145,61,7,70,132,61,18,202,109,61,122,5,83,61,145,62,56,61,164,117,29,61,252,170,2,61,202,189,207,60,86,35,154,60,97,14,73,60,197,167,187,59,61,122,86,186,9,70,241,187,18,221,99,188,80,138,167,188,65,36,221,188,227,93,9,189,35,40,36,189,150,240,62,189,242,182,89,189,234,122,116,189,26,158,135,189,66,253,148,189,200,90,162,189,134,182,175,189,87,16,189,189,22,104,202,189,155,189,215,189,195,16,229,189,105,97,242,189,101,175,255,189,74,125,6,190,104,33,13,190,250,195,19,190,237,100,26,190,46,4,33,190,172,161,39,190,83,61,46,190,16,215,52,190,210,110,59,190,134,4,66,190,25,152,72,190,121,41,79,190,148,184,85,190,86,69,92,190,174,207,98,190,137,87,105,190,214,220,111,190,128,95,118,190,120,223,124,190,84,174,129,190,129,235,132,190,56,39,136,190,114,97,139,190,36,154,142,190,69,209,145,190,205,6,149,190,179,58,152,190,238,108,155,190,116,157,158,190,61,204,161,190,64,249,164,190,115,36,168,190,207,77,171,190,73,117,174,190,218,154,177,190,120,190,180,190,27,224,183,190,186,255,186,190,75,29,190,190,199,56,193,190,37,82,196,190,91,105,199,190,97,126,202,190,48,145,205,190,188,161,208,190,0,176,211,190,241,187,214,190,135,197,217,190,186,204,220,190,129,209,223,190,211,211,226,190,169,211,229,190,250,208,232,190,189,203,235,190,234,195,238,190,120,185,241,190,96,172,244,190,154,156,247,190,28,138,250,190,223,116,253,190,109,46,0,191,3,161,1,191,45,18,3,191,230,129,4,191,44,240,5,191,250,92,7,191,76,200,8,191,30,50,10,191,108,154,11,191,50,1,13,191,108,102,14,191,23,202,15,191,45,44,17,191,172,140,18,191,144,235,19,191,213,72,21,191,118,164,22,191,113,254,23,191,192,86,25,191,98,173,26,191,81,2,28,191,138,85,29,191,9,167,30,191,203,246,31,191,204,68,33,191,9,145,34,191,124,219,35,191,36,36,37,191,253,106,38,191,2,176,39,191,48,243,40,191,132,52,42,191,250,115,43,191,143,177,44,191,63,237,45,191,7,39,47,191,227,94,48,191,208,148,49,191,202,200,50,191,206,250,51,191,218,42,53,191,232,88,54,191,247,132,55,191,2,175,56,191,7,215,57,191,3,253,58,191,241,32,60,191,207,66,61,191,154,98,62,191,79,128,63,191,233,155,64,191,104,181,65,191,198,204,66,191,1,226,67,191,23,245,68,191,3,6,70,191,196,20,71,191,86,33,72,191,182,43,73,191,225,51,74,191,212,57,75,191,141,61,76,191,9,63,77,191,68,62,78,191,61,59,79,191,240,53,80,191,90,46,81,191,121,36,82,191,74,24,83,191,202,9,84,191,247,248,84,191,206,229,85,191,77,208,86,191,112,184,87,191,55,158,88,191,156,129,89,191,160,98,90,191,62,65,91,191,117,29,92,191,65,247,92,191,162,206,93,191,148,163,94,191,20,118,95,191,34,70,96,191,186,19,97,191,217,222,97,191,127,167,98,191,169,109,99,191,84,49,100,191,126,242,100,191,38,177,101,191,73,109,102,191,229,38,103,191,248,221,103,191,128,146,104,191,123,68,105,191,232,243,105,191,195,160,106,191,12,75,107,191,192,242,107,191,222,151,108,191,100,58,109,191,80,218,109,191,160,119,110,191,83,18,111,191,102,170,111,191,217,63,112,191,169,210,112,191,213,98,113,191,91,240,113,191,58,123,114,191,113,3,115,191,253,136,115,191,222,11,116,191,17,140,116,191,150,9,117,191,107,132,117,191,143,252,117,191,0,114,118,191,189,228,118,191,198,84,119,191,24,194,119,191,178,44,120,191,147,148,120,191,187,249,120,191,40,92,121,191,217,187,121,191,205,24,122,191,2,115,122,191,121,202,122,191,47,31,123,191,36,113,123,191,88,192,123,191,201,12,124,191,118,86,124,191,95,157,124,191,130,225,124,191,224,34,125,191,119,97,125,191,71,157,125,191,79,214,125,191,142,12,126,191,4,64,126,191,176,112,126,191,146,158,126,191,169,201,126,191,245,241,126,191,117,23,127,191,41,58,127,191,16,90,127,191,43,119,127,191,120,145,127,191,248,168,127,191,170,189,127,191,143,207,127,191,165,222,127,191,237,234,127,191,102,244,127,191,17,251,127,191,237,254,127,191,234,255,127,63,229,248,127,63,166,230,127,63,45,201,127,63,124,160,127,63,149,108,127,63,121,45,127,63,44,227,126,63,177,141,126,63,11,45,126,63,63,193,125,63,82,74,125,63,72,200,124,63,40,59,124,63,247,162,123,63,189,255,122,63,128,81,122,63,72,152,121,63,30,212,120,63,9,5,120,63,19,43,119,63,70,70,118,63,172,86,117,63,78,92,116,63,56,87,115,63,118,71,114,63,19,45,113,63,28,8,112,63,158,216,110,63,165,158,109,63,64,90,108,63,126,11,107,63,107,178,105,63,25,79,104,63,150,225,102,63,242,105,101,63,62,232,99,63,139,92,98,63,234,198,96,63,109,39,95,63,38,126,93,63,40,203,91,63,133,14,90,63,83,72,88,63,163,120,86,63,139,159,84,63,32,189,82,63,118,209,80,63,163,220,78,63,189,222,76,63,219,215,74,63,19,200,72,63,124,175,70,63,46,142,68,63,65,100,66,63,206,49,64,63,236,246,61,63,180,179,59,63,66,104,57,63,173,20,55,63,16,185,52,63,134,85,50,63,41,234,47,63,21,119,45,63,101,252,42,63,53,122,40,63,161,240,37,63,198,95,35,63,192,199,32,63,172,40,30,63,169,130,27,63,212,213,24,63,74,34,22,63,42,104,19,63,147,167,16,63,164,224,13,63,123,19,11,63,57,64,8,63,253,102,5,63,231,135,2,63,45,70,255,62,91,113,249,62,151,145,243,62,36,167,237,62,69,178,231,62,60,179,225,62,76,170,219,62,186,151,213,62,201,123,207,62,190,86,201,62,223,40,195,62,112,242,188,62,183,179,182,62,251,108,176,62,129,30,170,62,146,200,163,62,115,107,157,62,108,7,151,62,197,156,144,62,199,43,138,62,185,180,131,62,199,111,122,62,33,107,109,62,17,92,96,62,41,67,83,62,253,32,70,62,32,246,56,62,38,195,43,62,164,136,30,62,45,71,17,62,87,255,3,62,110,99,237,61,194,189,210,61,218,14,184,61,222,87,157,61,251,153,130,61,188,172,79,61,101,28,26,61,153,10,201,60,42,167,59,60,193,120,214,186,45,68,113,188,87,215,227,188,76,129,39,189,148,15,93,189,21,74,137,189,90,6,164,189,109,187,190,189,34,104,217,189,78,11,244,189,227,81,7,190,47,152,20,190,247,215,33,190,165,16,47,190,166,65,60,190,100,106,73,190,77,138,86,190,205,160,99,190,80,173,112,190,69,175,125,190,13,83,133,190,158,200,139,190,13,56,146,190,18,161,152,190,102,3,159,190,191,94,165,190,216,178,171,190,105,255,177,190,43,68,184,190,216,128,190,190,42,181,196,190,219,224,202,190,165,3,209,190,69,29,215,190,117,45,221,190,241,51,227,190,118,48,233,190,192,34,239,190,141,10,245,190,155,231,250,190,211,92,0,191,56,64,3,191,219,29,6,191,155,245,8,191,90,199,11,191,247,146,14,191,84,88,17,191,80,23,20,191,205,207,22,191,172,129,25,191,208,44,28,191,26,209,30,191,109,110,33,191,171,4,36,191,183,147,38,191,116,27,41,191,199,155,43,191,147,20,46,191,187,133,48,191,38,239,50,191,183,80,53,191,85,170,55,191,227,251,57,191,74,69,60,191,110,134,62,191,55,191,64,191,139,239,66,191,83,23,69,191,117,54,71,191,218,76,73,191,107,90,75,191,16,95,77,191,179,90,79,191,62,77,81,191,154,54,83,191,179,22,85,191,114,237,86,191,197,186,88,191,149,126,90,191,208,56,92,191,98,233,93,191,56,144,95,191,64,45,97,191,103,192,98,191,156,73,100,191,206,200,101,191,235,61,103,191,227,168,104,191,167,9,106,191,39,96,107,191,84,172,108,191,31,238,109,191,122,37,111,191,88,82,112,191,171,116,113,191,103,140,114,191,127,153,115,191,231,155,116,191,149,147,117,191,126,128,118,191,150,98,119,191,212,57,120,191,47,6,121,191,158,199,121,191,23,126,122,191,148,41,123,191,13,202,123,191,122,95,124,191,213,233,124,191,24,105,125,191,62,221,125,191,64,70,126,191,28,164,126,191,204,246,126,191,77,62,127,191,156,122,127,191,182,171,127,191,153,209,127,191,67,236,127,191,180,251,127,191,166,255,127,63,148,227,127,63,156,154,127,63,204,36,127,63,56,130,126,63,253,178,125,63,63,183,124,63,42,143,123,63,243,58,122,63,212,186,120,63,17,15,119,63,246,55,117,63,213,53,115,63,8,9,113,63,241,177,110,63,249,48,108,63,144,134,105,63,47,179,102,63,83,183,99,63,132,147,96,63,78,72,93,63,69,214,89,63,3,62,86,63,43,128,82,63,101,157,78,63,94,150,74,63,204,107,70,63,106,30,66,63,249,174,61,63,64,30,57,63,13,109,52,63,50,156,47,63,135,172,42,63,235,158,37,63,63,116,32,63,109,45,27,63,97,203,21,63,13,79,16,63,104,185,10,63,107,11,5,63,46,140,254,62,221,212,242,62,241,242,230,62,127,232,218,62,166,183,206,62,136,98,194,62,78,235,181,62,42,84,169,62,81,159,156,62,253,206,143,62,109,229,130,62,206,201,107,62,98,159,81,62,48,80,55,62,211,224,28,62,241,85,2,62,98,104,207,61,124,0,154,61,36,251,72,61,27,164,187,60,243,119,86,187,100,61,241,188,187,192,99,189,103,93,167,189,20,189,220,189,3,251,8,190,115,127,35,190,52,231,61,190,164,45,88,190,38,78,114,190,18,34,134,190,137,5,147,190,52,207,159,190,213,124,172,190,51,12,185,190,26,123,197,190,91,199,209,190,205,238,221,190,80,239,233,190,199,198,245,190,144,185,0,191,38,121,6,191,36,33,12,191,141,176,17,191,102,38,23,191,186,129,28,191,152,193,33,191,21,229,38,191,74,235,43,191,86,211,48,191,91,156,53,191,131,69,58,191,253,205,62,191,252,52,67,191,188,121,71,191,125,155,75,191,132,153,79,191,31,115,83,191,161,39,87,191,99,182,90,191,198,30,94,191,48,96,97,191,15,122,100,191,216,107,103,191,7,53,106,191,31,213,108,191,169,75,111,191,55,152,113,191,98,186,115,191,201,177,117,191,22,126,119,191,246,30,121,191,33,148,122,191,85,221,123,191,89,250,124,191,250,234,125,191,14,175,126,191,116,70,127,191,15,177,127,191,206,238,127,191,0,0,0,0,0,0,0,0,3,0,0,0,2,0,0,0,3,0,0,0,2,0,0,0,5,0,0,0,2,0,0,0,3,0,0,0,2,0,0,0,3,0,0,0,2,0,0,0,5,0,0,0,2,0,0,0,3,0,0,0,2,0,0,0,0,0,206,64,0,0,200,64,0,0,184,64,0,0,170,64,0,0,162,64,0,0,154,64,0,0,144,64,0,0,140,64,0,0,156,64,0,0,150,64,0,0,146,64,0,0,142,64,0,0,156,64,0,0,148,64,0,0,138,64,0,0,144,64,0,0,140,64,0,0,148,64,0,0,152,64,0,0,142,64,0,0,112,64,0,0,112,64,0,0,112,64,0,0,112,64,0,0,112,64,0,134,107,63,0,20,46,63,0,112,189,62,0,208,76,62,0,0,102,63,0,0,76,63,0,0,38,63,0,0,0,63,15,0,0,0,10,0,0,0,5,0,0,0,6,0,0,0,4,0,0,0,3,0,0,0,0,115,0,0,8,115,0,0,24,115,0,0,56,115,0,0,64,115,0,0,80,115,0,0,112,115,0,0,152,115,0,0,232,115,0,0,136,116,0,0,144,116,0,0,160,116,0,0,0,0,0,0,64,31,0,0,184,36,0,0,236,44,0,0,188,52,0,0,92,68,0,0,168,97,0,0,128,56,1,0,0,0,0,0,40,35,0,0,224,46,0,0,164,56,0,0,68,72,0,0,180,95,0,0,172,138,0,0,128,56,1,0,0,0,0,0,4,41,0,0,176,54,0,0,104,66,0,0,252,83,0,0,84,111,0,0,16,164,0,0,128,56,1,0,222,116,0,0,225,116,0,0,10,103,242,14,86,205,228,29,10,103,242,14,117,82,130,12,89,154,4,25,117,82,130,12,70,17,49,10,237,3,98,20,70,17,49,10,218,2,215,7,249,198,173,15,218,2,215,7,34,182,82,5,218,250,164,10,34,182,82,5,70,243,46,30,43,227,75,14,31,102,128,24,28,44,29,10,218,97,72,18,237,156,244,6,236,48,19,11,227,144,165,4,237,164,29,2,10,223,107,3,1,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,2,0,0,0,1,0,0,0,7,0,0,0,0,0,0,0,4,0,0,0,3,0,0,0,6,0,0,0,1,0,0,0,5,0,0,0,2,0,0,0,15,0,0,0,0,0,0,0,8,0,0,0,7,0,0,0,12,0,0,0,3,0,0,0,11,0,0,0,4,0,0,0,14,0,0,0,1,0,0,0,9,0,0,0,6,0,0,0,13,0,0,0,2,0,0,0,10,0,0,0,5,0,0,0,144,69,0,0,80,72,0,0,12,75,0,0,196,77,0,0,120,80,0,0,40,83,0,0,212,85,0,0,60,87,0,0,248,87,0,0,108,88,0,0,184,88,0,0,240,88,0,0,16,89,0,0,40,89,0,0,52,89,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,3,0,0,0,5,0,0,0,7,0,0,0,9,0,0,0,11,0,0,0,13,0,0,0,15,0,0,0,17,0,0,0,19,0,0,0,21,0,0,0,23,0,0,0,25,0,0,0,27,0,0,0,29,0,0,0,31,0,0,0,33,0,0,0,35,0,0,0,37,0,0,0,39,0,0,0,41,0,0,0,43,0,0,0,45,0,0,0,47,0,0,0,49,0,0,0,51,0,0,0,53,0,0,0,55,0,0,0,57,0,0,0,59,0,0,0,61,0,0,0,63,0,0,0,65,0,0,0,67,0,0,0,69,0,0,0,71,0,0,0,73,0,0,0,75,0,0,0,77,0,0,0,79,0,0,0,81,0,0,0,83,0,0,0,85,0,0,0,87,0,0,0,89,0,0,0,91,0,0,0,93,0,0,0,95,0,0,0,97,0,0,0,99,0,0,0,101,0,0,0,103,0,0,0,105,0,0,0,107,0,0,0,109,0,0,0,111,0,0,0,113,0,0,0,115,0,0,0,117,0,0,0,119,0,0,0,121,0,0,0,123,0,0,0,125,0,0,0,127,0,0,0,129,0,0,0,131,0,0,0,133,0,0,0,135,0,0,0,137,0,0,0,139,0,0,0,141,0,0,0,143,0,0,0,145,0,0,0,147,0,0,0,149,0,0,0,151,0,0,0,153,0,0,0,155,0,0,0,157,0,0,0,159,0,0,0,161,0,0,0,163,0,0,0,165,0,0,0,167,0,0,0,169,0,0,0,171,0,0,0,173,0,0,0,175,0,0,0,177,0,0,0,179,0,0,0,181,0,0,0,183,0,0,0,185,0,0,0,187,0,0,0,189,0,0,0,191,0,0,0,193,0,0,0,195,0,0,0,197,0,0,0,199,0,0,0,201,0,0,0,203,0,0,0,205,0,0,0,207,0,0,0,209,0,0,0,211,0,0,0,213,0,0,0,215,0,0,0,217,0,0,0,219,0,0,0,221,0,0,0,223,0,0,0,225,0,0,0,227,0,0,0,229,0,0,0,231,0,0,0,233,0,0,0,235,0,0,0,237,0,0,0,239,0,0,0,241,0,0,0,243,0,0,0,245,0,0,0,247,0,0,0,249,0,0,0,251,0,0,0,253,0,0,0,255,0,0,0,1,1,0,0,3,1,0,0,5,1,0,0,7,1,0,0,9,1,0,0,11,1,0,0,13,1,0,0,15,1,0,0,17,1,0,0,19,1,0,0,21,1,0,0,23,1,0,0,25,1,0,0,27,1,0,0,29,1,0,0,31,1,0,0,33,1,0,0,35,1,0,0,37,1,0,0,39,1,0,0,41,1,0,0,43,1,0,0,45,1,0,0,47,1,0,0,49,1,0,0,51,1,0,0,53,1,0,0,55,1,0,0,57,1,0,0,59,1,0,0,61,1,0,0,63,1,0,0,65,1,0,0,67,1,0,0,69,1,0,0,71,1,0,0,73,1,0,0,75,1,0,0,77,1,0,0,79,1,0,0,81,1,0,0,83,1,0,0,85,1,0,0,87,1,0,0,89,1,0,0,91,1,0,0,93,1,0,0,95,1,0,0,13,0,0,0,25,0,0,0,41,0,0,0,61,0,0,0,85,0,0,0,113,0,0,0,145,0,0,0,181,0,0,0,221,0,0,0,9,1,0,0,57,1,0,0,109,1,0,0,165,1,0,0,225,1,0,0,33,2,0,0,101,2,0,0,173,2,0,0,249,2,0,0,73,3,0,0,157,3,0,0,245,3,0,0,81,4,0,0,177,4,0,0,21,5,0,0,125,5,0,0,233,5,0,0,89,6,0,0,205,6,0,0,69,7,0,0,193,7,0,0,65,8,0,0,197,8,0,0,77,9,0,0,217,9,0,0,105,10,0,0,253,10,0,0,149,11,0,0,49,12,0,0,209,12,0,0,117,13,0,0,29,14,0,0,201,14,0,0,121,15,0,0,45,16,0,0,229,16,0,0,161,17,0,0,97,18,0,0,37,19,0,0,237,19,0,0,185,20,0,0,137,21,0,0,93,22,0,0,53,23,0,0,17,24,0,0,241,24,0,0,213,25,0,0,189,26,0,0,169,27,0,0,153,28,0,0,141,29,0,0,133,30,0,0,129,31,0,0,129,32,0,0,133,33,0,0,141,34,0,0,153,35,0,0,169,36,0,0,189,37,0,0,213,38,0,0,241,39,0,0,17,41,0,0,53,42,0,0,93,43,0,0,137,44,0,0,185,45,0,0,237,46,0,0,37,48,0,0,97,49,0,0,161,50,0,0,229,51,0,0,45,53,0,0,121,54,0,0,201,55,0,0,29,57,0,0,117,58,0,0,209,59,0,0,49,61,0,0,149,62,0,0,253,63,0,0,105,65,0,0,217,66,0,0,77,68,0,0,197,69,0,0,65,71,0,0,193,72,0,0,69,74,0,0,205,75,0,0,89,77,0,0,233,78,0,0,125,80,0,0,21,82,0,0,177,83,0,0,81,85,0,0,245,86,0,0,157,88,0,0,73,90,0,0,249,91,0,0,173,93,0,0,101,95,0,0,33,97,0,0,225,98,0,0,165,100,0,0,109,102,0,0,57,104,0,0,9,106,0,0,221,107,0,0,181,109,0,0,145,111,0,0,113,113,0,0,85,115,0,0,61,117,0,0,41,119,0,0,25,121,0,0,13,123,0,0,5,125,0,0,1,127,0,0,1,129,0,0,5,131,0,0,13,133,0,0,25,135,0,0,41,137,0,0,61,139,0,0,85,141,0,0,113,143,0,0,145,145,0,0,181,147,0,0,221,149,0,0,9,152,0,0,57,154,0,0,109,156,0,0,165,158,0,0,225,160],"i8",ALLOC_NONE,Runtime.GLOBAL_BASE+10240);allocate([33,163,0,0,101,165,0,0,173,167,0,0,249,169,0,0,73,172,0,0,157,174,0,0,245,176,0,0,81,179,0,0,177,181,0,0,21,184,0,0,125,186,0,0,233,188,0,0,89,191,0,0,205,193,0,0,69,196,0,0,193,198,0,0,65,201,0,0,197,203,0,0,77,206,0,0,217,208,0,0,105,211,0,0,253,213,0,0,149,216,0,0,49,219,0,0,209,221,0,0,117,224,0,0,29,227,0,0,201,229,0,0,121,232,0,0,45,235,0,0,229,237,0,0,161,240,0,0,63,0,0,0,129,0,0,0,231,0,0,0,121,1,0,0,63,2,0,0,65,3,0,0,135,4,0,0,25,6,0,0,255,7,0,0,65,10,0,0,231,12,0,0,249,15,0,0,127,19,0,0,129,23,0,0,7,28,0,0,25,33,0,0,191,38,0,0,1,45,0,0,231,51,0,0,121,59,0,0,191,67,0,0,193,76,0,0,135,86,0,0,25,97,0,0,127,108,0,0,193,120,0,0,231,133,0,0,249,147,0,0,255,162,0,0,1,179,0,0,7,196,0,0,25,214,0,0,63,233,0,0,129,253,0,0,231,18,1,0,121,41,1,0,63,65,1,0,65,90,1,0,135,116,1,0,25,144,1,0,255,172,1,0,65,203,1,0,231,234,1,0,249,11,2,0,127,46,2,0,129,82,2,0,7,120,2,0,25,159,2,0,191,199,2,0,1,242,2,0,231,29,3,0,121,75,3,0,191,122,3,0,193,171,3,0,135,222,3,0,25,19,4,0,127,73,4,0,193,129,4,0,231,187,4,0,249,247,4,0,255,53,5,0,1,118,5,0,7,184,5,0,25,252,5,0,63,66,6,0,129,138,6,0,231,212,6,0,121,33,7,0,63,112,7,0,65,193,7,0,135,20,8,0,25,106,8,0,255,193,8,0,65,28,9,0,231,120,9,0,249,215,9,0,127,57,10,0,129,157,10,0,7,4,11,0,25,109,11,0,191,216,11,0,1,71,12,0,231,183,12,0,121,43,13,0,191,161,13,0,193,26,14,0,135,150,14,0,25,21,15,0,127,150,15,0,193,26,16,0,231,161,16,0,249,43,17,0,255,184,17,0,1,73,18,0,7,220,18,0,25,114,19,0,63,11,20,0,129,167,20,0,231,70,21,0,121,233,21,0,63,143,22,0,65,56,23,0,135,228,23,0,25,148,24,0,255,70,25,0,65,253,25,0,231,182,26,0,249,115,27,0,127,52,28,0,129,248,28,0,7,192,29,0,25,139,30,0,191,89,31,0,1,44,32,0,231,1,33,0,121,219,33,0,191,184,34,0,193,153,35,0,135,126,36,0,25,103,37,0,127,83,38,0,193,67,39,0,231,55,40,0,249,47,41,0,255,43,42,0,1,44,43,0,7,48,44,0,25,56,45,0,63,68,46,0,129,84,47,0,231,104,48,0,121,129,49,0,63,158,50,0,65,191,51,0,135,228,52,0,25,14,54,0,255,59,55,0,65,110,56,0,231,164,57,0,249,223,58,0,127,31,60,0,129,99,61,0,7,172,62,0,25,249,63,0,191,74,65,0,1,161,66,0,231,251,67,0,121,91,69,0,191,191,70,0,193,40,72,0,135,150,73,0,25,9,75,0,127,128,76,0,193,252,77,0,231,125,79,0,249,3,81,0,255,142,82,0,1,31,84,0,7,180,85,0,25,78,87,0,63,237,88,0,129,145,90,0,231,58,92,0,121,233,93,0,63,157,95,0,65,86,97,0,135,20,99,0,25,216,100,0,255,160,102,0,65,111,104,0,231,66,106,0,249,27,108,0,127,250,109,0,65,1,0,0,169,2,0,0,9,5,0,0,193,8,0,0,65,14,0,0,9,22,0,0,169,32,0,0,193,46,0,0,1,65,0,0,41,88,0,0,9,117,0,0,129,152,0,0,129,195,0,0,9,247,0,0,41,52,1,0,1,124,1,0,193,207,1,0,169,48,2,0,9,160,2,0,65,31,3,0,193,175,3,0,9,83,4,0,169,10,5,0,65,216,5,0,129,189,6,0,41,188,7,0,9,214,8,0,1,13,10,0,1,99,11,0,9,218,12,0,41,116,14,0,129,51,16,0,65,26,18,0,169,42,20,0,9,103,22,0,193,209,24,0,65,109,27,0,9,60,30,0,169,64,33,0,193,125,36,0,1,246,39,0,41,172,43,0,9,163,47,0,129,221,51,0,129,94,56,0,9,41,61,0,41,64,66,0,1,167,71,0,193,96,77,0,169,112,83,0,9,218,89,0,65,160,96,0,193,198,103,0,9,81,111,0,169,66,119,0,65,159,127,0,129,106,136,0,41,168,145,0,9,92,155,0,1,138,165,0,1,54,176,0,9,100,187,0,41,24,199,0,129,86,211,0,65,35,224,0,169,130,237,0,9,121,251,0,193,10,10,1,65,60,25,1,9,18,41,1,169,144,57,1,193,188,74,1,1,155,92,1,41,48,111,1,9,129,130,1,129,146,150,1,129,105,171,1,9,11,193,1,41,124,215,1,1,194,238,1,193,225,6,2,169,224,31,2,9,196,57,2,65,145,84,2,193,77,112,2,9,255,140,2,169,170,170,2,65,86,201,2,129,7,233,2,41,196,9,3,9,146,43,3,1,119,78,3,1,121,114,3,9,158,151,3,41,236,189,3,129,105,229,3,65,28,14,4,169,10,56,4,9,59,99,4,193,179,143,4,65,123,189,4,9,152,236,4,169,16,29,5,193,235,78,5,1,48,130,5,41,228,182,5,9,15,237,5,129,183,36,6,129,228,93,6,9,157,152,6,41,232,212,6,1,205,18,7,193,82,82,7,169,128,147,7,9,94,214,7,65,242,26,8,193,68,97,8,9,93,169,8,169,66,243,8,65,253,62,9,129,148,140,9,41,16,220,9,9,120,45,10,1,212,128,10,1,44,214,10,9,136,45,11,41,240,134,11,129,108,226,11,65,5,64,12,169,194,159,12,9,173,1,13,193,204,101,13,65,42,204,13,9,206,52,14,169,192,159,14,193,10,13,15,1,181,124,15,41,200,238,15,9,77,99,16,129,76,218,16,129,207,83,17,9,223,207,17,41,132,78,18,1,200,207,18,193,179,83,19,169,80,218,19,9,168,99,20,65,195,239,20,193,171,126,21,9,107,16,22,169,10,165,22,65,148,60,23,129,17,215,23,41,140,116,24,9,14,21,25,1,161,184,25,1,79,95,26,9,34,9,27,41,36,182,27,129,95,102,28,65,222,25,29,169,170,208,29,9,207,138,30,193,85,72,31,65,73,9,32,9,180,205,32,169,160,149,33,193,25,97,34,1,42,48,35,41,220,2,36,9,59,217,36,129,81,179,37,147,6,0,0,69,14,0,0,15,28,0,0,17,51,0,0,91,87,0,0,13,142,0,0,119,221,0,0,57,77,1,0,99,230,1,0,149,179,2,0,31,193,3,0,33,29,5,0,171,215,6,0,221,2,9,0,7,179,11,0,201,254,14,0,51,255,18,0,229,207,23,0,47,143,29,0,49,94,36,0,251,96,44,0,173,190,53,0,151,161,64,0,89,55,77,0,3,177,91,0,53,67,108,0,63,38,127,0,65,150,148,0,75,211,172,0,125,33,200,0,39,201,230,0,233,22,9,1,211,91,47,1,133,237,89,1,79,38,137,1,81,101,189,1,155,14,247,1,77,139,54,2,183,73,124,2,121,189,200,2,163,95,28,3,213,174,119,3,95,47,219,3,97,107,71,4,235,242,188,4,29,92,60,5,71,67,198,5,9,75,91,6,115,28,252,6,37,103,169,7,111,225,99,8,113,72,44,9,59,96,3,10,237,243,233,10,215,213,224,11,153,223,232,12,67,242,2,14,117,246,47,15,127,220,112,16,129,156,198,17,139,54,50,19,189,178,180,20,103,33,79,22,41,155,2,24,19,65,208,25,197,60,185,27,143,192,190,29,145,7,226,31,219,85,36,34,141,248,134,36,247,69,11,39,185,157,178,41,227,104,126,44,21,26,112,47,159,45,137,50,161,41,203,53,43,158,55,57,93,37,208,60,135,99,150,64,73,7,140,68,179,201,178,72,101,110,12,77,175,195,154,81,177,162,95,86,123,239,92,91,45,153,148,96,23,154,8,102,217,247,186,107,131,195,173,113,181,25,227,119,191,34,93,126,29,35,0,0,113,77,0,0,145,156,0,0,253,38,1,0,101,12,2,0,233,119,3,0,153,162,5,0,53,214,8,0,45,112,13,0,225,228,19,0,33,195,28,0,237,183,40,0,117,146,56,0,89,72,77,0,41,250,103,0,37,248,137,0,61,199,180,0,81,38,234,0,177,19,44,1,221,210,124,1,133,242,222,1,201,82,85,2,185,43,227,2,21,20,140,3,77,8,84,4,193,113,63,5,65,46,83,6,205,151,148,7,149,140,9,9,57,119,184,10,73,87,168,12,5,202,224,14,93,19,106,17,49,39,77,20,209,178,147,23,189,38,72,27,165,192,117,31,169,149,40,36,217,156,109,41,245,185,82,47,109,200,230,53,161,166,57,61,97,65,92,69,173,159,96,78,181,238,89,88,25,142,92,99,105,28,126,111,229,131,213,124,255,189,0,0,1,168,1,0,143,107,3,0,241,158,6,0,63,35,12,0,193,61,21,0,143,182,35,0,241,252,57,0,255,81,91,0,1,250,139,0,15,117,209,0,113,191,50,1,63,154,184,1,193,220,109,2,15,207,95,3,113,142,158,4,255,123,61,6,1,182,83,8,143,156,252,10,241,97,88,14,63,167,140,18,193,37,197,23,143,101,52,30,241,129,20,38,255,251,167,47,1,156,58,59,15,98,34,73,113,134,192,89,63,138,130,109,193,88,227,132,1,14,4,0,145,33,9,0,17,44,19,0,65,238,37,0,65,79,71,0,145,67,128,0,17,247,221,0,1,70,115,1,1,146,90,2,17,1,184,3,145,53,188,5,65,143,167,8,65,6,206,12,17,178,155,18,145,15,154,26,1,26,118,37,1,76,7,52,145,158,87,71,17,157,172,96,65,166,145,129,35,81,22,0,197,158,50,0,23,185,107,0,153,246,216,0,107,137,160,1,13,196,254,2,31,1,80,5,33,217,29,9,51,108,48,15,213,162,164,24,167,103,8,39,41,253,125,60,123,181,231,91,29,119,29,137,175,160,45,201,173,142,123,0,137,230,25,1,57,150,94,2,61,22,216,4,181,99,119,9,225,40,198,17,33,3,52,32,117,72,130,56,125,87,87,96,191,91,175,2,129,216,39,6,247,132,94,13,233,254,173,27,127,139,235,54,129,183,229,104,23,3,156,193,193,12,255,14,57,106,133,34,25,238,145,75,129,120,43,158,51,225,9,84,32,0,10,0,20,46,100,1,221,121,0,0,188,100,0,0,29,123,0,0,93,123,0,0,111,123,0,0,15,124,0,0,87,124,0,0,60,103,0,0,32,0,16,0,102,38,171,1,159,124,0,0,82,103,0,0,159,126,0,0,223,126,0,0,253,126,0,0,253,127,0,0,69,128,0,0,82,107,0,0,48,117,0,0,112,23,0,0,32,209,255,255,32,209,255,255,0,64,0,0,108,34,0,0,66,15,0,0,18,6,0,0,77,2,0,0,219,0,0,0,237,0,0,0,153,0,0,0,73,0,0,0,30,0,0,0,12,0,0,0,7,0,0,0,0,64,0,0,147,93,0,0,189,112,0,0,237,121,0,0,178,125,0,0,36,127,0,0,0,0,0,0,240,0,0,0,1,0,0,0,2,0,0,0,3,0,0,0,4,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,5,0,0,0,3,0,0,0,4,0,0,0,1,0,0,0,2,0,0,0,2,0,0,0,2,0,0,0,0,0,0,0,40,1,0,0,6,0,0,0,7,0,0,0,1,0,0,0,0,0,0,0,88,1,0,0,1,0,0,0,8,0,0,0,3,0,0,0,4,0,0,0,2,0,0,0,0,0,0,0,72,1,0,0,1,0,0,0,9,0,0,0,3,0,0,0,4,0,0,0,3,0,0,0,0,0,0,0,216,1,0,0,1,0,0,0,10,0,0,0,3,0,0,0,4,0,0,0,1,0,0,0,3,0,0,0,3,0,0,0,3,0,0,0,0,0,1,0,2,0,3,0,4,0,5,0,6,0,7,0,8,0,10,0,12,0,14,0,16,0,20,0,24,0,28,0,34,0,40,0,48,0,60,0,78,0,100,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,0,8,0,8,0,8,0,16,0,16,0,16,0,21,0,21,0,24,0,29,0,34,0,36,0,0,0,96,0,192,0,32,1,128,1,32,0,128,0,224,0,64,1,160,1,64,0,160,0,0,1,96,1,192,1,8,0,104,0,200,0,40,1,136,1,40,0,136,0,232,0,72,1,168,1,72,0,168,0,8,1,104,1,200,1,16,0,112,0,208,0,48,1,144,1,48,0,144,0,240,0,80,1,176,1,80,0,176,0,16,1,112,1,208,1,24,0,120,0,216,0,56,1,152,1,56,0,152,0,248,0,88,1,184,1,88,0,184,0,24,1,120,1,216,1,4,0,100,0,196,0,36,1,132,1,36,0,132,0,228,0,68,1,164,1,68,0,164,0,4,1,100,1,196,1,12,0,108,0,204,0,44,1,140,1,44,0,140,0,236,0,76,1,172,1,76,0,172,0,12,1,108,1,204,1,20,0,116,0,212,0,52,1,148,1,52,0,148,0,244,0,84,1,180,1,84,0,180,0,20,1,116,1,212,1,28,0,124,0,220,0,60,1,156,1,60,0,156,0,252,0,92,1,188,1,92,0,188,0,28,1,124,1,220,1,1,0,97,0,193,0,33,1,129,1,33,0,129,0,225,0,65,1,161,1,65,0,161,0,1,1,97,1,193,1,9,0,105,0,201,0,41,1,137,1,41,0,137,0,233,0,73,1,169,1,73,0,169,0,9,1,105,1,201,1,17,0,113,0,209,0,49,1,145,1,49,0,145,0,241,0,81,1,177,1,81,0,177,0,17,1,113,1,209,1,25,0,121,0,217,0,57,1,153,1,57,0,153,0,249,0,89,1,185,1,89,0,185,0,25,1,121,1,217,1,5,0,101,0,197,0,37,1,133,1,37,0,133,0,229,0,69,1,165,1,69,0,165,0,5,1,101,1,197,1,13,0,109,0,205,0,45,1,141,1,45,0,141,0,237,0,77,1,173,1,77,0,173,0,13,1,109,1,205,1,21,0,117,0,213,0,53,1,149,1,53,0,149,0,245,0,85,1,181,1,85,0,181,0,21,1,117,1,213,1,29,0,125,0,221,0,61,1,157,1,61,0,157,0,253,0,93,1,189,1,93,0,189,0,29,1,125,1,221,1,2,0,98,0,194,0,34,1,130,1,34,0,130,0,226,0,66,1,162,1,66,0,162,0,2,1,98,1,194,1,10,0,106,0,202,0,42,1,138,1,42,0,138,0,234,0,74,1,170,1,74,0,170,0,10,1,106,1,202,1,18,0,114,0,210,0,50,1,146,1,50,0,146,0,242,0,82,1,178,1,82,0,178,0,18,1,114,1,210,1,26,0,122,0,218,0,58,1,154,1,58,0,154,0,250,0,90,1,186,1,90,0,186,0,26,1,122,1,218,1,6,0,102,0,198,0,38,1,134,1,38,0,134,0,230,0,70,1,166,1,70,0,166,0,6,1,102,1,198,1,14,0,110,0,206,0,46,1,142,1,46,0,142,0,238,0,78,1,174,1,78,0,174,0,14,1,110,1,206,1,22,0,118,0,214,0,54,1,150,1,54,0,150,0,246,0,86,1,182,1,86,0,182,0,22,1,118,1,214,1,30,0,126,0,222,0,62,1,158,1,62,0,158,0,254,0,94,1,190,1,94,0,190,0,30,1,126,1,222,1,3,0,99,0,195,0,35,1,131,1,35,0,131,0,227,0,67,1,163,1,67,0,163,0,3,1,99,1,195,1,11,0,107,0,203,0,43,1,139,1,43,0,139,0,235,0,75,1,171,1,75,0,171,0,11,1,107,1,203,1,19,0,115,0,211,0,51,1,147,1,51,0,147,0,243,0,83,1,179,1,83,0,179,0,19,1,115,1,211,1,27,0,123,0,219,0,59,1,155,1,59,0,155,0,251,0,91,1,187,1,91,0,187,0,27,1,123,1,219,1,7,0,103,0,199,0,39,1,135,1,39,0,135,0,231,0,71,1,167,1,71,0,167,0,7,1,103,1,199,1,15,0,111,0,207,0,47,1,143,1,47,0,143,0,239,0,79,1,175,1,79,0,175,0,15,1,111,1,207,1,23,0,119,0,215,0,55,1,151,1,55,0,151,0,247,0,87,1,183,1,87,0,183,0,23,1,119,1,215,1,31,0,127,0,223,0,63,1,159,1,63,0,159,0,255,0,95,1,191,1,95,0,191,0,31,1,127,1,223,1,0,0,48,0,96,0,144,0,192,0,16,0,64,0,112,0,160,0,208,0,32,0,80,0,128,0,176,0,224,0,4,0,52,0,100,0,148,0,196,0,20,0,68,0,116,0,164,0,212,0,36,0,84,0,132,0,180,0,228,0,8,0,56,0,104,0,152,0,200,0,24,0,72,0,120,0,168,0,216,0,40,0,88,0,136,0,184,0,232,0,12,0,60,0,108,0,156,0,204,0,28,0,76,0,124,0,172,0,220,0,44,0,92,0,140,0,188,0,236,0,1,0,49,0,97,0,145,0,193,0,17,0,65,0,113,0,161,0,209,0,33,0,81,0,129,0,177,0,225,0,5,0,53,0,101,0,149,0,197,0,21,0,69,0,117,0,165,0,213,0,37,0,85,0,133,0,181,0,229,0,9,0,57,0,105,0,153,0,201,0,25,0,73,0,121,0,169,0,217,0,41,0,89,0,137,0,185,0,233,0,13,0,61,0,109,0,157,0,205,0,29,0,77,0,125,0,173,0,221,0,45,0,93,0,141,0,189,0,237,0,2,0,50,0,98,0,146,0,194,0,18,0,66,0,114,0,162,0,210,0,34,0,82,0,130,0,178,0,226,0,6,0,54,0,102,0,150,0,198,0,22,0,70,0,118,0,166,0,214,0,38,0,86,0,134,0,182,0,230,0,10,0,58,0,106,0,154,0,202,0,26,0,74,0,122,0,170,0,218,0,42,0,90,0,138,0,186,0,234,0,14,0,62,0,110,0,158,0,206,0,30,0,78,0,126,0,174,0,222,0,46,0,94,0,142,0,190,0,238,0,3,0,51,0,99,0,147,0,195,0,19,0,67,0,115,0,163,0,211,0,35,0,83,0,131,0,179,0,227,0,7,0,55,0,103,0,151,0,199,0,23,0,71,0,119,0,167,0,215,0,39,0,87,0,135,0,183,0,231,0,11,0,59,0,107,0,155,0,203,0,27,0,75,0,123,0,171,0,219,0,43,0,91,0,139,0,187,0,235,0,15,0,63,0,111,0,159,0,207,0,31,0,79,0,127,0,175,0,223,0,47,0,95,0,143,0,191,0,239,0,0,0,24,0,48,0,72,0,96,0,8,0,32,0,56,0,80,0,104,0,16,0,40,0,64,0,88,0,112,0,4,0,28,0,52,0,76,0,100,0,12,0,36,0,60,0,84,0,108,0,20,0,44,0,68,0,92,0,116,0,1,0,25,0,49,0,73,0,97,0,9,0,33,0,57,0,81,0,105,0,17,0,41,0,65,0,89,0,113,0,5,0,29,0,53,0,77,0,101,0,13,0,37,0,61,0,85,0,109,0,21,0,45,0,69,0,93,0,117,0,2,0,26,0,50,0,74,0,98,0,10,0,34,0,58,0,82,0,106,0,18,0,42,0,66,0,90,0,114,0,6,0,30,0,54,0,78,0,102,0,14,0,38,0,62,0,86,0,110,0,22,0,46,0,70,0,94,0,118,0,3,0,27,0,51,0,75,0,99,0,11,0,35,0,59,0,83,0,107,0,19,0,43,0,67,0,91,0,115,0,7,0,31,0,55,0,79,0,103,0,15,0,39,0,63,0,87,0,111,0,23,0,47,0,71,0,95,0,119,0,0,0,12,0,24,0,36,0,48,0,4,0,16,0,28,0,40,0,52,0,8,0,20,0,32,0,44,0,56,0,1,0,13,0,25,0,37,0,49,0,5,0,17,0,29,0,41,0,53,0,9,0,21,0,33,0,45,0,57,0,2,0,14,0,26,0,38,0,50,0,6,0,18,0,30,0,42,0,54,0,10,0,22,0,34,0,46,0,58,0,3,0,15,0,27,0,39,0,51,0,7,0,19,0,31,0,43,0,55,0,11,0,23,0,35,0,47,0,59,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0,41,0,41,0,41,0,82,0,82,0,123,0,164,0,200,0,222,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,41,0,41,0,41,0,41,0,123,0,123,0,123,0,164,0,164,0,240,0,10,1,27,1,39,1,41,0,41,0,41,0,41,0,41,0,41,0,41,0,41,0,123,0,123,0,123,0,123,0,240,0,240,0,240,0,10,1,10,1,49,1,62,1,72,1,80,1,123,0,123,0,123,0,123,0,123,0,123,0,123,0,123,0,240,0,240,0,240,0,240,0,49,1,49,1,49,1,62,1,62,1,87,1,95,1,102,1,108,1,240,0,240,0,240,0,240,0,240,0,240,0,240,0,240,0,49,1,49,1,49,1,49,1,87,1,87,1,87,1,95,1,95,1,114,1,120,1,126,1,131,1,18,0,29,0,38,0,40,0,46,0,52,0,62,0,84,0,92,202,190,216,182,223,154,226,156,230,120,236,122,244,204,252,52,3,134,11,136,19,100,25,102,29,74,32,66,39,164,53,100,0,240,0,32,0,100,0,205,60,0,48,0,32,42,175,213,201,207,255,64,0,17,0,99,255,97,1,16,254,163,0,39,43,189,86,217,255,6,0,91,0,86,255,186,0,23,0,128,252,192,24,216,77,237,255,220,255,102,0,167,255,232,255,72,1,73,252,8,10,37,62,135,199,61,201,64,0,128,0,134,255,36,0,54,1,0,253,72,2,51,36,69,69,12,0,128,0,18,0,114,255,32,1,139,255,159,252,27,16,123,56,104,2,13,200,246,255,39,0,58,0,210,255,172,255,120,0,184,0,197,254,227,253,4,5,4,21,64,35,230,62,198,196,243,255,0,0,20,0,26,0,5,0,225,255,213,255,252,255,65,0,90,0,7,0,99,255,8,255,212,255,81,2,47,6,52,10,199,12,228,87,5,197,3,0,242,255,236,255,241,255,2,0,25,0,37,0,25,0,240,255,185,255,149,255,177,255,50,0,36,1,111,2,214,3,8,5,184,5,148,107,103,196,17,0,12,0,8,0,1,0,246,255,234,255,226,255,224,255,234,255,3,0,44,0,100,0,168,0,243,0,61,1,125,1,173,1,199,1,189,0,168,253,105,2,103,119,117,0,97,255,210,251,8,116,52,0,221,0,168,246,116,110,252,255,17,2,234,242,229,102,208,255,246,2,140,240,165,93,176,255,137,3,117,239,6,83,157,255,204,3,130,239,102,71,149,255,199,3,139,240,39,59,153,255,128,3,97,242,174,46,165,255,5,3,207,244,94,34,185,255,99,2,161,247,152,22,210,255,169,1,161,250,180,11,0,64,202,69,27,76,255,82,130,90,179,98,162,107,96,117,184,126,154,121,154,121,102,102,184,126,51,115,81,11,10,9,10,9,10,9,239,8,239,8,10,9,252,8,23,9,239,8,72,11,20,10,90,9,63,9,10,9,226,8,226,8,226,8,226,8,146,8,183,9,36,9,36,9,10,9,10,9,10,9,36,9,36,9,63,9,50,9,144,12,206,10,36,9,36,9,10,9,226,8,173,8,159,8,213,8,146,8,156,9,170,9,63,9,90,9,90,9,90,9,90,9,63,9,103,9,10,9,151,13,240,11,79,8,159,8,226,8,226,8,226,8,239,8,10,9,213,8,210,12,69,12,20,10,90,9,199,8,173,8,159,8,146,8,146,8,66,8,0,16,5,15,173,8,60,10,60,10,103,9,10,9,90,9,63,9,26,8,106,12,172,12,63,9,173,8,249,9,130,9,36,9,10,9,119,8,173,8,10,13,160,13,166,10,146,8,213,8,156,9,50,9,63,9,159,8,53,8,50,9,116,9,23,9,63,9,90,9,116,9,116,9,116,9,156,9,63,9,195,14,45,14,130,9,223,9,63,9,226,8,226,8,252,8,159,8,0,8,182,12,153,12,153,10,30,11,143,9,23,9,252,8,252,8,226,8,79,8,191,12,228,12,193,10,246,10,143,9,213,8,213,8,199,8,79,8,53,8,57,11,165,11,73,10,63,9,103,9,50,9,146,8,199,8,199,8,66,8,153,12,125,12,73,10,20,10,226,8,133,8,199,8,173,8,173,8,93,8,106,12,238,12,180,10,103,9,226,8,226,8,226,8,239,8,146,8,66,8,69,12,200,12,156,9,13,8,239,8,196,9,63,9,183,9,130,9,133,8,179,13,210,12,10,9,140,10,87,10,170,9,63,9,90,9,36,9,79,8,95,13,207,13,222,11,240,11,252,8,158,7,173,8,226,8,226,8,226,8,76,13,38,13,39,8,127,10,57,11,50,9,116,9,226,8,170,9,236,9,176,14,160,13,158,7,100,10,81,11,223,9,90,9,63,9,156,9,213,8,212,11,200,12,180,10,72,11,180,10,106,8,79,8,239,8,186,8,199,8,111,14,73,14,233,7,177,7,100,10,140,10,20,10,196,9,23,9,63,9,135,12,85,13,50,9,26,8,72,11,72,11,36,9,183,9,199,8,119,8,10,13,38,13,30,11,220,10,23,9,106,8,226,8,239,8,66,8,13,8,23,9,252,8,133,8,119,8,133,8,63,9,73,10,140,10,140,10,249,9,103,9,130,9,173,8,213,8,173,8,173,8,36,9,116,9,47,10,140,10,222,11,172,12,246,10,72,11,170,9,26,8,252,8,10,9,50,9,76,9,173,8,106,8,79,8,239,8,196,9,233,10,233,10,60,10,20,10,63,9,92,14,129,14,186,8,46,7,133,8,193,10,166,10,113,10,209,9,159,8,233,10,88,12,166,10,249,9,30,11,209,9,133,8,90,9,173,8,133,8,250,0,3,0,6,0,3,0,3,0,3,0,4,0,3,0,3,0,3,0,205,1,73,14,109,11,109,11,109,11,109,11,109,11,109,11,109,11,109,11,109,11,109,11,109,11,147,11,147,11,109,11,30,11,144,12,13,12,156,11,240,11,240,11,194,11,194,11,194,11,147,11,147,11,194,11,156,11,72,11,30,11,30,11,166,10,80,15,174,15,165,11,135,12,135,12,118,11,240,11,30,11,50,12,172,12,109,11,30,11,60,10,249,9,220,10,109,11,188,13,125,12,194,11,31,12,203,11,72,11,109,11,109,11,109,11,109,11,72,11,72,11,72,11,72,11,72,11,193,10,190,19,190,19,118,11,245,13,57,13,240,11,13,12,233,10,88,12,88,12,156,11,30,11,209,9,236,9,193,10,72,11,76,17,53,16,140,10,193,10,156,11,194,11,109,11,30,11,165,11,203,11,109,11,109,11,109,11,109,11,72,11,166,10,36,14,203,11,156,11,240,11,240,11,57,11,246,10,240,11,144,12,231,11,165,11,219,12,219,12,165,11,238,12,175,11,107,20,150,19,236,9,10,13,198,13,57,13,125,12,22,12,48,13,165,11,140,10,87,10,127,10,233,10,30,11,113,10,217,19,54,20,7,18,76,17,156,9,81,11,231,11,135,12,97,12,127,10,180,10,72,11,30,11,233,10,30,11,140,10,50,12,72,11,147,11,109,11,109,11,109,11,109,11,147,11,147,11,147,11,147,11,109,11,109,11,147,11,147,11,147,11,106,16,135,12,165,11,31,12,194,11,72,11,72,11,109,11,156,11,57,11,100,11,203,11,156,11,194,11,125,12,57,11,176,14,176,14,172,12,31,12,165,11,72,11,109,11,72,11,156,11,118,11,233,10,233,10,30,11,72,11,72,11,100,10,14,15,174,15,135,12,50,12,172,12,118,11,231,11,147,11,147,11,13,12,30,11,233,10,233,10,233,10,233,10,20,10,5,15,240,15,29,13,188,13,22,12,180,10,194,11,118,11,50,12,13,12,30,11,30,11,87,10,87,10,30,11,246,10,27,20,30,19,153,12,5,15,113,13,97,12,81,11,85,13,123,13,140,10,20,10,113,10,180,10,30,11,246,10,193,10,13,16,205,14,219,12,88,12,109,11,72,11,72,11,109,11,233,10,180,10,233,10,180,10,233,10,30,11,72,11,246,10,217,19,190,19,231,11,217,13,172,12,240,11,13,12,128,11,31,12,81,11,180,10,180,10,180,10,30,11,233,10,60,10,213,16,213,16,44,11,223,9,135,12,48,13,48,13,3,12,3,12,48,13,240,11,30,11,87,10,20,10,166,10,193,10,240,11,100,11,246,10,72,11,180,10,127,10,81,11,31,12,78,12,78,12,144,12,97,12,240,11,194,11,147,11,30,11,23,17,42,15,109,11,72,11,30,11,72,11,30,11,30,11,72,11,72,11,72,11,30,11,72,11,109,11,72,11,30,11,165,11,100,11,100,11,165,11,165,11,240,11,50,12,144,12,78,12,240,11,194,11,156,11,156,11,156,11,109,11,180,10,133,16,53,16,238,12,19,13,109,11,147,11,72,11,165,11,165,11,30,11,233,10,180,10,30,11,30,11,30,11,233,10,240,15,174,15,31,12,194,11,109,11,109,11,109,11,72,11,109,11,109,11,30,11,30,11,30,11,233,10,72,11,220,10,7,18,223,17,97,12,113,13,135,12,165,11,81,11,222,11,50,12,180,10,127,10,127,10,127,10,180,10,233,10,140,10,53,16,173,16,205,14,73,14,166,10,220,10,72,11,72,11,194,11,156,11,109,11,30,11,127,10,127,10,233,10,72,11,119,16,226,13,193,10,30,11,30,11,72,11,72,11,72,11,109,11,109,11,72,11,109,11,109,11,109,11,147,11,72,11,54,20,57,19,213,8,104,13,205,14,151,13,19,13,30,11,238,12,151,13,78,12,81,11,156,9,183,9,193,10,109,11,123,13,101,14,50,12,125,12,29,13,231,11,135,12,135,12,165,11,144,12,13,12,109,11,109,11,127,10,236,9,130,9,165,11,194,11,233,10,233,10,180,10,233,10,30,11,156,11,240,11,31,12,78,12,78,12,78,12,31,12,194,11,194,11,128,11,57,11,127,10,166,10,220,10,194,11,104,13,217,13,29,13,172,12,240,11,194,11,147,11,109,11,72,11,30,11,203,11,128,11,81,11,194,11,194,11,156,11,203,11,31,12,240,11,240,11,194,11,72,11,30,11,109,11,109,11,72,11,80,15,127,15,194,11,125,12,29,13,144,12,219,12,219,12,151,13,120,14,113,13,166,10,133,8,156,9,20,10,47,10,100,0,3,0,40,0,3,0,3,0,3,0,5,0,14,0,14,0,10,0,11,0,3,0,8,0,9,0,7,0,3,0,91,1,0,32,254,31,246,31,234,31,216,31,194,31,168,31,136,31,98,31,58,31,10,31,216,30,160,30,98,30,34,30,220,29,144,29,66,29,238,28,150,28,58,28,216,27,114,27,10,27,156,26,42,26,180,25,58,25,188,24,60,24,182,23,46,23,160,22,16,22,126,21,232,20,78,20,176,19,16,19,110,18,200,17,30,17,116,16,198,15,22,15,100,14,174,13,248,12,64,12,132,11,200,10,10,10,74,9,138,8,198,7,2,7,62,6,120,5,178,4,234,3,34,3,90,2,146,1,202,0,0,0,54,255,110,254,166,253,222,252,22,252,78,251,136,250,194,249,254,248,58,248,118,247,182,246,246,245,56,245,124,244,192,243,8,243,82,242,156,241,234,240,58,240,140,239,226,238,56,238,146,237,240,236,80,236,178,235,24,235,130,234,240,233,96,233,210,232,74,232,196,231,68,231,198,230,76,230,214,229,100,229,246,228,142,228,40,228,198,227,106,227,18,227,190,226,112,226,36,226,222,225,158,225,96,225,40,225,246,224,198,224,158,224,120,224,88,224,62,224,40,224,22,224,10,224,2,224,0,224,79,112,117,115,83,99,114,105,112,116,72,97,110,100,108,101,114,0,95,101,110,99,111,100,101,0,95,100,101,99,111,100,101,0,49,55,79,112,117,115,83,99,114,105,112,116,72,97,110,100,108,101,114,0,80,49,55,79,112,117,115,83,99,114,105,112,116,72,97,110,100,108,101,114,0,80,75,49,55,79,112,117,115,83,99,114,105,112,116,72,97,110,100,108,101,114,0,105,105,0,118,0,118,105,0,105,105,105,105,105,0,105,105,105,105,105,105,105,0,105,105,105,105,105,105,0,0,255,0,255,0,255,0,255,0,255,0,254,1,0,1,255,0,254,0,253,2,0,1,255,0,254,0,253,3,0,1,255,117,110,107,110,111,119,110,32,101,114,114,111,114,0,115,117,99,99,101,115,115,0,105,110,118,97,108,105,100,32,97,114,103,117,109,101,110,116,0,98,117,102,102,101,114,32,116,111,111,32,115,109,97,108,108,0,105,110,116,101,114,110,97,108,32,101,114,114,111,114,0,99,111,114,114,117,112,116,101,100,32,115,116,114,101,97,109,0,114,101,113,117,101,115,116,32,110,111,116,32,105,109,112,108,101,109,101,110,116,101,100,0,105,110,118,97,108,105,100,32,115,116,97,116,101,0,109,101,109,111,114,121,32,97,108,108,111,99,97,116,105,111,110,32,102,97,105,108,101,100,0,255,255,156,110,86,70,59,51,45,40,37,33,31,28,26,25,23,22,21,20,19,18,17,16,16,15,15,14,13,13,12,12,12,12,11,11,11,10,10,10,9,9,9,9,9,9,8,8,8,8,8,7,7,7,7,7,7,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,25,23,2,0,126,124,119,109,87,41,19,9,4,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,90,80,75,69,63,56,49,40,34,29,20,18,10,0,0,0,0,0,0,0,0,110,100,90,84,78,71,65,58,51,45,39,32,26,20,12,0,0,0,0,0,0,118,110,103,93,86,80,75,70,65,59,53,47,40,31,23,15,4,0,0,0,0,126,119,112,104,95,89,83,78,72,66,60,54,47,39,32,25,17,12,1,0,0,134,127,120,114,103,97,91,85,78,72,66,60,54,47,41,35,29,23,16,10,1,144,137,130,124,113,107,101,95,88,82,76,70,64,57,51,45,39,33,26,15,1,152,145,138,132,123,117,111,105,98,92,86,80,74,67,61,55,49,43,36,20,1,162,155,148,142,133,127,121,115,108,102,96,90,84,77,71,65,59,53,46,30,1,172,165,158,152,143,137,131,125,118,112,106,100,94,87,81,75,69,63,56,45,20,200,200,200,200,200,200,200,200,198,193,188,183,178,173,168,163,158,153,148,129,104,40,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,40,15,23,28,31,34,36,38,39,41,42,43,44,45,46,47,47,49,50,51,52,53,54,55,55,57,58,59,60,61,62,63,63,65,66,67,68,69,70,71,71,40,20,33,41,48,53,57,61,64,66,69,71,73,75,76,78,80,82,85,87,89,91,92,94,96,98,101,103,105,107,108,110,112,114,117,119,121,123,124,126,128,40,23,39,51,60,67,73,79,83,87,91,94,97,100,102,105,107,111,115,118,121,124,126,129,131,135,139,142,145,148,150,153,155,159,163,166,169,172,174,177,179,35,28,49,65,78,89,99,107,114,120,126,132,136,141,145,149,153,159,165,171,176,180,185,189,192,199,205,211,216,220,225,229,232,239,245,251,21,33,58,79,97,112,125,137,148,157,166,174,182,189,195,201,207,217,227,235,243,251,17,35,63,86,106,123,139,152,165,177,187,197,206,214,222,230,237,250,25,31,55,75,91,105,117,128,138,146,154,161,168,174,180,185,190,200,208,215,222,229,235,240,245,255,16,36,65,89,110,128,144,159,173,185,196,207,217,226,234,242,250,11,41,74,103,128,151,172,191,209,225,241,255,9,43,79,110,138,163,186,207,227,246,12,39,71,99,123,144,164,182,198,214,228,241,253,9,44,81,113,142,168,192,214,235,255,7,49,90,127,160,191,220,247,6,51,95,134,170,203,234,7,47,87,123,155,184,212,237,6,52,97,137,174,208,240,5,57,106,151,192,231,5,59,111,158,202,243,5,55,103,147,187,224,5,60,113,161,206,248,4,65,122,175,224,4,67,127,182,234,224,224,224,224,224,224,224,224,160,160,160,160,185,185,185,178,178,168,134,61,37,224,224,224,224,224,224,224,224,240,240,240,240,207,207,207,198,198,183,144,66,40,160,160,160,160,160,160,160,160,185,185,185,185,193,193,193,183,183,172,138,64,38,240,240,240,240,240,240,240,240,207,207,207,207,204,204,204,193,193,180,143,66,40,185,185,185,185,185,185,185,185,193,193,193,193,193,193,193,183,183,172,138,65,39,207,207,207,207,207,207,207,207,204,204,204,204,201,201,201,188,188,176,141,66,40,193,193,193,193,193,193,193,193,193,193,193,193,194,194,194,184,184,173,139,65,39,204,204,204,204,204,204,204,204,201,201,201,201,198,198,198,187,187,175,140,66,40,72,127,65,129,66,128,65,128,64,128,62,128,64,128,64,128,92,78,92,79,92,78,90,79,116,41,115,40,114,40,132,26,132,26,145,17,161,12,176,10,177,11,24,179,48,138,54,135,54,132,53,134,56,133,55,132,55,132,61,114,70,96,74,88,75,88,87,74,89,66,91,67,100,59,108,50,120,40,122,37,97,43,78,50,83,78,84,81,88,75,86,74,87,71,90,73,93,74,93,74,109,40,114,36,117,34,117,34,143,17,145,18,146,19,162,12,165,10,178,7,189,6,190,8,177,9,23,178,54,115,63,102,66,98,69,99,74,89,71,91,73,91,78,89,86,80,92,66,93,64,102,59,103,60,104,60,117,52,123,44,138,35,133,31,97,38,77,45,61,90,93,60,105,42,107,41,110,45,116,38,113,38,112,38,124,26,132,27,136,19,140,20,155,14,159,16,158,18,170,13,177,10,187,8,192,6,175,9,159,10,21,178,59,110,71,86,75,85,84,83,91,66,88,73,87,72,92,75,98,72,105,58,107,54,115,52,114,55,112,56,129,51,132,40,150,33,140,29,98,35,77,42,42,121,96,66,108,43,111,40,117,44,123,32,120,36,119,33,127,33,134,34,139,21,147,23,152,20,158,25,154,26,166,21,173,16,184,13,184,10,150,13,139,15,22,178,63,114,74,82,84,83,92,82,103,62,96,72,96,67,101,73,107,72,113,55,118,52,125,52,118,52,117,55,135,49,137,39,157,32,145,29,97,33,77,40,2,1,0,0,8,13,16,19,21,23,24,26,27,28,29,30,31,32,32,33,34,34,35,36,36,37,37,224,112,44,15,3,2,1,0,254,237,192,132,70,23,4,0,255,252,226,155,61,11,2,0,250,245,234,203,71,50,42,38,35,33,31,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0,179,99,0,71,56,43,30,21,12,6,0,199,165,144,124,109,96,84,71,61,51,42,32,23,15,8,0,241,225,211,199,187,175,164,153,142,132,123,114,105,96,88,80,72,64,57,50,44,38,33,29,24,20,16,12,9,5,2,0,15,131,138,138,155,155,173,173,69,93,115,118,131,138,141,138,150,150,155,150,155,160,166,160,131,128,134,141,141,141,145,145,145,150,155,155,155,155,160,160,160,160,166,166,173,173,182,192,182,192,192,192,205,192,205,224,4,6,24,7,5,0,0,2,0,0,12,28,41,13,252,247,15,42,25,14,1,254,62,41,247,246,37,65,252,3,250,4,66,7,248,16,14,38,253,33,13,22,39,23,12,255,36,64,27,250,249,10,55,43,17,1,1,8,1,1,6,245,74,53,247,244,55,76,244,8,253,3,93,27,252,26,39,59,3,248,2,0,77,11,9,248,22,44,250,7,40,9,26,3,9,249,20,101,249,4,3,248,42,26,0,241,33,68,2,23,254,55,46,254,15,3,255,21,16,41,250,27,61,39,5,245,42,88,4,1,254,60,65,6,252,255,251,73,56,1,247,19,94,29,247,0,12,99,6,4,8,237,102,46,243,3,2,13,3,2,9,235,84,72,238,245,46,104,234,8,18,38,48,23,0,240,70,83,235,11,5,245,117,22,248,250,23,117,244,3,3,248,95,28,4,246,15,77,60,241,255,4,124,2,252,3,38,84,24,231,2,13,42,13,31,21,252,56,46,255,255,35,79,243,19,249,65,88,247,242,20,4,81,49,227,20,0,75,3,239,5,247,44,92,248,1,253,22,69,31,250,95,41,244,5,39,67,16,252,1,0,250,120,55,220,243,44,122,4,232,81,5,11,3,7,2,0,9,10,88,46,2,90,87,93,91,82,98,109,120,118,12,113,115,117,119,99,59,87,111,63,111,112,80,126,124,125,124,129,121,126,23,132,127,127,127,126,127,122,133,130,134,101,118,119,145,126,86,124,120,123,119,170,173,107,109,8,16,32,249,247,246,245,244,234,210,202,201,200,197,174,82,59,56,55,54,46,22,12,11,10,9,7,0,64,0,203,150,0,215,195,166,125,110,82,0,120,0,128,64,0,232,158,10,0,230,0,243,221,192,181,0,171,85,0,192,128,64,0,205,154,102,51,0,213,171,128,85,43,0,224,192,160,128,96,64,32,0,100,40,16,7,3,1,0,253,250,244,233,212,182,150,131,120,110,98,85,72,60,49,40,32,25,19,15,13,11,9,8,7,6,5,4,3,2,1,0,210,208,206,203,199,193,183,168,142,104,74,52,37,27,20,14,10,6,4,2,0,223,201,183,167,152,138,124,111,98,88,79,70,62,56,50,44,39,35,31,27,24,21,18,16,14,12,10,8,6,4,3,2,1,0,188,176,155,138,119,97,67,43,26,10,0,165,119,80,61,47,35,27,20,14,9,4,0,113,63,0,125,51,26,18,15,12,11,10,9,8,7,6,5,4,3,2,1,0,198,105,45,22,15,12,11,10,9,8,7,6,5,4,3,2,1,0,213,162,116,83,59,43,32,24,18,15,12,9,7,6,5,3,2,0,239,187,116,59,28,16,11,10,9,8,7,6,5,4,3,2,1,0,250,229,188,135,86,51,30,19,13,10,8,6,5,4,3,2,1,0,249,235,213,185,156,128,103,83,66,53,42,33,26,21,17,13,10,0,254,249,235,206,164,118,77,46,27,16,10,7,5,4,3,2,1,0,255,253,249,239,220,191,156,119,85,57,37,23,15,10,6,4,2,0,255,253,251,246,237,223,203,179,152,124,98,75,55,40,29,21,15,0,255,254,253,247,220,162,106,67,42,28,18,12,9,6,4,3,2,0,31,57,107,160,205,205,255,255,255,255,255,255,255,255,255,255,255,255,69,47,67,111,166,205,255,255,255,255,255,255,255,255,255,255,255,255,82,74,79,95,109,128,145,160,173,205,205,205,224,255,255,224,255,224,125,74,59,69,97,141,182,255,255,255,255,255,255,255,255,255,255,255,173,115,85,73,76,92,115,145,173,205,224,224,255,255,255,255,255,255,166,134,113,102,101,102,107,118,125,138,145,155,166,182,192,192,205,150,224,182,134,101,83,79,85,97,120,145,173,205,224,255,255,255,255,255,255,224,192,150,120,101,92,89,93,102,118,134,160,182,192,224,224,224,255,224,224,182,155,134,118,109,104,102,106,111,118,131,145,160,173,131,241,190,178,132,87,74,41,14,0,223,193,157,140,106,57,39,18,0,131,74,141,79,80,138,95,104,134,95,99,91,125,93,76,123,115,123,128,0,214,42,0,235,128,21,0,244,184,72,11,0,248,214,128,42,7,0,248,225,170,80,25,5,0,251,236,198,126,54,18,3,0,250,238,211,159,82,35,15,5,0,250,231,203,168,128,88,53,25,6,0,252,238,216,185,148,108,71,40,18,4,0,253,243,225,199,166,128,90,57,31,13,3,0,254,246,233,212,183,147,109,73,44,23,10,2,0,255,250,240,223,198,166,128,90,58,33,16,6,1,0,255,251,244,231,210,181,146,110,75,46,25,12,5,1,0,255,253,248,238,221,196,164,128,92,60,35,18,8,3,1,0,255,253,249,242,229,208,180,146,110,76,48,27,14,7,3,1,0,129,0,207,50,0,236,129,20,0,245,185,72,10,0,249,213,129,42,6,0,250,226,169,87,27,4,0,251,233,194,130,62,20,4,0,250,236,207,160,99,47,17,3,0,255,240,217,182,131,81,41,11,1,0,255,254,233,201,159,107,61,20,2,1,0,255,249,233,206,170,128,86,50,23,7,1,0,255,250,238,217,186,148,108,70,39,18,6,1,0,255,252,243,226,200,166,128,90,56,30,13,4,1,0,255,252,245,231],"i8",ALLOC_NONE,Runtime.GLOBAL_BASE+20480);allocate([209,180,146,110,76,47,25,11,4,1,0,255,253,248,237,219,194,163,128,93,62,37,19,8,3,1,0,255,254,250,241,226,205,177,145,111,79,51,30,15,6,2,1,0,129,0,203,54,0,234,129,23,0,245,184,73,10,0,250,215,129,41,5,0,252,232,173,86,24,3,0,253,240,200,129,56,15,2,0,253,244,217,164,94,38,10,1,0,253,245,226,189,132,71,27,7,1,0,253,246,231,203,159,105,56,23,6,1,0,255,248,235,213,179,133,85,47,19,5,1,0,255,254,243,221,194,159,117,70,37,12,2,1,0,255,254,248,234,208,171,128,85,48,22,8,2,1,0,255,254,250,240,220,189,149,107,67,36,16,6,2,1,0,255,254,251,243,227,201,166,128,90,55,29,13,5,2,1,0,255,254,252,246,234,213,183,147,109,73,43,22,10,4,2,1,0,130,0,200,58,0,231,130,26,0,244,184,76,12,0,249,214,130,43,6,0,252,232,173,87,24,3,0,253,241,203,131,56,14,2,0,254,246,221,167,94,35,8,1,0,254,249,232,193,130,65,23,5,1,0,255,251,239,211,162,99,45,15,4,1,0,255,251,243,223,186,131,74,33,11,3,1,0,255,252,245,230,202,158,105,57,24,8,2,1,0,255,253,247,235,214,179,132,84,44,19,7,2,1,0,255,254,250,240,223,196,159,112,69,36,15,6,2,1,0,255,254,253,245,231,209,176,136,93,55,27,11,3,2,1,0,255,254,253,252,239,221,194,158,117,76,42,18,4,3,2,1,0,0,0,2,5,9,14,20,27,35,44,54,65,77,90,104,119,135,254,49,67,77,82,93,99,198,11,18,24,31,36,45,255,46,66,78,87,94,104,208,14,21,32,42,51,66,255,94,104,109,112,115,118,248,53,69,80,88,95,102,6,0,3,0,7,3,0,1,10,0,2,6,18,10,12,4,0,2,0,0,0,9,4,7,4,0,3,12,7,7,0,1,1,1,2,3,3,3,2,3,3,3,2,3,3,3,0,3,12,15,48,51,60,63,192,195,204,207,240,243,252,255,12,35,60,83,108,132,157,180,206,228,15,32,55,77,101,125,151,175,201,225,19,42,66,89,114,137,162,184,209,230,12,25,50,72,97,120,147,172,200,223,26,44,69,90,114,135,159,180,205,225,13,22,53,80,106,130,156,180,205,228,15,25,44,64,90,115,142,168,196,222,19,24,62,82,100,120,145,168,190,214,22,31,50,79,103,120,151,170,203,227,21,29,45,65,106,124,150,171,196,224,30,49,75,97,121,142,165,186,209,229,19,25,52,70,93,116,143,166,192,219,26,34,62,75,97,118,145,167,194,217,25,33,56,70,91,113,143,165,196,223,21,34,51,72,97,117,145,171,196,222,20,29,50,67,90,117,144,168,197,221,22,31,48,66,95,117,146,168,196,222,24,33,51,77,116,134,158,180,200,224,21,28,70,87,106,124,149,170,194,217,26,33,53,64,83,117,152,173,204,225,27,34,65,95,108,129,155,174,210,225,20,26,72,99,113,131,154,176,200,219,34,43,61,78,93,114,155,177,205,229,23,29,54,97,124,138,163,179,209,229,30,38,56,89,118,129,158,178,200,231,21,29,49,63,85,111,142,163,193,222,27,48,77,103,133,158,179,196,215,232,29,47,74,99,124,151,176,198,220,237,33,42,61,76,93,121,155,174,207,225,29,53,87,112,136,154,170,188,208,227,24,30,52,84,131,150,166,186,203,229,37,48,64,84,104,118,156,177,201,230,212,178,148,129,108,96,85,82,79,77,61,59,57,56,51,49,48,45,42,41,40,38,36,34,31,30,21,12,10,3,1,0,255,245,244,236,233,225,217,203,190,176,175,161,149,136,125,114,102,91,81,71,60,52,43,35,28,20,19,18,12,11,5,0,179,138,140,148,151,149,153,151,163,116,67,82,59,92,72,100,89,92,16,0,0,0,0,99,66,36,36,34,36,34,34,34,34,83,69,36,52,34,116,102,70,68,68,176,102,68,68,34,65,85,68,84,36,116,141,152,139,170,132,187,184,216,137,132,249,168,185,139,104,102,100,68,68,178,218,185,185,170,244,216,187,187,170,244,187,187,219,138,103,155,184,185,137,116,183,155,152,136,132,217,184,184,170,164,217,171,155,139,244,169,184,185,170,164,216,223,218,138,214,143,188,218,168,244,141,136,155,170,168,138,220,219,139,164,219,202,216,137,168,186,246,185,139,116,185,219,185,138,100,100,134,100,102,34,68,68,100,68,168,203,221,218,168,167,154,136,104,70,164,246,171,137,139,137,155,218,219,139,255,254,253,238,14,3,2,1,0,255,254,252,218,35,3,2,1,0,255,254,250,208,59,4,2,1,0,255,254,246,194,71,10,2,1,0,255,252,236,183,82,8,2,1,0,255,252,235,180,90,17,2,1,0,255,248,224,171,97,30,4,1,0,255,254,236,173,95,37,7,1,0,255,255,255,131,6,145,255,255,255,255,255,236,93,15,96,255,255,255,255,255,194,83,25,71,221,255,255,255,255,162,73,34,66,162,255,255,255,210,126,73,43,57,173,255,255,255,201,125,71,48,58,130,255,255,255,166,110,73,57,62,104,210,255,255,251,123,65,55,68,100,171,255,7,23,38,54,69,85,100,116,131,147,162,178,193,208,223,239,13,25,41,55,69,83,98,112,127,142,157,171,187,203,220,236,15,21,34,51,61,78,92,106,126,136,152,167,185,205,225,240,10,21,36,50,63,79,95,110,126,141,157,173,189,205,221,237,17,20,37,51,59,78,89,107,123,134,150,164,184,205,224,240,10,15,32,51,67,81,96,112,129,142,158,173,189,204,220,236,8,21,37,51,65,79,98,113,126,138,155,168,179,192,209,218,12,15,34,55,63,78,87,108,118,131,148,167,185,203,219,236,16,19,32,36,56,79,91,108,118,136,154,171,186,204,220,237,11,28,43,58,74,89,105,120,135,150,165,180,196,211,226,241,6,16,33,46,60,75,92,107,123,137,156,169,185,199,214,225,11,19,30,44,57,74,89,105,121,135,152,169,186,202,218,234,12,19,29,46,57,71,88,100,120,132,148,165,182,199,216,233,17,23,35,46,56,77,92,106,123,134,152,167,185,204,222,237,14,17,45,53,63,75,89,107,115,132,151,171,188,206,221,240,9,16,29,40,56,71,88,103,119,137,154,171,189,205,222,237,16,19,36,48,57,76,87,105,118,132,150,167,185,202,218,236,12,17,29,54,71,81,94,104,126,136,149,164,182,201,221,237,15,28,47,62,79,97,115,129,142,155,168,180,194,208,223,238,8,14,30,45,62,78,94,111,127,143,159,175,192,207,223,239,17,30,49,62,79,92,107,119,132,145,160,174,190,204,220,235,14,19,36,45,61,76,91,108,121,138,154,172,189,205,222,238,12,18,31,45,60,76,91,107,123,138,154,171,187,204,221,236,13,17,31,43,53,70,83,103,114,131,149,167,185,203,220,237,17,22,35,42,58,78,93,110,125,139,155,170,188,206,224,240,8,15,34,50,67,83,99,115,131,146,162,178,193,209,224,239,13,16,41,66,73,86,95,111,128,137,150,163,183,206,225,241,17,25,37,52,63,75,92,102,119,132,144,160,175,191,212,231,19,31,49,65,83,100,117,133,147,161,174,187,200,213,227,242,18,31,52,68,88,103,117,126,138,149,163,177,192,207,223,239,16,29,47,61,76,90,106,119,133,147,161,176,193,209,224,240,15,21,35,50,61,73,86,97,110,119,129,141,175,198,218,237,225,204,201,184,183,175,158,154,153,135,119,115,113,110,109,99,98,95,79,68,52,50,48,45,43,32,31,27,18,10,3,0,255,251,235,230,212,201,196,182,167,166,163,151,138,124,110,104,90,78,76,70,69,57,45,34,24,21,11,6,5,4,3,0,175,148,160,176,178,173,174,164,177,174,196,182,198,192,182,68,62,66,60,72,117,85,90,118,136,151,142,160,142,155,0,0,0,0,0,0,0,1,100,102,102,68,68,36,34,96,164,107,158,185,180,185,139,102,64,66,36,34,34,0,1,32,208,139,141,191,152,185,155,104,96,171,104,166,102,102,102,132,1,0,0,0,0,16,16,0,80,109,78,107,185,139,103,101,208,212,141,139,173,153,123,103,36,0,0,0,0,0,0,1,48,0,0,0,0,0,0,32,68,135,123,119,119,103,69,98,68,103,120,118,118,102,71,98,134,136,157,184,182,153,139,134,208,168,248,75,189,143,121,107,32,49,34,34,34,0,17,2,210,235,139,123,185,137,105,134,98,135,104,182,100,183,171,134,100,70,68,70,66,66,34,131,64,166,102,68,36,2,1,0,134,166,102,68,34,34,66,132,212,246,158,139,107,107,87,102,100,219,125,122,137,118,103,132,114,135,137,105,171,106,50,34,164,214,141,143,185,151,121,103,192,34,0,0,0,0,0,1,208,109,74,187,134,249,159,137,102,110,154,118,87,101,119,101,0,2,0,36,36,66,68,35,96,164,102,100,36,0,2,33,167,138,174,102,100,84,2,2,100,107,120,119,36,197,24,0,255,254,253,244,12,3,2,1,0,255,254,252,224,38,3,2,1,0,255,254,251,209,57,4,2,1,0,255,254,244,195,69,4,2,1,0,255,251,232,184,84,7,2,1,0,255,254,240,186,86,14,2,1,0,255,254,239,178,91,30,5,1,0,255,248,227,177,100,19,2,1,0,255,255,255,156,4,154,255,255,255,255,255,227,102,15,92,255,255,255,255,255,213,83,24,72,236,255,255,255,255,150,76,33,63,214,255,255,255,190,121,77,43,55,185,255,255,255,245,137,71,43,59,139,255,255,255,255,131,66,50,66,107,194,255,255,166,116,76,55,53,125,255,255,0,15,8,7,4,11,12,3,2,13,10,5,6,9,14,1,0,9,6,3,4,5,8,1,2,7,0,1,0,0,0,1,0,0,1,255,1,255,2,254,2,254,3,253,0,1,0,1,255,2,255,2,254,3,254,3,253,7,254,7,0,2,255,255,255,0,0,1,1,0,1,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,255,2,1,0,1,1,0,0,255,255,0,0,1,255,0,1,255,0,255,1,254,2,254,254,2,253,2,3,253,252,3,252,4,4,251,5,250,251,6,249,6,5,8,247,0,0,1,0,0,0,0,0,0,0,255,1,0,0,1,255,0,1,255,255,1,255,2,1,255,2,254,254,2,254,2,2,3,253,0,1,0,0,0,0,0,0,1,0,1,0,0,1,255,1,0,0,2,1,255,2,255,255,2,255,2,2,255,3,254,254,254,3,0,1,0,0,1,0,1,255,2,255,2,255,2,3,254,3,254,254,4,4,253,5,253,252,6,252,6,5,251,8,250,251,249,9,251,8,255,6,255,6,252,10,250,10,254,6,255,6,251,10,247,12,253,7,254,7,249,13,16,24,34,118,111,105,100,0,98,111,111,108,0,99,104,97,114,0,115,105,103,110,101,100,32,99,104,97,114,0,117,110,115,105,103,110,101,100,32,99,104,97,114,0,115,104,111,114,116,0,117,110,115,105,103,110,101,100,32,115,104,111,114,116,0,105,110,116,0,117,110,115,105,103,110,101,100,32,105,110,116,0,108,111,110,103,0,117,110,115,105,103,110,101,100,32,108,111,110,103,0,102,108,111,97,116,0,100,111,117,98,108,101,0,78,83,116,51,95,95,49,49,50,98,97,115,105,99,95,115,116,114,105,110,103,73,99,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,99,69,69,78,83,95,57,97,108,108,111,99,97,116,111,114,73,99,69,69,69,69,0,78,83,116,51,95,95,49,50,49,95,95,98,97,115,105,99,95,115,116,114,105,110,103,95,99,111,109,109,111,110,73,76,98,49,69,69,69,0,115,116,100,58,58,115,116,114,105,110,103,0,78,83,116,51,95,95,49,49,50,98,97,115,105,99,95,115,116,114,105,110,103,73,104,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,104,69,69,78,83,95,57,97,108,108,111,99,97,116,111,114,73,104,69,69,69,69,0,115,116,100,58,58,98,97,115,105,99,95,115,116,114,105,110,103,60,117,110,115,105,103,110,101,100,32,99,104,97,114,62,0,78,83,116,51,95,95,49,49,50,98,97,115,105,99,95,115,116,114,105,110,103,73,119,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,119,69,69,78,83,95,57,97,108,108,111,99,97,116,111,114,73,119,69,69,69,69,0,115,116,100,58,58,119,115,116,114,105,110,103,0,78,49,48,101,109,115,99,114,105,112,116,101,110,51,118,97,108,69,0,101,109,115,99,114,105,112,116,101,110,58,58,118,97,108,0,78,49,48,101,109,115,99,114,105,112,116,101,110,49,49,109,101,109,111,114,121,95,118,105,101,119,73,99,69,69,0,101,109,115,99,114,105,112,116,101,110,58,58,109,101,109,111,114,121,95,118,105,101,119,60,99,104,97,114,62,0,78,49,48,101,109,115,99,114,105,112,116,101,110,49,49,109,101,109,111,114,121,95,118,105,101,119,73,97,69,69,0,101,109,115,99,114,105,112,116,101,110,58,58,109,101,109,111,114,121,95,118,105,101,119,60,115,105,103,110,101,100,32,99,104,97,114,62,0,78,49,48,101,109,115,99,114,105,112,116,101,110,49,49,109,101,109,111,114,121,95,118,105,101,119,73,104,69,69,0,101,109,115,99,114,105,112,116,101,110,58,58,109,101,109,111,114,121,95,118,105,101,119,60,117,110,115,105,103,110,101,100,32,99,104,97,114,62,0,78,49,48,101,109,115,99,114,105,112,116,101,110,49,49,109,101,109,111,114,121,95,118,105,101,119,73,115,69,69,0,101,109,115,99,114,105,112,116,101,110,58,58,109,101,109,111,114,121,95,118,105,101,119,60,115,104,111,114,116,62,0,78,49,48,101,109,115,99,114,105,112,116,101,110,49,49,109,101,109,111,114,121,95,118,105,101,119,73,116,69,69,0,101,109,115,99,114,105,112,116,101,110,58,58,109,101,109,111,114,121,95,118,105,101,119,60,117,110,115,105,103,110,101,100,32,115,104,111,114,116,62,0,78,49,48,101,109,115,99,114,105,112,116,101,110,49,49,109,101,109,111,114,121,95,118,105,101,119,73,105,69,69,0,101,109,115,99,114,105,112,116,101,110,58,58,109,101,109,111,114,121,95,118,105,101,119,60,105,110,116,62,0,78,49,48,101,109,115,99,114,105,112,116,101,110,49,49,109,101,109,111,114,121,95,118,105,101,119,73,106,69,69,0,101,109,115,99,114,105,112,116,101,110,58,58,109,101,109,111,114,121,95,118,105,101,119,60,117,110,115,105,103,110,101,100,32,105,110,116,62,0,78,49,48,101,109,115,99,114,105,112,116,101,110,49,49,109,101,109,111,114,121,95,118,105,101,119,73,108,69,69,0,101,109,115,99,114,105,112,116,101,110,58,58,109,101,109,111,114,121,95,118,105,101,119,60,108,111,110,103,62,0,78,49,48,101,109,115,99,114,105,112,116,101,110,49,49,109,101,109,111,114,121,95,118,105,101,119,73,109,69,69,0,101,109,115,99,114,105,112,116,101,110,58,58,109,101,109,111,114,121,95,118,105,101,119,60,117,110,115,105,103,110,101,100,32,108,111,110,103,62,0,101,109,115,99,114,105,112,116,101,110,58,58,109,101,109,111,114,121,95,118,105,101,119,60,105,110,116,56,95,116,62,0,101,109,115,99,114,105,112,116,101,110,58,58,109,101,109,111,114,121,95,118,105,101,119,60,117,105,110,116,56,95,116,62,0,101,109,115,99,114,105,112,116,101,110,58,58,109,101,109,111,114,121,95,118,105,101,119,60,105,110,116,49,54,95,116,62,0,101,109,115,99,114,105,112,116,101,110,58,58,109,101,109,111,114,121,95,118,105,101,119,60,117,105,110,116,49,54,95,116,62,0,101,109,115,99,114,105,112,116,101,110,58,58,109,101,109,111,114,121,95,118,105,101,119,60,105,110,116,51,50,95,116,62,0,101,109,115,99,114,105,112,116,101,110,58,58,109,101,109,111,114,121,95,118,105,101,119,60,117,105,110,116,51,50,95,116,62,0,78,49,48,101,109,115,99,114,105,112,116,101,110,49,49,109,101,109,111,114,121,95,118,105,101,119,73,102,69,69,0,101,109,115,99,114,105,112,116,101,110,58,58,109,101,109,111,114,121,95,118,105,101,119,60,102,108,111,97,116,62,0,78,49,48,101,109,115,99,114,105,112,116,101,110,49,49,109,101,109,111,114,121,95,118,105,101,119,73,100,69,69,0,101,109,115,99,114,105,112,116,101,110,58,58,109,101,109,111,114,121,95,118,105,101,119,60,100,111,117,98,108,101,62,0,78,49,48,101,109,115,99,114,105,112,116,101,110,49,49,109,101,109,111,114,121,95,118,105,101,119,73,101,69,69,0,101,109,115,99,114,105,112,116,101,110,58,58,109,101,109,111,114,121,95,118,105,101,119,60,108,111,110,103,32,100,111,117,98,108,101,62,0,78,49,48,95,95,99,120,120,97,98,105,118,49,50,48,95,95,115,105,95,99,108,97,115,115,95,116,121,112,101,95,105,110,102,111,69,0,78,49,48,95,95,99,120,120,97,98,105,118,49,49,54,95,95,115,104,105,109,95,116,121,112,101,95,105,110,102,111,69,0,83,116,57,116,121,112,101,95,105,110,102,111,0,78,49,48,95,95,99,120,120,97,98,105,118,49,49,55,95,95,99,108,97,115,115,95,116,121,112,101,95,105,110,102,111,69,0,83,116,57,101,120,99,101,112,116,105,111,110,0,83,116,57,98,97,100,95,97,108,108,111,99,0,115,116,100,58,58,98,97,100,95,97,108,108,111,99,0,78,49,48,95,95,99,120,120,97,98,105,118,49,49,57,95,95,112,111,105,110,116,101,114,95,116,121,112,101,95,105,110,102,111,69,0,78,49,48,95,95,99,120,120,97,98,105,118,49,49,55,95,95,112,98,97,115,101,95,116,121,112,101,95,105,110,102,111,69,0,78,49,48,95,95,99,120,120,97,98,105,118,49,50,51,95,95,102,117,110,100,97,109,101,110,116,97,108,95,116,121,112,101,95,105,110,102,111,69,0,118,0,68,110,0,98,0,99,0,104,0,97,0,115,0,116,0,105,0,106,0,108,0,109,0,102,0,100,0,78,49,48,95,95,99,120,120,97,98,105,118,49,50,49,95,95,118,109,105,95,99,108,97,115,115,95,116,121,112,101,95,105,110,102,111,69,0],"i8",ALLOC_NONE,Runtime.GLOBAL_BASE+30720);var tempDoublePtr=STATICTOP;STATICTOP+=16;function ___setErrNo(value){if(Module["___errno_location"])HEAP32[Module["___errno_location"]()>>2]=value;return value}var ERRNO_CODES={EPERM:1,ENOENT:2,ESRCH:3,EINTR:4,EIO:5,ENXIO:6,E2BIG:7,ENOEXEC:8,EBADF:9,ECHILD:10,EAGAIN:11,EWOULDBLOCK:11,ENOMEM:12,EACCES:13,EFAULT:14,ENOTBLK:15,EBUSY:16,EEXIST:17,EXDEV:18,ENODEV:19,ENOTDIR:20,EISDIR:21,EINVAL:22,ENFILE:23,EMFILE:24,ENOTTY:25,ETXTBSY:26,EFBIG:27,ENOSPC:28,ESPIPE:29,EROFS:30,EMLINK:31,EPIPE:32,EDOM:33,ERANGE:34,ENOMSG:42,EIDRM:43,ECHRNG:44,EL2NSYNC:45,EL3HLT:46,EL3RST:47,ELNRNG:48,EUNATCH:49,ENOCSI:50,EL2HLT:51,EDEADLK:35,ENOLCK:37,EBADE:52,EBADR:53,EXFULL:54,ENOANO:55,EBADRQC:56,EBADSLT:57,EDEADLOCK:35,EBFONT:59,ENOSTR:60,ENODATA:61,ETIME:62,ENOSR:63,ENONET:64,ENOPKG:65,EREMOTE:66,ENOLINK:67,EADV:68,ESRMNT:69,ECOMM:70,EPROTO:71,EMULTIHOP:72,EDOTDOT:73,EBADMSG:74,ENOTUNIQ:76,EBADFD:77,EREMCHG:78,ELIBACC:79,ELIBBAD:80,ELIBSCN:81,ELIBMAX:82,ELIBEXEC:83,ENOSYS:38,ENOTEMPTY:39,ENAMETOOLONG:36,ELOOP:40,EOPNOTSUPP:95,EPFNOSUPPORT:96,ECONNRESET:104,ENOBUFS:105,EAFNOSUPPORT:97,EPROTOTYPE:91,ENOTSOCK:88,ENOPROTOOPT:92,ESHUTDOWN:108,ECONNREFUSED:111,EADDRINUSE:98,ECONNABORTED:103,ENETUNREACH:101,ENETDOWN:100,ETIMEDOUT:110,EHOSTDOWN:112,EHOSTUNREACH:113,EINPROGRESS:115,EALREADY:114,EDESTADDRREQ:89,EMSGSIZE:90,EPROTONOSUPPORT:93,ESOCKTNOSUPPORT:94,EADDRNOTAVAIL:99,ENETRESET:102,EISCONN:106,ENOTCONN:107,ETOOMANYREFS:109,EUSERS:87,EDQUOT:122,ESTALE:116,ENOTSUP:95,ENOMEDIUM:123,EILSEQ:84,EOVERFLOW:75,ECANCELED:125,ENOTRECOVERABLE:131,EOWNERDEAD:130,ESTRPIPE:86};function _sysconf(name){switch(name){case 30:return PAGE_SIZE;case 85:return totalMemory/PAGE_SIZE;case 132:case 133:case 12:case 137:case 138:case 15:case 235:case 16:case 17:case 18:case 19:case 20:case 149:case 13:case 10:case 236:case 153:case 9:case 21:case 22:case 159:case 154:case 14:case 77:case 78:case 139:case 80:case 81:case 82:case 68:case 67:case 164:case 11:case 29:case 47:case 48:case 95:case 52:case 51:case 46:return 200809;case 79:return 0;case 27:case 246:case 127:case 128:case 23:case 24:case 160:case 161:case 181:case 182:case 242:case 183:case 184:case 243:case 244:case 245:case 165:case 178:case 179:case 49:case 50:case 168:case 169:case 175:case 170:case 171:case 172:case 97:case 76:case 32:case 173:case 35:return-1;case 176:case 177:case 7:case 155:case 8:case 157:case 125:case 126:case 92:case 93:case 129:case 130:case 131:case 94:case 91:return 1;case 74:case 60:case 69:case 70:case 4:return 1024;case 31:case 42:case 72:return 32;case 87:case 26:case 33:return 2147483647;case 34:case 1:return 47839;case 38:case 36:return 99;case 43:case 37:return 2048;case 0:return 2097152;case 3:return 65536;case 28:return 32768;case 44:return 32767;case 75:return 16384;case 39:return 1e3;case 89:return 700;case 71:return 256;case 40:return 255;case 2:return 100;case 180:return 64;case 25:return 20;case 5:return 16;case 6:return 6;case 73:return 4;case 84:{if(typeof navigator==="object")return navigator["hardwareConcurrency"]||1;return 1}}___setErrNo(ERRNO_CODES.EINVAL);return-1}function embind_init_charCodes(){var codes=new Array(256);for(var i=0;i<256;++i){codes[i]=String.fromCharCode(i)}embind_charCodes=codes}var embind_charCodes=undefined;function readLatin1String(ptr){var ret="";var c=ptr;while(HEAPU8[c]){ret+=embind_charCodes[HEAPU8[c++]]}return ret}var awaitingDependencies={};var registeredTypes={};var typeDependencies={};var char_0=48;var char_9=57;function makeLegalFunctionName(name){if(undefined===name){return"_unknown"}name=name.replace(/[^a-zA-Z0-9_]/g,"$");var f=name.charCodeAt(0);if(f>=char_0&&f<=char_9){return"_"+name}else{return name}}function createNamedFunction(name,body){name=makeLegalFunctionName(name);return(new Function("body","return function "+name+"() {\n"+' "use strict";'+" return body.apply(this, arguments);\n"+"};\n"))(body)}function extendError(baseErrorType,errorName){var errorClass=createNamedFunction(errorName,(function(message){this.name=errorName;this.message=message;var stack=(new Error(message)).stack;if(stack!==undefined){this.stack=this.toString()+"\n"+stack.replace(/^Error(:[^\n]*)?\n/,"")}}));errorClass.prototype=Object.create(baseErrorType.prototype);errorClass.prototype.constructor=errorClass;errorClass.prototype.toString=(function(){if(this.message===undefined){return this.name}else{return this.name+": "+this.message}});return errorClass}var BindingError=undefined;function throwBindingError(message){throw new BindingError(message)}var InternalError=undefined;function throwInternalError(message){throw new InternalError(message)}function whenDependentTypesAreResolved(myTypes,dependentTypes,getTypeConverters){myTypes.forEach((function(type){typeDependencies[type]=dependentTypes}));function onComplete(typeConverters){var myTypeConverters=getTypeConverters(typeConverters);if(myTypeConverters.length!==myTypes.length){throwInternalError("Mismatched type converter count")}for(var i=0;i0);info.refcount--;if(info.refcount===0){if(info.destructor){Runtime.dynCall("vi",info.destructor,[ptr])}delete EXCEPTIONS.infos[ptr];___cxa_free_exception(ptr)}}),clearRef:(function(ptr){if(!ptr)return;var info=EXCEPTIONS.infos[ptr];info.refcount=0})};function ___resumeException(ptr){if(!EXCEPTIONS.last){EXCEPTIONS.last=ptr}EXCEPTIONS.clearRef(EXCEPTIONS.deAdjust(ptr));throw ptr+" - Exception catching is disabled, this exception cannot be caught. Compile with -s DISABLE_EXCEPTION_CATCHING=0 or DISABLE_EXCEPTION_CATCHING=2 to catch."}function ___cxa_find_matching_catch(){var thrown=EXCEPTIONS.last;if(!thrown){return(asm["setTempRet0"](0),0)|0}var info=EXCEPTIONS.infos[thrown];var throwntype=info.type;if(!throwntype){return(asm["setTempRet0"](0),thrown)|0}var typeArray=Array.prototype.slice.call(arguments);var pointer=Module["___cxa_is_pointer_type"](throwntype);if(!___cxa_find_matching_catch.buffer)___cxa_find_matching_catch.buffer=_malloc(4);HEAP32[___cxa_find_matching_catch.buffer>>2]=thrown;thrown=___cxa_find_matching_catch.buffer;for(var i=0;i>2];info.adjusted=thrown;return(asm["setTempRet0"](typeArray[i]),thrown)|0}}thrown=HEAP32[thrown>>2];return(asm["setTempRet0"](throwntype),thrown)|0}function ___cxa_throw(ptr,type,destructor){EXCEPTIONS.infos[ptr]={ptr:ptr,adjusted:ptr,type:type,destructor:destructor,refcount:0};EXCEPTIONS.last=ptr;if(!("uncaught_exception"in __ZSt18uncaught_exceptionv)){__ZSt18uncaught_exceptionv.uncaught_exception=1}else{__ZSt18uncaught_exceptionv.uncaught_exception++}throw ptr+" - Exception catching is disabled, this exception cannot be caught. Compile with -s DISABLE_EXCEPTION_CATCHING=0 or DISABLE_EXCEPTION_CATCHING=2 to catch."}Module["_memset"]=_memset;function getShiftFromSize(size){switch(size){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+size)}}function __embind_register_bool(rawType,name,size,trueValue,falseValue){var shift=getShiftFromSize(size);name=readLatin1String(name);registerType(rawType,{name:name,"fromWireType":(function(wt){return!!wt}),"toWireType":(function(destructors,o){return o?trueValue:falseValue}),"argPackAdvance":8,"readValueFromPointer":(function(pointer){var heap;if(size===1){heap=HEAP8}else if(size===2){heap=HEAP16}else if(size===4){heap=HEAP32}else{throw new TypeError("Unknown boolean type size: "+name)}return this["fromWireType"](heap[pointer>>shift])}),destructorFunction:null})}function _abort(){Module["abort"]()}function _free(){}Module["_free"]=_free;function _malloc(bytes){var ptr=Runtime.dynamicAlloc(bytes+8);return ptr+8&4294967288}Module["_malloc"]=_malloc;function simpleReadValueFromPointer(pointer){return this["fromWireType"](HEAPU32[pointer>>2])}function __embind_register_std_string(rawType,name){name=readLatin1String(name);registerType(rawType,{name:name,"fromWireType":(function(value){var length=HEAPU32[value>>2];var a=new Array(length);for(var i=0;i>2]=length;for(var i=0;i255){_free(ptr);throwBindingError("String has UTF-16 code units that do not fit in 8 bits")}HEAPU8[ptr+4+i]=charCode}if(destructors!==null){destructors.push(_free,ptr)}return ptr}),"argPackAdvance":8,"readValueFromPointer":simpleReadValueFromPointer,destructorFunction:(function(ptr){_free(ptr)})})}function __embind_register_std_wstring(rawType,charSize,name){name=readLatin1String(name);var getHeap,shift;if(charSize===2){getHeap=(function(){return HEAPU16});shift=1}else if(charSize===4){getHeap=(function(){return HEAPU32});shift=2}registerType(rawType,{name:name,"fromWireType":(function(value){var HEAP=getHeap();var length=HEAPU32[value>>2];var a=new Array(length);var start=value+4>>shift;for(var i=0;i>2]=length;var start=ptr+4>>shift;for(var i=0;i>1]}:function readU16FromPointer(pointer){return HEAPU16[pointer>>1]};case 2:return signed?function readS32FromPointer(pointer){return HEAP32[pointer>>2]}:function readU32FromPointer(pointer){return HEAPU32[pointer>>2]};default:throw new TypeError("Unknown integer type: "+name)}}function __embind_register_integer(primitiveType,name,size,minRange,maxRange){name=readLatin1String(name);if(maxRange===-1){maxRange=4294967295}var shift=getShiftFromSize(size);var fromWireType=(function(value){return value});if(minRange===0){var bitshift=32-8*size;fromWireType=(function(value){return value<>>bitshift})}registerType(primitiveType,{name:name,"fromWireType":fromWireType,"toWireType":(function(destructors,value){if(typeof value!=="number"&&typeof value!=="boolean"){throw new TypeError('Cannot convert "'+_embind_repr(value)+'" to '+this.name)}if(valuemaxRange){throw new TypeError('Passing a number "'+_embind_repr(value)+'" from JS side to C/C++ side to an argument of type "'+name+'", which is outside the valid range ['+minRange+", "+maxRange+"]!")}return value|0}),"argPackAdvance":8,"readValueFromPointer":integerReadValueFromPointer(name,shift,minRange!==0),destructorFunction:null})}var emval_free_list=[];var emval_handle_array=[{},{value:undefined},{value:null},{value:true},{value:false}];function __emval_decref(handle){if(handle>4&&0===--emval_handle_array[handle].refcount){emval_handle_array[handle]=undefined;emval_free_list.push(handle)}}function count_emval_handles(){var count=0;for(var i=5;i>2;var heap=HEAPU32;var size=heap[handle];var data=heap[handle+1];return new TA(heap["buffer"],data,size)}name=readLatin1String(name);registerType(rawType,{name:name,"fromWireType":decodeMemoryView,"argPackAdvance":8,"readValueFromPointer":decodeMemoryView},{ignoreDuplicateRegistrations:true})}function floatReadValueFromPointer(name,shift){switch(shift){case 2:return(function(pointer){return this["fromWireType"](HEAPF32[pointer>>2])});case 3:return(function(pointer){return this["fromWireType"](HEAPF64[pointer>>3])});default:throw new TypeError("Unknown float type: "+name)}}function __embind_register_float(rawType,name,size){var shift=getShiftFromSize(size);name=readLatin1String(name);registerType(rawType,{name:name,"fromWireType":(function(value){return value}),"toWireType":(function(destructors,value){if(typeof value!=="number"&&typeof value!=="boolean"){throw new TypeError('Cannot convert "'+_embind_repr(value)+'" to '+this.name)}return value}),"argPackAdvance":8,"readValueFromPointer":floatReadValueFromPointer(name,shift),destructorFunction:null})}function _emscripten_memcpy_big(dest,src,num){HEAPU8.set(HEAPU8.subarray(src,src+num),dest);return dest}Module["_memcpy"]=_memcpy;function _llvm_stackrestore(p){var self=_llvm_stacksave;var ret=self.LLVM_SAVEDSTACKS[p];self.LLVM_SAVEDSTACKS.splice(p,1);Runtime.stackRestore(ret)}var _llvm_pow_f64=Math_pow;function _sbrk(bytes){var self=_sbrk;if(!self.called){DYNAMICTOP=alignMemoryPage(DYNAMICTOP);self.called=true;assert(Runtime.dynamicAlloc);self.alloc=Runtime.dynamicAlloc;Runtime.dynamicAlloc=(function(){abort("cannot dynamically allocate, sbrk now has control")})}var ret=DYNAMICTOP;if(bytes!=0){var success=self.alloc(bytes);if(!success)return-1>>>0}return ret}function _llvm_stacksave(){var self=_llvm_stacksave;if(!self.LLVM_SAVEDSTACKS){self.LLVM_SAVEDSTACKS=[]}self.LLVM_SAVEDSTACKS.push(Runtime.stackSave());return self.LLVM_SAVEDSTACKS.length-1}Module["_memmove"]=_memmove;function ___gxx_personality_v0(){}function heap32VectorToArray(count,firstElement){var array=[];for(var i=0;i>2)+i])}return array}function runDestructors(destructors){while(destructors.length){var ptr=destructors.pop();var del=destructors.pop();del(ptr)}}function __embind_register_class_constructor(rawClassType,argCount,rawArgTypesAddr,invokerSignature,invoker,rawConstructor){var rawArgTypes=heap32VectorToArray(argCount,rawArgTypesAddr);invoker=requireFunction(invokerSignature,invoker);whenDependentTypesAreResolved([],[rawClassType],(function(classType){classType=classType[0];var humanName="constructor "+classType.name;if(undefined===classType.registeredClass.constructor_body){classType.registeredClass.constructor_body=[]}if(undefined!==classType.registeredClass.constructor_body[argCount-1]){throw new BindingError("Cannot register multiple constructors with identical number of parameters ("+(argCount-1)+") for class '"+classType.name+"'! Overload resolution is currently only performed using the parameter count, not actual type info!")}classType.registeredClass.constructor_body[argCount-1]=function unboundTypeHandler(){throwUnboundTypeError("Cannot construct "+classType.name+" due to unbound types",rawArgTypes)};whenDependentTypesAreResolved([],rawArgTypes,(function(argTypes){classType.registeredClass.constructor_body[argCount-1]=function constructor_body(){if(arguments.length!==argCount-1){throwBindingError(humanName+" called with "+arguments.length+" arguments, expected "+(argCount-1))}var destructors=[];var args=new Array(argCount);args[0]=rawConstructor;for(var i=1;i>2]=ret}return ret}function _pthread_self(){return 0}function new_(constructor,argumentList){if(!(constructor instanceof Function)){throw new TypeError("new_ called with constructor type "+typeof constructor+" which is not a function")}var dummy=createNamedFunction(constructor.name||"unknownFunctionName",(function(){}));dummy.prototype=constructor.prototype;var obj=new dummy;var r=constructor.apply(obj,argumentList);return r instanceof Object?r:obj}function craftInvokerFunction(humanName,argTypes,classType,cppInvokerFunc,cppTargetFunc){var argCount=argTypes.length;if(argCount<2){throwBindingError("argTypes array size mismatch! Must at least get return value and 'this' types!")}var isClassMethodFunc=argTypes[1]!==null&&classType!==null;var argsList="";var argsListWired="";for(var i=0;i0?", ":"")+argsListWired}var returns=argTypes[0].name!=="void";invokerFnBody+=(returns?"var rv = ":"")+"invoker(fn"+(argsListWired.length>0?", ":"")+argsListWired+");\n";if(needsDestructorStack){invokerFnBody+="runDestructors(destructors);\n"}else{for(var i=isClassMethodFunc?1:2;i>2]|0;Xa=c[e+8>>2]|0;c[Ya>>2]=15;g[K>>2]=0.0;c[Ra>>2]=0;c[ba>>2]=0;Pa=c[e>>2]|0;Ua=Pa+8|0;db=c[Ua>>2]|0;I=c[Pa+4>>2]|0;Ia=Pa+32|0;wa=c[Ia>>2]|0;bb=c[e+32>>2]|0;cb=c[e+36>>2]|0;Da=(bb|0)!=0;g[Ga>>2]=0.0;if((l|0)<2|(f|0)==0){e=-1;i=eb;return e|0}U=e+28|0;n=_(c[U>>2]|0,h)|0;oa=Pa+44|0;Ba=Pa+36|0;h=c[Ba>>2]|0;xa=0;while(1){if((xa|0)>(h|0)){h=-1;za=631;break}if((c[oa>>2]<>2]<>2]|0;Ta=c[m+28>>2]|0;E=aa(Ta|0)|0;Sa=32-E|0;Ta=Ta>>>(Sa+-16|0);Ca=(Ta>>>12)+-8|0;E=Ma+(E+-32)|0;H=E+4>>3;Ca=(Ma<<3)-((Sa<<3)+(Ca+(Ta>>>0>(c[5272+(Ca<<2)>>2]|0)>>>0&1)))|0}l=(l|0)<1275?l:1275;q=l-H|0;ua=e+44|0;h=c[e+40>>2]|0;if(!(c[ua>>2]|0))if((h|0)==-1)za=13;else{Ta=_(h,n)|0;za=c[Pa>>2]|0;za=((Ta+((E|0)>1?E:0)+(za<<2)|0)/(za<<3|0)|0)-((c[e+48>>2]|0)!=0&1)|0;Ta=(l|0)<(za|0);l=((Ta?l:za)|0)<2?2:Ta?l:za;za=13}else if((h|0)==-1){h=-1;za=13}else{Ka=c[Pa>>2]|0;Ka=((_(h,n)|0)+(Ka>>4)|0)/(Ka>>3|0)|0;o=l;G=Ka>>6}if((za|0)==13){o=l;G=l-H|0;Ka=0}l=_((Xa*40|0)+20|0,(400>>>xa)+-50|0)|0;n=(o*400>>3-xa)-l|0;if((h|0)==-1)La=n;else{La=h-l|0;La=(n|0)<(La|0)?n:La}if(p){c[r>>2]=j;c[r+8>>2]=0;c[r+12>>2]=0;c[r+16>>2]=0;c[r+20>>2]=33;c[r+24>>2]=0;c[r+28>>2]=-2147483648;c[r+40>>2]=-1;c[r+32>>2]=0;c[r+36>>2]=0;c[r+4>>2]=o;c[r+44>>2]=0;Ta=r}else Ta=m;Aa=(Ka|0)>0;if(((Aa?(c[e+52>>2]|0)!=0:0)?(t=(E|0)==1?2:0,u=(Ka<<1)-(c[e+176>>2]|0)>>6,x=(t|0)>(u|0),((x?t:u)|0)<(q|0)):0)?(y=x?t:u,(y|0)<(q|0)):0){o=H+y|0;Ja=c[Ta>>2]|0;Sa=c[Ta+8>>2]|0;Ma=0-Sa|0;n=Ta+4|0;sf(Ja+o+Ma|0,Ja+(c[n>>2]|0)+Ma|0,Sa|0)|0;c[n>>2]=o;n=y}else n=q;F=o<<3;na=c[Pa+12>>2]|0;na=(cb|0)>(na|0)?na:cb;P=Oa+I|0;r=_(ab,P)|0;Sa=Fa()|0;T=i;i=i+((1*(r<<2)|0)+15&-16)|0;r=e+192|0;s=+g[r>>2];l=_(Xa,Oa-I|0)|0;q=c[U>>2]|0;l=(l|0)/(q|0)|0;h=0;v=0.0;w=0.0;while(1){if((h|0)>=(l|0))break;Ha=+g[f+(h<<2)>>2];h=h+1|0;v=v>Ha?v:Ha;w=w(v>Ha?v:Ha))){h=0;v=0.0;s=0.0;while(1){if((h|0)>=(l|0))break;Ha=+g[f+(h<<2)>>2];h=h+1|0;v=v>Ha?v:Ha;s=ss)s=v}p=f+(l<<2)|0;h=(_(Xa,I)|0)/(q|0)|0;l=0;v=0.0;w=0.0;while(1){if((l|0)>=(h|0))break;Ha=+g[p+(l<<2)>>2];l=l+1|0;v=v>Ha?v:Ha;w=wHa?v:Ha;g[r>>2]=Ha;s=s>Ha?s:Ha;pa=e+60|0;z=s<=1.0/+(1<>2]|0);D=z&1;if((E|0)==1){B=Ta+28|0;l=c[B>>2]|0;h=l>>>15;l=l-h|0;y=Ta+32|0;if(z)c[y>>2]=(c[y>>2]|0)+l;else h=l;c[B>>2]=h;r=Ta+36|0;C=Ta+20|0;j=Ta+40|0;m=Ta+24|0;t=Ta+8|0;u=Ta+4|0;x=Ta+44|0;while(1){if(h>>>0>=8388609)break;l=c[y>>2]|0;q=l>>>23;if((q|0)==255)c[r>>2]=(c[r>>2]|0)+1;else{p=l>>>31;h=c[j>>2]|0;if((h|0)>-1){l=c[m>>2]|0;if((l+(c[t>>2]|0)|0)>>>0<(c[u>>2]|0)>>>0){c[m>>2]=l+1;a[(c[Ta>>2]|0)+l>>0]=h+p;h=0}else h=-1;c[x>>2]=c[x>>2]|h}h=c[r>>2]|0;if(h|0){p=p+255&255;do{l=c[m>>2]|0;if((l+(c[t>>2]|0)|0)>>>0<(c[u>>2]|0)>>>0){c[m>>2]=l+1;a[(c[Ta>>2]|0)+l>>0]=p;l=0;h=c[r>>2]|0}else l=-1;c[x>>2]=c[x>>2]|l;h=h+-1|0;c[r>>2]=h}while((h|0)!=0)}c[j>>2]=q&255;l=c[y>>2]|0;h=c[B>>2]|0}c[y>>2]=l<<8&2147483392;h=h<<8;c[B>>2]=h;c[C>>2]=(c[C>>2]|0)+8}if(z){if(Aa){p=H+2|0;p=(o|0)<(p|0)?o:p;l=c[Ta>>2]|0;o=c[t>>2]|0;h=0-o|0;sf(l+p+h|0,l+(c[u>>2]|0)+h|0,o|0)|0;c[u>>2]=p;o=p;h=c[B>>2]|0;l=p;n=2;p=p<<3}else{l=G;p=F}E=o<<3;Ma=c[C>>2]|0;c[C>>2]=Ma+(E-(Ma+((aa(h|0)|0)+-32)));Ma=D}else{l=G;Ma=0;E=1;p=F}}else{l=G;Ma=0;p=F}z=e+16|0;B=Pa+16|0;C=Pa+20|0;D=Oa<<2;u=s>65536.0;y=0;do{r=u&(c[z>>2]|0)!=0;m=f+(y<<2)|0;t=T+((_(y,P)|0)<<2)+(I<<2)|0;j=c[U>>2]|0;x=e+160+(y<<2)|0;v=+g[B>>2];s=+g[x>>2];a:do if(+g[C>>2]==0.0){if((j|0)!=1){h=(Oa|0)/(j|0)|0;za=64;break}if(r){h=Oa;za=65}else{h=0;while(1){if((h|0)>=(Oa|0))break a;Ha=+g[m+((_(h,ab)|0)<<2)>>2]*32768.0;g[t+(h<<2)>>2]=Ha-s;h=h+1|0;s=v*Ha}}}else{h=(Oa|0)/(j|0)|0;if((j|0)==1)za=65;else za=64}while(0);if((za|0)==64){nf(t|0,0,D|0)|0;za=65}b:do if((za|0)==65){za=0;q=0;while(1){if((q|0)>=(h|0))break;g[t+((_(q,j)|0)<<2)>>2]=+g[m+((_(q,ab)|0)<<2)>>2]*32768.0;q=q+1|0}c:do if(r){q=0;while(1){if((q|0)>=(h|0)){h=0;break c}Ja=t+((_(q,j)|0)<<2)|0;Ha=+g[Ja>>2];va=Ha>65536.0;ya=Ha<-65536.0&(va^1);g[Ja>>2]=ya|va?(ya?-65536.0:65536.0):Ha;q=q+1|0}}else h=0;while(0);while(1){if((h|0)>=(Oa|0))break b;Ja=t+(h<<2)|0;Ha=+g[Ja>>2];g[Ja>>2]=Ha-s;h=h+1|0;s=v*Ha}}while(0);g[x>>2]=s;y=y+1|0}while((y|0)<(ab|0));ya=e+68|0;if((((c[ya>>2]|0)!=0&(n|0)>3|(n|0)>(Xa*12|0))&(Da^1)&(Ma|0)==0?(c[e+20>>2]|0)==0:0)?(c[e+24>>2]|0)>4:0){if((c[e+116>>2]|0)==0|(xa|0)==3)h=0;else h=(c[e+64>>2]|0)==5010;h=h^1}else h=0;la=e+100|0;Ja=c[la>>2]|0;h=Sc(e,T,J,ab,Oa,Ja,Ya,K,L,h&1,n)|0;Ha=+g[K>>2];if(!(Ha>.4000000059604645)?!(+g[e+108>>2]>.4000000059604645):0)va=0;else za=82;do if((za|0)==82){if(c[e+120>>2]|0?!(+g[e+124>>2]>.3):0){va=0;break}ga=+(c[Ya>>2]|0);ja=+(c[e+104>>2]|0);va=(ga>ja*1.26|ga(p|0))){m=Ta+28|0;h=c[m>>2]|0;h=h-(h>>>1)|0;c[m>>2]=h;t=Ta+32|0;u=Ta+36|0;x=Ta+20|0;y=Ta+40|0;z=Ta+24|0;B=Ta+8|0;C=Ta+4|0;D=Ta+44|0;while(1){if(h>>>0>=8388609)break d;q=c[t>>2]|0;j=q>>>23;if((j|0)==255)c[u>>2]=(c[u>>2]|0)+1;else{r=q>>>31;h=c[y>>2]|0;if((h|0)>-1){q=c[z>>2]|0;if((q+(c[B>>2]|0)|0)>>>0<(c[C>>2]|0)>>>0){c[z>>2]=q+1;a[(c[Ta>>2]|0)+q>>0]=h+r;h=0}else h=-1;c[D>>2]=c[D>>2]|h}h=c[u>>2]|0;if(h|0){r=r+255&255;do{q=c[z>>2]|0;if((q+(c[B>>2]|0)|0)>>>0<(c[C>>2]|0)>>>0){c[z>>2]=q+1;a[(c[Ta>>2]|0)+q>>0]=r;q=0;h=c[u>>2]|0}else q=-1;c[D>>2]=c[D>>2]|q;h=h+-1|0;c[u>>2]=h}while((h|0)!=0)}c[y>>2]=j&255;q=c[t>>2]|0;h=c[m>>2]|0}c[t>>2]=q<<8&2147483392;h=h<<8;c[m>>2]=h;c[x>>2]=(c[x>>2]|0)+8}}}else{D=Ta+28|0;q=c[D>>2]|0;h=q>>>1;E=Ta+32|0;q=(c[E>>2]|0)+(q-h)|0;c[E>>2]=q;c[D>>2]=h;F=Ta+36|0;G=Ta+20|0;H=Ta+40|0;I=Ta+24|0;f=Ta+8|0;J=Ta+4|0;K=Ta+44|0;while(1){if(h>>>0>=8388609)break;j=q>>>23;if((j|0)==255)c[F>>2]=(c[F>>2]|0)+1;else{r=q>>>31;h=c[H>>2]|0;if((h|0)>-1){q=c[I>>2]|0;if((q+(c[f>>2]|0)|0)>>>0<(c[J>>2]|0)>>>0){c[I>>2]=q+1;a[(c[Ta>>2]|0)+q>>0]=h+r;h=0}else h=-1;c[K>>2]=c[K>>2]|h}h=c[F>>2]|0;if(h|0){r=r+255&255;do{q=c[I>>2]|0;if((q+(c[f>>2]|0)|0)>>>0<(c[J>>2]|0)>>>0){c[I>>2]=q+1;a[(c[Ta>>2]|0)+q>>0]=r;q=0;h=c[F>>2]|0}else q=-1;c[K>>2]=c[K>>2]|q;h=h+-1|0;c[F>>2]=h}while((h|0)!=0)}c[H>>2]=j&255;q=c[E>>2]|0;h=c[D>>2]|0}q=q<<8&2147483392;c[E>>2]=q;h=h<<8;c[D>>2]=h;c[G>>2]=(c[G>>2]|0)+8}B=c[Ya>>2]|0;m=B+1|0;c[Ya>>2]=m;C=aa(m|0)|0;x=32-C|0;t=x+-5|0;r=(h>>>0)/6|0;if(!t)h=h-(_(r,10-x|0)|0)|0;else{q=q+(h-(_(r,11-x|0)|0))|0;c[E>>2]=q;h=r}c[D>>2]=h;while(1){if(h>>>0>=8388609)break;j=q>>>23;if((j|0)==255)c[F>>2]=(c[F>>2]|0)+1;else{r=q>>>31;h=c[H>>2]|0;if((h|0)>-1){q=c[I>>2]|0;if((q+(c[f>>2]|0)|0)>>>0<(c[J>>2]|0)>>>0){c[I>>2]=q+1;a[(c[Ta>>2]|0)+q>>0]=h+r;h=0}else h=-1;c[K>>2]=c[K>>2]|h}h=c[F>>2]|0;if(h|0){r=r+255&255;do{q=c[I>>2]|0;if((q+(c[f>>2]|0)|0)>>>0<(c[J>>2]|0)>>>0){c[I>>2]=q+1;a[(c[Ta>>2]|0)+q>>0]=r;q=0;h=c[F>>2]|0}else q=-1;c[K>>2]=c[K>>2]|q;h=h+-1|0;c[F>>2]=h}while((h|0)!=0)}c[H>>2]=j&255;q=c[E>>2]|0;h=c[D>>2]|0}q=q<<8&2147483392;c[E>>2]=q;h=h<<8;c[D>>2]=h;c[G>>2]=(c[G>>2]|0)+8}u=m-(16<>2]|0;z=Ta+16|0;j=c[z>>2]|0;if((j+x|0)>>>0>32){m=7-j|0;m=j+((m|0)>-8?m:-8)&-8;t=j;do{q=c[f>>2]|0;r=c[J>>2]|0;if(((c[I>>2]|0)+q|0)>>>0>>0){q=q+1|0;c[f>>2]=q;a[(c[Ta>>2]|0)+(r-q)>>0]=h;q=0}else q=-1;c[K>>2]=c[K>>2]|q;h=h>>>8;t=t+-8|0}while((t|0)>7);j=j+-8-m|0}h=h|u<>2]=h;c[z>>2]=q;r=(c[G>>2]|0)+x|0;c[G>>2]=r;c[Ya>>2]=B;u=c[L>>2]|0;if((q+3|0)>>>0>32){t=j+23|0;m=C+-24-j|0;m=j+((m|0)>-8?m:-8)+31-C&-8;do{r=c[f>>2]|0;j=c[J>>2]|0;if(((c[I>>2]|0)+r|0)>>>0>>0){r=r+1|0;c[f>>2]=r;a[(c[Ta>>2]|0)+(j-r)>>0]=h;r=0}else r=-1;c[K>>2]=c[K>>2]|r;h=h>>>8;q=q+-8|0}while((q|0)>7);r=c[G>>2]|0;q=t-C-m|0}c[y>>2]=h|u<>2]=q+3;r=r+3|0;c[G>>2]=r;h=c[D>>2]|0;q=h>>>2;if((Ja|0)>0){ta=d[29345+(Ja+-1)>>0]|0;sa=h-(_(q,ta)|0)|0;c[E>>2]=(c[E>>2]|0)+sa;q=_(q,ta-(d[29345+Ja>>0]|0)|0)|0}else q=h-(_(q,d[29345+Ja>>0]|0)|0)|0;c[D>>2]=q;h=r;while(1){if(q>>>0>=8388609)break d;r=c[E>>2]|0;j=r>>>23;if((j|0)==255)c[F>>2]=(c[F>>2]|0)+1;else{r=r>>>31;h=c[H>>2]|0;if((h|0)>-1){q=c[I>>2]|0;if((q+(c[f>>2]|0)|0)>>>0<(c[J>>2]|0)>>>0){c[I>>2]=q+1;a[(c[Ta>>2]|0)+q>>0]=h+r;h=0}else h=-1;c[K>>2]=c[K>>2]|h}h=c[F>>2]|0;if(h|0){r=r+255&255;do{q=c[I>>2]|0;if((q+(c[f>>2]|0)|0)>>>0<(c[J>>2]|0)>>>0){c[I>>2]=q+1;a[(c[Ta>>2]|0)+q>>0]=r;q=0;h=c[F>>2]|0}else q=-1;c[K>>2]=c[K>>2]|q;h=h+-1|0;c[F>>2]=h}while((h|0)!=0)}c[H>>2]=j&255;r=c[E>>2]|0;q=c[D>>2]|0;h=c[G>>2]|0}c[E>>2]=r<<8&2147483392;q=q<<8;c[D>>2]=q;h=h+8|0;c[G>>2]=h}}while(0);qa=e+24|0;if((c[qa>>2]|0)>0?(c[ya>>2]|0)==0:0)F=Tc(T,P,ab,Ga,ba)|0;else F=0;J=(xa|0)>0;e:do if(J?((c[Ta+20>>2]|0)+((aa(c[Ta+28>>2]|0)|0)+-32)+3|0)<=(p|0):0)if(F){C=(_(ab,Oa)|0)<<2;B=i;i=i+((1*C|0)+15&-16)|0;C=i;i=i+((1*(Wa<<2)|0)+15&-16)|0;D=i;i=i+((1*(Wa<<2)|0)+15&-16)|0;z=_(Xa,db)|0;E=i;i=i+((1*(z<<2)|0)+15&-16)|0;if((c[qa>>2]|0)>7){Uc(Pa,0,T,B,Xa,ab,xa,c[U>>2]|0);h=c[Ia>>2]|0;q=c[oa>>2]<=(na|0))break;t=b[h+(y<<1)>>1]|0;j=B+(r+(t<>1]|0)-t<=(t|0))break;ja=+g[j+(x<<2)>>2];x=x+1|0;s=s+ja*ja}ja=+O(+(s+1.0000000272452012e-27));g[C+(y+(_(u,c[Ua>>2]|0)|0)<<2)>>2]=ja;y=m}u=u+1|0}while((u|0)<(Xa|0));q=0;do{h=0;while(1){if((h|0)>=(na|0)){h=na;break}ta=h+(_(q,c[Ua>>2]|0)|0)|0;ja=+Y(+(+g[C+(ta<<2)>>2]))*1.4426950408889634;g[E+(ta<<2)>>2]=ja-+g[17220+(h<<2)>>2];h=h+1|0}while(1){if((h|0)>=(cb|0))break;g[E+((_(q,c[Ua>>2]|0)|0)+h<<2)>>2]=-14.0;h=h+1|0}q=q+1|0}while((q|0)<(Xa|0));s=+(xa|0)*.5;h=0;while(1){if((h|0)>=(z|0)){H=1;G=0;h=F;F=X;ta=0;break e}ta=E+(h<<2)|0;g[ta>>2]=+g[ta>>2]+s;h=h+1|0}}else{H=0;G=0;h=F;F=X;ta=0}}else{h=F;q=0;za=171}else{h=0;q=1;za=171}while(0);if((za|0)==171){C=(_(ab,Oa)|0)<<2;B=i;i=i+((1*C|0)+15&-16)|0;C=i;i=i+((1*(Wa<<2)|0)+15&-16)|0;D=i;i=i+((1*(Wa<<2)|0)+15&-16)|0;H=(_(Xa,db)|0)<<2;E=i;i=i+((1*H|0)+15&-16)|0;H=0;G=1;F=0;ta=q}Uc(Pa,F,T,B,Xa,ab,xa,c[U>>2]|0);sa=(ab|0)==2;if(sa&(Xa|0)==1)c[ba>>2]=0;q=c[Ia>>2]|0;r=c[oa>>2]<=(na|0))break;u=b[q+(z<<1)>>1]|0;m=B+(j+(u<>1]|0)-u<=(u|0))break;ja=+g[m+(y<<2)>>2];y=y+1|0;s=s+ja*ja}ja=+O(+(s+1.0000000272452012e-27));g[C+(z+(_(x,c[Ua>>2]|0)|0)<<2)>>2]=ja;z=t}x=x+1|0}while((x|0)<(Xa|0));x=(c[ya>>2]|0)==0;f:do if(x)r=0;else{q=2;while(1){if((q|0)>=(cb|0)){r=0;break f}ra=C+(q<<2)|0;ga=+g[ra>>2];ja=+g[C>>2]*9.999999747378752e-05;ja=ga>2]=ja>1.0000000036274937e-15?ja:1.0000000036274937e-15;q=q+1|0}}while(0);do{q=0;while(1){if((q|0)>=(na|0)){q=na;break}ra=q+(_(r,c[Ua>>2]|0)|0)|0;ja=+Y(+(+g[C+(ra<<2)>>2]))*1.4426950408889634;g[D+(ra<<2)>>2]=ja-+g[17220+(q<<2)>>2];q=q+1|0}while(1){if((q|0)>=(cb|0))break;g[D+((_(r,c[Ua>>2]|0)|0)+q<<2)>>2]=-14.0;q=q+1|0}r=r+1|0}while((r|0)<(Xa|0));ra=_(Xa,db)|0;R=i;i=i+((1*(ra<<2)|0)+15&-16)|0;nf(R|0,0,cb<<2|0)|0;if(!Da?(S=c[e+204>>2]|0,!((S|0)==0|x^1)):0){u=c[e+92>>2]|0;u=(u|0)<2?2:u;t=0;q=0;v=0.0;s=0.0;while(1){if((t|0)>=(Xa|0))break;m=_(db,t)|0;j=0;w=s;while(1){if((j|0)>=(u|0))break;s=+g[S+(m+j<<2)>>2];r=s<.25;do if(s>-2.0|r^1){if(r){if(!(s>0.0))break}else s=.25;s=s*.5}else s=-2.0;while(0);ia=j+1|0;ma=(b[wa+(ia<<1)>>1]|0)-(b[wa+(j<<1)>>1]|0)|0;q=q+ma|0;v=v+s*+((j<<1|1)-u|0);j=ia;w=w+s*+(ma|0)}t=t+1|0;s=w}s=s/+(q|0)+.20000000298023224;v=v*6.0/+(_(_(_(Xa,u+-1|0)|0,u+1|0)|0,u)|0)*.5;q=v<.03099999949336052;v=q?(q&!(v>-.03099999949336052)?-.03099999949336052:v):.03099999949336052;q=(b[wa+(u<<1)>>1]|0)/2|0;t=0;while(1){r=t+1|0;if((b[wa+(r<<1)>>1]|0)<(q|0))t=r;else break}j=(Xa|0)==2;q=0;m=0;while(1){if((m|0)>=(u|0))break;r=S+(m<<2)|0;if(j){ma=S+(db+m<<2)|0;r=+g[r>>2]>+g[ma>>2]?r:ma}w=+g[r>>2];w=(w<0.0?w:0.0)-(s+v*+(m-t|0));if(w>.25){g[R+(m<<2)>>2]=w+-.25;q=q+1|0}m=m+1|0}g:do if((q|0)>2){s=s+.25;if(s>0.0){nf(R|0,0,u<<2|0)|0;v=0.0;s=0.0;break}else q=0;while(1){if((q|0)>=(u|0))break g;ma=R+(q<<2)|0;ja=+g[ma>>2]+-.25;g[ma>>2]=ja<0.0?0.0:ja;q=q+1|0}}while(0);ja=s+.20000000298023224;W=v*64.0}else{ja=0.0;W=0.0}if(x){w=G?0.0:+(xa|0)*.5;q=(Xa|0)==2;v=-10.0;A=0.0;r=bb;while(1){if((r|0)>=(cb|0))break;ga=v+-1.0;s=+g[D+(r<<2)>>2]-w;s=ga>s?ga:s;do if(q){v=+g[D+(r+db<<2)>>2]-w;if(s>v)break;s=v}while(0);v=s;A=A+s;r=r+1|0}ma=e+208|0;Q=+g[ma>>2];ga=A/+(cb-bb|0)-Q;ha=ga<-1.5;ia=ga>3.0&(ha^1);ga=ia|ha?(ia?3.0:-1.5):ga;g[ma>>2]=Q+ga*.019999999552965164}else ga=0.0;if(!H)rf(E|0,D|0,ra<<2|0)|0;h:do if(J){f=Ta+20|0;r=c[f>>2]|0;I=Ta+28|0;q=c[I>>2]|0;do if((h|0)==0?(r+((aa(q|0)|0)+-32)+3|0)<=(p|0):0){if((c[qa>>2]|0)<=4){m=q;t=r;x=B;h=0;r=F;break}if(!x){m=q;t=r;x=B;h=0;r=F;break}if(Da){m=q;t=r;x=B;h=0;r=F;break}i:do if((Xa|0)==1){h=c[Za>>2]|0;c[V>>2]=h;s=(c[k>>2]=h,+g[k>>2]);h=0;while(1){h=h+1|0;if((h|0)>=(cb|0))break i;Q=+g[Za+(h<<2)>>2];Q=s+-1.0>Q?s+-1.0:Q;g[V+(h<<2)>>2]=Q;s=Q}}else{Q=+g[Za>>2];s=+g[Za+(db<<2)>>2];s=Q>s?Q:s;g[V>>2]=s;h=0;while(1){h=h+1|0;if((h|0)>=(cb|0))break i;A=+g[Za+(h<<2)>>2];Q=+g[Za+(h+db<<2)>>2];ma=A>Q;Q=s+-1.0>(ma?A:Q)?s+-1.0:ma?A:Q;g[V+(h<<2)>>2]=Q;s=Q}}while(0);h=cb+-2|0;while(1){if((h|0)<0)break;ma=V+(h<<2)|0;A=+g[ma>>2];Q=+g[V+(h+1<<2)>>2]+-1.0;g[ma>>2]=A>Q?A:Q;h=h+-1|0}h=cb+-1|0;r=0;s=0.0;do{q=_(r,db)|0;j=2;while(1){if((j|0)>=(h|0))break;A=+g[D+(j+q<<2)>>2];Q=+g[V+(j<<2)>>2];Q=(A<0.0?0.0:A)-(Q<0.0?0.0:Q);j=j+1|0;s=s+(Q<0.0?0.0:Q)}r=r+1|0}while((r|0)<(Xa|0));if(s/+(_(cb+-3|0,Xa)|0)>1.0){Uc(Pa,X,T,B,Xa,ab,xa,c[U>>2]|0);h=c[Ia>>2]|0;q=c[oa>>2]<=(na|0))break;t=b[h+(y<<1)>>1]|0;j=B+(r+(t<>1]|0)-t<=(t|0))break;Q=+g[j+(x<<2)>>2];x=x+1|0;s=s+Q*Q}Q=+O(+(s+1.0000000272452012e-27));g[C+(y+(_(u,c[Ua>>2]|0)|0)<<2)>>2]=Q;y=m}u=u+1|0}while((u|0)<(Xa|0));q=0;do{h=0;while(1){if((h|0)>=(na|0)){h=na;break}ma=h+(_(q,c[Ua>>2]|0)|0)|0;Q=+Y(+(+g[C+(ma<<2)>>2]))*1.4426950408889634;g[D+(ma<<2)>>2]=Q-+g[17220+(h<<2)>>2];h=h+1|0}while(1){if((h|0)>=(cb|0))break;g[D+((_(q,c[Ua>>2]|0)|0)+h<<2)>>2]=-14.0;h=h+1|0}q=q+1|0}while((q|0)<(Xa|0));s=+(xa|0)*.5;h=0;while(1){if((h|0)>=(ra|0))break;ma=E+(h<<2)|0;g[ma>>2]=+g[ma>>2]+s;h=h+1|0}g[Ga>>2]=.20000000298023224;q=B;h=1;r=X}else{q=B;h=0;r=F}m=c[I>>2]|0;t=c[f>>2]|0;x=q}else{m=q;t=r;x=B;r=F}while(0);if((t+((aa(m|0)|0)+-32)+3|0)>(p|0)){ma=h;$=r;break}j=m>>>3;q=m-j|0;H=Ta+32|0;if(h){c[H>>2]=(c[H>>2]|0)+q;q=j}c[I>>2]=q;u=Ta+36|0;y=Ta+40|0;z=Ta+24|0;B=Ta+8|0;F=Ta+4|0;G=Ta+44|0;j=t;while(1){if(q>>>0>=8388609){ma=h;$=r;break h}m=c[H>>2]|0;t=m>>>23;if((t|0)==255)c[u>>2]=(c[u>>2]|0)+1;else{m=m>>>31;q=c[y>>2]|0;if((q|0)>-1){j=c[z>>2]|0;if((j+(c[B>>2]|0)|0)>>>0<(c[F>>2]|0)>>>0){c[z>>2]=j+1;a[(c[Ta>>2]|0)+j>>0]=q+m;q=0}else q=-1;c[G>>2]=c[G>>2]|q}q=c[u>>2]|0;if(q|0){m=m+255&255;do{j=c[z>>2]|0;if((j+(c[B>>2]|0)|0)>>>0<(c[F>>2]|0)>>>0){c[z>>2]=j+1;a[(c[Ta>>2]|0)+j>>0]=m;j=0;q=c[u>>2]|0}else j=-1;c[G>>2]=c[G>>2]|j;q=q+-1|0;c[u>>2]=q}while((q|0)!=0)}c[y>>2]=t&255;m=c[H>>2]|0;q=c[I>>2]|0;j=c[f>>2]|0}c[H>>2]=m<<8&2147483392;q=q<<8;c[I>>2]=q;j=j+8|0;c[f>>2]=j}}else{x=B;ma=h;$=F}while(0);q=(_(Xa,Oa)|0)<<2;Z=i;i=i+((1*q|0)+15&-16)|0;q=c[Ia>>2]|0;r=c[oa>>2]<=(na|0))break;s=1.0/(+g[C+(h+(_(u,c[Ua>>2]|0)|0)<<2)>>2]+1.0000000272452012e-27);m=h+1|0;t=b[q+(m<<1)>>1]<>1]<=(t|0)){h=m;continue j}ia=h+j|0;g[Z+(ia<<2)>>2]=+g[x+(ia<<2)>>2]*s;h=h+1|0}}u=u+1|0;if((u|0)>=(Xa|0))break}X=i;i=i+((1*(db<<2)|0)+15&-16)|0;k:do if((l|0)<(Xa*15|0))if(Da&(l|0)<15){h=0;za=320}else{h=0;za=322}else{if(Da)if((l|0)<15){h=0;za=320;break}else{h=0;za=322;break}if((c[qa>>2]|0)<=1){h=0;za=322;break}if(c[ya>>2]|0){h=0;za=322;break}h=(1280/(l|0)|0)+2|0;h=Vc(Pa,na,ma,X,(h|0)<5?5:h,Z,Oa,xa,+g[Ga>>2],c[ba>>2]|0)|0;q=X+(na+-1<<2)|0;r=na;while(1){if((r|0)>=(cb|0))break k;c[X+(r<<2)>>2]=c[q>>2];r=r+1|0}}while(0);l:do if((za|0)==320)while(1){za=0;if((h|0)>=(cb|0)){h=ma;break l}c[X+(h<<2)>>2]=0;h=h+1|0;za=320}else if((za|0)==322)while(1){za=0;if((h|0)>=(cb|0)){h=0;break l}c[X+(h<<2)>>2]=ma;h=h+1|0;za=322}while(0);ha=i;i=i+((1*(ra<<2)|0)+15&-16)|0;m=0;do{q=_(m,db)|0;t=bb;while(1){if((t|0)>=(cb|0))break;r=t+q|0;j=D+(r<<2)|0;s=+g[j>>2];if(+N(+(s-+g[Za+(r<<2)>>2]))<2.0)g[j>>2]=s-+g[Va+(r<<2)>>2]*.25;t=t+1|0}m=m+1|0}while((m|0)<(Xa|0));qd(Pa,bb,cb,na,D,Za,p,ha,Ta,Xa,xa,n,c[e+12>>2]|0,e+84|0,(c[qa>>2]|0)>3&1,c[e+56>>2]|0,c[ya>>2]|0);da=Ta+4|0;q=c[da>>2]<<3;ea=Ta+20|0;m=c[ea>>2]|0;ia=Ta+28|0;j=c[ia>>2]|0;u=m+((aa(j|0)|0)+-32)|0;r=(ma|0)!=0;t=r?2:4;if(J)H=(u+t+1|0)>>>0<=q>>>0;else H=0;G=q-(H&1)|0;F=r?4:5;T=Ta+32|0;U=Ta+36|0;V=Ta+40|0;ba=Ta+24|0;ca=Ta+8|0;fa=Ta+44|0;x=0;B=bb;z=0;while(1){if((B|0)>=(cb|0))break;q=X+(B<<2)|0;if((u+t|0)>>>0>G>>>0){c[q>>2]=x;r=x;q=z}else{y=c[q>>2]|0;t=j>>>t;r=j-t|0;q=(y|0)==(x|0);if(!q)c[T>>2]=(c[T>>2]|0)+r;t=q?r:t;c[ia>>2]=t;q=m;while(1){if(t>>>0>=8388609)break;r=c[T>>2]|0;m=r>>>23;if((m|0)==255){c[U>>2]=(c[U>>2]|0)+1;j=t}else{j=r>>>31;q=c[V>>2]|0;if((q|0)>-1){r=c[ba>>2]|0;if((r+(c[ca>>2]|0)|0)>>>0<(c[da>>2]|0)>>>0){c[ba>>2]=r+1;a[(c[Ta>>2]|0)+r>>0]=q+j;q=0}else q=-1;c[fa>>2]=c[fa>>2]|q}q=c[U>>2]|0;if(q|0){j=j+255&255;do{r=c[ba>>2]|0;if((r+(c[ca>>2]|0)|0)>>>0<(c[da>>2]|0)>>>0){c[ba>>2]=r+1;a[(c[Ta>>2]|0)+r>>0]=j;r=0;q=c[U>>2]|0}else r=-1;c[fa>>2]=c[fa>>2]|r;q=q+-1|0;c[U>>2]=q}while((q|0)!=0)}c[V>>2]=m&255;r=c[T>>2]|0;j=c[ia>>2]|0;q=c[ea>>2]|0}c[T>>2]=r<<8&2147483392;t=j<<8;c[ia>>2]=t;q=q+8|0;c[ea>>2]=q}m=q;j=t;r=y;u=q+((aa(t|0)|0)+-32)|0;q=z|y}x=r;B=B+1|0;t=F;z=q}t=ma<<2;do if(H){if((a[t+z+(27892+(xa<<3))>>0]|0)==(a[(t|2)+z+(27892+(xa<<3))>>0]|0)){h=0;q=j;break}q=j>>>1;r=j-q|0;if(!h)q=r;else c[T>>2]=(c[T>>2]|0)+r;c[ia>>2]=q;r=m;while(1){if(q>>>0>=8388609)break;j=c[T>>2]|0;m=j>>>23;if((m|0)==255)c[U>>2]=(c[U>>2]|0)+1;else{j=j>>>31;q=c[V>>2]|0;if((q|0)>-1){r=c[ba>>2]|0;if((r+(c[ca>>2]|0)|0)>>>0<(c[da>>2]|0)>>>0){c[ba>>2]=r+1;a[(c[Ta>>2]|0)+r>>0]=q+j;q=0}else q=-1;c[fa>>2]=c[fa>>2]|q}q=c[U>>2]|0;if(q|0){j=j+255&255;do{r=c[ba>>2]|0;if((r+(c[ca>>2]|0)|0)>>>0<(c[da>>2]|0)>>>0){c[ba>>2]=r+1;a[(c[Ta>>2]|0)+r>>0]=j;r=0;q=c[U>>2]|0}else r=-1;c[fa>>2]=c[fa>>2]|r;q=q+-1|0;c[U>>2]=q}while((q|0)!=0)}c[V>>2]=m&255;j=c[T>>2]|0;q=c[ia>>2]|0;r=c[ea>>2]|0}c[T>>2]=j<<8&2147483392;q=q<<8;c[ia>>2]=q;r=r+8|0;c[ea>>2]=r}h=h<<1;m=r}else{h=0;q=j}while(0);h=t+h|0;r=bb;while(1){if((r|0)>=(cb|0))break;S=X+(r<<2)|0;c[S>>2]=a[h+(c[S>>2]|0)+(27892+(xa<<3))>>0];r=r+1|0}m:do if((m+((aa(q|0)|0)+-32)+4|0)<=(p|0)){n:do if(!(c[ya>>2]|0)){o:do if(Da){if(!(c[qa>>2]|0)){c[e+80>>2]=0;za=415;break}h=e+80|0;if(!ma){c[h>>2]=3;h=3;za=414;break n}else{c[h>>2]=2;h=2;za=414;break n}}else{h=c[qa>>2]|0;do if(!$){if((h|0)<3|(n|0)<(Xa*10|0))break;K=e+88|0;P=e+80|0;L=c[P>>2]|0;J=e+96|0;f=c[Ia>>2]|0;G=c[oa>>2]<>1]|0)-(b[f+(na+-1<<1)>>1]|0)<>2]=0;h=0;n=q>>>5;break o}else{I=0;h=0;n=0;r=0}do{H=_(I,G)|0;F=0;while(1){if((F|0)>=(na|0))break;x=b[f+(F<<1)>>1]|0;j=Z+(x<>1]|0)-x<>2];Q=Q*Q*s;t=t+1|0;y=y+(Q<.25&1)|0;z=z+(Q<.015625&1)|0;B=B+(Q<.0625&1)|0}if((F|0)>((c[Ua>>2]|0)+-4|0))h=h+((B+y<<5>>>0)/(x>>>0)|0)|0;F=u;n=n+1|0;r=r+(((z<<1|0)>=(x|0)&1)+((B<<1|0)>=(x|0)&1)+((y<<1|0)>=(x|0)&1)<<8)|0}I=I+1|0}while((I|0)<(Xa|0));if(!ka){if(!h)h=0;else h=(h>>>0)/((_(4-(c[Ua>>2]|0)+na|0,Xa)|0)>>>0)|0;h=(c[J>>2]|0)+h>>1;c[J>>2]=h;switch(c[la>>2]|0){case 2:{h=h+4|0;break}case 0:{h=h+-4|0;break}default:{}}c[la>>2]=(h|0)>22?2:(h|0)>18&1}h=((r>>>0)/(n>>>0)|0)+(c[K>>2]|0)>>1;c[K>>2]=h;h=(h*3|0)+(3-L<<7|64)+2>>2;do if((h|0)>=80){if((h|0)<256){h=2;break}h=(h|0)<384&1;c[P>>2]=h;n=q>>>5;if((h|0)>0){za=418;break n}else break o}else h=3;while(0);c[P>>2]=h;n=q>>>5;za=418;break n}while(0);n=e+80|0;if(!h){c[n>>2]=0;za=415;break}else{c[n>>2]=2;h=2;za=414;break n}}while(0);if((za|0)==415){h=0;n=q>>>5}h=q-(_(n,d[28203+h>>0]|0)|0)|0}else{c[la>>2]=0;c[e+80>>2]=2;h=2;za=414}while(0);if((za|0)==414){n=q>>>5;za=418}if((za|0)==418){oa=d[28203+(h+-1)>>0]|0;na=q-(_(n,oa)|0)|0;c[T>>2]=(c[T>>2]|0)+na;h=_(n,oa-(d[28203+h>>0]|0)|0)|0}c[ia>>2]=h;n=m;while(1){if(h>>>0>=8388609)break m;q=c[T>>2]|0;r=q>>>23;if((r|0)==255)c[U>>2]=(c[U>>2]|0)+1;else{q=q>>>31;h=c[V>>2]|0;if((h|0)>-1){n=c[ba>>2]|0;if((n+(c[ca>>2]|0)|0)>>>0<(c[da>>2]|0)>>>0){c[ba>>2]=n+1;a[(c[Ta>>2]|0)+n>>0]=h+q;h=0}else h=-1;c[fa>>2]=c[fa>>2]|h}h=c[U>>2]|0;if(h|0){q=q+255&255;do{n=c[ba>>2]|0;if((n+(c[ca>>2]|0)|0)>>>0<(c[da>>2]|0)>>>0){c[ba>>2]=n+1;a[(c[Ta>>2]|0)+n>>0]=q;n=0;h=c[U>>2]|0}else n=-1;c[fa>>2]=c[fa>>2]|n;h=h+-1|0;c[U>>2]=h}while((h|0)!=0)}c[V>>2]=r&255;q=c[T>>2]|0;h=c[ia>>2]|0;n=c[ea>>2]|0}c[T>>2]=q<<8&2147483392;h=h<<8;c[ia>>2]=h;n=n+8|0;c[ea>>2]=n}}while(0);S=i;i=i+((1*(db<<2)|0)+15&-16)|0;H=e+52|0;Q=+Wc(D,E,db,bb,cb,Xa,S,c[pa>>2]|0,c[Pa+56>>2]|0,ma,c[ua>>2]|0,c[H>>2]|0,wa,xa,l,Ea,c[ya>>2]|0,R);if(c[ya>>2]|0)c[S>>2]=(l|0)>26?8:(l|0)/3|0;I=i;i=i+((1*(db<<2)|0)+15&-16)|0;h=c[Ua>>2]|0;l=(xa<<1)+Xa+-1|0;n=Pa+104|0;q=0;while(1){if((q|0)>=(h|0))break;ua=q+1|0;pa=c[Ia>>2]|0;oa=(_(h,l)|0)+q|0;c[I+(q<<2)>>2]=(_(_((d[(c[n>>2]|0)+oa>>0]|0)+64|0,Xa)|0,(b[pa+(ua<<1)>>1]|0)-(b[pa+(q<<1)>>1]|0)<>2;q=ua}E=p<<3;pa=c[ea>>2]|0;h=c[ia>>2]|0;ua=32-(aa(h|0)|0)|0;F=h>>>(ua+-16|0);y=(F>>>12)+-8|0;l=pa;n=6;p=bb;y=(pa<<3)-((ua<<3)+(y+(F>>>0>(c[5272+(y<<2)>>2]|0)>>>0&1)))|0;F=0;while(1){if((p|0)>=(cb|0))break;B=p+1|0;j=(_(Xa,(b[wa+(B<<1)>>1]|0)-(b[wa+(p<<1)>>1]|0)|0)|0)<=(E-z|0))break;if((u|0)>=(c[m>>2]|0))break;r=(t|0)<(c[x>>2]|0);p=h>>>p;h=h-p|0;if(r){c[T>>2]=(c[T>>2]|0)+h;h=p}c[ia>>2]=h;while(1){if(h>>>0>=8388609)break;p=c[T>>2]|0;q=p>>>23;if((q|0)==255)c[U>>2]=(c[U>>2]|0)+1;else{p=p>>>31;h=c[V>>2]|0;if((h|0)>-1){l=c[ba>>2]|0;if((l+(c[ca>>2]|0)|0)>>>0<(c[da>>2]|0)>>>0){c[ba>>2]=l+1;a[(c[Ta>>2]|0)+l>>0]=h+p;h=0}else h=-1;c[fa>>2]=c[fa>>2]|h}h=c[U>>2]|0;if(h|0){p=p+255&255;do{l=c[ba>>2]|0;if((l+(c[ca>>2]|0)|0)>>>0<(c[da>>2]|0)>>>0){c[ba>>2]=l+1;a[(c[Ta>>2]|0)+l>>0]=p;l=0;h=c[U>>2]|0}else l=-1;c[fa>>2]=c[fa>>2]|l;h=h+-1|0;c[U>>2]=h}while((h|0)!=0)}c[V>>2]=q&255;p=c[T>>2]|0;h=c[ia>>2]|0;l=c[ea>>2]|0}c[T>>2]=p<<8&2147483392;h=h<<8;c[ia>>2]=h;l=l+8|0;c[ea>>2]=l}pa=32-(aa(h|0)|0)|0;ua=h>>>(pa+-16|0);q=(ua>>>12)+-8|0;q=(l<<3)-((pa<<3)+(q+(ua>>>0>(c[5272+(q<<2)>>2]|0)>>>0&1)))|0;if(!r)break;u=u+j|0;p=1;t=t+1|0;z=z+j|0}if(t)n=(n|0)<3?2:n+-1|0;c[x>>2]=u;p=B;y=q;F=z}R=(Xa|0)==2;if(R){if(!xa)r=0;else{n=0;s=1.0000000036274937e-15;v=1.0000000036274937e-15;p:while(1){if((n|0)==13)break;wa=c[Ia>>2]|0;p=n+1|0;q=b[wa+(p<<1)>>1]<>1]<=(q|0)){n=p;continue p}w=+g[Z+(n<<2)>>2];A=+g[Z+(n+Oa<<2)>>2];n=n+1|0;s=s+(+N(+w)+ +N(+A));v=v+(+N(+(w+A))+ +N(+(w-A)))}}r=b[(c[Ia>>2]|0)+26>>1]<>2]=+(r+((xa|0)<2?5:13)|0)*(v*.7071070075035095)>+(r|0)*s&1;r=xa}s=+((La|0)/1e3|0|0);q=e+200|0;n=c[q>>2]|0;p=0;while(1){if((p|0)>=21)break;if(+g[5104+(p<<2)>>2]>s)break;p=p+1|0}if(!((p|0)>(n|0)?+g[5104+(n<<2)>>2]+ +g[5188+(n<<2)>>2]>s:0))za=480;do if((za|0)==480){if((p|0)>=(n|0)){n=p;break}xa=n+-1|0;if(!(+g[5104+(xa<<2)>>2]-+g[5188+(xa<<2)>>2](n|0);c[q>>2]=(cb|0)<((P?bb:n)|0)?cb:P?bb:n;P=r}else P=xa;if((y+48|0)>(E-F|0))G=5;else{do if((bb|0)>0)za=487;else{if(c[ya>>2]|0){za=487;break}m=e+196|0;A=+g[Ga>>2];t=c[e+200>>2]|0;if(R){n=0;s=0.0;while(1){if((n|0)==8)break;q=c[Ia>>2]|0;p=b[q+(n<<1)>>1]|0;j=p<>1]|0)-p<=(p|0))break;w=v+ +g[r+(q<<2)>>2]*+g[j+(q<<2)>>2];q=q+1|0;v=w}s=s+v}v=+N(+(s*.125));v=v>1.0?1.0:v;n=8;w=v;while(1){if((n|0)>=(t|0))break;q=c[Ia>>2]|0;p=b[q+(n<<1)>>1]|0;j=p<>1]|0)-p<=(p|0))break;fb=s+ +g[r+(q<<2)>>2]*+g[j+(q<<2)>>2];q=q+1|0;s=fb}fb=+N(+s);w=w1.0?1.0:fb;v=+Y(+(1.0010000467300415-v*v))*1.4426950408889634;s=v*.5;fb=+Y(+(1.0010000467300415-fb*fb))*1.4426950408889634;v=v*.75;w=+g[m>>2]+.25;fb=-((s>fb?s:fb)*.5);g[m>>2]=w=(p|0))break;s=s+ +g[D+(n+(_(q,c[Ua>>2]|0)|0)<<2)>>2]*+((n<<1)+2-cb|0);n=n+1|0}q=q+1|0}while((q|0)<(Xa|0));s=(s/+(_(p,Xa)|0)+1.0)/6.0;wa=s>2.0;xa=s<-2.0&(wa^1);s=v-(xa|wa?(xa?-2.0:2.0):s)-W-A*2.0;if(c[e+120>>2]|0){fb=(+g[e+128>>2]+.05000000074505806)*2.0;wa=fb>2.0;xa=fb<-2.0&(wa^1);s=s-(xa|wa?(xa?-2.0:2.0):fb)}n=~~+M(+(s+.5));if((n|0)>10){p=h>>>7;n=10;za=512;break}p=h>>>7;if((n|0)>=0){if((n|0)>0){za=512;break}}else n=0;r=n;h=h-(_(p,d[28207+n>>0]|0)|0)|0}while(0);if((za|0)==487){g[e+196>>2]=0.0;p=h>>>7;n=5;za=512}if((za|0)==512){za=d[28207+(n+-1)>>0]|0;r=h-(_(p,za)|0)|0;c[T>>2]=(c[T>>2]|0)+r;r=n;h=_(p,za-(d[28207+n>>0]|0)|0)|0}c[ia>>2]=h;p=l;while(1){if(h>>>0>=8388609)break;l=c[T>>2]|0;q=l>>>23;if((q|0)==255){c[U>>2]=(c[U>>2]|0)+1;n=l;l=p}else{n=l>>>31;h=c[V>>2]|0;if((h|0)>-1){l=c[ba>>2]|0;if((l+(c[ca>>2]|0)|0)>>>0<(c[da>>2]|0)>>>0){c[ba>>2]=l+1;a[(c[Ta>>2]|0)+l>>0]=h+n;h=0}else h=-1;c[fa>>2]=c[fa>>2]|h}h=c[U>>2]|0;if(h|0){n=n+255&255;do{l=c[ba>>2]|0;if((l+(c[ca>>2]|0)|0)>>>0<(c[da>>2]|0)>>>0){c[ba>>2]=l+1;a[(c[Ta>>2]|0)+l>>0]=n;l=0;h=c[U>>2]|0}else l=-1;c[fa>>2]=c[fa>>2]|l;h=h+-1|0;c[U>>2]=h}while((h|0)!=0)}c[V>>2]=q&255;n=c[T>>2]|0;h=c[ia>>2]|0;l=c[ea>>2]|0}c[T>>2]=n<<8&2147483392;h=h<<8;c[ia>>2]=h;p=l+8|0;c[ea>>2]=p}xa=32-(aa(h|0)|0)|0;za=h>>>(xa+-16|0);y=(za>>>12)+-8|0;l=p;G=r;y=(p<<3)-((xa<<3)+(y+(za>>>0>(c[5272+(y<<2)>>2]|0)>>>0&1)))|0}if(Aa){B=(c[Ba>>2]|0)-P|0;l=3-P|0;D=1275>>>l;D=(o|0)<(D|0)?o:D;if(Da){h=(Xa*72|0)+32|0;h=(Ka|0)<(h|0)?0:Ka-h|0}else h=Ka-((Xa*320|0)+160)|0;z=(c[H>>2]|0)==0;if(z)x=h;else x=h+(c[e+184>>2]>>B)|0;if(Da){h=c[e+156>>2]|0;fb=+g[Ga>>2];h=~~(+(x+((h|0)<100?96>>>l:0)-((h|0)>100?144>>>l:0)|0)+(fb+-.25)*400.0);Ia=(y+F+63>>6)+2|0;l=Ca+296+F+63>>6;h=!(fb>.699999988079071)|(h|0)>400?h:400;l=(Ia|0)>(l|0)?Ia:l}else{l=c[e+92>>2]|0;p=c[e+200>>2]|0;v=+g[e+196>>2];q=c[Ea>>2]|0;w=+g[Ga>>2];o=c[e+64>>2]|0;t=c[ya>>2]|0;u=(c[e+204>>2]|0)!=0;m=c[Ua>>2]|0;j=c[Ia>>2]|0;l=(l|0)==0?m:l;h=b[j+(l<<1)>>1]<(p|0)?p:l)<<1)>>1]<>2]|0)==0;do if(n)h=x;else{s=+g[e+136>>2];if(!(s<.4)){h=x;break}h=x-~~(+(r<<3|0)*(.4000000059604645-s))|0}while(0);if(R){Ia=(l|0)>(p|0)?p:l;Ia=(b[j+(Ia<<1)>>1]<>2]+-.15000000596046448;s=+(r<<3|0);h=h+~~(s*1.2000000476837158*((fb<0.0?0.0:fb)+-.09000000357627869))|0;if(!va)break;h=h+~~(s*.800000011920929)|0}while(0);if(u&(t|0)==0){Ia=h+~~(+(r<<3|0)*ja)|0;h=(h|0)/4|0;h=(h|0)>(Ia|0)?h:Ia}Ga=~~(+((_(b[j+(m+-2<<1)>>1]<>2;Ia=(Ga|0)>(Ia|0)?Ga:Ia;h=(h|0)<(Ia|0)?h:Ia;do if(!(u&(t|0)==0)){if(!z)h=~~(+(h-x|0)*.6700000166893005)+x|0;if(!(w<.20000000298023224&(u^1)))break;Ia=96e3-La|0;Ga=(Ia|0)>32e3;h=h+~~(((La|0)>96e3&(Ga^1)?0.0:Ga?.09919999539852142:+(Ia|0)*3.099999958067201e-06)*ga*+(h|0))|0}while(0);l=x<<1;h=(l|0)<(h|0)?l:h;l=(y+F+63>>6)+2|0}o=h+y|0;p=o+32>>6;p=(l|0)>(p|0)?l:p;p=(D|0)<(p|0)?D:p;q=(Ma|0)==0;h=q?p:2;l=e+188|0;n=c[l>>2]|0;if((n|0)<970){c[l>>2]=n+1;s=1.0/+(n+21|0)}else s=1.0000000474974513e-03;do if(!z){l=e+176|0;c[l>>2]=(c[l>>2]|0)+((q?p<<6:128)-Ka);l=e+184|0;Ia=e+180|0;n=c[Ia>>2]|0;n=n+~~(s*+(((q?o-Ka|0:0)<>2]|0)-n|0))|0;c[Ia>>2]=n;c[l>>2]=0-n;l=e+176|0;n=c[l>>2]|0;if((n|0)>=0)break;c[l>>2]=0;h=q?p+((n|0)/-64|0)|0:2}while(0);L=(D|0)<(h|0)?D:h;Ka=c[Ta>>2]|0;l=c[ca>>2]|0;h=0-l|0;sf(Ka+L+h|0,Ka+(c[da>>2]|0)+h|0,l|0)|0;c[da>>2]=L;l=c[ea>>2]|0;h=c[ia>>2]|0}else L=o;f=i;i=i+((1*(db<<2)|0)+15&-16)|0;E=i;i=i+((1*(db<<2)|0)+15&-16)|0;J=i;i=i+((1*(db<<2)|0)+15&-16)|0;F=L<<6;Ka=32-(aa(h|0)|0)|0;K=h>>>(Ka+-16|0);h=(K>>>12)+-8|0;h=F+((Ka<<3)+(h+(K>>>0>(c[5272+(h<<2)>>2]|0)>>>0&1))-(l<<3))+-1|0;K=(ma|0)==0;if((P|0)>1&(K^1))B=(h|0)>=((P<<3)+16|0);else B=0;D=B?8:0;l=h-D|0;if(!(c[e+120>>2]|0))h=cb+-1|0;else{do if((La|0)<(Xa*32e3|0))h=13;else{if((La|0)<(Xa*48e3|0)){h=16;break}if((La|0)<(Xa*6e4|0)){h=18;break}h=(La|0)<(Xa*8e4|0)?19:20}while(0);La=c[e+144>>2]|0;h=(La|0)>(h|0)?La:h}z=e+200|0;n=e+92|0;y=sd(Pa,bb,cb,S,I,G,z,Ra,l,Qa,E,f,J,Xa,P,Ta,1,c[n>>2]|0,(c[ya>>2]|0)==0?h:1)|0;h=c[n>>2]|0;if(!h)h=y;else{Ka=h+1|0;h=h+-1|0;La=(h|0)>(y|0);h=(Ka|0)<((La?h:y)|0)?Ka:La?h:y}c[n>>2]=h;H=Ta+12|0;I=Ta+16|0;x=bb;while(1){if((x|0)>=(cb|0))break;j=c[f+(x<<2)>>2]|0;if((j|0)>=1){m=65536<>16;s=+(m|0);v=+(1<<14-j|0);t=m+-1|0;h=c[Ua>>2]|0;u=0;do{r=~~+M(+((+g[ha+(x+(_(u,h)|0)<<2)>>2]+.5)*s));r=(r|0)<(m|0)?r:t;r=(r|0)<0?0:r;h=c[H>>2]|0;l=c[I>>2]|0;if((l+j|0)>>>0>32){p=7-l|0;p=l+((p|0)>-8?p:-8)&-8;q=l;do{n=c[ca>>2]|0;o=c[da>>2]|0;if(((c[ba>>2]|0)+n|0)>>>0>>0){n=n+1|0;c[ca>>2]=n;a[(c[Ta>>2]|0)+(o-n)>>0]=h;n=0}else n=-1;c[fa>>2]=c[fa>>2]|n;h=h>>>8;q=q+-8|0}while((q|0)>7);l=l+-8-p|0}c[H>>2]=h|r<>2]=l+j;c[ea>>2]=(c[ea>>2]|0)+j;fb=(+(r|0)+.5)*v*.00006103515625+-.5;h=Za+(x+(_(u,c[Ua>>2]|0)|0)<<2)|0;g[h>>2]=+g[h>>2]+fb;h=c[Ua>>2]|0;La=ha+(x+(_(u,h)|0)<<2)|0;g[La>>2]=+g[La>>2]-fb;u=u+1|0}while((u|0)<(Xa|0))}x=x+1|0}La=i;i=i+((1*ra|0)+15&-16)|0;G=e+76|0;Yd(1,Pa,bb,cb,Z,R?Z+(Oa<<2)|0:0,La,C,E,$,c[e+80>>2]|0,c[Ra>>2]|0,c[z>>2]|0,X,F-D|0,c[Qa>>2]|0,Ta,P,y,G,c[qa>>2]|0,c[e+72>>2]|0);if(B){r=(c[e+116>>2]|0)<2&1;h=c[H>>2]|0;l=c[I>>2]|0;if((l+1|0)>>>0>32){p=7-l|0;p=l+((p|0)>-8?p:-8)&-8;q=l;do{n=c[ca>>2]|0;o=c[da>>2]|0;if(((c[ba>>2]|0)+n|0)>>>0>>0){n=n+1|0;c[ca>>2]=n;a[(c[Ta>>2]|0)+(o-n)>>0]=h;n=0}else n=-1;c[fa>>2]=c[fa>>2]|n;h=h>>>8;q=q+-8|0}while((q|0)>7);l=l+-8-p|0}c[H>>2]=h|r<>2]=l+1;h=(c[ea>>2]|0)+1|0;c[ea>>2]=h}else h=c[ea>>2]|0;h=(L<<3)-(h+((aa(c[ia>>2]|0)|0)+-32))|0;x=0;while(1){if((x|0)==2)break;else u=bb;while(1){if(!((u|0)<(cb|0)&(h|0)>=(Xa|0)))break;l=c[f+(u<<2)>>2]|0;do if((l|0)<=7){if((c[J+(u<<2)>>2]|0)!=(x|0))break;s=+(1<<14-l+-1|0);l=c[Ua>>2]|0;n=c[I>>2]|0;o=c[H>>2]|0;t=0;do{m=!(+g[ha+(u+(_(t,l)|0)<<2)>>2]<0.0);j=m&1;if((n+1|0)>>>0>32){q=7-n|0;q=n+((q|0)>-8?q:-8)&-8;r=n;l=o;do{o=c[ca>>2]|0;p=c[da>>2]|0;if(((c[ba>>2]|0)+o|0)>>>0

>>0){o=o+1|0;c[ca>>2]=o;a[(c[Ta>>2]|0)+(p-o)>>0]=l;o=0}else o=-1;c[fa>>2]=c[fa>>2]|o;l=l>>>8;r=r+-8|0}while((r|0)>7);n=n+-8-q|0}else l=o;o=l|j<>2]=o;c[I>>2]=n;c[ea>>2]=(c[ea>>2]|0)+1;fb=(+(m&1)+-.5)*s*.00006103515625;l=Za+(u+(_(t,c[Ua>>2]|0)|0)<<2)|0;g[l>>2]=+g[l>>2]+fb;l=c[Ua>>2]|0;Ra=ha+(u+(_(t,l)|0)<<2)|0;g[Ra>>2]=+g[Ra>>2]-fb;h=h+-1|0;t=t+1|0}while((t|0)<(Xa|0))}while(0);u=u+1|0}x=x+1|0}o=Wa<<2;nf(Va|0,0,o|0)|0;l=0;do{h=_(l,db)|0;n=bb;while(1){if((n|0)>=(cb|0))break;Ua=n+h|0;fb=+g[ha+(Ua<<2)>>2];Qa=fb>.5;Ra=fb<-.5&(Qa^1);g[Va+(Ua<<2)>>2]=Ra|Qa?(Ra?-.5:.5):fb;n=n+1|0}l=l+1|0}while((l|0)<(Xa|0));q:do if(Ma|0){h=0;while(1){if((h|0)>=(ra|0))break q;g[Za+(h<<2)>>2]=-28.0;h=h+1|0}}while(0);c[e+104>>2]=c[Ya>>2];g[e+108>>2]=Ha;c[e+112>>2]=Ja;if(sa&(Xa|0)==1)rf(Za+(db<<2)|0,Za|0,db<<2|0)|0;r:do if(K){rf($a|0,_a|0,o|0)|0;rf(_a|0,Za|0,o|0)|0;n=0}else{h=0;while(1){if((h|0)>=(Wa|0)){n=0;break r}Ya=_a+(h<<2)|0;Ha=+g[Ya>>2];fb=+g[Za+(h<<2)>>2];g[Ya>>2]=Ha=(bb|0)){h=cb;break}Ya=l+h|0;g[Za+(Ya<<2)>>2]=0.0;g[$a+(Ya<<2)>>2]=-28.0;g[_a+(Ya<<2)>>2]=-28.0;h=h+1|0}while(1){if((h|0)>=(db|0))break;Ya=l+h|0;g[Za+(Ya<<2)>>2]=0.0;g[$a+(Ya<<2)>>2]=-28.0;g[_a+(Ya<<2)>>2]=-28.0;h=h+1|0}n=n+1|0}while((n|0)<(ab|0));l=e+116|0;if(!(ma|ta))h=0;else h=(c[l>>2]|0)+1|0;c[l>>2]=h;c[G>>2]=c[ia>>2];cd(Ta);e=(c[fa>>2]|0)==0?L:-3;Na(Sa|0);i=eb;return e|0}function Sc(a,b,d,e,f,h,j,k,l,m,n){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;h=h|0;j=j|0;k=k|0;l=l|0;m=m|0;n=n|0;var o=0,p=0.0,q=0,r=0.0,s=0,t=0,u=0.0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,O=0;L=i;i=i+16|0;K=L+8|0;t=L;w=c[a>>2]|0;H=c[w+4>>2]|0;q=f+1024|0;J=(_(q,e)|0)<<2;I=i;i=i+((1*J|0)+15&-16)|0;c[K>>2]=I;c[K+4>>2]=I+(q<<2);I=H+f|0;J=f<<2;o=0;do{G=c[K+(o<<2)>>2]|0;rf(G|0,d+(o<<10<<2)|0,4096)|0;rf(G+4096|0,b+((_(o,I)|0)<<2)+(H<<2)|0,J|0)|0;o=o+1|0}while((o|0)<(e|0));if(!m){c[t>>2]=15;G=a+104|0;F=15;u=0.0}else{s=Fa()|0;o=i;i=i+((1*(q>>1<<2)|0)+15&-16)|0;gd(K,o,q,e);id(o+2048|0,o,f,979,t);c[t>>2]=1024-(c[t>>2]|0);m=a+104|0;p=+kd(o,f,t,c[m>>2]|0,+g[a+108>>2]);o=c[t>>2]|0;if((o|0)>1022){c[t>>2]=1022;o=1022}u=p*.699999988079071;E=c[a+56>>2]|0;u=(E|0)>2?u*.5:u;Na(s|0);G=m;F=o;u=(E|0)>8?0.0:(E|0)>4?u*.5:u}q=c[G>>2]|0;E=F-q|0;p=(((E|0)>-1?E:0-E|0)*10|0)>(F|0)?.4000000059604645:.20000000298023224;if((n|0)>=25){if((n|0)<35)v=11}else{p=p+.10000000149011612;v=11}if((v|0)==11)p=p+.10000000149011612;E=a+108|0;r=+g[E>>2];p=r>.4000000059604645?p+-.10000000149011612:p;p=r>.550000011920929?p+-.10000000149011612:p;if(u<(p>.20000000298023224?p:.20000000298023224)){r=0.0;D=0;o=0}else{m=+N(+(u-r))<.10000000149011612;m=~~+M(+((m?r:u)*32.0/3.0+.5));o=m+-1|0;if((o|0)<=7)if((m|0)<1)o=0;else v=15;else{o=7;v=15}r=+(o+1|0)*.09375;D=1}A=w+44|0;B=H<<2;p=-r;C=a+112|0;w=w+60|0;x=(f|0)>1024;y=1024-f<<2;z=0-f|0;m=0;while(1){n=c[A>>2]|0;v=n-H|0;c[G>>2]=(q|0)>15?q:15;q=b+((_(m,I)|0)<<2)|0;s=a+212+((_(m,H)|0)<<2)|0;rf(q|0,s|0,B|0)|0;if((n|0)==(H|0))n=c[K+(m<<2)>>2]|0;else{n=c[K+(m<<2)>>2]|0;O=c[G>>2]|0;u=-+g[E>>2];t=c[C>>2]|0;yc(q+(H<<2)|0,n+4096|0,O,O,v,u,u,t,t,0,0)}t=n+4096|0;yc(q+(H<<2)+(v<<2)|0,t+(v<<2)|0,c[G>>2]|0,F,f-v|0,-+g[E>>2],p,c[C>>2]|0,h,c[w>>2]|0,H);rf(s|0,q+(f<<2)|0,B|0)|0;q=d+(m<<10<<2)|0;if(x)rf(q|0,n+(f<<2)|0,4096)|0;else{sf(q|0,q+(f<<2)|0,y|0)|0;rf(q+4096+(z<<2)|0,t|0,J|0)|0}m=m+1|0;if((m|0)>=(e|0))break;q=c[G>>2]|0}g[k>>2]=r;c[j>>2]=F;c[l>>2]=o;i=L;return D|0}function Tc(a,b,e,f,h){a=a|0;b=b|0;e=e|0;f=f|0;h=h|0;var j=0.0,k=0.0,l=0,m=0,n=0.0,o=0,p=0,q=0.0,r=0.0,s=0,t=0,u=0,v=0,w=0,x=0,y=0.0,z=0,A=0;x=i;o=i;i=i+((1*(b<<2)|0)+15&-16)|0;p=(b|0)/2|0;q=+(p|0);r=+(p|0);s=p+-5|0;t=(p*6|0)+-102|0;u=0;v=0;while(1){if((u|0)>=(e|0))break;l=_(u,b)|0;m=0;j=0.0;k=0.0;while(1){if((m|0)>=(b|0))break;y=+g[a+(m+l<<2)>>2];n=j+y;g[o+(m<<2)>>2]=n;m=m+1|0;j=k+n-y*2.0;k=y-n*.5}l=o;m=l+48|0;do{c[l>>2]=0;l=l+4|0}while((l|0)<(m|0));l=0;n=0.0;j=0.0;while(1){if((l|0)>=(p|0)){l=p;k=0.0;break}m=l<<1;y=+g[o+(m<<2)>>2];k=+g[o+((m|1)<<2)>>2];k=y*y+k*k;y=j+(k-j)*.0625;g[o+(l<<2)>>2]=y;l=l+1|0;n=n+k;j=y}a:while(1){m=l;j=k;while(1){l=m+-1|0;if((m|0)<=0)break a;m=o+(l<<2)|0;j=j+(+g[m>>2]-j)*.125;g[m>>2]=j;if(k>j)m=l;else{k=j;continue a}}}j=r/(+O(+(n*k*.5*q))+1.0000000036274937e-15)*64.0;l=12;m=0;while(1){if((l|0)>=(s|0))break;y=+M(+(j*(+g[o+(l<<2)>>2]+1.0000000036274937e-15)));A=y>127.0;z=y<0.0&(A^1);l=l+4|0;m=m+(d[28075+~~(z|A?(z?0.0:127.0):y)>>0]|0)|0}l=(m<<8|0)/(t|0)|0;if((l|0)>(v|0))c[h>>2]=u;else l=v;u=u+1|0;v=l}l=(v|0)>200&1;j=+O(+(+(v*27|0)))+-42.0;if(!(j<0.0))if(j>163.0)k=163.0;else w=20;else{j=0.0;w=20}if((w|0)==20)k=j;if(k*.006899999920278788+-.139<0.0){y=0.0;y=+O(+y);g[f>>2]=y;i=x;return l|0}y=(j>163.0?163.0:j)*.006899999920278788+-.139;y=+O(+y);g[f>>2]=y;i=x;return l|0}function Uc(a,b,d,e,f,h,i,j){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;h=h|0;i=i|0;j=j|0;var k=0,l=0.0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0;q=c[a+4>>2]|0;p=(b|0)==0;t=c[a+44>>2]<<(p?i:0);s=p?1:b;p=(c[a+36>>2]|0)-(p?i:0)|0;o=a+64|0;r=_(s,t)|0;n=r+q|0;b=a+60|0;m=0;do{i=d+((_(m,n)|0)<<2)|0;a=_(_(m,t)|0,s)|0;k=0;while(1){if((k|0)>=(s|0))break;u=i+((_(k,t)|0)<<2)|0;ed(o,u,e+(k+a<<2)|0,c[b>>2]|0,q,p,s);k=k+1|0}m=m+1|0}while((m|0)<(h|0));a:do if((h|0)==2&(f|0)==1){b=0;while(1){if((b|0)>=(r|0))break a;u=e+(b<<2)|0;g[u>>2]=+g[u>>2]*.5+ +g[e+(r+b<<2)>>2]*.5;b=b+1|0}}while(0);if((j|0)==1)return;m=(r|0)/(j|0)|0;l=+(j|0);b=r-m<<2;a=0;do{i=_(_(a,s)|0,t)|0;k=0;while(1){if((k|0)>=(m|0))break;u=e+(i+k<<2)|0;g[u>>2]=+g[u>>2]*l;k=k+1|0}nf(e+(i+m<<2)|0,0,b|0)|0;a=a+1|0}while((a|0)<(f|0));return}function Vc(d,e,f,h,j,k,l,m,n,o){d=d|0;e=e|0;f=f|0;h=h|0;j=j|0;k=k|0;l=l|0;m=m|0;n=+n;o=o|0;var p=0,q=0,r=0,s=0,t=0.0,u=0,v=0,w=0,x=0,y=0,z=0,A=0.0,B=0,C=0,D=0,E=0,F=0,G=0,H=0.0,I=0,J=0,K=0,L=0,M=0,O=0,P=0,Q=0.0,R=0,S=0;P=i;i=i+16|0;J=P;H=.5-n;H=(H<-.25?-.25:H)*.03999999910593033;L=i;i=i+((1*(e<<2)|0)+15&-16)|0;G=c[d+32>>2]|0;K=e+-1|0;M=(b[G+(e<<1)>>1]|0)-(b[G+(K<<1)>>1]|0)<=(e|0))break;C=w+1|0;d=b[G+(w<<1)>>1]|0;D=(b[G+(C<<1)>>1]|0)-d|0;v=D<=(v|0))break;n=n+ +N(+(+g[E+(d<<2)>>2]));d=d+1|0}t=n+(I?0.0:+(m|0))*H*n;if(!(I|D)){rf(F|0,E|0,l|0)|0;d=v>>m>>1;l=0;while(1){if((l|0)<(y|0))o=0;else{n=0.0;d=0;break}while(1){if((o|0)>=(d|0))break;s=F+((_(z,o)|0)+l<<2)|0;Q=+g[s>>2]*.7071067690849304;u=F+(((o<<1|1)<>2]*.7071067690849304;g[s>>2]=Q+n;g[u>>2]=Q-n;o=o+1|0}l=l+1|0}while(1){if((d|0)>=(v|0))break;n=n+ +N(+(+g[F+(d<<2)>>2]));d=d+1|0}n=n+A*n;if(n=(((D|I^1)&1^1)+m|0))break;r=I?u+1|0:m-u+-1|0;d=1<>u>>1;o=d<<1;p=0;while(1){if((p|0)<(d|0))q=0;else{t=0.0;d=0;break}while(1){if((q|0)>=(l|0))break;S=E+((_(o,q)|0)+p<<2)|0;t=+g[S>>2]*.7071067690849304;R=E+(((q<<1|1)<>2]*.7071067690849304;g[S>>2]=t+Q;g[R>>2]=t-Q;q=q+1|0}p=p+1|0}while(1){if((d|0)>=(v|0))break;t=t+ +N(+(+g[E+(d<<2)>>2]));d=d+1|0}Q=t+ +(r|0)*H*t;R=Q>2]=l;if(!D){w=C;continue}if(!((l|0)==0|(l|0)==(B|0))){w=C;continue}c[d>>2]=l+-1;w=C}s=f<<2;r=0;while(1){if((r|0)==2)break;l=s+(r<<1)|0;d=27892+(m<<3)+l|0;l=(l|1)+(27892+(m<<3))|0;o=0;p=I?j:0;q=1;while(1){if((q|0)>=(e|0))break;k=p+j|0;R=o+j|0;S=c[L+(q<<2)>>2]|0;f=S-(a[d>>0]<<1)|0;S=S-(a[l>>0]<<1)|0;o=((o|0)<(k|0)?o:k)+((f|0)>-1?f:0-f|0)|0;p=((R|0)<(p|0)?R:p)+((S|0)>-1?S:0-S|0)|0;q=q+1|0}c[J+(r<<2)>>2]=(o|0)<(p|0)?o:p;r=r+1|0}r=I?0:(c[J+4>>2]|0)<(c[J>>2]|0)&1;o=s|r<<1;q=27892+(m<<3)+o|0;o=(o|1)+(27892+(m<<3))|0;p=0;d=I?j:0;l=1;while(1){if((l|0)>=(e|0))break;I=d+j|0;f=(p|0)<(I|0);c[M+(l<<2)>>2]=f&1^1;R=p+j|0;m=(R|0)<(d|0);c[O+(l<<2)>>2]=m&1^1;S=c[L+(l<<2)>>2]|0;J=S-(a[q>>0]<<1)|0;S=S-(a[o>>0]<<1)|0;p=(f?p:I)+((J|0)>-1?J:0-J|0)|0;d=(m?R:d)+((S|0)>-1?S:0-S|0)|0;l=l+1|0}l=(p|0)>=(d|0)&1;c[h+(K<<2)>>2]=l;d=e+-2|0;while(1){if((d|0)<=-1)break;S=c[((l|0)==1?O:M)+(d+1<<2)>>2]|0;c[h+(d<<2)>>2]=S;l=S;d=d+-1|0}i=P;return r|0}function Wc(a,d,e,f,h,j,l,m,n,o,p,q,r,s,t,u,v,w){a=a|0;d=d|0;e=e|0;f=f|0;h=h|0;j=j|0;l=l|0;m=m|0;n=n|0;o=o|0;p=p|0;q=q|0;r=r|0;s=s|0;t=t|0;u=u|0;v=v|0;w=w|0;var x=0.0,y=0,z=0,A=0,B=0.0,C=0.0,D=0,E=0.0,F=0.0,G=0.0,H=0.0,I=0.0,J=0.0,K=0.0,L=0,M=0,N=0,O=0,P=0,Q=0.0,R=0,S=0,T=0,U=0.0,V=0;T=i;O=_(j,e)|0;R=i;i=i+((1*(O<<2)|0)+15&-16)|0;P=i;i=i+((1*(O<<2)|0)+15&-16)|0;nf(l|0,0,e<<2|0)|0;x=+(9-m|0);m=0;while(1){if((m|0)>=(h|0)){n=0;x=-31.899999618530273;break}O=m+5|0;g[P+(m<<2)>>2]=+(b[n+(m<<1)>>1]|0)*.0625+.5+x-+g[17220+(m<<2)>>2]+ +(_(O,O)|0)*.006200000178068876;m=m+1|0}while(1){m=_(n,e)|0;y=0;Q=x;while(1){if((y|0)>=(h|0))break;K=+g[a+(m+y<<2)>>2]-+g[P+(y<<2)>>2];y=y+1|0;Q=Q>K?Q:K}n=n+1|0;if((n|0)>=(j|0))break;else x=Q}if(!((t|0)>50&(s|0)>0&(v|0)==0)){S=0;c[u>>2]=S;i=T;return +Q}L=h+-2|0;M=h+-1|0;O=0;m=0;while(1){A=_(O,e)|0;N=R+(A<<2)|0;z=d+(A<<2)|0;n=c[z>>2]|0;c[N>>2]=n;K=(c[k>>2]=n,+g[k>>2]);x=K;n=1;D=m;while(1){if((n|0)>=(h|0)){n=D;break}v=A+n|0;J=+g[d+(v<<2)>>2];v=J>+g[d+(v+-1<<2)>>2]+.5?n:D;J=x+1.5>2]=J;x=J;n=n+1|0;D=v}while(1){m=n+-1|0;if((n|0)<=0){v=2;break}v=N+(m<<2)|0;H=+g[v>>2];I=+g[N+(n<<2)>>2]+2.0;J=+g[d+(A+m<<2)>>2];y=I>2]=H<(y?I:J)?H:y?I:J;n=m}while(1){if((v|0)>=(L|0))break;y=N+(v<<2)|0;F=+g[y>>2];n=d+(A+v+-2<<2)|0;x=+g[n+8>>2];G=+g[n>>2];H=+g[n+4>>2];m=G>H;U=m?G:H;B=m?H:G;I=+g[n+12>>2];J=+g[n+16>>2];n=I>J;C=n?J:I;E=n?I:J;V=B>C;C=V?B:C;B=V?E:U;E=V?U:E;do if(x>B)if(BB+-1.0)x=F;else{U=m?G:H;B=m?H:G;C=n?J:I;E=n?I:J;V=B>C;C=V?B:C;B=V?E:U;E=V?U:E;do if(x>B)if(B>2]=x;v=v+1|0}C=+g[z+4>>2];V=K>C;x=V?C:K;C=V?K:C;B=+g[z+8>>2];if(!(C>2];g[N>>2]=B>C?B:C;V=N+4|0;B=+g[V>>2];g[V>>2]=B>C?B:C;V=d+(A+h+-3<<2)|0;C=+g[V>>2];B=+g[V+4>>2];A=C>B;x=A?B:C;B=A?C:B;C=+g[V+8>>2];if(!(B>2];g[m>>2]=K>U?K:U;m=N+(M<<2)|0;K=+g[m>>2];g[m>>2]=K>U?K:U;m=0;while(1){if((m|0)>=(h|0))break;V=N+(m<<2)|0;K=+g[V>>2];U=+g[P+(m<<2)>>2];g[V>>2]=K>U?K:U;m=m+1|0}O=O+1|0;if((O|0)>=(j|0))break;else m=D}a:do if((j|0)==2){m=f;while(1){if((m|0)>=(h|0)){m=f;break a}P=m+e|0;d=R+(P<<2)|0;U=+g[d>>2];V=R+(m<<2)|0;K=+g[V>>2]+-4.0;K=U>K?U:K;g[d>>2]=K;U=+g[V>>2];K=K+-4.0;K=U>K?U:K;g[V>>2]=K;K=+g[a+(m<<2)>>2]-K;U=+g[a+(P<<2)>>2]-+g[d>>2];g[V>>2]=((K<0.0?0.0:K)+(U<0.0?0.0:U))*.5;m=m+1|0}}else{m=f;while(1){if((m|0)>=(h|0)){m=f;break a}V=R+(m<<2)|0;U=+g[a+(m<<2)>>2]-+g[V>>2];g[V>>2]=U<0.0?0.0:U;m=m+1|0}}while(0);while(1){if((m|0)>=(h|0))break;V=R+(m<<2)|0;K=+g[V>>2];U=+g[w+(m<<2)>>2];g[V>>2]=K>U?K:U;m=m+1|0}D=(p|0)==0;b:do if((D|(q|0)!=0)&(o|0)==0){m=f;while(1){if((m|0)>=(h|0))break b;V=R+(m<<2)|0;g[V>>2]=+g[V>>2]*.5;m=m+1|0}}while(0);A=(t|0)/4|0;z=(q|0)==0;m=0;while(1){if((f|0)>=(h|0)){S=76;break}if((f|0)>=8){n=R+(f<<2)|0;x=+g[n>>2];if((f|0)>11){x=x*.5;g[n>>2]=x}}else{n=R+(f<<2)|0;x=+g[n>>2]*2.0;g[n>>2]=x}x=x<4.0?x:4.0;g[n>>2]=x;v=f+1|0;n=(_((b[r+(v<<1)>>1]|0)-(b[r+(f<<1)>>1]|0)|0,j)|0)<=6)if((n|0)>48){V=~~(x*8.0);y=V;n=((_(V,n)|0)<<3|0)/8|0;break}else{n=~~(x*+(n|0)/6.0);y=n;n=n*48|0;break}else{V=~~x;y=V;n=(_(V,n)|0)<<3}while(0);if(!((z|(o|0)!=0)&(D^1))?(m+n>>6|0)>(A|0):0)break;c[l+(f<<2)>>2]=y;f=v;m=m+n|0}if((S|0)==76){c[u>>2]=m;i=T;return +Q}V=A<<6;c[l+(f<<2)>>2]=V-m;c[u>>2]=V;i=T;return +Q}function Xc(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,h=0,j=0;h=i;i=i+16|0;e=h;c[e>>2]=d;do switch(b|0){case 10010:{f=(c[e>>2]|0)+(4-1)&~(4-1);b=c[f>>2]|0;c[e>>2]=f+4;if((b|0)>=0?(b|0)<(c[(c[a>>2]|0)+8>>2]|0):0){c[a+20>>2]=b;b=25}else b=26;break}case 10012:{f=(c[e>>2]|0)+(4-1)&~(4-1);b=c[f>>2]|0;c[e>>2]=f+4;if((b|0)>=1?(b|0)<=(c[(c[a>>2]|0)+8>>2]|0):0){c[a+24>>2]=b;b=25}else b=26;break}case 10008:{f=(c[e>>2]|0)+(4-1)&~(4-1);b=c[f>>2]|0;c[e>>2]=f+4;if((b+-1|0)>>>0>1)b=26;else{c[a+12>>2]=b;b=25}break}case 10007:{f=(c[e>>2]|0)+(4-1)&~(4-1);b=c[f>>2]|0;c[e>>2]=f+4;if(!b)b=26;else{a=a+40|0;c[b>>2]=c[a>>2];c[a>>2]=0;b=25}break}case 4027:{f=(c[e>>2]|0)+(4-1)&~(4-1);b=c[f>>2]|0;c[e>>2]=f+4;if(!b)b=26;else{c[b>>2]=(c[a+4>>2]|0)/(c[a+16>>2]|0)|0;b=25}break}case 4028:{f=c[a+8>>2]|0;b=a+88+((_((c[a+4>>2]|0)+2048|0,f)|0)<<2)+(f*24<<2)|0;j=c[a>>2]|0;e=c[j+8>>2]|0;d=e<<1;b=b+(d<<2)|0;d=b+(d<<2)|0;nf(a+36|0,0,((_((c[j+4>>2]|0)+2048|0,f)|0)<<2)+88+(f*96|0)+(e<<5)+-36|0)|0;f=0;while(1){if((f|0)>=(e<<1|0))break;g[d+(f<<2)>>2]=-28.0;g[b+(f<<2)>>2]=-28.0;e=c[(c[a>>2]|0)+8>>2]|0;f=f+1|0}c[a+52>>2]=1;b=25;break}case 4033:{j=(c[e>>2]|0)+(4-1)&~(4-1);b=c[j>>2]|0;c[e>>2]=j+4;if(!b)b=26;else{c[b>>2]=c[a+56>>2];b=25}break}case 10015:{j=(c[e>>2]|0)+(4-1)&~(4-1);b=c[j>>2]|0;c[e>>2]=j+4;if(!b)b=26;else{c[b>>2]=c[a>>2];b=25}break}case 10016:{j=(c[e>>2]|0)+(4-1)&~(4-1);b=c[j>>2]|0;c[e>>2]=j+4;c[a+28>>2]=b;b=25;break}case 4031:{j=(c[e>>2]|0)+(4-1)&~(4-1);b=c[j>>2]|0;c[e>>2]=j+4;if(!b)b=26;else{c[b>>2]=c[a+36>>2];b=25}break}default:{i=h;return}}while(0);if((b|0)==25){i=h;return}else if((b|0)==26){i=h;return}}function Yc(e,f,h,j,k,l,m){e=e|0;f=f|0;h=h|0;j=j|0;k=k|0;l=l|0;m=m|0;var n=0,o=0,p=0.0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0.0,z=0.0,A=0.0,B=0,C=0,D=0,E=0,F=0,G=0.0,H=0.0,I=0,J=0,K=0,L=0,M=0,N=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,Y=0,Z=0,$=0,ba=0,ca=0,da=0,ea=0,fa=0,ga=0,ha=0,ia=0,ja=0,ka=0,la=0,ma=0,na=0,oa=0,pa=0,qa=0,ra=0,sa=0,ta=0,ua=0,va=0,wa=0,xa=0,ya=0,za=0,Aa=0,Ba=0,Ca=0,Da=0,Ea=0,Ga=0,Ha=0;Ha=i;i=i+96|0;J=Ha;B=Ha+40|0;ba=Ha+32|0;Ga=Ha+24|0;ea=Ha+16|0;da=Ha+12|0;ca=Ha+8|0;za=c[e+8>>2]|0;c[ea>>2]=0;c[da>>2]=0;ma=c[e+12>>2]|0;Da=c[e>>2]|0;ka=Da+8|0;Ea=c[ka>>2]|0;qa=c[Da+4>>2]|0;la=Da+32|0;R=c[la>>2]|0;Aa=c[e+20>>2]|0;Ba=c[e+24>>2]|0;Ca=e+16|0;va=_(c[Ca>>2]|0,k)|0;o=qa+2048|0;wa=e+88+((_(o,za)|0)<<2)+(za*24<<2)|0;sa=Ea<<1;xa=wa+(sa<<2)|0;ya=xa+(sa<<2)|0;ra=ya+(sa<<2)|0;pa=Da+44|0;k=c[Da+36>>2]|0;na=0;while(1){if((na|0)>(k|0)){k=-1;K=268;break}if((c[pa>>2]<>>0>1275|(j|0)==0){e=-1;i=Ha;return e|0}ua=c[pa>>2]<>2]=ta;c[Ga+(n<<2)>>2]=ta+8192+(k<<2);n=n+1|0}while((n|0)<(za|0));ja=c[Da+12>>2]|0;ja=(Ba|0)>(ja|0)?ja:Ba;if((f|0)==0|(h|0)<2){Zc(e,ua,na);$c(Ga,j,ua,za,c[Ca>>2]|0,Da+16|0,e+80|0,m);e=(va|0)/(c[Ca>>2]|0)|0;i=Ha;return e|0}ta=e+48|0;c[e+52>>2]=(c[ta>>2]|0)!=0&1;a:do if(!l){c[B>>2]=f;c[B+4>>2]=h;c[B+8>>2]=0;c[B+12>>2]=0;c[B+16>>2]=0;t=B+20|0;c[t>>2]=9;u=B+24|0;c[u>>2]=0;v=B+28|0;c[v>>2]=128;if(!h){k=0;n=0}else{c[u>>2]=1;k=1;n=d[f>>0]|0}w=B+40|0;c[w>>2]=n;s=n>>>1^127;x=B+32|0;c[x>>2]=s;c[B+44>>2]=0;o=128;l=9;while(1){if(o>>>0>=8388609){l=B;break a}l=l+8|0;c[t>>2]=l;o=o<<8;c[v>>2]=o;if(k>>>0>>0){q=k+1|0;c[u>>2]=q;r=d[f+k>>0]|0}else{q=k;r=0}c[w>>2]=r;ia=((n<<8|r)>>>1&255|s<<8&2147483392)^255;c[x>>2]=ia;k=q;n=r;s=ia}}while(0);fa=(ma|0)==1;b:do if(fa){k=0;while(1){if((k|0)>=(Ea|0))break b;ia=wa+(k<<2)|0;G=+g[ia>>2];H=+g[wa+(Ea+k<<2)>>2];g[ia>>2]=G>H?G:H;k=k+1|0}}while(0);ga=h<<3;ha=l+20|0;k=c[ha>>2]|0;ia=l+28|0;r=c[ia>>2]|0;o=k+((aa(r|0)|0)+-32)|0;if((o|0)<(ga|0))if((o|0)==1){w=l+32|0;o=c[w>>2]|0;q=r>>>15;x=o>>>0>>0;n=x&1;if(!x){o=o-q|0;c[w>>2]=o;q=r-q|0}c[ia>>2]=q;t=l+40|0;u=l+24|0;v=l+4|0;while(1){if(q>>>0>=8388609)break;k=k+8|0;c[ha>>2]=k;q=q<<8;c[ia>>2]=q;s=c[t>>2]|0;r=c[u>>2]|0;if(r>>>0<(c[v>>2]|0)>>>0){c[u>>2]=r+1;r=d[(c[l>>2]|0)+r>>0]|0}else r=0;c[t>>2]=r;$=((s<<8|r)>>>1&255|o<<8&2147483392)^255;c[w>>2]=$;o=$}if(x){o=q;K=31}else{n=0;o=1}}else{q=r;n=0}else{o=r;n=1;K=31}if((K|0)==31){k=k+(ga-(k+((aa(o|0)|0)+-32)))|0;c[ha>>2]=k;q=o;o=ga}if((Aa|0)!=0|(o+16|0)>(ga|0)){$=0;Z=0;p=0.0}else{I=l+32|0;o=c[I>>2]|0;r=q>>>1;t=o>>>0>>0;if(!t){o=o-r|0;c[I>>2]=o;r=q-r|0}c[ia>>2]=r;D=l+40|0;E=l+24|0;F=l+4|0;while(1){if(r>>>0>=8388609)break;k=k+8|0;c[ha>>2]=k;r=r<<8;c[ia>>2]=r;s=c[D>>2]|0;q=c[E>>2]|0;if(q>>>0<(c[F>>2]|0)>>>0){c[E>>2]=q+1;q=d[(c[l>>2]|0)+q>>0]|0}else q=0;c[D>>2]=q;$=((s<<8|q)>>>1&255|o<<8&2147483392)^255;c[I>>2]=$;o=$}if(t){B=bd(l,6)|0;v=16<>2]|0;C=l+16|0;o=c[C>>2]|0;if(o>>>0>>0){t=l+8|0;s=c[F>>2]|0;u=o+8|0;u=o+(((u|0)>25?u:25)+-1-o&-8)|0;q=c[t>>2]|0;do{if(q>>>0>>0){r=q+1|0;c[t>>2]=r;q=r;r=d[(c[l>>2]|0)+(s-r)>>0]|0}else r=0;k=k|r<>>w;q=r-w|0;c[f>>2]=o;c[C>>2]=q;x=(c[ha>>2]|0)+w|0;c[ha>>2]=x;k=v+(k&(1<>>0<3){v=l+8|0;u=c[F>>2]|0;t=r+4-B|0;t=r+(B+((t|0)>25?t:25)+3-r&-8)+4|0;r=c[v>>2]|0;do{if(r>>>0>>0){s=r+1|0;c[v>>2]=s;r=s;s=d[(c[l>>2]|0)+(u-s)>>0]|0}else s=0;o=o|s<>2]=o>>>3;c[C>>2]=q+-3;q=x+3|0;c[ha>>2]=q;r=c[ia>>2]|0;c:do if((q+((aa(r|0)|0)+-32)+2|0)>(ga|0))o=0;else{t=c[I>>2]|0;u=r>>>2;o=-1;while(1){o=o+1|0;s=_(u,d[29345+o>>0]|0)|0;if(t>>>0>=s>>>0)break;else r=s}u=t-s|0;c[I>>2]=u;r=r-s|0;c[ia>>2]=r;while(1){if(r>>>0>=8388609)break c;q=q+8|0;c[ha>>2]=q;r=r<<8;c[ia>>2]=r;t=c[D>>2]|0;s=c[E>>2]|0;if(s>>>0<(c[F>>2]|0)>>>0){c[E>>2]=s+1;s=d[(c[l>>2]|0)+s>>0]|0}else s=0;c[D>>2]=s;$=((t<<8|s)>>>1&255|u<<8&2147483392)^255;c[I>>2]=$;u=$}}while(0);s=q;p=+(v+1|0)*.09375}else{s=k;p=0.0;k=0;o=0}$=k;Z=o;k=s;q=r;o=s+((aa(r|0)|0)+-32)|0}Q=(na|0)>0;if(!((o+3|0)>(ga|0)|Q^1)){w=l+32|0;o=c[w>>2]|0;r=q>>>3;x=o>>>0>>0;B=x&1;if(x)q=r;else{o=o-r|0;c[w>>2]=o;q=q-r|0}c[ia>>2]=q;t=l+40|0;u=l+24|0;v=l+4|0;while(1){if(q>>>0>=8388609)break;k=k+8|0;c[ha>>2]=k;q=q<<8;c[ia>>2]=q;s=c[t>>2]|0;r=c[u>>2]|0;if(r>>>0<(c[v>>2]|0)>>>0){c[u>>2]=r+1;r=d[(c[l>>2]|0)+r>>0]|0}else r=0;c[t>>2]=r;Y=((s<<8|r)>>>1&255|o<<8&2147483392)^255;c[w>>2]=Y;o=Y}o=k+((aa(q|0)|0)+-32)|0;if(x)W=oa;else K=72}else K=72;if((K|0)==72){B=0;W=0}if((o+3|0)<=(ga|0)){w=l+32|0;o=c[w>>2]|0;r=q>>>3;u=o>>>0>>0;f=u&1;if(!u){o=o-r|0;c[w>>2]=o;r=q-r|0}c[ia>>2]=r;v=l+40|0;q=l+24|0;x=l+4|0;while(1){if(r>>>0>=8388609)break;k=k+8|0;c[ha>>2]=k;r=r<<8;c[ia>>2]=r;t=c[v>>2]|0;s=c[q>>2]|0;if(s>>>0<(c[x>>2]|0)>>>0){c[q>>2]=s+1;s=d[(c[l>>2]|0)+s>>0]|0}else s=0;c[v>>2]=s;Y=((t<<8|s)>>>1&255|o<<8&2147483392)^255;c[w>>2]=Y;o=Y}Y=J;c[Y>>2]=0;c[Y+4>>2]=0;if(u){k=w;o=v;r=l;Y=x;P=f;y=.149993896484375;z=0.0;t=J}else{s=x;k=w;o=v;r=l;t=J;K=83}}else{s=J;c[s>>2]=0;c[s+4>>2]=0;s=l+4|0;k=l+32|0;o=l+40|0;q=l+24|0;r=l;t=J;K=83}if((K|0)==83){Y=s;P=0;y=+g[17320+(na<<2)>>2];z=+g[17336+(na<<2)>>2]}J=c[Y>>2]<<3;K=l+36|0;N=Aa;while(1){if((N|0)>=(Ba|0))break;L=(N|0)<20;M=0;do{v=c[ha>>2]|0;I=c[ia>>2]|0;s=v+((aa(I|0)|0)+-32)|0;u=J-s|0;d:do if((u|0)<=14){if((u|0)>1){w=c[k>>2]|0;x=I>>>2;f=-1;u=I;while(1){f=f+1|0;s=_(x,d[29345+f>>0]|0)|0;if(w>>>0>=s>>>0)break;else u=s}x=w-s|0;c[k>>2]=x;u=u-s|0;c[ia>>2]=u;s=v;while(1){if(u>>>0>=8388609)break;s=s+8|0;c[ha>>2]=s;u=u<<8;c[ia>>2]=u;w=c[o>>2]|0;v=c[q>>2]|0;if(v>>>0<(c[Y>>2]|0)>>>0){c[q>>2]=v+1;v=d[(c[r>>2]|0)+v>>0]|0}else v=0;c[o>>2]=v;V=((w<<8|v)>>>1&255|x<<8&2147483392)^255;c[k>>2]=V;x=V}s=f>>1^0-(f&1);break}if((J|0)>(s|0)){u=c[k>>2]|0;s=I>>>1;f=u>>>0>>0;if(!f){u=u-s|0;c[k>>2]=u;s=I-s|0}c[ia>>2]=s;while(1){if(s>>>0>=8388609)break;v=v+8|0;c[ha>>2]=v;s=s<<8;c[ia>>2]=s;x=c[o>>2]|0;w=c[q>>2]|0;if(w>>>0<(c[Y>>2]|0)>>>0){c[q>>2]=w+1;w=d[(c[r>>2]|0)+w>>0]|0}else w=0;c[o>>2]=w;V=((x<<8|w)>>>1&255|u<<8&2147483392)^255;c[k>>2]=V;u=V}s=f<<31>>31}else s=-1}else{C=(L?N:20)<<1;s=d[29009+(na*84|0)+(P*42|0)+C>>0]<<7;C=d[(C|1)+(29009+(na*84|0)+(P*42|0))>>0]<<6;E=I>>>15;c[K>>2]=E;F=c[k>>2]|0;D=(F>>>0)/(E>>>0)|0;V=D+1|0;D=32768-(V+(V>>>0>32768?32767-D|0:0))|0;if(D>>>0>>0){w=s;u=0;s=0}else{u=_(32736-s|0,16384-C|0)|0;x=1;while(1){V=u>>>15;w=V+1|0;if(!V)break;u=w<<1;f=s+u|0;if(D>>>0>>0)break;u=_(u+-2|0,C)|0;s=f;x=x+1|0}if(w>>>0<2){V=(D-s|0)>>>1;s=s+(V<<1)|0;x=x+V|0}u=s+w|0;V=D>>>0>>0;u=V?s:u;s=V?0-x|0:x}w=u+w|0;w=w>>>0<32768?w:32768;V=_(E,32768-w|0)|0;f=F-V|0;c[k>>2]=f;w=_(E,w-u|0)|0;w=(u|0)==0?I-V|0:w;c[ia>>2]=w;u=v;while(1){if(w>>>0>=8388609)break d;u=u+8|0;c[ha>>2]=u;w=w<<8;c[ia>>2]=w;x=c[o>>2]|0;v=c[q>>2]|0;if(v>>>0<(c[Y>>2]|0)>>>0){c[q>>2]=v+1;v=d[(c[r>>2]|0)+v>>0]|0}else v=0;c[o>>2]=v;V=((x<<8|v)>>>1&255|f<<8&2147483392)^255;c[k>>2]=V;f=V}}while(0);H=+(s|0);U=wa+(N+(_(M,c[ka>>2]|0)|0)<<2)|0;G=+g[U>>2];g[U>>2]=G<-9.0?-9.0:G;U=wa+(N+(_(M,c[ka>>2]|0)|0)<<2)|0;V=t+(M<<2)|0;g[U>>2]=z*+g[U>>2]+ +g[V>>2]+H;g[V>>2]=+g[V>>2]+H-y*H;M=M+1|0}while((M|0)<(ma|0));N=N+1|0}V=Fa()|0;U=i;i=i+((1*(Ea<<2)|0)+15&-16)|0;N=c[Y>>2]|0;s=N<<3;u=c[ha>>2]|0;v=c[ia>>2]|0;x=u+((aa(v|0)|0)+-32)|0;t=(B|0)!=0;w=t?2:4;if(Q)I=(x+w+1|0)>>>0<=s>>>0;else I=0;F=s-(I&1)|0;E=t?4:5;C=0;D=Aa;s=x;f=0;while(1){if((D|0)>=(Ba|0))break;if((s+w|0)>>>0>F>>>0){x=C;t=f}else{t=c[k>>2]|0;s=v>>>w;T=t>>>0>>0;x=T&1;if(!T){t=t-s|0;c[k>>2]=t;s=v-s|0}c[ia>>2]=s;w=u;while(1){if(s>>>0>=8388609)break;w=w+8|0;c[ha>>2]=w;s=s<<8;c[ia>>2]=s;v=c[o>>2]|0;u=c[q>>2]|0;if(u>>>0>>0){c[q>>2]=u+1;u=d[(c[r>>2]|0)+u>>0]|0}else u=0;c[o>>2]=u;T=((v<<8|u)>>>1&255|t<<8&2147483392)^255;c[k>>2]=T;t=T}t=C^x;u=w;v=s;x=t;s=w+((aa(s|0)|0)+-32)|0;t=f|t}c[U+(D<<2)>>2]=x;C=x;D=D+1|0;w=E;f=t}C=B<<2;if(I?(a[C+f+(27892+(na<<3))>>0]|0)!=(a[(C|2)+f+(27892+(na<<3))>>0]|0):0){t=c[k>>2]|0;s=v>>>1;T=t>>>0>>0;f=T&1;if(!T){t=t-s|0;c[k>>2]=t;s=v-s|0}c[ia>>2]=s;while(1){if(s>>>0>=8388609)break;u=u+8|0;c[ha>>2]=u;s=s<<8;c[ia>>2]=s;w=c[o>>2]|0;v=c[q>>2]|0;if(v>>>0>>0){c[q>>2]=v+1;v=d[(c[r>>2]|0)+v>>0]|0}else v=0;c[o>>2]=v;T=((w<<8|v)>>>1&255|t<<8&2147483392)^255;c[k>>2]=T;t=T}x=s;s=f<<1}else{x=v;s=0}s=C+s|0;t=Aa;while(1){if((t|0)>=(Ba|0))break;T=U+(t<<2)|0;c[T>>2]=a[s+(c[T>>2]|0)+(27892+(na<<3))>>0];t=t+1|0}e:do if((u+((aa(x|0)|0)+-32)+4|0)>(ga|0)){s=u;t=x;f=2}else{v=c[k>>2]|0;w=x>>>5;f=-1;t=x;while(1){f=f+1|0;s=_(w,d[28203+f>>0]|0)|0;if(v>>>0>=s>>>0)break;else t=s}w=v-s|0;c[k>>2]=w;t=t-s|0;c[ia>>2]=t;s=u;while(1){if(t>>>0>=8388609)break e;s=s+8|0;c[ha>>2]=s;u=t<<8;c[ia>>2]=u;v=c[o>>2]|0;t=c[q>>2]|0;if(t>>>0>>0){c[q>>2]=t+1;t=d[(c[r>>2]|0)+t>>0]|0}else t=0;c[o>>2]=t;T=((v<<8|t)>>>1&255|w<<8&2147483392)^255;c[k>>2]=T;t=u;w=T}}while(0);M=i;i=i+((1*(Ea<<2)|0)+15&-16)|0;u=c[ka>>2]|0;v=(na<<1)+ma+-1|0;w=Da+104|0;x=0;while(1){if((x|0)>=(u|0))break;T=x+1|0;S=c[la>>2]|0;Q=(_(u,v)|0)+x|0;c[M+(x<<2)>>2]=(_(_((d[(c[w>>2]|0)+Q>>0]|0)+64|0,ma)|0,(b[S+(T<<1)>>1]|0)-(b[S+(x<<1)>>1]|0)<>2;x=T}L=i;i=i+((1*(Ea<<2)|0)+15&-16)|0;Q=h<<6;S=32-(aa(t|0)|0)|0;T=t>>>(S+-16|0);w=(T>>>12)+-8|0;C=s;J=6;K=Aa;s=(s<<3)-((S<<3)+(w+(T>>>0>(c[5272+(w<<2)>>2]|0)>>>0&1)))|0;w=Q;while(1){if((K|0)>=(Ba|0))break;I=K+1|0;D=(_(ma,(b[R+(I<<1)>>1]|0)-(b[R+(K<<1)>>1]|0)|0)|0)<=(F|0))break;if((C|0)>=(c[E>>2]|0))break;s=c[k>>2]|0;v=t>>>v;x=s>>>0>>0;if(x)t=v;else{s=s-v|0;c[k>>2]=s;t=t-v|0}c[ia>>2]=t;while(1){if(t>>>0>=8388609)break;u=u+8|0;c[ha>>2]=u;t=t<<8;c[ia>>2]=t;w=c[o>>2]|0;v=c[q>>2]|0;if(v>>>0>>0){c[q>>2]=v+1;v=d[(c[r>>2]|0)+v>>0]|0}else v=0;c[o>>2]=v;T=((w<<8|v)>>>1&255|s<<8&2147483392)^255;c[k>>2]=T;s=T}S=32-(aa(t|0)|0)|0;T=t>>>(S+-16|0);s=(T>>>12)+-8|0;s=(u<<3)-((S<<3)+(s+(T>>>0>(c[5272+(s<<2)>>2]|0)>>>0&1)))|0;if(!x)break;C=C+D|0;v=1;F=F-D|0}c[L+(K<<2)>>2]=C;if((C|0)<=0){C=u;K=I;w=F;continue}C=u;J=(J|0)<3?2:J+-1|0;K=I;w=F}h=i;i=i+((1*(Ea<<2)|0)+15&-16)|0;f:do if((s+48|0)>(w|0)){o=C;k=t;q=5}else{u=c[k>>2]|0;v=t>>>7;x=-1;while(1){x=x+1|0;s=_(v,d[28207+x>>0]|0)|0;if(u>>>0>=s>>>0)break;else t=s}w=u-s|0;c[k>>2]=w;t=t-s|0;c[ia>>2]=t;s=C;while(1){if(t>>>0>=8388609){o=s;k=t;q=x;break f}s=s+8|0;c[ha>>2]=s;u=t<<8;c[ia>>2]=u;v=c[o>>2]|0;t=c[q>>2]|0;if(t>>>0>>0){c[q>>2]=t+1;t=d[(c[r>>2]|0)+t>>0]|0}else t=0;c[o>>2]=t;T=((v<<8|t)>>>1&255|w<<8&2147483392)^255;c[k>>2]=T;t=u;w=T}}while(0);S=32-(aa(k|0)|0)|0;T=k>>>(S+-16|0);k=(T>>>12)+-8|0;k=Q+((S<<3)+(k+(T>>>0>(c[5272+(k<<2)>>2]|0)>>>0&1))-(o<<3))+-1|0;T=(B|0)==0;if((na|0)>1&(T^1))E=(k|0)>=((na<<3)+16|0);else E=0;F=E?8:0;S=i;i=i+((1*(Ea<<2)|0)+15&-16)|0;N=i;i=i+((1*(Ea<<2)|0)+15&-16)|0;D=sd(Da,Aa,Ba,L,M,q,ea,da,k-F|0,ca,S,h,N,ma,na,l,0,0,0)|0;I=l+12|0;J=l+16|0;K=l+8|0;C=Aa;while(1){if((C|0)>=(Ba|0))break;v=c[h+(C<<2)>>2]|0;if((v|0)>=1){w=(1<>2]|0;k=c[J>>2]|0;x=0;do{if(k>>>0>>0){t=k+8|0;u=((t|0)>25?t:25)+-1-k&-8;o=q;do{q=c[K>>2]|0;s=c[Y>>2]|0;if(q>>>0>>0){q=q+1|0;c[K>>2]=q;q=d[(c[r>>2]|0)+(s-q)>>0]|0}else q=0;o=o|q<>>v;k=k-v|0;c[I>>2]=q;c[J>>2]=k;c[ha>>2]=(c[ha>>2]|0)+v;R=wa+(C+(_(x,c[ka>>2]|0)|0)<<2)|0;g[R>>2]=+g[R>>2]+((+(o&w|0)+.5)*y*.00006103515625+-.5);x=x+1|0}while((x|0)<(ma|0))}C=C+1|0}k=2048-ua+((qa|0)/2|0)<<2;o=0;do{R=c[ba+(o<<2)>>2]|0;sf(R|0,R+(ua<<2)|0,k|0)|0;o=o+1|0}while((o|0)<(za|0));M=_(ma,Ea)|0;L=i;i=i+((1*M|0)+15&-16)|0;R=(_(ma,ua)|0)<<2;P=i;i=i+((1*R|0)+15&-16)|0;R=e+36|0;Yd(0,Da,Aa,Ba,P,(ma|0)==2?P+(ua<<2)|0:0,L,0,S,W,f,c[da>>2]|0,c[ea>>2]|0,U,Q-F|0,c[ca>>2]|0,l,na,D,R,0,c[e+32>>2]|0);if(E){o=c[I>>2]|0;k=c[J>>2]|0;if(!k){s=c[Y>>2]|0;q=c[K>>2]|0;t=0;do{if(q>>>0>>0){k=q+1|0;c[K>>2]=k;q=k;k=d[(c[r>>2]|0)+(s-k)>>0]|0}else k=0;o=o|k<>2]=o>>>1;c[J>>2]=k+-1;k=(c[ha>>2]|0)+1|0;c[ha>>2]=k;f=o&1}else{k=c[ha>>2]|0;f=0}o=ga-(k+((aa(c[ia>>2]|0)|0)+-32))|0;x=0;while(1){if((x|0)==2)break;else w=Aa;while(1){if(!((w|0)<(Ba|0)&(o|0)>=(ma|0)))break;q=c[h+(w<<2)>>2]|0;do if((q|0)<=7){if((c[N+(w<<2)>>2]|0)!=(x|0))break;y=+(1<<14-q+-1|0);s=c[J>>2]|0;t=c[I>>2]|0;v=0;do{if(!s){u=0;while(1){q=c[K>>2]|0;s=c[Y>>2]|0;if(q>>>0>>0){q=q+1|0;c[K>>2]=q;q=d[(c[r>>2]|0)+(s-q)>>0]|0}else q=0;q=t|q<=25){s=32;break}else t=q}}else q=t;t=q>>>1;s=s+-1|0;c[I>>2]=t;c[J>>2]=s;k=k+1|0;c[ha>>2]=k;ea=wa+(w+(_(v,c[ka>>2]|0)|0)<<2)|0;g[ea>>2]=+g[ea>>2]+(+(q&1|0)+-.5)*y*.00006103515625;o=o+-1|0;v=v+1|0}while((v|0)<(ma|0))}while(0);w=w+1|0}x=x+1|0}g:do if(f|0){u=(na|0)==3;k=c[R>>2]|0;C=Aa;h:while(1){if((C|0)>=(Ba|0))break g;v=C+1|0;w=c[la>>2]|0;w=(b[w+(v<<1)>>1]|0)-(b[w+(C<<1)>>1]|0)|0;G=+X(+(+(((((c[S+(C<<2)>>2]|0)+1|0)>>>0)/(w>>>0)|0)>>>na|0)*-.125*.6931471805599453))*.5;x=w<>2]|0;r=(_(o,q)|0)+C|0;z=+g[xa+(r<<2)>>2];y=+g[ya+(r<<2)>>2];do if(fa){ea=q+C|0;A=+g[xa+(ea<<2)>>2];z=z>A?z:A;A=+g[ya+(ea<<2)>>2];if(y>A)break;y=A}while(0);y=+g[wa+(r<<2)>>2]-(z>2]|0)+(C<<1)>>1]<=(oa|0))break;i:do if(!(d[s>>0]&1<=(w|0)){q=1;break i}ea=(_(k,1664525)|0)+1013904223|0;g[t+((q<>2]=(ea&32768|0)==0?z:y;k=ea;q=q+1|0}}while(0);r=r+1|0}j:do if(q|0){q=0;y=0.0;while(1){if((q|0)>=(x|0))break;A=+g[t+(q<<2)>>2];q=q+1|0;y=y+A*A}y=1.0/+O(+(y+1.0000000036274937e-15));r=0;q=t;while(1){if((r|0)>=(x|0))break j;g[q>>2]=y*+g[q>>2];r=r+1|0;q=q+4|0}}while(0);o=o+1|0;if((o|0)>=(ma|0)){C=v;continue h}}}}while(0);k:do if(n|0){k=0;while(1){if((k|0)>=(M|0))break k;g[wa+(k<<2)>>2]=-28.0;k=k+1|0}}while(0);_c(Da,P,Ga,wa,Aa,ja,ma,za,B,na,c[Ca>>2]|0,n);q=e+56|0;r=e+60|0;s=e+68|0;t=e+64|0;u=e+76|0;v=e+72|0;w=Da+60|0;k=(na|0)==0;o=0;do{na=c[q>>2]|0;na=(na|0)>15?na:15;c[q>>2]=na;ma=c[r>>2]|0;ma=(ma|0)>15?ma:15;c[r>>2]=ma;n=c[Ga+(o<<2)>>2]|0;yc(n,n,ma,na,c[pa>>2]|0,+g[s>>2],+g[t>>2],c[u>>2]|0,c[v>>2]|0,c[w>>2]|0,qa);if(!k){na=c[pa>>2]|0;ma=n+(na<<2)|0;yc(ma,ma,c[q>>2]|0,$,ua-na|0,+g[t>>2],p,c[v>>2]|0,Z,c[w>>2]|0,qa)}o=o+1|0}while((o|0)<(za|0));c[r>>2]=c[q>>2];c[s>>2]=c[t>>2];c[u>>2]=c[v>>2];c[q>>2]=$;g[t>>2]=p;c[v>>2]=Z;if(!k){c[r>>2]=$;g[s>>2]=p;c[u>>2]=Z}if(fa)rf(wa+(Ea<<2)|0,wa|0,Ea<<2|0)|0;l:do if(T){k=Ea<<3;rf(ya|0,xa|0,k|0)|0;rf(xa|0,wa|0,k|0)|0;p=(c[ta>>2]|0)<10?+(oa|0)*1.0000000474974513e-03:1.0;k=0;while(1){if((k|0)>=(sa|0)){o=0;break l}qa=ra+(k<<2)|0;G=+g[qa>>2]+p;H=+g[wa+(k<<2)>>2];g[qa>>2]=G=(sa|0)){o=0;break l}ra=xa+(k<<2)|0;G=+g[ra>>2];H=+g[wa+(k<<2)>>2];g[ra>>2]=G=(Aa|0)){k=Ba;break}sa=n+k|0;g[wa+(sa<<2)>>2]=0.0;g[ya+(sa<<2)>>2]=-28.0;g[xa+(sa<<2)>>2]=-28.0;k=k+1|0}while(1){if((k|0)>=(Ea|0))break;sa=n+k|0;g[wa+(sa<<2)>>2]=0.0;g[ya+(sa<<2)>>2]=-28.0;g[xa+(sa<<2)>>2]=-28.0;k=k+1|0}o=o+1|0}while((o|0)!=2);c[R>>2]=c[ia>>2];$c(Ga,j,ua,za,c[Ca>>2]|0,Da+16|0,e+80|0,m);c[ta>>2]=0;if(((c[ha>>2]|0)+((aa(c[ia>>2]|0)|0)+-32)|0)>(ga|0))k=-3;else{if(c[l+44>>2]|0)c[e+40>>2]=1;k=(va|0)/(c[Ca>>2]|0)|0}Na(V|0);e=k;i=Ha;return e|0}function Zc(a,d,e){a=a|0;d=d|0;e=e|0;var f=0,h=0,j=0.0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0.0,s=0,t=0,u=0,v=0.0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0.0,J=0,K=0,L=0,M=0,N=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0.0,Z=0.0;X=i;i=i+8512|0;l=X+8504|0;k=X+4408|0;W=X+4400|0;z=X+4392|0;P=X+296|0;N=X+192|0;Q=X+96|0;R=X;V=c[a+8>>2]|0;A=c[a>>2]|0;n=c[A+8>>2]|0;U=c[A+4>>2]|0;y=c[A+32>>2]|0;f=U+2048|0;M=0-d|0;h=0;do{T=a+88+((_(h,f)|0)<<2)|0;c[W+(h<<2)>>2]=T;c[z+(h<<2)>>2]=T+8192+(M<<2);h=h+1|0}while((h|0)<(V|0));L=a+88+((_(f,V)|0)<<2)|0;w=L+(V*24<<2)|0;m=n<<1;m=w+(m<<2)+(m<<2)+(m<<2)|0;S=a+48|0;T=c[S>>2]|0;x=c[a+20>>2]|0;if((T|0)<5&(x|0)==0?(c[a+52>>2]|0)==0:0){K=(T|0)==0;if(K){gd(W,k,2048,V);id(k+1440|0,k,1328,620,l);J=720-(c[l>>2]|0)|0;c[a+44>>2]=J;I=1.0}else{I=.800000011920929;J=c[a+44>>2]|0}G=Fa()|0;H=i;i=i+((1*(U<<2)|0)+15&-16)|0;u=c[A+60>>2]|0;w=J<<1;x=(w|0)<1024;y=P+4096|0;e=2048-d|0;z=e<<2;A=1024-J|0;B=U+d|0;C=1024-d+A|0;D=e+-1|0;E=a+56|0;F=a+64|0;o=a+72|0;p=(U|0)/2|0;q=U+-1|0;t=0;do{s=c[W+(t<<2)>>2]|0;f=0;while(1){if((f|0)==1024)break;c[P+(f<<2)>>2]=c[s+(f+1024<<2)>>2];f=f+1|0}if(K){pd(P,N,u,U,24,1024);g[N>>2]=+g[N>>2]*1.000100016593933;f=1;while(1){if((f|0)==25)break;a=N+(f<<2)|0;r=+g[a>>2];v=+(f|0);g[a>>2]=r-r*6.400000711437315e-05*v*v;f=f+1|0}ld(L+(t*24<<2)|0,N,24)}k=x?w:1024;f=2048-k+-1|0;h=0;while(1){if((h|0)==24)break;c[Q+(h<<2)>>2]=c[s+(f-h<<2)>>2];h=h+1|0}l=y+(0-k<<2)|0;n=L+(t*24<<2)|0;md(l,n,l,k,Q);l=k>>1;m=1024-l|0;f=1024-k|0;j=1.0;r=1.0;h=0;while(1){if((h|0)>=(l|0))break;Y=+g[P+(m+h<<2)>>2];v=+g[P+(f+h<<2)>>2];j=j+Y*Y;r=r+v*v;h=h+1|0}r=+O(+((j=(B|0)){f=0;break}a=(h|0)<(J|0);Y=a?j:j*r;a=h-(a?0:J)|0;g[s+(e+f<<2)>>2]=Y*+g[P+(A+a<<2)>>2];Z=+g[s+(C+a<<2)>>2];v=v+Z*Z;j=Y;f=f+1|0;h=a+1|0}while(1){if((f|0)==24)break;c[R+(f<<2)>>2]=c[s+(D-f<<2)>>2];f=f+1|0}h=s+8192|0;f=h+(M<<2)|0;od(f,n,f,B,R);j=0.0;f=0;while(1){if((f|0)>=(B|0))break;Z=+g[s+(e+f<<2)>>2];j=j+Z*Z;f=f+1|0}a:do if(v>j*.20000000298023224){if(v=(U|0)){f=U;break}a=s+(e+f<<2)|0;g[a>>2]=(1.0-+g[u+(f<<2)>>2]*j)*+g[a>>2];f=f+1|0}while(1){if((f|0)>=(B|0))break a;a=s+(e+f<<2)|0;g[a>>2]=r*+g[a>>2];f=f+1|0}}}else{f=0;while(1){if((f|0)>=(B|0))break a;g[s+(e+f<<2)>>2]=0.0;f=f+1|0}}while(0);a=c[E>>2]|0;Z=-+g[F>>2];f=c[o>>2]|0;yc(H,h,a,a,U,Z,Z,f,f,0,0);f=0;while(1){if((f|0)>=(p|0))break;g[s+(f+2048<<2)>>2]=+g[u+(f<<2)>>2]*+g[H+(q-f<<2)>>2]+ +g[u+(U-f+-1<<2)>>2]*+g[H+(f<<2)>>2];f=f+1|0}t=t+1|0}while((t|0)<(V|0));Na(G|0);W=T+1|0;c[S>>2]=W;i=X;return}f=c[a+24>>2]|0;s=c[A+12>>2]|0;k=(f|0)<(s|0);s=(x|0)>((k?f:s)|0)?x:k?f:s;k=_(V,d)|0;t=Fa()|0;u=i;i=i+((1*(k<<2)|0)+15&-16)|0;j=(T|0)==0?1.5:.5;k=0;do{h=_(k,n)|0;l=x;while(1){if((l|0)>=(f|0))break;R=h+l|0;Y=+g[m+(R<<2)>>2];R=w+(R<<2)|0;Z=+g[R>>2]-j;g[R>>2]=Y>Z?Y:Z;l=l+1|0}k=k+1|0}while((k|0)<(V|0));o=a+36|0;q=0;f=c[o>>2]|0;while(1){if((q|0)>=(V|0))break;p=_(q,d)|0;h=x;b:while(1){if((h|0)>=(s|0))break;n=b[y+(h<<1)>>1]|0;l=p+(n<>1]|0)-n<=(n|0))break;R=(_(f,1664525)|0)+1013904223|0;g[u+(l+k<<2)>>2]=+(R>>20|0);k=k+1|0;f=R}m=u+(l<<2)|0;k=0;j=0.0;while(1){if((k|0)>=(n|0))break;Z=+g[m+(k<<2)>>2];k=k+1|0;j=j+Z*Z}j=1.0/+O(+(j+1.0000000036274937e-15));l=0;k=m;while(1){if((l|0)>=(n|0))continue b;g[k>>2]=j*+g[k>>2];l=l+1|0;k=k+4|0}}q=q+1|0}c[o>>2]=f;f=2048-d+(U>>>1)<<2;h=0;do{U=c[W+(h<<2)>>2]|0;sf(U|0,U+(d<<2)|0,f|0)|0;h=h+1|0}while((h|0)<(V|0));_c(A,u,z,w,x,s,V,V,0,e,c[a+16>>2]|0,0);Na(t|0);W=T+1|0;c[S>>2]=W;i=X;return}function _c(a,b,d,e,f,h,j,k,l,m,n,o){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;h=h|0;j=j|0;k=k|0;l=l|0;m=m|0;n=n|0;o=o|0;var p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0;C=i;A=c[a+4>>2]|0;t=c[a+8>>2]|0;u=a+44|0;r=c[u>>2]|0;w=r<>2]|0)-(x?m:0)|0;switch(k|0){case 2:{if((j|0)==1){Xd(c[a+32>>2]|0,r,b,B,e,f,h,v,n,o);q=d+4|0;j=(c[q>>2]|0)+(((A|0)/2|0)<<2)|0;rf(j|0,B|0,w<<2|0)|0;p=a+64|0;m=a+60|0;l=0;while(1){if((l|0)>=(y|0)){l=0;break}w=(c[d>>2]|0)+((_(z,l)|0)<<2)|0;fd(p,j+(l<<2)|0,w,c[m>>2]|0,A,x,y);l=l+1|0}while(1){if((l|0)>=(y|0))break;d=(c[q>>2]|0)+((_(z,l)|0)<<2)|0;fd(p,B+(l<<2)|0,d,c[m>>2]|0,A,x,y);l=l+1|0}i=C;return}break}case 1:{if((j|0)==2){m=(c[d>>2]|0)+(((A|0)/2|0)<<2)|0;l=a+32|0;Xd(c[l>>2]|0,r,b,B,e,f,h,v,n,o);Xd(c[l>>2]|0,c[u>>2]|0,b+(w<<2)|0,m,e+(t<<2)|0,f,h,v,n,o);l=0;while(1){if((l|0)>=(w|0))break;f=B+(l<<2)|0;g[f>>2]=+g[f>>2]*.5+ +g[m+(l<<2)>>2]*.5;l=l+1|0}j=a+64|0;l=a+60|0;m=0;while(1){if((m|0)>=(y|0))break;w=(c[d>>2]|0)+((_(z,m)|0)<<2)|0;fd(j,B+(m<<2)|0,w,c[l>>2]|0,A,x,y);m=m+1|0}i=C;return}break}default:{}}s=a+32|0;q=a+64|0;p=a+60|0;l=0;m=r;while(1){a=b+((_(l,w)|0)<<2)|0;j=e+((_(l,t)|0)<<2)|0;Xd(c[s>>2]|0,m,a,B,j,f,h,v,n,o);m=d+(l<<2)|0;j=0;while(1){if((j|0)>=(y|0))break;a=(c[m>>2]|0)+((_(z,j)|0)<<2)|0;fd(q,B+(j<<2)|0,a,c[p>>2]|0,A,x,y);j=j+1|0}l=l+1|0;if((l|0)>=(k|0))break;m=c[u>>2]|0}i=C;return}function $c(a,b,d,e,f,h,j,k){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;h=h|0;j=j|0;k=k|0;var l=0,m=0.0,n=0.0,o=0.0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0.0,z=0.0;x=i;if((f|0)==1&(e|0)==2&(k|0)==0){o=+g[h>>2];p=c[a>>2]|0;k=c[a+4>>2]|0;h=j+4|0;l=0;m=+g[j>>2];n=+g[h>>2];while(1){if((l|0)>=(d|0))break;z=+g[p+(l<<2)>>2]+1.0000000031710769e-30+m;y=+g[k+(l<<2)>>2]+1.0000000031710769e-30+n;a=l<<1;g[b+(a<<2)>>2]=z*.000030517578125;g[b+((a|1)<<2)>>2]=y*.000030517578125;l=l+1|0;m=z*o;n=y*o}g[j>>2]=m;g[h>>2]=n;i=x;return}v=Fa()|0;w=i;i=i+((1*(d<<2)|0)+15&-16)|0;n=+g[h>>2];r=(d|0)/(f|0)|0;s=(f|0)>1;k=0;t=0;do{l=j+(t<<2)|0;m=+g[l>>2];p=c[a+(t<<2)>>2]|0;q=b+(t<<2)|0;if(!s){h=0;while(1){if((h|0)>=(d|0))break;z=+g[p+(h<<2)>>2]+1.0000000031710769e-30+m;g[q+((_(h,e)|0)<<2)>>2]=z*.000030517578125;h=h+1|0;m=n*z}g[l>>2]=m;if(!k)k=0;else u=14}else{k=0;while(1){if((k|0)>=(d|0))break;z=+g[p+(k<<2)>>2]+1.0000000031710769e-30+m;g[w+(k<<2)>>2]=z;k=k+1|0;m=n*z}g[l>>2]=m;k=1;u=14}a:do if((u|0)==14){u=0;h=0;while(1){if((h|0)>=(r|0))break a;g[q+((_(h,e)|0)<<2)>>2]=+g[w+((_(h,f)|0)<<2)>>2]*.000030517578125;h=h+1|0}}while(0);t=t+1|0}while((t|0)<(e|0));Na(v|0);i=x;return}function ad(a,b,e,f){a=a|0;b=b|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;g=c[a+36>>2]|0;f=_(g,f-e|0)|0;n=a+32|0;h=(c[n>>2]|0)-f|0;c[n>>2]=h;if(!b){l=a+28|0;m=l;f=(c[l>>2]|0)-f|0}else{m=a+28|0;f=_(g,e-b|0)|0}c[m>>2]=f;i=a+20|0;j=a+40|0;k=a+24|0;l=a+4|0;b=h;while(1){if(f>>>0>=8388609)break;c[i>>2]=(c[i>>2]|0)+8;f=f<<8;c[m>>2]=f;e=c[j>>2]|0;g=c[k>>2]|0;if(g>>>0<(c[l>>2]|0)>>>0){c[k>>2]=g+1;g=d[(c[a>>2]|0)+g>>0]|0}else g=0;c[j>>2]=g;h=((e<<8|g)>>>1&255|b<<8&2147483392)^255;c[n>>2]=h;b=h}return}function bd(a,b){a=a|0;b=b|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0;o=b+-1|0;e=32-(aa(o|0)|0)|0;if((e|0)<=8){m=a+28|0;j=c[m>>2]|0;h=(j>>>0)/(b>>>0)|0;c[a+36>>2]=h;n=a+32|0;l=c[n>>2]|0;k=((l>>>0)/(h>>>0)|0)+1|0;k=k>>>0>b>>>0?b:k;e=b-k|0;i=_(h,b-(e+1)|0)|0;l=l-i|0;c[n>>2]=l;b=(k|0)==(b|0)?j-i|0:h;c[m>>2]=b;h=a+20|0;i=a+40|0;j=a+24|0;k=a+4|0;while(1){if(b>>>0>=8388609)break;c[h>>2]=(c[h>>2]|0)+8;b=b<<8;c[m>>2]=b;g=c[i>>2]|0;f=c[j>>2]|0;if(f>>>0<(c[k>>2]|0)>>>0){c[j>>2]=f+1;f=d[(c[a>>2]|0)+f>>0]|0}else f=0;c[i>>2]=f;o=((g<<8|f)>>>1&255|l<<8&2147483392)^255;c[n>>2]=o;l=o}return e|0}n=e+-8|0;l=(o>>>n)+1|0;k=((c[a+28>>2]|0)>>>0)/(l>>>0)|0;c[a+36>>2]=k;k=(((c[a+32>>2]|0)>>>0)/(k>>>0)|0)+1|0;k=l-(l>>>0>>0?l:k)|0;ad(a,k,k+1|0,l);k=k<>2]|0;m=a+16|0;b=c[m>>2]|0;if(b>>>0>>0){i=a+8|0;h=c[a+4>>2]|0;j=b+8|0;j=b+(((j|0)>25?j:25)+-1-b&-8)|0;f=c[i>>2]|0;do{if(f>>>0>>0){g=f+1|0;c[i>>2]=g;f=g;g=d[(c[a>>2]|0)+(h-g)>>0]|0}else g=0;e=e|g<>2]=e>>>n;c[m>>2]=b-n;m=a+20|0;c[m>>2]=(c[m>>2]|0)+n;e=k|e&(1<>>0<=o>>>0){a=e;return a|0}c[a+44>>2]=1;a=o;return a|0}function cd(b){b=b|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0;s=c[b+28>>2]|0;h=aa(s|0)|0;e=2147483647>>>h;f=c[b+32>>2]|0;g=f+e&~e;if((g|e)>>>0>=(f+s|0)>>>0){g=e>>>1;g=f+g&~g;h=h+1|0}m=b+36|0;n=b+40|0;r=b+24|0;o=b+8|0;p=b+4|0;s=b+44|0;q=h+7&-8;k=h;while(1){if((k|0)<=0)break;j=g>>>23;if((j|0)==255)c[m>>2]=(c[m>>2]|0)+1;else{i=g>>>31;e=c[n>>2]|0;if((e|0)>-1){f=c[r>>2]|0;if((f+(c[o>>2]|0)|0)>>>0<(c[p>>2]|0)>>>0){c[r>>2]=f+1;a[(c[b>>2]|0)+f>>0]=e+i;e=0}else e=-1;c[s>>2]=c[s>>2]|e}e=c[m>>2]|0;if(e|0){i=i+255&255;do{f=c[r>>2]|0;if((f+(c[o>>2]|0)|0)>>>0<(c[p>>2]|0)>>>0){c[r>>2]=f+1;a[(c[b>>2]|0)+f>>0]=i;f=0;e=c[m>>2]|0}else f=-1;c[s>>2]=c[s>>2]|f;e=e+-1|0;c[m>>2]=e}while((e|0)!=0)}c[n>>2]=j&255}g=g<<8&2147483392;k=k+-8|0}f=c[n>>2]|0;if((f|0)>-1){e=c[r>>2]|0;if((e+(c[o>>2]|0)|0)>>>0<(c[p>>2]|0)>>>0){c[r>>2]=e+1;a[(c[b>>2]|0)+e>>0]=f;e=0}else e=-1;c[s>>2]=c[s>>2]|e;e=c[m>>2]|0;if(!e)l=26;else l=23}else{e=c[m>>2]|0;if(e|0)l=23}if((l|0)==23)while(1){f=c[r>>2]|0;if((f+(c[o>>2]|0)|0)>>>0<(c[p>>2]|0)>>>0){c[r>>2]=f+1;a[(c[b>>2]|0)+f>>0]=-1;f=0;e=c[m>>2]|0}else f=-1;c[s>>2]=c[s>>2]|f;e=e+-1|0;c[m>>2]=e;if(!e){l=26;break}else l=23}if((l|0)==26)c[n>>2]=0;j=c[b+16>>2]|0;i=j+~((j|0)<7?j:7)+8&-8;k=j;e=c[b+12>>2]|0;while(1){if((k|0)<=7)break;f=c[o>>2]|0;g=c[p>>2]|0;if(((c[r>>2]|0)+f|0)>>>0>>0){f=f+1|0;c[o>>2]=f;a[(c[b>>2]|0)+(g-f)>>0]=e;f=0}else f=-1;c[s>>2]=c[s>>2]|f;k=k+-8|0;e=e>>>8}i=j-i|0;if(c[s>>2]|0)return;n=c[r>>2]|0;nf((c[b>>2]|0)+n|0,0,(c[p>>2]|0)-n-(c[o>>2]|0)|0)|0;if((i|0)<=0)return;j=c[o>>2]|0;g=c[p>>2]|0;if(g>>>0<=j>>>0){c[s>>2]=-1;return}f=q-h|0;if((i|0)>(f|0)?((c[r>>2]|0)+j|0)>>>0>=g>>>0:0){c[s>>2]=-1;e=e&(1<>2]|0)+(g-j+-1)|0;a[b>>0]=d[b>>0]|0|e;return}function dd(a,d){a=a|0;d=d|0;var e=0,f=0,h=0,j=0,k=0,l=0.0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0.0,v=0.0,w=0.0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0.0,F=0.0,G=0.0,H=0.0,I=0.0,J=0.0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0.0,R=0.0,S=0.0,T=0.0,U=0.0,V=0.0,W=0.0,X=0.0;D=i;i=i+32|0;C=D;B=c[a+8>>2]|0;B=(B|0)>0?B:0;c[C>>2]=1;e=1;f=0;while(1){h=f<<1;A=b[a+12+((h|1)<<1)>>1]|0;e=_(e,b[a+12+(h<<1)>>1]|0)|0;h=f+1|0;c[C+(h<<2)>>2]=e;if(A<<16>>16==1)break;else f=h}A=a+48|0;y=b[a+12+((h<<1)+-1<<1)>>1]|0;while(1){if((f|0)<=-1)break;e=f<<1;if(!f)z=1;else z=b[a+12+(e+-1<<1)>>1]|0;a:do switch(b[a+12+(e<<1)>>1]|0){case 2:{h=c[C+(f<<2)>>2]|0;e=d;j=0;while(1){if((j|0)>=(h|0))break a;x=e+32|0;v=+g[x>>2];y=e+36|0;u=+g[y>>2];l=+g[e>>2];g[x>>2]=l-v;x=e+4|0;w=+g[x>>2];g[y>>2]=w-u;g[e>>2]=l+v;g[x>>2]=w+u;x=e+40|0;u=+g[x>>2];y=e+44|0;w=+g[y>>2];v=(u+w)*.7071067690849304;u=(w-u)*.7071067690849304;t=e+8|0;w=+g[t>>2];g[x>>2]=w-v;x=e+12|0;l=+g[x>>2];g[y>>2]=l-u;g[t>>2]=w+v;g[x>>2]=l+u;x=e+52|0;u=+g[x>>2];t=e+48|0;l=+g[t>>2];y=e+16|0;v=+g[y>>2];g[t>>2]=v-u;t=e+20|0;w=+g[t>>2];g[x>>2]=w+l;g[y>>2]=v+u;g[t>>2]=w-l;t=e+60|0;l=+g[t>>2];y=e+56|0;w=+g[y>>2];u=(l-w)*.7071067690849304;w=(l+w)*-.7071067690849304;x=e+24|0;l=+g[x>>2];g[y>>2]=l-u;y=e+28|0;v=+g[y>>2];g[t>>2]=v-w;g[x>>2]=l+u;g[y>>2]=v+w;e=e+64|0;j=j+1|0}}case 4:{t=c[C+(f<<2)>>2]|0;n=t<=(t|0))break a;w=+g[e>>2];o=e+16|0;J=+g[o>>2];l=w-J;q=e+4|0;F=+g[q>>2];p=e+20|0;H=+g[p>>2];v=F-H;J=w+J;H=F+H;r=e+8|0;F=+g[r>>2];x=e+24|0;w=+g[x>>2];I=F+w;s=e+12|0;E=+g[s>>2];y=e+28|0;u=+g[y>>2];G=E+u;g[o>>2]=J-I;g[p>>2]=H-G;g[e>>2]=J+I;g[q>>2]=H+G;w=F-w;u=E-u;g[r>>2]=l+u;g[s>>2]=v-w;g[x>>2]=l-u;g[y>>2]=v+w;e=e+32|0;h=h+1|0}}h=y<<1;j=y*3|0;k=n<<1;m=n*3|0;o=0;while(1){if((o|0)>=(t|0))break a;e=d+((_(o,z)|0)<<3)|0;s=c[A>>2]|0;p=0;q=s;r=s;while(1){if((p|0)>=(y|0))break;M=e+(y<<3)|0;E=+g[M>>2];u=+g[q>>2];L=e+(y<<3)+4|0;F=+g[L>>2];w=+g[q+4>>2];l=E*u-F*w;u=E*w+F*u;P=e+(h<<3)|0;F=+g[P>>2];w=+g[r>>2];O=e+(h<<3)+4|0;E=+g[O>>2];H=+g[r+4>>2];v=F*w-E*H;w=F*H+E*w;K=e+(j<<3)|0;E=+g[K>>2];H=+g[s>>2];x=e+(j<<3)+4|0;F=+g[x>>2];G=+g[s+4>>2];J=E*H-F*G;H=E*G+F*H;F=+g[e>>2];G=F-v;N=e+4|0;E=+g[N>>2];I=E-w;v=F+v;g[e>>2]=v;w=E+w;g[N>>2]=w;E=l+J;F=u+H;J=l-J;H=u-H;g[P>>2]=v-E;g[O>>2]=w-F;g[e>>2]=+g[e>>2]+E;g[N>>2]=+g[N>>2]+F;g[M>>2]=G+H;g[L>>2]=I-J;g[K>>2]=G-H;g[x>>2]=I+J;e=e+8|0;p=p+1|0;q=q+(n<<3)|0;r=r+(k<<3)|0;s=s+(m<<3)|0}o=o+1|0}}case 3:{h=c[C+(f<<2)>>2]|0;j=h<>2]|0)+(m<<3)+4>>2];m=j<<1;n=0;while(1){if((n|0)>=(h|0))break a;e=d+((_(n,z)|0)<<3)|0;q=c[A>>2]|0;o=y;p=q;while(1){O=e+(y<<3)|0;G=+g[O>>2];F=+g[p>>2];P=e+(y<<3)+4|0;w=+g[P>>2];I=+g[p+4>>2];E=G*F-w*I;F=G*I+w*F;M=e+(k<<3)|0;w=+g[M>>2];I=+g[q>>2];N=e+(k<<3)+4|0;G=+g[N>>2];H=+g[q+4>>2];J=w*I-G*H;I=w*H+G*I;G=E+J;H=F+I;g[O>>2]=+g[e>>2]-G*.5;L=e+4|0;g[P>>2]=+g[L>>2]-H*.5;J=(E-J)*l;I=(F-I)*l;g[e>>2]=+g[e>>2]+G;g[L>>2]=+g[L>>2]+H;g[M>>2]=+g[O>>2]+I;g[N>>2]=+g[P>>2]-J;g[O>>2]=+g[O>>2]-I;g[P>>2]=+g[P>>2]+J;o=o+-1|0;if(!o)break;else{e=e+8|0;p=p+(j<<3)|0;q=q+(m<<3)|0}}n=n+1|0}}case 5:{e=c[C+(f<<2)>>2]|0;h=e<>2]|0;l=+g[j+(k<<3)>>2];u=+g[j+(k<<3)+4>>2];k=_(h<<1,y)|0;v=+g[j+(k<<3)>>2];w=+g[j+(k<<3)+4>>2];k=y<<1;m=y*3|0;n=y<<2;t=0;while(1){if((t|0)>=(e|0))break a;s=d+((_(t,z)|0)<<3)|0;o=s;p=s+(y<<3)|0;q=s+(k<<3)|0;r=s+(m<<3)|0;s=s+(n<<3)|0;x=0;while(1){if((x|0)>=(y|0))break;T=+g[o>>2];L=o+4|0;R=+g[L>>2];S=+g[p>>2];K=_(x,h)|0;G=+g[j+(K<<3)>>2];M=p+4|0;W=+g[M>>2];X=+g[j+(K<<3)+4>>2];I=S*G-W*X;G=S*X+W*G;W=+g[q>>2];K=_(x<<1,h)|0;X=+g[j+(K<<3)>>2];O=q+4|0;S=+g[O>>2];E=+g[j+(K<<3)+4>>2];V=W*X-S*E;X=W*E+S*X;S=+g[r>>2];K=_(x*3|0,h)|0;E=+g[j+(K<<3)>>2];P=r+4|0;W=+g[P>>2];H=+g[j+(K<<3)+4>>2];J=S*E-W*H;E=S*H+W*E;W=+g[s>>2];K=_(x<<2,h)|0;H=+g[j+(K<<3)>>2];N=s+4|0;S=+g[N>>2];Q=+g[j+(K<<3)+4>>2];F=W*H-S*Q;H=W*Q+S*H;S=I+F;Q=G+H;F=I-F;H=G-H;G=V+J;I=X+E;J=V-J;E=X-E;g[o>>2]=T+(S+G);g[L>>2]=R+(Q+I);X=T+(S*l+G*v);V=R+(Q*l+I*v);W=H*u+E*w;U=F*u+J*w;g[p>>2]=X-W;g[M>>2]=V+U;g[s>>2]=X+W;g[N>>2]=V-U;G=T+(S*v+G*l);I=R+(Q*v+I*l);H=E*u-H*w;J=F*w-J*u;g[q>>2]=G+H;g[O>>2]=I+J;g[r>>2]=G-H;g[P>>2]=I-J;o=o+8|0;p=p+8|0;q=q+8|0;r=r+8|0;s=s+8|0;x=x+1|0}t=t+1|0}}default:{}}while(0);f=f+-1|0;y=z}i=D;return}function ed(a,d,e,f,h,j,k){a=a|0;d=d|0;e=e|0;f=f|0;h=h|0;j=j|0;k=k|0;var l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0.0,v=0,w=0,x=0,y=0,z=0.0,A=0.0,B=0.0,C=0.0;y=i;t=c[a+8+(j<<2)>>2]|0;u=+g[t+4>>2];l=c[a>>2]|0;m=0;x=c[a+24>>2]|0;while(1){w=l>>1;if((m|0)>=(j|0))break;l=w;m=m+1|0;x=x+(w<<2)|0}v=l>>2;a=i;i=i+((1*(w<<2)|0)+15&-16)|0;l=i;i=i+((1*(v<<3)|0)+15&-16)|0;j=h>>1;q=f+(j<<2)|0;r=h+3>>2;s=0-w|0;o=0;p=q;q=q+-4|0;n=d+(j<<2)|0;j=d+(w<<2)+-4+(j<<2)|0;m=a;while(1){if((o|0)>=(r|0))break;z=+g[q>>2];A=+g[p>>2];g[m>>2]=z*+g[n+(w<<2)>>2]+A*+g[j>>2];g[m+4>>2]=A*+g[n>>2]-z*+g[j+(s<<2)>>2];o=o+1|0;p=p+8|0;q=q+-8|0;n=n+8|0;j=j+-8|0;m=m+8|0}d=f+(h<<2)|0;p=v-r|0;while(1){if((o|0)>=(p|0))break;c[m>>2]=c[j>>2];c[m+4>>2]=c[n>>2];o=o+1|0;n=n+8|0;j=j+-8|0;m=m+8|0}q=o;p=f;o=d+-4|0;while(1){if((q|0)>=(v|0))break;g[m>>2]=+g[o>>2]*+g[j>>2]-+g[p>>2]*+g[n+(s<<2)>>2];g[m+4>>2]=+g[o>>2]*+g[n>>2]+ +g[p>>2]*+g[j+(w<<2)>>2];q=q+1|0;p=p+8|0;o=o+-8|0;n=n+8|0;j=j+-8|0;m=m+8|0}m=t+44|0;j=0;while(1){if((j|0)>=(v|0))break;B=+g[x+(j<<2)>>2];A=+g[x+(v+j<<2)>>2];z=+g[a>>2];C=+g[a+4>>2];s=b[(c[m>>2]|0)+(j<<1)>>1]|0;g[l+(s<<3)>>2]=u*(z*B-C*A);g[l+(s<<3)+4>>2]=u*(C*B+z*A);j=j+1|0;a=a+8|0}dd(t,l);n=k<<1;o=0-n|0;m=0;j=e;a=e+((_(w+-1|0,k)|0)<<2)|0;while(1){if((m|0)>=(v|0))break;B=+g[l+4>>2];A=+g[x+(v+m<<2)>>2];z=+g[l>>2];C=+g[x+(m<<2)>>2];g[j>>2]=B*A-z*C;g[a>>2]=z*A+B*C;l=l+8|0;m=m+1|0;j=j+(n<<2)|0;a=a+(o<<2)|0}i=y;return}function fd(a,d,e,f,h,i,j){a=a|0;d=d|0;e=e|0;f=f|0;h=h|0;i=i|0;j=j|0;var k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0.0,u=0.0,v=0.0,w=0.0,x=0.0,y=0.0;k=c[a>>2]|0;l=0;r=c[a+24>>2]|0;while(1){q=k>>1;if((l|0)>=(i|0))break;k=q;l=l+1|0;r=r+(q<<2)|0}p=k>>2;s=d+((_(q+-1|0,j)|0)<<2)|0;k=e+(h>>1<<2)|0;o=c[a+8+(i<<2)>>2]|0;i=j<<1;j=0-i|0;m=c[o+44>>2]|0;n=0;l=d;a=s;while(1){if((n|0)>=(p|0))break;u=+g[a>>2];v=+g[r+(n<<2)>>2];w=+g[l>>2];t=+g[r+(p+n<<2)>>2];s=b[m>>1]<<1;g[k+((s|1)<<2)>>2]=u*v+w*t;g[k+(s<<2)>>2]=w*v-u*t;m=m+2|0;n=n+1|0;l=l+(i<<2)|0;a=a+(j<<2)|0}dd(o,k);i=p+1>>1;a=k+(q<<2)|0;j=0;while(1){l=a+-8|0;if((j|0)>=(i|0))break;s=k+4|0;y=+g[s>>2];u=+g[k>>2];w=+g[r+(j<<2)>>2];x=+g[r+(p+j<<2)>>2];d=a+-4|0;t=+g[d>>2];v=+g[l>>2];g[k>>2]=y*w+u*x;g[d>>2]=y*x-u*w;w=+g[r+(p-j+-1<<2)>>2];u=+g[r+(q-j+-1<<2)>>2];g[l>>2]=t*w+v*u;g[s>>2]=t*u-v*w;a=l;j=j+1|0;k=k+8|0}i=(h|0)/2|0;k=e+(h<<2)|0;l=f+(h<<2)|0;a=0;while(1){l=l+-4|0;k=k+-4|0;if((a|0)>=(i|0))break;y=+g[k>>2];w=+g[e>>2];x=+g[l>>2];v=+g[f>>2];g[e>>2]=x*w-v*y;g[k>>2]=v*w+x*y;a=a+1|0;f=f+4|0;e=e+4|0}return}function gd(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0.0,h=0,j=0.0,k=0.0,l=0.0,m=0.0,n=0.0,o=0.0,p=0.0,q=0.0,r=0.0,s=0,t=0,u=0,v=0,w=0,x=0.0,y=0.0;u=i;i=i+48|0;h=u+16|0;s=u;t=d>>1;d=1;while(1){if((d|0)>=(t|0))break;v=d<<1;w=c[a>>2]|0;g[b+(d<<2)>>2]=((+g[w+(v+-1<<2)>>2]+ +g[w+((v|1)<<2)>>2])*.5+ +g[w+(v<<2)>>2])*.5;d=d+1|0}w=c[a>>2]|0;g[b>>2]=(+g[w+4>>2]*.5+ +g[w>>2])*.5;if((e|0)==2){d=a+4|0;e=1;while(1){if((e|0)>=(t|0))break;v=e<<1;a=c[d>>2]|0;w=b+(e<<2)|0;g[w>>2]=+g[w>>2]+((+g[a+(v+-1<<2)>>2]+ +g[a+((v|1)<<2)>>2])*.5+ +g[a+(v<<2)>>2])*.5;e=e+1|0}w=c[d>>2]|0;g[b>>2]=+g[b>>2]+(+g[w+4>>2]*.5+ +g[w>>2])*.5}pd(b,h,0,0,4,t);g[h>>2]=+g[h>>2]*1.000100016593933;d=1;while(1){if((d|0)==5)break;w=h+(d<<2)|0;q=+g[w>>2];r=+(d|0)*.00800000037997961;g[w>>2]=q-q*r*r;d=d+1|0}ld(s,h,4);d=0;f=1.0;while(1){if((d|0)==4)break;r=f*.8999999761581421;w=s+(d<<2)|0;g[w>>2]=+g[w>>2]*r;d=d+1|0;f=r}q=+g[s>>2];p=q+.800000011920929;r=+g[s+4>>2];q=r+q*.800000011920929;f=+g[s+8>>2];r=f+r*.800000011920929;j=+g[s+12>>2];f=j+f*.800000011920929;j=j*.800000011920929;d=0;k=0.0;l=0.0;m=0.0;n=0.0;o=0.0;while(1){if((d|0)>=(t|0))break;w=b+(d<<2)|0;y=+g[w>>2];g[w>>2]=y+p*k+q*l+r*m+f*n+j*o;x=k;d=d+1|0;k=y;o=n;n=m;m=l;l=x}i=u;return}function hd(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var h=0,i=0,j=0,l=0.0,m=0,n=0,o=0,p=0,q=0,r=0.0,s=0.0,t=0.0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0.0,C=0.0,D=0.0,E=0.0,F=0.0,G=0,H=0,I=0.0,J=0.0,K=0.0,L=0.0,M=0.0;u=f+-3|0;v=e+-3|0;y=((v|0)>0?v:0)+3|0;w=y&-4;z=a+(w<<2)|0;j=f+-3|0;j=((j|0)>0?j:0)+3&-4;x=0;y=b+((y|3)<<2)|0;while(1){if((x|0)>=(u|0))break;A=b+(x<<2)|0;o=a;p=A+12|0;q=0;n=0;m=0;i=0;h=0;l=+g[A>>2];s=+g[A+4>>2];t=+g[A+8>>2];r=0.0;while(1){if((q|0)>=(v|0))break;F=+g[o>>2];r=+g[p>>2];M=(c[k>>2]=n,+g[k>>2])+F*l;L=(c[k>>2]=m,+g[k>>2])+F*s;K=(c[k>>2]=i,+g[k>>2])+F*t;J=+g[o+4>>2];D=+g[p+4>>2];I=+g[o+8>>2];C=+g[p+8>>2];F=(c[k>>2]=h,+g[k>>2])+F*r+J*D+I*C;E=+g[o+12>>2];B=+g[p+12>>2];H=(g[k>>2]=M+J*s+I*t+E*r,c[k>>2]|0);G=(g[k>>2]=L+J*t+I*r+E*D,c[k>>2]|0);A=(g[k>>2]=K+J*r+I*D+E*C,c[k>>2]|0);o=o+16|0;p=p+16|0;q=q+4|0;n=H;m=G;i=A;h=(g[k>>2]=F+E*B,c[k>>2]|0);l=D;s=C;t=B}q=w|1;if((w|0)<(e|0)){M=+g[z>>2];r=+g[y>>2];n=(g[k>>2]=(c[k>>2]=n,+g[k>>2])+M*l,c[k>>2]|0);m=(g[k>>2]=(c[k>>2]=m,+g[k>>2])+M*s,c[k>>2]|0);i=(g[k>>2]=(c[k>>2]=i,+g[k>>2])+M*t,c[k>>2]|0);o=z+4|0;p=y+4|0;h=(g[k>>2]=(c[k>>2]=h,+g[k>>2])+M*r,c[k>>2]|0)}else{o=z;p=y}if((q|0)<(e|0)){M=+g[o>>2];l=+g[p>>2];n=(g[k>>2]=(c[k>>2]=n,+g[k>>2])+M*s,c[k>>2]|0);m=(g[k>>2]=(c[k>>2]=m,+g[k>>2])+M*t,c[k>>2]|0);i=(g[k>>2]=(c[k>>2]=i,+g[k>>2])+M*r,c[k>>2]|0);o=o+4|0;p=p+4|0;h=(g[k>>2]=(c[k>>2]=h,+g[k>>2])+M*l,c[k>>2]|0)}if((q+1|0)<(e|0)){M=+g[o>>2];n=(g[k>>2]=(c[k>>2]=n,+g[k>>2])+M*t,c[k>>2]|0);m=(g[k>>2]=(c[k>>2]=m,+g[k>>2])+M*r,c[k>>2]|0);i=(g[k>>2]=(c[k>>2]=i,+g[k>>2])+M*l,c[k>>2]|0);h=(g[k>>2]=(c[k>>2]=h,+g[k>>2])+M*+g[p>>2],c[k>>2]|0)}c[d+(x<<2)>>2]=n;c[d+((x|1)<<2)>>2]=m;c[d+((x|2)<<2)>>2]=i;c[d+((x|3)<<2)>>2]=h;x=x+4|0;y=y+16|0}while(1){if((j|0)>=(f|0))break;h=b+(j<<2)|0;i=0;l=0.0;while(1){if((i|0)>=(e|0))break;M=l+ +g[a+(i<<2)>>2]*+g[h+(i<<2)>>2];i=i+1|0;l=M}g[d+(j<<2)>>2]=l;j=j+1|0}return}function id(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var h=0.0,j=0.0,k=0.0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0;u=i;i=i+16|0;r=u;m=r;c[m>>2]=0;c[m+4>>2]=0;m=d>>2;n=i;i=i+((1*(m<<2)|0)+15&-16)|0;o=d+e>>2;p=i;i=i+((1*(o<<2)|0)+15&-16)|0;s=e>>1;t=i;i=i+((1*(s<<2)|0)+15&-16)|0;l=0;while(1){if((l|0)>=(m|0))break;c[n+(l<<2)>>2]=c[a+(l<<1<<2)>>2];l=l+1|0}l=0;while(1){if((l|0)>=(o|0))break;c[p+(l<<2)>>2]=c[b+(l<<1<<2)>>2];l=l+1|0}e=e>>2;hd(n,p,t,m,e);jd(t,p,m,e,r);e=c[r>>2]<<1;q=c[r+4>>2]<<1;l=d>>1;o=0;while(1){if((o|0)>=(s|0))break;m=t+(o<<2)|0;g[m>>2]=0.0;d=o-e|0;if(!((((d|0)>-1?d:0-d|0)|0)>2?(d=o-q|0,(((d|0)>-1?d:0-d|0)|0)>2):0)){n=b+(o<<2)|0;p=0;h=0.0;while(1){if((p|0)>=(l|0))break;k=h+ +g[a+(p<<2)>>2]*+g[n+(p<<2)>>2];p=p+1|0;h=k}g[m>>2]=h<-1.0?-1.0:h}o=o+1|0}jd(t,b,l,s,r);l=c[r>>2]|0;if(!((l|0)>0&(l|0)<(s+-1|0))){t=0;s=l<<1;t=s-t|0;c[f>>2]=t;i=u;return}j=+g[t+(l+-1<<2)>>2];k=+g[t+(l<<2)>>2];h=+g[t+(l+1<<2)>>2];if(h-j>(k-j)*.699999988079071){t=1;s=l<<1;t=s-t|0;c[f>>2]=t;i=u;return}if(j-h>(k-h)*.699999988079071){t=-1;s=l<<1;t=s-t|0;c[f>>2]=t;i=u;return}t=0;s=l<<1;t=s-t|0;c[f>>2]=t;i=u;return}function jd(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var h=0,i=0.0,j=0.0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0.0,u=0.0;c[f>>2]=0;s=f+4|0;c[s>>2]=1;i=1.0;h=0;while(1){if((h|0)>=(d|0)){h=0;p=0;l=0;q=-1082130432;m=-1082130432;r=0;break}j=+g[b+(h<<2)>>2];i=i+j*j;h=h+1|0}while(1){if((r|0)>=(e|0))break;j=+g[a+(r<<2)>>2];do if(j>0.0?(t=j*9.999999960041972e-13,t=t*t,j=t*(c[k>>2]=l,+g[k>>2]),j>(c[k>>2]=m,+g[k>>2])*i):0){j=t*(c[k>>2]=p,+g[k>>2]);if(j>(c[k>>2]=q,+g[k>>2])*i){c[s>>2]=h;o=(g[k>>2]=t,c[k>>2]|0);n=(g[k>>2]=i,c[k>>2]|0);c[f>>2]=r;h=r;l=p;m=q;break}else{m=(g[k>>2]=t,c[k>>2]|0);l=(g[k>>2]=i,c[k>>2]|0);c[s>>2]=r;n=p;o=q;break}}else{n=p;o=q}while(0);u=+g[b+(r+d<<2)>>2];j=+g[b+(r<<2)>>2];j=i+(u*u-j*j);i=j<1.0?1.0:j;p=n;q=o;r=r+1|0}return}function kd(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=+f;var h=0.0,j=0.0,k=0.0,l=0.0,m=0.0,n=0,o=0.0,p=0,q=0.0,r=0,s=0,t=0.0,u=0.0,v=0.0,w=0,x=0,y=0.0,z=0,A=0.0,B=0,C=0,D=0,E=0,F=0;F=i;i=i+2064|0;E=F+2052|0;w=c[d>>2]|0;z=(e|0)/2|0;D=(b|0)/2|0;C=a+2048|0;w=(w|0)>1023?511:(w|0)/2|0;c[d>>2]=w;x=F;e=C+(0-w<<2)|0;b=0;y=0.0;j=0.0;while(1){if((b|0)>=(D|0))break;v=+g[C+(b<<2)>>2];A=j+v*+g[e+(b<<2)>>2];b=b+1|0;y=y+v*v;j=A}g[x>>2]=y;e=1;h=y;while(1){if((e|0)==513)break;v=+g[C+(0-e<<2)>>2];A=+g[C+(D-e<<2)>>2];A=h+v*v-A*A;g[x+(e<<2)>>2]=A<0.0?0.0:A;e=e+1|0;h=A}q=+g[x+(w<<2)>>2];A=j/+O(+(y*q+1.0));s=w<<1;t=A*.699999988079071;u=A*.8500000238418579;v=f*.5;B=w;r=2;while(1){if((r|0)>=16)break;e=r<<1;p=((s+r|0)>>>0)/(e>>>0)|0;if((p|0)<7)break;if((r|0)==2){n=p+w|0;n=(n|0)>512?w:n}else n=(((_(c[17156+(r<<2)>>2]<<1,w)|0)+r|0)>>>0)/(e>>>0)|0;e=C+(0-p<<2)|0;b=C+(0-n<<2)|0;a=0;h=0.0;k=0.0;while(1){if((a|0)>=(D|0))break;m=+g[C+(a<<2)>>2];o=k+m*+g[b+(a<<2)>>2];m=h+m*+g[e+(a<<2)>>2];a=a+1|0;h=m;k=o}o=(h+k)*.5;k=(+g[x+(p<<2)>>2]+ +g[x+(n<<2)>>2])*.5;h=o/+O(+(y*k+1.0));e=p-z|0;e=(e|0)>-1?e:0-e|0;if((e|0)>=2)if((e|0)<3){n=(_(r*5|0,r)|0)<(w|0);m=n?v:0.0}else m=0.0;else m=f;l=t-m;l=l<.30000001192092896?.30000001192092896:l;if((p|0)<21){l=u-m;if(l<.4000000059604645)l=.4000000059604645}if(h>l){e=p;j=o}else{e=B;k=q;h=A}B=e;q=k;A=h;r=r+1|0}h=j<0.0?0.0:j;if(!(q<=h))l=h/(q+1.0);else l=1.0;a=0;while(1){if((a|0)==3)break;e=C+(1-(B+a)<<2)|0;b=0;h=0.0;while(1){if((b|0)>=(D|0))break;f=h+ +g[C+(b<<2)>>2]*+g[e+(b<<2)>>2];b=b+1|0;h=f}g[E+(a<<2)>>2]=h;a=a+1|0}j=+g[E+8>>2];k=+g[E>>2];h=+g[E+4>>2];if(j-k>(h-k)*.699999988079071){E=1;D=l>A;f=D?A:l;D=B<<1;E=D+E|0;D=(E|0)<15;E=D?15:E;c[d>>2]=E;i=F;return +f}if(k-j>(h-j)*.699999988079071){E=-1;D=l>A;f=D?A:l;D=B<<1;E=D+E|0;D=(E|0)<15;E=D?15:E;c[d>>2]=E;i=F;return +f}E=0;D=l>A;f=D?A:l;D=B<<1;E=D+E|0;D=(E|0)<15;E=D?15:E;c[d>>2]=E;i=F;return +f}function ld(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0.0,f=0.0,h=0.0,i=0,j=0,k=0,l=0,m=0.0,n=0.0,o=0;e=+g[b>>2];nf(a|0,0,c<<2|0)|0;if(+g[b>>2]!=0.0)k=0;else return;while(1){if((k|0)<(c|0)){d=0;f=0.0}else{d=9;break}while(1){if((k|0)==(d|0))break;h=f+ +g[a+(d<<2)>>2]*+g[b+(k-d<<2)>>2];d=d+1|0;f=h}i=k;k=k+1|0;f=(f+ +g[b+(k<<2)>>2])/e;h=-f;g[a+(i<<2)>>2]=h;d=k>>1;i=i+-1|0;j=0;while(1){if((j|0)>=(d|0))break;o=a+(j<<2)|0;m=+g[o>>2];l=a+(i-j<<2)|0;n=+g[l>>2];g[o>>2]=m+n*h;g[l>>2]=n+m*h;j=j+1|0}e=e-f*f*e;if(e<+g[b>>2]*1.0000000474974513e-03){d=9;break}}if((d|0)==9)return}function md(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var h=0,j=0.0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0.0;q=i;i=i+112|0;n=q+96|0;o=q;p=i;i=i+((1*(e+24<<2)|0)+15&-16)|0;h=0;while(1){if((h|0)==24)break;c[o+(h<<2)>>2]=c[b+(24-h+-1<<2)>>2];h=h+1|0}h=0;while(1){if((h|0)==24){h=0;break}c[p+(h<<2)>>2]=c[f+(24-h+-1<<2)>>2];h=h+1|0}while(1){if((h|0)>=(e|0)){h=0;break}c[p+(h+24<<2)>>2]=c[a+(h<<2)>>2];h=h+1|0}while(1){if((h|0)==24)break;c[f+(h<<2)>>2]=c[a+(e-h+-1<<2)>>2];h=h+1|0}b=e+-3|0;f=n+4|0;k=n+8|0;l=n+12|0;h=((b|0)>0?b:0)+3&-4;m=0;while(1){if((m|0)>=(b|0))break;c[n>>2]=0;c[n+4>>2]=0;c[n+8>>2]=0;c[n+12>>2]=0;nd(o,p+(m<<2)|0,n,24);g[d+(m<<2)>>2]=+g[a+(m<<2)>>2]+ +g[n>>2];r=m|1;g[d+(r<<2)>>2]=+g[a+(r<<2)>>2]+ +g[f>>2];r=m|2;g[d+(r<<2)>>2]=+g[a+(r<<2)>>2]+ +g[k>>2];r=m|3;g[d+(r<<2)>>2]=+g[a+(r<<2)>>2]+ +g[l>>2];m=m+4|0}while(1){if((h|0)<(e|0)){b=0;j=0.0}else break;while(1){if((b|0)==24)break;s=j+ +g[o+(b<<2)>>2]*+g[p+(h+b<<2)>>2];b=b+1|0;j=s}g[d+(h<<2)>>2]=+g[a+(h<<2)>>2]+j;h=h+1|0}i=q;return}function nd(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0.0,f=0,h=0,i=0.0,j=0,k=0,l=0,m=0,n=0.0,o=0,p=0,q=0,r=0.0,s=0.0,t=0.0,u=0.0,v=0.0,w=0.0,x=0.0,y=0.0,z=0.0;j=d+-3|0;o=c+4|0;p=c+8|0;q=c+12|0;l=((j|0)>0?j:0)+3|0;m=l&-4;l=l|3;f=a;h=b+12|0;k=0;e=+g[b>>2];n=+g[b+4>>2];r=+g[b+8>>2];i=0.0;while(1){if((k|0)>=(j|0))break;w=+g[f>>2];i=+g[h>>2];z=+g[c>>2]+w*e;g[c>>2]=z;y=+g[o>>2]+w*n;g[o>>2]=y;x=+g[p>>2]+w*r;g[p>>2]=x;w=+g[q>>2]+w*i;g[q>>2]=w;v=+g[f+4>>2];u=+g[h+4>>2];z=z+v*n;g[c>>2]=z;y=y+v*r;g[o>>2]=y;x=x+v*i;g[p>>2]=x;v=w+v*u;g[q>>2]=v;w=+g[f+8>>2];t=+g[h+8>>2];z=z+w*r;g[c>>2]=z;y=y+w*i;g[o>>2]=y;x=x+w*u;g[p>>2]=x;w=v+w*t;g[q>>2]=w;v=+g[f+12>>2];s=+g[h+12>>2];g[c>>2]=z+v*i;g[o>>2]=y+v*u;g[p>>2]=x+v*t;g[q>>2]=w+v*s;f=f+16|0;h=h+16|0;k=k+4|0;e=u;n=t;r=s}h=a+(m<<2)|0;f=b+(l<<2)|0;j=m|1;if((m|0)<(d|0)){z=+g[h>>2];i=+g[f>>2];g[c>>2]=+g[c>>2]+z*e;g[o>>2]=+g[o>>2]+z*n;g[p>>2]=+g[p>>2]+z*r;g[q>>2]=+g[q>>2]+z*i;h=h+4|0;f=f+4|0}if((j|0)<(d|0)){z=+g[h>>2];e=+g[f>>2];g[c>>2]=+g[c>>2]+z*n;g[o>>2]=+g[o>>2]+z*r;g[p>>2]=+g[p>>2]+z*i;g[q>>2]=+g[q>>2]+z*e;h=h+4|0;f=f+4|0}if((j+1|0)>=(d|0))return;y=+g[h>>2];z=+g[f>>2];g[c>>2]=+g[c>>2]+y*r;g[o>>2]=+g[o>>2]+y*i;g[p>>2]=+g[p>>2]+y*e;g[q>>2]=+g[q>>2]+y*z;return}function od(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var h=0,j=0,k=0.0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0.0,x=0.0,y=0,z=0.0,A=0;u=i;i=i+112|0;r=u+96|0;s=u;j=e+24|0;t=i;i=i+((1*(j<<2)|0)+15&-16)|0;h=0;while(1){if((h|0)==24)break;c[s+(h<<2)>>2]=c[b+(24-h+-1<<2)>>2];h=h+1|0}h=0;while(1){if((h|0)==24){h=24;break}g[t+(h<<2)>>2]=-+g[f+(24-h+-1<<2)>>2];h=h+1|0}while(1){if((h|0)>=(j|0))break;g[t+(h<<2)>>2]=0.0;h=h+1|0}j=e+-3|0;l=r+4|0;m=r+8|0;n=r+12|0;o=b+4|0;p=b+8|0;h=e+-3|0;h=((h|0)>0?h:0)+3&-4;q=0;while(1){if((q|0)>=(j|0))break;c[r>>2]=c[a+(q<<2)>>2];A=q|1;c[l>>2]=c[a+(A<<2)>>2];y=q|2;c[m>>2]=c[a+(y<<2)>>2];v=q|3;c[n>>2]=c[a+(v<<2)>>2];nd(s,t+(q<<2)|0,r,24);z=+g[r>>2];k=-z;g[t+(q+24<<2)>>2]=k;g[d+(q<<2)>>2]=z;z=+g[l>>2]+ +g[b>>2]*k;g[l>>2]=z;w=-z;g[t+(q+25<<2)>>2]=w;g[d+(A<<2)>>2]=z;z=+g[m>>2]+ +g[b>>2]*w+ +g[o>>2]*k;g[m>>2]=z;x=-z;g[t+(q+26<<2)>>2]=x;g[d+(y<<2)>>2]=z;k=+g[n>>2]+ +g[b>>2]*x+ +g[o>>2]*w+ +g[p>>2]*k;g[n>>2]=k;g[t+(q+27<<2)>>2]=-k;g[d+(v<<2)>>2]=k;q=q+4|0}while(1){if((h|0)>=(e|0)){h=0;break}j=0;k=+g[a+(h<<2)>>2];while(1){if((j|0)==24)break;z=k-+g[s+(j<<2)>>2]*+g[t+(h+j<<2)>>2];j=j+1|0;k=z}g[t+(h+24<<2)>>2]=k;g[d+(h<<2)>>2]=k;h=h+1|0}while(1){if((h|0)==24)break;c[f+(h<<2)>>2]=c[d+(e-h+-1<<2)>>2];h=h+1|0}i=u;return}function pd(a,b,d,e,f,h){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;h=h|0;var j=0.0,k=0,l=0,m=0,n=0,o=0;n=i;m=h-f|0;l=i;i=i+((1*(h<<2)|0)+15&-16)|0;a:do if(!e)l=a;else{k=0;while(1){if((k|0)>=(h|0)){k=0;break}c[l+(k<<2)>>2]=c[a+(k<<2)>>2];k=k+1|0}while(1){if((k|0)>=(e|0))break a;j=+g[d+(k<<2)>>2];g[l+(k<<2)>>2]=+g[a+(k<<2)>>2]*j;o=h-k+-1|0;g[l+(o<<2)>>2]=+g[a+(o<<2)>>2]*j;k=k+1|0}}while(0);hd(l,l,b,m,f+1|0);e=0;while(1){if((e|0)>(f|0))break;j=0.0;k=e+m|0;while(1){if((k|0)>=(h|0))break;j=j+ +g[l+(k<<2)>>2]*+g[l+(k-e<<2)>>2];k=k+1|0}o=b+(e<<2)|0;g[o>>2]=+g[o>>2]+j;e=e+1|0}i=n;return}function qd(a,b,d,e,f,h,j,k,l,m,n,o,p,q,r,s,t){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;h=h|0;j=j|0;k=k|0;l=l|0;m=m|0;n=n|0;o=o|0;p=p|0;q=q|0;r=r|0;s=s|0;t=t|0;var u=0,v=0.0,w=0.0,x=0,y=0,z=0.0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0.0;S=i;i=i+96|0;O=S+72|0;P=S+48|0;Q=S+24|0;R=S;if(!p)if((r|0)==0?(u=d-b|0,+g[q>>2]>+(_(m<<1,u)|0)):0)x=(_(u,m)|0)<(o|0);else x=0;else x=1;w=+(j>>>0)*+g[q>>2]*+(s|0)/+(m<<9|0);N=a+8|0;y=c[N>>2]|0;s=0;v=0.0;do{p=_(s,y)|0;u=b;while(1){if((u|0)>=(e|0))break;L=u+p|0;T=+g[f+(L<<2)>>2]-+g[h+(L<<2)>>2];v=v+T*T;u=u+1|0}s=s+1|0}while((s|0)<(m|0));L=~~w;w=v>200.0?200.0:v;J=l+20|0;s=c[J>>2]|0;K=l+28|0;p=c[K>>2]|0;I=s+((aa(p|0)|0)+-32)|0;u=(I+3|0)>>>0>j>>>0;H=u?0:x&1;if((d-b|0)>10?(z=+(o|0)*.125,!(z>16.0)):0)v=z;else v=16.0;v=(t|0)==0?v:3.0;c[O>>2]=c[l>>2];c[O+4>>2]=c[l+4>>2];c[O+8>>2]=c[l+8>>2];c[O+12>>2]=c[l+12>>2];c[O+16>>2]=c[l+16>>2];c[O+20>>2]=c[l+20>>2];G=l+24|0;D=c[G>>2]|0;c[P>>2]=c[K>>2];c[P+4>>2]=c[K+4>>2];c[P+8>>2]=c[K+8>>2];c[P+12>>2]=c[K+12>>2];c[P+16>>2]=c[K+16>>2];C=_(y,m)|0;E=i;i=i+((1*(C<<2)|0)+15&-16)|0;F=i;i=i+((1*(C<<2)|0)+15&-16)|0;rf(E|0,h|0,C<<2|0)|0;C=u|(r|0)==0;if(C)if(!H){B=D;A=0}else{rd(a,b,d,f,E,j,I,29009+(n*84|0)+42|0,F,l,m,n,1,v,t)|0;M=22}else{u=rd(a,b,d,f,E,j,I,29009+(n*84|0)+42|0,F,l,m,n,1,v,t)|0;if(!H){s=c[J>>2]|0;p=c[K>>2]|0;B=c[G>>2]|0;A=u}else M=22}if((M|0)==22){rf(h|0,E|0,(_(c[N>>2]|0,m)|0)<<2|0)|0;rf(k|0,F|0,(_(c[N>>2]|0,m)|0)<<2|0)|0;T=w;g[q>>2]=T;i=S;return}x=32-(aa(p|0)|0)|0;e=p>>>(x+-16|0);p=(e>>>12)+-8|0;p=(s<<3)-((x<<3)+(p+(e>>>0>(c[5272+(p<<2)>>2]|0)>>>0&1)))|0;s=c[l>>2]|0;e=l+4|0;c[Q>>2]=c[e>>2];c[Q+4>>2]=c[e+4>>2];c[Q+8>>2]=c[e+8>>2];c[Q+12>>2]=c[e+12>>2];c[Q+16>>2]=c[e+16>>2];c[R>>2]=c[K>>2];c[R+4>>2]=c[K+4>>2];c[R+8>>2]=c[K+8>>2];c[R+12>>2]=c[K+12>>2];c[R+16>>2]=c[K+16>>2];x=s+D|0;o=B-D|0;y=Fa()|0;r=i;i=i+((1*((B|0)==(D|0)?1:o)|0)+15&-16)|0;rf(r|0,x|0,o|0)|0;c[l>>2]=c[O>>2];c[l+4>>2]=c[O+4>>2];c[l+8>>2]=c[O+8>>2];c[l+12>>2]=c[O+12>>2];c[l+16>>2]=c[O+16>>2];c[l+20>>2]=c[O+20>>2];c[G>>2]=D;c[K>>2]=c[P>>2];c[K+4>>2]=c[P+4>>2];c[K+8>>2]=c[P+8>>2];c[K+12>>2]=c[P+12>>2];c[K+16>>2]=c[P+16>>2];u=rd(a,b,d,f,h,j,I,29009+(n*84|0)+(H*42|0)|0,k,l,m,n,0,v,t)|0;do if(!C){if((A|0)>=(u|0)){if((A|0)!=(u|0))break;a=c[K>>2]|0;t=32-(aa(a|0)|0)|0;a=a>>>(t+-16|0);b=(a>>>12)+-8|0;if(((c[J>>2]<<3)-((t<<3)+(b+(a>>>0>(c[5272+(b<<2)>>2]|0)>>>0&1)))+L|0)<=(p|0))break}c[l>>2]=s;c[e>>2]=c[Q>>2];c[e+4>>2]=c[Q+4>>2];c[e+8>>2]=c[Q+8>>2];c[e+12>>2]=c[Q+12>>2];c[e+16>>2]=c[Q+16>>2];c[G>>2]=B;c[K>>2]=c[R>>2];c[K+4>>2]=c[R+4>>2];c[K+8>>2]=c[R+8>>2];c[K+12>>2]=c[R+12>>2];c[K+16>>2]=c[R+16>>2];rf(x|0,r|0,o|0)|0;rf(h|0,E|0,(_(c[N>>2]|0,m)|0)<<2|0)|0;rf(k|0,F|0,(_(c[N>>2]|0,m)|0)<<2|0)|0;Na(y|0);T=w;g[q>>2]=T;i=S;return}while(0);Na(y|0);T=+g[17336+(n<<2)>>2];T=T*T*+g[q>>2]+w;g[q>>2]=T;i=S;return}function rd(b,e,f,h,j,k,l,m,n,o,p,q,r,s,t){b=b|0;e=e|0;f=f|0;h=h|0;j=j|0;k=k|0;l=l|0;m=m|0;n=n|0;o=o|0;p=p|0;q=q|0;r=r|0;s=+s;t=t|0;var u=0,v=0,w=0,x=0.0,y=0.0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0.0,J=0.0,K=0.0,L=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,$=0.0,ba=0.0,ca=0,da=0;da=i;i=i+16|0;ca=da;Z=ca;c[Z>>2]=0;c[Z+4>>2]=0;a:do if((l+3|0)<=(k|0)){H=o+28|0;u=c[H>>2]|0;l=u>>>3;u=u-l|0;G=o+32|0;if(!r)l=u;else c[G>>2]=(c[G>>2]|0)+u;c[H>>2]=l;z=o+36|0;A=o+20|0;B=o+40|0;C=o+24|0;D=o+8|0;E=o+4|0;F=o+44|0;while(1){if(l>>>0>=8388609)break a;u=c[G>>2]|0;w=u>>>23;if((w|0)==255)c[z>>2]=(c[z>>2]|0)+1;else{v=u>>>31;l=c[B>>2]|0;if((l|0)>-1){u=c[C>>2]|0;if((u+(c[D>>2]|0)|0)>>>0<(c[E>>2]|0)>>>0){c[C>>2]=u+1;a[(c[o>>2]|0)+u>>0]=l+v;l=0}else l=-1;c[F>>2]=c[F>>2]|l}l=c[z>>2]|0;if(l|0){v=v+255&255;do{u=c[C>>2]|0;if((u+(c[D>>2]|0)|0)>>>0<(c[E>>2]|0)>>>0){c[C>>2]=u+1;a[(c[o>>2]|0)+u>>0]=v;u=0;l=c[z>>2]|0}else u=-1;c[F>>2]=c[F>>2]|u;l=l+-1|0;c[z>>2]=l}while((l|0)!=0)}c[B>>2]=w&255;u=c[G>>2]|0;l=c[H>>2]|0}c[G>>2]=u<<8&2147483392;l=l<<8;c[H>>2]=l;c[A>>2]=(c[A>>2]|0)+8}}while(0);if(!r){ba=+g[17320+(q<<2)>>2];$=+g[17336+(q<<2)>>2]}else{ba=.149993896484375;$=0.0}W=b+8|0;X=o+20|0;Y=o+28|0;Z=p*3|0;b=(t|0)==0;t=o+32|0;L=o+36|0;N=o+40|0;O=o+24|0;P=o+8|0;Q=o+4|0;R=o+44|0;l=0;V=e;while(1){if((V|0)>=(f|0))break;S=_(Z,f-V|0)|0;T=(V|0)!=(e|0);U=(V|0)<20;q=0;do{r=V+(_(q,c[W>>2]|0)|0)|0;y=+g[h+(r<<2)>>2];x=+g[j+(r<<2)>>2];K=$*(x<-9.0?-9.0:x);r=ca+(q<<2)|0;I=+g[r>>2];J=y-K-I;u=~~+M(+(J+.5));x=(x<-28.0?-28.0:x)-s;if((u|0)<0&y0?0:H}else H=u;w=c[X>>2]|0;G=c[Y>>2]|0;z=w+((aa(G|0)|0)+-32)|0;A=k-z|0;v=A-S|0;if((v|0)<24&T){u=(H|0)>1?1:H;if((v|0)<16)u=(u|0)<-1?-1:u}else u=H;u=b|(V|0)<2|(u|0)<0?u:0;b:do if((A|0)<=14)if((A|0)>1){u=(u|0)<-1?-1:(u|0)<1?u:1;v=u<<1^u>>31;z=G>>>2;if((v|0)>0){F=d[29345+(v+-1)>>0]|0;G=G-(_(z,F)|0)|0;c[t>>2]=(c[t>>2]|0)+G;v=_(z,F-(d[29345+v>>0]|0)|0)|0}else v=G-(_(z,d[29345+v>>0]|0)|0)|0;c[Y>>2]=v;while(1){if(v>>>0>=8388609)break b;z=c[t>>2]|0;A=z>>>23;if((A|0)==255)c[L>>2]=(c[L>>2]|0)+1;else{z=z>>>31;v=c[N>>2]|0;if((v|0)>-1){w=c[O>>2]|0;if((w+(c[P>>2]|0)|0)>>>0<(c[Q>>2]|0)>>>0){c[O>>2]=w+1;a[(c[o>>2]|0)+w>>0]=v+z;v=0}else v=-1;c[R>>2]=c[R>>2]|v}v=c[L>>2]|0;if(v|0){z=z+255&255;do{w=c[O>>2]|0;if((w+(c[P>>2]|0)|0)>>>0<(c[Q>>2]|0)>>>0){c[O>>2]=w+1;a[(c[o>>2]|0)+w>>0]=z;w=0;v=c[L>>2]|0}else w=-1;c[R>>2]=c[R>>2]|w;v=v+-1|0;c[L>>2]=v}while((v|0)!=0)}c[N>>2]=A&255;z=c[t>>2]|0;v=c[Y>>2]|0;w=c[X>>2]|0}c[t>>2]=z<<8&2147483392;v=v<<8;c[Y>>2]=v;w=w+8|0;c[X>>2]=w}}else{if((z|0)>=(k|0)){u=-1;break}z=G>>>1;v=G-z|0;if((u|0)>-1)u=0;else{c[t>>2]=(c[t>>2]|0)+v;v=z}c[Y>>2]=v;while(1){if(v>>>0>=8388609)break b;z=c[t>>2]|0;A=z>>>23;if((A|0)==255)c[L>>2]=(c[L>>2]|0)+1;else{z=z>>>31;v=c[N>>2]|0;if((v|0)>-1){w=c[O>>2]|0;if((w+(c[P>>2]|0)|0)>>>0<(c[Q>>2]|0)>>>0){c[O>>2]=w+1;a[(c[o>>2]|0)+w>>0]=v+z;v=0}else v=-1;c[R>>2]=c[R>>2]|v}v=c[L>>2]|0;if(v|0){z=z+255&255;do{w=c[O>>2]|0;if((w+(c[P>>2]|0)|0)>>>0<(c[Q>>2]|0)>>>0){c[O>>2]=w+1;a[(c[o>>2]|0)+w>>0]=z;w=0;v=c[L>>2]|0}else w=-1;c[R>>2]=c[R>>2]|w;v=v+-1|0;c[L>>2]=v}while((v|0)!=0)}c[N>>2]=A&255;z=c[t>>2]|0;v=c[Y>>2]|0;w=c[X>>2]|0}c[t>>2]=z<<8&2147483392;v=v<<8;c[Y>>2]=v;w=w+8|0;c[X>>2]=w}}else{A=(U?V:20)<<1;v=(d[m+A>>0]|0)<<7;A=(d[m+(A|1)>>0]|0)<<6;if(u){E=u>>31;B=u+E^E;z=_(32736-v|0,16384-A|0)|0;C=v;D=1;while(1){v=z>>>15;if(!v){F=36;break}if((B|0)<=(D|0)){F=37;break}F=v<<1;z=_(F,A)|0;C=C+(F+2)|0;D=D+1|0}if((F|0)==36){F=0;A=B-D|0;u=(32768-C-E>>1)+-1|0;u=(A|0)<(u|0)?A:u;A=C+((u<<1|1)+E)|0;v=32768-A|0;v=v>>>0>1?1:v;u=D+u+E^E}else if((F|0)==37){F=0;A=v+1|0;v=A;A=C+(A&~E)|0}z=G>>>15;if(!A)F=40;else{G=G-(_(z,32768-A|0)|0)|0;c[t>>2]=(c[t>>2]|0)+G;v=_(z,v)|0}}else{z=G>>>15;u=0;F=40}if((F|0)==40)v=G-(_(z,32768-v|0)|0)|0;c[Y>>2]=v;z=v;v=w;while(1){if(z>>>0>=8388609)break b;w=c[t>>2]|0;A=w>>>23;if((A|0)==255)c[L>>2]=(c[L>>2]|0)+1;else{z=w>>>31;v=c[N>>2]|0;if((v|0)>-1){w=c[O>>2]|0;if((w+(c[P>>2]|0)|0)>>>0<(c[Q>>2]|0)>>>0){c[O>>2]=w+1;a[(c[o>>2]|0)+w>>0]=v+z;v=0}else v=-1;c[R>>2]=c[R>>2]|v}v=c[L>>2]|0;if(v|0){z=z+255&255;do{w=c[O>>2]|0;if((w+(c[P>>2]|0)|0)>>>0<(c[Q>>2]|0)>>>0){c[O>>2]=w+1;a[(c[o>>2]|0)+w>>0]=z;w=0;v=c[L>>2]|0}else w=-1;c[R>>2]=c[R>>2]|w;v=v+-1|0;c[L>>2]=v}while((v|0)!=0)}c[N>>2]=A&255;w=c[t>>2]|0;z=c[Y>>2]|0;v=c[X>>2]|0}c[t>>2]=w<<8&2147483392;z=z<<8;c[Y>>2]=z;v=v+8|0;c[X>>2]=v}}while(0);y=+(u|0);g[n+(V+(_(q,c[W>>2]|0)|0)<<2)>>2]=J-y;H=H-u|0;l=l+((H|0)>-1?H:0-H|0)|0;g[j+(V+(_(q,c[W>>2]|0)|0)<<2)>>2]=K+I+y;g[r>>2]=I+y-ba*y;q=q+1|0}while((q|0)<(p|0));V=V+1|0}i=da;return (b?l:0)|0}function sd(e,f,g,h,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x){e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;k=k|0;l=l|0;m=m|0;n=n|0;o=o|0;p=p|0;q=q|0;r=r|0;s=s|0;t=t|0;u=u|0;v=v|0;w=w|0;x=x|0;var y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,$=0,ba=0,ca=0,da=0;da=i;n=(n|0)>0?n:0;G=c[e+8>>2]|0;P=(n|0)>7?8:0;n=n-P|0;ca=(s|0)==2;if(ca?(y=d[29348+(g-f)>>0]|0,(n|0)>=(y|0)):0){n=n-y|0;V=(n|0)>7?8:0;n=n-V|0}else{V=0;y=0}L=i;i=i+((1*(G<<2)|0)+15&-16)|0;M=i;i=i+((1*(G<<2)|0)+15&-16)|0;O=i;i=i+((1*(G<<2)|0)+15&-16)|0;K=i;i=i+((1*(G<<2)|0)+15&-16)|0;$=s<<3;ba=e+32|0;k=k+-5-t|0;z=t+3|0;A=f;while(1){if((A|0)>=(g|0))break;Y=A+1|0;X=c[ba>>2]|0;X=(b[X+(Y<<1)>>1]|0)-(b[X+(A<<1)>>1]|0)|0;W=X*3<>4;c[O+(A<<2)>>2]=($|0)>(W|0)?$:W;W=(_(_(_(X,s)|0,k)|0,g-A+-1|0)|0)<>6;c[K+(A<<2)>>2]=W-((X<>2]|0;I=e+52|0;F=H+-1|0;J=1;do{C=J+F>>1;D=_(C,G)|0;E=0;k=g;z=0;a:while(1){b:while(1){B=k;do{k=B;B=B+-1|0;if((k|0)<=(f|0))break a;Y=c[ba>>2]|0;k=_((b[Y+(k<<1)>>1]|0)-(b[Y+(B<<1)>>1]|0)|0,s)|0;k=(_(k,d[(c[I>>2]|0)+(D+B)>>0]|0)|0)<>2;if((k|0)>0){k=k+(c[K+(B<<2)>>2]|0)|0;k=(k|0)<0?0:k}A=k+(c[h+(B<<2)>>2]|0)|0;if((A|0)>=(c[O+(B<<2)>>2]|0)|E)break b}while((A|0)<($|0));k=B;z=z+$|0}Y=c[j+(B<<2)>>2]|0;E=1;k=B;z=z+((A|0)<(Y|0)?A:Y)|0}Y=(z|0)>(n|0);J=Y?J:C+1|0;F=Y?C+-1|0:F}while((J|0)<=(F|0));F=_(J+-1|0,G)|0;B=_(J,G)|0;C=(J|0)>1;E=f;N=f;while(1){if((E|0)>=(g|0))break;D=E+1|0;k=c[ba>>2]|0;k=_((b[k+(D<<1)>>1]|0)-(b[k+(E<<1)>>1]|0)|0,s)|0;z=c[I>>2]|0;A=(_(k,d[z+(F+E)>>0]|0)|0)<>2;if((J|0)<(H|0))k=(_(k,d[z+(B+E)>>0]|0)|0)<>2;else k=c[j+(E<<2)>>2]|0;if((A|0)>0){z=A+(c[K+(E<<2)>>2]|0)|0;z=(z|0)<0?0:z}else z=A;if((k|0)>0){k=k+(c[K+(E<<2)>>2]|0)|0;k=(k|0)<0?0:k}Y=c[h+(E<<2)>>2]|0;X=z+(C?Y:0)|0;W=k+Y|0;Y=(Y|0)>0?E:N;c[L+(E<<2)>>2]=X;c[M+(E<<2)>>2]=(W|0)<(X|0)?0:W-X|0;E=D;N=Y}W=(s|0)>1;Y=W&1;D=64;E=0;F=0;while(1){if((E|0)==6)break;B=F+D>>1;C=0;k=g;z=0;c:while(1){d:while(1){do{X=k;k=k+-1|0;if((X|0)<=(f|0))break c;A=(c[L+(k<<2)>>2]|0)+((_(B,c[M+(k<<2)>>2]|0)|0)>>6)|0;if((A|0)>=(c[O+(k<<2)>>2]|0)|C)break d}while((A|0)<($|0));z=z+$|0}X=c[j+(k<<2)>>2]|0;C=1;z=z+((A|0)<(X|0)?A:X)|0}X=(z|0)>(n|0);D=X?B:D;E=E+1|0;F=X?F:B}X=t<<3;z=0;A=g;B=0;while(1){k=A+-1|0;if((A|0)<=(f|0))break;T=(c[L+(k<<2)>>2]|0)+((_(F,c[M+(k<<2)>>2]|0)|0)>>6)|0;A=(z|0)==0?(T|0)<(c[O+(k<<2)>>2]|0):0;T=A?((T|0)<($|0)?0:$):T;U=c[j+(k<<2)>>2]|0;U=(T|0)<(U|0)?T:U;c[p+(k<<2)>>2]=U;z=A&1^1;A=k;B=B+U|0}H=$+8|0;I=(v|0)==0;M=u+28|0;v=u+32|0;Q=u+20|0;R=u+40|0;S=u+24|0;T=u+4|0;G=f+2|0;J=u+36|0;K=u+8|0;h=u+44|0;U=g;L=B;e:while(1){E=U+-1|0;if((E|0)<=(N|0)){Z=45;break}C=n-L|0;k=c[ba>>2]|0;F=b[k+(U<<1)>>1]|0;A=b[k+(f<<1)>>1]|0;z=F-A|0;D=(C>>>0)/(z>>>0)|0;z=C-(_(z,D)|0)|0;k=b[k+(E<<1)>>1]|0;A=z+(A-k)|0;k=F-k|0;F=p+(E<<2)|0;z=c[F>>2]|0;A=z+(_(D,k)|0)+((A|0)>0?A:0)|0;D=c[O+(E<<2)>>2]|0;if((A|0)<(((D|0)>(H|0)?D:H)|0)){B=z;z=L}else{f:do if(I){k=c[M>>2]|0;B=c[v>>2]|0;z=k>>>1;D=B>>>0>>0;if(D)k=B;else{C=B-z|0;c[v>>2]=C;z=k-z|0;k=C}c[M>>2]=z;while(1){if(z>>>0>=8388609)break;c[Q>>2]=(c[Q>>2]|0)+8;z=z<<8;c[M>>2]=z;C=c[R>>2]|0;B=c[S>>2]|0;if(B>>>0<(c[T>>2]|0)>>>0){c[S>>2]=B+1;B=d[(c[u>>2]|0)+B>>0]|0}else B=0;c[R>>2]=B;C=((C<<8|B)>>>1&255|k<<8&2147483392)^255;c[v>>2]=C;k=C}if(D)break e}else{if((U|0)<=(G|0)){Z=50;break e}if(!((E|0)>(x|0)?1:(A|0)<=((_((U|0)<=(w|0)?7:9,k)|0)<>4|0))){Z=50;break e}k=c[M>>2]|0;k=k-(k>>>1)|0;c[M>>2]=k;while(1){if(k>>>0>=8388609)break f;z=c[v>>2]|0;C=z>>>23;if((C|0)==255)c[J>>2]=(c[J>>2]|0)+1;else{B=z>>>31;k=c[R>>2]|0;if((k|0)>-1){z=c[S>>2]|0;if((z+(c[K>>2]|0)|0)>>>0<(c[T>>2]|0)>>>0){c[S>>2]=z+1;a[(c[u>>2]|0)+z>>0]=k+B;k=0}else k=-1;c[h>>2]=c[h>>2]|k}k=c[J>>2]|0;if(k|0){B=B+255&255;do{z=c[S>>2]|0;if((z+(c[K>>2]|0)|0)>>>0<(c[T>>2]|0)>>>0){c[S>>2]=z+1;a[(c[u>>2]|0)+z>>0]=B;z=0;k=c[J>>2]|0}else z=-1;c[h>>2]=c[h>>2]|z;k=k+-1|0;c[J>>2]=k}while((k|0)!=0)}c[R>>2]=C&255;z=c[v>>2]|0;k=c[M>>2]|0}c[v>>2]=z<<8&2147483392;k=k<<8;c[M>>2]=k;c[Q>>2]=(c[Q>>2]|0)+8}}while(0);B=c[F>>2]|0;A=A+-8|0;z=L+8|0}if((y|0)>0)k=d[29348+(E-f)>>0]|0;else k=y;U=(A|0)<($|0);L=z-(B+y)+k+(U?0:$)|0;c[F>>2]=U?0:$;y=k;U=E}g:do if((Z|0)==45)n=n+P|0;else if((Z|0)==50){z=c[M>>2]|0;k=z>>>1;z=(c[v>>2]|0)+(z-k)|0;c[v>>2]=z;c[M>>2]=k;while(1){if(k>>>0>=8388609)break g;B=z>>>23;if((B|0)==255)c[J>>2]=(c[J>>2]|0)+1;else{A=z>>>31;k=c[R>>2]|0;if((k|0)>-1){z=c[S>>2]|0;if((z+(c[K>>2]|0)|0)>>>0<(c[T>>2]|0)>>>0){c[S>>2]=z+1;a[(c[u>>2]|0)+z>>0]=k+A;k=0}else k=-1;c[h>>2]=c[h>>2]|k}k=c[J>>2]|0;if(k|0){A=A+255&255;do{z=c[S>>2]|0;if((z+(c[K>>2]|0)|0)>>>0<(c[T>>2]|0)>>>0){c[S>>2]=z+1;a[(c[u>>2]|0)+z>>0]=A;z=0;k=c[J>>2]|0}else z=-1;c[h>>2]=c[h>>2]|z;k=k+-1|0;c[J>>2]=k}while((k|0)!=0)}c[R>>2]=B&255;z=c[v>>2]|0;k=c[M>>2]|0}z=z<<8&2147483392;c[v>>2]=z;k=k<<8;c[M>>2]=k;c[Q>>2]=(c[Q>>2]|0)+8}}while(0);h:do if((y|0)>0){if(I){c[l>>2]=(bd(u,U+1-f|0)|0)+f;break}z=c[l>>2]|0;z=(z|0)<(U|0)?z:U;c[l>>2]=z;C=z-f|0;A=U+1-f|0;k=A+-1|0;y=32-(aa(k|0)|0)|0;if((y|0)<=8){k=c[M>>2]|0;y=(k>>>0)/(A>>>0)|0;if((z|0)==(f|0))y=k-(_(y,A-(C+1)|0)|0)|0;else{x=k-(_(y,A-C|0)|0)|0;c[v>>2]=(c[v>>2]|0)+x}c[M>>2]=y;while(1){if(y>>>0>=8388609)break h;k=c[v>>2]|0;A=k>>>23;if((A|0)==255)c[J>>2]=(c[J>>2]|0)+1;else{z=k>>>31;y=c[R>>2]|0;if((y|0)>-1){k=c[S>>2]|0;if((k+(c[K>>2]|0)|0)>>>0<(c[T>>2]|0)>>>0){c[S>>2]=k+1;a[(c[u>>2]|0)+k>>0]=y+z;y=0}else y=-1;c[h>>2]=c[h>>2]|y}y=c[J>>2]|0;if(y|0){z=z+255&255;do{k=c[S>>2]|0;if((k+(c[K>>2]|0)|0)>>>0<(c[T>>2]|0)>>>0){c[S>>2]=k+1;a[(c[u>>2]|0)+k>>0]=z;k=0;y=c[J>>2]|0}else k=-1;c[h>>2]=c[h>>2]|k;y=y+-1|0;c[J>>2]=y}while((y|0)!=0)}c[R>>2]=A&255;k=c[v>>2]|0;y=c[M>>2]|0}c[v>>2]=k<<8&2147483392;y=y<<8;c[M>>2]=y;c[Q>>2]=(c[Q>>2]|0)+8}}G=y+-8|0;k=k>>>G;z=k+1|0;A=C>>>G;B=c[M>>2]|0;y=(B>>>0)/(z>>>0)|0;if(!A)y=B-(_(y,k)|0)|0;else{x=B-(_(y,z-A|0)|0)|0;c[v>>2]=(c[v>>2]|0)+x}c[M>>2]=y;while(1){if(y>>>0>=8388609)break;k=c[v>>2]|0;A=k>>>23;if((A|0)==255)c[J>>2]=(c[J>>2]|0)+1;else{z=k>>>31;y=c[R>>2]|0;if((y|0)>-1){k=c[S>>2]|0;if((k+(c[K>>2]|0)|0)>>>0<(c[T>>2]|0)>>>0){c[S>>2]=k+1;a[(c[u>>2]|0)+k>>0]=y+z;y=0}else y=-1;c[h>>2]=c[h>>2]|y}y=c[J>>2]|0;if(y|0){z=z+255&255;do{k=c[S>>2]|0;if((k+(c[K>>2]|0)|0)>>>0<(c[T>>2]|0)>>>0){c[S>>2]=k+1;a[(c[u>>2]|0)+k>>0]=z;k=0;y=c[J>>2]|0}else k=-1;c[h>>2]=c[h>>2]|k;y=y+-1|0;c[J>>2]=y}while((y|0)!=0)}c[R>>2]=A&255;k=c[v>>2]|0;y=c[M>>2]|0}c[v>>2]=k<<8&2147483392;y=y<<8;c[M>>2]=y;c[Q>>2]=(c[Q>>2]|0)+8}D=(1<>2]|0;F=u+16|0;k=c[F>>2]|0;if((k+G|0)>>>0>32){B=7-k|0;B=k+((B|0)>-8?B:-8)&-8;C=k;do{z=c[K>>2]|0;A=c[T>>2]|0;if(((c[S>>2]|0)+z|0)>>>0>>0){z=z+1|0;c[K>>2]=z;a[(c[u>>2]|0)+(A-z)>>0]=y;z=0}else z=-1;c[h>>2]=c[h>>2]|z;y=y>>>8;C=C+-8|0}while((C|0)>7);k=k+-8-B|0}c[E>>2]=y|D<>2]=k+G;c[Q>>2]=(c[Q>>2]|0)+G}else c[l>>2]=0;while(0);i:do if((c[l>>2]|0)>(f|0))if(!V)Z=169;else{if(I){y=c[M>>2]|0;z=c[v>>2]|0;k=y>>>1;V=z>>>0>>0;B=V&1;if(V)y=z;else{V=z-k|0;c[v>>2]=V;k=y-k|0;y=V}c[M>>2]=k;while(1){if(k>>>0>=8388609)break;c[Q>>2]=(c[Q>>2]|0)+8;k=k<<8;c[M>>2]=k;A=c[R>>2]|0;z=c[S>>2]|0;if(z>>>0<(c[T>>2]|0)>>>0){c[S>>2]=z+1;z=d[(c[u>>2]|0)+z>>0]|0}else z=0;c[R>>2]=z;V=((A<<8|z)>>>1&255|y<<8&2147483392)^255;c[v>>2]=V;y=V}c[m>>2]=B;break}k=c[M>>2]|0;y=k>>>1;k=k-y|0;if(!(c[m>>2]|0))y=k;else c[v>>2]=(c[v>>2]|0)+k;c[M>>2]=y;while(1){if(y>>>0>=8388609)break i;k=c[v>>2]|0;A=k>>>23;if((A|0)==255)c[J>>2]=(c[J>>2]|0)+1;else{z=k>>>31;y=c[R>>2]|0;if((y|0)>-1){k=c[S>>2]|0;if((k+(c[K>>2]|0)|0)>>>0<(c[T>>2]|0)>>>0){c[S>>2]=k+1;a[(c[u>>2]|0)+k>>0]=y+z;y=0}else y=-1;c[h>>2]=c[h>>2]|y}y=c[J>>2]|0;if(y|0){z=z+255&255;do{k=c[S>>2]|0;if((k+(c[K>>2]|0)|0)>>>0<(c[T>>2]|0)>>>0){c[S>>2]=k+1;a[(c[u>>2]|0)+k>>0]=z;k=0;y=c[J>>2]|0}else k=-1;c[h>>2]=c[h>>2]|k;y=y+-1|0;c[J>>2]=y}while((y|0)!=0)}c[R>>2]=A&255;k=c[v>>2]|0;y=c[M>>2]|0}c[v>>2]=k<<8&2147483392;y=y<<8;c[M>>2]=y;c[Q>>2]=(c[Q>>2]|0)+8}}else{n=n+V|0;Z=169}while(0);if((Z|0)==169)c[m>>2]=0;k=n-L|0;z=c[ba>>2]|0;z=(b[z+(U<<1)>>1]|0)-(b[z+(f<<1)>>1]|0)|0;n=(k>>>0)/(z>>>0)|0;z=_(z,n)|0;y=f;while(1){if((y|0)>=(U|0))break;Z=y+1|0;V=c[ba>>2]|0;V=_(n,(b[V+(Z<<1)>>1]|0)-(b[V+(y<<1)>>1]|0)|0)|0;u=p+(y<<2)|0;c[u>>2]=(c[u>>2]|0)+V;y=Z}y=f;n=k-z|0;while(1){if((y|0)>=(U|0))break;u=y+1|0;Z=c[ba>>2]|0;Z=(b[Z+(u<<1)>>1]|0)-(b[Z+(y<<1)>>1]|0)|0;Z=(n|0)<(Z|0)?n:Z;V=p+(y<<2)|0;c[V>>2]=(c[V>>2]|0)+Z;y=u;n=n-Z|0}H=e+56|0;F=W?4:3;G=0;while(1){if((f|0)>=(U|0))break;E=f+1|0;A=c[ba>>2]|0;A=(b[A+(E<<1)>>1]|0)-(b[A+(f<<1)>>1]|0)<>2]|0)+G|0;if((A|0)>1){n=c[j+(f<<2)>>2]|0;n=(y|0)>(n|0)?y-n|0:0;B=y-n|0;c[D>>2]=B;y=_(A,s)|0;if(ca&(A|0)>2?(c[m>>2]|0)==0:0)k=(f|0)<(c[l>>2]|0);else k=0;C=y+(k&1)|0;z=_(C,(b[(c[H>>2]|0)+(f<<1)>>1]|0)+X|0)|0;y=(z>>1)+(_(C,-21)|0)|0;if((A|0)==2)y=y+(C<<3>>2)|0;k=B+y|0;if((k|0)>=(C<<4|0))if((k|0)<(C*24|0))A=y+(z>>3)|0;else A=y;else A=y+(z>>2)|0;y=B+A+(C<<2)|0;y=((((y|0)<0?0:y)>>>0)/(C>>>0)|0)>>>3;z=q+(f<<2)|0;c[z>>2]=y;e=_(y,s)|0;k=c[D>>2]|0;if((e|0)>(k>>3|0)){y=k>>Y>>3;c[z>>2]=y}e=(y|0)<8?y:8;c[z>>2]=e;e=_(e,C<<3)|0;c[r+(f<<2)>>2]=(e|0)>=((c[D>>2]|0)+A|0)&1;e=(_(c[z>>2]|0,s)|0)<<3;c[D>>2]=(c[D>>2]|0)-e}else{n=(y|0)<($|0)?0:y-$|0;c[D>>2]=y-n;c[q+(f<<2)>>2]=0;c[r+(f<<2)>>2]=1}if((n|0)<=0){G=n;f=E;continue}W=n>>F;Z=q+(f<<2)|0;u=c[Z>>2]|0;e=8-u|0;e=(W|0)<(e|0)?W:e;c[Z>>2]=u+e;e=(_(e,s)|0)<<3;c[r+(f<<2)>>2]=(e|0)>=(n-G|0)&1;G=n-e|0;f=E}c[o>>2]=G;while(1){if((f|0)>=(g|0))break;m=p+(f<<2)|0;l=q+(f<<2)|0;c[l>>2]=c[m>>2]>>Y>>3;c[m>>2]=0;c[r+(f<<2)>>2]=(c[l>>2]|0)<1&1;f=f+1|0}i=da;return U|0}function td(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,h=0.0,j=0.0,k=0.0,l=0,m=0.0,n=0.0,o=0.0,p=0,q=0,r=0,s=0,t=0;t=i;r=i;i=i+((1*(e<<2)|0)+15&-16)|0;s=i;i=i+((1*(e<<2)|0)+15&-16)|0;f=0;do{q=a+(f<<2)|0;o=+g[q>>2];c[s+(f<<2)>>2]=o<0.0&1;g[q>>2]=+N(+o);c[b+(f<<2)>>2]=0;g[r+(f<<2)>>2]=0.0;f=f+1|0}while((f|0)<(e|0));if((e>>1|0)<(d|0)){f=0;h=0.0;do{h=h+ +g[a+(f<<2)>>2];f=f+1|0}while((f|0)<(e|0));if(!(h>1.0000000036274937e-15&h<64.0)){g[a>>2]=1.0;f=1;do{g[a+(f<<2)>>2]=0.0;f=f+1|0}while((f|0)<(e|0));h=1.0}k=(+(d|0)+.8)*(1.0/h);l=0;f=d;j=0.0;h=0.0;do{p=a+(l<<2)|0;q=~~+M(+(k*+g[p>>2]));c[b+(l<<2)>>2]=q;o=+(q|0);h=h+o*o;j=j+ +g[p>>2]*o;g[r+(l<<2)>>2]=o*2.0;f=f-q|0;l=l+1|0}while((l|0)<(e|0))}else{f=d;j=0.0;h=0.0}if((f|0)>(e+3|0)){o=+(f|0);h=h+o*o+o*+g[r>>2];c[b>>2]=(c[b>>2]|0)+f;f=0}q=0;while(1){if((q|0)>=(f|0)){f=0;break}h=h+1.0;o=j+ +g[a>>2];n=h+ +g[r>>2];l=0;o=o*o;p=1;while(1){m=j+ +g[a+(p<<2)>>2];k=h+ +g[r+(p<<2)>>2];m=m*m;d=n*m>k*o;l=d?p:l;p=p+1|0;if((p|0)>=(e|0))break;else{n=d?k:n;o=d?m:o}}n=+g[a+(l<<2)>>2];p=r+(l<<2)|0;o=+g[p>>2];g[p>>2]=o+2.0;p=b+(l<<2)|0;c[p>>2]=(c[p>>2]|0)+1;q=q+1|0;j=j+n;h=h+o}do{a=b+(f<<2)|0;r=c[s+(f<<2)>>2]|0;c[a>>2]=(c[a>>2]^0-r)+r;f=f+1|0}while((f|0)<(e|0));i=t;return +h} - function ud(b,d,e,f,h,j,k,l){b=b|0;d=d|0;e=e|0;f=f|0;h=h|0;j=j|0;k=+k;l=l|0;var m=0,n=0.0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0;E=i;D=i;i=i+((1*(d+3<<2)|0)+15&-16)|0;vd(b,d,1,h,e,f);n=+td(b,D,e,d);p=d+-1|0;r=c[D+(p<<2)>>2]|0;m=r>>>31;r=(r|0)>-1?r:0-r|0;while(1){q=p;p=p+-1|0;o=d-p|0;m=m+(c[(c[17748+(((o|0)<(r|0)?o:r)<<2)>>2]|0)+(((o|0)>(r|0)?o:r)<<2)>>2]|0)|0;C=c[D+(p<<2)>>2]|0;r=r+((C|0)>-1?C:0-C|0)|0;if((C|0)<0){B=r+1|0;B=m+(c[(c[17748+(((o|0)>(r|0)?B:o)<<2)>>2]|0)+(((o|0)>(B|0)?o:B)<<2)>>2]|0)|0}else B=m;if((q|0)<=1)break;else m=B}o=(d|0)>(e|0);p=e+1|0;p=(c[(c[17748+(((d|0)<(e|0)?d:e)<<2)>>2]|0)+((o?d:e)<<2)>>2]|0)+(c[(c[17748+((o?p:d)<<2)>>2]|0)+(((p|0)<(d|0)?d:p)<<2)>>2]|0)|0;o=p+-1|0;m=32-(aa(o|0)|0)|0;a:do if((m|0)>8){C=m+-8|0;m=o>>>C;o=m+1|0;p=B>>>C;v=j+28|0;q=c[v>>2]|0;r=(q>>>0)/(o>>>0)|0;if(!p){r=q-(_(r,m)|0)|0;c[v>>2]=r;u=j+32|0}else{A=q-(_(r,o-p|0)|0)|0;u=j+32|0;c[u>>2]=(c[u>>2]|0)+A;c[v>>2]=r}s=j+36|0;A=j+20|0;t=j+40|0;w=j+24|0;x=j+8|0;y=j+4|0;z=j+44|0;while(1){if(r>>>0>=8388609)break;m=c[u>>2]|0;q=m>>>23;if((q|0)==255)c[s>>2]=(c[s>>2]|0)+1;else{p=m>>>31;m=c[t>>2]|0;if((m|0)>-1){o=c[w>>2]|0;if((o+(c[x>>2]|0)|0)>>>0<(c[y>>2]|0)>>>0){c[w>>2]=o+1;a[(c[j>>2]|0)+o>>0]=m+p;m=0}else m=-1;c[z>>2]=c[z>>2]|m}m=c[s>>2]|0;if(m|0){p=p+255&255;do{o=c[w>>2]|0;if((o+(c[x>>2]|0)|0)>>>0<(c[y>>2]|0)>>>0){c[w>>2]=o+1;a[(c[j>>2]|0)+o>>0]=p;o=0;m=c[s>>2]|0}else o=-1;c[z>>2]=c[z>>2]|o;m=m+-1|0;c[s>>2]=m}while((m|0)!=0)}c[t>>2]=q&255;m=c[u>>2]|0;r=c[v>>2]|0}c[u>>2]=m<<8&2147483392;r=r<<8;c[v>>2]=r;c[A>>2]=(c[A>>2]|0)+8}t=(1<>2]|0;v=j+16|0;o=c[v>>2]|0;if((o+C|0)>>>0>32){r=7-o|0;r=o+((r|0)>-8?r:-8)&-8;s=o;do{p=c[x>>2]|0;q=c[y>>2]|0;if(((c[w>>2]|0)+p|0)>>>0>>0){p=p+1|0;c[x>>2]=p;a[(c[j>>2]|0)+(q-p)>>0]=m;p=0}else p=-1;c[z>>2]=c[z>>2]|p;m=m>>>8;s=s+-8|0}while((s|0)>7);o=o+-8-r|0}c[u>>2]=m|t<>2]=o+C;c[A>>2]=(c[A>>2]|0)+C}else{z=j+28|0;m=c[z>>2]|0;o=(m>>>0)/(p>>>0)|0;if(!B){o=m-(_(o,p+-1|0)|0)|0;c[z>>2]=o;y=j+32|0}else{C=m-(_(o,p-B|0)|0)|0;y=j+32|0;c[y>>2]=(c[y>>2]|0)+C;c[z>>2]=o}r=j+36|0;s=j+20|0;t=j+40|0;u=j+24|0;v=j+8|0;w=j+4|0;x=j+44|0;while(1){if(o>>>0>=8388609)break a;m=c[y>>2]|0;q=m>>>23;if((q|0)==255)c[r>>2]=(c[r>>2]|0)+1;else{p=m>>>31;m=c[t>>2]|0;if((m|0)>-1){o=c[u>>2]|0;if((o+(c[v>>2]|0)|0)>>>0<(c[w>>2]|0)>>>0){c[u>>2]=o+1;a[(c[j>>2]|0)+o>>0]=m+p;m=0}else m=-1;c[x>>2]=c[x>>2]|m}m=c[r>>2]|0;if(m|0){p=p+255&255;do{o=c[u>>2]|0;if((o+(c[v>>2]|0)|0)>>>0<(c[w>>2]|0)>>>0){c[u>>2]=o+1;a[(c[j>>2]|0)+o>>0]=p;o=0;m=c[r>>2]|0}else o=-1;c[x>>2]=c[x>>2]|o;m=m+-1|0;c[r>>2]=m}while((m|0)!=0)}c[t>>2]=q&255;m=c[y>>2]|0;o=c[z>>2]|0}c[y>>2]=m<<8&2147483392;o=o<<8;c[z>>2]=o;c[s>>2]=(c[s>>2]|0)+8}}while(0);if(l|0){n=1.0/+O(+n)*k;m=0;do{g[b+(m<<2)>>2]=n*+(c[D+(m<<2)>>2]|0);m=m+1|0}while((m|0)<(d|0));vd(b,d,-1,h,e,f)}if((h|0)<2){h=1;i=E;return h|0}r=(d>>>0)/(h>>>0)|0;m=0;s=0;do{o=_(s,r)|0;p=0;q=0;do{q=q|c[D+(o+p<<2)>>2];p=p+1|0}while((p|0)<(r|0));m=m|((q|0)!=0&1)<=(b|0)|(h|0)==0)return;v=+(b|0)/+((_(c[17352+(h+-1<<2)>>2]|0,f)|0)+b|0);v=v*v*.5;u=+Q(+(v*1.5707963705062866));v=+Q(+((1.0-v)*1.5707963705062866));a:do if((e<<3|0)>(b|0))h=0;else{f=e>>2;h=1;while(1){if(((_((_(h,h)|0)+h|0,e)|0)+f|0)>=(b|0))break a;h=h+1|0}}while(0);t=(b>>>0)/(e>>>0)|0;i=(d|0)<0;j=(h|0)==0;k=-v;l=t+-1|0;m=t+-3|0;n=t+-2|0;o=-u;p=t-h|0;q=t-(h<<1)|0;r=q+-1|0;s=0;while(1){if((s|0)>=(e|0))break;d=a+((_(s,t)|0)<<2)|0;b:do if(!i){f=d;b=0;while(1){if((b|0)>=(l|0))break;y=+g[f>>2];w=f+4|0;x=+g[w>>2];g[w>>2]=x*u+y*k;g[f>>2]=y*u+x*v;f=w;b=b+1|0}f=d+(m<<2)|0;b=n;while(1){if((b|0)<=0)break;x=+g[f>>2];w=f+4|0;y=+g[w>>2];g[w>>2]=y*u+x*k;g[f>>2]=x*u+y*v;f=f+-4|0;b=b+-1|0}if(!j){f=d;b=0;while(1){if((b|0)>=(p|0))break;x=+g[f>>2];w=f+(h<<2)|0;y=+g[w>>2];g[w>>2]=y*v+x*o;g[f>>2]=x*v+y*u;f=f+4|0;b=b+1|0}f=d+(r<<2)|0;b=q;while(1){if((b|0)<=0)break b;x=+g[f>>2];w=f+(h<<2)|0;y=+g[w>>2];g[w>>2]=y*v+x*o;g[f>>2]=x*v+y*u;f=f+-4|0;b=b+-1|0}}}else{c:do if(j){f=d;b=0}else{f=d;b=0;while(1){if((b|0)>=(p|0))break;x=+g[f>>2];w=f+(h<<2)|0;y=+g[w>>2];g[w>>2]=y*v+x*u;g[f>>2]=x*v+y*o;f=f+4|0;b=b+1|0}f=d+(r<<2)|0;b=q;while(1){if((b|0)<=0){f=d;b=0;break c}x=+g[f>>2];w=f+(h<<2)|0;y=+g[w>>2];g[w>>2]=y*v+x*u;g[f>>2]=x*v+y*o;f=f+-4|0;b=b+-1|0}}while(0);while(1){if((b|0)>=(l|0))break;x=+g[f>>2];w=f+4|0;y=+g[w>>2];g[w>>2]=y*u+x*v;g[f>>2]=x*u+y*k;f=w;b=b+1|0}f=d+(m<<2)|0;b=n;while(1){if((b|0)<=0)break b;x=+g[f>>2];w=f+4|0;y=+g[w>>2];g[w>>2]=y*u+x*v;g[f>>2]=x*u+y*k;f=f+-4|0;b=b+-1|0}}while(0);s=s+1|0}return}function wd(a,b,d,e,f,h,j){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;h=h|0;j=+j;var k=0.0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0.0,w=0.0;u=i;t=i;i=i+((1*(b<<2)|0)+15&-16)|0;s=(b|0)>(d|0);o=d+1|0;q=b;r=d;o=bd(h,(c[(c[17748+(((b|0)<(d|0)?b:d)<<2)>>2]|0)+((s?b:d)<<2)>>2]|0)+(c[(c[17748+((s?o:b)<<2)>>2]|0)+(((o|0)<(b|0)?b:o)<<2)>>2]|0)|0)|0;s=t;k=0.0;while(1){if((q|0)<=2)break;do if((r|0)<(q|0)){h=c[(c[17748+(r<<2)>>2]|0)+(q<<2)>>2]|0;l=c[(c[17748+(r+1<<2)>>2]|0)+(q<<2)>>2]|0;if(o>>>0>=h>>>0&o>>>0>>0){c[s>>2]=0;l=o-h|0;h=r;break}n=o>>>0>=l>>>0;l=o-(n?l:0)|0;h=r;do{h=h+-1|0;m=c[(c[17748+(h<<2)>>2]|0)+(q<<2)>>2]|0}while(l>>>0>>0);p=n<<31>>31;r=r-h+p^p;c[s>>2]=r<<16>>16;v=+((r&65535)<<16>>16);l=l-m|0;k=k+v*v}else{m=c[17748+(q<<2)>>2]|0;n=c[m+(r+1<<2)>>2]|0;l=o>>>0>=n>>>0;p=l<<31>>31;n=o-(l?n:0)|0;a:do if((c[m+(q<<2)>>2]|0)>>>0>n>>>0){h=q;do{h=h+-1|0;l=c[(c[17748+(h<<2)>>2]|0)+(q<<2)>>2]|0}while(l>>>0>n>>>0)}else{h=r;while(1){l=c[m+(h<<2)>>2]|0;if(l>>>0<=n>>>0)break a;h=h+-1|0}}while(0);r=r-h+p^p;c[s>>2]=r<<16>>16;v=+((r&65535)<<16>>16);l=n-l|0;k=k+v*v}while(0);q=q+-1|0;r=h;o=l;s=s+4|0}h=r<<1|1;l=o>>>0>=h>>>0;m=l<<31>>31;h=o-(l?h:0)|0;l=(h+1|0)>>>1;if(l)h=h-((l<<1)+-1)|0;r=r-l+m^m;c[s>>2]=r<<16>>16;w=+((r&65535)<<16>>16);h=l-h^0-h;c[s+4>>2]=h<<16>>16;v=+((h&65535)<<16>>16);k=1.0/+O(+(k+w*w+v*v))*j;h=0;do{g[a+(h<<2)>>2]=k*+(c[t+(h<<2)>>2]|0);h=h+1|0}while((h|0)<(b|0));vd(a,b,-1,f,d,e);if((f|0)<2){f=1;i=u;return f|0}o=(b>>>0)/(f>>>0)|0;h=0;p=0;do{l=_(p,o)|0;m=0;n=0;do{n=n|c[t+(l+m<<2)>>2];m=m+1|0}while((m|0)<(o|0));h=h|((n|0)!=0&1)<>2]=0;c[M+4>>2]=0;M=g+4|0;a:do if(!j)j=c[M>>2]|0;else{n=0;while(1){j=c[M>>2]|0;if((n|0)>=(j|0))break a;c[f+(n*4260|0)+2388>>2]=0;n=n+1|0}}while(0);O=f+8536|0;if((j|0)>(c[O>>2]|0)){j=f+4260|0;nf(j|0,0,4260)|0;c[f+6636>>2]=1;c[j>>2]=65536;c[f+8408>>2]=0;c[f+8412>>2]=3176576;c[f+8428>>2]=c[f+6588>>2]<<7;c[f+8500>>2]=65536;c[f+8504>>2]=65536;c[f+8516>>2]=20;c[f+8512>>2]=2;j=c[M>>2]|0}if((j|0)==1?(c[O>>2]|0)==2:0)L=(c[g+12>>2]|0)==((c[f+2316>>2]|0)*1e3|0);else L=0;H=f+2388|0;b:do if(!(c[H>>2]|0)){x=g+16|0;y=g+12|0;z=g+8|0;w=0;A=0;c:while(1){if((w|0)>=(j|0))break b;switch(c[x>>2]|0){case 0:{c[f+(w*4260|0)+2392>>2]=1;c[f+(w*4260|0)+2324>>2]=2;j=2;break}case 10:{c[f+(w*4260|0)+2392>>2]=1;c[f+(w*4260|0)+2324>>2]=2;j=2;break}case 20:{c[f+(w*4260|0)+2392>>2]=1;c[f+(w*4260|0)+2324>>2]=4;j=4;break}case 40:{c[f+(w*4260|0)+2392>>2]=2;c[f+(w*4260|0)+2324>>2]=4;j=4;break}case 60:{c[f+(w*4260|0)+2392>>2]=3;c[f+(w*4260|0)+2324>>2]=4;j=4;break}default:{j=-203;B=183;break c}}s=c[y>>2]>>10;t=s+1|0;u=(t|0)==8;switch(s|0){case 7:case 11:case 15:break;default:{j=-200;B=183;break c}}o=c[z>>2]|0;v=t<<16>>16;c[f+(w*4260|0)+2332>>2]=v*5;p=f+(w*4260|0)+2324|0;q=_(j,v*327680>>16)|0;r=f+(w*4260|0)+2316|0;j=f+(w*4260|0)+2320|0;if((c[r>>2]|0)==(t|0)?(c[j>>2]|0)==(o|0):0){j=1;n=0;B=23}else{n=Hd(f+(w*4260|0)+2432|0,v*1e3|0,o,0)|0;c[j>>2]=o;j=(c[r>>2]|0)==(t|0);if(j)B=23;else B=24}if((B|0)==23){B=0;if((q|0)!=(c[f+(w*4260|0)+2328>>2]|0))B=24}if((B|0)==24){B=0;o=(c[p>>2]|0)==4;p=f+(w*4260|0)+2384|0;do if(u)if(o){c[p>>2]=30064;break}else{c[p>>2]=30087;break}else if(o){c[p>>2]=30030;break}else{c[p>>2]=30075;break}while(0);if(!j){c[f+(w*4260|0)+2336>>2]=v*20;switch(s|0){case 7:case 11:{c[f+(w*4260|0)+2340>>2]=10;c[f+(w*4260|0)+2732>>2]=22896;if((t|0)==12)c[f+(w*4260|0)+2380>>2]=29956;else B=37;break}default:{c[f+(w*4260|0)+2340>>2]=16;c[f+(w*4260|0)+2732>>2]=22936;if((t|0)==16)c[f+(w*4260|0)+2380>>2]=29962;else B=37}}if((B|0)==37?(0,u):0)c[f+(w*4260|0)+2380>>2]=29947;c[f+(w*4260|0)+2376>>2]=1;c[f+(w*4260|0)+2308>>2]=100;a[f+(w*4260|0)+2312>>0]=10;c[f+(w*4260|0)+4164>>2]=0;nf(f+(w*4260|0)+1284|0,0,1024)|0}c[r>>2]=t;c[f+(w*4260|0)+2328>>2]=q}j=c[M>>2]|0;w=w+1|0;A=A+n|0}if((B|0)==183){i=P;return j|0}}else A=0;while(0);n=c[g>>2]|0;do if((n|0)==2)if((j|0)==2){if((c[f+8532>>2]|0)!=1?(c[O>>2]|0)!=1:0){j=2;break}c[f+8520>>2]=0;c[f+8528>>2]=0;rf(f+6692|0,f+2432|0,300)|0;j=c[g>>2]|0}else j=2;else j=n;while(0);c[f+8532>>2]=j;c[O>>2]=c[M>>2];G=g+8|0;if(((c[G>>2]|0)+-8e3|0)>>>0>4e4){f=-200;i=P;return f|0}I=(h|0)==1;d:do if(!I?(c[H>>2]|0)==0:0){y=k+28|0;z=k+32|0;B=k+20|0;C=k+40|0;D=k+24|0;E=k+4|0;t=0;while(1){j=c[M>>2]|0;if((t|0)>=(j|0)){u=0;break}q=f+(t*4260|0)+2392|0;r=0;while(1){o=c[y>>2]|0;n=c[z>>2]|0;j=o>>>1;p=n>>>0>>0;s=p&1;if((r|0)>=(c[q>>2]|0))break;if(!p){n=n-j|0;c[z>>2]=n;j=o-j|0}c[y>>2]=j;while(1){if(j>>>0>=8388609)break;c[B>>2]=(c[B>>2]|0)+8;j=j<<8;c[y>>2]=j;p=c[C>>2]|0;o=c[D>>2]|0;if(o>>>0<(c[E>>2]|0)>>>0){c[D>>2]=o+1;o=d[(c[k>>2]|0)+o>>0]|0}else o=0;c[C>>2]=o;x=((p<<8|o)>>>1&255|n<<8&2147483392)^255;c[z>>2]=x;n=x}c[f+(t*4260|0)+2404+(r<<2)>>2]=s;r=r+1|0}if(!p){n=n-j|0;c[z>>2]=n;j=o-j|0}c[y>>2]=j;while(1){if(j>>>0>=8388609)break;c[B>>2]=(c[B>>2]|0)+8;j=j<<8;c[y>>2]=j;p=c[C>>2]|0;o=c[D>>2]|0;if(o>>>0<(c[E>>2]|0)>>>0){c[D>>2]=o+1;o=d[(c[k>>2]|0)+o>>0]|0}else o=0;c[C>>2]=o;x=((p<<8|o)>>>1&255|n<<8&2147483392)^255;c[z>>2]=x;n=x}c[f+(t*4260|0)+2416>>2]=s;t=t+1|0}while(1){if((u|0)>=(j|0))break;j=f+(u*4260|0)+2420|0;c[j>>2]=0;c[j+4>>2]=0;c[j+8>>2]=0;e:do if(c[f+(u*4260|0)+2416>>2]|0){t=f+(u*4260|0)+2392|0;n=c[t>>2]|0;if((n|0)==1){c[j>>2]=1;break}j=c[17520+(n+-2<<2)>>2]|0;r=c[y>>2]|0;n=c[z>>2]|0;o=r>>>8;s=-1;while(1){p=s+1|0;q=_(o,d[j+p>>0]|0)|0;if(n>>>0>>0){s=p;r=q}else break}p=n-q|0;c[z>>2]=p;j=r-q|0;c[y>>2]=j;while(1){if(j>>>0>=8388609)break;c[B>>2]=(c[B>>2]|0)+8;j=j<<8;c[y>>2]=j;o=c[C>>2]|0;n=c[D>>2]|0;if(n>>>0<(c[E>>2]|0)>>>0){c[D>>2]=n+1;n=d[(c[k>>2]|0)+n>>0]|0}else n=0;c[C>>2]=n;x=((o<<8|n)>>>1&255|p<<8&2147483392)^255;c[z>>2]=x;p=x}j=s+2|0;n=0;while(1){if((n|0)>=(c[t>>2]|0))break e;c[f+(u*4260|0)+2420+(n<<2)>>2]=j>>>n&1;n=n+1|0}}while(0);j=c[M>>2]|0;u=u+1|0}if(!h){w=f+2392|0;x=f+6680|0;n=0;v=0;while(1){if((v|0)>=(c[w>>2]|0))break d;s=x+(v<<2)|0;t=(v|0)>0;u=v+-1|0;r=0;while(1){if((r|0)>=(j|0))break;if(c[f+(r*4260|0)+2420+(v<<2)>>2]|0){f:do if((j|0)==2&(r|0)==0?(Md(k,K),(c[s>>2]|0)==0):0){q=c[y>>2]|0;j=c[z>>2]|0;o=q>>>8;n=-1;while(1){n=n+1|0;p=_(o,d[29916+n>>0]|0)|0;if(j>>>0>=p>>>0)break;else q=p}o=j-p|0;c[z>>2]=o;j=q-p|0;c[y>>2]=j;q=o;while(1){if(j>>>0>=8388609)break f;c[B>>2]=(c[B>>2]|0)+8;j=j<<8;c[y>>2]=j;p=c[C>>2]|0;o=c[D>>2]|0;if(o>>>0<(c[E>>2]|0)>>>0){c[D>>2]=o+1;o=d[(c[k>>2]|0)+o>>0]|0}else o=0;c[C>>2]=o;p=((p<<8|o)>>>1&255|q<<8&2147483392)^255;c[z>>2]=p;q=p}}while(0);if(t?(c[f+(r*4260|0)+2420+(u<<2)>>2]|0)!=0:0)j=2;else j=0;ee(f+(r*4260|0)|0,k,v,1,j);fe(k,F,a[f+(r*4260|0)+2765>>0]|0,a[f+(r*4260|0)+2766>>0]|0,c[f+(r*4260|0)+2328>>2]|0);j=c[M>>2]|0}r=r+1|0}v=v+1|0}}else n=0}else n=0;while(0);j=c[M>>2]|0;do if((j|0)==2){switch(h|0){case 0:{Md(k,K);if(!(c[f+6664+(c[H>>2]<<2)>>2]|0))B=112;else{n=0;B=121}break}case 2:{if((c[f+2420+(c[H>>2]<<2)>>2]|0)==1){Md(k,K);if(!(c[f+6680+(c[H>>2]<<2)>>2]|0))B=112;else{n=0;B=121}}else B=108;break}default:B=108}g:do if((B|0)==108){j=f+8520|0;o=0;while(1){if((o|0)==2)break g;c[K+(o<<2)>>2]=b[j+(o<<1)>>1];o=o+1|0}}else if((B|0)==112){v=k+28|0;q=c[v>>2]|0;w=k+32|0;j=c[w>>2]|0;o=q>>>8;n=-1;while(1){n=n+1|0;p=_(o,d[29916+n>>0]|0)|0;if(j>>>0>=p>>>0)break;else q=p}u=j-p|0;c[w>>2]=u;j=q-p|0;c[v>>2]=j;q=k+20|0;r=k+40|0;s=k+24|0;t=k+4|0;while(1){if(j>>>0>=8388609){B=121;break g}c[q>>2]=(c[q>>2]|0)+8;j=j<<8;c[v>>2]=j;p=c[r>>2]|0;o=c[s>>2]|0;if(o>>>0<(c[t>>2]|0)>>>0){c[s>>2]=o+1;o=d[(c[k>>2]|0)+o>>0]|0}else o=0;c[r>>2]=o;F=((p<<8|o)>>>1&255|u<<8&2147483392)^255;c[w>>2]=F;u=F}}while(0);if((B|0)==121){j=c[M>>2]|0;if((j|0)!=2)break}if((n|0)==0?(c[f+8540>>2]|0)==1:0){nf(f+5544|0,0,1024)|0;c[f+6568>>2]=100;a[f+6572>>0]=10;c[f+8424>>2]=0;c[f+6636>>2]=1;j=c[M>>2]|0}else j=2}while(0);C=_(c[g+12>>2]|0,j)|0;C=(C|0)<(_(c[G>>2]|0,c[g>>2]|0)|0);if(C){E=Fa()|0;c[N>>2]=l;B=l+(c[f+2328>>2]<<1)+4|0;c[N+4>>2]=B;q=l}else{B=f+2328|0;F=_(j,(c[B>>2]|0)+2|0)|0;E=Fa()|0;q=i;i=i+((1*(F<<1)|0)+15&-16)|0;c[N>>2]=q;B=q+(c[B>>2]<<1)+4|0;c[N+4>>2]=B}if(!h){D=f+8540|0;p=(n|0)==0&1}else{j=f+8540|0;if(c[j>>2]|0)if((c[M>>2]|0)==2&(h|0)==2)o=(c[f+6680+(c[f+6648>>2]<<2)>>2]|0)==1;else o=0;else o=1;D=j;p=o&1}o=(h|0)==2;r=0;while(1){j=c[M>>2]|0;if((r|0)>=(j|0))break;if((r|0)==0|(p|0)!=0){j=(c[H>>2]|0)-r|0;do if((j|0)<1)j=0;else{if(o){j=c[f+(r*4260|0)+2420+(j+-1<<2)>>2]|0?2:0;break}if((r|0)>0?c[D>>2]|0:0){j=1;break}j=2}while(0);j=A+(de(f+(r*4260|0)|0,k,(c[N+(r<<2)>>2]|0)+4|0,J,h,j)|0)|0}else{nf((c[N+(r<<2)>>2]|0)+4|0,0,c[J>>2]<<1|0)|0;j=A}A=f+(r*4260|0)+2388|0;c[A>>2]=(c[A>>2]|0)+1;r=r+1|0;A=j}h:do if((c[g>>2]|0)==2&(j|0)==2){x=f+8520|0;y=f+2316|0;j=c[y>>2]|0;z=c[J>>2]|0;v=f+8524|0;r=e[v>>1]|e[v+2>>1]<<16;b[q>>1]=r;b[q+2>>1]=r>>>16;r=f+8528|0;s=e[r>>1]|e[r+2>>1]<<16;b[B>>1]=s;b[B+2>>1]=s>>>16;s=q+(z<<1)|0;s=e[s>>1]|e[s+2>>1]<<16;b[v>>1]=s;b[v+2>>1]=s>>>16;v=B+(z<<1)|0;v=e[v>>1]|e[v+2>>1]<<16;b[r>>1]=v;b[r+2>>1]=v>>>16;r=b[x>>1]|0;v=f+8522|0;s=b[v>>1]|0;j=j<<3;w=c[K>>2]|0;o=(65536/(j|0)|0)<<16>>16;t=((_(w-(r&65535)<<16>>16,o)|0)>>15)+1>>1;u=c[K+4>>2]|0;o=((_(u-(s&65535)<<16>>16,o)|0)>>15)+1>>1;p=0;r=r<<16>>16;s=s<<16>>16;while(1){if((p|0)>=(j|0))break;J=r+t|0;K=s+o|0;k=p+1|0;F=b[q+(k<<1)>>1]|0;R=(b[q+(p<<1)>>1]|0)+(b[q+(p+2<<1)>>1]|0)+(F<<1)|0;h=B+(k<<1)|0;Q=J<<16>>16;H=K<<16>>16;H=((b[h>>1]<<8)+((_(R>>7,Q)|0)+((_(R<<9&65024,Q)|0)>>16))+((_(F>>5,H)|0)+((_(F<<11&63488,H)|0)>>16))>>7)+1>>1;b[h>>1]=(H|0)>32767?32767:((H|0)<-32768?-32768:H)&65535;p=k;r=J;s=K}o=w<<16>>16;p=u<<16>>16;while(1){if((j|0)>=(z|0))break;R=j+1|0;K=b[q+(R<<1)>>1]|0;J=(b[q+(j<<1)>>1]|0)+(b[q+(j+2<<1)>>1]|0)+(K<<1)|0;Q=B+(R<<1)|0;K=((b[Q>>1]<<8)+((_(J>>7,o)|0)+((_(J<<9&65024,o)|0)>>16))+((_(K>>5,p)|0)+((_(K<<11&63488,p)|0)>>16))>>7)+1>>1;b[Q>>1]=(K|0)>32767?32767:((K|0)<-32768?-32768:K)&65535;j=R}b[x>>1]=w;b[v>>1]=u;j=0;while(1){if((j|0)>=(z|0)){t=y;s=z;break h}R=j+1|0;J=q+(R<<1)|0;h=b[J>>1]|0;Q=B+(R<<1)|0;K=b[Q>>1]|0;k=h+K|0;K=h-K|0;b[J>>1]=(k|0)>32767?32767:((k|0)<-32768?-32768:k)&65535;b[Q>>1]=(K|0)>32767?32767:((K|0)<-32768?-32768:K)&65535;j=R}}else{t=f+8524|0;s=e[t>>1]|e[t+2>>1]<<16;b[q>>1]=s;b[q+2>>1]=s>>>16;s=c[J>>2]|0;q=c[N>>2]|0;R=q+(s<<1)|0;R=e[R>>1]|e[R+2>>1]<<16;b[t>>1]=R;b[t+2>>1]=R>>>16;t=f+2316|0}while(0);o=_(s,c[G>>2]|0)|0;o=(o|0)/((c[t>>2]<<16>>16)*1e3|0)|0;c[m>>2]=o;j=c[g>>2]|0;p=(j|0)==2;if(p){r=i;i=i+((1*((p?o:1)<<1)|0)+15&-16)|0}else r=l;if(C){R=c[f+2328>>2]|0;Q=_(c[M>>2]|0,R+2|0)|0;q=i;i=i+((1*(Q<<1)|0)+15&-16)|0;rf(q|0,l|0,Q<<1|0)|0;c[N>>2]=q;c[N+4>>2]=q+(R<<1)+4}p=0;while(1){o=c[M>>2]|0;if((p|0)>=(((j|0)<(o|0)?j:o)|0))break;Id(f+(p*4260|0)+2432|0,r,(c[N+(p<<2)>>2]|0)+2|0,s);j=c[g>>2]|0;if((j|0)==2){j=0;while(1){if((j|0)>=(c[m>>2]|0))break;b[l+(p+(j<<1)<<1)>>1]=b[r+(j<<1)>>1]|0;j=j+1|0}j=c[g>>2]|0}p=p+1|0}i:do if((j|0)==2&(o|0)==1){if(!L){j=0;while(1){if((j|0)>=(c[m>>2]|0))break i;R=j<<1;b[l+((R|1)<<1)>>1]=b[l+(R<<1)>>1]|0;j=j+1|0}}Id(f+6692|0,r,q+2|0,s);j=0;while(1){if((j|0)>=(c[m>>2]|0))break i;b[l+((j<<1|1)<<1)>>1]=b[r+(j<<1)>>1]|0;j=j+1|0}}while(0);if((c[f+4164>>2]|0)==2)j=_(c[f+2308>>2]|0,c[17364+((c[t>>2]|0)+-8>>2<<2)>>2]|0)|0;else j=0;c[g+20>>2]=j;j:do if(I){j=0;while(1){if((j|0)>=(c[O>>2]|0))break j;a[f+(j*4260|0)+2312>>0]=10;j=j+1|0}}else c[D>>2]=n;while(0);Na(E|0);R=A;i=P;return R|0}function yd(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0;nf(a|0,0,20400)|0;e=0;f=0;while(1){if((e|0)==2)break;g=f+(Fd(a+(e*10156|0)|0,b)|0)|0;e=e+1|0;f=g}c[a+20376>>2]=1;g=a+20380|0;c[g>>2]=1;c[d>>2]=1;c[d+4>>2]=c[g>>2];c[d+8>>2]=c[a+4648>>2];c[d+12>>2]=c[a+4656>>2];c[d+16>>2]=c[a+4660>>2];c[d+20>>2]=c[a+4664>>2];c[d+24>>2]=c[a+4704>>2];c[d+28>>2]=c[a+4700>>2];c[d+32>>2]=c[a+4708>>2];c[d+36>>2]=c[a+4716>>2];c[d+40>>2]=c[a+6180>>2];c[d+48>>2]=c[a+6168>>2];c[d+52>>2]=c[a+4768>>2];g=a+4668|0;c[d+72>>2]=(c[g>>2]<<16>>16)*1e3;c[d+76>>2]=c[a+4628>>2];if((c[g>>2]|0)!=16){e=0;e=e&1;g=d+80|0;c[g>>2]=e;return f|0}e=(c[a+28>>2]|0)==0;e=e&1;g=d+80|0;c[g>>2]=e;return f|0}function zd(f,g,h,j,k,l,m){f=f|0;g=g|0;h=h|0;j=j|0;k=k|0;l=l|0;m=m|0;var n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,$=0,ba=0,ca=0,da=0,ea=0,fa=0,ga=0,ha=0,ia=0,ja=0,ka=0,la=0,ma=0,na=0,oa=0,pa=0,qa=0,ra=0,sa=0,ta=0,ua=0,va=0,wa=0,xa=0,ya=0,za=0,Aa=0,Ba=0,Ca=0,Da=0,Ea=0,Ga=0,Ha=0,Ia=0,Ja=0,Ka=0,La=0,Ma=0,Oa=0,Pa=0,Qa=0,Ra=0,Sa=0,Ta=0,Ua=0,Va=0,Wa=0,Xa=0,Ya=0,Za=0,_a=0,$a=0,ab=0,bb=0,cb=0,db=0,eb=0,fb=0,gb=0,hb=0;hb=i;i=i+16|0;fb=hb;if(c[g+68>>2]|0){c[f+4756>>2]=1;c[f+14912>>2]=1}db=f+15996|0;c[db>>2]=0;eb=f+5840|0;c[eb>>2]=0;M=g+8|0;o=c[M>>2]|0;a:do if((o|0)<24e3){if((o|0)<12e3){switch(o|0){case 8e3:break a;default:n=-102}i=hb;return n|0}if((o|0)<16e3){switch(o|0){case 12e3:break a;default:n=-102}i=hb;return n|0}else{switch(o|0){case 16e3:break a;default:n=-102}i=hb;return n|0}}else if((o|0)<44100)if((o|0)<32e3){switch(o|0){case 24e3:break a;default:n=-102}i=hb;return n|0}else{switch(o|0){case 32e3:break a;default:n=-102}i=hb;return n|0}else if((o|0)<48e3){switch(o|0){case 44100:break a;default:n=-102}i=hb;return n|0}else{switch(o|0){case 48e3:break a;default:n=-102}i=hb;return n|0}while(0);L=g+20|0;o=c[L>>2]|0;b:do if((o|0)>=12e3)if((o|0)<16e3){switch(o|0){case 12e3:break b;default:n=-102}i=hb;return n|0}else{switch(o|0){case 16e3:break b;default:n=-102}i=hb;return n|0}else{switch(o|0){case 8e3:break b;default:n=-102}i=hb;return n|0}while(0);J=g+12|0;p=c[J>>2]|0;c:do if((p|0)>=12e3)if((p|0)<16e3){switch(p|0){case 12e3:break c;default:n=-102}i=hb;return n|0}else{switch(p|0){case 16e3:break c;default:n=-102}i=hb;return n|0}else{switch(p|0){case 8e3:break c;default:n=-102}i=hb;return n|0}while(0);K=g+16|0;q=c[K>>2]|0;d:do if((q|0)>=12e3)if((q|0)<16e3){switch(q|0){case 12e3:break d;default:n=-102}i=hb;return n|0}else{switch(q|0){case 16e3:break d;default:n=-102}i=hb;return n|0}else{switch(q|0){case 8e3:break d;default:n=-102}i=hb;return n|0}while(0);if((q|0)>(o|0)|(p|0)<(o|0)|(q|0)>(p|0)){f=-102;i=hb;return f|0}cb=g+24|0;switch(c[cb>>2]|0){case 60:case 40:case 20:case 10:break;default:{f=-103;i=hb;return f|0}}G=g+32|0;if((c[G>>2]|0)>>>0>100){f=-105;i=hb;return f|0}H=g+48|0;if((c[H>>2]|0)>>>0>1){f=-108;i=hb;return f|0}ab=g+52|0;if((c[ab>>2]|0)>>>0>1){f=-109;i=hb;return f|0}I=g+40|0;if((c[I>>2]|0)>>>0>1){f=-107;i=hb;return f|0}o=c[g>>2]|0;if((o+-1|0)>>>0>1){f=-111;i=hb;return f|0}gb=g+4|0;p=c[gb>>2]|0;if((p+-1|0)>>>0>1|(p|0)>(o|0)){f=-111;i=hb;return f|0}bb=g+36|0;if((c[bb>>2]|0)>>>0>10){f=-106;i=hb;return f|0}F=g+88|0;c[F>>2]=0;q=f+20380|0;if((p|0)>(c[q>>2]|0)){p=f+10156|0;o=Fd(p,c[f+5184>>2]|0)|0;c[f+20312>>2]=0;c[f+20320>>2]=0;c[f+20324>>2]=0;c[f+20328>>2]=1;c[f+20332>>2]=0;c[f+20336>>2]=1;b[f+20342>>1]=0;b[f+20340>>1]=16384;if((c[f+20376>>2]|0)==2){rf(f+16024|0,f+5868|0,300)|0;Ya=f;Za=c[Ya+4>>2]|0;_a=p;c[_a>>2]=c[Ya>>2];c[_a+4>>2]=Za}}else o=0;if((c[cb>>2]|0)==(c[f+4704>>2]|0))E=(c[q>>2]|0)!=(c[gb>>2]|0);else E=1;c[f+20376>>2]=c[g>>2];c[q>>2]=c[gb>>2];p=j*100|0;q=c[M>>2]|0;D=(p|0)/(q|0)|0;Za=(D|0)>1?D>>1:1;_a=(m|0)==0;e:do if(_a){if((_(D,q)|0)!=(p|0)|(j|0)<0){f=-101;i=hb;return f|0}if((j*1e3|0)>(_(c[cb>>2]|0,q)|0)){f=-101;i=hb;return f|0}else{Ya=f;m=0;r=0;break}}else{if((D|0)!=1){f=-101;i=hb;return f|0}p=0;while(1){q=c[gb>>2]|0;if((p|0)>=(q|0))break;o=Fd(f+(p*10156|0)|0,c[f+(p*10156|0)+5184>>2]|0)|0;p=p+1|0}r=c[cb>>2]|0;c[cb>>2]=10;m=c[bb>>2]|0;c[bb>>2]=0;p=0;while(1){if((p|0)>=(q|0)){Ya=f;break e}c[f+(p*10156|0)+4760>>2]=0;c[f+(p*10156|0)+4772>>2]=1;q=c[gb>>2]|0;p=p+1|0}}while(0);Xa=f+4668|0;Ua=f+20392|0;A=g+44|0;B=g+64|0;Va=g+56|0;Wa=f+5836|0;C=0;while(1){if((C|0)>=(c[gb>>2]|0))break;if((C|0)==1)v=c[Xa>>2]|0;else v=0;w=Ya+(C*10156|0)|0;t=c[Ua>>2]|0;z=Ya+(C*10156|0)+6168|0;c[z>>2]=c[H>>2];c[Ya+(C*10156|0)+4768>>2]=c[ab>>2];o=c[M>>2]|0;c[Ya+(C*10156|0)+4648>>2]=o;p=c[J>>2]|0;c[Ya+(C*10156|0)+4656>>2]=p;q=c[K>>2]|0;c[Ya+(C*10156|0)+4660>>2]=q;u=c[L>>2]|0;c[Ya+(C*10156|0)+4664>>2]=u;c[Ya+(C*10156|0)+6180>>2]=c[I>>2];c[Ya+(C*10156|0)+5844>>2]=c[g>>2];c[Ya+(C*10156|0)+5848>>2]=c[gb>>2];c[Ya+(C*10156|0)+4628>>2]=t;c[Ya+(C*10156|0)+5852>>2]=C;y=Ya+(C*10156|0)+4760|0;do if(!(c[y>>2]|0))$a=41;else{if(c[Ya+(C*10156|0)+4772>>2]|0){$a=41;break}if((o|0)==(c[Ya+(C*10156|0)+4652>>2]|0))break;o=c[Ya+(C*10156|0)+4668>>2]|0;if((o|0)<=0)break;n=Gd(w,o)|0;$a=110}while(0);if(($a|0)==41){$a=0;x=Ya+(C*10156|0)+4668|0;n=c[x>>2]|0;Ta=n<<16>>16;s=Ta*1e3|0;do if(Ta){if((s|0)>(o|0)|(s|0)>(p|0)|(s|0)<(q|0)){n=(o|0)<(p|0)?o:p;n=(((n|0)>(q|0)?n:q)|0)/1e3|0;break}q=Ya+(C*10156|0)+24|0;o=c[q>>2]|0;if((o|0)>255)c[Ya+(C*10156|0)+28>>2]=0;if((t|0)==0?(c[B>>2]|0)==0:0)break;if((s|0)>(u|0)){p=Ya+(C*10156|0)+28|0;if(!(c[p>>2]|0)){c[q>>2]=256;o=Ya+(C*10156|0)+16|0;c[o>>2]=0;c[o+4>>2]=0;o=256}if(c[B>>2]|0){c[p>>2]=0;n=(n|0)==16?12:8;break}if((o|0)<1){c[F>>2]=1;Ta=c[Va>>2]|0;c[Va>>2]=Ta-((Ta*5|0)/((c[cb>>2]|0)+5|0)|0);break}else{c[p>>2]=-2;break}}if((s|0)>=(u|0)){o=Ya+(C*10156|0)+28|0;if((c[o>>2]|0)>=0)break;c[o>>2]=1;break}if(c[B>>2]|0){c[q>>2]=0;Ta=Ya+(C*10156|0)+16|0;c[Ta>>2]=0;c[Ta+4>>2]=0;c[Ya+(C*10156|0)+28>>2]=1;n=(n|0)==8?12:16;break}o=Ya+(C*10156|0)+28|0;if(!(c[o>>2]|0)){c[F>>2]=1;Ta=c[Va>>2]|0;c[Va>>2]=Ta-((Ta*5|0)/((c[cb>>2]|0)+5|0)|0);break}else{c[o>>2]=1;break}}else n=(((u|0)<(o|0)?u:o)|0)/1e3|0;while(0);t=(v|0)==0?n:v;u=Gd(w,t)|0;q=c[cb>>2]|0;s=Ya+(C*10156|0)+4704|0;if((c[s>>2]|0)==(q|0)){n=c[x>>2]|0;q=0}else{n=(q|0)==10;f:do if(!n){switch(q|0){case 60:case 40:case 20:{p=0;break}default:if((q|0)<11){p=-103;$a=70;break f}else p=-103}c[Ya+(C*10156|0)+5836>>2]=(q|0)/20|0;c[Ya+(C*10156|0)+4672>>2]=4;n=t<<16>>16;c[Ya+(C*10156|0)+4676>>2]=n*20;c[Ya+(C*10156|0)+4640>>2]=n*24;n=c[x>>2]|0;o=Ya+(C*10156|0)+4780|0;if((n|0)==8){c[o>>2]=30064;n=8;o=p;break}else{c[o>>2]=30030;o=p;break}}else{p=0;$a=70}while(0);do if(($a|0)==70){$a=0;c[Ya+(C*10156|0)+5836>>2]=1;c[Ya+(C*10156|0)+4672>>2]=n?2:1;n=t<<16>>16;c[Ya+(C*10156|0)+4676>>2]=_(q<<16>>16,n)|0;c[Ya+(C*10156|0)+4640>>2]=n*14;n=c[x>>2]|0;o=Ya+(C*10156|0)+4780|0;if((n|0)==8){c[o>>2]=30087;n=8;o=p;break}else{c[o>>2]=30075;o=p;break}}while(0);c[s>>2]=q;c[Ya+(C*10156|0)+4700>>2]=0;q=o}g:do if((n|0)!=(t|0)){n=Ya+(C*10156|0)+7260|0;c[n>>2]=0;c[n+4>>2]=0;c[n+8>>2]=0;o=Ya+(C*10156|0)+16|0;c[o>>2]=0;c[o+4>>2]=0;c[Ya+(C*10156|0)+5832>>2]=0;c[Ya+(C*10156|0)+5840>>2]=0;c[Ya+(C*10156|0)+4700>>2]=0;nf(Ya+(C*10156|0)+144|0,0,4480)|0;c[Ya+(C*10156|0)+4636>>2]=100;c[Ya+(C*10156|0)+4756>>2]=1;a[n>>0]=10;c[Ya+(C*10156|0)+4568>>2]=100;c[Ya+(C*10156|0)+4584>>2]=65536;a[Ya+(C*10156|0)+4633>>0]=0;c[x>>2]=t;n=c[Ya+(C*10156|0)+4672>>2]|0;o=(n|0)==4;p=Ya+(C*10156|0)+4780|0;h:do if((t|0)==8)if(o){c[p>>2]=30064;n=4;$a=86;break}else{c[p>>2]=30087;$a=86;break}else{if(o){c[p>>2]=30030;n=4}else c[p>>2]=30075;switch(t|0){case 8:case 12:{$a=86;break h}default:{}}c[Ya+(C*10156|0)+4732>>2]=16;c[Ya+(C*10156|0)+4784>>2]=22936}while(0);if(($a|0)==86){c[Ya+(C*10156|0)+4732>>2]=10;c[Ya+(C*10156|0)+4784>>2]=22896}c[Ya+(C*10156|0)+4680>>2]=t*5;c[Ya+(C*10156|0)+4676>>2]=_(t*327680>>16,n<<16>>16)|0;Ta=t<<16;$a=Ta>>16;c[Ya+(C*10156|0)+4684>>2]=$a*20;c[Ya+(C*10156|0)+4688>>2]=Ta>>15;c[Ya+(C*10156|0)+4644>>2]=$a*18;c[Ya+(C*10156|0)+4640>>2]=_($a,(n|0)==4?24:14)|0;switch(t|0){case 16:{c[Ya+(C*10156|0)+4776>>2]=29962;t=16;break g}case 12:{c[Ya+(C*10156|0)+4776>>2]=29956;t=12;break g}default:{c[Ya+(C*10156|0)+4776>>2]=29947;break g}}}while(0);n=u+q|0;s=c[bb>>2]|0;do if((s|0)>=1){if((s|0)<2){c[Ya+(C*10156|0)+4736>>2]=1;c[Ya+(C*10156|0)+4744>>2]=49807;o=Ya+(C*10156|0)+4740|0;c[o>>2]=8;c[Ya+(C*10156|0)+4728>>2]=14;q=t*5|0;c[Ya+(C*10156|0)+4692>>2]=q;c[Ya+(C*10156|0)+4720>>2]=1;c[Ya+(C*10156|0)+4724>>2]=0;c[Ya+(C*10156|0)+4752>>2]=3;c[Ya+(C*10156|0)+4764>>2]=0;p=8;break}if((s|0)<3){c[Ya+(C*10156|0)+4736>>2]=0;c[Ya+(C*10156|0)+4744>>2]=52429;o=Ya+(C*10156|0)+4740|0;c[o>>2]=6;c[Ya+(C*10156|0)+4728>>2]=12;q=t*3|0;c[Ya+(C*10156|0)+4692>>2]=q;c[Ya+(C*10156|0)+4720>>2]=2;c[Ya+(C*10156|0)+4724>>2]=0;c[Ya+(C*10156|0)+4752>>2]=2;c[Ya+(C*10156|0)+4764>>2]=0;p=6;break}if((s|0)<4){c[Ya+(C*10156|0)+4736>>2]=1;c[Ya+(C*10156|0)+4744>>2]=49807;o=Ya+(C*10156|0)+4740|0;c[o>>2]=8;c[Ya+(C*10156|0)+4728>>2]=14;q=t*5|0;c[Ya+(C*10156|0)+4692>>2]=q;c[Ya+(C*10156|0)+4720>>2]=2;c[Ya+(C*10156|0)+4724>>2]=0;c[Ya+(C*10156|0)+4752>>2]=4;c[Ya+(C*10156|0)+4764>>2]=0;p=8;break}if((s|0)<6){c[Ya+(C*10156|0)+4736>>2]=1;c[Ya+(C*10156|0)+4744>>2]=48497;o=Ya+(C*10156|0)+4740|0;c[o>>2]=10;c[Ya+(C*10156|0)+4728>>2]=16;q=t*5|0;c[Ya+(C*10156|0)+4692>>2]=q;c[Ya+(C*10156|0)+4720>>2]=2;c[Ya+(C*10156|0)+4724>>2]=1;c[Ya+(C*10156|0)+4752>>2]=6;c[Ya+(C*10156|0)+4764>>2]=t*983;p=10;break}o=Ya+(C*10156|0)+4736|0;if((s|0)<8){c[o>>2]=1;c[Ya+(C*10156|0)+4744>>2]=47186;o=Ya+(C*10156|0)+4740|0;c[o>>2]=12;c[Ya+(C*10156|0)+4728>>2]=20;q=t*5|0;c[Ya+(C*10156|0)+4692>>2]=q;c[Ya+(C*10156|0)+4720>>2]=3;c[Ya+(C*10156|0)+4724>>2]=1;c[Ya+(C*10156|0)+4752>>2]=8;c[Ya+(C*10156|0)+4764>>2]=t*983;p=12;break}else{c[o>>2]=2;c[Ya+(C*10156|0)+4744>>2]=45875;o=Ya+(C*10156|0)+4740|0;c[o>>2]=16;c[Ya+(C*10156|0)+4728>>2]=24;q=t*5|0;c[Ya+(C*10156|0)+4692>>2]=q;c[Ya+(C*10156|0)+4720>>2]=4;c[Ya+(C*10156|0)+4724>>2]=1;c[Ya+(C*10156|0)+4752>>2]=16;c[Ya+(C*10156|0)+4764>>2]=t*983;p=16;break}}else{c[Ya+(C*10156|0)+4736>>2]=0;c[Ya+(C*10156|0)+4744>>2]=52429;o=Ya+(C*10156|0)+4740|0;c[o>>2]=6;c[Ya+(C*10156|0)+4728>>2]=12;q=t*3|0;c[Ya+(C*10156|0)+4692>>2]=q;c[Ya+(C*10156|0)+4720>>2]=1;c[Ya+(C*10156|0)+4724>>2]=0;c[Ya+(C*10156|0)+4752>>2]=2;c[Ya+(C*10156|0)+4764>>2]=0;p=6}while(0);Ta=c[Ya+(C*10156|0)+4732>>2]|0;c[o>>2]=(p|0)<(Ta|0)?p:Ta;c[Ya+(C*10156|0)+4696>>2]=(t*5|0)+(q<<1);c[Ya+(C*10156|0)+4716>>2]=s;o=c[G>>2]|0;c[Ya+(C*10156|0)+4708>>2]=o;Ta=Ya+(C*10156|0)+6184|0;p=c[Ta>>2]|0;$a=c[A>>2]|0;c[Ta>>2]=$a;do if($a|0)if(!p){c[Ya+(C*10156|0)+6188>>2]=7;break}else{$a=7-(((o>>16)*26214|0)+(((o&65535)*26214|0)>>>16))|0;c[Ya+(C*10156|0)+6188>>2]=($a|0)>2?$a:2;break}while(0);c[y>>2]=1;$a=110}if(($a|0)==110?($a=0,n|0):0){$a=439;break}i:do if((c[Ya+(C*10156|0)+4756>>2]|0)!=0|E){o=0;while(1){if((o|0)>=(c[Wa>>2]|0))break i;c[Ya+(C*10156|0)+4816+(o<<2)>>2]=0;o=o+1|0}}while(0);c[Ya+(C*10156|0)+6172>>2]=c[z>>2];C=C+1|0;o=0}if(($a|0)==439){i=hb;return n|0}G=D*10|0;K=c[Xa>>2]|0;H=_(G,K)|0;I=f+4648|0;K=(_(H,c[I>>2]|0)|0)/(K*1e3|0)|0;Sa=Fa()|0;J=i;i=i+((1*(K<<1)|0)+15&-16)|0;K=f+4676|0;L=f+5832|0;Qa=f+20384|0;M=f+16024|0;N=f+5868|0;O=f+5188|0;P=f+14832|0;Q=f+15988|0;R=f+14824|0;S=f+15344|0;T=k+28|0;U=k+32|0;V=k+36|0;W=k+20|0;X=k+40|0;Y=k+24|0;Z=k+8|0;$=k+4|0;ba=k+44|0;ca=f+20346|0;da=f+14972|0;ea=f+20364|0;fa=f+20368|0;ga=f+4633|0;ha=f+4636|0;ia=f+4788|0;ja=f+8|0;ka=f+4624|0;la=g+28|0;ma=f+20372|0;na=f+20312|0;oa=f+5192|0;pa=f+15348|0;Ra=g+60|0;qa=f+20396|0;ra=f+17416|0;sa=f+10300|0;ta=f+10172|0;ua=f+14792|0;va=f+14724|0;wa=f+14789|0;xa=f+14740|0;ya=f+14912|0;za=f+10156|0;Aa=f+15346|0;Ba=f+14780|0;Ca=f+15013|0;Da=f+16332|0;Ea=f+16328|0;Ga=f+14968|0;Ha=f+5190|0;Ta=f+4857|0;Ia=f+6176|0;Ja=f+6172|0;Ka=fb+4|0;La=Za<<1;Ma=Za+-1|0;Oa=f+20388|0;Pa=f+20316|0;t=h;F=0;while(1){q=c[L>>2]|0;s=(c[K>>2]|0)-q|0;s=(s|0)<(H|0)?s:H;E=_(s,c[I>>2]|0)|0;E=(E|0)/((c[Xa>>2]|0)*1e3|0)|0;do if((c[g>>2]|0)==2)if((c[gb>>2]|0)==2){n=c[eb>>2]|0;p=0;while(1){if((p|0)>=(E|0))break;b[J+(p<<1)>>1]=b[t+(p<<1<<1)>>1]|0;p=p+1|0}if((c[Qa>>2]|0)==1&(n|0)==0)rf(M|0,N|0,300)|0;Id(N,O+(q+2<<1)|0,J,E);c[L>>2]=(c[L>>2]|0)+s;p=c[Q>>2]|0;q=(c[P>>2]|0)-p|0;n=_(G,c[R>>2]|0)|0;n=(q|0)<(n|0)?q:n;q=0;while(1){if((q|0)>=(E|0))break;b[J+(q<<1)>>1]=b[t+((q<<1|1)<<1)>>1]|0;q=q+1|0}Id(M,S+(p+2<<1)|0,J,E);c[Q>>2]=(c[Q>>2]|0)+n;n=c[L>>2]|0;break}else{if((c[gb>>2]|0)==1)n=0;else{$a=136;break}while(1){if((n|0)>=(E|0))break;h=n<<1;h=(b[t+(h<<1)>>1]|0)+(b[t+((h|1)<<1)>>1]|0)|0;b[J+(n<<1)>>1]=(h>>>1)+(h&1);n=n+1|0}Id(N,O+(q+2<<1)|0,J,E);j:do if((c[Qa>>2]|0)==2){if(c[eb>>2]|0)break;Id(M,S+((c[Q>>2]|0)+2<<1)|0,J,E);n=0;while(1){if((n|0)>=(c[K>>2]|0))break j;h=O+((c[L>>2]|0)+n+2<<1)|0;b[h>>1]=((b[h>>1]|0)+(b[S+((c[Q>>2]|0)+n+2<<1)>>1]|0)|0)>>>1;n=n+1|0}}while(0);n=(c[L>>2]|0)+s|0;c[L>>2]=n;break}else $a=136;while(0);if(($a|0)==136){$a=0;rf(J|0,t|0,E<<1|0)|0;Id(N,O+(q+2<<1)|0,J,E);n=(c[L>>2]|0)+s|0;c[L>>2]=n}C=t+((_(E,c[g>>2]|0)|0)<<1)|0;D=j-E|0;c[Ua>>2]=0;if((n|0)<(c[K>>2]|0)){n=0;break}if(!((c[eb>>2]|0)!=0|_a^1)){n=256>>>(_((c[Wa>>2]|0)+1|0,c[gb>>2]|0)|0);h=c[T>>2]|0;n=h-(_(h>>>8,0-n&255)|0)|0;c[T>>2]=n;while(1){if(n>>>0>=8388609){u=0;break}p=c[U>>2]|0;s=p>>>23;if((s|0)==255)c[V>>2]=(c[V>>2]|0)+1;else{q=p>>>31;n=c[X>>2]|0;if((n|0)>-1){p=c[Y>>2]|0;if((p+(c[Z>>2]|0)|0)>>>0<(c[$>>2]|0)>>>0){c[Y>>2]=p+1;a[(c[k>>2]|0)+p>>0]=n+q;n=0}else n=-1;c[ba>>2]=c[ba>>2]|n}n=c[V>>2]|0;if(n|0){q=q+255&255;do{p=c[Y>>2]|0;if((p+(c[Z>>2]|0)|0)>>>0<(c[$>>2]|0)>>>0){c[Y>>2]=p+1;a[(c[k>>2]|0)+p>>0]=q;p=0;n=c[V>>2]|0}else p=-1;c[ba>>2]=c[ba>>2]|p;n=n+-1|0;c[V>>2]=n}while((n|0)!=0)}c[X>>2]=s&255;p=c[U>>2]|0;n=c[T>>2]|0}c[U>>2]=p<<8&2147483392;n=n<<8;c[T>>2]=n;c[W>>2]=(c[W>>2]|0)+8}while(1){n=c[gb>>2]|0;if((u|0)>=(n|0)){B=0;break}p=c[Ya+(u*10156|0)+5836>>2]|0;t=0;n=0;while(1){if((n|0)>=(p|0))break;t=t|c[Ya+(u*10156|0)+4816+(n<<2)>>2]<>0]=(t|0)>0&1;k:do if((t|0)!=0&(p|0)>1){s=t+-1|0;n=c[17520+(p+-2<<2)>>2]|0;p=c[T>>2]|0;q=p>>>8;if((t|0)>1){h=n+(t+-2)|0;B=p-(_(q,d[h>>0]|0)|0)|0;c[U>>2]=(c[U>>2]|0)+B;n=_(q,(d[h>>0]|0)-(d[n+s>>0]|0)|0)|0}else n=p-(_(q,d[n+s>>0]|0)|0)|0;c[T>>2]=n;while(1){if(n>>>0>=8388609)break k;p=c[U>>2]|0;s=p>>>23;if((s|0)==255)c[V>>2]=(c[V>>2]|0)+1;else{q=p>>>31;n=c[X>>2]|0;if((n|0)>-1){p=c[Y>>2]|0;if((p+(c[Z>>2]|0)|0)>>>0<(c[$>>2]|0)>>>0){c[Y>>2]=p+1;a[(c[k>>2]|0)+p>>0]=n+q;n=0}else n=-1;c[ba>>2]=c[ba>>2]|n}n=c[V>>2]|0;if(n|0){q=q+255&255;do{p=c[Y>>2]|0;if((p+(c[Z>>2]|0)|0)>>>0<(c[$>>2]|0)>>>0){c[Y>>2]=p+1;a[(c[k>>2]|0)+p>>0]=q;p=0;n=c[V>>2]|0}else p=-1;c[ba>>2]=c[ba>>2]|p;n=n+-1|0;c[V>>2]=n}while((n|0)!=0)}c[X>>2]=s&255;p=c[U>>2]|0;n=c[T>>2]|0}c[U>>2]=p<<8&2147483392;n=n<<8;c[T>>2]=n;c[W>>2]=(c[W>>2]|0)+8}}while(0);u=u+1|0}while(1){if((B|0)>=(c[Wa>>2]|0)){p=0;break}v=ca+(B*6|0)+2|0;w=ca+(B*6|0)+5|0;x=da+(B<<2)|0;y=ea+B|0;z=(B|0)>0;A=B+-1|0;u=0;while(1){if((u|0)>=(n|0))break;if(c[Ya+(u*10156|0)+4816+(B<<2)>>2]|0){l:do if((n|0)==2&(u|0)==0){n=((a[v>>0]|0)*5|0)+(a[w>>0]|0)|0;p=c[T>>2]|0;q=p>>>8;if((n|0)>0){h=d[29891+(n+-1)>>0]|0;t=p-(_(q,h)|0)|0;c[U>>2]=(c[U>>2]|0)+t;n=_(q,h-(d[29891+n>>0]|0)|0)|0}else n=p-(_(q,d[29891+n>>0]|0)|0)|0;c[T>>2]=n;while(1){if(n>>>0>=8388609){t=0;break}p=c[U>>2]|0;s=p>>>23;if((s|0)==255)c[V>>2]=(c[V>>2]|0)+1;else{q=p>>>31;n=c[X>>2]|0;if((n|0)>-1){p=c[Y>>2]|0;if((p+(c[Z>>2]|0)|0)>>>0<(c[$>>2]|0)>>>0){c[Y>>2]=p+1;a[(c[k>>2]|0)+p>>0]=n+q;n=0}else n=-1;c[ba>>2]=c[ba>>2]|n}n=c[V>>2]|0;if(n|0){q=q+255&255;do{p=c[Y>>2]|0;if((p+(c[Z>>2]|0)|0)>>>0<(c[$>>2]|0)>>>0){c[Y>>2]=p+1;a[(c[k>>2]|0)+p>>0]=q;p=0;n=c[V>>2]|0}else p=-1;c[ba>>2]=c[ba>>2]|p;n=n+-1|0;c[V>>2]=n}while((n|0)!=0)}c[X>>2]=s&255;p=c[U>>2]|0;n=c[T>>2]|0}c[U>>2]=p<<8&2147483392;n=n<<8;c[T>>2]=n;c[W>>2]=(c[W>>2]|0)+8}while(1){if((t|0)==2)break;h=a[ca+(B*6|0)+(t*3|0)>>0]|0;p=h<<24>>24;q=n>>>8;if(h<<24>>24>0){h=d[29944+(p+-1)>>0]|0;n=n-(_(q,h)|0)|0;c[U>>2]=(c[U>>2]|0)+n;n=_(q,h-(d[29944+p>>0]|0)|0)|0}else n=n-(_(q,d[29944+p>>0]|0)|0)|0;c[T>>2]=n;while(1){if(n>>>0>=8388609)break;p=c[U>>2]|0;s=p>>>23;if((s|0)==255)c[V>>2]=(c[V>>2]|0)+1;else{q=p>>>31;n=c[X>>2]|0;if((n|0)>-1){p=c[Y>>2]|0;if((p+(c[Z>>2]|0)|0)>>>0<(c[$>>2]|0)>>>0){c[Y>>2]=p+1;a[(c[k>>2]|0)+p>>0]=n+q;n=0}else n=-1;c[ba>>2]=c[ba>>2]|n}n=c[V>>2]|0;if(n|0){q=q+255&255;do{p=c[Y>>2]|0;if((p+(c[Z>>2]|0)|0)>>>0<(c[$>>2]|0)>>>0){c[Y>>2]=p+1;a[(c[k>>2]|0)+p>>0]=q;p=0;n=c[V>>2]|0}else p=-1;c[ba>>2]=c[ba>>2]|p;n=n+-1|0;c[V>>2]=n}while((n|0)!=0)}c[X>>2]=s&255;p=c[U>>2]|0;n=c[T>>2]|0}c[U>>2]=p<<8&2147483392;n=n<<8;c[T>>2]=n;c[W>>2]=(c[W>>2]|0)+8}h=a[ca+(B*6|0)+(t*3|0)+1>>0]|0;p=h<<24>>24;q=n>>>8;if(h<<24>>24>0){h=d[29951+(p+-1)>>0]|0;n=n-(_(q,h)|0)|0;c[U>>2]=(c[U>>2]|0)+n;n=_(q,h-(d[29951+p>>0]|0)|0)|0}else n=n-(_(q,d[29951+p>>0]|0)|0)|0;c[T>>2]=n;while(1){if(n>>>0>=8388609)break;p=c[U>>2]|0;s=p>>>23;if((s|0)==255)c[V>>2]=(c[V>>2]|0)+1;else{q=p>>>31;n=c[X>>2]|0;if((n|0)>-1){p=c[Y>>2]|0;if((p+(c[Z>>2]|0)|0)>>>0<(c[$>>2]|0)>>>0){c[Y>>2]=p+1;a[(c[k>>2]|0)+p>>0]=n+q;n=0}else n=-1;c[ba>>2]=c[ba>>2]|n}n=c[V>>2]|0;if(n|0){q=q+255&255;do{p=c[Y>>2]|0;if((p+(c[Z>>2]|0)|0)>>>0<(c[$>>2]|0)>>>0){c[Y>>2]=p+1;a[(c[k>>2]|0)+p>>0]=q;p=0;n=c[V>>2]|0}else p=-1;c[ba>>2]=c[ba>>2]|p;n=n+-1|0;c[V>>2]=n}while((n|0)!=0)}c[X>>2]=s&255;p=c[U>>2]|0;n=c[T>>2]|0}c[U>>2]=p<<8&2147483392;n=n<<8;c[T>>2]=n;c[W>>2]=(c[W>>2]|0)+8}t=t+1|0}if(c[x>>2]|0)break;h=a[y>>0]|0;p=h<<24>>24;q=n>>>8;if(h<<24>>24>0){h=d[29916+(p+-1)>>0]|0;n=n-(_(q,h)|0)|0;c[U>>2]=(c[U>>2]|0)+n;n=_(q,h-(d[29916+p>>0]|0)|0)|0}else n=n-(_(q,d[29916+p>>0]|0)|0)|0;c[T>>2]=n;while(1){if(n>>>0>=8388609)break l;p=c[U>>2]|0;s=p>>>23;if((s|0)==255)c[V>>2]=(c[V>>2]|0)+1;else{q=p>>>31;p=c[X>>2]|0;if((p|0)>-1){n=c[Y>>2]|0;if((n+(c[Z>>2]|0)|0)>>>0<(c[$>>2]|0)>>>0){c[Y>>2]=n+1;a[(c[k>>2]|0)+n>>0]=p+q;n=0}else n=-1;c[ba>>2]=c[ba>>2]|n}n=c[V>>2]|0;if(n|0){q=q+255&255;do{p=c[Y>>2]|0;if((p+(c[Z>>2]|0)|0)>>>0<(c[$>>2]|0)>>>0){c[Y>>2]=p+1;a[(c[k>>2]|0)+p>>0]=q;p=0;n=c[V>>2]|0}else p=-1;c[ba>>2]=c[ba>>2]|p;n=n+-1|0;c[V>>2]=n}while((n|0)!=0)}c[X>>2]=s&255;p=c[U>>2]|0;n=c[T>>2]|0}c[U>>2]=p<<8&2147483392;n=n<<8;c[T>>2]=n;c[W>>2]=(c[W>>2]|0)+8}}while(0);if(z?(c[Ya+(u*10156|0)+4816+(A<<2)>>2]|0)!=0:0)n=2;else n=0;Ad(Ya+(u*10156|0)|0,k,B,1,n);Bd(k,a[Ya+(u*10156|0)+6192+(B*36|0)+29>>0]|0,a[Ya+(u*10156|0)+6192+(B*36|0)+30>>0]|0,Ya+(u*10156|0)+6300+(B*320|0)|0,c[Ya+(u*10156|0)+4676>>2]|0);n=c[gb>>2]|0}u=u+1|0}B=B+1|0}while(1){if((p|0)>=(n|0))break;n=Ya+(p*10156|0)+4816|0;c[n>>2]=0;c[n+4>>2]=0;c[n+8>>2]=0;n=c[gb>>2]|0;p=p+1|0}c[fa>>2]=(c[W>>2]|0)+((aa(c[T>>2]|0)|0)+-32)}if((a[ga>>0]|0)==2){n=_(c[Xa>>2]|0,65536e3)|0;n=(n|0)/(c[ha>>2]|0)|0;s=aa(n|0)|0;p=24-s|0;q=0-p|0;do if(p)if((p|0)<0){n=n<>>(p+32|0);break}else{n=n<<32-p|n>>>p;break}while(0);z=n&127;z=z+(((_(z,128-z|0)|0)*179|0)>>>16)+(31-s<<7)|0;B=c[ia>>2]|0;h=0-B<<2;B=B<<16>>16;A=_(h>>16,B)|0;B=_(h&65532,B)|0;h=(z<<16)+-183762944>>16;h=z+-2048+((_(A+(B>>16)>>16,h)|0)+((_(A+(B>>>16)&65535,h)|0)>>16))|0;B=c[ja>>2]|0;h=h-(B>>8)|0;h=(h|0)<0?h*3|0:h;h=_(c[ka>>2]<<16>>16,(h|0)>51?51:((h|0)<-51?-51:h)<<16>>16)|0;h=B+(((h>>16)*6554|0)+(((h&65535)*6554|0)>>>16))|0;c[ja>>2]=(h|0)>217856?217856:(h|0)<193536?193536:h}s=c[la>>2]|0;p=c[cb>>2]|0;n=(_(s,p)|0)/1e3|0;if(_a)n=n-(c[fa>>2]|0)|0;q=(n|0)/(c[Wa>>2]|0)|0;n=_(q<<16>>16,(p|0)==10?100:50)|0;n=n-(c[ma>>2]<<1)|0;do if(_a){p=c[eb>>2]|0;if((p|0)<=0)break;h=(c[W>>2]|0)+((aa(c[T>>2]|0)|0)+-32)|0;n=n-(h-(c[fa>>2]|0)-(_(q,p)|0)<<1)|0}while(0);do if((s|0)>5e3){if((n|0)>(s|0))break;s=(n|0)<5e3?5e3:n}else{if((n|0)>5e3){s=5e3;break}s=(n|0)<(s|0)?s:n}while(0);m:do if((c[gb>>2]|0)==2){n=c[eb>>2]|0;Dd(na,oa,pa,ca+(n*6|0)|0,ea+n|0,fb,s,c[ka>>2]|0,c[Ra>>2]|0,c[Xa>>2]|0,c[K>>2]|0);n=c[eb>>2]|0;do if(!(a[ea+n>>0]|0)){if((c[qa>>2]|0)==1){c[ra>>2]=0;c[ra+4>>2]=0;c[ra+8>>2]=0;h=ta;c[h>>2]=0;c[h+4>>2]=0;nf(sa|0,0,4480)|0;c[ua>>2]=100;c[va>>2]=100;a[ra>>0]=10;a[wa>>0]=0;c[xa>>2]=65536;c[ya>>2]=1}oe(za,Aa);if((c[Ba>>2]|0)>=13){c[Da>>2]=0;c[Ea>>2]=0;a[Ca>>0]=1;a[(c[db>>2]|0)+(za+4812)>>0]=1;break}a[Ca>>0]=0;n=c[Da>>2]|0;h=n+1|0;c[Da>>2]=h;do if((h|0)<10)c[Ea>>2]=0;else{if((n|0)<=29)break;c[Da>>2]=10;c[Ea>>2]=0}while(0);a[(c[db>>2]|0)+(za+4812)>>0]=0}else a[Ga+n>>0]=0;while(0);if(!_a)break;v=c[eb>>2]|0;n=((a[ca+(v*6|0)+2>>0]|0)*5|0)+(a[ca+(v*6|0)+5>>0]|0)|0;p=c[T>>2]|0;q=p>>>8;if((n|0)>0){h=d[29891+(n+-1)>>0]|0;B=p-(_(q,h)|0)|0;c[U>>2]=(c[U>>2]|0)+B;n=_(q,h-(d[29891+n>>0]|0)|0)|0}else n=p-(_(q,d[29891+n>>0]|0)|0)|0;c[T>>2]=n;while(1){if(n>>>0>=8388609){q=n;u=0;break}p=c[U>>2]|0;t=p>>>23;if((t|0)==255)c[V>>2]=(c[V>>2]|0)+1;else{q=p>>>31;n=c[X>>2]|0;if((n|0)>-1){p=c[Y>>2]|0;if((p+(c[Z>>2]|0)|0)>>>0<(c[$>>2]|0)>>>0){c[Y>>2]=p+1;a[(c[k>>2]|0)+p>>0]=n+q;n=0}else n=-1;c[ba>>2]=c[ba>>2]|n}n=c[V>>2]|0;if(n|0){q=q+255&255;do{p=c[Y>>2]|0;if((p+(c[Z>>2]|0)|0)>>>0<(c[$>>2]|0)>>>0){c[Y>>2]=p+1;a[(c[k>>2]|0)+p>>0]=q;p=0;n=c[V>>2]|0}else p=-1;c[ba>>2]=c[ba>>2]|p;n=n+-1|0;c[V>>2]=n}while((n|0)!=0)}c[X>>2]=t&255;p=c[U>>2]|0;n=c[T>>2]|0}c[U>>2]=p<<8&2147483392;n=n<<8;c[T>>2]=n;c[W>>2]=(c[W>>2]|0)+8}while(1){if((u|0)==2)break;h=a[ca+(v*6|0)+(u*3|0)>>0]|0;n=h<<24>>24;p=q>>>8;if(h<<24>>24>0){h=d[29944+(n+-1)>>0]|0;B=q-(_(p,h)|0)|0;c[U>>2]=(c[U>>2]|0)+B;n=_(p,h-(d[29944+n>>0]|0)|0)|0}else n=q-(_(p,d[29944+n>>0]|0)|0)|0;c[T>>2]=n;while(1){if(n>>>0>=8388609)break;p=c[U>>2]|0;t=p>>>23;if((t|0)==255)c[V>>2]=(c[V>>2]|0)+1;else{q=p>>>31;n=c[X>>2]|0;if((n|0)>-1){p=c[Y>>2]|0;if((p+(c[Z>>2]|0)|0)>>>0<(c[$>>2]|0)>>>0){c[Y>>2]=p+1;a[(c[k>>2]|0)+p>>0]=n+q;n=0}else n=-1;c[ba>>2]=c[ba>>2]|n}n=c[V>>2]|0;if(n|0){q=q+255&255;do{p=c[Y>>2]|0;if((p+(c[Z>>2]|0)|0)>>>0<(c[$>>2]|0)>>>0){c[Y>>2]=p+1;a[(c[k>>2]|0)+p>>0]=q;p=0;n=c[V>>2]|0}else p=-1;c[ba>>2]=c[ba>>2]|p;n=n+-1|0;c[V>>2]=n}while((n|0)!=0)}c[X>>2]=t&255;p=c[U>>2]|0;n=c[T>>2]|0}c[U>>2]=p<<8&2147483392;n=n<<8;c[T>>2]=n;c[W>>2]=(c[W>>2]|0)+8}h=a[ca+(v*6|0)+(u*3|0)+1>>0]|0;p=h<<24>>24;q=n>>>8;if(h<<24>>24>0){h=d[29951+(p+-1)>>0]|0;n=n-(_(q,h)|0)|0;c[U>>2]=(c[U>>2]|0)+n;n=_(q,h-(d[29951+p>>0]|0)|0)|0}else n=n-(_(q,d[29951+p>>0]|0)|0)|0;c[T>>2]=n;while(1){if(n>>>0>=8388609)break;p=c[U>>2]|0;t=p>>>23;if((t|0)==255)c[V>>2]=(c[V>>2]|0)+1;else{q=p>>>31;n=c[X>>2]|0;if((n|0)>-1){p=c[Y>>2]|0;if((p+(c[Z>>2]|0)|0)>>>0<(c[$>>2]|0)>>>0){c[Y>>2]=p+1;a[(c[k>>2]|0)+p>>0]=n+q;n=0}else n=-1;c[ba>>2]=c[ba>>2]|n}n=c[V>>2]|0;if(n|0){q=q+255&255;do{p=c[Y>>2]|0;if((p+(c[Z>>2]|0)|0)>>>0<(c[$>>2]|0)>>>0){c[Y>>2]=p+1;a[(c[k>>2]|0)+p>>0]=q;p=0;n=c[V>>2]|0}else p=-1;c[ba>>2]=c[ba>>2]|p;n=n+-1|0;c[V>>2]=n}while((n|0)!=0)}c[X>>2]=t&255;p=c[U>>2]|0;n=c[T>>2]|0}c[U>>2]=p<<8&2147483392;n=n<<8;c[T>>2]=n;c[W>>2]=(c[W>>2]|0)+8}q=n;u=u+1|0}n=c[eb>>2]|0;if(a[Ga+n>>0]|0)break;h=a[ea+n>>0]|0;n=h<<24>>24;p=q>>>8;if(h<<24>>24>0){h=d[29916+(n+-1)>>0]|0;B=q-(_(p,h)|0)|0;c[U>>2]=(c[U>>2]|0)+B;n=_(p,h-(d[29916+n>>0]|0)|0)|0}else n=q-(_(p,d[29916+n>>0]|0)|0)|0;c[T>>2]=n;while(1){if(n>>>0>=8388609)break m;p=c[U>>2]|0;t=p>>>23;if((t|0)==255)c[V>>2]=(c[V>>2]|0)+1;else{q=p>>>31;n=c[X>>2]|0;if((n|0)>-1){p=c[Y>>2]|0;if((p+(c[Z>>2]|0)|0)>>>0<(c[$>>2]|0)>>>0){c[Y>>2]=p+1;a[(c[k>>2]|0)+p>>0]=n+q;n=0}else n=-1;c[ba>>2]=c[ba>>2]|n}n=c[V>>2]|0;if(n|0){q=q+255&255;do{p=c[Y>>2]|0;if((p+(c[Z>>2]|0)|0)>>>0<(c[$>>2]|0)>>>0){c[Y>>2]=p+1;a[(c[k>>2]|0)+p>>0]=q;p=0;n=c[V>>2]|0}else p=-1;c[ba>>2]=c[ba>>2]|p;n=n+-1|0;c[V>>2]=n}while((n|0)!=0)}c[X>>2]=t&255;p=c[U>>2]|0;n=c[T>>2]|0}c[U>>2]=p<<8&2147483392;n=n<<8;c[T>>2]=n;c[W>>2]=(c[W>>2]|0)+8}}else{c[O>>2]=c[Pa>>2];h=O+(c[K>>2]<<1)|0;h=e[h>>1]|e[h+2>>1]<<16;b[Pa>>1]=h;b[Pa+2>>1]=h>>>16}while(0);oe(f,Ha);if((c[ka>>2]|0)<13){a[Ta>>0]=0;n=c[Ia>>2]|0;h=n+1|0;c[Ia>>2]=h;do if((h|0)<10)c[Ja>>2]=0;else{if((n|0)<=29)break;c[Ia>>2]=10;c[Ja>>2]=0}while(0);a[(c[eb>>2]|0)+(f+4812)>>0]=0}else{c[Ia>>2]=0;c[Ja>>2]=0;a[Ta>>0]=1;a[(c[eb>>2]|0)+(f+4812)>>0]=1}v=(F|0)==0;w=c[Ka>>2]|0;x=(F|0)==(Ma|0);y=(F|0)==1;z=0;while(1){n=c[gb>>2]|0;if((z|0)>=(n|0))break;p=c[Va>>2]|0;n:do switch(Za|0){case 2:{if(!v){q=p;break n}q=(p*3|0)/5|0;break}case 3:{if(v){q=(p<<1|0)/5|0;break n}if(!y){q=p;break n}q=(p*3|0)/4|0;break}default:q=p}while(0);t=x&(c[ab>>2]|0)!=0&1;do if((n|0)==1){n=s;u=t}else{n=c[fb+(z<<2)>>2]|0;if((z|0)!=0|(w|0)<1){u=t;break}q=q-((p|0)/(La|0)|0)|0;u=0}while(0);if((n|0)>0){o=(n|0)>8e4?8e4:(n|0)<5e3?5e3:n;n=Ya+(z*10156|0)+4700|0;o:do if((o|0)!=(c[n>>2]|0)){c[n>>2]=o;t=c[Ya+(z*10156|0)+4668>>2]|0;t=(t|0)==8?17424:(t|0)==12?17456:17488;n=(c[Ya+(z*10156|0)+4672>>2]|0)==2?o+-2200|0:o;p=1;while(1){if((p|0)>=8)break o;o=c[t+(p<<2)>>2]|0;if((n|0)<=(o|0))break;p=p+1|0}h=p+-1|0;B=c[t+(h<<2)>>2]|0;h=b[25356+(h<<1)>>1]|0;c[Ya+(z*10156|0)+4808>>2]=(h<<6)+(_((n-B<<6|0)/(o-B|0)|0,(b[25356+(p<<1)>>1]|0)-h|0)|0)}while(0);do if((c[eb>>2]|0)>(z|0)){if((z|0)>0?c[qa>>2]|0:0){n=1;break}n=2}else n=0;while(0);o=Qd(Ya+(z*10156|0)|0,l,k,n,q,u)|0}c[Ya+(z*10156|0)+4760>>2]=0;c[Ya+(z*10156|0)+5832>>2]=0;h=Ya+(z*10156|0)+5840|0;c[h>>2]=(c[h>>2]|0)+1;z=z+1|0}q=c[eb>>2]|0;c[qa>>2]=a[ea+(q+-1)>>0];do if((c[l>>2]|0)>0){if((q|0)!=(c[Wa>>2]|0))break;s=c[gb>>2]|0;v=0;u=0;while(1){if((u|0)>=(s|0))break;t=c[Ya+(u*10156|0)+5836>>2]|0;n=v;p=0;while(1){n=n<<1;if((p|0)>=(t|0))break;n=n|a[Ya+(u*10156|0)+4812+p>>0];p=p+1|0}v=n|a[Ya+(u*10156|0)+4815>>0];u=u+1|0}do if(_a){n=_(q+1|0,s)|0;p=8-n|0;q=(1<>2]|0){h=c[k>>2]|0;a[h>>0]=d[h>>0]&(q^255)|v<>2]|0;if((s|0)>-1){c[X>>2]=s&~q|v<>2]|0)>>>0>-2147483648>>>n>>>0){c[ba>>2]=-1;break}else{c[U>>2]=c[U>>2]&~(q<<23)|v<>2]|0){if((c[gb>>2]|0)!=1?(c[Ea>>2]|0)==0:0)break;c[l>>2]=0}while(0);n=(c[ma>>2]|0)+(c[l>>2]<<3)|0;c[ma>>2]=n;n=n-((_(c[la>>2]|0,c[cb>>2]|0)|0)/1e3|0)|0;c[ma>>2]=(n|0)>1e4?1e4:(n|0)<0?0:n;n=c[Oa>>2]|0;if((c[ka>>2]|0)<(((n<<16>>16)*3188>>16)+13|0)){c[Ua>>2]=1;c[Oa>>2]=0;break}else{c[Ua>>2]=0;c[Oa>>2]=n+(c[cb>>2]|0);break}}while(0);if((j|0)==(E|0)){$a=428;break}t=C;j=D;F=F+1|0}if(($a|0)==428)n=c[Ua>>2]|0;c[Qa>>2]=c[gb>>2];c[g+76>>2]=n;if((c[Xa>>2]|0)==16)n=(c[f+28>>2]|0)==0;else n=0;c[g+80>>2]=n&1;c[g+72>>2]=(c[Xa>>2]<<16>>16)*1e3;if(!(c[Ra>>2]|0))n=b[f+20340>>1]|0;else n=0;c[g+84>>2]=n;p:do if(!_a){c[cb>>2]=r;c[bb>>2]=m;n=0;while(1){if((n|0)>=(c[gb>>2]|0))break p;c[Ya+(n*10156|0)+4760>>2]=0;c[Ya+(n*10156|0)+4772>>2]=0;n=n+1|0}}while(0);c[g+92>>2]=a[Ta>>0];c[g+96>>2]=b[25404+(a[Ta>>0]>>1<<2)+(a[f+4858>>0]<<1)>>1];Na(Sa|0);f=o;i=hb;return f|0}function Ad(e,f,g,h,j){e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;var k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0;F=i;i=i+48|0;x=F;v=F+32|0;C=(h|0)==0;E=C?e+4828|0:e+6192+(g*36|0)|0;D=E+29|0;l=(a[D>>0]<<1)+(a[E+30>>0]|0)|0;a:do if((l|0)>1|C^1){g=l+-2|0;u=f+28|0;h=c[u>>2]|0;k=h>>>8;if((l|0)>2){C=d[29933+(l+-3)>>0]|0;B=h-(_(k,C)|0)|0;m=f+32|0;c[m>>2]=(c[m>>2]|0)+B;g=_(k,C-(d[29933+g>>0]|0)|0)|0;c[u>>2]=g}else{g=h-(_(k,d[29933+g>>0]|0)|0)|0;c[u>>2]=g;m=f+32|0}n=f+36|0;o=f+20|0;p=f+40|0;q=f+24|0;r=f+8|0;s=f+4|0;t=f+44|0;while(1){if(g>>>0>=8388609){l=g;break a}h=c[m>>2]|0;l=h>>>23;if((l|0)==255)c[n>>2]=(c[n>>2]|0)+1;else{k=h>>>31;g=c[p>>2]|0;if((g|0)>-1){h=c[q>>2]|0;if((h+(c[r>>2]|0)|0)>>>0<(c[s>>2]|0)>>>0){c[q>>2]=h+1;a[(c[f>>2]|0)+h>>0]=g+k;g=0}else g=-1;c[t>>2]=c[t>>2]|g}g=c[n>>2]|0;if(g|0){k=k+255&255;do{h=c[q>>2]|0;if((h+(c[r>>2]|0)|0)>>>0<(c[s>>2]|0)>>>0){c[q>>2]=h+1;a[(c[f>>2]|0)+h>>0]=k;h=0;g=c[n>>2]|0}else h=-1;c[t>>2]=c[t>>2]|h;g=g+-1|0;c[n>>2]=g}while((g|0)!=0)}c[p>>2]=l&255;h=c[m>>2]|0;g=c[u>>2]|0}c[m>>2]=h<<8&2147483392;g=g<<8;c[u>>2]=g;c[o>>2]=(c[o>>2]|0)+8}}else{u=f+28|0;g=c[u>>2]|0;h=g>>>8;if((l|0)>0){C=d[29937+(l+-1)>>0]|0;g=g-(_(h,C)|0)|0;m=f+32|0;c[m>>2]=(c[m>>2]|0)+g;g=_(h,C-(d[29937+l>>0]|0)|0)|0;c[u>>2]=g}else{g=g-(_(h,d[29937+l>>0]|0)|0)|0;c[u>>2]=g;m=f+32|0}n=f+36|0;o=f+20|0;p=f+40|0;q=f+24|0;r=f+8|0;s=f+4|0;t=f+44|0;while(1){if(g>>>0>=8388609){l=g;break a}h=c[m>>2]|0;l=h>>>23;if((l|0)==255)c[n>>2]=(c[n>>2]|0)+1;else{k=h>>>31;g=c[p>>2]|0;if((g|0)>-1){h=c[q>>2]|0;if((h+(c[r>>2]|0)|0)>>>0<(c[s>>2]|0)>>>0){c[q>>2]=h+1;a[(c[f>>2]|0)+h>>0]=g+k;g=0}else g=-1;c[t>>2]=c[t>>2]|g}g=c[n>>2]|0;if(g|0){k=k+255&255;do{h=c[q>>2]|0;if((h+(c[r>>2]|0)|0)>>>0<(c[s>>2]|0)>>>0){c[q>>2]=h+1;a[(c[f>>2]|0)+h>>0]=k;h=0;g=c[n>>2]|0}else h=-1;c[t>>2]=c[t>>2]|h;g=g+-1|0;c[n>>2]=g}while((g|0)!=0)}c[p>>2]=l&255;h=c[m>>2]|0;g=c[u>>2]|0}c[m>>2]=h<<8&2147483392;g=g<<8;c[u>>2]=g;c[o>>2]=(c[o>>2]|0)+8}}while(0);w=(j|0)==2;g=a[E>>0]|0;h=g<<24>>24;b:do if(w){p=f+28|0;k=l>>>8;if(g<<24>>24>0){g=d[29396+(h+-1)>>0]|0;C=l-(_(k,g)|0)|0;m=f+32|0;c[m>>2]=(c[m>>2]|0)+C;g=_(k,g-(d[29396+h>>0]|0)|0)|0;c[p>>2]=g}else{g=l-(_(k,d[29396+h>>0]|0)|0)|0;c[p>>2]=g;m=f+32|0}n=f+36|0;o=f+20|0;q=f+40|0;r=f+24|0;s=f+8|0;t=f+4|0;u=f+44|0;while(1){if(g>>>0>=8388609){C=m;B=n;A=t;break b}h=c[m>>2]|0;l=h>>>23;if((l|0)==255)c[n>>2]=(c[n>>2]|0)+1;else{k=h>>>31;g=c[q>>2]|0;if((g|0)>-1){h=c[r>>2]|0;if((h+(c[s>>2]|0)|0)>>>0<(c[t>>2]|0)>>>0){c[r>>2]=h+1;a[(c[f>>2]|0)+h>>0]=g+k;g=0}else g=-1;c[u>>2]=c[u>>2]|g}g=c[n>>2]|0;if(g|0){k=k+255&255;do{h=c[r>>2]|0;if((h+(c[s>>2]|0)|0)>>>0<(c[t>>2]|0)>>>0){c[r>>2]=h+1;a[(c[f>>2]|0)+h>>0]=k;h=0;g=c[n>>2]|0}else h=-1;c[u>>2]=c[u>>2]|h;g=g+-1|0;c[n>>2]=g}while((g|0)!=0)}c[q>>2]=l&255;h=c[m>>2]|0;g=c[p>>2]|0}c[m>>2]=h<<8&2147483392;g=g<<8;c[p>>2]=g;c[o>>2]=(c[o>>2]|0)+8}}else{g=h>>3;h=a[D>>0]|0;p=f+28|0;k=l>>>8;if((g|0)>0){C=d[g+-1+(29372+(h<<3))>>0]|0;B=l-(_(k,C)|0)|0;m=f+32|0;c[m>>2]=(c[m>>2]|0)+B;g=_(k,C-(d[29372+(h<<3)+g>>0]|0)|0)|0;c[p>>2]=g}else{g=l-(_(k,d[29372+(h<<3)+g>>0]|0)|0)|0;c[p>>2]=g;m=f+32|0}n=f+36|0;o=f+20|0;q=f+40|0;r=f+24|0;s=f+8|0;t=f+4|0;u=f+44|0;while(1){if(g>>>0>=8388609)break;h=c[m>>2]|0;l=h>>>23;if((l|0)==255)c[n>>2]=(c[n>>2]|0)+1;else{k=h>>>31;g=c[q>>2]|0;if((g|0)>-1){h=c[r>>2]|0;if((h+(c[s>>2]|0)|0)>>>0<(c[t>>2]|0)>>>0){c[r>>2]=h+1;a[(c[f>>2]|0)+h>>0]=g+k;g=0}else g=-1;c[u>>2]=c[u>>2]|g}g=c[n>>2]|0;if(g|0){k=k+255&255;do{h=c[r>>2]|0;if((h+(c[s>>2]|0)|0)>>>0<(c[t>>2]|0)>>>0){c[r>>2]=h+1;a[(c[f>>2]|0)+h>>0]=k;h=0;g=c[n>>2]|0}else h=-1;c[u>>2]=c[u>>2]|h;g=g+-1|0;c[n>>2]=g}while((g|0)!=0)}c[q>>2]=l&255;h=c[m>>2]|0;g=c[p>>2]|0}c[m>>2]=h<<8&2147483392;g=g<<8;c[p>>2]=g;c[o>>2]=(c[o>>2]|0)+8}h=d[E>>0]&7;k=g>>>8;l=a[29962+h>>0]|0;if(!h)g=g-(_(k,l&255)|0)|0;else{C=d[29962+(h+-1)>>0]|0;g=g-(_(k,C)|0)|0;c[m>>2]=(c[m>>2]|0)+g;g=_(k,C-(l&255)|0)|0}c[p>>2]=g;while(1){if(g>>>0>=8388609){C=m;B=n;A=t;break b}h=c[m>>2]|0;l=h>>>23;if((l|0)==255)c[n>>2]=(c[n>>2]|0)+1;else{k=h>>>31;g=c[q>>2]|0;if((g|0)>-1){h=c[r>>2]|0;if((h+(c[s>>2]|0)|0)>>>0<(c[t>>2]|0)>>>0){c[r>>2]=h+1;a[(c[f>>2]|0)+h>>0]=g+k;g=0}else g=-1;c[u>>2]=c[u>>2]|g}g=c[n>>2]|0;if(g|0){k=k+255&255;do{h=c[r>>2]|0;if((h+(c[s>>2]|0)|0)>>>0<(c[t>>2]|0)>>>0){c[r>>2]=h+1;a[(c[f>>2]|0)+h>>0]=k;h=0;g=c[n>>2]|0}else h=-1;c[u>>2]=c[u>>2]|h;g=g+-1|0;c[n>>2]=g}while((g|0)!=0)}c[q>>2]=l&255;h=c[m>>2]|0;g=c[p>>2]|0}c[m>>2]=h<<8&2147483392;g=g<<8;c[p>>2]=g;c[o>>2]=(c[o>>2]|0)+8}}while(0);y=e+4672|0;m=1;while(1){if((m|0)>=(c[y>>2]|0))break;t=a[E+m>>0]|0;h=t<<24>>24;k=g>>>8;if(t<<24>>24>0){t=d[29396+(h+-1)>>0]|0;g=g-(_(k,t)|0)|0;c[C>>2]=(c[C>>2]|0)+g;g=_(k,t-(d[29396+h>>0]|0)|0)|0}else g=g-(_(k,d[29396+h>>0]|0)|0)|0;c[p>>2]=g;while(1){if(g>>>0>=8388609)break;h=c[C>>2]|0;l=h>>>23;if((l|0)==255)c[B>>2]=(c[B>>2]|0)+1;else{k=h>>>31;g=c[q>>2]|0;if((g|0)>-1){h=c[r>>2]|0;if((h+(c[s>>2]|0)|0)>>>0<(c[A>>2]|0)>>>0){c[r>>2]=h+1;a[(c[f>>2]|0)+h>>0]=g+k;g=0}else g=-1;c[u>>2]=c[u>>2]|g}g=c[B>>2]|0;if(g|0){k=k+255&255;do{h=c[r>>2]|0;if((h+(c[s>>2]|0)|0)>>>0<(c[A>>2]|0)>>>0){c[r>>2]=h+1;a[(c[f>>2]|0)+h>>0]=k;h=0;g=c[B>>2]|0}else h=-1;c[u>>2]=c[u>>2]|h;g=g+-1|0;c[B>>2]=g}while((g|0)!=0)}c[q>>2]=l&255;h=c[C>>2]|0;g=c[p>>2]|0}c[C>>2]=h<<8&2147483392;g=g<<8;c[p>>2]=g;c[o>>2]=(c[o>>2]|0)+8}m=m+1|0}m=E+8|0;n=a[m>>0]|0;h=n<<24>>24;t=e+4784|0;l=c[t>>2]|0;k=_(a[D>>0]>>1,b[l>>1]|0)|0;k=(c[l+16>>2]|0)+k|0;l=g>>>8;if(n<<24>>24>0){n=k+(h+-1)|0;g=g-(_(l,d[n>>0]|0)|0)|0;c[C>>2]=(c[C>>2]|0)+g;g=_(l,(d[n>>0]|0)-(d[k+h>>0]|0)|0)|0}else g=g-(_(l,d[k+h>>0]|0)|0)|0;c[p>>2]=g;while(1){if(g>>>0>=8388609)break;h=c[C>>2]|0;l=h>>>23;if((l|0)==255)c[B>>2]=(c[B>>2]|0)+1;else{k=h>>>31;g=c[q>>2]|0;if((g|0)>-1){h=c[r>>2]|0;if((h+(c[s>>2]|0)|0)>>>0<(c[A>>2]|0)>>>0){c[r>>2]=h+1;a[(c[f>>2]|0)+h>>0]=g+k;g=0}else g=-1;c[u>>2]=c[u>>2]|g}g=c[B>>2]|0;if(g|0){k=k+255&255;do{h=c[r>>2]|0;if((h+(c[s>>2]|0)|0)>>>0<(c[A>>2]|0)>>>0){c[r>>2]=h+1;a[(c[f>>2]|0)+h>>0]=k;h=0;g=c[B>>2]|0}else h=-1;c[u>>2]=c[u>>2]|h;g=g+-1|0;c[B>>2]=g}while((g|0)!=0)}c[q>>2]=l&255;h=c[C>>2]|0;g=c[p>>2]|0}c[C>>2]=h<<8&2147483392;g=g<<8;c[p>>2]=g;c[o>>2]=(c[o>>2]|0)+8}Cd(x,v,c[t>>2]|0,a[m>>0]|0);k=0;c:while(1){g=c[t>>2]|0;if((k|0)>=(b[g+2>>1]|0))break;n=k+1|0;m=E+8+n|0;h=a[m>>0]|0;if(h<<24>>24>3){g=(c[g+28>>2]|0)+(b[x+(k<<1)>>1]|0)|0;h=c[p>>2]|0;l=h>>>8;v=g+7|0;h=h-(_(l,d[v>>0]|0)|0)|0;h=(c[C>>2]|0)+h|0;c[C>>2]=h;g=_(l,(d[v>>0]|0)-(d[g+8>>0]|0)|0)|0;c[p>>2]=g;while(1){if(g>>>0>=8388609)break;l=h>>>23;if((l|0)==255)c[B>>2]=(c[B>>2]|0)+1;else{k=h>>>31;g=c[q>>2]|0;if((g|0)>-1){h=c[r>>2]|0;if((h+(c[s>>2]|0)|0)>>>0<(c[A>>2]|0)>>>0){c[r>>2]=h+1;a[(c[f>>2]|0)+h>>0]=g+k;g=0}else g=-1;c[u>>2]=c[u>>2]|g}g=c[B>>2]|0;if(g|0){k=k+255&255;do{h=c[r>>2]|0;if((h+(c[s>>2]|0)|0)>>>0<(c[A>>2]|0)>>>0){c[r>>2]=h+1;a[(c[f>>2]|0)+h>>0]=k;h=0;g=c[B>>2]|0}else h=-1;c[u>>2]=c[u>>2]|h;g=g+-1|0;c[B>>2]=g}while((g|0)!=0)}c[q>>2]=l&255;h=c[C>>2]|0;g=c[p>>2]|0}h=h<<8&2147483392;c[C>>2]=h;g=g<<8;c[p>>2]=g;c[o>>2]=(c[o>>2]|0)+8}v=a[m>>0]|0;k=v<<24>>24;l=k+-4|0;m=g>>>8;if(v<<24>>24>4){v=d[29970+(k+-5)>>0]|0;h=h+(g-(_(m,v)|0))|0;c[C>>2]=h;g=_(m,v-(d[29970+l>>0]|0)|0)|0}else g=g-(_(m,d[29970+l>>0]|0)|0)|0;c[p>>2]=g;while(1){if(g>>>0>=8388609){k=n;continue c}l=h>>>23;if((l|0)==255)c[B>>2]=(c[B>>2]|0)+1;else{k=h>>>31;g=c[q>>2]|0;if((g|0)>-1){h=c[r>>2]|0;if((h+(c[s>>2]|0)|0)>>>0<(c[A>>2]|0)>>>0){c[r>>2]=h+1;a[(c[f>>2]|0)+h>>0]=g+k;g=0}else g=-1;c[u>>2]=c[u>>2]|g}g=c[B>>2]|0;if(g|0){k=k+255&255;do{h=c[r>>2]|0;if((h+(c[s>>2]|0)|0)>>>0<(c[A>>2]|0)>>>0){c[r>>2]=h+1;a[(c[f>>2]|0)+h>>0]=k;h=0;g=c[B>>2]|0}else h=-1;c[u>>2]=c[u>>2]|h;g=g+-1|0;c[B>>2]=g}while((g|0)!=0)}c[q>>2]=l&255;h=c[C>>2]|0;g=c[p>>2]|0}h=h<<8&2147483392;c[C>>2]=h;g=g<<8;c[p>>2]=g;c[o>>2]=(c[o>>2]|0)+8}}if(h<<24>>24>=-3){v=h<<24>>24;g=(c[g+28>>2]|0)+(b[x+(k<<1)>>1]|0)|0;k=c[p>>2]|0;l=k>>>8;m=g+(v+3)|0;k=k-(_(l,d[m>>0]|0)|0)|0;c[C>>2]=(c[C>>2]|0)+k;g=_(l,(d[m>>0]|0)-(d[g+(v+4)>>0]|0)|0)|0;c[p>>2]=g;while(1){if(g>>>0>=8388609){k=n;continue c}h=c[C>>2]|0;l=h>>>23;if((l|0)==255)c[B>>2]=(c[B>>2]|0)+1;else{k=h>>>31;g=c[q>>2]|0;if((g|0)>-1){h=c[r>>2]|0;if((h+(c[s>>2]|0)|0)>>>0<(c[A>>2]|0)>>>0){c[r>>2]=h+1;a[(c[f>>2]|0)+h>>0]=g+k;g=0}else g=-1;c[u>>2]=c[u>>2]|g}g=c[B>>2]|0;if(g|0){k=k+255&255;do{h=c[r>>2]|0;if((h+(c[s>>2]|0)|0)>>>0<(c[A>>2]|0)>>>0){c[r>>2]=h+1;a[(c[f>>2]|0)+h>>0]=k;h=0;g=c[B>>2]|0}else h=-1;c[u>>2]=c[u>>2]|h;g=g+-1|0;c[B>>2]=g}while((g|0)!=0)}c[q>>2]=l&255;h=c[C>>2]|0;g=c[p>>2]|0}c[C>>2]=h<<8&2147483392;g=g<<8;c[p>>2]=g;c[o>>2]=(c[o>>2]|0)+8}}v=c[p>>2]|0;g=v-(_(v>>>8,d[(c[g+28>>2]|0)+(b[x+(k<<1)>>1]|0)>>0]|0)|0)|0;c[p>>2]=g;while(1){if(g>>>0>=8388609)break;h=c[C>>2]|0;l=h>>>23;if((l|0)==255)c[B>>2]=(c[B>>2]|0)+1;else{k=h>>>31;g=c[q>>2]|0;if((g|0)>-1){h=c[r>>2]|0;if((h+(c[s>>2]|0)|0)>>>0<(c[A>>2]|0)>>>0){c[r>>2]=h+1;a[(c[f>>2]|0)+h>>0]=g+k;g=0}else g=-1;c[u>>2]=c[u>>2]|g}g=c[B>>2]|0;if(g|0){k=k+255&255;do{h=c[r>>2]|0;if((h+(c[s>>2]|0)|0)>>>0<(c[A>>2]|0)>>>0){c[r>>2]=h+1;a[(c[f>>2]|0)+h>>0]=k;h=0;g=c[B>>2]|0}else h=-1;c[u>>2]=c[u>>2]|h;g=g+-1|0;c[B>>2]=g}while((g|0)!=0)}c[q>>2]=l&255;h=c[C>>2]|0;g=c[p>>2]|0}c[C>>2]=h<<8&2147483392;g=g<<8;c[p>>2]=g;c[o>>2]=(c[o>>2]|0)+8}h=-4-(a[m>>0]|0)|0;k=g>>>8;if((h|0)>0){v=d[29970+(h+-1)>>0]|0;g=g-(_(k,v)|0)|0;c[C>>2]=(c[C>>2]|0)+g;g=_(k,v-(d[29970+h>>0]|0)|0)|0}else g=g-(_(k,d[29970+h>>0]|0)|0)|0;c[p>>2]=g;while(1){if(g>>>0>=8388609){k=n;continue c}h=c[C>>2]|0;l=h>>>23;if((l|0)==255)c[B>>2]=(c[B>>2]|0)+1;else{k=h>>>31;g=c[q>>2]|0;if((g|0)>-1){h=c[r>>2]|0;if((h+(c[s>>2]|0)|0)>>>0<(c[A>>2]|0)>>>0){c[r>>2]=h+1;a[(c[f>>2]|0)+h>>0]=g+k;g=0}else g=-1;c[u>>2]=c[u>>2]|g}g=c[B>>2]|0;if(g|0){k=k+255&255;do{h=c[r>>2]|0;if((h+(c[s>>2]|0)|0)>>>0<(c[A>>2]|0)>>>0){c[r>>2]=h+1;a[(c[f>>2]|0)+h>>0]=k;h=0;g=c[B>>2]|0}else h=-1;c[u>>2]=c[u>>2]|h;g=g+-1|0;c[B>>2]=g}while((g|0)!=0)}c[q>>2]=l&255;h=c[C>>2]|0;g=c[p>>2]|0}c[C>>2]=h<<8&2147483392;g=g<<8;c[p>>2]=g;c[o>>2]=(c[o>>2]|0)+8}}d:do if((c[y>>2]|0)==4){x=a[E+31>>0]|0;g=x<<24>>24;h=c[p>>2]|0;k=h>>>8;if(x<<24>>24>0){x=d[29939+(g+-1)>>0]|0;v=h-(_(k,x)|0)|0;c[C>>2]=(c[C>>2]|0)+v;g=_(k,x-(d[29939+g>>0]|0)|0)|0}else g=h-(_(k,d[29939+g>>0]|0)|0)|0;c[p>>2]=g;while(1){if(g>>>0>=8388609)break d;h=c[C>>2]|0;l=h>>>23;if((l|0)==255)c[B>>2]=(c[B>>2]|0)+1;else{k=h>>>31;g=c[q>>2]|0;if((g|0)>-1){h=c[r>>2]|0;if((h+(c[s>>2]|0)|0)>>>0<(c[A>>2]|0)>>>0){c[r>>2]=h+1;a[(c[f>>2]|0)+h>>0]=g+k;g=0}else g=-1;c[u>>2]=c[u>>2]|g}g=c[B>>2]|0;if(g|0){k=k+255&255;do{h=c[r>>2]|0;if((h+(c[s>>2]|0)|0)>>>0<(c[A>>2]|0)>>>0){c[r>>2]=h+1;a[(c[f>>2]|0)+h>>0]=k;h=0;g=c[B>>2]|0}else h=-1;c[u>>2]=c[u>>2]|h;g=g+-1|0;c[B>>2]=g}while((g|0)!=0)}c[q>>2]=l&255;h=c[C>>2]|0;g=c[p>>2]|0}c[C>>2]=h<<8&2147483392;g=g<<8;c[p>>2]=g;c[o>>2]=(c[o>>2]|0)+8}}while(0);e:do if((a[D>>0]|0)==2){if(w?(c[e+5860>>2]|0)==2:0){h=E+26|0;g=e+5864|0;k=(b[h>>1]|0)-(b[g>>1]|0)|0;if((k+8|0)>>>0<=19){n=k+9|0;l=c[p>>2]|0;m=l>>>8;if((k|0)>-9){k=d[30009+(k+8)>>0]|0;t=l-(_(m,k)|0)|0;c[C>>2]=(c[C>>2]|0)+t;t=0;k=_(m,k-(d[30009+n>>0]|0)|0)|0}else{k=0;z=243}}else{l=c[p>>2]|0;m=l>>>8;n=0;k=1;z=243}if((z|0)==243){t=k;k=l-(_(m,d[30009+n>>0]|0)|0)|0}c[p>>2]=k;while(1){if(k>>>0>=8388609)break;l=c[C>>2]|0;n=l>>>23;if((n|0)==255)c[B>>2]=(c[B>>2]|0)+1;else{m=l>>>31;k=c[q>>2]|0;if((k|0)>-1){l=c[r>>2]|0;if((l+(c[s>>2]|0)|0)>>>0<(c[A>>2]|0)>>>0){c[r>>2]=l+1;a[(c[f>>2]|0)+l>>0]=k+m;k=0}else k=-1;c[u>>2]=c[u>>2]|k}k=c[B>>2]|0;if(k|0){m=m+255&255;do{l=c[r>>2]|0;if((l+(c[s>>2]|0)|0)>>>0<(c[A>>2]|0)>>>0){c[r>>2]=l+1;a[(c[f>>2]|0)+l>>0]=m;l=0;k=c[B>>2]|0}else l=-1;c[u>>2]=c[u>>2]|l;k=k+-1|0;c[B>>2]=k}while((k|0)!=0)}c[q>>2]=n&255;l=c[C>>2]|0;k=c[p>>2]|0}c[C>>2]=l<<8&2147483392;k=k<<8;c[p>>2]=k;c[o>>2]=(c[o>>2]|0)+8}if(t)z=260}else z=260;if((z|0)==260){h=E+26|0;k=b[h>>1]|0;n=c[e+4668>>2]|0;g=(k|0)/(n>>1|0)|0;n=k-(_(g<<16>>16,n<<15>>16)|0)|0;k=c[p>>2]|0;l=k>>>8;if((g|0)>0){z=d[29977+(g+-1)>>0]|0;x=k-(_(l,z)|0)|0;c[C>>2]=(c[C>>2]|0)+x;g=_(l,z-(d[29977+g>>0]|0)|0)|0}else g=k-(_(l,d[29977+g>>0]|0)|0)|0;c[p>>2]=g;while(1){if(g>>>0>=8388609)break;k=c[C>>2]|0;m=k>>>23;if((m|0)==255)c[B>>2]=(c[B>>2]|0)+1;else{l=k>>>31;g=c[q>>2]|0;if((g|0)>-1){k=c[r>>2]|0;if((k+(c[s>>2]|0)|0)>>>0<(c[A>>2]|0)>>>0){c[r>>2]=k+1;a[(c[f>>2]|0)+k>>0]=g+l;g=0}else g=-1;c[u>>2]=c[u>>2]|g}g=c[B>>2]|0;if(g|0){l=l+255&255;do{k=c[r>>2]|0;if((k+(c[s>>2]|0)|0)>>>0<(c[A>>2]|0)>>>0){c[r>>2]=k+1;a[(c[f>>2]|0)+k>>0]=l;k=0;g=c[B>>2]|0}else k=-1;c[u>>2]=c[u>>2]|k;g=g+-1|0;c[B>>2]=g}while((g|0)!=0)}c[q>>2]=m&255;k=c[C>>2]|0;g=c[p>>2]|0}c[C>>2]=k<<8&2147483392;g=g<<8;c[p>>2]=g;c[o>>2]=(c[o>>2]|0)+8}k=c[e+4776>>2]|0;l=g>>>8;if((n|0)>0){z=k+(n+-1)|0;g=g-(_(l,d[z>>0]|0)|0)|0;c[C>>2]=(c[C>>2]|0)+g;g=_(l,(d[z>>0]|0)-(d[k+n>>0]|0)|0)|0}else g=g-(_(l,d[k+n>>0]|0)|0)|0;c[p>>2]=g;while(1){if(g>>>0>=8388609)break;k=c[C>>2]|0;m=k>>>23;if((m|0)==255)c[B>>2]=(c[B>>2]|0)+1;else{l=k>>>31;g=c[q>>2]|0;if((g|0)>-1){k=c[r>>2]|0;if((k+(c[s>>2]|0)|0)>>>0<(c[A>>2]|0)>>>0){c[r>>2]=k+1;a[(c[f>>2]|0)+k>>0]=g+l;g=0}else g=-1;c[u>>2]=c[u>>2]|g}g=c[B>>2]|0;if(g|0){l=l+255&255;do{k=c[r>>2]|0;if((k+(c[s>>2]|0)|0)>>>0<(c[A>>2]|0)>>>0){c[r>>2]=k+1;a[(c[f>>2]|0)+k>>0]=l;k=0;g=c[B>>2]|0}else k=-1;c[u>>2]=c[u>>2]|k;g=g+-1|0;c[B>>2]=g}while((g|0)!=0)}c[q>>2]=m&255;k=c[C>>2]|0;g=c[p>>2]|0}c[C>>2]=k<<8&2147483392;g=g<<8;c[p>>2]=g;c[o>>2]=(c[o>>2]|0)+8}g=e+5864|0}b[g>>1]=b[h>>1]|0;z=a[E+28>>0]|0;g=z<<24>>24;h=c[e+4780>>2]|0;k=c[p>>2]|0;l=k>>>8;if(z<<24>>24>0){z=h+(g+-1)|0;x=k-(_(l,d[z>>0]|0)|0)|0;c[C>>2]=(c[C>>2]|0)+x;g=_(l,(d[z>>0]|0)-(d[h+g>>0]|0)|0)|0}else g=k-(_(l,d[h+g>>0]|0)|0)|0;c[p>>2]=g;while(1){if(g>>>0>=8388609)break;h=c[C>>2]|0;l=h>>>23;if((l|0)==255)c[B>>2]=(c[B>>2]|0)+1;else{k=h>>>31;g=c[q>>2]|0;if((g|0)>-1){h=c[r>>2]|0;if((h+(c[s>>2]|0)|0)>>>0<(c[A>>2]|0)>>>0){c[r>>2]=h+1;a[(c[f>>2]|0)+h>>0]=g+k;g=0}else g=-1;c[u>>2]=c[u>>2]|g}g=c[B>>2]|0;if(g|0){k=k+255&255;do{h=c[r>>2]|0;if((h+(c[s>>2]|0)|0)>>>0<(c[A>>2]|0)>>>0){c[r>>2]=h+1;a[(c[f>>2]|0)+h>>0]=k;h=0;g=c[B>>2]|0}else h=-1;c[u>>2]=c[u>>2]|h;g=g+-1|0;c[B>>2]=g}while((g|0)!=0)}c[q>>2]=l&255;h=c[C>>2]|0;g=c[p>>2]|0}c[C>>2]=h<<8&2147483392;g=g<<8;c[p>>2]=g;c[o>>2]=(c[o>>2]|0)+8}n=E+32|0;z=a[n>>0]|0;h=z<<24>>24;k=g>>>8;if(z<<24>>24>0){z=d[29437+(h+-1)>>0]|0;g=g-(_(k,z)|0)|0;c[C>>2]=(c[C>>2]|0)+g;g=_(k,z-(d[29437+h>>0]|0)|0)|0}else g=g-(_(k,d[29437+h>>0]|0)|0)|0;c[p>>2]=g;while(1){if(g>>>0>=8388609){l=g;m=0;break}h=c[C>>2]|0;l=h>>>23;if((l|0)==255)c[B>>2]=(c[B>>2]|0)+1;else{k=h>>>31;g=c[q>>2]|0;if((g|0)>-1){h=c[r>>2]|0;if((h+(c[s>>2]|0)|0)>>>0<(c[A>>2]|0)>>>0){c[r>>2]=h+1;a[(c[f>>2]|0)+h>>0]=g+k;g=0}else g=-1;c[u>>2]=c[u>>2]|g}g=c[B>>2]|0;if(g|0){k=k+255&255;do{h=c[r>>2]|0;if((h+(c[s>>2]|0)|0)>>>0<(c[A>>2]|0)>>>0){c[r>>2]=h+1;a[(c[f>>2]|0)+h>>0]=k;h=0;g=c[B>>2]|0}else h=-1;c[u>>2]=c[u>>2]|h;g=g+-1|0;c[B>>2]=g}while((g|0)!=0)}c[q>>2]=l&255;h=c[C>>2]|0;g=c[p>>2]|0}c[C>>2]=h<<8&2147483392;g=g<<8;c[p>>2]=g;c[o>>2]=(c[o>>2]|0)+8}while(1){if((m|0)>=(c[y>>2]|0))break;z=a[E+4+m>>0]|0;g=z<<24>>24;h=c[17376+(a[n>>0]<<2)>>2]|0;k=l>>>8;if(z<<24>>24>0){z=h+(g+-1)|0;x=l-(_(k,d[z>>0]|0)|0)|0;c[C>>2]=(c[C>>2]|0)+x;g=_(k,(d[z>>0]|0)-(d[h+g>>0]|0)|0)|0}else g=l-(_(k,d[h+g>>0]|0)|0)|0;c[p>>2]=g;while(1){if(g>>>0>=8388609)break;h=c[C>>2]|0;l=h>>>23;if((l|0)==255)c[B>>2]=(c[B>>2]|0)+1;else{k=h>>>31;g=c[q>>2]|0;if((g|0)>-1){h=c[r>>2]|0;if((h+(c[s>>2]|0)|0)>>>0<(c[A>>2]|0)>>>0){c[r>>2]=h+1;a[(c[f>>2]|0)+h>>0]=g+k;g=0}else g=-1;c[u>>2]=c[u>>2]|g}g=c[B>>2]|0;if(g|0){k=k+255&255;do{h=c[r>>2]|0;if((h+(c[s>>2]|0)|0)>>>0<(c[A>>2]|0)>>>0){c[r>>2]=h+1;a[(c[f>>2]|0)+h>>0]=k;h=0;g=c[B>>2]|0}else h=-1;c[u>>2]=c[u>>2]|h;g=g+-1|0;c[B>>2]=g}while((g|0)!=0)}c[q>>2]=l&255;h=c[C>>2]|0;g=c[p>>2]|0}c[C>>2]=h<<8&2147483392;g=g<<8;c[p>>2]=g;c[o>>2]=(c[o>>2]|0)+8}l=g;m=m+1|0}if(!j){j=a[E+33>>0]|0;g=j<<24>>24;h=l>>>8;if(j<<24>>24>0){j=d[29930+(g+-1)>>0]|0;z=l-(_(h,j)|0)|0;c[C>>2]=(c[C>>2]|0)+z;g=_(h,j-(d[29930+g>>0]|0)|0)|0}else g=l-(_(h,d[29930+g>>0]|0)|0)|0;c[p>>2]=g;while(1){if(g>>>0>=8388609)break e;h=c[C>>2]|0;l=h>>>23;if((l|0)==255)c[B>>2]=(c[B>>2]|0)+1;else{k=h>>>31;g=c[q>>2]|0;if((g|0)>-1){h=c[r>>2]|0;if((h+(c[s>>2]|0)|0)>>>0<(c[A>>2]|0)>>>0){c[r>>2]=h+1;a[(c[f>>2]|0)+h>>0]=g+k;g=0}else g=-1;c[u>>2]=c[u>>2]|g}g=c[B>>2]|0;if(g|0){k=k+255&255;do{h=c[r>>2]|0;if((h+(c[s>>2]|0)|0)>>>0<(c[A>>2]|0)>>>0){c[r>>2]=h+1;a[(c[f>>2]|0)+h>>0]=k;h=0;g=c[B>>2]|0}else h=-1;c[u>>2]=c[u>>2]|h;g=g+-1|0;c[B>>2]=g}while((g|0)!=0)}c[q>>2]=l&255;h=c[C>>2]|0;g=c[p>>2]|0}c[C>>2]=h<<8&2147483392;g=g<<8;c[p>>2]=g;c[o>>2]=(c[o>>2]|0)+8}}}while(0);c[e+5860>>2]=a[D>>0];e=a[E+34>>0]|0;g=e<<24>>24;h=c[p>>2]|0;k=h>>>8;if(e<<24>>24>0){e=d[29947+(g+-1)>>0]|0;E=h-(_(k,e)|0)|0;c[C>>2]=(c[C>>2]|0)+E;g=_(k,e-(d[29947+g>>0]|0)|0)|0}else g=h-(_(k,d[29947+g>>0]|0)|0)|0;c[p>>2]=g;while(1){if(g>>>0>=8388609)break;h=c[C>>2]|0;l=h>>>23;if((l|0)==255)c[B>>2]=(c[B>>2]|0)+1;else{k=h>>>31;g=c[q>>2]|0;if((g|0)>-1){h=c[r>>2]|0;if((h+(c[s>>2]|0)|0)>>>0<(c[A>>2]|0)>>>0){c[r>>2]=h+1;a[(c[f>>2]|0)+h>>0]=g+k;g=0}else g=-1;c[u>>2]=c[u>>2]|g}g=c[B>>2]|0;if(g|0){k=k+255&255;do{h=c[r>>2]|0;if((h+(c[s>>2]|0)|0)>>>0<(c[A>>2]|0)>>>0){c[r>>2]=h+1;a[(c[f>>2]|0)+h>>0]=k;h=0;g=c[B>>2]|0}else h=-1;c[u>>2]=c[u>>2]|h;g=g+-1|0;c[B>>2]=g}while((g|0)!=0)}c[q>>2]=l&255;h=c[C>>2]|0;g=c[p>>2]|0}c[C>>2]=h<<8&2147483392;g=g<<8;c[p>>2]=g;c[o>>2]=(c[o>>2]|0)+8}i=F;return}function Bd(b,e,f,g,h){b=b|0;e=e|0;f=f|0;g=g|0;h=h|0;var j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0;T=i;i=i+96|0;S=T+56|0;F=T+40|0;G=T+32|0;r=T;c[r>>2]=0;c[r+4>>2]=0;c[r+8>>2]=0;c[r+12>>2]=0;c[r+16>>2]=0;c[r+20>>2]=0;c[r+24>>2]=0;c[r+28>>2]=0;j=h>>4;if((j<<4|0)<(h|0)){j=j+1|0;k=g+h|0;l=k+16|0;do{a[k>>0]=0;k=k+1|0}while((k|0)<(l|0))}k=j<<4;E=i;i=i+((1*(k<<2)|0)+15&-16)|0;l=0;while(1){if((l|0)>=(k|0))break;P=a[g+l>>0]|0;R=P<<24>>24;c[E+(l<<2)>>2]=P<<24>>24>0?R:0-R|0;R=l|1;P=a[g+R>>0]|0;Q=P<<24>>24;c[E+(R<<2)>>2]=P<<24>>24>0?Q:0-Q|0;R=l|2;Q=a[g+R>>0]|0;P=Q<<24>>24;c[E+(R<<2)>>2]=Q<<24>>24>0?P:0-P|0;R=l|3;P=a[g+R>>0]|0;Q=P<<24>>24;c[E+(R<<2)>>2]=P<<24>>24>0?Q:0-Q|0;l=l+4|0}R=i;i=i+((1*(j<<2)|0)+15&-16)|0;H=i;i=i+((1*(j<<2)|0)+15&-16)|0;p=E;q=0;while(1){if((q|0)>=(j|0))break;n=H+(q<<2)|0;c[n>>2]=0;o=R+(q<<2)|0;l=0;a:while(1){if((l|0)<8){k=l<<1;k=(c[p+(k<<2)>>2]|0)+(c[p+((k|1)<<2)>>2]|0)|0;if((k|0)>8)m=1;else{c[r+(l<<2)>>2]=k;l=l+1|0;continue}}else m=0;l=0;while(1){if((l|0)>=4){k=0;break}k=l<<1;k=(c[r+(k<<2)>>2]|0)+(c[r+((k|1)<<2)>>2]|0)|0;if((k|0)>10){k=1;break}c[r+(l<<2)>>2]=k;l=l+1|0}m=m+k|0;l=0;while(1){if((l|0)>=2){k=0;break}k=l<<1;k=(c[r+(k<<2)>>2]|0)+(c[r+((k|1)<<2)>>2]|0)|0;if((k|0)>12){k=1;break}c[r+(l<<2)>>2]=k;l=l+1|0}m=m+k|0;l=0;while(1){if((l|0)>=1){k=0;break}k=l<<1;k=(c[r+(k<<2)>>2]|0)+(c[r+((k|1)<<2)>>2]|0)|0;if((k|0)>16){k=1;break}c[o+(l<<2)>>2]=k;l=l+1|0}if((m|0)==(0-k|0))break;c[n>>2]=(c[n>>2]|0)+1;k=0;while(1){if((k|0)==16){l=0;continue a}Q=p+(k<<2)|0;c[Q>>2]=c[Q>>2]>>1;k=k+1|0}}p=p+64|0;q=q+1|0}q=e>>1;t=0;n=0;o=2147483647;while(1){if((n|0)==9)break;l=30270+(n*18|0)+17|0;m=0;p=d[30450+(q*9|0)+n>>0]|0;while(1){if((m|0)>=(j|0))break;if((c[H+(m<<2)>>2]|0)>0)k=l;else k=(c[R+(m<<2)>>2]|0)+(30270+(n*18|0))|0;m=m+1|0;p=p+(d[k>>0]|0)|0}Q=(p|0)<(o|0);t=Q?n:t;n=n+1|0;o=Q?p:o}Q=b+28|0;k=c[Q>>2]|0;l=k>>>8;if((t|0)>0){P=d[t+-1+(30432+(q*9|0))>>0]|0;k=k-(_(l,P)|0)|0;I=b+32|0;c[I>>2]=(c[I>>2]|0)+k;k=_(l,P-(d[30432+(q*9|0)+t>>0]|0)|0)|0;c[Q>>2]=k}else{k=k-(_(l,d[30432+(q*9|0)+t>>0]|0)|0)|0;c[Q>>2]=k;I=b+32|0}J=b+36|0;K=b+20|0;L=b+40|0;M=b+24|0;N=b+8|0;O=b+4|0;P=b+44|0;while(1){if(k>>>0>=8388609)break;l=c[I>>2]|0;n=l>>>23;if((n|0)==255)c[J>>2]=(c[J>>2]|0)+1;else{m=l>>>31;k=c[L>>2]|0;if((k|0)>-1){l=c[M>>2]|0;if((l+(c[N>>2]|0)|0)>>>0<(c[O>>2]|0)>>>0){c[M>>2]=l+1;a[(c[b>>2]|0)+l>>0]=k+m;k=0}else k=-1;c[P>>2]=c[P>>2]|k}k=c[J>>2]|0;if(k|0){m=m+255&255;do{l=c[M>>2]|0;if((l+(c[N>>2]|0)|0)>>>0<(c[O>>2]|0)>>>0){c[M>>2]=l+1;a[(c[b>>2]|0)+l>>0]=m;l=0;k=c[J>>2]|0}else l=-1;c[P>>2]=c[P>>2]|l;k=k+-1|0;c[J>>2]=k}while((k|0)!=0)}c[L>>2]=n&255;l=c[I>>2]|0;k=c[Q>>2]|0}c[I>>2]=l<<8&2147483392;k=k<<8;c[Q>>2]=k;c[K>>2]=(c[K>>2]|0)+8}r=30090+(t*18|0)+16|0;s=30090+(t*18|0)+17|0;q=0;while(1){if((q|0)>=(j|0))break;o=c[H+(q<<2)>>2]|0;b:do if(!o){l=c[R+(q<<2)>>2]|0;m=k>>>8;if((l|0)>0){D=d[l+-1+(30090+(t*18|0))>>0]|0;k=k-(_(m,D)|0)|0;c[I>>2]=(c[I>>2]|0)+k;k=_(m,D-(d[30090+(t*18|0)+l>>0]|0)|0)|0}else k=k-(_(m,d[30090+(t*18|0)+l>>0]|0)|0)|0;c[Q>>2]=k;while(1){if(k>>>0>=8388609)break b;l=c[I>>2]|0;n=l>>>23;if((n|0)==255)c[J>>2]=(c[J>>2]|0)+1;else{m=l>>>31;k=c[L>>2]|0;if((k|0)>-1){l=c[M>>2]|0;if((l+(c[N>>2]|0)|0)>>>0<(c[O>>2]|0)>>>0){c[M>>2]=l+1;a[(c[b>>2]|0)+l>>0]=k+m;k=0}else k=-1;c[P>>2]=c[P>>2]|k}k=c[J>>2]|0;if(k|0){m=m+255&255;do{l=c[M>>2]|0;if((l+(c[N>>2]|0)|0)>>>0<(c[O>>2]|0)>>>0){c[M>>2]=l+1;a[(c[b>>2]|0)+l>>0]=m;l=0;k=c[J>>2]|0}else l=-1;c[P>>2]=c[P>>2]|l;k=k+-1|0;c[J>>2]=k}while((k|0)!=0)}c[L>>2]=n&255;l=c[I>>2]|0;k=c[Q>>2]|0}c[I>>2]=l<<8&2147483392;k=k<<8;c[Q>>2]=k;c[K>>2]=(c[K>>2]|0)+8}}else{C=k>>>8;D=d[r>>0]|0;l=k-(_(C,D)|0)|0;l=(c[I>>2]|0)+l|0;c[I>>2]=l;k=_(C,D-(d[s>>0]|0)|0)|0;c[Q>>2]=k;while(1){if(k>>>0>=8388609)break;n=l>>>23;if((n|0)==255)c[J>>2]=(c[J>>2]|0)+1;else{m=l>>>31;k=c[L>>2]|0;if((k|0)>-1){l=c[M>>2]|0;if((l+(c[N>>2]|0)|0)>>>0<(c[O>>2]|0)>>>0){c[M>>2]=l+1;a[(c[b>>2]|0)+l>>0]=k+m;k=0}else k=-1;c[P>>2]=c[P>>2]|k}k=c[J>>2]|0;if(k|0){m=m+255&255;do{l=c[M>>2]|0;if((l+(c[N>>2]|0)|0)>>>0<(c[O>>2]|0)>>>0){c[M>>2]=l+1;a[(c[b>>2]|0)+l>>0]=m;l=0;k=c[J>>2]|0}else l=-1;c[P>>2]=c[P>>2]|l;k=k+-1|0;c[J>>2]=k}while((k|0)!=0)}c[L>>2]=n&255;l=c[I>>2]|0;k=c[Q>>2]|0}l=l<<8&2147483392;c[I>>2]=l;k=k<<8;c[Q>>2]=k;c[K>>2]=(c[K>>2]|0)+8}p=o+-1|0;o=0;while(1){if((o|0)>=(p|0))break;D=k>>>8<<1;l=l+(k-D)|0;c[I>>2]=l;c[Q>>2]=D;k=D;while(1){if(k>>>0>=8388609)break;n=l>>>23;if((n|0)==255)c[J>>2]=(c[J>>2]|0)+1;else{m=l>>>31;k=c[L>>2]|0;if((k|0)>-1){l=c[M>>2]|0;if((l+(c[N>>2]|0)|0)>>>0<(c[O>>2]|0)>>>0){c[M>>2]=l+1;a[(c[b>>2]|0)+l>>0]=k+m;k=0}else k=-1;c[P>>2]=c[P>>2]|k}k=c[J>>2]|0;if(k|0){m=m+255&255;do{l=c[M>>2]|0;if((l+(c[N>>2]|0)|0)>>>0<(c[O>>2]|0)>>>0){c[M>>2]=l+1;a[(c[b>>2]|0)+l>>0]=m;l=0;k=c[J>>2]|0}else l=-1;c[P>>2]=c[P>>2]|l;k=k+-1|0;c[J>>2]=k}while((k|0)!=0)}c[L>>2]=n&255;l=c[I>>2]|0;k=c[Q>>2]|0}l=l<<8&2147483392;c[I>>2]=l;k=k<<8;c[Q>>2]=k;c[K>>2]=(c[K>>2]|0)+8}o=o+1|0}m=c[R+(q<<2)>>2]|0;n=k>>>8;if((m|0)>0){D=d[30252+(m+-1)>>0]|0;l=l+(k-(_(n,D)|0))|0;c[I>>2]=l;k=_(n,D-(d[30252+m>>0]|0)|0)|0}else k=k-(_(n,d[30252+m>>0]|0)|0)|0;c[Q>>2]=k;while(1){if(k>>>0>=8388609)break b;n=l>>>23;if((n|0)==255)c[J>>2]=(c[J>>2]|0)+1;else{m=l>>>31;k=c[L>>2]|0;if((k|0)>-1){l=c[M>>2]|0;if((l+(c[N>>2]|0)|0)>>>0<(c[O>>2]|0)>>>0){c[M>>2]=l+1;a[(c[b>>2]|0)+l>>0]=k+m;k=0}else k=-1;c[P>>2]=c[P>>2]|k}k=c[J>>2]|0;if(k|0){m=m+255&255;do{l=c[M>>2]|0;if((l+(c[N>>2]|0)|0)>>>0<(c[O>>2]|0)>>>0){c[M>>2]=l+1;a[(c[b>>2]|0)+l>>0]=m;l=0;k=c[J>>2]|0}else l=-1;c[P>>2]=c[P>>2]|l;k=k+-1|0;c[J>>2]=k}while((k|0)!=0)}c[L>>2]=n&255;l=c[I>>2]|0;k=c[Q>>2]|0}l=l<<8&2147483392;c[I>>2]=l;k=k<<8;c[Q>>2]=k;c[K>>2]=(c[K>>2]|0)+8}}while(0);q=q+1|0}t=S+4|0;u=S+8|0;v=F+4|0;w=S+12|0;x=F+8|0;y=G+4|0;z=S+16|0;A=S+20|0;B=S+24|0;C=F+12|0;D=S+28|0;s=0;l=0;while(1){if((s|0)>=(j|0)){t=0;break}if((c[R+(s<<2)>>2]|0)>0){r=E+(s<<4<<2)|0;m=0;while(1){if((m|0)==8){m=0;break}q=m<<1;c[S+(m<<2)>>2]=(c[r+(q<<2)>>2]|0)+(c[r+((q|1)<<2)>>2]|0);m=m+1|0}while(1){if((m|0)==4){m=0;break}q=m<<1;c[F+(m<<2)>>2]=(c[S+(q<<2)>>2]|0)+(c[S+((q|1)<<2)>>2]|0);m=m+1|0}while(1){if((m|0)==2){m=0;break}q=m<<1;c[G+(m<<2)>>2]=(c[F+(q<<2)>>2]|0)+(c[F+((q|1)<<2)>>2]|0);m=m+1|0}while(1){if((m|0)==1)break;l=m<<1;m=m+1|0;l=(c[G+(l<<2)>>2]|0)+(c[G+((l|1)<<2)>>2]|0)|0}p=c[G>>2]|0;c:do if((l|0)>0){m=30924+(d[31076+l>>0]|0)|0;n=k>>>8;if((p|0)>0){q=d[m+(p+-1)>>0]|0;k=k-(_(n,q)|0)|0;c[I>>2]=(c[I>>2]|0)+k;k=_(n,q-(d[m+p>>0]|0)|0)|0}else k=k-(_(n,d[m+p>>0]|0)|0)|0;c[Q>>2]=k;while(1){if(k>>>0>=8388609)break c;m=c[I>>2]|0;o=m>>>23;if((o|0)==255)c[J>>2]=(c[J>>2]|0)+1;else{n=m>>>31;k=c[L>>2]|0;if((k|0)>-1){m=c[M>>2]|0;if((m+(c[N>>2]|0)|0)>>>0<(c[O>>2]|0)>>>0){c[M>>2]=m+1;a[(c[b>>2]|0)+m>>0]=k+n;k=0}else k=-1;c[P>>2]=c[P>>2]|k}k=c[J>>2]|0;if(k|0){n=n+255&255;do{m=c[M>>2]|0;if((m+(c[N>>2]|0)|0)>>>0<(c[O>>2]|0)>>>0){c[M>>2]=m+1;a[(c[b>>2]|0)+m>>0]=n;m=0;k=c[J>>2]|0}else m=-1;c[P>>2]=c[P>>2]|m;k=k+-1|0;c[J>>2]=k}while((k|0)!=0)}c[L>>2]=o&255;m=c[I>>2]|0;k=c[Q>>2]|0}c[I>>2]=m<<8&2147483392;k=k<<8;c[Q>>2]=k;c[K>>2]=(c[K>>2]|0)+8}}while(0);q=c[F>>2]|0;d:do if((p|0)>0){m=30772+(d[31076+p>>0]|0)|0;n=k>>>8;if((q|0)>0){p=d[m+(q+-1)>>0]|0;k=k-(_(n,p)|0)|0;c[I>>2]=(c[I>>2]|0)+k;k=_(n,p-(d[m+q>>0]|0)|0)|0}else k=k-(_(n,d[m+q>>0]|0)|0)|0;c[Q>>2]=k;while(1){if(k>>>0>=8388609)break d;m=c[I>>2]|0;o=m>>>23;if((o|0)==255)c[J>>2]=(c[J>>2]|0)+1;else{n=m>>>31;k=c[L>>2]|0;if((k|0)>-1){m=c[M>>2]|0;if((m+(c[N>>2]|0)|0)>>>0<(c[O>>2]|0)>>>0){c[M>>2]=m+1;a[(c[b>>2]|0)+m>>0]=k+n;k=0}else k=-1;c[P>>2]=c[P>>2]|k}k=c[J>>2]|0;if(k|0){n=n+255&255;do{m=c[M>>2]|0;if((m+(c[N>>2]|0)|0)>>>0<(c[O>>2]|0)>>>0){c[M>>2]=m+1;a[(c[b>>2]|0)+m>>0]=n;m=0;k=c[J>>2]|0}else m=-1;c[P>>2]=c[P>>2]|m;k=k+-1|0;c[J>>2]=k}while((k|0)!=0)}c[L>>2]=o&255;m=c[I>>2]|0;k=c[Q>>2]|0}c[I>>2]=m<<8&2147483392;k=k<<8;c[Q>>2]=k;c[K>>2]=(c[K>>2]|0)+8}}while(0);p=c[S>>2]|0;e:do if((q|0)>0){m=30620+(d[31076+q>>0]|0)|0;n=k>>>8;if((p|0)>0){q=d[m+(p+-1)>>0]|0;k=k-(_(n,q)|0)|0;c[I>>2]=(c[I>>2]|0)+k;k=_(n,q-(d[m+p>>0]|0)|0)|0}else k=k-(_(n,d[m+p>>0]|0)|0)|0;c[Q>>2]=k;while(1){if(k>>>0>=8388609)break e;m=c[I>>2]|0;o=m>>>23;if((o|0)==255)c[J>>2]=(c[J>>2]|0)+1;else{n=m>>>31;k=c[L>>2]|0;if((k|0)>-1){m=c[M>>2]|0;if((m+(c[N>>2]|0)|0)>>>0<(c[O>>2]|0)>>>0){c[M>>2]=m+1;a[(c[b>>2]|0)+m>>0]=k+n;k=0}else k=-1;c[P>>2]=c[P>>2]|k}k=c[J>>2]|0;if(k|0){n=n+255&255;do{m=c[M>>2]|0;if((m+(c[N>>2]|0)|0)>>>0<(c[O>>2]|0)>>>0){c[M>>2]=m+1;a[(c[b>>2]|0)+m>>0]=n;m=0;k=c[J>>2]|0}else m=-1;c[P>>2]=c[P>>2]|m;k=k+-1|0;c[J>>2]=k}while((k|0)!=0)}c[L>>2]=o&255;m=c[I>>2]|0;k=c[Q>>2]|0}c[I>>2]=m<<8&2147483392;k=k<<8;c[Q>>2]=k;c[K>>2]=(c[K>>2]|0)+8}}while(0);o=c[r>>2]|0;f:do if((p|0)>0){m=30468+(d[31076+p>>0]|0)|0;n=k>>>8;if((o|0)>0){q=d[m+(o+-1)>>0]|0;k=k-(_(n,q)|0)|0;c[I>>2]=(c[I>>2]|0)+k;k=_(n,q-(d[m+o>>0]|0)|0)|0}else k=k-(_(n,d[m+o>>0]|0)|0)|0;c[Q>>2]=k;while(1){if(k>>>0>=8388609)break f;m=c[I>>2]|0;o=m>>>23;if((o|0)==255)c[J>>2]=(c[J>>2]|0)+1;else{n=m>>>31;k=c[L>>2]|0;if((k|0)>-1){m=c[M>>2]|0;if((m+(c[N>>2]|0)|0)>>>0<(c[O>>2]|0)>>>0){c[M>>2]=m+1;a[(c[b>>2]|0)+m>>0]=k+n;k=0}else k=-1;c[P>>2]=c[P>>2]|k}k=c[J>>2]|0;if(k|0){n=n+255&255;do{m=c[M>>2]|0;if((m+(c[N>>2]|0)|0)>>>0<(c[O>>2]|0)>>>0){c[M>>2]=m+1;a[(c[b>>2]|0)+m>>0]=n;m=0;k=c[J>>2]|0}else m=-1;c[P>>2]=c[P>>2]|m;k=k+-1|0;c[J>>2]=k}while((k|0)!=0)}c[L>>2]=o&255;m=c[I>>2]|0;k=c[Q>>2]|0}c[I>>2]=m<<8&2147483392;k=k<<8;c[Q>>2]=k;c[K>>2]=(c[K>>2]|0)+8}}while(0);o=c[r+8>>2]|0;m=c[t>>2]|0;g:do if((m|0)>0){m=30468+(d[31076+m>>0]|0)|0;n=k>>>8;if((o|0)>0){q=d[m+(o+-1)>>0]|0;k=k-(_(n,q)|0)|0;c[I>>2]=(c[I>>2]|0)+k;k=_(n,q-(d[m+o>>0]|0)|0)|0}else k=k-(_(n,d[m+o>>0]|0)|0)|0;c[Q>>2]=k;while(1){if(k>>>0>=8388609)break g;m=c[I>>2]|0;o=m>>>23;if((o|0)==255)c[J>>2]=(c[J>>2]|0)+1;else{n=m>>>31;k=c[L>>2]|0;if((k|0)>-1){m=c[M>>2]|0;if((m+(c[N>>2]|0)|0)>>>0<(c[O>>2]|0)>>>0){c[M>>2]=m+1;a[(c[b>>2]|0)+m>>0]=k+n;k=0}else k=-1;c[P>>2]=c[P>>2]|k}k=c[J>>2]|0;if(k|0){n=n+255&255;do{m=c[M>>2]|0;if((m+(c[N>>2]|0)|0)>>>0<(c[O>>2]|0)>>>0){c[M>>2]=m+1;a[(c[b>>2]|0)+m>>0]=n;m=0;k=c[J>>2]|0}else m=-1;c[P>>2]=c[P>>2]|m;k=k+-1|0;c[J>>2]=k}while((k|0)!=0)}c[L>>2]=o&255;m=c[I>>2]|0;k=c[Q>>2]|0}c[I>>2]=m<<8&2147483392;k=k<<8;c[Q>>2]=k;c[K>>2]=(c[K>>2]|0)+8}}while(0);p=c[u>>2]|0;m=c[v>>2]|0;h:do if((m|0)>0){m=30620+(d[31076+m>>0]|0)|0;n=k>>>8;if((p|0)>0){q=d[m+(p+-1)>>0]|0;k=k-(_(n,q)|0)|0;c[I>>2]=(c[I>>2]|0)+k;k=_(n,q-(d[m+p>>0]|0)|0)|0}else k=k-(_(n,d[m+p>>0]|0)|0)|0;c[Q>>2]=k;while(1){if(k>>>0>=8388609)break h;m=c[I>>2]|0;o=m>>>23;if((o|0)==255)c[J>>2]=(c[J>>2]|0)+1;else{n=m>>>31;k=c[L>>2]|0;if((k|0)>-1){m=c[M>>2]|0;if((m+(c[N>>2]|0)|0)>>>0<(c[O>>2]|0)>>>0){c[M>>2]=m+1;a[(c[b>>2]|0)+m>>0]=k+n;k=0}else k=-1;c[P>>2]=c[P>>2]|k}k=c[J>>2]|0;if(k|0){n=n+255&255;do{m=c[M>>2]|0;if((m+(c[N>>2]|0)|0)>>>0<(c[O>>2]|0)>>>0){c[M>>2]=m+1;a[(c[b>>2]|0)+m>>0]=n;m=0;k=c[J>>2]|0}else m=-1;c[P>>2]=c[P>>2]|m;k=k+-1|0;c[J>>2]=k}while((k|0)!=0)}c[L>>2]=o&255;m=c[I>>2]|0;k=c[Q>>2]|0}c[I>>2]=m<<8&2147483392;k=k<<8;c[Q>>2]=k;c[K>>2]=(c[K>>2]|0)+8}}while(0);o=c[r+16>>2]|0;i:do if((p|0)>0){m=30468+(d[31076+p>>0]|0)|0;n=k>>>8;if((o|0)>0){q=d[m+(o+-1)>>0]|0;k=k-(_(n,q)|0)|0;c[I>>2]=(c[I>>2]|0)+k;k=_(n,q-(d[m+o>>0]|0)|0)|0}else k=k-(_(n,d[m+o>>0]|0)|0)|0;c[Q>>2]=k;while(1){if(k>>>0>=8388609)break i;m=c[I>>2]|0;o=m>>>23;if((o|0)==255)c[J>>2]=(c[J>>2]|0)+1;else{n=m>>>31;k=c[L>>2]|0;if((k|0)>-1){m=c[M>>2]|0;if((m+(c[N>>2]|0)|0)>>>0<(c[O>>2]|0)>>>0){c[M>>2]=m+1;a[(c[b>>2]|0)+m>>0]=k+n;k=0}else k=-1;c[P>>2]=c[P>>2]|k}k=c[J>>2]|0;if(k|0){n=n+255&255;do{m=c[M>>2]|0;if((m+(c[N>>2]|0)|0)>>>0<(c[O>>2]|0)>>>0){c[M>>2]=m+1;a[(c[b>>2]|0)+m>>0]=n;m=0;k=c[J>>2]|0}else m=-1;c[P>>2]=c[P>>2]|m;k=k+-1|0;c[J>>2]=k}while((k|0)!=0)}c[L>>2]=o&255;m=c[I>>2]|0;k=c[Q>>2]|0}c[I>>2]=m<<8&2147483392;k=k<<8;c[Q>>2]=k;c[K>>2]=(c[K>>2]|0)+8}}while(0);o=c[r+24>>2]|0;m=c[w>>2]|0;j:do if((m|0)>0){m=30468+(d[31076+m>>0]|0)|0;n=k>>>8;if((o|0)>0){q=d[m+(o+-1)>>0]|0;k=k-(_(n,q)|0)|0;c[I>>2]=(c[I>>2]|0)+k;k=_(n,q-(d[m+o>>0]|0)|0)|0}else k=k-(_(n,d[m+o>>0]|0)|0)|0;c[Q>>2]=k;while(1){if(k>>>0>=8388609)break j;m=c[I>>2]|0;o=m>>>23;if((o|0)==255)c[J>>2]=(c[J>>2]|0)+1;else{n=m>>>31;k=c[L>>2]|0;if((k|0)>-1){m=c[M>>2]|0;if((m+(c[N>>2]|0)|0)>>>0<(c[O>>2]|0)>>>0){c[M>>2]=m+1;a[(c[b>>2]|0)+m>>0]=k+n;k=0}else k=-1;c[P>>2]=c[P>>2]|k}k=c[J>>2]|0;if(k|0){n=n+255&255;do{m=c[M>>2]|0;if((m+(c[N>>2]|0)|0)>>>0<(c[O>>2]|0)>>>0){c[M>>2]=m+1;a[(c[b>>2]|0)+m>>0]=n;m=0;k=c[J>>2]|0}else m=-1;c[P>>2]=c[P>>2]|m;k=k+-1|0;c[J>>2]=k}while((k|0)!=0)}c[L>>2]=o&255;m=c[I>>2]|0;k=c[Q>>2]|0}c[I>>2]=m<<8&2147483392;k=k<<8;c[Q>>2]=k;c[K>>2]=(c[K>>2]|0)+8}}while(0);p=c[x>>2]|0;m=c[y>>2]|0;k:do if((m|0)>0){m=30772+(d[31076+m>>0]|0)|0;n=k>>>8;if((p|0)>0){q=d[m+(p+-1)>>0]|0;k=k-(_(n,q)|0)|0;c[I>>2]=(c[I>>2]|0)+k;k=_(n,q-(d[m+p>>0]|0)|0)|0}else k=k-(_(n,d[m+p>>0]|0)|0)|0;c[Q>>2]=k;while(1){if(k>>>0>=8388609)break k;m=c[I>>2]|0;o=m>>>23;if((o|0)==255)c[J>>2]=(c[J>>2]|0)+1;else{n=m>>>31;k=c[L>>2]|0;if((k|0)>-1){m=c[M>>2]|0;if((m+(c[N>>2]|0)|0)>>>0<(c[O>>2]|0)>>>0){c[M>>2]=m+1;a[(c[b>>2]|0)+m>>0]=k+n;k=0}else k=-1;c[P>>2]=c[P>>2]|k}k=c[J>>2]|0;if(k|0){n=n+255&255;do{m=c[M>>2]|0;if((m+(c[N>>2]|0)|0)>>>0<(c[O>>2]|0)>>>0){c[M>>2]=m+1;a[(c[b>>2]|0)+m>>0]=n;m=0;k=c[J>>2]|0}else m=-1;c[P>>2]=c[P>>2]|m;k=k+-1|0;c[J>>2]=k}while((k|0)!=0)}c[L>>2]=o&255;m=c[I>>2]|0;k=c[Q>>2]|0}c[I>>2]=m<<8&2147483392;k=k<<8;c[Q>>2]=k;c[K>>2]=(c[K>>2]|0)+8}}while(0);q=c[z>>2]|0;l:do if((p|0)>0){m=30620+(d[31076+p>>0]|0)|0;n=k>>>8;if((q|0)>0){p=d[m+(q+-1)>>0]|0;k=k-(_(n,p)|0)|0;c[I>>2]=(c[I>>2]|0)+k;k=_(n,p-(d[m+q>>0]|0)|0)|0}else k=k-(_(n,d[m+q>>0]|0)|0)|0;c[Q>>2]=k;while(1){if(k>>>0>=8388609)break l;m=c[I>>2]|0;o=m>>>23;if((o|0)==255)c[J>>2]=(c[J>>2]|0)+1;else{n=m>>>31;k=c[L>>2]|0;if((k|0)>-1){m=c[M>>2]|0;if((m+(c[N>>2]|0)|0)>>>0<(c[O>>2]|0)>>>0){c[M>>2]=m+1;a[(c[b>>2]|0)+m>>0]=k+n;k=0}else k=-1;c[P>>2]=c[P>>2]|k}k=c[J>>2]|0;if(k|0){n=n+255&255;do{m=c[M>>2]|0;if((m+(c[N>>2]|0)|0)>>>0<(c[O>>2]|0)>>>0){c[M>>2]=m+1;a[(c[b>>2]|0)+m>>0]=n;m=0;k=c[J>>2]|0}else m=-1;c[P>>2]=c[P>>2]|m;k=k+-1|0;c[J>>2]=k}while((k|0)!=0)}c[L>>2]=o&255;m=c[I>>2]|0;k=c[Q>>2]|0}c[I>>2]=m<<8&2147483392;k=k<<8;c[Q>>2]=k;c[K>>2]=(c[K>>2]|0)+8}}while(0);o=c[r+32>>2]|0;m:do if((q|0)>0){m=30468+(d[31076+q>>0]|0)|0;n=k>>>8;if((o|0)>0){q=d[m+(o+-1)>>0]|0;k=k-(_(n,q)|0)|0;c[I>>2]=(c[I>>2]|0)+k;k=_(n,q-(d[m+o>>0]|0)|0)|0}else k=k-(_(n,d[m+o>>0]|0)|0)|0;c[Q>>2]=k;while(1){if(k>>>0>=8388609)break m;m=c[I>>2]|0;o=m>>>23;if((o|0)==255)c[J>>2]=(c[J>>2]|0)+1;else{n=m>>>31;k=c[L>>2]|0;if((k|0)>-1){m=c[M>>2]|0;if((m+(c[N>>2]|0)|0)>>>0<(c[O>>2]|0)>>>0){c[M>>2]=m+1;a[(c[b>>2]|0)+m>>0]=k+n;k=0}else k=-1;c[P>>2]=c[P>>2]|k}k=c[J>>2]|0;if(k|0){n=n+255&255;do{m=c[M>>2]|0;if((m+(c[N>>2]|0)|0)>>>0<(c[O>>2]|0)>>>0){c[M>>2]=m+1;a[(c[b>>2]|0)+m>>0]=n;m=0;k=c[J>>2]|0}else m=-1;c[P>>2]=c[P>>2]|m;k=k+-1|0;c[J>>2]=k}while((k|0)!=0)}c[L>>2]=o&255;m=c[I>>2]|0;k=c[Q>>2]|0}c[I>>2]=m<<8&2147483392;k=k<<8;c[Q>>2]=k;c[K>>2]=(c[K>>2]|0)+8}}while(0);o=c[r+40>>2]|0;m=c[A>>2]|0;n:do if((m|0)>0){m=30468+(d[31076+m>>0]|0)|0;n=k>>>8;if((o|0)>0){q=d[m+(o+-1)>>0]|0;k=k-(_(n,q)|0)|0;c[I>>2]=(c[I>>2]|0)+k;k=_(n,q-(d[m+o>>0]|0)|0)|0}else k=k-(_(n,d[m+o>>0]|0)|0)|0;c[Q>>2]=k;while(1){if(k>>>0>=8388609)break n;m=c[I>>2]|0;o=m>>>23;if((o|0)==255)c[J>>2]=(c[J>>2]|0)+1;else{n=m>>>31;k=c[L>>2]|0;if((k|0)>-1){m=c[M>>2]|0;if((m+(c[N>>2]|0)|0)>>>0<(c[O>>2]|0)>>>0){c[M>>2]=m+1;a[(c[b>>2]|0)+m>>0]=k+n;k=0}else k=-1;c[P>>2]=c[P>>2]|k}k=c[J>>2]|0;if(k|0){n=n+255&255;do{m=c[M>>2]|0;if((m+(c[N>>2]|0)|0)>>>0<(c[O>>2]|0)>>>0){c[M>>2]=m+1;a[(c[b>>2]|0)+m>>0]=n;m=0;k=c[J>>2]|0}else m=-1;c[P>>2]=c[P>>2]|m;k=k+-1|0;c[J>>2]=k}while((k|0)!=0)}c[L>>2]=o&255;m=c[I>>2]|0;k=c[Q>>2]|0}c[I>>2]=m<<8&2147483392;k=k<<8;c[Q>>2]=k;c[K>>2]=(c[K>>2]|0)+8}}while(0);p=c[B>>2]|0;m=c[C>>2]|0;o:do if((m|0)>0){m=30620+(d[31076+m>>0]|0)|0;n=k>>>8;if((p|0)>0){q=d[m+(p+-1)>>0]|0;k=k-(_(n,q)|0)|0;c[I>>2]=(c[I>>2]|0)+k;k=_(n,q-(d[m+p>>0]|0)|0)|0}else k=k-(_(n,d[m+p>>0]|0)|0)|0;c[Q>>2]=k;while(1){if(k>>>0>=8388609)break o;m=c[I>>2]|0;o=m>>>23;if((o|0)==255)c[J>>2]=(c[J>>2]|0)+1;else{n=m>>>31;k=c[L>>2]|0;if((k|0)>-1){m=c[M>>2]|0;if((m+(c[N>>2]|0)|0)>>>0<(c[O>>2]|0)>>>0){c[M>>2]=m+1;a[(c[b>>2]|0)+m>>0]=k+n;k=0}else k=-1;c[P>>2]=c[P>>2]|k}k=c[J>>2]|0;if(k|0){n=n+255&255;do{m=c[M>>2]|0;if((m+(c[N>>2]|0)|0)>>>0<(c[O>>2]|0)>>>0){c[M>>2]=m+1;a[(c[b>>2]|0)+m>>0]=n;m=0;k=c[J>>2]|0}else m=-1;c[P>>2]=c[P>>2]|m;k=k+-1|0;c[J>>2]=k}while((k|0)!=0)}c[L>>2]=o&255;m=c[I>>2]|0;k=c[Q>>2]|0}c[I>>2]=m<<8&2147483392;k=k<<8;c[Q>>2]=k;c[K>>2]=(c[K>>2]|0)+8}}while(0);o=c[r+48>>2]|0;p:do if((p|0)>0){m=30468+(d[31076+p>>0]|0)|0;n=k>>>8;if((o|0)>0){q=d[m+(o+-1)>>0]|0;k=k-(_(n,q)|0)|0;c[I>>2]=(c[I>>2]|0)+k;k=_(n,q-(d[m+o>>0]|0)|0)|0}else k=k-(_(n,d[m+o>>0]|0)|0)|0;c[Q>>2]=k;while(1){if(k>>>0>=8388609)break p;m=c[I>>2]|0;o=m>>>23;if((o|0)==255)c[J>>2]=(c[J>>2]|0)+1;else{n=m>>>31;k=c[L>>2]|0;if((k|0)>-1){m=c[M>>2]|0;if((m+(c[N>>2]|0)|0)>>>0<(c[O>>2]|0)>>>0){c[M>>2]=m+1;a[(c[b>>2]|0)+m>>0]=k+n;k=0}else k=-1;c[P>>2]=c[P>>2]|k}k=c[J>>2]|0;if(k|0){n=n+255&255;do{m=c[M>>2]|0;if((m+(c[N>>2]|0)|0)>>>0<(c[O>>2]|0)>>>0){c[M>>2]=m+1;a[(c[b>>2]|0)+m>>0]=n;m=0;k=c[J>>2]|0}else m=-1;c[P>>2]=c[P>>2]|m;k=k+-1|0;c[J>>2]=k}while((k|0)!=0)}c[L>>2]=o&255;m=c[I>>2]|0;k=c[Q>>2]|0}c[I>>2]=m<<8&2147483392;k=k<<8;c[Q>>2]=k;c[K>>2]=(c[K>>2]|0)+8}}while(0);o=c[r+56>>2]|0;m=c[D>>2]|0;q:do if((m|0)>0){m=30468+(d[31076+m>>0]|0)|0;n=k>>>8;if((o|0)>0){r=d[m+(o+-1)>>0]|0;k=k-(_(n,r)|0)|0;c[I>>2]=(c[I>>2]|0)+k;k=_(n,r-(d[m+o>>0]|0)|0)|0}else k=k-(_(n,d[m+o>>0]|0)|0)|0;c[Q>>2]=k;while(1){if(k>>>0>=8388609)break q;m=c[I>>2]|0;o=m>>>23;if((o|0)==255)c[J>>2]=(c[J>>2]|0)+1;else{n=m>>>31;k=c[L>>2]|0;if((k|0)>-1){m=c[M>>2]|0;if((m+(c[N>>2]|0)|0)>>>0<(c[O>>2]|0)>>>0){c[M>>2]=m+1;a[(c[b>>2]|0)+m>>0]=k+n;k=0}else k=-1;c[P>>2]=c[P>>2]|k}k=c[J>>2]|0;if(k|0){n=n+255&255;do{m=c[M>>2]|0;if((m+(c[N>>2]|0)|0)>>>0<(c[O>>2]|0)>>>0){c[M>>2]=m+1;a[(c[b>>2]|0)+m>>0]=n;m=0;k=c[J>>2]|0}else m=-1;c[P>>2]=c[P>>2]|m;k=k+-1|0;c[J>>2]=k}while((k|0)!=0)}c[L>>2]=o&255;m=c[I>>2]|0;k=c[Q>>2]|0}c[I>>2]=m<<8&2147483392;k=k<<8;c[Q>>2]=k;c[K>>2]=(c[K>>2]|0)+8}}while(0)}s=s+1|0}while(1){if((t|0)>=(j|0))break;r=c[H+(t<<2)>>2]|0;r:do if((r|0)>0){s=g+(t<<4)|0;q=0;while(1){if((q|0)==16)break r;l=a[s+q>>0]|0;p=l<<24>>24;p=(l<<24>>24>0?p:0-p|0)<<24>>24;l=r;s:while(1){o=l+-1|0;if((l|0)<=1)break;l=p>>>o&1;m=k>>>8;n=a[29928+l>>0]|0;if(!l)k=k-(_(m,n&255)|0)|0;else{G=d[29928+(l+-1)>>0]|0;k=k-(_(m,G)|0)|0;c[I>>2]=(c[I>>2]|0)+k;k=_(m,G-(n&255)|0)|0}c[Q>>2]=k;while(1){if(k>>>0>=8388609){l=o;continue s}l=c[I>>2]|0;n=l>>>23;if((n|0)==255)c[J>>2]=(c[J>>2]|0)+1;else{m=l>>>31;k=c[L>>2]|0;if((k|0)>-1){l=c[M>>2]|0;if((l+(c[N>>2]|0)|0)>>>0<(c[O>>2]|0)>>>0){c[M>>2]=l+1;a[(c[b>>2]|0)+l>>0]=k+m;k=0}else k=-1;c[P>>2]=c[P>>2]|k}k=c[J>>2]|0;if(k|0){m=m+255&255;do{l=c[M>>2]|0;if((l+(c[N>>2]|0)|0)>>>0<(c[O>>2]|0)>>>0){c[M>>2]=l+1;a[(c[b>>2]|0)+l>>0]=m;l=0;k=c[J>>2]|0}else l=-1;c[P>>2]=c[P>>2]|l;k=k+-1|0;c[J>>2]=k}while((k|0)!=0)}c[L>>2]=n&255;l=c[I>>2]|0;k=c[Q>>2]|0}c[I>>2]=l<<8&2147483392;k=k<<8;c[Q>>2]=k;c[K>>2]=(c[K>>2]|0)+8}}l=p&1;m=k>>>8;n=a[29928+l>>0]|0;if(!l)k=k-(_(m,n&255)|0)|0;else{G=d[29928+(l+-1)>>0]|0;k=k-(_(m,G)|0)|0;c[I>>2]=(c[I>>2]|0)+k;k=_(m,G-(n&255)|0)|0}c[Q>>2]=k;while(1){if(k>>>0>=8388609)break;l=c[I>>2]|0;n=l>>>23;if((n|0)==255)c[J>>2]=(c[J>>2]|0)+1;else{m=l>>>31;k=c[L>>2]|0;if((k|0)>-1){l=c[M>>2]|0;if((l+(c[N>>2]|0)|0)>>>0<(c[O>>2]|0)>>>0){c[M>>2]=l+1;a[(c[b>>2]|0)+l>>0]=k+m;k=0}else k=-1;c[P>>2]=c[P>>2]|k}k=c[J>>2]|0;if(k|0){m=m+255&255;do{l=c[M>>2]|0;if((l+(c[N>>2]|0)|0)>>>0<(c[O>>2]|0)>>>0){c[M>>2]=l+1;a[(c[b>>2]|0)+l>>0]=m;l=0;k=c[J>>2]|0}else l=-1;c[P>>2]=c[P>>2]|l;k=k+-1|0;c[J>>2]=k}while((k|0)!=0)}c[L>>2]=n&255;l=c[I>>2]|0;k=c[Q>>2]|0}c[I>>2]=l<<8&2147483392;k=k<<8;c[Q>>2]=k;c[K>>2]=(c[K>>2]|0)+8}q=q+1|0}}while(0);t=t+1|0}a[S+1>>0]=0;r=31093+(((e<<1)+f<<16>>16)*7|0)|0;q=h+8>>4;j=k;p=0;o=g;while(1){if((p|0)>=(q|0))break;k=c[R+(p<<2)>>2]|0;t:do if((k|0)>0){a[S>>0]=a[r+((k&30)>>>0<6?k&31:6)>>0]|0;n=0;while(1){if((n|0)==16)break t;k=a[o+n>>0]|0;u:do if(k<<24>>24){k=k<<24>>24>>15;l=k+1|0;m=j>>>8;if((k|0)>-1){g=d[S+k>>0]|0;j=j-(_(m,g)|0)|0;c[I>>2]=(c[I>>2]|0)+j;j=_(m,g-(d[S+l>>0]|0)|0)|0}else j=j-(_(m,d[S+l>>0]|0)|0)|0;c[Q>>2]=j;while(1){if(j>>>0>=8388609)break u;k=c[I>>2]|0;m=k>>>23;if((m|0)==255)c[J>>2]=(c[J>>2]|0)+1;else{l=k>>>31;j=c[L>>2]|0;if((j|0)>-1){k=c[M>>2]|0;if((k+(c[N>>2]|0)|0)>>>0<(c[O>>2]|0)>>>0){c[M>>2]=k+1;a[(c[b>>2]|0)+k>>0]=j+l;j=0}else j=-1;c[P>>2]=c[P>>2]|j}j=c[J>>2]|0;if(j|0){l=l+255&255;do{k=c[M>>2]|0;if((k+(c[N>>2]|0)|0)>>>0<(c[O>>2]|0)>>>0){c[M>>2]=k+1;a[(c[b>>2]|0)+k>>0]=l;k=0;j=c[J>>2]|0}else k=-1;c[P>>2]=c[P>>2]|k;j=j+-1|0;c[J>>2]=j}while((j|0)!=0)}c[L>>2]=m&255;k=c[I>>2]|0;j=c[Q>>2]|0}c[I>>2]=k<<8&2147483392;j=j<<8;c[Q>>2]=j;c[K>>2]=(c[K>>2]|0)+8}}while(0);n=n+1|0}}while(0);p=p+1|0;o=o+16|0}i=T;return}function Cd(d,e,f,g){d=d|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,l=0;j=f+2|0;h=b[j>>1]|0;g=(_(h<<16>>16,g)|0)/2|0;i=f+20|0;g=(c[f+24>>2]|0)+g|0;f=0;while(1){if((f|0)>=(h<<16>>16|0))break;l=a[g>>0]|0;k=l&255;b[d+(f<<1)>>1]=(k>>>1&7)*9;a[e+f>>0]=a[(c[i>>2]|0)+(f+((b[j>>1]|0)+-1&0-(k&1)))>>0]|0;h=f|1;b[d+(h<<1)>>1]=((l&255)>>>5&255)*9;a[e+h>>0]=a[(c[i>>2]|0)+(f+((b[j>>1]|0)+-1&0-(k>>>4&1))+1)>>0]|0;h=b[j>>1]|0;g=g+1|0;f=f+2|0}return}function Dd(d,f,g,h,j,k,l,m,n,o,p){d=d|0;f=f|0;g=g|0;h=h|0;j=j|0;k=k|0;l=l|0;m=m|0;n=n|0;o=o|0;p=p|0;var q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0;D=i;i=i+16|0;A=D+8|0;w=D+4|0;v=D;B=f+-4|0;q=p+2|0;C=i;i=i+((1*(q<<1)|0)+15&-16)|0;r=0;while(1){if((r|0)>=(q|0))break;y=r+-2|0;u=b[f+(y<<1)>>1]|0;y=b[g+(y<<1)>>1]|0;x=u+y|0;y=u-y|0;b[B+(r<<1)>>1]=(x>>>1)+(x&1);y=(y>>1)+(y&1)|0;b[C+(r<<1)>>1]=(y|0)>32767?32767:((y|0)<-32768?-32768:y)&65535;r=r+1|0}u=d+4|0;s=e[u>>1]|e[u+2>>1]<<16;b[B>>1]=s;b[B+2>>1]=s>>>16;s=d+8|0;r=e[s>>1]|e[s+2>>1]<<16;c[C>>2]=r;q=B+(p<<1)|0;q=e[q>>1]|e[q+2>>1]<<16;b[u>>1]=q;b[u+2>>1]=q>>>16;u=C+(p<<1)|0;u=e[u>>1]|e[u+2>>1]<<16;b[s>>1]=u;b[s+2>>1]=u>>>16;s=i;i=i+((1*(p<<1)|0)+15&-16)|0;u=i;i=i+((1*(p<<1)|0)+15&-16)|0;q=0;while(1){if((q|0)>=(p|0))break;y=q+1|0;t=b[B+(y<<1)>>1]|0;x=((b[B+(q<<1)>>1]|0)+(b[B+(q+2<<1)>>1]|0)+(t<<16>>16<<1)>>1)+1>>1;b[s+(q<<1)>>1]=x;b[u+(q<<1)>>1]=(t&65535)-x;q=y}f=i;i=i+((1*(p<<1)|0)+15&-16)|0;t=i;i=i+((1*(p<<1)|0)+15&-16)|0;q=r&65535;r=0;while(1){if((r|0)>=(p|0))break;y=r+1|0;x=b[C+(y<<1)>>1]|0;E=((q<<16>>16)+(b[C+(r+2<<1)>>1]|0)+(x<<16>>16<<1)>>1)+1>>1;b[f+(r<<1)>>1]=E;b[t+(r<<1)>>1]=(x&65535)-E;q=x;r=y}q=(o*10|0)==(p|0);x=q?328:655;m=m<<16>>16;m=_(m,m)|0;m=(_(m>>>16,x)|0)+((_(m&65535,x)|0)>>>16)|0;x=Nd(w,s,f,d+12|0,p,m)|0;c[A>>2]=x;t=Nd(v,u,t,d+20|0,p,m)|0;y=A+4|0;c[y>>2]=t;s=(c[v>>2]|0)+((c[w>>2]<<16>>16)*3|0)|0;s=(s|0)<65536?s:65536;u=l-(q?1200:600)|0;u=(u|0)<1?1:u;f=((o<<16>>16)*900|0)+2e3|0;q=s*3|0;r=Ed(u,q+851968|0,19)|0;c[k>>2]=r;if((r|0)<(f|0)){c[k>>2]=f;l=u-f|0;c[k+4>>2]=l;E=f<<16>>16;q=Ed((l<<1)-f|0,(_(q+65536>>16,E)|0)+((_(q&65535,E)|0)>>16)|0,16)|0;if((q|0)>16384)q=16384;else q=(q|0)<0?0:q}else{c[k+4>>2]=u-r;q=16384}r=d+28|0;w=b[r>>1]|0;l=w&65535;E=m<<16>>16;b[r>>1]=l+((_(q-(w<<16>>16)>>16,E)|0)+((_(q-l&65535,E)|0)>>>16));a[j>>0]=0;a:do if(!n){do if(!(b[d+30>>1]|0)){if((u<<3|0)>=(f*13|0)){q=c[r>>2]|0;E=q<<16>>16;if(((_(s>>16,E)|0)+((_(s&65535,E)|0)>>16)|0)<819)q=q&65535;else{if((q>>>16&65535)<<16>>16){z=23;break}q=b[r>>1]|0;break}}else q=b[r>>1]|0;c[A>>2]=(_(q<<16>>16,x<<16>>16)|0)>>14;c[y>>2]=(_(q<<16>>16,t<<16>>16)|0)>>14;Pd(A,h);c[A>>2]=0;c[y>>2]=0;c[k>>2]=u;c[k+4>>2]=0;a[j>>0]=1;r=0;z=31;break a}else z=23;while(0);do if((z|0)==23){if((u<<3|0)>=(f*11|0)){q=b[r>>1]|0;E=q<<16>>16;if(((_(s>>16,E)|0)+((_(s&65535,E)|0)>>16)|0)>=328)break}else q=b[r>>1]|0;q=q<<16>>16;c[A>>2]=(_(q,x<<16>>16)|0)>>14;c[y>>2]=(_(q,t<<16>>16)|0)>>14;Pd(A,h);c[A>>2]=0;c[y>>2]=0;q=0;z=30;break a}while(0);if(q<<16>>16>15565){Pd(A,h);q=16384;z=30;break}else{q=q<<16>>16;c[A>>2]=(_(q,x<<16>>16)|0)>>14;c[y>>2]=(_(q,t<<16>>16)|0)>>14;Pd(A,h);q=b[r>>1]|0;z=30;break}}else{c[A>>2]=0;c[y>>2]=0;Pd(A,h);q=0;z=30}while(0);if((z|0)==30)if((a[j>>0]|0)==1){r=q;z=31}else{b[d+32>>1]=0;z=35}do if((z|0)==31){q=d+32|0;E=(e[q>>1]|0)+(p-(o<<3))|0;b[q>>1]=E;if((E<<16>>16|0)<(o*5|0)){a[j>>0]=0;z=36;break}else{b[q>>1]=1e4;q=r;z=35;break}}while(0);if((z|0)==35)if(!(a[j>>0]|0)){r=q;z=36}if((z|0)==36){q=k+4|0;if((c[q>>2]|0)<1){c[q>>2]=1;c[k>>2]=(u|0)<2?1:u+-1|0;q=r}else q=r}m=c[d>>2]|0;n=d+30|0;t=b[n>>1]|0;v=t<<16>>16;r=o<<3;x=c[A>>2]|0;s=(65536/(r|0)|0)<<16>>16;w=((_(x-m<<16>>16,s)|0)>>15)+1>>1;l=c[y>>2]|0;f=((_(l-(m>>>16)<<16>>16,s)|0)>>15)+1>>1;s=(_(q-v>>16,s)|0)+((_(q-(t&65535)&65535,s)|0)>>16)<<10;t=0;u=0-(m<<16>>16)|0;m=0-(m>>16)|0;v=v<<10;while(1){if((t|0)>=(r|0))break;o=u-w|0;A=m-f|0;E=v+s|0;k=t+1|0;z=b[B+(k<<1)>>1]|0;y=(b[B+(t<<1)>>1]|0)+(b[B+(t+2<<1)>>1]|0)+(z<<1)|0;F=b[C+(k<<1)>>1]|0;h=o<<16>>16;j=A<<16>>16;j=((_(E>>16,F)|0)+((_(E&64512,F)|0)>>16)+((_(y>>7,h)|0)+((_(y<<9&65024,h)|0)>>16))+((_(z>>5,j)|0)+((_(z<<11&63488,j)|0)>>16))>>7)+1>>1;b[g+(t+-1<<1)>>1]=(j|0)>32767?32767:((j|0)<-32768?-32768:j)&65535;t=k;u=o;m=A;v=E}f=d+2|0;s=q>>6;t=q<<10&64512;u=0-x<<16>>16;m=0-l<<16>>16;while(1){if((r|0)>=(p|0))break;F=r+1|0;E=b[B+(F<<1)>>1]|0;A=(b[B+(r<<1)>>1]|0)+(b[B+(r+2<<1)>>1]|0)+(E<<1)|0;o=b[C+(F<<1)>>1]|0;E=((_(s,o)|0)+((_(t,o)|0)>>16)+((_(A>>7,u)|0)+((_(A<<9&65024,u)|0)>>16))+((_(E>>5,m)|0)+((_(E<<11&63488,m)|0)>>16))>>7)+1>>1;b[g+(r+-1<<1)>>1]=(E|0)>32767?32767:((E|0)<-32768?-32768:E)&65535;r=F}b[d>>1]=x;b[f>>1]=l;b[n>>1]=q;i=D;return}function Ed(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,f=0,g=0;if((a|0)<=0)if(!a)e=32;else{d=0-a|0;f=3}else{d=a;f=3}if((f|0)==3)e=aa(d|0)|0;a=a<>16|0)|0)<<16>>16;g=(_(a>>16,b)|0)+((_(a&65535,b)|0)>>16)|0;f=zf(f|0,((f|0)<0)<<31>>31|0,g|0,((g|0)<0)<<31>>31|0)|0;f=qf(f|0,C|0,29)|0;f=a-(f&-8)|0;b=g+((_(f>>16,b)|0)+((_(f&65535,b)|0)>>16))|0;d=e+28-d-c|0;if((d|0)>=0)return ((d|0)<32?b>>d:0)|0;d=0-d|0;a=-2147483648>>d;e=2147483647>>>d;if((a|0)>(e|0)){if((b|0)>(a|0)){g=a;g=g<(e|0)){g=e;g=g<>2]=b;c[a+8>>2]=193536;c[a+12>>2]=193536;c[a+4756>>2]=1;b=a+32|0;d=b+112|0;do{c[b>>2]=0;b=b+4|0}while((b|0)<(d|0));b=0;while(1){if((b|0)==4){b=0;break}d=b+1|0;e=50/(d|0)|0;c[a+124+(b<<2)>>2]=(e|0)>1?e:1;b=d}while(1){if((b|0)==4)break;e=(c[a+124+(b<<2)>>2]|0)*100|0;c[a+92+(b<<2)>>2]=e;c[a+108+(b<<2)>>2]=2147483647/(e|0)|0;b=b+1|0}c[a+140>>2]=15;b=0;while(1){if((b|0)==4)break;c[a+72+(b<<2)>>2]=25600;b=b+1|0}return 0}function Gd(a,d){a=a|0;d=d|0;var e=0,f=0,h=0,j=0.0,l=0,m=0.0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0;u=i;i=i+304|0;r=u;p=a+4668|0;f=c[p>>2]|0;if((f|0)==(d|0)?(e=a+4648|0,(c[a+4652>>2]|0)==(c[e>>2]|0)):0){s=e;t=0;s=c[s>>2]|0;a=a+4652|0;c[a>>2]=s;i=u;return t|0}if(!f){t=a+4648|0;s=t;t=Hd(a+5868|0,c[t>>2]|0,d*1e3|0,1)|0;s=c[s>>2]|0;a=a+4652|0;c[a>>2]=s;i=u;return t|0}q=((c[a+4672>>2]|0)*10|0)+5|0;o=_(q,f)|0;f=_(q,d)|0;s=Fa()|0;t=i;i=i+((1*(((o|0)>(f|0)?o:f)<<1)|0)+15&-16)|0;e=o;while(1){n=e+-1|0;if((e|0)<=0)break;j=+g[a+7272+(n<<2)>>2];h=(g[k>>2]=j,c[k>>2]|0);l=(h&2130706432)>>>0>1249902592;if(!l){e=(h|0)<0;m=e?j+-8388608.0+8388608.0:j+8388608.0+-8388608.0;if(m==0.0)m=e?-0.0:0.0}else m=j;if((~~m|0)<=32767){if(!l){e=(h|0)<0;m=e?j+-8388608.0+8388608.0:j+8388608.0+-8388608.0;if(m==0.0)m=e?-0.0:0.0}else m=j;if((~~m|0)<-32768)e=-32768;else{if(!l){e=(h|0)<0;j=e?j+-8388608.0+8388608.0:j+8388608.0+-8388608.0;if(j==0.0)j=e?-0.0:0.0}e=~~j}}else e=32767;b[t+(n<<1)>>1]=e;e=n}n=a+4648|0;l=Hd(r,(c[p>>2]<<16>>16)*1e3|0,c[n>>2]|0,0)|0;q=_(q,(c[n>>2]|0)/1e3|0)|0;p=i;i=i+((1*(q<<1)|0)+15&-16)|0;Id(r,p,t,o);r=a+5868|0;h=Hd(r,c[n>>2]|0,(d<<16>>16)*1e3|0,1)|0;Id(r,t,p,q);while(1){e=f+-1|0;if((f|0)<=0)break;g[a+7272+(e<<2)>>2]=+(b[t+(e<<1)>>1]|0);f=e}Na(s|0);s=n;t=l+h|0;s=c[s>>2]|0;a=a+4652|0;c[a>>2]=s;i=u;return t|0}function Hd(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0;nf(b|0,0,300)|0;if(!f){a:do if((d|0)>=12e3)if((d|0)<16e3){switch(d|0){case 12e3:break a;default:f=-1}return f|0}else{switch(d|0){case 16e3:break a;default:f=-1}return f|0}else{switch(d|0){case 8e3:break a;default:f=-1}return f|0}while(0);b:do if((e|0)<16e3)if((e|0)<12e3){switch(e|0){case 8e3:break b;default:f=-1}return f|0}else{switch(e|0){case 12e3:break b;default:f=-1}return f|0}else{if((e|0)<24e3){switch(e|0){case 16e3:break b;default:f=-1}return f|0}if((e|0)<48e3){switch(e|0){case 24e3:break b;default:f=-1}return f|0}else{switch(e|0){case 48e3:break b;default:f=-1}return f|0}}while(0);c[b+292>>2]=a[((e>>12)-((e|0)>16e3&1)>>((e|0)>24e3&1))+-1+(31150+((((d>>12)-((d|0)>16e3&1)>>((d|0)>24e3&1))+-1|0)*5|0))>>0]}else{c:do if((d|0)<16e3)if((d|0)<12e3){switch(d|0){case 8e3:break c;default:f=-1}return f|0}else{switch(d|0){case 12e3:break c;default:f=-1}return f|0}else{if((d|0)<24e3){switch(d|0){case 16e3:break c;default:f=-1}return f|0}if((d|0)<48e3){switch(d|0){case 24e3:break c;default:f=-1}return f|0}else{switch(d|0){case 48e3:break c;default:f=-1}return f|0}}while(0);d:do if((e|0)>=12e3)if((e|0)<16e3){switch(e|0){case 12e3:break d;default:f=-1}return f|0}else{switch(e|0){case 16e3:break d;default:f=-1}return f|0}else{switch(e|0){case 8e3:break d;default:f=-1}return f|0}while(0);c[b+292>>2]=a[((e>>12)-((e|0)>16e3&1)>>((e|0)>24e3&1))+-1+(31135+((((d>>12)-((d|0)>16e3&1)>>((d|0)>24e3&1))+-1|0)*3|0))>>0]}i=(d|0)/1e3|0;c[b+284>>2]=i;c[b+288>>2]=(e|0)/1e3|0;c[b+268>>2]=i*10;do if((e|0)>(d|0)){f=b+264|0;if((d<<1|0)==(e|0)){c[f>>2]=1;f=0;break}else{c[f>>2]=2;f=1;break}}else{f=b+264|0;if((e|0)>=(d|0)){c[f>>2]=0;f=0;break}c[f>>2]=3;f=e<<2;if((f|0)==(d*3|0)){c[b+280>>2]=3;c[b+276>>2]=18;c[b+296>>2]=25418;f=0;break}g=e*3|0;if((g|0)==(d<<1|0)){c[b+280>>2]=2;c[b+276>>2]=18;c[b+296>>2]=25476;f=0;break}if((e<<1|0)==(d|0)){c[b+280>>2]=1;c[b+276>>2]=24;c[b+296>>2]=25516;f=0;break}if((g|0)==(d|0)){c[b+280>>2]=1;c[b+276>>2]=36;c[b+296>>2]=25544;f=0;break}if((f|0)==(d|0)){c[b+280>>2]=1;c[b+276>>2]=36;c[b+296>>2]=25584;f=0;break}if((e*6|0)==(d|0)){c[b+280>>2]=1;c[b+276>>2]=36;c[b+296>>2]=25624;f=0;break}else{d=-1;return d|0}}while(0);g=((d<<(f|14)|0)/(e|0)|0)<<2;h=b+272|0;c[h>>2]=g;i=e<<16>>16;b=(e>>15)+1>>1;f=d<>16,i)|0)+((_(g&65535,i)|0)>>16)+(_(g,b)|0)|0)>=(f|0)){f=0;break}d=g+1|0;c[h>>2]=d;g=d}return f|0}function Id(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0;f=a+284|0;h=a+292|0;i=c[h>>2]|0;g=(c[f>>2]|0)-i|0;rf(a+168+(i<<1)|0,d|0,g<<1|0)|0;switch(c[a+264>>2]|0){case 1:{i=a+168|0;Ld(a,b,i,c[f>>2]|0);Ld(a,b+(c[a+288>>2]<<1)|0,d+(g<<1)|0,e-(c[f>>2]|0)|0);f=i;break}case 2:{i=a+168|0;Kd(a,b,i,c[f>>2]|0);Kd(a,b+(c[a+288>>2]<<1)|0,d+(g<<1)|0,e-(c[f>>2]|0)|0);f=i;break}case 3:{i=a+168|0;Jd(a,b,i,c[f>>2]|0);Jd(a,b+(c[a+288>>2]<<1)|0,d+(g<<1)|0,e-(c[f>>2]|0)|0);f=i;break}default:{i=a+168|0;rf(b|0,i|0,c[f>>2]<<1|0)|0;rf(b+(c[a+288>>2]<<1)|0,d+(g<<1)|0,e-(c[f>>2]|0)<<1|0)|0;f=i}}i=c[h>>2]|0;rf(f|0,d+(e-i<<1)|0,i<<1|0)|0;return}function Jd(a,d,e,f){a=a|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0;N=i;n=a+268|0;l=c[n>>2]|0;x=a+276|0;k=c[x>>2]|0;K=i;i=i+((1*(l+k<<2)|0)+15&-16)|0;L=a+24|0;rf(K|0,L|0,k<<2|0)|0;M=a+296|0;J=c[M>>2]|0;o=J+4|0;p=c[a+272>>2]|0;q=a+4|0;r=a+280|0;s=J+6|0;t=J+8|0;u=J+10|0;v=J+12|0;w=J+14|0;y=J+16|0;z=J+18|0;A=J+20|0;B=J+22|0;C=J+24|0;D=J+26|0;E=J+28|0;F=J+30|0;G=J+32|0;H=J+34|0;I=J+36|0;J=J+38|0;m=e;e=l;while(1){l=(f|0)<(e|0)?f:e;e=K+(k<<2)|0;g=c[M>>2]|0;h=g+2|0;j=0;while(1){if((j|0)>=(l|0))break;P=(c[a>>2]|0)+(b[m+(j<<1)>>1]<<8)|0;c[e+(j<<2)>>2]=P;P=P<<2;Q=P>>16;O=b[g>>1]|0;P=P&65532;c[a>>2]=(c[q>>2]|0)+((_(Q,O)|0)+((_(P,O)|0)>>16));O=b[h>>1]|0;c[q>>2]=(_(Q,O)|0)+((_(P,O)|0)>>16);j=j+1|0}j=l<<16;e=c[r>>2]|0;a:do switch(k|0){case 18:{h=e<<16>>16;g=e+-1|0;e=0;while(1){if((e|0)>=(j|0))break a;P=K+(e>>16<<2)|0;Q=(_(e&65535,h)|0)>>16;O=o+(Q*9<<1)|0;k=c[P>>2]|0;S=b[O>>1]|0;S=(_(k>>16,S)|0)+((_(k&65535,S)|0)>>16)|0;k=c[P+4>>2]|0;R=b[O+2>>1]|0;R=S+((_(k>>16,R)|0)+((_(k&65535,R)|0)>>16))|0;k=c[P+8>>2]|0;S=b[O+4>>1]|0;S=R+((_(k>>16,S)|0)+((_(k&65535,S)|0)>>16))|0;k=c[P+12>>2]|0;R=b[O+6>>1]|0;R=S+((_(k>>16,R)|0)+((_(k&65535,R)|0)>>16))|0;k=c[P+16>>2]|0;S=b[O+8>>1]|0;S=R+((_(k>>16,S)|0)+((_(k&65535,S)|0)>>16))|0;k=c[P+20>>2]|0;R=b[O+10>>1]|0;R=S+((_(k>>16,R)|0)+((_(k&65535,R)|0)>>16))|0;k=c[P+24>>2]|0;S=b[O+12>>1]|0;S=R+((_(k>>16,S)|0)+((_(k&65535,S)|0)>>16))|0;k=c[P+28>>2]|0;R=b[O+14>>1]|0;R=S+((_(k>>16,R)|0)+((_(k&65535,R)|0)>>16))|0;k=c[P+32>>2]|0;O=b[O+16>>1]|0;O=R+((_(k>>16,O)|0)+((_(k&65535,O)|0)>>16))|0;Q=o+((g-Q|0)*9<<1)|0;k=c[P+68>>2]|0;R=b[Q>>1]|0;R=O+((_(k>>16,R)|0)+((_(k&65535,R)|0)>>16))|0;k=c[P+64>>2]|0;O=b[Q+2>>1]|0;O=R+((_(k>>16,O)|0)+((_(k&65535,O)|0)>>16))|0;k=c[P+60>>2]|0;R=b[Q+4>>1]|0;R=O+((_(k>>16,R)|0)+((_(k&65535,R)|0)>>16))|0;k=c[P+56>>2]|0;O=b[Q+6>>1]|0;O=R+((_(k>>16,O)|0)+((_(k&65535,O)|0)>>16))|0;k=c[P+52>>2]|0;R=b[Q+8>>1]|0;R=O+((_(k>>16,R)|0)+((_(k&65535,R)|0)>>16))|0;k=c[P+48>>2]|0;O=b[Q+10>>1]|0;O=R+((_(k>>16,O)|0)+((_(k&65535,O)|0)>>16))|0;k=c[P+44>>2]|0;R=b[Q+12>>1]|0;R=O+((_(k>>16,R)|0)+((_(k&65535,R)|0)>>16))|0;k=c[P+40>>2]|0;O=b[Q+14>>1]|0;O=R+((_(k>>16,O)|0)+((_(k&65535,O)|0)>>16))|0;P=c[P+36>>2]|0;Q=b[Q+16>>1]|0;Q=(O+((_(P>>16,Q)|0)+((_(P&65535,Q)|0)>>16))>>5)+1>>1;b[d>>1]=(Q|0)>32767?32767:((Q|0)<-32768?-32768:Q)&65535;d=d+2|0;e=e+p|0}}case 24:{e=0;while(1){if((e|0)>=(j|0))break a;R=K+(e>>16<<2)|0;S=(c[R>>2]|0)+(c[R+92>>2]|0)|0;Q=b[o>>1]|0;Q=(_(S>>16,Q)|0)+((_(S&65535,Q)|0)>>16)|0;S=(c[R+4>>2]|0)+(c[R+88>>2]|0)|0;P=b[s>>1]|0;P=Q+((_(S>>16,P)|0)+((_(S&65535,P)|0)>>16))|0;S=(c[R+8>>2]|0)+(c[R+84>>2]|0)|0;Q=b[t>>1]|0;Q=P+((_(S>>16,Q)|0)+((_(S&65535,Q)|0)>>16))|0;S=(c[R+12>>2]|0)+(c[R+80>>2]|0)|0;P=b[u>>1]|0;P=Q+((_(S>>16,P)|0)+((_(S&65535,P)|0)>>16))|0;S=(c[R+16>>2]|0)+(c[R+76>>2]|0)|0;Q=b[v>>1]|0;Q=P+((_(S>>16,Q)|0)+((_(S&65535,Q)|0)>>16))|0;S=(c[R+20>>2]|0)+(c[R+72>>2]|0)|0;P=b[w>>1]|0;P=Q+((_(S>>16,P)|0)+((_(S&65535,P)|0)>>16))|0;S=(c[R+24>>2]|0)+(c[R+68>>2]|0)|0;Q=b[y>>1]|0;Q=P+((_(S>>16,Q)|0)+((_(S&65535,Q)|0)>>16))|0;S=(c[R+28>>2]|0)+(c[R+64>>2]|0)|0;P=b[z>>1]|0;P=Q+((_(S>>16,P)|0)+((_(S&65535,P)|0)>>16))|0;S=(c[R+32>>2]|0)+(c[R+60>>2]|0)|0;Q=b[A>>1]|0;Q=P+((_(S>>16,Q)|0)+((_(S&65535,Q)|0)>>16))|0;S=(c[R+36>>2]|0)+(c[R+56>>2]|0)|0;P=b[B>>1]|0;P=Q+((_(S>>16,P)|0)+((_(S&65535,P)|0)>>16))|0;S=(c[R+40>>2]|0)+(c[R+52>>2]|0)|0;Q=b[C>>1]|0;Q=P+((_(S>>16,Q)|0)+((_(S&65535,Q)|0)>>16))|0;R=(c[R+44>>2]|0)+(c[R+48>>2]|0)|0;S=b[D>>1]|0;S=(Q+((_(R>>16,S)|0)+((_(R&65535,S)|0)>>16))>>5)+1>>1;b[d>>1]=(S|0)>32767?32767:((S|0)<-32768?-32768:S)&65535;d=d+2|0;e=e+p|0}}case 36:{e=0;while(1){if((e|0)>=(j|0))break a;R=K+(e>>16<<2)|0;S=(c[R>>2]|0)+(c[R+140>>2]|0)|0;Q=b[o>>1]|0;Q=(_(S>>16,Q)|0)+((_(S&65535,Q)|0)>>16)|0;S=(c[R+4>>2]|0)+(c[R+136>>2]|0)|0;P=b[s>>1]|0;P=Q+((_(S>>16,P)|0)+((_(S&65535,P)|0)>>16))|0;S=(c[R+8>>2]|0)+(c[R+132>>2]|0)|0;Q=b[t>>1]|0;Q=P+((_(S>>16,Q)|0)+((_(S&65535,Q)|0)>>16))|0;S=(c[R+12>>2]|0)+(c[R+128>>2]|0)|0;P=b[u>>1]|0;P=Q+((_(S>>16,P)|0)+((_(S&65535,P)|0)>>16))|0;S=(c[R+16>>2]|0)+(c[R+124>>2]|0)|0;Q=b[v>>1]|0;Q=P+((_(S>>16,Q)|0)+((_(S&65535,Q)|0)>>16))|0;S=(c[R+20>>2]|0)+(c[R+120>>2]|0)|0;P=b[w>>1]|0;P=Q+((_(S>>16,P)|0)+((_(S&65535,P)|0)>>16))|0;S=(c[R+24>>2]|0)+(c[R+116>>2]|0)|0;Q=b[y>>1]|0;Q=P+((_(S>>16,Q)|0)+((_(S&65535,Q)|0)>>16))|0;S=(c[R+28>>2]|0)+(c[R+112>>2]|0)|0;P=b[z>>1]|0;P=Q+((_(S>>16,P)|0)+((_(S&65535,P)|0)>>16))|0;S=(c[R+32>>2]|0)+(c[R+108>>2]|0)|0;Q=b[A>>1]|0;Q=P+((_(S>>16,Q)|0)+((_(S&65535,Q)|0)>>16))|0;S=(c[R+36>>2]|0)+(c[R+104>>2]|0)|0;P=b[B>>1]|0;P=Q+((_(S>>16,P)|0)+((_(S&65535,P)|0)>>16))|0;S=(c[R+40>>2]|0)+(c[R+100>>2]|0)|0;Q=b[C>>1]|0;Q=P+((_(S>>16,Q)|0)+((_(S&65535,Q)|0)>>16))|0;S=(c[R+44>>2]|0)+(c[R+96>>2]|0)|0;P=b[D>>1]|0;P=Q+((_(S>>16,P)|0)+((_(S&65535,P)|0)>>16))|0;S=(c[R+48>>2]|0)+(c[R+92>>2]|0)|0;Q=b[E>>1]|0;Q=P+((_(S>>16,Q)|0)+((_(S&65535,Q)|0)>>16))|0;S=(c[R+52>>2]|0)+(c[R+88>>2]|0)|0;P=b[F>>1]|0;P=Q+((_(S>>16,P)|0)+((_(S&65535,P)|0)>>16))|0;S=(c[R+56>>2]|0)+(c[R+84>>2]|0)|0;Q=b[G>>1]|0;Q=P+((_(S>>16,Q)|0)+((_(S&65535,Q)|0)>>16))|0;S=(c[R+60>>2]|0)+(c[R+80>>2]|0)|0;P=b[H>>1]|0;P=Q+((_(S>>16,P)|0)+((_(S&65535,P)|0)>>16))|0;S=(c[R+64>>2]|0)+(c[R+76>>2]|0)|0;Q=b[I>>1]|0;Q=P+((_(S>>16,Q)|0)+((_(S&65535,Q)|0)>>16))|0;R=(c[R+68>>2]|0)+(c[R+72>>2]|0)|0;S=b[J>>1]|0;S=(Q+((_(R>>16,S)|0)+((_(R&65535,S)|0)>>16))>>5)+1>>1;b[d>>1]=(S|0)>32767?32767:((S|0)<-32768?-32768:S)&65535;d=d+2|0;e=e+p|0}}default:{}}while(0);f=f-l|0;if((f|0)<=1)break;k=c[x>>2]|0;rf(K|0,K+(l<<2)|0,k<<2|0)|0;m=m+(l<<1)|0;e=c[n>>2]|0}rf(L|0,K+(l<<2)|0,c[x>>2]<<2|0)|0;i=N;return}function Kd(a,d,e,f){a=a|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0;p=i;k=a+268|0;j=c[k>>2]|0;l=i;i=i+((1*((j<<1)+8<<1)|0)+15&-16)|0;m=a+24|0;b[l>>1]=b[m>>1]|0;b[l+2>>1]=b[m+2>>1]|0;b[l+4>>1]=b[m+4>>1]|0;b[l+6>>1]=b[m+6>>1]|0;b[l+8>>1]=b[m+8>>1]|0;b[l+10>>1]=b[m+10>>1]|0;b[l+12>>1]=b[m+12>>1]|0;b[l+14>>1]=b[m+14>>1]|0;n=c[a+272>>2]|0;o=l+16|0;g=d;d=j;while(1){j=(f|0)<(d|0)?f:d;Ld(a,o,e,j);h=j<<17;d=0;while(1){if((d|0)>=(h|0))break;q=((d&65535)*12|0)>>>16;r=l+(d>>16<<1)|0;s=_(b[r>>1]|0,b[25664+(q<<3)>>1]|0)|0;s=s+(_(b[r+2>>1]|0,b[25664+(q<<3)+2>>1]|0)|0)|0;s=s+(_(b[r+4>>1]|0,b[25664+(q<<3)+4>>1]|0)|0)|0;s=s+(_(b[r+6>>1]|0,b[25664+(q<<3)+6>>1]|0)|0)|0;q=11-q|0;s=s+(_(b[r+8>>1]|0,b[25664+(q<<3)+6>>1]|0)|0)|0;s=s+(_(b[r+10>>1]|0,b[25664+(q<<3)+4>>1]|0)|0)|0;s=s+(_(b[r+12>>1]|0,b[25664+(q<<3)+2>>1]|0)|0)|0;q=(s+(_(b[r+14>>1]|0,b[25664+(q<<3)>>1]|0)|0)>>14)+1>>1;b[g>>1]=(q|0)>32767?32767:((q|0)<-32768?-32768:q)&65535;g=g+2|0;d=d+n|0}f=f-j|0;if((f|0)<=0)break;d=l+(j<<1<<1)|0;b[l>>1]=b[d>>1]|0;b[l+2>>1]=b[d+2>>1]|0;b[l+4>>1]=b[d+4>>1]|0;b[l+6>>1]=b[d+6>>1]|0;b[l+8>>1]=b[d+8>>1]|0;b[l+10>>1]=b[d+10>>1]|0;b[l+12>>1]=b[d+12>>1]|0;b[l+14>>1]=b[d+14>>1]|0;e=e+(j<<1)|0;d=c[k>>2]|0}s=l+(j<<1<<1)|0;b[m>>1]=b[s>>1]|0;b[m+2>>1]=b[s+2>>1]|0;b[m+4>>1]=b[s+4>>1]|0;b[m+6>>1]=b[s+6>>1]|0;b[m+8>>1]=b[s+8>>1]|0;b[m+10>>1]=b[s+10>>1]|0;b[m+12>>1]=b[s+12>>1]|0;b[m+14>>1]=b[s+14>>1]|0;i=p;return}function Ld(a,d,e,f){a=a|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;g=a+4|0;h=a+8|0;i=a+12|0;j=a+16|0;k=a+20|0;l=0;while(1){if((l|0)>=(f|0))break;p=b[e+(l<<1)>>1]<<10;n=c[a>>2]|0;m=p-n|0;m=((m>>16)*1746|0)+(((m&65535)*1746|0)>>>16)|0;n=n+m|0;c[a>>2]=p+m;m=c[g>>2]|0;o=n-m|0;o=((o>>16)*14986|0)+(((o&65535)*14986|0)>>>16)|0;m=m+o|0;c[g>>2]=n+o;o=m-(c[h>>2]|0)|0;n=(_(o>>16,-26453)|0)+((_(o&65535,-26453)|0)>>16)|0;c[h>>2]=m+(o+n);n=(m+n>>9)+1>>1;m=l<<1;b[d+(m<<1)>>1]=(n|0)>32767?32767:((n|0)<-32768?-32768:n)&65535;n=c[i>>2]|0;o=p-n|0;o=((o>>16)*6854|0)+(((o&65535)*6854|0)>>>16)|0;n=n+o|0;c[i>>2]=p+o;o=c[j>>2]|0;p=n-o|0;p=((p>>16)*25769|0)+(((p&65535)*25769|0)>>>16)|0;o=o+p|0;c[j>>2]=n+p;p=o-(c[k>>2]|0)|0;n=(_(p>>16,-9994)|0)+((_(p&65535,-9994)|0)>>16)|0;c[k>>2]=o+(p+n);n=(o+n>>9)+1>>1;b[d+((m|1)<<1)>>1]=(n|0)>32767?32767:((n|0)<-32768?-32768:n)&65535;l=l+1|0}return}function Md(a,e){a=a|0;e=e|0;var f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0;t=i;i=i+32|0;s=t;q=a+28|0;j=c[q>>2]|0;r=a+32|0;f=c[r>>2]|0;g=j>>>8;k=-1;while(1){k=k+1|0;h=_(g,d[29891+k>>0]|0)|0;if(f>>>0>=h>>>0)break;else j=h}l=f-h|0;c[r>>2]=l;f=j-h|0;c[q>>2]=f;m=a+20|0;n=a+40|0;o=a+24|0;p=a+4|0;j=l;while(1){if(f>>>0>=8388609)break;c[m>>2]=(c[m>>2]|0)+8;f=f<<8;c[q>>2]=f;h=c[n>>2]|0;g=c[o>>2]|0;if(g>>>0<(c[p>>2]|0)>>>0){c[o>>2]=g+1;g=d[(c[a>>2]|0)+g>>0]|0}else g=0;c[n>>2]=g;l=((h<<8|g)>>>1&255|j<<8&2147483392)^255;c[r>>2]=l;j=l}l=(k|0)/5|0;c[s+8>>2]=l;c[s+20>>2]=k+(_(l,-5)|0);l=0;while(1){if((l|0)==2){f=0;break}h=f>>>8;k=-1;while(1){k=k+1|0;g=_(h,d[29944+k>>0]|0)|0;if(j>>>0>=g>>>0)break;else f=g}j=j-g|0;c[r>>2]=j;f=f-g|0;c[q>>2]=f;while(1){if(f>>>0>=8388609)break;c[m>>2]=(c[m>>2]|0)+8;f=f<<8;c[q>>2]=f;h=c[n>>2]|0;g=c[o>>2]|0;if(g>>>0<(c[p>>2]|0)>>>0){c[o>>2]=g+1;g=d[(c[a>>2]|0)+g>>0]|0}else g=0;c[n>>2]=g;h=((h<<8|g)>>>1&255|j<<8&2147483392)^255;c[r>>2]=h;j=h}c[s+(l*12|0)>>2]=k;h=f>>>8;k=-1;while(1){k=k+1|0;g=_(h,d[29951+k>>0]|0)|0;if(j>>>0>=g>>>0)break;else f=g}j=j-g|0;c[r>>2]=j;f=f-g|0;c[q>>2]=f;while(1){if(f>>>0>=8388609)break;c[m>>2]=(c[m>>2]|0)+8;f=f<<8;c[q>>2]=f;h=c[n>>2]|0;g=c[o>>2]|0;if(g>>>0<(c[p>>2]|0)>>>0){c[o>>2]=g+1;g=d[(c[a>>2]|0)+g>>0]|0}else g=0;c[n>>2]=g;h=((h<<8|g)>>>1&255|j<<8&2147483392)^255;c[r>>2]=h;j=h}c[s+(l*12|0)+4>>2]=k;l=l+1|0}while(1){if((f|0)==2)break;r=s+(f*12|0)|0;a=(c[r>>2]|0)+((c[s+(f*12|0)+8>>2]|0)*3|0)|0;c[r>>2]=a;r=b[25372+(a<<1)>>1]|0;a=b[25372+(a+1<<1)>>1]|0;a=(_((a<<16>>16)-r>>16,429522944)|0)+(((a&65535)-r&65535)*6554|0)>>16;c[e+(f<<2)>>2]=r+(_(a,c[s+(f*12|0)+4>>2]<<17>>16|1)|0);f=f+1|0}c[e>>2]=(c[e>>2]|0)-(c[e+4>>2]|0);i=t;return}function Nd(a,d,e,f,g,h){a=a|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;var j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0;v=i;i=i+16|0;o=v+12|0;p=v+8|0;j=v+4|0;r=v;ze(j,o,d,g);ze(r,p,e,g);o=c[o>>2]|0;p=c[p>>2]|0;k=(o|0)>(p|0)?o:p;k=k+(k&1)|0;p=c[r>>2]>>k-p;c[r>>2]=p;o=c[j>>2]>>k-o;o=(o|0)>1?o:1;c[j>>2]=o;j=0;q=0;while(1){if((j|0)>=(g|0))break;u=q+((_(b[d+(j<<1)>>1]|0,b[e+(j<<1)>>1]|0)|0)>>k)|0;j=j+1|0;q=u}u=Od(q,o,13)|0;u=(u|0)>16384?16384:(u|0)<-16384?-16384:u;l=u<<16>>16;m=(_(u>>16,l)|0)+((_(u&65535,l)|0)>>16)|0;e=(m|0)>0?m:0-m|0;e=(e|0)<(h|0)?h:e;t=k>>1;h=c[f>>2]|0;d=aa(o|0)|0;j=24-d|0;g=0-j|0;do if(j)if((j|0)<0){j=o<>>(j+32|0);break}else{j=o<<32-j|o>>>j;break}else j=o;while(0);g=((d&1|0)==0?46214:32768)>>>(d>>>1);d=(_(j&127,13959168)|0)>>>16;s=e<<16>>16;d=_((g+((_(g>>16,d)|0)+((_(g&65535,d)|0)>>>16))<>16,s)|0;e=aa(o|0)|0;j=24-e|0;g=0-j|0;do if(j)if((j|0)<0){j=o<>>(j+32|0);break}else{j=o<<32-j|o>>>j;break}else j=o;while(0);k=((e&1|0)==0?46214:32768)>>>(e>>>1);n=(_(j&127,13959168)|0)>>>16;n=h+(d+((_((k+((_(k>>16,n)|0)+((_(k&65535,n)|0)>>>16))<>16))|0;c[f>>2]=n;j=m<<16>>16;j=p-((_(q>>16,l)|0)+((_(q&65535,l)|0)>>16)<<4)+((_(o>>16,j)|0)+((_(o&65535,j)|0)>>16)<<6)|0;c[r>>2]=j;l=f+4|0;m=c[l>>2]|0;h=(j|0)<1;if(h){f=0;r=_(0-m>>16,s)|0;t=f<>16;s=r+s|0;s=m+s|0;c[l>>2]=s;t=(n|0)>1;t=t?n:1;t=Od(s,t,14)|0;s=(t|0)>32767;r=(t|0)<0;t=r?0:t;t=s?32767:t;c[a>>2]=t;i=v;return u|0}e=aa(j|0)|0;g=24-e|0;d=0-g|0;do if(g)if((g|0)<0){g=j<>>(g+32|0);break}else{g=j<<32-g|j>>>g;break}else g=j;while(0);r=((e&1|0)==0?46214:32768)>>>(e>>>1);k=(_(g&127,13959168)|0)>>>16;k=_((r+((_(r>>16,k)|0)+((_(r&65535,k)|0)>>>16))<>16,s)|0;if(h){f=0;r=k;t=f<>16;s=r+s|0;s=m+s|0;c[l>>2]=s;t=(n|0)>1;t=t?n:1;t=Od(s,t,14)|0;s=(t|0)>32767;r=(t|0)<0;t=r?0:t;t=s?32767:t;c[a>>2]=t;i=v;return u|0}e=aa(j|0)|0;g=24-e|0;d=0-g|0;do if(g)if((g|0)<0){j=j<>>(g+32|0);break}else{j=j<<32-g|j>>>g;break}while(0);r=((e&1|0)==0?46214:32768)>>>(e>>>1);f=(_(j&127,13959168)|0)>>>16;f=r+((_(r>>16,f)|0)+((_(r&65535,f)|0)>>>16))|0;r=k;t=f<>16;s=r+s|0;s=m+s|0;c[l>>2]=s;t=(n|0)>1;t=t?n:1;t=Od(s,t,14)|0;s=(t|0)>32767;r=(t|0)<0;t=r?0:t;t=s?32767:t;c[a>>2]=t;i=v;return u|0}function Od(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,f=0,g=0;if((a|0)<=0)if(!a)e=32;else{d=0-a|0;f=3}else{d=a;f=3}if((f|0)==3)e=aa(d|0)|0;a=a<>16|0)|0)<<16>>16;g=(_(a>>16,b)|0)+((_(a&65535,b)|0)>>16)|0;f=zf(f|0,((f|0)<0)<<31>>31|0,g|0,((g|0)<0)<<31>>31|0)|0;f=qf(f|0,C|0,29)|0;f=a-(f&-8)|0;b=g+((_(f>>16,b)|0)+((_(f&65535,b)|0)>>16))|0;d=e+28-d-c|0;if((d|0)>=0)return ((d|0)<32?b>>d:0)|0;d=0-d|0;a=-2147483648>>d;e=2147483647>>>d;if((a|0)>(e|0)){if((b|0)>(a|0)){g=a;g=g<(e|0)){g=e;g=g<=15)break;l=b[25372+(g<<1)>>1]|0;m=g+1|0;n=b[25372+(m<<1)>>1]|0;n=(_((n<<16>>16)-l>>16,429522944)|0)+(((n&65535)-l&65535)*6554|0)>>16;k=g&255;i=h;j=0;while(1){if((j|0)>=5){h=i;g=m;continue a}g=l+(_(n,j<<17>>16|1)|0)|0;h=c[p>>2]|0;h=(h|0)>(g|0)?h-g|0:g-h|0;if((h|0)>=(i|0))break a;a[q>>0]=k;a[o>>0]=j;i=h;j=j+1|0;f=g}}n=a[q>>0]|0;o=(n<<24>>24|0)/3|0;a[e+(r*3|0)+2>>0]=o;a[q>>0]=(n&255)+(_(o,-3)|0);c[p>>2]=f;r=r+1|0}c[d>>2]=(c[d>>2]|0)-(c[d+4>>2]|0);return}function Qd(f,j,l,m,n,o){f=f|0;j=j|0;l=l|0;m=m|0;n=n|0;o=o|0;var p=0,q=0.0,r=0,s=0,t=0,u=0,v=0.0,w=0.0,x=0,y=0,z=0,A=0,B=0,C=0.0,D=0,E=0,F=0,G=0,H=0.0,I=0.0,J=0,K=0.0,L=0.0,M=0.0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,Y=0,Z=0,$=0,ba=0,ca=0,da=0,ea=0,fa=0,ga=0,ha=0,ia=0,ja=0,ka=0,la=0,ma=0,na=0,oa=0,pa=0,qa=0,ra=0,sa=0,ta=0,ua=0,va=0,wa=0,xa=0,ya=0,za=0,Aa=0,Ba=0,Ca=0,Da=0,Ea=0,Fa=0,Ga=0,Ha=0,Ia=0,Ja=0,Ka=0,La=0,Ma=0,Na=0,Oa=0,Pa=0,Qa=0,Ra=0,Sa=0,Ta=0,Ua=0,Va=0,Wa=0,Xa=0,Ya=0,Za=0,_a=0,$a=0,ab=0,bb=0,cb=0,db=0,eb=0,fb=0,gb=0,hb=0,ib=0,jb=0.0,kb=0,lb=0;ib=i;i=i+35104|0;Qa=ib+272|0;Pa=ib+72|0;La=ib+29992|0;Ka=ib+29352|0;la=ib+28712|0;ma=ib+28392|0;Oa=ib+48|0;Na=ib+26008|0;Ma=ib+24472|0;da=ib+11992|0;ea=ib+11896|0;W=ib+33512|0;ia=ib+9176|0;ha=ib+6456|0;Q=ib+32232|0;R=ib+31272|0;P=ib+6384|0;Ga=ib+6320|0;Ia=ib+6256|0;Ha=ib+4720|0;bb=ib+23720|0;fa=ib+21032|0;eb=ib+20984|0;fb=ib+24|0;gb=ib;cb=ib+16536|0;db=ib+12088|0;ab=ib+12072|0;_a=ib+33824|0;$a=ib+12056|0;Ya=ib+33816|0;Za=ib+12040|0;c[$a>>2]=0;c[$a+4>>2]=0;c[$a+8>>2]=0;c[$a+12>>2]=0;Va=f+4712|0;Wa=c[Va>>2]|0;c[Va>>2]=Wa+1;Va=f+4862|0;a[Va>>0]=Wa&3;Wa=f+4684|0;ka=c[Wa>>2]|0;Xa=f+7272+(ka<<2)|0;ka=fa+(ka<<2)|0;J=f+5190|0;Ua=f+4676|0;p=c[Ua>>2]|0;s=c[f+28>>2]|0;if(s){t=f+24|0;u=c[t>>2]|0;r=256-u<<10;x=r>>16;r=r-(x<<16)|0;a:do if((x|0)<4){if((r|0)<=0){Ra=17528+(x*12|0)|0;c[Qa>>2]=c[Ra>>2];c[Qa+4>>2]=c[Ra+4>>2];c[Qa+8>>2]=c[Ra+8>>2];Ra=17588+(x<<3)|0;Sa=c[Ra+4>>2]|0;Ta=Pa;c[Ta>>2]=c[Ra>>2];c[Ta+4>>2]=Sa;break}y=x+1|0;z=r<<16>>16;if((r|0)<32768){r=0;while(1){if((r|0)==3){r=0;break}Sa=c[17528+(x*12|0)+(r<<2)>>2]|0;Ta=(c[17528+(y*12|0)+(r<<2)>>2]|0)-Sa|0;c[Qa+(r<<2)>>2]=Sa+((_(Ta>>16,z)|0)+((_(Ta&65535,z)|0)>>16));r=r+1|0}while(1){if((r|0)==2)break a;Sa=c[17588+(x<<3)+(r<<2)>>2]|0;Ta=(c[17588+(y<<3)+(r<<2)>>2]|0)-Sa|0;c[Pa+(r<<2)>>2]=Sa+((_(Ta>>16,z)|0)+((_(Ta&65535,z)|0)>>16));r=r+1|0}}else{r=0;while(1){if((r|0)==3){r=0;break}Sa=c[17528+(y*12|0)+(r<<2)>>2]|0;Ta=Sa-(c[17528+(x*12|0)+(r<<2)>>2]|0)|0;c[Qa+(r<<2)>>2]=Sa+((_(Ta>>16,z)|0)+((_(Ta&65535,z)|0)>>16));r=r+1|0}while(1){if((r|0)==2)break a;Sa=c[17588+(y<<3)+(r<<2)>>2]|0;Ta=Sa-(c[17588+(x<<3)+(r<<2)>>2]|0)|0;c[Pa+(r<<2)>>2]=Sa+((_(Ta>>16,z)|0)+((_(Ta&65535,z)|0)>>16));r=r+1|0}}}else{c[Qa>>2]=c[4394];c[Qa+4>>2]=c[4395];c[Qa+8>>2]=c[4396];Ta=Pa;c[Ta>>2]=35497197;c[Ta+4>>2]=57401098}while(0);r=u+s|0;c[t>>2]=(r|0)>256?256:(r|0)<0?0:r;r=f+16|0;z=0-(c[Pa>>2]|0)|0;s=z&16383;D=0-(c[Pa+4>>2]|0)|0;t=D&16383;x=c[Qa>>2]|0;u=x>>16;x=x&65535;y=f+20|0;z=z>>>14<<16>>16;B=c[Qa+4>>2]|0;A=B>>16;B=B&65535;D=D>>>14<<16>>16;F=c[Qa+8>>2]|0;E=F>>16;F=F&65535;G=0;while(1){if((G|0)>=(p|0))break;Ta=J+(G<<1)|0;Ra=b[Ta>>1]|0;Sa=(c[r>>2]|0)+((_(u,Ra)|0)+((_(x,Ra)|0)>>16))<<2;Ea=Sa>>16;Fa=Sa&65532;c[r>>2]=(c[y>>2]|0)+(((_(Ea,s)|0)+((_(Fa,s)|0)>>>16)>>13)+1>>1)+((_(Ea,z)|0)+((_(Fa,z)|0)>>16))+((_(A,Ra)|0)+((_(B,Ra)|0)>>16));c[y>>2]=(((_(Ea,t)|0)+((_(Fa,t)|0)>>>16)>>13)+1>>1)+((_(Ea,D)|0)+((_(Fa,D)|0)>>16))+((_(E,Ra)|0)+((_(F,Ra)|0)>>16));Sa=Sa+16383>>14;b[Ta>>1]=(Sa|0)>32767?32767:((Sa|0)<-32768?-32768:Sa)&65535;G=G+1|0}p=c[Ua>>2]|0}Ta=f+4668|0;s=Xa+((c[Ta>>2]|0)*5<<2)|0;while(1){r=p+-1|0;if((p|0)<=0){p=0;break}g[s+(r<<2)>>2]=+(b[J+(r<<1)>>1]|0);p=r}while(1){if((p|0)==8)break;Sa=Xa+(((c[Ta>>2]|0)*5|0)+(_(p,c[Ua>>2]>>3)|0)<<2)|0;g[Sa>>2]=+g[Sa>>2]+ +(1-(p&2)|0)*9.999999974752427e-07;p=p+1|0}Sa=f+4772|0;b:do if(!(c[Sa>>2]|0)){t=c[f+4688>>2]|0;A=c[Wa>>2]|0;z=t+(c[Ua>>2]|0)+A|0;A=Xa+(0-A<<2)|0;u=c[f+4640>>2]|0;p=A+(z<<2)+(0-u<<2)|0;v=3.1415927410125732/+(t+1|0);w=2.0-v*v;q=0.0;r=0;while(1){if((r|0)>=(t|0))break;g[Ha+(r<<2)>>2]=+g[p+(r<<2)>>2]*.5*(q+v);Ra=r|1;g[Ha+(Ra<<2)>>2]=+g[p+(Ra<<2)>>2]*v;M=w*v-q;Ra=r|2;g[Ha+(Ra<<2)>>2]=+g[p+(Ra<<2)>>2]*.5*(v+M);Ra=r|3;g[Ha+(Ra<<2)>>2]=+g[p+(Ra<<2)>>2]*M;q=M;v=w*M-v;r=r+4|0}Ra=Ha+(t<<2)|0;s=p+(t<<2)|0;r=u-(t<<1)|0;rf(Ra|0,s|0,r<<2|0)|0;p=Ra+(r<<2)|0;r=s+(r<<2)|0;q=1.0;v=w*.5;s=0;while(1){if((s|0)>=(t|0))break;g[p+(s<<2)>>2]=+g[r+(s<<2)>>2]*.5*(q+v);Ra=s|1;g[p+(Ra<<2)>>2]=+g[r+(Ra<<2)>>2]*v;M=w*v-q;Ra=s|2;g[p+(Ra<<2)>>2]=+g[r+(Ra<<2)>>2]*.5*(v+M);Ra=s|3;g[p+(Ra<<2)>>2]=+g[r+(Ra<<2)>>2]*M;q=M;v=w*M-v;s=s+4|0}y=f+4740|0;x=c[y>>2]|0;p=(x|0)<(u|0)?x+1|0:u;r=0;while(1){if((r|0)>=(p|0))break;g[P+(r<<2)>>2]=+Vd(Ha,Ha+(r<<2)|0,u-r|0);r=r+1|0}v=+g[P>>2];v=v+(v*1.0000000474974513e-03+1.0);g[P>>2]=v;p=0;while(1){if((p|0)>(x|0))break;M=+g[P+(p<<2)>>2];h[Qa+(p<<4)+8>>3]=M;h[Qa+(p<<4)>>3]=M;p=p+1|0}ja=Qa+8|0;s=0;c:while(1){if((x|0)<=(s|0))break;p=s+1|0;q=+h[ja>>3];q=-+h[Qa+(p<<4)>>3]/(q>9.999999717180685e-10?q:9.999999717180685e-10);g[Ia+(s<<2)>>2]=q;r=x-s|0;t=0;while(1){if((t|0)>=(r|0)){s=p;continue c}Fa=Qa+(t+s+1<<4)|0;M=+h[Fa>>3];Ra=Qa+(t<<4)+8|0;L=+h[Ra>>3];h[Fa>>3]=M+L*q;h[Ra>>3]=L+M*q;t=t+1|0}}M=+h[ja>>3];ga=bb+704|0;g[ga>>2]=v/(M>1.0?M:1.0);s=0;while(1){if((s|0)>=(x|0))break;q=+g[Ia+(s<<2)>>2];p=s+1|0;r=p>>1;t=0;while(1){if((t|0)>=(r|0))break;Fa=Ga+(t<<2)|0;M=+g[Fa>>2];Ra=Ga+(s-t+-1<<2)|0;L=+g[Ra>>2];g[Fa>>2]=M+L*q;g[Ra>>2]=L+M*q;t=t+1|0}g[Ga+(s<<2)>>2]=-q;s=p}p=x+-1|0;q=.9900000095367432;r=0;while(1){if((r|0)>=(p|0))break;Ra=Ga+(r<<2)|0;g[Ra>>2]=+g[Ra>>2]*q;q=q*.9900000095367432;r=r+1|0}Ra=Ga+(p<<2)|0;g[Ra>>2]=+g[Ra>>2]*q;Rd(fa,Ga,A,z,x);Ra=f+4857|0;p=a[Ra>>0]|0;do if(p<<24>>24!=0?(c[f+4756>>2]|0)==0:0){C=.6000000238418579-+(c[y>>2]|0)*.004000000189989805-+(c[f+4624>>2]|0)*.10000000149011612*.00390625-+(a[f+4633>>0]>>1|0)*.15000000596046448-+(c[f+4804>>2]|0)*.10000000149011612*.000030517578125;J=bb+228|0;ba=f+4854|0;ca=f+4856|0;P=f+10152|0;F=c[f+4636>>2]|0;w=+(c[f+4744>>2]|0)*.0000152587890625;T=c[Ta>>2]|0;U=c[f+4736>>2]|0;Z=c[f+4672>>2]|0;x=_((Z*5|0)+20|0,T)|0;E=Z*20|0;r=E+80|0;D=(Z*40|0)+160|0;V=T*5|0;$=T<<1;Y=T*18|0;S=Y+-1|0;G=(T|0)==16;d:do if(G){p=x;while(1){u=p+-1|0;if((p|0)<=0)break;q=+g[fa+(u<<2)>>2];s=(g[k>>2]=q,c[k>>2]|0);t=(s&2130706432)>>>0>1249902592;if(!t){p=(s|0)<0;v=p?q+-8388608.0+8388608.0:q+8388608.0+-8388608.0;if(v==0.0)v=p?-0.0:0.0}else v=q;if((~~v|0)<=32767){if(!t){p=(s|0)<0;v=p?q+-8388608.0+8388608.0:q+8388608.0+-8388608.0;if(v==0.0)v=p?-0.0:0.0}else v=q;if((~~v|0)<-32768)p=-32768;else{if(!t){p=(s|0)<0;q=p?q+-8388608.0+8388608.0:q+8388608.0+-8388608.0;if(q==0.0)q=p?-0.0:0.0}p=~~q}}else p=32767;b[Q+(u<<1)>>1]=p;p=u}s=Oa;c[s>>2]=0;c[s+4>>2]=0;xe(Oa,la,Q,x);s=D;while(1){p=s+-1|0;if((s|0)<=0){p=la;break d}g[La+(p<<2)>>2]=+(b[la+(p<<1)>>1]|0);s=p}}else{if((T|0)==12)p=x;else{p=D;while(1){u=p+-1|0;if((p|0)<=0)break;q=+g[fa+(u<<2)>>2];s=(g[k>>2]=q,c[k>>2]|0);t=(s&2130706432)>>>0>1249902592;if(!t){p=(s|0)<0;v=p?q+-8388608.0+8388608.0:q+8388608.0+-8388608.0;if(v==0.0)v=p?-0.0:0.0}else v=q;if((~~v|0)<=32767){if(!t){p=(s|0)<0;v=p?q+-8388608.0+8388608.0:q+8388608.0+-8388608.0;if(v==0.0)v=p?-0.0:0.0}else v=q;if((~~v|0)<-32768)p=-32768;else{if(!t){p=(s|0)<0;q=p?q+-8388608.0+8388608.0:q+8388608.0+-8388608.0;if(q==0.0)q=p?-0.0:0.0}p=~~q}}else p=32767;b[la+(u<<1)>>1]=p;p=u}p=la;break}while(1){u=p+-1|0;if((p|0)<=0)break;q=+g[fa+(u<<2)>>2];s=(g[k>>2]=q,c[k>>2]|0);t=(s&2130706432)>>>0>1249902592;if(!t){p=(s|0)<0;v=p?q+-8388608.0+8388608.0:q+8388608.0+-8388608.0;if(v==0.0)v=p?-0.0:0.0}else v=q;if((~~v|0)<=32767){if(!t){p=(s|0)<0;v=p?q+-8388608.0+8388608.0:q+8388608.0+-8388608.0;if(v==0.0)v=p?-0.0:0.0}else v=q;if((~~v|0)<-32768)p=-32768;else{if(!t){p=(s|0)<0;q=p?q+-8388608.0+8388608.0:q+8388608.0+-8388608.0;if(q==0.0)q=p?-0.0:0.0}p=~~q}}else p=32767;b[R+(u<<1)>>1]=p;p=u}c[Oa>>2]=0;c[Oa+4>>2]=0;c[Oa+8>>2]=0;c[Oa+12>>2]=0;c[Oa+16>>2]=0;c[Oa+20>>2]=0;c[Qa>>2]=0;c[Qa+4>>2]=0;c[Qa+8>>2]=0;c[Qa+12>>2]=0;z=Oa+16|0;A=Qa+16|0;B=Oa+20|0;u=la;y=R;p=x;while(1){x=(p|0)<480?p:480;s=0;while(1){if((s|0)>=(x|0)){s=Qa;t=x;break}Fa=(c[z>>2]|0)+(b[y+(s<<1)>>1]<<8)|0;c[A+(s<<2)>>2]=Fa;Fa=Fa<<2;Ea=Fa>>16;Fa=Fa&65532;c[z>>2]=(c[B>>2]|0)+((_(Ea,-2797)|0)+((_(Fa,-2797)|0)>>16));c[B>>2]=(_(Ea,-6507)|0)+((_(Fa,-6507)|0)>>16);s=s+1|0}while(1){if((t|0)<=2)break;za=c[s>>2]|0;Ba=s+4|0;Aa=c[Ba>>2]|0;Ca=s+8|0;Ea=c[Ca>>2]|0;Fa=s+12|0;Da=c[Fa>>2]|0;Da=(((za>>16)*4697|0)+(((za&65535)*4697|0)>>>16)+(((Aa>>16)*10739|0)+(((Aa&65535)*10739|0)>>>16))+(((Ea>>16)*8276|0)+(((Ea&65535)*8276|0)>>>16))+(((Da>>16)*1567|0)+(((Da&65535)*1567|0)>>>16))>>5)+1>>1;b[u>>1]=(Da|0)>32767?32767:((Da|0)<-32768?-32768:Da)&65535;Ba=c[Ba>>2]|0;Ca=c[Ca>>2]|0;Da=c[Fa>>2]|0;Ea=c[s+16>>2]|0;Ea=(((Ba>>16)*1567|0)+(((Ba&65535)*1567|0)>>>16)+(((Ca>>16)*8276|0)+(((Ca&65535)*8276|0)>>>16))+(((Da>>16)*10739|0)+(((Da&65535)*10739|0)>>>16))+(((Ea>>16)*4697|0)+(((Ea&65535)*4697|0)>>>16))>>5)+1>>1;b[u+2>>1]=(Ea|0)>32767?32767:((Ea|0)<-32768?-32768:Ea)&65535;u=u+4|0;s=Fa;t=t+-3|0}p=p-x|0;if((p|0)<=0)break;Fa=Qa+(x<<2)|0;c[Qa>>2]=c[Fa>>2];c[Qa+4>>2]=c[Fa+4>>2];c[Qa+8>>2]=c[Fa+8>>2];c[Qa+12>>2]=c[Fa+12>>2];y=y+(x<<1)|0}s=Qa+(x<<2)|0;c[Oa>>2]=c[s>>2];c[Oa+4>>2]=c[s+4>>2];c[Oa+8>>2]=c[s+8>>2];c[Oa+12>>2]=c[s+12>>2];s=D;while(1){p=s+-1|0;if((s|0)<=0){p=la;break d}g[La+(p<<2)>>2]=+(b[la+(p<<1)>>1]|0);s=p}}while(0);Fa=Oa;c[Fa>>2]=0;c[Fa+4>>2]=0;xe(Oa,ma,p,D);while(1){p=r+-1|0;if((r|0)<=0)break;g[Ka+(p<<2)>>2]=+(b[ma+(p<<1)>>1]|0);r=p}p=E+79|0;while(1){if((p|0)<=0)break;r=Ka+(p<<2)|0;p=p+-1|0;q=+(~~+g[r>>2]|0)+ +g[Ka+(p<<2)>>2];if(!(q>32767.0)){if(q<-32768.0)q=-32768.0}else q=32767.0;g[r>>2]=+(~~q<<16>>16)}nf(Na|0,0,Z*596|0)|0;p=Z>>1;r=Ma+256|0;y=Na+32|0;u=0;x=Ka+320|0;while(1){if((u|0)>=(p|0)){p=72;break}s=x+-32|0;hd(x,x+-288|0,Ma,40,65);M=+g[r>>2];q=+Ud(x,40);q=q+ +Ud(s,40)+16.0e4;g[y>>2]=+g[y>>2]+M*2.0/q;t=9;while(1){if((t|0)==73)break;Fa=s+-4|0;L=+g[Fa>>2];M=+g[s+156>>2];M=q+(L*L-M*M);Ea=Na+(t<<2)|0;g[Ea>>2]=+g[Ea>>2]+ +g[Ma+(72-t<<2)>>2]*2.0/M;s=Fa;t=t+1|0;q=M}u=u+1|0;x=x+160|0}while(1){if((p|0)<=7)break;Fa=Na+(p<<2)|0;M=+g[Fa>>2];g[Fa>>2]=M-M*+(p|0)*.000244140625;p=p+-1|0}x=U<<1;r=x+4|0;p=0;while(1){if((p|0)>=(r|0)){p=1;break}c[ea+(p<<2)>>2]=p;p=p+1|0}while(1){if((p|0)>=(r|0))break;q=+g[y+(p<<2)>>2];t=p;while(1){s=t+-1|0;if((t|0)<=0)break;v=+g[y+(s<<2)>>2];if(!(q>v))break;g[y+(t<<2)>>2]=v;c[ea+(t<<2)>>2]=c[ea+(s<<2)>>2];t=s}g[y+(t<<2)>>2]=q;c[ea+(t<<2)>>2]=p;p=p+1|0}u=y+(x+3<<2)|0;p=x+2|0;s=r;while(1){if((s|0)>=65)break;q=+g[y+(s<<2)>>2];if(q>+g[u>>2]){t=p;while(1){if((t|0)<=-1)break;v=+g[y+(t<<2)>>2];if(!(q>v))break;Fa=t+1|0;g[y+(Fa<<2)>>2]=v;c[ea+(Fa<<2)>>2]=c[ea+(t<<2)>>2];t=t+-1|0}Fa=t+1|0;g[y+(Fa<<2)>>2]=q;c[ea+(Fa<<2)>>2]=s}s=s+1|0}q=+g[y>>2];do if(q<.20000000298023224){nf(J|0,0,Z<<2|0)|0;g[P>>2]=0.0;b[ba>>1]=0;a[ca>>0]=0;p=0}else{q=q*w;p=0;while(1){if((p|0)>=(r|0))break;if(!(+g[Na+(p+8<<2)>>2]>q)){r=p;break}Fa=ea+(p<<2)|0;c[Fa>>2]=(c[Fa>>2]<<1)+16;p=p+1|0}p=11;while(1){if((p|0)==148){p=0;break}b[W+(p<<1)>>1]=0;p=p+1|0}while(1){if((p|0)>=(r|0)){p=146;break}b[W+(c[ea+(p<<2)>>2]<<1)>>1]=1;p=p+1|0}while(1){if((p|0)<=15){r=16;E=0;break}Fa=p+-1|0;Ea=W+(p<<1)|0;b[Ea>>1]=(e[Ea>>1]|0)+((e[W+(Fa<<1)>>1]|0)+(e[W+(p+-2<<1)>>1]|0));p=Fa}while(1){if((r|0)==144){p=146;break}p=r+1|0;if((b[W+(p<<1)>>1]|0)<=0){r=p;continue}c[ea+(E<<2)>>2]=r;r=p;E=E+1|0}while(1){if((p|0)<=15){r=16;p=0;break}Fa=p+-1|0;Ea=W+(p<<1)|0;b[Ea>>1]=(e[Ea>>1]|0)+((e[W+(Fa<<1)>>1]|0)+(e[W+(p+-2<<1)>>1]|0)+(e[W+(p+-3<<1)>>1]|0));p=Fa}while(1){if((r|0)==147)break;if((b[W+(r<<1)>>1]|0)>0){b[W+(p<<1)>>1]=r+65534;p=p+1|0}r=r+1|0}nf(Na|0,0,2384)|0;y=(T|0)==8;u=0;x=y?fa+640|0:La+640|0;while(1){if((u|0)>=(Z|0))break;v=+Ud(x,40)+1.0;t=0;while(1){if((t|0)>=(p|0))break;s=b[W+(t<<1)>>1]|0;r=x+(0-s<<2)|0;q=+Vd(r,x,40);if(q>0.0)q=q*2.0/(+Ud(r,40)+v);else q=0.0;g[Na+(u*596|0)+(s<<2)>>2]=q;t=t+1|0}u=u+1|0;x=x+160|0}if((F|0)>0){if((T|0)==12)p=(F<<1|0)/3|0;else p=F>>(G&1);r=p;M=+Ge(+(p|0))*3.32192809488736}else{r=F;M=0.0}Q=(Z|0)==4;if(Q){B=32969;D=11;A=y&(U|0)>0?11:3}else{B=32935;D=3;A=3}K=+(Z|0);L=K*.20000000298023224;y=(r|0)>0;C=K*C;r=0;H=0.0;I=-1.0e3;x=0;z=-1;while(1){if((x|0)>=(E|0))break;u=c[ea+(x<<2)>>2]|0;t=0;while(1){if((t|0)>=(A|0)){s=0;w=-1.0e3;p=0;break}p=da+(t<<2)|0;g[p>>2]=0.0;q=0.0;s=0;while(1){if((s|0)>=(Z|0))break;w=q+ +g[Na+(s*596|0)+(u+(a[B+((_(s,D)|0)+t)>>0]|0)<<2)>>2];g[p>>2]=w;q=w;s=s+1|0}t=t+1|0}while(1){if((p|0)>=(A|0))break;v=+g[da+(p<<2)>>2];Fa=v>w;s=Fa?p:s;w=Fa?v:w;p=p+1|0}v=+Ge(+(u|0))*3.32192809488736;q=w-L*v;if(y){v=v-M;v=v*v;q=q-L*+g[P>>2]*v/(v+.5)}Fa=q>I&w>C;r=Fa?s:r;H=Fa?w:H;I=Fa?q:I;x=x+1|0;z=Fa?u:z}if((z|0)==-1){c[J>>2]=0;c[J+4>>2]=0;c[J+8>>2]=0;c[J+12>>2]=0;g[P>>2]=0.0;b[ba>>1]=0;a[ca>>0]=0;p=0;break}g[P>>2]=H/K;if((T|0)>8){if((T|0)==12){p=(z<<16>>16)*3|0;p=(p>>1)+(p&1)|0}else p=z<<1;if(($|0)<(Y|0))if((p|0)<(Y|0))x=(p|0)<($|0)?$:p;else x=S;else if((p|0)>($|0))x=$;else x=(p|0)<(S|0)?S:p;J=x+-2|0;J=(J|0)>($|0)?J:$;P=x+2|0;P=(P|0)<(S|0)?P:S;if(Q){B=33013;D=33149+(U<<3)|0;E=34;F=a[33173+U>>0]|0}else{B=32941;D=32965;E=12;F=12}G=fa+(T*20<<2)|0;u=0-J|0;z=0;A=G;while(1){if((z|0)>=(Z|0))break;p=z<<1;y=a[D+p>>0]|0;p=a[D+(p|1)>>0]|0;hd(A,A+(u<<2)+(0-p<<2)|0,Qa,V,p-y+1|0);r=y;s=0;while(1){if((p|0)<(r|0))break;c[Pa+(s<<2)>>2]=c[Qa+(p-r<<2)>>2];r=r+1|0;s=s+1|0}p=_(z,E)|0;s=0;while(1){if((s|0)>=(F|0))break;r=(a[B+(p+s)>>0]|0)-y|0;t=0;while(1){if((t|0)==5)break;c[ha+(z*680|0)+(s*20|0)+(t<<2)>>2]=c[Pa+(r+t<<2)>>2];t=t+1|0}s=s+1|0}z=z+1|0;A=A+(V<<2)|0}if(Q){y=33013;z=33149+(U<<3)|0;A=34;D=a[33173+U>>0]|0}else{y=32941;z=32965;A=12;D=12}B=0;E=G;while(1){if((B|0)>=(Z|0))break;r=B<<1;u=a[z+r>>0]|0;p=E+(0-(u+J)<<2)|0;q=+Ud(p,V)+.001;g[Pa>>2]=q;r=(a[z+(r|1)>>0]|0)-u|0;s=1;while(1){if((s|0)>(r|0))break;L=+g[p+(V-s<<2)>>2];M=+g[p+(0-s<<2)>>2];M=q-L*L+M*M;g[Pa+(s<<2)>>2]=M;q=M;s=s+1|0}p=_(B,A)|0;s=0;while(1){if((s|0)>=(D|0))break;r=(a[y+(p+s)>>0]|0)-u|0;t=0;while(1){if((t|0)==5)break;c[ia+(B*680|0)+(s*20|0)+(t<<2)>>2]=c[Pa+(r+t<<2)>>2];t=t+1|0}s=s+1|0}B=B+1|0;E=E+(V<<2)|0}H=.05000000074505806/+(x|0);if(Q){A=33013;B=34;z=a[33173+U>>0]|0}else{A=32941;B=12;z=12}C=+Ud(G,_(V,Z)|0)+1.0;r=0;q=-1.0e3;u=J;y=0;while(1){if((u|0)>(P|0))break;else{t=0;p=x}while(1){if((t|0)<(z|0)){v=0.0;w=C;s=0}else break;while(1){if((s|0)>=(Z|0))break;v=v+ +g[ha+(s*680|0)+(t*20|0)+(y<<2)>>2];w=w+ +g[ia+(s*680|0)+(t*20|0)+(y<<2)>>2];s=s+1|0}if(v>0.0)v=v*2.0/w*(1.0-H*+(t|0));else v=0.0;if(v>q){Fa=(u+(a[33013+t>>0]|0)|0)<(Y|0);r=Fa?t:r;q=Fa?v:q;p=Fa?u:p}t=t+1|0}u=u+1|0;y=y+1|0;x=p}s=($|0)>(Y|0);u=0;while(1){if((u|0)>=(Z|0))break;p=x+(a[A+((_(u,B)|0)+r)>>0]|0)|0;t=bb+228+(u<<2)|0;c[t>>2]=p;do if(s){if((p|0)>($|0)){p=$;break}p=(p|0)<(Y|0)?Y:p}else{if((p|0)>(Y|0)){p=Y;break}p=(p|0)<($|0)?$:p}while(0);c[t>>2]=p;u=u+1|0}p=x-$|0}else{p=0;while(1){if((p|0)>=(Z|0))break;Fa=z+(a[B+((_(p,D)|0)+r)>>0]|0)|0;c[bb+228+(p<<2)>>2]=(Fa|0)>144?144:(Fa|0)<16?16:Fa;p=p+1|0}p=z+65520|0}b[ba>>1]=p;a[ca>>0]=r;p=1}while(0);if(p){a[Ra>>0]=2;p=2;break}else{a[Ra>>0]=1;p=1;break}}else hb=264;while(0);if((hb|0)==264){Fa=bb+228|0;c[Fa>>2]=0;c[Fa+4>>2]=0;c[Fa+8>>2]=0;c[Fa+12>>2]=0;b[f+4854>>1]=0;a[f+4856>>0]=0;g[f+10152>>2]=0.0}y=Xa+(0-(c[f+4692>>2]|0)<<2)|0;Ba=f+4808|0;v=+(c[Ba>>2]|0);q=v*.0078125;P=c[f+4788>>2]|0;w=+(P+(c[f+4792>>2]|0)|0)*.5*.000030517578125;Ca=bb+696|0;g[Ca>>2]=w;I=1.0/(+X(+-((q+-20.0)*.25))+1.0);Da=bb+700|0;g[Da>>2]=I;if(!(c[f+4768>>2]|0)){M=1.0-+(c[f+4624>>2]|0)*.00390625;q=q-I*2.0*(w*.5+.5)*M*M}Q=p<<24>>24==2;do if(!Q){H=q+(v*-.4000000059604645*.0078125+6.0)*(1.0-w);r=c[Ta>>2]<<1;u=f+4672|0;p=c[u>>2]|0;x=((p<<16>>16)*5|0)/2|0;w=+(r|0);q=0.0;s=0;v=0.0;t=ka;while(1){if((s|0)>=(x|0))break;C=+Ge(w+ +Ud(t,r))*3.32192809488736;if((s|0)>0)q=q+ +N(+(C-v));s=s+1|0;v=C;t=t+(r<<2)|0}r=f+4858|0;if(q>+(x+-1|0)*.6000000238418579){a[r>>0]=0;Fa=u;break}else{a[r>>0]=1;Fa=u;break}}else{H=q+ +g[f+10152>>2]*2.0;a[f+4858>>0]=0;p=f+4672|0;Fa=p;p=c[p>>2]|0}while(0);L=+g[ga>>2]*1.0000000474974513e-03;L=.9399999976158142/(L*L+1.0);J=c[f+4764>>2]|0;C=+(J|0)*.0000152587890625+I*.009999999776482582;E=f+4696|0;Ea=f+4680|0;F=f+4728|0;I=C;K=1.0-C*C;G=0;x=y;while(1){if((G|0)>=(p|0))break;r=c[Ta>>2]|0;s=r*3|0;y=c[E>>2]|0;u=(y-s|0)/2|0;v=3.1415927410125732/+(u+1|0);w=2.0-v*v;q=0.0;t=0;while(1){if((t|0)>=(u|0))break;g[La+(t<<2)>>2]=+g[x+(t<<2)>>2]*.5*(q+v);Aa=t|1;g[La+(Aa<<2)>>2]=+g[x+(Aa<<2)>>2]*v;M=w*v-q;Aa=t|2;g[La+(Aa<<2)>>2]=+g[x+(Aa<<2)>>2]*.5*(v+M);Aa=t|3;g[La+(Aa<<2)>>2]=+g[x+(Aa<<2)>>2]*M;q=M;v=w*M-v;t=t+4|0}rf(La+(u<<2)|0,x+(u<<2)|0,r*12|0)|0;s=u+s|0;r=La+(s<<2)|0;s=x+(s<<2)|0;q=1.0;v=w*.5;t=0;while(1){if((t|0)>=(u|0))break;g[r+(t<<2)>>2]=+g[s+(t<<2)>>2]*.5*(q+v);Aa=t|1;g[r+(Aa<<2)>>2]=+g[s+(Aa<<2)>>2]*v;M=w*v-q;Aa=t|2;g[r+(Aa<<2)>>2]=+g[s+(Aa<<2)>>2]*.5*(v+M);Aa=t|3;g[r+(Aa<<2)>>2]=+g[s+(Aa<<2)>>2]*M;q=M;v=w*M-v;t=t+4|0}x=x+(c[Ea>>2]<<2)|0;z=(J|0)>0;D=c[F>>2]|0;e:do if(z){nf(Qa|0,0,200)|0;nf(Pa|0,0,200)|0;s=Qa+(D<<3)|0;t=Pa+(D<<3)|0;q=0.0;u=0;while(1){if((u|0)>=(y|0)){r=0;break}r=0;v=+g[La+(u<<2)>>2];while(1){if((r|0)>=(D|0))break;za=r|1;ya=Qa+(za<<3)|0;jb=+h[ya>>3];M=q+I*(jb-v);h[Qa+(r<<3)>>3]=v;Aa=Pa+(r<<3)|0;h[Aa>>3]=+h[Aa>>3]+ +h[Qa>>3]*v;Aa=r+2|0;w=+h[Qa+(Aa<<3)>>3];h[ya>>3]=M;za=Pa+(za<<3)|0;h[za>>3]=+h[za>>3]+ +h[Qa>>3]*M;q=w;r=Aa;v=jb+I*(w-M)}h[s>>3]=v;q=+h[Qa>>3];h[t>>3]=+h[t>>3]+q*v;u=u+1|0}while(1){if((r|0)>(D|0))break;g[Ka+(r<<2)>>2]=+h[Pa+(r<<3)>>3];r=r+1|0}}else{r=(D|0)<(y|0)?D+1|0:y;s=0;while(1){if((s|0)>=(r|0))break e;g[Ka+(s<<2)>>2]=+Vd(La,La+(s<<2)|0,y-s|0);s=s+1|0}}while(0);jb=+g[Ka>>2];g[Ka>>2]=jb+(jb*2.9999999242136255e-05+1.0);r=0;while(1){if((r|0)>(D|0)){t=0;break}jb=+g[Ka+(r<<2)>>2];h[Qa+(r<<4)+8>>3]=jb;h[Qa+(r<<4)>>3]=jb;r=r+1|0}f:while(1){if((D|0)<=(t|0))break;r=t+1|0;q=+h[ja>>3];q=-+h[Qa+(r<<4)>>3]/(q>9.999999717180685e-10?q:9.999999717180685e-10);g[la+(t<<2)>>2]=q;s=D-t|0;u=0;while(1){if((u|0)>=(s|0)){t=r;continue f}za=Qa+(u+t+1<<4)|0;jb=+h[za>>3];Aa=Qa+(u<<4)+8|0;M=+h[Aa>>3];h[za>>3]=jb+M*q;h[Aa>>3]=M+jb*q;u=u+1|0}}q=+h[ja>>3];B=bb+244+(G*24<<2)|0;t=0;while(1){if((t|0)>=(D|0))break;v=+g[la+(t<<2)>>2];r=t+1|0;s=r>>1;u=0;while(1){if((u|0)>=(s|0))break;za=B+(u<<2)|0;jb=+g[za>>2];Aa=B+(t-u+-1<<2)|0;M=+g[Aa>>2];g[za>>2]=jb+M*v;g[Aa>>2]=M+jb*v;u=u+1|0}g[B+(t<<2)>>2]=-v;t=r}v=+O(+q);r=bb+(G<<2)|0;g[r>>2]=v;A=D+-1|0;if(z){q=+g[B+(A<<2)>>2];s=D+-2|0;while(1){q=C*q;if((s|0)<=-1)break;q=+g[B+(s<<2)>>2]-q;s=s+-1|0}g[r>>2]=v*(1.0/(q+1.0));q=L;r=0}else{q=L;r=0}while(1){if((r|0)>=(A|0))break;Aa=B+(r<<2)|0;g[Aa>>2]=+g[Aa>>2]*q;q=q*L;r=r+1|0}y=B+(A<<2)|0;q=+g[y>>2]*q;g[y>>2]=q;g:do if(z){r=D;while(1){if((r|0)<=1)break;Aa=B+(r+-2<<2)|0;jb=+g[Aa>>2]-q*C;g[Aa>>2]=jb;q=jb;r=r+-1|0}q=K/(+g[B>>2]*C+1.0);r=0;while(1){if((r|0)>=(D|0)){r=0;u=0;break}Aa=B+(r<<2)|0;g[Aa>>2]=+g[Aa>>2]*q;r=r+1|0}while(1){if((u|0)<10){s=0;t=r;v=-1.0}else break g;while(1){if((s|0)>=(D|0))break;jb=+N(+(+g[B+(s<<2)>>2]));Aa=jb>v;za=Aa?s:t;s=s+1|0;t=za;v=Aa?jb:v}if(!(v<=3.999000072479248))r=1;else break g;while(1){if((r|0)>=(D|0))break;Aa=B+(r+-1<<2)|0;g[Aa>>2]=+g[Aa>>2]+ +g[B+(r<<2)>>2]*C;r=r+1|0}q=1.0/q;r=0;while(1){if((r|0)>=(D|0))break;Aa=B+(r<<2)|0;g[Aa>>2]=+g[Aa>>2]*q;r=r+1|0}q=.9900000095367432-(+(u|0)*.10000000149011612+.800000011920929)*(v+-3.999000072479248)/(v*+(t+1|0));v=q;r=0;while(1){if((r|0)>=(A|0))break;Aa=B+(r<<2)|0;g[Aa>>2]=+g[Aa>>2]*v;v=v*q;r=r+1|0}q=+g[y>>2]*v;g[y>>2]=q;r=D;while(1){if((r|0)<=1)break;Aa=B+(r+-2<<2)|0;jb=+g[Aa>>2]-q*C;g[Aa>>2]=jb;q=jb;r=r+-1|0}q=K/(+g[B>>2]*C+1.0);r=0;while(1){if((r|0)>=(D|0))break;Aa=B+(r<<2)|0;g[Aa>>2]=+g[Aa>>2]*q;r=r+1|0}r=t;u=u+1|0}}else{r=0;t=0;while(1){if((t|0)<10){s=0;q=-1.0}else break g;while(1){if((s|0)>=(D|0))break;jb=+N(+(+g[B+(s<<2)>>2]));Aa=jb>q;za=Aa?s:r;s=s+1|0;r=za;q=Aa?jb:q}if(q<=3.999000072479248)break g;q=.9900000095367432-(+(t|0)*.10000000149011612+.800000011920929)*(q+-3.999000072479248)/(q*+(r+1|0));v=q;s=0;while(1){if((s|0)>=(A|0))break;Aa=B+(s<<2)|0;g[Aa>>2]=+g[Aa>>2]*v;v=v*q;s=s+1|0}g[y>>2]=+g[y>>2]*v;t=t+1|0}}while(0);G=G+1|0}q=+nb(+(H*-.1599999964237213));r=0;while(1){if((r|0)>=(p|0))break;Aa=bb+(r<<2)|0;g[Aa>>2]=+g[Aa>>2]*q+1.2483305931091309;r=r+1|0}Aa=f+4624|0;q=+(c[Aa>>2]|0);v=((+(P|0)*.000030517578125+-1.0)*.5+1.0)*4.0*(q*.00390625);h:do if(Q){r=0;while(1){if((r|0)>=(p|0))break;jb=.20000000298023224/+(c[Ta>>2]|0)+3.0/+(c[bb+228+(r<<2)>>2]|0);g[bb+628+(r<<2)>>2]=jb+-1.0;g[bb+644+(r<<2)>>2]=1.0-jb-jb*v;r=r+1|0}v=-.25-q*.26249998807907104*.00390625}else{jb=1.2999999523162842/+(c[Ta>>2]|0);s=bb+628|0;g[s>>2]=jb+-1.0;t=bb+644|0;g[t>>2]=1.0-jb-jb*v*.6000000238418579;r=1;while(1){if((r|0)>=(p|0)){v=-.25;break h}c[bb+628+(r<<2)>>2]=c[s>>2];c[bb+644+(r<<2)>>2]=c[t>>2];r=r+1|0}}while(0);if(Q)q=((1.0-(1.0-+g[Da>>2])*+g[Ca>>2])*.20000000298023224+.30000001192092896)*+O(+(+g[f+10152>>2]));else q=0.0;r=f+7264|0;s=f+7268|0;t=0;while(1){if((t|0)>=(p|0))break;jb=+g[r>>2];jb=jb+(q-jb)*.4000000059604645;g[r>>2]=jb;g[bb+676+(t<<2)>>2]=jb;jb=+g[s>>2];jb=jb+(v-jb)*.4000000059604645;g[s>>2]=jb;g[bb+660+(t<<2)>>2]=jb;t=t+1|0}r=0;while(1){if((r|0)>=(p|0))break;g[Oa+(r<<2)>>2]=1.0/+g[bb+(r<<2)>>2];r=r+1|0}if(Q){D=c[Ea>>2]|0;E=D+5|0;y=ka;z=la;A=0;B=ma;while(1){if((A|0)>=(p|0))break;t=y+(-2-(c[bb+228+(A<<2)>>2]|0)<<2)|0;r=t+16|0;q=+Ud(r,D);g[z>>2]=q;s=1;while(1){if((s|0)==5)break;M=+g[r+(0-s<<2)>>2];jb=+g[r+(D-s<<2)>>2];jb=q+(M*M-jb*jb);g[z+(s*6<<2)>>2]=jb;q=jb;s=s+1|0}x=1;u=t+12|0;while(1){if((x|0)==5){s=0;break}q=+Vd(r,u,D);jb=q;g[z+(x*5<<2)>>2]=jb;g[z+(x<<2)>>2]=jb;s=5-x|0;t=1;while(1){if((t|0)>=(s|0))break;ya=0-t|0;za=D-t|0;jb=q+(+g[r+(ya<<2)>>2]*+g[u+(ya<<2)>>2]-+g[r+(za<<2)>>2]*+g[u+(za<<2)>>2]);M=jb;za=x+t|0;g[z+((za*5|0)+t<<2)>>2]=M;g[z+((t*5|0)+za<<2)>>2]=M;q=jb;t=t+1|0}x=x+1|0;u=u+-4|0}while(1){if((s|0)==5)break;g[B+(s<<2)>>2]=+Vd(r,y,D);s=s+1|0;r=r+-4|0}jb=+Ud(y,E);q=(+g[z>>2]+ +g[z+96>>2])*.014999999664723873+1.0;q=1.0/(jb>q?jb:q);r=0;while(1){if((r|0)>=24){r=24;break}za=z+(r<<2)|0;g[za>>2]=+g[za>>2]*q;za=z+((r|1)<<2)|0;g[za>>2]=+g[za>>2]*q;za=z+((r|2)<<2)|0;g[za>>2]=+g[za>>2]*q;za=z+((r|3)<<2)|0;g[za>>2]=+g[za>>2]*q;r=r+4|0}while(1){if((r|0)==25){r=0;break}za=z+(r<<2)|0;g[za>>2]=+g[za>>2]*q;r=r+1|0}while(1){if((r|0)>=4){r=4;break}za=B+(r<<2)|0;g[za>>2]=+g[za>>2]*q;za=B+((r|1)<<2)|0;g[za>>2]=+g[za>>2]*q;za=B+((r|2)<<2)|0;g[za>>2]=+g[za>>2]*q;za=B+((r|3)<<2)|0;g[za>>2]=+g[za>>2]*q;r=r+4|0}while(1){if((r|0)==5)break;za=B+(r<<2)|0;g[za>>2]=+g[za>>2]*q;r=r+1|0}y=y+(D<<2)|0;z=z+100|0;A=A+1|0;B=B+20|0}va=f+4832|0;za=f+4748|0;t=c[Ea>>2]|0;xa=c[Fa>>2]|0;r=xa*25|0;s=0;while(1){if((s|0)>=(r|0))break;q=+g[la+(s<<2)>>2]*131072.0;p=(g[k>>2]=q,c[k>>2]|0);if((p&2130706432)>>>0<=1249902592){p=(p|0)<0;q=p?q+-8388608.0+8388608.0:q+8388608.0+-8388608.0;if(q==0.0)q=p?-0.0:0.0}c[La+(s<<2)>>2]=~~q;s=s+1|0}ua=f+4860|0;ya=bb+708|0;wa=xa*5|0;r=0;while(1){if((r|0)>=(wa|0))break;q=+g[ma+(r<<2)>>2]*131072.0;p=(g[k>>2]=q,c[k>>2]|0);if((p&2130706432)>>>0<=1249902592){p=(p|0)<0;q=p?q+-8388608.0+8388608.0:q+8388608.0+-8388608.0;if(q==0.0)q=p?-0.0:0.0}c[Ka+(r<<2)>>2]=~~q;r=r+1|0}ra=t<<16>>16;ta=0;p=0;sa=0;r=2147483647;x=0;while(1){if((sa|0)==3)break;ma=c[17388+(sa<<2)>>2]|0;na=c[17400+(sa<<2)>>2]|0;oa=c[17412+(sa<<2)>>2]|0;pa=a[29888+sa>>0]|0;qa=La;A=p;ka=0;z=0;x=0;p=c[za>>2]|0;la=Ka;while(1){if((ka|0)>=(xa|0))break;ja=5333-p|0;s=ja+896|0;if((ja|0)>=-896)if((s|0)>3966)s=2147483647;else{t=s>>7;y=1<>16)<>7;else s=_(y>>7,u+((_(_(u,128-u|0)|0,-174)|0)>>16)|0)|0;s=y+s|0}else s=0;F=s+-51|0;G=Qa+ka|0;J=c[la>>2]<<7;P=c[la+4>>2]<<7;Q=c[la+8>>2]<<7;R=c[la+12>>2]<<7;ga=0-(c[la+16>>2]<<7)|0;a[G>>0]=0;S=qa+4|0;T=qa+8|0;U=qa+12|0;V=qa+16|0;W=qa+28|0;Y=qa+32|0;Z=qa+36|0;$=qa+24|0;ba=qa+52|0;ca=qa+56|0;da=qa+48|0;ea=qa+76|0;fa=qa+72|0;ga=ga<<1;ha=qa+96|0;ia=na;ja=A;D=0;E=2147483647;B=2147483647;while(1){if((D|0)>=(pa|0))break;u=d[oa+D>>0]|0;kb=a[ia+1>>0]|0;A=(_(c[S>>2]|0,kb)|0)-J|0;t=a[ia+2>>0]|0;A=A+(_(c[T>>2]|0,t)|0)|0;y=a[ia+3>>0]|0;A=A+(_(c[U>>2]|0,y)|0)|0;s=a[ia+4>>0]|0;A=A+(_(c[V>>2]|0,s)|0)<<1;lb=a[ia>>0]|0;A=A+(_(c[qa>>2]|0,lb)|0)|0;lb=(_(A>>16,lb)|0)+((_(A&65535,lb)|0)>>16)+32801|0;A=(_(c[W>>2]|0,t)|0)-P|0;A=A+(_(c[Y>>2]|0,y)|0)|0;A=A+(_(c[Z>>2]|0,s)|0)<<1;A=A+(_(c[$>>2]|0,kb)|0)|0;kb=lb+((_(A>>16,kb)|0)+((_(A&65535,kb)|0)>>16))|0;A=(_(c[ba>>2]|0,y)|0)-Q|0;A=A+(_(c[ca>>2]|0,s)|0)<<1;A=A+(_(c[da>>2]|0,t)|0)|0;t=kb+((_(A>>16,t)|0)+((_(A&65535,t)|0)>>16))|0;A=(_(c[ea>>2]|0,s)|0)-R<<1;A=A+(_(c[fa>>2]|0,y)|0)|0;y=t+((_(A>>16,y)|0)+((_(A&65535,y)|0)>>16))|0;A=ga+(_(c[ha>>2]|0,s)|0)|0;s=y+((_(A>>16,s)|0)+((_(A&65535,s)|0)>>16))|0;do if((s|0)>-1){s=s+((u|0)>(F|0)?u-F<<11:0)|0;A=aa(s|0)|0;t=24-A|0;y=0-t|0;do if(t)if((t|0)<0){t=s<>>(t+32|0);break}else{t=s<<32-t|s>>>t;break}else t=s;while(0);t=t&127;t=_(ra,(t+(((_(t,128-t|0)|0)*179|0)>>>16)+(31-A<<7)<<16)+-125829120>>16)|0;t=t+(d[ma+D>>0]<<2)|0;if((t|0)>(E|0)){u=ja;t=E;s=B;break}a[G>>0]=D}else{u=ja;t=E;s=B}while(0);ia=ia+5|0;ja=u;D=D+1|0;E=t;B=s}x=x+B|0;x=(x|0)<0?2147483647:x;z=z+E|0;z=(z|0)<0?2147483647:z;s=ja+51|0;y=aa(s|0)|0;t=24-y|0;u=0-t|0;do if(t)if((t|0)<0){t=s<>>(t+32|0);break}else{t=s<<32-t|s>>>t;break}else t=s;while(0);lb=t&127;if((p+(lb+(((_(lb,128-lb|0)|0)*179|0)>>>16)+(31-y<<7))|0)<896)p=0;else{y=aa(s|0)|0;t=24-y|0;u=0-t|0;do if(t)if((t|0)<0){s=s<>>(t+32|0);break}else{s=s<<32-t|s>>>t;break}while(0);lb=s&127;p=p+(lb+(((_(lb,128-lb|0)|0)*179|0)>>>16)+(31-y<<7))+-896|0}qa=qa+100|0;A=ja;ka=ka+1|0;la=la+20|0}if((z|0)>(r|0))p=ta;else{a[ua>>0]=sa;rf(va|0,Qa|0,xa|0)|0;r=z}ta=p;p=A;sa=sa+1|0}p=c[17400+(a[ua>>0]<<2)>>2]|0;t=0;while(1){if((t|0)>=(xa|0))break;r=f+4832+t|0;s=t*5|0;u=0;while(1){if((u|0)==5)break;b[Pa+(s+u<<1)>>1]=a[p+(((a[r>>0]|0)*5|0)+u)>>0]<<7;u=u+1|0}t=t+1|0}p=x>>((xa|0)==2?1:2);c[za>>2]=ta;t=aa(p|0)|0;r=24-t|0;s=0-r|0;do if(r)if((r|0)<0){p=p<>>(r+32|0);break}else{p=p<<32-r|p>>>r;break}while(0);p=p&127;p=(p+(((_(p,128-p|0)|0)*179|0)>>>16)+(31-t<<7)<<16)+-125829120>>16;r=0;while(1){if((r|0)>=(wa|0))break;g[bb+144+(r<<2)>>2]=+(b[Pa+(r<<1)>>1]|0)*.00006103515625;r=r+1|0}q=+(_(p,-3)|0)*.0078125;g[ya>>2]=q;if(!m){q=+((c[f+4708>>2]|0)+(c[f+5836>>2]|0)|0)*q*.10000000149011612;if(!(q>2.0)){if(q<0.0)q=0.0}else q=2.0;p=~~q;a[f+4861>>0]=p}else{a[f+4861>>0]=0;p=0}g[bb+224>>2]=+(b[25412+(p<<24>>24<<1)>>1]|0)*.00006103515625;B=c[f+4732>>2]|0;u=c[Ea>>2]|0;x=c[Fa>>2]|0;y=u+B|0;z=Ma;A=0;B=Xa+(0-B<<2)|0;while(1){if((A|0)>=(x|0))break;s=0-(c[bb+228+(A<<2)>>2]|0)|0;v=+g[Oa+(A<<2)>>2];p=A*5|0;r=0;while(1){if((r|0)==5)break;c[Qa+(r<<2)>>2]=c[bb+144+(p+r<<2)>>2];r=r+1|0}t=0;s=B+(s<<2)|0;while(1){if((t|0)>=(y|0))break;r=c[B+(t<<2)>>2]|0;p=z+(t<<2)|0;c[p>>2]=r;q=(c[k>>2]=r,+g[k>>2]);r=0;while(1){if((r|0)==5)break;jb=q-+g[Qa+(r<<2)>>2]*+g[s+(2-r<<2)>>2];g[p>>2]=jb;q=jb;r=r+1|0}g[p>>2]=q*v;t=t+1|0;s=s+4|0}z=z+(y<<2)|0;A=A+1|0;B=B+(u<<2)|0}}else{z=f+4732|0;y=c[z>>2]|0;r=y;u=0;x=Ma;y=Xa+(0-y<<2)|0;while(1){if((u|0)>=(p|0))break;q=+g[Oa+(u<<2)>>2];p=c[Ea>>2]|0;t=p+r|0;s=t&65532;p=r+p&65532;r=0;while(1){if((r|0)>=(s|0))break;g[x+(r<<2)>>2]=+g[y+(r<<2)>>2]*q;lb=r|1;g[x+(lb<<2)>>2]=+g[y+(lb<<2)>>2]*q;lb=r|2;g[x+(lb<<2)>>2]=+g[y+(lb<<2)>>2]*q;lb=r|3;g[x+(lb<<2)>>2]=+g[y+(lb<<2)>>2]*q;r=r+4|0}while(1){if((p|0)>=(t|0))break;g[x+(p<<2)>>2]=+g[y+(p<<2)>>2]*q;p=p+1|0}lb=c[Ea>>2]|0;kb=c[z>>2]|0;p=c[Fa>>2]|0;r=kb;u=u+1|0;x=x+(lb+kb<<2)|0;y=y+(lb<<2)|0}nf(bb+144|0,0,p*20|0)|0;g[bb+708>>2]=0.0;c[f+4748>>2]=0}p=f+4756|0;if(!(c[p>>2]|0)){v=+nb(+(+g[bb+708>>2]/3.0))/1.0e4;v=v/(+g[Da>>2]*.75+.25)}else v=.009999999776482582;A=f+4732|0;y=c[A>>2]|0;x=(c[Ea>>2]|0)+y|0;z=f+4859|0;a[z>>0]=4;q=+Ae(Ga,Ma,v,x,c[Fa>>2]|0,y);y=f+4724|0;i:do if((c[y>>2]|0?(c[p>>2]|0)==0:0)?(c[Fa>>2]|0)==4:0){u=x<<1;q=q-+Ae(Ia,Ma+(u<<2)|0,v,x,2,c[A>>2]|0);Sd(Na,Ia,c[A>>2]|0);t=3;w=3402823466385288598117041.0e14;while(1){if((t|0)<=-1)break i;s=c[A>>2]|0;p=t<<16>>16;r=0;while(1){if((r|0)>=(s|0))break;lb=e[f+4592+(r<<1)>>1]|0;b[Ka+(r<<1)>>1]=lb+((_((e[Na+(r<<1)>>1]|0)-lb<<16>>16,p)|0)>>>2);r=r+1|0}ue(La,Ka,s);p=0;while(1){if((p|0)>=(s|0))break;g[Ia+(p<<2)>>2]=+(b[La+(p<<1)>>1]|0)*.000244140625;p=p+1|0}Rd(Ha,Ia,Ma,u,c[A>>2]|0);lb=c[A>>2]|0;kb=Ha+(lb<<2)|0;lb=x-lb|0;v=+Ud(kb,lb);v=v+ +Ud(kb+(x<<2)|0,lb);if(!(vw)break i}else{a[z>>0]=t;q=v}t=t+-1|0;w=v}}while(0);if((a[z>>0]|0)==4)Sd(Na,Ga,c[A>>2]|0);t=c[Aa>>2]<<16>>16;t=(_(t,-5)|0)+(t*59246>>16)+3146|0;t=t+((c[Fa>>2]|0)==2?t>>1:0)|0;we(Ka,Na,c[A>>2]|0);j:do if((c[y>>2]|0)==1?(Ja=a[z>>0]|0,Ja<<24>>24<4):0){p=Ja<<24>>24;r=c[A>>2]|0;s=0;while(1){if((s|0)>=(r|0))break;lb=e[f+4592+(s<<1)>>1]|0;b[La+(s<<1)>>1]=lb+((_((e[Na+(s<<1)>>1]|0)-lb<<16>>16,p)|0)>>>2);s=s+1|0}we(Qa,La,r);r=a[z>>0]|0;r=(_(r,r)|0)<<27;p=c[A>>2]|0;r=r>>16;s=0;while(1){if((s|0)>=(p|0)){r=1;break j}lb=Ka+(s<<1)|0;b[lb>>1]=((b[lb>>1]|0)>>>1)+((_(b[Qa+(s<<1)>>1]|0,r)|0)>>>16);s=s+1|0}}else r=0;while(0);De(f+4836|0,Na,c[f+4784>>2]|0,Ka,t,c[f+4752>>2]|0,a[Ra>>0]|0);p=Pa+32|0;ue(p,Na,c[A>>2]|0);if(r){p=a[z>>0]|0;r=c[A>>2]|0;s=0;while(1){if((s|0)>=(r|0))break;lb=e[f+4592+(s<<1)>>1]|0;b[La+(s<<1)>>1]=lb+((_((e[Na+(s<<1)>>1]|0)-lb<<16>>16,p)|0)>>>2);s=s+1|0}ue(Pa,La,r)}else rf(Pa|0,p|0,c[A>>2]<<1|0)|0;s=0;while(1){if((s|0)==2)break;p=c[A>>2]|0;r=0;while(1){if((r|0)>=(p|0))break;g[bb+16+(s<<6)+(r<<2)>>2]=+(b[Pa+(s<<5)+(r<<1)>>1]|0)*.000244140625;r=r+1|0}s=s+1|0}u=c[Ea>>2]|0;lb=c[Fa>>2]|0;p=c[A>>2]|0;r=Qa+(p<<2)|0;t=p+u|0;s=t<<1;Rd(Qa,bb+16|0,Ma,s,p);jb=+g[bb>>2];g[bb+712>>2]=jb*jb*+Ud(r,u);jb=+g[bb+4>>2];t=r+(t<<2)|0;g[bb+716>>2]=jb*jb*+Ud(t,u);if((lb|0)==4){Rd(Qa,bb+80|0,Ma+(s<<2)|0,s,p);jb=+g[bb+8>>2];g[bb+720>>2]=jb*jb*+Ud(r,u);jb=+g[bb+12>>2];g[bb+724>>2]=jb*jb*+Ud(t,u)}x=f+4592|0;p=Na;u=x+32|0;do{b[x>>1]=b[p>>1]|0;x=x+2|0;p=p+2|0}while((x|0)<(u|0));k:do if((a[Ra>>0]|0)==2){q=1.0-1.0/(+X(+-((+g[bb+708>>2]+-12.0)*.25))+1.0)*.5;p=c[Fa>>2]|0;r=0;while(1){if((r|0)>=(p|0)){r=p;break k}lb=bb+(r<<2)|0;g[lb>>2]=+g[lb>>2]*q;r=r+1|0}}else r=c[Fa>>2]|0;while(0);q=+nb(+((21.0-+(c[Ba>>2]|0)*.0078125)*.33000001311302185));q=q/+(c[Ea>>2]|0);p=0;while(1){if((p|0)>=(r|0)){p=0;break}lb=bb+(p<<2)|0;jb=+g[lb>>2];jb=+O(+(jb*jb+ +g[bb+712+(p<<2)>>2]*q));g[lb>>2]=jb<32767.0?jb:32767.0;p=p+1|0}while(1){if((p|0)>=(r|0))break;c[Pa+(p<<2)>>2]=~~(+g[bb+(p<<2)>>2]*65536.0);p=p+1|0}rf(bb+728|0,Pa|0,r<<2|0)|0;p=f+7260|0;la=bb+744|0;a[la>>0]=a[p>>0]|0;ma=f+4828|0;na=(m|0)==2;oa=na&1;ge(ma,Pa,p,oa,r);p=c[Fa>>2]|0;r=0;while(1){if((r|0)>=(p|0))break;g[bb+(r<<2)>>2]=+(c[Pa+(r<<2)>>2]|0)*.0000152587890625;r=r+1|0}s=a[Ra>>0]|0;do if(s<<24>>24==2){r=f+4858|0;if(+g[bb+708>>2]+ +(c[f+4804>>2]|0)*.000030517578125>1.0){a[r>>0]=0;ka=r;r=0;break}else{a[r>>0]=1;ka=r;r=1;break}}else{r=f+4858|0;ka=r;r=a[r>>0]|0}while(0);lb=c[Aa>>2]|0;ja=bb+692|0;g[ja>>2]=+(c[f+4720>>2]|0)*-.05000000074505806+1.2000000476837158+ +(lb|0)*-.20000000298023224*.00390625+ +g[Ca>>2]*-.10000000149011612+ +g[Da>>2]*-.20000000298023224+ +(b[25404+(s<<24>>24>>1<<2)+(r<<24>>24<<1)>>1]|0)*.0009765625*.800000011920929;ia=f+5840|0;r=c[ia>>2]|0;t=f+6192+(r*36|0)|0;if((c[f+6184>>2]|0)!=0&(lb|0)>77){c[f+4816+(r<<2)>>2]=1;rf(Qa|0,f+144|0,4448)|0;x=t;p=ma;u=x+36|0;do{b[x>>1]=b[p>>1]|0;x=x+2|0;p=p+2|0}while((x|0)<(u|0));s=c[Fa>>2]|0;rf(Oa|0,bb|0,s<<2|0)|0;p=c[ia>>2]|0;do if(!p)hb=544;else{if(!(c[f+4816+(p+-1<<2)>>2]|0)){hb=544;break}r=f+4632|0;p=s}while(0);if((hb|0)==544){r=f+4632|0;a[r>>0]=a[f+7260>>0]|0;p=(d[t>>0]|0)+(c[f+6188>>2]|0)|0;a[t>>0]=(p&255)<<24>>24<63?p&255:63;p=c[Fa>>2]|0}he(Pa,t,r,oa,p);p=c[Fa>>2]|0;r=0;while(1){if((r|0)>=(p|0))break;g[bb+(r<<2)>>2]=+(c[Pa+(r<<2)>>2]|0)*.0000152587890625;r=r+1|0}Td(f,bb,t,Qa,f+6300+((c[ia>>2]|0)*320|0)|0,Xa);p=c[Fa>>2]|0;rf(bb|0,Oa|0,p<<2|0)|0}s=0;r=0;while(1){if((r|0)>=(p|0))break;s=(a[f+4828+r>>0]|0)+(s<<8)|0;r=r+1|0}x=eb;p=l;u=x+48|0;do{c[x>>2]=c[p>>2];x=x+4|0;p=p+4|0}while((x|0)<(u|0));U=f+144|0;rf(cb|0,U|0,4448)|0;V=a[Va>>0]|0;W=f+5864|0;Y=b[W>>1]|0;Z=f+5860|0;$=c[Z>>2]|0;ba=f+7260|0;ca=n+-5|0;da=l+24|0;ea=l+28|0;fa=f+4828|0;ga=f+4864|0;ha=l+20|0;J=0;A=0;B=0;S=256;R=0;D=0;P=-1;z=-1;T=0;Q=0;E=0;r=0;while(1){y=(s|0)==(P|0);do if(!y){if((s|0)==(z|0)){p=E;hb=571;break}if((T|0)>0){x=l;p=eb;u=x+48|0;do{c[x>>2]=c[p>>2];x=x+4|0;p=p+4|0}while((x|0)<(u|0));rf(U|0,cb|0,4448)|0;a[Va>>0]=V;b[W>>1]=Y;c[Z>>2]=$}Td(f,bb,fa,U,ga,Xa);t=(T|0)==6;if(t&(A|0)==0){c[fb>>2]=c[l>>2];c[fb+4>>2]=c[l+4>>2];c[fb+8>>2]=c[l+8>>2];c[fb+12>>2]=c[l+12>>2];c[fb+16>>2]=c[l+16>>2];c[fb+20>>2]=c[l+20>>2];u=c[da>>2]|0;c[gb>>2]=c[ea>>2];c[gb+4>>2]=c[ea+4>>2];c[gb+8>>2]=c[ea+8>>2];c[gb+12>>2]=c[ea+12>>2];c[gb+16>>2]=c[ea+16>>2]}else u=r;Ad(f,l,c[ia>>2]|0,0,m);Bd(l,a[Ra>>0]|0,a[ka>>0]|0,ga,c[Ua>>2]|0);p=(c[ha>>2]|0)+((aa(c[ea>>2]|0)|0)+-32)|0;if(t&(A|0)==0&(p|0)>(n|0)){c[l>>2]=c[fb>>2];c[l+4>>2]=c[fb+4>>2];c[l+8>>2]=c[fb+8>>2];c[l+12>>2]=c[fb+12>>2];c[l+16>>2]=c[fb+16>>2];c[l+20>>2]=c[fb+20>>2];c[da>>2]=u;c[ea>>2]=c[gb>>2];c[ea+4>>2]=c[gb+4>>2];c[ea+8>>2]=c[gb+8>>2];c[ea+12>>2]=c[gb+12>>2];c[ea+16>>2]=c[gb+16>>2];p=a[la>>0]|0;a[ba>>0]=p;r=0;while(1){if((r|0)>=(c[Fa>>2]|0))break;a[f+4828+r>>0]=4;r=r+1|0}if(!na)a[ma>>0]=p;b[W>>1]=Y;c[Z>>2]=$;p=0;while(1){if((p|0)>=(c[Ua>>2]|0))break;a[f+4864+p>>0]=0;p=p+1|0}Ad(f,l,c[ia>>2]|0,0,m);Bd(l,a[Ra>>0]|0,a[ka>>0]|0,ga,c[Ua>>2]|0);p=(c[ha>>2]|0)+((aa(c[ea>>2]|0)|0)+-32)|0}if(T|o|0){r=u;hb=571;break}if((p|0)>(n|0))F=u;else break b}else{p=Q;hb=571}while(0);if((hb|0)==571){hb=0;if((T|0)==6)break;else F=r}G=(p|0)>(n|0);l:do if(G){if(A|0){B=1;y=R;D=S<<16>>16;x=P;z=s;u=Q;E=p;break}if((T|0)>1){jb=+g[ja>>2]*1.5;g[ja>>2]=jb>1.5?jb:1.5;a[ka>>0]=0;B=0;s=-1}else{B=1;D=S<<16>>16;E=p}u=c[Fa>>2]|0;x=(T|0)==0;z=0;m:while(1){if((z|0)>=(u|0)){A=0;y=R;x=P;z=s;u=Q;break l}t=c[Ea>>2]|0;y=z+1|0;r=_(y,t)|0;t=_(z,t)|0;A=0;while(1){if((t|0)>=(r|0))break;kb=a[f+4864+t>>0]|0;lb=kb<<24>>24;t=t+1|0;A=A+(kb<<24>>24>-1?lb:0-lb|0)|0}r=Za+(z<<2)|0;do if(!x){t=$a+(z<<2)|0;if((A|0)<(c[r>>2]|0)?(c[t>>2]|0)==0:0)break;c[t>>2]=1;z=y;continue m}while(0);c[r>>2]=A;b[Ya+(z<<1)>>1]=S;z=y}}else{if((p|0)>=(ca|0))break b;r=S<<16>>16;if(y){A=1;y=r;x=s;u=p;break};c[fb>>2]=c[l>>2];c[fb+4>>2]=c[l+4>>2];c[fb+8>>2]=c[l+8>>2];c[fb+12>>2]=c[l+12>>2];c[fb+16>>2]=c[l+16>>2];c[fb+20>>2]=c[l+20>>2];F=c[da>>2]|0;c[gb>>2]=c[ea>>2];c[gb+4>>2]=c[ea+4>>2];c[gb+8>>2]=c[ea+8>>2];c[gb+12>>2]=c[ea+12>>2];c[gb+16>>2]=c[ea+16>>2];rf(_a|0,c[l>>2]|0,F|0)|0;rf(db|0,U|0,4448)|0;J=a[ba>>0]|0;A=1;y=r;x=s;u=p}while(0);do if(!(A&B)){if(G){if(S<<16>>16>=16384){t=32767;break}t=S<<16>>16<<1&65535;break}r=(p-n<<7|0)/(c[Ua>>2]|0)|0;p=r+2048|0;do if((r|0)<-2048)p=0;else{if((p|0)>3966){p=2147483647;break}s=p>>7;t=1<>16)<>7;else p=_(t>>7,p+((_(_(p,128-p|0)|0,-174)|0)>>16)|0)|0;p=t+p|0}while(0);t=S<<16>>16;t=(_(p>>16,t)|0)+((_(p&65535,t)|0)>>>16)&65535}else{t=D-y|0;r=y+((_(t,n-u|0)|0)/(E-u|0)|0)|0;s=r<<16>>16;t=t>>2;p=y+t|0;if((s|0)<=(p|0)){p=D-t|0;p=(s|0)<(p|0)?p:r}t=p&65535}while(0);p=c[Fa>>2]|0;r=0;while(1){if((r|0)>=(p|0))break;if(!(c[$a+(r<<2)>>2]|0))s=t;else s=b[Ya+(r<<1)>>1]|0;kb=c[bb+728+(r<<2)>>2]|0;lb=s<<16>>16;lb=(_(kb>>16,lb)|0)+((_(kb&65535,lb)|0)>>16)|0;c[ab+(r<<2)>>2]=(lb|0)>8388607?2147483392:((lb|0)<-8388608?-8388608:lb)<<8;r=r+1|0}a[ba>>0]=a[la>>0]|0;ge(ma,ab,ba,oa,p);r=c[Fa>>2]|0;s=0;p=0;while(1){if((p|0)>=(r|0)){p=0;break}s=(a[f+4828+p>>0]|0)+(s<<8)|0;p=p+1|0}while(1){if((p|0)>=(r|0))break;g[bb+(p<<2)>>2]=+(c[ab+(p<<2)>>2]|0)*.0000152587890625;p=p+1|0}S=t;R=y;P=x;T=T+1|0;Q=u;r=F}if((A|0)!=0&(y|(p|0)>(n|0))){c[l>>2]=c[fb>>2];c[l+4>>2]=c[fb+4>>2];c[l+8>>2]=c[fb+8>>2];c[l+12>>2]=c[fb+12>>2];c[l+16>>2]=c[fb+16>>2];c[l+20>>2]=c[fb+20>>2];c[da>>2]=r;c[ea>>2]=c[gb>>2];c[ea+4>>2]=c[gb+4>>2];c[ea+8>>2]=c[gb+8>>2];c[ea+12>>2]=c[gb+12>>2];c[ea+16>>2]=c[gb+16>>2];rf(c[l>>2]|0,_a|0,r|0)|0;rf(U|0,db|0,4448)|0;a[ba>>0]=J}}while(0);sf(f+7272|0,f+7272+(c[Ua>>2]<<2)|0,(c[Wa>>2]|0)+((c[Ta>>2]|0)*5|0)<<2|0)|0;if(c[Sa>>2]|0){lb=0;c[j>>2]=lb;i=ib;return 0}c[f+4636>>2]=c[bb+228+((c[f+4672>>2]|0)+-1<<2)>>2];a[f+4633>>0]=a[f+4857>>0]|0;c[f+4756>>2]=0;lb=(c[l+20>>2]|0)+((aa(c[l+28>>2]|0)|0)+-32)+7>>3;c[j>>2]=lb;i=ib;return 0}function Rd(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;var f=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0;switch(e|0){case 6:{f=b+4|0;h=b+8|0;i=b+12|0;j=b+16|0;k=b+20|0;l=6;while(1){if((l|0)>=(d|0))break;v=c+(l+-1<<2)|0;g[a+(l<<2)>>2]=+g[v+4>>2]-(+g[v>>2]*+g[b>>2]+ +g[v+-4>>2]*+g[f>>2]+ +g[v+-8>>2]*+g[h>>2]+ +g[v+-12>>2]*+g[i>>2]+ +g[v+-16>>2]*+g[j>>2]+ +g[v+-20>>2]*+g[k>>2]);l=l+1|0}c=e<<2;nf(a|0,0,c|0)|0;return}case 8:{f=b+4|0;h=b+8|0;i=b+12|0;j=b+16|0;k=b+20|0;l=b+24|0;m=b+28|0;n=8;while(1){if((n|0)>=(d|0))break;v=c+(n+-1<<2)|0;g[a+(n<<2)>>2]=+g[v+4>>2]-(+g[v>>2]*+g[b>>2]+ +g[v+-4>>2]*+g[f>>2]+ +g[v+-8>>2]*+g[h>>2]+ +g[v+-12>>2]*+g[i>>2]+ +g[v+-16>>2]*+g[j>>2]+ +g[v+-20>>2]*+g[k>>2]+ +g[v+-24>>2]*+g[l>>2]+ +g[v+-28>>2]*+g[m>>2]);n=n+1|0}c=e<<2;nf(a|0,0,c|0)|0;return}case 10:{f=b+4|0;h=b+8|0;i=b+12|0;j=b+16|0;k=b+20|0;l=b+24|0;m=b+28|0;n=b+32|0;o=b+36|0;p=10;while(1){if((p|0)>=(d|0))break;v=c+(p+-1<<2)|0;g[a+(p<<2)>>2]=+g[v+4>>2]-(+g[v>>2]*+g[b>>2]+ +g[v+-4>>2]*+g[f>>2]+ +g[v+-8>>2]*+g[h>>2]+ +g[v+-12>>2]*+g[i>>2]+ +g[v+-16>>2]*+g[j>>2]+ +g[v+-20>>2]*+g[k>>2]+ +g[v+-24>>2]*+g[l>>2]+ +g[v+-28>>2]*+g[m>>2]+ +g[v+-32>>2]*+g[n>>2]+ +g[v+-36>>2]*+g[o>>2]);p=p+1|0}c=e<<2;nf(a|0,0,c|0)|0;return}case 12:{f=b+4|0;h=b+8|0;i=b+12|0;j=b+16|0;k=b+20|0;l=b+24|0;m=b+28|0;n=b+32|0;o=b+36|0;p=b+40|0;q=b+44|0;r=12;while(1){if((r|0)>=(d|0))break;v=c+(r+-1<<2)|0;g[a+(r<<2)>>2]=+g[v+4>>2]-(+g[v>>2]*+g[b>>2]+ +g[v+-4>>2]*+g[f>>2]+ +g[v+-8>>2]*+g[h>>2]+ +g[v+-12>>2]*+g[i>>2]+ +g[v+-16>>2]*+g[j>>2]+ +g[v+-20>>2]*+g[k>>2]+ +g[v+-24>>2]*+g[l>>2]+ +g[v+-28>>2]*+g[m>>2]+ +g[v+-32>>2]*+g[n>>2]+ +g[v+-36>>2]*+g[o>>2]+ +g[v+-40>>2]*+g[p>>2]+ +g[v+-44>>2]*+g[q>>2]);r=r+1|0}c=e<<2;nf(a|0,0,c|0)|0;return}case 16:{f=b+4|0;h=b+8|0;n=b+12|0;o=b+16|0;p=b+20|0;q=b+24|0;r=b+28|0;s=b+32|0;t=b+36|0;u=b+40|0;i=b+44|0;j=b+48|0;k=b+52|0;l=b+56|0;m=b+60|0;v=16;while(1){if((v|0)>=(d|0))break;w=c+(v+-1<<2)|0;g[a+(v<<2)>>2]=+g[w+4>>2]-(+g[w>>2]*+g[b>>2]+ +g[w+-4>>2]*+g[f>>2]+ +g[w+-8>>2]*+g[h>>2]+ +g[w+-12>>2]*+g[n>>2]+ +g[w+-16>>2]*+g[o>>2]+ +g[w+-20>>2]*+g[p>>2]+ +g[w+-24>>2]*+g[q>>2]+ +g[w+-28>>2]*+g[r>>2]+ +g[w+-32>>2]*+g[s>>2]+ +g[w+-36>>2]*+g[t>>2]+ +g[w+-40>>2]*+g[u>>2]+ +g[w+-44>>2]*+g[i>>2]+ +g[w+-48>>2]*+g[j>>2]+ +g[w+-52>>2]*+g[k>>2]+ +g[w+-56>>2]*+g[l>>2]+ +g[w+-60>>2]*+g[m>>2]);v=v+1|0}w=e<<2;nf(a|0,0,w|0)|0;return}default:{w=e<<2;nf(a|0,0,w|0)|0;return}}}function Sd(a,d,f){a=a|0;d=d|0;f=f|0;var h=0,j=0,l=0.0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0;T=i;i=i+176|0;O=T+124|0;Q=T+72|0;P=T+64|0;R=T;j=0;while(1){if((j|0)>=(f|0))break;l=+g[d+(j<<2)>>2]*65536.0;h=(g[k>>2]=l,c[k>>2]|0);if((h&2130706432)>>>0<=1249902592){h=(h|0)<0;l=h?l+-8388608.0+8388608.0:l+8388608.0+-8388608.0;if(l==0.0)l=h?-0.0:0.0}c[R+(j<<2)>>2]=~~l;j=j+1|0}c[P>>2]=O;c[P+4>>2]=Q;L=f>>1;M=O+(L<<2)|0;c[M>>2]=65536;N=Q+(L<<2)|0;c[N>>2]=65536;h=0;while(1){if((L|0)<=(h|0))break;K=c[R+(L-h+-1<<2)>>2]|0;J=c[R+(h+L<<2)>>2]|0;c[O+(h<<2)>>2]=0-K-J;c[Q+(h<<2)>>2]=J-K;h=h+1|0}h=L;while(1){if((h|0)<=0){h=2;break}K=h+-1|0;J=O+(K<<2)|0;c[J>>2]=(c[J>>2]|0)-(c[O+(h<<2)>>2]|0);J=Q+(K<<2)|0;c[J>>2]=(c[J>>2]|0)+(c[Q+(h<<2)>>2]|0);h=K}while(1){if((h|0)>(L|0)){h=2;break}else j=L;while(1){if((j|0)<=(h|0))break;K=O+(j+-2<<2)|0;c[K>>2]=(c[K>>2]|0)-(c[O+(j<<2)>>2]|0);j=j+-1|0}K=O+(h+-2<<2)|0;c[K>>2]=(c[K>>2]|0)-(c[O+(h<<2)>>2]<<1);h=h+1|0}while(1){if((h|0)>(L|0))break;else j=L;while(1){if((j|0)<=(h|0))break;K=Q+(j+-2<<2)|0;c[K>>2]=(c[K>>2]|0)-(c[Q+(j<<2)>>2]|0);j=j+-1|0}K=Q+(h+-2<<2)|0;c[K>>2]=(c[K>>2]|0)-(c[Q+(h<<2)>>2]<<1);h=h+1|0}h=c[M>>2]|0;K=(L|0)==8;a:do if(K)h=(c[O>>2]|0)+((c[O+4>>2]|0)+((c[O+8>>2]|0)+((c[O+12>>2]|0)+((c[O+16>>2]|0)+((c[O+20>>2]|0)+((c[O+24>>2]|0)+((c[O+28>>2]|0)+(h<<1)<<1)<<1)<<1)<<1)<<1)<<1)<<1)|0;else{d=L;while(1){j=d+-1|0;if((d|0)<=0)break a;d=j;h=(c[O+(j<<2)>>2]|0)+(h<<1)|0}}while(0);b:do if((h|0)<0){b[a>>1]=0;h=c[N>>2]|0;if(K){j=Q;d=1;h=(c[Q>>2]|0)+((c[Q+4>>2]|0)+((c[Q+8>>2]|0)+((c[Q+12>>2]|0)+((c[Q+16>>2]|0)+((c[Q+20>>2]|0)+((c[Q+24>>2]|0)+((c[Q+28>>2]|0)+(h<<1)<<1)<<1)<<1)<<1)<<1)<<1)<<1)|0;break}else d=L;while(1){j=d+-1|0;if((d|0)<=0){j=Q;d=1;break b}d=j;h=(c[Q+(j<<2)>>2]|0)+(h<<1)|0}}else{j=O;d=0}while(0);w=O+28|0;x=O+24|0;y=O+20|0;z=O+16|0;A=O+12|0;B=O+8|0;C=O+4|0;D=Q+28|0;E=Q+24|0;F=Q+20|0;G=Q+16|0;H=Q+12|0;I=Q+8|0;J=Q+4|0;v=0;c:while(1){o=1;m=0;n=8192;d:while(1){u=o;while(1){o=b[27508+(u<<1)>>1]|0;p=pe(j,o,L)|0;if((h|0)<1){if((p|0)>=(m|0))break;if(!((h|0)<0|(p|0)>(0-m|0)))break}else if((p|0)<=(0-m|0))break;if((u|0)>127)break d;else{u=u+1|0;m=0;n=o;h=p}}m=(p|0)==0&1;s=-256;t=0;while(1){if((t|0)==3)break;q=n+o|0;q=(q>>1)+(q&1)|0;r=pe(j,q,L)|0;if((h|0)<1)if((r&h|0)>-1){o=q;p=r}else S=42;else if((r|0)<1){o=q;p=r}else S=42;if((S|0)==42){S=0;s=s+(128>>>t)|0;n=q;h=r}t=t+1|0}j=h-p|0;if((((h|0)>0?h:0-h|0)|0)<65536)if((h|0)==(p|0))h=s;else h=s+(((h<<5)+(j>>1)|0)/(j|0)|0)|0;else h=s+((h|0)/(j>>5|0)|0)|0;h=(u<<8)+h|0;b[a+(d<<1)>>1]=(h|0)<32767?h:32767;h=d+1|0;if((h|0)>=(f|0)){S=77;break c}o=u;j=c[P+((h&1)<<2)>>2]|0;d=h;n=b[27508+(u+-1<<1)>>1]|0;h=1-(h&2)<<12}m=v+1|0;if((v|0)>15)break;re(R,f,65536-(1<>2]=65536;c[N>>2]=65536;h=0;while(1){if((L|0)<=(h|0)){h=L;break}v=c[R+(L-h+-1<<2)>>2]|0;u=c[R+(h+L<<2)>>2]|0;c[O+(h<<2)>>2]=0-v-u;c[Q+(h<<2)>>2]=u-v;h=h+1|0}while(1){if((h|0)<=0){h=2;break}v=h+-1|0;u=O+(v<<2)|0;c[u>>2]=(c[u>>2]|0)-(c[O+(h<<2)>>2]|0);u=Q+(v<<2)|0;c[u>>2]=(c[u>>2]|0)+(c[Q+(h<<2)>>2]|0);h=v}while(1){if((h|0)>(L|0)){h=2;break}else j=L;while(1){if((j|0)<=(h|0))break;v=O+(j+-2<<2)|0;c[v>>2]=(c[v>>2]|0)-(c[O+(j<<2)>>2]|0);j=j+-1|0}v=O+(h+-2<<2)|0;c[v>>2]=(c[v>>2]|0)-(c[O+(h<<2)>>2]<<1);h=h+1|0}while(1){if((h|0)>(L|0))break;else j=L;while(1){if((j|0)<=(h|0))break;v=Q+(j+-2<<2)|0;c[v>>2]=(c[v>>2]|0)-(c[Q+(j<<2)>>2]|0);j=j+-1|0}v=Q+(h+-2<<2)|0;c[v>>2]=(c[v>>2]|0)-(c[Q+(h<<2)>>2]<<1);h=h+1|0}h=c[M>>2]|0;e:do if(K)h=(c[O>>2]|0)+((c[C>>2]|0)+((c[B>>2]|0)+((c[A>>2]|0)+((c[z>>2]|0)+((c[y>>2]|0)+((c[x>>2]|0)+((c[w>>2]|0)+(h<<1)<<1)<<1)<<1)<<1)<<1)<<1)<<1)|0;else{d=L;while(1){j=d+-1|0;if((d|0)<=0)break e;d=j;h=(c[O+(j<<2)>>2]|0)+(h<<1)|0}}while(0);if((h|0)>=0){v=m;j=O;d=0;continue}b[a>>1]=0;h=c[N>>2]|0;if(K){v=m;j=Q;d=1;h=(c[Q>>2]|0)+((c[J>>2]|0)+((c[I>>2]|0)+((c[H>>2]|0)+((c[G>>2]|0)+((c[F>>2]|0)+((c[E>>2]|0)+((c[D>>2]|0)+(h<<1)<<1)<<1)<<1)<<1)<<1)<<1)<<1)|0;continue}else d=L;while(1){j=d+-1|0;if((d|0)<=0){v=m;j=Q;d=1;continue c}d=j;h=(c[Q+(j<<2)>>2]|0)+(h<<1)|0}}if((S|0)==77){i=T;return}h=32768/(f+1|0)|0;b[a>>1]=h;j=1;while(1){if((j|0)>=(f|0))break;S=(h&65535)+(e[a>>1]|0)|0;b[a+(j<<1)>>1]=S;h=S;j=j+1|0}i=T;return}function Td(d,e,f,h,j,l){d=d|0;e=e|0;f=f|0;h=h|0;j=j|0;l=l|0;var m=0.0,n=0,o=0.0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0;E=i;i=i+1008|0;D=E+360|0;x=E+48|0;B=E+296|0;A=E+256|0;w=E+64|0;z=E+32|0;C=E+16|0;y=E;v=c[d+4672>>2]|0;p=d+4728|0;t=0;while(1){if((t|0)>=(v|0)){q=0;break}q=c[p>>2]|0;r=t*24|0;u=0;while(1){if((u|0)>=(q|0))break;s=r+u|0;m=+g[e+244+(s<<2)>>2]*8192.0;n=(g[k>>2]=m,c[k>>2]|0);if((n&2130706432)>>>0<=1249902592){n=(n|0)<0;m=n?m+-8388608.0+8388608.0:m+8388608.0+-8388608.0;if(m==0.0)m=n?-0.0:0.0}b[w+(s<<1)>>1]=~~m;u=u+1|0}t=t+1|0}while(1){if((q|0)>=(v|0))break;m=+g[e+644+(q<<2)>>2]*16384.0;n=(g[k>>2]=m,c[k>>2]|0);if((n&2130706432)>>>0<=1249902592){n=(n|0)<0;m=n?m+-8388608.0+8388608.0:m+8388608.0+-8388608.0;if(m==0.0)m=n?-0.0:0.0}p=~~m<<16;m=+g[e+628+(q<<2)>>2]*16384.0;n=(g[k>>2]=m,c[k>>2]|0);if((n&2130706432)>>>0<=1249902592){n=(n|0)<0;m=n?m+-8388608.0+8388608.0:m+8388608.0+-8388608.0;if(m==0.0)m=n?-0.0:0.0}c[z+(q<<2)>>2]=p|~~m&65535;m=+g[e+660+(q<<2)>>2]*16384.0;n=(g[k>>2]=m,c[k>>2]|0);if((n&2130706432)>>>0<=1249902592){n=(n|0)<0;m=n?m+-8388608.0+8388608.0:m+8388608.0+-8388608.0;if(m==0.0)m=n?-0.0:0.0}c[C+(q<<2)>>2]=~~m;m=+g[e+676+(q<<2)>>2]*16384.0;n=(g[k>>2]=m,c[k>>2]|0);if((n&2130706432)>>>0<=1249902592){n=(n|0)<0;m=n?m+-8388608.0+8388608.0:m+8388608.0+-8388608.0;if(m==0.0)m=n?-0.0:0.0}c[y+(q<<2)>>2]=~~m;q=q+1|0}m=+g[e+692>>2]*1024.0;n=(g[k>>2]=m,c[k>>2]|0);if((n&2130706432)>>>0<=1249902592){n=(n|0)<0;m=n?m+-8388608.0+8388608.0:m+8388608.0+-8388608.0;if(m==0.0)m=n?-0.0:0.0}p=v*5|0;q=0;while(1){if((q|0)>=(p|0))break;o=+g[e+144+(q<<2)>>2]*16384.0;n=(g[k>>2]=o,c[k>>2]|0);if((n&2130706432)>>>0<=1249902592){n=(n|0)<0;o=n?o+-8388608.0+8388608.0:o+8388608.0+-8388608.0;if(o==0.0)o=n?-0.0:0.0}b[A+(q<<1)>>1]=~~o;q=q+1|0}t=~~m;p=d+4732|0;s=0;while(1){if((s|0)==2){p=0;break}q=c[p>>2]|0;r=0;while(1){if((r|0)>=(q|0))break;m=+g[e+16+(s<<6)+(r<<2)>>2]*4096.0;n=(g[k>>2]=m,c[k>>2]|0);if((n&2130706432)>>>0<=1249902592){n=(n|0)<0;m=n?m+-8388608.0+8388608.0:m+8388608.0+-8388608.0;if(m==0.0)m=n?-0.0:0.0}b[B+(s<<5)+(r<<1)>>1]=~~m;r=r+1|0}s=s+1|0}while(1){if((p|0)>=(v|0))break;m=+g[e+(p<<2)>>2]*65536.0;n=(g[k>>2]=m,c[k>>2]|0);if((n&2130706432)>>>0<=1249902592){n=(n|0)<0;m=n?m+-8388608.0+8388608.0:m+8388608.0+-8388608.0;if(m==0.0)m=n?-0.0:0.0}c[x+(p<<2)>>2]=~~m;p=p+1|0}if((a[f+29>>0]|0)==2)q=b[25412+(a[f+33>>0]<<1)>>1]|0;else q=0;p=c[d+4676>>2]|0;r=0;while(1){if((r|0)>=(p|0))break;m=+g[l+(r<<2)>>2];n=(g[k>>2]=m,c[k>>2]|0);if((n&2130706432)>>>0<=1249902592){n=(n|0)<0;m=n?m+-8388608.0+8388608.0:m+8388608.0+-8388608.0;if(m==0.0)m=n?-0.0:0.0}b[D+(r<<1)>>1]=~~m;r=r+1|0}if((c[d+4720>>2]|0)<=1?(c[d+4764>>2]|0)<=0:0){je(d,h,f,D,j,B,A,w,y,C,z,x,e+228|0,t,q);i=E;return}ke(d,h,f,D,j,B,A,w,y,C,z,x,e+228|0,t,q);i=E;return}function Ud(a,b){a=a|0;b=b|0;var c=0.0,d=0,e=0,f=0,h=0.0,i=0.0,j=0.0,k=0.0;e=b+-3|0;d=((e|0)>0?e:0)+3&-4;f=0;c=0.0;while(1){if((f|0)>=(e|0))break;k=+g[a+(f<<2)>>2];j=+g[a+((f|1)<<2)>>2];i=+g[a+((f|2)<<2)>>2];h=+g[a+((f|3)<<2)>>2];f=f+4|0;c=c+(k*k+j*j+i*i+h*h)}while(1){if((d|0)>=(b|0))break;k=+g[a+(d<<2)>>2];d=d+1|0;c=c+k*k}return +c}function Vd(a,b,c){a=a|0;b=b|0;c=c|0;var d=0.0,e=0,f=0,h=0,i=0.0,j=0,k=0,l=0;f=c+-3|0;e=((f|0)>0?f:0)+3&-4;h=0;d=0.0;while(1){if((h|0)>=(f|0))break;l=h|1;k=h|2;j=h|3;i=d+(+g[a+(h<<2)>>2]*+g[b+(h<<2)>>2]+ +g[a+(l<<2)>>2]*+g[b+(l<<2)>>2]+ +g[a+(k<<2)>>2]*+g[b+(k<<2)>>2]+ +g[a+(j<<2)>>2]*+g[b+(j<<2)>>2]);h=h+4|0;d=i}while(1){if((e|0)>=(c|0))break;i=d+ +g[a+(e<<2)>>2]*+g[b+(e<<2)>>2];e=e+1|0;d=i}return +d}function Wd(e,f,g,h,i,j,k,l){e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;j=j|0;k=k|0;l=l|0;var m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0;if((j|0)==0|(f|0)<0){j=-1;return j|0}if(!f){j=-4;return j|0}S=a[e>>0]|0;do if(S<<24>>24>=0){if((S&96)==96){o=(S&8)==0?480:960;break}n=(S&255)>>>3&3;if((n|0)==3)o=2880;else o=(48e3<>>0)/100|0}else o=(48e3<<((S&255)>>>3&3)>>>0)/400|0;while(0);q=e+1|0;x=f+-1|0;a:do switch(S&3|0){case 0:{C=q;D=x;E=0;F=1;p=x;A=0;u=47;break}case 1:{if(!g)if(!(x&1)){I=(x|0)/2|0;b[j>>1]=I;G=q;H=2;J=0;u=61;break a}else{j=-4;return j|0}else{N=q;M=x;O=1;Q=2;P=x;R=0;u=48}break}case 2:{if((f|0)<2){b[j>>1]=-1;j=-4;return j|0}n=a[q>>0]|0;do if((n&255)<252){o=1;n=n&255}else{if((f|0)>=3){o=2;n=(d[e+2>>0]<<2)+(n&255)&65535;break}b[j>>1]=-1;j=-4;return j|0}while(0);b[j>>1]=n;f=x-o|0;n=n<<16>>16;if((f|0)<(n|0)){j=-4;return j|0}else{C=q+o|0;D=f;E=0;F=2;p=f-n|0;A=0;u=47;break a}}default:{if((f|0)<2){j=-4;return j|0}n=e+2|0;t=a[q>>0]|0;B=t&63;if((B|0)==0|(_(o,B)|0)>>>0>5760){j=-4;return j|0}o=f+-2|0;if(t&64){q=0;while(1){if((o|0)<1){y=-4;u=74;break}s=n+1|0;r=a[n>>0]|0;if(r<<24>>24!=-1)break;n=s;o=o+-255|0;q=q+254|0}if((u|0)==74)return y|0;f=r&255;n=o+-1-f|0;if((n|0)<0){j=-4;return j|0}else{r=n;w=q+f|0}}else{s=n;r=o;w=0}u=(t&255)>>>7;v=u&255^1;if(u<<24>>24!=1){if(g|0){N=s;M=r;O=v;Q=B;P=x;R=w;u=48;break a}p=(r|0)/(B|0)|0;if((_(p,B)|0)!=(r|0)){j=-4;return j|0}n=B+-1|0;o=p&65535;f=0;while(1){if((f|0)>=(n|0)){C=s;D=r;E=v;F=B;A=w;u=47;break a}b[j+(f<<1)>>1]=o;f=f+1|0}}u=B+-1|0;t=r;q=0;while(1){if((q|0)>=(u|0)){u=41;break}z=j+(q<<1)|0;if((t|0)<1){u=33;break}n=a[s>>0]|0;if((n&255)<252){n=n&255;b[z>>1]=n;o=1}else{if((t|0)<2){u=37;break}n=(d[s+1>>0]<<2)+(n&255)&65535;b[z>>1]=n;o=2}f=t-o|0;n=n<<16>>16;if((n|0)>(f|0)){y=-4;u=74;break}s=s+o|0;t=f;q=q+1|0;r=r-(o+n)|0}if((u|0)==33){b[z>>1]=-1;j=-4;return j|0}else if((u|0)==37){b[z>>1]=-1;j=-4;return j|0}else if((u|0)==41){if((r|0)<0)y=-4;else{C=s;D=t;E=v;F=B;p=r;A=w;u=47;break a}return y|0}else if((u|0)==74)return y|0}}while(0);if((u|0)==47)if(!g){G=C;H=F;I=p;J=A;u=61}else{N=C;M=D;O=E;Q=F;P=p;R=A;u=48}b:do if((u|0)==48){m=j+(Q<<1)+-2|0;if((M|0)<1){b[m>>1]=-1;j=-4;return j|0}n=a[N>>0]|0;do if((n&255)<252){L=n&255;b[m>>1]=L;f=1;m=L}else{if((M|0)>=2){L=(d[N+1>>0]<<2)+(n&255)&65535;b[m>>1]=L;f=2;m=L;break}b[m>>1]=-1;j=-4;return j|0}while(0);o=M-f|0;p=Q+-1|0;q=j+(p<<1)|0;n=m<<16>>16;if((n|0)>(o|0)){j=-4;return j|0}m=N+f|0;if(!O){if((f+n|0)>(P|0))y=-4;else{K=Q;L=R;break}return y|0}if((_(n,Q)|0)>(o|0)){j=-4;return j|0}else n=0;while(1){if((n|0)>=(p|0)){K=Q;L=R;break b}b[j+(n<<1)>>1]=b[q>>1]|0;n=n+1|0}}else if((u|0)==61)if((I|0)>1275){j=-4;return j|0}else{b[j+(H+-1<<1)>>1]=I;m=G;K=H;L=J;break}while(0);if(k|0)c[k>>2]=m-e;o=(i|0)==0;n=0;while(1){if((n|0)>=(K|0))break;if(!o)c[i+(n<<2)>>2]=m;m=m+(b[j+(n<<1)>>1]|0)|0;n=n+1|0}if(l|0)c[l>>2]=L+(m-e);if(!h){j=K;return j|0}a[h>>0]=S;j=K;return j|0}function Xd(a,c,d,e,f,h,i,j,k,l){a=a|0;c=c|0;d=d|0;e=e|0;f=f|0;h=h|0;i=i|0;j=j|0;k=k|0;l=l|0;var m=0,n=0.0,o=0,p=0,q=0;q=_(c,j)|0;c=_(b[a+(i<<1)>>1]|0,j)|0;if((k|0)!=1){p=(q|0)/(k|0)|0;c=(c|0)<(p|0)?c:p}o=(l|0)==0;p=o?i:0;m=o?h:0;o=o?c:0;k=a+(m<<1)|0;c=b[k>>1]|0;h=_(c<<16>>16,j)|0;i=e;l=0;while(1){if((l|0)>=(_(c<<16>>16,j)|0))break;g[i>>2]=0.0;c=b[k>>1]|0;i=i+4|0;l=l+1|0}c=m;k=d+(h<<2)|0;a:while(1){if((c|0)>=(p|0))break;l=_(b[a+(c<<1)>>1]|0,j)|0;m=c+1|0;d=_(b[a+(m<<1)>>1]|0,j)|0;n=+X(+((+g[f+(c<<2)>>2]+ +g[17220+(c<<2)>>2])*.6931471805599453));h=i;c=l;l=k;while(1){k=l+4|0;i=h+4|0;g[h>>2]=+g[l>>2]*n;c=c+1|0;if((c|0)<(d|0)){h=i;l=k}else{c=m;continue a}}}nf(e+(o<<2)|0,0,q-o<<2|0)|0;return}function Yd(e,f,h,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B){e=e|0;f=f|0;h=h|0;j=j|0;k=k|0;l=l|0;m=m|0;n=n|0;o=o|0;p=p|0;q=q|0;r=r|0;s=s|0;t=t|0;u=u|0;v=v|0;w=w|0;x=x|0;y=y|0;z=z|0;A=A|0;B=B|0;var C=0,D=0,E=0.0,F=0.0,G=0,H=0,I=0.0,J=0,K=0,L=0,M=0,N=0.0,O=0.0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,$=0,ba=0,ca=0,da=0,ea=0,fa=0,ga=0,ha=0,ia=0,ja=0,ka=0,la=0,ma=0,na=0,oa=0,pa=0,qa=0,ra=0,sa=0,ta=0,ua=0,va=0,wa=0,xa=0,ya=0,za=0,Aa=0,Ba=0,Ca=0,Da=0,Ea=0,Fa=0,Ga=0,Ha=0,Ia=0,Ja=0,Ka=0,La=0,Ma=0,Na=0,Oa=0,Pa=0.0;Oa=i;i=i+1520|0;Ia=Oa+192|0;La=Oa+24|0;Ma=Oa;Na=Oa+144|0;Ja=Oa+92|0;Ka=Oa+40|0;Ha=Oa+244|0;Da=c[f+32>>2]|0;Ga=l|0?2:1;D=(e|0)==0;if(D){Ba=0;Ca=1}else{za=(l|0)!=0&(r|0)==0;Ca=(A|0)>7;Ba=za&Ca;Ca=za&Ca}ta=(p|0)==0?1:1<>1]<>2]|0;p=b[Da+(A+-1<<1)>>1]|0;C=p<>1]|0)-p<>2]=n;c[Ia+28>>2]=w;c[Ia>>2]=e;c[Ia+16>>2]=s;c[Ia+8>>2]=f;na=Ia+40|0;c[na>>2]=c[z>>2];c[Ia+20>>2]=q;c[Ia+44>>2]=B;c[Ia+4>>2]=Ca&1;fa=Ia+48|0;c[fa>>2]=0;ga=Ia+12|0;ha=j+-1|0;ia=(l|0)==0;ja=w+20|0;ka=w+28|0;la=Ia+32|0;ma=Ia+24|0;Z=f+12|0;$=(1<1;Y=h;B=0;C=1;while(1){if((Y|0)>=(j|0))break;c[ga>>2]=Y;R=(Y|0)==(ha|0);S=Da+(Y<<1)|0;W=b[S>>1]<>1]<>2]|0;A=32-(aa(T|0)|0)|0;T=T>>>(A+-16|0);X=(T>>>12)+-8|0;X=(c[ja>>2]<<3)-((A<<3)+(X+(T>>>0>(c[5272+(X<<2)>>2]|0)>>>0&1)))|0;T=v-((Y|0)==(h|0)?0:X)|0;A=u-X|0;c[la>>2]=A+-1;if((Y|0)<(y|0)?(Ea=y-Y|0,Ea=(c[o+(Y<<2)>>2]|0)+((T|0)/(((Ea|0)>3?3:Ea)|0)|0)|0,Fa=(A|0)<(Ea|0),!(((Fa?A:Ea)|0)<16384&((Fa?A:Ea)|0)<0)):0)U=((Fa?A:Ea)|0)>16383?16383:Fa?A:Ea;else U=0;if(Ca?((b[S>>1]<=(b[ua>>1]<>2]|0;c[ma>>2]=M;Q=(Y|0)<(c[Z>>2]|0);p=Q?p:0;P=Q?D:xa;Q=Q?e:ia?0:xa;p=R?(Ba?p:0):p;if((B|0)!=0?(q|0)!=3|ea|(M|0)<0:0){f=(b[Da+(B<<1)>>1]<>1]<(A|0));A=A+W|0;e=B+-1|0;while(1){C=e+1|0;if((b[Da+(C<<1)>>1]<>0];C=C|d[m+(M+Ga+-1)>>0];if((D|0)<(e|0))D=D+1|0;else{D=A;G=C;break}}}else{f=-1;D=$;G=$}a:do if(r)if((Y|0)==(s|0)){if(!Ca){Aa=31;break}A=Da+(s<<1)|0;C=0;while(1){if((C|0)>=((b[A>>1]<>2]=(+g[Aa>>2]+ +g[za+(C<<2)>>2])*.5;C=C+1|0}}else{v=(U|0)/2|0;C=(f|0)==-1;A=C?0:xa+(f<<2)|0;if(R){A=Zd(Ia,P,W,v,ta,A,x,0,1.0,p,D)|0;D=C?0:za+(f<<2)|0;C=0}else{A=Zd(Ia,P,W,v,ta,A,x,xa+(b[S>>1]<>1]<>1]<>2]=0;if(R)A=0;else A=xa+(b[S>>1]<>2];O=+g[n+(Y+(c[wa>>2]|0)<<2)>>2];I=(N>2]|0;r=c[ba>>2]|0;c[La>>2]=c[ca>>2];c[La+4>>2]=c[ca+4>>2];c[La+8>>2]=c[ca+8>>2];c[La+12>>2]=c[ca+12>>2];v=c[da>>2]|0;c[Ma>>2]=c[ka>>2];c[Ma+4>>2]=c[ka+4>>2];c[Ma+8>>2]=c[ka+8>>2];c[Ma+12>>2]=c[ka+12>>2];c[Ma+16>>2]=c[ka+16>>2];A=Ja;C=Ia;D=A+52|0;do{c[A>>2]=c[C>>2];A=A+4|0;C=C+4|0}while((A|0)<(D|0));L=W<<2;rf(oa|0,P|0,L|0)|0;rf(pa|0,Q|0,L|0)|0;c[fa>>2]=-1;H=(f|0)==-1;if(R)A=0;else A=xa+(b[S>>1]<=(W|0)){A=0;E=0.0;break}I=F+ +g[oa+(A<<2)>>2]*+g[P+(A<<2)>>2];A=A+1|0;F=I}while(1){if((A|0)>=(W|0))break;I=E+ +g[pa+(A<<2)>>2]*+g[Q+(A<<2)>>2];A=A+1|0;E=I}I=N*F+O*E;A=Na;C=w;D=A+48|0;do{c[A>>2]=c[C>>2];A=A+4|0;C=C+4|0}while((A|0)<(D|0));A=Ka;C=Ia;D=A+52|0;do{c[A>>2]=c[C>>2];A=A+4|0;C=C+4|0}while((A|0)<(D|0));rf(qa|0,P|0,L|0)|0;rf(ra|0,Q|0,L|0)|0;if(!R)rf(sa|0,xa+(b[S>>1]<>2]=e;c[ba>>2]=r;c[ca>>2]=c[La>>2];c[ca+4>>2]=c[La+4>>2];c[ca+8>>2]=c[La+8>>2];c[ca+12>>2]=c[La+12>>2];c[da>>2]=v;c[ka>>2]=c[Ma>>2];c[ka+4>>2]=c[Ma+4>>2];c[ka+8>>2]=c[Ma+8>>2];c[ka+12>>2]=c[Ma+12>>2];c[ka+16>>2]=c[Ma+16>>2];A=Ia;C=Ja;D=A+48|0;do{c[A>>2]=c[C>>2];A=A+4|0;C=C+4|0}while((A|0)<(D|0));rf(P|0,oa|0,L|0)|0;rf(Q|0,pa|0,L|0)|0;c[fa>>2]=1;if(R)A=0;else A=xa+(b[S>>1]<=(W|0)){A=0;E=0.0;break}E=F+ +g[oa+(A<<2)>>2]*+g[P+(A<<2)>>2];A=A+1|0;F=E}while(1){if((A|0)>=(W|0))break;Pa=E+ +g[pa+(A<<2)>>2]*+g[Q+(A<<2)>>2];A=A+1|0;E=Pa}if(!(I>=N*F+O*E)){r=0;e=C;A=C}else{A=w;C=Na;D=A+48|0;do{c[A>>2]=c[C>>2];A=A+4|0;C=C+4|0}while((A|0)<(D|0));A=Ia;C=Ka;D=A+52|0;do{c[A>>2]=c[C>>2];A=A+4|0;C=C+4|0}while((A|0)<(D|0));rf(P|0,qa|0,L|0)|0;rf(Q|0,ra|0,L|0)|0;if(!R)rf(xa+(b[S>>1]<>0]=e;a[m+(v+Ga+-1)>>0]=A;v=T+((c[o+(Y<<2)>>2]|0)+X)|0;Y=V;C=(U|0)>(W<<3|0)&1}c[z>>2]=c[na>>2];i=Oa;return}function Zd(b,e,f,h,i,j,k,l,m,n,o){b=b|0;e=e|0;f=f|0;h=h|0;i=i|0;j=j|0;k=k|0;l=l|0;m=+m;n=n|0;o=o|0;var p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0.0,C=0.0,D=0;p=c[b>>2]|0;v=c[b+24>>2]|0;y=(i|0)==1&1;u=(f>>>0)/(i>>>0)|0;if((f|0)==1){w=c[b+28>>2]|0;z=b+32|0;x=w+12|0;k=w+16|0;h=w+20|0;v=w+8|0;i=w+4|0;s=w+24|0;t=w+44|0;y=b+4|0;if((c[z>>2]|0)>7){if(!p){n=c[x>>2]|0;j=c[k>>2]|0;if(!j){p=c[i>>2]|0;o=c[v>>2]|0;q=0;do{if(o>>>0

>>0){j=o+1|0;c[v>>2]=j;o=j;j=d[(c[w>>2]|0)+(p-j)>>0]|0}else j=0;n=n|j<>>1}else{u=+g[e>>2]<0.0&1;n=c[x>>2]|0;p=c[k>>2]|0;if((p+1|0)>>>0>32){q=7-p|0;q=p+((q|0)>-8?q:-8)&-8;r=p;do{j=c[v>>2]|0;o=c[i>>2]|0;if(((c[s>>2]|0)+j|0)>>>0>>0){j=j+1|0;c[v>>2]=j;a[(c[w>>2]|0)+(o-j)>>0]=n;j=0}else j=-1;c[t>>2]=c[t>>2]|j;n=n>>>8;r=r+-8|0}while((r|0)>7);p=p+-8-q|0}j=u;o=p+1|0;n=n|u<>2]=n;c[k>>2]=o;c[h>>2]=(c[h>>2]|0)+1;c[z>>2]=(c[z>>2]|0)+-8}else j=0;if(c[y>>2]|0)g[e>>2]=j|0?-1.0:1.0;if(!l){l=1;return l|0}c[l>>2]=c[e>>2];l=1;return l|0}z=(v|0)>0?v:0;do if(n)if(!j)n=0;else{if((z|0)==0?!((u&1|0)==0&(v|0)<0|(i|0)>1):0){n=j;break}rf(n|0,j|0,f<<2|0)|0}else n=j;while(0);w=(p|0)==0;x=(n|0)==0;t=0;while(1){if((t|0)>=(z|0))break;a:do if(!w){j=1<>t>>1;q=j<<1;r=0;while(1){if((r|0)<(j|0))s=0;else break a;while(1){if((s|0)>=(p|0))break;D=e+((_(q,s)|0)+r<<2)|0;C=+g[D>>2]*.7071067690849304;A=e+(((s<<1|1)<>2]*.7071067690849304;g[D>>2]=C+B;g[A>>2]=C-B;s=s+1|0}r=r+1|0}}while(0);b:do if(!x){j=1<>t>>1;q=j<<1;r=0;while(1){if((r|0)<(j|0))s=0;else break b;while(1){if((s|0)>=(p|0))break;A=n+((_(q,s)|0)+r<<2)|0;B=+g[A>>2]*.7071067690849304;D=n+(((s<<1|1)<>2]*.7071067690849304;g[A>>2]=B+C;g[D>>2]=B-C;s=s+1|0}r=r+1|0}}while(0);o=d[31165+(o&15)>>0]|0|(d[31165+(o>>4)>>0]|0)<<2;t=t+1|0}i=i>>z;t=o;j=u<>1;p=i<<1;q=0;while(1){if((q|0)<(i|0))r=0;else break c;while(1){if((r|0)>=(o|0))break;A=e+((_(p,r)|0)+q<<2)|0;B=+g[A>>2]*.7071067690849304;D=e+((_(r<<1|1,i)|0)+q<<2)|0;C=+g[D>>2]*.7071067690849304;g[A>>2]=B+C;g[D>>2]=B-C;r=r+1|0}q=q+1|0}}while(0);d:do if(x){j=j>>1;o=i<<1}else{j=j>>1;o=i<<1;p=0;while(1){if((p|0)<(i|0))q=0;else break d;while(1){if((q|0)>=(j|0))break;A=n+((_(o,q)|0)+p<<2)|0;B=+g[A>>2]*.7071067690849304;D=n+((_(q<<1|1,i)|0)+p<<2)|0;C=+g[D>>2]*.7071067690849304;g[A>>2]=B+C;g[D>>2]=B-C;q=q+1|0}p=p+1|0}}while(0);D=t|t<1;if(p){if(!w)_d(e,j>>z,i<>z,i<>2]|0)){D=o;return D|0}if(p){be(e,j>>z,i<=(u|0)){s=0;break}s=i>>1;j=j<<1;n=j>>1;p=s<<1;q=0;while(1){if((q|0)<(s|0))r=0;else break;while(1){if((r|0)>=(n|0))break;A=e+((_(p,r)|0)+q<<2)|0;B=+g[A>>2]*.7071067690849304;D=e+((_(r<<1|1,s)|0)+q<<2)|0;C=+g[D>>2]*.7071067690849304;g[A>>2]=B+C;g[D>>2]=B-C;r=r+1|0}q=q+1|0}i=s;o=o|o>>>s;t=t+1|0}while(1){if((s|0)>=(z|0))break;j=a[31181+o>>0]|0;n=1<>s>>1;p=n<<1;q=0;while(1){if((q|0)<(n|0))r=0;else break;while(1){if((r|0)>=(o|0))break;A=e+((_(p,r)|0)+q<<2)|0;B=+g[A>>2]*.7071067690849304;D=e+(((r<<1|1)<>2]*.7071067690849304;g[A>>2]=B+C;g[D>>2]=B-C;r=r+1|0}q=q+1|0}o=j&255;s=s+1|0}j=i<=(f|0))break e;g[l+(n<<2)>>2]=m*+g[e+(n<<2)>>2];n=n+1|0}}while(0);D=o&(1<=(d|0))break;e=_(f,b)|0;g=0;while(1){if((g|0)>=(b|0))break;c[k+(e+g<<2)>>2]=c[a+((_(g,d)|0)+f<<2)>>2];g=g+1|0}f=f+1|0}d=j<<2;rf(a|0,k|0,d|0)|0;i=l;return}e=17628+(d<<2)+-8|0;g=0;while(1){if((g|0)>=(d|0))break;f=e+(g<<2)|0;h=0;while(1){if((h|0)>=(b|0))break;m=c[a+((_(h,d)|0)+g<<2)>>2]|0;c[k+((_(c[f>>2]|0,b)|0)+h<<2)>>2]=m;h=h+1|0}g=g+1|0}m=j<<2;rf(a|0,k|0,m|0)|0;i=l;return}function $d(e,f,h,j,k,l,m,n,o){e=e|0;f=f|0;h=h|0;j=j|0;k=k|0;l=l|0;m=m|0;n=+n;o=o|0;var p=0.0,q=0,r=0,s=0,t=0,u=0,v=0.0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0;E=i;i=i+32|0;z=E+28|0;D=E+24|0;r=E;c[z>>2]=j;c[D>>2]=o;B=c[e>>2]|0;x=c[e+8>>2]|0;y=c[e+12>>2]|0;C=c[e+20>>2]|0;A=c[e+28>>2]|0;t=x+100|0;u=m+1|0;w=x+8|0;s=(_(u,c[w>>2]|0)|0)+y|0;x=x+96|0;s=(c[t>>2]|0)+(b[(c[x>>2]|0)+(s<<1)>>1]|0)|0;q=a[s>>0]|0;if((m|0)!=-1?((h|0)>2?((d[s+(q&255)>>0]|0)+12|0)<(j|0):0):0){w=h>>1;x=f+(w<<2)|0;y=m+-1|0;if((k|0)==1)c[D>>2]=o&1|o<<1;t=k+1>>1;ae(e,r,f,x,w,z,t,k,y,0,D);j=c[r+12>>2]|0;u=c[r+16>>2]|0;q=c[r+20>>2]|0;v=+(c[r+4>>2]|0)*.000030517578125;p=+(c[r+8>>2]|0)*.000030517578125;do if(!((k|0)<2|(u&16383|0)==0))if((u|0)>8192){j=j-(j>>5-m)|0;break}else{j=j+(w<<3>>6-m)|0;j=(j|0)>0?0:j;break}while(0);m=c[z>>2]|0;r=(m-j|0)/2|0;s=(m|0)<(r|0);r=((s?m:r)|0)<0?0:s?m:r;m=m-r|0;s=e+32|0;q=(c[s>>2]|0)-q|0;c[s>>2]=q;j=(l|0)==0?0:l+(w<<2)|0;if((r|0)<(m|0)){D=c[D>>2]|0;h=($d(e,x,w,m,t,j,y,p*n,D>>t)|0)<<(k>>1);k=m+((c[s>>2]|0)-q)|0;l=h|($d(e,f,w,r+((k|0)<25|(u|0)==16384?0:k+-24|0)|0,t,l,y,v*n,D)|0);i=E;return l|0}else{D=c[D>>2]|0;h=$d(e,f,w,r,t,l,y,v*n,D)|0;l=r+((c[s>>2]|0)-q)|0;l=h|($d(e,x,w,m+((l|0)<25|(u|0)==0?0:l+-24|0)|0,t,j,y,p*n,D>>t)|0)<<(k>>1);i=E;return l|0}}m=j+-1|0;q=q&255;j=0;r=0;while(1){if((j|0)==6)break;z=r+q+1>>1;F=(d[s+z>>0]|0)<(m|0);q=F?q:z;j=j+1|0;r=F?z:r}if(!r)j=-1;else j=d[s+r>>0]|0;j=(m-j|0)>((d[s+q>>0]|0)-m|0)?q:r;if(!j)q=0;else q=(d[s+j>>0]|0)+1|0;m=e+32|0;s=q;q=(c[m>>2]|0)-q|0;while(1){c[m>>2]=q;if(!((q|0)<0&(j|0)>0))break;q=q+s|0;c[m>>2]=q;j=j+-1|0;if(!j)r=0;else r=(d[(c[t>>2]|0)+(b[(c[x>>2]|0)+((_(u,c[w>>2]|0)|0)+y<<1)>>1]|0)+j>>0]|0)+1|0;s=r;q=q-r|0}if(j|0){if((j|0)>=8)j=(j&7|8)<<(j>>3)+-1;if(!B){F=wd(f,h,j,C,k,A,n)|0;i=E;return F|0}else{F=ud(f,h,j,C,k,A,n,c[e+4>>2]|0)|0;i=E;return F|0}}if(!(c[e+4>>2]|0)){F=0;i=E;return F|0}j=(1<>2]=q;if(!q){nf(f|0,0,h<<2|0)|0;F=0;i=E;return F|0}r=e+40|0;a:do if(!l){q=0;while(1){if((q|0)>=(h|0))break a;F=(_(c[r>>2]|0,1664525)|0)+1013904223|0;c[r>>2]=F;g[f+(q<<2)>>2]=+(F>>20|0);q=q+1|0}}else{j=0;while(1){if((j|0)>=(h|0)){j=q;break a}F=(_(c[r>>2]|0,1664525)|0)+1013904223|0;c[r>>2]=F;g[f+(j<<2)>>2]=+g[l+(j<<2)>>2]+((F&32768|0)==0?-.00390625:.00390625);j=j+1|0}}while(0);q=0;p=0.0;while(1){if((q|0)>=(h|0))break;v=+g[f+(q<<2)>>2];q=q+1|0;p=p+v*v}p=1.0/+O(+(p+1.0000000036274937e-15))*n;q=0;while(1){if((q|0)>=(h|0))break;g[f>>2]=p*+g[f>>2];q=q+1|0;f=f+4|0}i=E;return j|0}function ae(e,f,h,i,j,k,l,m,n,o,p){e=e|0;f=f|0;h=h|0;i=i|0;j=j|0;k=k|0;l=l|0;m=m|0;n=n|0;o=o|0;p=p|0;var q=0.0,r=0.0,s=0,t=0,u=0,v=0.0,w=0,x=0,y=0,z=0.0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,N=0,P=0,Q=0,R=0,S=0,T=0.0;x=c[e>>2]|0;K=c[e+8>>2]|0;L=c[e+12>>2]|0;u=c[e+16>>2]|0;S=c[e+28>>2]|0;J=c[e+36>>2]|0;t=(b[(c[K+56>>2]|0)+(L<<1)>>1]|0)+(n<<3)|0;n=t>>1;I=(o|0)==0;do if(!I)if((j|0)==2){o=n+-16|0;s=2;break}else{o=n+-4|0;s=(j<<1)+-1|0;break}else{o=n+-4|0;s=(j<<1)+-1|0}while(0);n=c[k>>2]|0;o=((_(s,o)|0)+n|0)/(s|0)|0;R=n-t+-32|0;o=(R|0)<(o|0)?R:o;if((o|0)<=64)if((o|0)<4)o=1;else w=8;else{o=64;w=8}if((w|0)==8)o=(b[25760+((o&7)<<1)>>1]>>14-(o>>3))+1&-2;G=I|(L|0)<(u|0)?o:1;H=(x|0)==0;if(H)o=0;else{a:do if(I){o=0;q=0.0;while(1){if((o|0)>=(j|0)){o=0;r=0.0;break}z=+g[h+(o<<2)>>2];o=o+1|0;q=q+z*z}while(1){if((o|0)>=(j|0))break;z=+g[i+(o<<2)>>2];o=o+1|0;r=r+z*z}q=q+1.0000000036274937e-15;r=r+1.0000000036274937e-15}else{q=1.0000000036274937e-15;r=1.0000000036274937e-15;o=0;while(1){if((o|0)>=(j|0))break a;T=+g[h+(o<<2)>>2];z=+g[i+(o<<2)>>2];v=T+z;z=T-z;q=q+v*v;r=r+z*z;o=o+1|0}}while(0);z=+O(+q);v=+O(+r);q=z*z;r=v*v;do if(!(q+r<1.000000045813705e-18))if(q>2]|0;P=F<<3;Q=S+28|0;B=c[Q>>2]|0;D=32-(aa(B|0)|0)|0;E=B>>>(D+-16|0);R=(E>>>12)+-8|0;R=(D<<3)+(R+(E>>>0>(c[5272+(R<<2)>>2]|0)>>>0&1))|0;b:do if((G|0)==1)if(!I){if(H)s=0;else{I=(o|0)>8192;s=I&1;c:do if(I){n=0;while(1){if((n|0)>=(j|0))break c;I=i+(n<<2)|0;g[I>>2]=-+g[I>>2];n=n+1|0}}while(0);q=+g[J+(L<<2)>>2];T=+g[J+((c[K+8>>2]|0)+L<<2)>>2];r=+O(+(q*q+1.0000000036274937e-15+T*T))+1.0000000036274937e-15;q=q/r;r=T/r;n=0;while(1){if((n|0)>=(j|0))break;L=h+(n<<2)|0;g[L>>2]=q*+g[L>>2]+r*+g[i+(n<<2)>>2];n=n+1|0}n=c[k>>2]|0}if((n|0)>16?(c[e+32>>2]|0)>16:0){t=c[Q>>2]|0;if(H){m=S+32|0;o=c[m>>2]|0;n=t>>>2;i=o>>>0>>0;s=i&1;if(!i){o=o-n|0;c[m>>2]=o;n=t-n|0}c[Q>>2]=n;w=S+40|0;x=S+24|0;y=S+4|0;while(1){if(n>>>0>=8388609){o=0;break b}c[N>>2]=(c[N>>2]|0)+8;n=n<<8;c[Q>>2]=n;u=c[w>>2]|0;t=c[x>>2]|0;if(t>>>0<(c[y>>2]|0)>>>0){c[x>>2]=t+1;t=d[(c[S>>2]|0)+t>>0]|0}else t=0;c[w>>2]=t;i=((u<<8|t)>>>1&255|o<<8&2147483392)^255;c[m>>2]=i;o=i}}o=t>>>2;n=t-o|0;B=S+32|0;if(s){c[B>>2]=(c[B>>2]|0)+n;n=o}c[Q>>2]=n;w=S+36|0;x=S+40|0;y=S+24|0;m=S+8|0;e=S+4|0;A=S+44|0;while(1){if(n>>>0>=8388609){o=0;break b}o=c[B>>2]|0;u=o>>>23;if((u|0)==255)c[w>>2]=(c[w>>2]|0)+1;else{t=o>>>31;n=c[x>>2]|0;if((n|0)>-1){o=c[y>>2]|0;if((o+(c[m>>2]|0)|0)>>>0<(c[e>>2]|0)>>>0){c[y>>2]=o+1;a[(c[S>>2]|0)+o>>0]=n+t;n=0}else n=-1;c[A>>2]=c[A>>2]|n}n=c[w>>2]|0;if(n|0){t=t+255&255;do{o=c[y>>2]|0;if((o+(c[m>>2]|0)|0)>>>0<(c[e>>2]|0)>>>0){c[y>>2]=o+1;a[(c[S>>2]|0)+o>>0]=t;o=0;n=c[w>>2]|0}else o=-1;c[A>>2]=c[A>>2]|o;n=n+-1|0;c[w>>2]=n}while((n|0)!=0)}c[x>>2]=u&255;o=c[B>>2]|0;n=c[Q>>2]|0}c[B>>2]=o<<8&2147483392;n=n<<8;c[Q>>2]=n;c[N>>2]=(c[N>>2]|0)+8}}else{s=0;o=0}}else s=0;else{do if(!H){if(!I?(y=c[e+48>>2]|0,y|0):0){o=(_(o,G)|0)+((((o|0)>8192?32767:-32767)|0)/(G|0)|0)|0;E=(o|0)<0;o=((G|0)>((E?0:o>>14)|0)?(E?0:o>>14):G+-1|0)+(y>>>31^1)|0;break}o=(_(o,G)|0)+8192>>14}while(0);d:do if((j|0)>2&(I^1)){w=(G|0)/2|0;x=(w*3|0)+3|0;y=x+w|0;if(H){t=(B>>>0)/(y>>>0)|0;c[S+36>>2]=t;e=S+32|0;u=c[e>>2]|0;n=((u>>>0)/(t>>>0)|0)+1|0;n=y-(y>>>0>>0?y:n)|0;if((n|0)<(x|0))o=(n|0)/3|0;else o=w+1+(n-x)|0;n=(o|0)>(w|0);if(n)s=o+-1-w+x|0;else s=o*3|0;x=n?o-w+x|0:(o*3|0)+3|0;y=_(t,y-x|0)|0;w=u-y|0;c[e>>2]=w;x=_(t,x-s|0)|0;s=(s|0)==0?B-y|0:x;c[Q>>2]=s;x=S+40|0;y=S+24|0;m=S+4|0;n=F;while(1){if(s>>>0>=8388609)break d;n=n+8|0;c[N>>2]=n;s=s<<8;c[Q>>2]=s;u=c[x>>2]|0;t=c[y>>2]|0;if(t>>>0<(c[m>>2]|0)>>>0){c[y>>2]=t+1;t=d[(c[S>>2]|0)+t>>0]|0}else t=0;c[x>>2]=t;F=((u<<8|t)>>>1&255|w<<8&2147483392)^255;c[e>>2]=F;w=F}}n=(o|0)>(w|0);if(n)t=o+-1-w+x|0;else t=o*3|0;n=n?o-w+x|0:(o*3|0)+3|0;s=(B>>>0)/(y>>>0)|0;if(!t){n=B-(_(s,y-n|0)|0)|0;c[Q>>2]=n;w=S+32|0}else{E=B-(_(s,y-t|0)|0)|0;w=S+32|0;c[w>>2]=(c[w>>2]|0)+E;n=_(s,n-t|0)|0;c[Q>>2]=n}x=S+36|0;y=S+40|0;m=S+24|0;e=S+8|0;A=S+4|0;B=S+44|0;s=F;while(1){if(n>>>0>=8388609)break d;t=c[w>>2]|0;u=t>>>23;if((u|0)==255)c[x>>2]=(c[x>>2]|0)+1;else{t=t>>>31;n=c[y>>2]|0;if((n|0)>-1){s=c[m>>2]|0;if((s+(c[e>>2]|0)|0)>>>0<(c[A>>2]|0)>>>0){c[m>>2]=s+1;a[(c[S>>2]|0)+s>>0]=n+t;n=0}else n=-1;c[B>>2]=c[B>>2]|n}n=c[x>>2]|0;if(n|0){t=t+255&255;do{s=c[m>>2]|0;if((s+(c[e>>2]|0)|0)>>>0<(c[A>>2]|0)>>>0){c[m>>2]=s+1;a[(c[S>>2]|0)+s>>0]=t;s=0;n=c[x>>2]|0}else s=-1;c[B>>2]=c[B>>2]|s;n=n+-1|0;c[x>>2]=n}while((n|0)!=0)}c[y>>2]=u&255;t=c[w>>2]|0;n=c[Q>>2]|0;s=c[N>>2]|0}c[w>>2]=t<<8&2147483392;n=n<<8;c[Q>>2]=n;s=s+8|0;c[N>>2]=s}}else{if(!((m|0)>1|I^1)){s=G>>1;t=s+1|0;e=_(t,t)|0;if(H){y=(B>>>0)/(e>>>0)|0;c[S+36>>2]=y;A=S+32|0;m=c[A>>2]|0;o=((m>>>0)/(y>>>0)|0)+1|0;o=e>>>0>>0?e:o;n=e-o|0;if((n|0)<((_(s,t)|0)>>1|0)){n=n<<3|1;u=32-(aa(n|0)|0)+-1>>1;t=1<>>0>>0;w=w+(s?0:t)|0;if((u|0)<=0)break;else{n=n-(s?0:o)|0;t=t>>>1;u=u+-1|0}}o=(w+-1|0)>>>1;s=o+1|0;n=(_(o,s)|0)>>>1}else{x=G<<1;n=(o<<3)+-7|0;u=32-(aa(n|0)|0)+-1>>1;t=1<>>0>>0;w=w+(s?0:t)|0;if((u|0)<=0)break;else{n=n-(s?0:o)|0;t=t>>>1;u=u+-1|0}}o=(x+2-w|0)>>>1;s=G+1-o|0;n=e-((_(s,G+2-o|0)|0)>>1)|0}x=_(y,e-(n+s)|0)|0;w=m-x|0;c[A>>2]=w;s=_(y,s)|0;s=(n|0)==0?B-x|0:s;c[Q>>2]=s;x=S+40|0;y=S+24|0;m=S+4|0;n=F;while(1){if(s>>>0>=8388609)break d;n=n+8|0;c[N>>2]=n;s=s<<8;c[Q>>2]=s;u=c[x>>2]|0;t=c[y>>2]|0;if(t>>>0<(c[m>>2]|0)>>>0){c[y>>2]=t+1;t=d[(c[S>>2]|0)+t>>0]|0}else t=0;c[x>>2]=t;F=((u<<8|t)>>>1&255|w<<8&2147483392)^255;c[A>>2]=F;w=F}}E=(o|0)>(s|0);n=E?G+1-o|0:o+1|0;if(E)t=e-((_(G+1-o|0,G+2-o|0)|0)>>1)|0;else t=(_(o,o+1|0)|0)>>1;s=(B>>>0)/(e>>>0)|0;if(!t){n=B-(_(s,e-n|0)|0)|0;c[Q>>2]=n;w=S+32|0}else{E=B-(_(s,e-t|0)|0)|0;w=S+32|0;c[w>>2]=(c[w>>2]|0)+E;n=_(s,n)|0;c[Q>>2]=n}x=S+36|0;y=S+40|0;m=S+24|0;e=S+8|0;A=S+4|0;B=S+44|0;s=F;while(1){if(n>>>0>=8388609)break d;t=c[w>>2]|0;u=t>>>23;if((u|0)==255)c[x>>2]=(c[x>>2]|0)+1;else{t=t>>>31;n=c[y>>2]|0;if((n|0)>-1){s=c[m>>2]|0;if((s+(c[e>>2]|0)|0)>>>0<(c[A>>2]|0)>>>0){c[m>>2]=s+1;a[(c[S>>2]|0)+s>>0]=n+t;n=0}else n=-1;c[B>>2]=c[B>>2]|n}n=c[x>>2]|0;if(n|0){t=t+255&255;do{s=c[m>>2]|0;if((s+(c[e>>2]|0)|0)>>>0<(c[A>>2]|0)>>>0){c[m>>2]=s+1;a[(c[S>>2]|0)+s>>0]=t;s=0;n=c[x>>2]|0}else s=-1;c[B>>2]=c[B>>2]|s;n=n+-1|0;c[x>>2]=n}while((n|0)!=0)}c[y>>2]=u&255;t=c[w>>2]|0;n=c[Q>>2]|0;s=c[N>>2]|0}c[w>>2]=t<<8&2147483392;n=n<<8;c[Q>>2]=n;s=s+8|0;c[N>>2]=s}}t=G+1|0;if(H){s=0;o=((bd(S,t)|0)<<14>>>0)/(G>>>0)|0;break b}n=32-(aa(G|0)|0)|0;if((n|0)<=8){n=(B>>>0)/(t>>>0)|0;if(!o){n=B-(_(n,G)|0)|0;c[Q>>2]=n;B=S+32|0}else{E=B-(_(n,t-o|0)|0)|0;B=S+32|0;c[B>>2]=(c[B>>2]|0)+E;c[Q>>2]=n}w=S+36|0;x=S+40|0;y=S+24|0;m=S+8|0;e=S+4|0;A=S+44|0;s=F;while(1){if(n>>>0>=8388609)break d;t=c[B>>2]|0;u=t>>>23;if((u|0)==255)c[w>>2]=(c[w>>2]|0)+1;else{t=t>>>31;n=c[x>>2]|0;if((n|0)>-1){s=c[y>>2]|0;if((s+(c[m>>2]|0)|0)>>>0<(c[e>>2]|0)>>>0){c[y>>2]=s+1;a[(c[S>>2]|0)+s>>0]=n+t;n=0}else n=-1;c[A>>2]=c[A>>2]|n}n=c[w>>2]|0;if(n|0){t=t+255&255;do{s=c[y>>2]|0;if((s+(c[m>>2]|0)|0)>>>0<(c[e>>2]|0)>>>0){c[y>>2]=s+1;a[(c[S>>2]|0)+s>>0]=t;s=0;n=c[w>>2]|0}else s=-1;c[A>>2]=c[A>>2]|s;n=n+-1|0;c[w>>2]=n}while((n|0)!=0)}c[x>>2]=u&255;t=c[B>>2]|0;n=c[Q>>2]|0;s=c[N>>2]|0}c[B>>2]=t<<8&2147483392;n=n<<8;c[Q>>2]=n;s=s+8|0;c[N>>2]=s}}E=n+-8|0;n=G>>>E;s=n+1|0;t=o>>>E;u=(B>>>0)/(s>>>0)|0;if(!t){u=B-(_(u,n)|0)|0;c[Q>>2]=u;m=S+32|0}else{D=B-(_(u,s-t|0)|0)|0;m=S+32|0;c[m>>2]=(c[m>>2]|0)+D;c[Q>>2]=u}x=S+36|0;y=S+40|0;A=S+24|0;B=S+8|0;C=S+4|0;D=S+44|0;t=F;while(1){if(u>>>0>=8388609)break;n=c[m>>2]|0;w=n>>>23;if((w|0)==255)c[x>>2]=(c[x>>2]|0)+1;else{t=n>>>31;n=c[y>>2]|0;if((n|0)>-1){s=c[A>>2]|0;if((s+(c[B>>2]|0)|0)>>>0<(c[C>>2]|0)>>>0){c[A>>2]=s+1;a[(c[S>>2]|0)+s>>0]=n+t;n=0}else n=-1;c[D>>2]=c[D>>2]|n}n=c[x>>2]|0;if(n|0){t=t+255&255;do{s=c[A>>2]|0;if((s+(c[B>>2]|0)|0)>>>0<(c[C>>2]|0)>>>0){c[A>>2]=s+1;a[(c[S>>2]|0)+s>>0]=t;s=0;n=c[x>>2]|0}else s=-1;c[D>>2]=c[D>>2]|s;n=n+-1|0;c[x>>2]=n}while((n|0)!=0)}c[y>>2]=w&255;n=c[m>>2]|0;u=c[Q>>2]|0;t=c[N>>2]|0}c[m>>2]=n<<8&2147483392;u=u<<8;c[Q>>2]=u;t=t+8|0;c[N>>2]=t}y=(1<>2]|0;e=S+16|0;s=c[e>>2]|0;if((s+E|0)>>>0>32){x=7-s|0;x=s+((x|0)>-8?x:-8)&-8;w=s;do{t=c[B>>2]|0;u=c[C>>2]|0;if(((c[A>>2]|0)+t|0)>>>0>>0){t=t+1|0;c[B>>2]=t;a[(c[S>>2]|0)+(u-t)>>0]=n;t=0}else t=-1;c[D>>2]=c[D>>2]|t;n=n>>>8;w=w+-8|0}while((w|0)>7);t=c[N>>2]|0;s=s+-8-x|0}c[m>>2]=n|y<>2]=s+E;c[N>>2]=t+E}while(0);o=(o<<14>>>0)/(G>>>0)|0;if(H|I)s=0;else{if(o|0){n=0;while(1){if((n|0)>=(j|0)){s=0;break b}L=h+(n<<2)|0;T=+g[L>>2]*.7071067690849304;S=i+(n<<2)|0;z=+g[S>>2]*.7071067690849304;g[L>>2]=T+z;g[S>>2]=z-T;n=n+1|0}}q=+g[J+(L<<2)>>2];T=+g[J+((c[K+8>>2]|0)+L<<2)>>2];r=+O(+(q*q+1.0000000036274937e-15+T*T))+1.0000000036274937e-15;q=q/r;r=T/r;n=0;while(1){if((n|0)>=(j|0)){s=0;o=0;break b}S=h+(n<<2)|0;g[S>>2]=q*+g[S>>2]+r*+g[i+(n<<2)>>2];n=n+1|0}}}while(0);S=c[Q>>2]|0;Q=32-(aa(S|0)|0)|0;S=S>>>(Q+-16|0);n=(S>>>12)+-8|0;n=(c[N>>2]<<3)-((Q<<3)+(n+(S>>>0>(c[5272+(n<<2)>>2]|0)>>>0&1)))+(R-P)|0;c[k>>2]=(c[k>>2]|0)-n;e:do if((o|0)<16384){switch(o|0){case 0:break;default:break e}c[p>>2]=c[p>>2]&(1<>2]=s;p=f+4|0;c[p>>2]=l;p=f+8|0;c[p>>2]=j;p=f+12|0;c[p>>2]=k;p=f+16|0;c[p>>2]=o;f=f+20|0;c[f>>2]=n;return}else{switch(o|0){case 16384:break;default:break e}c[p>>2]=c[p>>2]&(1<>2]=s;p=f+4|0;c[p>>2]=l;p=f+8|0;c[p>>2]=j;p=f+12|0;c[p>>2]=k;p=f+16|0;c[p>>2]=o;f=f+20|0;c[f>>2]=n;return}while(0);R=o<<16>>16;R=((_(R,R)|0)+4096|0)>>>13;l=R<<16>>16;l=(32767-R+(((_(l,(((_(l,(((_(l,-626)|0)+16384|0)>>>15<<16)+542441472>>16)|0)+16384|0)>>>15<<16)+-501415936>>16)|0)+16384|0)>>>15)<<16)+65536>>16;R=16384-o<<16>>16;R=((_(R,R)|0)+4096|0)>>>13;p=R<<16>>16;p=(32767-R+(((_(p,(((_(p,(((_(p,-626)|0)+16384|0)>>>15<<16)+542441472>>16)|0)+16384|0)>>>15<<16)+-501415936>>16)|0)+16384|0)>>>15)<<16)+65536>>16;R=32-(aa(l|0)|0)|0;Q=32-(aa(p|0)|0)|0;S=p<<15-Q<<16>>16;k=l<<15-R<<16>>16;k=(_((j<<23)+-8388608>>16,(Q-R<<11)+(((_(S,(((_(S,-2597)|0)+16384|0)>>>15<<16)+519831552>>16)|0)+16384|0)>>>15)-(((_(k,(((_(k,-2597)|0)+16384|0)>>>15<<16)+519831552>>16)|0)+16384|0)>>>15)<<16>>16)|0)+16384>>15;j=p;c[f>>2]=s;p=f+4|0;c[p>>2]=l;p=f+8|0;c[p>>2]=j;p=f+12|0;c[p>>2]=k;p=f+16|0;c[p>>2]=o;f=f+20|0;c[f>>2]=n;return}function be(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,j=0,k=0,l=0;l=i;j=_(b,d)|0;k=i;i=i+((1*(j<<2)|0)+15&-16)|0;if(!e){f=0;while(1){if((f|0)>=(d|0))break;e=_(f,b)|0;g=0;while(1){if((g|0)>=(b|0))break;c[k+((_(g,d)|0)+f<<2)>>2]=c[a+(e+g<<2)>>2];g=g+1|0}f=f+1|0}d=j<<2;rf(a|0,k|0,d|0)|0;i=l;return}e=17628+(d<<2)+-8|0;g=0;while(1){if((g|0)>=(d|0))break;f=e+(g<<2)|0;h=0;while(1){if((h|0)>=(b|0))break;c[k+((_(h,d)|0)+g<<2)>>2]=c[a+((_(c[f>>2]|0,b)|0)+h<<2)>>2];h=h+1|0}g=g+1|0}d=j<<2;rf(a|0,k|0,d|0)|0;i=l;return}function ce(b,e,f,h,j,k,l,m,n,o,p){b=b|0;e=e|0;f=f|0;h=h|0;j=j|0;k=k|0;l=l|0;m=m|0;n=n|0;o=o|0;p=p|0;var q=0,r=0.0,s=0.0,t=0.0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0.0,L=0,M=0,N=0.0;M=i;i=i+32|0;q=M+28|0;x=M+24|0;u=M;c[q>>2]=j;c[x>>2]=p;w=c[b>>2]|0;L=c[b+28>>2]|0;if((h|0)==1){l=b+32|0;k=(w|0)==0;m=L+12|0;D=L+16|0;E=L+20|0;F=L+8|0;G=L+4|0;H=L+24|0;p=L+44|0;z=b+4|0;A=f|0?2:1;B=0;C=e;while(1){if((c[l>>2]|0)>7){if(k){q=c[m>>2]|0;j=c[D>>2]|0;if(!j){v=c[G>>2]|0;u=c[F>>2]|0;w=0;do{if(u>>>0>>0){j=u+1|0;c[F>>2]=j;u=j;j=d[(c[L>>2]|0)+(v-j)>>0]|0}else j=0;q=q|j<>>1}else{y=+g[C>>2]<0.0&1;q=c[m>>2]|0;v=c[D>>2]|0;if((v+1|0)>>>0>32){w=7-v|0;w=v+((w|0)>-8?w:-8)&-8;x=v;do{j=c[F>>2]|0;u=c[G>>2]|0;if(((c[H>>2]|0)+j|0)>>>0>>0){j=j+1|0;c[F>>2]=j;a[(c[L>>2]|0)+(u-j)>>0]=q;j=0}else j=-1;c[p>>2]=c[p>>2]|j;q=q>>>8;x=x+-8|0}while((x|0)>7);v=v+-8-w|0}j=y;u=v+1|0;q=q|y<>2]=q;c[D>>2]=u;c[E>>2]=(c[E>>2]|0)+1;c[l>>2]=(c[l>>2]|0)+-8}else j=0;if(c[z>>2]|0)g[C>>2]=j|0?-1.0:1.0;B=B+1|0;if((B|0)>=(A|0))break;else C=f}if(!n){f=1;i=M;return f|0}c[n>>2]=c[e>>2];f=1;i=M;return f|0}ae(b,u,e,f,h,q,k,k,m,1,x);J=c[u>>2]|0;z=c[u+16>>2]|0;y=c[u+20>>2]|0;K=+(c[u+4>>2]|0)*.000030517578125;r=+(c[u+8>>2]|0)*.000030517578125;I=(h|0)==2;do if(I){j=c[q>>2]|0;if((z|0)<16384)switch(z|0){case 0:{q=0;break}default:v=26}else switch(z|0){case 16384:{q=0;break}default:v=26}if((v|0)==26)q=8;H=j-q|0;F=(z|0)>8192;G=b+32|0;c[G>>2]=(c[G>>2]|0)-(y+q);G=F?f:e;F=F?e:f;do if(!q)j=0;else{if(!w){y=L+12|0;q=c[y>>2]|0;z=L+16|0;j=c[z>>2]|0;if(!j){w=L+8|0;v=c[L+4>>2]|0;u=c[w>>2]|0;x=0;do{if(u>>>0>>0){u=u+1|0;c[w>>2]=u;j=d[(c[L>>2]|0)+(v-u)>>0]|0}else j=0;q=q|j<>2]=q>>>1;c[z>>2]=j+-1;j=L+20|0;c[j>>2]=(c[j>>2]|0)+1;j=q&1;break}j=+g[G>>2]*+g[F+4>>2]-+g[G+4>>2]*+g[F>>2]<0.0&1;D=L+12|0;q=c[D>>2]|0;E=L+16|0;u=c[E>>2]|0;if((u+1|0)>>>0>32){x=L+24|0;y=L+8|0;z=L+4|0;A=L+44|0;B=7-u|0;B=u+((B|0)>-8?B:-8)&-8;C=u;do{v=c[y>>2]|0;w=c[z>>2]|0;if(((c[x>>2]|0)+v|0)>>>0>>0){v=v+1|0;c[y>>2]=v;a[(c[L>>2]|0)+(w-v)>>0]=q;v=0}else v=-1;c[A>>2]=c[A>>2]|v;q=q>>>8;C=C+-8|0}while((C|0)>7);u=u+-8-B|0}c[D>>2]=q|j<>2]=u+1;L=L+20|0;c[L>>2]=(c[L>>2]|0)+1}while(0);L=1-(j<<1)|0;j=Zd(b,G,2,H,k,l,m,n,1.0,o,p)|0;g[F>>2]=+(0-L|0)*+g[G+4>>2];g[F+4>>2]=+(L|0)*+g[G>>2];if(c[b+4>>2]|0){g[e>>2]=K*+g[e>>2];L=e+4|0;g[L>>2]=K*+g[L>>2];s=r*+g[f>>2];g[f>>2]=s;n=f+4|0;g[n>>2]=r*+g[n>>2];t=+g[e>>2];g[e>>2]=t-s;g[f>>2]=t+ +g[f>>2];t=+g[L>>2];g[L>>2]=t-+g[n>>2];g[n>>2]=t+ +g[n>>2]}}else{v=c[q>>2]|0;u=(v-(c[u+12>>2]|0)|0)/2|0;w=(v|0)<(u|0);u=((w?v:u)|0)<0?0:w?v:u;v=v-u|0;w=b+32|0;q=(c[w>>2]|0)-y|0;c[w>>2]=q;j=c[x>>2]|0;if((u|0)<(v|0)){p=Zd(b,f,h,v,k,0,m,0,r,0,j>>k)|0;L=v+((c[w>>2]|0)-q)|0;j=p|(Zd(b,e,h,u+((L|0)<25|(z|0)==16384?0:L+-24|0)|0,k,l,m,n,1.0,o,j)|0);break}else{L=Zd(b,e,h,u,k,l,m,n,1.0,o,j)|0;n=u+((c[w>>2]|0)-q)|0;j=L|(Zd(b,f,h,v+((n|0)<25|(z|0)==0?0:n+-24|0)|0,k,0,m,0,r,0,j>>k)|0);break}}while(0);if(!(c[b+4>>2]|0)){f=j;i=M;return f|0}a:do if(!I){q=0;r=0.0;s=0.0;while(1){if((q|0)>=(h|0))break;t=+g[f+(q<<2)>>2];N=r+t*+g[e+(q<<2)>>2];q=q+1|0;r=N;s=s+t*t}N=K*K+s;s=r*K*2.0;r=N-s;s=N+s;if(s<6.000000284984708e-04|r<6.000000284984708e-04){rf(f|0,e|0,h<<2|0)|0;break}t=1.0/+O(+r);r=1.0/+O(+s);q=0;while(1){if((q|0)>=(h|0))break a;L=e+(q<<2)|0;s=+g[L>>2]*K;n=f+(q<<2)|0;N=+g[n>>2];g[L>>2]=t*(s-N);g[n>>2]=r*(s+N);q=q+1|0}}while(0);if(!J){f=j;i=M;return f|0}else q=0;while(1){if((q|0)>=(h|0))break;e=f+(q<<2)|0;g[e>>2]=-+g[e>>2];q=q+1|0}i=M;return j|0}function de(d,e,f,g,h,j){d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;var k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0;H=i;i=i+208|0;D=H+176|0;E=H+144|0;G=H;C=d+2328|0;F=c[C>>2]|0;B=G+136|0;c[B>>2]=0;switch(h|0){case 0:{k=d+2388|0;l=4;break}case 2:{k=d+2388|0;if((c[d+2420+(c[k>>2]<<2)>>2]|0)==1)l=4;else l=57;break}default:l=57}if((l|0)==4){A=Fa()|0;u=i;i=i+((1*((F+15&-16)<<1)|0)+15&-16)|0;ee(d,e,c[k>>2]|0,h,j);z=d+2765|0;fe(e,u,a[z>>0]|0,a[d+2766>>0]|0,c[C>>2]|0);y=d+2324|0;he(G+16|0,d+2736|0,d+2312|0,(j|0)==2&1,c[y>>2]|0);ie(D,d+2744|0,c[d+2732>>2]|0);v=G+64|0;w=d+2340|0;ue(v,D,c[w>>2]|0);x=d+2376|0;k=d+2767|0;if((c[x>>2]|0)!=1){k=a[k>>0]|0;if(k<<24>>24<4){h=c[w>>2]|0;e=0;while(1){if((e|0)>=(h|0))break;t=b[d+2344+(e<<1)>>1]|0;b[E+(e<<1)>>1]=(t&65535)+((_(k<<24>>24,(b[D+(e<<1)>>1]|0)-(t<<16>>16)|0)|0)>>>2);e=e+1|0}ue(G+32|0,E,h);h=c[w>>2]|0}else l=11}else{a[k>>0]=4;l=11}if((l|0)==11){h=c[w>>2]|0;rf(G+32|0,v|0,h<<1|0)|0}rf(d+2344|0,D|0,h<<1|0)|0;k=d+4160|0;if(c[k>>2]|0){j=h+-1|0;h=63570;e=0;while(1){if((e|0)>=(j|0))break;t=G+32+(e<<1)|0;b[t>>1]=(((_(h,b[t>>1]|0)|0)>>>15)+1|0)>>>1;h=h+(((_(h,-1966)|0)>>15)+1>>1)|0;e=e+1|0}e=G+32+(j<<1)|0;b[e>>1]=(((_(h,b[e>>1]|0)|0)>>>15)+1|0)>>>1;h=63570;e=0;while(1){if((e|0)>=(j|0))break;t=G+64+(e<<1)|0;b[t>>1]=(((_(h,b[t>>1]|0)|0)>>>15)+1|0)>>>1;h=h+(((_(h,-1966)|0)>>15)+1>>1)|0;e=e+1|0}t=G+64+(j<<1)|0;b[t>>1]=(((_(h,b[t>>1]|0)|0)>>>15)+1|0)>>>1}if((a[z>>0]|0)==2){h=d+2316|0;l=c[h>>2]|0;t=c[y>>2]|0;j=(l|0)==8;q=(t|0)==4;r=j?(q?11:3):q?34:12;q=j?(q?32969:32935):q?33013:32941;l=l<<16;j=l>>15;l=(l>>16)*18|0;m=j+(b[d+2762>>1]|0)|0;n=a[d+2764>>0]|0;o=(j|0)>(l|0);s=0;while(1){if((s|0)>=(t|0))break;e=m+(a[q+((_(s,r)|0)+n)>>0]|0)|0;p=G+(s<<2)|0;c[p>>2]=e;if(o)if((e|0)>(j|0))e=j;else e=(e|0)<(l|0)?l:e;else if((e|0)>(l|0))e=l;else e=(e|0)<(j|0)?j:e;c[p>>2]=e;s=s+1|0}j=b[d+2768>>1]|0;e=c[17400+((j&65535)<<24>>24<<2)>>2]|0;j=(j&65535)>>>8;o=0;while(1){if((o|0)>=(t|0))break;l=(a[d+2740+o>>0]|0)*5|0;m=o*5|0;n=0;while(1){if((n|0)==5)break;b[G+96+(m+n<<1)>>1]=a[e+(l+n)>>0]<<7;n=n+1|0}o=o+1|0}c[B>>2]=b[25412+((j&65535)<<24>>24<<1)>>1]}else{h=c[y>>2]|0;nf(G|0,0,h<<2|0)|0;nf(G+96|0,0,h*10|0)|0;a[d+2768>>0]=0;c[B>>2]=0;h=d+2316|0}Ce(d,G,f,u);e=c[h>>2]|0;h=d+4248|0;if((e|0)!=(c[h>>2]|0)){c[d+4168>>2]=c[C>>2]<<7;c[d+4240>>2]=65536;c[d+4244>>2]=65536;c[d+4256>>2]=20;c[d+4252>>2]=2;c[h>>2]=e}s=d+4168|0;u=a[z>>0]|0;t=d+4164|0;c[t>>2]=u<<24>>24;a:do if(u<<24>>24==2){h=d+2332|0;n=c[h>>2]|0;o=c[y>>2]|0;p=o+-1|0;q=d+4172|0;m=c[G+(p<<2)>>2]|0;e=0;r=0;while(1){if((_(r,n)|0)>=(m|0)|(r|0)==(o|0))break;else{j=0;l=0}while(1){if((j|0)==5)break;u=l+(b[G+96+(((p-r|0)*5|0)+j<<1)>>1]|0)|0;j=j+1|0;l=u}if((l|0)>(e|0)){e=G+96+((o+65535-r<<16>>16)*5<<1)|0;b[q>>1]=b[e>>1]|0;b[q+2>>1]=b[e+2>>1]|0;b[q+4>>1]=b[e+4>>1]|0;b[q+6>>1]=b[e+6>>1]|0;b[q+8>>1]=b[e+8>>1]|0;c[s>>2]=c[G+(p-r<<2)>>2]<<8;e=l}r=r+1|0}c[q>>2]=0;c[q+4>>2]=0;b[q+8>>1]=0;b[d+4176>>1]=e;if((e|0)<11469){e=(11744256/(((e|0)>1?e:1)|0)|0)<<16>>16;j=0;while(1){if((j|0)==5)break a;u=d+4172+(j<<1)|0;b[u>>1]=(_(b[u>>1]|0,e)|0)>>>10;j=j+1|0}}if((e|0)>15565){e=(255016960/(e|0)|0)<<16>>16;j=0;while(1){if((j|0)==5)break a;u=d+4172+(j<<1)|0;b[u>>1]=(_(b[u>>1]|0,e)|0)>>>14;j=j+1|0}}}else{c[s>>2]=(e<<16>>16)*4608;h=d+4172|0;c[h>>2]=0;c[h+4>>2]=0;b[h+8>>1]=0;h=d+2332|0}while(0);rf(d+4182|0,v|0,c[w>>2]<<1|0)|0;b[d+4236>>1]=c[B>>2];B=c[y>>2]|0;v=G+16+(B+-2<<2)|0;w=c[v+4>>2]|0;y=d+4240|0;c[y>>2]=c[v>>2];c[y+4>>2]=w;c[d+4256>>2]=c[h>>2];c[d+4252>>2]=B;c[k>>2]=0;c[t>>2]=a[z>>0];c[x>>2]=0;Na(A|0);h=G}else if((l|0)==57){a[d+2765>>0]=c[d+4164>>2];k=c[d+2316>>2]|0;h=d+4248|0;if((k|0)!=(c[h>>2]|0)){c[d+4168>>2]=F<<7;c[d+4240>>2]=65536;c[d+4244>>2]=65536;c[d+4256>>2]=20;c[d+4252>>2]=2;c[h>>2]=k}me(d,G,f);k=d+4160|0;c[k>>2]=(c[k>>2]|0)+1;h=G}A=c[C>>2]|0;B=(c[d+2336>>2]|0)-A|0;sf(d+1348|0,d+1348+(A<<1)|0,B<<1|0)|0;rf(d+1348+(B<<1)|0,f|0,c[C>>2]<<1|0)|0;Be(d,h,f,F);if(c[k>>2]|0){ze(d+4228|0,d+4232|0,f,F);c[d+4216>>2]=1;f=d+2324|0;f=c[f>>2]|0;f=f+-1|0;f=G+(f<<2)|0;f=c[f>>2]|0;G=d+2308|0;c[G>>2]=f;c[g>>2]=F;i=H;return 0}l=d+4216|0;b:do if(c[l>>2]|0){ze(E,D,f,F);k=c[D>>2]|0;h=c[d+4232>>2]|0;if((k|0)<=(h|0)){if((k|0)<(h|0))c[E>>2]=c[E>>2]>>h-k}else{D=d+4228|0;c[D>>2]=c[D>>2]>>k-h}k=c[E>>2]|0;h=d+4228|0;e=c[h>>2]|0;if((k|0)>(e|0)){C=aa(e|0)|0;D=e<>2]=D;C=25-C|0;k=k>>((C|0)>0?C:0);c[E>>2]=k;k=(D|0)/(((k|0)>1?k:1)|0)|0;if((k|0)<1)k=0;else{j=aa(k|0)|0;h=24-j|0;e=0-h|0;do if(h)if((h|0)<0){k=k<>>(h+32|0);break}else{k=k<<32-h|k>>>h;break}while(0);E=((j&1|0)==0?46214:32768)>>>(j>>>1);k=(_(k&127,13959168)|0)>>>16;k=E+((_(E>>16,k)|0)+((_(E&65535,k)|0)>>>16))<<4}e=((65536-k|0)/(F|0)|0)<<2;h=0;while(1){if((h|0)>=(F|0))break b;E=f+(h<<1)|0;D=b[E>>1]|0;b[E>>1]=(_(k>>16,D)|0)+((_(k&65532,D)|0)>>>16);k=k+e|0;if((k|0)>65536)break b;h=h+1|0}}}while(0);c[l>>2]=0;f=d+2324|0;f=c[f>>2]|0;f=f+-1|0;f=G+(f<<2)|0;f=c[f>>2]|0;G=d+2308|0;c[G>>2]=f;c[g>>2]=F;i=H;return 0}function ee(f,g,h,j,k){f=f|0;g=g|0;h=h|0;j=j|0;k=k|0;var l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0;E=i;i=i+48|0;z=E;w=E+32|0;a:do if((j|0)==0?(c[f+2404+(h<<2)>>2]|0)==0:0){s=g+28|0;n=c[s>>2]|0;t=g+32|0;j=c[t>>2]|0;l=n>>>8;h=-1;while(1){h=h+1|0;m=_(l,d[29937+h>>0]|0)|0;if(j>>>0>=m>>>0)break;else n=m}r=j-m|0;c[t>>2]=r;j=n-m|0;c[s>>2]=j;n=g+20|0;o=g+40|0;p=g+24|0;q=g+4|0;while(1){if(j>>>0>=8388609)break a;c[n>>2]=(c[n>>2]|0)+8;j=j<<8;c[s>>2]=j;m=c[o>>2]|0;l=c[p>>2]|0;if(l>>>0<(c[q>>2]|0)>>>0){c[p>>2]=l+1;l=d[(c[g>>2]|0)+l>>0]|0}else l=0;c[o>>2]=l;D=((m<<8|l)>>>1&255|r<<8&2147483392)^255;c[t>>2]=D;r=D}}else B=3;while(0);if((B|0)==3){r=g+28|0;n=c[r>>2]|0;s=g+32|0;j=c[s>>2]|0;l=n>>>8;t=-1;while(1){m=t+1|0;h=_(l,d[29933+m>>0]|0)|0;if(j>>>0>>0){t=m;n=h}else break}q=j-h|0;c[s>>2]=q;h=n-h|0;c[r>>2]=h;m=g+20|0;n=g+40|0;o=g+24|0;p=g+4|0;while(1){if(h>>>0>=8388609)break;c[m>>2]=(c[m>>2]|0)+8;h=h<<8;c[r>>2]=h;l=c[n>>2]|0;j=c[o>>2]|0;if(j>>>0<(c[p>>2]|0)>>>0){c[o>>2]=j+1;j=d[(c[g>>2]|0)+j>>0]|0}else j=0;c[n>>2]=j;D=((l<<8|j)>>>1&255|q<<8&2147483392)^255;c[s>>2]=D;q=D}h=t+3|0}j=h>>>1;D=f+2765|0;a[D>>0]=j;a[f+2766>>0]=h&1;x=(k|0)==2;if(x){t=g+28|0;m=c[t>>2]|0;r=g+32|0;j=c[r>>2]|0;l=m>>>8;s=-1;while(1){s=s+1|0;h=_(l,d[29396+s>>0]|0)|0;if(j>>>0>=h>>>0)break;else m=h}C=j-h|0;c[r>>2]=C;h=m-h|0;c[t>>2]=h;n=g+20|0;o=g+40|0;p=g+24|0;q=g+4|0;m=C;while(1){if(h>>>0>=8388609)break;c[n>>2]=(c[n>>2]|0)+8;h=h<<8;c[t>>2]=h;l=c[o>>2]|0;j=c[p>>2]|0;if(j>>>0<(c[q>>2]|0)>>>0){c[p>>2]=j+1;j=d[(c[g>>2]|0)+j>>0]|0}else j=0;c[o>>2]=j;C=((l<<8|j)>>>1&255|m<<8&2147483392)^255;c[r>>2]=C;m=C}a[f+2736>>0]=s;v=r;C=n;u=p;A=g}else{h=j<<24>>24;t=g+28|0;n=c[t>>2]|0;v=g+32|0;j=c[v>>2]|0;l=n>>>8;r=-1;while(1){r=r+1|0;m=_(l,d[29372+(h<<3)+r>>0]|0)|0;if(j>>>0>=m>>>0)break;else n=m}C=j-m|0;c[v>>2]=C;h=n-m|0;c[t>>2]=h;s=g+20|0;o=g+40|0;u=g+24|0;q=g+4|0;m=C;while(1){if(h>>>0>=8388609)break;c[s>>2]=(c[s>>2]|0)+8;h=h<<8;c[t>>2]=h;l=c[o>>2]|0;j=c[u>>2]|0;if(j>>>0<(c[q>>2]|0)>>>0){c[u>>2]=j+1;j=d[(c[g>>2]|0)+j>>0]|0}else j=0;c[o>>2]=j;C=((l<<8|j)>>>1&255|m<<8&2147483392)^255;c[v>>2]=C;m=C}p=f+2736|0;a[p>>0]=r<<3;m=c[t>>2]|0;h=c[v>>2]|0;j=m>>>8;n=-1;while(1){n=n+1|0;l=_(j,d[29962+n>>0]|0)|0;if(h>>>0>=l>>>0)break;else m=l}C=h-l|0;c[v>>2]=C;h=m-l|0;c[t>>2]=h;m=C;while(1){if(h>>>0>=8388609)break;c[s>>2]=(c[s>>2]|0)+8;h=h<<8;c[t>>2]=h;l=c[o>>2]|0;j=c[u>>2]|0;if(j>>>0<(c[q>>2]|0)>>>0){c[u>>2]=j+1;j=d[(c[g>>2]|0)+j>>0]|0}else j=0;c[o>>2]=j;C=((l<<8|j)>>>1&255|m<<8&2147483392)^255;c[v>>2]=C;m=C}a[p>>0]=(d[p>>0]|0)+n;C=s;A=g}y=f+2324|0;n=1;while(1){if((n|0)>=(c[y>>2]|0))break;m=c[t>>2]|0;h=c[v>>2]|0;j=m>>>8;p=-1;while(1){p=p+1|0;l=_(j,d[29396+p>>0]|0)|0;if(h>>>0>=l>>>0)break;else m=l}g=h-l|0;c[v>>2]=g;h=m-l|0;c[t>>2]=h;m=g;while(1){if(h>>>0>=8388609)break;c[C>>2]=(c[C>>2]|0)+8;h=h<<8;c[t>>2]=h;l=c[o>>2]|0;j=c[u>>2]|0;if(j>>>0<(c[q>>2]|0)>>>0){c[u>>2]=j+1;j=d[(c[A>>2]|0)+j>>0]|0}else j=0;c[o>>2]=j;g=((l<<8|j)>>>1&255|m<<8&2147483392)^255;c[v>>2]=g;m=g}a[f+2736+n>>0]=p;n=n+1|0}g=f+2732|0;n=c[g>>2]|0;h=_(a[D>>0]>>1,b[n>>1]|0)|0;h=(c[n+16>>2]|0)+h|0;n=c[t>>2]|0;j=c[v>>2]|0;l=n>>>8;p=-1;while(1){p=p+1|0;m=_(l,d[h+p>>0]|0)|0;if(j>>>0>=m>>>0)break;else n=m}s=j-m|0;c[v>>2]=s;h=n-m|0;c[t>>2]=h;m=s;while(1){if(h>>>0>=8388609)break;c[C>>2]=(c[C>>2]|0)+8;h=h<<8;c[t>>2]=h;l=c[o>>2]|0;j=c[u>>2]|0;if(j>>>0<(c[q>>2]|0)>>>0){c[u>>2]=j+1;j=d[(c[A>>2]|0)+j>>0]|0}else j=0;c[o>>2]=j;s=((l<<8|j)>>>1&255|m<<8&2147483392)^255;c[v>>2]=s;m=s}a[f+2744>>0]=p;Cd(z,w,c[g>>2]|0,p<<24>>24);s=0;while(1){h=c[g>>2]|0;if((s|0)>=(b[h+2>>1]|0))break;j=(c[h+28>>2]|0)+(b[z+(s<<1)>>1]|0)|0;p=c[t>>2]|0;l=c[v>>2]|0;m=p>>>8;r=-1;while(1){h=r+1|0;n=_(m,d[j+h>>0]|0)|0;if(l>>>0>>0){r=h;p=n}else break}w=l-n|0;c[v>>2]=w;l=p-n|0;c[t>>2]=l;p=w;while(1){if(l>>>0>=8388609)break;c[C>>2]=(c[C>>2]|0)+8;l=l<<8;c[t>>2]=l;m=c[o>>2]|0;j=c[u>>2]|0;if(j>>>0<(c[q>>2]|0)>>>0){c[u>>2]=j+1;j=d[(c[A>>2]|0)+j>>0]|0}else j=0;c[o>>2]=j;w=((m<<8|j)>>>1&255|p<<8&2147483392)^255;c[v>>2]=w;p=w}switch(r|0){case -1:{m=l>>>8;n=-1;while(1){h=n+1|0;j=_(m,d[29970+h>>0]|0)|0;if(p>>>0>>0){n=h;l=j}else break}m=p-j|0;c[v>>2]=m;h=l-j|0;c[t>>2]=h;while(1){if(h>>>0>=8388609)break;c[C>>2]=(c[C>>2]|0)+8;h=h<<8;c[t>>2]=h;l=c[o>>2]|0;j=c[u>>2]|0;if(j>>>0<(c[q>>2]|0)>>>0){c[u>>2]=j+1;j=d[(c[A>>2]|0)+j>>0]|0}else j=0;c[o>>2]=j;w=((l<<8|j)>>>1&255|m<<8&2147483392)^255;c[v>>2]=w;m=w}h=~n;break}case 7:{m=l>>>8;n=-1;while(1){h=n+1|0;j=_(m,d[29970+h>>0]|0)|0;if(p>>>0>>0){n=h;l=j}else break}m=p-j|0;c[v>>2]=m;h=l-j|0;c[t>>2]=h;while(1){if(h>>>0>=8388609)break;c[C>>2]=(c[C>>2]|0)+8;h=h<<8;c[t>>2]=h;l=c[o>>2]|0;j=c[u>>2]|0;if(j>>>0<(c[q>>2]|0)>>>0){c[u>>2]=j+1;j=d[(c[A>>2]|0)+j>>0]|0}else j=0;c[o>>2]=j;w=((l<<8|j)>>>1&255|m<<8&2147483392)^255;c[v>>2]=w;m=w}h=n+9|0;break}default:{}}w=s+1|0;a[f+2744+w>>0]=h+252;s=w}if((c[y>>2]|0)==4){m=c[t>>2]|0;h=c[v>>2]|0;j=m>>>8;n=-1;while(1){n=n+1|0;l=_(j,d[29939+n>>0]|0)|0;if(h>>>0>=l>>>0)break;else m=l}z=h-l|0;c[v>>2]=z;h=m-l|0;c[t>>2]=h;m=z;while(1){if(h>>>0>=8388609)break;c[C>>2]=(c[C>>2]|0)+8;h=h<<8;c[t>>2]=h;l=c[o>>2]|0;j=c[u>>2]|0;if(j>>>0<(c[q>>2]|0)>>>0){c[u>>2]=j+1;j=d[(c[A>>2]|0)+j>>0]|0}else j=0;c[o>>2]=j;z=((l<<8|j)>>>1&255|m<<8&2147483392)^255;c[v>>2]=z;m=z}a[f+2767>>0]=n}else a[f+2767>>0]=4;do if((a[D>>0]|0)==2){if(x?(c[f+2396>>2]|0)==2:0){m=c[t>>2]|0;h=c[v>>2]|0;j=m>>>8;p=-1;while(1){n=p+1|0;l=_(j,d[30009+n>>0]|0)|0;if(h>>>0>>0){p=n;m=l}else break}z=h-l|0;c[v>>2]=z;h=m-l|0;c[t>>2]=h;m=z;while(1){if(h>>>0>=8388609)break;c[C>>2]=(c[C>>2]|0)+8;h=h<<8;c[t>>2]=h;l=c[o>>2]|0;j=c[u>>2]|0;if(j>>>0<(c[q>>2]|0)>>>0){c[u>>2]=j+1;j=d[(c[A>>2]|0)+j>>0]|0}else j=0;c[o>>2]=j;z=((l<<8|j)>>>1&255|m<<8&2147483392)^255;c[v>>2]=z;m=z}if((n&65535)<<16>>16>0){h=f+2400|0;j=(e[h>>1]|0)+(p+65528)&65535;b[f+2762>>1]=j}else B=108}else B=108;if((B|0)==108){m=c[t>>2]|0;h=c[v>>2]|0;j=m>>>8;n=-1;while(1){n=n+1|0;l=_(j,d[29977+n>>0]|0)|0;if(h>>>0>=l>>>0)break;else m=l}B=h-l|0;c[v>>2]=B;h=m-l|0;c[t>>2]=h;m=B;while(1){if(h>>>0>=8388609)break;c[C>>2]=(c[C>>2]|0)+8;h=h<<8;c[t>>2]=h;l=c[o>>2]|0;j=c[u>>2]|0;if(j>>>0<(c[q>>2]|0)>>>0){c[u>>2]=j+1;j=d[(c[A>>2]|0)+j>>0]|0}else j=0;c[o>>2]=j;B=((l<<8|j)>>>1&255|m<<8&2147483392)^255;c[v>>2]=B;m=B}r=f+2762|0;b[r>>1]=_(n<<16>>16,c[f+2316>>2]>>1)|0;h=c[f+2380>>2]|0;n=c[t>>2]|0;j=c[v>>2]|0;l=n>>>8;p=-1;while(1){p=p+1|0;m=_(l,d[h+p>>0]|0)|0;if(j>>>0>=m>>>0)break;else n=m}B=j-m|0;c[v>>2]=B;h=n-m|0;c[t>>2]=h;m=B;while(1){if(h>>>0>=8388609)break;c[C>>2]=(c[C>>2]|0)+8;h=h<<8;c[t>>2]=h;l=c[o>>2]|0;j=c[u>>2]|0;if(j>>>0<(c[q>>2]|0)>>>0){c[u>>2]=j+1;j=d[(c[A>>2]|0)+j>>0]|0}else j=0;c[o>>2]=j;B=((l<<8|j)>>>1&255|m<<8&2147483392)^255;c[v>>2]=B;m=B}j=(e[r>>1]|0)+p&65535;b[r>>1]=j;h=f+2400|0}b[h>>1]=j;h=c[f+2384>>2]|0;n=c[t>>2]|0;j=c[v>>2]|0;l=n>>>8;p=-1;while(1){p=p+1|0;m=_(l,d[h+p>>0]|0)|0;if(j>>>0>=m>>>0)break;else n=m}B=j-m|0;c[v>>2]=B;h=n-m|0;c[t>>2]=h;m=B;while(1){if(h>>>0>=8388609)break;c[C>>2]=(c[C>>2]|0)+8;h=h<<8;c[t>>2]=h;l=c[o>>2]|0;j=c[u>>2]|0;if(j>>>0<(c[q>>2]|0)>>>0){c[u>>2]=j+1;j=d[(c[A>>2]|0)+j>>0]|0}else j=0;c[o>>2]=j;B=((l<<8|j)>>>1&255|m<<8&2147483392)^255;c[v>>2]=B;m=B}a[f+2764>>0]=p;m=c[t>>2]|0;h=c[v>>2]|0;j=m>>>8;n=-1;while(1){n=n+1|0;l=_(j,d[29437+n>>0]|0)|0;if(h>>>0>=l>>>0)break;else m=l}B=h-l|0;c[v>>2]=B;h=m-l|0;c[t>>2]=h;m=B;while(1){if(h>>>0>=8388609)break;c[C>>2]=(c[C>>2]|0)+8;h=h<<8;c[t>>2]=h;l=c[o>>2]|0;j=c[u>>2]|0;if(j>>>0<(c[q>>2]|0)>>>0){c[u>>2]=j+1;j=d[(c[A>>2]|0)+j>>0]|0}else j=0;c[o>>2]=j;B=((l<<8|j)>>>1&255|m<<8&2147483392)^255;c[v>>2]=B;m=B}s=f+2768|0;a[s>>0]=n;p=0;while(1){if((p|0)>=(c[y>>2]|0))break;h=c[17376+(a[s>>0]<<2)>>2]|0;n=c[t>>2]|0;j=c[v>>2]|0;l=n>>>8;r=-1;while(1){r=r+1|0;m=_(l,d[h+r>>0]|0)|0;if(j>>>0>=m>>>0)break;else n=m}B=j-m|0;c[v>>2]=B;h=n-m|0;c[t>>2]=h;m=B;while(1){if(h>>>0>=8388609)break;c[C>>2]=(c[C>>2]|0)+8;h=h<<8;c[t>>2]=h;l=c[o>>2]|0;j=c[u>>2]|0;if(j>>>0<(c[q>>2]|0)>>>0){c[u>>2]=j+1;j=d[(c[A>>2]|0)+j>>0]|0}else j=0;c[o>>2]=j;B=((l<<8|j)>>>1&255|m<<8&2147483392)^255;c[v>>2]=B;m=B}a[f+2740+p>>0]=r;p=p+1|0}if(k|0){a[f+2769>>0]=0;break}m=c[t>>2]|0;h=c[v>>2]|0;j=m>>>8;n=-1;while(1){n=n+1|0;l=_(j,d[29930+n>>0]|0)|0;if(h>>>0>=l>>>0)break;else m=l}k=h-l|0;c[v>>2]=k;h=m-l|0;c[t>>2]=h;m=k;while(1){if(h>>>0>=8388609)break;c[C>>2]=(c[C>>2]|0)+8;h=h<<8;c[t>>2]=h;l=c[o>>2]|0;j=c[u>>2]|0;if(j>>>0<(c[q>>2]|0)>>>0){c[u>>2]=j+1;j=d[(c[A>>2]|0)+j>>0]|0}else j=0;c[o>>2]=j;k=((l<<8|j)>>>1&255|m<<8&2147483392)^255;c[v>>2]=k;m=k}a[f+2769>>0]=n}while(0);c[f+2396>>2]=a[D>>0];m=c[t>>2]|0;h=c[v>>2]|0;j=m>>>8;n=-1;while(1){n=n+1|0;l=_(j,d[29947+n>>0]|0)|0;if(h>>>0>=l>>>0)break;else m=l}k=h-l|0;c[v>>2]=k;h=m-l|0;c[t>>2]=h;m=k;while(1){if(h>>>0>=8388609)break;c[C>>2]=(c[C>>2]|0)+8;h=h<<8;c[t>>2]=h;l=c[o>>2]|0;j=c[u>>2]|0;if(j>>>0<(c[q>>2]|0)>>>0){c[u>>2]=j+1;j=d[(c[A>>2]|0)+j>>0]|0}else j=0;c[o>>2]=j;k=((l<<8|j)>>>1&255|m<<8&2147483392)^255;c[v>>2]=k;m=k}a[f+2770>>0]=n;i=E;return}function fe(e,f,g,h,j){e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;var k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0;J=i;i=i+176|0;H=J+160|0;I=J+80|0;A=J;k=g>>1;F=e+28|0;o=c[F>>2]|0;G=e+32|0;m=c[G>>2]|0;n=o>>>8;u=-1;while(1){u=u+1|0;l=_(n,d[30432+(k*9|0)+u>>0]|0)|0;if(m>>>0>=l>>>0)break;else o=l}n=m-l|0;c[G>>2]=n;k=o-l|0;c[F>>2]=k;B=e+20|0;C=e+40|0;D=e+24|0;E=e+4|0;while(1){if(k>>>0>=8388609)break;c[B>>2]=(c[B>>2]|0)+8;k=k<<8;c[F>>2]=k;m=c[C>>2]|0;l=c[D>>2]|0;if(l>>>0<(c[E>>2]|0)>>>0){c[D>>2]=l+1;l=d[(c[e>>2]|0)+l>>0]|0}else l=0;c[C>>2]=l;z=((m<<8|l)>>>1&255|n<<8&2147483392)^255;c[G>>2]=z;n=z}z=j>>4;z=z+((z<<4|0)<(j|0)&1)|0;t=0;while(1){if((t|0)>=(z|0)){x=0;break}s=A+(t<<2)|0;c[s>>2]=0;m=k>>>8;o=-1;while(1){o=o+1|0;l=_(m,d[30090+(u*18|0)+o>>0]|0)|0;if(n>>>0>=l>>>0)break;else k=l}n=n-l|0;c[G>>2]=n;k=k-l|0;c[F>>2]=k;while(1){if(k>>>0>=8388609)break;c[B>>2]=(c[B>>2]|0)+8;k=k<<8;c[F>>2]=k;m=c[C>>2]|0;l=c[D>>2]|0;if(l>>>0<(c[E>>2]|0)>>>0){c[D>>2]=l+1;l=d[(c[e>>2]|0)+l>>0]|0}else l=0;c[C>>2]=l;x=((m<<8|l)>>>1&255|n<<8&2147483392)^255;c[G>>2]=x;n=x}r=I+(t<<2)|0;m=0;l=o;a:while(1){c[r>>2]=l;if((l|0)!=17)break;q=m+1|0;c[s>>2]=q;o=30252+((q|0)==10&1)|0;p=k>>>8;l=-1;while(1){l=l+1|0;m=_(p,d[o+l>>0]|0)|0;if(n>>>0>=m>>>0)break;else k=m}n=n-m|0;c[G>>2]=n;k=k-m|0;c[F>>2]=k;while(1){if(k>>>0>=8388609){m=q;continue a}c[B>>2]=(c[B>>2]|0)+8;k=k<<8;c[F>>2]=k;o=c[C>>2]|0;m=c[D>>2]|0;if(m>>>0<(c[E>>2]|0)>>>0){c[D>>2]=m+1;m=d[(c[e>>2]|0)+m>>0]|0}else m=0;c[C>>2]=m;x=((o<<8|m)>>>1&255|n<<8&2147483392)^255;c[G>>2]=x;n=x}}t=t+1|0}while(1){if((x|0)>=(z|0)){s=0;break}q=c[I+(x<<2)>>2]|0;k=f+(x<<16>>12<<1)|0;if((q|0)>0){l=30924+(d[31076+q>>0]|0)|0;p=c[F>>2]|0;m=c[G>>2]|0;n=p>>>8;s=-1;while(1){s=s+1|0;o=_(n,d[l+s>>0]|0)|0;if(m>>>0>=o>>>0)break;else p=o}w=m-o|0;c[G>>2]=w;l=p-o|0;c[F>>2]=l;o=w;while(1){if(l>>>0>=8388609)break;c[B>>2]=(c[B>>2]|0)+8;l=l<<8;c[F>>2]=l;n=c[C>>2]|0;m=c[D>>2]|0;if(m>>>0<(c[E>>2]|0)>>>0){c[D>>2]=m+1;m=d[(c[e>>2]|0)+m>>0]|0}else m=0;c[C>>2]=m;w=((n<<8|m)>>>1&255|o<<8&2147483392)^255;c[G>>2]=w;o=w}v=q-s|0;w=v&65535;r=s<<16>>16;if((s&65535)<<16>>16>0){l=30772+(d[31076+r>>0]|0)|0;p=c[F>>2]|0;m=c[G>>2]|0;n=p>>>8;q=-1;while(1){q=q+1|0;o=_(n,d[l+q>>0]|0)|0;if(m>>>0>=o>>>0)break;else p=o}u=m-o|0;c[G>>2]=u;l=p-o|0;c[F>>2]=l;o=u;while(1){if(l>>>0>=8388609)break;c[B>>2]=(c[B>>2]|0)+8;l=l<<8;c[F>>2]=l;n=c[C>>2]|0;m=c[D>>2]|0;if(m>>>0<(c[E>>2]|0)>>>0){c[D>>2]=m+1;m=d[(c[e>>2]|0)+m>>0]|0}else m=0;c[C>>2]=m;u=((n<<8|m)>>>1&255|o<<8&2147483392)^255;c[G>>2]=u;o=u}u=q&65535;l=r-q&65535;r=u<<16>>16;if(u<<16>>16>0){m=30620+(d[31076+r>>0]|0)|0;q=c[F>>2]|0;n=c[G>>2]|0;o=q>>>8;s=-1;while(1){s=s+1|0;p=_(o,d[m+s>>0]|0)|0;if(n>>>0>=p>>>0)break;else q=p}u=n-p|0;c[G>>2]=u;m=q-p|0;c[F>>2]=m;p=u;while(1){if(m>>>0>=8388609)break;c[B>>2]=(c[B>>2]|0)+8;m=m<<8;c[F>>2]=m;o=c[C>>2]|0;n=c[D>>2]|0;if(n>>>0<(c[E>>2]|0)>>>0){c[D>>2]=n+1;n=d[(c[e>>2]|0)+n>>0]|0}else n=0;c[C>>2]=n;u=((o<<8|n)>>>1&255|p<<8&2147483392)^255;c[G>>2]=u;p=u}t=s&65535;u=r-s&65535;m=k+2|0;s=t<<16>>16;if(t<<16>>16>0){n=30468+(d[31076+s>>0]|0)|0;r=c[F>>2]|0;o=c[G>>2]|0;p=r>>>8;t=-1;while(1){t=t+1|0;q=_(p,d[n+t>>0]|0)|0;if(o>>>0>=q>>>0)break;else r=q}p=o-q|0;c[G>>2]=p;n=r-q|0;c[F>>2]=n;q=p;while(1){if(n>>>0>=8388609)break;c[B>>2]=(c[B>>2]|0)+8;n=n<<8;c[F>>2]=n;p=c[C>>2]|0;o=c[D>>2]|0;if(o>>>0<(c[E>>2]|0)>>>0){c[D>>2]=o+1;o=d[(c[e>>2]|0)+o>>0]|0}else o=0;c[C>>2]=o;r=((p<<8|o)>>>1&255|q<<8&2147483392)^255;c[G>>2]=r;q=r}b[k>>1]=t;o=s-t&65535;n=u;u=l}else{n=u;y=62}}else y=52}else{l=0;y=52}if((y|0)==52){m=k+2|0;n=0;y=62}if((y|0)==62){y=0;b[k>>1]=0;o=0;u=l}b[m>>1]=o;r=k+4|0;t=k+6|0;s=n<<16>>16;if(n<<16>>16>0){l=30468+(d[31076+s>>0]|0)|0;p=c[F>>2]|0;m=c[G>>2]|0;n=p>>>8;q=-1;while(1){q=q+1|0;o=_(n,d[l+q>>0]|0)|0;if(m>>>0>=o>>>0)break;else p=o}n=m-o|0;c[G>>2]=n;l=p-o|0;c[F>>2]=l;o=n;while(1){if(l>>>0>=8388609)break;c[B>>2]=(c[B>>2]|0)+8;l=l<<8;c[F>>2]=l;n=c[C>>2]|0;m=c[D>>2]|0;if(m>>>0<(c[E>>2]|0)>>>0){c[D>>2]=m+1;m=d[(c[e>>2]|0)+m>>0]|0}else m=0;c[C>>2]=m;p=((n<<8|m)>>>1&255|o<<8&2147483392)^255;c[G>>2]=p;o=p}b[r>>1]=q;l=s-q&65535}else{b[r>>1]=0;l=0}b[t>>1]=l;r=u<<16>>16;if(u<<16>>16>0){l=30620+(d[31076+r>>0]|0)|0;p=c[F>>2]|0;m=c[G>>2]|0;n=p>>>8;q=-1;while(1){q=q+1|0;o=_(n,d[l+q>>0]|0)|0;if(m>>>0>=o>>>0)break;else p=o}u=m-o|0;c[G>>2]=u;l=p-o|0;c[F>>2]=l;o=u;while(1){if(l>>>0>=8388609)break;c[B>>2]=(c[B>>2]|0)+8;l=l<<8;c[F>>2]=l;n=c[C>>2]|0;m=c[D>>2]|0;if(m>>>0<(c[E>>2]|0)>>>0){c[D>>2]=m+1;m=d[(c[e>>2]|0)+m>>0]|0}else m=0;c[C>>2]=m;u=((n<<8|m)>>>1&255|o<<8&2147483392)^255;c[G>>2]=u;o=u}u=q&65535;n=r-q&65535;m=k+8|0;l=k+10|0;t=u<<16>>16;if(u<<16>>16>0){o=30468+(d[31076+t>>0]|0)|0;s=c[F>>2]|0;p=c[G>>2]|0;q=s>>>8;u=-1;while(1){u=u+1|0;r=_(q,d[o+u>>0]|0)|0;if(p>>>0>=r>>>0)break;else s=r}q=p-r|0;c[G>>2]=q;o=s-r|0;c[F>>2]=o;r=q;while(1){if(o>>>0>=8388609)break;c[B>>2]=(c[B>>2]|0)+8;o=o<<8;c[F>>2]=o;q=c[C>>2]|0;p=c[D>>2]|0;if(p>>>0<(c[E>>2]|0)>>>0){c[D>>2]=p+1;p=d[(c[e>>2]|0)+p>>0]|0}else p=0;c[C>>2]=p;s=((q<<8|p)>>>1&255|r<<8&2147483392)^255;c[G>>2]=s;r=s}b[m>>1]=u;m=t-u&65535}else y=91}else{m=k+8|0;l=k+10|0;n=0;y=91}if((y|0)==91){y=0;b[m>>1]=0;m=0}b[l>>1]=m;r=k+12|0;t=k+14|0;s=n<<16>>16;if(n<<16>>16>0){l=30468+(d[31076+s>>0]|0)|0;p=c[F>>2]|0;m=c[G>>2]|0;n=p>>>8;q=-1;while(1){q=q+1|0;o=_(n,d[l+q>>0]|0)|0;if(m>>>0>=o>>>0)break;else p=o}u=m-o|0;c[G>>2]=u;l=p-o|0;c[F>>2]=l;o=u;while(1){if(l>>>0>=8388609)break;c[B>>2]=(c[B>>2]|0)+8;l=l<<8;c[F>>2]=l;n=c[C>>2]|0;m=c[D>>2]|0;if(m>>>0<(c[E>>2]|0)>>>0){c[D>>2]=m+1;m=d[(c[e>>2]|0)+m>>0]|0}else m=0;c[C>>2]=m;u=((n<<8|m)>>>1&255|o<<8&2147483392)^255;c[G>>2]=u;o=u}b[r>>1]=q;l=s-q&65535}else{b[r>>1]=0;l=0}b[t>>1]=l;r=v<<16>>16;if(w<<16>>16>0){l=30772+(d[31076+r>>0]|0)|0;p=c[F>>2]|0;m=c[G>>2]|0;n=p>>>8;q=-1;while(1){q=q+1|0;o=_(n,d[l+q>>0]|0)|0;if(m>>>0>=o>>>0)break;else p=o}w=m-o|0;c[G>>2]=w;l=p-o|0;c[F>>2]=l;o=w;while(1){if(l>>>0>=8388609)break;c[B>>2]=(c[B>>2]|0)+8;l=l<<8;c[F>>2]=l;n=c[C>>2]|0;m=c[D>>2]|0;if(m>>>0<(c[E>>2]|0)>>>0){c[D>>2]=m+1;m=d[(c[e>>2]|0)+m>>0]|0}else m=0;c[C>>2]=m;w=((n<<8|m)>>>1&255|o<<8&2147483392)^255;c[G>>2]=w;o=w}w=q&65535;l=r-q&65535;r=w<<16>>16;if(w<<16>>16>0){m=30620+(d[31076+r>>0]|0)|0;q=c[F>>2]|0;n=c[G>>2]|0;o=q>>>8;s=-1;while(1){s=s+1|0;p=_(o,d[m+s>>0]|0)|0;if(n>>>0>=p>>>0)break;else q=p}w=n-p|0;c[G>>2]=w;m=q-p|0;c[F>>2]=m;p=w;while(1){if(m>>>0>=8388609)break;c[B>>2]=(c[B>>2]|0)+8;m=m<<8;c[F>>2]=m;o=c[C>>2]|0;n=c[D>>2]|0;if(n>>>0<(c[E>>2]|0)>>>0){c[D>>2]=n+1;n=d[(c[e>>2]|0)+n>>0]|0}else n=0;c[C>>2]=n;w=((o<<8|n)>>>1&255|p<<8&2147483392)^255;c[G>>2]=w;p=w}w=s&65535;o=r-s&65535;t=k+16|0;m=k+18|0;u=w<<16>>16;if(w<<16>>16>0){n=30468+(d[31076+u>>0]|0)|0;s=c[F>>2]|0;p=c[G>>2]|0;q=s>>>8;v=-1;while(1){v=v+1|0;r=_(q,d[n+v>>0]|0)|0;if(p>>>0>=r>>>0)break;else s=r}w=p-r|0;c[G>>2]=w;n=s-r|0;c[F>>2]=n;r=w;while(1){if(n>>>0>=8388609)break;c[B>>2]=(c[B>>2]|0)+8;n=n<<8;c[F>>2]=n;q=c[C>>2]|0;p=c[D>>2]|0;if(p>>>0<(c[E>>2]|0)>>>0){c[D>>2]=p+1;p=d[(c[e>>2]|0)+p>>0]|0}else p=0;c[C>>2]=p;w=((q<<8|p)>>>1&255|r<<8&2147483392)^255;c[G>>2]=w;r=w}b[t>>1]=v;n=u-v&65535;u=l}else{n=t;y=128}}else y=118}else{l=0;y=118}if((y|0)==118){n=k+16|0;m=k+18|0;o=0;y=128}if((y|0)==128){y=0;b[n>>1]=0;n=0;u=l}b[m>>1]=n;r=k+20|0;t=k+22|0;s=o<<16>>16;if(o<<16>>16>0){l=30468+(d[31076+s>>0]|0)|0;p=c[F>>2]|0;m=c[G>>2]|0;n=p>>>8;q=-1;while(1){q=q+1|0;o=_(n,d[l+q>>0]|0)|0;if(m>>>0>=o>>>0)break;else p=o}w=m-o|0;c[G>>2]=w;l=p-o|0;c[F>>2]=l;o=w;while(1){if(l>>>0>=8388609)break;c[B>>2]=(c[B>>2]|0)+8;l=l<<8;c[F>>2]=l;n=c[C>>2]|0;m=c[D>>2]|0;if(m>>>0<(c[E>>2]|0)>>>0){c[D>>2]=m+1;m=d[(c[e>>2]|0)+m>>0]|0}else m=0;c[C>>2]=m;w=((n<<8|m)>>>1&255|o<<8&2147483392)^255;c[G>>2]=w;o=w}b[r>>1]=q;l=s-q&65535}else{b[r>>1]=0;l=0}b[t>>1]=l;r=u<<16>>16;if(u<<16>>16>0){l=30620+(d[31076+r>>0]|0)|0;p=c[F>>2]|0;m=c[G>>2]|0;n=p>>>8;q=-1;while(1){q=q+1|0;o=_(n,d[l+q>>0]|0)|0;if(m>>>0>=o>>>0)break;else p=o}w=m-o|0;c[G>>2]=w;l=p-o|0;c[F>>2]=l;o=w;while(1){if(l>>>0>=8388609)break;c[B>>2]=(c[B>>2]|0)+8;l=l<<8;c[F>>2]=l;n=c[C>>2]|0;m=c[D>>2]|0;if(m>>>0<(c[E>>2]|0)>>>0){c[D>>2]=m+1;m=d[(c[e>>2]|0)+m>>0]|0}else m=0;c[C>>2]=m;w=((n<<8|m)>>>1&255|o<<8&2147483392)^255;c[G>>2]=w;o=w}w=q&65535;n=r-q&65535;m=k+24|0;l=k+26|0;t=w<<16>>16;if(w<<16>>16>0){o=30468+(d[31076+t>>0]|0)|0;s=c[F>>2]|0;p=c[G>>2]|0;q=s>>>8;u=-1;while(1){u=u+1|0;r=_(q,d[o+u>>0]|0)|0;if(p>>>0>=r>>>0)break;else s=r}w=p-r|0;c[G>>2]=w;o=s-r|0;c[F>>2]=o;r=w;while(1){if(o>>>0>=8388609)break;c[B>>2]=(c[B>>2]|0)+8;o=o<<8;c[F>>2]=o;q=c[C>>2]|0;p=c[D>>2]|0;if(p>>>0<(c[E>>2]|0)>>>0){c[D>>2]=p+1;p=d[(c[e>>2]|0)+p>>0]|0}else p=0;c[C>>2]=p;w=((q<<8|p)>>>1&255|r<<8&2147483392)^255;c[G>>2]=w;r=w}b[m>>1]=u;m=t-u&65535}else y=157}else{m=k+24|0;l=k+26|0;n=0;y=157}if((y|0)==157){y=0;b[m>>1]=0;m=0}b[l>>1]=m;r=k+28|0;s=k+30|0;q=n<<16>>16;if(n<<16>>16>0){k=30468+(d[31076+q>>0]|0)|0;o=c[F>>2]|0;l=c[G>>2]|0;m=o>>>8;p=-1;while(1){p=p+1|0;n=_(m,d[k+p>>0]|0)|0;if(l>>>0>=n>>>0)break;else o=n}w=l-n|0;c[G>>2]=w;k=o-n|0;c[F>>2]=k;n=w;while(1){if(k>>>0>=8388609)break;c[B>>2]=(c[B>>2]|0)+8;k=k<<8;c[F>>2]=k;m=c[C>>2]|0;l=c[D>>2]|0;if(l>>>0<(c[E>>2]|0)>>>0){c[D>>2]=l+1;l=d[(c[e>>2]|0)+l>>0]|0}else l=0;c[C>>2]=l;w=((m<<8|l)>>>1&255|n<<8&2147483392)^255;c[G>>2]=w;n=w}b[r>>1]=p;k=q-p&65535}else{b[r>>1]=0;k=0}b[s>>1]=k}else{l=k+32|0;do{b[k>>1]=0;k=k+2|0}while((k|0)<(l|0))}x=x+1|0}while(1){if((s|0)>=(z|0))break;o=c[A+(s<<2)>>2]|0;if((o|0)>0){p=f+(s<<16>>12<<1)|0;u=0;while(1){if((u|0)==16)break;q=p+(u<<1)|0;r=b[q>>1]|0;t=0;while(1){if((t|0)==(o|0))break;n=c[F>>2]|0;k=c[G>>2]|0;l=n>>>8;v=-1;while(1){v=v+1|0;m=_(l,d[29928+v>>0]|0)|0;if(k>>>0>=m>>>0)break;else n=m}y=k-m|0;c[G>>2]=y;k=n-m|0;c[F>>2]=k;n=y;while(1){if(k>>>0>=8388609)break;c[B>>2]=(c[B>>2]|0)+8;k=k<<8;c[F>>2]=k;m=c[C>>2]|0;l=c[D>>2]|0;if(l>>>0<(c[E>>2]|0)>>>0){c[D>>2]=l+1;l=d[(c[e>>2]|0)+l>>0]|0}else l=0;c[C>>2]=l;y=((m<<8|l)>>>1&255|n<<8&2147483392)^255;c[G>>2]=y;n=y}r=(r<<1)+v|0;t=t+1|0}b[q>>1]=r;u=u+1|0}y=I+(s<<2)|0;c[y>>2]=c[y>>2]|o<<5}s=s+1|0}a[H+1>>0]=0;t=31093+(((g<<1)+h<<16>>16)*7|0)|0;r=j+8>>4;s=0;while(1){if((s|0)>=(r|0))break;k=c[I+(s<<2)>>2]|0;b:do if((k|0)>0){a[H>>0]=a[t+((k&30)>>>0<6?k&31:6)>>0]|0;p=0;while(1){if((p|0)==16)break b;o=f+(p<<1)|0;if((b[o>>1]|0)>0){n=c[F>>2]|0;k=c[G>>2]|0;l=n>>>8;q=-1;while(1){q=q+1|0;m=_(l,d[H+q>>0]|0)|0;if(k>>>0>=m>>>0)break;else n=m}j=k-m|0;c[G>>2]=j;k=n-m|0;c[F>>2]=k;n=j;while(1){if(k>>>0>=8388609)break;c[B>>2]=(c[B>>2]|0)+8;k=k<<8;c[F>>2]=k;m=c[C>>2]|0;l=c[D>>2]|0;if(l>>>0<(c[E>>2]|0)>>>0){c[D>>2]=l+1;l=d[(c[e>>2]|0)+l>>0]|0}else l=0;c[C>>2]=l;j=((m<<8|l)>>>1&255|n<<8&2147483392)^255;c[G>>2]=j;n=j}b[o>>1]=_(b[o>>1]|0,(q<<1)+-1|0)|0}p=p+1|0}}while(0);s=s+1|0;f=f+32|0}i=J;return} - function ge(b,e,f,g,h){b=b|0;e=e|0;f=f|0;g=g|0;h=h|0;var i=0,j=0,k=0,l=0,m=0,n=0;n=0;while(1){if((n|0)>=(h|0))break;m=e+(n<<2)|0;i=c[m>>2]|0;l=aa(i|0)|0;j=24-l|0;k=0-j|0;do if(j)if((j|0)<0){i=i<>>(j+32|0);break}else{i=i<<32-j|i>>>j;break}while(0);k=i&127;k=(((k+(((_(k,128-k|0)|0)*179|0)>>>16)+(31-l<<7)<<16)+-136970240>>16)*2251|0)>>>16;i=k&255;l=b+n|0;a[l>>0]=i;if((k<<24>>24|0)<(a[f>>0]|0)){i=i+1<<24>>24;a[l>>0]=i}if(i<<24>>24>63)i=63;else i=(i<<24>>24>0?i:0)<<24>>24;a[l>>0]=i;if(!(n|g)){i=(a[f>>0]|0)+-4|0;j=a[b>>0]|0;if((i|0)>63){if((j<<24>>24|0)<=(i|0))i=(j<<24>>24>63?j:63)<<24>>24}else if(j<<24>>24>63)i=63;else{l=j<<24>>24;i=(l|0)<(i|0)?i:l}i=i&255;a[b>>0]=i;a[f>>0]=i}else{j=(i&255)-(d[f>>0]|0)|0;i=j&255;a[l>>0]=i;k=(a[f>>0]|0)+8|0;j=j<<24>>24;if((j|0)>(k|0)){i=k+((j-k+1|0)>>>1)&255;a[l>>0]=i}if(i<<24>>24>36)i=36;else i=(i<<24>>24>-4?i:-4)<<24>>24;a[l>>0]=i;if((i|0)>(k|0))i=(a[f>>0]|0)+((i<<1)-k)|0;else i=(d[f>>0]|0)+(i&255)|0;a[f>>0]=i;a[l>>0]=(d[l>>0]|0)+4;i=a[f>>0]|0}i=i<<24>>24;i=(i*29|0)+(i*7281>>16)|0;k=i+2090|0;if((k|0)<3967)if((i|0)<-2090)i=0;else{i=k>>7;l=1<>16)<>7;else i=_(l>>7,j+((_(_(j,128-j|0)|0,-174)|0)>>16)|0)|0;i=l+i|0}else i=2147483647;c[m>>2]=i;n=n+1|0}return}function he(b,d,e,f,g){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,l=0;l=0;while(1){if((l|0)>=(g|0))break;do if(l|f){h=(a[d+l>>0]|0)+-4|0;i=a[e>>0]|0;j=i<<24>>24;k=j+8|0;if((h|0)>(k|0)){i=j+((h<<1)-k)|0;break}else{i=(i&255)+h|0;break}}else{k=a[d>>0]|0;i=(a[e>>0]|0)+-16|0;i=(k|0)>(i|0)?k:i}while(0);h=i&255;a[e>>0]=h;if(h<<24>>24<=63)if(h<<24>>24<0)h=0;else h=i<<24>>24;else h=63;a[e>>0]=h;h=(h*29|0)+(h*7281>>16)|0;j=h+2090|0;if((j|0)<3967)if((h|0)<-2090)h=0;else{h=j>>7;k=1<>16)<>7;else h=_(k>>7,i+((_(_(i,128-i|0)|0,-174)|0)>>16)|0)|0;h=k+h|0}else h=2147483647;c[b+(l<<2)>>2]=h;l=l+1|0}return}function ie(e,f,g){e=e|0;f=f|0;g=g|0;var h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0;t=i;i=i+80|0;q=t+64|0;s=t;Cd(t+32|0,q,g,a[f>>0]|0);m=f+1|0;n=b[g+4>>1]|0;r=g+2|0;h=b[r>>1]|0;o=h<<16>>16;j=o;k=0;while(1){p=j+-1|0;if((j|0)<=0)break;l=(_(k<<16>>16,d[q+p>>0]|0)|0)>>8;j=a[m+p>>0]|0;k=j<<24>>24<<10;if(j<<24>>24>0)j=k+-102|0;else j=j<<24>>24<0?k|102:k;k=l+((_(j>>16,n)|0)+((_(j&65535,n)|0)>>16))|0;b[s+(p<<1)>>1]=k;j=p}l=_(a[f>>0]|0,o)|0;k=(c[g+8>>2]|0)+l|0;l=(c[g+12>>2]|0)+(l<<1)|0;j=0;while(1){h=h<<16>>16;if((j|0)>=(h|0))break;h=((b[s+(j<<1)>>1]<<14|0)/(b[l+(j<<1)>>1]|0)|0)+(d[k+j>>0]<<7)|0;b[e+(j<<1)>>1]=(h|0)>32767?32767:((h|0)<0?0:h)&65535;h=b[r>>1]|0;j=j+1|0}ve(e,c[g+36>>2]|0,h);i=t;return}function je(d,e,f,g,h,j,k,l,m,n,o,p,q,r,s){d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;k=k|0;l=l|0;m=m|0;n=n|0;o=o|0;p=p|0;q=q|0;r=r|0;s=s|0;var t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,$=0,ba=0,ca=0,da=0,ea=0,fa=0,ga=0,ha=0,ia=0,ja=0,ka=0,la=0,ma=0,na=0,oa=0,pa=0,qa=0,ra=0,sa=0,ta=0,ua=0,va=0,wa=0,xa=0,ya=0,za=0,Aa=0,Ba=0,Ca=0,Da=0,Ea=0,Fa=0,Ga=0,Ha=0,Ia=0,Ja=0,Ka=0,La=0,Ma=0,Na=0,Oa=0,Pa=0,Qa=0,Ra=0,Sa=0,Ta=0,Ua=0,Va=0,Wa=0,Xa=0,Ya=0,Za=0,_a=0,$a=0,ab=0,bb=0;ab=i;Za=e+4436|0;c[Za>>2]=a[f+34>>0];_a=e+4424|0;sa=c[_a>>2]|0;Wa=b[f+30>>1]|0;Ja=f+29|0;Ka=b[25404+(a[Ja>>0]>>1<<2)+((Wa&65535)<<24>>24<<1)>>1]|0;Wa=(Wa&-256)<<16>>16!=1024&1;La=d+4684|0;ra=c[La>>2]|0;Ma=d+4676|0;Pa=ra+(c[Ma>>2]|0)|0;Na=i;i=i+((1*(Pa<<2)|0)+15&-16)|0;Oa=i;i=i+((1*(Pa<<1)|0)+15&-16)|0;Pa=d+4680|0;Qa=i;i=i+((1*(c[Pa>>2]<<2)|0)+15&-16)|0;Ra=e+4432|0;c[Ra>>2]=ra;ra=c[La>>2]|0;Sa=e+4428|0;c[Sa>>2]=ra;Ta=d+4672|0;Ua=Wa^1;Va=e+4444|0;Wa=Wa<<1^3;Xa=d+4732|0;Ya=e+4440|0;Ba=d+4728|0;Ca=e+3996|0;Da=e+4420|0;Ea=e+4320|0;Fa=e+4416|0;Ga=(r|0)>2048;Ia=(r|0)/2|0;Ha=Ia+-512|0;Ia=512-Ia|0;ua=r<<16>>16;va=Ka+944|0;wa=_(Ka,ua)|0;xa=_(va<<16>>16,ua)|0;ya=Ka+-944|0;za=_(944-Ka<<16>>16,ua)|0;Aa=e+3840|0;ta=s<<16>>16;d=ra;ra=0;r=sa;sa=e+(c[La>>2]<<1)|0;while(1){f=c[Ta>>2]|0;if((ra|0)>=(f|0))break;oa=j+((ra>>1|Ua)<<4<<1)|0;pa=k+(ra*5<<1)|0;qa=l+(ra*24<<1)|0;D=c[m+(ra<<2)>>2]|0;B=D>>2;D=B|D<<15;c[Va>>2]=0;f=a[Ja>>0]|0;s=q+(ra<<2)|0;if(f<<24>>24==2){f=c[s>>2]|0;if(!(ra&Wa)){z=c[La>>2]|0;d=c[Xa>>2]|0;w=z-f-d+-2|0;se(Oa+(w<<1)|0,e+(w+(_(ra,c[Pa>>2]|0)|0)<<1)|0,oa,z-w|0,d);c[Va>>2]=1;d=c[La>>2]|0;c[Sa>>2]=d;w=1;z=a[Ja>>0]|0;r=f}else{w=0;z=2;r=f}}else{w=0;z=f}y=c[s>>2]|0;A=p+(ra<<2)|0;x=c[A>>2]|0;s=(x|0)>1;f=aa((s?x:1)|0)|0;s=(s?x:1)<>16;u=536870911/(la|0)|0;ma=u<<16;na=ma>>16;s=536870912-((_(la,na)|0)+((_(s&65535,na)|0)>>16))<<3;u=ma+((_(s>>16,na)|0)+((_(s&65528,na)|0)>>16))+(_(s,(u>>15)+1>>1)|0)|0;f=62-f|0;s=f+-47|0;if((s|0)<1){t=47-f|0;f=-2147483648>>t;s=2147483647>>>t;if((f|0)>(s|0)){if((u|0)<=(f|0))f=(u|0)<(s|0)?s:u}else if((u|0)>(s|0))f=s;else f=(u|0)<(f|0)?f:u;f=f<>s:0;t=(f>>4)+1|0;s=t>>>1<<16>>16;t=(t>>16)+1>>1;v=c[Pa>>2]|0;u=0;while(1){if((u|0)>=(v|0))break;ma=b[g+(u<<1)>>1]|0;na=ma<<16>>16;c[Qa+(u<<2)>>2]=(_(na>>16,s)|0)+((_(ma&65535,s)|0)>>16)+(_(na,t)|0);u=u+1|0}a:do if(w|0){if(!ra)f=(_(f>>16,ta)|0)+((_(f&65535,ta)|0)>>16)<<2;t=f>>16;f=f&65535;s=d-y+-2|0;while(1){if((s|0)>=(d|0))break a;na=b[Oa+(s<<1)>>1]|0;c[Na+(s<<2)>>2]=(_(t,na)|0)+((_(f,na)|0)>>16);s=s+1|0}}while(0);s=c[Ya>>2]|0;if((x|0)==(s|0))f=z;else{if((s|0)<=0)if(!s)t=32;else{f=0-s|0;$a=26}else{f=s;$a=26}if(($a|0)==26){$a=0;t=aa(f|0)|0}d=s<>16|0)|0)<<16>>16;na=(_(d>>16,u)|0)+((_(d&65535,u)|0)>>16)|0;ma=zf(ma|0,((ma|0)<0)<<31>>31|0,na|0,((na|0)<0)<<31>>31|0)|0;ma=qf(ma|0,C|0,29)|0;d=d-(ma&-8)|0;u=na+((_(d>>16,u)|0)+((_(d&65535,u)|0)>>16))|0;f=t+28-f|0;d=f+-16|0;if((f|0)<16){s=16-f|0;f=-2147483648>>s;d=2147483647>>>s;if((f|0)>(d|0)){if((u|0)<=(f|0))f=(u|0)<(d|0)?d:u}else if((u|0)>(d|0))f=d;else f=(u|0)<(f|0)?f:u;s=f<>d:0;d=c[Ra>>2]|0;t=s>>16;u=s&65535;f=d;d=d-(c[La>>2]|0)|0;while(1){if((d|0)>=(f|0))break;f=e+1280+(d<<2)|0;na=c[f>>2]|0;ma=na<<16>>16;c[f>>2]=(_(t,ma)|0)+((_(u,ma)|0)>>16)+(_(s,(na>>15)+1>>1)|0);f=c[Ra>>2]|0;d=d+1|0}b:do if(z<<24>>24==2?(c[Va>>2]|0)==0:0){d=c[Sa>>2]|0;f=d-y+-2|0;while(1){if((f|0)>=(d|0))break b;na=Na+(f<<2)|0;ma=c[na>>2]|0;la=ma<<16>>16;c[na>>2]=(_(t,la)|0)+((_(u,la)|0)>>16)+(_(s,(ma>>15)+1>>1)|0);f=f+1|0}}while(0);f=c[Fa>>2]|0;na=f<<16>>16;c[Fa>>2]=(_(t,na)|0)+((_(u,na)|0)>>16)+(_(s,(f>>15)+1>>1)|0);f=c[Da>>2]|0;na=f<<16>>16;c[Da>>2]=(_(t,na)|0)+((_(u,na)|0)>>16)+(_(s,(f>>15)+1>>1)|0);f=0;while(1){if((f|0)==40){f=0;break}na=e+3840+(f<<2)|0;ma=c[na>>2]|0;la=ma<<16>>16;c[na>>2]=(_(t,la)|0)+((_(u,la)|0)>>16)+(_(s,(ma>>15)+1>>1)|0);f=f+1|0}while(1){if((f|0)==24)break;na=e+4320+(f<<2)|0;ma=c[na>>2]|0;la=ma<<16>>16;c[na>>2]=(_(t,la)|0)+((_(u,la)|0)>>16)+(_(s,(ma>>15)+1>>1)|0);f=f+1|0}c[Ya>>2]=c[A>>2];d=c[Sa>>2]|0;x=c[A>>2]|0;f=a[Ja>>0]|0;v=c[Pa>>2]|0}U=c[o+(ra<<2)>>2]|0;W=c[Ba>>2]|0;ha=c[Xa>>2]|0;X=ha>>1;Y=oa+2|0;Z=oa+4|0;$=oa+6|0;ba=oa+8|0;ca=oa+10|0;da=oa+12|0;ea=oa+14|0;fa=oa+16|0;ga=oa+18|0;ha=(ha|0)==16;ia=oa+20|0;ja=oa+22|0;ka=oa+24|0;la=oa+26|0;ma=oa+28|0;na=oa+30|0;K=f<<24>>24==2;L=pa+2|0;M=pa+4|0;N=pa+6|0;O=pa+8|0;P=W>>1;R=W+-1|0;Q=e+4320+(R<<2)|0;R=qa+(R<<1)|0;S=c[n+(ra<<2)>>2]<<16>>16;T=U<<16>>16;U=U>>16;V=(r|0)>0;J=B<<16>>16;H=D>>16;I=x>>>6<<16>>16;F=(x>>21)+1>>1;f=d;G=0;d=Na+(d-r+2<<2)|0;E=Ca;u=e+1280+((c[Ra>>2]|0)-r+1<<2)|0;while(1){if((G|0)>=(v|0))break;c[Za>>2]=(_(c[Za>>2]|0,196314165)|0)+907633515;D=c[E>>2]|0;B=b[oa>>1]|0;B=X+((_(D>>16,B)|0)+((_(D&65535,B)|0)>>16))|0;D=c[E+-4>>2]|0;f=b[Y>>1]|0;f=B+((_(D>>16,f)|0)+((_(D&65535,f)|0)>>16))|0;D=c[E+-8>>2]|0;B=b[Z>>1]|0;B=f+((_(D>>16,B)|0)+((_(D&65535,B)|0)>>16))|0;D=c[E+-12>>2]|0;f=b[$>>1]|0;f=B+((_(D>>16,f)|0)+((_(D&65535,f)|0)>>16))|0;D=c[E+-16>>2]|0;B=b[ba>>1]|0;B=f+((_(D>>16,B)|0)+((_(D&65535,B)|0)>>16))|0;D=c[E+-20>>2]|0;f=b[ca>>1]|0;f=B+((_(D>>16,f)|0)+((_(D&65535,f)|0)>>16))|0;D=c[E+-24>>2]|0;B=b[da>>1]|0;B=f+((_(D>>16,B)|0)+((_(D&65535,B)|0)>>16))|0;D=c[E+-28>>2]|0;f=b[ea>>1]|0;f=B+((_(D>>16,f)|0)+((_(D&65535,f)|0)>>16))|0;D=c[E+-32>>2]|0;B=b[fa>>1]|0;B=f+((_(D>>16,B)|0)+((_(D&65535,B)|0)>>16))|0;D=c[E+-36>>2]|0;f=b[ga>>1]|0;f=B+((_(D>>16,f)|0)+((_(D&65535,f)|0)>>16))|0;if(ha){D=c[E+-40>>2]|0;B=b[ia>>1]|0;B=f+((_(D>>16,B)|0)+((_(D&65535,B)|0)>>16))|0;D=c[E+-44>>2]|0;f=b[ja>>1]|0;f=B+((_(D>>16,f)|0)+((_(D&65535,f)|0)>>16))|0;D=c[E+-48>>2]|0;B=b[ka>>1]|0;B=f+((_(D>>16,B)|0)+((_(D&65535,B)|0)>>16))|0;D=c[E+-52>>2]|0;f=b[la>>1]|0;f=B+((_(D>>16,f)|0)+((_(D&65535,f)|0)>>16))|0;D=c[E+-56>>2]|0;B=b[ma>>1]|0;B=f+((_(D>>16,B)|0)+((_(D&65535,B)|0)>>16))|0;D=c[E+-60>>2]|0;f=b[na>>1]|0;f=B+((_(D>>16,f)|0)+((_(D&65535,f)|0)>>16))|0}if(K){D=c[d>>2]|0;B=b[pa>>1]|0;B=(_(D>>16,B)|0)+((_(D&65535,B)|0)>>16)+2|0;D=c[d+-4>>2]|0;A=b[L>>1]|0;A=B+((_(D>>16,A)|0)+((_(D&65535,A)|0)>>16))|0;D=c[d+-8>>2]|0;B=b[M>>1]|0;B=A+((_(D>>16,B)|0)+((_(D&65535,B)|0)>>16))|0;D=c[d+-12>>2]|0;A=b[N>>1]|0;A=B+((_(D>>16,A)|0)+((_(D&65535,A)|0)>>16))|0;D=c[d+-16>>2]|0;B=b[O>>1]|0;B=A+((_(D>>16,B)|0)+((_(D&65535,B)|0)>>16))|0;D=d+4|0}else{B=0;D=d}A=c[Da>>2]|0;t=c[Ea>>2]|0;c[Ea>>2]=A;s=b[qa>>1]|0;d=2;s=P+((_(A>>16,s)|0)+((_(A&65535,s)|0)>>16))|0;while(1){if((d|0)>=(W|0))break;x=d+-1|0;z=e+4320+(x<<2)|0;y=c[z>>2]|0;c[z>>2]=t;x=b[qa+(x<<1)>>1]|0;z=e+4320+(d<<2)|0;A=c[z>>2]|0;c[z>>2]=y;x=x<<16>>16;z=b[qa+(d<<1)>>1]|0;d=d+2|0;s=s+((_(t>>16,x)|0)+((_(t&65535,x)|0)>>16))+((_(y>>16,z)|0)+((_(y&65535,z)|0)>>16))|0;t=A}c[Q>>2]=t;y=b[R>>1]|0;y=s+((_(t>>16,y)|0)+((_(t&65535,y)|0)>>16))<<1;z=c[Fa>>2]|0;d=z>>16;z=z&65535;y=y+((_(d,S)|0)+((_(z,S)|0)>>16))|0;A=c[e+1280+((c[Ra>>2]|0)+-1<<2)>>2]|0;z=(_(A>>16,T)|0)+((_(A&65535,T)|0)>>16)+(_(d,U)|0)+((_(z,U)|0)>>16)|0;d=(f<<2)-y-z|0;if(V){w=(c[u>>2]|0)+(c[u+-8>>2]|0)|0;w=(_(w>>16,J)|0)+((_(w&65535,J)|0)>>16)|0;x=c[u+-4>>2]|0;A=u+4|0;d=B-(w+(_(x>>16,H)|0)+((_(x&65535,H)|0)>>16)<<1)+(d<<1)>>2}else{A=u;d=d>>1}x=Qa+(G<<2)|0;w=(c[x>>2]|0)-(d+1>>1)|0;w=(c[Za>>2]|0)<0?0-w|0:w;w=(w|0)>30720?30720:(w|0)<-31744?-31744:w;d=w-Ka|0;do if(Ga){if((d|0)>(Ha|0)){d=d-Ha|0;$a=70;break}if((d|0)>=(Ia|0))if((d|0)<0){$a=73;break}else{d=Ka;s=va;t=wa;u=xa;break}else{d=d+Ha|0;$a=70;break}}else $a=70;while(0);c:do if(($a|0)==70){$a=0;d=d>>10;if((d|0)>0){t=(d<<10)+-80+Ka|0;u=t+1024|0;d=t;s=u;t=_(t<<16>>16,ua)|0;u=_(u<<16>>16,ua)|0;break}switch(d|0){case 0:{d=Ka;s=va;t=wa;u=xa;break c}case -1:{$a=73;break c}default:{}}u=(d<<10|80)+Ka|0;d=u;s=u+1024|0;t=_(0-u<<16>>16,ua)|0;u=_(-1024-u<<16>>16,ua)|0}while(0);if(($a|0)==73){$a=0;d=ya;s=Ka;t=za;u=wa}bb=w-d<<16>>16;w=w-s<<16>>16;u=(u+(_(w,w)|0)|0)<(t+(_(bb,bb)|0)|0);u=u?s:d;d=h+G|0;a[d>>0]=((u>>>9)+1|0)>>>1;u=u<<4;B=((c[Za>>2]|0)<0?0-u|0:u)+(B<<1)|0;f=B+(f<<4)|0;u=((_(f>>16,I)|0)+((_(f&65534,I)|0)>>16)+(_(f,F)|0)>>7)+1>>1;b[sa+(G<<1)>>1]=(u|0)>32767?32767:((u|0)<-32768?-32768:u)&65535;u=E+4|0;c[u>>2]=f;f=f-(c[x>>2]<<4)|0;c[Da>>2]=f;f=f-(y<<2)|0;c[Fa>>2]=f;c[e+1280+(c[Ra>>2]<<2)>>2]=f-(z<<2);f=c[Sa>>2]|0;c[Na+(f<<2)>>2]=B<<1;c[Ra>>2]=(c[Ra>>2]|0)+1;f=f+1|0;c[Sa>>2]=f;c[Za>>2]=(c[Za>>2]|0)+(a[d>>0]|0);G=G+1|0;d=D;E=u;u=A}rf(Aa|0,e+3840+(v<<2)|0,160)|0;bb=c[Pa>>2]|0;g=g+(bb<<1)|0;h=h+bb|0;d=f;ra=ra+1|0;sa=sa+(bb<<1)|0}c[_a>>2]=c[q+(f+-1<<2)>>2];sf(e|0,e+(c[Ma>>2]<<1)|0,c[La>>2]<<1|0)|0;sf(e+1280|0,e+1280+(c[Ma>>2]<<2)|0,c[La>>2]<<2|0)|0;i=ab;return}function ke(e,f,g,h,j,k,l,m,n,o,p,q,r,s,t){e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;k=k|0;l=l|0;m=m|0;n=n|0;o=o|0;p=p|0;q=q|0;r=r|0;s=s|0;t=t|0;var u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,$=0,ba=0,ca=0,da=0,ea=0,fa=0,ga=0,ha=0,ia=0,ja=0,ka=0,la=0,ma=0,na=0,oa=0,pa=0,qa=0,ra=0,sa=0,ta=0,ua=0;sa=i;i=i+176|0;ka=sa+160|0;ga=sa;la=f+4424|0;A=c[la>>2]|0;ea=e+4720|0;u=c[ea>>2]|0;oa=i;i=i+((1*(u*1396|0)|0)+15&-16)|0;nf(oa|0,0,u*1396|0)|0;ja=g+34|0;pa=f+4416|0;qa=f+4420|0;ra=e+4684|0;ma=f+3840|0;na=f+4320|0;v=0;while(1){if((v|0)>=(u|0))break;w=v+(d[ja>>0]|0)&3;c[oa+(v*1396|0)+1384>>2]=w;c[oa+(v*1396|0)+1388>>2]=w;c[oa+(v*1396|0)+1392>>2]=0;c[oa+(v*1396|0)+1376>>2]=c[pa>>2];c[oa+(v*1396|0)+1380>>2]=c[qa>>2];c[oa+(v*1396|0)+1120>>2]=c[f+1280+((c[ra>>2]|0)+-1<<2)>>2];rf(oa+(v*1396|0)|0,ma|0,160)|0;w=oa+(v*1396|0)+1280|0;y=na;z=w+96|0;do{c[w>>2]=c[y>>2];w=w+4|0;y=y+4|0}while((w|0)<(z|0));v=v+1|0}w=b[g+30>>1]|0;Z=g+29|0;fa=a[Z>>0]|0;$=b[25404+(fa<<24>>24>>1<<2)+((w&65535)<<24>>24<<1)>>1]|0;c[ka>>2]=0;ia=e+4680|0;x=c[ia>>2]|0;u=(x|0)>40?40:x;a:do if(fa<<24>>24!=2)if((A|0)>0){ca=A+-3|0;ca=(u|0)<(ca|0)?u:ca}else ca=u;else{g=c[e+4672>>2]|0;v=0;while(1){if((v|0)>=(g|0)){ca=u;break a}fa=(c[r+(v<<2)>>2]|0)+-3|0;u=(u|0)<(fa|0)?u:fa;v=v+1|0}}while(0);P=(w&-256)<<16>>16!=1024&1;Y=c[ra>>2]|0;fa=e+4676|0;W=Y+(c[fa>>2]|0)|0;U=i;i=i+((1*(W<<2)|0)+15&-16)|0;V=i;i=i+((1*(W<<1)|0)+15&-16)|0;W=i;i=i+((1*(x<<2)|0)+15&-16)|0;ba=f+4432|0;c[ba>>2]=Y;M=f+4428|0;c[M>>2]=c[ra>>2];da=e+4672|0;N=P^1;O=f+4444|0;P=P<<1^3;X=oa+1392|0;Q=q+4|0;R=e+4732|0;S=f+4440|0;T=e+4728|0;L=e+4764|0;K=t<<16>>16;J=0;g=A;Y=f+(Y<<1)|0;v=0;while(1){if((J|0)>=(c[da>>2]|0))break;F=k+((J>>1|N)<<4<<1)|0;G=l+(J*5<<1)|0;H=m+(J*24<<1)|0;I=c[n+(J<<2)>>2]|0;I=I>>2|I>>>1<<16;c[O>>2]=0;u=a[Z>>0]|0;y=r+(J<<2)|0;if(u<<24>>24==2){x=c[y>>2]|0;if(!(J&P)){b:do if((J|0)==2){g=c[ea>>2]|0;u=c[X>>2]|0;w=0;v=1;while(1){if((v|0)>=(g|0)){u=0;break}D=c[oa+(v*1396|0)+1392>>2]|0;E=(D|0)<(u|0);u=E?D:u;w=E?v:w;v=v+1|0}while(1){if((u|0)>=(g|0))break;if((u|0)!=(w|0)){E=oa+(u*1396|0)+1392|0;c[E>>2]=(c[E>>2]|0)+134217727}u=u+1|0}u=0;v=(c[ka>>2]|0)+ca|0;while(1){if((u|0)>=(ca|0)){v=0;break b}E=(v+-1|0)%40|0;E=(E|0)<0?E+40|0:E;D=u-ca|0;a[j+D>>0]=(((c[oa+(w*1396|0)+640+(E<<2)>>2]|0)>>>9)+1|0)>>>1;A=c[oa+(w*1396|0)+800+(E<<2)>>2]|0;B=c[Q>>2]|0;t=B<<16>>16;B=((_(A>>16,t)|0)+((_(A&65535,t)|0)>>16)+(_(A,(B>>15)+1>>1)|0)>>13)+1>>1;b[Y+(D<<1)>>1]=(B|0)>32767?32767:((B|0)<-32768?-32768:B)&65535;c[f+1280+((c[ba>>2]|0)-ca+u<<2)>>2]=c[oa+(w*1396|0)+1120+(E<<2)>>2];u=u+1|0;v=E}}while(0);E=c[ra>>2]|0;t=c[R>>2]|0;u=E-x-t+-2|0;se(V+(u<<1)|0,f+(u+(_(J,c[ia>>2]|0)|0)<<1)|0,F,E-u|0,t);c[M>>2]=c[ra>>2];c[O>>2]=1;t=1;u=a[Z>>0]|0;E=x;D=v}else{t=0;u=2;E=x;D=v}}else{t=0;E=g;D=v}v=c[ea>>2]|0;A=c[y>>2]|0;B=q+(J<<2)|0;w=c[B>>2]|0;x=(w|0)>1;g=aa((x?w:1)|0)|0;x=(x?w:1)<>16;z=536870911/(ta|0)|0;y=z<<16;e=y>>16;x=536870912-((_(ta,e)|0)+((_(x&65535,e)|0)>>16))<<3;z=y+((_(x>>16,e)|0)+((_(x&65528,e)|0)>>16))+(_(x,(z>>15)+1>>1)|0)|0;g=62-g|0;x=g+-47|0;if((x|0)<1){y=47-g|0;g=-2147483648>>y;x=2147483647>>>y;if((g|0)>(x|0)){if((z|0)<=(g|0))g=(z|0)<(x|0)?x:z}else if((z|0)>(x|0))g=x;else g=(z|0)<(g|0)?g:z;x=g<>x:0;z=(x>>4)+1|0;y=z>>>1<<16>>16;z=(z>>16)+1>>1;g=c[ia>>2]|0;e=0;while(1){if((e|0)>=(g|0))break;ua=b[h+(e<<1)>>1]|0;ta=ua<<16>>16;c[W+(e<<2)>>2]=(_(ta>>16,y)|0)+((_(ua&65535,y)|0)>>16)+(_(ta,z)|0);e=e+1|0}c:do if(t|0){if(!J)x=(_(x>>16,K)|0)+((_(x&65535,K)|0)>>16)<<2;z=c[M>>2]|0;e=x>>16;x=x&65535;y=z-A+-2|0;while(1){if((y|0)>=(z|0))break c;ua=b[V+(y<<1)>>1]|0;c[U+(y<<2)>>2]=(_(e,ua)|0)+((_(x,ua)|0)>>16);y=y+1|0}}while(0);x=c[S>>2]|0;if((w|0)!=(x|0)){if((x|0)<=0)if(!x)y=32;else{g=0-x|0;ha=46}else{g=x;ha=46}if((ha|0)==46){ha=0;y=aa(g|0)|0}x=x<>16|0)|0)<<16>>16;ua=(_(x>>16,z)|0)+((_(x&65535,z)|0)>>16)|0;w=zf(w|0,((w|0)<0)<<31>>31|0,ua|0,((ua|0)<0)<<31>>31|0)|0;w=qf(w|0,C|0,29)|0;w=x-(w&-8)|0;z=ua+((_(w>>16,z)|0)+((_(w&65535,z)|0)>>16))|0;g=y+28-g|0;w=g+-16|0;if((g|0)<16){x=16-g|0;g=-2147483648>>x;w=2147483647>>>x;if((g|0)>(w|0)){if((z|0)<=(g|0))g=(z|0)<(w|0)?w:z}else if((z|0)>(w|0))g=w;else g=(z|0)<(g|0)?g:z;x=g<>w:0;w=c[ba>>2]|0;y=x>>16;z=x&65535;g=w;w=w-(c[ra>>2]|0)|0;while(1){if((w|0)>=(g|0))break;g=f+1280+(w<<2)|0;ua=c[g>>2]|0;ta=ua<<16>>16;c[g>>2]=(_(y,ta)|0)+((_(z,ta)|0)>>16)+(_(x,(ua>>15)+1>>1)|0);g=c[ba>>2]|0;w=w+1|0}d:do if(u<<24>>24==2?(c[O>>2]|0)==0:0){u=c[M>>2]|0;g=u-ca|0;u=u-A+-2|0;while(1){if((u|0)>=(g|0)){g=0;break d}ua=U+(u<<2)|0;ta=c[ua>>2]|0;A=ta<<16>>16;c[ua>>2]=(_(y,A)|0)+((_(z,A)|0)>>16)+(_(x,(ta>>15)+1>>1)|0);u=u+1|0}}else g=0;while(0);while(1){if((g|0)>=(v|0))break;u=oa+(g*1396|0)+1376|0;ua=c[u>>2]|0;ta=ua<<16>>16;c[u>>2]=(_(y,ta)|0)+((_(z,ta)|0)>>16)+(_(x,(ua>>15)+1>>1)|0);u=oa+(g*1396|0)+1380|0;ua=c[u>>2]|0;ta=ua<<16>>16;c[u>>2]=(_(y,ta)|0)+((_(z,ta)|0)>>16)+(_(x,(ua>>15)+1>>1)|0);u=0;while(1){if((u|0)==40){u=0;break}ua=oa+(g*1396|0)+(u<<2)|0;ta=c[ua>>2]|0;A=ta<<16>>16;c[ua>>2]=(_(y,A)|0)+((_(z,A)|0)>>16)+(_(x,(ta>>15)+1>>1)|0);u=u+1|0}while(1){if((u|0)==24){u=0;break}ua=oa+(g*1396|0)+1280+(u<<2)|0;ta=c[ua>>2]|0;A=ta<<16>>16;c[ua>>2]=(_(y,A)|0)+((_(z,A)|0)>>16)+(_(x,(ta>>15)+1>>1)|0);u=u+1|0}while(1){if((u|0)==40)break;ua=oa+(g*1396|0)+960+(u<<2)|0;ta=c[ua>>2]|0;A=ta<<16>>16;c[ua>>2]=(_(y,A)|0)+((_(z,A)|0)>>16)+(_(x,(ta>>15)+1>>1)|0);ua=oa+(g*1396|0)+1120+(u<<2)|0;ta=c[ua>>2]|0;A=ta<<16>>16;c[ua>>2]=(_(y,A)|0)+((_(z,A)|0)>>16)+(_(x,(ta>>15)+1>>1)|0);u=u+1|0}g=g+1|0}c[S>>2]=c[B>>2];u=a[Z>>0]|0;w=c[B>>2]|0;g=c[ia>>2]|0;v=c[ea>>2]|0}le(f,oa,u<<24>>24,W,j,Y,U,ga,F,G,H,E,I,c[o+(J<<2)>>2]|0,c[p+(J<<2)>>2]|0,w,s,$,g,D,c[T>>2]|0,c[R>>2]|0,c[L>>2]|0,v,ka,ca);v=c[ia>>2]|0;h=h+(v<<1)|0;j=j+v|0;J=J+1|0;g=E;Y=Y+(v<<1)|0;v=D+1|0}g=c[ea>>2]|0;u=c[X>>2]|0;x=0;v=1;while(1){if((v|0)>=(g|0))break;ta=c[oa+(v*1396|0)+1392>>2]|0;ua=(ta|0)<(u|0);u=ua?ta:u;x=ua?v:x;v=v+1|0}a[ja>>0]=c[oa+(x*1396|0)+1388>>2];g=c[q+((c[da>>2]|0)+-1<<2)>>2]|0;v=g>>>6<<16>>16;g=(g>>21)+1>>1;w=0;u=(c[ka>>2]|0)+ca|0;while(1){if((w|0)>=(ca|0))break;ua=(u+-1|0)%40|0;ua=(ua|0)<0?ua+40|0:ua;ta=w-ca|0;a[j+ta>>0]=(((c[oa+(x*1396|0)+640+(ua<<2)>>2]|0)>>>9)+1|0)>>>1;ka=c[oa+(x*1396|0)+800+(ua<<2)>>2]|0;ka=((_(ka>>16,v)|0)+((_(ka&65535,v)|0)>>16)+(_(ka,g)|0)>>7)+1>>1;b[Y+(ta<<1)>>1]=(ka|0)>32767?32767:((ka|0)<-32768?-32768:ka)&65535;c[f+1280+((c[ba>>2]|0)-ca+w<<2)>>2]=c[oa+(x*1396|0)+1120+(ua<<2)>>2];w=w+1|0;u=ua}rf(ma|0,oa+(x*1396|0)+(c[ia>>2]<<2)|0,160)|0;w=na;y=oa+(x*1396|0)+1280|0;z=w+96|0;do{c[w>>2]=c[y>>2];w=w+4|0;y=y+4|0}while((w|0)<(z|0));c[pa>>2]=c[oa+(x*1396|0)+1376>>2];c[qa>>2]=c[oa+(x*1396|0)+1380>>2];c[la>>2]=c[r+((c[da>>2]|0)+-1<<2)>>2];sf(f|0,f+(c[fa>>2]<<1)|0,c[ra>>2]<<1|0)|0;sf(f+1280|0,f+1280+(c[fa>>2]<<2)|0,c[ra>>2]<<2|0)|0;i=sa;return}function le(d,e,f,g,h,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D){d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;k=k|0;l=l|0;m=m|0;n=n|0;o=o|0;p=p|0;q=q|0;r=r|0;s=s|0;t=t|0;u=u|0;v=v|0;w=w|0;x=x|0;y=y|0;z=z|0;A=A|0;B=B|0;C=C|0;D=D|0;var E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,$=0,aa=0,ba=0,ca=0,da=0,ea=0,fa=0,ga=0,ha=0,ia=0,ja=0,ka=0,la=0,ma=0,na=0,oa=0,pa=0,qa=0,ra=0,sa=0,ta=0,ua=0,va=0,wa=0,xa=0,ya=0,za=0,Aa=0,Ba=0,Ca=0,Da=0,Ea=0,Fa=0,Ga=0,Ha=0,Ia=0,Ja=0,Ka=0,La=0;Ia=i;Ea=i;i=i+((1*(B*56|0)|0)+15&-16)|0;Fa=d+4432|0;Ga=d+4428|0;Da=t>>6;wa=(f|0)==2;xa=n+2|0;ya=n+4|0;za=n+6|0;Aa=n+8|0;Ba=(p|0)>0;Ca=q<<16>>16;la=q>>16;ma=z>>1;na=m+2|0;oa=m+4|0;pa=m+6|0;qa=m+8|0;ra=m+10|0;sa=m+12|0;ta=m+14|0;ua=m+16|0;va=m+18|0;ea=(z|0)==16;fa=m+20|0;ga=m+22|0;ha=m+24|0;ia=m+26|0;ja=m+28|0;ka=m+30|0;aa=A<<16>>16;ba=y>>1;ca=y+-1|0;da=o+(ca<<1)|0;Z=r<<16>>16;$=s<<16>>16;V=s>>16;W=(u|0)>2048;Y=(u|0)/2|0;X=Y+-512|0;Y=512-Y|0;N=u<<16>>16;O=v+944|0;P=_(v<<16>>16,N)|0;Q=_(O<<16>>16,N)|0;R=v+-944|0;S=_(944-v<<16>>16,N)|0;T=Ea+4|0;U=Ea+32|0;L=(x|0)<1;M=0;t=k+((c[Ga>>2]|0)-p+2<<2)|0;f=d+1280+((c[Fa>>2]|0)-p+1<<2)|0;while(1){if((M|0)>=(w|0)){t=0;break}if(wa){J=c[t>>2]|0;I=b[n>>1]|0;I=(_(J>>16,I)|0)+((_(J&65535,I)|0)>>16)+2|0;J=c[t+-4>>2]|0;K=b[xa>>1]|0;K=I+((_(J>>16,K)|0)+((_(J&65535,K)|0)>>16))|0;J=c[t+-8>>2]|0;I=b[ya>>1]|0;I=K+((_(J>>16,I)|0)+((_(J&65535,I)|0)>>16))|0;J=c[t+-12>>2]|0;K=b[za>>1]|0;K=I+((_(J>>16,K)|0)+((_(J&65535,K)|0)>>16))|0;J=c[t+-16>>2]|0;I=b[Aa>>1]|0;I=K+((_(J>>16,I)|0)+((_(J&65535,I)|0)>>16))<<1;J=t+4|0}else{I=0;J=t}if(Ba){K=(c[f>>2]|0)+(c[f+-8>>2]|0)|0;K=(_(K>>16,Ca)|0)+((_(K&65535,Ca)|0)>>16)|0;H=c[f+-4>>2]|0;H=I-(K+(_(H>>16,la)|0)+((_(H&65535,la)|0)>>16)<<2)|0;K=f+4|0}else{H=0;K=f}E=M+39|0;F=g+(M<<2)|0;G=0;while(1){if((G|0)>=(B|0))break;A=e+(G*1396|0)+1384|0;c[A>>2]=(_(c[A>>2]|0,196314165)|0)+907633515;t=e+(G*1396|0)+(E<<2)|0;p=c[t>>2]|0;x=b[m>>1]|0;x=ma+((_(p>>16,x)|0)+((_(p&65535,x)|0)>>16))|0;p=c[t+-4>>2]|0;f=b[na>>1]|0;f=x+((_(p>>16,f)|0)+((_(p&65535,f)|0)>>16))|0;p=c[t+-8>>2]|0;x=b[oa>>1]|0;x=f+((_(p>>16,x)|0)+((_(p&65535,x)|0)>>16))|0;p=c[t+-12>>2]|0;f=b[pa>>1]|0;f=x+((_(p>>16,f)|0)+((_(p&65535,f)|0)>>16))|0;p=c[t+-16>>2]|0;x=b[qa>>1]|0;x=f+((_(p>>16,x)|0)+((_(p&65535,x)|0)>>16))|0;p=c[t+-20>>2]|0;f=b[ra>>1]|0;f=x+((_(p>>16,f)|0)+((_(p&65535,f)|0)>>16))|0;p=c[t+-24>>2]|0;x=b[sa>>1]|0;x=f+((_(p>>16,x)|0)+((_(p&65535,x)|0)>>16))|0;p=c[t+-28>>2]|0;f=b[ta>>1]|0;f=x+((_(p>>16,f)|0)+((_(p&65535,f)|0)>>16))|0;p=c[t+-32>>2]|0;x=b[ua>>1]|0;x=f+((_(p>>16,x)|0)+((_(p&65535,x)|0)>>16))|0;p=c[t+-36>>2]|0;f=b[va>>1]|0;f=x+((_(p>>16,f)|0)+((_(p&65535,f)|0)>>16))|0;if(ea){p=c[t+-40>>2]|0;x=b[fa>>1]|0;x=f+((_(p>>16,x)|0)+((_(p&65535,x)|0)>>16))|0;p=c[t+-44>>2]|0;f=b[ga>>1]|0;f=x+((_(p>>16,f)|0)+((_(p&65535,f)|0)>>16))|0;p=c[t+-48>>2]|0;x=b[ha>>1]|0;x=f+((_(p>>16,x)|0)+((_(p&65535,x)|0)>>16))|0;p=c[t+-52>>2]|0;f=b[ia>>1]|0;f=x+((_(p>>16,f)|0)+((_(p&65535,f)|0)>>16))|0;p=c[t+-56>>2]|0;x=b[ja>>1]|0;x=f+((_(p>>16,x)|0)+((_(p&65535,x)|0)>>16))|0;p=c[t+-60>>2]|0;f=b[ka>>1]|0;f=x+((_(p>>16,f)|0)+((_(p&65535,f)|0)>>16))|0}q=e+(G*1396|0)+1280|0;t=c[q>>2]|0;p=(c[e+(G*1396|0)+1380>>2]|0)+((_(t>>16,aa)|0)+((_(t&65535,aa)|0)>>16))|0;z=(c[e+(G*1396|0)+1284>>2]|0)-p|0;z=t+((_(z>>16,aa)|0)+((_(z&65535,aa)|0)>>16))|0;c[q>>2]=p;q=b[o>>1]|0;t=2;q=ba+((_(p>>16,q)|0)+((_(p&65535,q)|0)>>16))|0;while(1){if((t|0)>=(y|0))break;r=t+-1|0;p=e+(G*1396|0)+1280+(r<<2)|0;u=e+(G*1396|0)+1280+(t<<2)|0;x=c[u>>2]|0;s=x-z|0;s=(c[p>>2]|0)+((_(s>>16,aa)|0)+((_(s&65535,aa)|0)>>16))|0;c[p>>2]=z;r=b[o+(r<<1)>>1]|0;p=c[e+(G*1396|0)+1280+((t|1)<<2)>>2]|0;c[u>>2]=s;r=r<<16>>16;u=b[o+(t<<1)>>1]|0;p=p-s|0;t=t+2|0;q=q+((_(z>>16,r)|0)+((_(z&65535,r)|0)>>16))+((_(s>>16,u)|0)+((_(s&65535,u)|0)>>16))|0;z=x+((_(p>>16,aa)|0)+((_(p&65535,aa)|0)>>16))|0}p=f<<4;c[e+(G*1396|0)+1280+(ca<<2)>>2]=z;s=b[da>>1]|0;s=q+((_(z>>16,s)|0)+((_(z&65535,s)|0)>>16))<<1;u=c[e+(G*1396|0)+1376>>2]|0;x=u>>16;u=u&65535;s=s+((_(x,Z)|0)+((_(u,Z)|0)>>16))<<2;r=c[e+(G*1396|0)+1120+(c[C>>2]<<2)>>2]|0;u=(_(r>>16,$)|0)+((_(r&65535,$)|0)>>16)+(_(x,V)|0)+((_(u,V)|0)>>16)<<2;x=c[F>>2]|0;r=x-((H+p-(s+u)>>3)+1>>1)|0;A=(c[A>>2]|0)<0;r=A?0-r|0:r;r=(r|0)>30720?30720:(r|0)<-31744?-31744:r;t=r-v|0;do if(W){if((t|0)>(X|0)){t=t-X|0;Ha=20;break}if((t|0)>=(Y|0))if((t|0)<0){Ha=23;break}else{t=v;f=O;q=P;z=Q;break}else{t=t+X|0;Ha=20;break}}else Ha=20;while(0);a:do if((Ha|0)==20){Ha=0;t=t>>10;if((t|0)>0){q=(t<<10)+-80+v|0;z=q+1024|0;t=q;f=z;q=_(q<<16>>16,N)|0;z=_(z<<16>>16,N)|0;break}switch(t|0){case 0:{t=v;f=O;q=P;z=Q;break a}case -1:{Ha=23;break a}default:{}}z=(t<<10|80)+v|0;t=z;f=z+1024|0;q=_(0-z<<16>>16,N)|0;z=_(-1024-z<<16>>16,N)|0}while(0);if((Ha|0)==23){Ha=0;t=R;f=v;q=S;z=P}Ja=r-t<<16>>16;Ja=q+(_(Ja,Ja)|0)>>10;r=r-f<<16>>16;r=z+(_(r,r)|0)>>10;Ka=(Ja|0)<(r|0);La=c[e+(G*1396|0)+1392>>2]|0;q=Ka?t:f;z=Ka?f:t;c[Ea+(G*56|0)+4>>2]=La+(Ka?Ja:r);c[Ea+(G*56|0)+32>>2]=La+(Ka?r:Ja);c[Ea+(G*56|0)>>2]=q;c[Ea+(G*56|0)+28>>2]=z;f=q<<4;f=(A?0-f|0:f)+I|0;q=f+p|0;r=x<<4;x=q-r|0;c[Ea+(G*56|0)+16>>2]=x;x=x-s|0;c[Ea+(G*56|0)+20>>2]=x-u;c[Ea+(G*56|0)+12>>2]=x;c[Ea+(G*56|0)+24>>2]=f;c[Ea+(G*56|0)+8>>2]=q;x=z<<4;x=(A?0-x|0:x)+I|0;p=x+p|0;r=p-r|0;c[Ea+(G*56|0)+44>>2]=r;s=r-s|0;c[Ea+(G*56|0)+48>>2]=s-u;c[Ea+(G*56|0)+40>>2]=s;c[Ea+(G*56|0)+52>>2]=x;c[Ea+(G*56|0)+36>>2]=p;G=G+1|0}t=((c[C>>2]|0)+-1|0)%40|0;s=(t|0)<0;f=t+40|0;c[C>>2]=s?f:t;t=(s?f:t)+D|0;f=c[T>>2]|0;s=0;q=1;while(1){if((q|0)>=(B|0))break;Ka=c[Ea+(q*56|0)+4>>2]|0;La=(Ka|0)<(f|0);f=La?Ka:f;s=La?q:s;q=q+1|0}r=(t|0)%40|0;t=c[e+(s*1396|0)+480+(r<<2)>>2]|0;f=0;while(1){if((f|0)>=(B|0))break;if((c[e+(f*1396|0)+480+(r<<2)>>2]|0)!=(t|0)){La=Ea+(f*56|0)+4|0;c[La>>2]=(c[La>>2]|0)+134217727;La=Ea+(f*56|0)+32|0;c[La>>2]=(c[La>>2]|0)+134217727}f=f+1|0}t=c[T>>2]|0;f=0;q=c[U>>2]|0;z=0;A=1;while(1){if((A|0)>=(B|0))break;I=c[Ea+(A*56|0)+4>>2]|0;Ja=(I|0)>(t|0);Ka=c[Ea+(A*56|0)+32>>2]|0;La=(Ka|0)<(q|0);t=Ja?I:t;f=Ja?A:f;q=La?Ka:q;z=La?A:z;A=A+1|0}if((q|0)<(t|0)){rf(e+(f*1396|0)+(M<<2)|0,e+(z*1396|0)+(M<<2)|0,1396-(M<<2)|0)|0;La=Ea+(f*56|0)|0;Ka=Ea+(z*56|0)+28|0;c[La>>2]=c[Ka>>2];c[La+4>>2]=c[Ka+4>>2];c[La+8>>2]=c[Ka+8>>2];c[La+12>>2]=c[Ka+12>>2];c[La+16>>2]=c[Ka+16>>2];c[La+20>>2]=c[Ka+20>>2];c[La+24>>2]=c[Ka+24>>2]}if(!(L&(M|0)<(D|0))){La=M-D|0;a[h+La>>0]=(((c[e+(s*1396|0)+640+(r<<2)>>2]|0)>>>9)+1|0)>>>1;Ja=c[e+(s*1396|0)+800+(r<<2)>>2]|0;Ka=c[l+(r<<2)>>2]|0;I=Ka<<16>>16;Ka=((_(Ja>>16,I)|0)+((_(Ja&65535,I)|0)>>16)+(_(Ja,(Ka>>15)+1>>1)|0)>>7)+1>>1;b[j+(La<<1)>>1]=(Ka|0)>32767?32767:((Ka|0)<-32768?-32768:Ka)&65535;c[d+1280+((c[Fa>>2]|0)-D<<2)>>2]=c[e+(s*1396|0)+1120+(r<<2)>>2];c[k+((c[Ga>>2]|0)-D<<2)>>2]=c[e+(s*1396|0)+960+(r<<2)>>2]}c[Fa>>2]=(c[Fa>>2]|0)+1;c[Ga>>2]=(c[Ga>>2]|0)+1;t=M+40|0;f=0;while(1){if((f|0)>=(B|0))break;c[e+(f*1396|0)+1376>>2]=c[Ea+(f*56|0)+12>>2];c[e+(f*1396|0)+1380>>2]=c[Ea+(f*56|0)+16>>2];La=c[Ea+(f*56|0)+8>>2]|0;c[e+(f*1396|0)+(t<<2)>>2]=La;c[e+(f*1396|0)+800+(c[C>>2]<<2)>>2]=La;La=c[Ea+(f*56|0)>>2]|0;c[e+(f*1396|0)+640+(c[C>>2]<<2)>>2]=La;c[e+(f*1396|0)+960+(c[C>>2]<<2)>>2]=c[Ea+(f*56|0)+24>>2]<<1;c[e+(f*1396|0)+1120+(c[C>>2]<<2)>>2]=c[Ea+(f*56|0)+20>>2];Ka=e+(f*1396|0)+1384|0;La=(c[Ka>>2]|0)+((La>>9)+1>>1)|0;c[Ka>>2]=La;c[e+(f*1396|0)+480+(c[C>>2]<<2)>>2]=La;c[e+(f*1396|0)+1392>>2]=c[Ea+(f*56|0)+4>>2];f=f+1|0}c[l+(c[C>>2]<<2)>>2]=Da;M=M+1|0;t=J;f=K}while(1){if((t|0)>=(B|0))break;rf(e+(t*1396|0)|0,e+(t*1396|0)+(w<<2)|0,160)|0;t=t+1|0}i=Ia;return}function me(d,f,g){d=d|0;f=f|0;g=g|0;var h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0;R=i;i=i+64|0;l=R+20|0;m=R+16|0;j=R+12|0;k=R+8|0;Q=R+24|0;h=R;I=d+2336|0;p=c[I>>2]|0;P=d+2328|0;J=i;i=i+((1*(p+(c[P>>2]|0)<<2)|0)+15&-16)|0;s=i;i=i+((1*(p<<1)|0)+15&-16)|0;c[h>>2]=c[d+4240>>2]>>6;p=d+4244|0;M=c[p>>2]|0;L=M>>6;c[h+4>>2]=L;if(c[d+2376>>2]|0){o=d+4182|0;n=o+32|0;do{b[o>>1]=0;o=o+2|0}while((o|0)<(n|0))}G=d+2332|0;H=d+2324|0;ne(j,l,k,m,d+4|0,h,c[G>>2]|0,c[H>>2]|0);h=c[d+4252>>2]|0;if((c[j>>2]>>c[m>>2]|0)<(c[k>>2]>>c[l>>2]|0)){h=_(h+-1|0,c[d+4256>>2]|0)|0;h=(h|0)<128?0:h+-128|0}else{h=_(h,c[d+4256>>2]|0)|0;h=(h|0)<128?0:h+-128|0}F=d+4+(h<<2)|0;B=d+4172|0;N=d+4224|0;n=b[N>>1]|0;l=d+4160|0;o=c[l>>2]|0;O=(o|0)>1;r=b[25776+((O?1:o)<<1)>>1]|0;m=d+4164|0;o=b[((c[m>>2]|0)==2?25780:25784)+((O?1:o)<<1)>>1]|0;O=d+2340|0;j=(c[O>>2]|0)+-1|0;h=64881;k=0;while(1){if((k|0)>=(j|0))break;K=d+4182+(k<<1)|0;b[K>>1]=(((_(h,b[K>>1]|0)|0)>>>15)+1|0)>>>1;h=h+(((_(h,-655)|0)>>15)+1>>1)|0;k=k+1|0}k=d+4182+(j<<1)|0;b[k>>1]=(((_(h,b[k>>1]|0)|0)>>>15)+1|0)>>>1;h=d+4182|0;k=c[O>>2]|0;rf(Q|0,h|0,k<<1|0)|0;do if(!(c[l>>2]|0)){if((c[m>>2]|0)==2){h=0;j=16384;while(1){if((h|0)==5)break;K=(j&65535)-(e[d+4172+(h<<1)>>1]|0)&65535;h=h+1|0;j=K}n=(_((j<<16>>16<3277?3277:j)<<16>>16,b[d+4236>>1]|0)|0)>>>14&65535;break}h=te(h,k)|0;if((h|0)<=134217728)if((h|0)<4194304)h=4194304;else q=16;else{h=134217728;q=16}n=h<<3;o=(_(n>>16,o)|0)+((_(n&65528,o)|0)>>16)>>14;n=16384}while(0);K=d+4220|0;y=c[K>>2]|0;A=d+4168|0;x=(c[A>>2]>>7)+1>>1;z=c[I>>2]|0;m=z-x-k+-2|0;se(s+(m<<1)|0,d+1348+(m<<1)|0,Q,z-m|0,k);j=c[p>>2]|0;if((j|0)<=0)if(!j)h=32;else{h=0-j|0;q=20}else{h=j;q=20}if((q|0)==20)h=aa(h|0)|0;j=j<>16;l=536870911/(C|0)|0;D=l<<16;E=D>>16;j=536870912-((_(C,E)|0)+((_(j&65535,E)|0)>>16))<<3;l=D+((_(j>>16,E)|0)+((_(j&65528,E)|0)>>16))+(_(j,(l>>15)+1>>1)|0)|0;h=62-h|0;j=h+-46|0;if((j|0)>=1)if((j|0)<32){h=l>>j;q=30}else h=0;else{k=46-h|0;h=-2147483648>>k;j=2147483647>>>k;if((h|0)>(j|0)){if((l|0)<=(h|0))h=(l|0)<(j|0)?j:l}else if((l|0)>(j|0))h=j;else h=(l|0)<(h|0)?h:l;h=h<>2]|0;l=h>>16;j=h&65535;h=m+(c[O>>2]|0)|0;while(1){if((h|0)>=(k|0))break;E=b[s+(h<<1)>>1]|0;c[J+(h<<2)>>2]=(_(l,E)|0)+((_(j,E)|0)>>16);h=h+1|0}t=d+4174|0;u=d+4176|0;v=d+4178|0;w=d+4180|0;q=r<<16>>16;r=d+2765|0;s=d+2316|0;o=o<<16>>16;p=0;E=x;D=n;C=y;j=z;while(1){if((p|0)>=(c[H>>2]|0))break;m=D<<16>>16;k=c[G>>2]|0;l=0;h=J+(j-E+2<<2)|0;n=C;while(1){if((l|0)>=(k|0)){h=0;break}E=c[h>>2]|0;z=b[B>>1]|0;z=(_(E>>16,z)|0)+((_(E&65535,z)|0)>>16)+2|0;E=c[h+-4>>2]|0;C=b[t>>1]|0;C=z+((_(E>>16,C)|0)+((_(E&65535,C)|0)>>16))|0;E=c[h+-8>>2]|0;z=b[u>>1]|0;z=C+((_(E>>16,z)|0)+((_(E&65535,z)|0)>>16))|0;E=c[h+-12>>2]|0;C=b[v>>1]|0;C=z+((_(E>>16,C)|0)+((_(E&65535,C)|0)>>16))|0;E=c[h+-16>>2]|0;z=b[w>>1]|0;z=C+((_(E>>16,z)|0)+((_(E&65535,z)|0)>>16))|0;E=(_(n,196314165)|0)+907633515|0;C=c[F+(E>>>25<<2)>>2]|0;c[J+(j<<2)>>2]=z+((_(C>>16,m)|0)+((_(C&65535,m)|0)>>16))<<2;l=l+1|0;h=h+4|0;n=E;j=j+1|0}while(1){if((h|0)==5)break;E=d+4172+(h<<1)|0;b[E>>1]=(_(q,b[E>>1]|0)|0)>>>15;h=h+1|0}if(!(a[r>>0]|0))h=D;else h=(_(m,o)|0)>>>15&65535;D=c[A>>2]|0;D=D+(((D>>16)*655|0)+(((D&65535)*655|0)>>>16))|0;c[A>>2]=D;E=(c[s>>2]<<16>>16)*4608|0;E=(D|0)<(E|0)?D:E;c[A>>2]=E;p=p+1|0;E=(E>>7)+1>>1;D=h;C=n}B=J+((c[I>>2]|0)+-16<<2)|0;A=d+1284|0;o=B;h=A;n=o+64|0;do{c[o>>2]=c[h>>2];o=o+4|0;h=h+4|0}while((o|0)<(n|0));q=b[Q>>1]|0;r=b[Q+2>>1]|0;s=b[Q+4>>1]|0;t=b[Q+6>>1]|0;u=b[Q+8>>1]|0;v=b[Q+10>>1]|0;w=b[Q+12>>1]|0;x=b[Q+14>>1]|0;y=b[Q+16>>1]|0;z=b[Q+18>>1]|0;p=L<<16>>16;n=(M>>21)+1>>1;o=0;while(1){h=c[P>>2]|0;if((o|0)>=(h|0))break;h=c[B+(o+15<<2)>>2]|0;h=(c[O>>2]>>1)+((_(h>>16,q)|0)+((_(h&65535,q)|0)>>16))|0;m=c[B+(o+14<<2)>>2]|0;m=h+((_(m>>16,r)|0)+((_(m&65535,r)|0)>>16))|0;h=c[B+(o+13<<2)>>2]|0;h=m+((_(h>>16,s)|0)+((_(h&65535,s)|0)>>16))|0;m=c[B+(o+12<<2)>>2]|0;m=h+((_(m>>16,t)|0)+((_(m&65535,t)|0)>>16))|0;h=c[B+(o+11<<2)>>2]|0;h=m+((_(h>>16,u)|0)+((_(h&65535,u)|0)>>16))|0;m=c[B+(o+10<<2)>>2]|0;m=h+((_(m>>16,v)|0)+((_(m&65535,v)|0)>>16))|0;h=c[B+(o+9<<2)>>2]|0;h=m+((_(h>>16,w)|0)+((_(h&65535,w)|0)>>16))|0;m=c[B+(o+8<<2)>>2]|0;m=h+((_(m>>16,x)|0)+((_(m&65535,x)|0)>>16))|0;h=c[B+(o+7<<2)>>2]|0;h=m+((_(h>>16,y)|0)+((_(h&65535,y)|0)>>16))|0;m=c[B+(o+6<<2)>>2]|0;m=h+((_(m>>16,z)|0)+((_(m&65535,z)|0)>>16))|0;h=c[O>>2]|0;j=o+16|0;k=10;while(1){if((k|0)>=(h|0))break;L=c[B+(j-k+-1<<2)>>2]|0;M=b[Q+(k<<1)>>1]|0;m=m+((_(L>>16,M)|0)+((_(L&65535,M)|0)>>16))|0;k=k+1|0}l=B+(j<<2)|0;h=c[l>>2]|0;j=(m|0)>134217727;k=j?2147483632:((m|0)<-134217728?-134217728:m)<<4;if((h+(j?2147483632:((m|0)<-134217728?-134217728:m)<<4)|0)>-1)if((h&k|0)<0)h=-2147483648;else h=h+(j?2147483632:((m|0)<-134217728?-134217728:m)<<4)|0;else if((h|k|0)>-1)h=2147483647;else h=h+(j?2147483632:((m|0)<-134217728?-134217728:m)<<4)|0;c[l>>2]=h;M=((_(h>>16,p)|0)+((_(h&65535,p)|0)>>16)+(_(h,n)|0)>>7)+1>>1;b[g+(o<<1)>>1]=(M|0)>32767?32767:((M|0)<-32768?-32768:M)&65535;o=o+1|0}o=A;h=B+(h<<2)|0;n=o+64|0;do{c[o>>2]=c[h>>2];o=o+4|0;h=h+4|0}while((o|0)<(n|0));c[K>>2]=C;b[N>>1]=D;h=0;while(1){if((h|0)==4)break;c[f+(h<<2)>>2]=E;h=h+1|0}i=R;return}function ne(a,d,e,f,g,h,j,k){a=a|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;k=k|0;var l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0;r=i;l=i;i=i+((1*(j<<1<<1)|0)+15&-16)|0;o=l;q=0;while(1){if((q|0)==2)break;m=_(q+k+-2|0,j)|0;n=h+(q<<2)|0;p=0;while(1){if((p|0)>=(j|0))break;t=c[g+(p+m<<2)>>2]|0;s=c[n>>2]|0;u=s<<16>>16;s=(_(t>>16,u)|0)+((_(t&65535,u)|0)>>16)+(_(t,(s>>15)+1>>1)|0)>>8;b[o+(p<<1)>>1]=(s|0)>32767?32767:((s|0)<-32768?-32768:s)&65535;p=p+1|0}o=o+(j<<1)|0;q=q+1|0}ze(a,d,l,j);ze(e,f,l+(j<<1)|0,j);i=r;return}function oe(a,d){a=a|0;d=d|0;var f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0;v=i;i=i+48|0;s=v+32|0;u=v+16|0;q=v;t=a+4676|0;l=c[t>>2]|0;n=l>>1;f=l>>2;h=l>>3;c[q>>2]=0;o=h+f|0;c[q+4>>2]=o;m=o+h|0;c[q+8>>2]=m;k=m+f|0;c[q+12>>2]=k;p=i;i=i+((1*(k+n<<1)|0)+15&-16)|0;qe(d,a+32|0,p,p+(k<<1)|0,l);qe(p,a+40|0,p,p+(m<<1)|0,n);qe(p,a+48|0,p,p+(o<<1)|0,f);f=p+(h+-1<<1)|0;d=b[f>>1]>>1;b[f>>1]=d;f=d;while(1){g=h+-1|0;if((h|0)<=1)break;n=p+(h+-2<<1)|0;o=b[n>>1]>>1;b[n>>1]=o;b[p+(g<<1)>>1]=(f&65535)-(o&65535);f=o;h=g}m=a+88|0;b[p>>1]=(e[p>>1]|0)-(e[m>>1]|0);b[m>>1]=d;m=0;f=0;while(1){if((m|0)==4)break;h=4-m|0;h=c[t>>2]>>((h|0)<3?h:3)>>2;j=a+56+(m<<2)|0;d=c[j>>2]|0;k=s+(m<<2)|0;c[k>>2]=d;l=q+(m<<2)|0;n=0;o=0;while(1){if((o|0)==4)break;else{g=0;f=0}while(1){if((g|0)>=(h|0))break;w=b[p+((c[l>>2]|0)+g+n<<1)>>1]>>3;g=g+1|0;f=f+(_(w,w)|0)|0}if((o|0)<3){d=d+f|0;d=(d|0)<0?2147483647:d}else{d=d+(f>>1)|0;d=(d|0)<0?2147483647:d}c[k>>2]=d;n=n+h|0;o=o+1|0}c[j>>2]=f;m=m+1|0}l=a+140|0;d=c[l>>2]|0;if((d|0)<1e3)k=32767/((d>>4)+1|0)|0;else k=0;j=0;while(1){if((j|0)==4)break;g=a+92+(j<<2)|0;f=c[g>>2]|0;d=(c[s+(j<<2)>>2]|0)+(c[a+124+(j<<2)>>2]|0)|0;d=(d|0)<0?2147483647:d;h=2147483647/(d|0)|0;if((d|0)<=(f<<3|0))if((d|0)<(f|0))d=1024;else{w=f<<16>>16;q=_(h>>16,w)|0;w=_(h&65535,w)|0;d=_(h,(f>>15)+1>>1)|0;d=q+(w>>16)+d>>16<<11|(q+(w>>>16)+d|0)>>>5&2047}else d=128;q=a+108+(j<<2)|0;o=c[q>>2]|0;p=h-o|0;w=((d|0)>(k|0)?d:k)<<16>>16;w=o+((_(p>>16,w)|0)+((_(p&65535,w)|0)>>16))|0;c[q>>2]=w;w=2147483647/(w|0)|0;c[g>>2]=(w|0)<16777215?w:16777215;j=j+1|0}c[l>>2]=(c[l>>2]|0)+1;o=0;p=0;j=0;while(1){if((o|0)==4)break;l=c[s+(o<<2)>>2]|0;m=c[a+92+(o<<2)>>2]|0;n=l-m|0;if((n|0)>0){if(l>>>0<8388608)d=(l<<8|0)/(m+1|0)|0;else d=(l|0)/((m>>8)+1|0)|0;c[u+(o<<2)>>2]=d;h=aa(d|0)|0;f=24-h|0;g=0-f|0;do if(f)if((f|0)<0){d=d<>>(f+32|0);break}else{d=d<<32-f|d>>>f;break}while(0);d=d&127;d=d+(((_(d,128-d|0)|0)*179|0)>>>16)+(31-h<<7)+-1024|0;k=d<<16>>16;j=j+(_(k,k)|0)|0;if((n|0)<1048576){g=aa(n|0)|0;g=(l|0)==(m|0)?32:g;d=24-g|0;f=0-d|0;do if(d)if((d|0)<0){d=n<>>(d+32|0);break}else{d=n<<32-d|n>>>d;break}else d=n;while(0);g=((g&1|0)==0?46214:32768)>>>(g>>>1);h=(_(d&127,13959168)|0)>>>16;h=_(g+((_(g>>16,h)|0)+((_(g&65535,h)|0)>>>16))<<6>>16,k)|0;g=aa(n|0)|0;g=(l|0)==(m|0)?32:g;d=24-g|0;f=0-d|0;do if(d)if((d|0)<0){d=n<>>(d+32|0);break}else{d=n<<32-d|n>>>d;break}else d=n;while(0);w=((g&1|0)==0?46214:32768)>>>(g>>>1);d=(_(d&127,13959168)|0)>>>16;d=h+((_(w+((_(w>>16,d)|0)+((_(w&65535,d)|0)>>>16))<<6&65472,k)|0)>>16)|0}w=c[22976+(o<<2)>>2]|0;f=d<<16>>16;f=p+((_(w>>16,f)|0)+((_(w&65535,f)|0)>>16))|0;d=j}else{c[u+(o<<2)>>2]=256;f=p;d=j}o=o+1|0;p=f;j=d}d=(j|0)/4|0;do if((j|0)>=4){h=aa(d|0)|0;h=(j+3|0)>>>0<7?32:h;f=24-h|0;g=0-f|0;do if(f)if((f|0)<0){d=d<>>(f+32|0);break}else{d=d<<32-f|d>>>f;break}while(0);f=((h&1|0)==0?46214:32768)>>>(h>>>1);d=(_(d&127,13959168)|0)>>>16;d=((f+((_(f>>16,d)|0)+((_(f&65535,d)|0)>>>16))|0)*196608>>16)*45e3>>16;f=d+-128|0;if((d|0)<128)if((f|0)<-191){d=0;break}else{d=128-d|0;r=53;break}if((f|0)>191)d=32767;else{d=f>>5;d=(c[23040+(d<<2)>>2]|0)+(_(c[23016+(d<<2)>>2]<<16>>16,f&31)|0)|0}}else{d=128;r=53}while(0);if((r|0)==53){w=d>>5;d=(c[22992+(w<<2)>>2]|0)-(_(c[23016+(w<<2)>>2]<<16>>16,d&31)|0)|0}if((p|0)<0){f=0-p|0;if((p|0)<-191)f=0;else{w=f>>5;f=(c[22992+(w<<2)>>2]|0)-(_(c[23016+(w<<2)>>2]<<16>>16,f&31)|0)|0}}else if((p|0)>191)f=32767;else{f=p>>5;f=(c[23040+(f<<2)>>2]|0)+(_(c[23016+(f<<2)>>2]<<16>>16,p&31)|0)|0}c[a+4804>>2]=(f<<1)+-32768;f=0;g=0;while(1){if((f|0)==4)break;r=f+1|0;w=g+(_(r,(c[s+(f<<2)>>2]|0)-(c[a+92+(f<<2)>>2]|0)>>4)|0)|0;f=r;g=w}if((g|0)>=1){if((g|0)<32768){f=g<<((c[t>>2]|0)==((c[a+4668>>2]|0)*10|0)?16:15);j=aa(f|0)|0;g=24-j|0;h=0-g|0;do if(g)if((g|0)<0){f=f<>>(g+32|0);break}else{f=f<<32-g|f>>>g;break}while(0);s=((j&1|0)==0?46214:32768)>>>(j>>>1);w=(_(f&127,13959168)|0)>>>16;w=s+((_(s>>16,w)|0)+((_(s&65535,w)|0)>>>16))+32768|0;d=d<<16>>16;d=(_(w>>16,d)|0)+((_(w&65535,d)|0)>>16)|0}}else d=d>>1;k=d>>7;c[a+4624>>2]=(k|0)<255?k:255;k=d<<16>>16;k=((_(d>>16,k)|0)<<16)+(_(d&65535,k)|0)|0;k=k>>((c[t>>2]|0)==((c[a+4668>>2]|0)*10|0)?21:20);j=0;while(1){if((j|0)==4)break;h=a+72+(j<<2)|0;f=c[h>>2]|0;d=(c[u+(j<<2)>>2]|0)-f|0;d=f+((_(d>>16,k)|0)+((_(d&65535,k)|0)>>16))|0;c[h>>2]=d;h=aa(d|0)|0;f=24-h|0;g=0-f|0;do if(f)if((f|0)<0){d=d<>>(f+32|0);break}else{d=d<<32-f|d>>>f;break}while(0);d=d&127;d=((d+(((_(d,128-d|0)|0)*179|0)>>>16)+(31-h<<7)|0)*3|0)+-5120|0;f=d>>4;if((f|0)<0){d=0-f|0;if((f|0)<-191)d=0;else{w=d>>5;d=(c[22992+(w<<2)>>2]|0)-(_(c[23016+(w<<2)>>2]<<16>>16,d&31)|0)|0}}else if((f|0)>191)d=32767;else{d=d>>9;d=(c[23040+(d<<2)>>2]|0)+(_(c[23016+(d<<2)>>2]<<16>>16,f&31)|0)|0}c[a+4788+(j<<2)>>2]=d;j=j+1|0}i=v;return}function pe(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0;e=c[a+(d<<2)>>2]|0;f=b<<4;if((d|0)==8){b=b<<20>>16;g=(f>>15)+1>>1;d=(c[a+28>>2]|0)+((_(e>>16,b)|0)+((_(e&65535,b)|0)>>16))+(_(e,g)|0)|0;d=(c[a+24>>2]|0)+((_(d>>16,b)|0)+((_(d&65535,b)|0)>>16))+(_(d,g)|0)|0;d=(c[a+20>>2]|0)+((_(d>>16,b)|0)+((_(d&65535,b)|0)>>16))+(_(d,g)|0)|0;d=(c[a+16>>2]|0)+((_(d>>16,b)|0)+((_(d&65535,b)|0)>>16))+(_(d,g)|0)|0;d=(c[a+12>>2]|0)+((_(d>>16,b)|0)+((_(d&65535,b)|0)>>16))+(_(d,g)|0)|0;d=(c[a+8>>2]|0)+((_(d>>16,b)|0)+((_(d&65535,b)|0)>>16))+(_(d,g)|0)|0;d=(c[a+4>>2]|0)+((_(d>>16,b)|0)+((_(d&65535,b)|0)>>16))+(_(d,g)|0)|0;a=(c[a>>2]|0)+((_(d>>16,b)|0)+((_(d&65535,b)|0)>>16))+(_(d,g)|0)|0;return a|0}g=b<<20>>16;f=(f>>15)+1>>1;while(1){b=d+-1|0;if((d|0)<=0)break;d=b;e=(c[a+(b<<2)>>2]|0)+((_(e>>16,g)|0)+((_(e&65535,g)|0)>>16))+(_(e,f)|0)|0}return e|0}function qe(a,d,e,f,g){a=a|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,l=0,m=0,n=0;g=g>>1;h=d+4|0;i=0;while(1){if((i|0)>=(g|0))break;m=i<<1;n=b[a+(m<<1)>>1]<<10;l=n-(c[d>>2]|0)|0;k=(_(l>>16,-24290)|0)+((_(l&65535,-24290)|0)>>16)|0;j=n+k|0;c[d>>2]=n+(l+k);m=b[a+((m|1)<<1)>>1]<<10;k=c[h>>2]|0;l=m-k|0;l=((l>>16)*10788|0)+(((l&65535)*10788|0)>>>16)|0;k=k+l|0;c[h>>2]=m+l;l=(k+j>>10)+1>>1;b[e+(i<<1)>>1]=(l|0)>32767?32767:((l|0)<-32768?-32768:l)&65535;j=(k-j>>10)+1>>1;b[f+(i<<1)>>1]=(j|0)>32767?32767:((j|0)<-32768?-32768:j)&65535;i=i+1|0}return}function re(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0;g=d+-65536|0;f=b+-1|0;e=0;while(1){b=d>>16;if((e|0)>=(f|0))break;h=a+(e<<2)|0;i=c[h>>2]|0;j=i<<16>>16;c[h>>2]=(_(b,j)|0)+((_(d&65535,j)|0)>>16)+(_(d,(i>>15)+1>>1)|0);d=d+(((_(d,g)|0)>>15)+1>>1)|0;e=e+1|0}j=a+(f<<2)|0;i=c[j>>2]|0;h=i<<16>>16;c[j>>2]=(_(b,h)|0)+((_(d&65535,h)|0)>>16)+(_(d,(i>>15)+1>>1)|0);return}function se(a,c,d,e,f){a=a|0;c=c|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;g=d+2|0;h=d+4|0;i=d+6|0;j=d+8|0;k=d+10|0;m=f;while(1){if((m|0)>=(e|0))break;l=c+(m+-1<<1)|0;o=_(b[l>>1]|0,b[d>>1]|0)|0;o=o+(_(b[l+-2>>1]|0,b[g>>1]|0)|0)|0;o=o+(_(b[l+-4>>1]|0,b[h>>1]|0)|0)|0;o=o+(_(b[l+-6>>1]|0,b[i>>1]|0)|0)|0;o=o+(_(b[l+-8>>1]|0,b[j>>1]|0)|0)|0;n=6;o=o+(_(b[l+-10>>1]|0,b[k>>1]|0)|0)|0;while(1){if((n|0)>=(f|0))break;p=o+(_(b[l+(0-n<<1)>>1]|0,b[d+(n<<1)>>1]|0)|0)|0;p=p+(_(b[l+(~n<<1)>>1]|0,b[d+((n|1)<<1)>>1]|0)|0)|0;n=n+2|0;o=p}p=((b[l+2>>1]<<12)-o>>11)+1>>1;b[a+(m<<1)>>1]=(p|0)>32767?32767:((p|0)<-32768?-32768:p)&65535;m=m+1|0}nf(a|0,0,f<<1|0)|0;return}function te(a,d){a=a|0;d=d|0;var e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0;w=i;i=i+96|0;u=w;e=0;f=0;while(1){if((f|0)>=(d|0))break;t=b[a+(f<<1)>>1]|0;c[u+(f<<2)>>2]=t<<12;e=e+t|0;f=f+1|0}if((e|0)>4095){i=w;return 0}g=1073741824;f=0;a:while(1){t=d+-1|0;a=c[u+(t<<2)>>2]|0;e=(a+16773022|0)>>>0>33546044;if((d|0)<=1){v=44;break}if(e){v=46;break}r=0-(a<<7)|0;s=((r|0)<0)<<31>>31;zf(r|0,s|0,r|0,s|0)|0;h=1073741824-C|0;q=zf(g|0,f|0,h|0,((h|0)<0)<<31>>31|0)|0;q=qf(q|0,C|0,30)|0;q=q&-4;if((q|0)<107374){v=46;break}if((h|0)<=0)if(!h){a=32;e=30;j=0}else{a=0-h|0;v=11}else{a=h;v=11}if((v|0)==11){v=0;j=32-(aa(a|0)|0)|0;a=aa(a|0)|0;e=j+30|0}p=h<>16;g=536870911/(m|0)|0;n=g<<16;o=n>>16;p=536870912-((_(m,o)|0)+((_(p&65535,o)|0)>>16))<<3;g=n+((_(p>>16,o)|0)+((_(p&65528,o)|0)>>16))+(_(p,(g>>15)+1>>1)|0)|0;a=62-a-e|0;if((a|0)<1){f=0-a|0;a=-2147483648>>f;e=2147483647>>>f;if((a|0)>(e|0)){if((g|0)<=(a|0))a=(g|0)<(e|0)?e:g}else if((g|0)>(e|0))a=e;else a=(g|0)<(a|0)?a:g;p=a<>a:0;m=d>>1;n=(j|0)==1;o=((p|0)<0)<<31>>31;j=j+-1|0;l=0;while(1){if((l|0)>=(m|0))break;d=u+(l<<2)|0;g=c[d>>2]|0;k=u+(t-l+-1<<2)|0;h=c[k>>2]|0;a=zf(h|0,((h|0)<0)<<31>>31|0,r|0,s|0)|0;a=qf(a|0,C|0,30)|0;a=of(a|0,C|0,1,0)|0;a=qf(a|0,C|0,1)|0;e=g-a|0;f=(e|0)>-1;if(n){if(f){f=(g&(a^-2147483648)|0)<0?-2147483648:e;f=zf(f|0,((f|0)<0)<<31>>31|0,p|0,o|0)|0;f=pf(f|0,C|0,1)|0;a=(g&(a^-2147483648)|0)<0?-2147483648:e;e=f;f=C}else{f=((g^-2147483648)&a|0)<0?2147483647:e;f=zf(f|0,((f|0)<0)<<31>>31|0,p|0,o|0)|0;f=pf(f|0,C|0,1)|0;a=((g^-2147483648)&a|0)<0?2147483647:e;e=f;f=C}a=zf(a|0,((a|0)<0)<<31>>31|0,p|0,o|0)|0;a=of(e|0,f|0,a&1|0,0)|0;e=C}else{if(f)a=(g&(a^-2147483648)|0)<0?-2147483648:e;else a=((g^-2147483648)&a|0)<0?2147483647:e;a=zf(a|0,((a|0)<0)<<31>>31|0,p|0,o|0)|0;a=pf(a|0,C|0,j|0)|0;a=of(a|0,C|0,1,0)|0;a=pf(a|0,C|0,1)|0;e=C}f=of(a|0,e|0,-2147483648,0)|0;e=C;if(e>>>0>0|(e|0)==0&f>>>0>4294967295){v=46;break a}c[d>>2]=a;a=zf(g|0,((g|0)<0)<<31>>31|0,r|0,s|0)|0;a=qf(a|0,C|0,30)|0;a=of(a|0,C|0,1,0)|0;a=qf(a|0,C|0,1)|0;e=h-a|0;f=(e|0)>-1;if(n){if(f){f=(h&(a^-2147483648)|0)<0?-2147483648:e;f=zf(f|0,((f|0)<0)<<31>>31|0,p|0,o|0)|0;f=pf(f|0,C|0,1)|0;a=(h&(a^-2147483648)|0)<0?-2147483648:e;e=f;f=C}else{f=((h^-2147483648)&a|0)<0?2147483647:e;f=zf(f|0,((f|0)<0)<<31>>31|0,p|0,o|0)|0;f=pf(f|0,C|0,1)|0;a=((h^-2147483648)&a|0)<0?2147483647:e;e=f;f=C}a=zf(a|0,((a|0)<0)<<31>>31|0,p|0,o|0)|0;a=of(e|0,f|0,a&1|0,0)|0;e=C}else{if(f)a=(h&(a^-2147483648)|0)<0?-2147483648:e;else a=((h^-2147483648)&a|0)<0?2147483647:e;a=zf(a|0,((a|0)<0)<<31>>31|0,p|0,o|0)|0;a=pf(a|0,C|0,j|0)|0;a=of(a|0,C|0,1,0)|0;a=pf(a|0,C|0,1)|0;e=C}h=of(a|0,e|0,-2147483648,0)|0;g=C;if(g>>>0>0|(g|0)==0&h>>>0>4294967295){v=46;break a}c[k>>2]=a;l=l+1|0}g=q;f=((q|0)<0)<<31>>31;d=t}if((v|0)==44)if(e){i=w;return 0}else{u=0-(c[u>>2]<<7)|0;v=((u|0)<0)<<31>>31;zf(u|0,v|0,u|0,v|0)|0;v=1073741824-C|0;v=zf(g|0,f|0,v|0,((v|0)<0)<<31>>31|0)|0;v=qf(v|0,C|0,30)|0;v=v&-4;i=w;return ((v|0)<107374?0:v)|0}else if((v|0)==46){i=w;return 0}return 0}function ue(a,e,f){a=a|0;e=e|0;f=f|0;var g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0;s=i;i=i+304|0;n=s+200|0;p=s+148|0;q=s+96|0;r=s;g=(f|0)==16?32909:32925;h=0;while(1){if((h|0)>=(f|0))break;m=b[e+(h<<1)>>1]|0;o=m>>8;l=b[27508+(o<<1)>>1]|0;o=((l<<8)+(_((b[27508+(o+1<<1)>>1]|0)-l|0,m-(o<<8)|0)|0)>>3)+1>>1;c[n+(d[g+h>>0]<<2)>>2]=o;h=h+1|0}o=f>>1;c[p>>2]=65536;m=p+4|0;l=1;g=0-(c[n>>2]|0)|0;while(1){c[m>>2]=g;if((l|0)>=(o|0))break;e=c[n+(l<<1<<2)>>2]|0;k=c[p+(l+-1<<2)>>2]|0;h=((e|0)<0)<<31>>31;g=c[p+(l<<2)>>2]|0;g=zf(e|0,h|0,g|0,((g|0)<0)<<31>>31|0)|0;g=qf(g|0,C|0,15)|0;g=of(g|0,C|0,1,0)|0;g=qf(g|0,C|0,1)|0;j=l+1|0;c[p+(j<<2)>>2]=(k<<1)-g;g=l;while(1){if((g|0)<=1)break;l=c[p+(g+-2<<2)>>2]|0;u=zf(e|0,h|0,k|0,((k|0)<0)<<31>>31|0)|0;u=qf(u|0,C|0,15)|0;u=of(u|0,C|0,1,0)|0;u=qf(u|0,C|0,1)|0;t=p+(g<<2)|0;c[t>>2]=(c[t>>2]|0)+(l-u);k=l;g=g+-1|0}l=j;g=(c[m>>2]|0)-e|0}m=n+4|0;c[q>>2]=65536;n=q+4|0;l=1;g=0-(c[m>>2]|0)|0;while(1){c[n>>2]=g;if((l|0)>=(o|0)){g=0;break}j=c[m+(l<<1<<2)>>2]|0;h=c[q+(l+-1<<2)>>2]|0;k=((j|0)<0)<<31>>31;g=c[q+(l<<2)>>2]|0;g=zf(j|0,k|0,g|0,((g|0)<0)<<31>>31|0)|0;g=qf(g|0,C|0,15)|0;g=of(g|0,C|0,1,0)|0;g=qf(g|0,C|0,1)|0;e=l+1|0;c[q+(e<<2)>>2]=(h<<1)-g;g=l;while(1){if((g|0)<=1)break;u=c[q+(g+-2<<2)>>2]|0;l=zf(j|0,k|0,h|0,((h|0)<0)<<31>>31|0)|0;l=qf(l|0,C|0,15)|0;l=of(l|0,C|0,1,0)|0;l=qf(l|0,C|0,1)|0;t=q+(g<<2)|0;c[t>>2]=(c[t>>2]|0)+(u-l);h=u;g=g+-1|0}l=e;g=(c[n>>2]|0)-j|0}while(1){if((g|0)>=(o|0))break;u=g+1|0;t=(c[p+(u<<2)>>2]|0)+(c[p+(g<<2)>>2]|0)|0;n=(c[q+(u<<2)>>2]|0)-(c[q+(g<<2)>>2]|0)|0;c[r+(g<<2)>>2]=0-n-t;c[r+(f-g+-1<<2)>>2]=n-t;g=u}j=0;g=0;while(1){if((j|0)<10){e=0;h=0}else break;while(1){if((e|0)>=(f|0))break;u=c[r+(e<<2)>>2]|0;u=(u|0)>0?u:0-u|0;t=(u|0)>(h|0);g=t?e:g;e=e+1|0;h=t?u:h}e=(h>>4)+1>>1;if((e|0)<=32767)break;u=(e|0)<163838?e:163838;re(r,f,65470-(((u<<14)+-536854528|0)/((_(u,g+1|0)|0)>>2|0)|0)|0);j=j+1|0}a:do if((j|0)==10){g=0;while(1){if((g|0)>=(f|0)){g=0;break a}u=r+(g<<2)|0;t=(c[u>>2]>>4)+1>>1;t=(t|0)>32767?32767:(t|0)<-32768?-32768:t;b[a+(g<<1)>>1]=t;c[u>>2]=t<<16>>11;g=g+1|0}}else{g=0;while(1){if((g|0)>=(f|0)){g=0;break a}b[a+(g<<1)>>1]=(((c[r+(g<<2)>>2]|0)>>>4)+1|0)>>>1;g=g+1|0}}while(0);while(1){if(!((te(a,f)|0)==0&(g|0)<16))break;re(r,f,65536-(2<=(f|0))break;b[a+(e<<1)>>1]=(((c[r+(e<<2)>>2]|0)>>>4)+1|0)>>>1;e=e+1|0}g=g+1|0}i=s;return}function ve(a,c,d){a=a|0;c=c|0;d=d|0;var f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0;p=a+(d+-1<<1)|0;q=c+(d<<1)|0;n=0;while(1){if((n|0)>=20)break;j=b[a>>1]|0;i=b[c>>1]|0;f=j;g=0;h=1;j=(j<<16>>16)-(i<<16>>16)|0;while(1){if((h|0)>=(d|0))break;k=b[a+(h<<1)>>1]|0;m=(k<<16>>16)-((f<<16>>16)+(b[c+(h<<1)>>1]|0))|0;l=(m|0)<(j|0);f=k;g=l?h:g;h=h+1|0;j=l?m:j}l=32768-((b[p>>1]|0)+(b[q>>1]|0))|0;k=(l|0)<(j|0);m=k?d:g;if(((k?l:j)|0)>-1){o=36;break}do if(!m)b[a>>1]=i;else{if((m|0)==(d|0)){b[p>>1]=32768-(e[q>>1]|0);break}else{f=0;i=0}while(1){if((f|0)>=(m|0))break;l=i+(b[c+(f<<1)>>1]|0)|0;f=f+1|0;i=l}k=c+(m<<1)|0;l=b[k>>1]|0;g=l>>1;f=d;h=32768;while(1){if((f|0)<=(m|0))break;j=h-(b[c+(f<<1)>>1]|0)|0;f=f+-1|0;h=j}f=i+g|0;h=h-g|0;j=a+(m+-1<<1)|0;r=b[j>>1]|0;i=a+(m<<1)|0;g=b[i>>1]|0;g=((r<<16>>16)+(g<<16>>16)>>1)+((r&65535)+(g&65535)&1)|0;if((f|0)>(h|0)){if((g|0)<=(f|0))f=(g|0)<(h|0)?h:g}else if((g|0)>(h|0))f=h;else f=(g|0)<(f|0)?f:g;r=f-(l>>>1)|0;b[j>>1]=r;b[i>>1]=r+(e[k>>1]|0)}while(0);n=n+1|0}if((o|0)==36)return;if((n|0)==20)h=1;else return;while(1){if((h|0)>=(d|0))break;f=b[a+(h<<1)>>1]|0;j=h;while(1){i=j+-1|0;if((j|0)<=0)break;g=b[a+(i<<1)>>1]|0;if(f<<16>>16>=g<<16>>16)break;b[a+(j<<1)>>1]=g;j=i}b[a+(j<<1)>>1]=f;h=h+1|0}g=b[a>>1]|0;f=b[c>>1]|0;f=g<<16>>16>f<<16>>16?g:f;b[a>>1]=f;f=f<<16>>16;g=1;while(1){if((g|0)>=(d|0))break;o=a+(g<<1)|0;n=b[o>>1]|0;r=f+(b[c+(g<<1)>>1]|0)|0;r=(r|0)>32767?32767:((r|0)<-32768?-32768:r)<<16>>16;r=(n|0)>(r|0)?n:r;b[o>>1]=r;f=r;g=g+1|0}f=b[p>>1]|0;g=32768-(b[q>>1]|0)|0;g=(f|0)<(g|0)?f:g;b[p>>1]=g;f=d+-2|0;while(1){if((f|0)<=-1)break;d=a+(f<<1)|0;q=b[d>>1]|0;r=(g<<16>>16)-(b[c+(f+1<<1)>>1]|0)|0;r=(q|0)<(r|0)?q:r;b[d>>1]=r;g=r;f=f+-1|0}return}function we(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0;e=b[c>>1]|0;f=(b[c+2>>1]|0)-(e<<16>>16)|0;f=131072/(((f|0)>1?f:1)|0)|0;e=(131072/((e<<16>>16>1?e:1)<<16>>16|0)|0)+f|0;b[a>>1]=(e|0)<32767?e:32767;d=d+-1|0;e=1;while(1){if((e|0)>=(d|0))break;i=e+1|0;g=c+(i<<1)|0;j=(b[g>>1]|0)-(b[c+(e<<1)>>1]|0)|0;j=131072/(((j|0)>1?j:1)|0)|0;h=j+f|0;b[a+(e<<1)>>1]=(h|0)<32767?h:32767;h=e+2|0;g=(b[c+(h<<1)>>1]|0)-(b[g>>1]|0)|0;g=131072/(((g|0)>1?g:1)|0)|0;j=j+g|0;b[a+(i<<1)>>1]=(j|0)<32767?j:32767;e=h;f=g}j=32768-(b[c+(d<<1)>>1]|0)|0;j=(131072/(((j|0)>1?j:1)|0)|0)+f|0;b[a+(d<<1)>>1]=(j|0)<32767?j:32767;return}function xe(a,d,e,f){a=a|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0;f=f>>1;g=a+4|0;h=0;while(1){if((h|0)>=(f|0))break;m=h<<1;l=b[e+(m<<1)>>1]<<10;j=l-(c[a>>2]|0)|0;k=(_(j>>16,-25727)|0)+((_(j&65535,-25727)|0)>>16)|0;c[a>>2]=l+(j+k);m=b[e+((m|1)<<1)>>1]<<10;j=c[g>>2]|0;i=m-j|0;i=((i>>16)*9872|0)+(((i&65535)*9872|0)>>>16)|0;c[g>>2]=m+i;i=(l+k+j+i>>10)+1>>1;b[d+(h<<1)>>1]=(i|0)>32767?32767:((i|0)<-32768?-32768:i)&65535;h=h+1|0}return}function ye(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0;f=0;while(1){if((f|0)>=(e|0)){h=1;break}c[b+(f<<2)>>2]=f;f=f+1|0}while(1){if((h|0)>=(e|0))break;g=c[a+(h<<2)>>2]|0;j=h;while(1){i=j+-1|0;if((j|0)<=0)break;f=c[a+(i<<2)>>2]|0;if((g|0)>=(f|0))break;c[a+(j<<2)>>2]=f;c[b+(j<<2)>>2]=c[b+(i<<2)>>2];j=i}c[a+(j<<2)>>2]=g;c[b+(j<<2)>>2]=h;h=h+1|0}j=a+(e+-1<<2)|0;k=e+-2|0;h=e;while(1){if((h|0)>=(d|0))break;f=c[a+(h<<2)>>2]|0;if((f|0)<(c[j>>2]|0)){i=k;while(1){if((i|0)<=-1)break;g=c[a+(i<<2)>>2]|0;if((f|0)>=(g|0))break;e=i+1|0;c[a+(e<<2)>>2]=g;c[b+(e<<2)>>2]=c[b+(i<<2)>>2];i=i+-1|0}e=i+1|0;c[a+(e<<2)>>2]=f;c[b+(e<<2)>>2]=h}h=h+1|0}return}function ze(a,d,e,f){a=a|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0;j=31-(aa(f|0)|0)|0;k=f+-1|0;h=((k|0)>0?k:0)+1&-2;i=0;g=f;while(1){if((i|0)>=(k|0))break;m=b[e+(i<<1)>>1]|0;m=_(m,m)|0;l=b[e+((i|1)<<1)>>1]|0;i=i+2|0;g=g+((m+(_(l,l)|0)|0)>>>j)|0}if((h|0)<(f|0)){m=b[e+(h<<1)>>1]|0;g=g+((_(m,m)|0)>>>j)|0}g=j+3-(aa(g|0)|0)|0;g=(g|0)<0?0:g;h=f+-1|0;h=((h|0)>0?h:0)+1&-2;i=0;j=0;while(1){if((i|0)>=(k|0))break;l=b[e+(i<<1)>>1]|0;l=_(l,l)|0;m=b[e+((i|1)<<1)>>1]|0;i=i+2|0;j=j+((l+(_(m,m)|0)|0)>>>g)|0}if((h|0)>=(f|0)){m=j;c[d>>2]=g;c[a>>2]=m;return}m=b[e+(h<<1)>>1]|0;m=j+((_(m,m)|0)>>>g)|0;c[d>>2]=g;c[a>>2]=m;return}function Ae(a,b,c,d,e,f){a=a|0;b=b|0;c=+c;d=d|0;e=e|0;f=f|0;var j=0.0,k=0,l=0,m=0,n=0.0,o=0,p=0.0,q=0,r=0,s=0.0,t=0.0,u=0.0,v=0,w=0,x=0,y=0,z=0,A=0,B=0.0,C=0,D=0,E=0,F=0.0,G=0.0,H=0.0,I=0;E=i;i=i+976|0;y=E+784|0;z=E+592|0;C=E+392|0;x=E+192|0;D=E;j=+Ud(b,_(e,d)|0);nf(y|0,0,192)|0;m=0;while(1){if((m|0)>=(e|0))break;k=b+((_(m,d)|0)<<2)|0;l=1;while(1){if((l|0)>(f|0))break;B=+Vd(k,k+(l<<2)|0,d-l|0);w=y+(l+-1<<3)|0;h[w>>3]=+h[w>>3]+B;l=l+1|0}m=m+1|0}rf(z|0,y|0,192)|0;B=j*9.999999747378752e-06;u=j+B+9.999999717180685e-10;h[C>>3]=u;h[x>>3]=u;u=c;v=1;l=0;w=2;t=1.0;while(1){if((l|0)>=(f|0))break;m=d-l|0;o=m+-1|0;r=0;while(1){if((r|0)>=(e|0))break;q=b+((_(r,d)|0)<<2)|0;c=+g[q+(l<<2)>>2];n=+g[q+(o<<2)>>2];k=0;p=c;s=n;while(1){if((l|0)==(k|0)){k=0;break}H=+g[q+(l-k+-1<<2)>>2];I=y+(k<<3)|0;h[I>>3]=+h[I>>3]-c*H;G=+g[q+(m+k<<2)>>2];I=z+(k<<3)|0;h[I>>3]=+h[I>>3]-n*G;F=+h[D+(k<<3)>>3];k=k+1|0;p=p+H*F;s=s+G*F}while(1){if((k|0)==(v|0))break;I=C+(k<<3)|0;h[I>>3]=+h[I>>3]-p*+g[q+(l-k<<2)>>2];I=x+(k<<3)|0;h[I>>3]=+h[I>>3]-s*+g[q+(m+k+-1<<2)>>2];k=k+1|0}r=r+1|0}k=0;c=+h[y+(l<<3)>>3];p=+h[z+(l<<3)>>3];while(1){if((l|0)==(k|0))break;H=+h[D+(k<<3)>>3];I=l-k+-1|0;k=k+1|0;c=c+ +h[z+(I<<3)>>3]*H;p=p+ +h[y+(I<<3)>>3]*H}q=l+1|0;h[C+(q<<3)>>3]=c;h[x+(q<<3)>>3]=p;k=0;c=+h[x>>3];n=+h[C>>3];while(1){if((l|0)==(k|0))break;G=+h[D+(k<<3)>>3];I=k+1|0;H=p+ +h[x+(l-k<<3)>>3]*G;k=I;c=c+ +h[x+(I<<3)>>3]*G;n=n+ +h[C+(I<<3)>>3]*G;p=H}n=p*-2.0/(n+c);c=t*(1.0-n*n);if(!(c<=u))k=0;else{n=+O(+(1.0-u/t));c=u;n=p>0.0?-n:n;k=1}m=q>>1;o=0;while(1){if((o|0)>=(m|0))break;r=D+(o<<3)|0;H=+h[r>>3];I=D+(l-o+-1<<3)|0;G=+h[I>>3];h[r>>3]=H+n*G;h[I>>3]=G+n*H;o=o+1|0}h[D+(l<<3)>>3]=n;if(!k)k=0;else{A=29;break}while(1){if((k|0)==(w|0))break;r=C+(k<<3)|0;H=+h[r>>3];I=x+(l-k+1<<3)|0;G=+h[I>>3];h[r>>3]=H+n*G;h[I>>3]=G+n*H;k=k+1|0}v=v+1|0;l=q;w=w+1|0;t=c}if((A|0)==29){while(1){l=l+1|0;if((l|0)>=(f|0))break;h[D+(l<<3)>>3]=0.0;A=29}if(k|0){k=0;while(1){if((k|0)>=(f|0)){k=0;break}g[a+(k<<2)>>2]=-+h[D+(k<<3)>>3];k=k+1|0}while(1){if((k|0)>=(e|0))break;j=j-+Ud(b+((_(k,d)|0)<<2)|0,f);k=k+1|0}H=j*c;i=E;return +H}}k=0;j=+h[C>>3];c=1.0;while(1){if((k|0)>=(f|0))break;H=+h[D+(k<<3)>>3];I=k+1|0;G=+h[C+(I<<3)>>3];g[a+(k<<2)>>2]=-H;k=I;j=j+G*H;c=c+H*H}H=j-B*c;i=E;return +H}function Be(a,d,e,f){a=a|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0;I=i;i=i+32|0;H=I;o=a+2772|0;g=a+2316|0;j=a+4156|0;if((c[g>>2]|0)!=(c[j>>2]|0)){k=a+2340|0;h=c[k>>2]|0;l=32767/(h+1|0)|0;m=0;n=0;while(1){if((n|0)>=(h|0))break;G=m+l|0;b[a+4052+(n<<1)>>1]=G;h=c[k>>2]|0;m=G;n=n+1|0}c[a+4148>>2]=0;c[a+4152>>2]=3176576;c[j>>2]=c[g>>2]}m=a+4160|0;do if(!(c[m>>2]|0)){if(!(c[a+4164>>2]|0)){g=a+2340|0;h=0;while(1){if((h|0)>=(c[g>>2]|0))break;E=b[a+2344+(h<<1)>>1]|0;G=a+4052+(h<<1)|0;D=b[G>>1]|0;F=D&65535;b[G>>1]=F+((((E<<16>>16)-(D<<16>>16)>>16)*16348|0)+((((E&65535)-F&65535)*16348|0)>>>16));h=h+1|0}l=a+2324|0;g=c[l>>2]|0;h=0;j=0;k=0;while(1){if((h|0)>=(g|0))break;F=c[d+16+(h<<2)>>2]|0;E=(F|0)>(j|0);G=E?h:k;h=h+1|0;j=E?F:j;k=G}j=a+2332|0;h=c[j>>2]|0;sf(a+2772+(h<<2)|0,o|0,(_(g+-1|0,h)|0)<<2|0)|0;j=c[j>>2]|0;rf(o|0,a+4+((_(k,j)|0)<<2)|0,j<<2|0)|0;j=a+4148|0;g=c[l>>2]|0;h=0;while(1){if((h|0)>=(g|0))break;F=c[j>>2]|0;G=(c[d+16+(h<<2)>>2]|0)-F|0;c[j>>2]=F+(((G>>16)*4634|0)+(((G&65535)*4634|0)>>>16));h=h+1|0}if(c[m>>2]|0)break}nf(a+4084|0,0,c[a+2340>>2]<<2|0)|0;i=I;return}while(0);F=Fa()|0;G=i;i=i+((1*(f+16<<2)|0)+15&-16)|0;E=b[a+4224>>1]|0;g=E<<16>>16;h=c[a+4244>>2]|0;k=h<<16>>16;h=(_(g>>16,k)|0)+((_(E&65535,k)|0)>>16)+(_(g,(h>>15)+1>>1)|0)|0;g=c[a+4148>>2]|0;k=h>>16;if((h|0)>2097151|(g|0)>8388608){j=g>>16;j=_(j,j)|0;h=(_(k,k)|0)<<5;g=j-h|0;if((g|0)<1)m=0;else{k=aa(g|0)|0;k=(j|0)==(h|0)?32:k;h=24-k|0;j=0-h|0;do if(h)if((h|0)<0){g=g<>>(h+32|0);break}else{g=g<<32-h|g>>>h;break}while(0);E=((k&1|0)==0?46214:32768)>>>(k>>>1);m=(_(g&127,13959168)|0)>>>16;m=E+((_(E>>16,m)|0)+((_(E&65535,m)|0)>>>16))<<16}}else{E=h<<16>>16;j=g<<16>>16;j=(_(g>>16,j)|0)+((_(g&65535,j)|0)>>16)+(_(g,(g>>15)+1>>1)|0)|0;h=(_(k,E)|0)+((_(h&65535,E)|0)>>16)+(_(h,(h>>15)+1>>1)|0)<<5;g=j-h|0;if((g|0)<1)m=0;else{k=aa(g|0)|0;k=(j|0)==(h|0)?32:k;h=24-k|0;j=0-h|0;do if(h)if((h|0)<0){g=g<>>(h+32|0);break}else{g=g<<32-h|g>>>h;break}while(0);E=((k&1|0)==0?46214:32768)>>>(k>>>1);m=(_(g&127,13959168)|0)>>>16;m=E+((_(E>>16,m)|0)+((_(E&65535,m)|0)>>>16))<<8}}g=G+64|0;j=255;while(1){if((j|0)<=(f|0))break;j=j>>1}h=a+4152|0;k=0;l=c[h>>2]|0;while(1){if((k|0)>=(f|0))break;E=(_(l,196314165)|0)+907633515|0;c[g+(k<<2)>>2]=c[a+2772+((E>>24&j)<<2)>>2];k=k+1|0;l=E}c[h>>2]=l;E=a+2340|0;ue(H,a+4052|0,c[E>>2]|0);D=a+4084|0;g=G;h=D;j=g+64|0;do{c[g>>2]=c[h>>2];g=g+4|0;h=h+4|0}while((g|0)<(j|0));a=b[H>>1]|0;p=b[H+2>>1]|0;q=b[H+4>>1]|0;r=b[H+6>>1]|0;s=b[H+8>>1]|0;t=b[H+10>>1]|0;u=b[H+12>>1]|0;v=b[H+14>>1]|0;w=b[H+16>>1]|0;x=b[H+18>>1]|0;y=b[H+20>>1]|0;z=b[H+22>>1]|0;A=b[H+24>>1]|0;B=b[H+26>>1]|0;C=b[H+28>>1]|0;o=b[H+30>>1]|0;d=m<<10>>16;m=(m>>21)+1>>1;n=0;while(1){if((n|0)>=(f|0))break;H=c[G+(n+15<<2)>>2]|0;H=(c[E>>2]>>1)+((_(H>>16,a)|0)+((_(H&65535,a)|0)>>16))|0;g=c[G+(n+14<<2)>>2]|0;g=H+((_(g>>16,p)|0)+((_(g&65535,p)|0)>>16))|0;H=c[G+(n+13<<2)>>2]|0;H=g+((_(H>>16,q)|0)+((_(H&65535,q)|0)>>16))|0;g=c[G+(n+12<<2)>>2]|0;g=H+((_(g>>16,r)|0)+((_(g&65535,r)|0)>>16))|0;H=c[G+(n+11<<2)>>2]|0;H=g+((_(H>>16,s)|0)+((_(H&65535,s)|0)>>16))|0;g=c[G+(n+10<<2)>>2]|0;g=H+((_(g>>16,t)|0)+((_(g&65535,t)|0)>>16))|0;H=c[G+(n+9<<2)>>2]|0;H=g+((_(H>>16,u)|0)+((_(H&65535,u)|0)>>16))|0;g=c[G+(n+8<<2)>>2]|0;g=H+((_(g>>16,v)|0)+((_(g&65535,v)|0)>>16))|0;H=c[G+(n+7<<2)>>2]|0;H=g+((_(H>>16,w)|0)+((_(H&65535,w)|0)>>16))|0;g=c[G+(n+6<<2)>>2]|0;g=H+((_(g>>16,x)|0)+((_(g&65535,x)|0)>>16))|0;if((c[E>>2]|0)==16){H=c[G+(n+5<<2)>>2]|0;H=g+((_(H>>16,y)|0)+((_(H&65535,y)|0)>>16))|0;g=c[G+(n+4<<2)>>2]|0;g=H+((_(g>>16,z)|0)+((_(g&65535,z)|0)>>16))|0;H=c[G+(n+3<<2)>>2]|0;H=g+((_(H>>16,A)|0)+((_(H&65535,A)|0)>>16))|0;g=c[G+(n+2<<2)>>2]|0;g=H+((_(g>>16,B)|0)+((_(g&65535,B)|0)>>16))|0;H=c[G+(n+1<<2)>>2]|0;H=g+((_(H>>16,C)|0)+((_(H&65535,C)|0)>>16))|0;g=c[G+(n<<2)>>2]|0;g=H+((_(g>>16,o)|0)+((_(g&65535,o)|0)>>16))|0}l=G+(n+16<<2)|0;h=c[l>>2]|0;j=(g|0)>134217727;k=j?2147483632:((g|0)<-134217728?-134217728:g)<<4;if((h+(j?2147483632:((g|0)<-134217728?-134217728:g)<<4)|0)>-1)if((h&k|0)<0)g=-2147483648;else g=h+(j?2147483632:((g|0)<-134217728?-134217728:g)<<4)|0;else if((h|k|0)>-1)g=2147483647;else g=h+(j?2147483632:((g|0)<-134217728?-134217728:g)<<4)|0;c[l>>2]=g;k=e+(n<<1)|0;j=b[k>>1]|0;g=((_(g>>16,d)|0)+((_(g&65535,d)|0)>>16)+(_(g,m)|0)>>7)+1>>1;h=(g|0)>32767;if((j+(h?32767:(g|0)<-32768?-32768:g)|0)<=32767)if((j+(h?32767:(g|0)<-32768?-32768:g)|0)<-32768)g=-32768;else g=j+(h?32767:(g|0)<-32768?-32768:g)|0;else g=32767;b[k>>1]=g;n=n+1|0}g=D;h=G+(f<<2)|0;j=g+64|0;do{c[g>>2]=c[h>>2];g=g+4|0;h=h+4|0}while((g|0)<(j|0));Na(F|0);i=I;return}function Ce(d,e,f,g){d=d|0;e=e|0;f=f|0;g=g|0;var h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,$=0,ba=0,ca=0,da=0,ea=0,fa=0;ea=i;i=i+32|0;da=ea;W=d+2336|0;ba=c[W>>2]|0;Z=i;i=i+((1*(ba<<1)|0)+15&-16)|0;o=d+2328|0;j=c[o>>2]|0;$=i;i=i+((1*(ba+j<<2)|0)+15&-16)|0;ba=d+2332|0;n=c[ba>>2]|0;ca=i;i=i+((1*(n<<2)|0)+15&-16)|0;X=i;i=i+((1*(n+16<<2)|0)+15&-16)|0;n=b[d+2766>>1]|0;Y=d+2765|0;q=(n&65535)>>>8&255;n=b[25404+(a[Y>>0]>>1<<2)+((n&65535)<<24>>24<<1)>>1]<<4;p=0;h=a[d+2770>>0]|0;while(1){if((p|0)>=(j|0))break;l=(_(h,196314165)|0)+907633515|0;m=g+(p<<1)|0;j=b[m>>1]|0;h=j<<16>>16<<14;k=d+4+(p<<2)|0;c[k>>2]=h;if(j<<16>>16<=0){if(j<<16>>16<0){h=h|1280;c[k>>2]=h}}else{h=h+-1280|0;c[k>>2]=h}j=h+n|0;c[k>>2]=(l|0)<0?0-j|0:j;j=c[o>>2]|0;p=p+1|0;h=l+(b[m>>1]|0)|0}Q=d+1284|0;h=X;j=Q;k=h+64|0;do{c[h>>2]=c[j>>2];h=h+4|0;j=j+4|0}while((h|0)<(k|0));R=d+2324|0;S=d+2340|0;T=d+4160|0;U=e+136|0;u=q<<24>>24>3;v=da+2|0;w=da+4|0;x=da+6|0;y=da+8|0;z=da+10|0;A=da+12|0;B=da+14|0;D=da+16|0;E=da+18|0;F=da+20|0;G=da+22|0;H=da+24|0;I=da+26|0;J=da+28|0;K=da+30|0;L=d+4164|0;M=d+2308|0;N=0;O=d+4|0;P=f;g=c[W>>2]|0;while(1){if((N|0)>=(c[R>>2]|0))break;o=e+32+(N>>1<<5)|0;rf(da|0,o|0,c[S>>2]<<1|0)|0;r=e+96+(N*5<<1)|0;n=a[Y>>0]|0;t=c[e+16+(N<<2)>>2]|0;s=t>>>6;m=(t|0)>0;if(!m)if(!t)h=32;else{h=0-t|0;V=12}else{h=t;V=12}if((V|0)==12){V=0;h=aa(h|0)|0}j=t<>16;l=536870911/(k|0)|0;p=l<<16;q=p>>16;j=536870912-((_(k,q)|0)+((_(j&65535,q)|0)>>16))<<3;l=p+((_(j>>16,q)|0)+((_(j&65528,q)|0)>>16))+(_(j,(l>>15)+1>>1)|0)|0;h=62-h|0;j=h+-47|0;if((j|0)<1){k=47-h|0;h=-2147483648>>k;j=2147483647>>>k;if((h|0)>(j|0)){if((l|0)<=(h|0))h=(l|0)<(j|0)?j:l}else if((l|0)>(j|0))h=j;else h=(l|0)<(h|0)?h:l;h=h<>j:0;k=c[d>>2]|0;a:do if((t|0)==(k|0))m=65536;else{if((k|0)<=0)if(!k)l=32;else{j=0-k|0;V=24}else{j=k;V=24}if((V|0)==24){V=0;l=aa(j|0)|0}k=k<>16|0)|0)<<16>>16;q=(_(k>>16,m)|0)+((_(k&65535,m)|0)>>16)|0;p=zf(p|0,((p|0)<0)<<31>>31|0,q|0,((q|0)<0)<<31>>31|0)|0;p=qf(p|0,C|0,29)|0;k=k-(p&-8)|0;m=q+((_(k>>16,m)|0)+((_(k&65535,m)|0)>>16))|0;j=l+28-j|0;k=j+-16|0;if((j|0)<16){l=16-j|0;j=-2147483648>>l;k=2147483647>>>l;if((j|0)>(k|0)){if((m|0)<=(j|0))j=(m|0)<(k|0)?k:m}else if((m|0)>(k|0))j=k;else j=(m|0)<(j|0)?j:m;j=j<>k:0;k=j>>16;l=j&65535;m=0;while(1){if((m|0)==16){m=j;break a}q=X+(m<<2)|0;p=c[q>>2]|0;fa=p<<16>>16;c[q>>2]=(_(k,fa)|0)+((_(l,fa)|0)>>16)+(_(j,(p>>15)+1>>1)|0);m=m+1|0}}while(0);c[d>>2]=t;if((c[T>>2]|0)!=0?n<<24>>24!=2&(c[L>>2]|0)==2&(N|0)<2:0){b[r>>1]=0;b[r+2>>1]=0;b[r+4>>1]=0;b[r+6>>1]=0;b[r+8>>1]=0;b[r+4>>1]=4096;q=c[M>>2]|0;c[e+(N<<2)>>2]=q;V=44}else if(n<<24>>24==2){q=c[e+(N<<2)>>2]|0;V=44}else p=O;b:do if((V|0)==44){V=0;n=(N|0)==0;c:do if(!n){if(!((N|0)!=2|u)){k=c[W>>2]|0;l=c[S>>2]|0;j=k-q-l+-2|0;if((N|0)!=2){V=49;break}rf(d+1348+(k<<1)|0,f|0,c[ba>>2]<<2|0)|0;k=c[W>>2]|0;l=c[S>>2]|0;V=49;break}if((m|0)!=65536){h=q+2|0;j=m>>16;k=m&65535;l=0;while(1){if((l|0)>=(h|0))break c;fa=$+(g-l+-1<<2)|0;p=c[fa>>2]|0;o=p<<16>>16;c[fa>>2]=(_(j,o)|0)+((_(k,o)|0)>>16)+(_(m,(p>>15)+1>>1)|0);l=l+1|0}}}else{k=c[W>>2]|0;l=c[S>>2]|0;j=k-q-l+-2|0;V=49}while(0);d:do if((V|0)==49){V=0;se(Z+(j<<1)|0,d+1348+(j+(_(N,c[ba>>2]|0)|0)<<1)|0,o,k-j|0,l);if(n){fa=c[U>>2]<<16>>16;h=(_(h>>16,fa)|0)+((_(h&65535,fa)|0)>>16)<<2}k=q+2|0;l=h>>16;h=h&65535;j=0;while(1){if((j|0)>=(k|0))break d;fa=b[Z+((c[W>>2]|0)-j+-1<<1)>>1]|0;c[$+(g-j+-1<<2)>>2]=(_(l,fa)|0)+((_(h,fa)|0)>>16);j=j+1|0}}while(0);l=r+2|0;m=r+4|0;n=r+6|0;o=r+8|0;k=c[ba>>2]|0;p=0;h=$+(g-q+2<<2)|0;j=g;while(1){if((p|0)>=(k|0)){p=ca;g=j;break b}q=c[h>>2]|0;fa=b[r>>1]|0;fa=(_(q>>16,fa)|0)+((_(q&65535,fa)|0)>>16)+2|0;q=c[h+-4>>2]|0;g=b[l>>1]|0;g=fa+((_(q>>16,g)|0)+((_(q&65535,g)|0)>>16))|0;q=c[h+-8>>2]|0;fa=b[m>>1]|0;fa=g+((_(q>>16,fa)|0)+((_(q&65535,fa)|0)>>16))|0;q=c[h+-12>>2]|0;g=b[n>>1]|0;g=fa+((_(q>>16,g)|0)+((_(q&65535,g)|0)>>16))|0;q=c[h+-16>>2]|0;fa=b[o>>1]|0;fa=g+((_(q>>16,fa)|0)+((_(q&65535,fa)|0)>>16))|0;fa=(c[O+(p<<2)>>2]|0)+(fa<<1)|0;c[ca+(p<<2)>>2]=fa;c[$+(j<<2)>>2]=fa<<1;p=p+1|0;h=h+4|0;j=j+1|0}}while(0);o=s<<16>>16;m=(t>>21)+1>>1;n=0;while(1){l=c[ba>>2]|0;if((n|0)>=(l|0))break;fa=c[X+(n+15<<2)>>2]|0;t=b[da>>1]|0;t=(c[S>>2]>>1)+((_(fa>>16,t)|0)+((_(fa&65535,t)|0)>>16))|0;fa=c[X+(n+14<<2)>>2]|0;h=b[v>>1]|0;h=t+((_(fa>>16,h)|0)+((_(fa&65535,h)|0)>>16))|0;fa=c[X+(n+13<<2)>>2]|0;t=b[w>>1]|0;t=h+((_(fa>>16,t)|0)+((_(fa&65535,t)|0)>>16))|0;fa=c[X+(n+12<<2)>>2]|0;h=b[x>>1]|0;h=t+((_(fa>>16,h)|0)+((_(fa&65535,h)|0)>>16))|0;fa=c[X+(n+11<<2)>>2]|0;t=b[y>>1]|0;t=h+((_(fa>>16,t)|0)+((_(fa&65535,t)|0)>>16))|0;fa=c[X+(n+10<<2)>>2]|0;h=b[z>>1]|0;h=t+((_(fa>>16,h)|0)+((_(fa&65535,h)|0)>>16))|0;fa=c[X+(n+9<<2)>>2]|0;t=b[A>>1]|0;t=h+((_(fa>>16,t)|0)+((_(fa&65535,t)|0)>>16))|0;fa=c[X+(n+8<<2)>>2]|0;h=b[B>>1]|0;h=t+((_(fa>>16,h)|0)+((_(fa&65535,h)|0)>>16))|0;fa=c[X+(n+7<<2)>>2]|0;t=b[D>>1]|0;t=h+((_(fa>>16,t)|0)+((_(fa&65535,t)|0)>>16))|0;fa=c[X+(n+6<<2)>>2]|0;h=b[E>>1]|0;h=t+((_(fa>>16,h)|0)+((_(fa&65535,h)|0)>>16))|0;if((c[S>>2]|0)==16){fa=c[X+(n+5<<2)>>2]|0;t=b[F>>1]|0;t=h+((_(fa>>16,t)|0)+((_(fa&65535,t)|0)>>16))|0;fa=c[X+(n+4<<2)>>2]|0;h=b[G>>1]|0;h=t+((_(fa>>16,h)|0)+((_(fa&65535,h)|0)>>16))|0;fa=c[X+(n+3<<2)>>2]|0;t=b[H>>1]|0;t=h+((_(fa>>16,t)|0)+((_(fa&65535,t)|0)>>16))|0;fa=c[X+(n+2<<2)>>2]|0;h=b[I>>1]|0;h=t+((_(fa>>16,h)|0)+((_(fa&65535,h)|0)>>16))|0;fa=c[X+(n+1<<2)>>2]|0;t=b[J>>1]|0;t=h+((_(fa>>16,t)|0)+((_(fa&65535,t)|0)>>16))|0;fa=c[X+(n<<2)>>2]|0;h=b[K>>1]|0;h=t+((_(fa>>16,h)|0)+((_(fa&65535,h)|0)>>16))|0}j=c[p+(n<<2)>>2]|0;k=(h|0)>134217727;l=k?2147483632:((h|0)<-134217728?-134217728:h)<<4;if((j+(k?2147483632:((h|0)<-134217728?-134217728:h)<<4)|0)>-1)if((j&l|0)<0)h=-2147483648;else h=j+(k?2147483632:((h|0)<-134217728?-134217728:h)<<4)|0;else if((j|l|0)>-1)h=2147483647;else h=j+(k?2147483632:((h|0)<-134217728?-134217728:h)<<4)|0;c[X+(n+16<<2)>>2]=h;fa=((_(h>>16,o)|0)+((_(h&65535,o)|0)>>16)+(_(h,m)|0)>>7)+1>>1;b[P+(n<<1)>>1]=(fa|0)>32767?32767:((fa|0)<-32768?-32768:fa)&65535;n=n+1|0}h=X;j=X+(l<<2)|0;k=h+64|0;do{c[h>>2]=c[j>>2];h=h+4|0;j=j+4|0}while((h|0)<(k|0));N=N+1|0;O=O+(l<<2)|0;P=P+(l<<1)|0}h=Q;j=X;k=h+64|0;do{c[h>>2]=c[j>>2];h=h+4|0;j=j+4|0}while((h|0)<(k|0));i=ea;return}function De(f,g,h,j,k,l,m){f=f|0;g=g|0;h=h|0;j=j|0;k=k|0;l=l|0;m=m|0;var n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,$=0,ba=0,ca=0,da=0,ea=0,fa=0,ga=0,ha=0,ia=0;fa=i;i=i+448|0;Z=fa+232|0;Y=fa+376|0;da=fa+344|0;S=fa+200|0;U=fa+184|0;T=fa+168|0;$=fa+88|0;ba=fa+8|0;W=fa;ea=fa+312|0;V=fa+280|0;ca=fa+360|0;X=fa+248|0;Q=h+2|0;ve(g,c[h+36>>2]|0,b[Q>>1]|0);n=c[h>>2]|0;w=i;i=i+((1*((n&65535)<<2)|0)+15&-16)|0;R=h+8|0;P=h+12|0;v=n<<16>>16;n=n>>16;o=c[R>>2]|0;p=0;u=c[P>>2]|0;while(1){if((p|0)<(v|0)){r=n;s=0;t=0}else break;while(1){q=r+-2|0;if((q|0)<=-1)break;M=r+-1|0;M=_((e[g+(M<<1)>>1]|0)-(d[o+M>>0]<<7)<<16>>16,b[u+(M<<1)>>1]|0)|0;L=s>>1;O=_((e[g+(q<<1)>>1]|0)-(d[o+q>>0]<<7)<<16>>16,b[u+(q<<1)>>1]|0)|0;N=M>>1;r=q;s=O;t=t+((M|0)>(L|0)?M-L|0:L-M|0)+((O|0)>(N|0)?O-N|0:N-O|0)|0}c[w+(p<<2)>>2]=t;o=o+n|0;p=p+1|0;u=u+(n<<1)|0}O=i;i=i+((1*(l<<2)|0)+15&-16)|0;ye(w,O,v,l);J=i;i=i+((1*(l<<2)|0)+15&-16)|0;K=i;i=i+((1*(l<<4)|0)+15&-16)|0;L=h+32|0;M=h+4|0;N=k<<16>>16;H=m>>1;I=h+16|0;F=k<<14>>16;G=0;while(1){if((G|0)>=(l|0))break;E=c[O+(G<<2)>>2]|0;r=b[Q>>1]|0;t=_(E,r)|0;s=(c[R>>2]|0)+t|0;t=(c[P>>2]|0)+(t<<1)|0;u=0;while(1){if((u|0)>=(r|0))break;D=b[t+(u<<1)>>1]|0;b[ea+(u<<1)>>1]=(_((e[g+(u<<1)>>1]|0)-(d[s+u>>0]<<7)<<16>>16,D)|0)>>>14;o=b[j+(u<<1)>>1]|0;A=o<<16>>16;D=_(D,D)|0;o=aa((o<<16>>16>0?A:0-A|0)|0)|0;A=A<>16|0)|0)<<16>>16;B=(_(A>>16,q)|0)+((_(A&65535,q)|0)>>16)|0;D=zf(D|0,((D|0)<0)<<31>>31|0,B|0,((B|0)<0)<<31>>31|0)|0;D=qf(D|0,C|0,29)|0;D=A-(D&-8)|0;q=B+((_(D>>16,q)|0)+((_(D&65535,q)|0)>>16))|0;n=o+28-n|0;o=n+-21|0;if((n|0)<21){p=21-n|0;n=-2147483648>>p;o=2147483647>>>p;if((n|0)>(o|0)){if((q|0)<=(n|0))n=(q|0)<(o|0)?o:q}else if((q|0)>(o|0))n=o;else n=(q|0)<(n|0)?n:q;n=n<>o:0;b[V+(u<<1)>>1]=n;u=u+1|0}Cd(X,ca,h,E);D=G<<4;B=c[L>>2]|0;s=c[M>>2]|0;p=s<<16>>16;q=b[Q>>1]|0;r=-10;while(1){if((r|0)==10)break;n=r<<10;o=n+1024|0;a:do if((r|0)>0){n=(r<<26>>16)+-102|0;o=(o<<16>>16)+-102|0}else{switch(r|0){case 0:{o=(o<<16>>16)+-102|0;break a}case -1:{n=-1024;break}default:o=o|102}n=n|102}while(0);A=r+10|0;c[$+(A<<2)>>2]=(_(n<<16>>16,p)|0)>>16;c[ba+(A<<2)>>2]=(_(o<<16>>16,p)|0)>>16;r=r+1|0}c[S>>2]=0;b[da>>1]=0;A=q<<16>>16;y=s>>16;n=A;x=1;b:while(1){z=x<<1;m=(z|0)<5;c:while(1){k=n+-1|0;if((n|0)<=0){s=2147483647;q=0;n=0;break b}o=B+(b[X+(k<<1)>>1]|0)|0;p=b[ea+(k<<1)>>1]|0;q=ca+k|0;r=V+(k<<1)|0;v=0;while(1){if((v|0)>=(x|0))break;u=da+(v<<1)|0;t=(_(d[q>>0]|0,b[u>>1]|0)|0)>>8;n=(_(y,p-t<<16>>16)|0)>>16;n=(n|0)>9?9:(n|0)<-10?-10:n;a[Y+(v<<4)+k>>0]=n;w=n+10|0;s=(c[$+(w<<2)>>2]|0)+t|0;t=(c[ba+(w<<2)>>2]|0)+t|0;b[u>>1]=s;u=v+x|0;b[da+(u<<1)>>1]=t;do if((n|0)>2)if((n|0)==3){w=d[o+7>>0]|0;n=280;break}else{n=n*43|0;w=n+108|0;n=n+151|0;break}else{if((n|0)>=-3){w=d[o+(n+4)>>0]|0;n=d[o+(n+5)>>0]|0;break}if((n|0)==-4){w=280;n=d[o+1>>0]|0;break}else{n=_(n,-43)|0;w=n+108|0;n=n+65|0;break}}while(0);ha=S+(v<<2)|0;ga=c[ha>>2]|0;ia=p-s<<16>>16;ia=_(ia,ia)|0;s=b[r>>1]|0;c[ha>>2]=ga+(_(ia,s)|0)+(_(N,w<<16>>16)|0);w=p-t<<16>>16;c[S+(u<<2)>>2]=ga+(_(_(w,w)|0,s)|0)+(_(N,n<<16>>16)|0);v=v+1|0}if(m){n=0;break}else t=0;while(1){if((t|0)==4){n=0;r=0;o=0;p=0;q=2147483647;break}p=S+(t<<2)|0;n=c[p>>2]|0;o=t+4|0;q=S+(o<<2)|0;s=c[q>>2]|0;r=T+(t<<2)|0;if((n|0)>(s|0)){c[r>>2]=n;c[p>>2]=s;c[q>>2]=n;ha=da+(t<<1)|0;ia=b[ha>>1]|0;n=da+(o<<1)|0;b[ha>>1]=b[n>>1]|0;b[n>>1]=ia;n=s}else{c[r>>2]=s;o=t}c[U+(t<<2)>>2]=n;c[Z+(t<<2)>>2]=o;t=t+1|0}while(1){if((o|0)<4){ia=c[T+(o<<2)>>2]|0;ha=(q|0)>(ia|0);ga=c[U+(o<<2)>>2]|0;w=(p|0)<(ga|0);n=w?o:n;r=ha?o:r;o=o+1|0;p=w?ga:p;q=ha?ia:q;continue}if((q|0)>=(p|0)){n=0;break}c[Z+(n<<2)>>2]=c[Z+(r<<2)>>2]^4;p=r+4|0;c[S+(n<<2)>>2]=c[S+(p<<2)>>2];b[da+(n<<1)>>1]=b[da+(p<<1)>>1]|0;c[U+(n<<2)>>2]=0;c[T+(r<<2)>>2]=2147483647;p=Y+(n<<4)|0;n=Y+(r<<4)|0;o=p+16|0;do{a[p>>0]=a[n>>0]|0;p=p+1|0;n=n+1|0}while((p|0)<(o|0));n=0;r=0;o=0;p=0;q=2147483647}while(1){if((n|0)==4){n=k;continue c}ia=Y+(n<<4)+k|0;a[ia>>0]=(d[ia>>0]|0)+((c[Z+(n<<2)>>2]|0)>>>2);n=n+1|0}}while(1){if((n|0)>=(x|0)){n=z;break}a[Y+(n+x<<4)+k>>0]=(d[Y+(n<<4)+k>>0]|0)+1;n=n+1|0}while(1){if((n|0)>=4){n=k;x=z;continue b}a[Y+(n<<4)+k>>0]=a[Y+(n-z<<4)+k>>0]|0;n=n+1|0}}while(1){if((n|0)==8)break;ha=c[S+(n<<2)>>2]|0;ia=(s|0)>(ha|0);s=ia?ha:s;q=ia?n:q;n=n+1|0}n=K+D|0;o=q&3;p=0;while(1){if((p|0)>=(A|0))break;a[n+p>>0]=a[Y+(o<<4)+p>>0]|0;p=p+1|0}a[n>>0]=(d[n>>0]|0)+(q>>>2);r=J+(G<<2)|0;c[r>>2]=s;n=_(H,b[h>>1]|0)|0;n=(c[I>>2]|0)+n|0;o=a[n+E>>0]|0;if(!E)n=256-(o&255)|0;else n=(d[n+(E+-1)>>0]|0)-(o&255)|0;q=aa(n|0)|0;o=24-q|0;p=0-o|0;do if(o)if((o|0)<0){n=n<>>(o+32|0);break}else{n=n<<32-o|n>>>o;break}while(0);ia=n&127;c[r>>2]=s+(_(1024-(ia+(((_(ia,128-ia|0)|0)*179|0)>>>16)+(31-q<<7))<<16>>16,F)|0);G=G+1|0}ye(J,W,l,1);ia=c[W>>2]|0;a[f>>0]=c[O+(ia<<2)>>2];rf(f+1|0,K+(ia<<4)|0,b[Q>>1]|0)|0;ie(g,f,h);i=fa;return}function Ee(){Fb(360,33176);Ra(376,33181,1,1,0);jb(384,33186,1,-128,127);jb(400,33191,1,-128,127);jb(392,33203,1,0,255);jb(408,33217,2,-32768,32767);jb(416,33223,2,0,65535);jb(424,33238,4,-2147483648,2147483647);jb(432,33242,4,0,-1);jb(440,33255,4,-2147483648,2147483647);jb(448,33260,4,0,-1);Pb(456,33274,4);Pb(464,33280,8);Ca(48,33388);Ca(80,33463);Ib(104,4,33559);Ua(128,33591);Ab(136,0,33638);Ab(144,0,33699);Ab(152,1,33767);Ab(160,2,33837);Ab(168,3,33899);Ab(176,4,33970);Ab(184,5,34030);Ab(192,4,34099);Ab(200,5,34160);Ab(144,0,34199);Ab(152,1,34231);Ab(160,2,34264);Ab(168,3,34297);Ab(176,4,34331);Ab(184,5,34364);Ab(208,6,34429);Ab(216,7,34491);Ab(224,7,34554);return}function Fe(b){b=b|0;var d=0,e=0,f=0,g=0;g=c[b+4>>2]|0;f=g;a:do if(!(f&3)){b=g;e=4}else{d=g;b=f;while(1){if(!(a[d>>0]|0))break a;d=d+1|0;b=d;if(!(b&3)){b=d;e=4;break}}}while(0);if((e|0)==4){while(1){d=c[b>>2]|0;if(!((d&-2139062144^-2139062144)&d+-16843009))b=b+4|0;else break}if((d&255)<<24>>24)do b=b+1|0;while((a[b>>0]|0)!=0)}b=b-f+1|0;d=He(b)|0;if(!d){g=0;return g|0}rf(d|0,g|0,b|0)|0;g=d;return g|0}function Ge(a){a=+a;var b=0,d=0,e=0,f=0,g=0.0,i=0.0,j=0.0,l=0.0,m=0.0;h[k>>3]=a;d=c[k>>2]|0;b=c[k+4>>2]|0;e=(b|0)<0;do if(e|b>>>0<1048576){g=+N(+a);h[k>>3]=g;if((c[k>>2]|0)==0&(c[k+4>>2]|0)==0){a=-1.0/(a*a);break}if(e){a=(a-a)/0.0;break}else{h[k>>3]=a*18014398509481984.0;b=c[k+4>>2]|0;e=c[k>>2]|0;d=-1077;f=9;break}}else if(b>>>0<=2146435071)if((d|0)==0&0==0&(b|0)==1072693248)a=0.0;else{e=d;d=-1023;f=9}while(0);if((f|0)==9){f=b+614242|0;c[k>>2]=e;c[k+4>>2]=(f&1048575)+1072079006;j=+h[k>>3]+-1.0;i=j*(j*.5);l=j/(j+2.0);m=l*l;a=m*m;h[k>>3]=j-i;e=c[k+4>>2]|0;c[k>>2]=0;c[k+4>>2]=e;g=+h[k>>3];a=j-g-i+l*(i+(a*(a*(a*.15313837699209373+.22222198432149784)+.3999999999940942)+m*(a*(a*(a*.14798198605116586+.1818357216161805)+.2857142874366239)+.6666666666666735)));m=g*.4342944818781689;i=+(d+(f>>>20)|0);l=i*.30102999566361177;j=l+m;a=j+(m+(l-j)+(a*.4342944818781689+(i*3.694239077158931e-13+(g+a)*2.5082946711645275e-11)))}return +a}function He(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0;do if(a>>>0<245){o=a>>>0<11?16:a+11&-8;a=o>>>3;j=c[8744]|0;b=j>>>a;if(b&3|0){b=(b&1^1)+a|0;d=35016+(b<<1<<2)|0;e=d+8|0;f=c[e>>2]|0;g=f+8|0;h=c[g>>2]|0;do if((d|0)!=(h|0)){if(h>>>0<(c[8748]|0)>>>0)vb();a=h+12|0;if((c[a>>2]|0)==(f|0)){c[a>>2]=d;c[e>>2]=h;break}else vb()}else c[8744]=j&~(1<>2]=G|3;G=f+G+4|0;c[G>>2]=c[G>>2]|1;G=g;return G|0}h=c[8746]|0;if(o>>>0>h>>>0){if(b|0){d=2<>>12&16;d=d>>>i;f=d>>>5&8;d=d>>>f;g=d>>>2&4;d=d>>>g;e=d>>>1&2;d=d>>>e;b=d>>>1&1;b=(f|i|g|e|b)+(d>>>b)|0;d=35016+(b<<1<<2)|0;e=d+8|0;g=c[e>>2]|0;i=g+8|0;f=c[i>>2]|0;do if((d|0)!=(f|0)){if(f>>>0<(c[8748]|0)>>>0)vb();a=f+12|0;if((c[a>>2]|0)==(g|0)){c[a>>2]=d;c[e>>2]=f;k=c[8746]|0;break}else vb()}else{c[8744]=j&~(1<>2]=o|3;e=g+o|0;c[e+4>>2]=h|1;c[e+h>>2]=h;if(k|0){f=c[8749]|0;b=k>>>3;d=35016+(b<<1<<2)|0;a=c[8744]|0;b=1<>2]|0;if(b>>>0<(c[8748]|0)>>>0)vb();else{l=a;m=b}}else{c[8744]=a|b;l=d+8|0;m=d}c[l>>2]=f;c[m+12>>2]=f;c[f+8>>2]=m;c[f+12>>2]=d}c[8746]=h;c[8749]=e;G=i;return G|0}a=c[8745]|0;if(a){i=(a&0-a)+-1|0;F=i>>>12&16;i=i>>>F;E=i>>>5&8;i=i>>>E;G=i>>>2&4;i=i>>>G;b=i>>>1&2;i=i>>>b;j=i>>>1&1;j=c[35280+((E|F|G|b|j)+(i>>>j)<<2)>>2]|0;i=(c[j+4>>2]&-8)-o|0;b=j;while(1){a=c[b+16>>2]|0;if(!a){a=c[b+20>>2]|0;if(!a)break}b=(c[a+4>>2]&-8)-o|0;G=b>>>0>>0;i=G?b:i;b=a;j=G?a:j}f=c[8748]|0;if(j>>>0>>0)vb();h=j+o|0;if(j>>>0>=h>>>0)vb();g=c[j+24>>2]|0;d=c[j+12>>2]|0;do if((d|0)==(j|0)){b=j+20|0;a=c[b>>2]|0;if(!a){b=j+16|0;a=c[b>>2]|0;if(!a){n=0;break}}while(1){d=a+20|0;e=c[d>>2]|0;if(e|0){a=e;b=d;continue}d=a+16|0;e=c[d>>2]|0;if(!e)break;else{a=e;b=d}}if(b>>>0>>0)vb();else{c[b>>2]=0;n=a;break}}else{e=c[j+8>>2]|0;if(e>>>0>>0)vb();a=e+12|0;if((c[a>>2]|0)!=(j|0))vb();b=d+8|0;if((c[b>>2]|0)==(j|0)){c[a>>2]=d;c[b>>2]=e;n=d;break}else vb()}while(0);do if(g|0){a=c[j+28>>2]|0;b=35280+(a<<2)|0;if((j|0)==(c[b>>2]|0)){c[b>>2]=n;if(!n){c[8745]=c[8745]&~(1<>>0<(c[8748]|0)>>>0)vb();a=g+16|0;if((c[a>>2]|0)==(j|0))c[a>>2]=n;else c[g+20>>2]=n;if(!n)break}b=c[8748]|0;if(n>>>0>>0)vb();c[n+24>>2]=g;a=c[j+16>>2]|0;do if(a|0)if(a>>>0>>0)vb();else{c[n+16>>2]=a;c[a+24>>2]=n;break}while(0);a=c[j+20>>2]|0;if(a|0)if(a>>>0<(c[8748]|0)>>>0)vb();else{c[n+20>>2]=a;c[a+24>>2]=n;break}}while(0);if(i>>>0<16){G=i+o|0;c[j+4>>2]=G|3;G=j+G+4|0;c[G>>2]=c[G>>2]|1}else{c[j+4>>2]=o|3;c[h+4>>2]=i|1;c[h+i>>2]=i;a=c[8746]|0;if(a|0){e=c[8749]|0;b=a>>>3;d=35016+(b<<1<<2)|0;a=c[8744]|0;b=1<>2]|0;if(b>>>0<(c[8748]|0)>>>0)vb();else{p=a;q=b}}else{c[8744]=a|b;p=d+8|0;q=d}c[p>>2]=e;c[q+12>>2]=e;c[e+8>>2]=q;c[e+12>>2]=d}c[8746]=i;c[8749]=h}G=j+8|0;return G|0}}}else if(a>>>0<=4294967231){a=a+11|0;o=a&-8;k=c[8745]|0;if(k){d=0-o|0;a=a>>>8;if(a)if(o>>>0>16777215)j=31;else{q=(a+1048320|0)>>>16&8;z=a<>>16&4;z=z<>>16&2;j=14-(p|q|j)+(z<>>15)|0;j=o>>>(j+7|0)&1|j<<1}else j=0;b=c[35280+(j<<2)>>2]|0;a:do if(!b){a=0;b=0;z=86}else{f=d;a=0;h=o<<((j|0)==31?0:25-(j>>>1)|0);i=b;b=0;while(1){e=c[i+4>>2]&-8;d=e-o|0;if(d>>>0>>0)if((e|0)==(o|0)){a=i;b=i;z=90;break a}else b=i;else d=f;e=c[i+20>>2]|0;i=c[i+16+(h>>>31<<2)>>2]|0;a=(e|0)==0|(e|0)==(i|0)?a:e;e=(i|0)==0;if(e){z=86;break}else{f=d;h=h<<(e&1^1)}}}while(0);if((z|0)==86){if((a|0)==0&(b|0)==0){a=2<>>12&16;q=q>>>m;l=q>>>5&8;q=q>>>l;n=q>>>2&4;q=q>>>n;p=q>>>1&2;q=q>>>p;a=q>>>1&1;a=c[35280+((l|m|n|p|a)+(q>>>a)<<2)>>2]|0}if(!a){i=d;j=b}else z=90}if((z|0)==90)while(1){z=0;q=(c[a+4>>2]&-8)-o|0;e=q>>>0>>0;d=e?q:d;b=e?a:b;e=c[a+16>>2]|0;if(e|0){a=e;z=90;continue}a=c[a+20>>2]|0;if(!a){i=d;j=b;break}else z=90}if((j|0)!=0?i>>>0<((c[8746]|0)-o|0)>>>0:0){f=c[8748]|0;if(j>>>0>>0)vb();h=j+o|0;if(j>>>0>=h>>>0)vb();g=c[j+24>>2]|0;d=c[j+12>>2]|0;do if((d|0)==(j|0)){b=j+20|0;a=c[b>>2]|0;if(!a){b=j+16|0;a=c[b>>2]|0;if(!a){s=0;break}}while(1){d=a+20|0;e=c[d>>2]|0;if(e|0){a=e;b=d;continue}d=a+16|0;e=c[d>>2]|0;if(!e)break;else{a=e;b=d}}if(b>>>0>>0)vb();else{c[b>>2]=0;s=a;break}}else{e=c[j+8>>2]|0;if(e>>>0>>0)vb();a=e+12|0;if((c[a>>2]|0)!=(j|0))vb();b=d+8|0;if((c[b>>2]|0)==(j|0)){c[a>>2]=d;c[b>>2]=e;s=d;break}else vb()}while(0);do if(g|0){a=c[j+28>>2]|0;b=35280+(a<<2)|0;if((j|0)==(c[b>>2]|0)){c[b>>2]=s;if(!s){c[8745]=c[8745]&~(1<>>0<(c[8748]|0)>>>0)vb();a=g+16|0;if((c[a>>2]|0)==(j|0))c[a>>2]=s;else c[g+20>>2]=s;if(!s)break}b=c[8748]|0;if(s>>>0>>0)vb();c[s+24>>2]=g;a=c[j+16>>2]|0;do if(a|0)if(a>>>0>>0)vb();else{c[s+16>>2]=a;c[a+24>>2]=s;break}while(0);a=c[j+20>>2]|0;if(a|0)if(a>>>0<(c[8748]|0)>>>0)vb();else{c[s+20>>2]=a;c[a+24>>2]=s;break}}while(0);do if(i>>>0>=16){c[j+4>>2]=o|3;c[h+4>>2]=i|1;c[h+i>>2]=i;a=i>>>3;if(i>>>0<256){d=35016+(a<<1<<2)|0;b=c[8744]|0;a=1<>2]|0;if(b>>>0<(c[8748]|0)>>>0)vb();else{t=a;v=b}}else{c[8744]=b|a;t=d+8|0;v=d}c[t>>2]=h;c[v+12>>2]=h;c[h+8>>2]=v;c[h+12>>2]=d;break}a=i>>>8;if(a)if(i>>>0>16777215)d=31;else{F=(a+1048320|0)>>>16&8;G=a<>>16&4;G=G<>>16&2;d=14-(E|F|d)+(G<>>15)|0;d=i>>>(d+7|0)&1|d<<1}else d=0;e=35280+(d<<2)|0;c[h+28>>2]=d;a=h+16|0;c[a+4>>2]=0;c[a>>2]=0;a=c[8745]|0;b=1<>2]=h;c[h+24>>2]=e;c[h+12>>2]=h;c[h+8>>2]=h;break}d=i<<((d|0)==31?0:25-(d>>>1)|0);e=c[e>>2]|0;while(1){if((c[e+4>>2]&-8|0)==(i|0)){z=148;break}b=e+16+(d>>>31<<2)|0;a=c[b>>2]|0;if(!a){z=145;break}else{d=d<<1;e=a}}if((z|0)==145)if(b>>>0<(c[8748]|0)>>>0)vb();else{c[b>>2]=h;c[h+24>>2]=e;c[h+12>>2]=h;c[h+8>>2]=h;break}else if((z|0)==148){a=e+8|0;b=c[a>>2]|0;G=c[8748]|0;if(b>>>0>=G>>>0&e>>>0>=G>>>0){c[b+12>>2]=h;c[a>>2]=h;c[h+8>>2]=b;c[h+12>>2]=e;c[h+24>>2]=0;break}else vb()}}else{G=i+o|0;c[j+4>>2]=G|3;G=j+G+4|0;c[G>>2]=c[G>>2]|1}while(0);G=j+8|0;return G|0}}}else o=-1;while(0);d=c[8746]|0;if(d>>>0>=o>>>0){a=d-o|0;b=c[8749]|0;if(a>>>0>15){G=b+o|0;c[8749]=G;c[8746]=a;c[G+4>>2]=a|1;c[G+a>>2]=a;c[b+4>>2]=o|3}else{c[8746]=0;c[8749]=0;c[b+4>>2]=d|3;G=b+d+4|0;c[G>>2]=c[G>>2]|1}G=b+8|0;return G|0}a=c[8747]|0;if(a>>>0>o>>>0){E=a-o|0;c[8747]=E;G=c[8750]|0;F=G+o|0;c[8750]=F;c[F+4>>2]=E|1;c[G+4>>2]=o|3;G=G+8|0;return G|0}do if(!(c[8862]|0)){a=Aa(30)|0;if(!(a+-1&a)){c[8864]=a;c[8863]=a;c[8865]=-1;c[8866]=-1;c[8867]=0;c[8855]=0;c[8862]=(ab(0)|0)&-16^1431655768;break}else vb()}while(0);h=o+48|0;e=c[8864]|0;i=o+47|0;d=e+i|0;e=0-e|0;j=d&e;if(j>>>0<=o>>>0){G=0;return G|0}a=c[8854]|0;if(a|0?(t=c[8852]|0,v=t+j|0,v>>>0<=t>>>0|v>>>0>a>>>0):0){G=0;return G|0}b:do if(!(c[8855]&4)){b=c[8750]|0;c:do if(b){f=35424;while(1){a=c[f>>2]|0;if(a>>>0<=b>>>0?(r=f+4|0,(a+(c[r>>2]|0)|0)>>>0>b>>>0):0)break;a=c[f+8>>2]|0;if(!a){z=173;break c}else f=a}a=d-(c[8747]|0)&e;if(a>>>0<2147483647){b=xa(a|0)|0;if((b|0)==((c[f>>2]|0)+(c[r>>2]|0)|0)){if((b|0)!=(-1|0)){h=b;g=a;z=193;break b}}else z=183}}else z=173;while(0);do if((z|0)==173?(u=xa(0)|0,(u|0)!=(-1|0)):0){a=u;b=c[8863]|0;d=b+-1|0;if(!(d&a))a=j;else a=j-a+(d+a&0-b)|0;b=c[8852]|0;d=b+a|0;if(a>>>0>o>>>0&a>>>0<2147483647){v=c[8854]|0;if(v|0?d>>>0<=b>>>0|d>>>0>v>>>0:0)break;b=xa(a|0)|0;if((b|0)==(u|0)){h=u;g=a;z=193;break b}else z=183}}while(0);d:do if((z|0)==183){d=0-a|0;do if(h>>>0>a>>>0&(a>>>0<2147483647&(b|0)!=(-1|0))?(w=c[8864]|0,w=i-a+w&0-w,w>>>0<2147483647):0)if((xa(w|0)|0)==(-1|0)){xa(d|0)|0;break d}else{a=w+a|0;break}while(0);if((b|0)!=(-1|0)){h=b;g=a;z=193;break b}}while(0);c[8855]=c[8855]|4;z=190}else z=190;while(0);if((((z|0)==190?j>>>0<2147483647:0)?(x=xa(j|0)|0,y=xa(0)|0,x>>>0>>0&((x|0)!=(-1|0)&(y|0)!=(-1|0))):0)?(g=y-x|0,g>>>0>(o+40|0)>>>0):0){h=x;z=193}if((z|0)==193){a=(c[8852]|0)+g|0;c[8852]=a;if(a>>>0>(c[8853]|0)>>>0)c[8853]=a;k=c[8750]|0;do if(k){f=35424;while(1){a=c[f>>2]|0;b=f+4|0;d=c[b>>2]|0;if((h|0)==(a+d|0)){z=203;break}e=c[f+8>>2]|0;if(!e)break;else f=e}if(((z|0)==203?(c[f+12>>2]&8|0)==0:0)?k>>>0>>0&k>>>0>=a>>>0:0){c[b>>2]=d+g;G=k+8|0;G=(G&7|0)==0?0:0-G&7;F=k+G|0;G=g-G+(c[8747]|0)|0;c[8750]=F;c[8747]=G;c[F+4>>2]=G|1;c[F+G+4>>2]=40;c[8751]=c[8866];break}a=c[8748]|0;if(h>>>0>>0){c[8748]=h;i=h}else i=a;b=h+g|0;a=35424;while(1){if((c[a>>2]|0)==(b|0)){z=211;break}a=c[a+8>>2]|0;if(!a){b=35424;break}}if((z|0)==211)if(!(c[a+12>>2]&8)){c[a>>2]=h;m=a+4|0;c[m>>2]=(c[m>>2]|0)+g;m=h+8|0;m=h+((m&7|0)==0?0:0-m&7)|0;a=b+8|0;a=b+((a&7|0)==0?0:0-a&7)|0;l=m+o|0;j=a-m-o|0;c[m+4>>2]=o|3;do if((a|0)!=(k|0)){if((a|0)==(c[8749]|0)){G=(c[8746]|0)+j|0;c[8746]=G;c[8749]=l;c[l+4>>2]=G|1;c[l+G>>2]=G;break}b=c[a+4>>2]|0;if((b&3|0)==1){h=b&-8;f=b>>>3;e:do if(b>>>0>=256){g=c[a+24>>2]|0;e=c[a+12>>2]|0;do if((e|0)==(a|0)){e=a+16|0;d=e+4|0;b=c[d>>2]|0;if(!b){b=c[e>>2]|0;if(!b){E=0;break}else d=e}while(1){e=b+20|0;f=c[e>>2]|0;if(f|0){b=f;d=e;continue}e=b+16|0;f=c[e>>2]|0;if(!f)break;else{b=f;d=e}}if(d>>>0>>0)vb();else{c[d>>2]=0;E=b;break}}else{f=c[a+8>>2]|0;if(f>>>0>>0)vb();b=f+12|0;if((c[b>>2]|0)!=(a|0))vb();d=e+8|0;if((c[d>>2]|0)==(a|0)){c[b>>2]=e;c[d>>2]=f;E=e;break}else vb()}while(0);if(!g)break;b=c[a+28>>2]|0;d=35280+(b<<2)|0;do if((a|0)!=(c[d>>2]|0)){if(g>>>0<(c[8748]|0)>>>0)vb();b=g+16|0;if((c[b>>2]|0)==(a|0))c[b>>2]=E;else c[g+20>>2]=E;if(!E)break e}else{c[d>>2]=E;if(E|0)break;c[8745]=c[8745]&~(1<>>0>>0)vb();c[E+24>>2]=g;b=a+16|0;d=c[b>>2]|0;do if(d|0)if(d>>>0>>0)vb();else{c[E+16>>2]=d;c[d+24>>2]=E;break}while(0);b=c[b+4>>2]|0;if(!b)break;if(b>>>0<(c[8748]|0)>>>0)vb();else{c[E+20>>2]=b;c[b+24>>2]=E;break}}else{d=c[a+8>>2]|0;e=c[a+12>>2]|0;b=35016+(f<<1<<2)|0;do if((d|0)!=(b|0)){if(d>>>0>>0)vb();if((c[d+12>>2]|0)==(a|0))break;vb()}while(0);if((e|0)==(d|0)){c[8744]=c[8744]&~(1<>>0>>0)vb();b=e+8|0;if((c[b>>2]|0)==(a|0)){B=b;break}vb()}while(0);c[d+12>>2]=e;c[B>>2]=d}while(0);a=a+h|0;f=h+j|0}else f=j;a=a+4|0;c[a>>2]=c[a>>2]&-2;c[l+4>>2]=f|1;c[l+f>>2]=f;a=f>>>3;if(f>>>0<256){d=35016+(a<<1<<2)|0;b=c[8744]|0;a=1<>2]|0;if(b>>>0>=(c[8748]|0)>>>0){F=a;G=b;break}vb()}while(0);c[F>>2]=l;c[G+12>>2]=l;c[l+8>>2]=G;c[l+12>>2]=d;break}a=f>>>8;do if(!a)d=0;else{if(f>>>0>16777215){d=31;break}F=(a+1048320|0)>>>16&8;G=a<>>16&4;G=G<>>16&2;d=14-(E|F|d)+(G<>>15)|0;d=f>>>(d+7|0)&1|d<<1}while(0);e=35280+(d<<2)|0;c[l+28>>2]=d;a=l+16|0;c[a+4>>2]=0;c[a>>2]=0;a=c[8745]|0;b=1<>2]=l;c[l+24>>2]=e;c[l+12>>2]=l;c[l+8>>2]=l;break}d=f<<((d|0)==31?0:25-(d>>>1)|0);e=c[e>>2]|0;while(1){if((c[e+4>>2]&-8|0)==(f|0)){z=281;break}b=e+16+(d>>>31<<2)|0;a=c[b>>2]|0;if(!a){z=278;break}else{d=d<<1;e=a}}if((z|0)==278)if(b>>>0<(c[8748]|0)>>>0)vb();else{c[b>>2]=l;c[l+24>>2]=e;c[l+12>>2]=l;c[l+8>>2]=l;break}else if((z|0)==281){a=e+8|0;b=c[a>>2]|0;G=c[8748]|0;if(b>>>0>=G>>>0&e>>>0>=G>>>0){c[b+12>>2]=l;c[a>>2]=l;c[l+8>>2]=b;c[l+12>>2]=e;c[l+24>>2]=0;break}else vb()}}else{G=(c[8747]|0)+j|0;c[8747]=G;c[8750]=l;c[l+4>>2]=G|1}while(0);G=m+8|0;return G|0}else b=35424;while(1){a=c[b>>2]|0;if(a>>>0<=k>>>0?(A=a+(c[b+4>>2]|0)|0,A>>>0>k>>>0):0)break;b=c[b+8>>2]|0}f=A+-47|0;b=f+8|0;b=f+((b&7|0)==0?0:0-b&7)|0;f=k+16|0;b=b>>>0>>0?k:b;a=b+8|0;d=h+8|0;d=(d&7|0)==0?0:0-d&7;G=h+d|0;d=g+-40-d|0;c[8750]=G;c[8747]=d;c[G+4>>2]=d|1;c[G+d+4>>2]=40;c[8751]=c[8866];d=b+4|0;c[d>>2]=27;c[a>>2]=c[8856];c[a+4>>2]=c[8857];c[a+8>>2]=c[8858];c[a+12>>2]=c[8859];c[8856]=h;c[8857]=g;c[8859]=0;c[8858]=a;a=b+24|0;do{a=a+4|0;c[a>>2]=7}while((a+4|0)>>>0>>0);if((b|0)!=(k|0)){g=b-k|0;c[d>>2]=c[d>>2]&-2;c[k+4>>2]=g|1;c[b>>2]=g;a=g>>>3;if(g>>>0<256){d=35016+(a<<1<<2)|0;b=c[8744]|0;a=1<>2]|0;if(b>>>0<(c[8748]|0)>>>0)vb();else{C=a;D=b}}else{c[8744]=b|a;C=d+8|0;D=d}c[C>>2]=k;c[D+12>>2]=k;c[k+8>>2]=D;c[k+12>>2]=d;break}a=g>>>8;if(a)if(g>>>0>16777215)d=31;else{F=(a+1048320|0)>>>16&8;G=a<>>16&4;G=G<>>16&2;d=14-(E|F|d)+(G<>>15)|0;d=g>>>(d+7|0)&1|d<<1}else d=0;e=35280+(d<<2)|0;c[k+28>>2]=d;c[k+20>>2]=0;c[f>>2]=0;a=c[8745]|0;b=1<>2]=k;c[k+24>>2]=e;c[k+12>>2]=k;c[k+8>>2]=k;break}d=g<<((d|0)==31?0:25-(d>>>1)|0);e=c[e>>2]|0;while(1){if((c[e+4>>2]&-8|0)==(g|0)){z=307;break}b=e+16+(d>>>31<<2)|0;a=c[b>>2]|0;if(!a){z=304;break}else{d=d<<1;e=a}}if((z|0)==304)if(b>>>0<(c[8748]|0)>>>0)vb();else{c[b>>2]=k;c[k+24>>2]=e;c[k+12>>2]=k;c[k+8>>2]=k;break}else if((z|0)==307){a=e+8|0;b=c[a>>2]|0;G=c[8748]|0;if(b>>>0>=G>>>0&e>>>0>=G>>>0){c[b+12>>2]=k;c[a>>2]=k;c[k+8>>2]=b;c[k+12>>2]=e;c[k+24>>2]=0;break}else vb()}}}else{G=c[8748]|0;if((G|0)==0|h>>>0>>0)c[8748]=h;c[8856]=h;c[8857]=g;c[8859]=0;c[8753]=c[8862];c[8752]=-1;a=0;do{G=35016+(a<<1<<2)|0;c[G+12>>2]=G;c[G+8>>2]=G;a=a+1|0}while((a|0)!=32);G=h+8|0;G=(G&7|0)==0?0:0-G&7;F=h+G|0;G=g+-40-G|0;c[8750]=F;c[8747]=G;c[F+4>>2]=G|1;c[F+G+4>>2]=40;c[8751]=c[8866]}while(0);a=c[8747]|0;if(a>>>0>o>>>0){E=a-o|0;c[8747]=E;G=c[8750]|0;F=G+o|0;c[8750]=F;c[F+4>>2]=E|1;c[G+4>>2]=o|3;G=G+8|0;return G|0}}if(!(c[8732]|0))a=34972;else a=c[(Mb()|0)+64>>2]|0;c[a>>2]=12;G=0;return G|0}function Ie(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;if(!a)return;d=a+-8|0;h=c[8748]|0;if(d>>>0>>0)vb();a=c[a+-4>>2]|0;b=a&3;if((b|0)==1)vb();e=a&-8;m=d+e|0;do if(!(a&1)){a=c[d>>2]|0;if(!b)return;k=d+(0-a)|0;j=a+e|0;if(k>>>0>>0)vb();if((k|0)==(c[8749]|0)){a=m+4|0;b=c[a>>2]|0;if((b&3|0)!=3){q=k;f=j;break}c[8746]=j;c[a>>2]=b&-2;c[k+4>>2]=j|1;c[k+j>>2]=j;return}e=a>>>3;if(a>>>0<256){b=c[k+8>>2]|0;d=c[k+12>>2]|0;a=35016+(e<<1<<2)|0;if((b|0)!=(a|0)){if(b>>>0>>0)vb();if((c[b+12>>2]|0)!=(k|0))vb()}if((d|0)==(b|0)){c[8744]=c[8744]&~(1<>>0>>0)vb();a=d+8|0;if((c[a>>2]|0)==(k|0))g=a;else vb()}else g=d+8|0;c[b+12>>2]=d;c[g>>2]=b;q=k;f=j;break}g=c[k+24>>2]|0;d=c[k+12>>2]|0;do if((d|0)==(k|0)){d=k+16|0;b=d+4|0;a=c[b>>2]|0;if(!a){a=c[d>>2]|0;if(!a){i=0;break}else b=d}while(1){d=a+20|0;e=c[d>>2]|0;if(e|0){a=e;b=d;continue}d=a+16|0;e=c[d>>2]|0;if(!e)break;else{a=e;b=d}}if(b>>>0>>0)vb();else{c[b>>2]=0;i=a;break}}else{e=c[k+8>>2]|0;if(e>>>0>>0)vb();a=e+12|0;if((c[a>>2]|0)!=(k|0))vb();b=d+8|0;if((c[b>>2]|0)==(k|0)){c[a>>2]=d;c[b>>2]=e;i=d;break}else vb()}while(0);if(g){a=c[k+28>>2]|0;b=35280+(a<<2)|0;if((k|0)==(c[b>>2]|0)){c[b>>2]=i;if(!i){c[8745]=c[8745]&~(1<>>0<(c[8748]|0)>>>0)vb();a=g+16|0;if((c[a>>2]|0)==(k|0))c[a>>2]=i;else c[g+20>>2]=i;if(!i){q=k;f=j;break}}d=c[8748]|0;if(i>>>0>>0)vb();c[i+24>>2]=g;a=k+16|0;b=c[a>>2]|0;do if(b|0)if(b>>>0>>0)vb();else{c[i+16>>2]=b;c[b+24>>2]=i;break}while(0);a=c[a+4>>2]|0;if(a)if(a>>>0<(c[8748]|0)>>>0)vb();else{c[i+20>>2]=a;c[a+24>>2]=i;q=k;f=j;break}else{q=k;f=j}}else{q=k;f=j}}else{q=d;f=e}while(0);if(q>>>0>=m>>>0)vb();a=m+4|0;b=c[a>>2]|0;if(!(b&1))vb();if(!(b&2)){if((m|0)==(c[8750]|0)){p=(c[8747]|0)+f|0;c[8747]=p;c[8750]=q;c[q+4>>2]=p|1;if((q|0)!=(c[8749]|0))return;c[8749]=0;c[8746]=0;return}if((m|0)==(c[8749]|0)){p=(c[8746]|0)+f|0;c[8746]=p;c[8749]=q;c[q+4>>2]=p|1;c[q+p>>2]=p;return}f=(b&-8)+f|0;e=b>>>3;do if(b>>>0>=256){g=c[m+24>>2]|0;a=c[m+12>>2]|0;do if((a|0)==(m|0)){d=m+16|0;b=d+4|0;a=c[b>>2]|0;if(!a){a=c[d>>2]|0;if(!a){n=0;break}else b=d}while(1){d=a+20|0;e=c[d>>2]|0;if(e|0){a=e;b=d;continue}d=a+16|0;e=c[d>>2]|0;if(!e)break;else{a=e;b=d}}if(b>>>0<(c[8748]|0)>>>0)vb();else{c[b>>2]=0;n=a;break}}else{b=c[m+8>>2]|0;if(b>>>0<(c[8748]|0)>>>0)vb();d=b+12|0;if((c[d>>2]|0)!=(m|0))vb();e=a+8|0;if((c[e>>2]|0)==(m|0)){c[d>>2]=a;c[e>>2]=b;n=a;break}else vb()}while(0);if(g|0){a=c[m+28>>2]|0;b=35280+(a<<2)|0;if((m|0)==(c[b>>2]|0)){c[b>>2]=n;if(!n){c[8745]=c[8745]&~(1<>>0<(c[8748]|0)>>>0)vb();a=g+16|0;if((c[a>>2]|0)==(m|0))c[a>>2]=n;else c[g+20>>2]=n;if(!n)break}d=c[8748]|0;if(n>>>0>>0)vb();c[n+24>>2]=g;a=m+16|0;b=c[a>>2]|0;do if(b|0)if(b>>>0>>0)vb();else{c[n+16>>2]=b;c[b+24>>2]=n;break}while(0);a=c[a+4>>2]|0;if(a|0)if(a>>>0<(c[8748]|0)>>>0)vb();else{c[n+20>>2]=a;c[a+24>>2]=n;break}}}else{b=c[m+8>>2]|0;d=c[m+12>>2]|0;a=35016+(e<<1<<2)|0;if((b|0)!=(a|0)){if(b>>>0<(c[8748]|0)>>>0)vb();if((c[b+12>>2]|0)!=(m|0))vb()}if((d|0)==(b|0)){c[8744]=c[8744]&~(1<>>0<(c[8748]|0)>>>0)vb();a=d+8|0;if((c[a>>2]|0)==(m|0))l=a;else vb()}else l=d+8|0;c[b+12>>2]=d;c[l>>2]=b}while(0);c[q+4>>2]=f|1;c[q+f>>2]=f;if((q|0)==(c[8749]|0)){c[8746]=f;return}}else{c[a>>2]=b&-2;c[q+4>>2]=f|1;c[q+f>>2]=f}a=f>>>3;if(f>>>0<256){d=35016+(a<<1<<2)|0;b=c[8744]|0;a=1<>2]|0;if(b>>>0<(c[8748]|0)>>>0)vb();else{o=a;p=b}}else{c[8744]=b|a;o=d+8|0;p=d}c[o>>2]=q;c[p+12>>2]=q;c[q+8>>2]=p;c[q+12>>2]=d;return}a=f>>>8;if(a)if(f>>>0>16777215)d=31;else{o=(a+1048320|0)>>>16&8;p=a<>>16&4;p=p<>>16&2;d=14-(n|o|d)+(p<>>15)|0;d=f>>>(d+7|0)&1|d<<1}else d=0;e=35280+(d<<2)|0;c[q+28>>2]=d;c[q+20>>2]=0;c[q+16>>2]=0;a=c[8745]|0;b=1<>>1)|0);e=c[e>>2]|0;while(1){if((c[e+4>>2]&-8|0)==(f|0)){a=130;break}b=e+16+(d>>>31<<2)|0;a=c[b>>2]|0;if(!a){a=127;break}else{d=d<<1;e=a}}if((a|0)==127)if(b>>>0<(c[8748]|0)>>>0)vb();else{c[b>>2]=q;c[q+24>>2]=e;c[q+12>>2]=q;c[q+8>>2]=q;break}else if((a|0)==130){a=e+8|0;b=c[a>>2]|0;p=c[8748]|0;if(b>>>0>=p>>>0&e>>>0>=p>>>0){c[b+12>>2]=q;c[a>>2]=q;c[q+8>>2]=b;c[q+12>>2]=e;c[q+24>>2]=0;break}else vb()}}else{c[8745]=a|b;c[e>>2]=q;c[q+24>>2]=e;c[q+12>>2]=q;c[q+8>>2]=q}while(0);q=(c[8752]|0)+-1|0;c[8752]=q;if(!q)a=35432;else return;while(1){a=c[a>>2]|0;if(!a)break;else a=a+8|0}c[8752]=-1;return}function Je(a){a=a|0;return}function Ke(a){a=a|0;Ie(a);return}function Le(a){a=a|0;return}function Me(a){a=a|0;return}function Ne(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0;h=i;i=i+64|0;g=h;if((a|0)!=(b|0))if((b|0)!=0?(f=Oe(b,240)|0,(f|0)!=0):0){b=g;e=b+56|0;do{c[b>>2]=0;b=b+4|0}while((b|0)<(e|0));c[g>>2]=f;c[g+8>>2]=a;c[g+12>>2]=-1;c[g+48>>2]=1;fc[c[(c[f>>2]|0)+28>>2]&3](f,g,c[d>>2]|0,1);if((c[g+24>>2]|0)==1){c[d>>2]=c[g+16>>2];b=1}else b=0}else b=0;else b=1;i=h;return b|0}function Oe(d,e){d=d|0;e=e|0;var f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0;s=i;i=i+64|0;r=s;q=c[d>>2]|0;p=d+(c[q+-8>>2]|0)|0;q=c[q+-4>>2]|0;c[r>>2]=e;c[r+4>>2]=d;c[r+8>>2]=272;l=r+12|0;m=r+16|0;d=r+20|0;f=r+24|0;g=r+28|0;h=r+32|0;j=r+40|0;k=(q|0)==(e|0);n=l;o=n+40|0;do{c[n>>2]=0;n=n+4|0}while((n|0)<(o|0));b[l+40>>1]=0;a[l+42>>0]=0;a:do if(k){c[r+48>>2]=1;dc[c[(c[e>>2]|0)+20>>2]&3](e,r,p,p,1,0);d=(c[f>>2]|0)==1?p:0}else{Yb[c[(c[q>>2]|0)+24>>2]&3](q,r,p,1,0);switch(c[r+36>>2]|0){case 0:{d=(c[j>>2]|0)==1&(c[g>>2]|0)==1&(c[h>>2]|0)==1?c[d>>2]|0:0;break a}case 1:break;default:{d=0;break a}}if((c[f>>2]|0)!=1?!((c[j>>2]|0)==0&(c[g>>2]|0)==1&(c[h>>2]|0)==1):0){d=0;break}d=c[m>>2]|0}while(0);i=s;return d|0}function Pe(a,b,d,e,f,g){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;if((a|0)==(c[b+8>>2]|0))Qe(b,d,e,f);else{a=c[a+8>>2]|0;dc[c[(c[a>>2]|0)+20>>2]&3](a,b,d,e,f,g)}return}function Qe(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var g=0;a[b+53>>0]=1;do if((c[b+4>>2]|0)==(e|0)){a[b+52>>0]=1;e=b+16|0;g=c[e>>2]|0;if(!g){c[e>>2]=d;c[b+24>>2]=f;c[b+36>>2]=1;if(!((f|0)==1?(c[b+48>>2]|0)==1:0))break;a[b+54>>0]=1;break}if((g|0)!=(d|0)){f=b+36|0;c[f>>2]=(c[f>>2]|0)+1;a[b+54>>0]=1;break}g=b+24|0;e=c[g>>2]|0;if((e|0)==2){c[g>>2]=f;e=f}if((e|0)==1?(c[b+48>>2]|0)==1:0)a[b+54>>0]=1}while(0);return}function Re(b,d,e,f,g){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0;do if((b|0)==(c[d+8>>2]|0)){if((c[d+4>>2]|0)==(e|0)?(h=d+28|0,(c[h>>2]|0)!=1):0)c[h>>2]=f}else{if((b|0)!=(c[d>>2]|0)){j=c[b+8>>2]|0;Yb[c[(c[j>>2]|0)+24>>2]&3](j,d,e,f,g);break}if((c[d+16>>2]|0)!=(e|0)?(j=d+20|0,(c[j>>2]|0)!=(e|0)):0){c[d+32>>2]=f;i=d+44|0;if((c[i>>2]|0)==4)break;h=d+52|0;a[h>>0]=0;f=d+53|0;a[f>>0]=0;b=c[b+8>>2]|0;dc[c[(c[b>>2]|0)+20>>2]&3](b,d,e,e,1,g);if(a[f>>0]|0)if(!(a[h>>0]|0)){h=1;f=13}else f=17;else{h=0;f=13}do if((f|0)==13){c[j>>2]=e;e=d+40|0;c[e>>2]=(c[e>>2]|0)+1;if((c[d+36>>2]|0)==1?(c[d+24>>2]|0)==2:0){a[d+54>>0]=1;if(h){f=17;break}else{h=4;break}}if(h)f=17;else h=4}while(0);if((f|0)==17)h=3;c[i>>2]=h;break}if((f|0)==1)c[d+32>>2]=1}while(0);return}function Se(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var g=0;do if((b|0)==(c[d+8>>2]|0)){b=d+16|0;g=c[b>>2]|0;if(!g){c[b>>2]=e;c[d+24>>2]=f;c[d+36>>2]=1;break}if((g|0)!=(e|0)){f=d+36|0;c[f>>2]=(c[f>>2]|0)+1;c[d+24>>2]=2;a[d+54>>0]=1;break}b=d+24|0;if((c[b>>2]|0)==2)c[b>>2]=f}else{g=c[b+8>>2]|0;fc[c[(c[g>>2]|0)+28>>2]&3](g,d,e,f)}while(0);return}function Te(a){a=a|0;Ie(a);return}function Ue(a,b,d,e,f,g){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;if((a|0)==(c[b+8>>2]|0))Qe(b,d,e,f);return}function Ve(b,d,e,f,g){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,i=0;do if((b|0)==(c[d+8>>2]|0)){if((c[d+4>>2]|0)==(e|0)?(i=d+28|0,(c[i>>2]|0)!=1):0)c[i>>2]=f}else if((b|0)==(c[d>>2]|0)){if((c[d+16>>2]|0)!=(e|0)?(h=d+20|0,(c[h>>2]|0)!=(e|0)):0){c[d+32>>2]=f;c[h>>2]=e;g=d+40|0;c[g>>2]=(c[g>>2]|0)+1;if((c[d+36>>2]|0)==1?(c[d+24>>2]|0)==2:0)a[d+54>>0]=1;c[d+44>>2]=4;break}if((f|0)==1)c[d+32>>2]=1}while(0);return}function We(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var g=0;do if((b|0)==(c[d+8>>2]|0)){b=d+16|0;g=c[b>>2]|0;if(!g){c[b>>2]=e;c[d+24>>2]=f;c[d+36>>2]=1;break}if((g|0)!=(e|0)){f=d+36|0;c[f>>2]=(c[f>>2]|0)+1;c[d+24>>2]=2;a[d+54>>0]=1;break}b=d+24|0;if((c[b>>2]|0)==2)c[b>>2]=f}while(0);return}function Xe(a){a=a|0;return}function Ye(a){a=a|0;Ie(a);return}function Ze(a){a=a|0;return 34734}function _e(a){a=a|0;Ie(a);return}function $e(a,b,c){a=a|0;b=b|0;c=c|0;return (a|0)==(b|0)|0}function af(a){a=a|0;Ie(a);return}function bf(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0,k=0;k=i;i=i+64|0;j=k;c[d>>2]=c[c[d>>2]>>2];if(!((a|0)==(b|0)|(b|0)==368))if(((b|0)!=0?(e=Oe(b,328)|0,(e|0)!=0):0)?(c[e+8>>2]&~c[a+8>>2]|0)==0:0){b=c[a+12>>2]|0;a=e+12|0;if(!((b|0)==360?1:(b|0)==(c[a>>2]|0)))if((((b|0)!=0?(g=Oe(b,240)|0,(g|0)!=0):0)?(f=c[a>>2]|0,(f|0)!=0):0)?(h=Oe(f,240)|0,(h|0)!=0):0){a=j;b=a+56|0;do{c[a>>2]=0;a=a+4|0}while((a|0)<(b|0));c[j>>2]=h;c[j+8>>2]=g;c[j+12>>2]=-1;c[j+48>>2]=1;fc[c[(c[h>>2]|0)+28>>2]&3](h,j,c[d>>2]|0,1);if((c[j+24>>2]|0)==1){c[d>>2]=c[j+16>>2];a=1}else a=0}else a=0;else a=1}else a=0;else a=1;i=k;return a|0}function cf(a){a=a|0;Ie(a);return}function df(d,e,f,g,h,i){d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;var j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0;if((d|0)==(c[e+8>>2]|0))Qe(e,f,g,h);else{o=e+52|0;r=b[o>>1]|0;p=r&255;q=e+53|0;r=(r&65535)>>>8&255;n=c[d+12>>2]|0;k=d+16+(n<<3)|0;a[o>>0]=0;a[q>>0]=0;ef(d+16|0,e,f,g,h,i);a:do if((n|0)>1){l=e+24|0;m=d+8|0;n=e+54|0;j=d+24|0;do{if(a[n>>0]|0)break a;d=b[o>>1]|0;if(!((d&255)<<24>>24)){if((d&65535)>=256?(c[m>>2]&1|0)==0:0)break a}else{if((c[l>>2]|0)==1)break a;if(!(c[m>>2]&2))break a}a[o>>0]=0;a[q>>0]=0;ef(j,e,f,g,h,i);j=j+8|0}while(j>>>0>>0)}while(0);a[o>>0]=p;a[q>>0]=r}return}function ef(a,b,d,e,f,g){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,i=0;i=c[a+4>>2]|0;h=i>>8;if(i&1)h=c[(c[e>>2]|0)+h>>2]|0;a=c[a>>2]|0;dc[c[(c[a>>2]|0)+20>>2]&3](a,b,d,e+h|0,i&2|0?f:2,g);return}function ff(b,d,e,f,g){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;a:do if((b|0)==(c[d+8>>2]|0)){if((c[d+4>>2]|0)==(e|0)?(h=d+28|0,(c[h>>2]|0)!=1):0)c[h>>2]=f}else{if((b|0)!=(c[d>>2]|0)){q=c[b+12>>2]|0;j=b+16+(q<<3)|0;gf(b+16|0,d,e,f,g);h=b+24|0;if((q|0)<=1)break;b=c[b+8>>2]|0;if((b&2|0)==0?(k=d+36|0,(c[k>>2]|0)!=1):0){if(!(b&1)){b=d+54|0;while(1){if(a[b>>0]|0)break a;if((c[k>>2]|0)==1)break a;gf(h,d,e,f,g);h=h+8|0;if(h>>>0>=j>>>0)break a}}b=d+24|0;i=d+54|0;while(1){if(a[i>>0]|0)break a;if((c[k>>2]|0)==1?(c[b>>2]|0)==1:0)break a;gf(h,d,e,f,g);h=h+8|0;if(h>>>0>=j>>>0)break a}}b=d+54|0;while(1){if(a[b>>0]|0)break a;gf(h,d,e,f,g);h=h+8|0;if(h>>>0>=j>>>0)break a}}if((c[d+16>>2]|0)!=(e|0)?(q=d+20|0,(c[q>>2]|0)!=(e|0)):0){c[d+32>>2]=f;p=d+44|0;if((c[p>>2]|0)==4)break;j=b+16+(c[b+12>>2]<<3)|0;k=d+52|0;f=d+53|0;n=d+54|0;l=b+8|0;o=d+24|0;m=0;h=0;i=b+16|0;b:while(1){if(i>>>0>=j>>>0){b=20;break}a[k>>0]=0;a[f>>0]=0;ef(i,d,e,e,1,g);if(a[n>>0]|0){b=20;break}do if(a[f>>0]|0){if(!(a[k>>0]|0))if(!(c[l>>2]&1)){h=1;b=20;break b}else{b=m;h=1;break}if((c[o>>2]|0)==1){b=25;break b}if(!(c[l>>2]&2)){b=25;break b}else{b=1;h=1}}else b=m;while(0);m=b;i=i+8|0}do if((b|0)==20){if((!m?(c[q>>2]=e,e=d+40|0,c[e>>2]=(c[e>>2]|0)+1,(c[d+36>>2]|0)==1):0)?(c[o>>2]|0)==2:0){a[n>>0]=1;if(h){b=25;break}else{h=4;break}}if(h)b=25;else h=4}while(0);if((b|0)==25)h=3;c[p>>2]=h;break}if((f|0)==1)c[d+32>>2]=1}while(0);return}function gf(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0;h=c[a+4>>2]|0;g=h>>8;if(h&1)g=c[(c[d>>2]|0)+g>>2]|0;a=c[a>>2]|0;Yb[c[(c[a>>2]|0)+24>>2]&3](a,b,d+g|0,h&2|0?e:2,f);return}function hf(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0;a:do if((b|0)==(c[d+8>>2]|0)){b=d+16|0;g=c[b>>2]|0;if(!g){c[b>>2]=e;c[d+24>>2]=f;c[d+36>>2]=1;break}if((g|0)!=(e|0)){f=d+36|0;c[f>>2]=(c[f>>2]|0)+1;c[d+24>>2]=2;a[d+54>>0]=1;break}b=d+24|0;if((c[b>>2]|0)==2)c[b>>2]=f}else{h=c[b+12>>2]|0;g=b+16+(h<<3)|0;jf(b+16|0,d,e,f);if((h|0)>1){h=d+54|0;b=b+24|0;do{jf(b,d,e,f);if(a[h>>0]|0)break a;b=b+8|0}while(b>>>0>>0)}}while(0);return}function jf(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0;g=c[a+4>>2]|0;f=g>>8;if(g&1)f=c[(c[d>>2]|0)+f>>2]|0;a=c[a>>2]|0;fc[c[(c[a>>2]|0)+28>>2]&3](a,b,d+f|0,g&2|0?e:2);return}function kf(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0;f=i;i=i+16|0;e=f;c[e>>2]=c[d>>2];a=Xb[c[(c[a>>2]|0)+16>>2]&7](a,b,e)|0;if(a)c[d>>2]=c[e>>2];i=f;return a&1|0}function lf(a){a=a|0;if(!a)a=0;else a=(Oe(a,328)|0)!=0;return a&1|0}function mf(){}function nf(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0;f=b+e|0;if((e|0)>=20){d=d&255;h=b&3;i=d|d<<8|d<<16|d<<24;g=f&~3;if(h){h=b+4-h|0;while((b|0)<(h|0)){a[b>>0]=d;b=b+1|0}}while((b|0)<(g|0)){c[b>>2]=i;b=b+4|0}}while((b|0)<(f|0)){a[b>>0]=d;b=b+1|0}return b-e|0}function of(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;c=a+c>>>0;return (C=b+d+(c>>>0>>0|0)>>>0,c|0)|0}function pf(a,b,c){a=a|0;b=b|0;c=c|0;if((c|0)<32){C=b>>c;return a>>>c|(b&(1<>c-32|0}function qf(a,b,c){a=a|0;b=b|0;c=c|0;if((c|0)<32){C=b>>>c;return a>>>c|(b&(1<>>c-32|0}function rf(b,d,e){b=b|0;d=d|0;e=e|0;var f=0;if((e|0)>=4096)return ya(b|0,d|0,e|0)|0;f=b|0;if((b&3)==(d&3)){while(b&3){if(!e)return f|0;a[b>>0]=a[d>>0]|0;b=b+1|0;d=d+1|0;e=e-1|0}while((e|0)>=4){c[b>>2]=c[d>>2];b=b+4|0;d=d+4|0;e=e-4|0}}while((e|0)>0){a[b>>0]=a[d>>0]|0;b=b+1|0;d=d+1|0;e=e-1|0}return f|0}function sf(b,c,d){b=b|0;c=c|0;d=d|0;var e=0;if((c|0)<(b|0)&(b|0)<(c+d|0)){e=b;c=c+d|0;b=b+d|0;while((d|0)>0){b=b-1|0;c=c-1|0;d=d-1|0;a[b>>0]=a[c>>0]|0}b=e}else rf(b,c,d)|0;return b|0}function tf(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;d=b-d-(c>>>0>a>>>0|0)>>>0;return (C=d,a-c>>>0|0)|0}function uf(a,b,c){a=a|0;b=b|0;c=c|0;if((c|0)<32){C=b<>>32-c;return a<>0]|0;if((c|0)<8)return c|0;c=a[m+(b>>8&255)>>0]|0;if((c|0)<8)return c+8|0;c=a[m+(b>>16&255)>>0]|0;if((c|0)<8)return c+16|0;return (a[m+(b>>>24)>>0]|0)+24|0}function wf(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0;f=a&65535;e=b&65535;c=_(e,f)|0;d=a>>>16;a=(c>>>16)+(_(e,d)|0)|0;e=b>>>16;b=_(e,f)|0;return (C=(a>>>16)+(_(e,d)|0)+(((a&65535)+b|0)>>>16)|0,a+b<<16|c&65535|0)|0}function xf(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0;j=b>>31|((b|0)<0?-1:0)<<1;i=((b|0)<0?-1:0)>>31|((b|0)<0?-1:0)<<1;f=d>>31|((d|0)<0?-1:0)<<1;e=((d|0)<0?-1:0)>>31|((d|0)<0?-1:0)<<1;h=tf(j^a|0,i^b|0,j|0,i|0)|0;g=C;a=f^j;b=e^i;return tf((Cf(h,g,tf(f^c|0,e^d|0,f|0,e|0)|0,C,0)|0)^a|0,C^b|0,a|0,b|0)|0}function yf(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,j=0,k=0,l=0;f=i;i=i+16|0;j=f|0;h=b>>31|((b|0)<0?-1:0)<<1;g=((b|0)<0?-1:0)>>31|((b|0)<0?-1:0)<<1;l=e>>31|((e|0)<0?-1:0)<<1;k=((e|0)<0?-1:0)>>31|((e|0)<0?-1:0)<<1;a=tf(h^a|0,g^b|0,h|0,g|0)|0;b=C;Cf(a,b,tf(l^d|0,k^e|0,l|0,k|0)|0,C,j)|0;e=tf(c[j>>2]^h|0,c[j+4>>2]^g|0,h|0,g|0)|0;d=C;i=f;return (C=d,e)|0}function zf(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0;e=a;f=c;c=wf(e,f)|0;a=C;return (C=(_(b,f)|0)+(_(d,e)|0)+a|a&0,c|0|0)|0}function Af(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;return Cf(a,b,c,d,0)|0}function Bf(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0;g=i;i=i+16|0;f=g|0;Cf(a,b,d,e,f)|0;i=g;return (C=c[f+4>>2]|0,c[f>>2]|0)|0}function Cf(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;l=a;j=b;k=j;h=d;n=e;i=n;if(!k){g=(f|0)!=0;if(!i){if(g){c[f>>2]=(l>>>0)%(h>>>0);c[f+4>>2]=0}n=0;f=(l>>>0)/(h>>>0)>>>0;return (C=n,f)|0}else{if(!g){n=0;f=0;return (C=n,f)|0}c[f>>2]=a|0;c[f+4>>2]=b&0;n=0;f=0;return (C=n,f)|0}}g=(i|0)==0;do if(h){if(!g){g=(aa(i|0)|0)-(aa(k|0)|0)|0;if(g>>>0<=31){m=g+1|0;i=31-g|0;b=g-31>>31;h=m;a=l>>>(m>>>0)&b|k<>>(m>>>0)&b;g=0;i=l<>2]=a|0;c[f+4>>2]=j|b&0;n=0;f=0;return (C=n,f)|0}g=h-1|0;if(g&h|0){i=(aa(h|0)|0)+33-(aa(k|0)|0)|0;p=64-i|0;m=32-i|0;j=m>>31;o=i-32|0;b=o>>31;h=i;a=m-1>>31&k>>>(o>>>0)|(k<>>(i>>>0))&b;b=b&k>>>(i>>>0);g=l<>>(o>>>0))&j|l<>31;break}if(f|0){c[f>>2]=g&l;c[f+4>>2]=0}if((h|0)==1){o=j|b&0;p=a|0|0;return (C=o,p)|0}else{p=vf(h|0)|0;o=k>>>(p>>>0)|0;p=k<<32-p|l>>>(p>>>0)|0;return (C=o,p)|0}}else{if(g){if(f|0){c[f>>2]=(k>>>0)%(h>>>0);c[f+4>>2]=0}o=0;p=(k>>>0)/(h>>>0)>>>0;return (C=o,p)|0}if(!l){if(f|0){c[f>>2]=0;c[f+4>>2]=(k>>>0)%(i>>>0)}o=0;p=(k>>>0)/(i>>>0)>>>0;return (C=o,p)|0}g=i-1|0;if(!(g&i)){if(f|0){c[f>>2]=a|0;c[f+4>>2]=g&k|b&0}o=0;p=k>>>((vf(i|0)|0)>>>0);return (C=o,p)|0}g=(aa(i|0)|0)-(aa(k|0)|0)|0;if(g>>>0<=30){b=g+1|0;i=31-g|0;h=b;a=k<>>(b>>>0);b=k>>>(b>>>0);g=0;i=l<>2]=a|0;c[f+4>>2]=j|b&0;o=0;p=0;return (C=o,p)|0}while(0);if(!h){k=i;j=0;i=0}else{m=d|0|0;l=n|e&0;k=of(m|0,l|0,-1,-1)|0;d=C;j=i;i=0;do{e=j;j=g>>>31|j<<1;g=i|g<<1;e=a<<1|e>>>31|0;n=a>>>31|b<<1|0;tf(k|0,d|0,e|0,n|0)|0;p=C;o=p>>31|((p|0)<0?-1:0)<<1;i=o&1;a=tf(e|0,n|0,o&m|0,(((p|0)<0?-1:0)>>31|((p|0)<0?-1:0)<<1)&l|0)|0;b=C;h=h-1|0}while((h|0)!=0);k=j;j=0}h=0;if(f|0){c[f>>2]=a;c[f+4>>2]=b}o=(g|0)>>>31|(k|h)<<1|(h<<1|g>>>31)&0|j;p=(g<<1|0>>>31)&-2|i;return (C=o,p)|0}function Df(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;return Xb[a&7](b|0,c|0,d|0)|0}function Ef(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;Yb[a&3](b|0,c|0,d|0,e|0,f|0)}function Ff(a,b){a=a|0;b=b|0;Zb[a&15](b|0)}function Gf(a,b,c,d,e,f,g){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=g|0;return _b[a&1](b|0,c|0,d|0,e|0,f|0,g|0)|0}function Hf(a,b){a=a|0;b=b|0;return $b[a&3](b|0)|0}function If(a,b,c,d,e,f,g,h){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;ac[a&1](b|0,c|0,d|0,e|0,f|0,g|0,h|0)}function Jf(a){a=a|0;bc[a&0]()}function Kf(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;return cc[a&3](b|0,c|0,d|0,e|0)|0}function Lf(a,b,c,d,e,f,g){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=g|0;dc[a&3](b|0,c|0,d|0,e|0,f|0,g|0)}function Mf(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;return ec[a&3](b|0,c|0,d|0,e|0,f|0)|0}function Nf(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;fc[a&3](b|0,c|0,d|0,e|0)}function Of(a,b,c){a=a|0;b=b|0;c=c|0;ba(0);return 0}function Pf(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;ba(1)}function Qf(a){a=a|0;ba(2)}function Rf(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;ba(3);return 0}function Sf(a){a=a|0;ba(4);return 0}function Tf(a,b,c,d,e,f,g){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=g|0;ba(5)}function Uf(){ba(6)}function Vf(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;ba(7);return 0}function Wf(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;ba(8)}function Xf(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;ba(9);return 0}function Yf(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;ba(10)} - function gc(a){a=a|0;var b=0;b=i;i=i+a|0;i=i+15&-16;return b|0}function hc(){return i|0}function ic(a){a=a|0;i=a}function jc(a,b){a=a|0;b=b|0;i=a;j=b}function kc(a,b){a=a|0;b=b|0;if(!n){n=a;o=b}}function lc(b){b=b|0;a[k>>0]=a[b>>0];a[k+1>>0]=a[b+1>>0];a[k+2>>0]=a[b+2>>0];a[k+3>>0]=a[b+3>>0]}function mc(b){b=b|0;a[k>>0]=a[b>>0];a[k+1>>0]=a[b+1>>0];a[k+2>>0]=a[b+2>>0];a[k+3>>0]=a[b+3>>0];a[k+4>>0]=a[b+4>>0];a[k+5>>0]=a[b+5>>0];a[k+6>>0]=a[b+6>>0];a[k+7>>0]=a[b+7>>0]}function nc(a){a=a|0;C=a}function oc(){return C|0}function pc(a,d,f,g,h){a=a|0;d=d|0;f=f|0;g=g|0;h=h|0;var i=0,j=0;if((f|0)>0){i=0;do{j=i<<1;b[d+(i<<1)>>1]=b[d+((j|1)<<1)>>1]<<8|e[d+(j<<1)>>1];i=i+1|0}while((i|0)!=(f|0))}return Kc(c[a+12>>2]|0,d,h,g)|0}function qc(a,d,f,g){a=a|0;d=d|0;f=f|0;g=g|0;var h=0,i=0,j=0;h=a+20|0;i=Cc(c[a+16>>2]|0,d,f,c[h>>2]|0)|0;f=c[a+4>>2]|0;if((_(f,i)|0)<=0)return i|0;h=c[h>>2]|0;f=_(i,f)|0;d=0;do{j=h+(d<<1)|0;a=d<<1;b[g+(a<<1)>>1]=(e[j>>1]|0)&255;b[g+((a|1)<<1)>>1]=(e[j>>1]|0)>>>8;d=d+1|0}while((d|0)!=(f|0));return i|0}function rc(a){a=a|0;return 8}function sc(a){a=a|0;if(!a)return;Ie(c[a+12>>2]|0);Ie(c[a+16>>2]|0);Ie(a);return}function tc(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0;m=i;i=i+16|0;l=m+4|0;k=m;while(1){j=He(24)|0;if(j|0)break;e=c[8868]|0;c[8868]=e+0;if(!e){h=5;break}bc[e&0]()}if((h|0)==5){m=kb(4)|0;c[m>>2]=23152;Tb(m|0,296,6)}g=c[a>>2]|0;f=c[b>>2]|0;b=c[d>>2]|0;c[j>>2]=b;c[j+4>>2]=f;c[j+8>>2]=g;a=f*11520|0;a=a>>>0>2147483647?-1:a<<1;a=(a|0)==0?1:a;while(1){e=He(a)|0;if(e|0){h=11;break}e=c[8868]|0;c[8868]=e+0;if(!e){h=10;break}bc[e&0]()}if((h|0)==10){m=kb(4)|0;c[m>>2]=23152;Tb(m|0,296,6)}else if((h|0)==11){c[j+20>>2]=e;c[j+12>>2]=Fc(g,f,b,l)|0;c[j+16>>2]=Ac(g,f,k)|0;i=m;return j|0}return 0}function uc(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,j=0;f=i;i=i+16|0;j=f+8|0;h=f+4|0;g=f;c[j>>2]=b;c[h>>2]=d;c[g>>2]=e;a=Xb[a&7](j,h,g)|0;i=f;return a|0}function vc(a,b,d,e,f,g){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,i=0;h=c[a>>2]|0;i=c[a+4>>2]|0;a=b+(i>>1)|0;if(i&1)h=c[(c[a>>2]|0)+h>>2]|0;return ec[h&3](a,d,e,f,g)|0}function wc(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0;g=c[a>>2]|0;h=c[a+4>>2]|0;a=b+(h>>1)|0;if(h&1)g=c[(c[a>>2]|0)+g>>2]|0;return cc[g&3](a,d,e,f)|0}function xc(){var a=0,b=0;eb(8,16,32,0,27863,2,27866,0,27866,0,27766,27868,11);Ja(8,4,488,27871,1,4);while(1){a=He(8)|0;if(a|0)break;a=c[8868]|0;c[8868]=a+0;if(!a){b=5;break}bc[a&0]()}if((b|0)==5){b=kb(4)|0;c[b>>2]=23152;Tb(b|0,296,6)}c[a>>2]=1;c[a+4>>2]=0;Jb(8,27784,6,504,27877,1,a|0,0);while(1){a=He(8)|0;if(a|0){b=11;break}a=c[8868]|0;c[8868]=a+0;if(!a){b=10;break}bc[a&0]()}if((b|0)==10){b=kb(4)|0;c[b>>2]=23152;Tb(b|0,296,6)}else if((b|0)==11){c[a>>2]=2;c[a+4>>2]=0;Jb(8,27792,5,528,27885,2,a|0,0);return}}function yc(a,b,c,d,e,f,h,i,j,k,l){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=+f;h=+h;i=i|0;j=j|0;k=k|0;l=l|0;var m=0.0,n=0.0,o=0.0,p=0.0,q=0.0,r=0.0,s=0,t=0,u=0,v=0,w=0,x=0.0,y=0.0,z=0.0,A=0,B=0.0,C=0.0,D=0.0;if(f==0.0&h==0.0){if((b|0)==(a|0))return;sf(a|0,b|0,e<<2|0)|0;return}s=(c|0)>15?c:15;A=(d|0)>15?d:15;r=+g[548+(i*12|0)>>2]*f;p=+g[548+(i*12|0)+4>>2]*f;q=+g[548+(i*12|0)+8>>2]*f;x=+g[548+(j*12|0)>>2]*h;y=+g[548+(j*12|0)+4>>2]*h;z=+g[548+(j*12|0)+8>>2]*h;t=1-A|0;u=0-A|0;v=~A;w=-2-A|0;c=f==h&(s|0)==(A|0)&(i|0)==(j|0)?0:l;d=0;f=+g[b+(t<<2)>>2];m=+g[b+(u<<2)>>2];n=+g[b+(v<<2)>>2];o=+g[b+(w<<2)>>2];while(1){if((d|0)>=(c|0))break;C=+g[b+(d-A+2<<2)>>2];B=+g[k+(d<<2)>>2];B=B*B;D=1.0-B;j=d-s|0;g[a+(d<<2)>>2]=+g[b+(d<<2)>>2]+D*r*+g[b+(j<<2)>>2]+D*p*(+g[b+(j+1<<2)>>2]+ +g[b+(j+-1<<2)>>2])+D*q*(+g[b+(j+2<<2)>>2]+ +g[b+(j+-2<<2)>>2])+B*x*m+B*y*(f+n)+B*z*(C+o);B=f;d=d+1|0;f=C;o=n;n=m;m=B}if(h==0.0){if((b|0)==(a|0))return;sf(a+(c<<2)|0,b+(c<<2)|0,e-c<<2|0)|0;return}else{i=a+(d<<2)|0;l=b+(d<<2)|0;c=e-d|0;d=0;o=+g[l+(t<<2)>>2];n=+g[l+(u<<2)>>2];m=+g[l+(v<<2)>>2];f=+g[l+(w<<2)>>2];while(1){if((d|0)>=(c|0))break;C=+g[l+(d-A+2<<2)>>2];g[i+(d<<2)>>2]=+g[l+(d<<2)>>2]+n*x+(o+m)*y+(C+f)*z;D=o;d=d+1|0;o=C;f=m;m=n;n=D}return}}function zc(a){a=a|0;if((a+7|0)>>>0>7){a=27924;return a|0}a=c[584+(0-a<<2)>>2]|0;return a|0}function Ac(a,d,e){a=a|0;d=d|0;e=e|0;var f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0;s=i;i=i+16|0;q=s+8|0;o=s;a:do if((a|0)<16e3)if((a|0)<12e3)switch(a|0){case 8e3:{h=2;break a}default:break a}else switch(a|0){case 12e3:{h=2;break a}default:break a}else{if((a|0)<24e3)switch(a|0){case 16e3:{h=2;break a}default:break a}if((a|0)<48e3)switch(a|0){case 24e3:{h=2;break a}default:break a}else switch(a|0){case 48e3:{h=2;break a}default:break a}}while(0);if((h|0)==2?(d+-1|0)>>>0<2:0){n=d*96|0;r=He((d*8672|0)+88+n+9304|0)|0;if(!r){if(!e){e=0;i=s;return e|0}c[e>>2]=-7;e=0;i=s;return e|0}b:do if((a|0)<16e3)if((a|0)<12e3)switch(a|0){case 8e3:{h=9;break b}default:{f=-1;break b}}else switch(a|0){case 12e3:{h=9;break b}default:{f=-1;break b}}else{if((a|0)<24e3)switch(a|0){case 16e3:{h=9;break b}default:{f=-1;break b}}if((a|0)<48e3)switch(a|0){case 24e3:{h=9;break b}default:{f=-1;break b}}else switch(a|0){case 48e3:{h=9;break b}default:{f=-1;break b}}}while(0);do if((h|0)==9)if((d+-1|0)>>>0<2){nf(r|0,0,(d*8672|0)+88+n+9304|0)|0;c[r+4>>2]=88;c[r>>2]=8632;f=r+88|0;p=r+8632|0;c[r+8>>2]=d;c[r+48>>2]=d;c[r+12>>2]=a;c[r+24>>2]=a;c[r+16>>2]=d;m=0;while(1){if((m|0)==2)break;g=f+(m*4260|0)|0;nf(g|0,0,4260)|0;c[f+(m*4260|0)+2376>>2]=1;c[g>>2]=65536;g=f+(m*4260|0)+2340|0;j=c[g>>2]|0;h=32767/(j+1|0)|0;k=0;l=0;while(1){if((l|0)>=(j|0))break;t=k+h|0;b[f+(m*4260|0)+4052+(l<<1)>>1]=t;j=c[g>>2]|0;k=t;l=l+1|0}c[f+(m*4260|0)+4148>>2]=0;c[f+(m*4260|0)+4152>>2]=3176576;c[f+(m*4260|0)+4168>>2]=c[f+(m*4260|0)+2328>>2]<<7;c[f+(m*4260|0)+4240>>2]=65536;c[f+(m*4260|0)+4244>>2]=65536;c[f+(m*4260|0)+4256>>2]=20;c[f+(m*4260|0)+4252>>2]=2;m=m+1|0}t=r+8608|0;c[t>>2]=0;c[t+4>>2]=0;c[t+8>>2]=0;c[r+8628>>2]=0;if(d>>>0<=2){nf(p|0,0,(d*8672|0)+88+n+672|0)|0;c[p>>2]=5304;c[r+8636>>2]=120;c[r+8640>>2]=d;c[r+8644>>2]=d;g=r+8648|0;c[g>>2]=1;c[r+8652>>2]=0;c[r+8656>>2]=21;c[r+8660>>2]=1;c[r+8664>>2]=0;Xc(p,4028,o);c:do if((a|0)<16e3)if((a|0)<12e3){switch(a|0){case 8e3:break;default:{h=22;break c}}f=6;h=23;break}else{switch(a|0){case 12e3:break;default:{h=22;break c}}f=4;h=23;break}else{if((a|0)<24e3){switch(a|0){case 16e3:break;default:{h=22;break c}}f=3;h=23;break}if((a|0)>=48e3)switch(a|0){case 48e3:{f=1;h=23;break c}default:{h=22;break c}}switch(a|0){case 24e3:break;default:{h=22;break c}}f=2;h=23}while(0);if((h|0)==22){c[g>>2]=0;f=-3;break}else if((h|0)==23){c[g>>2]=f;c[q>>2]=0;Xc(p,10016,q);c[r+60>>2]=0;c[r+64>>2]=(a|0)/400|0;c[r+44>>2]=0;f=0;break}}else f=-3}else f=-1;while(0);if(e|0)c[e>>2]=f;if(!f){t=r;i=s;return t|0}Ie(r);t=0;i=s;return t|0}if(!e){t=0;i=s;return t|0}c[e>>2]=-1;t=0;i=s;return t|0}function Bc(a,e,f,h,j,k){a=a|0;e=e|0;f=f|0;h=h|0;j=j|0;k=k|0;var l=0,m=0,n=0,o=0,p=0.0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,Y=0,Z=0,$=0,ba=0,ca=0,da=0,ea=0,fa=0,ga=0,ha=0;ha=i;i=i+160|0;Z=ha+80|0;Y=ha+72|0;W=ha+64|0;U=ha+56|0;R=ha+48|0;P=ha+40|0;O=ha+32|0;N=ha+24|0;M=ha+16|0;L=ha+8|0;K=ha;fa=ha+96|0;B=ha+92|0;ga=ha+88|0;Q=ha+144|0;T=ha+84|0;c[ga>>2]=0;A=a+(c[a+4>>2]|0)|0;V=a+(c[a>>2]|0)|0;da=a+12|0;l=c[da>>2]|0;S=(l|0)/50|0;z=S>>1;ca=S>>2;ea=S>>3;if((ea|0)>(j|0)){a=-2;i=ha;return a|0}l=((l|0)/25|0)*3|0;l=(l|0)>(j|0)?j:l;do if((f|0)>=2)if(e){o=c[a+64>>2]|0;n=c[a+56>>2]|0;c[fa>>2]=e;c[fa+4>>2]=f;c[fa+8>>2]=0;c[fa+12>>2]=0;c[fa+16>>2]=0;r=fa+20|0;c[r>>2]=9;s=fa+24|0;c[s>>2]=0;t=fa+28|0;c[t>>2]=128;c[s>>2]=1;x=d[e>>0]|0;u=fa+40|0;c[u>>2]=x;y=x>>>1^127;v=fa+32|0;c[v>>2]=y;c[fa+44>>2]=0;m=128;j=9;q=1;while(1){if(m>>>0>=8388609)break;j=j+8|0;c[r>>2]=j;m=m<<8;c[t>>2]=m;if(q>>>0>>0){ba=q+1|0;c[s>>2]=ba;w=d[e+q>>0]|0;q=ba}else w=0;c[u>>2]=w;ba=((x<<8|w)>>>1&255|y<<8&2147483392)^255;c[v>>2]=ba;x=w;y=ba}j=c[a+60>>2]|0;if((j|0)>0){j=(j|0)==1002;if((n|0)!=1002){if(!j){j=e;m=l;E=27;break}F=_(ca,c[a+8>>2]|0)|0;ba=Fa()|0;$=o;G=0;H=1;break}if(!j?(c[a+68>>2]|0)==0:0){$=_(ca,c[a+8>>2]|0)|0;ba=Fa()|0;G=i;i=i+((1*($<<2)|0)+15&-16)|0;Bc(a,0,0,G,(ca|0)<(o|0)?ca:o,0)|0;$=o;n=1002;F=1;H=1}else{j=e;m=l;n=1002;E=27}}else{j=e;m=l;E=27}}else E=10;else{E=c[a+64>>2]|0;l=(l|0)<(E|0)?l:E;E=10}while(0);do if((E|0)==10){n=c[a+60>>2]|0;if(!n){j=a+8|0;m=0;while(1){if((m|0)>=(_(l,c[j>>2]|0)|0))break;g[h+(m<<2)>>2]=0.0;m=m+1|0}i=ha;return l|0}if((l|0)<=(S|0)){if((l|0)>=(S|0)){j=0;m=l;o=l;E=27;break}if((l|0)>(z|0)){j=0;m=l;o=z;E=27;break}if((n|0)==1e3){j=0;m=l;o=l;n=1e3;E=27;break}j=0;m=l;o=(l|0)>(ca|0)&(l|0)<(z|0)?ca:l;E=27;break}o=a+8|0;j=h;n=l;while(1){m=Bc(a,0,0,j,(n|0)<(S|0)?n:S,0)|0;if((m|0)<0){l=m;E=158;break}n=n-m|0;j=j+((_(m,c[o>>2]|0)|0)<<2)|0;if((n|0)<=0){E=158;break}}if((E|0)==158){i=ha;return l|0}}while(0);if((E|0)==27){e=j;l=m;ba=Fa()|0;$=o;G=0;F=1;H=0}a:do if(($|0)>(l|0))l=-1;else{if((n|0)==1002){B=i;i=i+16|0;n=1002}else{u=a+8|0;l=c[u>>2]|0;if((z|0)>($|0)){z=(_(z,l)|0)<<1;t=i;i=i+((1*z|0)+15&-16)|0}else{z=(_($,l)|0)<<1;t=i;i=i+((1*z|0)+15&-16)|0}if((c[a+60>>2]|0)==1002){r=0;while(1){if((r|0)==2)break;l=A+(r*4260|0)|0;nf(l|0,0,4260)|0;c[A+(r*4260|0)+2376>>2]=1;c[l>>2]=65536;l=A+(r*4260|0)+2340|0;m=c[l>>2]|0;j=32767/(m+1|0)|0;o=0;q=0;while(1){if((q|0)>=(m|0))break;z=o+j|0;b[A+(r*4260|0)+4052+(q<<1)>>1]=z;m=c[l>>2]|0;o=z;q=q+1|0}c[A+(r*4260|0)+4148>>2]=0;c[A+(r*4260|0)+4152>>2]=3176576;c[A+(r*4260|0)+4168>>2]=c[A+(r*4260|0)+2328>>2]<<7;c[A+(r*4260|0)+4240>>2]=65536;c[A+(r*4260|0)+4244>>2]=65536;c[A+(r*4260|0)+4256>>2]=20;c[A+(r*4260|0)+4252>>2]=2;r=r+1|0}z=A+8520|0;c[z>>2]=0;c[z+4>>2]=0;c[z+8>>2]=0;c[A+8540>>2]=0}z=($*1e3|0)/(c[da>>2]|0)|0;c[a+32>>2]=(z|0)<10?10:z;if(!e)o=1;else{c[a+20>>2]=c[a+48>>2];b:do if((n|0)==1e3)switch(c[a+52>>2]|0){case 1101:{c[a+28>>2]=8e3;break b}case 1102:{c[a+28>>2]=12e3;break b}case 1103:{c[a+28>>2]=16e3;break b}default:{c[a+28>>2]=16e3;break b}}else c[a+28>>2]=16e3;while(0);o=k<<1}m=a+16|0;q=(o|0)==0;r=0;s=t;while(1){c:do if(!(xd(A,m,o,(r|0)==0&1,fa,s,B)|0))l=c[u>>2]|0;else{if(q){l=-3;break a}c[B>>2]=$;j=0;while(1){l=c[u>>2]|0;if((j|0)>=(_($,l)|0))break c;b[s+(j<<1)>>1]=0;j=j+1|0}}while(0);z=c[B>>2]|0;r=r+z|0;s=s+((_(z,l)|0)<<1)|0;if((r|0)>=($|0)){B=t;break}}}A=(k|0)==0;do if(A)if((n|0)!=1002)if((e|0)!=0?(I=fa+20|0,D=c[I>>2]|0,J=fa+28|0,C=c[J>>2]|0,E=D+((aa(C|0)|0)+-32)+17|0,(E+((c[a+56>>2]|0)==1001?20:0)|0)<=(f<<3|0)):0){x=(n|0)==1001;y=fa+32|0;j=c[y>>2]|0;if(x){l=C>>>12;u=j>>>0>>0;v=u&1;if(!u){j=j-l|0;c[y>>2]=j;l=C-l|0}c[J>>2]=l;r=fa+40|0;s=fa+24|0;t=fa+4|0;m=l;l=D;while(1){if(m>>>0>=8388609)break;l=l+8|0;c[I>>2]=l;o=m<<8;c[J>>2]=o;q=c[r>>2]|0;m=c[s>>2]|0;if(m>>>0<(c[t>>2]|0)>>>0){c[s>>2]=m+1;m=d[(c[fa>>2]|0)+m>>0]|0}else m=0;c[r>>2]=m;E=((q<<8|m)>>>1&255|j<<8&2147483392)^255;c[y>>2]=E;m=o;j=E}if(u){q=m;o=j}else{l=f;j=0;m=0;o=0;E=90;break}}else{q=C;o=j;l=D;v=1}m=q>>>1;E=o>>>0>>0;j=E&1;if(!E){o=o-m|0;c[y>>2]=o;m=q-m|0}c[J>>2]=m;t=fa+40|0;u=fa+24|0;w=fa+4|0;while(1){if(m>>>0>=8388609)break;l=l+8|0;c[I>>2]=l;m=m<<8;c[J>>2]=m;r=c[t>>2]|0;q=c[u>>2]|0;if(q>>>0<(c[w>>2]|0)>>>0){c[u>>2]=q+1;q=d[(c[fa>>2]|0)+q>>0]|0}else q=0;c[t>>2]=q;E=((r<<8|q)>>>1&255|o<<8&2147483392)^255;c[y>>2]=E;o=E}if(x){E=m>>>8;c[fa+36>>2]=E;s=(o>>>0)/(E>>>0)|0;D=s+1|0;s=256-(D+(D>>>0>256?255-s|0:0))|0;D=_(E,255-s|0)|0;r=o-D|0;c[y>>2]=r;m=(s|0)==0?m-D|0:E;c[J>>2]=m;while(1){if(m>>>0>=8388609)break;l=l+8|0;c[I>>2]=l;m=m<<8;c[J>>2]=m;q=c[t>>2]|0;o=c[u>>2]|0;if(o>>>0<(c[w>>2]|0)>>>0){c[u>>2]=o+1;o=d[(c[fa>>2]|0)+o>>0]|0}else o=0;c[t>>2]=o;E=((q<<8|o)>>>1&255|r<<8&2147483392)^255;c[y>>2]=E;r=E}o=s+2|0}else o=f-(l+((aa(m|0)|0)+-32)+7>>3)|0;E=f-o|0;m=(E<<3|0)<(l+((aa(m|0)|0)+-32)|0);o=m?0:o;c[w>>2]=(c[w>>2]|0)-o;l=m?0:E;m=m?0:v;E=90}else{l=f;j=0;m=0;o=0;E=91}else{z=f;y=0;m=0;o=0;j=0}else{l=f;j=0;m=0;o=0;E=90}while(0);if((E|0)==90)if((n|0)==1002){z=l;y=j;j=0}else E=91;if((E|0)==91){z=l;y=j;j=17}switch(c[a+52>>2]|0){case 1101:{l=13;break}case 1103:case 1102:{l=17;break}case 1104:{l=19;break}default:l=21}c[K>>2]=l;Xc(V,10012,K);c[L>>2]=c[a+48>>2];Xc(V,10008,L);x=(m|0)==0;if(!x){L=(_(ca,c[a+8>>2]|0)|0)<<2;l=i;i=i+((1*L|0)+15&-16)|0;if(!y){s=l;w=G;t=0}else{c[M>>2]=0;Xc(V,10010,M);Yc(V,e+z|0,o,l,ca,0,0)|0;c[N>>2]=ga;Xc(V,4031,N);s=l;w=G;t=0}}else{l=i;i=i+((1*(F<<2)|0)+15&-16)|0;do if(!((H|0)==0|(n|0)==1002))if((ca|0)<($|0)){Bc(a,0,0,l,ca,0)|0;break}else{Bc(a,0,0,l,$,0)|0;break}else l=G;while(0);s=i;i=i+16|0;w=l;t=H}c[O>>2]=j;Xc(V,10010,O);do if((n|0)==1e3){b[Q>>1]=-1;l=a+8|0;j=0;while(1){if((j|0)>=(_($,c[l>>2]|0)|0))break;g[h+(j<<2)>>2]=0.0;j=j+1|0}if((c[a+60>>2]|0)==1001){if(!(x|(y|0)==0)?c[a+68>>2]|0:0){l=0;n=1e3;E=116;break}c[R>>2]=0;Xc(V,10010,R);Yc(V,Q,2,h,ea,0,0)|0;l=0;n=1e3;E=116}else{l=0;n=1e3;E=116}}else{l=(S|0)<($|0)?S:$;S=c[a+60>>2]|0;if((n|0)!=(S|0)&(S|0)>0?(c[a+68>>2]|0)==0:0)Xc(V,4028,P);l=Yc(V,A?e:0,z,h,l,fa,0)|0;if((n|0)==1002){v=l;u=n}else E=116}while(0);d:do if((E|0)==116){j=a+8|0;m=0;while(1){if((m|0)>=(_($,c[j>>2]|0)|0)){v=l;u=n;break d}S=h+(m<<2)|0;g[S>>2]=+g[S>>2]+ +(b[B+(m<<1)>>1]|0)*.000030517578125;m=m+1|0}}while(0);c[U>>2]=T;Xc(V,10015,U);r=c[(c[T>>2]|0)+60>>2]|0;e:do if(!x){if(!y){Xc(V,4028,W);c[Y>>2]=0;Xc(V,10010,Y);Yc(V,e+z|0,o,s,ca,0,0)|0;c[Z>>2]=ga;Xc(V,4031,Z);o=c[a+8>>2]|0;q=h+((_(o,$-ea|0)|0)<<2)|0;l=s+((_(o,ea)|0)<<2)|0;j=48e3/(c[da>>2]|0)|0;m=0;while(1){if((m|0)<(o|0))n=0;else break e;while(1){if((n|0)>=(ea|0))break;p=+g[r+((_(n,j)|0)<<2)>>2];p=p*p;Y=(_(n,o)|0)+m|0;Z=q+(Y<<2)|0;g[Z>>2]=p*+g[l+(Y<<2)>>2]+(1.0-p)*+g[Z>>2];n=n+1|0}m=m+1|0}}j=a+8|0;m=0;while(1){q=c[j>>2]|0;if((m|0)<(q|0))l=0;else break;while(1){if((l|0)>=(ea|0))break;Z=(_(c[j>>2]|0,l)|0)+m|0;c[h+(Z<<2)>>2]=c[s+(Z<<2)>>2];l=l+1|0}m=m+1|0}j=_(q,ea)|0;l=s+(j<<2)|0;j=h+(j<<2)|0;m=48e3/(c[da>>2]|0)|0;n=0;while(1){if((n|0)<(q|0))o=0;else break e;while(1){if((o|0)>=(ea|0))break;p=+g[r+((_(o,m)|0)<<2)>>2];p=p*p;Y=(_(o,q)|0)+n|0;Z=j+(Y<<2)|0;g[Z>>2]=p*+g[Z>>2]+(1.0-p)*+g[l+(Y<<2)>>2];o=o+1|0}n=n+1|0}}while(0);f:do if(t|0){j=a+8|0;if(($|0)<(ca|0)){n=c[j>>2]|0;l=48e3/(c[da>>2]|0)|0;j=0;while(1){if((j|0)<(n|0))m=0;else break f;while(1){if((m|0)>=(ea|0))break;p=+g[r+((_(m,l)|0)<<2)>>2];p=p*p;ca=(_(m,n)|0)+j|0;da=h+(ca<<2)|0;g[da>>2]=p*+g[da>>2]+(1.0-p)*+g[w+(ca<<2)>>2];m=m+1|0}j=j+1|0}}else l=0;while(1){q=c[j>>2]|0;m=_(q,ea)|0;if((l|0)>=(m|0))break;c[h+(l<<2)>>2]=c[w+(l<<2)>>2];l=l+1|0}o=w+(m<<2)|0;n=h+(m<<2)|0;l=48e3/(c[da>>2]|0)|0;j=0;while(1){if((j|0)<(q|0))m=0;else break f;while(1){if((m|0)>=(ea|0))break;p=+g[r+((_(m,l)|0)<<2)>>2];p=p*p;ca=(_(m,q)|0)+j|0;da=n+(ca<<2)|0;g[da>>2]=p*+g[da>>2]+(1.0-p)*+g[o+(ca<<2)>>2];m=m+1|0}j=j+1|0}}while(0);l=c[a+40>>2]|0;g:do if(l|0){p=+X(+(+(l|0)*6.488140788860619e-04*.6931471805599453));l=a+8|0;j=0;while(1){if((j|0)>=(_($,c[l>>2]|0)|0))break g;ea=h+(j<<2)|0;g[ea>>2]=+g[ea>>2]*p;j=j+1|0}}while(0);if((z|0)<2)l=0;else l=c[fa+28>>2]^c[ga>>2];c[a+84>>2]=l;c[a+60>>2]=u;c[a+68>>2]=(y|0)==0&(x^1)&1;l=(v|0)<0?v:$}while(0);Na(ba|0);a=l;i=ha;return a|0}function Cc(e,f,h,j){e=e|0;f=f|0;h=h|0;j=j|0;var l=0.0,m=0,n=0,o=0,p=0,q=0,r=0.0,s=0.0,t=0,u=0,v=0.0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0.0,F=0.0;D=i;i=i+112|0;y=D;x=D+104|0;z=D+8|0;t=(f|0)==0;do if((h|0)>0&(t^1)){q=c[e+12>>2]|0;n=a[f>>0]|0;o=n&255;a:do switch(o&3|0){case 0:{p=1;break}case 3:if((h|0)<2){j=-4;i=D;return j|0}else{m=d[f+1>>0]&63;u=5;break a}default:{m=2;u=5}}while(0);if((u|0)==5)p=m;do if(n<<24>>24>=0)if((n&96)==96)if(!(n&8)){m=(q|0)/100|0;break}else{m=(q|0)/50|0;break}else{m=o>>>3&3;if((m|0)==3){m=(q*60|0)/1e3|0;break}else{m=(q<>>3&3)|0)/400|0;while(0);m=_(p,m)|0;if((m*25|0)<=(q*3|0)&(m|0)>0){w=(m|0)>5760?5760:m;break}else{j=-4;i=D;return j|0}}else w=5760;while(0);A=e+8|0;m=_(w,c[A>>2]|0)|0;B=Fa()|0;C=i;i=i+((1*(m<<2)|0)+15&-16)|0;m=(h|0)==0;b:do if(m|t)if(!((w|0)%((c[e+12>>2]|0)/400|0|0)|0))if(m|t){n=0;do{m=Bc(e,0,0,C+((_(n,c[A>>2]|0)|0)<<2)|0,w-n|0,0)|0;if((m|0)<0){n=m;break b}n=n+m|0}while((n|0)<(w|0));c[e+72>>2]=n}else u=23;else n=-1;else u=23;while(0);c:do if((u|0)==23)if((h|0)>=0){q=a[f>>0]|0;do if(q<<24>>24>=0){u=(q&96)==96;p=u?1001:1e3;if(u)o=(q&16)>>>4|1104;else o=((q&255)>>>5&3)+1101|0;m=c[e+12>>2]|0;if((q&96)==96)if(!(q&8)){t=(m|0)/100|0;break}else{t=(m|0)/50|0;break}else{n=(q&255)>>>3&3;if((n|0)==3){t=(m*60|0)/1e3|0;break}else{t=(m<>>5&3;t=(c[e+12>>2]<<((q&255)>>>3&3)|0)/400|0;o=(o|0)==0?1101:o+1102|0;p=1002}while(0);m=((q&4)>>>2)+1|0;n=Wd(f,h,0,x,0,z,y,0)|0;if((n|0)>=0)if((_(n,t)|0)<=(w|0)){q=f+(c[y>>2]|0)|0;c[e+56>>2]=p;c[e+52>>2]=o;c[e+64>>2]=t;c[e+48>>2]=m;m=q;q=0;f=0;while(1){if((q|0)>=(n|0))break;o=z+(q<<1)|0;p=Bc(e,m,b[o>>1]|0,C+((_(f,c[A>>2]|0)|0)<<2)|0,w-f|0,0)|0;if((p|0)<0){n=p;break c}m=m+(b[o>>1]|0)|0;q=q+1|0;f=f+p|0}c[e+72>>2]=f;x=c[A>>2]|0;if((x|0)<1|(f|0)<1)n=f;else{m=_(f,x)|0;n=0;while(1){if((n|0)>=(m|0)){h=0;break}z=C+(n<<2)|0;v=+g[z>>2];h=v>2.0;y=v<-2.0&(h^1);g[z>>2]=y|h?(y?-2.0:2.0):v;n=n+1|0}while(1){if((h|0)==(x|0)){n=f;break c}u=C+(h<<2)|0;w=e+76+(h<<2)|0;l=+g[w>>2];n=0;while(1){if((n|0)>=(f|0))break;m=u+((_(n,x)|0)<<2)|0;r=+g[m>>2];s=r*l;if(s>=0.0)break;g[m>>2]=r+s*r;n=n+1|0}v=+g[u>>2];q=0;while(1){n=q;while(1){if((n|0)>=(f|0))break;s=+g[u+((_(n,x)|0)<<2)>>2];if(s>1.0|s<-1.0)break;n=n+1|0}if((n|0)==(f|0)){l=0.0;break}s=+g[u+((_(n,x)|0)<<2)>>2];l=+N(+s);o=n;while(1){if((o|0)<=0){t=n;r=l;p=n;break}m=o+-1|0;if(!(s*+g[u+((_(m,x)|0)<<2)>>2]>=0.0)){t=n;r=l;p=n;break}else o=m}while(1){if((t|0)>=(f|0))break;l=+g[u+((_(t,x)|0)<<2)>>2];if(!(s*l>=0.0))break;l=+N(+l);y=l>r;z=y?t:p;t=t+1|0;r=y?l:r;p=z}if(!o)n=s*+g[u>>2]>=0.0;else n=0;l=(r+-1.0)/(r*r);l=l+l*2.4e-07;l=s>0.0?-l:l;m=o;while(1){if((m|0)>=(t|0))break;z=u+((_(m,x)|0)<<2)|0;s=+g[z>>2];g[z>>2]=s+l*s*s;m=m+1|0}d:do if(n&(p|0)>1){r=v-+g[u>>2];s=r/+(p|0);m=q;while(1){if((m|0)>=(p|0))break d;E=r-s;z=u+((_(m,x)|0)<<2)|0;F=+g[z>>2]+E;g[z>>2]=F;q=F>1.0;y=F<-1.0&(q^1);g[z>>2]=y|q?(y?-1.0:1.0):F;m=m+1|0;r=E}}while(0);if((t|0)==(f|0))break;else q=t}g[w>>2]=l;h=h+1|0}}}else n=-2}else n=-1;while(0);e:do if((n|0)>0){o=0;while(1){if((o|0)>=(_(n,c[A>>2]|0)|0))break e;l=+g[C+(o<<2)>>2]*32768.0;if(l>-32768.0){if(!(l<32767.0))l=32767.0}else l=-32768.0;m=(g[k>>2]=l,c[k>>2]|0);if((m&2130706432)>>>0<=1249902592){m=(m|0)<0;l=m?l+-8388608.0+8388608.0:l+8388608.0+-8388608.0;if(l==0.0)l=m?-0.0:0.0}b[j+(o<<1)>>1]=~~l;o=o+1|0}}while(0);Na(B|0);j=n;i=D;return j|0}function Dc(a,d,e){a=a|0;d=d|0;e=e|0;var f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0;m=i;i=i+32|0;g=m+8|0;h=m;k=m+16|0;f=c[a+4>>2]|0;j=a+(c[a>>2]|0)|0;c[k>>2]=e;a:do switch(d|0){case 4009:{l=(c[k>>2]|0)+(4-1)&~(4-1);f=c[l>>2]|0;c[k>>2]=l+4;if(!f)d=26;else{c[f>>2]=c[a+52>>2];f=0;d=25}break}case 4031:{l=(c[k>>2]|0)+(4-1)&~(4-1);f=c[l>>2]|0;c[k>>2]=l+4;if(!f)d=26;else{c[f>>2]=c[a+84>>2];f=0;d=25}break}case 4028:{k=a+f|0;l=a+48|0;f=l;d=f+40|0;do{c[f>>2]=0;f=f+4|0}while((f|0)<(d|0));Xc(j,4028,h);j=0;while(1){if((j|0)==2)break;f=k+(j*4260|0)|0;nf(f|0,0,4260)|0;c[k+(j*4260|0)+2376>>2]=1;c[f>>2]=65536;f=k+(j*4260|0)+2340|0;e=c[f>>2]|0;d=32767/(e+1|0)|0;g=0;h=0;while(1){if((h|0)>=(e|0))break;n=g+d|0;b[k+(j*4260|0)+4052+(h<<1)>>1]=n;e=c[f>>2]|0;g=n;h=h+1|0}c[k+(j*4260|0)+4148>>2]=0;c[k+(j*4260|0)+4152>>2]=3176576;c[k+(j*4260|0)+4168>>2]=c[k+(j*4260|0)+2328>>2]<<7;c[k+(j*4260|0)+4240>>2]=65536;c[k+(j*4260|0)+4244>>2]=65536;c[k+(j*4260|0)+4256>>2]=20;c[k+(j*4260|0)+4252>>2]=2;j=j+1|0}f=k+8520|0;c[f>>2]=0;c[f+4>>2]=0;c[f+8>>2]=0;c[k+8540>>2]=0;c[l>>2]=c[a+8>>2];c[a+64>>2]=(c[a+12>>2]|0)/400|0;f=0;d=25;break}case 4029:{n=(c[k>>2]|0)+(4-1)&~(4-1);f=c[n>>2]|0;c[k>>2]=n+4;if(!f)d=26;else{c[f>>2]=c[a+12>>2];f=0;d=25}break}case 4033:{n=(c[k>>2]|0)+(4-1)&~(4-1);f=c[n>>2]|0;c[k>>2]=n+4;if(f)if((c[a+60>>2]|0)==1002){c[g>>2]=f;Xc(j,4033,g);f=0;d=25;break a}else{c[f>>2]=c[a+36>>2];f=0;d=25;break a}else d=26;break}case 4045:{n=(c[k>>2]|0)+(4-1)&~(4-1);f=c[n>>2]|0;c[k>>2]=n+4;if(!f)d=26;else{c[f>>2]=c[a+40>>2];f=0;d=25}break}case 4034:{n=(c[k>>2]|0)+(4-1)&~(4-1);f=c[n>>2]|0;c[k>>2]=n+4;if((f+32768|0)>>>0>65535)d=26;else{c[a+40>>2]=f;f=0;d=25}break}case 4039:{n=(c[k>>2]|0)+(4-1)&~(4-1);f=c[n>>2]|0;c[k>>2]=n+4;if(!f)d=26;else{c[f>>2]=c[a+72>>2];f=0;d=25}break}default:{f=-5;d=25}}while(0);if((d|0)==25){n=f;i=m;return n|0}else if((d|0)==26){n=-1;i=m;return n|0}return 0}function Ec(a){a=a|0;Ie(a);return}function Fc(a,d,e,f){a=a|0;d=d|0;e=e|0;f=f|0;var h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0;t=i;i=i+32|0;q=t+16|0;p=t+8|0;m=t;a:do if((a|0)<16e3)if((a|0)<12e3)switch(a|0){case 8e3:{s=2;break a}default:break a}else switch(a|0){case 12e3:{s=2;break a}default:break a}else{if((a|0)<24e3)switch(a|0){case 16e3:{s=2;break a}default:break a}if((a|0)<48e3)switch(a|0){case 24e3:{s=2;break a}default:break a}else switch(a|0){case 48e3:{s=2;break a}default:break a}}while(0);b:do if((s|0)==2?(d+-1|0)>>>0<2:0){switch(e|0){case 2048:case 2049:case 2051:break;default:break b}k=d<<12;r=He((d*480|0)+212+k+(d*336|0)+39448|0)|0;if(!r){if(!f){s=0;i=t;return s|0}c[f>>2]=-7;s=0;i=t;return s|0}c:do if((a|0)<16e3)if((a|0)<12e3)switch(a|0){case 8e3:{s=10;break c}default:{h=-1;break c}}else switch(a|0){case 12e3:{s=10;break c}default:{h=-1;break c}}else{if((a|0)<24e3)switch(a|0){case 16e3:{s=10;break c}default:{h=-1;break c}}if((a|0)<48e3)switch(a|0){case 24e3:{s=10;break c}default:{h=-1;break c}}else switch(a|0){case 48e3:{s=10;break c}default:{h=-1;break c}}}while(0);d:do if((s|0)==10)if((d+-1|0)>>>0<2){switch(e|0){case 2048:case 2049:case 2051:break;default:{h=-1;break d}}nf(r|0,0,(d*480|0)+212+k+(d*336|0)+39448|0)|0;c[r+4>>2]=19048;c[r>>2]=39448;n=r+39448|0;c[r+112>>2]=d;c[r+15104>>2]=d;o=r+144|0;c[o>>2]=a;j=r+180|0;c[j>>2]=0;h=r+8|0;if(!(yd(r+19048|0,0,h)|0)){c[h>>2]=d;c[r+12>>2]=d;c[r+16>>2]=c[o>>2];c[r+20>>2]=16e3;c[r+24>>2]=8e3;c[r+28>>2]=16e3;c[r+32>>2]=20;c[r+36>>2]=25e3;c[r+40>>2]=0;l=r+44|0;c[l>>2]=9;c[r+48>>2]=0;c[r+56>>2]=0;c[r+60>>2]=0;c[r+76>>2]=0;h=c[j>>2]|0;nf(n|0,0,(d*480|0)+212+k+(d*336|0)|0)|0;c[n>>2]=5304;c[r+39452>>2]=d;c[r+39456>>2]=d;j=r+39476|0;c[j>>2]=1;c[r+39480>>2]=0;c[r+39484>>2]=21;c[r+39496>>2]=1;c[r+39520>>2]=h;c[r+39500>>2]=1;c[r+39464>>2]=1;c[r+39488>>2]=-1;c[r+39492>>2]=0;c[r+39460>>2]=0;c[r+39472>>2]=5;c[r+39508>>2]=24;Qc(n,4028,m)|0;e:do if((a|0)<16e3)if((a|0)<12e3){switch(a|0){case 8e3:break;default:{s=18;break e}}h=6;break}else{switch(a|0){case 12e3:break;default:{s=18;break e}}h=4;break}else{if((a|0)<24e3){switch(a|0){case 16e3:break;default:{s=18;break e}}h=3;break}if((a|0)>=48e3)switch(a|0){case 48e3:{h=1;break e}default:{s=18;break e}}switch(a|0){case 24e3:break;default:{s=18;break e}}h=2}while(0);if((s|0)==18)h=0;c[j>>2]=h;c[p>>2]=0;Qc(n,10016,p)|0;c[q>>2]=c[l>>2];Qc(n,4010,q)|0;c[r+148>>2]=1;c[r+152>>2]=1;c[r+164>>2]=-1e3;c[r+160>>2]=(_(a,d)|0)+3e3;c[r+108>>2]=e;c[r+124>>2]=-1e3;c[r+128>>2]=-1e3;c[r+132>>2]=1105;c[r+120>>2]=-1e3;c[r+136>>2]=-1e3;c[r+140>>2]=-1;h=c[o>>2]|0;c[r+172>>2]=(h|0)/100|0;c[r+168>>2]=24;c[r+156>>2]=5e3;c[r+116>>2]=(h|0)/250|0;b[r+15108>>1]=16384;g[r+15116>>2]=1.0;c[r+15112>>2]=193536;c[r+15164>>2]=1;c[r+15136>>2]=1001;c[r+15152>>2]=1105;nf(r+188|0,0,14916)|0;h=0}else h=-3}else h=-1;while(0);if(f|0)c[f>>2]=h;if(!h){s=r;i=t;return s|0}Ie(r);s=0;i=t;return s|0}while(0);if(!f){s=0;i=t;return s|0}c[f>>2]=-1;s=0;i=t;return s|0}function Gc(a,c,d,e,f,h,i){a=a|0;c=c|0;d=d|0;e=e|0;f=f|0;h=h|0;i=i|0;var j=0.0,k=0,l=0,m=0;k=0;while(1){if((k|0)>=(d|0))break;g[c+(k<<2)>>2]=+(b[a+((_(k+e|0,i)|0)+f<<1)>>1]|0);k=k+1|0}l=(h|0)>-1;a:do if(!l)if((h|0)==-2){f=1;while(1){if((f|0)<(i|0))k=0;else{f=12;break a}while(1){if((k|0)>=(d|0))break;j=+(b[a+((_(k+e|0,i)|0)+f<<1)>>1]|0);m=c+(k<<2)|0;g[m>>2]=+g[m>>2]+j;k=k+1|0}f=f+1|0}}else f=14;else{f=0;while(1){if((f|0)>=(d|0)){f=12;break a}j=+(b[a+((_(f+e|0,i)|0)+h<<1)>>1]|0);m=c+(f<<2)|0;g[m>>2]=+g[m>>2]+j;f=f+1|0}}while(0);if((f|0)==12)if((h|0)==-2)j=.000030517578125/+(i|0);else f=14;if((f|0)==14)j=l?.0000152587890625:.000030517578125;f=0;while(1){if((f|0)>=(d|0))break;m=c+(f<<2)|0;g[m>>2]=+g[m>>2]*j;f=f+1|0}return}function Hc(a,b,d,e,f,h,j,l){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;h=h|0;j=j|0;l=l|0;var m=0.0,n=0,o=0.0,p=0.0,q=0,r=0,s=0,t=0.0,u=0.0,v=0,w=0.0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0.0,G=0.0;E=i;i=i+3296|0;A=E+1760|0;C=E+224|0;D=E+112|0;z=E;r=(e|0)/400|0;s=i;i=i+((1*(r<<2)|0)+15&-16)|0;B=c[h>>2]|0;c[D>>2]=B;g[z>>2]=1.0/((c[k>>2]=B,+g[k>>2])+1.0000000036274937e-15);B=(j|0)==0;if(B){e=b;n=0;q=1}else{n=(r<<1)-j|0;e=c[h+4>>2]|0;c[D+4>>2]=e;g[z+4>>2]=1.0/((c[k>>2]=e,+g[k>>2])+1.0000000036274937e-15);e=c[h+8>>2]|0;c[D+8>>2]=e;g[z+8>>2]=1.0/((c[k>>2]=e,+g[k>>2])+1.0000000036274937e-15);e=b-n|0;q=3}j=(e|0)/(r|0)|0;j=(j|0)<24?j:24;e=0;m=0.0;while(1){if((e|0)>=(j|0))break;b=(_(e,r)|0)+n|0;ac[l&1](a,s,r,b,0,-2,d);b=0;m=(e|0)==0?+g[s>>2]:m;o=1.0000000036274937e-15;while(1){if((b|0)>=(r|0))break;u=+g[s+(b<<2)>>2];w=u-m;b=b+1|0;m=u;o=o+w*w}y=e+q|0;g[D+(y<<2)>>2]=o;g[z+(y<<2)>>2]=1.0/o;e=e+1|0}y=e+q|0;c[D+(y<<2)>>2]=c[D+(y+-1<<2)>>2];if(!B){j=j+2|0;j=(j|0)>24?24:j}x=~~+((d*60|0)+40|0);y=(f|0)/400|0;if((f|0)>=32e3)if((f|0)>64399)w=1.0;else w=+(y+-80|0)/80.0;else w=0.0;e=0;while(1){if((e|0)==16){q=0;break}c[C+(e<<2)>>2]=-1;g[A+(e<<2)>>2]=1.0e10;e=e+1|0}while(1){if((q|0)==4){v=1;break}p=+((y<(j|0)?j:n;b=0;m=0.0;o=0.0;while(1){if((b|0)>(e|0))break;u=o+ +g[z+(b<<2)>>2];t=m+ +g[D+(b<<2)>>2];b=b+1|0;m=t;o=u}v=e+1|0;m=(m*o/+(_(v,v)|0)+-2.0)*.05000000074505806;if(+O(+(m<=0.0?0.0:m))>1.0)m=1.0;else m=+O(+(m<=0.0?0.0:m));g[A+(n<<2)>>2]=p*(w*m+1.0);c[C+(n<<2)>>2]=q;q=q+1|0}while(1){if((j|0)<=(v|0))break;f=v+-1|0;e=2;while(1){if((e|0)==16)break;d=e+-1|0;c[A+(v<<6)+(e<<2)>>2]=c[A+(f<<6)+(d<<2)>>2];c[C+(v<<6)+(e<<2)>>2]=d;e=e+1|0}r=A+(f<<6)+4|0;s=D+(v<<2)|0;l=z+(v<<2)|0;a=j-v|0;u=+(a|0);d=0;while(1){if((d|0)==4)break;q=1<>2]=1;t=+g[r>>2];e=1;while(1){if((e|0)==4)break;e=e+1|0;b=(1<>2];if(!(m>2]=b;t=m}p=+((y<(a|0);e=n?a:q;b=0;m=0.0;o=0.0;while(1){if((b|0)>(e|0))break;F=o+ +g[l+(b<<2)>>2];G=m+ +g[s+(b<<2)>>2];b=b+1|0;m=G;o=F}b=e+1|0;m=(m*o/+(_(b,b)|0)+-2.0)*.05000000074505806;if(+O(+(m<=0.0?0.0:m))>1.0)m=1.0;else m=+O(+(m<=0.0?0.0:m));m=p*(w*m+1.0);e=A+(v<<6)+(q<<2)|0;g[e>>2]=t;if(n)m=m*u/+(q|0);g[e>>2]=t+m;d=d+1|0}v=v+1|0}e=j+-1|0;m=+g[A+(e<<6)+4>>2];b=1;n=2;while(1){if((n|0)==16)break;G=+g[A+(e<<6)+(n<<2)>>2];z=G>2]|0;j=e}e=1<>2]=c[D+(e<<2)>>2];if(B){i=E;return b|0}c[h+4>>2]=c[D+(e+1<<2)>>2];c[h+8>>2]=c[D+(e+2<<2)>>2];i=E;return b|0}function Ic(d,e,f,h,j,l,m,n,o,p,q,r,s){d=d|0;e=e|0;f=f|0;h=h|0;j=j|0;l=l|0;m=m|0;n=n|0;o=o|0;p=p|0;q=q|0;r=r|0;s=s|0;var t=0,u=0,v=0,w=0,x=0.0,y=0.0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0.0,I=0.0,J=0.0,K=0.0,L=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,Y=0,Z=0,$=0,ba=0,ca=0,da=0,ea=0,fa=0,ga=0,ha=0,ia=0,ja=0,ka=0,la=0,ma=0,na=0,oa=0,pa=0,qa=0,ra=0,sa=0,ta=0,ua=0,va=0,wa=0,xa=0,ya=0,za=0,Aa=0,Ba=0,Ca=0,Da=0,Ea=0,Ga=0,Ha=0,Ia=0,Ja=0,Ka=0,La=0,Ma=0,Oa=0,Pa=0,Qa=0,Ra=0,Sa=0,Ta=0,Ua=0,Va=0,Wa=0,Xa=0,Ya=0,Za=0,_a=0,$a=0,ab=0,bb=0,cb=0,db=0,eb=0,fb=0,gb=0,hb=0,ib=0,jb=0,kb=0,lb=0,mb=0,nb=0,ob=0,pb=0.0,qb=0.0,rb=0.0,sb=0.0,tb=0.0,ub=0.0,vb=0,wb=0;ob=i;i=i+1280|0;fb=ob+832|0;db=ob+824|0;cb=ob+816|0;bb=ob+808|0;ab=ob+800|0;$a=ob+792|0;Ya=ob+784|0;Xa=ob+776|0;Wa=ob+768|0;Va=ob+760|0;mb=ob+456|0;Ta=ob+448|0;Sa=ob+440|0;Ra=ob+432|0;Qa=ob+424|0;Pa=ob+416|0;Oa=ob+408|0;Ma=ob+400|0;La=ob+392|0;za=ob+384|0;ya=ob+376|0;xa=ob+368|0;wa=ob+360|0;va=ob+352|0;sa=ob+344|0;ra=ob+336|0;qa=ob+328|0;ua=ob+320|0;ta=ob+312|0;V=ob+304|0;D=ob;oa=ob+1272|0;_a=ob+1224|0;ib=ob+1220|0;Ba=ob+1216|0;jb=ob+1184|0;U=ob+1152|0;ca=ob+852|0;la=ob+848|0;Ja=ob+840|0;Ua=ob+1278|0;eb=ob+1276|0;c[ib>>2]=0;C=(j|0)>1276?1276:j;lb=d+19044|0;c[lb>>2]=0;pa=d+156|0;if(!(c[pa>>2]|0)){v=f*400|0;u=d+144|0;t=c[u>>2]|0;if((v|0)!=(t|0))if(!((f*200|0)==(t|0)|(f*100|0)==(t|0))?(nb=f*50|0,!((nb|0)==(t|0)|(f*25|0)==(t|0)|(nb|0)==(t*3|0))):0){h=-1;i=ob;return h|0}else{nb=u;u=v}else{nb=u;u=v;t=v}}else{t=d+144|0;nb=t;u=f*400|0;t=c[t>>2]|0}if((u|0)<(t|0)|(C|0)<1){h=-1;i=ob;return h|0}na=d+(c[d+4>>2]|0)|0;Za=d+(c[d>>2]|0)|0;ba=d+108|0;if((c[ba>>2]|0)==2051)Aa=0;else Aa=c[d+116>>2]|0;$=c[d+168>>2]|0;$=($|0)>(l|0)?l:$;c[D>>2]=Ba;Qc(Za,10015,D)|0;c[jb>>2]=0;B=d+44|0;do if((c[B>>2]|0)>6?(c[nb>>2]|0)==48e3:0){v=d+112|0;t=_(c[v>>2]|0,f)|0;u=0;x=0.0;y=0.0;while(1){if((u|0)>=(t|0))break;K=+g[e+(u<<2)>>2];u=u+1|0;x=x>K?x:K;y=yK?x:K)<=1.0/+(1<<$|0)){S=d+19032|0;c[S>>2]=0;u=1;l=-1;w=-1;Ia=1;break}l=c[d+8696>>2]|0;w=c[d+8700>>2]|0;Pc(d+188|0,c[Ba>>2]|0,m,n,f,o,p,q,48e3,$,r,jb);if(+g[jb+28>>2]>.10000000149011612){m=d+19040|0;x=+g[m>>2];u=_(c[v>>2]|0,f)|0;t=0;H=0.0;while(1){if((t|0)>=(u|0))break;K=+g[e+(t<<2)>>2];t=t+1|0;H=H+K*K}x=x*.999;y=+(u|0);if(!(x>H/y)){t=0;x=0.0;while(1){if((t|0)>=(u|0))break;K=+g[e+(t<<2)>>2];t=t+1|0;x=x+K*K}x=x/y}g[m>>2]=x;kb=25}else kb=25}else{l=-1;w=-1;kb=25}while(0);do if((kb|0)==25){c[d+140>>2]=-1;u=c[jb>>2]|0;v=d+19032|0;c[v>>2]=0;u=(u|0)==0;if(!u){if((c[d+124>>2]|0)==-1e3)c[d+140>>2]=~~+M(+((1.0-+g[jb+20>>2])*100.0+.5));t=c[jb+24>>2]|0;if((t|0)<13){c[v>>2]=1101;S=v;Ia=0;break}if((t|0)<15){c[v>>2]=1102;S=v;Ia=0;break}if((t|0)<17){c[v>>2]=1103;S=v;Ia=0;break}if((t|0)<19){c[v>>2]=1104;S=v;Ia=0;break}else{c[v>>2]=1105;S=v;Ia=0;break}}else{S=v;Ia=0}}while(0);gb=d+112|0;z=c[gb>>2]|0;A=(z|0)==2;if(A?(c[d+120>>2]|0)!=1:0){n=(c[nb>>2]|0)/(f|0)|0;t=(n|0)<50;x=25.0/+(n|0);v=f+-3|0;m=0;y=0.0;H=0.0;I=0.0;while(1){if((m|0)>=(v|0))break;hb=m<<1;ub=+g[e+(hb<<2)>>2];qb=+g[e+((hb|1)<<2)>>2];tb=+g[e+((hb|2)<<2)>>2];pb=+g[e+((hb|3)<<2)>>2];sb=+g[e+((hb|4)<<2)>>2];J=+g[e+((hb|5)<<2)>>2];rb=+g[e+((hb|6)<<2)>>2];K=+g[e+((hb|7)<<2)>>2];m=m+4|0;y=y+(ub*ub+tb*tb+sb*sb+rb*rb);H=H+(ub*qb+tb*pb+sb*J+rb*K);I=I+(qb*qb+pb*pb+J*J+K*K)}ub=t?.5:1.0-x;Ka=d+15172|0;x=+g[Ka>>2];x=x+ub*(y-x);g[Ka>>2]=x;t=d+15176|0;y=+g[t>>2];y=y+ub*(H-y);g[t>>2]=y;hb=d+15180|0;H=+g[hb>>2];H=H+ub*(I-H);g[hb>>2]=H;x=x<0.0?0.0:x;g[Ka>>2]=x;y=y<0.0?0.0:y;g[t>>2]=y;H=H<0.0?0.0:H;g[hb>>2]=H;if((x>H?x:H)>7.999999797903001e-04){sb=+O(+x);ub=+O(+H);x=+O(+sb);tb=+O(+ub);ub=sb*ub;sb=y>2]=sb;ub=sb/(ub+1.0000000036274937e-15);tb=+O(+(1.0-ub*ub))*(+N(+(x-tb))/(x+1.0000000036274937e-15+tb));hb=d+15184|0;x=+g[hb>>2];ub=+(n|0);x=x+(tb-x)/ub;g[hb>>2]=x;hb=d+15188|0;ub=+g[hb>>2]-.019999999552965164/ub;x=ub>x?ub:x;g[hb>>2]=x}else x=+g[d+15188>>2];x=x*20.0;if(x>1.0)x=1.0}else x=0.0;if(!f)t=(c[nb>>2]|0)/400|0;else t=f;v=c[d+164>>2]|0;switch(v|0){case -1e3:{G=c[nb>>2]|0;v=((G*60|0)/(t|0)|0)+(_(G,z)|0)|0;break}case -1:{G=c[nb>>2]|0;v=(_(C<<3,G)|0)/(t|0)|0;break}default:G=c[nb>>2]|0}Ga=d+160|0;c[Ga>>2]=v;t=(G|0)/(f|0)|0;hb=d+148|0;P=(c[hb>>2]|0)==0;if(P){L=(G*3|0)/(f|0)|0;Ka=(((v*3|0)/8|0)+((L|0)/2|0)|0)/(L|0)|0;Ka=(Ka|0)<(C|0)?Ka:C;L=((_(Ka,L)|0)<<3|0)/3|0;c[Ga>>2]=L}else{L=v;Ka=C}do if(!((Ka|0)<3|(L|0)<(t*24|0))){if((t|0)<50){v=_(Ka,t)|0;if((v|0)<300|(L|0)<2400)break;else ga=v}else ga=_(t,Ka)|0;ha=ga<<3;E=c[B>>2]|0;R=d+40|0;F=c[R>>2]|0;B=t+-50|0;v=L-(_((z*40|0)+20|0,B)|0)|0;if(P)v=v-((v|0)/12|0)|0;C=E+90|0;m=(_(v,C)|0)/100|0;D=(F*12|0)+20|0;m=m-((_(m,F)|0)/(D|0)|0)|0;v=c[d+124>>2]|0;do if((v|0)!=3001)if((v|0)!=3002){v=c[d+140>>2]|0;if((v|0)>-1){Q=v*327>>8;Q=(c[ba>>2]|0)!=2049|(Q|0)<115?Q:115;break}else{Q=(c[ba>>2]|0)==2048?115:48;break}}else Q=0;else Q=127;while(0);T=d+120|0;v=c[T>>2]|0;Ha=d+15104|0;do if((v|0)==-1e3|A^1)if(A){z=(m|0)>(((c[Ha>>2]|0)==2?23e3:25e3)|0)?2:1;c[Ha>>2]=z;break}else{c[Ha>>2]=z;break}else{c[Ha>>2]=v;z=v}while(0);v=L-(_((z*40|0)+20|0,B)|0)|0;if(P)v=v-((v|0)/12|0)|0;n=(_(v,C)|0)/100|0;n=n-((_(n,F)|0)/(D|0)|0)|0;m=c[ba>>2]|0;do if((m|0)!=2051){v=c[d+136>>2]|0;do if((v|0)==-1e3){ub=1.0-x;v=~~(ub*16.0e3+x*16.0e3);v=v+((_(_(Q,Q)|0,~~(ub*64.0e3+x*36.0e3)-v|0)|0)>>14)|0;v=(m|0)==2048?v+8e3|0:v;m=c[d+15140>>2]|0;if((m|0)==1002)v=v+-4e3|0;else v=(m|0)>0?v+4e3|0:v;v=(n|0)>=(v|0)?1002:1e3;m=d+15136|0;c[m>>2]=v;do if(c[d+48>>2]|0){if((F|0)<=(128-Q>>4|0))break;c[m>>2]=1e3;v=1e3}while(0);if(!(c[d+184>>2]|0)){c[d+56>>2]=0;u=m;kb=112;break}if(!u){c[d+56>>2]=0;u=m;kb=112;break}c[d+56>>2]=Ia^1;if(!((Ia|0)==0&(Q|0)>100)){u=m;kb=112;break}c[m>>2]=1e3;u=m;v=1e3}else{u=d+15136|0;c[u>>2]=v;kb=112}while(0);if((kb|0)==112)if((v|0)==1002){Ea=u;u=1002;break}if(((G|0)/100|0|0)>(f|0)){c[u>>2]=1002;Ea=u;u=1002}else{Ea=u;u=v}}else{Ea=d+15136|0;c[Ea>>2]=1002;u=1002}while(0);Y=d+176|0;if(c[Y>>2]|0){c[Ea>>2]=1002;u=1002}da=(t|0)>50;if((Ka|0)<((_(da?9e3:6e3,f)|0)/(G<<3|0)|0|0)){c[Ea>>2]=1002;u=1002}do if((z|0)==1?(c[d+15144>>2]|0)==2:0){v=d+68|0;if((c[v>>2]|0)!=0|(u|0)==1002){kb=124;break}m=d+15140|0;if((c[m>>2]|0)==1002){kb=124;break}c[v>>2]=1;c[Ha>>2]=2;Ca=m;m=2}else kb=124;while(0);if((kb|0)==124){c[d+68>>2]=0;Ca=d+15140|0;m=z}A=c[Ca>>2]|0;do if((A|0)>0){v=(u|0)==1002;if((A|0)==1002&(v^1)){Da=(u|0)!=1002;v=Da&1;if(Da){n=v;v=1;Da=0;break}}else{if(!v){n=0;v=0;Da=0;break}if((A|0)==1002){u=1002;n=0;v=0;Da=0;break}v=(u|0)!=1002&1}if(((G|0)/100|0|0)>(f|0)){u=1002;n=v;v=0;Da=0;break}c[Ea>>2]=A;u=A;n=v;v=1;Da=1}else{n=0;v=0;Da=0}while(0);m=L-(_((m*40|0)+20|0,B)|0)|0;if(P)m=m-((m|0)/12|0)|0;m=(_(m,C)|0)/100|0;a:do switch(u|0){case 1001:case 1e3:{if((E|0)<2)m=(m<<2|0)/5|0;ia=m-((_(m,F)|0)/((F*6|0)+10|0)|0)|0;break}case 1002:{if((E|0)>=5){ia=m;break a}ia=(m*9|0)/10|0;break}default:ia=m-((_(m,F)|0)/(D|0)|0)|0}while(0);ja=d+15160|0;if(!(c[ja>>2]|0))if(!v){ea=n;m=0;v=0;fa=0}else{m=0;kb=145}else{c[ja>>2]=0;n=1;m=1;v=1;kb=145}do if((kb|0)==145){z=(G|0)/200|0;z=(_(Ka,z)|0)/(z+f|0)|0;z=(z|0)>257?257:z;if(P){ea=n;fa=z;break}fa=(L|0)/1600|0;ea=n;fa=(z|0)<(fa|0)?z:fa}while(0);if((u|0)!=1002&(A|0)==1002){u=c[d+180>>2]|0;nf(na|0,0,20400)|0;m=0;while(1){if((m|0)==2)break;Fd(na+(m*10156|0)|0,u)|0;m=m+1|0}c[na+20376>>2]=1;c[na+20380>>2]=1;Z=1}else Z=m;B=(c[Ea>>2]|0)==1002;do if(B)kb=156;else{if(c[d+15164>>2]|0){kb=156;break}if(c[d+84>>2]|0){kb=156;break}m=d+15152|0;P=m;m=c[m>>2]|0}while(0);do if((kb|0)==156){if((c[gb>>2]|0)==2?(c[T>>2]|0)!=1:0){n=616;z=616}else{n=616;z=616}u=_(Q,Q)|0;m=0;while(1){if((m|0)==8)break;ma=c[n+(m<<2)>>2]|0;c[U+(m<<2)>>2]=ma+((_(u,(c[z+(m<<2)>>2]|0)-ma|0)|0)>>14);m=m+1|0}A=(c[d+15164>>2]|0)==0;z=d+15156|0;m=1105;do{n=m<<1;u=c[U+(n+-2204<<2)>>2]|0;n=c[U+(n+-2203<<2)>>2]|0;do if(A)if((c[z>>2]|0)<(m|0)){u=u+n|0;break}else{u=u-n|0;break}while(0);if((ia|0)>=(u|0))break;m=m+-1|0}while((m|0)>1101);c[z>>2]=m;u=d+15152|0;c[u>>2]=m;if(B|A^1){P=u;break}if(!((c[d+88>>2]|0)==0&(m|0)>1103)){P=u;break}c[u>>2]=1103;P=u;m=1103}while(0);u=c[d+132>>2]|0;if((m|0)>(u|0))c[P>>2]=u;else u=m;L=d+128|0;m=c[L>>2]|0;z=(m|0)==-1e3;if(!z){c[P>>2]=m;u=m}if((ha|0)<15e3&(B^1)){u=(u|0)<1103?u:1103;c[P>>2]=u}m=c[nb>>2]|0;if((m|0)<24001&(u|0)>1104){c[P>>2]=1104;u=1104}if((m|0)<16001&(u|0)>1103){c[P>>2]=1103;u=1103}if((m|0)<12001&(u|0)>1102){c[P>>2]=1102;u=1102}if((m|0)<8001&(u|0)>1101){c[P>>2]=1101;u=1101}n=c[S>>2]|0;if(!((n|0)==0|z^1)){m=c[Ha>>2]|0;do if((ia|0)>(m*18e3|0)|B^1){if(!((ia|0)>(m*24e3|0)|B^1)){m=1102;break}if((ia|0)<=(m*3e4|0)){m=1103;break}m=(ia|0)>(m*44e3|0)?1105:1104}else m=1101;while(0);ma=(n|0)>(m|0)?n:m;c[S>>2]=ma;u=(u|0)<(ma|0)?u:ma;c[P>>2]=u}D=c[R>>2]|0;Q=d+52|0;E=c[Q>>2]|0;b:do if((c[d+48>>2]|0)==0|(D|0)==0|B)u=0;else{z=(D|0)<25;A=125-D|0;B=(D|0)<6;C=u;while(1){n=C<<1;m=c[648+(n+-2202<<2)>>2]|0;n=c[648+(n+-2201<<2)>>2]|0;switch(E|0){case 1:{m=m-n|0;break}case 0:{m=m+n|0;break}default:{}}ma=((_(m,z?A:100)|0)>>16)*655|0;m=(ma+((((_(m,z?125-D|0:100)|0)&65535)*655|0)>>>16)|0)<(ia|0);if(m|B){u=m&1;break b}if((C|0)<=1101)break;ma=C+-1|0;c[P>>2]=ma;C=ma}c[P>>2]=u;u=0}while(0);c[Q>>2]=u;c[V>>2]=$;Qc(Za,4036,V)|0;m=c[Ea>>2]|0;u=(m|0)==1002;do if(u){if((c[P>>2]|0)!=1102)break;c[P>>2]=1103}while(0);if(c[Y>>2]|0)c[P>>2]=1101;n=c[nb>>2]|0;do if(((n|0)/50|0|0)<(f|0)){if(!u?(W=c[P>>2]|0,(W|0)<=1103):0){L=W;break}if((l|0)!=-1){c[d+8696>>2]=l;c[d+8700>>2]=w}B=((n|0)/25|0|0)<(f|0)?3:2;m=(j+-3|0)/(B|0)|0;m=(m|0)>1276?1276:m;C=_(B,m)|0;G=Fa()|0;n=i;i=i+((1*C|0)+15&-16)|0;c[ca+4>>2]=0;C=d+136|0;D=c[C>>2]|0;E=c[L>>2]|0;F=c[T>>2]|0;c[C>>2]=c[Ea>>2];c[L>>2]=c[P>>2];t=c[Ha>>2]|0;c[T>>2]=t;z=d+68|0;A=c[z>>2]|0;if(!A)c[d+15144>>2]=t;else c[T>>2]=1;t=(Da|0)!=0;u=B+-1|0;w=0;while(1){if((w|0)>=(B|0)){kb=222;break}c[z>>2]=0;if(t&(w|0)==(u|0))c[C>>2]=1002;l=c[nb>>2]|0;v=n+(_(w,m)|0)|0;l=Ic(d,e+((_(w,(_(c[gb>>2]|0,l)|0)/50|0)|0)<<2)|0,(l|0)/50|0,v,m,$,0,0,o,p,q,r,s)|0;if((l|0)<0){t=-3;break}if((Nc(ca,v,l)|0)<0){t=-3;break}w=w+1|0}do if((kb|0)==222){u=(c[hb>>2]|0)==0;if(u){t=((c[Ga>>2]|0)*3|0)/(1200/(B>>>0)|0|0)|0;t=(t|0)<(j|0)?t:j}else t=j;t=Oc(ca,B,h,t,u&1)|0;if((t|0)<0){t=-3;break}c[C>>2]=D;c[L>>2]=E;c[T>>2]=F;c[z>>2]=A}while(0);Na(G|0);h=t;i=ob;return h|0}else L=c[P>>2]|0;while(0);do if((m|0)==1e3){if((L|0)<=1103)break;c[Ea>>2]=1001}else{if(!((m|0)==1001&(L|0)<1104))break;c[Ea>>2]=1e3}while(0);ca=Ka-fa|0;n=(_(c[Ga>>2]|0,f)|0)/(n<<3|0)|0;n=((ca|0)<(n|0)?ca:n)+-1|0;ca=h+1|0;q=Ka+-1|0;c[_a>>2]=ca;o=_a+8|0;c[o>>2]=0;c[_a+12>>2]=0;c[_a+16>>2]=0;ka=_a+20|0;c[ka>>2]=33;T=_a+24|0;c[T>>2]=0;j=_a+28|0;c[j>>2]=-2147483648;U=_a+40|0;c[U>>2]=-1;V=_a+32|0;c[V>>2]=0;W=_a+36|0;c[W>>2]=0;p=_a+4|0;c[p>>2]=q;$=_a+44|0;c[$>>2]=0;S=Aa+f|0;R=_(S,c[gb>>2]|0)|0;ma=Fa()|0;r=i;i=i+((1*(R<<2)|0)+15&-16)|0;R=d+172|0;C=c[gb>>2]|0;B=_(Aa,C)|0;rf(r|0,d+15192+((_((c[R>>2]|0)-Aa|0,C)|0)<<2)|0,B<<2|0)|0;D=(c[Ea>>2]|0)==1002;if(D)u=193536;else u=c[na+8>>2]|0;G=d+15112|0;F=c[G>>2]|0;u=u-F|0;u=F+(((u>>16)*983|0)+(((u&65535)*983|0)>>>16))|0;c[G>>2]=u;c:do if((c[ba>>2]|0)==2048){w=u>>8;do if((w|0)<0)u=0;else{if((w|0)>3966){u=2147483647;break}u=u>>15;m=1<>16)<>7;else u=_(m>>7,l+((_(_(l,128-l|0)|0,-174)|0)>>16)|0)|0;u=m+u|0}while(0);A=r+(B<<2)|0;w=d+15120|0;z=((u<<16>>16)*2471|0)/((c[nb>>2]|0)/1e3|0|0)|0;u=_(z,-471)|0;l=u+268435456|0;ba=l>>6;E=l>>22;m=z<<16>>16;vb=_(z>>16,m)|0;m=_(z&65535,m)|0;z=_(z,(z>>15)+1>>1)|0;wb=vb+(m>>>16)+z<<16>>16;F=ba&65535;G=ba<<16>>16;x=+((_(E,wb)|0)+((_(F,wb)|0)>>16)+(_(ba,(vb+(m>>16)+z+-8388608>>15)+1>>1)|0)|0)*3.725290298461914e-09;y=+((_(E,G)|0)+((_(F,G)|0)>>16)+(_(ba,(l>>21)+1>>1)|0)|0)*3.725290298461914e-09;H=+(l|0)*3.725290298461914e-09;I=+(-268435456-u<<1|0)*3.725290298461914e-09;u=d+15124|0;l=0;while(1){if((l|0)>=(f|0))break;wb=_(l,C)|0;sb=+g[e+(wb<<2)>>2];tb=H*sb;ub=+g[w>>2]+tb;g[w>>2]=+g[u>>2]-ub*x+I*sb;g[u>>2]=tb-ub*y+1.0000000031710769e-30;g[A+(wb<<2)>>2]=ub;l=l+1|0}if((C|0)!=2)break;m=e+4|0;z=d+15128|0;u=A+4|0;l=d+15132|0;w=0;while(1){if((w|0)>=(f|0))break c;wb=w<<1;sb=+g[m+(wb<<2)>>2];tb=H*sb;ub=+g[z>>2]+tb;g[z>>2]=+g[l>>2]-ub*x+I*sb;g[l>>2]=tb-ub*y+1.0000000031710769e-30;g[u+(wb<<2)>>2]=ub;w=w+1|0}}else{m=r+(B<<2)|0;z=d+15120|0;J=12.0/+(c[nb>>2]|0);K=1.0-J;y=+g[z>>2];A=d+15124|0;x=+g[A>>2];if((C|0)!=2){u=0;while(1){if((u|0)>=(f|0))break;tb=+g[e+(u<<2)>>2];ub=tb-y;g[m+(u<<2)>>2]=ub-x;u=u+1|0;y=J*tb+1.0000000031710769e-30+K*y;x=J*ub+1.0000000031710769e-30+K*x}g[z>>2]=y;g[A>>2]=x;break}u=d+15128|0;l=d+15132|0;w=0;H=+g[u>>2];I=+g[l>>2];while(1){if((w|0)>=(f|0))break;vb=w<<1;rb=+g[e+(vb<<2)>>2];wb=vb|1;tb=+g[e+(wb<<2)>>2];sb=rb-y;ub=tb-H;g[m+(vb<<2)>>2]=sb-x;g[m+(wb<<2)>>2]=ub-I;w=w+1|0;y=J*rb+1.0000000031710769e-30+K*y;x=J*sb+1.0000000031710769e-30+K*x;H=J*tb+1.0000000031710769e-30+K*H;I=J*ub+1.0000000031710769e-30+K*I}g[z>>2]=y;g[A>>2]=x;g[u>>2]=H;g[l>>2]=I}while(0);do if(s|0){u=r+(B<<2)|0;l=_(C,f)|0;w=0;x=0.0;while(1){if((w|0)>=(l|0))break;ub=+g[u+(w<<2)>>2];w=w+1|0;x=x+ub*ub}if(!(!(x<1.0e9)|(x!=x|0.0!=0.0)))break;nf(u|0,0,l<<2|0)|0;wb=d+15120|0;c[wb>>2]=0;c[wb+4>>2]=0;c[wb+8>>2]=0;c[wb+12>>2]=0}while(0);do if(D){y=1.0;D=ea;kb=353}else{m=_(C,f)|0;G=Fa()|0;F=i;i=i+((1*(m<<1)|0)+15&-16)|0;m=_(n<<3,t)|0;D=c[Ea>>2]|0;E=(D|0)==1001;do if(!E){c[d+36>>2]=m;t=c[d+15168>>2]|0;if(!t){B=m;y=1.0}else{I=1.0;kb=275}}else{w=c[hb>>2]|0;u=((c[nb>>2]|0)==(f*50|0)?2:1)+(c[Q>>2]<<1)|0;l=1;while(1){if((l|0)>=7){kb=268;break}t=c[688+(l*20|0)>>2]|0;if((t|0)>(m|0)){kb=271;break}l=l+1|0}do if((kb|0)==268)if((l|0)==7){t=(c[808+(u<<2)>>2]|0)+((m+-64e3|0)/2|0)|0;break}else{t=c[688+(l*20|0)>>2]|0;kb=271;break}while(0);if((kb|0)==271){vb=l+-1|0;wb=c[688+(vb*20|0)>>2]|0;t=((_(c[688+(vb*20|0)+(u<<2)>>2]|0,t-m|0)|0)+(_(c[688+(l*20|0)+(u<<2)>>2]|0,m-wb|0)|0)|0)/(t-wb|0)|0}u=(w|0)==0?t+100|0:t;u=(L|0)==1104?u+300|0:u;c[d+36>>2]=u;t=c[d+15168>>2]|0;if(t|0){m=u;I=1.0;kb=275;break}B=u;y=1.0-+X(+(+(u-m|0)*.0009765625*.6931471805599453))}while(0);do if((kb|0)==275){if(!(c[hb>>2]|0)){B=m;y=I;break}if(c[Y>>2]|0){B=m;y=I;break}C=c[P>>2]|0;if((C|0)==1101){A=13;H=8.0e3}else{wb=(C|0)==1102;A=wb?15:17;H=wb?12.0e3:16.0e3}l=c[gb>>2]|0;z=0;x=0.0;while(1){if((z|0)>=(l|0))break;w=z*21|0;B=0;while(1){if((B|0)>=(A|0))break;y=+g[t+(w+B<<2)>>2];u=y<.5;do if(y>-2.0|u^1){if(u){if(!(y>0.0))break}else y=.5;y=y*.5}else y=-2.0;while(0);B=B+1|0;x=x+y}z=z+1|0}wb=~~(H*(x/+(A|0)*+(l|0)+.20000000298023224));u=(_(m,-2)|0)/3|0;u=(wb|0)>(u|0)?wb:u;if((C&-2|0)==1104)t=(u*3|0)/5|0;else t=u;B=m+t|0;c[d+36>>2]=B;wb=_(u,f)|0;y=I;n=n+((wb|0)/(c[nb>>2]<<3|0)|0)|0}while(0);C=c[nb>>2]|0;c[d+32>>2]=(f*1e3|0)/(C|0)|0;l=c[gb>>2]|0;c[d+8>>2]=l;c[d+12>>2]=c[Ha>>2];switch(L|0){case 1101:{c[d+28>>2]=8e3;t=8e3;break}case 1102:{c[d+28>>2]=12e3;t=12e3;break}default:{c[d+28>>2]=16e3;t=16e3}}c[d+24>>2]=E?16e3:8e3;m=d+20|0;c[m>>2]=16e3;do if((D|0)==1e3){if(da)w=(ga<<4|0)/3|0;else w=ha;if((w|0)>=8e3)break;c[m>>2]=12e3;u=d+28|0;t=t>>>0>12e3?12e3:t;c[u>>2]=t;if((w|0)>=7e3)break;c[m>>2]=8e3;c[u>>2]=(t|0)>8e3?8e3:t}while(0);z=(c[hb>>2]|0)==0;c[d+60>>2]=z&1;t=q-fa|0;t=(t|0)>1275?1275:t;c[oa>>2]=t;t=t<<3;A=d+64|0;c[A>>2]=t;do if(z){if(!E)break;c[A>>2]=(_(B,f)|0)/(C|0)|0}else{if(!E)break;m=(_(t,C)|0)/(f|0)|0;u=((C|0)==(f*50|0)?2:1)+(c[Q>>2]<<1)|0;w=1;while(1){if((w|0)>=7){kb=310;break}t=c[688+(w*20|0)>>2]|0;if((t|0)>(m|0)){kb=313;break}w=w+1|0}do if((kb|0)==310)if((w|0)==7){t=(c[808+(u<<2)>>2]|0)+((m+-64e3|0)/2|0)|0;break}else{t=c[688+(w*20|0)>>2]|0;kb=313;break}while(0);if((kb|0)==313){vb=w+-1|0;wb=c[688+(vb*20|0)>>2]|0;t=((_(c[688+(vb*20|0)+(u<<2)>>2]|0,t-m|0)|0)+(_(c[688+(w*20|0)+(u<<2)>>2]|0,m-wb|0)|0)|0)/(t-wb|0)|0}wb=z?t+100|0:t;c[A>>2]=(_((L|0)==1104?wb+300|0:wb,f)|0)/(C|0)|0}while(0);if(Z){c[la>>2]=0;wb=(C|0)/400|0;u=_(l,(c[R>>2]|0)-(c[d+116>>2]|0)-wb|0)|0;vb=d+15192+(u<<2)|0;w=c[Ba>>2]|0;Jc(vb,vb,0.0,1.0,c[w+4>>2]|0,wb,l,c[w+60>>2]|0,C);nf(d+15192|0,0,u<<2|0)|0;u=c[R>>2]|0;l=_(u,c[gb>>2]|0)|0;w=0;while(1){if((w|0)>=(l|0))break;x=+g[d+15192+(w<<2)>>2]*32768.0;do if(x>-32768.0){if(x<32767.0)break;x=32767.0}else x=-32768.0;while(0);t=(g[k>>2]=x,c[k>>2]|0);do if((t&2130706432)>>>0<=1249902592){t=(t|0)<0;x=t?x+-8388608.0+8388608.0:x+8388608.0+-8388608.0;if(!(x==0.0))break;x=t?-0.0:0.0}while(0);b[F+(w<<1)>>1]=~~x;w=w+1|0}zd(na,d+8|0,F,u,0,la,1)|0;l=c[gb>>2]|0}u=_(l,f)|0;w=0;while(1){if((w|0)>=(u|0))break;x=+g[r+((_(Aa,l)|0)+w<<2)>>2]*32768.0;do if(x>-32768.0){if(x<32767.0)break;x=32767.0}else x=-32768.0;while(0);t=(g[k>>2]=x,c[k>>2]|0);do if((t&2130706432)>>>0<=1249902592){t=(t|0)<0;x=t?x+-8388608.0+8388608.0:x+8388608.0+-8388608.0;if(!(x==0.0))break;x=t?-0.0:0.0}while(0);b[F+(w<<1)>>1]=~~x;w=w+1|0}if(!(zd(na,d+8|0,F,f,_a,oa,0)|0)){if(c[oa>>2]|0){do if((c[Ea>>2]|0)==1e3){t=c[d+80>>2]|0;if((t|0)==8e3){u=1101;break}if((t|0)==12e3){u=1102;break}u=(t|0)==16e3?1103:L}else u=L;while(0);wb=c[d+96>>2]|0;c[d+72>>2]=wb;if(!wb)t=ea;else{c[ja>>2]=1;t=0;v=1}Na(G|0);D=t;L=u;kb=353;break}c[lb>>2]=0;v=c[Ea>>2]|0;l=c[Ha>>2]|0;t=(c[nb>>2]|0)/(f|0)|0;u=0;while(1){if((t|0)>=400)break;t=t<<1;u=u+1|0}switch(v|0){case 1e3:{t=(L<<5)+96&224|(u<<3)+-16;break}case 1002:{t=((L|0)<1102?0:(L<<5)+64&96)|u<<3|128;break}default:t=L<<4|(u<<3)+240|96}a[h>>0]=t|((l|0)==2&1)<<2;t=1}else t=-3;Na(G|0)}while(0);d:do if((kb|0)==353){switch(L|0){case 1101:{t=13;break}case 1103:case 1102:{t=17;break}case 1104:{t=19;break}default:t=21}c[ta>>2]=t;Qc(Za,10012,ta)|0;c[ua>>2]=c[Ha>>2];Qc(Za,10008,ua)|0;c[qa>>2]=-1;Qc(Za,4002,qa)|0;do if((c[Ea>>2]|0)==1e3){l=c[gb>>2]|0;n=((_(l,c[nb>>2]|0)|0)/400|0)<<2;m=i;i=i+((1*n|0)+15&-16)|0;n=0}else{c[ra>>2]=0;Qc(Za,4006,ra)|0;c[sa>>2]=(c[d+76>>2]|0)==0?2:0;Qc(Za,10002,sa)|0;do if((c[Ea>>2]|0)==1001){t=(c[ka>>2]|0)+((aa(c[j>>2]|0)|0)+-32)+7>>3;t=(v|0)==0?t:t+3|0;if(!(c[hb>>2]|0)){n=(t|0)>(n|0)?t:n;break}else{c[va>>2]=(c[Ga>>2]|0)-(c[d+36>>2]|0);Qc(Za,4002,va)|0;c[wa>>2]=0;Qc(Za,4020,wa)|0;n=q-fa|0;break}}else{if(!(c[hb>>2]|0))break;do if((c[pa>>2]|0)==5010){t=c[nb>>2]|0;if(((t|0)/50|0|0)==(f|0)){t=0;break}t=_(((c[Ha>>2]|0)*60|0)+40|0,((t|0)/(f|0)|0)+-50|0)|0;if(!(c[jb>>2]|0))break;t=~~(+(t|0)*(+g[jb+4>>2]*.5+1.0))}else t=0;while(0);c[xa>>2]=1;Qc(Za,4006,xa)|0;c[ya>>2]=c[d+152>>2];Qc(Za,4020,ya)|0;c[za>>2]=(c[Ga>>2]|0)+t;Qc(Za,4002,za)|0;n=q-fa|0}while(0);t=c[Ea>>2]|0;u=c[gb>>2]|0;l=c[nb>>2]|0;w=(_(u,l)|0)/400|0;m=i;i=i+((1*(w<<2)|0)+15&-16)|0;if((t|0)==1e3){l=u;break}wb=c[Ca>>2]|0;if(!((t|0)!=(wb|0)&(wb|0)>0)){l=u;break}rf(m|0,d+15192+((_((c[R>>2]|0)-Aa-((l|0)/400|0)|0,u)|0)<<2)|0,w<<2|0)|0;l=u}while(0);t=c[R>>2]|0;u=d+15192|0;if((_(l,t-S|0)|0)>0){wb=_(l,t-f-Aa|0)|0;sf(u|0,d+15192+((_(l,f)|0)<<2)|0,wb<<2|0)|0;rf(d+15192+(wb<<2)|0,r|0,(_(S,l)|0)<<2|0)|0}else rf(u|0,r+((_(S-t|0,l)|0)<<2)|0,(_(t,l)|0)<<2|0)|0;t=d+15116|0;x=+g[t>>2];if(x<1.0|y<1.0){wb=c[Ba>>2]|0;Jc(r,r,x,y,c[wb+4>>2]|0,f,c[gb>>2]|0,c[wb+60>>2]|0,c[nb>>2]|0)}g[t>>2]=y;B=c[Ea>>2]|0;C=(B|0)==1001;if(!(C?(c[Ha>>2]|0)!=1:0)){if((ia|0)>=24e3){t=ia+-24e3|0;if((t<<1|0)>16384)t=16384;else kb=381}else{t=0;kb=381}if((kb|0)==381)t=t<<1;c[d+92>>2]=t}do if(!(c[d+15168>>2]|0)){if((c[gb>>2]|0)!=2)break;A=d+15108|0;t=b[A>>1]|0;z=c[d+92>>2]|0;if(!(t<<16>>16<16384|(z|0)<16384))break;w=c[Ba>>2]|0;u=c[w+60>>2]|0;l=48e3/(c[nb>>2]|0)|0;w=(c[w+4>>2]|0)/(l|0)|0;x=1.0-+(t<<16>>16)*.00006103515625;y=1.0-+(z|0)*.00006103515625;t=0;while(1){if((t|0)>=(w|0))break;ub=+g[u+((_(t,l)|0)<<2)>>2];ub=ub*ub;wb=t<<1;vb=r+(wb<<2)|0;sb=+g[vb>>2];wb=r+((wb|1)<<2)|0;tb=+g[wb>>2];ub=(ub*y+(1.0-ub)*x)*((sb-tb)*.5);g[vb>>2]=sb-ub;g[wb>>2]=tb+ub;t=t+1|0}while(1){if((t|0)>=(f|0))break;wb=t<<1;vb=r+(wb<<2)|0;sb=+g[vb>>2];wb=r+((wb|1)<<2)|0;tb=+g[wb>>2];ub=y*((sb-tb)*.5);g[vb>>2]=sb-ub;g[wb>>2]=tb+ub;t=t+1|0}b[A>>1]=z}while(0);e:do if((B|0)==1002)kb=456;else{u=c[ka>>2]|0;t=c[j>>2]|0;l=u+((aa(t|0)|0)+-32)|0;if((l+17+(C?20:0)|0)>((Ka<<3)+-8|0)){kb=456;break}f:do if(C){if(!v){if((l+37|0)>(n<<3|0)){kb=456;break e}t=t-(t>>>12)|0}else{wb=t>>>12;c[V>>2]=(c[V>>2]|0)+(t-wb);t=wb}c[j>>2]=t;while(1){if(t>>>0>=8388609){l=t;w=u;break f}l=c[V>>2]|0;w=l>>>23;if((w|0)==255)c[W>>2]=(c[W>>2]|0)+1;else{l=l>>>31;t=c[U>>2]|0;if((t|0)>-1){u=c[T>>2]|0;if((u+(c[o>>2]|0)|0)>>>0<(c[p>>2]|0)>>>0){c[T>>2]=u+1;a[(c[_a>>2]|0)+u>>0]=t+l;t=0}else t=-1;c[$>>2]=c[$>>2]|t}t=c[W>>2]|0;if(t|0){l=l+255&255;do{u=c[T>>2]|0;if((u+(c[o>>2]|0)|0)>>>0<(c[p>>2]|0)>>>0){c[T>>2]=u+1;a[(c[_a>>2]|0)+u>>0]=l;u=0;t=c[W>>2]|0}else u=-1;c[$>>2]=c[$>>2]|u;t=t+-1|0;c[W>>2]=t}while((t|0)!=0)}c[U>>2]=w&255;l=c[V>>2]|0;t=c[j>>2]|0;u=c[ka>>2]|0}c[V>>2]=l<<8&2147483392;t=t<<8;c[j>>2]=t;u=u+8|0;c[ka>>2]=u}}else{l=t;w=u}while(0);if(!v){kb=456;break}t=l>>>1;u=l-t|0;if(!D)t=u;else c[V>>2]=(c[V>>2]|0)+u;c[j>>2]=t;u=w;while(1){if(t>>>0>=8388609)break;l=c[V>>2]|0;w=l>>>23;if((w|0)==255)c[W>>2]=(c[W>>2]|0)+1;else{l=l>>>31;t=c[U>>2]|0;if((t|0)>-1){u=c[T>>2]|0;if((u+(c[o>>2]|0)|0)>>>0<(c[p>>2]|0)>>>0){c[T>>2]=u+1;a[(c[_a>>2]|0)+u>>0]=t+l;t=0}else t=-1;c[$>>2]=c[$>>2]|t}t=c[W>>2]|0;if(t|0){l=l+255&255;do{u=c[T>>2]|0;if((u+(c[o>>2]|0)|0)>>>0<(c[p>>2]|0)>>>0){c[T>>2]=u+1;a[(c[_a>>2]|0)+u>>0]=l;u=0;t=c[W>>2]|0}else u=-1;c[$>>2]=c[$>>2]|u;t=t+-1|0;c[W>>2]=t}while((t|0)!=0)}c[U>>2]=w&255;l=c[V>>2]|0;t=c[j>>2]|0;u=c[ka>>2]|0}c[V>>2]=l<<8&2147483392;t=t<<8;c[j>>2]=t;u=u+8|0;c[ka>>2]=u}w=(c[Ea>>2]|0)==1001;if(w)l=n;else l=u+((aa(t|0)|0)+-32)+7>>3;wb=q-l|0;l=(c[Ga>>2]|0)/1600|0;l=(wb|0)<(l|0)?wb:l;if((l|0)>=2)if((l|0)>257)z=257;else kb=436;else{l=2;kb=436}if((kb|0)==436)z=l;if(!w){A=z;break}l=t>>>8;if((z|0)==2)t=t+(_(l,-255)|0)|0;else{t=t-(_(l,258-z|0)|0)|0;c[V>>2]=(c[V>>2]|0)+t;t=l}c[j>>2]=t;while(1){if(t>>>0>=8388609){A=z;break e}l=c[V>>2]|0;w=l>>>23;if((w|0)==255)c[W>>2]=(c[W>>2]|0)+1;else{l=l>>>31;t=c[U>>2]|0;if((t|0)>-1){u=c[T>>2]|0;if((u+(c[o>>2]|0)|0)>>>0<(c[p>>2]|0)>>>0){c[T>>2]=u+1;a[(c[_a>>2]|0)+u>>0]=t+l;t=0}else t=-1;c[$>>2]=c[$>>2]|t}t=c[W>>2]|0;if(t|0){l=l+255&255;do{u=c[T>>2]|0;if((u+(c[o>>2]|0)|0)>>>0<(c[p>>2]|0)>>>0){c[T>>2]=u+1;a[(c[_a>>2]|0)+u>>0]=l;u=0;t=c[W>>2]|0}else u=-1;c[$>>2]=c[$>>2]|u;t=t+-1|0;c[W>>2]=t}while((t|0)!=0)}c[U>>2]=w&255;l=c[V>>2]|0;t=c[j>>2]|0;u=c[ka>>2]|0}c[V>>2]=l<<8&2147483392;t=t<<8;c[j>>2]=t;u=u+8|0;c[ka>>2]=u}}while(0);if((kb|0)==456){c[ja>>2]=0;v=0;A=0}wb=c[Ea>>2]|0;u=(wb|0)==1002?0:17;if((wb|0)==1e3){t=(c[ka>>2]|0)+((aa(c[j>>2]|0)|0)+-32)+7>>3;cd(_a);w=t}else{w=q-A|0;w=(w|0)<(n|0)?w:n;vb=c[_a>>2]|0;t=c[o>>2]|0;wb=0-t|0;sf(vb+w+wb|0,vb+(c[p>>2]|0)+wb|0,t|0)|0;c[p>>2]=w;t=0}l=(v|0)==0;if(l?(c[Ea>>2]|0)==1e3:0)kb=464;else kb=462;do if((kb|0)==462){c[La>>2]=jb;Qc(Za,10022,La)|0;if((c[Ea>>2]|0)!=1001){kb=464;break}c[Ja>>2]=c[d+100>>2];c[Ja+4>>2]=c[d+104>>2];c[Ma>>2]=Ja;Qc(Za,10028,Ma)|0}while(0);if((kb|0)==464){c[Oa>>2]=0;Qc(Za,10028,Oa)|0}if(!(l|(D|0)==0)){c[Pa>>2]=0;Qc(Za,10010,Pa)|0;c[Qa>>2]=0;Qc(Za,4006,Qa)|0;c[Ra>>2]=-1;Qc(Za,4002,Ra)|0;if((Rc(Za,r,(c[nb>>2]|0)/200|0,ca+w|0,A,0)|0)<0){t=-3;break}c[Sa>>2]=ib;Qc(Za,4031,Sa)|0;Qc(Za,4028,Ta)|0}c[mb>>2]=u;Qc(Za,10010,mb)|0;u=c[Ea>>2]|0;do if((u|0)==1e3)kb=482;else{wb=c[Ca>>2]|0;if((u|0)!=(wb|0)&(wb|0)>0){Qc(Za,4028,Va)|0;Rc(Za,m,(c[nb>>2]|0)/400|0,Ua,2,0)|0;c[Wa>>2]=0;Qc(Za,10002,Wa)|0}if(((c[ka>>2]|0)+((aa(c[j>>2]|0)|0)+-32)|0)>(w<<3|0)){kb=482;break}do if(!(l|(D|0)==0)){if((c[Ea>>2]|0)!=1001)break;if(!(c[hb>>2]|0))break;c[Xa>>2]=(c[Ga>>2]|0)-(c[d+36>>2]|0);Qc(Za,4002,Xa)|0}while(0);c[Ya>>2]=c[hb>>2];Qc(Za,4006,Ya)|0;t=Rc(Za,r,f,0,w,_a)|0;if((t|0)<0){t=-3;break d}if(l){v=0;kb=488;break}if(!D){u=w;kb=484;break}u=c[Ea>>2]|0;if((u|0)!=1001){z=v;break}if(!(c[hb>>2]|0)){kb=488;break}rf(ca+t|0,ca+w|0,A|0)|0;kb=488}while(0);do if((kb|0)==482){if(l){v=0;kb=488;break}else u=w;if(!D)kb=484;else kb=488}while(0);if((kb|0)==484){w=c[nb>>2]|0;l=(w|0)/200|0;w=(w|0)/400|0;Qc(Za,4028,$a)|0;c[ab>>2]=0;Qc(Za,10010,ab)|0;c[bb>>2]=0;Qc(Za,10002,bb)|0;c[cb>>2]=0;Qc(Za,4006,cb)|0;c[db>>2]=-1;Qc(Za,4002,db)|0;if((c[Ea>>2]|0)==1001){vb=c[_a>>2]|0;u=c[o>>2]|0;wb=0-u|0;sf(vb+t+wb|0,vb+(c[p>>2]|0)+wb|0,u|0)|0;c[p>>2]=t;u=t}wb=f-l|0;Rc(Za,r+((_(c[gb>>2]|0,wb-w|0)|0)<<2)|0,w,eb,2,0)|0;if((Rc(Za,r+((_(c[gb>>2]|0,wb)|0)<<2)|0,l,ca+u|0,A,0)|0)<0){t=-3;break}c[fb>>2]=ib;Qc(Za,4031,fb)|0;kb=488}if((kb|0)==488){u=c[Ea>>2]|0;z=v}w=c[Ha>>2]|0;v=(c[nb>>2]|0)/(f|0)|0;l=0;while(1){if((v|0)>=400)break;v=v<<1;l=l+1|0}switch(u|0){case 1e3:{u=(L<<5)+96&224|(l<<3)+-16;break}case 1002:{u=((L|0)<1102?0:(L<<5)+64&96)|l<<3|128;break}default:u=L<<4|(l<<3)+240|96}a[h>>0]=u|((w|0)==2&1)<<2;n=c[j>>2]|0;c[lb>>2]=n^c[ib>>2];if(!Da)u=c[Ea>>2]|0;else u=1002;c[Ca>>2]=u;m=c[Ha>>2]|0;c[d+15144>>2]=m;c[d+15148>>2]=f;c[d+15164>>2]=0;g:do if(c[d+184>>2]|0){do if(!(c[jb>>2]|0)){if(!Ia)break g;u=d+19036|0}else{u=d+19036|0;y=+g[d+19040>>2];if(Ia|0)break;w=+g[jb+28>>2]<.10000000149011612;if(w){v=_(c[gb>>2]|0,f)|0;l=0;x=0.0;while(1){if((l|0)>=(v|0))break;ub=+g[e+(l<<2)>>2];l=l+1|0;x=x+ub*ub}if(!((x/+(v|0)*316.2300109863281<=y|0)==0|w^1))break}c[u>>2]=0;break g}while(0);wb=c[u>>2]|0;v=wb+1|0;c[u>>2]=v;if((wb|0)<=9)break;if((v|0)>=31){c[u>>2]=10;break}c[lb>>2]=0;v=c[Ea>>2]|0;t=(c[nb>>2]|0)/(f|0)|0;u=0;while(1){if((t|0)>=400)break;t=t<<1;u=u+1|0}switch(v|0){case 1e3:{t=(L<<5)+96&224|(u<<3)+-16;break}case 1002:{t=((L|0)<1102?0:(L<<5)+64&96)|u<<3|128;break}default:t=L<<4|(u<<3)+240|96}a[h>>0]=t|((m|0)==2&1)<<2;t=1;break d}while(0);h:do if(((c[ka>>2]|0)+((aa(n|0)|0)+-32)|0)>((Ka<<3)+-8|0)){if((Ka|0)<2){t=-2;break d}a[ca>>0]=0;c[lb>>2]=0;t=1}else{if(!((c[Ea>>2]|0)==1e3&(z|0)==0))break;while(1){if((t|0)<=2)break h;if(a[h+t>>0]|0)break h;t=t+-1|0}}while(0);t=t+(A+1)|0;i:do if(!(c[hb>>2]|0)){j:do if((t|0)>=1){do if((t|0)!=(Ka|0)){if((t|0)>(Ka|0))break j;u=mb+4|0;c[u>>2]=0;wb=h+Ka+(0-t)|0;sf(wb|0,h|0,t|0)|0;if(Nc(mb,wb,t)|0)break j;t=Oc(mb,c[u>>2]|0,h,Ka,1)|0;if((t|0)>0)break;if(!t){t=Ka;break i}else{t=-3;break d}}while(0);t=Ka;break i}while(0);t=-3;break d}while(0)}while(0);Na(ma|0);wb=t;i=ob;return wb|0}while(0);v=c[d+15136>>2]|0;u=c[d+15152>>2]|0;u=(u|0)==0?1101:u;v=(v|0)==0?1e3:v;k:do if((t|0)>100)kb=63;else{if((t|0)<50|(v|0)==1e3)if((u|0)>1103){u=1103;w=1e3;break}else{v=1e3;kb=64;break}switch(v|0){case 1002:{kb=63;break k}case 1001:break;default:{w=v;break k}}u=(u|0)>1104?u:1104;w=1001}while(0);if((kb|0)==63)if((u|0)==1102){u=1101;w=1002}else{v=1002;kb=64}if((kb|0)==64)w=v;l=c[d+15104>>2]|0;v=0;while(1){if((t|0)>=400)break;t=t<<1;v=v+1|0}switch(w|0){case 1e3:{t=(u<<5)+96&224|(v<<3)+-16;break}case 1002:{t=((u|0)<1102?0:(u<<5)+64&96)|v<<3|128;break}default:t=u<<4|(v<<3)+240|96}t=(t|((l|0)==2&1)<<2)&255;a[h>>0]=t;if(c[hb>>2]|0){wb=1;i=ob;return wb|0}do if((Ka|0)==1)kb=78;else{if((Ka|0)>=1){u=D+4|0;c[u>>2]=0;wb=h+Ka+-1|0;a[wb>>0]=t;t=Nc(D,wb,1)|0;if(!t){t=Oc(D,c[u>>2]|0,h,Ka,1)|0;if((t|0)>0){kb=78;break}if(!t)break;i=ob;return t|0}}else t=-1;wb=t;i=ob;return wb|0}while(0);wb=Ka;i=ob;return wb|0}function Jc(a,b,c,d,e,f,h,i,j){a=a|0;b=b|0;c=+c;d=+d;e=e|0;f=f|0;h=h|0;i=i|0;j=j|0;var k=0,l=0,m=0.0;k=48e3/(j|0)|0;l=(e|0)/(k|0)|0;a:do if((h|0)==1){j=0;while(1){if((j|0)>=(l|0)){j=0;break a}m=+g[i+((_(j,k)|0)<<2)>>2];m=m*m;g[b+(j<<2)>>2]=(m*d+(1.0-m)*c)*+g[a+(j<<2)>>2];j=j+1|0}}else{j=0;while(1){if((j|0)>=(l|0)){j=0;break a}m=+g[i+((_(j,k)|0)<<2)>>2];m=m*m;m=m*d+(1.0-m)*c;e=j<<1;g[b+(e<<2)>>2]=m*+g[a+(e<<2)>>2];e=e|1;g[b+(e<<2)>>2]=m*+g[a+(e<<2)>>2];j=j+1|0}}while(0);do{e=l;while(1){if((e|0)>=(f|0))break;i=(_(e,h)|0)+j|0;g[b+(i<<2)>>2]=+g[a+(i<<2)>>2]*d;e=e+1|0}j=j+1|0}while((j|0)<(h|0));return}function Kc(a,d,e,f){a=a|0;d=d|0;e=e|0;f=f|0;var h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;p=i;if((c[a+108>>2]|0)==2051)h=0;else h=c[a+116>>2]|0;k=c[a+156>>2]|0;o=a+112|0;l=c[a+144>>2]|0;j=(k|0)==5010;a:do if(((l|0)/200|0|0)>(e|0)|j^1){h=(l|0)/400|0;if((h|0)<=(e|0)){if((k|0)!=5e3){if(j)h=(l|0)/50|0;else{if((k+-5001|0)>>>0>=6){m=-1;break}m=(l*3|0)/50|0;h=h<(e|0)){m=-1;break}}else h=e;if(!((h*400|0)==(l|0)|(h*200|0)==(l|0)|(h*100|0)==(l|0))?(m=h*50|0,!((m|0)==(l|0)|(h*25|0)==(l|0)|(m|0)==(l*3|0))):0)m=-1;else n=16}else m=-1}else{k=(l|0)/400|0;j=Hc(d,e,c[o>>2]|0,l,c[a+160>>2]|0,a+7060|0,h,1)|0;while(1){h=k<-1?h:-1;h=c[o>>2]|0;j=_(m,h)|0;k=i;i=i+((1*(j<<2)|0)+15&-16)|0;l=0;while(1){if((l|0)>=(j|0))break;g[k+(l<<2)>>2]=+(b[d+(l<<1)>>1]|0)*.000030517578125;l=l+1|0}a=Ic(a,k,m,f,3828,16,d,e,0,-2,h,1,0)|0;i=p;return a|0}function Lc(a,d,e){a=a|0;d=d|0;e=e|0;var f=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;q=i;i=i+80|0;k=q+48|0;h=q+40|0;f=q+32|0;n=q+24|0;m=q+16|0;l=q+8|0;j=q;p=q+56|0;c[p>>2]=e;o=a+(c[a>>2]|0)|0;a:do switch(d|0){case 4e3:{o=(c[p>>2]|0)+(4-1)&~(4-1);d=c[o>>2]|0;c[p>>2]=o+4;switch(d|0){case 2051:case 2049:case 2048:break;default:{e=-1;d=108;break a}}e=a+108|0;if((c[a+15164>>2]|0)==0?(c[e>>2]|0)!=(d|0):0){e=-1;d=108;break a}c[e>>2]=d;e=0;d=108;break}case 4001:{o=(c[p>>2]|0)+(4-1)&~(4-1);e=c[o>>2]|0;c[p>>2]=o+4;if(!e)d=109;else{c[e>>2]=c[a+108>>2];e=0;d=108}break}case 4002:{o=(c[p>>2]|0)+(4-1)&~(4-1);e=c[o>>2]|0;c[p>>2]=o+4;if((e|0)!=-1e3)if((e|0)!=-1){if((e|0)<1){d=109;break a}if((e|0)<501)e=500;else{p=(c[a+112>>2]|0)*3e5|0;e=(e|0)>(p|0)?p:e}}else e=-1;else e=-1e3;c[a+164>>2]=e;e=0;d=108;break}case 4003:{o=(c[p>>2]|0)+(4-1)&~(4-1);f=c[o>>2]|0;c[p>>2]=o+4;if(!f)d=109;else{e=c[a+15148>>2]|0;if(!e)d=(c[a+144>>2]|0)/400|0;else d=e;e=c[a+164>>2]|0;switch(e|0){case -1e3:{e=c[a+144>>2]|0;e=((e*60|0)/(d|0)|0)+(_(e,c[a+112>>2]|0)|0)|0;break}case -1:{e=((c[a+144>>2]|0)*10208|0)/(d|0)|0;break}default:{}}c[f>>2]=e;e=0;d=108}break}case 4022:{o=(c[p>>2]|0)+(4-1)&~(4-1);e=c[o>>2]|0;c[p>>2]=o+4;if((e|0)<1){if((e|0)!=-1e3){d=109;break a}}else if((e|0)>(c[a+112>>2]|0)){d=109;break a}c[a+120>>2]=e;e=0;d=108;break}case 4023:{o=(c[p>>2]|0)+(4-1)&~(4-1);e=c[o>>2]|0;c[p>>2]=o+4;if(!e)d=109;else{c[e>>2]=c[a+120>>2];e=0;d=108}break}case 4004:{o=(c[p>>2]|0)+(4-1)&~(4-1);e=c[o>>2]|0;c[p>>2]=o+4;if((e+-1101|0)>>>0>4)d=109;else{c[a+132>>2]=e;switch(e|0){case 1101:{c[a+20>>2]=8e3;e=0;d=108;break a}case 1102:{c[a+20>>2]=12e3;e=0;d=108;break a}default:{c[a+20>>2]=16e3;e=0;d=108;break a}}}break}case 4005:{o=(c[p>>2]|0)+(4-1)&~(4-1);e=c[o>>2]|0;c[p>>2]=o+4;if(!e)d=109;else{c[e>>2]=c[a+132>>2];e=0;d=108}break}case 4008:{o=(c[p>>2]|0)+(4-1)&~(4-1);e=c[o>>2]|0;c[p>>2]=o+4;if((e|0)>=1101){if((e|0)>1105){d=109;break a}c[a+128>>2]=e;if((e|0)==1101){c[a+20>>2]=8e3;e=0;d=108;break a}else d=e;e=a+20|0;if((d|0)==1102){c[e>>2]=12e3;e=0;d=108;break a}}else{if((e|0)!=-1e3){d=109;break a}c[a+128>>2]=-1e3;e=a+20|0}c[e>>2]=16e3;e=0;d=108;break}case 4009:{o=(c[p>>2]|0)+(4-1)&~(4-1);e=c[o>>2]|0;c[p>>2]=o+4;if(!e)d=109;else{c[e>>2]=c[a+15152>>2];e=0;d=108}break}case 4016:{o=(c[p>>2]|0)+(4-1)&~(4-1);e=c[o>>2]|0;c[p>>2]=o+4;if(e>>>0>1)d=109;else{c[a+184>>2]=e;e=0;d=108}break}case 4017:{o=(c[p>>2]|0)+(4-1)&~(4-1);e=c[o>>2]|0;c[p>>2]=o+4;if(!e)d=109;else{c[e>>2]=c[a+184>>2];e=0;d=108}break}case 4010:{n=(c[p>>2]|0)+(4-1)&~(4-1);e=c[n>>2]|0;c[p>>2]=n+4;if(e>>>0>10)d=109;else{c[a+44>>2]=e;c[j>>2]=e;Qc(o,4010,j)|0;e=0;d=108}break}case 4011:{o=(c[p>>2]|0)+(4-1)&~(4-1);e=c[o>>2]|0;c[p>>2]=o+4;if(!e)d=109;else{c[e>>2]=c[a+44>>2];e=0;d=108}break}case 4012:{o=(c[p>>2]|0)+(4-1)&~(4-1);e=c[o>>2]|0;c[p>>2]=o+4;if(e>>>0>1)d=109;else{c[a+48>>2]=e;e=0;d=108}break}case 4013:{o=(c[p>>2]|0)+(4-1)&~(4-1);e=c[o>>2]|0;c[p>>2]=o+4;if(!e)d=109;else{c[e>>2]=c[a+48>>2];e=0;d=108}break}case 4014:{n=(c[p>>2]|0)+(4-1)&~(4-1);e=c[n>>2]|0;c[p>>2]=n+4;if(e>>>0>100)d=109;else{c[a+40>>2]=e;c[l>>2]=e;Qc(o,4014,l)|0;e=0;d=108}break}case 4015:{o=(c[p>>2]|0)+(4-1)&~(4-1);e=c[o>>2]|0;c[p>>2]=o+4;if(!e)d=109;else{c[e>>2]=c[a+40>>2];e=0;d=108}break}case 4006:{o=(c[p>>2]|0)+(4-1)&~(4-1);e=c[o>>2]|0;c[p>>2]=o+4;if(e>>>0>1)d=109;else{c[a+148>>2]=e;c[a+60>>2]=1-e;e=0;d=108}break}case 4007:{o=(c[p>>2]|0)+(4-1)&~(4-1);e=c[o>>2]|0;c[p>>2]=o+4;if(!e)d=109;else{c[e>>2]=c[a+148>>2];e=0;d=108}break}case 11018:{o=(c[p>>2]|0)+(4-1)&~(4-1);e=c[o>>2]|0;c[p>>2]=o+4;if((e+1|0)>>>0>101)d=109;else{c[a+140>>2]=e;e=0;d=108}break}case 11019:{o=(c[p>>2]|0)+(4-1)&~(4-1);e=c[o>>2]|0;c[p>>2]=o+4;if(!e)d=109;else{c[e>>2]=c[a+140>>2];e=0;d=108}break}case 4020:{o=(c[p>>2]|0)+(4-1)&~(4-1);e=c[o>>2]|0;c[p>>2]=o+4;if(e>>>0>1)d=109;else{c[a+152>>2]=e;e=0;d=108}break}case 4021:{o=(c[p>>2]|0)+(4-1)&~(4-1);e=c[o>>2]|0;c[p>>2]=o+4;if(!e)d=109;else{c[e>>2]=c[a+152>>2];e=0;d=108}break}case 4024:{o=(c[p>>2]|0)+(4-1)&~(4-1);e=c[o>>2]|0;c[p>>2]=o+4;if((e|0)<3001)switch(e|0){case -1e3:break;default:{d=109;break a}}else switch(e|0){case 3002:case 3001:break;default:{d=109;break a}}c[a+124>>2]=e;e=0;d=108;break}case 4025:{o=(c[p>>2]|0)+(4-1)&~(4-1);e=c[o>>2]|0;c[p>>2]=o+4;if(!e)d=109;else{c[e>>2]=c[a+124>>2];e=0;d=108}break}case 4027:{o=(c[p>>2]|0)+(4-1)&~(4-1);d=c[o>>2]|0;c[p>>2]=o+4;if(d){e=(c[a+144>>2]|0)/400|0;c[d>>2]=e;if((c[a+108>>2]|0)==2051){e=0;d=108}else{c[d>>2]=e+(c[a+116>>2]|0);e=0;d=108}}else d=109;break}case 4029:{o=(c[p>>2]|0)+(4-1)&~(4-1);e=c[o>>2]|0;c[p>>2]=o+4;if(!e)d=109;else{c[e>>2]=c[a+144>>2];e=0;d=108}break}case 4031:{o=(c[p>>2]|0)+(4-1)&~(4-1);e=c[o>>2]|0;c[p>>2]=o+4;if(!e)d=109;else{c[e>>2]=c[a+19044>>2];e=0;d=108}break}case 4036:{o=(c[p>>2]|0)+(4-1)&~(4-1);e=c[o>>2]|0;c[p>>2]=o+4;if((e+-8|0)>>>0>16)d=109;else{c[a+168>>2]=e;e=0;d=108}break}case 4037:{o=(c[p>>2]|0)+(4-1)&~(4-1);e=c[o>>2]|0;c[p>>2]=o+4;if(!e)d=109;else{c[e>>2]=c[a+168>>2];e=0;d=108}break}case 4040:{n=(c[p>>2]|0)+(4-1)&~(4-1);e=c[n>>2]|0;c[p>>2]=n+4;switch(e|0){case 5010:case 5006:case 5005:case 5004:case 5003:case 5002:case 5001:case 5e3:break;default:{d=109;break a}}c[a+156>>2]=e;c[m>>2]=e;Qc(o,4040,m)|0;e=0;d=108;break}case 4041:{o=(c[p>>2]|0)+(4-1)&~(4-1);e=c[o>>2]|0;c[p>>2]=o+4;if(!e)d=109;else{c[e>>2]=c[a+156>>2];e=0;d=108}break}case 4042:{o=(c[p>>2]|0)+(4-1)&~(4-1);e=c[o>>2]|0;c[p>>2]=o+4;if(e>>>0>1)d=109;else{c[a+76>>2]=e;e=0;d=108}break}case 4043:{o=(c[p>>2]|0)+(4-1)&~(4-1);e=c[o>>2]|0;c[p>>2]=o+4;if(!e)d=109;else{c[e>>2]=c[a+76>>2];e=0;d=108}break}case 4028:{f=a+(c[a+4>>2]|0)|0;h=a+15104|0;nf(a+192|0,0,18856)|0;Qc(o,4028,n)|0;e=c[a+180>>2]|0;nf(f|0,0,20400)|0;d=0;while(1){if((d|0)==2)break;Fd(f+(d*10156|0)|0,e)|0;d=d+1|0}c[f+20376>>2]=1;c[f+20380>>2]=1;c[h>>2]=c[a+112>>2];b[a+15108>>1]=16384;g[a+15116>>2]=1.0;c[a+15164>>2]=1;c[a+15136>>2]=1001;c[a+15152>>2]=1105;c[a+15112>>2]=193536;e=0;d=108;break}case 11002:{o=(c[p>>2]|0)+(4-1)&~(4-1);e=c[o>>2]|0;c[p>>2]=o+4;if((e|0)<1e3){if((e|0)!=-1e3){d=109;break a}}else if((e|0)>1002){d=109;break a}c[a+136>>2]=e;e=0;d=108;break}case 10024:{d=(c[p>>2]|0)+(4-1)&~(4-1);e=c[d>>2]|0;c[p>>2]=d+4;c[a+176>>2]=e;c[f>>2]=e;e=Qc(o,10024,f)|0;d=108;break}case 10026:{d=(c[p>>2]|0)+(4-1)&~(4-1);e=c[d>>2]|0;c[p>>2]=d+4;c[a+15168>>2]=e;c[h>>2]=e;e=Qc(o,10026,h)|0;d=108;break}case 10015:{a=(c[p>>2]|0)+(4-1)&~(4-1);e=c[a>>2]|0;c[p>>2]=a+4;if(!e)d=109;else{c[k>>2]=e;e=Qc(o,10015,k)|0;d=108}break}default:{e=-5;d=108}}while(0);if((d|0)==108){a=e;i=q;return a|0}else if((d|0)==109){a=-1;i=q;return a|0}return 0}function Mc(a){a=a|0;Ie(a);return}function Nc(b,e,f){b=b|0;e=e|0;f=f|0;var g=0,h=0,j=0,k=0,l=0,m=0;m=i;i=i+16|0;k=m;if((f|0)<1){l=-4;i=m;return l|0}l=b+4|0;j=c[l>>2]|0;a:do if(j){if(((a[b>>0]^a[e>>0])&255)>=4){l=-4;i=m;return l|0}}else{a[b>>0]=a[e>>0]|0;g=a[e>>0]|0;do if(g<<24>>24>=0)if((g&96)==96){if(g&8){g=160;break}c[b+296>>2]=80;break a}else{g=(g&255)>>>3&3;if((g|0)==3){g=480;break}c[b+296>>2]=(8e3<>>0)/100|0;break a}else g=(8e3<<((g&255)>>>3&3)>>>0)/400|0;while(0);c[b+296>>2]=g}while(0);g=(d[e>>0]|0)&3;if(g)if((g|0)==3){if((f|0)<2){l=-4;i=m;return l|0}g=(d[e+1>>0]|0)&63;if(!g){l=-4;i=m;return l|0}else h=g}else h=2;else h=1;if((_(h+j|0,c[b+296>>2]|0)|0)>960){l=-4;i=m;return l|0}g=Wd(e,f,0,k,b+8+(j<<2)|0,b+200+(j<<1)|0,0,0)|0;if((g|0)<1){l=g;i=m;return l|0}c[l>>2]=(c[l>>2]|0)+h;l=0;i=m;return l|0}function Oc(e,f,g,h,i){e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;var j=0,k=0,l=0,m=0,n=0,o=0,p=0;if((f|0)<1){e=-1;return e|0}if((c[e+4>>2]|0)<(f|0)){e=-1;return e|0}o=e+200|0;a:do switch(f|0){case 1:{j=b[o>>1]|0;if((j|0)<(h|0)){a[g>>0]=d[e>>0]&252;k=g+1|0;j=j+1|0;n=14;break a}else{e=-2;return e|0}}case 2:{j=b[e+202>>1]|0;k=b[o>>1]|0;if(j<<16>>16==k<<16>>16){j=j<<16>>16<<1|1;if((j|0)>(h|0)){e=-2;return e|0}else{a[g>>0]=d[e>>0]&252|1;k=g+1|0;n=14;break a}}j=(k<<16>>16)+(j<<16>>16)+2+(k<<16>>16>251&1)|0;if((j|0)>(h|0)){e=-2;return e|0}m=g+1|0;a[g>>0]=d[e>>0]&252|2;k=b[o>>1]|0;l=k<<16>>16;if(k<<16>>16<252){a[m>>0]=k;k=1}else{k=l|252;a[m>>0]=k;a[g+2>>0]=(l-(k&255)|0)>>>2;k=2}k=m+k|0;n=14;break}default:{j=1;n=15}}while(0);if((n|0)==14)if((i|0)!=0&(j|0)<(h|0)){j=1;n=15}b:do if((n|0)==15){while(1){if((j|0)>=(f|0)){n=23;break}if((b[e+200+(j<<1)>>1]|0)!=(b[o>>1]|0)){n=17;break}j=j+1|0;n=15}do if((n|0)==17){j=f+-1|0;k=0;l=2;while(1){if((k|0)>=(j|0))break;o=b[e+200+(k<<1)>>1]|0;k=k+1|0;l=l+((o<<16>>16>251?2:1)+(o<<16>>16))|0}j=l+(b[e+200+(j<<1)>>1]|0)|0;if((j|0)>(h|0)){e=-2;return e|0}else{a[g>>0]=d[e>>0]|3;l=f|128;a[g+1>>0]=l;m=1;break}}else if((n|0)==23){j=(_(b[o>>1]|0,f)|0)+2|0;if((j|0)>(h|0)){e=-2;return e|0}else{a[g>>0]=d[e>>0]|3;a[g+1>>0]=f;l=f;m=0;break}}while(0);k=g+2|0;if((i|0)!=0?(p=h-j|0,(j|0)!=(h|0)):0){a[g+1>>0]=l|64;j=(p+-1|0)/255|0;l=0;while(1){if((l|0)>=(j|0))break;a[k>>0]=-1;l=l+1|0;k=k+1|0}a[k>>0]=p+(_(j,-255)|0)+255;k=k+1|0;j=h}if(m){n=f+-1|0;o=0;while(1){if((o|0)>=(n|0))break b;l=b[e+200+(o<<1)>>1]|0;m=l<<16>>16;if(l<<16>>16<252){a[k>>0]=l;l=1}else{l=m|252;a[k>>0]=l;a[k+1>>0]=(m-(l&255)|0)>>>2;l=2}o=o+1|0;k=k+l|0}}}while(0);l=0;while(1){if((l|0)>=(f|0))break;p=e+200+(l<<1)|0;sf(k|0,c[e+8+(l<<2)>>2]|0,b[p>>1]|0)|0;l=l+1|0;k=k+(b[p>>1]|0)|0}if(!i){e=j;return e|0}l=g+h|0;while(1){if(k>>>0>=l>>>0)break;a[k>>0]=0;k=k+1|0}return j|0}function Pc(a,d,e,f,h,j,k,l,m,n,o,p){a=a|0;d=d|0;e=e|0;f=f|0;h=h|0;j=j|0;k=k|0;l=l|0;m=m|0;n=n|0;o=o|0;p=p|0;var q=0.0,r=0,s=0.0,t=0.0,u=0.0,v=0.0,w=0.0,x=0.0,y=0.0,z=0,A=0,B=0.0,C=0.0,D=0.0,E=0.0,F=0.0,G=0.0,H=0,I=0.0,J=0.0,K=0,L=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Z=0,_=0,$=0,aa=0,ba=0,ca=0,da=0,ea=0,fa=0,ga=0,ha=0,ia=0,ja=0,ka=0,la=0,ma=0,na=0,oa=0,pa=0,qa=0,ra=0,sa=0,ta=0,ua=0,va=0,wa=0,xa=0,ya=0,za=0,Aa=0,Ba=0,Ca=0,Da=0,Ea=0,Fa=0,Ga=0,Ha=0,Ia=0,Ja=0,Ka=0,La=0.0,Ma=0;Ka=i;i=i+10288|0;Da=Ka+9888|0;Aa=Ka+9816|0;Fa=Ka+9744|0;za=Ka+9712|0;Ba=Ka+9608|0;Ca=Ka+9600|0;Ea=Ka+5760|0;Ha=Ka+1920|0;Ia=Ka+960|0;Ga=Ka;if(!e)m=a+8504|0;else{ua=(m*195|0)/100|0;ua=(ua|0)<(f|0)?ua:f;va=a+6884|0;T=c[va>>2]|0;wa=a+6864|0;xa=a+6868|0;ya=a+6844|0;U=d+72|0;V=a+5764|0;m=a+8504|0;W=a+2884|0;X=a+4804|0;Z=a+3844|0;_=a+6856|0;$=(n|0)<8;aa=a+6848|0;ba=a+6852|0;ca=a+5840|0;da=Ba+80|0;ea=Ba+84|0;fa=Ba+88|0;ga=Ba+92|0;ha=Ba+96|0;ia=Ca+4|0;ja=a+6888|0;ka=a+7688|0;la=a+6892|0;ma=a+7692|0;na=a+7684|0;oa=a+8484|0;pa=a+8500|0;qa=a+8492|0;ra=a+8496|0;sa=a+8488|0;ta=a+6860|0;Q=n+-8|0;S=T;T=ua-T|0;while(1){R=(T|0)>480;r=R?480:T;c[wa>>2]=(c[wa>>2]|0)+1;f=c[xa>>2]|0;J=(f|0)>19?.05000000074505806:1.0/+(f+1|0);L=f+1|0;I=(f|0)>49?.019999999552965164:1.0/+(L|0);z=(f|0)>999;G=1.0/+(L|0);if((f|0)<4){g[ya>>2]=.5;d=c[U>>2]|0;if(!f){c[V>>2]=240;n=240;f=d}else{f=d;Ja=7}}else{f=c[U>>2]|0;Ja=7}if((Ja|0)==7){Ja=0;n=c[V>>2]|0}d=720-n|0;ac[o&1](e,a+2884+(n<<2)|0,(d|0)>(r|0)?r:d,S,j,k,l);n=c[V>>2]|0;d=n+r|0;do if((d|0)<720)c[V>>2]=d;else{K=c[m>>2]|0;L=a+8516+(K<<5)|0;c[m>>2]=K+((K|0)>198?-199:1);d=0;while(1){if((d|0)==240)break;F=+g[828+(d<<2)>>2];g[Ea+(d<<3)>>2]=F*+g[a+2884+(d<<2)>>2];g[Ea+(d<<3)+4>>2]=F*+g[a+2884+(d+240<<2)>>2];H=480-d+-1|0;g[Ea+(H<<3)>>2]=F*+g[a+2884+(H<<2)>>2];g[Ea+(H<<3)+4>>2]=F*+g[a+2884+(720-d+-1<<2)>>2];d=d+1|0}rf(W|0,X|0,960)|0;d=n+-720+r|0;ac[o&1](e,Z,d,S+720-n|0,j,k,l);c[V>>2]=d+240;q=+g[f+4>>2];d=f+44|0;n=0;while(1){if((n|0)>=(c[f>>2]|0))break;F=+g[Ea+(n<<3)+4>>2];g[Ha+(b[(c[d>>2]|0)+(n<<1)>>1]<<3)>>2]=q*+g[Ea+(n<<3)>>2];g[Ha+(b[(c[d>>2]|0)+(n<<1)>>1]<<3)+4>>2]=q*F;n=n+1|0}dd(f,Ha);F=+g[Ha>>2];if(F!=F|0.0!=0.0){c[L>>2]=0;break}else n=1;while(1){if((n|0)==240)break;x=+g[Ha+(n<<3)>>2];H=480-n|0;t=+g[Ha+(H<<3)>>2];q=x+t;u=+g[Ha+(n<<3)+4>>2];w=+g[Ha+(H<<3)+4>>2];s=u-w;w=u+w;x=t-x;t=q*q;u=s*s;do if(!(t+u<1.000000045813705e-18))if(t>2];d=a+964+(n<<2)|0;v=u-+g[d>>2];q=w*w;s=x*x;do if(!(q+s<1.000000045813705e-18))if(q>2]=+N(+B)+ +N(+F);F=F*F;F=F*F;H=a+1924+(n<<2)|0;g[Ia+(n<<2)>>2]=1.0/((+g[H>>2]+C*C*2.0+F)*.25*62341.81640625+1.0)+-.014999999664723873;g[f>>2]=D;g[d>>2]=E;g[H>>2]=F;n=n+1|0}H=a+8516+(K<<5)+16|0;g[H>>2]=0.0;a:do if(!(c[xa>>2]|0)){f=0;while(1){if((f|0)==18){r=0;B=0.0;x=0.0;C=0.0;q=0.0;D=0.0;E=0.0;F=0.0;break a}g[a+6420+(f<<2)>>2]=1.0e10;g[a+6492+(f<<2)>>2]=-1.0e10;f=f+1|0}}else{r=0;B=0.0;x=0.0;C=0.0;q=0.0;D=0.0;E=0.0;F=0.0}while(0);while(1){if((r|0)>=18)break;n=r+1|0;f=c[1788+(n<<2)>>2]|0;t=0.0;d=c[1788+(r<<2)>>2]|0;s=0.0;y=0.0;while(1){if((d|0)>=(f|0))break;La=+g[Ha+(d<<3)>>2];A=480-d|0;w=+g[Ha+(A<<3)>>2];v=+g[Ha+(d<<3)+4>>2];u=+g[Ha+(A<<3)+4>>2];u=La*La+w*w+v*v+u*u;v=s+u*2.0*(.5-+g[Ga+(d<<2)>>2]);w=y+u*+g[Ia+(d<<2)>>2];t=t+u;d=d+1|0;s=v;y=w}if(!(t<1.0e9)|(t!=t|0.0!=0.0)){Ja=37;break}g[a+5844+((c[_>>2]|0)*72|0)+(r<<2)>>2]=t;v=t+1.0000000036274937e-15;x=x+s/v;u=t+1.000000013351432e-10;w=B+ +O(+u);u=+Y(+u);g[Fa+(r<<2)>>2]=u;f=a+6420+(r<<2)|0;t=+g[f>>2]+.009999999776482582;t=u>2]=t;d=a+6492+(r<<2)|0;s=+g[d>>2]+-.10000000149011612;s=u>s?u:s;g[d>>2]=s;if(s>2]=s;t=t+-.5;g[f>>2]=t}u=(u-t)/(s+1.0000000036274937e-15-t);s=0.0;t=0.0;f=0;while(1){if((f|0)==8)break;La=+g[a+5844+(f*72|0)+(r<<2)>>2];s=s+ +O(+La);t=t+La;f=f+1|0}t=s/+O(+(t*8.0+1.0e-15));t=t>.9900000095367432?.9900000095367432:t;t=t*t;t=t*t;La=y/v;f=a+5768+(r<<2)|0;s=t*+g[f>>2];s=La>s?La:s;g[Aa+(r<<2)>>2]=s;q=q+s;if((r|0)>8)q=q-+g[Aa+(r+-9<<2)>>2];y=(+(r+-18|0)*.029999999329447746+1.0)*q;g[f>>2]=s;La=F+s*+(r+-8|0);r=n;B=w;C=C+t;D=D>y?D:y;E=E+u;F=La}if((Ja|0)==37){Ja=0;c[L>>2]=0;break}w=$?5.699999746866524e-04:5.699999746866524e-04/+(1<>2]|0;n=z+1|0;r=c[1864+(n<<2)>>2]|0;u=0.0;f=d;while(1){if((f|0)>=(r|0))break;t=+g[Ha+(f<<3)>>2];G=+g[Ha+(f<<3)+4>>2];Ma=480-f|0;y=+g[Ha+(Ma<<3)>>2];La=+g[Ha+(Ma<<3)+4>>2];u=u+(t*t+y*y+G*G+La*La);f=f+1|0}t=s>u?s:u;Ma=a+6564+(z<<2)|0;s=v*+g[Ma>>2];s=s>u?s:u;g[Ma>>2]=s;s=u>s?u:s;q=q*.05000000074505806;q=q>s?q:s;if(!(s>q*.1&s*1.0e9>t)){Ma=A;z=n;s=t;A=Ma;continue}if(!(s>w*+(r-d|0))){Ma=A;z=n;s=t;A=Ma;continue}A=z;z=n;s=t}r=c[xa>>2]|0;z=(r|0)<3?20:A;B=+Ge(B)*20.0;G=+g[aa>>2]+-.029999999329447746;G=G>B?G:B;g[aa>>2]=G;La=+g[ba>>2]*(1.0-I);g[ba>>2]=B>2]*+g[Fa+(d<<2)>>2];d=d+1|0;q=La}g[za+(n<<2)>>2]=q;n=n+1|0}s=C/18.0;B=x/18.0;g[H>>2]=B+(1.0-B)*((r|0)<10?.5:E/18.0);I=D/9.0;La=+g[ca>>2]*.800000011920929;La=I>La?I:La;g[ca>>2]=La;n=a+8516+(K<<5)+8|0;g[n>>2]=F*.015625;c[_>>2]=((c[_>>2]|0)+1|0)%8|0;c[xa>>2]=(c[xa>>2]|0)+1;d=a+8516+(K<<5)+4|0;g[d>>2]=La;f=0;while(1){if((f|0)==4)break;g[Ba+(f<<2)>>2]=(+g[za+(f<<2)>>2]+ +g[a+6648+(f+24<<2)>>2])*-.12298999726772308+(+g[a+6648+(f<<2)>>2]+ +g[a+6648+(f+16<<2)>>2])*.49195000529289246+ +g[a+6648+(f+8<<2)>>2]*.6969299912452698-+g[a+6776+(f<<2)>>2]*1.4349000453948975;f=f+1|0}q=1.0-J;f=0;while(1){if((f|0)==4){f=0;break}Ma=a+6776+(f<<2)|0;g[Ma>>2]=q*+g[Ma>>2]+J*+g[za+(f<<2)>>2];f=f+1|0}while(1){if((f|0)==4){f=0;break}g[Ba+(f+4<<2)>>2]=(+g[za+(f<<2)>>2]-+g[a+6648+(f+24<<2)>>2])*.6324599981307983+(+g[a+6648+(f<<2)>>2]-+g[a+6648+(f+16<<2)>>2])*.31622999906539917;f=f+1|0}while(1){if((f|0)==3)break;Ma=f+8|0;g[Ba+(Ma<<2)>>2]=(+g[za+(f<<2)>>2]+ +g[a+6648+(f+24<<2)>>2])*.5345199704170227-(+g[a+6648+(f<<2)>>2]+ +g[a+6648+(f+16<<2)>>2])*.26725998520851135-+g[a+6648+(Ma<<2)>>2]*.5345199704170227;f=f+1|0}b:do if((c[xa>>2]|0)>5){f=0;while(1){if((f|0)==9){f=0;break b}Ma=a+6808+(f<<2)|0;La=+g[Ba+(f<<2)>>2];g[Ma>>2]=q*+g[Ma>>2]+J*La*La;f=f+1|0}}else f=0;while(0);while(1){if((f|0)==8){f=0;break}Ma=a+6648+(f+16<<2)|0;c[a+6648+(f+24<<2)>>2]=c[Ma>>2];A=a+6648+(f+8<<2)|0;c[Ma>>2]=c[A>>2];Ma=a+6648+(f<<2)|0;c[A>>2]=c[Ma>>2];c[Ma>>2]=c[za+(f<<2)>>2];f=f+1|0}while(1){if((f|0)==9)break;La=+O(+(+g[a+6808+(f<<2)>>2]));g[Ba+(f+11<<2)>>2]=La-+g[2464+(f<<2)>>2];f=f+1|0}g[da>>2]=+g[d>>2]+-.154723;g[ea>>2]=+g[H>>2]+-.724643;g[fa>>2]=s+-.743717;g[ga>>2]=+g[n>>2]+.069216;g[ha>>2]=+g[ba>>2]+-.06793;f=3304;r=0;while(1){if((r|0)==16){f=4968;r=0;break}d=f;n=0;q=+g[f>>2];while(1){d=d+4|0;if((n|0)==25)break;La=q+ +g[Ba+(n<<2)>>2]*+g[d>>2];n=n+1|0;q=La}f=f+104|0;if(q<8.0)if(q>-8.0)if(q!=q|0.0!=0.0)q=0.0;else{Ma=q<0.0;q=Ma?-q:q;H=~~+M(+(q*25.0+.5));q=q-+(H|0)*.03999999910593033;La=+g[2500+(H<<2)>>2];q=(Ma?-1.0:1.0)*(La+q*(1.0-La*La)*(1.0-La*q))}else q=-1.0;else q=1.0;g[Da+(r<<2)>>2]=q;r=r+1|0}while(1){if((r|0)==2)break;d=f;n=0;q=+g[f>>2];while(1){d=d+4|0;if((n|0)==16)break;La=q+ +g[Da+(n<<2)>>2]*+g[d>>2];n=n+1|0;q=La}f=f+68|0;if(q<8.0)if(q>-8.0)if(q!=q|0.0!=0.0)q=0.0;else{Ma=q<0.0;q=Ma?-q:q;H=~~+M(+(q*25.0+.5));q=q-+(H|0)*.03999999910593033;La=+g[2500+(H<<2)>>2];q=(Ma?-1.0:1.0)*(La+q*(1.0-La*La)*(1.0-La*q))}else q=-1.0;else q=1.0;g[Ca+(r<<2)>>2]=q;r=r+1|0}y=(+g[Ca>>2]+1.0)*.5;x=+g[ia>>2]*.5+.5;x=x*x;g[ia>>2]=x;y=x*y+(1.0-x)*.5;g[Ca>>2]=y;g[a+8516+(K<<5)+28>>2]=x;u=x*4.999999873689376e-05;Ma=y>.949999988079071;H=y<.05000000074505806&(Ma^1);w=H|Ma?(H?.05000000074505806:.949999988079071):y;J=+g[ya>>2];H=J>.949999988079071;Ma=J<.05000000074505806&(H^1);v=Ma|H?(Ma?.05000000074505806:.949999988079071):J;I=1.0-J;s=1.0-u;w=+N(+(w-v))*.05000000074505806/(w*(1.0-v)+v*(1.0-w))+.009999999776482582;v=+P(+(1.0-y),+w);w=+P(+y,+w);La=(J*s+I*u)*w;La=La/((I*s+J*u)*v+La);g[ya>>2]=La;g[a+8516+(K<<5)+20>>2]=La;if((c[xa>>2]|0)==1){g[ja>>2]=.5;g[ka>>2]=.5;q=.5}else q=+g[ja>>2];q=q+ +g[la>>2];t=+g[ka>>2]+ +g[ma>>2];g[ja>>2]=q*s*v;g[ka>>2]=t*s*w;f=1;while(1){if((f|0)==199)break;Ma=f+1|0;g[a+6888+(f<<2)>>2]=+g[a+6888+(Ma<<2)>>2]*v;g[a+7688+(f<<2)>>2]=+g[a+7688+(Ma<<2)>>2]*w;f=Ma}g[na>>2]=t*u*v;g[oa>>2]=q*u*w;f=0;q=9.999999682655225e-21;while(1){if((f|0)==200)break;La=q+(+g[a+6888+(f<<2)>>2]+ +g[a+7688+(f<<2)>>2]);f=f+1|0;q=La}q=1.0/q;f=0;while(1){if((f|0)==200)break;Ma=a+6888+(f<<2)|0;g[Ma>>2]=+g[Ma>>2]*q;Ma=a+7688+(f<<2)|0;g[Ma>>2]=+g[Ma>>2]*q;f=f+1|0}if(x>.75){q=+g[ya>>2];if(q>.9){Ma=(c[pa>>2]|0)+1|0;c[pa>>2]=(Ma|0)<500?Ma:500;J=+g[qa>>2];La=y-J;g[qa>>2]=J+1.0/+(Ma|0)*(La<-.20000000298023224?-.20000000298023224:La)}if(q<.1){Ma=(c[ra>>2]|0)+1|0;c[ra>>2]=(Ma|0)<500?Ma:500;J=+g[sa>>2];La=y-J;g[sa>>2]=J+1.0/+(Ma|0)*(La>.20000000298023224?.20000000298023224:La)}}else{if(!(c[pa>>2]|0))g[qa>>2]=.8999999761581421;if(!(c[ra>>2]|0))g[sa>>2]=.10000000149011612}f=+g[ya>>2]>.5&1;if((c[ta>>2]|0)!=(f|0))c[wa>>2]=0;c[ta>>2]=f;c[a+8516+(K<<5)+24>>2]=z;g[a+8516+(K<<5)+12>>2]=B;c[L>>2]=1}while(0);if(R){S=S+480|0;T=T+-480|0}else break}c[va>>2]=ua-h}c[p>>2]=0;r=a+8508|0;f=c[r>>2]|0;d=c[m>>2]|0;n=d-f|0;n=(n|0)<0?n+200|0:n;if((h|0)<481|(d|0)==(f|0))m=f;else{m=f+1|0;m=(m|0)==200?0:m}f=(m|0)==(d|0)?d+-1|0:m;f=a+8516+(((f|0)<0?199:f)<<5)|0;c[p>>2]=c[f>>2];c[p+4>>2]=c[f+4>>2];c[p+8>>2]=c[f+8>>2];c[p+12>>2]=c[f+12>>2];c[p+16>>2]=c[f+16>>2];c[p+20>>2]=c[f+20>>2];c[p+24>>2]=c[f+24>>2];c[p+28>>2]=c[f+28>>2];f=a+8512|0;m=(c[f>>2]|0)+((h|0)/120|0)|0;c[f>>2]=m;while(1){if((m|0)<=3)break;Ma=m+-4|0;c[f>>2]=Ma;c[r>>2]=(c[r>>2]|0)+1;m=Ma}m=c[r>>2]|0;if((m|0)>199)c[r>>2]=m+-200;m=(n|0)>10?210-n|0:200;f=0;q=0.0;while(1){if((f|0)>=(m|0))break;La=q+ +g[a+7688+(f<<2)>>2];f=f+1|0;q=La}while(1){if((f|0)>=200)break;La=q+ +g[a+6888+(f<<2)>>2];f=f+1|0;q=La}g[p+20>>2]=q*+g[a+8492>>2]+(1.0-q)*+g[a+8488>>2];i=Ka;return}function Qc(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,h=0,j=0,k=0,l=0;k=i;i=i+16|0;e=k;c[e>>2]=d;do switch(b|0){case 4010:{j=(c[e>>2]|0)+(4-1)&~(4-1);b=c[j>>2]|0;c[e>>2]=j+4;if(b>>>0>10)b=40;else{c[a+24>>2]=b;b=39}break}case 10010:{j=(c[e>>2]|0)+(4-1)&~(4-1);b=c[j>>2]|0;c[e>>2]=j+4;if((b|0)>=0?(b|0)<(c[(c[a>>2]|0)+8>>2]|0):0){c[a+32>>2]=b;b=39}else b=40;break}case 10012:{j=(c[e>>2]|0)+(4-1)&~(4-1);b=c[j>>2]|0;c[e>>2]=j+4;if((b|0)>=1?(b|0)<=(c[(c[a>>2]|0)+8>>2]|0):0){c[a+36>>2]=b;b=39}else b=40;break}case 10002:{j=(c[e>>2]|0)+(4-1)&~(4-1);b=c[j>>2]|0;c[e>>2]=j+4;if(b>>>0>2)b=40;else{c[a+20>>2]=(b|0)<2&1;c[a+12>>2]=(b|0)==0&1;b=39}break}case 4014:{j=(c[e>>2]|0)+(4-1)&~(4-1);b=c[j>>2]|0;c[e>>2]=j+4;if(b>>>0>100)b=40;else{c[a+56>>2]=b;b=39}break}case 4020:{j=(c[e>>2]|0)+(4-1)&~(4-1);b=c[j>>2]|0;c[e>>2]=j+4;c[a+52>>2]=b;b=39;break}case 4006:{j=(c[e>>2]|0)+(4-1)&~(4-1);b=c[j>>2]|0;c[e>>2]=j+4;c[a+44>>2]=b;b=39;break}case 4002:{j=(c[e>>2]|0)+(4-1)&~(4-1);b=c[j>>2]|0;c[e>>2]=j+4;if((b|0)>500|(b|0)==-1){j=(c[a+4>>2]|0)*26e4|0;c[a+40>>2]=(b|0)<(j|0)?b:j;b=39}else b=40;break}case 10008:{j=(c[e>>2]|0)+(4-1)&~(4-1);b=c[j>>2]|0;c[e>>2]=j+4;if((b+-1|0)>>>0>1)b=40;else{c[a+8>>2]=b;b=39}break}case 4036:{j=(c[e>>2]|0)+(4-1)&~(4-1);b=c[j>>2]|0;c[e>>2]=j+4;if((b+-8|0)>>>0>16)b=40;else{c[a+60>>2]=b;b=39}break}case 4037:{j=(c[e>>2]|0)+(4-1)&~(4-1);b=c[j>>2]|0;c[e>>2]=j+4;c[b>>2]=c[a+60>>2];b=39;break}case 4040:{j=(c[e>>2]|0)+(4-1)&~(4-1);b=c[j>>2]|0;c[e>>2]=j+4;c[a+64>>2]=b;b=39;break}case 4028:{b=a+4|0;h=c[b>>2]|0;f=c[a>>2]|0;l=c[f+4>>2]|0;d=a+212+((_(h,l+1024|0)|0)<<2)|0;j=c[f+8>>2]|0;e=_(h,j)|0;d=d+(e<<2)|0;e=d+(e<<2)|0;nf(a+76|0,0,((_(l,h)|0)<<2)+212+(h<<12)+((_(h<<2,j)|0)<<2)+-76|0)|0;j=0;while(1){if((j|0)>=(_(h,c[f+8>>2]|0)|0))break;g[e+(j<<2)>>2]=-28.0;g[d+(j<<2)>>2]=-28.0;f=c[a>>2]|0;h=c[b>>2]|0;j=j+1|0}c[a+184>>2]=0;g[a+84>>2]=1.0;c[a+80>>2]=2;c[a+88>>2]=256;c[a+96>>2]=0;c[a+100>>2]=0;b=39;break}case 10016:{l=(c[e>>2]|0)+(4-1)&~(4-1);b=c[l>>2]|0;c[e>>2]=l+4;c[a+48>>2]=b;b=39;break}case 10022:{l=(c[e>>2]|0)+(4-1)&~(4-1);b=c[l>>2]|0;c[e>>2]=l+4;if(!b)b=39;else{l=a+120|0;c[l>>2]=c[b>>2];c[l+4>>2]=c[b+4>>2];c[l+8>>2]=c[b+8>>2];c[l+12>>2]=c[b+12>>2];c[l+16>>2]=c[b+16>>2];c[l+20>>2]=c[b+20>>2];c[l+24>>2]=c[b+24>>2];c[l+28>>2]=c[b+28>>2];b=39}break}case 10028:{l=(c[e>>2]|0)+(4-1)&~(4-1);b=c[l>>2]|0;c[e>>2]=l+4;if(!b)b=39;else{j=b;l=c[j+4>>2]|0;b=a+152|0;c[b>>2]=c[j>>2];c[b+4>>2]=l;b=39}break}case 10015:{l=(c[e>>2]|0)+(4-1)&~(4-1);b=c[l>>2]|0;c[e>>2]=l+4;if(!b)b=40;else{c[b>>2]=c[a>>2];b=39}break}case 4031:{l=(c[e>>2]|0)+(4-1)&~(4-1);b=c[l>>2]|0;c[e>>2]=l+4;if(!b)b=40;else{c[b>>2]=c[a+76>>2];b=39}break}case 10024:{l=(c[e>>2]|0)+(4-1)&~(4-1);b=c[l>>2]|0;c[e>>2]=l+4;c[a+68>>2]=b;b=39;break}case 10026:{l=(c[e>>2]|0)+(4-1)&~(4-1);b=c[l>>2]|0;c[e>>2]=l+4;c[a+204>>2]=b;b=39;break}default:{l=-5;i=k;return l|0}}while(0);if((b|0)==39){l=0;i=k;return l|0}else if((b|0)==40){l=-1;i=k;return l|0}return 0} +"use strict"; +'use strict'; - // EMSCRIPTEN_END_FUNCS - var Xb=[Of,Ne,$e,bf,tc,Of,Of,Of];var Yb=[Pf,Ve,Re,ff];var Zb=[Qf,Je,Te,Le,Me,Ke,Xe,Ye,_e,af,cf,sc,Qf,Qf,Qf,Qf];var _b=[Rf,vc];var $b=[Sf,Ze,rc,Sf];var ac=[Tf,Gc];var bc=[Uf];var cc=[Vf,uc,qc,Vf];var dc=[Wf,Ue,Pe,df];var ec=[Xf,pc,wc,Xf];var fc=[Yf,We,Se,hf];return{___cxa_can_catch:kf,_free:Ie,_opus_strerror:zc,_opus_decoder_create:Ac,___cxa_is_pointer_type:lf,_i64Add:of,_memmove:sf,_bitshift64Ashr:pf,_opus_encoder_destroy:Mc,_memset:nf,_malloc:He,_opus_decoder_destroy:Ec,_opus_encoder_create:Fc,_memcpy:rf,___getTypeName:Fe,_bitshift64Lshr:qf,_opus_decoder_ctl:Dc,_opus_encoder_ctl:Lc,__GLOBAL__sub_I_opusscript_encoder_cpp:xc,__GLOBAL__sub_I_bind_cpp:Ee,runPostSets:mf,stackAlloc:gc,stackSave:hc,stackRestore:ic,establishStackSpace:jc,setThrew:kc,setTempRet0:nc,getTempRet0:oc,dynCall_iiii:Df,dynCall_viiiii:Ef,dynCall_vi:Ff,dynCall_iiiiiii:Gf,dynCall_ii:Hf,dynCall_viiiiiii:If,dynCall_v:Jf,dynCall_iiiii:Kf,dynCall_viiiiii:Lf,dynCall_iiiiii:Mf,dynCall_viiii:Nf}}) +var assert = __webpack_require__(26); +var inherits = __webpack_require__(1); +var proto = {}; - // EMSCRIPTEN_END_ASM - (Module.asmGlobalArg,Module.asmLibraryArg,buffer);var runPostSets=Module["runPostSets"]=asm["runPostSets"];var ___cxa_can_catch=Module["___cxa_can_catch"]=asm["___cxa_can_catch"];var __GLOBAL__sub_I_bind_cpp=Module["__GLOBAL__sub_I_bind_cpp"]=asm["__GLOBAL__sub_I_bind_cpp"];var _free=Module["_free"]=asm["_free"];var _opus_strerror=Module["_opus_strerror"]=asm["_opus_strerror"];var _opus_decoder_create=Module["_opus_decoder_create"]=asm["_opus_decoder_create"];var ___cxa_is_pointer_type=Module["___cxa_is_pointer_type"]=asm["___cxa_is_pointer_type"];var _i64Add=Module["_i64Add"]=asm["_i64Add"];var _memmove=Module["_memmove"]=asm["_memmove"];var _bitshift64Ashr=Module["_bitshift64Ashr"]=asm["_bitshift64Ashr"];var _opus_encoder_destroy=Module["_opus_encoder_destroy"]=asm["_opus_encoder_destroy"];var _memset=Module["_memset"]=asm["_memset"];var _malloc=Module["_malloc"]=asm["_malloc"];var _opus_decoder_destroy=Module["_opus_decoder_destroy"]=asm["_opus_decoder_destroy"];var _opus_encoder_create=Module["_opus_encoder_create"]=asm["_opus_encoder_create"];var _memcpy=Module["_memcpy"]=asm["_memcpy"];var ___getTypeName=Module["___getTypeName"]=asm["___getTypeName"];var _bitshift64Lshr=Module["_bitshift64Lshr"]=asm["_bitshift64Lshr"];var _opus_encoder_ctl=Module["_opus_encoder_ctl"]=asm["_opus_encoder_ctl"];var _opus_decoder_ctl=Module["_opus_decoder_ctl"]=asm["_opus_decoder_ctl"];var __GLOBAL__sub_I_opusscript_encoder_cpp=Module["__GLOBAL__sub_I_opusscript_encoder_cpp"]=asm["__GLOBAL__sub_I_opusscript_encoder_cpp"];var dynCall_iiii=Module["dynCall_iiii"]=asm["dynCall_iiii"];var dynCall_viiiii=Module["dynCall_viiiii"]=asm["dynCall_viiiii"];var dynCall_vi=Module["dynCall_vi"]=asm["dynCall_vi"];var dynCall_iiiiiii=Module["dynCall_iiiiiii"]=asm["dynCall_iiiiiii"];var dynCall_ii=Module["dynCall_ii"]=asm["dynCall_ii"];var dynCall_viiiiiii=Module["dynCall_viiiiiii"]=asm["dynCall_viiiiiii"];var dynCall_v=Module["dynCall_v"]=asm["dynCall_v"];var dynCall_iiiii=Module["dynCall_iiiii"]=asm["dynCall_iiiii"];var dynCall_viiiiii=Module["dynCall_viiiiii"]=asm["dynCall_viiiiii"];var dynCall_iiiiii=Module["dynCall_iiiiii"]=asm["dynCall_iiiiii"];var dynCall_viiii=Module["dynCall_viiii"]=asm["dynCall_viiii"];Runtime.stackAlloc=asm["stackAlloc"];Runtime.stackSave=asm["stackSave"];Runtime.stackRestore=asm["stackRestore"];Runtime.establishStackSpace=asm["establishStackSpace"];Runtime.setTempRet0=asm["setTempRet0"];Runtime.getTempRet0=asm["getTempRet0"];function ExitStatus(status){this.name="ExitStatus";this.message="Program terminated with exit("+status+")";this.status=status}ExitStatus.prototype=new Error;ExitStatus.prototype.constructor=ExitStatus;var initialStackTop;var preloadStartTime=null;var calledMain=false;dependenciesFulfilled=function runCaller(){if(!Module["calledRun"])run();if(!Module["calledRun"])dependenciesFulfilled=runCaller};Module["callMain"]=Module.callMain=function callMain(args){args=args||[];ensureInitRuntime();var argc=args.length+1;function pad(){for(var i=0;i<4-1;i++){argv.push(0)}}var argv=[allocate(intArrayFromString(Module["thisProgram"]),"i8",ALLOC_NORMAL)];pad();for(var i=0;i0){return}preRun();if(runDependencies>0)return;if(Module["calledRun"])return;function doRun(){if(Module["calledRun"])return;Module["calledRun"]=true;if(ABORT)return;ensureInitRuntime();preMain();if(Module["onRuntimeInitialized"])Module["onRuntimeInitialized"]();if(Module["_main"]&&shouldRunNow)Module["callMain"](args);postRun()}if(Module["setStatus"]){Module["setStatus"]("Running...");setTimeout((function(){setTimeout((function(){Module["setStatus"]("")}),1);doRun()}),1)}else{doRun()}}Module["run"]=Module.run=run;function exit(status,implicit){if(implicit&&Module["noExitRuntime"]){return}if(Module["noExitRuntime"]){}else{ABORT=true;EXITSTATUS=status;STACKTOP=initialStackTop;exitRuntime();if(Module["onExit"])Module["onExit"](status)}if(ENVIRONMENT_IS_NODE){process["exit"](status)}else if(ENVIRONMENT_IS_SHELL&&typeof quit==="function"){quit(status)}throw new ExitStatus(status)}Module["exit"]=Module.exit=exit;var abortDecorators=[];function abort(what){if(what!==undefined){Module.print(what);Module.printErr(what);what=JSON.stringify(what)}else{what=""}ABORT=true;EXITSTATUS=1;var extra="\nIf this abort() is unexpected, build with -s ASSERTIONS=1 which can give more information.";var output="abort("+what+") at "+stackTrace()+extra;if(abortDecorators){abortDecorators.forEach((function(decorator){output=decorator(output,what)}))}throw output}Module["abort"]=Module.abort=abort;if(Module["preInit"]){if(typeof Module["preInit"]=="function")Module["preInit"]=[Module["preInit"]];while(Module["preInit"].length>0){Module["preInit"].pop()()}}var shouldRunNow=true;if(Module["noInitialRun"]){shouldRunNow=false}run() +function CBCState(iv) { + assert.equal(iv.length, 8, 'Invalid IV length'); + this.iv = new Array(8); + for (var i = 0; i < this.iv.length; i++) + this.iv[i] = iv[i]; +} +function instantiate(Base) { + function CBC(options) { + Base.call(this, options); + this._cbcInit(); + } + inherits(CBC, Base); + var keys = Object.keys(proto); + for (var i = 0; i < keys.length; i++) { + var key = keys[i]; + CBC.prototype[key] = proto[key]; + } + CBC.create = function create(options) { + return new CBC(options); + }; + + return CBC; +} + +exports.instantiate = instantiate; + +proto._cbcInit = function _cbcInit() { + var state = new CBCState(this.options.iv); + this._cbcState = state; +}; + +proto._update = function _update(inp, inOff, out, outOff) { + var state = this._cbcState; + var superProto = this.constructor.super_.prototype; + + var iv = state.iv; + if (this.type === 'encrypt') { + for (var i = 0; i < this.blockSize; i++) + iv[i] ^= inp[inOff + i]; + + superProto._update.call(this, iv, 0, out, outOff); + + for (var i = 0; i < this.blockSize; i++) + iv[i] = out[outOff + i]; + } else { + superProto._update.call(this, inp, inOff, out, outOff); + + for (var i = 0; i < this.blockSize; i++) + out[outOff + i] ^= iv[i]; + + for (var i = 0; i < this.blockSize; i++) + iv[i] = inp[inOff + i]; + } +}; - /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2), "node_modules/opusscript/build", __webpack_require__(71)(module))) /***/ }, /* 171 */ /***/ function(module, exports, __webpack_require__) { - /* WEBPACK VAR INJECTION */(function(Buffer) {const EventEmitter = __webpack_require__(3).EventEmitter; - const NaCl = __webpack_require__(172); +"use strict"; +'use strict'; - const nonce = new Buffer(24); - nonce.fill(0); +var assert = __webpack_require__(26); - /** - * The class that sends voice packet data to the voice connection. - * ```js - * // obtained using: - * voiceChannel.join().then(connection => { - * // you can play a file or a stream here: - * connection.playFile('./file.mp3').then(dispatcher => { - * - * }); - * }); - * ``` - * @extends {EventEmitter} - */ - class StreamDispatcher extends EventEmitter { - constructor(player, stream, sd, streamOptions) { - super(); - this.player = player; - this.stream = stream; - this.streamingData = { - channels: 2, - count: 0, - sequence: sd.sequence, - timestamp: sd.timestamp, - pausedTime: 0, - }; - this._startStreaming(); - this._triggered = false; - this._volume = streamOptions.volume; +function Cipher(options) { + this.options = options; - /** - * How many passes the dispatcher should take when sending packets to reduce packet loss. Values over 5 - * aren't recommended, as it means you are using 5x more bandwidth. You _can_ edit this at runtime. - * @type {number} - */ - this.passes = streamOptions.passes || 1; + this.type = this.options.type; + this.blockSize = 8; + this._init(); - /** - * Whether playing is paused - * @type {boolean} - */ - this.paused = false; + this.buffer = new Array(this.blockSize); + this.bufferOff = 0; +} +module.exports = Cipher; - this.setVolume(streamOptions.volume || 1); - } +Cipher.prototype._init = function _init() { + // Might be overrided +}; - /** - * How long the stream dispatcher has been "speaking" for - * @type {number} - * @readonly - */ - get time() { - return this.streamingData.count * (this.streamingData.length || 0); - } +Cipher.prototype.update = function update(data) { + if (data.length === 0) + return []; - /** - * The total time, taking into account pauses and skips, that the dispatcher has been streaming for - * @type {number} - * @readonly - */ - get totalStreamTime() { - return this.time + this.streamingData.pausedTime; - } + if (this.type === 'decrypt') + return this._updateDecrypt(data); + else + return this._updateEncrypt(data); +}; - /** - * The volume of the stream, relative to the stream's input volume - * @type {number} - * @readonly - */ - get volume() { - return this._volume; - } +Cipher.prototype._buffer = function _buffer(data, off) { + // Append data to buffer + var min = Math.min(this.buffer.length - this.bufferOff, data.length - off); + for (var i = 0; i < min; i++) + this.buffer[this.bufferOff + i] = data[off + i]; + this.bufferOff += min; - /** - * Sets the volume relative to the input stream - i.e. 1 is normal, 0.5 is half, 2 is double. - * @param {number} volume The volume that you want to set - */ - setVolume(volume) { - this._volume = volume; - } + // Shift next + return min; +}; - /** - * Set the volume in decibels - * @param {number} db The decibels - */ - setVolumeDecibels(db) { - this._volume = Math.pow(10, db / 20); - } +Cipher.prototype._flushBuffer = function _flushBuffer(out, off) { + this._update(this.buffer, 0, out, off); + this.bufferOff = 0; + return this.blockSize; +}; - /** - * Set the volume so that a perceived value of 0.5 is half the perceived volume etc. - * @param {number} value The value for the volume - */ - setVolumeLogarithmic(value) { - this._volume = Math.pow(value, 1.660964); - } +Cipher.prototype._updateEncrypt = function _updateEncrypt(data) { + var inputOff = 0; + var outputOff = 0; - /** - * Stops sending voice packets to the voice connection (stream may still progress however) - */ - pause() { - this._setPaused(true); - } + var count = ((this.bufferOff + data.length) / this.blockSize) | 0; + var out = new Array(count * this.blockSize); - /** - * Resumes sending voice packets to the voice connection (may be further on in the stream than when paused) - */ - resume() { - this._setPaused(false); - } + if (this.bufferOff !== 0) { + inputOff += this._buffer(data, inputOff); - /** - * Stops the current stream permanently and emits an `end` event. - */ - end() { - this._triggerTerminalState('end', 'user requested'); - } + if (this.bufferOff === this.buffer.length) + outputOff += this._flushBuffer(out, outputOff); + } - _setSpeaking(value) { - this.speaking = value; - /** - * Emitted when the dispatcher starts/stops speaking - * @event StreamDispatcher#speaking - * @param {boolean} value Whether or not the dispatcher is speaking - */ - this.emit('speaking', value); - } + // Write blocks + var max = data.length - ((data.length - inputOff) % this.blockSize); + for (; inputOff < max; inputOff += this.blockSize) { + this._update(data, inputOff, out, outputOff); + outputOff += this.blockSize; + } - _sendBuffer(buffer, sequence, timestamp) { - let repeats = this.passes; - const packet = this._createPacket(sequence, timestamp, this.player.opusEncoder.encode(buffer)); - while (repeats--) { - this.player.voiceConnection.sockets.udp.send(packet) - .catch(e => this.emit('debug', `Failed to send a packet ${e}`)); - } - } + // Queue rest + for (; inputOff < data.length; inputOff++, this.bufferOff++) + this.buffer[this.bufferOff] = data[inputOff]; - _createPacket(sequence, timestamp, buffer) { - const packetBuffer = new Buffer(buffer.length + 28); - packetBuffer.fill(0); - packetBuffer[0] = 0x80; - packetBuffer[1] = 0x78; + return out; +}; - packetBuffer.writeUIntBE(sequence, 2, 2); - packetBuffer.writeUIntBE(timestamp, 4, 4); - packetBuffer.writeUIntBE(this.player.voiceConnection.authentication.ssrc, 8, 4); +Cipher.prototype._updateDecrypt = function _updateDecrypt(data) { + var inputOff = 0; + var outputOff = 0; - packetBuffer.copy(nonce, 0, 0, 12); - buffer = NaCl.secretbox(buffer, nonce, this.player.voiceConnection.authentication.secretKey.key); + var count = Math.ceil((this.bufferOff + data.length) / this.blockSize) - 1; + var out = new Array(count * this.blockSize); - for (let i = 0; i < buffer.length; i++) packetBuffer[i + 12] = buffer[i]; + // TODO(indutny): optimize it, this is far from optimal + for (; count > 0; count--) { + inputOff += this._buffer(data, inputOff); + outputOff += this._flushBuffer(out, outputOff); + } - return packetBuffer; - } + // Buffer rest of the input + inputOff += this._buffer(data, inputOff); - _applyVolume(buffer) { - if (this._volume === 1) return buffer; + return out; +}; - const out = new Buffer(buffer.length); - for (let i = 0; i < buffer.length; i += 2) { - if (i >= buffer.length - 1) break; - const uint = Math.min(32767, Math.max(-32767, Math.floor(this._volume * buffer.readInt16LE(i)))); - out.writeInt16LE(uint, i); - } +Cipher.prototype.final = function final(buffer) { + var first; + if (buffer) + first = this.update(buffer); - return out; - } + var last; + if (this.type === 'encrypt') + last = this._finalEncrypt(); + else + last = this._finalDecrypt(); - _send() { - try { - if (this._triggered) { - this._setSpeaking(false); - return; - } + if (first) + return first.concat(last); + else + return last; +}; - const data = this.streamingData; +Cipher.prototype._pad = function _pad(buffer, off) { + if (off === 0) + return false; - if (data.missed >= 5) { - this._triggerTerminalState('end', 'Stream is not generating quickly enough.'); - return; - } + while (off < buffer.length) + buffer[off++] = 0; - if (this.paused) { - // data.timestamp = data.timestamp + 4294967295 ? data.timestamp + 960 : 0; - data.pausedTime += data.length * 10; - this.player.voiceConnection.voiceManager.client.setTimeout(() => this._send(), data.length * 10); - return; - } + return true; +}; - this._setSpeaking(true); +Cipher.prototype._finalEncrypt = function _finalEncrypt() { + if (!this._pad(this.buffer, this.bufferOff)) + return []; - if (!data.startTime) { - /** - * Emitted once the dispatcher starts streaming - * @event StreamDispatcher#start - */ - this.emit('start'); - data.startTime = Date.now(); - } + var out = new Array(this.blockSize); + this._update(this.buffer, 0, out, 0); + return out; +}; - const bufferLength = 1920 * data.channels; - let buffer = this.stream.read(bufferLength); - if (!buffer) { - data.missed++; - data.pausedTime += data.length * 10; - this.player.voiceConnection.voiceManager.client.setTimeout(() => this._send(), data.length * 10); - return; - } +Cipher.prototype._unpad = function _unpad(buffer) { + return buffer; +}; - data.missed = 0; +Cipher.prototype._finalDecrypt = function _finalDecrypt() { + assert.equal(this.bufferOff, this.blockSize, 'Not enough data to decrypt'); + var out = new Array(this.blockSize); + this._flushBuffer(out, 0); - if (buffer.length !== bufferLength) { - const newBuffer = new Buffer(bufferLength).fill(0); - buffer.copy(newBuffer); - buffer = newBuffer; - } + return this._unpad(out); +}; - buffer = this._applyVolume(buffer); - - data.count++; - data.sequence = (data.sequence + 1) < 65536 ? data.sequence + 1 : 0; - data.timestamp = data.timestamp + 4294967295 ? data.timestamp + 960 : 0; - - this._sendBuffer(buffer, data.sequence, data.timestamp); - - const nextTime = data.length + (data.startTime + data.pausedTime + (data.count * data.length) - Date.now()); - this.player.voiceConnection.voiceManager.client.setTimeout(() => this._send(), nextTime); - } catch (e) { - this._triggerTerminalState('error', e); - } - } - - _triggerEnd() { - /** - * Emitted once the stream has ended. Attach a `once` listener to this. - * @event StreamDispatcher#end - */ - this.emit('end'); - } - - _triggerError(err) { - this.emit('end'); - /** - * Emitted once the stream has encountered an error. Attach a `once` listener to this. Also emits `end`. - * @event StreamDispatcher#error - * @param {Error} err The encountered error - */ - this.emit('error', err); - } - - _triggerTerminalState(state, err) { - if (this._triggered) return; - /** - * Emitted when the stream wants to give debug information. - * @event StreamDispatcher#debug - * @param {string} information The debug information - */ - this.emit('debug', `Triggered terminal state ${state} - stream is now dead`); - this._triggered = true; - this._setSpeaking(false); - switch (state) { - case 'end': - this._triggerEnd(err); - break; - case 'error': - this._triggerError(err); - break; - default: - this.emit('error', 'Unknown trigger state'); - break; - } - } - - _startStreaming() { - if (!this.stream) { - this.emit('error', 'No stream'); - return; - } - - this.stream.on('end', err => this._triggerTerminalState('end', err)); - this.stream.on('error', err => this._triggerTerminalState('error', err)); - - const data = this.streamingData; - data.length = 20; - data.missed = 0; - - this.stream.once('readable', () => this._send()); - } - - _setPaused(paused) { - if (paused) { - this.paused = true; - this._setSpeaking(false); - } else { - this.paused = false; - this._setSpeaking(true); - } - } - } - - module.exports = StreamDispatcher; - - /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(58).Buffer)) /***/ }, /* 172 */ /***/ function(module, exports, __webpack_require__) { - (function(nacl) { - 'use strict'; +"use strict"; +'use strict'; - // Ported in 2014 by Dmitry Chestnykh and Devi Mandiri. - // Public domain. - // - // Implementation derived from TweetNaCl version 20140427. - // See for details: http://tweetnacl.cr.yp.to/ +var assert = __webpack_require__(26); +var inherits = __webpack_require__(1); - var gf = function(init) { - var i, r = new Float64Array(16); - if (init) for (i = 0; i < init.length; i++) r[i] = init[i]; - return r; - }; +var des = __webpack_require__(51); +var utils = des.utils; +var Cipher = des.Cipher; - // Pluggable, initialized in high-level API below. - var randombytes = function(/* x, n */) { throw new Error('no PRNG'); }; +function DESState() { + this.tmp = new Array(2); + this.keys = null; +} - var _0 = new Uint8Array(16); - var _9 = new Uint8Array(32); _9[0] = 9; - - var gf0 = gf(), - gf1 = gf([1]), - _121665 = gf([0xdb41, 1]), - D = gf([0x78a3, 0x1359, 0x4dca, 0x75eb, 0xd8ab, 0x4141, 0x0a4d, 0x0070, 0xe898, 0x7779, 0x4079, 0x8cc7, 0xfe73, 0x2b6f, 0x6cee, 0x5203]), - D2 = gf([0xf159, 0x26b2, 0x9b94, 0xebd6, 0xb156, 0x8283, 0x149a, 0x00e0, 0xd130, 0xeef3, 0x80f2, 0x198e, 0xfce7, 0x56df, 0xd9dc, 0x2406]), - X = gf([0xd51a, 0x8f25, 0x2d60, 0xc956, 0xa7b2, 0x9525, 0xc760, 0x692c, 0xdc5c, 0xfdd6, 0xe231, 0xc0a4, 0x53fe, 0xcd6e, 0x36d3, 0x2169]), - Y = gf([0x6658, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666]), - I = gf([0xa0b0, 0x4a0e, 0x1b27, 0xc4ee, 0xe478, 0xad2f, 0x1806, 0x2f43, 0xd7a7, 0x3dfb, 0x0099, 0x2b4d, 0xdf0b, 0x4fc1, 0x2480, 0x2b83]); - - function ts64(x, i, h, l) { - x[i] = (h >> 24) & 0xff; - x[i+1] = (h >> 16) & 0xff; - x[i+2] = (h >> 8) & 0xff; - x[i+3] = h & 0xff; - x[i+4] = (l >> 24) & 0xff; - x[i+5] = (l >> 16) & 0xff; - x[i+6] = (l >> 8) & 0xff; - x[i+7] = l & 0xff; - } - - function vn(x, xi, y, yi, n) { - var i,d = 0; - for (i = 0; i < n; i++) d |= x[xi+i]^y[yi+i]; - return (1 & ((d - 1) >>> 8)) - 1; - } - - function crypto_verify_16(x, xi, y, yi) { - return vn(x,xi,y,yi,16); - } - - function crypto_verify_32(x, xi, y, yi) { - return vn(x,xi,y,yi,32); - } - - function core_salsa20(o, p, k, c) { - var j0 = c[ 0] & 0xff | (c[ 1] & 0xff)<<8 | (c[ 2] & 0xff)<<16 | (c[ 3] & 0xff)<<24, - j1 = k[ 0] & 0xff | (k[ 1] & 0xff)<<8 | (k[ 2] & 0xff)<<16 | (k[ 3] & 0xff)<<24, - j2 = k[ 4] & 0xff | (k[ 5] & 0xff)<<8 | (k[ 6] & 0xff)<<16 | (k[ 7] & 0xff)<<24, - j3 = k[ 8] & 0xff | (k[ 9] & 0xff)<<8 | (k[10] & 0xff)<<16 | (k[11] & 0xff)<<24, - j4 = k[12] & 0xff | (k[13] & 0xff)<<8 | (k[14] & 0xff)<<16 | (k[15] & 0xff)<<24, - j5 = c[ 4] & 0xff | (c[ 5] & 0xff)<<8 | (c[ 6] & 0xff)<<16 | (c[ 7] & 0xff)<<24, - j6 = p[ 0] & 0xff | (p[ 1] & 0xff)<<8 | (p[ 2] & 0xff)<<16 | (p[ 3] & 0xff)<<24, - j7 = p[ 4] & 0xff | (p[ 5] & 0xff)<<8 | (p[ 6] & 0xff)<<16 | (p[ 7] & 0xff)<<24, - j8 = p[ 8] & 0xff | (p[ 9] & 0xff)<<8 | (p[10] & 0xff)<<16 | (p[11] & 0xff)<<24, - j9 = p[12] & 0xff | (p[13] & 0xff)<<8 | (p[14] & 0xff)<<16 | (p[15] & 0xff)<<24, - j10 = c[ 8] & 0xff | (c[ 9] & 0xff)<<8 | (c[10] & 0xff)<<16 | (c[11] & 0xff)<<24, - j11 = k[16] & 0xff | (k[17] & 0xff)<<8 | (k[18] & 0xff)<<16 | (k[19] & 0xff)<<24, - j12 = k[20] & 0xff | (k[21] & 0xff)<<8 | (k[22] & 0xff)<<16 | (k[23] & 0xff)<<24, - j13 = k[24] & 0xff | (k[25] & 0xff)<<8 | (k[26] & 0xff)<<16 | (k[27] & 0xff)<<24, - j14 = k[28] & 0xff | (k[29] & 0xff)<<8 | (k[30] & 0xff)<<16 | (k[31] & 0xff)<<24, - j15 = c[12] & 0xff | (c[13] & 0xff)<<8 | (c[14] & 0xff)<<16 | (c[15] & 0xff)<<24; - - var x0 = j0, x1 = j1, x2 = j2, x3 = j3, x4 = j4, x5 = j5, x6 = j6, x7 = j7, - x8 = j8, x9 = j9, x10 = j10, x11 = j11, x12 = j12, x13 = j13, x14 = j14, - x15 = j15, u; - - for (var i = 0; i < 20; i += 2) { - u = x0 + x12 | 0; - x4 ^= u<<7 | u>>>(32-7); - u = x4 + x0 | 0; - x8 ^= u<<9 | u>>>(32-9); - u = x8 + x4 | 0; - x12 ^= u<<13 | u>>>(32-13); - u = x12 + x8 | 0; - x0 ^= u<<18 | u>>>(32-18); - - u = x5 + x1 | 0; - x9 ^= u<<7 | u>>>(32-7); - u = x9 + x5 | 0; - x13 ^= u<<9 | u>>>(32-9); - u = x13 + x9 | 0; - x1 ^= u<<13 | u>>>(32-13); - u = x1 + x13 | 0; - x5 ^= u<<18 | u>>>(32-18); - - u = x10 + x6 | 0; - x14 ^= u<<7 | u>>>(32-7); - u = x14 + x10 | 0; - x2 ^= u<<9 | u>>>(32-9); - u = x2 + x14 | 0; - x6 ^= u<<13 | u>>>(32-13); - u = x6 + x2 | 0; - x10 ^= u<<18 | u>>>(32-18); - - u = x15 + x11 | 0; - x3 ^= u<<7 | u>>>(32-7); - u = x3 + x15 | 0; - x7 ^= u<<9 | u>>>(32-9); - u = x7 + x3 | 0; - x11 ^= u<<13 | u>>>(32-13); - u = x11 + x7 | 0; - x15 ^= u<<18 | u>>>(32-18); - - u = x0 + x3 | 0; - x1 ^= u<<7 | u>>>(32-7); - u = x1 + x0 | 0; - x2 ^= u<<9 | u>>>(32-9); - u = x2 + x1 | 0; - x3 ^= u<<13 | u>>>(32-13); - u = x3 + x2 | 0; - x0 ^= u<<18 | u>>>(32-18); - - u = x5 + x4 | 0; - x6 ^= u<<7 | u>>>(32-7); - u = x6 + x5 | 0; - x7 ^= u<<9 | u>>>(32-9); - u = x7 + x6 | 0; - x4 ^= u<<13 | u>>>(32-13); - u = x4 + x7 | 0; - x5 ^= u<<18 | u>>>(32-18); - - u = x10 + x9 | 0; - x11 ^= u<<7 | u>>>(32-7); - u = x11 + x10 | 0; - x8 ^= u<<9 | u>>>(32-9); - u = x8 + x11 | 0; - x9 ^= u<<13 | u>>>(32-13); - u = x9 + x8 | 0; - x10 ^= u<<18 | u>>>(32-18); - - u = x15 + x14 | 0; - x12 ^= u<<7 | u>>>(32-7); - u = x12 + x15 | 0; - x13 ^= u<<9 | u>>>(32-9); - u = x13 + x12 | 0; - x14 ^= u<<13 | u>>>(32-13); - u = x14 + x13 | 0; - x15 ^= u<<18 | u>>>(32-18); - } - x0 = x0 + j0 | 0; - x1 = x1 + j1 | 0; - x2 = x2 + j2 | 0; - x3 = x3 + j3 | 0; - x4 = x4 + j4 | 0; - x5 = x5 + j5 | 0; - x6 = x6 + j6 | 0; - x7 = x7 + j7 | 0; - x8 = x8 + j8 | 0; - x9 = x9 + j9 | 0; - x10 = x10 + j10 | 0; - x11 = x11 + j11 | 0; - x12 = x12 + j12 | 0; - x13 = x13 + j13 | 0; - x14 = x14 + j14 | 0; - x15 = x15 + j15 | 0; - - o[ 0] = x0 >>> 0 & 0xff; - o[ 1] = x0 >>> 8 & 0xff; - o[ 2] = x0 >>> 16 & 0xff; - o[ 3] = x0 >>> 24 & 0xff; - - o[ 4] = x1 >>> 0 & 0xff; - o[ 5] = x1 >>> 8 & 0xff; - o[ 6] = x1 >>> 16 & 0xff; - o[ 7] = x1 >>> 24 & 0xff; - - o[ 8] = x2 >>> 0 & 0xff; - o[ 9] = x2 >>> 8 & 0xff; - o[10] = x2 >>> 16 & 0xff; - o[11] = x2 >>> 24 & 0xff; - - o[12] = x3 >>> 0 & 0xff; - o[13] = x3 >>> 8 & 0xff; - o[14] = x3 >>> 16 & 0xff; - o[15] = x3 >>> 24 & 0xff; - - o[16] = x4 >>> 0 & 0xff; - o[17] = x4 >>> 8 & 0xff; - o[18] = x4 >>> 16 & 0xff; - o[19] = x4 >>> 24 & 0xff; - - o[20] = x5 >>> 0 & 0xff; - o[21] = x5 >>> 8 & 0xff; - o[22] = x5 >>> 16 & 0xff; - o[23] = x5 >>> 24 & 0xff; - - o[24] = x6 >>> 0 & 0xff; - o[25] = x6 >>> 8 & 0xff; - o[26] = x6 >>> 16 & 0xff; - o[27] = x6 >>> 24 & 0xff; - - o[28] = x7 >>> 0 & 0xff; - o[29] = x7 >>> 8 & 0xff; - o[30] = x7 >>> 16 & 0xff; - o[31] = x7 >>> 24 & 0xff; - - o[32] = x8 >>> 0 & 0xff; - o[33] = x8 >>> 8 & 0xff; - o[34] = x8 >>> 16 & 0xff; - o[35] = x8 >>> 24 & 0xff; - - o[36] = x9 >>> 0 & 0xff; - o[37] = x9 >>> 8 & 0xff; - o[38] = x9 >>> 16 & 0xff; - o[39] = x9 >>> 24 & 0xff; - - o[40] = x10 >>> 0 & 0xff; - o[41] = x10 >>> 8 & 0xff; - o[42] = x10 >>> 16 & 0xff; - o[43] = x10 >>> 24 & 0xff; - - o[44] = x11 >>> 0 & 0xff; - o[45] = x11 >>> 8 & 0xff; - o[46] = x11 >>> 16 & 0xff; - o[47] = x11 >>> 24 & 0xff; - - o[48] = x12 >>> 0 & 0xff; - o[49] = x12 >>> 8 & 0xff; - o[50] = x12 >>> 16 & 0xff; - o[51] = x12 >>> 24 & 0xff; - - o[52] = x13 >>> 0 & 0xff; - o[53] = x13 >>> 8 & 0xff; - o[54] = x13 >>> 16 & 0xff; - o[55] = x13 >>> 24 & 0xff; - - o[56] = x14 >>> 0 & 0xff; - o[57] = x14 >>> 8 & 0xff; - o[58] = x14 >>> 16 & 0xff; - o[59] = x14 >>> 24 & 0xff; - - o[60] = x15 >>> 0 & 0xff; - o[61] = x15 >>> 8 & 0xff; - o[62] = x15 >>> 16 & 0xff; - o[63] = x15 >>> 24 & 0xff; - } - - function core_hsalsa20(o,p,k,c) { - var j0 = c[ 0] & 0xff | (c[ 1] & 0xff)<<8 | (c[ 2] & 0xff)<<16 | (c[ 3] & 0xff)<<24, - j1 = k[ 0] & 0xff | (k[ 1] & 0xff)<<8 | (k[ 2] & 0xff)<<16 | (k[ 3] & 0xff)<<24, - j2 = k[ 4] & 0xff | (k[ 5] & 0xff)<<8 | (k[ 6] & 0xff)<<16 | (k[ 7] & 0xff)<<24, - j3 = k[ 8] & 0xff | (k[ 9] & 0xff)<<8 | (k[10] & 0xff)<<16 | (k[11] & 0xff)<<24, - j4 = k[12] & 0xff | (k[13] & 0xff)<<8 | (k[14] & 0xff)<<16 | (k[15] & 0xff)<<24, - j5 = c[ 4] & 0xff | (c[ 5] & 0xff)<<8 | (c[ 6] & 0xff)<<16 | (c[ 7] & 0xff)<<24, - j6 = p[ 0] & 0xff | (p[ 1] & 0xff)<<8 | (p[ 2] & 0xff)<<16 | (p[ 3] & 0xff)<<24, - j7 = p[ 4] & 0xff | (p[ 5] & 0xff)<<8 | (p[ 6] & 0xff)<<16 | (p[ 7] & 0xff)<<24, - j8 = p[ 8] & 0xff | (p[ 9] & 0xff)<<8 | (p[10] & 0xff)<<16 | (p[11] & 0xff)<<24, - j9 = p[12] & 0xff | (p[13] & 0xff)<<8 | (p[14] & 0xff)<<16 | (p[15] & 0xff)<<24, - j10 = c[ 8] & 0xff | (c[ 9] & 0xff)<<8 | (c[10] & 0xff)<<16 | (c[11] & 0xff)<<24, - j11 = k[16] & 0xff | (k[17] & 0xff)<<8 | (k[18] & 0xff)<<16 | (k[19] & 0xff)<<24, - j12 = k[20] & 0xff | (k[21] & 0xff)<<8 | (k[22] & 0xff)<<16 | (k[23] & 0xff)<<24, - j13 = k[24] & 0xff | (k[25] & 0xff)<<8 | (k[26] & 0xff)<<16 | (k[27] & 0xff)<<24, - j14 = k[28] & 0xff | (k[29] & 0xff)<<8 | (k[30] & 0xff)<<16 | (k[31] & 0xff)<<24, - j15 = c[12] & 0xff | (c[13] & 0xff)<<8 | (c[14] & 0xff)<<16 | (c[15] & 0xff)<<24; - - var x0 = j0, x1 = j1, x2 = j2, x3 = j3, x4 = j4, x5 = j5, x6 = j6, x7 = j7, - x8 = j8, x9 = j9, x10 = j10, x11 = j11, x12 = j12, x13 = j13, x14 = j14, - x15 = j15, u; - - for (var i = 0; i < 20; i += 2) { - u = x0 + x12 | 0; - x4 ^= u<<7 | u>>>(32-7); - u = x4 + x0 | 0; - x8 ^= u<<9 | u>>>(32-9); - u = x8 + x4 | 0; - x12 ^= u<<13 | u>>>(32-13); - u = x12 + x8 | 0; - x0 ^= u<<18 | u>>>(32-18); - - u = x5 + x1 | 0; - x9 ^= u<<7 | u>>>(32-7); - u = x9 + x5 | 0; - x13 ^= u<<9 | u>>>(32-9); - u = x13 + x9 | 0; - x1 ^= u<<13 | u>>>(32-13); - u = x1 + x13 | 0; - x5 ^= u<<18 | u>>>(32-18); - - u = x10 + x6 | 0; - x14 ^= u<<7 | u>>>(32-7); - u = x14 + x10 | 0; - x2 ^= u<<9 | u>>>(32-9); - u = x2 + x14 | 0; - x6 ^= u<<13 | u>>>(32-13); - u = x6 + x2 | 0; - x10 ^= u<<18 | u>>>(32-18); - - u = x15 + x11 | 0; - x3 ^= u<<7 | u>>>(32-7); - u = x3 + x15 | 0; - x7 ^= u<<9 | u>>>(32-9); - u = x7 + x3 | 0; - x11 ^= u<<13 | u>>>(32-13); - u = x11 + x7 | 0; - x15 ^= u<<18 | u>>>(32-18); - - u = x0 + x3 | 0; - x1 ^= u<<7 | u>>>(32-7); - u = x1 + x0 | 0; - x2 ^= u<<9 | u>>>(32-9); - u = x2 + x1 | 0; - x3 ^= u<<13 | u>>>(32-13); - u = x3 + x2 | 0; - x0 ^= u<<18 | u>>>(32-18); - - u = x5 + x4 | 0; - x6 ^= u<<7 | u>>>(32-7); - u = x6 + x5 | 0; - x7 ^= u<<9 | u>>>(32-9); - u = x7 + x6 | 0; - x4 ^= u<<13 | u>>>(32-13); - u = x4 + x7 | 0; - x5 ^= u<<18 | u>>>(32-18); - - u = x10 + x9 | 0; - x11 ^= u<<7 | u>>>(32-7); - u = x11 + x10 | 0; - x8 ^= u<<9 | u>>>(32-9); - u = x8 + x11 | 0; - x9 ^= u<<13 | u>>>(32-13); - u = x9 + x8 | 0; - x10 ^= u<<18 | u>>>(32-18); - - u = x15 + x14 | 0; - x12 ^= u<<7 | u>>>(32-7); - u = x12 + x15 | 0; - x13 ^= u<<9 | u>>>(32-9); - u = x13 + x12 | 0; - x14 ^= u<<13 | u>>>(32-13); - u = x14 + x13 | 0; - x15 ^= u<<18 | u>>>(32-18); - } - - o[ 0] = x0 >>> 0 & 0xff; - o[ 1] = x0 >>> 8 & 0xff; - o[ 2] = x0 >>> 16 & 0xff; - o[ 3] = x0 >>> 24 & 0xff; - - o[ 4] = x5 >>> 0 & 0xff; - o[ 5] = x5 >>> 8 & 0xff; - o[ 6] = x5 >>> 16 & 0xff; - o[ 7] = x5 >>> 24 & 0xff; - - o[ 8] = x10 >>> 0 & 0xff; - o[ 9] = x10 >>> 8 & 0xff; - o[10] = x10 >>> 16 & 0xff; - o[11] = x10 >>> 24 & 0xff; - - o[12] = x15 >>> 0 & 0xff; - o[13] = x15 >>> 8 & 0xff; - o[14] = x15 >>> 16 & 0xff; - o[15] = x15 >>> 24 & 0xff; - - o[16] = x6 >>> 0 & 0xff; - o[17] = x6 >>> 8 & 0xff; - o[18] = x6 >>> 16 & 0xff; - o[19] = x6 >>> 24 & 0xff; - - o[20] = x7 >>> 0 & 0xff; - o[21] = x7 >>> 8 & 0xff; - o[22] = x7 >>> 16 & 0xff; - o[23] = x7 >>> 24 & 0xff; - - o[24] = x8 >>> 0 & 0xff; - o[25] = x8 >>> 8 & 0xff; - o[26] = x8 >>> 16 & 0xff; - o[27] = x8 >>> 24 & 0xff; - - o[28] = x9 >>> 0 & 0xff; - o[29] = x9 >>> 8 & 0xff; - o[30] = x9 >>> 16 & 0xff; - o[31] = x9 >>> 24 & 0xff; - } - - function crypto_core_salsa20(out,inp,k,c) { - core_salsa20(out,inp,k,c); - } - - function crypto_core_hsalsa20(out,inp,k,c) { - core_hsalsa20(out,inp,k,c); - } - - var sigma = new Uint8Array([101, 120, 112, 97, 110, 100, 32, 51, 50, 45, 98, 121, 116, 101, 32, 107]); - // "expand 32-byte k" - - function crypto_stream_salsa20_xor(c,cpos,m,mpos,b,n,k) { - var z = new Uint8Array(16), x = new Uint8Array(64); - var u, i; - for (i = 0; i < 16; i++) z[i] = 0; - for (i = 0; i < 8; i++) z[i] = n[i]; - while (b >= 64) { - crypto_core_salsa20(x,z,k,sigma); - for (i = 0; i < 64; i++) c[cpos+i] = m[mpos+i] ^ x[i]; - u = 1; - for (i = 8; i < 16; i++) { - u = u + (z[i] & 0xff) | 0; - z[i] = u & 0xff; - u >>>= 8; - } - b -= 64; - cpos += 64; - mpos += 64; - } - if (b > 0) { - crypto_core_salsa20(x,z,k,sigma); - for (i = 0; i < b; i++) c[cpos+i] = m[mpos+i] ^ x[i]; - } - return 0; - } - - function crypto_stream_salsa20(c,cpos,b,n,k) { - var z = new Uint8Array(16), x = new Uint8Array(64); - var u, i; - for (i = 0; i < 16; i++) z[i] = 0; - for (i = 0; i < 8; i++) z[i] = n[i]; - while (b >= 64) { - crypto_core_salsa20(x,z,k,sigma); - for (i = 0; i < 64; i++) c[cpos+i] = x[i]; - u = 1; - for (i = 8; i < 16; i++) { - u = u + (z[i] & 0xff) | 0; - z[i] = u & 0xff; - u >>>= 8; - } - b -= 64; - cpos += 64; - } - if (b > 0) { - crypto_core_salsa20(x,z,k,sigma); - for (i = 0; i < b; i++) c[cpos+i] = x[i]; - } - return 0; - } - - function crypto_stream(c,cpos,d,n,k) { - var s = new Uint8Array(32); - crypto_core_hsalsa20(s,n,k,sigma); - var sn = new Uint8Array(8); - for (var i = 0; i < 8; i++) sn[i] = n[i+16]; - return crypto_stream_salsa20(c,cpos,d,sn,s); - } - - function crypto_stream_xor(c,cpos,m,mpos,d,n,k) { - var s = new Uint8Array(32); - crypto_core_hsalsa20(s,n,k,sigma); - var sn = new Uint8Array(8); - for (var i = 0; i < 8; i++) sn[i] = n[i+16]; - return crypto_stream_salsa20_xor(c,cpos,m,mpos,d,sn,s); - } - - /* - * Port of Andrew Moon's Poly1305-donna-16. Public domain. - * https://github.com/floodyberry/poly1305-donna - */ - - var poly1305 = function(key) { - this.buffer = new Uint8Array(16); - this.r = new Uint16Array(10); - this.h = new Uint16Array(10); - this.pad = new Uint16Array(8); - this.leftover = 0; - this.fin = 0; - - var t0, t1, t2, t3, t4, t5, t6, t7; - - t0 = key[ 0] & 0xff | (key[ 1] & 0xff) << 8; this.r[0] = ( t0 ) & 0x1fff; - t1 = key[ 2] & 0xff | (key[ 3] & 0xff) << 8; this.r[1] = ((t0 >>> 13) | (t1 << 3)) & 0x1fff; - t2 = key[ 4] & 0xff | (key[ 5] & 0xff) << 8; this.r[2] = ((t1 >>> 10) | (t2 << 6)) & 0x1f03; - t3 = key[ 6] & 0xff | (key[ 7] & 0xff) << 8; this.r[3] = ((t2 >>> 7) | (t3 << 9)) & 0x1fff; - t4 = key[ 8] & 0xff | (key[ 9] & 0xff) << 8; this.r[4] = ((t3 >>> 4) | (t4 << 12)) & 0x00ff; - this.r[5] = ((t4 >>> 1)) & 0x1ffe; - t5 = key[10] & 0xff | (key[11] & 0xff) << 8; this.r[6] = ((t4 >>> 14) | (t5 << 2)) & 0x1fff; - t6 = key[12] & 0xff | (key[13] & 0xff) << 8; this.r[7] = ((t5 >>> 11) | (t6 << 5)) & 0x1f81; - t7 = key[14] & 0xff | (key[15] & 0xff) << 8; this.r[8] = ((t6 >>> 8) | (t7 << 8)) & 0x1fff; - this.r[9] = ((t7 >>> 5)) & 0x007f; - - this.pad[0] = key[16] & 0xff | (key[17] & 0xff) << 8; - this.pad[1] = key[18] & 0xff | (key[19] & 0xff) << 8; - this.pad[2] = key[20] & 0xff | (key[21] & 0xff) << 8; - this.pad[3] = key[22] & 0xff | (key[23] & 0xff) << 8; - this.pad[4] = key[24] & 0xff | (key[25] & 0xff) << 8; - this.pad[5] = key[26] & 0xff | (key[27] & 0xff) << 8; - this.pad[6] = key[28] & 0xff | (key[29] & 0xff) << 8; - this.pad[7] = key[30] & 0xff | (key[31] & 0xff) << 8; - }; - - poly1305.prototype.blocks = function(m, mpos, bytes) { - var hibit = this.fin ? 0 : (1 << 11); - var t0, t1, t2, t3, t4, t5, t6, t7, c; - var d0, d1, d2, d3, d4, d5, d6, d7, d8, d9; - - var h0 = this.h[0], - h1 = this.h[1], - h2 = this.h[2], - h3 = this.h[3], - h4 = this.h[4], - h5 = this.h[5], - h6 = this.h[6], - h7 = this.h[7], - h8 = this.h[8], - h9 = this.h[9]; - - var r0 = this.r[0], - r1 = this.r[1], - r2 = this.r[2], - r3 = this.r[3], - r4 = this.r[4], - r5 = this.r[5], - r6 = this.r[6], - r7 = this.r[7], - r8 = this.r[8], - r9 = this.r[9]; - - while (bytes >= 16) { - t0 = m[mpos+ 0] & 0xff | (m[mpos+ 1] & 0xff) << 8; h0 += ( t0 ) & 0x1fff; - t1 = m[mpos+ 2] & 0xff | (m[mpos+ 3] & 0xff) << 8; h1 += ((t0 >>> 13) | (t1 << 3)) & 0x1fff; - t2 = m[mpos+ 4] & 0xff | (m[mpos+ 5] & 0xff) << 8; h2 += ((t1 >>> 10) | (t2 << 6)) & 0x1fff; - t3 = m[mpos+ 6] & 0xff | (m[mpos+ 7] & 0xff) << 8; h3 += ((t2 >>> 7) | (t3 << 9)) & 0x1fff; - t4 = m[mpos+ 8] & 0xff | (m[mpos+ 9] & 0xff) << 8; h4 += ((t3 >>> 4) | (t4 << 12)) & 0x1fff; - h5 += ((t4 >>> 1)) & 0x1fff; - t5 = m[mpos+10] & 0xff | (m[mpos+11] & 0xff) << 8; h6 += ((t4 >>> 14) | (t5 << 2)) & 0x1fff; - t6 = m[mpos+12] & 0xff | (m[mpos+13] & 0xff) << 8; h7 += ((t5 >>> 11) | (t6 << 5)) & 0x1fff; - t7 = m[mpos+14] & 0xff | (m[mpos+15] & 0xff) << 8; h8 += ((t6 >>> 8) | (t7 << 8)) & 0x1fff; - h9 += ((t7 >>> 5)) | hibit; - - c = 0; - - d0 = c; - d0 += h0 * r0; - d0 += h1 * (5 * r9); - d0 += h2 * (5 * r8); - d0 += h3 * (5 * r7); - d0 += h4 * (5 * r6); - c = (d0 >>> 13); d0 &= 0x1fff; - d0 += h5 * (5 * r5); - d0 += h6 * (5 * r4); - d0 += h7 * (5 * r3); - d0 += h8 * (5 * r2); - d0 += h9 * (5 * r1); - c += (d0 >>> 13); d0 &= 0x1fff; - - d1 = c; - d1 += h0 * r1; - d1 += h1 * r0; - d1 += h2 * (5 * r9); - d1 += h3 * (5 * r8); - d1 += h4 * (5 * r7); - c = (d1 >>> 13); d1 &= 0x1fff; - d1 += h5 * (5 * r6); - d1 += h6 * (5 * r5); - d1 += h7 * (5 * r4); - d1 += h8 * (5 * r3); - d1 += h9 * (5 * r2); - c += (d1 >>> 13); d1 &= 0x1fff; - - d2 = c; - d2 += h0 * r2; - d2 += h1 * r1; - d2 += h2 * r0; - d2 += h3 * (5 * r9); - d2 += h4 * (5 * r8); - c = (d2 >>> 13); d2 &= 0x1fff; - d2 += h5 * (5 * r7); - d2 += h6 * (5 * r6); - d2 += h7 * (5 * r5); - d2 += h8 * (5 * r4); - d2 += h9 * (5 * r3); - c += (d2 >>> 13); d2 &= 0x1fff; - - d3 = c; - d3 += h0 * r3; - d3 += h1 * r2; - d3 += h2 * r1; - d3 += h3 * r0; - d3 += h4 * (5 * r9); - c = (d3 >>> 13); d3 &= 0x1fff; - d3 += h5 * (5 * r8); - d3 += h6 * (5 * r7); - d3 += h7 * (5 * r6); - d3 += h8 * (5 * r5); - d3 += h9 * (5 * r4); - c += (d3 >>> 13); d3 &= 0x1fff; - - d4 = c; - d4 += h0 * r4; - d4 += h1 * r3; - d4 += h2 * r2; - d4 += h3 * r1; - d4 += h4 * r0; - c = (d4 >>> 13); d4 &= 0x1fff; - d4 += h5 * (5 * r9); - d4 += h6 * (5 * r8); - d4 += h7 * (5 * r7); - d4 += h8 * (5 * r6); - d4 += h9 * (5 * r5); - c += (d4 >>> 13); d4 &= 0x1fff; - - d5 = c; - d5 += h0 * r5; - d5 += h1 * r4; - d5 += h2 * r3; - d5 += h3 * r2; - d5 += h4 * r1; - c = (d5 >>> 13); d5 &= 0x1fff; - d5 += h5 * r0; - d5 += h6 * (5 * r9); - d5 += h7 * (5 * r8); - d5 += h8 * (5 * r7); - d5 += h9 * (5 * r6); - c += (d5 >>> 13); d5 &= 0x1fff; - - d6 = c; - d6 += h0 * r6; - d6 += h1 * r5; - d6 += h2 * r4; - d6 += h3 * r3; - d6 += h4 * r2; - c = (d6 >>> 13); d6 &= 0x1fff; - d6 += h5 * r1; - d6 += h6 * r0; - d6 += h7 * (5 * r9); - d6 += h8 * (5 * r8); - d6 += h9 * (5 * r7); - c += (d6 >>> 13); d6 &= 0x1fff; - - d7 = c; - d7 += h0 * r7; - d7 += h1 * r6; - d7 += h2 * r5; - d7 += h3 * r4; - d7 += h4 * r3; - c = (d7 >>> 13); d7 &= 0x1fff; - d7 += h5 * r2; - d7 += h6 * r1; - d7 += h7 * r0; - d7 += h8 * (5 * r9); - d7 += h9 * (5 * r8); - c += (d7 >>> 13); d7 &= 0x1fff; - - d8 = c; - d8 += h0 * r8; - d8 += h1 * r7; - d8 += h2 * r6; - d8 += h3 * r5; - d8 += h4 * r4; - c = (d8 >>> 13); d8 &= 0x1fff; - d8 += h5 * r3; - d8 += h6 * r2; - d8 += h7 * r1; - d8 += h8 * r0; - d8 += h9 * (5 * r9); - c += (d8 >>> 13); d8 &= 0x1fff; - - d9 = c; - d9 += h0 * r9; - d9 += h1 * r8; - d9 += h2 * r7; - d9 += h3 * r6; - d9 += h4 * r5; - c = (d9 >>> 13); d9 &= 0x1fff; - d9 += h5 * r4; - d9 += h6 * r3; - d9 += h7 * r2; - d9 += h8 * r1; - d9 += h9 * r0; - c += (d9 >>> 13); d9 &= 0x1fff; - - c = (((c << 2) + c)) | 0; - c = (c + d0) | 0; - d0 = c & 0x1fff; - c = (c >>> 13); - d1 += c; - - h0 = d0; - h1 = d1; - h2 = d2; - h3 = d3; - h4 = d4; - h5 = d5; - h6 = d6; - h7 = d7; - h8 = d8; - h9 = d9; - - mpos += 16; - bytes -= 16; - } - this.h[0] = h0; - this.h[1] = h1; - this.h[2] = h2; - this.h[3] = h3; - this.h[4] = h4; - this.h[5] = h5; - this.h[6] = h6; - this.h[7] = h7; - this.h[8] = h8; - this.h[9] = h9; - }; - - poly1305.prototype.finish = function(mac, macpos) { - var g = new Uint16Array(10); - var c, mask, f, i; - - if (this.leftover) { - i = this.leftover; - this.buffer[i++] = 1; - for (; i < 16; i++) this.buffer[i] = 0; - this.fin = 1; - this.blocks(this.buffer, 0, 16); - } - - c = this.h[1] >>> 13; - this.h[1] &= 0x1fff; - for (i = 2; i < 10; i++) { - this.h[i] += c; - c = this.h[i] >>> 13; - this.h[i] &= 0x1fff; - } - this.h[0] += (c * 5); - c = this.h[0] >>> 13; - this.h[0] &= 0x1fff; - this.h[1] += c; - c = this.h[1] >>> 13; - this.h[1] &= 0x1fff; - this.h[2] += c; - - g[0] = this.h[0] + 5; - c = g[0] >>> 13; - g[0] &= 0x1fff; - for (i = 1; i < 10; i++) { - g[i] = this.h[i] + c; - c = g[i] >>> 13; - g[i] &= 0x1fff; - } - g[9] -= (1 << 13); - - mask = (c ^ 1) - 1; - for (i = 0; i < 10; i++) g[i] &= mask; - mask = ~mask; - for (i = 0; i < 10; i++) this.h[i] = (this.h[i] & mask) | g[i]; - - this.h[0] = ((this.h[0] ) | (this.h[1] << 13) ) & 0xffff; - this.h[1] = ((this.h[1] >>> 3) | (this.h[2] << 10) ) & 0xffff; - this.h[2] = ((this.h[2] >>> 6) | (this.h[3] << 7) ) & 0xffff; - this.h[3] = ((this.h[3] >>> 9) | (this.h[4] << 4) ) & 0xffff; - this.h[4] = ((this.h[4] >>> 12) | (this.h[5] << 1) | (this.h[6] << 14)) & 0xffff; - this.h[5] = ((this.h[6] >>> 2) | (this.h[7] << 11) ) & 0xffff; - this.h[6] = ((this.h[7] >>> 5) | (this.h[8] << 8) ) & 0xffff; - this.h[7] = ((this.h[8] >>> 8) | (this.h[9] << 5) ) & 0xffff; - - f = this.h[0] + this.pad[0]; - this.h[0] = f & 0xffff; - for (i = 1; i < 8; i++) { - f = (((this.h[i] + this.pad[i]) | 0) + (f >>> 16)) | 0; - this.h[i] = f & 0xffff; - } - - mac[macpos+ 0] = (this.h[0] >>> 0) & 0xff; - mac[macpos+ 1] = (this.h[0] >>> 8) & 0xff; - mac[macpos+ 2] = (this.h[1] >>> 0) & 0xff; - mac[macpos+ 3] = (this.h[1] >>> 8) & 0xff; - mac[macpos+ 4] = (this.h[2] >>> 0) & 0xff; - mac[macpos+ 5] = (this.h[2] >>> 8) & 0xff; - mac[macpos+ 6] = (this.h[3] >>> 0) & 0xff; - mac[macpos+ 7] = (this.h[3] >>> 8) & 0xff; - mac[macpos+ 8] = (this.h[4] >>> 0) & 0xff; - mac[macpos+ 9] = (this.h[4] >>> 8) & 0xff; - mac[macpos+10] = (this.h[5] >>> 0) & 0xff; - mac[macpos+11] = (this.h[5] >>> 8) & 0xff; - mac[macpos+12] = (this.h[6] >>> 0) & 0xff; - mac[macpos+13] = (this.h[6] >>> 8) & 0xff; - mac[macpos+14] = (this.h[7] >>> 0) & 0xff; - mac[macpos+15] = (this.h[7] >>> 8) & 0xff; - }; - - poly1305.prototype.update = function(m, mpos, bytes) { - var i, want; - - if (this.leftover) { - want = (16 - this.leftover); - if (want > bytes) - want = bytes; - for (i = 0; i < want; i++) - this.buffer[this.leftover + i] = m[mpos+i]; - bytes -= want; - mpos += want; - this.leftover += want; - if (this.leftover < 16) - return; - this.blocks(this.buffer, 0, 16); - this.leftover = 0; - } - - if (bytes >= 16) { - want = bytes - (bytes % 16); - this.blocks(m, mpos, want); - mpos += want; - bytes -= want; - } - - if (bytes) { - for (i = 0; i < bytes; i++) - this.buffer[this.leftover + i] = m[mpos+i]; - this.leftover += bytes; - } - }; - - function crypto_onetimeauth(out, outpos, m, mpos, n, k) { - var s = new poly1305(k); - s.update(m, mpos, n); - s.finish(out, outpos); - return 0; - } - - function crypto_onetimeauth_verify(h, hpos, m, mpos, n, k) { - var x = new Uint8Array(16); - crypto_onetimeauth(x,0,m,mpos,n,k); - return crypto_verify_16(h,hpos,x,0); - } - - function crypto_secretbox(c,m,d,n,k) { - var i; - if (d < 32) return -1; - crypto_stream_xor(c,0,m,0,d,n,k); - crypto_onetimeauth(c, 16, c, 32, d - 32, c); - for (i = 0; i < 16; i++) c[i] = 0; - return 0; - } - - function crypto_secretbox_open(m,c,d,n,k) { - var i; - var x = new Uint8Array(32); - if (d < 32) return -1; - crypto_stream(x,0,32,n,k); - if (crypto_onetimeauth_verify(c, 16,c, 32,d - 32,x) !== 0) return -1; - crypto_stream_xor(m,0,c,0,d,n,k); - for (i = 0; i < 32; i++) m[i] = 0; - return 0; - } - - function set25519(r, a) { - var i; - for (i = 0; i < 16; i++) r[i] = a[i]|0; - } - - function car25519(o) { - var i, v, c = 1; - for (i = 0; i < 16; i++) { - v = o[i] + c + 65535; - c = Math.floor(v / 65536); - o[i] = v - c * 65536; - } - o[0] += c-1 + 37 * (c-1); - } - - function sel25519(p, q, b) { - var t, c = ~(b-1); - for (var i = 0; i < 16; i++) { - t = c & (p[i] ^ q[i]); - p[i] ^= t; - q[i] ^= t; - } - } - - function pack25519(o, n) { - var i, j, b; - var m = gf(), t = gf(); - for (i = 0; i < 16; i++) t[i] = n[i]; - car25519(t); - car25519(t); - car25519(t); - for (j = 0; j < 2; j++) { - m[0] = t[0] - 0xffed; - for (i = 1; i < 15; i++) { - m[i] = t[i] - 0xffff - ((m[i-1]>>16) & 1); - m[i-1] &= 0xffff; - } - m[15] = t[15] - 0x7fff - ((m[14]>>16) & 1); - b = (m[15]>>16) & 1; - m[14] &= 0xffff; - sel25519(t, m, 1-b); - } - for (i = 0; i < 16; i++) { - o[2*i] = t[i] & 0xff; - o[2*i+1] = t[i]>>8; - } - } - - function neq25519(a, b) { - var c = new Uint8Array(32), d = new Uint8Array(32); - pack25519(c, a); - pack25519(d, b); - return crypto_verify_32(c, 0, d, 0); - } - - function par25519(a) { - var d = new Uint8Array(32); - pack25519(d, a); - return d[0] & 1; - } - - function unpack25519(o, n) { - var i; - for (i = 0; i < 16; i++) o[i] = n[2*i] + (n[2*i+1] << 8); - o[15] &= 0x7fff; - } - - function A(o, a, b) { - for (var i = 0; i < 16; i++) o[i] = a[i] + b[i]; - } - - function Z(o, a, b) { - for (var i = 0; i < 16; i++) o[i] = a[i] - b[i]; - } - - function M(o, a, b) { - var v, c, - t0 = 0, t1 = 0, t2 = 0, t3 = 0, t4 = 0, t5 = 0, t6 = 0, t7 = 0, - t8 = 0, t9 = 0, t10 = 0, t11 = 0, t12 = 0, t13 = 0, t14 = 0, t15 = 0, - t16 = 0, t17 = 0, t18 = 0, t19 = 0, t20 = 0, t21 = 0, t22 = 0, t23 = 0, - t24 = 0, t25 = 0, t26 = 0, t27 = 0, t28 = 0, t29 = 0, t30 = 0, - b0 = b[0], - b1 = b[1], - b2 = b[2], - b3 = b[3], - b4 = b[4], - b5 = b[5], - b6 = b[6], - b7 = b[7], - b8 = b[8], - b9 = b[9], - b10 = b[10], - b11 = b[11], - b12 = b[12], - b13 = b[13], - b14 = b[14], - b15 = b[15]; - - v = a[0]; - t0 += v * b0; - t1 += v * b1; - t2 += v * b2; - t3 += v * b3; - t4 += v * b4; - t5 += v * b5; - t6 += v * b6; - t7 += v * b7; - t8 += v * b8; - t9 += v * b9; - t10 += v * b10; - t11 += v * b11; - t12 += v * b12; - t13 += v * b13; - t14 += v * b14; - t15 += v * b15; - v = a[1]; - t1 += v * b0; - t2 += v * b1; - t3 += v * b2; - t4 += v * b3; - t5 += v * b4; - t6 += v * b5; - t7 += v * b6; - t8 += v * b7; - t9 += v * b8; - t10 += v * b9; - t11 += v * b10; - t12 += v * b11; - t13 += v * b12; - t14 += v * b13; - t15 += v * b14; - t16 += v * b15; - v = a[2]; - t2 += v * b0; - t3 += v * b1; - t4 += v * b2; - t5 += v * b3; - t6 += v * b4; - t7 += v * b5; - t8 += v * b6; - t9 += v * b7; - t10 += v * b8; - t11 += v * b9; - t12 += v * b10; - t13 += v * b11; - t14 += v * b12; - t15 += v * b13; - t16 += v * b14; - t17 += v * b15; - v = a[3]; - t3 += v * b0; - t4 += v * b1; - t5 += v * b2; - t6 += v * b3; - t7 += v * b4; - t8 += v * b5; - t9 += v * b6; - t10 += v * b7; - t11 += v * b8; - t12 += v * b9; - t13 += v * b10; - t14 += v * b11; - t15 += v * b12; - t16 += v * b13; - t17 += v * b14; - t18 += v * b15; - v = a[4]; - t4 += v * b0; - t5 += v * b1; - t6 += v * b2; - t7 += v * b3; - t8 += v * b4; - t9 += v * b5; - t10 += v * b6; - t11 += v * b7; - t12 += v * b8; - t13 += v * b9; - t14 += v * b10; - t15 += v * b11; - t16 += v * b12; - t17 += v * b13; - t18 += v * b14; - t19 += v * b15; - v = a[5]; - t5 += v * b0; - t6 += v * b1; - t7 += v * b2; - t8 += v * b3; - t9 += v * b4; - t10 += v * b5; - t11 += v * b6; - t12 += v * b7; - t13 += v * b8; - t14 += v * b9; - t15 += v * b10; - t16 += v * b11; - t17 += v * b12; - t18 += v * b13; - t19 += v * b14; - t20 += v * b15; - v = a[6]; - t6 += v * b0; - t7 += v * b1; - t8 += v * b2; - t9 += v * b3; - t10 += v * b4; - t11 += v * b5; - t12 += v * b6; - t13 += v * b7; - t14 += v * b8; - t15 += v * b9; - t16 += v * b10; - t17 += v * b11; - t18 += v * b12; - t19 += v * b13; - t20 += v * b14; - t21 += v * b15; - v = a[7]; - t7 += v * b0; - t8 += v * b1; - t9 += v * b2; - t10 += v * b3; - t11 += v * b4; - t12 += v * b5; - t13 += v * b6; - t14 += v * b7; - t15 += v * b8; - t16 += v * b9; - t17 += v * b10; - t18 += v * b11; - t19 += v * b12; - t20 += v * b13; - t21 += v * b14; - t22 += v * b15; - v = a[8]; - t8 += v * b0; - t9 += v * b1; - t10 += v * b2; - t11 += v * b3; - t12 += v * b4; - t13 += v * b5; - t14 += v * b6; - t15 += v * b7; - t16 += v * b8; - t17 += v * b9; - t18 += v * b10; - t19 += v * b11; - t20 += v * b12; - t21 += v * b13; - t22 += v * b14; - t23 += v * b15; - v = a[9]; - t9 += v * b0; - t10 += v * b1; - t11 += v * b2; - t12 += v * b3; - t13 += v * b4; - t14 += v * b5; - t15 += v * b6; - t16 += v * b7; - t17 += v * b8; - t18 += v * b9; - t19 += v * b10; - t20 += v * b11; - t21 += v * b12; - t22 += v * b13; - t23 += v * b14; - t24 += v * b15; - v = a[10]; - t10 += v * b0; - t11 += v * b1; - t12 += v * b2; - t13 += v * b3; - t14 += v * b4; - t15 += v * b5; - t16 += v * b6; - t17 += v * b7; - t18 += v * b8; - t19 += v * b9; - t20 += v * b10; - t21 += v * b11; - t22 += v * b12; - t23 += v * b13; - t24 += v * b14; - t25 += v * b15; - v = a[11]; - t11 += v * b0; - t12 += v * b1; - t13 += v * b2; - t14 += v * b3; - t15 += v * b4; - t16 += v * b5; - t17 += v * b6; - t18 += v * b7; - t19 += v * b8; - t20 += v * b9; - t21 += v * b10; - t22 += v * b11; - t23 += v * b12; - t24 += v * b13; - t25 += v * b14; - t26 += v * b15; - v = a[12]; - t12 += v * b0; - t13 += v * b1; - t14 += v * b2; - t15 += v * b3; - t16 += v * b4; - t17 += v * b5; - t18 += v * b6; - t19 += v * b7; - t20 += v * b8; - t21 += v * b9; - t22 += v * b10; - t23 += v * b11; - t24 += v * b12; - t25 += v * b13; - t26 += v * b14; - t27 += v * b15; - v = a[13]; - t13 += v * b0; - t14 += v * b1; - t15 += v * b2; - t16 += v * b3; - t17 += v * b4; - t18 += v * b5; - t19 += v * b6; - t20 += v * b7; - t21 += v * b8; - t22 += v * b9; - t23 += v * b10; - t24 += v * b11; - t25 += v * b12; - t26 += v * b13; - t27 += v * b14; - t28 += v * b15; - v = a[14]; - t14 += v * b0; - t15 += v * b1; - t16 += v * b2; - t17 += v * b3; - t18 += v * b4; - t19 += v * b5; - t20 += v * b6; - t21 += v * b7; - t22 += v * b8; - t23 += v * b9; - t24 += v * b10; - t25 += v * b11; - t26 += v * b12; - t27 += v * b13; - t28 += v * b14; - t29 += v * b15; - v = a[15]; - t15 += v * b0; - t16 += v * b1; - t17 += v * b2; - t18 += v * b3; - t19 += v * b4; - t20 += v * b5; - t21 += v * b6; - t22 += v * b7; - t23 += v * b8; - t24 += v * b9; - t25 += v * b10; - t26 += v * b11; - t27 += v * b12; - t28 += v * b13; - t29 += v * b14; - t30 += v * b15; - - t0 += 38 * t16; - t1 += 38 * t17; - t2 += 38 * t18; - t3 += 38 * t19; - t4 += 38 * t20; - t5 += 38 * t21; - t6 += 38 * t22; - t7 += 38 * t23; - t8 += 38 * t24; - t9 += 38 * t25; - t10 += 38 * t26; - t11 += 38 * t27; - t12 += 38 * t28; - t13 += 38 * t29; - t14 += 38 * t30; - // t15 left as is - - // first car - c = 1; - v = t0 + c + 65535; c = Math.floor(v / 65536); t0 = v - c * 65536; - v = t1 + c + 65535; c = Math.floor(v / 65536); t1 = v - c * 65536; - v = t2 + c + 65535; c = Math.floor(v / 65536); t2 = v - c * 65536; - v = t3 + c + 65535; c = Math.floor(v / 65536); t3 = v - c * 65536; - v = t4 + c + 65535; c = Math.floor(v / 65536); t4 = v - c * 65536; - v = t5 + c + 65535; c = Math.floor(v / 65536); t5 = v - c * 65536; - v = t6 + c + 65535; c = Math.floor(v / 65536); t6 = v - c * 65536; - v = t7 + c + 65535; c = Math.floor(v / 65536); t7 = v - c * 65536; - v = t8 + c + 65535; c = Math.floor(v / 65536); t8 = v - c * 65536; - v = t9 + c + 65535; c = Math.floor(v / 65536); t9 = v - c * 65536; - v = t10 + c + 65535; c = Math.floor(v / 65536); t10 = v - c * 65536; - v = t11 + c + 65535; c = Math.floor(v / 65536); t11 = v - c * 65536; - v = t12 + c + 65535; c = Math.floor(v / 65536); t12 = v - c * 65536; - v = t13 + c + 65535; c = Math.floor(v / 65536); t13 = v - c * 65536; - v = t14 + c + 65535; c = Math.floor(v / 65536); t14 = v - c * 65536; - v = t15 + c + 65535; c = Math.floor(v / 65536); t15 = v - c * 65536; - t0 += c-1 + 37 * (c-1); - - // second car - c = 1; - v = t0 + c + 65535; c = Math.floor(v / 65536); t0 = v - c * 65536; - v = t1 + c + 65535; c = Math.floor(v / 65536); t1 = v - c * 65536; - v = t2 + c + 65535; c = Math.floor(v / 65536); t2 = v - c * 65536; - v = t3 + c + 65535; c = Math.floor(v / 65536); t3 = v - c * 65536; - v = t4 + c + 65535; c = Math.floor(v / 65536); t4 = v - c * 65536; - v = t5 + c + 65535; c = Math.floor(v / 65536); t5 = v - c * 65536; - v = t6 + c + 65535; c = Math.floor(v / 65536); t6 = v - c * 65536; - v = t7 + c + 65535; c = Math.floor(v / 65536); t7 = v - c * 65536; - v = t8 + c + 65535; c = Math.floor(v / 65536); t8 = v - c * 65536; - v = t9 + c + 65535; c = Math.floor(v / 65536); t9 = v - c * 65536; - v = t10 + c + 65535; c = Math.floor(v / 65536); t10 = v - c * 65536; - v = t11 + c + 65535; c = Math.floor(v / 65536); t11 = v - c * 65536; - v = t12 + c + 65535; c = Math.floor(v / 65536); t12 = v - c * 65536; - v = t13 + c + 65535; c = Math.floor(v / 65536); t13 = v - c * 65536; - v = t14 + c + 65535; c = Math.floor(v / 65536); t14 = v - c * 65536; - v = t15 + c + 65535; c = Math.floor(v / 65536); t15 = v - c * 65536; - t0 += c-1 + 37 * (c-1); - - o[ 0] = t0; - o[ 1] = t1; - o[ 2] = t2; - o[ 3] = t3; - o[ 4] = t4; - o[ 5] = t5; - o[ 6] = t6; - o[ 7] = t7; - o[ 8] = t8; - o[ 9] = t9; - o[10] = t10; - o[11] = t11; - o[12] = t12; - o[13] = t13; - o[14] = t14; - o[15] = t15; - } - - function S(o, a) { - M(o, a, a); - } - - function inv25519(o, i) { - var c = gf(); - var a; - for (a = 0; a < 16; a++) c[a] = i[a]; - for (a = 253; a >= 0; a--) { - S(c, c); - if(a !== 2 && a !== 4) M(c, c, i); - } - for (a = 0; a < 16; a++) o[a] = c[a]; - } - - function pow2523(o, i) { - var c = gf(); - var a; - for (a = 0; a < 16; a++) c[a] = i[a]; - for (a = 250; a >= 0; a--) { - S(c, c); - if(a !== 1) M(c, c, i); - } - for (a = 0; a < 16; a++) o[a] = c[a]; - } - - function crypto_scalarmult(q, n, p) { - var z = new Uint8Array(32); - var x = new Float64Array(80), r, i; - var a = gf(), b = gf(), c = gf(), - d = gf(), e = gf(), f = gf(); - for (i = 0; i < 31; i++) z[i] = n[i]; - z[31]=(n[31]&127)|64; - z[0]&=248; - unpack25519(x,p); - for (i = 0; i < 16; i++) { - b[i]=x[i]; - d[i]=a[i]=c[i]=0; - } - a[0]=d[0]=1; - for (i=254; i>=0; --i) { - r=(z[i>>>3]>>>(i&7))&1; - sel25519(a,b,r); - sel25519(c,d,r); - A(e,a,c); - Z(a,a,c); - A(c,b,d); - Z(b,b,d); - S(d,e); - S(f,a); - M(a,c,a); - M(c,b,e); - A(e,a,c); - Z(a,a,c); - S(b,a); - Z(c,d,f); - M(a,c,_121665); - A(a,a,d); - M(c,c,a); - M(a,d,f); - M(d,b,x); - S(b,e); - sel25519(a,b,r); - sel25519(c,d,r); - } - for (i = 0; i < 16; i++) { - x[i+16]=a[i]; - x[i+32]=c[i]; - x[i+48]=b[i]; - x[i+64]=d[i]; - } - var x32 = x.subarray(32); - var x16 = x.subarray(16); - inv25519(x32,x32); - M(x16,x16,x32); - pack25519(q,x16); - return 0; - } - - function crypto_scalarmult_base(q, n) { - return crypto_scalarmult(q, n, _9); - } - - function crypto_box_keypair(y, x) { - randombytes(x, 32); - return crypto_scalarmult_base(y, x); - } - - function crypto_box_beforenm(k, y, x) { - var s = new Uint8Array(32); - crypto_scalarmult(s, x, y); - return crypto_core_hsalsa20(k, _0, s, sigma); - } - - var crypto_box_afternm = crypto_secretbox; - var crypto_box_open_afternm = crypto_secretbox_open; - - function crypto_box(c, m, d, n, y, x) { - var k = new Uint8Array(32); - crypto_box_beforenm(k, y, x); - return crypto_box_afternm(c, m, d, n, k); - } - - function crypto_box_open(m, c, d, n, y, x) { - var k = new Uint8Array(32); - crypto_box_beforenm(k, y, x); - return crypto_box_open_afternm(m, c, d, n, k); - } - - var K = [ - 0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd, - 0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc, - 0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019, - 0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118, - 0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe, - 0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2, - 0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1, - 0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694, - 0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3, - 0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65, - 0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483, - 0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5, - 0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210, - 0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4, - 0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725, - 0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70, - 0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926, - 0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df, - 0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8, - 0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b, - 0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001, - 0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30, - 0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910, - 0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8, - 0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53, - 0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8, - 0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb, - 0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3, - 0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60, - 0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec, - 0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9, - 0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b, - 0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207, - 0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178, - 0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6, - 0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b, - 0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493, - 0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c, - 0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a, - 0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817 - ]; - - function crypto_hashblocks_hl(hh, hl, m, n) { - var wh = new Int32Array(16), wl = new Int32Array(16), - bh0, bh1, bh2, bh3, bh4, bh5, bh6, bh7, - bl0, bl1, bl2, bl3, bl4, bl5, bl6, bl7, - th, tl, i, j, h, l, a, b, c, d; - - var ah0 = hh[0], - ah1 = hh[1], - ah2 = hh[2], - ah3 = hh[3], - ah4 = hh[4], - ah5 = hh[5], - ah6 = hh[6], - ah7 = hh[7], - - al0 = hl[0], - al1 = hl[1], - al2 = hl[2], - al3 = hl[3], - al4 = hl[4], - al5 = hl[5], - al6 = hl[6], - al7 = hl[7]; - - var pos = 0; - while (n >= 128) { - for (i = 0; i < 16; i++) { - j = 8 * i + pos; - wh[i] = (m[j+0] << 24) | (m[j+1] << 16) | (m[j+2] << 8) | m[j+3]; - wl[i] = (m[j+4] << 24) | (m[j+5] << 16) | (m[j+6] << 8) | m[j+7]; - } - for (i = 0; i < 80; i++) { - bh0 = ah0; - bh1 = ah1; - bh2 = ah2; - bh3 = ah3; - bh4 = ah4; - bh5 = ah5; - bh6 = ah6; - bh7 = ah7; - - bl0 = al0; - bl1 = al1; - bl2 = al2; - bl3 = al3; - bl4 = al4; - bl5 = al5; - bl6 = al6; - bl7 = al7; - - // add - h = ah7; - l = al7; - - a = l & 0xffff; b = l >>> 16; - c = h & 0xffff; d = h >>> 16; - - // Sigma1 - h = ((ah4 >>> 14) | (al4 << (32-14))) ^ ((ah4 >>> 18) | (al4 << (32-18))) ^ ((al4 >>> (41-32)) | (ah4 << (32-(41-32)))); - l = ((al4 >>> 14) | (ah4 << (32-14))) ^ ((al4 >>> 18) | (ah4 << (32-18))) ^ ((ah4 >>> (41-32)) | (al4 << (32-(41-32)))); - - a += l & 0xffff; b += l >>> 16; - c += h & 0xffff; d += h >>> 16; - - // Ch - h = (ah4 & ah5) ^ (~ah4 & ah6); - l = (al4 & al5) ^ (~al4 & al6); - - a += l & 0xffff; b += l >>> 16; - c += h & 0xffff; d += h >>> 16; - - // K - h = K[i*2]; - l = K[i*2+1]; - - a += l & 0xffff; b += l >>> 16; - c += h & 0xffff; d += h >>> 16; - - // w - h = wh[i%16]; - l = wl[i%16]; - - a += l & 0xffff; b += l >>> 16; - c += h & 0xffff; d += h >>> 16; - - b += a >>> 16; - c += b >>> 16; - d += c >>> 16; - - th = c & 0xffff | d << 16; - tl = a & 0xffff | b << 16; - - // add - h = th; - l = tl; - - a = l & 0xffff; b = l >>> 16; - c = h & 0xffff; d = h >>> 16; - - // Sigma0 - h = ((ah0 >>> 28) | (al0 << (32-28))) ^ ((al0 >>> (34-32)) | (ah0 << (32-(34-32)))) ^ ((al0 >>> (39-32)) | (ah0 << (32-(39-32)))); - l = ((al0 >>> 28) | (ah0 << (32-28))) ^ ((ah0 >>> (34-32)) | (al0 << (32-(34-32)))) ^ ((ah0 >>> (39-32)) | (al0 << (32-(39-32)))); - - a += l & 0xffff; b += l >>> 16; - c += h & 0xffff; d += h >>> 16; - - // Maj - h = (ah0 & ah1) ^ (ah0 & ah2) ^ (ah1 & ah2); - l = (al0 & al1) ^ (al0 & al2) ^ (al1 & al2); - - a += l & 0xffff; b += l >>> 16; - c += h & 0xffff; d += h >>> 16; - - b += a >>> 16; - c += b >>> 16; - d += c >>> 16; - - bh7 = (c & 0xffff) | (d << 16); - bl7 = (a & 0xffff) | (b << 16); - - // add - h = bh3; - l = bl3; - - a = l & 0xffff; b = l >>> 16; - c = h & 0xffff; d = h >>> 16; - - h = th; - l = tl; - - a += l & 0xffff; b += l >>> 16; - c += h & 0xffff; d += h >>> 16; - - b += a >>> 16; - c += b >>> 16; - d += c >>> 16; - - bh3 = (c & 0xffff) | (d << 16); - bl3 = (a & 0xffff) | (b << 16); - - ah1 = bh0; - ah2 = bh1; - ah3 = bh2; - ah4 = bh3; - ah5 = bh4; - ah6 = bh5; - ah7 = bh6; - ah0 = bh7; - - al1 = bl0; - al2 = bl1; - al3 = bl2; - al4 = bl3; - al5 = bl4; - al6 = bl5; - al7 = bl6; - al0 = bl7; - - if (i%16 === 15) { - for (j = 0; j < 16; j++) { - // add - h = wh[j]; - l = wl[j]; - - a = l & 0xffff; b = l >>> 16; - c = h & 0xffff; d = h >>> 16; - - h = wh[(j+9)%16]; - l = wl[(j+9)%16]; - - a += l & 0xffff; b += l >>> 16; - c += h & 0xffff; d += h >>> 16; - - // sigma0 - th = wh[(j+1)%16]; - tl = wl[(j+1)%16]; - h = ((th >>> 1) | (tl << (32-1))) ^ ((th >>> 8) | (tl << (32-8))) ^ (th >>> 7); - l = ((tl >>> 1) | (th << (32-1))) ^ ((tl >>> 8) | (th << (32-8))) ^ ((tl >>> 7) | (th << (32-7))); - - a += l & 0xffff; b += l >>> 16; - c += h & 0xffff; d += h >>> 16; - - // sigma1 - th = wh[(j+14)%16]; - tl = wl[(j+14)%16]; - h = ((th >>> 19) | (tl << (32-19))) ^ ((tl >>> (61-32)) | (th << (32-(61-32)))) ^ (th >>> 6); - l = ((tl >>> 19) | (th << (32-19))) ^ ((th >>> (61-32)) | (tl << (32-(61-32)))) ^ ((tl >>> 6) | (th << (32-6))); - - a += l & 0xffff; b += l >>> 16; - c += h & 0xffff; d += h >>> 16; - - b += a >>> 16; - c += b >>> 16; - d += c >>> 16; - - wh[j] = (c & 0xffff) | (d << 16); - wl[j] = (a & 0xffff) | (b << 16); - } - } - } - - // add - h = ah0; - l = al0; - - a = l & 0xffff; b = l >>> 16; - c = h & 0xffff; d = h >>> 16; - - h = hh[0]; - l = hl[0]; - - a += l & 0xffff; b += l >>> 16; - c += h & 0xffff; d += h >>> 16; - - b += a >>> 16; - c += b >>> 16; - d += c >>> 16; - - hh[0] = ah0 = (c & 0xffff) | (d << 16); - hl[0] = al0 = (a & 0xffff) | (b << 16); - - h = ah1; - l = al1; - - a = l & 0xffff; b = l >>> 16; - c = h & 0xffff; d = h >>> 16; - - h = hh[1]; - l = hl[1]; - - a += l & 0xffff; b += l >>> 16; - c += h & 0xffff; d += h >>> 16; - - b += a >>> 16; - c += b >>> 16; - d += c >>> 16; - - hh[1] = ah1 = (c & 0xffff) | (d << 16); - hl[1] = al1 = (a & 0xffff) | (b << 16); - - h = ah2; - l = al2; - - a = l & 0xffff; b = l >>> 16; - c = h & 0xffff; d = h >>> 16; - - h = hh[2]; - l = hl[2]; - - a += l & 0xffff; b += l >>> 16; - c += h & 0xffff; d += h >>> 16; - - b += a >>> 16; - c += b >>> 16; - d += c >>> 16; - - hh[2] = ah2 = (c & 0xffff) | (d << 16); - hl[2] = al2 = (a & 0xffff) | (b << 16); - - h = ah3; - l = al3; - - a = l & 0xffff; b = l >>> 16; - c = h & 0xffff; d = h >>> 16; - - h = hh[3]; - l = hl[3]; - - a += l & 0xffff; b += l >>> 16; - c += h & 0xffff; d += h >>> 16; - - b += a >>> 16; - c += b >>> 16; - d += c >>> 16; - - hh[3] = ah3 = (c & 0xffff) | (d << 16); - hl[3] = al3 = (a & 0xffff) | (b << 16); - - h = ah4; - l = al4; - - a = l & 0xffff; b = l >>> 16; - c = h & 0xffff; d = h >>> 16; - - h = hh[4]; - l = hl[4]; - - a += l & 0xffff; b += l >>> 16; - c += h & 0xffff; d += h >>> 16; - - b += a >>> 16; - c += b >>> 16; - d += c >>> 16; - - hh[4] = ah4 = (c & 0xffff) | (d << 16); - hl[4] = al4 = (a & 0xffff) | (b << 16); - - h = ah5; - l = al5; - - a = l & 0xffff; b = l >>> 16; - c = h & 0xffff; d = h >>> 16; - - h = hh[5]; - l = hl[5]; - - a += l & 0xffff; b += l >>> 16; - c += h & 0xffff; d += h >>> 16; - - b += a >>> 16; - c += b >>> 16; - d += c >>> 16; - - hh[5] = ah5 = (c & 0xffff) | (d << 16); - hl[5] = al5 = (a & 0xffff) | (b << 16); - - h = ah6; - l = al6; - - a = l & 0xffff; b = l >>> 16; - c = h & 0xffff; d = h >>> 16; - - h = hh[6]; - l = hl[6]; - - a += l & 0xffff; b += l >>> 16; - c += h & 0xffff; d += h >>> 16; - - b += a >>> 16; - c += b >>> 16; - d += c >>> 16; - - hh[6] = ah6 = (c & 0xffff) | (d << 16); - hl[6] = al6 = (a & 0xffff) | (b << 16); - - h = ah7; - l = al7; - - a = l & 0xffff; b = l >>> 16; - c = h & 0xffff; d = h >>> 16; - - h = hh[7]; - l = hl[7]; - - a += l & 0xffff; b += l >>> 16; - c += h & 0xffff; d += h >>> 16; - - b += a >>> 16; - c += b >>> 16; - d += c >>> 16; - - hh[7] = ah7 = (c & 0xffff) | (d << 16); - hl[7] = al7 = (a & 0xffff) | (b << 16); - - pos += 128; - n -= 128; - } - - return n; - } - - function crypto_hash(out, m, n) { - var hh = new Int32Array(8), - hl = new Int32Array(8), - x = new Uint8Array(256), - i, b = n; - - hh[0] = 0x6a09e667; - hh[1] = 0xbb67ae85; - hh[2] = 0x3c6ef372; - hh[3] = 0xa54ff53a; - hh[4] = 0x510e527f; - hh[5] = 0x9b05688c; - hh[6] = 0x1f83d9ab; - hh[7] = 0x5be0cd19; - - hl[0] = 0xf3bcc908; - hl[1] = 0x84caa73b; - hl[2] = 0xfe94f82b; - hl[3] = 0x5f1d36f1; - hl[4] = 0xade682d1; - hl[5] = 0x2b3e6c1f; - hl[6] = 0xfb41bd6b; - hl[7] = 0x137e2179; - - crypto_hashblocks_hl(hh, hl, m, n); - n %= 128; - - for (i = 0; i < n; i++) x[i] = m[b-n+i]; - x[n] = 128; - - n = 256-128*(n<112?1:0); - x[n-9] = 0; - ts64(x, n-8, (b / 0x20000000) | 0, b << 3); - crypto_hashblocks_hl(hh, hl, x, n); - - for (i = 0; i < 8; i++) ts64(out, 8*i, hh[i], hl[i]); - - return 0; - } - - function add(p, q) { - var a = gf(), b = gf(), c = gf(), - d = gf(), e = gf(), f = gf(), - g = gf(), h = gf(), t = gf(); - - Z(a, p[1], p[0]); - Z(t, q[1], q[0]); - M(a, a, t); - A(b, p[0], p[1]); - A(t, q[0], q[1]); - M(b, b, t); - M(c, p[3], q[3]); - M(c, c, D2); - M(d, p[2], q[2]); - A(d, d, d); - Z(e, b, a); - Z(f, d, c); - A(g, d, c); - A(h, b, a); - - M(p[0], e, f); - M(p[1], h, g); - M(p[2], g, f); - M(p[3], e, h); - } - - function cswap(p, q, b) { - var i; - for (i = 0; i < 4; i++) { - sel25519(p[i], q[i], b); - } - } - - function pack(r, p) { - var tx = gf(), ty = gf(), zi = gf(); - inv25519(zi, p[2]); - M(tx, p[0], zi); - M(ty, p[1], zi); - pack25519(r, ty); - r[31] ^= par25519(tx) << 7; - } - - function scalarmult(p, q, s) { - var b, i; - set25519(p[0], gf0); - set25519(p[1], gf1); - set25519(p[2], gf1); - set25519(p[3], gf0); - for (i = 255; i >= 0; --i) { - b = (s[(i/8)|0] >> (i&7)) & 1; - cswap(p, q, b); - add(q, p); - add(p, p); - cswap(p, q, b); - } - } - - function scalarbase(p, s) { - var q = [gf(), gf(), gf(), gf()]; - set25519(q[0], X); - set25519(q[1], Y); - set25519(q[2], gf1); - M(q[3], X, Y); - scalarmult(p, q, s); - } - - function crypto_sign_keypair(pk, sk, seeded) { - var d = new Uint8Array(64); - var p = [gf(), gf(), gf(), gf()]; - var i; - - if (!seeded) randombytes(sk, 32); - crypto_hash(d, sk, 32); - d[0] &= 248; - d[31] &= 127; - d[31] |= 64; - - scalarbase(p, d); - pack(pk, p); - - for (i = 0; i < 32; i++) sk[i+32] = pk[i]; - return 0; - } - - var L = new Float64Array([0xed, 0xd3, 0xf5, 0x5c, 0x1a, 0x63, 0x12, 0x58, 0xd6, 0x9c, 0xf7, 0xa2, 0xde, 0xf9, 0xde, 0x14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10]); - - function modL(r, x) { - var carry, i, j, k; - for (i = 63; i >= 32; --i) { - carry = 0; - for (j = i - 32, k = i - 12; j < k; ++j) { - x[j] += carry - 16 * x[i] * L[j - (i - 32)]; - carry = (x[j] + 128) >> 8; - x[j] -= carry * 256; - } - x[j] += carry; - x[i] = 0; - } - carry = 0; - for (j = 0; j < 32; j++) { - x[j] += carry - (x[31] >> 4) * L[j]; - carry = x[j] >> 8; - x[j] &= 255; - } - for (j = 0; j < 32; j++) x[j] -= carry * L[j]; - for (i = 0; i < 32; i++) { - x[i+1] += x[i] >> 8; - r[i] = x[i] & 255; - } - } - - function reduce(r) { - var x = new Float64Array(64), i; - for (i = 0; i < 64; i++) x[i] = r[i]; - for (i = 0; i < 64; i++) r[i] = 0; - modL(r, x); - } - - // Note: difference from C - smlen returned, not passed as argument. - function crypto_sign(sm, m, n, sk) { - var d = new Uint8Array(64), h = new Uint8Array(64), r = new Uint8Array(64); - var i, j, x = new Float64Array(64); - var p = [gf(), gf(), gf(), gf()]; - - crypto_hash(d, sk, 32); - d[0] &= 248; - d[31] &= 127; - d[31] |= 64; - - var smlen = n + 64; - for (i = 0; i < n; i++) sm[64 + i] = m[i]; - for (i = 0; i < 32; i++) sm[32 + i] = d[32 + i]; - - crypto_hash(r, sm.subarray(32), n+32); - reduce(r); - scalarbase(p, r); - pack(sm, p); - - for (i = 32; i < 64; i++) sm[i] = sk[i]; - crypto_hash(h, sm, n + 64); - reduce(h); - - for (i = 0; i < 64; i++) x[i] = 0; - for (i = 0; i < 32; i++) x[i] = r[i]; - for (i = 0; i < 32; i++) { - for (j = 0; j < 32; j++) { - x[i+j] += h[i] * d[j]; - } - } - - modL(sm.subarray(32), x); - return smlen; - } - - function unpackneg(r, p) { - var t = gf(), chk = gf(), num = gf(), - den = gf(), den2 = gf(), den4 = gf(), - den6 = gf(); - - set25519(r[2], gf1); - unpack25519(r[1], p); - S(num, r[1]); - M(den, num, D); - Z(num, num, r[2]); - A(den, r[2], den); - - S(den2, den); - S(den4, den2); - M(den6, den4, den2); - M(t, den6, num); - M(t, t, den); - - pow2523(t, t); - M(t, t, num); - M(t, t, den); - M(t, t, den); - M(r[0], t, den); - - S(chk, r[0]); - M(chk, chk, den); - if (neq25519(chk, num)) M(r[0], r[0], I); - - S(chk, r[0]); - M(chk, chk, den); - if (neq25519(chk, num)) return -1; - - if (par25519(r[0]) === (p[31]>>7)) Z(r[0], gf0, r[0]); - - M(r[3], r[0], r[1]); - return 0; - } - - function crypto_sign_open(m, sm, n, pk) { - var i, mlen; - var t = new Uint8Array(32), h = new Uint8Array(64); - var p = [gf(), gf(), gf(), gf()], - q = [gf(), gf(), gf(), gf()]; - - mlen = -1; - if (n < 64) return -1; - - if (unpackneg(q, pk)) return -1; - - for (i = 0; i < n; i++) m[i] = sm[i]; - for (i = 0; i < 32; i++) m[i+32] = pk[i]; - crypto_hash(h, m, n); - reduce(h); - scalarmult(p, q, h); - - scalarbase(q, sm.subarray(32)); - add(p, q); - pack(t, p); - - n -= 64; - if (crypto_verify_32(sm, 0, t, 0)) { - for (i = 0; i < n; i++) m[i] = 0; - return -1; - } - - for (i = 0; i < n; i++) m[i] = sm[i + 64]; - mlen = n; - return mlen; - } - - var crypto_secretbox_KEYBYTES = 32, - crypto_secretbox_NONCEBYTES = 24, - crypto_secretbox_ZEROBYTES = 32, - crypto_secretbox_BOXZEROBYTES = 16, - crypto_scalarmult_BYTES = 32, - crypto_scalarmult_SCALARBYTES = 32, - crypto_box_PUBLICKEYBYTES = 32, - crypto_box_SECRETKEYBYTES = 32, - crypto_box_BEFORENMBYTES = 32, - crypto_box_NONCEBYTES = crypto_secretbox_NONCEBYTES, - crypto_box_ZEROBYTES = crypto_secretbox_ZEROBYTES, - crypto_box_BOXZEROBYTES = crypto_secretbox_BOXZEROBYTES, - crypto_sign_BYTES = 64, - crypto_sign_PUBLICKEYBYTES = 32, - crypto_sign_SECRETKEYBYTES = 64, - crypto_sign_SEEDBYTES = 32, - crypto_hash_BYTES = 64; - - nacl.lowlevel = { - crypto_core_hsalsa20: crypto_core_hsalsa20, - crypto_stream_xor: crypto_stream_xor, - crypto_stream: crypto_stream, - crypto_stream_salsa20_xor: crypto_stream_salsa20_xor, - crypto_stream_salsa20: crypto_stream_salsa20, - crypto_onetimeauth: crypto_onetimeauth, - crypto_onetimeauth_verify: crypto_onetimeauth_verify, - crypto_verify_16: crypto_verify_16, - crypto_verify_32: crypto_verify_32, - crypto_secretbox: crypto_secretbox, - crypto_secretbox_open: crypto_secretbox_open, - crypto_scalarmult: crypto_scalarmult, - crypto_scalarmult_base: crypto_scalarmult_base, - crypto_box_beforenm: crypto_box_beforenm, - crypto_box_afternm: crypto_box_afternm, - crypto_box: crypto_box, - crypto_box_open: crypto_box_open, - crypto_box_keypair: crypto_box_keypair, - crypto_hash: crypto_hash, - crypto_sign: crypto_sign, - crypto_sign_keypair: crypto_sign_keypair, - crypto_sign_open: crypto_sign_open, - - crypto_secretbox_KEYBYTES: crypto_secretbox_KEYBYTES, - crypto_secretbox_NONCEBYTES: crypto_secretbox_NONCEBYTES, - crypto_secretbox_ZEROBYTES: crypto_secretbox_ZEROBYTES, - crypto_secretbox_BOXZEROBYTES: crypto_secretbox_BOXZEROBYTES, - crypto_scalarmult_BYTES: crypto_scalarmult_BYTES, - crypto_scalarmult_SCALARBYTES: crypto_scalarmult_SCALARBYTES, - crypto_box_PUBLICKEYBYTES: crypto_box_PUBLICKEYBYTES, - crypto_box_SECRETKEYBYTES: crypto_box_SECRETKEYBYTES, - crypto_box_BEFORENMBYTES: crypto_box_BEFORENMBYTES, - crypto_box_NONCEBYTES: crypto_box_NONCEBYTES, - crypto_box_ZEROBYTES: crypto_box_ZEROBYTES, - crypto_box_BOXZEROBYTES: crypto_box_BOXZEROBYTES, - crypto_sign_BYTES: crypto_sign_BYTES, - crypto_sign_PUBLICKEYBYTES: crypto_sign_PUBLICKEYBYTES, - crypto_sign_SECRETKEYBYTES: crypto_sign_SECRETKEYBYTES, - crypto_sign_SEEDBYTES: crypto_sign_SEEDBYTES, - crypto_hash_BYTES: crypto_hash_BYTES - }; - - /* High-level API */ - - function checkLengths(k, n) { - if (k.length !== crypto_secretbox_KEYBYTES) throw new Error('bad key size'); - if (n.length !== crypto_secretbox_NONCEBYTES) throw new Error('bad nonce size'); - } - - function checkBoxLengths(pk, sk) { - if (pk.length !== crypto_box_PUBLICKEYBYTES) throw new Error('bad public key size'); - if (sk.length !== crypto_box_SECRETKEYBYTES) throw new Error('bad secret key size'); - } - - function checkArrayTypes() { - var t, i; - for (i = 0; i < arguments.length; i++) { - if ((t = Object.prototype.toString.call(arguments[i])) !== '[object Uint8Array]') - throw new TypeError('unexpected type ' + t + ', use Uint8Array'); - } - } - - function cleanup(arr) { - for (var i = 0; i < arr.length; i++) arr[i] = 0; - } - - // TODO: Completely remove this in v0.15. - if (!nacl.util) { - nacl.util = {}; - nacl.util.decodeUTF8 = nacl.util.encodeUTF8 = nacl.util.encodeBase64 = nacl.util.decodeBase64 = function() { - throw new Error('nacl.util moved into separate package: https://github.com/dchest/tweetnacl-util-js'); - }; - } - - nacl.randomBytes = function(n) { - var b = new Uint8Array(n); - randombytes(b, n); - return b; - }; - - nacl.secretbox = function(msg, nonce, key) { - checkArrayTypes(msg, nonce, key); - checkLengths(key, nonce); - var m = new Uint8Array(crypto_secretbox_ZEROBYTES + msg.length); - var c = new Uint8Array(m.length); - for (var i = 0; i < msg.length; i++) m[i+crypto_secretbox_ZEROBYTES] = msg[i]; - crypto_secretbox(c, m, m.length, nonce, key); - return c.subarray(crypto_secretbox_BOXZEROBYTES); - }; - - nacl.secretbox.open = function(box, nonce, key) { - checkArrayTypes(box, nonce, key); - checkLengths(key, nonce); - var c = new Uint8Array(crypto_secretbox_BOXZEROBYTES + box.length); - var m = new Uint8Array(c.length); - for (var i = 0; i < box.length; i++) c[i+crypto_secretbox_BOXZEROBYTES] = box[i]; - if (c.length < 32) return false; - if (crypto_secretbox_open(m, c, c.length, nonce, key) !== 0) return false; - return m.subarray(crypto_secretbox_ZEROBYTES); - }; - - nacl.secretbox.keyLength = crypto_secretbox_KEYBYTES; - nacl.secretbox.nonceLength = crypto_secretbox_NONCEBYTES; - nacl.secretbox.overheadLength = crypto_secretbox_BOXZEROBYTES; - - nacl.scalarMult = function(n, p) { - checkArrayTypes(n, p); - if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error('bad n size'); - if (p.length !== crypto_scalarmult_BYTES) throw new Error('bad p size'); - var q = new Uint8Array(crypto_scalarmult_BYTES); - crypto_scalarmult(q, n, p); - return q; - }; - - nacl.scalarMult.base = function(n) { - checkArrayTypes(n); - if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error('bad n size'); - var q = new Uint8Array(crypto_scalarmult_BYTES); - crypto_scalarmult_base(q, n); - return q; - }; - - nacl.scalarMult.scalarLength = crypto_scalarmult_SCALARBYTES; - nacl.scalarMult.groupElementLength = crypto_scalarmult_BYTES; - - nacl.box = function(msg, nonce, publicKey, secretKey) { - var k = nacl.box.before(publicKey, secretKey); - return nacl.secretbox(msg, nonce, k); - }; - - nacl.box.before = function(publicKey, secretKey) { - checkArrayTypes(publicKey, secretKey); - checkBoxLengths(publicKey, secretKey); - var k = new Uint8Array(crypto_box_BEFORENMBYTES); - crypto_box_beforenm(k, publicKey, secretKey); - return k; - }; - - nacl.box.after = nacl.secretbox; - - nacl.box.open = function(msg, nonce, publicKey, secretKey) { - var k = nacl.box.before(publicKey, secretKey); - return nacl.secretbox.open(msg, nonce, k); - }; - - nacl.box.open.after = nacl.secretbox.open; - - nacl.box.keyPair = function() { - var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES); - var sk = new Uint8Array(crypto_box_SECRETKEYBYTES); - crypto_box_keypair(pk, sk); - return {publicKey: pk, secretKey: sk}; - }; - - nacl.box.keyPair.fromSecretKey = function(secretKey) { - checkArrayTypes(secretKey); - if (secretKey.length !== crypto_box_SECRETKEYBYTES) - throw new Error('bad secret key size'); - var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES); - crypto_scalarmult_base(pk, secretKey); - return {publicKey: pk, secretKey: new Uint8Array(secretKey)}; - }; - - nacl.box.publicKeyLength = crypto_box_PUBLICKEYBYTES; - nacl.box.secretKeyLength = crypto_box_SECRETKEYBYTES; - nacl.box.sharedKeyLength = crypto_box_BEFORENMBYTES; - nacl.box.nonceLength = crypto_box_NONCEBYTES; - nacl.box.overheadLength = nacl.secretbox.overheadLength; - - nacl.sign = function(msg, secretKey) { - checkArrayTypes(msg, secretKey); - if (secretKey.length !== crypto_sign_SECRETKEYBYTES) - throw new Error('bad secret key size'); - var signedMsg = new Uint8Array(crypto_sign_BYTES+msg.length); - crypto_sign(signedMsg, msg, msg.length, secretKey); - return signedMsg; - }; - - nacl.sign.open = function(signedMsg, publicKey) { - if (arguments.length !== 2) - throw new Error('nacl.sign.open accepts 2 arguments; did you mean to use nacl.sign.detached.verify?'); - checkArrayTypes(signedMsg, publicKey); - if (publicKey.length !== crypto_sign_PUBLICKEYBYTES) - throw new Error('bad public key size'); - var tmp = new Uint8Array(signedMsg.length); - var mlen = crypto_sign_open(tmp, signedMsg, signedMsg.length, publicKey); - if (mlen < 0) return null; - var m = new Uint8Array(mlen); - for (var i = 0; i < m.length; i++) m[i] = tmp[i]; - return m; - }; - - nacl.sign.detached = function(msg, secretKey) { - var signedMsg = nacl.sign(msg, secretKey); - var sig = new Uint8Array(crypto_sign_BYTES); - for (var i = 0; i < sig.length; i++) sig[i] = signedMsg[i]; - return sig; - }; - - nacl.sign.detached.verify = function(msg, sig, publicKey) { - checkArrayTypes(msg, sig, publicKey); - if (sig.length !== crypto_sign_BYTES) - throw new Error('bad signature size'); - if (publicKey.length !== crypto_sign_PUBLICKEYBYTES) - throw new Error('bad public key size'); - var sm = new Uint8Array(crypto_sign_BYTES + msg.length); - var m = new Uint8Array(crypto_sign_BYTES + msg.length); - var i; - for (i = 0; i < crypto_sign_BYTES; i++) sm[i] = sig[i]; - for (i = 0; i < msg.length; i++) sm[i+crypto_sign_BYTES] = msg[i]; - return (crypto_sign_open(m, sm, sm.length, publicKey) >= 0); - }; - - nacl.sign.keyPair = function() { - var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES); - var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES); - crypto_sign_keypair(pk, sk); - return {publicKey: pk, secretKey: sk}; - }; - - nacl.sign.keyPair.fromSecretKey = function(secretKey) { - checkArrayTypes(secretKey); - if (secretKey.length !== crypto_sign_SECRETKEYBYTES) - throw new Error('bad secret key size'); - var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES); - for (var i = 0; i < pk.length; i++) pk[i] = secretKey[32+i]; - return {publicKey: pk, secretKey: new Uint8Array(secretKey)}; - }; - - nacl.sign.keyPair.fromSeed = function(seed) { - checkArrayTypes(seed); - if (seed.length !== crypto_sign_SEEDBYTES) - throw new Error('bad seed size'); - var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES); - var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES); - for (var i = 0; i < 32; i++) sk[i] = seed[i]; - crypto_sign_keypair(pk, sk, true); - return {publicKey: pk, secretKey: sk}; - }; - - nacl.sign.publicKeyLength = crypto_sign_PUBLICKEYBYTES; - nacl.sign.secretKeyLength = crypto_sign_SECRETKEYBYTES; - nacl.sign.seedLength = crypto_sign_SEEDBYTES; - nacl.sign.signatureLength = crypto_sign_BYTES; - - nacl.hash = function(msg) { - checkArrayTypes(msg); - var h = new Uint8Array(crypto_hash_BYTES); - crypto_hash(h, msg, msg.length); - return h; - }; - - nacl.hash.hashLength = crypto_hash_BYTES; - - nacl.verify = function(x, y) { - checkArrayTypes(x, y); - // Zero length arguments are considered not equal. - if (x.length === 0 || y.length === 0) return false; - if (x.length !== y.length) return false; - return (vn(x, 0, y, 0, x.length) === 0) ? true : false; - }; - - nacl.setPRNG = function(fn) { - randombytes = fn; - }; - - (function() { - // Initialize PRNG if environment provides CSPRNG. - // If not, methods calling randombytes will throw. - var crypto = typeof self !== 'undefined' ? (self.crypto || self.msCrypto) : null; - if (crypto && crypto.getRandomValues) { - // Browsers. - var QUOTA = 65536; - nacl.setPRNG(function(x, n) { - var i, v = new Uint8Array(n); - for (i = 0; i < n; i += QUOTA) { - crypto.getRandomValues(v.subarray(i, i + Math.min(n - i, QUOTA))); - } - for (i = 0; i < n; i++) x[i] = v[i]; - cleanup(v); - }); - } else if (true) { - // Node.js. - crypto = __webpack_require__(173); - if (crypto && crypto.randomBytes) { - nacl.setPRNG(function(x, n) { - var i, v = crypto.randomBytes(n); - for (i = 0; i < n; i++) x[i] = v[i]; - cleanup(v); - }); - } - } - })(); - - })(typeof module !== 'undefined' && module.exports ? module.exports : (self.nacl = self.nacl || {})); +function DES(options) { + Cipher.call(this, options); + + var state = new DESState(); + this._desState = state; + + this.deriveKeys(state, options.key); +} +inherits(DES, Cipher); +module.exports = DES; + +DES.create = function create(options) { + return new DES(options); +}; + +var shiftTable = [ + 1, 1, 2, 2, 2, 2, 2, 2, + 1, 2, 2, 2, 2, 2, 2, 1 +]; + +DES.prototype.deriveKeys = function deriveKeys(state, key) { + state.keys = new Array(16 * 2); + + assert.equal(key.length, this.blockSize, 'Invalid key length'); + + var kL = utils.readUInt32BE(key, 0); + var kR = utils.readUInt32BE(key, 4); + + utils.pc1(kL, kR, state.tmp, 0); + kL = state.tmp[0]; + kR = state.tmp[1]; + for (var i = 0; i < state.keys.length; i += 2) { + var shift = shiftTable[i >>> 1]; + kL = utils.r28shl(kL, shift); + kR = utils.r28shl(kR, shift); + utils.pc2(kL, kR, state.keys, i); + } +}; + +DES.prototype._update = function _update(inp, inOff, out, outOff) { + var state = this._desState; + + var l = utils.readUInt32BE(inp, inOff); + var r = utils.readUInt32BE(inp, inOff + 4); + + // Initial Permutation + utils.ip(l, r, state.tmp, 0); + l = state.tmp[0]; + r = state.tmp[1]; + + if (this.type === 'encrypt') + this._encrypt(state, l, r, state.tmp, 0); + else + this._decrypt(state, l, r, state.tmp, 0); + + l = state.tmp[0]; + r = state.tmp[1]; + + utils.writeUInt32BE(out, l, outOff); + utils.writeUInt32BE(out, r, outOff + 4); +}; + +DES.prototype._pad = function _pad(buffer, off) { + var value = buffer.length - off; + for (var i = off; i < buffer.length; i++) + buffer[i] = value; + + return true; +}; + +DES.prototype._unpad = function _unpad(buffer) { + var pad = buffer[buffer.length - 1]; + for (var i = buffer.length - pad; i < buffer.length; i++) + assert.equal(buffer[i], pad); + + return buffer.slice(0, buffer.length - pad); +}; + +DES.prototype._encrypt = function _encrypt(state, lStart, rStart, out, off) { + var l = lStart; + var r = rStart; + + // Apply f() x16 times + for (var i = 0; i < state.keys.length; i += 2) { + var keyL = state.keys[i]; + var keyR = state.keys[i + 1]; + + // f(r, k) + utils.expand(r, state.tmp, 0); + + keyL ^= state.tmp[0]; + keyR ^= state.tmp[1]; + var s = utils.substitute(keyL, keyR); + var f = utils.permute(s); + + var t = r; + r = (l ^ f) >>> 0; + l = t; + } + + // Reverse Initial Permutation + utils.rip(r, l, out, off); +}; + +DES.prototype._decrypt = function _decrypt(state, lStart, rStart, out, off) { + var l = rStart; + var r = lStart; + + // Apply f() x16 times + for (var i = state.keys.length - 2; i >= 0; i -= 2) { + var keyL = state.keys[i]; + var keyR = state.keys[i + 1]; + + // f(r, k) + utils.expand(l, state.tmp, 0); + + keyL ^= state.tmp[0]; + keyR ^= state.tmp[1]; + var s = utils.substitute(keyL, keyR); + var f = utils.permute(s); + + var t = l; + l = (r ^ f) >>> 0; + r = t; + } + + // Reverse Initial Permutation + utils.rip(l, r, out, off); +}; /***/ }, /* 173 */ -/***/ function(module, exports) { +/***/ function(module, exports, __webpack_require__) { + +"use strict"; +'use strict'; + +var assert = __webpack_require__(26); +var inherits = __webpack_require__(1); + +var des = __webpack_require__(51); +var Cipher = des.Cipher; +var DES = des.DES; + +function EDEState(type, key) { + assert.equal(key.length, 24, 'Invalid key length'); + + var k1 = key.slice(0, 8); + var k2 = key.slice(8, 16); + var k3 = key.slice(16, 24); + + if (type === 'encrypt') { + this.ciphers = [ + DES.create({ type: 'encrypt', key: k1 }), + DES.create({ type: 'decrypt', key: k2 }), + DES.create({ type: 'encrypt', key: k3 }) + ]; + } else { + this.ciphers = [ + DES.create({ type: 'decrypt', key: k3 }), + DES.create({ type: 'encrypt', key: k2 }), + DES.create({ type: 'decrypt', key: k1 }) + ]; + } +} + +function EDE(options) { + Cipher.call(this, options); + + var state = new EDEState(this.type, this.options.key); + this._edeState = state; +} +inherits(EDE, Cipher); + +module.exports = EDE; + +EDE.create = function create(options) { + return new EDE(options); +}; + +EDE.prototype._update = function _update(inp, inOff, out, outOff) { + var state = this._edeState; + + state.ciphers[0]._update(inp, inOff, out, outOff); + state.ciphers[1]._update(out, outOff, out, outOff); + state.ciphers[2]._update(out, outOff, out, outOff); +}; + +EDE.prototype._pad = DES.prototype._pad; +EDE.prototype._unpad = DES.prototype._unpad; - /* (ignored) */ /***/ }, /* 174 */ -/***/ function(module, exports, __webpack_require__) { +/***/ function(module, exports) { - /* WEBPACK VAR INJECTION */(function(Buffer) {const EventEmitter = __webpack_require__(3).EventEmitter; - const NaCl = __webpack_require__(172); - const Readable = __webpack_require__(175); +"use strict"; +'use strict'; - const nonce = new Buffer(24); - nonce.fill(0); +exports.readUInt32BE = function readUInt32BE(bytes, off) { + var res = (bytes[0 + off] << 24) | + (bytes[1 + off] << 16) | + (bytes[2 + off] << 8) | + bytes[3 + off]; + return res >>> 0; +}; - /** - * Receives voice data from a voice connection. - * ```js - * // obtained using: - * voiceChannel.join().then(connection => { - * const receiver = connection.createReceiver(); - * }); - * ``` - * @extends {EventEmitter} - */ - class VoiceReceiver extends EventEmitter { - constructor(connection) { - super(); - /* - need a queue because we don't get the ssrc of the user speaking until after the first few packets, - so we queue up unknown SSRCs until they become known, then empty the queue. - */ - this.queues = new Map(); - this.pcmStreams = new Map(); - this.opusStreams = new Map(); +exports.writeUInt32BE = function writeUInt32BE(bytes, value, off) { + bytes[0 + off] = value >>> 24; + bytes[1 + off] = (value >>> 16) & 0xff; + bytes[2 + off] = (value >>> 8) & 0xff; + bytes[3 + off] = value & 0xff; +}; - /** - * Whether or not this receiver has been destroyed. - * @type {boolean} - */ - this.destroyed = false; +exports.ip = function ip(inL, inR, out, off) { + var outL = 0; + var outR = 0; - /** - * The VoiceConnection that instantiated this - * @type {VoiceConnection} - */ - this.voiceConnection = connection; + for (var i = 6; i >= 0; i -= 2) { + for (var j = 0; j <= 24; j += 8) { + outL <<= 1; + outL |= (inR >>> (j + i)) & 1; + } + for (var j = 0; j <= 24; j += 8) { + outL <<= 1; + outL |= (inL >>> (j + i)) & 1; + } + } - this._listener = msg => { - const ssrc = +msg.readUInt32BE(8).toString(10); - const user = this.voiceConnection.ssrcMap.get(ssrc); - if (!user) { - if (!this.queues.has(ssrc)) this.queues.set(ssrc, []); - this.queues.get(ssrc).push(msg); - } else { - if (this.queues.get(ssrc)) { - this.queues.get(ssrc).push(msg); - this.queues.get(ssrc).map(m => this.handlePacket(m, user)); - this.queues.delete(ssrc); - return; - } - this.handlePacket(msg, user); - } - }; - this.voiceConnection.sockets.udp.socket.on('message', this._listener); - } + for (var i = 6; i >= 0; i -= 2) { + for (var j = 1; j <= 25; j += 8) { + outR <<= 1; + outR |= (inR >>> (j + i)) & 1; + } + for (var j = 1; j <= 25; j += 8) { + outR <<= 1; + outR |= (inL >>> (j + i)) & 1; + } + } - /** - * If this VoiceReceiver has been destroyed, running `recreate()` will recreate the listener. - * This avoids you having to create a new receiver. - * Any streams that you had prior to destroying the receiver will not be recreated. - */ - recreate() { - if (!this.destroyed) return; - this.voiceConnection.sockets.udp.socket.on('message', this._listener); - this.destroyed = false; - return; - } + out[off + 0] = outL >>> 0; + out[off + 1] = outR >>> 0; +}; - /** - * Destroy this VoiceReceiver, also ending any streams that it may be controlling. - */ - destroy() { - this.voiceConnection.sockets.udp.socket.removeListener('message', this._listener); - for (const stream of this.pcmStreams) { - stream[1]._push(null); - this.pcmStreams.delete(stream[0]); - } - for (const stream of this.opusStreams) { - stream[1]._push(null); - this.opusStreams.delete(stream[0]); - } - this.destroyed = true; - } +exports.rip = function rip(inL, inR, out, off) { + var outL = 0; + var outR = 0; - /** - * Creates a readable stream for a user that provides opus data while the user is speaking. When the user - * stops speaking, the stream is destroyed. - * @param {UserResolvable} user The user to create the stream for - * @returns {ReadableStream} - */ - createOpusStream(user) { - user = this.voiceConnection.voiceManager.client.resolver.resolveUser(user); - if (!user) throw new Error('Couldn\'t resolve the user to create Opus stream.'); - if (this.opusStreams.get(user.id)) throw new Error('There is already an existing stream for that user.'); - const stream = new Readable(); - this.opusStreams.set(user.id, stream); - return stream; - } + for (var i = 0; i < 4; i++) { + for (var j = 24; j >= 0; j -= 8) { + outL <<= 1; + outL |= (inR >>> (j + i)) & 1; + outL <<= 1; + outL |= (inL >>> (j + i)) & 1; + } + } + for (var i = 4; i < 8; i++) { + for (var j = 24; j >= 0; j -= 8) { + outR <<= 1; + outR |= (inR >>> (j + i)) & 1; + outR <<= 1; + outR |= (inL >>> (j + i)) & 1; + } + } - /** - * Creates a readable stream for a user that provides PCM data while the user is speaking. When the user - * stops speaking, the stream is destroyed. The stream is 32-bit signed stereo PCM at 48KHz. - * @param {UserResolvable} user The user to create the stream for - * @returns {ReadableStream} - */ - createPCMStream(user) { - user = this.voiceConnection.voiceManager.client.resolver.resolveUser(user); - if (!user) throw new Error('Couldn\'t resolve the user to create PCM stream.'); - if (this.pcmStreams.get(user.id)) throw new Error('There is already an existing stream for that user.'); - const stream = new Readable(); - this.pcmStreams.set(user.id, stream); - return stream; - } + out[off + 0] = outL >>> 0; + out[off + 1] = outR >>> 0; +}; - handlePacket(msg, user) { - msg.copy(nonce, 0, 0, 12); - let data = NaCl.secretbox.open(msg.slice(12), nonce, this.voiceConnection.authentication.secretKey.key); - if (!data) { - /** - * Emitted whenever a voice packet cannot be decrypted - * @event VoiceReceiver#warn - * @param {string} message The warning message - */ - this.emit('warn', 'Failed to decrypt voice packet'); - return; - } - data = new Buffer(data); - if (this.opusStreams.get(user.id)) this.opusStreams.get(user.id)._push(data); - /** - * Emitted whenever voice data is received from the voice connection. This is _always_ emitted (unlike PCM). - * @event VoiceReceiver#opus - * @param {User} user The user that is sending the buffer (is speaking) - * @param {Buffer} buffer The opus buffer - */ - this.emit('opus', user, data); - if (this.listenerCount('pcm') > 0 || this.pcmStreams.size > 0) { - /** - * Emits decoded voice data when it's received. For performance reasons, the decoding will only - * happen if there is at least one `pcm` listener on this receiver. - * @event VoiceReceiver#pcm - * @param {User} user The user that is sending the buffer (is speaking) - * @param {Buffer} buffer The decoded buffer - */ - const pcm = this.voiceConnection.player.opusEncoder.decode(data); - if (this.pcmStreams.get(user.id)) this.pcmStreams.get(user.id)._push(pcm); - this.emit('pcm', user, pcm); - } - } - } +exports.pc1 = function pc1(inL, inR, out, off) { + var outL = 0; + var outR = 0; - module.exports = VoiceReceiver; + // 7, 15, 23, 31, 39, 47, 55, 63 + // 6, 14, 22, 30, 39, 47, 55, 63 + // 5, 13, 21, 29, 39, 47, 55, 63 + // 4, 12, 20, 28 + for (var i = 7; i >= 5; i--) { + for (var j = 0; j <= 24; j += 8) { + outL <<= 1; + outL |= (inR >> (j + i)) & 1; + } + for (var j = 0; j <= 24; j += 8) { + outL <<= 1; + outL |= (inL >> (j + i)) & 1; + } + } + for (var j = 0; j <= 24; j += 8) { + outL <<= 1; + outL |= (inR >> (j + i)) & 1; + } + + // 1, 9, 17, 25, 33, 41, 49, 57 + // 2, 10, 18, 26, 34, 42, 50, 58 + // 3, 11, 19, 27, 35, 43, 51, 59 + // 36, 44, 52, 60 + for (var i = 1; i <= 3; i++) { + for (var j = 0; j <= 24; j += 8) { + outR <<= 1; + outR |= (inR >> (j + i)) & 1; + } + for (var j = 0; j <= 24; j += 8) { + outR <<= 1; + outR |= (inL >> (j + i)) & 1; + } + } + for (var j = 0; j <= 24; j += 8) { + outR <<= 1; + outR |= (inL >> (j + i)) & 1; + } + + out[off + 0] = outL >>> 0; + out[off + 1] = outR >>> 0; +}; + +exports.r28shl = function r28shl(num, shift) { + return ((num << shift) & 0xfffffff) | (num >>> (28 - shift)); +}; + +var pc2table = [ + // inL => outL + 14, 11, 17, 4, 27, 23, 25, 0, + 13, 22, 7, 18, 5, 9, 16, 24, + 2, 20, 12, 21, 1, 8, 15, 26, + + // inR => outR + 15, 4, 25, 19, 9, 1, 26, 16, + 5, 11, 23, 8, 12, 7, 17, 0, + 22, 3, 10, 14, 6, 20, 27, 24 +]; + +exports.pc2 = function pc2(inL, inR, out, off) { + var outL = 0; + var outR = 0; + + var len = pc2table.length >>> 1; + for (var i = 0; i < len; i++) { + outL <<= 1; + outL |= (inL >>> pc2table[i]) & 0x1; + } + for (var i = len; i < pc2table.length; i++) { + outR <<= 1; + outR |= (inR >>> pc2table[i]) & 0x1; + } + + out[off + 0] = outL >>> 0; + out[off + 1] = outR >>> 0; +}; + +exports.expand = function expand(r, out, off) { + var outL = 0; + var outR = 0; + + outL = ((r & 1) << 5) | (r >>> 27); + for (var i = 23; i >= 15; i -= 4) { + outL <<= 6; + outL |= (r >>> i) & 0x3f; + } + for (var i = 11; i >= 3; i -= 4) { + outR |= (r >>> i) & 0x3f; + outR <<= 6; + } + outR |= ((r & 0x1f) << 1) | (r >>> 31); + + out[off + 0] = outL >>> 0; + out[off + 1] = outR >>> 0; +}; + +var sTable = [ + 14, 0, 4, 15, 13, 7, 1, 4, 2, 14, 15, 2, 11, 13, 8, 1, + 3, 10, 10, 6, 6, 12, 12, 11, 5, 9, 9, 5, 0, 3, 7, 8, + 4, 15, 1, 12, 14, 8, 8, 2, 13, 4, 6, 9, 2, 1, 11, 7, + 15, 5, 12, 11, 9, 3, 7, 14, 3, 10, 10, 0, 5, 6, 0, 13, + + 15, 3, 1, 13, 8, 4, 14, 7, 6, 15, 11, 2, 3, 8, 4, 14, + 9, 12, 7, 0, 2, 1, 13, 10, 12, 6, 0, 9, 5, 11, 10, 5, + 0, 13, 14, 8, 7, 10, 11, 1, 10, 3, 4, 15, 13, 4, 1, 2, + 5, 11, 8, 6, 12, 7, 6, 12, 9, 0, 3, 5, 2, 14, 15, 9, + + 10, 13, 0, 7, 9, 0, 14, 9, 6, 3, 3, 4, 15, 6, 5, 10, + 1, 2, 13, 8, 12, 5, 7, 14, 11, 12, 4, 11, 2, 15, 8, 1, + 13, 1, 6, 10, 4, 13, 9, 0, 8, 6, 15, 9, 3, 8, 0, 7, + 11, 4, 1, 15, 2, 14, 12, 3, 5, 11, 10, 5, 14, 2, 7, 12, + + 7, 13, 13, 8, 14, 11, 3, 5, 0, 6, 6, 15, 9, 0, 10, 3, + 1, 4, 2, 7, 8, 2, 5, 12, 11, 1, 12, 10, 4, 14, 15, 9, + 10, 3, 6, 15, 9, 0, 0, 6, 12, 10, 11, 1, 7, 13, 13, 8, + 15, 9, 1, 4, 3, 5, 14, 11, 5, 12, 2, 7, 8, 2, 4, 14, + + 2, 14, 12, 11, 4, 2, 1, 12, 7, 4, 10, 7, 11, 13, 6, 1, + 8, 5, 5, 0, 3, 15, 15, 10, 13, 3, 0, 9, 14, 8, 9, 6, + 4, 11, 2, 8, 1, 12, 11, 7, 10, 1, 13, 14, 7, 2, 8, 13, + 15, 6, 9, 15, 12, 0, 5, 9, 6, 10, 3, 4, 0, 5, 14, 3, + + 12, 10, 1, 15, 10, 4, 15, 2, 9, 7, 2, 12, 6, 9, 8, 5, + 0, 6, 13, 1, 3, 13, 4, 14, 14, 0, 7, 11, 5, 3, 11, 8, + 9, 4, 14, 3, 15, 2, 5, 12, 2, 9, 8, 5, 12, 15, 3, 10, + 7, 11, 0, 14, 4, 1, 10, 7, 1, 6, 13, 0, 11, 8, 6, 13, + + 4, 13, 11, 0, 2, 11, 14, 7, 15, 4, 0, 9, 8, 1, 13, 10, + 3, 14, 12, 3, 9, 5, 7, 12, 5, 2, 10, 15, 6, 8, 1, 6, + 1, 6, 4, 11, 11, 13, 13, 8, 12, 1, 3, 4, 7, 10, 14, 7, + 10, 9, 15, 5, 6, 0, 8, 15, 0, 14, 5, 2, 9, 3, 2, 12, + + 13, 1, 2, 15, 8, 13, 4, 8, 6, 10, 15, 3, 11, 7, 1, 4, + 10, 12, 9, 5, 3, 6, 14, 11, 5, 0, 0, 14, 12, 9, 7, 2, + 7, 2, 11, 1, 4, 14, 1, 7, 9, 4, 12, 10, 14, 8, 2, 13, + 0, 15, 6, 12, 10, 9, 13, 0, 15, 3, 3, 5, 5, 6, 8, 11 +]; + +exports.substitute = function substitute(inL, inR) { + var out = 0; + for (var i = 0; i < 4; i++) { + var b = (inL >>> (18 - i * 6)) & 0x3f; + var sb = sTable[i * 0x40 + b]; + + out <<= 4; + out |= sb; + } + for (var i = 0; i < 4; i++) { + var b = (inR >>> (18 - i * 6)) & 0x3f; + var sb = sTable[4 * 0x40 + i * 0x40 + b]; + + out <<= 4; + out |= sb; + } + return out >>> 0; +}; + +var permuteTable = [ + 16, 25, 12, 11, 3, 20, 4, 15, 31, 17, 9, 6, 27, 14, 1, 22, + 30, 24, 8, 18, 0, 5, 29, 23, 13, 19, 2, 26, 10, 21, 28, 7 +]; + +exports.permute = function permute(num) { + var out = 0; + for (var i = 0; i < permuteTable.length; i++) { + out <<= 1; + out |= (num >>> permuteTable[i]) & 0x1; + } + return out >>> 0; +}; + +exports.padSplit = function padSplit(num, size, group) { + var str = num.toString(2); + while (str.length < size) + str = '0' + str; + + var out = []; + for (var i = 0; i < size; i += group) + out.push(str.slice(i, i + group)); + return out.join(' '); +}; - /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(58).Buffer)) /***/ }, /* 175 */ /***/ function(module, exports, __webpack_require__) { - const Readable = __webpack_require__(80).Readable; +/* WEBPACK VAR INJECTION */(function(Buffer) {var generatePrime = __webpack_require__(101) +var primes = __webpack_require__(200) - class VoiceReadable extends Readable { - constructor() { - super(); - this._packets = []; - this.open = true; - } +var DH = __webpack_require__(176) - _read() { - return; - } +function getDiffieHellman (mod) { + var prime = new Buffer(primes[mod].prime, 'hex') + var gen = new Buffer(primes[mod].gen, 'hex') - _push(d) { - if (this.open) this.push(d); - } - } + return new DH(prime, gen) +} - module.exports = VoiceReadable; +var ENCODINGS = { + 'binary': true, 'hex': true, 'base64': true +} +function createDiffieHellman (prime, enc, generator, genc) { + if (Buffer.isBuffer(enc) || ENCODINGS[enc] === undefined) { + return createDiffieHellman(prime, 'binary', enc, generator) + } + + enc = enc || 'binary' + genc = genc || 'binary' + generator = generator || new Buffer([2]) + + if (!Buffer.isBuffer(generator)) { + generator = new Buffer(generator, genc) + } + + if (typeof prime === 'number') { + return new DH(generatePrime(prime, generator), generator, true) + } + + if (!Buffer.isBuffer(prime)) { + prime = new Buffer(prime, enc) + } + + return new DH(prime, generator, true) +} + +exports.DiffieHellmanGroup = exports.createDiffieHellmanGroup = exports.getDiffieHellman = getDiffieHellman +exports.createDiffieHellman = exports.DiffieHellman = createDiffieHellman + +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer)) /***/ }, /* 176 */ /***/ function(module, exports, __webpack_require__) { - const browser = typeof window !== 'undefined'; - const WebSocket = browser ? window.WebSocket : __webpack_require__(67); // eslint-disable-line no-undef - const EventEmitter = __webpack_require__(3).EventEmitter; - const Constants = __webpack_require__(5); - const inflate = browser ? __webpack_require__(177).inflateSync : __webpack_require__(126).inflateSync; - const PacketManager = __webpack_require__(178); - const convertArrayBuffer = __webpack_require__(63); +/* WEBPACK VAR INJECTION */(function(Buffer) {var BN = __webpack_require__(4); +var MillerRabin = __webpack_require__(103); +var millerRabin = new MillerRabin(); +var TWENTYFOUR = new BN(24); +var ELEVEN = new BN(11); +var TEN = new BN(10); +var THREE = new BN(3); +var SEVEN = new BN(7); +var primes = __webpack_require__(101); +var randomBytes = __webpack_require__(27); +module.exports = DH; - /** - * The WebSocket Manager of the Client - * @private - */ - class WebSocketManager extends EventEmitter { - constructor(client) { - super(); - /** - * The Client that instantiated this WebSocketManager - * @type {Client} - */ - this.client = client; +function setPublicKey(pub, enc) { + enc = enc || 'utf8'; + if (!Buffer.isBuffer(pub)) { + pub = new Buffer(pub, enc); + } + this._pub = new BN(pub); + return this; +} - /** - * A WebSocket Packet manager, it handles all the messages - * @type {PacketManager} - */ - this.packetManager = new PacketManager(this); +function setPrivateKey(priv, enc) { + enc = enc || 'utf8'; + if (!Buffer.isBuffer(priv)) { + priv = new Buffer(priv, enc); + } + this._priv = new BN(priv); + return this; +} - /** - * The status of the WebSocketManager, a type of Constants.Status. It defaults to IDLE. - * @type {number} - */ - this.status = Constants.Status.IDLE; +var primeCache = {}; +function checkPrime(prime, generator) { + var gen = generator.toString('hex'); + var hex = [gen, prime.toString(16)].join('_'); + if (hex in primeCache) { + return primeCache[hex]; + } + var error = 0; - /** - * The session ID of the connection, null if not yet available. - * @type {?string} - */ - this.sessionID = null; + if (prime.isEven() || + !primes.simpleSieve || + !primes.fermatTest(prime) || + !millerRabin.test(prime)) { + //not a prime so +1 + error += 1; - /** - * The packet count of the client, null if not yet available. - * @type {?number} - */ - this.sequence = -1; + if (gen === '02' || gen === '05') { + // we'd be able to check the generator + // it would fail so +8 + error += 8; + } else { + //we wouldn't be able to test the generator + // so +4 + error += 4; + } + primeCache[hex] = error; + return error; + } + if (!millerRabin.test(prime.shrn(1))) { + //not a safe prime + error += 2; + } + var rem; + switch (gen) { + case '02': + if (prime.mod(TWENTYFOUR).cmp(ELEVEN)) { + // unsuidable generator + error += 8; + } + break; + case '05': + rem = prime.mod(TEN); + if (rem.cmp(THREE) && rem.cmp(SEVEN)) { + // prime mod 10 needs to equal 3 or 7 + error += 8; + } + break; + default: + error += 4; + } + primeCache[hex] = error; + return error; +} - /** - * The gateway address for this WebSocket connection, null if not yet available. - * @type {?string} - */ - this.gateway = null; +function DH(prime, generator, malleable) { + this.setGenerator(generator); + this.__prime = new BN(prime); + this._prime = BN.mont(this.__prime); + this._primeLen = prime.length; + this._pub = undefined; + this._priv = undefined; + this._primeCode = undefined; + if (malleable) { + this.setPublicKey = setPublicKey; + this.setPrivateKey = setPrivateKey; + } else { + this._primeCode = 8; + } +} +Object.defineProperty(DH.prototype, 'verifyError', { + enumerable: true, + get: function () { + if (typeof this._primeCode !== 'number') { + this._primeCode = checkPrime(this.__prime, this.__gen); + } + return this._primeCode; + } +}); +DH.prototype.generateKeys = function () { + if (!this._priv) { + this._priv = new BN(randomBytes(this._primeLen)); + } + this._pub = this._gen.toRed(this._prime).redPow(this._priv).fromRed(); + return this.getPublicKey(); +}; - /** - * Whether READY was emitted normally (all packets received) or not - * @type {boolean} - */ - this.normalReady = false; +DH.prototype.computeSecret = function (other) { + other = new BN(other); + other = other.toRed(this._prime); + var secret = other.redPow(this._priv).fromRed(); + var out = new Buffer(secret.toArray()); + var prime = this.getPrime(); + if (out.length < prime.length) { + var front = new Buffer(prime.length - out.length); + front.fill(0); + out = Buffer.concat([front, out]); + } + return out; +}; - /** - * The WebSocket connection to the gateway - * @type {?WebSocket} - */ - this.ws = null; +DH.prototype.getPublicKey = function getPublicKey(enc) { + return formatReturnValue(this._pub, enc); +}; - /** - * An object with keys that are websocket event names that should be ignored - * @type {Object} - */ - this.disabledEvents = {}; - for (const event in client.options.disabledEvents) this.disabledEvents[event] = true; +DH.prototype.getPrivateKey = function getPrivateKey(enc) { + return formatReturnValue(this._priv, enc); +}; - this.first = true; - } +DH.prototype.getPrime = function (enc) { + return formatReturnValue(this.__prime, enc); +}; - /** - * Connects the client to a given gateway - * @param {string} gateway The gateway to connect to - */ - _connect(gateway) { - this.client.emit('debug', `Connecting to gateway ${gateway}`); - this.normalReady = false; - if (this.status !== Constants.Status.RECONNECTING) this.status = Constants.Status.CONNECTING; - this.ws = new WebSocket(gateway); - if (browser) this.ws.binaryType = 'arraybuffer'; - this.ws.onopen = () => this.eventOpen(); - this.ws.onclose = (d) => this.eventClose(d); - this.ws.onmessage = (e) => this.eventMessage(e); - this.ws.onerror = (e) => this.eventError(e); - this._queue = []; - this._remaining = 3; - } +DH.prototype.getGenerator = function (enc) { + return formatReturnValue(this._gen, enc); +}; - connect(gateway) { - if (this.first) { - this._connect(gateway); - this.first = false; - } else { - this.client.setTimeout(() => this._connect(gateway), 5500); - } - } +DH.prototype.setGenerator = function (gen, enc) { + enc = enc || 'utf8'; + if (!Buffer.isBuffer(gen)) { + gen = new Buffer(gen, enc); + } + this.__gen = gen; + this._gen = new BN(gen); + return this; +}; - /** - * Sends a packet to the gateway - * @param {Object} data An object that can be JSON stringified - * @param {boolean} force Whether or not to send the packet immediately - */ - send(data, force = false) { - if (force) { - this._send(JSON.stringify(data)); - return; - } - this._queue.push(JSON.stringify(data)); - this.doQueue(); - } - - destroy() { - this.ws.close(1000); - this._queue = []; - this.status = Constants.Status.IDLE; - } - - _send(data) { - if (this.ws.readyState === WebSocket.OPEN) { - this.emit('send', data); - this.ws.send(data); - } - } - - doQueue() { - const item = this._queue[0]; - if (this.ws.readyState === WebSocket.OPEN && item) { - if (this._remaining === 0) { - this.client.setTimeout(() => { - this.doQueue(); - }, 1000); - return; - } - this._remaining--; - this._send(item); - this._queue.shift(); - this.doQueue(); - this.client.setTimeout(() => this._remaining++, 1000); - } - } - - /** - * Run whenever the gateway connections opens up - */ - eventOpen() { - this.client.emit('debug', 'Connection to gateway opened'); - if (this.status === Constants.Status.RECONNECTING) this._sendResume(); - else this._sendNewIdentify(); - } - - /** - * Sends a gateway resume packet, in cases of unexpected disconnections. - */ - _sendResume() { - if (!this.sessionID) { - this._sendNewIdentify(); - return; - } - this.client.emit('debug', 'Identifying as resumed session'); - const payload = { - token: this.client.token, - session_id: this.sessionID, - seq: this.sequence, - }; - - this.send({ - op: Constants.OPCodes.RESUME, - d: payload, - }); - } - - /** - * Sends a new identification packet, in cases of new connections or failed reconnections. - */ - _sendNewIdentify() { - this.reconnecting = false; - const payload = this.client.options.ws; - payload.token = this.client.token; - if (this.client.options.shardCount > 0) { - payload.shard = [Number(this.client.options.shardId), Number(this.client.options.shardCount)]; - } - this.client.emit('debug', 'Identifying as new session'); - this.send({ - op: Constants.OPCodes.IDENTIFY, - d: payload, - }); - this.sequence = -1; - } - - /** - * Run whenever the connection to the gateway is closed, it will try to reconnect the client. - * @param {Object} event The received websocket data - */ - eventClose(event) { - this.emit('close', event); - this.client.clearInterval(this.client.manager.heartbeatInterval); - /** - * Emitted whenever the client websocket is disconnected - * @event Client#disconnect - */ - if (!this.reconnecting) this.client.emit(Constants.Events.DISCONNECT); - if (event.code === 4004) return; - if (event.code === 4010) return; - if (!this.reconnecting && event.code !== 1000) this.tryReconnect(); - } - - /** - * Run whenever a message is received from the WebSocket. Returns `true` if the message - * was handled properly. - * @param {Object} event The received websocket data - * @returns {boolean} - */ - eventMessage(event) { - let packet = event.data; - try { - if (typeof packet !== 'string') { - if (packet instanceof ArrayBuffer) packet = convertArrayBuffer(packet); - packet = inflate(packet).toString(); - } - packet = JSON.parse(packet); - } catch (e) { - return this.eventError(new Error(Constants.Errors.BAD_WS_MESSAGE)); - } - - this.client.emit('raw', packet); - - if (packet.op === Constants.OPCodes.HELLO) this.client.manager.setupKeepAlive(packet.d.heartbeat_interval); - return this.packetManager.handle(packet); - } - - /** - * Run whenever an error occurs with the WebSocket connection. Tries to reconnect - * @param {Error} err The encountered error - */ - eventError(err) { - /** - * Emitted whenever the Client encounters a serious connection error - * @event Client#error - * @param {Error} error The encountered error - */ - if (this.client.listenerCount('error') > 0) this.client.emit('error', err); - this.ws.close(); - } - - _emitReady(normal = true) { - /** - * Emitted when the Client becomes ready to start working - * @event Client#ready - */ - this.status = Constants.Status.READY; - this.client.emit(Constants.Events.READY); - this.packetManager.handleQueue(); - this.normalReady = normal; - } - - /** - * Runs on new packets before `READY` to see if the Client is ready yet, if it is prepares - * the `READY` event. - */ - checkIfReady() { - if (this.status !== Constants.Status.READY && this.status !== Constants.Status.NEARLY) { - let unavailableCount = 0; - for (const guildID of this.client.guilds.keys()) { - unavailableCount += this.client.guilds.get(guildID).available ? 0 : 1; - } - if (unavailableCount === 0) { - this.status = Constants.Status.NEARLY; - if (this.client.options.fetchAllMembers) { - const promises = this.client.guilds.map(g => g.fetchMembers()); - Promise.all(promises).then(() => this._emitReady(), e => { - this.client.emit(Constants.Events.WARN, 'Error in pre-ready guild member fetching'); - this.client.emit(Constants.Events.ERROR, e); - this._emitReady(); - }); - return; - } - this._emitReady(); - } - } - } - - /** - * Tries to reconnect the client, changing the status to Constants.Status.RECONNECTING. - */ - tryReconnect() { - this.status = Constants.Status.RECONNECTING; - this.ws.close(); - this.packetManager.handleQueue(); - /** - * Emitted when the Client tries to reconnect after being disconnected - * @event Client#reconnecting - */ - this.client.emit(Constants.Events.RECONNECTING); - this.connect(this.client.ws.gateway); - } - } - - module.exports = WebSocketManager; +function formatReturnValue(bn, enc) { + var buf = new Buffer(bn.toArray()); + if (!enc) { + return buf; + } else { + return buf.toString(enc); + } +} +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer)) /***/ }, /* 177 */ /***/ function(module, exports, __webpack_require__) { - /* WEBPACK VAR INJECTION */(function(process, Buffer) {/** @license zlib.js 2012 - imaya [ https://github.com/imaya/zlib.js ] The MIT License */(function() {'use strict';function q(b){throw b;}var t=void 0,v=!0;var A="undefined"!==typeof Uint8Array&&"undefined"!==typeof Uint16Array&&"undefined"!==typeof Uint32Array&&"undefined"!==typeof DataView;function E(b,a){this.index="number"===typeof a?a:0;this.m=0;this.buffer=b instanceof(A?Uint8Array:Array)?b:new (A?Uint8Array:Array)(32768);2*this.buffer.length<=this.index&&q(Error("invalid index"));this.buffer.length<=this.index&&this.f()}E.prototype.f=function(){var b=this.buffer,a,c=b.length,d=new (A?Uint8Array:Array)(c<<1);if(A)d.set(b);else for(a=0;a>>8&255]<<16|G[b>>>16&255]<<8|G[b>>>24&255])>>32-a:G[b]>>8-a);if(8>a+f)g=g<>a-k-1&1,8===++f&&(f=0,d[e++]=G[g],g=0,e===d.length&&(d=this.f()));d[e]=g;this.buffer=d;this.m=f;this.index=e};E.prototype.finish=function(){var b=this.buffer,a=this.index,c;0J;++J){for(var N=J,Q=N,ba=7,N=N>>>1;N;N>>>=1)Q<<=1,Q|=N&1,--ba;aa[J]=(Q<>>0}var G=aa;function R(b,a,c){var d,e="number"===typeof a?a:a=0,f="number"===typeof c?c:b.length;d=-1;for(e=f&7;e--;++a)d=d>>>8^S[(d^b[a])&255];for(e=f>>3;e--;a+=8)d=d>>>8^S[(d^b[a])&255],d=d>>>8^S[(d^b[a+1])&255],d=d>>>8^S[(d^b[a+2])&255],d=d>>>8^S[(d^b[a+3])&255],d=d>>>8^S[(d^b[a+4])&255],d=d>>>8^S[(d^b[a+5])&255],d=d>>>8^S[(d^b[a+6])&255],d=d>>>8^S[(d^b[a+7])&255];return(d^4294967295)>>>0} - var ga=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759, - 2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977, - 2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755, - 2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956, - 3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270, - 936918E3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117],S=A?new Uint32Array(ga):ga;function ha(){};function ia(b){this.buffer=new (A?Uint16Array:Array)(2*b);this.length=0}ia.prototype.getParent=function(b){return 2*((b-2)/4|0)};ia.prototype.push=function(b,a){var c,d,e=this.buffer,f;c=this.length;e[this.length++]=a;for(e[this.length++]=b;0e[d])f=e[c],e[c]=e[d],e[d]=f,f=e[c+1],e[c+1]=e[d+1],e[d+1]=f,c=d;else break;return this.length}; - ia.prototype.pop=function(){var b,a,c=this.buffer,d,e,f;a=c[0];b=c[1];this.length-=2;c[0]=c[this.length];c[1]=c[this.length+1];for(f=0;;){e=2*f+2;if(e>=this.length)break;e+2c[e]&&(e+=2);if(c[e]>c[f])d=c[f],c[f]=c[e],c[e]=d,d=c[f+1],c[f+1]=c[e+1],c[e+1]=d;else break;f=e}return{index:b,value:a,length:this.length}};function ja(b){var a=b.length,c=0,d=Number.POSITIVE_INFINITY,e,f,g,k,h,l,s,p,m,n;for(p=0;pc&&(c=b[p]),b[p]>=1;n=g<<16|p;for(m=l;mT;T++)switch(v){case 143>=T:pa.push([T+48,8]);break;case 255>=T:pa.push([T-144+400,9]);break;case 279>=T:pa.push([T-256+0,7]);break;case 287>=T:pa.push([T-280+192,8]);break;default:q("invalid literal: "+T)} - ma.prototype.h=function(){var b,a,c,d,e=this.input;switch(this.k){case 0:c=0;for(d=e.length;c>>8&255;m[n++]=l&255;m[n++]=l>>>8&255;if(A)m.set(f,n),n+=f.length,m=m.subarray(0,n);else{s=0;for(p=f.length;sz)for(;0< - z--;)H[F++]=0,L[0]++;else for(;0z?z:138,C>z-3&&C=C?(H[F++]=17,H[F++]=C-3,L[17]++):(H[F++]=18,H[F++]=C-11,L[18]++),z-=C;else if(H[F++]=I[w],L[I[w]]++,z--,3>z)for(;0z?z:6,C>z-3&&CB;B++)sa[B]=ka[qb[B]];for(W=19;4=a:return[265,a-11,1];case 14>=a:return[266,a-13,1];case 16>=a:return[267,a-15,1];case 18>=a:return[268,a-17,1];case 22>=a:return[269,a-19,2];case 26>=a:return[270,a-23,2];case 30>=a:return[271,a-27,2];case 34>=a:return[272, - a-31,2];case 42>=a:return[273,a-35,3];case 50>=a:return[274,a-43,3];case 58>=a:return[275,a-51,3];case 66>=a:return[276,a-59,3];case 82>=a:return[277,a-67,4];case 98>=a:return[278,a-83,4];case 114>=a:return[279,a-99,4];case 130>=a:return[280,a-115,4];case 162>=a:return[281,a-131,5];case 194>=a:return[282,a-163,5];case 226>=a:return[283,a-195,5];case 257>=a:return[284,a-227,5];case 258===a:return[285,a-258,0];default:q("invalid length: "+a)}}var a=[],c,d;for(c=3;258>=c;c++)d=b(c),a[c]=d[2]<<24|d[1]<< - 16|d[0];return a}(),xa=A?new Uint32Array(wa):wa; - function qa(b,a){function c(a,c){var b=a.O,d=[],f=0,e;e=xa[a.length];d[f++]=e&65535;d[f++]=e>>16&255;d[f++]=e>>24;var g;switch(v){case 1===b:g=[0,b-1,0];break;case 2===b:g=[1,b-2,0];break;case 3===b:g=[2,b-3,0];break;case 4===b:g=[3,b-4,0];break;case 6>=b:g=[4,b-5,1];break;case 8>=b:g=[5,b-7,1];break;case 12>=b:g=[6,b-9,2];break;case 16>=b:g=[7,b-13,2];break;case 24>=b:g=[8,b-17,3];break;case 32>=b:g=[9,b-25,3];break;case 48>=b:g=[10,b-33,4];break;case 64>=b:g=[11,b-49,4];break;case 96>=b:g=[12,b- - 65,5];break;case 128>=b:g=[13,b-97,5];break;case 192>=b:g=[14,b-129,6];break;case 256>=b:g=[15,b-193,6];break;case 384>=b:g=[16,b-257,7];break;case 512>=b:g=[17,b-385,7];break;case 768>=b:g=[18,b-513,8];break;case 1024>=b:g=[19,b-769,8];break;case 1536>=b:g=[20,b-1025,9];break;case 2048>=b:g=[21,b-1537,9];break;case 3072>=b:g=[22,b-2049,10];break;case 4096>=b:g=[23,b-3073,10];break;case 6144>=b:g=[24,b-4097,11];break;case 8192>=b:g=[25,b-6145,11];break;case 12288>=b:g=[26,b-8193,12];break;case 16384>= - b:g=[27,b-12289,12];break;case 24576>=b:g=[28,b-16385,13];break;case 32768>=b:g=[29,b-24577,13];break;default:q("invalid distance")}e=g;d[f++]=e[0];d[f++]=e[1];d[f++]=e[2];var h,k;h=0;for(k=d.length;h=f;)u[f++]=0;for(f=0;29>=f;)x[f++]=0}u[256]=1;d=0;for(e=a.length;d=e){p&&c(p,-1);f=0;for(g=e-d;fg&&a+gf&&(e=d,f=g);if(258===g)break}return new ua(f,a-e)} - function ra(b,a){var c=b.length,d=new ia(572),e=new (A?Uint8Array:Array)(c),f,g,k,h,l;if(!A)for(h=0;h2*e[n-1]+f[n]&&(e[n]=2*e[n-1]+f[n]),k[n]=Array(e[n]),h[n]=Array(e[n]);for(m=0;mb[m]?(k[n][r]=u,h[n][r]=a,x+=2):(k[n][r]=b[m],h[n][r]=m,++m);l[n]=0;1===f[n]&&d(n)}return g} - function ta(b){var a=new (A?Uint16Array:Array)(b.length),c=[],d=[],e=0,f,g,k,h;f=0;for(g=b.length;f>>=1}return a};function Aa(b,a){this.input=b;this.b=this.c=0;this.g={};a&&(a.flags&&(this.g=a.flags),"string"===typeof a.filename&&(this.filename=a.filename),"string"===typeof a.comment&&(this.w=a.comment),a.deflateOptions&&(this.l=a.deflateOptions));this.l||(this.l={})} - Aa.prototype.h=function(){var b,a,c,d,e,f,g,k,h=new (A?Uint8Array:Array)(32768),l=0,s=this.input,p=this.c,m=this.filename,n=this.w;h[l++]=31;h[l++]=139;h[l++]=8;b=0;this.g.fname&&(b|=Ba);this.g.fcomment&&(b|=Ca);this.g.fhcrc&&(b|=Da);h[l++]=b;a=(Date.now?Date.now():+new Date)/1E3|0;h[l++]=a&255;h[l++]=a>>>8&255;h[l++]=a>>>16&255;h[l++]=a>>>24&255;h[l++]=0;h[l++]=Sa;if(this.g.fname!==t){g=0;for(k=m.length;g>>8&255),h[l++]=f&255;h[l++]=0}if(this.g.comment){g= - 0;for(k=n.length;g>>8&255),h[l++]=f&255;h[l++]=0}this.g.fhcrc&&(c=R(h,0,l)&65535,h[l++]=c&255,h[l++]=c>>>8&255);this.l.outputBuffer=h;this.l.outputIndex=l;e=new ma(s,this.l);h=e.h();l=e.b;A&&(l+8>h.buffer.byteLength?(this.a=new Uint8Array(l+8),this.a.set(new Uint8Array(h.buffer)),h=this.a):h=new Uint8Array(h.buffer));d=R(s,t,t);h[l++]=d&255;h[l++]=d>>>8&255;h[l++]=d>>>16&255;h[l++]=d>>>24&255;k=s.length;h[l++]=k&255;h[l++]=k>>>8&255;h[l++]=k>>>16&255;h[l++]= - k>>>24&255;this.c=p;A&&l>>=1;switch(b){case 0:var a=this.input,c=this.c,d=this.a,e=this.b,f=a.length,g=t,k=t,h=d.length,l=t;this.e=this.j=0;c+1>=f&&q(Error("invalid uncompressed block header: LEN"));g=a[c++]|a[c++]<<8;c+1>=f&&q(Error("invalid uncompressed block header: NLEN"));k=a[c++]|a[c++]<<8;g===~k&&q(Error("invalid uncompressed block header: length verify"));c+g>a.length&&q(Error("input buffer is broken"));switch(this.q){case Ua:for(;e+g>d.length;){l= - h-e;g-=l;if(A)d.set(a.subarray(c,c+l),e),e+=l,c+=l;else for(;l--;)d[e++]=a[c++];this.b=e;d=this.f();e=this.b}break;case Ta:for(;e+g>d.length;)d=this.f({B:2});break;default:q(Error("invalid inflate mode"))}if(A)d.set(a.subarray(c,c+g),e),e+=g,c+=g;else for(;g--;)d[e++]=a[c++];this.c=c;this.b=e;this.a=d;break;case 1:this.r(Va,Wa);break;case 2:Xa(this);break;default:q(Error("unknown BTYPE: "+b))}}return this.z()}; - var Ya=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],Za=A?new Uint16Array(Ya):Ya,$a=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,258,258],ab=A?new Uint16Array($a):$a,bb=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0],cb=A?new Uint8Array(bb):bb,db=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577],eb=A?new Uint16Array(db):db,fb=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10, - 10,11,11,12,12,13,13],gb=A?new Uint8Array(fb):fb,hb=new (A?Uint8Array:Array)(288),$,ib;$=0;for(ib=hb.length;$=$?8:255>=$?9:279>=$?7:8;var Va=ja(hb),jb=new (A?Uint8Array:Array)(30),kb,lb;kb=0;for(lb=jb.length;kb=g&&q(Error("input buffer is broken")),c|=e[f++]<>>a;b.e=d-a;b.c=f;return k} - function mb(b,a){for(var c=b.j,d=b.e,e=b.input,f=b.c,g=e.length,k=a[0],h=a[1],l,s;d=g);)c|=e[f++]<>>16;b.j=c>>s;b.e=d-s;b.c=f;return l&65535} - function Xa(b){function a(a,b,c){var d,e=this.I,f,g;for(g=0;gf)d>=e&&(this.b=d,c=this.f(),d=this.b),c[d++]=f;else{g=f-257;h=ab[g];0=e&&(this.b=d,c=this.f(),d=this.b);for(;h--;)c[d]=c[d++-k]}for(;8<=this.e;)this.e-=8,this.c--;this.b=d}; - Y.prototype.R=function(b,a){var c=this.a,d=this.b;this.A=b;for(var e=c.length,f,g,k,h;256!==(f=mb(this,b));)if(256>f)d>=e&&(c=this.f(),e=c.length),c[d++]=f;else{g=f-257;h=ab[g];0e&&(c=this.f(),e=c.length);for(;h--;)c[d]=c[d++-k]}for(;8<=this.e;)this.e-=8,this.c--;this.b=d}; - Y.prototype.f=function(){var b=new (A?Uint8Array:Array)(this.b-32768),a=this.b-32768,c,d,e=this.a;if(A)b.set(e.subarray(32768,b.length));else{c=0;for(d=b.length;cc;++c)e[c]=e[a+c];this.b=32768;return e}; - Y.prototype.T=function(b){var a,c=this.input.length/this.c+1|0,d,e,f,g=this.input,k=this.a;b&&("number"===typeof b.B&&(c=b.B),"number"===typeof b.N&&(c+=b.N));2>c?(d=(g.length-this.c)/this.A[2],f=258*(d/2)|0,e=fa&&(this.a.length=a),b=this.a);return this.buffer=b};function nb(b){this.input=b;this.c=0;this.G=[];this.S=!1} - nb.prototype.i=function(){for(var b=this.input.length;this.c>>0;R(e,t,t)!==s&&q(Error("invalid CRC-32 checksum: 0x"+R(e,t,t).toString(16)+" / 0x"+ - s.toString(16)));a.$=c=(p[m++]|p[m++]<<8|p[m++]<<16|p[m++]<<24)>>>0;(e.length&4294967295)!==c&&q(Error("invalid input size: "+(e.length&4294967295)+" / "+c));this.G.push(a);this.c=m}this.S=v;var n=this.G,r,u,x=0,O=0,y;r=0;for(u=n.length;r>>0;b=a}for(var e=1,f=0,g=b.length,k,h=0;0>>0};function pb(b,a){var c,d;this.input=b;this.c=0;if(a||!(a={}))a.index&&(this.c=a.index),a.verify&&(this.W=a.verify);c=b[this.c++];d=b[this.c++];switch(c&15){case rb:this.method=rb;break;default:q(Error("unsupported compression method"))}0!==((c<<8)+d)%31&&q(Error("invalid fcheck flag:"+((c<<8)+d)%31));d&32&&q(Error("fdict flag is not supported"));this.K=new Y(b,{index:this.c,bufferSize:a.bufferSize,bufferType:a.bufferType,resize:a.resize})} - pb.prototype.i=function(){var b=this.input,a,c;a=this.K.i();this.c=this.K.c;this.W&&(c=(b[this.c++]<<24|b[this.c++]<<16|b[this.c++]<<8|b[this.c++])>>>0,c!==ob(a)&&q(Error("invalid adler-32 checksum")));return a};var rb=8;function sb(b,a){this.input=b;this.a=new (A?Uint8Array:Array)(32768);this.k=tb.t;var c={},d;if((a||!(a={}))&&"number"===typeof a.compressionType)this.k=a.compressionType;for(d in a)c[d]=a[d];c.outputBuffer=this.a;this.J=new ma(this.input,c)}var tb=oa; - sb.prototype.h=function(){var b,a,c,d,e,f,g,k=0;g=this.a;b=rb;switch(b){case rb:a=Math.LOG2E*Math.log(32768)-8;break;default:q(Error("invalid compression method"))}c=a<<4|b;g[k++]=c;switch(b){case rb:switch(this.k){case tb.NONE:e=0;break;case tb.M:e=1;break;case tb.t:e=2;break;default:q(Error("unsupported compression type"))}break;default:q(Error("invalid compression method"))}d=e<<6|0;g[k++]=d|31-(256*c+d)%31;f=ob(this.input);this.J.b=k;g=this.J.h();k=g.length;A&&(g=new Uint8Array(g.buffer),g.length<= - k+4&&(this.a=new Uint8Array(g.length+4),this.a.set(g),g=this.a),g=g.subarray(0,k+4));g[k++]=f>>24&255;g[k++]=f>>16&255;g[k++]=f>>8&255;g[k++]=f&255;return g};exports.deflate=ub;exports.deflateSync=vb;exports.inflate=wb;exports.inflateSync=xb;exports.gzip=yb;exports.gzipSync=zb;exports.gunzip=Ab;exports.gunzipSync=Bb;function ub(b,a,c){process.nextTick(function(){var d,e;try{e=vb(b,c)}catch(f){d=f}a(d,e)})}function vb(b,a){var c;c=(new sb(b)).h();a||(a={});return a.H?c:Cb(c)}function wb(b,a,c){process.nextTick(function(){var d,e;try{e=xb(b,c)}catch(f){d=f}a(d,e)})} - function xb(b,a){var c;b.subarray=b.slice;c=(new pb(b)).i();a||(a={});return a.noBuffer?c:Cb(c)}function yb(b,a,c){process.nextTick(function(){var d,e;try{e=zb(b,c)}catch(f){d=f}a(d,e)})}function zb(b,a){var c;b.subarray=b.slice;c=(new Aa(b)).h();a||(a={});return a.H?c:Cb(c)}function Ab(b,a,c){process.nextTick(function(){var d,e;try{e=Bb(b,c)}catch(f){d=f}a(d,e)})}function Bb(b,a){var c;b.subarray=b.slice;c=(new nb(b)).i();a||(a={});return a.H?c:Cb(c)} - function Cb(b){var a=new Buffer(b.length),c,d;c=0;for(d=b.length;c 0) { + this.redN = null; + } else { + this._maxwellTrick = true; + this.redN = this.n.toRed(this.red); + } +} +module.exports = BaseCurve; + +BaseCurve.prototype.point = function point() { + throw new Error('Not implemented'); +}; + +BaseCurve.prototype.validate = function validate() { + throw new Error('Not implemented'); +}; + +BaseCurve.prototype._fixedNafMul = function _fixedNafMul(p, k) { + assert(p.precomputed); + var doubles = p._getDoubles(); + + var naf = getNAF(k, 1); + var I = (1 << (doubles.step + 1)) - (doubles.step % 2 === 0 ? 2 : 1); + I /= 3; + + // Translate into more windowed form + var repr = []; + for (var j = 0; j < naf.length; j += doubles.step) { + var nafW = 0; + for (var k = j + doubles.step - 1; k >= j; k--) + nafW = (nafW << 1) + naf[k]; + repr.push(nafW); + } + + var a = this.jpoint(null, null, null); + var b = this.jpoint(null, null, null); + for (var i = I; i > 0; i--) { + for (var j = 0; j < repr.length; j++) { + var nafW = repr[j]; + if (nafW === i) + b = b.mixedAdd(doubles.points[j]); + else if (nafW === -i) + b = b.mixedAdd(doubles.points[j].neg()); + } + a = a.add(b); + } + return a.toP(); +}; + +BaseCurve.prototype._wnafMul = function _wnafMul(p, k) { + var w = 4; + + // Precompute window + var nafPoints = p._getNAFPoints(w); + w = nafPoints.wnd; + var wnd = nafPoints.points; + + // Get NAF form + var naf = getNAF(k, w); + + // Add `this`*(N+1) for every w-NAF index + var acc = this.jpoint(null, null, null); + for (var i = naf.length - 1; i >= 0; i--) { + // Count zeroes + for (var k = 0; i >= 0 && naf[i] === 0; i--) + k++; + if (i >= 0) + k++; + acc = acc.dblp(k); + + if (i < 0) + break; + var z = naf[i]; + assert(z !== 0); + if (p.type === 'affine') { + // J +- P + if (z > 0) + acc = acc.mixedAdd(wnd[(z - 1) >> 1]); + else + acc = acc.mixedAdd(wnd[(-z - 1) >> 1].neg()); + } else { + // J +- J + if (z > 0) + acc = acc.add(wnd[(z - 1) >> 1]); + else + acc = acc.add(wnd[(-z - 1) >> 1].neg()); + } + } + return p.type === 'affine' ? acc.toP() : acc; +}; + +BaseCurve.prototype._wnafMulAdd = function _wnafMulAdd(defW, + points, + coeffs, + len, + jacobianResult) { + var wndWidth = this._wnafT1; + var wnd = this._wnafT2; + var naf = this._wnafT3; + + // Fill all arrays + var max = 0; + for (var i = 0; i < len; i++) { + var p = points[i]; + var nafPoints = p._getNAFPoints(defW); + wndWidth[i] = nafPoints.wnd; + wnd[i] = nafPoints.points; + } + + // Comb small window NAFs + for (var i = len - 1; i >= 1; i -= 2) { + var a = i - 1; + var b = i; + if (wndWidth[a] !== 1 || wndWidth[b] !== 1) { + naf[a] = getNAF(coeffs[a], wndWidth[a]); + naf[b] = getNAF(coeffs[b], wndWidth[b]); + max = Math.max(naf[a].length, max); + max = Math.max(naf[b].length, max); + continue; + } + + var comb = [ + points[a], /* 1 */ + null, /* 3 */ + null, /* 5 */ + points[b] /* 7 */ + ]; + + // Try to avoid Projective points, if possible + if (points[a].y.cmp(points[b].y) === 0) { + comb[1] = points[a].add(points[b]); + comb[2] = points[a].toJ().mixedAdd(points[b].neg()); + } else if (points[a].y.cmp(points[b].y.redNeg()) === 0) { + comb[1] = points[a].toJ().mixedAdd(points[b]); + comb[2] = points[a].add(points[b].neg()); + } else { + comb[1] = points[a].toJ().mixedAdd(points[b]); + comb[2] = points[a].toJ().mixedAdd(points[b].neg()); + } + + var index = [ + -3, /* -1 -1 */ + -1, /* -1 0 */ + -5, /* -1 1 */ + -7, /* 0 -1 */ + 0, /* 0 0 */ + 7, /* 0 1 */ + 5, /* 1 -1 */ + 1, /* 1 0 */ + 3 /* 1 1 */ + ]; + + var jsf = getJSF(coeffs[a], coeffs[b]); + max = Math.max(jsf[0].length, max); + naf[a] = new Array(max); + naf[b] = new Array(max); + for (var j = 0; j < max; j++) { + var ja = jsf[0][j] | 0; + var jb = jsf[1][j] | 0; + + naf[a][j] = index[(ja + 1) * 3 + (jb + 1)]; + naf[b][j] = 0; + wnd[a] = comb; + } + } + + var acc = this.jpoint(null, null, null); + var tmp = this._wnafT4; + for (var i = max; i >= 0; i--) { + var k = 0; + + while (i >= 0) { + var zero = true; + for (var j = 0; j < len; j++) { + tmp[j] = naf[j][i] | 0; + if (tmp[j] !== 0) + zero = false; + } + if (!zero) + break; + k++; + i--; + } + if (i >= 0) + k++; + acc = acc.dblp(k); + if (i < 0) + break; + + for (var j = 0; j < len; j++) { + var z = tmp[j]; + var p; + if (z === 0) + continue; + else if (z > 0) + p = wnd[j][(z - 1) >> 1]; + else if (z < 0) + p = wnd[j][(-z - 1) >> 1].neg(); + + if (p.type === 'affine') + acc = acc.mixedAdd(p); + else + acc = acc.add(p); + } + } + // Zeroify references + for (var i = 0; i < len; i++) + wnd[i] = null; + + if (jacobianResult) + return acc; + else + return acc.toP(); +}; + +function BasePoint(curve, type) { + this.curve = curve; + this.type = type; + this.precomputed = null; +} +BaseCurve.BasePoint = BasePoint; + +BasePoint.prototype.eq = function eq(/*other*/) { + throw new Error('Not implemented'); +}; + +BasePoint.prototype.validate = function validate() { + return this.curve.validate(this); +}; + +BaseCurve.prototype.decodePoint = function decodePoint(bytes, enc) { + bytes = utils.toArray(bytes, enc); + + var len = this.p.byteLength(); + + // uncompressed, hybrid-odd, hybrid-even + if ((bytes[0] === 0x04 || bytes[0] === 0x06 || bytes[0] === 0x07) && + bytes.length - 1 === 2 * len) { + if (bytes[0] === 0x06) + assert(bytes[bytes.length - 1] % 2 === 0); + else if (bytes[0] === 0x07) + assert(bytes[bytes.length - 1] % 2 === 1); + + var res = this.point(bytes.slice(1, 1 + len), + bytes.slice(1 + len, 1 + 2 * len)); + + return res; + } else if ((bytes[0] === 0x02 || bytes[0] === 0x03) && + bytes.length - 1 === len) { + return this.pointFromX(bytes.slice(1, 1 + len), bytes[0] === 0x03); + } + throw new Error('Unknown point format'); +}; + +BasePoint.prototype.encodeCompressed = function encodeCompressed(enc) { + return this.encode(enc, true); +}; + +BasePoint.prototype._encode = function _encode(compact) { + var len = this.curve.p.byteLength(); + var x = this.getX().toArray('be', len); + + if (compact) + return [ this.getY().isEven() ? 0x02 : 0x03 ].concat(x); + + return [ 0x04 ].concat(x, this.getY().toArray('be', len)) ; +}; + +BasePoint.prototype.encode = function encode(enc, compact) { + return utils.encode(this._encode(compact), enc); +}; + +BasePoint.prototype.precompute = function precompute(power) { + if (this.precomputed) + return this; + + var precomputed = { + doubles: null, + naf: null, + beta: null + }; + precomputed.naf = this._getNAFPoints(8); + precomputed.doubles = this._getDoubles(4, power); + precomputed.beta = this._getBeta(); + this.precomputed = precomputed; + + return this; +}; + +BasePoint.prototype._hasDoubles = function _hasDoubles(k) { + if (!this.precomputed) + return false; + + var doubles = this.precomputed.doubles; + if (!doubles) + return false; + + return doubles.points.length >= Math.ceil((k.bitLength() + 1) / doubles.step); +}; + +BasePoint.prototype._getDoubles = function _getDoubles(step, power) { + if (this.precomputed && this.precomputed.doubles) + return this.precomputed.doubles; + + var doubles = [ this ]; + var acc = this; + for (var i = 0; i < power; i += step) { + for (var j = 0; j < step; j++) + acc = acc.dbl(); + doubles.push(acc); + } + return { + step: step, + points: doubles + }; +}; + +BasePoint.prototype._getNAFPoints = function _getNAFPoints(wnd) { + if (this.precomputed && this.precomputed.naf) + return this.precomputed.naf; + + var res = [ this ]; + var max = (1 << wnd) - 1; + var dbl = max === 1 ? null : this.dbl(); + for (var i = 1; i < max; i++) + res[i] = res[i - 1].add(dbl); + return { + wnd: wnd, + points: res + }; +}; + +BasePoint.prototype._getBeta = function _getBeta() { + return null; +}; + +BasePoint.prototype.dblp = function dblp(k) { + var r = this; + for (var i = 0; i < k; i++) + r = r.dbl(); + return r; +}; - /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2), __webpack_require__(58).Buffer)) /***/ }, /* 178 */ /***/ function(module, exports, __webpack_require__) { - const Constants = __webpack_require__(5); +"use strict"; +'use strict'; - const BeforeReadyWhitelist = [ - Constants.WSEvents.READY, - Constants.WSEvents.GUILD_CREATE, - Constants.WSEvents.GUILD_DELETE, - Constants.WSEvents.GUILD_MEMBERS_CHUNK, - Constants.WSEvents.GUILD_MEMBER_ADD, - Constants.WSEvents.GUILD_MEMBER_REMOVE, - ]; +var curve = __webpack_require__(36); +var elliptic = __webpack_require__(7); +var BN = __webpack_require__(4); +var inherits = __webpack_require__(1); +var Base = curve.base; - class WebSocketPacketManager { - constructor(websocketManager) { - this.ws = websocketManager; - this.handlers = {}; - this.queue = []; +var assert = elliptic.utils.assert; - this.register(Constants.WSEvents.READY, 'Ready'); - this.register(Constants.WSEvents.GUILD_CREATE, 'GuildCreate'); - this.register(Constants.WSEvents.GUILD_DELETE, 'GuildDelete'); - this.register(Constants.WSEvents.GUILD_UPDATE, 'GuildUpdate'); - this.register(Constants.WSEvents.GUILD_BAN_ADD, 'GuildBanAdd'); - this.register(Constants.WSEvents.GUILD_BAN_REMOVE, 'GuildBanRemove'); - this.register(Constants.WSEvents.GUILD_MEMBER_ADD, 'GuildMemberAdd'); - this.register(Constants.WSEvents.GUILD_MEMBER_REMOVE, 'GuildMemberRemove'); - this.register(Constants.WSEvents.GUILD_MEMBER_UPDATE, 'GuildMemberUpdate'); - this.register(Constants.WSEvents.GUILD_ROLE_CREATE, 'GuildRoleCreate'); - this.register(Constants.WSEvents.GUILD_ROLE_DELETE, 'GuildRoleDelete'); - this.register(Constants.WSEvents.GUILD_ROLE_UPDATE, 'GuildRoleUpdate'); - this.register(Constants.WSEvents.GUILD_MEMBERS_CHUNK, 'GuildMembersChunk'); - this.register(Constants.WSEvents.CHANNEL_CREATE, 'ChannelCreate'); - this.register(Constants.WSEvents.CHANNEL_DELETE, 'ChannelDelete'); - this.register(Constants.WSEvents.CHANNEL_UPDATE, 'ChannelUpdate'); - this.register(Constants.WSEvents.PRESENCE_UPDATE, 'PresenceUpdate'); - this.register(Constants.WSEvents.USER_UPDATE, 'UserUpdate'); - this.register(Constants.WSEvents.USER_NOTE_UPDATE, 'UserNoteUpdate'); - this.register(Constants.WSEvents.VOICE_STATE_UPDATE, 'VoiceStateUpdate'); - this.register(Constants.WSEvents.TYPING_START, 'TypingStart'); - this.register(Constants.WSEvents.MESSAGE_CREATE, 'MessageCreate'); - this.register(Constants.WSEvents.MESSAGE_DELETE, 'MessageDelete'); - this.register(Constants.WSEvents.MESSAGE_UPDATE, 'MessageUpdate'); - this.register(Constants.WSEvents.VOICE_SERVER_UPDATE, 'VoiceServerUpdate'); - this.register(Constants.WSEvents.MESSAGE_DELETE_BULK, 'MessageDeleteBulk'); - this.register(Constants.WSEvents.CHANNEL_PINS_UPDATE, 'ChannelPinsUpdate'); - this.register(Constants.WSEvents.GUILD_SYNC, 'GuildSync'); - this.register(Constants.WSEvents.RELATIONSHIP_ADD, 'RelationshipAdd'); - this.register(Constants.WSEvents.RELATIONSHIP_REMOVE, 'RelationshipRemove'); - this.register(Constants.WSEvents.MESSAGE_REACTION_ADD, 'MessageReactionAdd'); - this.register(Constants.WSEvents.MESSAGE_REACTION_REMOVE, 'MessageReactionRemove'); - this.register(Constants.WSEvents.MESSAGE_REACTION_REMOVE_ALL, 'MessageReactionRemoveAll'); - } +function EdwardsCurve(conf) { + // NOTE: Important as we are creating point in Base.call() + this.twisted = (conf.a | 0) !== 1; + this.mOneA = this.twisted && (conf.a | 0) === -1; + this.extended = this.mOneA; - get client() { - return this.ws.client; - } + Base.call(this, 'edwards', conf); - register(event, handle) { - const Handler = __webpack_require__(179)(`./handlers/${handle}`); - this.handlers[event] = new Handler(this); - } + this.a = new BN(conf.a, 16).umod(this.red.m); + this.a = this.a.toRed(this.red); + this.c = new BN(conf.c, 16).toRed(this.red); + this.c2 = this.c.redSqr(); + this.d = new BN(conf.d, 16).toRed(this.red); + this.dd = this.d.redAdd(this.d); - handleQueue() { - this.queue.forEach((element, index) => { - this.handle(this.queue[index]); - this.queue.splice(index, 1); - }); - } + assert(!this.twisted || this.c.fromRed().cmpn(1) === 0); + this.oneC = (conf.c | 0) === 1; +} +inherits(EdwardsCurve, Base); +module.exports = EdwardsCurve; - setSequence(s) { - if (s && s > this.ws.sequence) this.ws.sequence = s; - } +EdwardsCurve.prototype._mulA = function _mulA(num) { + if (this.mOneA) + return num.redNeg(); + else + return this.a.redMul(num); +}; - handle(packet) { - if (packet.op === Constants.OPCodes.RECONNECT) { - this.setSequence(packet.s); - this.ws.tryReconnect(); - return false; - } +EdwardsCurve.prototype._mulC = function _mulC(num) { + if (this.oneC) + return num; + else + return this.c.redMul(num); +}; - if (packet.op === Constants.OPCodes.INVALID_SESSION) { - this.ws.sessionID = null; - this.ws._sendNewIdentify(); - return false; - } +// Just for compatibility with Short curve +EdwardsCurve.prototype.jpoint = function jpoint(x, y, z, t) { + return this.point(x, y, z, t); +}; - if (packet.op === Constants.OPCodes.HEARTBEAT_ACK) this.ws.client.emit('debug', 'Heartbeat acknowledged'); +EdwardsCurve.prototype.pointFromX = function pointFromX(x, odd) { + x = new BN(x, 16); + if (!x.red) + x = x.toRed(this.red); - if (this.ws.status === Constants.Status.RECONNECTING) { - this.ws.reconnecting = false; - this.ws.checkIfReady(); - } + var x2 = x.redSqr(); + var rhs = this.c2.redSub(this.a.redMul(x2)); + var lhs = this.one.redSub(this.c2.redMul(this.d).redMul(x2)); - this.setSequence(packet.s); + var y2 = rhs.redMul(lhs.redInvm()); + var y = y2.redSqrt(); + if (y.redSqr().redSub(y2).cmp(this.zero) !== 0) + throw new Error('invalid point'); - if (this.ws.disabledEvents[packet.t] !== undefined) return false; + var isOdd = y.fromRed().isOdd(); + if (odd && !isOdd || !odd && isOdd) + y = y.redNeg(); - if (this.ws.status !== Constants.Status.READY) { - if (BeforeReadyWhitelist.indexOf(packet.t) === -1) { - this.queue.push(packet); - return false; - } - } + return this.point(x, y); +}; - if (this.handlers[packet.t]) return this.handlers[packet.t].handle(packet); - return false; - } - } +EdwardsCurve.prototype.pointFromY = function pointFromY(y, odd) { + y = new BN(y, 16); + if (!y.red) + y = y.toRed(this.red); - module.exports = WebSocketPacketManager; + // x^2 = (y^2 - 1) / (d y^2 + 1) + var y2 = y.redSqr(); + var lhs = y2.redSub(this.one); + var rhs = y2.redMul(this.d).redAdd(this.one); + var x2 = lhs.redMul(rhs.redInvm()); + + if (x2.cmp(this.zero) === 0) { + if (odd) + throw new Error('invalid point'); + else + return this.point(this.zero, y); + } + + var x = x2.redSqrt(); + if (x.redSqr().redSub(x2).cmp(this.zero) !== 0) + throw new Error('invalid point'); + + if (x.isOdd() !== odd) + x = x.redNeg(); + + return this.point(x, y); +}; + +EdwardsCurve.prototype.validate = function validate(point) { + if (point.isInfinity()) + return true; + + // Curve: A * X^2 + Y^2 = C^2 * (1 + D * X^2 * Y^2) + point.normalize(); + + var x2 = point.x.redSqr(); + var y2 = point.y.redSqr(); + var lhs = x2.redMul(this.a).redAdd(y2); + var rhs = this.c2.redMul(this.one.redAdd(this.d.redMul(x2).redMul(y2))); + + return lhs.cmp(rhs) === 0; +}; + +function Point(curve, x, y, z, t) { + Base.BasePoint.call(this, curve, 'projective'); + if (x === null && y === null && z === null) { + this.x = this.curve.zero; + this.y = this.curve.one; + this.z = this.curve.one; + this.t = this.curve.zero; + this.zOne = true; + } else { + this.x = new BN(x, 16); + this.y = new BN(y, 16); + this.z = z ? new BN(z, 16) : this.curve.one; + this.t = t && new BN(t, 16); + if (!this.x.red) + this.x = this.x.toRed(this.curve.red); + if (!this.y.red) + this.y = this.y.toRed(this.curve.red); + if (!this.z.red) + this.z = this.z.toRed(this.curve.red); + if (this.t && !this.t.red) + this.t = this.t.toRed(this.curve.red); + this.zOne = this.z === this.curve.one; + + // Use extended coordinates + if (this.curve.extended && !this.t) { + this.t = this.x.redMul(this.y); + if (!this.zOne) + this.t = this.t.redMul(this.z.redInvm()); + } + } +} +inherits(Point, Base.BasePoint); + +EdwardsCurve.prototype.pointFromJSON = function pointFromJSON(obj) { + return Point.fromJSON(this, obj); +}; + +EdwardsCurve.prototype.point = function point(x, y, z, t) { + return new Point(this, x, y, z, t); +}; + +Point.fromJSON = function fromJSON(curve, obj) { + return new Point(curve, obj[0], obj[1], obj[2]); +}; + +Point.prototype.inspect = function inspect() { + if (this.isInfinity()) + return ''; + return ''; +}; + +Point.prototype.isInfinity = function isInfinity() { + // XXX This code assumes that zero is always zero in red + return this.x.cmpn(0) === 0 && + this.y.cmp(this.z) === 0; +}; + +Point.prototype._extDbl = function _extDbl() { + // hyperelliptic.org/EFD/g1p/auto-twisted-extended-1.html + // #doubling-dbl-2008-hwcd + // 4M + 4S + + // A = X1^2 + var a = this.x.redSqr(); + // B = Y1^2 + var b = this.y.redSqr(); + // C = 2 * Z1^2 + var c = this.z.redSqr(); + c = c.redIAdd(c); + // D = a * A + var d = this.curve._mulA(a); + // E = (X1 + Y1)^2 - A - B + var e = this.x.redAdd(this.y).redSqr().redISub(a).redISub(b); + // G = D + B + var g = d.redAdd(b); + // F = G - C + var f = g.redSub(c); + // H = D - B + var h = d.redSub(b); + // X3 = E * F + var nx = e.redMul(f); + // Y3 = G * H + var ny = g.redMul(h); + // T3 = E * H + var nt = e.redMul(h); + // Z3 = F * G + var nz = f.redMul(g); + return this.curve.point(nx, ny, nz, nt); +}; + +Point.prototype._projDbl = function _projDbl() { + // hyperelliptic.org/EFD/g1p/auto-twisted-projective.html + // #doubling-dbl-2008-bbjlp + // #doubling-dbl-2007-bl + // and others + // Generally 3M + 4S or 2M + 4S + + // B = (X1 + Y1)^2 + var b = this.x.redAdd(this.y).redSqr(); + // C = X1^2 + var c = this.x.redSqr(); + // D = Y1^2 + var d = this.y.redSqr(); + + var nx; + var ny; + var nz; + if (this.curve.twisted) { + // E = a * C + var e = this.curve._mulA(c); + // F = E + D + var f = e.redAdd(d); + if (this.zOne) { + // X3 = (B - C - D) * (F - 2) + nx = b.redSub(c).redSub(d).redMul(f.redSub(this.curve.two)); + // Y3 = F * (E - D) + ny = f.redMul(e.redSub(d)); + // Z3 = F^2 - 2 * F + nz = f.redSqr().redSub(f).redSub(f); + } else { + // H = Z1^2 + var h = this.z.redSqr(); + // J = F - 2 * H + var j = f.redSub(h).redISub(h); + // X3 = (B-C-D)*J + nx = b.redSub(c).redISub(d).redMul(j); + // Y3 = F * (E - D) + ny = f.redMul(e.redSub(d)); + // Z3 = F * J + nz = f.redMul(j); + } + } else { + // E = C + D + var e = c.redAdd(d); + // H = (c * Z1)^2 + var h = this.curve._mulC(this.c.redMul(this.z)).redSqr(); + // J = E - 2 * H + var j = e.redSub(h).redSub(h); + // X3 = c * (B - E) * J + nx = this.curve._mulC(b.redISub(e)).redMul(j); + // Y3 = c * E * (C - D) + ny = this.curve._mulC(e).redMul(c.redISub(d)); + // Z3 = E * J + nz = e.redMul(j); + } + return this.curve.point(nx, ny, nz); +}; + +Point.prototype.dbl = function dbl() { + if (this.isInfinity()) + return this; + + // Double in extended coordinates + if (this.curve.extended) + return this._extDbl(); + else + return this._projDbl(); +}; + +Point.prototype._extAdd = function _extAdd(p) { + // hyperelliptic.org/EFD/g1p/auto-twisted-extended-1.html + // #addition-add-2008-hwcd-3 + // 8M + + // A = (Y1 - X1) * (Y2 - X2) + var a = this.y.redSub(this.x).redMul(p.y.redSub(p.x)); + // B = (Y1 + X1) * (Y2 + X2) + var b = this.y.redAdd(this.x).redMul(p.y.redAdd(p.x)); + // C = T1 * k * T2 + var c = this.t.redMul(this.curve.dd).redMul(p.t); + // D = Z1 * 2 * Z2 + var d = this.z.redMul(p.z.redAdd(p.z)); + // E = B - A + var e = b.redSub(a); + // F = D - C + var f = d.redSub(c); + // G = D + C + var g = d.redAdd(c); + // H = B + A + var h = b.redAdd(a); + // X3 = E * F + var nx = e.redMul(f); + // Y3 = G * H + var ny = g.redMul(h); + // T3 = E * H + var nt = e.redMul(h); + // Z3 = F * G + var nz = f.redMul(g); + return this.curve.point(nx, ny, nz, nt); +}; + +Point.prototype._projAdd = function _projAdd(p) { + // hyperelliptic.org/EFD/g1p/auto-twisted-projective.html + // #addition-add-2008-bbjlp + // #addition-add-2007-bl + // 10M + 1S + + // A = Z1 * Z2 + var a = this.z.redMul(p.z); + // B = A^2 + var b = a.redSqr(); + // C = X1 * X2 + var c = this.x.redMul(p.x); + // D = Y1 * Y2 + var d = this.y.redMul(p.y); + // E = d * C * D + var e = this.curve.d.redMul(c).redMul(d); + // F = B - E + var f = b.redSub(e); + // G = B + E + var g = b.redAdd(e); + // X3 = A * F * ((X1 + Y1) * (X2 + Y2) - C - D) + var tmp = this.x.redAdd(this.y).redMul(p.x.redAdd(p.y)).redISub(c).redISub(d); + var nx = a.redMul(f).redMul(tmp); + var ny; + var nz; + if (this.curve.twisted) { + // Y3 = A * G * (D - a * C) + ny = a.redMul(g).redMul(d.redSub(this.curve._mulA(c))); + // Z3 = F * G + nz = f.redMul(g); + } else { + // Y3 = A * G * (D - C) + ny = a.redMul(g).redMul(d.redSub(c)); + // Z3 = c * F * G + nz = this.curve._mulC(f).redMul(g); + } + return this.curve.point(nx, ny, nz); +}; + +Point.prototype.add = function add(p) { + if (this.isInfinity()) + return p; + if (p.isInfinity()) + return this; + + if (this.curve.extended) + return this._extAdd(p); + else + return this._projAdd(p); +}; + +Point.prototype.mul = function mul(k) { + if (this._hasDoubles(k)) + return this.curve._fixedNafMul(this, k); + else + return this.curve._wnafMul(this, k); +}; + +Point.prototype.mulAdd = function mulAdd(k1, p, k2) { + return this.curve._wnafMulAdd(1, [ this, p ], [ k1, k2 ], 2, false); +}; + +Point.prototype.jmulAdd = function jmulAdd(k1, p, k2) { + return this.curve._wnafMulAdd(1, [ this, p ], [ k1, k2 ], 2, true); +}; + +Point.prototype.normalize = function normalize() { + if (this.zOne) + return this; + + // Normalize coordinates + var zi = this.z.redInvm(); + this.x = this.x.redMul(zi); + this.y = this.y.redMul(zi); + if (this.t) + this.t = this.t.redMul(zi); + this.z = this.curve.one; + this.zOne = true; + return this; +}; + +Point.prototype.neg = function neg() { + return this.curve.point(this.x.redNeg(), + this.y, + this.z, + this.t && this.t.redNeg()); +}; + +Point.prototype.getX = function getX() { + this.normalize(); + return this.x.fromRed(); +}; + +Point.prototype.getY = function getY() { + this.normalize(); + return this.y.fromRed(); +}; + +Point.prototype.eq = function eq(other) { + return this === other || + this.getX().cmp(other.getX()) === 0 && + this.getY().cmp(other.getY()) === 0; +}; + +Point.prototype.eqXToP = function eqXToP(x) { + var rx = x.toRed(this.curve.red).redMul(this.z); + if (this.x.cmp(rx) === 0) + return true; + + var xc = x.clone(); + var t = this.curve.redN.redMul(this.z); + for (;;) { + xc.iadd(this.curve.n); + if (xc.cmp(this.curve.p) >= 0) + return false; + + rx.redIAdd(t); + if (this.x.cmp(rx) === 0) + return true; + } + return false; +}; + +// Compatibility with BaseCurve +Point.prototype.toP = Point.prototype.normalize; +Point.prototype.mixedAdd = Point.prototype.add; /***/ }, /* 179 */ /***/ function(module, exports, __webpack_require__) { - var map = { - "./WebSocketPacketManager": 178, - "./WebSocketPacketManager.js": 178, - "./handlers/AbstractHandler": 180, - "./handlers/AbstractHandler.js": 180, - "./handlers/ChannelCreate": 181, - "./handlers/ChannelCreate.js": 181, - "./handlers/ChannelDelete": 182, - "./handlers/ChannelDelete.js": 182, - "./handlers/ChannelPinsUpdate": 183, - "./handlers/ChannelPinsUpdate.js": 183, - "./handlers/ChannelUpdate": 184, - "./handlers/ChannelUpdate.js": 184, - "./handlers/GuildBanAdd": 185, - "./handlers/GuildBanAdd.js": 185, - "./handlers/GuildBanRemove": 186, - "./handlers/GuildBanRemove.js": 186, - "./handlers/GuildCreate": 187, - "./handlers/GuildCreate.js": 187, - "./handlers/GuildDelete": 188, - "./handlers/GuildDelete.js": 188, - "./handlers/GuildEmojiUpdate": 189, - "./handlers/GuildEmojiUpdate.js": 189, - "./handlers/GuildMemberAdd": 190, - "./handlers/GuildMemberAdd.js": 190, - "./handlers/GuildMemberRemove": 191, - "./handlers/GuildMemberRemove.js": 191, - "./handlers/GuildMemberUpdate": 192, - "./handlers/GuildMemberUpdate.js": 192, - "./handlers/GuildMembersChunk": 193, - "./handlers/GuildMembersChunk.js": 193, - "./handlers/GuildRoleCreate": 194, - "./handlers/GuildRoleCreate.js": 194, - "./handlers/GuildRoleDelete": 195, - "./handlers/GuildRoleDelete.js": 195, - "./handlers/GuildRoleUpdate": 196, - "./handlers/GuildRoleUpdate.js": 196, - "./handlers/GuildSync": 197, - "./handlers/GuildSync.js": 197, - "./handlers/GuildUpdate": 198, - "./handlers/GuildUpdate.js": 198, - "./handlers/MessageCreate": 199, - "./handlers/MessageCreate.js": 199, - "./handlers/MessageDelete": 200, - "./handlers/MessageDelete.js": 200, - "./handlers/MessageDeleteBulk": 201, - "./handlers/MessageDeleteBulk.js": 201, - "./handlers/MessageReactionAdd": 202, - "./handlers/MessageReactionAdd.js": 202, - "./handlers/MessageReactionRemove": 203, - "./handlers/MessageReactionRemove.js": 203, - "./handlers/MessageReactionRemoveAll": 204, - "./handlers/MessageReactionRemoveAll.js": 204, - "./handlers/MessageUpdate": 205, - "./handlers/MessageUpdate.js": 205, - "./handlers/PresenceUpdate": 206, - "./handlers/PresenceUpdate.js": 206, - "./handlers/Ready": 207, - "./handlers/Ready.js": 207, - "./handlers/RelationshipAdd": 209, - "./handlers/RelationshipAdd.js": 209, - "./handlers/RelationshipRemove": 210, - "./handlers/RelationshipRemove.js": 210, - "./handlers/TypingStart": 211, - "./handlers/TypingStart.js": 211, - "./handlers/UserNoteUpdate": 212, - "./handlers/UserNoteUpdate.js": 212, - "./handlers/UserUpdate": 213, - "./handlers/UserUpdate.js": 213, - "./handlers/VoiceServerUpdate": 214, - "./handlers/VoiceServerUpdate.js": 214, - "./handlers/VoiceStateUpdate": 215, - "./handlers/VoiceStateUpdate.js": 215 - }; - function webpackContext(req) { - return __webpack_require__(webpackContextResolve(req)); - }; - function webpackContextResolve(req) { - return map[req] || (function() { throw new Error("Cannot find module '" + req + "'.") }()); - }; - webpackContext.keys = function webpackContextKeys() { - return Object.keys(map); - }; - webpackContext.resolve = webpackContextResolve; - module.exports = webpackContext; - webpackContext.id = 179; +"use strict"; +'use strict'; + +var curve = __webpack_require__(36); +var BN = __webpack_require__(4); +var inherits = __webpack_require__(1); +var Base = curve.base; + +var elliptic = __webpack_require__(7); +var utils = elliptic.utils; + +function MontCurve(conf) { + Base.call(this, 'mont', conf); + + this.a = new BN(conf.a, 16).toRed(this.red); + this.b = new BN(conf.b, 16).toRed(this.red); + this.i4 = new BN(4).toRed(this.red).redInvm(); + this.two = new BN(2).toRed(this.red); + this.a24 = this.i4.redMul(this.a.redAdd(this.two)); +} +inherits(MontCurve, Base); +module.exports = MontCurve; + +MontCurve.prototype.validate = function validate(point) { + var x = point.normalize().x; + var x2 = x.redSqr(); + var rhs = x2.redMul(x).redAdd(x2.redMul(this.a)).redAdd(x); + var y = rhs.redSqrt(); + + return y.redSqr().cmp(rhs) === 0; +}; + +function Point(curve, x, z) { + Base.BasePoint.call(this, curve, 'projective'); + if (x === null && z === null) { + this.x = this.curve.one; + this.z = this.curve.zero; + } else { + this.x = new BN(x, 16); + this.z = new BN(z, 16); + if (!this.x.red) + this.x = this.x.toRed(this.curve.red); + if (!this.z.red) + this.z = this.z.toRed(this.curve.red); + } +} +inherits(Point, Base.BasePoint); + +MontCurve.prototype.decodePoint = function decodePoint(bytes, enc) { + return this.point(utils.toArray(bytes, enc), 1); +}; + +MontCurve.prototype.point = function point(x, z) { + return new Point(this, x, z); +}; + +MontCurve.prototype.pointFromJSON = function pointFromJSON(obj) { + return Point.fromJSON(this, obj); +}; + +Point.prototype.precompute = function precompute() { + // No-op +}; + +Point.prototype._encode = function _encode() { + return this.getX().toArray('be', this.curve.p.byteLength()); +}; + +Point.fromJSON = function fromJSON(curve, obj) { + return new Point(curve, obj[0], obj[1] || curve.one); +}; + +Point.prototype.inspect = function inspect() { + if (this.isInfinity()) + return ''; + return ''; +}; + +Point.prototype.isInfinity = function isInfinity() { + // XXX This code assumes that zero is always zero in red + return this.z.cmpn(0) === 0; +}; + +Point.prototype.dbl = function dbl() { + // http://hyperelliptic.org/EFD/g1p/auto-montgom-xz.html#doubling-dbl-1987-m-3 + // 2M + 2S + 4A + + // A = X1 + Z1 + var a = this.x.redAdd(this.z); + // AA = A^2 + var aa = a.redSqr(); + // B = X1 - Z1 + var b = this.x.redSub(this.z); + // BB = B^2 + var bb = b.redSqr(); + // C = AA - BB + var c = aa.redSub(bb); + // X3 = AA * BB + var nx = aa.redMul(bb); + // Z3 = C * (BB + A24 * C) + var nz = c.redMul(bb.redAdd(this.curve.a24.redMul(c))); + return this.curve.point(nx, nz); +}; + +Point.prototype.add = function add() { + throw new Error('Not supported on Montgomery curve'); +}; + +Point.prototype.diffAdd = function diffAdd(p, diff) { + // http://hyperelliptic.org/EFD/g1p/auto-montgom-xz.html#diffadd-dadd-1987-m-3 + // 4M + 2S + 6A + + // A = X2 + Z2 + var a = this.x.redAdd(this.z); + // B = X2 - Z2 + var b = this.x.redSub(this.z); + // C = X3 + Z3 + var c = p.x.redAdd(p.z); + // D = X3 - Z3 + var d = p.x.redSub(p.z); + // DA = D * A + var da = d.redMul(a); + // CB = C * B + var cb = c.redMul(b); + // X5 = Z1 * (DA + CB)^2 + var nx = diff.z.redMul(da.redAdd(cb).redSqr()); + // Z5 = X1 * (DA - CB)^2 + var nz = diff.x.redMul(da.redISub(cb).redSqr()); + return this.curve.point(nx, nz); +}; + +Point.prototype.mul = function mul(k) { + var t = k.clone(); + var a = this; // (N / 2) * Q + Q + var b = this.curve.point(null, null); // (N / 2) * Q + var c = this; // Q + + for (var bits = []; t.cmpn(0) !== 0; t.iushrn(1)) + bits.push(t.andln(1)); + + for (var i = bits.length - 1; i >= 0; i--) { + if (bits[i] === 0) { + // N * Q + Q = ((N / 2) * Q + Q)) + (N / 2) * Q + a = a.diffAdd(b, c); + // N * Q = 2 * ((N / 2) * Q + Q)) + b = b.dbl(); + } else { + // N * Q = ((N / 2) * Q + Q) + ((N / 2) * Q) + b = a.diffAdd(b, c); + // N * Q + Q = 2 * ((N / 2) * Q + Q) + a = a.dbl(); + } + } + return b; +}; + +Point.prototype.mulAdd = function mulAdd() { + throw new Error('Not supported on Montgomery curve'); +}; + +Point.prototype.jumlAdd = function jumlAdd() { + throw new Error('Not supported on Montgomery curve'); +}; + +Point.prototype.eq = function eq(other) { + return this.getX().cmp(other.getX()) === 0; +}; + +Point.prototype.normalize = function normalize() { + this.x = this.x.redMul(this.z.redInvm()); + this.z = this.curve.one; + return this; +}; + +Point.prototype.getX = function getX() { + // Normalize coordinates + this.normalize(); + + return this.x.fromRed(); +}; /***/ }, /* 180 */ -/***/ function(module, exports) { +/***/ function(module, exports, __webpack_require__) { - class AbstractHandler { - constructor(packetManager) { - this.packetManager = packetManager; - } +"use strict"; +'use strict'; - handle(packet) { - return packet; - } - } +var curve = __webpack_require__(36); +var elliptic = __webpack_require__(7); +var BN = __webpack_require__(4); +var inherits = __webpack_require__(1); +var Base = curve.base; - module.exports = AbstractHandler; +var assert = elliptic.utils.assert; + +function ShortCurve(conf) { + Base.call(this, 'short', conf); + + this.a = new BN(conf.a, 16).toRed(this.red); + this.b = new BN(conf.b, 16).toRed(this.red); + this.tinv = this.two.redInvm(); + + this.zeroA = this.a.fromRed().cmpn(0) === 0; + this.threeA = this.a.fromRed().sub(this.p).cmpn(-3) === 0; + + // If the curve is endomorphic, precalculate beta and lambda + this.endo = this._getEndomorphism(conf); + this._endoWnafT1 = new Array(4); + this._endoWnafT2 = new Array(4); +} +inherits(ShortCurve, Base); +module.exports = ShortCurve; + +ShortCurve.prototype._getEndomorphism = function _getEndomorphism(conf) { + // No efficient endomorphism + if (!this.zeroA || !this.g || !this.n || this.p.modn(3) !== 1) + return; + + // Compute beta and lambda, that lambda * P = (beta * Px; Py) + var beta; + var lambda; + if (conf.beta) { + beta = new BN(conf.beta, 16).toRed(this.red); + } else { + var betas = this._getEndoRoots(this.p); + // Choose the smallest beta + beta = betas[0].cmp(betas[1]) < 0 ? betas[0] : betas[1]; + beta = beta.toRed(this.red); + } + if (conf.lambda) { + lambda = new BN(conf.lambda, 16); + } else { + // Choose the lambda that is matching selected beta + var lambdas = this._getEndoRoots(this.n); + if (this.g.mul(lambdas[0]).x.cmp(this.g.x.redMul(beta)) === 0) { + lambda = lambdas[0]; + } else { + lambda = lambdas[1]; + assert(this.g.mul(lambda).x.cmp(this.g.x.redMul(beta)) === 0); + } + } + + // Get basis vectors, used for balanced length-two representation + var basis; + if (conf.basis) { + basis = conf.basis.map(function(vec) { + return { + a: new BN(vec.a, 16), + b: new BN(vec.b, 16) + }; + }); + } else { + basis = this._getEndoBasis(lambda); + } + + return { + beta: beta, + lambda: lambda, + basis: basis + }; +}; + +ShortCurve.prototype._getEndoRoots = function _getEndoRoots(num) { + // Find roots of for x^2 + x + 1 in F + // Root = (-1 +- Sqrt(-3)) / 2 + // + var red = num === this.p ? this.red : BN.mont(num); + var tinv = new BN(2).toRed(red).redInvm(); + var ntinv = tinv.redNeg(); + + var s = new BN(3).toRed(red).redNeg().redSqrt().redMul(tinv); + + var l1 = ntinv.redAdd(s).fromRed(); + var l2 = ntinv.redSub(s).fromRed(); + return [ l1, l2 ]; +}; + +ShortCurve.prototype._getEndoBasis = function _getEndoBasis(lambda) { + // aprxSqrt >= sqrt(this.n) + var aprxSqrt = this.n.ushrn(Math.floor(this.n.bitLength() / 2)); + + // 3.74 + // Run EGCD, until r(L + 1) < aprxSqrt + var u = lambda; + var v = this.n.clone(); + var x1 = new BN(1); + var y1 = new BN(0); + var x2 = new BN(0); + var y2 = new BN(1); + + // NOTE: all vectors are roots of: a + b * lambda = 0 (mod n) + var a0; + var b0; + // First vector + var a1; + var b1; + // Second vector + var a2; + var b2; + + var prevR; + var i = 0; + var r; + var x; + while (u.cmpn(0) !== 0) { + var q = v.div(u); + r = v.sub(q.mul(u)); + x = x2.sub(q.mul(x1)); + var y = y2.sub(q.mul(y1)); + + if (!a1 && r.cmp(aprxSqrt) < 0) { + a0 = prevR.neg(); + b0 = x1; + a1 = r.neg(); + b1 = x; + } else if (a1 && ++i === 2) { + break; + } + prevR = r; + + v = u; + u = r; + x2 = x1; + x1 = x; + y2 = y1; + y1 = y; + } + a2 = r.neg(); + b2 = x; + + var len1 = a1.sqr().add(b1.sqr()); + var len2 = a2.sqr().add(b2.sqr()); + if (len2.cmp(len1) >= 0) { + a2 = a0; + b2 = b0; + } + + // Normalize signs + if (a1.negative) { + a1 = a1.neg(); + b1 = b1.neg(); + } + if (a2.negative) { + a2 = a2.neg(); + b2 = b2.neg(); + } + + return [ + { a: a1, b: b1 }, + { a: a2, b: b2 } + ]; +}; + +ShortCurve.prototype._endoSplit = function _endoSplit(k) { + var basis = this.endo.basis; + var v1 = basis[0]; + var v2 = basis[1]; + + var c1 = v2.b.mul(k).divRound(this.n); + var c2 = v1.b.neg().mul(k).divRound(this.n); + + var p1 = c1.mul(v1.a); + var p2 = c2.mul(v2.a); + var q1 = c1.mul(v1.b); + var q2 = c2.mul(v2.b); + + // Calculate answer + var k1 = k.sub(p1).sub(p2); + var k2 = q1.add(q2).neg(); + return { k1: k1, k2: k2 }; +}; + +ShortCurve.prototype.pointFromX = function pointFromX(x, odd) { + x = new BN(x, 16); + if (!x.red) + x = x.toRed(this.red); + + var y2 = x.redSqr().redMul(x).redIAdd(x.redMul(this.a)).redIAdd(this.b); + var y = y2.redSqrt(); + if (y.redSqr().redSub(y2).cmp(this.zero) !== 0) + throw new Error('invalid point'); + + // XXX Is there any way to tell if the number is odd without converting it + // to non-red form? + var isOdd = y.fromRed().isOdd(); + if (odd && !isOdd || !odd && isOdd) + y = y.redNeg(); + + return this.point(x, y); +}; + +ShortCurve.prototype.validate = function validate(point) { + if (point.inf) + return true; + + var x = point.x; + var y = point.y; + + var ax = this.a.redMul(x); + var rhs = x.redSqr().redMul(x).redIAdd(ax).redIAdd(this.b); + return y.redSqr().redISub(rhs).cmpn(0) === 0; +}; + +ShortCurve.prototype._endoWnafMulAdd = + function _endoWnafMulAdd(points, coeffs, jacobianResult) { + var npoints = this._endoWnafT1; + var ncoeffs = this._endoWnafT2; + for (var i = 0; i < points.length; i++) { + var split = this._endoSplit(coeffs[i]); + var p = points[i]; + var beta = p._getBeta(); + + if (split.k1.negative) { + split.k1.ineg(); + p = p.neg(true); + } + if (split.k2.negative) { + split.k2.ineg(); + beta = beta.neg(true); + } + + npoints[i * 2] = p; + npoints[i * 2 + 1] = beta; + ncoeffs[i * 2] = split.k1; + ncoeffs[i * 2 + 1] = split.k2; + } + var res = this._wnafMulAdd(1, npoints, ncoeffs, i * 2, jacobianResult); + + // Clean-up references to points and coefficients + for (var j = 0; j < i * 2; j++) { + npoints[j] = null; + ncoeffs[j] = null; + } + return res; +}; + +function Point(curve, x, y, isRed) { + Base.BasePoint.call(this, curve, 'affine'); + if (x === null && y === null) { + this.x = null; + this.y = null; + this.inf = true; + } else { + this.x = new BN(x, 16); + this.y = new BN(y, 16); + // Force redgomery representation when loading from JSON + if (isRed) { + this.x.forceRed(this.curve.red); + this.y.forceRed(this.curve.red); + } + if (!this.x.red) + this.x = this.x.toRed(this.curve.red); + if (!this.y.red) + this.y = this.y.toRed(this.curve.red); + this.inf = false; + } +} +inherits(Point, Base.BasePoint); + +ShortCurve.prototype.point = function point(x, y, isRed) { + return new Point(this, x, y, isRed); +}; + +ShortCurve.prototype.pointFromJSON = function pointFromJSON(obj, red) { + return Point.fromJSON(this, obj, red); +}; + +Point.prototype._getBeta = function _getBeta() { + if (!this.curve.endo) + return; + + var pre = this.precomputed; + if (pre && pre.beta) + return pre.beta; + + var beta = this.curve.point(this.x.redMul(this.curve.endo.beta), this.y); + if (pre) { + var curve = this.curve; + var endoMul = function(p) { + return curve.point(p.x.redMul(curve.endo.beta), p.y); + }; + pre.beta = beta; + beta.precomputed = { + beta: null, + naf: pre.naf && { + wnd: pre.naf.wnd, + points: pre.naf.points.map(endoMul) + }, + doubles: pre.doubles && { + step: pre.doubles.step, + points: pre.doubles.points.map(endoMul) + } + }; + } + return beta; +}; + +Point.prototype.toJSON = function toJSON() { + if (!this.precomputed) + return [ this.x, this.y ]; + + return [ this.x, this.y, this.precomputed && { + doubles: this.precomputed.doubles && { + step: this.precomputed.doubles.step, + points: this.precomputed.doubles.points.slice(1) + }, + naf: this.precomputed.naf && { + wnd: this.precomputed.naf.wnd, + points: this.precomputed.naf.points.slice(1) + } + } ]; +}; + +Point.fromJSON = function fromJSON(curve, obj, red) { + if (typeof obj === 'string') + obj = JSON.parse(obj); + var res = curve.point(obj[0], obj[1], red); + if (!obj[2]) + return res; + + function obj2point(obj) { + return curve.point(obj[0], obj[1], red); + } + + var pre = obj[2]; + res.precomputed = { + beta: null, + doubles: pre.doubles && { + step: pre.doubles.step, + points: [ res ].concat(pre.doubles.points.map(obj2point)) + }, + naf: pre.naf && { + wnd: pre.naf.wnd, + points: [ res ].concat(pre.naf.points.map(obj2point)) + } + }; + return res; +}; + +Point.prototype.inspect = function inspect() { + if (this.isInfinity()) + return ''; + return ''; +}; + +Point.prototype.isInfinity = function isInfinity() { + return this.inf; +}; + +Point.prototype.add = function add(p) { + // O + P = P + if (this.inf) + return p; + + // P + O = P + if (p.inf) + return this; + + // P + P = 2P + if (this.eq(p)) + return this.dbl(); + + // P + (-P) = O + if (this.neg().eq(p)) + return this.curve.point(null, null); + + // P + Q = O + if (this.x.cmp(p.x) === 0) + return this.curve.point(null, null); + + var c = this.y.redSub(p.y); + if (c.cmpn(0) !== 0) + c = c.redMul(this.x.redSub(p.x).redInvm()); + var nx = c.redSqr().redISub(this.x).redISub(p.x); + var ny = c.redMul(this.x.redSub(nx)).redISub(this.y); + return this.curve.point(nx, ny); +}; + +Point.prototype.dbl = function dbl() { + if (this.inf) + return this; + + // 2P = O + var ys1 = this.y.redAdd(this.y); + if (ys1.cmpn(0) === 0) + return this.curve.point(null, null); + + var a = this.curve.a; + + var x2 = this.x.redSqr(); + var dyinv = ys1.redInvm(); + var c = x2.redAdd(x2).redIAdd(x2).redIAdd(a).redMul(dyinv); + + var nx = c.redSqr().redISub(this.x.redAdd(this.x)); + var ny = c.redMul(this.x.redSub(nx)).redISub(this.y); + return this.curve.point(nx, ny); +}; + +Point.prototype.getX = function getX() { + return this.x.fromRed(); +}; + +Point.prototype.getY = function getY() { + return this.y.fromRed(); +}; + +Point.prototype.mul = function mul(k) { + k = new BN(k, 16); + + if (this._hasDoubles(k)) + return this.curve._fixedNafMul(this, k); + else if (this.curve.endo) + return this.curve._endoWnafMulAdd([ this ], [ k ]); + else + return this.curve._wnafMul(this, k); +}; + +Point.prototype.mulAdd = function mulAdd(k1, p2, k2) { + var points = [ this, p2 ]; + var coeffs = [ k1, k2 ]; + if (this.curve.endo) + return this.curve._endoWnafMulAdd(points, coeffs); + else + return this.curve._wnafMulAdd(1, points, coeffs, 2); +}; + +Point.prototype.jmulAdd = function jmulAdd(k1, p2, k2) { + var points = [ this, p2 ]; + var coeffs = [ k1, k2 ]; + if (this.curve.endo) + return this.curve._endoWnafMulAdd(points, coeffs, true); + else + return this.curve._wnafMulAdd(1, points, coeffs, 2, true); +}; + +Point.prototype.eq = function eq(p) { + return this === p || + this.inf === p.inf && + (this.inf || this.x.cmp(p.x) === 0 && this.y.cmp(p.y) === 0); +}; + +Point.prototype.neg = function neg(_precompute) { + if (this.inf) + return this; + + var res = this.curve.point(this.x, this.y.redNeg()); + if (_precompute && this.precomputed) { + var pre = this.precomputed; + var negate = function(p) { + return p.neg(); + }; + res.precomputed = { + naf: pre.naf && { + wnd: pre.naf.wnd, + points: pre.naf.points.map(negate) + }, + doubles: pre.doubles && { + step: pre.doubles.step, + points: pre.doubles.points.map(negate) + } + }; + } + return res; +}; + +Point.prototype.toJ = function toJ() { + if (this.inf) + return this.curve.jpoint(null, null, null); + + var res = this.curve.jpoint(this.x, this.y, this.curve.one); + return res; +}; + +function JPoint(curve, x, y, z) { + Base.BasePoint.call(this, curve, 'jacobian'); + if (x === null && y === null && z === null) { + this.x = this.curve.one; + this.y = this.curve.one; + this.z = new BN(0); + } else { + this.x = new BN(x, 16); + this.y = new BN(y, 16); + this.z = new BN(z, 16); + } + if (!this.x.red) + this.x = this.x.toRed(this.curve.red); + if (!this.y.red) + this.y = this.y.toRed(this.curve.red); + if (!this.z.red) + this.z = this.z.toRed(this.curve.red); + + this.zOne = this.z === this.curve.one; +} +inherits(JPoint, Base.BasePoint); + +ShortCurve.prototype.jpoint = function jpoint(x, y, z) { + return new JPoint(this, x, y, z); +}; + +JPoint.prototype.toP = function toP() { + if (this.isInfinity()) + return this.curve.point(null, null); + + var zinv = this.z.redInvm(); + var zinv2 = zinv.redSqr(); + var ax = this.x.redMul(zinv2); + var ay = this.y.redMul(zinv2).redMul(zinv); + + return this.curve.point(ax, ay); +}; + +JPoint.prototype.neg = function neg() { + return this.curve.jpoint(this.x, this.y.redNeg(), this.z); +}; + +JPoint.prototype.add = function add(p) { + // O + P = P + if (this.isInfinity()) + return p; + + // P + O = P + if (p.isInfinity()) + return this; + + // 12M + 4S + 7A + var pz2 = p.z.redSqr(); + var z2 = this.z.redSqr(); + var u1 = this.x.redMul(pz2); + var u2 = p.x.redMul(z2); + var s1 = this.y.redMul(pz2.redMul(p.z)); + var s2 = p.y.redMul(z2.redMul(this.z)); + + var h = u1.redSub(u2); + var r = s1.redSub(s2); + if (h.cmpn(0) === 0) { + if (r.cmpn(0) !== 0) + return this.curve.jpoint(null, null, null); + else + return this.dbl(); + } + + var h2 = h.redSqr(); + var h3 = h2.redMul(h); + var v = u1.redMul(h2); + + var nx = r.redSqr().redIAdd(h3).redISub(v).redISub(v); + var ny = r.redMul(v.redISub(nx)).redISub(s1.redMul(h3)); + var nz = this.z.redMul(p.z).redMul(h); + + return this.curve.jpoint(nx, ny, nz); +}; + +JPoint.prototype.mixedAdd = function mixedAdd(p) { + // O + P = P + if (this.isInfinity()) + return p.toJ(); + + // P + O = P + if (p.isInfinity()) + return this; + + // 8M + 3S + 7A + var z2 = this.z.redSqr(); + var u1 = this.x; + var u2 = p.x.redMul(z2); + var s1 = this.y; + var s2 = p.y.redMul(z2).redMul(this.z); + + var h = u1.redSub(u2); + var r = s1.redSub(s2); + if (h.cmpn(0) === 0) { + if (r.cmpn(0) !== 0) + return this.curve.jpoint(null, null, null); + else + return this.dbl(); + } + + var h2 = h.redSqr(); + var h3 = h2.redMul(h); + var v = u1.redMul(h2); + + var nx = r.redSqr().redIAdd(h3).redISub(v).redISub(v); + var ny = r.redMul(v.redISub(nx)).redISub(s1.redMul(h3)); + var nz = this.z.redMul(h); + + return this.curve.jpoint(nx, ny, nz); +}; + +JPoint.prototype.dblp = function dblp(pow) { + if (pow === 0) + return this; + if (this.isInfinity()) + return this; + if (!pow) + return this.dbl(); + + if (this.curve.zeroA || this.curve.threeA) { + var r = this; + for (var i = 0; i < pow; i++) + r = r.dbl(); + return r; + } + + // 1M + 2S + 1A + N * (4S + 5M + 8A) + // N = 1 => 6M + 6S + 9A + var a = this.curve.a; + var tinv = this.curve.tinv; + + var jx = this.x; + var jy = this.y; + var jz = this.z; + var jz4 = jz.redSqr().redSqr(); + + // Reuse results + var jyd = jy.redAdd(jy); + for (var i = 0; i < pow; i++) { + var jx2 = jx.redSqr(); + var jyd2 = jyd.redSqr(); + var jyd4 = jyd2.redSqr(); + var c = jx2.redAdd(jx2).redIAdd(jx2).redIAdd(a.redMul(jz4)); + + var t1 = jx.redMul(jyd2); + var nx = c.redSqr().redISub(t1.redAdd(t1)); + var t2 = t1.redISub(nx); + var dny = c.redMul(t2); + dny = dny.redIAdd(dny).redISub(jyd4); + var nz = jyd.redMul(jz); + if (i + 1 < pow) + jz4 = jz4.redMul(jyd4); + + jx = nx; + jz = nz; + jyd = dny; + } + + return this.curve.jpoint(jx, jyd.redMul(tinv), jz); +}; + +JPoint.prototype.dbl = function dbl() { + if (this.isInfinity()) + return this; + + if (this.curve.zeroA) + return this._zeroDbl(); + else if (this.curve.threeA) + return this._threeDbl(); + else + return this._dbl(); +}; + +JPoint.prototype._zeroDbl = function _zeroDbl() { + var nx; + var ny; + var nz; + // Z = 1 + if (this.zOne) { + // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html + // #doubling-mdbl-2007-bl + // 1M + 5S + 14A + + // XX = X1^2 + var xx = this.x.redSqr(); + // YY = Y1^2 + var yy = this.y.redSqr(); + // YYYY = YY^2 + var yyyy = yy.redSqr(); + // S = 2 * ((X1 + YY)^2 - XX - YYYY) + var s = this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy); + s = s.redIAdd(s); + // M = 3 * XX + a; a = 0 + var m = xx.redAdd(xx).redIAdd(xx); + // T = M ^ 2 - 2*S + var t = m.redSqr().redISub(s).redISub(s); + + // 8 * YYYY + var yyyy8 = yyyy.redIAdd(yyyy); + yyyy8 = yyyy8.redIAdd(yyyy8); + yyyy8 = yyyy8.redIAdd(yyyy8); + + // X3 = T + nx = t; + // Y3 = M * (S - T) - 8 * YYYY + ny = m.redMul(s.redISub(t)).redISub(yyyy8); + // Z3 = 2*Y1 + nz = this.y.redAdd(this.y); + } else { + // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html + // #doubling-dbl-2009-l + // 2M + 5S + 13A + + // A = X1^2 + var a = this.x.redSqr(); + // B = Y1^2 + var b = this.y.redSqr(); + // C = B^2 + var c = b.redSqr(); + // D = 2 * ((X1 + B)^2 - A - C) + var d = this.x.redAdd(b).redSqr().redISub(a).redISub(c); + d = d.redIAdd(d); + // E = 3 * A + var e = a.redAdd(a).redIAdd(a); + // F = E^2 + var f = e.redSqr(); + + // 8 * C + var c8 = c.redIAdd(c); + c8 = c8.redIAdd(c8); + c8 = c8.redIAdd(c8); + + // X3 = F - 2 * D + nx = f.redISub(d).redISub(d); + // Y3 = E * (D - X3) - 8 * C + ny = e.redMul(d.redISub(nx)).redISub(c8); + // Z3 = 2 * Y1 * Z1 + nz = this.y.redMul(this.z); + nz = nz.redIAdd(nz); + } + + return this.curve.jpoint(nx, ny, nz); +}; + +JPoint.prototype._threeDbl = function _threeDbl() { + var nx; + var ny; + var nz; + // Z = 1 + if (this.zOne) { + // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html + // #doubling-mdbl-2007-bl + // 1M + 5S + 15A + + // XX = X1^2 + var xx = this.x.redSqr(); + // YY = Y1^2 + var yy = this.y.redSqr(); + // YYYY = YY^2 + var yyyy = yy.redSqr(); + // S = 2 * ((X1 + YY)^2 - XX - YYYY) + var s = this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy); + s = s.redIAdd(s); + // M = 3 * XX + a + var m = xx.redAdd(xx).redIAdd(xx).redIAdd(this.curve.a); + // T = M^2 - 2 * S + var t = m.redSqr().redISub(s).redISub(s); + // X3 = T + nx = t; + // Y3 = M * (S - T) - 8 * YYYY + var yyyy8 = yyyy.redIAdd(yyyy); + yyyy8 = yyyy8.redIAdd(yyyy8); + yyyy8 = yyyy8.redIAdd(yyyy8); + ny = m.redMul(s.redISub(t)).redISub(yyyy8); + // Z3 = 2 * Y1 + nz = this.y.redAdd(this.y); + } else { + // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-3.html#doubling-dbl-2001-b + // 3M + 5S + + // delta = Z1^2 + var delta = this.z.redSqr(); + // gamma = Y1^2 + var gamma = this.y.redSqr(); + // beta = X1 * gamma + var beta = this.x.redMul(gamma); + // alpha = 3 * (X1 - delta) * (X1 + delta) + var alpha = this.x.redSub(delta).redMul(this.x.redAdd(delta)); + alpha = alpha.redAdd(alpha).redIAdd(alpha); + // X3 = alpha^2 - 8 * beta + var beta4 = beta.redIAdd(beta); + beta4 = beta4.redIAdd(beta4); + var beta8 = beta4.redAdd(beta4); + nx = alpha.redSqr().redISub(beta8); + // Z3 = (Y1 + Z1)^2 - gamma - delta + nz = this.y.redAdd(this.z).redSqr().redISub(gamma).redISub(delta); + // Y3 = alpha * (4 * beta - X3) - 8 * gamma^2 + var ggamma8 = gamma.redSqr(); + ggamma8 = ggamma8.redIAdd(ggamma8); + ggamma8 = ggamma8.redIAdd(ggamma8); + ggamma8 = ggamma8.redIAdd(ggamma8); + ny = alpha.redMul(beta4.redISub(nx)).redISub(ggamma8); + } + + return this.curve.jpoint(nx, ny, nz); +}; + +JPoint.prototype._dbl = function _dbl() { + var a = this.curve.a; + + // 4M + 6S + 10A + var jx = this.x; + var jy = this.y; + var jz = this.z; + var jz4 = jz.redSqr().redSqr(); + + var jx2 = jx.redSqr(); + var jy2 = jy.redSqr(); + + var c = jx2.redAdd(jx2).redIAdd(jx2).redIAdd(a.redMul(jz4)); + + var jxd4 = jx.redAdd(jx); + jxd4 = jxd4.redIAdd(jxd4); + var t1 = jxd4.redMul(jy2); + var nx = c.redSqr().redISub(t1.redAdd(t1)); + var t2 = t1.redISub(nx); + + var jyd8 = jy2.redSqr(); + jyd8 = jyd8.redIAdd(jyd8); + jyd8 = jyd8.redIAdd(jyd8); + jyd8 = jyd8.redIAdd(jyd8); + var ny = c.redMul(t2).redISub(jyd8); + var nz = jy.redAdd(jy).redMul(jz); + + return this.curve.jpoint(nx, ny, nz); +}; + +JPoint.prototype.trpl = function trpl() { + if (!this.curve.zeroA) + return this.dbl().add(this); + + // hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0.html#tripling-tpl-2007-bl + // 5M + 10S + ... + + // XX = X1^2 + var xx = this.x.redSqr(); + // YY = Y1^2 + var yy = this.y.redSqr(); + // ZZ = Z1^2 + var zz = this.z.redSqr(); + // YYYY = YY^2 + var yyyy = yy.redSqr(); + // M = 3 * XX + a * ZZ2; a = 0 + var m = xx.redAdd(xx).redIAdd(xx); + // MM = M^2 + var mm = m.redSqr(); + // E = 6 * ((X1 + YY)^2 - XX - YYYY) - MM + var e = this.x.redAdd(yy).redSqr().redISub(xx).redISub(yyyy); + e = e.redIAdd(e); + e = e.redAdd(e).redIAdd(e); + e = e.redISub(mm); + // EE = E^2 + var ee = e.redSqr(); + // T = 16*YYYY + var t = yyyy.redIAdd(yyyy); + t = t.redIAdd(t); + t = t.redIAdd(t); + t = t.redIAdd(t); + // U = (M + E)^2 - MM - EE - T + var u = m.redIAdd(e).redSqr().redISub(mm).redISub(ee).redISub(t); + // X3 = 4 * (X1 * EE - 4 * YY * U) + var yyu4 = yy.redMul(u); + yyu4 = yyu4.redIAdd(yyu4); + yyu4 = yyu4.redIAdd(yyu4); + var nx = this.x.redMul(ee).redISub(yyu4); + nx = nx.redIAdd(nx); + nx = nx.redIAdd(nx); + // Y3 = 8 * Y1 * (U * (T - U) - E * EE) + var ny = this.y.redMul(u.redMul(t.redISub(u)).redISub(e.redMul(ee))); + ny = ny.redIAdd(ny); + ny = ny.redIAdd(ny); + ny = ny.redIAdd(ny); + // Z3 = (Z1 + E)^2 - ZZ - EE + var nz = this.z.redAdd(e).redSqr().redISub(zz).redISub(ee); + + return this.curve.jpoint(nx, ny, nz); +}; + +JPoint.prototype.mul = function mul(k, kbase) { + k = new BN(k, kbase); + + return this.curve._wnafMul(this, k); +}; + +JPoint.prototype.eq = function eq(p) { + if (p.type === 'affine') + return this.eq(p.toJ()); + + if (this === p) + return true; + + // x1 * z2^2 == x2 * z1^2 + var z2 = this.z.redSqr(); + var pz2 = p.z.redSqr(); + if (this.x.redMul(pz2).redISub(p.x.redMul(z2)).cmpn(0) !== 0) + return false; + + // y1 * z2^3 == y2 * z1^3 + var z3 = z2.redMul(this.z); + var pz3 = pz2.redMul(p.z); + return this.y.redMul(pz3).redISub(p.y.redMul(z3)).cmpn(0) === 0; +}; + +JPoint.prototype.eqXToP = function eqXToP(x) { + var zs = this.z.redSqr(); + var rx = x.toRed(this.curve.red).redMul(zs); + if (this.x.cmp(rx) === 0) + return true; + + var xc = x.clone(); + var t = this.curve.redN.redMul(zs); + for (;;) { + xc.iadd(this.curve.n); + if (xc.cmp(this.curve.p) >= 0) + return false; + + rx.redIAdd(t); + if (this.x.cmp(rx) === 0) + return true; + } + return false; +}; + +JPoint.prototype.inspect = function inspect() { + if (this.isInfinity()) + return ''; + return ''; +}; + +JPoint.prototype.isInfinity = function isInfinity() { + // XXX This code assumes that zero is always zero in red + return this.z.cmpn(0) === 0; +}; /***/ }, /* 181 */ /***/ function(module, exports, __webpack_require__) { - const AbstractHandler = __webpack_require__(180); +"use strict"; +'use strict'; - class ChannelCreateHandler extends AbstractHandler { - handle(packet) { - const client = this.packetManager.client; - const data = packet.d; - client.actions.ChannelCreate.handle(data); - } - } +var curves = exports; - /** - * Emitted whenever a channel is created. - * @event Client#channelCreate - * @param {Channel} channel The channel that was created - */ +var hash = __webpack_require__(13); +var elliptic = __webpack_require__(7); - module.exports = ChannelCreateHandler; +var assert = elliptic.utils.assert; + +function PresetCurve(options) { + if (options.type === 'short') + this.curve = new elliptic.curve.short(options); + else if (options.type === 'edwards') + this.curve = new elliptic.curve.edwards(options); + else + this.curve = new elliptic.curve.mont(options); + this.g = this.curve.g; + this.n = this.curve.n; + this.hash = options.hash; + + assert(this.g.validate(), 'Invalid curve'); + assert(this.g.mul(this.n).isInfinity(), 'Invalid curve, G*N != O'); +} +curves.PresetCurve = PresetCurve; + +function defineCurve(name, options) { + Object.defineProperty(curves, name, { + configurable: true, + enumerable: true, + get: function() { + var curve = new PresetCurve(options); + Object.defineProperty(curves, name, { + configurable: true, + enumerable: true, + value: curve + }); + return curve; + } + }); +} + +defineCurve('p192', { + type: 'short', + prime: 'p192', + p: 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff', + a: 'ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc', + b: '64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1', + n: 'ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831', + hash: hash.sha256, + gRed: false, + g: [ + '188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012', + '07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811' + ] +}); + +defineCurve('p224', { + type: 'short', + prime: 'p224', + p: 'ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001', + a: 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe', + b: 'b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4', + n: 'ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d', + hash: hash.sha256, + gRed: false, + g: [ + 'b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21', + 'bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34' + ] +}); + +defineCurve('p256', { + type: 'short', + prime: null, + p: 'ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff', + a: 'ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc', + b: '5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b', + n: 'ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551', + hash: hash.sha256, + gRed: false, + g: [ + '6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296', + '4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5' + ] +}); + +defineCurve('p384', { + type: 'short', + prime: null, + p: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' + + 'fffffffe ffffffff 00000000 00000000 ffffffff', + a: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' + + 'fffffffe ffffffff 00000000 00000000 fffffffc', + b: 'b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f ' + + '5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef', + n: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 ' + + 'f4372ddf 581a0db2 48b0a77a ecec196a ccc52973', + hash: hash.sha384, + gRed: false, + g: [ + 'aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 ' + + '5502f25d bf55296c 3a545e38 72760ab7', + '3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 ' + + '0a60b1ce 1d7e819d 7a431d7c 90ea0e5f' + ] +}); + +defineCurve('p521', { + type: 'short', + prime: null, + p: '000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ' + + 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' + + 'ffffffff ffffffff ffffffff ffffffff ffffffff', + a: '000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ' + + 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' + + 'ffffffff ffffffff ffffffff ffffffff fffffffc', + b: '00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b ' + + '99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd ' + + '3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00', + n: '000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ' + + 'ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 ' + + 'f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409', + hash: hash.sha512, + gRed: false, + g: [ + '000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 ' + + '053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 ' + + 'a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66', + '00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 ' + + '579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 ' + + '3fad0761 353c7086 a272c240 88be9476 9fd16650' + ] +}); + +defineCurve('curve25519', { + type: 'mont', + prime: 'p25519', + p: '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed', + a: '76d06', + b: '0', + n: '1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed', + hash: hash.sha256, + gRed: false, + g: [ + '9' + ] +}); + +defineCurve('ed25519', { + type: 'edwards', + prime: 'p25519', + p: '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed', + a: '-1', + c: '1', + // -121665 * (121666^(-1)) (mod P) + d: '52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3', + n: '1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed', + hash: hash.sha256, + gRed: false, + g: [ + '216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a', + + // 4/5 + '6666666666666666666666666666666666666666666666666666666666666658' + ] +}); + +var pre; +try { + pre = __webpack_require__(189); +} catch (e) { + pre = undefined; +} + +defineCurve('secp256k1', { + type: 'short', + prime: 'k256', + p: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f', + a: '0', + b: '7', + n: 'ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141', + h: '1', + hash: hash.sha256, + + // Precomputed endomorphism + beta: '7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee', + lambda: '5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72', + basis: [ + { + a: '3086d221a7d46bcde86c90e49284eb15', + b: '-e4437ed6010e88286f547fa90abfe4c3' + }, + { + a: '114ca50f7a8e2f3f657c1108d9d44cfd8', + b: '3086d221a7d46bcde86c90e49284eb15' + } + ], + + gRed: false, + g: [ + '79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798', + '483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8', + pre + ] +}); /***/ }, /* 182 */ /***/ function(module, exports, __webpack_require__) { - const AbstractHandler = __webpack_require__(180); +"use strict"; +'use strict'; - const Constants = __webpack_require__(5); +var BN = __webpack_require__(4); +var elliptic = __webpack_require__(7); +var utils = elliptic.utils; +var assert = utils.assert; - class ChannelDeleteHandler extends AbstractHandler { - handle(packet) { - const client = this.packetManager.client; - const data = packet.d; - const response = client.actions.ChannelDelete.handle(data); - if (response.channel) client.emit(Constants.Events.CHANNEL_DELETE, response.channel); - } - } +var KeyPair = __webpack_require__(183); +var Signature = __webpack_require__(184); - /** - * Emitted whenever a channel is deleted. - * @event Client#channelDelete - * @param {Channel} channel The channel that was deleted - */ +function EC(options) { + if (!(this instanceof EC)) + return new EC(options); - module.exports = ChannelDeleteHandler; + // Shortcut `elliptic.ec(curve-name)` + if (typeof options === 'string') { + assert(elliptic.curves.hasOwnProperty(options), 'Unknown curve ' + options); + + options = elliptic.curves[options]; + } + + // Shortcut for `elliptic.ec(elliptic.curves.curveName)` + if (options instanceof elliptic.curves.PresetCurve) + options = { curve: options }; + + this.curve = options.curve.curve; + this.n = this.curve.n; + this.nh = this.n.ushrn(1); + this.g = this.curve.g; + + // Point on curve + this.g = options.curve.g; + this.g.precompute(options.curve.n.bitLength() + 1); + + // Hash for function for DRBG + this.hash = options.hash || options.curve.hash; +} +module.exports = EC; + +EC.prototype.keyPair = function keyPair(options) { + return new KeyPair(this, options); +}; + +EC.prototype.keyFromPrivate = function keyFromPrivate(priv, enc) { + return KeyPair.fromPrivate(this, priv, enc); +}; + +EC.prototype.keyFromPublic = function keyFromPublic(pub, enc) { + return KeyPair.fromPublic(this, pub, enc); +}; + +EC.prototype.genKeyPair = function genKeyPair(options) { + if (!options) + options = {}; + + // Instantiate Hmac_DRBG + var drbg = new elliptic.hmacDRBG({ + hash: this.hash, + pers: options.pers, + entropy: options.entropy || elliptic.rand(this.hash.hmacStrength), + nonce: this.n.toArray() + }); + + var bytes = this.n.byteLength(); + var ns2 = this.n.sub(new BN(2)); + do { + var priv = new BN(drbg.generate(bytes)); + if (priv.cmp(ns2) > 0) + continue; + + priv.iaddn(1); + return this.keyFromPrivate(priv); + } while (true); +}; + +EC.prototype._truncateToN = function truncateToN(msg, truncOnly) { + var delta = msg.byteLength() * 8 - this.n.bitLength(); + if (delta > 0) + msg = msg.ushrn(delta); + if (!truncOnly && msg.cmp(this.n) >= 0) + return msg.sub(this.n); + else + return msg; +}; + +EC.prototype.sign = function sign(msg, key, enc, options) { + if (typeof enc === 'object') { + options = enc; + enc = null; + } + if (!options) + options = {}; + + key = this.keyFromPrivate(key, enc); + msg = this._truncateToN(new BN(msg, 16)); + + // Zero-extend key to provide enough entropy + var bytes = this.n.byteLength(); + var bkey = key.getPrivate().toArray('be', bytes); + + // Zero-extend nonce to have the same byte size as N + var nonce = msg.toArray('be', bytes); + + // Instantiate Hmac_DRBG + var drbg = new elliptic.hmacDRBG({ + hash: this.hash, + entropy: bkey, + nonce: nonce, + pers: options.pers, + persEnc: options.persEnc + }); + + // Number of bytes to generate + var ns1 = this.n.sub(new BN(1)); + + for (var iter = 0; true; iter++) { + var k = options.k ? + options.k(iter) : + new BN(drbg.generate(this.n.byteLength())); + k = this._truncateToN(k, true); + if (k.cmpn(1) <= 0 || k.cmp(ns1) >= 0) + continue; + + var kp = this.g.mul(k); + if (kp.isInfinity()) + continue; + + var kpX = kp.getX(); + var r = kpX.umod(this.n); + if (r.cmpn(0) === 0) + continue; + + var s = k.invm(this.n).mul(r.mul(key.getPrivate()).iadd(msg)); + s = s.umod(this.n); + if (s.cmpn(0) === 0) + continue; + + var recoveryParam = (kp.getY().isOdd() ? 1 : 0) | + (kpX.cmp(r) !== 0 ? 2 : 0); + + // Use complement of `s`, if it is > `n / 2` + if (options.canonical && s.cmp(this.nh) > 0) { + s = this.n.sub(s); + recoveryParam ^= 1; + } + + return new Signature({ r: r, s: s, recoveryParam: recoveryParam }); + } +}; + +EC.prototype.verify = function verify(msg, signature, key, enc) { + msg = this._truncateToN(new BN(msg, 16)); + key = this.keyFromPublic(key, enc); + signature = new Signature(signature, 'hex'); + + // Perform primitive values validation + var r = signature.r; + var s = signature.s; + if (r.cmpn(1) < 0 || r.cmp(this.n) >= 0) + return false; + if (s.cmpn(1) < 0 || s.cmp(this.n) >= 0) + return false; + + // Validate signature + var sinv = s.invm(this.n); + var u1 = sinv.mul(msg).umod(this.n); + var u2 = sinv.mul(r).umod(this.n); + + if (!this.curve._maxwellTrick) { + var p = this.g.mulAdd(u1, key.getPublic(), u2); + if (p.isInfinity()) + return false; + + return p.getX().umod(this.n).cmp(r) === 0; + } + + // NOTE: Greg Maxwell's trick, inspired by: + // https://git.io/vad3K + + var p = this.g.jmulAdd(u1, key.getPublic(), u2); + if (p.isInfinity()) + return false; + + // Compare `p.x` of Jacobian point with `r`, + // this will do `p.x == r * p.z^2` instead of multiplying `p.x` by the + // inverse of `p.z^2` + return p.eqXToP(r); +}; + +EC.prototype.recoverPubKey = function(msg, signature, j, enc) { + assert((3 & j) === j, 'The recovery param is more than two bits'); + signature = new Signature(signature, enc); + + var n = this.n; + var e = new BN(msg); + var r = signature.r; + var s = signature.s; + + // A set LSB signifies that the y-coordinate is odd + var isYOdd = j & 1; + var isSecondKey = j >> 1; + if (r.cmp(this.curve.p.umod(this.curve.n)) >= 0 && isSecondKey) + throw new Error('Unable to find sencond key candinate'); + + // 1.1. Let x = r + jn. + if (isSecondKey) + r = this.curve.pointFromX(r.add(this.curve.n), isYOdd); + else + r = this.curve.pointFromX(r, isYOdd); + + var rInv = signature.r.invm(n); + var s1 = n.sub(e).mul(rInv).umod(n); + var s2 = s.mul(rInv).umod(n); + + // 1.6.1 Compute Q = r^-1 (sR - eG) + // Q = r^-1 (sR + -eG) + return this.g.mulAdd(s1, r, s2); +}; + +EC.prototype.getKeyRecoveryParam = function(e, signature, Q, enc) { + signature = new Signature(signature, enc); + if (signature.recoveryParam !== null) + return signature.recoveryParam; + + for (var i = 0; i < 4; i++) { + var Qprime; + try { + Qprime = this.recoverPubKey(e, signature, i); + } catch (e) { + continue; + } + + if (Qprime.eq(Q)) + return i; + } + throw new Error('Unable to find valid recovery factor'); +}; /***/ }, /* 183 */ /***/ function(module, exports, __webpack_require__) { - const AbstractHandler = __webpack_require__(180); - const Constants = __webpack_require__(5); +"use strict"; +'use strict'; - /* - { t: 'CHANNEL_PINS_UPDATE', - s: 666, - op: 0, - d: - { last_pin_timestamp: '2016-08-28T17:37:13.171774+00:00', - channel_id: '314866471639044027' } } - */ +var BN = __webpack_require__(4); - class ChannelPinsUpdate extends AbstractHandler { - handle(packet) { - const client = this.packetManager.client; - const data = packet.d; - const channel = client.channels.get(data.channel_id); - const time = new Date(data.last_pin_timestamp); - if (channel && time) client.emit(Constants.Events.CHANNEL_PINS_UPDATE, channel, time); - } - } +function KeyPair(ec, options) { + this.ec = ec; + this.priv = null; + this.pub = null; - /** - * Emitted whenever the pins of a channel are updated. Due to the nature of the WebSocket event, not much information - * can be provided easily here - you need to manually check the pins yourself. - * @event Client#channelPinsUpdate - * @param {Channel} channel The channel that the pins update occured in - * @param {Date} time The time of the pins update - */ + // KeyPair(ec, { priv: ..., pub: ... }) + if (options.priv) + this._importPrivate(options.priv, options.privEnc); + if (options.pub) + this._importPublic(options.pub, options.pubEnc); +} +module.exports = KeyPair; - module.exports = ChannelPinsUpdate; +KeyPair.fromPublic = function fromPublic(ec, pub, enc) { + if (pub instanceof KeyPair) + return pub; + + return new KeyPair(ec, { + pub: pub, + pubEnc: enc + }); +}; + +KeyPair.fromPrivate = function fromPrivate(ec, priv, enc) { + if (priv instanceof KeyPair) + return priv; + + return new KeyPair(ec, { + priv: priv, + privEnc: enc + }); +}; + +KeyPair.prototype.validate = function validate() { + var pub = this.getPublic(); + + if (pub.isInfinity()) + return { result: false, reason: 'Invalid public key' }; + if (!pub.validate()) + return { result: false, reason: 'Public key is not a point' }; + if (!pub.mul(this.ec.curve.n).isInfinity()) + return { result: false, reason: 'Public key * N != O' }; + + return { result: true, reason: null }; +}; + +KeyPair.prototype.getPublic = function getPublic(compact, enc) { + // compact is optional argument + if (typeof compact === 'string') { + enc = compact; + compact = null; + } + + if (!this.pub) + this.pub = this.ec.g.mul(this.priv); + + if (!enc) + return this.pub; + + return this.pub.encode(enc, compact); +}; + +KeyPair.prototype.getPrivate = function getPrivate(enc) { + if (enc === 'hex') + return this.priv.toString(16, 2); + else + return this.priv; +}; + +KeyPair.prototype._importPrivate = function _importPrivate(key, enc) { + this.priv = new BN(key, enc || 16); + + // Ensure that the priv won't be bigger than n, otherwise we may fail + // in fixed multiplication method + this.priv = this.priv.umod(this.ec.curve.n); +}; + +KeyPair.prototype._importPublic = function _importPublic(key, enc) { + if (key.x || key.y) { + this.pub = this.ec.curve.point(key.x, key.y); + return; + } + this.pub = this.ec.curve.decodePoint(key, enc); +}; + +// ECDH +KeyPair.prototype.derive = function derive(pub) { + return pub.mul(this.priv).getX(); +}; + +// ECDSA +KeyPair.prototype.sign = function sign(msg, enc, options) { + return this.ec.sign(msg, this, enc, options); +}; + +KeyPair.prototype.verify = function verify(msg, signature) { + return this.ec.verify(msg, signature, this); +}; + +KeyPair.prototype.inspect = function inspect() { + return ''; +}; /***/ }, /* 184 */ /***/ function(module, exports, __webpack_require__) { - const AbstractHandler = __webpack_require__(180); +"use strict"; +'use strict'; - class ChannelUpdateHandler extends AbstractHandler { - handle(packet) { - const client = this.packetManager.client; - const data = packet.d; - client.actions.ChannelUpdate.handle(data); - } - } +var BN = __webpack_require__(4); - module.exports = ChannelUpdateHandler; +var elliptic = __webpack_require__(7); +var utils = elliptic.utils; +var assert = utils.assert; + +function Signature(options, enc) { + if (options instanceof Signature) + return options; + + if (this._importDER(options, enc)) + return; + + assert(options.r && options.s, 'Signature without r or s'); + this.r = new BN(options.r, 16); + this.s = new BN(options.s, 16); + if (options.recoveryParam === undefined) + this.recoveryParam = null; + else + this.recoveryParam = options.recoveryParam; +} +module.exports = Signature; + +function Position() { + this.place = 0; +} + +function getLength(buf, p) { + var initial = buf[p.place++]; + if (!(initial & 0x80)) { + return initial; + } + var octetLen = initial & 0xf; + var val = 0; + for (var i = 0, off = p.place; i < octetLen; i++, off++) { + val <<= 8; + val |= buf[off]; + } + p.place = off; + return val; +} + +function rmPadding(buf) { + var i = 0; + var len = buf.length - 1; + while (!buf[i] && !(buf[i + 1] & 0x80) && i < len) { + i++; + } + if (i === 0) { + return buf; + } + return buf.slice(i); +} + +Signature.prototype._importDER = function _importDER(data, enc) { + data = utils.toArray(data, enc); + var p = new Position(); + if (data[p.place++] !== 0x30) { + return false; + } + var len = getLength(data, p); + if ((len + p.place) !== data.length) { + return false; + } + if (data[p.place++] !== 0x02) { + return false; + } + var rlen = getLength(data, p); + var r = data.slice(p.place, rlen + p.place); + p.place += rlen; + if (data[p.place++] !== 0x02) { + return false; + } + var slen = getLength(data, p); + if (data.length !== slen + p.place) { + return false; + } + var s = data.slice(p.place, slen + p.place); + if (r[0] === 0 && (r[1] & 0x80)) { + r = r.slice(1); + } + if (s[0] === 0 && (s[1] & 0x80)) { + s = s.slice(1); + } + + this.r = new BN(r); + this.s = new BN(s); + this.recoveryParam = null; + + return true; +}; + +function constructLength(arr, len) { + if (len < 0x80) { + arr.push(len); + return; + } + var octets = 1 + (Math.log(len) / Math.LN2 >>> 3); + arr.push(octets | 0x80); + while (--octets) { + arr.push((len >>> (octets << 3)) & 0xff); + } + arr.push(len); +} + +Signature.prototype.toDER = function toDER(enc) { + var r = this.r.toArray(); + var s = this.s.toArray(); + + // Pad values + if (r[0] & 0x80) + r = [ 0 ].concat(r); + // Pad values + if (s[0] & 0x80) + s = [ 0 ].concat(s); + + r = rmPadding(r); + s = rmPadding(s); + + while (!s[0] && !(s[1] & 0x80)) { + s = s.slice(1); + } + var arr = [ 0x02 ]; + constructLength(arr, r.length); + arr = arr.concat(r); + arr.push(0x02); + constructLength(arr, s.length); + var backHalf = arr.concat(s); + var res = [ 0x30 ]; + constructLength(res, backHalf.length); + res = res.concat(backHalf); + return utils.encode(res, enc); +}; /***/ }, /* 185 */ /***/ function(module, exports, __webpack_require__) { - // ##untested handler## +"use strict"; +'use strict'; - const AbstractHandler = __webpack_require__(180); - const Constants = __webpack_require__(5); +var hash = __webpack_require__(13); +var elliptic = __webpack_require__(7); +var utils = elliptic.utils; +var assert = utils.assert; +var parseBytes = utils.parseBytes; +var KeyPair = __webpack_require__(186); +var Signature = __webpack_require__(187); - class GuildBanAddHandler extends AbstractHandler { - handle(packet) { - const client = this.packetManager.client; - const data = packet.d; - const guild = client.guilds.get(data.guild_id); - const user = client.users.get(data.user.id); - if (guild && user) client.emit(Constants.Events.GUILD_BAN_ADD, guild, user); - } - } +function EDDSA(curve) { + assert(curve === 'ed25519', 'only tested with ed25519 so far'); - /** - * Emitted whenever a member is banned from a guild. - * @event Client#guildBanAdd - * @param {Guild} guild The guild that the ban occurred in - * @param {User} user The user that was banned - */ + if (!(this instanceof EDDSA)) + return new EDDSA(curve); - module.exports = GuildBanAddHandler; + var curve = elliptic.curves[curve].curve; + this.curve = curve; + this.g = curve.g; + this.g.precompute(curve.n.bitLength() + 1); + + this.pointClass = curve.point().constructor; + this.encodingLength = Math.ceil(curve.n.bitLength() / 8); + this.hash = hash.sha512; +} + +module.exports = EDDSA; + +/** +* @param {Array|String} message - message bytes +* @param {Array|String|KeyPair} secret - secret bytes or a keypair +* @returns {Signature} - signature +*/ +EDDSA.prototype.sign = function sign(message, secret) { + message = parseBytes(message); + var key = this.keyFromSecret(secret); + var r = this.hashInt(key.messagePrefix(), message); + var R = this.g.mul(r); + var Rencoded = this.encodePoint(R); + var s_ = this.hashInt(Rencoded, key.pubBytes(), message) + .mul(key.priv()); + var S = r.add(s_).umod(this.curve.n); + return this.makeSignature({ R: R, S: S, Rencoded: Rencoded }); +}; + +/** +* @param {Array} message - message bytes +* @param {Array|String|Signature} sig - sig bytes +* @param {Array|String|Point|KeyPair} pub - public key +* @returns {Boolean} - true if public key matches sig of message +*/ +EDDSA.prototype.verify = function verify(message, sig, pub) { + message = parseBytes(message); + sig = this.makeSignature(sig); + var key = this.keyFromPublic(pub); + var h = this.hashInt(sig.Rencoded(), key.pubBytes(), message); + var SG = this.g.mul(sig.S()); + var RplusAh = sig.R().add(key.pub().mul(h)); + return RplusAh.eq(SG); +}; + +EDDSA.prototype.hashInt = function hashInt() { + var hash = this.hash(); + for (var i = 0; i < arguments.length; i++) + hash.update(arguments[i]); + return utils.intFromLE(hash.digest()).umod(this.curve.n); +}; + +EDDSA.prototype.keyFromPublic = function keyFromPublic(pub) { + return KeyPair.fromPublic(this, pub); +}; + +EDDSA.prototype.keyFromSecret = function keyFromSecret(secret) { + return KeyPair.fromSecret(this, secret); +}; + +EDDSA.prototype.makeSignature = function makeSignature(sig) { + if (sig instanceof Signature) + return sig; + return new Signature(this, sig); +}; + +/** +* * https://tools.ietf.org/html/draft-josefsson-eddsa-ed25519-03#section-5.2 +* +* EDDSA defines methods for encoding and decoding points and integers. These are +* helper convenience methods, that pass along to utility functions implied +* parameters. +* +*/ +EDDSA.prototype.encodePoint = function encodePoint(point) { + var enc = point.getY().toArray('le', this.encodingLength); + enc[this.encodingLength - 1] |= point.getX().isOdd() ? 0x80 : 0; + return enc; +}; + +EDDSA.prototype.decodePoint = function decodePoint(bytes) { + bytes = utils.parseBytes(bytes); + + var lastIx = bytes.length - 1; + var normed = bytes.slice(0, lastIx).concat(bytes[lastIx] & ~0x80); + var xIsOdd = (bytes[lastIx] & 0x80) !== 0; + + var y = utils.intFromLE(normed); + return this.curve.pointFromY(y, xIsOdd); +}; + +EDDSA.prototype.encodeInt = function encodeInt(num) { + return num.toArray('le', this.encodingLength); +}; + +EDDSA.prototype.decodeInt = function decodeInt(bytes) { + return utils.intFromLE(bytes); +}; + +EDDSA.prototype.isPoint = function isPoint(val) { + return val instanceof this.pointClass; +}; /***/ }, /* 186 */ /***/ function(module, exports, __webpack_require__) { - // ##untested handler## +"use strict"; +'use strict'; - const AbstractHandler = __webpack_require__(180); +var elliptic = __webpack_require__(7); +var utils = elliptic.utils; +var assert = utils.assert; +var parseBytes = utils.parseBytes; +var cachedProperty = utils.cachedProperty; - class GuildBanRemoveHandler extends AbstractHandler { - handle(packet) { - const client = this.packetManager.client; - const data = packet.d; - client.actions.GuildBanRemove.handle(data); - } - } +/** +* @param {EDDSA} eddsa - instance +* @param {Object} params - public/private key parameters +* +* @param {Array} [params.secret] - secret seed bytes +* @param {Point} [params.pub] - public key point (aka `A` in eddsa terms) +* @param {Array} [params.pub] - public key point encoded as bytes +* +*/ +function KeyPair(eddsa, params) { + this.eddsa = eddsa; + this._secret = parseBytes(params.secret); + if (eddsa.isPoint(params.pub)) + this._pub = params.pub; + else + this._pubBytes = parseBytes(params.pub); +} - /** - * Emitted whenever a member is unbanned from a guild. - * @event Client#guildBanRemove - * @param {Guild} guild The guild that the unban occurred in - * @param {User} user The user that was unbanned - */ +KeyPair.fromPublic = function fromPublic(eddsa, pub) { + if (pub instanceof KeyPair) + return pub; + return new KeyPair(eddsa, { pub: pub }); +}; - module.exports = GuildBanRemoveHandler; +KeyPair.fromSecret = function fromSecret(eddsa, secret) { + if (secret instanceof KeyPair) + return secret; + return new KeyPair(eddsa, { secret: secret }); +}; + +KeyPair.prototype.secret = function secret() { + return this._secret; +}; + +cachedProperty(KeyPair, 'pubBytes', function pubBytes() { + return this.eddsa.encodePoint(this.pub()); +}); + +cachedProperty(KeyPair, 'pub', function pub() { + if (this._pubBytes) + return this.eddsa.decodePoint(this._pubBytes); + return this.eddsa.g.mul(this.priv()); +}); + +cachedProperty(KeyPair, 'privBytes', function privBytes() { + var eddsa = this.eddsa; + var hash = this.hash(); + var lastIx = eddsa.encodingLength - 1; + + var a = hash.slice(0, eddsa.encodingLength); + a[0] &= 248; + a[lastIx] &= 127; + a[lastIx] |= 64; + + return a; +}); + +cachedProperty(KeyPair, 'priv', function priv() { + return this.eddsa.decodeInt(this.privBytes()); +}); + +cachedProperty(KeyPair, 'hash', function hash() { + return this.eddsa.hash().update(this.secret()).digest(); +}); + +cachedProperty(KeyPair, 'messagePrefix', function messagePrefix() { + return this.hash().slice(this.eddsa.encodingLength); +}); + +KeyPair.prototype.sign = function sign(message) { + assert(this._secret, 'KeyPair can only verify'); + return this.eddsa.sign(message, this); +}; + +KeyPair.prototype.verify = function verify(message, sig) { + return this.eddsa.verify(message, sig, this); +}; + +KeyPair.prototype.getSecret = function getSecret(enc) { + assert(this._secret, 'KeyPair is public only'); + return utils.encode(this.secret(), enc); +}; + +KeyPair.prototype.getPublic = function getPublic(enc) { + return utils.encode(this.pubBytes(), enc); +}; + +module.exports = KeyPair; /***/ }, /* 187 */ /***/ function(module, exports, __webpack_require__) { - const AbstractHandler = __webpack_require__(180); +"use strict"; +'use strict'; - class GuildCreateHandler extends AbstractHandler { - handle(packet) { - const client = this.packetManager.client; - const data = packet.d; +var BN = __webpack_require__(4); +var elliptic = __webpack_require__(7); +var utils = elliptic.utils; +var assert = utils.assert; +var cachedProperty = utils.cachedProperty; +var parseBytes = utils.parseBytes; - const guild = client.guilds.get(data.id); - if (guild) { - if (!guild.available && !data.unavailable) { - // a newly available guild - guild.setup(data); - this.packetManager.ws.checkIfReady(); - } - } else { - // a new guild - client.dataManager.newGuild(data); - } - } - } +/** +* @param {EDDSA} eddsa - eddsa instance +* @param {Array|Object} sig - +* @param {Array|Point} [sig.R] - R point as Point or bytes +* @param {Array|bn} [sig.S] - S scalar as bn or bytes +* @param {Array} [sig.Rencoded] - R point encoded +* @param {Array} [sig.Sencoded] - S scalar encoded +*/ +function Signature(eddsa, sig) { + this.eddsa = eddsa; - module.exports = GuildCreateHandler; + if (typeof sig !== 'object') + sig = parseBytes(sig); + + if (Array.isArray(sig)) { + sig = { + R: sig.slice(0, eddsa.encodingLength), + S: sig.slice(eddsa.encodingLength) + }; + } + + assert(sig.R && sig.S, 'Signature without R or S'); + + if (eddsa.isPoint(sig.R)) + this._R = sig.R; + if (sig.S instanceof BN) + this._S = sig.S; + + this._Rencoded = Array.isArray(sig.R) ? sig.R : sig.Rencoded; + this._Sencoded = Array.isArray(sig.S) ? sig.S : sig.Sencoded; +} + +cachedProperty(Signature, 'S', function S() { + return this.eddsa.decodeInt(this.Sencoded()); +}); + +cachedProperty(Signature, 'R', function R() { + return this.eddsa.decodePoint(this.Rencoded()); +}); + +cachedProperty(Signature, 'Rencoded', function Rencoded() { + return this.eddsa.encodePoint(this.R()); +}); + +cachedProperty(Signature, 'Sencoded', function Sencoded() { + return this.eddsa.encodeInt(this.S()); +}); + +Signature.prototype.toBytes = function toBytes() { + return this.Rencoded().concat(this.Sencoded()); +}; + +Signature.prototype.toHex = function toHex() { + return utils.encode(this.toBytes(), 'hex').toUpperCase(); +}; + +module.exports = Signature; /***/ }, /* 188 */ /***/ function(module, exports, __webpack_require__) { - const AbstractHandler = __webpack_require__(180); - const Constants = __webpack_require__(5); +"use strict"; +'use strict'; - class GuildDeleteHandler extends AbstractHandler { - handle(packet) { - const client = this.packetManager.client; - const data = packet.d; - const response = client.actions.GuildDelete.handle(data); - if (response.guild) client.emit(Constants.Events.GUILD_DELETE, response.guild); - } - } +var hash = __webpack_require__(13); +var elliptic = __webpack_require__(7); +var utils = elliptic.utils; +var assert = utils.assert; - /** - * Emitted whenever a guild is deleted/left. - * @event Client#guildDelete - * @param {Guild} guild The guild that was deleted - */ +function HmacDRBG(options) { + if (!(this instanceof HmacDRBG)) + return new HmacDRBG(options); + this.hash = options.hash; + this.predResist = !!options.predResist; - module.exports = GuildDeleteHandler; + this.outLen = this.hash.outSize; + this.minEntropy = options.minEntropy || this.hash.hmacStrength; + + this.reseed = null; + this.reseedInterval = null; + this.K = null; + this.V = null; + + var entropy = utils.toArray(options.entropy, options.entropyEnc); + var nonce = utils.toArray(options.nonce, options.nonceEnc); + var pers = utils.toArray(options.pers, options.persEnc); + assert(entropy.length >= (this.minEntropy / 8), + 'Not enough entropy. Minimum is: ' + this.minEntropy + ' bits'); + this._init(entropy, nonce, pers); +} +module.exports = HmacDRBG; + +HmacDRBG.prototype._init = function init(entropy, nonce, pers) { + var seed = entropy.concat(nonce).concat(pers); + + this.K = new Array(this.outLen / 8); + this.V = new Array(this.outLen / 8); + for (var i = 0; i < this.V.length; i++) { + this.K[i] = 0x00; + this.V[i] = 0x01; + } + + this._update(seed); + this.reseed = 1; + this.reseedInterval = 0x1000000000000; // 2^48 +}; + +HmacDRBG.prototype._hmac = function hmac() { + return new hash.hmac(this.hash, this.K); +}; + +HmacDRBG.prototype._update = function update(seed) { + var kmac = this._hmac() + .update(this.V) + .update([ 0x00 ]); + if (seed) + kmac = kmac.update(seed); + this.K = kmac.digest(); + this.V = this._hmac().update(this.V).digest(); + if (!seed) + return; + + this.K = this._hmac() + .update(this.V) + .update([ 0x01 ]) + .update(seed) + .digest(); + this.V = this._hmac().update(this.V).digest(); +}; + +HmacDRBG.prototype.reseed = function reseed(entropy, entropyEnc, add, addEnc) { + // Optional entropy enc + if (typeof entropyEnc !== 'string') { + addEnc = add; + add = entropyEnc; + entropyEnc = null; + } + + entropy = utils.toBuffer(entropy, entropyEnc); + add = utils.toBuffer(add, addEnc); + + assert(entropy.length >= (this.minEntropy / 8), + 'Not enough entropy. Minimum is: ' + this.minEntropy + ' bits'); + + this._update(entropy.concat(add || [])); + this.reseed = 1; +}; + +HmacDRBG.prototype.generate = function generate(len, enc, add, addEnc) { + if (this.reseed > this.reseedInterval) + throw new Error('Reseed is required'); + + // Optional encoding + if (typeof enc !== 'string') { + addEnc = add; + add = enc; + enc = null; + } + + // Optional additional data + if (add) { + add = utils.toArray(add, addEnc); + this._update(add); + } + + var temp = []; + while (temp.length < len) { + this.V = this._hmac().update(this.V).digest(); + temp = temp.concat(this.V); + } + + var res = temp.slice(0, len); + this._update(add); + this.reseed++; + return utils.encode(res, enc); +}; /***/ }, /* 189 */ -/***/ function(module, exports, __webpack_require__) { +/***/ function(module, exports) { - const AbstractHandler = __webpack_require__(180); - - class GuildEmojiUpdate extends AbstractHandler { - handle(packet) { - const client = this.packetManager.client; - const data = packet.d; - const guild = client.guilds.get(data.guild_id); - if (!guild) return; - client.actions.EmojiUpdate.handle(data, guild); - } - } - - module.exports = GuildEmojiUpdate; +module.exports = { + doubles: { + step: 4, + points: [ + [ + 'e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a', + 'f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821' + ], + [ + '8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508', + '11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf' + ], + [ + '175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739', + 'd3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695' + ], + [ + '363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640', + '4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9' + ], + [ + '8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c', + '4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36' + ], + [ + '723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda', + '96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f' + ], + [ + 'eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa', + '5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999' + ], + [ + '100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0', + 'cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09' + ], + [ + 'e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d', + '9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d' + ], + [ + 'feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d', + 'e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088' + ], + [ + 'da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1', + '9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d' + ], + [ + '53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0', + '5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8' + ], + [ + '8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047', + '10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a' + ], + [ + '385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862', + '283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453' + ], + [ + '6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7', + '7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160' + ], + [ + '3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd', + '56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0' + ], + [ + '85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83', + '7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6' + ], + [ + '948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a', + '53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589' + ], + [ + '6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8', + 'bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17' + ], + [ + 'e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d', + '4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda' + ], + [ + 'e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725', + '7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd' + ], + [ + '213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754', + '4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2' + ], + [ + '4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c', + '17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6' + ], + [ + 'fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6', + '6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f' + ], + [ + '76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39', + 'c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01' + ], + [ + 'c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891', + '893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3' + ], + [ + 'd895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b', + 'febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f' + ], + [ + 'b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03', + '2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7' + ], + [ + 'e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d', + 'eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78' + ], + [ + 'a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070', + '7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1' + ], + [ + '90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4', + 'e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150' + ], + [ + '8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da', + '662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82' + ], + [ + 'e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11', + '1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc' + ], + [ + '8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e', + 'efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b' + ], + [ + 'e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41', + '2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51' + ], + [ + 'b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef', + '67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45' + ], + [ + 'd68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8', + 'db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120' + ], + [ + '324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d', + '648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84' + ], + [ + '4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96', + '35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d' + ], + [ + '9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd', + 'ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d' + ], + [ + '6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5', + '9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8' + ], + [ + 'a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266', + '40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8' + ], + [ + '7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71', + '34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac' + ], + [ + '928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac', + 'c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f' + ], + [ + '85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751', + '1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962' + ], + [ + 'ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e', + '493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907' + ], + [ + '827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241', + 'c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec' + ], + [ + 'eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3', + 'be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d' + ], + [ + 'e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f', + '4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414' + ], + [ + '1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19', + 'aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd' + ], + [ + '146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be', + 'b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0' + ], + [ + 'fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9', + '6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811' + ], + [ + 'da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2', + '8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1' + ], + [ + 'a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13', + '7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c' + ], + [ + '174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c', + 'ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73' + ], + [ + '959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba', + '2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd' + ], + [ + 'd2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151', + 'e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405' + ], + [ + '64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073', + 'd99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589' + ], + [ + '8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458', + '38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e' + ], + [ + '13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b', + '69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27' + ], + [ + 'bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366', + 'd3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1' + ], + [ + '8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa', + '40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482' + ], + [ + '8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0', + '620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945' + ], + [ + 'dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787', + '7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573' + ], + [ + 'f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e', + 'ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82' + ] + ] + }, + naf: { + wnd: 7, + points: [ + [ + 'f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9', + '388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672' + ], + [ + '2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4', + 'd8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6' + ], + [ + '5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc', + '6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da' + ], + [ + 'acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe', + 'cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37' + ], + [ + '774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb', + 'd984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b' + ], + [ + 'f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8', + 'ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81' + ], + [ + 'd7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e', + '581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58' + ], + [ + 'defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34', + '4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77' + ], + [ + '2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c', + '85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a' + ], + [ + '352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5', + '321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c' + ], + [ + '2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f', + '2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67' + ], + [ + '9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714', + '73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402' + ], + [ + 'daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729', + 'a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55' + ], + [ + 'c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db', + '2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482' + ], + [ + '6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4', + 'e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82' + ], + [ + '1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5', + 'b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396' + ], + [ + '605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479', + '2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49' + ], + [ + '62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d', + '80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf' + ], + [ + '80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f', + '1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a' + ], + [ + '7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb', + 'd0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7' + ], + [ + 'd528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9', + 'eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933' + ], + [ + '49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963', + '758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a' + ], + [ + '77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74', + '958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6' + ], + [ + 'f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530', + 'e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37' + ], + [ + '463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b', + '5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e' + ], + [ + 'f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247', + 'cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6' + ], + [ + 'caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1', + 'cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476' + ], + [ + '2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120', + '4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40' + ], + [ + '7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435', + '91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61' + ], + [ + '754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18', + '673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683' + ], + [ + 'e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8', + '59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5' + ], + [ + '186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb', + '3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b' + ], + [ + 'df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f', + '55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417' + ], + [ + '5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143', + 'efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868' + ], + [ + '290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba', + 'e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a' + ], + [ + 'af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45', + 'f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6' + ], + [ + '766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a', + '744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996' + ], + [ + '59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e', + 'c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e' + ], + [ + 'f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8', + 'e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d' + ], + [ + '7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c', + '30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2' + ], + [ + '948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519', + 'e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e' + ], + [ + '7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab', + '100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437' + ], + [ + '3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca', + 'ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311' + ], + [ + 'd3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf', + '8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4' + ], + [ + '1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610', + '68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575' + ], + [ + '733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4', + 'f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d' + ], + [ + '15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c', + 'd56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d' + ], + [ + 'a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940', + 'edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629' + ], + [ + 'e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980', + 'a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06' + ], + [ + '311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3', + '66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374' + ], + [ + '34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf', + '9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee' + ], + [ + 'f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63', + '4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1' + ], + [ + 'd7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448', + 'fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b' + ], + [ + '32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf', + '5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661' + ], + [ + '7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5', + '8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6' + ], + [ + 'ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6', + '8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e' + ], + [ + '16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5', + '5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d' + ], + [ + 'eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99', + 'f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc' + ], + [ + '78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51', + 'f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4' + ], + [ + '494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5', + '42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c' + ], + [ + 'a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5', + '204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b' + ], + [ + 'c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997', + '4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913' + ], + [ + '841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881', + '73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154' + ], + [ + '5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5', + '39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865' + ], + [ + '36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66', + 'd2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc' + ], + [ + '336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726', + 'ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224' + ], + [ + '8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede', + '6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e' + ], + [ + '1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94', + '60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6' + ], + [ + '85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31', + '3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511' + ], + [ + '29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51', + 'b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b' + ], + [ + 'a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252', + 'ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2' + ], + [ + '4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5', + 'cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c' + ], + [ + 'd24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b', + '6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3' + ], + [ + 'ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4', + '322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d' + ], + [ + 'af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f', + '6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700' + ], + [ + 'e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889', + '2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4' + ], + [ + '591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246', + 'b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196' + ], + [ + '11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984', + '998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4' + ], + [ + '3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a', + 'b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257' + ], + [ + 'cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030', + 'bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13' + ], + [ + 'c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197', + '6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096' + ], + [ + 'c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593', + 'c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38' + ], + [ + 'a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef', + '21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f' + ], + [ + '347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38', + '60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448' + ], + [ + 'da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a', + '49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a' + ], + [ + 'c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111', + '5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4' + ], + [ + '4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502', + '7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437' + ], + [ + '3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea', + 'be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7' + ], + [ + 'cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26', + '8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d' + ], + [ + 'b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986', + '39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a' + ], + [ + 'd4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e', + '62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54' + ], + [ + '48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4', + '25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77' + ], + [ + 'dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda', + 'ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517' + ], + [ + '6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859', + 'cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10' + ], + [ + 'e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f', + 'f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125' + ], + [ + 'eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c', + '6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e' + ], + [ + '13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942', + 'fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1' + ], + [ + 'ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a', + '1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2' + ], + [ + 'b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80', + '5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423' + ], + [ + 'ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d', + '438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8' + ], + [ + '8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1', + 'cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758' + ], + [ + '52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63', + 'c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375' + ], + [ + 'e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352', + '6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d' + ], + [ + '7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193', + 'ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec' + ], + [ + '5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00', + '9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0' + ], + [ + '32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58', + 'ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c' + ], + [ + 'e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7', + 'd3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4' + ], + [ + '8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8', + 'c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f' + ], + [ + '4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e', + '67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649' + ], + [ + '3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d', + 'cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826' + ], + [ + '674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b', + '299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5' + ], + [ + 'd32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f', + 'f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87' + ], + [ + '30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6', + '462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b' + ], + [ + 'be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297', + '62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc' + ], + [ + '93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a', + '7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c' + ], + [ + 'b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c', + 'ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f' + ], + [ + 'd5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52', + '4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a' + ], + [ + 'd3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb', + 'bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46' + ], + [ + '463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065', + 'bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f' + ], + [ + '7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917', + '603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03' + ], + [ + '74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9', + 'cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08' + ], + [ + '30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3', + '553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8' + ], + [ + '9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57', + '712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373' + ], + [ + '176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66', + 'ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3' + ], + [ + '75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8', + '9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8' + ], + [ + '809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721', + '9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1' + ], + [ + '1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180', + '4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9' + ] + ] + } +}; /***/ }, /* 190 */ /***/ function(module, exports, __webpack_require__) { - // ##untested handler## +"use strict"; +'use strict'; - const AbstractHandler = __webpack_require__(180); +var utils = exports; +var BN = __webpack_require__(4); - class GuildMemberAddHandler extends AbstractHandler { - handle(packet) { - const client = this.packetManager.client; - const data = packet.d; - const guild = client.guilds.get(data.guild_id); - if (guild) { - guild.memberCount++; - guild._addMember(data); - } - } - } +utils.assert = function assert(val, msg) { + if (!val) + throw new Error(msg || 'Assertion failed'); +}; + +function toArray(msg, enc) { + if (Array.isArray(msg)) + return msg.slice(); + if (!msg) + return []; + var res = []; + if (typeof msg !== 'string') { + for (var i = 0; i < msg.length; i++) + res[i] = msg[i] | 0; + return res; + } + if (!enc) { + for (var i = 0; i < msg.length; i++) { + var c = msg.charCodeAt(i); + var hi = c >> 8; + var lo = c & 0xff; + if (hi) + res.push(hi, lo); + else + res.push(lo); + } + } else if (enc === 'hex') { + msg = msg.replace(/[^a-z0-9]+/ig, ''); + if (msg.length % 2 !== 0) + msg = '0' + msg; + for (var i = 0; i < msg.length; i += 2) + res.push(parseInt(msg[i] + msg[i + 1], 16)); + } + return res; +} +utils.toArray = toArray; + +function zero2(word) { + if (word.length === 1) + return '0' + word; + else + return word; +} +utils.zero2 = zero2; + +function toHex(msg) { + var res = ''; + for (var i = 0; i < msg.length; i++) + res += zero2(msg[i].toString(16)); + return res; +} +utils.toHex = toHex; + +utils.encode = function encode(arr, enc) { + if (enc === 'hex') + return toHex(arr); + else + return arr; +}; + +// Represent num in a w-NAF form +function getNAF(num, w) { + var naf = []; + var ws = 1 << (w + 1); + var k = num.clone(); + while (k.cmpn(1) >= 0) { + var z; + if (k.isOdd()) { + var mod = k.andln(ws - 1); + if (mod > (ws >> 1) - 1) + z = (ws >> 1) - mod; + else + z = mod; + k.isubn(z); + } else { + z = 0; + } + naf.push(z); + + // Optimization, shift by word if possible + var shift = (k.cmpn(0) !== 0 && k.andln(ws - 1) === 0) ? (w + 1) : 1; + for (var i = 1; i < shift; i++) + naf.push(0); + k.iushrn(shift); + } + + return naf; +} +utils.getNAF = getNAF; + +// Represent k1, k2 in a Joint Sparse Form +function getJSF(k1, k2) { + var jsf = [ + [], + [] + ]; + + k1 = k1.clone(); + k2 = k2.clone(); + var d1 = 0; + var d2 = 0; + while (k1.cmpn(-d1) > 0 || k2.cmpn(-d2) > 0) { + + // First phase + var m14 = (k1.andln(3) + d1) & 3; + var m24 = (k2.andln(3) + d2) & 3; + if (m14 === 3) + m14 = -1; + if (m24 === 3) + m24 = -1; + var u1; + if ((m14 & 1) === 0) { + u1 = 0; + } else { + var m8 = (k1.andln(7) + d1) & 7; + if ((m8 === 3 || m8 === 5) && m24 === 2) + u1 = -m14; + else + u1 = m14; + } + jsf[0].push(u1); + + var u2; + if ((m24 & 1) === 0) { + u2 = 0; + } else { + var m8 = (k2.andln(7) + d2) & 7; + if ((m8 === 3 || m8 === 5) && m14 === 2) + u2 = -m24; + else + u2 = m24; + } + jsf[1].push(u2); + + // Second phase + if (2 * d1 === u1 + 1) + d1 = 1 - d1; + if (2 * d2 === u2 + 1) + d2 = 1 - d2; + k1.iushrn(1); + k2.iushrn(1); + } + + return jsf; +} +utils.getJSF = getJSF; + +function cachedProperty(obj, name, computer) { + var key = '_' + name; + obj.prototype[name] = function cachedProperty() { + return this[key] !== undefined ? this[key] : + this[key] = computer.call(this); + }; +} +utils.cachedProperty = cachedProperty; + +function parseBytes(bytes) { + return typeof bytes === 'string' ? utils.toArray(bytes, 'hex') : + bytes; +} +utils.parseBytes = parseBytes; + +function intFromLE(bytes) { + return new BN(bytes, 'hex', 'le'); +} +utils.intFromLE = intFromLE; - module.exports = GuildMemberAddHandler; /***/ }, /* 191 */ /***/ function(module, exports, __webpack_require__) { - // ##untested handler## +var hash = __webpack_require__(13); +var utils = hash.utils; +var assert = utils.assert; - const AbstractHandler = __webpack_require__(180); +function BlockHash() { + this.pending = null; + this.pendingTotal = 0; + this.blockSize = this.constructor.blockSize; + this.outSize = this.constructor.outSize; + this.hmacStrength = this.constructor.hmacStrength; + this.padLength = this.constructor.padLength / 8; + this.endian = 'big'; - class GuildMemberRemoveHandler extends AbstractHandler { - handle(packet) { - const client = this.packetManager.client; - const data = packet.d; - client.actions.GuildMemberRemove.handle(data); - } - } + this._delta8 = this.blockSize / 8; + this._delta32 = this.blockSize / 32; +} +exports.BlockHash = BlockHash; - module.exports = GuildMemberRemoveHandler; +BlockHash.prototype.update = function update(msg, enc) { + // Convert message to array, pad it, and join into 32bit blocks + msg = utils.toArray(msg, enc); + if (!this.pending) + this.pending = msg; + else + this.pending = this.pending.concat(msg); + this.pendingTotal += msg.length; + + // Enough data, try updating + if (this.pending.length >= this._delta8) { + msg = this.pending; + + // Process pending data in blocks + var r = msg.length % this._delta8; + this.pending = msg.slice(msg.length - r, msg.length); + if (this.pending.length === 0) + this.pending = null; + + msg = utils.join32(msg, 0, msg.length - r, this.endian); + for (var i = 0; i < msg.length; i += this._delta32) + this._update(msg, i, i + this._delta32); + } + + return this; +}; + +BlockHash.prototype.digest = function digest(enc) { + this.update(this._pad()); + assert(this.pending === null); + + return this._digest(enc); +}; + +BlockHash.prototype._pad = function pad() { + var len = this.pendingTotal; + var bytes = this._delta8; + var k = bytes - ((len + this.padLength) % bytes); + var res = new Array(k + this.padLength); + res[0] = 0x80; + for (var i = 1; i < k; i++) + res[i] = 0; + + // Append length + len <<= 3; + if (this.endian === 'big') { + for (var t = 8; t < this.padLength; t++) + res[i++] = 0; + + res[i++] = 0; + res[i++] = 0; + res[i++] = 0; + res[i++] = 0; + res[i++] = (len >>> 24) & 0xff; + res[i++] = (len >>> 16) & 0xff; + res[i++] = (len >>> 8) & 0xff; + res[i++] = len & 0xff; + } else { + res[i++] = len & 0xff; + res[i++] = (len >>> 8) & 0xff; + res[i++] = (len >>> 16) & 0xff; + res[i++] = (len >>> 24) & 0xff; + res[i++] = 0; + res[i++] = 0; + res[i++] = 0; + res[i++] = 0; + + for (var t = 8; t < this.padLength; t++) + res[i++] = 0; + } + + return res; +}; /***/ }, /* 192 */ /***/ function(module, exports, __webpack_require__) { - // ##untested handler## +var hmac = exports; - const AbstractHandler = __webpack_require__(180); +var hash = __webpack_require__(13); +var utils = hash.utils; +var assert = utils.assert; - class GuildMemberUpdateHandler extends AbstractHandler { - handle(packet) { - const client = this.packetManager.client; - const data = packet.d; +function Hmac(hash, key, enc) { + if (!(this instanceof Hmac)) + return new Hmac(hash, key, enc); + this.Hash = hash; + this.blockSize = hash.blockSize / 8; + this.outSize = hash.outSize / 8; + this.inner = null; + this.outer = null; - const guild = client.guilds.get(data.guild_id); - if (guild) { - const member = guild.members.get(data.user.id); - if (member) guild._updateMember(member, data); - } - } - } + this._init(utils.toArray(key, enc)); +} +module.exports = Hmac; - module.exports = GuildMemberUpdateHandler; +Hmac.prototype._init = function init(key) { + // Shorten key, if needed + if (key.length > this.blockSize) + key = new this.Hash().update(key).digest(); + assert(key.length <= this.blockSize); + + // Add padding to key + for (var i = key.length; i < this.blockSize; i++) + key.push(0); + + for (var i = 0; i < key.length; i++) + key[i] ^= 0x36; + this.inner = new this.Hash().update(key); + + // 0x36 ^ 0x5c = 0x6a + for (var i = 0; i < key.length; i++) + key[i] ^= 0x6a; + this.outer = new this.Hash().update(key); +}; + +Hmac.prototype.update = function update(msg, enc) { + this.inner.update(msg, enc); + return this; +}; + +Hmac.prototype.digest = function digest(enc) { + this.outer.update(this.inner.digest()); + return this.outer.digest(enc); +}; /***/ }, /* 193 */ /***/ function(module, exports, __webpack_require__) { - // ##untested## +var hash = __webpack_require__(13); +var utils = hash.utils; - const AbstractHandler = __webpack_require__(180); - const Constants = __webpack_require__(5); +var rotl32 = utils.rotl32; +var sum32 = utils.sum32; +var sum32_3 = utils.sum32_3; +var sum32_4 = utils.sum32_4; +var BlockHash = hash.common.BlockHash; - class GuildMembersChunkHandler extends AbstractHandler { - handle(packet) { - const client = this.packetManager.client; - const data = packet.d; - const guild = client.guilds.get(data.guild_id); - const members = []; +function RIPEMD160() { + if (!(this instanceof RIPEMD160)) + return new RIPEMD160(); - if (guild) { - for (const member of data.members) members.push(guild._addMember(member, false)); - } + BlockHash.call(this); - guild._checkChunks(); - client.emit(Constants.Events.GUILD_MEMBERS_CHUNK, members); - } - } + this.h = [ 0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0 ]; + this.endian = 'little'; +} +utils.inherits(RIPEMD160, BlockHash); +exports.ripemd160 = RIPEMD160; - /** - * Emitted whenever a chunk of guild members is received (all members come from the same guild) - * @event Client#guildMembersChunk - * @param {GuildMember[]} members The members in the chunk - */ +RIPEMD160.blockSize = 512; +RIPEMD160.outSize = 160; +RIPEMD160.hmacStrength = 192; +RIPEMD160.padLength = 64; - module.exports = GuildMembersChunkHandler; +RIPEMD160.prototype._update = function update(msg, start) { + var A = this.h[0]; + var B = this.h[1]; + var C = this.h[2]; + var D = this.h[3]; + var E = this.h[4]; + var Ah = A; + var Bh = B; + var Ch = C; + var Dh = D; + var Eh = E; + for (var j = 0; j < 80; j++) { + var T = sum32( + rotl32( + sum32_4(A, f(j, B, C, D), msg[r[j] + start], K(j)), + s[j]), + E); + A = E; + E = D; + D = rotl32(C, 10); + C = B; + B = T; + T = sum32( + rotl32( + sum32_4(Ah, f(79 - j, Bh, Ch, Dh), msg[rh[j] + start], Kh(j)), + sh[j]), + Eh); + Ah = Eh; + Eh = Dh; + Dh = rotl32(Ch, 10); + Ch = Bh; + Bh = T; + } + T = sum32_3(this.h[1], C, Dh); + this.h[1] = sum32_3(this.h[2], D, Eh); + this.h[2] = sum32_3(this.h[3], E, Ah); + this.h[3] = sum32_3(this.h[4], A, Bh); + this.h[4] = sum32_3(this.h[0], B, Ch); + this.h[0] = T; +}; + +RIPEMD160.prototype._digest = function digest(enc) { + if (enc === 'hex') + return utils.toHex32(this.h, 'little'); + else + return utils.split32(this.h, 'little'); +}; + +function f(j, x, y, z) { + if (j <= 15) + return x ^ y ^ z; + else if (j <= 31) + return (x & y) | ((~x) & z); + else if (j <= 47) + return (x | (~y)) ^ z; + else if (j <= 63) + return (x & z) | (y & (~z)); + else + return x ^ (y | (~z)); +} + +function K(j) { + if (j <= 15) + return 0x00000000; + else if (j <= 31) + return 0x5a827999; + else if (j <= 47) + return 0x6ed9eba1; + else if (j <= 63) + return 0x8f1bbcdc; + else + return 0xa953fd4e; +} + +function Kh(j) { + if (j <= 15) + return 0x50a28be6; + else if (j <= 31) + return 0x5c4dd124; + else if (j <= 47) + return 0x6d703ef3; + else if (j <= 63) + return 0x7a6d76e9; + else + return 0x00000000; +} + +var r = [ + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8, + 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12, + 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2, + 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13 +]; + +var rh = [ + 5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12, + 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2, + 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13, + 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14, + 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11 +]; + +var s = [ + 11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8, + 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12, + 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5, + 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12, + 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6 +]; + +var sh = [ + 8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6, + 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11, + 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5, + 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8, + 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11 +]; /***/ }, /* 194 */ /***/ function(module, exports, __webpack_require__) { - const AbstractHandler = __webpack_require__(180); +var hash = __webpack_require__(13); +var utils = hash.utils; +var assert = utils.assert; - class GuildRoleCreateHandler extends AbstractHandler { - handle(packet) { - const client = this.packetManager.client; - const data = packet.d; - client.actions.GuildRoleCreate.handle(data); - } - } +var rotr32 = utils.rotr32; +var rotl32 = utils.rotl32; +var sum32 = utils.sum32; +var sum32_4 = utils.sum32_4; +var sum32_5 = utils.sum32_5; +var rotr64_hi = utils.rotr64_hi; +var rotr64_lo = utils.rotr64_lo; +var shr64_hi = utils.shr64_hi; +var shr64_lo = utils.shr64_lo; +var sum64 = utils.sum64; +var sum64_hi = utils.sum64_hi; +var sum64_lo = utils.sum64_lo; +var sum64_4_hi = utils.sum64_4_hi; +var sum64_4_lo = utils.sum64_4_lo; +var sum64_5_hi = utils.sum64_5_hi; +var sum64_5_lo = utils.sum64_5_lo; +var BlockHash = hash.common.BlockHash; - module.exports = GuildRoleCreateHandler; +var sha256_K = [ + 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, + 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, + 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, + 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, + 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, + 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, + 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, + 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, + 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, + 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, + 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, + 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, + 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, + 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, + 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, + 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2 +]; + +var sha512_K = [ + 0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd, + 0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc, + 0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019, + 0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118, + 0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe, + 0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2, + 0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1, + 0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694, + 0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3, + 0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65, + 0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483, + 0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5, + 0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210, + 0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4, + 0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725, + 0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70, + 0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926, + 0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df, + 0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8, + 0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b, + 0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001, + 0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30, + 0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910, + 0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8, + 0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53, + 0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8, + 0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb, + 0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3, + 0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60, + 0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec, + 0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9, + 0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b, + 0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207, + 0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178, + 0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6, + 0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b, + 0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493, + 0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c, + 0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a, + 0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817 +]; + +var sha1_K = [ + 0x5A827999, 0x6ED9EBA1, + 0x8F1BBCDC, 0xCA62C1D6 +]; + +function SHA256() { + if (!(this instanceof SHA256)) + return new SHA256(); + + BlockHash.call(this); + this.h = [ 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, + 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19 ]; + this.k = sha256_K; + this.W = new Array(64); +} +utils.inherits(SHA256, BlockHash); +exports.sha256 = SHA256; + +SHA256.blockSize = 512; +SHA256.outSize = 256; +SHA256.hmacStrength = 192; +SHA256.padLength = 64; + +SHA256.prototype._update = function _update(msg, start) { + var W = this.W; + + for (var i = 0; i < 16; i++) + W[i] = msg[start + i]; + for (; i < W.length; i++) + W[i] = sum32_4(g1_256(W[i - 2]), W[i - 7], g0_256(W[i - 15]), W[i - 16]); + + var a = this.h[0]; + var b = this.h[1]; + var c = this.h[2]; + var d = this.h[3]; + var e = this.h[4]; + var f = this.h[5]; + var g = this.h[6]; + var h = this.h[7]; + + assert(this.k.length === W.length); + for (var i = 0; i < W.length; i++) { + var T1 = sum32_5(h, s1_256(e), ch32(e, f, g), this.k[i], W[i]); + var T2 = sum32(s0_256(a), maj32(a, b, c)); + h = g; + g = f; + f = e; + e = sum32(d, T1); + d = c; + c = b; + b = a; + a = sum32(T1, T2); + } + + this.h[0] = sum32(this.h[0], a); + this.h[1] = sum32(this.h[1], b); + this.h[2] = sum32(this.h[2], c); + this.h[3] = sum32(this.h[3], d); + this.h[4] = sum32(this.h[4], e); + this.h[5] = sum32(this.h[5], f); + this.h[6] = sum32(this.h[6], g); + this.h[7] = sum32(this.h[7], h); +}; + +SHA256.prototype._digest = function digest(enc) { + if (enc === 'hex') + return utils.toHex32(this.h, 'big'); + else + return utils.split32(this.h, 'big'); +}; + +function SHA224() { + if (!(this instanceof SHA224)) + return new SHA224(); + + SHA256.call(this); + this.h = [ 0xc1059ed8, 0x367cd507, 0x3070dd17, 0xf70e5939, + 0xffc00b31, 0x68581511, 0x64f98fa7, 0xbefa4fa4 ]; +} +utils.inherits(SHA224, SHA256); +exports.sha224 = SHA224; + +SHA224.blockSize = 512; +SHA224.outSize = 224; +SHA224.hmacStrength = 192; +SHA224.padLength = 64; + +SHA224.prototype._digest = function digest(enc) { + // Just truncate output + if (enc === 'hex') + return utils.toHex32(this.h.slice(0, 7), 'big'); + else + return utils.split32(this.h.slice(0, 7), 'big'); +}; + +function SHA512() { + if (!(this instanceof SHA512)) + return new SHA512(); + + BlockHash.call(this); + this.h = [ 0x6a09e667, 0xf3bcc908, + 0xbb67ae85, 0x84caa73b, + 0x3c6ef372, 0xfe94f82b, + 0xa54ff53a, 0x5f1d36f1, + 0x510e527f, 0xade682d1, + 0x9b05688c, 0x2b3e6c1f, + 0x1f83d9ab, 0xfb41bd6b, + 0x5be0cd19, 0x137e2179 ]; + this.k = sha512_K; + this.W = new Array(160); +} +utils.inherits(SHA512, BlockHash); +exports.sha512 = SHA512; + +SHA512.blockSize = 1024; +SHA512.outSize = 512; +SHA512.hmacStrength = 192; +SHA512.padLength = 128; + +SHA512.prototype._prepareBlock = function _prepareBlock(msg, start) { + var W = this.W; + + // 32 x 32bit words + for (var i = 0; i < 32; i++) + W[i] = msg[start + i]; + for (; i < W.length; i += 2) { + var c0_hi = g1_512_hi(W[i - 4], W[i - 3]); // i - 2 + var c0_lo = g1_512_lo(W[i - 4], W[i - 3]); + var c1_hi = W[i - 14]; // i - 7 + var c1_lo = W[i - 13]; + var c2_hi = g0_512_hi(W[i - 30], W[i - 29]); // i - 15 + var c2_lo = g0_512_lo(W[i - 30], W[i - 29]); + var c3_hi = W[i - 32]; // i - 16 + var c3_lo = W[i - 31]; + + W[i] = sum64_4_hi(c0_hi, c0_lo, + c1_hi, c1_lo, + c2_hi, c2_lo, + c3_hi, c3_lo); + W[i + 1] = sum64_4_lo(c0_hi, c0_lo, + c1_hi, c1_lo, + c2_hi, c2_lo, + c3_hi, c3_lo); + } +}; + +SHA512.prototype._update = function _update(msg, start) { + this._prepareBlock(msg, start); + + var W = this.W; + + var ah = this.h[0]; + var al = this.h[1]; + var bh = this.h[2]; + var bl = this.h[3]; + var ch = this.h[4]; + var cl = this.h[5]; + var dh = this.h[6]; + var dl = this.h[7]; + var eh = this.h[8]; + var el = this.h[9]; + var fh = this.h[10]; + var fl = this.h[11]; + var gh = this.h[12]; + var gl = this.h[13]; + var hh = this.h[14]; + var hl = this.h[15]; + + assert(this.k.length === W.length); + for (var i = 0; i < W.length; i += 2) { + var c0_hi = hh; + var c0_lo = hl; + var c1_hi = s1_512_hi(eh, el); + var c1_lo = s1_512_lo(eh, el); + var c2_hi = ch64_hi(eh, el, fh, fl, gh, gl); + var c2_lo = ch64_lo(eh, el, fh, fl, gh, gl); + var c3_hi = this.k[i]; + var c3_lo = this.k[i + 1]; + var c4_hi = W[i]; + var c4_lo = W[i + 1]; + + var T1_hi = sum64_5_hi(c0_hi, c0_lo, + c1_hi, c1_lo, + c2_hi, c2_lo, + c3_hi, c3_lo, + c4_hi, c4_lo); + var T1_lo = sum64_5_lo(c0_hi, c0_lo, + c1_hi, c1_lo, + c2_hi, c2_lo, + c3_hi, c3_lo, + c4_hi, c4_lo); + + var c0_hi = s0_512_hi(ah, al); + var c0_lo = s0_512_lo(ah, al); + var c1_hi = maj64_hi(ah, al, bh, bl, ch, cl); + var c1_lo = maj64_lo(ah, al, bh, bl, ch, cl); + + var T2_hi = sum64_hi(c0_hi, c0_lo, c1_hi, c1_lo); + var T2_lo = sum64_lo(c0_hi, c0_lo, c1_hi, c1_lo); + + hh = gh; + hl = gl; + + gh = fh; + gl = fl; + + fh = eh; + fl = el; + + eh = sum64_hi(dh, dl, T1_hi, T1_lo); + el = sum64_lo(dl, dl, T1_hi, T1_lo); + + dh = ch; + dl = cl; + + ch = bh; + cl = bl; + + bh = ah; + bl = al; + + ah = sum64_hi(T1_hi, T1_lo, T2_hi, T2_lo); + al = sum64_lo(T1_hi, T1_lo, T2_hi, T2_lo); + } + + sum64(this.h, 0, ah, al); + sum64(this.h, 2, bh, bl); + sum64(this.h, 4, ch, cl); + sum64(this.h, 6, dh, dl); + sum64(this.h, 8, eh, el); + sum64(this.h, 10, fh, fl); + sum64(this.h, 12, gh, gl); + sum64(this.h, 14, hh, hl); +}; + +SHA512.prototype._digest = function digest(enc) { + if (enc === 'hex') + return utils.toHex32(this.h, 'big'); + else + return utils.split32(this.h, 'big'); +}; + +function SHA384() { + if (!(this instanceof SHA384)) + return new SHA384(); + + SHA512.call(this); + this.h = [ 0xcbbb9d5d, 0xc1059ed8, + 0x629a292a, 0x367cd507, + 0x9159015a, 0x3070dd17, + 0x152fecd8, 0xf70e5939, + 0x67332667, 0xffc00b31, + 0x8eb44a87, 0x68581511, + 0xdb0c2e0d, 0x64f98fa7, + 0x47b5481d, 0xbefa4fa4 ]; +} +utils.inherits(SHA384, SHA512); +exports.sha384 = SHA384; + +SHA384.blockSize = 1024; +SHA384.outSize = 384; +SHA384.hmacStrength = 192; +SHA384.padLength = 128; + +SHA384.prototype._digest = function digest(enc) { + if (enc === 'hex') + return utils.toHex32(this.h.slice(0, 12), 'big'); + else + return utils.split32(this.h.slice(0, 12), 'big'); +}; + +function SHA1() { + if (!(this instanceof SHA1)) + return new SHA1(); + + BlockHash.call(this); + this.h = [ 0x67452301, 0xefcdab89, 0x98badcfe, + 0x10325476, 0xc3d2e1f0 ]; + this.W = new Array(80); +} + +utils.inherits(SHA1, BlockHash); +exports.sha1 = SHA1; + +SHA1.blockSize = 512; +SHA1.outSize = 160; +SHA1.hmacStrength = 80; +SHA1.padLength = 64; + +SHA1.prototype._update = function _update(msg, start) { + var W = this.W; + + for (var i = 0; i < 16; i++) + W[i] = msg[start + i]; + + for(; i < W.length; i++) + W[i] = rotl32(W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16], 1); + + var a = this.h[0]; + var b = this.h[1]; + var c = this.h[2]; + var d = this.h[3]; + var e = this.h[4]; + + for (var i = 0; i < W.length; i++) { + var s = ~~(i / 20); + var t = sum32_5(rotl32(a, 5), ft_1(s, b, c, d), e, W[i], sha1_K[s]); + e = d; + d = c; + c = rotl32(b, 30); + b = a; + a = t; + } + + this.h[0] = sum32(this.h[0], a); + this.h[1] = sum32(this.h[1], b); + this.h[2] = sum32(this.h[2], c); + this.h[3] = sum32(this.h[3], d); + this.h[4] = sum32(this.h[4], e); +}; + +SHA1.prototype._digest = function digest(enc) { + if (enc === 'hex') + return utils.toHex32(this.h, 'big'); + else + return utils.split32(this.h, 'big'); +}; + +function ch32(x, y, z) { + return (x & y) ^ ((~x) & z); +} + +function maj32(x, y, z) { + return (x & y) ^ (x & z) ^ (y & z); +} + +function p32(x, y, z) { + return x ^ y ^ z; +} + +function s0_256(x) { + return rotr32(x, 2) ^ rotr32(x, 13) ^ rotr32(x, 22); +} + +function s1_256(x) { + return rotr32(x, 6) ^ rotr32(x, 11) ^ rotr32(x, 25); +} + +function g0_256(x) { + return rotr32(x, 7) ^ rotr32(x, 18) ^ (x >>> 3); +} + +function g1_256(x) { + return rotr32(x, 17) ^ rotr32(x, 19) ^ (x >>> 10); +} + +function ft_1(s, x, y, z) { + if (s === 0) + return ch32(x, y, z); + if (s === 1 || s === 3) + return p32(x, y, z); + if (s === 2) + return maj32(x, y, z); +} + +function ch64_hi(xh, xl, yh, yl, zh, zl) { + var r = (xh & yh) ^ ((~xh) & zh); + if (r < 0) + r += 0x100000000; + return r; +} + +function ch64_lo(xh, xl, yh, yl, zh, zl) { + var r = (xl & yl) ^ ((~xl) & zl); + if (r < 0) + r += 0x100000000; + return r; +} + +function maj64_hi(xh, xl, yh, yl, zh, zl) { + var r = (xh & yh) ^ (xh & zh) ^ (yh & zh); + if (r < 0) + r += 0x100000000; + return r; +} + +function maj64_lo(xh, xl, yh, yl, zh, zl) { + var r = (xl & yl) ^ (xl & zl) ^ (yl & zl); + if (r < 0) + r += 0x100000000; + return r; +} + +function s0_512_hi(xh, xl) { + var c0_hi = rotr64_hi(xh, xl, 28); + var c1_hi = rotr64_hi(xl, xh, 2); // 34 + var c2_hi = rotr64_hi(xl, xh, 7); // 39 + + var r = c0_hi ^ c1_hi ^ c2_hi; + if (r < 0) + r += 0x100000000; + return r; +} + +function s0_512_lo(xh, xl) { + var c0_lo = rotr64_lo(xh, xl, 28); + var c1_lo = rotr64_lo(xl, xh, 2); // 34 + var c2_lo = rotr64_lo(xl, xh, 7); // 39 + + var r = c0_lo ^ c1_lo ^ c2_lo; + if (r < 0) + r += 0x100000000; + return r; +} + +function s1_512_hi(xh, xl) { + var c0_hi = rotr64_hi(xh, xl, 14); + var c1_hi = rotr64_hi(xh, xl, 18); + var c2_hi = rotr64_hi(xl, xh, 9); // 41 + + var r = c0_hi ^ c1_hi ^ c2_hi; + if (r < 0) + r += 0x100000000; + return r; +} + +function s1_512_lo(xh, xl) { + var c0_lo = rotr64_lo(xh, xl, 14); + var c1_lo = rotr64_lo(xh, xl, 18); + var c2_lo = rotr64_lo(xl, xh, 9); // 41 + + var r = c0_lo ^ c1_lo ^ c2_lo; + if (r < 0) + r += 0x100000000; + return r; +} + +function g0_512_hi(xh, xl) { + var c0_hi = rotr64_hi(xh, xl, 1); + var c1_hi = rotr64_hi(xh, xl, 8); + var c2_hi = shr64_hi(xh, xl, 7); + + var r = c0_hi ^ c1_hi ^ c2_hi; + if (r < 0) + r += 0x100000000; + return r; +} + +function g0_512_lo(xh, xl) { + var c0_lo = rotr64_lo(xh, xl, 1); + var c1_lo = rotr64_lo(xh, xl, 8); + var c2_lo = shr64_lo(xh, xl, 7); + + var r = c0_lo ^ c1_lo ^ c2_lo; + if (r < 0) + r += 0x100000000; + return r; +} + +function g1_512_hi(xh, xl) { + var c0_hi = rotr64_hi(xh, xl, 19); + var c1_hi = rotr64_hi(xl, xh, 29); // 61 + var c2_hi = shr64_hi(xh, xl, 6); + + var r = c0_hi ^ c1_hi ^ c2_hi; + if (r < 0) + r += 0x100000000; + return r; +} + +function g1_512_lo(xh, xl) { + var c0_lo = rotr64_lo(xh, xl, 19); + var c1_lo = rotr64_lo(xl, xh, 29); // 61 + var c2_lo = shr64_lo(xh, xl, 6); + + var r = c0_lo ^ c1_lo ^ c2_lo; + if (r < 0) + r += 0x100000000; + return r; +} /***/ }, /* 195 */ /***/ function(module, exports, __webpack_require__) { - const AbstractHandler = __webpack_require__(180); +var utils = exports; +var inherits = __webpack_require__(1); - class GuildRoleDeleteHandler extends AbstractHandler { - handle(packet) { - const client = this.packetManager.client; - const data = packet.d; - client.actions.GuildRoleDelete.handle(data); - } - } +function toArray(msg, enc) { + if (Array.isArray(msg)) + return msg.slice(); + if (!msg) + return []; + var res = []; + if (typeof msg === 'string') { + if (!enc) { + for (var i = 0; i < msg.length; i++) { + var c = msg.charCodeAt(i); + var hi = c >> 8; + var lo = c & 0xff; + if (hi) + res.push(hi, lo); + else + res.push(lo); + } + } else if (enc === 'hex') { + msg = msg.replace(/[^a-z0-9]+/ig, ''); + if (msg.length % 2 !== 0) + msg = '0' + msg; + for (var i = 0; i < msg.length; i += 2) + res.push(parseInt(msg[i] + msg[i + 1], 16)); + } + } else { + for (var i = 0; i < msg.length; i++) + res[i] = msg[i] | 0; + } + return res; +} +utils.toArray = toArray; - module.exports = GuildRoleDeleteHandler; +function toHex(msg) { + var res = ''; + for (var i = 0; i < msg.length; i++) + res += zero2(msg[i].toString(16)); + return res; +} +utils.toHex = toHex; + +function htonl(w) { + var res = (w >>> 24) | + ((w >>> 8) & 0xff00) | + ((w << 8) & 0xff0000) | + ((w & 0xff) << 24); + return res >>> 0; +} +utils.htonl = htonl; + +function toHex32(msg, endian) { + var res = ''; + for (var i = 0; i < msg.length; i++) { + var w = msg[i]; + if (endian === 'little') + w = htonl(w); + res += zero8(w.toString(16)); + } + return res; +} +utils.toHex32 = toHex32; + +function zero2(word) { + if (word.length === 1) + return '0' + word; + else + return word; +} +utils.zero2 = zero2; + +function zero8(word) { + if (word.length === 7) + return '0' + word; + else if (word.length === 6) + return '00' + word; + else if (word.length === 5) + return '000' + word; + else if (word.length === 4) + return '0000' + word; + else if (word.length === 3) + return '00000' + word; + else if (word.length === 2) + return '000000' + word; + else if (word.length === 1) + return '0000000' + word; + else + return word; +} +utils.zero8 = zero8; + +function join32(msg, start, end, endian) { + var len = end - start; + assert(len % 4 === 0); + var res = new Array(len / 4); + for (var i = 0, k = start; i < res.length; i++, k += 4) { + var w; + if (endian === 'big') + w = (msg[k] << 24) | (msg[k + 1] << 16) | (msg[k + 2] << 8) | msg[k + 3]; + else + w = (msg[k + 3] << 24) | (msg[k + 2] << 16) | (msg[k + 1] << 8) | msg[k]; + res[i] = w >>> 0; + } + return res; +} +utils.join32 = join32; + +function split32(msg, endian) { + var res = new Array(msg.length * 4); + for (var i = 0, k = 0; i < msg.length; i++, k += 4) { + var m = msg[i]; + if (endian === 'big') { + res[k] = m >>> 24; + res[k + 1] = (m >>> 16) & 0xff; + res[k + 2] = (m >>> 8) & 0xff; + res[k + 3] = m & 0xff; + } else { + res[k + 3] = m >>> 24; + res[k + 2] = (m >>> 16) & 0xff; + res[k + 1] = (m >>> 8) & 0xff; + res[k] = m & 0xff; + } + } + return res; +} +utils.split32 = split32; + +function rotr32(w, b) { + return (w >>> b) | (w << (32 - b)); +} +utils.rotr32 = rotr32; + +function rotl32(w, b) { + return (w << b) | (w >>> (32 - b)); +} +utils.rotl32 = rotl32; + +function sum32(a, b) { + return (a + b) >>> 0; +} +utils.sum32 = sum32; + +function sum32_3(a, b, c) { + return (a + b + c) >>> 0; +} +utils.sum32_3 = sum32_3; + +function sum32_4(a, b, c, d) { + return (a + b + c + d) >>> 0; +} +utils.sum32_4 = sum32_4; + +function sum32_5(a, b, c, d, e) { + return (a + b + c + d + e) >>> 0; +} +utils.sum32_5 = sum32_5; + +function assert(cond, msg) { + if (!cond) + throw new Error(msg || 'Assertion failed'); +} +utils.assert = assert; + +utils.inherits = inherits; + +function sum64(buf, pos, ah, al) { + var bh = buf[pos]; + var bl = buf[pos + 1]; + + var lo = (al + bl) >>> 0; + var hi = (lo < al ? 1 : 0) + ah + bh; + buf[pos] = hi >>> 0; + buf[pos + 1] = lo; +} +exports.sum64 = sum64; + +function sum64_hi(ah, al, bh, bl) { + var lo = (al + bl) >>> 0; + var hi = (lo < al ? 1 : 0) + ah + bh; + return hi >>> 0; +}; +exports.sum64_hi = sum64_hi; + +function sum64_lo(ah, al, bh, bl) { + var lo = al + bl; + return lo >>> 0; +}; +exports.sum64_lo = sum64_lo; + +function sum64_4_hi(ah, al, bh, bl, ch, cl, dh, dl) { + var carry = 0; + var lo = al; + lo = (lo + bl) >>> 0; + carry += lo < al ? 1 : 0; + lo = (lo + cl) >>> 0; + carry += lo < cl ? 1 : 0; + lo = (lo + dl) >>> 0; + carry += lo < dl ? 1 : 0; + + var hi = ah + bh + ch + dh + carry; + return hi >>> 0; +}; +exports.sum64_4_hi = sum64_4_hi; + +function sum64_4_lo(ah, al, bh, bl, ch, cl, dh, dl) { + var lo = al + bl + cl + dl; + return lo >>> 0; +}; +exports.sum64_4_lo = sum64_4_lo; + +function sum64_5_hi(ah, al, bh, bl, ch, cl, dh, dl, eh, el) { + var carry = 0; + var lo = al; + lo = (lo + bl) >>> 0; + carry += lo < al ? 1 : 0; + lo = (lo + cl) >>> 0; + carry += lo < cl ? 1 : 0; + lo = (lo + dl) >>> 0; + carry += lo < dl ? 1 : 0; + lo = (lo + el) >>> 0; + carry += lo < el ? 1 : 0; + + var hi = ah + bh + ch + dh + eh + carry; + return hi >>> 0; +}; +exports.sum64_5_hi = sum64_5_hi; + +function sum64_5_lo(ah, al, bh, bl, ch, cl, dh, dl, eh, el) { + var lo = al + bl + cl + dl + el; + + return lo >>> 0; +}; +exports.sum64_5_lo = sum64_5_lo; + +function rotr64_hi(ah, al, num) { + var r = (al << (32 - num)) | (ah >>> num); + return r >>> 0; +}; +exports.rotr64_hi = rotr64_hi; + +function rotr64_lo(ah, al, num) { + var r = (ah << (32 - num)) | (al >>> num); + return r >>> 0; +}; +exports.rotr64_lo = rotr64_lo; + +function shr64_hi(ah, al, num) { + return ah >>> num; +}; +exports.shr64_hi = shr64_hi; + +function shr64_lo(ah, al, num) { + var r = (ah << (32 - num)) | (al >>> num); + return r >>> 0; +}; +exports.shr64_lo = shr64_lo; /***/ }, /* 196 */ /***/ function(module, exports, __webpack_require__) { - const AbstractHandler = __webpack_require__(180); +var Stream = __webpack_require__(9); +var Response = __webpack_require__(197); +var Base64 = __webpack_require__(138); +var inherits = __webpack_require__(1); - class GuildRoleUpdateHandler extends AbstractHandler { - handle(packet) { - const client = this.packetManager.client; - const data = packet.d; - client.actions.GuildRoleUpdate.handle(data); - } - } +var Request = module.exports = function (xhr, params) { + var self = this; + self.writable = true; + self.xhr = xhr; + self.body = []; + + self.uri = (params.protocol || 'http:') + '//' + + params.host + + (params.port ? ':' + params.port : '') + + (params.path || '/') + ; + + if (typeof params.withCredentials === 'undefined') { + params.withCredentials = true; + } - module.exports = GuildRoleUpdateHandler; + try { xhr.withCredentials = params.withCredentials } + catch (e) {} + + if (params.responseType) try { xhr.responseType = params.responseType } + catch (e) {} + + xhr.open( + params.method || 'GET', + self.uri, + true + ); + + xhr.onerror = function(event) { + self.emit('error', new Error('Network error')); + }; + + self._headers = {}; + + if (params.headers) { + var keys = objectKeys(params.headers); + for (var i = 0; i < keys.length; i++) { + var key = keys[i]; + if (!self.isSafeRequestHeader(key)) continue; + var value = params.headers[key]; + self.setHeader(key, value); + } + } + + if (params.auth) { + //basic auth + this.setHeader('Authorization', 'Basic ' + Base64.btoa(params.auth)); + } + + var res = new Response; + res.on('close', function () { + self.emit('close'); + }); + + res.on('ready', function () { + self.emit('response', res); + }); + + res.on('error', function (err) { + self.emit('error', err); + }); + + xhr.onreadystatechange = function () { + // Fix for IE9 bug + // SCRIPT575: Could not complete the operation due to error c00c023f + // It happens when a request is aborted, calling the success callback anyway with readyState === 4 + if (xhr.__aborted) return; + res.handle(xhr); + }; +}; + +inherits(Request, Stream); + +Request.prototype.setHeader = function (key, value) { + this._headers[key.toLowerCase()] = value +}; + +Request.prototype.getHeader = function (key) { + return this._headers[key.toLowerCase()] +}; + +Request.prototype.removeHeader = function (key) { + delete this._headers[key.toLowerCase()] +}; + +Request.prototype.write = function (s) { + this.body.push(s); +}; + +Request.prototype.destroy = function (s) { + this.xhr.__aborted = true; + this.xhr.abort(); + this.emit('close'); +}; + +Request.prototype.end = function (s) { + if (s !== undefined) this.body.push(s); + + var keys = objectKeys(this._headers); + for (var i = 0; i < keys.length; i++) { + var key = keys[i]; + var value = this._headers[key]; + if (isArray(value)) { + for (var j = 0; j < value.length; j++) { + this.xhr.setRequestHeader(key, value[j]); + } + } + else this.xhr.setRequestHeader(key, value) + } + + if (this.body.length === 0) { + this.xhr.send(''); + } + else if (typeof this.body[0] === 'string') { + this.xhr.send(this.body.join('')); + } + else if (isArray(this.body[0])) { + var body = []; + for (var i = 0; i < this.body.length; i++) { + body.push.apply(body, this.body[i]); + } + this.xhr.send(body); + } + else if (/Array/.test(Object.prototype.toString.call(this.body[0]))) { + var len = 0; + for (var i = 0; i < this.body.length; i++) { + len += this.body[i].length; + } + var body = new(this.body[0].constructor)(len); + var k = 0; + + for (var i = 0; i < this.body.length; i++) { + var b = this.body[i]; + for (var j = 0; j < b.length; j++) { + body[k++] = b[j]; + } + } + this.xhr.send(body); + } + else if (isXHR2Compatible(this.body[0])) { + this.xhr.send(this.body[0]); + } + else { + var body = ''; + for (var i = 0; i < this.body.length; i++) { + body += this.body[i].toString(); + } + this.xhr.send(body); + } +}; + +// Taken from http://dxr.mozilla.org/mozilla/mozilla-central/content/base/src/nsXMLHttpRequest.cpp.html +Request.unsafeHeaders = [ + "accept-charset", + "accept-encoding", + "access-control-request-headers", + "access-control-request-method", + "connection", + "content-length", + "cookie", + "cookie2", + "content-transfer-encoding", + "date", + "expect", + "host", + "keep-alive", + "origin", + "referer", + "te", + "trailer", + "transfer-encoding", + "upgrade", + "user-agent", + "via" +]; + +Request.prototype.isSafeRequestHeader = function (headerName) { + if (!headerName) return false; + return indexOf(Request.unsafeHeaders, headerName.toLowerCase()) === -1; +}; + +var objectKeys = Object.keys || function (obj) { + var keys = []; + for (var key in obj) keys.push(key); + return keys; +}; + +var isArray = Array.isArray || function (xs) { + return Object.prototype.toString.call(xs) === '[object Array]'; +}; + +var indexOf = function (xs, x) { + if (xs.indexOf) return xs.indexOf(x); + for (var i = 0; i < xs.length; i++) { + if (xs[i] === x) return i; + } + return -1; +}; + +var isXHR2Compatible = function (obj) { + if (typeof Blob !== 'undefined' && obj instanceof Blob) return true; + if (typeof ArrayBuffer !== 'undefined' && obj instanceof ArrayBuffer) return true; + if (typeof FormData !== 'undefined' && obj instanceof FormData) return true; +}; /***/ }, /* 197 */ /***/ function(module, exports, __webpack_require__) { - const AbstractHandler = __webpack_require__(180); +var Stream = __webpack_require__(9); +var util = __webpack_require__(8); - class GuildSyncHandler extends AbstractHandler { - handle(packet) { - const client = this.packetManager.client; - const data = packet.d; - client.actions.GuildSync.handle(data); - } - } +var Response = module.exports = function (res) { + this.offset = 0; + this.readable = true; +}; - module.exports = GuildSyncHandler; +util.inherits(Response, Stream); + +var capable = { + streaming : true, + status2 : true +}; + +function parseHeaders (res) { + var lines = res.getAllResponseHeaders().split(/\r?\n/); + var headers = {}; + for (var i = 0; i < lines.length; i++) { + var line = lines[i]; + if (line === '') continue; + + var m = line.match(/^([^:]+):\s*(.*)/); + if (m) { + var key = m[1].toLowerCase(), value = m[2]; + + if (headers[key] !== undefined) { + + if (isArray(headers[key])) { + headers[key].push(value); + } + else { + headers[key] = [ headers[key], value ]; + } + } + else { + headers[key] = value; + } + } + else { + headers[line] = true; + } + } + return headers; +} + +Response.prototype.getResponse = function (xhr) { + var respType = String(xhr.responseType).toLowerCase(); + if (respType === 'blob') return xhr.responseBlob || xhr.response; + if (respType === 'arraybuffer') return xhr.response; + return xhr.responseText; +} + +Response.prototype.getHeader = function (key) { + return this.headers[key.toLowerCase()]; +}; + +Response.prototype.handle = function (res) { + if (res.readyState === 2 && capable.status2) { + try { + this.statusCode = res.status; + this.headers = parseHeaders(res); + } + catch (err) { + capable.status2 = false; + } + + if (capable.status2) { + this.emit('ready'); + } + } + else if (capable.streaming && res.readyState === 3) { + try { + if (!this.statusCode) { + this.statusCode = res.status; + this.headers = parseHeaders(res); + this.emit('ready'); + } + } + catch (err) {} + + try { + this._emitData(res); + } + catch (err) { + capable.streaming = false; + } + } + else if (res.readyState === 4) { + if (!this.statusCode) { + this.statusCode = res.status; + this.emit('ready'); + } + this._emitData(res); + + if (res.error) { + this.emit('error', this.getResponse(res)); + } + else this.emit('end'); + + this.emit('close'); + } +}; + +Response.prototype._emitData = function (res) { + var respBody = this.getResponse(res); + if (respBody.toString().match(/ArrayBuffer/)) { + this.emit('data', new Uint8Array(respBody, this.offset)); + this.offset = respBody.byteLength; + return; + } + if (respBody.length > this.offset) { + this.emit('data', respBody.slice(this.offset)); + this.offset = respBody.length; + } +}; + +var isArray = Array.isArray || function (xs) { + return Object.prototype.toString.call(xs) === '[object Array]'; +}; /***/ }, /* 198 */ -/***/ function(module, exports, __webpack_require__) { +/***/ function(module, exports) { - const AbstractHandler = __webpack_require__(180); +exports.read = function (buffer, offset, isLE, mLen, nBytes) { + var e, m + var eLen = nBytes * 8 - mLen - 1 + var eMax = (1 << eLen) - 1 + var eBias = eMax >> 1 + var nBits = -7 + var i = isLE ? (nBytes - 1) : 0 + var d = isLE ? -1 : 1 + var s = buffer[offset + i] - class GuildUpdateHandler extends AbstractHandler { - handle(packet) { - const client = this.packetManager.client; - const data = packet.d; - client.actions.GuildUpdate.handle(data); - } - } + i += d - module.exports = GuildUpdateHandler; + e = s & ((1 << (-nBits)) - 1) + s >>= (-nBits) + nBits += eLen + for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8) {} + + m = e & ((1 << (-nBits)) - 1) + e >>= (-nBits) + nBits += mLen + for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8) {} + + if (e === 0) { + e = 1 - eBias + } else if (e === eMax) { + return m ? NaN : ((s ? -1 : 1) * Infinity) + } else { + m = m + Math.pow(2, mLen) + e = e - eBias + } + return (s ? -1 : 1) * m * Math.pow(2, e - mLen) +} + +exports.write = function (buffer, value, offset, isLE, mLen, nBytes) { + var e, m, c + var eLen = nBytes * 8 - mLen - 1 + var eMax = (1 << eLen) - 1 + var eBias = eMax >> 1 + var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0) + var i = isLE ? 0 : (nBytes - 1) + var d = isLE ? 1 : -1 + var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0 + + value = Math.abs(value) + + if (isNaN(value) || value === Infinity) { + m = isNaN(value) ? 1 : 0 + e = eMax + } else { + e = Math.floor(Math.log(value) / Math.LN2) + if (value * (c = Math.pow(2, -e)) < 1) { + e-- + c *= 2 + } + if (e + eBias >= 1) { + value += rt / c + } else { + value += rt * Math.pow(2, 1 - eBias) + } + if (value * c >= 2) { + e++ + c /= 2 + } + + if (e + eBias >= eMax) { + m = 0 + e = eMax + } else if (e + eBias >= 1) { + m = (value * c - 1) * Math.pow(2, mLen) + e = e + eBias + } else { + m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen) + e = 0 + } + } + + for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {} + + e = (e << mLen) | m + eLen += mLen + for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {} + + buffer[offset + i - d] |= s * 128 +} /***/ }, /* 199 */ -/***/ function(module, exports, __webpack_require__) { +/***/ function(module, exports) { - const AbstractHandler = __webpack_require__(180); - const Constants = __webpack_require__(5); - class MessageCreateHandler extends AbstractHandler { - handle(packet) { - const client = this.packetManager.client; - const data = packet.d; - const response = client.actions.MessageCreate.handle(data); - if (response.message) client.emit(Constants.Events.MESSAGE_CREATE, response.message); - } - } - - /** - * Emitted whenever a message is created - * @event Client#message - * @param {Message} message The created message - */ - - module.exports = MessageCreateHandler; +var indexOf = [].indexOf; +module.exports = function(arr, obj){ + if (indexOf) return arr.indexOf(obj); + for (var i = 0; i < arr.length; ++i) { + if (arr[i] === obj) return i; + } + return -1; +}; /***/ }, /* 200 */ -/***/ function(module, exports, __webpack_require__) { +/***/ function(module, exports) { - const AbstractHandler = __webpack_require__(180); - const Constants = __webpack_require__(5); - - class MessageDeleteHandler extends AbstractHandler { - handle(packet) { - const client = this.packetManager.client; - const data = packet.d; - const response = client.actions.MessageDelete.handle(data); - if (response.message) client.emit(Constants.Events.MESSAGE_DELETE, response.message); - } +module.exports = { + "modp1": { + "gen": "02", + "prime": "ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff" + }, + "modp2": { + "gen": "02", + "prime": "ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff" + }, + "modp5": { + "gen": "02", + "prime": "ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff" + }, + "modp14": { + "gen": "02", + "prime": "ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aacaa68ffffffffffffffff" + }, + "modp15": { + "gen": "02", + "prime": "ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffff" + }, + "modp16": { + "gen": "02", + "prime": "ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffff" + }, + "modp17": { + "gen": "02", + "prime": "ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff" + }, + "modp18": { + "gen": "02", + "prime": "ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff" } - - /** - * Emitted whenever a message is deleted - * @event Client#messageDelete - * @param {Message} message The deleted message - */ - - module.exports = MessageDeleteHandler; - +}; /***/ }, /* 201 */ -/***/ function(module, exports, __webpack_require__) { - - const AbstractHandler = __webpack_require__(180); - - class MessageDeleteBulkHandler extends AbstractHandler { - handle(packet) { - const client = this.packetManager.client; - const data = packet.d; - client.actions.MessageDeleteBulk.handle(data); - } - } - - /** - * Emitted whenever messages are deleted in bulk - * @event Client#messageDeleteBulk - * @param {Collection} messages The deleted messages, mapped by their ID - */ - - module.exports = MessageDeleteBulkHandler; +/***/ function(module, exports) { +module.exports = { + "_args": [ + [ + { + "raw": "elliptic@^6.0.0", + "scope": null, + "escapedName": "elliptic", + "name": "elliptic", + "rawSpec": "^6.0.0", + "spec": ">=6.0.0 <7.0.0", + "type": "range" + }, + "/home/travis/build/hydrabolt/discord.js/node_modules/browserify-sign" + ] + ], + "_from": "elliptic@>=6.0.0 <7.0.0", + "_id": "elliptic@6.3.2", + "_inCache": true, + "_location": "/elliptic", + "_nodeVersion": "6.3.0", + "_npmOperationalInternal": { + "host": "packages-16-east.internal.npmjs.com", + "tmp": "tmp/elliptic-6.3.2.tgz_1473938837205_0.3108903462998569" + }, + "_npmUser": { + "name": "indutny", + "email": "fedor@indutny.com" + }, + "_npmVersion": "3.10.3", + "_phantomChildren": {}, + "_requested": { + "raw": "elliptic@^6.0.0", + "scope": null, + "escapedName": "elliptic", + "name": "elliptic", + "rawSpec": "^6.0.0", + "spec": ">=6.0.0 <7.0.0", + "type": "range" + }, + "_requiredBy": [ + "/browserify-sign", + "/create-ecdh" + ], + "_resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.3.2.tgz", + "_shasum": "e4c81e0829cf0a65ab70e998b8232723b5c1bc48", + "_shrinkwrap": null, + "_spec": "elliptic@^6.0.0", + "_where": "/home/travis/build/hydrabolt/discord.js/node_modules/browserify-sign", + "author": { + "name": "Fedor Indutny", + "email": "fedor@indutny.com" + }, + "bugs": { + "url": "https://github.com/indutny/elliptic/issues" + }, + "dependencies": { + "bn.js": "^4.4.0", + "brorand": "^1.0.1", + "hash.js": "^1.0.0", + "inherits": "^2.0.1" + }, + "description": "EC cryptography", + "devDependencies": { + "brfs": "^1.4.3", + "coveralls": "^2.11.3", + "grunt": "^0.4.5", + "grunt-browserify": "^5.0.0", + "grunt-contrib-connect": "^1.0.0", + "grunt-contrib-copy": "^1.0.0", + "grunt-contrib-uglify": "^1.0.1", + "grunt-mocha-istanbul": "^3.0.1", + "grunt-saucelabs": "^8.6.2", + "istanbul": "^0.4.2", + "jscs": "^2.9.0", + "jshint": "^2.6.0", + "mocha": "^2.1.0" + }, + "directories": {}, + "dist": { + "shasum": "e4c81e0829cf0a65ab70e998b8232723b5c1bc48", + "tarball": "https://registry.npmjs.org/elliptic/-/elliptic-6.3.2.tgz" + }, + "files": [ + "lib" + ], + "gitHead": "cbace4683a4a548dc0306ef36756151a20299cd5", + "homepage": "https://github.com/indutny/elliptic", + "keywords": [ + "EC", + "Elliptic", + "curve", + "Cryptography" + ], + "license": "MIT", + "main": "lib/elliptic.js", + "maintainers": [ + { + "name": "indutny", + "email": "fedor@indutny.com" + } + ], + "name": "elliptic", + "optionalDependencies": {}, + "readme": "ERROR: No README data found!", + "repository": { + "type": "git", + "url": "git+ssh://git@github.com/indutny/elliptic.git" + }, + "scripts": { + "jscs": "jscs benchmarks/*.js lib/*.js lib/**/*.js lib/**/**/*.js test/index.js", + "jshint": "jscs benchmarks/*.js lib/*.js lib/**/*.js lib/**/**/*.js test/index.js", + "lint": "npm run jscs && npm run jshint", + "test": "npm run lint && npm run unit", + "unit": "istanbul test _mocha --reporter=spec test/index.js", + "version": "grunt dist && git add dist/" + }, + "version": "6.3.2" +}; /***/ }, /* 202 */ -/***/ function(module, exports, __webpack_require__) { - - const AbstractHandler = __webpack_require__(180); - - class MessageReactionAddHandler extends AbstractHandler { - handle(packet) { - const client = this.packetManager.client; - const data = packet.d; - client.actions.MessageReactionAdd.handle(data); - } - } - - module.exports = MessageReactionAddHandler; +/***/ function(module, exports) { +module.exports = { + "2.16.840.1.101.3.4.1.1": "aes-128-ecb", + "2.16.840.1.101.3.4.1.2": "aes-128-cbc", + "2.16.840.1.101.3.4.1.3": "aes-128-ofb", + "2.16.840.1.101.3.4.1.4": "aes-128-cfb", + "2.16.840.1.101.3.4.1.21": "aes-192-ecb", + "2.16.840.1.101.3.4.1.22": "aes-192-cbc", + "2.16.840.1.101.3.4.1.23": "aes-192-ofb", + "2.16.840.1.101.3.4.1.24": "aes-192-cfb", + "2.16.840.1.101.3.4.1.41": "aes-256-ecb", + "2.16.840.1.101.3.4.1.42": "aes-256-cbc", + "2.16.840.1.101.3.4.1.43": "aes-256-ofb", + "2.16.840.1.101.3.4.1.44": "aes-256-cfb" +}; /***/ }, /* 203 */ /***/ function(module, exports, __webpack_require__) { - const AbstractHandler = __webpack_require__(180); - - class MessageReactionRemove extends AbstractHandler { - handle(packet) { - const client = this.packetManager.client; - const data = packet.d; - client.actions.MessageReactionRemove.handle(data); - } - } - - module.exports = MessageReactionRemove; +/* WEBPACK VAR INJECTION */(function(process, __dirname) {var Module;if(!Module)Module=(typeof Module!=="undefined"?Module:null)||{};var moduleOverrides={};for(var key in Module){if(Module.hasOwnProperty(key)){moduleOverrides[key]=Module[key]}}var ENVIRONMENT_IS_WEB=false;var ENVIRONMENT_IS_WORKER=false;var ENVIRONMENT_IS_NODE=false;var ENVIRONMENT_IS_SHELL=false;if(Module["ENVIRONMENT"]){if(Module["ENVIRONMENT"]==="WEB"){ENVIRONMENT_IS_WEB=true}else if(Module["ENVIRONMENT"]==="WORKER"){ENVIRONMENT_IS_WORKER=true}else if(Module["ENVIRONMENT"]==="NODE"){ENVIRONMENT_IS_NODE=true}else if(Module["ENVIRONMENT"]==="SHELL"){ENVIRONMENT_IS_SHELL=true}else{throw new Error("The provided Module['ENVIRONMENT'] value is not valid. It must be one of: WEB|WORKER|NODE|SHELL.")}}else{ENVIRONMENT_IS_WEB=typeof window==="object";ENVIRONMENT_IS_WORKER=typeof importScripts==="function";ENVIRONMENT_IS_NODE=typeof process==="object"&&"function"==="function"&&!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_WORKER;ENVIRONMENT_IS_SHELL=!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_NODE&&!ENVIRONMENT_IS_WORKER}if(ENVIRONMENT_IS_NODE){if(!Module["print"])Module["print"]=console.log;if(!Module["printErr"])Module["printErr"]=console.warn;var nodeFS;var nodePath;Module["read"]=function read(filename,binary){if(!nodeFS)nodeFS=__webpack_require__(10);if(!nodePath)nodePath=__webpack_require__(14);filename=nodePath["normalize"](filename);var ret=nodeFS["readFileSync"](filename);if(!ret&&filename!=nodePath["resolve"](filename)){filename=path.join(__dirname,"..","src",filename);ret=nodeFS["readFileSync"](filename)}if(ret&&!binary)ret=ret.toString();return ret};Module["readBinary"]=function readBinary(filename){var ret=Module["read"](filename,true);if(!ret.buffer){ret=new Uint8Array(ret)}assert(ret.buffer);return ret};Module["load"]=function load(f){globalEval(read(f))};if(!Module["thisProgram"]){if(process["argv"].length>1){Module["thisProgram"]=process["argv"][1].replace(/\\/g,"/")}else{Module["thisProgram"]="unknown-program"}}Module["arguments"]=process["argv"].slice(2);if(true){module["exports"]=Module}Module["inspect"]=(function(){return"[Emscripten Module object]"})}else if(ENVIRONMENT_IS_SHELL){if(!Module["print"])Module["print"]=print;if(typeof printErr!="undefined")Module["printErr"]=printErr;if(typeof read!="undefined"){Module["read"]=read}else{Module["read"]=function read(){throw"no read() available (jsc?)"}}Module["readBinary"]=function readBinary(f){if(typeof readbuffer==="function"){return new Uint8Array(readbuffer(f))}var data=read(f,"binary");assert(typeof data==="object");return data};if(typeof scriptArgs!="undefined"){Module["arguments"]=scriptArgs}else if(typeof arguments!="undefined"){Module["arguments"]=arguments}}else if(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER){Module["read"]=function read(url){var xhr=new XMLHttpRequest;xhr.open("GET",url,false);xhr.send(null);return xhr.responseText};Module["readAsync"]=function readAsync(url,onload,onerror){var xhr=new XMLHttpRequest;xhr.open("GET",url,true);xhr.responseType="arraybuffer";xhr.onload=function xhr_onload(){if(xhr.status==200||xhr.status==0&&xhr.response){onload(xhr.response)}else{onerror()}};xhr.onerror=onerror;xhr.send(null)};if(typeof arguments!="undefined"){Module["arguments"]=arguments}if(typeof console!=="undefined"){if(!Module["print"])Module["print"]=function print(x){console.log(x)};if(!Module["printErr"])Module["printErr"]=function printErr(x){console.warn(x)}}else{var TRY_USE_DUMP=false;if(!Module["print"])Module["print"]=TRY_USE_DUMP&&typeof dump!=="undefined"?(function(x){dump(x)}):(function(x){})}if(ENVIRONMENT_IS_WORKER){Module["load"]=importScripts}if(typeof Module["setWindowTitle"]==="undefined"){Module["setWindowTitle"]=(function(title){document.title=title})}}else{throw"Unknown runtime environment. Where are we?"}function globalEval(x){eval.call(null,x)}if(!Module["load"]&&Module["read"]){Module["load"]=function load(f){globalEval(Module["read"](f))}}if(!Module["print"]){Module["print"]=(function(){})}if(!Module["printErr"]){Module["printErr"]=Module["print"]}if(!Module["arguments"]){Module["arguments"]=[]}if(!Module["thisProgram"]){Module["thisProgram"]="./this.program"}Module.print=Module["print"];Module.printErr=Module["printErr"];Module["preRun"]=[];Module["postRun"]=[];for(var key in moduleOverrides){if(moduleOverrides.hasOwnProperty(key)){Module[key]=moduleOverrides[key]}}moduleOverrides=undefined;var Runtime={setTempRet0:(function(value){tempRet0=value}),getTempRet0:(function(){return tempRet0}),stackSave:(function(){return STACKTOP}),stackRestore:(function(stackTop){STACKTOP=stackTop}),getNativeTypeSize:(function(type){switch(type){case"i1":case"i8":return 1;case"i16":return 2;case"i32":return 4;case"i64":return 8;case"float":return 4;case"double":return 8;default:{if(type[type.length-1]==="*"){return Runtime.QUANTUM_SIZE}else if(type[0]==="i"){var bits=parseInt(type.substr(1));assert(bits%8===0);return bits/8}else{return 0}}}}),getNativeFieldSize:(function(type){return Math.max(Runtime.getNativeTypeSize(type),Runtime.QUANTUM_SIZE)}),STACK_ALIGN:16,prepVararg:(function(ptr,type){if(type==="double"||type==="i64"){if(ptr&7){assert((ptr&7)===4);ptr+=4}}else{assert((ptr&3)===0)}return ptr}),getAlignSize:(function(type,size,vararg){if(!vararg&&(type=="i64"||type=="double"))return 8;if(!type)return Math.min(size,8);return Math.min(size||(type?Runtime.getNativeFieldSize(type):0),Runtime.QUANTUM_SIZE)}),dynCall:(function(sig,ptr,args){if(args&&args.length){if(!args.splice)args=Array.prototype.slice.call(args);args.splice(0,0,ptr);return Module["dynCall_"+sig].apply(null,args)}else{return Module["dynCall_"+sig].call(null,ptr)}}),functionPointers:[],addFunction:(function(func){for(var i=0;i=TOTAL_MEMORY){var success=enlargeMemory();if(!success){DYNAMICTOP=ret;return 0}}return ret}),alignMemory:(function(size,quantum){var ret=size=Math.ceil(size/(quantum?quantum:16))*(quantum?quantum:16);return ret}),makeBigInt:(function(low,high,unsigned){var ret=unsigned?+(low>>>0)+ +(high>>>0)*+4294967296:+(low>>>0)+ +(high|0)*+4294967296;return ret}),GLOBAL_BASE:8,QUANTUM_SIZE:4,__dummy__:0};var ABORT=false;var EXITSTATUS=0;function assert(condition,text){if(!condition){abort("Assertion failed: "+text)}}function getCFunc(ident){var func=Module["_"+ident];if(!func){try{func=eval("_"+ident)}catch(e){}}assert(func,"Cannot call unknown function "+ident+" (perhaps LLVM optimizations or closure removed it?)");return func}var ccall;((function(){var JSfuncs={"stackSave":(function(){Runtime.stackSave()}),"stackRestore":(function(){Runtime.stackRestore()}),"arrayToC":(function(arr){var ret=Runtime.stackAlloc(arr.length);writeArrayToMemory(arr,ret);return ret}),"stringToC":(function(str){var ret=0;if(str!==null&&str!==undefined&&str!==0){ret=Runtime.stackAlloc((str.length<<2)+1);writeStringToMemory(str,ret)}return ret})};var toC={"string":JSfuncs["stringToC"],"array":JSfuncs["arrayToC"]};ccall=function ccallFunc(ident,returnType,argTypes,args,opts){var func=getCFunc(ident);var cArgs=[];var stack=0;if(args){for(var i=0;i>0]=value;break;case"i8":HEAP8[ptr>>0]=value;break;case"i16":HEAP16[ptr>>1]=value;break;case"i32":HEAP32[ptr>>2]=value;break;case"i64":tempI64=[value>>>0,(tempDouble=value,+Math_abs(tempDouble)>=+1?tempDouble>+0?(Math_min(+Math_floor(tempDouble/+4294967296),+4294967295)|0)>>>0:~~+Math_ceil((tempDouble- +(~~tempDouble>>>0))/+4294967296)>>>0:0)],HEAP32[ptr>>2]=tempI64[0],HEAP32[ptr+4>>2]=tempI64[1];break;case"float":HEAPF32[ptr>>2]=value;break;case"double":HEAPF64[ptr>>3]=value;break;default:abort("invalid type for setValue: "+type)}}Module["setValue"]=setValue;function getValue(ptr,type,noSafe){type=type||"i8";if(type.charAt(type.length-1)==="*")type="i32";switch(type){case"i1":return HEAP8[ptr>>0];case"i8":return HEAP8[ptr>>0];case"i16":return HEAP16[ptr>>1];case"i32":return HEAP32[ptr>>2];case"i64":return HEAP32[ptr>>2];case"float":return HEAPF32[ptr>>2];case"double":return HEAPF64[ptr>>3];default:abort("invalid type for setValue: "+type)}return null}Module["getValue"]=getValue;var ALLOC_NORMAL=0;var ALLOC_STATIC=2;var ALLOC_DYNAMIC=3;var ALLOC_NONE=4;function allocate(slab,types,allocator,ptr){var zeroinit,size;if(typeof slab==="number"){zeroinit=true;size=slab}else{zeroinit=false;size=slab.length}var singleType=typeof types==="string"?types:null;var ret;if(allocator==ALLOC_NONE){ret=ptr}else{ret=[typeof _malloc==="function"?_malloc:Runtime.staticAlloc,Runtime.stackAlloc,Runtime.staticAlloc,Runtime.dynamicAlloc][allocator===undefined?ALLOC_STATIC:allocator](Math.max(size,singleType?1:types.length))}if(zeroinit){var ptr=ret,stop;assert((ret&3)==0);stop=ret+(size&~3);for(;ptr>2]=0}stop=ret+size;while(ptr>0]=0}return ret}if(singleType==="i8"){if(slab.subarray||slab.slice){HEAPU8.set(slab,ret)}else{HEAPU8.set(new Uint8Array(slab),ret)}return ret}var i=0,type,typeSize,previousType;while(i>0];hasUtf|=t;if(t==0&&!length)break;i++;if(length&&i==length)break}if(!length)length=i;var ret="";if(hasUtf<128){var MAX_CHUNK=1024;var curr;while(length>0){curr=String.fromCharCode.apply(String,HEAPU8.subarray(ptr,ptr+Math.min(length,MAX_CHUNK)));ret=ret?ret+curr:curr;ptr+=MAX_CHUNK;length-=MAX_CHUNK}return ret}return Module["UTF8ToString"](ptr)}function UTF8ArrayToString(u8Array,idx){var u0,u1,u2,u3,u4,u5;var str="";while(1){u0=u8Array[idx++];if(!u0)return str;if(!(u0&128)){str+=String.fromCharCode(u0);continue}u1=u8Array[idx++]&63;if((u0&224)==192){str+=String.fromCharCode((u0&31)<<6|u1);continue}u2=u8Array[idx++]&63;if((u0&240)==224){u0=(u0&15)<<12|u1<<6|u2}else{u3=u8Array[idx++]&63;if((u0&248)==240){u0=(u0&7)<<18|u1<<12|u2<<6|u3}else{u4=u8Array[idx++]&63;if((u0&252)==248){u0=(u0&3)<<24|u1<<18|u2<<12|u3<<6|u4}else{u5=u8Array[idx++]&63;u0=(u0&1)<<30|u1<<24|u2<<18|u3<<12|u4<<6|u5}}}if(u0<65536){str+=String.fromCharCode(u0)}else{var ch=u0-65536;str+=String.fromCharCode(55296|ch>>10,56320|ch&1023)}}}function stringToUTF8Array(str,outU8Array,outIdx,maxBytesToWrite){if(!(maxBytesToWrite>0))return 0;var startIdx=outIdx;var endIdx=outIdx+maxBytesToWrite-1;for(var i=0;i=55296&&u<=57343)u=65536+((u&1023)<<10)|str.charCodeAt(++i)&1023;if(u<=127){if(outIdx>=endIdx)break;outU8Array[outIdx++]=u}else if(u<=2047){if(outIdx+1>=endIdx)break;outU8Array[outIdx++]=192|u>>6;outU8Array[outIdx++]=128|u&63}else if(u<=65535){if(outIdx+2>=endIdx)break;outU8Array[outIdx++]=224|u>>12;outU8Array[outIdx++]=128|u>>6&63;outU8Array[outIdx++]=128|u&63}else if(u<=2097151){if(outIdx+3>=endIdx)break;outU8Array[outIdx++]=240|u>>18;outU8Array[outIdx++]=128|u>>12&63;outU8Array[outIdx++]=128|u>>6&63;outU8Array[outIdx++]=128|u&63}else if(u<=67108863){if(outIdx+4>=endIdx)break;outU8Array[outIdx++]=248|u>>24;outU8Array[outIdx++]=128|u>>18&63;outU8Array[outIdx++]=128|u>>12&63;outU8Array[outIdx++]=128|u>>6&63;outU8Array[outIdx++]=128|u&63}else{if(outIdx+5>=endIdx)break;outU8Array[outIdx++]=252|u>>30;outU8Array[outIdx++]=128|u>>24&63;outU8Array[outIdx++]=128|u>>18&63;outU8Array[outIdx++]=128|u>>12&63;outU8Array[outIdx++]=128|u>>6&63;outU8Array[outIdx++]=128|u&63}}outU8Array[outIdx]=0;return outIdx-startIdx}function lengthBytesUTF8(str){var len=0;for(var i=0;i=55296&&u<=57343)u=65536+((u&1023)<<10)|str.charCodeAt(++i)&1023;if(u<=127){++len}else if(u<=2047){len+=2}else if(u<=65535){len+=3}else if(u<=2097151){len+=4}else if(u<=67108863){len+=5}else{len+=6}}return len}function demangle(func){var hasLibcxxabi=!!Module["___cxa_demangle"];if(hasLibcxxabi){try{var buf=_malloc(func.length);writeStringToMemory(func.substr(1),buf);var status=_malloc(4);var ret=Module["___cxa_demangle"](buf,0,0,status);if(getValue(status,"i32")===0&&ret){return Pointer_stringify(ret)}}catch(e){return func}finally{if(buf)_free(buf);if(status)_free(status);if(ret)_free(ret)}}Runtime.warnOnce("warning: build with -s DEMANGLE_SUPPORT=1 to link in libcxxabi demangling");return func}function demangleAll(text){return text.replace(/__Z[\w\d_]+/g,(function(x){var y=demangle(x);return x===y?x:x+" ["+y+"]"}))}function jsStackTrace(){var err=new Error;if(!err.stack){try{throw new Error(0)}catch(e){err=e}if(!err.stack){return"(no stack trace available)"}}return err.stack.toString()}function stackTrace(){return demangleAll(jsStackTrace())}var PAGE_SIZE=4096;function alignMemoryPage(x){if(x%4096>0){x+=4096-x%4096}return x}var HEAP;var buffer;var HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAPF64;function updateGlobalBufferViews(){Module["HEAP8"]=HEAP8=new Int8Array(buffer);Module["HEAP16"]=HEAP16=new Int16Array(buffer);Module["HEAP32"]=HEAP32=new Int32Array(buffer);Module["HEAPU8"]=HEAPU8=new Uint8Array(buffer);Module["HEAPU16"]=HEAPU16=new Uint16Array(buffer);Module["HEAPU32"]=HEAPU32=new Uint32Array(buffer);Module["HEAPF32"]=HEAPF32=new Float32Array(buffer);Module["HEAPF64"]=HEAPF64=new Float64Array(buffer)}var STATIC_BASE=0,STATICTOP=0,staticSealed=false;var STACK_BASE=0,STACKTOP=0,STACK_MAX=0;var DYNAMIC_BASE=0,DYNAMICTOP=0;function abortOnCannotGrowMemory(){abort("Cannot enlarge memory arrays. Either (1) compile with -s TOTAL_MEMORY=X with X higher than the current value "+TOTAL_MEMORY+", (2) compile with -s ALLOW_MEMORY_GROWTH=1 which adjusts the size at runtime but prevents some optimizations, (3) set Module.TOTAL_MEMORY to a higher value before the program runs, or if you want malloc to return NULL (0) instead of this abort, compile with -s ABORTING_MALLOC=0 ")}function enlargeMemory(){abortOnCannotGrowMemory()}var TOTAL_STACK=Module["TOTAL_STACK"]||5242880;var TOTAL_MEMORY=Module["TOTAL_MEMORY"]||16777216;var totalMemory=64*1024;while(totalMemory0){var callback=callbacks.shift();if(typeof callback=="function"){callback();continue}var func=callback.func;if(typeof func==="number"){if(callback.arg===undefined){Runtime.dynCall("v",func)}else{Runtime.dynCall("vi",func,[callback.arg])}}else{func(callback.arg===undefined?null:callback.arg)}}}var __ATPRERUN__=[];var __ATINIT__=[];var __ATMAIN__=[];var __ATEXIT__=[];var __ATPOSTRUN__=[];var runtimeInitialized=false;var runtimeExited=false;function preRun(){if(Module["preRun"]){if(typeof Module["preRun"]=="function")Module["preRun"]=[Module["preRun"]];while(Module["preRun"].length){addOnPreRun(Module["preRun"].shift())}}callRuntimeCallbacks(__ATPRERUN__)}function ensureInitRuntime(){if(runtimeInitialized)return;runtimeInitialized=true;callRuntimeCallbacks(__ATINIT__)}function preMain(){callRuntimeCallbacks(__ATMAIN__)}function exitRuntime(){callRuntimeCallbacks(__ATEXIT__);runtimeExited=true}function postRun(){if(Module["postRun"]){if(typeof Module["postRun"]=="function")Module["postRun"]=[Module["postRun"]];while(Module["postRun"].length){addOnPostRun(Module["postRun"].shift())}}callRuntimeCallbacks(__ATPOSTRUN__)}function addOnPreRun(cb){__ATPRERUN__.unshift(cb)}function addOnPostRun(cb){__ATPOSTRUN__.unshift(cb)}function intArrayFromString(stringy,dontAddNull,length){var len=length>0?length:lengthBytesUTF8(stringy)+1;var u8array=new Array(len);var numBytesWritten=stringToUTF8Array(stringy,u8array,0,u8array.length);if(dontAddNull)u8array.length=numBytesWritten;return u8array}function writeStringToMemory(string,buffer,dontAddNull){var array=intArrayFromString(string,dontAddNull);var i=0;while(i>0]=chr;i=i+1}}function writeArrayToMemory(array,buffer){for(var i=0;i>0]=array[i]}}function writeAsciiToMemory(str,buffer,dontAddNull){for(var i=0;i>0]=str.charCodeAt(i)}if(!dontAddNull)HEAP8[buffer>>0]=0}if(!Math["imul"]||Math["imul"](4294967295,5)!==-5)Math["imul"]=function imul(a,b){var ah=a>>>16;var al=a&65535;var bh=b>>>16;var bl=b&65535;return al*bl+(ah*bl+al*bh<<16)|0};Math.imul=Math["imul"];if(!Math["clz32"])Math["clz32"]=(function(x){x=x>>>0;for(var i=0;i<32;i++){if(x&1<<31-i)return i}return 32});Math.clz32=Math["clz32"];var Math_abs=Math.abs;var Math_cos=Math.cos;var Math_sin=Math.sin;var Math_tan=Math.tan;var Math_acos=Math.acos;var Math_asin=Math.asin;var Math_atan=Math.atan;var Math_atan2=Math.atan2;var Math_exp=Math.exp;var Math_log=Math.log;var Math_sqrt=Math.sqrt;var Math_ceil=Math.ceil;var Math_floor=Math.floor;var Math_pow=Math.pow;var Math_imul=Math.imul;var Math_fround=Math.fround;var Math_min=Math.min;var Math_clz32=Math.clz32;var runDependencies=0;var runDependencyWatcher=null;var dependenciesFulfilled=null;Module["preloadedImages"]={};Module["preloadedAudios"]={};var ASM_CONSTS=[];STATIC_BASE=8;STATICTOP=STATIC_BASE+35488;__ATINIT__.push({func:(function(){__GLOBAL__sub_I_opusscript_encoder_cpp()})},{func:(function(){__GLOBAL__sub_I_bind_cpp()})});allocate([32,90,0,0,152,108,0,0,160,90,0,0,172,108,0,0,0,0,0,0,8,0,0,0,160,90,0,0,193,108,0,0,1,0,0,0,8,0,0,0,188,90,0,0,7,130,0,0,0,0,0,0,1,0,0,0,72,0,0,0,0,0,0,0,32,90,0,0,70,130,0,0,188,90,0,0,120,130,0,0,0,0,0,0,1,0,0,0,72,0,0,0,0,0,0,0,188,90,0,0,216,130,0,0,0,0,0,0,1,0,0,0,72,0,0,0,0,0,0,0,32,90,0,0,36,131,0,0,32,90,0,0,71,131,0,0,32,90,0,0,132,131,0,0,32,90,0,0,200,131,0,0,32,90,0,0,14,132,0,0,32,90,0,0,76,132,0,0,32,90,0,0,147,132,0,0,32,90,0,0,207,132,0,0,32,90,0,0,20,133,0,0,32,90,0,0,81,133,0,0,32,90,0,0,94,134,0,0,32,90,0,0,156,134,0,0,32,90,0,0,219,134,0,0,32,90,0,0,148,135,0,0,72,90,0,0,114,135,0,0,16,1,0,0,0,0,0,0,72,90,0,0,31,135,0,0,240,0,0,0,0,0,0,0,72,90,0,0,68,135,0,0,32,1,0,0,0,0,0,0,32,90,0,0,101,135,0,0,72,90,0,0,161,135,0,0,232,0,0,0,0,0,0,0,72,90,0,0,225,135,0,0,16,1,0,0,0,0,0,0,72,90,0,0,189,135,0,0,56,1,0,0,0,0,0,0,72,90,0,0,3,136,0,0,16,1,0,0,0,0,0,0,132,90,0,0,43,136,0,0,132,90,0,0,45,136,0,0,132,90,0,0,48,136,0,0,132,90,0,0,50,136,0,0,132,90,0,0,52,136,0,0,132,90,0,0,54,136,0,0,132,90,0,0,56,136,0,0,132,90,0,0,58,136,0,0,132,90,0,0,60,136,0,0,132,90,0,0,62,136,0,0,132,90,0,0,64,136,0,0,132,90,0,0,66,136,0,0,132,90,0,0,68,136,0,0,132,90,0,0,70,136,0,0,72,90,0,0,72,136,0,0,240,0,0,0,0,0,0,0,16,0,0,0,168,1,0,0,168,1,0,0,168,1,0,0,168,1,0,0,16,0,0,0,168,1,0,0,168,1,0,0,168,1,0,0,168,1,0,0,168,1,0,0,16,0,0,0,168,1,0,0,168,1,0,0,168,1,0,0,0,0,157,62,0,64,94,62,0,192,4,62,0,128,237,62,0,64,137,62,0,0,0,0,0,192,76,63,0,0,205,61,0,0,0,0,34,109,0,0,42,109,0,0,59,109,0,0,76,109,0,0,91,109,0,0,108,109,0,0,132,109,0,0,146,109,0,0,16,39,0,0,232,3,0,0,248,42,0,0,232,3,0,0,188,52,0,0,232,3,0,0,176,54,0,0,208,7,0,0,224,46,0,0,232,3,0,0,176,54,0,0,232,3,0,0,128,62,0,0,232,3,0,0,32,78,0,0,232,3,0,0,240,85,0,0,232,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,224,46,0,0,16,39,0,0,16,39,0,0,248,42,0,0,248,42,0,0,128,62,0,0,188,52,0,0,188,52,0,0,152,58,0,0,152,58,0,0,32,78,0,0,128,62,0,0,128,62,0,0,80,70,0,0,80,70,0,0,192,93,0,0,80,70,0,0,80,70,0,0,8,82,0,0,8,82,0,0,0,125,0,0,240,85,0,0,240,85,0,0,96,109,0,0,96,109,0,0,0,250,0,0,112,148,0,0,112,148,0,0,80,195,0,0,80,195,0,0,230,90,52,56,119,78,51,57,211,217,201,57,146,145,51,58,204,96,140,58,97,251,201,58,153,126,9,59,203,128,51,59,213,37,99,59,119,46,140,59,168,138,169,59,69,184,201,59,135,166,236,59,232,46,9,60,174,102,29,60,247,2,51,60,147,255,73,60,79,88,98,60,94,17,124,60,46,145,139,60,189,199,153,60,92,172,168,60,243,60,184,60,129,121,200,60,238,95,217,60,57,240,234,60,99,42,253,60,53,7,8,61,16,204,17,61,205,228,27,61,97,80,38,61,203,14,49,61,0,31,60,61,254,128,71,61,198,52,83,61,63,56,95,61,105,139,107,61,69,46,120,61,105,144,130,61,123,48,137,61,224,247,143,61,138,229,150,61,123,249,157,61,177,51,165,61,33,147,172,61,80,24,180,61,51,194,187,61,79,145,195,61,18,132,203,61,2,155,211,61,31,214,219,61,215,51,228,61,175,180,236,61,33,88,245,61,168,29,254,61,161,130,3,62,242,6,8,62,199,155,12,62,221,64,17,62,52,246,21,62,69,187,26,62,17,144,31,62,84,116,36,62,203,103,41,62,51,106,46,62,141,123,51,62,82,155,56,62,197,201,61,62,28,6,67,62,89,80,72,62,122,168,77,62,183,13,83,62,82,128,88,62,8,0,94,62,84,140,99,62,242,36,105,62,37,202,110,62,36,123,116,62,172,55,122,62,0,0,128,62,171,233,130,62,249,216,133,62,133,205,136,62,80,199,139,62,55,198,142,62,247,201,145,62,179,210,148,62,38,224,151,62,15,242,154,62,108,8,158,62,28,35,161,62,255,65,164,62,208,100,167,62,177,139,170,62,28,182,173,62,84,228,176,62,211,21,180,62,186,74,183,62,232,130,186,62,249,189,189,62,13,252,192,62,226,60,196,62,86,128,199,62,71,198,202,62,149,14,206,62,251,88,209,62,122,165,212,62,241,243,215,62,28,68,219,62,217,149,222,62,8,233,225,62,167,61,229,62,83,147,232,62,12,234,235,62,175,65,239,62,28,154,242,62,14,243,245,62,136,76,249,62,34,166,252,62,0,0,0,63,239,172,1,63,188,89,3,63,121,6,5,63,242,178,6,63,41,95,8,63,250,10,10,63,86,182,11,63,44,97,13,63,124,11,15,63,19,181,16,63,242,93,18,63,8,6,20,63,67,173,21,63,130,83,23,63,182,248,24,63,220,156,26,63,213,63,28,63,143,225,29,63,249,129,31,63,4,33,33,63,140,190,34,63,163,90,36,63,23,245,37,63,214,141,39,63,242,36,41,63,40,186,42,63,152,77,44,63,1,223,45,63,114,110,47,63,202,251,48,63,249,134,50,63,237,15,52,63,167,150,53,63,4,27,55,63,229,156,56,63,88,28,58,63,61,153,59,63,131,19,61,63,42,139,62,63,0,0,64,63,21,114,65,63,55,225,66,63,119,77,68,63,195,182,69,63,235,28,71,63,254,127,72,63,236,223,73,63,146,60,75,63,225,149,76,63,234,235,77,63,121,62,79,63,143,141,80,63,43,217,81,63,29,33,83,63,115,101,84,63,13,166,85,63,235,226,86,63,252,27,88,63,47,81,89,63,115,130,90,63,201,175,91,63,14,217,92,63,67,254,93,63,88,31,95,63,75,60,96,63,252,84,97,63,106,105,98,63,133,121,99,63,60,133,100,63,160,140,101,63,126,143,102,63,214,141,103,63,186,135,104,63,246,124,105,63,156,109,106,63,138,89,107,63,209,64,108,63,79,35,109,63,4,1,110,63,241,217,110,63,243,173,111,63,28,125,112,63,73,71,113,63,124,12,114,63,180,204,114,63,240,135,115,63,16,62,116,63,19,239,116,63,250,154,117,63,179,65,118,63,63,227,118,63,141,127,119,63,173,22,120,63,126,168,120,63,1,53,121,63,52,188,121,63,24,62,122,63,157,186,122,63,194,49,123,63,119,163,123,63,187,15,124,63,159,118,124,63,2,216,124,63,244,51,125,63,101,138,125,63,68,219,125,63,179,38,126,63,143,108,126,63,235,172,126,63,163,231,126,63,218,28,127,63,127,76,127,63,129,118,127,63,2,155,127,63,208,185,127,63,28,211,127,63,197,230,127,63,203,244,127,63,47,253,127,63,0,0,128,63,2,0,0,0,4,0,0,0,6,0,0,0,8,0,0,0,10,0,0,0,12,0,0,0,14,0,0,0,16,0,0,0,20,0,0,0,24,0,0,0,28,0,0,0,32,0,0,0,40,0,0,0,48,0,0,0,56,0,0,0,68,0,0,0,80,0,0,0,96,0,0,0,120,0,0,0,1,0,0,0,2,0,0,0,4,0,0,0,6,0,0,0,8,0,0,0,10,0,0,0,12,0,0,0,14,0,0,0,16,0,0,0,20,0,0,0,24,0,0,0,28,0,0,0,32,0,0,0,40,0,0,0,48,0,0,0,56,0,0,0,68,0,0,0,80,0,0,0,96,0,0,0,120,0,0,0,160,0,0,0,200,0,0,0,0,0,128,62,0,0,128,62,0,0,128,62,0,0,128,62,0,0,128,62,0,0,128,62,0,0,128,62,0,0,128,62,0,0,128,62,0,0,128,62,0,0,128,62,0,0,128,62,0,0,128,62,0,0,128,62,0,0,128,62,0,0,128,62,208,37,180,62,151,57,173,62,9,165,159,62,250,237,139,62,205,172,101,62,248,169,42,62,52,48,210,61,90,241,13,61,90,241,13,189,52,48,210,189,248,169,42,190,205,172,101,190,250,237,139,190,9,165,159,190,151,57,173,190,208,37,180,190,135,138,177,62,27,131,150,62,96,35,73,62,196,66,141,61,196,66,141,189,96,35,73,190,27,131,150,190,135,138,177,190,135,138,177,190,27,131,150,190,96,35,73,190,196,66,141,189,196,66,141,61,96,35,73,62,27,131,150,62,135,138,177,62,151,57,173,62,205,172,101,62,90,241,13,61,248,169,42,190,9,165,159,190,208,37,180,190,250,237,139,190,52,48,210,189,52,48,210,61,250,237,139,62,208,37,180,62,9,165,159,62,248,169,42,62,90,241,13,189,205,172,101,190,151,57,173,190,125,61,167,62,210,139,10,62,210,139,10,190,125,61,167,190,125,61,167,190,210,139,10,190,210,139,10,62,125,61,167,62,125,61,167,62,210,139,10,62,210,139,10,190,125,61,167,190,125,61,167,190,210,139,10,190,210,139,10,62,125,61,167,62,9,165,159,62,90,241,13,61,250,237,139,190,151,57,173,190,52,48,210,189,205,172,101,62,208,37,180,62,248,169,42,62,248,169,42,190,208,37,180,190,205,172,101,190,52,48,210,61,151,57,173,62,250,237,139,62,90,241,13,189,9,165,159,190,27,131,150,62,196,66,141,189,135,138,177,190,96,35,73,190,96,35,73,62,135,138,177,62,196,66,141,61,27,131,150,190,27,131,150,190,196,66,141,61,135,138,177,62,96,35,73,62,96,35,73,190,135,138,177,190,196,66,141,189,27,131,150,62,250,237,139,62,248,169,42,190,151,57,173,190,90,241,13,61,208,37,180,62,52,48,210,61,9,165,159,190,205,172,101,190,205,172,101,62,9,165,159,62,52,48,210,189,208,37,180,190,90,241,13,189,151,57,173,62,248,169,42,62,250,237,139,190,22,235,181,64,30,107,94,64,35,164,226,63,185,197,204,63,91,124,113,64,184,115,10,64,116,96,161,63,136,245,142,63,19,155,245,63,0,0,0,0,5,193,35,61,233,125,163,61,37,150,244,61,226,116,34,62,172,28,74,62,221,37,113,62,52,186,139,62,180,119,158,62,228,191,176,62,173,136,194,62,37,201,211,62,24,122,228,62,24,149,244,62,200,10,2,63,28,124,9,63,73,157,16,63,202,109,23,63,192,237,29,63,159,29,36,63,84,254,41,63,46,145,47,63,224,215,52,63,99,212,57,63,240,136,62,63,211,247,66,63,171,35,71,63,23,15,75,63,216,188,78,63,173,47,82,63,106,106,85,63,206,111,88,63,154,66,91,63,142,229,93,63,75,91,96,63,110,166,98,63,100,201,100,63,155,198,102,63,111,160,104,63,247,88,106,63,128,242,107,63,223,110,109,63,11,208,110,63,202,23,112,63,224,71,113,63,225,97,114,63,77,103,115,63,150,89,116,63,12,58,117,63,255,9,118,63,138,202,118,63,187,124,119,63,192,33,120,63,98,186,120,63,157,71,121,63,75,202,121,63,36,67,122,63,242,178,122,63,59,26,123,63,200,121,123,63,32,210,123,63,200,35,124,63,55,111,124,63,242,180,124,63,94,245,124,63,224,48,125,63,236,103,125,63,183,154,125,63,180,201,125,63,6,245,125,63,17,29,126,63,24,66,126,63,78,100,126,63,211,131,126,63,253,160,126,63,237,187,126,63,195,212,126,63,179,235,126,63,239,0,127,63,135,20,127,63,141,38,127,63,67,55,127,63,170,70,127,63,227,84,127,63,15,98,127,63,47,110,127,63,100,121,127,63,190,131,127,63,63,141,127,63,24,150,127,63,56,158,127,63,194,165,127,63,163,172,127,63,16,179,127,63,245,184,127,63,119,190,127,63,114,195,127,63,25,200,127,63,108,204,127,63,91,208,127,63,6,212,127,63,111,215,127,63,131,218,127,63,102,221,127,63,21,224,127,63,130,226,127,63,205,228,127,63,230,230,127,63,205,232,127,63,146,234,127,63,70,236,127,63,200,237,127,63,40,239,127,63,120,240,127,63,166,241,127,63,195,242,127,63,191,243,127,63,186,244,127,63,148,245,127,63,94,246,127,63,39,247,127,63,207,247,127,63,119,248,127,63,253,248,127,63,148,249,127,63,9,250,127,63,127,250,127,63,244,250,127,63,89,251,127,63,173,251,127,63,1,252,127,63,84,252,127,63,152,252,127,63,219,252,127,63,30,253,127,63,80,253,127,63,130,253,127,63,181,253,127,63,231,253,127,63,9,254,127,63,59,254,127,63,93,254,127,63,126,254,127,63,143,254,127,63,176,254,127,63,210,254,127,63,227,254,127,63,244,254,127,63,21,255,127,63,38,255,127,63,55,255,127,63,71,255,127,63,88,255,127,63,88,255,127,63,105,255,127,63,122,255,127,63,122,255,127,63,139,255,127,63,155,255,127,63,155,255,127,63,155,255,127,63,172,255,127,63,172,255,127,63,189,255,127,63,189,255,127,63,189,255,127,63,206,255,127,63,206,255,127,63,206,255,127,63,206,255,127,63,206,255,127,63,222,255,127,63,222,255,127,63,222,255,127,63,222,255,127,63,222,255,127,63,222,255,127,63,239,255,127,63,239,255,127,63,239,255,127,63,239,255,127,63,239,255,127,63,239,255,127,63,239,255,127,63,239,255,127,63,239,255,127,63,239,255,127,63,239,255,127,63,239,255,127,63,239,255,127,63,0,0,128,63,0,0,128,63,0,0,128,63,0,0,128,63,0,0,128,63,0,0,128,63,0,0,128,63,0,0,128,63,0,0,128,63,0,0,128,63,0,0,128,63,92,201,154,191,92,181,225,188,29,102,249,60,41,7,147,189,76,199,183,189,254,214,206,61,107,200,73,189,213,203,143,61,162,63,153,60,131,208,139,59,7,3,132,61,170,154,224,189,251,30,245,189,156,141,17,188,11,14,47,62,98,192,50,62,25,231,135,190,14,59,130,189,104,203,145,190,133,66,136,191,57,185,79,62,205,228,19,64,254,212,48,192,107,127,215,190,71,229,50,63,144,218,206,64,190,165,135,61,26,70,155,61,241,153,81,61,23,176,46,61,228,249,236,61,194,18,135,190,137,197,57,188,107,74,66,190,44,114,190,189,15,94,147,190,234,136,189,61,164,240,234,60,161,171,163,188,103,180,69,190,98,101,132,62,179,149,151,60,242,210,237,61,140,77,203,61,221,29,0,188,97,51,136,190,116,69,145,62,227,199,40,65,110,133,40,191,198,53,86,63,106,222,81,65,36,209,160,192,56,103,140,191,137,42,151,189,64,184,167,60,103,126,53,60,37,104,2,187,152,220,139,59,239,146,24,62,41,174,154,61,238,207,229,61,197,96,84,189,236,162,232,60,105,97,197,60,53,77,78,189,26,24,25,190,227,199,8,190,182,159,12,190,150,33,238,61,117,202,115,62,250,97,164,61,125,168,30,61,218,27,188,61,180,142,129,64,129,149,79,64,2,43,55,191,225,93,2,65,218,44,239,193,246,40,148,63,255,147,255,189,102,233,185,60,124,187,64,189,90,0,9,189,207,206,19,61,20,106,55,61,121,110,41,187,165,84,157,188,137,151,231,189,90,72,224,61,75,81,51,189,51,156,28,61,194,238,34,188,128,99,31,190,82,12,48,62,141,123,99,190,91,8,6,191,166,34,58,189,54,144,14,191,23,244,66,63,23,217,44,192,69,13,98,191,113,29,99,63,107,15,63,63,168,25,186,190,127,137,184,62,66,91,14,61,15,97,124,188,56,153,225,59,58,135,27,188,169,33,128,61,86,182,79,189,178,164,23,61,110,10,117,60,67,86,119,61,71,94,145,189,118,138,21,189,47,196,202,61,104,185,34,189,150,10,146,62,113,231,2,62,77,45,27,190,59,29,136,62,111,117,170,189,14,67,85,61,140,214,101,63,202,224,224,62,144,131,64,192,163,1,248,63,103,68,209,190,54,172,153,62,227,194,181,191,69,74,243,61,178,70,61,189,146,230,79,61,22,83,196,188,77,235,128,189,165,98,8,188,160,53,223,189,183,222,5,189,46,143,213,61,96,168,136,189,8,242,66,61,75,175,141,61,63,127,107,189,121,33,13,190,10,242,83,190,129,236,37,190,88,114,85,190,45,39,17,62,57,41,148,190,154,153,73,191,163,146,186,61,240,50,51,62,10,46,2,192,198,80,68,64,133,124,156,63,95,210,6,64,48,139,159,61,171,63,98,190,60,106,12,62,216,26,128,189,100,118,150,189,195,14,51,62,84,195,14,190,131,32,198,61,103,30,170,61,167,7,101,190,13,250,210,61,147,139,209,189,146,6,103,62,123,20,30,62,83,93,64,62,22,226,15,188,77,188,3,62,60,50,190,190,86,68,245,190,73,76,32,62,106,48,141,63,196,124,161,191,19,13,178,61,28,181,18,190,57,185,11,64,18,218,56,192,38,27,207,61,119,219,157,190,203,101,99,62,140,44,105,190,51,31,12,188,188,93,47,60,26,189,253,59,149,207,151,188,8,181,250,60,252,55,111,190,62,86,165,61,13,54,245,188,175,150,27,62,31,19,137,190,22,143,70,61,87,93,7,62,150,148,107,190,235,59,183,62,168,114,154,61,167,149,226,61,103,155,163,191,174,216,83,64,156,192,84,63,188,118,89,190,203,161,165,193,252,24,147,191,62,46,0,61,22,207,170,188,109,194,3,188,13,228,52,60,76,23,226,60,94,191,253,58,3,71,93,188,3,132,201,187,99,6,79,61,150,27,49,188,190,138,88,58,58,177,199,188,119,103,165,190,169,211,139,61,238,8,15,191,175,7,211,189,41,34,51,62,108,152,1,190,136,13,214,189,43,79,216,62,52,234,139,189,171,91,185,191,106,189,51,63,173,78,54,63,236,24,215,190,201,60,38,64,232,221,243,188,27,145,57,189,185,75,7,189,85,29,13,189,165,90,213,188,35,17,122,189,144,195,187,61,245,244,209,60,72,108,215,189,184,241,157,61,150,18,184,189,131,161,62,190,154,92,164,190,4,27,103,190,120,11,52,62,56,129,129,62,107,40,61,63,2,212,26,64,153,129,234,61,4,200,160,190,198,164,27,63,129,178,221,63,87,38,6,192,164,253,27,191,240,80,152,63,51,53,233,61,233,239,53,190,169,237,160,189,98,49,178,190,76,105,194,189,155,132,156,188,254,240,171,62,96,4,109,189,194,104,6,62,43,18,243,189,64,75,7,190,254,95,117,190,119,167,65,58,2,102,62,190,146,232,5,190,239,116,223,190,94,16,17,190,187,191,16,61,20,198,91,189,132,137,197,189,111,45,99,62,109,168,248,63,76,137,228,191,91,211,116,64,35,190,111,64,182,185,23,64,227,170,182,191,215,183,61,61,62,230,104,189,170,229,88,61,29,114,211,189,226,147,174,190,198,194,208,61,79,145,79,191,195,98,52,62,3,119,240,62,144,222,203,60,19,213,219,189,99,71,19,190,169,61,59,189,229,122,71,63,75,144,17,190,9,129,33,61,106,161,36,62,200,38,53,191,91,181,27,191,126,24,137,63,124,155,162,191,249,189,17,64,54,205,203,64,10,20,5,63,165,73,85,192,70,122,1,190,179,80,193,189,15,198,217,60,14,62,126,61,52,147,57,60,169,249,130,190,29,176,150,189,125,219,130,189,206,112,195,189,88,226,81,190,21,24,149,59,62,81,99,61,5,105,38,190,235,230,18,191,183,124,132,62,140,185,75,62,61,164,179,60,75,230,192,190,43,50,2,191,22,24,157,189,25,142,39,191,248,165,143,64,103,237,88,64,227,25,22,192,193,57,49,193,167,116,139,64,15,127,213,63,227,129,82,189,253,114,140,189,204,192,55,188,190,157,243,57,254,123,112,190,116,92,173,190,227,167,17,190,212,126,43,190,24,177,15,190,150,176,214,189,48,100,213,189,144,204,52,60,123,190,230,189,57,165,178,61,42,224,46,190,69,155,179,189,224,157,252,61,43,133,32,190,158,208,75,62,116,208,101,189,126,54,102,63,242,249,167,61,143,194,165,191,164,231,241,60,55,166,17,64,235,228,112,191,169,2,36,188,156,111,228,189,154,93,7,190,171,9,226,189,126,29,24,61,207,152,147,188,19,0,45,188,234,106,161,60,33,229,39,61,192,163,92,189,78,155,209,189,224,208,64,189,139,78,54,62,105,25,137,190,231,167,216,189,95,207,215,189,194,73,127,61,52,190,47,189,194,195,52,62,247,234,35,190,168,58,18,192,101,141,246,191,116,98,95,62,180,188,26,65,146,116,83,64,160,55,225,191,122,200,4,62,228,73,242,61,246,36,16,62,235,223,138,61,12,62,77,59,137,205,108,188,56,33,254,188,96,209,200,188,25,60,12,62,132,189,25,62,45,11,230,61,121,161,154,189,35,221,143,190,130,83,127,190,19,129,46,191,240,31,1,61,12,6,151,62,139,187,38,61,202,197,144,62,4,57,176,190,69,129,234,192,30,81,97,190,142,119,15,191,191,154,239,191,3,62,227,192,179,210,8,65,196,66,5,64,192,93,118,62,189,24,162,63,174,156,253,60,179,152,140,191,122,142,92,63,186,189,196,191,106,106,137,63,198,138,140,64,99,180,38,192,82,12,192,62,126,200,251,61,169,231,85,59,40,244,70,63,137,7,2,192,108,206,113,191,82,242,128,64,216,127,133,190,63,111,14,63,148,220,97,190,2,183,226,191,40,212,91,191,230,150,194,191,215,190,72,191,25,32,177,62,201,21,72,189,50,146,165,190,160,168,64,191,202,112,4,63,170,96,96,63,69,100,184,191,174,185,195,190,108,236,198,191,0,0,128,63,0,0,0,64,0,0,64,64,0,0,128,64,0,0,160,64,0,0,192,64,0,0,224,64,0,0,0,65,0,0,128,65,0,0,192,65,0,0,16,66,0,0,48,66,0,0,72,66,0,0,96,66,0,0,120,66,0,0,134,66,0,0,144,66,0,0,158,66,0,0,176,66,0,0,212,66,0,0,6,67,0,0,128,63,0,0,128,63,0,0,128,63,0,0,128,63,0,0,128,63,0,0,128,63,0,0,128,63,0,0,0,64,0,0,0,64,0,0,0,64,0,0,0,64,0,0,0,64,0,0,0,64,0,0,0,64,0,0,64,64,0,0,64,64,0,0,128,64,0,0,160,64,0,0,192,64,0,0,0,65,0,0,0,65,149,139,0,0,55,152,0,0,255,165,0,0,4,181,0,0,103,197,0,0,69,215,0,0,193,234,0,0,255,255,0,0,128,187,0,0,120,0,0,0,21,0,0,0,21,0,0,0,0,154,89,63,0,0,0,0,0,0,128,63,0,0,128,63,220,90,0,0,3,0,0,0,8,0,0,0,120,0,0,0,11,0,0,0,58,110,0,0,8,91,0,0,36,21,0,0,128,7,0,0,3,0,0,0,4,23,0,0,60,38,0,0,116,38,0,0,172,38,0,0,228,38,0,0,136,1,0,0,58,98,0,0,33,111,0,0,169,112,0,0,106,28,141,56,82,187,30,58,8,105,220,58,130,237,87,59,137,99,178,59,3,42,5,60,48,220,57,60,180,62,119,60,28,163,158,60,209,242,197,60,254,134,241,60,155,171,16,61,5,173,42,61,132,194,70,61,83,230,100,61,17,137,130,61,135,159,147,61,203,178,165,61,209,190,184,61,58,191,204,61,84,175,225,61,20,138,247,61,14,37,7,62,217,244,18,62,95,49,31,62,104,215,43,62,138,227,56,62,48,82,70,62,148,31,84,62,191,71,98,62,142,198,112,62,176,151,127,62,82,91,135,62,96,15,143,62,152,229,150,62,121,219,158,62,112,238,166,62,216,27,175,62,251,96,183,62,17,187,191,62,70,39,200,62,183,162,208,62,120,42,217,62,148,187,225,62,12,83,234,62,222,237,242,62,6,137,251,62,190,16,2,63,31,90,6,63,36,159,10,63,80,222,14,63,43,22,19,63,65,69,23,63,37,106,27,63,115,131,31,63,206,143,35,63,230,141,39,63,116,124,43,63,63,90,47,63,25,38,51,63,231,222,54,63,153,131,58,63,51,19,62,63,197,140,65,63,119,239,68,63,127,58,72,63,39,109,75,63,206,134,78,63,229,134,81,63,241,108,84,63,142,56,87,63,105,233,89,63,69,127,92,63,250,249,94,63,115,89,97,63,175,157,99,63,193,198,101,63,207,212,103,63,17,200,105,63,210,160,107,63,110,95,109,63,80,4,111,63,244,143,112,63,230,2,114,63,189,93,115,63,31,161,116,63,191,205,117,63,87,228,118,63,176,229,119,63,151,210,120,63,227,171,121,63,115,114,122,63,39,39,123,63,231,202,123,63,157,94,124,63,53,227,124,63,156,89,125,63,189,194,125,63,134,31,126,63,222,112,126,63,171,183,126,63,207,244,126,63,38,41,127,63,134,85,127,63,190,122,127,63,150,153,127,63,204,178,127,63,20,199,127,63,28,215,127,63,130,227,127,63,221,236,127,63,182,243,127,63,138,248,127,63,200,251,127,63,214,253,127,63,7,255,127,63,165,255,127,63,232,255,127,63,253,255,127,63,0,0,128,63,224,1,0,0,135,136,8,59,255,255,255,255,5,0,96,0,3,0,32,0,4,0,8,0,2,0,4,0,4,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,50,91,0,0,60,23,0,0,0,0,0,0,0,0,128,63,0,0,0,128,99,250,127,63,191,117,86,188,139,233,127,63,10,113,214,188,121,205,127,63,231,206,32,189,47,166,127,63,58,94,86,189,175,115,127,63,19,242,133,189,249,53,127,63,42,175,160,189,18,237,126,63,51,101,187,189,253,152,126,63,4,19,214,189,188,57,126,63,115,183,240,189,85,207,125,63,168,168,5,190,203,89,125,63,187,239,18,190,37,217,124,63,92,48,32,190,103,77,124,63,245,105,45,190,152,182,123,63,243,155,58,190,190,20,123,63,194,197,71,190,226,103,122,63,205,230,84,190,9,176,121,63,130,254,97,190,60,237,120,63,77,12,111,190,132,31,120,63,156,15,124,190,234,70,119,63,238,131,132,190,119,99,118,63,62,250,138,190,54,117,117,63,117,106,145,190,48,124,116,63,76,212,151,190,113,120,115,63,122,55,158,190,3,106,114,63,183,147,164,190,244,80,113,63,188,232,170,190,79,45,112,63,65,54,177,190,33,255,110,63,1,124,183,190,118,198,109,63,180,185,189,190,94,131,108,63,21,239,195,190,231,53,107,63,222,27,202,190,30,222,105,63,201,63,208,190,18,124,104,63,146,90,214,190,212,15,103,63,243,107,220,190,116,153,101,63,170,115,226,190,1,25,100,63,113,113,232,190,141,142,98,63,7,101,238,190,40,250,96,63,39,78,244,190,230,91,95,63,144,44,250,190,215,179,93,63,0,0,0,191,15,2,92,63,27,228,2,191,160,70,90,63,119,194,5,191,158,129,88,63,246,154,8,191,29,179,86,63,119,109,11,191,49,219,84,63,218,57,14,191,239,249,82,63,0,0,17,191,108,15,81,63,202,191,19,191,189,27,79,63,24,121,22,191,248,30,77,63,205,43,25,191,52,25,75,63,202,215,27,191,136,10,73,63,241,124,30,191,10,243,70,63,36,27,33,191,209,210,68,63,70,178,35,191,247,169,66,63,58,66,38,191,147,120,64,63,227,202,40,191,189,62,62,63,37,76,43,191,143,252,59,63,227,197,45,191,34,178,57,63,1,56,48,191,144,95,55,63,101,162,50,191,243,4,53,63,243,4,53,191,101,162,50,63,144,95,55,191,1,56,48,63,34,178,57,191,227,197,45,63,143,252,59,191,37,76,43,63,189,62,62,191,227,202,40,63,147,120,64,191,58,66,38,63,247,169,66,191,70,178,35,63,209,210,68,191,36,27,33,63,10,243,70,191,241,124,30,63,136,10,73,191,202,215,27,63,52,25,75,191,205,43,25,63,248,30,77,191,24,121,22,63,189,27,79,191,202,191,19,63,108,15,81,191,0,0,17,63,239,249,82,191,218,57,14,63,49,219,84,191,119,109,11,63,29,179,86,191,246,154,8,63,158,129,88,191,119,194,5,63,160,70,90,191,27,228,2,63,15,2,92,191,0,0,0,63,215,179,93,191,144,44,250,62,230,91,95,191,39,78,244,62,40,250,96,191,7,101,238,62,141,142,98,191,113,113,232,62,1,25,100,191,170,115,226,62,116,153,101,191,243,107,220,62,212,15,103,191,146,90,214,62,18,124,104,191,201,63,208,62,30,222,105,191,222,27,202,62,231,53,107,191,21,239,195,62,94,131,108,191,180,185,189,62,118,198,109,191,1,124,183,62,33,255,110,191,65,54,177,62,79,45,112,191,188,232,170,62,244,80,113,191,183,147,164,62,3,106,114,191,122,55,158,62,113,120,115,191,76,212,151,62,48,124,116,191,117,106,145,62,54,117,117,191,62,250,138,62,119,99,118,191,238,131,132,62,234,70,119,191,156,15,124,62,132,31,120,191,77,12,111,62,60,237,120,191,130,254,97,62,9,176,121,191,205,230,84,62,226,103,122,191,194,197,71,62,190,20,123,191,243,155,58,62,152,182,123,191,245,105,45,62,103,77,124,191,92,48,32,62,37,217,124,191,187,239,18,62,203,89,125,191,168,168,5,62,85,207,125,191,115,183,240,61,188,57,126,191,4,19,214,61,253,152,126,191,51,101,187,61,18,237,126,191,42,175,160,61,249,53,127,191,19,242,133,61,175,115,127,191,58,94,86,61,47,166,127,191,231,206,32,61,121,205,127,191,10,113,214,60,139,233,127,191,191,117,86,60,99,250,127,191,0,48,141,36,0,0,128,191,191,117,86,188,99,250,127,191,10,113,214,188,139,233,127,191,231,206,32,189,121,205,127,191,58,94,86,189,47,166,127,191,19,242,133,189,175,115,127,191,42,175,160,189,249,53,127,191,51,101,187,189,18,237,126,191,4,19,214,189,253,152,126,191,115,183,240,189,188,57,126,191,168,168,5,190,85,207,125,191,187,239,18,190,203,89,125,191,92,48,32,190,37,217,124,191,245,105,45,190,103,77,124,191,243,155,58,190,152,182,123,191,194,197,71,190,190,20,123,191,205,230,84,190,226,103,122,191,130,254,97,190,9,176,121,191,77,12,111,190,60,237,120,191,156,15,124,190,132,31,120,191,238,131,132,190,234,70,119,191,62,250,138,190,119,99,118,191,117,106,145,190,54,117,117,191,76,212,151,190,48,124,116,191,122,55,158,190,113,120,115,191,183,147,164,190,3,106,114,191,188,232,170,190,244,80,113,191,65,54,177,190,79,45,112,191,1,124,183,190,33,255,110,191,180,185,189,190,118,198,109,191,21,239,195,190,94,131,108,191,222,27,202,190,231,53,107,191,201,63,208,190,30,222,105,191,146,90,214,190,18,124,104,191,243,107,220,190,212,15,103,191,170,115,226,190,116,153,101,191,113,113,232,190,1,25,100,191,7,101,238,190,141,142,98,191,39,78,244,190,40,250,96,191,144,44,250,190,230,91,95,191,0,0,0,191,215,179,93,191,27,228,2,191,15,2,92,191,119,194,5,191,160,70,90,191,246,154,8,191,158,129,88,191,119,109,11,191,29,179,86,191,218,57,14,191,49,219,84,191,0,0,17,191,239,249,82,191,202,191,19,191,108,15,81,191,24,121,22,191,189,27,79,191,205,43,25,191,248,30,77,191,202,215,27,191,52,25,75,191,241,124,30,191,136,10,73,191,36,27,33,191,10,243,70,191,70,178,35,191,209,210,68,191,58,66,38,191,247,169,66,191,227,202,40,191,147,120,64,191,37,76,43,191,189,62,62,191,227,197,45,191,143,252,59,191,1,56,48,191,34,178,57,191,101,162,50,191,144,95,55,191,243,4,53,191,243,4,53,191,144,95,55,191,101,162,50,191,34,178,57,191,1,56,48,191,143,252,59,191,227,197,45,191,189,62,62,191,37,76,43,191,147,120,64,191,227,202,40,191,247,169,66,191,58,66,38,191,209,210,68,191,70,178,35,191,10,243,70,191,36,27,33,191,136,10,73,191,241,124,30,191,52,25,75,191,202,215,27,191,248,30,77,191,205,43,25,191,189,27,79,191,24,121,22,191,108,15,81,191,202,191,19,191,239,249,82,191,0,0,17,191,49,219,84,191,218,57,14,191,29,179,86,191,119,109,11,191,158,129,88,191,246,154,8,191,160,70,90,191,119,194,5,191,15,2,92,191,27,228,2,191,215,179,93,191,0,0,0,191,230,91,95,191,144,44,250,190,40,250,96,191,39,78,244,190,141,142,98,191,7,101,238,190,1,25,100,191,113,113,232,190,116,153,101,191,170,115,226,190,212,15,103,191,243,107,220,190,18,124,104,191,146,90,214,190,30,222,105,191,201,63,208,190,231,53,107,191,222,27,202,190,94,131,108,191,21,239,195,190,118,198,109,191,180,185,189,190,33,255,110,191,1,124,183,190,79,45,112,191,65,54,177,190,244,80,113,191,188,232,170,190,3,106,114,191,183,147,164,190,113,120,115,191,122,55,158,190,48,124,116,191,76,212,151,190,54,117,117,191,117,106,145,190,119,99,118,191,62,250,138,190,234,70,119,191,238,131,132,190,132,31,120,191,156,15,124,190,60,237,120,191,77,12,111,190,9,176,121,191,130,254,97,190,226,103,122,191,205,230,84,190,190,20,123,191,194,197,71,190,152,182,123,191,243,155,58,190,103,77,124,191,245,105,45,190,37,217,124,191,92,48,32,190,203,89,125,191,187,239,18,190,85,207,125,191,168,168,5,190,188,57,126,191,115,183,240,189,253,152,126,191,4,19,214,189,18,237,126,191,51,101,187,189,249,53,127,191,42,175,160,189,175,115,127,191,19,242,133,189,47,166,127,191,58,94,86,189,121,205,127,191,231,206,32,189,139,233,127,191,10,113,214,188,99,250,127,191,191,117,86,188,0,0,128,191,0,48,13,165,99,250,127,191,191,117,86,60,139,233,127,191,10,113,214,60,121,205,127,191,231,206,32,61,47,166,127,191,58,94,86,61,175,115,127,191,19,242,133,61,249,53,127,191,42,175,160,61,18,237,126,191,51,101,187,61,253,152,126,191,4,19,214,61,188,57,126,191,115,183,240,61,85,207,125,191,168,168,5,62,203,89,125,191,187,239,18,62,37,217,124,191,92,48,32,62,103,77,124,191,245,105,45,62,152,182,123,191,243,155,58,62,190,20,123,191,194,197,71,62,226,103,122,191,205,230,84,62,9,176,121,191,130,254,97,62,60,237,120,191,77,12,111,62,132,31,120,191,156,15,124,62,234,70,119,191,238,131,132,62,119,99,118,191,62,250,138,62,54,117,117,191,117,106,145,62,48,124,116,191,76,212,151,62,113,120,115,191,122,55,158,62,3,106,114,191,183,147,164,62,244,80,113,191,188,232,170,62,79,45,112,191,65,54,177,62,33,255,110,191,1,124,183,62,118,198,109,191,180,185,189,62,94,131,108,191,21,239,195,62,231,53,107,191,222,27,202,62,30,222,105,191,201,63,208,62,18,124,104,191,146,90,214,62,212,15,103,191,243,107,220,62,116,153,101,191,170,115,226,62,1,25,100,191,113,113,232,62,141,142,98,191,7,101,238,62,40,250,96,191,39,78,244,62,230,91,95,191,144,44,250,62,215,179,93,191,0,0,0,63,15,2,92,191,27,228,2,63,160,70,90,191,119,194,5,63,158,129,88,191,246,154,8,63,29,179,86,191,119,109,11,63,49,219,84,191,218,57,14,63,239,249,82,191,0,0,17,63,108,15,81,191,202,191,19,63,189,27,79,191,24,121,22,63,248,30,77,191,205,43,25,63,52,25,75,191,202,215,27,63,136,10,73,191,241,124,30,63,10,243,70,191,36,27,33,63,209,210,68,191,70,178,35,63,247,169,66,191,58,66,38,63,147,120,64,191,227,202,40,63,189,62,62,191,37,76,43,63,143,252,59,191,227,197,45,63,34,178,57,191,1,56,48,63,144,95,55,191,101,162,50,63,243,4,53,191,243,4,53,63,101,162,50,191,144,95,55,63,1,56,48,191,34,178,57,63,227,197,45,191,143,252,59,63,37,76,43,191,189,62,62,63,227,202,40,191,147,120,64,63,58,66,38,191,247,169,66,63,70,178,35,191,209,210,68,63,36,27,33,191,10,243,70,63,241,124,30,191,136,10,73,63,202,215,27,191,52,25,75,63,205,43,25,191,248,30,77,63,24,121,22,191,189,27,79,63,202,191,19,191,108,15,81,63,0,0,17,191,239,249,82,63,218,57,14,191,49,219,84,63,119,109,11,191,29,179,86,63,246,154,8,191,158,129,88,63,119,194,5,191,160,70,90,63,27,228,2,191,15,2,92,63,0,0,0,191,215,179,93,63,144,44,250,190,230,91,95,63,39,78,244,190,40,250,96,63,7,101,238,190,141,142,98,63,113,113,232,190,1,25,100,63,170,115,226,190,116,153,101,63,243,107,220,190,212,15,103,63,146,90,214,190,18,124,104,63,201,63,208,190,30,222,105,63,222,27,202,190,231,53,107,63,21,239,195,190,94,131,108,63,180,185,189,190,118,198,109,63,1,124,183,190,33,255,110,63,65,54,177,190,79,45,112,63,188,232,170,190,244,80,113,63,183,147,164,190,3,106,114,63,122,55,158,190,113,120,115,63,76,212,151,190,48,124,116,63,117,106,145,190,54,117,117,63,62,250,138,190,119,99,118,63,238,131,132,190,234,70,119,63,156,15,124,190,132,31,120,63,77,12,111,190,60,237,120,63,130,254,97,190,9,176,121,63,205,230,84,190,226,103,122,63,194,197,71,190,190,20,123,63,243,155,58,190,152,182,123,63,245,105,45,190,103,77,124,63,92,48,32,190,37,217,124,63,187,239,18,190,203,89,125,63,168,168,5,190,85,207,125,63,115,183,240,189,188,57,126,63,4,19,214,189,253,152,126,63,51,101,187,189,18,237,126,63,42,175,160,189,249,53,127,63,19,242,133,189,175,115,127,63,58,94,86,189,47,166,127,63,231,206,32,189,121,205,127,63,10,113,214,188,139,233,127,63,191,117,86,188,99,250,127,63,0,200,83,165,0,0,128,63,191,117,86,60,99,250,127,63,10,113,214,60,139,233,127,63,231,206,32,61,121,205,127,63,58,94,86,61,47,166,127,63,19,242,133,61,175,115,127,63,42,175,160,61,249,53,127,63,51,101,187,61,18,237,126,63,4,19,214,61,253,152,126,63,115,183,240,61,188,57,126,63,168,168,5,62,85,207,125,63,187,239,18,62,203,89,125,63,92,48,32,62,37,217,124,63,245,105,45,62,103,77,124,63,243,155,58,62,152,182,123,63,194,197,71,62,190,20,123,63,205,230,84,62,226,103,122,63,130,254,97,62,9,176,121,63,77,12,111,62,60,237,120,63,156,15,124,62,132,31,120,63,238,131,132,62,234,70,119,63,62,250,138,62,119,99,118,63,117,106,145,62,54,117,117,63,76,212,151,62,48,124,116,63,122,55,158,62,113,120,115,63,183,147,164,62,3,106,114,63,188,232,170,62,244,80,113,63,65,54,177,62,79,45,112,63,1,124,183,62,33,255,110,63,180,185,189,62,118,198,109,63,21,239,195,62,94,131,108,63,222,27,202,62,231,53,107,63,201,63,208,62,30,222,105,63,146,90,214,62,18,124,104,63,243,107,220,62,212,15,103,63,170,115,226,62,116,153,101,63,113,113,232,62,1,25,100,63,7,101,238,62,141,142,98,63,39,78,244,62,40,250,96,63,144,44,250,62,230,91,95,63,0,0,0,63,215,179,93,63,27,228,2,63,15,2,92,63,119,194,5,63,160,70,90,63,246,154,8,63,158,129,88,63,119,109,11,63,29,179,86,63,218,57,14,63,49,219,84,63,0,0,17,63,239,249,82,63,202,191,19,63,108,15,81,63,24,121,22,63,189,27,79,63,205,43,25,63,248,30,77,63,202,215,27,63,52,25,75,63,241,124,30,63,136,10,73,63,36,27,33,63,10,243,70,63,70,178,35,63,209,210,68,63,58,66,38,63,247,169,66,63,227,202,40,63,147,120,64,63,37,76,43,63,189,62,62,63,227,197,45,63,143,252,59,63,1,56,48,63,34,178,57,63,101,162,50,63,144,95,55,63,243,4,53,63,243,4,53,63,144,95,55,63,101,162,50,63,34,178,57,63,1,56,48,63,143,252,59,63,227,197,45,63,189,62,62,63,37,76,43,63,147,120,64,63,227,202,40,63,247,169,66,63,58,66,38,63,209,210,68,63,70,178,35,63,10,243,70,63,36,27,33,63,136,10,73,63,241,124,30,63,52,25,75,63,202,215,27,63,248,30,77,63,205,43,25,63,189,27,79,63,24,121,22,63,108,15,81,63,202,191,19,63,239,249,82,63,0,0,17,63,49,219,84,63,218,57,14,63,29,179,86,63,119,109,11,63,158,129,88,63,246,154,8,63,160,70,90,63,119,194,5,63,15,2,92,63,27,228,2,63,215,179,93,63,0,0,0,63,230,91,95,63,144,44,250,62,40,250,96,63,39,78,244,62,141,142,98,63,7,101,238,62,1,25,100,63,113,113,232,62,116,153,101,63,170,115,226,62,212,15,103,63,243,107,220,62,18,124,104,63,146,90,214,62,30,222,105,63,201,63,208,62,231,53,107,63,222,27,202,62,94,131,108,63,21,239,195,62,118,198,109,63,180,185,189,62,33,255,110,63,1,124,183,62,79,45,112,63,65,54,177,62,244,80,113,63,188,232,170,62,3,106,114,63,183,147,164,62,113,120,115,63,122,55,158,62,48,124,116,63,76,212,151,62,54,117,117,63,117,106,145,62,119,99,118,63,62,250,138,62,234,70,119,63,238,131,132,62,132,31,120,63,156,15,124,62,60,237,120,63,77,12,111,62,9,176,121,63,130,254,97,62,226,103,122,63,205,230,84,62,190,20,123,63,194,197,71,62,152,182,123,63,243,155,58,62,103,77,124,63,245,105,45,62,37,217,124,63,92,48,32,62,203,89,125,63,187,239,18,62,85,207,125,63,168,168,5,62,188,57,126,63,115,183,240,61,253,152,126,63,4,19,214,61,18,237,126,63,51,101,187,61,249,53,127,63,42,175,160,61,175,115,127,63,19,242,133,61,47,166,127,63,58,94,86,61,121,205,127,63,231,206,32,61,139,233,127,63,10,113,214,60,99,250,127,63,191,117,86,60,240,0,0,0,137,136,136,59,1,0,0,0,5,0,48,0,3,0,16,0,4,0,4,0,4,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,242,94,0,0,60,23,0,0,0,0,0,0,120,0,0,0,136,136,8,60,2,0,0,0,5,0,24,0,3,0,8,0,2,0,4,0,4,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,210,96,0,0,60,23,0,0,0,0,0,0,60,0,0,0,137,136,136,60,3,0,0,0,5,0,12,0,3,0,4,0,4,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,194,97,0,0,60,23,0,0,0,0,0,0,255,255,127,63,142,255,127,63,106,254,127,63,147,252,127,63,7,250,127,63,200,246,127,63,214,242,127,63,48,238,127,63,214,232,127,63,200,226,127,63,7,220,127,63,147,212,127,63,107,204,127,63,143,195,127,63,0,186,127,63,189,175,127,63,199,164,127,63,29,153,127,63,192,140,127,63,176,127,127,63,236,113,127,63,118,99,127,63,75,84,127,63,110,68,127,63,222,51,127,63,154,34,127,63,163,16,127,63,250,253,126,63,157,234,126,63,141,214,126,63,203,193,126,63,86,172,126,63,46,150,126,63,83,127,126,63,198,103,126,63,134,79,126,63,148,54,126,63,239,28,126,63,152,2,126,63,143,231,125,63,211,203,125,63,102,175,125,63,70,146,125,63,116,116,125,63,241,85,125,63,188,54,125,63,213,22,125,63,60,246,124,63,242,212,124,63,246,178,124,63,73,144,124,63,235,108,124,63,219,72,124,63,27,36,124,63,169,254,123,63,135,216,123,63,180,177,123,63,48,138,123,63,252,97,123,63,23,57,123,63,130,15,123,63,61,229,122,63,72,186,122,63,162,142,122,63,77,98,122,63,72,53,122,63,148,7,122,63,48,217,121,63,29,170,121,63,90,122,121,63,233,73,121,63,200,24,121,63,249,230,120,63],"i8",ALLOC_NONE,Runtime.GLOBAL_BASE);allocate([123,180,120,63,78,129,120,63,115,77,120,63,234,24,120,63,178,227,119,63,205,173,119,63,58,119,119,63,249,63,119,63,10,8,119,63,110,207,118,63,37,150,118,63,47,92,118,63,140,33,118,63,60,230,117,63,64,170,117,63,151,109,117,63,66,48,117,63,65,242,116,63,148,179,116,63,59,116,116,63,55,52,116,63,135,243,115,63,44,178,115,63,38,112,115,63,118,45,115,63,26,234,114,63,20,166,114,63,100,97,114,63,10,28,114,63,5,214,113,63,87,143,113,63,0,72,113,63,255,255,112,63,85,183,112,63,2,110,112,63,6,36,112,63,98,217,111,63,21,142,111,63,32,66,111,63,132,245,110,63,63,168,110,63,83,90,110,63,192,11,110,63,134,188,109,63,165,108,109,63,29,28,109,63,239,202,108,63,27,121,108,63,161,38,108,63,128,211,107,63,187,127,107,63,80,43,107,63,64,214,106,63,140,128,106,63,50,42,106,63,53,211,105,63,147,123,105,63,77,35,105,63,100,202,104,63,216,112,104,63,168,22,104,63,213,187,103,63,96,96,103,63,72,4,103,63,143,167,102,63,51,74,102,63,54,236,101,63,151,141,101,63,87,46,101,63,119,206,100,63,245,109,100,63,212,12,100,63,18,171,99,63,177,72,99,63,176,229,98,63,16,130,98,63,209,29,98,63,243,184,97,63,119,83,97,63,92,237,96,63,164,134,96,63,78,31,96,63,91,183,95,63,203,78,95,63,158,229,94,63,213,123,94,63,112,17,94,63,110,166,93,63,210,58,93,63,154,206,92,63,198,97,92,63,89,244,91,63,81,134,91,63,174,23,91,63,114,168,90,63,157,56,90,63,46,200,89,63,39,87,89,63,135,229,88,63,79,115,88,63,127,0,88,63,23,141,87,63,24,25,87,63,130,164,86,63,86,47,86,63,147,185,85,63,58,67,85,63,75,204,84,63,199,84,84,63,174,220,83,63,1,100,83,63,191,234,82,63,233,112,82,63,127,246,81,63,130,123,81,63,242,255,80,63,207,131,80,63,26,7,80,63,210,137,79,63,250,11,79,63,144,141,78,63,148,14,78,63,9,143,77,63,237,14,77,63,65,142,76,63,5,13,76,63,59,139,75,63,225,8,75,63,249,133,74,63,131,2,74,63,127,126,73,63,238,249,72,63,207,116,72,63,36,239,71,63,237,104,71,63,41,226,70,63,218,90,70,63,0,211,69,63,155,74,69,63,172,193,68,63,50,56,68,63,47,174,67,63,162,35,67,63,141,152,66,63,239,12,66,63,200,128,65,63,26,244,64,63,229,102,64,63,40,217,63,63,229,74,63,63,27,188,62,63,204,44,62,63,247,156,61,63,157,12,61,63,190,123,60,63,92,234,59,63,117,88,59,63,10,198,58,63,29,51,58,63,173,159,57,63,187,11,57,63,71,119,56,63,81,226,55,63,218,76,55,63,227,182,54,63,107,32,54,63,116,137,53,63,253,241,52,63,7,90,52,63,147,193,51,63,160,40,51,63,48,143,50,63,66,245,49,63,216,90,49,63,241,191,48,63,142,36,48,63,175,136,47,63,85,236,46,63,129,79,46,63,50,178,45,63,105,20,45,63,39,118,44,63,107,215,43,63,55,56,43,63,139,152,42,63,103,248,41,63,204,87,41,63,186,182,40,63,50,21,40,63,51,115,39,63,191,208,38,63,214,45,38,63,121,138,37,63,167,230,36,63,97,66,36,63,169,157,35,63,125,248,34,63,223,82,34,63,207,172,33,63,77,6,33,63,91,95,32,63,248,183,31,63,37,16,31,63,226,103,30,63,48,191,29,63,16,22,29,63,129,108,28,63,132,194,27,63,26,24,27,63,67,109,26,63,0,194,25,63,81,22,25,63,54,106,24,63,177,189,23,63,193,16,23,63,103,99,22,63,163,181,21,63,118,7,21,63,225,88,20,63,228,169,19,63,127,250,18,63,179,74,18,63,128,154,17,63,231,233,16,63,232,56,16,63,132,135,15,63,187,213,14,63,142,35,14,63,254,112,13,63,10,190,12,63,179,10,12,63,250,86,11,63,223,162,10,63,99,238,9,63,134,57,9,63,73,132,8,63,172,206,7,63,175,24,7,63,84,98,6,63,155,171,5,63,131,244,4,63,15,61,4,63,61,133,3,63,15,205,2,63,134,20,2,63,161,91,1,63,97,162,0,63,143,209,255,62,167,93,254,62,14,233,252,62,194,115,251,62,198,253,249,62,27,135,248,62,193,15,247,62,186,151,245,62,6,31,244,62,168,165,242,62,158,43,241,62,236,176,239,62,145,53,238,62,144,185,236,62,232,60,235,62,154,191,233,62,169,65,232,62,21,195,230,62,223,67,229,62,8,196,227,62,145,67,226,62,124,194,224,62,200,64,223,62,120,190,221,62,140,59,220,62,6,184,218,62,230,51,217,62,46,175,215,62,223,41,214,62,249,163,212,62,125,29,211,62,110,150,209,62,204,14,208,62,151,134,206,62,210,253,204,62,125,116,203,62,153,234,201,62,39,96,200,62,40,213,198,62,159,73,197,62,138,189,195,62,236,48,194,62,198,163,192,62,25,22,191,62,230,135,189,62,45,249,187,62,241,105,186,62,50,218,184,62,241,73,183,62,47,185,181,62,238,39,180,62,47,150,178,62,242,3,177,62,57,113,175,62,4,222,173,62,86,74,172,62,47,182,170,62,144,33,169,62,122,140,167,62,239,246,165,62,239,96,164,62,124,202,162,62,151,51,161,62,64,156,159,62,122,4,158,62,68,108,156,62,161,211,154,62,145,58,153,62,22,161,151,62,48,7,150,62,225,108,148,62,41,210,146,62,11,55,145,62,135,155,143,62,158,255,141,62,81,99,140,62,162,198,138,62,145,41,137,62,32,140,135,62,80,238,133,62,34,80,132,62,151,177,130,62,176,18,129,62,222,230,126,62,169,167,123,62,195,103,120,62,47,39,117,62,238,229,113,62,4,164,110,62,115,97,107,62,60,30,104,62,98,218,100,62,232,149,97,62,207,80,94,62,26,11,91,62,204,196,87,62,230,125,84,62,107,54,81,62,93,238,77,62,191,165,74,62,146,92,71,62,218,18,68,62,151,200,64,62,206,125,61,62,128,50,58,62,174,230,54,62,93,154,51,62,141,77,48,62,66,0,45,62,125,178,41,62,66,100,38,62,145,21,35,62,110,198,31,62,219,118,28,62,218,38,25,62,109,214,21,62,152,133,18,62,91,52,15,62,186,226,11,62,183,144,8,62,84,62,5,62,148,235,1,62,240,48,253,61,6,138,246,61,113,226,239,61,51,58,233,61,79,145,226,61,207,231,219,61,181,61,213,61,3,147,206,61,192,231,199,61,242,59,193,61,156,143,186,61,195,226,179,61,108,53,173,61,155,135,166,61,85,217,159,61,159,42,153,61,126,123,146,61,246,203,139,61,11,28,133,61,135,215,124,61,70,118,111,61,93,20,98,61,214,177,84,61,185,78,71,61,16,235,57,61,229,134,44,61,64,34,31,61,44,189,17,61,178,87,4,61,181,227,237,60,96,23,211,60,118,74,184,60,11,125,157,60,50,175,130,60,250,193,79,60,254,36,26,60,42,15,201,59,153,167,59,59,46,125,214,185,210,70,113,187,171,222,227,187,166,140,39,188,129,41,93,188,225,98,137,188,160,48,164,188,236,253,190,188,179,202,217,188,224,150,244,188,49,177,7,189,147,22,21,189,140,123,34,189,19,224,47,189,30,68,61,189,165,167,74,189,157,10,88,189,254,108,101,189,190,206,114,189,234,23,128,189,27,200,134,189,237,119,141,189,92,39,148,189,99,214,154,189,253,132,161,189,38,51,168,189,217,224,174,189,17,142,181,189,202,58,188,189,254,230,194,189,170,146,201,189,200,61,208,189,84,232,214,189,74,146,221,189,164,59,228,189,93,228,234,189,114,140,241,189,221,51,248,189,154,218,254,189,82,192,2,190,252,18,6,190,71,101,9,190,50,183,12,190,186,8,16,190,221,89,19,190,152,170,22,190,234,250,25,190,208,74,29,190,71,154,32,190,78,233,35,190,225,55,39,190,0,134,42,190,166,211,45,190,211,32,49,190,131,109,52,190,181,185,55,190,101,5,59,190,147,80,62,190,58,155,65,190,90,229,68,190,240,46,72,190,249,119,75,190,116,192,78,190,93,8,82,190,179,79,85,190,115,150,88,190,156,220,91,190,42,34,95,190,27,103,98,190,109,171,101,190,31,239,104,190,44,50,108,190,148,116,111,190,84,182,114,190,106,247,117,190,211,55,121,190,141,119,124,190,150,182,127,190,117,122,129,190,69,25,131,190,185,183,132,190,208,85,134,190,136,243,135,190,225,144,137,190,218,45,139,190,112,202,140,190,164,102,142,190,116,2,144,190,223,157,145,190,228,56,147,190,129,211,148,190,182,109,150,190,129,7,152,190,226,160,153,190,215,57,155,190,95,210,156,190,121,106,158,190,35,2,160,190,94,153,161,190,38,48,163,190,125,198,164,190,96,92,166,190,206,241,167,190,198,134,169,190,71,27,171,190,80,175,172,190,224,66,174,190,245,213,175,190,143,104,177,190,173,250,178,190,77,140,180,190,110,29,182,190,16,174,183,190,48,62,185,190,207,205,186,190,234,92,188,190,130,235,189,190,148,121,191,190,31,7,193,190,35,148,194,190,159,32,196,190,145,172,197,190,248,55,199,190,211,194,200,190,34,77,202,190,226,214,203,190,19,96,205,190,181,232,206,190,197,112,208,190,66,248,209,190,45,127,211,190,131,5,213,190,67,139,214,190,109,16,216,190,255,148,217,190,249,24,219,190,89,156,220,190,29,31,222,190,70,161,223,190,211,34,225,190,193,163,226,190,16,36,228,190,190,163,229,190,204,34,231,190,56,161,232,190,0,31,234,190,36,156,235,190,162,24,237,190,122,148,238,190,171,15,240,190,51,138,241,190,18,4,243,190,70,125,244,190,207,245,245,190,170,109,247,190,217,228,248,190,88,91,250,190,40,209,251,190,71,70,253,190,181,186,254,190,56,23,0,191,187,208,0,191,228,137,1,191,178,66,2,191,37,251,2,191,59,179,3,191,246,106,4,191,83,34,5,191,83,217,5,191,245,143,6,191,56,70,7,191,29,252,7,191,162,177,8,191,199,102,9,191,140,27,10,191,240,207,10,191,243,131,11,191,147,55,12,191,209,234,12,191,172,157,13,191,36,80,14,191,56,2,15,191,232,179,15,191,50,101,16,191,24,22,17,191,151,198,17,191,176,118,18,191,99,38,19,191,174,213,19,191,145,132,20,191,13,51,21,191,31,225,21,191,200,142,22,191,8,60,23,191,221,232,23,191,72,149,24,191,72,65,25,191,220,236,25,191,4,152,26,191,192,66,27,191,15,237,27,191,240,150,28,191,99,64,29,191,104,233,29,191,254,145,30,191,37,58,31,191,220,225,31,191,35,137,32,191,250,47,33,191,95,214,33,191,82,124,34,191,212,33,35,191,227,198,35,191,127,107,36,191,167,15,37,191,92,179,37,191,157,86,38,191,104,249,38,191,191,155,39,191,160,61,40,191,11,223,40,191,255,127,41,191,125,32,42,191,131,192,42,191,17,96,43,191,39,255,43,191,196,157,44,191,232,59,45,191,146,217,45,191,195,118,46,191,121,19,47,191,180,175,47,191,115,75,48,191,183,230,48,191,127,129,49,191,203,27,50,191,153,181,50,191,234,78,51,191,189,231,51,191,18,128,52,191,232,23,53,191,63,175,53,191,22,70,54,191,110,220,54,191,69,114,55,191,156,7,56,191,113,156,56,191,197,48,57,191,150,196,57,191,230,87,58,191,178,234,58,191,252,124,59,191,194,14,60,191,3,160,60,191,193,48,61,191,250,192,61,191,173,80,62,191,219,223,62,191,131,110,63,191,165,252,63,191,64,138,64,191,83,23,65,191,224,163,65,191,228,47,66,191,96,187,66,191,83,70,67,191,190,208,67,191,158,90,68,191,246,227,68,191,194,108,69,191,5,245,69,191,188,124,70,191,232,3,71,191,137,138,71,191,157,16,72,191,37,150,72,191,32,27,73,191,142,159,73,191,111,35,74,191,193,166,74,191,134,41,75,191,188,171,75,191,99,45,76,191,122,174,76,191,2,47,77,191,250,174,77,191,98,46,78,191,57,173,78,191,126,43,79,191,51,169,79,191,85,38,80,191,230,162,80,191,228,30,81,191,80,154,81,191,40,21,82,191,109,143,82,191,30,9,83,191,59,130,83,191,195,250,83,191,183,114,84,191,22,234,84,191,223,96,85,191,18,215,85,191,176,76,86,191,183,193,86,191,39,54,87,191,0,170,87,191,66,29,88,191,236,143,88,191,254,1,89,191,120,115,89,191,89,228,89,191,162,84,90,191,81,196,90,191,102,51,91,191,226,161,91,191,195,15,92,191,10,125,92,191,183,233,92,191,200,85,93,191,62,193,93,191,24,44,94,191,87,150,94,191,249,255,94,191,255,104,95,191,104,209,95,191,51,57,96,191,98,160,96,191,243,6,97,191,229,108,97,191,58,210,97,191,240,54,98,191,8,155,98,191,128,254,98,191,89,97,99,191,146,195,99,191,44,37,100,191,37,134,100,191,126,230,100,191,55,70,101,191,78,165,101,191,197,3,102,191,154,97,102,191,205,190,102,191,94,27,103,191,77,119,103,191,154,210,103,191,68,45,104,191,75,135,104,191,174,224,104,191,111,57,105,191,139,145,105,191,4,233,105,191,217,63,106,191,9,150,106,191,148,235,106,191,123,64,107,191,188,148,107,191,89,232,107,191,79,59,108,191,160,141,108,191,75,223,108,191,79,48,109,191,173,128,109,191,101,208,109,191,117,31,110,191,223,109,110,191,161,187,110,191,187,8,111,191,46,85,111,191,248,160,111,191,27,236,111,191,149,54,112,191,103,128,112,191,144,201,112,191,15,18,113,191,230,89,113,191,19,161,113,191,151,231,113,191,113,45,114,191,160,114,114,191,38,183,114,191,1,251,114,191,50,62,115,191,184,128,115,191,148,194,115,191,196,3,116,191,73,68,116,191,34,132,116,191,80,195,116,191,210,1,117,191,168,63,117,191,210,124,117,191,80,185,117,191,33,245,117,191,69,48,118,191,189,106,118,191,136,164,118,191,166,221,118,191,22,22,119,191,217,77,119,191,239,132,119,191,87,187,119,191,17,241,119,191,29,38,120,191,122,90,120,191,42,142,120,191,43,193,120,191,125,243,120,191,33,37,121,191,22,86,121,191,92,134,121,191,242,181,121,191,218,228,121,191,18,19,122,191,154,64,122,191,115,109,122,191,157,153,122,191,22,197,122,191,223,239,122,191,248,25,123,191,97,67,123,191,26,108,123,191,34,148,123,191,122,187,123,191,32,226,123,191,23,8,124,191,92,45,124,191,240,81,124,191,211,117,124,191,5,153,124,191,134,187,124,191,85,221,124,191,115,254,124,191,223,30,125,191,154,62,125,191,163,93,125,191,250,123,125,191,159,153,125,191,146,182,125,191,211,210,125,191,98,238,125,191,63,9,126,191,105,35,126,191,225,60,126,191,167,85,126,191,186,109,126,191,27,133,126,191,201,155,126,191,196,177,126,191,13,199,126,191,162,219,126,191,133,239,126,191,181,2,127,191,50,21,127,191,252,38,127,191,19,56,127,191,118,72,127,191,39,88,127,191,36,103,127,191,110,117,127,191,5,131,127,191,232,143,127,191,25,156,127,191,149,167,127,191,95,178,127,191,116,188,127,191,215,197,127,191,133,206,127,191,129,214,127,191,200,221,127,191,93,228,127,191,61,234,127,191,106,239,127,191,227,243,127,191,169,247,127,191,187,250,127,191,25,253,127,191,196,254,127,191,187,255,127,191,250,255,127,63,57,254,127,63,169,249,127,63,75,242,127,63,30,232,127,63,35,219,127,63,89,203,127,63,193,184,127,63,91,163,127,63,40,139,127,63,39,112,127,63,90,82,127,63,191,49,127,63,88,14,127,63,37,232,126,63,38,191,126,63,92,147,126,63,200,100,126,63,105,51,126,63,65,255,125,63,79,200,125,63,150,142,125,63,20,82,125,63,203,18,125,63,188,208,124,63,231,139,124,63,77,68,124,63,239,249,123,63,205,172,123,63,233,92,123,63,67,10,123,63,221,180,122,63,182,92,122,63,209,1,122,63,46,164,121,63,206,67,121,63,178,224,120,63,220,122,120,63,76,18,120,63,4,167,119,63,4,57,119,63,79,200,118,63,228,84,118,63,198,222,117,63,246,101,117,63,117,234,116,63,68,108,116,63,101,235,115,63,218,103,115,63,163,225,114,63,194,88,114,63,57,205,113,63,9,63,113,63,52,174,112,63,187,26,112,63,160,132,111,63,228,235,110,63,138,80,110,63,147,178,109,63,1,18,109,63,213,110,108,63,17,201,107,63,183,32,107,63,201,117,106,63,73,200,105,63,57,24,105,63,155,101,104,63,111,176,103,63,186,248,102,63,124,62,102,63,184,129,101,63,111,194,100,63,164,0,100,63,90,60,99,63,145,117,98,63,76,172,97,63,142,224,96,63,89,18,96,63,174,65,95,63,145,110,94,63,3,153,93,63,8,193,92,63,160,230,91,63,207,9,91,63,152,42,90,63,251,72,89,63,253,100,88,63,159,126,87,63,229,149,86,63,208,170,85,63,99,189,84,63,161,205,83,63,140,219,82,63,39,231,81,63,117,240,80,63,121,247,79,63,52,252,78,63,171,254,77,63,223,254,76,63,212,252,75,63,140,248,74,63,10,242,73,63,82,233,72,63,101,222,71,63,71,209,70,63,251,193,69,63,132,176,68,63,229,156,67,63,32,135,66,63,58,111,65,63,52,85,64,63,19,57,63,63,216,26,62,63,136,250,60,63,38,216,59,63,180,179,58,63,54,141,57,63,175,100,56,63,34,58,55,63,147,13,54,63,5,223,52,63,124,174,51,63,249,123,50,63,130,71,49,63,25,17,48,63,194,216,46,63,127,158,45,63,86,98,44,63,72,36,43,63,90,228,41,63,144,162,40,63,235,94,39,63,113,25,38,63,37,210,36,63,9,137,35,63,35,62,34,63,117,241,32,63,4,163,31,63,210,82,30,63,228,0,29,63,61,173,27,63,225,87,26,63,211,0,25,63,25,168,23,63,180,77,22,63,170,241,20,63,253,147,19,63,178,52,18,63,204,211,16,63,80,113,15,63,66,13,14,63,164,167,12,63,124,64,11,63,205,215,9,63,154,109,8,63,233,1,7,63,189,148,5,63,25,38,4,63,3,182,2,63,126,68,1,63,28,163,255,62,110,186,252,62,250,206,249,62,202,224,246,62,228,239,243,62,81,252,240,62,26,6,238,62,71,13,235,62,224,17,232,62,237,19,229,62,119,19,226,62,135,16,223,62,36,11,220,62,88,3,217,62,42,249,213,62,164,236,210,62,205,221,207,62,175,204,204,62,82,185,201,62,191,163,198,62,254,139,195,62,24,114,192,62,22,86,189,62,0,56,186,62,224,23,183,62,189,245,179,62,161,209,176,62,149,171,173,62,162,131,170,62,207,89,167,62,39,46,164,62,178,0,161,62,121,209,157,62,133,160,154,62,223,109,151,62,143,57,148,62,160,3,145,62,26,204,141,62,5,147,138,62,107,88,135,62,86,28,132,62,205,222,128,62,182,63,123,62,16,191,116,62,187,59,110,62,201,181,103,62,77,45,97,62,89,162,90,62,255,20,84,62,81,133,77,62,99,243,70,62,70,95,64,62,13,201,57,62,202,48,51,62,144,150,44,62,114,250,37,62,130,92,31,62,210,188,24,62,118,27,18,62,127,120,11,62,1,212,4,62,29,92,252,61,114,13,239,61,41,188,225,61,102,104,212,61,78,18,199,61,8,186,185,61,184,95,172,61,132,3,159,61,146,165,145,61,7,70,132,61,18,202,109,61,122,5,83,61,145,62,56,61,164,117,29,61,252,170,2,61,202,189,207,60,86,35,154,60,97,14,73,60,197,167,187,59,61,122,86,186,9,70,241,187,18,221,99,188,80,138,167,188,65,36,221,188,227,93,9,189,35,40,36,189,150,240,62,189,242,182,89,189,234,122,116,189,26,158,135,189,66,253,148,189,200,90,162,189,134,182,175,189,87,16,189,189,22,104,202,189,155,189,215,189,195,16,229,189,105,97,242,189,101,175,255,189,74,125,6,190,104,33,13,190,250,195,19,190,237,100,26,190,46,4,33,190,172,161,39,190,83,61,46,190,16,215,52,190,210,110,59,190,134,4,66,190,25,152,72,190,121,41,79,190,148,184,85,190,86,69,92,190,174,207,98,190,137,87,105,190,214,220,111,190,128,95,118,190,120,223,124,190,84,174,129,190,129,235,132,190,56,39,136,190,114,97,139,190,36,154,142,190,69,209,145,190,205,6,149,190,179,58,152,190,238,108,155,190,116,157,158,190,61,204,161,190,64,249,164,190,115,36,168,190,207,77,171,190,73,117,174,190,218,154,177,190,120,190,180,190,27,224,183,190,186,255,186,190,75,29,190,190,199,56,193,190,37,82,196,190,91,105,199,190,97,126,202,190,48,145,205,190,188,161,208,190,0,176,211,190,241,187,214,190,135,197,217,190,186,204,220,190,129,209,223,190,211,211,226,190,169,211,229,190,250,208,232,190,189,203,235,190,234,195,238,190,120,185,241,190,96,172,244,190,154,156,247,190,28,138,250,190,223,116,253,190,109,46,0,191,3,161,1,191,45,18,3,191,230,129,4,191,44,240,5,191,250,92,7,191,76,200,8,191,30,50,10,191,108,154,11,191,50,1,13,191,108,102,14,191,23,202,15,191,45,44,17,191,172,140,18,191,144,235,19,191,213,72,21,191,118,164,22,191,113,254,23,191,192,86,25,191,98,173,26,191,81,2,28,191,138,85,29,191,9,167,30,191,203,246,31,191,204,68,33,191,9,145,34,191,124,219,35,191,36,36,37,191,253,106,38,191,2,176,39,191,48,243,40,191,132,52,42,191,250,115,43,191,143,177,44,191,63,237,45,191,7,39,47,191,227,94,48,191,208,148,49,191,202,200,50,191,206,250,51,191,218,42,53,191,232,88,54,191,247,132,55,191,2,175,56,191,7,215,57,191,3,253,58,191,241,32,60,191,207,66,61,191,154,98,62,191,79,128,63,191,233,155,64,191,104,181,65,191,198,204,66,191,1,226,67,191,23,245,68,191,3,6,70,191,196,20,71,191,86,33,72,191,182,43,73,191,225,51,74,191,212,57,75,191,141,61,76,191,9,63,77,191,68,62,78,191,61,59,79,191,240,53,80,191,90,46,81,191,121,36,82,191,74,24,83,191,202,9,84,191,247,248,84,191,206,229,85,191,77,208,86,191,112,184,87,191,55,158,88,191,156,129,89,191,160,98,90,191,62,65,91,191,117,29,92,191,65,247,92,191,162,206,93,191,148,163,94,191,20,118,95,191,34,70,96,191,186,19,97,191,217,222,97,191,127,167,98,191,169,109,99,191,84,49,100,191,126,242,100,191,38,177,101,191,73,109,102,191,229,38,103,191,248,221,103,191,128,146,104,191,123,68,105,191,232,243,105,191,195,160,106,191,12,75,107,191,192,242,107,191,222,151,108,191,100,58,109,191,80,218,109,191,160,119,110,191,83,18,111,191,102,170,111,191,217,63,112,191,169,210,112,191,213,98,113,191,91,240,113,191,58,123,114,191,113,3,115,191,253,136,115,191,222,11,116,191,17,140,116,191,150,9,117,191,107,132,117,191,143,252,117,191,0,114,118,191,189,228,118,191,198,84,119,191,24,194,119,191,178,44,120,191,147,148,120,191,187,249,120,191,40,92,121,191,217,187,121,191,205,24,122,191,2,115,122,191,121,202,122,191,47,31,123,191,36,113,123,191,88,192,123,191,201,12,124,191,118,86,124,191,95,157,124,191,130,225,124,191,224,34,125,191,119,97,125,191,71,157,125,191,79,214,125,191,142,12,126,191,4,64,126,191,176,112,126,191,146,158,126,191,169,201,126,191,245,241,126,191,117,23,127,191,41,58,127,191,16,90,127,191,43,119,127,191,120,145,127,191,248,168,127,191,170,189,127,191,143,207,127,191,165,222,127,191,237,234,127,191,102,244,127,191,17,251,127,191,237,254,127,191,234,255,127,63,229,248,127,63,166,230,127,63,45,201,127,63,124,160,127,63,149,108,127,63,121,45,127,63,44,227,126,63,177,141,126,63,11,45,126,63,63,193,125,63,82,74,125,63,72,200,124,63,40,59,124,63,247,162,123,63,189,255,122,63,128,81,122,63,72,152,121,63,30,212,120,63,9,5,120,63,19,43,119,63,70,70,118,63,172,86,117,63,78,92,116,63,56,87,115,63,118,71,114,63,19,45,113,63,28,8,112,63,158,216,110,63,165,158,109,63,64,90,108,63,126,11,107,63,107,178,105,63,25,79,104,63,150,225,102,63,242,105,101,63,62,232,99,63,139,92,98,63,234,198,96,63,109,39,95,63,38,126,93,63,40,203,91,63,133,14,90,63,83,72,88,63,163,120,86,63,139,159,84,63,32,189,82,63,118,209,80,63,163,220,78,63,189,222,76,63,219,215,74,63,19,200,72,63,124,175,70,63,46,142,68,63,65,100,66,63,206,49,64,63,236,246,61,63,180,179,59,63,66,104,57,63,173,20,55,63,16,185,52,63,134,85,50,63,41,234,47,63,21,119,45,63,101,252,42,63,53,122,40,63,161,240,37,63,198,95,35,63,192,199,32,63,172,40,30,63,169,130,27,63,212,213,24,63,74,34,22,63,42,104,19,63,147,167,16,63,164,224,13,63,123,19,11,63,57,64,8,63,253,102,5,63,231,135,2,63,45,70,255,62,91,113,249,62,151,145,243,62,36,167,237,62,69,178,231,62,60,179,225,62,76,170,219,62,186,151,213,62,201,123,207,62,190,86,201,62,223,40,195,62,112,242,188,62,183,179,182,62,251,108,176,62,129,30,170,62,146,200,163,62,115,107,157,62,108,7,151,62,197,156,144,62,199,43,138,62,185,180,131,62,199,111,122,62,33,107,109,62,17,92,96,62,41,67,83,62,253,32,70,62,32,246,56,62,38,195,43,62,164,136,30,62,45,71,17,62,87,255,3,62,110,99,237,61,194,189,210,61,218,14,184,61,222,87,157,61,251,153,130,61,188,172,79,61,101,28,26,61,153,10,201,60,42,167,59,60,193,120,214,186,45,68,113,188,87,215,227,188,76,129,39,189,148,15,93,189,21,74,137,189,90,6,164,189,109,187,190,189,34,104,217,189,78,11,244,189,227,81,7,190,47,152,20,190,247,215,33,190,165,16,47,190,166,65,60,190,100,106,73,190,77,138,86,190,205,160,99,190,80,173,112,190,69,175,125,190,13,83,133,190,158,200,139,190,13,56,146,190,18,161,152,190,102,3,159,190,191,94,165,190,216,178,171,190,105,255,177,190,43,68,184,190,216,128,190,190,42,181,196,190,219,224,202,190,165,3,209,190,69,29,215,190,117,45,221,190,241,51,227,190,118,48,233,190,192,34,239,190,141,10,245,190,155,231,250,190,211,92,0,191,56,64,3,191,219,29,6,191,155,245,8,191,90,199,11,191,247,146,14,191,84,88,17,191,80,23,20,191,205,207,22,191,172,129,25,191,208,44,28,191,26,209,30,191,109,110,33,191,171,4,36,191,183,147,38,191,116,27,41,191,199,155,43,191,147,20,46,191,187,133,48,191,38,239,50,191,183,80,53,191,85,170,55,191,227,251,57,191,74,69,60,191,110,134,62,191,55,191,64,191,139,239,66,191,83,23,69,191,117,54,71,191,218,76,73,191,107,90,75,191,16,95,77,191,179,90,79,191,62,77,81,191,154,54,83,191,179,22,85,191,114,237,86,191,197,186,88,191,149,126,90,191,208,56,92,191,98,233,93,191,56,144,95,191,64,45,97,191,103,192,98,191,156,73,100,191,206,200,101,191,235,61,103,191,227,168,104,191,167,9,106,191,39,96,107,191,84,172,108,191,31,238,109,191,122,37,111,191,88,82,112,191,171,116,113,191,103,140,114,191,127,153,115,191,231,155,116,191,149,147,117,191,126,128,118,191,150,98,119,191,212,57,120,191,47,6,121,191,158,199,121,191,23,126,122,191,148,41,123,191,13,202,123,191,122,95,124,191,213,233,124,191,24,105,125,191,62,221,125,191,64,70,126,191,28,164,126,191,204,246,126,191,77,62,127,191,156,122,127,191,182,171,127,191,153,209,127,191,67,236,127,191,180,251,127,191,166,255,127,63,148,227,127,63,156,154,127,63,204,36,127,63,56,130,126,63,253,178,125,63,63,183,124,63,42,143,123,63,243,58,122,63,212,186,120,63,17,15,119,63,246,55,117,63,213,53,115,63,8,9,113,63,241,177,110,63,249,48,108,63,144,134,105,63,47,179,102,63,83,183,99,63,132,147,96,63,78,72,93,63,69,214,89,63,3,62,86,63,43,128,82,63,101,157,78,63,94,150,74,63,204,107,70,63,106,30,66,63,249,174,61,63,64,30,57,63,13,109,52,63,50,156,47,63,135,172,42,63,235,158,37,63,63,116,32,63,109,45,27,63,97,203,21,63,13,79,16,63,104,185,10,63,107,11,5,63,46,140,254,62,221,212,242,62,241,242,230,62,127,232,218,62,166,183,206,62,136,98,194,62,78,235,181,62,42,84,169,62,81,159,156,62,253,206,143,62,109,229,130,62,206,201,107,62,98,159,81,62,48,80,55,62,211,224,28,62,241,85,2,62,98,104,207,61,124,0,154,61,36,251,72,61,27,164,187,60,243,119,86,187,100,61,241,188,187,192,99,189,103,93,167,189,20,189,220,189,3,251,8,190,115,127,35,190,52,231,61,190,164,45,88,190,38,78,114,190,18,34,134,190,137,5,147,190,52,207,159,190,213,124,172,190,51,12,185,190,26,123,197,190,91,199,209,190,205,238,221,190,80,239,233,190,199,198,245,190,144,185,0,191,38,121,6,191,36,33,12,191,141,176,17,191,102,38,23,191,186,129,28,191,152,193,33,191,21,229,38,191,74,235,43,191,86,211,48,191,91,156,53,191,131,69,58,191,253,205,62,191,252,52,67,191,188,121,71,191,125,155,75,191,132,153,79,191,31,115,83,191,161,39,87,191,99,182,90,191,198,30,94,191,48,96,97,191,15,122,100,191,216,107,103,191,7,53,106,191,31,213,108,191,169,75,111,191,55,152,113,191,98,186,115,191,201,177,117,191,22,126,119,191,246,30,121,191,33,148,122,191,85,221,123,191,89,250,124,191,250,234,125,191,14,175,126,191,116,70,127,191,15,177,127,191,206,238,127,191,0,0,0,0,0,0,0,0,3,0,0,0,2,0,0,0,3,0,0,0,2,0,0,0,5,0,0,0,2,0,0,0,3,0,0,0,2,0,0,0,3,0,0,0,2,0,0,0,5,0,0,0,2,0,0,0,3,0,0,0,2,0,0,0,0,0,206,64,0,0,200,64,0,0,184,64,0,0,170,64,0,0,162,64,0,0,154,64,0,0,144,64,0,0,140,64,0,0,156,64,0,0,150,64,0,0,146,64,0,0,142,64,0,0,156,64,0,0,148,64,0,0,138,64,0,0,144,64,0,0,140,64,0,0,148,64,0,0,152,64,0,0,142,64,0,0,112,64,0,0,112,64,0,0,112,64,0,0,112,64,0,0,112,64,0,134,107,63,0,20,46,63,0,112,189,62,0,208,76,62,0,0,102,63,0,0,76,63,0,0,38,63,0,0,0,63,15,0,0,0,10,0,0,0,5,0,0,0,6,0,0,0,4,0,0,0,3,0,0,0,0,115,0,0,8,115,0,0,24,115,0,0,56,115,0,0,64,115,0,0,80,115,0,0,112,115,0,0,152,115,0,0,232,115,0,0,136,116,0,0,144,116,0,0,160,116,0,0,0,0,0,0,64,31,0,0,184,36,0,0,236,44,0,0,188,52,0,0,92,68,0,0,168,97,0,0,128,56,1,0,0,0,0,0,40,35,0,0,224,46,0,0,164,56,0,0,68,72,0,0,180,95,0,0,172,138,0,0,128,56,1,0,0,0,0,0,4,41,0,0,176,54,0,0,104,66,0,0,252,83,0,0,84,111,0,0,16,164,0,0,128,56,1,0,222,116,0,0,225,116,0,0,10,103,242,14,86,205,228,29,10,103,242,14,117,82,130,12,89,154,4,25,117,82,130,12,70,17,49,10,237,3,98,20,70,17,49,10,218,2,215,7,249,198,173,15,218,2,215,7,34,182,82,5,218,250,164,10,34,182,82,5,70,243,46,30,43,227,75,14,31,102,128,24,28,44,29,10,218,97,72,18,237,156,244,6,236,48,19,11,227,144,165,4,237,164,29,2,10,223,107,3,1,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,2,0,0,0,1,0,0,0,7,0,0,0,0,0,0,0,4,0,0,0,3,0,0,0,6,0,0,0,1,0,0,0,5,0,0,0,2,0,0,0,15,0,0,0,0,0,0,0,8,0,0,0,7,0,0,0,12,0,0,0,3,0,0,0,11,0,0,0,4,0,0,0,14,0,0,0,1,0,0,0,9,0,0,0,6,0,0,0,13,0,0,0,2,0,0,0,10,0,0,0,5,0,0,0,144,69,0,0,80,72,0,0,12,75,0,0,196,77,0,0,120,80,0,0,40,83,0,0,212,85,0,0,60,87,0,0,248,87,0,0,108,88,0,0,184,88,0,0,240,88,0,0,16,89,0,0,40,89,0,0,52,89,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,3,0,0,0,5,0,0,0,7,0,0,0,9,0,0,0,11,0,0,0,13,0,0,0,15,0,0,0,17,0,0,0,19,0,0,0,21,0,0,0,23,0,0,0,25,0,0,0,27,0,0,0,29,0,0,0,31,0,0,0,33,0,0,0,35,0,0,0,37,0,0,0,39,0,0,0,41,0,0,0,43,0,0,0,45,0,0,0,47,0,0,0,49,0,0,0,51,0,0,0,53,0,0,0,55,0,0,0,57,0,0,0,59,0,0,0,61,0,0,0,63,0,0,0,65,0,0,0,67,0,0,0,69,0,0,0,71,0,0,0,73,0,0,0,75,0,0,0,77,0,0,0,79,0,0,0,81,0,0,0,83,0,0,0,85,0,0,0,87,0,0,0,89,0,0,0,91,0,0,0,93,0,0,0,95,0,0,0,97,0,0,0,99,0,0,0,101,0,0,0,103,0,0,0,105,0,0,0,107,0,0,0,109,0,0,0,111,0,0,0,113,0,0,0,115,0,0,0,117,0,0,0,119,0,0,0,121,0,0,0,123,0,0,0,125,0,0,0,127,0,0,0,129,0,0,0,131,0,0,0,133,0,0,0,135,0,0,0,137,0,0,0,139,0,0,0,141,0,0,0,143,0,0,0,145,0,0,0,147,0,0,0,149,0,0,0,151,0,0,0,153,0,0,0,155,0,0,0,157,0,0,0,159,0,0,0,161,0,0,0,163,0,0,0,165,0,0,0,167,0,0,0,169,0,0,0,171,0,0,0,173,0,0,0,175,0,0,0,177,0,0,0,179,0,0,0,181,0,0,0,183,0,0,0,185,0,0,0,187,0,0,0,189,0,0,0,191,0,0,0,193,0,0,0,195,0,0,0,197,0,0,0,199,0,0,0,201,0,0,0,203,0,0,0,205,0,0,0,207,0,0,0,209,0,0,0,211,0,0,0,213,0,0,0,215,0,0,0,217,0,0,0,219,0,0,0,221,0,0,0,223,0,0,0,225,0,0,0,227,0,0,0,229,0,0,0,231,0,0,0,233,0,0,0,235,0,0,0,237,0,0,0,239,0,0,0,241,0,0,0,243,0,0,0,245,0,0,0,247,0,0,0,249,0,0,0,251,0,0,0,253,0,0,0,255,0,0,0,1,1,0,0,3,1,0,0,5,1,0,0,7,1,0,0,9,1,0,0,11,1,0,0,13,1,0,0,15,1,0,0,17,1,0,0,19,1,0,0,21,1,0,0,23,1,0,0,25,1,0,0,27,1,0,0,29,1,0,0,31,1,0,0,33,1,0,0,35,1,0,0,37,1,0,0,39,1,0,0,41,1,0,0,43,1,0,0,45,1,0,0,47,1,0,0,49,1,0,0,51,1,0,0,53,1,0,0,55,1,0,0,57,1,0,0,59,1,0,0,61,1,0,0,63,1,0,0,65,1,0,0,67,1,0,0,69,1,0,0,71,1,0,0,73,1,0,0,75,1,0,0,77,1,0,0,79,1,0,0,81,1,0,0,83,1,0,0,85,1,0,0,87,1,0,0,89,1,0,0,91,1,0,0,93,1,0,0,95,1,0,0,13,0,0,0,25,0,0,0,41,0,0,0,61,0,0,0,85,0,0,0,113,0,0,0,145,0,0,0,181,0,0,0,221,0,0,0,9,1,0,0,57,1,0,0,109,1,0,0,165,1,0,0,225,1,0,0,33,2,0,0,101,2,0,0,173,2,0,0,249,2,0,0,73,3,0,0,157,3,0,0,245,3,0,0,81,4,0,0,177,4,0,0,21,5,0,0,125,5,0,0,233,5,0,0,89,6,0,0,205,6,0,0,69,7,0,0,193,7,0,0,65,8,0,0,197,8,0,0,77,9,0,0,217,9,0,0,105,10,0,0,253,10,0,0,149,11,0,0,49,12,0,0,209,12,0,0,117,13,0,0,29,14,0,0,201,14,0,0,121,15,0,0,45,16,0,0,229,16,0,0,161,17,0,0,97,18,0,0,37,19,0,0,237,19,0,0,185,20,0,0,137,21,0,0,93,22,0,0,53,23,0,0,17,24,0,0,241,24,0,0,213,25,0,0,189,26,0,0,169,27,0,0,153,28,0,0,141,29,0,0,133,30,0,0,129,31,0,0,129,32,0,0,133,33,0,0,141,34,0,0,153,35,0,0,169,36,0,0,189,37,0,0,213,38,0,0,241,39,0,0,17,41,0,0,53,42,0,0,93,43,0,0,137,44,0,0,185,45,0,0,237,46,0,0,37,48,0,0,97,49,0,0,161,50,0,0,229,51,0,0,45,53,0,0,121,54,0,0,201,55,0,0,29,57,0,0,117,58,0,0,209,59,0,0,49,61,0,0,149,62,0,0,253,63,0,0,105,65,0,0,217,66,0,0,77,68,0,0,197,69,0,0,65,71,0,0,193,72,0,0,69,74,0,0,205,75,0,0,89,77,0,0,233,78,0,0,125,80,0,0,21,82,0,0,177,83,0,0,81,85,0,0,245,86,0,0,157,88,0,0,73,90,0,0,249,91,0,0,173,93,0,0,101,95,0,0,33,97,0,0,225,98,0,0,165,100,0,0,109,102,0,0,57,104,0,0,9,106,0,0,221,107,0,0,181,109,0,0,145,111,0,0,113,113,0,0,85,115,0,0,61,117,0,0,41,119,0,0,25,121,0,0,13,123,0,0,5,125,0,0,1,127,0,0,1,129,0,0,5,131,0,0,13,133,0,0,25,135,0,0,41,137,0,0,61,139,0,0,85,141,0,0,113,143,0,0,145,145,0,0,181,147,0,0,221,149,0,0,9,152,0,0,57,154,0,0,109,156,0,0,165,158,0,0,225,160],"i8",ALLOC_NONE,Runtime.GLOBAL_BASE+10240);allocate([33,163,0,0,101,165,0,0,173,167,0,0,249,169,0,0,73,172,0,0,157,174,0,0,245,176,0,0,81,179,0,0,177,181,0,0,21,184,0,0,125,186,0,0,233,188,0,0,89,191,0,0,205,193,0,0,69,196,0,0,193,198,0,0,65,201,0,0,197,203,0,0,77,206,0,0,217,208,0,0,105,211,0,0,253,213,0,0,149,216,0,0,49,219,0,0,209,221,0,0,117,224,0,0,29,227,0,0,201,229,0,0,121,232,0,0,45,235,0,0,229,237,0,0,161,240,0,0,63,0,0,0,129,0,0,0,231,0,0,0,121,1,0,0,63,2,0,0,65,3,0,0,135,4,0,0,25,6,0,0,255,7,0,0,65,10,0,0,231,12,0,0,249,15,0,0,127,19,0,0,129,23,0,0,7,28,0,0,25,33,0,0,191,38,0,0,1,45,0,0,231,51,0,0,121,59,0,0,191,67,0,0,193,76,0,0,135,86,0,0,25,97,0,0,127,108,0,0,193,120,0,0,231,133,0,0,249,147,0,0,255,162,0,0,1,179,0,0,7,196,0,0,25,214,0,0,63,233,0,0,129,253,0,0,231,18,1,0,121,41,1,0,63,65,1,0,65,90,1,0,135,116,1,0,25,144,1,0,255,172,1,0,65,203,1,0,231,234,1,0,249,11,2,0,127,46,2,0,129,82,2,0,7,120,2,0,25,159,2,0,191,199,2,0,1,242,2,0,231,29,3,0,121,75,3,0,191,122,3,0,193,171,3,0,135,222,3,0,25,19,4,0,127,73,4,0,193,129,4,0,231,187,4,0,249,247,4,0,255,53,5,0,1,118,5,0,7,184,5,0,25,252,5,0,63,66,6,0,129,138,6,0,231,212,6,0,121,33,7,0,63,112,7,0,65,193,7,0,135,20,8,0,25,106,8,0,255,193,8,0,65,28,9,0,231,120,9,0,249,215,9,0,127,57,10,0,129,157,10,0,7,4,11,0,25,109,11,0,191,216,11,0,1,71,12,0,231,183,12,0,121,43,13,0,191,161,13,0,193,26,14,0,135,150,14,0,25,21,15,0,127,150,15,0,193,26,16,0,231,161,16,0,249,43,17,0,255,184,17,0,1,73,18,0,7,220,18,0,25,114,19,0,63,11,20,0,129,167,20,0,231,70,21,0,121,233,21,0,63,143,22,0,65,56,23,0,135,228,23,0,25,148,24,0,255,70,25,0,65,253,25,0,231,182,26,0,249,115,27,0,127,52,28,0,129,248,28,0,7,192,29,0,25,139,30,0,191,89,31,0,1,44,32,0,231,1,33,0,121,219,33,0,191,184,34,0,193,153,35,0,135,126,36,0,25,103,37,0,127,83,38,0,193,67,39,0,231,55,40,0,249,47,41,0,255,43,42,0,1,44,43,0,7,48,44,0,25,56,45,0,63,68,46,0,129,84,47,0,231,104,48,0,121,129,49,0,63,158,50,0,65,191,51,0,135,228,52,0,25,14,54,0,255,59,55,0,65,110,56,0,231,164,57,0,249,223,58,0,127,31,60,0,129,99,61,0,7,172,62,0,25,249,63,0,191,74,65,0,1,161,66,0,231,251,67,0,121,91,69,0,191,191,70,0,193,40,72,0,135,150,73,0,25,9,75,0,127,128,76,0,193,252,77,0,231,125,79,0,249,3,81,0,255,142,82,0,1,31,84,0,7,180,85,0,25,78,87,0,63,237,88,0,129,145,90,0,231,58,92,0,121,233,93,0,63,157,95,0,65,86,97,0,135,20,99,0,25,216,100,0,255,160,102,0,65,111,104,0,231,66,106,0,249,27,108,0,127,250,109,0,65,1,0,0,169,2,0,0,9,5,0,0,193,8,0,0,65,14,0,0,9,22,0,0,169,32,0,0,193,46,0,0,1,65,0,0,41,88,0,0,9,117,0,0,129,152,0,0,129,195,0,0,9,247,0,0,41,52,1,0,1,124,1,0,193,207,1,0,169,48,2,0,9,160,2,0,65,31,3,0,193,175,3,0,9,83,4,0,169,10,5,0,65,216,5,0,129,189,6,0,41,188,7,0,9,214,8,0,1,13,10,0,1,99,11,0,9,218,12,0,41,116,14,0,129,51,16,0,65,26,18,0,169,42,20,0,9,103,22,0,193,209,24,0,65,109,27,0,9,60,30,0,169,64,33,0,193,125,36,0,1,246,39,0,41,172,43,0,9,163,47,0,129,221,51,0,129,94,56,0,9,41,61,0,41,64,66,0,1,167,71,0,193,96,77,0,169,112,83,0,9,218,89,0,65,160,96,0,193,198,103,0,9,81,111,0,169,66,119,0,65,159,127,0,129,106,136,0,41,168,145,0,9,92,155,0,1,138,165,0,1,54,176,0,9,100,187,0,41,24,199,0,129,86,211,0,65,35,224,0,169,130,237,0,9,121,251,0,193,10,10,1,65,60,25,1,9,18,41,1,169,144,57,1,193,188,74,1,1,155,92,1,41,48,111,1,9,129,130,1,129,146,150,1,129,105,171,1,9,11,193,1,41,124,215,1,1,194,238,1,193,225,6,2,169,224,31,2,9,196,57,2,65,145,84,2,193,77,112,2,9,255,140,2,169,170,170,2,65,86,201,2,129,7,233,2,41,196,9,3,9,146,43,3,1,119,78,3,1,121,114,3,9,158,151,3,41,236,189,3,129,105,229,3,65,28,14,4,169,10,56,4,9,59,99,4,193,179,143,4,65,123,189,4,9,152,236,4,169,16,29,5,193,235,78,5,1,48,130,5,41,228,182,5,9,15,237,5,129,183,36,6,129,228,93,6,9,157,152,6,41,232,212,6,1,205,18,7,193,82,82,7,169,128,147,7,9,94,214,7,65,242,26,8,193,68,97,8,9,93,169,8,169,66,243,8,65,253,62,9,129,148,140,9,41,16,220,9,9,120,45,10,1,212,128,10,1,44,214,10,9,136,45,11,41,240,134,11,129,108,226,11,65,5,64,12,169,194,159,12,9,173,1,13,193,204,101,13,65,42,204,13,9,206,52,14,169,192,159,14,193,10,13,15,1,181,124,15,41,200,238,15,9,77,99,16,129,76,218,16,129,207,83,17,9,223,207,17,41,132,78,18,1,200,207,18,193,179,83,19,169,80,218,19,9,168,99,20,65,195,239,20,193,171,126,21,9,107,16,22,169,10,165,22,65,148,60,23,129,17,215,23,41,140,116,24,9,14,21,25,1,161,184,25,1,79,95,26,9,34,9,27,41,36,182,27,129,95,102,28,65,222,25,29,169,170,208,29,9,207,138,30,193,85,72,31,65,73,9,32,9,180,205,32,169,160,149,33,193,25,97,34,1,42,48,35,41,220,2,36,9,59,217,36,129,81,179,37,147,6,0,0,69,14,0,0,15,28,0,0,17,51,0,0,91,87,0,0,13,142,0,0,119,221,0,0,57,77,1,0,99,230,1,0,149,179,2,0,31,193,3,0,33,29,5,0,171,215,6,0,221,2,9,0,7,179,11,0,201,254,14,0,51,255,18,0,229,207,23,0,47,143,29,0,49,94,36,0,251,96,44,0,173,190,53,0,151,161,64,0,89,55,77,0,3,177,91,0,53,67,108,0,63,38,127,0,65,150,148,0,75,211,172,0,125,33,200,0,39,201,230,0,233,22,9,1,211,91,47,1,133,237,89,1,79,38,137,1,81,101,189,1,155,14,247,1,77,139,54,2,183,73,124,2,121,189,200,2,163,95,28,3,213,174,119,3,95,47,219,3,97,107,71,4,235,242,188,4,29,92,60,5,71,67,198,5,9,75,91,6,115,28,252,6,37,103,169,7,111,225,99,8,113,72,44,9,59,96,3,10,237,243,233,10,215,213,224,11,153,223,232,12,67,242,2,14,117,246,47,15,127,220,112,16,129,156,198,17,139,54,50,19,189,178,180,20,103,33,79,22,41,155,2,24,19,65,208,25,197,60,185,27,143,192,190,29,145,7,226,31,219,85,36,34,141,248,134,36,247,69,11,39,185,157,178,41,227,104,126,44,21,26,112,47,159,45,137,50,161,41,203,53,43,158,55,57,93,37,208,60,135,99,150,64,73,7,140,68,179,201,178,72,101,110,12,77,175,195,154,81,177,162,95,86,123,239,92,91,45,153,148,96,23,154,8,102,217,247,186,107,131,195,173,113,181,25,227,119,191,34,93,126,29,35,0,0,113,77,0,0,145,156,0,0,253,38,1,0,101,12,2,0,233,119,3,0,153,162,5,0,53,214,8,0,45,112,13,0,225,228,19,0,33,195,28,0,237,183,40,0,117,146,56,0,89,72,77,0,41,250,103,0,37,248,137,0,61,199,180,0,81,38,234,0,177,19,44,1,221,210,124,1,133,242,222,1,201,82,85,2,185,43,227,2,21,20,140,3,77,8,84,4,193,113,63,5,65,46,83,6,205,151,148,7,149,140,9,9,57,119,184,10,73,87,168,12,5,202,224,14,93,19,106,17,49,39,77,20,209,178,147,23,189,38,72,27,165,192,117,31,169,149,40,36,217,156,109,41,245,185,82,47,109,200,230,53,161,166,57,61,97,65,92,69,173,159,96,78,181,238,89,88,25,142,92,99,105,28,126,111,229,131,213,124,255,189,0,0,1,168,1,0,143,107,3,0,241,158,6,0,63,35,12,0,193,61,21,0,143,182,35,0,241,252,57,0,255,81,91,0,1,250,139,0,15,117,209,0,113,191,50,1,63,154,184,1,193,220,109,2,15,207,95,3,113,142,158,4,255,123,61,6,1,182,83,8,143,156,252,10,241,97,88,14,63,167,140,18,193,37,197,23,143,101,52,30,241,129,20,38,255,251,167,47,1,156,58,59,15,98,34,73,113,134,192,89,63,138,130,109,193,88,227,132,1,14,4,0,145,33,9,0,17,44,19,0,65,238,37,0,65,79,71,0,145,67,128,0,17,247,221,0,1,70,115,1,1,146,90,2,17,1,184,3,145,53,188,5,65,143,167,8,65,6,206,12,17,178,155,18,145,15,154,26,1,26,118,37,1,76,7,52,145,158,87,71,17,157,172,96,65,166,145,129,35,81,22,0,197,158,50,0,23,185,107,0,153,246,216,0,107,137,160,1,13,196,254,2,31,1,80,5,33,217,29,9,51,108,48,15,213,162,164,24,167,103,8,39,41,253,125,60,123,181,231,91,29,119,29,137,175,160,45,201,173,142,123,0,137,230,25,1,57,150,94,2,61,22,216,4,181,99,119,9,225,40,198,17,33,3,52,32,117,72,130,56,125,87,87,96,191,91,175,2,129,216,39,6,247,132,94,13,233,254,173,27,127,139,235,54,129,183,229,104,23,3,156,193,193,12,255,14,57,106,133,34,25,238,145,75,129,120,43,158,51,225,9,84,32,0,10,0,20,46,100,1,221,121,0,0,188,100,0,0,29,123,0,0,93,123,0,0,111,123,0,0,15,124,0,0,87,124,0,0,60,103,0,0,32,0,16,0,102,38,171,1,159,124,0,0,82,103,0,0,159,126,0,0,223,126,0,0,253,126,0,0,253,127,0,0,69,128,0,0,82,107,0,0,48,117,0,0,112,23,0,0,32,209,255,255,32,209,255,255,0,64,0,0,108,34,0,0,66,15,0,0,18,6,0,0,77,2,0,0,219,0,0,0,237,0,0,0,153,0,0,0,73,0,0,0,30,0,0,0,12,0,0,0,7,0,0,0,0,64,0,0,147,93,0,0,189,112,0,0,237,121,0,0,178,125,0,0,36,127,0,0,0,0,0,0,240,0,0,0,1,0,0,0,2,0,0,0,3,0,0,0,4,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,5,0,0,0,3,0,0,0,4,0,0,0,1,0,0,0,2,0,0,0,2,0,0,0,2,0,0,0,0,0,0,0,40,1,0,0,6,0,0,0,7,0,0,0,1,0,0,0,0,0,0,0,88,1,0,0,1,0,0,0,8,0,0,0,3,0,0,0,4,0,0,0,2,0,0,0,0,0,0,0,72,1,0,0,1,0,0,0,9,0,0,0,3,0,0,0,4,0,0,0,3,0,0,0,0,0,0,0,216,1,0,0,1,0,0,0,10,0,0,0,3,0,0,0,4,0,0,0,1,0,0,0,3,0,0,0,3,0,0,0,3,0,0,0,0,0,1,0,2,0,3,0,4,0,5,0,6,0,7,0,8,0,10,0,12,0,14,0,16,0,20,0,24,0,28,0,34,0,40,0,48,0,60,0,78,0,100,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,0,8,0,8,0,8,0,16,0,16,0,16,0,21,0,21,0,24,0,29,0,34,0,36,0,0,0,96,0,192,0,32,1,128,1,32,0,128,0,224,0,64,1,160,1,64,0,160,0,0,1,96,1,192,1,8,0,104,0,200,0,40,1,136,1,40,0,136,0,232,0,72,1,168,1,72,0,168,0,8,1,104,1,200,1,16,0,112,0,208,0,48,1,144,1,48,0,144,0,240,0,80,1,176,1,80,0,176,0,16,1,112,1,208,1,24,0,120,0,216,0,56,1,152,1,56,0,152,0,248,0,88,1,184,1,88,0,184,0,24,1,120,1,216,1,4,0,100,0,196,0,36,1,132,1,36,0,132,0,228,0,68,1,164,1,68,0,164,0,4,1,100,1,196,1,12,0,108,0,204,0,44,1,140,1,44,0,140,0,236,0,76,1,172,1,76,0,172,0,12,1,108,1,204,1,20,0,116,0,212,0,52,1,148,1,52,0,148,0,244,0,84,1,180,1,84,0,180,0,20,1,116,1,212,1,28,0,124,0,220,0,60,1,156,1,60,0,156,0,252,0,92,1,188,1,92,0,188,0,28,1,124,1,220,1,1,0,97,0,193,0,33,1,129,1,33,0,129,0,225,0,65,1,161,1,65,0,161,0,1,1,97,1,193,1,9,0,105,0,201,0,41,1,137,1,41,0,137,0,233,0,73,1,169,1,73,0,169,0,9,1,105,1,201,1,17,0,113,0,209,0,49,1,145,1,49,0,145,0,241,0,81,1,177,1,81,0,177,0,17,1,113,1,209,1,25,0,121,0,217,0,57,1,153,1,57,0,153,0,249,0,89,1,185,1,89,0,185,0,25,1,121,1,217,1,5,0,101,0,197,0,37,1,133,1,37,0,133,0,229,0,69,1,165,1,69,0,165,0,5,1,101,1,197,1,13,0,109,0,205,0,45,1,141,1,45,0,141,0,237,0,77,1,173,1,77,0,173,0,13,1,109,1,205,1,21,0,117,0,213,0,53,1,149,1,53,0,149,0,245,0,85,1,181,1,85,0,181,0,21,1,117,1,213,1,29,0,125,0,221,0,61,1,157,1,61,0,157,0,253,0,93,1,189,1,93,0,189,0,29,1,125,1,221,1,2,0,98,0,194,0,34,1,130,1,34,0,130,0,226,0,66,1,162,1,66,0,162,0,2,1,98,1,194,1,10,0,106,0,202,0,42,1,138,1,42,0,138,0,234,0,74,1,170,1,74,0,170,0,10,1,106,1,202,1,18,0,114,0,210,0,50,1,146,1,50,0,146,0,242,0,82,1,178,1,82,0,178,0,18,1,114,1,210,1,26,0,122,0,218,0,58,1,154,1,58,0,154,0,250,0,90,1,186,1,90,0,186,0,26,1,122,1,218,1,6,0,102,0,198,0,38,1,134,1,38,0,134,0,230,0,70,1,166,1,70,0,166,0,6,1,102,1,198,1,14,0,110,0,206,0,46,1,142,1,46,0,142,0,238,0,78,1,174,1,78,0,174,0,14,1,110,1,206,1,22,0,118,0,214,0,54,1,150,1,54,0,150,0,246,0,86,1,182,1,86,0,182,0,22,1,118,1,214,1,30,0,126,0,222,0,62,1,158,1,62,0,158,0,254,0,94,1,190,1,94,0,190,0,30,1,126,1,222,1,3,0,99,0,195,0,35,1,131,1,35,0,131,0,227,0,67,1,163,1,67,0,163,0,3,1,99,1,195,1,11,0,107,0,203,0,43,1,139,1,43,0,139,0,235,0,75,1,171,1,75,0,171,0,11,1,107,1,203,1,19,0,115,0,211,0,51,1,147,1,51,0,147,0,243,0,83,1,179,1,83,0,179,0,19,1,115,1,211,1,27,0,123,0,219,0,59,1,155,1,59,0,155,0,251,0,91,1,187,1,91,0,187,0,27,1,123,1,219,1,7,0,103,0,199,0,39,1,135,1,39,0,135,0,231,0,71,1,167,1,71,0,167,0,7,1,103,1,199,1,15,0,111,0,207,0,47,1,143,1,47,0,143,0,239,0,79,1,175,1,79,0,175,0,15,1,111,1,207,1,23,0,119,0,215,0,55,1,151,1,55,0,151,0,247,0,87,1,183,1,87,0,183,0,23,1,119,1,215,1,31,0,127,0,223,0,63,1,159,1,63,0,159,0,255,0,95,1,191,1,95,0,191,0,31,1,127,1,223,1,0,0,48,0,96,0,144,0,192,0,16,0,64,0,112,0,160,0,208,0,32,0,80,0,128,0,176,0,224,0,4,0,52,0,100,0,148,0,196,0,20,0,68,0,116,0,164,0,212,0,36,0,84,0,132,0,180,0,228,0,8,0,56,0,104,0,152,0,200,0,24,0,72,0,120,0,168,0,216,0,40,0,88,0,136,0,184,0,232,0,12,0,60,0,108,0,156,0,204,0,28,0,76,0,124,0,172,0,220,0,44,0,92,0,140,0,188,0,236,0,1,0,49,0,97,0,145,0,193,0,17,0,65,0,113,0,161,0,209,0,33,0,81,0,129,0,177,0,225,0,5,0,53,0,101,0,149,0,197,0,21,0,69,0,117,0,165,0,213,0,37,0,85,0,133,0,181,0,229,0,9,0,57,0,105,0,153,0,201,0,25,0,73,0,121,0,169,0,217,0,41,0,89,0,137,0,185,0,233,0,13,0,61,0,109,0,157,0,205,0,29,0,77,0,125,0,173,0,221,0,45,0,93,0,141,0,189,0,237,0,2,0,50,0,98,0,146,0,194,0,18,0,66,0,114,0,162,0,210,0,34,0,82,0,130,0,178,0,226,0,6,0,54,0,102,0,150,0,198,0,22,0,70,0,118,0,166,0,214,0,38,0,86,0,134,0,182,0,230,0,10,0,58,0,106,0,154,0,202,0,26,0,74,0,122,0,170,0,218,0,42,0,90,0,138,0,186,0,234,0,14,0,62,0,110,0,158,0,206,0,30,0,78,0,126,0,174,0,222,0,46,0,94,0,142,0,190,0,238,0,3,0,51,0,99,0,147,0,195,0,19,0,67,0,115,0,163,0,211,0,35,0,83,0,131,0,179,0,227,0,7,0,55,0,103,0,151,0,199,0,23,0,71,0,119,0,167,0,215,0,39,0,87,0,135,0,183,0,231,0,11,0,59,0,107,0,155,0,203,0,27,0,75,0,123,0,171,0,219,0,43,0,91,0,139,0,187,0,235,0,15,0,63,0,111,0,159,0,207,0,31,0,79,0,127,0,175,0,223,0,47,0,95,0,143,0,191,0,239,0,0,0,24,0,48,0,72,0,96,0,8,0,32,0,56,0,80,0,104,0,16,0,40,0,64,0,88,0,112,0,4,0,28,0,52,0,76,0,100,0,12,0,36,0,60,0,84,0,108,0,20,0,44,0,68,0,92,0,116,0,1,0,25,0,49,0,73,0,97,0,9,0,33,0,57,0,81,0,105,0,17,0,41,0,65,0,89,0,113,0,5,0,29,0,53,0,77,0,101,0,13,0,37,0,61,0,85,0,109,0,21,0,45,0,69,0,93,0,117,0,2,0,26,0,50,0,74,0,98,0,10,0,34,0,58,0,82,0,106,0,18,0,42,0,66,0,90,0,114,0,6,0,30,0,54,0,78,0,102,0,14,0,38,0,62,0,86,0,110,0,22,0,46,0,70,0,94,0,118,0,3,0,27,0,51,0,75,0,99,0,11,0,35,0,59,0,83,0,107,0,19,0,43,0,67,0,91,0,115,0,7,0,31,0,55,0,79,0,103,0,15,0,39,0,63,0,87,0,111,0,23,0,47,0,71,0,95,0,119,0,0,0,12,0,24,0,36,0,48,0,4,0,16,0,28,0,40,0,52,0,8,0,20,0,32,0,44,0,56,0,1,0,13,0,25,0,37,0,49,0,5,0,17,0,29,0,41,0,53,0,9,0,21,0,33,0,45,0,57,0,2,0,14,0,26,0,38,0,50,0,6,0,18,0,30,0,42,0,54,0,10,0,22,0,34,0,46,0,58,0,3,0,15,0,27,0,39,0,51,0,7,0,19,0,31,0,43,0,55,0,11,0,23,0,35,0,47,0,59,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0,41,0,41,0,41,0,82,0,82,0,123,0,164,0,200,0,222,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,41,0,41,0,41,0,41,0,123,0,123,0,123,0,164,0,164,0,240,0,10,1,27,1,39,1,41,0,41,0,41,0,41,0,41,0,41,0,41,0,41,0,123,0,123,0,123,0,123,0,240,0,240,0,240,0,10,1,10,1,49,1,62,1,72,1,80,1,123,0,123,0,123,0,123,0,123,0,123,0,123,0,123,0,240,0,240,0,240,0,240,0,49,1,49,1,49,1,62,1,62,1,87,1,95,1,102,1,108,1,240,0,240,0,240,0,240,0,240,0,240,0,240,0,240,0,49,1,49,1,49,1,49,1,87,1,87,1,87,1,95,1,95,1,114,1,120,1,126,1,131,1,18,0,29,0,38,0,40,0,46,0,52,0,62,0,84,0,92,202,190,216,182,223,154,226,156,230,120,236,122,244,204,252,52,3,134,11,136,19,100,25,102,29,74,32,66,39,164,53,100,0,240,0,32,0,100,0,205,60,0,48,0,32,42,175,213,201,207,255,64,0,17,0,99,255,97,1,16,254,163,0,39,43,189,86,217,255,6,0,91,0,86,255,186,0,23,0,128,252,192,24,216,77,237,255,220,255,102,0,167,255,232,255,72,1,73,252,8,10,37,62,135,199,61,201,64,0,128,0,134,255,36,0,54,1,0,253,72,2,51,36,69,69,12,0,128,0,18,0,114,255,32,1,139,255,159,252,27,16,123,56,104,2,13,200,246,255,39,0,58,0,210,255,172,255,120,0,184,0,197,254,227,253,4,5,4,21,64,35,230,62,198,196,243,255,0,0,20,0,26,0,5,0,225,255,213,255,252,255,65,0,90,0,7,0,99,255,8,255,212,255,81,2,47,6,52,10,199,12,228,87,5,197,3,0,242,255,236,255,241,255,2,0,25,0,37,0,25,0,240,255,185,255,149,255,177,255,50,0,36,1,111,2,214,3,8,5,184,5,148,107,103,196,17,0,12,0,8,0,1,0,246,255,234,255,226,255,224,255,234,255,3,0,44,0,100,0,168,0,243,0,61,1,125,1,173,1,199,1,189,0,168,253,105,2,103,119,117,0,97,255,210,251,8,116,52,0,221,0,168,246,116,110,252,255,17,2,234,242,229,102,208,255,246,2,140,240,165,93,176,255,137,3,117,239,6,83,157,255,204,3,130,239,102,71,149,255,199,3,139,240,39,59,153,255,128,3,97,242,174,46,165,255,5,3,207,244,94,34,185,255,99,2,161,247,152,22,210,255,169,1,161,250,180,11,0,64,202,69,27,76,255,82,130,90,179,98,162,107,96,117,184,126,154,121,154,121,102,102,184,126,51,115,81,11,10,9,10,9,10,9,239,8,239,8,10,9,252,8,23,9,239,8,72,11,20,10,90,9,63,9,10,9,226,8,226,8,226,8,226,8,146,8,183,9,36,9,36,9,10,9,10,9,10,9,36,9,36,9,63,9,50,9,144,12,206,10,36,9,36,9,10,9,226,8,173,8,159,8,213,8,146,8,156,9,170,9,63,9,90,9,90,9,90,9,90,9,63,9,103,9,10,9,151,13,240,11,79,8,159,8,226,8,226,8,226,8,239,8,10,9,213,8,210,12,69,12,20,10,90,9,199,8,173,8,159,8,146,8,146,8,66,8,0,16,5,15,173,8,60,10,60,10,103,9,10,9,90,9,63,9,26,8,106,12,172,12,63,9,173,8,249,9,130,9,36,9,10,9,119,8,173,8,10,13,160,13,166,10,146,8,213,8,156,9,50,9,63,9,159,8,53,8,50,9,116,9,23,9,63,9,90,9,116,9,116,9,116,9,156,9,63,9,195,14,45,14,130,9,223,9,63,9,226,8,226,8,252,8,159,8,0,8,182,12,153,12,153,10,30,11,143,9,23,9,252,8,252,8,226,8,79,8,191,12,228,12,193,10,246,10,143,9,213,8,213,8,199,8,79,8,53,8,57,11,165,11,73,10,63,9,103,9,50,9,146,8,199,8,199,8,66,8,153,12,125,12,73,10,20,10,226,8,133,8,199,8,173,8,173,8,93,8,106,12,238,12,180,10,103,9,226,8,226,8,226,8,239,8,146,8,66,8,69,12,200,12,156,9,13,8,239,8,196,9,63,9,183,9,130,9,133,8,179,13,210,12,10,9,140,10,87,10,170,9,63,9,90,9,36,9,79,8,95,13,207,13,222,11,240,11,252,8,158,7,173,8,226,8,226,8,226,8,76,13,38,13,39,8,127,10,57,11,50,9,116,9,226,8,170,9,236,9,176,14,160,13,158,7,100,10,81,11,223,9,90,9,63,9,156,9,213,8,212,11,200,12,180,10,72,11,180,10,106,8,79,8,239,8,186,8,199,8,111,14,73,14,233,7,177,7,100,10,140,10,20,10,196,9,23,9,63,9,135,12,85,13,50,9,26,8,72,11,72,11,36,9,183,9,199,8,119,8,10,13,38,13,30,11,220,10,23,9,106,8,226,8,239,8,66,8,13,8,23,9,252,8,133,8,119,8,133,8,63,9,73,10,140,10,140,10,249,9,103,9,130,9,173,8,213,8,173,8,173,8,36,9,116,9,47,10,140,10,222,11,172,12,246,10,72,11,170,9,26,8,252,8,10,9,50,9,76,9,173,8,106,8,79,8,239,8,196,9,233,10,233,10,60,10,20,10,63,9,92,14,129,14,186,8,46,7,133,8,193,10,166,10,113,10,209,9,159,8,233,10,88,12,166,10,249,9,30,11,209,9,133,8,90,9,173,8,133,8,250,0,3,0,6,0,3,0,3,0,3,0,4,0,3,0,3,0,3,0,205,1,73,14,109,11,109,11,109,11,109,11,109,11,109,11,109,11,109,11,109,11,109,11,109,11,147,11,147,11,109,11,30,11,144,12,13,12,156,11,240,11,240,11,194,11,194,11,194,11,147,11,147,11,194,11,156,11,72,11,30,11,30,11,166,10,80,15,174,15,165,11,135,12,135,12,118,11,240,11,30,11,50,12,172,12,109,11,30,11,60,10,249,9,220,10,109,11,188,13,125,12,194,11,31,12,203,11,72,11,109,11,109,11,109,11,109,11,72,11,72,11,72,11,72,11,72,11,193,10,190,19,190,19,118,11,245,13,57,13,240,11,13,12,233,10,88,12,88,12,156,11,30,11,209,9,236,9,193,10,72,11,76,17,53,16,140,10,193,10,156,11,194,11,109,11,30,11,165,11,203,11,109,11,109,11,109,11,109,11,72,11,166,10,36,14,203,11,156,11,240,11,240,11,57,11,246,10,240,11,144,12,231,11,165,11,219,12,219,12,165,11,238,12,175,11,107,20,150,19,236,9,10,13,198,13,57,13,125,12,22,12,48,13,165,11,140,10,87,10,127,10,233,10,30,11,113,10,217,19,54,20,7,18,76,17,156,9,81,11,231,11,135,12,97,12,127,10,180,10,72,11,30,11,233,10,30,11,140,10,50,12,72,11,147,11,109,11,109,11,109,11,109,11,147,11,147,11,147,11,147,11,109,11,109,11,147,11,147,11,147,11,106,16,135,12,165,11,31,12,194,11,72,11,72,11,109,11,156,11,57,11,100,11,203,11,156,11,194,11,125,12,57,11,176,14,176,14,172,12,31,12,165,11,72,11,109,11,72,11,156,11,118,11,233,10,233,10,30,11,72,11,72,11,100,10,14,15,174,15,135,12,50,12,172,12,118,11,231,11,147,11,147,11,13,12,30,11,233,10,233,10,233,10,233,10,20,10,5,15,240,15,29,13,188,13,22,12,180,10,194,11,118,11,50,12,13,12,30,11,30,11,87,10,87,10,30,11,246,10,27,20,30,19,153,12,5,15,113,13,97,12,81,11,85,13,123,13,140,10,20,10,113,10,180,10,30,11,246,10,193,10,13,16,205,14,219,12,88,12,109,11,72,11,72,11,109,11,233,10,180,10,233,10,180,10,233,10,30,11,72,11,246,10,217,19,190,19,231,11,217,13,172,12,240,11,13,12,128,11,31,12,81,11,180,10,180,10,180,10,30,11,233,10,60,10,213,16,213,16,44,11,223,9,135,12,48,13,48,13,3,12,3,12,48,13,240,11,30,11,87,10,20,10,166,10,193,10,240,11,100,11,246,10,72,11,180,10,127,10,81,11,31,12,78,12,78,12,144,12,97,12,240,11,194,11,147,11,30,11,23,17,42,15,109,11,72,11,30,11,72,11,30,11,30,11,72,11,72,11,72,11,30,11,72,11,109,11,72,11,30,11,165,11,100,11,100,11,165,11,165,11,240,11,50,12,144,12,78,12,240,11,194,11,156,11,156,11,156,11,109,11,180,10,133,16,53,16,238,12,19,13,109,11,147,11,72,11,165,11,165,11,30,11,233,10,180,10,30,11,30,11,30,11,233,10,240,15,174,15,31,12,194,11,109,11,109,11,109,11,72,11,109,11,109,11,30,11,30,11,30,11,233,10,72,11,220,10,7,18,223,17,97,12,113,13,135,12,165,11,81,11,222,11,50,12,180,10,127,10,127,10,127,10,180,10,233,10,140,10,53,16,173,16,205,14,73,14,166,10,220,10,72,11,72,11,194,11,156,11,109,11,30,11,127,10,127,10,233,10,72,11,119,16,226,13,193,10,30,11,30,11,72,11,72,11,72,11,109,11,109,11,72,11,109,11,109,11,109,11,147,11,72,11,54,20,57,19,213,8,104,13,205,14,151,13,19,13,30,11,238,12,151,13,78,12,81,11,156,9,183,9,193,10,109,11,123,13,101,14,50,12,125,12,29,13,231,11,135,12,135,12,165,11,144,12,13,12,109,11,109,11,127,10,236,9,130,9,165,11,194,11,233,10,233,10,180,10,233,10,30,11,156,11,240,11,31,12,78,12,78,12,78,12,31,12,194,11,194,11,128,11,57,11,127,10,166,10,220,10,194,11,104,13,217,13,29,13,172,12,240,11,194,11,147,11,109,11,72,11,30,11,203,11,128,11,81,11,194,11,194,11,156,11,203,11,31,12,240,11,240,11,194,11,72,11,30,11,109,11,109,11,72,11,80,15,127,15,194,11,125,12,29,13,144,12,219,12,219,12,151,13,120,14,113,13,166,10,133,8,156,9,20,10,47,10,100,0,3,0,40,0,3,0,3,0,3,0,5,0,14,0,14,0,10,0,11,0,3,0,8,0,9,0,7,0,3,0,91,1,0,32,254,31,246,31,234,31,216,31,194,31,168,31,136,31,98,31,58,31,10,31,216,30,160,30,98,30,34,30,220,29,144,29,66,29,238,28,150,28,58,28,216,27,114,27,10,27,156,26,42,26,180,25,58,25,188,24,60,24,182,23,46,23,160,22,16,22,126,21,232,20,78,20,176,19,16,19,110,18,200,17,30,17,116,16,198,15,22,15,100,14,174,13,248,12,64,12,132,11,200,10,10,10,74,9,138,8,198,7,2,7,62,6,120,5,178,4,234,3,34,3,90,2,146,1,202,0,0,0,54,255,110,254,166,253,222,252,22,252,78,251,136,250,194,249,254,248,58,248,118,247,182,246,246,245,56,245,124,244,192,243,8,243,82,242,156,241,234,240,58,240,140,239,226,238,56,238,146,237,240,236,80,236,178,235,24,235,130,234,240,233,96,233,210,232,74,232,196,231,68,231,198,230,76,230,214,229,100,229,246,228,142,228,40,228,198,227,106,227,18,227,190,226,112,226,36,226,222,225,158,225,96,225,40,225,246,224,198,224,158,224,120,224,88,224,62,224,40,224,22,224,10,224,2,224,0,224,79,112,117,115,83,99,114,105,112,116,72,97,110,100,108,101,114,0,95,101,110,99,111,100,101,0,95,100,101,99,111,100,101,0,49,55,79,112,117,115,83,99,114,105,112,116,72,97,110,100,108,101,114,0,80,49,55,79,112,117,115,83,99,114,105,112,116,72,97,110,100,108,101,114,0,80,75,49,55,79,112,117,115,83,99,114,105,112,116,72,97,110,100,108,101,114,0,105,105,0,118,0,118,105,0,105,105,105,105,105,0,105,105,105,105,105,105,105,0,105,105,105,105,105,105,0,0,255,0,255,0,255,0,255,0,255,0,254,1,0,1,255,0,254,0,253,2,0,1,255,0,254,0,253,3,0,1,255,117,110,107,110,111,119,110,32,101,114,114,111,114,0,115,117,99,99,101,115,115,0,105,110,118,97,108,105,100,32,97,114,103,117,109,101,110,116,0,98,117,102,102,101,114,32,116,111,111,32,115,109,97,108,108,0,105,110,116,101,114,110,97,108,32,101,114,114,111,114,0,99,111,114,114,117,112,116,101,100,32,115,116,114,101,97,109,0,114,101,113,117,101,115,116,32,110,111,116,32,105,109,112,108,101,109,101,110,116,101,100,0,105,110,118,97,108,105,100,32,115,116,97,116,101,0,109,101,109,111,114,121,32,97,108,108,111,99,97,116,105,111,110,32,102,97,105,108,101,100,0,255,255,156,110,86,70,59,51,45,40,37,33,31,28,26,25,23,22,21,20,19,18,17,16,16,15,15,14,13,13,12,12,12,12,11,11,11,10,10,10,9,9,9,9,9,9,8,8,8,8,8,7,7,7,7,7,7,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,25,23,2,0,126,124,119,109,87,41,19,9,4,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,90,80,75,69,63,56,49,40,34,29,20,18,10,0,0,0,0,0,0,0,0,110,100,90,84,78,71,65,58,51,45,39,32,26,20,12,0,0,0,0,0,0,118,110,103,93,86,80,75,70,65,59,53,47,40,31,23,15,4,0,0,0,0,126,119,112,104,95,89,83,78,72,66,60,54,47,39,32,25,17,12,1,0,0,134,127,120,114,103,97,91,85,78,72,66,60,54,47,41,35,29,23,16,10,1,144,137,130,124,113,107,101,95,88,82,76,70,64,57,51,45,39,33,26,15,1,152,145,138,132,123,117,111,105,98,92,86,80,74,67,61,55,49,43,36,20,1,162,155,148,142,133,127,121,115,108,102,96,90,84,77,71,65,59,53,46,30,1,172,165,158,152,143,137,131,125,118,112,106,100,94,87,81,75,69,63,56,45,20,200,200,200,200,200,200,200,200,198,193,188,183,178,173,168,163,158,153,148,129,104,40,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,40,15,23,28,31,34,36,38,39,41,42,43,44,45,46,47,47,49,50,51,52,53,54,55,55,57,58,59,60,61,62,63,63,65,66,67,68,69,70,71,71,40,20,33,41,48,53,57,61,64,66,69,71,73,75,76,78,80,82,85,87,89,91,92,94,96,98,101,103,105,107,108,110,112,114,117,119,121,123,124,126,128,40,23,39,51,60,67,73,79,83,87,91,94,97,100,102,105,107,111,115,118,121,124,126,129,131,135,139,142,145,148,150,153,155,159,163,166,169,172,174,177,179,35,28,49,65,78,89,99,107,114,120,126,132,136,141,145,149,153,159,165,171,176,180,185,189,192,199,205,211,216,220,225,229,232,239,245,251,21,33,58,79,97,112,125,137,148,157,166,174,182,189,195,201,207,217,227,235,243,251,17,35,63,86,106,123,139,152,165,177,187,197,206,214,222,230,237,250,25,31,55,75,91,105,117,128,138,146,154,161,168,174,180,185,190,200,208,215,222,229,235,240,245,255,16,36,65,89,110,128,144,159,173,185,196,207,217,226,234,242,250,11,41,74,103,128,151,172,191,209,225,241,255,9,43,79,110,138,163,186,207,227,246,12,39,71,99,123,144,164,182,198,214,228,241,253,9,44,81,113,142,168,192,214,235,255,7,49,90,127,160,191,220,247,6,51,95,134,170,203,234,7,47,87,123,155,184,212,237,6,52,97,137,174,208,240,5,57,106,151,192,231,5,59,111,158,202,243,5,55,103,147,187,224,5,60,113,161,206,248,4,65,122,175,224,4,67,127,182,234,224,224,224,224,224,224,224,224,160,160,160,160,185,185,185,178,178,168,134,61,37,224,224,224,224,224,224,224,224,240,240,240,240,207,207,207,198,198,183,144,66,40,160,160,160,160,160,160,160,160,185,185,185,185,193,193,193,183,183,172,138,64,38,240,240,240,240,240,240,240,240,207,207,207,207,204,204,204,193,193,180,143,66,40,185,185,185,185,185,185,185,185,193,193,193,193,193,193,193,183,183,172,138,65,39,207,207,207,207,207,207,207,207,204,204,204,204,201,201,201,188,188,176,141,66,40,193,193,193,193,193,193,193,193,193,193,193,193,194,194,194,184,184,173,139,65,39,204,204,204,204,204,204,204,204,201,201,201,201,198,198,198,187,187,175,140,66,40,72,127,65,129,66,128,65,128,64,128,62,128,64,128,64,128,92,78,92,79,92,78,90,79,116,41,115,40,114,40,132,26,132,26,145,17,161,12,176,10,177,11,24,179,48,138,54,135,54,132,53,134,56,133,55,132,55,132,61,114,70,96,74,88,75,88,87,74,89,66,91,67,100,59,108,50,120,40,122,37,97,43,78,50,83,78,84,81,88,75,86,74,87,71,90,73,93,74,93,74,109,40,114,36,117,34,117,34,143,17,145,18,146,19,162,12,165,10,178,7,189,6,190,8,177,9,23,178,54,115,63,102,66,98,69,99,74,89,71,91,73,91,78,89,86,80,92,66,93,64,102,59,103,60,104,60,117,52,123,44,138,35,133,31,97,38,77,45,61,90,93,60,105,42,107,41,110,45,116,38,113,38,112,38,124,26,132,27,136,19,140,20,155,14,159,16,158,18,170,13,177,10,187,8,192,6,175,9,159,10,21,178,59,110,71,86,75,85,84,83,91,66,88,73,87,72,92,75,98,72,105,58,107,54,115,52,114,55,112,56,129,51,132,40,150,33,140,29,98,35,77,42,42,121,96,66,108,43,111,40,117,44,123,32,120,36,119,33,127,33,134,34,139,21,147,23,152,20,158,25,154,26,166,21,173,16,184,13,184,10,150,13,139,15,22,178,63,114,74,82,84,83,92,82,103,62,96,72,96,67,101,73,107,72,113,55,118,52,125,52,118,52,117,55,135,49,137,39,157,32,145,29,97,33,77,40,2,1,0,0,8,13,16,19,21,23,24,26,27,28,29,30,31,32,32,33,34,34,35,36,36,37,37,224,112,44,15,3,2,1,0,254,237,192,132,70,23,4,0,255,252,226,155,61,11,2,0,250,245,234,203,71,50,42,38,35,33,31,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0,179,99,0,71,56,43,30,21,12,6,0,199,165,144,124,109,96,84,71,61,51,42,32,23,15,8,0,241,225,211,199,187,175,164,153,142,132,123,114,105,96,88,80,72,64,57,50,44,38,33,29,24,20,16,12,9,5,2,0,15,131,138,138,155,155,173,173,69,93,115,118,131,138,141,138,150,150,155,150,155,160,166,160,131,128,134,141,141,141,145,145,145,150,155,155,155,155,160,160,160,160,166,166,173,173,182,192,182,192,192,192,205,192,205,224,4,6,24,7,5,0,0,2,0,0,12,28,41,13,252,247,15,42,25,14,1,254,62,41,247,246,37,65,252,3,250,4,66,7,248,16,14,38,253,33,13,22,39,23,12,255,36,64,27,250,249,10,55,43,17,1,1,8,1,1,6,245,74,53,247,244,55,76,244,8,253,3,93,27,252,26,39,59,3,248,2,0,77,11,9,248,22,44,250,7,40,9,26,3,9,249,20,101,249,4,3,248,42,26,0,241,33,68,2,23,254,55,46,254,15,3,255,21,16,41,250,27,61,39,5,245,42,88,4,1,254,60,65,6,252,255,251,73,56,1,247,19,94,29,247,0,12,99,6,4,8,237,102,46,243,3,2,13,3,2,9,235,84,72,238,245,46,104,234,8,18,38,48,23,0,240,70,83,235,11,5,245,117,22,248,250,23,117,244,3,3,248,95,28,4,246,15,77,60,241,255,4,124,2,252,3,38,84,24,231,2,13,42,13,31,21,252,56,46,255,255,35,79,243,19,249,65,88,247,242,20,4,81,49,227,20,0,75,3,239,5,247,44,92,248,1,253,22,69,31,250,95,41,244,5,39,67,16,252,1,0,250,120,55,220,243,44,122,4,232,81,5,11,3,7,2,0,9,10,88,46,2,90,87,93,91,82,98,109,120,118,12,113,115,117,119,99,59,87,111,63,111,112,80,126,124,125,124,129,121,126,23,132,127,127,127,126,127,122,133,130,134,101,118,119,145,126,86,124,120,123,119,170,173,107,109,8,16,32,249,247,246,245,244,234,210,202,201,200,197,174,82,59,56,55,54,46,22,12,11,10,9,7,0,64,0,203,150,0,215,195,166,125,110,82,0,120,0,128,64,0,232,158,10,0,230,0,243,221,192,181,0,171,85,0,192,128,64,0,205,154,102,51,0,213,171,128,85,43,0,224,192,160,128,96,64,32,0,100,40,16,7,3,1,0,253,250,244,233,212,182,150,131,120,110,98,85,72,60,49,40,32,25,19,15,13,11,9,8,7,6,5,4,3,2,1,0,210,208,206,203,199,193,183,168,142,104,74,52,37,27,20,14,10,6,4,2,0,223,201,183,167,152,138,124,111,98,88,79,70,62,56,50,44,39,35,31,27,24,21,18,16,14,12,10,8,6,4,3,2,1,0,188,176,155,138,119,97,67,43,26,10,0,165,119,80,61,47,35,27,20,14,9,4,0,113,63,0,125,51,26,18,15,12,11,10,9,8,7,6,5,4,3,2,1,0,198,105,45,22,15,12,11,10,9,8,7,6,5,4,3,2,1,0,213,162,116,83,59,43,32,24,18,15,12,9,7,6,5,3,2,0,239,187,116,59,28,16,11,10,9,8,7,6,5,4,3,2,1,0,250,229,188,135,86,51,30,19,13,10,8,6,5,4,3,2,1,0,249,235,213,185,156,128,103,83,66,53,42,33,26,21,17,13,10,0,254,249,235,206,164,118,77,46,27,16,10,7,5,4,3,2,1,0,255,253,249,239,220,191,156,119,85,57,37,23,15,10,6,4,2,0,255,253,251,246,237,223,203,179,152,124,98,75,55,40,29,21,15,0,255,254,253,247,220,162,106,67,42,28,18,12,9,6,4,3,2,0,31,57,107,160,205,205,255,255,255,255,255,255,255,255,255,255,255,255,69,47,67,111,166,205,255,255,255,255,255,255,255,255,255,255,255,255,82,74,79,95,109,128,145,160,173,205,205,205,224,255,255,224,255,224,125,74,59,69,97,141,182,255,255,255,255,255,255,255,255,255,255,255,173,115,85,73,76,92,115,145,173,205,224,224,255,255,255,255,255,255,166,134,113,102,101,102,107,118,125,138,145,155,166,182,192,192,205,150,224,182,134,101,83,79,85,97,120,145,173,205,224,255,255,255,255,255,255,224,192,150,120,101,92,89,93,102,118,134,160,182,192,224,224,224,255,224,224,182,155,134,118,109,104,102,106,111,118,131,145,160,173,131,241,190,178,132,87,74,41,14,0,223,193,157,140,106,57,39,18,0,131,74,141,79,80,138,95,104,134,95,99,91,125,93,76,123,115,123,128,0,214,42,0,235,128,21,0,244,184,72,11,0,248,214,128,42,7,0,248,225,170,80,25,5,0,251,236,198,126,54,18,3,0,250,238,211,159,82,35,15,5,0,250,231,203,168,128,88,53,25,6,0,252,238,216,185,148,108,71,40,18,4,0,253,243,225,199,166,128,90,57,31,13,3,0,254,246,233,212,183,147,109,73,44,23,10,2,0,255,250,240,223,198,166,128,90,58,33,16,6,1,0,255,251,244,231,210,181,146,110,75,46,25,12,5,1,0,255,253,248,238,221,196,164,128,92,60,35,18,8,3,1,0,255,253,249,242,229,208,180,146,110,76,48,27,14,7,3,1,0,129,0,207,50,0,236,129,20,0,245,185,72,10,0,249,213,129,42,6,0,250,226,169,87,27,4,0,251,233,194,130,62,20,4,0,250,236,207,160,99,47,17,3,0,255,240,217,182,131,81,41,11,1,0,255,254,233,201,159,107,61,20,2,1,0,255,249,233,206,170,128,86,50,23,7,1,0,255,250,238,217,186,148,108,70,39,18,6,1,0,255,252,243,226,200,166,128,90,56,30,13,4,1,0,255,252,245,231],"i8",ALLOC_NONE,Runtime.GLOBAL_BASE+20480);allocate([209,180,146,110,76,47,25,11,4,1,0,255,253,248,237,219,194,163,128,93,62,37,19,8,3,1,0,255,254,250,241,226,205,177,145,111,79,51,30,15,6,2,1,0,129,0,203,54,0,234,129,23,0,245,184,73,10,0,250,215,129,41,5,0,252,232,173,86,24,3,0,253,240,200,129,56,15,2,0,253,244,217,164,94,38,10,1,0,253,245,226,189,132,71,27,7,1,0,253,246,231,203,159,105,56,23,6,1,0,255,248,235,213,179,133,85,47,19,5,1,0,255,254,243,221,194,159,117,70,37,12,2,1,0,255,254,248,234,208,171,128,85,48,22,8,2,1,0,255,254,250,240,220,189,149,107,67,36,16,6,2,1,0,255,254,251,243,227,201,166,128,90,55,29,13,5,2,1,0,255,254,252,246,234,213,183,147,109,73,43,22,10,4,2,1,0,130,0,200,58,0,231,130,26,0,244,184,76,12,0,249,214,130,43,6,0,252,232,173,87,24,3,0,253,241,203,131,56,14,2,0,254,246,221,167,94,35,8,1,0,254,249,232,193,130,65,23,5,1,0,255,251,239,211,162,99,45,15,4,1,0,255,251,243,223,186,131,74,33,11,3,1,0,255,252,245,230,202,158,105,57,24,8,2,1,0,255,253,247,235,214,179,132,84,44,19,7,2,1,0,255,254,250,240,223,196,159,112,69,36,15,6,2,1,0,255,254,253,245,231,209,176,136,93,55,27,11,3,2,1,0,255,254,253,252,239,221,194,158,117,76,42,18,4,3,2,1,0,0,0,2,5,9,14,20,27,35,44,54,65,77,90,104,119,135,254,49,67,77,82,93,99,198,11,18,24,31,36,45,255,46,66,78,87,94,104,208,14,21,32,42,51,66,255,94,104,109,112,115,118,248,53,69,80,88,95,102,6,0,3,0,7,3,0,1,10,0,2,6,18,10,12,4,0,2,0,0,0,9,4,7,4,0,3,12,7,7,0,1,1,1,2,3,3,3,2,3,3,3,2,3,3,3,0,3,12,15,48,51,60,63,192,195,204,207,240,243,252,255,12,35,60,83,108,132,157,180,206,228,15,32,55,77,101,125,151,175,201,225,19,42,66,89,114,137,162,184,209,230,12,25,50,72,97,120,147,172,200,223,26,44,69,90,114,135,159,180,205,225,13,22,53,80,106,130,156,180,205,228,15,25,44,64,90,115,142,168,196,222,19,24,62,82,100,120,145,168,190,214,22,31,50,79,103,120,151,170,203,227,21,29,45,65,106,124,150,171,196,224,30,49,75,97,121,142,165,186,209,229,19,25,52,70,93,116,143,166,192,219,26,34,62,75,97,118,145,167,194,217,25,33,56,70,91,113,143,165,196,223,21,34,51,72,97,117,145,171,196,222,20,29,50,67,90,117,144,168,197,221,22,31,48,66,95,117,146,168,196,222,24,33,51,77,116,134,158,180,200,224,21,28,70,87,106,124,149,170,194,217,26,33,53,64,83,117,152,173,204,225,27,34,65,95,108,129,155,174,210,225,20,26,72,99,113,131,154,176,200,219,34,43,61,78,93,114,155,177,205,229,23,29,54,97,124,138,163,179,209,229,30,38,56,89,118,129,158,178,200,231,21,29,49,63,85,111,142,163,193,222,27,48,77,103,133,158,179,196,215,232,29,47,74,99,124,151,176,198,220,237,33,42,61,76,93,121,155,174,207,225,29,53,87,112,136,154,170,188,208,227,24,30,52,84,131,150,166,186,203,229,37,48,64,84,104,118,156,177,201,230,212,178,148,129,108,96,85,82,79,77,61,59,57,56,51,49,48,45,42,41,40,38,36,34,31,30,21,12,10,3,1,0,255,245,244,236,233,225,217,203,190,176,175,161,149,136,125,114,102,91,81,71,60,52,43,35,28,20,19,18,12,11,5,0,179,138,140,148,151,149,153,151,163,116,67,82,59,92,72,100,89,92,16,0,0,0,0,99,66,36,36,34,36,34,34,34,34,83,69,36,52,34,116,102,70,68,68,176,102,68,68,34,65,85,68,84,36,116,141,152,139,170,132,187,184,216,137,132,249,168,185,139,104,102,100,68,68,178,218,185,185,170,244,216,187,187,170,244,187,187,219,138,103,155,184,185,137,116,183,155,152,136,132,217,184,184,170,164,217,171,155,139,244,169,184,185,170,164,216,223,218,138,214,143,188,218,168,244,141,136,155,170,168,138,220,219,139,164,219,202,216,137,168,186,246,185,139,116,185,219,185,138,100,100,134,100,102,34,68,68,100,68,168,203,221,218,168,167,154,136,104,70,164,246,171,137,139,137,155,218,219,139,255,254,253,238,14,3,2,1,0,255,254,252,218,35,3,2,1,0,255,254,250,208,59,4,2,1,0,255,254,246,194,71,10,2,1,0,255,252,236,183,82,8,2,1,0,255,252,235,180,90,17,2,1,0,255,248,224,171,97,30,4,1,0,255,254,236,173,95,37,7,1,0,255,255,255,131,6,145,255,255,255,255,255,236,93,15,96,255,255,255,255,255,194,83,25,71,221,255,255,255,255,162,73,34,66,162,255,255,255,210,126,73,43,57,173,255,255,255,201,125,71,48,58,130,255,255,255,166,110,73,57,62,104,210,255,255,251,123,65,55,68,100,171,255,7,23,38,54,69,85,100,116,131,147,162,178,193,208,223,239,13,25,41,55,69,83,98,112,127,142,157,171,187,203,220,236,15,21,34,51,61,78,92,106,126,136,152,167,185,205,225,240,10,21,36,50,63,79,95,110,126,141,157,173,189,205,221,237,17,20,37,51,59,78,89,107,123,134,150,164,184,205,224,240,10,15,32,51,67,81,96,112,129,142,158,173,189,204,220,236,8,21,37,51,65,79,98,113,126,138,155,168,179,192,209,218,12,15,34,55,63,78,87,108,118,131,148,167,185,203,219,236,16,19,32,36,56,79,91,108,118,136,154,171,186,204,220,237,11,28,43,58,74,89,105,120,135,150,165,180,196,211,226,241,6,16,33,46,60,75,92,107,123,137,156,169,185,199,214,225,11,19,30,44,57,74,89,105,121,135,152,169,186,202,218,234,12,19,29,46,57,71,88,100,120,132,148,165,182,199,216,233,17,23,35,46,56,77,92,106,123,134,152,167,185,204,222,237,14,17,45,53,63,75,89,107,115,132,151,171,188,206,221,240,9,16,29,40,56,71,88,103,119,137,154,171,189,205,222,237,16,19,36,48,57,76,87,105,118,132,150,167,185,202,218,236,12,17,29,54,71,81,94,104,126,136,149,164,182,201,221,237,15,28,47,62,79,97,115,129,142,155,168,180,194,208,223,238,8,14,30,45,62,78,94,111,127,143,159,175,192,207,223,239,17,30,49,62,79,92,107,119,132,145,160,174,190,204,220,235,14,19,36,45,61,76,91,108,121,138,154,172,189,205,222,238,12,18,31,45,60,76,91,107,123,138,154,171,187,204,221,236,13,17,31,43,53,70,83,103,114,131,149,167,185,203,220,237,17,22,35,42,58,78,93,110,125,139,155,170,188,206,224,240,8,15,34,50,67,83,99,115,131,146,162,178,193,209,224,239,13,16,41,66,73,86,95,111,128,137,150,163,183,206,225,241,17,25,37,52,63,75,92,102,119,132,144,160,175,191,212,231,19,31,49,65,83,100,117,133,147,161,174,187,200,213,227,242,18,31,52,68,88,103,117,126,138,149,163,177,192,207,223,239,16,29,47,61,76,90,106,119,133,147,161,176,193,209,224,240,15,21,35,50,61,73,86,97,110,119,129,141,175,198,218,237,225,204,201,184,183,175,158,154,153,135,119,115,113,110,109,99,98,95,79,68,52,50,48,45,43,32,31,27,18,10,3,0,255,251,235,230,212,201,196,182,167,166,163,151,138,124,110,104,90,78,76,70,69,57,45,34,24,21,11,6,5,4,3,0,175,148,160,176,178,173,174,164,177,174,196,182,198,192,182,68,62,66,60,72,117,85,90,118,136,151,142,160,142,155,0,0,0,0,0,0,0,1,100,102,102,68,68,36,34,96,164,107,158,185,180,185,139,102,64,66,36,34,34,0,1,32,208,139,141,191,152,185,155,104,96,171,104,166,102,102,102,132,1,0,0,0,0,16,16,0,80,109,78,107,185,139,103,101,208,212,141,139,173,153,123,103,36,0,0,0,0,0,0,1,48,0,0,0,0,0,0,32,68,135,123,119,119,103,69,98,68,103,120,118,118,102,71,98,134,136,157,184,182,153,139,134,208,168,248,75,189,143,121,107,32,49,34,34,34,0,17,2,210,235,139,123,185,137,105,134,98,135,104,182,100,183,171,134,100,70,68,70,66,66,34,131,64,166,102,68,36,2,1,0,134,166,102,68,34,34,66,132,212,246,158,139,107,107,87,102,100,219,125,122,137,118,103,132,114,135,137,105,171,106,50,34,164,214,141,143,185,151,121,103,192,34,0,0,0,0,0,1,208,109,74,187,134,249,159,137,102,110,154,118,87,101,119,101,0,2,0,36,36,66,68,35,96,164,102,100,36,0,2,33,167,138,174,102,100,84,2,2,100,107,120,119,36,197,24,0,255,254,253,244,12,3,2,1,0,255,254,252,224,38,3,2,1,0,255,254,251,209,57,4,2,1,0,255,254,244,195,69,4,2,1,0,255,251,232,184,84,7,2,1,0,255,254,240,186,86,14,2,1,0,255,254,239,178,91,30,5,1,0,255,248,227,177,100,19,2,1,0,255,255,255,156,4,154,255,255,255,255,255,227,102,15,92,255,255,255,255,255,213,83,24,72,236,255,255,255,255,150,76,33,63,214,255,255,255,190,121,77,43,55,185,255,255,255,245,137,71,43,59,139,255,255,255,255,131,66,50,66,107,194,255,255,166,116,76,55,53,125,255,255,0,15,8,7,4,11,12,3,2,13,10,5,6,9,14,1,0,9,6,3,4,5,8,1,2,7,0,1,0,0,0,1,0,0,1,255,1,255,2,254,2,254,3,253,0,1,0,1,255,2,255,2,254,3,254,3,253,7,254,7,0,2,255,255,255,0,0,1,1,0,1,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,255,2,1,0,1,1,0,0,255,255,0,0,1,255,0,1,255,0,255,1,254,2,254,254,2,253,2,3,253,252,3,252,4,4,251,5,250,251,6,249,6,5,8,247,0,0,1,0,0,0,0,0,0,0,255,1,0,0,1,255,0,1,255,255,1,255,2,1,255,2,254,254,2,254,2,2,3,253,0,1,0,0,0,0,0,0,1,0,1,0,0,1,255,1,0,0,2,1,255,2,255,255,2,255,2,2,255,3,254,254,254,3,0,1,0,0,1,0,1,255,2,255,2,255,2,3,254,3,254,254,4,4,253,5,253,252,6,252,6,5,251,8,250,251,249,9,251,8,255,6,255,6,252,10,250,10,254,6,255,6,251,10,247,12,253,7,254,7,249,13,16,24,34,118,111,105,100,0,98,111,111,108,0,99,104,97,114,0,115,105,103,110,101,100,32,99,104,97,114,0,117,110,115,105,103,110,101,100,32,99,104,97,114,0,115,104,111,114,116,0,117,110,115,105,103,110,101,100,32,115,104,111,114,116,0,105,110,116,0,117,110,115,105,103,110,101,100,32,105,110,116,0,108,111,110,103,0,117,110,115,105,103,110,101,100,32,108,111,110,103,0,102,108,111,97,116,0,100,111,117,98,108,101,0,78,83,116,51,95,95,49,49,50,98,97,115,105,99,95,115,116,114,105,110,103,73,99,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,99,69,69,78,83,95,57,97,108,108,111,99,97,116,111,114,73,99,69,69,69,69,0,78,83,116,51,95,95,49,50,49,95,95,98,97,115,105,99,95,115,116,114,105,110,103,95,99,111,109,109,111,110,73,76,98,49,69,69,69,0,115,116,100,58,58,115,116,114,105,110,103,0,78,83,116,51,95,95,49,49,50,98,97,115,105,99,95,115,116,114,105,110,103,73,104,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,104,69,69,78,83,95,57,97,108,108,111,99,97,116,111,114,73,104,69,69,69,69,0,115,116,100,58,58,98,97,115,105,99,95,115,116,114,105,110,103,60,117,110,115,105,103,110,101,100,32,99,104,97,114,62,0,78,83,116,51,95,95,49,49,50,98,97,115,105,99,95,115,116,114,105,110,103,73,119,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,119,69,69,78,83,95,57,97,108,108,111,99,97,116,111,114,73,119,69,69,69,69,0,115,116,100,58,58,119,115,116,114,105,110,103,0,78,49,48,101,109,115,99,114,105,112,116,101,110,51,118,97,108,69,0,101,109,115,99,114,105,112,116,101,110,58,58,118,97,108,0,78,49,48,101,109,115,99,114,105,112,116,101,110,49,49,109,101,109,111,114,121,95,118,105,101,119,73,99,69,69,0,101,109,115,99,114,105,112,116,101,110,58,58,109,101,109,111,114,121,95,118,105,101,119,60,99,104,97,114,62,0,78,49,48,101,109,115,99,114,105,112,116,101,110,49,49,109,101,109,111,114,121,95,118,105,101,119,73,97,69,69,0,101,109,115,99,114,105,112,116,101,110,58,58,109,101,109,111,114,121,95,118,105,101,119,60,115,105,103,110,101,100,32,99,104,97,114,62,0,78,49,48,101,109,115,99,114,105,112,116,101,110,49,49,109,101,109,111,114,121,95,118,105,101,119,73,104,69,69,0,101,109,115,99,114,105,112,116,101,110,58,58,109,101,109,111,114,121,95,118,105,101,119,60,117,110,115,105,103,110,101,100,32,99,104,97,114,62,0,78,49,48,101,109,115,99,114,105,112,116,101,110,49,49,109,101,109,111,114,121,95,118,105,101,119,73,115,69,69,0,101,109,115,99,114,105,112,116,101,110,58,58,109,101,109,111,114,121,95,118,105,101,119,60,115,104,111,114,116,62,0,78,49,48,101,109,115,99,114,105,112,116,101,110,49,49,109,101,109,111,114,121,95,118,105,101,119,73,116,69,69,0,101,109,115,99,114,105,112,116,101,110,58,58,109,101,109,111,114,121,95,118,105,101,119,60,117,110,115,105,103,110,101,100,32,115,104,111,114,116,62,0,78,49,48,101,109,115,99,114,105,112,116,101,110,49,49,109,101,109,111,114,121,95,118,105,101,119,73,105,69,69,0,101,109,115,99,114,105,112,116,101,110,58,58,109,101,109,111,114,121,95,118,105,101,119,60,105,110,116,62,0,78,49,48,101,109,115,99,114,105,112,116,101,110,49,49,109,101,109,111,114,121,95,118,105,101,119,73,106,69,69,0,101,109,115,99,114,105,112,116,101,110,58,58,109,101,109,111,114,121,95,118,105,101,119,60,117,110,115,105,103,110,101,100,32,105,110,116,62,0,78,49,48,101,109,115,99,114,105,112,116,101,110,49,49,109,101,109,111,114,121,95,118,105,101,119,73,108,69,69,0,101,109,115,99,114,105,112,116,101,110,58,58,109,101,109,111,114,121,95,118,105,101,119,60,108,111,110,103,62,0,78,49,48,101,109,115,99,114,105,112,116,101,110,49,49,109,101,109,111,114,121,95,118,105,101,119,73,109,69,69,0,101,109,115,99,114,105,112,116,101,110,58,58,109,101,109,111,114,121,95,118,105,101,119,60,117,110,115,105,103,110,101,100,32,108,111,110,103,62,0,101,109,115,99,114,105,112,116,101,110,58,58,109,101,109,111,114,121,95,118,105,101,119,60,105,110,116,56,95,116,62,0,101,109,115,99,114,105,112,116,101,110,58,58,109,101,109,111,114,121,95,118,105,101,119,60,117,105,110,116,56,95,116,62,0,101,109,115,99,114,105,112,116,101,110,58,58,109,101,109,111,114,121,95,118,105,101,119,60,105,110,116,49,54,95,116,62,0,101,109,115,99,114,105,112,116,101,110,58,58,109,101,109,111,114,121,95,118,105,101,119,60,117,105,110,116,49,54,95,116,62,0,101,109,115,99,114,105,112,116,101,110,58,58,109,101,109,111,114,121,95,118,105,101,119,60,105,110,116,51,50,95,116,62,0,101,109,115,99,114,105,112,116,101,110,58,58,109,101,109,111,114,121,95,118,105,101,119,60,117,105,110,116,51,50,95,116,62,0,78,49,48,101,109,115,99,114,105,112,116,101,110,49,49,109,101,109,111,114,121,95,118,105,101,119,73,102,69,69,0,101,109,115,99,114,105,112,116,101,110,58,58,109,101,109,111,114,121,95,118,105,101,119,60,102,108,111,97,116,62,0,78,49,48,101,109,115,99,114,105,112,116,101,110,49,49,109,101,109,111,114,121,95,118,105,101,119,73,100,69,69,0,101,109,115,99,114,105,112,116,101,110,58,58,109,101,109,111,114,121,95,118,105,101,119,60,100,111,117,98,108,101,62,0,78,49,48,101,109,115,99,114,105,112,116,101,110,49,49,109,101,109,111,114,121,95,118,105,101,119,73,101,69,69,0,101,109,115,99,114,105,112,116,101,110,58,58,109,101,109,111,114,121,95,118,105,101,119,60,108,111,110,103,32,100,111,117,98,108,101,62,0,78,49,48,95,95,99,120,120,97,98,105,118,49,50,48,95,95,115,105,95,99,108,97,115,115,95,116,121,112,101,95,105,110,102,111,69,0,78,49,48,95,95,99,120,120,97,98,105,118,49,49,54,95,95,115,104,105,109,95,116,121,112,101,95,105,110,102,111,69,0,83,116,57,116,121,112,101,95,105,110,102,111,0,78,49,48,95,95,99,120,120,97,98,105,118,49,49,55,95,95,99,108,97,115,115,95,116,121,112,101,95,105,110,102,111,69,0,83,116,57,101,120,99,101,112,116,105,111,110,0,83,116,57,98,97,100,95,97,108,108,111,99,0,115,116,100,58,58,98,97,100,95,97,108,108,111,99,0,78,49,48,95,95,99,120,120,97,98,105,118,49,49,57,95,95,112,111,105,110,116,101,114,95,116,121,112,101,95,105,110,102,111,69,0,78,49,48,95,95,99,120,120,97,98,105,118,49,49,55,95,95,112,98,97,115,101,95,116,121,112,101,95,105,110,102,111,69,0,78,49,48,95,95,99,120,120,97,98,105,118,49,50,51,95,95,102,117,110,100,97,109,101,110,116,97,108,95,116,121,112,101,95,105,110,102,111,69,0,118,0,68,110,0,98,0,99,0,104,0,97,0,115,0,116,0,105,0,106,0,108,0,109,0,102,0,100,0,78,49,48,95,95,99,120,120,97,98,105,118,49,50,49,95,95,118,109,105,95,99,108,97,115,115,95,116,121,112,101,95,105,110,102,111,69,0],"i8",ALLOC_NONE,Runtime.GLOBAL_BASE+30720);var tempDoublePtr=STATICTOP;STATICTOP+=16;function ___setErrNo(value){if(Module["___errno_location"])HEAP32[Module["___errno_location"]()>>2]=value;return value}var ERRNO_CODES={EPERM:1,ENOENT:2,ESRCH:3,EINTR:4,EIO:5,ENXIO:6,E2BIG:7,ENOEXEC:8,EBADF:9,ECHILD:10,EAGAIN:11,EWOULDBLOCK:11,ENOMEM:12,EACCES:13,EFAULT:14,ENOTBLK:15,EBUSY:16,EEXIST:17,EXDEV:18,ENODEV:19,ENOTDIR:20,EISDIR:21,EINVAL:22,ENFILE:23,EMFILE:24,ENOTTY:25,ETXTBSY:26,EFBIG:27,ENOSPC:28,ESPIPE:29,EROFS:30,EMLINK:31,EPIPE:32,EDOM:33,ERANGE:34,ENOMSG:42,EIDRM:43,ECHRNG:44,EL2NSYNC:45,EL3HLT:46,EL3RST:47,ELNRNG:48,EUNATCH:49,ENOCSI:50,EL2HLT:51,EDEADLK:35,ENOLCK:37,EBADE:52,EBADR:53,EXFULL:54,ENOANO:55,EBADRQC:56,EBADSLT:57,EDEADLOCK:35,EBFONT:59,ENOSTR:60,ENODATA:61,ETIME:62,ENOSR:63,ENONET:64,ENOPKG:65,EREMOTE:66,ENOLINK:67,EADV:68,ESRMNT:69,ECOMM:70,EPROTO:71,EMULTIHOP:72,EDOTDOT:73,EBADMSG:74,ENOTUNIQ:76,EBADFD:77,EREMCHG:78,ELIBACC:79,ELIBBAD:80,ELIBSCN:81,ELIBMAX:82,ELIBEXEC:83,ENOSYS:38,ENOTEMPTY:39,ENAMETOOLONG:36,ELOOP:40,EOPNOTSUPP:95,EPFNOSUPPORT:96,ECONNRESET:104,ENOBUFS:105,EAFNOSUPPORT:97,EPROTOTYPE:91,ENOTSOCK:88,ENOPROTOOPT:92,ESHUTDOWN:108,ECONNREFUSED:111,EADDRINUSE:98,ECONNABORTED:103,ENETUNREACH:101,ENETDOWN:100,ETIMEDOUT:110,EHOSTDOWN:112,EHOSTUNREACH:113,EINPROGRESS:115,EALREADY:114,EDESTADDRREQ:89,EMSGSIZE:90,EPROTONOSUPPORT:93,ESOCKTNOSUPPORT:94,EADDRNOTAVAIL:99,ENETRESET:102,EISCONN:106,ENOTCONN:107,ETOOMANYREFS:109,EUSERS:87,EDQUOT:122,ESTALE:116,ENOTSUP:95,ENOMEDIUM:123,EILSEQ:84,EOVERFLOW:75,ECANCELED:125,ENOTRECOVERABLE:131,EOWNERDEAD:130,ESTRPIPE:86};function _sysconf(name){switch(name){case 30:return PAGE_SIZE;case 85:return totalMemory/PAGE_SIZE;case 132:case 133:case 12:case 137:case 138:case 15:case 235:case 16:case 17:case 18:case 19:case 20:case 149:case 13:case 10:case 236:case 153:case 9:case 21:case 22:case 159:case 154:case 14:case 77:case 78:case 139:case 80:case 81:case 82:case 68:case 67:case 164:case 11:case 29:case 47:case 48:case 95:case 52:case 51:case 46:return 200809;case 79:return 0;case 27:case 246:case 127:case 128:case 23:case 24:case 160:case 161:case 181:case 182:case 242:case 183:case 184:case 243:case 244:case 245:case 165:case 178:case 179:case 49:case 50:case 168:case 169:case 175:case 170:case 171:case 172:case 97:case 76:case 32:case 173:case 35:return-1;case 176:case 177:case 7:case 155:case 8:case 157:case 125:case 126:case 92:case 93:case 129:case 130:case 131:case 94:case 91:return 1;case 74:case 60:case 69:case 70:case 4:return 1024;case 31:case 42:case 72:return 32;case 87:case 26:case 33:return 2147483647;case 34:case 1:return 47839;case 38:case 36:return 99;case 43:case 37:return 2048;case 0:return 2097152;case 3:return 65536;case 28:return 32768;case 44:return 32767;case 75:return 16384;case 39:return 1e3;case 89:return 700;case 71:return 256;case 40:return 255;case 2:return 100;case 180:return 64;case 25:return 20;case 5:return 16;case 6:return 6;case 73:return 4;case 84:{if(typeof navigator==="object")return navigator["hardwareConcurrency"]||1;return 1}}___setErrNo(ERRNO_CODES.EINVAL);return-1}function embind_init_charCodes(){var codes=new Array(256);for(var i=0;i<256;++i){codes[i]=String.fromCharCode(i)}embind_charCodes=codes}var embind_charCodes=undefined;function readLatin1String(ptr){var ret="";var c=ptr;while(HEAPU8[c]){ret+=embind_charCodes[HEAPU8[c++]]}return ret}var awaitingDependencies={};var registeredTypes={};var typeDependencies={};var char_0=48;var char_9=57;function makeLegalFunctionName(name){if(undefined===name){return"_unknown"}name=name.replace(/[^a-zA-Z0-9_]/g,"$");var f=name.charCodeAt(0);if(f>=char_0&&f<=char_9){return"_"+name}else{return name}}function createNamedFunction(name,body){name=makeLegalFunctionName(name);return(new Function("body","return function "+name+"() {\n"+' "use strict";'+" return body.apply(this, arguments);\n"+"};\n"))(body)}function extendError(baseErrorType,errorName){var errorClass=createNamedFunction(errorName,(function(message){this.name=errorName;this.message=message;var stack=(new Error(message)).stack;if(stack!==undefined){this.stack=this.toString()+"\n"+stack.replace(/^Error(:[^\n]*)?\n/,"")}}));errorClass.prototype=Object.create(baseErrorType.prototype);errorClass.prototype.constructor=errorClass;errorClass.prototype.toString=(function(){if(this.message===undefined){return this.name}else{return this.name+": "+this.message}});return errorClass}var BindingError=undefined;function throwBindingError(message){throw new BindingError(message)}var InternalError=undefined;function throwInternalError(message){throw new InternalError(message)}function whenDependentTypesAreResolved(myTypes,dependentTypes,getTypeConverters){myTypes.forEach((function(type){typeDependencies[type]=dependentTypes}));function onComplete(typeConverters){var myTypeConverters=getTypeConverters(typeConverters);if(myTypeConverters.length!==myTypes.length){throwInternalError("Mismatched type converter count")}for(var i=0;i0);info.refcount--;if(info.refcount===0){if(info.destructor){Runtime.dynCall("vi",info.destructor,[ptr])}delete EXCEPTIONS.infos[ptr];___cxa_free_exception(ptr)}}),clearRef:(function(ptr){if(!ptr)return;var info=EXCEPTIONS.infos[ptr];info.refcount=0})};function ___resumeException(ptr){if(!EXCEPTIONS.last){EXCEPTIONS.last=ptr}EXCEPTIONS.clearRef(EXCEPTIONS.deAdjust(ptr));throw ptr+" - Exception catching is disabled, this exception cannot be caught. Compile with -s DISABLE_EXCEPTION_CATCHING=0 or DISABLE_EXCEPTION_CATCHING=2 to catch."}function ___cxa_find_matching_catch(){var thrown=EXCEPTIONS.last;if(!thrown){return(asm["setTempRet0"](0),0)|0}var info=EXCEPTIONS.infos[thrown];var throwntype=info.type;if(!throwntype){return(asm["setTempRet0"](0),thrown)|0}var typeArray=Array.prototype.slice.call(arguments);var pointer=Module["___cxa_is_pointer_type"](throwntype);if(!___cxa_find_matching_catch.buffer)___cxa_find_matching_catch.buffer=_malloc(4);HEAP32[___cxa_find_matching_catch.buffer>>2]=thrown;thrown=___cxa_find_matching_catch.buffer;for(var i=0;i>2];info.adjusted=thrown;return(asm["setTempRet0"](typeArray[i]),thrown)|0}}thrown=HEAP32[thrown>>2];return(asm["setTempRet0"](throwntype),thrown)|0}function ___cxa_throw(ptr,type,destructor){EXCEPTIONS.infos[ptr]={ptr:ptr,adjusted:ptr,type:type,destructor:destructor,refcount:0};EXCEPTIONS.last=ptr;if(!("uncaught_exception"in __ZSt18uncaught_exceptionv)){__ZSt18uncaught_exceptionv.uncaught_exception=1}else{__ZSt18uncaught_exceptionv.uncaught_exception++}throw ptr+" - Exception catching is disabled, this exception cannot be caught. Compile with -s DISABLE_EXCEPTION_CATCHING=0 or DISABLE_EXCEPTION_CATCHING=2 to catch."}Module["_memset"]=_memset;function getShiftFromSize(size){switch(size){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+size)}}function __embind_register_bool(rawType,name,size,trueValue,falseValue){var shift=getShiftFromSize(size);name=readLatin1String(name);registerType(rawType,{name:name,"fromWireType":(function(wt){return!!wt}),"toWireType":(function(destructors,o){return o?trueValue:falseValue}),"argPackAdvance":8,"readValueFromPointer":(function(pointer){var heap;if(size===1){heap=HEAP8}else if(size===2){heap=HEAP16}else if(size===4){heap=HEAP32}else{throw new TypeError("Unknown boolean type size: "+name)}return this["fromWireType"](heap[pointer>>shift])}),destructorFunction:null})}function _abort(){Module["abort"]()}function _free(){}Module["_free"]=_free;function _malloc(bytes){var ptr=Runtime.dynamicAlloc(bytes+8);return ptr+8&4294967288}Module["_malloc"]=_malloc;function simpleReadValueFromPointer(pointer){return this["fromWireType"](HEAPU32[pointer>>2])}function __embind_register_std_string(rawType,name){name=readLatin1String(name);registerType(rawType,{name:name,"fromWireType":(function(value){var length=HEAPU32[value>>2];var a=new Array(length);for(var i=0;i>2]=length;for(var i=0;i255){_free(ptr);throwBindingError("String has UTF-16 code units that do not fit in 8 bits")}HEAPU8[ptr+4+i]=charCode}if(destructors!==null){destructors.push(_free,ptr)}return ptr}),"argPackAdvance":8,"readValueFromPointer":simpleReadValueFromPointer,destructorFunction:(function(ptr){_free(ptr)})})}function __embind_register_std_wstring(rawType,charSize,name){name=readLatin1String(name);var getHeap,shift;if(charSize===2){getHeap=(function(){return HEAPU16});shift=1}else if(charSize===4){getHeap=(function(){return HEAPU32});shift=2}registerType(rawType,{name:name,"fromWireType":(function(value){var HEAP=getHeap();var length=HEAPU32[value>>2];var a=new Array(length);var start=value+4>>shift;for(var i=0;i>2]=length;var start=ptr+4>>shift;for(var i=0;i>1]}:function readU16FromPointer(pointer){return HEAPU16[pointer>>1]};case 2:return signed?function readS32FromPointer(pointer){return HEAP32[pointer>>2]}:function readU32FromPointer(pointer){return HEAPU32[pointer>>2]};default:throw new TypeError("Unknown integer type: "+name)}}function __embind_register_integer(primitiveType,name,size,minRange,maxRange){name=readLatin1String(name);if(maxRange===-1){maxRange=4294967295}var shift=getShiftFromSize(size);var fromWireType=(function(value){return value});if(minRange===0){var bitshift=32-8*size;fromWireType=(function(value){return value<>>bitshift})}registerType(primitiveType,{name:name,"fromWireType":fromWireType,"toWireType":(function(destructors,value){if(typeof value!=="number"&&typeof value!=="boolean"){throw new TypeError('Cannot convert "'+_embind_repr(value)+'" to '+this.name)}if(valuemaxRange){throw new TypeError('Passing a number "'+_embind_repr(value)+'" from JS side to C/C++ side to an argument of type "'+name+'", which is outside the valid range ['+minRange+", "+maxRange+"]!")}return value|0}),"argPackAdvance":8,"readValueFromPointer":integerReadValueFromPointer(name,shift,minRange!==0),destructorFunction:null})}var emval_free_list=[];var emval_handle_array=[{},{value:undefined},{value:null},{value:true},{value:false}];function __emval_decref(handle){if(handle>4&&0===--emval_handle_array[handle].refcount){emval_handle_array[handle]=undefined;emval_free_list.push(handle)}}function count_emval_handles(){var count=0;for(var i=5;i>2;var heap=HEAPU32;var size=heap[handle];var data=heap[handle+1];return new TA(heap["buffer"],data,size)}name=readLatin1String(name);registerType(rawType,{name:name,"fromWireType":decodeMemoryView,"argPackAdvance":8,"readValueFromPointer":decodeMemoryView},{ignoreDuplicateRegistrations:true})}function floatReadValueFromPointer(name,shift){switch(shift){case 2:return(function(pointer){return this["fromWireType"](HEAPF32[pointer>>2])});case 3:return(function(pointer){return this["fromWireType"](HEAPF64[pointer>>3])});default:throw new TypeError("Unknown float type: "+name)}}function __embind_register_float(rawType,name,size){var shift=getShiftFromSize(size);name=readLatin1String(name);registerType(rawType,{name:name,"fromWireType":(function(value){return value}),"toWireType":(function(destructors,value){if(typeof value!=="number"&&typeof value!=="boolean"){throw new TypeError('Cannot convert "'+_embind_repr(value)+'" to '+this.name)}return value}),"argPackAdvance":8,"readValueFromPointer":floatReadValueFromPointer(name,shift),destructorFunction:null})}function _emscripten_memcpy_big(dest,src,num){HEAPU8.set(HEAPU8.subarray(src,src+num),dest);return dest}Module["_memcpy"]=_memcpy;function _llvm_stackrestore(p){var self=_llvm_stacksave;var ret=self.LLVM_SAVEDSTACKS[p];self.LLVM_SAVEDSTACKS.splice(p,1);Runtime.stackRestore(ret)}var _llvm_pow_f64=Math_pow;function _sbrk(bytes){var self=_sbrk;if(!self.called){DYNAMICTOP=alignMemoryPage(DYNAMICTOP);self.called=true;assert(Runtime.dynamicAlloc);self.alloc=Runtime.dynamicAlloc;Runtime.dynamicAlloc=(function(){abort("cannot dynamically allocate, sbrk now has control")})}var ret=DYNAMICTOP;if(bytes!=0){var success=self.alloc(bytes);if(!success)return-1>>>0}return ret}function _llvm_stacksave(){var self=_llvm_stacksave;if(!self.LLVM_SAVEDSTACKS){self.LLVM_SAVEDSTACKS=[]}self.LLVM_SAVEDSTACKS.push(Runtime.stackSave());return self.LLVM_SAVEDSTACKS.length-1}Module["_memmove"]=_memmove;function ___gxx_personality_v0(){}function heap32VectorToArray(count,firstElement){var array=[];for(var i=0;i>2)+i])}return array}function runDestructors(destructors){while(destructors.length){var ptr=destructors.pop();var del=destructors.pop();del(ptr)}}function __embind_register_class_constructor(rawClassType,argCount,rawArgTypesAddr,invokerSignature,invoker,rawConstructor){var rawArgTypes=heap32VectorToArray(argCount,rawArgTypesAddr);invoker=requireFunction(invokerSignature,invoker);whenDependentTypesAreResolved([],[rawClassType],(function(classType){classType=classType[0];var humanName="constructor "+classType.name;if(undefined===classType.registeredClass.constructor_body){classType.registeredClass.constructor_body=[]}if(undefined!==classType.registeredClass.constructor_body[argCount-1]){throw new BindingError("Cannot register multiple constructors with identical number of parameters ("+(argCount-1)+") for class '"+classType.name+"'! Overload resolution is currently only performed using the parameter count, not actual type info!")}classType.registeredClass.constructor_body[argCount-1]=function unboundTypeHandler(){throwUnboundTypeError("Cannot construct "+classType.name+" due to unbound types",rawArgTypes)};whenDependentTypesAreResolved([],rawArgTypes,(function(argTypes){classType.registeredClass.constructor_body[argCount-1]=function constructor_body(){if(arguments.length!==argCount-1){throwBindingError(humanName+" called with "+arguments.length+" arguments, expected "+(argCount-1))}var destructors=[];var args=new Array(argCount);args[0]=rawConstructor;for(var i=1;i>2]=ret}return ret}function _pthread_self(){return 0}function new_(constructor,argumentList){if(!(constructor instanceof Function)){throw new TypeError("new_ called with constructor type "+typeof constructor+" which is not a function")}var dummy=createNamedFunction(constructor.name||"unknownFunctionName",(function(){}));dummy.prototype=constructor.prototype;var obj=new dummy;var r=constructor.apply(obj,argumentList);return r instanceof Object?r:obj}function craftInvokerFunction(humanName,argTypes,classType,cppInvokerFunc,cppTargetFunc){var argCount=argTypes.length;if(argCount<2){throwBindingError("argTypes array size mismatch! Must at least get return value and 'this' types!")}var isClassMethodFunc=argTypes[1]!==null&&classType!==null;var argsList="";var argsListWired="";for(var i=0;i0?", ":"")+argsListWired}var returns=argTypes[0].name!=="void";invokerFnBody+=(returns?"var rv = ":"")+"invoker(fn"+(argsListWired.length>0?", ":"")+argsListWired+");\n";if(needsDestructorStack){invokerFnBody+="runDestructors(destructors);\n"}else{for(var i=isClassMethodFunc?1:2;i>2]|0;Xa=c[e+8>>2]|0;c[Ya>>2]=15;g[K>>2]=0.0;c[Ra>>2]=0;c[ba>>2]=0;Pa=c[e>>2]|0;Ua=Pa+8|0;db=c[Ua>>2]|0;I=c[Pa+4>>2]|0;Ia=Pa+32|0;wa=c[Ia>>2]|0;bb=c[e+32>>2]|0;cb=c[e+36>>2]|0;Da=(bb|0)!=0;g[Ga>>2]=0.0;if((l|0)<2|(f|0)==0){e=-1;i=eb;return e|0}U=e+28|0;n=_(c[U>>2]|0,h)|0;oa=Pa+44|0;Ba=Pa+36|0;h=c[Ba>>2]|0;xa=0;while(1){if((xa|0)>(h|0)){h=-1;za=631;break}if((c[oa>>2]<>2]<>2]|0;Ta=c[m+28>>2]|0;E=aa(Ta|0)|0;Sa=32-E|0;Ta=Ta>>>(Sa+-16|0);Ca=(Ta>>>12)+-8|0;E=Ma+(E+-32)|0;H=E+4>>3;Ca=(Ma<<3)-((Sa<<3)+(Ca+(Ta>>>0>(c[5272+(Ca<<2)>>2]|0)>>>0&1)))|0}l=(l|0)<1275?l:1275;q=l-H|0;ua=e+44|0;h=c[e+40>>2]|0;if(!(c[ua>>2]|0))if((h|0)==-1)za=13;else{Ta=_(h,n)|0;za=c[Pa>>2]|0;za=((Ta+((E|0)>1?E:0)+(za<<2)|0)/(za<<3|0)|0)-((c[e+48>>2]|0)!=0&1)|0;Ta=(l|0)<(za|0);l=((Ta?l:za)|0)<2?2:Ta?l:za;za=13}else if((h|0)==-1){h=-1;za=13}else{Ka=c[Pa>>2]|0;Ka=((_(h,n)|0)+(Ka>>4)|0)/(Ka>>3|0)|0;o=l;G=Ka>>6}if((za|0)==13){o=l;G=l-H|0;Ka=0}l=_((Xa*40|0)+20|0,(400>>>xa)+-50|0)|0;n=(o*400>>3-xa)-l|0;if((h|0)==-1)La=n;else{La=h-l|0;La=(n|0)<(La|0)?n:La}if(p){c[r>>2]=j;c[r+8>>2]=0;c[r+12>>2]=0;c[r+16>>2]=0;c[r+20>>2]=33;c[r+24>>2]=0;c[r+28>>2]=-2147483648;c[r+40>>2]=-1;c[r+32>>2]=0;c[r+36>>2]=0;c[r+4>>2]=o;c[r+44>>2]=0;Ta=r}else Ta=m;Aa=(Ka|0)>0;if(((Aa?(c[e+52>>2]|0)!=0:0)?(t=(E|0)==1?2:0,u=(Ka<<1)-(c[e+176>>2]|0)>>6,x=(t|0)>(u|0),((x?t:u)|0)<(q|0)):0)?(y=x?t:u,(y|0)<(q|0)):0){o=H+y|0;Ja=c[Ta>>2]|0;Sa=c[Ta+8>>2]|0;Ma=0-Sa|0;n=Ta+4|0;sf(Ja+o+Ma|0,Ja+(c[n>>2]|0)+Ma|0,Sa|0)|0;c[n>>2]=o;n=y}else n=q;F=o<<3;na=c[Pa+12>>2]|0;na=(cb|0)>(na|0)?na:cb;P=Oa+I|0;r=_(ab,P)|0;Sa=Fa()|0;T=i;i=i+((1*(r<<2)|0)+15&-16)|0;r=e+192|0;s=+g[r>>2];l=_(Xa,Oa-I|0)|0;q=c[U>>2]|0;l=(l|0)/(q|0)|0;h=0;v=0.0;w=0.0;while(1){if((h|0)>=(l|0))break;Ha=+g[f+(h<<2)>>2];h=h+1|0;v=v>Ha?v:Ha;w=w(v>Ha?v:Ha))){h=0;v=0.0;s=0.0;while(1){if((h|0)>=(l|0))break;Ha=+g[f+(h<<2)>>2];h=h+1|0;v=v>Ha?v:Ha;s=ss)s=v}p=f+(l<<2)|0;h=(_(Xa,I)|0)/(q|0)|0;l=0;v=0.0;w=0.0;while(1){if((l|0)>=(h|0))break;Ha=+g[p+(l<<2)>>2];l=l+1|0;v=v>Ha?v:Ha;w=wHa?v:Ha;g[r>>2]=Ha;s=s>Ha?s:Ha;pa=e+60|0;z=s<=1.0/+(1<>2]|0);D=z&1;if((E|0)==1){B=Ta+28|0;l=c[B>>2]|0;h=l>>>15;l=l-h|0;y=Ta+32|0;if(z)c[y>>2]=(c[y>>2]|0)+l;else h=l;c[B>>2]=h;r=Ta+36|0;C=Ta+20|0;j=Ta+40|0;m=Ta+24|0;t=Ta+8|0;u=Ta+4|0;x=Ta+44|0;while(1){if(h>>>0>=8388609)break;l=c[y>>2]|0;q=l>>>23;if((q|0)==255)c[r>>2]=(c[r>>2]|0)+1;else{p=l>>>31;h=c[j>>2]|0;if((h|0)>-1){l=c[m>>2]|0;if((l+(c[t>>2]|0)|0)>>>0<(c[u>>2]|0)>>>0){c[m>>2]=l+1;a[(c[Ta>>2]|0)+l>>0]=h+p;h=0}else h=-1;c[x>>2]=c[x>>2]|h}h=c[r>>2]|0;if(h|0){p=p+255&255;do{l=c[m>>2]|0;if((l+(c[t>>2]|0)|0)>>>0<(c[u>>2]|0)>>>0){c[m>>2]=l+1;a[(c[Ta>>2]|0)+l>>0]=p;l=0;h=c[r>>2]|0}else l=-1;c[x>>2]=c[x>>2]|l;h=h+-1|0;c[r>>2]=h}while((h|0)!=0)}c[j>>2]=q&255;l=c[y>>2]|0;h=c[B>>2]|0}c[y>>2]=l<<8&2147483392;h=h<<8;c[B>>2]=h;c[C>>2]=(c[C>>2]|0)+8}if(z){if(Aa){p=H+2|0;p=(o|0)<(p|0)?o:p;l=c[Ta>>2]|0;o=c[t>>2]|0;h=0-o|0;sf(l+p+h|0,l+(c[u>>2]|0)+h|0,o|0)|0;c[u>>2]=p;o=p;h=c[B>>2]|0;l=p;n=2;p=p<<3}else{l=G;p=F}E=o<<3;Ma=c[C>>2]|0;c[C>>2]=Ma+(E-(Ma+((aa(h|0)|0)+-32)));Ma=D}else{l=G;Ma=0;E=1;p=F}}else{l=G;Ma=0;p=F}z=e+16|0;B=Pa+16|0;C=Pa+20|0;D=Oa<<2;u=s>65536.0;y=0;do{r=u&(c[z>>2]|0)!=0;m=f+(y<<2)|0;t=T+((_(y,P)|0)<<2)+(I<<2)|0;j=c[U>>2]|0;x=e+160+(y<<2)|0;v=+g[B>>2];s=+g[x>>2];a:do if(+g[C>>2]==0.0){if((j|0)!=1){h=(Oa|0)/(j|0)|0;za=64;break}if(r){h=Oa;za=65}else{h=0;while(1){if((h|0)>=(Oa|0))break a;Ha=+g[m+((_(h,ab)|0)<<2)>>2]*32768.0;g[t+(h<<2)>>2]=Ha-s;h=h+1|0;s=v*Ha}}}else{h=(Oa|0)/(j|0)|0;if((j|0)==1)za=65;else za=64}while(0);if((za|0)==64){nf(t|0,0,D|0)|0;za=65}b:do if((za|0)==65){za=0;q=0;while(1){if((q|0)>=(h|0))break;g[t+((_(q,j)|0)<<2)>>2]=+g[m+((_(q,ab)|0)<<2)>>2]*32768.0;q=q+1|0}c:do if(r){q=0;while(1){if((q|0)>=(h|0)){h=0;break c}Ja=t+((_(q,j)|0)<<2)|0;Ha=+g[Ja>>2];va=Ha>65536.0;ya=Ha<-65536.0&(va^1);g[Ja>>2]=ya|va?(ya?-65536.0:65536.0):Ha;q=q+1|0}}else h=0;while(0);while(1){if((h|0)>=(Oa|0))break b;Ja=t+(h<<2)|0;Ha=+g[Ja>>2];g[Ja>>2]=Ha-s;h=h+1|0;s=v*Ha}}while(0);g[x>>2]=s;y=y+1|0}while((y|0)<(ab|0));ya=e+68|0;if((((c[ya>>2]|0)!=0&(n|0)>3|(n|0)>(Xa*12|0))&(Da^1)&(Ma|0)==0?(c[e+20>>2]|0)==0:0)?(c[e+24>>2]|0)>4:0){if((c[e+116>>2]|0)==0|(xa|0)==3)h=0;else h=(c[e+64>>2]|0)==5010;h=h^1}else h=0;la=e+100|0;Ja=c[la>>2]|0;h=Sc(e,T,J,ab,Oa,Ja,Ya,K,L,h&1,n)|0;Ha=+g[K>>2];if(!(Ha>.4000000059604645)?!(+g[e+108>>2]>.4000000059604645):0)va=0;else za=82;do if((za|0)==82){if(c[e+120>>2]|0?!(+g[e+124>>2]>.3):0){va=0;break}ga=+(c[Ya>>2]|0);ja=+(c[e+104>>2]|0);va=(ga>ja*1.26|ga(p|0))){m=Ta+28|0;h=c[m>>2]|0;h=h-(h>>>1)|0;c[m>>2]=h;t=Ta+32|0;u=Ta+36|0;x=Ta+20|0;y=Ta+40|0;z=Ta+24|0;B=Ta+8|0;C=Ta+4|0;D=Ta+44|0;while(1){if(h>>>0>=8388609)break d;q=c[t>>2]|0;j=q>>>23;if((j|0)==255)c[u>>2]=(c[u>>2]|0)+1;else{r=q>>>31;h=c[y>>2]|0;if((h|0)>-1){q=c[z>>2]|0;if((q+(c[B>>2]|0)|0)>>>0<(c[C>>2]|0)>>>0){c[z>>2]=q+1;a[(c[Ta>>2]|0)+q>>0]=h+r;h=0}else h=-1;c[D>>2]=c[D>>2]|h}h=c[u>>2]|0;if(h|0){r=r+255&255;do{q=c[z>>2]|0;if((q+(c[B>>2]|0)|0)>>>0<(c[C>>2]|0)>>>0){c[z>>2]=q+1;a[(c[Ta>>2]|0)+q>>0]=r;q=0;h=c[u>>2]|0}else q=-1;c[D>>2]=c[D>>2]|q;h=h+-1|0;c[u>>2]=h}while((h|0)!=0)}c[y>>2]=j&255;q=c[t>>2]|0;h=c[m>>2]|0}c[t>>2]=q<<8&2147483392;h=h<<8;c[m>>2]=h;c[x>>2]=(c[x>>2]|0)+8}}}else{D=Ta+28|0;q=c[D>>2]|0;h=q>>>1;E=Ta+32|0;q=(c[E>>2]|0)+(q-h)|0;c[E>>2]=q;c[D>>2]=h;F=Ta+36|0;G=Ta+20|0;H=Ta+40|0;I=Ta+24|0;f=Ta+8|0;J=Ta+4|0;K=Ta+44|0;while(1){if(h>>>0>=8388609)break;j=q>>>23;if((j|0)==255)c[F>>2]=(c[F>>2]|0)+1;else{r=q>>>31;h=c[H>>2]|0;if((h|0)>-1){q=c[I>>2]|0;if((q+(c[f>>2]|0)|0)>>>0<(c[J>>2]|0)>>>0){c[I>>2]=q+1;a[(c[Ta>>2]|0)+q>>0]=h+r;h=0}else h=-1;c[K>>2]=c[K>>2]|h}h=c[F>>2]|0;if(h|0){r=r+255&255;do{q=c[I>>2]|0;if((q+(c[f>>2]|0)|0)>>>0<(c[J>>2]|0)>>>0){c[I>>2]=q+1;a[(c[Ta>>2]|0)+q>>0]=r;q=0;h=c[F>>2]|0}else q=-1;c[K>>2]=c[K>>2]|q;h=h+-1|0;c[F>>2]=h}while((h|0)!=0)}c[H>>2]=j&255;q=c[E>>2]|0;h=c[D>>2]|0}q=q<<8&2147483392;c[E>>2]=q;h=h<<8;c[D>>2]=h;c[G>>2]=(c[G>>2]|0)+8}B=c[Ya>>2]|0;m=B+1|0;c[Ya>>2]=m;C=aa(m|0)|0;x=32-C|0;t=x+-5|0;r=(h>>>0)/6|0;if(!t)h=h-(_(r,10-x|0)|0)|0;else{q=q+(h-(_(r,11-x|0)|0))|0;c[E>>2]=q;h=r}c[D>>2]=h;while(1){if(h>>>0>=8388609)break;j=q>>>23;if((j|0)==255)c[F>>2]=(c[F>>2]|0)+1;else{r=q>>>31;h=c[H>>2]|0;if((h|0)>-1){q=c[I>>2]|0;if((q+(c[f>>2]|0)|0)>>>0<(c[J>>2]|0)>>>0){c[I>>2]=q+1;a[(c[Ta>>2]|0)+q>>0]=h+r;h=0}else h=-1;c[K>>2]=c[K>>2]|h}h=c[F>>2]|0;if(h|0){r=r+255&255;do{q=c[I>>2]|0;if((q+(c[f>>2]|0)|0)>>>0<(c[J>>2]|0)>>>0){c[I>>2]=q+1;a[(c[Ta>>2]|0)+q>>0]=r;q=0;h=c[F>>2]|0}else q=-1;c[K>>2]=c[K>>2]|q;h=h+-1|0;c[F>>2]=h}while((h|0)!=0)}c[H>>2]=j&255;q=c[E>>2]|0;h=c[D>>2]|0}q=q<<8&2147483392;c[E>>2]=q;h=h<<8;c[D>>2]=h;c[G>>2]=(c[G>>2]|0)+8}u=m-(16<>2]|0;z=Ta+16|0;j=c[z>>2]|0;if((j+x|0)>>>0>32){m=7-j|0;m=j+((m|0)>-8?m:-8)&-8;t=j;do{q=c[f>>2]|0;r=c[J>>2]|0;if(((c[I>>2]|0)+q|0)>>>0>>0){q=q+1|0;c[f>>2]=q;a[(c[Ta>>2]|0)+(r-q)>>0]=h;q=0}else q=-1;c[K>>2]=c[K>>2]|q;h=h>>>8;t=t+-8|0}while((t|0)>7);j=j+-8-m|0}h=h|u<>2]=h;c[z>>2]=q;r=(c[G>>2]|0)+x|0;c[G>>2]=r;c[Ya>>2]=B;u=c[L>>2]|0;if((q+3|0)>>>0>32){t=j+23|0;m=C+-24-j|0;m=j+((m|0)>-8?m:-8)+31-C&-8;do{r=c[f>>2]|0;j=c[J>>2]|0;if(((c[I>>2]|0)+r|0)>>>0>>0){r=r+1|0;c[f>>2]=r;a[(c[Ta>>2]|0)+(j-r)>>0]=h;r=0}else r=-1;c[K>>2]=c[K>>2]|r;h=h>>>8;q=q+-8|0}while((q|0)>7);r=c[G>>2]|0;q=t-C-m|0}c[y>>2]=h|u<>2]=q+3;r=r+3|0;c[G>>2]=r;h=c[D>>2]|0;q=h>>>2;if((Ja|0)>0){ta=d[29345+(Ja+-1)>>0]|0;sa=h-(_(q,ta)|0)|0;c[E>>2]=(c[E>>2]|0)+sa;q=_(q,ta-(d[29345+Ja>>0]|0)|0)|0}else q=h-(_(q,d[29345+Ja>>0]|0)|0)|0;c[D>>2]=q;h=r;while(1){if(q>>>0>=8388609)break d;r=c[E>>2]|0;j=r>>>23;if((j|0)==255)c[F>>2]=(c[F>>2]|0)+1;else{r=r>>>31;h=c[H>>2]|0;if((h|0)>-1){q=c[I>>2]|0;if((q+(c[f>>2]|0)|0)>>>0<(c[J>>2]|0)>>>0){c[I>>2]=q+1;a[(c[Ta>>2]|0)+q>>0]=h+r;h=0}else h=-1;c[K>>2]=c[K>>2]|h}h=c[F>>2]|0;if(h|0){r=r+255&255;do{q=c[I>>2]|0;if((q+(c[f>>2]|0)|0)>>>0<(c[J>>2]|0)>>>0){c[I>>2]=q+1;a[(c[Ta>>2]|0)+q>>0]=r;q=0;h=c[F>>2]|0}else q=-1;c[K>>2]=c[K>>2]|q;h=h+-1|0;c[F>>2]=h}while((h|0)!=0)}c[H>>2]=j&255;r=c[E>>2]|0;q=c[D>>2]|0;h=c[G>>2]|0}c[E>>2]=r<<8&2147483392;q=q<<8;c[D>>2]=q;h=h+8|0;c[G>>2]=h}}while(0);qa=e+24|0;if((c[qa>>2]|0)>0?(c[ya>>2]|0)==0:0)F=Tc(T,P,ab,Ga,ba)|0;else F=0;J=(xa|0)>0;e:do if(J?((c[Ta+20>>2]|0)+((aa(c[Ta+28>>2]|0)|0)+-32)+3|0)<=(p|0):0)if(F){C=(_(ab,Oa)|0)<<2;B=i;i=i+((1*C|0)+15&-16)|0;C=i;i=i+((1*(Wa<<2)|0)+15&-16)|0;D=i;i=i+((1*(Wa<<2)|0)+15&-16)|0;z=_(Xa,db)|0;E=i;i=i+((1*(z<<2)|0)+15&-16)|0;if((c[qa>>2]|0)>7){Uc(Pa,0,T,B,Xa,ab,xa,c[U>>2]|0);h=c[Ia>>2]|0;q=c[oa>>2]<=(na|0))break;t=b[h+(y<<1)>>1]|0;j=B+(r+(t<>1]|0)-t<=(t|0))break;ja=+g[j+(x<<2)>>2];x=x+1|0;s=s+ja*ja}ja=+O(+(s+1.0000000272452012e-27));g[C+(y+(_(u,c[Ua>>2]|0)|0)<<2)>>2]=ja;y=m}u=u+1|0}while((u|0)<(Xa|0));q=0;do{h=0;while(1){if((h|0)>=(na|0)){h=na;break}ta=h+(_(q,c[Ua>>2]|0)|0)|0;ja=+Y(+(+g[C+(ta<<2)>>2]))*1.4426950408889634;g[E+(ta<<2)>>2]=ja-+g[17220+(h<<2)>>2];h=h+1|0}while(1){if((h|0)>=(cb|0))break;g[E+((_(q,c[Ua>>2]|0)|0)+h<<2)>>2]=-14.0;h=h+1|0}q=q+1|0}while((q|0)<(Xa|0));s=+(xa|0)*.5;h=0;while(1){if((h|0)>=(z|0)){H=1;G=0;h=F;F=X;ta=0;break e}ta=E+(h<<2)|0;g[ta>>2]=+g[ta>>2]+s;h=h+1|0}}else{H=0;G=0;h=F;F=X;ta=0}}else{h=F;q=0;za=171}else{h=0;q=1;za=171}while(0);if((za|0)==171){C=(_(ab,Oa)|0)<<2;B=i;i=i+((1*C|0)+15&-16)|0;C=i;i=i+((1*(Wa<<2)|0)+15&-16)|0;D=i;i=i+((1*(Wa<<2)|0)+15&-16)|0;H=(_(Xa,db)|0)<<2;E=i;i=i+((1*H|0)+15&-16)|0;H=0;G=1;F=0;ta=q}Uc(Pa,F,T,B,Xa,ab,xa,c[U>>2]|0);sa=(ab|0)==2;if(sa&(Xa|0)==1)c[ba>>2]=0;q=c[Ia>>2]|0;r=c[oa>>2]<=(na|0))break;u=b[q+(z<<1)>>1]|0;m=B+(j+(u<>1]|0)-u<=(u|0))break;ja=+g[m+(y<<2)>>2];y=y+1|0;s=s+ja*ja}ja=+O(+(s+1.0000000272452012e-27));g[C+(z+(_(x,c[Ua>>2]|0)|0)<<2)>>2]=ja;z=t}x=x+1|0}while((x|0)<(Xa|0));x=(c[ya>>2]|0)==0;f:do if(x)r=0;else{q=2;while(1){if((q|0)>=(cb|0)){r=0;break f}ra=C+(q<<2)|0;ga=+g[ra>>2];ja=+g[C>>2]*9.999999747378752e-05;ja=ga>2]=ja>1.0000000036274937e-15?ja:1.0000000036274937e-15;q=q+1|0}}while(0);do{q=0;while(1){if((q|0)>=(na|0)){q=na;break}ra=q+(_(r,c[Ua>>2]|0)|0)|0;ja=+Y(+(+g[C+(ra<<2)>>2]))*1.4426950408889634;g[D+(ra<<2)>>2]=ja-+g[17220+(q<<2)>>2];q=q+1|0}while(1){if((q|0)>=(cb|0))break;g[D+((_(r,c[Ua>>2]|0)|0)+q<<2)>>2]=-14.0;q=q+1|0}r=r+1|0}while((r|0)<(Xa|0));ra=_(Xa,db)|0;R=i;i=i+((1*(ra<<2)|0)+15&-16)|0;nf(R|0,0,cb<<2|0)|0;if(!Da?(S=c[e+204>>2]|0,!((S|0)==0|x^1)):0){u=c[e+92>>2]|0;u=(u|0)<2?2:u;t=0;q=0;v=0.0;s=0.0;while(1){if((t|0)>=(Xa|0))break;m=_(db,t)|0;j=0;w=s;while(1){if((j|0)>=(u|0))break;s=+g[S+(m+j<<2)>>2];r=s<.25;do if(s>-2.0|r^1){if(r){if(!(s>0.0))break}else s=.25;s=s*.5}else s=-2.0;while(0);ia=j+1|0;ma=(b[wa+(ia<<1)>>1]|0)-(b[wa+(j<<1)>>1]|0)|0;q=q+ma|0;v=v+s*+((j<<1|1)-u|0);j=ia;w=w+s*+(ma|0)}t=t+1|0;s=w}s=s/+(q|0)+.20000000298023224;v=v*6.0/+(_(_(_(Xa,u+-1|0)|0,u+1|0)|0,u)|0)*.5;q=v<.03099999949336052;v=q?(q&!(v>-.03099999949336052)?-.03099999949336052:v):.03099999949336052;q=(b[wa+(u<<1)>>1]|0)/2|0;t=0;while(1){r=t+1|0;if((b[wa+(r<<1)>>1]|0)<(q|0))t=r;else break}j=(Xa|0)==2;q=0;m=0;while(1){if((m|0)>=(u|0))break;r=S+(m<<2)|0;if(j){ma=S+(db+m<<2)|0;r=+g[r>>2]>+g[ma>>2]?r:ma}w=+g[r>>2];w=(w<0.0?w:0.0)-(s+v*+(m-t|0));if(w>.25){g[R+(m<<2)>>2]=w+-.25;q=q+1|0}m=m+1|0}g:do if((q|0)>2){s=s+.25;if(s>0.0){nf(R|0,0,u<<2|0)|0;v=0.0;s=0.0;break}else q=0;while(1){if((q|0)>=(u|0))break g;ma=R+(q<<2)|0;ja=+g[ma>>2]+-.25;g[ma>>2]=ja<0.0?0.0:ja;q=q+1|0}}while(0);ja=s+.20000000298023224;W=v*64.0}else{ja=0.0;W=0.0}if(x){w=G?0.0:+(xa|0)*.5;q=(Xa|0)==2;v=-10.0;A=0.0;r=bb;while(1){if((r|0)>=(cb|0))break;ga=v+-1.0;s=+g[D+(r<<2)>>2]-w;s=ga>s?ga:s;do if(q){v=+g[D+(r+db<<2)>>2]-w;if(s>v)break;s=v}while(0);v=s;A=A+s;r=r+1|0}ma=e+208|0;Q=+g[ma>>2];ga=A/+(cb-bb|0)-Q;ha=ga<-1.5;ia=ga>3.0&(ha^1);ga=ia|ha?(ia?3.0:-1.5):ga;g[ma>>2]=Q+ga*.019999999552965164}else ga=0.0;if(!H)rf(E|0,D|0,ra<<2|0)|0;h:do if(J){f=Ta+20|0;r=c[f>>2]|0;I=Ta+28|0;q=c[I>>2]|0;do if((h|0)==0?(r+((aa(q|0)|0)+-32)+3|0)<=(p|0):0){if((c[qa>>2]|0)<=4){m=q;t=r;x=B;h=0;r=F;break}if(!x){m=q;t=r;x=B;h=0;r=F;break}if(Da){m=q;t=r;x=B;h=0;r=F;break}i:do if((Xa|0)==1){h=c[Za>>2]|0;c[V>>2]=h;s=(c[k>>2]=h,+g[k>>2]);h=0;while(1){h=h+1|0;if((h|0)>=(cb|0))break i;Q=+g[Za+(h<<2)>>2];Q=s+-1.0>Q?s+-1.0:Q;g[V+(h<<2)>>2]=Q;s=Q}}else{Q=+g[Za>>2];s=+g[Za+(db<<2)>>2];s=Q>s?Q:s;g[V>>2]=s;h=0;while(1){h=h+1|0;if((h|0)>=(cb|0))break i;A=+g[Za+(h<<2)>>2];Q=+g[Za+(h+db<<2)>>2];ma=A>Q;Q=s+-1.0>(ma?A:Q)?s+-1.0:ma?A:Q;g[V+(h<<2)>>2]=Q;s=Q}}while(0);h=cb+-2|0;while(1){if((h|0)<0)break;ma=V+(h<<2)|0;A=+g[ma>>2];Q=+g[V+(h+1<<2)>>2]+-1.0;g[ma>>2]=A>Q?A:Q;h=h+-1|0}h=cb+-1|0;r=0;s=0.0;do{q=_(r,db)|0;j=2;while(1){if((j|0)>=(h|0))break;A=+g[D+(j+q<<2)>>2];Q=+g[V+(j<<2)>>2];Q=(A<0.0?0.0:A)-(Q<0.0?0.0:Q);j=j+1|0;s=s+(Q<0.0?0.0:Q)}r=r+1|0}while((r|0)<(Xa|0));if(s/+(_(cb+-3|0,Xa)|0)>1.0){Uc(Pa,X,T,B,Xa,ab,xa,c[U>>2]|0);h=c[Ia>>2]|0;q=c[oa>>2]<=(na|0))break;t=b[h+(y<<1)>>1]|0;j=B+(r+(t<>1]|0)-t<=(t|0))break;Q=+g[j+(x<<2)>>2];x=x+1|0;s=s+Q*Q}Q=+O(+(s+1.0000000272452012e-27));g[C+(y+(_(u,c[Ua>>2]|0)|0)<<2)>>2]=Q;y=m}u=u+1|0}while((u|0)<(Xa|0));q=0;do{h=0;while(1){if((h|0)>=(na|0)){h=na;break}ma=h+(_(q,c[Ua>>2]|0)|0)|0;Q=+Y(+(+g[C+(ma<<2)>>2]))*1.4426950408889634;g[D+(ma<<2)>>2]=Q-+g[17220+(h<<2)>>2];h=h+1|0}while(1){if((h|0)>=(cb|0))break;g[D+((_(q,c[Ua>>2]|0)|0)+h<<2)>>2]=-14.0;h=h+1|0}q=q+1|0}while((q|0)<(Xa|0));s=+(xa|0)*.5;h=0;while(1){if((h|0)>=(ra|0))break;ma=E+(h<<2)|0;g[ma>>2]=+g[ma>>2]+s;h=h+1|0}g[Ga>>2]=.20000000298023224;q=B;h=1;r=X}else{q=B;h=0;r=F}m=c[I>>2]|0;t=c[f>>2]|0;x=q}else{m=q;t=r;x=B;r=F}while(0);if((t+((aa(m|0)|0)+-32)+3|0)>(p|0)){ma=h;$=r;break}j=m>>>3;q=m-j|0;H=Ta+32|0;if(h){c[H>>2]=(c[H>>2]|0)+q;q=j}c[I>>2]=q;u=Ta+36|0;y=Ta+40|0;z=Ta+24|0;B=Ta+8|0;F=Ta+4|0;G=Ta+44|0;j=t;while(1){if(q>>>0>=8388609){ma=h;$=r;break h}m=c[H>>2]|0;t=m>>>23;if((t|0)==255)c[u>>2]=(c[u>>2]|0)+1;else{m=m>>>31;q=c[y>>2]|0;if((q|0)>-1){j=c[z>>2]|0;if((j+(c[B>>2]|0)|0)>>>0<(c[F>>2]|0)>>>0){c[z>>2]=j+1;a[(c[Ta>>2]|0)+j>>0]=q+m;q=0}else q=-1;c[G>>2]=c[G>>2]|q}q=c[u>>2]|0;if(q|0){m=m+255&255;do{j=c[z>>2]|0;if((j+(c[B>>2]|0)|0)>>>0<(c[F>>2]|0)>>>0){c[z>>2]=j+1;a[(c[Ta>>2]|0)+j>>0]=m;j=0;q=c[u>>2]|0}else j=-1;c[G>>2]=c[G>>2]|j;q=q+-1|0;c[u>>2]=q}while((q|0)!=0)}c[y>>2]=t&255;m=c[H>>2]|0;q=c[I>>2]|0;j=c[f>>2]|0}c[H>>2]=m<<8&2147483392;q=q<<8;c[I>>2]=q;j=j+8|0;c[f>>2]=j}}else{x=B;ma=h;$=F}while(0);q=(_(Xa,Oa)|0)<<2;Z=i;i=i+((1*q|0)+15&-16)|0;q=c[Ia>>2]|0;r=c[oa>>2]<=(na|0))break;s=1.0/(+g[C+(h+(_(u,c[Ua>>2]|0)|0)<<2)>>2]+1.0000000272452012e-27);m=h+1|0;t=b[q+(m<<1)>>1]<>1]<=(t|0)){h=m;continue j}ia=h+j|0;g[Z+(ia<<2)>>2]=+g[x+(ia<<2)>>2]*s;h=h+1|0}}u=u+1|0;if((u|0)>=(Xa|0))break}X=i;i=i+((1*(db<<2)|0)+15&-16)|0;k:do if((l|0)<(Xa*15|0))if(Da&(l|0)<15){h=0;za=320}else{h=0;za=322}else{if(Da)if((l|0)<15){h=0;za=320;break}else{h=0;za=322;break}if((c[qa>>2]|0)<=1){h=0;za=322;break}if(c[ya>>2]|0){h=0;za=322;break}h=(1280/(l|0)|0)+2|0;h=Vc(Pa,na,ma,X,(h|0)<5?5:h,Z,Oa,xa,+g[Ga>>2],c[ba>>2]|0)|0;q=X+(na+-1<<2)|0;r=na;while(1){if((r|0)>=(cb|0))break k;c[X+(r<<2)>>2]=c[q>>2];r=r+1|0}}while(0);l:do if((za|0)==320)while(1){za=0;if((h|0)>=(cb|0)){h=ma;break l}c[X+(h<<2)>>2]=0;h=h+1|0;za=320}else if((za|0)==322)while(1){za=0;if((h|0)>=(cb|0)){h=0;break l}c[X+(h<<2)>>2]=ma;h=h+1|0;za=322}while(0);ha=i;i=i+((1*(ra<<2)|0)+15&-16)|0;m=0;do{q=_(m,db)|0;t=bb;while(1){if((t|0)>=(cb|0))break;r=t+q|0;j=D+(r<<2)|0;s=+g[j>>2];if(+N(+(s-+g[Za+(r<<2)>>2]))<2.0)g[j>>2]=s-+g[Va+(r<<2)>>2]*.25;t=t+1|0}m=m+1|0}while((m|0)<(Xa|0));qd(Pa,bb,cb,na,D,Za,p,ha,Ta,Xa,xa,n,c[e+12>>2]|0,e+84|0,(c[qa>>2]|0)>3&1,c[e+56>>2]|0,c[ya>>2]|0);da=Ta+4|0;q=c[da>>2]<<3;ea=Ta+20|0;m=c[ea>>2]|0;ia=Ta+28|0;j=c[ia>>2]|0;u=m+((aa(j|0)|0)+-32)|0;r=(ma|0)!=0;t=r?2:4;if(J)H=(u+t+1|0)>>>0<=q>>>0;else H=0;G=q-(H&1)|0;F=r?4:5;T=Ta+32|0;U=Ta+36|0;V=Ta+40|0;ba=Ta+24|0;ca=Ta+8|0;fa=Ta+44|0;x=0;B=bb;z=0;while(1){if((B|0)>=(cb|0))break;q=X+(B<<2)|0;if((u+t|0)>>>0>G>>>0){c[q>>2]=x;r=x;q=z}else{y=c[q>>2]|0;t=j>>>t;r=j-t|0;q=(y|0)==(x|0);if(!q)c[T>>2]=(c[T>>2]|0)+r;t=q?r:t;c[ia>>2]=t;q=m;while(1){if(t>>>0>=8388609)break;r=c[T>>2]|0;m=r>>>23;if((m|0)==255){c[U>>2]=(c[U>>2]|0)+1;j=t}else{j=r>>>31;q=c[V>>2]|0;if((q|0)>-1){r=c[ba>>2]|0;if((r+(c[ca>>2]|0)|0)>>>0<(c[da>>2]|0)>>>0){c[ba>>2]=r+1;a[(c[Ta>>2]|0)+r>>0]=q+j;q=0}else q=-1;c[fa>>2]=c[fa>>2]|q}q=c[U>>2]|0;if(q|0){j=j+255&255;do{r=c[ba>>2]|0;if((r+(c[ca>>2]|0)|0)>>>0<(c[da>>2]|0)>>>0){c[ba>>2]=r+1;a[(c[Ta>>2]|0)+r>>0]=j;r=0;q=c[U>>2]|0}else r=-1;c[fa>>2]=c[fa>>2]|r;q=q+-1|0;c[U>>2]=q}while((q|0)!=0)}c[V>>2]=m&255;r=c[T>>2]|0;j=c[ia>>2]|0;q=c[ea>>2]|0}c[T>>2]=r<<8&2147483392;t=j<<8;c[ia>>2]=t;q=q+8|0;c[ea>>2]=q}m=q;j=t;r=y;u=q+((aa(t|0)|0)+-32)|0;q=z|y}x=r;B=B+1|0;t=F;z=q}t=ma<<2;do if(H){if((a[t+z+(27892+(xa<<3))>>0]|0)==(a[(t|2)+z+(27892+(xa<<3))>>0]|0)){h=0;q=j;break}q=j>>>1;r=j-q|0;if(!h)q=r;else c[T>>2]=(c[T>>2]|0)+r;c[ia>>2]=q;r=m;while(1){if(q>>>0>=8388609)break;j=c[T>>2]|0;m=j>>>23;if((m|0)==255)c[U>>2]=(c[U>>2]|0)+1;else{j=j>>>31;q=c[V>>2]|0;if((q|0)>-1){r=c[ba>>2]|0;if((r+(c[ca>>2]|0)|0)>>>0<(c[da>>2]|0)>>>0){c[ba>>2]=r+1;a[(c[Ta>>2]|0)+r>>0]=q+j;q=0}else q=-1;c[fa>>2]=c[fa>>2]|q}q=c[U>>2]|0;if(q|0){j=j+255&255;do{r=c[ba>>2]|0;if((r+(c[ca>>2]|0)|0)>>>0<(c[da>>2]|0)>>>0){c[ba>>2]=r+1;a[(c[Ta>>2]|0)+r>>0]=j;r=0;q=c[U>>2]|0}else r=-1;c[fa>>2]=c[fa>>2]|r;q=q+-1|0;c[U>>2]=q}while((q|0)!=0)}c[V>>2]=m&255;j=c[T>>2]|0;q=c[ia>>2]|0;r=c[ea>>2]|0}c[T>>2]=j<<8&2147483392;q=q<<8;c[ia>>2]=q;r=r+8|0;c[ea>>2]=r}h=h<<1;m=r}else{h=0;q=j}while(0);h=t+h|0;r=bb;while(1){if((r|0)>=(cb|0))break;S=X+(r<<2)|0;c[S>>2]=a[h+(c[S>>2]|0)+(27892+(xa<<3))>>0];r=r+1|0}m:do if((m+((aa(q|0)|0)+-32)+4|0)<=(p|0)){n:do if(!(c[ya>>2]|0)){o:do if(Da){if(!(c[qa>>2]|0)){c[e+80>>2]=0;za=415;break}h=e+80|0;if(!ma){c[h>>2]=3;h=3;za=414;break n}else{c[h>>2]=2;h=2;za=414;break n}}else{h=c[qa>>2]|0;do if(!$){if((h|0)<3|(n|0)<(Xa*10|0))break;K=e+88|0;P=e+80|0;L=c[P>>2]|0;J=e+96|0;f=c[Ia>>2]|0;G=c[oa>>2]<>1]|0)-(b[f+(na+-1<<1)>>1]|0)<>2]=0;h=0;n=q>>>5;break o}else{I=0;h=0;n=0;r=0}do{H=_(I,G)|0;F=0;while(1){if((F|0)>=(na|0))break;x=b[f+(F<<1)>>1]|0;j=Z+(x<>1]|0)-x<>2];Q=Q*Q*s;t=t+1|0;y=y+(Q<.25&1)|0;z=z+(Q<.015625&1)|0;B=B+(Q<.0625&1)|0}if((F|0)>((c[Ua>>2]|0)+-4|0))h=h+((B+y<<5>>>0)/(x>>>0)|0)|0;F=u;n=n+1|0;r=r+(((z<<1|0)>=(x|0)&1)+((B<<1|0)>=(x|0)&1)+((y<<1|0)>=(x|0)&1)<<8)|0}I=I+1|0}while((I|0)<(Xa|0));if(!ka){if(!h)h=0;else h=(h>>>0)/((_(4-(c[Ua>>2]|0)+na|0,Xa)|0)>>>0)|0;h=(c[J>>2]|0)+h>>1;c[J>>2]=h;switch(c[la>>2]|0){case 2:{h=h+4|0;break}case 0:{h=h+-4|0;break}default:{}}c[la>>2]=(h|0)>22?2:(h|0)>18&1}h=((r>>>0)/(n>>>0)|0)+(c[K>>2]|0)>>1;c[K>>2]=h;h=(h*3|0)+(3-L<<7|64)+2>>2;do if((h|0)>=80){if((h|0)<256){h=2;break}h=(h|0)<384&1;c[P>>2]=h;n=q>>>5;if((h|0)>0){za=418;break n}else break o}else h=3;while(0);c[P>>2]=h;n=q>>>5;za=418;break n}while(0);n=e+80|0;if(!h){c[n>>2]=0;za=415;break}else{c[n>>2]=2;h=2;za=414;break n}}while(0);if((za|0)==415){h=0;n=q>>>5}h=q-(_(n,d[28203+h>>0]|0)|0)|0}else{c[la>>2]=0;c[e+80>>2]=2;h=2;za=414}while(0);if((za|0)==414){n=q>>>5;za=418}if((za|0)==418){oa=d[28203+(h+-1)>>0]|0;na=q-(_(n,oa)|0)|0;c[T>>2]=(c[T>>2]|0)+na;h=_(n,oa-(d[28203+h>>0]|0)|0)|0}c[ia>>2]=h;n=m;while(1){if(h>>>0>=8388609)break m;q=c[T>>2]|0;r=q>>>23;if((r|0)==255)c[U>>2]=(c[U>>2]|0)+1;else{q=q>>>31;h=c[V>>2]|0;if((h|0)>-1){n=c[ba>>2]|0;if((n+(c[ca>>2]|0)|0)>>>0<(c[da>>2]|0)>>>0){c[ba>>2]=n+1;a[(c[Ta>>2]|0)+n>>0]=h+q;h=0}else h=-1;c[fa>>2]=c[fa>>2]|h}h=c[U>>2]|0;if(h|0){q=q+255&255;do{n=c[ba>>2]|0;if((n+(c[ca>>2]|0)|0)>>>0<(c[da>>2]|0)>>>0){c[ba>>2]=n+1;a[(c[Ta>>2]|0)+n>>0]=q;n=0;h=c[U>>2]|0}else n=-1;c[fa>>2]=c[fa>>2]|n;h=h+-1|0;c[U>>2]=h}while((h|0)!=0)}c[V>>2]=r&255;q=c[T>>2]|0;h=c[ia>>2]|0;n=c[ea>>2]|0}c[T>>2]=q<<8&2147483392;h=h<<8;c[ia>>2]=h;n=n+8|0;c[ea>>2]=n}}while(0);S=i;i=i+((1*(db<<2)|0)+15&-16)|0;H=e+52|0;Q=+Wc(D,E,db,bb,cb,Xa,S,c[pa>>2]|0,c[Pa+56>>2]|0,ma,c[ua>>2]|0,c[H>>2]|0,wa,xa,l,Ea,c[ya>>2]|0,R);if(c[ya>>2]|0)c[S>>2]=(l|0)>26?8:(l|0)/3|0;I=i;i=i+((1*(db<<2)|0)+15&-16)|0;h=c[Ua>>2]|0;l=(xa<<1)+Xa+-1|0;n=Pa+104|0;q=0;while(1){if((q|0)>=(h|0))break;ua=q+1|0;pa=c[Ia>>2]|0;oa=(_(h,l)|0)+q|0;c[I+(q<<2)>>2]=(_(_((d[(c[n>>2]|0)+oa>>0]|0)+64|0,Xa)|0,(b[pa+(ua<<1)>>1]|0)-(b[pa+(q<<1)>>1]|0)<>2;q=ua}E=p<<3;pa=c[ea>>2]|0;h=c[ia>>2]|0;ua=32-(aa(h|0)|0)|0;F=h>>>(ua+-16|0);y=(F>>>12)+-8|0;l=pa;n=6;p=bb;y=(pa<<3)-((ua<<3)+(y+(F>>>0>(c[5272+(y<<2)>>2]|0)>>>0&1)))|0;F=0;while(1){if((p|0)>=(cb|0))break;B=p+1|0;j=(_(Xa,(b[wa+(B<<1)>>1]|0)-(b[wa+(p<<1)>>1]|0)|0)|0)<=(E-z|0))break;if((u|0)>=(c[m>>2]|0))break;r=(t|0)<(c[x>>2]|0);p=h>>>p;h=h-p|0;if(r){c[T>>2]=(c[T>>2]|0)+h;h=p}c[ia>>2]=h;while(1){if(h>>>0>=8388609)break;p=c[T>>2]|0;q=p>>>23;if((q|0)==255)c[U>>2]=(c[U>>2]|0)+1;else{p=p>>>31;h=c[V>>2]|0;if((h|0)>-1){l=c[ba>>2]|0;if((l+(c[ca>>2]|0)|0)>>>0<(c[da>>2]|0)>>>0){c[ba>>2]=l+1;a[(c[Ta>>2]|0)+l>>0]=h+p;h=0}else h=-1;c[fa>>2]=c[fa>>2]|h}h=c[U>>2]|0;if(h|0){p=p+255&255;do{l=c[ba>>2]|0;if((l+(c[ca>>2]|0)|0)>>>0<(c[da>>2]|0)>>>0){c[ba>>2]=l+1;a[(c[Ta>>2]|0)+l>>0]=p;l=0;h=c[U>>2]|0}else l=-1;c[fa>>2]=c[fa>>2]|l;h=h+-1|0;c[U>>2]=h}while((h|0)!=0)}c[V>>2]=q&255;p=c[T>>2]|0;h=c[ia>>2]|0;l=c[ea>>2]|0}c[T>>2]=p<<8&2147483392;h=h<<8;c[ia>>2]=h;l=l+8|0;c[ea>>2]=l}pa=32-(aa(h|0)|0)|0;ua=h>>>(pa+-16|0);q=(ua>>>12)+-8|0;q=(l<<3)-((pa<<3)+(q+(ua>>>0>(c[5272+(q<<2)>>2]|0)>>>0&1)))|0;if(!r)break;u=u+j|0;p=1;t=t+1|0;z=z+j|0}if(t)n=(n|0)<3?2:n+-1|0;c[x>>2]=u;p=B;y=q;F=z}R=(Xa|0)==2;if(R){if(!xa)r=0;else{n=0;s=1.0000000036274937e-15;v=1.0000000036274937e-15;p:while(1){if((n|0)==13)break;wa=c[Ia>>2]|0;p=n+1|0;q=b[wa+(p<<1)>>1]<>1]<=(q|0)){n=p;continue p}w=+g[Z+(n<<2)>>2];A=+g[Z+(n+Oa<<2)>>2];n=n+1|0;s=s+(+N(+w)+ +N(+A));v=v+(+N(+(w+A))+ +N(+(w-A)))}}r=b[(c[Ia>>2]|0)+26>>1]<>2]=+(r+((xa|0)<2?5:13)|0)*(v*.7071070075035095)>+(r|0)*s&1;r=xa}s=+((La|0)/1e3|0|0);q=e+200|0;n=c[q>>2]|0;p=0;while(1){if((p|0)>=21)break;if(+g[5104+(p<<2)>>2]>s)break;p=p+1|0}if(!((p|0)>(n|0)?+g[5104+(n<<2)>>2]+ +g[5188+(n<<2)>>2]>s:0))za=480;do if((za|0)==480){if((p|0)>=(n|0)){n=p;break}xa=n+-1|0;if(!(+g[5104+(xa<<2)>>2]-+g[5188+(xa<<2)>>2](n|0);c[q>>2]=(cb|0)<((P?bb:n)|0)?cb:P?bb:n;P=r}else P=xa;if((y+48|0)>(E-F|0))G=5;else{do if((bb|0)>0)za=487;else{if(c[ya>>2]|0){za=487;break}m=e+196|0;A=+g[Ga>>2];t=c[e+200>>2]|0;if(R){n=0;s=0.0;while(1){if((n|0)==8)break;q=c[Ia>>2]|0;p=b[q+(n<<1)>>1]|0;j=p<>1]|0)-p<=(p|0))break;w=v+ +g[r+(q<<2)>>2]*+g[j+(q<<2)>>2];q=q+1|0;v=w}s=s+v}v=+N(+(s*.125));v=v>1.0?1.0:v;n=8;w=v;while(1){if((n|0)>=(t|0))break;q=c[Ia>>2]|0;p=b[q+(n<<1)>>1]|0;j=p<>1]|0)-p<=(p|0))break;fb=s+ +g[r+(q<<2)>>2]*+g[j+(q<<2)>>2];q=q+1|0;s=fb}fb=+N(+s);w=w1.0?1.0:fb;v=+Y(+(1.0010000467300415-v*v))*1.4426950408889634;s=v*.5;fb=+Y(+(1.0010000467300415-fb*fb))*1.4426950408889634;v=v*.75;w=+g[m>>2]+.25;fb=-((s>fb?s:fb)*.5);g[m>>2]=w=(p|0))break;s=s+ +g[D+(n+(_(q,c[Ua>>2]|0)|0)<<2)>>2]*+((n<<1)+2-cb|0);n=n+1|0}q=q+1|0}while((q|0)<(Xa|0));s=(s/+(_(p,Xa)|0)+1.0)/6.0;wa=s>2.0;xa=s<-2.0&(wa^1);s=v-(xa|wa?(xa?-2.0:2.0):s)-W-A*2.0;if(c[e+120>>2]|0){fb=(+g[e+128>>2]+.05000000074505806)*2.0;wa=fb>2.0;xa=fb<-2.0&(wa^1);s=s-(xa|wa?(xa?-2.0:2.0):fb)}n=~~+M(+(s+.5));if((n|0)>10){p=h>>>7;n=10;za=512;break}p=h>>>7;if((n|0)>=0){if((n|0)>0){za=512;break}}else n=0;r=n;h=h-(_(p,d[28207+n>>0]|0)|0)|0}while(0);if((za|0)==487){g[e+196>>2]=0.0;p=h>>>7;n=5;za=512}if((za|0)==512){za=d[28207+(n+-1)>>0]|0;r=h-(_(p,za)|0)|0;c[T>>2]=(c[T>>2]|0)+r;r=n;h=_(p,za-(d[28207+n>>0]|0)|0)|0}c[ia>>2]=h;p=l;while(1){if(h>>>0>=8388609)break;l=c[T>>2]|0;q=l>>>23;if((q|0)==255){c[U>>2]=(c[U>>2]|0)+1;n=l;l=p}else{n=l>>>31;h=c[V>>2]|0;if((h|0)>-1){l=c[ba>>2]|0;if((l+(c[ca>>2]|0)|0)>>>0<(c[da>>2]|0)>>>0){c[ba>>2]=l+1;a[(c[Ta>>2]|0)+l>>0]=h+n;h=0}else h=-1;c[fa>>2]=c[fa>>2]|h}h=c[U>>2]|0;if(h|0){n=n+255&255;do{l=c[ba>>2]|0;if((l+(c[ca>>2]|0)|0)>>>0<(c[da>>2]|0)>>>0){c[ba>>2]=l+1;a[(c[Ta>>2]|0)+l>>0]=n;l=0;h=c[U>>2]|0}else l=-1;c[fa>>2]=c[fa>>2]|l;h=h+-1|0;c[U>>2]=h}while((h|0)!=0)}c[V>>2]=q&255;n=c[T>>2]|0;h=c[ia>>2]|0;l=c[ea>>2]|0}c[T>>2]=n<<8&2147483392;h=h<<8;c[ia>>2]=h;p=l+8|0;c[ea>>2]=p}xa=32-(aa(h|0)|0)|0;za=h>>>(xa+-16|0);y=(za>>>12)+-8|0;l=p;G=r;y=(p<<3)-((xa<<3)+(y+(za>>>0>(c[5272+(y<<2)>>2]|0)>>>0&1)))|0}if(Aa){B=(c[Ba>>2]|0)-P|0;l=3-P|0;D=1275>>>l;D=(o|0)<(D|0)?o:D;if(Da){h=(Xa*72|0)+32|0;h=(Ka|0)<(h|0)?0:Ka-h|0}else h=Ka-((Xa*320|0)+160)|0;z=(c[H>>2]|0)==0;if(z)x=h;else x=h+(c[e+184>>2]>>B)|0;if(Da){h=c[e+156>>2]|0;fb=+g[Ga>>2];h=~~(+(x+((h|0)<100?96>>>l:0)-((h|0)>100?144>>>l:0)|0)+(fb+-.25)*400.0);Ia=(y+F+63>>6)+2|0;l=Ca+296+F+63>>6;h=!(fb>.699999988079071)|(h|0)>400?h:400;l=(Ia|0)>(l|0)?Ia:l}else{l=c[e+92>>2]|0;p=c[e+200>>2]|0;v=+g[e+196>>2];q=c[Ea>>2]|0;w=+g[Ga>>2];o=c[e+64>>2]|0;t=c[ya>>2]|0;u=(c[e+204>>2]|0)!=0;m=c[Ua>>2]|0;j=c[Ia>>2]|0;l=(l|0)==0?m:l;h=b[j+(l<<1)>>1]<(p|0)?p:l)<<1)>>1]<>2]|0)==0;do if(n)h=x;else{s=+g[e+136>>2];if(!(s<.4)){h=x;break}h=x-~~(+(r<<3|0)*(.4000000059604645-s))|0}while(0);if(R){Ia=(l|0)>(p|0)?p:l;Ia=(b[j+(Ia<<1)>>1]<>2]+-.15000000596046448;s=+(r<<3|0);h=h+~~(s*1.2000000476837158*((fb<0.0?0.0:fb)+-.09000000357627869))|0;if(!va)break;h=h+~~(s*.800000011920929)|0}while(0);if(u&(t|0)==0){Ia=h+~~(+(r<<3|0)*ja)|0;h=(h|0)/4|0;h=(h|0)>(Ia|0)?h:Ia}Ga=~~(+((_(b[j+(m+-2<<1)>>1]<>2;Ia=(Ga|0)>(Ia|0)?Ga:Ia;h=(h|0)<(Ia|0)?h:Ia;do if(!(u&(t|0)==0)){if(!z)h=~~(+(h-x|0)*.6700000166893005)+x|0;if(!(w<.20000000298023224&(u^1)))break;Ia=96e3-La|0;Ga=(Ia|0)>32e3;h=h+~~(((La|0)>96e3&(Ga^1)?0.0:Ga?.09919999539852142:+(Ia|0)*3.099999958067201e-06)*ga*+(h|0))|0}while(0);l=x<<1;h=(l|0)<(h|0)?l:h;l=(y+F+63>>6)+2|0}o=h+y|0;p=o+32>>6;p=(l|0)>(p|0)?l:p;p=(D|0)<(p|0)?D:p;q=(Ma|0)==0;h=q?p:2;l=e+188|0;n=c[l>>2]|0;if((n|0)<970){c[l>>2]=n+1;s=1.0/+(n+21|0)}else s=1.0000000474974513e-03;do if(!z){l=e+176|0;c[l>>2]=(c[l>>2]|0)+((q?p<<6:128)-Ka);l=e+184|0;Ia=e+180|0;n=c[Ia>>2]|0;n=n+~~(s*+(((q?o-Ka|0:0)<>2]|0)-n|0))|0;c[Ia>>2]=n;c[l>>2]=0-n;l=e+176|0;n=c[l>>2]|0;if((n|0)>=0)break;c[l>>2]=0;h=q?p+((n|0)/-64|0)|0:2}while(0);L=(D|0)<(h|0)?D:h;Ka=c[Ta>>2]|0;l=c[ca>>2]|0;h=0-l|0;sf(Ka+L+h|0,Ka+(c[da>>2]|0)+h|0,l|0)|0;c[da>>2]=L;l=c[ea>>2]|0;h=c[ia>>2]|0}else L=o;f=i;i=i+((1*(db<<2)|0)+15&-16)|0;E=i;i=i+((1*(db<<2)|0)+15&-16)|0;J=i;i=i+((1*(db<<2)|0)+15&-16)|0;F=L<<6;Ka=32-(aa(h|0)|0)|0;K=h>>>(Ka+-16|0);h=(K>>>12)+-8|0;h=F+((Ka<<3)+(h+(K>>>0>(c[5272+(h<<2)>>2]|0)>>>0&1))-(l<<3))+-1|0;K=(ma|0)==0;if((P|0)>1&(K^1))B=(h|0)>=((P<<3)+16|0);else B=0;D=B?8:0;l=h-D|0;if(!(c[e+120>>2]|0))h=cb+-1|0;else{do if((La|0)<(Xa*32e3|0))h=13;else{if((La|0)<(Xa*48e3|0)){h=16;break}if((La|0)<(Xa*6e4|0)){h=18;break}h=(La|0)<(Xa*8e4|0)?19:20}while(0);La=c[e+144>>2]|0;h=(La|0)>(h|0)?La:h}z=e+200|0;n=e+92|0;y=sd(Pa,bb,cb,S,I,G,z,Ra,l,Qa,E,f,J,Xa,P,Ta,1,c[n>>2]|0,(c[ya>>2]|0)==0?h:1)|0;h=c[n>>2]|0;if(!h)h=y;else{Ka=h+1|0;h=h+-1|0;La=(h|0)>(y|0);h=(Ka|0)<((La?h:y)|0)?Ka:La?h:y}c[n>>2]=h;H=Ta+12|0;I=Ta+16|0;x=bb;while(1){if((x|0)>=(cb|0))break;j=c[f+(x<<2)>>2]|0;if((j|0)>=1){m=65536<>16;s=+(m|0);v=+(1<<14-j|0);t=m+-1|0;h=c[Ua>>2]|0;u=0;do{r=~~+M(+((+g[ha+(x+(_(u,h)|0)<<2)>>2]+.5)*s));r=(r|0)<(m|0)?r:t;r=(r|0)<0?0:r;h=c[H>>2]|0;l=c[I>>2]|0;if((l+j|0)>>>0>32){p=7-l|0;p=l+((p|0)>-8?p:-8)&-8;q=l;do{n=c[ca>>2]|0;o=c[da>>2]|0;if(((c[ba>>2]|0)+n|0)>>>0>>0){n=n+1|0;c[ca>>2]=n;a[(c[Ta>>2]|0)+(o-n)>>0]=h;n=0}else n=-1;c[fa>>2]=c[fa>>2]|n;h=h>>>8;q=q+-8|0}while((q|0)>7);l=l+-8-p|0}c[H>>2]=h|r<>2]=l+j;c[ea>>2]=(c[ea>>2]|0)+j;fb=(+(r|0)+.5)*v*.00006103515625+-.5;h=Za+(x+(_(u,c[Ua>>2]|0)|0)<<2)|0;g[h>>2]=+g[h>>2]+fb;h=c[Ua>>2]|0;La=ha+(x+(_(u,h)|0)<<2)|0;g[La>>2]=+g[La>>2]-fb;u=u+1|0}while((u|0)<(Xa|0))}x=x+1|0}La=i;i=i+((1*ra|0)+15&-16)|0;G=e+76|0;Yd(1,Pa,bb,cb,Z,R?Z+(Oa<<2)|0:0,La,C,E,$,c[e+80>>2]|0,c[Ra>>2]|0,c[z>>2]|0,X,F-D|0,c[Qa>>2]|0,Ta,P,y,G,c[qa>>2]|0,c[e+72>>2]|0);if(B){r=(c[e+116>>2]|0)<2&1;h=c[H>>2]|0;l=c[I>>2]|0;if((l+1|0)>>>0>32){p=7-l|0;p=l+((p|0)>-8?p:-8)&-8;q=l;do{n=c[ca>>2]|0;o=c[da>>2]|0;if(((c[ba>>2]|0)+n|0)>>>0>>0){n=n+1|0;c[ca>>2]=n;a[(c[Ta>>2]|0)+(o-n)>>0]=h;n=0}else n=-1;c[fa>>2]=c[fa>>2]|n;h=h>>>8;q=q+-8|0}while((q|0)>7);l=l+-8-p|0}c[H>>2]=h|r<>2]=l+1;h=(c[ea>>2]|0)+1|0;c[ea>>2]=h}else h=c[ea>>2]|0;h=(L<<3)-(h+((aa(c[ia>>2]|0)|0)+-32))|0;x=0;while(1){if((x|0)==2)break;else u=bb;while(1){if(!((u|0)<(cb|0)&(h|0)>=(Xa|0)))break;l=c[f+(u<<2)>>2]|0;do if((l|0)<=7){if((c[J+(u<<2)>>2]|0)!=(x|0))break;s=+(1<<14-l+-1|0);l=c[Ua>>2]|0;n=c[I>>2]|0;o=c[H>>2]|0;t=0;do{m=!(+g[ha+(u+(_(t,l)|0)<<2)>>2]<0.0);j=m&1;if((n+1|0)>>>0>32){q=7-n|0;q=n+((q|0)>-8?q:-8)&-8;r=n;l=o;do{o=c[ca>>2]|0;p=c[da>>2]|0;if(((c[ba>>2]|0)+o|0)>>>0

>>0){o=o+1|0;c[ca>>2]=o;a[(c[Ta>>2]|0)+(p-o)>>0]=l;o=0}else o=-1;c[fa>>2]=c[fa>>2]|o;l=l>>>8;r=r+-8|0}while((r|0)>7);n=n+-8-q|0}else l=o;o=l|j<>2]=o;c[I>>2]=n;c[ea>>2]=(c[ea>>2]|0)+1;fb=(+(m&1)+-.5)*s*.00006103515625;l=Za+(u+(_(t,c[Ua>>2]|0)|0)<<2)|0;g[l>>2]=+g[l>>2]+fb;l=c[Ua>>2]|0;Ra=ha+(u+(_(t,l)|0)<<2)|0;g[Ra>>2]=+g[Ra>>2]-fb;h=h+-1|0;t=t+1|0}while((t|0)<(Xa|0))}while(0);u=u+1|0}x=x+1|0}o=Wa<<2;nf(Va|0,0,o|0)|0;l=0;do{h=_(l,db)|0;n=bb;while(1){if((n|0)>=(cb|0))break;Ua=n+h|0;fb=+g[ha+(Ua<<2)>>2];Qa=fb>.5;Ra=fb<-.5&(Qa^1);g[Va+(Ua<<2)>>2]=Ra|Qa?(Ra?-.5:.5):fb;n=n+1|0}l=l+1|0}while((l|0)<(Xa|0));q:do if(Ma|0){h=0;while(1){if((h|0)>=(ra|0))break q;g[Za+(h<<2)>>2]=-28.0;h=h+1|0}}while(0);c[e+104>>2]=c[Ya>>2];g[e+108>>2]=Ha;c[e+112>>2]=Ja;if(sa&(Xa|0)==1)rf(Za+(db<<2)|0,Za|0,db<<2|0)|0;r:do if(K){rf($a|0,_a|0,o|0)|0;rf(_a|0,Za|0,o|0)|0;n=0}else{h=0;while(1){if((h|0)>=(Wa|0)){n=0;break r}Ya=_a+(h<<2)|0;Ha=+g[Ya>>2];fb=+g[Za+(h<<2)>>2];g[Ya>>2]=Ha=(bb|0)){h=cb;break}Ya=l+h|0;g[Za+(Ya<<2)>>2]=0.0;g[$a+(Ya<<2)>>2]=-28.0;g[_a+(Ya<<2)>>2]=-28.0;h=h+1|0}while(1){if((h|0)>=(db|0))break;Ya=l+h|0;g[Za+(Ya<<2)>>2]=0.0;g[$a+(Ya<<2)>>2]=-28.0;g[_a+(Ya<<2)>>2]=-28.0;h=h+1|0}n=n+1|0}while((n|0)<(ab|0));l=e+116|0;if(!(ma|ta))h=0;else h=(c[l>>2]|0)+1|0;c[l>>2]=h;c[G>>2]=c[ia>>2];cd(Ta);e=(c[fa>>2]|0)==0?L:-3;Na(Sa|0);i=eb;return e|0}function Sc(a,b,d,e,f,h,j,k,l,m,n){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;h=h|0;j=j|0;k=k|0;l=l|0;m=m|0;n=n|0;var o=0,p=0.0,q=0,r=0.0,s=0,t=0,u=0.0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,O=0;L=i;i=i+16|0;K=L+8|0;t=L;w=c[a>>2]|0;H=c[w+4>>2]|0;q=f+1024|0;J=(_(q,e)|0)<<2;I=i;i=i+((1*J|0)+15&-16)|0;c[K>>2]=I;c[K+4>>2]=I+(q<<2);I=H+f|0;J=f<<2;o=0;do{G=c[K+(o<<2)>>2]|0;rf(G|0,d+(o<<10<<2)|0,4096)|0;rf(G+4096|0,b+((_(o,I)|0)<<2)+(H<<2)|0,J|0)|0;o=o+1|0}while((o|0)<(e|0));if(!m){c[t>>2]=15;G=a+104|0;F=15;u=0.0}else{s=Fa()|0;o=i;i=i+((1*(q>>1<<2)|0)+15&-16)|0;gd(K,o,q,e);id(o+2048|0,o,f,979,t);c[t>>2]=1024-(c[t>>2]|0);m=a+104|0;p=+kd(o,f,t,c[m>>2]|0,+g[a+108>>2]);o=c[t>>2]|0;if((o|0)>1022){c[t>>2]=1022;o=1022}u=p*.699999988079071;E=c[a+56>>2]|0;u=(E|0)>2?u*.5:u;Na(s|0);G=m;F=o;u=(E|0)>8?0.0:(E|0)>4?u*.5:u}q=c[G>>2]|0;E=F-q|0;p=(((E|0)>-1?E:0-E|0)*10|0)>(F|0)?.4000000059604645:.20000000298023224;if((n|0)>=25){if((n|0)<35)v=11}else{p=p+.10000000149011612;v=11}if((v|0)==11)p=p+.10000000149011612;E=a+108|0;r=+g[E>>2];p=r>.4000000059604645?p+-.10000000149011612:p;p=r>.550000011920929?p+-.10000000149011612:p;if(u<(p>.20000000298023224?p:.20000000298023224)){r=0.0;D=0;o=0}else{m=+N(+(u-r))<.10000000149011612;m=~~+M(+((m?r:u)*32.0/3.0+.5));o=m+-1|0;if((o|0)<=7)if((m|0)<1)o=0;else v=15;else{o=7;v=15}r=+(o+1|0)*.09375;D=1}A=w+44|0;B=H<<2;p=-r;C=a+112|0;w=w+60|0;x=(f|0)>1024;y=1024-f<<2;z=0-f|0;m=0;while(1){n=c[A>>2]|0;v=n-H|0;c[G>>2]=(q|0)>15?q:15;q=b+((_(m,I)|0)<<2)|0;s=a+212+((_(m,H)|0)<<2)|0;rf(q|0,s|0,B|0)|0;if((n|0)==(H|0))n=c[K+(m<<2)>>2]|0;else{n=c[K+(m<<2)>>2]|0;O=c[G>>2]|0;u=-+g[E>>2];t=c[C>>2]|0;yc(q+(H<<2)|0,n+4096|0,O,O,v,u,u,t,t,0,0)}t=n+4096|0;yc(q+(H<<2)+(v<<2)|0,t+(v<<2)|0,c[G>>2]|0,F,f-v|0,-+g[E>>2],p,c[C>>2]|0,h,c[w>>2]|0,H);rf(s|0,q+(f<<2)|0,B|0)|0;q=d+(m<<10<<2)|0;if(x)rf(q|0,n+(f<<2)|0,4096)|0;else{sf(q|0,q+(f<<2)|0,y|0)|0;rf(q+4096+(z<<2)|0,t|0,J|0)|0}m=m+1|0;if((m|0)>=(e|0))break;q=c[G>>2]|0}g[k>>2]=r;c[j>>2]=F;c[l>>2]=o;i=L;return D|0}function Tc(a,b,e,f,h){a=a|0;b=b|0;e=e|0;f=f|0;h=h|0;var j=0.0,k=0.0,l=0,m=0,n=0.0,o=0,p=0,q=0.0,r=0.0,s=0,t=0,u=0,v=0,w=0,x=0,y=0.0,z=0,A=0;x=i;o=i;i=i+((1*(b<<2)|0)+15&-16)|0;p=(b|0)/2|0;q=+(p|0);r=+(p|0);s=p+-5|0;t=(p*6|0)+-102|0;u=0;v=0;while(1){if((u|0)>=(e|0))break;l=_(u,b)|0;m=0;j=0.0;k=0.0;while(1){if((m|0)>=(b|0))break;y=+g[a+(m+l<<2)>>2];n=j+y;g[o+(m<<2)>>2]=n;m=m+1|0;j=k+n-y*2.0;k=y-n*.5}l=o;m=l+48|0;do{c[l>>2]=0;l=l+4|0}while((l|0)<(m|0));l=0;n=0.0;j=0.0;while(1){if((l|0)>=(p|0)){l=p;k=0.0;break}m=l<<1;y=+g[o+(m<<2)>>2];k=+g[o+((m|1)<<2)>>2];k=y*y+k*k;y=j+(k-j)*.0625;g[o+(l<<2)>>2]=y;l=l+1|0;n=n+k;j=y}a:while(1){m=l;j=k;while(1){l=m+-1|0;if((m|0)<=0)break a;m=o+(l<<2)|0;j=j+(+g[m>>2]-j)*.125;g[m>>2]=j;if(k>j)m=l;else{k=j;continue a}}}j=r/(+O(+(n*k*.5*q))+1.0000000036274937e-15)*64.0;l=12;m=0;while(1){if((l|0)>=(s|0))break;y=+M(+(j*(+g[o+(l<<2)>>2]+1.0000000036274937e-15)));A=y>127.0;z=y<0.0&(A^1);l=l+4|0;m=m+(d[28075+~~(z|A?(z?0.0:127.0):y)>>0]|0)|0}l=(m<<8|0)/(t|0)|0;if((l|0)>(v|0))c[h>>2]=u;else l=v;u=u+1|0;v=l}l=(v|0)>200&1;j=+O(+(+(v*27|0)))+-42.0;if(!(j<0.0))if(j>163.0)k=163.0;else w=20;else{j=0.0;w=20}if((w|0)==20)k=j;if(k*.006899999920278788+-.139<0.0){y=0.0;y=+O(+y);g[f>>2]=y;i=x;return l|0}y=(j>163.0?163.0:j)*.006899999920278788+-.139;y=+O(+y);g[f>>2]=y;i=x;return l|0}function Uc(a,b,d,e,f,h,i,j){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;h=h|0;i=i|0;j=j|0;var k=0,l=0.0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0;q=c[a+4>>2]|0;p=(b|0)==0;t=c[a+44>>2]<<(p?i:0);s=p?1:b;p=(c[a+36>>2]|0)-(p?i:0)|0;o=a+64|0;r=_(s,t)|0;n=r+q|0;b=a+60|0;m=0;do{i=d+((_(m,n)|0)<<2)|0;a=_(_(m,t)|0,s)|0;k=0;while(1){if((k|0)>=(s|0))break;u=i+((_(k,t)|0)<<2)|0;ed(o,u,e+(k+a<<2)|0,c[b>>2]|0,q,p,s);k=k+1|0}m=m+1|0}while((m|0)<(h|0));a:do if((h|0)==2&(f|0)==1){b=0;while(1){if((b|0)>=(r|0))break a;u=e+(b<<2)|0;g[u>>2]=+g[u>>2]*.5+ +g[e+(r+b<<2)>>2]*.5;b=b+1|0}}while(0);if((j|0)==1)return;m=(r|0)/(j|0)|0;l=+(j|0);b=r-m<<2;a=0;do{i=_(_(a,s)|0,t)|0;k=0;while(1){if((k|0)>=(m|0))break;u=e+(i+k<<2)|0;g[u>>2]=+g[u>>2]*l;k=k+1|0}nf(e+(i+m<<2)|0,0,b|0)|0;a=a+1|0}while((a|0)<(f|0));return}function Vc(d,e,f,h,j,k,l,m,n,o){d=d|0;e=e|0;f=f|0;h=h|0;j=j|0;k=k|0;l=l|0;m=m|0;n=+n;o=o|0;var p=0,q=0,r=0,s=0,t=0.0,u=0,v=0,w=0,x=0,y=0,z=0,A=0.0,B=0,C=0,D=0,E=0,F=0,G=0,H=0.0,I=0,J=0,K=0,L=0,M=0,O=0,P=0,Q=0.0,R=0,S=0;P=i;i=i+16|0;J=P;H=.5-n;H=(H<-.25?-.25:H)*.03999999910593033;L=i;i=i+((1*(e<<2)|0)+15&-16)|0;G=c[d+32>>2]|0;K=e+-1|0;M=(b[G+(e<<1)>>1]|0)-(b[G+(K<<1)>>1]|0)<=(e|0))break;C=w+1|0;d=b[G+(w<<1)>>1]|0;D=(b[G+(C<<1)>>1]|0)-d|0;v=D<=(v|0))break;n=n+ +N(+(+g[E+(d<<2)>>2]));d=d+1|0}t=n+(I?0.0:+(m|0))*H*n;if(!(I|D)){rf(F|0,E|0,l|0)|0;d=v>>m>>1;l=0;while(1){if((l|0)<(y|0))o=0;else{n=0.0;d=0;break}while(1){if((o|0)>=(d|0))break;s=F+((_(z,o)|0)+l<<2)|0;Q=+g[s>>2]*.7071067690849304;u=F+(((o<<1|1)<>2]*.7071067690849304;g[s>>2]=Q+n;g[u>>2]=Q-n;o=o+1|0}l=l+1|0}while(1){if((d|0)>=(v|0))break;n=n+ +N(+(+g[F+(d<<2)>>2]));d=d+1|0}n=n+A*n;if(n=(((D|I^1)&1^1)+m|0))break;r=I?u+1|0:m-u+-1|0;d=1<>u>>1;o=d<<1;p=0;while(1){if((p|0)<(d|0))q=0;else{t=0.0;d=0;break}while(1){if((q|0)>=(l|0))break;S=E+((_(o,q)|0)+p<<2)|0;t=+g[S>>2]*.7071067690849304;R=E+(((q<<1|1)<>2]*.7071067690849304;g[S>>2]=t+Q;g[R>>2]=t-Q;q=q+1|0}p=p+1|0}while(1){if((d|0)>=(v|0))break;t=t+ +N(+(+g[E+(d<<2)>>2]));d=d+1|0}Q=t+ +(r|0)*H*t;R=Q>2]=l;if(!D){w=C;continue}if(!((l|0)==0|(l|0)==(B|0))){w=C;continue}c[d>>2]=l+-1;w=C}s=f<<2;r=0;while(1){if((r|0)==2)break;l=s+(r<<1)|0;d=27892+(m<<3)+l|0;l=(l|1)+(27892+(m<<3))|0;o=0;p=I?j:0;q=1;while(1){if((q|0)>=(e|0))break;k=p+j|0;R=o+j|0;S=c[L+(q<<2)>>2]|0;f=S-(a[d>>0]<<1)|0;S=S-(a[l>>0]<<1)|0;o=((o|0)<(k|0)?o:k)+((f|0)>-1?f:0-f|0)|0;p=((R|0)<(p|0)?R:p)+((S|0)>-1?S:0-S|0)|0;q=q+1|0}c[J+(r<<2)>>2]=(o|0)<(p|0)?o:p;r=r+1|0}r=I?0:(c[J+4>>2]|0)<(c[J>>2]|0)&1;o=s|r<<1;q=27892+(m<<3)+o|0;o=(o|1)+(27892+(m<<3))|0;p=0;d=I?j:0;l=1;while(1){if((l|0)>=(e|0))break;I=d+j|0;f=(p|0)<(I|0);c[M+(l<<2)>>2]=f&1^1;R=p+j|0;m=(R|0)<(d|0);c[O+(l<<2)>>2]=m&1^1;S=c[L+(l<<2)>>2]|0;J=S-(a[q>>0]<<1)|0;S=S-(a[o>>0]<<1)|0;p=(f?p:I)+((J|0)>-1?J:0-J|0)|0;d=(m?R:d)+((S|0)>-1?S:0-S|0)|0;l=l+1|0}l=(p|0)>=(d|0)&1;c[h+(K<<2)>>2]=l;d=e+-2|0;while(1){if((d|0)<=-1)break;S=c[((l|0)==1?O:M)+(d+1<<2)>>2]|0;c[h+(d<<2)>>2]=S;l=S;d=d+-1|0}i=P;return r|0}function Wc(a,d,e,f,h,j,l,m,n,o,p,q,r,s,t,u,v,w){a=a|0;d=d|0;e=e|0;f=f|0;h=h|0;j=j|0;l=l|0;m=m|0;n=n|0;o=o|0;p=p|0;q=q|0;r=r|0;s=s|0;t=t|0;u=u|0;v=v|0;w=w|0;var x=0.0,y=0,z=0,A=0,B=0.0,C=0.0,D=0,E=0.0,F=0.0,G=0.0,H=0.0,I=0.0,J=0.0,K=0.0,L=0,M=0,N=0,O=0,P=0,Q=0.0,R=0,S=0,T=0,U=0.0,V=0;T=i;O=_(j,e)|0;R=i;i=i+((1*(O<<2)|0)+15&-16)|0;P=i;i=i+((1*(O<<2)|0)+15&-16)|0;nf(l|0,0,e<<2|0)|0;x=+(9-m|0);m=0;while(1){if((m|0)>=(h|0)){n=0;x=-31.899999618530273;break}O=m+5|0;g[P+(m<<2)>>2]=+(b[n+(m<<1)>>1]|0)*.0625+.5+x-+g[17220+(m<<2)>>2]+ +(_(O,O)|0)*.006200000178068876;m=m+1|0}while(1){m=_(n,e)|0;y=0;Q=x;while(1){if((y|0)>=(h|0))break;K=+g[a+(m+y<<2)>>2]-+g[P+(y<<2)>>2];y=y+1|0;Q=Q>K?Q:K}n=n+1|0;if((n|0)>=(j|0))break;else x=Q}if(!((t|0)>50&(s|0)>0&(v|0)==0)){S=0;c[u>>2]=S;i=T;return +Q}L=h+-2|0;M=h+-1|0;O=0;m=0;while(1){A=_(O,e)|0;N=R+(A<<2)|0;z=d+(A<<2)|0;n=c[z>>2]|0;c[N>>2]=n;K=(c[k>>2]=n,+g[k>>2]);x=K;n=1;D=m;while(1){if((n|0)>=(h|0)){n=D;break}v=A+n|0;J=+g[d+(v<<2)>>2];v=J>+g[d+(v+-1<<2)>>2]+.5?n:D;J=x+1.5>2]=J;x=J;n=n+1|0;D=v}while(1){m=n+-1|0;if((n|0)<=0){v=2;break}v=N+(m<<2)|0;H=+g[v>>2];I=+g[N+(n<<2)>>2]+2.0;J=+g[d+(A+m<<2)>>2];y=I>2]=H<(y?I:J)?H:y?I:J;n=m}while(1){if((v|0)>=(L|0))break;y=N+(v<<2)|0;F=+g[y>>2];n=d+(A+v+-2<<2)|0;x=+g[n+8>>2];G=+g[n>>2];H=+g[n+4>>2];m=G>H;U=m?G:H;B=m?H:G;I=+g[n+12>>2];J=+g[n+16>>2];n=I>J;C=n?J:I;E=n?I:J;V=B>C;C=V?B:C;B=V?E:U;E=V?U:E;do if(x>B)if(BB+-1.0)x=F;else{U=m?G:H;B=m?H:G;C=n?J:I;E=n?I:J;V=B>C;C=V?B:C;B=V?E:U;E=V?U:E;do if(x>B)if(B>2]=x;v=v+1|0}C=+g[z+4>>2];V=K>C;x=V?C:K;C=V?K:C;B=+g[z+8>>2];if(!(C>2];g[N>>2]=B>C?B:C;V=N+4|0;B=+g[V>>2];g[V>>2]=B>C?B:C;V=d+(A+h+-3<<2)|0;C=+g[V>>2];B=+g[V+4>>2];A=C>B;x=A?B:C;B=A?C:B;C=+g[V+8>>2];if(!(B>2];g[m>>2]=K>U?K:U;m=N+(M<<2)|0;K=+g[m>>2];g[m>>2]=K>U?K:U;m=0;while(1){if((m|0)>=(h|0))break;V=N+(m<<2)|0;K=+g[V>>2];U=+g[P+(m<<2)>>2];g[V>>2]=K>U?K:U;m=m+1|0}O=O+1|0;if((O|0)>=(j|0))break;else m=D}a:do if((j|0)==2){m=f;while(1){if((m|0)>=(h|0)){m=f;break a}P=m+e|0;d=R+(P<<2)|0;U=+g[d>>2];V=R+(m<<2)|0;K=+g[V>>2]+-4.0;K=U>K?U:K;g[d>>2]=K;U=+g[V>>2];K=K+-4.0;K=U>K?U:K;g[V>>2]=K;K=+g[a+(m<<2)>>2]-K;U=+g[a+(P<<2)>>2]-+g[d>>2];g[V>>2]=((K<0.0?0.0:K)+(U<0.0?0.0:U))*.5;m=m+1|0}}else{m=f;while(1){if((m|0)>=(h|0)){m=f;break a}V=R+(m<<2)|0;U=+g[a+(m<<2)>>2]-+g[V>>2];g[V>>2]=U<0.0?0.0:U;m=m+1|0}}while(0);while(1){if((m|0)>=(h|0))break;V=R+(m<<2)|0;K=+g[V>>2];U=+g[w+(m<<2)>>2];g[V>>2]=K>U?K:U;m=m+1|0}D=(p|0)==0;b:do if((D|(q|0)!=0)&(o|0)==0){m=f;while(1){if((m|0)>=(h|0))break b;V=R+(m<<2)|0;g[V>>2]=+g[V>>2]*.5;m=m+1|0}}while(0);A=(t|0)/4|0;z=(q|0)==0;m=0;while(1){if((f|0)>=(h|0)){S=76;break}if((f|0)>=8){n=R+(f<<2)|0;x=+g[n>>2];if((f|0)>11){x=x*.5;g[n>>2]=x}}else{n=R+(f<<2)|0;x=+g[n>>2]*2.0;g[n>>2]=x}x=x<4.0?x:4.0;g[n>>2]=x;v=f+1|0;n=(_((b[r+(v<<1)>>1]|0)-(b[r+(f<<1)>>1]|0)|0,j)|0)<=6)if((n|0)>48){V=~~(x*8.0);y=V;n=((_(V,n)|0)<<3|0)/8|0;break}else{n=~~(x*+(n|0)/6.0);y=n;n=n*48|0;break}else{V=~~x;y=V;n=(_(V,n)|0)<<3}while(0);if(!((z|(o|0)!=0)&(D^1))?(m+n>>6|0)>(A|0):0)break;c[l+(f<<2)>>2]=y;f=v;m=m+n|0}if((S|0)==76){c[u>>2]=m;i=T;return +Q}V=A<<6;c[l+(f<<2)>>2]=V-m;c[u>>2]=V;i=T;return +Q}function Xc(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,h=0,j=0;h=i;i=i+16|0;e=h;c[e>>2]=d;do switch(b|0){case 10010:{f=(c[e>>2]|0)+(4-1)&~(4-1);b=c[f>>2]|0;c[e>>2]=f+4;if((b|0)>=0?(b|0)<(c[(c[a>>2]|0)+8>>2]|0):0){c[a+20>>2]=b;b=25}else b=26;break}case 10012:{f=(c[e>>2]|0)+(4-1)&~(4-1);b=c[f>>2]|0;c[e>>2]=f+4;if((b|0)>=1?(b|0)<=(c[(c[a>>2]|0)+8>>2]|0):0){c[a+24>>2]=b;b=25}else b=26;break}case 10008:{f=(c[e>>2]|0)+(4-1)&~(4-1);b=c[f>>2]|0;c[e>>2]=f+4;if((b+-1|0)>>>0>1)b=26;else{c[a+12>>2]=b;b=25}break}case 10007:{f=(c[e>>2]|0)+(4-1)&~(4-1);b=c[f>>2]|0;c[e>>2]=f+4;if(!b)b=26;else{a=a+40|0;c[b>>2]=c[a>>2];c[a>>2]=0;b=25}break}case 4027:{f=(c[e>>2]|0)+(4-1)&~(4-1);b=c[f>>2]|0;c[e>>2]=f+4;if(!b)b=26;else{c[b>>2]=(c[a+4>>2]|0)/(c[a+16>>2]|0)|0;b=25}break}case 4028:{f=c[a+8>>2]|0;b=a+88+((_((c[a+4>>2]|0)+2048|0,f)|0)<<2)+(f*24<<2)|0;j=c[a>>2]|0;e=c[j+8>>2]|0;d=e<<1;b=b+(d<<2)|0;d=b+(d<<2)|0;nf(a+36|0,0,((_((c[j+4>>2]|0)+2048|0,f)|0)<<2)+88+(f*96|0)+(e<<5)+-36|0)|0;f=0;while(1){if((f|0)>=(e<<1|0))break;g[d+(f<<2)>>2]=-28.0;g[b+(f<<2)>>2]=-28.0;e=c[(c[a>>2]|0)+8>>2]|0;f=f+1|0}c[a+52>>2]=1;b=25;break}case 4033:{j=(c[e>>2]|0)+(4-1)&~(4-1);b=c[j>>2]|0;c[e>>2]=j+4;if(!b)b=26;else{c[b>>2]=c[a+56>>2];b=25}break}case 10015:{j=(c[e>>2]|0)+(4-1)&~(4-1);b=c[j>>2]|0;c[e>>2]=j+4;if(!b)b=26;else{c[b>>2]=c[a>>2];b=25}break}case 10016:{j=(c[e>>2]|0)+(4-1)&~(4-1);b=c[j>>2]|0;c[e>>2]=j+4;c[a+28>>2]=b;b=25;break}case 4031:{j=(c[e>>2]|0)+(4-1)&~(4-1);b=c[j>>2]|0;c[e>>2]=j+4;if(!b)b=26;else{c[b>>2]=c[a+36>>2];b=25}break}default:{i=h;return}}while(0);if((b|0)==25){i=h;return}else if((b|0)==26){i=h;return}}function Yc(e,f,h,j,k,l,m){e=e|0;f=f|0;h=h|0;j=j|0;k=k|0;l=l|0;m=m|0;var n=0,o=0,p=0.0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0.0,z=0.0,A=0.0,B=0,C=0,D=0,E=0,F=0,G=0.0,H=0.0,I=0,J=0,K=0,L=0,M=0,N=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,Y=0,Z=0,$=0,ba=0,ca=0,da=0,ea=0,fa=0,ga=0,ha=0,ia=0,ja=0,ka=0,la=0,ma=0,na=0,oa=0,pa=0,qa=0,ra=0,sa=0,ta=0,ua=0,va=0,wa=0,xa=0,ya=0,za=0,Aa=0,Ba=0,Ca=0,Da=0,Ea=0,Ga=0,Ha=0;Ha=i;i=i+96|0;J=Ha;B=Ha+40|0;ba=Ha+32|0;Ga=Ha+24|0;ea=Ha+16|0;da=Ha+12|0;ca=Ha+8|0;za=c[e+8>>2]|0;c[ea>>2]=0;c[da>>2]=0;ma=c[e+12>>2]|0;Da=c[e>>2]|0;ka=Da+8|0;Ea=c[ka>>2]|0;qa=c[Da+4>>2]|0;la=Da+32|0;R=c[la>>2]|0;Aa=c[e+20>>2]|0;Ba=c[e+24>>2]|0;Ca=e+16|0;va=_(c[Ca>>2]|0,k)|0;o=qa+2048|0;wa=e+88+((_(o,za)|0)<<2)+(za*24<<2)|0;sa=Ea<<1;xa=wa+(sa<<2)|0;ya=xa+(sa<<2)|0;ra=ya+(sa<<2)|0;pa=Da+44|0;k=c[Da+36>>2]|0;na=0;while(1){if((na|0)>(k|0)){k=-1;K=268;break}if((c[pa>>2]<>>0>1275|(j|0)==0){e=-1;i=Ha;return e|0}ua=c[pa>>2]<>2]=ta;c[Ga+(n<<2)>>2]=ta+8192+(k<<2);n=n+1|0}while((n|0)<(za|0));ja=c[Da+12>>2]|0;ja=(Ba|0)>(ja|0)?ja:Ba;if((f|0)==0|(h|0)<2){Zc(e,ua,na);$c(Ga,j,ua,za,c[Ca>>2]|0,Da+16|0,e+80|0,m);e=(va|0)/(c[Ca>>2]|0)|0;i=Ha;return e|0}ta=e+48|0;c[e+52>>2]=(c[ta>>2]|0)!=0&1;a:do if(!l){c[B>>2]=f;c[B+4>>2]=h;c[B+8>>2]=0;c[B+12>>2]=0;c[B+16>>2]=0;t=B+20|0;c[t>>2]=9;u=B+24|0;c[u>>2]=0;v=B+28|0;c[v>>2]=128;if(!h){k=0;n=0}else{c[u>>2]=1;k=1;n=d[f>>0]|0}w=B+40|0;c[w>>2]=n;s=n>>>1^127;x=B+32|0;c[x>>2]=s;c[B+44>>2]=0;o=128;l=9;while(1){if(o>>>0>=8388609){l=B;break a}l=l+8|0;c[t>>2]=l;o=o<<8;c[v>>2]=o;if(k>>>0>>0){q=k+1|0;c[u>>2]=q;r=d[f+k>>0]|0}else{q=k;r=0}c[w>>2]=r;ia=((n<<8|r)>>>1&255|s<<8&2147483392)^255;c[x>>2]=ia;k=q;n=r;s=ia}}while(0);fa=(ma|0)==1;b:do if(fa){k=0;while(1){if((k|0)>=(Ea|0))break b;ia=wa+(k<<2)|0;G=+g[ia>>2];H=+g[wa+(Ea+k<<2)>>2];g[ia>>2]=G>H?G:H;k=k+1|0}}while(0);ga=h<<3;ha=l+20|0;k=c[ha>>2]|0;ia=l+28|0;r=c[ia>>2]|0;o=k+((aa(r|0)|0)+-32)|0;if((o|0)<(ga|0))if((o|0)==1){w=l+32|0;o=c[w>>2]|0;q=r>>>15;x=o>>>0>>0;n=x&1;if(!x){o=o-q|0;c[w>>2]=o;q=r-q|0}c[ia>>2]=q;t=l+40|0;u=l+24|0;v=l+4|0;while(1){if(q>>>0>=8388609)break;k=k+8|0;c[ha>>2]=k;q=q<<8;c[ia>>2]=q;s=c[t>>2]|0;r=c[u>>2]|0;if(r>>>0<(c[v>>2]|0)>>>0){c[u>>2]=r+1;r=d[(c[l>>2]|0)+r>>0]|0}else r=0;c[t>>2]=r;$=((s<<8|r)>>>1&255|o<<8&2147483392)^255;c[w>>2]=$;o=$}if(x){o=q;K=31}else{n=0;o=1}}else{q=r;n=0}else{o=r;n=1;K=31}if((K|0)==31){k=k+(ga-(k+((aa(o|0)|0)+-32)))|0;c[ha>>2]=k;q=o;o=ga}if((Aa|0)!=0|(o+16|0)>(ga|0)){$=0;Z=0;p=0.0}else{I=l+32|0;o=c[I>>2]|0;r=q>>>1;t=o>>>0>>0;if(!t){o=o-r|0;c[I>>2]=o;r=q-r|0}c[ia>>2]=r;D=l+40|0;E=l+24|0;F=l+4|0;while(1){if(r>>>0>=8388609)break;k=k+8|0;c[ha>>2]=k;r=r<<8;c[ia>>2]=r;s=c[D>>2]|0;q=c[E>>2]|0;if(q>>>0<(c[F>>2]|0)>>>0){c[E>>2]=q+1;q=d[(c[l>>2]|0)+q>>0]|0}else q=0;c[D>>2]=q;$=((s<<8|q)>>>1&255|o<<8&2147483392)^255;c[I>>2]=$;o=$}if(t){B=bd(l,6)|0;v=16<>2]|0;C=l+16|0;o=c[C>>2]|0;if(o>>>0>>0){t=l+8|0;s=c[F>>2]|0;u=o+8|0;u=o+(((u|0)>25?u:25)+-1-o&-8)|0;q=c[t>>2]|0;do{if(q>>>0>>0){r=q+1|0;c[t>>2]=r;q=r;r=d[(c[l>>2]|0)+(s-r)>>0]|0}else r=0;k=k|r<>>w;q=r-w|0;c[f>>2]=o;c[C>>2]=q;x=(c[ha>>2]|0)+w|0;c[ha>>2]=x;k=v+(k&(1<>>0<3){v=l+8|0;u=c[F>>2]|0;t=r+4-B|0;t=r+(B+((t|0)>25?t:25)+3-r&-8)+4|0;r=c[v>>2]|0;do{if(r>>>0>>0){s=r+1|0;c[v>>2]=s;r=s;s=d[(c[l>>2]|0)+(u-s)>>0]|0}else s=0;o=o|s<>2]=o>>>3;c[C>>2]=q+-3;q=x+3|0;c[ha>>2]=q;r=c[ia>>2]|0;c:do if((q+((aa(r|0)|0)+-32)+2|0)>(ga|0))o=0;else{t=c[I>>2]|0;u=r>>>2;o=-1;while(1){o=o+1|0;s=_(u,d[29345+o>>0]|0)|0;if(t>>>0>=s>>>0)break;else r=s}u=t-s|0;c[I>>2]=u;r=r-s|0;c[ia>>2]=r;while(1){if(r>>>0>=8388609)break c;q=q+8|0;c[ha>>2]=q;r=r<<8;c[ia>>2]=r;t=c[D>>2]|0;s=c[E>>2]|0;if(s>>>0<(c[F>>2]|0)>>>0){c[E>>2]=s+1;s=d[(c[l>>2]|0)+s>>0]|0}else s=0;c[D>>2]=s;$=((t<<8|s)>>>1&255|u<<8&2147483392)^255;c[I>>2]=$;u=$}}while(0);s=q;p=+(v+1|0)*.09375}else{s=k;p=0.0;k=0;o=0}$=k;Z=o;k=s;q=r;o=s+((aa(r|0)|0)+-32)|0}Q=(na|0)>0;if(!((o+3|0)>(ga|0)|Q^1)){w=l+32|0;o=c[w>>2]|0;r=q>>>3;x=o>>>0>>0;B=x&1;if(x)q=r;else{o=o-r|0;c[w>>2]=o;q=q-r|0}c[ia>>2]=q;t=l+40|0;u=l+24|0;v=l+4|0;while(1){if(q>>>0>=8388609)break;k=k+8|0;c[ha>>2]=k;q=q<<8;c[ia>>2]=q;s=c[t>>2]|0;r=c[u>>2]|0;if(r>>>0<(c[v>>2]|0)>>>0){c[u>>2]=r+1;r=d[(c[l>>2]|0)+r>>0]|0}else r=0;c[t>>2]=r;Y=((s<<8|r)>>>1&255|o<<8&2147483392)^255;c[w>>2]=Y;o=Y}o=k+((aa(q|0)|0)+-32)|0;if(x)W=oa;else K=72}else K=72;if((K|0)==72){B=0;W=0}if((o+3|0)<=(ga|0)){w=l+32|0;o=c[w>>2]|0;r=q>>>3;u=o>>>0>>0;f=u&1;if(!u){o=o-r|0;c[w>>2]=o;r=q-r|0}c[ia>>2]=r;v=l+40|0;q=l+24|0;x=l+4|0;while(1){if(r>>>0>=8388609)break;k=k+8|0;c[ha>>2]=k;r=r<<8;c[ia>>2]=r;t=c[v>>2]|0;s=c[q>>2]|0;if(s>>>0<(c[x>>2]|0)>>>0){c[q>>2]=s+1;s=d[(c[l>>2]|0)+s>>0]|0}else s=0;c[v>>2]=s;Y=((t<<8|s)>>>1&255|o<<8&2147483392)^255;c[w>>2]=Y;o=Y}Y=J;c[Y>>2]=0;c[Y+4>>2]=0;if(u){k=w;o=v;r=l;Y=x;P=f;y=.149993896484375;z=0.0;t=J}else{s=x;k=w;o=v;r=l;t=J;K=83}}else{s=J;c[s>>2]=0;c[s+4>>2]=0;s=l+4|0;k=l+32|0;o=l+40|0;q=l+24|0;r=l;t=J;K=83}if((K|0)==83){Y=s;P=0;y=+g[17320+(na<<2)>>2];z=+g[17336+(na<<2)>>2]}J=c[Y>>2]<<3;K=l+36|0;N=Aa;while(1){if((N|0)>=(Ba|0))break;L=(N|0)<20;M=0;do{v=c[ha>>2]|0;I=c[ia>>2]|0;s=v+((aa(I|0)|0)+-32)|0;u=J-s|0;d:do if((u|0)<=14){if((u|0)>1){w=c[k>>2]|0;x=I>>>2;f=-1;u=I;while(1){f=f+1|0;s=_(x,d[29345+f>>0]|0)|0;if(w>>>0>=s>>>0)break;else u=s}x=w-s|0;c[k>>2]=x;u=u-s|0;c[ia>>2]=u;s=v;while(1){if(u>>>0>=8388609)break;s=s+8|0;c[ha>>2]=s;u=u<<8;c[ia>>2]=u;w=c[o>>2]|0;v=c[q>>2]|0;if(v>>>0<(c[Y>>2]|0)>>>0){c[q>>2]=v+1;v=d[(c[r>>2]|0)+v>>0]|0}else v=0;c[o>>2]=v;V=((w<<8|v)>>>1&255|x<<8&2147483392)^255;c[k>>2]=V;x=V}s=f>>1^0-(f&1);break}if((J|0)>(s|0)){u=c[k>>2]|0;s=I>>>1;f=u>>>0>>0;if(!f){u=u-s|0;c[k>>2]=u;s=I-s|0}c[ia>>2]=s;while(1){if(s>>>0>=8388609)break;v=v+8|0;c[ha>>2]=v;s=s<<8;c[ia>>2]=s;x=c[o>>2]|0;w=c[q>>2]|0;if(w>>>0<(c[Y>>2]|0)>>>0){c[q>>2]=w+1;w=d[(c[r>>2]|0)+w>>0]|0}else w=0;c[o>>2]=w;V=((x<<8|w)>>>1&255|u<<8&2147483392)^255;c[k>>2]=V;u=V}s=f<<31>>31}else s=-1}else{C=(L?N:20)<<1;s=d[29009+(na*84|0)+(P*42|0)+C>>0]<<7;C=d[(C|1)+(29009+(na*84|0)+(P*42|0))>>0]<<6;E=I>>>15;c[K>>2]=E;F=c[k>>2]|0;D=(F>>>0)/(E>>>0)|0;V=D+1|0;D=32768-(V+(V>>>0>32768?32767-D|0:0))|0;if(D>>>0>>0){w=s;u=0;s=0}else{u=_(32736-s|0,16384-C|0)|0;x=1;while(1){V=u>>>15;w=V+1|0;if(!V)break;u=w<<1;f=s+u|0;if(D>>>0>>0)break;u=_(u+-2|0,C)|0;s=f;x=x+1|0}if(w>>>0<2){V=(D-s|0)>>>1;s=s+(V<<1)|0;x=x+V|0}u=s+w|0;V=D>>>0>>0;u=V?s:u;s=V?0-x|0:x}w=u+w|0;w=w>>>0<32768?w:32768;V=_(E,32768-w|0)|0;f=F-V|0;c[k>>2]=f;w=_(E,w-u|0)|0;w=(u|0)==0?I-V|0:w;c[ia>>2]=w;u=v;while(1){if(w>>>0>=8388609)break d;u=u+8|0;c[ha>>2]=u;w=w<<8;c[ia>>2]=w;x=c[o>>2]|0;v=c[q>>2]|0;if(v>>>0<(c[Y>>2]|0)>>>0){c[q>>2]=v+1;v=d[(c[r>>2]|0)+v>>0]|0}else v=0;c[o>>2]=v;V=((x<<8|v)>>>1&255|f<<8&2147483392)^255;c[k>>2]=V;f=V}}while(0);H=+(s|0);U=wa+(N+(_(M,c[ka>>2]|0)|0)<<2)|0;G=+g[U>>2];g[U>>2]=G<-9.0?-9.0:G;U=wa+(N+(_(M,c[ka>>2]|0)|0)<<2)|0;V=t+(M<<2)|0;g[U>>2]=z*+g[U>>2]+ +g[V>>2]+H;g[V>>2]=+g[V>>2]+H-y*H;M=M+1|0}while((M|0)<(ma|0));N=N+1|0}V=Fa()|0;U=i;i=i+((1*(Ea<<2)|0)+15&-16)|0;N=c[Y>>2]|0;s=N<<3;u=c[ha>>2]|0;v=c[ia>>2]|0;x=u+((aa(v|0)|0)+-32)|0;t=(B|0)!=0;w=t?2:4;if(Q)I=(x+w+1|0)>>>0<=s>>>0;else I=0;F=s-(I&1)|0;E=t?4:5;C=0;D=Aa;s=x;f=0;while(1){if((D|0)>=(Ba|0))break;if((s+w|0)>>>0>F>>>0){x=C;t=f}else{t=c[k>>2]|0;s=v>>>w;T=t>>>0>>0;x=T&1;if(!T){t=t-s|0;c[k>>2]=t;s=v-s|0}c[ia>>2]=s;w=u;while(1){if(s>>>0>=8388609)break;w=w+8|0;c[ha>>2]=w;s=s<<8;c[ia>>2]=s;v=c[o>>2]|0;u=c[q>>2]|0;if(u>>>0>>0){c[q>>2]=u+1;u=d[(c[r>>2]|0)+u>>0]|0}else u=0;c[o>>2]=u;T=((v<<8|u)>>>1&255|t<<8&2147483392)^255;c[k>>2]=T;t=T}t=C^x;u=w;v=s;x=t;s=w+((aa(s|0)|0)+-32)|0;t=f|t}c[U+(D<<2)>>2]=x;C=x;D=D+1|0;w=E;f=t}C=B<<2;if(I?(a[C+f+(27892+(na<<3))>>0]|0)!=(a[(C|2)+f+(27892+(na<<3))>>0]|0):0){t=c[k>>2]|0;s=v>>>1;T=t>>>0>>0;f=T&1;if(!T){t=t-s|0;c[k>>2]=t;s=v-s|0}c[ia>>2]=s;while(1){if(s>>>0>=8388609)break;u=u+8|0;c[ha>>2]=u;s=s<<8;c[ia>>2]=s;w=c[o>>2]|0;v=c[q>>2]|0;if(v>>>0>>0){c[q>>2]=v+1;v=d[(c[r>>2]|0)+v>>0]|0}else v=0;c[o>>2]=v;T=((w<<8|v)>>>1&255|t<<8&2147483392)^255;c[k>>2]=T;t=T}x=s;s=f<<1}else{x=v;s=0}s=C+s|0;t=Aa;while(1){if((t|0)>=(Ba|0))break;T=U+(t<<2)|0;c[T>>2]=a[s+(c[T>>2]|0)+(27892+(na<<3))>>0];t=t+1|0}e:do if((u+((aa(x|0)|0)+-32)+4|0)>(ga|0)){s=u;t=x;f=2}else{v=c[k>>2]|0;w=x>>>5;f=-1;t=x;while(1){f=f+1|0;s=_(w,d[28203+f>>0]|0)|0;if(v>>>0>=s>>>0)break;else t=s}w=v-s|0;c[k>>2]=w;t=t-s|0;c[ia>>2]=t;s=u;while(1){if(t>>>0>=8388609)break e;s=s+8|0;c[ha>>2]=s;u=t<<8;c[ia>>2]=u;v=c[o>>2]|0;t=c[q>>2]|0;if(t>>>0>>0){c[q>>2]=t+1;t=d[(c[r>>2]|0)+t>>0]|0}else t=0;c[o>>2]=t;T=((v<<8|t)>>>1&255|w<<8&2147483392)^255;c[k>>2]=T;t=u;w=T}}while(0);M=i;i=i+((1*(Ea<<2)|0)+15&-16)|0;u=c[ka>>2]|0;v=(na<<1)+ma+-1|0;w=Da+104|0;x=0;while(1){if((x|0)>=(u|0))break;T=x+1|0;S=c[la>>2]|0;Q=(_(u,v)|0)+x|0;c[M+(x<<2)>>2]=(_(_((d[(c[w>>2]|0)+Q>>0]|0)+64|0,ma)|0,(b[S+(T<<1)>>1]|0)-(b[S+(x<<1)>>1]|0)<>2;x=T}L=i;i=i+((1*(Ea<<2)|0)+15&-16)|0;Q=h<<6;S=32-(aa(t|0)|0)|0;T=t>>>(S+-16|0);w=(T>>>12)+-8|0;C=s;J=6;K=Aa;s=(s<<3)-((S<<3)+(w+(T>>>0>(c[5272+(w<<2)>>2]|0)>>>0&1)))|0;w=Q;while(1){if((K|0)>=(Ba|0))break;I=K+1|0;D=(_(ma,(b[R+(I<<1)>>1]|0)-(b[R+(K<<1)>>1]|0)|0)|0)<=(F|0))break;if((C|0)>=(c[E>>2]|0))break;s=c[k>>2]|0;v=t>>>v;x=s>>>0>>0;if(x)t=v;else{s=s-v|0;c[k>>2]=s;t=t-v|0}c[ia>>2]=t;while(1){if(t>>>0>=8388609)break;u=u+8|0;c[ha>>2]=u;t=t<<8;c[ia>>2]=t;w=c[o>>2]|0;v=c[q>>2]|0;if(v>>>0>>0){c[q>>2]=v+1;v=d[(c[r>>2]|0)+v>>0]|0}else v=0;c[o>>2]=v;T=((w<<8|v)>>>1&255|s<<8&2147483392)^255;c[k>>2]=T;s=T}S=32-(aa(t|0)|0)|0;T=t>>>(S+-16|0);s=(T>>>12)+-8|0;s=(u<<3)-((S<<3)+(s+(T>>>0>(c[5272+(s<<2)>>2]|0)>>>0&1)))|0;if(!x)break;C=C+D|0;v=1;F=F-D|0}c[L+(K<<2)>>2]=C;if((C|0)<=0){C=u;K=I;w=F;continue}C=u;J=(J|0)<3?2:J+-1|0;K=I;w=F}h=i;i=i+((1*(Ea<<2)|0)+15&-16)|0;f:do if((s+48|0)>(w|0)){o=C;k=t;q=5}else{u=c[k>>2]|0;v=t>>>7;x=-1;while(1){x=x+1|0;s=_(v,d[28207+x>>0]|0)|0;if(u>>>0>=s>>>0)break;else t=s}w=u-s|0;c[k>>2]=w;t=t-s|0;c[ia>>2]=t;s=C;while(1){if(t>>>0>=8388609){o=s;k=t;q=x;break f}s=s+8|0;c[ha>>2]=s;u=t<<8;c[ia>>2]=u;v=c[o>>2]|0;t=c[q>>2]|0;if(t>>>0>>0){c[q>>2]=t+1;t=d[(c[r>>2]|0)+t>>0]|0}else t=0;c[o>>2]=t;T=((v<<8|t)>>>1&255|w<<8&2147483392)^255;c[k>>2]=T;t=u;w=T}}while(0);S=32-(aa(k|0)|0)|0;T=k>>>(S+-16|0);k=(T>>>12)+-8|0;k=Q+((S<<3)+(k+(T>>>0>(c[5272+(k<<2)>>2]|0)>>>0&1))-(o<<3))+-1|0;T=(B|0)==0;if((na|0)>1&(T^1))E=(k|0)>=((na<<3)+16|0);else E=0;F=E?8:0;S=i;i=i+((1*(Ea<<2)|0)+15&-16)|0;N=i;i=i+((1*(Ea<<2)|0)+15&-16)|0;D=sd(Da,Aa,Ba,L,M,q,ea,da,k-F|0,ca,S,h,N,ma,na,l,0,0,0)|0;I=l+12|0;J=l+16|0;K=l+8|0;C=Aa;while(1){if((C|0)>=(Ba|0))break;v=c[h+(C<<2)>>2]|0;if((v|0)>=1){w=(1<>2]|0;k=c[J>>2]|0;x=0;do{if(k>>>0>>0){t=k+8|0;u=((t|0)>25?t:25)+-1-k&-8;o=q;do{q=c[K>>2]|0;s=c[Y>>2]|0;if(q>>>0>>0){q=q+1|0;c[K>>2]=q;q=d[(c[r>>2]|0)+(s-q)>>0]|0}else q=0;o=o|q<>>v;k=k-v|0;c[I>>2]=q;c[J>>2]=k;c[ha>>2]=(c[ha>>2]|0)+v;R=wa+(C+(_(x,c[ka>>2]|0)|0)<<2)|0;g[R>>2]=+g[R>>2]+((+(o&w|0)+.5)*y*.00006103515625+-.5);x=x+1|0}while((x|0)<(ma|0))}C=C+1|0}k=2048-ua+((qa|0)/2|0)<<2;o=0;do{R=c[ba+(o<<2)>>2]|0;sf(R|0,R+(ua<<2)|0,k|0)|0;o=o+1|0}while((o|0)<(za|0));M=_(ma,Ea)|0;L=i;i=i+((1*M|0)+15&-16)|0;R=(_(ma,ua)|0)<<2;P=i;i=i+((1*R|0)+15&-16)|0;R=e+36|0;Yd(0,Da,Aa,Ba,P,(ma|0)==2?P+(ua<<2)|0:0,L,0,S,W,f,c[da>>2]|0,c[ea>>2]|0,U,Q-F|0,c[ca>>2]|0,l,na,D,R,0,c[e+32>>2]|0);if(E){o=c[I>>2]|0;k=c[J>>2]|0;if(!k){s=c[Y>>2]|0;q=c[K>>2]|0;t=0;do{if(q>>>0>>0){k=q+1|0;c[K>>2]=k;q=k;k=d[(c[r>>2]|0)+(s-k)>>0]|0}else k=0;o=o|k<>2]=o>>>1;c[J>>2]=k+-1;k=(c[ha>>2]|0)+1|0;c[ha>>2]=k;f=o&1}else{k=c[ha>>2]|0;f=0}o=ga-(k+((aa(c[ia>>2]|0)|0)+-32))|0;x=0;while(1){if((x|0)==2)break;else w=Aa;while(1){if(!((w|0)<(Ba|0)&(o|0)>=(ma|0)))break;q=c[h+(w<<2)>>2]|0;do if((q|0)<=7){if((c[N+(w<<2)>>2]|0)!=(x|0))break;y=+(1<<14-q+-1|0);s=c[J>>2]|0;t=c[I>>2]|0;v=0;do{if(!s){u=0;while(1){q=c[K>>2]|0;s=c[Y>>2]|0;if(q>>>0>>0){q=q+1|0;c[K>>2]=q;q=d[(c[r>>2]|0)+(s-q)>>0]|0}else q=0;q=t|q<=25){s=32;break}else t=q}}else q=t;t=q>>>1;s=s+-1|0;c[I>>2]=t;c[J>>2]=s;k=k+1|0;c[ha>>2]=k;ea=wa+(w+(_(v,c[ka>>2]|0)|0)<<2)|0;g[ea>>2]=+g[ea>>2]+(+(q&1|0)+-.5)*y*.00006103515625;o=o+-1|0;v=v+1|0}while((v|0)<(ma|0))}while(0);w=w+1|0}x=x+1|0}g:do if(f|0){u=(na|0)==3;k=c[R>>2]|0;C=Aa;h:while(1){if((C|0)>=(Ba|0))break g;v=C+1|0;w=c[la>>2]|0;w=(b[w+(v<<1)>>1]|0)-(b[w+(C<<1)>>1]|0)|0;G=+X(+(+(((((c[S+(C<<2)>>2]|0)+1|0)>>>0)/(w>>>0)|0)>>>na|0)*-.125*.6931471805599453))*.5;x=w<>2]|0;r=(_(o,q)|0)+C|0;z=+g[xa+(r<<2)>>2];y=+g[ya+(r<<2)>>2];do if(fa){ea=q+C|0;A=+g[xa+(ea<<2)>>2];z=z>A?z:A;A=+g[ya+(ea<<2)>>2];if(y>A)break;y=A}while(0);y=+g[wa+(r<<2)>>2]-(z>2]|0)+(C<<1)>>1]<=(oa|0))break;i:do if(!(d[s>>0]&1<=(w|0)){q=1;break i}ea=(_(k,1664525)|0)+1013904223|0;g[t+((q<>2]=(ea&32768|0)==0?z:y;k=ea;q=q+1|0}}while(0);r=r+1|0}j:do if(q|0){q=0;y=0.0;while(1){if((q|0)>=(x|0))break;A=+g[t+(q<<2)>>2];q=q+1|0;y=y+A*A}y=1.0/+O(+(y+1.0000000036274937e-15));r=0;q=t;while(1){if((r|0)>=(x|0))break j;g[q>>2]=y*+g[q>>2];r=r+1|0;q=q+4|0}}while(0);o=o+1|0;if((o|0)>=(ma|0)){C=v;continue h}}}}while(0);k:do if(n|0){k=0;while(1){if((k|0)>=(M|0))break k;g[wa+(k<<2)>>2]=-28.0;k=k+1|0}}while(0);_c(Da,P,Ga,wa,Aa,ja,ma,za,B,na,c[Ca>>2]|0,n);q=e+56|0;r=e+60|0;s=e+68|0;t=e+64|0;u=e+76|0;v=e+72|0;w=Da+60|0;k=(na|0)==0;o=0;do{na=c[q>>2]|0;na=(na|0)>15?na:15;c[q>>2]=na;ma=c[r>>2]|0;ma=(ma|0)>15?ma:15;c[r>>2]=ma;n=c[Ga+(o<<2)>>2]|0;yc(n,n,ma,na,c[pa>>2]|0,+g[s>>2],+g[t>>2],c[u>>2]|0,c[v>>2]|0,c[w>>2]|0,qa);if(!k){na=c[pa>>2]|0;ma=n+(na<<2)|0;yc(ma,ma,c[q>>2]|0,$,ua-na|0,+g[t>>2],p,c[v>>2]|0,Z,c[w>>2]|0,qa)}o=o+1|0}while((o|0)<(za|0));c[r>>2]=c[q>>2];c[s>>2]=c[t>>2];c[u>>2]=c[v>>2];c[q>>2]=$;g[t>>2]=p;c[v>>2]=Z;if(!k){c[r>>2]=$;g[s>>2]=p;c[u>>2]=Z}if(fa)rf(wa+(Ea<<2)|0,wa|0,Ea<<2|0)|0;l:do if(T){k=Ea<<3;rf(ya|0,xa|0,k|0)|0;rf(xa|0,wa|0,k|0)|0;p=(c[ta>>2]|0)<10?+(oa|0)*1.0000000474974513e-03:1.0;k=0;while(1){if((k|0)>=(sa|0)){o=0;break l}qa=ra+(k<<2)|0;G=+g[qa>>2]+p;H=+g[wa+(k<<2)>>2];g[qa>>2]=G=(sa|0)){o=0;break l}ra=xa+(k<<2)|0;G=+g[ra>>2];H=+g[wa+(k<<2)>>2];g[ra>>2]=G=(Aa|0)){k=Ba;break}sa=n+k|0;g[wa+(sa<<2)>>2]=0.0;g[ya+(sa<<2)>>2]=-28.0;g[xa+(sa<<2)>>2]=-28.0;k=k+1|0}while(1){if((k|0)>=(Ea|0))break;sa=n+k|0;g[wa+(sa<<2)>>2]=0.0;g[ya+(sa<<2)>>2]=-28.0;g[xa+(sa<<2)>>2]=-28.0;k=k+1|0}o=o+1|0}while((o|0)!=2);c[R>>2]=c[ia>>2];$c(Ga,j,ua,za,c[Ca>>2]|0,Da+16|0,e+80|0,m);c[ta>>2]=0;if(((c[ha>>2]|0)+((aa(c[ia>>2]|0)|0)+-32)|0)>(ga|0))k=-3;else{if(c[l+44>>2]|0)c[e+40>>2]=1;k=(va|0)/(c[Ca>>2]|0)|0}Na(V|0);e=k;i=Ha;return e|0}function Zc(a,d,e){a=a|0;d=d|0;e=e|0;var f=0,h=0,j=0.0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0.0,s=0,t=0,u=0,v=0.0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0.0,J=0,K=0,L=0,M=0,N=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0.0,Z=0.0;X=i;i=i+8512|0;l=X+8504|0;k=X+4408|0;W=X+4400|0;z=X+4392|0;P=X+296|0;N=X+192|0;Q=X+96|0;R=X;V=c[a+8>>2]|0;A=c[a>>2]|0;n=c[A+8>>2]|0;U=c[A+4>>2]|0;y=c[A+32>>2]|0;f=U+2048|0;M=0-d|0;h=0;do{T=a+88+((_(h,f)|0)<<2)|0;c[W+(h<<2)>>2]=T;c[z+(h<<2)>>2]=T+8192+(M<<2);h=h+1|0}while((h|0)<(V|0));L=a+88+((_(f,V)|0)<<2)|0;w=L+(V*24<<2)|0;m=n<<1;m=w+(m<<2)+(m<<2)+(m<<2)|0;S=a+48|0;T=c[S>>2]|0;x=c[a+20>>2]|0;if((T|0)<5&(x|0)==0?(c[a+52>>2]|0)==0:0){K=(T|0)==0;if(K){gd(W,k,2048,V);id(k+1440|0,k,1328,620,l);J=720-(c[l>>2]|0)|0;c[a+44>>2]=J;I=1.0}else{I=.800000011920929;J=c[a+44>>2]|0}G=Fa()|0;H=i;i=i+((1*(U<<2)|0)+15&-16)|0;u=c[A+60>>2]|0;w=J<<1;x=(w|0)<1024;y=P+4096|0;e=2048-d|0;z=e<<2;A=1024-J|0;B=U+d|0;C=1024-d+A|0;D=e+-1|0;E=a+56|0;F=a+64|0;o=a+72|0;p=(U|0)/2|0;q=U+-1|0;t=0;do{s=c[W+(t<<2)>>2]|0;f=0;while(1){if((f|0)==1024)break;c[P+(f<<2)>>2]=c[s+(f+1024<<2)>>2];f=f+1|0}if(K){pd(P,N,u,U,24,1024);g[N>>2]=+g[N>>2]*1.000100016593933;f=1;while(1){if((f|0)==25)break;a=N+(f<<2)|0;r=+g[a>>2];v=+(f|0);g[a>>2]=r-r*6.400000711437315e-05*v*v;f=f+1|0}ld(L+(t*24<<2)|0,N,24)}k=x?w:1024;f=2048-k+-1|0;h=0;while(1){if((h|0)==24)break;c[Q+(h<<2)>>2]=c[s+(f-h<<2)>>2];h=h+1|0}l=y+(0-k<<2)|0;n=L+(t*24<<2)|0;md(l,n,l,k,Q);l=k>>1;m=1024-l|0;f=1024-k|0;j=1.0;r=1.0;h=0;while(1){if((h|0)>=(l|0))break;Y=+g[P+(m+h<<2)>>2];v=+g[P+(f+h<<2)>>2];j=j+Y*Y;r=r+v*v;h=h+1|0}r=+O(+((j=(B|0)){f=0;break}a=(h|0)<(J|0);Y=a?j:j*r;a=h-(a?0:J)|0;g[s+(e+f<<2)>>2]=Y*+g[P+(A+a<<2)>>2];Z=+g[s+(C+a<<2)>>2];v=v+Z*Z;j=Y;f=f+1|0;h=a+1|0}while(1){if((f|0)==24)break;c[R+(f<<2)>>2]=c[s+(D-f<<2)>>2];f=f+1|0}h=s+8192|0;f=h+(M<<2)|0;od(f,n,f,B,R);j=0.0;f=0;while(1){if((f|0)>=(B|0))break;Z=+g[s+(e+f<<2)>>2];j=j+Z*Z;f=f+1|0}a:do if(v>j*.20000000298023224){if(v=(U|0)){f=U;break}a=s+(e+f<<2)|0;g[a>>2]=(1.0-+g[u+(f<<2)>>2]*j)*+g[a>>2];f=f+1|0}while(1){if((f|0)>=(B|0))break a;a=s+(e+f<<2)|0;g[a>>2]=r*+g[a>>2];f=f+1|0}}}else{f=0;while(1){if((f|0)>=(B|0))break a;g[s+(e+f<<2)>>2]=0.0;f=f+1|0}}while(0);a=c[E>>2]|0;Z=-+g[F>>2];f=c[o>>2]|0;yc(H,h,a,a,U,Z,Z,f,f,0,0);f=0;while(1){if((f|0)>=(p|0))break;g[s+(f+2048<<2)>>2]=+g[u+(f<<2)>>2]*+g[H+(q-f<<2)>>2]+ +g[u+(U-f+-1<<2)>>2]*+g[H+(f<<2)>>2];f=f+1|0}t=t+1|0}while((t|0)<(V|0));Na(G|0);W=T+1|0;c[S>>2]=W;i=X;return}f=c[a+24>>2]|0;s=c[A+12>>2]|0;k=(f|0)<(s|0);s=(x|0)>((k?f:s)|0)?x:k?f:s;k=_(V,d)|0;t=Fa()|0;u=i;i=i+((1*(k<<2)|0)+15&-16)|0;j=(T|0)==0?1.5:.5;k=0;do{h=_(k,n)|0;l=x;while(1){if((l|0)>=(f|0))break;R=h+l|0;Y=+g[m+(R<<2)>>2];R=w+(R<<2)|0;Z=+g[R>>2]-j;g[R>>2]=Y>Z?Y:Z;l=l+1|0}k=k+1|0}while((k|0)<(V|0));o=a+36|0;q=0;f=c[o>>2]|0;while(1){if((q|0)>=(V|0))break;p=_(q,d)|0;h=x;b:while(1){if((h|0)>=(s|0))break;n=b[y+(h<<1)>>1]|0;l=p+(n<>1]|0)-n<=(n|0))break;R=(_(f,1664525)|0)+1013904223|0;g[u+(l+k<<2)>>2]=+(R>>20|0);k=k+1|0;f=R}m=u+(l<<2)|0;k=0;j=0.0;while(1){if((k|0)>=(n|0))break;Z=+g[m+(k<<2)>>2];k=k+1|0;j=j+Z*Z}j=1.0/+O(+(j+1.0000000036274937e-15));l=0;k=m;while(1){if((l|0)>=(n|0))continue b;g[k>>2]=j*+g[k>>2];l=l+1|0;k=k+4|0}}q=q+1|0}c[o>>2]=f;f=2048-d+(U>>>1)<<2;h=0;do{U=c[W+(h<<2)>>2]|0;sf(U|0,U+(d<<2)|0,f|0)|0;h=h+1|0}while((h|0)<(V|0));_c(A,u,z,w,x,s,V,V,0,e,c[a+16>>2]|0,0);Na(t|0);W=T+1|0;c[S>>2]=W;i=X;return}function _c(a,b,d,e,f,h,j,k,l,m,n,o){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;h=h|0;j=j|0;k=k|0;l=l|0;m=m|0;n=n|0;o=o|0;var p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0;C=i;A=c[a+4>>2]|0;t=c[a+8>>2]|0;u=a+44|0;r=c[u>>2]|0;w=r<>2]|0)-(x?m:0)|0;switch(k|0){case 2:{if((j|0)==1){Xd(c[a+32>>2]|0,r,b,B,e,f,h,v,n,o);q=d+4|0;j=(c[q>>2]|0)+(((A|0)/2|0)<<2)|0;rf(j|0,B|0,w<<2|0)|0;p=a+64|0;m=a+60|0;l=0;while(1){if((l|0)>=(y|0)){l=0;break}w=(c[d>>2]|0)+((_(z,l)|0)<<2)|0;fd(p,j+(l<<2)|0,w,c[m>>2]|0,A,x,y);l=l+1|0}while(1){if((l|0)>=(y|0))break;d=(c[q>>2]|0)+((_(z,l)|0)<<2)|0;fd(p,B+(l<<2)|0,d,c[m>>2]|0,A,x,y);l=l+1|0}i=C;return}break}case 1:{if((j|0)==2){m=(c[d>>2]|0)+(((A|0)/2|0)<<2)|0;l=a+32|0;Xd(c[l>>2]|0,r,b,B,e,f,h,v,n,o);Xd(c[l>>2]|0,c[u>>2]|0,b+(w<<2)|0,m,e+(t<<2)|0,f,h,v,n,o);l=0;while(1){if((l|0)>=(w|0))break;f=B+(l<<2)|0;g[f>>2]=+g[f>>2]*.5+ +g[m+(l<<2)>>2]*.5;l=l+1|0}j=a+64|0;l=a+60|0;m=0;while(1){if((m|0)>=(y|0))break;w=(c[d>>2]|0)+((_(z,m)|0)<<2)|0;fd(j,B+(m<<2)|0,w,c[l>>2]|0,A,x,y);m=m+1|0}i=C;return}break}default:{}}s=a+32|0;q=a+64|0;p=a+60|0;l=0;m=r;while(1){a=b+((_(l,w)|0)<<2)|0;j=e+((_(l,t)|0)<<2)|0;Xd(c[s>>2]|0,m,a,B,j,f,h,v,n,o);m=d+(l<<2)|0;j=0;while(1){if((j|0)>=(y|0))break;a=(c[m>>2]|0)+((_(z,j)|0)<<2)|0;fd(q,B+(j<<2)|0,a,c[p>>2]|0,A,x,y);j=j+1|0}l=l+1|0;if((l|0)>=(k|0))break;m=c[u>>2]|0}i=C;return}function $c(a,b,d,e,f,h,j,k){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;h=h|0;j=j|0;k=k|0;var l=0,m=0.0,n=0.0,o=0.0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0.0,z=0.0;x=i;if((f|0)==1&(e|0)==2&(k|0)==0){o=+g[h>>2];p=c[a>>2]|0;k=c[a+4>>2]|0;h=j+4|0;l=0;m=+g[j>>2];n=+g[h>>2];while(1){if((l|0)>=(d|0))break;z=+g[p+(l<<2)>>2]+1.0000000031710769e-30+m;y=+g[k+(l<<2)>>2]+1.0000000031710769e-30+n;a=l<<1;g[b+(a<<2)>>2]=z*.000030517578125;g[b+((a|1)<<2)>>2]=y*.000030517578125;l=l+1|0;m=z*o;n=y*o}g[j>>2]=m;g[h>>2]=n;i=x;return}v=Fa()|0;w=i;i=i+((1*(d<<2)|0)+15&-16)|0;n=+g[h>>2];r=(d|0)/(f|0)|0;s=(f|0)>1;k=0;t=0;do{l=j+(t<<2)|0;m=+g[l>>2];p=c[a+(t<<2)>>2]|0;q=b+(t<<2)|0;if(!s){h=0;while(1){if((h|0)>=(d|0))break;z=+g[p+(h<<2)>>2]+1.0000000031710769e-30+m;g[q+((_(h,e)|0)<<2)>>2]=z*.000030517578125;h=h+1|0;m=n*z}g[l>>2]=m;if(!k)k=0;else u=14}else{k=0;while(1){if((k|0)>=(d|0))break;z=+g[p+(k<<2)>>2]+1.0000000031710769e-30+m;g[w+(k<<2)>>2]=z;k=k+1|0;m=n*z}g[l>>2]=m;k=1;u=14}a:do if((u|0)==14){u=0;h=0;while(1){if((h|0)>=(r|0))break a;g[q+((_(h,e)|0)<<2)>>2]=+g[w+((_(h,f)|0)<<2)>>2]*.000030517578125;h=h+1|0}}while(0);t=t+1|0}while((t|0)<(e|0));Na(v|0);i=x;return}function ad(a,b,e,f){a=a|0;b=b|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0;g=c[a+36>>2]|0;f=_(g,f-e|0)|0;n=a+32|0;h=(c[n>>2]|0)-f|0;c[n>>2]=h;if(!b){l=a+28|0;m=l;f=(c[l>>2]|0)-f|0}else{m=a+28|0;f=_(g,e-b|0)|0}c[m>>2]=f;i=a+20|0;j=a+40|0;k=a+24|0;l=a+4|0;b=h;while(1){if(f>>>0>=8388609)break;c[i>>2]=(c[i>>2]|0)+8;f=f<<8;c[m>>2]=f;e=c[j>>2]|0;g=c[k>>2]|0;if(g>>>0<(c[l>>2]|0)>>>0){c[k>>2]=g+1;g=d[(c[a>>2]|0)+g>>0]|0}else g=0;c[j>>2]=g;h=((e<<8|g)>>>1&255|b<<8&2147483392)^255;c[n>>2]=h;b=h}return}function bd(a,b){a=a|0;b=b|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0;o=b+-1|0;e=32-(aa(o|0)|0)|0;if((e|0)<=8){m=a+28|0;j=c[m>>2]|0;h=(j>>>0)/(b>>>0)|0;c[a+36>>2]=h;n=a+32|0;l=c[n>>2]|0;k=((l>>>0)/(h>>>0)|0)+1|0;k=k>>>0>b>>>0?b:k;e=b-k|0;i=_(h,b-(e+1)|0)|0;l=l-i|0;c[n>>2]=l;b=(k|0)==(b|0)?j-i|0:h;c[m>>2]=b;h=a+20|0;i=a+40|0;j=a+24|0;k=a+4|0;while(1){if(b>>>0>=8388609)break;c[h>>2]=(c[h>>2]|0)+8;b=b<<8;c[m>>2]=b;g=c[i>>2]|0;f=c[j>>2]|0;if(f>>>0<(c[k>>2]|0)>>>0){c[j>>2]=f+1;f=d[(c[a>>2]|0)+f>>0]|0}else f=0;c[i>>2]=f;o=((g<<8|f)>>>1&255|l<<8&2147483392)^255;c[n>>2]=o;l=o}return e|0}n=e+-8|0;l=(o>>>n)+1|0;k=((c[a+28>>2]|0)>>>0)/(l>>>0)|0;c[a+36>>2]=k;k=(((c[a+32>>2]|0)>>>0)/(k>>>0)|0)+1|0;k=l-(l>>>0>>0?l:k)|0;ad(a,k,k+1|0,l);k=k<>2]|0;m=a+16|0;b=c[m>>2]|0;if(b>>>0>>0){i=a+8|0;h=c[a+4>>2]|0;j=b+8|0;j=b+(((j|0)>25?j:25)+-1-b&-8)|0;f=c[i>>2]|0;do{if(f>>>0>>0){g=f+1|0;c[i>>2]=g;f=g;g=d[(c[a>>2]|0)+(h-g)>>0]|0}else g=0;e=e|g<>2]=e>>>n;c[m>>2]=b-n;m=a+20|0;c[m>>2]=(c[m>>2]|0)+n;e=k|e&(1<>>0<=o>>>0){a=e;return a|0}c[a+44>>2]=1;a=o;return a|0}function cd(b){b=b|0;var e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0;s=c[b+28>>2]|0;h=aa(s|0)|0;e=2147483647>>>h;f=c[b+32>>2]|0;g=f+e&~e;if((g|e)>>>0>=(f+s|0)>>>0){g=e>>>1;g=f+g&~g;h=h+1|0}m=b+36|0;n=b+40|0;r=b+24|0;o=b+8|0;p=b+4|0;s=b+44|0;q=h+7&-8;k=h;while(1){if((k|0)<=0)break;j=g>>>23;if((j|0)==255)c[m>>2]=(c[m>>2]|0)+1;else{i=g>>>31;e=c[n>>2]|0;if((e|0)>-1){f=c[r>>2]|0;if((f+(c[o>>2]|0)|0)>>>0<(c[p>>2]|0)>>>0){c[r>>2]=f+1;a[(c[b>>2]|0)+f>>0]=e+i;e=0}else e=-1;c[s>>2]=c[s>>2]|e}e=c[m>>2]|0;if(e|0){i=i+255&255;do{f=c[r>>2]|0;if((f+(c[o>>2]|0)|0)>>>0<(c[p>>2]|0)>>>0){c[r>>2]=f+1;a[(c[b>>2]|0)+f>>0]=i;f=0;e=c[m>>2]|0}else f=-1;c[s>>2]=c[s>>2]|f;e=e+-1|0;c[m>>2]=e}while((e|0)!=0)}c[n>>2]=j&255}g=g<<8&2147483392;k=k+-8|0}f=c[n>>2]|0;if((f|0)>-1){e=c[r>>2]|0;if((e+(c[o>>2]|0)|0)>>>0<(c[p>>2]|0)>>>0){c[r>>2]=e+1;a[(c[b>>2]|0)+e>>0]=f;e=0}else e=-1;c[s>>2]=c[s>>2]|e;e=c[m>>2]|0;if(!e)l=26;else l=23}else{e=c[m>>2]|0;if(e|0)l=23}if((l|0)==23)while(1){f=c[r>>2]|0;if((f+(c[o>>2]|0)|0)>>>0<(c[p>>2]|0)>>>0){c[r>>2]=f+1;a[(c[b>>2]|0)+f>>0]=-1;f=0;e=c[m>>2]|0}else f=-1;c[s>>2]=c[s>>2]|f;e=e+-1|0;c[m>>2]=e;if(!e){l=26;break}else l=23}if((l|0)==26)c[n>>2]=0;j=c[b+16>>2]|0;i=j+~((j|0)<7?j:7)+8&-8;k=j;e=c[b+12>>2]|0;while(1){if((k|0)<=7)break;f=c[o>>2]|0;g=c[p>>2]|0;if(((c[r>>2]|0)+f|0)>>>0>>0){f=f+1|0;c[o>>2]=f;a[(c[b>>2]|0)+(g-f)>>0]=e;f=0}else f=-1;c[s>>2]=c[s>>2]|f;k=k+-8|0;e=e>>>8}i=j-i|0;if(c[s>>2]|0)return;n=c[r>>2]|0;nf((c[b>>2]|0)+n|0,0,(c[p>>2]|0)-n-(c[o>>2]|0)|0)|0;if((i|0)<=0)return;j=c[o>>2]|0;g=c[p>>2]|0;if(g>>>0<=j>>>0){c[s>>2]=-1;return}f=q-h|0;if((i|0)>(f|0)?((c[r>>2]|0)+j|0)>>>0>=g>>>0:0){c[s>>2]=-1;e=e&(1<>2]|0)+(g-j+-1)|0;a[b>>0]=d[b>>0]|0|e;return}function dd(a,d){a=a|0;d=d|0;var e=0,f=0,h=0,j=0,k=0,l=0.0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0.0,v=0.0,w=0.0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0.0,F=0.0,G=0.0,H=0.0,I=0.0,J=0.0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0.0,R=0.0,S=0.0,T=0.0,U=0.0,V=0.0,W=0.0,X=0.0;D=i;i=i+32|0;C=D;B=c[a+8>>2]|0;B=(B|0)>0?B:0;c[C>>2]=1;e=1;f=0;while(1){h=f<<1;A=b[a+12+((h|1)<<1)>>1]|0;e=_(e,b[a+12+(h<<1)>>1]|0)|0;h=f+1|0;c[C+(h<<2)>>2]=e;if(A<<16>>16==1)break;else f=h}A=a+48|0;y=b[a+12+((h<<1)+-1<<1)>>1]|0;while(1){if((f|0)<=-1)break;e=f<<1;if(!f)z=1;else z=b[a+12+(e+-1<<1)>>1]|0;a:do switch(b[a+12+(e<<1)>>1]|0){case 2:{h=c[C+(f<<2)>>2]|0;e=d;j=0;while(1){if((j|0)>=(h|0))break a;x=e+32|0;v=+g[x>>2];y=e+36|0;u=+g[y>>2];l=+g[e>>2];g[x>>2]=l-v;x=e+4|0;w=+g[x>>2];g[y>>2]=w-u;g[e>>2]=l+v;g[x>>2]=w+u;x=e+40|0;u=+g[x>>2];y=e+44|0;w=+g[y>>2];v=(u+w)*.7071067690849304;u=(w-u)*.7071067690849304;t=e+8|0;w=+g[t>>2];g[x>>2]=w-v;x=e+12|0;l=+g[x>>2];g[y>>2]=l-u;g[t>>2]=w+v;g[x>>2]=l+u;x=e+52|0;u=+g[x>>2];t=e+48|0;l=+g[t>>2];y=e+16|0;v=+g[y>>2];g[t>>2]=v-u;t=e+20|0;w=+g[t>>2];g[x>>2]=w+l;g[y>>2]=v+u;g[t>>2]=w-l;t=e+60|0;l=+g[t>>2];y=e+56|0;w=+g[y>>2];u=(l-w)*.7071067690849304;w=(l+w)*-.7071067690849304;x=e+24|0;l=+g[x>>2];g[y>>2]=l-u;y=e+28|0;v=+g[y>>2];g[t>>2]=v-w;g[x>>2]=l+u;g[y>>2]=v+w;e=e+64|0;j=j+1|0}}case 4:{t=c[C+(f<<2)>>2]|0;n=t<=(t|0))break a;w=+g[e>>2];o=e+16|0;J=+g[o>>2];l=w-J;q=e+4|0;F=+g[q>>2];p=e+20|0;H=+g[p>>2];v=F-H;J=w+J;H=F+H;r=e+8|0;F=+g[r>>2];x=e+24|0;w=+g[x>>2];I=F+w;s=e+12|0;E=+g[s>>2];y=e+28|0;u=+g[y>>2];G=E+u;g[o>>2]=J-I;g[p>>2]=H-G;g[e>>2]=J+I;g[q>>2]=H+G;w=F-w;u=E-u;g[r>>2]=l+u;g[s>>2]=v-w;g[x>>2]=l-u;g[y>>2]=v+w;e=e+32|0;h=h+1|0}}h=y<<1;j=y*3|0;k=n<<1;m=n*3|0;o=0;while(1){if((o|0)>=(t|0))break a;e=d+((_(o,z)|0)<<3)|0;s=c[A>>2]|0;p=0;q=s;r=s;while(1){if((p|0)>=(y|0))break;M=e+(y<<3)|0;E=+g[M>>2];u=+g[q>>2];L=e+(y<<3)+4|0;F=+g[L>>2];w=+g[q+4>>2];l=E*u-F*w;u=E*w+F*u;P=e+(h<<3)|0;F=+g[P>>2];w=+g[r>>2];O=e+(h<<3)+4|0;E=+g[O>>2];H=+g[r+4>>2];v=F*w-E*H;w=F*H+E*w;K=e+(j<<3)|0;E=+g[K>>2];H=+g[s>>2];x=e+(j<<3)+4|0;F=+g[x>>2];G=+g[s+4>>2];J=E*H-F*G;H=E*G+F*H;F=+g[e>>2];G=F-v;N=e+4|0;E=+g[N>>2];I=E-w;v=F+v;g[e>>2]=v;w=E+w;g[N>>2]=w;E=l+J;F=u+H;J=l-J;H=u-H;g[P>>2]=v-E;g[O>>2]=w-F;g[e>>2]=+g[e>>2]+E;g[N>>2]=+g[N>>2]+F;g[M>>2]=G+H;g[L>>2]=I-J;g[K>>2]=G-H;g[x>>2]=I+J;e=e+8|0;p=p+1|0;q=q+(n<<3)|0;r=r+(k<<3)|0;s=s+(m<<3)|0}o=o+1|0}}case 3:{h=c[C+(f<<2)>>2]|0;j=h<>2]|0)+(m<<3)+4>>2];m=j<<1;n=0;while(1){if((n|0)>=(h|0))break a;e=d+((_(n,z)|0)<<3)|0;q=c[A>>2]|0;o=y;p=q;while(1){O=e+(y<<3)|0;G=+g[O>>2];F=+g[p>>2];P=e+(y<<3)+4|0;w=+g[P>>2];I=+g[p+4>>2];E=G*F-w*I;F=G*I+w*F;M=e+(k<<3)|0;w=+g[M>>2];I=+g[q>>2];N=e+(k<<3)+4|0;G=+g[N>>2];H=+g[q+4>>2];J=w*I-G*H;I=w*H+G*I;G=E+J;H=F+I;g[O>>2]=+g[e>>2]-G*.5;L=e+4|0;g[P>>2]=+g[L>>2]-H*.5;J=(E-J)*l;I=(F-I)*l;g[e>>2]=+g[e>>2]+G;g[L>>2]=+g[L>>2]+H;g[M>>2]=+g[O>>2]+I;g[N>>2]=+g[P>>2]-J;g[O>>2]=+g[O>>2]-I;g[P>>2]=+g[P>>2]+J;o=o+-1|0;if(!o)break;else{e=e+8|0;p=p+(j<<3)|0;q=q+(m<<3)|0}}n=n+1|0}}case 5:{e=c[C+(f<<2)>>2]|0;h=e<>2]|0;l=+g[j+(k<<3)>>2];u=+g[j+(k<<3)+4>>2];k=_(h<<1,y)|0;v=+g[j+(k<<3)>>2];w=+g[j+(k<<3)+4>>2];k=y<<1;m=y*3|0;n=y<<2;t=0;while(1){if((t|0)>=(e|0))break a;s=d+((_(t,z)|0)<<3)|0;o=s;p=s+(y<<3)|0;q=s+(k<<3)|0;r=s+(m<<3)|0;s=s+(n<<3)|0;x=0;while(1){if((x|0)>=(y|0))break;T=+g[o>>2];L=o+4|0;R=+g[L>>2];S=+g[p>>2];K=_(x,h)|0;G=+g[j+(K<<3)>>2];M=p+4|0;W=+g[M>>2];X=+g[j+(K<<3)+4>>2];I=S*G-W*X;G=S*X+W*G;W=+g[q>>2];K=_(x<<1,h)|0;X=+g[j+(K<<3)>>2];O=q+4|0;S=+g[O>>2];E=+g[j+(K<<3)+4>>2];V=W*X-S*E;X=W*E+S*X;S=+g[r>>2];K=_(x*3|0,h)|0;E=+g[j+(K<<3)>>2];P=r+4|0;W=+g[P>>2];H=+g[j+(K<<3)+4>>2];J=S*E-W*H;E=S*H+W*E;W=+g[s>>2];K=_(x<<2,h)|0;H=+g[j+(K<<3)>>2];N=s+4|0;S=+g[N>>2];Q=+g[j+(K<<3)+4>>2];F=W*H-S*Q;H=W*Q+S*H;S=I+F;Q=G+H;F=I-F;H=G-H;G=V+J;I=X+E;J=V-J;E=X-E;g[o>>2]=T+(S+G);g[L>>2]=R+(Q+I);X=T+(S*l+G*v);V=R+(Q*l+I*v);W=H*u+E*w;U=F*u+J*w;g[p>>2]=X-W;g[M>>2]=V+U;g[s>>2]=X+W;g[N>>2]=V-U;G=T+(S*v+G*l);I=R+(Q*v+I*l);H=E*u-H*w;J=F*w-J*u;g[q>>2]=G+H;g[O>>2]=I+J;g[r>>2]=G-H;g[P>>2]=I-J;o=o+8|0;p=p+8|0;q=q+8|0;r=r+8|0;s=s+8|0;x=x+1|0}t=t+1|0}}default:{}}while(0);f=f+-1|0;y=z}i=D;return}function ed(a,d,e,f,h,j,k){a=a|0;d=d|0;e=e|0;f=f|0;h=h|0;j=j|0;k=k|0;var l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0.0,v=0,w=0,x=0,y=0,z=0.0,A=0.0,B=0.0,C=0.0;y=i;t=c[a+8+(j<<2)>>2]|0;u=+g[t+4>>2];l=c[a>>2]|0;m=0;x=c[a+24>>2]|0;while(1){w=l>>1;if((m|0)>=(j|0))break;l=w;m=m+1|0;x=x+(w<<2)|0}v=l>>2;a=i;i=i+((1*(w<<2)|0)+15&-16)|0;l=i;i=i+((1*(v<<3)|0)+15&-16)|0;j=h>>1;q=f+(j<<2)|0;r=h+3>>2;s=0-w|0;o=0;p=q;q=q+-4|0;n=d+(j<<2)|0;j=d+(w<<2)+-4+(j<<2)|0;m=a;while(1){if((o|0)>=(r|0))break;z=+g[q>>2];A=+g[p>>2];g[m>>2]=z*+g[n+(w<<2)>>2]+A*+g[j>>2];g[m+4>>2]=A*+g[n>>2]-z*+g[j+(s<<2)>>2];o=o+1|0;p=p+8|0;q=q+-8|0;n=n+8|0;j=j+-8|0;m=m+8|0}d=f+(h<<2)|0;p=v-r|0;while(1){if((o|0)>=(p|0))break;c[m>>2]=c[j>>2];c[m+4>>2]=c[n>>2];o=o+1|0;n=n+8|0;j=j+-8|0;m=m+8|0}q=o;p=f;o=d+-4|0;while(1){if((q|0)>=(v|0))break;g[m>>2]=+g[o>>2]*+g[j>>2]-+g[p>>2]*+g[n+(s<<2)>>2];g[m+4>>2]=+g[o>>2]*+g[n>>2]+ +g[p>>2]*+g[j+(w<<2)>>2];q=q+1|0;p=p+8|0;o=o+-8|0;n=n+8|0;j=j+-8|0;m=m+8|0}m=t+44|0;j=0;while(1){if((j|0)>=(v|0))break;B=+g[x+(j<<2)>>2];A=+g[x+(v+j<<2)>>2];z=+g[a>>2];C=+g[a+4>>2];s=b[(c[m>>2]|0)+(j<<1)>>1]|0;g[l+(s<<3)>>2]=u*(z*B-C*A);g[l+(s<<3)+4>>2]=u*(C*B+z*A);j=j+1|0;a=a+8|0}dd(t,l);n=k<<1;o=0-n|0;m=0;j=e;a=e+((_(w+-1|0,k)|0)<<2)|0;while(1){if((m|0)>=(v|0))break;B=+g[l+4>>2];A=+g[x+(v+m<<2)>>2];z=+g[l>>2];C=+g[x+(m<<2)>>2];g[j>>2]=B*A-z*C;g[a>>2]=z*A+B*C;l=l+8|0;m=m+1|0;j=j+(n<<2)|0;a=a+(o<<2)|0}i=y;return}function fd(a,d,e,f,h,i,j){a=a|0;d=d|0;e=e|0;f=f|0;h=h|0;i=i|0;j=j|0;var k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0.0,u=0.0,v=0.0,w=0.0,x=0.0,y=0.0;k=c[a>>2]|0;l=0;r=c[a+24>>2]|0;while(1){q=k>>1;if((l|0)>=(i|0))break;k=q;l=l+1|0;r=r+(q<<2)|0}p=k>>2;s=d+((_(q+-1|0,j)|0)<<2)|0;k=e+(h>>1<<2)|0;o=c[a+8+(i<<2)>>2]|0;i=j<<1;j=0-i|0;m=c[o+44>>2]|0;n=0;l=d;a=s;while(1){if((n|0)>=(p|0))break;u=+g[a>>2];v=+g[r+(n<<2)>>2];w=+g[l>>2];t=+g[r+(p+n<<2)>>2];s=b[m>>1]<<1;g[k+((s|1)<<2)>>2]=u*v+w*t;g[k+(s<<2)>>2]=w*v-u*t;m=m+2|0;n=n+1|0;l=l+(i<<2)|0;a=a+(j<<2)|0}dd(o,k);i=p+1>>1;a=k+(q<<2)|0;j=0;while(1){l=a+-8|0;if((j|0)>=(i|0))break;s=k+4|0;y=+g[s>>2];u=+g[k>>2];w=+g[r+(j<<2)>>2];x=+g[r+(p+j<<2)>>2];d=a+-4|0;t=+g[d>>2];v=+g[l>>2];g[k>>2]=y*w+u*x;g[d>>2]=y*x-u*w;w=+g[r+(p-j+-1<<2)>>2];u=+g[r+(q-j+-1<<2)>>2];g[l>>2]=t*w+v*u;g[s>>2]=t*u-v*w;a=l;j=j+1|0;k=k+8|0}i=(h|0)/2|0;k=e+(h<<2)|0;l=f+(h<<2)|0;a=0;while(1){l=l+-4|0;k=k+-4|0;if((a|0)>=(i|0))break;y=+g[k>>2];w=+g[e>>2];x=+g[l>>2];v=+g[f>>2];g[e>>2]=x*w-v*y;g[k>>2]=v*w+x*y;a=a+1|0;f=f+4|0;e=e+4|0}return}function gd(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0.0,h=0,j=0.0,k=0.0,l=0.0,m=0.0,n=0.0,o=0.0,p=0.0,q=0.0,r=0.0,s=0,t=0,u=0,v=0,w=0,x=0.0,y=0.0;u=i;i=i+48|0;h=u+16|0;s=u;t=d>>1;d=1;while(1){if((d|0)>=(t|0))break;v=d<<1;w=c[a>>2]|0;g[b+(d<<2)>>2]=((+g[w+(v+-1<<2)>>2]+ +g[w+((v|1)<<2)>>2])*.5+ +g[w+(v<<2)>>2])*.5;d=d+1|0}w=c[a>>2]|0;g[b>>2]=(+g[w+4>>2]*.5+ +g[w>>2])*.5;if((e|0)==2){d=a+4|0;e=1;while(1){if((e|0)>=(t|0))break;v=e<<1;a=c[d>>2]|0;w=b+(e<<2)|0;g[w>>2]=+g[w>>2]+((+g[a+(v+-1<<2)>>2]+ +g[a+((v|1)<<2)>>2])*.5+ +g[a+(v<<2)>>2])*.5;e=e+1|0}w=c[d>>2]|0;g[b>>2]=+g[b>>2]+(+g[w+4>>2]*.5+ +g[w>>2])*.5}pd(b,h,0,0,4,t);g[h>>2]=+g[h>>2]*1.000100016593933;d=1;while(1){if((d|0)==5)break;w=h+(d<<2)|0;q=+g[w>>2];r=+(d|0)*.00800000037997961;g[w>>2]=q-q*r*r;d=d+1|0}ld(s,h,4);d=0;f=1.0;while(1){if((d|0)==4)break;r=f*.8999999761581421;w=s+(d<<2)|0;g[w>>2]=+g[w>>2]*r;d=d+1|0;f=r}q=+g[s>>2];p=q+.800000011920929;r=+g[s+4>>2];q=r+q*.800000011920929;f=+g[s+8>>2];r=f+r*.800000011920929;j=+g[s+12>>2];f=j+f*.800000011920929;j=j*.800000011920929;d=0;k=0.0;l=0.0;m=0.0;n=0.0;o=0.0;while(1){if((d|0)>=(t|0))break;w=b+(d<<2)|0;y=+g[w>>2];g[w>>2]=y+p*k+q*l+r*m+f*n+j*o;x=k;d=d+1|0;k=y;o=n;n=m;m=l;l=x}i=u;return}function hd(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var h=0,i=0,j=0,l=0.0,m=0,n=0,o=0,p=0,q=0,r=0.0,s=0.0,t=0.0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0.0,C=0.0,D=0.0,E=0.0,F=0.0,G=0,H=0,I=0.0,J=0.0,K=0.0,L=0.0,M=0.0;u=f+-3|0;v=e+-3|0;y=((v|0)>0?v:0)+3|0;w=y&-4;z=a+(w<<2)|0;j=f+-3|0;j=((j|0)>0?j:0)+3&-4;x=0;y=b+((y|3)<<2)|0;while(1){if((x|0)>=(u|0))break;A=b+(x<<2)|0;o=a;p=A+12|0;q=0;n=0;m=0;i=0;h=0;l=+g[A>>2];s=+g[A+4>>2];t=+g[A+8>>2];r=0.0;while(1){if((q|0)>=(v|0))break;F=+g[o>>2];r=+g[p>>2];M=(c[k>>2]=n,+g[k>>2])+F*l;L=(c[k>>2]=m,+g[k>>2])+F*s;K=(c[k>>2]=i,+g[k>>2])+F*t;J=+g[o+4>>2];D=+g[p+4>>2];I=+g[o+8>>2];C=+g[p+8>>2];F=(c[k>>2]=h,+g[k>>2])+F*r+J*D+I*C;E=+g[o+12>>2];B=+g[p+12>>2];H=(g[k>>2]=M+J*s+I*t+E*r,c[k>>2]|0);G=(g[k>>2]=L+J*t+I*r+E*D,c[k>>2]|0);A=(g[k>>2]=K+J*r+I*D+E*C,c[k>>2]|0);o=o+16|0;p=p+16|0;q=q+4|0;n=H;m=G;i=A;h=(g[k>>2]=F+E*B,c[k>>2]|0);l=D;s=C;t=B}q=w|1;if((w|0)<(e|0)){M=+g[z>>2];r=+g[y>>2];n=(g[k>>2]=(c[k>>2]=n,+g[k>>2])+M*l,c[k>>2]|0);m=(g[k>>2]=(c[k>>2]=m,+g[k>>2])+M*s,c[k>>2]|0);i=(g[k>>2]=(c[k>>2]=i,+g[k>>2])+M*t,c[k>>2]|0);o=z+4|0;p=y+4|0;h=(g[k>>2]=(c[k>>2]=h,+g[k>>2])+M*r,c[k>>2]|0)}else{o=z;p=y}if((q|0)<(e|0)){M=+g[o>>2];l=+g[p>>2];n=(g[k>>2]=(c[k>>2]=n,+g[k>>2])+M*s,c[k>>2]|0);m=(g[k>>2]=(c[k>>2]=m,+g[k>>2])+M*t,c[k>>2]|0);i=(g[k>>2]=(c[k>>2]=i,+g[k>>2])+M*r,c[k>>2]|0);o=o+4|0;p=p+4|0;h=(g[k>>2]=(c[k>>2]=h,+g[k>>2])+M*l,c[k>>2]|0)}if((q+1|0)<(e|0)){M=+g[o>>2];n=(g[k>>2]=(c[k>>2]=n,+g[k>>2])+M*t,c[k>>2]|0);m=(g[k>>2]=(c[k>>2]=m,+g[k>>2])+M*r,c[k>>2]|0);i=(g[k>>2]=(c[k>>2]=i,+g[k>>2])+M*l,c[k>>2]|0);h=(g[k>>2]=(c[k>>2]=h,+g[k>>2])+M*+g[p>>2],c[k>>2]|0)}c[d+(x<<2)>>2]=n;c[d+((x|1)<<2)>>2]=m;c[d+((x|2)<<2)>>2]=i;c[d+((x|3)<<2)>>2]=h;x=x+4|0;y=y+16|0}while(1){if((j|0)>=(f|0))break;h=b+(j<<2)|0;i=0;l=0.0;while(1){if((i|0)>=(e|0))break;M=l+ +g[a+(i<<2)>>2]*+g[h+(i<<2)>>2];i=i+1|0;l=M}g[d+(j<<2)>>2]=l;j=j+1|0}return}function id(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var h=0.0,j=0.0,k=0.0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0;u=i;i=i+16|0;r=u;m=r;c[m>>2]=0;c[m+4>>2]=0;m=d>>2;n=i;i=i+((1*(m<<2)|0)+15&-16)|0;o=d+e>>2;p=i;i=i+((1*(o<<2)|0)+15&-16)|0;s=e>>1;t=i;i=i+((1*(s<<2)|0)+15&-16)|0;l=0;while(1){if((l|0)>=(m|0))break;c[n+(l<<2)>>2]=c[a+(l<<1<<2)>>2];l=l+1|0}l=0;while(1){if((l|0)>=(o|0))break;c[p+(l<<2)>>2]=c[b+(l<<1<<2)>>2];l=l+1|0}e=e>>2;hd(n,p,t,m,e);jd(t,p,m,e,r);e=c[r>>2]<<1;q=c[r+4>>2]<<1;l=d>>1;o=0;while(1){if((o|0)>=(s|0))break;m=t+(o<<2)|0;g[m>>2]=0.0;d=o-e|0;if(!((((d|0)>-1?d:0-d|0)|0)>2?(d=o-q|0,(((d|0)>-1?d:0-d|0)|0)>2):0)){n=b+(o<<2)|0;p=0;h=0.0;while(1){if((p|0)>=(l|0))break;k=h+ +g[a+(p<<2)>>2]*+g[n+(p<<2)>>2];p=p+1|0;h=k}g[m>>2]=h<-1.0?-1.0:h}o=o+1|0}jd(t,b,l,s,r);l=c[r>>2]|0;if(!((l|0)>0&(l|0)<(s+-1|0))){t=0;s=l<<1;t=s-t|0;c[f>>2]=t;i=u;return}j=+g[t+(l+-1<<2)>>2];k=+g[t+(l<<2)>>2];h=+g[t+(l+1<<2)>>2];if(h-j>(k-j)*.699999988079071){t=1;s=l<<1;t=s-t|0;c[f>>2]=t;i=u;return}if(j-h>(k-h)*.699999988079071){t=-1;s=l<<1;t=s-t|0;c[f>>2]=t;i=u;return}t=0;s=l<<1;t=s-t|0;c[f>>2]=t;i=u;return}function jd(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var h=0,i=0.0,j=0.0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0.0,u=0.0;c[f>>2]=0;s=f+4|0;c[s>>2]=1;i=1.0;h=0;while(1){if((h|0)>=(d|0)){h=0;p=0;l=0;q=-1082130432;m=-1082130432;r=0;break}j=+g[b+(h<<2)>>2];i=i+j*j;h=h+1|0}while(1){if((r|0)>=(e|0))break;j=+g[a+(r<<2)>>2];do if(j>0.0?(t=j*9.999999960041972e-13,t=t*t,j=t*(c[k>>2]=l,+g[k>>2]),j>(c[k>>2]=m,+g[k>>2])*i):0){j=t*(c[k>>2]=p,+g[k>>2]);if(j>(c[k>>2]=q,+g[k>>2])*i){c[s>>2]=h;o=(g[k>>2]=t,c[k>>2]|0);n=(g[k>>2]=i,c[k>>2]|0);c[f>>2]=r;h=r;l=p;m=q;break}else{m=(g[k>>2]=t,c[k>>2]|0);l=(g[k>>2]=i,c[k>>2]|0);c[s>>2]=r;n=p;o=q;break}}else{n=p;o=q}while(0);u=+g[b+(r+d<<2)>>2];j=+g[b+(r<<2)>>2];j=i+(u*u-j*j);i=j<1.0?1.0:j;p=n;q=o;r=r+1|0}return}function kd(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=+f;var h=0.0,j=0.0,k=0.0,l=0.0,m=0.0,n=0,o=0.0,p=0,q=0.0,r=0,s=0,t=0.0,u=0.0,v=0.0,w=0,x=0,y=0.0,z=0,A=0.0,B=0,C=0,D=0,E=0,F=0;F=i;i=i+2064|0;E=F+2052|0;w=c[d>>2]|0;z=(e|0)/2|0;D=(b|0)/2|0;C=a+2048|0;w=(w|0)>1023?511:(w|0)/2|0;c[d>>2]=w;x=F;e=C+(0-w<<2)|0;b=0;y=0.0;j=0.0;while(1){if((b|0)>=(D|0))break;v=+g[C+(b<<2)>>2];A=j+v*+g[e+(b<<2)>>2];b=b+1|0;y=y+v*v;j=A}g[x>>2]=y;e=1;h=y;while(1){if((e|0)==513)break;v=+g[C+(0-e<<2)>>2];A=+g[C+(D-e<<2)>>2];A=h+v*v-A*A;g[x+(e<<2)>>2]=A<0.0?0.0:A;e=e+1|0;h=A}q=+g[x+(w<<2)>>2];A=j/+O(+(y*q+1.0));s=w<<1;t=A*.699999988079071;u=A*.8500000238418579;v=f*.5;B=w;r=2;while(1){if((r|0)>=16)break;e=r<<1;p=((s+r|0)>>>0)/(e>>>0)|0;if((p|0)<7)break;if((r|0)==2){n=p+w|0;n=(n|0)>512?w:n}else n=(((_(c[17156+(r<<2)>>2]<<1,w)|0)+r|0)>>>0)/(e>>>0)|0;e=C+(0-p<<2)|0;b=C+(0-n<<2)|0;a=0;h=0.0;k=0.0;while(1){if((a|0)>=(D|0))break;m=+g[C+(a<<2)>>2];o=k+m*+g[b+(a<<2)>>2];m=h+m*+g[e+(a<<2)>>2];a=a+1|0;h=m;k=o}o=(h+k)*.5;k=(+g[x+(p<<2)>>2]+ +g[x+(n<<2)>>2])*.5;h=o/+O(+(y*k+1.0));e=p-z|0;e=(e|0)>-1?e:0-e|0;if((e|0)>=2)if((e|0)<3){n=(_(r*5|0,r)|0)<(w|0);m=n?v:0.0}else m=0.0;else m=f;l=t-m;l=l<.30000001192092896?.30000001192092896:l;if((p|0)<21){l=u-m;if(l<.4000000059604645)l=.4000000059604645}if(h>l){e=p;j=o}else{e=B;k=q;h=A}B=e;q=k;A=h;r=r+1|0}h=j<0.0?0.0:j;if(!(q<=h))l=h/(q+1.0);else l=1.0;a=0;while(1){if((a|0)==3)break;e=C+(1-(B+a)<<2)|0;b=0;h=0.0;while(1){if((b|0)>=(D|0))break;f=h+ +g[C+(b<<2)>>2]*+g[e+(b<<2)>>2];b=b+1|0;h=f}g[E+(a<<2)>>2]=h;a=a+1|0}j=+g[E+8>>2];k=+g[E>>2];h=+g[E+4>>2];if(j-k>(h-k)*.699999988079071){E=1;D=l>A;f=D?A:l;D=B<<1;E=D+E|0;D=(E|0)<15;E=D?15:E;c[d>>2]=E;i=F;return +f}if(k-j>(h-j)*.699999988079071){E=-1;D=l>A;f=D?A:l;D=B<<1;E=D+E|0;D=(E|0)<15;E=D?15:E;c[d>>2]=E;i=F;return +f}E=0;D=l>A;f=D?A:l;D=B<<1;E=D+E|0;D=(E|0)<15;E=D?15:E;c[d>>2]=E;i=F;return +f}function ld(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0.0,f=0.0,h=0.0,i=0,j=0,k=0,l=0,m=0.0,n=0.0,o=0;e=+g[b>>2];nf(a|0,0,c<<2|0)|0;if(+g[b>>2]!=0.0)k=0;else return;while(1){if((k|0)<(c|0)){d=0;f=0.0}else{d=9;break}while(1){if((k|0)==(d|0))break;h=f+ +g[a+(d<<2)>>2]*+g[b+(k-d<<2)>>2];d=d+1|0;f=h}i=k;k=k+1|0;f=(f+ +g[b+(k<<2)>>2])/e;h=-f;g[a+(i<<2)>>2]=h;d=k>>1;i=i+-1|0;j=0;while(1){if((j|0)>=(d|0))break;o=a+(j<<2)|0;m=+g[o>>2];l=a+(i-j<<2)|0;n=+g[l>>2];g[o>>2]=m+n*h;g[l>>2]=n+m*h;j=j+1|0}e=e-f*f*e;if(e<+g[b>>2]*1.0000000474974513e-03){d=9;break}}if((d|0)==9)return}function md(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var h=0,j=0.0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0.0;q=i;i=i+112|0;n=q+96|0;o=q;p=i;i=i+((1*(e+24<<2)|0)+15&-16)|0;h=0;while(1){if((h|0)==24)break;c[o+(h<<2)>>2]=c[b+(24-h+-1<<2)>>2];h=h+1|0}h=0;while(1){if((h|0)==24){h=0;break}c[p+(h<<2)>>2]=c[f+(24-h+-1<<2)>>2];h=h+1|0}while(1){if((h|0)>=(e|0)){h=0;break}c[p+(h+24<<2)>>2]=c[a+(h<<2)>>2];h=h+1|0}while(1){if((h|0)==24)break;c[f+(h<<2)>>2]=c[a+(e-h+-1<<2)>>2];h=h+1|0}b=e+-3|0;f=n+4|0;k=n+8|0;l=n+12|0;h=((b|0)>0?b:0)+3&-4;m=0;while(1){if((m|0)>=(b|0))break;c[n>>2]=0;c[n+4>>2]=0;c[n+8>>2]=0;c[n+12>>2]=0;nd(o,p+(m<<2)|0,n,24);g[d+(m<<2)>>2]=+g[a+(m<<2)>>2]+ +g[n>>2];r=m|1;g[d+(r<<2)>>2]=+g[a+(r<<2)>>2]+ +g[f>>2];r=m|2;g[d+(r<<2)>>2]=+g[a+(r<<2)>>2]+ +g[k>>2];r=m|3;g[d+(r<<2)>>2]=+g[a+(r<<2)>>2]+ +g[l>>2];m=m+4|0}while(1){if((h|0)<(e|0)){b=0;j=0.0}else break;while(1){if((b|0)==24)break;s=j+ +g[o+(b<<2)>>2]*+g[p+(h+b<<2)>>2];b=b+1|0;j=s}g[d+(h<<2)>>2]=+g[a+(h<<2)>>2]+j;h=h+1|0}i=q;return}function nd(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0.0,f=0,h=0,i=0.0,j=0,k=0,l=0,m=0,n=0.0,o=0,p=0,q=0,r=0.0,s=0.0,t=0.0,u=0.0,v=0.0,w=0.0,x=0.0,y=0.0,z=0.0;j=d+-3|0;o=c+4|0;p=c+8|0;q=c+12|0;l=((j|0)>0?j:0)+3|0;m=l&-4;l=l|3;f=a;h=b+12|0;k=0;e=+g[b>>2];n=+g[b+4>>2];r=+g[b+8>>2];i=0.0;while(1){if((k|0)>=(j|0))break;w=+g[f>>2];i=+g[h>>2];z=+g[c>>2]+w*e;g[c>>2]=z;y=+g[o>>2]+w*n;g[o>>2]=y;x=+g[p>>2]+w*r;g[p>>2]=x;w=+g[q>>2]+w*i;g[q>>2]=w;v=+g[f+4>>2];u=+g[h+4>>2];z=z+v*n;g[c>>2]=z;y=y+v*r;g[o>>2]=y;x=x+v*i;g[p>>2]=x;v=w+v*u;g[q>>2]=v;w=+g[f+8>>2];t=+g[h+8>>2];z=z+w*r;g[c>>2]=z;y=y+w*i;g[o>>2]=y;x=x+w*u;g[p>>2]=x;w=v+w*t;g[q>>2]=w;v=+g[f+12>>2];s=+g[h+12>>2];g[c>>2]=z+v*i;g[o>>2]=y+v*u;g[p>>2]=x+v*t;g[q>>2]=w+v*s;f=f+16|0;h=h+16|0;k=k+4|0;e=u;n=t;r=s}h=a+(m<<2)|0;f=b+(l<<2)|0;j=m|1;if((m|0)<(d|0)){z=+g[h>>2];i=+g[f>>2];g[c>>2]=+g[c>>2]+z*e;g[o>>2]=+g[o>>2]+z*n;g[p>>2]=+g[p>>2]+z*r;g[q>>2]=+g[q>>2]+z*i;h=h+4|0;f=f+4|0}if((j|0)<(d|0)){z=+g[h>>2];e=+g[f>>2];g[c>>2]=+g[c>>2]+z*n;g[o>>2]=+g[o>>2]+z*r;g[p>>2]=+g[p>>2]+z*i;g[q>>2]=+g[q>>2]+z*e;h=h+4|0;f=f+4|0}if((j+1|0)>=(d|0))return;y=+g[h>>2];z=+g[f>>2];g[c>>2]=+g[c>>2]+y*r;g[o>>2]=+g[o>>2]+y*i;g[p>>2]=+g[p>>2]+y*e;g[q>>2]=+g[q>>2]+y*z;return}function od(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var h=0,j=0,k=0.0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0.0,x=0.0,y=0,z=0.0,A=0;u=i;i=i+112|0;r=u+96|0;s=u;j=e+24|0;t=i;i=i+((1*(j<<2)|0)+15&-16)|0;h=0;while(1){if((h|0)==24)break;c[s+(h<<2)>>2]=c[b+(24-h+-1<<2)>>2];h=h+1|0}h=0;while(1){if((h|0)==24){h=24;break}g[t+(h<<2)>>2]=-+g[f+(24-h+-1<<2)>>2];h=h+1|0}while(1){if((h|0)>=(j|0))break;g[t+(h<<2)>>2]=0.0;h=h+1|0}j=e+-3|0;l=r+4|0;m=r+8|0;n=r+12|0;o=b+4|0;p=b+8|0;h=e+-3|0;h=((h|0)>0?h:0)+3&-4;q=0;while(1){if((q|0)>=(j|0))break;c[r>>2]=c[a+(q<<2)>>2];A=q|1;c[l>>2]=c[a+(A<<2)>>2];y=q|2;c[m>>2]=c[a+(y<<2)>>2];v=q|3;c[n>>2]=c[a+(v<<2)>>2];nd(s,t+(q<<2)|0,r,24);z=+g[r>>2];k=-z;g[t+(q+24<<2)>>2]=k;g[d+(q<<2)>>2]=z;z=+g[l>>2]+ +g[b>>2]*k;g[l>>2]=z;w=-z;g[t+(q+25<<2)>>2]=w;g[d+(A<<2)>>2]=z;z=+g[m>>2]+ +g[b>>2]*w+ +g[o>>2]*k;g[m>>2]=z;x=-z;g[t+(q+26<<2)>>2]=x;g[d+(y<<2)>>2]=z;k=+g[n>>2]+ +g[b>>2]*x+ +g[o>>2]*w+ +g[p>>2]*k;g[n>>2]=k;g[t+(q+27<<2)>>2]=-k;g[d+(v<<2)>>2]=k;q=q+4|0}while(1){if((h|0)>=(e|0)){h=0;break}j=0;k=+g[a+(h<<2)>>2];while(1){if((j|0)==24)break;z=k-+g[s+(j<<2)>>2]*+g[t+(h+j<<2)>>2];j=j+1|0;k=z}g[t+(h+24<<2)>>2]=k;g[d+(h<<2)>>2]=k;h=h+1|0}while(1){if((h|0)==24)break;c[f+(h<<2)>>2]=c[d+(e-h+-1<<2)>>2];h=h+1|0}i=u;return}function pd(a,b,d,e,f,h){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;h=h|0;var j=0.0,k=0,l=0,m=0,n=0,o=0;n=i;m=h-f|0;l=i;i=i+((1*(h<<2)|0)+15&-16)|0;a:do if(!e)l=a;else{k=0;while(1){if((k|0)>=(h|0)){k=0;break}c[l+(k<<2)>>2]=c[a+(k<<2)>>2];k=k+1|0}while(1){if((k|0)>=(e|0))break a;j=+g[d+(k<<2)>>2];g[l+(k<<2)>>2]=+g[a+(k<<2)>>2]*j;o=h-k+-1|0;g[l+(o<<2)>>2]=+g[a+(o<<2)>>2]*j;k=k+1|0}}while(0);hd(l,l,b,m,f+1|0);e=0;while(1){if((e|0)>(f|0))break;j=0.0;k=e+m|0;while(1){if((k|0)>=(h|0))break;j=j+ +g[l+(k<<2)>>2]*+g[l+(k-e<<2)>>2];k=k+1|0}o=b+(e<<2)|0;g[o>>2]=+g[o>>2]+j;e=e+1|0}i=n;return}function qd(a,b,d,e,f,h,j,k,l,m,n,o,p,q,r,s,t){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;h=h|0;j=j|0;k=k|0;l=l|0;m=m|0;n=n|0;o=o|0;p=p|0;q=q|0;r=r|0;s=s|0;t=t|0;var u=0,v=0.0,w=0.0,x=0,y=0,z=0.0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0.0;S=i;i=i+96|0;O=S+72|0;P=S+48|0;Q=S+24|0;R=S;if(!p)if((r|0)==0?(u=d-b|0,+g[q>>2]>+(_(m<<1,u)|0)):0)x=(_(u,m)|0)<(o|0);else x=0;else x=1;w=+(j>>>0)*+g[q>>2]*+(s|0)/+(m<<9|0);N=a+8|0;y=c[N>>2]|0;s=0;v=0.0;do{p=_(s,y)|0;u=b;while(1){if((u|0)>=(e|0))break;L=u+p|0;T=+g[f+(L<<2)>>2]-+g[h+(L<<2)>>2];v=v+T*T;u=u+1|0}s=s+1|0}while((s|0)<(m|0));L=~~w;w=v>200.0?200.0:v;J=l+20|0;s=c[J>>2]|0;K=l+28|0;p=c[K>>2]|0;I=s+((aa(p|0)|0)+-32)|0;u=(I+3|0)>>>0>j>>>0;H=u?0:x&1;if((d-b|0)>10?(z=+(o|0)*.125,!(z>16.0)):0)v=z;else v=16.0;v=(t|0)==0?v:3.0;c[O>>2]=c[l>>2];c[O+4>>2]=c[l+4>>2];c[O+8>>2]=c[l+8>>2];c[O+12>>2]=c[l+12>>2];c[O+16>>2]=c[l+16>>2];c[O+20>>2]=c[l+20>>2];G=l+24|0;D=c[G>>2]|0;c[P>>2]=c[K>>2];c[P+4>>2]=c[K+4>>2];c[P+8>>2]=c[K+8>>2];c[P+12>>2]=c[K+12>>2];c[P+16>>2]=c[K+16>>2];C=_(y,m)|0;E=i;i=i+((1*(C<<2)|0)+15&-16)|0;F=i;i=i+((1*(C<<2)|0)+15&-16)|0;rf(E|0,h|0,C<<2|0)|0;C=u|(r|0)==0;if(C)if(!H){B=D;A=0}else{rd(a,b,d,f,E,j,I,29009+(n*84|0)+42|0,F,l,m,n,1,v,t)|0;M=22}else{u=rd(a,b,d,f,E,j,I,29009+(n*84|0)+42|0,F,l,m,n,1,v,t)|0;if(!H){s=c[J>>2]|0;p=c[K>>2]|0;B=c[G>>2]|0;A=u}else M=22}if((M|0)==22){rf(h|0,E|0,(_(c[N>>2]|0,m)|0)<<2|0)|0;rf(k|0,F|0,(_(c[N>>2]|0,m)|0)<<2|0)|0;T=w;g[q>>2]=T;i=S;return}x=32-(aa(p|0)|0)|0;e=p>>>(x+-16|0);p=(e>>>12)+-8|0;p=(s<<3)-((x<<3)+(p+(e>>>0>(c[5272+(p<<2)>>2]|0)>>>0&1)))|0;s=c[l>>2]|0;e=l+4|0;c[Q>>2]=c[e>>2];c[Q+4>>2]=c[e+4>>2];c[Q+8>>2]=c[e+8>>2];c[Q+12>>2]=c[e+12>>2];c[Q+16>>2]=c[e+16>>2];c[R>>2]=c[K>>2];c[R+4>>2]=c[K+4>>2];c[R+8>>2]=c[K+8>>2];c[R+12>>2]=c[K+12>>2];c[R+16>>2]=c[K+16>>2];x=s+D|0;o=B-D|0;y=Fa()|0;r=i;i=i+((1*((B|0)==(D|0)?1:o)|0)+15&-16)|0;rf(r|0,x|0,o|0)|0;c[l>>2]=c[O>>2];c[l+4>>2]=c[O+4>>2];c[l+8>>2]=c[O+8>>2];c[l+12>>2]=c[O+12>>2];c[l+16>>2]=c[O+16>>2];c[l+20>>2]=c[O+20>>2];c[G>>2]=D;c[K>>2]=c[P>>2];c[K+4>>2]=c[P+4>>2];c[K+8>>2]=c[P+8>>2];c[K+12>>2]=c[P+12>>2];c[K+16>>2]=c[P+16>>2];u=rd(a,b,d,f,h,j,I,29009+(n*84|0)+(H*42|0)|0,k,l,m,n,0,v,t)|0;do if(!C){if((A|0)>=(u|0)){if((A|0)!=(u|0))break;a=c[K>>2]|0;t=32-(aa(a|0)|0)|0;a=a>>>(t+-16|0);b=(a>>>12)+-8|0;if(((c[J>>2]<<3)-((t<<3)+(b+(a>>>0>(c[5272+(b<<2)>>2]|0)>>>0&1)))+L|0)<=(p|0))break}c[l>>2]=s;c[e>>2]=c[Q>>2];c[e+4>>2]=c[Q+4>>2];c[e+8>>2]=c[Q+8>>2];c[e+12>>2]=c[Q+12>>2];c[e+16>>2]=c[Q+16>>2];c[G>>2]=B;c[K>>2]=c[R>>2];c[K+4>>2]=c[R+4>>2];c[K+8>>2]=c[R+8>>2];c[K+12>>2]=c[R+12>>2];c[K+16>>2]=c[R+16>>2];rf(x|0,r|0,o|0)|0;rf(h|0,E|0,(_(c[N>>2]|0,m)|0)<<2|0)|0;rf(k|0,F|0,(_(c[N>>2]|0,m)|0)<<2|0)|0;Na(y|0);T=w;g[q>>2]=T;i=S;return}while(0);Na(y|0);T=+g[17336+(n<<2)>>2];T=T*T*+g[q>>2]+w;g[q>>2]=T;i=S;return}function rd(b,e,f,h,j,k,l,m,n,o,p,q,r,s,t){b=b|0;e=e|0;f=f|0;h=h|0;j=j|0;k=k|0;l=l|0;m=m|0;n=n|0;o=o|0;p=p|0;q=q|0;r=r|0;s=+s;t=t|0;var u=0,v=0,w=0,x=0.0,y=0.0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0.0,J=0.0,K=0.0,L=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,$=0.0,ba=0.0,ca=0,da=0;da=i;i=i+16|0;ca=da;Z=ca;c[Z>>2]=0;c[Z+4>>2]=0;a:do if((l+3|0)<=(k|0)){H=o+28|0;u=c[H>>2]|0;l=u>>>3;u=u-l|0;G=o+32|0;if(!r)l=u;else c[G>>2]=(c[G>>2]|0)+u;c[H>>2]=l;z=o+36|0;A=o+20|0;B=o+40|0;C=o+24|0;D=o+8|0;E=o+4|0;F=o+44|0;while(1){if(l>>>0>=8388609)break a;u=c[G>>2]|0;w=u>>>23;if((w|0)==255)c[z>>2]=(c[z>>2]|0)+1;else{v=u>>>31;l=c[B>>2]|0;if((l|0)>-1){u=c[C>>2]|0;if((u+(c[D>>2]|0)|0)>>>0<(c[E>>2]|0)>>>0){c[C>>2]=u+1;a[(c[o>>2]|0)+u>>0]=l+v;l=0}else l=-1;c[F>>2]=c[F>>2]|l}l=c[z>>2]|0;if(l|0){v=v+255&255;do{u=c[C>>2]|0;if((u+(c[D>>2]|0)|0)>>>0<(c[E>>2]|0)>>>0){c[C>>2]=u+1;a[(c[o>>2]|0)+u>>0]=v;u=0;l=c[z>>2]|0}else u=-1;c[F>>2]=c[F>>2]|u;l=l+-1|0;c[z>>2]=l}while((l|0)!=0)}c[B>>2]=w&255;u=c[G>>2]|0;l=c[H>>2]|0}c[G>>2]=u<<8&2147483392;l=l<<8;c[H>>2]=l;c[A>>2]=(c[A>>2]|0)+8}}while(0);if(!r){ba=+g[17320+(q<<2)>>2];$=+g[17336+(q<<2)>>2]}else{ba=.149993896484375;$=0.0}W=b+8|0;X=o+20|0;Y=o+28|0;Z=p*3|0;b=(t|0)==0;t=o+32|0;L=o+36|0;N=o+40|0;O=o+24|0;P=o+8|0;Q=o+4|0;R=o+44|0;l=0;V=e;while(1){if((V|0)>=(f|0))break;S=_(Z,f-V|0)|0;T=(V|0)!=(e|0);U=(V|0)<20;q=0;do{r=V+(_(q,c[W>>2]|0)|0)|0;y=+g[h+(r<<2)>>2];x=+g[j+(r<<2)>>2];K=$*(x<-9.0?-9.0:x);r=ca+(q<<2)|0;I=+g[r>>2];J=y-K-I;u=~~+M(+(J+.5));x=(x<-28.0?-28.0:x)-s;if((u|0)<0&y0?0:H}else H=u;w=c[X>>2]|0;G=c[Y>>2]|0;z=w+((aa(G|0)|0)+-32)|0;A=k-z|0;v=A-S|0;if((v|0)<24&T){u=(H|0)>1?1:H;if((v|0)<16)u=(u|0)<-1?-1:u}else u=H;u=b|(V|0)<2|(u|0)<0?u:0;b:do if((A|0)<=14)if((A|0)>1){u=(u|0)<-1?-1:(u|0)<1?u:1;v=u<<1^u>>31;z=G>>>2;if((v|0)>0){F=d[29345+(v+-1)>>0]|0;G=G-(_(z,F)|0)|0;c[t>>2]=(c[t>>2]|0)+G;v=_(z,F-(d[29345+v>>0]|0)|0)|0}else v=G-(_(z,d[29345+v>>0]|0)|0)|0;c[Y>>2]=v;while(1){if(v>>>0>=8388609)break b;z=c[t>>2]|0;A=z>>>23;if((A|0)==255)c[L>>2]=(c[L>>2]|0)+1;else{z=z>>>31;v=c[N>>2]|0;if((v|0)>-1){w=c[O>>2]|0;if((w+(c[P>>2]|0)|0)>>>0<(c[Q>>2]|0)>>>0){c[O>>2]=w+1;a[(c[o>>2]|0)+w>>0]=v+z;v=0}else v=-1;c[R>>2]=c[R>>2]|v}v=c[L>>2]|0;if(v|0){z=z+255&255;do{w=c[O>>2]|0;if((w+(c[P>>2]|0)|0)>>>0<(c[Q>>2]|0)>>>0){c[O>>2]=w+1;a[(c[o>>2]|0)+w>>0]=z;w=0;v=c[L>>2]|0}else w=-1;c[R>>2]=c[R>>2]|w;v=v+-1|0;c[L>>2]=v}while((v|0)!=0)}c[N>>2]=A&255;z=c[t>>2]|0;v=c[Y>>2]|0;w=c[X>>2]|0}c[t>>2]=z<<8&2147483392;v=v<<8;c[Y>>2]=v;w=w+8|0;c[X>>2]=w}}else{if((z|0)>=(k|0)){u=-1;break}z=G>>>1;v=G-z|0;if((u|0)>-1)u=0;else{c[t>>2]=(c[t>>2]|0)+v;v=z}c[Y>>2]=v;while(1){if(v>>>0>=8388609)break b;z=c[t>>2]|0;A=z>>>23;if((A|0)==255)c[L>>2]=(c[L>>2]|0)+1;else{z=z>>>31;v=c[N>>2]|0;if((v|0)>-1){w=c[O>>2]|0;if((w+(c[P>>2]|0)|0)>>>0<(c[Q>>2]|0)>>>0){c[O>>2]=w+1;a[(c[o>>2]|0)+w>>0]=v+z;v=0}else v=-1;c[R>>2]=c[R>>2]|v}v=c[L>>2]|0;if(v|0){z=z+255&255;do{w=c[O>>2]|0;if((w+(c[P>>2]|0)|0)>>>0<(c[Q>>2]|0)>>>0){c[O>>2]=w+1;a[(c[o>>2]|0)+w>>0]=z;w=0;v=c[L>>2]|0}else w=-1;c[R>>2]=c[R>>2]|w;v=v+-1|0;c[L>>2]=v}while((v|0)!=0)}c[N>>2]=A&255;z=c[t>>2]|0;v=c[Y>>2]|0;w=c[X>>2]|0}c[t>>2]=z<<8&2147483392;v=v<<8;c[Y>>2]=v;w=w+8|0;c[X>>2]=w}}else{A=(U?V:20)<<1;v=(d[m+A>>0]|0)<<7;A=(d[m+(A|1)>>0]|0)<<6;if(u){E=u>>31;B=u+E^E;z=_(32736-v|0,16384-A|0)|0;C=v;D=1;while(1){v=z>>>15;if(!v){F=36;break}if((B|0)<=(D|0)){F=37;break}F=v<<1;z=_(F,A)|0;C=C+(F+2)|0;D=D+1|0}if((F|0)==36){F=0;A=B-D|0;u=(32768-C-E>>1)+-1|0;u=(A|0)<(u|0)?A:u;A=C+((u<<1|1)+E)|0;v=32768-A|0;v=v>>>0>1?1:v;u=D+u+E^E}else if((F|0)==37){F=0;A=v+1|0;v=A;A=C+(A&~E)|0}z=G>>>15;if(!A)F=40;else{G=G-(_(z,32768-A|0)|0)|0;c[t>>2]=(c[t>>2]|0)+G;v=_(z,v)|0}}else{z=G>>>15;u=0;F=40}if((F|0)==40)v=G-(_(z,32768-v|0)|0)|0;c[Y>>2]=v;z=v;v=w;while(1){if(z>>>0>=8388609)break b;w=c[t>>2]|0;A=w>>>23;if((A|0)==255)c[L>>2]=(c[L>>2]|0)+1;else{z=w>>>31;v=c[N>>2]|0;if((v|0)>-1){w=c[O>>2]|0;if((w+(c[P>>2]|0)|0)>>>0<(c[Q>>2]|0)>>>0){c[O>>2]=w+1;a[(c[o>>2]|0)+w>>0]=v+z;v=0}else v=-1;c[R>>2]=c[R>>2]|v}v=c[L>>2]|0;if(v|0){z=z+255&255;do{w=c[O>>2]|0;if((w+(c[P>>2]|0)|0)>>>0<(c[Q>>2]|0)>>>0){c[O>>2]=w+1;a[(c[o>>2]|0)+w>>0]=z;w=0;v=c[L>>2]|0}else w=-1;c[R>>2]=c[R>>2]|w;v=v+-1|0;c[L>>2]=v}while((v|0)!=0)}c[N>>2]=A&255;w=c[t>>2]|0;z=c[Y>>2]|0;v=c[X>>2]|0}c[t>>2]=w<<8&2147483392;z=z<<8;c[Y>>2]=z;v=v+8|0;c[X>>2]=v}}while(0);y=+(u|0);g[n+(V+(_(q,c[W>>2]|0)|0)<<2)>>2]=J-y;H=H-u|0;l=l+((H|0)>-1?H:0-H|0)|0;g[j+(V+(_(q,c[W>>2]|0)|0)<<2)>>2]=K+I+y;g[r>>2]=I+y-ba*y;q=q+1|0}while((q|0)<(p|0));V=V+1|0}i=da;return (b?l:0)|0}function sd(e,f,g,h,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x){e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;k=k|0;l=l|0;m=m|0;n=n|0;o=o|0;p=p|0;q=q|0;r=r|0;s=s|0;t=t|0;u=u|0;v=v|0;w=w|0;x=x|0;var y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,$=0,ba=0,ca=0,da=0;da=i;n=(n|0)>0?n:0;G=c[e+8>>2]|0;P=(n|0)>7?8:0;n=n-P|0;ca=(s|0)==2;if(ca?(y=d[29348+(g-f)>>0]|0,(n|0)>=(y|0)):0){n=n-y|0;V=(n|0)>7?8:0;n=n-V|0}else{V=0;y=0}L=i;i=i+((1*(G<<2)|0)+15&-16)|0;M=i;i=i+((1*(G<<2)|0)+15&-16)|0;O=i;i=i+((1*(G<<2)|0)+15&-16)|0;K=i;i=i+((1*(G<<2)|0)+15&-16)|0;$=s<<3;ba=e+32|0;k=k+-5-t|0;z=t+3|0;A=f;while(1){if((A|0)>=(g|0))break;Y=A+1|0;X=c[ba>>2]|0;X=(b[X+(Y<<1)>>1]|0)-(b[X+(A<<1)>>1]|0)|0;W=X*3<>4;c[O+(A<<2)>>2]=($|0)>(W|0)?$:W;W=(_(_(_(X,s)|0,k)|0,g-A+-1|0)|0)<>6;c[K+(A<<2)>>2]=W-((X<>2]|0;I=e+52|0;F=H+-1|0;J=1;do{C=J+F>>1;D=_(C,G)|0;E=0;k=g;z=0;a:while(1){b:while(1){B=k;do{k=B;B=B+-1|0;if((k|0)<=(f|0))break a;Y=c[ba>>2]|0;k=_((b[Y+(k<<1)>>1]|0)-(b[Y+(B<<1)>>1]|0)|0,s)|0;k=(_(k,d[(c[I>>2]|0)+(D+B)>>0]|0)|0)<>2;if((k|0)>0){k=k+(c[K+(B<<2)>>2]|0)|0;k=(k|0)<0?0:k}A=k+(c[h+(B<<2)>>2]|0)|0;if((A|0)>=(c[O+(B<<2)>>2]|0)|E)break b}while((A|0)<($|0));k=B;z=z+$|0}Y=c[j+(B<<2)>>2]|0;E=1;k=B;z=z+((A|0)<(Y|0)?A:Y)|0}Y=(z|0)>(n|0);J=Y?J:C+1|0;F=Y?C+-1|0:F}while((J|0)<=(F|0));F=_(J+-1|0,G)|0;B=_(J,G)|0;C=(J|0)>1;E=f;N=f;while(1){if((E|0)>=(g|0))break;D=E+1|0;k=c[ba>>2]|0;k=_((b[k+(D<<1)>>1]|0)-(b[k+(E<<1)>>1]|0)|0,s)|0;z=c[I>>2]|0;A=(_(k,d[z+(F+E)>>0]|0)|0)<>2;if((J|0)<(H|0))k=(_(k,d[z+(B+E)>>0]|0)|0)<>2;else k=c[j+(E<<2)>>2]|0;if((A|0)>0){z=A+(c[K+(E<<2)>>2]|0)|0;z=(z|0)<0?0:z}else z=A;if((k|0)>0){k=k+(c[K+(E<<2)>>2]|0)|0;k=(k|0)<0?0:k}Y=c[h+(E<<2)>>2]|0;X=z+(C?Y:0)|0;W=k+Y|0;Y=(Y|0)>0?E:N;c[L+(E<<2)>>2]=X;c[M+(E<<2)>>2]=(W|0)<(X|0)?0:W-X|0;E=D;N=Y}W=(s|0)>1;Y=W&1;D=64;E=0;F=0;while(1){if((E|0)==6)break;B=F+D>>1;C=0;k=g;z=0;c:while(1){d:while(1){do{X=k;k=k+-1|0;if((X|0)<=(f|0))break c;A=(c[L+(k<<2)>>2]|0)+((_(B,c[M+(k<<2)>>2]|0)|0)>>6)|0;if((A|0)>=(c[O+(k<<2)>>2]|0)|C)break d}while((A|0)<($|0));z=z+$|0}X=c[j+(k<<2)>>2]|0;C=1;z=z+((A|0)<(X|0)?A:X)|0}X=(z|0)>(n|0);D=X?B:D;E=E+1|0;F=X?F:B}X=t<<3;z=0;A=g;B=0;while(1){k=A+-1|0;if((A|0)<=(f|0))break;T=(c[L+(k<<2)>>2]|0)+((_(F,c[M+(k<<2)>>2]|0)|0)>>6)|0;A=(z|0)==0?(T|0)<(c[O+(k<<2)>>2]|0):0;T=A?((T|0)<($|0)?0:$):T;U=c[j+(k<<2)>>2]|0;U=(T|0)<(U|0)?T:U;c[p+(k<<2)>>2]=U;z=A&1^1;A=k;B=B+U|0}H=$+8|0;I=(v|0)==0;M=u+28|0;v=u+32|0;Q=u+20|0;R=u+40|0;S=u+24|0;T=u+4|0;G=f+2|0;J=u+36|0;K=u+8|0;h=u+44|0;U=g;L=B;e:while(1){E=U+-1|0;if((E|0)<=(N|0)){Z=45;break}C=n-L|0;k=c[ba>>2]|0;F=b[k+(U<<1)>>1]|0;A=b[k+(f<<1)>>1]|0;z=F-A|0;D=(C>>>0)/(z>>>0)|0;z=C-(_(z,D)|0)|0;k=b[k+(E<<1)>>1]|0;A=z+(A-k)|0;k=F-k|0;F=p+(E<<2)|0;z=c[F>>2]|0;A=z+(_(D,k)|0)+((A|0)>0?A:0)|0;D=c[O+(E<<2)>>2]|0;if((A|0)<(((D|0)>(H|0)?D:H)|0)){B=z;z=L}else{f:do if(I){k=c[M>>2]|0;B=c[v>>2]|0;z=k>>>1;D=B>>>0>>0;if(D)k=B;else{C=B-z|0;c[v>>2]=C;z=k-z|0;k=C}c[M>>2]=z;while(1){if(z>>>0>=8388609)break;c[Q>>2]=(c[Q>>2]|0)+8;z=z<<8;c[M>>2]=z;C=c[R>>2]|0;B=c[S>>2]|0;if(B>>>0<(c[T>>2]|0)>>>0){c[S>>2]=B+1;B=d[(c[u>>2]|0)+B>>0]|0}else B=0;c[R>>2]=B;C=((C<<8|B)>>>1&255|k<<8&2147483392)^255;c[v>>2]=C;k=C}if(D)break e}else{if((U|0)<=(G|0)){Z=50;break e}if(!((E|0)>(x|0)?1:(A|0)<=((_((U|0)<=(w|0)?7:9,k)|0)<>4|0))){Z=50;break e}k=c[M>>2]|0;k=k-(k>>>1)|0;c[M>>2]=k;while(1){if(k>>>0>=8388609)break f;z=c[v>>2]|0;C=z>>>23;if((C|0)==255)c[J>>2]=(c[J>>2]|0)+1;else{B=z>>>31;k=c[R>>2]|0;if((k|0)>-1){z=c[S>>2]|0;if((z+(c[K>>2]|0)|0)>>>0<(c[T>>2]|0)>>>0){c[S>>2]=z+1;a[(c[u>>2]|0)+z>>0]=k+B;k=0}else k=-1;c[h>>2]=c[h>>2]|k}k=c[J>>2]|0;if(k|0){B=B+255&255;do{z=c[S>>2]|0;if((z+(c[K>>2]|0)|0)>>>0<(c[T>>2]|0)>>>0){c[S>>2]=z+1;a[(c[u>>2]|0)+z>>0]=B;z=0;k=c[J>>2]|0}else z=-1;c[h>>2]=c[h>>2]|z;k=k+-1|0;c[J>>2]=k}while((k|0)!=0)}c[R>>2]=C&255;z=c[v>>2]|0;k=c[M>>2]|0}c[v>>2]=z<<8&2147483392;k=k<<8;c[M>>2]=k;c[Q>>2]=(c[Q>>2]|0)+8}}while(0);B=c[F>>2]|0;A=A+-8|0;z=L+8|0}if((y|0)>0)k=d[29348+(E-f)>>0]|0;else k=y;U=(A|0)<($|0);L=z-(B+y)+k+(U?0:$)|0;c[F>>2]=U?0:$;y=k;U=E}g:do if((Z|0)==45)n=n+P|0;else if((Z|0)==50){z=c[M>>2]|0;k=z>>>1;z=(c[v>>2]|0)+(z-k)|0;c[v>>2]=z;c[M>>2]=k;while(1){if(k>>>0>=8388609)break g;B=z>>>23;if((B|0)==255)c[J>>2]=(c[J>>2]|0)+1;else{A=z>>>31;k=c[R>>2]|0;if((k|0)>-1){z=c[S>>2]|0;if((z+(c[K>>2]|0)|0)>>>0<(c[T>>2]|0)>>>0){c[S>>2]=z+1;a[(c[u>>2]|0)+z>>0]=k+A;k=0}else k=-1;c[h>>2]=c[h>>2]|k}k=c[J>>2]|0;if(k|0){A=A+255&255;do{z=c[S>>2]|0;if((z+(c[K>>2]|0)|0)>>>0<(c[T>>2]|0)>>>0){c[S>>2]=z+1;a[(c[u>>2]|0)+z>>0]=A;z=0;k=c[J>>2]|0}else z=-1;c[h>>2]=c[h>>2]|z;k=k+-1|0;c[J>>2]=k}while((k|0)!=0)}c[R>>2]=B&255;z=c[v>>2]|0;k=c[M>>2]|0}z=z<<8&2147483392;c[v>>2]=z;k=k<<8;c[M>>2]=k;c[Q>>2]=(c[Q>>2]|0)+8}}while(0);h:do if((y|0)>0){if(I){c[l>>2]=(bd(u,U+1-f|0)|0)+f;break}z=c[l>>2]|0;z=(z|0)<(U|0)?z:U;c[l>>2]=z;C=z-f|0;A=U+1-f|0;k=A+-1|0;y=32-(aa(k|0)|0)|0;if((y|0)<=8){k=c[M>>2]|0;y=(k>>>0)/(A>>>0)|0;if((z|0)==(f|0))y=k-(_(y,A-(C+1)|0)|0)|0;else{x=k-(_(y,A-C|0)|0)|0;c[v>>2]=(c[v>>2]|0)+x}c[M>>2]=y;while(1){if(y>>>0>=8388609)break h;k=c[v>>2]|0;A=k>>>23;if((A|0)==255)c[J>>2]=(c[J>>2]|0)+1;else{z=k>>>31;y=c[R>>2]|0;if((y|0)>-1){k=c[S>>2]|0;if((k+(c[K>>2]|0)|0)>>>0<(c[T>>2]|0)>>>0){c[S>>2]=k+1;a[(c[u>>2]|0)+k>>0]=y+z;y=0}else y=-1;c[h>>2]=c[h>>2]|y}y=c[J>>2]|0;if(y|0){z=z+255&255;do{k=c[S>>2]|0;if((k+(c[K>>2]|0)|0)>>>0<(c[T>>2]|0)>>>0){c[S>>2]=k+1;a[(c[u>>2]|0)+k>>0]=z;k=0;y=c[J>>2]|0}else k=-1;c[h>>2]=c[h>>2]|k;y=y+-1|0;c[J>>2]=y}while((y|0)!=0)}c[R>>2]=A&255;k=c[v>>2]|0;y=c[M>>2]|0}c[v>>2]=k<<8&2147483392;y=y<<8;c[M>>2]=y;c[Q>>2]=(c[Q>>2]|0)+8}}G=y+-8|0;k=k>>>G;z=k+1|0;A=C>>>G;B=c[M>>2]|0;y=(B>>>0)/(z>>>0)|0;if(!A)y=B-(_(y,k)|0)|0;else{x=B-(_(y,z-A|0)|0)|0;c[v>>2]=(c[v>>2]|0)+x}c[M>>2]=y;while(1){if(y>>>0>=8388609)break;k=c[v>>2]|0;A=k>>>23;if((A|0)==255)c[J>>2]=(c[J>>2]|0)+1;else{z=k>>>31;y=c[R>>2]|0;if((y|0)>-1){k=c[S>>2]|0;if((k+(c[K>>2]|0)|0)>>>0<(c[T>>2]|0)>>>0){c[S>>2]=k+1;a[(c[u>>2]|0)+k>>0]=y+z;y=0}else y=-1;c[h>>2]=c[h>>2]|y}y=c[J>>2]|0;if(y|0){z=z+255&255;do{k=c[S>>2]|0;if((k+(c[K>>2]|0)|0)>>>0<(c[T>>2]|0)>>>0){c[S>>2]=k+1;a[(c[u>>2]|0)+k>>0]=z;k=0;y=c[J>>2]|0}else k=-1;c[h>>2]=c[h>>2]|k;y=y+-1|0;c[J>>2]=y}while((y|0)!=0)}c[R>>2]=A&255;k=c[v>>2]|0;y=c[M>>2]|0}c[v>>2]=k<<8&2147483392;y=y<<8;c[M>>2]=y;c[Q>>2]=(c[Q>>2]|0)+8}D=(1<>2]|0;F=u+16|0;k=c[F>>2]|0;if((k+G|0)>>>0>32){B=7-k|0;B=k+((B|0)>-8?B:-8)&-8;C=k;do{z=c[K>>2]|0;A=c[T>>2]|0;if(((c[S>>2]|0)+z|0)>>>0>>0){z=z+1|0;c[K>>2]=z;a[(c[u>>2]|0)+(A-z)>>0]=y;z=0}else z=-1;c[h>>2]=c[h>>2]|z;y=y>>>8;C=C+-8|0}while((C|0)>7);k=k+-8-B|0}c[E>>2]=y|D<>2]=k+G;c[Q>>2]=(c[Q>>2]|0)+G}else c[l>>2]=0;while(0);i:do if((c[l>>2]|0)>(f|0))if(!V)Z=169;else{if(I){y=c[M>>2]|0;z=c[v>>2]|0;k=y>>>1;V=z>>>0>>0;B=V&1;if(V)y=z;else{V=z-k|0;c[v>>2]=V;k=y-k|0;y=V}c[M>>2]=k;while(1){if(k>>>0>=8388609)break;c[Q>>2]=(c[Q>>2]|0)+8;k=k<<8;c[M>>2]=k;A=c[R>>2]|0;z=c[S>>2]|0;if(z>>>0<(c[T>>2]|0)>>>0){c[S>>2]=z+1;z=d[(c[u>>2]|0)+z>>0]|0}else z=0;c[R>>2]=z;V=((A<<8|z)>>>1&255|y<<8&2147483392)^255;c[v>>2]=V;y=V}c[m>>2]=B;break}k=c[M>>2]|0;y=k>>>1;k=k-y|0;if(!(c[m>>2]|0))y=k;else c[v>>2]=(c[v>>2]|0)+k;c[M>>2]=y;while(1){if(y>>>0>=8388609)break i;k=c[v>>2]|0;A=k>>>23;if((A|0)==255)c[J>>2]=(c[J>>2]|0)+1;else{z=k>>>31;y=c[R>>2]|0;if((y|0)>-1){k=c[S>>2]|0;if((k+(c[K>>2]|0)|0)>>>0<(c[T>>2]|0)>>>0){c[S>>2]=k+1;a[(c[u>>2]|0)+k>>0]=y+z;y=0}else y=-1;c[h>>2]=c[h>>2]|y}y=c[J>>2]|0;if(y|0){z=z+255&255;do{k=c[S>>2]|0;if((k+(c[K>>2]|0)|0)>>>0<(c[T>>2]|0)>>>0){c[S>>2]=k+1;a[(c[u>>2]|0)+k>>0]=z;k=0;y=c[J>>2]|0}else k=-1;c[h>>2]=c[h>>2]|k;y=y+-1|0;c[J>>2]=y}while((y|0)!=0)}c[R>>2]=A&255;k=c[v>>2]|0;y=c[M>>2]|0}c[v>>2]=k<<8&2147483392;y=y<<8;c[M>>2]=y;c[Q>>2]=(c[Q>>2]|0)+8}}else{n=n+V|0;Z=169}while(0);if((Z|0)==169)c[m>>2]=0;k=n-L|0;z=c[ba>>2]|0;z=(b[z+(U<<1)>>1]|0)-(b[z+(f<<1)>>1]|0)|0;n=(k>>>0)/(z>>>0)|0;z=_(z,n)|0;y=f;while(1){if((y|0)>=(U|0))break;Z=y+1|0;V=c[ba>>2]|0;V=_(n,(b[V+(Z<<1)>>1]|0)-(b[V+(y<<1)>>1]|0)|0)|0;u=p+(y<<2)|0;c[u>>2]=(c[u>>2]|0)+V;y=Z}y=f;n=k-z|0;while(1){if((y|0)>=(U|0))break;u=y+1|0;Z=c[ba>>2]|0;Z=(b[Z+(u<<1)>>1]|0)-(b[Z+(y<<1)>>1]|0)|0;Z=(n|0)<(Z|0)?n:Z;V=p+(y<<2)|0;c[V>>2]=(c[V>>2]|0)+Z;y=u;n=n-Z|0}H=e+56|0;F=W?4:3;G=0;while(1){if((f|0)>=(U|0))break;E=f+1|0;A=c[ba>>2]|0;A=(b[A+(E<<1)>>1]|0)-(b[A+(f<<1)>>1]|0)<>2]|0)+G|0;if((A|0)>1){n=c[j+(f<<2)>>2]|0;n=(y|0)>(n|0)?y-n|0:0;B=y-n|0;c[D>>2]=B;y=_(A,s)|0;if(ca&(A|0)>2?(c[m>>2]|0)==0:0)k=(f|0)<(c[l>>2]|0);else k=0;C=y+(k&1)|0;z=_(C,(b[(c[H>>2]|0)+(f<<1)>>1]|0)+X|0)|0;y=(z>>1)+(_(C,-21)|0)|0;if((A|0)==2)y=y+(C<<3>>2)|0;k=B+y|0;if((k|0)>=(C<<4|0))if((k|0)<(C*24|0))A=y+(z>>3)|0;else A=y;else A=y+(z>>2)|0;y=B+A+(C<<2)|0;y=((((y|0)<0?0:y)>>>0)/(C>>>0)|0)>>>3;z=q+(f<<2)|0;c[z>>2]=y;e=_(y,s)|0;k=c[D>>2]|0;if((e|0)>(k>>3|0)){y=k>>Y>>3;c[z>>2]=y}e=(y|0)<8?y:8;c[z>>2]=e;e=_(e,C<<3)|0;c[r+(f<<2)>>2]=(e|0)>=((c[D>>2]|0)+A|0)&1;e=(_(c[z>>2]|0,s)|0)<<3;c[D>>2]=(c[D>>2]|0)-e}else{n=(y|0)<($|0)?0:y-$|0;c[D>>2]=y-n;c[q+(f<<2)>>2]=0;c[r+(f<<2)>>2]=1}if((n|0)<=0){G=n;f=E;continue}W=n>>F;Z=q+(f<<2)|0;u=c[Z>>2]|0;e=8-u|0;e=(W|0)<(e|0)?W:e;c[Z>>2]=u+e;e=(_(e,s)|0)<<3;c[r+(f<<2)>>2]=(e|0)>=(n-G|0)&1;G=n-e|0;f=E}c[o>>2]=G;while(1){if((f|0)>=(g|0))break;m=p+(f<<2)|0;l=q+(f<<2)|0;c[l>>2]=c[m>>2]>>Y>>3;c[m>>2]=0;c[r+(f<<2)>>2]=(c[l>>2]|0)<1&1;f=f+1|0}i=da;return U|0}function td(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,h=0.0,j=0.0,k=0.0,l=0,m=0.0,n=0.0,o=0.0,p=0,q=0,r=0,s=0,t=0;t=i;r=i;i=i+((1*(e<<2)|0)+15&-16)|0;s=i;i=i+((1*(e<<2)|0)+15&-16)|0;f=0;do{q=a+(f<<2)|0;o=+g[q>>2];c[s+(f<<2)>>2]=o<0.0&1;g[q>>2]=+N(+o);c[b+(f<<2)>>2]=0;g[r+(f<<2)>>2]=0.0;f=f+1|0}while((f|0)<(e|0));if((e>>1|0)<(d|0)){f=0;h=0.0;do{h=h+ +g[a+(f<<2)>>2];f=f+1|0}while((f|0)<(e|0));if(!(h>1.0000000036274937e-15&h<64.0)){g[a>>2]=1.0;f=1;do{g[a+(f<<2)>>2]=0.0;f=f+1|0}while((f|0)<(e|0));h=1.0}k=(+(d|0)+.8)*(1.0/h);l=0;f=d;j=0.0;h=0.0;do{p=a+(l<<2)|0;q=~~+M(+(k*+g[p>>2]));c[b+(l<<2)>>2]=q;o=+(q|0);h=h+o*o;j=j+ +g[p>>2]*o;g[r+(l<<2)>>2]=o*2.0;f=f-q|0;l=l+1|0}while((l|0)<(e|0))}else{f=d;j=0.0;h=0.0}if((f|0)>(e+3|0)){o=+(f|0);h=h+o*o+o*+g[r>>2];c[b>>2]=(c[b>>2]|0)+f;f=0}q=0;while(1){if((q|0)>=(f|0)){f=0;break}h=h+1.0;o=j+ +g[a>>2];n=h+ +g[r>>2];l=0;o=o*o;p=1;while(1){m=j+ +g[a+(p<<2)>>2];k=h+ +g[r+(p<<2)>>2];m=m*m;d=n*m>k*o;l=d?p:l;p=p+1|0;if((p|0)>=(e|0))break;else{n=d?k:n;o=d?m:o}}n=+g[a+(l<<2)>>2];p=r+(l<<2)|0;o=+g[p>>2];g[p>>2]=o+2.0;p=b+(l<<2)|0;c[p>>2]=(c[p>>2]|0)+1;q=q+1|0;j=j+n;h=h+o}do{a=b+(f<<2)|0;r=c[s+(f<<2)>>2]|0;c[a>>2]=(c[a>>2]^0-r)+r;f=f+1|0}while((f|0)<(e|0));i=t;return +h} +function ud(b,d,e,f,h,j,k,l){b=b|0;d=d|0;e=e|0;f=f|0;h=h|0;j=j|0;k=+k;l=l|0;var m=0,n=0.0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0;E=i;D=i;i=i+((1*(d+3<<2)|0)+15&-16)|0;vd(b,d,1,h,e,f);n=+td(b,D,e,d);p=d+-1|0;r=c[D+(p<<2)>>2]|0;m=r>>>31;r=(r|0)>-1?r:0-r|0;while(1){q=p;p=p+-1|0;o=d-p|0;m=m+(c[(c[17748+(((o|0)<(r|0)?o:r)<<2)>>2]|0)+(((o|0)>(r|0)?o:r)<<2)>>2]|0)|0;C=c[D+(p<<2)>>2]|0;r=r+((C|0)>-1?C:0-C|0)|0;if((C|0)<0){B=r+1|0;B=m+(c[(c[17748+(((o|0)>(r|0)?B:o)<<2)>>2]|0)+(((o|0)>(B|0)?o:B)<<2)>>2]|0)|0}else B=m;if((q|0)<=1)break;else m=B}o=(d|0)>(e|0);p=e+1|0;p=(c[(c[17748+(((d|0)<(e|0)?d:e)<<2)>>2]|0)+((o?d:e)<<2)>>2]|0)+(c[(c[17748+((o?p:d)<<2)>>2]|0)+(((p|0)<(d|0)?d:p)<<2)>>2]|0)|0;o=p+-1|0;m=32-(aa(o|0)|0)|0;a:do if((m|0)>8){C=m+-8|0;m=o>>>C;o=m+1|0;p=B>>>C;v=j+28|0;q=c[v>>2]|0;r=(q>>>0)/(o>>>0)|0;if(!p){r=q-(_(r,m)|0)|0;c[v>>2]=r;u=j+32|0}else{A=q-(_(r,o-p|0)|0)|0;u=j+32|0;c[u>>2]=(c[u>>2]|0)+A;c[v>>2]=r}s=j+36|0;A=j+20|0;t=j+40|0;w=j+24|0;x=j+8|0;y=j+4|0;z=j+44|0;while(1){if(r>>>0>=8388609)break;m=c[u>>2]|0;q=m>>>23;if((q|0)==255)c[s>>2]=(c[s>>2]|0)+1;else{p=m>>>31;m=c[t>>2]|0;if((m|0)>-1){o=c[w>>2]|0;if((o+(c[x>>2]|0)|0)>>>0<(c[y>>2]|0)>>>0){c[w>>2]=o+1;a[(c[j>>2]|0)+o>>0]=m+p;m=0}else m=-1;c[z>>2]=c[z>>2]|m}m=c[s>>2]|0;if(m|0){p=p+255&255;do{o=c[w>>2]|0;if((o+(c[x>>2]|0)|0)>>>0<(c[y>>2]|0)>>>0){c[w>>2]=o+1;a[(c[j>>2]|0)+o>>0]=p;o=0;m=c[s>>2]|0}else o=-1;c[z>>2]=c[z>>2]|o;m=m+-1|0;c[s>>2]=m}while((m|0)!=0)}c[t>>2]=q&255;m=c[u>>2]|0;r=c[v>>2]|0}c[u>>2]=m<<8&2147483392;r=r<<8;c[v>>2]=r;c[A>>2]=(c[A>>2]|0)+8}t=(1<>2]|0;v=j+16|0;o=c[v>>2]|0;if((o+C|0)>>>0>32){r=7-o|0;r=o+((r|0)>-8?r:-8)&-8;s=o;do{p=c[x>>2]|0;q=c[y>>2]|0;if(((c[w>>2]|0)+p|0)>>>0>>0){p=p+1|0;c[x>>2]=p;a[(c[j>>2]|0)+(q-p)>>0]=m;p=0}else p=-1;c[z>>2]=c[z>>2]|p;m=m>>>8;s=s+-8|0}while((s|0)>7);o=o+-8-r|0}c[u>>2]=m|t<>2]=o+C;c[A>>2]=(c[A>>2]|0)+C}else{z=j+28|0;m=c[z>>2]|0;o=(m>>>0)/(p>>>0)|0;if(!B){o=m-(_(o,p+-1|0)|0)|0;c[z>>2]=o;y=j+32|0}else{C=m-(_(o,p-B|0)|0)|0;y=j+32|0;c[y>>2]=(c[y>>2]|0)+C;c[z>>2]=o}r=j+36|0;s=j+20|0;t=j+40|0;u=j+24|0;v=j+8|0;w=j+4|0;x=j+44|0;while(1){if(o>>>0>=8388609)break a;m=c[y>>2]|0;q=m>>>23;if((q|0)==255)c[r>>2]=(c[r>>2]|0)+1;else{p=m>>>31;m=c[t>>2]|0;if((m|0)>-1){o=c[u>>2]|0;if((o+(c[v>>2]|0)|0)>>>0<(c[w>>2]|0)>>>0){c[u>>2]=o+1;a[(c[j>>2]|0)+o>>0]=m+p;m=0}else m=-1;c[x>>2]=c[x>>2]|m}m=c[r>>2]|0;if(m|0){p=p+255&255;do{o=c[u>>2]|0;if((o+(c[v>>2]|0)|0)>>>0<(c[w>>2]|0)>>>0){c[u>>2]=o+1;a[(c[j>>2]|0)+o>>0]=p;o=0;m=c[r>>2]|0}else o=-1;c[x>>2]=c[x>>2]|o;m=m+-1|0;c[r>>2]=m}while((m|0)!=0)}c[t>>2]=q&255;m=c[y>>2]|0;o=c[z>>2]|0}c[y>>2]=m<<8&2147483392;o=o<<8;c[z>>2]=o;c[s>>2]=(c[s>>2]|0)+8}}while(0);if(l|0){n=1.0/+O(+n)*k;m=0;do{g[b+(m<<2)>>2]=n*+(c[D+(m<<2)>>2]|0);m=m+1|0}while((m|0)<(d|0));vd(b,d,-1,h,e,f)}if((h|0)<2){h=1;i=E;return h|0}r=(d>>>0)/(h>>>0)|0;m=0;s=0;do{o=_(s,r)|0;p=0;q=0;do{q=q|c[D+(o+p<<2)>>2];p=p+1|0}while((p|0)<(r|0));m=m|((q|0)!=0&1)<=(b|0)|(h|0)==0)return;v=+(b|0)/+((_(c[17352+(h+-1<<2)>>2]|0,f)|0)+b|0);v=v*v*.5;u=+Q(+(v*1.5707963705062866));v=+Q(+((1.0-v)*1.5707963705062866));a:do if((e<<3|0)>(b|0))h=0;else{f=e>>2;h=1;while(1){if(((_((_(h,h)|0)+h|0,e)|0)+f|0)>=(b|0))break a;h=h+1|0}}while(0);t=(b>>>0)/(e>>>0)|0;i=(d|0)<0;j=(h|0)==0;k=-v;l=t+-1|0;m=t+-3|0;n=t+-2|0;o=-u;p=t-h|0;q=t-(h<<1)|0;r=q+-1|0;s=0;while(1){if((s|0)>=(e|0))break;d=a+((_(s,t)|0)<<2)|0;b:do if(!i){f=d;b=0;while(1){if((b|0)>=(l|0))break;y=+g[f>>2];w=f+4|0;x=+g[w>>2];g[w>>2]=x*u+y*k;g[f>>2]=y*u+x*v;f=w;b=b+1|0}f=d+(m<<2)|0;b=n;while(1){if((b|0)<=0)break;x=+g[f>>2];w=f+4|0;y=+g[w>>2];g[w>>2]=y*u+x*k;g[f>>2]=x*u+y*v;f=f+-4|0;b=b+-1|0}if(!j){f=d;b=0;while(1){if((b|0)>=(p|0))break;x=+g[f>>2];w=f+(h<<2)|0;y=+g[w>>2];g[w>>2]=y*v+x*o;g[f>>2]=x*v+y*u;f=f+4|0;b=b+1|0}f=d+(r<<2)|0;b=q;while(1){if((b|0)<=0)break b;x=+g[f>>2];w=f+(h<<2)|0;y=+g[w>>2];g[w>>2]=y*v+x*o;g[f>>2]=x*v+y*u;f=f+-4|0;b=b+-1|0}}}else{c:do if(j){f=d;b=0}else{f=d;b=0;while(1){if((b|0)>=(p|0))break;x=+g[f>>2];w=f+(h<<2)|0;y=+g[w>>2];g[w>>2]=y*v+x*u;g[f>>2]=x*v+y*o;f=f+4|0;b=b+1|0}f=d+(r<<2)|0;b=q;while(1){if((b|0)<=0){f=d;b=0;break c}x=+g[f>>2];w=f+(h<<2)|0;y=+g[w>>2];g[w>>2]=y*v+x*u;g[f>>2]=x*v+y*o;f=f+-4|0;b=b+-1|0}}while(0);while(1){if((b|0)>=(l|0))break;x=+g[f>>2];w=f+4|0;y=+g[w>>2];g[w>>2]=y*u+x*v;g[f>>2]=x*u+y*k;f=w;b=b+1|0}f=d+(m<<2)|0;b=n;while(1){if((b|0)<=0)break b;x=+g[f>>2];w=f+4|0;y=+g[w>>2];g[w>>2]=y*u+x*v;g[f>>2]=x*u+y*k;f=f+-4|0;b=b+-1|0}}while(0);s=s+1|0}return}function wd(a,b,d,e,f,h,j){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;h=h|0;j=+j;var k=0.0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0.0,w=0.0;u=i;t=i;i=i+((1*(b<<2)|0)+15&-16)|0;s=(b|0)>(d|0);o=d+1|0;q=b;r=d;o=bd(h,(c[(c[17748+(((b|0)<(d|0)?b:d)<<2)>>2]|0)+((s?b:d)<<2)>>2]|0)+(c[(c[17748+((s?o:b)<<2)>>2]|0)+(((o|0)<(b|0)?b:o)<<2)>>2]|0)|0)|0;s=t;k=0.0;while(1){if((q|0)<=2)break;do if((r|0)<(q|0)){h=c[(c[17748+(r<<2)>>2]|0)+(q<<2)>>2]|0;l=c[(c[17748+(r+1<<2)>>2]|0)+(q<<2)>>2]|0;if(o>>>0>=h>>>0&o>>>0>>0){c[s>>2]=0;l=o-h|0;h=r;break}n=o>>>0>=l>>>0;l=o-(n?l:0)|0;h=r;do{h=h+-1|0;m=c[(c[17748+(h<<2)>>2]|0)+(q<<2)>>2]|0}while(l>>>0>>0);p=n<<31>>31;r=r-h+p^p;c[s>>2]=r<<16>>16;v=+((r&65535)<<16>>16);l=l-m|0;k=k+v*v}else{m=c[17748+(q<<2)>>2]|0;n=c[m+(r+1<<2)>>2]|0;l=o>>>0>=n>>>0;p=l<<31>>31;n=o-(l?n:0)|0;a:do if((c[m+(q<<2)>>2]|0)>>>0>n>>>0){h=q;do{h=h+-1|0;l=c[(c[17748+(h<<2)>>2]|0)+(q<<2)>>2]|0}while(l>>>0>n>>>0)}else{h=r;while(1){l=c[m+(h<<2)>>2]|0;if(l>>>0<=n>>>0)break a;h=h+-1|0}}while(0);r=r-h+p^p;c[s>>2]=r<<16>>16;v=+((r&65535)<<16>>16);l=n-l|0;k=k+v*v}while(0);q=q+-1|0;r=h;o=l;s=s+4|0}h=r<<1|1;l=o>>>0>=h>>>0;m=l<<31>>31;h=o-(l?h:0)|0;l=(h+1|0)>>>1;if(l)h=h-((l<<1)+-1)|0;r=r-l+m^m;c[s>>2]=r<<16>>16;w=+((r&65535)<<16>>16);h=l-h^0-h;c[s+4>>2]=h<<16>>16;v=+((h&65535)<<16>>16);k=1.0/+O(+(k+w*w+v*v))*j;h=0;do{g[a+(h<<2)>>2]=k*+(c[t+(h<<2)>>2]|0);h=h+1|0}while((h|0)<(b|0));vd(a,b,-1,f,d,e);if((f|0)<2){f=1;i=u;return f|0}o=(b>>>0)/(f>>>0)|0;h=0;p=0;do{l=_(p,o)|0;m=0;n=0;do{n=n|c[t+(l+m<<2)>>2];m=m+1|0}while((m|0)<(o|0));h=h|((n|0)!=0&1)<>2]=0;c[M+4>>2]=0;M=g+4|0;a:do if(!j)j=c[M>>2]|0;else{n=0;while(1){j=c[M>>2]|0;if((n|0)>=(j|0))break a;c[f+(n*4260|0)+2388>>2]=0;n=n+1|0}}while(0);O=f+8536|0;if((j|0)>(c[O>>2]|0)){j=f+4260|0;nf(j|0,0,4260)|0;c[f+6636>>2]=1;c[j>>2]=65536;c[f+8408>>2]=0;c[f+8412>>2]=3176576;c[f+8428>>2]=c[f+6588>>2]<<7;c[f+8500>>2]=65536;c[f+8504>>2]=65536;c[f+8516>>2]=20;c[f+8512>>2]=2;j=c[M>>2]|0}if((j|0)==1?(c[O>>2]|0)==2:0)L=(c[g+12>>2]|0)==((c[f+2316>>2]|0)*1e3|0);else L=0;H=f+2388|0;b:do if(!(c[H>>2]|0)){x=g+16|0;y=g+12|0;z=g+8|0;w=0;A=0;c:while(1){if((w|0)>=(j|0))break b;switch(c[x>>2]|0){case 0:{c[f+(w*4260|0)+2392>>2]=1;c[f+(w*4260|0)+2324>>2]=2;j=2;break}case 10:{c[f+(w*4260|0)+2392>>2]=1;c[f+(w*4260|0)+2324>>2]=2;j=2;break}case 20:{c[f+(w*4260|0)+2392>>2]=1;c[f+(w*4260|0)+2324>>2]=4;j=4;break}case 40:{c[f+(w*4260|0)+2392>>2]=2;c[f+(w*4260|0)+2324>>2]=4;j=4;break}case 60:{c[f+(w*4260|0)+2392>>2]=3;c[f+(w*4260|0)+2324>>2]=4;j=4;break}default:{j=-203;B=183;break c}}s=c[y>>2]>>10;t=s+1|0;u=(t|0)==8;switch(s|0){case 7:case 11:case 15:break;default:{j=-200;B=183;break c}}o=c[z>>2]|0;v=t<<16>>16;c[f+(w*4260|0)+2332>>2]=v*5;p=f+(w*4260|0)+2324|0;q=_(j,v*327680>>16)|0;r=f+(w*4260|0)+2316|0;j=f+(w*4260|0)+2320|0;if((c[r>>2]|0)==(t|0)?(c[j>>2]|0)==(o|0):0){j=1;n=0;B=23}else{n=Hd(f+(w*4260|0)+2432|0,v*1e3|0,o,0)|0;c[j>>2]=o;j=(c[r>>2]|0)==(t|0);if(j)B=23;else B=24}if((B|0)==23){B=0;if((q|0)!=(c[f+(w*4260|0)+2328>>2]|0))B=24}if((B|0)==24){B=0;o=(c[p>>2]|0)==4;p=f+(w*4260|0)+2384|0;do if(u)if(o){c[p>>2]=30064;break}else{c[p>>2]=30087;break}else if(o){c[p>>2]=30030;break}else{c[p>>2]=30075;break}while(0);if(!j){c[f+(w*4260|0)+2336>>2]=v*20;switch(s|0){case 7:case 11:{c[f+(w*4260|0)+2340>>2]=10;c[f+(w*4260|0)+2732>>2]=22896;if((t|0)==12)c[f+(w*4260|0)+2380>>2]=29956;else B=37;break}default:{c[f+(w*4260|0)+2340>>2]=16;c[f+(w*4260|0)+2732>>2]=22936;if((t|0)==16)c[f+(w*4260|0)+2380>>2]=29962;else B=37}}if((B|0)==37?(0,u):0)c[f+(w*4260|0)+2380>>2]=29947;c[f+(w*4260|0)+2376>>2]=1;c[f+(w*4260|0)+2308>>2]=100;a[f+(w*4260|0)+2312>>0]=10;c[f+(w*4260|0)+4164>>2]=0;nf(f+(w*4260|0)+1284|0,0,1024)|0}c[r>>2]=t;c[f+(w*4260|0)+2328>>2]=q}j=c[M>>2]|0;w=w+1|0;A=A+n|0}if((B|0)==183){i=P;return j|0}}else A=0;while(0);n=c[g>>2]|0;do if((n|0)==2)if((j|0)==2){if((c[f+8532>>2]|0)!=1?(c[O>>2]|0)!=1:0){j=2;break}c[f+8520>>2]=0;c[f+8528>>2]=0;rf(f+6692|0,f+2432|0,300)|0;j=c[g>>2]|0}else j=2;else j=n;while(0);c[f+8532>>2]=j;c[O>>2]=c[M>>2];G=g+8|0;if(((c[G>>2]|0)+-8e3|0)>>>0>4e4){f=-200;i=P;return f|0}I=(h|0)==1;d:do if(!I?(c[H>>2]|0)==0:0){y=k+28|0;z=k+32|0;B=k+20|0;C=k+40|0;D=k+24|0;E=k+4|0;t=0;while(1){j=c[M>>2]|0;if((t|0)>=(j|0)){u=0;break}q=f+(t*4260|0)+2392|0;r=0;while(1){o=c[y>>2]|0;n=c[z>>2]|0;j=o>>>1;p=n>>>0>>0;s=p&1;if((r|0)>=(c[q>>2]|0))break;if(!p){n=n-j|0;c[z>>2]=n;j=o-j|0}c[y>>2]=j;while(1){if(j>>>0>=8388609)break;c[B>>2]=(c[B>>2]|0)+8;j=j<<8;c[y>>2]=j;p=c[C>>2]|0;o=c[D>>2]|0;if(o>>>0<(c[E>>2]|0)>>>0){c[D>>2]=o+1;o=d[(c[k>>2]|0)+o>>0]|0}else o=0;c[C>>2]=o;x=((p<<8|o)>>>1&255|n<<8&2147483392)^255;c[z>>2]=x;n=x}c[f+(t*4260|0)+2404+(r<<2)>>2]=s;r=r+1|0}if(!p){n=n-j|0;c[z>>2]=n;j=o-j|0}c[y>>2]=j;while(1){if(j>>>0>=8388609)break;c[B>>2]=(c[B>>2]|0)+8;j=j<<8;c[y>>2]=j;p=c[C>>2]|0;o=c[D>>2]|0;if(o>>>0<(c[E>>2]|0)>>>0){c[D>>2]=o+1;o=d[(c[k>>2]|0)+o>>0]|0}else o=0;c[C>>2]=o;x=((p<<8|o)>>>1&255|n<<8&2147483392)^255;c[z>>2]=x;n=x}c[f+(t*4260|0)+2416>>2]=s;t=t+1|0}while(1){if((u|0)>=(j|0))break;j=f+(u*4260|0)+2420|0;c[j>>2]=0;c[j+4>>2]=0;c[j+8>>2]=0;e:do if(c[f+(u*4260|0)+2416>>2]|0){t=f+(u*4260|0)+2392|0;n=c[t>>2]|0;if((n|0)==1){c[j>>2]=1;break}j=c[17520+(n+-2<<2)>>2]|0;r=c[y>>2]|0;n=c[z>>2]|0;o=r>>>8;s=-1;while(1){p=s+1|0;q=_(o,d[j+p>>0]|0)|0;if(n>>>0>>0){s=p;r=q}else break}p=n-q|0;c[z>>2]=p;j=r-q|0;c[y>>2]=j;while(1){if(j>>>0>=8388609)break;c[B>>2]=(c[B>>2]|0)+8;j=j<<8;c[y>>2]=j;o=c[C>>2]|0;n=c[D>>2]|0;if(n>>>0<(c[E>>2]|0)>>>0){c[D>>2]=n+1;n=d[(c[k>>2]|0)+n>>0]|0}else n=0;c[C>>2]=n;x=((o<<8|n)>>>1&255|p<<8&2147483392)^255;c[z>>2]=x;p=x}j=s+2|0;n=0;while(1){if((n|0)>=(c[t>>2]|0))break e;c[f+(u*4260|0)+2420+(n<<2)>>2]=j>>>n&1;n=n+1|0}}while(0);j=c[M>>2]|0;u=u+1|0}if(!h){w=f+2392|0;x=f+6680|0;n=0;v=0;while(1){if((v|0)>=(c[w>>2]|0))break d;s=x+(v<<2)|0;t=(v|0)>0;u=v+-1|0;r=0;while(1){if((r|0)>=(j|0))break;if(c[f+(r*4260|0)+2420+(v<<2)>>2]|0){f:do if((j|0)==2&(r|0)==0?(Md(k,K),(c[s>>2]|0)==0):0){q=c[y>>2]|0;j=c[z>>2]|0;o=q>>>8;n=-1;while(1){n=n+1|0;p=_(o,d[29916+n>>0]|0)|0;if(j>>>0>=p>>>0)break;else q=p}o=j-p|0;c[z>>2]=o;j=q-p|0;c[y>>2]=j;q=o;while(1){if(j>>>0>=8388609)break f;c[B>>2]=(c[B>>2]|0)+8;j=j<<8;c[y>>2]=j;p=c[C>>2]|0;o=c[D>>2]|0;if(o>>>0<(c[E>>2]|0)>>>0){c[D>>2]=o+1;o=d[(c[k>>2]|0)+o>>0]|0}else o=0;c[C>>2]=o;p=((p<<8|o)>>>1&255|q<<8&2147483392)^255;c[z>>2]=p;q=p}}while(0);if(t?(c[f+(r*4260|0)+2420+(u<<2)>>2]|0)!=0:0)j=2;else j=0;ee(f+(r*4260|0)|0,k,v,1,j);fe(k,F,a[f+(r*4260|0)+2765>>0]|0,a[f+(r*4260|0)+2766>>0]|0,c[f+(r*4260|0)+2328>>2]|0);j=c[M>>2]|0}r=r+1|0}v=v+1|0}}else n=0}else n=0;while(0);j=c[M>>2]|0;do if((j|0)==2){switch(h|0){case 0:{Md(k,K);if(!(c[f+6664+(c[H>>2]<<2)>>2]|0))B=112;else{n=0;B=121}break}case 2:{if((c[f+2420+(c[H>>2]<<2)>>2]|0)==1){Md(k,K);if(!(c[f+6680+(c[H>>2]<<2)>>2]|0))B=112;else{n=0;B=121}}else B=108;break}default:B=108}g:do if((B|0)==108){j=f+8520|0;o=0;while(1){if((o|0)==2)break g;c[K+(o<<2)>>2]=b[j+(o<<1)>>1];o=o+1|0}}else if((B|0)==112){v=k+28|0;q=c[v>>2]|0;w=k+32|0;j=c[w>>2]|0;o=q>>>8;n=-1;while(1){n=n+1|0;p=_(o,d[29916+n>>0]|0)|0;if(j>>>0>=p>>>0)break;else q=p}u=j-p|0;c[w>>2]=u;j=q-p|0;c[v>>2]=j;q=k+20|0;r=k+40|0;s=k+24|0;t=k+4|0;while(1){if(j>>>0>=8388609){B=121;break g}c[q>>2]=(c[q>>2]|0)+8;j=j<<8;c[v>>2]=j;p=c[r>>2]|0;o=c[s>>2]|0;if(o>>>0<(c[t>>2]|0)>>>0){c[s>>2]=o+1;o=d[(c[k>>2]|0)+o>>0]|0}else o=0;c[r>>2]=o;F=((p<<8|o)>>>1&255|u<<8&2147483392)^255;c[w>>2]=F;u=F}}while(0);if((B|0)==121){j=c[M>>2]|0;if((j|0)!=2)break}if((n|0)==0?(c[f+8540>>2]|0)==1:0){nf(f+5544|0,0,1024)|0;c[f+6568>>2]=100;a[f+6572>>0]=10;c[f+8424>>2]=0;c[f+6636>>2]=1;j=c[M>>2]|0}else j=2}while(0);C=_(c[g+12>>2]|0,j)|0;C=(C|0)<(_(c[G>>2]|0,c[g>>2]|0)|0);if(C){E=Fa()|0;c[N>>2]=l;B=l+(c[f+2328>>2]<<1)+4|0;c[N+4>>2]=B;q=l}else{B=f+2328|0;F=_(j,(c[B>>2]|0)+2|0)|0;E=Fa()|0;q=i;i=i+((1*(F<<1)|0)+15&-16)|0;c[N>>2]=q;B=q+(c[B>>2]<<1)+4|0;c[N+4>>2]=B}if(!h){D=f+8540|0;p=(n|0)==0&1}else{j=f+8540|0;if(c[j>>2]|0)if((c[M>>2]|0)==2&(h|0)==2)o=(c[f+6680+(c[f+6648>>2]<<2)>>2]|0)==1;else o=0;else o=1;D=j;p=o&1}o=(h|0)==2;r=0;while(1){j=c[M>>2]|0;if((r|0)>=(j|0))break;if((r|0)==0|(p|0)!=0){j=(c[H>>2]|0)-r|0;do if((j|0)<1)j=0;else{if(o){j=c[f+(r*4260|0)+2420+(j+-1<<2)>>2]|0?2:0;break}if((r|0)>0?c[D>>2]|0:0){j=1;break}j=2}while(0);j=A+(de(f+(r*4260|0)|0,k,(c[N+(r<<2)>>2]|0)+4|0,J,h,j)|0)|0}else{nf((c[N+(r<<2)>>2]|0)+4|0,0,c[J>>2]<<1|0)|0;j=A}A=f+(r*4260|0)+2388|0;c[A>>2]=(c[A>>2]|0)+1;r=r+1|0;A=j}h:do if((c[g>>2]|0)==2&(j|0)==2){x=f+8520|0;y=f+2316|0;j=c[y>>2]|0;z=c[J>>2]|0;v=f+8524|0;r=e[v>>1]|e[v+2>>1]<<16;b[q>>1]=r;b[q+2>>1]=r>>>16;r=f+8528|0;s=e[r>>1]|e[r+2>>1]<<16;b[B>>1]=s;b[B+2>>1]=s>>>16;s=q+(z<<1)|0;s=e[s>>1]|e[s+2>>1]<<16;b[v>>1]=s;b[v+2>>1]=s>>>16;v=B+(z<<1)|0;v=e[v>>1]|e[v+2>>1]<<16;b[r>>1]=v;b[r+2>>1]=v>>>16;r=b[x>>1]|0;v=f+8522|0;s=b[v>>1]|0;j=j<<3;w=c[K>>2]|0;o=(65536/(j|0)|0)<<16>>16;t=((_(w-(r&65535)<<16>>16,o)|0)>>15)+1>>1;u=c[K+4>>2]|0;o=((_(u-(s&65535)<<16>>16,o)|0)>>15)+1>>1;p=0;r=r<<16>>16;s=s<<16>>16;while(1){if((p|0)>=(j|0))break;J=r+t|0;K=s+o|0;k=p+1|0;F=b[q+(k<<1)>>1]|0;R=(b[q+(p<<1)>>1]|0)+(b[q+(p+2<<1)>>1]|0)+(F<<1)|0;h=B+(k<<1)|0;Q=J<<16>>16;H=K<<16>>16;H=((b[h>>1]<<8)+((_(R>>7,Q)|0)+((_(R<<9&65024,Q)|0)>>16))+((_(F>>5,H)|0)+((_(F<<11&63488,H)|0)>>16))>>7)+1>>1;b[h>>1]=(H|0)>32767?32767:((H|0)<-32768?-32768:H)&65535;p=k;r=J;s=K}o=w<<16>>16;p=u<<16>>16;while(1){if((j|0)>=(z|0))break;R=j+1|0;K=b[q+(R<<1)>>1]|0;J=(b[q+(j<<1)>>1]|0)+(b[q+(j+2<<1)>>1]|0)+(K<<1)|0;Q=B+(R<<1)|0;K=((b[Q>>1]<<8)+((_(J>>7,o)|0)+((_(J<<9&65024,o)|0)>>16))+((_(K>>5,p)|0)+((_(K<<11&63488,p)|0)>>16))>>7)+1>>1;b[Q>>1]=(K|0)>32767?32767:((K|0)<-32768?-32768:K)&65535;j=R}b[x>>1]=w;b[v>>1]=u;j=0;while(1){if((j|0)>=(z|0)){t=y;s=z;break h}R=j+1|0;J=q+(R<<1)|0;h=b[J>>1]|0;Q=B+(R<<1)|0;K=b[Q>>1]|0;k=h+K|0;K=h-K|0;b[J>>1]=(k|0)>32767?32767:((k|0)<-32768?-32768:k)&65535;b[Q>>1]=(K|0)>32767?32767:((K|0)<-32768?-32768:K)&65535;j=R}}else{t=f+8524|0;s=e[t>>1]|e[t+2>>1]<<16;b[q>>1]=s;b[q+2>>1]=s>>>16;s=c[J>>2]|0;q=c[N>>2]|0;R=q+(s<<1)|0;R=e[R>>1]|e[R+2>>1]<<16;b[t>>1]=R;b[t+2>>1]=R>>>16;t=f+2316|0}while(0);o=_(s,c[G>>2]|0)|0;o=(o|0)/((c[t>>2]<<16>>16)*1e3|0)|0;c[m>>2]=o;j=c[g>>2]|0;p=(j|0)==2;if(p){r=i;i=i+((1*((p?o:1)<<1)|0)+15&-16)|0}else r=l;if(C){R=c[f+2328>>2]|0;Q=_(c[M>>2]|0,R+2|0)|0;q=i;i=i+((1*(Q<<1)|0)+15&-16)|0;rf(q|0,l|0,Q<<1|0)|0;c[N>>2]=q;c[N+4>>2]=q+(R<<1)+4}p=0;while(1){o=c[M>>2]|0;if((p|0)>=(((j|0)<(o|0)?j:o)|0))break;Id(f+(p*4260|0)+2432|0,r,(c[N+(p<<2)>>2]|0)+2|0,s);j=c[g>>2]|0;if((j|0)==2){j=0;while(1){if((j|0)>=(c[m>>2]|0))break;b[l+(p+(j<<1)<<1)>>1]=b[r+(j<<1)>>1]|0;j=j+1|0}j=c[g>>2]|0}p=p+1|0}i:do if((j|0)==2&(o|0)==1){if(!L){j=0;while(1){if((j|0)>=(c[m>>2]|0))break i;R=j<<1;b[l+((R|1)<<1)>>1]=b[l+(R<<1)>>1]|0;j=j+1|0}}Id(f+6692|0,r,q+2|0,s);j=0;while(1){if((j|0)>=(c[m>>2]|0))break i;b[l+((j<<1|1)<<1)>>1]=b[r+(j<<1)>>1]|0;j=j+1|0}}while(0);if((c[f+4164>>2]|0)==2)j=_(c[f+2308>>2]|0,c[17364+((c[t>>2]|0)+-8>>2<<2)>>2]|0)|0;else j=0;c[g+20>>2]=j;j:do if(I){j=0;while(1){if((j|0)>=(c[O>>2]|0))break j;a[f+(j*4260|0)+2312>>0]=10;j=j+1|0}}else c[D>>2]=n;while(0);Na(E|0);R=A;i=P;return R|0}function yd(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0;nf(a|0,0,20400)|0;e=0;f=0;while(1){if((e|0)==2)break;g=f+(Fd(a+(e*10156|0)|0,b)|0)|0;e=e+1|0;f=g}c[a+20376>>2]=1;g=a+20380|0;c[g>>2]=1;c[d>>2]=1;c[d+4>>2]=c[g>>2];c[d+8>>2]=c[a+4648>>2];c[d+12>>2]=c[a+4656>>2];c[d+16>>2]=c[a+4660>>2];c[d+20>>2]=c[a+4664>>2];c[d+24>>2]=c[a+4704>>2];c[d+28>>2]=c[a+4700>>2];c[d+32>>2]=c[a+4708>>2];c[d+36>>2]=c[a+4716>>2];c[d+40>>2]=c[a+6180>>2];c[d+48>>2]=c[a+6168>>2];c[d+52>>2]=c[a+4768>>2];g=a+4668|0;c[d+72>>2]=(c[g>>2]<<16>>16)*1e3;c[d+76>>2]=c[a+4628>>2];if((c[g>>2]|0)!=16){e=0;e=e&1;g=d+80|0;c[g>>2]=e;return f|0}e=(c[a+28>>2]|0)==0;e=e&1;g=d+80|0;c[g>>2]=e;return f|0}function zd(f,g,h,j,k,l,m){f=f|0;g=g|0;h=h|0;j=j|0;k=k|0;l=l|0;m=m|0;var n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,$=0,ba=0,ca=0,da=0,ea=0,fa=0,ga=0,ha=0,ia=0,ja=0,ka=0,la=0,ma=0,na=0,oa=0,pa=0,qa=0,ra=0,sa=0,ta=0,ua=0,va=0,wa=0,xa=0,ya=0,za=0,Aa=0,Ba=0,Ca=0,Da=0,Ea=0,Ga=0,Ha=0,Ia=0,Ja=0,Ka=0,La=0,Ma=0,Oa=0,Pa=0,Qa=0,Ra=0,Sa=0,Ta=0,Ua=0,Va=0,Wa=0,Xa=0,Ya=0,Za=0,_a=0,$a=0,ab=0,bb=0,cb=0,db=0,eb=0,fb=0,gb=0,hb=0;hb=i;i=i+16|0;fb=hb;if(c[g+68>>2]|0){c[f+4756>>2]=1;c[f+14912>>2]=1}db=f+15996|0;c[db>>2]=0;eb=f+5840|0;c[eb>>2]=0;M=g+8|0;o=c[M>>2]|0;a:do if((o|0)<24e3){if((o|0)<12e3){switch(o|0){case 8e3:break a;default:n=-102}i=hb;return n|0}if((o|0)<16e3){switch(o|0){case 12e3:break a;default:n=-102}i=hb;return n|0}else{switch(o|0){case 16e3:break a;default:n=-102}i=hb;return n|0}}else if((o|0)<44100)if((o|0)<32e3){switch(o|0){case 24e3:break a;default:n=-102}i=hb;return n|0}else{switch(o|0){case 32e3:break a;default:n=-102}i=hb;return n|0}else if((o|0)<48e3){switch(o|0){case 44100:break a;default:n=-102}i=hb;return n|0}else{switch(o|0){case 48e3:break a;default:n=-102}i=hb;return n|0}while(0);L=g+20|0;o=c[L>>2]|0;b:do if((o|0)>=12e3)if((o|0)<16e3){switch(o|0){case 12e3:break b;default:n=-102}i=hb;return n|0}else{switch(o|0){case 16e3:break b;default:n=-102}i=hb;return n|0}else{switch(o|0){case 8e3:break b;default:n=-102}i=hb;return n|0}while(0);J=g+12|0;p=c[J>>2]|0;c:do if((p|0)>=12e3)if((p|0)<16e3){switch(p|0){case 12e3:break c;default:n=-102}i=hb;return n|0}else{switch(p|0){case 16e3:break c;default:n=-102}i=hb;return n|0}else{switch(p|0){case 8e3:break c;default:n=-102}i=hb;return n|0}while(0);K=g+16|0;q=c[K>>2]|0;d:do if((q|0)>=12e3)if((q|0)<16e3){switch(q|0){case 12e3:break d;default:n=-102}i=hb;return n|0}else{switch(q|0){case 16e3:break d;default:n=-102}i=hb;return n|0}else{switch(q|0){case 8e3:break d;default:n=-102}i=hb;return n|0}while(0);if((q|0)>(o|0)|(p|0)<(o|0)|(q|0)>(p|0)){f=-102;i=hb;return f|0}cb=g+24|0;switch(c[cb>>2]|0){case 60:case 40:case 20:case 10:break;default:{f=-103;i=hb;return f|0}}G=g+32|0;if((c[G>>2]|0)>>>0>100){f=-105;i=hb;return f|0}H=g+48|0;if((c[H>>2]|0)>>>0>1){f=-108;i=hb;return f|0}ab=g+52|0;if((c[ab>>2]|0)>>>0>1){f=-109;i=hb;return f|0}I=g+40|0;if((c[I>>2]|0)>>>0>1){f=-107;i=hb;return f|0}o=c[g>>2]|0;if((o+-1|0)>>>0>1){f=-111;i=hb;return f|0}gb=g+4|0;p=c[gb>>2]|0;if((p+-1|0)>>>0>1|(p|0)>(o|0)){f=-111;i=hb;return f|0}bb=g+36|0;if((c[bb>>2]|0)>>>0>10){f=-106;i=hb;return f|0}F=g+88|0;c[F>>2]=0;q=f+20380|0;if((p|0)>(c[q>>2]|0)){p=f+10156|0;o=Fd(p,c[f+5184>>2]|0)|0;c[f+20312>>2]=0;c[f+20320>>2]=0;c[f+20324>>2]=0;c[f+20328>>2]=1;c[f+20332>>2]=0;c[f+20336>>2]=1;b[f+20342>>1]=0;b[f+20340>>1]=16384;if((c[f+20376>>2]|0)==2){rf(f+16024|0,f+5868|0,300)|0;Ya=f;Za=c[Ya+4>>2]|0;_a=p;c[_a>>2]=c[Ya>>2];c[_a+4>>2]=Za}}else o=0;if((c[cb>>2]|0)==(c[f+4704>>2]|0))E=(c[q>>2]|0)!=(c[gb>>2]|0);else E=1;c[f+20376>>2]=c[g>>2];c[q>>2]=c[gb>>2];p=j*100|0;q=c[M>>2]|0;D=(p|0)/(q|0)|0;Za=(D|0)>1?D>>1:1;_a=(m|0)==0;e:do if(_a){if((_(D,q)|0)!=(p|0)|(j|0)<0){f=-101;i=hb;return f|0}if((j*1e3|0)>(_(c[cb>>2]|0,q)|0)){f=-101;i=hb;return f|0}else{Ya=f;m=0;r=0;break}}else{if((D|0)!=1){f=-101;i=hb;return f|0}p=0;while(1){q=c[gb>>2]|0;if((p|0)>=(q|0))break;o=Fd(f+(p*10156|0)|0,c[f+(p*10156|0)+5184>>2]|0)|0;p=p+1|0}r=c[cb>>2]|0;c[cb>>2]=10;m=c[bb>>2]|0;c[bb>>2]=0;p=0;while(1){if((p|0)>=(q|0)){Ya=f;break e}c[f+(p*10156|0)+4760>>2]=0;c[f+(p*10156|0)+4772>>2]=1;q=c[gb>>2]|0;p=p+1|0}}while(0);Xa=f+4668|0;Ua=f+20392|0;A=g+44|0;B=g+64|0;Va=g+56|0;Wa=f+5836|0;C=0;while(1){if((C|0)>=(c[gb>>2]|0))break;if((C|0)==1)v=c[Xa>>2]|0;else v=0;w=Ya+(C*10156|0)|0;t=c[Ua>>2]|0;z=Ya+(C*10156|0)+6168|0;c[z>>2]=c[H>>2];c[Ya+(C*10156|0)+4768>>2]=c[ab>>2];o=c[M>>2]|0;c[Ya+(C*10156|0)+4648>>2]=o;p=c[J>>2]|0;c[Ya+(C*10156|0)+4656>>2]=p;q=c[K>>2]|0;c[Ya+(C*10156|0)+4660>>2]=q;u=c[L>>2]|0;c[Ya+(C*10156|0)+4664>>2]=u;c[Ya+(C*10156|0)+6180>>2]=c[I>>2];c[Ya+(C*10156|0)+5844>>2]=c[g>>2];c[Ya+(C*10156|0)+5848>>2]=c[gb>>2];c[Ya+(C*10156|0)+4628>>2]=t;c[Ya+(C*10156|0)+5852>>2]=C;y=Ya+(C*10156|0)+4760|0;do if(!(c[y>>2]|0))$a=41;else{if(c[Ya+(C*10156|0)+4772>>2]|0){$a=41;break}if((o|0)==(c[Ya+(C*10156|0)+4652>>2]|0))break;o=c[Ya+(C*10156|0)+4668>>2]|0;if((o|0)<=0)break;n=Gd(w,o)|0;$a=110}while(0);if(($a|0)==41){$a=0;x=Ya+(C*10156|0)+4668|0;n=c[x>>2]|0;Ta=n<<16>>16;s=Ta*1e3|0;do if(Ta){if((s|0)>(o|0)|(s|0)>(p|0)|(s|0)<(q|0)){n=(o|0)<(p|0)?o:p;n=(((n|0)>(q|0)?n:q)|0)/1e3|0;break}q=Ya+(C*10156|0)+24|0;o=c[q>>2]|0;if((o|0)>255)c[Ya+(C*10156|0)+28>>2]=0;if((t|0)==0?(c[B>>2]|0)==0:0)break;if((s|0)>(u|0)){p=Ya+(C*10156|0)+28|0;if(!(c[p>>2]|0)){c[q>>2]=256;o=Ya+(C*10156|0)+16|0;c[o>>2]=0;c[o+4>>2]=0;o=256}if(c[B>>2]|0){c[p>>2]=0;n=(n|0)==16?12:8;break}if((o|0)<1){c[F>>2]=1;Ta=c[Va>>2]|0;c[Va>>2]=Ta-((Ta*5|0)/((c[cb>>2]|0)+5|0)|0);break}else{c[p>>2]=-2;break}}if((s|0)>=(u|0)){o=Ya+(C*10156|0)+28|0;if((c[o>>2]|0)>=0)break;c[o>>2]=1;break}if(c[B>>2]|0){c[q>>2]=0;Ta=Ya+(C*10156|0)+16|0;c[Ta>>2]=0;c[Ta+4>>2]=0;c[Ya+(C*10156|0)+28>>2]=1;n=(n|0)==8?12:16;break}o=Ya+(C*10156|0)+28|0;if(!(c[o>>2]|0)){c[F>>2]=1;Ta=c[Va>>2]|0;c[Va>>2]=Ta-((Ta*5|0)/((c[cb>>2]|0)+5|0)|0);break}else{c[o>>2]=1;break}}else n=(((u|0)<(o|0)?u:o)|0)/1e3|0;while(0);t=(v|0)==0?n:v;u=Gd(w,t)|0;q=c[cb>>2]|0;s=Ya+(C*10156|0)+4704|0;if((c[s>>2]|0)==(q|0)){n=c[x>>2]|0;q=0}else{n=(q|0)==10;f:do if(!n){switch(q|0){case 60:case 40:case 20:{p=0;break}default:if((q|0)<11){p=-103;$a=70;break f}else p=-103}c[Ya+(C*10156|0)+5836>>2]=(q|0)/20|0;c[Ya+(C*10156|0)+4672>>2]=4;n=t<<16>>16;c[Ya+(C*10156|0)+4676>>2]=n*20;c[Ya+(C*10156|0)+4640>>2]=n*24;n=c[x>>2]|0;o=Ya+(C*10156|0)+4780|0;if((n|0)==8){c[o>>2]=30064;n=8;o=p;break}else{c[o>>2]=30030;o=p;break}}else{p=0;$a=70}while(0);do if(($a|0)==70){$a=0;c[Ya+(C*10156|0)+5836>>2]=1;c[Ya+(C*10156|0)+4672>>2]=n?2:1;n=t<<16>>16;c[Ya+(C*10156|0)+4676>>2]=_(q<<16>>16,n)|0;c[Ya+(C*10156|0)+4640>>2]=n*14;n=c[x>>2]|0;o=Ya+(C*10156|0)+4780|0;if((n|0)==8){c[o>>2]=30087;n=8;o=p;break}else{c[o>>2]=30075;o=p;break}}while(0);c[s>>2]=q;c[Ya+(C*10156|0)+4700>>2]=0;q=o}g:do if((n|0)!=(t|0)){n=Ya+(C*10156|0)+7260|0;c[n>>2]=0;c[n+4>>2]=0;c[n+8>>2]=0;o=Ya+(C*10156|0)+16|0;c[o>>2]=0;c[o+4>>2]=0;c[Ya+(C*10156|0)+5832>>2]=0;c[Ya+(C*10156|0)+5840>>2]=0;c[Ya+(C*10156|0)+4700>>2]=0;nf(Ya+(C*10156|0)+144|0,0,4480)|0;c[Ya+(C*10156|0)+4636>>2]=100;c[Ya+(C*10156|0)+4756>>2]=1;a[n>>0]=10;c[Ya+(C*10156|0)+4568>>2]=100;c[Ya+(C*10156|0)+4584>>2]=65536;a[Ya+(C*10156|0)+4633>>0]=0;c[x>>2]=t;n=c[Ya+(C*10156|0)+4672>>2]|0;o=(n|0)==4;p=Ya+(C*10156|0)+4780|0;h:do if((t|0)==8)if(o){c[p>>2]=30064;n=4;$a=86;break}else{c[p>>2]=30087;$a=86;break}else{if(o){c[p>>2]=30030;n=4}else c[p>>2]=30075;switch(t|0){case 8:case 12:{$a=86;break h}default:{}}c[Ya+(C*10156|0)+4732>>2]=16;c[Ya+(C*10156|0)+4784>>2]=22936}while(0);if(($a|0)==86){c[Ya+(C*10156|0)+4732>>2]=10;c[Ya+(C*10156|0)+4784>>2]=22896}c[Ya+(C*10156|0)+4680>>2]=t*5;c[Ya+(C*10156|0)+4676>>2]=_(t*327680>>16,n<<16>>16)|0;Ta=t<<16;$a=Ta>>16;c[Ya+(C*10156|0)+4684>>2]=$a*20;c[Ya+(C*10156|0)+4688>>2]=Ta>>15;c[Ya+(C*10156|0)+4644>>2]=$a*18;c[Ya+(C*10156|0)+4640>>2]=_($a,(n|0)==4?24:14)|0;switch(t|0){case 16:{c[Ya+(C*10156|0)+4776>>2]=29962;t=16;break g}case 12:{c[Ya+(C*10156|0)+4776>>2]=29956;t=12;break g}default:{c[Ya+(C*10156|0)+4776>>2]=29947;break g}}}while(0);n=u+q|0;s=c[bb>>2]|0;do if((s|0)>=1){if((s|0)<2){c[Ya+(C*10156|0)+4736>>2]=1;c[Ya+(C*10156|0)+4744>>2]=49807;o=Ya+(C*10156|0)+4740|0;c[o>>2]=8;c[Ya+(C*10156|0)+4728>>2]=14;q=t*5|0;c[Ya+(C*10156|0)+4692>>2]=q;c[Ya+(C*10156|0)+4720>>2]=1;c[Ya+(C*10156|0)+4724>>2]=0;c[Ya+(C*10156|0)+4752>>2]=3;c[Ya+(C*10156|0)+4764>>2]=0;p=8;break}if((s|0)<3){c[Ya+(C*10156|0)+4736>>2]=0;c[Ya+(C*10156|0)+4744>>2]=52429;o=Ya+(C*10156|0)+4740|0;c[o>>2]=6;c[Ya+(C*10156|0)+4728>>2]=12;q=t*3|0;c[Ya+(C*10156|0)+4692>>2]=q;c[Ya+(C*10156|0)+4720>>2]=2;c[Ya+(C*10156|0)+4724>>2]=0;c[Ya+(C*10156|0)+4752>>2]=2;c[Ya+(C*10156|0)+4764>>2]=0;p=6;break}if((s|0)<4){c[Ya+(C*10156|0)+4736>>2]=1;c[Ya+(C*10156|0)+4744>>2]=49807;o=Ya+(C*10156|0)+4740|0;c[o>>2]=8;c[Ya+(C*10156|0)+4728>>2]=14;q=t*5|0;c[Ya+(C*10156|0)+4692>>2]=q;c[Ya+(C*10156|0)+4720>>2]=2;c[Ya+(C*10156|0)+4724>>2]=0;c[Ya+(C*10156|0)+4752>>2]=4;c[Ya+(C*10156|0)+4764>>2]=0;p=8;break}if((s|0)<6){c[Ya+(C*10156|0)+4736>>2]=1;c[Ya+(C*10156|0)+4744>>2]=48497;o=Ya+(C*10156|0)+4740|0;c[o>>2]=10;c[Ya+(C*10156|0)+4728>>2]=16;q=t*5|0;c[Ya+(C*10156|0)+4692>>2]=q;c[Ya+(C*10156|0)+4720>>2]=2;c[Ya+(C*10156|0)+4724>>2]=1;c[Ya+(C*10156|0)+4752>>2]=6;c[Ya+(C*10156|0)+4764>>2]=t*983;p=10;break}o=Ya+(C*10156|0)+4736|0;if((s|0)<8){c[o>>2]=1;c[Ya+(C*10156|0)+4744>>2]=47186;o=Ya+(C*10156|0)+4740|0;c[o>>2]=12;c[Ya+(C*10156|0)+4728>>2]=20;q=t*5|0;c[Ya+(C*10156|0)+4692>>2]=q;c[Ya+(C*10156|0)+4720>>2]=3;c[Ya+(C*10156|0)+4724>>2]=1;c[Ya+(C*10156|0)+4752>>2]=8;c[Ya+(C*10156|0)+4764>>2]=t*983;p=12;break}else{c[o>>2]=2;c[Ya+(C*10156|0)+4744>>2]=45875;o=Ya+(C*10156|0)+4740|0;c[o>>2]=16;c[Ya+(C*10156|0)+4728>>2]=24;q=t*5|0;c[Ya+(C*10156|0)+4692>>2]=q;c[Ya+(C*10156|0)+4720>>2]=4;c[Ya+(C*10156|0)+4724>>2]=1;c[Ya+(C*10156|0)+4752>>2]=16;c[Ya+(C*10156|0)+4764>>2]=t*983;p=16;break}}else{c[Ya+(C*10156|0)+4736>>2]=0;c[Ya+(C*10156|0)+4744>>2]=52429;o=Ya+(C*10156|0)+4740|0;c[o>>2]=6;c[Ya+(C*10156|0)+4728>>2]=12;q=t*3|0;c[Ya+(C*10156|0)+4692>>2]=q;c[Ya+(C*10156|0)+4720>>2]=1;c[Ya+(C*10156|0)+4724>>2]=0;c[Ya+(C*10156|0)+4752>>2]=2;c[Ya+(C*10156|0)+4764>>2]=0;p=6}while(0);Ta=c[Ya+(C*10156|0)+4732>>2]|0;c[o>>2]=(p|0)<(Ta|0)?p:Ta;c[Ya+(C*10156|0)+4696>>2]=(t*5|0)+(q<<1);c[Ya+(C*10156|0)+4716>>2]=s;o=c[G>>2]|0;c[Ya+(C*10156|0)+4708>>2]=o;Ta=Ya+(C*10156|0)+6184|0;p=c[Ta>>2]|0;$a=c[A>>2]|0;c[Ta>>2]=$a;do if($a|0)if(!p){c[Ya+(C*10156|0)+6188>>2]=7;break}else{$a=7-(((o>>16)*26214|0)+(((o&65535)*26214|0)>>>16))|0;c[Ya+(C*10156|0)+6188>>2]=($a|0)>2?$a:2;break}while(0);c[y>>2]=1;$a=110}if(($a|0)==110?($a=0,n|0):0){$a=439;break}i:do if((c[Ya+(C*10156|0)+4756>>2]|0)!=0|E){o=0;while(1){if((o|0)>=(c[Wa>>2]|0))break i;c[Ya+(C*10156|0)+4816+(o<<2)>>2]=0;o=o+1|0}}while(0);c[Ya+(C*10156|0)+6172>>2]=c[z>>2];C=C+1|0;o=0}if(($a|0)==439){i=hb;return n|0}G=D*10|0;K=c[Xa>>2]|0;H=_(G,K)|0;I=f+4648|0;K=(_(H,c[I>>2]|0)|0)/(K*1e3|0)|0;Sa=Fa()|0;J=i;i=i+((1*(K<<1)|0)+15&-16)|0;K=f+4676|0;L=f+5832|0;Qa=f+20384|0;M=f+16024|0;N=f+5868|0;O=f+5188|0;P=f+14832|0;Q=f+15988|0;R=f+14824|0;S=f+15344|0;T=k+28|0;U=k+32|0;V=k+36|0;W=k+20|0;X=k+40|0;Y=k+24|0;Z=k+8|0;$=k+4|0;ba=k+44|0;ca=f+20346|0;da=f+14972|0;ea=f+20364|0;fa=f+20368|0;ga=f+4633|0;ha=f+4636|0;ia=f+4788|0;ja=f+8|0;ka=f+4624|0;la=g+28|0;ma=f+20372|0;na=f+20312|0;oa=f+5192|0;pa=f+15348|0;Ra=g+60|0;qa=f+20396|0;ra=f+17416|0;sa=f+10300|0;ta=f+10172|0;ua=f+14792|0;va=f+14724|0;wa=f+14789|0;xa=f+14740|0;ya=f+14912|0;za=f+10156|0;Aa=f+15346|0;Ba=f+14780|0;Ca=f+15013|0;Da=f+16332|0;Ea=f+16328|0;Ga=f+14968|0;Ha=f+5190|0;Ta=f+4857|0;Ia=f+6176|0;Ja=f+6172|0;Ka=fb+4|0;La=Za<<1;Ma=Za+-1|0;Oa=f+20388|0;Pa=f+20316|0;t=h;F=0;while(1){q=c[L>>2]|0;s=(c[K>>2]|0)-q|0;s=(s|0)<(H|0)?s:H;E=_(s,c[I>>2]|0)|0;E=(E|0)/((c[Xa>>2]|0)*1e3|0)|0;do if((c[g>>2]|0)==2)if((c[gb>>2]|0)==2){n=c[eb>>2]|0;p=0;while(1){if((p|0)>=(E|0))break;b[J+(p<<1)>>1]=b[t+(p<<1<<1)>>1]|0;p=p+1|0}if((c[Qa>>2]|0)==1&(n|0)==0)rf(M|0,N|0,300)|0;Id(N,O+(q+2<<1)|0,J,E);c[L>>2]=(c[L>>2]|0)+s;p=c[Q>>2]|0;q=(c[P>>2]|0)-p|0;n=_(G,c[R>>2]|0)|0;n=(q|0)<(n|0)?q:n;q=0;while(1){if((q|0)>=(E|0))break;b[J+(q<<1)>>1]=b[t+((q<<1|1)<<1)>>1]|0;q=q+1|0}Id(M,S+(p+2<<1)|0,J,E);c[Q>>2]=(c[Q>>2]|0)+n;n=c[L>>2]|0;break}else{if((c[gb>>2]|0)==1)n=0;else{$a=136;break}while(1){if((n|0)>=(E|0))break;h=n<<1;h=(b[t+(h<<1)>>1]|0)+(b[t+((h|1)<<1)>>1]|0)|0;b[J+(n<<1)>>1]=(h>>>1)+(h&1);n=n+1|0}Id(N,O+(q+2<<1)|0,J,E);j:do if((c[Qa>>2]|0)==2){if(c[eb>>2]|0)break;Id(M,S+((c[Q>>2]|0)+2<<1)|0,J,E);n=0;while(1){if((n|0)>=(c[K>>2]|0))break j;h=O+((c[L>>2]|0)+n+2<<1)|0;b[h>>1]=((b[h>>1]|0)+(b[S+((c[Q>>2]|0)+n+2<<1)>>1]|0)|0)>>>1;n=n+1|0}}while(0);n=(c[L>>2]|0)+s|0;c[L>>2]=n;break}else $a=136;while(0);if(($a|0)==136){$a=0;rf(J|0,t|0,E<<1|0)|0;Id(N,O+(q+2<<1)|0,J,E);n=(c[L>>2]|0)+s|0;c[L>>2]=n}C=t+((_(E,c[g>>2]|0)|0)<<1)|0;D=j-E|0;c[Ua>>2]=0;if((n|0)<(c[K>>2]|0)){n=0;break}if(!((c[eb>>2]|0)!=0|_a^1)){n=256>>>(_((c[Wa>>2]|0)+1|0,c[gb>>2]|0)|0);h=c[T>>2]|0;n=h-(_(h>>>8,0-n&255)|0)|0;c[T>>2]=n;while(1){if(n>>>0>=8388609){u=0;break}p=c[U>>2]|0;s=p>>>23;if((s|0)==255)c[V>>2]=(c[V>>2]|0)+1;else{q=p>>>31;n=c[X>>2]|0;if((n|0)>-1){p=c[Y>>2]|0;if((p+(c[Z>>2]|0)|0)>>>0<(c[$>>2]|0)>>>0){c[Y>>2]=p+1;a[(c[k>>2]|0)+p>>0]=n+q;n=0}else n=-1;c[ba>>2]=c[ba>>2]|n}n=c[V>>2]|0;if(n|0){q=q+255&255;do{p=c[Y>>2]|0;if((p+(c[Z>>2]|0)|0)>>>0<(c[$>>2]|0)>>>0){c[Y>>2]=p+1;a[(c[k>>2]|0)+p>>0]=q;p=0;n=c[V>>2]|0}else p=-1;c[ba>>2]=c[ba>>2]|p;n=n+-1|0;c[V>>2]=n}while((n|0)!=0)}c[X>>2]=s&255;p=c[U>>2]|0;n=c[T>>2]|0}c[U>>2]=p<<8&2147483392;n=n<<8;c[T>>2]=n;c[W>>2]=(c[W>>2]|0)+8}while(1){n=c[gb>>2]|0;if((u|0)>=(n|0)){B=0;break}p=c[Ya+(u*10156|0)+5836>>2]|0;t=0;n=0;while(1){if((n|0)>=(p|0))break;t=t|c[Ya+(u*10156|0)+4816+(n<<2)>>2]<>0]=(t|0)>0&1;k:do if((t|0)!=0&(p|0)>1){s=t+-1|0;n=c[17520+(p+-2<<2)>>2]|0;p=c[T>>2]|0;q=p>>>8;if((t|0)>1){h=n+(t+-2)|0;B=p-(_(q,d[h>>0]|0)|0)|0;c[U>>2]=(c[U>>2]|0)+B;n=_(q,(d[h>>0]|0)-(d[n+s>>0]|0)|0)|0}else n=p-(_(q,d[n+s>>0]|0)|0)|0;c[T>>2]=n;while(1){if(n>>>0>=8388609)break k;p=c[U>>2]|0;s=p>>>23;if((s|0)==255)c[V>>2]=(c[V>>2]|0)+1;else{q=p>>>31;n=c[X>>2]|0;if((n|0)>-1){p=c[Y>>2]|0;if((p+(c[Z>>2]|0)|0)>>>0<(c[$>>2]|0)>>>0){c[Y>>2]=p+1;a[(c[k>>2]|0)+p>>0]=n+q;n=0}else n=-1;c[ba>>2]=c[ba>>2]|n}n=c[V>>2]|0;if(n|0){q=q+255&255;do{p=c[Y>>2]|0;if((p+(c[Z>>2]|0)|0)>>>0<(c[$>>2]|0)>>>0){c[Y>>2]=p+1;a[(c[k>>2]|0)+p>>0]=q;p=0;n=c[V>>2]|0}else p=-1;c[ba>>2]=c[ba>>2]|p;n=n+-1|0;c[V>>2]=n}while((n|0)!=0)}c[X>>2]=s&255;p=c[U>>2]|0;n=c[T>>2]|0}c[U>>2]=p<<8&2147483392;n=n<<8;c[T>>2]=n;c[W>>2]=(c[W>>2]|0)+8}}while(0);u=u+1|0}while(1){if((B|0)>=(c[Wa>>2]|0)){p=0;break}v=ca+(B*6|0)+2|0;w=ca+(B*6|0)+5|0;x=da+(B<<2)|0;y=ea+B|0;z=(B|0)>0;A=B+-1|0;u=0;while(1){if((u|0)>=(n|0))break;if(c[Ya+(u*10156|0)+4816+(B<<2)>>2]|0){l:do if((n|0)==2&(u|0)==0){n=((a[v>>0]|0)*5|0)+(a[w>>0]|0)|0;p=c[T>>2]|0;q=p>>>8;if((n|0)>0){h=d[29891+(n+-1)>>0]|0;t=p-(_(q,h)|0)|0;c[U>>2]=(c[U>>2]|0)+t;n=_(q,h-(d[29891+n>>0]|0)|0)|0}else n=p-(_(q,d[29891+n>>0]|0)|0)|0;c[T>>2]=n;while(1){if(n>>>0>=8388609){t=0;break}p=c[U>>2]|0;s=p>>>23;if((s|0)==255)c[V>>2]=(c[V>>2]|0)+1;else{q=p>>>31;n=c[X>>2]|0;if((n|0)>-1){p=c[Y>>2]|0;if((p+(c[Z>>2]|0)|0)>>>0<(c[$>>2]|0)>>>0){c[Y>>2]=p+1;a[(c[k>>2]|0)+p>>0]=n+q;n=0}else n=-1;c[ba>>2]=c[ba>>2]|n}n=c[V>>2]|0;if(n|0){q=q+255&255;do{p=c[Y>>2]|0;if((p+(c[Z>>2]|0)|0)>>>0<(c[$>>2]|0)>>>0){c[Y>>2]=p+1;a[(c[k>>2]|0)+p>>0]=q;p=0;n=c[V>>2]|0}else p=-1;c[ba>>2]=c[ba>>2]|p;n=n+-1|0;c[V>>2]=n}while((n|0)!=0)}c[X>>2]=s&255;p=c[U>>2]|0;n=c[T>>2]|0}c[U>>2]=p<<8&2147483392;n=n<<8;c[T>>2]=n;c[W>>2]=(c[W>>2]|0)+8}while(1){if((t|0)==2)break;h=a[ca+(B*6|0)+(t*3|0)>>0]|0;p=h<<24>>24;q=n>>>8;if(h<<24>>24>0){h=d[29944+(p+-1)>>0]|0;n=n-(_(q,h)|0)|0;c[U>>2]=(c[U>>2]|0)+n;n=_(q,h-(d[29944+p>>0]|0)|0)|0}else n=n-(_(q,d[29944+p>>0]|0)|0)|0;c[T>>2]=n;while(1){if(n>>>0>=8388609)break;p=c[U>>2]|0;s=p>>>23;if((s|0)==255)c[V>>2]=(c[V>>2]|0)+1;else{q=p>>>31;n=c[X>>2]|0;if((n|0)>-1){p=c[Y>>2]|0;if((p+(c[Z>>2]|0)|0)>>>0<(c[$>>2]|0)>>>0){c[Y>>2]=p+1;a[(c[k>>2]|0)+p>>0]=n+q;n=0}else n=-1;c[ba>>2]=c[ba>>2]|n}n=c[V>>2]|0;if(n|0){q=q+255&255;do{p=c[Y>>2]|0;if((p+(c[Z>>2]|0)|0)>>>0<(c[$>>2]|0)>>>0){c[Y>>2]=p+1;a[(c[k>>2]|0)+p>>0]=q;p=0;n=c[V>>2]|0}else p=-1;c[ba>>2]=c[ba>>2]|p;n=n+-1|0;c[V>>2]=n}while((n|0)!=0)}c[X>>2]=s&255;p=c[U>>2]|0;n=c[T>>2]|0}c[U>>2]=p<<8&2147483392;n=n<<8;c[T>>2]=n;c[W>>2]=(c[W>>2]|0)+8}h=a[ca+(B*6|0)+(t*3|0)+1>>0]|0;p=h<<24>>24;q=n>>>8;if(h<<24>>24>0){h=d[29951+(p+-1)>>0]|0;n=n-(_(q,h)|0)|0;c[U>>2]=(c[U>>2]|0)+n;n=_(q,h-(d[29951+p>>0]|0)|0)|0}else n=n-(_(q,d[29951+p>>0]|0)|0)|0;c[T>>2]=n;while(1){if(n>>>0>=8388609)break;p=c[U>>2]|0;s=p>>>23;if((s|0)==255)c[V>>2]=(c[V>>2]|0)+1;else{q=p>>>31;n=c[X>>2]|0;if((n|0)>-1){p=c[Y>>2]|0;if((p+(c[Z>>2]|0)|0)>>>0<(c[$>>2]|0)>>>0){c[Y>>2]=p+1;a[(c[k>>2]|0)+p>>0]=n+q;n=0}else n=-1;c[ba>>2]=c[ba>>2]|n}n=c[V>>2]|0;if(n|0){q=q+255&255;do{p=c[Y>>2]|0;if((p+(c[Z>>2]|0)|0)>>>0<(c[$>>2]|0)>>>0){c[Y>>2]=p+1;a[(c[k>>2]|0)+p>>0]=q;p=0;n=c[V>>2]|0}else p=-1;c[ba>>2]=c[ba>>2]|p;n=n+-1|0;c[V>>2]=n}while((n|0)!=0)}c[X>>2]=s&255;p=c[U>>2]|0;n=c[T>>2]|0}c[U>>2]=p<<8&2147483392;n=n<<8;c[T>>2]=n;c[W>>2]=(c[W>>2]|0)+8}t=t+1|0}if(c[x>>2]|0)break;h=a[y>>0]|0;p=h<<24>>24;q=n>>>8;if(h<<24>>24>0){h=d[29916+(p+-1)>>0]|0;n=n-(_(q,h)|0)|0;c[U>>2]=(c[U>>2]|0)+n;n=_(q,h-(d[29916+p>>0]|0)|0)|0}else n=n-(_(q,d[29916+p>>0]|0)|0)|0;c[T>>2]=n;while(1){if(n>>>0>=8388609)break l;p=c[U>>2]|0;s=p>>>23;if((s|0)==255)c[V>>2]=(c[V>>2]|0)+1;else{q=p>>>31;p=c[X>>2]|0;if((p|0)>-1){n=c[Y>>2]|0;if((n+(c[Z>>2]|0)|0)>>>0<(c[$>>2]|0)>>>0){c[Y>>2]=n+1;a[(c[k>>2]|0)+n>>0]=p+q;n=0}else n=-1;c[ba>>2]=c[ba>>2]|n}n=c[V>>2]|0;if(n|0){q=q+255&255;do{p=c[Y>>2]|0;if((p+(c[Z>>2]|0)|0)>>>0<(c[$>>2]|0)>>>0){c[Y>>2]=p+1;a[(c[k>>2]|0)+p>>0]=q;p=0;n=c[V>>2]|0}else p=-1;c[ba>>2]=c[ba>>2]|p;n=n+-1|0;c[V>>2]=n}while((n|0)!=0)}c[X>>2]=s&255;p=c[U>>2]|0;n=c[T>>2]|0}c[U>>2]=p<<8&2147483392;n=n<<8;c[T>>2]=n;c[W>>2]=(c[W>>2]|0)+8}}while(0);if(z?(c[Ya+(u*10156|0)+4816+(A<<2)>>2]|0)!=0:0)n=2;else n=0;Ad(Ya+(u*10156|0)|0,k,B,1,n);Bd(k,a[Ya+(u*10156|0)+6192+(B*36|0)+29>>0]|0,a[Ya+(u*10156|0)+6192+(B*36|0)+30>>0]|0,Ya+(u*10156|0)+6300+(B*320|0)|0,c[Ya+(u*10156|0)+4676>>2]|0);n=c[gb>>2]|0}u=u+1|0}B=B+1|0}while(1){if((p|0)>=(n|0))break;n=Ya+(p*10156|0)+4816|0;c[n>>2]=0;c[n+4>>2]=0;c[n+8>>2]=0;n=c[gb>>2]|0;p=p+1|0}c[fa>>2]=(c[W>>2]|0)+((aa(c[T>>2]|0)|0)+-32)}if((a[ga>>0]|0)==2){n=_(c[Xa>>2]|0,65536e3)|0;n=(n|0)/(c[ha>>2]|0)|0;s=aa(n|0)|0;p=24-s|0;q=0-p|0;do if(p)if((p|0)<0){n=n<>>(p+32|0);break}else{n=n<<32-p|n>>>p;break}while(0);z=n&127;z=z+(((_(z,128-z|0)|0)*179|0)>>>16)+(31-s<<7)|0;B=c[ia>>2]|0;h=0-B<<2;B=B<<16>>16;A=_(h>>16,B)|0;B=_(h&65532,B)|0;h=(z<<16)+-183762944>>16;h=z+-2048+((_(A+(B>>16)>>16,h)|0)+((_(A+(B>>>16)&65535,h)|0)>>16))|0;B=c[ja>>2]|0;h=h-(B>>8)|0;h=(h|0)<0?h*3|0:h;h=_(c[ka>>2]<<16>>16,(h|0)>51?51:((h|0)<-51?-51:h)<<16>>16)|0;h=B+(((h>>16)*6554|0)+(((h&65535)*6554|0)>>>16))|0;c[ja>>2]=(h|0)>217856?217856:(h|0)<193536?193536:h}s=c[la>>2]|0;p=c[cb>>2]|0;n=(_(s,p)|0)/1e3|0;if(_a)n=n-(c[fa>>2]|0)|0;q=(n|0)/(c[Wa>>2]|0)|0;n=_(q<<16>>16,(p|0)==10?100:50)|0;n=n-(c[ma>>2]<<1)|0;do if(_a){p=c[eb>>2]|0;if((p|0)<=0)break;h=(c[W>>2]|0)+((aa(c[T>>2]|0)|0)+-32)|0;n=n-(h-(c[fa>>2]|0)-(_(q,p)|0)<<1)|0}while(0);do if((s|0)>5e3){if((n|0)>(s|0))break;s=(n|0)<5e3?5e3:n}else{if((n|0)>5e3){s=5e3;break}s=(n|0)<(s|0)?s:n}while(0);m:do if((c[gb>>2]|0)==2){n=c[eb>>2]|0;Dd(na,oa,pa,ca+(n*6|0)|0,ea+n|0,fb,s,c[ka>>2]|0,c[Ra>>2]|0,c[Xa>>2]|0,c[K>>2]|0);n=c[eb>>2]|0;do if(!(a[ea+n>>0]|0)){if((c[qa>>2]|0)==1){c[ra>>2]=0;c[ra+4>>2]=0;c[ra+8>>2]=0;h=ta;c[h>>2]=0;c[h+4>>2]=0;nf(sa|0,0,4480)|0;c[ua>>2]=100;c[va>>2]=100;a[ra>>0]=10;a[wa>>0]=0;c[xa>>2]=65536;c[ya>>2]=1}oe(za,Aa);if((c[Ba>>2]|0)>=13){c[Da>>2]=0;c[Ea>>2]=0;a[Ca>>0]=1;a[(c[db>>2]|0)+(za+4812)>>0]=1;break}a[Ca>>0]=0;n=c[Da>>2]|0;h=n+1|0;c[Da>>2]=h;do if((h|0)<10)c[Ea>>2]=0;else{if((n|0)<=29)break;c[Da>>2]=10;c[Ea>>2]=0}while(0);a[(c[db>>2]|0)+(za+4812)>>0]=0}else a[Ga+n>>0]=0;while(0);if(!_a)break;v=c[eb>>2]|0;n=((a[ca+(v*6|0)+2>>0]|0)*5|0)+(a[ca+(v*6|0)+5>>0]|0)|0;p=c[T>>2]|0;q=p>>>8;if((n|0)>0){h=d[29891+(n+-1)>>0]|0;B=p-(_(q,h)|0)|0;c[U>>2]=(c[U>>2]|0)+B;n=_(q,h-(d[29891+n>>0]|0)|0)|0}else n=p-(_(q,d[29891+n>>0]|0)|0)|0;c[T>>2]=n;while(1){if(n>>>0>=8388609){q=n;u=0;break}p=c[U>>2]|0;t=p>>>23;if((t|0)==255)c[V>>2]=(c[V>>2]|0)+1;else{q=p>>>31;n=c[X>>2]|0;if((n|0)>-1){p=c[Y>>2]|0;if((p+(c[Z>>2]|0)|0)>>>0<(c[$>>2]|0)>>>0){c[Y>>2]=p+1;a[(c[k>>2]|0)+p>>0]=n+q;n=0}else n=-1;c[ba>>2]=c[ba>>2]|n}n=c[V>>2]|0;if(n|0){q=q+255&255;do{p=c[Y>>2]|0;if((p+(c[Z>>2]|0)|0)>>>0<(c[$>>2]|0)>>>0){c[Y>>2]=p+1;a[(c[k>>2]|0)+p>>0]=q;p=0;n=c[V>>2]|0}else p=-1;c[ba>>2]=c[ba>>2]|p;n=n+-1|0;c[V>>2]=n}while((n|0)!=0)}c[X>>2]=t&255;p=c[U>>2]|0;n=c[T>>2]|0}c[U>>2]=p<<8&2147483392;n=n<<8;c[T>>2]=n;c[W>>2]=(c[W>>2]|0)+8}while(1){if((u|0)==2)break;h=a[ca+(v*6|0)+(u*3|0)>>0]|0;n=h<<24>>24;p=q>>>8;if(h<<24>>24>0){h=d[29944+(n+-1)>>0]|0;B=q-(_(p,h)|0)|0;c[U>>2]=(c[U>>2]|0)+B;n=_(p,h-(d[29944+n>>0]|0)|0)|0}else n=q-(_(p,d[29944+n>>0]|0)|0)|0;c[T>>2]=n;while(1){if(n>>>0>=8388609)break;p=c[U>>2]|0;t=p>>>23;if((t|0)==255)c[V>>2]=(c[V>>2]|0)+1;else{q=p>>>31;n=c[X>>2]|0;if((n|0)>-1){p=c[Y>>2]|0;if((p+(c[Z>>2]|0)|0)>>>0<(c[$>>2]|0)>>>0){c[Y>>2]=p+1;a[(c[k>>2]|0)+p>>0]=n+q;n=0}else n=-1;c[ba>>2]=c[ba>>2]|n}n=c[V>>2]|0;if(n|0){q=q+255&255;do{p=c[Y>>2]|0;if((p+(c[Z>>2]|0)|0)>>>0<(c[$>>2]|0)>>>0){c[Y>>2]=p+1;a[(c[k>>2]|0)+p>>0]=q;p=0;n=c[V>>2]|0}else p=-1;c[ba>>2]=c[ba>>2]|p;n=n+-1|0;c[V>>2]=n}while((n|0)!=0)}c[X>>2]=t&255;p=c[U>>2]|0;n=c[T>>2]|0}c[U>>2]=p<<8&2147483392;n=n<<8;c[T>>2]=n;c[W>>2]=(c[W>>2]|0)+8}h=a[ca+(v*6|0)+(u*3|0)+1>>0]|0;p=h<<24>>24;q=n>>>8;if(h<<24>>24>0){h=d[29951+(p+-1)>>0]|0;n=n-(_(q,h)|0)|0;c[U>>2]=(c[U>>2]|0)+n;n=_(q,h-(d[29951+p>>0]|0)|0)|0}else n=n-(_(q,d[29951+p>>0]|0)|0)|0;c[T>>2]=n;while(1){if(n>>>0>=8388609)break;p=c[U>>2]|0;t=p>>>23;if((t|0)==255)c[V>>2]=(c[V>>2]|0)+1;else{q=p>>>31;n=c[X>>2]|0;if((n|0)>-1){p=c[Y>>2]|0;if((p+(c[Z>>2]|0)|0)>>>0<(c[$>>2]|0)>>>0){c[Y>>2]=p+1;a[(c[k>>2]|0)+p>>0]=n+q;n=0}else n=-1;c[ba>>2]=c[ba>>2]|n}n=c[V>>2]|0;if(n|0){q=q+255&255;do{p=c[Y>>2]|0;if((p+(c[Z>>2]|0)|0)>>>0<(c[$>>2]|0)>>>0){c[Y>>2]=p+1;a[(c[k>>2]|0)+p>>0]=q;p=0;n=c[V>>2]|0}else p=-1;c[ba>>2]=c[ba>>2]|p;n=n+-1|0;c[V>>2]=n}while((n|0)!=0)}c[X>>2]=t&255;p=c[U>>2]|0;n=c[T>>2]|0}c[U>>2]=p<<8&2147483392;n=n<<8;c[T>>2]=n;c[W>>2]=(c[W>>2]|0)+8}q=n;u=u+1|0}n=c[eb>>2]|0;if(a[Ga+n>>0]|0)break;h=a[ea+n>>0]|0;n=h<<24>>24;p=q>>>8;if(h<<24>>24>0){h=d[29916+(n+-1)>>0]|0;B=q-(_(p,h)|0)|0;c[U>>2]=(c[U>>2]|0)+B;n=_(p,h-(d[29916+n>>0]|0)|0)|0}else n=q-(_(p,d[29916+n>>0]|0)|0)|0;c[T>>2]=n;while(1){if(n>>>0>=8388609)break m;p=c[U>>2]|0;t=p>>>23;if((t|0)==255)c[V>>2]=(c[V>>2]|0)+1;else{q=p>>>31;n=c[X>>2]|0;if((n|0)>-1){p=c[Y>>2]|0;if((p+(c[Z>>2]|0)|0)>>>0<(c[$>>2]|0)>>>0){c[Y>>2]=p+1;a[(c[k>>2]|0)+p>>0]=n+q;n=0}else n=-1;c[ba>>2]=c[ba>>2]|n}n=c[V>>2]|0;if(n|0){q=q+255&255;do{p=c[Y>>2]|0;if((p+(c[Z>>2]|0)|0)>>>0<(c[$>>2]|0)>>>0){c[Y>>2]=p+1;a[(c[k>>2]|0)+p>>0]=q;p=0;n=c[V>>2]|0}else p=-1;c[ba>>2]=c[ba>>2]|p;n=n+-1|0;c[V>>2]=n}while((n|0)!=0)}c[X>>2]=t&255;p=c[U>>2]|0;n=c[T>>2]|0}c[U>>2]=p<<8&2147483392;n=n<<8;c[T>>2]=n;c[W>>2]=(c[W>>2]|0)+8}}else{c[O>>2]=c[Pa>>2];h=O+(c[K>>2]<<1)|0;h=e[h>>1]|e[h+2>>1]<<16;b[Pa>>1]=h;b[Pa+2>>1]=h>>>16}while(0);oe(f,Ha);if((c[ka>>2]|0)<13){a[Ta>>0]=0;n=c[Ia>>2]|0;h=n+1|0;c[Ia>>2]=h;do if((h|0)<10)c[Ja>>2]=0;else{if((n|0)<=29)break;c[Ia>>2]=10;c[Ja>>2]=0}while(0);a[(c[eb>>2]|0)+(f+4812)>>0]=0}else{c[Ia>>2]=0;c[Ja>>2]=0;a[Ta>>0]=1;a[(c[eb>>2]|0)+(f+4812)>>0]=1}v=(F|0)==0;w=c[Ka>>2]|0;x=(F|0)==(Ma|0);y=(F|0)==1;z=0;while(1){n=c[gb>>2]|0;if((z|0)>=(n|0))break;p=c[Va>>2]|0;n:do switch(Za|0){case 2:{if(!v){q=p;break n}q=(p*3|0)/5|0;break}case 3:{if(v){q=(p<<1|0)/5|0;break n}if(!y){q=p;break n}q=(p*3|0)/4|0;break}default:q=p}while(0);t=x&(c[ab>>2]|0)!=0&1;do if((n|0)==1){n=s;u=t}else{n=c[fb+(z<<2)>>2]|0;if((z|0)!=0|(w|0)<1){u=t;break}q=q-((p|0)/(La|0)|0)|0;u=0}while(0);if((n|0)>0){o=(n|0)>8e4?8e4:(n|0)<5e3?5e3:n;n=Ya+(z*10156|0)+4700|0;o:do if((o|0)!=(c[n>>2]|0)){c[n>>2]=o;t=c[Ya+(z*10156|0)+4668>>2]|0;t=(t|0)==8?17424:(t|0)==12?17456:17488;n=(c[Ya+(z*10156|0)+4672>>2]|0)==2?o+-2200|0:o;p=1;while(1){if((p|0)>=8)break o;o=c[t+(p<<2)>>2]|0;if((n|0)<=(o|0))break;p=p+1|0}h=p+-1|0;B=c[t+(h<<2)>>2]|0;h=b[25356+(h<<1)>>1]|0;c[Ya+(z*10156|0)+4808>>2]=(h<<6)+(_((n-B<<6|0)/(o-B|0)|0,(b[25356+(p<<1)>>1]|0)-h|0)|0)}while(0);do if((c[eb>>2]|0)>(z|0)){if((z|0)>0?c[qa>>2]|0:0){n=1;break}n=2}else n=0;while(0);o=Qd(Ya+(z*10156|0)|0,l,k,n,q,u)|0}c[Ya+(z*10156|0)+4760>>2]=0;c[Ya+(z*10156|0)+5832>>2]=0;h=Ya+(z*10156|0)+5840|0;c[h>>2]=(c[h>>2]|0)+1;z=z+1|0}q=c[eb>>2]|0;c[qa>>2]=a[ea+(q+-1)>>0];do if((c[l>>2]|0)>0){if((q|0)!=(c[Wa>>2]|0))break;s=c[gb>>2]|0;v=0;u=0;while(1){if((u|0)>=(s|0))break;t=c[Ya+(u*10156|0)+5836>>2]|0;n=v;p=0;while(1){n=n<<1;if((p|0)>=(t|0))break;n=n|a[Ya+(u*10156|0)+4812+p>>0];p=p+1|0}v=n|a[Ya+(u*10156|0)+4815>>0];u=u+1|0}do if(_a){n=_(q+1|0,s)|0;p=8-n|0;q=(1<>2]|0){h=c[k>>2]|0;a[h>>0]=d[h>>0]&(q^255)|v<>2]|0;if((s|0)>-1){c[X>>2]=s&~q|v<>2]|0)>>>0>-2147483648>>>n>>>0){c[ba>>2]=-1;break}else{c[U>>2]=c[U>>2]&~(q<<23)|v<>2]|0){if((c[gb>>2]|0)!=1?(c[Ea>>2]|0)==0:0)break;c[l>>2]=0}while(0);n=(c[ma>>2]|0)+(c[l>>2]<<3)|0;c[ma>>2]=n;n=n-((_(c[la>>2]|0,c[cb>>2]|0)|0)/1e3|0)|0;c[ma>>2]=(n|0)>1e4?1e4:(n|0)<0?0:n;n=c[Oa>>2]|0;if((c[ka>>2]|0)<(((n<<16>>16)*3188>>16)+13|0)){c[Ua>>2]=1;c[Oa>>2]=0;break}else{c[Ua>>2]=0;c[Oa>>2]=n+(c[cb>>2]|0);break}}while(0);if((j|0)==(E|0)){$a=428;break}t=C;j=D;F=F+1|0}if(($a|0)==428)n=c[Ua>>2]|0;c[Qa>>2]=c[gb>>2];c[g+76>>2]=n;if((c[Xa>>2]|0)==16)n=(c[f+28>>2]|0)==0;else n=0;c[g+80>>2]=n&1;c[g+72>>2]=(c[Xa>>2]<<16>>16)*1e3;if(!(c[Ra>>2]|0))n=b[f+20340>>1]|0;else n=0;c[g+84>>2]=n;p:do if(!_a){c[cb>>2]=r;c[bb>>2]=m;n=0;while(1){if((n|0)>=(c[gb>>2]|0))break p;c[Ya+(n*10156|0)+4760>>2]=0;c[Ya+(n*10156|0)+4772>>2]=0;n=n+1|0}}while(0);c[g+92>>2]=a[Ta>>0];c[g+96>>2]=b[25404+(a[Ta>>0]>>1<<2)+(a[f+4858>>0]<<1)>>1];Na(Sa|0);f=o;i=hb;return f|0}function Ad(e,f,g,h,j){e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;var k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0;F=i;i=i+48|0;x=F;v=F+32|0;C=(h|0)==0;E=C?e+4828|0:e+6192+(g*36|0)|0;D=E+29|0;l=(a[D>>0]<<1)+(a[E+30>>0]|0)|0;a:do if((l|0)>1|C^1){g=l+-2|0;u=f+28|0;h=c[u>>2]|0;k=h>>>8;if((l|0)>2){C=d[29933+(l+-3)>>0]|0;B=h-(_(k,C)|0)|0;m=f+32|0;c[m>>2]=(c[m>>2]|0)+B;g=_(k,C-(d[29933+g>>0]|0)|0)|0;c[u>>2]=g}else{g=h-(_(k,d[29933+g>>0]|0)|0)|0;c[u>>2]=g;m=f+32|0}n=f+36|0;o=f+20|0;p=f+40|0;q=f+24|0;r=f+8|0;s=f+4|0;t=f+44|0;while(1){if(g>>>0>=8388609){l=g;break a}h=c[m>>2]|0;l=h>>>23;if((l|0)==255)c[n>>2]=(c[n>>2]|0)+1;else{k=h>>>31;g=c[p>>2]|0;if((g|0)>-1){h=c[q>>2]|0;if((h+(c[r>>2]|0)|0)>>>0<(c[s>>2]|0)>>>0){c[q>>2]=h+1;a[(c[f>>2]|0)+h>>0]=g+k;g=0}else g=-1;c[t>>2]=c[t>>2]|g}g=c[n>>2]|0;if(g|0){k=k+255&255;do{h=c[q>>2]|0;if((h+(c[r>>2]|0)|0)>>>0<(c[s>>2]|0)>>>0){c[q>>2]=h+1;a[(c[f>>2]|0)+h>>0]=k;h=0;g=c[n>>2]|0}else h=-1;c[t>>2]=c[t>>2]|h;g=g+-1|0;c[n>>2]=g}while((g|0)!=0)}c[p>>2]=l&255;h=c[m>>2]|0;g=c[u>>2]|0}c[m>>2]=h<<8&2147483392;g=g<<8;c[u>>2]=g;c[o>>2]=(c[o>>2]|0)+8}}else{u=f+28|0;g=c[u>>2]|0;h=g>>>8;if((l|0)>0){C=d[29937+(l+-1)>>0]|0;g=g-(_(h,C)|0)|0;m=f+32|0;c[m>>2]=(c[m>>2]|0)+g;g=_(h,C-(d[29937+l>>0]|0)|0)|0;c[u>>2]=g}else{g=g-(_(h,d[29937+l>>0]|0)|0)|0;c[u>>2]=g;m=f+32|0}n=f+36|0;o=f+20|0;p=f+40|0;q=f+24|0;r=f+8|0;s=f+4|0;t=f+44|0;while(1){if(g>>>0>=8388609){l=g;break a}h=c[m>>2]|0;l=h>>>23;if((l|0)==255)c[n>>2]=(c[n>>2]|0)+1;else{k=h>>>31;g=c[p>>2]|0;if((g|0)>-1){h=c[q>>2]|0;if((h+(c[r>>2]|0)|0)>>>0<(c[s>>2]|0)>>>0){c[q>>2]=h+1;a[(c[f>>2]|0)+h>>0]=g+k;g=0}else g=-1;c[t>>2]=c[t>>2]|g}g=c[n>>2]|0;if(g|0){k=k+255&255;do{h=c[q>>2]|0;if((h+(c[r>>2]|0)|0)>>>0<(c[s>>2]|0)>>>0){c[q>>2]=h+1;a[(c[f>>2]|0)+h>>0]=k;h=0;g=c[n>>2]|0}else h=-1;c[t>>2]=c[t>>2]|h;g=g+-1|0;c[n>>2]=g}while((g|0)!=0)}c[p>>2]=l&255;h=c[m>>2]|0;g=c[u>>2]|0}c[m>>2]=h<<8&2147483392;g=g<<8;c[u>>2]=g;c[o>>2]=(c[o>>2]|0)+8}}while(0);w=(j|0)==2;g=a[E>>0]|0;h=g<<24>>24;b:do if(w){p=f+28|0;k=l>>>8;if(g<<24>>24>0){g=d[29396+(h+-1)>>0]|0;C=l-(_(k,g)|0)|0;m=f+32|0;c[m>>2]=(c[m>>2]|0)+C;g=_(k,g-(d[29396+h>>0]|0)|0)|0;c[p>>2]=g}else{g=l-(_(k,d[29396+h>>0]|0)|0)|0;c[p>>2]=g;m=f+32|0}n=f+36|0;o=f+20|0;q=f+40|0;r=f+24|0;s=f+8|0;t=f+4|0;u=f+44|0;while(1){if(g>>>0>=8388609){C=m;B=n;A=t;break b}h=c[m>>2]|0;l=h>>>23;if((l|0)==255)c[n>>2]=(c[n>>2]|0)+1;else{k=h>>>31;g=c[q>>2]|0;if((g|0)>-1){h=c[r>>2]|0;if((h+(c[s>>2]|0)|0)>>>0<(c[t>>2]|0)>>>0){c[r>>2]=h+1;a[(c[f>>2]|0)+h>>0]=g+k;g=0}else g=-1;c[u>>2]=c[u>>2]|g}g=c[n>>2]|0;if(g|0){k=k+255&255;do{h=c[r>>2]|0;if((h+(c[s>>2]|0)|0)>>>0<(c[t>>2]|0)>>>0){c[r>>2]=h+1;a[(c[f>>2]|0)+h>>0]=k;h=0;g=c[n>>2]|0}else h=-1;c[u>>2]=c[u>>2]|h;g=g+-1|0;c[n>>2]=g}while((g|0)!=0)}c[q>>2]=l&255;h=c[m>>2]|0;g=c[p>>2]|0}c[m>>2]=h<<8&2147483392;g=g<<8;c[p>>2]=g;c[o>>2]=(c[o>>2]|0)+8}}else{g=h>>3;h=a[D>>0]|0;p=f+28|0;k=l>>>8;if((g|0)>0){C=d[g+-1+(29372+(h<<3))>>0]|0;B=l-(_(k,C)|0)|0;m=f+32|0;c[m>>2]=(c[m>>2]|0)+B;g=_(k,C-(d[29372+(h<<3)+g>>0]|0)|0)|0;c[p>>2]=g}else{g=l-(_(k,d[29372+(h<<3)+g>>0]|0)|0)|0;c[p>>2]=g;m=f+32|0}n=f+36|0;o=f+20|0;q=f+40|0;r=f+24|0;s=f+8|0;t=f+4|0;u=f+44|0;while(1){if(g>>>0>=8388609)break;h=c[m>>2]|0;l=h>>>23;if((l|0)==255)c[n>>2]=(c[n>>2]|0)+1;else{k=h>>>31;g=c[q>>2]|0;if((g|0)>-1){h=c[r>>2]|0;if((h+(c[s>>2]|0)|0)>>>0<(c[t>>2]|0)>>>0){c[r>>2]=h+1;a[(c[f>>2]|0)+h>>0]=g+k;g=0}else g=-1;c[u>>2]=c[u>>2]|g}g=c[n>>2]|0;if(g|0){k=k+255&255;do{h=c[r>>2]|0;if((h+(c[s>>2]|0)|0)>>>0<(c[t>>2]|0)>>>0){c[r>>2]=h+1;a[(c[f>>2]|0)+h>>0]=k;h=0;g=c[n>>2]|0}else h=-1;c[u>>2]=c[u>>2]|h;g=g+-1|0;c[n>>2]=g}while((g|0)!=0)}c[q>>2]=l&255;h=c[m>>2]|0;g=c[p>>2]|0}c[m>>2]=h<<8&2147483392;g=g<<8;c[p>>2]=g;c[o>>2]=(c[o>>2]|0)+8}h=d[E>>0]&7;k=g>>>8;l=a[29962+h>>0]|0;if(!h)g=g-(_(k,l&255)|0)|0;else{C=d[29962+(h+-1)>>0]|0;g=g-(_(k,C)|0)|0;c[m>>2]=(c[m>>2]|0)+g;g=_(k,C-(l&255)|0)|0}c[p>>2]=g;while(1){if(g>>>0>=8388609){C=m;B=n;A=t;break b}h=c[m>>2]|0;l=h>>>23;if((l|0)==255)c[n>>2]=(c[n>>2]|0)+1;else{k=h>>>31;g=c[q>>2]|0;if((g|0)>-1){h=c[r>>2]|0;if((h+(c[s>>2]|0)|0)>>>0<(c[t>>2]|0)>>>0){c[r>>2]=h+1;a[(c[f>>2]|0)+h>>0]=g+k;g=0}else g=-1;c[u>>2]=c[u>>2]|g}g=c[n>>2]|0;if(g|0){k=k+255&255;do{h=c[r>>2]|0;if((h+(c[s>>2]|0)|0)>>>0<(c[t>>2]|0)>>>0){c[r>>2]=h+1;a[(c[f>>2]|0)+h>>0]=k;h=0;g=c[n>>2]|0}else h=-1;c[u>>2]=c[u>>2]|h;g=g+-1|0;c[n>>2]=g}while((g|0)!=0)}c[q>>2]=l&255;h=c[m>>2]|0;g=c[p>>2]|0}c[m>>2]=h<<8&2147483392;g=g<<8;c[p>>2]=g;c[o>>2]=(c[o>>2]|0)+8}}while(0);y=e+4672|0;m=1;while(1){if((m|0)>=(c[y>>2]|0))break;t=a[E+m>>0]|0;h=t<<24>>24;k=g>>>8;if(t<<24>>24>0){t=d[29396+(h+-1)>>0]|0;g=g-(_(k,t)|0)|0;c[C>>2]=(c[C>>2]|0)+g;g=_(k,t-(d[29396+h>>0]|0)|0)|0}else g=g-(_(k,d[29396+h>>0]|0)|0)|0;c[p>>2]=g;while(1){if(g>>>0>=8388609)break;h=c[C>>2]|0;l=h>>>23;if((l|0)==255)c[B>>2]=(c[B>>2]|0)+1;else{k=h>>>31;g=c[q>>2]|0;if((g|0)>-1){h=c[r>>2]|0;if((h+(c[s>>2]|0)|0)>>>0<(c[A>>2]|0)>>>0){c[r>>2]=h+1;a[(c[f>>2]|0)+h>>0]=g+k;g=0}else g=-1;c[u>>2]=c[u>>2]|g}g=c[B>>2]|0;if(g|0){k=k+255&255;do{h=c[r>>2]|0;if((h+(c[s>>2]|0)|0)>>>0<(c[A>>2]|0)>>>0){c[r>>2]=h+1;a[(c[f>>2]|0)+h>>0]=k;h=0;g=c[B>>2]|0}else h=-1;c[u>>2]=c[u>>2]|h;g=g+-1|0;c[B>>2]=g}while((g|0)!=0)}c[q>>2]=l&255;h=c[C>>2]|0;g=c[p>>2]|0}c[C>>2]=h<<8&2147483392;g=g<<8;c[p>>2]=g;c[o>>2]=(c[o>>2]|0)+8}m=m+1|0}m=E+8|0;n=a[m>>0]|0;h=n<<24>>24;t=e+4784|0;l=c[t>>2]|0;k=_(a[D>>0]>>1,b[l>>1]|0)|0;k=(c[l+16>>2]|0)+k|0;l=g>>>8;if(n<<24>>24>0){n=k+(h+-1)|0;g=g-(_(l,d[n>>0]|0)|0)|0;c[C>>2]=(c[C>>2]|0)+g;g=_(l,(d[n>>0]|0)-(d[k+h>>0]|0)|0)|0}else g=g-(_(l,d[k+h>>0]|0)|0)|0;c[p>>2]=g;while(1){if(g>>>0>=8388609)break;h=c[C>>2]|0;l=h>>>23;if((l|0)==255)c[B>>2]=(c[B>>2]|0)+1;else{k=h>>>31;g=c[q>>2]|0;if((g|0)>-1){h=c[r>>2]|0;if((h+(c[s>>2]|0)|0)>>>0<(c[A>>2]|0)>>>0){c[r>>2]=h+1;a[(c[f>>2]|0)+h>>0]=g+k;g=0}else g=-1;c[u>>2]=c[u>>2]|g}g=c[B>>2]|0;if(g|0){k=k+255&255;do{h=c[r>>2]|0;if((h+(c[s>>2]|0)|0)>>>0<(c[A>>2]|0)>>>0){c[r>>2]=h+1;a[(c[f>>2]|0)+h>>0]=k;h=0;g=c[B>>2]|0}else h=-1;c[u>>2]=c[u>>2]|h;g=g+-1|0;c[B>>2]=g}while((g|0)!=0)}c[q>>2]=l&255;h=c[C>>2]|0;g=c[p>>2]|0}c[C>>2]=h<<8&2147483392;g=g<<8;c[p>>2]=g;c[o>>2]=(c[o>>2]|0)+8}Cd(x,v,c[t>>2]|0,a[m>>0]|0);k=0;c:while(1){g=c[t>>2]|0;if((k|0)>=(b[g+2>>1]|0))break;n=k+1|0;m=E+8+n|0;h=a[m>>0]|0;if(h<<24>>24>3){g=(c[g+28>>2]|0)+(b[x+(k<<1)>>1]|0)|0;h=c[p>>2]|0;l=h>>>8;v=g+7|0;h=h-(_(l,d[v>>0]|0)|0)|0;h=(c[C>>2]|0)+h|0;c[C>>2]=h;g=_(l,(d[v>>0]|0)-(d[g+8>>0]|0)|0)|0;c[p>>2]=g;while(1){if(g>>>0>=8388609)break;l=h>>>23;if((l|0)==255)c[B>>2]=(c[B>>2]|0)+1;else{k=h>>>31;g=c[q>>2]|0;if((g|0)>-1){h=c[r>>2]|0;if((h+(c[s>>2]|0)|0)>>>0<(c[A>>2]|0)>>>0){c[r>>2]=h+1;a[(c[f>>2]|0)+h>>0]=g+k;g=0}else g=-1;c[u>>2]=c[u>>2]|g}g=c[B>>2]|0;if(g|0){k=k+255&255;do{h=c[r>>2]|0;if((h+(c[s>>2]|0)|0)>>>0<(c[A>>2]|0)>>>0){c[r>>2]=h+1;a[(c[f>>2]|0)+h>>0]=k;h=0;g=c[B>>2]|0}else h=-1;c[u>>2]=c[u>>2]|h;g=g+-1|0;c[B>>2]=g}while((g|0)!=0)}c[q>>2]=l&255;h=c[C>>2]|0;g=c[p>>2]|0}h=h<<8&2147483392;c[C>>2]=h;g=g<<8;c[p>>2]=g;c[o>>2]=(c[o>>2]|0)+8}v=a[m>>0]|0;k=v<<24>>24;l=k+-4|0;m=g>>>8;if(v<<24>>24>4){v=d[29970+(k+-5)>>0]|0;h=h+(g-(_(m,v)|0))|0;c[C>>2]=h;g=_(m,v-(d[29970+l>>0]|0)|0)|0}else g=g-(_(m,d[29970+l>>0]|0)|0)|0;c[p>>2]=g;while(1){if(g>>>0>=8388609){k=n;continue c}l=h>>>23;if((l|0)==255)c[B>>2]=(c[B>>2]|0)+1;else{k=h>>>31;g=c[q>>2]|0;if((g|0)>-1){h=c[r>>2]|0;if((h+(c[s>>2]|0)|0)>>>0<(c[A>>2]|0)>>>0){c[r>>2]=h+1;a[(c[f>>2]|0)+h>>0]=g+k;g=0}else g=-1;c[u>>2]=c[u>>2]|g}g=c[B>>2]|0;if(g|0){k=k+255&255;do{h=c[r>>2]|0;if((h+(c[s>>2]|0)|0)>>>0<(c[A>>2]|0)>>>0){c[r>>2]=h+1;a[(c[f>>2]|0)+h>>0]=k;h=0;g=c[B>>2]|0}else h=-1;c[u>>2]=c[u>>2]|h;g=g+-1|0;c[B>>2]=g}while((g|0)!=0)}c[q>>2]=l&255;h=c[C>>2]|0;g=c[p>>2]|0}h=h<<8&2147483392;c[C>>2]=h;g=g<<8;c[p>>2]=g;c[o>>2]=(c[o>>2]|0)+8}}if(h<<24>>24>=-3){v=h<<24>>24;g=(c[g+28>>2]|0)+(b[x+(k<<1)>>1]|0)|0;k=c[p>>2]|0;l=k>>>8;m=g+(v+3)|0;k=k-(_(l,d[m>>0]|0)|0)|0;c[C>>2]=(c[C>>2]|0)+k;g=_(l,(d[m>>0]|0)-(d[g+(v+4)>>0]|0)|0)|0;c[p>>2]=g;while(1){if(g>>>0>=8388609){k=n;continue c}h=c[C>>2]|0;l=h>>>23;if((l|0)==255)c[B>>2]=(c[B>>2]|0)+1;else{k=h>>>31;g=c[q>>2]|0;if((g|0)>-1){h=c[r>>2]|0;if((h+(c[s>>2]|0)|0)>>>0<(c[A>>2]|0)>>>0){c[r>>2]=h+1;a[(c[f>>2]|0)+h>>0]=g+k;g=0}else g=-1;c[u>>2]=c[u>>2]|g}g=c[B>>2]|0;if(g|0){k=k+255&255;do{h=c[r>>2]|0;if((h+(c[s>>2]|0)|0)>>>0<(c[A>>2]|0)>>>0){c[r>>2]=h+1;a[(c[f>>2]|0)+h>>0]=k;h=0;g=c[B>>2]|0}else h=-1;c[u>>2]=c[u>>2]|h;g=g+-1|0;c[B>>2]=g}while((g|0)!=0)}c[q>>2]=l&255;h=c[C>>2]|0;g=c[p>>2]|0}c[C>>2]=h<<8&2147483392;g=g<<8;c[p>>2]=g;c[o>>2]=(c[o>>2]|0)+8}}v=c[p>>2]|0;g=v-(_(v>>>8,d[(c[g+28>>2]|0)+(b[x+(k<<1)>>1]|0)>>0]|0)|0)|0;c[p>>2]=g;while(1){if(g>>>0>=8388609)break;h=c[C>>2]|0;l=h>>>23;if((l|0)==255)c[B>>2]=(c[B>>2]|0)+1;else{k=h>>>31;g=c[q>>2]|0;if((g|0)>-1){h=c[r>>2]|0;if((h+(c[s>>2]|0)|0)>>>0<(c[A>>2]|0)>>>0){c[r>>2]=h+1;a[(c[f>>2]|0)+h>>0]=g+k;g=0}else g=-1;c[u>>2]=c[u>>2]|g}g=c[B>>2]|0;if(g|0){k=k+255&255;do{h=c[r>>2]|0;if((h+(c[s>>2]|0)|0)>>>0<(c[A>>2]|0)>>>0){c[r>>2]=h+1;a[(c[f>>2]|0)+h>>0]=k;h=0;g=c[B>>2]|0}else h=-1;c[u>>2]=c[u>>2]|h;g=g+-1|0;c[B>>2]=g}while((g|0)!=0)}c[q>>2]=l&255;h=c[C>>2]|0;g=c[p>>2]|0}c[C>>2]=h<<8&2147483392;g=g<<8;c[p>>2]=g;c[o>>2]=(c[o>>2]|0)+8}h=-4-(a[m>>0]|0)|0;k=g>>>8;if((h|0)>0){v=d[29970+(h+-1)>>0]|0;g=g-(_(k,v)|0)|0;c[C>>2]=(c[C>>2]|0)+g;g=_(k,v-(d[29970+h>>0]|0)|0)|0}else g=g-(_(k,d[29970+h>>0]|0)|0)|0;c[p>>2]=g;while(1){if(g>>>0>=8388609){k=n;continue c}h=c[C>>2]|0;l=h>>>23;if((l|0)==255)c[B>>2]=(c[B>>2]|0)+1;else{k=h>>>31;g=c[q>>2]|0;if((g|0)>-1){h=c[r>>2]|0;if((h+(c[s>>2]|0)|0)>>>0<(c[A>>2]|0)>>>0){c[r>>2]=h+1;a[(c[f>>2]|0)+h>>0]=g+k;g=0}else g=-1;c[u>>2]=c[u>>2]|g}g=c[B>>2]|0;if(g|0){k=k+255&255;do{h=c[r>>2]|0;if((h+(c[s>>2]|0)|0)>>>0<(c[A>>2]|0)>>>0){c[r>>2]=h+1;a[(c[f>>2]|0)+h>>0]=k;h=0;g=c[B>>2]|0}else h=-1;c[u>>2]=c[u>>2]|h;g=g+-1|0;c[B>>2]=g}while((g|0)!=0)}c[q>>2]=l&255;h=c[C>>2]|0;g=c[p>>2]|0}c[C>>2]=h<<8&2147483392;g=g<<8;c[p>>2]=g;c[o>>2]=(c[o>>2]|0)+8}}d:do if((c[y>>2]|0)==4){x=a[E+31>>0]|0;g=x<<24>>24;h=c[p>>2]|0;k=h>>>8;if(x<<24>>24>0){x=d[29939+(g+-1)>>0]|0;v=h-(_(k,x)|0)|0;c[C>>2]=(c[C>>2]|0)+v;g=_(k,x-(d[29939+g>>0]|0)|0)|0}else g=h-(_(k,d[29939+g>>0]|0)|0)|0;c[p>>2]=g;while(1){if(g>>>0>=8388609)break d;h=c[C>>2]|0;l=h>>>23;if((l|0)==255)c[B>>2]=(c[B>>2]|0)+1;else{k=h>>>31;g=c[q>>2]|0;if((g|0)>-1){h=c[r>>2]|0;if((h+(c[s>>2]|0)|0)>>>0<(c[A>>2]|0)>>>0){c[r>>2]=h+1;a[(c[f>>2]|0)+h>>0]=g+k;g=0}else g=-1;c[u>>2]=c[u>>2]|g}g=c[B>>2]|0;if(g|0){k=k+255&255;do{h=c[r>>2]|0;if((h+(c[s>>2]|0)|0)>>>0<(c[A>>2]|0)>>>0){c[r>>2]=h+1;a[(c[f>>2]|0)+h>>0]=k;h=0;g=c[B>>2]|0}else h=-1;c[u>>2]=c[u>>2]|h;g=g+-1|0;c[B>>2]=g}while((g|0)!=0)}c[q>>2]=l&255;h=c[C>>2]|0;g=c[p>>2]|0}c[C>>2]=h<<8&2147483392;g=g<<8;c[p>>2]=g;c[o>>2]=(c[o>>2]|0)+8}}while(0);e:do if((a[D>>0]|0)==2){if(w?(c[e+5860>>2]|0)==2:0){h=E+26|0;g=e+5864|0;k=(b[h>>1]|0)-(b[g>>1]|0)|0;if((k+8|0)>>>0<=19){n=k+9|0;l=c[p>>2]|0;m=l>>>8;if((k|0)>-9){k=d[30009+(k+8)>>0]|0;t=l-(_(m,k)|0)|0;c[C>>2]=(c[C>>2]|0)+t;t=0;k=_(m,k-(d[30009+n>>0]|0)|0)|0}else{k=0;z=243}}else{l=c[p>>2]|0;m=l>>>8;n=0;k=1;z=243}if((z|0)==243){t=k;k=l-(_(m,d[30009+n>>0]|0)|0)|0}c[p>>2]=k;while(1){if(k>>>0>=8388609)break;l=c[C>>2]|0;n=l>>>23;if((n|0)==255)c[B>>2]=(c[B>>2]|0)+1;else{m=l>>>31;k=c[q>>2]|0;if((k|0)>-1){l=c[r>>2]|0;if((l+(c[s>>2]|0)|0)>>>0<(c[A>>2]|0)>>>0){c[r>>2]=l+1;a[(c[f>>2]|0)+l>>0]=k+m;k=0}else k=-1;c[u>>2]=c[u>>2]|k}k=c[B>>2]|0;if(k|0){m=m+255&255;do{l=c[r>>2]|0;if((l+(c[s>>2]|0)|0)>>>0<(c[A>>2]|0)>>>0){c[r>>2]=l+1;a[(c[f>>2]|0)+l>>0]=m;l=0;k=c[B>>2]|0}else l=-1;c[u>>2]=c[u>>2]|l;k=k+-1|0;c[B>>2]=k}while((k|0)!=0)}c[q>>2]=n&255;l=c[C>>2]|0;k=c[p>>2]|0}c[C>>2]=l<<8&2147483392;k=k<<8;c[p>>2]=k;c[o>>2]=(c[o>>2]|0)+8}if(t)z=260}else z=260;if((z|0)==260){h=E+26|0;k=b[h>>1]|0;n=c[e+4668>>2]|0;g=(k|0)/(n>>1|0)|0;n=k-(_(g<<16>>16,n<<15>>16)|0)|0;k=c[p>>2]|0;l=k>>>8;if((g|0)>0){z=d[29977+(g+-1)>>0]|0;x=k-(_(l,z)|0)|0;c[C>>2]=(c[C>>2]|0)+x;g=_(l,z-(d[29977+g>>0]|0)|0)|0}else g=k-(_(l,d[29977+g>>0]|0)|0)|0;c[p>>2]=g;while(1){if(g>>>0>=8388609)break;k=c[C>>2]|0;m=k>>>23;if((m|0)==255)c[B>>2]=(c[B>>2]|0)+1;else{l=k>>>31;g=c[q>>2]|0;if((g|0)>-1){k=c[r>>2]|0;if((k+(c[s>>2]|0)|0)>>>0<(c[A>>2]|0)>>>0){c[r>>2]=k+1;a[(c[f>>2]|0)+k>>0]=g+l;g=0}else g=-1;c[u>>2]=c[u>>2]|g}g=c[B>>2]|0;if(g|0){l=l+255&255;do{k=c[r>>2]|0;if((k+(c[s>>2]|0)|0)>>>0<(c[A>>2]|0)>>>0){c[r>>2]=k+1;a[(c[f>>2]|0)+k>>0]=l;k=0;g=c[B>>2]|0}else k=-1;c[u>>2]=c[u>>2]|k;g=g+-1|0;c[B>>2]=g}while((g|0)!=0)}c[q>>2]=m&255;k=c[C>>2]|0;g=c[p>>2]|0}c[C>>2]=k<<8&2147483392;g=g<<8;c[p>>2]=g;c[o>>2]=(c[o>>2]|0)+8}k=c[e+4776>>2]|0;l=g>>>8;if((n|0)>0){z=k+(n+-1)|0;g=g-(_(l,d[z>>0]|0)|0)|0;c[C>>2]=(c[C>>2]|0)+g;g=_(l,(d[z>>0]|0)-(d[k+n>>0]|0)|0)|0}else g=g-(_(l,d[k+n>>0]|0)|0)|0;c[p>>2]=g;while(1){if(g>>>0>=8388609)break;k=c[C>>2]|0;m=k>>>23;if((m|0)==255)c[B>>2]=(c[B>>2]|0)+1;else{l=k>>>31;g=c[q>>2]|0;if((g|0)>-1){k=c[r>>2]|0;if((k+(c[s>>2]|0)|0)>>>0<(c[A>>2]|0)>>>0){c[r>>2]=k+1;a[(c[f>>2]|0)+k>>0]=g+l;g=0}else g=-1;c[u>>2]=c[u>>2]|g}g=c[B>>2]|0;if(g|0){l=l+255&255;do{k=c[r>>2]|0;if((k+(c[s>>2]|0)|0)>>>0<(c[A>>2]|0)>>>0){c[r>>2]=k+1;a[(c[f>>2]|0)+k>>0]=l;k=0;g=c[B>>2]|0}else k=-1;c[u>>2]=c[u>>2]|k;g=g+-1|0;c[B>>2]=g}while((g|0)!=0)}c[q>>2]=m&255;k=c[C>>2]|0;g=c[p>>2]|0}c[C>>2]=k<<8&2147483392;g=g<<8;c[p>>2]=g;c[o>>2]=(c[o>>2]|0)+8}g=e+5864|0}b[g>>1]=b[h>>1]|0;z=a[E+28>>0]|0;g=z<<24>>24;h=c[e+4780>>2]|0;k=c[p>>2]|0;l=k>>>8;if(z<<24>>24>0){z=h+(g+-1)|0;x=k-(_(l,d[z>>0]|0)|0)|0;c[C>>2]=(c[C>>2]|0)+x;g=_(l,(d[z>>0]|0)-(d[h+g>>0]|0)|0)|0}else g=k-(_(l,d[h+g>>0]|0)|0)|0;c[p>>2]=g;while(1){if(g>>>0>=8388609)break;h=c[C>>2]|0;l=h>>>23;if((l|0)==255)c[B>>2]=(c[B>>2]|0)+1;else{k=h>>>31;g=c[q>>2]|0;if((g|0)>-1){h=c[r>>2]|0;if((h+(c[s>>2]|0)|0)>>>0<(c[A>>2]|0)>>>0){c[r>>2]=h+1;a[(c[f>>2]|0)+h>>0]=g+k;g=0}else g=-1;c[u>>2]=c[u>>2]|g}g=c[B>>2]|0;if(g|0){k=k+255&255;do{h=c[r>>2]|0;if((h+(c[s>>2]|0)|0)>>>0<(c[A>>2]|0)>>>0){c[r>>2]=h+1;a[(c[f>>2]|0)+h>>0]=k;h=0;g=c[B>>2]|0}else h=-1;c[u>>2]=c[u>>2]|h;g=g+-1|0;c[B>>2]=g}while((g|0)!=0)}c[q>>2]=l&255;h=c[C>>2]|0;g=c[p>>2]|0}c[C>>2]=h<<8&2147483392;g=g<<8;c[p>>2]=g;c[o>>2]=(c[o>>2]|0)+8}n=E+32|0;z=a[n>>0]|0;h=z<<24>>24;k=g>>>8;if(z<<24>>24>0){z=d[29437+(h+-1)>>0]|0;g=g-(_(k,z)|0)|0;c[C>>2]=(c[C>>2]|0)+g;g=_(k,z-(d[29437+h>>0]|0)|0)|0}else g=g-(_(k,d[29437+h>>0]|0)|0)|0;c[p>>2]=g;while(1){if(g>>>0>=8388609){l=g;m=0;break}h=c[C>>2]|0;l=h>>>23;if((l|0)==255)c[B>>2]=(c[B>>2]|0)+1;else{k=h>>>31;g=c[q>>2]|0;if((g|0)>-1){h=c[r>>2]|0;if((h+(c[s>>2]|0)|0)>>>0<(c[A>>2]|0)>>>0){c[r>>2]=h+1;a[(c[f>>2]|0)+h>>0]=g+k;g=0}else g=-1;c[u>>2]=c[u>>2]|g}g=c[B>>2]|0;if(g|0){k=k+255&255;do{h=c[r>>2]|0;if((h+(c[s>>2]|0)|0)>>>0<(c[A>>2]|0)>>>0){c[r>>2]=h+1;a[(c[f>>2]|0)+h>>0]=k;h=0;g=c[B>>2]|0}else h=-1;c[u>>2]=c[u>>2]|h;g=g+-1|0;c[B>>2]=g}while((g|0)!=0)}c[q>>2]=l&255;h=c[C>>2]|0;g=c[p>>2]|0}c[C>>2]=h<<8&2147483392;g=g<<8;c[p>>2]=g;c[o>>2]=(c[o>>2]|0)+8}while(1){if((m|0)>=(c[y>>2]|0))break;z=a[E+4+m>>0]|0;g=z<<24>>24;h=c[17376+(a[n>>0]<<2)>>2]|0;k=l>>>8;if(z<<24>>24>0){z=h+(g+-1)|0;x=l-(_(k,d[z>>0]|0)|0)|0;c[C>>2]=(c[C>>2]|0)+x;g=_(k,(d[z>>0]|0)-(d[h+g>>0]|0)|0)|0}else g=l-(_(k,d[h+g>>0]|0)|0)|0;c[p>>2]=g;while(1){if(g>>>0>=8388609)break;h=c[C>>2]|0;l=h>>>23;if((l|0)==255)c[B>>2]=(c[B>>2]|0)+1;else{k=h>>>31;g=c[q>>2]|0;if((g|0)>-1){h=c[r>>2]|0;if((h+(c[s>>2]|0)|0)>>>0<(c[A>>2]|0)>>>0){c[r>>2]=h+1;a[(c[f>>2]|0)+h>>0]=g+k;g=0}else g=-1;c[u>>2]=c[u>>2]|g}g=c[B>>2]|0;if(g|0){k=k+255&255;do{h=c[r>>2]|0;if((h+(c[s>>2]|0)|0)>>>0<(c[A>>2]|0)>>>0){c[r>>2]=h+1;a[(c[f>>2]|0)+h>>0]=k;h=0;g=c[B>>2]|0}else h=-1;c[u>>2]=c[u>>2]|h;g=g+-1|0;c[B>>2]=g}while((g|0)!=0)}c[q>>2]=l&255;h=c[C>>2]|0;g=c[p>>2]|0}c[C>>2]=h<<8&2147483392;g=g<<8;c[p>>2]=g;c[o>>2]=(c[o>>2]|0)+8}l=g;m=m+1|0}if(!j){j=a[E+33>>0]|0;g=j<<24>>24;h=l>>>8;if(j<<24>>24>0){j=d[29930+(g+-1)>>0]|0;z=l-(_(h,j)|0)|0;c[C>>2]=(c[C>>2]|0)+z;g=_(h,j-(d[29930+g>>0]|0)|0)|0}else g=l-(_(h,d[29930+g>>0]|0)|0)|0;c[p>>2]=g;while(1){if(g>>>0>=8388609)break e;h=c[C>>2]|0;l=h>>>23;if((l|0)==255)c[B>>2]=(c[B>>2]|0)+1;else{k=h>>>31;g=c[q>>2]|0;if((g|0)>-1){h=c[r>>2]|0;if((h+(c[s>>2]|0)|0)>>>0<(c[A>>2]|0)>>>0){c[r>>2]=h+1;a[(c[f>>2]|0)+h>>0]=g+k;g=0}else g=-1;c[u>>2]=c[u>>2]|g}g=c[B>>2]|0;if(g|0){k=k+255&255;do{h=c[r>>2]|0;if((h+(c[s>>2]|0)|0)>>>0<(c[A>>2]|0)>>>0){c[r>>2]=h+1;a[(c[f>>2]|0)+h>>0]=k;h=0;g=c[B>>2]|0}else h=-1;c[u>>2]=c[u>>2]|h;g=g+-1|0;c[B>>2]=g}while((g|0)!=0)}c[q>>2]=l&255;h=c[C>>2]|0;g=c[p>>2]|0}c[C>>2]=h<<8&2147483392;g=g<<8;c[p>>2]=g;c[o>>2]=(c[o>>2]|0)+8}}}while(0);c[e+5860>>2]=a[D>>0];e=a[E+34>>0]|0;g=e<<24>>24;h=c[p>>2]|0;k=h>>>8;if(e<<24>>24>0){e=d[29947+(g+-1)>>0]|0;E=h-(_(k,e)|0)|0;c[C>>2]=(c[C>>2]|0)+E;g=_(k,e-(d[29947+g>>0]|0)|0)|0}else g=h-(_(k,d[29947+g>>0]|0)|0)|0;c[p>>2]=g;while(1){if(g>>>0>=8388609)break;h=c[C>>2]|0;l=h>>>23;if((l|0)==255)c[B>>2]=(c[B>>2]|0)+1;else{k=h>>>31;g=c[q>>2]|0;if((g|0)>-1){h=c[r>>2]|0;if((h+(c[s>>2]|0)|0)>>>0<(c[A>>2]|0)>>>0){c[r>>2]=h+1;a[(c[f>>2]|0)+h>>0]=g+k;g=0}else g=-1;c[u>>2]=c[u>>2]|g}g=c[B>>2]|0;if(g|0){k=k+255&255;do{h=c[r>>2]|0;if((h+(c[s>>2]|0)|0)>>>0<(c[A>>2]|0)>>>0){c[r>>2]=h+1;a[(c[f>>2]|0)+h>>0]=k;h=0;g=c[B>>2]|0}else h=-1;c[u>>2]=c[u>>2]|h;g=g+-1|0;c[B>>2]=g}while((g|0)!=0)}c[q>>2]=l&255;h=c[C>>2]|0;g=c[p>>2]|0}c[C>>2]=h<<8&2147483392;g=g<<8;c[p>>2]=g;c[o>>2]=(c[o>>2]|0)+8}i=F;return}function Bd(b,e,f,g,h){b=b|0;e=e|0;f=f|0;g=g|0;h=h|0;var j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0;T=i;i=i+96|0;S=T+56|0;F=T+40|0;G=T+32|0;r=T;c[r>>2]=0;c[r+4>>2]=0;c[r+8>>2]=0;c[r+12>>2]=0;c[r+16>>2]=0;c[r+20>>2]=0;c[r+24>>2]=0;c[r+28>>2]=0;j=h>>4;if((j<<4|0)<(h|0)){j=j+1|0;k=g+h|0;l=k+16|0;do{a[k>>0]=0;k=k+1|0}while((k|0)<(l|0))}k=j<<4;E=i;i=i+((1*(k<<2)|0)+15&-16)|0;l=0;while(1){if((l|0)>=(k|0))break;P=a[g+l>>0]|0;R=P<<24>>24;c[E+(l<<2)>>2]=P<<24>>24>0?R:0-R|0;R=l|1;P=a[g+R>>0]|0;Q=P<<24>>24;c[E+(R<<2)>>2]=P<<24>>24>0?Q:0-Q|0;R=l|2;Q=a[g+R>>0]|0;P=Q<<24>>24;c[E+(R<<2)>>2]=Q<<24>>24>0?P:0-P|0;R=l|3;P=a[g+R>>0]|0;Q=P<<24>>24;c[E+(R<<2)>>2]=P<<24>>24>0?Q:0-Q|0;l=l+4|0}R=i;i=i+((1*(j<<2)|0)+15&-16)|0;H=i;i=i+((1*(j<<2)|0)+15&-16)|0;p=E;q=0;while(1){if((q|0)>=(j|0))break;n=H+(q<<2)|0;c[n>>2]=0;o=R+(q<<2)|0;l=0;a:while(1){if((l|0)<8){k=l<<1;k=(c[p+(k<<2)>>2]|0)+(c[p+((k|1)<<2)>>2]|0)|0;if((k|0)>8)m=1;else{c[r+(l<<2)>>2]=k;l=l+1|0;continue}}else m=0;l=0;while(1){if((l|0)>=4){k=0;break}k=l<<1;k=(c[r+(k<<2)>>2]|0)+(c[r+((k|1)<<2)>>2]|0)|0;if((k|0)>10){k=1;break}c[r+(l<<2)>>2]=k;l=l+1|0}m=m+k|0;l=0;while(1){if((l|0)>=2){k=0;break}k=l<<1;k=(c[r+(k<<2)>>2]|0)+(c[r+((k|1)<<2)>>2]|0)|0;if((k|0)>12){k=1;break}c[r+(l<<2)>>2]=k;l=l+1|0}m=m+k|0;l=0;while(1){if((l|0)>=1){k=0;break}k=l<<1;k=(c[r+(k<<2)>>2]|0)+(c[r+((k|1)<<2)>>2]|0)|0;if((k|0)>16){k=1;break}c[o+(l<<2)>>2]=k;l=l+1|0}if((m|0)==(0-k|0))break;c[n>>2]=(c[n>>2]|0)+1;k=0;while(1){if((k|0)==16){l=0;continue a}Q=p+(k<<2)|0;c[Q>>2]=c[Q>>2]>>1;k=k+1|0}}p=p+64|0;q=q+1|0}q=e>>1;t=0;n=0;o=2147483647;while(1){if((n|0)==9)break;l=30270+(n*18|0)+17|0;m=0;p=d[30450+(q*9|0)+n>>0]|0;while(1){if((m|0)>=(j|0))break;if((c[H+(m<<2)>>2]|0)>0)k=l;else k=(c[R+(m<<2)>>2]|0)+(30270+(n*18|0))|0;m=m+1|0;p=p+(d[k>>0]|0)|0}Q=(p|0)<(o|0);t=Q?n:t;n=n+1|0;o=Q?p:o}Q=b+28|0;k=c[Q>>2]|0;l=k>>>8;if((t|0)>0){P=d[t+-1+(30432+(q*9|0))>>0]|0;k=k-(_(l,P)|0)|0;I=b+32|0;c[I>>2]=(c[I>>2]|0)+k;k=_(l,P-(d[30432+(q*9|0)+t>>0]|0)|0)|0;c[Q>>2]=k}else{k=k-(_(l,d[30432+(q*9|0)+t>>0]|0)|0)|0;c[Q>>2]=k;I=b+32|0}J=b+36|0;K=b+20|0;L=b+40|0;M=b+24|0;N=b+8|0;O=b+4|0;P=b+44|0;while(1){if(k>>>0>=8388609)break;l=c[I>>2]|0;n=l>>>23;if((n|0)==255)c[J>>2]=(c[J>>2]|0)+1;else{m=l>>>31;k=c[L>>2]|0;if((k|0)>-1){l=c[M>>2]|0;if((l+(c[N>>2]|0)|0)>>>0<(c[O>>2]|0)>>>0){c[M>>2]=l+1;a[(c[b>>2]|0)+l>>0]=k+m;k=0}else k=-1;c[P>>2]=c[P>>2]|k}k=c[J>>2]|0;if(k|0){m=m+255&255;do{l=c[M>>2]|0;if((l+(c[N>>2]|0)|0)>>>0<(c[O>>2]|0)>>>0){c[M>>2]=l+1;a[(c[b>>2]|0)+l>>0]=m;l=0;k=c[J>>2]|0}else l=-1;c[P>>2]=c[P>>2]|l;k=k+-1|0;c[J>>2]=k}while((k|0)!=0)}c[L>>2]=n&255;l=c[I>>2]|0;k=c[Q>>2]|0}c[I>>2]=l<<8&2147483392;k=k<<8;c[Q>>2]=k;c[K>>2]=(c[K>>2]|0)+8}r=30090+(t*18|0)+16|0;s=30090+(t*18|0)+17|0;q=0;while(1){if((q|0)>=(j|0))break;o=c[H+(q<<2)>>2]|0;b:do if(!o){l=c[R+(q<<2)>>2]|0;m=k>>>8;if((l|0)>0){D=d[l+-1+(30090+(t*18|0))>>0]|0;k=k-(_(m,D)|0)|0;c[I>>2]=(c[I>>2]|0)+k;k=_(m,D-(d[30090+(t*18|0)+l>>0]|0)|0)|0}else k=k-(_(m,d[30090+(t*18|0)+l>>0]|0)|0)|0;c[Q>>2]=k;while(1){if(k>>>0>=8388609)break b;l=c[I>>2]|0;n=l>>>23;if((n|0)==255)c[J>>2]=(c[J>>2]|0)+1;else{m=l>>>31;k=c[L>>2]|0;if((k|0)>-1){l=c[M>>2]|0;if((l+(c[N>>2]|0)|0)>>>0<(c[O>>2]|0)>>>0){c[M>>2]=l+1;a[(c[b>>2]|0)+l>>0]=k+m;k=0}else k=-1;c[P>>2]=c[P>>2]|k}k=c[J>>2]|0;if(k|0){m=m+255&255;do{l=c[M>>2]|0;if((l+(c[N>>2]|0)|0)>>>0<(c[O>>2]|0)>>>0){c[M>>2]=l+1;a[(c[b>>2]|0)+l>>0]=m;l=0;k=c[J>>2]|0}else l=-1;c[P>>2]=c[P>>2]|l;k=k+-1|0;c[J>>2]=k}while((k|0)!=0)}c[L>>2]=n&255;l=c[I>>2]|0;k=c[Q>>2]|0}c[I>>2]=l<<8&2147483392;k=k<<8;c[Q>>2]=k;c[K>>2]=(c[K>>2]|0)+8}}else{C=k>>>8;D=d[r>>0]|0;l=k-(_(C,D)|0)|0;l=(c[I>>2]|0)+l|0;c[I>>2]=l;k=_(C,D-(d[s>>0]|0)|0)|0;c[Q>>2]=k;while(1){if(k>>>0>=8388609)break;n=l>>>23;if((n|0)==255)c[J>>2]=(c[J>>2]|0)+1;else{m=l>>>31;k=c[L>>2]|0;if((k|0)>-1){l=c[M>>2]|0;if((l+(c[N>>2]|0)|0)>>>0<(c[O>>2]|0)>>>0){c[M>>2]=l+1;a[(c[b>>2]|0)+l>>0]=k+m;k=0}else k=-1;c[P>>2]=c[P>>2]|k}k=c[J>>2]|0;if(k|0){m=m+255&255;do{l=c[M>>2]|0;if((l+(c[N>>2]|0)|0)>>>0<(c[O>>2]|0)>>>0){c[M>>2]=l+1;a[(c[b>>2]|0)+l>>0]=m;l=0;k=c[J>>2]|0}else l=-1;c[P>>2]=c[P>>2]|l;k=k+-1|0;c[J>>2]=k}while((k|0)!=0)}c[L>>2]=n&255;l=c[I>>2]|0;k=c[Q>>2]|0}l=l<<8&2147483392;c[I>>2]=l;k=k<<8;c[Q>>2]=k;c[K>>2]=(c[K>>2]|0)+8}p=o+-1|0;o=0;while(1){if((o|0)>=(p|0))break;D=k>>>8<<1;l=l+(k-D)|0;c[I>>2]=l;c[Q>>2]=D;k=D;while(1){if(k>>>0>=8388609)break;n=l>>>23;if((n|0)==255)c[J>>2]=(c[J>>2]|0)+1;else{m=l>>>31;k=c[L>>2]|0;if((k|0)>-1){l=c[M>>2]|0;if((l+(c[N>>2]|0)|0)>>>0<(c[O>>2]|0)>>>0){c[M>>2]=l+1;a[(c[b>>2]|0)+l>>0]=k+m;k=0}else k=-1;c[P>>2]=c[P>>2]|k}k=c[J>>2]|0;if(k|0){m=m+255&255;do{l=c[M>>2]|0;if((l+(c[N>>2]|0)|0)>>>0<(c[O>>2]|0)>>>0){c[M>>2]=l+1;a[(c[b>>2]|0)+l>>0]=m;l=0;k=c[J>>2]|0}else l=-1;c[P>>2]=c[P>>2]|l;k=k+-1|0;c[J>>2]=k}while((k|0)!=0)}c[L>>2]=n&255;l=c[I>>2]|0;k=c[Q>>2]|0}l=l<<8&2147483392;c[I>>2]=l;k=k<<8;c[Q>>2]=k;c[K>>2]=(c[K>>2]|0)+8}o=o+1|0}m=c[R+(q<<2)>>2]|0;n=k>>>8;if((m|0)>0){D=d[30252+(m+-1)>>0]|0;l=l+(k-(_(n,D)|0))|0;c[I>>2]=l;k=_(n,D-(d[30252+m>>0]|0)|0)|0}else k=k-(_(n,d[30252+m>>0]|0)|0)|0;c[Q>>2]=k;while(1){if(k>>>0>=8388609)break b;n=l>>>23;if((n|0)==255)c[J>>2]=(c[J>>2]|0)+1;else{m=l>>>31;k=c[L>>2]|0;if((k|0)>-1){l=c[M>>2]|0;if((l+(c[N>>2]|0)|0)>>>0<(c[O>>2]|0)>>>0){c[M>>2]=l+1;a[(c[b>>2]|0)+l>>0]=k+m;k=0}else k=-1;c[P>>2]=c[P>>2]|k}k=c[J>>2]|0;if(k|0){m=m+255&255;do{l=c[M>>2]|0;if((l+(c[N>>2]|0)|0)>>>0<(c[O>>2]|0)>>>0){c[M>>2]=l+1;a[(c[b>>2]|0)+l>>0]=m;l=0;k=c[J>>2]|0}else l=-1;c[P>>2]=c[P>>2]|l;k=k+-1|0;c[J>>2]=k}while((k|0)!=0)}c[L>>2]=n&255;l=c[I>>2]|0;k=c[Q>>2]|0}l=l<<8&2147483392;c[I>>2]=l;k=k<<8;c[Q>>2]=k;c[K>>2]=(c[K>>2]|0)+8}}while(0);q=q+1|0}t=S+4|0;u=S+8|0;v=F+4|0;w=S+12|0;x=F+8|0;y=G+4|0;z=S+16|0;A=S+20|0;B=S+24|0;C=F+12|0;D=S+28|0;s=0;l=0;while(1){if((s|0)>=(j|0)){t=0;break}if((c[R+(s<<2)>>2]|0)>0){r=E+(s<<4<<2)|0;m=0;while(1){if((m|0)==8){m=0;break}q=m<<1;c[S+(m<<2)>>2]=(c[r+(q<<2)>>2]|0)+(c[r+((q|1)<<2)>>2]|0);m=m+1|0}while(1){if((m|0)==4){m=0;break}q=m<<1;c[F+(m<<2)>>2]=(c[S+(q<<2)>>2]|0)+(c[S+((q|1)<<2)>>2]|0);m=m+1|0}while(1){if((m|0)==2){m=0;break}q=m<<1;c[G+(m<<2)>>2]=(c[F+(q<<2)>>2]|0)+(c[F+((q|1)<<2)>>2]|0);m=m+1|0}while(1){if((m|0)==1)break;l=m<<1;m=m+1|0;l=(c[G+(l<<2)>>2]|0)+(c[G+((l|1)<<2)>>2]|0)|0}p=c[G>>2]|0;c:do if((l|0)>0){m=30924+(d[31076+l>>0]|0)|0;n=k>>>8;if((p|0)>0){q=d[m+(p+-1)>>0]|0;k=k-(_(n,q)|0)|0;c[I>>2]=(c[I>>2]|0)+k;k=_(n,q-(d[m+p>>0]|0)|0)|0}else k=k-(_(n,d[m+p>>0]|0)|0)|0;c[Q>>2]=k;while(1){if(k>>>0>=8388609)break c;m=c[I>>2]|0;o=m>>>23;if((o|0)==255)c[J>>2]=(c[J>>2]|0)+1;else{n=m>>>31;k=c[L>>2]|0;if((k|0)>-1){m=c[M>>2]|0;if((m+(c[N>>2]|0)|0)>>>0<(c[O>>2]|0)>>>0){c[M>>2]=m+1;a[(c[b>>2]|0)+m>>0]=k+n;k=0}else k=-1;c[P>>2]=c[P>>2]|k}k=c[J>>2]|0;if(k|0){n=n+255&255;do{m=c[M>>2]|0;if((m+(c[N>>2]|0)|0)>>>0<(c[O>>2]|0)>>>0){c[M>>2]=m+1;a[(c[b>>2]|0)+m>>0]=n;m=0;k=c[J>>2]|0}else m=-1;c[P>>2]=c[P>>2]|m;k=k+-1|0;c[J>>2]=k}while((k|0)!=0)}c[L>>2]=o&255;m=c[I>>2]|0;k=c[Q>>2]|0}c[I>>2]=m<<8&2147483392;k=k<<8;c[Q>>2]=k;c[K>>2]=(c[K>>2]|0)+8}}while(0);q=c[F>>2]|0;d:do if((p|0)>0){m=30772+(d[31076+p>>0]|0)|0;n=k>>>8;if((q|0)>0){p=d[m+(q+-1)>>0]|0;k=k-(_(n,p)|0)|0;c[I>>2]=(c[I>>2]|0)+k;k=_(n,p-(d[m+q>>0]|0)|0)|0}else k=k-(_(n,d[m+q>>0]|0)|0)|0;c[Q>>2]=k;while(1){if(k>>>0>=8388609)break d;m=c[I>>2]|0;o=m>>>23;if((o|0)==255)c[J>>2]=(c[J>>2]|0)+1;else{n=m>>>31;k=c[L>>2]|0;if((k|0)>-1){m=c[M>>2]|0;if((m+(c[N>>2]|0)|0)>>>0<(c[O>>2]|0)>>>0){c[M>>2]=m+1;a[(c[b>>2]|0)+m>>0]=k+n;k=0}else k=-1;c[P>>2]=c[P>>2]|k}k=c[J>>2]|0;if(k|0){n=n+255&255;do{m=c[M>>2]|0;if((m+(c[N>>2]|0)|0)>>>0<(c[O>>2]|0)>>>0){c[M>>2]=m+1;a[(c[b>>2]|0)+m>>0]=n;m=0;k=c[J>>2]|0}else m=-1;c[P>>2]=c[P>>2]|m;k=k+-1|0;c[J>>2]=k}while((k|0)!=0)}c[L>>2]=o&255;m=c[I>>2]|0;k=c[Q>>2]|0}c[I>>2]=m<<8&2147483392;k=k<<8;c[Q>>2]=k;c[K>>2]=(c[K>>2]|0)+8}}while(0);p=c[S>>2]|0;e:do if((q|0)>0){m=30620+(d[31076+q>>0]|0)|0;n=k>>>8;if((p|0)>0){q=d[m+(p+-1)>>0]|0;k=k-(_(n,q)|0)|0;c[I>>2]=(c[I>>2]|0)+k;k=_(n,q-(d[m+p>>0]|0)|0)|0}else k=k-(_(n,d[m+p>>0]|0)|0)|0;c[Q>>2]=k;while(1){if(k>>>0>=8388609)break e;m=c[I>>2]|0;o=m>>>23;if((o|0)==255)c[J>>2]=(c[J>>2]|0)+1;else{n=m>>>31;k=c[L>>2]|0;if((k|0)>-1){m=c[M>>2]|0;if((m+(c[N>>2]|0)|0)>>>0<(c[O>>2]|0)>>>0){c[M>>2]=m+1;a[(c[b>>2]|0)+m>>0]=k+n;k=0}else k=-1;c[P>>2]=c[P>>2]|k}k=c[J>>2]|0;if(k|0){n=n+255&255;do{m=c[M>>2]|0;if((m+(c[N>>2]|0)|0)>>>0<(c[O>>2]|0)>>>0){c[M>>2]=m+1;a[(c[b>>2]|0)+m>>0]=n;m=0;k=c[J>>2]|0}else m=-1;c[P>>2]=c[P>>2]|m;k=k+-1|0;c[J>>2]=k}while((k|0)!=0)}c[L>>2]=o&255;m=c[I>>2]|0;k=c[Q>>2]|0}c[I>>2]=m<<8&2147483392;k=k<<8;c[Q>>2]=k;c[K>>2]=(c[K>>2]|0)+8}}while(0);o=c[r>>2]|0;f:do if((p|0)>0){m=30468+(d[31076+p>>0]|0)|0;n=k>>>8;if((o|0)>0){q=d[m+(o+-1)>>0]|0;k=k-(_(n,q)|0)|0;c[I>>2]=(c[I>>2]|0)+k;k=_(n,q-(d[m+o>>0]|0)|0)|0}else k=k-(_(n,d[m+o>>0]|0)|0)|0;c[Q>>2]=k;while(1){if(k>>>0>=8388609)break f;m=c[I>>2]|0;o=m>>>23;if((o|0)==255)c[J>>2]=(c[J>>2]|0)+1;else{n=m>>>31;k=c[L>>2]|0;if((k|0)>-1){m=c[M>>2]|0;if((m+(c[N>>2]|0)|0)>>>0<(c[O>>2]|0)>>>0){c[M>>2]=m+1;a[(c[b>>2]|0)+m>>0]=k+n;k=0}else k=-1;c[P>>2]=c[P>>2]|k}k=c[J>>2]|0;if(k|0){n=n+255&255;do{m=c[M>>2]|0;if((m+(c[N>>2]|0)|0)>>>0<(c[O>>2]|0)>>>0){c[M>>2]=m+1;a[(c[b>>2]|0)+m>>0]=n;m=0;k=c[J>>2]|0}else m=-1;c[P>>2]=c[P>>2]|m;k=k+-1|0;c[J>>2]=k}while((k|0)!=0)}c[L>>2]=o&255;m=c[I>>2]|0;k=c[Q>>2]|0}c[I>>2]=m<<8&2147483392;k=k<<8;c[Q>>2]=k;c[K>>2]=(c[K>>2]|0)+8}}while(0);o=c[r+8>>2]|0;m=c[t>>2]|0;g:do if((m|0)>0){m=30468+(d[31076+m>>0]|0)|0;n=k>>>8;if((o|0)>0){q=d[m+(o+-1)>>0]|0;k=k-(_(n,q)|0)|0;c[I>>2]=(c[I>>2]|0)+k;k=_(n,q-(d[m+o>>0]|0)|0)|0}else k=k-(_(n,d[m+o>>0]|0)|0)|0;c[Q>>2]=k;while(1){if(k>>>0>=8388609)break g;m=c[I>>2]|0;o=m>>>23;if((o|0)==255)c[J>>2]=(c[J>>2]|0)+1;else{n=m>>>31;k=c[L>>2]|0;if((k|0)>-1){m=c[M>>2]|0;if((m+(c[N>>2]|0)|0)>>>0<(c[O>>2]|0)>>>0){c[M>>2]=m+1;a[(c[b>>2]|0)+m>>0]=k+n;k=0}else k=-1;c[P>>2]=c[P>>2]|k}k=c[J>>2]|0;if(k|0){n=n+255&255;do{m=c[M>>2]|0;if((m+(c[N>>2]|0)|0)>>>0<(c[O>>2]|0)>>>0){c[M>>2]=m+1;a[(c[b>>2]|0)+m>>0]=n;m=0;k=c[J>>2]|0}else m=-1;c[P>>2]=c[P>>2]|m;k=k+-1|0;c[J>>2]=k}while((k|0)!=0)}c[L>>2]=o&255;m=c[I>>2]|0;k=c[Q>>2]|0}c[I>>2]=m<<8&2147483392;k=k<<8;c[Q>>2]=k;c[K>>2]=(c[K>>2]|0)+8}}while(0);p=c[u>>2]|0;m=c[v>>2]|0;h:do if((m|0)>0){m=30620+(d[31076+m>>0]|0)|0;n=k>>>8;if((p|0)>0){q=d[m+(p+-1)>>0]|0;k=k-(_(n,q)|0)|0;c[I>>2]=(c[I>>2]|0)+k;k=_(n,q-(d[m+p>>0]|0)|0)|0}else k=k-(_(n,d[m+p>>0]|0)|0)|0;c[Q>>2]=k;while(1){if(k>>>0>=8388609)break h;m=c[I>>2]|0;o=m>>>23;if((o|0)==255)c[J>>2]=(c[J>>2]|0)+1;else{n=m>>>31;k=c[L>>2]|0;if((k|0)>-1){m=c[M>>2]|0;if((m+(c[N>>2]|0)|0)>>>0<(c[O>>2]|0)>>>0){c[M>>2]=m+1;a[(c[b>>2]|0)+m>>0]=k+n;k=0}else k=-1;c[P>>2]=c[P>>2]|k}k=c[J>>2]|0;if(k|0){n=n+255&255;do{m=c[M>>2]|0;if((m+(c[N>>2]|0)|0)>>>0<(c[O>>2]|0)>>>0){c[M>>2]=m+1;a[(c[b>>2]|0)+m>>0]=n;m=0;k=c[J>>2]|0}else m=-1;c[P>>2]=c[P>>2]|m;k=k+-1|0;c[J>>2]=k}while((k|0)!=0)}c[L>>2]=o&255;m=c[I>>2]|0;k=c[Q>>2]|0}c[I>>2]=m<<8&2147483392;k=k<<8;c[Q>>2]=k;c[K>>2]=(c[K>>2]|0)+8}}while(0);o=c[r+16>>2]|0;i:do if((p|0)>0){m=30468+(d[31076+p>>0]|0)|0;n=k>>>8;if((o|0)>0){q=d[m+(o+-1)>>0]|0;k=k-(_(n,q)|0)|0;c[I>>2]=(c[I>>2]|0)+k;k=_(n,q-(d[m+o>>0]|0)|0)|0}else k=k-(_(n,d[m+o>>0]|0)|0)|0;c[Q>>2]=k;while(1){if(k>>>0>=8388609)break i;m=c[I>>2]|0;o=m>>>23;if((o|0)==255)c[J>>2]=(c[J>>2]|0)+1;else{n=m>>>31;k=c[L>>2]|0;if((k|0)>-1){m=c[M>>2]|0;if((m+(c[N>>2]|0)|0)>>>0<(c[O>>2]|0)>>>0){c[M>>2]=m+1;a[(c[b>>2]|0)+m>>0]=k+n;k=0}else k=-1;c[P>>2]=c[P>>2]|k}k=c[J>>2]|0;if(k|0){n=n+255&255;do{m=c[M>>2]|0;if((m+(c[N>>2]|0)|0)>>>0<(c[O>>2]|0)>>>0){c[M>>2]=m+1;a[(c[b>>2]|0)+m>>0]=n;m=0;k=c[J>>2]|0}else m=-1;c[P>>2]=c[P>>2]|m;k=k+-1|0;c[J>>2]=k}while((k|0)!=0)}c[L>>2]=o&255;m=c[I>>2]|0;k=c[Q>>2]|0}c[I>>2]=m<<8&2147483392;k=k<<8;c[Q>>2]=k;c[K>>2]=(c[K>>2]|0)+8}}while(0);o=c[r+24>>2]|0;m=c[w>>2]|0;j:do if((m|0)>0){m=30468+(d[31076+m>>0]|0)|0;n=k>>>8;if((o|0)>0){q=d[m+(o+-1)>>0]|0;k=k-(_(n,q)|0)|0;c[I>>2]=(c[I>>2]|0)+k;k=_(n,q-(d[m+o>>0]|0)|0)|0}else k=k-(_(n,d[m+o>>0]|0)|0)|0;c[Q>>2]=k;while(1){if(k>>>0>=8388609)break j;m=c[I>>2]|0;o=m>>>23;if((o|0)==255)c[J>>2]=(c[J>>2]|0)+1;else{n=m>>>31;k=c[L>>2]|0;if((k|0)>-1){m=c[M>>2]|0;if((m+(c[N>>2]|0)|0)>>>0<(c[O>>2]|0)>>>0){c[M>>2]=m+1;a[(c[b>>2]|0)+m>>0]=k+n;k=0}else k=-1;c[P>>2]=c[P>>2]|k}k=c[J>>2]|0;if(k|0){n=n+255&255;do{m=c[M>>2]|0;if((m+(c[N>>2]|0)|0)>>>0<(c[O>>2]|0)>>>0){c[M>>2]=m+1;a[(c[b>>2]|0)+m>>0]=n;m=0;k=c[J>>2]|0}else m=-1;c[P>>2]=c[P>>2]|m;k=k+-1|0;c[J>>2]=k}while((k|0)!=0)}c[L>>2]=o&255;m=c[I>>2]|0;k=c[Q>>2]|0}c[I>>2]=m<<8&2147483392;k=k<<8;c[Q>>2]=k;c[K>>2]=(c[K>>2]|0)+8}}while(0);p=c[x>>2]|0;m=c[y>>2]|0;k:do if((m|0)>0){m=30772+(d[31076+m>>0]|0)|0;n=k>>>8;if((p|0)>0){q=d[m+(p+-1)>>0]|0;k=k-(_(n,q)|0)|0;c[I>>2]=(c[I>>2]|0)+k;k=_(n,q-(d[m+p>>0]|0)|0)|0}else k=k-(_(n,d[m+p>>0]|0)|0)|0;c[Q>>2]=k;while(1){if(k>>>0>=8388609)break k;m=c[I>>2]|0;o=m>>>23;if((o|0)==255)c[J>>2]=(c[J>>2]|0)+1;else{n=m>>>31;k=c[L>>2]|0;if((k|0)>-1){m=c[M>>2]|0;if((m+(c[N>>2]|0)|0)>>>0<(c[O>>2]|0)>>>0){c[M>>2]=m+1;a[(c[b>>2]|0)+m>>0]=k+n;k=0}else k=-1;c[P>>2]=c[P>>2]|k}k=c[J>>2]|0;if(k|0){n=n+255&255;do{m=c[M>>2]|0;if((m+(c[N>>2]|0)|0)>>>0<(c[O>>2]|0)>>>0){c[M>>2]=m+1;a[(c[b>>2]|0)+m>>0]=n;m=0;k=c[J>>2]|0}else m=-1;c[P>>2]=c[P>>2]|m;k=k+-1|0;c[J>>2]=k}while((k|0)!=0)}c[L>>2]=o&255;m=c[I>>2]|0;k=c[Q>>2]|0}c[I>>2]=m<<8&2147483392;k=k<<8;c[Q>>2]=k;c[K>>2]=(c[K>>2]|0)+8}}while(0);q=c[z>>2]|0;l:do if((p|0)>0){m=30620+(d[31076+p>>0]|0)|0;n=k>>>8;if((q|0)>0){p=d[m+(q+-1)>>0]|0;k=k-(_(n,p)|0)|0;c[I>>2]=(c[I>>2]|0)+k;k=_(n,p-(d[m+q>>0]|0)|0)|0}else k=k-(_(n,d[m+q>>0]|0)|0)|0;c[Q>>2]=k;while(1){if(k>>>0>=8388609)break l;m=c[I>>2]|0;o=m>>>23;if((o|0)==255)c[J>>2]=(c[J>>2]|0)+1;else{n=m>>>31;k=c[L>>2]|0;if((k|0)>-1){m=c[M>>2]|0;if((m+(c[N>>2]|0)|0)>>>0<(c[O>>2]|0)>>>0){c[M>>2]=m+1;a[(c[b>>2]|0)+m>>0]=k+n;k=0}else k=-1;c[P>>2]=c[P>>2]|k}k=c[J>>2]|0;if(k|0){n=n+255&255;do{m=c[M>>2]|0;if((m+(c[N>>2]|0)|0)>>>0<(c[O>>2]|0)>>>0){c[M>>2]=m+1;a[(c[b>>2]|0)+m>>0]=n;m=0;k=c[J>>2]|0}else m=-1;c[P>>2]=c[P>>2]|m;k=k+-1|0;c[J>>2]=k}while((k|0)!=0)}c[L>>2]=o&255;m=c[I>>2]|0;k=c[Q>>2]|0}c[I>>2]=m<<8&2147483392;k=k<<8;c[Q>>2]=k;c[K>>2]=(c[K>>2]|0)+8}}while(0);o=c[r+32>>2]|0;m:do if((q|0)>0){m=30468+(d[31076+q>>0]|0)|0;n=k>>>8;if((o|0)>0){q=d[m+(o+-1)>>0]|0;k=k-(_(n,q)|0)|0;c[I>>2]=(c[I>>2]|0)+k;k=_(n,q-(d[m+o>>0]|0)|0)|0}else k=k-(_(n,d[m+o>>0]|0)|0)|0;c[Q>>2]=k;while(1){if(k>>>0>=8388609)break m;m=c[I>>2]|0;o=m>>>23;if((o|0)==255)c[J>>2]=(c[J>>2]|0)+1;else{n=m>>>31;k=c[L>>2]|0;if((k|0)>-1){m=c[M>>2]|0;if((m+(c[N>>2]|0)|0)>>>0<(c[O>>2]|0)>>>0){c[M>>2]=m+1;a[(c[b>>2]|0)+m>>0]=k+n;k=0}else k=-1;c[P>>2]=c[P>>2]|k}k=c[J>>2]|0;if(k|0){n=n+255&255;do{m=c[M>>2]|0;if((m+(c[N>>2]|0)|0)>>>0<(c[O>>2]|0)>>>0){c[M>>2]=m+1;a[(c[b>>2]|0)+m>>0]=n;m=0;k=c[J>>2]|0}else m=-1;c[P>>2]=c[P>>2]|m;k=k+-1|0;c[J>>2]=k}while((k|0)!=0)}c[L>>2]=o&255;m=c[I>>2]|0;k=c[Q>>2]|0}c[I>>2]=m<<8&2147483392;k=k<<8;c[Q>>2]=k;c[K>>2]=(c[K>>2]|0)+8}}while(0);o=c[r+40>>2]|0;m=c[A>>2]|0;n:do if((m|0)>0){m=30468+(d[31076+m>>0]|0)|0;n=k>>>8;if((o|0)>0){q=d[m+(o+-1)>>0]|0;k=k-(_(n,q)|0)|0;c[I>>2]=(c[I>>2]|0)+k;k=_(n,q-(d[m+o>>0]|0)|0)|0}else k=k-(_(n,d[m+o>>0]|0)|0)|0;c[Q>>2]=k;while(1){if(k>>>0>=8388609)break n;m=c[I>>2]|0;o=m>>>23;if((o|0)==255)c[J>>2]=(c[J>>2]|0)+1;else{n=m>>>31;k=c[L>>2]|0;if((k|0)>-1){m=c[M>>2]|0;if((m+(c[N>>2]|0)|0)>>>0<(c[O>>2]|0)>>>0){c[M>>2]=m+1;a[(c[b>>2]|0)+m>>0]=k+n;k=0}else k=-1;c[P>>2]=c[P>>2]|k}k=c[J>>2]|0;if(k|0){n=n+255&255;do{m=c[M>>2]|0;if((m+(c[N>>2]|0)|0)>>>0<(c[O>>2]|0)>>>0){c[M>>2]=m+1;a[(c[b>>2]|0)+m>>0]=n;m=0;k=c[J>>2]|0}else m=-1;c[P>>2]=c[P>>2]|m;k=k+-1|0;c[J>>2]=k}while((k|0)!=0)}c[L>>2]=o&255;m=c[I>>2]|0;k=c[Q>>2]|0}c[I>>2]=m<<8&2147483392;k=k<<8;c[Q>>2]=k;c[K>>2]=(c[K>>2]|0)+8}}while(0);p=c[B>>2]|0;m=c[C>>2]|0;o:do if((m|0)>0){m=30620+(d[31076+m>>0]|0)|0;n=k>>>8;if((p|0)>0){q=d[m+(p+-1)>>0]|0;k=k-(_(n,q)|0)|0;c[I>>2]=(c[I>>2]|0)+k;k=_(n,q-(d[m+p>>0]|0)|0)|0}else k=k-(_(n,d[m+p>>0]|0)|0)|0;c[Q>>2]=k;while(1){if(k>>>0>=8388609)break o;m=c[I>>2]|0;o=m>>>23;if((o|0)==255)c[J>>2]=(c[J>>2]|0)+1;else{n=m>>>31;k=c[L>>2]|0;if((k|0)>-1){m=c[M>>2]|0;if((m+(c[N>>2]|0)|0)>>>0<(c[O>>2]|0)>>>0){c[M>>2]=m+1;a[(c[b>>2]|0)+m>>0]=k+n;k=0}else k=-1;c[P>>2]=c[P>>2]|k}k=c[J>>2]|0;if(k|0){n=n+255&255;do{m=c[M>>2]|0;if((m+(c[N>>2]|0)|0)>>>0<(c[O>>2]|0)>>>0){c[M>>2]=m+1;a[(c[b>>2]|0)+m>>0]=n;m=0;k=c[J>>2]|0}else m=-1;c[P>>2]=c[P>>2]|m;k=k+-1|0;c[J>>2]=k}while((k|0)!=0)}c[L>>2]=o&255;m=c[I>>2]|0;k=c[Q>>2]|0}c[I>>2]=m<<8&2147483392;k=k<<8;c[Q>>2]=k;c[K>>2]=(c[K>>2]|0)+8}}while(0);o=c[r+48>>2]|0;p:do if((p|0)>0){m=30468+(d[31076+p>>0]|0)|0;n=k>>>8;if((o|0)>0){q=d[m+(o+-1)>>0]|0;k=k-(_(n,q)|0)|0;c[I>>2]=(c[I>>2]|0)+k;k=_(n,q-(d[m+o>>0]|0)|0)|0}else k=k-(_(n,d[m+o>>0]|0)|0)|0;c[Q>>2]=k;while(1){if(k>>>0>=8388609)break p;m=c[I>>2]|0;o=m>>>23;if((o|0)==255)c[J>>2]=(c[J>>2]|0)+1;else{n=m>>>31;k=c[L>>2]|0;if((k|0)>-1){m=c[M>>2]|0;if((m+(c[N>>2]|0)|0)>>>0<(c[O>>2]|0)>>>0){c[M>>2]=m+1;a[(c[b>>2]|0)+m>>0]=k+n;k=0}else k=-1;c[P>>2]=c[P>>2]|k}k=c[J>>2]|0;if(k|0){n=n+255&255;do{m=c[M>>2]|0;if((m+(c[N>>2]|0)|0)>>>0<(c[O>>2]|0)>>>0){c[M>>2]=m+1;a[(c[b>>2]|0)+m>>0]=n;m=0;k=c[J>>2]|0}else m=-1;c[P>>2]=c[P>>2]|m;k=k+-1|0;c[J>>2]=k}while((k|0)!=0)}c[L>>2]=o&255;m=c[I>>2]|0;k=c[Q>>2]|0}c[I>>2]=m<<8&2147483392;k=k<<8;c[Q>>2]=k;c[K>>2]=(c[K>>2]|0)+8}}while(0);o=c[r+56>>2]|0;m=c[D>>2]|0;q:do if((m|0)>0){m=30468+(d[31076+m>>0]|0)|0;n=k>>>8;if((o|0)>0){r=d[m+(o+-1)>>0]|0;k=k-(_(n,r)|0)|0;c[I>>2]=(c[I>>2]|0)+k;k=_(n,r-(d[m+o>>0]|0)|0)|0}else k=k-(_(n,d[m+o>>0]|0)|0)|0;c[Q>>2]=k;while(1){if(k>>>0>=8388609)break q;m=c[I>>2]|0;o=m>>>23;if((o|0)==255)c[J>>2]=(c[J>>2]|0)+1;else{n=m>>>31;k=c[L>>2]|0;if((k|0)>-1){m=c[M>>2]|0;if((m+(c[N>>2]|0)|0)>>>0<(c[O>>2]|0)>>>0){c[M>>2]=m+1;a[(c[b>>2]|0)+m>>0]=k+n;k=0}else k=-1;c[P>>2]=c[P>>2]|k}k=c[J>>2]|0;if(k|0){n=n+255&255;do{m=c[M>>2]|0;if((m+(c[N>>2]|0)|0)>>>0<(c[O>>2]|0)>>>0){c[M>>2]=m+1;a[(c[b>>2]|0)+m>>0]=n;m=0;k=c[J>>2]|0}else m=-1;c[P>>2]=c[P>>2]|m;k=k+-1|0;c[J>>2]=k}while((k|0)!=0)}c[L>>2]=o&255;m=c[I>>2]|0;k=c[Q>>2]|0}c[I>>2]=m<<8&2147483392;k=k<<8;c[Q>>2]=k;c[K>>2]=(c[K>>2]|0)+8}}while(0)}s=s+1|0}while(1){if((t|0)>=(j|0))break;r=c[H+(t<<2)>>2]|0;r:do if((r|0)>0){s=g+(t<<4)|0;q=0;while(1){if((q|0)==16)break r;l=a[s+q>>0]|0;p=l<<24>>24;p=(l<<24>>24>0?p:0-p|0)<<24>>24;l=r;s:while(1){o=l+-1|0;if((l|0)<=1)break;l=p>>>o&1;m=k>>>8;n=a[29928+l>>0]|0;if(!l)k=k-(_(m,n&255)|0)|0;else{G=d[29928+(l+-1)>>0]|0;k=k-(_(m,G)|0)|0;c[I>>2]=(c[I>>2]|0)+k;k=_(m,G-(n&255)|0)|0}c[Q>>2]=k;while(1){if(k>>>0>=8388609){l=o;continue s}l=c[I>>2]|0;n=l>>>23;if((n|0)==255)c[J>>2]=(c[J>>2]|0)+1;else{m=l>>>31;k=c[L>>2]|0;if((k|0)>-1){l=c[M>>2]|0;if((l+(c[N>>2]|0)|0)>>>0<(c[O>>2]|0)>>>0){c[M>>2]=l+1;a[(c[b>>2]|0)+l>>0]=k+m;k=0}else k=-1;c[P>>2]=c[P>>2]|k}k=c[J>>2]|0;if(k|0){m=m+255&255;do{l=c[M>>2]|0;if((l+(c[N>>2]|0)|0)>>>0<(c[O>>2]|0)>>>0){c[M>>2]=l+1;a[(c[b>>2]|0)+l>>0]=m;l=0;k=c[J>>2]|0}else l=-1;c[P>>2]=c[P>>2]|l;k=k+-1|0;c[J>>2]=k}while((k|0)!=0)}c[L>>2]=n&255;l=c[I>>2]|0;k=c[Q>>2]|0}c[I>>2]=l<<8&2147483392;k=k<<8;c[Q>>2]=k;c[K>>2]=(c[K>>2]|0)+8}}l=p&1;m=k>>>8;n=a[29928+l>>0]|0;if(!l)k=k-(_(m,n&255)|0)|0;else{G=d[29928+(l+-1)>>0]|0;k=k-(_(m,G)|0)|0;c[I>>2]=(c[I>>2]|0)+k;k=_(m,G-(n&255)|0)|0}c[Q>>2]=k;while(1){if(k>>>0>=8388609)break;l=c[I>>2]|0;n=l>>>23;if((n|0)==255)c[J>>2]=(c[J>>2]|0)+1;else{m=l>>>31;k=c[L>>2]|0;if((k|0)>-1){l=c[M>>2]|0;if((l+(c[N>>2]|0)|0)>>>0<(c[O>>2]|0)>>>0){c[M>>2]=l+1;a[(c[b>>2]|0)+l>>0]=k+m;k=0}else k=-1;c[P>>2]=c[P>>2]|k}k=c[J>>2]|0;if(k|0){m=m+255&255;do{l=c[M>>2]|0;if((l+(c[N>>2]|0)|0)>>>0<(c[O>>2]|0)>>>0){c[M>>2]=l+1;a[(c[b>>2]|0)+l>>0]=m;l=0;k=c[J>>2]|0}else l=-1;c[P>>2]=c[P>>2]|l;k=k+-1|0;c[J>>2]=k}while((k|0)!=0)}c[L>>2]=n&255;l=c[I>>2]|0;k=c[Q>>2]|0}c[I>>2]=l<<8&2147483392;k=k<<8;c[Q>>2]=k;c[K>>2]=(c[K>>2]|0)+8}q=q+1|0}}while(0);t=t+1|0}a[S+1>>0]=0;r=31093+(((e<<1)+f<<16>>16)*7|0)|0;q=h+8>>4;j=k;p=0;o=g;while(1){if((p|0)>=(q|0))break;k=c[R+(p<<2)>>2]|0;t:do if((k|0)>0){a[S>>0]=a[r+((k&30)>>>0<6?k&31:6)>>0]|0;n=0;while(1){if((n|0)==16)break t;k=a[o+n>>0]|0;u:do if(k<<24>>24){k=k<<24>>24>>15;l=k+1|0;m=j>>>8;if((k|0)>-1){g=d[S+k>>0]|0;j=j-(_(m,g)|0)|0;c[I>>2]=(c[I>>2]|0)+j;j=_(m,g-(d[S+l>>0]|0)|0)|0}else j=j-(_(m,d[S+l>>0]|0)|0)|0;c[Q>>2]=j;while(1){if(j>>>0>=8388609)break u;k=c[I>>2]|0;m=k>>>23;if((m|0)==255)c[J>>2]=(c[J>>2]|0)+1;else{l=k>>>31;j=c[L>>2]|0;if((j|0)>-1){k=c[M>>2]|0;if((k+(c[N>>2]|0)|0)>>>0<(c[O>>2]|0)>>>0){c[M>>2]=k+1;a[(c[b>>2]|0)+k>>0]=j+l;j=0}else j=-1;c[P>>2]=c[P>>2]|j}j=c[J>>2]|0;if(j|0){l=l+255&255;do{k=c[M>>2]|0;if((k+(c[N>>2]|0)|0)>>>0<(c[O>>2]|0)>>>0){c[M>>2]=k+1;a[(c[b>>2]|0)+k>>0]=l;k=0;j=c[J>>2]|0}else k=-1;c[P>>2]=c[P>>2]|k;j=j+-1|0;c[J>>2]=j}while((j|0)!=0)}c[L>>2]=m&255;k=c[I>>2]|0;j=c[Q>>2]|0}c[I>>2]=k<<8&2147483392;j=j<<8;c[Q>>2]=j;c[K>>2]=(c[K>>2]|0)+8}}while(0);n=n+1|0}}while(0);p=p+1|0;o=o+16|0}i=T;return}function Cd(d,e,f,g){d=d|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,l=0;j=f+2|0;h=b[j>>1]|0;g=(_(h<<16>>16,g)|0)/2|0;i=f+20|0;g=(c[f+24>>2]|0)+g|0;f=0;while(1){if((f|0)>=(h<<16>>16|0))break;l=a[g>>0]|0;k=l&255;b[d+(f<<1)>>1]=(k>>>1&7)*9;a[e+f>>0]=a[(c[i>>2]|0)+(f+((b[j>>1]|0)+-1&0-(k&1)))>>0]|0;h=f|1;b[d+(h<<1)>>1]=((l&255)>>>5&255)*9;a[e+h>>0]=a[(c[i>>2]|0)+(f+((b[j>>1]|0)+-1&0-(k>>>4&1))+1)>>0]|0;h=b[j>>1]|0;g=g+1|0;f=f+2|0}return}function Dd(d,f,g,h,j,k,l,m,n,o,p){d=d|0;f=f|0;g=g|0;h=h|0;j=j|0;k=k|0;l=l|0;m=m|0;n=n|0;o=o|0;p=p|0;var q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0;D=i;i=i+16|0;A=D+8|0;w=D+4|0;v=D;B=f+-4|0;q=p+2|0;C=i;i=i+((1*(q<<1)|0)+15&-16)|0;r=0;while(1){if((r|0)>=(q|0))break;y=r+-2|0;u=b[f+(y<<1)>>1]|0;y=b[g+(y<<1)>>1]|0;x=u+y|0;y=u-y|0;b[B+(r<<1)>>1]=(x>>>1)+(x&1);y=(y>>1)+(y&1)|0;b[C+(r<<1)>>1]=(y|0)>32767?32767:((y|0)<-32768?-32768:y)&65535;r=r+1|0}u=d+4|0;s=e[u>>1]|e[u+2>>1]<<16;b[B>>1]=s;b[B+2>>1]=s>>>16;s=d+8|0;r=e[s>>1]|e[s+2>>1]<<16;c[C>>2]=r;q=B+(p<<1)|0;q=e[q>>1]|e[q+2>>1]<<16;b[u>>1]=q;b[u+2>>1]=q>>>16;u=C+(p<<1)|0;u=e[u>>1]|e[u+2>>1]<<16;b[s>>1]=u;b[s+2>>1]=u>>>16;s=i;i=i+((1*(p<<1)|0)+15&-16)|0;u=i;i=i+((1*(p<<1)|0)+15&-16)|0;q=0;while(1){if((q|0)>=(p|0))break;y=q+1|0;t=b[B+(y<<1)>>1]|0;x=((b[B+(q<<1)>>1]|0)+(b[B+(q+2<<1)>>1]|0)+(t<<16>>16<<1)>>1)+1>>1;b[s+(q<<1)>>1]=x;b[u+(q<<1)>>1]=(t&65535)-x;q=y}f=i;i=i+((1*(p<<1)|0)+15&-16)|0;t=i;i=i+((1*(p<<1)|0)+15&-16)|0;q=r&65535;r=0;while(1){if((r|0)>=(p|0))break;y=r+1|0;x=b[C+(y<<1)>>1]|0;E=((q<<16>>16)+(b[C+(r+2<<1)>>1]|0)+(x<<16>>16<<1)>>1)+1>>1;b[f+(r<<1)>>1]=E;b[t+(r<<1)>>1]=(x&65535)-E;q=x;r=y}q=(o*10|0)==(p|0);x=q?328:655;m=m<<16>>16;m=_(m,m)|0;m=(_(m>>>16,x)|0)+((_(m&65535,x)|0)>>>16)|0;x=Nd(w,s,f,d+12|0,p,m)|0;c[A>>2]=x;t=Nd(v,u,t,d+20|0,p,m)|0;y=A+4|0;c[y>>2]=t;s=(c[v>>2]|0)+((c[w>>2]<<16>>16)*3|0)|0;s=(s|0)<65536?s:65536;u=l-(q?1200:600)|0;u=(u|0)<1?1:u;f=((o<<16>>16)*900|0)+2e3|0;q=s*3|0;r=Ed(u,q+851968|0,19)|0;c[k>>2]=r;if((r|0)<(f|0)){c[k>>2]=f;l=u-f|0;c[k+4>>2]=l;E=f<<16>>16;q=Ed((l<<1)-f|0,(_(q+65536>>16,E)|0)+((_(q&65535,E)|0)>>16)|0,16)|0;if((q|0)>16384)q=16384;else q=(q|0)<0?0:q}else{c[k+4>>2]=u-r;q=16384}r=d+28|0;w=b[r>>1]|0;l=w&65535;E=m<<16>>16;b[r>>1]=l+((_(q-(w<<16>>16)>>16,E)|0)+((_(q-l&65535,E)|0)>>>16));a[j>>0]=0;a:do if(!n){do if(!(b[d+30>>1]|0)){if((u<<3|0)>=(f*13|0)){q=c[r>>2]|0;E=q<<16>>16;if(((_(s>>16,E)|0)+((_(s&65535,E)|0)>>16)|0)<819)q=q&65535;else{if((q>>>16&65535)<<16>>16){z=23;break}q=b[r>>1]|0;break}}else q=b[r>>1]|0;c[A>>2]=(_(q<<16>>16,x<<16>>16)|0)>>14;c[y>>2]=(_(q<<16>>16,t<<16>>16)|0)>>14;Pd(A,h);c[A>>2]=0;c[y>>2]=0;c[k>>2]=u;c[k+4>>2]=0;a[j>>0]=1;r=0;z=31;break a}else z=23;while(0);do if((z|0)==23){if((u<<3|0)>=(f*11|0)){q=b[r>>1]|0;E=q<<16>>16;if(((_(s>>16,E)|0)+((_(s&65535,E)|0)>>16)|0)>=328)break}else q=b[r>>1]|0;q=q<<16>>16;c[A>>2]=(_(q,x<<16>>16)|0)>>14;c[y>>2]=(_(q,t<<16>>16)|0)>>14;Pd(A,h);c[A>>2]=0;c[y>>2]=0;q=0;z=30;break a}while(0);if(q<<16>>16>15565){Pd(A,h);q=16384;z=30;break}else{q=q<<16>>16;c[A>>2]=(_(q,x<<16>>16)|0)>>14;c[y>>2]=(_(q,t<<16>>16)|0)>>14;Pd(A,h);q=b[r>>1]|0;z=30;break}}else{c[A>>2]=0;c[y>>2]=0;Pd(A,h);q=0;z=30}while(0);if((z|0)==30)if((a[j>>0]|0)==1){r=q;z=31}else{b[d+32>>1]=0;z=35}do if((z|0)==31){q=d+32|0;E=(e[q>>1]|0)+(p-(o<<3))|0;b[q>>1]=E;if((E<<16>>16|0)<(o*5|0)){a[j>>0]=0;z=36;break}else{b[q>>1]=1e4;q=r;z=35;break}}while(0);if((z|0)==35)if(!(a[j>>0]|0)){r=q;z=36}if((z|0)==36){q=k+4|0;if((c[q>>2]|0)<1){c[q>>2]=1;c[k>>2]=(u|0)<2?1:u+-1|0;q=r}else q=r}m=c[d>>2]|0;n=d+30|0;t=b[n>>1]|0;v=t<<16>>16;r=o<<3;x=c[A>>2]|0;s=(65536/(r|0)|0)<<16>>16;w=((_(x-m<<16>>16,s)|0)>>15)+1>>1;l=c[y>>2]|0;f=((_(l-(m>>>16)<<16>>16,s)|0)>>15)+1>>1;s=(_(q-v>>16,s)|0)+((_(q-(t&65535)&65535,s)|0)>>16)<<10;t=0;u=0-(m<<16>>16)|0;m=0-(m>>16)|0;v=v<<10;while(1){if((t|0)>=(r|0))break;o=u-w|0;A=m-f|0;E=v+s|0;k=t+1|0;z=b[B+(k<<1)>>1]|0;y=(b[B+(t<<1)>>1]|0)+(b[B+(t+2<<1)>>1]|0)+(z<<1)|0;F=b[C+(k<<1)>>1]|0;h=o<<16>>16;j=A<<16>>16;j=((_(E>>16,F)|0)+((_(E&64512,F)|0)>>16)+((_(y>>7,h)|0)+((_(y<<9&65024,h)|0)>>16))+((_(z>>5,j)|0)+((_(z<<11&63488,j)|0)>>16))>>7)+1>>1;b[g+(t+-1<<1)>>1]=(j|0)>32767?32767:((j|0)<-32768?-32768:j)&65535;t=k;u=o;m=A;v=E}f=d+2|0;s=q>>6;t=q<<10&64512;u=0-x<<16>>16;m=0-l<<16>>16;while(1){if((r|0)>=(p|0))break;F=r+1|0;E=b[B+(F<<1)>>1]|0;A=(b[B+(r<<1)>>1]|0)+(b[B+(r+2<<1)>>1]|0)+(E<<1)|0;o=b[C+(F<<1)>>1]|0;E=((_(s,o)|0)+((_(t,o)|0)>>16)+((_(A>>7,u)|0)+((_(A<<9&65024,u)|0)>>16))+((_(E>>5,m)|0)+((_(E<<11&63488,m)|0)>>16))>>7)+1>>1;b[g+(r+-1<<1)>>1]=(E|0)>32767?32767:((E|0)<-32768?-32768:E)&65535;r=F}b[d>>1]=x;b[f>>1]=l;b[n>>1]=q;i=D;return}function Ed(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,f=0,g=0;if((a|0)<=0)if(!a)e=32;else{d=0-a|0;f=3}else{d=a;f=3}if((f|0)==3)e=aa(d|0)|0;a=a<>16|0)|0)<<16>>16;g=(_(a>>16,b)|0)+((_(a&65535,b)|0)>>16)|0;f=zf(f|0,((f|0)<0)<<31>>31|0,g|0,((g|0)<0)<<31>>31|0)|0;f=qf(f|0,C|0,29)|0;f=a-(f&-8)|0;b=g+((_(f>>16,b)|0)+((_(f&65535,b)|0)>>16))|0;d=e+28-d-c|0;if((d|0)>=0)return ((d|0)<32?b>>d:0)|0;d=0-d|0;a=-2147483648>>d;e=2147483647>>>d;if((a|0)>(e|0)){if((b|0)>(a|0)){g=a;g=g<(e|0)){g=e;g=g<>2]=b;c[a+8>>2]=193536;c[a+12>>2]=193536;c[a+4756>>2]=1;b=a+32|0;d=b+112|0;do{c[b>>2]=0;b=b+4|0}while((b|0)<(d|0));b=0;while(1){if((b|0)==4){b=0;break}d=b+1|0;e=50/(d|0)|0;c[a+124+(b<<2)>>2]=(e|0)>1?e:1;b=d}while(1){if((b|0)==4)break;e=(c[a+124+(b<<2)>>2]|0)*100|0;c[a+92+(b<<2)>>2]=e;c[a+108+(b<<2)>>2]=2147483647/(e|0)|0;b=b+1|0}c[a+140>>2]=15;b=0;while(1){if((b|0)==4)break;c[a+72+(b<<2)>>2]=25600;b=b+1|0}return 0}function Gd(a,d){a=a|0;d=d|0;var e=0,f=0,h=0,j=0.0,l=0,m=0.0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0;u=i;i=i+304|0;r=u;p=a+4668|0;f=c[p>>2]|0;if((f|0)==(d|0)?(e=a+4648|0,(c[a+4652>>2]|0)==(c[e>>2]|0)):0){s=e;t=0;s=c[s>>2]|0;a=a+4652|0;c[a>>2]=s;i=u;return t|0}if(!f){t=a+4648|0;s=t;t=Hd(a+5868|0,c[t>>2]|0,d*1e3|0,1)|0;s=c[s>>2]|0;a=a+4652|0;c[a>>2]=s;i=u;return t|0}q=((c[a+4672>>2]|0)*10|0)+5|0;o=_(q,f)|0;f=_(q,d)|0;s=Fa()|0;t=i;i=i+((1*(((o|0)>(f|0)?o:f)<<1)|0)+15&-16)|0;e=o;while(1){n=e+-1|0;if((e|0)<=0)break;j=+g[a+7272+(n<<2)>>2];h=(g[k>>2]=j,c[k>>2]|0);l=(h&2130706432)>>>0>1249902592;if(!l){e=(h|0)<0;m=e?j+-8388608.0+8388608.0:j+8388608.0+-8388608.0;if(m==0.0)m=e?-0.0:0.0}else m=j;if((~~m|0)<=32767){if(!l){e=(h|0)<0;m=e?j+-8388608.0+8388608.0:j+8388608.0+-8388608.0;if(m==0.0)m=e?-0.0:0.0}else m=j;if((~~m|0)<-32768)e=-32768;else{if(!l){e=(h|0)<0;j=e?j+-8388608.0+8388608.0:j+8388608.0+-8388608.0;if(j==0.0)j=e?-0.0:0.0}e=~~j}}else e=32767;b[t+(n<<1)>>1]=e;e=n}n=a+4648|0;l=Hd(r,(c[p>>2]<<16>>16)*1e3|0,c[n>>2]|0,0)|0;q=_(q,(c[n>>2]|0)/1e3|0)|0;p=i;i=i+((1*(q<<1)|0)+15&-16)|0;Id(r,p,t,o);r=a+5868|0;h=Hd(r,c[n>>2]|0,(d<<16>>16)*1e3|0,1)|0;Id(r,t,p,q);while(1){e=f+-1|0;if((f|0)<=0)break;g[a+7272+(e<<2)>>2]=+(b[t+(e<<1)>>1]|0);f=e}Na(s|0);s=n;t=l+h|0;s=c[s>>2]|0;a=a+4652|0;c[a>>2]=s;i=u;return t|0}function Hd(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0;nf(b|0,0,300)|0;if(!f){a:do if((d|0)>=12e3)if((d|0)<16e3){switch(d|0){case 12e3:break a;default:f=-1}return f|0}else{switch(d|0){case 16e3:break a;default:f=-1}return f|0}else{switch(d|0){case 8e3:break a;default:f=-1}return f|0}while(0);b:do if((e|0)<16e3)if((e|0)<12e3){switch(e|0){case 8e3:break b;default:f=-1}return f|0}else{switch(e|0){case 12e3:break b;default:f=-1}return f|0}else{if((e|0)<24e3){switch(e|0){case 16e3:break b;default:f=-1}return f|0}if((e|0)<48e3){switch(e|0){case 24e3:break b;default:f=-1}return f|0}else{switch(e|0){case 48e3:break b;default:f=-1}return f|0}}while(0);c[b+292>>2]=a[((e>>12)-((e|0)>16e3&1)>>((e|0)>24e3&1))+-1+(31150+((((d>>12)-((d|0)>16e3&1)>>((d|0)>24e3&1))+-1|0)*5|0))>>0]}else{c:do if((d|0)<16e3)if((d|0)<12e3){switch(d|0){case 8e3:break c;default:f=-1}return f|0}else{switch(d|0){case 12e3:break c;default:f=-1}return f|0}else{if((d|0)<24e3){switch(d|0){case 16e3:break c;default:f=-1}return f|0}if((d|0)<48e3){switch(d|0){case 24e3:break c;default:f=-1}return f|0}else{switch(d|0){case 48e3:break c;default:f=-1}return f|0}}while(0);d:do if((e|0)>=12e3)if((e|0)<16e3){switch(e|0){case 12e3:break d;default:f=-1}return f|0}else{switch(e|0){case 16e3:break d;default:f=-1}return f|0}else{switch(e|0){case 8e3:break d;default:f=-1}return f|0}while(0);c[b+292>>2]=a[((e>>12)-((e|0)>16e3&1)>>((e|0)>24e3&1))+-1+(31135+((((d>>12)-((d|0)>16e3&1)>>((d|0)>24e3&1))+-1|0)*3|0))>>0]}i=(d|0)/1e3|0;c[b+284>>2]=i;c[b+288>>2]=(e|0)/1e3|0;c[b+268>>2]=i*10;do if((e|0)>(d|0)){f=b+264|0;if((d<<1|0)==(e|0)){c[f>>2]=1;f=0;break}else{c[f>>2]=2;f=1;break}}else{f=b+264|0;if((e|0)>=(d|0)){c[f>>2]=0;f=0;break}c[f>>2]=3;f=e<<2;if((f|0)==(d*3|0)){c[b+280>>2]=3;c[b+276>>2]=18;c[b+296>>2]=25418;f=0;break}g=e*3|0;if((g|0)==(d<<1|0)){c[b+280>>2]=2;c[b+276>>2]=18;c[b+296>>2]=25476;f=0;break}if((e<<1|0)==(d|0)){c[b+280>>2]=1;c[b+276>>2]=24;c[b+296>>2]=25516;f=0;break}if((g|0)==(d|0)){c[b+280>>2]=1;c[b+276>>2]=36;c[b+296>>2]=25544;f=0;break}if((f|0)==(d|0)){c[b+280>>2]=1;c[b+276>>2]=36;c[b+296>>2]=25584;f=0;break}if((e*6|0)==(d|0)){c[b+280>>2]=1;c[b+276>>2]=36;c[b+296>>2]=25624;f=0;break}else{d=-1;return d|0}}while(0);g=((d<<(f|14)|0)/(e|0)|0)<<2;h=b+272|0;c[h>>2]=g;i=e<<16>>16;b=(e>>15)+1>>1;f=d<>16,i)|0)+((_(g&65535,i)|0)>>16)+(_(g,b)|0)|0)>=(f|0)){f=0;break}d=g+1|0;c[h>>2]=d;g=d}return f|0}function Id(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0;f=a+284|0;h=a+292|0;i=c[h>>2]|0;g=(c[f>>2]|0)-i|0;rf(a+168+(i<<1)|0,d|0,g<<1|0)|0;switch(c[a+264>>2]|0){case 1:{i=a+168|0;Ld(a,b,i,c[f>>2]|0);Ld(a,b+(c[a+288>>2]<<1)|0,d+(g<<1)|0,e-(c[f>>2]|0)|0);f=i;break}case 2:{i=a+168|0;Kd(a,b,i,c[f>>2]|0);Kd(a,b+(c[a+288>>2]<<1)|0,d+(g<<1)|0,e-(c[f>>2]|0)|0);f=i;break}case 3:{i=a+168|0;Jd(a,b,i,c[f>>2]|0);Jd(a,b+(c[a+288>>2]<<1)|0,d+(g<<1)|0,e-(c[f>>2]|0)|0);f=i;break}default:{i=a+168|0;rf(b|0,i|0,c[f>>2]<<1|0)|0;rf(b+(c[a+288>>2]<<1)|0,d+(g<<1)|0,e-(c[f>>2]|0)<<1|0)|0;f=i}}i=c[h>>2]|0;rf(f|0,d+(e-i<<1)|0,i<<1|0)|0;return}function Jd(a,d,e,f){a=a|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0;N=i;n=a+268|0;l=c[n>>2]|0;x=a+276|0;k=c[x>>2]|0;K=i;i=i+((1*(l+k<<2)|0)+15&-16)|0;L=a+24|0;rf(K|0,L|0,k<<2|0)|0;M=a+296|0;J=c[M>>2]|0;o=J+4|0;p=c[a+272>>2]|0;q=a+4|0;r=a+280|0;s=J+6|0;t=J+8|0;u=J+10|0;v=J+12|0;w=J+14|0;y=J+16|0;z=J+18|0;A=J+20|0;B=J+22|0;C=J+24|0;D=J+26|0;E=J+28|0;F=J+30|0;G=J+32|0;H=J+34|0;I=J+36|0;J=J+38|0;m=e;e=l;while(1){l=(f|0)<(e|0)?f:e;e=K+(k<<2)|0;g=c[M>>2]|0;h=g+2|0;j=0;while(1){if((j|0)>=(l|0))break;P=(c[a>>2]|0)+(b[m+(j<<1)>>1]<<8)|0;c[e+(j<<2)>>2]=P;P=P<<2;Q=P>>16;O=b[g>>1]|0;P=P&65532;c[a>>2]=(c[q>>2]|0)+((_(Q,O)|0)+((_(P,O)|0)>>16));O=b[h>>1]|0;c[q>>2]=(_(Q,O)|0)+((_(P,O)|0)>>16);j=j+1|0}j=l<<16;e=c[r>>2]|0;a:do switch(k|0){case 18:{h=e<<16>>16;g=e+-1|0;e=0;while(1){if((e|0)>=(j|0))break a;P=K+(e>>16<<2)|0;Q=(_(e&65535,h)|0)>>16;O=o+(Q*9<<1)|0;k=c[P>>2]|0;S=b[O>>1]|0;S=(_(k>>16,S)|0)+((_(k&65535,S)|0)>>16)|0;k=c[P+4>>2]|0;R=b[O+2>>1]|0;R=S+((_(k>>16,R)|0)+((_(k&65535,R)|0)>>16))|0;k=c[P+8>>2]|0;S=b[O+4>>1]|0;S=R+((_(k>>16,S)|0)+((_(k&65535,S)|0)>>16))|0;k=c[P+12>>2]|0;R=b[O+6>>1]|0;R=S+((_(k>>16,R)|0)+((_(k&65535,R)|0)>>16))|0;k=c[P+16>>2]|0;S=b[O+8>>1]|0;S=R+((_(k>>16,S)|0)+((_(k&65535,S)|0)>>16))|0;k=c[P+20>>2]|0;R=b[O+10>>1]|0;R=S+((_(k>>16,R)|0)+((_(k&65535,R)|0)>>16))|0;k=c[P+24>>2]|0;S=b[O+12>>1]|0;S=R+((_(k>>16,S)|0)+((_(k&65535,S)|0)>>16))|0;k=c[P+28>>2]|0;R=b[O+14>>1]|0;R=S+((_(k>>16,R)|0)+((_(k&65535,R)|0)>>16))|0;k=c[P+32>>2]|0;O=b[O+16>>1]|0;O=R+((_(k>>16,O)|0)+((_(k&65535,O)|0)>>16))|0;Q=o+((g-Q|0)*9<<1)|0;k=c[P+68>>2]|0;R=b[Q>>1]|0;R=O+((_(k>>16,R)|0)+((_(k&65535,R)|0)>>16))|0;k=c[P+64>>2]|0;O=b[Q+2>>1]|0;O=R+((_(k>>16,O)|0)+((_(k&65535,O)|0)>>16))|0;k=c[P+60>>2]|0;R=b[Q+4>>1]|0;R=O+((_(k>>16,R)|0)+((_(k&65535,R)|0)>>16))|0;k=c[P+56>>2]|0;O=b[Q+6>>1]|0;O=R+((_(k>>16,O)|0)+((_(k&65535,O)|0)>>16))|0;k=c[P+52>>2]|0;R=b[Q+8>>1]|0;R=O+((_(k>>16,R)|0)+((_(k&65535,R)|0)>>16))|0;k=c[P+48>>2]|0;O=b[Q+10>>1]|0;O=R+((_(k>>16,O)|0)+((_(k&65535,O)|0)>>16))|0;k=c[P+44>>2]|0;R=b[Q+12>>1]|0;R=O+((_(k>>16,R)|0)+((_(k&65535,R)|0)>>16))|0;k=c[P+40>>2]|0;O=b[Q+14>>1]|0;O=R+((_(k>>16,O)|0)+((_(k&65535,O)|0)>>16))|0;P=c[P+36>>2]|0;Q=b[Q+16>>1]|0;Q=(O+((_(P>>16,Q)|0)+((_(P&65535,Q)|0)>>16))>>5)+1>>1;b[d>>1]=(Q|0)>32767?32767:((Q|0)<-32768?-32768:Q)&65535;d=d+2|0;e=e+p|0}}case 24:{e=0;while(1){if((e|0)>=(j|0))break a;R=K+(e>>16<<2)|0;S=(c[R>>2]|0)+(c[R+92>>2]|0)|0;Q=b[o>>1]|0;Q=(_(S>>16,Q)|0)+((_(S&65535,Q)|0)>>16)|0;S=(c[R+4>>2]|0)+(c[R+88>>2]|0)|0;P=b[s>>1]|0;P=Q+((_(S>>16,P)|0)+((_(S&65535,P)|0)>>16))|0;S=(c[R+8>>2]|0)+(c[R+84>>2]|0)|0;Q=b[t>>1]|0;Q=P+((_(S>>16,Q)|0)+((_(S&65535,Q)|0)>>16))|0;S=(c[R+12>>2]|0)+(c[R+80>>2]|0)|0;P=b[u>>1]|0;P=Q+((_(S>>16,P)|0)+((_(S&65535,P)|0)>>16))|0;S=(c[R+16>>2]|0)+(c[R+76>>2]|0)|0;Q=b[v>>1]|0;Q=P+((_(S>>16,Q)|0)+((_(S&65535,Q)|0)>>16))|0;S=(c[R+20>>2]|0)+(c[R+72>>2]|0)|0;P=b[w>>1]|0;P=Q+((_(S>>16,P)|0)+((_(S&65535,P)|0)>>16))|0;S=(c[R+24>>2]|0)+(c[R+68>>2]|0)|0;Q=b[y>>1]|0;Q=P+((_(S>>16,Q)|0)+((_(S&65535,Q)|0)>>16))|0;S=(c[R+28>>2]|0)+(c[R+64>>2]|0)|0;P=b[z>>1]|0;P=Q+((_(S>>16,P)|0)+((_(S&65535,P)|0)>>16))|0;S=(c[R+32>>2]|0)+(c[R+60>>2]|0)|0;Q=b[A>>1]|0;Q=P+((_(S>>16,Q)|0)+((_(S&65535,Q)|0)>>16))|0;S=(c[R+36>>2]|0)+(c[R+56>>2]|0)|0;P=b[B>>1]|0;P=Q+((_(S>>16,P)|0)+((_(S&65535,P)|0)>>16))|0;S=(c[R+40>>2]|0)+(c[R+52>>2]|0)|0;Q=b[C>>1]|0;Q=P+((_(S>>16,Q)|0)+((_(S&65535,Q)|0)>>16))|0;R=(c[R+44>>2]|0)+(c[R+48>>2]|0)|0;S=b[D>>1]|0;S=(Q+((_(R>>16,S)|0)+((_(R&65535,S)|0)>>16))>>5)+1>>1;b[d>>1]=(S|0)>32767?32767:((S|0)<-32768?-32768:S)&65535;d=d+2|0;e=e+p|0}}case 36:{e=0;while(1){if((e|0)>=(j|0))break a;R=K+(e>>16<<2)|0;S=(c[R>>2]|0)+(c[R+140>>2]|0)|0;Q=b[o>>1]|0;Q=(_(S>>16,Q)|0)+((_(S&65535,Q)|0)>>16)|0;S=(c[R+4>>2]|0)+(c[R+136>>2]|0)|0;P=b[s>>1]|0;P=Q+((_(S>>16,P)|0)+((_(S&65535,P)|0)>>16))|0;S=(c[R+8>>2]|0)+(c[R+132>>2]|0)|0;Q=b[t>>1]|0;Q=P+((_(S>>16,Q)|0)+((_(S&65535,Q)|0)>>16))|0;S=(c[R+12>>2]|0)+(c[R+128>>2]|0)|0;P=b[u>>1]|0;P=Q+((_(S>>16,P)|0)+((_(S&65535,P)|0)>>16))|0;S=(c[R+16>>2]|0)+(c[R+124>>2]|0)|0;Q=b[v>>1]|0;Q=P+((_(S>>16,Q)|0)+((_(S&65535,Q)|0)>>16))|0;S=(c[R+20>>2]|0)+(c[R+120>>2]|0)|0;P=b[w>>1]|0;P=Q+((_(S>>16,P)|0)+((_(S&65535,P)|0)>>16))|0;S=(c[R+24>>2]|0)+(c[R+116>>2]|0)|0;Q=b[y>>1]|0;Q=P+((_(S>>16,Q)|0)+((_(S&65535,Q)|0)>>16))|0;S=(c[R+28>>2]|0)+(c[R+112>>2]|0)|0;P=b[z>>1]|0;P=Q+((_(S>>16,P)|0)+((_(S&65535,P)|0)>>16))|0;S=(c[R+32>>2]|0)+(c[R+108>>2]|0)|0;Q=b[A>>1]|0;Q=P+((_(S>>16,Q)|0)+((_(S&65535,Q)|0)>>16))|0;S=(c[R+36>>2]|0)+(c[R+104>>2]|0)|0;P=b[B>>1]|0;P=Q+((_(S>>16,P)|0)+((_(S&65535,P)|0)>>16))|0;S=(c[R+40>>2]|0)+(c[R+100>>2]|0)|0;Q=b[C>>1]|0;Q=P+((_(S>>16,Q)|0)+((_(S&65535,Q)|0)>>16))|0;S=(c[R+44>>2]|0)+(c[R+96>>2]|0)|0;P=b[D>>1]|0;P=Q+((_(S>>16,P)|0)+((_(S&65535,P)|0)>>16))|0;S=(c[R+48>>2]|0)+(c[R+92>>2]|0)|0;Q=b[E>>1]|0;Q=P+((_(S>>16,Q)|0)+((_(S&65535,Q)|0)>>16))|0;S=(c[R+52>>2]|0)+(c[R+88>>2]|0)|0;P=b[F>>1]|0;P=Q+((_(S>>16,P)|0)+((_(S&65535,P)|0)>>16))|0;S=(c[R+56>>2]|0)+(c[R+84>>2]|0)|0;Q=b[G>>1]|0;Q=P+((_(S>>16,Q)|0)+((_(S&65535,Q)|0)>>16))|0;S=(c[R+60>>2]|0)+(c[R+80>>2]|0)|0;P=b[H>>1]|0;P=Q+((_(S>>16,P)|0)+((_(S&65535,P)|0)>>16))|0;S=(c[R+64>>2]|0)+(c[R+76>>2]|0)|0;Q=b[I>>1]|0;Q=P+((_(S>>16,Q)|0)+((_(S&65535,Q)|0)>>16))|0;R=(c[R+68>>2]|0)+(c[R+72>>2]|0)|0;S=b[J>>1]|0;S=(Q+((_(R>>16,S)|0)+((_(R&65535,S)|0)>>16))>>5)+1>>1;b[d>>1]=(S|0)>32767?32767:((S|0)<-32768?-32768:S)&65535;d=d+2|0;e=e+p|0}}default:{}}while(0);f=f-l|0;if((f|0)<=1)break;k=c[x>>2]|0;rf(K|0,K+(l<<2)|0,k<<2|0)|0;m=m+(l<<1)|0;e=c[n>>2]|0}rf(L|0,K+(l<<2)|0,c[x>>2]<<2|0)|0;i=N;return}function Kd(a,d,e,f){a=a|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0;p=i;k=a+268|0;j=c[k>>2]|0;l=i;i=i+((1*((j<<1)+8<<1)|0)+15&-16)|0;m=a+24|0;b[l>>1]=b[m>>1]|0;b[l+2>>1]=b[m+2>>1]|0;b[l+4>>1]=b[m+4>>1]|0;b[l+6>>1]=b[m+6>>1]|0;b[l+8>>1]=b[m+8>>1]|0;b[l+10>>1]=b[m+10>>1]|0;b[l+12>>1]=b[m+12>>1]|0;b[l+14>>1]=b[m+14>>1]|0;n=c[a+272>>2]|0;o=l+16|0;g=d;d=j;while(1){j=(f|0)<(d|0)?f:d;Ld(a,o,e,j);h=j<<17;d=0;while(1){if((d|0)>=(h|0))break;q=((d&65535)*12|0)>>>16;r=l+(d>>16<<1)|0;s=_(b[r>>1]|0,b[25664+(q<<3)>>1]|0)|0;s=s+(_(b[r+2>>1]|0,b[25664+(q<<3)+2>>1]|0)|0)|0;s=s+(_(b[r+4>>1]|0,b[25664+(q<<3)+4>>1]|0)|0)|0;s=s+(_(b[r+6>>1]|0,b[25664+(q<<3)+6>>1]|0)|0)|0;q=11-q|0;s=s+(_(b[r+8>>1]|0,b[25664+(q<<3)+6>>1]|0)|0)|0;s=s+(_(b[r+10>>1]|0,b[25664+(q<<3)+4>>1]|0)|0)|0;s=s+(_(b[r+12>>1]|0,b[25664+(q<<3)+2>>1]|0)|0)|0;q=(s+(_(b[r+14>>1]|0,b[25664+(q<<3)>>1]|0)|0)>>14)+1>>1;b[g>>1]=(q|0)>32767?32767:((q|0)<-32768?-32768:q)&65535;g=g+2|0;d=d+n|0}f=f-j|0;if((f|0)<=0)break;d=l+(j<<1<<1)|0;b[l>>1]=b[d>>1]|0;b[l+2>>1]=b[d+2>>1]|0;b[l+4>>1]=b[d+4>>1]|0;b[l+6>>1]=b[d+6>>1]|0;b[l+8>>1]=b[d+8>>1]|0;b[l+10>>1]=b[d+10>>1]|0;b[l+12>>1]=b[d+12>>1]|0;b[l+14>>1]=b[d+14>>1]|0;e=e+(j<<1)|0;d=c[k>>2]|0}s=l+(j<<1<<1)|0;b[m>>1]=b[s>>1]|0;b[m+2>>1]=b[s+2>>1]|0;b[m+4>>1]=b[s+4>>1]|0;b[m+6>>1]=b[s+6>>1]|0;b[m+8>>1]=b[s+8>>1]|0;b[m+10>>1]=b[s+10>>1]|0;b[m+12>>1]=b[s+12>>1]|0;b[m+14>>1]=b[s+14>>1]|0;i=p;return}function Ld(a,d,e,f){a=a|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;g=a+4|0;h=a+8|0;i=a+12|0;j=a+16|0;k=a+20|0;l=0;while(1){if((l|0)>=(f|0))break;p=b[e+(l<<1)>>1]<<10;n=c[a>>2]|0;m=p-n|0;m=((m>>16)*1746|0)+(((m&65535)*1746|0)>>>16)|0;n=n+m|0;c[a>>2]=p+m;m=c[g>>2]|0;o=n-m|0;o=((o>>16)*14986|0)+(((o&65535)*14986|0)>>>16)|0;m=m+o|0;c[g>>2]=n+o;o=m-(c[h>>2]|0)|0;n=(_(o>>16,-26453)|0)+((_(o&65535,-26453)|0)>>16)|0;c[h>>2]=m+(o+n);n=(m+n>>9)+1>>1;m=l<<1;b[d+(m<<1)>>1]=(n|0)>32767?32767:((n|0)<-32768?-32768:n)&65535;n=c[i>>2]|0;o=p-n|0;o=((o>>16)*6854|0)+(((o&65535)*6854|0)>>>16)|0;n=n+o|0;c[i>>2]=p+o;o=c[j>>2]|0;p=n-o|0;p=((p>>16)*25769|0)+(((p&65535)*25769|0)>>>16)|0;o=o+p|0;c[j>>2]=n+p;p=o-(c[k>>2]|0)|0;n=(_(p>>16,-9994)|0)+((_(p&65535,-9994)|0)>>16)|0;c[k>>2]=o+(p+n);n=(o+n>>9)+1>>1;b[d+((m|1)<<1)>>1]=(n|0)>32767?32767:((n|0)<-32768?-32768:n)&65535;l=l+1|0}return}function Md(a,e){a=a|0;e=e|0;var f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0;t=i;i=i+32|0;s=t;q=a+28|0;j=c[q>>2]|0;r=a+32|0;f=c[r>>2]|0;g=j>>>8;k=-1;while(1){k=k+1|0;h=_(g,d[29891+k>>0]|0)|0;if(f>>>0>=h>>>0)break;else j=h}l=f-h|0;c[r>>2]=l;f=j-h|0;c[q>>2]=f;m=a+20|0;n=a+40|0;o=a+24|0;p=a+4|0;j=l;while(1){if(f>>>0>=8388609)break;c[m>>2]=(c[m>>2]|0)+8;f=f<<8;c[q>>2]=f;h=c[n>>2]|0;g=c[o>>2]|0;if(g>>>0<(c[p>>2]|0)>>>0){c[o>>2]=g+1;g=d[(c[a>>2]|0)+g>>0]|0}else g=0;c[n>>2]=g;l=((h<<8|g)>>>1&255|j<<8&2147483392)^255;c[r>>2]=l;j=l}l=(k|0)/5|0;c[s+8>>2]=l;c[s+20>>2]=k+(_(l,-5)|0);l=0;while(1){if((l|0)==2){f=0;break}h=f>>>8;k=-1;while(1){k=k+1|0;g=_(h,d[29944+k>>0]|0)|0;if(j>>>0>=g>>>0)break;else f=g}j=j-g|0;c[r>>2]=j;f=f-g|0;c[q>>2]=f;while(1){if(f>>>0>=8388609)break;c[m>>2]=(c[m>>2]|0)+8;f=f<<8;c[q>>2]=f;h=c[n>>2]|0;g=c[o>>2]|0;if(g>>>0<(c[p>>2]|0)>>>0){c[o>>2]=g+1;g=d[(c[a>>2]|0)+g>>0]|0}else g=0;c[n>>2]=g;h=((h<<8|g)>>>1&255|j<<8&2147483392)^255;c[r>>2]=h;j=h}c[s+(l*12|0)>>2]=k;h=f>>>8;k=-1;while(1){k=k+1|0;g=_(h,d[29951+k>>0]|0)|0;if(j>>>0>=g>>>0)break;else f=g}j=j-g|0;c[r>>2]=j;f=f-g|0;c[q>>2]=f;while(1){if(f>>>0>=8388609)break;c[m>>2]=(c[m>>2]|0)+8;f=f<<8;c[q>>2]=f;h=c[n>>2]|0;g=c[o>>2]|0;if(g>>>0<(c[p>>2]|0)>>>0){c[o>>2]=g+1;g=d[(c[a>>2]|0)+g>>0]|0}else g=0;c[n>>2]=g;h=((h<<8|g)>>>1&255|j<<8&2147483392)^255;c[r>>2]=h;j=h}c[s+(l*12|0)+4>>2]=k;l=l+1|0}while(1){if((f|0)==2)break;r=s+(f*12|0)|0;a=(c[r>>2]|0)+((c[s+(f*12|0)+8>>2]|0)*3|0)|0;c[r>>2]=a;r=b[25372+(a<<1)>>1]|0;a=b[25372+(a+1<<1)>>1]|0;a=(_((a<<16>>16)-r>>16,429522944)|0)+(((a&65535)-r&65535)*6554|0)>>16;c[e+(f<<2)>>2]=r+(_(a,c[s+(f*12|0)+4>>2]<<17>>16|1)|0);f=f+1|0}c[e>>2]=(c[e>>2]|0)-(c[e+4>>2]|0);i=t;return}function Nd(a,d,e,f,g,h){a=a|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;var j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0;v=i;i=i+16|0;o=v+12|0;p=v+8|0;j=v+4|0;r=v;ze(j,o,d,g);ze(r,p,e,g);o=c[o>>2]|0;p=c[p>>2]|0;k=(o|0)>(p|0)?o:p;k=k+(k&1)|0;p=c[r>>2]>>k-p;c[r>>2]=p;o=c[j>>2]>>k-o;o=(o|0)>1?o:1;c[j>>2]=o;j=0;q=0;while(1){if((j|0)>=(g|0))break;u=q+((_(b[d+(j<<1)>>1]|0,b[e+(j<<1)>>1]|0)|0)>>k)|0;j=j+1|0;q=u}u=Od(q,o,13)|0;u=(u|0)>16384?16384:(u|0)<-16384?-16384:u;l=u<<16>>16;m=(_(u>>16,l)|0)+((_(u&65535,l)|0)>>16)|0;e=(m|0)>0?m:0-m|0;e=(e|0)<(h|0)?h:e;t=k>>1;h=c[f>>2]|0;d=aa(o|0)|0;j=24-d|0;g=0-j|0;do if(j)if((j|0)<0){j=o<>>(j+32|0);break}else{j=o<<32-j|o>>>j;break}else j=o;while(0);g=((d&1|0)==0?46214:32768)>>>(d>>>1);d=(_(j&127,13959168)|0)>>>16;s=e<<16>>16;d=_((g+((_(g>>16,d)|0)+((_(g&65535,d)|0)>>>16))<>16,s)|0;e=aa(o|0)|0;j=24-e|0;g=0-j|0;do if(j)if((j|0)<0){j=o<>>(j+32|0);break}else{j=o<<32-j|o>>>j;break}else j=o;while(0);k=((e&1|0)==0?46214:32768)>>>(e>>>1);n=(_(j&127,13959168)|0)>>>16;n=h+(d+((_((k+((_(k>>16,n)|0)+((_(k&65535,n)|0)>>>16))<>16))|0;c[f>>2]=n;j=m<<16>>16;j=p-((_(q>>16,l)|0)+((_(q&65535,l)|0)>>16)<<4)+((_(o>>16,j)|0)+((_(o&65535,j)|0)>>16)<<6)|0;c[r>>2]=j;l=f+4|0;m=c[l>>2]|0;h=(j|0)<1;if(h){f=0;r=_(0-m>>16,s)|0;t=f<>16;s=r+s|0;s=m+s|0;c[l>>2]=s;t=(n|0)>1;t=t?n:1;t=Od(s,t,14)|0;s=(t|0)>32767;r=(t|0)<0;t=r?0:t;t=s?32767:t;c[a>>2]=t;i=v;return u|0}e=aa(j|0)|0;g=24-e|0;d=0-g|0;do if(g)if((g|0)<0){g=j<>>(g+32|0);break}else{g=j<<32-g|j>>>g;break}else g=j;while(0);r=((e&1|0)==0?46214:32768)>>>(e>>>1);k=(_(g&127,13959168)|0)>>>16;k=_((r+((_(r>>16,k)|0)+((_(r&65535,k)|0)>>>16))<>16,s)|0;if(h){f=0;r=k;t=f<>16;s=r+s|0;s=m+s|0;c[l>>2]=s;t=(n|0)>1;t=t?n:1;t=Od(s,t,14)|0;s=(t|0)>32767;r=(t|0)<0;t=r?0:t;t=s?32767:t;c[a>>2]=t;i=v;return u|0}e=aa(j|0)|0;g=24-e|0;d=0-g|0;do if(g)if((g|0)<0){j=j<>>(g+32|0);break}else{j=j<<32-g|j>>>g;break}while(0);r=((e&1|0)==0?46214:32768)>>>(e>>>1);f=(_(j&127,13959168)|0)>>>16;f=r+((_(r>>16,f)|0)+((_(r&65535,f)|0)>>>16))|0;r=k;t=f<>16;s=r+s|0;s=m+s|0;c[l>>2]=s;t=(n|0)>1;t=t?n:1;t=Od(s,t,14)|0;s=(t|0)>32767;r=(t|0)<0;t=r?0:t;t=s?32767:t;c[a>>2]=t;i=v;return u|0}function Od(a,b,c){a=a|0;b=b|0;c=c|0;var d=0,e=0,f=0,g=0;if((a|0)<=0)if(!a)e=32;else{d=0-a|0;f=3}else{d=a;f=3}if((f|0)==3)e=aa(d|0)|0;a=a<>16|0)|0)<<16>>16;g=(_(a>>16,b)|0)+((_(a&65535,b)|0)>>16)|0;f=zf(f|0,((f|0)<0)<<31>>31|0,g|0,((g|0)<0)<<31>>31|0)|0;f=qf(f|0,C|0,29)|0;f=a-(f&-8)|0;b=g+((_(f>>16,b)|0)+((_(f&65535,b)|0)>>16))|0;d=e+28-d-c|0;if((d|0)>=0)return ((d|0)<32?b>>d:0)|0;d=0-d|0;a=-2147483648>>d;e=2147483647>>>d;if((a|0)>(e|0)){if((b|0)>(a|0)){g=a;g=g<(e|0)){g=e;g=g<=15)break;l=b[25372+(g<<1)>>1]|0;m=g+1|0;n=b[25372+(m<<1)>>1]|0;n=(_((n<<16>>16)-l>>16,429522944)|0)+(((n&65535)-l&65535)*6554|0)>>16;k=g&255;i=h;j=0;while(1){if((j|0)>=5){h=i;g=m;continue a}g=l+(_(n,j<<17>>16|1)|0)|0;h=c[p>>2]|0;h=(h|0)>(g|0)?h-g|0:g-h|0;if((h|0)>=(i|0))break a;a[q>>0]=k;a[o>>0]=j;i=h;j=j+1|0;f=g}}n=a[q>>0]|0;o=(n<<24>>24|0)/3|0;a[e+(r*3|0)+2>>0]=o;a[q>>0]=(n&255)+(_(o,-3)|0);c[p>>2]=f;r=r+1|0}c[d>>2]=(c[d>>2]|0)-(c[d+4>>2]|0);return}function Qd(f,j,l,m,n,o){f=f|0;j=j|0;l=l|0;m=m|0;n=n|0;o=o|0;var p=0,q=0.0,r=0,s=0,t=0,u=0,v=0.0,w=0.0,x=0,y=0,z=0,A=0,B=0,C=0.0,D=0,E=0,F=0,G=0,H=0.0,I=0.0,J=0,K=0.0,L=0.0,M=0.0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,Y=0,Z=0,$=0,ba=0,ca=0,da=0,ea=0,fa=0,ga=0,ha=0,ia=0,ja=0,ka=0,la=0,ma=0,na=0,oa=0,pa=0,qa=0,ra=0,sa=0,ta=0,ua=0,va=0,wa=0,xa=0,ya=0,za=0,Aa=0,Ba=0,Ca=0,Da=0,Ea=0,Fa=0,Ga=0,Ha=0,Ia=0,Ja=0,Ka=0,La=0,Ma=0,Na=0,Oa=0,Pa=0,Qa=0,Ra=0,Sa=0,Ta=0,Ua=0,Va=0,Wa=0,Xa=0,Ya=0,Za=0,_a=0,$a=0,ab=0,bb=0,cb=0,db=0,eb=0,fb=0,gb=0,hb=0,ib=0,jb=0.0,kb=0,lb=0;ib=i;i=i+35104|0;Qa=ib+272|0;Pa=ib+72|0;La=ib+29992|0;Ka=ib+29352|0;la=ib+28712|0;ma=ib+28392|0;Oa=ib+48|0;Na=ib+26008|0;Ma=ib+24472|0;da=ib+11992|0;ea=ib+11896|0;W=ib+33512|0;ia=ib+9176|0;ha=ib+6456|0;Q=ib+32232|0;R=ib+31272|0;P=ib+6384|0;Ga=ib+6320|0;Ia=ib+6256|0;Ha=ib+4720|0;bb=ib+23720|0;fa=ib+21032|0;eb=ib+20984|0;fb=ib+24|0;gb=ib;cb=ib+16536|0;db=ib+12088|0;ab=ib+12072|0;_a=ib+33824|0;$a=ib+12056|0;Ya=ib+33816|0;Za=ib+12040|0;c[$a>>2]=0;c[$a+4>>2]=0;c[$a+8>>2]=0;c[$a+12>>2]=0;Va=f+4712|0;Wa=c[Va>>2]|0;c[Va>>2]=Wa+1;Va=f+4862|0;a[Va>>0]=Wa&3;Wa=f+4684|0;ka=c[Wa>>2]|0;Xa=f+7272+(ka<<2)|0;ka=fa+(ka<<2)|0;J=f+5190|0;Ua=f+4676|0;p=c[Ua>>2]|0;s=c[f+28>>2]|0;if(s){t=f+24|0;u=c[t>>2]|0;r=256-u<<10;x=r>>16;r=r-(x<<16)|0;a:do if((x|0)<4){if((r|0)<=0){Ra=17528+(x*12|0)|0;c[Qa>>2]=c[Ra>>2];c[Qa+4>>2]=c[Ra+4>>2];c[Qa+8>>2]=c[Ra+8>>2];Ra=17588+(x<<3)|0;Sa=c[Ra+4>>2]|0;Ta=Pa;c[Ta>>2]=c[Ra>>2];c[Ta+4>>2]=Sa;break}y=x+1|0;z=r<<16>>16;if((r|0)<32768){r=0;while(1){if((r|0)==3){r=0;break}Sa=c[17528+(x*12|0)+(r<<2)>>2]|0;Ta=(c[17528+(y*12|0)+(r<<2)>>2]|0)-Sa|0;c[Qa+(r<<2)>>2]=Sa+((_(Ta>>16,z)|0)+((_(Ta&65535,z)|0)>>16));r=r+1|0}while(1){if((r|0)==2)break a;Sa=c[17588+(x<<3)+(r<<2)>>2]|0;Ta=(c[17588+(y<<3)+(r<<2)>>2]|0)-Sa|0;c[Pa+(r<<2)>>2]=Sa+((_(Ta>>16,z)|0)+((_(Ta&65535,z)|0)>>16));r=r+1|0}}else{r=0;while(1){if((r|0)==3){r=0;break}Sa=c[17528+(y*12|0)+(r<<2)>>2]|0;Ta=Sa-(c[17528+(x*12|0)+(r<<2)>>2]|0)|0;c[Qa+(r<<2)>>2]=Sa+((_(Ta>>16,z)|0)+((_(Ta&65535,z)|0)>>16));r=r+1|0}while(1){if((r|0)==2)break a;Sa=c[17588+(y<<3)+(r<<2)>>2]|0;Ta=Sa-(c[17588+(x<<3)+(r<<2)>>2]|0)|0;c[Pa+(r<<2)>>2]=Sa+((_(Ta>>16,z)|0)+((_(Ta&65535,z)|0)>>16));r=r+1|0}}}else{c[Qa>>2]=c[4394];c[Qa+4>>2]=c[4395];c[Qa+8>>2]=c[4396];Ta=Pa;c[Ta>>2]=35497197;c[Ta+4>>2]=57401098}while(0);r=u+s|0;c[t>>2]=(r|0)>256?256:(r|0)<0?0:r;r=f+16|0;z=0-(c[Pa>>2]|0)|0;s=z&16383;D=0-(c[Pa+4>>2]|0)|0;t=D&16383;x=c[Qa>>2]|0;u=x>>16;x=x&65535;y=f+20|0;z=z>>>14<<16>>16;B=c[Qa+4>>2]|0;A=B>>16;B=B&65535;D=D>>>14<<16>>16;F=c[Qa+8>>2]|0;E=F>>16;F=F&65535;G=0;while(1){if((G|0)>=(p|0))break;Ta=J+(G<<1)|0;Ra=b[Ta>>1]|0;Sa=(c[r>>2]|0)+((_(u,Ra)|0)+((_(x,Ra)|0)>>16))<<2;Ea=Sa>>16;Fa=Sa&65532;c[r>>2]=(c[y>>2]|0)+(((_(Ea,s)|0)+((_(Fa,s)|0)>>>16)>>13)+1>>1)+((_(Ea,z)|0)+((_(Fa,z)|0)>>16))+((_(A,Ra)|0)+((_(B,Ra)|0)>>16));c[y>>2]=(((_(Ea,t)|0)+((_(Fa,t)|0)>>>16)>>13)+1>>1)+((_(Ea,D)|0)+((_(Fa,D)|0)>>16))+((_(E,Ra)|0)+((_(F,Ra)|0)>>16));Sa=Sa+16383>>14;b[Ta>>1]=(Sa|0)>32767?32767:((Sa|0)<-32768?-32768:Sa)&65535;G=G+1|0}p=c[Ua>>2]|0}Ta=f+4668|0;s=Xa+((c[Ta>>2]|0)*5<<2)|0;while(1){r=p+-1|0;if((p|0)<=0){p=0;break}g[s+(r<<2)>>2]=+(b[J+(r<<1)>>1]|0);p=r}while(1){if((p|0)==8)break;Sa=Xa+(((c[Ta>>2]|0)*5|0)+(_(p,c[Ua>>2]>>3)|0)<<2)|0;g[Sa>>2]=+g[Sa>>2]+ +(1-(p&2)|0)*9.999999974752427e-07;p=p+1|0}Sa=f+4772|0;b:do if(!(c[Sa>>2]|0)){t=c[f+4688>>2]|0;A=c[Wa>>2]|0;z=t+(c[Ua>>2]|0)+A|0;A=Xa+(0-A<<2)|0;u=c[f+4640>>2]|0;p=A+(z<<2)+(0-u<<2)|0;v=3.1415927410125732/+(t+1|0);w=2.0-v*v;q=0.0;r=0;while(1){if((r|0)>=(t|0))break;g[Ha+(r<<2)>>2]=+g[p+(r<<2)>>2]*.5*(q+v);Ra=r|1;g[Ha+(Ra<<2)>>2]=+g[p+(Ra<<2)>>2]*v;M=w*v-q;Ra=r|2;g[Ha+(Ra<<2)>>2]=+g[p+(Ra<<2)>>2]*.5*(v+M);Ra=r|3;g[Ha+(Ra<<2)>>2]=+g[p+(Ra<<2)>>2]*M;q=M;v=w*M-v;r=r+4|0}Ra=Ha+(t<<2)|0;s=p+(t<<2)|0;r=u-(t<<1)|0;rf(Ra|0,s|0,r<<2|0)|0;p=Ra+(r<<2)|0;r=s+(r<<2)|0;q=1.0;v=w*.5;s=0;while(1){if((s|0)>=(t|0))break;g[p+(s<<2)>>2]=+g[r+(s<<2)>>2]*.5*(q+v);Ra=s|1;g[p+(Ra<<2)>>2]=+g[r+(Ra<<2)>>2]*v;M=w*v-q;Ra=s|2;g[p+(Ra<<2)>>2]=+g[r+(Ra<<2)>>2]*.5*(v+M);Ra=s|3;g[p+(Ra<<2)>>2]=+g[r+(Ra<<2)>>2]*M;q=M;v=w*M-v;s=s+4|0}y=f+4740|0;x=c[y>>2]|0;p=(x|0)<(u|0)?x+1|0:u;r=0;while(1){if((r|0)>=(p|0))break;g[P+(r<<2)>>2]=+Vd(Ha,Ha+(r<<2)|0,u-r|0);r=r+1|0}v=+g[P>>2];v=v+(v*1.0000000474974513e-03+1.0);g[P>>2]=v;p=0;while(1){if((p|0)>(x|0))break;M=+g[P+(p<<2)>>2];h[Qa+(p<<4)+8>>3]=M;h[Qa+(p<<4)>>3]=M;p=p+1|0}ja=Qa+8|0;s=0;c:while(1){if((x|0)<=(s|0))break;p=s+1|0;q=+h[ja>>3];q=-+h[Qa+(p<<4)>>3]/(q>9.999999717180685e-10?q:9.999999717180685e-10);g[Ia+(s<<2)>>2]=q;r=x-s|0;t=0;while(1){if((t|0)>=(r|0)){s=p;continue c}Fa=Qa+(t+s+1<<4)|0;M=+h[Fa>>3];Ra=Qa+(t<<4)+8|0;L=+h[Ra>>3];h[Fa>>3]=M+L*q;h[Ra>>3]=L+M*q;t=t+1|0}}M=+h[ja>>3];ga=bb+704|0;g[ga>>2]=v/(M>1.0?M:1.0);s=0;while(1){if((s|0)>=(x|0))break;q=+g[Ia+(s<<2)>>2];p=s+1|0;r=p>>1;t=0;while(1){if((t|0)>=(r|0))break;Fa=Ga+(t<<2)|0;M=+g[Fa>>2];Ra=Ga+(s-t+-1<<2)|0;L=+g[Ra>>2];g[Fa>>2]=M+L*q;g[Ra>>2]=L+M*q;t=t+1|0}g[Ga+(s<<2)>>2]=-q;s=p}p=x+-1|0;q=.9900000095367432;r=0;while(1){if((r|0)>=(p|0))break;Ra=Ga+(r<<2)|0;g[Ra>>2]=+g[Ra>>2]*q;q=q*.9900000095367432;r=r+1|0}Ra=Ga+(p<<2)|0;g[Ra>>2]=+g[Ra>>2]*q;Rd(fa,Ga,A,z,x);Ra=f+4857|0;p=a[Ra>>0]|0;do if(p<<24>>24!=0?(c[f+4756>>2]|0)==0:0){C=.6000000238418579-+(c[y>>2]|0)*.004000000189989805-+(c[f+4624>>2]|0)*.10000000149011612*.00390625-+(a[f+4633>>0]>>1|0)*.15000000596046448-+(c[f+4804>>2]|0)*.10000000149011612*.000030517578125;J=bb+228|0;ba=f+4854|0;ca=f+4856|0;P=f+10152|0;F=c[f+4636>>2]|0;w=+(c[f+4744>>2]|0)*.0000152587890625;T=c[Ta>>2]|0;U=c[f+4736>>2]|0;Z=c[f+4672>>2]|0;x=_((Z*5|0)+20|0,T)|0;E=Z*20|0;r=E+80|0;D=(Z*40|0)+160|0;V=T*5|0;$=T<<1;Y=T*18|0;S=Y+-1|0;G=(T|0)==16;d:do if(G){p=x;while(1){u=p+-1|0;if((p|0)<=0)break;q=+g[fa+(u<<2)>>2];s=(g[k>>2]=q,c[k>>2]|0);t=(s&2130706432)>>>0>1249902592;if(!t){p=(s|0)<0;v=p?q+-8388608.0+8388608.0:q+8388608.0+-8388608.0;if(v==0.0)v=p?-0.0:0.0}else v=q;if((~~v|0)<=32767){if(!t){p=(s|0)<0;v=p?q+-8388608.0+8388608.0:q+8388608.0+-8388608.0;if(v==0.0)v=p?-0.0:0.0}else v=q;if((~~v|0)<-32768)p=-32768;else{if(!t){p=(s|0)<0;q=p?q+-8388608.0+8388608.0:q+8388608.0+-8388608.0;if(q==0.0)q=p?-0.0:0.0}p=~~q}}else p=32767;b[Q+(u<<1)>>1]=p;p=u}s=Oa;c[s>>2]=0;c[s+4>>2]=0;xe(Oa,la,Q,x);s=D;while(1){p=s+-1|0;if((s|0)<=0){p=la;break d}g[La+(p<<2)>>2]=+(b[la+(p<<1)>>1]|0);s=p}}else{if((T|0)==12)p=x;else{p=D;while(1){u=p+-1|0;if((p|0)<=0)break;q=+g[fa+(u<<2)>>2];s=(g[k>>2]=q,c[k>>2]|0);t=(s&2130706432)>>>0>1249902592;if(!t){p=(s|0)<0;v=p?q+-8388608.0+8388608.0:q+8388608.0+-8388608.0;if(v==0.0)v=p?-0.0:0.0}else v=q;if((~~v|0)<=32767){if(!t){p=(s|0)<0;v=p?q+-8388608.0+8388608.0:q+8388608.0+-8388608.0;if(v==0.0)v=p?-0.0:0.0}else v=q;if((~~v|0)<-32768)p=-32768;else{if(!t){p=(s|0)<0;q=p?q+-8388608.0+8388608.0:q+8388608.0+-8388608.0;if(q==0.0)q=p?-0.0:0.0}p=~~q}}else p=32767;b[la+(u<<1)>>1]=p;p=u}p=la;break}while(1){u=p+-1|0;if((p|0)<=0)break;q=+g[fa+(u<<2)>>2];s=(g[k>>2]=q,c[k>>2]|0);t=(s&2130706432)>>>0>1249902592;if(!t){p=(s|0)<0;v=p?q+-8388608.0+8388608.0:q+8388608.0+-8388608.0;if(v==0.0)v=p?-0.0:0.0}else v=q;if((~~v|0)<=32767){if(!t){p=(s|0)<0;v=p?q+-8388608.0+8388608.0:q+8388608.0+-8388608.0;if(v==0.0)v=p?-0.0:0.0}else v=q;if((~~v|0)<-32768)p=-32768;else{if(!t){p=(s|0)<0;q=p?q+-8388608.0+8388608.0:q+8388608.0+-8388608.0;if(q==0.0)q=p?-0.0:0.0}p=~~q}}else p=32767;b[R+(u<<1)>>1]=p;p=u}c[Oa>>2]=0;c[Oa+4>>2]=0;c[Oa+8>>2]=0;c[Oa+12>>2]=0;c[Oa+16>>2]=0;c[Oa+20>>2]=0;c[Qa>>2]=0;c[Qa+4>>2]=0;c[Qa+8>>2]=0;c[Qa+12>>2]=0;z=Oa+16|0;A=Qa+16|0;B=Oa+20|0;u=la;y=R;p=x;while(1){x=(p|0)<480?p:480;s=0;while(1){if((s|0)>=(x|0)){s=Qa;t=x;break}Fa=(c[z>>2]|0)+(b[y+(s<<1)>>1]<<8)|0;c[A+(s<<2)>>2]=Fa;Fa=Fa<<2;Ea=Fa>>16;Fa=Fa&65532;c[z>>2]=(c[B>>2]|0)+((_(Ea,-2797)|0)+((_(Fa,-2797)|0)>>16));c[B>>2]=(_(Ea,-6507)|0)+((_(Fa,-6507)|0)>>16);s=s+1|0}while(1){if((t|0)<=2)break;za=c[s>>2]|0;Ba=s+4|0;Aa=c[Ba>>2]|0;Ca=s+8|0;Ea=c[Ca>>2]|0;Fa=s+12|0;Da=c[Fa>>2]|0;Da=(((za>>16)*4697|0)+(((za&65535)*4697|0)>>>16)+(((Aa>>16)*10739|0)+(((Aa&65535)*10739|0)>>>16))+(((Ea>>16)*8276|0)+(((Ea&65535)*8276|0)>>>16))+(((Da>>16)*1567|0)+(((Da&65535)*1567|0)>>>16))>>5)+1>>1;b[u>>1]=(Da|0)>32767?32767:((Da|0)<-32768?-32768:Da)&65535;Ba=c[Ba>>2]|0;Ca=c[Ca>>2]|0;Da=c[Fa>>2]|0;Ea=c[s+16>>2]|0;Ea=(((Ba>>16)*1567|0)+(((Ba&65535)*1567|0)>>>16)+(((Ca>>16)*8276|0)+(((Ca&65535)*8276|0)>>>16))+(((Da>>16)*10739|0)+(((Da&65535)*10739|0)>>>16))+(((Ea>>16)*4697|0)+(((Ea&65535)*4697|0)>>>16))>>5)+1>>1;b[u+2>>1]=(Ea|0)>32767?32767:((Ea|0)<-32768?-32768:Ea)&65535;u=u+4|0;s=Fa;t=t+-3|0}p=p-x|0;if((p|0)<=0)break;Fa=Qa+(x<<2)|0;c[Qa>>2]=c[Fa>>2];c[Qa+4>>2]=c[Fa+4>>2];c[Qa+8>>2]=c[Fa+8>>2];c[Qa+12>>2]=c[Fa+12>>2];y=y+(x<<1)|0}s=Qa+(x<<2)|0;c[Oa>>2]=c[s>>2];c[Oa+4>>2]=c[s+4>>2];c[Oa+8>>2]=c[s+8>>2];c[Oa+12>>2]=c[s+12>>2];s=D;while(1){p=s+-1|0;if((s|0)<=0){p=la;break d}g[La+(p<<2)>>2]=+(b[la+(p<<1)>>1]|0);s=p}}while(0);Fa=Oa;c[Fa>>2]=0;c[Fa+4>>2]=0;xe(Oa,ma,p,D);while(1){p=r+-1|0;if((r|0)<=0)break;g[Ka+(p<<2)>>2]=+(b[ma+(p<<1)>>1]|0);r=p}p=E+79|0;while(1){if((p|0)<=0)break;r=Ka+(p<<2)|0;p=p+-1|0;q=+(~~+g[r>>2]|0)+ +g[Ka+(p<<2)>>2];if(!(q>32767.0)){if(q<-32768.0)q=-32768.0}else q=32767.0;g[r>>2]=+(~~q<<16>>16)}nf(Na|0,0,Z*596|0)|0;p=Z>>1;r=Ma+256|0;y=Na+32|0;u=0;x=Ka+320|0;while(1){if((u|0)>=(p|0)){p=72;break}s=x+-32|0;hd(x,x+-288|0,Ma,40,65);M=+g[r>>2];q=+Ud(x,40);q=q+ +Ud(s,40)+16.0e4;g[y>>2]=+g[y>>2]+M*2.0/q;t=9;while(1){if((t|0)==73)break;Fa=s+-4|0;L=+g[Fa>>2];M=+g[s+156>>2];M=q+(L*L-M*M);Ea=Na+(t<<2)|0;g[Ea>>2]=+g[Ea>>2]+ +g[Ma+(72-t<<2)>>2]*2.0/M;s=Fa;t=t+1|0;q=M}u=u+1|0;x=x+160|0}while(1){if((p|0)<=7)break;Fa=Na+(p<<2)|0;M=+g[Fa>>2];g[Fa>>2]=M-M*+(p|0)*.000244140625;p=p+-1|0}x=U<<1;r=x+4|0;p=0;while(1){if((p|0)>=(r|0)){p=1;break}c[ea+(p<<2)>>2]=p;p=p+1|0}while(1){if((p|0)>=(r|0))break;q=+g[y+(p<<2)>>2];t=p;while(1){s=t+-1|0;if((t|0)<=0)break;v=+g[y+(s<<2)>>2];if(!(q>v))break;g[y+(t<<2)>>2]=v;c[ea+(t<<2)>>2]=c[ea+(s<<2)>>2];t=s}g[y+(t<<2)>>2]=q;c[ea+(t<<2)>>2]=p;p=p+1|0}u=y+(x+3<<2)|0;p=x+2|0;s=r;while(1){if((s|0)>=65)break;q=+g[y+(s<<2)>>2];if(q>+g[u>>2]){t=p;while(1){if((t|0)<=-1)break;v=+g[y+(t<<2)>>2];if(!(q>v))break;Fa=t+1|0;g[y+(Fa<<2)>>2]=v;c[ea+(Fa<<2)>>2]=c[ea+(t<<2)>>2];t=t+-1|0}Fa=t+1|0;g[y+(Fa<<2)>>2]=q;c[ea+(Fa<<2)>>2]=s}s=s+1|0}q=+g[y>>2];do if(q<.20000000298023224){nf(J|0,0,Z<<2|0)|0;g[P>>2]=0.0;b[ba>>1]=0;a[ca>>0]=0;p=0}else{q=q*w;p=0;while(1){if((p|0)>=(r|0))break;if(!(+g[Na+(p+8<<2)>>2]>q)){r=p;break}Fa=ea+(p<<2)|0;c[Fa>>2]=(c[Fa>>2]<<1)+16;p=p+1|0}p=11;while(1){if((p|0)==148){p=0;break}b[W+(p<<1)>>1]=0;p=p+1|0}while(1){if((p|0)>=(r|0)){p=146;break}b[W+(c[ea+(p<<2)>>2]<<1)>>1]=1;p=p+1|0}while(1){if((p|0)<=15){r=16;E=0;break}Fa=p+-1|0;Ea=W+(p<<1)|0;b[Ea>>1]=(e[Ea>>1]|0)+((e[W+(Fa<<1)>>1]|0)+(e[W+(p+-2<<1)>>1]|0));p=Fa}while(1){if((r|0)==144){p=146;break}p=r+1|0;if((b[W+(p<<1)>>1]|0)<=0){r=p;continue}c[ea+(E<<2)>>2]=r;r=p;E=E+1|0}while(1){if((p|0)<=15){r=16;p=0;break}Fa=p+-1|0;Ea=W+(p<<1)|0;b[Ea>>1]=(e[Ea>>1]|0)+((e[W+(Fa<<1)>>1]|0)+(e[W+(p+-2<<1)>>1]|0)+(e[W+(p+-3<<1)>>1]|0));p=Fa}while(1){if((r|0)==147)break;if((b[W+(r<<1)>>1]|0)>0){b[W+(p<<1)>>1]=r+65534;p=p+1|0}r=r+1|0}nf(Na|0,0,2384)|0;y=(T|0)==8;u=0;x=y?fa+640|0:La+640|0;while(1){if((u|0)>=(Z|0))break;v=+Ud(x,40)+1.0;t=0;while(1){if((t|0)>=(p|0))break;s=b[W+(t<<1)>>1]|0;r=x+(0-s<<2)|0;q=+Vd(r,x,40);if(q>0.0)q=q*2.0/(+Ud(r,40)+v);else q=0.0;g[Na+(u*596|0)+(s<<2)>>2]=q;t=t+1|0}u=u+1|0;x=x+160|0}if((F|0)>0){if((T|0)==12)p=(F<<1|0)/3|0;else p=F>>(G&1);r=p;M=+Ge(+(p|0))*3.32192809488736}else{r=F;M=0.0}Q=(Z|0)==4;if(Q){B=32969;D=11;A=y&(U|0)>0?11:3}else{B=32935;D=3;A=3}K=+(Z|0);L=K*.20000000298023224;y=(r|0)>0;C=K*C;r=0;H=0.0;I=-1.0e3;x=0;z=-1;while(1){if((x|0)>=(E|0))break;u=c[ea+(x<<2)>>2]|0;t=0;while(1){if((t|0)>=(A|0)){s=0;w=-1.0e3;p=0;break}p=da+(t<<2)|0;g[p>>2]=0.0;q=0.0;s=0;while(1){if((s|0)>=(Z|0))break;w=q+ +g[Na+(s*596|0)+(u+(a[B+((_(s,D)|0)+t)>>0]|0)<<2)>>2];g[p>>2]=w;q=w;s=s+1|0}t=t+1|0}while(1){if((p|0)>=(A|0))break;v=+g[da+(p<<2)>>2];Fa=v>w;s=Fa?p:s;w=Fa?v:w;p=p+1|0}v=+Ge(+(u|0))*3.32192809488736;q=w-L*v;if(y){v=v-M;v=v*v;q=q-L*+g[P>>2]*v/(v+.5)}Fa=q>I&w>C;r=Fa?s:r;H=Fa?w:H;I=Fa?q:I;x=x+1|0;z=Fa?u:z}if((z|0)==-1){c[J>>2]=0;c[J+4>>2]=0;c[J+8>>2]=0;c[J+12>>2]=0;g[P>>2]=0.0;b[ba>>1]=0;a[ca>>0]=0;p=0;break}g[P>>2]=H/K;if((T|0)>8){if((T|0)==12){p=(z<<16>>16)*3|0;p=(p>>1)+(p&1)|0}else p=z<<1;if(($|0)<(Y|0))if((p|0)<(Y|0))x=(p|0)<($|0)?$:p;else x=S;else if((p|0)>($|0))x=$;else x=(p|0)<(S|0)?S:p;J=x+-2|0;J=(J|0)>($|0)?J:$;P=x+2|0;P=(P|0)<(S|0)?P:S;if(Q){B=33013;D=33149+(U<<3)|0;E=34;F=a[33173+U>>0]|0}else{B=32941;D=32965;E=12;F=12}G=fa+(T*20<<2)|0;u=0-J|0;z=0;A=G;while(1){if((z|0)>=(Z|0))break;p=z<<1;y=a[D+p>>0]|0;p=a[D+(p|1)>>0]|0;hd(A,A+(u<<2)+(0-p<<2)|0,Qa,V,p-y+1|0);r=y;s=0;while(1){if((p|0)<(r|0))break;c[Pa+(s<<2)>>2]=c[Qa+(p-r<<2)>>2];r=r+1|0;s=s+1|0}p=_(z,E)|0;s=0;while(1){if((s|0)>=(F|0))break;r=(a[B+(p+s)>>0]|0)-y|0;t=0;while(1){if((t|0)==5)break;c[ha+(z*680|0)+(s*20|0)+(t<<2)>>2]=c[Pa+(r+t<<2)>>2];t=t+1|0}s=s+1|0}z=z+1|0;A=A+(V<<2)|0}if(Q){y=33013;z=33149+(U<<3)|0;A=34;D=a[33173+U>>0]|0}else{y=32941;z=32965;A=12;D=12}B=0;E=G;while(1){if((B|0)>=(Z|0))break;r=B<<1;u=a[z+r>>0]|0;p=E+(0-(u+J)<<2)|0;q=+Ud(p,V)+.001;g[Pa>>2]=q;r=(a[z+(r|1)>>0]|0)-u|0;s=1;while(1){if((s|0)>(r|0))break;L=+g[p+(V-s<<2)>>2];M=+g[p+(0-s<<2)>>2];M=q-L*L+M*M;g[Pa+(s<<2)>>2]=M;q=M;s=s+1|0}p=_(B,A)|0;s=0;while(1){if((s|0)>=(D|0))break;r=(a[y+(p+s)>>0]|0)-u|0;t=0;while(1){if((t|0)==5)break;c[ia+(B*680|0)+(s*20|0)+(t<<2)>>2]=c[Pa+(r+t<<2)>>2];t=t+1|0}s=s+1|0}B=B+1|0;E=E+(V<<2)|0}H=.05000000074505806/+(x|0);if(Q){A=33013;B=34;z=a[33173+U>>0]|0}else{A=32941;B=12;z=12}C=+Ud(G,_(V,Z)|0)+1.0;r=0;q=-1.0e3;u=J;y=0;while(1){if((u|0)>(P|0))break;else{t=0;p=x}while(1){if((t|0)<(z|0)){v=0.0;w=C;s=0}else break;while(1){if((s|0)>=(Z|0))break;v=v+ +g[ha+(s*680|0)+(t*20|0)+(y<<2)>>2];w=w+ +g[ia+(s*680|0)+(t*20|0)+(y<<2)>>2];s=s+1|0}if(v>0.0)v=v*2.0/w*(1.0-H*+(t|0));else v=0.0;if(v>q){Fa=(u+(a[33013+t>>0]|0)|0)<(Y|0);r=Fa?t:r;q=Fa?v:q;p=Fa?u:p}t=t+1|0}u=u+1|0;y=y+1|0;x=p}s=($|0)>(Y|0);u=0;while(1){if((u|0)>=(Z|0))break;p=x+(a[A+((_(u,B)|0)+r)>>0]|0)|0;t=bb+228+(u<<2)|0;c[t>>2]=p;do if(s){if((p|0)>($|0)){p=$;break}p=(p|0)<(Y|0)?Y:p}else{if((p|0)>(Y|0)){p=Y;break}p=(p|0)<($|0)?$:p}while(0);c[t>>2]=p;u=u+1|0}p=x-$|0}else{p=0;while(1){if((p|0)>=(Z|0))break;Fa=z+(a[B+((_(p,D)|0)+r)>>0]|0)|0;c[bb+228+(p<<2)>>2]=(Fa|0)>144?144:(Fa|0)<16?16:Fa;p=p+1|0}p=z+65520|0}b[ba>>1]=p;a[ca>>0]=r;p=1}while(0);if(p){a[Ra>>0]=2;p=2;break}else{a[Ra>>0]=1;p=1;break}}else hb=264;while(0);if((hb|0)==264){Fa=bb+228|0;c[Fa>>2]=0;c[Fa+4>>2]=0;c[Fa+8>>2]=0;c[Fa+12>>2]=0;b[f+4854>>1]=0;a[f+4856>>0]=0;g[f+10152>>2]=0.0}y=Xa+(0-(c[f+4692>>2]|0)<<2)|0;Ba=f+4808|0;v=+(c[Ba>>2]|0);q=v*.0078125;P=c[f+4788>>2]|0;w=+(P+(c[f+4792>>2]|0)|0)*.5*.000030517578125;Ca=bb+696|0;g[Ca>>2]=w;I=1.0/(+X(+-((q+-20.0)*.25))+1.0);Da=bb+700|0;g[Da>>2]=I;if(!(c[f+4768>>2]|0)){M=1.0-+(c[f+4624>>2]|0)*.00390625;q=q-I*2.0*(w*.5+.5)*M*M}Q=p<<24>>24==2;do if(!Q){H=q+(v*-.4000000059604645*.0078125+6.0)*(1.0-w);r=c[Ta>>2]<<1;u=f+4672|0;p=c[u>>2]|0;x=((p<<16>>16)*5|0)/2|0;w=+(r|0);q=0.0;s=0;v=0.0;t=ka;while(1){if((s|0)>=(x|0))break;C=+Ge(w+ +Ud(t,r))*3.32192809488736;if((s|0)>0)q=q+ +N(+(C-v));s=s+1|0;v=C;t=t+(r<<2)|0}r=f+4858|0;if(q>+(x+-1|0)*.6000000238418579){a[r>>0]=0;Fa=u;break}else{a[r>>0]=1;Fa=u;break}}else{H=q+ +g[f+10152>>2]*2.0;a[f+4858>>0]=0;p=f+4672|0;Fa=p;p=c[p>>2]|0}while(0);L=+g[ga>>2]*1.0000000474974513e-03;L=.9399999976158142/(L*L+1.0);J=c[f+4764>>2]|0;C=+(J|0)*.0000152587890625+I*.009999999776482582;E=f+4696|0;Ea=f+4680|0;F=f+4728|0;I=C;K=1.0-C*C;G=0;x=y;while(1){if((G|0)>=(p|0))break;r=c[Ta>>2]|0;s=r*3|0;y=c[E>>2]|0;u=(y-s|0)/2|0;v=3.1415927410125732/+(u+1|0);w=2.0-v*v;q=0.0;t=0;while(1){if((t|0)>=(u|0))break;g[La+(t<<2)>>2]=+g[x+(t<<2)>>2]*.5*(q+v);Aa=t|1;g[La+(Aa<<2)>>2]=+g[x+(Aa<<2)>>2]*v;M=w*v-q;Aa=t|2;g[La+(Aa<<2)>>2]=+g[x+(Aa<<2)>>2]*.5*(v+M);Aa=t|3;g[La+(Aa<<2)>>2]=+g[x+(Aa<<2)>>2]*M;q=M;v=w*M-v;t=t+4|0}rf(La+(u<<2)|0,x+(u<<2)|0,r*12|0)|0;s=u+s|0;r=La+(s<<2)|0;s=x+(s<<2)|0;q=1.0;v=w*.5;t=0;while(1){if((t|0)>=(u|0))break;g[r+(t<<2)>>2]=+g[s+(t<<2)>>2]*.5*(q+v);Aa=t|1;g[r+(Aa<<2)>>2]=+g[s+(Aa<<2)>>2]*v;M=w*v-q;Aa=t|2;g[r+(Aa<<2)>>2]=+g[s+(Aa<<2)>>2]*.5*(v+M);Aa=t|3;g[r+(Aa<<2)>>2]=+g[s+(Aa<<2)>>2]*M;q=M;v=w*M-v;t=t+4|0}x=x+(c[Ea>>2]<<2)|0;z=(J|0)>0;D=c[F>>2]|0;e:do if(z){nf(Qa|0,0,200)|0;nf(Pa|0,0,200)|0;s=Qa+(D<<3)|0;t=Pa+(D<<3)|0;q=0.0;u=0;while(1){if((u|0)>=(y|0)){r=0;break}r=0;v=+g[La+(u<<2)>>2];while(1){if((r|0)>=(D|0))break;za=r|1;ya=Qa+(za<<3)|0;jb=+h[ya>>3];M=q+I*(jb-v);h[Qa+(r<<3)>>3]=v;Aa=Pa+(r<<3)|0;h[Aa>>3]=+h[Aa>>3]+ +h[Qa>>3]*v;Aa=r+2|0;w=+h[Qa+(Aa<<3)>>3];h[ya>>3]=M;za=Pa+(za<<3)|0;h[za>>3]=+h[za>>3]+ +h[Qa>>3]*M;q=w;r=Aa;v=jb+I*(w-M)}h[s>>3]=v;q=+h[Qa>>3];h[t>>3]=+h[t>>3]+q*v;u=u+1|0}while(1){if((r|0)>(D|0))break;g[Ka+(r<<2)>>2]=+h[Pa+(r<<3)>>3];r=r+1|0}}else{r=(D|0)<(y|0)?D+1|0:y;s=0;while(1){if((s|0)>=(r|0))break e;g[Ka+(s<<2)>>2]=+Vd(La,La+(s<<2)|0,y-s|0);s=s+1|0}}while(0);jb=+g[Ka>>2];g[Ka>>2]=jb+(jb*2.9999999242136255e-05+1.0);r=0;while(1){if((r|0)>(D|0)){t=0;break}jb=+g[Ka+(r<<2)>>2];h[Qa+(r<<4)+8>>3]=jb;h[Qa+(r<<4)>>3]=jb;r=r+1|0}f:while(1){if((D|0)<=(t|0))break;r=t+1|0;q=+h[ja>>3];q=-+h[Qa+(r<<4)>>3]/(q>9.999999717180685e-10?q:9.999999717180685e-10);g[la+(t<<2)>>2]=q;s=D-t|0;u=0;while(1){if((u|0)>=(s|0)){t=r;continue f}za=Qa+(u+t+1<<4)|0;jb=+h[za>>3];Aa=Qa+(u<<4)+8|0;M=+h[Aa>>3];h[za>>3]=jb+M*q;h[Aa>>3]=M+jb*q;u=u+1|0}}q=+h[ja>>3];B=bb+244+(G*24<<2)|0;t=0;while(1){if((t|0)>=(D|0))break;v=+g[la+(t<<2)>>2];r=t+1|0;s=r>>1;u=0;while(1){if((u|0)>=(s|0))break;za=B+(u<<2)|0;jb=+g[za>>2];Aa=B+(t-u+-1<<2)|0;M=+g[Aa>>2];g[za>>2]=jb+M*v;g[Aa>>2]=M+jb*v;u=u+1|0}g[B+(t<<2)>>2]=-v;t=r}v=+O(+q);r=bb+(G<<2)|0;g[r>>2]=v;A=D+-1|0;if(z){q=+g[B+(A<<2)>>2];s=D+-2|0;while(1){q=C*q;if((s|0)<=-1)break;q=+g[B+(s<<2)>>2]-q;s=s+-1|0}g[r>>2]=v*(1.0/(q+1.0));q=L;r=0}else{q=L;r=0}while(1){if((r|0)>=(A|0))break;Aa=B+(r<<2)|0;g[Aa>>2]=+g[Aa>>2]*q;q=q*L;r=r+1|0}y=B+(A<<2)|0;q=+g[y>>2]*q;g[y>>2]=q;g:do if(z){r=D;while(1){if((r|0)<=1)break;Aa=B+(r+-2<<2)|0;jb=+g[Aa>>2]-q*C;g[Aa>>2]=jb;q=jb;r=r+-1|0}q=K/(+g[B>>2]*C+1.0);r=0;while(1){if((r|0)>=(D|0)){r=0;u=0;break}Aa=B+(r<<2)|0;g[Aa>>2]=+g[Aa>>2]*q;r=r+1|0}while(1){if((u|0)<10){s=0;t=r;v=-1.0}else break g;while(1){if((s|0)>=(D|0))break;jb=+N(+(+g[B+(s<<2)>>2]));Aa=jb>v;za=Aa?s:t;s=s+1|0;t=za;v=Aa?jb:v}if(!(v<=3.999000072479248))r=1;else break g;while(1){if((r|0)>=(D|0))break;Aa=B+(r+-1<<2)|0;g[Aa>>2]=+g[Aa>>2]+ +g[B+(r<<2)>>2]*C;r=r+1|0}q=1.0/q;r=0;while(1){if((r|0)>=(D|0))break;Aa=B+(r<<2)|0;g[Aa>>2]=+g[Aa>>2]*q;r=r+1|0}q=.9900000095367432-(+(u|0)*.10000000149011612+.800000011920929)*(v+-3.999000072479248)/(v*+(t+1|0));v=q;r=0;while(1){if((r|0)>=(A|0))break;Aa=B+(r<<2)|0;g[Aa>>2]=+g[Aa>>2]*v;v=v*q;r=r+1|0}q=+g[y>>2]*v;g[y>>2]=q;r=D;while(1){if((r|0)<=1)break;Aa=B+(r+-2<<2)|0;jb=+g[Aa>>2]-q*C;g[Aa>>2]=jb;q=jb;r=r+-1|0}q=K/(+g[B>>2]*C+1.0);r=0;while(1){if((r|0)>=(D|0))break;Aa=B+(r<<2)|0;g[Aa>>2]=+g[Aa>>2]*q;r=r+1|0}r=t;u=u+1|0}}else{r=0;t=0;while(1){if((t|0)<10){s=0;q=-1.0}else break g;while(1){if((s|0)>=(D|0))break;jb=+N(+(+g[B+(s<<2)>>2]));Aa=jb>q;za=Aa?s:r;s=s+1|0;r=za;q=Aa?jb:q}if(q<=3.999000072479248)break g;q=.9900000095367432-(+(t|0)*.10000000149011612+.800000011920929)*(q+-3.999000072479248)/(q*+(r+1|0));v=q;s=0;while(1){if((s|0)>=(A|0))break;Aa=B+(s<<2)|0;g[Aa>>2]=+g[Aa>>2]*v;v=v*q;s=s+1|0}g[y>>2]=+g[y>>2]*v;t=t+1|0}}while(0);G=G+1|0}q=+nb(+(H*-.1599999964237213));r=0;while(1){if((r|0)>=(p|0))break;Aa=bb+(r<<2)|0;g[Aa>>2]=+g[Aa>>2]*q+1.2483305931091309;r=r+1|0}Aa=f+4624|0;q=+(c[Aa>>2]|0);v=((+(P|0)*.000030517578125+-1.0)*.5+1.0)*4.0*(q*.00390625);h:do if(Q){r=0;while(1){if((r|0)>=(p|0))break;jb=.20000000298023224/+(c[Ta>>2]|0)+3.0/+(c[bb+228+(r<<2)>>2]|0);g[bb+628+(r<<2)>>2]=jb+-1.0;g[bb+644+(r<<2)>>2]=1.0-jb-jb*v;r=r+1|0}v=-.25-q*.26249998807907104*.00390625}else{jb=1.2999999523162842/+(c[Ta>>2]|0);s=bb+628|0;g[s>>2]=jb+-1.0;t=bb+644|0;g[t>>2]=1.0-jb-jb*v*.6000000238418579;r=1;while(1){if((r|0)>=(p|0)){v=-.25;break h}c[bb+628+(r<<2)>>2]=c[s>>2];c[bb+644+(r<<2)>>2]=c[t>>2];r=r+1|0}}while(0);if(Q)q=((1.0-(1.0-+g[Da>>2])*+g[Ca>>2])*.20000000298023224+.30000001192092896)*+O(+(+g[f+10152>>2]));else q=0.0;r=f+7264|0;s=f+7268|0;t=0;while(1){if((t|0)>=(p|0))break;jb=+g[r>>2];jb=jb+(q-jb)*.4000000059604645;g[r>>2]=jb;g[bb+676+(t<<2)>>2]=jb;jb=+g[s>>2];jb=jb+(v-jb)*.4000000059604645;g[s>>2]=jb;g[bb+660+(t<<2)>>2]=jb;t=t+1|0}r=0;while(1){if((r|0)>=(p|0))break;g[Oa+(r<<2)>>2]=1.0/+g[bb+(r<<2)>>2];r=r+1|0}if(Q){D=c[Ea>>2]|0;E=D+5|0;y=ka;z=la;A=0;B=ma;while(1){if((A|0)>=(p|0))break;t=y+(-2-(c[bb+228+(A<<2)>>2]|0)<<2)|0;r=t+16|0;q=+Ud(r,D);g[z>>2]=q;s=1;while(1){if((s|0)==5)break;M=+g[r+(0-s<<2)>>2];jb=+g[r+(D-s<<2)>>2];jb=q+(M*M-jb*jb);g[z+(s*6<<2)>>2]=jb;q=jb;s=s+1|0}x=1;u=t+12|0;while(1){if((x|0)==5){s=0;break}q=+Vd(r,u,D);jb=q;g[z+(x*5<<2)>>2]=jb;g[z+(x<<2)>>2]=jb;s=5-x|0;t=1;while(1){if((t|0)>=(s|0))break;ya=0-t|0;za=D-t|0;jb=q+(+g[r+(ya<<2)>>2]*+g[u+(ya<<2)>>2]-+g[r+(za<<2)>>2]*+g[u+(za<<2)>>2]);M=jb;za=x+t|0;g[z+((za*5|0)+t<<2)>>2]=M;g[z+((t*5|0)+za<<2)>>2]=M;q=jb;t=t+1|0}x=x+1|0;u=u+-4|0}while(1){if((s|0)==5)break;g[B+(s<<2)>>2]=+Vd(r,y,D);s=s+1|0;r=r+-4|0}jb=+Ud(y,E);q=(+g[z>>2]+ +g[z+96>>2])*.014999999664723873+1.0;q=1.0/(jb>q?jb:q);r=0;while(1){if((r|0)>=24){r=24;break}za=z+(r<<2)|0;g[za>>2]=+g[za>>2]*q;za=z+((r|1)<<2)|0;g[za>>2]=+g[za>>2]*q;za=z+((r|2)<<2)|0;g[za>>2]=+g[za>>2]*q;za=z+((r|3)<<2)|0;g[za>>2]=+g[za>>2]*q;r=r+4|0}while(1){if((r|0)==25){r=0;break}za=z+(r<<2)|0;g[za>>2]=+g[za>>2]*q;r=r+1|0}while(1){if((r|0)>=4){r=4;break}za=B+(r<<2)|0;g[za>>2]=+g[za>>2]*q;za=B+((r|1)<<2)|0;g[za>>2]=+g[za>>2]*q;za=B+((r|2)<<2)|0;g[za>>2]=+g[za>>2]*q;za=B+((r|3)<<2)|0;g[za>>2]=+g[za>>2]*q;r=r+4|0}while(1){if((r|0)==5)break;za=B+(r<<2)|0;g[za>>2]=+g[za>>2]*q;r=r+1|0}y=y+(D<<2)|0;z=z+100|0;A=A+1|0;B=B+20|0}va=f+4832|0;za=f+4748|0;t=c[Ea>>2]|0;xa=c[Fa>>2]|0;r=xa*25|0;s=0;while(1){if((s|0)>=(r|0))break;q=+g[la+(s<<2)>>2]*131072.0;p=(g[k>>2]=q,c[k>>2]|0);if((p&2130706432)>>>0<=1249902592){p=(p|0)<0;q=p?q+-8388608.0+8388608.0:q+8388608.0+-8388608.0;if(q==0.0)q=p?-0.0:0.0}c[La+(s<<2)>>2]=~~q;s=s+1|0}ua=f+4860|0;ya=bb+708|0;wa=xa*5|0;r=0;while(1){if((r|0)>=(wa|0))break;q=+g[ma+(r<<2)>>2]*131072.0;p=(g[k>>2]=q,c[k>>2]|0);if((p&2130706432)>>>0<=1249902592){p=(p|0)<0;q=p?q+-8388608.0+8388608.0:q+8388608.0+-8388608.0;if(q==0.0)q=p?-0.0:0.0}c[Ka+(r<<2)>>2]=~~q;r=r+1|0}ra=t<<16>>16;ta=0;p=0;sa=0;r=2147483647;x=0;while(1){if((sa|0)==3)break;ma=c[17388+(sa<<2)>>2]|0;na=c[17400+(sa<<2)>>2]|0;oa=c[17412+(sa<<2)>>2]|0;pa=a[29888+sa>>0]|0;qa=La;A=p;ka=0;z=0;x=0;p=c[za>>2]|0;la=Ka;while(1){if((ka|0)>=(xa|0))break;ja=5333-p|0;s=ja+896|0;if((ja|0)>=-896)if((s|0)>3966)s=2147483647;else{t=s>>7;y=1<>16)<>7;else s=_(y>>7,u+((_(_(u,128-u|0)|0,-174)|0)>>16)|0)|0;s=y+s|0}else s=0;F=s+-51|0;G=Qa+ka|0;J=c[la>>2]<<7;P=c[la+4>>2]<<7;Q=c[la+8>>2]<<7;R=c[la+12>>2]<<7;ga=0-(c[la+16>>2]<<7)|0;a[G>>0]=0;S=qa+4|0;T=qa+8|0;U=qa+12|0;V=qa+16|0;W=qa+28|0;Y=qa+32|0;Z=qa+36|0;$=qa+24|0;ba=qa+52|0;ca=qa+56|0;da=qa+48|0;ea=qa+76|0;fa=qa+72|0;ga=ga<<1;ha=qa+96|0;ia=na;ja=A;D=0;E=2147483647;B=2147483647;while(1){if((D|0)>=(pa|0))break;u=d[oa+D>>0]|0;kb=a[ia+1>>0]|0;A=(_(c[S>>2]|0,kb)|0)-J|0;t=a[ia+2>>0]|0;A=A+(_(c[T>>2]|0,t)|0)|0;y=a[ia+3>>0]|0;A=A+(_(c[U>>2]|0,y)|0)|0;s=a[ia+4>>0]|0;A=A+(_(c[V>>2]|0,s)|0)<<1;lb=a[ia>>0]|0;A=A+(_(c[qa>>2]|0,lb)|0)|0;lb=(_(A>>16,lb)|0)+((_(A&65535,lb)|0)>>16)+32801|0;A=(_(c[W>>2]|0,t)|0)-P|0;A=A+(_(c[Y>>2]|0,y)|0)|0;A=A+(_(c[Z>>2]|0,s)|0)<<1;A=A+(_(c[$>>2]|0,kb)|0)|0;kb=lb+((_(A>>16,kb)|0)+((_(A&65535,kb)|0)>>16))|0;A=(_(c[ba>>2]|0,y)|0)-Q|0;A=A+(_(c[ca>>2]|0,s)|0)<<1;A=A+(_(c[da>>2]|0,t)|0)|0;t=kb+((_(A>>16,t)|0)+((_(A&65535,t)|0)>>16))|0;A=(_(c[ea>>2]|0,s)|0)-R<<1;A=A+(_(c[fa>>2]|0,y)|0)|0;y=t+((_(A>>16,y)|0)+((_(A&65535,y)|0)>>16))|0;A=ga+(_(c[ha>>2]|0,s)|0)|0;s=y+((_(A>>16,s)|0)+((_(A&65535,s)|0)>>16))|0;do if((s|0)>-1){s=s+((u|0)>(F|0)?u-F<<11:0)|0;A=aa(s|0)|0;t=24-A|0;y=0-t|0;do if(t)if((t|0)<0){t=s<>>(t+32|0);break}else{t=s<<32-t|s>>>t;break}else t=s;while(0);t=t&127;t=_(ra,(t+(((_(t,128-t|0)|0)*179|0)>>>16)+(31-A<<7)<<16)+-125829120>>16)|0;t=t+(d[ma+D>>0]<<2)|0;if((t|0)>(E|0)){u=ja;t=E;s=B;break}a[G>>0]=D}else{u=ja;t=E;s=B}while(0);ia=ia+5|0;ja=u;D=D+1|0;E=t;B=s}x=x+B|0;x=(x|0)<0?2147483647:x;z=z+E|0;z=(z|0)<0?2147483647:z;s=ja+51|0;y=aa(s|0)|0;t=24-y|0;u=0-t|0;do if(t)if((t|0)<0){t=s<>>(t+32|0);break}else{t=s<<32-t|s>>>t;break}else t=s;while(0);lb=t&127;if((p+(lb+(((_(lb,128-lb|0)|0)*179|0)>>>16)+(31-y<<7))|0)<896)p=0;else{y=aa(s|0)|0;t=24-y|0;u=0-t|0;do if(t)if((t|0)<0){s=s<>>(t+32|0);break}else{s=s<<32-t|s>>>t;break}while(0);lb=s&127;p=p+(lb+(((_(lb,128-lb|0)|0)*179|0)>>>16)+(31-y<<7))+-896|0}qa=qa+100|0;A=ja;ka=ka+1|0;la=la+20|0}if((z|0)>(r|0))p=ta;else{a[ua>>0]=sa;rf(va|0,Qa|0,xa|0)|0;r=z}ta=p;p=A;sa=sa+1|0}p=c[17400+(a[ua>>0]<<2)>>2]|0;t=0;while(1){if((t|0)>=(xa|0))break;r=f+4832+t|0;s=t*5|0;u=0;while(1){if((u|0)==5)break;b[Pa+(s+u<<1)>>1]=a[p+(((a[r>>0]|0)*5|0)+u)>>0]<<7;u=u+1|0}t=t+1|0}p=x>>((xa|0)==2?1:2);c[za>>2]=ta;t=aa(p|0)|0;r=24-t|0;s=0-r|0;do if(r)if((r|0)<0){p=p<>>(r+32|0);break}else{p=p<<32-r|p>>>r;break}while(0);p=p&127;p=(p+(((_(p,128-p|0)|0)*179|0)>>>16)+(31-t<<7)<<16)+-125829120>>16;r=0;while(1){if((r|0)>=(wa|0))break;g[bb+144+(r<<2)>>2]=+(b[Pa+(r<<1)>>1]|0)*.00006103515625;r=r+1|0}q=+(_(p,-3)|0)*.0078125;g[ya>>2]=q;if(!m){q=+((c[f+4708>>2]|0)+(c[f+5836>>2]|0)|0)*q*.10000000149011612;if(!(q>2.0)){if(q<0.0)q=0.0}else q=2.0;p=~~q;a[f+4861>>0]=p}else{a[f+4861>>0]=0;p=0}g[bb+224>>2]=+(b[25412+(p<<24>>24<<1)>>1]|0)*.00006103515625;B=c[f+4732>>2]|0;u=c[Ea>>2]|0;x=c[Fa>>2]|0;y=u+B|0;z=Ma;A=0;B=Xa+(0-B<<2)|0;while(1){if((A|0)>=(x|0))break;s=0-(c[bb+228+(A<<2)>>2]|0)|0;v=+g[Oa+(A<<2)>>2];p=A*5|0;r=0;while(1){if((r|0)==5)break;c[Qa+(r<<2)>>2]=c[bb+144+(p+r<<2)>>2];r=r+1|0}t=0;s=B+(s<<2)|0;while(1){if((t|0)>=(y|0))break;r=c[B+(t<<2)>>2]|0;p=z+(t<<2)|0;c[p>>2]=r;q=(c[k>>2]=r,+g[k>>2]);r=0;while(1){if((r|0)==5)break;jb=q-+g[Qa+(r<<2)>>2]*+g[s+(2-r<<2)>>2];g[p>>2]=jb;q=jb;r=r+1|0}g[p>>2]=q*v;t=t+1|0;s=s+4|0}z=z+(y<<2)|0;A=A+1|0;B=B+(u<<2)|0}}else{z=f+4732|0;y=c[z>>2]|0;r=y;u=0;x=Ma;y=Xa+(0-y<<2)|0;while(1){if((u|0)>=(p|0))break;q=+g[Oa+(u<<2)>>2];p=c[Ea>>2]|0;t=p+r|0;s=t&65532;p=r+p&65532;r=0;while(1){if((r|0)>=(s|0))break;g[x+(r<<2)>>2]=+g[y+(r<<2)>>2]*q;lb=r|1;g[x+(lb<<2)>>2]=+g[y+(lb<<2)>>2]*q;lb=r|2;g[x+(lb<<2)>>2]=+g[y+(lb<<2)>>2]*q;lb=r|3;g[x+(lb<<2)>>2]=+g[y+(lb<<2)>>2]*q;r=r+4|0}while(1){if((p|0)>=(t|0))break;g[x+(p<<2)>>2]=+g[y+(p<<2)>>2]*q;p=p+1|0}lb=c[Ea>>2]|0;kb=c[z>>2]|0;p=c[Fa>>2]|0;r=kb;u=u+1|0;x=x+(lb+kb<<2)|0;y=y+(lb<<2)|0}nf(bb+144|0,0,p*20|0)|0;g[bb+708>>2]=0.0;c[f+4748>>2]=0}p=f+4756|0;if(!(c[p>>2]|0)){v=+nb(+(+g[bb+708>>2]/3.0))/1.0e4;v=v/(+g[Da>>2]*.75+.25)}else v=.009999999776482582;A=f+4732|0;y=c[A>>2]|0;x=(c[Ea>>2]|0)+y|0;z=f+4859|0;a[z>>0]=4;q=+Ae(Ga,Ma,v,x,c[Fa>>2]|0,y);y=f+4724|0;i:do if((c[y>>2]|0?(c[p>>2]|0)==0:0)?(c[Fa>>2]|0)==4:0){u=x<<1;q=q-+Ae(Ia,Ma+(u<<2)|0,v,x,2,c[A>>2]|0);Sd(Na,Ia,c[A>>2]|0);t=3;w=3402823466385288598117041.0e14;while(1){if((t|0)<=-1)break i;s=c[A>>2]|0;p=t<<16>>16;r=0;while(1){if((r|0)>=(s|0))break;lb=e[f+4592+(r<<1)>>1]|0;b[Ka+(r<<1)>>1]=lb+((_((e[Na+(r<<1)>>1]|0)-lb<<16>>16,p)|0)>>>2);r=r+1|0}ue(La,Ka,s);p=0;while(1){if((p|0)>=(s|0))break;g[Ia+(p<<2)>>2]=+(b[La+(p<<1)>>1]|0)*.000244140625;p=p+1|0}Rd(Ha,Ia,Ma,u,c[A>>2]|0);lb=c[A>>2]|0;kb=Ha+(lb<<2)|0;lb=x-lb|0;v=+Ud(kb,lb);v=v+ +Ud(kb+(x<<2)|0,lb);if(!(vw)break i}else{a[z>>0]=t;q=v}t=t+-1|0;w=v}}while(0);if((a[z>>0]|0)==4)Sd(Na,Ga,c[A>>2]|0);t=c[Aa>>2]<<16>>16;t=(_(t,-5)|0)+(t*59246>>16)+3146|0;t=t+((c[Fa>>2]|0)==2?t>>1:0)|0;we(Ka,Na,c[A>>2]|0);j:do if((c[y>>2]|0)==1?(Ja=a[z>>0]|0,Ja<<24>>24<4):0){p=Ja<<24>>24;r=c[A>>2]|0;s=0;while(1){if((s|0)>=(r|0))break;lb=e[f+4592+(s<<1)>>1]|0;b[La+(s<<1)>>1]=lb+((_((e[Na+(s<<1)>>1]|0)-lb<<16>>16,p)|0)>>>2);s=s+1|0}we(Qa,La,r);r=a[z>>0]|0;r=(_(r,r)|0)<<27;p=c[A>>2]|0;r=r>>16;s=0;while(1){if((s|0)>=(p|0)){r=1;break j}lb=Ka+(s<<1)|0;b[lb>>1]=((b[lb>>1]|0)>>>1)+((_(b[Qa+(s<<1)>>1]|0,r)|0)>>>16);s=s+1|0}}else r=0;while(0);De(f+4836|0,Na,c[f+4784>>2]|0,Ka,t,c[f+4752>>2]|0,a[Ra>>0]|0);p=Pa+32|0;ue(p,Na,c[A>>2]|0);if(r){p=a[z>>0]|0;r=c[A>>2]|0;s=0;while(1){if((s|0)>=(r|0))break;lb=e[f+4592+(s<<1)>>1]|0;b[La+(s<<1)>>1]=lb+((_((e[Na+(s<<1)>>1]|0)-lb<<16>>16,p)|0)>>>2);s=s+1|0}ue(Pa,La,r)}else rf(Pa|0,p|0,c[A>>2]<<1|0)|0;s=0;while(1){if((s|0)==2)break;p=c[A>>2]|0;r=0;while(1){if((r|0)>=(p|0))break;g[bb+16+(s<<6)+(r<<2)>>2]=+(b[Pa+(s<<5)+(r<<1)>>1]|0)*.000244140625;r=r+1|0}s=s+1|0}u=c[Ea>>2]|0;lb=c[Fa>>2]|0;p=c[A>>2]|0;r=Qa+(p<<2)|0;t=p+u|0;s=t<<1;Rd(Qa,bb+16|0,Ma,s,p);jb=+g[bb>>2];g[bb+712>>2]=jb*jb*+Ud(r,u);jb=+g[bb+4>>2];t=r+(t<<2)|0;g[bb+716>>2]=jb*jb*+Ud(t,u);if((lb|0)==4){Rd(Qa,bb+80|0,Ma+(s<<2)|0,s,p);jb=+g[bb+8>>2];g[bb+720>>2]=jb*jb*+Ud(r,u);jb=+g[bb+12>>2];g[bb+724>>2]=jb*jb*+Ud(t,u)}x=f+4592|0;p=Na;u=x+32|0;do{b[x>>1]=b[p>>1]|0;x=x+2|0;p=p+2|0}while((x|0)<(u|0));k:do if((a[Ra>>0]|0)==2){q=1.0-1.0/(+X(+-((+g[bb+708>>2]+-12.0)*.25))+1.0)*.5;p=c[Fa>>2]|0;r=0;while(1){if((r|0)>=(p|0)){r=p;break k}lb=bb+(r<<2)|0;g[lb>>2]=+g[lb>>2]*q;r=r+1|0}}else r=c[Fa>>2]|0;while(0);q=+nb(+((21.0-+(c[Ba>>2]|0)*.0078125)*.33000001311302185));q=q/+(c[Ea>>2]|0);p=0;while(1){if((p|0)>=(r|0)){p=0;break}lb=bb+(p<<2)|0;jb=+g[lb>>2];jb=+O(+(jb*jb+ +g[bb+712+(p<<2)>>2]*q));g[lb>>2]=jb<32767.0?jb:32767.0;p=p+1|0}while(1){if((p|0)>=(r|0))break;c[Pa+(p<<2)>>2]=~~(+g[bb+(p<<2)>>2]*65536.0);p=p+1|0}rf(bb+728|0,Pa|0,r<<2|0)|0;p=f+7260|0;la=bb+744|0;a[la>>0]=a[p>>0]|0;ma=f+4828|0;na=(m|0)==2;oa=na&1;ge(ma,Pa,p,oa,r);p=c[Fa>>2]|0;r=0;while(1){if((r|0)>=(p|0))break;g[bb+(r<<2)>>2]=+(c[Pa+(r<<2)>>2]|0)*.0000152587890625;r=r+1|0}s=a[Ra>>0]|0;do if(s<<24>>24==2){r=f+4858|0;if(+g[bb+708>>2]+ +(c[f+4804>>2]|0)*.000030517578125>1.0){a[r>>0]=0;ka=r;r=0;break}else{a[r>>0]=1;ka=r;r=1;break}}else{r=f+4858|0;ka=r;r=a[r>>0]|0}while(0);lb=c[Aa>>2]|0;ja=bb+692|0;g[ja>>2]=+(c[f+4720>>2]|0)*-.05000000074505806+1.2000000476837158+ +(lb|0)*-.20000000298023224*.00390625+ +g[Ca>>2]*-.10000000149011612+ +g[Da>>2]*-.20000000298023224+ +(b[25404+(s<<24>>24>>1<<2)+(r<<24>>24<<1)>>1]|0)*.0009765625*.800000011920929;ia=f+5840|0;r=c[ia>>2]|0;t=f+6192+(r*36|0)|0;if((c[f+6184>>2]|0)!=0&(lb|0)>77){c[f+4816+(r<<2)>>2]=1;rf(Qa|0,f+144|0,4448)|0;x=t;p=ma;u=x+36|0;do{b[x>>1]=b[p>>1]|0;x=x+2|0;p=p+2|0}while((x|0)<(u|0));s=c[Fa>>2]|0;rf(Oa|0,bb|0,s<<2|0)|0;p=c[ia>>2]|0;do if(!p)hb=544;else{if(!(c[f+4816+(p+-1<<2)>>2]|0)){hb=544;break}r=f+4632|0;p=s}while(0);if((hb|0)==544){r=f+4632|0;a[r>>0]=a[f+7260>>0]|0;p=(d[t>>0]|0)+(c[f+6188>>2]|0)|0;a[t>>0]=(p&255)<<24>>24<63?p&255:63;p=c[Fa>>2]|0}he(Pa,t,r,oa,p);p=c[Fa>>2]|0;r=0;while(1){if((r|0)>=(p|0))break;g[bb+(r<<2)>>2]=+(c[Pa+(r<<2)>>2]|0)*.0000152587890625;r=r+1|0}Td(f,bb,t,Qa,f+6300+((c[ia>>2]|0)*320|0)|0,Xa);p=c[Fa>>2]|0;rf(bb|0,Oa|0,p<<2|0)|0}s=0;r=0;while(1){if((r|0)>=(p|0))break;s=(a[f+4828+r>>0]|0)+(s<<8)|0;r=r+1|0}x=eb;p=l;u=x+48|0;do{c[x>>2]=c[p>>2];x=x+4|0;p=p+4|0}while((x|0)<(u|0));U=f+144|0;rf(cb|0,U|0,4448)|0;V=a[Va>>0]|0;W=f+5864|0;Y=b[W>>1]|0;Z=f+5860|0;$=c[Z>>2]|0;ba=f+7260|0;ca=n+-5|0;da=l+24|0;ea=l+28|0;fa=f+4828|0;ga=f+4864|0;ha=l+20|0;J=0;A=0;B=0;S=256;R=0;D=0;P=-1;z=-1;T=0;Q=0;E=0;r=0;while(1){y=(s|0)==(P|0);do if(!y){if((s|0)==(z|0)){p=E;hb=571;break}if((T|0)>0){x=l;p=eb;u=x+48|0;do{c[x>>2]=c[p>>2];x=x+4|0;p=p+4|0}while((x|0)<(u|0));rf(U|0,cb|0,4448)|0;a[Va>>0]=V;b[W>>1]=Y;c[Z>>2]=$}Td(f,bb,fa,U,ga,Xa);t=(T|0)==6;if(t&(A|0)==0){c[fb>>2]=c[l>>2];c[fb+4>>2]=c[l+4>>2];c[fb+8>>2]=c[l+8>>2];c[fb+12>>2]=c[l+12>>2];c[fb+16>>2]=c[l+16>>2];c[fb+20>>2]=c[l+20>>2];u=c[da>>2]|0;c[gb>>2]=c[ea>>2];c[gb+4>>2]=c[ea+4>>2];c[gb+8>>2]=c[ea+8>>2];c[gb+12>>2]=c[ea+12>>2];c[gb+16>>2]=c[ea+16>>2]}else u=r;Ad(f,l,c[ia>>2]|0,0,m);Bd(l,a[Ra>>0]|0,a[ka>>0]|0,ga,c[Ua>>2]|0);p=(c[ha>>2]|0)+((aa(c[ea>>2]|0)|0)+-32)|0;if(t&(A|0)==0&(p|0)>(n|0)){c[l>>2]=c[fb>>2];c[l+4>>2]=c[fb+4>>2];c[l+8>>2]=c[fb+8>>2];c[l+12>>2]=c[fb+12>>2];c[l+16>>2]=c[fb+16>>2];c[l+20>>2]=c[fb+20>>2];c[da>>2]=u;c[ea>>2]=c[gb>>2];c[ea+4>>2]=c[gb+4>>2];c[ea+8>>2]=c[gb+8>>2];c[ea+12>>2]=c[gb+12>>2];c[ea+16>>2]=c[gb+16>>2];p=a[la>>0]|0;a[ba>>0]=p;r=0;while(1){if((r|0)>=(c[Fa>>2]|0))break;a[f+4828+r>>0]=4;r=r+1|0}if(!na)a[ma>>0]=p;b[W>>1]=Y;c[Z>>2]=$;p=0;while(1){if((p|0)>=(c[Ua>>2]|0))break;a[f+4864+p>>0]=0;p=p+1|0}Ad(f,l,c[ia>>2]|0,0,m);Bd(l,a[Ra>>0]|0,a[ka>>0]|0,ga,c[Ua>>2]|0);p=(c[ha>>2]|0)+((aa(c[ea>>2]|0)|0)+-32)|0}if(T|o|0){r=u;hb=571;break}if((p|0)>(n|0))F=u;else break b}else{p=Q;hb=571}while(0);if((hb|0)==571){hb=0;if((T|0)==6)break;else F=r}G=(p|0)>(n|0);l:do if(G){if(A|0){B=1;y=R;D=S<<16>>16;x=P;z=s;u=Q;E=p;break}if((T|0)>1){jb=+g[ja>>2]*1.5;g[ja>>2]=jb>1.5?jb:1.5;a[ka>>0]=0;B=0;s=-1}else{B=1;D=S<<16>>16;E=p}u=c[Fa>>2]|0;x=(T|0)==0;z=0;m:while(1){if((z|0)>=(u|0)){A=0;y=R;x=P;z=s;u=Q;break l}t=c[Ea>>2]|0;y=z+1|0;r=_(y,t)|0;t=_(z,t)|0;A=0;while(1){if((t|0)>=(r|0))break;kb=a[f+4864+t>>0]|0;lb=kb<<24>>24;t=t+1|0;A=A+(kb<<24>>24>-1?lb:0-lb|0)|0}r=Za+(z<<2)|0;do if(!x){t=$a+(z<<2)|0;if((A|0)<(c[r>>2]|0)?(c[t>>2]|0)==0:0)break;c[t>>2]=1;z=y;continue m}while(0);c[r>>2]=A;b[Ya+(z<<1)>>1]=S;z=y}}else{if((p|0)>=(ca|0))break b;r=S<<16>>16;if(y){A=1;y=r;x=s;u=p;break};c[fb>>2]=c[l>>2];c[fb+4>>2]=c[l+4>>2];c[fb+8>>2]=c[l+8>>2];c[fb+12>>2]=c[l+12>>2];c[fb+16>>2]=c[l+16>>2];c[fb+20>>2]=c[l+20>>2];F=c[da>>2]|0;c[gb>>2]=c[ea>>2];c[gb+4>>2]=c[ea+4>>2];c[gb+8>>2]=c[ea+8>>2];c[gb+12>>2]=c[ea+12>>2];c[gb+16>>2]=c[ea+16>>2];rf(_a|0,c[l>>2]|0,F|0)|0;rf(db|0,U|0,4448)|0;J=a[ba>>0]|0;A=1;y=r;x=s;u=p}while(0);do if(!(A&B)){if(G){if(S<<16>>16>=16384){t=32767;break}t=S<<16>>16<<1&65535;break}r=(p-n<<7|0)/(c[Ua>>2]|0)|0;p=r+2048|0;do if((r|0)<-2048)p=0;else{if((p|0)>3966){p=2147483647;break}s=p>>7;t=1<>16)<>7;else p=_(t>>7,p+((_(_(p,128-p|0)|0,-174)|0)>>16)|0)|0;p=t+p|0}while(0);t=S<<16>>16;t=(_(p>>16,t)|0)+((_(p&65535,t)|0)>>>16)&65535}else{t=D-y|0;r=y+((_(t,n-u|0)|0)/(E-u|0)|0)|0;s=r<<16>>16;t=t>>2;p=y+t|0;if((s|0)<=(p|0)){p=D-t|0;p=(s|0)<(p|0)?p:r}t=p&65535}while(0);p=c[Fa>>2]|0;r=0;while(1){if((r|0)>=(p|0))break;if(!(c[$a+(r<<2)>>2]|0))s=t;else s=b[Ya+(r<<1)>>1]|0;kb=c[bb+728+(r<<2)>>2]|0;lb=s<<16>>16;lb=(_(kb>>16,lb)|0)+((_(kb&65535,lb)|0)>>16)|0;c[ab+(r<<2)>>2]=(lb|0)>8388607?2147483392:((lb|0)<-8388608?-8388608:lb)<<8;r=r+1|0}a[ba>>0]=a[la>>0]|0;ge(ma,ab,ba,oa,p);r=c[Fa>>2]|0;s=0;p=0;while(1){if((p|0)>=(r|0)){p=0;break}s=(a[f+4828+p>>0]|0)+(s<<8)|0;p=p+1|0}while(1){if((p|0)>=(r|0))break;g[bb+(p<<2)>>2]=+(c[ab+(p<<2)>>2]|0)*.0000152587890625;p=p+1|0}S=t;R=y;P=x;T=T+1|0;Q=u;r=F}if((A|0)!=0&(y|(p|0)>(n|0))){c[l>>2]=c[fb>>2];c[l+4>>2]=c[fb+4>>2];c[l+8>>2]=c[fb+8>>2];c[l+12>>2]=c[fb+12>>2];c[l+16>>2]=c[fb+16>>2];c[l+20>>2]=c[fb+20>>2];c[da>>2]=r;c[ea>>2]=c[gb>>2];c[ea+4>>2]=c[gb+4>>2];c[ea+8>>2]=c[gb+8>>2];c[ea+12>>2]=c[gb+12>>2];c[ea+16>>2]=c[gb+16>>2];rf(c[l>>2]|0,_a|0,r|0)|0;rf(U|0,db|0,4448)|0;a[ba>>0]=J}}while(0);sf(f+7272|0,f+7272+(c[Ua>>2]<<2)|0,(c[Wa>>2]|0)+((c[Ta>>2]|0)*5|0)<<2|0)|0;if(c[Sa>>2]|0){lb=0;c[j>>2]=lb;i=ib;return 0}c[f+4636>>2]=c[bb+228+((c[f+4672>>2]|0)+-1<<2)>>2];a[f+4633>>0]=a[f+4857>>0]|0;c[f+4756>>2]=0;lb=(c[l+20>>2]|0)+((aa(c[l+28>>2]|0)|0)+-32)+7>>3;c[j>>2]=lb;i=ib;return 0}function Rd(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;var f=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0;switch(e|0){case 6:{f=b+4|0;h=b+8|0;i=b+12|0;j=b+16|0;k=b+20|0;l=6;while(1){if((l|0)>=(d|0))break;v=c+(l+-1<<2)|0;g[a+(l<<2)>>2]=+g[v+4>>2]-(+g[v>>2]*+g[b>>2]+ +g[v+-4>>2]*+g[f>>2]+ +g[v+-8>>2]*+g[h>>2]+ +g[v+-12>>2]*+g[i>>2]+ +g[v+-16>>2]*+g[j>>2]+ +g[v+-20>>2]*+g[k>>2]);l=l+1|0}c=e<<2;nf(a|0,0,c|0)|0;return}case 8:{f=b+4|0;h=b+8|0;i=b+12|0;j=b+16|0;k=b+20|0;l=b+24|0;m=b+28|0;n=8;while(1){if((n|0)>=(d|0))break;v=c+(n+-1<<2)|0;g[a+(n<<2)>>2]=+g[v+4>>2]-(+g[v>>2]*+g[b>>2]+ +g[v+-4>>2]*+g[f>>2]+ +g[v+-8>>2]*+g[h>>2]+ +g[v+-12>>2]*+g[i>>2]+ +g[v+-16>>2]*+g[j>>2]+ +g[v+-20>>2]*+g[k>>2]+ +g[v+-24>>2]*+g[l>>2]+ +g[v+-28>>2]*+g[m>>2]);n=n+1|0}c=e<<2;nf(a|0,0,c|0)|0;return}case 10:{f=b+4|0;h=b+8|0;i=b+12|0;j=b+16|0;k=b+20|0;l=b+24|0;m=b+28|0;n=b+32|0;o=b+36|0;p=10;while(1){if((p|0)>=(d|0))break;v=c+(p+-1<<2)|0;g[a+(p<<2)>>2]=+g[v+4>>2]-(+g[v>>2]*+g[b>>2]+ +g[v+-4>>2]*+g[f>>2]+ +g[v+-8>>2]*+g[h>>2]+ +g[v+-12>>2]*+g[i>>2]+ +g[v+-16>>2]*+g[j>>2]+ +g[v+-20>>2]*+g[k>>2]+ +g[v+-24>>2]*+g[l>>2]+ +g[v+-28>>2]*+g[m>>2]+ +g[v+-32>>2]*+g[n>>2]+ +g[v+-36>>2]*+g[o>>2]);p=p+1|0}c=e<<2;nf(a|0,0,c|0)|0;return}case 12:{f=b+4|0;h=b+8|0;i=b+12|0;j=b+16|0;k=b+20|0;l=b+24|0;m=b+28|0;n=b+32|0;o=b+36|0;p=b+40|0;q=b+44|0;r=12;while(1){if((r|0)>=(d|0))break;v=c+(r+-1<<2)|0;g[a+(r<<2)>>2]=+g[v+4>>2]-(+g[v>>2]*+g[b>>2]+ +g[v+-4>>2]*+g[f>>2]+ +g[v+-8>>2]*+g[h>>2]+ +g[v+-12>>2]*+g[i>>2]+ +g[v+-16>>2]*+g[j>>2]+ +g[v+-20>>2]*+g[k>>2]+ +g[v+-24>>2]*+g[l>>2]+ +g[v+-28>>2]*+g[m>>2]+ +g[v+-32>>2]*+g[n>>2]+ +g[v+-36>>2]*+g[o>>2]+ +g[v+-40>>2]*+g[p>>2]+ +g[v+-44>>2]*+g[q>>2]);r=r+1|0}c=e<<2;nf(a|0,0,c|0)|0;return}case 16:{f=b+4|0;h=b+8|0;n=b+12|0;o=b+16|0;p=b+20|0;q=b+24|0;r=b+28|0;s=b+32|0;t=b+36|0;u=b+40|0;i=b+44|0;j=b+48|0;k=b+52|0;l=b+56|0;m=b+60|0;v=16;while(1){if((v|0)>=(d|0))break;w=c+(v+-1<<2)|0;g[a+(v<<2)>>2]=+g[w+4>>2]-(+g[w>>2]*+g[b>>2]+ +g[w+-4>>2]*+g[f>>2]+ +g[w+-8>>2]*+g[h>>2]+ +g[w+-12>>2]*+g[n>>2]+ +g[w+-16>>2]*+g[o>>2]+ +g[w+-20>>2]*+g[p>>2]+ +g[w+-24>>2]*+g[q>>2]+ +g[w+-28>>2]*+g[r>>2]+ +g[w+-32>>2]*+g[s>>2]+ +g[w+-36>>2]*+g[t>>2]+ +g[w+-40>>2]*+g[u>>2]+ +g[w+-44>>2]*+g[i>>2]+ +g[w+-48>>2]*+g[j>>2]+ +g[w+-52>>2]*+g[k>>2]+ +g[w+-56>>2]*+g[l>>2]+ +g[w+-60>>2]*+g[m>>2]);v=v+1|0}w=e<<2;nf(a|0,0,w|0)|0;return}default:{w=e<<2;nf(a|0,0,w|0)|0;return}}}function Sd(a,d,f){a=a|0;d=d|0;f=f|0;var h=0,j=0,l=0.0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0;T=i;i=i+176|0;O=T+124|0;Q=T+72|0;P=T+64|0;R=T;j=0;while(1){if((j|0)>=(f|0))break;l=+g[d+(j<<2)>>2]*65536.0;h=(g[k>>2]=l,c[k>>2]|0);if((h&2130706432)>>>0<=1249902592){h=(h|0)<0;l=h?l+-8388608.0+8388608.0:l+8388608.0+-8388608.0;if(l==0.0)l=h?-0.0:0.0}c[R+(j<<2)>>2]=~~l;j=j+1|0}c[P>>2]=O;c[P+4>>2]=Q;L=f>>1;M=O+(L<<2)|0;c[M>>2]=65536;N=Q+(L<<2)|0;c[N>>2]=65536;h=0;while(1){if((L|0)<=(h|0))break;K=c[R+(L-h+-1<<2)>>2]|0;J=c[R+(h+L<<2)>>2]|0;c[O+(h<<2)>>2]=0-K-J;c[Q+(h<<2)>>2]=J-K;h=h+1|0}h=L;while(1){if((h|0)<=0){h=2;break}K=h+-1|0;J=O+(K<<2)|0;c[J>>2]=(c[J>>2]|0)-(c[O+(h<<2)>>2]|0);J=Q+(K<<2)|0;c[J>>2]=(c[J>>2]|0)+(c[Q+(h<<2)>>2]|0);h=K}while(1){if((h|0)>(L|0)){h=2;break}else j=L;while(1){if((j|0)<=(h|0))break;K=O+(j+-2<<2)|0;c[K>>2]=(c[K>>2]|0)-(c[O+(j<<2)>>2]|0);j=j+-1|0}K=O+(h+-2<<2)|0;c[K>>2]=(c[K>>2]|0)-(c[O+(h<<2)>>2]<<1);h=h+1|0}while(1){if((h|0)>(L|0))break;else j=L;while(1){if((j|0)<=(h|0))break;K=Q+(j+-2<<2)|0;c[K>>2]=(c[K>>2]|0)-(c[Q+(j<<2)>>2]|0);j=j+-1|0}K=Q+(h+-2<<2)|0;c[K>>2]=(c[K>>2]|0)-(c[Q+(h<<2)>>2]<<1);h=h+1|0}h=c[M>>2]|0;K=(L|0)==8;a:do if(K)h=(c[O>>2]|0)+((c[O+4>>2]|0)+((c[O+8>>2]|0)+((c[O+12>>2]|0)+((c[O+16>>2]|0)+((c[O+20>>2]|0)+((c[O+24>>2]|0)+((c[O+28>>2]|0)+(h<<1)<<1)<<1)<<1)<<1)<<1)<<1)<<1)|0;else{d=L;while(1){j=d+-1|0;if((d|0)<=0)break a;d=j;h=(c[O+(j<<2)>>2]|0)+(h<<1)|0}}while(0);b:do if((h|0)<0){b[a>>1]=0;h=c[N>>2]|0;if(K){j=Q;d=1;h=(c[Q>>2]|0)+((c[Q+4>>2]|0)+((c[Q+8>>2]|0)+((c[Q+12>>2]|0)+((c[Q+16>>2]|0)+((c[Q+20>>2]|0)+((c[Q+24>>2]|0)+((c[Q+28>>2]|0)+(h<<1)<<1)<<1)<<1)<<1)<<1)<<1)<<1)|0;break}else d=L;while(1){j=d+-1|0;if((d|0)<=0){j=Q;d=1;break b}d=j;h=(c[Q+(j<<2)>>2]|0)+(h<<1)|0}}else{j=O;d=0}while(0);w=O+28|0;x=O+24|0;y=O+20|0;z=O+16|0;A=O+12|0;B=O+8|0;C=O+4|0;D=Q+28|0;E=Q+24|0;F=Q+20|0;G=Q+16|0;H=Q+12|0;I=Q+8|0;J=Q+4|0;v=0;c:while(1){o=1;m=0;n=8192;d:while(1){u=o;while(1){o=b[27508+(u<<1)>>1]|0;p=pe(j,o,L)|0;if((h|0)<1){if((p|0)>=(m|0))break;if(!((h|0)<0|(p|0)>(0-m|0)))break}else if((p|0)<=(0-m|0))break;if((u|0)>127)break d;else{u=u+1|0;m=0;n=o;h=p}}m=(p|0)==0&1;s=-256;t=0;while(1){if((t|0)==3)break;q=n+o|0;q=(q>>1)+(q&1)|0;r=pe(j,q,L)|0;if((h|0)<1)if((r&h|0)>-1){o=q;p=r}else S=42;else if((r|0)<1){o=q;p=r}else S=42;if((S|0)==42){S=0;s=s+(128>>>t)|0;n=q;h=r}t=t+1|0}j=h-p|0;if((((h|0)>0?h:0-h|0)|0)<65536)if((h|0)==(p|0))h=s;else h=s+(((h<<5)+(j>>1)|0)/(j|0)|0)|0;else h=s+((h|0)/(j>>5|0)|0)|0;h=(u<<8)+h|0;b[a+(d<<1)>>1]=(h|0)<32767?h:32767;h=d+1|0;if((h|0)>=(f|0)){S=77;break c}o=u;j=c[P+((h&1)<<2)>>2]|0;d=h;n=b[27508+(u+-1<<1)>>1]|0;h=1-(h&2)<<12}m=v+1|0;if((v|0)>15)break;re(R,f,65536-(1<>2]=65536;c[N>>2]=65536;h=0;while(1){if((L|0)<=(h|0)){h=L;break}v=c[R+(L-h+-1<<2)>>2]|0;u=c[R+(h+L<<2)>>2]|0;c[O+(h<<2)>>2]=0-v-u;c[Q+(h<<2)>>2]=u-v;h=h+1|0}while(1){if((h|0)<=0){h=2;break}v=h+-1|0;u=O+(v<<2)|0;c[u>>2]=(c[u>>2]|0)-(c[O+(h<<2)>>2]|0);u=Q+(v<<2)|0;c[u>>2]=(c[u>>2]|0)+(c[Q+(h<<2)>>2]|0);h=v}while(1){if((h|0)>(L|0)){h=2;break}else j=L;while(1){if((j|0)<=(h|0))break;v=O+(j+-2<<2)|0;c[v>>2]=(c[v>>2]|0)-(c[O+(j<<2)>>2]|0);j=j+-1|0}v=O+(h+-2<<2)|0;c[v>>2]=(c[v>>2]|0)-(c[O+(h<<2)>>2]<<1);h=h+1|0}while(1){if((h|0)>(L|0))break;else j=L;while(1){if((j|0)<=(h|0))break;v=Q+(j+-2<<2)|0;c[v>>2]=(c[v>>2]|0)-(c[Q+(j<<2)>>2]|0);j=j+-1|0}v=Q+(h+-2<<2)|0;c[v>>2]=(c[v>>2]|0)-(c[Q+(h<<2)>>2]<<1);h=h+1|0}h=c[M>>2]|0;e:do if(K)h=(c[O>>2]|0)+((c[C>>2]|0)+((c[B>>2]|0)+((c[A>>2]|0)+((c[z>>2]|0)+((c[y>>2]|0)+((c[x>>2]|0)+((c[w>>2]|0)+(h<<1)<<1)<<1)<<1)<<1)<<1)<<1)<<1)|0;else{d=L;while(1){j=d+-1|0;if((d|0)<=0)break e;d=j;h=(c[O+(j<<2)>>2]|0)+(h<<1)|0}}while(0);if((h|0)>=0){v=m;j=O;d=0;continue}b[a>>1]=0;h=c[N>>2]|0;if(K){v=m;j=Q;d=1;h=(c[Q>>2]|0)+((c[J>>2]|0)+((c[I>>2]|0)+((c[H>>2]|0)+((c[G>>2]|0)+((c[F>>2]|0)+((c[E>>2]|0)+((c[D>>2]|0)+(h<<1)<<1)<<1)<<1)<<1)<<1)<<1)<<1)|0;continue}else d=L;while(1){j=d+-1|0;if((d|0)<=0){v=m;j=Q;d=1;continue c}d=j;h=(c[Q+(j<<2)>>2]|0)+(h<<1)|0}}if((S|0)==77){i=T;return}h=32768/(f+1|0)|0;b[a>>1]=h;j=1;while(1){if((j|0)>=(f|0))break;S=(h&65535)+(e[a>>1]|0)|0;b[a+(j<<1)>>1]=S;h=S;j=j+1|0}i=T;return}function Td(d,e,f,h,j,l){d=d|0;e=e|0;f=f|0;h=h|0;j=j|0;l=l|0;var m=0.0,n=0,o=0.0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0;E=i;i=i+1008|0;D=E+360|0;x=E+48|0;B=E+296|0;A=E+256|0;w=E+64|0;z=E+32|0;C=E+16|0;y=E;v=c[d+4672>>2]|0;p=d+4728|0;t=0;while(1){if((t|0)>=(v|0)){q=0;break}q=c[p>>2]|0;r=t*24|0;u=0;while(1){if((u|0)>=(q|0))break;s=r+u|0;m=+g[e+244+(s<<2)>>2]*8192.0;n=(g[k>>2]=m,c[k>>2]|0);if((n&2130706432)>>>0<=1249902592){n=(n|0)<0;m=n?m+-8388608.0+8388608.0:m+8388608.0+-8388608.0;if(m==0.0)m=n?-0.0:0.0}b[w+(s<<1)>>1]=~~m;u=u+1|0}t=t+1|0}while(1){if((q|0)>=(v|0))break;m=+g[e+644+(q<<2)>>2]*16384.0;n=(g[k>>2]=m,c[k>>2]|0);if((n&2130706432)>>>0<=1249902592){n=(n|0)<0;m=n?m+-8388608.0+8388608.0:m+8388608.0+-8388608.0;if(m==0.0)m=n?-0.0:0.0}p=~~m<<16;m=+g[e+628+(q<<2)>>2]*16384.0;n=(g[k>>2]=m,c[k>>2]|0);if((n&2130706432)>>>0<=1249902592){n=(n|0)<0;m=n?m+-8388608.0+8388608.0:m+8388608.0+-8388608.0;if(m==0.0)m=n?-0.0:0.0}c[z+(q<<2)>>2]=p|~~m&65535;m=+g[e+660+(q<<2)>>2]*16384.0;n=(g[k>>2]=m,c[k>>2]|0);if((n&2130706432)>>>0<=1249902592){n=(n|0)<0;m=n?m+-8388608.0+8388608.0:m+8388608.0+-8388608.0;if(m==0.0)m=n?-0.0:0.0}c[C+(q<<2)>>2]=~~m;m=+g[e+676+(q<<2)>>2]*16384.0;n=(g[k>>2]=m,c[k>>2]|0);if((n&2130706432)>>>0<=1249902592){n=(n|0)<0;m=n?m+-8388608.0+8388608.0:m+8388608.0+-8388608.0;if(m==0.0)m=n?-0.0:0.0}c[y+(q<<2)>>2]=~~m;q=q+1|0}m=+g[e+692>>2]*1024.0;n=(g[k>>2]=m,c[k>>2]|0);if((n&2130706432)>>>0<=1249902592){n=(n|0)<0;m=n?m+-8388608.0+8388608.0:m+8388608.0+-8388608.0;if(m==0.0)m=n?-0.0:0.0}p=v*5|0;q=0;while(1){if((q|0)>=(p|0))break;o=+g[e+144+(q<<2)>>2]*16384.0;n=(g[k>>2]=o,c[k>>2]|0);if((n&2130706432)>>>0<=1249902592){n=(n|0)<0;o=n?o+-8388608.0+8388608.0:o+8388608.0+-8388608.0;if(o==0.0)o=n?-0.0:0.0}b[A+(q<<1)>>1]=~~o;q=q+1|0}t=~~m;p=d+4732|0;s=0;while(1){if((s|0)==2){p=0;break}q=c[p>>2]|0;r=0;while(1){if((r|0)>=(q|0))break;m=+g[e+16+(s<<6)+(r<<2)>>2]*4096.0;n=(g[k>>2]=m,c[k>>2]|0);if((n&2130706432)>>>0<=1249902592){n=(n|0)<0;m=n?m+-8388608.0+8388608.0:m+8388608.0+-8388608.0;if(m==0.0)m=n?-0.0:0.0}b[B+(s<<5)+(r<<1)>>1]=~~m;r=r+1|0}s=s+1|0}while(1){if((p|0)>=(v|0))break;m=+g[e+(p<<2)>>2]*65536.0;n=(g[k>>2]=m,c[k>>2]|0);if((n&2130706432)>>>0<=1249902592){n=(n|0)<0;m=n?m+-8388608.0+8388608.0:m+8388608.0+-8388608.0;if(m==0.0)m=n?-0.0:0.0}c[x+(p<<2)>>2]=~~m;p=p+1|0}if((a[f+29>>0]|0)==2)q=b[25412+(a[f+33>>0]<<1)>>1]|0;else q=0;p=c[d+4676>>2]|0;r=0;while(1){if((r|0)>=(p|0))break;m=+g[l+(r<<2)>>2];n=(g[k>>2]=m,c[k>>2]|0);if((n&2130706432)>>>0<=1249902592){n=(n|0)<0;m=n?m+-8388608.0+8388608.0:m+8388608.0+-8388608.0;if(m==0.0)m=n?-0.0:0.0}b[D+(r<<1)>>1]=~~m;r=r+1|0}if((c[d+4720>>2]|0)<=1?(c[d+4764>>2]|0)<=0:0){je(d,h,f,D,j,B,A,w,y,C,z,x,e+228|0,t,q);i=E;return}ke(d,h,f,D,j,B,A,w,y,C,z,x,e+228|0,t,q);i=E;return}function Ud(a,b){a=a|0;b=b|0;var c=0.0,d=0,e=0,f=0,h=0.0,i=0.0,j=0.0,k=0.0;e=b+-3|0;d=((e|0)>0?e:0)+3&-4;f=0;c=0.0;while(1){if((f|0)>=(e|0))break;k=+g[a+(f<<2)>>2];j=+g[a+((f|1)<<2)>>2];i=+g[a+((f|2)<<2)>>2];h=+g[a+((f|3)<<2)>>2];f=f+4|0;c=c+(k*k+j*j+i*i+h*h)}while(1){if((d|0)>=(b|0))break;k=+g[a+(d<<2)>>2];d=d+1|0;c=c+k*k}return +c}function Vd(a,b,c){a=a|0;b=b|0;c=c|0;var d=0.0,e=0,f=0,h=0,i=0.0,j=0,k=0,l=0;f=c+-3|0;e=((f|0)>0?f:0)+3&-4;h=0;d=0.0;while(1){if((h|0)>=(f|0))break;l=h|1;k=h|2;j=h|3;i=d+(+g[a+(h<<2)>>2]*+g[b+(h<<2)>>2]+ +g[a+(l<<2)>>2]*+g[b+(l<<2)>>2]+ +g[a+(k<<2)>>2]*+g[b+(k<<2)>>2]+ +g[a+(j<<2)>>2]*+g[b+(j<<2)>>2]);h=h+4|0;d=i}while(1){if((e|0)>=(c|0))break;i=d+ +g[a+(e<<2)>>2]*+g[b+(e<<2)>>2];e=e+1|0;d=i}return +d}function Wd(e,f,g,h,i,j,k,l){e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;j=j|0;k=k|0;l=l|0;var m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0;if((j|0)==0|(f|0)<0){j=-1;return j|0}if(!f){j=-4;return j|0}S=a[e>>0]|0;do if(S<<24>>24>=0){if((S&96)==96){o=(S&8)==0?480:960;break}n=(S&255)>>>3&3;if((n|0)==3)o=2880;else o=(48e3<>>0)/100|0}else o=(48e3<<((S&255)>>>3&3)>>>0)/400|0;while(0);q=e+1|0;x=f+-1|0;a:do switch(S&3|0){case 0:{C=q;D=x;E=0;F=1;p=x;A=0;u=47;break}case 1:{if(!g)if(!(x&1)){I=(x|0)/2|0;b[j>>1]=I;G=q;H=2;J=0;u=61;break a}else{j=-4;return j|0}else{N=q;M=x;O=1;Q=2;P=x;R=0;u=48}break}case 2:{if((f|0)<2){b[j>>1]=-1;j=-4;return j|0}n=a[q>>0]|0;do if((n&255)<252){o=1;n=n&255}else{if((f|0)>=3){o=2;n=(d[e+2>>0]<<2)+(n&255)&65535;break}b[j>>1]=-1;j=-4;return j|0}while(0);b[j>>1]=n;f=x-o|0;n=n<<16>>16;if((f|0)<(n|0)){j=-4;return j|0}else{C=q+o|0;D=f;E=0;F=2;p=f-n|0;A=0;u=47;break a}}default:{if((f|0)<2){j=-4;return j|0}n=e+2|0;t=a[q>>0]|0;B=t&63;if((B|0)==0|(_(o,B)|0)>>>0>5760){j=-4;return j|0}o=f+-2|0;if(t&64){q=0;while(1){if((o|0)<1){y=-4;u=74;break}s=n+1|0;r=a[n>>0]|0;if(r<<24>>24!=-1)break;n=s;o=o+-255|0;q=q+254|0}if((u|0)==74)return y|0;f=r&255;n=o+-1-f|0;if((n|0)<0){j=-4;return j|0}else{r=n;w=q+f|0}}else{s=n;r=o;w=0}u=(t&255)>>>7;v=u&255^1;if(u<<24>>24!=1){if(g|0){N=s;M=r;O=v;Q=B;P=x;R=w;u=48;break a}p=(r|0)/(B|0)|0;if((_(p,B)|0)!=(r|0)){j=-4;return j|0}n=B+-1|0;o=p&65535;f=0;while(1){if((f|0)>=(n|0)){C=s;D=r;E=v;F=B;A=w;u=47;break a}b[j+(f<<1)>>1]=o;f=f+1|0}}u=B+-1|0;t=r;q=0;while(1){if((q|0)>=(u|0)){u=41;break}z=j+(q<<1)|0;if((t|0)<1){u=33;break}n=a[s>>0]|0;if((n&255)<252){n=n&255;b[z>>1]=n;o=1}else{if((t|0)<2){u=37;break}n=(d[s+1>>0]<<2)+(n&255)&65535;b[z>>1]=n;o=2}f=t-o|0;n=n<<16>>16;if((n|0)>(f|0)){y=-4;u=74;break}s=s+o|0;t=f;q=q+1|0;r=r-(o+n)|0}if((u|0)==33){b[z>>1]=-1;j=-4;return j|0}else if((u|0)==37){b[z>>1]=-1;j=-4;return j|0}else if((u|0)==41){if((r|0)<0)y=-4;else{C=s;D=t;E=v;F=B;p=r;A=w;u=47;break a}return y|0}else if((u|0)==74)return y|0}}while(0);if((u|0)==47)if(!g){G=C;H=F;I=p;J=A;u=61}else{N=C;M=D;O=E;Q=F;P=p;R=A;u=48}b:do if((u|0)==48){m=j+(Q<<1)+-2|0;if((M|0)<1){b[m>>1]=-1;j=-4;return j|0}n=a[N>>0]|0;do if((n&255)<252){L=n&255;b[m>>1]=L;f=1;m=L}else{if((M|0)>=2){L=(d[N+1>>0]<<2)+(n&255)&65535;b[m>>1]=L;f=2;m=L;break}b[m>>1]=-1;j=-4;return j|0}while(0);o=M-f|0;p=Q+-1|0;q=j+(p<<1)|0;n=m<<16>>16;if((n|0)>(o|0)){j=-4;return j|0}m=N+f|0;if(!O){if((f+n|0)>(P|0))y=-4;else{K=Q;L=R;break}return y|0}if((_(n,Q)|0)>(o|0)){j=-4;return j|0}else n=0;while(1){if((n|0)>=(p|0)){K=Q;L=R;break b}b[j+(n<<1)>>1]=b[q>>1]|0;n=n+1|0}}else if((u|0)==61)if((I|0)>1275){j=-4;return j|0}else{b[j+(H+-1<<1)>>1]=I;m=G;K=H;L=J;break}while(0);if(k|0)c[k>>2]=m-e;o=(i|0)==0;n=0;while(1){if((n|0)>=(K|0))break;if(!o)c[i+(n<<2)>>2]=m;m=m+(b[j+(n<<1)>>1]|0)|0;n=n+1|0}if(l|0)c[l>>2]=L+(m-e);if(!h){j=K;return j|0}a[h>>0]=S;j=K;return j|0}function Xd(a,c,d,e,f,h,i,j,k,l){a=a|0;c=c|0;d=d|0;e=e|0;f=f|0;h=h|0;i=i|0;j=j|0;k=k|0;l=l|0;var m=0,n=0.0,o=0,p=0,q=0;q=_(c,j)|0;c=_(b[a+(i<<1)>>1]|0,j)|0;if((k|0)!=1){p=(q|0)/(k|0)|0;c=(c|0)<(p|0)?c:p}o=(l|0)==0;p=o?i:0;m=o?h:0;o=o?c:0;k=a+(m<<1)|0;c=b[k>>1]|0;h=_(c<<16>>16,j)|0;i=e;l=0;while(1){if((l|0)>=(_(c<<16>>16,j)|0))break;g[i>>2]=0.0;c=b[k>>1]|0;i=i+4|0;l=l+1|0}c=m;k=d+(h<<2)|0;a:while(1){if((c|0)>=(p|0))break;l=_(b[a+(c<<1)>>1]|0,j)|0;m=c+1|0;d=_(b[a+(m<<1)>>1]|0,j)|0;n=+X(+((+g[f+(c<<2)>>2]+ +g[17220+(c<<2)>>2])*.6931471805599453));h=i;c=l;l=k;while(1){k=l+4|0;i=h+4|0;g[h>>2]=+g[l>>2]*n;c=c+1|0;if((c|0)<(d|0)){h=i;l=k}else{c=m;continue a}}}nf(e+(o<<2)|0,0,q-o<<2|0)|0;return}function Yd(e,f,h,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B){e=e|0;f=f|0;h=h|0;j=j|0;k=k|0;l=l|0;m=m|0;n=n|0;o=o|0;p=p|0;q=q|0;r=r|0;s=s|0;t=t|0;u=u|0;v=v|0;w=w|0;x=x|0;y=y|0;z=z|0;A=A|0;B=B|0;var C=0,D=0,E=0.0,F=0.0,G=0,H=0,I=0.0,J=0,K=0,L=0,M=0,N=0.0,O=0.0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,$=0,ba=0,ca=0,da=0,ea=0,fa=0,ga=0,ha=0,ia=0,ja=0,ka=0,la=0,ma=0,na=0,oa=0,pa=0,qa=0,ra=0,sa=0,ta=0,ua=0,va=0,wa=0,xa=0,ya=0,za=0,Aa=0,Ba=0,Ca=0,Da=0,Ea=0,Fa=0,Ga=0,Ha=0,Ia=0,Ja=0,Ka=0,La=0,Ma=0,Na=0,Oa=0,Pa=0.0;Oa=i;i=i+1520|0;Ia=Oa+192|0;La=Oa+24|0;Ma=Oa;Na=Oa+144|0;Ja=Oa+92|0;Ka=Oa+40|0;Ha=Oa+244|0;Da=c[f+32>>2]|0;Ga=l|0?2:1;D=(e|0)==0;if(D){Ba=0;Ca=1}else{za=(l|0)!=0&(r|0)==0;Ca=(A|0)>7;Ba=za&Ca;Ca=za&Ca}ta=(p|0)==0?1:1<>1]<>2]|0;p=b[Da+(A+-1<<1)>>1]|0;C=p<>1]|0)-p<>2]=n;c[Ia+28>>2]=w;c[Ia>>2]=e;c[Ia+16>>2]=s;c[Ia+8>>2]=f;na=Ia+40|0;c[na>>2]=c[z>>2];c[Ia+20>>2]=q;c[Ia+44>>2]=B;c[Ia+4>>2]=Ca&1;fa=Ia+48|0;c[fa>>2]=0;ga=Ia+12|0;ha=j+-1|0;ia=(l|0)==0;ja=w+20|0;ka=w+28|0;la=Ia+32|0;ma=Ia+24|0;Z=f+12|0;$=(1<1;Y=h;B=0;C=1;while(1){if((Y|0)>=(j|0))break;c[ga>>2]=Y;R=(Y|0)==(ha|0);S=Da+(Y<<1)|0;W=b[S>>1]<>1]<>2]|0;A=32-(aa(T|0)|0)|0;T=T>>>(A+-16|0);X=(T>>>12)+-8|0;X=(c[ja>>2]<<3)-((A<<3)+(X+(T>>>0>(c[5272+(X<<2)>>2]|0)>>>0&1)))|0;T=v-((Y|0)==(h|0)?0:X)|0;A=u-X|0;c[la>>2]=A+-1;if((Y|0)<(y|0)?(Ea=y-Y|0,Ea=(c[o+(Y<<2)>>2]|0)+((T|0)/(((Ea|0)>3?3:Ea)|0)|0)|0,Fa=(A|0)<(Ea|0),!(((Fa?A:Ea)|0)<16384&((Fa?A:Ea)|0)<0)):0)U=((Fa?A:Ea)|0)>16383?16383:Fa?A:Ea;else U=0;if(Ca?((b[S>>1]<=(b[ua>>1]<>2]|0;c[ma>>2]=M;Q=(Y|0)<(c[Z>>2]|0);p=Q?p:0;P=Q?D:xa;Q=Q?e:ia?0:xa;p=R?(Ba?p:0):p;if((B|0)!=0?(q|0)!=3|ea|(M|0)<0:0){f=(b[Da+(B<<1)>>1]<>1]<(A|0));A=A+W|0;e=B+-1|0;while(1){C=e+1|0;if((b[Da+(C<<1)>>1]<>0];C=C|d[m+(M+Ga+-1)>>0];if((D|0)<(e|0))D=D+1|0;else{D=A;G=C;break}}}else{f=-1;D=$;G=$}a:do if(r)if((Y|0)==(s|0)){if(!Ca){Aa=31;break}A=Da+(s<<1)|0;C=0;while(1){if((C|0)>=((b[A>>1]<>2]=(+g[Aa>>2]+ +g[za+(C<<2)>>2])*.5;C=C+1|0}}else{v=(U|0)/2|0;C=(f|0)==-1;A=C?0:xa+(f<<2)|0;if(R){A=Zd(Ia,P,W,v,ta,A,x,0,1.0,p,D)|0;D=C?0:za+(f<<2)|0;C=0}else{A=Zd(Ia,P,W,v,ta,A,x,xa+(b[S>>1]<>1]<>1]<>2]=0;if(R)A=0;else A=xa+(b[S>>1]<>2];O=+g[n+(Y+(c[wa>>2]|0)<<2)>>2];I=(N>2]|0;r=c[ba>>2]|0;c[La>>2]=c[ca>>2];c[La+4>>2]=c[ca+4>>2];c[La+8>>2]=c[ca+8>>2];c[La+12>>2]=c[ca+12>>2];v=c[da>>2]|0;c[Ma>>2]=c[ka>>2];c[Ma+4>>2]=c[ka+4>>2];c[Ma+8>>2]=c[ka+8>>2];c[Ma+12>>2]=c[ka+12>>2];c[Ma+16>>2]=c[ka+16>>2];A=Ja;C=Ia;D=A+52|0;do{c[A>>2]=c[C>>2];A=A+4|0;C=C+4|0}while((A|0)<(D|0));L=W<<2;rf(oa|0,P|0,L|0)|0;rf(pa|0,Q|0,L|0)|0;c[fa>>2]=-1;H=(f|0)==-1;if(R)A=0;else A=xa+(b[S>>1]<=(W|0)){A=0;E=0.0;break}I=F+ +g[oa+(A<<2)>>2]*+g[P+(A<<2)>>2];A=A+1|0;F=I}while(1){if((A|0)>=(W|0))break;I=E+ +g[pa+(A<<2)>>2]*+g[Q+(A<<2)>>2];A=A+1|0;E=I}I=N*F+O*E;A=Na;C=w;D=A+48|0;do{c[A>>2]=c[C>>2];A=A+4|0;C=C+4|0}while((A|0)<(D|0));A=Ka;C=Ia;D=A+52|0;do{c[A>>2]=c[C>>2];A=A+4|0;C=C+4|0}while((A|0)<(D|0));rf(qa|0,P|0,L|0)|0;rf(ra|0,Q|0,L|0)|0;if(!R)rf(sa|0,xa+(b[S>>1]<>2]=e;c[ba>>2]=r;c[ca>>2]=c[La>>2];c[ca+4>>2]=c[La+4>>2];c[ca+8>>2]=c[La+8>>2];c[ca+12>>2]=c[La+12>>2];c[da>>2]=v;c[ka>>2]=c[Ma>>2];c[ka+4>>2]=c[Ma+4>>2];c[ka+8>>2]=c[Ma+8>>2];c[ka+12>>2]=c[Ma+12>>2];c[ka+16>>2]=c[Ma+16>>2];A=Ia;C=Ja;D=A+48|0;do{c[A>>2]=c[C>>2];A=A+4|0;C=C+4|0}while((A|0)<(D|0));rf(P|0,oa|0,L|0)|0;rf(Q|0,pa|0,L|0)|0;c[fa>>2]=1;if(R)A=0;else A=xa+(b[S>>1]<=(W|0)){A=0;E=0.0;break}E=F+ +g[oa+(A<<2)>>2]*+g[P+(A<<2)>>2];A=A+1|0;F=E}while(1){if((A|0)>=(W|0))break;Pa=E+ +g[pa+(A<<2)>>2]*+g[Q+(A<<2)>>2];A=A+1|0;E=Pa}if(!(I>=N*F+O*E)){r=0;e=C;A=C}else{A=w;C=Na;D=A+48|0;do{c[A>>2]=c[C>>2];A=A+4|0;C=C+4|0}while((A|0)<(D|0));A=Ia;C=Ka;D=A+52|0;do{c[A>>2]=c[C>>2];A=A+4|0;C=C+4|0}while((A|0)<(D|0));rf(P|0,qa|0,L|0)|0;rf(Q|0,ra|0,L|0)|0;if(!R)rf(xa+(b[S>>1]<>0]=e;a[m+(v+Ga+-1)>>0]=A;v=T+((c[o+(Y<<2)>>2]|0)+X)|0;Y=V;C=(U|0)>(W<<3|0)&1}c[z>>2]=c[na>>2];i=Oa;return}function Zd(b,e,f,h,i,j,k,l,m,n,o){b=b|0;e=e|0;f=f|0;h=h|0;i=i|0;j=j|0;k=k|0;l=l|0;m=+m;n=n|0;o=o|0;var p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0.0,C=0.0,D=0;p=c[b>>2]|0;v=c[b+24>>2]|0;y=(i|0)==1&1;u=(f>>>0)/(i>>>0)|0;if((f|0)==1){w=c[b+28>>2]|0;z=b+32|0;x=w+12|0;k=w+16|0;h=w+20|0;v=w+8|0;i=w+4|0;s=w+24|0;t=w+44|0;y=b+4|0;if((c[z>>2]|0)>7){if(!p){n=c[x>>2]|0;j=c[k>>2]|0;if(!j){p=c[i>>2]|0;o=c[v>>2]|0;q=0;do{if(o>>>0

>>0){j=o+1|0;c[v>>2]=j;o=j;j=d[(c[w>>2]|0)+(p-j)>>0]|0}else j=0;n=n|j<>>1}else{u=+g[e>>2]<0.0&1;n=c[x>>2]|0;p=c[k>>2]|0;if((p+1|0)>>>0>32){q=7-p|0;q=p+((q|0)>-8?q:-8)&-8;r=p;do{j=c[v>>2]|0;o=c[i>>2]|0;if(((c[s>>2]|0)+j|0)>>>0>>0){j=j+1|0;c[v>>2]=j;a[(c[w>>2]|0)+(o-j)>>0]=n;j=0}else j=-1;c[t>>2]=c[t>>2]|j;n=n>>>8;r=r+-8|0}while((r|0)>7);p=p+-8-q|0}j=u;o=p+1|0;n=n|u<>2]=n;c[k>>2]=o;c[h>>2]=(c[h>>2]|0)+1;c[z>>2]=(c[z>>2]|0)+-8}else j=0;if(c[y>>2]|0)g[e>>2]=j|0?-1.0:1.0;if(!l){l=1;return l|0}c[l>>2]=c[e>>2];l=1;return l|0}z=(v|0)>0?v:0;do if(n)if(!j)n=0;else{if((z|0)==0?!((u&1|0)==0&(v|0)<0|(i|0)>1):0){n=j;break}rf(n|0,j|0,f<<2|0)|0}else n=j;while(0);w=(p|0)==0;x=(n|0)==0;t=0;while(1){if((t|0)>=(z|0))break;a:do if(!w){j=1<>t>>1;q=j<<1;r=0;while(1){if((r|0)<(j|0))s=0;else break a;while(1){if((s|0)>=(p|0))break;D=e+((_(q,s)|0)+r<<2)|0;C=+g[D>>2]*.7071067690849304;A=e+(((s<<1|1)<>2]*.7071067690849304;g[D>>2]=C+B;g[A>>2]=C-B;s=s+1|0}r=r+1|0}}while(0);b:do if(!x){j=1<>t>>1;q=j<<1;r=0;while(1){if((r|0)<(j|0))s=0;else break b;while(1){if((s|0)>=(p|0))break;A=n+((_(q,s)|0)+r<<2)|0;B=+g[A>>2]*.7071067690849304;D=n+(((s<<1|1)<>2]*.7071067690849304;g[A>>2]=B+C;g[D>>2]=B-C;s=s+1|0}r=r+1|0}}while(0);o=d[31165+(o&15)>>0]|0|(d[31165+(o>>4)>>0]|0)<<2;t=t+1|0}i=i>>z;t=o;j=u<>1;p=i<<1;q=0;while(1){if((q|0)<(i|0))r=0;else break c;while(1){if((r|0)>=(o|0))break;A=e+((_(p,r)|0)+q<<2)|0;B=+g[A>>2]*.7071067690849304;D=e+((_(r<<1|1,i)|0)+q<<2)|0;C=+g[D>>2]*.7071067690849304;g[A>>2]=B+C;g[D>>2]=B-C;r=r+1|0}q=q+1|0}}while(0);d:do if(x){j=j>>1;o=i<<1}else{j=j>>1;o=i<<1;p=0;while(1){if((p|0)<(i|0))q=0;else break d;while(1){if((q|0)>=(j|0))break;A=n+((_(o,q)|0)+p<<2)|0;B=+g[A>>2]*.7071067690849304;D=n+((_(q<<1|1,i)|0)+p<<2)|0;C=+g[D>>2]*.7071067690849304;g[A>>2]=B+C;g[D>>2]=B-C;q=q+1|0}p=p+1|0}}while(0);D=t|t<1;if(p){if(!w)_d(e,j>>z,i<>z,i<>2]|0)){D=o;return D|0}if(p){be(e,j>>z,i<=(u|0)){s=0;break}s=i>>1;j=j<<1;n=j>>1;p=s<<1;q=0;while(1){if((q|0)<(s|0))r=0;else break;while(1){if((r|0)>=(n|0))break;A=e+((_(p,r)|0)+q<<2)|0;B=+g[A>>2]*.7071067690849304;D=e+((_(r<<1|1,s)|0)+q<<2)|0;C=+g[D>>2]*.7071067690849304;g[A>>2]=B+C;g[D>>2]=B-C;r=r+1|0}q=q+1|0}i=s;o=o|o>>>s;t=t+1|0}while(1){if((s|0)>=(z|0))break;j=a[31181+o>>0]|0;n=1<>s>>1;p=n<<1;q=0;while(1){if((q|0)<(n|0))r=0;else break;while(1){if((r|0)>=(o|0))break;A=e+((_(p,r)|0)+q<<2)|0;B=+g[A>>2]*.7071067690849304;D=e+(((r<<1|1)<>2]*.7071067690849304;g[A>>2]=B+C;g[D>>2]=B-C;r=r+1|0}q=q+1|0}o=j&255;s=s+1|0}j=i<=(f|0))break e;g[l+(n<<2)>>2]=m*+g[e+(n<<2)>>2];n=n+1|0}}while(0);D=o&(1<=(d|0))break;e=_(f,b)|0;g=0;while(1){if((g|0)>=(b|0))break;c[k+(e+g<<2)>>2]=c[a+((_(g,d)|0)+f<<2)>>2];g=g+1|0}f=f+1|0}d=j<<2;rf(a|0,k|0,d|0)|0;i=l;return}e=17628+(d<<2)+-8|0;g=0;while(1){if((g|0)>=(d|0))break;f=e+(g<<2)|0;h=0;while(1){if((h|0)>=(b|0))break;m=c[a+((_(h,d)|0)+g<<2)>>2]|0;c[k+((_(c[f>>2]|0,b)|0)+h<<2)>>2]=m;h=h+1|0}g=g+1|0}m=j<<2;rf(a|0,k|0,m|0)|0;i=l;return}function $d(e,f,h,j,k,l,m,n,o){e=e|0;f=f|0;h=h|0;j=j|0;k=k|0;l=l|0;m=m|0;n=+n;o=o|0;var p=0.0,q=0,r=0,s=0,t=0,u=0,v=0.0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0;E=i;i=i+32|0;z=E+28|0;D=E+24|0;r=E;c[z>>2]=j;c[D>>2]=o;B=c[e>>2]|0;x=c[e+8>>2]|0;y=c[e+12>>2]|0;C=c[e+20>>2]|0;A=c[e+28>>2]|0;t=x+100|0;u=m+1|0;w=x+8|0;s=(_(u,c[w>>2]|0)|0)+y|0;x=x+96|0;s=(c[t>>2]|0)+(b[(c[x>>2]|0)+(s<<1)>>1]|0)|0;q=a[s>>0]|0;if((m|0)!=-1?((h|0)>2?((d[s+(q&255)>>0]|0)+12|0)<(j|0):0):0){w=h>>1;x=f+(w<<2)|0;y=m+-1|0;if((k|0)==1)c[D>>2]=o&1|o<<1;t=k+1>>1;ae(e,r,f,x,w,z,t,k,y,0,D);j=c[r+12>>2]|0;u=c[r+16>>2]|0;q=c[r+20>>2]|0;v=+(c[r+4>>2]|0)*.000030517578125;p=+(c[r+8>>2]|0)*.000030517578125;do if(!((k|0)<2|(u&16383|0)==0))if((u|0)>8192){j=j-(j>>5-m)|0;break}else{j=j+(w<<3>>6-m)|0;j=(j|0)>0?0:j;break}while(0);m=c[z>>2]|0;r=(m-j|0)/2|0;s=(m|0)<(r|0);r=((s?m:r)|0)<0?0:s?m:r;m=m-r|0;s=e+32|0;q=(c[s>>2]|0)-q|0;c[s>>2]=q;j=(l|0)==0?0:l+(w<<2)|0;if((r|0)<(m|0)){D=c[D>>2]|0;h=($d(e,x,w,m,t,j,y,p*n,D>>t)|0)<<(k>>1);k=m+((c[s>>2]|0)-q)|0;l=h|($d(e,f,w,r+((k|0)<25|(u|0)==16384?0:k+-24|0)|0,t,l,y,v*n,D)|0);i=E;return l|0}else{D=c[D>>2]|0;h=$d(e,f,w,r,t,l,y,v*n,D)|0;l=r+((c[s>>2]|0)-q)|0;l=h|($d(e,x,w,m+((l|0)<25|(u|0)==0?0:l+-24|0)|0,t,j,y,p*n,D>>t)|0)<<(k>>1);i=E;return l|0}}m=j+-1|0;q=q&255;j=0;r=0;while(1){if((j|0)==6)break;z=r+q+1>>1;F=(d[s+z>>0]|0)<(m|0);q=F?q:z;j=j+1|0;r=F?z:r}if(!r)j=-1;else j=d[s+r>>0]|0;j=(m-j|0)>((d[s+q>>0]|0)-m|0)?q:r;if(!j)q=0;else q=(d[s+j>>0]|0)+1|0;m=e+32|0;s=q;q=(c[m>>2]|0)-q|0;while(1){c[m>>2]=q;if(!((q|0)<0&(j|0)>0))break;q=q+s|0;c[m>>2]=q;j=j+-1|0;if(!j)r=0;else r=(d[(c[t>>2]|0)+(b[(c[x>>2]|0)+((_(u,c[w>>2]|0)|0)+y<<1)>>1]|0)+j>>0]|0)+1|0;s=r;q=q-r|0}if(j|0){if((j|0)>=8)j=(j&7|8)<<(j>>3)+-1;if(!B){F=wd(f,h,j,C,k,A,n)|0;i=E;return F|0}else{F=ud(f,h,j,C,k,A,n,c[e+4>>2]|0)|0;i=E;return F|0}}if(!(c[e+4>>2]|0)){F=0;i=E;return F|0}j=(1<>2]=q;if(!q){nf(f|0,0,h<<2|0)|0;F=0;i=E;return F|0}r=e+40|0;a:do if(!l){q=0;while(1){if((q|0)>=(h|0))break a;F=(_(c[r>>2]|0,1664525)|0)+1013904223|0;c[r>>2]=F;g[f+(q<<2)>>2]=+(F>>20|0);q=q+1|0}}else{j=0;while(1){if((j|0)>=(h|0)){j=q;break a}F=(_(c[r>>2]|0,1664525)|0)+1013904223|0;c[r>>2]=F;g[f+(j<<2)>>2]=+g[l+(j<<2)>>2]+((F&32768|0)==0?-.00390625:.00390625);j=j+1|0}}while(0);q=0;p=0.0;while(1){if((q|0)>=(h|0))break;v=+g[f+(q<<2)>>2];q=q+1|0;p=p+v*v}p=1.0/+O(+(p+1.0000000036274937e-15))*n;q=0;while(1){if((q|0)>=(h|0))break;g[f>>2]=p*+g[f>>2];q=q+1|0;f=f+4|0}i=E;return j|0}function ae(e,f,h,i,j,k,l,m,n,o,p){e=e|0;f=f|0;h=h|0;i=i|0;j=j|0;k=k|0;l=l|0;m=m|0;n=n|0;o=o|0;p=p|0;var q=0.0,r=0.0,s=0,t=0,u=0,v=0.0,w=0,x=0,y=0,z=0.0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,N=0,P=0,Q=0,R=0,S=0,T=0.0;x=c[e>>2]|0;K=c[e+8>>2]|0;L=c[e+12>>2]|0;u=c[e+16>>2]|0;S=c[e+28>>2]|0;J=c[e+36>>2]|0;t=(b[(c[K+56>>2]|0)+(L<<1)>>1]|0)+(n<<3)|0;n=t>>1;I=(o|0)==0;do if(!I)if((j|0)==2){o=n+-16|0;s=2;break}else{o=n+-4|0;s=(j<<1)+-1|0;break}else{o=n+-4|0;s=(j<<1)+-1|0}while(0);n=c[k>>2]|0;o=((_(s,o)|0)+n|0)/(s|0)|0;R=n-t+-32|0;o=(R|0)<(o|0)?R:o;if((o|0)<=64)if((o|0)<4)o=1;else w=8;else{o=64;w=8}if((w|0)==8)o=(b[25760+((o&7)<<1)>>1]>>14-(o>>3))+1&-2;G=I|(L|0)<(u|0)?o:1;H=(x|0)==0;if(H)o=0;else{a:do if(I){o=0;q=0.0;while(1){if((o|0)>=(j|0)){o=0;r=0.0;break}z=+g[h+(o<<2)>>2];o=o+1|0;q=q+z*z}while(1){if((o|0)>=(j|0))break;z=+g[i+(o<<2)>>2];o=o+1|0;r=r+z*z}q=q+1.0000000036274937e-15;r=r+1.0000000036274937e-15}else{q=1.0000000036274937e-15;r=1.0000000036274937e-15;o=0;while(1){if((o|0)>=(j|0))break a;T=+g[h+(o<<2)>>2];z=+g[i+(o<<2)>>2];v=T+z;z=T-z;q=q+v*v;r=r+z*z;o=o+1|0}}while(0);z=+O(+q);v=+O(+r);q=z*z;r=v*v;do if(!(q+r<1.000000045813705e-18))if(q>2]|0;P=F<<3;Q=S+28|0;B=c[Q>>2]|0;D=32-(aa(B|0)|0)|0;E=B>>>(D+-16|0);R=(E>>>12)+-8|0;R=(D<<3)+(R+(E>>>0>(c[5272+(R<<2)>>2]|0)>>>0&1))|0;b:do if((G|0)==1)if(!I){if(H)s=0;else{I=(o|0)>8192;s=I&1;c:do if(I){n=0;while(1){if((n|0)>=(j|0))break c;I=i+(n<<2)|0;g[I>>2]=-+g[I>>2];n=n+1|0}}while(0);q=+g[J+(L<<2)>>2];T=+g[J+((c[K+8>>2]|0)+L<<2)>>2];r=+O(+(q*q+1.0000000036274937e-15+T*T))+1.0000000036274937e-15;q=q/r;r=T/r;n=0;while(1){if((n|0)>=(j|0))break;L=h+(n<<2)|0;g[L>>2]=q*+g[L>>2]+r*+g[i+(n<<2)>>2];n=n+1|0}n=c[k>>2]|0}if((n|0)>16?(c[e+32>>2]|0)>16:0){t=c[Q>>2]|0;if(H){m=S+32|0;o=c[m>>2]|0;n=t>>>2;i=o>>>0>>0;s=i&1;if(!i){o=o-n|0;c[m>>2]=o;n=t-n|0}c[Q>>2]=n;w=S+40|0;x=S+24|0;y=S+4|0;while(1){if(n>>>0>=8388609){o=0;break b}c[N>>2]=(c[N>>2]|0)+8;n=n<<8;c[Q>>2]=n;u=c[w>>2]|0;t=c[x>>2]|0;if(t>>>0<(c[y>>2]|0)>>>0){c[x>>2]=t+1;t=d[(c[S>>2]|0)+t>>0]|0}else t=0;c[w>>2]=t;i=((u<<8|t)>>>1&255|o<<8&2147483392)^255;c[m>>2]=i;o=i}}o=t>>>2;n=t-o|0;B=S+32|0;if(s){c[B>>2]=(c[B>>2]|0)+n;n=o}c[Q>>2]=n;w=S+36|0;x=S+40|0;y=S+24|0;m=S+8|0;e=S+4|0;A=S+44|0;while(1){if(n>>>0>=8388609){o=0;break b}o=c[B>>2]|0;u=o>>>23;if((u|0)==255)c[w>>2]=(c[w>>2]|0)+1;else{t=o>>>31;n=c[x>>2]|0;if((n|0)>-1){o=c[y>>2]|0;if((o+(c[m>>2]|0)|0)>>>0<(c[e>>2]|0)>>>0){c[y>>2]=o+1;a[(c[S>>2]|0)+o>>0]=n+t;n=0}else n=-1;c[A>>2]=c[A>>2]|n}n=c[w>>2]|0;if(n|0){t=t+255&255;do{o=c[y>>2]|0;if((o+(c[m>>2]|0)|0)>>>0<(c[e>>2]|0)>>>0){c[y>>2]=o+1;a[(c[S>>2]|0)+o>>0]=t;o=0;n=c[w>>2]|0}else o=-1;c[A>>2]=c[A>>2]|o;n=n+-1|0;c[w>>2]=n}while((n|0)!=0)}c[x>>2]=u&255;o=c[B>>2]|0;n=c[Q>>2]|0}c[B>>2]=o<<8&2147483392;n=n<<8;c[Q>>2]=n;c[N>>2]=(c[N>>2]|0)+8}}else{s=0;o=0}}else s=0;else{do if(!H){if(!I?(y=c[e+48>>2]|0,y|0):0){o=(_(o,G)|0)+((((o|0)>8192?32767:-32767)|0)/(G|0)|0)|0;E=(o|0)<0;o=((G|0)>((E?0:o>>14)|0)?(E?0:o>>14):G+-1|0)+(y>>>31^1)|0;break}o=(_(o,G)|0)+8192>>14}while(0);d:do if((j|0)>2&(I^1)){w=(G|0)/2|0;x=(w*3|0)+3|0;y=x+w|0;if(H){t=(B>>>0)/(y>>>0)|0;c[S+36>>2]=t;e=S+32|0;u=c[e>>2]|0;n=((u>>>0)/(t>>>0)|0)+1|0;n=y-(y>>>0>>0?y:n)|0;if((n|0)<(x|0))o=(n|0)/3|0;else o=w+1+(n-x)|0;n=(o|0)>(w|0);if(n)s=o+-1-w+x|0;else s=o*3|0;x=n?o-w+x|0:(o*3|0)+3|0;y=_(t,y-x|0)|0;w=u-y|0;c[e>>2]=w;x=_(t,x-s|0)|0;s=(s|0)==0?B-y|0:x;c[Q>>2]=s;x=S+40|0;y=S+24|0;m=S+4|0;n=F;while(1){if(s>>>0>=8388609)break d;n=n+8|0;c[N>>2]=n;s=s<<8;c[Q>>2]=s;u=c[x>>2]|0;t=c[y>>2]|0;if(t>>>0<(c[m>>2]|0)>>>0){c[y>>2]=t+1;t=d[(c[S>>2]|0)+t>>0]|0}else t=0;c[x>>2]=t;F=((u<<8|t)>>>1&255|w<<8&2147483392)^255;c[e>>2]=F;w=F}}n=(o|0)>(w|0);if(n)t=o+-1-w+x|0;else t=o*3|0;n=n?o-w+x|0:(o*3|0)+3|0;s=(B>>>0)/(y>>>0)|0;if(!t){n=B-(_(s,y-n|0)|0)|0;c[Q>>2]=n;w=S+32|0}else{E=B-(_(s,y-t|0)|0)|0;w=S+32|0;c[w>>2]=(c[w>>2]|0)+E;n=_(s,n-t|0)|0;c[Q>>2]=n}x=S+36|0;y=S+40|0;m=S+24|0;e=S+8|0;A=S+4|0;B=S+44|0;s=F;while(1){if(n>>>0>=8388609)break d;t=c[w>>2]|0;u=t>>>23;if((u|0)==255)c[x>>2]=(c[x>>2]|0)+1;else{t=t>>>31;n=c[y>>2]|0;if((n|0)>-1){s=c[m>>2]|0;if((s+(c[e>>2]|0)|0)>>>0<(c[A>>2]|0)>>>0){c[m>>2]=s+1;a[(c[S>>2]|0)+s>>0]=n+t;n=0}else n=-1;c[B>>2]=c[B>>2]|n}n=c[x>>2]|0;if(n|0){t=t+255&255;do{s=c[m>>2]|0;if((s+(c[e>>2]|0)|0)>>>0<(c[A>>2]|0)>>>0){c[m>>2]=s+1;a[(c[S>>2]|0)+s>>0]=t;s=0;n=c[x>>2]|0}else s=-1;c[B>>2]=c[B>>2]|s;n=n+-1|0;c[x>>2]=n}while((n|0)!=0)}c[y>>2]=u&255;t=c[w>>2]|0;n=c[Q>>2]|0;s=c[N>>2]|0}c[w>>2]=t<<8&2147483392;n=n<<8;c[Q>>2]=n;s=s+8|0;c[N>>2]=s}}else{if(!((m|0)>1|I^1)){s=G>>1;t=s+1|0;e=_(t,t)|0;if(H){y=(B>>>0)/(e>>>0)|0;c[S+36>>2]=y;A=S+32|0;m=c[A>>2]|0;o=((m>>>0)/(y>>>0)|0)+1|0;o=e>>>0>>0?e:o;n=e-o|0;if((n|0)<((_(s,t)|0)>>1|0)){n=n<<3|1;u=32-(aa(n|0)|0)+-1>>1;t=1<>>0>>0;w=w+(s?0:t)|0;if((u|0)<=0)break;else{n=n-(s?0:o)|0;t=t>>>1;u=u+-1|0}}o=(w+-1|0)>>>1;s=o+1|0;n=(_(o,s)|0)>>>1}else{x=G<<1;n=(o<<3)+-7|0;u=32-(aa(n|0)|0)+-1>>1;t=1<>>0>>0;w=w+(s?0:t)|0;if((u|0)<=0)break;else{n=n-(s?0:o)|0;t=t>>>1;u=u+-1|0}}o=(x+2-w|0)>>>1;s=G+1-o|0;n=e-((_(s,G+2-o|0)|0)>>1)|0}x=_(y,e-(n+s)|0)|0;w=m-x|0;c[A>>2]=w;s=_(y,s)|0;s=(n|0)==0?B-x|0:s;c[Q>>2]=s;x=S+40|0;y=S+24|0;m=S+4|0;n=F;while(1){if(s>>>0>=8388609)break d;n=n+8|0;c[N>>2]=n;s=s<<8;c[Q>>2]=s;u=c[x>>2]|0;t=c[y>>2]|0;if(t>>>0<(c[m>>2]|0)>>>0){c[y>>2]=t+1;t=d[(c[S>>2]|0)+t>>0]|0}else t=0;c[x>>2]=t;F=((u<<8|t)>>>1&255|w<<8&2147483392)^255;c[A>>2]=F;w=F}}E=(o|0)>(s|0);n=E?G+1-o|0:o+1|0;if(E)t=e-((_(G+1-o|0,G+2-o|0)|0)>>1)|0;else t=(_(o,o+1|0)|0)>>1;s=(B>>>0)/(e>>>0)|0;if(!t){n=B-(_(s,e-n|0)|0)|0;c[Q>>2]=n;w=S+32|0}else{E=B-(_(s,e-t|0)|0)|0;w=S+32|0;c[w>>2]=(c[w>>2]|0)+E;n=_(s,n)|0;c[Q>>2]=n}x=S+36|0;y=S+40|0;m=S+24|0;e=S+8|0;A=S+4|0;B=S+44|0;s=F;while(1){if(n>>>0>=8388609)break d;t=c[w>>2]|0;u=t>>>23;if((u|0)==255)c[x>>2]=(c[x>>2]|0)+1;else{t=t>>>31;n=c[y>>2]|0;if((n|0)>-1){s=c[m>>2]|0;if((s+(c[e>>2]|0)|0)>>>0<(c[A>>2]|0)>>>0){c[m>>2]=s+1;a[(c[S>>2]|0)+s>>0]=n+t;n=0}else n=-1;c[B>>2]=c[B>>2]|n}n=c[x>>2]|0;if(n|0){t=t+255&255;do{s=c[m>>2]|0;if((s+(c[e>>2]|0)|0)>>>0<(c[A>>2]|0)>>>0){c[m>>2]=s+1;a[(c[S>>2]|0)+s>>0]=t;s=0;n=c[x>>2]|0}else s=-1;c[B>>2]=c[B>>2]|s;n=n+-1|0;c[x>>2]=n}while((n|0)!=0)}c[y>>2]=u&255;t=c[w>>2]|0;n=c[Q>>2]|0;s=c[N>>2]|0}c[w>>2]=t<<8&2147483392;n=n<<8;c[Q>>2]=n;s=s+8|0;c[N>>2]=s}}t=G+1|0;if(H){s=0;o=((bd(S,t)|0)<<14>>>0)/(G>>>0)|0;break b}n=32-(aa(G|0)|0)|0;if((n|0)<=8){n=(B>>>0)/(t>>>0)|0;if(!o){n=B-(_(n,G)|0)|0;c[Q>>2]=n;B=S+32|0}else{E=B-(_(n,t-o|0)|0)|0;B=S+32|0;c[B>>2]=(c[B>>2]|0)+E;c[Q>>2]=n}w=S+36|0;x=S+40|0;y=S+24|0;m=S+8|0;e=S+4|0;A=S+44|0;s=F;while(1){if(n>>>0>=8388609)break d;t=c[B>>2]|0;u=t>>>23;if((u|0)==255)c[w>>2]=(c[w>>2]|0)+1;else{t=t>>>31;n=c[x>>2]|0;if((n|0)>-1){s=c[y>>2]|0;if((s+(c[m>>2]|0)|0)>>>0<(c[e>>2]|0)>>>0){c[y>>2]=s+1;a[(c[S>>2]|0)+s>>0]=n+t;n=0}else n=-1;c[A>>2]=c[A>>2]|n}n=c[w>>2]|0;if(n|0){t=t+255&255;do{s=c[y>>2]|0;if((s+(c[m>>2]|0)|0)>>>0<(c[e>>2]|0)>>>0){c[y>>2]=s+1;a[(c[S>>2]|0)+s>>0]=t;s=0;n=c[w>>2]|0}else s=-1;c[A>>2]=c[A>>2]|s;n=n+-1|0;c[w>>2]=n}while((n|0)!=0)}c[x>>2]=u&255;t=c[B>>2]|0;n=c[Q>>2]|0;s=c[N>>2]|0}c[B>>2]=t<<8&2147483392;n=n<<8;c[Q>>2]=n;s=s+8|0;c[N>>2]=s}}E=n+-8|0;n=G>>>E;s=n+1|0;t=o>>>E;u=(B>>>0)/(s>>>0)|0;if(!t){u=B-(_(u,n)|0)|0;c[Q>>2]=u;m=S+32|0}else{D=B-(_(u,s-t|0)|0)|0;m=S+32|0;c[m>>2]=(c[m>>2]|0)+D;c[Q>>2]=u}x=S+36|0;y=S+40|0;A=S+24|0;B=S+8|0;C=S+4|0;D=S+44|0;t=F;while(1){if(u>>>0>=8388609)break;n=c[m>>2]|0;w=n>>>23;if((w|0)==255)c[x>>2]=(c[x>>2]|0)+1;else{t=n>>>31;n=c[y>>2]|0;if((n|0)>-1){s=c[A>>2]|0;if((s+(c[B>>2]|0)|0)>>>0<(c[C>>2]|0)>>>0){c[A>>2]=s+1;a[(c[S>>2]|0)+s>>0]=n+t;n=0}else n=-1;c[D>>2]=c[D>>2]|n}n=c[x>>2]|0;if(n|0){t=t+255&255;do{s=c[A>>2]|0;if((s+(c[B>>2]|0)|0)>>>0<(c[C>>2]|0)>>>0){c[A>>2]=s+1;a[(c[S>>2]|0)+s>>0]=t;s=0;n=c[x>>2]|0}else s=-1;c[D>>2]=c[D>>2]|s;n=n+-1|0;c[x>>2]=n}while((n|0)!=0)}c[y>>2]=w&255;n=c[m>>2]|0;u=c[Q>>2]|0;t=c[N>>2]|0}c[m>>2]=n<<8&2147483392;u=u<<8;c[Q>>2]=u;t=t+8|0;c[N>>2]=t}y=(1<>2]|0;e=S+16|0;s=c[e>>2]|0;if((s+E|0)>>>0>32){x=7-s|0;x=s+((x|0)>-8?x:-8)&-8;w=s;do{t=c[B>>2]|0;u=c[C>>2]|0;if(((c[A>>2]|0)+t|0)>>>0>>0){t=t+1|0;c[B>>2]=t;a[(c[S>>2]|0)+(u-t)>>0]=n;t=0}else t=-1;c[D>>2]=c[D>>2]|t;n=n>>>8;w=w+-8|0}while((w|0)>7);t=c[N>>2]|0;s=s+-8-x|0}c[m>>2]=n|y<>2]=s+E;c[N>>2]=t+E}while(0);o=(o<<14>>>0)/(G>>>0)|0;if(H|I)s=0;else{if(o|0){n=0;while(1){if((n|0)>=(j|0)){s=0;break b}L=h+(n<<2)|0;T=+g[L>>2]*.7071067690849304;S=i+(n<<2)|0;z=+g[S>>2]*.7071067690849304;g[L>>2]=T+z;g[S>>2]=z-T;n=n+1|0}}q=+g[J+(L<<2)>>2];T=+g[J+((c[K+8>>2]|0)+L<<2)>>2];r=+O(+(q*q+1.0000000036274937e-15+T*T))+1.0000000036274937e-15;q=q/r;r=T/r;n=0;while(1){if((n|0)>=(j|0)){s=0;o=0;break b}S=h+(n<<2)|0;g[S>>2]=q*+g[S>>2]+r*+g[i+(n<<2)>>2];n=n+1|0}}}while(0);S=c[Q>>2]|0;Q=32-(aa(S|0)|0)|0;S=S>>>(Q+-16|0);n=(S>>>12)+-8|0;n=(c[N>>2]<<3)-((Q<<3)+(n+(S>>>0>(c[5272+(n<<2)>>2]|0)>>>0&1)))+(R-P)|0;c[k>>2]=(c[k>>2]|0)-n;e:do if((o|0)<16384){switch(o|0){case 0:break;default:break e}c[p>>2]=c[p>>2]&(1<>2]=s;p=f+4|0;c[p>>2]=l;p=f+8|0;c[p>>2]=j;p=f+12|0;c[p>>2]=k;p=f+16|0;c[p>>2]=o;f=f+20|0;c[f>>2]=n;return}else{switch(o|0){case 16384:break;default:break e}c[p>>2]=c[p>>2]&(1<>2]=s;p=f+4|0;c[p>>2]=l;p=f+8|0;c[p>>2]=j;p=f+12|0;c[p>>2]=k;p=f+16|0;c[p>>2]=o;f=f+20|0;c[f>>2]=n;return}while(0);R=o<<16>>16;R=((_(R,R)|0)+4096|0)>>>13;l=R<<16>>16;l=(32767-R+(((_(l,(((_(l,(((_(l,-626)|0)+16384|0)>>>15<<16)+542441472>>16)|0)+16384|0)>>>15<<16)+-501415936>>16)|0)+16384|0)>>>15)<<16)+65536>>16;R=16384-o<<16>>16;R=((_(R,R)|0)+4096|0)>>>13;p=R<<16>>16;p=(32767-R+(((_(p,(((_(p,(((_(p,-626)|0)+16384|0)>>>15<<16)+542441472>>16)|0)+16384|0)>>>15<<16)+-501415936>>16)|0)+16384|0)>>>15)<<16)+65536>>16;R=32-(aa(l|0)|0)|0;Q=32-(aa(p|0)|0)|0;S=p<<15-Q<<16>>16;k=l<<15-R<<16>>16;k=(_((j<<23)+-8388608>>16,(Q-R<<11)+(((_(S,(((_(S,-2597)|0)+16384|0)>>>15<<16)+519831552>>16)|0)+16384|0)>>>15)-(((_(k,(((_(k,-2597)|0)+16384|0)>>>15<<16)+519831552>>16)|0)+16384|0)>>>15)<<16>>16)|0)+16384>>15;j=p;c[f>>2]=s;p=f+4|0;c[p>>2]=l;p=f+8|0;c[p>>2]=j;p=f+12|0;c[p>>2]=k;p=f+16|0;c[p>>2]=o;f=f+20|0;c[f>>2]=n;return}function be(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,j=0,k=0,l=0;l=i;j=_(b,d)|0;k=i;i=i+((1*(j<<2)|0)+15&-16)|0;if(!e){f=0;while(1){if((f|0)>=(d|0))break;e=_(f,b)|0;g=0;while(1){if((g|0)>=(b|0))break;c[k+((_(g,d)|0)+f<<2)>>2]=c[a+(e+g<<2)>>2];g=g+1|0}f=f+1|0}d=j<<2;rf(a|0,k|0,d|0)|0;i=l;return}e=17628+(d<<2)+-8|0;g=0;while(1){if((g|0)>=(d|0))break;f=e+(g<<2)|0;h=0;while(1){if((h|0)>=(b|0))break;c[k+((_(h,d)|0)+g<<2)>>2]=c[a+((_(c[f>>2]|0,b)|0)+h<<2)>>2];h=h+1|0}g=g+1|0}d=j<<2;rf(a|0,k|0,d|0)|0;i=l;return}function ce(b,e,f,h,j,k,l,m,n,o,p){b=b|0;e=e|0;f=f|0;h=h|0;j=j|0;k=k|0;l=l|0;m=m|0;n=n|0;o=o|0;p=p|0;var q=0,r=0.0,s=0.0,t=0.0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0.0,L=0,M=0,N=0.0;M=i;i=i+32|0;q=M+28|0;x=M+24|0;u=M;c[q>>2]=j;c[x>>2]=p;w=c[b>>2]|0;L=c[b+28>>2]|0;if((h|0)==1){l=b+32|0;k=(w|0)==0;m=L+12|0;D=L+16|0;E=L+20|0;F=L+8|0;G=L+4|0;H=L+24|0;p=L+44|0;z=b+4|0;A=f|0?2:1;B=0;C=e;while(1){if((c[l>>2]|0)>7){if(k){q=c[m>>2]|0;j=c[D>>2]|0;if(!j){v=c[G>>2]|0;u=c[F>>2]|0;w=0;do{if(u>>>0>>0){j=u+1|0;c[F>>2]=j;u=j;j=d[(c[L>>2]|0)+(v-j)>>0]|0}else j=0;q=q|j<>>1}else{y=+g[C>>2]<0.0&1;q=c[m>>2]|0;v=c[D>>2]|0;if((v+1|0)>>>0>32){w=7-v|0;w=v+((w|0)>-8?w:-8)&-8;x=v;do{j=c[F>>2]|0;u=c[G>>2]|0;if(((c[H>>2]|0)+j|0)>>>0>>0){j=j+1|0;c[F>>2]=j;a[(c[L>>2]|0)+(u-j)>>0]=q;j=0}else j=-1;c[p>>2]=c[p>>2]|j;q=q>>>8;x=x+-8|0}while((x|0)>7);v=v+-8-w|0}j=y;u=v+1|0;q=q|y<>2]=q;c[D>>2]=u;c[E>>2]=(c[E>>2]|0)+1;c[l>>2]=(c[l>>2]|0)+-8}else j=0;if(c[z>>2]|0)g[C>>2]=j|0?-1.0:1.0;B=B+1|0;if((B|0)>=(A|0))break;else C=f}if(!n){f=1;i=M;return f|0}c[n>>2]=c[e>>2];f=1;i=M;return f|0}ae(b,u,e,f,h,q,k,k,m,1,x);J=c[u>>2]|0;z=c[u+16>>2]|0;y=c[u+20>>2]|0;K=+(c[u+4>>2]|0)*.000030517578125;r=+(c[u+8>>2]|0)*.000030517578125;I=(h|0)==2;do if(I){j=c[q>>2]|0;if((z|0)<16384)switch(z|0){case 0:{q=0;break}default:v=26}else switch(z|0){case 16384:{q=0;break}default:v=26}if((v|0)==26)q=8;H=j-q|0;F=(z|0)>8192;G=b+32|0;c[G>>2]=(c[G>>2]|0)-(y+q);G=F?f:e;F=F?e:f;do if(!q)j=0;else{if(!w){y=L+12|0;q=c[y>>2]|0;z=L+16|0;j=c[z>>2]|0;if(!j){w=L+8|0;v=c[L+4>>2]|0;u=c[w>>2]|0;x=0;do{if(u>>>0>>0){u=u+1|0;c[w>>2]=u;j=d[(c[L>>2]|0)+(v-u)>>0]|0}else j=0;q=q|j<>2]=q>>>1;c[z>>2]=j+-1;j=L+20|0;c[j>>2]=(c[j>>2]|0)+1;j=q&1;break}j=+g[G>>2]*+g[F+4>>2]-+g[G+4>>2]*+g[F>>2]<0.0&1;D=L+12|0;q=c[D>>2]|0;E=L+16|0;u=c[E>>2]|0;if((u+1|0)>>>0>32){x=L+24|0;y=L+8|0;z=L+4|0;A=L+44|0;B=7-u|0;B=u+((B|0)>-8?B:-8)&-8;C=u;do{v=c[y>>2]|0;w=c[z>>2]|0;if(((c[x>>2]|0)+v|0)>>>0>>0){v=v+1|0;c[y>>2]=v;a[(c[L>>2]|0)+(w-v)>>0]=q;v=0}else v=-1;c[A>>2]=c[A>>2]|v;q=q>>>8;C=C+-8|0}while((C|0)>7);u=u+-8-B|0}c[D>>2]=q|j<>2]=u+1;L=L+20|0;c[L>>2]=(c[L>>2]|0)+1}while(0);L=1-(j<<1)|0;j=Zd(b,G,2,H,k,l,m,n,1.0,o,p)|0;g[F>>2]=+(0-L|0)*+g[G+4>>2];g[F+4>>2]=+(L|0)*+g[G>>2];if(c[b+4>>2]|0){g[e>>2]=K*+g[e>>2];L=e+4|0;g[L>>2]=K*+g[L>>2];s=r*+g[f>>2];g[f>>2]=s;n=f+4|0;g[n>>2]=r*+g[n>>2];t=+g[e>>2];g[e>>2]=t-s;g[f>>2]=t+ +g[f>>2];t=+g[L>>2];g[L>>2]=t-+g[n>>2];g[n>>2]=t+ +g[n>>2]}}else{v=c[q>>2]|0;u=(v-(c[u+12>>2]|0)|0)/2|0;w=(v|0)<(u|0);u=((w?v:u)|0)<0?0:w?v:u;v=v-u|0;w=b+32|0;q=(c[w>>2]|0)-y|0;c[w>>2]=q;j=c[x>>2]|0;if((u|0)<(v|0)){p=Zd(b,f,h,v,k,0,m,0,r,0,j>>k)|0;L=v+((c[w>>2]|0)-q)|0;j=p|(Zd(b,e,h,u+((L|0)<25|(z|0)==16384?0:L+-24|0)|0,k,l,m,n,1.0,o,j)|0);break}else{L=Zd(b,e,h,u,k,l,m,n,1.0,o,j)|0;n=u+((c[w>>2]|0)-q)|0;j=L|(Zd(b,f,h,v+((n|0)<25|(z|0)==0?0:n+-24|0)|0,k,0,m,0,r,0,j>>k)|0);break}}while(0);if(!(c[b+4>>2]|0)){f=j;i=M;return f|0}a:do if(!I){q=0;r=0.0;s=0.0;while(1){if((q|0)>=(h|0))break;t=+g[f+(q<<2)>>2];N=r+t*+g[e+(q<<2)>>2];q=q+1|0;r=N;s=s+t*t}N=K*K+s;s=r*K*2.0;r=N-s;s=N+s;if(s<6.000000284984708e-04|r<6.000000284984708e-04){rf(f|0,e|0,h<<2|0)|0;break}t=1.0/+O(+r);r=1.0/+O(+s);q=0;while(1){if((q|0)>=(h|0))break a;L=e+(q<<2)|0;s=+g[L>>2]*K;n=f+(q<<2)|0;N=+g[n>>2];g[L>>2]=t*(s-N);g[n>>2]=r*(s+N);q=q+1|0}}while(0);if(!J){f=j;i=M;return f|0}else q=0;while(1){if((q|0)>=(h|0))break;e=f+(q<<2)|0;g[e>>2]=-+g[e>>2];q=q+1|0}i=M;return j|0}function de(d,e,f,g,h,j){d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;var k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0;H=i;i=i+208|0;D=H+176|0;E=H+144|0;G=H;C=d+2328|0;F=c[C>>2]|0;B=G+136|0;c[B>>2]=0;switch(h|0){case 0:{k=d+2388|0;l=4;break}case 2:{k=d+2388|0;if((c[d+2420+(c[k>>2]<<2)>>2]|0)==1)l=4;else l=57;break}default:l=57}if((l|0)==4){A=Fa()|0;u=i;i=i+((1*((F+15&-16)<<1)|0)+15&-16)|0;ee(d,e,c[k>>2]|0,h,j);z=d+2765|0;fe(e,u,a[z>>0]|0,a[d+2766>>0]|0,c[C>>2]|0);y=d+2324|0;he(G+16|0,d+2736|0,d+2312|0,(j|0)==2&1,c[y>>2]|0);ie(D,d+2744|0,c[d+2732>>2]|0);v=G+64|0;w=d+2340|0;ue(v,D,c[w>>2]|0);x=d+2376|0;k=d+2767|0;if((c[x>>2]|0)!=1){k=a[k>>0]|0;if(k<<24>>24<4){h=c[w>>2]|0;e=0;while(1){if((e|0)>=(h|0))break;t=b[d+2344+(e<<1)>>1]|0;b[E+(e<<1)>>1]=(t&65535)+((_(k<<24>>24,(b[D+(e<<1)>>1]|0)-(t<<16>>16)|0)|0)>>>2);e=e+1|0}ue(G+32|0,E,h);h=c[w>>2]|0}else l=11}else{a[k>>0]=4;l=11}if((l|0)==11){h=c[w>>2]|0;rf(G+32|0,v|0,h<<1|0)|0}rf(d+2344|0,D|0,h<<1|0)|0;k=d+4160|0;if(c[k>>2]|0){j=h+-1|0;h=63570;e=0;while(1){if((e|0)>=(j|0))break;t=G+32+(e<<1)|0;b[t>>1]=(((_(h,b[t>>1]|0)|0)>>>15)+1|0)>>>1;h=h+(((_(h,-1966)|0)>>15)+1>>1)|0;e=e+1|0}e=G+32+(j<<1)|0;b[e>>1]=(((_(h,b[e>>1]|0)|0)>>>15)+1|0)>>>1;h=63570;e=0;while(1){if((e|0)>=(j|0))break;t=G+64+(e<<1)|0;b[t>>1]=(((_(h,b[t>>1]|0)|0)>>>15)+1|0)>>>1;h=h+(((_(h,-1966)|0)>>15)+1>>1)|0;e=e+1|0}t=G+64+(j<<1)|0;b[t>>1]=(((_(h,b[t>>1]|0)|0)>>>15)+1|0)>>>1}if((a[z>>0]|0)==2){h=d+2316|0;l=c[h>>2]|0;t=c[y>>2]|0;j=(l|0)==8;q=(t|0)==4;r=j?(q?11:3):q?34:12;q=j?(q?32969:32935):q?33013:32941;l=l<<16;j=l>>15;l=(l>>16)*18|0;m=j+(b[d+2762>>1]|0)|0;n=a[d+2764>>0]|0;o=(j|0)>(l|0);s=0;while(1){if((s|0)>=(t|0))break;e=m+(a[q+((_(s,r)|0)+n)>>0]|0)|0;p=G+(s<<2)|0;c[p>>2]=e;if(o)if((e|0)>(j|0))e=j;else e=(e|0)<(l|0)?l:e;else if((e|0)>(l|0))e=l;else e=(e|0)<(j|0)?j:e;c[p>>2]=e;s=s+1|0}j=b[d+2768>>1]|0;e=c[17400+((j&65535)<<24>>24<<2)>>2]|0;j=(j&65535)>>>8;o=0;while(1){if((o|0)>=(t|0))break;l=(a[d+2740+o>>0]|0)*5|0;m=o*5|0;n=0;while(1){if((n|0)==5)break;b[G+96+(m+n<<1)>>1]=a[e+(l+n)>>0]<<7;n=n+1|0}o=o+1|0}c[B>>2]=b[25412+((j&65535)<<24>>24<<1)>>1]}else{h=c[y>>2]|0;nf(G|0,0,h<<2|0)|0;nf(G+96|0,0,h*10|0)|0;a[d+2768>>0]=0;c[B>>2]=0;h=d+2316|0}Ce(d,G,f,u);e=c[h>>2]|0;h=d+4248|0;if((e|0)!=(c[h>>2]|0)){c[d+4168>>2]=c[C>>2]<<7;c[d+4240>>2]=65536;c[d+4244>>2]=65536;c[d+4256>>2]=20;c[d+4252>>2]=2;c[h>>2]=e}s=d+4168|0;u=a[z>>0]|0;t=d+4164|0;c[t>>2]=u<<24>>24;a:do if(u<<24>>24==2){h=d+2332|0;n=c[h>>2]|0;o=c[y>>2]|0;p=o+-1|0;q=d+4172|0;m=c[G+(p<<2)>>2]|0;e=0;r=0;while(1){if((_(r,n)|0)>=(m|0)|(r|0)==(o|0))break;else{j=0;l=0}while(1){if((j|0)==5)break;u=l+(b[G+96+(((p-r|0)*5|0)+j<<1)>>1]|0)|0;j=j+1|0;l=u}if((l|0)>(e|0)){e=G+96+((o+65535-r<<16>>16)*5<<1)|0;b[q>>1]=b[e>>1]|0;b[q+2>>1]=b[e+2>>1]|0;b[q+4>>1]=b[e+4>>1]|0;b[q+6>>1]=b[e+6>>1]|0;b[q+8>>1]=b[e+8>>1]|0;c[s>>2]=c[G+(p-r<<2)>>2]<<8;e=l}r=r+1|0}c[q>>2]=0;c[q+4>>2]=0;b[q+8>>1]=0;b[d+4176>>1]=e;if((e|0)<11469){e=(11744256/(((e|0)>1?e:1)|0)|0)<<16>>16;j=0;while(1){if((j|0)==5)break a;u=d+4172+(j<<1)|0;b[u>>1]=(_(b[u>>1]|0,e)|0)>>>10;j=j+1|0}}if((e|0)>15565){e=(255016960/(e|0)|0)<<16>>16;j=0;while(1){if((j|0)==5)break a;u=d+4172+(j<<1)|0;b[u>>1]=(_(b[u>>1]|0,e)|0)>>>14;j=j+1|0}}}else{c[s>>2]=(e<<16>>16)*4608;h=d+4172|0;c[h>>2]=0;c[h+4>>2]=0;b[h+8>>1]=0;h=d+2332|0}while(0);rf(d+4182|0,v|0,c[w>>2]<<1|0)|0;b[d+4236>>1]=c[B>>2];B=c[y>>2]|0;v=G+16+(B+-2<<2)|0;w=c[v+4>>2]|0;y=d+4240|0;c[y>>2]=c[v>>2];c[y+4>>2]=w;c[d+4256>>2]=c[h>>2];c[d+4252>>2]=B;c[k>>2]=0;c[t>>2]=a[z>>0];c[x>>2]=0;Na(A|0);h=G}else if((l|0)==57){a[d+2765>>0]=c[d+4164>>2];k=c[d+2316>>2]|0;h=d+4248|0;if((k|0)!=(c[h>>2]|0)){c[d+4168>>2]=F<<7;c[d+4240>>2]=65536;c[d+4244>>2]=65536;c[d+4256>>2]=20;c[d+4252>>2]=2;c[h>>2]=k}me(d,G,f);k=d+4160|0;c[k>>2]=(c[k>>2]|0)+1;h=G}A=c[C>>2]|0;B=(c[d+2336>>2]|0)-A|0;sf(d+1348|0,d+1348+(A<<1)|0,B<<1|0)|0;rf(d+1348+(B<<1)|0,f|0,c[C>>2]<<1|0)|0;Be(d,h,f,F);if(c[k>>2]|0){ze(d+4228|0,d+4232|0,f,F);c[d+4216>>2]=1;f=d+2324|0;f=c[f>>2]|0;f=f+-1|0;f=G+(f<<2)|0;f=c[f>>2]|0;G=d+2308|0;c[G>>2]=f;c[g>>2]=F;i=H;return 0}l=d+4216|0;b:do if(c[l>>2]|0){ze(E,D,f,F);k=c[D>>2]|0;h=c[d+4232>>2]|0;if((k|0)<=(h|0)){if((k|0)<(h|0))c[E>>2]=c[E>>2]>>h-k}else{D=d+4228|0;c[D>>2]=c[D>>2]>>k-h}k=c[E>>2]|0;h=d+4228|0;e=c[h>>2]|0;if((k|0)>(e|0)){C=aa(e|0)|0;D=e<>2]=D;C=25-C|0;k=k>>((C|0)>0?C:0);c[E>>2]=k;k=(D|0)/(((k|0)>1?k:1)|0)|0;if((k|0)<1)k=0;else{j=aa(k|0)|0;h=24-j|0;e=0-h|0;do if(h)if((h|0)<0){k=k<>>(h+32|0);break}else{k=k<<32-h|k>>>h;break}while(0);E=((j&1|0)==0?46214:32768)>>>(j>>>1);k=(_(k&127,13959168)|0)>>>16;k=E+((_(E>>16,k)|0)+((_(E&65535,k)|0)>>>16))<<4}e=((65536-k|0)/(F|0)|0)<<2;h=0;while(1){if((h|0)>=(F|0))break b;E=f+(h<<1)|0;D=b[E>>1]|0;b[E>>1]=(_(k>>16,D)|0)+((_(k&65532,D)|0)>>>16);k=k+e|0;if((k|0)>65536)break b;h=h+1|0}}}while(0);c[l>>2]=0;f=d+2324|0;f=c[f>>2]|0;f=f+-1|0;f=G+(f<<2)|0;f=c[f>>2]|0;G=d+2308|0;c[G>>2]=f;c[g>>2]=F;i=H;return 0}function ee(f,g,h,j,k){f=f|0;g=g|0;h=h|0;j=j|0;k=k|0;var l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0;E=i;i=i+48|0;z=E;w=E+32|0;a:do if((j|0)==0?(c[f+2404+(h<<2)>>2]|0)==0:0){s=g+28|0;n=c[s>>2]|0;t=g+32|0;j=c[t>>2]|0;l=n>>>8;h=-1;while(1){h=h+1|0;m=_(l,d[29937+h>>0]|0)|0;if(j>>>0>=m>>>0)break;else n=m}r=j-m|0;c[t>>2]=r;j=n-m|0;c[s>>2]=j;n=g+20|0;o=g+40|0;p=g+24|0;q=g+4|0;while(1){if(j>>>0>=8388609)break a;c[n>>2]=(c[n>>2]|0)+8;j=j<<8;c[s>>2]=j;m=c[o>>2]|0;l=c[p>>2]|0;if(l>>>0<(c[q>>2]|0)>>>0){c[p>>2]=l+1;l=d[(c[g>>2]|0)+l>>0]|0}else l=0;c[o>>2]=l;D=((m<<8|l)>>>1&255|r<<8&2147483392)^255;c[t>>2]=D;r=D}}else B=3;while(0);if((B|0)==3){r=g+28|0;n=c[r>>2]|0;s=g+32|0;j=c[s>>2]|0;l=n>>>8;t=-1;while(1){m=t+1|0;h=_(l,d[29933+m>>0]|0)|0;if(j>>>0>>0){t=m;n=h}else break}q=j-h|0;c[s>>2]=q;h=n-h|0;c[r>>2]=h;m=g+20|0;n=g+40|0;o=g+24|0;p=g+4|0;while(1){if(h>>>0>=8388609)break;c[m>>2]=(c[m>>2]|0)+8;h=h<<8;c[r>>2]=h;l=c[n>>2]|0;j=c[o>>2]|0;if(j>>>0<(c[p>>2]|0)>>>0){c[o>>2]=j+1;j=d[(c[g>>2]|0)+j>>0]|0}else j=0;c[n>>2]=j;D=((l<<8|j)>>>1&255|q<<8&2147483392)^255;c[s>>2]=D;q=D}h=t+3|0}j=h>>>1;D=f+2765|0;a[D>>0]=j;a[f+2766>>0]=h&1;x=(k|0)==2;if(x){t=g+28|0;m=c[t>>2]|0;r=g+32|0;j=c[r>>2]|0;l=m>>>8;s=-1;while(1){s=s+1|0;h=_(l,d[29396+s>>0]|0)|0;if(j>>>0>=h>>>0)break;else m=h}C=j-h|0;c[r>>2]=C;h=m-h|0;c[t>>2]=h;n=g+20|0;o=g+40|0;p=g+24|0;q=g+4|0;m=C;while(1){if(h>>>0>=8388609)break;c[n>>2]=(c[n>>2]|0)+8;h=h<<8;c[t>>2]=h;l=c[o>>2]|0;j=c[p>>2]|0;if(j>>>0<(c[q>>2]|0)>>>0){c[p>>2]=j+1;j=d[(c[g>>2]|0)+j>>0]|0}else j=0;c[o>>2]=j;C=((l<<8|j)>>>1&255|m<<8&2147483392)^255;c[r>>2]=C;m=C}a[f+2736>>0]=s;v=r;C=n;u=p;A=g}else{h=j<<24>>24;t=g+28|0;n=c[t>>2]|0;v=g+32|0;j=c[v>>2]|0;l=n>>>8;r=-1;while(1){r=r+1|0;m=_(l,d[29372+(h<<3)+r>>0]|0)|0;if(j>>>0>=m>>>0)break;else n=m}C=j-m|0;c[v>>2]=C;h=n-m|0;c[t>>2]=h;s=g+20|0;o=g+40|0;u=g+24|0;q=g+4|0;m=C;while(1){if(h>>>0>=8388609)break;c[s>>2]=(c[s>>2]|0)+8;h=h<<8;c[t>>2]=h;l=c[o>>2]|0;j=c[u>>2]|0;if(j>>>0<(c[q>>2]|0)>>>0){c[u>>2]=j+1;j=d[(c[g>>2]|0)+j>>0]|0}else j=0;c[o>>2]=j;C=((l<<8|j)>>>1&255|m<<8&2147483392)^255;c[v>>2]=C;m=C}p=f+2736|0;a[p>>0]=r<<3;m=c[t>>2]|0;h=c[v>>2]|0;j=m>>>8;n=-1;while(1){n=n+1|0;l=_(j,d[29962+n>>0]|0)|0;if(h>>>0>=l>>>0)break;else m=l}C=h-l|0;c[v>>2]=C;h=m-l|0;c[t>>2]=h;m=C;while(1){if(h>>>0>=8388609)break;c[s>>2]=(c[s>>2]|0)+8;h=h<<8;c[t>>2]=h;l=c[o>>2]|0;j=c[u>>2]|0;if(j>>>0<(c[q>>2]|0)>>>0){c[u>>2]=j+1;j=d[(c[g>>2]|0)+j>>0]|0}else j=0;c[o>>2]=j;C=((l<<8|j)>>>1&255|m<<8&2147483392)^255;c[v>>2]=C;m=C}a[p>>0]=(d[p>>0]|0)+n;C=s;A=g}y=f+2324|0;n=1;while(1){if((n|0)>=(c[y>>2]|0))break;m=c[t>>2]|0;h=c[v>>2]|0;j=m>>>8;p=-1;while(1){p=p+1|0;l=_(j,d[29396+p>>0]|0)|0;if(h>>>0>=l>>>0)break;else m=l}g=h-l|0;c[v>>2]=g;h=m-l|0;c[t>>2]=h;m=g;while(1){if(h>>>0>=8388609)break;c[C>>2]=(c[C>>2]|0)+8;h=h<<8;c[t>>2]=h;l=c[o>>2]|0;j=c[u>>2]|0;if(j>>>0<(c[q>>2]|0)>>>0){c[u>>2]=j+1;j=d[(c[A>>2]|0)+j>>0]|0}else j=0;c[o>>2]=j;g=((l<<8|j)>>>1&255|m<<8&2147483392)^255;c[v>>2]=g;m=g}a[f+2736+n>>0]=p;n=n+1|0}g=f+2732|0;n=c[g>>2]|0;h=_(a[D>>0]>>1,b[n>>1]|0)|0;h=(c[n+16>>2]|0)+h|0;n=c[t>>2]|0;j=c[v>>2]|0;l=n>>>8;p=-1;while(1){p=p+1|0;m=_(l,d[h+p>>0]|0)|0;if(j>>>0>=m>>>0)break;else n=m}s=j-m|0;c[v>>2]=s;h=n-m|0;c[t>>2]=h;m=s;while(1){if(h>>>0>=8388609)break;c[C>>2]=(c[C>>2]|0)+8;h=h<<8;c[t>>2]=h;l=c[o>>2]|0;j=c[u>>2]|0;if(j>>>0<(c[q>>2]|0)>>>0){c[u>>2]=j+1;j=d[(c[A>>2]|0)+j>>0]|0}else j=0;c[o>>2]=j;s=((l<<8|j)>>>1&255|m<<8&2147483392)^255;c[v>>2]=s;m=s}a[f+2744>>0]=p;Cd(z,w,c[g>>2]|0,p<<24>>24);s=0;while(1){h=c[g>>2]|0;if((s|0)>=(b[h+2>>1]|0))break;j=(c[h+28>>2]|0)+(b[z+(s<<1)>>1]|0)|0;p=c[t>>2]|0;l=c[v>>2]|0;m=p>>>8;r=-1;while(1){h=r+1|0;n=_(m,d[j+h>>0]|0)|0;if(l>>>0>>0){r=h;p=n}else break}w=l-n|0;c[v>>2]=w;l=p-n|0;c[t>>2]=l;p=w;while(1){if(l>>>0>=8388609)break;c[C>>2]=(c[C>>2]|0)+8;l=l<<8;c[t>>2]=l;m=c[o>>2]|0;j=c[u>>2]|0;if(j>>>0<(c[q>>2]|0)>>>0){c[u>>2]=j+1;j=d[(c[A>>2]|0)+j>>0]|0}else j=0;c[o>>2]=j;w=((m<<8|j)>>>1&255|p<<8&2147483392)^255;c[v>>2]=w;p=w}switch(r|0){case -1:{m=l>>>8;n=-1;while(1){h=n+1|0;j=_(m,d[29970+h>>0]|0)|0;if(p>>>0>>0){n=h;l=j}else break}m=p-j|0;c[v>>2]=m;h=l-j|0;c[t>>2]=h;while(1){if(h>>>0>=8388609)break;c[C>>2]=(c[C>>2]|0)+8;h=h<<8;c[t>>2]=h;l=c[o>>2]|0;j=c[u>>2]|0;if(j>>>0<(c[q>>2]|0)>>>0){c[u>>2]=j+1;j=d[(c[A>>2]|0)+j>>0]|0}else j=0;c[o>>2]=j;w=((l<<8|j)>>>1&255|m<<8&2147483392)^255;c[v>>2]=w;m=w}h=~n;break}case 7:{m=l>>>8;n=-1;while(1){h=n+1|0;j=_(m,d[29970+h>>0]|0)|0;if(p>>>0>>0){n=h;l=j}else break}m=p-j|0;c[v>>2]=m;h=l-j|0;c[t>>2]=h;while(1){if(h>>>0>=8388609)break;c[C>>2]=(c[C>>2]|0)+8;h=h<<8;c[t>>2]=h;l=c[o>>2]|0;j=c[u>>2]|0;if(j>>>0<(c[q>>2]|0)>>>0){c[u>>2]=j+1;j=d[(c[A>>2]|0)+j>>0]|0}else j=0;c[o>>2]=j;w=((l<<8|j)>>>1&255|m<<8&2147483392)^255;c[v>>2]=w;m=w}h=n+9|0;break}default:{}}w=s+1|0;a[f+2744+w>>0]=h+252;s=w}if((c[y>>2]|0)==4){m=c[t>>2]|0;h=c[v>>2]|0;j=m>>>8;n=-1;while(1){n=n+1|0;l=_(j,d[29939+n>>0]|0)|0;if(h>>>0>=l>>>0)break;else m=l}z=h-l|0;c[v>>2]=z;h=m-l|0;c[t>>2]=h;m=z;while(1){if(h>>>0>=8388609)break;c[C>>2]=(c[C>>2]|0)+8;h=h<<8;c[t>>2]=h;l=c[o>>2]|0;j=c[u>>2]|0;if(j>>>0<(c[q>>2]|0)>>>0){c[u>>2]=j+1;j=d[(c[A>>2]|0)+j>>0]|0}else j=0;c[o>>2]=j;z=((l<<8|j)>>>1&255|m<<8&2147483392)^255;c[v>>2]=z;m=z}a[f+2767>>0]=n}else a[f+2767>>0]=4;do if((a[D>>0]|0)==2){if(x?(c[f+2396>>2]|0)==2:0){m=c[t>>2]|0;h=c[v>>2]|0;j=m>>>8;p=-1;while(1){n=p+1|0;l=_(j,d[30009+n>>0]|0)|0;if(h>>>0>>0){p=n;m=l}else break}z=h-l|0;c[v>>2]=z;h=m-l|0;c[t>>2]=h;m=z;while(1){if(h>>>0>=8388609)break;c[C>>2]=(c[C>>2]|0)+8;h=h<<8;c[t>>2]=h;l=c[o>>2]|0;j=c[u>>2]|0;if(j>>>0<(c[q>>2]|0)>>>0){c[u>>2]=j+1;j=d[(c[A>>2]|0)+j>>0]|0}else j=0;c[o>>2]=j;z=((l<<8|j)>>>1&255|m<<8&2147483392)^255;c[v>>2]=z;m=z}if((n&65535)<<16>>16>0){h=f+2400|0;j=(e[h>>1]|0)+(p+65528)&65535;b[f+2762>>1]=j}else B=108}else B=108;if((B|0)==108){m=c[t>>2]|0;h=c[v>>2]|0;j=m>>>8;n=-1;while(1){n=n+1|0;l=_(j,d[29977+n>>0]|0)|0;if(h>>>0>=l>>>0)break;else m=l}B=h-l|0;c[v>>2]=B;h=m-l|0;c[t>>2]=h;m=B;while(1){if(h>>>0>=8388609)break;c[C>>2]=(c[C>>2]|0)+8;h=h<<8;c[t>>2]=h;l=c[o>>2]|0;j=c[u>>2]|0;if(j>>>0<(c[q>>2]|0)>>>0){c[u>>2]=j+1;j=d[(c[A>>2]|0)+j>>0]|0}else j=0;c[o>>2]=j;B=((l<<8|j)>>>1&255|m<<8&2147483392)^255;c[v>>2]=B;m=B}r=f+2762|0;b[r>>1]=_(n<<16>>16,c[f+2316>>2]>>1)|0;h=c[f+2380>>2]|0;n=c[t>>2]|0;j=c[v>>2]|0;l=n>>>8;p=-1;while(1){p=p+1|0;m=_(l,d[h+p>>0]|0)|0;if(j>>>0>=m>>>0)break;else n=m}B=j-m|0;c[v>>2]=B;h=n-m|0;c[t>>2]=h;m=B;while(1){if(h>>>0>=8388609)break;c[C>>2]=(c[C>>2]|0)+8;h=h<<8;c[t>>2]=h;l=c[o>>2]|0;j=c[u>>2]|0;if(j>>>0<(c[q>>2]|0)>>>0){c[u>>2]=j+1;j=d[(c[A>>2]|0)+j>>0]|0}else j=0;c[o>>2]=j;B=((l<<8|j)>>>1&255|m<<8&2147483392)^255;c[v>>2]=B;m=B}j=(e[r>>1]|0)+p&65535;b[r>>1]=j;h=f+2400|0}b[h>>1]=j;h=c[f+2384>>2]|0;n=c[t>>2]|0;j=c[v>>2]|0;l=n>>>8;p=-1;while(1){p=p+1|0;m=_(l,d[h+p>>0]|0)|0;if(j>>>0>=m>>>0)break;else n=m}B=j-m|0;c[v>>2]=B;h=n-m|0;c[t>>2]=h;m=B;while(1){if(h>>>0>=8388609)break;c[C>>2]=(c[C>>2]|0)+8;h=h<<8;c[t>>2]=h;l=c[o>>2]|0;j=c[u>>2]|0;if(j>>>0<(c[q>>2]|0)>>>0){c[u>>2]=j+1;j=d[(c[A>>2]|0)+j>>0]|0}else j=0;c[o>>2]=j;B=((l<<8|j)>>>1&255|m<<8&2147483392)^255;c[v>>2]=B;m=B}a[f+2764>>0]=p;m=c[t>>2]|0;h=c[v>>2]|0;j=m>>>8;n=-1;while(1){n=n+1|0;l=_(j,d[29437+n>>0]|0)|0;if(h>>>0>=l>>>0)break;else m=l}B=h-l|0;c[v>>2]=B;h=m-l|0;c[t>>2]=h;m=B;while(1){if(h>>>0>=8388609)break;c[C>>2]=(c[C>>2]|0)+8;h=h<<8;c[t>>2]=h;l=c[o>>2]|0;j=c[u>>2]|0;if(j>>>0<(c[q>>2]|0)>>>0){c[u>>2]=j+1;j=d[(c[A>>2]|0)+j>>0]|0}else j=0;c[o>>2]=j;B=((l<<8|j)>>>1&255|m<<8&2147483392)^255;c[v>>2]=B;m=B}s=f+2768|0;a[s>>0]=n;p=0;while(1){if((p|0)>=(c[y>>2]|0))break;h=c[17376+(a[s>>0]<<2)>>2]|0;n=c[t>>2]|0;j=c[v>>2]|0;l=n>>>8;r=-1;while(1){r=r+1|0;m=_(l,d[h+r>>0]|0)|0;if(j>>>0>=m>>>0)break;else n=m}B=j-m|0;c[v>>2]=B;h=n-m|0;c[t>>2]=h;m=B;while(1){if(h>>>0>=8388609)break;c[C>>2]=(c[C>>2]|0)+8;h=h<<8;c[t>>2]=h;l=c[o>>2]|0;j=c[u>>2]|0;if(j>>>0<(c[q>>2]|0)>>>0){c[u>>2]=j+1;j=d[(c[A>>2]|0)+j>>0]|0}else j=0;c[o>>2]=j;B=((l<<8|j)>>>1&255|m<<8&2147483392)^255;c[v>>2]=B;m=B}a[f+2740+p>>0]=r;p=p+1|0}if(k|0){a[f+2769>>0]=0;break}m=c[t>>2]|0;h=c[v>>2]|0;j=m>>>8;n=-1;while(1){n=n+1|0;l=_(j,d[29930+n>>0]|0)|0;if(h>>>0>=l>>>0)break;else m=l}k=h-l|0;c[v>>2]=k;h=m-l|0;c[t>>2]=h;m=k;while(1){if(h>>>0>=8388609)break;c[C>>2]=(c[C>>2]|0)+8;h=h<<8;c[t>>2]=h;l=c[o>>2]|0;j=c[u>>2]|0;if(j>>>0<(c[q>>2]|0)>>>0){c[u>>2]=j+1;j=d[(c[A>>2]|0)+j>>0]|0}else j=0;c[o>>2]=j;k=((l<<8|j)>>>1&255|m<<8&2147483392)^255;c[v>>2]=k;m=k}a[f+2769>>0]=n}while(0);c[f+2396>>2]=a[D>>0];m=c[t>>2]|0;h=c[v>>2]|0;j=m>>>8;n=-1;while(1){n=n+1|0;l=_(j,d[29947+n>>0]|0)|0;if(h>>>0>=l>>>0)break;else m=l}k=h-l|0;c[v>>2]=k;h=m-l|0;c[t>>2]=h;m=k;while(1){if(h>>>0>=8388609)break;c[C>>2]=(c[C>>2]|0)+8;h=h<<8;c[t>>2]=h;l=c[o>>2]|0;j=c[u>>2]|0;if(j>>>0<(c[q>>2]|0)>>>0){c[u>>2]=j+1;j=d[(c[A>>2]|0)+j>>0]|0}else j=0;c[o>>2]=j;k=((l<<8|j)>>>1&255|m<<8&2147483392)^255;c[v>>2]=k;m=k}a[f+2770>>0]=n;i=E;return}function fe(e,f,g,h,j){e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;var k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0;J=i;i=i+176|0;H=J+160|0;I=J+80|0;A=J;k=g>>1;F=e+28|0;o=c[F>>2]|0;G=e+32|0;m=c[G>>2]|0;n=o>>>8;u=-1;while(1){u=u+1|0;l=_(n,d[30432+(k*9|0)+u>>0]|0)|0;if(m>>>0>=l>>>0)break;else o=l}n=m-l|0;c[G>>2]=n;k=o-l|0;c[F>>2]=k;B=e+20|0;C=e+40|0;D=e+24|0;E=e+4|0;while(1){if(k>>>0>=8388609)break;c[B>>2]=(c[B>>2]|0)+8;k=k<<8;c[F>>2]=k;m=c[C>>2]|0;l=c[D>>2]|0;if(l>>>0<(c[E>>2]|0)>>>0){c[D>>2]=l+1;l=d[(c[e>>2]|0)+l>>0]|0}else l=0;c[C>>2]=l;z=((m<<8|l)>>>1&255|n<<8&2147483392)^255;c[G>>2]=z;n=z}z=j>>4;z=z+((z<<4|0)<(j|0)&1)|0;t=0;while(1){if((t|0)>=(z|0)){x=0;break}s=A+(t<<2)|0;c[s>>2]=0;m=k>>>8;o=-1;while(1){o=o+1|0;l=_(m,d[30090+(u*18|0)+o>>0]|0)|0;if(n>>>0>=l>>>0)break;else k=l}n=n-l|0;c[G>>2]=n;k=k-l|0;c[F>>2]=k;while(1){if(k>>>0>=8388609)break;c[B>>2]=(c[B>>2]|0)+8;k=k<<8;c[F>>2]=k;m=c[C>>2]|0;l=c[D>>2]|0;if(l>>>0<(c[E>>2]|0)>>>0){c[D>>2]=l+1;l=d[(c[e>>2]|0)+l>>0]|0}else l=0;c[C>>2]=l;x=((m<<8|l)>>>1&255|n<<8&2147483392)^255;c[G>>2]=x;n=x}r=I+(t<<2)|0;m=0;l=o;a:while(1){c[r>>2]=l;if((l|0)!=17)break;q=m+1|0;c[s>>2]=q;o=30252+((q|0)==10&1)|0;p=k>>>8;l=-1;while(1){l=l+1|0;m=_(p,d[o+l>>0]|0)|0;if(n>>>0>=m>>>0)break;else k=m}n=n-m|0;c[G>>2]=n;k=k-m|0;c[F>>2]=k;while(1){if(k>>>0>=8388609){m=q;continue a}c[B>>2]=(c[B>>2]|0)+8;k=k<<8;c[F>>2]=k;o=c[C>>2]|0;m=c[D>>2]|0;if(m>>>0<(c[E>>2]|0)>>>0){c[D>>2]=m+1;m=d[(c[e>>2]|0)+m>>0]|0}else m=0;c[C>>2]=m;x=((o<<8|m)>>>1&255|n<<8&2147483392)^255;c[G>>2]=x;n=x}}t=t+1|0}while(1){if((x|0)>=(z|0)){s=0;break}q=c[I+(x<<2)>>2]|0;k=f+(x<<16>>12<<1)|0;if((q|0)>0){l=30924+(d[31076+q>>0]|0)|0;p=c[F>>2]|0;m=c[G>>2]|0;n=p>>>8;s=-1;while(1){s=s+1|0;o=_(n,d[l+s>>0]|0)|0;if(m>>>0>=o>>>0)break;else p=o}w=m-o|0;c[G>>2]=w;l=p-o|0;c[F>>2]=l;o=w;while(1){if(l>>>0>=8388609)break;c[B>>2]=(c[B>>2]|0)+8;l=l<<8;c[F>>2]=l;n=c[C>>2]|0;m=c[D>>2]|0;if(m>>>0<(c[E>>2]|0)>>>0){c[D>>2]=m+1;m=d[(c[e>>2]|0)+m>>0]|0}else m=0;c[C>>2]=m;w=((n<<8|m)>>>1&255|o<<8&2147483392)^255;c[G>>2]=w;o=w}v=q-s|0;w=v&65535;r=s<<16>>16;if((s&65535)<<16>>16>0){l=30772+(d[31076+r>>0]|0)|0;p=c[F>>2]|0;m=c[G>>2]|0;n=p>>>8;q=-1;while(1){q=q+1|0;o=_(n,d[l+q>>0]|0)|0;if(m>>>0>=o>>>0)break;else p=o}u=m-o|0;c[G>>2]=u;l=p-o|0;c[F>>2]=l;o=u;while(1){if(l>>>0>=8388609)break;c[B>>2]=(c[B>>2]|0)+8;l=l<<8;c[F>>2]=l;n=c[C>>2]|0;m=c[D>>2]|0;if(m>>>0<(c[E>>2]|0)>>>0){c[D>>2]=m+1;m=d[(c[e>>2]|0)+m>>0]|0}else m=0;c[C>>2]=m;u=((n<<8|m)>>>1&255|o<<8&2147483392)^255;c[G>>2]=u;o=u}u=q&65535;l=r-q&65535;r=u<<16>>16;if(u<<16>>16>0){m=30620+(d[31076+r>>0]|0)|0;q=c[F>>2]|0;n=c[G>>2]|0;o=q>>>8;s=-1;while(1){s=s+1|0;p=_(o,d[m+s>>0]|0)|0;if(n>>>0>=p>>>0)break;else q=p}u=n-p|0;c[G>>2]=u;m=q-p|0;c[F>>2]=m;p=u;while(1){if(m>>>0>=8388609)break;c[B>>2]=(c[B>>2]|0)+8;m=m<<8;c[F>>2]=m;o=c[C>>2]|0;n=c[D>>2]|0;if(n>>>0<(c[E>>2]|0)>>>0){c[D>>2]=n+1;n=d[(c[e>>2]|0)+n>>0]|0}else n=0;c[C>>2]=n;u=((o<<8|n)>>>1&255|p<<8&2147483392)^255;c[G>>2]=u;p=u}t=s&65535;u=r-s&65535;m=k+2|0;s=t<<16>>16;if(t<<16>>16>0){n=30468+(d[31076+s>>0]|0)|0;r=c[F>>2]|0;o=c[G>>2]|0;p=r>>>8;t=-1;while(1){t=t+1|0;q=_(p,d[n+t>>0]|0)|0;if(o>>>0>=q>>>0)break;else r=q}p=o-q|0;c[G>>2]=p;n=r-q|0;c[F>>2]=n;q=p;while(1){if(n>>>0>=8388609)break;c[B>>2]=(c[B>>2]|0)+8;n=n<<8;c[F>>2]=n;p=c[C>>2]|0;o=c[D>>2]|0;if(o>>>0<(c[E>>2]|0)>>>0){c[D>>2]=o+1;o=d[(c[e>>2]|0)+o>>0]|0}else o=0;c[C>>2]=o;r=((p<<8|o)>>>1&255|q<<8&2147483392)^255;c[G>>2]=r;q=r}b[k>>1]=t;o=s-t&65535;n=u;u=l}else{n=u;y=62}}else y=52}else{l=0;y=52}if((y|0)==52){m=k+2|0;n=0;y=62}if((y|0)==62){y=0;b[k>>1]=0;o=0;u=l}b[m>>1]=o;r=k+4|0;t=k+6|0;s=n<<16>>16;if(n<<16>>16>0){l=30468+(d[31076+s>>0]|0)|0;p=c[F>>2]|0;m=c[G>>2]|0;n=p>>>8;q=-1;while(1){q=q+1|0;o=_(n,d[l+q>>0]|0)|0;if(m>>>0>=o>>>0)break;else p=o}n=m-o|0;c[G>>2]=n;l=p-o|0;c[F>>2]=l;o=n;while(1){if(l>>>0>=8388609)break;c[B>>2]=(c[B>>2]|0)+8;l=l<<8;c[F>>2]=l;n=c[C>>2]|0;m=c[D>>2]|0;if(m>>>0<(c[E>>2]|0)>>>0){c[D>>2]=m+1;m=d[(c[e>>2]|0)+m>>0]|0}else m=0;c[C>>2]=m;p=((n<<8|m)>>>1&255|o<<8&2147483392)^255;c[G>>2]=p;o=p}b[r>>1]=q;l=s-q&65535}else{b[r>>1]=0;l=0}b[t>>1]=l;r=u<<16>>16;if(u<<16>>16>0){l=30620+(d[31076+r>>0]|0)|0;p=c[F>>2]|0;m=c[G>>2]|0;n=p>>>8;q=-1;while(1){q=q+1|0;o=_(n,d[l+q>>0]|0)|0;if(m>>>0>=o>>>0)break;else p=o}u=m-o|0;c[G>>2]=u;l=p-o|0;c[F>>2]=l;o=u;while(1){if(l>>>0>=8388609)break;c[B>>2]=(c[B>>2]|0)+8;l=l<<8;c[F>>2]=l;n=c[C>>2]|0;m=c[D>>2]|0;if(m>>>0<(c[E>>2]|0)>>>0){c[D>>2]=m+1;m=d[(c[e>>2]|0)+m>>0]|0}else m=0;c[C>>2]=m;u=((n<<8|m)>>>1&255|o<<8&2147483392)^255;c[G>>2]=u;o=u}u=q&65535;n=r-q&65535;m=k+8|0;l=k+10|0;t=u<<16>>16;if(u<<16>>16>0){o=30468+(d[31076+t>>0]|0)|0;s=c[F>>2]|0;p=c[G>>2]|0;q=s>>>8;u=-1;while(1){u=u+1|0;r=_(q,d[o+u>>0]|0)|0;if(p>>>0>=r>>>0)break;else s=r}q=p-r|0;c[G>>2]=q;o=s-r|0;c[F>>2]=o;r=q;while(1){if(o>>>0>=8388609)break;c[B>>2]=(c[B>>2]|0)+8;o=o<<8;c[F>>2]=o;q=c[C>>2]|0;p=c[D>>2]|0;if(p>>>0<(c[E>>2]|0)>>>0){c[D>>2]=p+1;p=d[(c[e>>2]|0)+p>>0]|0}else p=0;c[C>>2]=p;s=((q<<8|p)>>>1&255|r<<8&2147483392)^255;c[G>>2]=s;r=s}b[m>>1]=u;m=t-u&65535}else y=91}else{m=k+8|0;l=k+10|0;n=0;y=91}if((y|0)==91){y=0;b[m>>1]=0;m=0}b[l>>1]=m;r=k+12|0;t=k+14|0;s=n<<16>>16;if(n<<16>>16>0){l=30468+(d[31076+s>>0]|0)|0;p=c[F>>2]|0;m=c[G>>2]|0;n=p>>>8;q=-1;while(1){q=q+1|0;o=_(n,d[l+q>>0]|0)|0;if(m>>>0>=o>>>0)break;else p=o}u=m-o|0;c[G>>2]=u;l=p-o|0;c[F>>2]=l;o=u;while(1){if(l>>>0>=8388609)break;c[B>>2]=(c[B>>2]|0)+8;l=l<<8;c[F>>2]=l;n=c[C>>2]|0;m=c[D>>2]|0;if(m>>>0<(c[E>>2]|0)>>>0){c[D>>2]=m+1;m=d[(c[e>>2]|0)+m>>0]|0}else m=0;c[C>>2]=m;u=((n<<8|m)>>>1&255|o<<8&2147483392)^255;c[G>>2]=u;o=u}b[r>>1]=q;l=s-q&65535}else{b[r>>1]=0;l=0}b[t>>1]=l;r=v<<16>>16;if(w<<16>>16>0){l=30772+(d[31076+r>>0]|0)|0;p=c[F>>2]|0;m=c[G>>2]|0;n=p>>>8;q=-1;while(1){q=q+1|0;o=_(n,d[l+q>>0]|0)|0;if(m>>>0>=o>>>0)break;else p=o}w=m-o|0;c[G>>2]=w;l=p-o|0;c[F>>2]=l;o=w;while(1){if(l>>>0>=8388609)break;c[B>>2]=(c[B>>2]|0)+8;l=l<<8;c[F>>2]=l;n=c[C>>2]|0;m=c[D>>2]|0;if(m>>>0<(c[E>>2]|0)>>>0){c[D>>2]=m+1;m=d[(c[e>>2]|0)+m>>0]|0}else m=0;c[C>>2]=m;w=((n<<8|m)>>>1&255|o<<8&2147483392)^255;c[G>>2]=w;o=w}w=q&65535;l=r-q&65535;r=w<<16>>16;if(w<<16>>16>0){m=30620+(d[31076+r>>0]|0)|0;q=c[F>>2]|0;n=c[G>>2]|0;o=q>>>8;s=-1;while(1){s=s+1|0;p=_(o,d[m+s>>0]|0)|0;if(n>>>0>=p>>>0)break;else q=p}w=n-p|0;c[G>>2]=w;m=q-p|0;c[F>>2]=m;p=w;while(1){if(m>>>0>=8388609)break;c[B>>2]=(c[B>>2]|0)+8;m=m<<8;c[F>>2]=m;o=c[C>>2]|0;n=c[D>>2]|0;if(n>>>0<(c[E>>2]|0)>>>0){c[D>>2]=n+1;n=d[(c[e>>2]|0)+n>>0]|0}else n=0;c[C>>2]=n;w=((o<<8|n)>>>1&255|p<<8&2147483392)^255;c[G>>2]=w;p=w}w=s&65535;o=r-s&65535;t=k+16|0;m=k+18|0;u=w<<16>>16;if(w<<16>>16>0){n=30468+(d[31076+u>>0]|0)|0;s=c[F>>2]|0;p=c[G>>2]|0;q=s>>>8;v=-1;while(1){v=v+1|0;r=_(q,d[n+v>>0]|0)|0;if(p>>>0>=r>>>0)break;else s=r}w=p-r|0;c[G>>2]=w;n=s-r|0;c[F>>2]=n;r=w;while(1){if(n>>>0>=8388609)break;c[B>>2]=(c[B>>2]|0)+8;n=n<<8;c[F>>2]=n;q=c[C>>2]|0;p=c[D>>2]|0;if(p>>>0<(c[E>>2]|0)>>>0){c[D>>2]=p+1;p=d[(c[e>>2]|0)+p>>0]|0}else p=0;c[C>>2]=p;w=((q<<8|p)>>>1&255|r<<8&2147483392)^255;c[G>>2]=w;r=w}b[t>>1]=v;n=u-v&65535;u=l}else{n=t;y=128}}else y=118}else{l=0;y=118}if((y|0)==118){n=k+16|0;m=k+18|0;o=0;y=128}if((y|0)==128){y=0;b[n>>1]=0;n=0;u=l}b[m>>1]=n;r=k+20|0;t=k+22|0;s=o<<16>>16;if(o<<16>>16>0){l=30468+(d[31076+s>>0]|0)|0;p=c[F>>2]|0;m=c[G>>2]|0;n=p>>>8;q=-1;while(1){q=q+1|0;o=_(n,d[l+q>>0]|0)|0;if(m>>>0>=o>>>0)break;else p=o}w=m-o|0;c[G>>2]=w;l=p-o|0;c[F>>2]=l;o=w;while(1){if(l>>>0>=8388609)break;c[B>>2]=(c[B>>2]|0)+8;l=l<<8;c[F>>2]=l;n=c[C>>2]|0;m=c[D>>2]|0;if(m>>>0<(c[E>>2]|0)>>>0){c[D>>2]=m+1;m=d[(c[e>>2]|0)+m>>0]|0}else m=0;c[C>>2]=m;w=((n<<8|m)>>>1&255|o<<8&2147483392)^255;c[G>>2]=w;o=w}b[r>>1]=q;l=s-q&65535}else{b[r>>1]=0;l=0}b[t>>1]=l;r=u<<16>>16;if(u<<16>>16>0){l=30620+(d[31076+r>>0]|0)|0;p=c[F>>2]|0;m=c[G>>2]|0;n=p>>>8;q=-1;while(1){q=q+1|0;o=_(n,d[l+q>>0]|0)|0;if(m>>>0>=o>>>0)break;else p=o}w=m-o|0;c[G>>2]=w;l=p-o|0;c[F>>2]=l;o=w;while(1){if(l>>>0>=8388609)break;c[B>>2]=(c[B>>2]|0)+8;l=l<<8;c[F>>2]=l;n=c[C>>2]|0;m=c[D>>2]|0;if(m>>>0<(c[E>>2]|0)>>>0){c[D>>2]=m+1;m=d[(c[e>>2]|0)+m>>0]|0}else m=0;c[C>>2]=m;w=((n<<8|m)>>>1&255|o<<8&2147483392)^255;c[G>>2]=w;o=w}w=q&65535;n=r-q&65535;m=k+24|0;l=k+26|0;t=w<<16>>16;if(w<<16>>16>0){o=30468+(d[31076+t>>0]|0)|0;s=c[F>>2]|0;p=c[G>>2]|0;q=s>>>8;u=-1;while(1){u=u+1|0;r=_(q,d[o+u>>0]|0)|0;if(p>>>0>=r>>>0)break;else s=r}w=p-r|0;c[G>>2]=w;o=s-r|0;c[F>>2]=o;r=w;while(1){if(o>>>0>=8388609)break;c[B>>2]=(c[B>>2]|0)+8;o=o<<8;c[F>>2]=o;q=c[C>>2]|0;p=c[D>>2]|0;if(p>>>0<(c[E>>2]|0)>>>0){c[D>>2]=p+1;p=d[(c[e>>2]|0)+p>>0]|0}else p=0;c[C>>2]=p;w=((q<<8|p)>>>1&255|r<<8&2147483392)^255;c[G>>2]=w;r=w}b[m>>1]=u;m=t-u&65535}else y=157}else{m=k+24|0;l=k+26|0;n=0;y=157}if((y|0)==157){y=0;b[m>>1]=0;m=0}b[l>>1]=m;r=k+28|0;s=k+30|0;q=n<<16>>16;if(n<<16>>16>0){k=30468+(d[31076+q>>0]|0)|0;o=c[F>>2]|0;l=c[G>>2]|0;m=o>>>8;p=-1;while(1){p=p+1|0;n=_(m,d[k+p>>0]|0)|0;if(l>>>0>=n>>>0)break;else o=n}w=l-n|0;c[G>>2]=w;k=o-n|0;c[F>>2]=k;n=w;while(1){if(k>>>0>=8388609)break;c[B>>2]=(c[B>>2]|0)+8;k=k<<8;c[F>>2]=k;m=c[C>>2]|0;l=c[D>>2]|0;if(l>>>0<(c[E>>2]|0)>>>0){c[D>>2]=l+1;l=d[(c[e>>2]|0)+l>>0]|0}else l=0;c[C>>2]=l;w=((m<<8|l)>>>1&255|n<<8&2147483392)^255;c[G>>2]=w;n=w}b[r>>1]=p;k=q-p&65535}else{b[r>>1]=0;k=0}b[s>>1]=k}else{l=k+32|0;do{b[k>>1]=0;k=k+2|0}while((k|0)<(l|0))}x=x+1|0}while(1){if((s|0)>=(z|0))break;o=c[A+(s<<2)>>2]|0;if((o|0)>0){p=f+(s<<16>>12<<1)|0;u=0;while(1){if((u|0)==16)break;q=p+(u<<1)|0;r=b[q>>1]|0;t=0;while(1){if((t|0)==(o|0))break;n=c[F>>2]|0;k=c[G>>2]|0;l=n>>>8;v=-1;while(1){v=v+1|0;m=_(l,d[29928+v>>0]|0)|0;if(k>>>0>=m>>>0)break;else n=m}y=k-m|0;c[G>>2]=y;k=n-m|0;c[F>>2]=k;n=y;while(1){if(k>>>0>=8388609)break;c[B>>2]=(c[B>>2]|0)+8;k=k<<8;c[F>>2]=k;m=c[C>>2]|0;l=c[D>>2]|0;if(l>>>0<(c[E>>2]|0)>>>0){c[D>>2]=l+1;l=d[(c[e>>2]|0)+l>>0]|0}else l=0;c[C>>2]=l;y=((m<<8|l)>>>1&255|n<<8&2147483392)^255;c[G>>2]=y;n=y}r=(r<<1)+v|0;t=t+1|0}b[q>>1]=r;u=u+1|0}y=I+(s<<2)|0;c[y>>2]=c[y>>2]|o<<5}s=s+1|0}a[H+1>>0]=0;t=31093+(((g<<1)+h<<16>>16)*7|0)|0;r=j+8>>4;s=0;while(1){if((s|0)>=(r|0))break;k=c[I+(s<<2)>>2]|0;b:do if((k|0)>0){a[H>>0]=a[t+((k&30)>>>0<6?k&31:6)>>0]|0;p=0;while(1){if((p|0)==16)break b;o=f+(p<<1)|0;if((b[o>>1]|0)>0){n=c[F>>2]|0;k=c[G>>2]|0;l=n>>>8;q=-1;while(1){q=q+1|0;m=_(l,d[H+q>>0]|0)|0;if(k>>>0>=m>>>0)break;else n=m}j=k-m|0;c[G>>2]=j;k=n-m|0;c[F>>2]=k;n=j;while(1){if(k>>>0>=8388609)break;c[B>>2]=(c[B>>2]|0)+8;k=k<<8;c[F>>2]=k;m=c[C>>2]|0;l=c[D>>2]|0;if(l>>>0<(c[E>>2]|0)>>>0){c[D>>2]=l+1;l=d[(c[e>>2]|0)+l>>0]|0}else l=0;c[C>>2]=l;j=((m<<8|l)>>>1&255|n<<8&2147483392)^255;c[G>>2]=j;n=j}b[o>>1]=_(b[o>>1]|0,(q<<1)+-1|0)|0}p=p+1|0}}while(0);s=s+1|0;f=f+32|0}i=J;return} +function ge(b,e,f,g,h){b=b|0;e=e|0;f=f|0;g=g|0;h=h|0;var i=0,j=0,k=0,l=0,m=0,n=0;n=0;while(1){if((n|0)>=(h|0))break;m=e+(n<<2)|0;i=c[m>>2]|0;l=aa(i|0)|0;j=24-l|0;k=0-j|0;do if(j)if((j|0)<0){i=i<>>(j+32|0);break}else{i=i<<32-j|i>>>j;break}while(0);k=i&127;k=(((k+(((_(k,128-k|0)|0)*179|0)>>>16)+(31-l<<7)<<16)+-136970240>>16)*2251|0)>>>16;i=k&255;l=b+n|0;a[l>>0]=i;if((k<<24>>24|0)<(a[f>>0]|0)){i=i+1<<24>>24;a[l>>0]=i}if(i<<24>>24>63)i=63;else i=(i<<24>>24>0?i:0)<<24>>24;a[l>>0]=i;if(!(n|g)){i=(a[f>>0]|0)+-4|0;j=a[b>>0]|0;if((i|0)>63){if((j<<24>>24|0)<=(i|0))i=(j<<24>>24>63?j:63)<<24>>24}else if(j<<24>>24>63)i=63;else{l=j<<24>>24;i=(l|0)<(i|0)?i:l}i=i&255;a[b>>0]=i;a[f>>0]=i}else{j=(i&255)-(d[f>>0]|0)|0;i=j&255;a[l>>0]=i;k=(a[f>>0]|0)+8|0;j=j<<24>>24;if((j|0)>(k|0)){i=k+((j-k+1|0)>>>1)&255;a[l>>0]=i}if(i<<24>>24>36)i=36;else i=(i<<24>>24>-4?i:-4)<<24>>24;a[l>>0]=i;if((i|0)>(k|0))i=(a[f>>0]|0)+((i<<1)-k)|0;else i=(d[f>>0]|0)+(i&255)|0;a[f>>0]=i;a[l>>0]=(d[l>>0]|0)+4;i=a[f>>0]|0}i=i<<24>>24;i=(i*29|0)+(i*7281>>16)|0;k=i+2090|0;if((k|0)<3967)if((i|0)<-2090)i=0;else{i=k>>7;l=1<>16)<>7;else i=_(l>>7,j+((_(_(j,128-j|0)|0,-174)|0)>>16)|0)|0;i=l+i|0}else i=2147483647;c[m>>2]=i;n=n+1|0}return}function he(b,d,e,f,g){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,l=0;l=0;while(1){if((l|0)>=(g|0))break;do if(l|f){h=(a[d+l>>0]|0)+-4|0;i=a[e>>0]|0;j=i<<24>>24;k=j+8|0;if((h|0)>(k|0)){i=j+((h<<1)-k)|0;break}else{i=(i&255)+h|0;break}}else{k=a[d>>0]|0;i=(a[e>>0]|0)+-16|0;i=(k|0)>(i|0)?k:i}while(0);h=i&255;a[e>>0]=h;if(h<<24>>24<=63)if(h<<24>>24<0)h=0;else h=i<<24>>24;else h=63;a[e>>0]=h;h=(h*29|0)+(h*7281>>16)|0;j=h+2090|0;if((j|0)<3967)if((h|0)<-2090)h=0;else{h=j>>7;k=1<>16)<>7;else h=_(k>>7,i+((_(_(i,128-i|0)|0,-174)|0)>>16)|0)|0;h=k+h|0}else h=2147483647;c[b+(l<<2)>>2]=h;l=l+1|0}return}function ie(e,f,g){e=e|0;f=f|0;g=g|0;var h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0;t=i;i=i+80|0;q=t+64|0;s=t;Cd(t+32|0,q,g,a[f>>0]|0);m=f+1|0;n=b[g+4>>1]|0;r=g+2|0;h=b[r>>1]|0;o=h<<16>>16;j=o;k=0;while(1){p=j+-1|0;if((j|0)<=0)break;l=(_(k<<16>>16,d[q+p>>0]|0)|0)>>8;j=a[m+p>>0]|0;k=j<<24>>24<<10;if(j<<24>>24>0)j=k+-102|0;else j=j<<24>>24<0?k|102:k;k=l+((_(j>>16,n)|0)+((_(j&65535,n)|0)>>16))|0;b[s+(p<<1)>>1]=k;j=p}l=_(a[f>>0]|0,o)|0;k=(c[g+8>>2]|0)+l|0;l=(c[g+12>>2]|0)+(l<<1)|0;j=0;while(1){h=h<<16>>16;if((j|0)>=(h|0))break;h=((b[s+(j<<1)>>1]<<14|0)/(b[l+(j<<1)>>1]|0)|0)+(d[k+j>>0]<<7)|0;b[e+(j<<1)>>1]=(h|0)>32767?32767:((h|0)<0?0:h)&65535;h=b[r>>1]|0;j=j+1|0}ve(e,c[g+36>>2]|0,h);i=t;return}function je(d,e,f,g,h,j,k,l,m,n,o,p,q,r,s){d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;k=k|0;l=l|0;m=m|0;n=n|0;o=o|0;p=p|0;q=q|0;r=r|0;s=s|0;var t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,$=0,ba=0,ca=0,da=0,ea=0,fa=0,ga=0,ha=0,ia=0,ja=0,ka=0,la=0,ma=0,na=0,oa=0,pa=0,qa=0,ra=0,sa=0,ta=0,ua=0,va=0,wa=0,xa=0,ya=0,za=0,Aa=0,Ba=0,Ca=0,Da=0,Ea=0,Fa=0,Ga=0,Ha=0,Ia=0,Ja=0,Ka=0,La=0,Ma=0,Na=0,Oa=0,Pa=0,Qa=0,Ra=0,Sa=0,Ta=0,Ua=0,Va=0,Wa=0,Xa=0,Ya=0,Za=0,_a=0,$a=0,ab=0,bb=0;ab=i;Za=e+4436|0;c[Za>>2]=a[f+34>>0];_a=e+4424|0;sa=c[_a>>2]|0;Wa=b[f+30>>1]|0;Ja=f+29|0;Ka=b[25404+(a[Ja>>0]>>1<<2)+((Wa&65535)<<24>>24<<1)>>1]|0;Wa=(Wa&-256)<<16>>16!=1024&1;La=d+4684|0;ra=c[La>>2]|0;Ma=d+4676|0;Pa=ra+(c[Ma>>2]|0)|0;Na=i;i=i+((1*(Pa<<2)|0)+15&-16)|0;Oa=i;i=i+((1*(Pa<<1)|0)+15&-16)|0;Pa=d+4680|0;Qa=i;i=i+((1*(c[Pa>>2]<<2)|0)+15&-16)|0;Ra=e+4432|0;c[Ra>>2]=ra;ra=c[La>>2]|0;Sa=e+4428|0;c[Sa>>2]=ra;Ta=d+4672|0;Ua=Wa^1;Va=e+4444|0;Wa=Wa<<1^3;Xa=d+4732|0;Ya=e+4440|0;Ba=d+4728|0;Ca=e+3996|0;Da=e+4420|0;Ea=e+4320|0;Fa=e+4416|0;Ga=(r|0)>2048;Ia=(r|0)/2|0;Ha=Ia+-512|0;Ia=512-Ia|0;ua=r<<16>>16;va=Ka+944|0;wa=_(Ka,ua)|0;xa=_(va<<16>>16,ua)|0;ya=Ka+-944|0;za=_(944-Ka<<16>>16,ua)|0;Aa=e+3840|0;ta=s<<16>>16;d=ra;ra=0;r=sa;sa=e+(c[La>>2]<<1)|0;while(1){f=c[Ta>>2]|0;if((ra|0)>=(f|0))break;oa=j+((ra>>1|Ua)<<4<<1)|0;pa=k+(ra*5<<1)|0;qa=l+(ra*24<<1)|0;D=c[m+(ra<<2)>>2]|0;B=D>>2;D=B|D<<15;c[Va>>2]=0;f=a[Ja>>0]|0;s=q+(ra<<2)|0;if(f<<24>>24==2){f=c[s>>2]|0;if(!(ra&Wa)){z=c[La>>2]|0;d=c[Xa>>2]|0;w=z-f-d+-2|0;se(Oa+(w<<1)|0,e+(w+(_(ra,c[Pa>>2]|0)|0)<<1)|0,oa,z-w|0,d);c[Va>>2]=1;d=c[La>>2]|0;c[Sa>>2]=d;w=1;z=a[Ja>>0]|0;r=f}else{w=0;z=2;r=f}}else{w=0;z=f}y=c[s>>2]|0;A=p+(ra<<2)|0;x=c[A>>2]|0;s=(x|0)>1;f=aa((s?x:1)|0)|0;s=(s?x:1)<>16;u=536870911/(la|0)|0;ma=u<<16;na=ma>>16;s=536870912-((_(la,na)|0)+((_(s&65535,na)|0)>>16))<<3;u=ma+((_(s>>16,na)|0)+((_(s&65528,na)|0)>>16))+(_(s,(u>>15)+1>>1)|0)|0;f=62-f|0;s=f+-47|0;if((s|0)<1){t=47-f|0;f=-2147483648>>t;s=2147483647>>>t;if((f|0)>(s|0)){if((u|0)<=(f|0))f=(u|0)<(s|0)?s:u}else if((u|0)>(s|0))f=s;else f=(u|0)<(f|0)?f:u;f=f<>s:0;t=(f>>4)+1|0;s=t>>>1<<16>>16;t=(t>>16)+1>>1;v=c[Pa>>2]|0;u=0;while(1){if((u|0)>=(v|0))break;ma=b[g+(u<<1)>>1]|0;na=ma<<16>>16;c[Qa+(u<<2)>>2]=(_(na>>16,s)|0)+((_(ma&65535,s)|0)>>16)+(_(na,t)|0);u=u+1|0}a:do if(w|0){if(!ra)f=(_(f>>16,ta)|0)+((_(f&65535,ta)|0)>>16)<<2;t=f>>16;f=f&65535;s=d-y+-2|0;while(1){if((s|0)>=(d|0))break a;na=b[Oa+(s<<1)>>1]|0;c[Na+(s<<2)>>2]=(_(t,na)|0)+((_(f,na)|0)>>16);s=s+1|0}}while(0);s=c[Ya>>2]|0;if((x|0)==(s|0))f=z;else{if((s|0)<=0)if(!s)t=32;else{f=0-s|0;$a=26}else{f=s;$a=26}if(($a|0)==26){$a=0;t=aa(f|0)|0}d=s<>16|0)|0)<<16>>16;na=(_(d>>16,u)|0)+((_(d&65535,u)|0)>>16)|0;ma=zf(ma|0,((ma|0)<0)<<31>>31|0,na|0,((na|0)<0)<<31>>31|0)|0;ma=qf(ma|0,C|0,29)|0;d=d-(ma&-8)|0;u=na+((_(d>>16,u)|0)+((_(d&65535,u)|0)>>16))|0;f=t+28-f|0;d=f+-16|0;if((f|0)<16){s=16-f|0;f=-2147483648>>s;d=2147483647>>>s;if((f|0)>(d|0)){if((u|0)<=(f|0))f=(u|0)<(d|0)?d:u}else if((u|0)>(d|0))f=d;else f=(u|0)<(f|0)?f:u;s=f<>d:0;d=c[Ra>>2]|0;t=s>>16;u=s&65535;f=d;d=d-(c[La>>2]|0)|0;while(1){if((d|0)>=(f|0))break;f=e+1280+(d<<2)|0;na=c[f>>2]|0;ma=na<<16>>16;c[f>>2]=(_(t,ma)|0)+((_(u,ma)|0)>>16)+(_(s,(na>>15)+1>>1)|0);f=c[Ra>>2]|0;d=d+1|0}b:do if(z<<24>>24==2?(c[Va>>2]|0)==0:0){d=c[Sa>>2]|0;f=d-y+-2|0;while(1){if((f|0)>=(d|0))break b;na=Na+(f<<2)|0;ma=c[na>>2]|0;la=ma<<16>>16;c[na>>2]=(_(t,la)|0)+((_(u,la)|0)>>16)+(_(s,(ma>>15)+1>>1)|0);f=f+1|0}}while(0);f=c[Fa>>2]|0;na=f<<16>>16;c[Fa>>2]=(_(t,na)|0)+((_(u,na)|0)>>16)+(_(s,(f>>15)+1>>1)|0);f=c[Da>>2]|0;na=f<<16>>16;c[Da>>2]=(_(t,na)|0)+((_(u,na)|0)>>16)+(_(s,(f>>15)+1>>1)|0);f=0;while(1){if((f|0)==40){f=0;break}na=e+3840+(f<<2)|0;ma=c[na>>2]|0;la=ma<<16>>16;c[na>>2]=(_(t,la)|0)+((_(u,la)|0)>>16)+(_(s,(ma>>15)+1>>1)|0);f=f+1|0}while(1){if((f|0)==24)break;na=e+4320+(f<<2)|0;ma=c[na>>2]|0;la=ma<<16>>16;c[na>>2]=(_(t,la)|0)+((_(u,la)|0)>>16)+(_(s,(ma>>15)+1>>1)|0);f=f+1|0}c[Ya>>2]=c[A>>2];d=c[Sa>>2]|0;x=c[A>>2]|0;f=a[Ja>>0]|0;v=c[Pa>>2]|0}U=c[o+(ra<<2)>>2]|0;W=c[Ba>>2]|0;ha=c[Xa>>2]|0;X=ha>>1;Y=oa+2|0;Z=oa+4|0;$=oa+6|0;ba=oa+8|0;ca=oa+10|0;da=oa+12|0;ea=oa+14|0;fa=oa+16|0;ga=oa+18|0;ha=(ha|0)==16;ia=oa+20|0;ja=oa+22|0;ka=oa+24|0;la=oa+26|0;ma=oa+28|0;na=oa+30|0;K=f<<24>>24==2;L=pa+2|0;M=pa+4|0;N=pa+6|0;O=pa+8|0;P=W>>1;R=W+-1|0;Q=e+4320+(R<<2)|0;R=qa+(R<<1)|0;S=c[n+(ra<<2)>>2]<<16>>16;T=U<<16>>16;U=U>>16;V=(r|0)>0;J=B<<16>>16;H=D>>16;I=x>>>6<<16>>16;F=(x>>21)+1>>1;f=d;G=0;d=Na+(d-r+2<<2)|0;E=Ca;u=e+1280+((c[Ra>>2]|0)-r+1<<2)|0;while(1){if((G|0)>=(v|0))break;c[Za>>2]=(_(c[Za>>2]|0,196314165)|0)+907633515;D=c[E>>2]|0;B=b[oa>>1]|0;B=X+((_(D>>16,B)|0)+((_(D&65535,B)|0)>>16))|0;D=c[E+-4>>2]|0;f=b[Y>>1]|0;f=B+((_(D>>16,f)|0)+((_(D&65535,f)|0)>>16))|0;D=c[E+-8>>2]|0;B=b[Z>>1]|0;B=f+((_(D>>16,B)|0)+((_(D&65535,B)|0)>>16))|0;D=c[E+-12>>2]|0;f=b[$>>1]|0;f=B+((_(D>>16,f)|0)+((_(D&65535,f)|0)>>16))|0;D=c[E+-16>>2]|0;B=b[ba>>1]|0;B=f+((_(D>>16,B)|0)+((_(D&65535,B)|0)>>16))|0;D=c[E+-20>>2]|0;f=b[ca>>1]|0;f=B+((_(D>>16,f)|0)+((_(D&65535,f)|0)>>16))|0;D=c[E+-24>>2]|0;B=b[da>>1]|0;B=f+((_(D>>16,B)|0)+((_(D&65535,B)|0)>>16))|0;D=c[E+-28>>2]|0;f=b[ea>>1]|0;f=B+((_(D>>16,f)|0)+((_(D&65535,f)|0)>>16))|0;D=c[E+-32>>2]|0;B=b[fa>>1]|0;B=f+((_(D>>16,B)|0)+((_(D&65535,B)|0)>>16))|0;D=c[E+-36>>2]|0;f=b[ga>>1]|0;f=B+((_(D>>16,f)|0)+((_(D&65535,f)|0)>>16))|0;if(ha){D=c[E+-40>>2]|0;B=b[ia>>1]|0;B=f+((_(D>>16,B)|0)+((_(D&65535,B)|0)>>16))|0;D=c[E+-44>>2]|0;f=b[ja>>1]|0;f=B+((_(D>>16,f)|0)+((_(D&65535,f)|0)>>16))|0;D=c[E+-48>>2]|0;B=b[ka>>1]|0;B=f+((_(D>>16,B)|0)+((_(D&65535,B)|0)>>16))|0;D=c[E+-52>>2]|0;f=b[la>>1]|0;f=B+((_(D>>16,f)|0)+((_(D&65535,f)|0)>>16))|0;D=c[E+-56>>2]|0;B=b[ma>>1]|0;B=f+((_(D>>16,B)|0)+((_(D&65535,B)|0)>>16))|0;D=c[E+-60>>2]|0;f=b[na>>1]|0;f=B+((_(D>>16,f)|0)+((_(D&65535,f)|0)>>16))|0}if(K){D=c[d>>2]|0;B=b[pa>>1]|0;B=(_(D>>16,B)|0)+((_(D&65535,B)|0)>>16)+2|0;D=c[d+-4>>2]|0;A=b[L>>1]|0;A=B+((_(D>>16,A)|0)+((_(D&65535,A)|0)>>16))|0;D=c[d+-8>>2]|0;B=b[M>>1]|0;B=A+((_(D>>16,B)|0)+((_(D&65535,B)|0)>>16))|0;D=c[d+-12>>2]|0;A=b[N>>1]|0;A=B+((_(D>>16,A)|0)+((_(D&65535,A)|0)>>16))|0;D=c[d+-16>>2]|0;B=b[O>>1]|0;B=A+((_(D>>16,B)|0)+((_(D&65535,B)|0)>>16))|0;D=d+4|0}else{B=0;D=d}A=c[Da>>2]|0;t=c[Ea>>2]|0;c[Ea>>2]=A;s=b[qa>>1]|0;d=2;s=P+((_(A>>16,s)|0)+((_(A&65535,s)|0)>>16))|0;while(1){if((d|0)>=(W|0))break;x=d+-1|0;z=e+4320+(x<<2)|0;y=c[z>>2]|0;c[z>>2]=t;x=b[qa+(x<<1)>>1]|0;z=e+4320+(d<<2)|0;A=c[z>>2]|0;c[z>>2]=y;x=x<<16>>16;z=b[qa+(d<<1)>>1]|0;d=d+2|0;s=s+((_(t>>16,x)|0)+((_(t&65535,x)|0)>>16))+((_(y>>16,z)|0)+((_(y&65535,z)|0)>>16))|0;t=A}c[Q>>2]=t;y=b[R>>1]|0;y=s+((_(t>>16,y)|0)+((_(t&65535,y)|0)>>16))<<1;z=c[Fa>>2]|0;d=z>>16;z=z&65535;y=y+((_(d,S)|0)+((_(z,S)|0)>>16))|0;A=c[e+1280+((c[Ra>>2]|0)+-1<<2)>>2]|0;z=(_(A>>16,T)|0)+((_(A&65535,T)|0)>>16)+(_(d,U)|0)+((_(z,U)|0)>>16)|0;d=(f<<2)-y-z|0;if(V){w=(c[u>>2]|0)+(c[u+-8>>2]|0)|0;w=(_(w>>16,J)|0)+((_(w&65535,J)|0)>>16)|0;x=c[u+-4>>2]|0;A=u+4|0;d=B-(w+(_(x>>16,H)|0)+((_(x&65535,H)|0)>>16)<<1)+(d<<1)>>2}else{A=u;d=d>>1}x=Qa+(G<<2)|0;w=(c[x>>2]|0)-(d+1>>1)|0;w=(c[Za>>2]|0)<0?0-w|0:w;w=(w|0)>30720?30720:(w|0)<-31744?-31744:w;d=w-Ka|0;do if(Ga){if((d|0)>(Ha|0)){d=d-Ha|0;$a=70;break}if((d|0)>=(Ia|0))if((d|0)<0){$a=73;break}else{d=Ka;s=va;t=wa;u=xa;break}else{d=d+Ha|0;$a=70;break}}else $a=70;while(0);c:do if(($a|0)==70){$a=0;d=d>>10;if((d|0)>0){t=(d<<10)+-80+Ka|0;u=t+1024|0;d=t;s=u;t=_(t<<16>>16,ua)|0;u=_(u<<16>>16,ua)|0;break}switch(d|0){case 0:{d=Ka;s=va;t=wa;u=xa;break c}case -1:{$a=73;break c}default:{}}u=(d<<10|80)+Ka|0;d=u;s=u+1024|0;t=_(0-u<<16>>16,ua)|0;u=_(-1024-u<<16>>16,ua)|0}while(0);if(($a|0)==73){$a=0;d=ya;s=Ka;t=za;u=wa}bb=w-d<<16>>16;w=w-s<<16>>16;u=(u+(_(w,w)|0)|0)<(t+(_(bb,bb)|0)|0);u=u?s:d;d=h+G|0;a[d>>0]=((u>>>9)+1|0)>>>1;u=u<<4;B=((c[Za>>2]|0)<0?0-u|0:u)+(B<<1)|0;f=B+(f<<4)|0;u=((_(f>>16,I)|0)+((_(f&65534,I)|0)>>16)+(_(f,F)|0)>>7)+1>>1;b[sa+(G<<1)>>1]=(u|0)>32767?32767:((u|0)<-32768?-32768:u)&65535;u=E+4|0;c[u>>2]=f;f=f-(c[x>>2]<<4)|0;c[Da>>2]=f;f=f-(y<<2)|0;c[Fa>>2]=f;c[e+1280+(c[Ra>>2]<<2)>>2]=f-(z<<2);f=c[Sa>>2]|0;c[Na+(f<<2)>>2]=B<<1;c[Ra>>2]=(c[Ra>>2]|0)+1;f=f+1|0;c[Sa>>2]=f;c[Za>>2]=(c[Za>>2]|0)+(a[d>>0]|0);G=G+1|0;d=D;E=u;u=A}rf(Aa|0,e+3840+(v<<2)|0,160)|0;bb=c[Pa>>2]|0;g=g+(bb<<1)|0;h=h+bb|0;d=f;ra=ra+1|0;sa=sa+(bb<<1)|0}c[_a>>2]=c[q+(f+-1<<2)>>2];sf(e|0,e+(c[Ma>>2]<<1)|0,c[La>>2]<<1|0)|0;sf(e+1280|0,e+1280+(c[Ma>>2]<<2)|0,c[La>>2]<<2|0)|0;i=ab;return}function ke(e,f,g,h,j,k,l,m,n,o,p,q,r,s,t){e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;k=k|0;l=l|0;m=m|0;n=n|0;o=o|0;p=p|0;q=q|0;r=r|0;s=s|0;t=t|0;var u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,$=0,ba=0,ca=0,da=0,ea=0,fa=0,ga=0,ha=0,ia=0,ja=0,ka=0,la=0,ma=0,na=0,oa=0,pa=0,qa=0,ra=0,sa=0,ta=0,ua=0;sa=i;i=i+176|0;ka=sa+160|0;ga=sa;la=f+4424|0;A=c[la>>2]|0;ea=e+4720|0;u=c[ea>>2]|0;oa=i;i=i+((1*(u*1396|0)|0)+15&-16)|0;nf(oa|0,0,u*1396|0)|0;ja=g+34|0;pa=f+4416|0;qa=f+4420|0;ra=e+4684|0;ma=f+3840|0;na=f+4320|0;v=0;while(1){if((v|0)>=(u|0))break;w=v+(d[ja>>0]|0)&3;c[oa+(v*1396|0)+1384>>2]=w;c[oa+(v*1396|0)+1388>>2]=w;c[oa+(v*1396|0)+1392>>2]=0;c[oa+(v*1396|0)+1376>>2]=c[pa>>2];c[oa+(v*1396|0)+1380>>2]=c[qa>>2];c[oa+(v*1396|0)+1120>>2]=c[f+1280+((c[ra>>2]|0)+-1<<2)>>2];rf(oa+(v*1396|0)|0,ma|0,160)|0;w=oa+(v*1396|0)+1280|0;y=na;z=w+96|0;do{c[w>>2]=c[y>>2];w=w+4|0;y=y+4|0}while((w|0)<(z|0));v=v+1|0}w=b[g+30>>1]|0;Z=g+29|0;fa=a[Z>>0]|0;$=b[25404+(fa<<24>>24>>1<<2)+((w&65535)<<24>>24<<1)>>1]|0;c[ka>>2]=0;ia=e+4680|0;x=c[ia>>2]|0;u=(x|0)>40?40:x;a:do if(fa<<24>>24!=2)if((A|0)>0){ca=A+-3|0;ca=(u|0)<(ca|0)?u:ca}else ca=u;else{g=c[e+4672>>2]|0;v=0;while(1){if((v|0)>=(g|0)){ca=u;break a}fa=(c[r+(v<<2)>>2]|0)+-3|0;u=(u|0)<(fa|0)?u:fa;v=v+1|0}}while(0);P=(w&-256)<<16>>16!=1024&1;Y=c[ra>>2]|0;fa=e+4676|0;W=Y+(c[fa>>2]|0)|0;U=i;i=i+((1*(W<<2)|0)+15&-16)|0;V=i;i=i+((1*(W<<1)|0)+15&-16)|0;W=i;i=i+((1*(x<<2)|0)+15&-16)|0;ba=f+4432|0;c[ba>>2]=Y;M=f+4428|0;c[M>>2]=c[ra>>2];da=e+4672|0;N=P^1;O=f+4444|0;P=P<<1^3;X=oa+1392|0;Q=q+4|0;R=e+4732|0;S=f+4440|0;T=e+4728|0;L=e+4764|0;K=t<<16>>16;J=0;g=A;Y=f+(Y<<1)|0;v=0;while(1){if((J|0)>=(c[da>>2]|0))break;F=k+((J>>1|N)<<4<<1)|0;G=l+(J*5<<1)|0;H=m+(J*24<<1)|0;I=c[n+(J<<2)>>2]|0;I=I>>2|I>>>1<<16;c[O>>2]=0;u=a[Z>>0]|0;y=r+(J<<2)|0;if(u<<24>>24==2){x=c[y>>2]|0;if(!(J&P)){b:do if((J|0)==2){g=c[ea>>2]|0;u=c[X>>2]|0;w=0;v=1;while(1){if((v|0)>=(g|0)){u=0;break}D=c[oa+(v*1396|0)+1392>>2]|0;E=(D|0)<(u|0);u=E?D:u;w=E?v:w;v=v+1|0}while(1){if((u|0)>=(g|0))break;if((u|0)!=(w|0)){E=oa+(u*1396|0)+1392|0;c[E>>2]=(c[E>>2]|0)+134217727}u=u+1|0}u=0;v=(c[ka>>2]|0)+ca|0;while(1){if((u|0)>=(ca|0)){v=0;break b}E=(v+-1|0)%40|0;E=(E|0)<0?E+40|0:E;D=u-ca|0;a[j+D>>0]=(((c[oa+(w*1396|0)+640+(E<<2)>>2]|0)>>>9)+1|0)>>>1;A=c[oa+(w*1396|0)+800+(E<<2)>>2]|0;B=c[Q>>2]|0;t=B<<16>>16;B=((_(A>>16,t)|0)+((_(A&65535,t)|0)>>16)+(_(A,(B>>15)+1>>1)|0)>>13)+1>>1;b[Y+(D<<1)>>1]=(B|0)>32767?32767:((B|0)<-32768?-32768:B)&65535;c[f+1280+((c[ba>>2]|0)-ca+u<<2)>>2]=c[oa+(w*1396|0)+1120+(E<<2)>>2];u=u+1|0;v=E}}while(0);E=c[ra>>2]|0;t=c[R>>2]|0;u=E-x-t+-2|0;se(V+(u<<1)|0,f+(u+(_(J,c[ia>>2]|0)|0)<<1)|0,F,E-u|0,t);c[M>>2]=c[ra>>2];c[O>>2]=1;t=1;u=a[Z>>0]|0;E=x;D=v}else{t=0;u=2;E=x;D=v}}else{t=0;E=g;D=v}v=c[ea>>2]|0;A=c[y>>2]|0;B=q+(J<<2)|0;w=c[B>>2]|0;x=(w|0)>1;g=aa((x?w:1)|0)|0;x=(x?w:1)<>16;z=536870911/(ta|0)|0;y=z<<16;e=y>>16;x=536870912-((_(ta,e)|0)+((_(x&65535,e)|0)>>16))<<3;z=y+((_(x>>16,e)|0)+((_(x&65528,e)|0)>>16))+(_(x,(z>>15)+1>>1)|0)|0;g=62-g|0;x=g+-47|0;if((x|0)<1){y=47-g|0;g=-2147483648>>y;x=2147483647>>>y;if((g|0)>(x|0)){if((z|0)<=(g|0))g=(z|0)<(x|0)?x:z}else if((z|0)>(x|0))g=x;else g=(z|0)<(g|0)?g:z;x=g<>x:0;z=(x>>4)+1|0;y=z>>>1<<16>>16;z=(z>>16)+1>>1;g=c[ia>>2]|0;e=0;while(1){if((e|0)>=(g|0))break;ua=b[h+(e<<1)>>1]|0;ta=ua<<16>>16;c[W+(e<<2)>>2]=(_(ta>>16,y)|0)+((_(ua&65535,y)|0)>>16)+(_(ta,z)|0);e=e+1|0}c:do if(t|0){if(!J)x=(_(x>>16,K)|0)+((_(x&65535,K)|0)>>16)<<2;z=c[M>>2]|0;e=x>>16;x=x&65535;y=z-A+-2|0;while(1){if((y|0)>=(z|0))break c;ua=b[V+(y<<1)>>1]|0;c[U+(y<<2)>>2]=(_(e,ua)|0)+((_(x,ua)|0)>>16);y=y+1|0}}while(0);x=c[S>>2]|0;if((w|0)!=(x|0)){if((x|0)<=0)if(!x)y=32;else{g=0-x|0;ha=46}else{g=x;ha=46}if((ha|0)==46){ha=0;y=aa(g|0)|0}x=x<>16|0)|0)<<16>>16;ua=(_(x>>16,z)|0)+((_(x&65535,z)|0)>>16)|0;w=zf(w|0,((w|0)<0)<<31>>31|0,ua|0,((ua|0)<0)<<31>>31|0)|0;w=qf(w|0,C|0,29)|0;w=x-(w&-8)|0;z=ua+((_(w>>16,z)|0)+((_(w&65535,z)|0)>>16))|0;g=y+28-g|0;w=g+-16|0;if((g|0)<16){x=16-g|0;g=-2147483648>>x;w=2147483647>>>x;if((g|0)>(w|0)){if((z|0)<=(g|0))g=(z|0)<(w|0)?w:z}else if((z|0)>(w|0))g=w;else g=(z|0)<(g|0)?g:z;x=g<>w:0;w=c[ba>>2]|0;y=x>>16;z=x&65535;g=w;w=w-(c[ra>>2]|0)|0;while(1){if((w|0)>=(g|0))break;g=f+1280+(w<<2)|0;ua=c[g>>2]|0;ta=ua<<16>>16;c[g>>2]=(_(y,ta)|0)+((_(z,ta)|0)>>16)+(_(x,(ua>>15)+1>>1)|0);g=c[ba>>2]|0;w=w+1|0}d:do if(u<<24>>24==2?(c[O>>2]|0)==0:0){u=c[M>>2]|0;g=u-ca|0;u=u-A+-2|0;while(1){if((u|0)>=(g|0)){g=0;break d}ua=U+(u<<2)|0;ta=c[ua>>2]|0;A=ta<<16>>16;c[ua>>2]=(_(y,A)|0)+((_(z,A)|0)>>16)+(_(x,(ta>>15)+1>>1)|0);u=u+1|0}}else g=0;while(0);while(1){if((g|0)>=(v|0))break;u=oa+(g*1396|0)+1376|0;ua=c[u>>2]|0;ta=ua<<16>>16;c[u>>2]=(_(y,ta)|0)+((_(z,ta)|0)>>16)+(_(x,(ua>>15)+1>>1)|0);u=oa+(g*1396|0)+1380|0;ua=c[u>>2]|0;ta=ua<<16>>16;c[u>>2]=(_(y,ta)|0)+((_(z,ta)|0)>>16)+(_(x,(ua>>15)+1>>1)|0);u=0;while(1){if((u|0)==40){u=0;break}ua=oa+(g*1396|0)+(u<<2)|0;ta=c[ua>>2]|0;A=ta<<16>>16;c[ua>>2]=(_(y,A)|0)+((_(z,A)|0)>>16)+(_(x,(ta>>15)+1>>1)|0);u=u+1|0}while(1){if((u|0)==24){u=0;break}ua=oa+(g*1396|0)+1280+(u<<2)|0;ta=c[ua>>2]|0;A=ta<<16>>16;c[ua>>2]=(_(y,A)|0)+((_(z,A)|0)>>16)+(_(x,(ta>>15)+1>>1)|0);u=u+1|0}while(1){if((u|0)==40)break;ua=oa+(g*1396|0)+960+(u<<2)|0;ta=c[ua>>2]|0;A=ta<<16>>16;c[ua>>2]=(_(y,A)|0)+((_(z,A)|0)>>16)+(_(x,(ta>>15)+1>>1)|0);ua=oa+(g*1396|0)+1120+(u<<2)|0;ta=c[ua>>2]|0;A=ta<<16>>16;c[ua>>2]=(_(y,A)|0)+((_(z,A)|0)>>16)+(_(x,(ta>>15)+1>>1)|0);u=u+1|0}g=g+1|0}c[S>>2]=c[B>>2];u=a[Z>>0]|0;w=c[B>>2]|0;g=c[ia>>2]|0;v=c[ea>>2]|0}le(f,oa,u<<24>>24,W,j,Y,U,ga,F,G,H,E,I,c[o+(J<<2)>>2]|0,c[p+(J<<2)>>2]|0,w,s,$,g,D,c[T>>2]|0,c[R>>2]|0,c[L>>2]|0,v,ka,ca);v=c[ia>>2]|0;h=h+(v<<1)|0;j=j+v|0;J=J+1|0;g=E;Y=Y+(v<<1)|0;v=D+1|0}g=c[ea>>2]|0;u=c[X>>2]|0;x=0;v=1;while(1){if((v|0)>=(g|0))break;ta=c[oa+(v*1396|0)+1392>>2]|0;ua=(ta|0)<(u|0);u=ua?ta:u;x=ua?v:x;v=v+1|0}a[ja>>0]=c[oa+(x*1396|0)+1388>>2];g=c[q+((c[da>>2]|0)+-1<<2)>>2]|0;v=g>>>6<<16>>16;g=(g>>21)+1>>1;w=0;u=(c[ka>>2]|0)+ca|0;while(1){if((w|0)>=(ca|0))break;ua=(u+-1|0)%40|0;ua=(ua|0)<0?ua+40|0:ua;ta=w-ca|0;a[j+ta>>0]=(((c[oa+(x*1396|0)+640+(ua<<2)>>2]|0)>>>9)+1|0)>>>1;ka=c[oa+(x*1396|0)+800+(ua<<2)>>2]|0;ka=((_(ka>>16,v)|0)+((_(ka&65535,v)|0)>>16)+(_(ka,g)|0)>>7)+1>>1;b[Y+(ta<<1)>>1]=(ka|0)>32767?32767:((ka|0)<-32768?-32768:ka)&65535;c[f+1280+((c[ba>>2]|0)-ca+w<<2)>>2]=c[oa+(x*1396|0)+1120+(ua<<2)>>2];w=w+1|0;u=ua}rf(ma|0,oa+(x*1396|0)+(c[ia>>2]<<2)|0,160)|0;w=na;y=oa+(x*1396|0)+1280|0;z=w+96|0;do{c[w>>2]=c[y>>2];w=w+4|0;y=y+4|0}while((w|0)<(z|0));c[pa>>2]=c[oa+(x*1396|0)+1376>>2];c[qa>>2]=c[oa+(x*1396|0)+1380>>2];c[la>>2]=c[r+((c[da>>2]|0)+-1<<2)>>2];sf(f|0,f+(c[fa>>2]<<1)|0,c[ra>>2]<<1|0)|0;sf(f+1280|0,f+1280+(c[fa>>2]<<2)|0,c[ra>>2]<<2|0)|0;i=sa;return}function le(d,e,f,g,h,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D){d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;k=k|0;l=l|0;m=m|0;n=n|0;o=o|0;p=p|0;q=q|0;r=r|0;s=s|0;t=t|0;u=u|0;v=v|0;w=w|0;x=x|0;y=y|0;z=z|0;A=A|0;B=B|0;C=C|0;D=D|0;var E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,$=0,aa=0,ba=0,ca=0,da=0,ea=0,fa=0,ga=0,ha=0,ia=0,ja=0,ka=0,la=0,ma=0,na=0,oa=0,pa=0,qa=0,ra=0,sa=0,ta=0,ua=0,va=0,wa=0,xa=0,ya=0,za=0,Aa=0,Ba=0,Ca=0,Da=0,Ea=0,Fa=0,Ga=0,Ha=0,Ia=0,Ja=0,Ka=0,La=0;Ia=i;Ea=i;i=i+((1*(B*56|0)|0)+15&-16)|0;Fa=d+4432|0;Ga=d+4428|0;Da=t>>6;wa=(f|0)==2;xa=n+2|0;ya=n+4|0;za=n+6|0;Aa=n+8|0;Ba=(p|0)>0;Ca=q<<16>>16;la=q>>16;ma=z>>1;na=m+2|0;oa=m+4|0;pa=m+6|0;qa=m+8|0;ra=m+10|0;sa=m+12|0;ta=m+14|0;ua=m+16|0;va=m+18|0;ea=(z|0)==16;fa=m+20|0;ga=m+22|0;ha=m+24|0;ia=m+26|0;ja=m+28|0;ka=m+30|0;aa=A<<16>>16;ba=y>>1;ca=y+-1|0;da=o+(ca<<1)|0;Z=r<<16>>16;$=s<<16>>16;V=s>>16;W=(u|0)>2048;Y=(u|0)/2|0;X=Y+-512|0;Y=512-Y|0;N=u<<16>>16;O=v+944|0;P=_(v<<16>>16,N)|0;Q=_(O<<16>>16,N)|0;R=v+-944|0;S=_(944-v<<16>>16,N)|0;T=Ea+4|0;U=Ea+32|0;L=(x|0)<1;M=0;t=k+((c[Ga>>2]|0)-p+2<<2)|0;f=d+1280+((c[Fa>>2]|0)-p+1<<2)|0;while(1){if((M|0)>=(w|0)){t=0;break}if(wa){J=c[t>>2]|0;I=b[n>>1]|0;I=(_(J>>16,I)|0)+((_(J&65535,I)|0)>>16)+2|0;J=c[t+-4>>2]|0;K=b[xa>>1]|0;K=I+((_(J>>16,K)|0)+((_(J&65535,K)|0)>>16))|0;J=c[t+-8>>2]|0;I=b[ya>>1]|0;I=K+((_(J>>16,I)|0)+((_(J&65535,I)|0)>>16))|0;J=c[t+-12>>2]|0;K=b[za>>1]|0;K=I+((_(J>>16,K)|0)+((_(J&65535,K)|0)>>16))|0;J=c[t+-16>>2]|0;I=b[Aa>>1]|0;I=K+((_(J>>16,I)|0)+((_(J&65535,I)|0)>>16))<<1;J=t+4|0}else{I=0;J=t}if(Ba){K=(c[f>>2]|0)+(c[f+-8>>2]|0)|0;K=(_(K>>16,Ca)|0)+((_(K&65535,Ca)|0)>>16)|0;H=c[f+-4>>2]|0;H=I-(K+(_(H>>16,la)|0)+((_(H&65535,la)|0)>>16)<<2)|0;K=f+4|0}else{H=0;K=f}E=M+39|0;F=g+(M<<2)|0;G=0;while(1){if((G|0)>=(B|0))break;A=e+(G*1396|0)+1384|0;c[A>>2]=(_(c[A>>2]|0,196314165)|0)+907633515;t=e+(G*1396|0)+(E<<2)|0;p=c[t>>2]|0;x=b[m>>1]|0;x=ma+((_(p>>16,x)|0)+((_(p&65535,x)|0)>>16))|0;p=c[t+-4>>2]|0;f=b[na>>1]|0;f=x+((_(p>>16,f)|0)+((_(p&65535,f)|0)>>16))|0;p=c[t+-8>>2]|0;x=b[oa>>1]|0;x=f+((_(p>>16,x)|0)+((_(p&65535,x)|0)>>16))|0;p=c[t+-12>>2]|0;f=b[pa>>1]|0;f=x+((_(p>>16,f)|0)+((_(p&65535,f)|0)>>16))|0;p=c[t+-16>>2]|0;x=b[qa>>1]|0;x=f+((_(p>>16,x)|0)+((_(p&65535,x)|0)>>16))|0;p=c[t+-20>>2]|0;f=b[ra>>1]|0;f=x+((_(p>>16,f)|0)+((_(p&65535,f)|0)>>16))|0;p=c[t+-24>>2]|0;x=b[sa>>1]|0;x=f+((_(p>>16,x)|0)+((_(p&65535,x)|0)>>16))|0;p=c[t+-28>>2]|0;f=b[ta>>1]|0;f=x+((_(p>>16,f)|0)+((_(p&65535,f)|0)>>16))|0;p=c[t+-32>>2]|0;x=b[ua>>1]|0;x=f+((_(p>>16,x)|0)+((_(p&65535,x)|0)>>16))|0;p=c[t+-36>>2]|0;f=b[va>>1]|0;f=x+((_(p>>16,f)|0)+((_(p&65535,f)|0)>>16))|0;if(ea){p=c[t+-40>>2]|0;x=b[fa>>1]|0;x=f+((_(p>>16,x)|0)+((_(p&65535,x)|0)>>16))|0;p=c[t+-44>>2]|0;f=b[ga>>1]|0;f=x+((_(p>>16,f)|0)+((_(p&65535,f)|0)>>16))|0;p=c[t+-48>>2]|0;x=b[ha>>1]|0;x=f+((_(p>>16,x)|0)+((_(p&65535,x)|0)>>16))|0;p=c[t+-52>>2]|0;f=b[ia>>1]|0;f=x+((_(p>>16,f)|0)+((_(p&65535,f)|0)>>16))|0;p=c[t+-56>>2]|0;x=b[ja>>1]|0;x=f+((_(p>>16,x)|0)+((_(p&65535,x)|0)>>16))|0;p=c[t+-60>>2]|0;f=b[ka>>1]|0;f=x+((_(p>>16,f)|0)+((_(p&65535,f)|0)>>16))|0}q=e+(G*1396|0)+1280|0;t=c[q>>2]|0;p=(c[e+(G*1396|0)+1380>>2]|0)+((_(t>>16,aa)|0)+((_(t&65535,aa)|0)>>16))|0;z=(c[e+(G*1396|0)+1284>>2]|0)-p|0;z=t+((_(z>>16,aa)|0)+((_(z&65535,aa)|0)>>16))|0;c[q>>2]=p;q=b[o>>1]|0;t=2;q=ba+((_(p>>16,q)|0)+((_(p&65535,q)|0)>>16))|0;while(1){if((t|0)>=(y|0))break;r=t+-1|0;p=e+(G*1396|0)+1280+(r<<2)|0;u=e+(G*1396|0)+1280+(t<<2)|0;x=c[u>>2]|0;s=x-z|0;s=(c[p>>2]|0)+((_(s>>16,aa)|0)+((_(s&65535,aa)|0)>>16))|0;c[p>>2]=z;r=b[o+(r<<1)>>1]|0;p=c[e+(G*1396|0)+1280+((t|1)<<2)>>2]|0;c[u>>2]=s;r=r<<16>>16;u=b[o+(t<<1)>>1]|0;p=p-s|0;t=t+2|0;q=q+((_(z>>16,r)|0)+((_(z&65535,r)|0)>>16))+((_(s>>16,u)|0)+((_(s&65535,u)|0)>>16))|0;z=x+((_(p>>16,aa)|0)+((_(p&65535,aa)|0)>>16))|0}p=f<<4;c[e+(G*1396|0)+1280+(ca<<2)>>2]=z;s=b[da>>1]|0;s=q+((_(z>>16,s)|0)+((_(z&65535,s)|0)>>16))<<1;u=c[e+(G*1396|0)+1376>>2]|0;x=u>>16;u=u&65535;s=s+((_(x,Z)|0)+((_(u,Z)|0)>>16))<<2;r=c[e+(G*1396|0)+1120+(c[C>>2]<<2)>>2]|0;u=(_(r>>16,$)|0)+((_(r&65535,$)|0)>>16)+(_(x,V)|0)+((_(u,V)|0)>>16)<<2;x=c[F>>2]|0;r=x-((H+p-(s+u)>>3)+1>>1)|0;A=(c[A>>2]|0)<0;r=A?0-r|0:r;r=(r|0)>30720?30720:(r|0)<-31744?-31744:r;t=r-v|0;do if(W){if((t|0)>(X|0)){t=t-X|0;Ha=20;break}if((t|0)>=(Y|0))if((t|0)<0){Ha=23;break}else{t=v;f=O;q=P;z=Q;break}else{t=t+X|0;Ha=20;break}}else Ha=20;while(0);a:do if((Ha|0)==20){Ha=0;t=t>>10;if((t|0)>0){q=(t<<10)+-80+v|0;z=q+1024|0;t=q;f=z;q=_(q<<16>>16,N)|0;z=_(z<<16>>16,N)|0;break}switch(t|0){case 0:{t=v;f=O;q=P;z=Q;break a}case -1:{Ha=23;break a}default:{}}z=(t<<10|80)+v|0;t=z;f=z+1024|0;q=_(0-z<<16>>16,N)|0;z=_(-1024-z<<16>>16,N)|0}while(0);if((Ha|0)==23){Ha=0;t=R;f=v;q=S;z=P}Ja=r-t<<16>>16;Ja=q+(_(Ja,Ja)|0)>>10;r=r-f<<16>>16;r=z+(_(r,r)|0)>>10;Ka=(Ja|0)<(r|0);La=c[e+(G*1396|0)+1392>>2]|0;q=Ka?t:f;z=Ka?f:t;c[Ea+(G*56|0)+4>>2]=La+(Ka?Ja:r);c[Ea+(G*56|0)+32>>2]=La+(Ka?r:Ja);c[Ea+(G*56|0)>>2]=q;c[Ea+(G*56|0)+28>>2]=z;f=q<<4;f=(A?0-f|0:f)+I|0;q=f+p|0;r=x<<4;x=q-r|0;c[Ea+(G*56|0)+16>>2]=x;x=x-s|0;c[Ea+(G*56|0)+20>>2]=x-u;c[Ea+(G*56|0)+12>>2]=x;c[Ea+(G*56|0)+24>>2]=f;c[Ea+(G*56|0)+8>>2]=q;x=z<<4;x=(A?0-x|0:x)+I|0;p=x+p|0;r=p-r|0;c[Ea+(G*56|0)+44>>2]=r;s=r-s|0;c[Ea+(G*56|0)+48>>2]=s-u;c[Ea+(G*56|0)+40>>2]=s;c[Ea+(G*56|0)+52>>2]=x;c[Ea+(G*56|0)+36>>2]=p;G=G+1|0}t=((c[C>>2]|0)+-1|0)%40|0;s=(t|0)<0;f=t+40|0;c[C>>2]=s?f:t;t=(s?f:t)+D|0;f=c[T>>2]|0;s=0;q=1;while(1){if((q|0)>=(B|0))break;Ka=c[Ea+(q*56|0)+4>>2]|0;La=(Ka|0)<(f|0);f=La?Ka:f;s=La?q:s;q=q+1|0}r=(t|0)%40|0;t=c[e+(s*1396|0)+480+(r<<2)>>2]|0;f=0;while(1){if((f|0)>=(B|0))break;if((c[e+(f*1396|0)+480+(r<<2)>>2]|0)!=(t|0)){La=Ea+(f*56|0)+4|0;c[La>>2]=(c[La>>2]|0)+134217727;La=Ea+(f*56|0)+32|0;c[La>>2]=(c[La>>2]|0)+134217727}f=f+1|0}t=c[T>>2]|0;f=0;q=c[U>>2]|0;z=0;A=1;while(1){if((A|0)>=(B|0))break;I=c[Ea+(A*56|0)+4>>2]|0;Ja=(I|0)>(t|0);Ka=c[Ea+(A*56|0)+32>>2]|0;La=(Ka|0)<(q|0);t=Ja?I:t;f=Ja?A:f;q=La?Ka:q;z=La?A:z;A=A+1|0}if((q|0)<(t|0)){rf(e+(f*1396|0)+(M<<2)|0,e+(z*1396|0)+(M<<2)|0,1396-(M<<2)|0)|0;La=Ea+(f*56|0)|0;Ka=Ea+(z*56|0)+28|0;c[La>>2]=c[Ka>>2];c[La+4>>2]=c[Ka+4>>2];c[La+8>>2]=c[Ka+8>>2];c[La+12>>2]=c[Ka+12>>2];c[La+16>>2]=c[Ka+16>>2];c[La+20>>2]=c[Ka+20>>2];c[La+24>>2]=c[Ka+24>>2]}if(!(L&(M|0)<(D|0))){La=M-D|0;a[h+La>>0]=(((c[e+(s*1396|0)+640+(r<<2)>>2]|0)>>>9)+1|0)>>>1;Ja=c[e+(s*1396|0)+800+(r<<2)>>2]|0;Ka=c[l+(r<<2)>>2]|0;I=Ka<<16>>16;Ka=((_(Ja>>16,I)|0)+((_(Ja&65535,I)|0)>>16)+(_(Ja,(Ka>>15)+1>>1)|0)>>7)+1>>1;b[j+(La<<1)>>1]=(Ka|0)>32767?32767:((Ka|0)<-32768?-32768:Ka)&65535;c[d+1280+((c[Fa>>2]|0)-D<<2)>>2]=c[e+(s*1396|0)+1120+(r<<2)>>2];c[k+((c[Ga>>2]|0)-D<<2)>>2]=c[e+(s*1396|0)+960+(r<<2)>>2]}c[Fa>>2]=(c[Fa>>2]|0)+1;c[Ga>>2]=(c[Ga>>2]|0)+1;t=M+40|0;f=0;while(1){if((f|0)>=(B|0))break;c[e+(f*1396|0)+1376>>2]=c[Ea+(f*56|0)+12>>2];c[e+(f*1396|0)+1380>>2]=c[Ea+(f*56|0)+16>>2];La=c[Ea+(f*56|0)+8>>2]|0;c[e+(f*1396|0)+(t<<2)>>2]=La;c[e+(f*1396|0)+800+(c[C>>2]<<2)>>2]=La;La=c[Ea+(f*56|0)>>2]|0;c[e+(f*1396|0)+640+(c[C>>2]<<2)>>2]=La;c[e+(f*1396|0)+960+(c[C>>2]<<2)>>2]=c[Ea+(f*56|0)+24>>2]<<1;c[e+(f*1396|0)+1120+(c[C>>2]<<2)>>2]=c[Ea+(f*56|0)+20>>2];Ka=e+(f*1396|0)+1384|0;La=(c[Ka>>2]|0)+((La>>9)+1>>1)|0;c[Ka>>2]=La;c[e+(f*1396|0)+480+(c[C>>2]<<2)>>2]=La;c[e+(f*1396|0)+1392>>2]=c[Ea+(f*56|0)+4>>2];f=f+1|0}c[l+(c[C>>2]<<2)>>2]=Da;M=M+1|0;t=J;f=K}while(1){if((t|0)>=(B|0))break;rf(e+(t*1396|0)|0,e+(t*1396|0)+(w<<2)|0,160)|0;t=t+1|0}i=Ia;return}function me(d,f,g){d=d|0;f=f|0;g=g|0;var h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0;R=i;i=i+64|0;l=R+20|0;m=R+16|0;j=R+12|0;k=R+8|0;Q=R+24|0;h=R;I=d+2336|0;p=c[I>>2]|0;P=d+2328|0;J=i;i=i+((1*(p+(c[P>>2]|0)<<2)|0)+15&-16)|0;s=i;i=i+((1*(p<<1)|0)+15&-16)|0;c[h>>2]=c[d+4240>>2]>>6;p=d+4244|0;M=c[p>>2]|0;L=M>>6;c[h+4>>2]=L;if(c[d+2376>>2]|0){o=d+4182|0;n=o+32|0;do{b[o>>1]=0;o=o+2|0}while((o|0)<(n|0))}G=d+2332|0;H=d+2324|0;ne(j,l,k,m,d+4|0,h,c[G>>2]|0,c[H>>2]|0);h=c[d+4252>>2]|0;if((c[j>>2]>>c[m>>2]|0)<(c[k>>2]>>c[l>>2]|0)){h=_(h+-1|0,c[d+4256>>2]|0)|0;h=(h|0)<128?0:h+-128|0}else{h=_(h,c[d+4256>>2]|0)|0;h=(h|0)<128?0:h+-128|0}F=d+4+(h<<2)|0;B=d+4172|0;N=d+4224|0;n=b[N>>1]|0;l=d+4160|0;o=c[l>>2]|0;O=(o|0)>1;r=b[25776+((O?1:o)<<1)>>1]|0;m=d+4164|0;o=b[((c[m>>2]|0)==2?25780:25784)+((O?1:o)<<1)>>1]|0;O=d+2340|0;j=(c[O>>2]|0)+-1|0;h=64881;k=0;while(1){if((k|0)>=(j|0))break;K=d+4182+(k<<1)|0;b[K>>1]=(((_(h,b[K>>1]|0)|0)>>>15)+1|0)>>>1;h=h+(((_(h,-655)|0)>>15)+1>>1)|0;k=k+1|0}k=d+4182+(j<<1)|0;b[k>>1]=(((_(h,b[k>>1]|0)|0)>>>15)+1|0)>>>1;h=d+4182|0;k=c[O>>2]|0;rf(Q|0,h|0,k<<1|0)|0;do if(!(c[l>>2]|0)){if((c[m>>2]|0)==2){h=0;j=16384;while(1){if((h|0)==5)break;K=(j&65535)-(e[d+4172+(h<<1)>>1]|0)&65535;h=h+1|0;j=K}n=(_((j<<16>>16<3277?3277:j)<<16>>16,b[d+4236>>1]|0)|0)>>>14&65535;break}h=te(h,k)|0;if((h|0)<=134217728)if((h|0)<4194304)h=4194304;else q=16;else{h=134217728;q=16}n=h<<3;o=(_(n>>16,o)|0)+((_(n&65528,o)|0)>>16)>>14;n=16384}while(0);K=d+4220|0;y=c[K>>2]|0;A=d+4168|0;x=(c[A>>2]>>7)+1>>1;z=c[I>>2]|0;m=z-x-k+-2|0;se(s+(m<<1)|0,d+1348+(m<<1)|0,Q,z-m|0,k);j=c[p>>2]|0;if((j|0)<=0)if(!j)h=32;else{h=0-j|0;q=20}else{h=j;q=20}if((q|0)==20)h=aa(h|0)|0;j=j<>16;l=536870911/(C|0)|0;D=l<<16;E=D>>16;j=536870912-((_(C,E)|0)+((_(j&65535,E)|0)>>16))<<3;l=D+((_(j>>16,E)|0)+((_(j&65528,E)|0)>>16))+(_(j,(l>>15)+1>>1)|0)|0;h=62-h|0;j=h+-46|0;if((j|0)>=1)if((j|0)<32){h=l>>j;q=30}else h=0;else{k=46-h|0;h=-2147483648>>k;j=2147483647>>>k;if((h|0)>(j|0)){if((l|0)<=(h|0))h=(l|0)<(j|0)?j:l}else if((l|0)>(j|0))h=j;else h=(l|0)<(h|0)?h:l;h=h<>2]|0;l=h>>16;j=h&65535;h=m+(c[O>>2]|0)|0;while(1){if((h|0)>=(k|0))break;E=b[s+(h<<1)>>1]|0;c[J+(h<<2)>>2]=(_(l,E)|0)+((_(j,E)|0)>>16);h=h+1|0}t=d+4174|0;u=d+4176|0;v=d+4178|0;w=d+4180|0;q=r<<16>>16;r=d+2765|0;s=d+2316|0;o=o<<16>>16;p=0;E=x;D=n;C=y;j=z;while(1){if((p|0)>=(c[H>>2]|0))break;m=D<<16>>16;k=c[G>>2]|0;l=0;h=J+(j-E+2<<2)|0;n=C;while(1){if((l|0)>=(k|0)){h=0;break}E=c[h>>2]|0;z=b[B>>1]|0;z=(_(E>>16,z)|0)+((_(E&65535,z)|0)>>16)+2|0;E=c[h+-4>>2]|0;C=b[t>>1]|0;C=z+((_(E>>16,C)|0)+((_(E&65535,C)|0)>>16))|0;E=c[h+-8>>2]|0;z=b[u>>1]|0;z=C+((_(E>>16,z)|0)+((_(E&65535,z)|0)>>16))|0;E=c[h+-12>>2]|0;C=b[v>>1]|0;C=z+((_(E>>16,C)|0)+((_(E&65535,C)|0)>>16))|0;E=c[h+-16>>2]|0;z=b[w>>1]|0;z=C+((_(E>>16,z)|0)+((_(E&65535,z)|0)>>16))|0;E=(_(n,196314165)|0)+907633515|0;C=c[F+(E>>>25<<2)>>2]|0;c[J+(j<<2)>>2]=z+((_(C>>16,m)|0)+((_(C&65535,m)|0)>>16))<<2;l=l+1|0;h=h+4|0;n=E;j=j+1|0}while(1){if((h|0)==5)break;E=d+4172+(h<<1)|0;b[E>>1]=(_(q,b[E>>1]|0)|0)>>>15;h=h+1|0}if(!(a[r>>0]|0))h=D;else h=(_(m,o)|0)>>>15&65535;D=c[A>>2]|0;D=D+(((D>>16)*655|0)+(((D&65535)*655|0)>>>16))|0;c[A>>2]=D;E=(c[s>>2]<<16>>16)*4608|0;E=(D|0)<(E|0)?D:E;c[A>>2]=E;p=p+1|0;E=(E>>7)+1>>1;D=h;C=n}B=J+((c[I>>2]|0)+-16<<2)|0;A=d+1284|0;o=B;h=A;n=o+64|0;do{c[o>>2]=c[h>>2];o=o+4|0;h=h+4|0}while((o|0)<(n|0));q=b[Q>>1]|0;r=b[Q+2>>1]|0;s=b[Q+4>>1]|0;t=b[Q+6>>1]|0;u=b[Q+8>>1]|0;v=b[Q+10>>1]|0;w=b[Q+12>>1]|0;x=b[Q+14>>1]|0;y=b[Q+16>>1]|0;z=b[Q+18>>1]|0;p=L<<16>>16;n=(M>>21)+1>>1;o=0;while(1){h=c[P>>2]|0;if((o|0)>=(h|0))break;h=c[B+(o+15<<2)>>2]|0;h=(c[O>>2]>>1)+((_(h>>16,q)|0)+((_(h&65535,q)|0)>>16))|0;m=c[B+(o+14<<2)>>2]|0;m=h+((_(m>>16,r)|0)+((_(m&65535,r)|0)>>16))|0;h=c[B+(o+13<<2)>>2]|0;h=m+((_(h>>16,s)|0)+((_(h&65535,s)|0)>>16))|0;m=c[B+(o+12<<2)>>2]|0;m=h+((_(m>>16,t)|0)+((_(m&65535,t)|0)>>16))|0;h=c[B+(o+11<<2)>>2]|0;h=m+((_(h>>16,u)|0)+((_(h&65535,u)|0)>>16))|0;m=c[B+(o+10<<2)>>2]|0;m=h+((_(m>>16,v)|0)+((_(m&65535,v)|0)>>16))|0;h=c[B+(o+9<<2)>>2]|0;h=m+((_(h>>16,w)|0)+((_(h&65535,w)|0)>>16))|0;m=c[B+(o+8<<2)>>2]|0;m=h+((_(m>>16,x)|0)+((_(m&65535,x)|0)>>16))|0;h=c[B+(o+7<<2)>>2]|0;h=m+((_(h>>16,y)|0)+((_(h&65535,y)|0)>>16))|0;m=c[B+(o+6<<2)>>2]|0;m=h+((_(m>>16,z)|0)+((_(m&65535,z)|0)>>16))|0;h=c[O>>2]|0;j=o+16|0;k=10;while(1){if((k|0)>=(h|0))break;L=c[B+(j-k+-1<<2)>>2]|0;M=b[Q+(k<<1)>>1]|0;m=m+((_(L>>16,M)|0)+((_(L&65535,M)|0)>>16))|0;k=k+1|0}l=B+(j<<2)|0;h=c[l>>2]|0;j=(m|0)>134217727;k=j?2147483632:((m|0)<-134217728?-134217728:m)<<4;if((h+(j?2147483632:((m|0)<-134217728?-134217728:m)<<4)|0)>-1)if((h&k|0)<0)h=-2147483648;else h=h+(j?2147483632:((m|0)<-134217728?-134217728:m)<<4)|0;else if((h|k|0)>-1)h=2147483647;else h=h+(j?2147483632:((m|0)<-134217728?-134217728:m)<<4)|0;c[l>>2]=h;M=((_(h>>16,p)|0)+((_(h&65535,p)|0)>>16)+(_(h,n)|0)>>7)+1>>1;b[g+(o<<1)>>1]=(M|0)>32767?32767:((M|0)<-32768?-32768:M)&65535;o=o+1|0}o=A;h=B+(h<<2)|0;n=o+64|0;do{c[o>>2]=c[h>>2];o=o+4|0;h=h+4|0}while((o|0)<(n|0));c[K>>2]=C;b[N>>1]=D;h=0;while(1){if((h|0)==4)break;c[f+(h<<2)>>2]=E;h=h+1|0}i=R;return}function ne(a,d,e,f,g,h,j,k){a=a|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;j=j|0;k=k|0;var l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0;r=i;l=i;i=i+((1*(j<<1<<1)|0)+15&-16)|0;o=l;q=0;while(1){if((q|0)==2)break;m=_(q+k+-2|0,j)|0;n=h+(q<<2)|0;p=0;while(1){if((p|0)>=(j|0))break;t=c[g+(p+m<<2)>>2]|0;s=c[n>>2]|0;u=s<<16>>16;s=(_(t>>16,u)|0)+((_(t&65535,u)|0)>>16)+(_(t,(s>>15)+1>>1)|0)>>8;b[o+(p<<1)>>1]=(s|0)>32767?32767:((s|0)<-32768?-32768:s)&65535;p=p+1|0}o=o+(j<<1)|0;q=q+1|0}ze(a,d,l,j);ze(e,f,l+(j<<1)|0,j);i=r;return}function oe(a,d){a=a|0;d=d|0;var f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0;v=i;i=i+48|0;s=v+32|0;u=v+16|0;q=v;t=a+4676|0;l=c[t>>2]|0;n=l>>1;f=l>>2;h=l>>3;c[q>>2]=0;o=h+f|0;c[q+4>>2]=o;m=o+h|0;c[q+8>>2]=m;k=m+f|0;c[q+12>>2]=k;p=i;i=i+((1*(k+n<<1)|0)+15&-16)|0;qe(d,a+32|0,p,p+(k<<1)|0,l);qe(p,a+40|0,p,p+(m<<1)|0,n);qe(p,a+48|0,p,p+(o<<1)|0,f);f=p+(h+-1<<1)|0;d=b[f>>1]>>1;b[f>>1]=d;f=d;while(1){g=h+-1|0;if((h|0)<=1)break;n=p+(h+-2<<1)|0;o=b[n>>1]>>1;b[n>>1]=o;b[p+(g<<1)>>1]=(f&65535)-(o&65535);f=o;h=g}m=a+88|0;b[p>>1]=(e[p>>1]|0)-(e[m>>1]|0);b[m>>1]=d;m=0;f=0;while(1){if((m|0)==4)break;h=4-m|0;h=c[t>>2]>>((h|0)<3?h:3)>>2;j=a+56+(m<<2)|0;d=c[j>>2]|0;k=s+(m<<2)|0;c[k>>2]=d;l=q+(m<<2)|0;n=0;o=0;while(1){if((o|0)==4)break;else{g=0;f=0}while(1){if((g|0)>=(h|0))break;w=b[p+((c[l>>2]|0)+g+n<<1)>>1]>>3;g=g+1|0;f=f+(_(w,w)|0)|0}if((o|0)<3){d=d+f|0;d=(d|0)<0?2147483647:d}else{d=d+(f>>1)|0;d=(d|0)<0?2147483647:d}c[k>>2]=d;n=n+h|0;o=o+1|0}c[j>>2]=f;m=m+1|0}l=a+140|0;d=c[l>>2]|0;if((d|0)<1e3)k=32767/((d>>4)+1|0)|0;else k=0;j=0;while(1){if((j|0)==4)break;g=a+92+(j<<2)|0;f=c[g>>2]|0;d=(c[s+(j<<2)>>2]|0)+(c[a+124+(j<<2)>>2]|0)|0;d=(d|0)<0?2147483647:d;h=2147483647/(d|0)|0;if((d|0)<=(f<<3|0))if((d|0)<(f|0))d=1024;else{w=f<<16>>16;q=_(h>>16,w)|0;w=_(h&65535,w)|0;d=_(h,(f>>15)+1>>1)|0;d=q+(w>>16)+d>>16<<11|(q+(w>>>16)+d|0)>>>5&2047}else d=128;q=a+108+(j<<2)|0;o=c[q>>2]|0;p=h-o|0;w=((d|0)>(k|0)?d:k)<<16>>16;w=o+((_(p>>16,w)|0)+((_(p&65535,w)|0)>>16))|0;c[q>>2]=w;w=2147483647/(w|0)|0;c[g>>2]=(w|0)<16777215?w:16777215;j=j+1|0}c[l>>2]=(c[l>>2]|0)+1;o=0;p=0;j=0;while(1){if((o|0)==4)break;l=c[s+(o<<2)>>2]|0;m=c[a+92+(o<<2)>>2]|0;n=l-m|0;if((n|0)>0){if(l>>>0<8388608)d=(l<<8|0)/(m+1|0)|0;else d=(l|0)/((m>>8)+1|0)|0;c[u+(o<<2)>>2]=d;h=aa(d|0)|0;f=24-h|0;g=0-f|0;do if(f)if((f|0)<0){d=d<>>(f+32|0);break}else{d=d<<32-f|d>>>f;break}while(0);d=d&127;d=d+(((_(d,128-d|0)|0)*179|0)>>>16)+(31-h<<7)+-1024|0;k=d<<16>>16;j=j+(_(k,k)|0)|0;if((n|0)<1048576){g=aa(n|0)|0;g=(l|0)==(m|0)?32:g;d=24-g|0;f=0-d|0;do if(d)if((d|0)<0){d=n<>>(d+32|0);break}else{d=n<<32-d|n>>>d;break}else d=n;while(0);g=((g&1|0)==0?46214:32768)>>>(g>>>1);h=(_(d&127,13959168)|0)>>>16;h=_(g+((_(g>>16,h)|0)+((_(g&65535,h)|0)>>>16))<<6>>16,k)|0;g=aa(n|0)|0;g=(l|0)==(m|0)?32:g;d=24-g|0;f=0-d|0;do if(d)if((d|0)<0){d=n<>>(d+32|0);break}else{d=n<<32-d|n>>>d;break}else d=n;while(0);w=((g&1|0)==0?46214:32768)>>>(g>>>1);d=(_(d&127,13959168)|0)>>>16;d=h+((_(w+((_(w>>16,d)|0)+((_(w&65535,d)|0)>>>16))<<6&65472,k)|0)>>16)|0}w=c[22976+(o<<2)>>2]|0;f=d<<16>>16;f=p+((_(w>>16,f)|0)+((_(w&65535,f)|0)>>16))|0;d=j}else{c[u+(o<<2)>>2]=256;f=p;d=j}o=o+1|0;p=f;j=d}d=(j|0)/4|0;do if((j|0)>=4){h=aa(d|0)|0;h=(j+3|0)>>>0<7?32:h;f=24-h|0;g=0-f|0;do if(f)if((f|0)<0){d=d<>>(f+32|0);break}else{d=d<<32-f|d>>>f;break}while(0);f=((h&1|0)==0?46214:32768)>>>(h>>>1);d=(_(d&127,13959168)|0)>>>16;d=((f+((_(f>>16,d)|0)+((_(f&65535,d)|0)>>>16))|0)*196608>>16)*45e3>>16;f=d+-128|0;if((d|0)<128)if((f|0)<-191){d=0;break}else{d=128-d|0;r=53;break}if((f|0)>191)d=32767;else{d=f>>5;d=(c[23040+(d<<2)>>2]|0)+(_(c[23016+(d<<2)>>2]<<16>>16,f&31)|0)|0}}else{d=128;r=53}while(0);if((r|0)==53){w=d>>5;d=(c[22992+(w<<2)>>2]|0)-(_(c[23016+(w<<2)>>2]<<16>>16,d&31)|0)|0}if((p|0)<0){f=0-p|0;if((p|0)<-191)f=0;else{w=f>>5;f=(c[22992+(w<<2)>>2]|0)-(_(c[23016+(w<<2)>>2]<<16>>16,f&31)|0)|0}}else if((p|0)>191)f=32767;else{f=p>>5;f=(c[23040+(f<<2)>>2]|0)+(_(c[23016+(f<<2)>>2]<<16>>16,p&31)|0)|0}c[a+4804>>2]=(f<<1)+-32768;f=0;g=0;while(1){if((f|0)==4)break;r=f+1|0;w=g+(_(r,(c[s+(f<<2)>>2]|0)-(c[a+92+(f<<2)>>2]|0)>>4)|0)|0;f=r;g=w}if((g|0)>=1){if((g|0)<32768){f=g<<((c[t>>2]|0)==((c[a+4668>>2]|0)*10|0)?16:15);j=aa(f|0)|0;g=24-j|0;h=0-g|0;do if(g)if((g|0)<0){f=f<>>(g+32|0);break}else{f=f<<32-g|f>>>g;break}while(0);s=((j&1|0)==0?46214:32768)>>>(j>>>1);w=(_(f&127,13959168)|0)>>>16;w=s+((_(s>>16,w)|0)+((_(s&65535,w)|0)>>>16))+32768|0;d=d<<16>>16;d=(_(w>>16,d)|0)+((_(w&65535,d)|0)>>16)|0}}else d=d>>1;k=d>>7;c[a+4624>>2]=(k|0)<255?k:255;k=d<<16>>16;k=((_(d>>16,k)|0)<<16)+(_(d&65535,k)|0)|0;k=k>>((c[t>>2]|0)==((c[a+4668>>2]|0)*10|0)?21:20);j=0;while(1){if((j|0)==4)break;h=a+72+(j<<2)|0;f=c[h>>2]|0;d=(c[u+(j<<2)>>2]|0)-f|0;d=f+((_(d>>16,k)|0)+((_(d&65535,k)|0)>>16))|0;c[h>>2]=d;h=aa(d|0)|0;f=24-h|0;g=0-f|0;do if(f)if((f|0)<0){d=d<>>(f+32|0);break}else{d=d<<32-f|d>>>f;break}while(0);d=d&127;d=((d+(((_(d,128-d|0)|0)*179|0)>>>16)+(31-h<<7)|0)*3|0)+-5120|0;f=d>>4;if((f|0)<0){d=0-f|0;if((f|0)<-191)d=0;else{w=d>>5;d=(c[22992+(w<<2)>>2]|0)-(_(c[23016+(w<<2)>>2]<<16>>16,d&31)|0)|0}}else if((f|0)>191)d=32767;else{d=d>>9;d=(c[23040+(d<<2)>>2]|0)+(_(c[23016+(d<<2)>>2]<<16>>16,f&31)|0)|0}c[a+4788+(j<<2)>>2]=d;j=j+1|0}i=v;return}function pe(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0;e=c[a+(d<<2)>>2]|0;f=b<<4;if((d|0)==8){b=b<<20>>16;g=(f>>15)+1>>1;d=(c[a+28>>2]|0)+((_(e>>16,b)|0)+((_(e&65535,b)|0)>>16))+(_(e,g)|0)|0;d=(c[a+24>>2]|0)+((_(d>>16,b)|0)+((_(d&65535,b)|0)>>16))+(_(d,g)|0)|0;d=(c[a+20>>2]|0)+((_(d>>16,b)|0)+((_(d&65535,b)|0)>>16))+(_(d,g)|0)|0;d=(c[a+16>>2]|0)+((_(d>>16,b)|0)+((_(d&65535,b)|0)>>16))+(_(d,g)|0)|0;d=(c[a+12>>2]|0)+((_(d>>16,b)|0)+((_(d&65535,b)|0)>>16))+(_(d,g)|0)|0;d=(c[a+8>>2]|0)+((_(d>>16,b)|0)+((_(d&65535,b)|0)>>16))+(_(d,g)|0)|0;d=(c[a+4>>2]|0)+((_(d>>16,b)|0)+((_(d&65535,b)|0)>>16))+(_(d,g)|0)|0;a=(c[a>>2]|0)+((_(d>>16,b)|0)+((_(d&65535,b)|0)>>16))+(_(d,g)|0)|0;return a|0}g=b<<20>>16;f=(f>>15)+1>>1;while(1){b=d+-1|0;if((d|0)<=0)break;d=b;e=(c[a+(b<<2)>>2]|0)+((_(e>>16,g)|0)+((_(e&65535,g)|0)>>16))+(_(e,f)|0)|0}return e|0}function qe(a,d,e,f,g){a=a|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,l=0,m=0,n=0;g=g>>1;h=d+4|0;i=0;while(1){if((i|0)>=(g|0))break;m=i<<1;n=b[a+(m<<1)>>1]<<10;l=n-(c[d>>2]|0)|0;k=(_(l>>16,-24290)|0)+((_(l&65535,-24290)|0)>>16)|0;j=n+k|0;c[d>>2]=n+(l+k);m=b[a+((m|1)<<1)>>1]<<10;k=c[h>>2]|0;l=m-k|0;l=((l>>16)*10788|0)+(((l&65535)*10788|0)>>>16)|0;k=k+l|0;c[h>>2]=m+l;l=(k+j>>10)+1>>1;b[e+(i<<1)>>1]=(l|0)>32767?32767:((l|0)<-32768?-32768:l)&65535;j=(k-j>>10)+1>>1;b[f+(i<<1)>>1]=(j|0)>32767?32767:((j|0)<-32768?-32768:j)&65535;i=i+1|0}return}function re(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0;g=d+-65536|0;f=b+-1|0;e=0;while(1){b=d>>16;if((e|0)>=(f|0))break;h=a+(e<<2)|0;i=c[h>>2]|0;j=i<<16>>16;c[h>>2]=(_(b,j)|0)+((_(d&65535,j)|0)>>16)+(_(d,(i>>15)+1>>1)|0);d=d+(((_(d,g)|0)>>15)+1>>1)|0;e=e+1|0}j=a+(f<<2)|0;i=c[j>>2]|0;h=i<<16>>16;c[j>>2]=(_(b,h)|0)+((_(d&65535,h)|0)>>16)+(_(d,(i>>15)+1>>1)|0);return}function se(a,c,d,e,f){a=a|0;c=c|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;g=d+2|0;h=d+4|0;i=d+6|0;j=d+8|0;k=d+10|0;m=f;while(1){if((m|0)>=(e|0))break;l=c+(m+-1<<1)|0;o=_(b[l>>1]|0,b[d>>1]|0)|0;o=o+(_(b[l+-2>>1]|0,b[g>>1]|0)|0)|0;o=o+(_(b[l+-4>>1]|0,b[h>>1]|0)|0)|0;o=o+(_(b[l+-6>>1]|0,b[i>>1]|0)|0)|0;o=o+(_(b[l+-8>>1]|0,b[j>>1]|0)|0)|0;n=6;o=o+(_(b[l+-10>>1]|0,b[k>>1]|0)|0)|0;while(1){if((n|0)>=(f|0))break;p=o+(_(b[l+(0-n<<1)>>1]|0,b[d+(n<<1)>>1]|0)|0)|0;p=p+(_(b[l+(~n<<1)>>1]|0,b[d+((n|1)<<1)>>1]|0)|0)|0;n=n+2|0;o=p}p=((b[l+2>>1]<<12)-o>>11)+1>>1;b[a+(m<<1)>>1]=(p|0)>32767?32767:((p|0)<-32768?-32768:p)&65535;m=m+1|0}nf(a|0,0,f<<1|0)|0;return}function te(a,d){a=a|0;d=d|0;var e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0;w=i;i=i+96|0;u=w;e=0;f=0;while(1){if((f|0)>=(d|0))break;t=b[a+(f<<1)>>1]|0;c[u+(f<<2)>>2]=t<<12;e=e+t|0;f=f+1|0}if((e|0)>4095){i=w;return 0}g=1073741824;f=0;a:while(1){t=d+-1|0;a=c[u+(t<<2)>>2]|0;e=(a+16773022|0)>>>0>33546044;if((d|0)<=1){v=44;break}if(e){v=46;break}r=0-(a<<7)|0;s=((r|0)<0)<<31>>31;zf(r|0,s|0,r|0,s|0)|0;h=1073741824-C|0;q=zf(g|0,f|0,h|0,((h|0)<0)<<31>>31|0)|0;q=qf(q|0,C|0,30)|0;q=q&-4;if((q|0)<107374){v=46;break}if((h|0)<=0)if(!h){a=32;e=30;j=0}else{a=0-h|0;v=11}else{a=h;v=11}if((v|0)==11){v=0;j=32-(aa(a|0)|0)|0;a=aa(a|0)|0;e=j+30|0}p=h<>16;g=536870911/(m|0)|0;n=g<<16;o=n>>16;p=536870912-((_(m,o)|0)+((_(p&65535,o)|0)>>16))<<3;g=n+((_(p>>16,o)|0)+((_(p&65528,o)|0)>>16))+(_(p,(g>>15)+1>>1)|0)|0;a=62-a-e|0;if((a|0)<1){f=0-a|0;a=-2147483648>>f;e=2147483647>>>f;if((a|0)>(e|0)){if((g|0)<=(a|0))a=(g|0)<(e|0)?e:g}else if((g|0)>(e|0))a=e;else a=(g|0)<(a|0)?a:g;p=a<>a:0;m=d>>1;n=(j|0)==1;o=((p|0)<0)<<31>>31;j=j+-1|0;l=0;while(1){if((l|0)>=(m|0))break;d=u+(l<<2)|0;g=c[d>>2]|0;k=u+(t-l+-1<<2)|0;h=c[k>>2]|0;a=zf(h|0,((h|0)<0)<<31>>31|0,r|0,s|0)|0;a=qf(a|0,C|0,30)|0;a=of(a|0,C|0,1,0)|0;a=qf(a|0,C|0,1)|0;e=g-a|0;f=(e|0)>-1;if(n){if(f){f=(g&(a^-2147483648)|0)<0?-2147483648:e;f=zf(f|0,((f|0)<0)<<31>>31|0,p|0,o|0)|0;f=pf(f|0,C|0,1)|0;a=(g&(a^-2147483648)|0)<0?-2147483648:e;e=f;f=C}else{f=((g^-2147483648)&a|0)<0?2147483647:e;f=zf(f|0,((f|0)<0)<<31>>31|0,p|0,o|0)|0;f=pf(f|0,C|0,1)|0;a=((g^-2147483648)&a|0)<0?2147483647:e;e=f;f=C}a=zf(a|0,((a|0)<0)<<31>>31|0,p|0,o|0)|0;a=of(e|0,f|0,a&1|0,0)|0;e=C}else{if(f)a=(g&(a^-2147483648)|0)<0?-2147483648:e;else a=((g^-2147483648)&a|0)<0?2147483647:e;a=zf(a|0,((a|0)<0)<<31>>31|0,p|0,o|0)|0;a=pf(a|0,C|0,j|0)|0;a=of(a|0,C|0,1,0)|0;a=pf(a|0,C|0,1)|0;e=C}f=of(a|0,e|0,-2147483648,0)|0;e=C;if(e>>>0>0|(e|0)==0&f>>>0>4294967295){v=46;break a}c[d>>2]=a;a=zf(g|0,((g|0)<0)<<31>>31|0,r|0,s|0)|0;a=qf(a|0,C|0,30)|0;a=of(a|0,C|0,1,0)|0;a=qf(a|0,C|0,1)|0;e=h-a|0;f=(e|0)>-1;if(n){if(f){f=(h&(a^-2147483648)|0)<0?-2147483648:e;f=zf(f|0,((f|0)<0)<<31>>31|0,p|0,o|0)|0;f=pf(f|0,C|0,1)|0;a=(h&(a^-2147483648)|0)<0?-2147483648:e;e=f;f=C}else{f=((h^-2147483648)&a|0)<0?2147483647:e;f=zf(f|0,((f|0)<0)<<31>>31|0,p|0,o|0)|0;f=pf(f|0,C|0,1)|0;a=((h^-2147483648)&a|0)<0?2147483647:e;e=f;f=C}a=zf(a|0,((a|0)<0)<<31>>31|0,p|0,o|0)|0;a=of(e|0,f|0,a&1|0,0)|0;e=C}else{if(f)a=(h&(a^-2147483648)|0)<0?-2147483648:e;else a=((h^-2147483648)&a|0)<0?2147483647:e;a=zf(a|0,((a|0)<0)<<31>>31|0,p|0,o|0)|0;a=pf(a|0,C|0,j|0)|0;a=of(a|0,C|0,1,0)|0;a=pf(a|0,C|0,1)|0;e=C}h=of(a|0,e|0,-2147483648,0)|0;g=C;if(g>>>0>0|(g|0)==0&h>>>0>4294967295){v=46;break a}c[k>>2]=a;l=l+1|0}g=q;f=((q|0)<0)<<31>>31;d=t}if((v|0)==44)if(e){i=w;return 0}else{u=0-(c[u>>2]<<7)|0;v=((u|0)<0)<<31>>31;zf(u|0,v|0,u|0,v|0)|0;v=1073741824-C|0;v=zf(g|0,f|0,v|0,((v|0)<0)<<31>>31|0)|0;v=qf(v|0,C|0,30)|0;v=v&-4;i=w;return ((v|0)<107374?0:v)|0}else if((v|0)==46){i=w;return 0}return 0}function ue(a,e,f){a=a|0;e=e|0;f=f|0;var g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0;s=i;i=i+304|0;n=s+200|0;p=s+148|0;q=s+96|0;r=s;g=(f|0)==16?32909:32925;h=0;while(1){if((h|0)>=(f|0))break;m=b[e+(h<<1)>>1]|0;o=m>>8;l=b[27508+(o<<1)>>1]|0;o=((l<<8)+(_((b[27508+(o+1<<1)>>1]|0)-l|0,m-(o<<8)|0)|0)>>3)+1>>1;c[n+(d[g+h>>0]<<2)>>2]=o;h=h+1|0}o=f>>1;c[p>>2]=65536;m=p+4|0;l=1;g=0-(c[n>>2]|0)|0;while(1){c[m>>2]=g;if((l|0)>=(o|0))break;e=c[n+(l<<1<<2)>>2]|0;k=c[p+(l+-1<<2)>>2]|0;h=((e|0)<0)<<31>>31;g=c[p+(l<<2)>>2]|0;g=zf(e|0,h|0,g|0,((g|0)<0)<<31>>31|0)|0;g=qf(g|0,C|0,15)|0;g=of(g|0,C|0,1,0)|0;g=qf(g|0,C|0,1)|0;j=l+1|0;c[p+(j<<2)>>2]=(k<<1)-g;g=l;while(1){if((g|0)<=1)break;l=c[p+(g+-2<<2)>>2]|0;u=zf(e|0,h|0,k|0,((k|0)<0)<<31>>31|0)|0;u=qf(u|0,C|0,15)|0;u=of(u|0,C|0,1,0)|0;u=qf(u|0,C|0,1)|0;t=p+(g<<2)|0;c[t>>2]=(c[t>>2]|0)+(l-u);k=l;g=g+-1|0}l=j;g=(c[m>>2]|0)-e|0}m=n+4|0;c[q>>2]=65536;n=q+4|0;l=1;g=0-(c[m>>2]|0)|0;while(1){c[n>>2]=g;if((l|0)>=(o|0)){g=0;break}j=c[m+(l<<1<<2)>>2]|0;h=c[q+(l+-1<<2)>>2]|0;k=((j|0)<0)<<31>>31;g=c[q+(l<<2)>>2]|0;g=zf(j|0,k|0,g|0,((g|0)<0)<<31>>31|0)|0;g=qf(g|0,C|0,15)|0;g=of(g|0,C|0,1,0)|0;g=qf(g|0,C|0,1)|0;e=l+1|0;c[q+(e<<2)>>2]=(h<<1)-g;g=l;while(1){if((g|0)<=1)break;u=c[q+(g+-2<<2)>>2]|0;l=zf(j|0,k|0,h|0,((h|0)<0)<<31>>31|0)|0;l=qf(l|0,C|0,15)|0;l=of(l|0,C|0,1,0)|0;l=qf(l|0,C|0,1)|0;t=q+(g<<2)|0;c[t>>2]=(c[t>>2]|0)+(u-l);h=u;g=g+-1|0}l=e;g=(c[n>>2]|0)-j|0}while(1){if((g|0)>=(o|0))break;u=g+1|0;t=(c[p+(u<<2)>>2]|0)+(c[p+(g<<2)>>2]|0)|0;n=(c[q+(u<<2)>>2]|0)-(c[q+(g<<2)>>2]|0)|0;c[r+(g<<2)>>2]=0-n-t;c[r+(f-g+-1<<2)>>2]=n-t;g=u}j=0;g=0;while(1){if((j|0)<10){e=0;h=0}else break;while(1){if((e|0)>=(f|0))break;u=c[r+(e<<2)>>2]|0;u=(u|0)>0?u:0-u|0;t=(u|0)>(h|0);g=t?e:g;e=e+1|0;h=t?u:h}e=(h>>4)+1>>1;if((e|0)<=32767)break;u=(e|0)<163838?e:163838;re(r,f,65470-(((u<<14)+-536854528|0)/((_(u,g+1|0)|0)>>2|0)|0)|0);j=j+1|0}a:do if((j|0)==10){g=0;while(1){if((g|0)>=(f|0)){g=0;break a}u=r+(g<<2)|0;t=(c[u>>2]>>4)+1>>1;t=(t|0)>32767?32767:(t|0)<-32768?-32768:t;b[a+(g<<1)>>1]=t;c[u>>2]=t<<16>>11;g=g+1|0}}else{g=0;while(1){if((g|0)>=(f|0)){g=0;break a}b[a+(g<<1)>>1]=(((c[r+(g<<2)>>2]|0)>>>4)+1|0)>>>1;g=g+1|0}}while(0);while(1){if(!((te(a,f)|0)==0&(g|0)<16))break;re(r,f,65536-(2<=(f|0))break;b[a+(e<<1)>>1]=(((c[r+(e<<2)>>2]|0)>>>4)+1|0)>>>1;e=e+1|0}g=g+1|0}i=s;return}function ve(a,c,d){a=a|0;c=c|0;d=d|0;var f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0;p=a+(d+-1<<1)|0;q=c+(d<<1)|0;n=0;while(1){if((n|0)>=20)break;j=b[a>>1]|0;i=b[c>>1]|0;f=j;g=0;h=1;j=(j<<16>>16)-(i<<16>>16)|0;while(1){if((h|0)>=(d|0))break;k=b[a+(h<<1)>>1]|0;m=(k<<16>>16)-((f<<16>>16)+(b[c+(h<<1)>>1]|0))|0;l=(m|0)<(j|0);f=k;g=l?h:g;h=h+1|0;j=l?m:j}l=32768-((b[p>>1]|0)+(b[q>>1]|0))|0;k=(l|0)<(j|0);m=k?d:g;if(((k?l:j)|0)>-1){o=36;break}do if(!m)b[a>>1]=i;else{if((m|0)==(d|0)){b[p>>1]=32768-(e[q>>1]|0);break}else{f=0;i=0}while(1){if((f|0)>=(m|0))break;l=i+(b[c+(f<<1)>>1]|0)|0;f=f+1|0;i=l}k=c+(m<<1)|0;l=b[k>>1]|0;g=l>>1;f=d;h=32768;while(1){if((f|0)<=(m|0))break;j=h-(b[c+(f<<1)>>1]|0)|0;f=f+-1|0;h=j}f=i+g|0;h=h-g|0;j=a+(m+-1<<1)|0;r=b[j>>1]|0;i=a+(m<<1)|0;g=b[i>>1]|0;g=((r<<16>>16)+(g<<16>>16)>>1)+((r&65535)+(g&65535)&1)|0;if((f|0)>(h|0)){if((g|0)<=(f|0))f=(g|0)<(h|0)?h:g}else if((g|0)>(h|0))f=h;else f=(g|0)<(f|0)?f:g;r=f-(l>>>1)|0;b[j>>1]=r;b[i>>1]=r+(e[k>>1]|0)}while(0);n=n+1|0}if((o|0)==36)return;if((n|0)==20)h=1;else return;while(1){if((h|0)>=(d|0))break;f=b[a+(h<<1)>>1]|0;j=h;while(1){i=j+-1|0;if((j|0)<=0)break;g=b[a+(i<<1)>>1]|0;if(f<<16>>16>=g<<16>>16)break;b[a+(j<<1)>>1]=g;j=i}b[a+(j<<1)>>1]=f;h=h+1|0}g=b[a>>1]|0;f=b[c>>1]|0;f=g<<16>>16>f<<16>>16?g:f;b[a>>1]=f;f=f<<16>>16;g=1;while(1){if((g|0)>=(d|0))break;o=a+(g<<1)|0;n=b[o>>1]|0;r=f+(b[c+(g<<1)>>1]|0)|0;r=(r|0)>32767?32767:((r|0)<-32768?-32768:r)<<16>>16;r=(n|0)>(r|0)?n:r;b[o>>1]=r;f=r;g=g+1|0}f=b[p>>1]|0;g=32768-(b[q>>1]|0)|0;g=(f|0)<(g|0)?f:g;b[p>>1]=g;f=d+-2|0;while(1){if((f|0)<=-1)break;d=a+(f<<1)|0;q=b[d>>1]|0;r=(g<<16>>16)-(b[c+(f+1<<1)>>1]|0)|0;r=(q|0)<(r|0)?q:r;b[d>>1]=r;g=r;f=f+-1|0}return}function we(a,c,d){a=a|0;c=c|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0;e=b[c>>1]|0;f=(b[c+2>>1]|0)-(e<<16>>16)|0;f=131072/(((f|0)>1?f:1)|0)|0;e=(131072/((e<<16>>16>1?e:1)<<16>>16|0)|0)+f|0;b[a>>1]=(e|0)<32767?e:32767;d=d+-1|0;e=1;while(1){if((e|0)>=(d|0))break;i=e+1|0;g=c+(i<<1)|0;j=(b[g>>1]|0)-(b[c+(e<<1)>>1]|0)|0;j=131072/(((j|0)>1?j:1)|0)|0;h=j+f|0;b[a+(e<<1)>>1]=(h|0)<32767?h:32767;h=e+2|0;g=(b[c+(h<<1)>>1]|0)-(b[g>>1]|0)|0;g=131072/(((g|0)>1?g:1)|0)|0;j=j+g|0;b[a+(i<<1)>>1]=(j|0)<32767?j:32767;e=h;f=g}j=32768-(b[c+(d<<1)>>1]|0)|0;j=(131072/(((j|0)>1?j:1)|0)|0)+f|0;b[a+(d<<1)>>1]=(j|0)<32767?j:32767;return}function xe(a,d,e,f){a=a|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0;f=f>>1;g=a+4|0;h=0;while(1){if((h|0)>=(f|0))break;m=h<<1;l=b[e+(m<<1)>>1]<<10;j=l-(c[a>>2]|0)|0;k=(_(j>>16,-25727)|0)+((_(j&65535,-25727)|0)>>16)|0;c[a>>2]=l+(j+k);m=b[e+((m|1)<<1)>>1]<<10;j=c[g>>2]|0;i=m-j|0;i=((i>>16)*9872|0)+(((i&65535)*9872|0)>>>16)|0;c[g>>2]=m+i;i=(l+k+j+i>>10)+1>>1;b[d+(h<<1)>>1]=(i|0)>32767?32767:((i|0)<-32768?-32768:i)&65535;h=h+1|0}return}function ye(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0,j=0,k=0;f=0;while(1){if((f|0)>=(e|0)){h=1;break}c[b+(f<<2)>>2]=f;f=f+1|0}while(1){if((h|0)>=(e|0))break;g=c[a+(h<<2)>>2]|0;j=h;while(1){i=j+-1|0;if((j|0)<=0)break;f=c[a+(i<<2)>>2]|0;if((g|0)>=(f|0))break;c[a+(j<<2)>>2]=f;c[b+(j<<2)>>2]=c[b+(i<<2)>>2];j=i}c[a+(j<<2)>>2]=g;c[b+(j<<2)>>2]=h;h=h+1|0}j=a+(e+-1<<2)|0;k=e+-2|0;h=e;while(1){if((h|0)>=(d|0))break;f=c[a+(h<<2)>>2]|0;if((f|0)<(c[j>>2]|0)){i=k;while(1){if((i|0)<=-1)break;g=c[a+(i<<2)>>2]|0;if((f|0)>=(g|0))break;e=i+1|0;c[a+(e<<2)>>2]=g;c[b+(e<<2)>>2]=c[b+(i<<2)>>2];i=i+-1|0}e=i+1|0;c[a+(e<<2)>>2]=f;c[b+(e<<2)>>2]=h}h=h+1|0}return}function ze(a,d,e,f){a=a|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0;j=31-(aa(f|0)|0)|0;k=f+-1|0;h=((k|0)>0?k:0)+1&-2;i=0;g=f;while(1){if((i|0)>=(k|0))break;m=b[e+(i<<1)>>1]|0;m=_(m,m)|0;l=b[e+((i|1)<<1)>>1]|0;i=i+2|0;g=g+((m+(_(l,l)|0)|0)>>>j)|0}if((h|0)<(f|0)){m=b[e+(h<<1)>>1]|0;g=g+((_(m,m)|0)>>>j)|0}g=j+3-(aa(g|0)|0)|0;g=(g|0)<0?0:g;h=f+-1|0;h=((h|0)>0?h:0)+1&-2;i=0;j=0;while(1){if((i|0)>=(k|0))break;l=b[e+(i<<1)>>1]|0;l=_(l,l)|0;m=b[e+((i|1)<<1)>>1]|0;i=i+2|0;j=j+((l+(_(m,m)|0)|0)>>>g)|0}if((h|0)>=(f|0)){m=j;c[d>>2]=g;c[a>>2]=m;return}m=b[e+(h<<1)>>1]|0;m=j+((_(m,m)|0)>>>g)|0;c[d>>2]=g;c[a>>2]=m;return}function Ae(a,b,c,d,e,f){a=a|0;b=b|0;c=+c;d=d|0;e=e|0;f=f|0;var j=0.0,k=0,l=0,m=0,n=0.0,o=0,p=0.0,q=0,r=0,s=0.0,t=0.0,u=0.0,v=0,w=0,x=0,y=0,z=0,A=0,B=0.0,C=0,D=0,E=0,F=0.0,G=0.0,H=0.0,I=0;E=i;i=i+976|0;y=E+784|0;z=E+592|0;C=E+392|0;x=E+192|0;D=E;j=+Ud(b,_(e,d)|0);nf(y|0,0,192)|0;m=0;while(1){if((m|0)>=(e|0))break;k=b+((_(m,d)|0)<<2)|0;l=1;while(1){if((l|0)>(f|0))break;B=+Vd(k,k+(l<<2)|0,d-l|0);w=y+(l+-1<<3)|0;h[w>>3]=+h[w>>3]+B;l=l+1|0}m=m+1|0}rf(z|0,y|0,192)|0;B=j*9.999999747378752e-06;u=j+B+9.999999717180685e-10;h[C>>3]=u;h[x>>3]=u;u=c;v=1;l=0;w=2;t=1.0;while(1){if((l|0)>=(f|0))break;m=d-l|0;o=m+-1|0;r=0;while(1){if((r|0)>=(e|0))break;q=b+((_(r,d)|0)<<2)|0;c=+g[q+(l<<2)>>2];n=+g[q+(o<<2)>>2];k=0;p=c;s=n;while(1){if((l|0)==(k|0)){k=0;break}H=+g[q+(l-k+-1<<2)>>2];I=y+(k<<3)|0;h[I>>3]=+h[I>>3]-c*H;G=+g[q+(m+k<<2)>>2];I=z+(k<<3)|0;h[I>>3]=+h[I>>3]-n*G;F=+h[D+(k<<3)>>3];k=k+1|0;p=p+H*F;s=s+G*F}while(1){if((k|0)==(v|0))break;I=C+(k<<3)|0;h[I>>3]=+h[I>>3]-p*+g[q+(l-k<<2)>>2];I=x+(k<<3)|0;h[I>>3]=+h[I>>3]-s*+g[q+(m+k+-1<<2)>>2];k=k+1|0}r=r+1|0}k=0;c=+h[y+(l<<3)>>3];p=+h[z+(l<<3)>>3];while(1){if((l|0)==(k|0))break;H=+h[D+(k<<3)>>3];I=l-k+-1|0;k=k+1|0;c=c+ +h[z+(I<<3)>>3]*H;p=p+ +h[y+(I<<3)>>3]*H}q=l+1|0;h[C+(q<<3)>>3]=c;h[x+(q<<3)>>3]=p;k=0;c=+h[x>>3];n=+h[C>>3];while(1){if((l|0)==(k|0))break;G=+h[D+(k<<3)>>3];I=k+1|0;H=p+ +h[x+(l-k<<3)>>3]*G;k=I;c=c+ +h[x+(I<<3)>>3]*G;n=n+ +h[C+(I<<3)>>3]*G;p=H}n=p*-2.0/(n+c);c=t*(1.0-n*n);if(!(c<=u))k=0;else{n=+O(+(1.0-u/t));c=u;n=p>0.0?-n:n;k=1}m=q>>1;o=0;while(1){if((o|0)>=(m|0))break;r=D+(o<<3)|0;H=+h[r>>3];I=D+(l-o+-1<<3)|0;G=+h[I>>3];h[r>>3]=H+n*G;h[I>>3]=G+n*H;o=o+1|0}h[D+(l<<3)>>3]=n;if(!k)k=0;else{A=29;break}while(1){if((k|0)==(w|0))break;r=C+(k<<3)|0;H=+h[r>>3];I=x+(l-k+1<<3)|0;G=+h[I>>3];h[r>>3]=H+n*G;h[I>>3]=G+n*H;k=k+1|0}v=v+1|0;l=q;w=w+1|0;t=c}if((A|0)==29){while(1){l=l+1|0;if((l|0)>=(f|0))break;h[D+(l<<3)>>3]=0.0;A=29}if(k|0){k=0;while(1){if((k|0)>=(f|0)){k=0;break}g[a+(k<<2)>>2]=-+h[D+(k<<3)>>3];k=k+1|0}while(1){if((k|0)>=(e|0))break;j=j-+Ud(b+((_(k,d)|0)<<2)|0,f);k=k+1|0}H=j*c;i=E;return +H}}k=0;j=+h[C>>3];c=1.0;while(1){if((k|0)>=(f|0))break;H=+h[D+(k<<3)>>3];I=k+1|0;G=+h[C+(I<<3)>>3];g[a+(k<<2)>>2]=-H;k=I;j=j+G*H;c=c+H*H}H=j-B*c;i=E;return +H}function Be(a,d,e,f){a=a|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0;I=i;i=i+32|0;H=I;o=a+2772|0;g=a+2316|0;j=a+4156|0;if((c[g>>2]|0)!=(c[j>>2]|0)){k=a+2340|0;h=c[k>>2]|0;l=32767/(h+1|0)|0;m=0;n=0;while(1){if((n|0)>=(h|0))break;G=m+l|0;b[a+4052+(n<<1)>>1]=G;h=c[k>>2]|0;m=G;n=n+1|0}c[a+4148>>2]=0;c[a+4152>>2]=3176576;c[j>>2]=c[g>>2]}m=a+4160|0;do if(!(c[m>>2]|0)){if(!(c[a+4164>>2]|0)){g=a+2340|0;h=0;while(1){if((h|0)>=(c[g>>2]|0))break;E=b[a+2344+(h<<1)>>1]|0;G=a+4052+(h<<1)|0;D=b[G>>1]|0;F=D&65535;b[G>>1]=F+((((E<<16>>16)-(D<<16>>16)>>16)*16348|0)+((((E&65535)-F&65535)*16348|0)>>>16));h=h+1|0}l=a+2324|0;g=c[l>>2]|0;h=0;j=0;k=0;while(1){if((h|0)>=(g|0))break;F=c[d+16+(h<<2)>>2]|0;E=(F|0)>(j|0);G=E?h:k;h=h+1|0;j=E?F:j;k=G}j=a+2332|0;h=c[j>>2]|0;sf(a+2772+(h<<2)|0,o|0,(_(g+-1|0,h)|0)<<2|0)|0;j=c[j>>2]|0;rf(o|0,a+4+((_(k,j)|0)<<2)|0,j<<2|0)|0;j=a+4148|0;g=c[l>>2]|0;h=0;while(1){if((h|0)>=(g|0))break;F=c[j>>2]|0;G=(c[d+16+(h<<2)>>2]|0)-F|0;c[j>>2]=F+(((G>>16)*4634|0)+(((G&65535)*4634|0)>>>16));h=h+1|0}if(c[m>>2]|0)break}nf(a+4084|0,0,c[a+2340>>2]<<2|0)|0;i=I;return}while(0);F=Fa()|0;G=i;i=i+((1*(f+16<<2)|0)+15&-16)|0;E=b[a+4224>>1]|0;g=E<<16>>16;h=c[a+4244>>2]|0;k=h<<16>>16;h=(_(g>>16,k)|0)+((_(E&65535,k)|0)>>16)+(_(g,(h>>15)+1>>1)|0)|0;g=c[a+4148>>2]|0;k=h>>16;if((h|0)>2097151|(g|0)>8388608){j=g>>16;j=_(j,j)|0;h=(_(k,k)|0)<<5;g=j-h|0;if((g|0)<1)m=0;else{k=aa(g|0)|0;k=(j|0)==(h|0)?32:k;h=24-k|0;j=0-h|0;do if(h)if((h|0)<0){g=g<>>(h+32|0);break}else{g=g<<32-h|g>>>h;break}while(0);E=((k&1|0)==0?46214:32768)>>>(k>>>1);m=(_(g&127,13959168)|0)>>>16;m=E+((_(E>>16,m)|0)+((_(E&65535,m)|0)>>>16))<<16}}else{E=h<<16>>16;j=g<<16>>16;j=(_(g>>16,j)|0)+((_(g&65535,j)|0)>>16)+(_(g,(g>>15)+1>>1)|0)|0;h=(_(k,E)|0)+((_(h&65535,E)|0)>>16)+(_(h,(h>>15)+1>>1)|0)<<5;g=j-h|0;if((g|0)<1)m=0;else{k=aa(g|0)|0;k=(j|0)==(h|0)?32:k;h=24-k|0;j=0-h|0;do if(h)if((h|0)<0){g=g<>>(h+32|0);break}else{g=g<<32-h|g>>>h;break}while(0);E=((k&1|0)==0?46214:32768)>>>(k>>>1);m=(_(g&127,13959168)|0)>>>16;m=E+((_(E>>16,m)|0)+((_(E&65535,m)|0)>>>16))<<8}}g=G+64|0;j=255;while(1){if((j|0)<=(f|0))break;j=j>>1}h=a+4152|0;k=0;l=c[h>>2]|0;while(1){if((k|0)>=(f|0))break;E=(_(l,196314165)|0)+907633515|0;c[g+(k<<2)>>2]=c[a+2772+((E>>24&j)<<2)>>2];k=k+1|0;l=E}c[h>>2]=l;E=a+2340|0;ue(H,a+4052|0,c[E>>2]|0);D=a+4084|0;g=G;h=D;j=g+64|0;do{c[g>>2]=c[h>>2];g=g+4|0;h=h+4|0}while((g|0)<(j|0));a=b[H>>1]|0;p=b[H+2>>1]|0;q=b[H+4>>1]|0;r=b[H+6>>1]|0;s=b[H+8>>1]|0;t=b[H+10>>1]|0;u=b[H+12>>1]|0;v=b[H+14>>1]|0;w=b[H+16>>1]|0;x=b[H+18>>1]|0;y=b[H+20>>1]|0;z=b[H+22>>1]|0;A=b[H+24>>1]|0;B=b[H+26>>1]|0;C=b[H+28>>1]|0;o=b[H+30>>1]|0;d=m<<10>>16;m=(m>>21)+1>>1;n=0;while(1){if((n|0)>=(f|0))break;H=c[G+(n+15<<2)>>2]|0;H=(c[E>>2]>>1)+((_(H>>16,a)|0)+((_(H&65535,a)|0)>>16))|0;g=c[G+(n+14<<2)>>2]|0;g=H+((_(g>>16,p)|0)+((_(g&65535,p)|0)>>16))|0;H=c[G+(n+13<<2)>>2]|0;H=g+((_(H>>16,q)|0)+((_(H&65535,q)|0)>>16))|0;g=c[G+(n+12<<2)>>2]|0;g=H+((_(g>>16,r)|0)+((_(g&65535,r)|0)>>16))|0;H=c[G+(n+11<<2)>>2]|0;H=g+((_(H>>16,s)|0)+((_(H&65535,s)|0)>>16))|0;g=c[G+(n+10<<2)>>2]|0;g=H+((_(g>>16,t)|0)+((_(g&65535,t)|0)>>16))|0;H=c[G+(n+9<<2)>>2]|0;H=g+((_(H>>16,u)|0)+((_(H&65535,u)|0)>>16))|0;g=c[G+(n+8<<2)>>2]|0;g=H+((_(g>>16,v)|0)+((_(g&65535,v)|0)>>16))|0;H=c[G+(n+7<<2)>>2]|0;H=g+((_(H>>16,w)|0)+((_(H&65535,w)|0)>>16))|0;g=c[G+(n+6<<2)>>2]|0;g=H+((_(g>>16,x)|0)+((_(g&65535,x)|0)>>16))|0;if((c[E>>2]|0)==16){H=c[G+(n+5<<2)>>2]|0;H=g+((_(H>>16,y)|0)+((_(H&65535,y)|0)>>16))|0;g=c[G+(n+4<<2)>>2]|0;g=H+((_(g>>16,z)|0)+((_(g&65535,z)|0)>>16))|0;H=c[G+(n+3<<2)>>2]|0;H=g+((_(H>>16,A)|0)+((_(H&65535,A)|0)>>16))|0;g=c[G+(n+2<<2)>>2]|0;g=H+((_(g>>16,B)|0)+((_(g&65535,B)|0)>>16))|0;H=c[G+(n+1<<2)>>2]|0;H=g+((_(H>>16,C)|0)+((_(H&65535,C)|0)>>16))|0;g=c[G+(n<<2)>>2]|0;g=H+((_(g>>16,o)|0)+((_(g&65535,o)|0)>>16))|0}l=G+(n+16<<2)|0;h=c[l>>2]|0;j=(g|0)>134217727;k=j?2147483632:((g|0)<-134217728?-134217728:g)<<4;if((h+(j?2147483632:((g|0)<-134217728?-134217728:g)<<4)|0)>-1)if((h&k|0)<0)g=-2147483648;else g=h+(j?2147483632:((g|0)<-134217728?-134217728:g)<<4)|0;else if((h|k|0)>-1)g=2147483647;else g=h+(j?2147483632:((g|0)<-134217728?-134217728:g)<<4)|0;c[l>>2]=g;k=e+(n<<1)|0;j=b[k>>1]|0;g=((_(g>>16,d)|0)+((_(g&65535,d)|0)>>16)+(_(g,m)|0)>>7)+1>>1;h=(g|0)>32767;if((j+(h?32767:(g|0)<-32768?-32768:g)|0)<=32767)if((j+(h?32767:(g|0)<-32768?-32768:g)|0)<-32768)g=-32768;else g=j+(h?32767:(g|0)<-32768?-32768:g)|0;else g=32767;b[k>>1]=g;n=n+1|0}g=D;h=G+(f<<2)|0;j=g+64|0;do{c[g>>2]=c[h>>2];g=g+4|0;h=h+4|0}while((g|0)<(j|0));Na(F|0);i=I;return}function Ce(d,e,f,g){d=d|0;e=e|0;f=f|0;g=g|0;var h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,$=0,ba=0,ca=0,da=0,ea=0,fa=0;ea=i;i=i+32|0;da=ea;W=d+2336|0;ba=c[W>>2]|0;Z=i;i=i+((1*(ba<<1)|0)+15&-16)|0;o=d+2328|0;j=c[o>>2]|0;$=i;i=i+((1*(ba+j<<2)|0)+15&-16)|0;ba=d+2332|0;n=c[ba>>2]|0;ca=i;i=i+((1*(n<<2)|0)+15&-16)|0;X=i;i=i+((1*(n+16<<2)|0)+15&-16)|0;n=b[d+2766>>1]|0;Y=d+2765|0;q=(n&65535)>>>8&255;n=b[25404+(a[Y>>0]>>1<<2)+((n&65535)<<24>>24<<1)>>1]<<4;p=0;h=a[d+2770>>0]|0;while(1){if((p|0)>=(j|0))break;l=(_(h,196314165)|0)+907633515|0;m=g+(p<<1)|0;j=b[m>>1]|0;h=j<<16>>16<<14;k=d+4+(p<<2)|0;c[k>>2]=h;if(j<<16>>16<=0){if(j<<16>>16<0){h=h|1280;c[k>>2]=h}}else{h=h+-1280|0;c[k>>2]=h}j=h+n|0;c[k>>2]=(l|0)<0?0-j|0:j;j=c[o>>2]|0;p=p+1|0;h=l+(b[m>>1]|0)|0}Q=d+1284|0;h=X;j=Q;k=h+64|0;do{c[h>>2]=c[j>>2];h=h+4|0;j=j+4|0}while((h|0)<(k|0));R=d+2324|0;S=d+2340|0;T=d+4160|0;U=e+136|0;u=q<<24>>24>3;v=da+2|0;w=da+4|0;x=da+6|0;y=da+8|0;z=da+10|0;A=da+12|0;B=da+14|0;D=da+16|0;E=da+18|0;F=da+20|0;G=da+22|0;H=da+24|0;I=da+26|0;J=da+28|0;K=da+30|0;L=d+4164|0;M=d+2308|0;N=0;O=d+4|0;P=f;g=c[W>>2]|0;while(1){if((N|0)>=(c[R>>2]|0))break;o=e+32+(N>>1<<5)|0;rf(da|0,o|0,c[S>>2]<<1|0)|0;r=e+96+(N*5<<1)|0;n=a[Y>>0]|0;t=c[e+16+(N<<2)>>2]|0;s=t>>>6;m=(t|0)>0;if(!m)if(!t)h=32;else{h=0-t|0;V=12}else{h=t;V=12}if((V|0)==12){V=0;h=aa(h|0)|0}j=t<>16;l=536870911/(k|0)|0;p=l<<16;q=p>>16;j=536870912-((_(k,q)|0)+((_(j&65535,q)|0)>>16))<<3;l=p+((_(j>>16,q)|0)+((_(j&65528,q)|0)>>16))+(_(j,(l>>15)+1>>1)|0)|0;h=62-h|0;j=h+-47|0;if((j|0)<1){k=47-h|0;h=-2147483648>>k;j=2147483647>>>k;if((h|0)>(j|0)){if((l|0)<=(h|0))h=(l|0)<(j|0)?j:l}else if((l|0)>(j|0))h=j;else h=(l|0)<(h|0)?h:l;h=h<>j:0;k=c[d>>2]|0;a:do if((t|0)==(k|0))m=65536;else{if((k|0)<=0)if(!k)l=32;else{j=0-k|0;V=24}else{j=k;V=24}if((V|0)==24){V=0;l=aa(j|0)|0}k=k<>16|0)|0)<<16>>16;q=(_(k>>16,m)|0)+((_(k&65535,m)|0)>>16)|0;p=zf(p|0,((p|0)<0)<<31>>31|0,q|0,((q|0)<0)<<31>>31|0)|0;p=qf(p|0,C|0,29)|0;k=k-(p&-8)|0;m=q+((_(k>>16,m)|0)+((_(k&65535,m)|0)>>16))|0;j=l+28-j|0;k=j+-16|0;if((j|0)<16){l=16-j|0;j=-2147483648>>l;k=2147483647>>>l;if((j|0)>(k|0)){if((m|0)<=(j|0))j=(m|0)<(k|0)?k:m}else if((m|0)>(k|0))j=k;else j=(m|0)<(j|0)?j:m;j=j<>k:0;k=j>>16;l=j&65535;m=0;while(1){if((m|0)==16){m=j;break a}q=X+(m<<2)|0;p=c[q>>2]|0;fa=p<<16>>16;c[q>>2]=(_(k,fa)|0)+((_(l,fa)|0)>>16)+(_(j,(p>>15)+1>>1)|0);m=m+1|0}}while(0);c[d>>2]=t;if((c[T>>2]|0)!=0?n<<24>>24!=2&(c[L>>2]|0)==2&(N|0)<2:0){b[r>>1]=0;b[r+2>>1]=0;b[r+4>>1]=0;b[r+6>>1]=0;b[r+8>>1]=0;b[r+4>>1]=4096;q=c[M>>2]|0;c[e+(N<<2)>>2]=q;V=44}else if(n<<24>>24==2){q=c[e+(N<<2)>>2]|0;V=44}else p=O;b:do if((V|0)==44){V=0;n=(N|0)==0;c:do if(!n){if(!((N|0)!=2|u)){k=c[W>>2]|0;l=c[S>>2]|0;j=k-q-l+-2|0;if((N|0)!=2){V=49;break}rf(d+1348+(k<<1)|0,f|0,c[ba>>2]<<2|0)|0;k=c[W>>2]|0;l=c[S>>2]|0;V=49;break}if((m|0)!=65536){h=q+2|0;j=m>>16;k=m&65535;l=0;while(1){if((l|0)>=(h|0))break c;fa=$+(g-l+-1<<2)|0;p=c[fa>>2]|0;o=p<<16>>16;c[fa>>2]=(_(j,o)|0)+((_(k,o)|0)>>16)+(_(m,(p>>15)+1>>1)|0);l=l+1|0}}}else{k=c[W>>2]|0;l=c[S>>2]|0;j=k-q-l+-2|0;V=49}while(0);d:do if((V|0)==49){V=0;se(Z+(j<<1)|0,d+1348+(j+(_(N,c[ba>>2]|0)|0)<<1)|0,o,k-j|0,l);if(n){fa=c[U>>2]<<16>>16;h=(_(h>>16,fa)|0)+((_(h&65535,fa)|0)>>16)<<2}k=q+2|0;l=h>>16;h=h&65535;j=0;while(1){if((j|0)>=(k|0))break d;fa=b[Z+((c[W>>2]|0)-j+-1<<1)>>1]|0;c[$+(g-j+-1<<2)>>2]=(_(l,fa)|0)+((_(h,fa)|0)>>16);j=j+1|0}}while(0);l=r+2|0;m=r+4|0;n=r+6|0;o=r+8|0;k=c[ba>>2]|0;p=0;h=$+(g-q+2<<2)|0;j=g;while(1){if((p|0)>=(k|0)){p=ca;g=j;break b}q=c[h>>2]|0;fa=b[r>>1]|0;fa=(_(q>>16,fa)|0)+((_(q&65535,fa)|0)>>16)+2|0;q=c[h+-4>>2]|0;g=b[l>>1]|0;g=fa+((_(q>>16,g)|0)+((_(q&65535,g)|0)>>16))|0;q=c[h+-8>>2]|0;fa=b[m>>1]|0;fa=g+((_(q>>16,fa)|0)+((_(q&65535,fa)|0)>>16))|0;q=c[h+-12>>2]|0;g=b[n>>1]|0;g=fa+((_(q>>16,g)|0)+((_(q&65535,g)|0)>>16))|0;q=c[h+-16>>2]|0;fa=b[o>>1]|0;fa=g+((_(q>>16,fa)|0)+((_(q&65535,fa)|0)>>16))|0;fa=(c[O+(p<<2)>>2]|0)+(fa<<1)|0;c[ca+(p<<2)>>2]=fa;c[$+(j<<2)>>2]=fa<<1;p=p+1|0;h=h+4|0;j=j+1|0}}while(0);o=s<<16>>16;m=(t>>21)+1>>1;n=0;while(1){l=c[ba>>2]|0;if((n|0)>=(l|0))break;fa=c[X+(n+15<<2)>>2]|0;t=b[da>>1]|0;t=(c[S>>2]>>1)+((_(fa>>16,t)|0)+((_(fa&65535,t)|0)>>16))|0;fa=c[X+(n+14<<2)>>2]|0;h=b[v>>1]|0;h=t+((_(fa>>16,h)|0)+((_(fa&65535,h)|0)>>16))|0;fa=c[X+(n+13<<2)>>2]|0;t=b[w>>1]|0;t=h+((_(fa>>16,t)|0)+((_(fa&65535,t)|0)>>16))|0;fa=c[X+(n+12<<2)>>2]|0;h=b[x>>1]|0;h=t+((_(fa>>16,h)|0)+((_(fa&65535,h)|0)>>16))|0;fa=c[X+(n+11<<2)>>2]|0;t=b[y>>1]|0;t=h+((_(fa>>16,t)|0)+((_(fa&65535,t)|0)>>16))|0;fa=c[X+(n+10<<2)>>2]|0;h=b[z>>1]|0;h=t+((_(fa>>16,h)|0)+((_(fa&65535,h)|0)>>16))|0;fa=c[X+(n+9<<2)>>2]|0;t=b[A>>1]|0;t=h+((_(fa>>16,t)|0)+((_(fa&65535,t)|0)>>16))|0;fa=c[X+(n+8<<2)>>2]|0;h=b[B>>1]|0;h=t+((_(fa>>16,h)|0)+((_(fa&65535,h)|0)>>16))|0;fa=c[X+(n+7<<2)>>2]|0;t=b[D>>1]|0;t=h+((_(fa>>16,t)|0)+((_(fa&65535,t)|0)>>16))|0;fa=c[X+(n+6<<2)>>2]|0;h=b[E>>1]|0;h=t+((_(fa>>16,h)|0)+((_(fa&65535,h)|0)>>16))|0;if((c[S>>2]|0)==16){fa=c[X+(n+5<<2)>>2]|0;t=b[F>>1]|0;t=h+((_(fa>>16,t)|0)+((_(fa&65535,t)|0)>>16))|0;fa=c[X+(n+4<<2)>>2]|0;h=b[G>>1]|0;h=t+((_(fa>>16,h)|0)+((_(fa&65535,h)|0)>>16))|0;fa=c[X+(n+3<<2)>>2]|0;t=b[H>>1]|0;t=h+((_(fa>>16,t)|0)+((_(fa&65535,t)|0)>>16))|0;fa=c[X+(n+2<<2)>>2]|0;h=b[I>>1]|0;h=t+((_(fa>>16,h)|0)+((_(fa&65535,h)|0)>>16))|0;fa=c[X+(n+1<<2)>>2]|0;t=b[J>>1]|0;t=h+((_(fa>>16,t)|0)+((_(fa&65535,t)|0)>>16))|0;fa=c[X+(n<<2)>>2]|0;h=b[K>>1]|0;h=t+((_(fa>>16,h)|0)+((_(fa&65535,h)|0)>>16))|0}j=c[p+(n<<2)>>2]|0;k=(h|0)>134217727;l=k?2147483632:((h|0)<-134217728?-134217728:h)<<4;if((j+(k?2147483632:((h|0)<-134217728?-134217728:h)<<4)|0)>-1)if((j&l|0)<0)h=-2147483648;else h=j+(k?2147483632:((h|0)<-134217728?-134217728:h)<<4)|0;else if((j|l|0)>-1)h=2147483647;else h=j+(k?2147483632:((h|0)<-134217728?-134217728:h)<<4)|0;c[X+(n+16<<2)>>2]=h;fa=((_(h>>16,o)|0)+((_(h&65535,o)|0)>>16)+(_(h,m)|0)>>7)+1>>1;b[P+(n<<1)>>1]=(fa|0)>32767?32767:((fa|0)<-32768?-32768:fa)&65535;n=n+1|0}h=X;j=X+(l<<2)|0;k=h+64|0;do{c[h>>2]=c[j>>2];h=h+4|0;j=j+4|0}while((h|0)<(k|0));N=N+1|0;O=O+(l<<2)|0;P=P+(l<<1)|0}h=Q;j=X;k=h+64|0;do{c[h>>2]=c[j>>2];h=h+4|0;j=j+4|0}while((h|0)<(k|0));i=ea;return}function De(f,g,h,j,k,l,m){f=f|0;g=g|0;h=h|0;j=j|0;k=k|0;l=l|0;m=m|0;var n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Y=0,Z=0,$=0,ba=0,ca=0,da=0,ea=0,fa=0,ga=0,ha=0,ia=0;fa=i;i=i+448|0;Z=fa+232|0;Y=fa+376|0;da=fa+344|0;S=fa+200|0;U=fa+184|0;T=fa+168|0;$=fa+88|0;ba=fa+8|0;W=fa;ea=fa+312|0;V=fa+280|0;ca=fa+360|0;X=fa+248|0;Q=h+2|0;ve(g,c[h+36>>2]|0,b[Q>>1]|0);n=c[h>>2]|0;w=i;i=i+((1*((n&65535)<<2)|0)+15&-16)|0;R=h+8|0;P=h+12|0;v=n<<16>>16;n=n>>16;o=c[R>>2]|0;p=0;u=c[P>>2]|0;while(1){if((p|0)<(v|0)){r=n;s=0;t=0}else break;while(1){q=r+-2|0;if((q|0)<=-1)break;M=r+-1|0;M=_((e[g+(M<<1)>>1]|0)-(d[o+M>>0]<<7)<<16>>16,b[u+(M<<1)>>1]|0)|0;L=s>>1;O=_((e[g+(q<<1)>>1]|0)-(d[o+q>>0]<<7)<<16>>16,b[u+(q<<1)>>1]|0)|0;N=M>>1;r=q;s=O;t=t+((M|0)>(L|0)?M-L|0:L-M|0)+((O|0)>(N|0)?O-N|0:N-O|0)|0}c[w+(p<<2)>>2]=t;o=o+n|0;p=p+1|0;u=u+(n<<1)|0}O=i;i=i+((1*(l<<2)|0)+15&-16)|0;ye(w,O,v,l);J=i;i=i+((1*(l<<2)|0)+15&-16)|0;K=i;i=i+((1*(l<<4)|0)+15&-16)|0;L=h+32|0;M=h+4|0;N=k<<16>>16;H=m>>1;I=h+16|0;F=k<<14>>16;G=0;while(1){if((G|0)>=(l|0))break;E=c[O+(G<<2)>>2]|0;r=b[Q>>1]|0;t=_(E,r)|0;s=(c[R>>2]|0)+t|0;t=(c[P>>2]|0)+(t<<1)|0;u=0;while(1){if((u|0)>=(r|0))break;D=b[t+(u<<1)>>1]|0;b[ea+(u<<1)>>1]=(_((e[g+(u<<1)>>1]|0)-(d[s+u>>0]<<7)<<16>>16,D)|0)>>>14;o=b[j+(u<<1)>>1]|0;A=o<<16>>16;D=_(D,D)|0;o=aa((o<<16>>16>0?A:0-A|0)|0)|0;A=A<>16|0)|0)<<16>>16;B=(_(A>>16,q)|0)+((_(A&65535,q)|0)>>16)|0;D=zf(D|0,((D|0)<0)<<31>>31|0,B|0,((B|0)<0)<<31>>31|0)|0;D=qf(D|0,C|0,29)|0;D=A-(D&-8)|0;q=B+((_(D>>16,q)|0)+((_(D&65535,q)|0)>>16))|0;n=o+28-n|0;o=n+-21|0;if((n|0)<21){p=21-n|0;n=-2147483648>>p;o=2147483647>>>p;if((n|0)>(o|0)){if((q|0)<=(n|0))n=(q|0)<(o|0)?o:q}else if((q|0)>(o|0))n=o;else n=(q|0)<(n|0)?n:q;n=n<>o:0;b[V+(u<<1)>>1]=n;u=u+1|0}Cd(X,ca,h,E);D=G<<4;B=c[L>>2]|0;s=c[M>>2]|0;p=s<<16>>16;q=b[Q>>1]|0;r=-10;while(1){if((r|0)==10)break;n=r<<10;o=n+1024|0;a:do if((r|0)>0){n=(r<<26>>16)+-102|0;o=(o<<16>>16)+-102|0}else{switch(r|0){case 0:{o=(o<<16>>16)+-102|0;break a}case -1:{n=-1024;break}default:o=o|102}n=n|102}while(0);A=r+10|0;c[$+(A<<2)>>2]=(_(n<<16>>16,p)|0)>>16;c[ba+(A<<2)>>2]=(_(o<<16>>16,p)|0)>>16;r=r+1|0}c[S>>2]=0;b[da>>1]=0;A=q<<16>>16;y=s>>16;n=A;x=1;b:while(1){z=x<<1;m=(z|0)<5;c:while(1){k=n+-1|0;if((n|0)<=0){s=2147483647;q=0;n=0;break b}o=B+(b[X+(k<<1)>>1]|0)|0;p=b[ea+(k<<1)>>1]|0;q=ca+k|0;r=V+(k<<1)|0;v=0;while(1){if((v|0)>=(x|0))break;u=da+(v<<1)|0;t=(_(d[q>>0]|0,b[u>>1]|0)|0)>>8;n=(_(y,p-t<<16>>16)|0)>>16;n=(n|0)>9?9:(n|0)<-10?-10:n;a[Y+(v<<4)+k>>0]=n;w=n+10|0;s=(c[$+(w<<2)>>2]|0)+t|0;t=(c[ba+(w<<2)>>2]|0)+t|0;b[u>>1]=s;u=v+x|0;b[da+(u<<1)>>1]=t;do if((n|0)>2)if((n|0)==3){w=d[o+7>>0]|0;n=280;break}else{n=n*43|0;w=n+108|0;n=n+151|0;break}else{if((n|0)>=-3){w=d[o+(n+4)>>0]|0;n=d[o+(n+5)>>0]|0;break}if((n|0)==-4){w=280;n=d[o+1>>0]|0;break}else{n=_(n,-43)|0;w=n+108|0;n=n+65|0;break}}while(0);ha=S+(v<<2)|0;ga=c[ha>>2]|0;ia=p-s<<16>>16;ia=_(ia,ia)|0;s=b[r>>1]|0;c[ha>>2]=ga+(_(ia,s)|0)+(_(N,w<<16>>16)|0);w=p-t<<16>>16;c[S+(u<<2)>>2]=ga+(_(_(w,w)|0,s)|0)+(_(N,n<<16>>16)|0);v=v+1|0}if(m){n=0;break}else t=0;while(1){if((t|0)==4){n=0;r=0;o=0;p=0;q=2147483647;break}p=S+(t<<2)|0;n=c[p>>2]|0;o=t+4|0;q=S+(o<<2)|0;s=c[q>>2]|0;r=T+(t<<2)|0;if((n|0)>(s|0)){c[r>>2]=n;c[p>>2]=s;c[q>>2]=n;ha=da+(t<<1)|0;ia=b[ha>>1]|0;n=da+(o<<1)|0;b[ha>>1]=b[n>>1]|0;b[n>>1]=ia;n=s}else{c[r>>2]=s;o=t}c[U+(t<<2)>>2]=n;c[Z+(t<<2)>>2]=o;t=t+1|0}while(1){if((o|0)<4){ia=c[T+(o<<2)>>2]|0;ha=(q|0)>(ia|0);ga=c[U+(o<<2)>>2]|0;w=(p|0)<(ga|0);n=w?o:n;r=ha?o:r;o=o+1|0;p=w?ga:p;q=ha?ia:q;continue}if((q|0)>=(p|0)){n=0;break}c[Z+(n<<2)>>2]=c[Z+(r<<2)>>2]^4;p=r+4|0;c[S+(n<<2)>>2]=c[S+(p<<2)>>2];b[da+(n<<1)>>1]=b[da+(p<<1)>>1]|0;c[U+(n<<2)>>2]=0;c[T+(r<<2)>>2]=2147483647;p=Y+(n<<4)|0;n=Y+(r<<4)|0;o=p+16|0;do{a[p>>0]=a[n>>0]|0;p=p+1|0;n=n+1|0}while((p|0)<(o|0));n=0;r=0;o=0;p=0;q=2147483647}while(1){if((n|0)==4){n=k;continue c}ia=Y+(n<<4)+k|0;a[ia>>0]=(d[ia>>0]|0)+((c[Z+(n<<2)>>2]|0)>>>2);n=n+1|0}}while(1){if((n|0)>=(x|0)){n=z;break}a[Y+(n+x<<4)+k>>0]=(d[Y+(n<<4)+k>>0]|0)+1;n=n+1|0}while(1){if((n|0)>=4){n=k;x=z;continue b}a[Y+(n<<4)+k>>0]=a[Y+(n-z<<4)+k>>0]|0;n=n+1|0}}while(1){if((n|0)==8)break;ha=c[S+(n<<2)>>2]|0;ia=(s|0)>(ha|0);s=ia?ha:s;q=ia?n:q;n=n+1|0}n=K+D|0;o=q&3;p=0;while(1){if((p|0)>=(A|0))break;a[n+p>>0]=a[Y+(o<<4)+p>>0]|0;p=p+1|0}a[n>>0]=(d[n>>0]|0)+(q>>>2);r=J+(G<<2)|0;c[r>>2]=s;n=_(H,b[h>>1]|0)|0;n=(c[I>>2]|0)+n|0;o=a[n+E>>0]|0;if(!E)n=256-(o&255)|0;else n=(d[n+(E+-1)>>0]|0)-(o&255)|0;q=aa(n|0)|0;o=24-q|0;p=0-o|0;do if(o)if((o|0)<0){n=n<>>(o+32|0);break}else{n=n<<32-o|n>>>o;break}while(0);ia=n&127;c[r>>2]=s+(_(1024-(ia+(((_(ia,128-ia|0)|0)*179|0)>>>16)+(31-q<<7))<<16>>16,F)|0);G=G+1|0}ye(J,W,l,1);ia=c[W>>2]|0;a[f>>0]=c[O+(ia<<2)>>2];rf(f+1|0,K+(ia<<4)|0,b[Q>>1]|0)|0;ie(g,f,h);i=fa;return}function Ee(){Fb(360,33176);Ra(376,33181,1,1,0);jb(384,33186,1,-128,127);jb(400,33191,1,-128,127);jb(392,33203,1,0,255);jb(408,33217,2,-32768,32767);jb(416,33223,2,0,65535);jb(424,33238,4,-2147483648,2147483647);jb(432,33242,4,0,-1);jb(440,33255,4,-2147483648,2147483647);jb(448,33260,4,0,-1);Pb(456,33274,4);Pb(464,33280,8);Ca(48,33388);Ca(80,33463);Ib(104,4,33559);Ua(128,33591);Ab(136,0,33638);Ab(144,0,33699);Ab(152,1,33767);Ab(160,2,33837);Ab(168,3,33899);Ab(176,4,33970);Ab(184,5,34030);Ab(192,4,34099);Ab(200,5,34160);Ab(144,0,34199);Ab(152,1,34231);Ab(160,2,34264);Ab(168,3,34297);Ab(176,4,34331);Ab(184,5,34364);Ab(208,6,34429);Ab(216,7,34491);Ab(224,7,34554);return}function Fe(b){b=b|0;var d=0,e=0,f=0,g=0;g=c[b+4>>2]|0;f=g;a:do if(!(f&3)){b=g;e=4}else{d=g;b=f;while(1){if(!(a[d>>0]|0))break a;d=d+1|0;b=d;if(!(b&3)){b=d;e=4;break}}}while(0);if((e|0)==4){while(1){d=c[b>>2]|0;if(!((d&-2139062144^-2139062144)&d+-16843009))b=b+4|0;else break}if((d&255)<<24>>24)do b=b+1|0;while((a[b>>0]|0)!=0)}b=b-f+1|0;d=He(b)|0;if(!d){g=0;return g|0}rf(d|0,g|0,b|0)|0;g=d;return g|0}function Ge(a){a=+a;var b=0,d=0,e=0,f=0,g=0.0,i=0.0,j=0.0,l=0.0,m=0.0;h[k>>3]=a;d=c[k>>2]|0;b=c[k+4>>2]|0;e=(b|0)<0;do if(e|b>>>0<1048576){g=+N(+a);h[k>>3]=g;if((c[k>>2]|0)==0&(c[k+4>>2]|0)==0){a=-1.0/(a*a);break}if(e){a=(a-a)/0.0;break}else{h[k>>3]=a*18014398509481984.0;b=c[k+4>>2]|0;e=c[k>>2]|0;d=-1077;f=9;break}}else if(b>>>0<=2146435071)if((d|0)==0&0==0&(b|0)==1072693248)a=0.0;else{e=d;d=-1023;f=9}while(0);if((f|0)==9){f=b+614242|0;c[k>>2]=e;c[k+4>>2]=(f&1048575)+1072079006;j=+h[k>>3]+-1.0;i=j*(j*.5);l=j/(j+2.0);m=l*l;a=m*m;h[k>>3]=j-i;e=c[k+4>>2]|0;c[k>>2]=0;c[k+4>>2]=e;g=+h[k>>3];a=j-g-i+l*(i+(a*(a*(a*.15313837699209373+.22222198432149784)+.3999999999940942)+m*(a*(a*(a*.14798198605116586+.1818357216161805)+.2857142874366239)+.6666666666666735)));m=g*.4342944818781689;i=+(d+(f>>>20)|0);l=i*.30102999566361177;j=l+m;a=j+(m+(l-j)+(a*.4342944818781689+(i*3.694239077158931e-13+(g+a)*2.5082946711645275e-11)))}return +a}function He(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0;do if(a>>>0<245){o=a>>>0<11?16:a+11&-8;a=o>>>3;j=c[8744]|0;b=j>>>a;if(b&3|0){b=(b&1^1)+a|0;d=35016+(b<<1<<2)|0;e=d+8|0;f=c[e>>2]|0;g=f+8|0;h=c[g>>2]|0;do if((d|0)!=(h|0)){if(h>>>0<(c[8748]|0)>>>0)vb();a=h+12|0;if((c[a>>2]|0)==(f|0)){c[a>>2]=d;c[e>>2]=h;break}else vb()}else c[8744]=j&~(1<>2]=G|3;G=f+G+4|0;c[G>>2]=c[G>>2]|1;G=g;return G|0}h=c[8746]|0;if(o>>>0>h>>>0){if(b|0){d=2<>>12&16;d=d>>>i;f=d>>>5&8;d=d>>>f;g=d>>>2&4;d=d>>>g;e=d>>>1&2;d=d>>>e;b=d>>>1&1;b=(f|i|g|e|b)+(d>>>b)|0;d=35016+(b<<1<<2)|0;e=d+8|0;g=c[e>>2]|0;i=g+8|0;f=c[i>>2]|0;do if((d|0)!=(f|0)){if(f>>>0<(c[8748]|0)>>>0)vb();a=f+12|0;if((c[a>>2]|0)==(g|0)){c[a>>2]=d;c[e>>2]=f;k=c[8746]|0;break}else vb()}else{c[8744]=j&~(1<>2]=o|3;e=g+o|0;c[e+4>>2]=h|1;c[e+h>>2]=h;if(k|0){f=c[8749]|0;b=k>>>3;d=35016+(b<<1<<2)|0;a=c[8744]|0;b=1<>2]|0;if(b>>>0<(c[8748]|0)>>>0)vb();else{l=a;m=b}}else{c[8744]=a|b;l=d+8|0;m=d}c[l>>2]=f;c[m+12>>2]=f;c[f+8>>2]=m;c[f+12>>2]=d}c[8746]=h;c[8749]=e;G=i;return G|0}a=c[8745]|0;if(a){i=(a&0-a)+-1|0;F=i>>>12&16;i=i>>>F;E=i>>>5&8;i=i>>>E;G=i>>>2&4;i=i>>>G;b=i>>>1&2;i=i>>>b;j=i>>>1&1;j=c[35280+((E|F|G|b|j)+(i>>>j)<<2)>>2]|0;i=(c[j+4>>2]&-8)-o|0;b=j;while(1){a=c[b+16>>2]|0;if(!a){a=c[b+20>>2]|0;if(!a)break}b=(c[a+4>>2]&-8)-o|0;G=b>>>0>>0;i=G?b:i;b=a;j=G?a:j}f=c[8748]|0;if(j>>>0>>0)vb();h=j+o|0;if(j>>>0>=h>>>0)vb();g=c[j+24>>2]|0;d=c[j+12>>2]|0;do if((d|0)==(j|0)){b=j+20|0;a=c[b>>2]|0;if(!a){b=j+16|0;a=c[b>>2]|0;if(!a){n=0;break}}while(1){d=a+20|0;e=c[d>>2]|0;if(e|0){a=e;b=d;continue}d=a+16|0;e=c[d>>2]|0;if(!e)break;else{a=e;b=d}}if(b>>>0>>0)vb();else{c[b>>2]=0;n=a;break}}else{e=c[j+8>>2]|0;if(e>>>0>>0)vb();a=e+12|0;if((c[a>>2]|0)!=(j|0))vb();b=d+8|0;if((c[b>>2]|0)==(j|0)){c[a>>2]=d;c[b>>2]=e;n=d;break}else vb()}while(0);do if(g|0){a=c[j+28>>2]|0;b=35280+(a<<2)|0;if((j|0)==(c[b>>2]|0)){c[b>>2]=n;if(!n){c[8745]=c[8745]&~(1<>>0<(c[8748]|0)>>>0)vb();a=g+16|0;if((c[a>>2]|0)==(j|0))c[a>>2]=n;else c[g+20>>2]=n;if(!n)break}b=c[8748]|0;if(n>>>0>>0)vb();c[n+24>>2]=g;a=c[j+16>>2]|0;do if(a|0)if(a>>>0>>0)vb();else{c[n+16>>2]=a;c[a+24>>2]=n;break}while(0);a=c[j+20>>2]|0;if(a|0)if(a>>>0<(c[8748]|0)>>>0)vb();else{c[n+20>>2]=a;c[a+24>>2]=n;break}}while(0);if(i>>>0<16){G=i+o|0;c[j+4>>2]=G|3;G=j+G+4|0;c[G>>2]=c[G>>2]|1}else{c[j+4>>2]=o|3;c[h+4>>2]=i|1;c[h+i>>2]=i;a=c[8746]|0;if(a|0){e=c[8749]|0;b=a>>>3;d=35016+(b<<1<<2)|0;a=c[8744]|0;b=1<>2]|0;if(b>>>0<(c[8748]|0)>>>0)vb();else{p=a;q=b}}else{c[8744]=a|b;p=d+8|0;q=d}c[p>>2]=e;c[q+12>>2]=e;c[e+8>>2]=q;c[e+12>>2]=d}c[8746]=i;c[8749]=h}G=j+8|0;return G|0}}}else if(a>>>0<=4294967231){a=a+11|0;o=a&-8;k=c[8745]|0;if(k){d=0-o|0;a=a>>>8;if(a)if(o>>>0>16777215)j=31;else{q=(a+1048320|0)>>>16&8;z=a<>>16&4;z=z<>>16&2;j=14-(p|q|j)+(z<>>15)|0;j=o>>>(j+7|0)&1|j<<1}else j=0;b=c[35280+(j<<2)>>2]|0;a:do if(!b){a=0;b=0;z=86}else{f=d;a=0;h=o<<((j|0)==31?0:25-(j>>>1)|0);i=b;b=0;while(1){e=c[i+4>>2]&-8;d=e-o|0;if(d>>>0>>0)if((e|0)==(o|0)){a=i;b=i;z=90;break a}else b=i;else d=f;e=c[i+20>>2]|0;i=c[i+16+(h>>>31<<2)>>2]|0;a=(e|0)==0|(e|0)==(i|0)?a:e;e=(i|0)==0;if(e){z=86;break}else{f=d;h=h<<(e&1^1)}}}while(0);if((z|0)==86){if((a|0)==0&(b|0)==0){a=2<>>12&16;q=q>>>m;l=q>>>5&8;q=q>>>l;n=q>>>2&4;q=q>>>n;p=q>>>1&2;q=q>>>p;a=q>>>1&1;a=c[35280+((l|m|n|p|a)+(q>>>a)<<2)>>2]|0}if(!a){i=d;j=b}else z=90}if((z|0)==90)while(1){z=0;q=(c[a+4>>2]&-8)-o|0;e=q>>>0>>0;d=e?q:d;b=e?a:b;e=c[a+16>>2]|0;if(e|0){a=e;z=90;continue}a=c[a+20>>2]|0;if(!a){i=d;j=b;break}else z=90}if((j|0)!=0?i>>>0<((c[8746]|0)-o|0)>>>0:0){f=c[8748]|0;if(j>>>0>>0)vb();h=j+o|0;if(j>>>0>=h>>>0)vb();g=c[j+24>>2]|0;d=c[j+12>>2]|0;do if((d|0)==(j|0)){b=j+20|0;a=c[b>>2]|0;if(!a){b=j+16|0;a=c[b>>2]|0;if(!a){s=0;break}}while(1){d=a+20|0;e=c[d>>2]|0;if(e|0){a=e;b=d;continue}d=a+16|0;e=c[d>>2]|0;if(!e)break;else{a=e;b=d}}if(b>>>0>>0)vb();else{c[b>>2]=0;s=a;break}}else{e=c[j+8>>2]|0;if(e>>>0>>0)vb();a=e+12|0;if((c[a>>2]|0)!=(j|0))vb();b=d+8|0;if((c[b>>2]|0)==(j|0)){c[a>>2]=d;c[b>>2]=e;s=d;break}else vb()}while(0);do if(g|0){a=c[j+28>>2]|0;b=35280+(a<<2)|0;if((j|0)==(c[b>>2]|0)){c[b>>2]=s;if(!s){c[8745]=c[8745]&~(1<>>0<(c[8748]|0)>>>0)vb();a=g+16|0;if((c[a>>2]|0)==(j|0))c[a>>2]=s;else c[g+20>>2]=s;if(!s)break}b=c[8748]|0;if(s>>>0>>0)vb();c[s+24>>2]=g;a=c[j+16>>2]|0;do if(a|0)if(a>>>0>>0)vb();else{c[s+16>>2]=a;c[a+24>>2]=s;break}while(0);a=c[j+20>>2]|0;if(a|0)if(a>>>0<(c[8748]|0)>>>0)vb();else{c[s+20>>2]=a;c[a+24>>2]=s;break}}while(0);do if(i>>>0>=16){c[j+4>>2]=o|3;c[h+4>>2]=i|1;c[h+i>>2]=i;a=i>>>3;if(i>>>0<256){d=35016+(a<<1<<2)|0;b=c[8744]|0;a=1<>2]|0;if(b>>>0<(c[8748]|0)>>>0)vb();else{t=a;v=b}}else{c[8744]=b|a;t=d+8|0;v=d}c[t>>2]=h;c[v+12>>2]=h;c[h+8>>2]=v;c[h+12>>2]=d;break}a=i>>>8;if(a)if(i>>>0>16777215)d=31;else{F=(a+1048320|0)>>>16&8;G=a<>>16&4;G=G<>>16&2;d=14-(E|F|d)+(G<>>15)|0;d=i>>>(d+7|0)&1|d<<1}else d=0;e=35280+(d<<2)|0;c[h+28>>2]=d;a=h+16|0;c[a+4>>2]=0;c[a>>2]=0;a=c[8745]|0;b=1<>2]=h;c[h+24>>2]=e;c[h+12>>2]=h;c[h+8>>2]=h;break}d=i<<((d|0)==31?0:25-(d>>>1)|0);e=c[e>>2]|0;while(1){if((c[e+4>>2]&-8|0)==(i|0)){z=148;break}b=e+16+(d>>>31<<2)|0;a=c[b>>2]|0;if(!a){z=145;break}else{d=d<<1;e=a}}if((z|0)==145)if(b>>>0<(c[8748]|0)>>>0)vb();else{c[b>>2]=h;c[h+24>>2]=e;c[h+12>>2]=h;c[h+8>>2]=h;break}else if((z|0)==148){a=e+8|0;b=c[a>>2]|0;G=c[8748]|0;if(b>>>0>=G>>>0&e>>>0>=G>>>0){c[b+12>>2]=h;c[a>>2]=h;c[h+8>>2]=b;c[h+12>>2]=e;c[h+24>>2]=0;break}else vb()}}else{G=i+o|0;c[j+4>>2]=G|3;G=j+G+4|0;c[G>>2]=c[G>>2]|1}while(0);G=j+8|0;return G|0}}}else o=-1;while(0);d=c[8746]|0;if(d>>>0>=o>>>0){a=d-o|0;b=c[8749]|0;if(a>>>0>15){G=b+o|0;c[8749]=G;c[8746]=a;c[G+4>>2]=a|1;c[G+a>>2]=a;c[b+4>>2]=o|3}else{c[8746]=0;c[8749]=0;c[b+4>>2]=d|3;G=b+d+4|0;c[G>>2]=c[G>>2]|1}G=b+8|0;return G|0}a=c[8747]|0;if(a>>>0>o>>>0){E=a-o|0;c[8747]=E;G=c[8750]|0;F=G+o|0;c[8750]=F;c[F+4>>2]=E|1;c[G+4>>2]=o|3;G=G+8|0;return G|0}do if(!(c[8862]|0)){a=Aa(30)|0;if(!(a+-1&a)){c[8864]=a;c[8863]=a;c[8865]=-1;c[8866]=-1;c[8867]=0;c[8855]=0;c[8862]=(ab(0)|0)&-16^1431655768;break}else vb()}while(0);h=o+48|0;e=c[8864]|0;i=o+47|0;d=e+i|0;e=0-e|0;j=d&e;if(j>>>0<=o>>>0){G=0;return G|0}a=c[8854]|0;if(a|0?(t=c[8852]|0,v=t+j|0,v>>>0<=t>>>0|v>>>0>a>>>0):0){G=0;return G|0}b:do if(!(c[8855]&4)){b=c[8750]|0;c:do if(b){f=35424;while(1){a=c[f>>2]|0;if(a>>>0<=b>>>0?(r=f+4|0,(a+(c[r>>2]|0)|0)>>>0>b>>>0):0)break;a=c[f+8>>2]|0;if(!a){z=173;break c}else f=a}a=d-(c[8747]|0)&e;if(a>>>0<2147483647){b=xa(a|0)|0;if((b|0)==((c[f>>2]|0)+(c[r>>2]|0)|0)){if((b|0)!=(-1|0)){h=b;g=a;z=193;break b}}else z=183}}else z=173;while(0);do if((z|0)==173?(u=xa(0)|0,(u|0)!=(-1|0)):0){a=u;b=c[8863]|0;d=b+-1|0;if(!(d&a))a=j;else a=j-a+(d+a&0-b)|0;b=c[8852]|0;d=b+a|0;if(a>>>0>o>>>0&a>>>0<2147483647){v=c[8854]|0;if(v|0?d>>>0<=b>>>0|d>>>0>v>>>0:0)break;b=xa(a|0)|0;if((b|0)==(u|0)){h=u;g=a;z=193;break b}else z=183}}while(0);d:do if((z|0)==183){d=0-a|0;do if(h>>>0>a>>>0&(a>>>0<2147483647&(b|0)!=(-1|0))?(w=c[8864]|0,w=i-a+w&0-w,w>>>0<2147483647):0)if((xa(w|0)|0)==(-1|0)){xa(d|0)|0;break d}else{a=w+a|0;break}while(0);if((b|0)!=(-1|0)){h=b;g=a;z=193;break b}}while(0);c[8855]=c[8855]|4;z=190}else z=190;while(0);if((((z|0)==190?j>>>0<2147483647:0)?(x=xa(j|0)|0,y=xa(0)|0,x>>>0>>0&((x|0)!=(-1|0)&(y|0)!=(-1|0))):0)?(g=y-x|0,g>>>0>(o+40|0)>>>0):0){h=x;z=193}if((z|0)==193){a=(c[8852]|0)+g|0;c[8852]=a;if(a>>>0>(c[8853]|0)>>>0)c[8853]=a;k=c[8750]|0;do if(k){f=35424;while(1){a=c[f>>2]|0;b=f+4|0;d=c[b>>2]|0;if((h|0)==(a+d|0)){z=203;break}e=c[f+8>>2]|0;if(!e)break;else f=e}if(((z|0)==203?(c[f+12>>2]&8|0)==0:0)?k>>>0>>0&k>>>0>=a>>>0:0){c[b>>2]=d+g;G=k+8|0;G=(G&7|0)==0?0:0-G&7;F=k+G|0;G=g-G+(c[8747]|0)|0;c[8750]=F;c[8747]=G;c[F+4>>2]=G|1;c[F+G+4>>2]=40;c[8751]=c[8866];break}a=c[8748]|0;if(h>>>0>>0){c[8748]=h;i=h}else i=a;b=h+g|0;a=35424;while(1){if((c[a>>2]|0)==(b|0)){z=211;break}a=c[a+8>>2]|0;if(!a){b=35424;break}}if((z|0)==211)if(!(c[a+12>>2]&8)){c[a>>2]=h;m=a+4|0;c[m>>2]=(c[m>>2]|0)+g;m=h+8|0;m=h+((m&7|0)==0?0:0-m&7)|0;a=b+8|0;a=b+((a&7|0)==0?0:0-a&7)|0;l=m+o|0;j=a-m-o|0;c[m+4>>2]=o|3;do if((a|0)!=(k|0)){if((a|0)==(c[8749]|0)){G=(c[8746]|0)+j|0;c[8746]=G;c[8749]=l;c[l+4>>2]=G|1;c[l+G>>2]=G;break}b=c[a+4>>2]|0;if((b&3|0)==1){h=b&-8;f=b>>>3;e:do if(b>>>0>=256){g=c[a+24>>2]|0;e=c[a+12>>2]|0;do if((e|0)==(a|0)){e=a+16|0;d=e+4|0;b=c[d>>2]|0;if(!b){b=c[e>>2]|0;if(!b){E=0;break}else d=e}while(1){e=b+20|0;f=c[e>>2]|0;if(f|0){b=f;d=e;continue}e=b+16|0;f=c[e>>2]|0;if(!f)break;else{b=f;d=e}}if(d>>>0>>0)vb();else{c[d>>2]=0;E=b;break}}else{f=c[a+8>>2]|0;if(f>>>0>>0)vb();b=f+12|0;if((c[b>>2]|0)!=(a|0))vb();d=e+8|0;if((c[d>>2]|0)==(a|0)){c[b>>2]=e;c[d>>2]=f;E=e;break}else vb()}while(0);if(!g)break;b=c[a+28>>2]|0;d=35280+(b<<2)|0;do if((a|0)!=(c[d>>2]|0)){if(g>>>0<(c[8748]|0)>>>0)vb();b=g+16|0;if((c[b>>2]|0)==(a|0))c[b>>2]=E;else c[g+20>>2]=E;if(!E)break e}else{c[d>>2]=E;if(E|0)break;c[8745]=c[8745]&~(1<>>0>>0)vb();c[E+24>>2]=g;b=a+16|0;d=c[b>>2]|0;do if(d|0)if(d>>>0>>0)vb();else{c[E+16>>2]=d;c[d+24>>2]=E;break}while(0);b=c[b+4>>2]|0;if(!b)break;if(b>>>0<(c[8748]|0)>>>0)vb();else{c[E+20>>2]=b;c[b+24>>2]=E;break}}else{d=c[a+8>>2]|0;e=c[a+12>>2]|0;b=35016+(f<<1<<2)|0;do if((d|0)!=(b|0)){if(d>>>0>>0)vb();if((c[d+12>>2]|0)==(a|0))break;vb()}while(0);if((e|0)==(d|0)){c[8744]=c[8744]&~(1<>>0>>0)vb();b=e+8|0;if((c[b>>2]|0)==(a|0)){B=b;break}vb()}while(0);c[d+12>>2]=e;c[B>>2]=d}while(0);a=a+h|0;f=h+j|0}else f=j;a=a+4|0;c[a>>2]=c[a>>2]&-2;c[l+4>>2]=f|1;c[l+f>>2]=f;a=f>>>3;if(f>>>0<256){d=35016+(a<<1<<2)|0;b=c[8744]|0;a=1<>2]|0;if(b>>>0>=(c[8748]|0)>>>0){F=a;G=b;break}vb()}while(0);c[F>>2]=l;c[G+12>>2]=l;c[l+8>>2]=G;c[l+12>>2]=d;break}a=f>>>8;do if(!a)d=0;else{if(f>>>0>16777215){d=31;break}F=(a+1048320|0)>>>16&8;G=a<>>16&4;G=G<>>16&2;d=14-(E|F|d)+(G<>>15)|0;d=f>>>(d+7|0)&1|d<<1}while(0);e=35280+(d<<2)|0;c[l+28>>2]=d;a=l+16|0;c[a+4>>2]=0;c[a>>2]=0;a=c[8745]|0;b=1<>2]=l;c[l+24>>2]=e;c[l+12>>2]=l;c[l+8>>2]=l;break}d=f<<((d|0)==31?0:25-(d>>>1)|0);e=c[e>>2]|0;while(1){if((c[e+4>>2]&-8|0)==(f|0)){z=281;break}b=e+16+(d>>>31<<2)|0;a=c[b>>2]|0;if(!a){z=278;break}else{d=d<<1;e=a}}if((z|0)==278)if(b>>>0<(c[8748]|0)>>>0)vb();else{c[b>>2]=l;c[l+24>>2]=e;c[l+12>>2]=l;c[l+8>>2]=l;break}else if((z|0)==281){a=e+8|0;b=c[a>>2]|0;G=c[8748]|0;if(b>>>0>=G>>>0&e>>>0>=G>>>0){c[b+12>>2]=l;c[a>>2]=l;c[l+8>>2]=b;c[l+12>>2]=e;c[l+24>>2]=0;break}else vb()}}else{G=(c[8747]|0)+j|0;c[8747]=G;c[8750]=l;c[l+4>>2]=G|1}while(0);G=m+8|0;return G|0}else b=35424;while(1){a=c[b>>2]|0;if(a>>>0<=k>>>0?(A=a+(c[b+4>>2]|0)|0,A>>>0>k>>>0):0)break;b=c[b+8>>2]|0}f=A+-47|0;b=f+8|0;b=f+((b&7|0)==0?0:0-b&7)|0;f=k+16|0;b=b>>>0>>0?k:b;a=b+8|0;d=h+8|0;d=(d&7|0)==0?0:0-d&7;G=h+d|0;d=g+-40-d|0;c[8750]=G;c[8747]=d;c[G+4>>2]=d|1;c[G+d+4>>2]=40;c[8751]=c[8866];d=b+4|0;c[d>>2]=27;c[a>>2]=c[8856];c[a+4>>2]=c[8857];c[a+8>>2]=c[8858];c[a+12>>2]=c[8859];c[8856]=h;c[8857]=g;c[8859]=0;c[8858]=a;a=b+24|0;do{a=a+4|0;c[a>>2]=7}while((a+4|0)>>>0>>0);if((b|0)!=(k|0)){g=b-k|0;c[d>>2]=c[d>>2]&-2;c[k+4>>2]=g|1;c[b>>2]=g;a=g>>>3;if(g>>>0<256){d=35016+(a<<1<<2)|0;b=c[8744]|0;a=1<>2]|0;if(b>>>0<(c[8748]|0)>>>0)vb();else{C=a;D=b}}else{c[8744]=b|a;C=d+8|0;D=d}c[C>>2]=k;c[D+12>>2]=k;c[k+8>>2]=D;c[k+12>>2]=d;break}a=g>>>8;if(a)if(g>>>0>16777215)d=31;else{F=(a+1048320|0)>>>16&8;G=a<>>16&4;G=G<>>16&2;d=14-(E|F|d)+(G<>>15)|0;d=g>>>(d+7|0)&1|d<<1}else d=0;e=35280+(d<<2)|0;c[k+28>>2]=d;c[k+20>>2]=0;c[f>>2]=0;a=c[8745]|0;b=1<>2]=k;c[k+24>>2]=e;c[k+12>>2]=k;c[k+8>>2]=k;break}d=g<<((d|0)==31?0:25-(d>>>1)|0);e=c[e>>2]|0;while(1){if((c[e+4>>2]&-8|0)==(g|0)){z=307;break}b=e+16+(d>>>31<<2)|0;a=c[b>>2]|0;if(!a){z=304;break}else{d=d<<1;e=a}}if((z|0)==304)if(b>>>0<(c[8748]|0)>>>0)vb();else{c[b>>2]=k;c[k+24>>2]=e;c[k+12>>2]=k;c[k+8>>2]=k;break}else if((z|0)==307){a=e+8|0;b=c[a>>2]|0;G=c[8748]|0;if(b>>>0>=G>>>0&e>>>0>=G>>>0){c[b+12>>2]=k;c[a>>2]=k;c[k+8>>2]=b;c[k+12>>2]=e;c[k+24>>2]=0;break}else vb()}}}else{G=c[8748]|0;if((G|0)==0|h>>>0>>0)c[8748]=h;c[8856]=h;c[8857]=g;c[8859]=0;c[8753]=c[8862];c[8752]=-1;a=0;do{G=35016+(a<<1<<2)|0;c[G+12>>2]=G;c[G+8>>2]=G;a=a+1|0}while((a|0)!=32);G=h+8|0;G=(G&7|0)==0?0:0-G&7;F=h+G|0;G=g+-40-G|0;c[8750]=F;c[8747]=G;c[F+4>>2]=G|1;c[F+G+4>>2]=40;c[8751]=c[8866]}while(0);a=c[8747]|0;if(a>>>0>o>>>0){E=a-o|0;c[8747]=E;G=c[8750]|0;F=G+o|0;c[8750]=F;c[F+4>>2]=E|1;c[G+4>>2]=o|3;G=G+8|0;return G|0}}if(!(c[8732]|0))a=34972;else a=c[(Mb()|0)+64>>2]|0;c[a>>2]=12;G=0;return G|0}function Ie(a){a=a|0;var b=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;if(!a)return;d=a+-8|0;h=c[8748]|0;if(d>>>0>>0)vb();a=c[a+-4>>2]|0;b=a&3;if((b|0)==1)vb();e=a&-8;m=d+e|0;do if(!(a&1)){a=c[d>>2]|0;if(!b)return;k=d+(0-a)|0;j=a+e|0;if(k>>>0>>0)vb();if((k|0)==(c[8749]|0)){a=m+4|0;b=c[a>>2]|0;if((b&3|0)!=3){q=k;f=j;break}c[8746]=j;c[a>>2]=b&-2;c[k+4>>2]=j|1;c[k+j>>2]=j;return}e=a>>>3;if(a>>>0<256){b=c[k+8>>2]|0;d=c[k+12>>2]|0;a=35016+(e<<1<<2)|0;if((b|0)!=(a|0)){if(b>>>0>>0)vb();if((c[b+12>>2]|0)!=(k|0))vb()}if((d|0)==(b|0)){c[8744]=c[8744]&~(1<>>0>>0)vb();a=d+8|0;if((c[a>>2]|0)==(k|0))g=a;else vb()}else g=d+8|0;c[b+12>>2]=d;c[g>>2]=b;q=k;f=j;break}g=c[k+24>>2]|0;d=c[k+12>>2]|0;do if((d|0)==(k|0)){d=k+16|0;b=d+4|0;a=c[b>>2]|0;if(!a){a=c[d>>2]|0;if(!a){i=0;break}else b=d}while(1){d=a+20|0;e=c[d>>2]|0;if(e|0){a=e;b=d;continue}d=a+16|0;e=c[d>>2]|0;if(!e)break;else{a=e;b=d}}if(b>>>0>>0)vb();else{c[b>>2]=0;i=a;break}}else{e=c[k+8>>2]|0;if(e>>>0>>0)vb();a=e+12|0;if((c[a>>2]|0)!=(k|0))vb();b=d+8|0;if((c[b>>2]|0)==(k|0)){c[a>>2]=d;c[b>>2]=e;i=d;break}else vb()}while(0);if(g){a=c[k+28>>2]|0;b=35280+(a<<2)|0;if((k|0)==(c[b>>2]|0)){c[b>>2]=i;if(!i){c[8745]=c[8745]&~(1<>>0<(c[8748]|0)>>>0)vb();a=g+16|0;if((c[a>>2]|0)==(k|0))c[a>>2]=i;else c[g+20>>2]=i;if(!i){q=k;f=j;break}}d=c[8748]|0;if(i>>>0>>0)vb();c[i+24>>2]=g;a=k+16|0;b=c[a>>2]|0;do if(b|0)if(b>>>0>>0)vb();else{c[i+16>>2]=b;c[b+24>>2]=i;break}while(0);a=c[a+4>>2]|0;if(a)if(a>>>0<(c[8748]|0)>>>0)vb();else{c[i+20>>2]=a;c[a+24>>2]=i;q=k;f=j;break}else{q=k;f=j}}else{q=k;f=j}}else{q=d;f=e}while(0);if(q>>>0>=m>>>0)vb();a=m+4|0;b=c[a>>2]|0;if(!(b&1))vb();if(!(b&2)){if((m|0)==(c[8750]|0)){p=(c[8747]|0)+f|0;c[8747]=p;c[8750]=q;c[q+4>>2]=p|1;if((q|0)!=(c[8749]|0))return;c[8749]=0;c[8746]=0;return}if((m|0)==(c[8749]|0)){p=(c[8746]|0)+f|0;c[8746]=p;c[8749]=q;c[q+4>>2]=p|1;c[q+p>>2]=p;return}f=(b&-8)+f|0;e=b>>>3;do if(b>>>0>=256){g=c[m+24>>2]|0;a=c[m+12>>2]|0;do if((a|0)==(m|0)){d=m+16|0;b=d+4|0;a=c[b>>2]|0;if(!a){a=c[d>>2]|0;if(!a){n=0;break}else b=d}while(1){d=a+20|0;e=c[d>>2]|0;if(e|0){a=e;b=d;continue}d=a+16|0;e=c[d>>2]|0;if(!e)break;else{a=e;b=d}}if(b>>>0<(c[8748]|0)>>>0)vb();else{c[b>>2]=0;n=a;break}}else{b=c[m+8>>2]|0;if(b>>>0<(c[8748]|0)>>>0)vb();d=b+12|0;if((c[d>>2]|0)!=(m|0))vb();e=a+8|0;if((c[e>>2]|0)==(m|0)){c[d>>2]=a;c[e>>2]=b;n=a;break}else vb()}while(0);if(g|0){a=c[m+28>>2]|0;b=35280+(a<<2)|0;if((m|0)==(c[b>>2]|0)){c[b>>2]=n;if(!n){c[8745]=c[8745]&~(1<>>0<(c[8748]|0)>>>0)vb();a=g+16|0;if((c[a>>2]|0)==(m|0))c[a>>2]=n;else c[g+20>>2]=n;if(!n)break}d=c[8748]|0;if(n>>>0>>0)vb();c[n+24>>2]=g;a=m+16|0;b=c[a>>2]|0;do if(b|0)if(b>>>0>>0)vb();else{c[n+16>>2]=b;c[b+24>>2]=n;break}while(0);a=c[a+4>>2]|0;if(a|0)if(a>>>0<(c[8748]|0)>>>0)vb();else{c[n+20>>2]=a;c[a+24>>2]=n;break}}}else{b=c[m+8>>2]|0;d=c[m+12>>2]|0;a=35016+(e<<1<<2)|0;if((b|0)!=(a|0)){if(b>>>0<(c[8748]|0)>>>0)vb();if((c[b+12>>2]|0)!=(m|0))vb()}if((d|0)==(b|0)){c[8744]=c[8744]&~(1<>>0<(c[8748]|0)>>>0)vb();a=d+8|0;if((c[a>>2]|0)==(m|0))l=a;else vb()}else l=d+8|0;c[b+12>>2]=d;c[l>>2]=b}while(0);c[q+4>>2]=f|1;c[q+f>>2]=f;if((q|0)==(c[8749]|0)){c[8746]=f;return}}else{c[a>>2]=b&-2;c[q+4>>2]=f|1;c[q+f>>2]=f}a=f>>>3;if(f>>>0<256){d=35016+(a<<1<<2)|0;b=c[8744]|0;a=1<>2]|0;if(b>>>0<(c[8748]|0)>>>0)vb();else{o=a;p=b}}else{c[8744]=b|a;o=d+8|0;p=d}c[o>>2]=q;c[p+12>>2]=q;c[q+8>>2]=p;c[q+12>>2]=d;return}a=f>>>8;if(a)if(f>>>0>16777215)d=31;else{o=(a+1048320|0)>>>16&8;p=a<>>16&4;p=p<>>16&2;d=14-(n|o|d)+(p<>>15)|0;d=f>>>(d+7|0)&1|d<<1}else d=0;e=35280+(d<<2)|0;c[q+28>>2]=d;c[q+20>>2]=0;c[q+16>>2]=0;a=c[8745]|0;b=1<>>1)|0);e=c[e>>2]|0;while(1){if((c[e+4>>2]&-8|0)==(f|0)){a=130;break}b=e+16+(d>>>31<<2)|0;a=c[b>>2]|0;if(!a){a=127;break}else{d=d<<1;e=a}}if((a|0)==127)if(b>>>0<(c[8748]|0)>>>0)vb();else{c[b>>2]=q;c[q+24>>2]=e;c[q+12>>2]=q;c[q+8>>2]=q;break}else if((a|0)==130){a=e+8|0;b=c[a>>2]|0;p=c[8748]|0;if(b>>>0>=p>>>0&e>>>0>=p>>>0){c[b+12>>2]=q;c[a>>2]=q;c[q+8>>2]=b;c[q+12>>2]=e;c[q+24>>2]=0;break}else vb()}}else{c[8745]=a|b;c[e>>2]=q;c[q+24>>2]=e;c[q+12>>2]=q;c[q+8>>2]=q}while(0);q=(c[8752]|0)+-1|0;c[8752]=q;if(!q)a=35432;else return;while(1){a=c[a>>2]|0;if(!a)break;else a=a+8|0}c[8752]=-1;return}function Je(a){a=a|0;return}function Ke(a){a=a|0;Ie(a);return}function Le(a){a=a|0;return}function Me(a){a=a|0;return}function Ne(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0;h=i;i=i+64|0;g=h;if((a|0)!=(b|0))if((b|0)!=0?(f=Oe(b,240)|0,(f|0)!=0):0){b=g;e=b+56|0;do{c[b>>2]=0;b=b+4|0}while((b|0)<(e|0));c[g>>2]=f;c[g+8>>2]=a;c[g+12>>2]=-1;c[g+48>>2]=1;fc[c[(c[f>>2]|0)+28>>2]&3](f,g,c[d>>2]|0,1);if((c[g+24>>2]|0)==1){c[d>>2]=c[g+16>>2];b=1}else b=0}else b=0;else b=1;i=h;return b|0}function Oe(d,e){d=d|0;e=e|0;var f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0;s=i;i=i+64|0;r=s;q=c[d>>2]|0;p=d+(c[q+-8>>2]|0)|0;q=c[q+-4>>2]|0;c[r>>2]=e;c[r+4>>2]=d;c[r+8>>2]=272;l=r+12|0;m=r+16|0;d=r+20|0;f=r+24|0;g=r+28|0;h=r+32|0;j=r+40|0;k=(q|0)==(e|0);n=l;o=n+40|0;do{c[n>>2]=0;n=n+4|0}while((n|0)<(o|0));b[l+40>>1]=0;a[l+42>>0]=0;a:do if(k){c[r+48>>2]=1;dc[c[(c[e>>2]|0)+20>>2]&3](e,r,p,p,1,0);d=(c[f>>2]|0)==1?p:0}else{Yb[c[(c[q>>2]|0)+24>>2]&3](q,r,p,1,0);switch(c[r+36>>2]|0){case 0:{d=(c[j>>2]|0)==1&(c[g>>2]|0)==1&(c[h>>2]|0)==1?c[d>>2]|0:0;break a}case 1:break;default:{d=0;break a}}if((c[f>>2]|0)!=1?!((c[j>>2]|0)==0&(c[g>>2]|0)==1&(c[h>>2]|0)==1):0){d=0;break}d=c[m>>2]|0}while(0);i=s;return d|0}function Pe(a,b,d,e,f,g){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;if((a|0)==(c[b+8>>2]|0))Qe(b,d,e,f);else{a=c[a+8>>2]|0;dc[c[(c[a>>2]|0)+20>>2]&3](a,b,d,e,f,g)}return}function Qe(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var g=0;a[b+53>>0]=1;do if((c[b+4>>2]|0)==(e|0)){a[b+52>>0]=1;e=b+16|0;g=c[e>>2]|0;if(!g){c[e>>2]=d;c[b+24>>2]=f;c[b+36>>2]=1;if(!((f|0)==1?(c[b+48>>2]|0)==1:0))break;a[b+54>>0]=1;break}if((g|0)!=(d|0)){f=b+36|0;c[f>>2]=(c[f>>2]|0)+1;a[b+54>>0]=1;break}g=b+24|0;e=c[g>>2]|0;if((e|0)==2){c[g>>2]=f;e=f}if((e|0)==1?(c[b+48>>2]|0)==1:0)a[b+54>>0]=1}while(0);return}function Re(b,d,e,f,g){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0;do if((b|0)==(c[d+8>>2]|0)){if((c[d+4>>2]|0)==(e|0)?(h=d+28|0,(c[h>>2]|0)!=1):0)c[h>>2]=f}else{if((b|0)!=(c[d>>2]|0)){j=c[b+8>>2]|0;Yb[c[(c[j>>2]|0)+24>>2]&3](j,d,e,f,g);break}if((c[d+16>>2]|0)!=(e|0)?(j=d+20|0,(c[j>>2]|0)!=(e|0)):0){c[d+32>>2]=f;i=d+44|0;if((c[i>>2]|0)==4)break;h=d+52|0;a[h>>0]=0;f=d+53|0;a[f>>0]=0;b=c[b+8>>2]|0;dc[c[(c[b>>2]|0)+20>>2]&3](b,d,e,e,1,g);if(a[f>>0]|0)if(!(a[h>>0]|0)){h=1;f=13}else f=17;else{h=0;f=13}do if((f|0)==13){c[j>>2]=e;e=d+40|0;c[e>>2]=(c[e>>2]|0)+1;if((c[d+36>>2]|0)==1?(c[d+24>>2]|0)==2:0){a[d+54>>0]=1;if(h){f=17;break}else{h=4;break}}if(h)f=17;else h=4}while(0);if((f|0)==17)h=3;c[i>>2]=h;break}if((f|0)==1)c[d+32>>2]=1}while(0);return}function Se(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var g=0;do if((b|0)==(c[d+8>>2]|0)){b=d+16|0;g=c[b>>2]|0;if(!g){c[b>>2]=e;c[d+24>>2]=f;c[d+36>>2]=1;break}if((g|0)!=(e|0)){f=d+36|0;c[f>>2]=(c[f>>2]|0)+1;c[d+24>>2]=2;a[d+54>>0]=1;break}b=d+24|0;if((c[b>>2]|0)==2)c[b>>2]=f}else{g=c[b+8>>2]|0;fc[c[(c[g>>2]|0)+28>>2]&3](g,d,e,f)}while(0);return}function Te(a){a=a|0;Ie(a);return}function Ue(a,b,d,e,f,g){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;if((a|0)==(c[b+8>>2]|0))Qe(b,d,e,f);return}function Ve(b,d,e,f,g){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,i=0;do if((b|0)==(c[d+8>>2]|0)){if((c[d+4>>2]|0)==(e|0)?(i=d+28|0,(c[i>>2]|0)!=1):0)c[i>>2]=f}else if((b|0)==(c[d>>2]|0)){if((c[d+16>>2]|0)!=(e|0)?(h=d+20|0,(c[h>>2]|0)!=(e|0)):0){c[d+32>>2]=f;c[h>>2]=e;g=d+40|0;c[g>>2]=(c[g>>2]|0)+1;if((c[d+36>>2]|0)==1?(c[d+24>>2]|0)==2:0)a[d+54>>0]=1;c[d+44>>2]=4;break}if((f|0)==1)c[d+32>>2]=1}while(0);return}function We(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var g=0;do if((b|0)==(c[d+8>>2]|0)){b=d+16|0;g=c[b>>2]|0;if(!g){c[b>>2]=e;c[d+24>>2]=f;c[d+36>>2]=1;break}if((g|0)!=(e|0)){f=d+36|0;c[f>>2]=(c[f>>2]|0)+1;c[d+24>>2]=2;a[d+54>>0]=1;break}b=d+24|0;if((c[b>>2]|0)==2)c[b>>2]=f}while(0);return}function Xe(a){a=a|0;return}function Ye(a){a=a|0;Ie(a);return}function Ze(a){a=a|0;return 34734}function _e(a){a=a|0;Ie(a);return}function $e(a,b,c){a=a|0;b=b|0;c=c|0;return (a|0)==(b|0)|0}function af(a){a=a|0;Ie(a);return}function bf(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0,k=0;k=i;i=i+64|0;j=k;c[d>>2]=c[c[d>>2]>>2];if(!((a|0)==(b|0)|(b|0)==368))if(((b|0)!=0?(e=Oe(b,328)|0,(e|0)!=0):0)?(c[e+8>>2]&~c[a+8>>2]|0)==0:0){b=c[a+12>>2]|0;a=e+12|0;if(!((b|0)==360?1:(b|0)==(c[a>>2]|0)))if((((b|0)!=0?(g=Oe(b,240)|0,(g|0)!=0):0)?(f=c[a>>2]|0,(f|0)!=0):0)?(h=Oe(f,240)|0,(h|0)!=0):0){a=j;b=a+56|0;do{c[a>>2]=0;a=a+4|0}while((a|0)<(b|0));c[j>>2]=h;c[j+8>>2]=g;c[j+12>>2]=-1;c[j+48>>2]=1;fc[c[(c[h>>2]|0)+28>>2]&3](h,j,c[d>>2]|0,1);if((c[j+24>>2]|0)==1){c[d>>2]=c[j+16>>2];a=1}else a=0}else a=0;else a=1}else a=0;else a=1;i=k;return a|0}function cf(a){a=a|0;Ie(a);return}function df(d,e,f,g,h,i){d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;var j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0;if((d|0)==(c[e+8>>2]|0))Qe(e,f,g,h);else{o=e+52|0;r=b[o>>1]|0;p=r&255;q=e+53|0;r=(r&65535)>>>8&255;n=c[d+12>>2]|0;k=d+16+(n<<3)|0;a[o>>0]=0;a[q>>0]=0;ef(d+16|0,e,f,g,h,i);a:do if((n|0)>1){l=e+24|0;m=d+8|0;n=e+54|0;j=d+24|0;do{if(a[n>>0]|0)break a;d=b[o>>1]|0;if(!((d&255)<<24>>24)){if((d&65535)>=256?(c[m>>2]&1|0)==0:0)break a}else{if((c[l>>2]|0)==1)break a;if(!(c[m>>2]&2))break a}a[o>>0]=0;a[q>>0]=0;ef(j,e,f,g,h,i);j=j+8|0}while(j>>>0>>0)}while(0);a[o>>0]=p;a[q>>0]=r}return}function ef(a,b,d,e,f,g){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,i=0;i=c[a+4>>2]|0;h=i>>8;if(i&1)h=c[(c[e>>2]|0)+h>>2]|0;a=c[a>>2]|0;dc[c[(c[a>>2]|0)+20>>2]&3](a,b,d,e+h|0,i&2|0?f:2,g);return}function ff(b,d,e,f,g){b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;a:do if((b|0)==(c[d+8>>2]|0)){if((c[d+4>>2]|0)==(e|0)?(h=d+28|0,(c[h>>2]|0)!=1):0)c[h>>2]=f}else{if((b|0)!=(c[d>>2]|0)){q=c[b+12>>2]|0;j=b+16+(q<<3)|0;gf(b+16|0,d,e,f,g);h=b+24|0;if((q|0)<=1)break;b=c[b+8>>2]|0;if((b&2|0)==0?(k=d+36|0,(c[k>>2]|0)!=1):0){if(!(b&1)){b=d+54|0;while(1){if(a[b>>0]|0)break a;if((c[k>>2]|0)==1)break a;gf(h,d,e,f,g);h=h+8|0;if(h>>>0>=j>>>0)break a}}b=d+24|0;i=d+54|0;while(1){if(a[i>>0]|0)break a;if((c[k>>2]|0)==1?(c[b>>2]|0)==1:0)break a;gf(h,d,e,f,g);h=h+8|0;if(h>>>0>=j>>>0)break a}}b=d+54|0;while(1){if(a[b>>0]|0)break a;gf(h,d,e,f,g);h=h+8|0;if(h>>>0>=j>>>0)break a}}if((c[d+16>>2]|0)!=(e|0)?(q=d+20|0,(c[q>>2]|0)!=(e|0)):0){c[d+32>>2]=f;p=d+44|0;if((c[p>>2]|0)==4)break;j=b+16+(c[b+12>>2]<<3)|0;k=d+52|0;f=d+53|0;n=d+54|0;l=b+8|0;o=d+24|0;m=0;h=0;i=b+16|0;b:while(1){if(i>>>0>=j>>>0){b=20;break}a[k>>0]=0;a[f>>0]=0;ef(i,d,e,e,1,g);if(a[n>>0]|0){b=20;break}do if(a[f>>0]|0){if(!(a[k>>0]|0))if(!(c[l>>2]&1)){h=1;b=20;break b}else{b=m;h=1;break}if((c[o>>2]|0)==1){b=25;break b}if(!(c[l>>2]&2)){b=25;break b}else{b=1;h=1}}else b=m;while(0);m=b;i=i+8|0}do if((b|0)==20){if((!m?(c[q>>2]=e,e=d+40|0,c[e>>2]=(c[e>>2]|0)+1,(c[d+36>>2]|0)==1):0)?(c[o>>2]|0)==2:0){a[n>>0]=1;if(h){b=25;break}else{h=4;break}}if(h)b=25;else h=4}while(0);if((b|0)==25)h=3;c[p>>2]=h;break}if((f|0)==1)c[d+32>>2]=1}while(0);return}function gf(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0;h=c[a+4>>2]|0;g=h>>8;if(h&1)g=c[(c[d>>2]|0)+g>>2]|0;a=c[a>>2]|0;Yb[c[(c[a>>2]|0)+24>>2]&3](a,b,d+g|0,h&2|0?e:2,f);return}function hf(b,d,e,f){b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0;a:do if((b|0)==(c[d+8>>2]|0)){b=d+16|0;g=c[b>>2]|0;if(!g){c[b>>2]=e;c[d+24>>2]=f;c[d+36>>2]=1;break}if((g|0)!=(e|0)){f=d+36|0;c[f>>2]=(c[f>>2]|0)+1;c[d+24>>2]=2;a[d+54>>0]=1;break}b=d+24|0;if((c[b>>2]|0)==2)c[b>>2]=f}else{h=c[b+12>>2]|0;g=b+16+(h<<3)|0;jf(b+16|0,d,e,f);if((h|0)>1){h=d+54|0;b=b+24|0;do{jf(b,d,e,f);if(a[h>>0]|0)break a;b=b+8|0}while(b>>>0>>0)}}while(0);return}function jf(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0;g=c[a+4>>2]|0;f=g>>8;if(g&1)f=c[(c[d>>2]|0)+f>>2]|0;a=c[a>>2]|0;fc[c[(c[a>>2]|0)+28>>2]&3](a,b,d+f|0,g&2|0?e:2);return}function kf(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0;f=i;i=i+16|0;e=f;c[e>>2]=c[d>>2];a=Xb[c[(c[a>>2]|0)+16>>2]&7](a,b,e)|0;if(a)c[d>>2]=c[e>>2];i=f;return a&1|0}function lf(a){a=a|0;if(!a)a=0;else a=(Oe(a,328)|0)!=0;return a&1|0}function mf(){}function nf(b,d,e){b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,i=0;f=b+e|0;if((e|0)>=20){d=d&255;h=b&3;i=d|d<<8|d<<16|d<<24;g=f&~3;if(h){h=b+4-h|0;while((b|0)<(h|0)){a[b>>0]=d;b=b+1|0}}while((b|0)<(g|0)){c[b>>2]=i;b=b+4|0}}while((b|0)<(f|0)){a[b>>0]=d;b=b+1|0}return b-e|0}function of(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;c=a+c>>>0;return (C=b+d+(c>>>0>>0|0)>>>0,c|0)|0}function pf(a,b,c){a=a|0;b=b|0;c=c|0;if((c|0)<32){C=b>>c;return a>>>c|(b&(1<>c-32|0}function qf(a,b,c){a=a|0;b=b|0;c=c|0;if((c|0)<32){C=b>>>c;return a>>>c|(b&(1<>>c-32|0}function rf(b,d,e){b=b|0;d=d|0;e=e|0;var f=0;if((e|0)>=4096)return ya(b|0,d|0,e|0)|0;f=b|0;if((b&3)==(d&3)){while(b&3){if(!e)return f|0;a[b>>0]=a[d>>0]|0;b=b+1|0;d=d+1|0;e=e-1|0}while((e|0)>=4){c[b>>2]=c[d>>2];b=b+4|0;d=d+4|0;e=e-4|0}}while((e|0)>0){a[b>>0]=a[d>>0]|0;b=b+1|0;d=d+1|0;e=e-1|0}return f|0}function sf(b,c,d){b=b|0;c=c|0;d=d|0;var e=0;if((c|0)<(b|0)&(b|0)<(c+d|0)){e=b;c=c+d|0;b=b+d|0;while((d|0)>0){b=b-1|0;c=c-1|0;d=d-1|0;a[b>>0]=a[c>>0]|0}b=e}else rf(b,c,d)|0;return b|0}function tf(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;d=b-d-(c>>>0>a>>>0|0)>>>0;return (C=d,a-c>>>0|0)|0}function uf(a,b,c){a=a|0;b=b|0;c=c|0;if((c|0)<32){C=b<>>32-c;return a<>0]|0;if((c|0)<8)return c|0;c=a[m+(b>>8&255)>>0]|0;if((c|0)<8)return c+8|0;c=a[m+(b>>16&255)>>0]|0;if((c|0)<8)return c+16|0;return (a[m+(b>>>24)>>0]|0)+24|0}function wf(a,b){a=a|0;b=b|0;var c=0,d=0,e=0,f=0;f=a&65535;e=b&65535;c=_(e,f)|0;d=a>>>16;a=(c>>>16)+(_(e,d)|0)|0;e=b>>>16;b=_(e,f)|0;return (C=(a>>>16)+(_(e,d)|0)+(((a&65535)+b|0)>>>16)|0,a+b<<16|c&65535|0)|0}function xf(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0,g=0,h=0,i=0,j=0;j=b>>31|((b|0)<0?-1:0)<<1;i=((b|0)<0?-1:0)>>31|((b|0)<0?-1:0)<<1;f=d>>31|((d|0)<0?-1:0)<<1;e=((d|0)<0?-1:0)>>31|((d|0)<0?-1:0)<<1;h=tf(j^a|0,i^b|0,j|0,i|0)|0;g=C;a=f^j;b=e^i;return tf((Cf(h,g,tf(f^c|0,e^d|0,f|0,e|0)|0,C,0)|0)^a|0,C^b|0,a|0,b|0)|0}function yf(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,j=0,k=0,l=0;f=i;i=i+16|0;j=f|0;h=b>>31|((b|0)<0?-1:0)<<1;g=((b|0)<0?-1:0)>>31|((b|0)<0?-1:0)<<1;l=e>>31|((e|0)<0?-1:0)<<1;k=((e|0)<0?-1:0)>>31|((e|0)<0?-1:0)<<1;a=tf(h^a|0,g^b|0,h|0,g|0)|0;b=C;Cf(a,b,tf(l^d|0,k^e|0,l|0,k|0)|0,C,j)|0;e=tf(c[j>>2]^h|0,c[j+4>>2]^g|0,h|0,g|0)|0;d=C;i=f;return (C=d,e)|0}function zf(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;var e=0,f=0;e=a;f=c;c=wf(e,f)|0;a=C;return (C=(_(b,f)|0)+(_(d,e)|0)+a|a&0,c|0|0)|0}function Af(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;return Cf(a,b,c,d,0)|0}function Bf(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0;g=i;i=i+16|0;f=g|0;Cf(a,b,d,e,f)|0;i=g;return (C=c[f+4>>2]|0,c[f>>2]|0)|0}function Cf(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;l=a;j=b;k=j;h=d;n=e;i=n;if(!k){g=(f|0)!=0;if(!i){if(g){c[f>>2]=(l>>>0)%(h>>>0);c[f+4>>2]=0}n=0;f=(l>>>0)/(h>>>0)>>>0;return (C=n,f)|0}else{if(!g){n=0;f=0;return (C=n,f)|0}c[f>>2]=a|0;c[f+4>>2]=b&0;n=0;f=0;return (C=n,f)|0}}g=(i|0)==0;do if(h){if(!g){g=(aa(i|0)|0)-(aa(k|0)|0)|0;if(g>>>0<=31){m=g+1|0;i=31-g|0;b=g-31>>31;h=m;a=l>>>(m>>>0)&b|k<>>(m>>>0)&b;g=0;i=l<>2]=a|0;c[f+4>>2]=j|b&0;n=0;f=0;return (C=n,f)|0}g=h-1|0;if(g&h|0){i=(aa(h|0)|0)+33-(aa(k|0)|0)|0;p=64-i|0;m=32-i|0;j=m>>31;o=i-32|0;b=o>>31;h=i;a=m-1>>31&k>>>(o>>>0)|(k<>>(i>>>0))&b;b=b&k>>>(i>>>0);g=l<>>(o>>>0))&j|l<>31;break}if(f|0){c[f>>2]=g&l;c[f+4>>2]=0}if((h|0)==1){o=j|b&0;p=a|0|0;return (C=o,p)|0}else{p=vf(h|0)|0;o=k>>>(p>>>0)|0;p=k<<32-p|l>>>(p>>>0)|0;return (C=o,p)|0}}else{if(g){if(f|0){c[f>>2]=(k>>>0)%(h>>>0);c[f+4>>2]=0}o=0;p=(k>>>0)/(h>>>0)>>>0;return (C=o,p)|0}if(!l){if(f|0){c[f>>2]=0;c[f+4>>2]=(k>>>0)%(i>>>0)}o=0;p=(k>>>0)/(i>>>0)>>>0;return (C=o,p)|0}g=i-1|0;if(!(g&i)){if(f|0){c[f>>2]=a|0;c[f+4>>2]=g&k|b&0}o=0;p=k>>>((vf(i|0)|0)>>>0);return (C=o,p)|0}g=(aa(i|0)|0)-(aa(k|0)|0)|0;if(g>>>0<=30){b=g+1|0;i=31-g|0;h=b;a=k<>>(b>>>0);b=k>>>(b>>>0);g=0;i=l<>2]=a|0;c[f+4>>2]=j|b&0;o=0;p=0;return (C=o,p)|0}while(0);if(!h){k=i;j=0;i=0}else{m=d|0|0;l=n|e&0;k=of(m|0,l|0,-1,-1)|0;d=C;j=i;i=0;do{e=j;j=g>>>31|j<<1;g=i|g<<1;e=a<<1|e>>>31|0;n=a>>>31|b<<1|0;tf(k|0,d|0,e|0,n|0)|0;p=C;o=p>>31|((p|0)<0?-1:0)<<1;i=o&1;a=tf(e|0,n|0,o&m|0,(((p|0)<0?-1:0)>>31|((p|0)<0?-1:0)<<1)&l|0)|0;b=C;h=h-1|0}while((h|0)!=0);k=j;j=0}h=0;if(f|0){c[f>>2]=a;c[f+4>>2]=b}o=(g|0)>>>31|(k|h)<<1|(h<<1|g>>>31)&0|j;p=(g<<1|0>>>31)&-2|i;return (C=o,p)|0}function Df(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;return Xb[a&7](b|0,c|0,d|0)|0}function Ef(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;Yb[a&3](b|0,c|0,d|0,e|0,f|0)}function Ff(a,b){a=a|0;b=b|0;Zb[a&15](b|0)}function Gf(a,b,c,d,e,f,g){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=g|0;return _b[a&1](b|0,c|0,d|0,e|0,f|0,g|0)|0}function Hf(a,b){a=a|0;b=b|0;return $b[a&3](b|0)|0}function If(a,b,c,d,e,f,g,h){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=g|0;h=h|0;ac[a&1](b|0,c|0,d|0,e|0,f|0,g|0,h|0)}function Jf(a){a=a|0;bc[a&0]()}function Kf(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;return cc[a&3](b|0,c|0,d|0,e|0)|0}function Lf(a,b,c,d,e,f,g){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=g|0;dc[a&3](b|0,c|0,d|0,e|0,f|0,g|0)}function Mf(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;return ec[a&3](b|0,c|0,d|0,e|0,f|0)|0}function Nf(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;fc[a&3](b|0,c|0,d|0,e|0)}function Of(a,b,c){a=a|0;b=b|0;c=c|0;ba(0);return 0}function Pf(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;ba(1)}function Qf(a){a=a|0;ba(2)}function Rf(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;ba(3);return 0}function Sf(a){a=a|0;ba(4);return 0}function Tf(a,b,c,d,e,f,g){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;g=g|0;ba(5)}function Uf(){ba(6)}function Vf(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;ba(7);return 0}function Wf(a,b,c,d,e,f){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=f|0;ba(8)}function Xf(a,b,c,d,e){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;ba(9);return 0}function Yf(a,b,c,d){a=a|0;b=b|0;c=c|0;d=d|0;ba(10)} +function gc(a){a=a|0;var b=0;b=i;i=i+a|0;i=i+15&-16;return b|0}function hc(){return i|0}function ic(a){a=a|0;i=a}function jc(a,b){a=a|0;b=b|0;i=a;j=b}function kc(a,b){a=a|0;b=b|0;if(!n){n=a;o=b}}function lc(b){b=b|0;a[k>>0]=a[b>>0];a[k+1>>0]=a[b+1>>0];a[k+2>>0]=a[b+2>>0];a[k+3>>0]=a[b+3>>0]}function mc(b){b=b|0;a[k>>0]=a[b>>0];a[k+1>>0]=a[b+1>>0];a[k+2>>0]=a[b+2>>0];a[k+3>>0]=a[b+3>>0];a[k+4>>0]=a[b+4>>0];a[k+5>>0]=a[b+5>>0];a[k+6>>0]=a[b+6>>0];a[k+7>>0]=a[b+7>>0]}function nc(a){a=a|0;C=a}function oc(){return C|0}function pc(a,d,f,g,h){a=a|0;d=d|0;f=f|0;g=g|0;h=h|0;var i=0,j=0;if((f|0)>0){i=0;do{j=i<<1;b[d+(i<<1)>>1]=b[d+((j|1)<<1)>>1]<<8|e[d+(j<<1)>>1];i=i+1|0}while((i|0)!=(f|0))}return Kc(c[a+12>>2]|0,d,h,g)|0}function qc(a,d,f,g){a=a|0;d=d|0;f=f|0;g=g|0;var h=0,i=0,j=0;h=a+20|0;i=Cc(c[a+16>>2]|0,d,f,c[h>>2]|0)|0;f=c[a+4>>2]|0;if((_(f,i)|0)<=0)return i|0;h=c[h>>2]|0;f=_(i,f)|0;d=0;do{j=h+(d<<1)|0;a=d<<1;b[g+(a<<1)>>1]=(e[j>>1]|0)&255;b[g+((a|1)<<1)>>1]=(e[j>>1]|0)>>>8;d=d+1|0}while((d|0)!=(f|0));return i|0}function rc(a){a=a|0;return 8}function sc(a){a=a|0;if(!a)return;Ie(c[a+12>>2]|0);Ie(c[a+16>>2]|0);Ie(a);return}function tc(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,g=0,h=0,j=0,k=0,l=0,m=0;m=i;i=i+16|0;l=m+4|0;k=m;while(1){j=He(24)|0;if(j|0)break;e=c[8868]|0;c[8868]=e+0;if(!e){h=5;break}bc[e&0]()}if((h|0)==5){m=kb(4)|0;c[m>>2]=23152;Tb(m|0,296,6)}g=c[a>>2]|0;f=c[b>>2]|0;b=c[d>>2]|0;c[j>>2]=b;c[j+4>>2]=f;c[j+8>>2]=g;a=f*11520|0;a=a>>>0>2147483647?-1:a<<1;a=(a|0)==0?1:a;while(1){e=He(a)|0;if(e|0){h=11;break}e=c[8868]|0;c[8868]=e+0;if(!e){h=10;break}bc[e&0]()}if((h|0)==10){m=kb(4)|0;c[m>>2]=23152;Tb(m|0,296,6)}else if((h|0)==11){c[j+20>>2]=e;c[j+12>>2]=Fc(g,f,b,l)|0;c[j+16>>2]=Ac(g,f,k)|0;i=m;return j|0}return 0}function uc(a,b,d,e){a=a|0;b=b|0;d=d|0;e=e|0;var f=0,g=0,h=0,j=0;f=i;i=i+16|0;j=f+8|0;h=f+4|0;g=f;c[j>>2]=b;c[h>>2]=d;c[g>>2]=e;a=Xb[a&7](j,h,g)|0;i=f;return a|0}function vc(a,b,d,e,f,g){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;g=g|0;var h=0,i=0;h=c[a>>2]|0;i=c[a+4>>2]|0;a=b+(i>>1)|0;if(i&1)h=c[(c[a>>2]|0)+h>>2]|0;return ec[h&3](a,d,e,f,g)|0}function wc(a,b,d,e,f){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;var g=0,h=0;g=c[a>>2]|0;h=c[a+4>>2]|0;a=b+(h>>1)|0;if(h&1)g=c[(c[a>>2]|0)+g>>2]|0;return cc[g&3](a,d,e,f)|0}function xc(){var a=0,b=0;eb(8,16,32,0,27863,2,27866,0,27866,0,27766,27868,11);Ja(8,4,488,27871,1,4);while(1){a=He(8)|0;if(a|0)break;a=c[8868]|0;c[8868]=a+0;if(!a){b=5;break}bc[a&0]()}if((b|0)==5){b=kb(4)|0;c[b>>2]=23152;Tb(b|0,296,6)}c[a>>2]=1;c[a+4>>2]=0;Jb(8,27784,6,504,27877,1,a|0,0);while(1){a=He(8)|0;if(a|0){b=11;break}a=c[8868]|0;c[8868]=a+0;if(!a){b=10;break}bc[a&0]()}if((b|0)==10){b=kb(4)|0;c[b>>2]=23152;Tb(b|0,296,6)}else if((b|0)==11){c[a>>2]=2;c[a+4>>2]=0;Jb(8,27792,5,528,27885,2,a|0,0);return}}function yc(a,b,c,d,e,f,h,i,j,k,l){a=a|0;b=b|0;c=c|0;d=d|0;e=e|0;f=+f;h=+h;i=i|0;j=j|0;k=k|0;l=l|0;var m=0.0,n=0.0,o=0.0,p=0.0,q=0.0,r=0.0,s=0,t=0,u=0,v=0,w=0,x=0.0,y=0.0,z=0.0,A=0,B=0.0,C=0.0,D=0.0;if(f==0.0&h==0.0){if((b|0)==(a|0))return;sf(a|0,b|0,e<<2|0)|0;return}s=(c|0)>15?c:15;A=(d|0)>15?d:15;r=+g[548+(i*12|0)>>2]*f;p=+g[548+(i*12|0)+4>>2]*f;q=+g[548+(i*12|0)+8>>2]*f;x=+g[548+(j*12|0)>>2]*h;y=+g[548+(j*12|0)+4>>2]*h;z=+g[548+(j*12|0)+8>>2]*h;t=1-A|0;u=0-A|0;v=~A;w=-2-A|0;c=f==h&(s|0)==(A|0)&(i|0)==(j|0)?0:l;d=0;f=+g[b+(t<<2)>>2];m=+g[b+(u<<2)>>2];n=+g[b+(v<<2)>>2];o=+g[b+(w<<2)>>2];while(1){if((d|0)>=(c|0))break;C=+g[b+(d-A+2<<2)>>2];B=+g[k+(d<<2)>>2];B=B*B;D=1.0-B;j=d-s|0;g[a+(d<<2)>>2]=+g[b+(d<<2)>>2]+D*r*+g[b+(j<<2)>>2]+D*p*(+g[b+(j+1<<2)>>2]+ +g[b+(j+-1<<2)>>2])+D*q*(+g[b+(j+2<<2)>>2]+ +g[b+(j+-2<<2)>>2])+B*x*m+B*y*(f+n)+B*z*(C+o);B=f;d=d+1|0;f=C;o=n;n=m;m=B}if(h==0.0){if((b|0)==(a|0))return;sf(a+(c<<2)|0,b+(c<<2)|0,e-c<<2|0)|0;return}else{i=a+(d<<2)|0;l=b+(d<<2)|0;c=e-d|0;d=0;o=+g[l+(t<<2)>>2];n=+g[l+(u<<2)>>2];m=+g[l+(v<<2)>>2];f=+g[l+(w<<2)>>2];while(1){if((d|0)>=(c|0))break;C=+g[l+(d-A+2<<2)>>2];g[i+(d<<2)>>2]=+g[l+(d<<2)>>2]+n*x+(o+m)*y+(C+f)*z;D=o;d=d+1|0;o=C;f=m;m=n;n=D}return}}function zc(a){a=a|0;if((a+7|0)>>>0>7){a=27924;return a|0}a=c[584+(0-a<<2)>>2]|0;return a|0}function Ac(a,d,e){a=a|0;d=d|0;e=e|0;var f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0;s=i;i=i+16|0;q=s+8|0;o=s;a:do if((a|0)<16e3)if((a|0)<12e3)switch(a|0){case 8e3:{h=2;break a}default:break a}else switch(a|0){case 12e3:{h=2;break a}default:break a}else{if((a|0)<24e3)switch(a|0){case 16e3:{h=2;break a}default:break a}if((a|0)<48e3)switch(a|0){case 24e3:{h=2;break a}default:break a}else switch(a|0){case 48e3:{h=2;break a}default:break a}}while(0);if((h|0)==2?(d+-1|0)>>>0<2:0){n=d*96|0;r=He((d*8672|0)+88+n+9304|0)|0;if(!r){if(!e){e=0;i=s;return e|0}c[e>>2]=-7;e=0;i=s;return e|0}b:do if((a|0)<16e3)if((a|0)<12e3)switch(a|0){case 8e3:{h=9;break b}default:{f=-1;break b}}else switch(a|0){case 12e3:{h=9;break b}default:{f=-1;break b}}else{if((a|0)<24e3)switch(a|0){case 16e3:{h=9;break b}default:{f=-1;break b}}if((a|0)<48e3)switch(a|0){case 24e3:{h=9;break b}default:{f=-1;break b}}else switch(a|0){case 48e3:{h=9;break b}default:{f=-1;break b}}}while(0);do if((h|0)==9)if((d+-1|0)>>>0<2){nf(r|0,0,(d*8672|0)+88+n+9304|0)|0;c[r+4>>2]=88;c[r>>2]=8632;f=r+88|0;p=r+8632|0;c[r+8>>2]=d;c[r+48>>2]=d;c[r+12>>2]=a;c[r+24>>2]=a;c[r+16>>2]=d;m=0;while(1){if((m|0)==2)break;g=f+(m*4260|0)|0;nf(g|0,0,4260)|0;c[f+(m*4260|0)+2376>>2]=1;c[g>>2]=65536;g=f+(m*4260|0)+2340|0;j=c[g>>2]|0;h=32767/(j+1|0)|0;k=0;l=0;while(1){if((l|0)>=(j|0))break;t=k+h|0;b[f+(m*4260|0)+4052+(l<<1)>>1]=t;j=c[g>>2]|0;k=t;l=l+1|0}c[f+(m*4260|0)+4148>>2]=0;c[f+(m*4260|0)+4152>>2]=3176576;c[f+(m*4260|0)+4168>>2]=c[f+(m*4260|0)+2328>>2]<<7;c[f+(m*4260|0)+4240>>2]=65536;c[f+(m*4260|0)+4244>>2]=65536;c[f+(m*4260|0)+4256>>2]=20;c[f+(m*4260|0)+4252>>2]=2;m=m+1|0}t=r+8608|0;c[t>>2]=0;c[t+4>>2]=0;c[t+8>>2]=0;c[r+8628>>2]=0;if(d>>>0<=2){nf(p|0,0,(d*8672|0)+88+n+672|0)|0;c[p>>2]=5304;c[r+8636>>2]=120;c[r+8640>>2]=d;c[r+8644>>2]=d;g=r+8648|0;c[g>>2]=1;c[r+8652>>2]=0;c[r+8656>>2]=21;c[r+8660>>2]=1;c[r+8664>>2]=0;Xc(p,4028,o);c:do if((a|0)<16e3)if((a|0)<12e3){switch(a|0){case 8e3:break;default:{h=22;break c}}f=6;h=23;break}else{switch(a|0){case 12e3:break;default:{h=22;break c}}f=4;h=23;break}else{if((a|0)<24e3){switch(a|0){case 16e3:break;default:{h=22;break c}}f=3;h=23;break}if((a|0)>=48e3)switch(a|0){case 48e3:{f=1;h=23;break c}default:{h=22;break c}}switch(a|0){case 24e3:break;default:{h=22;break c}}f=2;h=23}while(0);if((h|0)==22){c[g>>2]=0;f=-3;break}else if((h|0)==23){c[g>>2]=f;c[q>>2]=0;Xc(p,10016,q);c[r+60>>2]=0;c[r+64>>2]=(a|0)/400|0;c[r+44>>2]=0;f=0;break}}else f=-3}else f=-1;while(0);if(e|0)c[e>>2]=f;if(!f){t=r;i=s;return t|0}Ie(r);t=0;i=s;return t|0}if(!e){t=0;i=s;return t|0}c[e>>2]=-1;t=0;i=s;return t|0}function Bc(a,e,f,h,j,k){a=a|0;e=e|0;f=f|0;h=h|0;j=j|0;k=k|0;var l=0,m=0,n=0,o=0,p=0.0,q=0,r=0,s=0,t=0,u=0,v=0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,Y=0,Z=0,$=0,ba=0,ca=0,da=0,ea=0,fa=0,ga=0,ha=0;ha=i;i=i+160|0;Z=ha+80|0;Y=ha+72|0;W=ha+64|0;U=ha+56|0;R=ha+48|0;P=ha+40|0;O=ha+32|0;N=ha+24|0;M=ha+16|0;L=ha+8|0;K=ha;fa=ha+96|0;B=ha+92|0;ga=ha+88|0;Q=ha+144|0;T=ha+84|0;c[ga>>2]=0;A=a+(c[a+4>>2]|0)|0;V=a+(c[a>>2]|0)|0;da=a+12|0;l=c[da>>2]|0;S=(l|0)/50|0;z=S>>1;ca=S>>2;ea=S>>3;if((ea|0)>(j|0)){a=-2;i=ha;return a|0}l=((l|0)/25|0)*3|0;l=(l|0)>(j|0)?j:l;do if((f|0)>=2)if(e){o=c[a+64>>2]|0;n=c[a+56>>2]|0;c[fa>>2]=e;c[fa+4>>2]=f;c[fa+8>>2]=0;c[fa+12>>2]=0;c[fa+16>>2]=0;r=fa+20|0;c[r>>2]=9;s=fa+24|0;c[s>>2]=0;t=fa+28|0;c[t>>2]=128;c[s>>2]=1;x=d[e>>0]|0;u=fa+40|0;c[u>>2]=x;y=x>>>1^127;v=fa+32|0;c[v>>2]=y;c[fa+44>>2]=0;m=128;j=9;q=1;while(1){if(m>>>0>=8388609)break;j=j+8|0;c[r>>2]=j;m=m<<8;c[t>>2]=m;if(q>>>0>>0){ba=q+1|0;c[s>>2]=ba;w=d[e+q>>0]|0;q=ba}else w=0;c[u>>2]=w;ba=((x<<8|w)>>>1&255|y<<8&2147483392)^255;c[v>>2]=ba;x=w;y=ba}j=c[a+60>>2]|0;if((j|0)>0){j=(j|0)==1002;if((n|0)!=1002){if(!j){j=e;m=l;E=27;break}F=_(ca,c[a+8>>2]|0)|0;ba=Fa()|0;$=o;G=0;H=1;break}if(!j?(c[a+68>>2]|0)==0:0){$=_(ca,c[a+8>>2]|0)|0;ba=Fa()|0;G=i;i=i+((1*($<<2)|0)+15&-16)|0;Bc(a,0,0,G,(ca|0)<(o|0)?ca:o,0)|0;$=o;n=1002;F=1;H=1}else{j=e;m=l;n=1002;E=27}}else{j=e;m=l;E=27}}else E=10;else{E=c[a+64>>2]|0;l=(l|0)<(E|0)?l:E;E=10}while(0);do if((E|0)==10){n=c[a+60>>2]|0;if(!n){j=a+8|0;m=0;while(1){if((m|0)>=(_(l,c[j>>2]|0)|0))break;g[h+(m<<2)>>2]=0.0;m=m+1|0}i=ha;return l|0}if((l|0)<=(S|0)){if((l|0)>=(S|0)){j=0;m=l;o=l;E=27;break}if((l|0)>(z|0)){j=0;m=l;o=z;E=27;break}if((n|0)==1e3){j=0;m=l;o=l;n=1e3;E=27;break}j=0;m=l;o=(l|0)>(ca|0)&(l|0)<(z|0)?ca:l;E=27;break}o=a+8|0;j=h;n=l;while(1){m=Bc(a,0,0,j,(n|0)<(S|0)?n:S,0)|0;if((m|0)<0){l=m;E=158;break}n=n-m|0;j=j+((_(m,c[o>>2]|0)|0)<<2)|0;if((n|0)<=0){E=158;break}}if((E|0)==158){i=ha;return l|0}}while(0);if((E|0)==27){e=j;l=m;ba=Fa()|0;$=o;G=0;F=1;H=0}a:do if(($|0)>(l|0))l=-1;else{if((n|0)==1002){B=i;i=i+16|0;n=1002}else{u=a+8|0;l=c[u>>2]|0;if((z|0)>($|0)){z=(_(z,l)|0)<<1;t=i;i=i+((1*z|0)+15&-16)|0}else{z=(_($,l)|0)<<1;t=i;i=i+((1*z|0)+15&-16)|0}if((c[a+60>>2]|0)==1002){r=0;while(1){if((r|0)==2)break;l=A+(r*4260|0)|0;nf(l|0,0,4260)|0;c[A+(r*4260|0)+2376>>2]=1;c[l>>2]=65536;l=A+(r*4260|0)+2340|0;m=c[l>>2]|0;j=32767/(m+1|0)|0;o=0;q=0;while(1){if((q|0)>=(m|0))break;z=o+j|0;b[A+(r*4260|0)+4052+(q<<1)>>1]=z;m=c[l>>2]|0;o=z;q=q+1|0}c[A+(r*4260|0)+4148>>2]=0;c[A+(r*4260|0)+4152>>2]=3176576;c[A+(r*4260|0)+4168>>2]=c[A+(r*4260|0)+2328>>2]<<7;c[A+(r*4260|0)+4240>>2]=65536;c[A+(r*4260|0)+4244>>2]=65536;c[A+(r*4260|0)+4256>>2]=20;c[A+(r*4260|0)+4252>>2]=2;r=r+1|0}z=A+8520|0;c[z>>2]=0;c[z+4>>2]=0;c[z+8>>2]=0;c[A+8540>>2]=0}z=($*1e3|0)/(c[da>>2]|0)|0;c[a+32>>2]=(z|0)<10?10:z;if(!e)o=1;else{c[a+20>>2]=c[a+48>>2];b:do if((n|0)==1e3)switch(c[a+52>>2]|0){case 1101:{c[a+28>>2]=8e3;break b}case 1102:{c[a+28>>2]=12e3;break b}case 1103:{c[a+28>>2]=16e3;break b}default:{c[a+28>>2]=16e3;break b}}else c[a+28>>2]=16e3;while(0);o=k<<1}m=a+16|0;q=(o|0)==0;r=0;s=t;while(1){c:do if(!(xd(A,m,o,(r|0)==0&1,fa,s,B)|0))l=c[u>>2]|0;else{if(q){l=-3;break a}c[B>>2]=$;j=0;while(1){l=c[u>>2]|0;if((j|0)>=(_($,l)|0))break c;b[s+(j<<1)>>1]=0;j=j+1|0}}while(0);z=c[B>>2]|0;r=r+z|0;s=s+((_(z,l)|0)<<1)|0;if((r|0)>=($|0)){B=t;break}}}A=(k|0)==0;do if(A)if((n|0)!=1002)if((e|0)!=0?(I=fa+20|0,D=c[I>>2]|0,J=fa+28|0,C=c[J>>2]|0,E=D+((aa(C|0)|0)+-32)+17|0,(E+((c[a+56>>2]|0)==1001?20:0)|0)<=(f<<3|0)):0){x=(n|0)==1001;y=fa+32|0;j=c[y>>2]|0;if(x){l=C>>>12;u=j>>>0>>0;v=u&1;if(!u){j=j-l|0;c[y>>2]=j;l=C-l|0}c[J>>2]=l;r=fa+40|0;s=fa+24|0;t=fa+4|0;m=l;l=D;while(1){if(m>>>0>=8388609)break;l=l+8|0;c[I>>2]=l;o=m<<8;c[J>>2]=o;q=c[r>>2]|0;m=c[s>>2]|0;if(m>>>0<(c[t>>2]|0)>>>0){c[s>>2]=m+1;m=d[(c[fa>>2]|0)+m>>0]|0}else m=0;c[r>>2]=m;E=((q<<8|m)>>>1&255|j<<8&2147483392)^255;c[y>>2]=E;m=o;j=E}if(u){q=m;o=j}else{l=f;j=0;m=0;o=0;E=90;break}}else{q=C;o=j;l=D;v=1}m=q>>>1;E=o>>>0>>0;j=E&1;if(!E){o=o-m|0;c[y>>2]=o;m=q-m|0}c[J>>2]=m;t=fa+40|0;u=fa+24|0;w=fa+4|0;while(1){if(m>>>0>=8388609)break;l=l+8|0;c[I>>2]=l;m=m<<8;c[J>>2]=m;r=c[t>>2]|0;q=c[u>>2]|0;if(q>>>0<(c[w>>2]|0)>>>0){c[u>>2]=q+1;q=d[(c[fa>>2]|0)+q>>0]|0}else q=0;c[t>>2]=q;E=((r<<8|q)>>>1&255|o<<8&2147483392)^255;c[y>>2]=E;o=E}if(x){E=m>>>8;c[fa+36>>2]=E;s=(o>>>0)/(E>>>0)|0;D=s+1|0;s=256-(D+(D>>>0>256?255-s|0:0))|0;D=_(E,255-s|0)|0;r=o-D|0;c[y>>2]=r;m=(s|0)==0?m-D|0:E;c[J>>2]=m;while(1){if(m>>>0>=8388609)break;l=l+8|0;c[I>>2]=l;m=m<<8;c[J>>2]=m;q=c[t>>2]|0;o=c[u>>2]|0;if(o>>>0<(c[w>>2]|0)>>>0){c[u>>2]=o+1;o=d[(c[fa>>2]|0)+o>>0]|0}else o=0;c[t>>2]=o;E=((q<<8|o)>>>1&255|r<<8&2147483392)^255;c[y>>2]=E;r=E}o=s+2|0}else o=f-(l+((aa(m|0)|0)+-32)+7>>3)|0;E=f-o|0;m=(E<<3|0)<(l+((aa(m|0)|0)+-32)|0);o=m?0:o;c[w>>2]=(c[w>>2]|0)-o;l=m?0:E;m=m?0:v;E=90}else{l=f;j=0;m=0;o=0;E=91}else{z=f;y=0;m=0;o=0;j=0}else{l=f;j=0;m=0;o=0;E=90}while(0);if((E|0)==90)if((n|0)==1002){z=l;y=j;j=0}else E=91;if((E|0)==91){z=l;y=j;j=17}switch(c[a+52>>2]|0){case 1101:{l=13;break}case 1103:case 1102:{l=17;break}case 1104:{l=19;break}default:l=21}c[K>>2]=l;Xc(V,10012,K);c[L>>2]=c[a+48>>2];Xc(V,10008,L);x=(m|0)==0;if(!x){L=(_(ca,c[a+8>>2]|0)|0)<<2;l=i;i=i+((1*L|0)+15&-16)|0;if(!y){s=l;w=G;t=0}else{c[M>>2]=0;Xc(V,10010,M);Yc(V,e+z|0,o,l,ca,0,0)|0;c[N>>2]=ga;Xc(V,4031,N);s=l;w=G;t=0}}else{l=i;i=i+((1*(F<<2)|0)+15&-16)|0;do if(!((H|0)==0|(n|0)==1002))if((ca|0)<($|0)){Bc(a,0,0,l,ca,0)|0;break}else{Bc(a,0,0,l,$,0)|0;break}else l=G;while(0);s=i;i=i+16|0;w=l;t=H}c[O>>2]=j;Xc(V,10010,O);do if((n|0)==1e3){b[Q>>1]=-1;l=a+8|0;j=0;while(1){if((j|0)>=(_($,c[l>>2]|0)|0))break;g[h+(j<<2)>>2]=0.0;j=j+1|0}if((c[a+60>>2]|0)==1001){if(!(x|(y|0)==0)?c[a+68>>2]|0:0){l=0;n=1e3;E=116;break}c[R>>2]=0;Xc(V,10010,R);Yc(V,Q,2,h,ea,0,0)|0;l=0;n=1e3;E=116}else{l=0;n=1e3;E=116}}else{l=(S|0)<($|0)?S:$;S=c[a+60>>2]|0;if((n|0)!=(S|0)&(S|0)>0?(c[a+68>>2]|0)==0:0)Xc(V,4028,P);l=Yc(V,A?e:0,z,h,l,fa,0)|0;if((n|0)==1002){v=l;u=n}else E=116}while(0);d:do if((E|0)==116){j=a+8|0;m=0;while(1){if((m|0)>=(_($,c[j>>2]|0)|0)){v=l;u=n;break d}S=h+(m<<2)|0;g[S>>2]=+g[S>>2]+ +(b[B+(m<<1)>>1]|0)*.000030517578125;m=m+1|0}}while(0);c[U>>2]=T;Xc(V,10015,U);r=c[(c[T>>2]|0)+60>>2]|0;e:do if(!x){if(!y){Xc(V,4028,W);c[Y>>2]=0;Xc(V,10010,Y);Yc(V,e+z|0,o,s,ca,0,0)|0;c[Z>>2]=ga;Xc(V,4031,Z);o=c[a+8>>2]|0;q=h+((_(o,$-ea|0)|0)<<2)|0;l=s+((_(o,ea)|0)<<2)|0;j=48e3/(c[da>>2]|0)|0;m=0;while(1){if((m|0)<(o|0))n=0;else break e;while(1){if((n|0)>=(ea|0))break;p=+g[r+((_(n,j)|0)<<2)>>2];p=p*p;Y=(_(n,o)|0)+m|0;Z=q+(Y<<2)|0;g[Z>>2]=p*+g[l+(Y<<2)>>2]+(1.0-p)*+g[Z>>2];n=n+1|0}m=m+1|0}}j=a+8|0;m=0;while(1){q=c[j>>2]|0;if((m|0)<(q|0))l=0;else break;while(1){if((l|0)>=(ea|0))break;Z=(_(c[j>>2]|0,l)|0)+m|0;c[h+(Z<<2)>>2]=c[s+(Z<<2)>>2];l=l+1|0}m=m+1|0}j=_(q,ea)|0;l=s+(j<<2)|0;j=h+(j<<2)|0;m=48e3/(c[da>>2]|0)|0;n=0;while(1){if((n|0)<(q|0))o=0;else break e;while(1){if((o|0)>=(ea|0))break;p=+g[r+((_(o,m)|0)<<2)>>2];p=p*p;Y=(_(o,q)|0)+n|0;Z=j+(Y<<2)|0;g[Z>>2]=p*+g[Z>>2]+(1.0-p)*+g[l+(Y<<2)>>2];o=o+1|0}n=n+1|0}}while(0);f:do if(t|0){j=a+8|0;if(($|0)<(ca|0)){n=c[j>>2]|0;l=48e3/(c[da>>2]|0)|0;j=0;while(1){if((j|0)<(n|0))m=0;else break f;while(1){if((m|0)>=(ea|0))break;p=+g[r+((_(m,l)|0)<<2)>>2];p=p*p;ca=(_(m,n)|0)+j|0;da=h+(ca<<2)|0;g[da>>2]=p*+g[da>>2]+(1.0-p)*+g[w+(ca<<2)>>2];m=m+1|0}j=j+1|0}}else l=0;while(1){q=c[j>>2]|0;m=_(q,ea)|0;if((l|0)>=(m|0))break;c[h+(l<<2)>>2]=c[w+(l<<2)>>2];l=l+1|0}o=w+(m<<2)|0;n=h+(m<<2)|0;l=48e3/(c[da>>2]|0)|0;j=0;while(1){if((j|0)<(q|0))m=0;else break f;while(1){if((m|0)>=(ea|0))break;p=+g[r+((_(m,l)|0)<<2)>>2];p=p*p;ca=(_(m,q)|0)+j|0;da=n+(ca<<2)|0;g[da>>2]=p*+g[da>>2]+(1.0-p)*+g[o+(ca<<2)>>2];m=m+1|0}j=j+1|0}}while(0);l=c[a+40>>2]|0;g:do if(l|0){p=+X(+(+(l|0)*6.488140788860619e-04*.6931471805599453));l=a+8|0;j=0;while(1){if((j|0)>=(_($,c[l>>2]|0)|0))break g;ea=h+(j<<2)|0;g[ea>>2]=+g[ea>>2]*p;j=j+1|0}}while(0);if((z|0)<2)l=0;else l=c[fa+28>>2]^c[ga>>2];c[a+84>>2]=l;c[a+60>>2]=u;c[a+68>>2]=(y|0)==0&(x^1)&1;l=(v|0)<0?v:$}while(0);Na(ba|0);a=l;i=ha;return a|0}function Cc(e,f,h,j){e=e|0;f=f|0;h=h|0;j=j|0;var l=0.0,m=0,n=0,o=0,p=0,q=0,r=0.0,s=0.0,t=0,u=0,v=0.0,w=0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0.0,F=0.0;D=i;i=i+112|0;y=D;x=D+104|0;z=D+8|0;t=(f|0)==0;do if((h|0)>0&(t^1)){q=c[e+12>>2]|0;n=a[f>>0]|0;o=n&255;a:do switch(o&3|0){case 0:{p=1;break}case 3:if((h|0)<2){j=-4;i=D;return j|0}else{m=d[f+1>>0]&63;u=5;break a}default:{m=2;u=5}}while(0);if((u|0)==5)p=m;do if(n<<24>>24>=0)if((n&96)==96)if(!(n&8)){m=(q|0)/100|0;break}else{m=(q|0)/50|0;break}else{m=o>>>3&3;if((m|0)==3){m=(q*60|0)/1e3|0;break}else{m=(q<>>3&3)|0)/400|0;while(0);m=_(p,m)|0;if((m*25|0)<=(q*3|0)&(m|0)>0){w=(m|0)>5760?5760:m;break}else{j=-4;i=D;return j|0}}else w=5760;while(0);A=e+8|0;m=_(w,c[A>>2]|0)|0;B=Fa()|0;C=i;i=i+((1*(m<<2)|0)+15&-16)|0;m=(h|0)==0;b:do if(m|t)if(!((w|0)%((c[e+12>>2]|0)/400|0|0)|0))if(m|t){n=0;do{m=Bc(e,0,0,C+((_(n,c[A>>2]|0)|0)<<2)|0,w-n|0,0)|0;if((m|0)<0){n=m;break b}n=n+m|0}while((n|0)<(w|0));c[e+72>>2]=n}else u=23;else n=-1;else u=23;while(0);c:do if((u|0)==23)if((h|0)>=0){q=a[f>>0]|0;do if(q<<24>>24>=0){u=(q&96)==96;p=u?1001:1e3;if(u)o=(q&16)>>>4|1104;else o=((q&255)>>>5&3)+1101|0;m=c[e+12>>2]|0;if((q&96)==96)if(!(q&8)){t=(m|0)/100|0;break}else{t=(m|0)/50|0;break}else{n=(q&255)>>>3&3;if((n|0)==3){t=(m*60|0)/1e3|0;break}else{t=(m<>>5&3;t=(c[e+12>>2]<<((q&255)>>>3&3)|0)/400|0;o=(o|0)==0?1101:o+1102|0;p=1002}while(0);m=((q&4)>>>2)+1|0;n=Wd(f,h,0,x,0,z,y,0)|0;if((n|0)>=0)if((_(n,t)|0)<=(w|0)){q=f+(c[y>>2]|0)|0;c[e+56>>2]=p;c[e+52>>2]=o;c[e+64>>2]=t;c[e+48>>2]=m;m=q;q=0;f=0;while(1){if((q|0)>=(n|0))break;o=z+(q<<1)|0;p=Bc(e,m,b[o>>1]|0,C+((_(f,c[A>>2]|0)|0)<<2)|0,w-f|0,0)|0;if((p|0)<0){n=p;break c}m=m+(b[o>>1]|0)|0;q=q+1|0;f=f+p|0}c[e+72>>2]=f;x=c[A>>2]|0;if((x|0)<1|(f|0)<1)n=f;else{m=_(f,x)|0;n=0;while(1){if((n|0)>=(m|0)){h=0;break}z=C+(n<<2)|0;v=+g[z>>2];h=v>2.0;y=v<-2.0&(h^1);g[z>>2]=y|h?(y?-2.0:2.0):v;n=n+1|0}while(1){if((h|0)==(x|0)){n=f;break c}u=C+(h<<2)|0;w=e+76+(h<<2)|0;l=+g[w>>2];n=0;while(1){if((n|0)>=(f|0))break;m=u+((_(n,x)|0)<<2)|0;r=+g[m>>2];s=r*l;if(s>=0.0)break;g[m>>2]=r+s*r;n=n+1|0}v=+g[u>>2];q=0;while(1){n=q;while(1){if((n|0)>=(f|0))break;s=+g[u+((_(n,x)|0)<<2)>>2];if(s>1.0|s<-1.0)break;n=n+1|0}if((n|0)==(f|0)){l=0.0;break}s=+g[u+((_(n,x)|0)<<2)>>2];l=+N(+s);o=n;while(1){if((o|0)<=0){t=n;r=l;p=n;break}m=o+-1|0;if(!(s*+g[u+((_(m,x)|0)<<2)>>2]>=0.0)){t=n;r=l;p=n;break}else o=m}while(1){if((t|0)>=(f|0))break;l=+g[u+((_(t,x)|0)<<2)>>2];if(!(s*l>=0.0))break;l=+N(+l);y=l>r;z=y?t:p;t=t+1|0;r=y?l:r;p=z}if(!o)n=s*+g[u>>2]>=0.0;else n=0;l=(r+-1.0)/(r*r);l=l+l*2.4e-07;l=s>0.0?-l:l;m=o;while(1){if((m|0)>=(t|0))break;z=u+((_(m,x)|0)<<2)|0;s=+g[z>>2];g[z>>2]=s+l*s*s;m=m+1|0}d:do if(n&(p|0)>1){r=v-+g[u>>2];s=r/+(p|0);m=q;while(1){if((m|0)>=(p|0))break d;E=r-s;z=u+((_(m,x)|0)<<2)|0;F=+g[z>>2]+E;g[z>>2]=F;q=F>1.0;y=F<-1.0&(q^1);g[z>>2]=y|q?(y?-1.0:1.0):F;m=m+1|0;r=E}}while(0);if((t|0)==(f|0))break;else q=t}g[w>>2]=l;h=h+1|0}}}else n=-2}else n=-1;while(0);e:do if((n|0)>0){o=0;while(1){if((o|0)>=(_(n,c[A>>2]|0)|0))break e;l=+g[C+(o<<2)>>2]*32768.0;if(l>-32768.0){if(!(l<32767.0))l=32767.0}else l=-32768.0;m=(g[k>>2]=l,c[k>>2]|0);if((m&2130706432)>>>0<=1249902592){m=(m|0)<0;l=m?l+-8388608.0+8388608.0:l+8388608.0+-8388608.0;if(l==0.0)l=m?-0.0:0.0}b[j+(o<<1)>>1]=~~l;o=o+1|0}}while(0);Na(B|0);j=n;i=D;return j|0}function Dc(a,d,e){a=a|0;d=d|0;e=e|0;var f=0,g=0,h=0,j=0,k=0,l=0,m=0,n=0;m=i;i=i+32|0;g=m+8|0;h=m;k=m+16|0;f=c[a+4>>2]|0;j=a+(c[a>>2]|0)|0;c[k>>2]=e;a:do switch(d|0){case 4009:{l=(c[k>>2]|0)+(4-1)&~(4-1);f=c[l>>2]|0;c[k>>2]=l+4;if(!f)d=26;else{c[f>>2]=c[a+52>>2];f=0;d=25}break}case 4031:{l=(c[k>>2]|0)+(4-1)&~(4-1);f=c[l>>2]|0;c[k>>2]=l+4;if(!f)d=26;else{c[f>>2]=c[a+84>>2];f=0;d=25}break}case 4028:{k=a+f|0;l=a+48|0;f=l;d=f+40|0;do{c[f>>2]=0;f=f+4|0}while((f|0)<(d|0));Xc(j,4028,h);j=0;while(1){if((j|0)==2)break;f=k+(j*4260|0)|0;nf(f|0,0,4260)|0;c[k+(j*4260|0)+2376>>2]=1;c[f>>2]=65536;f=k+(j*4260|0)+2340|0;e=c[f>>2]|0;d=32767/(e+1|0)|0;g=0;h=0;while(1){if((h|0)>=(e|0))break;n=g+d|0;b[k+(j*4260|0)+4052+(h<<1)>>1]=n;e=c[f>>2]|0;g=n;h=h+1|0}c[k+(j*4260|0)+4148>>2]=0;c[k+(j*4260|0)+4152>>2]=3176576;c[k+(j*4260|0)+4168>>2]=c[k+(j*4260|0)+2328>>2]<<7;c[k+(j*4260|0)+4240>>2]=65536;c[k+(j*4260|0)+4244>>2]=65536;c[k+(j*4260|0)+4256>>2]=20;c[k+(j*4260|0)+4252>>2]=2;j=j+1|0}f=k+8520|0;c[f>>2]=0;c[f+4>>2]=0;c[f+8>>2]=0;c[k+8540>>2]=0;c[l>>2]=c[a+8>>2];c[a+64>>2]=(c[a+12>>2]|0)/400|0;f=0;d=25;break}case 4029:{n=(c[k>>2]|0)+(4-1)&~(4-1);f=c[n>>2]|0;c[k>>2]=n+4;if(!f)d=26;else{c[f>>2]=c[a+12>>2];f=0;d=25}break}case 4033:{n=(c[k>>2]|0)+(4-1)&~(4-1);f=c[n>>2]|0;c[k>>2]=n+4;if(f)if((c[a+60>>2]|0)==1002){c[g>>2]=f;Xc(j,4033,g);f=0;d=25;break a}else{c[f>>2]=c[a+36>>2];f=0;d=25;break a}else d=26;break}case 4045:{n=(c[k>>2]|0)+(4-1)&~(4-1);f=c[n>>2]|0;c[k>>2]=n+4;if(!f)d=26;else{c[f>>2]=c[a+40>>2];f=0;d=25}break}case 4034:{n=(c[k>>2]|0)+(4-1)&~(4-1);f=c[n>>2]|0;c[k>>2]=n+4;if((f+32768|0)>>>0>65535)d=26;else{c[a+40>>2]=f;f=0;d=25}break}case 4039:{n=(c[k>>2]|0)+(4-1)&~(4-1);f=c[n>>2]|0;c[k>>2]=n+4;if(!f)d=26;else{c[f>>2]=c[a+72>>2];f=0;d=25}break}default:{f=-5;d=25}}while(0);if((d|0)==25){n=f;i=m;return n|0}else if((d|0)==26){n=-1;i=m;return n|0}return 0}function Ec(a){a=a|0;Ie(a);return}function Fc(a,d,e,f){a=a|0;d=d|0;e=e|0;f=f|0;var h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0,r=0,s=0,t=0;t=i;i=i+32|0;q=t+16|0;p=t+8|0;m=t;a:do if((a|0)<16e3)if((a|0)<12e3)switch(a|0){case 8e3:{s=2;break a}default:break a}else switch(a|0){case 12e3:{s=2;break a}default:break a}else{if((a|0)<24e3)switch(a|0){case 16e3:{s=2;break a}default:break a}if((a|0)<48e3)switch(a|0){case 24e3:{s=2;break a}default:break a}else switch(a|0){case 48e3:{s=2;break a}default:break a}}while(0);b:do if((s|0)==2?(d+-1|0)>>>0<2:0){switch(e|0){case 2048:case 2049:case 2051:break;default:break b}k=d<<12;r=He((d*480|0)+212+k+(d*336|0)+39448|0)|0;if(!r){if(!f){s=0;i=t;return s|0}c[f>>2]=-7;s=0;i=t;return s|0}c:do if((a|0)<16e3)if((a|0)<12e3)switch(a|0){case 8e3:{s=10;break c}default:{h=-1;break c}}else switch(a|0){case 12e3:{s=10;break c}default:{h=-1;break c}}else{if((a|0)<24e3)switch(a|0){case 16e3:{s=10;break c}default:{h=-1;break c}}if((a|0)<48e3)switch(a|0){case 24e3:{s=10;break c}default:{h=-1;break c}}else switch(a|0){case 48e3:{s=10;break c}default:{h=-1;break c}}}while(0);d:do if((s|0)==10)if((d+-1|0)>>>0<2){switch(e|0){case 2048:case 2049:case 2051:break;default:{h=-1;break d}}nf(r|0,0,(d*480|0)+212+k+(d*336|0)+39448|0)|0;c[r+4>>2]=19048;c[r>>2]=39448;n=r+39448|0;c[r+112>>2]=d;c[r+15104>>2]=d;o=r+144|0;c[o>>2]=a;j=r+180|0;c[j>>2]=0;h=r+8|0;if(!(yd(r+19048|0,0,h)|0)){c[h>>2]=d;c[r+12>>2]=d;c[r+16>>2]=c[o>>2];c[r+20>>2]=16e3;c[r+24>>2]=8e3;c[r+28>>2]=16e3;c[r+32>>2]=20;c[r+36>>2]=25e3;c[r+40>>2]=0;l=r+44|0;c[l>>2]=9;c[r+48>>2]=0;c[r+56>>2]=0;c[r+60>>2]=0;c[r+76>>2]=0;h=c[j>>2]|0;nf(n|0,0,(d*480|0)+212+k+(d*336|0)|0)|0;c[n>>2]=5304;c[r+39452>>2]=d;c[r+39456>>2]=d;j=r+39476|0;c[j>>2]=1;c[r+39480>>2]=0;c[r+39484>>2]=21;c[r+39496>>2]=1;c[r+39520>>2]=h;c[r+39500>>2]=1;c[r+39464>>2]=1;c[r+39488>>2]=-1;c[r+39492>>2]=0;c[r+39460>>2]=0;c[r+39472>>2]=5;c[r+39508>>2]=24;Qc(n,4028,m)|0;e:do if((a|0)<16e3)if((a|0)<12e3){switch(a|0){case 8e3:break;default:{s=18;break e}}h=6;break}else{switch(a|0){case 12e3:break;default:{s=18;break e}}h=4;break}else{if((a|0)<24e3){switch(a|0){case 16e3:break;default:{s=18;break e}}h=3;break}if((a|0)>=48e3)switch(a|0){case 48e3:{h=1;break e}default:{s=18;break e}}switch(a|0){case 24e3:break;default:{s=18;break e}}h=2}while(0);if((s|0)==18)h=0;c[j>>2]=h;c[p>>2]=0;Qc(n,10016,p)|0;c[q>>2]=c[l>>2];Qc(n,4010,q)|0;c[r+148>>2]=1;c[r+152>>2]=1;c[r+164>>2]=-1e3;c[r+160>>2]=(_(a,d)|0)+3e3;c[r+108>>2]=e;c[r+124>>2]=-1e3;c[r+128>>2]=-1e3;c[r+132>>2]=1105;c[r+120>>2]=-1e3;c[r+136>>2]=-1e3;c[r+140>>2]=-1;h=c[o>>2]|0;c[r+172>>2]=(h|0)/100|0;c[r+168>>2]=24;c[r+156>>2]=5e3;c[r+116>>2]=(h|0)/250|0;b[r+15108>>1]=16384;g[r+15116>>2]=1.0;c[r+15112>>2]=193536;c[r+15164>>2]=1;c[r+15136>>2]=1001;c[r+15152>>2]=1105;nf(r+188|0,0,14916)|0;h=0}else h=-3}else h=-1;while(0);if(f|0)c[f>>2]=h;if(!h){s=r;i=t;return s|0}Ie(r);s=0;i=t;return s|0}while(0);if(!f){s=0;i=t;return s|0}c[f>>2]=-1;s=0;i=t;return s|0}function Gc(a,c,d,e,f,h,i){a=a|0;c=c|0;d=d|0;e=e|0;f=f|0;h=h|0;i=i|0;var j=0.0,k=0,l=0,m=0;k=0;while(1){if((k|0)>=(d|0))break;g[c+(k<<2)>>2]=+(b[a+((_(k+e|0,i)|0)+f<<1)>>1]|0);k=k+1|0}l=(h|0)>-1;a:do if(!l)if((h|0)==-2){f=1;while(1){if((f|0)<(i|0))k=0;else{f=12;break a}while(1){if((k|0)>=(d|0))break;j=+(b[a+((_(k+e|0,i)|0)+f<<1)>>1]|0);m=c+(k<<2)|0;g[m>>2]=+g[m>>2]+j;k=k+1|0}f=f+1|0}}else f=14;else{f=0;while(1){if((f|0)>=(d|0)){f=12;break a}j=+(b[a+((_(f+e|0,i)|0)+h<<1)>>1]|0);m=c+(f<<2)|0;g[m>>2]=+g[m>>2]+j;f=f+1|0}}while(0);if((f|0)==12)if((h|0)==-2)j=.000030517578125/+(i|0);else f=14;if((f|0)==14)j=l?.0000152587890625:.000030517578125;f=0;while(1){if((f|0)>=(d|0))break;m=c+(f<<2)|0;g[m>>2]=+g[m>>2]*j;f=f+1|0}return}function Hc(a,b,d,e,f,h,j,l){a=a|0;b=b|0;d=d|0;e=e|0;f=f|0;h=h|0;j=j|0;l=l|0;var m=0.0,n=0,o=0.0,p=0.0,q=0,r=0,s=0,t=0.0,u=0.0,v=0,w=0.0,x=0,y=0,z=0,A=0,B=0,C=0,D=0,E=0,F=0.0,G=0.0;E=i;i=i+3296|0;A=E+1760|0;C=E+224|0;D=E+112|0;z=E;r=(e|0)/400|0;s=i;i=i+((1*(r<<2)|0)+15&-16)|0;B=c[h>>2]|0;c[D>>2]=B;g[z>>2]=1.0/((c[k>>2]=B,+g[k>>2])+1.0000000036274937e-15);B=(j|0)==0;if(B){e=b;n=0;q=1}else{n=(r<<1)-j|0;e=c[h+4>>2]|0;c[D+4>>2]=e;g[z+4>>2]=1.0/((c[k>>2]=e,+g[k>>2])+1.0000000036274937e-15);e=c[h+8>>2]|0;c[D+8>>2]=e;g[z+8>>2]=1.0/((c[k>>2]=e,+g[k>>2])+1.0000000036274937e-15);e=b-n|0;q=3}j=(e|0)/(r|0)|0;j=(j|0)<24?j:24;e=0;m=0.0;while(1){if((e|0)>=(j|0))break;b=(_(e,r)|0)+n|0;ac[l&1](a,s,r,b,0,-2,d);b=0;m=(e|0)==0?+g[s>>2]:m;o=1.0000000036274937e-15;while(1){if((b|0)>=(r|0))break;u=+g[s+(b<<2)>>2];w=u-m;b=b+1|0;m=u;o=o+w*w}y=e+q|0;g[D+(y<<2)>>2]=o;g[z+(y<<2)>>2]=1.0/o;e=e+1|0}y=e+q|0;c[D+(y<<2)>>2]=c[D+(y+-1<<2)>>2];if(!B){j=j+2|0;j=(j|0)>24?24:j}x=~~+((d*60|0)+40|0);y=(f|0)/400|0;if((f|0)>=32e3)if((f|0)>64399)w=1.0;else w=+(y+-80|0)/80.0;else w=0.0;e=0;while(1){if((e|0)==16){q=0;break}c[C+(e<<2)>>2]=-1;g[A+(e<<2)>>2]=1.0e10;e=e+1|0}while(1){if((q|0)==4){v=1;break}p=+((y<(j|0)?j:n;b=0;m=0.0;o=0.0;while(1){if((b|0)>(e|0))break;u=o+ +g[z+(b<<2)>>2];t=m+ +g[D+(b<<2)>>2];b=b+1|0;m=t;o=u}v=e+1|0;m=(m*o/+(_(v,v)|0)+-2.0)*.05000000074505806;if(+O(+(m<=0.0?0.0:m))>1.0)m=1.0;else m=+O(+(m<=0.0?0.0:m));g[A+(n<<2)>>2]=p*(w*m+1.0);c[C+(n<<2)>>2]=q;q=q+1|0}while(1){if((j|0)<=(v|0))break;f=v+-1|0;e=2;while(1){if((e|0)==16)break;d=e+-1|0;c[A+(v<<6)+(e<<2)>>2]=c[A+(f<<6)+(d<<2)>>2];c[C+(v<<6)+(e<<2)>>2]=d;e=e+1|0}r=A+(f<<6)+4|0;s=D+(v<<2)|0;l=z+(v<<2)|0;a=j-v|0;u=+(a|0);d=0;while(1){if((d|0)==4)break;q=1<>2]=1;t=+g[r>>2];e=1;while(1){if((e|0)==4)break;e=e+1|0;b=(1<>2];if(!(m>2]=b;t=m}p=+((y<(a|0);e=n?a:q;b=0;m=0.0;o=0.0;while(1){if((b|0)>(e|0))break;F=o+ +g[l+(b<<2)>>2];G=m+ +g[s+(b<<2)>>2];b=b+1|0;m=G;o=F}b=e+1|0;m=(m*o/+(_(b,b)|0)+-2.0)*.05000000074505806;if(+O(+(m<=0.0?0.0:m))>1.0)m=1.0;else m=+O(+(m<=0.0?0.0:m));m=p*(w*m+1.0);e=A+(v<<6)+(q<<2)|0;g[e>>2]=t;if(n)m=m*u/+(q|0);g[e>>2]=t+m;d=d+1|0}v=v+1|0}e=j+-1|0;m=+g[A+(e<<6)+4>>2];b=1;n=2;while(1){if((n|0)==16)break;G=+g[A+(e<<6)+(n<<2)>>2];z=G>2]|0;j=e}e=1<>2]=c[D+(e<<2)>>2];if(B){i=E;return b|0}c[h+4>>2]=c[D+(e+1<<2)>>2];c[h+8>>2]=c[D+(e+2<<2)>>2];i=E;return b|0}function Ic(d,e,f,h,j,l,m,n,o,p,q,r,s){d=d|0;e=e|0;f=f|0;h=h|0;j=j|0;l=l|0;m=m|0;n=n|0;o=o|0;p=p|0;q=q|0;r=r|0;s=s|0;var t=0,u=0,v=0,w=0,x=0.0,y=0.0,z=0,A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0.0,I=0.0,J=0.0,K=0.0,L=0,P=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,Y=0,Z=0,$=0,ba=0,ca=0,da=0,ea=0,fa=0,ga=0,ha=0,ia=0,ja=0,ka=0,la=0,ma=0,na=0,oa=0,pa=0,qa=0,ra=0,sa=0,ta=0,ua=0,va=0,wa=0,xa=0,ya=0,za=0,Aa=0,Ba=0,Ca=0,Da=0,Ea=0,Ga=0,Ha=0,Ia=0,Ja=0,Ka=0,La=0,Ma=0,Oa=0,Pa=0,Qa=0,Ra=0,Sa=0,Ta=0,Ua=0,Va=0,Wa=0,Xa=0,Ya=0,Za=0,_a=0,$a=0,ab=0,bb=0,cb=0,db=0,eb=0,fb=0,gb=0,hb=0,ib=0,jb=0,kb=0,lb=0,mb=0,nb=0,ob=0,pb=0.0,qb=0.0,rb=0.0,sb=0.0,tb=0.0,ub=0.0,vb=0,wb=0;ob=i;i=i+1280|0;fb=ob+832|0;db=ob+824|0;cb=ob+816|0;bb=ob+808|0;ab=ob+800|0;$a=ob+792|0;Ya=ob+784|0;Xa=ob+776|0;Wa=ob+768|0;Va=ob+760|0;mb=ob+456|0;Ta=ob+448|0;Sa=ob+440|0;Ra=ob+432|0;Qa=ob+424|0;Pa=ob+416|0;Oa=ob+408|0;Ma=ob+400|0;La=ob+392|0;za=ob+384|0;ya=ob+376|0;xa=ob+368|0;wa=ob+360|0;va=ob+352|0;sa=ob+344|0;ra=ob+336|0;qa=ob+328|0;ua=ob+320|0;ta=ob+312|0;V=ob+304|0;D=ob;oa=ob+1272|0;_a=ob+1224|0;ib=ob+1220|0;Ba=ob+1216|0;jb=ob+1184|0;U=ob+1152|0;ca=ob+852|0;la=ob+848|0;Ja=ob+840|0;Ua=ob+1278|0;eb=ob+1276|0;c[ib>>2]=0;C=(j|0)>1276?1276:j;lb=d+19044|0;c[lb>>2]=0;pa=d+156|0;if(!(c[pa>>2]|0)){v=f*400|0;u=d+144|0;t=c[u>>2]|0;if((v|0)!=(t|0))if(!((f*200|0)==(t|0)|(f*100|0)==(t|0))?(nb=f*50|0,!((nb|0)==(t|0)|(f*25|0)==(t|0)|(nb|0)==(t*3|0))):0){h=-1;i=ob;return h|0}else{nb=u;u=v}else{nb=u;u=v;t=v}}else{t=d+144|0;nb=t;u=f*400|0;t=c[t>>2]|0}if((u|0)<(t|0)|(C|0)<1){h=-1;i=ob;return h|0}na=d+(c[d+4>>2]|0)|0;Za=d+(c[d>>2]|0)|0;ba=d+108|0;if((c[ba>>2]|0)==2051)Aa=0;else Aa=c[d+116>>2]|0;$=c[d+168>>2]|0;$=($|0)>(l|0)?l:$;c[D>>2]=Ba;Qc(Za,10015,D)|0;c[jb>>2]=0;B=d+44|0;do if((c[B>>2]|0)>6?(c[nb>>2]|0)==48e3:0){v=d+112|0;t=_(c[v>>2]|0,f)|0;u=0;x=0.0;y=0.0;while(1){if((u|0)>=(t|0))break;K=+g[e+(u<<2)>>2];u=u+1|0;x=x>K?x:K;y=yK?x:K)<=1.0/+(1<<$|0)){S=d+19032|0;c[S>>2]=0;u=1;l=-1;w=-1;Ia=1;break}l=c[d+8696>>2]|0;w=c[d+8700>>2]|0;Pc(d+188|0,c[Ba>>2]|0,m,n,f,o,p,q,48e3,$,r,jb);if(+g[jb+28>>2]>.10000000149011612){m=d+19040|0;x=+g[m>>2];u=_(c[v>>2]|0,f)|0;t=0;H=0.0;while(1){if((t|0)>=(u|0))break;K=+g[e+(t<<2)>>2];t=t+1|0;H=H+K*K}x=x*.999;y=+(u|0);if(!(x>H/y)){t=0;x=0.0;while(1){if((t|0)>=(u|0))break;K=+g[e+(t<<2)>>2];t=t+1|0;x=x+K*K}x=x/y}g[m>>2]=x;kb=25}else kb=25}else{l=-1;w=-1;kb=25}while(0);do if((kb|0)==25){c[d+140>>2]=-1;u=c[jb>>2]|0;v=d+19032|0;c[v>>2]=0;u=(u|0)==0;if(!u){if((c[d+124>>2]|0)==-1e3)c[d+140>>2]=~~+M(+((1.0-+g[jb+20>>2])*100.0+.5));t=c[jb+24>>2]|0;if((t|0)<13){c[v>>2]=1101;S=v;Ia=0;break}if((t|0)<15){c[v>>2]=1102;S=v;Ia=0;break}if((t|0)<17){c[v>>2]=1103;S=v;Ia=0;break}if((t|0)<19){c[v>>2]=1104;S=v;Ia=0;break}else{c[v>>2]=1105;S=v;Ia=0;break}}else{S=v;Ia=0}}while(0);gb=d+112|0;z=c[gb>>2]|0;A=(z|0)==2;if(A?(c[d+120>>2]|0)!=1:0){n=(c[nb>>2]|0)/(f|0)|0;t=(n|0)<50;x=25.0/+(n|0);v=f+-3|0;m=0;y=0.0;H=0.0;I=0.0;while(1){if((m|0)>=(v|0))break;hb=m<<1;ub=+g[e+(hb<<2)>>2];qb=+g[e+((hb|1)<<2)>>2];tb=+g[e+((hb|2)<<2)>>2];pb=+g[e+((hb|3)<<2)>>2];sb=+g[e+((hb|4)<<2)>>2];J=+g[e+((hb|5)<<2)>>2];rb=+g[e+((hb|6)<<2)>>2];K=+g[e+((hb|7)<<2)>>2];m=m+4|0;y=y+(ub*ub+tb*tb+sb*sb+rb*rb);H=H+(ub*qb+tb*pb+sb*J+rb*K);I=I+(qb*qb+pb*pb+J*J+K*K)}ub=t?.5:1.0-x;Ka=d+15172|0;x=+g[Ka>>2];x=x+ub*(y-x);g[Ka>>2]=x;t=d+15176|0;y=+g[t>>2];y=y+ub*(H-y);g[t>>2]=y;hb=d+15180|0;H=+g[hb>>2];H=H+ub*(I-H);g[hb>>2]=H;x=x<0.0?0.0:x;g[Ka>>2]=x;y=y<0.0?0.0:y;g[t>>2]=y;H=H<0.0?0.0:H;g[hb>>2]=H;if((x>H?x:H)>7.999999797903001e-04){sb=+O(+x);ub=+O(+H);x=+O(+sb);tb=+O(+ub);ub=sb*ub;sb=y>2]=sb;ub=sb/(ub+1.0000000036274937e-15);tb=+O(+(1.0-ub*ub))*(+N(+(x-tb))/(x+1.0000000036274937e-15+tb));hb=d+15184|0;x=+g[hb>>2];ub=+(n|0);x=x+(tb-x)/ub;g[hb>>2]=x;hb=d+15188|0;ub=+g[hb>>2]-.019999999552965164/ub;x=ub>x?ub:x;g[hb>>2]=x}else x=+g[d+15188>>2];x=x*20.0;if(x>1.0)x=1.0}else x=0.0;if(!f)t=(c[nb>>2]|0)/400|0;else t=f;v=c[d+164>>2]|0;switch(v|0){case -1e3:{G=c[nb>>2]|0;v=((G*60|0)/(t|0)|0)+(_(G,z)|0)|0;break}case -1:{G=c[nb>>2]|0;v=(_(C<<3,G)|0)/(t|0)|0;break}default:G=c[nb>>2]|0}Ga=d+160|0;c[Ga>>2]=v;t=(G|0)/(f|0)|0;hb=d+148|0;P=(c[hb>>2]|0)==0;if(P){L=(G*3|0)/(f|0)|0;Ka=(((v*3|0)/8|0)+((L|0)/2|0)|0)/(L|0)|0;Ka=(Ka|0)<(C|0)?Ka:C;L=((_(Ka,L)|0)<<3|0)/3|0;c[Ga>>2]=L}else{L=v;Ka=C}do if(!((Ka|0)<3|(L|0)<(t*24|0))){if((t|0)<50){v=_(Ka,t)|0;if((v|0)<300|(L|0)<2400)break;else ga=v}else ga=_(t,Ka)|0;ha=ga<<3;E=c[B>>2]|0;R=d+40|0;F=c[R>>2]|0;B=t+-50|0;v=L-(_((z*40|0)+20|0,B)|0)|0;if(P)v=v-((v|0)/12|0)|0;C=E+90|0;m=(_(v,C)|0)/100|0;D=(F*12|0)+20|0;m=m-((_(m,F)|0)/(D|0)|0)|0;v=c[d+124>>2]|0;do if((v|0)!=3001)if((v|0)!=3002){v=c[d+140>>2]|0;if((v|0)>-1){Q=v*327>>8;Q=(c[ba>>2]|0)!=2049|(Q|0)<115?Q:115;break}else{Q=(c[ba>>2]|0)==2048?115:48;break}}else Q=0;else Q=127;while(0);T=d+120|0;v=c[T>>2]|0;Ha=d+15104|0;do if((v|0)==-1e3|A^1)if(A){z=(m|0)>(((c[Ha>>2]|0)==2?23e3:25e3)|0)?2:1;c[Ha>>2]=z;break}else{c[Ha>>2]=z;break}else{c[Ha>>2]=v;z=v}while(0);v=L-(_((z*40|0)+20|0,B)|0)|0;if(P)v=v-((v|0)/12|0)|0;n=(_(v,C)|0)/100|0;n=n-((_(n,F)|0)/(D|0)|0)|0;m=c[ba>>2]|0;do if((m|0)!=2051){v=c[d+136>>2]|0;do if((v|0)==-1e3){ub=1.0-x;v=~~(ub*16.0e3+x*16.0e3);v=v+((_(_(Q,Q)|0,~~(ub*64.0e3+x*36.0e3)-v|0)|0)>>14)|0;v=(m|0)==2048?v+8e3|0:v;m=c[d+15140>>2]|0;if((m|0)==1002)v=v+-4e3|0;else v=(m|0)>0?v+4e3|0:v;v=(n|0)>=(v|0)?1002:1e3;m=d+15136|0;c[m>>2]=v;do if(c[d+48>>2]|0){if((F|0)<=(128-Q>>4|0))break;c[m>>2]=1e3;v=1e3}while(0);if(!(c[d+184>>2]|0)){c[d+56>>2]=0;u=m;kb=112;break}if(!u){c[d+56>>2]=0;u=m;kb=112;break}c[d+56>>2]=Ia^1;if(!((Ia|0)==0&(Q|0)>100)){u=m;kb=112;break}c[m>>2]=1e3;u=m;v=1e3}else{u=d+15136|0;c[u>>2]=v;kb=112}while(0);if((kb|0)==112)if((v|0)==1002){Ea=u;u=1002;break}if(((G|0)/100|0|0)>(f|0)){c[u>>2]=1002;Ea=u;u=1002}else{Ea=u;u=v}}else{Ea=d+15136|0;c[Ea>>2]=1002;u=1002}while(0);Y=d+176|0;if(c[Y>>2]|0){c[Ea>>2]=1002;u=1002}da=(t|0)>50;if((Ka|0)<((_(da?9e3:6e3,f)|0)/(G<<3|0)|0|0)){c[Ea>>2]=1002;u=1002}do if((z|0)==1?(c[d+15144>>2]|0)==2:0){v=d+68|0;if((c[v>>2]|0)!=0|(u|0)==1002){kb=124;break}m=d+15140|0;if((c[m>>2]|0)==1002){kb=124;break}c[v>>2]=1;c[Ha>>2]=2;Ca=m;m=2}else kb=124;while(0);if((kb|0)==124){c[d+68>>2]=0;Ca=d+15140|0;m=z}A=c[Ca>>2]|0;do if((A|0)>0){v=(u|0)==1002;if((A|0)==1002&(v^1)){Da=(u|0)!=1002;v=Da&1;if(Da){n=v;v=1;Da=0;break}}else{if(!v){n=0;v=0;Da=0;break}if((A|0)==1002){u=1002;n=0;v=0;Da=0;break}v=(u|0)!=1002&1}if(((G|0)/100|0|0)>(f|0)){u=1002;n=v;v=0;Da=0;break}c[Ea>>2]=A;u=A;n=v;v=1;Da=1}else{n=0;v=0;Da=0}while(0);m=L-(_((m*40|0)+20|0,B)|0)|0;if(P)m=m-((m|0)/12|0)|0;m=(_(m,C)|0)/100|0;a:do switch(u|0){case 1001:case 1e3:{if((E|0)<2)m=(m<<2|0)/5|0;ia=m-((_(m,F)|0)/((F*6|0)+10|0)|0)|0;break}case 1002:{if((E|0)>=5){ia=m;break a}ia=(m*9|0)/10|0;break}default:ia=m-((_(m,F)|0)/(D|0)|0)|0}while(0);ja=d+15160|0;if(!(c[ja>>2]|0))if(!v){ea=n;m=0;v=0;fa=0}else{m=0;kb=145}else{c[ja>>2]=0;n=1;m=1;v=1;kb=145}do if((kb|0)==145){z=(G|0)/200|0;z=(_(Ka,z)|0)/(z+f|0)|0;z=(z|0)>257?257:z;if(P){ea=n;fa=z;break}fa=(L|0)/1600|0;ea=n;fa=(z|0)<(fa|0)?z:fa}while(0);if((u|0)!=1002&(A|0)==1002){u=c[d+180>>2]|0;nf(na|0,0,20400)|0;m=0;while(1){if((m|0)==2)break;Fd(na+(m*10156|0)|0,u)|0;m=m+1|0}c[na+20376>>2]=1;c[na+20380>>2]=1;Z=1}else Z=m;B=(c[Ea>>2]|0)==1002;do if(B)kb=156;else{if(c[d+15164>>2]|0){kb=156;break}if(c[d+84>>2]|0){kb=156;break}m=d+15152|0;P=m;m=c[m>>2]|0}while(0);do if((kb|0)==156){if((c[gb>>2]|0)==2?(c[T>>2]|0)!=1:0){n=616;z=616}else{n=616;z=616}u=_(Q,Q)|0;m=0;while(1){if((m|0)==8)break;ma=c[n+(m<<2)>>2]|0;c[U+(m<<2)>>2]=ma+((_(u,(c[z+(m<<2)>>2]|0)-ma|0)|0)>>14);m=m+1|0}A=(c[d+15164>>2]|0)==0;z=d+15156|0;m=1105;do{n=m<<1;u=c[U+(n+-2204<<2)>>2]|0;n=c[U+(n+-2203<<2)>>2]|0;do if(A)if((c[z>>2]|0)<(m|0)){u=u+n|0;break}else{u=u-n|0;break}while(0);if((ia|0)>=(u|0))break;m=m+-1|0}while((m|0)>1101);c[z>>2]=m;u=d+15152|0;c[u>>2]=m;if(B|A^1){P=u;break}if(!((c[d+88>>2]|0)==0&(m|0)>1103)){P=u;break}c[u>>2]=1103;P=u;m=1103}while(0);u=c[d+132>>2]|0;if((m|0)>(u|0))c[P>>2]=u;else u=m;L=d+128|0;m=c[L>>2]|0;z=(m|0)==-1e3;if(!z){c[P>>2]=m;u=m}if((ha|0)<15e3&(B^1)){u=(u|0)<1103?u:1103;c[P>>2]=u}m=c[nb>>2]|0;if((m|0)<24001&(u|0)>1104){c[P>>2]=1104;u=1104}if((m|0)<16001&(u|0)>1103){c[P>>2]=1103;u=1103}if((m|0)<12001&(u|0)>1102){c[P>>2]=1102;u=1102}if((m|0)<8001&(u|0)>1101){c[P>>2]=1101;u=1101}n=c[S>>2]|0;if(!((n|0)==0|z^1)){m=c[Ha>>2]|0;do if((ia|0)>(m*18e3|0)|B^1){if(!((ia|0)>(m*24e3|0)|B^1)){m=1102;break}if((ia|0)<=(m*3e4|0)){m=1103;break}m=(ia|0)>(m*44e3|0)?1105:1104}else m=1101;while(0);ma=(n|0)>(m|0)?n:m;c[S>>2]=ma;u=(u|0)<(ma|0)?u:ma;c[P>>2]=u}D=c[R>>2]|0;Q=d+52|0;E=c[Q>>2]|0;b:do if((c[d+48>>2]|0)==0|(D|0)==0|B)u=0;else{z=(D|0)<25;A=125-D|0;B=(D|0)<6;C=u;while(1){n=C<<1;m=c[648+(n+-2202<<2)>>2]|0;n=c[648+(n+-2201<<2)>>2]|0;switch(E|0){case 1:{m=m-n|0;break}case 0:{m=m+n|0;break}default:{}}ma=((_(m,z?A:100)|0)>>16)*655|0;m=(ma+((((_(m,z?125-D|0:100)|0)&65535)*655|0)>>>16)|0)<(ia|0);if(m|B){u=m&1;break b}if((C|0)<=1101)break;ma=C+-1|0;c[P>>2]=ma;C=ma}c[P>>2]=u;u=0}while(0);c[Q>>2]=u;c[V>>2]=$;Qc(Za,4036,V)|0;m=c[Ea>>2]|0;u=(m|0)==1002;do if(u){if((c[P>>2]|0)!=1102)break;c[P>>2]=1103}while(0);if(c[Y>>2]|0)c[P>>2]=1101;n=c[nb>>2]|0;do if(((n|0)/50|0|0)<(f|0)){if(!u?(W=c[P>>2]|0,(W|0)<=1103):0){L=W;break}if((l|0)!=-1){c[d+8696>>2]=l;c[d+8700>>2]=w}B=((n|0)/25|0|0)<(f|0)?3:2;m=(j+-3|0)/(B|0)|0;m=(m|0)>1276?1276:m;C=_(B,m)|0;G=Fa()|0;n=i;i=i+((1*C|0)+15&-16)|0;c[ca+4>>2]=0;C=d+136|0;D=c[C>>2]|0;E=c[L>>2]|0;F=c[T>>2]|0;c[C>>2]=c[Ea>>2];c[L>>2]=c[P>>2];t=c[Ha>>2]|0;c[T>>2]=t;z=d+68|0;A=c[z>>2]|0;if(!A)c[d+15144>>2]=t;else c[T>>2]=1;t=(Da|0)!=0;u=B+-1|0;w=0;while(1){if((w|0)>=(B|0)){kb=222;break}c[z>>2]=0;if(t&(w|0)==(u|0))c[C>>2]=1002;l=c[nb>>2]|0;v=n+(_(w,m)|0)|0;l=Ic(d,e+((_(w,(_(c[gb>>2]|0,l)|0)/50|0)|0)<<2)|0,(l|0)/50|0,v,m,$,0,0,o,p,q,r,s)|0;if((l|0)<0){t=-3;break}if((Nc(ca,v,l)|0)<0){t=-3;break}w=w+1|0}do if((kb|0)==222){u=(c[hb>>2]|0)==0;if(u){t=((c[Ga>>2]|0)*3|0)/(1200/(B>>>0)|0|0)|0;t=(t|0)<(j|0)?t:j}else t=j;t=Oc(ca,B,h,t,u&1)|0;if((t|0)<0){t=-3;break}c[C>>2]=D;c[L>>2]=E;c[T>>2]=F;c[z>>2]=A}while(0);Na(G|0);h=t;i=ob;return h|0}else L=c[P>>2]|0;while(0);do if((m|0)==1e3){if((L|0)<=1103)break;c[Ea>>2]=1001}else{if(!((m|0)==1001&(L|0)<1104))break;c[Ea>>2]=1e3}while(0);ca=Ka-fa|0;n=(_(c[Ga>>2]|0,f)|0)/(n<<3|0)|0;n=((ca|0)<(n|0)?ca:n)+-1|0;ca=h+1|0;q=Ka+-1|0;c[_a>>2]=ca;o=_a+8|0;c[o>>2]=0;c[_a+12>>2]=0;c[_a+16>>2]=0;ka=_a+20|0;c[ka>>2]=33;T=_a+24|0;c[T>>2]=0;j=_a+28|0;c[j>>2]=-2147483648;U=_a+40|0;c[U>>2]=-1;V=_a+32|0;c[V>>2]=0;W=_a+36|0;c[W>>2]=0;p=_a+4|0;c[p>>2]=q;$=_a+44|0;c[$>>2]=0;S=Aa+f|0;R=_(S,c[gb>>2]|0)|0;ma=Fa()|0;r=i;i=i+((1*(R<<2)|0)+15&-16)|0;R=d+172|0;C=c[gb>>2]|0;B=_(Aa,C)|0;rf(r|0,d+15192+((_((c[R>>2]|0)-Aa|0,C)|0)<<2)|0,B<<2|0)|0;D=(c[Ea>>2]|0)==1002;if(D)u=193536;else u=c[na+8>>2]|0;G=d+15112|0;F=c[G>>2]|0;u=u-F|0;u=F+(((u>>16)*983|0)+(((u&65535)*983|0)>>>16))|0;c[G>>2]=u;c:do if((c[ba>>2]|0)==2048){w=u>>8;do if((w|0)<0)u=0;else{if((w|0)>3966){u=2147483647;break}u=u>>15;m=1<>16)<>7;else u=_(m>>7,l+((_(_(l,128-l|0)|0,-174)|0)>>16)|0)|0;u=m+u|0}while(0);A=r+(B<<2)|0;w=d+15120|0;z=((u<<16>>16)*2471|0)/((c[nb>>2]|0)/1e3|0|0)|0;u=_(z,-471)|0;l=u+268435456|0;ba=l>>6;E=l>>22;m=z<<16>>16;vb=_(z>>16,m)|0;m=_(z&65535,m)|0;z=_(z,(z>>15)+1>>1)|0;wb=vb+(m>>>16)+z<<16>>16;F=ba&65535;G=ba<<16>>16;x=+((_(E,wb)|0)+((_(F,wb)|0)>>16)+(_(ba,(vb+(m>>16)+z+-8388608>>15)+1>>1)|0)|0)*3.725290298461914e-09;y=+((_(E,G)|0)+((_(F,G)|0)>>16)+(_(ba,(l>>21)+1>>1)|0)|0)*3.725290298461914e-09;H=+(l|0)*3.725290298461914e-09;I=+(-268435456-u<<1|0)*3.725290298461914e-09;u=d+15124|0;l=0;while(1){if((l|0)>=(f|0))break;wb=_(l,C)|0;sb=+g[e+(wb<<2)>>2];tb=H*sb;ub=+g[w>>2]+tb;g[w>>2]=+g[u>>2]-ub*x+I*sb;g[u>>2]=tb-ub*y+1.0000000031710769e-30;g[A+(wb<<2)>>2]=ub;l=l+1|0}if((C|0)!=2)break;m=e+4|0;z=d+15128|0;u=A+4|0;l=d+15132|0;w=0;while(1){if((w|0)>=(f|0))break c;wb=w<<1;sb=+g[m+(wb<<2)>>2];tb=H*sb;ub=+g[z>>2]+tb;g[z>>2]=+g[l>>2]-ub*x+I*sb;g[l>>2]=tb-ub*y+1.0000000031710769e-30;g[u+(wb<<2)>>2]=ub;w=w+1|0}}else{m=r+(B<<2)|0;z=d+15120|0;J=12.0/+(c[nb>>2]|0);K=1.0-J;y=+g[z>>2];A=d+15124|0;x=+g[A>>2];if((C|0)!=2){u=0;while(1){if((u|0)>=(f|0))break;tb=+g[e+(u<<2)>>2];ub=tb-y;g[m+(u<<2)>>2]=ub-x;u=u+1|0;y=J*tb+1.0000000031710769e-30+K*y;x=J*ub+1.0000000031710769e-30+K*x}g[z>>2]=y;g[A>>2]=x;break}u=d+15128|0;l=d+15132|0;w=0;H=+g[u>>2];I=+g[l>>2];while(1){if((w|0)>=(f|0))break;vb=w<<1;rb=+g[e+(vb<<2)>>2];wb=vb|1;tb=+g[e+(wb<<2)>>2];sb=rb-y;ub=tb-H;g[m+(vb<<2)>>2]=sb-x;g[m+(wb<<2)>>2]=ub-I;w=w+1|0;y=J*rb+1.0000000031710769e-30+K*y;x=J*sb+1.0000000031710769e-30+K*x;H=J*tb+1.0000000031710769e-30+K*H;I=J*ub+1.0000000031710769e-30+K*I}g[z>>2]=y;g[A>>2]=x;g[u>>2]=H;g[l>>2]=I}while(0);do if(s|0){u=r+(B<<2)|0;l=_(C,f)|0;w=0;x=0.0;while(1){if((w|0)>=(l|0))break;ub=+g[u+(w<<2)>>2];w=w+1|0;x=x+ub*ub}if(!(!(x<1.0e9)|(x!=x|0.0!=0.0)))break;nf(u|0,0,l<<2|0)|0;wb=d+15120|0;c[wb>>2]=0;c[wb+4>>2]=0;c[wb+8>>2]=0;c[wb+12>>2]=0}while(0);do if(D){y=1.0;D=ea;kb=353}else{m=_(C,f)|0;G=Fa()|0;F=i;i=i+((1*(m<<1)|0)+15&-16)|0;m=_(n<<3,t)|0;D=c[Ea>>2]|0;E=(D|0)==1001;do if(!E){c[d+36>>2]=m;t=c[d+15168>>2]|0;if(!t){B=m;y=1.0}else{I=1.0;kb=275}}else{w=c[hb>>2]|0;u=((c[nb>>2]|0)==(f*50|0)?2:1)+(c[Q>>2]<<1)|0;l=1;while(1){if((l|0)>=7){kb=268;break}t=c[688+(l*20|0)>>2]|0;if((t|0)>(m|0)){kb=271;break}l=l+1|0}do if((kb|0)==268)if((l|0)==7){t=(c[808+(u<<2)>>2]|0)+((m+-64e3|0)/2|0)|0;break}else{t=c[688+(l*20|0)>>2]|0;kb=271;break}while(0);if((kb|0)==271){vb=l+-1|0;wb=c[688+(vb*20|0)>>2]|0;t=((_(c[688+(vb*20|0)+(u<<2)>>2]|0,t-m|0)|0)+(_(c[688+(l*20|0)+(u<<2)>>2]|0,m-wb|0)|0)|0)/(t-wb|0)|0}u=(w|0)==0?t+100|0:t;u=(L|0)==1104?u+300|0:u;c[d+36>>2]=u;t=c[d+15168>>2]|0;if(t|0){m=u;I=1.0;kb=275;break}B=u;y=1.0-+X(+(+(u-m|0)*.0009765625*.6931471805599453))}while(0);do if((kb|0)==275){if(!(c[hb>>2]|0)){B=m;y=I;break}if(c[Y>>2]|0){B=m;y=I;break}C=c[P>>2]|0;if((C|0)==1101){A=13;H=8.0e3}else{wb=(C|0)==1102;A=wb?15:17;H=wb?12.0e3:16.0e3}l=c[gb>>2]|0;z=0;x=0.0;while(1){if((z|0)>=(l|0))break;w=z*21|0;B=0;while(1){if((B|0)>=(A|0))break;y=+g[t+(w+B<<2)>>2];u=y<.5;do if(y>-2.0|u^1){if(u){if(!(y>0.0))break}else y=.5;y=y*.5}else y=-2.0;while(0);B=B+1|0;x=x+y}z=z+1|0}wb=~~(H*(x/+(A|0)*+(l|0)+.20000000298023224));u=(_(m,-2)|0)/3|0;u=(wb|0)>(u|0)?wb:u;if((C&-2|0)==1104)t=(u*3|0)/5|0;else t=u;B=m+t|0;c[d+36>>2]=B;wb=_(u,f)|0;y=I;n=n+((wb|0)/(c[nb>>2]<<3|0)|0)|0}while(0);C=c[nb>>2]|0;c[d+32>>2]=(f*1e3|0)/(C|0)|0;l=c[gb>>2]|0;c[d+8>>2]=l;c[d+12>>2]=c[Ha>>2];switch(L|0){case 1101:{c[d+28>>2]=8e3;t=8e3;break}case 1102:{c[d+28>>2]=12e3;t=12e3;break}default:{c[d+28>>2]=16e3;t=16e3}}c[d+24>>2]=E?16e3:8e3;m=d+20|0;c[m>>2]=16e3;do if((D|0)==1e3){if(da)w=(ga<<4|0)/3|0;else w=ha;if((w|0)>=8e3)break;c[m>>2]=12e3;u=d+28|0;t=t>>>0>12e3?12e3:t;c[u>>2]=t;if((w|0)>=7e3)break;c[m>>2]=8e3;c[u>>2]=(t|0)>8e3?8e3:t}while(0);z=(c[hb>>2]|0)==0;c[d+60>>2]=z&1;t=q-fa|0;t=(t|0)>1275?1275:t;c[oa>>2]=t;t=t<<3;A=d+64|0;c[A>>2]=t;do if(z){if(!E)break;c[A>>2]=(_(B,f)|0)/(C|0)|0}else{if(!E)break;m=(_(t,C)|0)/(f|0)|0;u=((C|0)==(f*50|0)?2:1)+(c[Q>>2]<<1)|0;w=1;while(1){if((w|0)>=7){kb=310;break}t=c[688+(w*20|0)>>2]|0;if((t|0)>(m|0)){kb=313;break}w=w+1|0}do if((kb|0)==310)if((w|0)==7){t=(c[808+(u<<2)>>2]|0)+((m+-64e3|0)/2|0)|0;break}else{t=c[688+(w*20|0)>>2]|0;kb=313;break}while(0);if((kb|0)==313){vb=w+-1|0;wb=c[688+(vb*20|0)>>2]|0;t=((_(c[688+(vb*20|0)+(u<<2)>>2]|0,t-m|0)|0)+(_(c[688+(w*20|0)+(u<<2)>>2]|0,m-wb|0)|0)|0)/(t-wb|0)|0}wb=z?t+100|0:t;c[A>>2]=(_((L|0)==1104?wb+300|0:wb,f)|0)/(C|0)|0}while(0);if(Z){c[la>>2]=0;wb=(C|0)/400|0;u=_(l,(c[R>>2]|0)-(c[d+116>>2]|0)-wb|0)|0;vb=d+15192+(u<<2)|0;w=c[Ba>>2]|0;Jc(vb,vb,0.0,1.0,c[w+4>>2]|0,wb,l,c[w+60>>2]|0,C);nf(d+15192|0,0,u<<2|0)|0;u=c[R>>2]|0;l=_(u,c[gb>>2]|0)|0;w=0;while(1){if((w|0)>=(l|0))break;x=+g[d+15192+(w<<2)>>2]*32768.0;do if(x>-32768.0){if(x<32767.0)break;x=32767.0}else x=-32768.0;while(0);t=(g[k>>2]=x,c[k>>2]|0);do if((t&2130706432)>>>0<=1249902592){t=(t|0)<0;x=t?x+-8388608.0+8388608.0:x+8388608.0+-8388608.0;if(!(x==0.0))break;x=t?-0.0:0.0}while(0);b[F+(w<<1)>>1]=~~x;w=w+1|0}zd(na,d+8|0,F,u,0,la,1)|0;l=c[gb>>2]|0}u=_(l,f)|0;w=0;while(1){if((w|0)>=(u|0))break;x=+g[r+((_(Aa,l)|0)+w<<2)>>2]*32768.0;do if(x>-32768.0){if(x<32767.0)break;x=32767.0}else x=-32768.0;while(0);t=(g[k>>2]=x,c[k>>2]|0);do if((t&2130706432)>>>0<=1249902592){t=(t|0)<0;x=t?x+-8388608.0+8388608.0:x+8388608.0+-8388608.0;if(!(x==0.0))break;x=t?-0.0:0.0}while(0);b[F+(w<<1)>>1]=~~x;w=w+1|0}if(!(zd(na,d+8|0,F,f,_a,oa,0)|0)){if(c[oa>>2]|0){do if((c[Ea>>2]|0)==1e3){t=c[d+80>>2]|0;if((t|0)==8e3){u=1101;break}if((t|0)==12e3){u=1102;break}u=(t|0)==16e3?1103:L}else u=L;while(0);wb=c[d+96>>2]|0;c[d+72>>2]=wb;if(!wb)t=ea;else{c[ja>>2]=1;t=0;v=1}Na(G|0);D=t;L=u;kb=353;break}c[lb>>2]=0;v=c[Ea>>2]|0;l=c[Ha>>2]|0;t=(c[nb>>2]|0)/(f|0)|0;u=0;while(1){if((t|0)>=400)break;t=t<<1;u=u+1|0}switch(v|0){case 1e3:{t=(L<<5)+96&224|(u<<3)+-16;break}case 1002:{t=((L|0)<1102?0:(L<<5)+64&96)|u<<3|128;break}default:t=L<<4|(u<<3)+240|96}a[h>>0]=t|((l|0)==2&1)<<2;t=1}else t=-3;Na(G|0)}while(0);d:do if((kb|0)==353){switch(L|0){case 1101:{t=13;break}case 1103:case 1102:{t=17;break}case 1104:{t=19;break}default:t=21}c[ta>>2]=t;Qc(Za,10012,ta)|0;c[ua>>2]=c[Ha>>2];Qc(Za,10008,ua)|0;c[qa>>2]=-1;Qc(Za,4002,qa)|0;do if((c[Ea>>2]|0)==1e3){l=c[gb>>2]|0;n=((_(l,c[nb>>2]|0)|0)/400|0)<<2;m=i;i=i+((1*n|0)+15&-16)|0;n=0}else{c[ra>>2]=0;Qc(Za,4006,ra)|0;c[sa>>2]=(c[d+76>>2]|0)==0?2:0;Qc(Za,10002,sa)|0;do if((c[Ea>>2]|0)==1001){t=(c[ka>>2]|0)+((aa(c[j>>2]|0)|0)+-32)+7>>3;t=(v|0)==0?t:t+3|0;if(!(c[hb>>2]|0)){n=(t|0)>(n|0)?t:n;break}else{c[va>>2]=(c[Ga>>2]|0)-(c[d+36>>2]|0);Qc(Za,4002,va)|0;c[wa>>2]=0;Qc(Za,4020,wa)|0;n=q-fa|0;break}}else{if(!(c[hb>>2]|0))break;do if((c[pa>>2]|0)==5010){t=c[nb>>2]|0;if(((t|0)/50|0|0)==(f|0)){t=0;break}t=_(((c[Ha>>2]|0)*60|0)+40|0,((t|0)/(f|0)|0)+-50|0)|0;if(!(c[jb>>2]|0))break;t=~~(+(t|0)*(+g[jb+4>>2]*.5+1.0))}else t=0;while(0);c[xa>>2]=1;Qc(Za,4006,xa)|0;c[ya>>2]=c[d+152>>2];Qc(Za,4020,ya)|0;c[za>>2]=(c[Ga>>2]|0)+t;Qc(Za,4002,za)|0;n=q-fa|0}while(0);t=c[Ea>>2]|0;u=c[gb>>2]|0;l=c[nb>>2]|0;w=(_(u,l)|0)/400|0;m=i;i=i+((1*(w<<2)|0)+15&-16)|0;if((t|0)==1e3){l=u;break}wb=c[Ca>>2]|0;if(!((t|0)!=(wb|0)&(wb|0)>0)){l=u;break}rf(m|0,d+15192+((_((c[R>>2]|0)-Aa-((l|0)/400|0)|0,u)|0)<<2)|0,w<<2|0)|0;l=u}while(0);t=c[R>>2]|0;u=d+15192|0;if((_(l,t-S|0)|0)>0){wb=_(l,t-f-Aa|0)|0;sf(u|0,d+15192+((_(l,f)|0)<<2)|0,wb<<2|0)|0;rf(d+15192+(wb<<2)|0,r|0,(_(S,l)|0)<<2|0)|0}else rf(u|0,r+((_(S-t|0,l)|0)<<2)|0,(_(t,l)|0)<<2|0)|0;t=d+15116|0;x=+g[t>>2];if(x<1.0|y<1.0){wb=c[Ba>>2]|0;Jc(r,r,x,y,c[wb+4>>2]|0,f,c[gb>>2]|0,c[wb+60>>2]|0,c[nb>>2]|0)}g[t>>2]=y;B=c[Ea>>2]|0;C=(B|0)==1001;if(!(C?(c[Ha>>2]|0)!=1:0)){if((ia|0)>=24e3){t=ia+-24e3|0;if((t<<1|0)>16384)t=16384;else kb=381}else{t=0;kb=381}if((kb|0)==381)t=t<<1;c[d+92>>2]=t}do if(!(c[d+15168>>2]|0)){if((c[gb>>2]|0)!=2)break;A=d+15108|0;t=b[A>>1]|0;z=c[d+92>>2]|0;if(!(t<<16>>16<16384|(z|0)<16384))break;w=c[Ba>>2]|0;u=c[w+60>>2]|0;l=48e3/(c[nb>>2]|0)|0;w=(c[w+4>>2]|0)/(l|0)|0;x=1.0-+(t<<16>>16)*.00006103515625;y=1.0-+(z|0)*.00006103515625;t=0;while(1){if((t|0)>=(w|0))break;ub=+g[u+((_(t,l)|0)<<2)>>2];ub=ub*ub;wb=t<<1;vb=r+(wb<<2)|0;sb=+g[vb>>2];wb=r+((wb|1)<<2)|0;tb=+g[wb>>2];ub=(ub*y+(1.0-ub)*x)*((sb-tb)*.5);g[vb>>2]=sb-ub;g[wb>>2]=tb+ub;t=t+1|0}while(1){if((t|0)>=(f|0))break;wb=t<<1;vb=r+(wb<<2)|0;sb=+g[vb>>2];wb=r+((wb|1)<<2)|0;tb=+g[wb>>2];ub=y*((sb-tb)*.5);g[vb>>2]=sb-ub;g[wb>>2]=tb+ub;t=t+1|0}b[A>>1]=z}while(0);e:do if((B|0)==1002)kb=456;else{u=c[ka>>2]|0;t=c[j>>2]|0;l=u+((aa(t|0)|0)+-32)|0;if((l+17+(C?20:0)|0)>((Ka<<3)+-8|0)){kb=456;break}f:do if(C){if(!v){if((l+37|0)>(n<<3|0)){kb=456;break e}t=t-(t>>>12)|0}else{wb=t>>>12;c[V>>2]=(c[V>>2]|0)+(t-wb);t=wb}c[j>>2]=t;while(1){if(t>>>0>=8388609){l=t;w=u;break f}l=c[V>>2]|0;w=l>>>23;if((w|0)==255)c[W>>2]=(c[W>>2]|0)+1;else{l=l>>>31;t=c[U>>2]|0;if((t|0)>-1){u=c[T>>2]|0;if((u+(c[o>>2]|0)|0)>>>0<(c[p>>2]|0)>>>0){c[T>>2]=u+1;a[(c[_a>>2]|0)+u>>0]=t+l;t=0}else t=-1;c[$>>2]=c[$>>2]|t}t=c[W>>2]|0;if(t|0){l=l+255&255;do{u=c[T>>2]|0;if((u+(c[o>>2]|0)|0)>>>0<(c[p>>2]|0)>>>0){c[T>>2]=u+1;a[(c[_a>>2]|0)+u>>0]=l;u=0;t=c[W>>2]|0}else u=-1;c[$>>2]=c[$>>2]|u;t=t+-1|0;c[W>>2]=t}while((t|0)!=0)}c[U>>2]=w&255;l=c[V>>2]|0;t=c[j>>2]|0;u=c[ka>>2]|0}c[V>>2]=l<<8&2147483392;t=t<<8;c[j>>2]=t;u=u+8|0;c[ka>>2]=u}}else{l=t;w=u}while(0);if(!v){kb=456;break}t=l>>>1;u=l-t|0;if(!D)t=u;else c[V>>2]=(c[V>>2]|0)+u;c[j>>2]=t;u=w;while(1){if(t>>>0>=8388609)break;l=c[V>>2]|0;w=l>>>23;if((w|0)==255)c[W>>2]=(c[W>>2]|0)+1;else{l=l>>>31;t=c[U>>2]|0;if((t|0)>-1){u=c[T>>2]|0;if((u+(c[o>>2]|0)|0)>>>0<(c[p>>2]|0)>>>0){c[T>>2]=u+1;a[(c[_a>>2]|0)+u>>0]=t+l;t=0}else t=-1;c[$>>2]=c[$>>2]|t}t=c[W>>2]|0;if(t|0){l=l+255&255;do{u=c[T>>2]|0;if((u+(c[o>>2]|0)|0)>>>0<(c[p>>2]|0)>>>0){c[T>>2]=u+1;a[(c[_a>>2]|0)+u>>0]=l;u=0;t=c[W>>2]|0}else u=-1;c[$>>2]=c[$>>2]|u;t=t+-1|0;c[W>>2]=t}while((t|0)!=0)}c[U>>2]=w&255;l=c[V>>2]|0;t=c[j>>2]|0;u=c[ka>>2]|0}c[V>>2]=l<<8&2147483392;t=t<<8;c[j>>2]=t;u=u+8|0;c[ka>>2]=u}w=(c[Ea>>2]|0)==1001;if(w)l=n;else l=u+((aa(t|0)|0)+-32)+7>>3;wb=q-l|0;l=(c[Ga>>2]|0)/1600|0;l=(wb|0)<(l|0)?wb:l;if((l|0)>=2)if((l|0)>257)z=257;else kb=436;else{l=2;kb=436}if((kb|0)==436)z=l;if(!w){A=z;break}l=t>>>8;if((z|0)==2)t=t+(_(l,-255)|0)|0;else{t=t-(_(l,258-z|0)|0)|0;c[V>>2]=(c[V>>2]|0)+t;t=l}c[j>>2]=t;while(1){if(t>>>0>=8388609){A=z;break e}l=c[V>>2]|0;w=l>>>23;if((w|0)==255)c[W>>2]=(c[W>>2]|0)+1;else{l=l>>>31;t=c[U>>2]|0;if((t|0)>-1){u=c[T>>2]|0;if((u+(c[o>>2]|0)|0)>>>0<(c[p>>2]|0)>>>0){c[T>>2]=u+1;a[(c[_a>>2]|0)+u>>0]=t+l;t=0}else t=-1;c[$>>2]=c[$>>2]|t}t=c[W>>2]|0;if(t|0){l=l+255&255;do{u=c[T>>2]|0;if((u+(c[o>>2]|0)|0)>>>0<(c[p>>2]|0)>>>0){c[T>>2]=u+1;a[(c[_a>>2]|0)+u>>0]=l;u=0;t=c[W>>2]|0}else u=-1;c[$>>2]=c[$>>2]|u;t=t+-1|0;c[W>>2]=t}while((t|0)!=0)}c[U>>2]=w&255;l=c[V>>2]|0;t=c[j>>2]|0;u=c[ka>>2]|0}c[V>>2]=l<<8&2147483392;t=t<<8;c[j>>2]=t;u=u+8|0;c[ka>>2]=u}}while(0);if((kb|0)==456){c[ja>>2]=0;v=0;A=0}wb=c[Ea>>2]|0;u=(wb|0)==1002?0:17;if((wb|0)==1e3){t=(c[ka>>2]|0)+((aa(c[j>>2]|0)|0)+-32)+7>>3;cd(_a);w=t}else{w=q-A|0;w=(w|0)<(n|0)?w:n;vb=c[_a>>2]|0;t=c[o>>2]|0;wb=0-t|0;sf(vb+w+wb|0,vb+(c[p>>2]|0)+wb|0,t|0)|0;c[p>>2]=w;t=0}l=(v|0)==0;if(l?(c[Ea>>2]|0)==1e3:0)kb=464;else kb=462;do if((kb|0)==462){c[La>>2]=jb;Qc(Za,10022,La)|0;if((c[Ea>>2]|0)!=1001){kb=464;break}c[Ja>>2]=c[d+100>>2];c[Ja+4>>2]=c[d+104>>2];c[Ma>>2]=Ja;Qc(Za,10028,Ma)|0}while(0);if((kb|0)==464){c[Oa>>2]=0;Qc(Za,10028,Oa)|0}if(!(l|(D|0)==0)){c[Pa>>2]=0;Qc(Za,10010,Pa)|0;c[Qa>>2]=0;Qc(Za,4006,Qa)|0;c[Ra>>2]=-1;Qc(Za,4002,Ra)|0;if((Rc(Za,r,(c[nb>>2]|0)/200|0,ca+w|0,A,0)|0)<0){t=-3;break}c[Sa>>2]=ib;Qc(Za,4031,Sa)|0;Qc(Za,4028,Ta)|0}c[mb>>2]=u;Qc(Za,10010,mb)|0;u=c[Ea>>2]|0;do if((u|0)==1e3)kb=482;else{wb=c[Ca>>2]|0;if((u|0)!=(wb|0)&(wb|0)>0){Qc(Za,4028,Va)|0;Rc(Za,m,(c[nb>>2]|0)/400|0,Ua,2,0)|0;c[Wa>>2]=0;Qc(Za,10002,Wa)|0}if(((c[ka>>2]|0)+((aa(c[j>>2]|0)|0)+-32)|0)>(w<<3|0)){kb=482;break}do if(!(l|(D|0)==0)){if((c[Ea>>2]|0)!=1001)break;if(!(c[hb>>2]|0))break;c[Xa>>2]=(c[Ga>>2]|0)-(c[d+36>>2]|0);Qc(Za,4002,Xa)|0}while(0);c[Ya>>2]=c[hb>>2];Qc(Za,4006,Ya)|0;t=Rc(Za,r,f,0,w,_a)|0;if((t|0)<0){t=-3;break d}if(l){v=0;kb=488;break}if(!D){u=w;kb=484;break}u=c[Ea>>2]|0;if((u|0)!=1001){z=v;break}if(!(c[hb>>2]|0)){kb=488;break}rf(ca+t|0,ca+w|0,A|0)|0;kb=488}while(0);do if((kb|0)==482){if(l){v=0;kb=488;break}else u=w;if(!D)kb=484;else kb=488}while(0);if((kb|0)==484){w=c[nb>>2]|0;l=(w|0)/200|0;w=(w|0)/400|0;Qc(Za,4028,$a)|0;c[ab>>2]=0;Qc(Za,10010,ab)|0;c[bb>>2]=0;Qc(Za,10002,bb)|0;c[cb>>2]=0;Qc(Za,4006,cb)|0;c[db>>2]=-1;Qc(Za,4002,db)|0;if((c[Ea>>2]|0)==1001){vb=c[_a>>2]|0;u=c[o>>2]|0;wb=0-u|0;sf(vb+t+wb|0,vb+(c[p>>2]|0)+wb|0,u|0)|0;c[p>>2]=t;u=t}wb=f-l|0;Rc(Za,r+((_(c[gb>>2]|0,wb-w|0)|0)<<2)|0,w,eb,2,0)|0;if((Rc(Za,r+((_(c[gb>>2]|0,wb)|0)<<2)|0,l,ca+u|0,A,0)|0)<0){t=-3;break}c[fb>>2]=ib;Qc(Za,4031,fb)|0;kb=488}if((kb|0)==488){u=c[Ea>>2]|0;z=v}w=c[Ha>>2]|0;v=(c[nb>>2]|0)/(f|0)|0;l=0;while(1){if((v|0)>=400)break;v=v<<1;l=l+1|0}switch(u|0){case 1e3:{u=(L<<5)+96&224|(l<<3)+-16;break}case 1002:{u=((L|0)<1102?0:(L<<5)+64&96)|l<<3|128;break}default:u=L<<4|(l<<3)+240|96}a[h>>0]=u|((w|0)==2&1)<<2;n=c[j>>2]|0;c[lb>>2]=n^c[ib>>2];if(!Da)u=c[Ea>>2]|0;else u=1002;c[Ca>>2]=u;m=c[Ha>>2]|0;c[d+15144>>2]=m;c[d+15148>>2]=f;c[d+15164>>2]=0;g:do if(c[d+184>>2]|0){do if(!(c[jb>>2]|0)){if(!Ia)break g;u=d+19036|0}else{u=d+19036|0;y=+g[d+19040>>2];if(Ia|0)break;w=+g[jb+28>>2]<.10000000149011612;if(w){v=_(c[gb>>2]|0,f)|0;l=0;x=0.0;while(1){if((l|0)>=(v|0))break;ub=+g[e+(l<<2)>>2];l=l+1|0;x=x+ub*ub}if(!((x/+(v|0)*316.2300109863281<=y|0)==0|w^1))break}c[u>>2]=0;break g}while(0);wb=c[u>>2]|0;v=wb+1|0;c[u>>2]=v;if((wb|0)<=9)break;if((v|0)>=31){c[u>>2]=10;break}c[lb>>2]=0;v=c[Ea>>2]|0;t=(c[nb>>2]|0)/(f|0)|0;u=0;while(1){if((t|0)>=400)break;t=t<<1;u=u+1|0}switch(v|0){case 1e3:{t=(L<<5)+96&224|(u<<3)+-16;break}case 1002:{t=((L|0)<1102?0:(L<<5)+64&96)|u<<3|128;break}default:t=L<<4|(u<<3)+240|96}a[h>>0]=t|((m|0)==2&1)<<2;t=1;break d}while(0);h:do if(((c[ka>>2]|0)+((aa(n|0)|0)+-32)|0)>((Ka<<3)+-8|0)){if((Ka|0)<2){t=-2;break d}a[ca>>0]=0;c[lb>>2]=0;t=1}else{if(!((c[Ea>>2]|0)==1e3&(z|0)==0))break;while(1){if((t|0)<=2)break h;if(a[h+t>>0]|0)break h;t=t+-1|0}}while(0);t=t+(A+1)|0;i:do if(!(c[hb>>2]|0)){j:do if((t|0)>=1){do if((t|0)!=(Ka|0)){if((t|0)>(Ka|0))break j;u=mb+4|0;c[u>>2]=0;wb=h+Ka+(0-t)|0;sf(wb|0,h|0,t|0)|0;if(Nc(mb,wb,t)|0)break j;t=Oc(mb,c[u>>2]|0,h,Ka,1)|0;if((t|0)>0)break;if(!t){t=Ka;break i}else{t=-3;break d}}while(0);t=Ka;break i}while(0);t=-3;break d}while(0)}while(0);Na(ma|0);wb=t;i=ob;return wb|0}while(0);v=c[d+15136>>2]|0;u=c[d+15152>>2]|0;u=(u|0)==0?1101:u;v=(v|0)==0?1e3:v;k:do if((t|0)>100)kb=63;else{if((t|0)<50|(v|0)==1e3)if((u|0)>1103){u=1103;w=1e3;break}else{v=1e3;kb=64;break}switch(v|0){case 1002:{kb=63;break k}case 1001:break;default:{w=v;break k}}u=(u|0)>1104?u:1104;w=1001}while(0);if((kb|0)==63)if((u|0)==1102){u=1101;w=1002}else{v=1002;kb=64}if((kb|0)==64)w=v;l=c[d+15104>>2]|0;v=0;while(1){if((t|0)>=400)break;t=t<<1;v=v+1|0}switch(w|0){case 1e3:{t=(u<<5)+96&224|(v<<3)+-16;break}case 1002:{t=((u|0)<1102?0:(u<<5)+64&96)|v<<3|128;break}default:t=u<<4|(v<<3)+240|96}t=(t|((l|0)==2&1)<<2)&255;a[h>>0]=t;if(c[hb>>2]|0){wb=1;i=ob;return wb|0}do if((Ka|0)==1)kb=78;else{if((Ka|0)>=1){u=D+4|0;c[u>>2]=0;wb=h+Ka+-1|0;a[wb>>0]=t;t=Nc(D,wb,1)|0;if(!t){t=Oc(D,c[u>>2]|0,h,Ka,1)|0;if((t|0)>0){kb=78;break}if(!t)break;i=ob;return t|0}}else t=-1;wb=t;i=ob;return wb|0}while(0);wb=Ka;i=ob;return wb|0}function Jc(a,b,c,d,e,f,h,i,j){a=a|0;b=b|0;c=+c;d=+d;e=e|0;f=f|0;h=h|0;i=i|0;j=j|0;var k=0,l=0,m=0.0;k=48e3/(j|0)|0;l=(e|0)/(k|0)|0;a:do if((h|0)==1){j=0;while(1){if((j|0)>=(l|0)){j=0;break a}m=+g[i+((_(j,k)|0)<<2)>>2];m=m*m;g[b+(j<<2)>>2]=(m*d+(1.0-m)*c)*+g[a+(j<<2)>>2];j=j+1|0}}else{j=0;while(1){if((j|0)>=(l|0)){j=0;break a}m=+g[i+((_(j,k)|0)<<2)>>2];m=m*m;m=m*d+(1.0-m)*c;e=j<<1;g[b+(e<<2)>>2]=m*+g[a+(e<<2)>>2];e=e|1;g[b+(e<<2)>>2]=m*+g[a+(e<<2)>>2];j=j+1|0}}while(0);do{e=l;while(1){if((e|0)>=(f|0))break;i=(_(e,h)|0)+j|0;g[b+(i<<2)>>2]=+g[a+(i<<2)>>2]*d;e=e+1|0}j=j+1|0}while((j|0)<(h|0));return}function Kc(a,d,e,f){a=a|0;d=d|0;e=e|0;f=f|0;var h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0;p=i;if((c[a+108>>2]|0)==2051)h=0;else h=c[a+116>>2]|0;k=c[a+156>>2]|0;o=a+112|0;l=c[a+144>>2]|0;j=(k|0)==5010;a:do if(((l|0)/200|0|0)>(e|0)|j^1){h=(l|0)/400|0;if((h|0)<=(e|0)){if((k|0)!=5e3){if(j)h=(l|0)/50|0;else{if((k+-5001|0)>>>0>=6){m=-1;break}m=(l*3|0)/50|0;h=h<(e|0)){m=-1;break}}else h=e;if(!((h*400|0)==(l|0)|(h*200|0)==(l|0)|(h*100|0)==(l|0))?(m=h*50|0,!((m|0)==(l|0)|(h*25|0)==(l|0)|(m|0)==(l*3|0))):0)m=-1;else n=16}else m=-1}else{k=(l|0)/400|0;j=Hc(d,e,c[o>>2]|0,l,c[a+160>>2]|0,a+7060|0,h,1)|0;while(1){h=k<-1?h:-1;h=c[o>>2]|0;j=_(m,h)|0;k=i;i=i+((1*(j<<2)|0)+15&-16)|0;l=0;while(1){if((l|0)>=(j|0))break;g[k+(l<<2)>>2]=+(b[d+(l<<1)>>1]|0)*.000030517578125;l=l+1|0}a=Ic(a,k,m,f,3828,16,d,e,0,-2,h,1,0)|0;i=p;return a|0}function Lc(a,d,e){a=a|0;d=d|0;e=e|0;var f=0,h=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;q=i;i=i+80|0;k=q+48|0;h=q+40|0;f=q+32|0;n=q+24|0;m=q+16|0;l=q+8|0;j=q;p=q+56|0;c[p>>2]=e;o=a+(c[a>>2]|0)|0;a:do switch(d|0){case 4e3:{o=(c[p>>2]|0)+(4-1)&~(4-1);d=c[o>>2]|0;c[p>>2]=o+4;switch(d|0){case 2051:case 2049:case 2048:break;default:{e=-1;d=108;break a}}e=a+108|0;if((c[a+15164>>2]|0)==0?(c[e>>2]|0)!=(d|0):0){e=-1;d=108;break a}c[e>>2]=d;e=0;d=108;break}case 4001:{o=(c[p>>2]|0)+(4-1)&~(4-1);e=c[o>>2]|0;c[p>>2]=o+4;if(!e)d=109;else{c[e>>2]=c[a+108>>2];e=0;d=108}break}case 4002:{o=(c[p>>2]|0)+(4-1)&~(4-1);e=c[o>>2]|0;c[p>>2]=o+4;if((e|0)!=-1e3)if((e|0)!=-1){if((e|0)<1){d=109;break a}if((e|0)<501)e=500;else{p=(c[a+112>>2]|0)*3e5|0;e=(e|0)>(p|0)?p:e}}else e=-1;else e=-1e3;c[a+164>>2]=e;e=0;d=108;break}case 4003:{o=(c[p>>2]|0)+(4-1)&~(4-1);f=c[o>>2]|0;c[p>>2]=o+4;if(!f)d=109;else{e=c[a+15148>>2]|0;if(!e)d=(c[a+144>>2]|0)/400|0;else d=e;e=c[a+164>>2]|0;switch(e|0){case -1e3:{e=c[a+144>>2]|0;e=((e*60|0)/(d|0)|0)+(_(e,c[a+112>>2]|0)|0)|0;break}case -1:{e=((c[a+144>>2]|0)*10208|0)/(d|0)|0;break}default:{}}c[f>>2]=e;e=0;d=108}break}case 4022:{o=(c[p>>2]|0)+(4-1)&~(4-1);e=c[o>>2]|0;c[p>>2]=o+4;if((e|0)<1){if((e|0)!=-1e3){d=109;break a}}else if((e|0)>(c[a+112>>2]|0)){d=109;break a}c[a+120>>2]=e;e=0;d=108;break}case 4023:{o=(c[p>>2]|0)+(4-1)&~(4-1);e=c[o>>2]|0;c[p>>2]=o+4;if(!e)d=109;else{c[e>>2]=c[a+120>>2];e=0;d=108}break}case 4004:{o=(c[p>>2]|0)+(4-1)&~(4-1);e=c[o>>2]|0;c[p>>2]=o+4;if((e+-1101|0)>>>0>4)d=109;else{c[a+132>>2]=e;switch(e|0){case 1101:{c[a+20>>2]=8e3;e=0;d=108;break a}case 1102:{c[a+20>>2]=12e3;e=0;d=108;break a}default:{c[a+20>>2]=16e3;e=0;d=108;break a}}}break}case 4005:{o=(c[p>>2]|0)+(4-1)&~(4-1);e=c[o>>2]|0;c[p>>2]=o+4;if(!e)d=109;else{c[e>>2]=c[a+132>>2];e=0;d=108}break}case 4008:{o=(c[p>>2]|0)+(4-1)&~(4-1);e=c[o>>2]|0;c[p>>2]=o+4;if((e|0)>=1101){if((e|0)>1105){d=109;break a}c[a+128>>2]=e;if((e|0)==1101){c[a+20>>2]=8e3;e=0;d=108;break a}else d=e;e=a+20|0;if((d|0)==1102){c[e>>2]=12e3;e=0;d=108;break a}}else{if((e|0)!=-1e3){d=109;break a}c[a+128>>2]=-1e3;e=a+20|0}c[e>>2]=16e3;e=0;d=108;break}case 4009:{o=(c[p>>2]|0)+(4-1)&~(4-1);e=c[o>>2]|0;c[p>>2]=o+4;if(!e)d=109;else{c[e>>2]=c[a+15152>>2];e=0;d=108}break}case 4016:{o=(c[p>>2]|0)+(4-1)&~(4-1);e=c[o>>2]|0;c[p>>2]=o+4;if(e>>>0>1)d=109;else{c[a+184>>2]=e;e=0;d=108}break}case 4017:{o=(c[p>>2]|0)+(4-1)&~(4-1);e=c[o>>2]|0;c[p>>2]=o+4;if(!e)d=109;else{c[e>>2]=c[a+184>>2];e=0;d=108}break}case 4010:{n=(c[p>>2]|0)+(4-1)&~(4-1);e=c[n>>2]|0;c[p>>2]=n+4;if(e>>>0>10)d=109;else{c[a+44>>2]=e;c[j>>2]=e;Qc(o,4010,j)|0;e=0;d=108}break}case 4011:{o=(c[p>>2]|0)+(4-1)&~(4-1);e=c[o>>2]|0;c[p>>2]=o+4;if(!e)d=109;else{c[e>>2]=c[a+44>>2];e=0;d=108}break}case 4012:{o=(c[p>>2]|0)+(4-1)&~(4-1);e=c[o>>2]|0;c[p>>2]=o+4;if(e>>>0>1)d=109;else{c[a+48>>2]=e;e=0;d=108}break}case 4013:{o=(c[p>>2]|0)+(4-1)&~(4-1);e=c[o>>2]|0;c[p>>2]=o+4;if(!e)d=109;else{c[e>>2]=c[a+48>>2];e=0;d=108}break}case 4014:{n=(c[p>>2]|0)+(4-1)&~(4-1);e=c[n>>2]|0;c[p>>2]=n+4;if(e>>>0>100)d=109;else{c[a+40>>2]=e;c[l>>2]=e;Qc(o,4014,l)|0;e=0;d=108}break}case 4015:{o=(c[p>>2]|0)+(4-1)&~(4-1);e=c[o>>2]|0;c[p>>2]=o+4;if(!e)d=109;else{c[e>>2]=c[a+40>>2];e=0;d=108}break}case 4006:{o=(c[p>>2]|0)+(4-1)&~(4-1);e=c[o>>2]|0;c[p>>2]=o+4;if(e>>>0>1)d=109;else{c[a+148>>2]=e;c[a+60>>2]=1-e;e=0;d=108}break}case 4007:{o=(c[p>>2]|0)+(4-1)&~(4-1);e=c[o>>2]|0;c[p>>2]=o+4;if(!e)d=109;else{c[e>>2]=c[a+148>>2];e=0;d=108}break}case 11018:{o=(c[p>>2]|0)+(4-1)&~(4-1);e=c[o>>2]|0;c[p>>2]=o+4;if((e+1|0)>>>0>101)d=109;else{c[a+140>>2]=e;e=0;d=108}break}case 11019:{o=(c[p>>2]|0)+(4-1)&~(4-1);e=c[o>>2]|0;c[p>>2]=o+4;if(!e)d=109;else{c[e>>2]=c[a+140>>2];e=0;d=108}break}case 4020:{o=(c[p>>2]|0)+(4-1)&~(4-1);e=c[o>>2]|0;c[p>>2]=o+4;if(e>>>0>1)d=109;else{c[a+152>>2]=e;e=0;d=108}break}case 4021:{o=(c[p>>2]|0)+(4-1)&~(4-1);e=c[o>>2]|0;c[p>>2]=o+4;if(!e)d=109;else{c[e>>2]=c[a+152>>2];e=0;d=108}break}case 4024:{o=(c[p>>2]|0)+(4-1)&~(4-1);e=c[o>>2]|0;c[p>>2]=o+4;if((e|0)<3001)switch(e|0){case -1e3:break;default:{d=109;break a}}else switch(e|0){case 3002:case 3001:break;default:{d=109;break a}}c[a+124>>2]=e;e=0;d=108;break}case 4025:{o=(c[p>>2]|0)+(4-1)&~(4-1);e=c[o>>2]|0;c[p>>2]=o+4;if(!e)d=109;else{c[e>>2]=c[a+124>>2];e=0;d=108}break}case 4027:{o=(c[p>>2]|0)+(4-1)&~(4-1);d=c[o>>2]|0;c[p>>2]=o+4;if(d){e=(c[a+144>>2]|0)/400|0;c[d>>2]=e;if((c[a+108>>2]|0)==2051){e=0;d=108}else{c[d>>2]=e+(c[a+116>>2]|0);e=0;d=108}}else d=109;break}case 4029:{o=(c[p>>2]|0)+(4-1)&~(4-1);e=c[o>>2]|0;c[p>>2]=o+4;if(!e)d=109;else{c[e>>2]=c[a+144>>2];e=0;d=108}break}case 4031:{o=(c[p>>2]|0)+(4-1)&~(4-1);e=c[o>>2]|0;c[p>>2]=o+4;if(!e)d=109;else{c[e>>2]=c[a+19044>>2];e=0;d=108}break}case 4036:{o=(c[p>>2]|0)+(4-1)&~(4-1);e=c[o>>2]|0;c[p>>2]=o+4;if((e+-8|0)>>>0>16)d=109;else{c[a+168>>2]=e;e=0;d=108}break}case 4037:{o=(c[p>>2]|0)+(4-1)&~(4-1);e=c[o>>2]|0;c[p>>2]=o+4;if(!e)d=109;else{c[e>>2]=c[a+168>>2];e=0;d=108}break}case 4040:{n=(c[p>>2]|0)+(4-1)&~(4-1);e=c[n>>2]|0;c[p>>2]=n+4;switch(e|0){case 5010:case 5006:case 5005:case 5004:case 5003:case 5002:case 5001:case 5e3:break;default:{d=109;break a}}c[a+156>>2]=e;c[m>>2]=e;Qc(o,4040,m)|0;e=0;d=108;break}case 4041:{o=(c[p>>2]|0)+(4-1)&~(4-1);e=c[o>>2]|0;c[p>>2]=o+4;if(!e)d=109;else{c[e>>2]=c[a+156>>2];e=0;d=108}break}case 4042:{o=(c[p>>2]|0)+(4-1)&~(4-1);e=c[o>>2]|0;c[p>>2]=o+4;if(e>>>0>1)d=109;else{c[a+76>>2]=e;e=0;d=108}break}case 4043:{o=(c[p>>2]|0)+(4-1)&~(4-1);e=c[o>>2]|0;c[p>>2]=o+4;if(!e)d=109;else{c[e>>2]=c[a+76>>2];e=0;d=108}break}case 4028:{f=a+(c[a+4>>2]|0)|0;h=a+15104|0;nf(a+192|0,0,18856)|0;Qc(o,4028,n)|0;e=c[a+180>>2]|0;nf(f|0,0,20400)|0;d=0;while(1){if((d|0)==2)break;Fd(f+(d*10156|0)|0,e)|0;d=d+1|0}c[f+20376>>2]=1;c[f+20380>>2]=1;c[h>>2]=c[a+112>>2];b[a+15108>>1]=16384;g[a+15116>>2]=1.0;c[a+15164>>2]=1;c[a+15136>>2]=1001;c[a+15152>>2]=1105;c[a+15112>>2]=193536;e=0;d=108;break}case 11002:{o=(c[p>>2]|0)+(4-1)&~(4-1);e=c[o>>2]|0;c[p>>2]=o+4;if((e|0)<1e3){if((e|0)!=-1e3){d=109;break a}}else if((e|0)>1002){d=109;break a}c[a+136>>2]=e;e=0;d=108;break}case 10024:{d=(c[p>>2]|0)+(4-1)&~(4-1);e=c[d>>2]|0;c[p>>2]=d+4;c[a+176>>2]=e;c[f>>2]=e;e=Qc(o,10024,f)|0;d=108;break}case 10026:{d=(c[p>>2]|0)+(4-1)&~(4-1);e=c[d>>2]|0;c[p>>2]=d+4;c[a+15168>>2]=e;c[h>>2]=e;e=Qc(o,10026,h)|0;d=108;break}case 10015:{a=(c[p>>2]|0)+(4-1)&~(4-1);e=c[a>>2]|0;c[p>>2]=a+4;if(!e)d=109;else{c[k>>2]=e;e=Qc(o,10015,k)|0;d=108}break}default:{e=-5;d=108}}while(0);if((d|0)==108){a=e;i=q;return a|0}else if((d|0)==109){a=-1;i=q;return a|0}return 0}function Mc(a){a=a|0;Ie(a);return}function Nc(b,e,f){b=b|0;e=e|0;f=f|0;var g=0,h=0,j=0,k=0,l=0,m=0;m=i;i=i+16|0;k=m;if((f|0)<1){l=-4;i=m;return l|0}l=b+4|0;j=c[l>>2]|0;a:do if(j){if(((a[b>>0]^a[e>>0])&255)>=4){l=-4;i=m;return l|0}}else{a[b>>0]=a[e>>0]|0;g=a[e>>0]|0;do if(g<<24>>24>=0)if((g&96)==96){if(g&8){g=160;break}c[b+296>>2]=80;break a}else{g=(g&255)>>>3&3;if((g|0)==3){g=480;break}c[b+296>>2]=(8e3<>>0)/100|0;break a}else g=(8e3<<((g&255)>>>3&3)>>>0)/400|0;while(0);c[b+296>>2]=g}while(0);g=(d[e>>0]|0)&3;if(g)if((g|0)==3){if((f|0)<2){l=-4;i=m;return l|0}g=(d[e+1>>0]|0)&63;if(!g){l=-4;i=m;return l|0}else h=g}else h=2;else h=1;if((_(h+j|0,c[b+296>>2]|0)|0)>960){l=-4;i=m;return l|0}g=Wd(e,f,0,k,b+8+(j<<2)|0,b+200+(j<<1)|0,0,0)|0;if((g|0)<1){l=g;i=m;return l|0}c[l>>2]=(c[l>>2]|0)+h;l=0;i=m;return l|0}function Oc(e,f,g,h,i){e=e|0;f=f|0;g=g|0;h=h|0;i=i|0;var j=0,k=0,l=0,m=0,n=0,o=0,p=0;if((f|0)<1){e=-1;return e|0}if((c[e+4>>2]|0)<(f|0)){e=-1;return e|0}o=e+200|0;a:do switch(f|0){case 1:{j=b[o>>1]|0;if((j|0)<(h|0)){a[g>>0]=d[e>>0]&252;k=g+1|0;j=j+1|0;n=14;break a}else{e=-2;return e|0}}case 2:{j=b[e+202>>1]|0;k=b[o>>1]|0;if(j<<16>>16==k<<16>>16){j=j<<16>>16<<1|1;if((j|0)>(h|0)){e=-2;return e|0}else{a[g>>0]=d[e>>0]&252|1;k=g+1|0;n=14;break a}}j=(k<<16>>16)+(j<<16>>16)+2+(k<<16>>16>251&1)|0;if((j|0)>(h|0)){e=-2;return e|0}m=g+1|0;a[g>>0]=d[e>>0]&252|2;k=b[o>>1]|0;l=k<<16>>16;if(k<<16>>16<252){a[m>>0]=k;k=1}else{k=l|252;a[m>>0]=k;a[g+2>>0]=(l-(k&255)|0)>>>2;k=2}k=m+k|0;n=14;break}default:{j=1;n=15}}while(0);if((n|0)==14)if((i|0)!=0&(j|0)<(h|0)){j=1;n=15}b:do if((n|0)==15){while(1){if((j|0)>=(f|0)){n=23;break}if((b[e+200+(j<<1)>>1]|0)!=(b[o>>1]|0)){n=17;break}j=j+1|0;n=15}do if((n|0)==17){j=f+-1|0;k=0;l=2;while(1){if((k|0)>=(j|0))break;o=b[e+200+(k<<1)>>1]|0;k=k+1|0;l=l+((o<<16>>16>251?2:1)+(o<<16>>16))|0}j=l+(b[e+200+(j<<1)>>1]|0)|0;if((j|0)>(h|0)){e=-2;return e|0}else{a[g>>0]=d[e>>0]|3;l=f|128;a[g+1>>0]=l;m=1;break}}else if((n|0)==23){j=(_(b[o>>1]|0,f)|0)+2|0;if((j|0)>(h|0)){e=-2;return e|0}else{a[g>>0]=d[e>>0]|3;a[g+1>>0]=f;l=f;m=0;break}}while(0);k=g+2|0;if((i|0)!=0?(p=h-j|0,(j|0)!=(h|0)):0){a[g+1>>0]=l|64;j=(p+-1|0)/255|0;l=0;while(1){if((l|0)>=(j|0))break;a[k>>0]=-1;l=l+1|0;k=k+1|0}a[k>>0]=p+(_(j,-255)|0)+255;k=k+1|0;j=h}if(m){n=f+-1|0;o=0;while(1){if((o|0)>=(n|0))break b;l=b[e+200+(o<<1)>>1]|0;m=l<<16>>16;if(l<<16>>16<252){a[k>>0]=l;l=1}else{l=m|252;a[k>>0]=l;a[k+1>>0]=(m-(l&255)|0)>>>2;l=2}o=o+1|0;k=k+l|0}}}while(0);l=0;while(1){if((l|0)>=(f|0))break;p=e+200+(l<<1)|0;sf(k|0,c[e+8+(l<<2)>>2]|0,b[p>>1]|0)|0;l=l+1|0;k=k+(b[p>>1]|0)|0}if(!i){e=j;return e|0}l=g+h|0;while(1){if(k>>>0>=l>>>0)break;a[k>>0]=0;k=k+1|0}return j|0}function Pc(a,d,e,f,h,j,k,l,m,n,o,p){a=a|0;d=d|0;e=e|0;f=f|0;h=h|0;j=j|0;k=k|0;l=l|0;m=m|0;n=n|0;o=o|0;p=p|0;var q=0.0,r=0,s=0.0,t=0.0,u=0.0,v=0.0,w=0.0,x=0.0,y=0.0,z=0,A=0,B=0.0,C=0.0,D=0.0,E=0.0,F=0.0,G=0.0,H=0,I=0.0,J=0.0,K=0,L=0,Q=0,R=0,S=0,T=0,U=0,V=0,W=0,X=0,Z=0,_=0,$=0,aa=0,ba=0,ca=0,da=0,ea=0,fa=0,ga=0,ha=0,ia=0,ja=0,ka=0,la=0,ma=0,na=0,oa=0,pa=0,qa=0,ra=0,sa=0,ta=0,ua=0,va=0,wa=0,xa=0,ya=0,za=0,Aa=0,Ba=0,Ca=0,Da=0,Ea=0,Fa=0,Ga=0,Ha=0,Ia=0,Ja=0,Ka=0,La=0.0,Ma=0;Ka=i;i=i+10288|0;Da=Ka+9888|0;Aa=Ka+9816|0;Fa=Ka+9744|0;za=Ka+9712|0;Ba=Ka+9608|0;Ca=Ka+9600|0;Ea=Ka+5760|0;Ha=Ka+1920|0;Ia=Ka+960|0;Ga=Ka;if(!e)m=a+8504|0;else{ua=(m*195|0)/100|0;ua=(ua|0)<(f|0)?ua:f;va=a+6884|0;T=c[va>>2]|0;wa=a+6864|0;xa=a+6868|0;ya=a+6844|0;U=d+72|0;V=a+5764|0;m=a+8504|0;W=a+2884|0;X=a+4804|0;Z=a+3844|0;_=a+6856|0;$=(n|0)<8;aa=a+6848|0;ba=a+6852|0;ca=a+5840|0;da=Ba+80|0;ea=Ba+84|0;fa=Ba+88|0;ga=Ba+92|0;ha=Ba+96|0;ia=Ca+4|0;ja=a+6888|0;ka=a+7688|0;la=a+6892|0;ma=a+7692|0;na=a+7684|0;oa=a+8484|0;pa=a+8500|0;qa=a+8492|0;ra=a+8496|0;sa=a+8488|0;ta=a+6860|0;Q=n+-8|0;S=T;T=ua-T|0;while(1){R=(T|0)>480;r=R?480:T;c[wa>>2]=(c[wa>>2]|0)+1;f=c[xa>>2]|0;J=(f|0)>19?.05000000074505806:1.0/+(f+1|0);L=f+1|0;I=(f|0)>49?.019999999552965164:1.0/+(L|0);z=(f|0)>999;G=1.0/+(L|0);if((f|0)<4){g[ya>>2]=.5;d=c[U>>2]|0;if(!f){c[V>>2]=240;n=240;f=d}else{f=d;Ja=7}}else{f=c[U>>2]|0;Ja=7}if((Ja|0)==7){Ja=0;n=c[V>>2]|0}d=720-n|0;ac[o&1](e,a+2884+(n<<2)|0,(d|0)>(r|0)?r:d,S,j,k,l);n=c[V>>2]|0;d=n+r|0;do if((d|0)<720)c[V>>2]=d;else{K=c[m>>2]|0;L=a+8516+(K<<5)|0;c[m>>2]=K+((K|0)>198?-199:1);d=0;while(1){if((d|0)==240)break;F=+g[828+(d<<2)>>2];g[Ea+(d<<3)>>2]=F*+g[a+2884+(d<<2)>>2];g[Ea+(d<<3)+4>>2]=F*+g[a+2884+(d+240<<2)>>2];H=480-d+-1|0;g[Ea+(H<<3)>>2]=F*+g[a+2884+(H<<2)>>2];g[Ea+(H<<3)+4>>2]=F*+g[a+2884+(720-d+-1<<2)>>2];d=d+1|0}rf(W|0,X|0,960)|0;d=n+-720+r|0;ac[o&1](e,Z,d,S+720-n|0,j,k,l);c[V>>2]=d+240;q=+g[f+4>>2];d=f+44|0;n=0;while(1){if((n|0)>=(c[f>>2]|0))break;F=+g[Ea+(n<<3)+4>>2];g[Ha+(b[(c[d>>2]|0)+(n<<1)>>1]<<3)>>2]=q*+g[Ea+(n<<3)>>2];g[Ha+(b[(c[d>>2]|0)+(n<<1)>>1]<<3)+4>>2]=q*F;n=n+1|0}dd(f,Ha);F=+g[Ha>>2];if(F!=F|0.0!=0.0){c[L>>2]=0;break}else n=1;while(1){if((n|0)==240)break;x=+g[Ha+(n<<3)>>2];H=480-n|0;t=+g[Ha+(H<<3)>>2];q=x+t;u=+g[Ha+(n<<3)+4>>2];w=+g[Ha+(H<<3)+4>>2];s=u-w;w=u+w;x=t-x;t=q*q;u=s*s;do if(!(t+u<1.000000045813705e-18))if(t>2];d=a+964+(n<<2)|0;v=u-+g[d>>2];q=w*w;s=x*x;do if(!(q+s<1.000000045813705e-18))if(q>2]=+N(+B)+ +N(+F);F=F*F;F=F*F;H=a+1924+(n<<2)|0;g[Ia+(n<<2)>>2]=1.0/((+g[H>>2]+C*C*2.0+F)*.25*62341.81640625+1.0)+-.014999999664723873;g[f>>2]=D;g[d>>2]=E;g[H>>2]=F;n=n+1|0}H=a+8516+(K<<5)+16|0;g[H>>2]=0.0;a:do if(!(c[xa>>2]|0)){f=0;while(1){if((f|0)==18){r=0;B=0.0;x=0.0;C=0.0;q=0.0;D=0.0;E=0.0;F=0.0;break a}g[a+6420+(f<<2)>>2]=1.0e10;g[a+6492+(f<<2)>>2]=-1.0e10;f=f+1|0}}else{r=0;B=0.0;x=0.0;C=0.0;q=0.0;D=0.0;E=0.0;F=0.0}while(0);while(1){if((r|0)>=18)break;n=r+1|0;f=c[1788+(n<<2)>>2]|0;t=0.0;d=c[1788+(r<<2)>>2]|0;s=0.0;y=0.0;while(1){if((d|0)>=(f|0))break;La=+g[Ha+(d<<3)>>2];A=480-d|0;w=+g[Ha+(A<<3)>>2];v=+g[Ha+(d<<3)+4>>2];u=+g[Ha+(A<<3)+4>>2];u=La*La+w*w+v*v+u*u;v=s+u*2.0*(.5-+g[Ga+(d<<2)>>2]);w=y+u*+g[Ia+(d<<2)>>2];t=t+u;d=d+1|0;s=v;y=w}if(!(t<1.0e9)|(t!=t|0.0!=0.0)){Ja=37;break}g[a+5844+((c[_>>2]|0)*72|0)+(r<<2)>>2]=t;v=t+1.0000000036274937e-15;x=x+s/v;u=t+1.000000013351432e-10;w=B+ +O(+u);u=+Y(+u);g[Fa+(r<<2)>>2]=u;f=a+6420+(r<<2)|0;t=+g[f>>2]+.009999999776482582;t=u>2]=t;d=a+6492+(r<<2)|0;s=+g[d>>2]+-.10000000149011612;s=u>s?u:s;g[d>>2]=s;if(s>2]=s;t=t+-.5;g[f>>2]=t}u=(u-t)/(s+1.0000000036274937e-15-t);s=0.0;t=0.0;f=0;while(1){if((f|0)==8)break;La=+g[a+5844+(f*72|0)+(r<<2)>>2];s=s+ +O(+La);t=t+La;f=f+1|0}t=s/+O(+(t*8.0+1.0e-15));t=t>.9900000095367432?.9900000095367432:t;t=t*t;t=t*t;La=y/v;f=a+5768+(r<<2)|0;s=t*+g[f>>2];s=La>s?La:s;g[Aa+(r<<2)>>2]=s;q=q+s;if((r|0)>8)q=q-+g[Aa+(r+-9<<2)>>2];y=(+(r+-18|0)*.029999999329447746+1.0)*q;g[f>>2]=s;La=F+s*+(r+-8|0);r=n;B=w;C=C+t;D=D>y?D:y;E=E+u;F=La}if((Ja|0)==37){Ja=0;c[L>>2]=0;break}w=$?5.699999746866524e-04:5.699999746866524e-04/+(1<>2]|0;n=z+1|0;r=c[1864+(n<<2)>>2]|0;u=0.0;f=d;while(1){if((f|0)>=(r|0))break;t=+g[Ha+(f<<3)>>2];G=+g[Ha+(f<<3)+4>>2];Ma=480-f|0;y=+g[Ha+(Ma<<3)>>2];La=+g[Ha+(Ma<<3)+4>>2];u=u+(t*t+y*y+G*G+La*La);f=f+1|0}t=s>u?s:u;Ma=a+6564+(z<<2)|0;s=v*+g[Ma>>2];s=s>u?s:u;g[Ma>>2]=s;s=u>s?u:s;q=q*.05000000074505806;q=q>s?q:s;if(!(s>q*.1&s*1.0e9>t)){Ma=A;z=n;s=t;A=Ma;continue}if(!(s>w*+(r-d|0))){Ma=A;z=n;s=t;A=Ma;continue}A=z;z=n;s=t}r=c[xa>>2]|0;z=(r|0)<3?20:A;B=+Ge(B)*20.0;G=+g[aa>>2]+-.029999999329447746;G=G>B?G:B;g[aa>>2]=G;La=+g[ba>>2]*(1.0-I);g[ba>>2]=B>2]*+g[Fa+(d<<2)>>2];d=d+1|0;q=La}g[za+(n<<2)>>2]=q;n=n+1|0}s=C/18.0;B=x/18.0;g[H>>2]=B+(1.0-B)*((r|0)<10?.5:E/18.0);I=D/9.0;La=+g[ca>>2]*.800000011920929;La=I>La?I:La;g[ca>>2]=La;n=a+8516+(K<<5)+8|0;g[n>>2]=F*.015625;c[_>>2]=((c[_>>2]|0)+1|0)%8|0;c[xa>>2]=(c[xa>>2]|0)+1;d=a+8516+(K<<5)+4|0;g[d>>2]=La;f=0;while(1){if((f|0)==4)break;g[Ba+(f<<2)>>2]=(+g[za+(f<<2)>>2]+ +g[a+6648+(f+24<<2)>>2])*-.12298999726772308+(+g[a+6648+(f<<2)>>2]+ +g[a+6648+(f+16<<2)>>2])*.49195000529289246+ +g[a+6648+(f+8<<2)>>2]*.6969299912452698-+g[a+6776+(f<<2)>>2]*1.4349000453948975;f=f+1|0}q=1.0-J;f=0;while(1){if((f|0)==4){f=0;break}Ma=a+6776+(f<<2)|0;g[Ma>>2]=q*+g[Ma>>2]+J*+g[za+(f<<2)>>2];f=f+1|0}while(1){if((f|0)==4){f=0;break}g[Ba+(f+4<<2)>>2]=(+g[za+(f<<2)>>2]-+g[a+6648+(f+24<<2)>>2])*.6324599981307983+(+g[a+6648+(f<<2)>>2]-+g[a+6648+(f+16<<2)>>2])*.31622999906539917;f=f+1|0}while(1){if((f|0)==3)break;Ma=f+8|0;g[Ba+(Ma<<2)>>2]=(+g[za+(f<<2)>>2]+ +g[a+6648+(f+24<<2)>>2])*.5345199704170227-(+g[a+6648+(f<<2)>>2]+ +g[a+6648+(f+16<<2)>>2])*.26725998520851135-+g[a+6648+(Ma<<2)>>2]*.5345199704170227;f=f+1|0}b:do if((c[xa>>2]|0)>5){f=0;while(1){if((f|0)==9){f=0;break b}Ma=a+6808+(f<<2)|0;La=+g[Ba+(f<<2)>>2];g[Ma>>2]=q*+g[Ma>>2]+J*La*La;f=f+1|0}}else f=0;while(0);while(1){if((f|0)==8){f=0;break}Ma=a+6648+(f+16<<2)|0;c[a+6648+(f+24<<2)>>2]=c[Ma>>2];A=a+6648+(f+8<<2)|0;c[Ma>>2]=c[A>>2];Ma=a+6648+(f<<2)|0;c[A>>2]=c[Ma>>2];c[Ma>>2]=c[za+(f<<2)>>2];f=f+1|0}while(1){if((f|0)==9)break;La=+O(+(+g[a+6808+(f<<2)>>2]));g[Ba+(f+11<<2)>>2]=La-+g[2464+(f<<2)>>2];f=f+1|0}g[da>>2]=+g[d>>2]+-.154723;g[ea>>2]=+g[H>>2]+-.724643;g[fa>>2]=s+-.743717;g[ga>>2]=+g[n>>2]+.069216;g[ha>>2]=+g[ba>>2]+-.06793;f=3304;r=0;while(1){if((r|0)==16){f=4968;r=0;break}d=f;n=0;q=+g[f>>2];while(1){d=d+4|0;if((n|0)==25)break;La=q+ +g[Ba+(n<<2)>>2]*+g[d>>2];n=n+1|0;q=La}f=f+104|0;if(q<8.0)if(q>-8.0)if(q!=q|0.0!=0.0)q=0.0;else{Ma=q<0.0;q=Ma?-q:q;H=~~+M(+(q*25.0+.5));q=q-+(H|0)*.03999999910593033;La=+g[2500+(H<<2)>>2];q=(Ma?-1.0:1.0)*(La+q*(1.0-La*La)*(1.0-La*q))}else q=-1.0;else q=1.0;g[Da+(r<<2)>>2]=q;r=r+1|0}while(1){if((r|0)==2)break;d=f;n=0;q=+g[f>>2];while(1){d=d+4|0;if((n|0)==16)break;La=q+ +g[Da+(n<<2)>>2]*+g[d>>2];n=n+1|0;q=La}f=f+68|0;if(q<8.0)if(q>-8.0)if(q!=q|0.0!=0.0)q=0.0;else{Ma=q<0.0;q=Ma?-q:q;H=~~+M(+(q*25.0+.5));q=q-+(H|0)*.03999999910593033;La=+g[2500+(H<<2)>>2];q=(Ma?-1.0:1.0)*(La+q*(1.0-La*La)*(1.0-La*q))}else q=-1.0;else q=1.0;g[Ca+(r<<2)>>2]=q;r=r+1|0}y=(+g[Ca>>2]+1.0)*.5;x=+g[ia>>2]*.5+.5;x=x*x;g[ia>>2]=x;y=x*y+(1.0-x)*.5;g[Ca>>2]=y;g[a+8516+(K<<5)+28>>2]=x;u=x*4.999999873689376e-05;Ma=y>.949999988079071;H=y<.05000000074505806&(Ma^1);w=H|Ma?(H?.05000000074505806:.949999988079071):y;J=+g[ya>>2];H=J>.949999988079071;Ma=J<.05000000074505806&(H^1);v=Ma|H?(Ma?.05000000074505806:.949999988079071):J;I=1.0-J;s=1.0-u;w=+N(+(w-v))*.05000000074505806/(w*(1.0-v)+v*(1.0-w))+.009999999776482582;v=+P(+(1.0-y),+w);w=+P(+y,+w);La=(J*s+I*u)*w;La=La/((I*s+J*u)*v+La);g[ya>>2]=La;g[a+8516+(K<<5)+20>>2]=La;if((c[xa>>2]|0)==1){g[ja>>2]=.5;g[ka>>2]=.5;q=.5}else q=+g[ja>>2];q=q+ +g[la>>2];t=+g[ka>>2]+ +g[ma>>2];g[ja>>2]=q*s*v;g[ka>>2]=t*s*w;f=1;while(1){if((f|0)==199)break;Ma=f+1|0;g[a+6888+(f<<2)>>2]=+g[a+6888+(Ma<<2)>>2]*v;g[a+7688+(f<<2)>>2]=+g[a+7688+(Ma<<2)>>2]*w;f=Ma}g[na>>2]=t*u*v;g[oa>>2]=q*u*w;f=0;q=9.999999682655225e-21;while(1){if((f|0)==200)break;La=q+(+g[a+6888+(f<<2)>>2]+ +g[a+7688+(f<<2)>>2]);f=f+1|0;q=La}q=1.0/q;f=0;while(1){if((f|0)==200)break;Ma=a+6888+(f<<2)|0;g[Ma>>2]=+g[Ma>>2]*q;Ma=a+7688+(f<<2)|0;g[Ma>>2]=+g[Ma>>2]*q;f=f+1|0}if(x>.75){q=+g[ya>>2];if(q>.9){Ma=(c[pa>>2]|0)+1|0;c[pa>>2]=(Ma|0)<500?Ma:500;J=+g[qa>>2];La=y-J;g[qa>>2]=J+1.0/+(Ma|0)*(La<-.20000000298023224?-.20000000298023224:La)}if(q<.1){Ma=(c[ra>>2]|0)+1|0;c[ra>>2]=(Ma|0)<500?Ma:500;J=+g[sa>>2];La=y-J;g[sa>>2]=J+1.0/+(Ma|0)*(La>.20000000298023224?.20000000298023224:La)}}else{if(!(c[pa>>2]|0))g[qa>>2]=.8999999761581421;if(!(c[ra>>2]|0))g[sa>>2]=.10000000149011612}f=+g[ya>>2]>.5&1;if((c[ta>>2]|0)!=(f|0))c[wa>>2]=0;c[ta>>2]=f;c[a+8516+(K<<5)+24>>2]=z;g[a+8516+(K<<5)+12>>2]=B;c[L>>2]=1}while(0);if(R){S=S+480|0;T=T+-480|0}else break}c[va>>2]=ua-h}c[p>>2]=0;r=a+8508|0;f=c[r>>2]|0;d=c[m>>2]|0;n=d-f|0;n=(n|0)<0?n+200|0:n;if((h|0)<481|(d|0)==(f|0))m=f;else{m=f+1|0;m=(m|0)==200?0:m}f=(m|0)==(d|0)?d+-1|0:m;f=a+8516+(((f|0)<0?199:f)<<5)|0;c[p>>2]=c[f>>2];c[p+4>>2]=c[f+4>>2];c[p+8>>2]=c[f+8>>2];c[p+12>>2]=c[f+12>>2];c[p+16>>2]=c[f+16>>2];c[p+20>>2]=c[f+20>>2];c[p+24>>2]=c[f+24>>2];c[p+28>>2]=c[f+28>>2];f=a+8512|0;m=(c[f>>2]|0)+((h|0)/120|0)|0;c[f>>2]=m;while(1){if((m|0)<=3)break;Ma=m+-4|0;c[f>>2]=Ma;c[r>>2]=(c[r>>2]|0)+1;m=Ma}m=c[r>>2]|0;if((m|0)>199)c[r>>2]=m+-200;m=(n|0)>10?210-n|0:200;f=0;q=0.0;while(1){if((f|0)>=(m|0))break;La=q+ +g[a+7688+(f<<2)>>2];f=f+1|0;q=La}while(1){if((f|0)>=200)break;La=q+ +g[a+6888+(f<<2)>>2];f=f+1|0;q=La}g[p+20>>2]=q*+g[a+8492>>2]+(1.0-q)*+g[a+8488>>2];i=Ka;return}function Qc(a,b,d){a=a|0;b=b|0;d=d|0;var e=0,f=0,h=0,j=0,k=0,l=0;k=i;i=i+16|0;e=k;c[e>>2]=d;do switch(b|0){case 4010:{j=(c[e>>2]|0)+(4-1)&~(4-1);b=c[j>>2]|0;c[e>>2]=j+4;if(b>>>0>10)b=40;else{c[a+24>>2]=b;b=39}break}case 10010:{j=(c[e>>2]|0)+(4-1)&~(4-1);b=c[j>>2]|0;c[e>>2]=j+4;if((b|0)>=0?(b|0)<(c[(c[a>>2]|0)+8>>2]|0):0){c[a+32>>2]=b;b=39}else b=40;break}case 10012:{j=(c[e>>2]|0)+(4-1)&~(4-1);b=c[j>>2]|0;c[e>>2]=j+4;if((b|0)>=1?(b|0)<=(c[(c[a>>2]|0)+8>>2]|0):0){c[a+36>>2]=b;b=39}else b=40;break}case 10002:{j=(c[e>>2]|0)+(4-1)&~(4-1);b=c[j>>2]|0;c[e>>2]=j+4;if(b>>>0>2)b=40;else{c[a+20>>2]=(b|0)<2&1;c[a+12>>2]=(b|0)==0&1;b=39}break}case 4014:{j=(c[e>>2]|0)+(4-1)&~(4-1);b=c[j>>2]|0;c[e>>2]=j+4;if(b>>>0>100)b=40;else{c[a+56>>2]=b;b=39}break}case 4020:{j=(c[e>>2]|0)+(4-1)&~(4-1);b=c[j>>2]|0;c[e>>2]=j+4;c[a+52>>2]=b;b=39;break}case 4006:{j=(c[e>>2]|0)+(4-1)&~(4-1);b=c[j>>2]|0;c[e>>2]=j+4;c[a+44>>2]=b;b=39;break}case 4002:{j=(c[e>>2]|0)+(4-1)&~(4-1);b=c[j>>2]|0;c[e>>2]=j+4;if((b|0)>500|(b|0)==-1){j=(c[a+4>>2]|0)*26e4|0;c[a+40>>2]=(b|0)<(j|0)?b:j;b=39}else b=40;break}case 10008:{j=(c[e>>2]|0)+(4-1)&~(4-1);b=c[j>>2]|0;c[e>>2]=j+4;if((b+-1|0)>>>0>1)b=40;else{c[a+8>>2]=b;b=39}break}case 4036:{j=(c[e>>2]|0)+(4-1)&~(4-1);b=c[j>>2]|0;c[e>>2]=j+4;if((b+-8|0)>>>0>16)b=40;else{c[a+60>>2]=b;b=39}break}case 4037:{j=(c[e>>2]|0)+(4-1)&~(4-1);b=c[j>>2]|0;c[e>>2]=j+4;c[b>>2]=c[a+60>>2];b=39;break}case 4040:{j=(c[e>>2]|0)+(4-1)&~(4-1);b=c[j>>2]|0;c[e>>2]=j+4;c[a+64>>2]=b;b=39;break}case 4028:{b=a+4|0;h=c[b>>2]|0;f=c[a>>2]|0;l=c[f+4>>2]|0;d=a+212+((_(h,l+1024|0)|0)<<2)|0;j=c[f+8>>2]|0;e=_(h,j)|0;d=d+(e<<2)|0;e=d+(e<<2)|0;nf(a+76|0,0,((_(l,h)|0)<<2)+212+(h<<12)+((_(h<<2,j)|0)<<2)+-76|0)|0;j=0;while(1){if((j|0)>=(_(h,c[f+8>>2]|0)|0))break;g[e+(j<<2)>>2]=-28.0;g[d+(j<<2)>>2]=-28.0;f=c[a>>2]|0;h=c[b>>2]|0;j=j+1|0}c[a+184>>2]=0;g[a+84>>2]=1.0;c[a+80>>2]=2;c[a+88>>2]=256;c[a+96>>2]=0;c[a+100>>2]=0;b=39;break}case 10016:{l=(c[e>>2]|0)+(4-1)&~(4-1);b=c[l>>2]|0;c[e>>2]=l+4;c[a+48>>2]=b;b=39;break}case 10022:{l=(c[e>>2]|0)+(4-1)&~(4-1);b=c[l>>2]|0;c[e>>2]=l+4;if(!b)b=39;else{l=a+120|0;c[l>>2]=c[b>>2];c[l+4>>2]=c[b+4>>2];c[l+8>>2]=c[b+8>>2];c[l+12>>2]=c[b+12>>2];c[l+16>>2]=c[b+16>>2];c[l+20>>2]=c[b+20>>2];c[l+24>>2]=c[b+24>>2];c[l+28>>2]=c[b+28>>2];b=39}break}case 10028:{l=(c[e>>2]|0)+(4-1)&~(4-1);b=c[l>>2]|0;c[e>>2]=l+4;if(!b)b=39;else{j=b;l=c[j+4>>2]|0;b=a+152|0;c[b>>2]=c[j>>2];c[b+4>>2]=l;b=39}break}case 10015:{l=(c[e>>2]|0)+(4-1)&~(4-1);b=c[l>>2]|0;c[e>>2]=l+4;if(!b)b=40;else{c[b>>2]=c[a>>2];b=39}break}case 4031:{l=(c[e>>2]|0)+(4-1)&~(4-1);b=c[l>>2]|0;c[e>>2]=l+4;if(!b)b=40;else{c[b>>2]=c[a+76>>2];b=39}break}case 10024:{l=(c[e>>2]|0)+(4-1)&~(4-1);b=c[l>>2]|0;c[e>>2]=l+4;c[a+68>>2]=b;b=39;break}case 10026:{l=(c[e>>2]|0)+(4-1)&~(4-1);b=c[l>>2]|0;c[e>>2]=l+4;c[a+204>>2]=b;b=39;break}default:{l=-5;i=k;return l|0}}while(0);if((b|0)==39){l=0;i=k;return l|0}else if((b|0)==40){l=-1;i=k;return l|0}return 0} +// EMSCRIPTEN_END_FUNCS +var Xb=[Of,Ne,$e,bf,tc,Of,Of,Of];var Yb=[Pf,Ve,Re,ff];var Zb=[Qf,Je,Te,Le,Me,Ke,Xe,Ye,_e,af,cf,sc,Qf,Qf,Qf,Qf];var _b=[Rf,vc];var $b=[Sf,Ze,rc,Sf];var ac=[Tf,Gc];var bc=[Uf];var cc=[Vf,uc,qc,Vf];var dc=[Wf,Ue,Pe,df];var ec=[Xf,pc,wc,Xf];var fc=[Yf,We,Se,hf];return{___cxa_can_catch:kf,_free:Ie,_opus_strerror:zc,_opus_decoder_create:Ac,___cxa_is_pointer_type:lf,_i64Add:of,_memmove:sf,_bitshift64Ashr:pf,_opus_encoder_destroy:Mc,_memset:nf,_malloc:He,_opus_decoder_destroy:Ec,_opus_encoder_create:Fc,_memcpy:rf,___getTypeName:Fe,_bitshift64Lshr:qf,_opus_decoder_ctl:Dc,_opus_encoder_ctl:Lc,__GLOBAL__sub_I_opusscript_encoder_cpp:xc,__GLOBAL__sub_I_bind_cpp:Ee,runPostSets:mf,stackAlloc:gc,stackSave:hc,stackRestore:ic,establishStackSpace:jc,setThrew:kc,setTempRet0:nc,getTempRet0:oc,dynCall_iiii:Df,dynCall_viiiii:Ef,dynCall_vi:Ff,dynCall_iiiiiii:Gf,dynCall_ii:Hf,dynCall_viiiiiii:If,dynCall_v:Jf,dynCall_iiiii:Kf,dynCall_viiiiii:Lf,dynCall_iiiiii:Mf,dynCall_viiii:Nf}}) + + +// EMSCRIPTEN_END_ASM +(Module.asmGlobalArg,Module.asmLibraryArg,buffer);var runPostSets=Module["runPostSets"]=asm["runPostSets"];var ___cxa_can_catch=Module["___cxa_can_catch"]=asm["___cxa_can_catch"];var __GLOBAL__sub_I_bind_cpp=Module["__GLOBAL__sub_I_bind_cpp"]=asm["__GLOBAL__sub_I_bind_cpp"];var _free=Module["_free"]=asm["_free"];var _opus_strerror=Module["_opus_strerror"]=asm["_opus_strerror"];var _opus_decoder_create=Module["_opus_decoder_create"]=asm["_opus_decoder_create"];var ___cxa_is_pointer_type=Module["___cxa_is_pointer_type"]=asm["___cxa_is_pointer_type"];var _i64Add=Module["_i64Add"]=asm["_i64Add"];var _memmove=Module["_memmove"]=asm["_memmove"];var _bitshift64Ashr=Module["_bitshift64Ashr"]=asm["_bitshift64Ashr"];var _opus_encoder_destroy=Module["_opus_encoder_destroy"]=asm["_opus_encoder_destroy"];var _memset=Module["_memset"]=asm["_memset"];var _malloc=Module["_malloc"]=asm["_malloc"];var _opus_decoder_destroy=Module["_opus_decoder_destroy"]=asm["_opus_decoder_destroy"];var _opus_encoder_create=Module["_opus_encoder_create"]=asm["_opus_encoder_create"];var _memcpy=Module["_memcpy"]=asm["_memcpy"];var ___getTypeName=Module["___getTypeName"]=asm["___getTypeName"];var _bitshift64Lshr=Module["_bitshift64Lshr"]=asm["_bitshift64Lshr"];var _opus_encoder_ctl=Module["_opus_encoder_ctl"]=asm["_opus_encoder_ctl"];var _opus_decoder_ctl=Module["_opus_decoder_ctl"]=asm["_opus_decoder_ctl"];var __GLOBAL__sub_I_opusscript_encoder_cpp=Module["__GLOBAL__sub_I_opusscript_encoder_cpp"]=asm["__GLOBAL__sub_I_opusscript_encoder_cpp"];var dynCall_iiii=Module["dynCall_iiii"]=asm["dynCall_iiii"];var dynCall_viiiii=Module["dynCall_viiiii"]=asm["dynCall_viiiii"];var dynCall_vi=Module["dynCall_vi"]=asm["dynCall_vi"];var dynCall_iiiiiii=Module["dynCall_iiiiiii"]=asm["dynCall_iiiiiii"];var dynCall_ii=Module["dynCall_ii"]=asm["dynCall_ii"];var dynCall_viiiiiii=Module["dynCall_viiiiiii"]=asm["dynCall_viiiiiii"];var dynCall_v=Module["dynCall_v"]=asm["dynCall_v"];var dynCall_iiiii=Module["dynCall_iiiii"]=asm["dynCall_iiiii"];var dynCall_viiiiii=Module["dynCall_viiiiii"]=asm["dynCall_viiiiii"];var dynCall_iiiiii=Module["dynCall_iiiiii"]=asm["dynCall_iiiiii"];var dynCall_viiii=Module["dynCall_viiii"]=asm["dynCall_viiii"];Runtime.stackAlloc=asm["stackAlloc"];Runtime.stackSave=asm["stackSave"];Runtime.stackRestore=asm["stackRestore"];Runtime.establishStackSpace=asm["establishStackSpace"];Runtime.setTempRet0=asm["setTempRet0"];Runtime.getTempRet0=asm["getTempRet0"];function ExitStatus(status){this.name="ExitStatus";this.message="Program terminated with exit("+status+")";this.status=status}ExitStatus.prototype=new Error;ExitStatus.prototype.constructor=ExitStatus;var initialStackTop;var preloadStartTime=null;var calledMain=false;dependenciesFulfilled=function runCaller(){if(!Module["calledRun"])run();if(!Module["calledRun"])dependenciesFulfilled=runCaller};Module["callMain"]=Module.callMain=function callMain(args){args=args||[];ensureInitRuntime();var argc=args.length+1;function pad(){for(var i=0;i<4-1;i++){argv.push(0)}}var argv=[allocate(intArrayFromString(Module["thisProgram"]),"i8",ALLOC_NORMAL)];pad();for(var i=0;i0){return}preRun();if(runDependencies>0)return;if(Module["calledRun"])return;function doRun(){if(Module["calledRun"])return;Module["calledRun"]=true;if(ABORT)return;ensureInitRuntime();preMain();if(Module["onRuntimeInitialized"])Module["onRuntimeInitialized"]();if(Module["_main"]&&shouldRunNow)Module["callMain"](args);postRun()}if(Module["setStatus"]){Module["setStatus"]("Running...");setTimeout((function(){setTimeout((function(){Module["setStatus"]("")}),1);doRun()}),1)}else{doRun()}}Module["run"]=Module.run=run;function exit(status,implicit){if(implicit&&Module["noExitRuntime"]){return}if(Module["noExitRuntime"]){}else{ABORT=true;EXITSTATUS=status;STACKTOP=initialStackTop;exitRuntime();if(Module["onExit"])Module["onExit"](status)}if(ENVIRONMENT_IS_NODE){process["exit"](status)}else if(ENVIRONMENT_IS_SHELL&&typeof quit==="function"){quit(status)}throw new ExitStatus(status)}Module["exit"]=Module.exit=exit;var abortDecorators=[];function abort(what){if(what!==undefined){Module.print(what);Module.printErr(what);what=JSON.stringify(what)}else{what=""}ABORT=true;EXITSTATUS=1;var extra="\nIf this abort() is unexpected, build with -s ASSERTIONS=1 which can give more information.";var output="abort("+what+") at "+stackTrace()+extra;if(abortDecorators){abortDecorators.forEach((function(decorator){output=decorator(output,what)}))}throw output}Module["abort"]=Module.abort=abort;if(Module["preInit"]){if(typeof Module["preInit"]=="function")Module["preInit"]=[Module["preInit"]];while(Module["preInit"].length>0){Module["preInit"].pop()()}}var shouldRunNow=true;if(Module["noInitialRun"]){shouldRunNow=false}run() + + + + + +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5), "node_modules/opusscript/build")) /***/ }, /* 204 */ /***/ function(module, exports, __webpack_require__) { - const AbstractHandler = __webpack_require__(180); +"use strict"; +/* WEBPACK VAR INJECTION */(function(Buffer) {"use strict"; - class MessageReactionRemoveAll extends AbstractHandler { - handle(packet) { - const client = this.packetManager.client; - const data = packet.d; - client.actions.MessageReactionRemoveAll.handle(data); - } - } +var opusscript_native = __webpack_require__(203); - module.exports = MessageReactionRemoveAll; +var OpusApplication = { + VOIP: 2048, + AUDIO: 2049, + RESTRICTED_LOWDELAY: 2051 +}; +var OpusError = { + "0": "OK", + "-1": "Bad argument", + "-2": "Buffer too small", + "-3": "Internal error", + "-4": "Invalid packet", + "-5": "Unimplemented", + "-6": "Invalid state", + "-7": "Memory allocation fail" +}; +var VALID_SAMPLING_RATES = [8000, 12000, 16000, 24000, 48000]; +var MAX_FRAME_SIZE = 48000 * 60 / 1000; +var MAX_PACKET_SIZE = 1276 * 3; +var SET_BITRATE_REQUEST = 4002; +function OpusScript(samplingRate, channels, application) { + if(!~VALID_SAMPLING_RATES.indexOf(samplingRate)) { + throw new RangeError(`${samplingRate} is an invalid sampling rate.`); + } + this.samplingRate = samplingRate; + + this.channels = channels || 1; + this.application = application || OpusApplication.AUDIO; + + this.handler = new opusscript_native.OpusScriptHandler(this.samplingRate, this.channels, this.application); + + this.inPCMLength = MAX_FRAME_SIZE * this.channels * 2; + this.inPCMPointer = opusscript_native._malloc(this.inPCMLength); + this.inPCM = opusscript_native.HEAPU16.subarray(this.inPCMPointer, this.inPCMPointer + this.inPCMLength); + + this.inOpusPointer = opusscript_native._malloc(MAX_PACKET_SIZE); + this.inOpus = opusscript_native.HEAPU8.subarray(this.inOpusPointer, this.inOpusPointer + MAX_PACKET_SIZE); + + this.outOpusPointer = opusscript_native._malloc(MAX_PACKET_SIZE); + this.outOpus = opusscript_native.HEAPU8.subarray(this.outOpusPointer, this.outOpusPointer + MAX_PACKET_SIZE); + + this.outPCMLength = MAX_FRAME_SIZE * this.channels * 2; + this.outPCMPointer = opusscript_native._malloc(this.outPCMLength); + this.outPCM = opusscript_native.HEAPU16.subarray(this.outPCMPointer, this.outPCMPointer + this.outPCMLength); +}; + +OpusScript.prototype.setBitrate = function setBitrate(bitrate) { + this.bitrate = bitrate || 64000; + opusscript_native.setValue(this.bitratePointer, this.bitrate, "i32"); + var errCode = opusscript_native._opus_encoder_ctl(this.handler, SET_BITRATE_REQUEST, this.bitratePointer); + if(errCode < 0) { + throw new Error("Failed to set bitrate: " + OpusError["" + opusscript_native.getValue(errCode, "i32")]); + } +}; + +OpusScript.prototype.encode = function encode(buffer, frameSize) { + this.inPCM.set(buffer); + + var len = this.handler._encode(this.inPCM.byteOffset, buffer.length, this.outOpusPointer, frameSize); + if(len < 0) { + throw new Error("Encode error: " + OpusError["" + len]); + } + + return new Buffer(this.outOpus.subarray(0, len)); +}; + +OpusScript.prototype.decode = function decode(buffer) { + this.inOpus.set(buffer); + + var len = this.handler._decode(this.inOpusPointer, buffer.length, this.outPCM.byteOffset); + if(len < 0) { + throw new Error("Decode error: " + OpusError["" + len]); + } + + return new Buffer(this.outPCM.subarray(0, len * this.channels * 2)); +}; + +OpusScript.Application = OpusApplication; +OpusScript.Error = OpusError; +OpusScript.VALID_SAMPLING_RATES = VALID_SAMPLING_RATES; +OpusScript.MAX_PACKET_SIZE = MAX_PACKET_SIZE; + +module.exports = OpusScript; + +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer)) /***/ }, /* 205 */ -/***/ function(module, exports, __webpack_require__) { +/***/ function(module, exports) { - const AbstractHandler = __webpack_require__(180); +"use strict"; +'use strict'; - class MessageUpdateHandler extends AbstractHandler { - handle(packet) { - const client = this.packetManager.client; - const data = packet.d; - client.actions.MessageUpdate.handle(data); - } - } - module.exports = MessageUpdateHandler; +module.exports = { + + /* Allowed flush values; see deflate() and inflate() below for details */ + Z_NO_FLUSH: 0, + Z_PARTIAL_FLUSH: 1, + Z_SYNC_FLUSH: 2, + Z_FULL_FLUSH: 3, + Z_FINISH: 4, + Z_BLOCK: 5, + Z_TREES: 6, + + /* Return codes for the compression/decompression functions. Negative values + * are errors, positive values are used for special but normal events. + */ + Z_OK: 0, + Z_STREAM_END: 1, + Z_NEED_DICT: 2, + Z_ERRNO: -1, + Z_STREAM_ERROR: -2, + Z_DATA_ERROR: -3, + //Z_MEM_ERROR: -4, + Z_BUF_ERROR: -5, + //Z_VERSION_ERROR: -6, + + /* compression levels */ + Z_NO_COMPRESSION: 0, + Z_BEST_SPEED: 1, + Z_BEST_COMPRESSION: 9, + Z_DEFAULT_COMPRESSION: -1, + + + Z_FILTERED: 1, + Z_HUFFMAN_ONLY: 2, + Z_RLE: 3, + Z_FIXED: 4, + Z_DEFAULT_STRATEGY: 0, + + /* Possible values of the data_type field (though see inflate()) */ + Z_BINARY: 0, + Z_TEXT: 1, + //Z_ASCII: 1, // = Z_TEXT (deprecated) + Z_UNKNOWN: 2, + + /* The deflate compression method */ + Z_DEFLATED: 8 + //Z_NULL: null // Use -1 or null inline, depending on var type +}; /***/ }, /* 206 */ /***/ function(module, exports, __webpack_require__) { - const AbstractHandler = __webpack_require__(180); - const Constants = __webpack_require__(5); - const cloneObject = __webpack_require__(46); +"use strict"; +'use strict'; - class PresenceUpdateHandler extends AbstractHandler { - handle(packet) { - const client = this.packetManager.client; - const data = packet.d; - let user = client.users.get(data.user.id); - const guild = client.guilds.get(data.guild_id); +var utils = __webpack_require__(38); +var trees = __webpack_require__(210); +var adler32 = __webpack_require__(105); +var crc32 = __webpack_require__(106); +var msg = __webpack_require__(107); - // step 1 - if (!user) { - if (data.user.username) { - user = client.dataManager.newUser(data.user); - } else { - return; - } - } +/* Public constants ==========================================================*/ +/* ===========================================================================*/ - const oldUser = cloneObject(user); - user.patch(data.user); - if (!user.equals(oldUser)) { - client.emit(Constants.Events.USER_UPDATE, oldUser, user); - } - if (guild) { - let member = guild.members.get(user.id); - if (!member && data.status !== 'offline') { - member = guild._addMember({ - user, - roles: data.roles, - deaf: false, - mute: false, - }, false); - client.emit(Constants.Events.GUILD_MEMBER_AVAILABLE, member); - } - if (member) { - const oldMember = cloneObject(member); - if (member.presence) { - oldMember.frozenPresence = cloneObject(member.presence); - } - guild._setPresence(user.id, data); - client.emit(Constants.Events.PRESENCE_UPDATE, oldMember, member); - } else { - guild._setPresence(user.id, data); - } - } - } - } +/* Allowed flush values; see deflate() and inflate() below for details */ +var Z_NO_FLUSH = 0; +var Z_PARTIAL_FLUSH = 1; +//var Z_SYNC_FLUSH = 2; +var Z_FULL_FLUSH = 3; +var Z_FINISH = 4; +var Z_BLOCK = 5; +//var Z_TREES = 6; - /** - * Emitted whenever a guild member's presence changes, or they change one of their details. - * @event Client#presenceUpdate - * @param {GuildMember} oldMember The member before the presence update - * @param {GuildMember} newMember The member after the presence update - */ - /** - * Emitted whenever a user's details (e.g. username) are changed. - * @event Client#userUpdate - * @param {User} oldUser The user before the update - * @param {User} newUser The user after the update - */ +/* Return codes for the compression/decompression functions. Negative values + * are errors, positive values are used for special but normal events. + */ +var Z_OK = 0; +var Z_STREAM_END = 1; +//var Z_NEED_DICT = 2; +//var Z_ERRNO = -1; +var Z_STREAM_ERROR = -2; +var Z_DATA_ERROR = -3; +//var Z_MEM_ERROR = -4; +var Z_BUF_ERROR = -5; +//var Z_VERSION_ERROR = -6; - /** - * Emitted whenever a member becomes available in a large guild - * @event Client#guildMemberAvailable - * @param {GuildMember} member The member that became available - */ - module.exports = PresenceUpdateHandler; +/* compression levels */ +//var Z_NO_COMPRESSION = 0; +//var Z_BEST_SPEED = 1; +//var Z_BEST_COMPRESSION = 9; +var Z_DEFAULT_COMPRESSION = -1; + + +var Z_FILTERED = 1; +var Z_HUFFMAN_ONLY = 2; +var Z_RLE = 3; +var Z_FIXED = 4; +var Z_DEFAULT_STRATEGY = 0; + +/* Possible values of the data_type field (though see inflate()) */ +//var Z_BINARY = 0; +//var Z_TEXT = 1; +//var Z_ASCII = 1; // = Z_TEXT +var Z_UNKNOWN = 2; + + +/* The deflate compression method */ +var Z_DEFLATED = 8; + +/*============================================================================*/ + + +var MAX_MEM_LEVEL = 9; +/* Maximum value for memLevel in deflateInit2 */ +var MAX_WBITS = 15; +/* 32K LZ77 window */ +var DEF_MEM_LEVEL = 8; + + +var LENGTH_CODES = 29; +/* number of length codes, not counting the special END_BLOCK code */ +var LITERALS = 256; +/* number of literal bytes 0..255 */ +var L_CODES = LITERALS + 1 + LENGTH_CODES; +/* number of Literal or Length codes, including the END_BLOCK code */ +var D_CODES = 30; +/* number of distance codes */ +var BL_CODES = 19; +/* number of codes used to transfer the bit lengths */ +var HEAP_SIZE = 2 * L_CODES + 1; +/* maximum heap size */ +var MAX_BITS = 15; +/* All codes must not exceed MAX_BITS bits */ + +var MIN_MATCH = 3; +var MAX_MATCH = 258; +var MIN_LOOKAHEAD = (MAX_MATCH + MIN_MATCH + 1); + +var PRESET_DICT = 0x20; + +var INIT_STATE = 42; +var EXTRA_STATE = 69; +var NAME_STATE = 73; +var COMMENT_STATE = 91; +var HCRC_STATE = 103; +var BUSY_STATE = 113; +var FINISH_STATE = 666; + +var BS_NEED_MORE = 1; /* block not completed, need more input or more output */ +var BS_BLOCK_DONE = 2; /* block flush performed */ +var BS_FINISH_STARTED = 3; /* finish started, need only more output at next deflate */ +var BS_FINISH_DONE = 4; /* finish done, accept no more input or output */ + +var OS_CODE = 0x03; // Unix :) . Don't detect, use this default. + +function err(strm, errorCode) { + strm.msg = msg[errorCode]; + return errorCode; +} + +function rank(f) { + return ((f) << 1) - ((f) > 4 ? 9 : 0); +} + +function zero(buf) { var len = buf.length; while (--len >= 0) { buf[len] = 0; } } + + +/* ========================================================================= + * Flush as much pending output as possible. All deflate() output goes + * through this function so some applications may wish to modify it + * to avoid allocating a large strm->output buffer and copying into it. + * (See also read_buf()). + */ +function flush_pending(strm) { + var s = strm.state; + + //_tr_flush_bits(s); + var len = s.pending; + if (len > strm.avail_out) { + len = strm.avail_out; + } + if (len === 0) { return; } + + utils.arraySet(strm.output, s.pending_buf, s.pending_out, len, strm.next_out); + strm.next_out += len; + s.pending_out += len; + strm.total_out += len; + strm.avail_out -= len; + s.pending -= len; + if (s.pending === 0) { + s.pending_out = 0; + } +} + + +function flush_block_only(s, last) { + trees._tr_flush_block(s, (s.block_start >= 0 ? s.block_start : -1), s.strstart - s.block_start, last); + s.block_start = s.strstart; + flush_pending(s.strm); +} + + +function put_byte(s, b) { + s.pending_buf[s.pending++] = b; +} + + +/* ========================================================================= + * Put a short in the pending buffer. The 16-bit value is put in MSB order. + * IN assertion: the stream state is correct and there is enough room in + * pending_buf. + */ +function putShortMSB(s, b) { +// put_byte(s, (Byte)(b >> 8)); +// put_byte(s, (Byte)(b & 0xff)); + s.pending_buf[s.pending++] = (b >>> 8) & 0xff; + s.pending_buf[s.pending++] = b & 0xff; +} + + +/* =========================================================================== + * Read a new buffer from the current input stream, update the adler32 + * and total number of bytes read. All deflate() input goes through + * this function so some applications may wish to modify it to avoid + * allocating a large strm->input buffer and copying from it. + * (See also flush_pending()). + */ +function read_buf(strm, buf, start, size) { + var len = strm.avail_in; + + if (len > size) { len = size; } + if (len === 0) { return 0; } + + strm.avail_in -= len; + + // zmemcpy(buf, strm->next_in, len); + utils.arraySet(buf, strm.input, strm.next_in, len, start); + if (strm.state.wrap === 1) { + strm.adler = adler32(strm.adler, buf, len, start); + } + + else if (strm.state.wrap === 2) { + strm.adler = crc32(strm.adler, buf, len, start); + } + + strm.next_in += len; + strm.total_in += len; + + return len; +} + + +/* =========================================================================== + * Set match_start to the longest match starting at the given string and + * return its length. Matches shorter or equal to prev_length are discarded, + * in which case the result is equal to prev_length and match_start is + * garbage. + * IN assertions: cur_match is the head of the hash chain for the current + * string (strstart) and its distance is <= MAX_DIST, and prev_length >= 1 + * OUT assertion: the match length is not greater than s->lookahead. + */ +function longest_match(s, cur_match) { + var chain_length = s.max_chain_length; /* max hash chain length */ + var scan = s.strstart; /* current string */ + var match; /* matched string */ + var len; /* length of current match */ + var best_len = s.prev_length; /* best match length so far */ + var nice_match = s.nice_match; /* stop if match long enough */ + var limit = (s.strstart > (s.w_size - MIN_LOOKAHEAD)) ? + s.strstart - (s.w_size - MIN_LOOKAHEAD) : 0/*NIL*/; + + var _win = s.window; // shortcut + + var wmask = s.w_mask; + var prev = s.prev; + + /* Stop when cur_match becomes <= limit. To simplify the code, + * we prevent matches with the string of window index 0. + */ + + var strend = s.strstart + MAX_MATCH; + var scan_end1 = _win[scan + best_len - 1]; + var scan_end = _win[scan + best_len]; + + /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16. + * It is easy to get rid of this optimization if necessary. + */ + // Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever"); + + /* Do not waste too much time if we already have a good match: */ + if (s.prev_length >= s.good_match) { + chain_length >>= 2; + } + /* Do not look for matches beyond the end of the input. This is necessary + * to make deflate deterministic. + */ + if (nice_match > s.lookahead) { nice_match = s.lookahead; } + + // Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead"); + + do { + // Assert(cur_match < s->strstart, "no future"); + match = cur_match; + + /* Skip to next match if the match length cannot increase + * or if the match length is less than 2. Note that the checks below + * for insufficient lookahead only occur occasionally for performance + * reasons. Therefore uninitialized memory will be accessed, and + * conditional jumps will be made that depend on those values. + * However the length of the match is limited to the lookahead, so + * the output of deflate is not affected by the uninitialized values. + */ + + if (_win[match + best_len] !== scan_end || + _win[match + best_len - 1] !== scan_end1 || + _win[match] !== _win[scan] || + _win[++match] !== _win[scan + 1]) { + continue; + } + + /* The check at best_len-1 can be removed because it will be made + * again later. (This heuristic is not always a win.) + * It is not necessary to compare scan[2] and match[2] since they + * are always equal when the other bytes match, given that + * the hash keys are equal and that HASH_BITS >= 8. + */ + scan += 2; + match++; + // Assert(*scan == *match, "match[2]?"); + + /* We check for insufficient lookahead only every 8th comparison; + * the 256th check will be made at strstart+258. + */ + do { + /*jshint noempty:false*/ + } while (_win[++scan] === _win[++match] && _win[++scan] === _win[++match] && + _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && + _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && + _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && + scan < strend); + + // Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan"); + + len = MAX_MATCH - (strend - scan); + scan = strend - MAX_MATCH; + + if (len > best_len) { + s.match_start = cur_match; + best_len = len; + if (len >= nice_match) { + break; + } + scan_end1 = _win[scan + best_len - 1]; + scan_end = _win[scan + best_len]; + } + } while ((cur_match = prev[cur_match & wmask]) > limit && --chain_length !== 0); + + if (best_len <= s.lookahead) { + return best_len; + } + return s.lookahead; +} + + +/* =========================================================================== + * Fill the window when the lookahead becomes insufficient. + * Updates strstart and lookahead. + * + * IN assertion: lookahead < MIN_LOOKAHEAD + * OUT assertions: strstart <= window_size-MIN_LOOKAHEAD + * At least one byte has been read, or avail_in == 0; reads are + * performed for at least two bytes (required for the zip translate_eol + * option -- not supported here). + */ +function fill_window(s) { + var _w_size = s.w_size; + var p, n, m, more, str; + + //Assert(s->lookahead < MIN_LOOKAHEAD, "already enough lookahead"); + + do { + more = s.window_size - s.lookahead - s.strstart; + + // JS ints have 32 bit, block below not needed + /* Deal with !@#$% 64K limit: */ + //if (sizeof(int) <= 2) { + // if (more == 0 && s->strstart == 0 && s->lookahead == 0) { + // more = wsize; + // + // } else if (more == (unsigned)(-1)) { + // /* Very unlikely, but possible on 16 bit machine if + // * strstart == 0 && lookahead == 1 (input done a byte at time) + // */ + // more--; + // } + //} + + + /* If the window is almost full and there is insufficient lookahead, + * move the upper half to the lower one to make room in the upper half. + */ + if (s.strstart >= _w_size + (_w_size - MIN_LOOKAHEAD)) { + + utils.arraySet(s.window, s.window, _w_size, _w_size, 0); + s.match_start -= _w_size; + s.strstart -= _w_size; + /* we now have strstart >= MAX_DIST */ + s.block_start -= _w_size; + + /* Slide the hash table (could be avoided with 32 bit values + at the expense of memory usage). We slide even when level == 0 + to keep the hash table consistent if we switch back to level > 0 + later. (Using level 0 permanently is not an optimal usage of + zlib, so we don't care about this pathological case.) + */ + + n = s.hash_size; + p = n; + do { + m = s.head[--p]; + s.head[p] = (m >= _w_size ? m - _w_size : 0); + } while (--n); + + n = _w_size; + p = n; + do { + m = s.prev[--p]; + s.prev[p] = (m >= _w_size ? m - _w_size : 0); + /* If n is not on any hash chain, prev[n] is garbage but + * its value will never be used. + */ + } while (--n); + + more += _w_size; + } + if (s.strm.avail_in === 0) { + break; + } + + /* If there was no sliding: + * strstart <= WSIZE+MAX_DIST-1 && lookahead <= MIN_LOOKAHEAD - 1 && + * more == window_size - lookahead - strstart + * => more >= window_size - (MIN_LOOKAHEAD-1 + WSIZE + MAX_DIST-1) + * => more >= window_size - 2*WSIZE + 2 + * In the BIG_MEM or MMAP case (not yet supported), + * window_size == input_size + MIN_LOOKAHEAD && + * strstart + s->lookahead <= input_size => more >= MIN_LOOKAHEAD. + * Otherwise, window_size == 2*WSIZE so more >= 2. + * If there was sliding, more >= WSIZE. So in all cases, more >= 2. + */ + //Assert(more >= 2, "more < 2"); + n = read_buf(s.strm, s.window, s.strstart + s.lookahead, more); + s.lookahead += n; + + /* Initialize the hash value now that we have some input: */ + if (s.lookahead + s.insert >= MIN_MATCH) { + str = s.strstart - s.insert; + s.ins_h = s.window[str]; + + /* UPDATE_HASH(s, s->ins_h, s->window[str + 1]); */ + s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + 1]) & s.hash_mask; +//#if MIN_MATCH != 3 +// Call update_hash() MIN_MATCH-3 more times +//#endif + while (s.insert) { + /* UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]); */ + s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + MIN_MATCH - 1]) & s.hash_mask; + + s.prev[str & s.w_mask] = s.head[s.ins_h]; + s.head[s.ins_h] = str; + str++; + s.insert--; + if (s.lookahead + s.insert < MIN_MATCH) { + break; + } + } + } + /* If the whole input has less than MIN_MATCH bytes, ins_h is garbage, + * but this is not important since only literal bytes will be emitted. + */ + + } while (s.lookahead < MIN_LOOKAHEAD && s.strm.avail_in !== 0); + + /* If the WIN_INIT bytes after the end of the current data have never been + * written, then zero those bytes in order to avoid memory check reports of + * the use of uninitialized (or uninitialised as Julian writes) bytes by + * the longest match routines. Update the high water mark for the next + * time through here. WIN_INIT is set to MAX_MATCH since the longest match + * routines allow scanning to strstart + MAX_MATCH, ignoring lookahead. + */ +// if (s.high_water < s.window_size) { +// var curr = s.strstart + s.lookahead; +// var init = 0; +// +// if (s.high_water < curr) { +// /* Previous high water mark below current data -- zero WIN_INIT +// * bytes or up to end of window, whichever is less. +// */ +// init = s.window_size - curr; +// if (init > WIN_INIT) +// init = WIN_INIT; +// zmemzero(s->window + curr, (unsigned)init); +// s->high_water = curr + init; +// } +// else if (s->high_water < (ulg)curr + WIN_INIT) { +// /* High water mark at or above current data, but below current data +// * plus WIN_INIT -- zero out to current data plus WIN_INIT, or up +// * to end of window, whichever is less. +// */ +// init = (ulg)curr + WIN_INIT - s->high_water; +// if (init > s->window_size - s->high_water) +// init = s->window_size - s->high_water; +// zmemzero(s->window + s->high_water, (unsigned)init); +// s->high_water += init; +// } +// } +// +// Assert((ulg)s->strstart <= s->window_size - MIN_LOOKAHEAD, +// "not enough room for search"); +} + +/* =========================================================================== + * Copy without compression as much as possible from the input stream, return + * the current block state. + * This function does not insert new strings in the dictionary since + * uncompressible data is probably not useful. This function is used + * only for the level=0 compression option. + * NOTE: this function should be optimized to avoid extra copying from + * window to pending_buf. + */ +function deflate_stored(s, flush) { + /* Stored blocks are limited to 0xffff bytes, pending_buf is limited + * to pending_buf_size, and each stored block has a 5 byte header: + */ + var max_block_size = 0xffff; + + if (max_block_size > s.pending_buf_size - 5) { + max_block_size = s.pending_buf_size - 5; + } + + /* Copy as much as possible from input to output: */ + for (;;) { + /* Fill the window as much as possible: */ + if (s.lookahead <= 1) { + + //Assert(s->strstart < s->w_size+MAX_DIST(s) || + // s->block_start >= (long)s->w_size, "slide too late"); +// if (!(s.strstart < s.w_size + (s.w_size - MIN_LOOKAHEAD) || +// s.block_start >= s.w_size)) { +// throw new Error("slide too late"); +// } + + fill_window(s); + if (s.lookahead === 0 && flush === Z_NO_FLUSH) { + return BS_NEED_MORE; + } + + if (s.lookahead === 0) { + break; + } + /* flush the current block */ + } + //Assert(s->block_start >= 0L, "block gone"); +// if (s.block_start < 0) throw new Error("block gone"); + + s.strstart += s.lookahead; + s.lookahead = 0; + + /* Emit a stored block if pending_buf will be full: */ + var max_start = s.block_start + max_block_size; + + if (s.strstart === 0 || s.strstart >= max_start) { + /* strstart == 0 is possible when wraparound on 16-bit machine */ + s.lookahead = s.strstart - max_start; + s.strstart = max_start; + /*** FLUSH_BLOCK(s, 0); ***/ + flush_block_only(s, false); + if (s.strm.avail_out === 0) { + return BS_NEED_MORE; + } + /***/ + + + } + /* Flush if we may have to slide, otherwise block_start may become + * negative and the data will be gone: + */ + if (s.strstart - s.block_start >= (s.w_size - MIN_LOOKAHEAD)) { + /*** FLUSH_BLOCK(s, 0); ***/ + flush_block_only(s, false); + if (s.strm.avail_out === 0) { + return BS_NEED_MORE; + } + /***/ + } + } + + s.insert = 0; + + if (flush === Z_FINISH) { + /*** FLUSH_BLOCK(s, 1); ***/ + flush_block_only(s, true); + if (s.strm.avail_out === 0) { + return BS_FINISH_STARTED; + } + /***/ + return BS_FINISH_DONE; + } + + if (s.strstart > s.block_start) { + /*** FLUSH_BLOCK(s, 0); ***/ + flush_block_only(s, false); + if (s.strm.avail_out === 0) { + return BS_NEED_MORE; + } + /***/ + } + + return BS_NEED_MORE; +} + +/* =========================================================================== + * Compress as much as possible from the input stream, return the current + * block state. + * This function does not perform lazy evaluation of matches and inserts + * new strings in the dictionary only for unmatched strings or for short + * matches. It is used only for the fast compression options. + */ +function deflate_fast(s, flush) { + var hash_head; /* head of the hash chain */ + var bflush; /* set if current block must be flushed */ + + for (;;) { + /* Make sure that we always have enough lookahead, except + * at the end of the input file. We need MAX_MATCH bytes + * for the next match, plus MIN_MATCH bytes to insert the + * string following the next match. + */ + if (s.lookahead < MIN_LOOKAHEAD) { + fill_window(s); + if (s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH) { + return BS_NEED_MORE; + } + if (s.lookahead === 0) { + break; /* flush the current block */ + } + } + + /* Insert the string window[strstart .. strstart+2] in the + * dictionary, and set hash_head to the head of the hash chain: + */ + hash_head = 0/*NIL*/; + if (s.lookahead >= MIN_MATCH) { + /*** INSERT_STRING(s, s.strstart, hash_head); ***/ + s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask; + hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h]; + s.head[s.ins_h] = s.strstart; + /***/ + } + + /* Find the longest match, discarding those <= prev_length. + * At this point we have always match_length < MIN_MATCH + */ + if (hash_head !== 0/*NIL*/ && ((s.strstart - hash_head) <= (s.w_size - MIN_LOOKAHEAD))) { + /* To simplify the code, we prevent matches with the string + * of window index 0 (in particular we have to avoid a match + * of the string with itself at the start of the input file). + */ + s.match_length = longest_match(s, hash_head); + /* longest_match() sets match_start */ + } + if (s.match_length >= MIN_MATCH) { + // check_match(s, s.strstart, s.match_start, s.match_length); // for debug only + + /*** _tr_tally_dist(s, s.strstart - s.match_start, + s.match_length - MIN_MATCH, bflush); ***/ + bflush = trees._tr_tally(s, s.strstart - s.match_start, s.match_length - MIN_MATCH); + + s.lookahead -= s.match_length; + + /* Insert new strings in the hash table only if the match length + * is not too large. This saves time but degrades compression. + */ + if (s.match_length <= s.max_lazy_match/*max_insert_length*/ && s.lookahead >= MIN_MATCH) { + s.match_length--; /* string at strstart already in table */ + do { + s.strstart++; + /*** INSERT_STRING(s, s.strstart, hash_head); ***/ + s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask; + hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h]; + s.head[s.ins_h] = s.strstart; + /***/ + /* strstart never exceeds WSIZE-MAX_MATCH, so there are + * always MIN_MATCH bytes ahead. + */ + } while (--s.match_length !== 0); + s.strstart++; + } else + { + s.strstart += s.match_length; + s.match_length = 0; + s.ins_h = s.window[s.strstart]; + /* UPDATE_HASH(s, s.ins_h, s.window[s.strstart+1]); */ + s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + 1]) & s.hash_mask; + +//#if MIN_MATCH != 3 +// Call UPDATE_HASH() MIN_MATCH-3 more times +//#endif + /* If lookahead < MIN_MATCH, ins_h is garbage, but it does not + * matter since it will be recomputed at next deflate call. + */ + } + } else { + /* No match, output a literal byte */ + //Tracevv((stderr,"%c", s.window[s.strstart])); + /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/ + bflush = trees._tr_tally(s, 0, s.window[s.strstart]); + + s.lookahead--; + s.strstart++; + } + if (bflush) { + /*** FLUSH_BLOCK(s, 0); ***/ + flush_block_only(s, false); + if (s.strm.avail_out === 0) { + return BS_NEED_MORE; + } + /***/ + } + } + s.insert = ((s.strstart < (MIN_MATCH - 1)) ? s.strstart : MIN_MATCH - 1); + if (flush === Z_FINISH) { + /*** FLUSH_BLOCK(s, 1); ***/ + flush_block_only(s, true); + if (s.strm.avail_out === 0) { + return BS_FINISH_STARTED; + } + /***/ + return BS_FINISH_DONE; + } + if (s.last_lit) { + /*** FLUSH_BLOCK(s, 0); ***/ + flush_block_only(s, false); + if (s.strm.avail_out === 0) { + return BS_NEED_MORE; + } + /***/ + } + return BS_BLOCK_DONE; +} + +/* =========================================================================== + * Same as above, but achieves better compression. We use a lazy + * evaluation for matches: a match is finally adopted only if there is + * no better match at the next window position. + */ +function deflate_slow(s, flush) { + var hash_head; /* head of hash chain */ + var bflush; /* set if current block must be flushed */ + + var max_insert; + + /* Process the input block. */ + for (;;) { + /* Make sure that we always have enough lookahead, except + * at the end of the input file. We need MAX_MATCH bytes + * for the next match, plus MIN_MATCH bytes to insert the + * string following the next match. + */ + if (s.lookahead < MIN_LOOKAHEAD) { + fill_window(s); + if (s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH) { + return BS_NEED_MORE; + } + if (s.lookahead === 0) { break; } /* flush the current block */ + } + + /* Insert the string window[strstart .. strstart+2] in the + * dictionary, and set hash_head to the head of the hash chain: + */ + hash_head = 0/*NIL*/; + if (s.lookahead >= MIN_MATCH) { + /*** INSERT_STRING(s, s.strstart, hash_head); ***/ + s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask; + hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h]; + s.head[s.ins_h] = s.strstart; + /***/ + } + + /* Find the longest match, discarding those <= prev_length. + */ + s.prev_length = s.match_length; + s.prev_match = s.match_start; + s.match_length = MIN_MATCH - 1; + + if (hash_head !== 0/*NIL*/ && s.prev_length < s.max_lazy_match && + s.strstart - hash_head <= (s.w_size - MIN_LOOKAHEAD)/*MAX_DIST(s)*/) { + /* To simplify the code, we prevent matches with the string + * of window index 0 (in particular we have to avoid a match + * of the string with itself at the start of the input file). + */ + s.match_length = longest_match(s, hash_head); + /* longest_match() sets match_start */ + + if (s.match_length <= 5 && + (s.strategy === Z_FILTERED || (s.match_length === MIN_MATCH && s.strstart - s.match_start > 4096/*TOO_FAR*/))) { + + /* If prev_match is also MIN_MATCH, match_start is garbage + * but we will ignore the current match anyway. + */ + s.match_length = MIN_MATCH - 1; + } + } + /* If there was a match at the previous step and the current + * match is not better, output the previous match: + */ + if (s.prev_length >= MIN_MATCH && s.match_length <= s.prev_length) { + max_insert = s.strstart + s.lookahead - MIN_MATCH; + /* Do not insert strings in hash table beyond this. */ + + //check_match(s, s.strstart-1, s.prev_match, s.prev_length); + + /***_tr_tally_dist(s, s.strstart - 1 - s.prev_match, + s.prev_length - MIN_MATCH, bflush);***/ + bflush = trees._tr_tally(s, s.strstart - 1 - s.prev_match, s.prev_length - MIN_MATCH); + /* Insert in hash table all strings up to the end of the match. + * strstart-1 and strstart are already inserted. If there is not + * enough lookahead, the last two strings are not inserted in + * the hash table. + */ + s.lookahead -= s.prev_length - 1; + s.prev_length -= 2; + do { + if (++s.strstart <= max_insert) { + /*** INSERT_STRING(s, s.strstart, hash_head); ***/ + s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask; + hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h]; + s.head[s.ins_h] = s.strstart; + /***/ + } + } while (--s.prev_length !== 0); + s.match_available = 0; + s.match_length = MIN_MATCH - 1; + s.strstart++; + + if (bflush) { + /*** FLUSH_BLOCK(s, 0); ***/ + flush_block_only(s, false); + if (s.strm.avail_out === 0) { + return BS_NEED_MORE; + } + /***/ + } + + } else if (s.match_available) { + /* If there was no match at the previous position, output a + * single literal. If there was a match but the current match + * is longer, truncate the previous match to a single literal. + */ + //Tracevv((stderr,"%c", s->window[s->strstart-1])); + /*** _tr_tally_lit(s, s.window[s.strstart-1], bflush); ***/ + bflush = trees._tr_tally(s, 0, s.window[s.strstart - 1]); + + if (bflush) { + /*** FLUSH_BLOCK_ONLY(s, 0) ***/ + flush_block_only(s, false); + /***/ + } + s.strstart++; + s.lookahead--; + if (s.strm.avail_out === 0) { + return BS_NEED_MORE; + } + } else { + /* There is no previous match to compare with, wait for + * the next step to decide. + */ + s.match_available = 1; + s.strstart++; + s.lookahead--; + } + } + //Assert (flush != Z_NO_FLUSH, "no flush?"); + if (s.match_available) { + //Tracevv((stderr,"%c", s->window[s->strstart-1])); + /*** _tr_tally_lit(s, s.window[s.strstart-1], bflush); ***/ + bflush = trees._tr_tally(s, 0, s.window[s.strstart - 1]); + + s.match_available = 0; + } + s.insert = s.strstart < MIN_MATCH - 1 ? s.strstart : MIN_MATCH - 1; + if (flush === Z_FINISH) { + /*** FLUSH_BLOCK(s, 1); ***/ + flush_block_only(s, true); + if (s.strm.avail_out === 0) { + return BS_FINISH_STARTED; + } + /***/ + return BS_FINISH_DONE; + } + if (s.last_lit) { + /*** FLUSH_BLOCK(s, 0); ***/ + flush_block_only(s, false); + if (s.strm.avail_out === 0) { + return BS_NEED_MORE; + } + /***/ + } + + return BS_BLOCK_DONE; +} + + +/* =========================================================================== + * For Z_RLE, simply look for runs of bytes, generate matches only of distance + * one. Do not maintain a hash table. (It will be regenerated if this run of + * deflate switches away from Z_RLE.) + */ +function deflate_rle(s, flush) { + var bflush; /* set if current block must be flushed */ + var prev; /* byte at distance one to match */ + var scan, strend; /* scan goes up to strend for length of run */ + + var _win = s.window; + + for (;;) { + /* Make sure that we always have enough lookahead, except + * at the end of the input file. We need MAX_MATCH bytes + * for the longest run, plus one for the unrolled loop. + */ + if (s.lookahead <= MAX_MATCH) { + fill_window(s); + if (s.lookahead <= MAX_MATCH && flush === Z_NO_FLUSH) { + return BS_NEED_MORE; + } + if (s.lookahead === 0) { break; } /* flush the current block */ + } + + /* See how many times the previous byte repeats */ + s.match_length = 0; + if (s.lookahead >= MIN_MATCH && s.strstart > 0) { + scan = s.strstart - 1; + prev = _win[scan]; + if (prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan]) { + strend = s.strstart + MAX_MATCH; + do { + /*jshint noempty:false*/ + } while (prev === _win[++scan] && prev === _win[++scan] && + prev === _win[++scan] && prev === _win[++scan] && + prev === _win[++scan] && prev === _win[++scan] && + prev === _win[++scan] && prev === _win[++scan] && + scan < strend); + s.match_length = MAX_MATCH - (strend - scan); + if (s.match_length > s.lookahead) { + s.match_length = s.lookahead; + } + } + //Assert(scan <= s->window+(uInt)(s->window_size-1), "wild scan"); + } + + /* Emit match if have run of MIN_MATCH or longer, else emit literal */ + if (s.match_length >= MIN_MATCH) { + //check_match(s, s.strstart, s.strstart - 1, s.match_length); + + /*** _tr_tally_dist(s, 1, s.match_length - MIN_MATCH, bflush); ***/ + bflush = trees._tr_tally(s, 1, s.match_length - MIN_MATCH); + + s.lookahead -= s.match_length; + s.strstart += s.match_length; + s.match_length = 0; + } else { + /* No match, output a literal byte */ + //Tracevv((stderr,"%c", s->window[s->strstart])); + /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/ + bflush = trees._tr_tally(s, 0, s.window[s.strstart]); + + s.lookahead--; + s.strstart++; + } + if (bflush) { + /*** FLUSH_BLOCK(s, 0); ***/ + flush_block_only(s, false); + if (s.strm.avail_out === 0) { + return BS_NEED_MORE; + } + /***/ + } + } + s.insert = 0; + if (flush === Z_FINISH) { + /*** FLUSH_BLOCK(s, 1); ***/ + flush_block_only(s, true); + if (s.strm.avail_out === 0) { + return BS_FINISH_STARTED; + } + /***/ + return BS_FINISH_DONE; + } + if (s.last_lit) { + /*** FLUSH_BLOCK(s, 0); ***/ + flush_block_only(s, false); + if (s.strm.avail_out === 0) { + return BS_NEED_MORE; + } + /***/ + } + return BS_BLOCK_DONE; +} + +/* =========================================================================== + * For Z_HUFFMAN_ONLY, do not look for matches. Do not maintain a hash table. + * (It will be regenerated if this run of deflate switches away from Huffman.) + */ +function deflate_huff(s, flush) { + var bflush; /* set if current block must be flushed */ + + for (;;) { + /* Make sure that we have a literal to write. */ + if (s.lookahead === 0) { + fill_window(s); + if (s.lookahead === 0) { + if (flush === Z_NO_FLUSH) { + return BS_NEED_MORE; + } + break; /* flush the current block */ + } + } + + /* Output a literal byte */ + s.match_length = 0; + //Tracevv((stderr,"%c", s->window[s->strstart])); + /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/ + bflush = trees._tr_tally(s, 0, s.window[s.strstart]); + s.lookahead--; + s.strstart++; + if (bflush) { + /*** FLUSH_BLOCK(s, 0); ***/ + flush_block_only(s, false); + if (s.strm.avail_out === 0) { + return BS_NEED_MORE; + } + /***/ + } + } + s.insert = 0; + if (flush === Z_FINISH) { + /*** FLUSH_BLOCK(s, 1); ***/ + flush_block_only(s, true); + if (s.strm.avail_out === 0) { + return BS_FINISH_STARTED; + } + /***/ + return BS_FINISH_DONE; + } + if (s.last_lit) { + /*** FLUSH_BLOCK(s, 0); ***/ + flush_block_only(s, false); + if (s.strm.avail_out === 0) { + return BS_NEED_MORE; + } + /***/ + } + return BS_BLOCK_DONE; +} + +/* Values for max_lazy_match, good_match and max_chain_length, depending on + * the desired pack level (0..9). The values given below have been tuned to + * exclude worst case performance for pathological files. Better values may be + * found for specific files. + */ +function Config(good_length, max_lazy, nice_length, max_chain, func) { + this.good_length = good_length; + this.max_lazy = max_lazy; + this.nice_length = nice_length; + this.max_chain = max_chain; + this.func = func; +} + +var configuration_table; + +configuration_table = [ + /* good lazy nice chain */ + new Config(0, 0, 0, 0, deflate_stored), /* 0 store only */ + new Config(4, 4, 8, 4, deflate_fast), /* 1 max speed, no lazy matches */ + new Config(4, 5, 16, 8, deflate_fast), /* 2 */ + new Config(4, 6, 32, 32, deflate_fast), /* 3 */ + + new Config(4, 4, 16, 16, deflate_slow), /* 4 lazy matches */ + new Config(8, 16, 32, 32, deflate_slow), /* 5 */ + new Config(8, 16, 128, 128, deflate_slow), /* 6 */ + new Config(8, 32, 128, 256, deflate_slow), /* 7 */ + new Config(32, 128, 258, 1024, deflate_slow), /* 8 */ + new Config(32, 258, 258, 4096, deflate_slow) /* 9 max compression */ +]; + + +/* =========================================================================== + * Initialize the "longest match" routines for a new zlib stream + */ +function lm_init(s) { + s.window_size = 2 * s.w_size; + + /*** CLEAR_HASH(s); ***/ + zero(s.head); // Fill with NIL (= 0); + + /* Set the default configuration parameters: + */ + s.max_lazy_match = configuration_table[s.level].max_lazy; + s.good_match = configuration_table[s.level].good_length; + s.nice_match = configuration_table[s.level].nice_length; + s.max_chain_length = configuration_table[s.level].max_chain; + + s.strstart = 0; + s.block_start = 0; + s.lookahead = 0; + s.insert = 0; + s.match_length = s.prev_length = MIN_MATCH - 1; + s.match_available = 0; + s.ins_h = 0; +} + + +function DeflateState() { + this.strm = null; /* pointer back to this zlib stream */ + this.status = 0; /* as the name implies */ + this.pending_buf = null; /* output still pending */ + this.pending_buf_size = 0; /* size of pending_buf */ + this.pending_out = 0; /* next pending byte to output to the stream */ + this.pending = 0; /* nb of bytes in the pending buffer */ + this.wrap = 0; /* bit 0 true for zlib, bit 1 true for gzip */ + this.gzhead = null; /* gzip header information to write */ + this.gzindex = 0; /* where in extra, name, or comment */ + this.method = Z_DEFLATED; /* can only be DEFLATED */ + this.last_flush = -1; /* value of flush param for previous deflate call */ + + this.w_size = 0; /* LZ77 window size (32K by default) */ + this.w_bits = 0; /* log2(w_size) (8..16) */ + this.w_mask = 0; /* w_size - 1 */ + + this.window = null; + /* Sliding window. Input bytes are read into the second half of the window, + * and move to the first half later to keep a dictionary of at least wSize + * bytes. With this organization, matches are limited to a distance of + * wSize-MAX_MATCH bytes, but this ensures that IO is always + * performed with a length multiple of the block size. + */ + + this.window_size = 0; + /* Actual size of window: 2*wSize, except when the user input buffer + * is directly used as sliding window. + */ + + this.prev = null; + /* Link to older string with same hash index. To limit the size of this + * array to 64K, this link is maintained only for the last 32K strings. + * An index in this array is thus a window index modulo 32K. + */ + + this.head = null; /* Heads of the hash chains or NIL. */ + + this.ins_h = 0; /* hash index of string to be inserted */ + this.hash_size = 0; /* number of elements in hash table */ + this.hash_bits = 0; /* log2(hash_size) */ + this.hash_mask = 0; /* hash_size-1 */ + + this.hash_shift = 0; + /* Number of bits by which ins_h must be shifted at each input + * step. It must be such that after MIN_MATCH steps, the oldest + * byte no longer takes part in the hash key, that is: + * hash_shift * MIN_MATCH >= hash_bits + */ + + this.block_start = 0; + /* Window position at the beginning of the current output block. Gets + * negative when the window is moved backwards. + */ + + this.match_length = 0; /* length of best match */ + this.prev_match = 0; /* previous match */ + this.match_available = 0; /* set if previous match exists */ + this.strstart = 0; /* start of string to insert */ + this.match_start = 0; /* start of matching string */ + this.lookahead = 0; /* number of valid bytes ahead in window */ + + this.prev_length = 0; + /* Length of the best match at previous step. Matches not greater than this + * are discarded. This is used in the lazy match evaluation. + */ + + this.max_chain_length = 0; + /* To speed up deflation, hash chains are never searched beyond this + * length. A higher limit improves compression ratio but degrades the + * speed. + */ + + this.max_lazy_match = 0; + /* Attempt to find a better match only when the current match is strictly + * smaller than this value. This mechanism is used only for compression + * levels >= 4. + */ + // That's alias to max_lazy_match, don't use directly + //this.max_insert_length = 0; + /* Insert new strings in the hash table only if the match length is not + * greater than this length. This saves time but degrades compression. + * max_insert_length is used only for compression levels <= 3. + */ + + this.level = 0; /* compression level (1..9) */ + this.strategy = 0; /* favor or force Huffman coding*/ + + this.good_match = 0; + /* Use a faster search when the previous match is longer than this */ + + this.nice_match = 0; /* Stop searching when current match exceeds this */ + + /* used by trees.c: */ + + /* Didn't use ct_data typedef below to suppress compiler warning */ + + // struct ct_data_s dyn_ltree[HEAP_SIZE]; /* literal and length tree */ + // struct ct_data_s dyn_dtree[2*D_CODES+1]; /* distance tree */ + // struct ct_data_s bl_tree[2*BL_CODES+1]; /* Huffman tree for bit lengths */ + + // Use flat array of DOUBLE size, with interleaved fata, + // because JS does not support effective + this.dyn_ltree = new utils.Buf16(HEAP_SIZE * 2); + this.dyn_dtree = new utils.Buf16((2 * D_CODES + 1) * 2); + this.bl_tree = new utils.Buf16((2 * BL_CODES + 1) * 2); + zero(this.dyn_ltree); + zero(this.dyn_dtree); + zero(this.bl_tree); + + this.l_desc = null; /* desc. for literal tree */ + this.d_desc = null; /* desc. for distance tree */ + this.bl_desc = null; /* desc. for bit length tree */ + + //ush bl_count[MAX_BITS+1]; + this.bl_count = new utils.Buf16(MAX_BITS + 1); + /* number of codes at each bit length for an optimal tree */ + + //int heap[2*L_CODES+1]; /* heap used to build the Huffman trees */ + this.heap = new utils.Buf16(2 * L_CODES + 1); /* heap used to build the Huffman trees */ + zero(this.heap); + + this.heap_len = 0; /* number of elements in the heap */ + this.heap_max = 0; /* element of largest frequency */ + /* The sons of heap[n] are heap[2*n] and heap[2*n+1]. heap[0] is not used. + * The same heap array is used to build all trees. + */ + + this.depth = new utils.Buf16(2 * L_CODES + 1); //uch depth[2*L_CODES+1]; + zero(this.depth); + /* Depth of each subtree used as tie breaker for trees of equal frequency + */ + + this.l_buf = 0; /* buffer index for literals or lengths */ + + this.lit_bufsize = 0; + /* Size of match buffer for literals/lengths. There are 4 reasons for + * limiting lit_bufsize to 64K: + * - frequencies can be kept in 16 bit counters + * - if compression is not successful for the first block, all input + * data is still in the window so we can still emit a stored block even + * when input comes from standard input. (This can also be done for + * all blocks if lit_bufsize is not greater than 32K.) + * - if compression is not successful for a file smaller than 64K, we can + * even emit a stored file instead of a stored block (saving 5 bytes). + * This is applicable only for zip (not gzip or zlib). + * - creating new Huffman trees less frequently may not provide fast + * adaptation to changes in the input data statistics. (Take for + * example a binary file with poorly compressible code followed by + * a highly compressible string table.) Smaller buffer sizes give + * fast adaptation but have of course the overhead of transmitting + * trees more frequently. + * - I can't count above 4 + */ + + this.last_lit = 0; /* running index in l_buf */ + + this.d_buf = 0; + /* Buffer index for distances. To simplify the code, d_buf and l_buf have + * the same number of elements. To use different lengths, an extra flag + * array would be necessary. + */ + + this.opt_len = 0; /* bit length of current block with optimal trees */ + this.static_len = 0; /* bit length of current block with static trees */ + this.matches = 0; /* number of string matches in current block */ + this.insert = 0; /* bytes at end of window left to insert */ + + + this.bi_buf = 0; + /* Output buffer. bits are inserted starting at the bottom (least + * significant bits). + */ + this.bi_valid = 0; + /* Number of valid bits in bi_buf. All bits above the last valid bit + * are always zero. + */ + + // Used for window memory init. We safely ignore it for JS. That makes + // sense only for pointers and memory check tools. + //this.high_water = 0; + /* High water mark offset in window for initialized bytes -- bytes above + * this are set to zero in order to avoid memory check warnings when + * longest match routines access bytes past the input. This is then + * updated to the new high water mark. + */ +} + + +function deflateResetKeep(strm) { + var s; + + if (!strm || !strm.state) { + return err(strm, Z_STREAM_ERROR); + } + + strm.total_in = strm.total_out = 0; + strm.data_type = Z_UNKNOWN; + + s = strm.state; + s.pending = 0; + s.pending_out = 0; + + if (s.wrap < 0) { + s.wrap = -s.wrap; + /* was made negative by deflate(..., Z_FINISH); */ + } + s.status = (s.wrap ? INIT_STATE : BUSY_STATE); + strm.adler = (s.wrap === 2) ? + 0 // crc32(0, Z_NULL, 0) + : + 1; // adler32(0, Z_NULL, 0) + s.last_flush = Z_NO_FLUSH; + trees._tr_init(s); + return Z_OK; +} + + +function deflateReset(strm) { + var ret = deflateResetKeep(strm); + if (ret === Z_OK) { + lm_init(strm.state); + } + return ret; +} + + +function deflateSetHeader(strm, head) { + if (!strm || !strm.state) { return Z_STREAM_ERROR; } + if (strm.state.wrap !== 2) { return Z_STREAM_ERROR; } + strm.state.gzhead = head; + return Z_OK; +} + + +function deflateInit2(strm, level, method, windowBits, memLevel, strategy) { + if (!strm) { // === Z_NULL + return Z_STREAM_ERROR; + } + var wrap = 1; + + if (level === Z_DEFAULT_COMPRESSION) { + level = 6; + } + + if (windowBits < 0) { /* suppress zlib wrapper */ + wrap = 0; + windowBits = -windowBits; + } + + else if (windowBits > 15) { + wrap = 2; /* write gzip wrapper instead */ + windowBits -= 16; + } + + + if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method !== Z_DEFLATED || + windowBits < 8 || windowBits > 15 || level < 0 || level > 9 || + strategy < 0 || strategy > Z_FIXED) { + return err(strm, Z_STREAM_ERROR); + } + + + if (windowBits === 8) { + windowBits = 9; + } + /* until 256-byte window bug fixed */ + + var s = new DeflateState(); + + strm.state = s; + s.strm = strm; + + s.wrap = wrap; + s.gzhead = null; + s.w_bits = windowBits; + s.w_size = 1 << s.w_bits; + s.w_mask = s.w_size - 1; + + s.hash_bits = memLevel + 7; + s.hash_size = 1 << s.hash_bits; + s.hash_mask = s.hash_size - 1; + s.hash_shift = ~~((s.hash_bits + MIN_MATCH - 1) / MIN_MATCH); + + s.window = new utils.Buf8(s.w_size * 2); + s.head = new utils.Buf16(s.hash_size); + s.prev = new utils.Buf16(s.w_size); + + // Don't need mem init magic for JS. + //s.high_water = 0; /* nothing written to s->window yet */ + + s.lit_bufsize = 1 << (memLevel + 6); /* 16K elements by default */ + + s.pending_buf_size = s.lit_bufsize * 4; + + //overlay = (ushf *) ZALLOC(strm, s->lit_bufsize, sizeof(ush)+2); + //s->pending_buf = (uchf *) overlay; + s.pending_buf = new utils.Buf8(s.pending_buf_size); + + // It is offset from `s.pending_buf` (size is `s.lit_bufsize * 2`) + //s->d_buf = overlay + s->lit_bufsize/sizeof(ush); + s.d_buf = 1 * s.lit_bufsize; + + //s->l_buf = s->pending_buf + (1+sizeof(ush))*s->lit_bufsize; + s.l_buf = (1 + 2) * s.lit_bufsize; + + s.level = level; + s.strategy = strategy; + s.method = method; + + return deflateReset(strm); +} + +function deflateInit(strm, level) { + return deflateInit2(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY); +} + + +function deflate(strm, flush) { + var old_flush, s; + var beg, val; // for gzip header write only + + if (!strm || !strm.state || + flush > Z_BLOCK || flush < 0) { + return strm ? err(strm, Z_STREAM_ERROR) : Z_STREAM_ERROR; + } + + s = strm.state; + + if (!strm.output || + (!strm.input && strm.avail_in !== 0) || + (s.status === FINISH_STATE && flush !== Z_FINISH)) { + return err(strm, (strm.avail_out === 0) ? Z_BUF_ERROR : Z_STREAM_ERROR); + } + + s.strm = strm; /* just in case */ + old_flush = s.last_flush; + s.last_flush = flush; + + /* Write the header */ + if (s.status === INIT_STATE) { + + if (s.wrap === 2) { // GZIP header + strm.adler = 0; //crc32(0L, Z_NULL, 0); + put_byte(s, 31); + put_byte(s, 139); + put_byte(s, 8); + if (!s.gzhead) { // s->gzhead == Z_NULL + put_byte(s, 0); + put_byte(s, 0); + put_byte(s, 0); + put_byte(s, 0); + put_byte(s, 0); + put_byte(s, s.level === 9 ? 2 : + (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ? + 4 : 0)); + put_byte(s, OS_CODE); + s.status = BUSY_STATE; + } + else { + put_byte(s, (s.gzhead.text ? 1 : 0) + + (s.gzhead.hcrc ? 2 : 0) + + (!s.gzhead.extra ? 0 : 4) + + (!s.gzhead.name ? 0 : 8) + + (!s.gzhead.comment ? 0 : 16) + ); + put_byte(s, s.gzhead.time & 0xff); + put_byte(s, (s.gzhead.time >> 8) & 0xff); + put_byte(s, (s.gzhead.time >> 16) & 0xff); + put_byte(s, (s.gzhead.time >> 24) & 0xff); + put_byte(s, s.level === 9 ? 2 : + (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2 ? + 4 : 0)); + put_byte(s, s.gzhead.os & 0xff); + if (s.gzhead.extra && s.gzhead.extra.length) { + put_byte(s, s.gzhead.extra.length & 0xff); + put_byte(s, (s.gzhead.extra.length >> 8) & 0xff); + } + if (s.gzhead.hcrc) { + strm.adler = crc32(strm.adler, s.pending_buf, s.pending, 0); + } + s.gzindex = 0; + s.status = EXTRA_STATE; + } + } + else // DEFLATE header + { + var header = (Z_DEFLATED + ((s.w_bits - 8) << 4)) << 8; + var level_flags = -1; + + if (s.strategy >= Z_HUFFMAN_ONLY || s.level < 2) { + level_flags = 0; + } else if (s.level < 6) { + level_flags = 1; + } else if (s.level === 6) { + level_flags = 2; + } else { + level_flags = 3; + } + header |= (level_flags << 6); + if (s.strstart !== 0) { header |= PRESET_DICT; } + header += 31 - (header % 31); + + s.status = BUSY_STATE; + putShortMSB(s, header); + + /* Save the adler32 of the preset dictionary: */ + if (s.strstart !== 0) { + putShortMSB(s, strm.adler >>> 16); + putShortMSB(s, strm.adler & 0xffff); + } + strm.adler = 1; // adler32(0L, Z_NULL, 0); + } + } + +//#ifdef GZIP + if (s.status === EXTRA_STATE) { + if (s.gzhead.extra/* != Z_NULL*/) { + beg = s.pending; /* start of bytes to update crc */ + + while (s.gzindex < (s.gzhead.extra.length & 0xffff)) { + if (s.pending === s.pending_buf_size) { + if (s.gzhead.hcrc && s.pending > beg) { + strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); + } + flush_pending(strm); + beg = s.pending; + if (s.pending === s.pending_buf_size) { + break; + } + } + put_byte(s, s.gzhead.extra[s.gzindex] & 0xff); + s.gzindex++; + } + if (s.gzhead.hcrc && s.pending > beg) { + strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); + } + if (s.gzindex === s.gzhead.extra.length) { + s.gzindex = 0; + s.status = NAME_STATE; + } + } + else { + s.status = NAME_STATE; + } + } + if (s.status === NAME_STATE) { + if (s.gzhead.name/* != Z_NULL*/) { + beg = s.pending; /* start of bytes to update crc */ + //int val; + + do { + if (s.pending === s.pending_buf_size) { + if (s.gzhead.hcrc && s.pending > beg) { + strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); + } + flush_pending(strm); + beg = s.pending; + if (s.pending === s.pending_buf_size) { + val = 1; + break; + } + } + // JS specific: little magic to add zero terminator to end of string + if (s.gzindex < s.gzhead.name.length) { + val = s.gzhead.name.charCodeAt(s.gzindex++) & 0xff; + } else { + val = 0; + } + put_byte(s, val); + } while (val !== 0); + + if (s.gzhead.hcrc && s.pending > beg) { + strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); + } + if (val === 0) { + s.gzindex = 0; + s.status = COMMENT_STATE; + } + } + else { + s.status = COMMENT_STATE; + } + } + if (s.status === COMMENT_STATE) { + if (s.gzhead.comment/* != Z_NULL*/) { + beg = s.pending; /* start of bytes to update crc */ + //int val; + + do { + if (s.pending === s.pending_buf_size) { + if (s.gzhead.hcrc && s.pending > beg) { + strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); + } + flush_pending(strm); + beg = s.pending; + if (s.pending === s.pending_buf_size) { + val = 1; + break; + } + } + // JS specific: little magic to add zero terminator to end of string + if (s.gzindex < s.gzhead.comment.length) { + val = s.gzhead.comment.charCodeAt(s.gzindex++) & 0xff; + } else { + val = 0; + } + put_byte(s, val); + } while (val !== 0); + + if (s.gzhead.hcrc && s.pending > beg) { + strm.adler = crc32(strm.adler, s.pending_buf, s.pending - beg, beg); + } + if (val === 0) { + s.status = HCRC_STATE; + } + } + else { + s.status = HCRC_STATE; + } + } + if (s.status === HCRC_STATE) { + if (s.gzhead.hcrc) { + if (s.pending + 2 > s.pending_buf_size) { + flush_pending(strm); + } + if (s.pending + 2 <= s.pending_buf_size) { + put_byte(s, strm.adler & 0xff); + put_byte(s, (strm.adler >> 8) & 0xff); + strm.adler = 0; //crc32(0L, Z_NULL, 0); + s.status = BUSY_STATE; + } + } + else { + s.status = BUSY_STATE; + } + } +//#endif + + /* Flush as much pending output as possible */ + if (s.pending !== 0) { + flush_pending(strm); + if (strm.avail_out === 0) { + /* Since avail_out is 0, deflate will be called again with + * more output space, but possibly with both pending and + * avail_in equal to zero. There won't be anything to do, + * but this is not an error situation so make sure we + * return OK instead of BUF_ERROR at next call of deflate: + */ + s.last_flush = -1; + return Z_OK; + } + + /* Make sure there is something to do and avoid duplicate consecutive + * flushes. For repeated and useless calls with Z_FINISH, we keep + * returning Z_STREAM_END instead of Z_BUF_ERROR. + */ + } else if (strm.avail_in === 0 && rank(flush) <= rank(old_flush) && + flush !== Z_FINISH) { + return err(strm, Z_BUF_ERROR); + } + + /* User must not provide more input after the first FINISH: */ + if (s.status === FINISH_STATE && strm.avail_in !== 0) { + return err(strm, Z_BUF_ERROR); + } + + /* Start a new block or continue the current one. + */ + if (strm.avail_in !== 0 || s.lookahead !== 0 || + (flush !== Z_NO_FLUSH && s.status !== FINISH_STATE)) { + var bstate = (s.strategy === Z_HUFFMAN_ONLY) ? deflate_huff(s, flush) : + (s.strategy === Z_RLE ? deflate_rle(s, flush) : + configuration_table[s.level].func(s, flush)); + + if (bstate === BS_FINISH_STARTED || bstate === BS_FINISH_DONE) { + s.status = FINISH_STATE; + } + if (bstate === BS_NEED_MORE || bstate === BS_FINISH_STARTED) { + if (strm.avail_out === 0) { + s.last_flush = -1; + /* avoid BUF_ERROR next call, see above */ + } + return Z_OK; + /* If flush != Z_NO_FLUSH && avail_out == 0, the next call + * of deflate should use the same flush parameter to make sure + * that the flush is complete. So we don't have to output an + * empty block here, this will be done at next call. This also + * ensures that for a very small output buffer, we emit at most + * one empty block. + */ + } + if (bstate === BS_BLOCK_DONE) { + if (flush === Z_PARTIAL_FLUSH) { + trees._tr_align(s); + } + else if (flush !== Z_BLOCK) { /* FULL_FLUSH or SYNC_FLUSH */ + + trees._tr_stored_block(s, 0, 0, false); + /* For a full flush, this empty block will be recognized + * as a special marker by inflate_sync(). + */ + if (flush === Z_FULL_FLUSH) { + /*** CLEAR_HASH(s); ***/ /* forget history */ + zero(s.head); // Fill with NIL (= 0); + + if (s.lookahead === 0) { + s.strstart = 0; + s.block_start = 0; + s.insert = 0; + } + } + } + flush_pending(strm); + if (strm.avail_out === 0) { + s.last_flush = -1; /* avoid BUF_ERROR at next call, see above */ + return Z_OK; + } + } + } + //Assert(strm->avail_out > 0, "bug2"); + //if (strm.avail_out <= 0) { throw new Error("bug2");} + + if (flush !== Z_FINISH) { return Z_OK; } + if (s.wrap <= 0) { return Z_STREAM_END; } + + /* Write the trailer */ + if (s.wrap === 2) { + put_byte(s, strm.adler & 0xff); + put_byte(s, (strm.adler >> 8) & 0xff); + put_byte(s, (strm.adler >> 16) & 0xff); + put_byte(s, (strm.adler >> 24) & 0xff); + put_byte(s, strm.total_in & 0xff); + put_byte(s, (strm.total_in >> 8) & 0xff); + put_byte(s, (strm.total_in >> 16) & 0xff); + put_byte(s, (strm.total_in >> 24) & 0xff); + } + else + { + putShortMSB(s, strm.adler >>> 16); + putShortMSB(s, strm.adler & 0xffff); + } + + flush_pending(strm); + /* If avail_out is zero, the application will call deflate again + * to flush the rest. + */ + if (s.wrap > 0) { s.wrap = -s.wrap; } + /* write the trailer only once! */ + return s.pending !== 0 ? Z_OK : Z_STREAM_END; +} + +function deflateEnd(strm) { + var status; + + if (!strm/*== Z_NULL*/ || !strm.state/*== Z_NULL*/) { + return Z_STREAM_ERROR; + } + + status = strm.state.status; + if (status !== INIT_STATE && + status !== EXTRA_STATE && + status !== NAME_STATE && + status !== COMMENT_STATE && + status !== HCRC_STATE && + status !== BUSY_STATE && + status !== FINISH_STATE + ) { + return err(strm, Z_STREAM_ERROR); + } + + strm.state = null; + + return status === BUSY_STATE ? err(strm, Z_DATA_ERROR) : Z_OK; +} + + +/* ========================================================================= + * Initializes the compression dictionary from the given byte + * sequence without producing any compressed output. + */ +function deflateSetDictionary(strm, dictionary) { + var dictLength = dictionary.length; + + var s; + var str, n; + var wrap; + var avail; + var next; + var input; + var tmpDict; + + if (!strm/*== Z_NULL*/ || !strm.state/*== Z_NULL*/) { + return Z_STREAM_ERROR; + } + + s = strm.state; + wrap = s.wrap; + + if (wrap === 2 || (wrap === 1 && s.status !== INIT_STATE) || s.lookahead) { + return Z_STREAM_ERROR; + } + + /* when using zlib wrappers, compute Adler-32 for provided dictionary */ + if (wrap === 1) { + /* adler32(strm->adler, dictionary, dictLength); */ + strm.adler = adler32(strm.adler, dictionary, dictLength, 0); + } + + s.wrap = 0; /* avoid computing Adler-32 in read_buf */ + + /* if dictionary would fill window, just replace the history */ + if (dictLength >= s.w_size) { + if (wrap === 0) { /* already empty otherwise */ + /*** CLEAR_HASH(s); ***/ + zero(s.head); // Fill with NIL (= 0); + s.strstart = 0; + s.block_start = 0; + s.insert = 0; + } + /* use the tail */ + // dictionary = dictionary.slice(dictLength - s.w_size); + tmpDict = new utils.Buf8(s.w_size); + utils.arraySet(tmpDict, dictionary, dictLength - s.w_size, s.w_size, 0); + dictionary = tmpDict; + dictLength = s.w_size; + } + /* insert dictionary into window and hash */ + avail = strm.avail_in; + next = strm.next_in; + input = strm.input; + strm.avail_in = dictLength; + strm.next_in = 0; + strm.input = dictionary; + fill_window(s); + while (s.lookahead >= MIN_MATCH) { + str = s.strstart; + n = s.lookahead - (MIN_MATCH - 1); + do { + /* UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]); */ + s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + MIN_MATCH - 1]) & s.hash_mask; + + s.prev[str & s.w_mask] = s.head[s.ins_h]; + + s.head[s.ins_h] = str; + str++; + } while (--n); + s.strstart = str; + s.lookahead = MIN_MATCH - 1; + fill_window(s); + } + s.strstart += s.lookahead; + s.block_start = s.strstart; + s.insert = s.lookahead; + s.lookahead = 0; + s.match_length = s.prev_length = MIN_MATCH - 1; + s.match_available = 0; + strm.next_in = next; + strm.input = input; + strm.avail_in = avail; + s.wrap = wrap; + return Z_OK; +} + + +exports.deflateInit = deflateInit; +exports.deflateInit2 = deflateInit2; +exports.deflateReset = deflateReset; +exports.deflateResetKeep = deflateResetKeep; +exports.deflateSetHeader = deflateSetHeader; +exports.deflate = deflate; +exports.deflateEnd = deflateEnd; +exports.deflateSetDictionary = deflateSetDictionary; +exports.deflateInfo = 'pako deflate (from Nodeca project)'; + +/* Not implemented +exports.deflateBound = deflateBound; +exports.deflateCopy = deflateCopy; +exports.deflateParams = deflateParams; +exports.deflatePending = deflatePending; +exports.deflatePrime = deflatePrime; +exports.deflateTune = deflateTune; +*/ /***/ }, /* 207 */ -/***/ function(module, exports, __webpack_require__) { +/***/ function(module, exports) { - const AbstractHandler = __webpack_require__(180); +"use strict"; +'use strict'; - const ClientUser = __webpack_require__(208); +// See state defs from inflate.js +var BAD = 30; /* got a data error -- remain here until reset */ +var TYPE = 12; /* i: waiting for type bits, including last-flag bit */ - class ReadyHandler extends AbstractHandler { - handle(packet) { - const client = this.packetManager.client; - const data = packet.d; +/* + Decode literal, length, and distance codes and write out the resulting + literal and match bytes until either not enough input or output is + available, an end-of-block is encountered, or a data error is encountered. + When large enough input and output buffers are supplied to inflate(), for + example, a 16K input buffer and a 64K output buffer, more than 95% of the + inflate execution time is spent in this routine. - const clientUser = new ClientUser(client, data.user); - client.user = clientUser; - client.readyAt = new Date(); - client.users.set(clientUser.id, clientUser); + Entry assumptions: - for (const guild of data.guilds) client.dataManager.newGuild(guild); - for (const privateDM of data.private_channels) client.dataManager.newChannel(privateDM); + state.mode === LEN + strm.avail_in >= 6 + strm.avail_out >= 258 + start >= strm.avail_out + state.bits < 8 - for (const relation of data.relationships) { - const user = client.dataManager.newUser(relation.user); - if (relation.type === 1) { - client.user.friends.set(user.id, user); - } else if (relation.type === 2) { - client.user.blocked.set(user.id, user); - } - } + On return, state.mode is one of: - data.presences = data.presences || []; - for (const presence of data.presences) { - client.dataManager.newUser(presence.user); - client._setPresence(presence.user.id, presence); - } + LEN -- ran out of enough output space or enough available input + TYPE -- reached end of block code, inflate() to interpret next block + BAD -- error in block data - if (data.notes) { - for (const user in data.notes) { - let note = data.notes[user]; - if (!note.length) note = null; + Notes: - client.user.notes.set(user, note); - } - } + - The maximum input bits used by a length/distance pair is 15 bits for the + length code, 5 bits for the length extra, 15 bits for the distance code, + and 13 bits for the distance extra. This totals 48 bits, or six bytes. + Therefore if strm.avail_in >= 6, then there is enough input to avoid + checking for available input while decoding. - if (!client.user.bot && client.options.sync) client.setInterval(client.syncGuilds.bind(client), 30000); - client.once('ready', client.syncGuilds.bind(client)); + - The maximum bytes that a single length/distance pair can output is 258 + bytes, which is the maximum length that can be coded. inflate_fast() + requires strm.avail_out >= 258 for each loop to avoid checking for + output space. + */ +module.exports = function inflate_fast(strm, start) { + var state; + var _in; /* local strm.input */ + var last; /* have enough input while in < last */ + var _out; /* local strm.output */ + var beg; /* inflate()'s initial strm.output */ + var end; /* while out < end, enough space available */ +//#ifdef INFLATE_STRICT + var dmax; /* maximum distance from zlib header */ +//#endif + var wsize; /* window size or zero if not using window */ + var whave; /* valid bytes in the window */ + var wnext; /* window write index */ + // Use `s_window` instead `window`, avoid conflict with instrumentation tools + var s_window; /* allocated sliding window, if wsize != 0 */ + var hold; /* local strm.hold */ + var bits; /* local strm.bits */ + var lcode; /* local strm.lencode */ + var dcode; /* local strm.distcode */ + var lmask; /* mask for first level of length codes */ + var dmask; /* mask for first level of distance codes */ + var here; /* retrieved table entry */ + var op; /* code bits, operation, extra bits, or */ + /* window position, window bytes to copy */ + var len; /* match length, unused bytes */ + var dist; /* match distance */ + var from; /* where to copy match from */ + var from_source; - if (!client.users.has('1')) { - client.dataManager.newUser({ - id: '1', - username: 'Clyde', - discriminator: '0000', - avatar: 'https://discordapp.com/assets/f78426a064bc9dd24847519259bc42af.png', - bot: true, - status: 'online', - game: null, - verified: true, - }); - } - client.setTimeout(() => { - if (!client.ws.normalReady) client.ws._emitReady(false); - }, 1200 * data.guilds.length); + var input, output; // JS specific, because we have no pointers - this.packetManager.ws.sessionID = data.session_id; - this.packetManager.ws.checkIfReady(); - } - } + /* copy state to local variables */ + state = strm.state; + //here = state.here; + _in = strm.next_in; + input = strm.input; + last = _in + (strm.avail_in - 5); + _out = strm.next_out; + output = strm.output; + beg = _out - (start - strm.avail_out); + end = _out + (strm.avail_out - 257); +//#ifdef INFLATE_STRICT + dmax = state.dmax; +//#endif + wsize = state.wsize; + whave = state.whave; + wnext = state.wnext; + s_window = state.window; + hold = state.hold; + bits = state.bits; + lcode = state.lencode; + dcode = state.distcode; + lmask = (1 << state.lenbits) - 1; + dmask = (1 << state.distbits) - 1; - module.exports = ReadyHandler; + + /* decode literals and length/distances until end-of-block or not enough + input data or output space */ + + top: + do { + if (bits < 15) { + hold += input[_in++] << bits; + bits += 8; + hold += input[_in++] << bits; + bits += 8; + } + + here = lcode[hold & lmask]; + + dolen: + for (;;) { // Goto emulation + op = here >>> 24/*here.bits*/; + hold >>>= op; + bits -= op; + op = (here >>> 16) & 0xff/*here.op*/; + if (op === 0) { /* literal */ + //Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ? + // "inflate: literal '%c'\n" : + // "inflate: literal 0x%02x\n", here.val)); + output[_out++] = here & 0xffff/*here.val*/; + } + else if (op & 16) { /* length base */ + len = here & 0xffff/*here.val*/; + op &= 15; /* number of extra bits */ + if (op) { + if (bits < op) { + hold += input[_in++] << bits; + bits += 8; + } + len += hold & ((1 << op) - 1); + hold >>>= op; + bits -= op; + } + //Tracevv((stderr, "inflate: length %u\n", len)); + if (bits < 15) { + hold += input[_in++] << bits; + bits += 8; + hold += input[_in++] << bits; + bits += 8; + } + here = dcode[hold & dmask]; + + dodist: + for (;;) { // goto emulation + op = here >>> 24/*here.bits*/; + hold >>>= op; + bits -= op; + op = (here >>> 16) & 0xff/*here.op*/; + + if (op & 16) { /* distance base */ + dist = here & 0xffff/*here.val*/; + op &= 15; /* number of extra bits */ + if (bits < op) { + hold += input[_in++] << bits; + bits += 8; + if (bits < op) { + hold += input[_in++] << bits; + bits += 8; + } + } + dist += hold & ((1 << op) - 1); +//#ifdef INFLATE_STRICT + if (dist > dmax) { + strm.msg = 'invalid distance too far back'; + state.mode = BAD; + break top; + } +//#endif + hold >>>= op; + bits -= op; + //Tracevv((stderr, "inflate: distance %u\n", dist)); + op = _out - beg; /* max distance in output */ + if (dist > op) { /* see if copy from window */ + op = dist - op; /* distance back in window */ + if (op > whave) { + if (state.sane) { + strm.msg = 'invalid distance too far back'; + state.mode = BAD; + break top; + } + +// (!) This block is disabled in zlib defailts, +// don't enable it for binary compatibility +//#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR +// if (len <= op - whave) { +// do { +// output[_out++] = 0; +// } while (--len); +// continue top; +// } +// len -= op - whave; +// do { +// output[_out++] = 0; +// } while (--op > whave); +// if (op === 0) { +// from = _out - dist; +// do { +// output[_out++] = output[from++]; +// } while (--len); +// continue top; +// } +//#endif + } + from = 0; // window index + from_source = s_window; + if (wnext === 0) { /* very common case */ + from += wsize - op; + if (op < len) { /* some from window */ + len -= op; + do { + output[_out++] = s_window[from++]; + } while (--op); + from = _out - dist; /* rest from output */ + from_source = output; + } + } + else if (wnext < op) { /* wrap around window */ + from += wsize + wnext - op; + op -= wnext; + if (op < len) { /* some from end of window */ + len -= op; + do { + output[_out++] = s_window[from++]; + } while (--op); + from = 0; + if (wnext < len) { /* some from start of window */ + op = wnext; + len -= op; + do { + output[_out++] = s_window[from++]; + } while (--op); + from = _out - dist; /* rest from output */ + from_source = output; + } + } + } + else { /* contiguous in window */ + from += wnext - op; + if (op < len) { /* some from window */ + len -= op; + do { + output[_out++] = s_window[from++]; + } while (--op); + from = _out - dist; /* rest from output */ + from_source = output; + } + } + while (len > 2) { + output[_out++] = from_source[from++]; + output[_out++] = from_source[from++]; + output[_out++] = from_source[from++]; + len -= 3; + } + if (len) { + output[_out++] = from_source[from++]; + if (len > 1) { + output[_out++] = from_source[from++]; + } + } + } + else { + from = _out - dist; /* copy direct from output */ + do { /* minimum length is three */ + output[_out++] = output[from++]; + output[_out++] = output[from++]; + output[_out++] = output[from++]; + len -= 3; + } while (len > 2); + if (len) { + output[_out++] = output[from++]; + if (len > 1) { + output[_out++] = output[from++]; + } + } + } + } + else if ((op & 64) === 0) { /* 2nd level distance code */ + here = dcode[(here & 0xffff)/*here.val*/ + (hold & ((1 << op) - 1))]; + continue dodist; + } + else { + strm.msg = 'invalid distance code'; + state.mode = BAD; + break top; + } + + break; // need to emulate goto via "continue" + } + } + else if ((op & 64) === 0) { /* 2nd level length code */ + here = lcode[(here & 0xffff)/*here.val*/ + (hold & ((1 << op) - 1))]; + continue dolen; + } + else if (op & 32) { /* end-of-block */ + //Tracevv((stderr, "inflate: end of block\n")); + state.mode = TYPE; + break top; + } + else { + strm.msg = 'invalid literal/length code'; + state.mode = BAD; + break top; + } + + break; // need to emulate goto via "continue" + } + } while (_in < last && _out < end); + + /* return unused bytes (on entry, bits < 8, so in won't go too far back) */ + len = bits >> 3; + _in -= len; + bits -= len << 3; + hold &= (1 << bits) - 1; + + /* update state and return */ + strm.next_in = _in; + strm.next_out = _out; + strm.avail_in = (_in < last ? 5 + (last - _in) : 5 - (_in - last)); + strm.avail_out = (_out < end ? 257 + (end - _out) : 257 - (_out - end)); + state.hold = hold; + state.bits = bits; + return; +}; /***/ }, /* 208 */ /***/ function(module, exports, __webpack_require__) { - const User = __webpack_require__(13); - const Collection = __webpack_require__(10); +"use strict"; +'use strict'; - /** - * Represents the logged in client's Discord user - * @extends {User} - */ - class ClientUser extends User { - setup(data) { - super.setup(data); - /** - * Whether or not this account has been verified - * @type {boolean} - */ - this.verified = data.verified; +var utils = __webpack_require__(38); +var adler32 = __webpack_require__(105); +var crc32 = __webpack_require__(106); +var inflate_fast = __webpack_require__(207); +var inflate_table = __webpack_require__(209); - /** - * The email of this account - * @type {string} - */ - this.email = data.email; - this.localPresence = {}; - this._typing = new Map(); +var CODES = 0; +var LENS = 1; +var DISTS = 2; - /** - * A Collection of friends for the logged in user. - * This is only filled when using a user account. - * @type {Collection} - */ - this.friends = new Collection(); +/* Public constants ==========================================================*/ +/* ===========================================================================*/ - /** - * A Collection of blocked users for the logged in user. - * This is only filled when using a user account. - * @type {Collection} - */ - this.blocked = new Collection(); - /** - * A Collection of notes for the logged in user. - * This is only filled when using a user account. - * @type {Collection} - */ - this.notes = new Collection(); - } +/* Allowed flush values; see deflate() and inflate() below for details */ +//var Z_NO_FLUSH = 0; +//var Z_PARTIAL_FLUSH = 1; +//var Z_SYNC_FLUSH = 2; +//var Z_FULL_FLUSH = 3; +var Z_FINISH = 4; +var Z_BLOCK = 5; +var Z_TREES = 6; - edit(data) { - return this.client.rest.methods.updateCurrentUser(data); - } - /** - * Set the username of the logged in Client. - * Changing usernames in Discord is heavily rate limited, with only 2 requests - * every hour. Use this sparingly! - * @param {string} username The new username - * @returns {Promise} - * @example - * // set username - * client.user.setUsername('discordjs') - * .then(user => console.log(`My new username is ${user.username}`)) - * .catch(console.error); - */ - setUsername(username) { - return this.client.rest.methods.updateCurrentUser({ username }); - } +/* Return codes for the compression/decompression functions. Negative values + * are errors, positive values are used for special but normal events. + */ +var Z_OK = 0; +var Z_STREAM_END = 1; +var Z_NEED_DICT = 2; +//var Z_ERRNO = -1; +var Z_STREAM_ERROR = -2; +var Z_DATA_ERROR = -3; +var Z_MEM_ERROR = -4; +var Z_BUF_ERROR = -5; +//var Z_VERSION_ERROR = -6; - /** - * If this user is a "self bot" or logged in using a normal user's details (which should be avoided), you can set the - * email here. - * @param {string} email The new email - * @returns {Promise} - * @example - * // set email - * client.user.setEmail('bob@gmail.com') - * .then(user => console.log(`My new email is ${user.email}`)) - * .catch(console.error); - */ - setEmail(email) { - return this.client.rest.methods.updateCurrentUser({ email }); - } +/* The deflate compression method */ +var Z_DEFLATED = 8; - /** - * If this user is a "self bot" or logged in using a normal user's details (which should be avoided), you can set the - * password here. - * @param {string} password The new password - * @returns {Promise} - * @example - * // set password - * client.user.setPassword('password123') - * .then(user => console.log('New password set!')) - * .catch(console.error); - */ - setPassword(password) { - return this.client.rest.methods.updateCurrentUser({ password }); - } - /** - * Set the avatar of the logged in Client. - * @param {BufferResolvable|Base64Resolvable} avatar The new avatar - * @returns {Promise} - * @example - * // set avatar - * client.user.setAvatar('./avatar.png') - * .then(user => console.log(`New avatar set!`)) - * .catch(console.error); - */ - setAvatar(avatar) { - if (avatar.startsWith('data:')) { - return this.client.rest.methods.updateCurrentUser({ avatar }); - } else { - return this.client.resolver.resolveBuffer(avatar).then(data => - this.client.rest.methods.updateCurrentUser({ avatar: data }) - ); - } - } +/* STATES ====================================================================*/ +/* ===========================================================================*/ - /** - * Set the status of the logged in user. - * @param {string} status can be `online`, `idle`, `invisible` or `dnd` (do not disturb) - * @returns {Promise} - */ - setStatus(status) { - return this.setPresence({ status }); - } - /** - * Set the current game of the logged in user. - * @param {string} game the game being played - * @param {string} [streamingURL] an optional URL to a twitch stream, if one is available. - * @returns {Promise} - */ - setGame(game, streamingURL) { - return this.setPresence({ game: { - name: game, - url: streamingURL, - } }); - } +var HEAD = 1; /* i: waiting for magic header */ +var FLAGS = 2; /* i: waiting for method and flags (gzip) */ +var TIME = 3; /* i: waiting for modification time (gzip) */ +var OS = 4; /* i: waiting for extra flags and operating system (gzip) */ +var EXLEN = 5; /* i: waiting for extra length (gzip) */ +var EXTRA = 6; /* i: waiting for extra bytes (gzip) */ +var NAME = 7; /* i: waiting for end of file name (gzip) */ +var COMMENT = 8; /* i: waiting for end of comment (gzip) */ +var HCRC = 9; /* i: waiting for header crc (gzip) */ +var DICTID = 10; /* i: waiting for dictionary check value */ +var DICT = 11; /* waiting for inflateSetDictionary() call */ +var TYPE = 12; /* i: waiting for type bits, including last-flag bit */ +var TYPEDO = 13; /* i: same, but skip check to exit inflate on new block */ +var STORED = 14; /* i: waiting for stored size (length and complement) */ +var COPY_ = 15; /* i/o: same as COPY below, but only first time in */ +var COPY = 16; /* i/o: waiting for input or output to copy stored block */ +var TABLE = 17; /* i: waiting for dynamic block table lengths */ +var LENLENS = 18; /* i: waiting for code length code lengths */ +var CODELENS = 19; /* i: waiting for length/lit and distance code lengths */ +var LEN_ = 20; /* i: same as LEN below, but only first time in */ +var LEN = 21; /* i: waiting for length/lit/eob code */ +var LENEXT = 22; /* i: waiting for length extra bits */ +var DIST = 23; /* i: waiting for distance code */ +var DISTEXT = 24; /* i: waiting for distance extra bits */ +var MATCH = 25; /* o: waiting for output space to copy string */ +var LIT = 26; /* o: waiting for output space to write literal */ +var CHECK = 27; /* i: waiting for 32-bit check value */ +var LENGTH = 28; /* i: waiting for 32-bit length (gzip) */ +var DONE = 29; /* finished check, done -- remain here until reset */ +var BAD = 30; /* got a data error -- remain here until reset */ +var MEM = 31; /* got an inflate() memory error -- remain here until reset */ +var SYNC = 32; /* looking for synchronization bytes to restart inflate() */ - /** - * Set/remove the AFK flag for the current user. - * @param {boolean} afk whether or not the user is AFK. - * @returns {Promise} - */ - setAFK(afk) { - return this.setPresence({ afk }); - } +/* ===========================================================================*/ - /** - * Send a friend request - * This is only available when using a user account. - * @param {UserResolvable} user The user to send the friend request to. - * @returns {Promise} The user the friend request was sent to. - */ - addFriend(user) { - user = this.client.resolver.resolveUser(user); - return this.client.rest.methods.addFriend(user); - } - /** - * Remove a friend - * This is only available when using a user account. - * @param {UserResolvable} user The user to remove from your friends - * @returns {Promise} The user that was removed - */ - removeFriend(user) { - user = this.client.resolver.resolveUser(user); - return this.client.rest.methods.removeFriend(user); - } - /** - * Creates a guild - * This is only available when using a user account. - * @param {string} name The name of the guild - * @param {string} region The region for the server - * @param {BufferResolvable|Base64Resolvable} [icon=null] The icon for the guild - * @returns {Promise} The guild that was created - */ - createGuild(name, region, icon = null) { - if (!icon) return this.client.rest.methods.createGuild({ name, icon, region }); - if (icon.startsWith('data:')) { - return this.client.rest.methods.createGuild({ name, icon, region }); - } else { - return this.client.resolver.resolveBuffer(icon).then(data => - this.client.rest.methods.createGuild({ name, icon: data, region }) - ); - } - } +var ENOUGH_LENS = 852; +var ENOUGH_DISTS = 592; +//var ENOUGH = (ENOUGH_LENS+ENOUGH_DISTS); - /** - * Set the full presence of the current user. - * @param {Object} data the data to provide - * @returns {Promise} - */ - setPresence(data) { - // {"op":3,"d":{"status":"dnd","since":0,"game":null,"afk":false}} - return new Promise(resolve => { - let status = this.localPresence.status || this.presence.status; - let game = this.localPresence.game; - let afk = this.localPresence.afk || this.presence.afk; +var MAX_WBITS = 15; +/* 32K LZ77 window */ +var DEF_WBITS = MAX_WBITS; - if (!game && this.presence.game) { - game = { - name: this.presence.game.name, - type: this.presence.game.type, - url: this.presence.game.url, - }; - } - if (data.status) { - if (typeof data.status !== 'string') throw new TypeError('Status must be a string'); - status = data.status; - } +function zswap32(q) { + return (((q >>> 24) & 0xff) + + ((q >>> 8) & 0xff00) + + ((q & 0xff00) << 8) + + ((q & 0xff) << 24)); +} - if (data.game) { - game = data.game; - if (game.url) game.type = 1; - } - if (typeof data.afk !== 'undefined') afk = data.afk; - afk = Boolean(afk); +function InflateState() { + this.mode = 0; /* current inflate mode */ + this.last = false; /* true if processing last block */ + this.wrap = 0; /* bit 0 true for zlib, bit 1 true for gzip */ + this.havedict = false; /* true if dictionary provided */ + this.flags = 0; /* gzip header method and flags (0 if zlib) */ + this.dmax = 0; /* zlib header max distance (INFLATE_STRICT) */ + this.check = 0; /* protected copy of check value */ + this.total = 0; /* protected copy of output count */ + // TODO: may be {} + this.head = null; /* where to save gzip header information */ - this.localPresence = { status, game, afk }; - this.localPresence.since = 0; - this.localPresence.game = this.localPresence.game || null; + /* sliding window */ + this.wbits = 0; /* log base 2 of requested window size */ + this.wsize = 0; /* window size or zero if not using window */ + this.whave = 0; /* valid bytes in the window */ + this.wnext = 0; /* window write index */ + this.window = null; /* allocated sliding window, if needed */ - this.client.ws.send({ - op: 3, - d: this.localPresence, - }); + /* bit accumulator */ + this.hold = 0; /* input bit accumulator */ + this.bits = 0; /* number of bits in "in" */ - this.client._setPresence(this.id, this.localPresence); + /* for string and stored block copying */ + this.length = 0; /* literal or length of data to copy */ + this.offset = 0; /* distance back to copy string from */ - resolve(this); - }); - } - } + /* for table and code decoding */ + this.extra = 0; /* extra bits needed */ - module.exports = ClientUser; + /* fixed and dynamic code tables */ + this.lencode = null; /* starting table for length/literal codes */ + this.distcode = null; /* starting table for distance codes */ + this.lenbits = 0; /* index bits for lencode */ + this.distbits = 0; /* index bits for distcode */ + + /* dynamic table building */ + this.ncode = 0; /* number of code length code lengths */ + this.nlen = 0; /* number of length code lengths */ + this.ndist = 0; /* number of distance code lengths */ + this.have = 0; /* number of code lengths in lens[] */ + this.next = null; /* next available space in codes[] */ + + this.lens = new utils.Buf16(320); /* temporary storage for code lengths */ + this.work = new utils.Buf16(288); /* work area for code table building */ + + /* + because we don't have pointers in js, we use lencode and distcode directly + as buffers so we don't need codes + */ + //this.codes = new utils.Buf32(ENOUGH); /* space for code tables */ + this.lendyn = null; /* dynamic table for length/literal codes (JS specific) */ + this.distdyn = null; /* dynamic table for distance codes (JS specific) */ + this.sane = 0; /* if false, allow invalid distance too far */ + this.back = 0; /* bits back of last unprocessed length/lit */ + this.was = 0; /* initial length of match */ +} + +function inflateResetKeep(strm) { + var state; + + if (!strm || !strm.state) { return Z_STREAM_ERROR; } + state = strm.state; + strm.total_in = strm.total_out = state.total = 0; + strm.msg = ''; /*Z_NULL*/ + if (state.wrap) { /* to support ill-conceived Java test suite */ + strm.adler = state.wrap & 1; + } + state.mode = HEAD; + state.last = 0; + state.havedict = 0; + state.dmax = 32768; + state.head = null/*Z_NULL*/; + state.hold = 0; + state.bits = 0; + //state.lencode = state.distcode = state.next = state.codes; + state.lencode = state.lendyn = new utils.Buf32(ENOUGH_LENS); + state.distcode = state.distdyn = new utils.Buf32(ENOUGH_DISTS); + + state.sane = 1; + state.back = -1; + //Tracev((stderr, "inflate: reset\n")); + return Z_OK; +} + +function inflateReset(strm) { + var state; + + if (!strm || !strm.state) { return Z_STREAM_ERROR; } + state = strm.state; + state.wsize = 0; + state.whave = 0; + state.wnext = 0; + return inflateResetKeep(strm); + +} + +function inflateReset2(strm, windowBits) { + var wrap; + var state; + + /* get the state */ + if (!strm || !strm.state) { return Z_STREAM_ERROR; } + state = strm.state; + + /* extract wrap request from windowBits parameter */ + if (windowBits < 0) { + wrap = 0; + windowBits = -windowBits; + } + else { + wrap = (windowBits >> 4) + 1; + if (windowBits < 48) { + windowBits &= 15; + } + } + + /* set number of window bits, free window if different */ + if (windowBits && (windowBits < 8 || windowBits > 15)) { + return Z_STREAM_ERROR; + } + if (state.window !== null && state.wbits !== windowBits) { + state.window = null; + } + + /* update state and reset the rest of it */ + state.wrap = wrap; + state.wbits = windowBits; + return inflateReset(strm); +} + +function inflateInit2(strm, windowBits) { + var ret; + var state; + + if (!strm) { return Z_STREAM_ERROR; } + //strm.msg = Z_NULL; /* in case we return an error */ + + state = new InflateState(); + + //if (state === Z_NULL) return Z_MEM_ERROR; + //Tracev((stderr, "inflate: allocated\n")); + strm.state = state; + state.window = null/*Z_NULL*/; + ret = inflateReset2(strm, windowBits); + if (ret !== Z_OK) { + strm.state = null/*Z_NULL*/; + } + return ret; +} + +function inflateInit(strm) { + return inflateInit2(strm, DEF_WBITS); +} + + +/* + Return state with length and distance decoding tables and index sizes set to + fixed code decoding. Normally this returns fixed tables from inffixed.h. + If BUILDFIXED is defined, then instead this routine builds the tables the + first time it's called, and returns those tables the first time and + thereafter. This reduces the size of the code by about 2K bytes, in + exchange for a little execution time. However, BUILDFIXED should not be + used for threaded applications, since the rewriting of the tables and virgin + may not be thread-safe. + */ +var virgin = true; + +var lenfix, distfix; // We have no pointers in JS, so keep tables separate + +function fixedtables(state) { + /* build fixed huffman tables if first call (may not be thread safe) */ + if (virgin) { + var sym; + + lenfix = new utils.Buf32(512); + distfix = new utils.Buf32(32); + + /* literal/length table */ + sym = 0; + while (sym < 144) { state.lens[sym++] = 8; } + while (sym < 256) { state.lens[sym++] = 9; } + while (sym < 280) { state.lens[sym++] = 7; } + while (sym < 288) { state.lens[sym++] = 8; } + + inflate_table(LENS, state.lens, 0, 288, lenfix, 0, state.work, { bits: 9 }); + + /* distance table */ + sym = 0; + while (sym < 32) { state.lens[sym++] = 5; } + + inflate_table(DISTS, state.lens, 0, 32, distfix, 0, state.work, { bits: 5 }); + + /* do this just once */ + virgin = false; + } + + state.lencode = lenfix; + state.lenbits = 9; + state.distcode = distfix; + state.distbits = 5; +} + + +/* + Update the window with the last wsize (normally 32K) bytes written before + returning. If window does not exist yet, create it. This is only called + when a window is already in use, or when output has been written during this + inflate call, but the end of the deflate stream has not been reached yet. + It is also called to create a window for dictionary data when a dictionary + is loaded. + + Providing output buffers larger than 32K to inflate() should provide a speed + advantage, since only the last 32K of output is copied to the sliding window + upon return from inflate(), and since all distances after the first 32K of + output will fall in the output data, making match copies simpler and faster. + The advantage may be dependent on the size of the processor's data caches. + */ +function updatewindow(strm, src, end, copy) { + var dist; + var state = strm.state; + + /* if it hasn't been done already, allocate space for the window */ + if (state.window === null) { + state.wsize = 1 << state.wbits; + state.wnext = 0; + state.whave = 0; + + state.window = new utils.Buf8(state.wsize); + } + + /* copy state->wsize or less output bytes into the circular window */ + if (copy >= state.wsize) { + utils.arraySet(state.window, src, end - state.wsize, state.wsize, 0); + state.wnext = 0; + state.whave = state.wsize; + } + else { + dist = state.wsize - state.wnext; + if (dist > copy) { + dist = copy; + } + //zmemcpy(state->window + state->wnext, end - copy, dist); + utils.arraySet(state.window, src, end - copy, dist, state.wnext); + copy -= dist; + if (copy) { + //zmemcpy(state->window, end - copy, copy); + utils.arraySet(state.window, src, end - copy, copy, 0); + state.wnext = copy; + state.whave = state.wsize; + } + else { + state.wnext += dist; + if (state.wnext === state.wsize) { state.wnext = 0; } + if (state.whave < state.wsize) { state.whave += dist; } + } + } + return 0; +} + +function inflate(strm, flush) { + var state; + var input, output; // input/output buffers + var next; /* next input INDEX */ + var put; /* next output INDEX */ + var have, left; /* available input and output */ + var hold; /* bit buffer */ + var bits; /* bits in bit buffer */ + var _in, _out; /* save starting available input and output */ + var copy; /* number of stored or match bytes to copy */ + var from; /* where to copy match bytes from */ + var from_source; + var here = 0; /* current decoding table entry */ + var here_bits, here_op, here_val; // paked "here" denormalized (JS specific) + //var last; /* parent table entry */ + var last_bits, last_op, last_val; // paked "last" denormalized (JS specific) + var len; /* length to copy for repeats, bits to drop */ + var ret; /* return code */ + var hbuf = new utils.Buf8(4); /* buffer for gzip header crc calculation */ + var opts; + + var n; // temporary var for NEED_BITS + + var order = /* permutation of code lengths */ + [ 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 ]; + + + if (!strm || !strm.state || !strm.output || + (!strm.input && strm.avail_in !== 0)) { + return Z_STREAM_ERROR; + } + + state = strm.state; + if (state.mode === TYPE) { state.mode = TYPEDO; } /* skip check */ + + + //--- LOAD() --- + put = strm.next_out; + output = strm.output; + left = strm.avail_out; + next = strm.next_in; + input = strm.input; + have = strm.avail_in; + hold = state.hold; + bits = state.bits; + //--- + + _in = have; + _out = left; + ret = Z_OK; + + inf_leave: // goto emulation + for (;;) { + switch (state.mode) { + case HEAD: + if (state.wrap === 0) { + state.mode = TYPEDO; + break; + } + //=== NEEDBITS(16); + while (bits < 16) { + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + } + //===// + if ((state.wrap & 2) && hold === 0x8b1f) { /* gzip header */ + state.check = 0/*crc32(0L, Z_NULL, 0)*/; + //=== CRC2(state.check, hold); + hbuf[0] = hold & 0xff; + hbuf[1] = (hold >>> 8) & 0xff; + state.check = crc32(state.check, hbuf, 2, 0); + //===// + + //=== INITBITS(); + hold = 0; + bits = 0; + //===// + state.mode = FLAGS; + break; + } + state.flags = 0; /* expect zlib header */ + if (state.head) { + state.head.done = false; + } + if (!(state.wrap & 1) || /* check if zlib header allowed */ + (((hold & 0xff)/*BITS(8)*/ << 8) + (hold >> 8)) % 31) { + strm.msg = 'incorrect header check'; + state.mode = BAD; + break; + } + if ((hold & 0x0f)/*BITS(4)*/ !== Z_DEFLATED) { + strm.msg = 'unknown compression method'; + state.mode = BAD; + break; + } + //--- DROPBITS(4) ---// + hold >>>= 4; + bits -= 4; + //---// + len = (hold & 0x0f)/*BITS(4)*/ + 8; + if (state.wbits === 0) { + state.wbits = len; + } + else if (len > state.wbits) { + strm.msg = 'invalid window size'; + state.mode = BAD; + break; + } + state.dmax = 1 << len; + //Tracev((stderr, "inflate: zlib header ok\n")); + strm.adler = state.check = 1/*adler32(0L, Z_NULL, 0)*/; + state.mode = hold & 0x200 ? DICTID : TYPE; + //=== INITBITS(); + hold = 0; + bits = 0; + //===// + break; + case FLAGS: + //=== NEEDBITS(16); */ + while (bits < 16) { + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + } + //===// + state.flags = hold; + if ((state.flags & 0xff) !== Z_DEFLATED) { + strm.msg = 'unknown compression method'; + state.mode = BAD; + break; + } + if (state.flags & 0xe000) { + strm.msg = 'unknown header flags set'; + state.mode = BAD; + break; + } + if (state.head) { + state.head.text = ((hold >> 8) & 1); + } + if (state.flags & 0x0200) { + //=== CRC2(state.check, hold); + hbuf[0] = hold & 0xff; + hbuf[1] = (hold >>> 8) & 0xff; + state.check = crc32(state.check, hbuf, 2, 0); + //===// + } + //=== INITBITS(); + hold = 0; + bits = 0; + //===// + state.mode = TIME; + /* falls through */ + case TIME: + //=== NEEDBITS(32); */ + while (bits < 32) { + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + } + //===// + if (state.head) { + state.head.time = hold; + } + if (state.flags & 0x0200) { + //=== CRC4(state.check, hold) + hbuf[0] = hold & 0xff; + hbuf[1] = (hold >>> 8) & 0xff; + hbuf[2] = (hold >>> 16) & 0xff; + hbuf[3] = (hold >>> 24) & 0xff; + state.check = crc32(state.check, hbuf, 4, 0); + //=== + } + //=== INITBITS(); + hold = 0; + bits = 0; + //===// + state.mode = OS; + /* falls through */ + case OS: + //=== NEEDBITS(16); */ + while (bits < 16) { + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + } + //===// + if (state.head) { + state.head.xflags = (hold & 0xff); + state.head.os = (hold >> 8); + } + if (state.flags & 0x0200) { + //=== CRC2(state.check, hold); + hbuf[0] = hold & 0xff; + hbuf[1] = (hold >>> 8) & 0xff; + state.check = crc32(state.check, hbuf, 2, 0); + //===// + } + //=== INITBITS(); + hold = 0; + bits = 0; + //===// + state.mode = EXLEN; + /* falls through */ + case EXLEN: + if (state.flags & 0x0400) { + //=== NEEDBITS(16); */ + while (bits < 16) { + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + } + //===// + state.length = hold; + if (state.head) { + state.head.extra_len = hold; + } + if (state.flags & 0x0200) { + //=== CRC2(state.check, hold); + hbuf[0] = hold & 0xff; + hbuf[1] = (hold >>> 8) & 0xff; + state.check = crc32(state.check, hbuf, 2, 0); + //===// + } + //=== INITBITS(); + hold = 0; + bits = 0; + //===// + } + else if (state.head) { + state.head.extra = null/*Z_NULL*/; + } + state.mode = EXTRA; + /* falls through */ + case EXTRA: + if (state.flags & 0x0400) { + copy = state.length; + if (copy > have) { copy = have; } + if (copy) { + if (state.head) { + len = state.head.extra_len - state.length; + if (!state.head.extra) { + // Use untyped array for more conveniend processing later + state.head.extra = new Array(state.head.extra_len); + } + utils.arraySet( + state.head.extra, + input, + next, + // extra field is limited to 65536 bytes + // - no need for additional size check + copy, + /*len + copy > state.head.extra_max - len ? state.head.extra_max : copy,*/ + len + ); + //zmemcpy(state.head.extra + len, next, + // len + copy > state.head.extra_max ? + // state.head.extra_max - len : copy); + } + if (state.flags & 0x0200) { + state.check = crc32(state.check, input, copy, next); + } + have -= copy; + next += copy; + state.length -= copy; + } + if (state.length) { break inf_leave; } + } + state.length = 0; + state.mode = NAME; + /* falls through */ + case NAME: + if (state.flags & 0x0800) { + if (have === 0) { break inf_leave; } + copy = 0; + do { + // TODO: 2 or 1 bytes? + len = input[next + copy++]; + /* use constant limit because in js we should not preallocate memory */ + if (state.head && len && + (state.length < 65536 /*state.head.name_max*/)) { + state.head.name += String.fromCharCode(len); + } + } while (len && copy < have); + + if (state.flags & 0x0200) { + state.check = crc32(state.check, input, copy, next); + } + have -= copy; + next += copy; + if (len) { break inf_leave; } + } + else if (state.head) { + state.head.name = null; + } + state.length = 0; + state.mode = COMMENT; + /* falls through */ + case COMMENT: + if (state.flags & 0x1000) { + if (have === 0) { break inf_leave; } + copy = 0; + do { + len = input[next + copy++]; + /* use constant limit because in js we should not preallocate memory */ + if (state.head && len && + (state.length < 65536 /*state.head.comm_max*/)) { + state.head.comment += String.fromCharCode(len); + } + } while (len && copy < have); + if (state.flags & 0x0200) { + state.check = crc32(state.check, input, copy, next); + } + have -= copy; + next += copy; + if (len) { break inf_leave; } + } + else if (state.head) { + state.head.comment = null; + } + state.mode = HCRC; + /* falls through */ + case HCRC: + if (state.flags & 0x0200) { + //=== NEEDBITS(16); */ + while (bits < 16) { + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + } + //===// + if (hold !== (state.check & 0xffff)) { + strm.msg = 'header crc mismatch'; + state.mode = BAD; + break; + } + //=== INITBITS(); + hold = 0; + bits = 0; + //===// + } + if (state.head) { + state.head.hcrc = ((state.flags >> 9) & 1); + state.head.done = true; + } + strm.adler = state.check = 0; + state.mode = TYPE; + break; + case DICTID: + //=== NEEDBITS(32); */ + while (bits < 32) { + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + } + //===// + strm.adler = state.check = zswap32(hold); + //=== INITBITS(); + hold = 0; + bits = 0; + //===// + state.mode = DICT; + /* falls through */ + case DICT: + if (state.havedict === 0) { + //--- RESTORE() --- + strm.next_out = put; + strm.avail_out = left; + strm.next_in = next; + strm.avail_in = have; + state.hold = hold; + state.bits = bits; + //--- + return Z_NEED_DICT; + } + strm.adler = state.check = 1/*adler32(0L, Z_NULL, 0)*/; + state.mode = TYPE; + /* falls through */ + case TYPE: + if (flush === Z_BLOCK || flush === Z_TREES) { break inf_leave; } + /* falls through */ + case TYPEDO: + if (state.last) { + //--- BYTEBITS() ---// + hold >>>= bits & 7; + bits -= bits & 7; + //---// + state.mode = CHECK; + break; + } + //=== NEEDBITS(3); */ + while (bits < 3) { + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + } + //===// + state.last = (hold & 0x01)/*BITS(1)*/; + //--- DROPBITS(1) ---// + hold >>>= 1; + bits -= 1; + //---// + + switch ((hold & 0x03)/*BITS(2)*/) { + case 0: /* stored block */ + //Tracev((stderr, "inflate: stored block%s\n", + // state.last ? " (last)" : "")); + state.mode = STORED; + break; + case 1: /* fixed block */ + fixedtables(state); + //Tracev((stderr, "inflate: fixed codes block%s\n", + // state.last ? " (last)" : "")); + state.mode = LEN_; /* decode codes */ + if (flush === Z_TREES) { + //--- DROPBITS(2) ---// + hold >>>= 2; + bits -= 2; + //---// + break inf_leave; + } + break; + case 2: /* dynamic block */ + //Tracev((stderr, "inflate: dynamic codes block%s\n", + // state.last ? " (last)" : "")); + state.mode = TABLE; + break; + case 3: + strm.msg = 'invalid block type'; + state.mode = BAD; + } + //--- DROPBITS(2) ---// + hold >>>= 2; + bits -= 2; + //---// + break; + case STORED: + //--- BYTEBITS() ---// /* go to byte boundary */ + hold >>>= bits & 7; + bits -= bits & 7; + //---// + //=== NEEDBITS(32); */ + while (bits < 32) { + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + } + //===// + if ((hold & 0xffff) !== ((hold >>> 16) ^ 0xffff)) { + strm.msg = 'invalid stored block lengths'; + state.mode = BAD; + break; + } + state.length = hold & 0xffff; + //Tracev((stderr, "inflate: stored length %u\n", + // state.length)); + //=== INITBITS(); + hold = 0; + bits = 0; + //===// + state.mode = COPY_; + if (flush === Z_TREES) { break inf_leave; } + /* falls through */ + case COPY_: + state.mode = COPY; + /* falls through */ + case COPY: + copy = state.length; + if (copy) { + if (copy > have) { copy = have; } + if (copy > left) { copy = left; } + if (copy === 0) { break inf_leave; } + //--- zmemcpy(put, next, copy); --- + utils.arraySet(output, input, next, copy, put); + //---// + have -= copy; + next += copy; + left -= copy; + put += copy; + state.length -= copy; + break; + } + //Tracev((stderr, "inflate: stored end\n")); + state.mode = TYPE; + break; + case TABLE: + //=== NEEDBITS(14); */ + while (bits < 14) { + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + } + //===// + state.nlen = (hold & 0x1f)/*BITS(5)*/ + 257; + //--- DROPBITS(5) ---// + hold >>>= 5; + bits -= 5; + //---// + state.ndist = (hold & 0x1f)/*BITS(5)*/ + 1; + //--- DROPBITS(5) ---// + hold >>>= 5; + bits -= 5; + //---// + state.ncode = (hold & 0x0f)/*BITS(4)*/ + 4; + //--- DROPBITS(4) ---// + hold >>>= 4; + bits -= 4; + //---// +//#ifndef PKZIP_BUG_WORKAROUND + if (state.nlen > 286 || state.ndist > 30) { + strm.msg = 'too many length or distance symbols'; + state.mode = BAD; + break; + } +//#endif + //Tracev((stderr, "inflate: table sizes ok\n")); + state.have = 0; + state.mode = LENLENS; + /* falls through */ + case LENLENS: + while (state.have < state.ncode) { + //=== NEEDBITS(3); + while (bits < 3) { + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + } + //===// + state.lens[order[state.have++]] = (hold & 0x07);//BITS(3); + //--- DROPBITS(3) ---// + hold >>>= 3; + bits -= 3; + //---// + } + while (state.have < 19) { + state.lens[order[state.have++]] = 0; + } + // We have separate tables & no pointers. 2 commented lines below not needed. + //state.next = state.codes; + //state.lencode = state.next; + // Switch to use dynamic table + state.lencode = state.lendyn; + state.lenbits = 7; + + opts = { bits: state.lenbits }; + ret = inflate_table(CODES, state.lens, 0, 19, state.lencode, 0, state.work, opts); + state.lenbits = opts.bits; + + if (ret) { + strm.msg = 'invalid code lengths set'; + state.mode = BAD; + break; + } + //Tracev((stderr, "inflate: code lengths ok\n")); + state.have = 0; + state.mode = CODELENS; + /* falls through */ + case CODELENS: + while (state.have < state.nlen + state.ndist) { + for (;;) { + here = state.lencode[hold & ((1 << state.lenbits) - 1)];/*BITS(state.lenbits)*/ + here_bits = here >>> 24; + here_op = (here >>> 16) & 0xff; + here_val = here & 0xffff; + + if ((here_bits) <= bits) { break; } + //--- PULLBYTE() ---// + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + //---// + } + if (here_val < 16) { + //--- DROPBITS(here.bits) ---// + hold >>>= here_bits; + bits -= here_bits; + //---// + state.lens[state.have++] = here_val; + } + else { + if (here_val === 16) { + //=== NEEDBITS(here.bits + 2); + n = here_bits + 2; + while (bits < n) { + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + } + //===// + //--- DROPBITS(here.bits) ---// + hold >>>= here_bits; + bits -= here_bits; + //---// + if (state.have === 0) { + strm.msg = 'invalid bit length repeat'; + state.mode = BAD; + break; + } + len = state.lens[state.have - 1]; + copy = 3 + (hold & 0x03);//BITS(2); + //--- DROPBITS(2) ---// + hold >>>= 2; + bits -= 2; + //---// + } + else if (here_val === 17) { + //=== NEEDBITS(here.bits + 3); + n = here_bits + 3; + while (bits < n) { + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + } + //===// + //--- DROPBITS(here.bits) ---// + hold >>>= here_bits; + bits -= here_bits; + //---// + len = 0; + copy = 3 + (hold & 0x07);//BITS(3); + //--- DROPBITS(3) ---// + hold >>>= 3; + bits -= 3; + //---// + } + else { + //=== NEEDBITS(here.bits + 7); + n = here_bits + 7; + while (bits < n) { + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + } + //===// + //--- DROPBITS(here.bits) ---// + hold >>>= here_bits; + bits -= here_bits; + //---// + len = 0; + copy = 11 + (hold & 0x7f);//BITS(7); + //--- DROPBITS(7) ---// + hold >>>= 7; + bits -= 7; + //---// + } + if (state.have + copy > state.nlen + state.ndist) { + strm.msg = 'invalid bit length repeat'; + state.mode = BAD; + break; + } + while (copy--) { + state.lens[state.have++] = len; + } + } + } + + /* handle error breaks in while */ + if (state.mode === BAD) { break; } + + /* check for end-of-block code (better have one) */ + if (state.lens[256] === 0) { + strm.msg = 'invalid code -- missing end-of-block'; + state.mode = BAD; + break; + } + + /* build code tables -- note: do not change the lenbits or distbits + values here (9 and 6) without reading the comments in inftrees.h + concerning the ENOUGH constants, which depend on those values */ + state.lenbits = 9; + + opts = { bits: state.lenbits }; + ret = inflate_table(LENS, state.lens, 0, state.nlen, state.lencode, 0, state.work, opts); + // We have separate tables & no pointers. 2 commented lines below not needed. + // state.next_index = opts.table_index; + state.lenbits = opts.bits; + // state.lencode = state.next; + + if (ret) { + strm.msg = 'invalid literal/lengths set'; + state.mode = BAD; + break; + } + + state.distbits = 6; + //state.distcode.copy(state.codes); + // Switch to use dynamic table + state.distcode = state.distdyn; + opts = { bits: state.distbits }; + ret = inflate_table(DISTS, state.lens, state.nlen, state.ndist, state.distcode, 0, state.work, opts); + // We have separate tables & no pointers. 2 commented lines below not needed. + // state.next_index = opts.table_index; + state.distbits = opts.bits; + // state.distcode = state.next; + + if (ret) { + strm.msg = 'invalid distances set'; + state.mode = BAD; + break; + } + //Tracev((stderr, 'inflate: codes ok\n')); + state.mode = LEN_; + if (flush === Z_TREES) { break inf_leave; } + /* falls through */ + case LEN_: + state.mode = LEN; + /* falls through */ + case LEN: + if (have >= 6 && left >= 258) { + //--- RESTORE() --- + strm.next_out = put; + strm.avail_out = left; + strm.next_in = next; + strm.avail_in = have; + state.hold = hold; + state.bits = bits; + //--- + inflate_fast(strm, _out); + //--- LOAD() --- + put = strm.next_out; + output = strm.output; + left = strm.avail_out; + next = strm.next_in; + input = strm.input; + have = strm.avail_in; + hold = state.hold; + bits = state.bits; + //--- + + if (state.mode === TYPE) { + state.back = -1; + } + break; + } + state.back = 0; + for (;;) { + here = state.lencode[hold & ((1 << state.lenbits) - 1)]; /*BITS(state.lenbits)*/ + here_bits = here >>> 24; + here_op = (here >>> 16) & 0xff; + here_val = here & 0xffff; + + if (here_bits <= bits) { break; } + //--- PULLBYTE() ---// + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + //---// + } + if (here_op && (here_op & 0xf0) === 0) { + last_bits = here_bits; + last_op = here_op; + last_val = here_val; + for (;;) { + here = state.lencode[last_val + + ((hold & ((1 << (last_bits + last_op)) - 1))/*BITS(last.bits + last.op)*/ >> last_bits)]; + here_bits = here >>> 24; + here_op = (here >>> 16) & 0xff; + here_val = here & 0xffff; + + if ((last_bits + here_bits) <= bits) { break; } + //--- PULLBYTE() ---// + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + //---// + } + //--- DROPBITS(last.bits) ---// + hold >>>= last_bits; + bits -= last_bits; + //---// + state.back += last_bits; + } + //--- DROPBITS(here.bits) ---// + hold >>>= here_bits; + bits -= here_bits; + //---// + state.back += here_bits; + state.length = here_val; + if (here_op === 0) { + //Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ? + // "inflate: literal '%c'\n" : + // "inflate: literal 0x%02x\n", here.val)); + state.mode = LIT; + break; + } + if (here_op & 32) { + //Tracevv((stderr, "inflate: end of block\n")); + state.back = -1; + state.mode = TYPE; + break; + } + if (here_op & 64) { + strm.msg = 'invalid literal/length code'; + state.mode = BAD; + break; + } + state.extra = here_op & 15; + state.mode = LENEXT; + /* falls through */ + case LENEXT: + if (state.extra) { + //=== NEEDBITS(state.extra); + n = state.extra; + while (bits < n) { + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + } + //===// + state.length += hold & ((1 << state.extra) - 1)/*BITS(state.extra)*/; + //--- DROPBITS(state.extra) ---// + hold >>>= state.extra; + bits -= state.extra; + //---// + state.back += state.extra; + } + //Tracevv((stderr, "inflate: length %u\n", state.length)); + state.was = state.length; + state.mode = DIST; + /* falls through */ + case DIST: + for (;;) { + here = state.distcode[hold & ((1 << state.distbits) - 1)];/*BITS(state.distbits)*/ + here_bits = here >>> 24; + here_op = (here >>> 16) & 0xff; + here_val = here & 0xffff; + + if ((here_bits) <= bits) { break; } + //--- PULLBYTE() ---// + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + //---// + } + if ((here_op & 0xf0) === 0) { + last_bits = here_bits; + last_op = here_op; + last_val = here_val; + for (;;) { + here = state.distcode[last_val + + ((hold & ((1 << (last_bits + last_op)) - 1))/*BITS(last.bits + last.op)*/ >> last_bits)]; + here_bits = here >>> 24; + here_op = (here >>> 16) & 0xff; + here_val = here & 0xffff; + + if ((last_bits + here_bits) <= bits) { break; } + //--- PULLBYTE() ---// + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + //---// + } + //--- DROPBITS(last.bits) ---// + hold >>>= last_bits; + bits -= last_bits; + //---// + state.back += last_bits; + } + //--- DROPBITS(here.bits) ---// + hold >>>= here_bits; + bits -= here_bits; + //---// + state.back += here_bits; + if (here_op & 64) { + strm.msg = 'invalid distance code'; + state.mode = BAD; + break; + } + state.offset = here_val; + state.extra = (here_op) & 15; + state.mode = DISTEXT; + /* falls through */ + case DISTEXT: + if (state.extra) { + //=== NEEDBITS(state.extra); + n = state.extra; + while (bits < n) { + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + } + //===// + state.offset += hold & ((1 << state.extra) - 1)/*BITS(state.extra)*/; + //--- DROPBITS(state.extra) ---// + hold >>>= state.extra; + bits -= state.extra; + //---// + state.back += state.extra; + } +//#ifdef INFLATE_STRICT + if (state.offset > state.dmax) { + strm.msg = 'invalid distance too far back'; + state.mode = BAD; + break; + } +//#endif + //Tracevv((stderr, "inflate: distance %u\n", state.offset)); + state.mode = MATCH; + /* falls through */ + case MATCH: + if (left === 0) { break inf_leave; } + copy = _out - left; + if (state.offset > copy) { /* copy from window */ + copy = state.offset - copy; + if (copy > state.whave) { + if (state.sane) { + strm.msg = 'invalid distance too far back'; + state.mode = BAD; + break; + } +// (!) This block is disabled in zlib defailts, +// don't enable it for binary compatibility +//#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR +// Trace((stderr, "inflate.c too far\n")); +// copy -= state.whave; +// if (copy > state.length) { copy = state.length; } +// if (copy > left) { copy = left; } +// left -= copy; +// state.length -= copy; +// do { +// output[put++] = 0; +// } while (--copy); +// if (state.length === 0) { state.mode = LEN; } +// break; +//#endif + } + if (copy > state.wnext) { + copy -= state.wnext; + from = state.wsize - copy; + } + else { + from = state.wnext - copy; + } + if (copy > state.length) { copy = state.length; } + from_source = state.window; + } + else { /* copy from output */ + from_source = output; + from = put - state.offset; + copy = state.length; + } + if (copy > left) { copy = left; } + left -= copy; + state.length -= copy; + do { + output[put++] = from_source[from++]; + } while (--copy); + if (state.length === 0) { state.mode = LEN; } + break; + case LIT: + if (left === 0) { break inf_leave; } + output[put++] = state.length; + left--; + state.mode = LEN; + break; + case CHECK: + if (state.wrap) { + //=== NEEDBITS(32); + while (bits < 32) { + if (have === 0) { break inf_leave; } + have--; + // Use '|' insdead of '+' to make sure that result is signed + hold |= input[next++] << bits; + bits += 8; + } + //===// + _out -= left; + strm.total_out += _out; + state.total += _out; + if (_out) { + strm.adler = state.check = + /*UPDATE(state.check, put - _out, _out);*/ + (state.flags ? crc32(state.check, output, _out, put - _out) : adler32(state.check, output, _out, put - _out)); + + } + _out = left; + // NB: crc32 stored as signed 32-bit int, zswap32 returns signed too + if ((state.flags ? hold : zswap32(hold)) !== state.check) { + strm.msg = 'incorrect data check'; + state.mode = BAD; + break; + } + //=== INITBITS(); + hold = 0; + bits = 0; + //===// + //Tracev((stderr, "inflate: check matches trailer\n")); + } + state.mode = LENGTH; + /* falls through */ + case LENGTH: + if (state.wrap && state.flags) { + //=== NEEDBITS(32); + while (bits < 32) { + if (have === 0) { break inf_leave; } + have--; + hold += input[next++] << bits; + bits += 8; + } + //===// + if (hold !== (state.total & 0xffffffff)) { + strm.msg = 'incorrect length check'; + state.mode = BAD; + break; + } + //=== INITBITS(); + hold = 0; + bits = 0; + //===// + //Tracev((stderr, "inflate: length matches trailer\n")); + } + state.mode = DONE; + /* falls through */ + case DONE: + ret = Z_STREAM_END; + break inf_leave; + case BAD: + ret = Z_DATA_ERROR; + break inf_leave; + case MEM: + return Z_MEM_ERROR; + case SYNC: + /* falls through */ + default: + return Z_STREAM_ERROR; + } + } + + // inf_leave <- here is real place for "goto inf_leave", emulated via "break inf_leave" + + /* + Return from inflate(), updating the total counts and the check value. + If there was no progress during the inflate() call, return a buffer + error. Call updatewindow() to create and/or update the window state. + Note: a memory error from inflate() is non-recoverable. + */ + + //--- RESTORE() --- + strm.next_out = put; + strm.avail_out = left; + strm.next_in = next; + strm.avail_in = have; + state.hold = hold; + state.bits = bits; + //--- + + if (state.wsize || (_out !== strm.avail_out && state.mode < BAD && + (state.mode < CHECK || flush !== Z_FINISH))) { + if (updatewindow(strm, strm.output, strm.next_out, _out - strm.avail_out)) { + state.mode = MEM; + return Z_MEM_ERROR; + } + } + _in -= strm.avail_in; + _out -= strm.avail_out; + strm.total_in += _in; + strm.total_out += _out; + state.total += _out; + if (state.wrap && _out) { + strm.adler = state.check = /*UPDATE(state.check, strm.next_out - _out, _out);*/ + (state.flags ? crc32(state.check, output, _out, strm.next_out - _out) : adler32(state.check, output, _out, strm.next_out - _out)); + } + strm.data_type = state.bits + (state.last ? 64 : 0) + + (state.mode === TYPE ? 128 : 0) + + (state.mode === LEN_ || state.mode === COPY_ ? 256 : 0); + if (((_in === 0 && _out === 0) || flush === Z_FINISH) && ret === Z_OK) { + ret = Z_BUF_ERROR; + } + return ret; +} + +function inflateEnd(strm) { + + if (!strm || !strm.state /*|| strm->zfree == (free_func)0*/) { + return Z_STREAM_ERROR; + } + + var state = strm.state; + if (state.window) { + state.window = null; + } + strm.state = null; + return Z_OK; +} + +function inflateGetHeader(strm, head) { + var state; + + /* check state */ + if (!strm || !strm.state) { return Z_STREAM_ERROR; } + state = strm.state; + if ((state.wrap & 2) === 0) { return Z_STREAM_ERROR; } + + /* save header structure */ + state.head = head; + head.done = false; + return Z_OK; +} + +function inflateSetDictionary(strm, dictionary) { + var dictLength = dictionary.length; + + var state; + var dictid; + var ret; + + /* check state */ + if (!strm /* == Z_NULL */ || !strm.state /* == Z_NULL */) { return Z_STREAM_ERROR; } + state = strm.state; + + if (state.wrap !== 0 && state.mode !== DICT) { + return Z_STREAM_ERROR; + } + + /* check for correct dictionary identifier */ + if (state.mode === DICT) { + dictid = 1; /* adler32(0, null, 0)*/ + /* dictid = adler32(dictid, dictionary, dictLength); */ + dictid = adler32(dictid, dictionary, dictLength, 0); + if (dictid !== state.check) { + return Z_DATA_ERROR; + } + } + /* copy dictionary to window using updatewindow(), which will amend the + existing dictionary if appropriate */ + ret = updatewindow(strm, dictionary, dictLength, dictLength); + if (ret) { + state.mode = MEM; + return Z_MEM_ERROR; + } + state.havedict = 1; + // Tracev((stderr, "inflate: dictionary set\n")); + return Z_OK; +} + +exports.inflateReset = inflateReset; +exports.inflateReset2 = inflateReset2; +exports.inflateResetKeep = inflateResetKeep; +exports.inflateInit = inflateInit; +exports.inflateInit2 = inflateInit2; +exports.inflate = inflate; +exports.inflateEnd = inflateEnd; +exports.inflateGetHeader = inflateGetHeader; +exports.inflateSetDictionary = inflateSetDictionary; +exports.inflateInfo = 'pako inflate (from Nodeca project)'; + +/* Not implemented +exports.inflateCopy = inflateCopy; +exports.inflateGetDictionary = inflateGetDictionary; +exports.inflateMark = inflateMark; +exports.inflatePrime = inflatePrime; +exports.inflateSync = inflateSync; +exports.inflateSyncPoint = inflateSyncPoint; +exports.inflateUndermine = inflateUndermine; +*/ /***/ }, /* 209 */ /***/ function(module, exports, __webpack_require__) { - const AbstractHandler = __webpack_require__(180); +"use strict"; +'use strict'; - class RelationshipAddHandler extends AbstractHandler { - handle(packet) { - const client = this.packetManager.client; - const data = packet.d; - if (data.type === 1) { - client.fetchUser(data.id).then(user => { - client.user.friends.set(user.id, user); - }); - } else if (data.type === 2) { - client.fetchUser(data.id).then(user => { - client.user.blocked.set(user.id, user); - }); - } - } - } - module.exports = RelationshipAddHandler; +var utils = __webpack_require__(38); + +var MAXBITS = 15; +var ENOUGH_LENS = 852; +var ENOUGH_DISTS = 592; +//var ENOUGH = (ENOUGH_LENS+ENOUGH_DISTS); + +var CODES = 0; +var LENS = 1; +var DISTS = 2; + +var lbase = [ /* Length codes 257..285 base */ + 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, + 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0 +]; + +var lext = [ /* Length codes 257..285 extra */ + 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, + 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 72, 78 +]; + +var dbase = [ /* Distance codes 0..29 base */ + 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, + 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, + 8193, 12289, 16385, 24577, 0, 0 +]; + +var dext = [ /* Distance codes 0..29 extra */ + 16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, + 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, + 28, 28, 29, 29, 64, 64 +]; + +module.exports = function inflate_table(type, lens, lens_index, codes, table, table_index, work, opts) +{ + var bits = opts.bits; + //here = opts.here; /* table entry for duplication */ + + var len = 0; /* a code's length in bits */ + var sym = 0; /* index of code symbols */ + var min = 0, max = 0; /* minimum and maximum code lengths */ + var root = 0; /* number of index bits for root table */ + var curr = 0; /* number of index bits for current table */ + var drop = 0; /* code bits to drop for sub-table */ + var left = 0; /* number of prefix codes available */ + var used = 0; /* code entries in table used */ + var huff = 0; /* Huffman code */ + var incr; /* for incrementing code, index */ + var fill; /* index for replicating entries */ + var low; /* low bits for current root entry */ + var mask; /* mask for low root bits */ + var next; /* next available space in table */ + var base = null; /* base value table to use */ + var base_index = 0; +// var shoextra; /* extra bits table to use */ + var end; /* use base and extra for symbol > end */ + var count = new utils.Buf16(MAXBITS + 1); //[MAXBITS+1]; /* number of codes of each length */ + var offs = new utils.Buf16(MAXBITS + 1); //[MAXBITS+1]; /* offsets in table for each length */ + var extra = null; + var extra_index = 0; + + var here_bits, here_op, here_val; + + /* + Process a set of code lengths to create a canonical Huffman code. The + code lengths are lens[0..codes-1]. Each length corresponds to the + symbols 0..codes-1. The Huffman code is generated by first sorting the + symbols by length from short to long, and retaining the symbol order + for codes with equal lengths. Then the code starts with all zero bits + for the first code of the shortest length, and the codes are integer + increments for the same length, and zeros are appended as the length + increases. For the deflate format, these bits are stored backwards + from their more natural integer increment ordering, and so when the + decoding tables are built in the large loop below, the integer codes + are incremented backwards. + + This routine assumes, but does not check, that all of the entries in + lens[] are in the range 0..MAXBITS. The caller must assure this. + 1..MAXBITS is interpreted as that code length. zero means that that + symbol does not occur in this code. + + The codes are sorted by computing a count of codes for each length, + creating from that a table of starting indices for each length in the + sorted table, and then entering the symbols in order in the sorted + table. The sorted table is work[], with that space being provided by + the caller. + + The length counts are used for other purposes as well, i.e. finding + the minimum and maximum length codes, determining if there are any + codes at all, checking for a valid set of lengths, and looking ahead + at length counts to determine sub-table sizes when building the + decoding tables. + */ + + /* accumulate lengths for codes (assumes lens[] all in 0..MAXBITS) */ + for (len = 0; len <= MAXBITS; len++) { + count[len] = 0; + } + for (sym = 0; sym < codes; sym++) { + count[lens[lens_index + sym]]++; + } + + /* bound code lengths, force root to be within code lengths */ + root = bits; + for (max = MAXBITS; max >= 1; max--) { + if (count[max] !== 0) { break; } + } + if (root > max) { + root = max; + } + if (max === 0) { /* no symbols to code at all */ + //table.op[opts.table_index] = 64; //here.op = (var char)64; /* invalid code marker */ + //table.bits[opts.table_index] = 1; //here.bits = (var char)1; + //table.val[opts.table_index++] = 0; //here.val = (var short)0; + table[table_index++] = (1 << 24) | (64 << 16) | 0; + + + //table.op[opts.table_index] = 64; + //table.bits[opts.table_index] = 1; + //table.val[opts.table_index++] = 0; + table[table_index++] = (1 << 24) | (64 << 16) | 0; + + opts.bits = 1; + return 0; /* no symbols, but wait for decoding to report error */ + } + for (min = 1; min < max; min++) { + if (count[min] !== 0) { break; } + } + if (root < min) { + root = min; + } + + /* check for an over-subscribed or incomplete set of lengths */ + left = 1; + for (len = 1; len <= MAXBITS; len++) { + left <<= 1; + left -= count[len]; + if (left < 0) { + return -1; + } /* over-subscribed */ + } + if (left > 0 && (type === CODES || max !== 1)) { + return -1; /* incomplete set */ + } + + /* generate offsets into symbol table for each length for sorting */ + offs[1] = 0; + for (len = 1; len < MAXBITS; len++) { + offs[len + 1] = offs[len] + count[len]; + } + + /* sort symbols by length, by symbol order within each length */ + for (sym = 0; sym < codes; sym++) { + if (lens[lens_index + sym] !== 0) { + work[offs[lens[lens_index + sym]]++] = sym; + } + } + + /* + Create and fill in decoding tables. In this loop, the table being + filled is at next and has curr index bits. The code being used is huff + with length len. That code is converted to an index by dropping drop + bits off of the bottom. For codes where len is less than drop + curr, + those top drop + curr - len bits are incremented through all values to + fill the table with replicated entries. + + root is the number of index bits for the root table. When len exceeds + root, sub-tables are created pointed to by the root entry with an index + of the low root bits of huff. This is saved in low to check for when a + new sub-table should be started. drop is zero when the root table is + being filled, and drop is root when sub-tables are being filled. + + When a new sub-table is needed, it is necessary to look ahead in the + code lengths to determine what size sub-table is needed. The length + counts are used for this, and so count[] is decremented as codes are + entered in the tables. + + used keeps track of how many table entries have been allocated from the + provided *table space. It is checked for LENS and DIST tables against + the constants ENOUGH_LENS and ENOUGH_DISTS to guard against changes in + the initial root table size constants. See the comments in inftrees.h + for more information. + + sym increments through all symbols, and the loop terminates when + all codes of length max, i.e. all codes, have been processed. This + routine permits incomplete codes, so another loop after this one fills + in the rest of the decoding tables with invalid code markers. + */ + + /* set up for code type */ + // poor man optimization - use if-else instead of switch, + // to avoid deopts in old v8 + if (type === CODES) { + base = extra = work; /* dummy value--not used */ + end = 19; + + } else if (type === LENS) { + base = lbase; + base_index -= 257; + extra = lext; + extra_index -= 257; + end = 256; + + } else { /* DISTS */ + base = dbase; + extra = dext; + end = -1; + } + + /* initialize opts for loop */ + huff = 0; /* starting code */ + sym = 0; /* starting code symbol */ + len = min; /* starting code length */ + next = table_index; /* current table to fill in */ + curr = root; /* current table index bits */ + drop = 0; /* current bits to drop from code for index */ + low = -1; /* trigger new sub-table when len > root */ + used = 1 << root; /* use root table entries */ + mask = used - 1; /* mask for comparing low */ + + /* check available table space */ + if ((type === LENS && used > ENOUGH_LENS) || + (type === DISTS && used > ENOUGH_DISTS)) { + return 1; + } + + var i = 0; + /* process all codes and make table entries */ + for (;;) { + i++; + /* create table entry */ + here_bits = len - drop; + if (work[sym] < end) { + here_op = 0; + here_val = work[sym]; + } + else if (work[sym] > end) { + here_op = extra[extra_index + work[sym]]; + here_val = base[base_index + work[sym]]; + } + else { + here_op = 32 + 64; /* end of block */ + here_val = 0; + } + + /* replicate for those indices with low len bits equal to huff */ + incr = 1 << (len - drop); + fill = 1 << curr; + min = fill; /* save offset to next table */ + do { + fill -= incr; + table[next + (huff >> drop) + fill] = (here_bits << 24) | (here_op << 16) | here_val |0; + } while (fill !== 0); + + /* backwards increment the len-bit code huff */ + incr = 1 << (len - 1); + while (huff & incr) { + incr >>= 1; + } + if (incr !== 0) { + huff &= incr - 1; + huff += incr; + } else { + huff = 0; + } + + /* go to next symbol, update count, len */ + sym++; + if (--count[len] === 0) { + if (len === max) { break; } + len = lens[lens_index + work[sym]]; + } + + /* create new sub-table if needed */ + if (len > root && (huff & mask) !== low) { + /* if first time, transition to sub-tables */ + if (drop === 0) { + drop = root; + } + + /* increment past last table */ + next += min; /* here min is 1 << curr */ + + /* determine length of next table */ + curr = len - drop; + left = 1 << curr; + while (curr + drop < max) { + left -= count[curr + drop]; + if (left <= 0) { break; } + curr++; + left <<= 1; + } + + /* check for enough space */ + used += 1 << curr; + if ((type === LENS && used > ENOUGH_LENS) || + (type === DISTS && used > ENOUGH_DISTS)) { + return 1; + } + + /* point entry in root table to sub-table */ + low = huff & mask; + /*table.op[low] = curr; + table.bits[low] = root; + table.val[low] = next - opts.table_index;*/ + table[low] = (root << 24) | (curr << 16) | (next - table_index) |0; + } + } + + /* fill in remaining table entry if code is incomplete (guaranteed to have + at most one remaining entry, since if the code is incomplete, the + maximum code length that was allowed to get this far is one bit) */ + if (huff !== 0) { + //table.op[next + huff] = 64; /* invalid code marker */ + //table.bits[next + huff] = len - drop; + //table.val[next + huff] = 0; + table[next + huff] = ((len - drop) << 24) | (64 << 16) |0; + } + + /* set return parameters */ + //opts.table_index += used; + opts.bits = root; + return 0; +}; /***/ }, /* 210 */ /***/ function(module, exports, __webpack_require__) { - const AbstractHandler = __webpack_require__(180); +"use strict"; +'use strict'; - class RelationshipRemoveHandler extends AbstractHandler { - handle(packet) { - const client = this.packetManager.client; - const data = packet.d; - if (data.type === 2) { - if (client.user.blocked.has(data.id)) { - client.user.blocked.delete(data.id); - } - } else if (data.type === 1) { - if (client.user.friends.has(data.id)) { - client.user.friends.delete(data.id); - } - } - } - } - module.exports = RelationshipRemoveHandler; +var utils = __webpack_require__(38); + +/* Public constants ==========================================================*/ +/* ===========================================================================*/ + + +//var Z_FILTERED = 1; +//var Z_HUFFMAN_ONLY = 2; +//var Z_RLE = 3; +var Z_FIXED = 4; +//var Z_DEFAULT_STRATEGY = 0; + +/* Possible values of the data_type field (though see inflate()) */ +var Z_BINARY = 0; +var Z_TEXT = 1; +//var Z_ASCII = 1; // = Z_TEXT +var Z_UNKNOWN = 2; + +/*============================================================================*/ + + +function zero(buf) { var len = buf.length; while (--len >= 0) { buf[len] = 0; } } + +// From zutil.h + +var STORED_BLOCK = 0; +var STATIC_TREES = 1; +var DYN_TREES = 2; +/* The three kinds of block type */ + +var MIN_MATCH = 3; +var MAX_MATCH = 258; +/* The minimum and maximum match lengths */ + +// From deflate.h +/* =========================================================================== + * Internal compression state. + */ + +var LENGTH_CODES = 29; +/* number of length codes, not counting the special END_BLOCK code */ + +var LITERALS = 256; +/* number of literal bytes 0..255 */ + +var L_CODES = LITERALS + 1 + LENGTH_CODES; +/* number of Literal or Length codes, including the END_BLOCK code */ + +var D_CODES = 30; +/* number of distance codes */ + +var BL_CODES = 19; +/* number of codes used to transfer the bit lengths */ + +var HEAP_SIZE = 2 * L_CODES + 1; +/* maximum heap size */ + +var MAX_BITS = 15; +/* All codes must not exceed MAX_BITS bits */ + +var Buf_size = 16; +/* size of bit buffer in bi_buf */ + + +/* =========================================================================== + * Constants + */ + +var MAX_BL_BITS = 7; +/* Bit length codes must not exceed MAX_BL_BITS bits */ + +var END_BLOCK = 256; +/* end of block literal code */ + +var REP_3_6 = 16; +/* repeat previous bit length 3-6 times (2 bits of repeat count) */ + +var REPZ_3_10 = 17; +/* repeat a zero length 3-10 times (3 bits of repeat count) */ + +var REPZ_11_138 = 18; +/* repeat a zero length 11-138 times (7 bits of repeat count) */ + +/* eslint-disable comma-spacing,array-bracket-spacing */ +var extra_lbits = /* extra bits for each length code */ + [0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]; + +var extra_dbits = /* extra bits for each distance code */ + [0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]; + +var extra_blbits = /* extra bits for each bit length code */ + [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]; + +var bl_order = + [16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]; +/* eslint-enable comma-spacing,array-bracket-spacing */ + +/* The lengths of the bit length codes are sent in order of decreasing + * probability, to avoid transmitting the lengths for unused bit length codes. + */ + +/* =========================================================================== + * Local data. These are initialized only once. + */ + +// We pre-fill arrays with 0 to avoid uninitialized gaps + +var DIST_CODE_LEN = 512; /* see definition of array dist_code below */ + +// !!!! Use flat array insdead of structure, Freq = i*2, Len = i*2+1 +var static_ltree = new Array((L_CODES + 2) * 2); +zero(static_ltree); +/* The static literal tree. Since the bit lengths are imposed, there is no + * need for the L_CODES extra codes used during heap construction. However + * The codes 286 and 287 are needed to build a canonical tree (see _tr_init + * below). + */ + +var static_dtree = new Array(D_CODES * 2); +zero(static_dtree); +/* The static distance tree. (Actually a trivial tree since all codes use + * 5 bits.) + */ + +var _dist_code = new Array(DIST_CODE_LEN); +zero(_dist_code); +/* Distance codes. The first 256 values correspond to the distances + * 3 .. 258, the last 256 values correspond to the top 8 bits of + * the 15 bit distances. + */ + +var _length_code = new Array(MAX_MATCH - MIN_MATCH + 1); +zero(_length_code); +/* length code for each normalized match length (0 == MIN_MATCH) */ + +var base_length = new Array(LENGTH_CODES); +zero(base_length); +/* First normalized length for each code (0 = MIN_MATCH) */ + +var base_dist = new Array(D_CODES); +zero(base_dist); +/* First normalized distance for each code (0 = distance of 1) */ + + +function StaticTreeDesc(static_tree, extra_bits, extra_base, elems, max_length) { + + this.static_tree = static_tree; /* static tree or NULL */ + this.extra_bits = extra_bits; /* extra bits for each code or NULL */ + this.extra_base = extra_base; /* base index for extra_bits */ + this.elems = elems; /* max number of elements in the tree */ + this.max_length = max_length; /* max bit length for the codes */ + + // show if `static_tree` has data or dummy - needed for monomorphic objects + this.has_stree = static_tree && static_tree.length; +} + + +var static_l_desc; +var static_d_desc; +var static_bl_desc; + + +function TreeDesc(dyn_tree, stat_desc) { + this.dyn_tree = dyn_tree; /* the dynamic tree */ + this.max_code = 0; /* largest code with non zero frequency */ + this.stat_desc = stat_desc; /* the corresponding static tree */ +} + + + +function d_code(dist) { + return dist < 256 ? _dist_code[dist] : _dist_code[256 + (dist >>> 7)]; +} + + +/* =========================================================================== + * Output a short LSB first on the stream. + * IN assertion: there is enough room in pendingBuf. + */ +function put_short(s, w) { +// put_byte(s, (uch)((w) & 0xff)); +// put_byte(s, (uch)((ush)(w) >> 8)); + s.pending_buf[s.pending++] = (w) & 0xff; + s.pending_buf[s.pending++] = (w >>> 8) & 0xff; +} + + +/* =========================================================================== + * Send a value on a given number of bits. + * IN assertion: length <= 16 and value fits in length bits. + */ +function send_bits(s, value, length) { + if (s.bi_valid > (Buf_size - length)) { + s.bi_buf |= (value << s.bi_valid) & 0xffff; + put_short(s, s.bi_buf); + s.bi_buf = value >> (Buf_size - s.bi_valid); + s.bi_valid += length - Buf_size; + } else { + s.bi_buf |= (value << s.bi_valid) & 0xffff; + s.bi_valid += length; + } +} + + +function send_code(s, c, tree) { + send_bits(s, tree[c * 2]/*.Code*/, tree[c * 2 + 1]/*.Len*/); +} + + +/* =========================================================================== + * Reverse the first len bits of a code, using straightforward code (a faster + * method would use a table) + * IN assertion: 1 <= len <= 15 + */ +function bi_reverse(code, len) { + var res = 0; + do { + res |= code & 1; + code >>>= 1; + res <<= 1; + } while (--len > 0); + return res >>> 1; +} + + +/* =========================================================================== + * Flush the bit buffer, keeping at most 7 bits in it. + */ +function bi_flush(s) { + if (s.bi_valid === 16) { + put_short(s, s.bi_buf); + s.bi_buf = 0; + s.bi_valid = 0; + + } else if (s.bi_valid >= 8) { + s.pending_buf[s.pending++] = s.bi_buf & 0xff; + s.bi_buf >>= 8; + s.bi_valid -= 8; + } +} + + +/* =========================================================================== + * Compute the optimal bit lengths for a tree and update the total bit length + * for the current block. + * IN assertion: the fields freq and dad are set, heap[heap_max] and + * above are the tree nodes sorted by increasing frequency. + * OUT assertions: the field len is set to the optimal bit length, the + * array bl_count contains the frequencies for each bit length. + * The length opt_len is updated; static_len is also updated if stree is + * not null. + */ +function gen_bitlen(s, desc) +// deflate_state *s; +// tree_desc *desc; /* the tree descriptor */ +{ + var tree = desc.dyn_tree; + var max_code = desc.max_code; + var stree = desc.stat_desc.static_tree; + var has_stree = desc.stat_desc.has_stree; + var extra = desc.stat_desc.extra_bits; + var base = desc.stat_desc.extra_base; + var max_length = desc.stat_desc.max_length; + var h; /* heap index */ + var n, m; /* iterate over the tree elements */ + var bits; /* bit length */ + var xbits; /* extra bits */ + var f; /* frequency */ + var overflow = 0; /* number of elements with bit length too large */ + + for (bits = 0; bits <= MAX_BITS; bits++) { + s.bl_count[bits] = 0; + } + + /* In a first pass, compute the optimal bit lengths (which may + * overflow in the case of the bit length tree). + */ + tree[s.heap[s.heap_max] * 2 + 1]/*.Len*/ = 0; /* root of the heap */ + + for (h = s.heap_max + 1; h < HEAP_SIZE; h++) { + n = s.heap[h]; + bits = tree[tree[n * 2 + 1]/*.Dad*/ * 2 + 1]/*.Len*/ + 1; + if (bits > max_length) { + bits = max_length; + overflow++; + } + tree[n * 2 + 1]/*.Len*/ = bits; + /* We overwrite tree[n].Dad which is no longer needed */ + + if (n > max_code) { continue; } /* not a leaf node */ + + s.bl_count[bits]++; + xbits = 0; + if (n >= base) { + xbits = extra[n - base]; + } + f = tree[n * 2]/*.Freq*/; + s.opt_len += f * (bits + xbits); + if (has_stree) { + s.static_len += f * (stree[n * 2 + 1]/*.Len*/ + xbits); + } + } + if (overflow === 0) { return; } + + // Trace((stderr,"\nbit length overflow\n")); + /* This happens for example on obj2 and pic of the Calgary corpus */ + + /* Find the first bit length which could increase: */ + do { + bits = max_length - 1; + while (s.bl_count[bits] === 0) { bits--; } + s.bl_count[bits]--; /* move one leaf down the tree */ + s.bl_count[bits + 1] += 2; /* move one overflow item as its brother */ + s.bl_count[max_length]--; + /* The brother of the overflow item also moves one step up, + * but this does not affect bl_count[max_length] + */ + overflow -= 2; + } while (overflow > 0); + + /* Now recompute all bit lengths, scanning in increasing frequency. + * h is still equal to HEAP_SIZE. (It is simpler to reconstruct all + * lengths instead of fixing only the wrong ones. This idea is taken + * from 'ar' written by Haruhiko Okumura.) + */ + for (bits = max_length; bits !== 0; bits--) { + n = s.bl_count[bits]; + while (n !== 0) { + m = s.heap[--h]; + if (m > max_code) { continue; } + if (tree[m * 2 + 1]/*.Len*/ !== bits) { + // Trace((stderr,"code %d bits %d->%d\n", m, tree[m].Len, bits)); + s.opt_len += (bits - tree[m * 2 + 1]/*.Len*/) * tree[m * 2]/*.Freq*/; + tree[m * 2 + 1]/*.Len*/ = bits; + } + n--; + } + } +} + + +/* =========================================================================== + * Generate the codes for a given tree and bit counts (which need not be + * optimal). + * IN assertion: the array bl_count contains the bit length statistics for + * the given tree and the field len is set for all tree elements. + * OUT assertion: the field code is set for all tree elements of non + * zero code length. + */ +function gen_codes(tree, max_code, bl_count) +// ct_data *tree; /* the tree to decorate */ +// int max_code; /* largest code with non zero frequency */ +// ushf *bl_count; /* number of codes at each bit length */ +{ + var next_code = new Array(MAX_BITS + 1); /* next code value for each bit length */ + var code = 0; /* running code value */ + var bits; /* bit index */ + var n; /* code index */ + + /* The distribution counts are first used to generate the code values + * without bit reversal. + */ + for (bits = 1; bits <= MAX_BITS; bits++) { + next_code[bits] = code = (code + bl_count[bits - 1]) << 1; + } + /* Check that the bit counts in bl_count are consistent. The last code + * must be all ones. + */ + //Assert (code + bl_count[MAX_BITS]-1 == (1< length code (0..28) */ + length = 0; + for (code = 0; code < LENGTH_CODES - 1; code++) { + base_length[code] = length; + for (n = 0; n < (1 << extra_lbits[code]); n++) { + _length_code[length++] = code; + } + } + //Assert (length == 256, "tr_static_init: length != 256"); + /* Note that the length 255 (match length 258) can be represented + * in two different ways: code 284 + 5 bits or code 285, so we + * overwrite length_code[255] to use the best encoding: + */ + _length_code[length - 1] = code; + + /* Initialize the mapping dist (0..32K) -> dist code (0..29) */ + dist = 0; + for (code = 0; code < 16; code++) { + base_dist[code] = dist; + for (n = 0; n < (1 << extra_dbits[code]); n++) { + _dist_code[dist++] = code; + } + } + //Assert (dist == 256, "tr_static_init: dist != 256"); + dist >>= 7; /* from now on, all distances are divided by 128 */ + for (; code < D_CODES; code++) { + base_dist[code] = dist << 7; + for (n = 0; n < (1 << (extra_dbits[code] - 7)); n++) { + _dist_code[256 + dist++] = code; + } + } + //Assert (dist == 256, "tr_static_init: 256+dist != 512"); + + /* Construct the codes of the static literal tree */ + for (bits = 0; bits <= MAX_BITS; bits++) { + bl_count[bits] = 0; + } + + n = 0; + while (n <= 143) { + static_ltree[n * 2 + 1]/*.Len*/ = 8; + n++; + bl_count[8]++; + } + while (n <= 255) { + static_ltree[n * 2 + 1]/*.Len*/ = 9; + n++; + bl_count[9]++; + } + while (n <= 279) { + static_ltree[n * 2 + 1]/*.Len*/ = 7; + n++; + bl_count[7]++; + } + while (n <= 287) { + static_ltree[n * 2 + 1]/*.Len*/ = 8; + n++; + bl_count[8]++; + } + /* Codes 286 and 287 do not exist, but we must include them in the + * tree construction to get a canonical Huffman tree (longest code + * all ones) + */ + gen_codes(static_ltree, L_CODES + 1, bl_count); + + /* The static distance tree is trivial: */ + for (n = 0; n < D_CODES; n++) { + static_dtree[n * 2 + 1]/*.Len*/ = 5; + static_dtree[n * 2]/*.Code*/ = bi_reverse(n, 5); + } + + // Now data ready and we can init static trees + static_l_desc = new StaticTreeDesc(static_ltree, extra_lbits, LITERALS + 1, L_CODES, MAX_BITS); + static_d_desc = new StaticTreeDesc(static_dtree, extra_dbits, 0, D_CODES, MAX_BITS); + static_bl_desc = new StaticTreeDesc(new Array(0), extra_blbits, 0, BL_CODES, MAX_BL_BITS); + + //static_init_done = true; +} + + +/* =========================================================================== + * Initialize a new block. + */ +function init_block(s) { + var n; /* iterates over tree elements */ + + /* Initialize the trees. */ + for (n = 0; n < L_CODES; n++) { s.dyn_ltree[n * 2]/*.Freq*/ = 0; } + for (n = 0; n < D_CODES; n++) { s.dyn_dtree[n * 2]/*.Freq*/ = 0; } + for (n = 0; n < BL_CODES; n++) { s.bl_tree[n * 2]/*.Freq*/ = 0; } + + s.dyn_ltree[END_BLOCK * 2]/*.Freq*/ = 1; + s.opt_len = s.static_len = 0; + s.last_lit = s.matches = 0; +} + + +/* =========================================================================== + * Flush the bit buffer and align the output on a byte boundary + */ +function bi_windup(s) +{ + if (s.bi_valid > 8) { + put_short(s, s.bi_buf); + } else if (s.bi_valid > 0) { + //put_byte(s, (Byte)s->bi_buf); + s.pending_buf[s.pending++] = s.bi_buf; + } + s.bi_buf = 0; + s.bi_valid = 0; +} + +/* =========================================================================== + * Copy a stored block, storing first the length and its + * one's complement if requested. + */ +function copy_block(s, buf, len, header) +//DeflateState *s; +//charf *buf; /* the input data */ +//unsigned len; /* its length */ +//int header; /* true if block header must be written */ +{ + bi_windup(s); /* align on byte boundary */ + + if (header) { + put_short(s, len); + put_short(s, ~len); + } +// while (len--) { +// put_byte(s, *buf++); +// } + utils.arraySet(s.pending_buf, s.window, buf, len, s.pending); + s.pending += len; +} + +/* =========================================================================== + * Compares to subtrees, using the tree depth as tie breaker when + * the subtrees have equal frequency. This minimizes the worst case length. + */ +function smaller(tree, n, m, depth) { + var _n2 = n * 2; + var _m2 = m * 2; + return (tree[_n2]/*.Freq*/ < tree[_m2]/*.Freq*/ || + (tree[_n2]/*.Freq*/ === tree[_m2]/*.Freq*/ && depth[n] <= depth[m])); +} + +/* =========================================================================== + * Restore the heap property by moving down the tree starting at node k, + * exchanging a node with the smallest of its two sons if necessary, stopping + * when the heap property is re-established (each father smaller than its + * two sons). + */ +function pqdownheap(s, tree, k) +// deflate_state *s; +// ct_data *tree; /* the tree to restore */ +// int k; /* node to move down */ +{ + var v = s.heap[k]; + var j = k << 1; /* left son of k */ + while (j <= s.heap_len) { + /* Set j to the smallest of the two sons: */ + if (j < s.heap_len && + smaller(tree, s.heap[j + 1], s.heap[j], s.depth)) { + j++; + } + /* Exit if v is smaller than both sons */ + if (smaller(tree, v, s.heap[j], s.depth)) { break; } + + /* Exchange v with the smallest son */ + s.heap[k] = s.heap[j]; + k = j; + + /* And continue down the tree, setting j to the left son of k */ + j <<= 1; + } + s.heap[k] = v; +} + + +// inlined manually +// var SMALLEST = 1; + +/* =========================================================================== + * Send the block data compressed using the given Huffman trees + */ +function compress_block(s, ltree, dtree) +// deflate_state *s; +// const ct_data *ltree; /* literal tree */ +// const ct_data *dtree; /* distance tree */ +{ + var dist; /* distance of matched string */ + var lc; /* match length or unmatched char (if dist == 0) */ + var lx = 0; /* running index in l_buf */ + var code; /* the code to send */ + var extra; /* number of extra bits to send */ + + if (s.last_lit !== 0) { + do { + dist = (s.pending_buf[s.d_buf + lx * 2] << 8) | (s.pending_buf[s.d_buf + lx * 2 + 1]); + lc = s.pending_buf[s.l_buf + lx]; + lx++; + + if (dist === 0) { + send_code(s, lc, ltree); /* send a literal byte */ + //Tracecv(isgraph(lc), (stderr," '%c' ", lc)); + } else { + /* Here, lc is the match length - MIN_MATCH */ + code = _length_code[lc]; + send_code(s, code + LITERALS + 1, ltree); /* send the length code */ + extra = extra_lbits[code]; + if (extra !== 0) { + lc -= base_length[code]; + send_bits(s, lc, extra); /* send the extra length bits */ + } + dist--; /* dist is now the match distance - 1 */ + code = d_code(dist); + //Assert (code < D_CODES, "bad d_code"); + + send_code(s, code, dtree); /* send the distance code */ + extra = extra_dbits[code]; + if (extra !== 0) { + dist -= base_dist[code]; + send_bits(s, dist, extra); /* send the extra distance bits */ + } + } /* literal or match pair ? */ + + /* Check that the overlay between pending_buf and d_buf+l_buf is ok: */ + //Assert((uInt)(s->pending) < s->lit_bufsize + 2*lx, + // "pendingBuf overflow"); + + } while (lx < s.last_lit); + } + + send_code(s, END_BLOCK, ltree); +} + + +/* =========================================================================== + * Construct one Huffman tree and assigns the code bit strings and lengths. + * Update the total bit length for the current block. + * IN assertion: the field freq is set for all tree elements. + * OUT assertions: the fields len and code are set to the optimal bit length + * and corresponding code. The length opt_len is updated; static_len is + * also updated if stree is not null. The field max_code is set. + */ +function build_tree(s, desc) +// deflate_state *s; +// tree_desc *desc; /* the tree descriptor */ +{ + var tree = desc.dyn_tree; + var stree = desc.stat_desc.static_tree; + var has_stree = desc.stat_desc.has_stree; + var elems = desc.stat_desc.elems; + var n, m; /* iterate over heap elements */ + var max_code = -1; /* largest code with non zero frequency */ + var node; /* new node being created */ + + /* Construct the initial heap, with least frequent element in + * heap[SMALLEST]. The sons of heap[n] are heap[2*n] and heap[2*n+1]. + * heap[0] is not used. + */ + s.heap_len = 0; + s.heap_max = HEAP_SIZE; + + for (n = 0; n < elems; n++) { + if (tree[n * 2]/*.Freq*/ !== 0) { + s.heap[++s.heap_len] = max_code = n; + s.depth[n] = 0; + + } else { + tree[n * 2 + 1]/*.Len*/ = 0; + } + } + + /* The pkzip format requires that at least one distance code exists, + * and that at least one bit should be sent even if there is only one + * possible code. So to avoid special checks later on we force at least + * two codes of non zero frequency. + */ + while (s.heap_len < 2) { + node = s.heap[++s.heap_len] = (max_code < 2 ? ++max_code : 0); + tree[node * 2]/*.Freq*/ = 1; + s.depth[node] = 0; + s.opt_len--; + + if (has_stree) { + s.static_len -= stree[node * 2 + 1]/*.Len*/; + } + /* node is 0 or 1 so it does not have extra bits */ + } + desc.max_code = max_code; + + /* The elements heap[heap_len/2+1 .. heap_len] are leaves of the tree, + * establish sub-heaps of increasing lengths: + */ + for (n = (s.heap_len >> 1/*int /2*/); n >= 1; n--) { pqdownheap(s, tree, n); } + + /* Construct the Huffman tree by repeatedly combining the least two + * frequent nodes. + */ + node = elems; /* next internal node of the tree */ + do { + //pqremove(s, tree, n); /* n = node of least frequency */ + /*** pqremove ***/ + n = s.heap[1/*SMALLEST*/]; + s.heap[1/*SMALLEST*/] = s.heap[s.heap_len--]; + pqdownheap(s, tree, 1/*SMALLEST*/); + /***/ + + m = s.heap[1/*SMALLEST*/]; /* m = node of next least frequency */ + + s.heap[--s.heap_max] = n; /* keep the nodes sorted by frequency */ + s.heap[--s.heap_max] = m; + + /* Create a new node father of n and m */ + tree[node * 2]/*.Freq*/ = tree[n * 2]/*.Freq*/ + tree[m * 2]/*.Freq*/; + s.depth[node] = (s.depth[n] >= s.depth[m] ? s.depth[n] : s.depth[m]) + 1; + tree[n * 2 + 1]/*.Dad*/ = tree[m * 2 + 1]/*.Dad*/ = node; + + /* and insert the new node in the heap */ + s.heap[1/*SMALLEST*/] = node++; + pqdownheap(s, tree, 1/*SMALLEST*/); + + } while (s.heap_len >= 2); + + s.heap[--s.heap_max] = s.heap[1/*SMALLEST*/]; + + /* At this point, the fields freq and dad are set. We can now + * generate the bit lengths. + */ + gen_bitlen(s, desc); + + /* The field len is now set, we can generate the bit codes */ + gen_codes(tree, max_code, s.bl_count); +} + + +/* =========================================================================== + * Scan a literal or distance tree to determine the frequencies of the codes + * in the bit length tree. + */ +function scan_tree(s, tree, max_code) +// deflate_state *s; +// ct_data *tree; /* the tree to be scanned */ +// int max_code; /* and its largest code of non zero frequency */ +{ + var n; /* iterates over all tree elements */ + var prevlen = -1; /* last emitted length */ + var curlen; /* length of current code */ + + var nextlen = tree[0 * 2 + 1]/*.Len*/; /* length of next code */ + + var count = 0; /* repeat count of the current code */ + var max_count = 7; /* max repeat count */ + var min_count = 4; /* min repeat count */ + + if (nextlen === 0) { + max_count = 138; + min_count = 3; + } + tree[(max_code + 1) * 2 + 1]/*.Len*/ = 0xffff; /* guard */ + + for (n = 0; n <= max_code; n++) { + curlen = nextlen; + nextlen = tree[(n + 1) * 2 + 1]/*.Len*/; + + if (++count < max_count && curlen === nextlen) { + continue; + + } else if (count < min_count) { + s.bl_tree[curlen * 2]/*.Freq*/ += count; + + } else if (curlen !== 0) { + + if (curlen !== prevlen) { s.bl_tree[curlen * 2]/*.Freq*/++; } + s.bl_tree[REP_3_6 * 2]/*.Freq*/++; + + } else if (count <= 10) { + s.bl_tree[REPZ_3_10 * 2]/*.Freq*/++; + + } else { + s.bl_tree[REPZ_11_138 * 2]/*.Freq*/++; + } + + count = 0; + prevlen = curlen; + + if (nextlen === 0) { + max_count = 138; + min_count = 3; + + } else if (curlen === nextlen) { + max_count = 6; + min_count = 3; + + } else { + max_count = 7; + min_count = 4; + } + } +} + + +/* =========================================================================== + * Send a literal or distance tree in compressed form, using the codes in + * bl_tree. + */ +function send_tree(s, tree, max_code) +// deflate_state *s; +// ct_data *tree; /* the tree to be scanned */ +// int max_code; /* and its largest code of non zero frequency */ +{ + var n; /* iterates over all tree elements */ + var prevlen = -1; /* last emitted length */ + var curlen; /* length of current code */ + + var nextlen = tree[0 * 2 + 1]/*.Len*/; /* length of next code */ + + var count = 0; /* repeat count of the current code */ + var max_count = 7; /* max repeat count */ + var min_count = 4; /* min repeat count */ + + /* tree[max_code+1].Len = -1; */ /* guard already set */ + if (nextlen === 0) { + max_count = 138; + min_count = 3; + } + + for (n = 0; n <= max_code; n++) { + curlen = nextlen; + nextlen = tree[(n + 1) * 2 + 1]/*.Len*/; + + if (++count < max_count && curlen === nextlen) { + continue; + + } else if (count < min_count) { + do { send_code(s, curlen, s.bl_tree); } while (--count !== 0); + + } else if (curlen !== 0) { + if (curlen !== prevlen) { + send_code(s, curlen, s.bl_tree); + count--; + } + //Assert(count >= 3 && count <= 6, " 3_6?"); + send_code(s, REP_3_6, s.bl_tree); + send_bits(s, count - 3, 2); + + } else if (count <= 10) { + send_code(s, REPZ_3_10, s.bl_tree); + send_bits(s, count - 3, 3); + + } else { + send_code(s, REPZ_11_138, s.bl_tree); + send_bits(s, count - 11, 7); + } + + count = 0; + prevlen = curlen; + if (nextlen === 0) { + max_count = 138; + min_count = 3; + + } else if (curlen === nextlen) { + max_count = 6; + min_count = 3; + + } else { + max_count = 7; + min_count = 4; + } + } +} + + +/* =========================================================================== + * Construct the Huffman tree for the bit lengths and return the index in + * bl_order of the last bit length code to send. + */ +function build_bl_tree(s) { + var max_blindex; /* index of last bit length code of non zero freq */ + + /* Determine the bit length frequencies for literal and distance trees */ + scan_tree(s, s.dyn_ltree, s.l_desc.max_code); + scan_tree(s, s.dyn_dtree, s.d_desc.max_code); + + /* Build the bit length tree: */ + build_tree(s, s.bl_desc); + /* opt_len now includes the length of the tree representations, except + * the lengths of the bit lengths codes and the 5+5+4 bits for the counts. + */ + + /* Determine the number of bit length codes to send. The pkzip format + * requires that at least 4 bit length codes be sent. (appnote.txt says + * 3 but the actual value used is 4.) + */ + for (max_blindex = BL_CODES - 1; max_blindex >= 3; max_blindex--) { + if (s.bl_tree[bl_order[max_blindex] * 2 + 1]/*.Len*/ !== 0) { + break; + } + } + /* Update opt_len to include the bit length tree and counts */ + s.opt_len += 3 * (max_blindex + 1) + 5 + 5 + 4; + //Tracev((stderr, "\ndyn trees: dyn %ld, stat %ld", + // s->opt_len, s->static_len)); + + return max_blindex; +} + + +/* =========================================================================== + * Send the header for a block using dynamic Huffman trees: the counts, the + * lengths of the bit length codes, the literal tree and the distance tree. + * IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4. + */ +function send_all_trees(s, lcodes, dcodes, blcodes) +// deflate_state *s; +// int lcodes, dcodes, blcodes; /* number of codes for each tree */ +{ + var rank; /* index in bl_order */ + + //Assert (lcodes >= 257 && dcodes >= 1 && blcodes >= 4, "not enough codes"); + //Assert (lcodes <= L_CODES && dcodes <= D_CODES && blcodes <= BL_CODES, + // "too many codes"); + //Tracev((stderr, "\nbl counts: ")); + send_bits(s, lcodes - 257, 5); /* not +255 as stated in appnote.txt */ + send_bits(s, dcodes - 1, 5); + send_bits(s, blcodes - 4, 4); /* not -3 as stated in appnote.txt */ + for (rank = 0; rank < blcodes; rank++) { + //Tracev((stderr, "\nbl code %2d ", bl_order[rank])); + send_bits(s, s.bl_tree[bl_order[rank] * 2 + 1]/*.Len*/, 3); + } + //Tracev((stderr, "\nbl tree: sent %ld", s->bits_sent)); + + send_tree(s, s.dyn_ltree, lcodes - 1); /* literal tree */ + //Tracev((stderr, "\nlit tree: sent %ld", s->bits_sent)); + + send_tree(s, s.dyn_dtree, dcodes - 1); /* distance tree */ + //Tracev((stderr, "\ndist tree: sent %ld", s->bits_sent)); +} + + +/* =========================================================================== + * Check if the data type is TEXT or BINARY, using the following algorithm: + * - TEXT if the two conditions below are satisfied: + * a) There are no non-portable control characters belonging to the + * "black list" (0..6, 14..25, 28..31). + * b) There is at least one printable character belonging to the + * "white list" (9 {TAB}, 10 {LF}, 13 {CR}, 32..255). + * - BINARY otherwise. + * - The following partially-portable control characters form a + * "gray list" that is ignored in this detection algorithm: + * (7 {BEL}, 8 {BS}, 11 {VT}, 12 {FF}, 26 {SUB}, 27 {ESC}). + * IN assertion: the fields Freq of dyn_ltree are set. + */ +function detect_data_type(s) { + /* black_mask is the bit mask of black-listed bytes + * set bits 0..6, 14..25, and 28..31 + * 0xf3ffc07f = binary 11110011111111111100000001111111 + */ + var black_mask = 0xf3ffc07f; + var n; + + /* Check for non-textual ("black-listed") bytes. */ + for (n = 0; n <= 31; n++, black_mask >>>= 1) { + if ((black_mask & 1) && (s.dyn_ltree[n * 2]/*.Freq*/ !== 0)) { + return Z_BINARY; + } + } + + /* Check for textual ("white-listed") bytes. */ + if (s.dyn_ltree[9 * 2]/*.Freq*/ !== 0 || s.dyn_ltree[10 * 2]/*.Freq*/ !== 0 || + s.dyn_ltree[13 * 2]/*.Freq*/ !== 0) { + return Z_TEXT; + } + for (n = 32; n < LITERALS; n++) { + if (s.dyn_ltree[n * 2]/*.Freq*/ !== 0) { + return Z_TEXT; + } + } + + /* There are no "black-listed" or "white-listed" bytes: + * this stream either is empty or has tolerated ("gray-listed") bytes only. + */ + return Z_BINARY; +} + + +var static_init_done = false; + +/* =========================================================================== + * Initialize the tree data structures for a new zlib stream. + */ +function _tr_init(s) +{ + + if (!static_init_done) { + tr_static_init(); + static_init_done = true; + } + + s.l_desc = new TreeDesc(s.dyn_ltree, static_l_desc); + s.d_desc = new TreeDesc(s.dyn_dtree, static_d_desc); + s.bl_desc = new TreeDesc(s.bl_tree, static_bl_desc); + + s.bi_buf = 0; + s.bi_valid = 0; + + /* Initialize the first block of the first file: */ + init_block(s); +} + + +/* =========================================================================== + * Send a stored block + */ +function _tr_stored_block(s, buf, stored_len, last) +//DeflateState *s; +//charf *buf; /* input block */ +//ulg stored_len; /* length of input block */ +//int last; /* one if this is the last block for a file */ +{ + send_bits(s, (STORED_BLOCK << 1) + (last ? 1 : 0), 3); /* send block type */ + copy_block(s, buf, stored_len, true); /* with header */ +} + + +/* =========================================================================== + * Send one empty static block to give enough lookahead for inflate. + * This takes 10 bits, of which 7 may remain in the bit buffer. + */ +function _tr_align(s) { + send_bits(s, STATIC_TREES << 1, 3); + send_code(s, END_BLOCK, static_ltree); + bi_flush(s); +} + + +/* =========================================================================== + * Determine the best encoding for the current block: dynamic trees, static + * trees or store, and output the encoded block to the zip file. + */ +function _tr_flush_block(s, buf, stored_len, last) +//DeflateState *s; +//charf *buf; /* input block, or NULL if too old */ +//ulg stored_len; /* length of input block */ +//int last; /* one if this is the last block for a file */ +{ + var opt_lenb, static_lenb; /* opt_len and static_len in bytes */ + var max_blindex = 0; /* index of last bit length code of non zero freq */ + + /* Build the Huffman trees unless a stored block is forced */ + if (s.level > 0) { + + /* Check if the file is binary or text */ + if (s.strm.data_type === Z_UNKNOWN) { + s.strm.data_type = detect_data_type(s); + } + + /* Construct the literal and distance trees */ + build_tree(s, s.l_desc); + // Tracev((stderr, "\nlit data: dyn %ld, stat %ld", s->opt_len, + // s->static_len)); + + build_tree(s, s.d_desc); + // Tracev((stderr, "\ndist data: dyn %ld, stat %ld", s->opt_len, + // s->static_len)); + /* At this point, opt_len and static_len are the total bit lengths of + * the compressed block data, excluding the tree representations. + */ + + /* Build the bit length tree for the above two trees, and get the index + * in bl_order of the last bit length code to send. + */ + max_blindex = build_bl_tree(s); + + /* Determine the best encoding. Compute the block lengths in bytes. */ + opt_lenb = (s.opt_len + 3 + 7) >>> 3; + static_lenb = (s.static_len + 3 + 7) >>> 3; + + // Tracev((stderr, "\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u ", + // opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len, + // s->last_lit)); + + if (static_lenb <= opt_lenb) { opt_lenb = static_lenb; } + + } else { + // Assert(buf != (char*)0, "lost buf"); + opt_lenb = static_lenb = stored_len + 5; /* force a stored block */ + } + + if ((stored_len + 4 <= opt_lenb) && (buf !== -1)) { + /* 4: two words for the lengths */ + + /* The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE. + * Otherwise we can't have processed more than WSIZE input bytes since + * the last block flush, because compression would have been + * successful. If LIT_BUFSIZE <= WSIZE, it is never too late to + * transform a block into a stored block. + */ + _tr_stored_block(s, buf, stored_len, last); + + } else if (s.strategy === Z_FIXED || static_lenb === opt_lenb) { + + send_bits(s, (STATIC_TREES << 1) + (last ? 1 : 0), 3); + compress_block(s, static_ltree, static_dtree); + + } else { + send_bits(s, (DYN_TREES << 1) + (last ? 1 : 0), 3); + send_all_trees(s, s.l_desc.max_code + 1, s.d_desc.max_code + 1, max_blindex + 1); + compress_block(s, s.dyn_ltree, s.dyn_dtree); + } + // Assert (s->compressed_len == s->bits_sent, "bad compressed size"); + /* The above check is made mod 2^32, for files larger than 512 MB + * and uLong implemented on 32 bits. + */ + init_block(s); + + if (last) { + bi_windup(s); + } + // Tracev((stderr,"\ncomprlen %lu(%lu) ", s->compressed_len>>3, + // s->compressed_len-7*last)); +} + +/* =========================================================================== + * Save the match info and tally the frequency counts. Return true if + * the current block must be flushed. + */ +function _tr_tally(s, dist, lc) +// deflate_state *s; +// unsigned dist; /* distance of matched string */ +// unsigned lc; /* match length-MIN_MATCH or unmatched char (if dist==0) */ +{ + //var out_length, in_length, dcode; + + s.pending_buf[s.d_buf + s.last_lit * 2] = (dist >>> 8) & 0xff; + s.pending_buf[s.d_buf + s.last_lit * 2 + 1] = dist & 0xff; + + s.pending_buf[s.l_buf + s.last_lit] = lc & 0xff; + s.last_lit++; + + if (dist === 0) { + /* lc is the unmatched char */ + s.dyn_ltree[lc * 2]/*.Freq*/++; + } else { + s.matches++; + /* Here, lc is the match length - MIN_MATCH */ + dist--; /* dist = match distance - 1 */ + //Assert((ush)dist < (ush)MAX_DIST(s) && + // (ush)lc <= (ush)(MAX_MATCH-MIN_MATCH) && + // (ush)d_code(dist) < (ush)D_CODES, "_tr_tally: bad match"); + + s.dyn_ltree[(_length_code[lc] + LITERALS + 1) * 2]/*.Freq*/++; + s.dyn_dtree[d_code(dist) * 2]/*.Freq*/++; + } + +// (!) This block is disabled in zlib defailts, +// don't enable it for binary compatibility + +//#ifdef TRUNCATE_BLOCK +// /* Try to guess if it is profitable to stop the current block here */ +// if ((s.last_lit & 0x1fff) === 0 && s.level > 2) { +// /* Compute an upper bound for the compressed length */ +// out_length = s.last_lit*8; +// in_length = s.strstart - s.block_start; +// +// for (dcode = 0; dcode < D_CODES; dcode++) { +// out_length += s.dyn_dtree[dcode*2]/*.Freq*/ * (5 + extra_dbits[dcode]); +// } +// out_length >>>= 3; +// //Tracev((stderr,"\nlast_lit %u, in %ld, out ~%ld(%ld%%) ", +// // s->last_lit, in_length, out_length, +// // 100L - out_length*100L/in_length)); +// if (s.matches < (s.last_lit>>1)/*int /2*/ && out_length < (in_length>>1)/*int /2*/) { +// return true; +// } +// } +//#endif + + return (s.last_lit === s.lit_bufsize - 1); + /* We avoid equality with lit_bufsize because of wraparound at 64K + * on 16 bit machines and because stored blocks are restricted to + * 64K-1 bytes. + */ +} + +exports._tr_init = _tr_init; +exports._tr_stored_block = _tr_stored_block; +exports._tr_flush_block = _tr_flush_block; +exports._tr_tally = _tr_tally; +exports._tr_align = _tr_align; /***/ }, /* 211 */ -/***/ function(module, exports, __webpack_require__) { +/***/ function(module, exports) { - const AbstractHandler = __webpack_require__(180); - const Constants = __webpack_require__(5); +"use strict"; +'use strict'; - class TypingStartHandler extends AbstractHandler { - handle(packet) { - const client = this.packetManager.client; - const data = packet.d; - const channel = client.channels.get(data.channel_id); - const user = client.users.get(data.user_id); - const timestamp = new Date(data.timestamp * 1000); - if (channel && user) { - if (channel.type === 'voice') { - client.emit(Constants.Events.WARN, `Discord sent a typing packet to voice channel ${channel.id}`); - return; - } - if (channel._typing.has(user.id)) { - const typing = channel._typing.get(user.id); - typing.lastTimestamp = timestamp; - typing.resetTimeout(tooLate(channel, user)); - } else { - channel._typing.set(user.id, new TypingData(client, timestamp, timestamp, tooLate(channel, user))); - client.emit(Constants.Events.TYPING_START, channel, user); - } - } - } - } +function ZStream() { + /* next input byte */ + this.input = null; // JS specific, because we have no pointers + this.next_in = 0; + /* number of bytes available at input */ + this.avail_in = 0; + /* total number of input bytes read so far */ + this.total_in = 0; + /* next output byte should be put there */ + this.output = null; // JS specific, because we have no pointers + this.next_out = 0; + /* remaining free space at output */ + this.avail_out = 0; + /* total number of bytes output so far */ + this.total_out = 0; + /* last error message, NULL if no error */ + this.msg = ''/*Z_NULL*/; + /* not visible by applications */ + this.state = null; + /* best guess about the data type: binary or text */ + this.data_type = 2/*Z_UNKNOWN*/; + /* adler32 value of the uncompressed data */ + this.adler = 0; +} - class TypingData { - constructor(client, since, lastTimestamp, _timeout) { - this.client = client; - this.since = since; - this.lastTimestamp = lastTimestamp; - this._timeout = _timeout; - } - - resetTimeout(_timeout) { - this.client.clearTimeout(this._timeout); - this._timeout = _timeout; - } - - get elapsedTime() { - return Date.now() - this.since; - } - } - - function tooLate(channel, user) { - return channel.client.setTimeout(() => { - channel.client.emit(Constants.Events.TYPING_STOP, channel, user, channel._typing.get(user.id)); - channel._typing.delete(user.id); - }, 6000); - } - - /** - * Emitted whenever a user starts typing in a channel - * @event Client#typingStart - * @param {Channel} channel The channel the user started typing in - * @param {User} user The user that started typing - */ - - /** - * Emitted whenever a user stops typing in a channel - * @event Client#typingStop - * @param {Channel} channel The channel the user stopped typing in - * @param {User} user The user that stopped typing - */ - - module.exports = TypingStartHandler; +module.exports = ZStream; /***/ }, /* 212 */ /***/ function(module, exports, __webpack_require__) { - const AbstractHandler = __webpack_require__(180); +// from https://github.com/indutny/self-signed/blob/gh-pages/lib/asn1.js +// Fedor, you are amazing. - class UserNoteUpdateHandler extends AbstractHandler { - handle(packet) { - const client = this.packetManager.client; - const data = packet.d; +var asn1 = __webpack_require__(32) - client.actions.UserNoteUpdate.handle(data); - } - } +var RSAPrivateKey = asn1.define('RSAPrivateKey', function () { + this.seq().obj( + this.key('version').int(), + this.key('modulus').int(), + this.key('publicExponent').int(), + this.key('privateExponent').int(), + this.key('prime1').int(), + this.key('prime2').int(), + this.key('exponent1').int(), + this.key('exponent2').int(), + this.key('coefficient').int() + ) +}) +exports.RSAPrivateKey = RSAPrivateKey - module.exports = UserNoteUpdateHandler; +var RSAPublicKey = asn1.define('RSAPublicKey', function () { + this.seq().obj( + this.key('modulus').int(), + this.key('publicExponent').int() + ) +}) +exports.RSAPublicKey = RSAPublicKey + +var PublicKey = asn1.define('SubjectPublicKeyInfo', function () { + this.seq().obj( + this.key('algorithm').use(AlgorithmIdentifier), + this.key('subjectPublicKey').bitstr() + ) +}) +exports.PublicKey = PublicKey + +var AlgorithmIdentifier = asn1.define('AlgorithmIdentifier', function () { + this.seq().obj( + this.key('algorithm').objid(), + this.key('none').null_().optional(), + this.key('curve').objid().optional(), + this.key('params').seq().obj( + this.key('p').int(), + this.key('q').int(), + this.key('g').int() + ).optional() + ) +}) + +var PrivateKeyInfo = asn1.define('PrivateKeyInfo', function () { + this.seq().obj( + this.key('version').int(), + this.key('algorithm').use(AlgorithmIdentifier), + this.key('subjectPrivateKey').octstr() + ) +}) +exports.PrivateKey = PrivateKeyInfo +var EncryptedPrivateKeyInfo = asn1.define('EncryptedPrivateKeyInfo', function () { + this.seq().obj( + this.key('algorithm').seq().obj( + this.key('id').objid(), + this.key('decrypt').seq().obj( + this.key('kde').seq().obj( + this.key('id').objid(), + this.key('kdeparams').seq().obj( + this.key('salt').octstr(), + this.key('iters').int() + ) + ), + this.key('cipher').seq().obj( + this.key('algo').objid(), + this.key('iv').octstr() + ) + ) + ), + this.key('subjectPrivateKey').octstr() + ) +}) + +exports.EncryptedPrivateKey = EncryptedPrivateKeyInfo + +var DSAPrivateKey = asn1.define('DSAPrivateKey', function () { + this.seq().obj( + this.key('version').int(), + this.key('p').int(), + this.key('q').int(), + this.key('g').int(), + this.key('pub_key').int(), + this.key('priv_key').int() + ) +}) +exports.DSAPrivateKey = DSAPrivateKey + +exports.DSAparam = asn1.define('DSAparam', function () { + this.int() +}) +var ECPrivateKey = asn1.define('ECPrivateKey', function () { + this.seq().obj( + this.key('version').int(), + this.key('privateKey').octstr(), + this.key('parameters').optional().explicit(0).use(ECParameters), + this.key('publicKey').optional().explicit(1).bitstr() + ) +}) +exports.ECPrivateKey = ECPrivateKey +var ECParameters = asn1.define('ECParameters', function () { + this.choice({ + namedCurve: this.objid() + }) +}) + +exports.signature = asn1.define('signature', function () { + this.seq().obj( + this.key('r').int(), + this.key('s').int() + ) +}) /***/ }, /* 213 */ /***/ function(module, exports, __webpack_require__) { - const AbstractHandler = __webpack_require__(180); - - class UserUpdateHandler extends AbstractHandler { - handle(packet) { - const client = this.packetManager.client; - const data = packet.d; - client.actions.UserUpdate.handle(data); - } - } - - module.exports = UserUpdateHandler; +/* WEBPACK VAR INJECTION */(function(Buffer) {// adapted from https://github.com/apatil/pemstrip +var findProc = /Proc-Type: 4,ENCRYPTED\r?\nDEK-Info: AES-((?:128)|(?:192)|(?:256))-CBC,([0-9A-H]+)\r?\n\r?\n([0-9A-z\n\r\+\/\=]+)\r?\n/m +var startRegex = /^-----BEGIN (.*) KEY-----\r?\n/m +var fullRegex = /^-----BEGIN (.*) KEY-----\r?\n([0-9A-z\n\r\+\/\=]+)\r?\n-----END \1 KEY-----$/m +var evp = __webpack_require__(37) +var ciphers = __webpack_require__(47) +module.exports = function (okey, password) { + var key = okey.toString() + var match = key.match(findProc) + var decrypted + if (!match) { + var match2 = key.match(fullRegex) + decrypted = new Buffer(match2[2].replace(/\r?\n/g, ''), 'base64') + } else { + var suite = 'aes' + match[1] + var iv = new Buffer(match[2], 'hex') + var cipherText = new Buffer(match[3].replace(/\r?\n/g, ''), 'base64') + var cipherKey = evp(password, iv.slice(0, 8), parseInt(match[1], 10)).key + var out = [] + var cipher = ciphers.createDecipheriv(suite, cipherKey, iv) + out.push(cipher.update(cipherText)) + out.push(cipher.final()) + decrypted = Buffer.concat(out) + } + var tag = key.match(startRegex)[1] + ' KEY' + return { + tag: tag, + data: decrypted + } +} +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer)) /***/ }, /* 214 */ -/***/ function(module, exports, __webpack_require__) { +/***/ function(module, exports) { - const AbstractHandler = __webpack_require__(180); +var MAX_ALLOC = Math.pow(2, 30) - 1 // default in iojs +module.exports = function (iterations, keylen) { + if (typeof iterations !== 'number') { + throw new TypeError('Iterations not a number') + } - /* - { - "token": "my_token", - "guild_id": "41771983423143937", - "endpoint": "smart.loyal.discord.gg" - } - */ + if (iterations < 0) { + throw new TypeError('Bad iterations') + } - class VoiceServerUpdate extends AbstractHandler { - handle(packet) { - const client = this.packetManager.client; - const data = packet.d; - client.emit('self.voiceServer', data); - } - } + if (typeof keylen !== 'number') { + throw new TypeError('Key length not a number') + } - module.exports = VoiceServerUpdate; + if (keylen < 0 || keylen > MAX_ALLOC || keylen !== keylen) { /* eslint no-self-compare: 0 */ + throw new TypeError('Bad key length') + } +} /***/ }, /* 215 */ /***/ function(module, exports, __webpack_require__) { - const AbstractHandler = __webpack_require__(180); +exports.publicEncrypt = __webpack_require__(217); +exports.privateDecrypt = __webpack_require__(216); - const Constants = __webpack_require__(5); - const cloneObject = __webpack_require__(46); - - class VoiceStateUpdateHandler extends AbstractHandler { - handle(packet) { - const client = this.packetManager.client; - const data = packet.d; - - const guild = client.guilds.get(data.guild_id); - if (guild) { - const member = guild.members.get(data.user_id); - if (member) { - const oldVoiceChannelMember = cloneObject(member); - if (member.voiceChannel && member.voiceChannel.id !== data.channel_id) { - member.voiceChannel.members.delete(oldVoiceChannelMember.id); - } - - // if the member left the voice channel, unset their speaking property - if (!data.channel_id) member.speaking = null; - - if (member.user.id === client.user.id && data.channel_id) { - client.emit('self.voiceStateUpdate', data); - } - - const newChannel = client.channels.get(data.channel_id); - if (newChannel) newChannel.members.set(member.user.id, member); - - member.serverMute = data.mute; - member.serverDeaf = data.deaf; - member.selfMute = data.self_mute; - member.selfDeaf = data.self_deaf; - member.voiceSessionID = data.session_id; - member.voiceChannelID = data.channel_id; - client.emit(Constants.Events.VOICE_STATE_UPDATE, oldVoiceChannelMember, member); - } - } - } - } - - /** - * Emitted whenever a user changes voice state - e.g. joins/leaves a channel, mutes/unmutes. - * @event Client#voiceStateUpdate - * @param {GuildMember} oldMember The member before the voice state update - * @param {GuildMember} newMember The member after the voice state update - */ - - module.exports = VoiceStateUpdateHandler; +exports.privateEncrypt = function privateEncrypt(key, buf) { + return exports.publicEncrypt(key, buf, true); +}; +exports.publicDecrypt = function publicDecrypt(key, buf) { + return exports.privateDecrypt(key, buf, true); +}; /***/ }, /* 216 */ /***/ function(module, exports, __webpack_require__) { - class ActionsManager { - constructor(client) { - this.client = client; +/* WEBPACK VAR INJECTION */(function(Buffer) {var parseKeys = __webpack_require__(39); +var mgf = __webpack_require__(109); +var xor = __webpack_require__(111); +var bn = __webpack_require__(4); +var crt = __webpack_require__(48); +var createHash = __webpack_require__(18); +var withPublic = __webpack_require__(110); +module.exports = function privateDecrypt(private_key, enc, reverse) { + var padding; + if (private_key.padding) { + padding = private_key.padding; + } else if (reverse) { + padding = 1; + } else { + padding = 4; + } + + var key = parseKeys(private_key); + var k = key.modulus.byteLength(); + if (enc.length > k || new bn(enc).cmp(key.modulus) >= 0) { + throw new Error('decryption error'); + } + var msg; + if (reverse) { + msg = withPublic(new bn(enc), key); + } else { + msg = crt(enc, key); + } + var zBuffer = new Buffer(k - msg.length); + zBuffer.fill(0); + msg = Buffer.concat([zBuffer, msg], k); + if (padding === 4) { + return oaep(key, msg); + } else if (padding === 1) { + return pkcs1(key, msg, reverse); + } else if (padding === 3) { + return msg; + } else { + throw new Error('unknown padding'); + } +}; - this.register('MessageCreate'); - this.register('MessageDelete'); - this.register('MessageDeleteBulk'); - this.register('MessageUpdate'); - this.register('MessageReactionAdd'); - this.register('MessageReactionRemove'); - this.register('MessageReactionRemoveAll'); - this.register('ChannelCreate'); - this.register('ChannelDelete'); - this.register('ChannelUpdate'); - this.register('GuildDelete'); - this.register('GuildUpdate'); - this.register('GuildMemberGet'); - this.register('GuildMemberRemove'); - this.register('GuildBanRemove'); - this.register('GuildRoleCreate'); - this.register('GuildRoleDelete'); - this.register('GuildRoleUpdate'); - this.register('UserGet'); - this.register('UserUpdate'); - this.register('UserNoteUpdate'); - this.register('GuildSync'); - this.register('GuildEmojiCreate'); - this.register('GuildEmojiDelete'); - this.register('GuildEmojiUpdate'); - this.register('GuildRolesPositionUpdate'); - } +function oaep(key, msg){ + var n = key.modulus; + var k = key.modulus.byteLength(); + var mLen = msg.length; + var iHash = createHash('sha1').update(new Buffer('')).digest(); + var hLen = iHash.length; + var hLen2 = 2 * hLen; + if (msg[0] !== 0) { + throw new Error('decryption error'); + } + var maskedSeed = msg.slice(1, hLen + 1); + var maskedDb = msg.slice(hLen + 1); + var seed = xor(maskedSeed, mgf(maskedDb, hLen)); + var db = xor(maskedDb, mgf(seed, k - hLen - 1)); + if (compare(iHash, db.slice(0, hLen))) { + throw new Error('decryption error'); + } + var i = hLen; + while (db[i] === 0) { + i++; + } + if (db[i++] !== 1) { + throw new Error('decryption error'); + } + return db.slice(i); +} - register(name) { - const Action = __webpack_require__(217)(`./${name}`); - this[name] = new Action(this.client); - } - } - - module.exports = ActionsManager; +function pkcs1(key, msg, reverse){ + var p1 = msg.slice(0, 2); + var i = 2; + var status = 0; + while (msg[i++] !== 0) { + if (i >= msg.length) { + status++; + break; + } + } + var ps = msg.slice(2, i - 1); + var p2 = msg.slice(i - 1, i); + if ((p1.toString('hex') !== '0002' && !reverse) || (p1.toString('hex') !== '0001' && reverse)){ + status++; + } + if (ps.length < 8) { + status++; + } + if (status) { + throw new Error('decryption error'); + } + return msg.slice(i); +} +function compare(a, b){ + a = new Buffer(a); + b = new Buffer(b); + var dif = 0; + var len = a.length; + if (a.length !== b.length) { + dif++; + len = Math.min(a.length, b.length); + } + var i = -1; + while (++i < len) { + dif += (a[i] ^ b[i]); + } + return dif; +} +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer)) /***/ }, /* 217 */ /***/ function(module, exports, __webpack_require__) { - var map = { - "./Action": 218, - "./Action.js": 218, - "./ActionsManager": 216, - "./ActionsManager.js": 216, - "./ChannelCreate": 219, - "./ChannelCreate.js": 219, - "./ChannelDelete": 220, - "./ChannelDelete.js": 220, - "./ChannelUpdate": 221, - "./ChannelUpdate.js": 221, - "./GuildBanRemove": 222, - "./GuildBanRemove.js": 222, - "./GuildDelete": 223, - "./GuildDelete.js": 223, - "./GuildEmojiCreate": 224, - "./GuildEmojiCreate.js": 224, - "./GuildEmojiDelete": 225, - "./GuildEmojiDelete.js": 225, - "./GuildEmojiUpdate": 226, - "./GuildEmojiUpdate.js": 226, - "./GuildMemberGet": 227, - "./GuildMemberGet.js": 227, - "./GuildMemberRemove": 228, - "./GuildMemberRemove.js": 228, - "./GuildRoleCreate": 229, - "./GuildRoleCreate.js": 229, - "./GuildRoleDelete": 230, - "./GuildRoleDelete.js": 230, - "./GuildRoleUpdate": 231, - "./GuildRoleUpdate.js": 231, - "./GuildRolesPositionUpdate": 232, - "./GuildRolesPositionUpdate.js": 232, - "./GuildSync": 233, - "./GuildSync.js": 233, - "./GuildUpdate": 234, - "./GuildUpdate.js": 234, - "./MessageCreate": 235, - "./MessageCreate.js": 235, - "./MessageDelete": 236, - "./MessageDelete.js": 236, - "./MessageDeleteBulk": 237, - "./MessageDeleteBulk.js": 237, - "./MessageReactionAdd": 238, - "./MessageReactionAdd.js": 238, - "./MessageReactionRemove": 239, - "./MessageReactionRemove.js": 239, - "./MessageReactionRemoveAll": 240, - "./MessageReactionRemoveAll.js": 240, - "./MessageUpdate": 241, - "./MessageUpdate.js": 241, - "./UserGet": 242, - "./UserGet.js": 242, - "./UserNoteUpdate": 243, - "./UserNoteUpdate.js": 243, - "./UserUpdate": 244, - "./UserUpdate.js": 244 - }; - function webpackContext(req) { - return __webpack_require__(webpackContextResolve(req)); - }; - function webpackContextResolve(req) { - return map[req] || (function() { throw new Error("Cannot find module '" + req + "'.") }()); - }; - webpackContext.keys = function webpackContextKeys() { - return Object.keys(map); - }; - webpackContext.resolve = webpackContextResolve; - module.exports = webpackContext; - webpackContext.id = 217; +/* WEBPACK VAR INJECTION */(function(Buffer) {var parseKeys = __webpack_require__(39); +var randomBytes = __webpack_require__(27); +var createHash = __webpack_require__(18); +var mgf = __webpack_require__(109); +var xor = __webpack_require__(111); +var bn = __webpack_require__(4); +var withPublic = __webpack_require__(110); +var crt = __webpack_require__(48); +var constants = { + RSA_PKCS1_OAEP_PADDING: 4, + RSA_PKCS1_PADDIN: 1, + RSA_NO_PADDING: 3 +}; + +module.exports = function publicEncrypt(public_key, msg, reverse) { + var padding; + if (public_key.padding) { + padding = public_key.padding; + } else if (reverse) { + padding = 1; + } else { + padding = 4; + } + var key = parseKeys(public_key); + var paddedMsg; + if (padding === 4) { + paddedMsg = oaep(key, msg); + } else if (padding === 1) { + paddedMsg = pkcs1(key, msg, reverse); + } else if (padding === 3) { + paddedMsg = new bn(msg); + if (paddedMsg.cmp(key.modulus) >= 0) { + throw new Error('data too long for modulus'); + } + } else { + throw new Error('unknown padding'); + } + if (reverse) { + return crt(paddedMsg, key); + } else { + return withPublic(paddedMsg, key); + } +}; + +function oaep(key, msg){ + var k = key.modulus.byteLength(); + var mLen = msg.length; + var iHash = createHash('sha1').update(new Buffer('')).digest(); + var hLen = iHash.length; + var hLen2 = 2 * hLen; + if (mLen > k - hLen2 - 2) { + throw new Error('message too long'); + } + var ps = new Buffer(k - mLen - hLen2 - 2); + ps.fill(0); + var dblen = k - hLen - 1; + var seed = randomBytes(hLen); + var maskedDb = xor(Buffer.concat([iHash, ps, new Buffer([1]), msg], dblen), mgf(seed, dblen)); + var maskedSeed = xor(seed, mgf(maskedDb, hLen)); + return new bn(Buffer.concat([new Buffer([0]), maskedSeed, maskedDb], k)); +} +function pkcs1(key, msg, reverse){ + var mLen = msg.length; + var k = key.modulus.byteLength(); + if (mLen > k - 11) { + throw new Error('message too long'); + } + var ps; + if (reverse) { + ps = new Buffer(k - mLen - 3); + ps.fill(0xff); + } else { + ps = nonZero(k - mLen - 3); + } + return new bn(Buffer.concat([new Buffer([0, reverse?1:2]), ps, new Buffer([0]), msg], k)); +} +function nonZero(len, crypto) { + var out = new Buffer(len); + var i = 0; + var cache = randomBytes(len*2); + var cur = 0; + var num; + while (i < len) { + if (cur === cache.length) { + cache = randomBytes(len*2); + cur = 0; + } + num = cache[cur++]; + if (num) { + out[i++] = num; + } + } + return out; +} +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer)) /***/ }, /* 218 */ -/***/ function(module, exports) { +/***/ function(module, exports, __webpack_require__) { - /* +/* WEBPACK VAR INJECTION */(function(module, global) {var __WEBPACK_AMD_DEFINE_RESULT__;/*! https://mths.be/punycode v1.4.1 by @mathias */ +;(function(root) { - ABOUT ACTIONS - - Actions are similar to WebSocket Packet Handlers, but since introducing - the REST API methods, in order to prevent rewriting code to handle data, - "actions" have been introduced. They're basically what Packet Handlers - used to be but they're strictly for manipulating data and making sure - that WebSocket events don't clash with REST methods. - - */ - - class GenericAction { - constructor(client) { - this.client = client; - } - - handle(data) { - return data; - } + /** Detect free variables */ + var freeExports = typeof exports == 'object' && exports && + !exports.nodeType && exports; + var freeModule = typeof module == 'object' && module && + !module.nodeType && module; + var freeGlobal = typeof global == 'object' && global; + if ( + freeGlobal.global === freeGlobal || + freeGlobal.window === freeGlobal || + freeGlobal.self === freeGlobal + ) { + root = freeGlobal; } - module.exports = GenericAction; + /** + * The `punycode` object. + * @name punycode + * @type Object + */ + var punycode, + /** Highest positive signed 32-bit float value */ + maxInt = 2147483647, // aka. 0x7FFFFFFF or 2^31-1 + + /** Bootstring parameters */ + base = 36, + tMin = 1, + tMax = 26, + skew = 38, + damp = 700, + initialBias = 72, + initialN = 128, // 0x80 + delimiter = '-', // '\x2D' + + /** Regular expressions */ + regexPunycode = /^xn--/, + regexNonASCII = /[^\x20-\x7E]/, // unprintable ASCII chars + non-ASCII chars + regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g, // RFC 3490 separators + + /** Error messages */ + errors = { + 'overflow': 'Overflow: input needs wider integers to process', + 'not-basic': 'Illegal input >= 0x80 (not a basic code point)', + 'invalid-input': 'Invalid input' + }, + + /** Convenience shortcuts */ + baseMinusTMin = base - tMin, + floor = Math.floor, + stringFromCharCode = String.fromCharCode, + + /** Temporary variable */ + key; + + /*--------------------------------------------------------------------------*/ + + /** + * A generic error utility function. + * @private + * @param {String} type The error type. + * @returns {Error} Throws a `RangeError` with the applicable error message. + */ + function error(type) { + throw new RangeError(errors[type]); + } + + /** + * A generic `Array#map` utility function. + * @private + * @param {Array} array The array to iterate over. + * @param {Function} callback The function that gets called for every array + * item. + * @returns {Array} A new array of values returned by the callback function. + */ + function map(array, fn) { + var length = array.length; + var result = []; + while (length--) { + result[length] = fn(array[length]); + } + return result; + } + + /** + * A simple `Array#map`-like wrapper to work with domain name strings or email + * addresses. + * @private + * @param {String} domain The domain name or email address. + * @param {Function} callback The function that gets called for every + * character. + * @returns {Array} A new string of characters returned by the callback + * function. + */ + function mapDomain(string, fn) { + var parts = string.split('@'); + var result = ''; + if (parts.length > 1) { + // In email addresses, only the domain name should be punycoded. Leave + // the local part (i.e. everything up to `@`) intact. + result = parts[0] + '@'; + string = parts[1]; + } + // Avoid `split(regex)` for IE8 compatibility. See #17. + string = string.replace(regexSeparators, '\x2E'); + var labels = string.split('.'); + var encoded = map(labels, fn).join('.'); + return result + encoded; + } + + /** + * Creates an array containing the numeric code points of each Unicode + * character in the string. While JavaScript uses UCS-2 internally, + * this function will convert a pair of surrogate halves (each of which + * UCS-2 exposes as separate characters) into a single code point, + * matching UTF-16. + * @see `punycode.ucs2.encode` + * @see + * @memberOf punycode.ucs2 + * @name decode + * @param {String} string The Unicode input string (UCS-2). + * @returns {Array} The new array of code points. + */ + function ucs2decode(string) { + var output = [], + counter = 0, + length = string.length, + value, + extra; + while (counter < length) { + value = string.charCodeAt(counter++); + if (value >= 0xD800 && value <= 0xDBFF && counter < length) { + // high surrogate, and there is a next character + extra = string.charCodeAt(counter++); + if ((extra & 0xFC00) == 0xDC00) { // low surrogate + output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000); + } else { + // unmatched surrogate; only append this code unit, in case the next + // code unit is the high surrogate of a surrogate pair + output.push(value); + counter--; + } + } else { + output.push(value); + } + } + return output; + } + + /** + * Creates a string based on an array of numeric code points. + * @see `punycode.ucs2.decode` + * @memberOf punycode.ucs2 + * @name encode + * @param {Array} codePoints The array of numeric code points. + * @returns {String} The new Unicode string (UCS-2). + */ + function ucs2encode(array) { + return map(array, function(value) { + var output = ''; + if (value > 0xFFFF) { + value -= 0x10000; + output += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800); + value = 0xDC00 | value & 0x3FF; + } + output += stringFromCharCode(value); + return output; + }).join(''); + } + + /** + * Converts a basic code point into a digit/integer. + * @see `digitToBasic()` + * @private + * @param {Number} codePoint The basic numeric code point value. + * @returns {Number} The numeric value of a basic code point (for use in + * representing integers) in the range `0` to `base - 1`, or `base` if + * the code point does not represent a value. + */ + function basicToDigit(codePoint) { + if (codePoint - 48 < 10) { + return codePoint - 22; + } + if (codePoint - 65 < 26) { + return codePoint - 65; + } + if (codePoint - 97 < 26) { + return codePoint - 97; + } + return base; + } + + /** + * Converts a digit/integer into a basic code point. + * @see `basicToDigit()` + * @private + * @param {Number} digit The numeric value of a basic code point. + * @returns {Number} The basic code point whose value (when used for + * representing integers) is `digit`, which needs to be in the range + * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is + * used; else, the lowercase form is used. The behavior is undefined + * if `flag` is non-zero and `digit` has no uppercase form. + */ + function digitToBasic(digit, flag) { + // 0..25 map to ASCII a..z or A..Z + // 26..35 map to ASCII 0..9 + return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5); + } + + /** + * Bias adaptation function as per section 3.4 of RFC 3492. + * https://tools.ietf.org/html/rfc3492#section-3.4 + * @private + */ + function adapt(delta, numPoints, firstTime) { + var k = 0; + delta = firstTime ? floor(delta / damp) : delta >> 1; + delta += floor(delta / numPoints); + for (/* no initialization */; delta > baseMinusTMin * tMax >> 1; k += base) { + delta = floor(delta / baseMinusTMin); + } + return floor(k + (baseMinusTMin + 1) * delta / (delta + skew)); + } + + /** + * Converts a Punycode string of ASCII-only symbols to a string of Unicode + * symbols. + * @memberOf punycode + * @param {String} input The Punycode string of ASCII-only symbols. + * @returns {String} The resulting string of Unicode symbols. + */ + function decode(input) { + // Don't use UCS-2 + var output = [], + inputLength = input.length, + out, + i = 0, + n = initialN, + bias = initialBias, + basic, + j, + index, + oldi, + w, + k, + digit, + t, + /** Cached calculation results */ + baseMinusT; + + // Handle the basic code points: let `basic` be the number of input code + // points before the last delimiter, or `0` if there is none, then copy + // the first basic code points to the output. + + basic = input.lastIndexOf(delimiter); + if (basic < 0) { + basic = 0; + } + + for (j = 0; j < basic; ++j) { + // if it's not a basic code point + if (input.charCodeAt(j) >= 0x80) { + error('not-basic'); + } + output.push(input.charCodeAt(j)); + } + + // Main decoding loop: start just after the last delimiter if any basic code + // points were copied; start at the beginning otherwise. + + for (index = basic > 0 ? basic + 1 : 0; index < inputLength; /* no final expression */) { + + // `index` is the index of the next character to be consumed. + // Decode a generalized variable-length integer into `delta`, + // which gets added to `i`. The overflow checking is easier + // if we increase `i` as we go, then subtract off its starting + // value at the end to obtain `delta`. + for (oldi = i, w = 1, k = base; /* no condition */; k += base) { + + if (index >= inputLength) { + error('invalid-input'); + } + + digit = basicToDigit(input.charCodeAt(index++)); + + if (digit >= base || digit > floor((maxInt - i) / w)) { + error('overflow'); + } + + i += digit * w; + t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias); + + if (digit < t) { + break; + } + + baseMinusT = base - t; + if (w > floor(maxInt / baseMinusT)) { + error('overflow'); + } + + w *= baseMinusT; + + } + + out = output.length + 1; + bias = adapt(i - oldi, out, oldi == 0); + + // `i` was supposed to wrap around from `out` to `0`, + // incrementing `n` each time, so we'll fix that now: + if (floor(i / out) > maxInt - n) { + error('overflow'); + } + + n += floor(i / out); + i %= out; + + // Insert `n` at position `i` of the output + output.splice(i++, 0, n); + + } + + return ucs2encode(output); + } + + /** + * Converts a string of Unicode symbols (e.g. a domain name label) to a + * Punycode string of ASCII-only symbols. + * @memberOf punycode + * @param {String} input The string of Unicode symbols. + * @returns {String} The resulting Punycode string of ASCII-only symbols. + */ + function encode(input) { + var n, + delta, + handledCPCount, + basicLength, + bias, + j, + m, + q, + k, + t, + currentValue, + output = [], + /** `inputLength` will hold the number of code points in `input`. */ + inputLength, + /** Cached calculation results */ + handledCPCountPlusOne, + baseMinusT, + qMinusT; + + // Convert the input in UCS-2 to Unicode + input = ucs2decode(input); + + // Cache the length + inputLength = input.length; + + // Initialize the state + n = initialN; + delta = 0; + bias = initialBias; + + // Handle the basic code points + for (j = 0; j < inputLength; ++j) { + currentValue = input[j]; + if (currentValue < 0x80) { + output.push(stringFromCharCode(currentValue)); + } + } + + handledCPCount = basicLength = output.length; + + // `handledCPCount` is the number of code points that have been handled; + // `basicLength` is the number of basic code points. + + // Finish the basic string - if it is not empty - with a delimiter + if (basicLength) { + output.push(delimiter); + } + + // Main encoding loop: + while (handledCPCount < inputLength) { + + // All non-basic code points < n have been handled already. Find the next + // larger one: + for (m = maxInt, j = 0; j < inputLength; ++j) { + currentValue = input[j]; + if (currentValue >= n && currentValue < m) { + m = currentValue; + } + } + + // Increase `delta` enough to advance the decoder's state to , + // but guard against overflow + handledCPCountPlusOne = handledCPCount + 1; + if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) { + error('overflow'); + } + + delta += (m - n) * handledCPCountPlusOne; + n = m; + + for (j = 0; j < inputLength; ++j) { + currentValue = input[j]; + + if (currentValue < n && ++delta > maxInt) { + error('overflow'); + } + + if (currentValue == n) { + // Represent delta as a generalized variable-length integer + for (q = delta, k = base; /* no condition */; k += base) { + t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias); + if (q < t) { + break; + } + qMinusT = q - t; + baseMinusT = base - t; + output.push( + stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0)) + ); + q = floor(qMinusT / baseMinusT); + } + + output.push(stringFromCharCode(digitToBasic(q, 0))); + bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength); + delta = 0; + ++handledCPCount; + } + } + + ++delta; + ++n; + + } + return output.join(''); + } + + /** + * Converts a Punycode string representing a domain name or an email address + * to Unicode. Only the Punycoded parts of the input will be converted, i.e. + * it doesn't matter if you call it on a string that has already been + * converted to Unicode. + * @memberOf punycode + * @param {String} input The Punycoded domain name or email address to + * convert to Unicode. + * @returns {String} The Unicode representation of the given Punycode + * string. + */ + function toUnicode(input) { + return mapDomain(input, function(string) { + return regexPunycode.test(string) + ? decode(string.slice(4).toLowerCase()) + : string; + }); + } + + /** + * Converts a Unicode string representing a domain name or an email address to + * Punycode. Only the non-ASCII parts of the domain name will be converted, + * i.e. it doesn't matter if you call it with a domain that's already in + * ASCII. + * @memberOf punycode + * @param {String} input The domain name or email address to convert, as a + * Unicode string. + * @returns {String} The Punycode representation of the given domain name or + * email address. + */ + function toASCII(input) { + return mapDomain(input, function(string) { + return regexNonASCII.test(string) + ? 'xn--' + encode(string) + : string; + }); + } + + /*--------------------------------------------------------------------------*/ + + /** Define the public API */ + punycode = { + /** + * A string representing the current Punycode.js version number. + * @memberOf punycode + * @type String + */ + 'version': '1.4.1', + /** + * An object of methods to convert from JavaScript's internal character + * representation (UCS-2) to Unicode code points, and back. + * @see + * @memberOf punycode + * @type Object + */ + 'ucs2': { + 'decode': ucs2decode, + 'encode': ucs2encode + }, + 'decode': decode, + 'encode': encode, + 'toASCII': toASCII, + 'toUnicode': toUnicode + }; + + /** Expose `punycode` */ + // Some AMD build optimizers, like r.js, check for specific condition patterns + // like the following: + if ( + true + ) { + !(__WEBPACK_AMD_DEFINE_RESULT__ = function() { + return punycode; + }.call(exports, __webpack_require__, exports, module), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); + } else if (freeExports && freeModule) { + if (module.exports == freeExports) { + // in Node.js, io.js, or RingoJS v0.8.0+ + freeModule.exports = punycode; + } else { + // in Narwhal or RingoJS v0.7.0- + for (key in punycode) { + punycode.hasOwnProperty(key) && (freeExports[key] = punycode[key]); + } + } + } else { + // in Rhino or a web browser + root.punycode = punycode; + } + +}(this)); + +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(117)(module), __webpack_require__(16))) /***/ }, /* 219 */ -/***/ function(module, exports, __webpack_require__) { +/***/ function(module, exports) { - const Action = __webpack_require__(218); +"use strict"; +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. - class ChannelCreateAction extends Action { - handle(data) { - const client = this.client; - const channel = client.dataManager.newChannel(data); - return { - channel, - }; - } - } +'use strict'; - module.exports = ChannelCreateAction; +// If obj.hasOwnProperty has been overridden, then calling +// obj.hasOwnProperty(prop) will break. +// See: https://github.com/joyent/node/issues/1707 +function hasOwnProperty(obj, prop) { + return Object.prototype.hasOwnProperty.call(obj, prop); +} + +module.exports = function(qs, sep, eq, options) { + sep = sep || '&'; + eq = eq || '='; + var obj = {}; + + if (typeof qs !== 'string' || qs.length === 0) { + return obj; + } + + var regexp = /\+/g; + qs = qs.split(sep); + + var maxKeys = 1000; + if (options && typeof options.maxKeys === 'number') { + maxKeys = options.maxKeys; + } + + var len = qs.length; + // maxKeys <= 0 means that we should not limit keys count + if (maxKeys > 0 && len > maxKeys) { + len = maxKeys; + } + + for (var i = 0; i < len; ++i) { + var x = qs[i].replace(regexp, '%20'), + idx = x.indexOf(eq), + kstr, vstr, k, v; + + if (idx >= 0) { + kstr = x.substr(0, idx); + vstr = x.substr(idx + 1); + } else { + kstr = x; + vstr = ''; + } + + k = decodeURIComponent(kstr); + v = decodeURIComponent(vstr); + + if (!hasOwnProperty(obj, k)) { + obj[k] = v; + } else if (isArray(obj[k])) { + obj[k].push(v); + } else { + obj[k] = [obj[k], v]; + } + } + + return obj; +}; + +var isArray = Array.isArray || function (xs) { + return Object.prototype.toString.call(xs) === '[object Array]'; +}; /***/ }, /* 220 */ -/***/ function(module, exports, __webpack_require__) { +/***/ function(module, exports) { - const Action = __webpack_require__(218); +"use strict"; +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. - class ChannelDeleteAction extends Action { - constructor(client) { - super(client); - this.deleted = new Map(); - } +'use strict'; - handle(data) { - const client = this.client; +var stringifyPrimitive = function(v) { + switch (typeof v) { + case 'string': + return v; - let channel = client.channels.get(data.id); - if (channel) { - client.dataManager.killChannel(channel); - this.deleted.set(channel.id, channel); - this.scheduleForDeletion(channel.id); - } else { - channel = this.deleted.get(data.id) || null; - } + case 'boolean': + return v ? 'true' : 'false'; - return { - channel, - }; - } + case 'number': + return isFinite(v) ? v : ''; - scheduleForDeletion(id) { - this.client.setTimeout(() => this.deleted.delete(id), this.client.options.restWsBridgeTimeout); - } - } + default: + return ''; + } +}; - module.exports = ChannelDeleteAction; +module.exports = function(obj, sep, eq, name) { + sep = sep || '&'; + eq = eq || '='; + if (obj === null) { + obj = undefined; + } + + if (typeof obj === 'object') { + return map(objectKeys(obj), function(k) { + var ks = encodeURIComponent(stringifyPrimitive(k)) + eq; + if (isArray(obj[k])) { + return map(obj[k], function(v) { + return ks + encodeURIComponent(stringifyPrimitive(v)); + }).join(sep); + } else { + return ks + encodeURIComponent(stringifyPrimitive(obj[k])); + } + }).join(sep); + + } + + if (!name) return ''; + return encodeURIComponent(stringifyPrimitive(name)) + eq + + encodeURIComponent(stringifyPrimitive(obj)); +}; + +var isArray = Array.isArray || function (xs) { + return Object.prototype.toString.call(xs) === '[object Array]'; +}; + +function map (xs, f) { + if (xs.map) return xs.map(f); + var res = []; + for (var i = 0; i < xs.length; i++) { + res.push(f(xs[i], i)); + } + return res; +} + +var objectKeys = Object.keys || function (obj) { + var res = []; + for (var key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) res.push(key); + } + return res; +}; /***/ }, /* 221 */ /***/ function(module, exports, __webpack_require__) { - const Action = __webpack_require__(218); - const Constants = __webpack_require__(5); - const cloneObject = __webpack_require__(46); +"use strict"; +'use strict'; - class ChannelUpdateAction extends Action { - handle(data) { - const client = this.client; - - const channel = client.channels.get(data.id); - if (channel) { - const oldChannel = cloneObject(channel); - channel.setup(data); - client.emit(Constants.Events.CHANNEL_UPDATE, oldChannel, channel); - return { - old: oldChannel, - updated: channel, - }; - } - - return { - old: null, - updated: null, - }; - } - } - - /** - * Emitted whenever a channel is updated - e.g. name change, topic change. - * @event Client#channelUpdate - * @param {Channel} oldChannel The channel before the update - * @param {Channel} newChannel The channel after the update - */ - - module.exports = ChannelUpdateAction; +exports.decode = exports.parse = __webpack_require__(219); +exports.encode = exports.stringify = __webpack_require__(220); /***/ }, /* 222 */ /***/ function(module, exports, __webpack_require__) { - const Action = __webpack_require__(218); - const Constants = __webpack_require__(5); - - class GuildBanRemove extends Action { - handle(data) { - const client = this.client; - const guild = client.guilds.get(data.guild_id); - const user = client.dataManager.newUser(data.user); - if (guild && user) client.emit(Constants.Events.GUILD_BAN_REMOVE, guild, user); - } - } - - module.exports = GuildBanRemove; +module.exports = __webpack_require__(15) /***/ }, /* 223 */ /***/ function(module, exports, __webpack_require__) { - const Action = __webpack_require__(218); - const Constants = __webpack_require__(5); +"use strict"; +'use strict'; - class GuildDeleteAction extends Action { - constructor(client) { - super(client); - this.deleted = new Map(); - } +var Buffer = __webpack_require__(0).Buffer; +/**/ +var bufferShim = __webpack_require__(49); +/**/ - handle(data) { - const client = this.client; +module.exports = BufferList; - let guild = client.guilds.get(data.id); - if (guild) { - if (guild.available && data.unavailable) { - // guild is unavailable - guild.available = false; - client.emit(Constants.Events.GUILD_UNAVAILABLE, guild); +function BufferList() { + this.head = null; + this.tail = null; + this.length = 0; +} - // stops the GuildDelete packet thinking a guild was actually deleted, - // handles emitting of event itself - return { - guild: null, - }; - } +BufferList.prototype.push = function (v) { + var entry = { data: v, next: null }; + if (this.length > 0) this.tail.next = entry;else this.head = entry; + this.tail = entry; + ++this.length; +}; - // delete guild - client.guilds.delete(guild.id); - this.deleted.set(guild.id, guild); - this.scheduleForDeletion(guild.id); - } else { - guild = this.deleted.get(data.id) || null; - } +BufferList.prototype.unshift = function (v) { + var entry = { data: v, next: this.head }; + if (this.length === 0) this.tail = entry; + this.head = entry; + ++this.length; +}; - return { - guild, - }; - } +BufferList.prototype.shift = function () { + if (this.length === 0) return; + var ret = this.head.data; + if (this.length === 1) this.head = this.tail = null;else this.head = this.head.next; + --this.length; + return ret; +}; - scheduleForDeletion(id) { - this.client.setTimeout(() => this.deleted.delete(id), this.client.options.restWsBridgeTimeout); - } - } +BufferList.prototype.clear = function () { + this.head = this.tail = null; + this.length = 0; +}; - /** - * Emitted whenever a guild becomes unavailable, likely due to a server outage. - * @event Client#guildUnavailable - * @param {Guild} guild The guild that has become unavailable. - */ - - module.exports = GuildDeleteAction; +BufferList.prototype.join = function (s) { + if (this.length === 0) return ''; + var p = this.head; + var ret = '' + p.data; + while (p = p.next) { + ret += s + p.data; + }return ret; +}; +BufferList.prototype.concat = function (n) { + if (this.length === 0) return bufferShim.alloc(0); + if (this.length === 1) return this.head.data; + var ret = bufferShim.allocUnsafe(n >>> 0); + var p = this.head; + var i = 0; + while (p) { + p.data.copy(ret, i); + i += p.data.length; + p = p.next; + } + return ret; +}; /***/ }, /* 224 */ /***/ function(module, exports, __webpack_require__) { - const Action = __webpack_require__(218); - - class EmojiCreateAction extends Action { - handle(data, guild) { - const client = this.client; - const emoji = client.dataManager.newEmoji(data, guild); - return { - emoji, - }; - } - } - - /** - * Emitted whenever an emoji is created - * @event Client#guildEmojiCreate - * @param {Emoji} emoji The emoji that was created. - */ - module.exports = EmojiCreateAction; +module.exports = __webpack_require__(112) /***/ }, /* 225 */ /***/ function(module, exports, __webpack_require__) { - const Action = __webpack_require__(218); +/* WEBPACK VAR INJECTION */(function(process) {var Stream = (function (){ + try { + return __webpack_require__(9); // hack to fix a circular dependency issue when used with browserify + } catch(_){} +}()); +exports = module.exports = __webpack_require__(113); +exports.Stream = Stream || exports; +exports.Readable = exports; +exports.Writable = __webpack_require__(55); +exports.Duplex = __webpack_require__(15); +exports.Transform = __webpack_require__(54); +exports.PassThrough = __webpack_require__(112); - class EmojiDeleteAction extends Action { - handle(data) { - const client = this.client; - client.dataManager.killEmoji(data); - return { - data, - }; - } - } - - /** - * Emitted whenever an emoji is deleted - * @event Client#guildEmojiDelete - * @param {Emoji} emoji The emoji that was deleted. - */ - module.exports = EmojiDeleteAction; +if (!process.browser && process.env.READABLE_STREAM === 'disable' && Stream) { + module.exports = Stream; +} +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5))) /***/ }, /* 226 */ /***/ function(module, exports, __webpack_require__) { - const Action = __webpack_require__(218); - - class GuildEmojiUpdateAction extends Action { - handle(data, guild) { - const client = this.client; - for (let emoji of data.emojis) { - const already = guild.emojis.has(emoji.id); - if (already) { - client.dataManager.updateEmoji(guild.emojis.get(emoji.id), emoji); - } else { - emoji = client.dataManager.newEmoji(emoji, guild); - } - } - for (let emoji of guild.emojis) { - if (!data.emoijs.has(emoji.id)) client.dataManager.killEmoji(emoji); - } - return { - emojis: data.emojis, - }; - } - } - - /** - * Emitted whenever an emoji is updated - * @event Client#guildEmojiUpdate - * @param {Emoji} oldEmoji The old emoji - * @param {Emoji} newEmoji The new emoji - */ - module.exports = GuildEmojiUpdateAction; +module.exports = __webpack_require__(55) /***/ }, /* 227 */ /***/ function(module, exports, __webpack_require__) { - const Action = __webpack_require__(218); +/** + * Module of mixed-in functions shared between node and client code + */ +var isObject = __webpack_require__(115); - class GuildMemberGetAction extends Action { - handle(guild, data) { - const member = guild._addMember(data, false); - return { - member, - }; - } - } +/** + * Expose `RequestBase`. + */ - module.exports = GuildMemberGetAction; +module.exports = RequestBase; + +/** + * Initialize a new `RequestBase`. + * + * @api public + */ + +function RequestBase(obj) { + if (obj) return mixin(obj); +} + +/** + * Mixin the prototype properties. + * + * @param {Object} obj + * @return {Object} + * @api private + */ + +function mixin(obj) { + for (var key in RequestBase.prototype) { + obj[key] = RequestBase.prototype[key]; + } + return obj; +} + +/** + * Clear previous timeout. + * + * @return {Request} for chaining + * @api public + */ + +RequestBase.prototype.clearTimeout = function _clearTimeout(){ + this._timeout = 0; + clearTimeout(this._timer); + return this; +}; + +/** + * Override default response body parser + * + * This function will be called to convert incoming data into request.body + * + * @param {Function} + * @api public + */ + +RequestBase.prototype.parse = function parse(fn){ + this._parser = fn; + return this; +}; + +/** + * Override default request body serializer + * + * This function will be called to convert data set via .send or .attach into payload to send + * + * @param {Function} + * @api public + */ + +RequestBase.prototype.serialize = function serialize(fn){ + this._serializer = fn; + return this; +}; + +/** + * Set timeout to `ms`. + * + * @param {Number} ms + * @return {Request} for chaining + * @api public + */ + +RequestBase.prototype.timeout = function timeout(ms){ + this._timeout = ms; + return this; +}; + +/** + * Promise support + * + * @param {Function} resolve + * @param {Function} reject + * @return {Request} + */ + +RequestBase.prototype.then = function then(resolve, reject) { + if (!this._fullfilledPromise) { + var self = this; + this._fullfilledPromise = new Promise(function(innerResolve, innerReject){ + self.end(function(err, res){ + if (err) innerReject(err); else innerResolve(res); + }); + }); + } + return this._fullfilledPromise.then(resolve, reject); +} + +RequestBase.prototype.catch = function(cb) { + return this.then(undefined, cb); +}; + +/** + * Allow for extension + */ + +RequestBase.prototype.use = function use(fn) { + fn(this); + return this; +} + + +/** + * Get request header `field`. + * Case-insensitive. + * + * @param {String} field + * @return {String} + * @api public + */ + +RequestBase.prototype.get = function(field){ + return this._header[field.toLowerCase()]; +}; + +/** + * Get case-insensitive header `field` value. + * This is a deprecated internal API. Use `.get(field)` instead. + * + * (getHeader is no longer used internally by the superagent code base) + * + * @param {String} field + * @return {String} + * @api private + * @deprecated + */ + +RequestBase.prototype.getHeader = RequestBase.prototype.get; + +/** + * Set header `field` to `val`, or multiple fields with one object. + * Case-insensitive. + * + * Examples: + * + * req.get('/') + * .set('Accept', 'application/json') + * .set('X-API-Key', 'foobar') + * .end(callback); + * + * req.get('/') + * .set({ Accept: 'application/json', 'X-API-Key': 'foobar' }) + * .end(callback); + * + * @param {String|Object} field + * @param {String} val + * @return {Request} for chaining + * @api public + */ + +RequestBase.prototype.set = function(field, val){ + if (isObject(field)) { + for (var key in field) { + this.set(key, field[key]); + } + return this; + } + this._header[field.toLowerCase()] = val; + this.header[field] = val; + return this; +}; + +/** + * Remove header `field`. + * Case-insensitive. + * + * Example: + * + * req.get('/') + * .unset('User-Agent') + * .end(callback); + * + * @param {String} field + */ +RequestBase.prototype.unset = function(field){ + delete this._header[field.toLowerCase()]; + delete this.header[field]; + return this; +}; + +/** + * Write the field `name` and `val`, or multiple fields with one object + * for "multipart/form-data" request bodies. + * + * ``` js + * request.post('/upload') + * .field('foo', 'bar') + * .end(callback); + * + * request.post('/upload') + * .field({ foo: 'bar', baz: 'qux' }) + * .end(callback); + * ``` + * + * @param {String|Object} name + * @param {String|Blob|File|Buffer|fs.ReadStream} val + * @return {Request} for chaining + * @api public + */ +RequestBase.prototype.field = function(name, val) { + + // name should be either a string or an object. + if (null === name || undefined === name) { + throw new Error('.field(name, val) name can not be empty'); + } + + if (isObject(name)) { + for (var key in name) { + this.field(key, name[key]); + } + return this; + } + + // val should be defined now + if (null === val || undefined === val) { + throw new Error('.field(name, val) val can not be empty'); + } + this._getFormData().append(name, val); + return this; +}; + +/** + * Abort the request, and clear potential timeout. + * + * @return {Request} + * @api public + */ +RequestBase.prototype.abort = function(){ + if (this._aborted) { + return this; + } + this._aborted = true; + this.xhr && this.xhr.abort(); // browser + this.req && this.req.abort(); // node + this.clearTimeout(); + this.emit('abort'); + return this; +}; + +/** + * Enable transmission of cookies with x-domain requests. + * + * Note that for this to work the origin must not be + * using "Access-Control-Allow-Origin" with a wildcard, + * and also must set "Access-Control-Allow-Credentials" + * to "true". + * + * @api public + */ + +RequestBase.prototype.withCredentials = function(){ + // This is browser-only functionality. Node side is no-op. + this._withCredentials = true; + return this; +}; + +/** + * Set the max redirects to `n`. Does noting in browser XHR implementation. + * + * @param {Number} n + * @return {Request} for chaining + * @api public + */ + +RequestBase.prototype.redirects = function(n){ + this._maxRedirects = n; + return this; +}; + +/** + * Convert to a plain javascript object (not JSON string) of scalar properties. + * Note as this method is designed to return a useful non-this value, + * it cannot be chained. + * + * @return {Object} describing method, url, and data of this request + * @api public + */ + +RequestBase.prototype.toJSON = function(){ + return { + method: this.method, + url: this.url, + data: this._data, + headers: this._header + }; +}; + + +/** + * Send `data` as the request body, defaulting the `.type()` to "json" when + * an object is given. + * + * Examples: + * + * // manual json + * request.post('/user') + * .type('json') + * .send('{"name":"tj"}') + * .end(callback) + * + * // auto json + * request.post('/user') + * .send({ name: 'tj' }) + * .end(callback) + * + * // manual x-www-form-urlencoded + * request.post('/user') + * .type('form') + * .send('name=tj') + * .end(callback) + * + * // auto x-www-form-urlencoded + * request.post('/user') + * .type('form') + * .send({ name: 'tj' }) + * .end(callback) + * + * // defaults to x-www-form-urlencoded + * request.post('/user') + * .send('name=tobi') + * .send('species=ferret') + * .end(callback) + * + * @param {String|Object} data + * @return {Request} for chaining + * @api public + */ + +RequestBase.prototype.send = function(data){ + var isObj = isObject(data); + var type = this._header['content-type']; + + if (isObj && !this._data) { + if (Array.isArray(data)) { + this._data = []; + } else if (!this._isHost(data)) { + this._data = {}; + } + } else if (data && this._data && this._isHost(this._data)) { + throw Error("Can't merge these send calls"); + } + + // merge + if (isObj && isObject(this._data)) { + for (var key in data) { + this._data[key] = data[key]; + } + } else if ('string' == typeof data) { + // default to x-www-form-urlencoded + if (!type) this.type('form'); + type = this._header['content-type']; + if ('application/x-www-form-urlencoded' == type) { + this._data = this._data + ? this._data + '&' + data + : data; + } else { + this._data = (this._data || '') + data; + } + } else { + this._data = data; + } + + if (!isObj || this._isHost(data)) return this; + + // default to json + if (!type) this.type('json'); + return this; +}; /***/ }, /* 228 */ -/***/ function(module, exports, __webpack_require__) { +/***/ function(module, exports) { - const Action = __webpack_require__(218); - const Constants = __webpack_require__(5); +// The node and browser modules expose versions of this with the +// appropriate constructor function bound as first argument +/** + * Issue a request: + * + * Examples: + * + * request('GET', '/users').end(callback) + * request('/users').end(callback) + * request('/users', callback) + * + * @param {String} method + * @param {String|Function} url or callback + * @return {Request} + * @api public + */ - class GuildMemberRemoveAction extends Action { - constructor(client) { - super(client); - this.deleted = new Map(); - } +function request(RequestConstructor, method, url) { + // callback + if ('function' == typeof url) { + return new RequestConstructor('GET', method).end(url); + } - handle(data) { - const client = this.client; + // url first + if (2 == arguments.length) { + return new RequestConstructor('GET', method); + } - const guild = client.guilds.get(data.guild_id); - if (guild) { - let member = guild.members.get(data.user.id); - if (member) { - guild.memberCount--; - guild._removeMember(member); - this.deleted.set(guild.id + data.user.id, member); - if (client.status === Constants.Status.READY) client.emit(Constants.Events.GUILD_MEMBER_REMOVE, member); - this.scheduleForDeletion(guild.id, data.user.id); - } else { - member = this.deleted.get(guild.id + data.user.id) || null; - } + return new RequestConstructor(method, url); +} - return { - guild, - member, - }; - } - - return { - guild, - member: null, - }; - } - - scheduleForDeletion(guildID, userID) { - this.client.setTimeout(() => this.deleted.delete(guildID + userID), this.client.options.restWsBridgeTimeout); - } - } - - /** - * Emitted whenever a member leaves a guild, or is kicked. - * @event Client#guildMemberRemove - * @param {GuildMember} member The member that has left/been kicked from the guild. - */ - - module.exports = GuildMemberRemoveAction; +module.exports = request; /***/ }, /* 229 */ -/***/ function(module, exports, __webpack_require__) { +/***/ function(module, exports) { - const Action = __webpack_require__(218); - const Constants = __webpack_require__(5); - const Role = __webpack_require__(26); +"use strict"; +'use strict'; - class GuildRoleCreate extends Action { - handle(data) { - const client = this.client; +var has = Object.prototype.hasOwnProperty; - const guild = client.guilds.get(data.guild_id); - if (guild) { - const already = guild.roles.has(data.role.id); - const role = new Role(guild, data.role); - guild.roles.set(role.id, role); - if (!already) client.emit(Constants.Events.GUILD_ROLE_CREATE, role); - return { - role, - }; - } +/** + * An auto incrementing id which we can use to create "unique" Ultron instances + * so we can track the event emitters that are added through the Ultron + * interface. + * + * @type {Number} + * @private + */ +var id = 0; - return { - role: null, - }; - } - } +/** + * Ultron is high-intelligence robot. It gathers intelligence so it can start improving + * upon his rudimentary design. It will learn from your EventEmitting patterns + * and exterminate them. + * + * @constructor + * @param {EventEmitter} ee EventEmitter instance we need to wrap. + * @api public + */ +function Ultron(ee) { + if (!(this instanceof Ultron)) return new Ultron(ee); - /** - * Emitted whenever a role is created. - * @event Client#roleCreate - * @param {Role} role The role that was created. - */ + this.id = id++; + this.ee = ee; +} - module.exports = GuildRoleCreate; +/** + * Register a new EventListener for the given event. + * + * @param {String} event Name of the event. + * @param {Functon} fn Callback function. + * @param {Mixed} context The context of the function. + * @returns {Ultron} + * @api public + */ +Ultron.prototype.on = function on(event, fn, context) { + fn.__ultron = this.id; + this.ee.on(event, fn, context); + + return this; +}; +/** + * Add an EventListener that's only called once. + * + * @param {String} event Name of the event. + * @param {Function} fn Callback function. + * @param {Mixed} context The context of the function. + * @returns {Ultron} + * @api public + */ +Ultron.prototype.once = function once(event, fn, context) { + fn.__ultron = this.id; + this.ee.once(event, fn, context); + + return this; +}; + +/** + * Remove the listeners we assigned for the given event. + * + * @returns {Ultron} + * @api public + */ +Ultron.prototype.remove = function remove() { + var args = arguments + , event; + + // + // When no event names are provided we assume that we need to clear all the + // events that were assigned through us. + // + if (args.length === 1 && 'string' === typeof args[0]) { + args = args[0].split(/[, ]+/); + } else if (!args.length) { + args = []; + + for (event in this.ee._events) { + if (has.call(this.ee._events, event)) args.push(event); + } + } + + for (var i = 0; i < args.length; i++) { + var listeners = this.ee.listeners(args[i]); + + for (var j = 0; j < listeners.length; j++) { + event = listeners[j]; + + // + // Once listeners have a `listener` property that stores the real listener + // in the EventEmitter that ships with Node.js. + // + if (event.listener) { + if (event.listener.__ultron !== this.id) continue; + delete event.listener.__ultron; + } else { + if (event.__ultron !== this.id) continue; + delete event.__ultron; + } + + this.ee.removeListener(args[i], event); + } + } + + return this; +}; + +/** + * Destroy the Ultron instance, remove all listeners and release all references. + * + * @returns {Boolean} + * @api public + */ +Ultron.prototype.destroy = function destroy() { + if (!this.ee) return false; + + this.remove(); + this.ee = null; + + return true; +}; + +// +// Expose the module. +// +module.exports = Ultron; /***/ }, /* 230 */ -/***/ function(module, exports, __webpack_require__) { +/***/ function(module, exports) { - const Action = __webpack_require__(218); - const Constants = __webpack_require__(5); +"use strict"; +'use strict'; - class GuildRoleDeleteAction extends Action { - constructor(client) { - super(client); - this.deleted = new Map(); - } +/*! + * UTF-8 validate: UTF-8 validation for WebSockets. + * Copyright(c) 2015 Einar Otto Stangvik + * MIT Licensed + */ - handle(data) { - const client = this.client; - - const guild = client.guilds.get(data.guild_id); - if (guild) { - let role = guild.roles.get(data.role_id); - if (role) { - guild.roles.delete(data.role_id); - this.deleted.set(guild.id + data.role_id, role); - this.scheduleForDeletion(guild.id, data.role_id); - client.emit(Constants.Events.GUILD_ROLE_DELETE, role); - } else { - role = this.deleted.get(guild.id + data.role_id) || null; - } - - return { - role, - }; - } - - return { - role: null, - }; - } - - scheduleForDeletion(guildID, roleID) { - this.client.setTimeout(() => this.deleted.delete(guildID + roleID), this.client.options.restWsBridgeTimeout); - } - } - - /** - * Emitted whenever a guild role is deleted. - * @event Client#roleDelete - * @param {Role} role The role that was deleted. - */ - - module.exports = GuildRoleDeleteAction; +module.exports.Validation = { + isValidUTF8: function(buffer) { + return true; + } +}; /***/ }, /* 231 */ /***/ function(module, exports, __webpack_require__) { - const Action = __webpack_require__(218); - const Constants = __webpack_require__(5); - const cloneObject = __webpack_require__(46); +"use strict"; +'use strict'; - class GuildRoleUpdateAction extends Action { - handle(data) { - const client = this.client; - - const guild = client.guilds.get(data.guild_id); - if (guild) { - const roleData = data.role; - let oldRole = null; - - const role = guild.roles.get(roleData.id); - if (role) { - oldRole = cloneObject(role); - role.setup(data.role); - client.emit(Constants.Events.GUILD_ROLE_UPDATE, oldRole, role); - } - - return { - old: oldRole, - updated: role, - }; - } - - return { - old: null, - updated: null, - }; - } - } - - /** - * Emitted whenever a guild role is updated. - * @event Client#roleUpdate - * @param {Role} oldRole The role before the update. - * @param {Role} newRole The role after the update. - */ - - module.exports = GuildRoleUpdateAction; +try { + module.exports = __webpack_require__(85)('validation'); +} catch (e) { + module.exports = __webpack_require__(230); +} /***/ }, /* 232 */ /***/ function(module, exports, __webpack_require__) { - const Action = __webpack_require__(218); - - class GuildRolesPositionUpdate extends Action { - handle(data) { - const client = this.client; - - const guild = client.guilds.get(data.guild_id); - if (guild) { - for (const partialRole of data.roles) { - const role = guild.roles.get(partialRole.id); - if (role) { - role.position = partialRole.position; - } - } - } - - return { - guild, - }; - } - } - - module.exports = GuildRolesPositionUpdate; +/* WEBPACK VAR INJECTION */(function(global) { +/** + * Module exports. + */ +module.exports = deprecate; + +/** + * Mark that a method should not be used. + * Returns a modified function which warns once by default. + * + * If `localStorage.noDeprecation = true` is set, then it is a no-op. + * + * If `localStorage.throwDeprecation = true` is set, then deprecated functions + * will throw an Error when invoked. + * + * If `localStorage.traceDeprecation = true` is set, then deprecated functions + * will invoke `console.trace()` instead of `console.error()`. + * + * @param {Function} fn - the function to deprecate + * @param {String} msg - the string to print to the console when `fn` is invoked + * @returns {Function} a new "deprecated" version of `fn` + * @api public + */ + +function deprecate (fn, msg) { + if (config('noDeprecation')) { + return fn; + } + + var warned = false; + function deprecated() { + if (!warned) { + if (config('throwDeprecation')) { + throw new Error(msg); + } else if (config('traceDeprecation')) { + console.trace(msg); + } else { + console.warn(msg); + } + warned = true; + } + return fn.apply(this, arguments); + } + + return deprecated; +} + +/** + * Checks `localStorage` for boolean values for the given `name`. + * + * @param {String} name + * @returns {Boolean} + * @api private + */ + +function config (name) { + // accessing global.localStorage can trigger a DOMException in sandboxed iframes + try { + if (!global.localStorage) return false; + } catch (_) { + return false; + } + var val = global.localStorage[name]; + if (null == val) return false; + return String(val).toLowerCase() === 'true'; +} + +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(16))) /***/ }, /* 233 */ -/***/ function(module, exports, __webpack_require__) { +/***/ function(module, exports) { - const Action = __webpack_require__(218); - - class GuildSync extends Action { - handle(data) { - const client = this.client; - - const guild = client.guilds.get(data.id); - if (guild) { - data.presences = data.presences || []; - for (const presence of data.presences) { - guild._setPresence(presence.user.id, presence); - } - - data.members = data.members || []; - for (const syncMember of data.members) { - const member = guild.members.get(syncMember.user.id); - if (member) { - guild._updateMember(member, syncMember); - } else { - guild._addMember(syncMember); - } - } - } - } - } - - module.exports = GuildSync; +if (typeof Object.create === 'function') { + // implementation from standard node.js 'util' module + module.exports = function inherits(ctor, superCtor) { + ctor.super_ = superCtor + ctor.prototype = Object.create(superCtor.prototype, { + constructor: { + value: ctor, + enumerable: false, + writable: true, + configurable: true + } + }); + }; +} else { + // old school shim for old browsers + module.exports = function inherits(ctor, superCtor) { + ctor.super_ = superCtor + var TempCtor = function () {} + TempCtor.prototype = superCtor.prototype + ctor.prototype = new TempCtor() + ctor.prototype.constructor = ctor + } +} /***/ }, /* 234 */ -/***/ function(module, exports, __webpack_require__) { - - const Action = __webpack_require__(218); - const Constants = __webpack_require__(5); - const cloneObject = __webpack_require__(46); - - class GuildUpdateAction extends Action { - handle(data) { - const client = this.client; - - const guild = client.guilds.get(data.id); - if (guild) { - const oldGuild = cloneObject(guild); - guild.setup(data); - client.emit(Constants.Events.GUILD_UPDATE, oldGuild, guild); - return { - old: oldGuild, - updated: guild, - }; - } - - return { - old: null, - updated: null, - }; - } - } - - /** - * Emitted whenever a guild is updated - e.g. name change. - * @event Client#guildUpdate - * @param {Guild} oldGuild The guild before the update. - * @param {Guild} newGuild The guild after the update. - */ - - module.exports = GuildUpdateAction; +/***/ function(module, exports) { +module.exports = function isBuffer(arg) { + return arg && typeof arg === 'object' + && typeof arg.copy === 'function' + && typeof arg.fill === 'function' + && typeof arg.readUInt8 === 'function'; +} /***/ }, /* 235 */ /***/ function(module, exports, __webpack_require__) { - const Action = __webpack_require__(218); - const Message = __webpack_require__(16); +var indexOf = __webpack_require__(199); - class MessageCreateAction extends Action { - handle(data) { - const client = this.client; +var Object_keys = function (obj) { + if (Object.keys) return Object.keys(obj) + else { + var res = []; + for (var key in obj) res.push(key) + return res; + } +}; - const channel = client.channels.get((data instanceof Array ? data[0] : data).channel_id); - if (channel) { - if (data instanceof Array) { - const messages = new Array(data.length); - for (let i = 0; i < data.length; i++) { - messages[i] = channel._cacheMessage(new Message(channel, data[i], client)); - } - channel.lastMessageID = messages[messages.length - 1].id; - return { - messages, - }; - } else { - const message = channel._cacheMessage(new Message(channel, data, client)); - channel.lastMessageID = data.id; - return { - message, - }; - } - } +var forEach = function (xs, fn) { + if (xs.forEach) return xs.forEach(fn) + else for (var i = 0; i < xs.length; i++) { + fn(xs[i], i, xs); + } +}; - return { - message: null, - }; - } - } +var defineProp = (function() { + try { + Object.defineProperty({}, '_', {}); + return function(obj, name, value) { + Object.defineProperty(obj, name, { + writable: true, + enumerable: false, + configurable: true, + value: value + }) + }; + } catch(e) { + return function(obj, name, value) { + obj[name] = value; + }; + } +}()); - module.exports = MessageCreateAction; +var globals = ['Array', 'Boolean', 'Date', 'Error', 'EvalError', 'Function', +'Infinity', 'JSON', 'Math', 'NaN', 'Number', 'Object', 'RangeError', +'ReferenceError', 'RegExp', 'String', 'SyntaxError', 'TypeError', 'URIError', +'decodeURI', 'decodeURIComponent', 'encodeURI', 'encodeURIComponent', 'escape', +'eval', 'isFinite', 'isNaN', 'parseFloat', 'parseInt', 'undefined', 'unescape']; + +function Context() {} +Context.prototype = {}; + +var Script = exports.Script = function NodeScript (code) { + if (!(this instanceof Script)) return new Script(code); + this.code = code; +}; + +Script.prototype.runInContext = function (context) { + if (!(context instanceof Context)) { + throw new TypeError("needs a 'context' argument."); + } + + var iframe = document.createElement('iframe'); + if (!iframe.style) iframe.style = {}; + iframe.style.display = 'none'; + + document.body.appendChild(iframe); + + var win = iframe.contentWindow; + var wEval = win.eval, wExecScript = win.execScript; + + if (!wEval && wExecScript) { + // win.eval() magically appears when this is called in IE: + wExecScript.call(win, 'null'); + wEval = win.eval; + } + + forEach(Object_keys(context), function (key) { + win[key] = context[key]; + }); + forEach(globals, function (key) { + if (context[key]) { + win[key] = context[key]; + } + }); + + var winKeys = Object_keys(win); + + var res = wEval.call(win, this.code); + + forEach(Object_keys(win), function (key) { + // Avoid copying circular objects like `top` and `window` by only + // updating existing context properties or new properties in the `win` + // that was only introduced after the eval. + if (key in context || indexOf(winKeys, key) === -1) { + context[key] = win[key]; + } + }); + + forEach(globals, function (key) { + if (!(key in context)) { + defineProp(context, key, win[key]); + } + }); + + document.body.removeChild(iframe); + + return res; +}; + +Script.prototype.runInThisContext = function () { + return eval(this.code); // maybe... +}; + +Script.prototype.runInNewContext = function (context) { + var ctx = Script.createContext(context); + var res = this.runInContext(ctx); + + forEach(Object_keys(ctx), function (key) { + context[key] = ctx[key]; + }); + + return res; +}; + +forEach(Object_keys(Script.prototype), function (name) { + exports[name] = Script[name] = function (code) { + var s = Script(code); + return s[name].apply(s, [].slice.call(arguments, 1)); + }; +}); + +exports.createScript = function (code) { + return exports.Script(code); +}; + +exports.createContext = Script.createContext = function (context) { + var copy = new Context(); + if(typeof context === 'object') { + forEach(Object_keys(context), function (key) { + copy[key] = context[key]; + }); + } + return copy; +}; /***/ }, /* 236 */ /***/ function(module, exports, __webpack_require__) { - const Action = __webpack_require__(218); +var http = __webpack_require__(52); - class MessageDeleteAction extends Action { - constructor(client) { - super(client); - this.deleted = new Map(); - } +var https = module.exports; - handle(data) { - const client = this.client; +for (var key in http) { + if (http.hasOwnProperty(key)) https[key] = http[key]; +}; - const channel = client.channels.get(data.channel_id); - if (channel) { - let message = channel.messages.get(data.id); - - if (message) { - channel.messages.delete(message.id); - this.deleted.set(channel.id + message.id, message); - this.scheduleForDeletion(channel.id, message.id); - } else { - message = this.deleted.get(channel.id + data.id) || null; - } - - return { - message, - }; - } - - return { - message: null, - }; - } - - scheduleForDeletion(channelID, messageID) { - this.client.setTimeout(() => this.deleted.delete(channelID + messageID), - this.client.options.restWsBridgeTimeout); - } - } - - module.exports = MessageDeleteAction; +https.request = function (params, cb) { + if (!params) params = {}; + params.scheme = 'https'; + params.protocol = 'https:'; + return http.request.call(this, params, cb); +} /***/ }, /* 237 */ -/***/ function(module, exports, __webpack_require__) { +/***/ function(module, exports) { - const Action = __webpack_require__(218); - const Collection = __webpack_require__(10); - const Constants = __webpack_require__(5); - - class MessageDeleteBulkAction extends Action { - handle(data) { - const client = this.client; - const channel = client.channels.get(data.channel_id); - - const ids = data.ids; - const messages = new Collection(); - for (const id of ids) { - const message = channel.messages.get(id); - if (message) messages.set(message.id, message); - } - - if (messages.size > 0) client.emit(Constants.Events.MESSAGE_BULK_DELETE, messages); - return { - messages, - }; - } - } - - module.exports = MessageDeleteBulkAction; +exports.lookup = exports.resolve4 = +exports.resolve6 = exports.resolveCname = +exports.resolveMx = exports.resolveNs = +exports.resolveTxt = exports.resolveSrv = +exports.resolveNaptr = exports.reverse = +exports.resolve = +function () { + if (!arguments.length) return; + + var callback = arguments[arguments.length - 1]; + if (callback && typeof callback === 'function') { + callback(null, '0.0.0.0') + } +} + /***/ }, /* 238 */ -/***/ function(module, exports, __webpack_require__) { +/***/ function(module, exports) { - const Action = __webpack_require__(218); - const Constants = __webpack_require__(5); - - /* - { user_id: 'id', - message_id: 'id', - emoji: { name: '�', id: null }, - channel_id: 'id' } } - */ - - class MessageReactionAdd extends Action { - handle(data) { - const user = this.client.users.get(data.user_id); - if (!user) return false; - - const channel = this.client.channels.get(data.channel_id); - if (!channel || channel.type === 'voice') return false; - - const message = channel.messages.get(data.message_id); - if (!message) return false; - - if (!data.emoji) return false; - - const reaction = message._addReaction(data.emoji, user); - - if (reaction) { - this.client.emit(Constants.Events.MESSAGE_REACTION_ADD, reaction, user); - } - - return { - message, - reaction, - user, - }; - } - } - /** - * Emitted whenever a reaction is added to a message. - * @event Client#messageReactionAdd - * @param {MessageReaction} messageReaction The reaction object. - * @param {User} user The user that applied the emoji or reaction emoji. - */ - module.exports = MessageReactionAdd; +// todo /***/ }, /* 239 */ -/***/ function(module, exports, __webpack_require__) { +/***/ function(module, exports) { - const Action = __webpack_require__(218); - const Constants = __webpack_require__(5); +"use strict"; +'use strict'; - /* - { user_id: 'id', - message_id: 'id', - emoji: { name: '�', id: null }, - channel_id: 'id' } } - */ - - class MessageReactionRemove extends Action { - handle(data) { - const user = this.client.users.get(data.user_id); - if (!user) return false; - - const channel = this.client.channels.get(data.channel_id); - if (!channel || channel.type === 'voice') return false; - - const message = channel.messages.get(data.message_id); - if (!message) return false; - - if (!data.emoji) return false; - - const reaction = message._removeReaction(data.emoji, user); - - if (reaction) { - this.client.emit(Constants.Events.MESSAGE_REACTION_REMOVE, reaction, user); - } - - return { - message, - reaction, - user, - }; - } - } - /** - * Emitted whenever a reaction is removed from a message. - * @event Client#messageReactionRemove - * @param {MessageReaction} messageReaction The reaction object. - * @param {User} user The user that removed the emoji or reaction emoji. - */ - module.exports = MessageReactionRemove; +module.exports = { + isString: function(arg) { + return typeof(arg) === 'string'; + }, + isObject: function(arg) { + return typeof(arg) === 'object' && arg !== null; + }, + isNull: function(arg) { + return arg === null; + }, + isNullOrUndefined: function(arg) { + return arg == null; + } +}; /***/ }, /* 240 */ /***/ function(module, exports, __webpack_require__) { - const Action = __webpack_require__(218); - const Constants = __webpack_require__(5); +/* WEBPACK VAR INJECTION */(function(Buffer) {/*! + * ws: a node.js websocket client + * Copyright(c) 2011 Einar Otto Stangvik + * MIT Licensed + */ - class MessageReactionRemoveAll extends Action { - handle(data) { - const channel = this.client.channels.get(data.channel_id); - if (!channel || channel.type === 'voice') return false; +var util = __webpack_require__(8); - const message = channel.messages.get(data.message_id); - if (!message) return false; +function BufferPool(initialSize, growStrategy, shrinkStrategy) { + if (this instanceof BufferPool === false) { + throw new TypeError("Classes can't be function-called"); + } - message._clearReactions(); - this.client.emit(Constants.Events.MESSAGE_REACTION_REMOVE_ALL, message); + if (typeof initialSize === 'function') { + shrinkStrategy = growStrategy; + growStrategy = initialSize; + initialSize = 0; + } + else if (typeof initialSize === 'undefined') { + initialSize = 0; + } + this._growStrategy = (growStrategy || function(db, size) { + return db.used + size; + }).bind(null, this); + this._shrinkStrategy = (shrinkStrategy || function(db) { + return initialSize; + }).bind(null, this); + this._buffer = initialSize ? new Buffer(initialSize) : null; + this._offset = 0; + this._used = 0; + this._changeFactor = 0; + this.__defineGetter__('size', function(){ + return this._buffer == null ? 0 : this._buffer.length; + }); + this.__defineGetter__('used', function(){ + return this._used; + }); +} - return { - message, - }; - } - } - /** - * Emitted whenever all reactions are removed from a message. - * @event Client#messageReactionRemoveAll - * @param {MessageReaction} messageReaction The reaction object. - */ - module.exports = MessageReactionRemoveAll; +BufferPool.prototype.get = function(length) { + if (this._buffer == null || this._offset + length > this._buffer.length) { + var newBuf = new Buffer(this._growStrategy(length)); + this._buffer = newBuf; + this._offset = 0; + } + this._used += length; + var buf = this._buffer.slice(this._offset, this._offset + length); + this._offset += length; + return buf; +} +BufferPool.prototype.reset = function(forceNewBuffer) { + var len = this._shrinkStrategy(); + if (len < this.size) this._changeFactor -= 1; + if (forceNewBuffer || this._changeFactor < -2) { + this._changeFactor = 0; + this._buffer = len ? new Buffer(len) : null; + } + this._offset = 0; + this._used = 0; +} + +module.exports = BufferPool; + +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer)) /***/ }, /* 241 */ -/***/ function(module, exports, __webpack_require__) { +/***/ function(module, exports) { - const Action = __webpack_require__(218); - const Constants = __webpack_require__(5); - const cloneObject = __webpack_require__(46); +/*! + * ws: a node.js websocket client + * Copyright(c) 2011 Einar Otto Stangvik + * MIT Licensed + */ - class MessageUpdateAction extends Action { - handle(data) { - const client = this.client; - - const channel = client.channels.get(data.channel_id); - if (channel) { - const message = channel.messages.get(data.id); - if (message) { - const oldMessage = cloneObject(message); - message.patch(data); - message._edits.unshift(oldMessage); - client.emit(Constants.Events.MESSAGE_UPDATE, oldMessage, message); - return { - old: oldMessage, - updated: message, - }; - } - - return { - old: message, - updated: message, - }; - } - - return { - old: null, - updated: null, - }; - } - } - - /** - * Emitted whenever a message is updated - e.g. embed or content change. - * @event Client#messageUpdate - * @param {Message} oldMessage The message before the update. - * @param {Message} newMessage The message after the update. - */ - - module.exports = MessageUpdateAction; +exports.BufferUtil = { + merge: function(mergedBuffer, buffers) { + var offset = 0; + for (var i = 0, l = buffers.length; i < l; ++i) { + var buf = buffers[i]; + buf.copy(mergedBuffer, offset); + offset += buf.length; + } + }, + mask: function(source, mask, output, offset, length) { + var maskNum = mask.readUInt32LE(0, true); + var i = 0; + for (; i < length - 3; i += 4) { + var num = maskNum ^ source.readUInt32LE(i, true); + if (num < 0) num = 4294967296 + num; + output.writeUInt32LE(num, offset + i, true); + } + switch (length % 4) { + case 3: output[offset + i + 2] = source[i + 2] ^ mask[2]; + case 2: output[offset + i + 1] = source[i + 1] ^ mask[1]; + case 1: output[offset + i] = source[i] ^ mask[0]; + case 0:; + } + }, + unmask: function(data, mask) { + var maskNum = mask.readUInt32LE(0, true); + var length = data.length; + var i = 0; + for (; i < length - 3; i += 4) { + var num = maskNum ^ data.readUInt32LE(i, true); + if (num < 0) num = 4294967296 + num; + data.writeUInt32LE(num, i, true); + } + switch (length % 4) { + case 3: data[i + 2] = data[i + 2] ^ mask[2]; + case 2: data[i + 1] = data[i + 1] ^ mask[1]; + case 1: data[i] = data[i] ^ mask[0]; + case 0:; + } + } +} /***/ }, /* 242 */ /***/ function(module, exports, __webpack_require__) { - const Action = __webpack_require__(218); +/* WEBPACK VAR INJECTION */(function(Buffer) {/*! + * ws: a node.js websocket client + * Copyright(c) 2011 Einar Otto Stangvik + * MIT Licensed + */ - class UserGetAction extends Action { - handle(data) { - const client = this.client; - const user = client.dataManager.newUser(data); - return { - user, - }; - } - } +var util = __webpack_require__(8); - module.exports = UserGetAction; +/** + * State constants + */ +var EMPTY = 0 + , BODY = 1; +var BINARYLENGTH = 2 + , BINARYBODY = 3; + +/** + * Hixie Receiver implementation + */ + +function Receiver () { + if (this instanceof Receiver === false) { + throw new TypeError("Classes can't be function-called"); + } + + this.state = EMPTY; + this.buffers = []; + this.messageEnd = -1; + this.spanLength = 0; + this.dead = false; + + this.onerror = function() {}; + this.ontext = function() {}; + this.onbinary = function() {}; + this.onclose = function() {}; + this.onping = function() {}; + this.onpong = function() {}; +} + +module.exports = Receiver; + +/** + * Add new data to the parser. + * + * @api public + */ + +Receiver.prototype.add = function(data) { + if (this.dead) return; + var self = this; + function doAdd() { + if (self.state === EMPTY) { + if (data.length == 2 && data[0] == 0xFF && data[1] == 0x00) { + self.reset(); + self.onclose(); + return; + } + if (data[0] === 0x80) { + self.messageEnd = 0; + self.state = BINARYLENGTH; + data = data.slice(1); + } else { + + if (data[0] !== 0x00) { + self.error('payload must start with 0x00 byte', true); + return; + } + data = data.slice(1); + self.state = BODY; + + } + } + if (self.state === BINARYLENGTH) { + var i = 0; + while ((i < data.length) && (data[i] & 0x80)) { + self.messageEnd = 128 * self.messageEnd + (data[i] & 0x7f); + ++i; + } + if (i < data.length) { + self.messageEnd = 128 * self.messageEnd + (data[i] & 0x7f); + self.state = BINARYBODY; + ++i; + } + if (i > 0) + data = data.slice(i); + } + if (self.state === BINARYBODY) { + var dataleft = self.messageEnd - self.spanLength; + if (data.length >= dataleft) { + // consume the whole buffer to finish the frame + self.buffers.push(data); + self.spanLength += dataleft; + self.messageEnd = dataleft; + return self.parse(); + } + // frame's not done even if we consume it all + self.buffers.push(data); + self.spanLength += data.length; + return; + } + self.buffers.push(data); + if ((self.messageEnd = bufferIndex(data, 0xFF)) != -1) { + self.spanLength += self.messageEnd; + return self.parse(); + } + else self.spanLength += data.length; + } + while(data) data = doAdd(); +}; + +/** + * Releases all resources used by the receiver. + * + * @api public + */ + +Receiver.prototype.cleanup = function() { + this.dead = true; + this.state = EMPTY; + this.buffers = []; +}; + +/** + * Process buffered data. + * + * @api public + */ + +Receiver.prototype.parse = function() { + var output = new Buffer(this.spanLength); + var outputIndex = 0; + for (var bi = 0, bl = this.buffers.length; bi < bl - 1; ++bi) { + var buffer = this.buffers[bi]; + buffer.copy(output, outputIndex); + outputIndex += buffer.length; + } + var lastBuffer = this.buffers[this.buffers.length - 1]; + if (this.messageEnd > 0) lastBuffer.copy(output, outputIndex, 0, this.messageEnd); + if (this.state !== BODY) --this.messageEnd; + var tail = null; + if (this.messageEnd < lastBuffer.length - 1) { + tail = lastBuffer.slice(this.messageEnd + 1); + } + this.reset(); + this.ontext(output.toString('utf8')); + return tail; +}; + +/** + * Handles an error + * + * @api private + */ + +Receiver.prototype.error = function (reason, terminate) { + if (this.dead) return; + this.reset(); + if(typeof reason == 'string'){ + this.onerror(new Error(reason), terminate); + } + else if(reason.constructor == Error){ + this.onerror(reason, terminate); + } + else{ + this.onerror(new Error("An error occured"),terminate); + } + return this; +}; + +/** + * Reset parser state + * + * @api private + */ + +Receiver.prototype.reset = function (reason) { + if (this.dead) return; + this.state = EMPTY; + this.buffers = []; + this.messageEnd = -1; + this.spanLength = 0; +}; + +/** + * Internal api + */ + +function bufferIndex(buffer, byte) { + for (var i = 0, l = buffer.length; i < l; ++i) { + if (buffer[i] === byte) return i; + } + return -1; +} + +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer)) /***/ }, /* 243 */ /***/ function(module, exports, __webpack_require__) { - const Action = __webpack_require__(218); - const Constants = __webpack_require__(5); +/* WEBPACK VAR INJECTION */(function(Buffer) {/*! + * ws: a node.js websocket client + * Copyright(c) 2011 Einar Otto Stangvik + * MIT Licensed + */ - class UserNoteUpdateAction extends Action { - handle(data) { - const client = this.client; +var events = __webpack_require__(3) + , util = __webpack_require__(8) + , EventEmitter = events.EventEmitter; - const oldNote = client.user.notes.get(data.id); - const note = data.note.length ? data.note : null; +/** + * Hixie Sender implementation + */ - client.user.notes.set(data.id, note); +function Sender(socket) { + if (this instanceof Sender === false) { + throw new TypeError("Classes can't be function-called"); + } - client.emit(Constants.Events.USER_NOTE_UPDATE, data.id, oldNote, note); + events.EventEmitter.call(this); - return { - old: oldNote, - updated: note, - }; - } - } + this.socket = socket; + this.continuationFrame = false; + this.isClosed = false; +} - /** - * Emitted whenever a note is updated. - * @event Client#userNoteUpdate - * @param {User} user The user the note belongs to - * @param {string} oldNote The note content before the update - * @param {string} newNote The note content after the update - */ +module.exports = Sender; - module.exports = UserNoteUpdateAction; +/** + * Inherits from EventEmitter. + */ +util.inherits(Sender, events.EventEmitter); + +/** + * Frames and writes data. + * + * @api public + */ + +Sender.prototype.send = function(data, options, cb) { + if (this.isClosed) return; + + var isString = typeof data == 'string' + , length = isString ? Buffer.byteLength(data) : data.length + , lengthbytes = (length > 127) ? 2 : 1 // assume less than 2**14 bytes + , writeStartMarker = this.continuationFrame == false + , writeEndMarker = !options || !(typeof options.fin != 'undefined' && !options.fin) + , buffer = new Buffer((writeStartMarker ? ((options && options.binary) ? (1 + lengthbytes) : 1) : 0) + length + ((writeEndMarker && !(options && options.binary)) ? 1 : 0)) + , offset = writeStartMarker ? 1 : 0; + + if (writeStartMarker) { + if (options && options.binary) { + buffer.write('\x80', 'binary'); + // assume length less than 2**14 bytes + if (lengthbytes > 1) + buffer.write(String.fromCharCode(128+length/128), offset++, 'binary'); + buffer.write(String.fromCharCode(length&0x7f), offset++, 'binary'); + } else + buffer.write('\x00', 'binary'); + } + + if (isString) buffer.write(data, offset, 'utf8'); + else data.copy(buffer, offset, 0); + + if (writeEndMarker) { + if (options && options.binary) { + // sending binary, not writing end marker + } else + buffer.write('\xff', offset + length, 'binary'); + this.continuationFrame = false; + } + else this.continuationFrame = true; + + try { + this.socket.write(buffer, 'binary', cb); + } catch (e) { + this.error(e.toString()); + } +}; + +/** + * Sends a close instruction to the remote party. + * + * @api public + */ + +Sender.prototype.close = function(code, data, mask, cb) { + if (this.isClosed) return; + this.isClosed = true; + try { + if (this.continuationFrame) this.socket.write(new Buffer([0xff], 'binary')); + this.socket.write(new Buffer([0xff, 0x00]), 'binary', cb); + } catch (e) { + this.error(e.toString()); + } +}; + +/** + * Sends a ping message to the remote party. Not available for hixie. + * + * @api public + */ + +Sender.prototype.ping = function(data, options) {}; + +/** + * Sends a pong message to the remote party. Not available for hixie. + * + * @api public + */ + +Sender.prototype.pong = function(data, options) {}; + +/** + * Handles an error + * + * @api private + */ + +Sender.prototype.error = function (reason) { + this.emit('error', reason); + return this; +}; + +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer)) /***/ }, /* 244 */ -/***/ function(module, exports, __webpack_require__) { +/***/ function(module, exports) { - const Action = __webpack_require__(218); - const Constants = __webpack_require__(5); - const cloneObject = __webpack_require__(46); +/*! + * ws: a node.js websocket client + * Copyright(c) 2011 Einar Otto Stangvik + * MIT Licensed + */ - class UserUpdateAction extends Action { - handle(data) { - const client = this.client; - - if (client.user) { - if (client.user.equals(data)) { - return { - old: client.user, - updated: client.user, - }; - } - - const oldUser = cloneObject(client.user); - client.user.patch(data); - client.emit(Constants.Events.USER_UPDATE, oldUser, client.user); - return { - old: oldUser, - updated: client.user, - }; - } - - return { - old: null, - updated: null, - }; - } - } - - module.exports = UserUpdateAction; +exports.Validation = { + isValidUTF8: function(buffer) { + return true; + } +}; /***/ }, /* 245 */ /***/ function(module, exports, __webpack_require__) { - /* WEBPACK VAR INJECTION */(function(process) {const makeError = __webpack_require__(246); - const makePlainError = __webpack_require__(247); +"use strict"; +'use strict'; - /** - * Helper class for sharded clients spawned as a child process, such as from a ShardingManager - */ - class ShardClientUtil { - /** - * @param {Client} client Client of the current shard - */ - constructor(client) { - this.client = client; - process.on('message', this._handleMessage.bind(this)); - } +/*! + * ws: a node.js websocket client + * Copyright(c) 2011 Einar Otto Stangvik + * MIT Licensed + */ - /** - * ID of this shard - * @type {number} - * @readonly - */ - get id() { - return this.client.options.shardId; - } +try { + module.exports = __webpack_require__(231); +} catch (e) { + module.exports = __webpack_require__(244); +} - /** - * Total number of shards - * @type {number} - * @readonly - */ - get count() { - return this.client.options.shardCount; - } - - /** - * Sends a message to the master process - * @param {*} message Message to send - * @returns {Promise} - */ - send(message) { - return new Promise((resolve, reject) => { - const sent = process.send(message, err => { - if (err) reject(err); else resolve(); - }); - if (!sent) throw new Error('Failed to send message to master process.'); - }); - } - - /** - * Fetches a Client property value of each shard. - * @param {string} prop Name of the Client property to get, using periods for nesting - * @returns {Promise} - * @example - * client.shard.fetchClientValues('guilds.size').then(results => { - * console.log(`${results.reduce((prev, val) => prev + val, 0)} total guilds`); - * }).catch(console.error); - */ - fetchClientValues(prop) { - return new Promise((resolve, reject) => { - const listener = message => { - if (!message || message._sFetchProp !== prop) return; - process.removeListener('message', listener); - if (!message._error) resolve(message._result); else reject(makeError(message._error)); - }; - process.on('message', listener); - - this.send({ _sFetchProp: prop }).catch(err => { - process.removeListener('message', listener); - reject(err); - }); - }); - } - - /** - * Evaluates a script on all shards, in the context of the Clients. - * @param {string} script JavaScript to run on each shard - * @returns {Promise} Results of the script execution - */ - broadcastEval(script) { - return new Promise((resolve, reject) => { - const listener = message => { - if (!message || message._sEval !== script) return; - process.removeListener('message', listener); - if (!message._error) resolve(message._result); else reject(makeError(message._error)); - }; - process.on('message', listener); - - this.send({ _sEval: script }).catch(err => { - process.removeListener('message', listener); - reject(err); - }); - }); - } - - /** - * Handles an IPC message - * @param {*} message Message received - * @private - */ - _handleMessage(message) { - if (!message) return; - if (message._fetchProp) { - const props = message._fetchProp.split('.'); - let value = this.client; - for (const prop of props) value = value[prop]; - this._respond('fetchProp', { _fetchProp: message._fetchProp, _result: value }); - } else if (message._eval) { - try { - this._respond('eval', { _eval: message._eval, _result: this.client._eval(message._eval) }); - } catch (err) { - this._respond('eval', { _eval: message._eval, _error: makePlainError(err) }); - } - } - } - - /** - * Sends a message to the master process, emitting an error from the client upon failure - * @param {string} type Type of response to send - * @param {*} message Message to send - * @private - */ - _respond(type, message) { - this.send(message).catch(err => - this.client.emit('error', `Error when sending ${type} response to master process: ${err}`) - ); - } - - /** - * Creates/gets the singleton of this class - * @param {Client} client Client to use - * @returns {ShardClientUtil} - */ - static singleton(client) { - if (!this._singleton) { - this._singleton = new this(client); - } else { - client.emit('error', 'Multiple clients created in child process; only the first will handle sharding helpers.'); - } - return this._singleton; - } - } - - module.exports = ShardClientUtil; - - /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2))) /***/ }, /* 246 */ -/***/ function(module, exports) { +/***/ function(module, exports, __webpack_require__) { - module.exports = function makeError(obj) { - const err = new Error(obj.message); - err.name = obj.name; - err.stack = obj.stack; - return err; - }; +/* WEBPACK VAR INJECTION */(function(Buffer) {/*! + * ws: a node.js websocket client + * Copyright(c) 2011 Einar Otto Stangvik + * MIT Licensed + */ +var util = __webpack_require__(8) + , events = __webpack_require__(3) + , http = __webpack_require__(52) + , crypto = __webpack_require__(118) + , Options = __webpack_require__(104) + , WebSocket = __webpack_require__(125) + , Extensions = __webpack_require__(122) + , PerMessageDeflate = __webpack_require__(40) + , tls = __webpack_require__(238) + , url = __webpack_require__(59); + +/** + * WebSocket Server implementation + */ + +function WebSocketServer(options, callback) { + if (this instanceof WebSocketServer === false) { + return new WebSocketServer(options, callback); + } + + events.EventEmitter.call(this); + + options = new Options({ + host: '0.0.0.0', + port: null, + server: null, + verifyClient: null, + handleProtocols: null, + path: null, + noServer: false, + disableHixie: false, + clientTracking: true, + perMessageDeflate: true, + maxPayload: 100 * 1024 * 1024 + }).merge(options); + + if (!options.isDefinedAndNonNull('port') && !options.isDefinedAndNonNull('server') && !options.value.noServer) { + throw new TypeError('`port` or a `server` must be provided'); + } + + var self = this; + + if (options.isDefinedAndNonNull('port')) { + this._server = http.createServer(function (req, res) { + var body = http.STATUS_CODES[426]; + res.writeHead(426, { + 'Content-Length': body.length, + 'Content-Type': 'text/plain' + }); + res.end(body); + }); + this._server.allowHalfOpen = false; + this._server.listen(options.value.port, options.value.host, callback); + this._closeServer = function() { if (self._server) self._server.close(); }; + } + else if (options.value.server) { + this._server = options.value.server; + if (options.value.path) { + // take note of the path, to avoid collisions when multiple websocket servers are + // listening on the same http server + if (this._server._webSocketPaths && options.value.server._webSocketPaths[options.value.path]) { + throw new Error('two instances of WebSocketServer cannot listen on the same http server path'); + } + if (typeof this._server._webSocketPaths !== 'object') { + this._server._webSocketPaths = {}; + } + this._server._webSocketPaths[options.value.path] = 1; + } + } + if (this._server) { + this._onceServerListening = function() { self.emit('listening'); }; + this._server.once('listening', this._onceServerListening); + } + + if (typeof this._server != 'undefined') { + this._onServerError = function(error) { self.emit('error', error) }; + this._server.on('error', this._onServerError); + this._onServerUpgrade = function(req, socket, upgradeHead) { + //copy upgradeHead to avoid retention of large slab buffers used in node core + var head = new Buffer(upgradeHead.length); + upgradeHead.copy(head); + + self.handleUpgrade(req, socket, head, function(client) { + self.emit('connection'+req.url, client); + self.emit('connection', client); + }); + }; + this._server.on('upgrade', this._onServerUpgrade); + } + + this.options = options.value; + this.path = options.value.path; + this.clients = []; +} + +/** + * Inherits from EventEmitter. + */ + +util.inherits(WebSocketServer, events.EventEmitter); + +/** + * Immediately shuts down the connection. + * + * @api public + */ + +WebSocketServer.prototype.close = function(callback) { + // terminate all associated clients + var error = null; + try { + for (var i = 0, l = this.clients.length; i < l; ++i) { + this.clients[i].terminate(); + } + } + catch (e) { + error = e; + } + + // remove path descriptor, if any + if (this.path && this._server._webSocketPaths) { + delete this._server._webSocketPaths[this.path]; + if (Object.keys(this._server._webSocketPaths).length == 0) { + delete this._server._webSocketPaths; + } + } + + // close the http server if it was internally created + try { + if (typeof this._closeServer !== 'undefined') { + this._closeServer(); + } + } + finally { + if (this._server) { + this._server.removeListener('listening', this._onceServerListening); + this._server.removeListener('error', this._onServerError); + this._server.removeListener('upgrade', this._onServerUpgrade); + } + delete this._server; + } + if(callback) + callback(error); + else if(error) + throw error; +} + +/** + * Handle a HTTP Upgrade request. + * + * @api public + */ + +WebSocketServer.prototype.handleUpgrade = function(req, socket, upgradeHead, cb) { + // check for wrong path + if (this.options.path) { + var u = url.parse(req.url); + if (u && u.pathname !== this.options.path) return; + } + + if (typeof req.headers.upgrade === 'undefined' || req.headers.upgrade.toLowerCase() !== 'websocket') { + abortConnection(socket, 400, 'Bad Request'); + return; + } + + if (req.headers['sec-websocket-key1']) handleHixieUpgrade.apply(this, arguments); + else handleHybiUpgrade.apply(this, arguments); +} + +module.exports = WebSocketServer; + +/** + * Entirely private apis, + * which may or may not be bound to a sepcific WebSocket instance. + */ + +function handleHybiUpgrade(req, socket, upgradeHead, cb) { + // handle premature socket errors + var errorHandler = function() { + try { socket.destroy(); } catch (e) {} + } + socket.on('error', errorHandler); + + // verify key presence + if (!req.headers['sec-websocket-key']) { + abortConnection(socket, 400, 'Bad Request'); + return; + } + + // verify version + var version = parseInt(req.headers['sec-websocket-version']); + if ([8, 13].indexOf(version) === -1) { + abortConnection(socket, 400, 'Bad Request'); + return; + } + + // verify protocol + var protocols = req.headers['sec-websocket-protocol']; + + // verify client + var origin = version < 13 ? + req.headers['sec-websocket-origin'] : + req.headers['origin']; + + // handle extensions offer + var extensionsOffer = Extensions.parse(req.headers['sec-websocket-extensions']); + + // handler to call when the connection sequence completes + var self = this; + var completeHybiUpgrade2 = function(protocol) { + + // calc key + var key = req.headers['sec-websocket-key']; + var shasum = crypto.createHash('sha1'); + shasum.update(key + "258EAFA5-E914-47DA-95CA-C5AB0DC85B11"); + key = shasum.digest('base64'); + + var headers = [ + 'HTTP/1.1 101 Switching Protocols' + , 'Upgrade: websocket' + , 'Connection: Upgrade' + , 'Sec-WebSocket-Accept: ' + key + ]; + + if (typeof protocol != 'undefined') { + headers.push('Sec-WebSocket-Protocol: ' + protocol); + } + + var extensions = {}; + try { + extensions = acceptExtensions.call(self, extensionsOffer); + } catch (err) { + abortConnection(socket, 400, 'Bad Request'); + return; + } + + if (Object.keys(extensions).length) { + var serverExtensions = {}; + Object.keys(extensions).forEach(function(token) { + serverExtensions[token] = [extensions[token].params] + }); + headers.push('Sec-WebSocket-Extensions: ' + Extensions.format(serverExtensions)); + } + + // allows external modification/inspection of handshake headers + self.emit('headers', headers); + + socket.setTimeout(0); + socket.setNoDelay(true); + try { + socket.write(headers.concat('', '').join('\r\n')); + } + catch (e) { + // if the upgrade write fails, shut the connection down hard + try { socket.destroy(); } catch (e) {} + return; + } + + var client = new WebSocket([req, socket, upgradeHead], { + protocolVersion: version, + protocol: protocol, + extensions: extensions, + maxPayload: self.options.maxPayload + }); + + if (self.options.clientTracking) { + self.clients.push(client); + client.on('close', function() { + var index = self.clients.indexOf(client); + if (index != -1) { + self.clients.splice(index, 1); + } + }); + } + + // signal upgrade complete + socket.removeListener('error', errorHandler); + cb(client); + } + + // optionally call external protocol selection handler before + // calling completeHybiUpgrade2 + var completeHybiUpgrade1 = function() { + // choose from the sub-protocols + if (typeof self.options.handleProtocols == 'function') { + var protList = (protocols || "").split(/, */); + var callbackCalled = false; + var res = self.options.handleProtocols(protList, function(result, protocol) { + callbackCalled = true; + if (!result) abortConnection(socket, 401, 'Unauthorized'); + else completeHybiUpgrade2(protocol); + }); + if (!callbackCalled) { + // the handleProtocols handler never called our callback + abortConnection(socket, 501, 'Could not process protocols'); + } + return; + } else { + if (typeof protocols !== 'undefined') { + completeHybiUpgrade2(protocols.split(/, */)[0]); + } + else { + completeHybiUpgrade2(); + } + } + } + + // optionally call external client verification handler + if (typeof this.options.verifyClient == 'function') { + var info = { + origin: origin, + secure: typeof req.connection.authorized !== 'undefined' || typeof req.connection.encrypted !== 'undefined', + req: req + }; + if (this.options.verifyClient.length == 2) { + this.options.verifyClient(info, function(result, code, name) { + if (typeof code === 'undefined') code = 401; + if (typeof name === 'undefined') name = http.STATUS_CODES[code]; + + if (!result) abortConnection(socket, code, name); + else completeHybiUpgrade1(); + }); + return; + } + else if (!this.options.verifyClient(info)) { + abortConnection(socket, 401, 'Unauthorized'); + return; + } + } + + completeHybiUpgrade1(); +} + +function handleHixieUpgrade(req, socket, upgradeHead, cb) { + // handle premature socket errors + var errorHandler = function() { + try { socket.destroy(); } catch (e) {} + } + socket.on('error', errorHandler); + + // bail if options prevent hixie + if (this.options.disableHixie) { + abortConnection(socket, 401, 'Hixie support disabled'); + return; + } + + // verify key presence + if (!req.headers['sec-websocket-key2']) { + abortConnection(socket, 400, 'Bad Request'); + return; + } + + var origin = req.headers['origin'] + , self = this; + + // setup handshake completion to run after client has been verified + var onClientVerified = function() { + var wshost; + if (!req.headers['x-forwarded-host']) + wshost = req.headers.host; + else + wshost = req.headers['x-forwarded-host']; + var location = ((req.headers['x-forwarded-proto'] === 'https' || socket.encrypted) ? 'wss' : 'ws') + '://' + wshost + req.url + , protocol = req.headers['sec-websocket-protocol']; + + // build the response header and return a Buffer + var buildResponseHeader = function() { + var headers = [ + 'HTTP/1.1 101 Switching Protocols' + , 'Upgrade: WebSocket' + , 'Connection: Upgrade' + , 'Sec-WebSocket-Location: ' + location + ]; + if (typeof protocol != 'undefined') headers.push('Sec-WebSocket-Protocol: ' + protocol); + if (typeof origin != 'undefined') headers.push('Sec-WebSocket-Origin: ' + origin); + + return new Buffer(headers.concat('', '').join('\r\n')); + }; + + // send handshake response before receiving the nonce + var handshakeResponse = function() { + + socket.setTimeout(0); + socket.setNoDelay(true); + + var headerBuffer = buildResponseHeader(); + + try { + socket.write(headerBuffer, 'binary', function(err) { + // remove listener if there was an error + if (err) socket.removeListener('data', handler); + return; + }); + } catch (e) { + try { socket.destroy(); } catch (e) {} + return; + }; + }; + + // handshake completion code to run once nonce has been successfully retrieved + var completeHandshake = function(nonce, rest, headerBuffer) { + // calculate key + var k1 = req.headers['sec-websocket-key1'] + , k2 = req.headers['sec-websocket-key2'] + , md5 = crypto.createHash('md5'); + + [k1, k2].forEach(function (k) { + var n = parseInt(k.replace(/[^\d]/g, '')) + , spaces = k.replace(/[^ ]/g, '').length; + if (spaces === 0 || n % spaces !== 0){ + abortConnection(socket, 400, 'Bad Request'); + return; + } + n /= spaces; + md5.update(String.fromCharCode( + n >> 24 & 0xFF, + n >> 16 & 0xFF, + n >> 8 & 0xFF, + n & 0xFF)); + }); + md5.update(nonce.toString('binary')); + + socket.setTimeout(0); + socket.setNoDelay(true); + + try { + var hashBuffer = new Buffer(md5.digest('binary'), 'binary'); + var handshakeBuffer = new Buffer(headerBuffer.length + hashBuffer.length); + headerBuffer.copy(handshakeBuffer, 0); + hashBuffer.copy(handshakeBuffer, headerBuffer.length); + + // do a single write, which - upon success - causes a new client websocket to be setup + socket.write(handshakeBuffer, 'binary', function(err) { + if (err) return; // do not create client if an error happens + var client = new WebSocket([req, socket, rest], { + protocolVersion: 'hixie-76', + protocol: protocol + }); + if (self.options.clientTracking) { + self.clients.push(client); + client.on('close', function() { + var index = self.clients.indexOf(client); + if (index != -1) { + self.clients.splice(index, 1); + } + }); + } + + // signal upgrade complete + socket.removeListener('error', errorHandler); + cb(client); + }); + } + catch (e) { + try { socket.destroy(); } catch (e) {} + return; + } + } + + // retrieve nonce + var nonceLength = 8; + if (upgradeHead && upgradeHead.length >= nonceLength) { + var nonce = upgradeHead.slice(0, nonceLength); + var rest = upgradeHead.length > nonceLength ? upgradeHead.slice(nonceLength) : null; + completeHandshake.call(self, nonce, rest, buildResponseHeader()); + } + else { + // nonce not present in upgradeHead + var nonce = new Buffer(nonceLength); + upgradeHead.copy(nonce, 0); + var received = upgradeHead.length; + var rest = null; + var handler = function (data) { + var toRead = Math.min(data.length, nonceLength - received); + if (toRead === 0) return; + data.copy(nonce, received, 0, toRead); + received += toRead; + if (received == nonceLength) { + socket.removeListener('data', handler); + if (toRead < data.length) rest = data.slice(toRead); + + // complete the handshake but send empty buffer for headers since they have already been sent + completeHandshake.call(self, nonce, rest, new Buffer(0)); + } + } + + // handle additional data as we receive it + socket.on('data', handler); + + // send header response before we have the nonce to fix haproxy buffering + handshakeResponse(); + } + } + + // verify client + if (typeof this.options.verifyClient == 'function') { + var info = { + origin: origin, + secure: typeof req.connection.authorized !== 'undefined' || typeof req.connection.encrypted !== 'undefined', + req: req + }; + if (this.options.verifyClient.length == 2) { + var self = this; + this.options.verifyClient(info, function(result, code, name) { + if (typeof code === 'undefined') code = 401; + if (typeof name === 'undefined') name = http.STATUS_CODES[code]; + + if (!result) abortConnection(socket, code, name); + else onClientVerified.apply(self); + }); + return; + } + else if (!this.options.verifyClient(info)) { + abortConnection(socket, 401, 'Unauthorized'); + return; + } + } + + // no client verification required + onClientVerified(); +} + +function acceptExtensions(offer) { + var extensions = {}; + var options = this.options.perMessageDeflate; + var maxPayload = this.options.maxPayload; + if (options && offer[PerMessageDeflate.extensionName]) { + var perMessageDeflate = new PerMessageDeflate(options !== true ? options : {}, true, maxPayload); + perMessageDeflate.accept(offer[PerMessageDeflate.extensionName]); + extensions[PerMessageDeflate.extensionName] = perMessageDeflate; + } + return extensions; +} + +function abortConnection(socket, code, name) { + try { + var response = [ + 'HTTP/1.1 ' + code + ' ' + name, + 'Content-type: text/html' + ]; + socket.write(response.concat('', '').join('\r\n')); + } + catch (e) { /* ignore errors - we've aborted this connection */ } + finally { + // ensure that an early aborted connection is shut down completely + try { socket.destroy(); } catch (e) {} + } +} + +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer)) /***/ }, /* 247 */ -/***/ function(module, exports) { +/***/ function(module, exports, __webpack_require__) { - module.exports = function makePlainError(err) { - const obj = {}; - obj.name = err.name; - obj.message = err.message; - obj.stack = err.stack; - return obj; - }; +/* WEBPACK VAR INJECTION */(function(process, Buffer) {/** @license zlib.js 2012 - imaya [ https://github.com/imaya/zlib.js ] The MIT License */(function() {'use strict';function q(b){throw b;}var t=void 0,v=!0;var A="undefined"!==typeof Uint8Array&&"undefined"!==typeof Uint16Array&&"undefined"!==typeof Uint32Array&&"undefined"!==typeof DataView;function E(b,a){this.index="number"===typeof a?a:0;this.m=0;this.buffer=b instanceof(A?Uint8Array:Array)?b:new (A?Uint8Array:Array)(32768);2*this.buffer.length<=this.index&&q(Error("invalid index"));this.buffer.length<=this.index&&this.f()}E.prototype.f=function(){var b=this.buffer,a,c=b.length,d=new (A?Uint8Array:Array)(c<<1);if(A)d.set(b);else for(a=0;a>>8&255]<<16|G[b>>>16&255]<<8|G[b>>>24&255])>>32-a:G[b]>>8-a);if(8>a+f)g=g<>a-k-1&1,8===++f&&(f=0,d[e++]=G[g],g=0,e===d.length&&(d=this.f()));d[e]=g;this.buffer=d;this.m=f;this.index=e};E.prototype.finish=function(){var b=this.buffer,a=this.index,c;0J;++J){for(var N=J,Q=N,ba=7,N=N>>>1;N;N>>>=1)Q<<=1,Q|=N&1,--ba;aa[J]=(Q<>>0}var G=aa;function R(b,a,c){var d,e="number"===typeof a?a:a=0,f="number"===typeof c?c:b.length;d=-1;for(e=f&7;e--;++a)d=d>>>8^S[(d^b[a])&255];for(e=f>>3;e--;a+=8)d=d>>>8^S[(d^b[a])&255],d=d>>>8^S[(d^b[a+1])&255],d=d>>>8^S[(d^b[a+2])&255],d=d>>>8^S[(d^b[a+3])&255],d=d>>>8^S[(d^b[a+4])&255],d=d>>>8^S[(d^b[a+5])&255],d=d>>>8^S[(d^b[a+6])&255],d=d>>>8^S[(d^b[a+7])&255];return(d^4294967295)>>>0} +var ga=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759, +2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977, +2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755, +2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956, +3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270, +936918E3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117],S=A?new Uint32Array(ga):ga;function ha(){};function ia(b){this.buffer=new (A?Uint16Array:Array)(2*b);this.length=0}ia.prototype.getParent=function(b){return 2*((b-2)/4|0)};ia.prototype.push=function(b,a){var c,d,e=this.buffer,f;c=this.length;e[this.length++]=a;for(e[this.length++]=b;0e[d])f=e[c],e[c]=e[d],e[d]=f,f=e[c+1],e[c+1]=e[d+1],e[d+1]=f,c=d;else break;return this.length}; +ia.prototype.pop=function(){var b,a,c=this.buffer,d,e,f;a=c[0];b=c[1];this.length-=2;c[0]=c[this.length];c[1]=c[this.length+1];for(f=0;;){e=2*f+2;if(e>=this.length)break;e+2c[e]&&(e+=2);if(c[e]>c[f])d=c[f],c[f]=c[e],c[e]=d,d=c[f+1],c[f+1]=c[e+1],c[e+1]=d;else break;f=e}return{index:b,value:a,length:this.length}};function ja(b){var a=b.length,c=0,d=Number.POSITIVE_INFINITY,e,f,g,k,h,l,s,p,m,n;for(p=0;pc&&(c=b[p]),b[p]>=1;n=g<<16|p;for(m=l;mT;T++)switch(v){case 143>=T:pa.push([T+48,8]);break;case 255>=T:pa.push([T-144+400,9]);break;case 279>=T:pa.push([T-256+0,7]);break;case 287>=T:pa.push([T-280+192,8]);break;default:q("invalid literal: "+T)} +ma.prototype.h=function(){var b,a,c,d,e=this.input;switch(this.k){case 0:c=0;for(d=e.length;c>>8&255;m[n++]=l&255;m[n++]=l>>>8&255;if(A)m.set(f,n),n+=f.length,m=m.subarray(0,n);else{s=0;for(p=f.length;sz)for(;0< +z--;)H[F++]=0,L[0]++;else for(;0z?z:138,C>z-3&&C=C?(H[F++]=17,H[F++]=C-3,L[17]++):(H[F++]=18,H[F++]=C-11,L[18]++),z-=C;else if(H[F++]=I[w],L[I[w]]++,z--,3>z)for(;0z?z:6,C>z-3&&CB;B++)sa[B]=ka[qb[B]];for(W=19;4=a:return[265,a-11,1];case 14>=a:return[266,a-13,1];case 16>=a:return[267,a-15,1];case 18>=a:return[268,a-17,1];case 22>=a:return[269,a-19,2];case 26>=a:return[270,a-23,2];case 30>=a:return[271,a-27,2];case 34>=a:return[272, +a-31,2];case 42>=a:return[273,a-35,3];case 50>=a:return[274,a-43,3];case 58>=a:return[275,a-51,3];case 66>=a:return[276,a-59,3];case 82>=a:return[277,a-67,4];case 98>=a:return[278,a-83,4];case 114>=a:return[279,a-99,4];case 130>=a:return[280,a-115,4];case 162>=a:return[281,a-131,5];case 194>=a:return[282,a-163,5];case 226>=a:return[283,a-195,5];case 257>=a:return[284,a-227,5];case 258===a:return[285,a-258,0];default:q("invalid length: "+a)}}var a=[],c,d;for(c=3;258>=c;c++)d=b(c),a[c]=d[2]<<24|d[1]<< +16|d[0];return a}(),xa=A?new Uint32Array(wa):wa; +function qa(b,a){function c(a,c){var b=a.O,d=[],f=0,e;e=xa[a.length];d[f++]=e&65535;d[f++]=e>>16&255;d[f++]=e>>24;var g;switch(v){case 1===b:g=[0,b-1,0];break;case 2===b:g=[1,b-2,0];break;case 3===b:g=[2,b-3,0];break;case 4===b:g=[3,b-4,0];break;case 6>=b:g=[4,b-5,1];break;case 8>=b:g=[5,b-7,1];break;case 12>=b:g=[6,b-9,2];break;case 16>=b:g=[7,b-13,2];break;case 24>=b:g=[8,b-17,3];break;case 32>=b:g=[9,b-25,3];break;case 48>=b:g=[10,b-33,4];break;case 64>=b:g=[11,b-49,4];break;case 96>=b:g=[12,b- +65,5];break;case 128>=b:g=[13,b-97,5];break;case 192>=b:g=[14,b-129,6];break;case 256>=b:g=[15,b-193,6];break;case 384>=b:g=[16,b-257,7];break;case 512>=b:g=[17,b-385,7];break;case 768>=b:g=[18,b-513,8];break;case 1024>=b:g=[19,b-769,8];break;case 1536>=b:g=[20,b-1025,9];break;case 2048>=b:g=[21,b-1537,9];break;case 3072>=b:g=[22,b-2049,10];break;case 4096>=b:g=[23,b-3073,10];break;case 6144>=b:g=[24,b-4097,11];break;case 8192>=b:g=[25,b-6145,11];break;case 12288>=b:g=[26,b-8193,12];break;case 16384>= +b:g=[27,b-12289,12];break;case 24576>=b:g=[28,b-16385,13];break;case 32768>=b:g=[29,b-24577,13];break;default:q("invalid distance")}e=g;d[f++]=e[0];d[f++]=e[1];d[f++]=e[2];var h,k;h=0;for(k=d.length;h=f;)u[f++]=0;for(f=0;29>=f;)x[f++]=0}u[256]=1;d=0;for(e=a.length;d=e){p&&c(p,-1);f=0;for(g=e-d;fg&&a+gf&&(e=d,f=g);if(258===g)break}return new ua(f,a-e)} +function ra(b,a){var c=b.length,d=new ia(572),e=new (A?Uint8Array:Array)(c),f,g,k,h,l;if(!A)for(h=0;h2*e[n-1]+f[n]&&(e[n]=2*e[n-1]+f[n]),k[n]=Array(e[n]),h[n]=Array(e[n]);for(m=0;mb[m]?(k[n][r]=u,h[n][r]=a,x+=2):(k[n][r]=b[m],h[n][r]=m,++m);l[n]=0;1===f[n]&&d(n)}return g} +function ta(b){var a=new (A?Uint16Array:Array)(b.length),c=[],d=[],e=0,f,g,k,h;f=0;for(g=b.length;f>>=1}return a};function Aa(b,a){this.input=b;this.b=this.c=0;this.g={};a&&(a.flags&&(this.g=a.flags),"string"===typeof a.filename&&(this.filename=a.filename),"string"===typeof a.comment&&(this.w=a.comment),a.deflateOptions&&(this.l=a.deflateOptions));this.l||(this.l={})} +Aa.prototype.h=function(){var b,a,c,d,e,f,g,k,h=new (A?Uint8Array:Array)(32768),l=0,s=this.input,p=this.c,m=this.filename,n=this.w;h[l++]=31;h[l++]=139;h[l++]=8;b=0;this.g.fname&&(b|=Ba);this.g.fcomment&&(b|=Ca);this.g.fhcrc&&(b|=Da);h[l++]=b;a=(Date.now?Date.now():+new Date)/1E3|0;h[l++]=a&255;h[l++]=a>>>8&255;h[l++]=a>>>16&255;h[l++]=a>>>24&255;h[l++]=0;h[l++]=Sa;if(this.g.fname!==t){g=0;for(k=m.length;g>>8&255),h[l++]=f&255;h[l++]=0}if(this.g.comment){g= +0;for(k=n.length;g>>8&255),h[l++]=f&255;h[l++]=0}this.g.fhcrc&&(c=R(h,0,l)&65535,h[l++]=c&255,h[l++]=c>>>8&255);this.l.outputBuffer=h;this.l.outputIndex=l;e=new ma(s,this.l);h=e.h();l=e.b;A&&(l+8>h.buffer.byteLength?(this.a=new Uint8Array(l+8),this.a.set(new Uint8Array(h.buffer)),h=this.a):h=new Uint8Array(h.buffer));d=R(s,t,t);h[l++]=d&255;h[l++]=d>>>8&255;h[l++]=d>>>16&255;h[l++]=d>>>24&255;k=s.length;h[l++]=k&255;h[l++]=k>>>8&255;h[l++]=k>>>16&255;h[l++]= +k>>>24&255;this.c=p;A&&l>>=1;switch(b){case 0:var a=this.input,c=this.c,d=this.a,e=this.b,f=a.length,g=t,k=t,h=d.length,l=t;this.e=this.j=0;c+1>=f&&q(Error("invalid uncompressed block header: LEN"));g=a[c++]|a[c++]<<8;c+1>=f&&q(Error("invalid uncompressed block header: NLEN"));k=a[c++]|a[c++]<<8;g===~k&&q(Error("invalid uncompressed block header: length verify"));c+g>a.length&&q(Error("input buffer is broken"));switch(this.q){case Ua:for(;e+g>d.length;){l= +h-e;g-=l;if(A)d.set(a.subarray(c,c+l),e),e+=l,c+=l;else for(;l--;)d[e++]=a[c++];this.b=e;d=this.f();e=this.b}break;case Ta:for(;e+g>d.length;)d=this.f({B:2});break;default:q(Error("invalid inflate mode"))}if(A)d.set(a.subarray(c,c+g),e),e+=g,c+=g;else for(;g--;)d[e++]=a[c++];this.c=c;this.b=e;this.a=d;break;case 1:this.r(Va,Wa);break;case 2:Xa(this);break;default:q(Error("unknown BTYPE: "+b))}}return this.z()}; +var Ya=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],Za=A?new Uint16Array(Ya):Ya,$a=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,258,258],ab=A?new Uint16Array($a):$a,bb=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0],cb=A?new Uint8Array(bb):bb,db=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577],eb=A?new Uint16Array(db):db,fb=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10, +10,11,11,12,12,13,13],gb=A?new Uint8Array(fb):fb,hb=new (A?Uint8Array:Array)(288),$,ib;$=0;for(ib=hb.length;$=$?8:255>=$?9:279>=$?7:8;var Va=ja(hb),jb=new (A?Uint8Array:Array)(30),kb,lb;kb=0;for(lb=jb.length;kb=g&&q(Error("input buffer is broken")),c|=e[f++]<>>a;b.e=d-a;b.c=f;return k} +function mb(b,a){for(var c=b.j,d=b.e,e=b.input,f=b.c,g=e.length,k=a[0],h=a[1],l,s;d=g);)c|=e[f++]<>>16;b.j=c>>s;b.e=d-s;b.c=f;return l&65535} +function Xa(b){function a(a,b,c){var d,e=this.I,f,g;for(g=0;gf)d>=e&&(this.b=d,c=this.f(),d=this.b),c[d++]=f;else{g=f-257;h=ab[g];0=e&&(this.b=d,c=this.f(),d=this.b);for(;h--;)c[d]=c[d++-k]}for(;8<=this.e;)this.e-=8,this.c--;this.b=d}; +Y.prototype.R=function(b,a){var c=this.a,d=this.b;this.A=b;for(var e=c.length,f,g,k,h;256!==(f=mb(this,b));)if(256>f)d>=e&&(c=this.f(),e=c.length),c[d++]=f;else{g=f-257;h=ab[g];0e&&(c=this.f(),e=c.length);for(;h--;)c[d]=c[d++-k]}for(;8<=this.e;)this.e-=8,this.c--;this.b=d}; +Y.prototype.f=function(){var b=new (A?Uint8Array:Array)(this.b-32768),a=this.b-32768,c,d,e=this.a;if(A)b.set(e.subarray(32768,b.length));else{c=0;for(d=b.length;cc;++c)e[c]=e[a+c];this.b=32768;return e}; +Y.prototype.T=function(b){var a,c=this.input.length/this.c+1|0,d,e,f,g=this.input,k=this.a;b&&("number"===typeof b.B&&(c=b.B),"number"===typeof b.N&&(c+=b.N));2>c?(d=(g.length-this.c)/this.A[2],f=258*(d/2)|0,e=fa&&(this.a.length=a),b=this.a);return this.buffer=b};function nb(b){this.input=b;this.c=0;this.G=[];this.S=!1} +nb.prototype.i=function(){for(var b=this.input.length;this.c>>0;R(e,t,t)!==s&&q(Error("invalid CRC-32 checksum: 0x"+R(e,t,t).toString(16)+" / 0x"+ +s.toString(16)));a.$=c=(p[m++]|p[m++]<<8|p[m++]<<16|p[m++]<<24)>>>0;(e.length&4294967295)!==c&&q(Error("invalid input size: "+(e.length&4294967295)+" / "+c));this.G.push(a);this.c=m}this.S=v;var n=this.G,r,u,x=0,O=0,y;r=0;for(u=n.length;r>>0;b=a}for(var e=1,f=0,g=b.length,k,h=0;0>>0};function pb(b,a){var c,d;this.input=b;this.c=0;if(a||!(a={}))a.index&&(this.c=a.index),a.verify&&(this.W=a.verify);c=b[this.c++];d=b[this.c++];switch(c&15){case rb:this.method=rb;break;default:q(Error("unsupported compression method"))}0!==((c<<8)+d)%31&&q(Error("invalid fcheck flag:"+((c<<8)+d)%31));d&32&&q(Error("fdict flag is not supported"));this.K=new Y(b,{index:this.c,bufferSize:a.bufferSize,bufferType:a.bufferType,resize:a.resize})} +pb.prototype.i=function(){var b=this.input,a,c;a=this.K.i();this.c=this.K.c;this.W&&(c=(b[this.c++]<<24|b[this.c++]<<16|b[this.c++]<<8|b[this.c++])>>>0,c!==ob(a)&&q(Error("invalid adler-32 checksum")));return a};var rb=8;function sb(b,a){this.input=b;this.a=new (A?Uint8Array:Array)(32768);this.k=tb.t;var c={},d;if((a||!(a={}))&&"number"===typeof a.compressionType)this.k=a.compressionType;for(d in a)c[d]=a[d];c.outputBuffer=this.a;this.J=new ma(this.input,c)}var tb=oa; +sb.prototype.h=function(){var b,a,c,d,e,f,g,k=0;g=this.a;b=rb;switch(b){case rb:a=Math.LOG2E*Math.log(32768)-8;break;default:q(Error("invalid compression method"))}c=a<<4|b;g[k++]=c;switch(b){case rb:switch(this.k){case tb.NONE:e=0;break;case tb.M:e=1;break;case tb.t:e=2;break;default:q(Error("unsupported compression type"))}break;default:q(Error("invalid compression method"))}d=e<<6|0;g[k++]=d|31-(256*c+d)%31;f=ob(this.input);this.J.b=k;g=this.J.h();k=g.length;A&&(g=new Uint8Array(g.buffer),g.length<= +k+4&&(this.a=new Uint8Array(g.length+4),this.a.set(g),g=this.a),g=g.subarray(0,k+4));g[k++]=f>>24&255;g[k++]=f>>16&255;g[k++]=f>>8&255;g[k++]=f&255;return g};exports.deflate=ub;exports.deflateSync=vb;exports.inflate=wb;exports.inflateSync=xb;exports.gzip=yb;exports.gzipSync=zb;exports.gunzip=Ab;exports.gunzipSync=Bb;function ub(b,a,c){process.nextTick(function(){var d,e;try{e=vb(b,c)}catch(f){d=f}a(d,e)})}function vb(b,a){var c;c=(new sb(b)).h();a||(a={});return a.H?c:Cb(c)}function wb(b,a,c){process.nextTick(function(){var d,e;try{e=xb(b,c)}catch(f){d=f}a(d,e)})} +function xb(b,a){var c;b.subarray=b.slice;c=(new pb(b)).i();a||(a={});return a.noBuffer?c:Cb(c)}function yb(b,a,c){process.nextTick(function(){var d,e;try{e=zb(b,c)}catch(f){d=f}a(d,e)})}function zb(b,a){var c;b.subarray=b.slice;c=(new Aa(b)).h();a||(a={});return a.H?c:Cb(c)}function Ab(b,a,c){process.nextTick(function(){var d,e;try{e=Bb(b,c)}catch(f){d=f}a(d,e)})}function Bb(b,a){var c;b.subarray=b.slice;c=(new nb(b)).i();a||(a={});return a.H?c:Cb(c)} +function Cb(b){var a=new Buffer(b.length),c,d;c=0;for(d=b.length;c { this.client.emit(Constants.Events.GUILD_CREATE, guild); }); + } else { + this.client.emit(Constants.Events.GUILD_CREATE, guild); + } + } - /** - * The Data Resolver of the Client - * @type {ClientDataResolver} - * @private - */ - this.resolver = new ClientDataResolver(this); - } - } + return guild; + } - module.exports = WebhookClient; + newUser(data) { + if (this.client.users.has(data.id)) return this.client.users.get(data.id); + const user = new User(this.client, data); + this.client.users.set(user.id, user); + return user; + } + + newChannel(data, guild) { + const already = this.client.channels.has(data.id); + let channel; + if (data.type === Constants.ChannelTypes.DM) { + channel = new DMChannel(this.client, data); + } else if (data.type === Constants.ChannelTypes.groupDM) { + channel = new GroupDMChannel(this.client, data); + } else { + guild = guild || this.client.guilds.get(data.guild_id); + if (guild) { + if (data.type === Constants.ChannelTypes.text) { + channel = new TextChannel(guild, data); + guild.channels.set(channel.id, channel); + } else if (data.type === Constants.ChannelTypes.voice) { + channel = new VoiceChannel(guild, data); + guild.channels.set(channel.id, channel); + } + } + } + + if (channel) { + if (this.pastReady && !already) this.client.emit(Constants.Events.CHANNEL_CREATE, channel); + this.client.channels.set(channel.id, channel); + return channel; + } + + return null; + } + + newEmoji(data, guild) { + const already = guild.emojis.has(data.id); + if (data && !already) { + let emoji = new Emoji(guild, data); + this.client.emit(Constants.Events.EMOJI_CREATE, emoji); + guild.emojis.set(emoji.id, emoji); + return emoji; + } else if (already) { + return guild.emojis.get(data.id); + } + + return null; + } + + killEmoji(emoji) { + if (!(emoji instanceof Emoji && emoji.guild)) return; + this.client.emit(Constants.Events.EMOJI_DELETE, emoji); + emoji.guild.emojis.delete(emoji.id); + } + + killGuild(guild) { + const already = this.client.guilds.has(guild.id); + this.client.guilds.delete(guild.id); + if (already && this.pastReady) this.client.emit(Constants.Events.GUILD_DELETE, guild); + } + + killUser(user) { + this.client.users.delete(user.id); + } + + killChannel(channel) { + this.client.channels.delete(channel.id); + if (channel instanceof GuildChannel) channel.guild.channels.delete(channel.id); + } + + updateGuild(currentGuild, newData) { + const oldGuild = cloneObject(currentGuild); + currentGuild.setup(newData); + if (this.pastReady) this.client.emit(Constants.Events.GUILD_UPDATE, oldGuild, currentGuild); + } + + updateChannel(currentChannel, newData) { + currentChannel.setup(newData); + } + + updateEmoji(currentEmoji, newData) { + const oldEmoji = cloneObject(currentEmoji); + currentEmoji.setup(newData); + this.client.emit(Constants.Events.GUILD_EMOJI_UPDATE, oldEmoji, currentEmoji); + } +} + +module.exports = ClientDataManager; /***/ }, /* 249 */ /***/ function(module, exports, __webpack_require__) { - /* WEBPACK VAR INJECTION */(function(process) {const childProcess = __webpack_require__(62); - const path = __webpack_require__(15); - const makeError = __webpack_require__(246); - const makePlainError = __webpack_require__(247); +const Constants = __webpack_require__(2); - /** - * Represents a Shard spawned by the ShardingManager. - */ - class Shard { - /** - * @param {ShardingManager} manager The sharding manager - * @param {number} id The ID of this shard - * @param {Array} [args=[]] Command line arguments to pass to the script - */ - constructor(manager, id, args = []) { - /** - * Manager that created the shard - * @type {ShardingManager} - */ - this.manager = manager; +/** + * Manages the State and Background Tasks of the Client + * @private + */ +class ClientManager { + constructor(client) { + /** + * The Client that instantiated this Manager + * @type {Client} + */ + this.client = client; - /** - * ID of the shard - * @type {number} - */ - this.id = id; + /** + * The heartbeat interval, null if not yet set + * @type {?number} + */ + this.heartbeatInterval = null; + } - /** - * The environment variables for the shard - * @type {Object} - */ - this.env = Object.assign({}, process.env, { - SHARD_ID: this.id, - SHARD_COUNT: this.manager.totalShards, - CLIENT_TOKEN: this.manager.token, - }); + /** + * Connects the Client to the WebSocket + * @param {string} token The authorization token + * @param {Function} resolve Function to run when connection is successful + * @param {Function} reject Function to run when connection fails + */ + connectToWebSocket(token, resolve, reject) { + this.client.emit(Constants.Events.DEBUG, `Authenticated using token ${token}`); + this.client.token = token; + const timeout = this.client.setTimeout(() => reject(new Error(Constants.Errors.TOOK_TOO_LONG)), 1000 * 300); + this.client.rest.methods.getGateway().then(gateway => { + this.client.emit(Constants.Events.DEBUG, `Using gateway ${gateway}`); + this.client.ws.connect(gateway); + this.client.ws.once('close', event => { + if (event.code === 4004) reject(new Error(Constants.Errors.BAD_LOGIN)); + if (event.code === 4010) reject(new Error(Constants.Errors.INVALID_SHARD)); + }); + this.client.once(Constants.Events.READY, () => { + resolve(token); + this.client.clearTimeout(timeout); + }); + }, reject); + } - /** - * Process of the shard - * @type {ChildProcess} - */ - this.process = childProcess.fork(path.resolve(this.manager.file), args, { - env: this.env, - }); - this.process.on('message', this._handleMessage.bind(this)); - this.process.once('exit', () => { - if (this.manager.respawn) this.manager.createShard(this.id); - }); + /** + * Sets up a keep-alive interval to keep the Client's connection valid + * @param {number} time The interval in milliseconds at which heartbeat packets should be sent + */ + setupKeepAlive(time) { + this.heartbeatInterval = this.client.setInterval(() => { + this.client.emit('debug', 'Sending heartbeat'); + this.client.ws.send({ + op: Constants.OPCodes.HEARTBEAT, + d: this.client.ws.sequence, + }, true); + }, time); + } - this._evals = new Map(); - this._fetches = new Map(); - } + destroy() { + return new Promise(resolve => { + this.client.ws.destroy(); + if (!this.client.user.bot) { + resolve(this.client.rest.methods.logout()); + } else { + resolve(); + } + }); + } +} - /** - * Sends a message to the shard's process. - * @param {*} message Message to send to the shard - * @returns {Promise} - */ - send(message) { - return new Promise((resolve, reject) => { - const sent = this.process.send(message, err => { - if (err) reject(err); else resolve(this); - }); - if (!sent) throw new Error('Failed to send message to shard\'s process.'); - }); - } +module.exports = ClientManager; - /** - * Fetches a Client property value of the shard. - * @param {string} prop Name of the Client property to get, using periods for nesting - * @returns {Promise<*>} - * @example - * shard.fetchClientValue('guilds.size').then(count => { - * console.log(`${count} guilds in shard ${shard.id}`); - * }).catch(console.error); - */ - fetchClientValue(prop) { - if (this._fetches.has(prop)) return this._fetches.get(prop); - - const promise = new Promise((resolve, reject) => { - const listener = message => { - if (!message || message._fetchProp !== prop) return; - this.process.removeListener('message', listener); - this._fetches.delete(prop); - resolve(message._result); - }; - this.process.on('message', listener); - - this.send({ _fetchProp: prop }).catch(err => { - this.process.removeListener('message', listener); - this._fetches.delete(prop); - reject(err); - }); - }); - - this._fetches.set(prop, promise); - return promise; - } - - /** - * Evaluates a script on the shard, in the context of the Client. - * @param {string} script JavaScript to run on the shard - * @returns {Promise<*>} Result of the script execution - */ - eval(script) { - if (this._evals.has(script)) return this._evals.get(script); - - const promise = new Promise((resolve, reject) => { - const listener = message => { - if (!message || message._eval !== script) return; - this.process.removeListener('message', listener); - this._evals.delete(script); - if (!message._error) resolve(message._result); else reject(makeError(message._error)); - }; - this.process.on('message', listener); - - this.send({ _eval: script }).catch(err => { - this.process.removeListener('message', listener); - this._evals.delete(script); - reject(err); - }); - }); - - this._evals.set(script, promise); - return promise; - } - - /** - * Handles an IPC message - * @param {*} message Message received - * @private - */ - _handleMessage(message) { - if (message) { - // Shard is requesting a property fetch - if (message._sFetchProp) { - this.manager.fetchClientValues(message._sFetchProp).then( - results => this.send({ _sFetchProp: message._sFetchProp, _result: results }), - err => this.send({ _sFetchProp: message._sFetchProp, _error: makePlainError(err) }) - ); - return; - } - - // Shard is requesting an eval broadcast - if (message._sEval) { - this.manager.broadcastEval(message._sEval).then( - results => this.send({ _sEval: message._sEval, _result: results }), - err => this.send({ _sEval: message._sEval, _error: makePlainError(err) }) - ); - return; - } - } - - this.manager.emit('message', this, message); - } - } - - module.exports = Shard; - - /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2))) /***/ }, /* 250 */ -/***/ function(module, exports, __webpack_require__) { +/***/ function(module, exports) { - /* WEBPACK VAR INJECTION */(function(process) {const path = __webpack_require__(15); - const fs = __webpack_require__(62); - const EventEmitter = __webpack_require__(3).EventEmitter; - const mergeDefault = __webpack_require__(4); - const Shard = __webpack_require__(249); - const Collection = __webpack_require__(10); - const fetchRecommendedShards = __webpack_require__(251); +function webpackEmptyContext(req) { + throw new Error("Cannot find module '" + req + "'."); +} +webpackEmptyContext.keys = function() { return []; }; +webpackEmptyContext.resolve = webpackEmptyContext; +module.exports = webpackEmptyContext; +webpackEmptyContext.id = 250; - /** - * This is a utility class that can be used to help you spawn shards of your Client. Each shard is completely separate - * from the other. The Shard Manager takes a path to a file and spawns it under the specified amount of shards safely. - * If you do not select an amount of shards, the manager will automatically decide the best amount. - * @extends {EventEmitter} - */ - class ShardingManager extends EventEmitter { - /** - * @param {string} file Path to your shard script file - * @param {Object} [options] Options for the sharding manager - * @param {number|string} [options.totalShards='auto'] Number of shards to spawn, or "auto" - * @param {boolean} [options.respawn=true] Whether shards should automatically respawn upon exiting - * @param {string[]} [options.shardArgs=[]] Arguments to pass to the shard script when spawning - * @param {string} [options.token] Token to use for automatic shard count and passing to shards - */ - constructor(file, options = {}) { - super(); - options = mergeDefault({ - totalShards: 'auto', - respawn: true, - shardArgs: [], - token: null, - }, options); - - /** - * Path to the shard script file - * @type {string} - */ - this.file = file; - if (!file) throw new Error('File must be specified.'); - if (!path.isAbsolute(file)) this.file = path.resolve(process.cwd(), file); - const stats = fs.statSync(this.file); - if (!stats.isFile()) throw new Error('File path does not point to a file.'); - - /** - * Amount of shards that this manager is going to spawn - * @type {number|string} - */ - this.totalShards = options.totalShards; - if (this.totalShards !== 'auto') { - if (typeof this.totalShards !== 'number' || isNaN(this.totalShards)) { - throw new TypeError('Amount of shards must be a number.'); - } - if (this.totalShards < 1) throw new RangeError('Amount of shards must be at least 1.'); - if (this.totalShards !== Math.floor(this.totalShards)) { - throw new RangeError('Amount of shards must be an integer.'); - } - } - - /** - * Whether shards should automatically respawn upon exiting - * @type {boolean} - */ - this.respawn = options.respawn; - - /** - * An array of arguments to pass to shards. - * @type {string[]} - */ - this.shardArgs = options.shardArgs; - - /** - * Token to use for obtaining the automatic shard count, and passing to shards - * @type {?string} - */ - this.token = options.token ? options.token.replace(/^Bot\s*/i, '') : null; - - /** - * A collection of shards that this manager has spawned - * @type {Collection} - */ - this.shards = new Collection(); - } - - /** - * Spawns a single shard. - * @param {number} id The ID of the shard to spawn. **This is usually not necessary.** - * @returns {Promise} - */ - createShard(id = this.shards.size) { - const shard = new Shard(this, id, this.shardArgs); - this.shards.set(id, shard); - /** - * Emitted upon launching a shard - * @event ShardingManager#launch - * @param {Shard} shard Shard that was launched - */ - this.emit('launch', shard); - return Promise.resolve(shard); - } - - /** - * Spawns multiple shards. - * @param {number} [amount=this.totalShards] Number of shards to spawn - * @param {number} [delay=5500] How long to wait in between spawning each shard (in milliseconds) - * @returns {Promise>} - */ - spawn(amount = this.totalShards, delay = 5500) { - if (amount === 'auto') { - return fetchRecommendedShards(this.token).then(count => { - this.totalShards = count; - return this._spawn(count, delay); - }); - } else { - if (typeof amount !== 'number' || isNaN(amount)) throw new TypeError('Amount of shards must be a number.'); - if (amount < 1) throw new RangeError('Amount of shards must be at least 1.'); - if (amount !== Math.floor(amount)) throw new TypeError('Amount of shards must be an integer.'); - return this._spawn(amount, delay); - } - } - - /** - * Actually spawns shards, unlike that poser above >:( - * @param {number} amount Number of shards to spawn - * @param {number} delay How long to wait in between spawning each shard (in milliseconds) - * @returns {Promise>} - * @private - */ - _spawn(amount, delay) { - return new Promise(resolve => { - if (this.shards.size >= amount) throw new Error(`Already spawned ${this.shards.size} shards.`); - this.totalShards = amount; - - this.createShard(); - if (this.shards.size >= this.totalShards) { - resolve(this.shards); - return; - } - - if (delay <= 0) { - while (this.shards.size < this.totalShards) this.createShard(); - resolve(this.shards); - } else { - const interval = setInterval(() => { - this.createShard(); - if (this.shards.size >= this.totalShards) { - clearInterval(interval); - resolve(this.shards); - } - }, delay); - } - }); - } - - /** - * Send a message to all shards. - * @param {*} message Message to be sent to the shards - * @returns {Promise} - */ - broadcast(message) { - const promises = []; - for (const shard of this.shards.values()) promises.push(shard.send(message)); - return Promise.all(promises); - } - - /** - * Evaluates a script on all shards, in the context of the Clients. - * @param {string} script JavaScript to run on each shard - * @returns {Promise} Results of the script execution - */ - broadcastEval(script) { - const promises = []; - for (const shard of this.shards.values()) promises.push(shard.eval(script)); - return Promise.all(promises); - } - - /** - * Fetches a Client property value of each shard. - * @param {string} prop Name of the Client property to get, using periods for nesting - * @returns {Promise} - * @example - * manager.fetchClientValues('guilds.size').then(results => { - * console.log(`${results.reduce((prev, val) => prev + val, 0)} total guilds`); - * }).catch(console.error); - */ - fetchClientValues(prop) { - if (this.shards.size === 0) return Promise.reject(new Error('No shards have been spawned.')); - if (this.shards.size !== this.totalShards) return Promise.reject(new Error('Still spawning shards.')); - const promises = []; - for (const shard of this.shards.values()) promises.push(shard.fetchClientValue(prop)); - return Promise.all(promises); - } - } - - module.exports = ShardingManager; - - /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(2))) /***/ }, /* 251 */ /***/ function(module, exports, __webpack_require__) { - const superagent = __webpack_require__(40); - const botGateway = __webpack_require__(5).Endpoints.botGateway; +class ActionsManager { + constructor(client) { + this.client = client; - /** - * Gets the recommended shard count from Discord - * @param {number} token Discord auth token - * @returns {Promise} the recommended number of shards - */ - module.exports = function fetchRecommendedShards(token) { - return new Promise((resolve, reject) => { - if (!token) throw new Error('A token must be provided.'); - superagent.get(botGateway) - .set('Authorization', `Bot ${token.replace(/^Bot\s*/i, '')}`) - .end((err, res) => { - if (err) reject(err); - resolve(res.body.shards); - }); - }); - }; + this.register('MessageCreate'); + this.register('MessageDelete'); + this.register('MessageDeleteBulk'); + this.register('MessageUpdate'); + this.register('MessageReactionAdd'); + this.register('MessageReactionRemove'); + this.register('MessageReactionRemoveAll'); + this.register('ChannelCreate'); + this.register('ChannelDelete'); + this.register('ChannelUpdate'); + this.register('GuildDelete'); + this.register('GuildUpdate'); + this.register('GuildMemberGet'); + this.register('GuildMemberRemove'); + this.register('GuildBanRemove'); + this.register('GuildRoleCreate'); + this.register('GuildRoleDelete'); + this.register('GuildRoleUpdate'); + this.register('UserGet'); + this.register('UserUpdate'); + this.register('UserNoteUpdate'); + this.register('GuildSync'); + this.register('GuildEmojiCreate'); + this.register('GuildEmojiDelete'); + this.register('GuildEmojiUpdate'); + this.register('GuildRolesPositionUpdate'); + } + + register(name) { + const Action = !(function webpackMissingModule() { var e = new Error("Cannot find module \".\""); e.code = 'MODULE_NOT_FOUND'; throw e; }()); + this[name] = new Action(this.client); + } +} + +module.exports = ActionsManager; + + +/***/ }, +/* 252 */ +/***/ function(module, exports, __webpack_require__) { + +const request = __webpack_require__(57); +const Constants = __webpack_require__(2); + +function getRoute(url) { + let route = url.split('?')[0]; + if (route.includes('/channels/') || route.includes('/guilds/')) { + const startInd = ~route.indexOf('/channels/') ? route.indexOf('/channels/') : route.indexOf('/guilds/'); + const majorID = route.substring(startInd).split('/')[2]; + route = route.replace(/(\d{8,})/g, ':id').replace(':id', majorID); + } + return route; +} + +class APIRequest { + constructor(rest, method, url, auth, data, file) { + this.rest = rest; + this.method = method; + this.url = url; + this.auth = auth; + this.data = data; + this.file = file; + this.route = getRoute(this.url); + } + + getAuth() { + if (this.rest.client.token && this.rest.client.user && this.rest.client.user.bot) { + return `Bot ${this.rest.client.token}`; + } else if (this.rest.client.token) { + return this.rest.client.token; + } + throw new Error(Constants.Errors.NO_TOKEN); + } + + gen() { + const apiRequest = request[this.method](this.url); + if (this.auth) apiRequest.set('authorization', this.getAuth()); + if (this.file && this.file.file) { + apiRequest.attach('file', this.file.file, this.file.name); + this.data = this.data || {}; + for (const key in this.data) { + if (this.data[key]) { + apiRequest.field(key, this.data[key]); + } + } + } else if (this.data) { + apiRequest.send(this.data); + } + apiRequest.set('User-Agent', this.rest.userAgentManager.userAgent); + return apiRequest; + } +} + +module.exports = APIRequest; + + +/***/ }, +/* 253 */ +/***/ function(module, exports, __webpack_require__) { + +const Constants = __webpack_require__(2); +const Collection = __webpack_require__(6); +const splitMessage = __webpack_require__(79); +const parseEmoji = __webpack_require__(277); + +const User = __webpack_require__(11); +const GuildMember = __webpack_require__(30); +const Role = __webpack_require__(22); +const Invite = __webpack_require__(67); +const Webhook = __webpack_require__(46); +const UserProfile = __webpack_require__(276); +const ClientOAuth2Application = __webpack_require__(64); + +class RESTMethods { + constructor(restManager) { + this.rest = restManager; + } + + loginToken(token = this.rest.client.token) { + return new Promise((resolve, reject) => { + token = token.replace(/^Bot\s*/i, ''); + this.rest.client.manager.connectToWebSocket(token, resolve, reject); + }); + } + + loginEmailPassword(email, password) { + this.rest.client.emit('warn', 'Client launched using email and password - should use token instead'); + this.rest.client.email = email; + this.rest.client.password = password; + return this.rest.makeRequest('post', Constants.Endpoints.login, false, { email, password }).then(data => + this.loginToken(data.token) + ); + } + + logout() { + return this.rest.makeRequest('post', Constants.Endpoints.logout, true, {}); + } + + getGateway() { + return this.rest.makeRequest('get', Constants.Endpoints.gateway, true).then(res => { + this.rest.client.ws.gateway = `${res.url}/?encoding=json&v=${Constants.PROTOCOL_VERSION}`; + return this.rest.client.ws.gateway; + }); + } + + getBotGateway() { + return this.rest.makeRequest('get', Constants.Endpoints.botGateway, true); + } + + sendMessage(channel, content, { tts, nonce, embed, disableEveryone, split } = {}, file = null) { + return new Promise((resolve, reject) => { + if (typeof content !== 'undefined') content = this.rest.client.resolver.resolveString(content); + + if (content) { + if (disableEveryone || (typeof disableEveryone === 'undefined' && this.rest.client.options.disableEveryone)) { + content = content.replace(/@(everyone|here)/g, '@\u200b$1'); + } + + if (split) content = splitMessage(content, typeof split === 'object' ? split : {}); + } + + if (channel instanceof User || channel instanceof GuildMember) { + this.createDM(channel).then(chan => { + this._sendMessageRequest(chan, content, file, tts, nonce, embed, resolve, reject); + }, reject); + } else { + this._sendMessageRequest(channel, content, file, tts, nonce, embed, resolve, reject); + } + }); + } + + _sendMessageRequest(channel, content, file, tts, nonce, embed, resolve, reject) { + if (content instanceof Array) { + const datas = []; + let promise = this.rest.makeRequest('post', Constants.Endpoints.channelMessages(channel.id), true, { + content: content[0], tts, nonce, + }, file).catch(reject); + + for (let i = 1; i <= content.length; i++) { + if (i < content.length) { + const i2 = i; + promise = promise.then(data => { + datas.push(data); + return this.rest.makeRequest('post', Constants.Endpoints.channelMessages(channel.id), true, { + content: content[i2], tts, nonce, embed, + }, file); + }, reject); + } else { + promise.then(data => { + datas.push(data); + resolve(this.rest.client.actions.MessageCreate.handle(datas).messages); + }, reject); + } + } + } else { + this.rest.makeRequest('post', Constants.Endpoints.channelMessages(channel.id), true, { + content, tts, nonce, embed, + }, file) + .then(data => resolve(this.rest.client.actions.MessageCreate.handle(data).message), reject); + } + } + + deleteMessage(message) { + return this.rest.makeRequest('del', Constants.Endpoints.channelMessage(message.channel.id, message.id), true) + .then(() => + this.rest.client.actions.MessageDelete.handle({ + id: message.id, + channel_id: message.channel.id, + }).message + ); + } + + bulkDeleteMessages(channel, messages) { + return this.rest.makeRequest('post', `${Constants.Endpoints.channelMessages(channel.id)}/bulk_delete`, true, { + messages, + }).then(() => + this.rest.client.actions.MessageDeleteBulk.handle({ + channel_id: channel.id, + ids: messages, + }).messages + ); + } + + updateMessage(message, content, { embed } = {}) { + content = this.rest.client.resolver.resolveString(content); + return this.rest.makeRequest('patch', Constants.Endpoints.channelMessage(message.channel.id, message.id), true, { + content, embed, + }).then(data => this.rest.client.actions.MessageUpdate.handle(data).updated); + } + + createChannel(guild, channelName, channelType) { + return this.rest.makeRequest('post', Constants.Endpoints.guildChannels(guild.id), true, { + name: channelName, + type: channelType, + }).then(data => this.rest.client.actions.ChannelCreate.handle(data).channel); + } + + createDM(recipient) { + const dmChannel = this.getExistingDM(recipient); + if (dmChannel) return Promise.resolve(dmChannel); + return this.rest.makeRequest('post', Constants.Endpoints.userChannels(this.rest.client.user.id), true, { + recipient_id: recipient.id, + }).then(data => this.rest.client.actions.ChannelCreate.handle(data).channel); + } + + getExistingDM(recipient) { + return this.rest.client.channels.find(channel => + channel.recipient && channel.recipient.id === recipient.id + ); + } + + deleteChannel(channel) { + if (channel instanceof User || channel instanceof GuildMember) channel = this.getExistingDM(channel); + if (!channel) return Promise.reject(new Error('No channel to delete.')); + return this.rest.makeRequest('del', Constants.Endpoints.channel(channel.id), true).then(data => { + data.id = channel.id; + return this.rest.client.actions.ChannelDelete.handle(data).channel; + }); + } + + updateChannel(channel, _data) { + const data = {}; + data.name = (_data.name || channel.name).trim(); + data.topic = _data.topic || channel.topic; + data.position = _data.position || channel.position; + data.bitrate = _data.bitrate || channel.bitrate; + data.user_limit = _data.userLimit || channel.userLimit; + return this.rest.makeRequest('patch', Constants.Endpoints.channel(channel.id), true, data).then(newData => + this.rest.client.actions.ChannelUpdate.handle(newData).updated + ); + } + + leaveGuild(guild) { + if (guild.ownerID === this.rest.client.user.id) return Promise.reject(new Error('Guild is owned by the client.')); + return this.rest.makeRequest('del', Constants.Endpoints.meGuild(guild.id), true).then(() => + this.rest.client.actions.GuildDelete.handle({ id: guild.id }).guild + ); + } + + createGuild(options) { + options.icon = this.rest.client.resolver.resolveBase64(options.icon) || null; + options.region = options.region || 'us-central'; + return new Promise((resolve, reject) => { + this.rest.makeRequest('post', Constants.Endpoints.guilds, true, options).then(data => { + if (this.rest.client.guilds.has(data.id)) { + resolve(this.rest.client.guilds.get(data.id)); + return; + } + + const handleGuild = guild => { + if (guild.id === data.id) { + this.rest.client.removeListener('guildCreate', handleGuild); + this.rest.client.clearTimeout(timeout); + resolve(guild); + } + }; + this.rest.client.on('guildCreate', handleGuild); + + const timeout = this.rest.client.setTimeout(() => { + this.rest.client.removeListener('guildCreate', handleGuild); + reject(new Error('Took too long to receive guild data.')); + }, 10000); + }, reject); + }); + } + + // untested but probably will work + deleteGuild(guild) { + return this.rest.makeRequest('del', Constants.Endpoints.guild(guild.id), true).then(() => + this.rest.client.actions.GuildDelete.handle({ id: guild.id }).guild + ); + } + + getUser(userID) { + return this.rest.makeRequest('get', Constants.Endpoints.user(userID), true).then(data => + this.rest.client.actions.UserGet.handle(data).user + ); + } + + updateCurrentUser(_data) { + const user = this.rest.client.user; + const data = {}; + data.username = _data.username || user.username; + data.avatar = this.rest.client.resolver.resolveBase64(_data.avatar) || user.avatar; + if (!user.bot) { + data.email = _data.email || user.email; + data.password = this.rest.client.password; + if (_data.new_password) data.new_password = _data.newPassword; + } + return this.rest.makeRequest('patch', Constants.Endpoints.me, true, data).then(newData => + this.rest.client.actions.UserUpdate.handle(newData).updated + ); + } + + updateGuild(guild, _data) { + const data = {}; + if (_data.name) data.name = _data.name; + if (_data.region) data.region = _data.region; + if (_data.verificationLevel) data.verification_level = Number(_data.verificationLevel); + if (_data.afkChannel) data.afk_channel_id = this.rest.client.resolver.resolveChannel(_data.afkChannel).id; + if (_data.afkTimeout) data.afk_timeout = Number(_data.afkTimeout); + if (_data.icon) data.icon = this.rest.client.resolver.resolveBase64(_data.icon); + if (_data.owner) data.owner_id = this.rest.client.resolver.resolveUser(_data.owner).id; + if (_data.splash) data.splash = this.rest.client.resolver.resolveBase64(_data.splash); + return this.rest.makeRequest('patch', Constants.Endpoints.guild(guild.id), true, data).then(newData => + this.rest.client.actions.GuildUpdate.handle(newData).updated + ); + } + + kickGuildMember(guild, member) { + return this.rest.makeRequest('del', Constants.Endpoints.guildMember(guild.id, member.id), true).then(() => + this.rest.client.actions.GuildMemberRemove.handle({ + guild_id: guild.id, + user: member.user, + }).member + ); + } + + createGuildRole(guild) { + return this.rest.makeRequest('post', Constants.Endpoints.guildRoles(guild.id), true).then(role => + this.rest.client.actions.GuildRoleCreate.handle({ + guild_id: guild.id, + role, + }).role + ); + } + + deleteGuildRole(role) { + return this.rest.makeRequest('del', Constants.Endpoints.guildRole(role.guild.id, role.id), true).then(() => + this.rest.client.actions.GuildRoleDelete.handle({ + guild_id: role.guild.id, + role_id: role.id, + }).role + ); + } + + setChannelOverwrite(channel, payload) { + return this.rest.makeRequest( + 'put', `${Constants.Endpoints.channelPermissions(channel.id)}/${payload.id}`, true, payload + ); + } + + deletePermissionOverwrites(overwrite) { + return this.rest.makeRequest( + 'del', `${Constants.Endpoints.channelPermissions(overwrite.channel.id)}/${overwrite.id}`, true + ).then(() => overwrite); + } + + getChannelMessages(channel, payload = {}) { + const params = []; + if (payload.limit) params.push(`limit=${payload.limit}`); + if (payload.around) params.push(`around=${payload.around}`); + else if (payload.before) params.push(`before=${payload.before}`); + else if (payload.after) params.push(`after=${payload.after}`); + + let endpoint = Constants.Endpoints.channelMessages(channel.id); + if (params.length > 0) endpoint += `?${params.join('&')}`; + return this.rest.makeRequest('get', endpoint, true); + } + + getChannelMessage(channel, messageID) { + const msg = channel.messages.get(messageID); + if (msg) return Promise.resolve(msg); + return this.rest.makeRequest('get', Constants.Endpoints.channelMessage(channel.id, messageID), true); + } + + getGuildMember(guild, user) { + return this.rest.makeRequest('get', Constants.Endpoints.guildMember(guild.id, user.id), true).then(data => + this.rest.client.actions.GuildMemberGet.handle(guild, data).member + ); + } + + updateGuildMember(member, data) { + if (data.channel) data.channel_id = this.rest.client.resolver.resolveChannel(data.channel).id; + if (data.roles) data.roles = data.roles.map(role => role instanceof Role ? role.id : role); + + let endpoint = Constants.Endpoints.guildMember(member.guild.id, member.id); + // fix your endpoints, discord ;-; + if (member.id === this.rest.client.user.id) { + const keys = Object.keys(data); + if (keys.length === 1 && keys[0] === 'nick') { + endpoint = Constants.Endpoints.stupidInconsistentGuildEndpoint(member.guild.id); + } + } + + return this.rest.makeRequest('patch', endpoint, true, data).then(newData => + member.guild._updateMember(member, newData).mem + ); + } + + sendTyping(channelID) { + return this.rest.makeRequest('post', `${Constants.Endpoints.channel(channelID)}/typing`, true); + } + + banGuildMember(guild, member, deleteDays = 0) { + const id = this.rest.client.resolver.resolveUserID(member); + if (!id) return Promise.reject(new Error('Couldn\'t resolve the user ID to ban.')); + return this.rest.makeRequest( + 'put', `${Constants.Endpoints.guildBans(guild.id)}/${id}?delete-message-days=${deleteDays}`, true, { + 'delete-message-days': deleteDays, + } + ).then(() => { + if (member instanceof GuildMember) return member; + const user = this.rest.client.resolver.resolveUser(id); + if (user) { + member = this.rest.client.resolver.resolveGuildMember(guild, user); + return member || user; + } + return id; + }); + } + + unbanGuildMember(guild, member) { + return new Promise((resolve, reject) => { + const id = this.rest.client.resolver.resolveUserID(member); + if (!id) throw new Error('Couldn\'t resolve the user ID to unban.'); + + const listener = (eGuild, eUser) => { + if (eGuild.id === guild.id && eUser.id === id) { + this.rest.client.removeListener(Constants.Events.GUILD_BAN_REMOVE, listener); + this.rest.client.clearTimeout(timeout); + resolve(eUser); + } + }; + this.rest.client.on(Constants.Events.GUILD_BAN_REMOVE, listener); + + const timeout = this.rest.client.setTimeout(() => { + this.rest.client.removeListener(Constants.Events.GUILD_BAN_REMOVE, listener); + reject(new Error('Took too long to receive the ban remove event.')); + }, 10000); + + this.rest.makeRequest('del', `${Constants.Endpoints.guildBans(guild.id)}/${id}`, true).catch(err => { + this.rest.client.removeListener(Constants.Events.GUILD_BAN_REMOVE, listener); + this.rest.client.clearTimeout(timeout); + reject(err); + }); + }); + } + + getGuildBans(guild) { + return this.rest.makeRequest('get', Constants.Endpoints.guildBans(guild.id), true).then(banItems => { + const bannedUsers = new Collection(); + for (const banItem of banItems) { + const user = this.rest.client.dataManager.newUser(banItem.user); + bannedUsers.set(user.id, user); + } + return bannedUsers; + }); + } + + updateGuildRole(role, _data) { + const data = {}; + data.name = _data.name || role.name; + data.position = typeof _data.position !== 'undefined' ? _data.position : role.position; + data.color = _data.color || role.color; + if (typeof data.color === 'string' && data.color.startsWith('#')) { + data.color = parseInt(data.color.replace('#', ''), 16); + } + data.hoist = typeof _data.hoist !== 'undefined' ? _data.hoist : role.hoist; + data.mentionable = typeof _data.mentionable !== 'undefined' ? _data.mentionable : role.mentionable; + + if (_data.permissions) { + let perms = 0; + for (let perm of _data.permissions) { + if (typeof perm === 'string') perm = Constants.PermissionFlags[perm]; + perms |= perm; + } + data.permissions = perms; + } else { + data.permissions = role.permissions; + } + + return this.rest.makeRequest( + 'patch', Constants.Endpoints.guildRole(role.guild.id, role.id), true, data + ).then(_role => + this.rest.client.actions.GuildRoleUpdate.handle({ + role: _role, + guild_id: role.guild.id, + }).updated + ); + } + + pinMessage(message) { + return this.rest.makeRequest('put', `${Constants.Endpoints.channel(message.channel.id)}/pins/${message.id}`, true) + .then(() => message); + } + + unpinMessage(message) { + return this.rest.makeRequest('del', `${Constants.Endpoints.channel(message.channel.id)}/pins/${message.id}`, true) + .then(() => message); + } + + getChannelPinnedMessages(channel) { + return this.rest.makeRequest('get', `${Constants.Endpoints.channel(channel.id)}/pins`, true); + } + + createChannelInvite(channel, options) { + const payload = {}; + payload.temporary = options.temporary; + payload.max_age = options.maxAge; + payload.max_uses = options.maxUses; + return this.rest.makeRequest('post', `${Constants.Endpoints.channelInvites(channel.id)}`, true, payload) + .then(invite => new Invite(this.rest.client, invite)); + } + + deleteInvite(invite) { + return this.rest.makeRequest('del', Constants.Endpoints.invite(invite.code), true).then(() => invite); + } + + getInvite(code) { + return this.rest.makeRequest('get', Constants.Endpoints.invite(code), true).then(invite => + new Invite(this.rest.client, invite) + ); + } + + getGuildInvites(guild) { + return this.rest.makeRequest('get', Constants.Endpoints.guildInvites(guild.id), true).then(inviteItems => { + const invites = new Collection(); + for (const inviteItem of inviteItems) { + const invite = new Invite(this.rest.client, inviteItem); + invites.set(invite.code, invite); + } + return invites; + }); + } + + pruneGuildMembers(guild, days, dry) { + return this.rest.makeRequest(dry ? 'get' : 'post', `${Constants.Endpoints.guildPrune(guild.id)}?days=${days}`, true) + .then(data => data.pruned); + } + + createEmoji(guild, image, name) { + return this.rest.makeRequest('post', `${Constants.Endpoints.guildEmojis(guild.id)}`, true, { name, image }) + .then(data => this.rest.client.actions.EmojiCreate.handle(data, guild).emoji); + } + + deleteEmoji(emoji) { + return this.rest.makeRequest('delete', `${Constants.Endpoints.guildEmojis(emoji.guild.id)}/${emoji.id}`, true) + .then(() => this.rest.client.actions.EmojiDelete.handle(emoji).data); + } + + getWebhook(id, token) { + return this.rest.makeRequest('get', Constants.Endpoints.webhook(id, token), !token).then(data => + new Webhook(this.rest.client, data) + ); + } + + getGuildWebhooks(guild) { + return this.rest.makeRequest('get', Constants.Endpoints.guildWebhooks(guild.id), true).then(data => { + const hooks = new Collection(); + for (const hook of data) hooks.set(hook.id, new Webhook(this.rest.client, hook)); + return hooks; + }); + } + + getChannelWebhooks(channel) { + return this.rest.makeRequest('get', Constants.Endpoints.channelWebhooks(channel.id), true).then(data => { + const hooks = new Collection(); + for (const hook of data) hooks.set(hook.id, new Webhook(this.rest.client, hook)); + return hooks; + }); + } + + createWebhook(channel, name, avatar) { + return this.rest.makeRequest('post', Constants.Endpoints.channelWebhooks(channel.id), true, { name, avatar }) + .then(data => new Webhook(this.rest.client, data)); + } + + editWebhook(webhook, name, avatar) { + return this.rest.makeRequest('patch', Constants.Endpoints.webhook(webhook.id, webhook.token), false, { + name, + avatar, + }).then(data => { + webhook.name = data.name; + webhook.avatar = data.avatar; + return webhook; + }); + } + + deleteWebhook(webhook) { + return this.rest.makeRequest('delete', Constants.Endpoints.webhook(webhook.id, webhook.token), false); + } + + sendWebhookMessage(webhook, content, { avatarURL, tts, disableEveryone, embeds } = {}, file = null) { + if (typeof content !== 'undefined') content = this.rest.client.resolver.resolveString(content); + if (content) { + if (disableEveryone || (typeof disableEveryone === 'undefined' && this.rest.client.options.disableEveryone)) { + content = content.replace(/@(everyone|here)/g, '@\u200b$1'); + } + } + return this.rest.makeRequest('post', `${Constants.Endpoints.webhook(webhook.id, webhook.token)}?wait=true`, false, { + username: webhook.name, + avatar_url: avatarURL, + content, + tts, + file, + embeds, + }); + } + + sendSlackWebhookMessage(webhook, body) { + return this.rest.makeRequest( + 'post', `${Constants.Endpoints.webhook(webhook.id, webhook.token)}/slack?wait=true`, false, body + ); + } + + fetchUserProfile(user) { + return this.rest.makeRequest('get', Constants.Endpoints.userProfile(user.id), true).then(data => + new UserProfile(user, data) + ); + } + + addFriend(user) { + return this.rest.makeRequest('post', Constants.Endpoints.relationships('@me'), true, { + username: user.username, + discriminator: user.discriminator, + }).then(() => user); + } + + removeFriend(user) { + return this.rest.makeRequest('delete', `${Constants.Endpoints.relationships('@me')}/${user.id}`, true) + .then(() => user); + } + + blockUser(user) { + return this.rest.makeRequest('put', `${Constants.Endpoints.relationships('@me')}/${user.id}`, true, { type: 2 }) + .then(() => user); + } + + unblockUser(user) { + return this.rest.makeRequest('delete', `${Constants.Endpoints.relationships('@me')}/${user.id}`, true) + .then(() => user); + } + + setRolePositions(guildID, roles) { + return this.rest.makeRequest('patch', Constants.Endpoints.guildRoles(guildID), true, roles).then(() => + this.rest.client.actions.GuildRolesPositionUpdate.handle({ + guild_id: guildID, + roles, + }).guild + ); + } + + addMessageReaction(message, emoji) { + return this.rest.makeRequest( + 'put', Constants.Endpoints.selfMessageReaction(message.channel.id, message.id, emoji), true + ).then(() => + this.rest.client.actions.MessageReactionAdd.handle({ + user_id: this.rest.client.user.id, + message_id: message.id, + emoji: parseEmoji(emoji), + channel_id: message.channel.id, + }).reaction + ); + } + + removeMessageReaction(message, emoji, user) { + let endpoint = Constants.Endpoints.selfMessageReaction(message.channel.id, message.id, emoji); + if (user.id !== this.rest.client.user.id) { + endpoint = Constants.Endpoints.userMessageReaction(message.channel.id, message.id, emoji, null, user.id); + } + return this.rest.makeRequest('delete', endpoint, true).then(() => + this.rest.client.actions.MessageReactionRemove.handle({ + user_id: user.id, + message_id: message.id, + emoji: parseEmoji(emoji), + channel_id: message.channel.id, + }).reaction + ); + } + + removeMessageReactions(message) { + this.rest.makeRequest('delete', Constants.Endpoints.messageReactions(message.channel.id, message.id), true) + .then(() => message); + } + + getMessageReactionUsers(message, emoji, limit = 100) { + return this.rest.makeRequest( + 'get', Constants.Endpoints.messageReaction(message.channel.id, message.id, emoji, limit), true + ); + } + + getMyApplication() { + return this.rest.makeRequest('get', Constants.Endpoints.myApplication, true).then(app => + new ClientOAuth2Application(this.rest.client, app) + ); + } + + setNote(user, note) { + return this.rest.makeRequest('put', Constants.Endpoints.note(user.id), true, { note }).then(() => user); + } +} + +module.exports = RESTMethods; + + +/***/ }, +/* 254 */ +/***/ function(module, exports, __webpack_require__) { + +const RequestHandler = __webpack_require__(128); + +class BurstRequestHandler extends RequestHandler { + constructor(restManager, endpoint) { + super(restManager, endpoint); + this.requestRemaining = 1; + this.first = true; + } + + push(request) { + super.push(request); + this.handle(); + } + + handleNext(time) { + if (this.waiting) return; + this.waiting = true; + this.restManager.client.setTimeout(() => { + this.requestRemaining = this.requestLimit; + this.waiting = false; + this.handle(); + }, time); + } + + execute(item) { + item.request.gen().end((err, res) => { + if (res && res.headers) { + this.requestLimit = res.headers['x-ratelimit-limit']; + this.requestResetTime = Number(res.headers['x-ratelimit-reset']) * 1000; + this.requestRemaining = Number(res.headers['x-ratelimit-remaining']); + this.timeDifference = Date.now() - new Date(res.headers.date).getTime(); + this.handleNext((this.requestResetTime - Date.now()) + this.timeDifference + 1000); + } + if (err) { + if (err.status === 429) { + this.requestRemaining = 0; + this.queue.unshift(item); + this.restManager.client.setTimeout(() => { + this.globalLimit = false; + this.handle(); + }, Number(res.headers['retry-after']) + 500); + if (res.headers['x-ratelimit-global']) { + this.globalLimit = true; + } + } else { + item.reject(err); + } + } else { + this.globalLimit = false; + const data = res && res.body ? res.body : {}; + item.resolve(data); + if (this.first) { + this.first = false; + this.handle(); + } + } + }); + } + + handle() { + super.handle(); + if (this.requestRemaining < 1 || this.queue.length === 0 || this.globalLimit) return; + while (this.queue.length > 0 && this.requestRemaining > 0) { + this.execute(this.queue.shift()); + this.requestRemaining--; + } + } +} + +module.exports = BurstRequestHandler; + + +/***/ }, +/* 255 */ +/***/ function(module, exports, __webpack_require__) { + +const RequestHandler = __webpack_require__(128); + +/** + * Handles API Requests sequentially, i.e. we wait until the current request is finished before moving onto + * the next. This plays a _lot_ nicer in terms of avoiding 429's when there is more than one session of the account, + * but it can be slower. + * @extends {RequestHandler} + * @private + */ +class SequentialRequestHandler extends RequestHandler { + /** + * @param {RESTManager} restManager The REST manager to use + * @param {string} endpoint The endpoint to handle + */ + constructor(restManager, endpoint) { + super(restManager, endpoint); + + /** + * Whether this rate limiter is waiting for a response from a request + * @type {boolean} + */ + this.waiting = false; + + /** + * The endpoint that this handler is handling + * @type {string} + */ + this.endpoint = endpoint; + + /** + * The time difference between Discord's Dates and the local computer's Dates. A positive number means the local + * computer's time is ahead of Discord's. + * @type {number} + */ + this.timeDifference = 0; + } + + push(request) { + super.push(request); + this.handle(); + } + + /** + * Performs a request then resolves a promise to indicate its readiness for a new request + * @param {APIRequest} item The item to execute + * @returns {Promise} + */ + execute(item) { + return new Promise(resolve => { + item.request.gen().end((err, res) => { + if (res && res.headers) { + this.requestLimit = res.headers['x-ratelimit-limit']; + this.requestResetTime = Number(res.headers['x-ratelimit-reset']) * 1000; + this.requestRemaining = Number(res.headers['x-ratelimit-remaining']); + this.timeDifference = Date.now() - new Date(res.headers.date).getTime(); + } + if (err) { + if (err.status === 429) { + this.restManager.client.setTimeout(() => { + this.waiting = false; + this.globalLimit = false; + resolve(); + }, Number(res.headers['retry-after']) + 500); + if (res.headers['x-ratelimit-global']) { + this.globalLimit = true; + } + } else { + this.queue.shift(); + this.waiting = false; + item.reject(err); + resolve(err); + } + } else { + this.queue.shift(); + this.globalLimit = false; + const data = res && res.body ? res.body : {}; + item.resolve(data); + if (this.requestRemaining === 0) { + this.restManager.client.setTimeout(() => { + this.waiting = false; + resolve(data); + }, (this.requestResetTime - Date.now()) + this.timeDifference + 1000); + } else { + this.waiting = false; + resolve(data); + } + } + }); + }); + } + + handle() { + super.handle(); + + if (this.waiting || this.queue.length === 0 || this.globalLimit) return; + this.waiting = true; + + const item = this.queue[0]; + this.execute(item).then(() => this.handle()); + } +} + +module.exports = SequentialRequestHandler; + + +/***/ }, +/* 256 */ +/***/ function(module, exports, __webpack_require__) { + +const Constants = __webpack_require__(2); + +class UserAgentManager { + constructor(restManager) { + this.restManager = restManager; + this._userAgent = { + url: 'https://github.com/hydrabolt/discord.js', + version: Constants.Package.version, + }; + } + + set(info) { + this._userAgent.url = info.url || 'https://github.com/hydrabolt/discord.js'; + this._userAgent.version = info.version || Constants.Package.version; + } + + get userAgent() { + return `DiscordBot (${this._userAgent.url}, ${this._userAgent.version})`; + } +} + +module.exports = UserAgentManager; + + +/***/ }, +/* 257 */ +/***/ function(module, exports, __webpack_require__) { + +const Collection = __webpack_require__(6); +const mergeDefault = __webpack_require__(41); +const Constants = __webpack_require__(2); +const VoiceConnection = __webpack_require__(258); +const EventEmitter = __webpack_require__(3).EventEmitter; + +/** + * Manages all the voice stuff for the Client + * @private + */ +class ClientVoiceManager { + constructor(client) { + /** + * The client that instantiated this voice manager + * @type {Client} + */ + this.client = client; + + /** + * A collection mapping connection IDs to the Connection objects + * @type {Collection} + */ + this.connections = new Collection(); + + /** + * Pending connection attempts, maps guild ID to VoiceChannel + * @type {Collection} + */ + this.pending = new Collection(); + + this.client.on('self.voiceServer', this.onVoiceServer.bind(this)); + this.client.on('self.voiceStateUpdate', this.onVoiceStateUpdate.bind(this)); + } + + onVoiceServer(data) { + if (this.pending.has(data.guild_id)) this.pending.get(data.guild_id).setTokenAndEndpoint(data.token, data.endpoint); + } + + onVoiceStateUpdate(data) { + if (this.pending.has(data.guild_id)) this.pending.get(data.guild_id).setSessionID(data.session_id); + } + + /** + * Sends a request to the main gateway to join a voice channel + * @param {VoiceChannel} channel The channel to join + * @param {Object} [options] The options to provide + */ + sendVoiceStateUpdate(channel, options = {}) { + if (!this.client.user) throw new Error('Unable to join because there is no client user.'); + if (!channel.permissionsFor) { + throw new Error('Channel does not support permissionsFor; is it really a voice channel?'); + } + const permissions = channel.permissionsFor(this.client.user); + if (!permissions) { + throw new Error('There is no permission set for the client user in this channel - are they part of the guild?'); + } + if (!permissions.hasPermission('CONNECT')) { + throw new Error('You do not have permission to join this voice channel.'); + } + + options = mergeDefault({ + guild_id: channel.guild.id, + channel_id: channel.id, + self_mute: false, + self_deaf: false, + }, options); + + this.client.ws.send({ + op: Constants.OPCodes.VOICE_STATE_UPDATE, + d: options, + }); + } + + /** + * Sets up a request to join a voice channel + * @param {VoiceChannel} channel The voice channel to join + * @returns {Promise} + */ + joinChannel(channel) { + return new Promise((resolve, reject) => { + if (this.client.browser) throw new Error('Voice connections are not available in browsers.'); + if (this.pending.get(channel.guild.id)) throw new Error('Already connecting to this guild\'s voice server.'); + if (!channel.joinable) throw new Error('You do not have permission to join this voice channel.'); + + const existingConnection = this.connections.get(channel.guild.id); + if (existingConnection) { + if (existingConnection.channel.id !== channel.id) { + this.sendVoiceStateUpdate(channel); + this.connections.get(channel.guild.id).channel = channel; + } + resolve(existingConnection); + return; + } + + const pendingConnection = new PendingVoiceConnection(this, channel); + this.pending.set(channel.guild.id, pendingConnection); + + pendingConnection.on('fail', reason => { + this.pending.delete(channel.guild.id); + reject(reason); + }); + + pendingConnection.on('pass', voiceConnection => { + this.pending.delete(channel.guild.id); + this.connections.set(channel.guild.id, voiceConnection); + voiceConnection.once('ready', () => resolve(voiceConnection)); + voiceConnection.once('error', reject); + voiceConnection.once('disconnect', () => this.connections.delete(channel.guild.id)); + }); + }); + } +} + +/** + * Represents a Pending Voice Connection + * @private + */ +class PendingVoiceConnection extends EventEmitter { + constructor(voiceManager, channel) { + super(); + + /** + * The ClientVoiceManager that instantiated this pending connection + * @type {ClientVoiceManager} + */ + this.voiceManager = voiceManager; + + /** + * The channel that this pending voice connection will attempt to join + * @type {VoiceChannel} + */ + this.channel = channel; + + /** + * The timeout that will be invoked after 15 seconds signifying a failure to connect + * @type {Timeout} + */ + this.deathTimer = this.voiceManager.client.setTimeout( + () => this.fail(new Error('Connection not established within 15 seconds.')), 15000); + + /** + * An object containing data required to connect to the voice servers with + * @type {object} + */ + this.data = {}; + + this.sendVoiceStateUpdate(); + } + + checkReady() { + if (this.data.token && this.data.endpoint && this.data.session_id) { + this.pass(); + return true; + } else { + return false; + } + } + + /** + * Set the token and endpoint required to connect to the the voice servers + * @param {string} token the token + * @param {string} endpoint the endpoint + * @returns {void} + */ + setTokenAndEndpoint(token, endpoint) { + if (!token) { + this.fail(new Error('Token not provided from voice server packet.')); + return; + } + if (!endpoint) { + this.fail(new Error('Endpoint not provided from voice server packet.')); + return; + } + if (this.data.token) { + this.fail(new Error('There is already a registered token for this connection.')); + return; + } + if (this.data.endpoint) { + this.fail(new Error('There is already a registered endpoint for this connection.')); + return; + } + + endpoint = endpoint.match(/([^:]*)/)[0]; + + if (!endpoint) { + this.fail(new Error('Failed to find an endpoint.')); + return; + } + + this.data.token = token; + this.data.endpoint = endpoint; + + this.checkReady(); + } + + /** + * Sets the Session ID for the connection + * @param {string} sessionID the session ID + */ + setSessionID(sessionID) { + if (!sessionID) { + this.fail(new Error('Session ID not supplied.')); + return; + } + if (this.data.session_id) { + this.fail(new Error('There is already a registered session ID for this connection.')); + return; + } + this.data.session_id = sessionID; + + this.checkReady(); + } + + clean() { + clearInterval(this.deathTimer); + this.emit('fail', new Error('Clean-up triggered :fourTriggered:')); + } + + pass() { + clearInterval(this.deathTimer); + this.emit('pass', this.upgrade()); + } + + fail(reason) { + this.emit('fail', reason); + this.clean(); + } + + sendVoiceStateUpdate() { + try { + this.voiceManager.sendVoiceStateUpdate(this.channel); + } catch (error) { + this.fail(error); + } + } + + /** + * Upgrades this Pending Connection to a full Voice Connection + * @returns {VoiceConnection} + */ + upgrade() { + return new VoiceConnection(this); + } +} + +module.exports = ClientVoiceManager; + + +/***/ }, +/* 258 */ +/***/ function(module, exports, __webpack_require__) { + +const VoiceWebSocket = __webpack_require__(260); +const VoiceUDP = __webpack_require__(259); +const Constants = __webpack_require__(2); +const AudioPlayer = __webpack_require__(268); +const VoiceReceiver = __webpack_require__(270); +const EventEmitter = __webpack_require__(3).EventEmitter; +const fs = __webpack_require__(10); + +/** + * Represents a connection to a voice channel in Discord. + * ```js + * // obtained using: + * voiceChannel.join().then(connection => { + * + * }); + * ``` + * @extends {EventEmitter} + */ +class VoiceConnection extends EventEmitter { + constructor(pendingConnection) { + super(); + + /** + * The Voice Manager that instantiated this connection + * @type {ClientVoiceManager} + */ + this.voiceManager = pendingConnection.voiceManager; + + /** + * The voice channel this connection is currently serving + * @type {VoiceChannel} + */ + this.channel = pendingConnection.channel; + + /** + * Whether we're currently transmitting audio + * @type {boolean} + */ + this.speaking = false; + + /** + * An array of Voice Receivers that have been created for this connection + * @type {VoiceReceiver[]} + */ + this.receivers = []; + + /** + * The authentication data needed to connect to the voice server + * @type {object} + * @private + */ + this.authentication = pendingConnection.data; + + /** + * The audio player for this voice connection + * @type {AudioPlayer} + */ + this.player = new AudioPlayer(this); + + this.player.on('debug', m => { + /** + * Debug info from the connection + * @event VoiceConnection#debug + * @param {string} message the debug message + */ + this.emit('debug', `audio player - ${m}`); + }); + + this.player.on('error', e => { + /** + * Warning info from the connection + * @event VoiceConnection#warn + * @param {string|Error} warning the warning + */ + this.emit('warn', e); + this.player.cleanup(); + }); + + /** + * Map SSRC to speaking values + * @type {Map} + * @private + */ + this.ssrcMap = new Map(); + + /** + * Whether this connection is ready + * @type {boolean} + * @private + */ + this.ready = false; + + /** + * Object that wraps contains the `ws` and `udp` sockets of this voice connection + * @type {object} + * @private + */ + this.sockets = {}; + this.connect(); + } + + /** + * Sets whether the voice connection should display as "speaking" or not + * @param {boolean} value whether or not to speak + * @private + */ + setSpeaking(value) { + if (this.speaking === value) return; + this.speaking = value; + this.sockets.ws.sendPacket({ + op: Constants.VoiceOPCodes.SPEAKING, + d: { + speaking: true, + delay: 0, + }, + }).catch(e => { + this.emit('debug', e); + }); + } + + /** + * Disconnect the voice connection, causing a disconnect and closing event to be emitted. + */ + disconnect() { + this.emit('closing'); + this.voiceManager.client.ws.send({ + op: Constants.OPCodes.VOICE_STATE_UPDATE, + d: { + guild_id: this.channel.guild.id, + channel_id: null, + self_mute: false, + self_deaf: false, + }, + }); + /** + * Emitted when the voice connection disconnects + * @event VoiceConnection#disconnect + */ + this.emit('disconnect'); + } + + /** + * Connect the voice connection + * @private + */ + connect() { + if (this.sockets.ws) throw new Error('There is already an existing WebSocket connection.'); + if (this.sockets.udp) throw new Error('There is already an existing UDP connection.'); + this.sockets.ws = new VoiceWebSocket(this); + this.sockets.udp = new VoiceUDP(this); + this.sockets.ws.on('error', e => this.emit('error', e)); + this.sockets.udp.on('error', e => this.emit('error', e)); + this.sockets.ws.once('ready', d => { + this.authentication.port = d.port; + this.authentication.ssrc = d.ssrc; + /** + * Emitted whenever the connection encounters an error. + * @event VoiceConnection#error + * @param {Error} error the encountered error + */ + this.sockets.udp.findEndpointAddress() + .then(address => { + this.sockets.udp.createUDPSocket(address); + }, e => this.emit('error', e)); + }); + this.sockets.ws.once('sessionDescription', (mode, secret) => { + this.authentication.encryptionMode = mode; + this.authentication.secretKey = secret; + /** + * Emitted once the connection is ready, when a promise to join a voice channel resolves, + * the connection will already be ready. + * @event VoiceConnection#ready + */ + this.emit('ready'); + this.ready = true; + }); + this.sockets.ws.on('speaking', data => { + const guild = this.channel.guild; + const user = this.voiceManager.client.users.get(data.user_id); + this.ssrcMap.set(+data.ssrc, user); + if (!data.speaking) { + for (const receiver of this.receivers) { + const opusStream = receiver.opusStreams.get(user.id); + const pcmStream = receiver.pcmStreams.get(user.id); + if (opusStream) { + opusStream.push(null); + opusStream.open = false; + receiver.opusStreams.delete(user.id); + } + if (pcmStream) { + pcmStream.push(null); + pcmStream.open = false; + receiver.pcmStreams.delete(user.id); + } + } + } + /** + * Emitted whenever a user starts/stops speaking + * @event VoiceConnection#speaking + * @param {User} user The user that has started/stopped speaking + * @param {boolean} speaking Whether or not the user is speaking + */ + if (this.ready) this.emit('speaking', user, data.speaking); + guild._memberSpeakUpdate(data.user_id, data.speaking); + }); + } + + /** + * Options that can be passed to stream-playing methods: + * @typedef {Object} StreamOptions + * @property {number} [seek=0] The time to seek to + * @property {number} [volume=1] The volume to play at + * @property {number} [passes=1] How many times to send the voice packet to reduce packet loss + */ + + /** + * Play the given file in the voice connection. + * @param {string} file The path to the file + * @param {StreamOptions} [options] Options for playing the stream + * @returns {StreamDispatcher} + * @example + * // play files natively + * voiceChannel.join() + * .then(connection => { + * const dispatcher = connection.playFile('C:/Users/Discord/Desktop/music.mp3'); + * }) + * .catch(console.error); + */ + playFile(file, options) { + return this.playStream(fs.createReadStream(file), options); + } + + /** + * Plays and converts an audio stream in the voice connection. + * @param {ReadableStream} stream The audio stream to play + * @param {StreamOptions} [options] Options for playing the stream + * @returns {StreamDispatcher} + * @example + * // play streams using ytdl-core + * const ytdl = require('ytdl-core'); + * const streamOptions = { seek: 0, volume: 1 }; + * voiceChannel.join() + * .then(connection => { + * const stream = ytdl('https://www.youtube.com/watch?v=XAWgeLF9EVQ', {filter : 'audioonly'}); + * const dispatcher = connection.playStream(stream, streamOptions); + * }) + * .catch(console.error); + */ + playStream(stream, { seek = 0, volume = 1, passes = 1 } = {}) { + const options = { seek, volume, passes }; + return this.player.playUnknownStream(stream, options); + } + + /** + * Plays a stream of 16-bit signed stereo PCM at 48KHz. + * @param {ReadableStream} stream The audio stream to play. + * @param {StreamOptions} [options] Options for playing the stream + * @returns {StreamDispatcher} + */ + playConvertedStream(stream, { seek = 0, volume = 1, passes = 1 } = {}) { + const options = { seek, volume, passes }; + return this.player.playPCMStream(stream, options); + } + + /** + * Creates a VoiceReceiver so you can start listening to voice data. It's recommended to only create one of these. + * @returns {VoiceReceiver} + */ + createReceiver() { + const receiver = new VoiceReceiver(this); + this.receivers.push(receiver); + return receiver; + } +} + +module.exports = VoiceConnection; + + +/***/ }, +/* 259 */ +/***/ function(module, exports, __webpack_require__) { + +/* WEBPACK VAR INJECTION */(function(Buffer) {const udp = __webpack_require__(10); +const dns = __webpack_require__(237); +const Constants = __webpack_require__(2); +const EventEmitter = __webpack_require__(3).EventEmitter; + +/** + * Represents a UDP Client for a Voice Connection + * @extends {EventEmitter} + * @private + */ +class VoiceConnectionUDPClient extends EventEmitter { + constructor(voiceConnection) { + super(); + + /** + * The voice connection that this UDP client serves + * @type {VoiceConnection} + */ + this.voiceConnection = voiceConnection; + + /** + * The UDP socket + * @type {?Socket} + */ + this.socket = null; + + /** + * The address of the discord voice server + * @type {?string} + */ + this.discordAddress = null; + + /** + * The local IP address + * @type {?string} + */ + this.localAddress = null; + + /** + * The local port + * @type {?string} + */ + this.localPort = null; + + this.voiceConnection.on('closing', this.shutdown.bind(this)); + } + + shutdown() { + if (this.socket) { + try { + this.socket.close(); + } catch (e) { + return; + } + this.socket = null; + } + } + + /** + * The port of the discord voice server + * @type {number} + * @readonly + */ + get discordPort() { + return this.voiceConnection.authentication.port; + } + + /** + * Tries to resolve the voice server endpoint to an address + * @returns {Promise} + */ + findEndpointAddress() { + return new Promise((resolve, reject) => { + dns.lookup(this.voiceConnection.authentication.endpoint, (error, address) => { + if (error) { + reject(error); + return; + } + this.discordAddress = address; + resolve(address); + }); + }); + } + + /** + * Send a packet to the UDP client + * @param {Object} packet the packet to send + * @returns {Promise} + */ + send(packet) { + return new Promise((resolve, reject) => { + if (!this.socket) throw new Error('Tried to send a UDP packet, but there is no socket available.'); + if (!this.discordAddress || !this.discordPort) throw new Error('Malformed UDP address or port.'); + this.socket.send(packet, 0, packet.length, this.discordPort, this.discordAddress, error => { + if (error) reject(error); else resolve(packet); + }); + }); + } + + createUDPSocket(address) { + this.discordAddress = address; + const socket = this.socket = udp.createSocket('udp4'); + + socket.once('message', message => { + const packet = parseLocalPacket(message); + if (packet.error) { + this.emit('error', packet.error); + return; + } + + this.localAddress = packet.address; + this.localPort = packet.port; + + this.voiceConnection.sockets.ws.sendPacket({ + op: Constants.VoiceOPCodes.SELECT_PROTOCOL, + d: { + protocol: 'udp', + data: { + address: packet.address, + port: packet.port, + mode: 'xsalsa20_poly1305', + }, + }, + }); + }); + + const blankMessage = new Buffer(70); + blankMessage.writeUIntBE(this.voiceConnection.authentication.ssrc, 0, 4); + this.send(blankMessage); + } +} + +function parseLocalPacket(message) { + try { + const packet = new Buffer(message); + let address = ''; + for (let i = 4; i < packet.indexOf(0, i); i++) address += String.fromCharCode(packet[i]); + const port = parseInt(packet.readUIntLE(packet.length - 2, 2).toString(10), 10); + return { address, port }; + } catch (error) { + return { error }; + } +} + +module.exports = VoiceConnectionUDPClient; + +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer)) + +/***/ }, +/* 260 */ +/***/ function(module, exports, __webpack_require__) { + +const WebSocket = __webpack_require__(119); +const Constants = __webpack_require__(2); +const SecretKey = __webpack_require__(271); +const EventEmitter = __webpack_require__(3).EventEmitter; + +/** + * Represents a Voice Connection's WebSocket + * @extends {EventEmitter} + * @private + */ +class VoiceWebSocket extends EventEmitter { + constructor(voiceConnection) { + super(); + + /** + * The Voice Connection that this WebSocket serves + * @type {VoiceConnection} + */ + this.voiceConnection = voiceConnection; + + /** + * How many connection attempts have been made + * @type {number} + */ + this.attempts = 0; + + this.connect(); + this.dead = false; + this.voiceConnection.on('closing', this.shutdown.bind(this)); + } + + shutdown() { + this.dead = true; + this.reset(); + } + + /** + * The client of this voice websocket + * @type {Client} + * @readonly + */ + get client() { + return this.voiceConnection.voiceManager.client; + } + + /** + * Resets the current WebSocket + */ + reset() { + if (this.ws) { + if (this.ws.readyState !== WebSocket.CLOSED) this.ws.close(); + this.ws = null; + } + this.clearHeartbeat(); + } + + /** + * Starts connecting to the Voice WebSocket Server. + */ + connect() { + if (this.dead) return; + if (this.ws) this.reset(); + if (this.attempts > 5) { + this.emit('error', new Error(`Too many connection attempts (${this.attempts}).`)); + return; + } + + this.attempts++; + + /** + * The actual WebSocket used to connect to the Voice WebSocket Server. + * @type {WebSocket} + */ + this.ws = new WebSocket(`wss://${this.voiceConnection.authentication.endpoint}`); + this.ws.onopen = this.onOpen.bind(this); + this.ws.onmessage = this.onMessage.bind(this); + this.ws.onclose = this.onClose.bind(this); + this.ws.onerror = this.onError.bind(this); + } + + /** + * Sends data to the WebSocket if it is open. + * @param {string} data the data to send to the WebSocket + * @returns {Promise} + */ + send(data) { + return new Promise((resolve, reject) => { + if (!this.ws || this.ws.readyState !== WebSocket.OPEN) { + throw new Error(`Voice websocket not open to send ${data}.`); + } + this.ws.send(data, null, error => { + if (error) reject(error); else resolve(data); + }); + }); + } + + /** + * JSON.stringify's a packet and then sends it to the WebSocket Server. + * @param {Object} packet the packet to send + * @returns {Promise} + */ + sendPacket(packet) { + try { + packet = JSON.stringify(packet); + } catch (error) { + return Promise.reject(error); + } + return this.send(packet); + } + + /** + * Called whenever the WebSocket opens + */ + onOpen() { + this.sendPacket({ + op: Constants.OPCodes.DISPATCH, + d: { + server_id: this.voiceConnection.channel.guild.id, + user_id: this.client.user.id, + token: this.voiceConnection.authentication.token, + session_id: this.voiceConnection.authentication.session_id, + }, + }).catch(() => { + this.emit('error', new Error('Tried to send join packet, but the WebSocket is not open.')); + }); + } + + /** + * Called whenever a message is received from the WebSocket + * @param {MessageEvent} event the message event that was received + * @returns {void} + */ + onMessage(event) { + try { + return this.onPacket(JSON.parse(event.data)); + } catch (error) { + return this.onError(error); + } + } + + /** + * Called whenever the connection to the WebSocket Server is lost + */ + onClose() { + if (!this.dead) this.client.setTimeout(this.connect.bind(this), this.attempts * 1000); + } + + /** + * Called whenever an error occurs with the WebSocket. + * @param {Error} error the error that occurred + */ + onError(error) { + this.emit('error', error); + } + + /** + * Called whenever a valid packet is received from the WebSocket + * @param {Object} packet the received packet + */ + onPacket(packet) { + switch (packet.op) { + case Constants.VoiceOPCodes.READY: + this.setHeartbeat(packet.d.heartbeat_interval); + /** + * Emitted once the voice websocket receives the ready packet + * @param {Object} packet the received packet + * @event VoiceWebSocket#ready + */ + this.emit('ready', packet.d); + break; + case Constants.VoiceOPCodes.SESSION_DESCRIPTION: + /** + * Emitted once the Voice Websocket receives a description of this voice session + * @param {string} encryptionMode the type of encryption being used + * @param {SecretKey} secretKey the secret key used for encryption + * @event VoiceWebSocket#sessionDescription + */ + this.emit('sessionDescription', packet.d.mode, new SecretKey(packet.d.secret_key)); + break; + case Constants.VoiceOPCodes.SPEAKING: + /** + * Emitted whenever a speaking packet is received + * @param {Object} data + * @event VoiceWebSocket#speaking + */ + this.emit('speaking', packet.d); + break; + default: + /** + * Emitted when an unhandled packet is received + * @param {Object} packet + * @event VoiceWebSocket#unknownPacket + */ + this.emit('unknownPacket', packet); + break; + } + } + + /** + * Sets an interval at which to send a heartbeat packet to the WebSocket + * @param {number} interval the interval at which to send a heartbeat packet + */ + setHeartbeat(interval) { + if (!interval || isNaN(interval)) { + this.onError(new Error('Tried to set voice heartbeat but no valid interval was specified.')); + return; + } + if (this.heartbeatInterval) { + /** + * Emitted whenver the voice websocket encounters a non-fatal error + * @param {string} warn the warning + * @event VoiceWebSocket#warn + */ + this.emit('warn', 'A voice heartbeat interval is being overwritten'); + clearInterval(this.heartbeatInterval); + } + this.heartbeatInterval = this.client.setInterval(this.sendHeartbeat.bind(this), interval); + } + + /** + * Clears a heartbeat interval, if one exists + */ + clearHeartbeat() { + if (!this.heartbeatInterval) { + this.emit('warn', 'Tried to clear a heartbeat interval that does not exist'); + return; + } + clearInterval(this.heartbeatInterval); + this.heartbeatInterval = null; + } + + /** + * Sends a heartbeat packet + */ + sendHeartbeat() { + this.sendPacket({ op: Constants.VoiceOPCodes.HEARTBEAT, d: null }).catch(() => { + this.emit('warn', 'Tried to send heartbeat, but connection is not open'); + this.clearHeartbeat(); + }); + } +} + +module.exports = VoiceWebSocket; + + +/***/ }, +/* 261 */ +/***/ function(module, exports, __webpack_require__) { + +/* WEBPACK VAR INJECTION */(function(Buffer) {const EventEmitter = __webpack_require__(3).EventEmitter; +const NaCl = __webpack_require__(116); + +const nonce = new Buffer(24); +nonce.fill(0); + +/** + * The class that sends voice packet data to the voice connection. + * ```js + * // obtained using: + * voiceChannel.join().then(connection => { + * // you can play a file or a stream here: + * connection.playFile('./file.mp3').then(dispatcher => { + * + * }); + * }); + * ``` + * @extends {EventEmitter} + */ +class StreamDispatcher extends EventEmitter { + constructor(player, stream, sd, streamOptions) { + super(); + this.player = player; + this.stream = stream; + this.streamingData = { + channels: 2, + count: 0, + sequence: sd.sequence, + timestamp: sd.timestamp, + pausedTime: 0, + }; + this._startStreaming(); + this._triggered = false; + this._volume = streamOptions.volume; + + /** + * How many passes the dispatcher should take when sending packets to reduce packet loss. Values over 5 + * aren't recommended, as it means you are using 5x more bandwidth. You _can_ edit this at runtime. + * @type {number} + */ + this.passes = streamOptions.passes || 1; + + /** + * Whether playing is paused + * @type {boolean} + */ + this.paused = false; + + this.setVolume(streamOptions.volume || 1); + } + + /** + * How long the stream dispatcher has been "speaking" for + * @type {number} + * @readonly + */ + get time() { + return this.streamingData.count * (this.streamingData.length || 0); + } + + /** + * The total time, taking into account pauses and skips, that the dispatcher has been streaming for + * @type {number} + * @readonly + */ + get totalStreamTime() { + return this.time + this.streamingData.pausedTime; + } + + /** + * The volume of the stream, relative to the stream's input volume + * @type {number} + * @readonly + */ + get volume() { + return this._volume; + } + + /** + * Sets the volume relative to the input stream - i.e. 1 is normal, 0.5 is half, 2 is double. + * @param {number} volume The volume that you want to set + */ + setVolume(volume) { + this._volume = volume; + } + + /** + * Set the volume in decibels + * @param {number} db The decibels + */ + setVolumeDecibels(db) { + this._volume = Math.pow(10, db / 20); + } + + /** + * Set the volume so that a perceived value of 0.5 is half the perceived volume etc. + * @param {number} value The value for the volume + */ + setVolumeLogarithmic(value) { + this._volume = Math.pow(value, 1.660964); + } + + /** + * Stops sending voice packets to the voice connection (stream may still progress however) + */ + pause() { + this._setPaused(true); + } + + /** + * Resumes sending voice packets to the voice connection (may be further on in the stream than when paused) + */ + resume() { + this._setPaused(false); + } + + /** + * Stops the current stream permanently and emits an `end` event. + */ + end() { + this._triggerTerminalState('end', 'user requested'); + } + + _setSpeaking(value) { + this.speaking = value; + /** + * Emitted when the dispatcher starts/stops speaking + * @event StreamDispatcher#speaking + * @param {boolean} value Whether or not the dispatcher is speaking + */ + this.emit('speaking', value); + } + + _sendBuffer(buffer, sequence, timestamp) { + let repeats = this.passes; + const packet = this._createPacket(sequence, timestamp, this.player.opusEncoder.encode(buffer)); + while (repeats--) { + this.player.voiceConnection.sockets.udp.send(packet) + .catch(e => this.emit('debug', `Failed to send a packet ${e}`)); + } + } + + _createPacket(sequence, timestamp, buffer) { + const packetBuffer = new Buffer(buffer.length + 28); + packetBuffer.fill(0); + packetBuffer[0] = 0x80; + packetBuffer[1] = 0x78; + + packetBuffer.writeUIntBE(sequence, 2, 2); + packetBuffer.writeUIntBE(timestamp, 4, 4); + packetBuffer.writeUIntBE(this.player.voiceConnection.authentication.ssrc, 8, 4); + + packetBuffer.copy(nonce, 0, 0, 12); + buffer = NaCl.secretbox(buffer, nonce, this.player.voiceConnection.authentication.secretKey.key); + + for (let i = 0; i < buffer.length; i++) packetBuffer[i + 12] = buffer[i]; + + return packetBuffer; + } + + _applyVolume(buffer) { + if (this._volume === 1) return buffer; + + const out = new Buffer(buffer.length); + for (let i = 0; i < buffer.length; i += 2) { + if (i >= buffer.length - 1) break; + const uint = Math.min(32767, Math.max(-32767, Math.floor(this._volume * buffer.readInt16LE(i)))); + out.writeInt16LE(uint, i); + } + + return out; + } + + _send() { + try { + if (this._triggered) { + this._setSpeaking(false); + return; + } + + const data = this.streamingData; + + if (data.missed >= 5) { + this._triggerTerminalState('end', 'Stream is not generating quickly enough.'); + return; + } + + if (this.paused) { + // data.timestamp = data.timestamp + 4294967295 ? data.timestamp + 960 : 0; + data.pausedTime += data.length * 10; + this.player.voiceConnection.voiceManager.client.setTimeout(() => this._send(), data.length * 10); + return; + } + + this._setSpeaking(true); + + if (!data.startTime) { + /** + * Emitted once the dispatcher starts streaming + * @event StreamDispatcher#start + */ + this.emit('start'); + data.startTime = Date.now(); + } + + const bufferLength = 1920 * data.channels; + let buffer = this.stream.read(bufferLength); + if (!buffer) { + data.missed++; + data.pausedTime += data.length * 10; + this.player.voiceConnection.voiceManager.client.setTimeout(() => this._send(), data.length * 10); + return; + } + + data.missed = 0; + + if (buffer.length !== bufferLength) { + const newBuffer = new Buffer(bufferLength).fill(0); + buffer.copy(newBuffer); + buffer = newBuffer; + } + + buffer = this._applyVolume(buffer); + + data.count++; + data.sequence = (data.sequence + 1) < 65536 ? data.sequence + 1 : 0; + data.timestamp = data.timestamp + 4294967295 ? data.timestamp + 960 : 0; + + this._sendBuffer(buffer, data.sequence, data.timestamp); + + const nextTime = data.length + (data.startTime + data.pausedTime + (data.count * data.length) - Date.now()); + this.player.voiceConnection.voiceManager.client.setTimeout(() => this._send(), nextTime); + } catch (e) { + this._triggerTerminalState('error', e); + } + } + + _triggerEnd() { + /** + * Emitted once the stream has ended. Attach a `once` listener to this. + * @event StreamDispatcher#end + */ + this.emit('end'); + } + + _triggerError(err) { + this.emit('end'); + /** + * Emitted once the stream has encountered an error. Attach a `once` listener to this. Also emits `end`. + * @event StreamDispatcher#error + * @param {Error} err The encountered error + */ + this.emit('error', err); + } + + _triggerTerminalState(state, err) { + if (this._triggered) return; + /** + * Emitted when the stream wants to give debug information. + * @event StreamDispatcher#debug + * @param {string} information The debug information + */ + this.emit('debug', `Triggered terminal state ${state} - stream is now dead`); + this._triggered = true; + this._setSpeaking(false); + switch (state) { + case 'end': + this._triggerEnd(err); + break; + case 'error': + this._triggerError(err); + break; + default: + this.emit('error', 'Unknown trigger state'); + break; + } + } + + _startStreaming() { + if (!this.stream) { + this.emit('error', 'No stream'); + return; + } + + this.stream.on('end', err => this._triggerTerminalState('end', err)); + this.stream.on('error', err => this._triggerTerminalState('error', err)); + + const data = this.streamingData; + data.length = 20; + data.missed = 0; + + this.stream.once('readable', () => this._send()); + } + + _setPaused(paused) { + if (paused) { + this.paused = true; + this._setSpeaking(false); + } else { + this.paused = false; + this._setSpeaking(true); + } + } +} + +module.exports = StreamDispatcher; + +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer)) + +/***/ }, +/* 262 */ +/***/ function(module, exports, __webpack_require__) { + +const OpusEngine = __webpack_require__(129); + +let opus; + +class NodeOpusEngine extends OpusEngine { + constructor(player) { + super(player); + try { + opus = __webpack_require__(!(function webpackMissingModule() { var e = new Error("Cannot find module \"node-opus\""); e.code = 'MODULE_NOT_FOUND'; throw e; }())); + } catch (err) { + throw err; + } + this.encoder = new opus.OpusEncoder(48000, 2); + } + + encode(buffer) { + super.encode(buffer); + return this.encoder.encode(buffer, 1920); + } + + decode(buffer) { + super.decode(buffer); + return this.encoder.decode(buffer, 1920); + } +} + +module.exports = NodeOpusEngine; + + +/***/ }, +/* 263 */ +/***/ function(module, exports, __webpack_require__) { + +const list = [ + __webpack_require__(262), + __webpack_require__(264), +]; + +function fetch(Encoder) { + try { + return new Encoder(); + } catch (err) { + return null; + } +} + +exports.add = encoder => { + list.push(encoder); +}; + +exports.fetch = () => { + for (const encoder of list) { + const fetched = fetch(encoder); + if (fetched) return fetched; + } + throw new Error('Couldn\'t find an Opus engine.'); +}; + + +/***/ }, +/* 264 */ +/***/ function(module, exports, __webpack_require__) { + +const OpusEngine = __webpack_require__(129); + +let OpusScript; + +class NodeOpusEngine extends OpusEngine { + constructor(player) { + super(player); + try { + OpusScript = __webpack_require__(204); + } catch (err) { + throw err; + } + this.encoder = new OpusScript(48000, 2); + } + + encode(buffer) { + super.encode(buffer); + return this.encoder.encode(buffer, 960); + } + + decode(buffer) { + super.decode(buffer); + return this.encoder.decode(buffer); + } +} + +module.exports = NodeOpusEngine; + + +/***/ }, +/* 265 */ +/***/ function(module, exports, __webpack_require__) { + +const EventEmitter = __webpack_require__(3).EventEmitter; + +class ConverterEngine extends EventEmitter { + constructor(player) { + super(); + this.player = player; + } + + createConvertStream() { + return; + } +} + +module.exports = ConverterEngine; + + +/***/ }, +/* 266 */ +/***/ function(module, exports, __webpack_require__) { + +exports.fetch = () => __webpack_require__(267); + + +/***/ }, +/* 267 */ +/***/ function(module, exports, __webpack_require__) { + +const ConverterEngine = __webpack_require__(265); +const ChildProcess = __webpack_require__(10); +const EventEmitter = __webpack_require__(3).EventEmitter; + +class PCMConversionProcess extends EventEmitter { + constructor(process) { + super(); + this.process = process; + this.input = null; + this.process.on('error', e => this.emit('error', e)); + } + + setInput(stream) { + this.input = stream; + stream.pipe(this.process.stdin, { end: false }); + this.input.on('error', e => this.emit('error', e)); + this.process.stdin.on('error', e => this.emit('error', e)); + } + + destroy() { + this.emit('debug', 'destroying a ffmpeg process:'); + if (this.input && this.input.unpipe && this.process.stdin) { + this.input.unpipe(this.process.stdin); + this.emit('unpiped the user input stream from the process input stream'); + } + if (this.process.stdin) { + this.process.stdin.end(); + this.emit('ended the process stdin'); + } + if (this.process.stdin.destroy) { + this.process.stdin.destroy(); + this.emit('destroyed the process stdin'); + } + if (this.process.kill) { + this.process.kill(); + this.emit('killed the process'); + } + } + +} + +class FfmpegConverterEngine extends ConverterEngine { + constructor(player) { + super(player); + this.command = chooseCommand(); + } + + handleError(encoder, err) { + if (encoder.destroy) encoder.destroy(); + this.emit('error', err); + } + + createConvertStream(seek = 0) { + super.createConvertStream(); + const encoder = ChildProcess.spawn(this.command, [ + '-analyzeduration', '0', + '-loglevel', '0', + '-i', '-', + '-f', 's16le', + '-ar', '48000', + '-ac', '2', + '-ss', String(seek), + 'pipe:1', + ], { stdio: ['pipe', 'pipe', 'ignore'] }); + return new PCMConversionProcess(encoder); + } +} + +function chooseCommand() { + for (const cmd of ['ffmpeg', 'avconv', './ffmpeg', './avconv']) { + if (!ChildProcess.spawnSync(cmd, ['-h']).error) return cmd; + } + throw new Error( + 'FFMPEG was not found on your system, so audio cannot be played. ' + + 'Please make sure FFMPEG is installed and in your PATH.' + ); +} + +module.exports = FfmpegConverterEngine; + + +/***/ }, +/* 268 */ +/***/ function(module, exports, __webpack_require__) { + +const PCMConverters = __webpack_require__(266); +const OpusEncoders = __webpack_require__(263); +const EventEmitter = __webpack_require__(3).EventEmitter; +const StreamDispatcher = __webpack_require__(261); + +/** + * Represents the Audio Player of a Voice Connection + * @extends {EventEmitter} + * @private + */ +class AudioPlayer extends EventEmitter { + constructor(voiceConnection) { + super(); + /** + * The voice connection the player belongs to + * @type {VoiceConnection} + */ + this.voiceConnection = voiceConnection; + this.audioToPCM = new (PCMConverters.fetch())(); + this.opusEncoder = OpusEncoders.fetch(); + this.currentConverter = null; + /** + * The current stream dispatcher, if a stream is being played + * @type {StreamDispatcher} + */ + this.dispatcher = null; + this.audioToPCM.on('error', e => this.emit('error', e)); + this.streamingData = { + channels: 2, + count: 0, + sequence: 0, + timestamp: 0, + pausedTime: 0, + }; + this.voiceConnection.on('closing', () => this.cleanup(null, 'voice connection closing')); + } + + playUnknownStream(stream, { seek = 0, volume = 1, passes = 1 } = {}) { + const options = { seek, volume, passes }; + stream.on('end', () => { + this.emit('debug', 'Input stream to converter has ended'); + }); + stream.on('error', e => this.emit('error', e)); + const conversionProcess = this.audioToPCM.createConvertStream(options.seek); + conversionProcess.on('error', e => this.emit('error', e)); + conversionProcess.setInput(stream); + return this.playPCMStream(conversionProcess.process.stdout, conversionProcess, options); + } + + cleanup(checkStream, reason) { + // cleanup is a lot less aggressive than v9 because it doesn't try to kill every single stream it is aware of + this.emit('debug', `Clean up triggered due to ${reason}`); + const filter = checkStream && this.dispatcher && this.dispatcher.stream === checkStream; + if (this.currentConverter && (checkStream ? filter : true)) { + this.currentConverter.destroy(); + this.currentConverter = null; + } + } + + playPCMStream(stream, converter, { seek = 0, volume = 1, passes = 1 } = {}) { + const options = { seek, volume, passes }; + stream.on('end', () => this.emit('debug', 'PCM input stream ended')); + this.cleanup(null, 'outstanding play stream'); + this.currentConverter = converter; + if (this.dispatcher) { + this.streamingData = this.dispatcher.streamingData; + } + stream.on('error', e => this.emit('error', e)); + const dispatcher = new StreamDispatcher(this, stream, this.streamingData, options); + dispatcher.on('error', e => this.emit('error', e)); + dispatcher.on('end', () => this.cleanup(dispatcher.stream, 'dispatcher ended')); + dispatcher.on('speaking', value => this.voiceConnection.setSpeaking(value)); + this.dispatcher = dispatcher; + dispatcher.on('debug', m => this.emit('debug', `Stream dispatch - ${m}`)); + return dispatcher; + } + +} + +module.exports = AudioPlayer; + + +/***/ }, +/* 269 */ +/***/ function(module, exports, __webpack_require__) { + +const Readable = __webpack_require__(9).Readable; + +class VoiceReadable extends Readable { + constructor() { + super(); + this._packets = []; + this.open = true; + } + + _read() { + return; + } + + _push(d) { + if (this.open) this.push(d); + } +} + +module.exports = VoiceReadable; + + +/***/ }, +/* 270 */ +/***/ function(module, exports, __webpack_require__) { + +/* WEBPACK VAR INJECTION */(function(Buffer) {const EventEmitter = __webpack_require__(3).EventEmitter; +const NaCl = __webpack_require__(116); +const Readable = __webpack_require__(269); + +const nonce = new Buffer(24); +nonce.fill(0); + +/** + * Receives voice data from a voice connection. + * ```js + * // obtained using: + * voiceChannel.join().then(connection => { + * const receiver = connection.createReceiver(); + * }); + * ``` + * @extends {EventEmitter} + */ +class VoiceReceiver extends EventEmitter { + constructor(connection) { + super(); + /* + need a queue because we don't get the ssrc of the user speaking until after the first few packets, + so we queue up unknown SSRCs until they become known, then empty the queue. + */ + this.queues = new Map(); + this.pcmStreams = new Map(); + this.opusStreams = new Map(); + + /** + * Whether or not this receiver has been destroyed. + * @type {boolean} + */ + this.destroyed = false; + + /** + * The VoiceConnection that instantiated this + * @type {VoiceConnection} + */ + this.voiceConnection = connection; + + this._listener = msg => { + const ssrc = +msg.readUInt32BE(8).toString(10); + const user = this.voiceConnection.ssrcMap.get(ssrc); + if (!user) { + if (!this.queues.has(ssrc)) this.queues.set(ssrc, []); + this.queues.get(ssrc).push(msg); + } else { + if (this.queues.get(ssrc)) { + this.queues.get(ssrc).push(msg); + this.queues.get(ssrc).map(m => this.handlePacket(m, user)); + this.queues.delete(ssrc); + return; + } + this.handlePacket(msg, user); + } + }; + this.voiceConnection.sockets.udp.socket.on('message', this._listener); + } + + /** + * If this VoiceReceiver has been destroyed, running `recreate()` will recreate the listener. + * This avoids you having to create a new receiver. + * Any streams that you had prior to destroying the receiver will not be recreated. + */ + recreate() { + if (!this.destroyed) return; + this.voiceConnection.sockets.udp.socket.on('message', this._listener); + this.destroyed = false; + return; + } + + /** + * Destroy this VoiceReceiver, also ending any streams that it may be controlling. + */ + destroy() { + this.voiceConnection.sockets.udp.socket.removeListener('message', this._listener); + for (const stream of this.pcmStreams) { + stream[1]._push(null); + this.pcmStreams.delete(stream[0]); + } + for (const stream of this.opusStreams) { + stream[1]._push(null); + this.opusStreams.delete(stream[0]); + } + this.destroyed = true; + } + + /** + * Creates a readable stream for a user that provides opus data while the user is speaking. When the user + * stops speaking, the stream is destroyed. + * @param {UserResolvable} user The user to create the stream for + * @returns {ReadableStream} + */ + createOpusStream(user) { + user = this.voiceConnection.voiceManager.client.resolver.resolveUser(user); + if (!user) throw new Error('Couldn\'t resolve the user to create Opus stream.'); + if (this.opusStreams.get(user.id)) throw new Error('There is already an existing stream for that user.'); + const stream = new Readable(); + this.opusStreams.set(user.id, stream); + return stream; + } + + /** + * Creates a readable stream for a user that provides PCM data while the user is speaking. When the user + * stops speaking, the stream is destroyed. The stream is 32-bit signed stereo PCM at 48KHz. + * @param {UserResolvable} user The user to create the stream for + * @returns {ReadableStream} + */ + createPCMStream(user) { + user = this.voiceConnection.voiceManager.client.resolver.resolveUser(user); + if (!user) throw new Error('Couldn\'t resolve the user to create PCM stream.'); + if (this.pcmStreams.get(user.id)) throw new Error('There is already an existing stream for that user.'); + const stream = new Readable(); + this.pcmStreams.set(user.id, stream); + return stream; + } + + handlePacket(msg, user) { + msg.copy(nonce, 0, 0, 12); + let data = NaCl.secretbox.open(msg.slice(12), nonce, this.voiceConnection.authentication.secretKey.key); + if (!data) { + /** + * Emitted whenever a voice packet cannot be decrypted + * @event VoiceReceiver#warn + * @param {string} message The warning message + */ + this.emit('warn', 'Failed to decrypt voice packet'); + return; + } + data = new Buffer(data); + if (this.opusStreams.get(user.id)) this.opusStreams.get(user.id)._push(data); + /** + * Emitted whenever voice data is received from the voice connection. This is _always_ emitted (unlike PCM). + * @event VoiceReceiver#opus + * @param {User} user The user that is sending the buffer (is speaking) + * @param {Buffer} buffer The opus buffer + */ + this.emit('opus', user, data); + if (this.listenerCount('pcm') > 0 || this.pcmStreams.size > 0) { + /** + * Emits decoded voice data when it's received. For performance reasons, the decoding will only + * happen if there is at least one `pcm` listener on this receiver. + * @event VoiceReceiver#pcm + * @param {User} user The user that is sending the buffer (is speaking) + * @param {Buffer} buffer The decoded buffer + */ + const pcm = this.voiceConnection.player.opusEncoder.decode(data); + if (this.pcmStreams.get(user.id)) this.pcmStreams.get(user.id)._push(pcm); + this.emit('pcm', user, pcm); + } + } +} + +module.exports = VoiceReceiver; + +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0).Buffer)) + +/***/ }, +/* 271 */ +/***/ function(module, exports) { + +/** + * Represents a Secret Key used in encryption over voice + * @private + */ +class SecretKey { + constructor(key) { + /** + * The key used for encryption + * @type {Uint8Array} + */ + this.key = new Uint8Array(new ArrayBuffer(key.length)); + for (const index in key) this.key[index] = key[index]; + } +} + +module.exports = SecretKey; + + +/***/ }, +/* 272 */ +/***/ function(module, exports, __webpack_require__) { + +const browser = typeof window !== 'undefined'; +const WebSocket = browser ? window.WebSocket : __webpack_require__(119); // eslint-disable-line no-undef +const EventEmitter = __webpack_require__(3).EventEmitter; +const Constants = __webpack_require__(2); +const inflate = browser ? __webpack_require__(247).inflateSync : __webpack_require__(97).inflateSync; +const PacketManager = __webpack_require__(274); +const convertArrayBuffer = __webpack_require__(131); + +/** + * The WebSocket Manager of the Client + * @private + */ +class WebSocketManager extends EventEmitter { + constructor(client) { + super(); + /** + * The Client that instantiated this WebSocketManager + * @type {Client} + */ + this.client = client; + + /** + * A WebSocket Packet manager, it handles all the messages + * @type {PacketManager} + */ + this.packetManager = new PacketManager(this); + + /** + * The status of the WebSocketManager, a type of Constants.Status. It defaults to IDLE. + * @type {number} + */ + this.status = Constants.Status.IDLE; + + /** + * The session ID of the connection, null if not yet available. + * @type {?string} + */ + this.sessionID = null; + + /** + * The packet count of the client, null if not yet available. + * @type {?number} + */ + this.sequence = -1; + + /** + * The gateway address for this WebSocket connection, null if not yet available. + * @type {?string} + */ + this.gateway = null; + + /** + * Whether READY was emitted normally (all packets received) or not + * @type {boolean} + */ + this.normalReady = false; + + /** + * The WebSocket connection to the gateway + * @type {?WebSocket} + */ + this.ws = null; + + /** + * An object with keys that are websocket event names that should be ignored + * @type {Object} + */ + this.disabledEvents = {}; + for (const event in client.options.disabledEvents) this.disabledEvents[event] = true; + + this.first = true; + } + + /** + * Connects the client to a given gateway + * @param {string} gateway The gateway to connect to + */ + _connect(gateway) { + this.client.emit('debug', `Connecting to gateway ${gateway}`); + this.normalReady = false; + if (this.status !== Constants.Status.RECONNECTING) this.status = Constants.Status.CONNECTING; + this.ws = new WebSocket(gateway); + if (browser) this.ws.binaryType = 'arraybuffer'; + this.ws.onopen = () => this.eventOpen(); + this.ws.onclose = (d) => this.eventClose(d); + this.ws.onmessage = (e) => this.eventMessage(e); + this.ws.onerror = (e) => this.eventError(e); + this._queue = []; + this._remaining = 3; + } + + connect(gateway) { + if (this.first) { + this._connect(gateway); + this.first = false; + } else { + this.client.setTimeout(() => this._connect(gateway), 5500); + } + } + + /** + * Sends a packet to the gateway + * @param {Object} data An object that can be JSON stringified + * @param {boolean} force Whether or not to send the packet immediately + */ + send(data, force = false) { + if (force) { + this._send(JSON.stringify(data)); + return; + } + this._queue.push(JSON.stringify(data)); + this.doQueue(); + } + + destroy() { + this.ws.close(1000); + this._queue = []; + this.status = Constants.Status.IDLE; + } + + _send(data) { + if (this.ws.readyState === WebSocket.OPEN) { + this.emit('send', data); + this.ws.send(data); + } + } + + doQueue() { + const item = this._queue[0]; + if (this.ws.readyState === WebSocket.OPEN && item) { + if (this._remaining === 0) { + this.client.setTimeout(() => { + this.doQueue(); + }, 1000); + return; + } + this._remaining--; + this._send(item); + this._queue.shift(); + this.doQueue(); + this.client.setTimeout(() => this._remaining++, 1000); + } + } + + /** + * Run whenever the gateway connections opens up + */ + eventOpen() { + this.client.emit('debug', 'Connection to gateway opened'); + if (this.status === Constants.Status.RECONNECTING) this._sendResume(); + else this._sendNewIdentify(); + } + + /** + * Sends a gateway resume packet, in cases of unexpected disconnections. + */ + _sendResume() { + if (!this.sessionID) { + this._sendNewIdentify(); + return; + } + this.client.emit('debug', 'Identifying as resumed session'); + const payload = { + token: this.client.token, + session_id: this.sessionID, + seq: this.sequence, + }; + + this.send({ + op: Constants.OPCodes.RESUME, + d: payload, + }); + } + + /** + * Sends a new identification packet, in cases of new connections or failed reconnections. + */ + _sendNewIdentify() { + this.reconnecting = false; + const payload = this.client.options.ws; + payload.token = this.client.token; + if (this.client.options.shardCount > 0) { + payload.shard = [Number(this.client.options.shardId), Number(this.client.options.shardCount)]; + } + this.client.emit('debug', 'Identifying as new session'); + this.send({ + op: Constants.OPCodes.IDENTIFY, + d: payload, + }); + this.sequence = -1; + } + + /** + * Run whenever the connection to the gateway is closed, it will try to reconnect the client. + * @param {Object} event The received websocket data + */ + eventClose(event) { + this.emit('close', event); + this.client.clearInterval(this.client.manager.heartbeatInterval); + /** + * Emitted whenever the client websocket is disconnected + * @event Client#disconnect + */ + if (!this.reconnecting) this.client.emit(Constants.Events.DISCONNECT); + if (event.code === 4004) return; + if (event.code === 4010) return; + if (!this.reconnecting && event.code !== 1000) this.tryReconnect(); + } + + /** + * Run whenever a message is received from the WebSocket. Returns `true` if the message + * was handled properly. + * @param {Object} event The received websocket data + * @returns {boolean} + */ + eventMessage(event) { + let packet = event.data; + try { + if (typeof packet !== 'string') { + if (packet instanceof ArrayBuffer) packet = convertArrayBuffer(packet); + packet = inflate(packet).toString(); + } + packet = JSON.parse(packet); + } catch (e) { + return this.eventError(new Error(Constants.Errors.BAD_WS_MESSAGE)); + } + + this.client.emit('raw', packet); + + if (packet.op === Constants.OPCodes.HELLO) this.client.manager.setupKeepAlive(packet.d.heartbeat_interval); + return this.packetManager.handle(packet); + } + + /** + * Run whenever an error occurs with the WebSocket connection. Tries to reconnect + * @param {Error} err The encountered error + */ + eventError(err) { + /** + * Emitted whenever the Client encounters a serious connection error + * @event Client#error + * @param {Error} error The encountered error + */ + if (this.client.listenerCount('error') > 0) this.client.emit('error', err); + this.ws.close(); + } + + _emitReady(normal = true) { + /** + * Emitted when the Client becomes ready to start working + * @event Client#ready + */ + this.status = Constants.Status.READY; + this.client.emit(Constants.Events.READY); + this.packetManager.handleQueue(); + this.normalReady = normal; + } + + /** + * Runs on new packets before `READY` to see if the Client is ready yet, if it is prepares + * the `READY` event. + */ + checkIfReady() { + if (this.status !== Constants.Status.READY && this.status !== Constants.Status.NEARLY) { + let unavailableCount = 0; + for (const guildID of this.client.guilds.keys()) { + unavailableCount += this.client.guilds.get(guildID).available ? 0 : 1; + } + if (unavailableCount === 0) { + this.status = Constants.Status.NEARLY; + if (this.client.options.fetchAllMembers) { + const promises = this.client.guilds.map(g => g.fetchMembers()); + Promise.all(promises).then(() => this._emitReady(), e => { + this.client.emit(Constants.Events.WARN, 'Error in pre-ready guild member fetching'); + this.client.emit(Constants.Events.ERROR, e); + this._emitReady(); + }); + return; + } + this._emitReady(); + } + } + } + + /** + * Tries to reconnect the client, changing the status to Constants.Status.RECONNECTING. + */ + tryReconnect() { + this.status = Constants.Status.RECONNECTING; + this.ws.close(); + this.packetManager.handleQueue(); + /** + * Emitted when the Client tries to reconnect after being disconnected + * @event Client#reconnecting + */ + this.client.emit(Constants.Events.RECONNECTING); + this.connect(this.client.ws.gateway); + } +} + +module.exports = WebSocketManager; + + +/***/ }, +/* 273 */ +/***/ function(module, exports) { + +function webpackEmptyContext(req) { + throw new Error("Cannot find module '" + req + "'."); +} +webpackEmptyContext.keys = function() { return []; }; +webpackEmptyContext.resolve = webpackEmptyContext; +module.exports = webpackEmptyContext; +webpackEmptyContext.id = 273; + + +/***/ }, +/* 274 */ +/***/ function(module, exports, __webpack_require__) { + +const Constants = __webpack_require__(2); + +const BeforeReadyWhitelist = [ + Constants.WSEvents.READY, + Constants.WSEvents.GUILD_CREATE, + Constants.WSEvents.GUILD_DELETE, + Constants.WSEvents.GUILD_MEMBERS_CHUNK, + Constants.WSEvents.GUILD_MEMBER_ADD, + Constants.WSEvents.GUILD_MEMBER_REMOVE, +]; + +class WebSocketPacketManager { + constructor(websocketManager) { + this.ws = websocketManager; + this.handlers = {}; + this.queue = []; + + this.register(Constants.WSEvents.READY, 'Ready'); + this.register(Constants.WSEvents.GUILD_CREATE, 'GuildCreate'); + this.register(Constants.WSEvents.GUILD_DELETE, 'GuildDelete'); + this.register(Constants.WSEvents.GUILD_UPDATE, 'GuildUpdate'); + this.register(Constants.WSEvents.GUILD_BAN_ADD, 'GuildBanAdd'); + this.register(Constants.WSEvents.GUILD_BAN_REMOVE, 'GuildBanRemove'); + this.register(Constants.WSEvents.GUILD_MEMBER_ADD, 'GuildMemberAdd'); + this.register(Constants.WSEvents.GUILD_MEMBER_REMOVE, 'GuildMemberRemove'); + this.register(Constants.WSEvents.GUILD_MEMBER_UPDATE, 'GuildMemberUpdate'); + this.register(Constants.WSEvents.GUILD_ROLE_CREATE, 'GuildRoleCreate'); + this.register(Constants.WSEvents.GUILD_ROLE_DELETE, 'GuildRoleDelete'); + this.register(Constants.WSEvents.GUILD_ROLE_UPDATE, 'GuildRoleUpdate'); + this.register(Constants.WSEvents.GUILD_MEMBERS_CHUNK, 'GuildMembersChunk'); + this.register(Constants.WSEvents.CHANNEL_CREATE, 'ChannelCreate'); + this.register(Constants.WSEvents.CHANNEL_DELETE, 'ChannelDelete'); + this.register(Constants.WSEvents.CHANNEL_UPDATE, 'ChannelUpdate'); + this.register(Constants.WSEvents.PRESENCE_UPDATE, 'PresenceUpdate'); + this.register(Constants.WSEvents.USER_UPDATE, 'UserUpdate'); + this.register(Constants.WSEvents.USER_NOTE_UPDATE, 'UserNoteUpdate'); + this.register(Constants.WSEvents.VOICE_STATE_UPDATE, 'VoiceStateUpdate'); + this.register(Constants.WSEvents.TYPING_START, 'TypingStart'); + this.register(Constants.WSEvents.MESSAGE_CREATE, 'MessageCreate'); + this.register(Constants.WSEvents.MESSAGE_DELETE, 'MessageDelete'); + this.register(Constants.WSEvents.MESSAGE_UPDATE, 'MessageUpdate'); + this.register(Constants.WSEvents.VOICE_SERVER_UPDATE, 'VoiceServerUpdate'); + this.register(Constants.WSEvents.MESSAGE_DELETE_BULK, 'MessageDeleteBulk'); + this.register(Constants.WSEvents.CHANNEL_PINS_UPDATE, 'ChannelPinsUpdate'); + this.register(Constants.WSEvents.GUILD_SYNC, 'GuildSync'); + this.register(Constants.WSEvents.RELATIONSHIP_ADD, 'RelationshipAdd'); + this.register(Constants.WSEvents.RELATIONSHIP_REMOVE, 'RelationshipRemove'); + this.register(Constants.WSEvents.MESSAGE_REACTION_ADD, 'MessageReactionAdd'); + this.register(Constants.WSEvents.MESSAGE_REACTION_REMOVE, 'MessageReactionRemove'); + this.register(Constants.WSEvents.MESSAGE_REACTION_REMOVE_ALL, 'MessageReactionRemoveAll'); + } + + get client() { + return this.ws.client; + } + + register(event, handle) { + const Handler = !(function webpackMissingModule() { var e = new Error("Cannot find module \".\""); e.code = 'MODULE_NOT_FOUND'; throw e; }()); + this.handlers[event] = new Handler(this); + } + + handleQueue() { + this.queue.forEach((element, index) => { + this.handle(this.queue[index]); + this.queue.splice(index, 1); + }); + } + + setSequence(s) { + if (s && s > this.ws.sequence) this.ws.sequence = s; + } + + handle(packet) { + if (packet.op === Constants.OPCodes.RECONNECT) { + this.setSequence(packet.s); + this.ws.tryReconnect(); + return false; + } + + if (packet.op === Constants.OPCodes.INVALID_SESSION) { + this.ws.sessionID = null; + this.ws._sendNewIdentify(); + return false; + } + + if (packet.op === Constants.OPCodes.HEARTBEAT_ACK) this.ws.client.emit('debug', 'Heartbeat acknowledged'); + + if (this.ws.status === Constants.Status.RECONNECTING) { + this.ws.reconnecting = false; + this.ws.checkIfReady(); + } + + this.setSequence(packet.s); + + if (this.ws.disabledEvents[packet.t] !== undefined) return false; + + if (this.ws.status !== Constants.Status.READY) { + if (BeforeReadyWhitelist.indexOf(packet.t) === -1) { + this.queue.push(packet); + return false; + } + } + + if (this.handlers[packet.t]) return this.handlers[packet.t].handle(packet); + return false; + } +} + +module.exports = WebSocketPacketManager; + + +/***/ }, +/* 275 */ +/***/ function(module, exports) { + +/** + * Represents a user connection (or "platform identity") + */ +class UserConnection { + constructor(user, data) { + /** + * The user that owns the Connection + * @type {User} + */ + this.user = user; + + this.setup(data); + } + + setup(data) { + /** + * The type of the Connection + * @type {string} + */ + this.type = data.type; + + /** + * The username of the connection account + * @type {string} + */ + this.name = data.name; + + /** + * The id of the connection account + * @type {string} + */ + this.id = data.id; + + /** + * Whether the connection is revoked + * @type {Boolean} + */ + this.revoked = data.revoked; + + /** + * an array of partial server integrations (not yet implemented in this lib) + * @type {Object[]} + */ + this.integrations = data.integrations; + } +} + +module.exports = UserConnection; + + +/***/ }, +/* 276 */ +/***/ function(module, exports, __webpack_require__) { + +const Collection = __webpack_require__(6); +const UserConnection = __webpack_require__(275); + +/** + * Represents a user's profile on Discord. + */ +class UserProfile { + constructor(user, data) { + /** + * The owner of the profile + * @type {User} + */ + this.user = user; + + /** + * The Client that created the instance of the the UserProfile. + * @type {Client} + */ + this.client = this.user.client; + Object.defineProperty(this, 'client', { enumerable: false, configurable: false }); + + /** + * Guilds that the client user and the user share + * @type {Collection} + */ + this.mutualGuilds = new Collection(); + + /** + * The user's connections + * @type {Collection} + */ + this.connections = new Collection(); + + this.setup(data); + } + + setup(data) { + for (const guild of data.mutual_guilds) { + if (this.client.guilds.has(guild.id)) { + this.mutualGuilds.set(guild.id, this.client.guilds.get(guild.id)); + } + } + for (const connection of data.connected_accounts) { + this.connections.set(connection.id, new UserConnection(this.user, connection)); + } + } +} + +module.exports = UserProfile; + + +/***/ }, +/* 277 */ +/***/ function(module, exports) { + +module.exports = function parseEmoji(text) { + if (text.includes('%')) { + text = decodeURIComponent(text); + } + if (text.includes(':')) { + const [name, id] = text.split(':'); + return { name, id }; + } else { + return { + name: text, + id: null, + }; + } +}; + + +/***/ }, +/* 278 */ +/***/ function(module, exports) { + +/* (ignored) */ + +/***/ }, +/* 279 */ +/***/ function(module, exports) { + +/* (ignored) */ + +/***/ }, +/* 280 */ +/***/ function(module, exports) { + +/* (ignored) */ + +/***/ }, +/* 281 */ +/***/ function(module, exports, __webpack_require__) { + +module.exports = { + Client: __webpack_require__(134), + WebhookClient: __webpack_require__(135), + Shard: __webpack_require__(62), + ShardClientUtil: __webpack_require__(63), + ShardingManager: __webpack_require__(136), + + Collection: __webpack_require__(6), + splitMessage: __webpack_require__(79), + escapeMarkdown: __webpack_require__(31), + fetchRecommendedShards: __webpack_require__(78), + + Channel: __webpack_require__(20), + ClientOAuth2Application: __webpack_require__(64), + ClientUser: __webpack_require__(137), + DMChannel: __webpack_require__(65), + Emoji: __webpack_require__(21), + EvaluatedPermissions: __webpack_require__(42), + Game: __webpack_require__(12).Game, + GroupDMChannel: __webpack_require__(66), + Guild: __webpack_require__(43), + GuildChannel: __webpack_require__(29), + GuildMember: __webpack_require__(30), + Invite: __webpack_require__(67), + Message: __webpack_require__(44), + MessageAttachment: __webpack_require__(68), + MessageCollector: __webpack_require__(69), + MessageEmbed: __webpack_require__(70), + MessageReaction: __webpack_require__(71), + OAuth2Application: __webpack_require__(72), + PartialGuild: __webpack_require__(73), + PartialGuildChannel: __webpack_require__(74), + PermissionOverwrites: __webpack_require__(75), + Presence: __webpack_require__(12).Presence, + ReactionEmoji: __webpack_require__(45), + Role: __webpack_require__(22), + TextChannel: __webpack_require__(76), + User: __webpack_require__(11), + VoiceChannel: __webpack_require__(77), + Webhook: __webpack_require__(46), + + version: __webpack_require__(61).version, +}; + +if (typeof window !== 'undefined') window.Discord = module.exports; // eslint-disable-line no-undef /***/ } diff --git a/discord.indev.min.js b/discord.indev.min.js index ecec6905..5decaac8 100644 --- a/discord.indev.min.js +++ b/discord.indev.min.js @@ -1,138 +1,139 @@ -!function(e){function t(n){if(i[n])return i[n].exports;var r=i[n]={exports:{},id:n,loaded:!1};return e[n].call(r.exports,r,r.exports,t),r.loaded=!0,r.exports}var i={};return t.m=e,t.c=i,t.p="",t(0)}([function(e,t,i){e.exports={Client:i(1),WebhookClient:i(248),Shard:i(249),ShardClientUtil:i(245),ShardingManager:i(250),Collection:i(10),splitMessage:i(11),escapeMarkdown:i(19),fetchRecommendedShards:i(251),Channel:i(50),ClientOAuth2Application:i(34),ClientUser:i(208),DMChannel:i(49),Emoji:i(21),EvaluatedPermissions:i(27),Game:i(24).Game,GroupDMChannel:i(55),Guild:i(47),GuildChannel:i(52),GuildMember:i(25),Invite:i(28),Message:i(16),MessageAttachment:i(17),MessageCollector:i(23),MessageEmbed:i(18),MessageReaction:i(20),OAuth2Application:i(35),PartialGuild:i(29),PartialGuildChannel:i(30),PermissionOverwrites:i(53),Presence:i(24).Presence,ReactionEmoji:i(22),Role:i(26),TextChannel:i(51),User:i(13),VoiceChannel:i(54),Webhook:i(31),version:i(6).version},"undefined"!=typeof window&&(window.Discord=e.exports)},function(module,exports,__webpack_require__){(function(process){const EventEmitter=__webpack_require__(3).EventEmitter,mergeDefault=__webpack_require__(4),Constants=__webpack_require__(5),RESTManager=__webpack_require__(7),ClientDataManager=__webpack_require__(45),ClientManager=__webpack_require__(56),ClientDataResolver=__webpack_require__(57),ClientVoiceManager=__webpack_require__(64),WebSocketManager=__webpack_require__(176),ActionsManager=__webpack_require__(216),Collection=__webpack_require__(10),Presence=__webpack_require__(24).Presence,ShardClientUtil=__webpack_require__(245);class Client extends EventEmitter{constructor(e={}){super(),this.browser="undefined"!=typeof window,!e.shardId&&"SHARD_ID"in process.env&&(e.shardId=Number(process.env.SHARD_ID)),!e.shardCount&&"SHARD_COUNT"in process.env&&(e.shardCount=Number(process.env.SHARD_COUNT)),this.options=mergeDefault(Constants.DefaultOptions,e),this._validateOptions(),this.rest=new RESTManager(this),this.dataManager=new ClientDataManager(this),this.manager=new ClientManager(this),this.ws=new WebSocketManager(this),this.resolver=new ClientDataResolver(this),this.actions=new ActionsManager(this),this.voice=new ClientVoiceManager(this),this.shard=process.send?ShardClientUtil.singleton(this):null,this.users=new Collection,this.guilds=new Collection,this.channels=new Collection,this.presences=new Collection,!this.token&&"CLIENT_TOKEN"in process.env?this.token=process.env.CLIENT_TOKEN:this.token=null,this.email=null,this.password=null,this.user=null,this.readyAt=null,this._timeouts=new Set,this._intervals=new Set,this.options.messageSweepInterval>0&&this.setInterval(this.sweepMessages.bind(this),1e3*this.options.messageSweepInterval)}get status(){return this.ws.status}get uptime(){return this.readyAt?Date.now()-this.readyAt:null}get voiceConnections(){return this.voice.connections}get emojis(){const e=new Collection;for(const t of this.guilds.values())for(const i of t.emojis.values())e.set(i.id,i);return e}get readyTimestamp(){return this.readyAt?this.readyAt.getTime():null}login(e,t=null){return t?this.rest.methods.loginEmailPassword(e,t):this.rest.methods.loginToken(e)}destroy(){for(const e of this._timeouts)clearTimeout(e);for(const t of this._intervals)clearInterval(t);return this._timeouts.clear(),this._intervals.clear(),this.token=null,this.email=null,this.password=null,this.manager.destroy()}syncGuilds(e=this.guilds){this.user.bot||this.ws.send({op:12,d:e instanceof Collection?e.keyArray():e.map(e=>e.id)})}fetchUser(e){return this.users.has(e)?Promise.resolve(this.users.get(e)):this.rest.methods.getUser(e)}fetchInvite(e){const t=this.resolver.resolveInviteCode(e);return this.rest.methods.getInvite(t)}fetchWebhook(e,t){return this.rest.methods.getWebhook(e,t)}sweepMessages(e=this.options.messageCacheLifetime){if("number"!=typeof e||isNaN(e))throw new TypeError("The lifetime must be a number.");if(e<=0)return this.emit("debug","Didn't sweep messages - lifetime is unlimited"),-1;const t=1e3*e,i=Date.now();let n=0,r=0;for(const s of this.channels.values())if(s.messages){n++;for(const e of s.messages.values())i-(e.editedTimestamp||e.createdTimestamp)>t&&(s.messages.delete(e.id),r++)}return this.emit("debug",`Swept ${r} messages older than ${e} seconds in ${n} text-based channels`),r}fetchApplication(){if(!this.user.bot)throw new Error(Constants.Errors.NO_BOT_ACCOUNT);return this.rest.methods.getMyApplication()}setTimeout(e,t,...i){const n=setTimeout(()=>{e(),this._timeouts.delete(n)},t,...i);return this._timeouts.add(n),n}clearTimeout(e){clearTimeout(e),this._timeouts.delete(e)}setInterval(e,t,...i){const n=setInterval(e,t,...i);return this._intervals.add(n),n}clearInterval(e){clearInterval(e),this._intervals.delete(e)}_setPresence(e,t){return this.presences.get(e)?void this.presences.get(e).update(t):void this.presences.set(e,new Presence(t))}_eval(script){return eval(script)}_validateOptions(e=this.options){if("number"!=typeof e.shardCount||isNaN(e.shardCount))throw new TypeError("The shardCount option must be a number.");if("number"!=typeof e.shardId||isNaN(e.shardId))throw new TypeError("The shardId option must be a number.");if(e.shardCount<0)throw new RangeError("The shardCount option must be at least 0.");if(e.shardId<0)throw new RangeError("The shardId option must be at least 0.");if(0!==e.shardId&&e.shardId>=e.shardCount)throw new RangeError("The shardId option must be less than shardCount.");if("number"!=typeof e.messageCacheMaxSize||isNaN(e.messageCacheMaxSize))throw new TypeError("The messageCacheMaxSize option must be a number.");if("number"!=typeof e.messageCacheLifetime||isNaN(e.messageCacheLifetime))throw new TypeError("The messageCacheLifetime option must be a number.");if("number"!=typeof e.messageSweepInterval||isNaN(e.messageSweepInterval))throw new TypeError("The messageSweepInterval option must be a number.");if("boolean"!=typeof e.fetchAllMembers)throw new TypeError("The fetchAllMembers option must be a boolean.");if("boolean"!=typeof e.disableEveryone)throw new TypeError("The disableEveryone option must be a boolean.");if("number"!=typeof e.restWsBridgeTimeout||isNaN(e.restWsBridgeTimeout))throw new TypeError("The restWsBridgeTimeout option must be a number.");if(!(e.disabledEvents instanceof Array))throw new TypeError("The disabledEvents option must be an Array.")}}module.exports=Client}).call(exports,__webpack_require__(2))},function(e,t){function i(){throw new Error("setTimeout has not been defined")}function n(){throw new Error("clearTimeout has not been defined")}function r(e){if(h===setTimeout)return setTimeout(e,0);if((h===i||!h)&&setTimeout)return h=setTimeout,setTimeout(e,0);try{return h(e,0)}catch(t){try{return h.call(null,e,0)}catch(t){return h.call(this,e,0)}}}function s(e){if(u===clearTimeout)return clearTimeout(e);if((u===n||!u)&&clearTimeout)return u=clearTimeout,clearTimeout(e);try{return u(e)}catch(t){try{return u.call(null,e)}catch(t){return u.call(this,e)}}}function o(){b&&d&&(b=!1,d.length?p=d.concat(p):w=-1,p.length&&a())}function a(){if(!b){var e=r(o);b=!0;for(var t=p.length;t;){for(d=p,p=[];++w1)for(var i=1;i0&&this._events[e].length>r&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace())),this},i.prototype.on=i.prototype.addListener,i.prototype.once=function(e,t){function i(){this.removeListener(e,i),r||(r=!0,t.apply(this,arguments))}if(!n(t))throw TypeError("listener must be a function");var r=!1;return i.listener=t,this.on(e,i),this},i.prototype.removeListener=function(e,t){var i,r,o,a;if(!n(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(i=this._events[e],o=i.length,r=-1,i===t||n(i.listener)&&i.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(s(i)){for(a=o;a-- >0;)if(i[a]===t||i[a].listener&&i[a].listener===t){r=a;break}if(r<0)return this;1===i.length?(i.length=0,delete this._events[e]):i.splice(r,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},i.prototype.removeAllListeners=function(e){var t,i;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(i=this._events[e],n(i))this.removeListener(e,i);else if(i)for(;i.length;)this.removeListener(e,i[i.length-1]);return delete this._events[e],this},i.prototype.listeners=function(e){var t;return t=this._events&&this._events[e]?n(this._events[e])?[this._events[e]]:this._events[e].slice():[]},i.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(n(t))return 1;if(t)return t.length}return 0},i.listenerCount=function(e,t){return e.listenerCount(t)}},function(e,t){e.exports=function e(t,i){if(!i)return t;for(const n in t)({}).hasOwnProperty.call(i,n)?i[n]===Object(i[n])&&(i[n]=e(t[n],i[n])):i[n]=t[n];return i}},function(e,t,i){(function(e){t.Package=i(6),t.DefaultOptions={apiRequestMethod:"sequential",shardId:0,shardCount:0,messageCacheMaxSize:200,messageCacheLifetime:0,messageSweepInterval:0,fetchAllMembers:!1,disableEveryone:!1,sync:!1,restWsBridgeTimeout:5e3,disabledEvents:[],ws:{large_threshold:250,compress:"undefined"==typeof window,properties:{$os:e?e.platform:"discord.js",$browser:"discord.js",$device:"discord.js",$referrer:"",$referring_domain:""}}},t.Errors={NO_TOKEN:"Request to use token, but token was unavailable to the client.",NO_BOT_ACCOUNT:"Only bot accounts are able to make use of this feature.",NO_USER_ACCOUNT:"Only user accounts are able to make use of this feature.",BAD_WS_MESSAGE:"A bad message was received from the websocket; either bad compression, or not JSON.",TOOK_TOO_LONG:"Something took too long to do.",NOT_A_PERMISSION:"Invalid permission string or number.",INVALID_RATE_LIMIT_METHOD:"Unknown rate limiting method.",BAD_LOGIN:"Incorrect login details were provided.",INVALID_SHARD:"Invalid shard settings were provided."};const n=t.PROTOCOL_VERSION=6,r=t.API=`https://discordapp.com/api/v${n}`,s=t.Endpoints={login:`${r}/auth/login`,logout:`${r}/auth/logout`,gateway:`${r}/gateway`,botGateway:`${r}/gateway/bot`,invite:e=>`${r}/invite/${e}`,inviteLink:e=>`https://discord.gg/${e}`,CDN:"https://cdn.discordapp.com",user:e=>`${r}/users/${e}`,userChannels:e=>`${s.user(e)}/channels`,userProfile:e=>`${s.user(e)}/profile`,avatar:(e,t)=>"1"===e?t:`${s.user(e)}/avatars/${t}.jpg`,me:`${r}/users/@me`,meGuild:e=>`${s.me}/guilds/${e}`,relationships:e=>`${s.user(e)}/relationships`,note:e=>`${s.me}/notes/${e}`,guilds:`${r}/guilds`,guild:e=>`${s.guilds}/${e}`,guildIcon:(e,t)=>`${s.guild(e)}/icons/${t}.jpg`,guildPrune:e=>`${s.guild(e)}/prune`,guildEmbed:e=>`${s.guild(e)}/embed`,guildInvites:e=>`${s.guild(e)}/invites`,guildRoles:e=>`${s.guild(e)}/roles`,guildRole:(e,t)=>`${s.guildRoles(e)}/${t}`,guildBans:e=>`${s.guild(e)}/bans`,guildIntegrations:e=>`${s.guild(e)}/integrations`,guildMembers:e=>`${s.guild(e)}/members`,guildMember:(e,t)=>`${s.guildMembers(e)}/${t}`,stupidInconsistentGuildEndpoint:e=>`${s.guildMember(e,"@me")}/nick`,guildChannels:e=>`${s.guild(e)}/channels`,guildEmojis:e=>`${s.guild(e)}/emojis`,channels:`${r}/channels`,channel:e=>`${s.channels}/${e}`,channelMessages:e=>`${s.channel(e)}/messages`,channelInvites:e=>`${s.channel(e)}/invites`,channelTyping:e=>`${s.channel(e)}/typing`,channelPermissions:e=>`${s.channel(e)}/permissions`,channelMessage:(e,t)=>`${s.channelMessages(e)}/${t}`,channelWebhooks:e=>`${s.channel(e)}/webhooks`,messageReactions:(e,t)=>`${s.channelMessage(e,t)}/reactions`,messageReaction:(e,t,i,n)=>`${s.messageReactions(e,t)}/${i}`+`${n?`?limit=${n}`:""}`,selfMessageReaction:(e,t,i,n)=>`${s.messageReaction(e,t,i,n)}/@me`,userMessageReaction:(e,t,i,n,r)=>`${s.messageReaction(e,t,i,n)}/${r}`,webhook:(e,t)=>`${r}/webhooks/${e}${t?`/${t}`:""}`,myApplication:`${r}/oauth2/applications/@me`,getApp:e=>`${r}/oauth2/authorize?client_id=${e}`};t.Status={READY:0,CONNECTING:1,RECONNECTING:2,IDLE:3,NEARLY:4},t.ChannelTypes={text:0,DM:1,voice:2,groupDM:3},t.OPCodes={DISPATCH:0,HEARTBEAT:1,IDENTIFY:2,STATUS_UPDATE:3,VOICE_STATE_UPDATE:4,VOICE_GUILD_PING:5,RESUME:6,RECONNECT:7,REQUEST_GUILD_MEMBERS:8,INVALID_SESSION:9,HELLO:10,HEARTBEAT_ACK:11},t.VoiceOPCodes={IDENTIFY:0,SELECT_PROTOCOL:1,READY:2,HEARTBEAT:3,SESSION_DESCRIPTION:4,SPEAKING:5},t.Events={READY:"ready",GUILD_CREATE:"guildCreate",GUILD_DELETE:"guildDelete",GUILD_UPDATE:"guildUpdate",GUILD_UNAVAILABLE:"guildUnavailable",GUILD_AVAILABLE:"guildAvailable",GUILD_MEMBER_ADD:"guildMemberAdd",GUILD_MEMBER_REMOVE:"guildMemberRemove",GUILD_MEMBER_UPDATE:"guildMemberUpdate",GUILD_MEMBER_AVAILABLE:"guildMemberAvailable",GUILD_MEMBER_SPEAKING:"guildMemberSpeaking",GUILD_MEMBERS_CHUNK:"guildMembersChunk",GUILD_ROLE_CREATE:"roleCreate",GUILD_ROLE_DELETE:"roleDelete",GUILD_ROLE_UPDATE:"roleUpdate",GUILD_EMOJI_CREATE:"guildEmojiCreate",GUILD_EMOJI_DELETE:"guildEmojiDelete",GUILD_EMOJI_UPDATE:"guildEmojiUpdate",GUILD_BAN_ADD:"guildBanAdd",GUILD_BAN_REMOVE:"guildBanRemove",CHANNEL_CREATE:"channelCreate",CHANNEL_DELETE:"channelDelete",CHANNEL_UPDATE:"channelUpdate",CHANNEL_PINS_UPDATE:"channelPinsUpdate",MESSAGE_CREATE:"message",MESSAGE_DELETE:"messageDelete",MESSAGE_UPDATE:"messageUpdate",MESSAGE_BULK_DELETE:"messageDeleteBulk",MESSAGE_REACTION_ADD:"messageReactionAdd",MESSAGE_REACTION_REMOVE:"messageReactionRemove",MESSAGE_REACTION_REMOVE_ALL:"messageReactionRemoveAll",USER_UPDATE:"userUpdate",USER_NOTE_UPDATE:"userNoteUpdate",PRESENCE_UPDATE:"presenceUpdate",VOICE_STATE_UPDATE:"voiceStateUpdate",TYPING_START:"typingStart",TYPING_STOP:"typingStop",DISCONNECT:"disconnect",RECONNECTING:"reconnecting",ERROR:"error",WARN:"warn",DEBUG:"debug"},t.WSEvents={READY:"READY",GUILD_SYNC:"GUILD_SYNC",GUILD_CREATE:"GUILD_CREATE",GUILD_DELETE:"GUILD_DELETE",GUILD_UPDATE:"GUILD_UPDATE",GUILD_MEMBER_ADD:"GUILD_MEMBER_ADD",GUILD_MEMBER_REMOVE:"GUILD_MEMBER_REMOVE",GUILD_MEMBER_UPDATE:"GUILD_MEMBER_UPDATE",GUILD_MEMBERS_CHUNK:"GUILD_MEMBERS_CHUNK",GUILD_ROLE_CREATE:"GUILD_ROLE_CREATE",GUILD_ROLE_DELETE:"GUILD_ROLE_DELETE",GUILD_ROLE_UPDATE:"GUILD_ROLE_UPDATE",GUILD_BAN_ADD:"GUILD_BAN_ADD",GUILD_BAN_REMOVE:"GUILD_BAN_REMOVE",CHANNEL_CREATE:"CHANNEL_CREATE",CHANNEL_DELETE:"CHANNEL_DELETE",CHANNEL_UPDATE:"CHANNEL_UPDATE",CHANNEL_PINS_UPDATE:"CHANNEL_PINS_UPDATE",MESSAGE_CREATE:"MESSAGE_CREATE",MESSAGE_DELETE:"MESSAGE_DELETE",MESSAGE_UPDATE:"MESSAGE_UPDATE",MESSAGE_DELETE_BULK:"MESSAGE_DELETE_BULK",MESSAGE_REACTION_ADD:"MESSAGE_REACTION_ADD",MESSAGE_REACTION_REMOVE:"MESSAGE_REACTION_REMOVE",MESSAGE_REACTION_REMOVE_ALL:"MESSAGE_REACTION_REMOVE_ALL",USER_UPDATE:"USER_UPDATE",USER_NOTE_UPDATE:"USER_NOTE_UPDATE",PRESENCE_UPDATE:"PRESENCE_UPDATE",VOICE_STATE_UPDATE:"VOICE_STATE_UPDATE",TYPING_START:"TYPING_START",FRIEND_ADD:"RELATIONSHIP_ADD",FRIEND_REMOVE:"RELATIONSHIP_REMOVE",VOICE_SERVER_UPDATE:"VOICE_SERVER_UPDATE",RELATIONSHIP_ADD:"RELATIONSHIP_ADD",RELATIONSHIP_REMOVE:"RELATIONSHIP_REMOVE"},t.MessageTypes={0:"DEFAULT",1:"RECIPIENT_ADD",2:"RECIPIENT_REMOVE",3:"CALL",4:"CHANNEL_NAME_CHANGE",5:"CHANNEL_ICON_CHANGE",6:"PINS_ADD"};const o=t.PermissionFlags={CREATE_INSTANT_INVITE:1,KICK_MEMBERS:2,BAN_MEMBERS:4,ADMINISTRATOR:8,MANAGE_CHANNELS:16,MANAGE_GUILD:32,ADD_REACTIONS:64,READ_MESSAGES:1024,SEND_MESSAGES:2048,SEND_TTS_MESSAGES:4096,MANAGE_MESSAGES:8192,EMBED_LINKS:16384,ATTACH_FILES:32768,READ_MESSAGE_HISTORY:65536,MENTION_EVERYONE:1<<17,EXTERNAL_EMOJIS:1<<18,CONNECT:1<<20,SPEAK:1<<21,MUTE_MEMBERS:1<<22,DEAFEN_MEMBERS:1<<23,MOVE_MEMBERS:1<<24,USE_VAD:1<<25,CHANGE_NICKNAME:1<<26,MANAGE_NICKNAMES:1<<27,MANAGE_ROLES_OR_PERMISSIONS:1<<28,MANAGE_WEBHOOKS:1<<29,MANAGE_EMOJIS:1<<30};let a=0;for(const l in o)a|=o[l];t.ALL_PERMISSIONS=a,t.DEFAULT_PERMISSIONS=104324097}).call(t,i(2))},function(e,t){e.exports={name:"discord.js",version:"10.0.1",description:"A powerful library for interacting with the Discord API",main:"./src/index",scripts:{test:"eslint src && node docs/generator test",docs:"node docs/generator","test-docs":"node docs/generator test",lint:"eslint src","web-dist":"npm install && ./node_modules/parallel-webpack/bin/run.js"},repository:{type:"git",url:"git+https://github.com/hydrabolt/discord.js.git"},keywords:["discord","api","bot","client","node","discordapp"],author:"Amish Shah ",license:"Apache-2.0",bugs:{url:"https://github.com/hydrabolt/discord.js/issues"},homepage:"https://github.com/hydrabolt/discord.js#readme",dependencies:{superagent:"^3.0.0",tweetnacl:"^0.14.3",ws:"^1.1.1"},peerDependencies:{"node-opus":"^0.2.0",opusscript:"^0.0.1"},devDependencies:{bufferutil:"^1.2.1",eslint:"^3.10.0","jsdoc-to-markdown":"^2.0.0","json-loader":"^0.5.4","parallel-webpack":"^1.5.0","uglify-js":"github:mishoo/UglifyJS2#harmony","utf-8-validate":"^1.2.1",webpack:"^1.13.3",zlibjs:"github:imaya/zlib.js"},engines:{node:">=6.0.0"}}},function(e,t,i){const n=i(8),r=i(9),s=i(36),o=i(38),a=i(39),l=i(5);class f{constructor(e){this.client=e,this.handlers={},this.userAgentManager=new n(this),this.methods=new r(this),this.rateLimitedEndpoints={},this.globallyRateLimited=!1}push(e,t){return new Promise((i,n)=>{e.push({request:t,resolve:i,reject:n})})}getRequestHandler(){switch(this.client.options.apiRequestMethod){case"sequential":return s;case"burst":return o;default:throw new Error(l.Errors.INVALID_RATE_LIMIT_METHOD)}}makeRequest(e,t,i,n,r){const s=new a(this,e,t,i,n,r);if(!this.handlers[s.route]){const e=this.getRequestHandler();this.handlers[s.route]=new e(this,s.route)}return this.push(this.handlers[s.route],s)}}e.exports=f},function(e,t,i){const n=i(5);class r{constructor(e){this.restManager=e,this._userAgent={url:"https://github.com/hydrabolt/discord.js",version:n.Package.version}}set(e){this._userAgent.url=e.url||"https://github.com/hydrabolt/discord.js",this._userAgent.version=e.version||n.Package.version}get userAgent(){return`DiscordBot (${this._userAgent.url}, ${this._userAgent.version})`}}e.exports=r},function(e,t,i){const n=i(5),r=i(10),s=i(11),o=i(12),a=i(13),l=i(25),f=i(26),h=i(28),u=i(31),c=i(32),d=i(34);class p{constructor(e){this.rest=e}loginToken(e=this.rest.client.token){return new Promise((t,i)=>{e=e.replace(/^Bot\s*/i,""),this.rest.client.manager.connectToWebSocket(e,t,i)})}loginEmailPassword(e,t){return this.rest.client.emit("warn","Client launched using email and password - should use token instead"),this.rest.client.email=e,this.rest.client.password=t,this.rest.makeRequest("post",n.Endpoints.login,!1,{email:e,password:t}).then(e=>this.loginToken(e.token))}logout(){return this.rest.makeRequest("post",n.Endpoints.logout,!0,{})}getGateway(){return this.rest.makeRequest("get",n.Endpoints.gateway,!0).then(e=>{return this.rest.client.ws.gateway=`${e.url}/?encoding=json&v=${n.PROTOCOL_VERSION}`,this.rest.client.ws.gateway})}getBotGateway(){return this.rest.makeRequest("get",n.Endpoints.botGateway,!0)}sendMessage(e,t,{tts,nonce,embed,disableEveryone,split}={},i=null){return new Promise((n,r)=>{"undefined"!=typeof t&&(t=this.rest.client.resolver.resolveString(t)),t&&((disableEveryone||"undefined"==typeof disableEveryone&&this.rest.client.options.disableEveryone)&&(t=t.replace(/@(everyone|here)/g,"@​$1")),split&&(t=s(t,"object"==typeof split?split:{}))),e instanceof a||e instanceof l?this.createDM(e).then(e=>{this._sendMessageRequest(e,t,i,tts,nonce,embed,n,r)},r):this._sendMessageRequest(e,t,i,tts,nonce,embed,n,r)})}_sendMessageRequest(e,t,i,r,s,o,a,l){if(t instanceof Array){const f=[];let h=this.rest.makeRequest("post",n.Endpoints.channelMessages(e.id),!0,{content:t[0],tts:r,nonce:s},i).catch(l);for(let u=1;u<=t.length;u++)if(u{return f.push(l),this.rest.makeRequest("post",n.Endpoints.channelMessages(e.id),!0,{content:t[a],tts:r,nonce:s,embed:o},i)},l)}else h.then(e=>{f.push(e),a(this.rest.client.actions.MessageCreate.handle(f).messages)},l)}else this.rest.makeRequest("post",n.Endpoints.channelMessages(e.id),!0,{content:t,tts:r,nonce:s,embed:o},i).then(e=>a(this.rest.client.actions.MessageCreate.handle(e).message),l)}deleteMessage(e){return this.rest.makeRequest("del",n.Endpoints.channelMessage(e.channel.id,e.id),!0).then(()=>this.rest.client.actions.MessageDelete.handle({id:e.id,channel_id:e.channel.id}).message)}bulkDeleteMessages(e,t){return this.rest.makeRequest("post",`${n.Endpoints.channelMessages(e.id)}/bulk_delete`,!0,{messages:t}).then(()=>this.rest.client.actions.MessageDeleteBulk.handle({channel_id:e.id,ids:t}).messages)}updateMessage(e,t,{embed}={}){return t=this.rest.client.resolver.resolveString(t),this.rest.makeRequest("patch",n.Endpoints.channelMessage(e.channel.id,e.id),!0,{content:t,embed:embed}).then(e=>this.rest.client.actions.MessageUpdate.handle(e).updated)}createChannel(e,t,i){return this.rest.makeRequest("post",n.Endpoints.guildChannels(e.id),!0,{name:t,type:i}).then(e=>this.rest.client.actions.ChannelCreate.handle(e).channel)}createDM(e){const t=this.getExistingDM(e);return t?Promise.resolve(t):this.rest.makeRequest("post",n.Endpoints.userChannels(this.rest.client.user.id),!0,{recipient_id:e.id}).then(e=>this.rest.client.actions.ChannelCreate.handle(e).channel)}getExistingDM(e){return this.rest.client.channels.find(t=>t.recipient&&t.recipient.id===e.id)}deleteChannel(e){return(e instanceof a||e instanceof l)&&(e=this.getExistingDM(e)),e?this.rest.makeRequest("del",n.Endpoints.channel(e.id),!0).then(t=>{return t.id=e.id,this.rest.client.actions.ChannelDelete.handle(t).channel}):Promise.reject(new Error("No channel to delete."))}updateChannel(e,t){const i={};return i.name=(t.name||e.name).trim(),i.topic=t.topic||e.topic,i.position=t.position||e.position,i.bitrate=t.bitrate||e.bitrate,i.user_limit=t.userLimit||e.userLimit,this.rest.makeRequest("patch",n.Endpoints.channel(e.id),!0,i).then(e=>this.rest.client.actions.ChannelUpdate.handle(e).updated)}leaveGuild(e){return e.ownerID===this.rest.client.user.id?Promise.reject(new Error("Guild is owned by the client.")):this.rest.makeRequest("del",n.Endpoints.meGuild(e.id),!0).then(()=>this.rest.client.actions.GuildDelete.handle({id:e.id}).guild)}createGuild(e){return e.icon=this.rest.client.resolver.resolveBase64(e.icon)||null,e.region=e.region||"us-central",new Promise((t,i)=>{this.rest.makeRequest("post",n.Endpoints.guilds,!0,e).then(e=>{if(this.rest.client.guilds.has(e.id))return void t(this.rest.client.guilds.get(e.id));const n=i=>{i.id===e.id&&(this.rest.client.removeListener("guildCreate",n),this.rest.client.clearTimeout(r),t(i))};this.rest.client.on("guildCreate",n);const r=this.rest.client.setTimeout(()=>{this.rest.client.removeListener("guildCreate",n),i(new Error("Took too long to receive guild data."))},1e4)},i)})}deleteGuild(e){return this.rest.makeRequest("del",n.Endpoints.guild(e.id),!0).then(()=>this.rest.client.actions.GuildDelete.handle({id:e.id}).guild)}getUser(e){return this.rest.makeRequest("get",n.Endpoints.user(e),!0).then(e=>this.rest.client.actions.UserGet.handle(e).user)}updateCurrentUser(e){const t=this.rest.client.user,i={};return i.username=e.username||t.username,i.avatar=this.rest.client.resolver.resolveBase64(e.avatar)||t.avatar,t.bot||(i.email=e.email||t.email,i.password=this.rest.client.password,e.new_password&&(i.new_password=e.newPassword)),this.rest.makeRequest("patch",n.Endpoints.me,!0,i).then(e=>this.rest.client.actions.UserUpdate.handle(e).updated)}updateGuild(e,t){const i={};return t.name&&(i.name=t.name),t.region&&(i.region=t.region),t.verificationLevel&&(i.verification_level=Number(t.verificationLevel)),t.afkChannel&&(i.afk_channel_id=this.rest.client.resolver.resolveChannel(t.afkChannel).id),t.afkTimeout&&(i.afk_timeout=Number(t.afkTimeout)),t.icon&&(i.icon=this.rest.client.resolver.resolveBase64(t.icon)),t.owner&&(i.owner_id=this.rest.client.resolver.resolveUser(t.owner).id),t.splash&&(i.splash=this.rest.client.resolver.resolveBase64(t.splash)),this.rest.makeRequest("patch",n.Endpoints.guild(e.id),!0,i).then(e=>this.rest.client.actions.GuildUpdate.handle(e).updated)}kickGuildMember(e,t){return this.rest.makeRequest("del",n.Endpoints.guildMember(e.id,t.id),!0).then(()=>this.rest.client.actions.GuildMemberRemove.handle({guild_id:e.id,user:t.user}).member)}createGuildRole(e){return this.rest.makeRequest("post",n.Endpoints.guildRoles(e.id),!0).then(t=>this.rest.client.actions.GuildRoleCreate.handle({guild_id:e.id,role:t}).role)}deleteGuildRole(e){return this.rest.makeRequest("del",n.Endpoints.guildRole(e.guild.id,e.id),!0).then(()=>this.rest.client.actions.GuildRoleDelete.handle({guild_id:e.guild.id,role_id:e.id}).role)}setChannelOverwrite(e,t){return this.rest.makeRequest("put",`${n.Endpoints.channelPermissions(e.id)}/${t.id}`,!0,t)}deletePermissionOverwrites(e){return this.rest.makeRequest("del",`${n.Endpoints.channelPermissions(e.channel.id)}/${e.id}`,!0).then(()=>e)}getChannelMessages(e,t={}){const i=[];t.limit&&i.push(`limit=${t.limit}`),t.around?i.push(`around=${t.around}`):t.before?i.push(`before=${t.before}`):t.after&&i.push(`after=${t.after}`);let r=n.Endpoints.channelMessages(e.id);return i.length>0&&(r+=`?${i.join("&")}`),this.rest.makeRequest("get",r,!0)}getChannelMessage(e,t){const i=e.messages.get(t);return i?Promise.resolve(i):this.rest.makeRequest("get",n.Endpoints.channelMessage(e.id,t),!0)}getGuildMember(e,t){return this.rest.makeRequest("get",n.Endpoints.guildMember(e.id,t.id),!0).then(t=>this.rest.client.actions.GuildMemberGet.handle(e,t).member)}updateGuildMember(e,t){t.channel&&(t.channel_id=this.rest.client.resolver.resolveChannel(t.channel).id),t.roles&&(t.roles=t.roles.map(e=>e instanceof f?e.id:e));let i=n.Endpoints.guildMember(e.guild.id,e.id);if(e.id===this.rest.client.user.id){const r=Object.keys(t);1===r.length&&"nick"===r[0]&&(i=n.Endpoints.stupidInconsistentGuildEndpoint(e.guild.id))}return this.rest.makeRequest("patch",i,!0,t).then(t=>e.guild._updateMember(e,t).mem)}sendTyping(e){return this.rest.makeRequest("post",`${n.Endpoints.channel(e)}/typing`,!0)}banGuildMember(e,t,i=0){const r=this.rest.client.resolver.resolveUserID(t);return r?this.rest.makeRequest("put",`${n.Endpoints.guildBans(e.id)}/${r}?delete-message-days=${i}`,!0,{"delete-message-days":i}).then(()=>{if(t instanceof l)return t;const i=this.rest.client.resolver.resolveUser(r);return i?(t=this.rest.client.resolver.resolveGuildMember(e,i),t||i):r}):Promise.reject(new Error("Couldn't resolve the user ID to ban."))}unbanGuildMember(e,t){return new Promise((i,r)=>{const s=this.rest.client.resolver.resolveUserID(t);if(!s)throw new Error("Couldn't resolve the user ID to unban.");const o=(t,r)=>{t.id===e.id&&r.id===s&&(this.rest.client.removeListener(n.Events.GUILD_BAN_REMOVE,o),this.rest.client.clearTimeout(a),i(r))};this.rest.client.on(n.Events.GUILD_BAN_REMOVE,o);const a=this.rest.client.setTimeout(()=>{this.rest.client.removeListener(n.Events.GUILD_BAN_REMOVE,o),r(new Error("Took too long to receive the ban remove event."))},1e4);this.rest.makeRequest("del",`${n.Endpoints.guildBans(e.id)}/${s}`,!0).catch(e=>{this.rest.client.removeListener(n.Events.GUILD_BAN_REMOVE,o),this.rest.client.clearTimeout(a),r(e)})})}getGuildBans(e){return this.rest.makeRequest("get",n.Endpoints.guildBans(e.id),!0).then(e=>{const t=new r;for(const i of e){const e=this.rest.client.dataManager.newUser(i.user);t.set(e.id,e)}return t})}updateGuildRole(e,t){const i={};if(i.name=t.name||e.name,i.position="undefined"!=typeof t.position?t.position:e.position,i.color=t.color||e.color,"string"==typeof i.color&&i.color.startsWith("#")&&(i.color=parseInt(i.color.replace("#",""),16)),i.hoist="undefined"!=typeof t.hoist?t.hoist:e.hoist,i.mentionable="undefined"!=typeof t.mentionable?t.mentionable:e.mentionable,t.permissions){let e=0;for(let r of t.permissions)"string"==typeof r&&(r=n.PermissionFlags[r]),e|=r;i.permissions=e}else i.permissions=e.permissions;return this.rest.makeRequest("patch",n.Endpoints.guildRole(e.guild.id,e.id),!0,i).then(t=>this.rest.client.actions.GuildRoleUpdate.handle({role:t,guild_id:e.guild.id}).updated)}pinMessage(e){return this.rest.makeRequest("put",`${n.Endpoints.channel(e.channel.id)}/pins/${e.id}`,!0).then(()=>e)}unpinMessage(e){return this.rest.makeRequest("del",`${n.Endpoints.channel(e.channel.id)}/pins/${e.id}`,!0).then(()=>e)}getChannelPinnedMessages(e){return this.rest.makeRequest("get",`${n.Endpoints.channel(e.id)}/pins`,!0)}createChannelInvite(e,t){const i={};return i.temporary=t.temporary,i.max_age=t.maxAge,i.max_uses=t.maxUses,this.rest.makeRequest("post",`${n.Endpoints.channelInvites(e.id)}`,!0,i).then(e=>new h(this.rest.client,e))}deleteInvite(e){return this.rest.makeRequest("del",n.Endpoints.invite(e.code),!0).then(()=>e)}getInvite(e){return this.rest.makeRequest("get",n.Endpoints.invite(e),!0).then(e=>new h(this.rest.client,e))}getGuildInvites(e){return this.rest.makeRequest("get",n.Endpoints.guildInvites(e.id),!0).then(e=>{const t=new r;for(const i of e){const e=new h(this.rest.client,i);t.set(e.code,e)}return t})}pruneGuildMembers(e,t,i){return this.rest.makeRequest(i?"get":"post",`${n.Endpoints.guildPrune(e.id)}?days=${t}`,!0).then(e=>e.pruned)}createEmoji(e,t,i){return this.rest.makeRequest("post",`${n.Endpoints.guildEmojis(e.id)}`,!0,{name:i,image:t}).then(t=>this.rest.client.actions.EmojiCreate.handle(t,e).emoji); -}deleteEmoji(e){return this.rest.makeRequest("delete",`${n.Endpoints.guildEmojis(e.guild.id)}/${e.id}`,!0).then(()=>this.rest.client.actions.EmojiDelete.handle(e).data)}getWebhook(e,t){return this.rest.makeRequest("get",n.Endpoints.webhook(e,t),!t).then(e=>new u(this.rest.client,e))}getGuildWebhooks(e){return this.rest.makeRequest("get",n.Endpoints.guildWebhooks(e.id),!0).then(e=>{const t=new r;for(const i of e)t.set(i.id,new u(this.rest.client,i));return t})}getChannelWebhooks(e){return this.rest.makeRequest("get",n.Endpoints.channelWebhooks(e.id),!0).then(e=>{const t=new r;for(const i of e)t.set(i.id,new u(this.rest.client,i));return t})}createWebhook(e,t,i){return this.rest.makeRequest("post",n.Endpoints.channelWebhooks(e.id),!0,{name:t,avatar:i}).then(e=>new u(this.rest.client,e))}editWebhook(e,t,i){return this.rest.makeRequest("patch",n.Endpoints.webhook(e.id,e.token),!1,{name:t,avatar:i}).then(t=>{return e.name=t.name,e.avatar=t.avatar,e})}deleteWebhook(e){return this.rest.makeRequest("delete",n.Endpoints.webhook(e.id,e.token),!1)}sendWebhookMessage(e,t,{avatarURL,tts,disableEveryone,embeds}={},i=null){return"undefined"!=typeof t&&(t=this.rest.client.resolver.resolveString(t)),t&&(disableEveryone||"undefined"==typeof disableEveryone&&this.rest.client.options.disableEveryone)&&(t=t.replace(/@(everyone|here)/g,"@​$1")),this.rest.makeRequest("post",`${n.Endpoints.webhook(e.id,e.token)}?wait=true`,!1,{username:e.name,avatar_url:avatarURL,content:t,tts:tts,file:i,embeds:embeds})}sendSlackWebhookMessage(e,t){return this.rest.makeRequest("post",`${n.Endpoints.webhook(e.id,e.token)}/slack?wait=true`,!1,t)}fetchUserProfile(e){return this.rest.makeRequest("get",n.Endpoints.userProfile(e.id),!0).then(t=>new c(e,t))}addFriend(e){return this.rest.makeRequest("post",n.Endpoints.relationships("@me"),!0,{username:e.username,discriminator:e.discriminator}).then(()=>e)}removeFriend(e){return this.rest.makeRequest("delete",`${n.Endpoints.relationships("@me")}/${e.id}`,!0).then(()=>e)}blockUser(e){return this.rest.makeRequest("put",`${n.Endpoints.relationships("@me")}/${e.id}`,!0,{type:2}).then(()=>e)}unblockUser(e){return this.rest.makeRequest("delete",`${n.Endpoints.relationships("@me")}/${e.id}`,!0).then(()=>e)}setRolePositions(e,t){return this.rest.makeRequest("patch",n.Endpoints.guildRoles(e),!0,t).then(()=>this.rest.client.actions.GuildRolesPositionUpdate.handle({guild_id:e,roles:t}).guild)}addMessageReaction(e,t){return this.rest.makeRequest("put",n.Endpoints.selfMessageReaction(e.channel.id,e.id,t),!0).then(()=>this.rest.client.actions.MessageReactionAdd.handle({user_id:this.rest.client.user.id,message_id:e.id,emoji:o(t),channel_id:e.channel.id}).reaction)}removeMessageReaction(e,t,i){let r=n.Endpoints.selfMessageReaction(e.channel.id,e.id,t);return i.id!==this.rest.client.user.id&&(r=n.Endpoints.userMessageReaction(e.channel.id,e.id,t,null,i.id)),this.rest.makeRequest("delete",r,!0).then(()=>this.rest.client.actions.MessageReactionRemove.handle({user_id:i.id,message_id:e.id,emoji:o(t),channel_id:e.channel.id}).reaction)}removeMessageReactions(e){this.rest.makeRequest("delete",n.Endpoints.messageReactions(e.channel.id,e.id),!0).then(()=>e)}getMessageReactionUsers(e,t,i=100){return this.rest.makeRequest("get",n.Endpoints.messageReaction(e.channel.id,e.id,t,i),!0)}getMyApplication(){return this.rest.makeRequest("get",n.Endpoints.myApplication,!0).then(e=>new d(this.rest.client,e))}setNote(e,t){return this.rest.makeRequest("put",n.Endpoints.note(e.id),!0,{note:t}).then(()=>e)}}e.exports=p},function(e,t){class i extends Map{constructor(e){super(e),this._array=null,this._keyArray=null}set(e,t){super.set(e,t),this._array=null,this._keyArray=null}delete(e){super.delete(e),this._array=null,this._keyArray=null}array(){return this._array&&this._array.length===this.size||(this._array=Array.from(this.values())),this._array}keyArray(){return this._keyArray&&this._keyArray.length===this.size||(this._keyArray=Array.from(this.keys())),this._keyArray}first(){return this.values().next().value}firstKey(){return this.keys().next().value}last(){const e=this.array();return e[e.length-1]}lastKey(){const e=this.keyArray();return e[e.length-1]}random(){const e=this.array();return e[Math.floor(Math.random()*e.length)]}randomKey(){const e=this.keyArray();return e[Math.floor(Math.random()*e.length)]}findAll(e,t){if("string"!=typeof e)throw new TypeError("Key must be a string.");if("undefined"==typeof t)throw new Error("Value must be specified.");const i=[];for(const n of this.values())n[e]===t&&i.push(n);return i}find(e,t){if("string"==typeof e){if("undefined"==typeof t)throw new Error("Value must be specified.");if("id"===e)throw new RangeError("Don't use .find() with IDs. Instead, use .get(id).");for(const i of this.values())if(i[e]===t)return i;return null}if("function"==typeof e){for(const[t,i]of this)if(e(i,t,this))return i;return null}throw new Error("First argument must be a property string or a function.")}findKey(e,t){if("string"==typeof e){if("undefined"==typeof t)throw new Error("Value must be specified.");for(const[i,n]of this)if(n[e]===t)return i;return null}if("function"==typeof e){for(const[t,i]of this)if(e(i,t,this))return t;return null}throw new Error("First argument must be a property string or a function.")}exists(e,t){if("id"===e)throw new RangeError("Don't use .exists() with IDs. Instead, use .has(id).");return Boolean(this.find(e,t))}filter(e,t){t&&(e=e.bind(t));const n=new i;for(const[r,s]of this)e(s,r,this)&&n.set(r,s);return n}filterArray(e,t){t&&(e=e.bind(t));const i=[];for(const[n,r]of this)e(r,n,this)&&i.push(r);return i}map(e,t){t&&(e=e.bind(t));const i=new Array(this.size);let n=0;for(const[r,s]of this)i[n++]=e(s,r,this);return i}some(e,t){t&&(e=e.bind(t));for(const[i,n]of this)if(e(n,i,this))return!0;return!1}every(e,t){t&&(e=e.bind(t));for(const[i,n]of this)if(!e(n,i,this))return!1;return!0}reduce(e,t){let i=t;for(const[n,r]of this)i=e(i,r,n,this);return i}concat(...e){const t=new this.constructor;for(const[i,n]of this)t.set(i,n);for(const r of e)for(const[i,n]of r)t.set(i,n);return t}deleteAll(){const e=[];for(const t of this.values())t.delete&&e.push(t.delete());return e}}e.exports=i},function(e,t){e.exports=function(e,{maxLength=1950,char="\n",prepend="",append=""}={}){if(e.length<=maxLength)return e;const t=e.split(char);if(1===t.length)throw new Error("Message exceeds the max length and contains no split characters.");const i=[""];let n=0;for(let r=0;rmaxLength&&(i[n]+=append,i.push(prepend),n++),i[n]+=(i[n].length>0&&i[n]!==prepend?char:"")+t[r];return i}},function(e,t){e.exports=function(e){if(e.includes("%")&&(e=decodeURIComponent(e)),e.includes(":")){const[t,i]=e.split(":");return{name:t,id:i}}return{name:e,id:null}}},function(e,t,i){const n=i(14),r=i(5),s=i(24).Presence;class o{constructor(e,t){this.client=e,Object.defineProperty(this,"client",{enumerable:!1,configurable:!1}),t&&this.setup(t)}setup(e){this.id=e.id,this.username=e.username,this.discriminator=e.discriminator,this.avatar=e.avatar,this.bot=Boolean(e.bot)}patch(e){for(const t of["id","username","discriminator","avatar","bot"])"undefined"!=typeof e[t]&&(this[t]=e[t])}get createdTimestamp(){return this.id/4194304+14200704e5}get createdAt(){return new Date(this.createdTimestamp)}get presence(){if(this.client.presences.has(this.id))return this.client.presences.get(this.id);for(const e of this.client.guilds.values())if(e.presences.has(this.id))return e.presences.get(this.id);return new s}get avatarURL(){return this.avatar?r.Endpoints.avatar(this.id,this.avatar):null}get note(){return this.client.user.notes.get(this.id)||null}typingIn(e){return e=this.client.resolver.resolveChannel(e),e._typing.has(this.id)}typingSinceIn(e){return e=this.client.resolver.resolveChannel(e),e._typing.has(this.id)?new Date(e._typing.get(this.id).since):null}typingDurationIn(e){return e=this.client.resolver.resolveChannel(e),e._typing.has(this.id)?e._typing.get(this.id).elapsedTime:-1}deleteDM(){return this.client.rest.methods.deleteChannel(this)}addFriend(){return this.client.rest.methods.addFriend(this)}removeFriend(){return this.client.rest.methods.removeFriend(this)}block(){return this.client.rest.methods.blockUser(this)}unblock(){return this.client.rest.methods.unblockUser(this)}fetchProfile(){return this.client.rest.methods.fetchUserProfile(this)}setNote(e){return this.client.rest.methods.setNote(this,e)}equals(e){let t=e&&this.id===e.id&&this.username===e.username&&this.discriminator===e.discriminator&&this.avatar===e.avatar&&this.bot===Boolean(e.bot);return t}toString(){return`<@${this.id}>`}sendMessage(){}sendTTSMessage(){}sendFile(){}sendCode(){}}n.applyToClass(o),e.exports=o},function(e,t,i){function n(e,t){Object.defineProperty(e.prototype,t,Object.getOwnPropertyDescriptor(f.prototype,t))}const r=i(15),s=i(16),o=i(23),a=i(10),l=i(19);class f{constructor(){this.messages=new a,this.lastMessageID=null}sendMessage(e,t={}){return this.client.rest.methods.sendMessage(this,e,t)}sendTTSMessage(e,t={}){return Object.assign(t,{tts:!0}),this.client.rest.methods.sendMessage(this,e,t)}sendFile(e,t,i,n={}){return t||(t="string"==typeof e?r.basename(e):e&&e.path?r.basename(e.path):"file.jpg"),this.client.resolver.resolveBuffer(e).then(e=>this.client.rest.methods.sendMessage(this,i,n,{file:e,name:t}))}sendCode(e,t,i={}){return i.split&&("object"!=typeof i.split&&(i.split={}),i.split.prepend||(i.split.prepend=`\`\`\`${e||""} -`),i.split.append||(i.split.append="\n```")),t=l(this.client.resolver.resolveString(t),!0),this.sendMessage(`\`\`\`${e||""} +!function(e){function t(r){if(i[r])return i[r].exports;var n=i[r]={i:r,l:!1,exports:{}};return e[r].call(n.exports,n,n.exports,t),n.l=!0,n.exports}var i={};return t.m=e,t.c=i,t.i=function(e){return e},t.d=function(e,t,i){Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:i})},t.n=function(e){var i=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(i,"a",i),i},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=281)}([function(e,t,i){"use strict";(function(e,r){function n(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}function s(){return e.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(t,i){if(s()=s())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s().toString(16)+" bytes");return 0|e}function m(t){return+t!=t&&(t=0),e.alloc(+t)}function w(t,i){if(e.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var r=t.length;if(0===r)return 0;for(var n=!1;;)switch(i){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return V(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return Z(t).length;default:if(n)return V(t).length;i=(""+i).toLowerCase(),n=!0}}function g(e,t,i){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===i||i>this.length)&&(i=this.length),i<=0)return"";if(i>>>=0,t>>>=0,i<=t)return"";for(e||(e="utf8");;)switch(e){case"hex":return O(this,t,i);case"utf8":case"utf-8":return x(this,t,i);case"ascii":return I(this,t,i);case"latin1":case"binary":return P(this,t,i);case"base64":return R(this,t,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return N(this,t,i);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function v(e,t,i){var r=e[t];e[t]=e[i],e[i]=r}function _(t,i,r,n,s){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=s?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(s)return-1;r=t.length-1}else if(r<0){if(!s)return-1;r=0}if("string"==typeof i&&(i=e.from(i,n)),e.isBuffer(i))return 0===i.length?-1:y(t,i,r,n,s);if("number"==typeof i)return i&=255,e.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?s?Uint8Array.prototype.indexOf.call(t,i,r):Uint8Array.prototype.lastIndexOf.call(t,i,r):y(t,[i],r,n,s);throw new TypeError("val must be string, number or Buffer")}function y(e,t,i,r,n){function s(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}var a=1,o=e.length,f=t.length;if(void 0!==r&&(r=String(r).toLowerCase(),"ucs2"===r||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;a=2,o/=2,f/=2,i/=2}var h;if(n){var c=-1;for(h=i;ho&&(i=o-f),h=i;h>=0;h--){for(var l=!0,u=0;un&&(r=n)):r=n;var s=t.length;if(s%2!==0)throw new TypeError("Invalid hex string");r>s/2&&(r=s/2);for(var a=0;a239?4:s>223?3:s>191?2:1;if(n+o<=i){var f,h,c,l;switch(o){case 1:s<128&&(a=s);break;case 2:f=e[n+1],128===(192&f)&&(l=(31&s)<<6|63&f,l>127&&(a=l));break;case 3:f=e[n+1],h=e[n+2],128===(192&f)&&128===(192&h)&&(l=(15&s)<<12|(63&f)<<6|63&h,l>2047&&(l<55296||l>57343)&&(a=l));break;case 4:f=e[n+1],h=e[n+2],c=e[n+3],128===(192&f)&&128===(192&h)&&128===(192&c)&&(l=(15&s)<<18|(63&f)<<12|(63&h)<<6|63&c,l>65535&&l<1114112&&(a=l))}}null===a?(a=65533,o=1):a>65535&&(a-=65536,r.push(a>>>10&1023|55296),a=56320|1023&a),r.push(a),n+=o}return C(r)}function C(e){var t=e.length;if(t<=ee)return String.fromCharCode.apply(String,e);for(var i="",r=0;rr)&&(i=r);for(var n="",s=t;si)throw new RangeError("Trying to access beyond buffer length")}function L(t,i,r,n,s,a){if(!e.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(i>s||it.length)throw new RangeError("Index out of range")}function B(e,t,i,r){t<0&&(t=65535+t+1);for(var n=0,s=Math.min(e.length-i,2);n>>8*(r?n:1-n)}function U(e,t,i,r){t<0&&(t=4294967295+t+1);for(var n=0,s=Math.min(e.length-i,4);n>>8*(r?n:3-n)&255}function j(e,t,i,r,n,s){if(i+r>e.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("Index out of range")}function F(e,t,i,r,n){return n||j(e,t,i,4,3.4028234663852886e38,-3.4028234663852886e38),J.write(e,t,i,r,23,4),i+4}function z(e,t,i,r,n){return n||j(e,t,i,8,1.7976931348623157e308,-1.7976931348623157e308),J.write(e,t,i,r,52,8),i+8}function q(e){if(e=H(e).replace(te,""),e.length<2)return"";for(;e.length%4!==0;)e+="=";return e}function H(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function G(e){return e<16?"0"+e.toString(16):e.toString(16)}function V(e,t){t=t||1/0;for(var i,r=e.length,n=null,s=[],a=0;a55295&&i<57344){if(!n){if(i>56319){(t-=3)>-1&&s.push(239,191,189);continue}if(a+1===r){(t-=3)>-1&&s.push(239,191,189);continue}n=i;continue}if(i<56320){(t-=3)>-1&&s.push(239,191,189),n=i;continue}i=(n-55296<<10|i-56320)+65536}else n&&(t-=3)>-1&&s.push(239,191,189);if(n=null,i<128){if((t-=1)<0)break;s.push(i)}else if(i<2048){if((t-=2)<0)break;s.push(i>>6|192,63&i|128)}else if(i<65536){if((t-=3)<0)break;s.push(i>>12|224,i>>6&63|128,63&i|128)}else{if(!(i<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;s.push(i>>18|240,i>>12&63|128,i>>6&63|128,63&i|128)}}return s}function W(e){for(var t=[],i=0;i>8,n=i%256,s.push(n),s.push(r);return s}function Z(e){return X.toByteArray(q(e))}function Y(e,t,i,r){for(var n=0;n=t.length||n>=e.length);++n)t[n+i]=e[n];return n}function $(e){return e!==e}var X=i(148),J=i(198),Q=i(102);t.Buffer=e,t.SlowBuffer=m,t.INSPECT_MAX_BYTES=50,e.TYPED_ARRAY_SUPPORT=void 0!==r.TYPED_ARRAY_SUPPORT?r.TYPED_ARRAY_SUPPORT:n(),t.kMaxLength=s(),e.poolSize=8192,e._augment=function(t){return t.__proto__=e.prototype,t},e.from=function(e,t,i){return o(null,e,t,i)},e.TYPED_ARRAY_SUPPORT&&(e.prototype.__proto__=Uint8Array.prototype,e.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&e[Symbol.species]===e&&Object.defineProperty(e,Symbol.species,{value:null,configurable:!0})),e.alloc=function(e,t,i){return h(null,e,t,i)},e.allocUnsafe=function(e){return c(null,e)},e.allocUnsafeSlow=function(e){return c(null,e)},e.isBuffer=function(e){return!(null==e||!e._isBuffer)},e.compare=function(t,i){if(!e.isBuffer(t)||!e.isBuffer(i))throw new TypeError("Arguments must be Buffers");if(t===i)return 0;for(var r=t.length,n=i.length,s=0,a=Math.min(r,n);s0&&(e=this.toString("hex",0,i).match(/.{2}/g).join(" "),this.length>i&&(e+=" ... ")),""},e.prototype.compare=function(t,i,r,n,s){if(!e.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===i&&(i=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===s&&(s=this.length),i<0||r>t.length||n<0||s>this.length)throw new RangeError("out of range index");if(n>=s&&i>=r)return 0;if(n>=s)return-1;if(i>=r)return 1;if(i>>>=0,r>>>=0,n>>>=0,s>>>=0,this===t)return 0;for(var a=s-n,o=r-i,f=Math.min(a,o),h=this.slice(n,s),c=t.slice(i,r),l=0;ln)&&(i=n),e.length>0&&(i<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var s=!1;;)switch(r){case"hex":return k(this,e,t,i);case"utf8":case"utf-8":return E(this,e,t,i);case"ascii":return A(this,e,t,i);case"latin1":case"binary":return S(this,e,t,i);case"base64":return M(this,e,t,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T(this,e,t,i);default:if(s)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),s=!0}},e.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var ee=4096;e.prototype.slice=function(t,i){var r=this.length;t=~~t,i=void 0===i?r:~~i,t<0?(t+=r,t<0&&(t=0)):t>r&&(t=r),i<0?(i+=r,i<0&&(i=0)):i>r&&(i=r),i0&&(n*=256);)r+=this[e+--t]*n;return r},e.prototype.readUInt8=function(e,t){return t||D(e,1,this.length),this[e]},e.prototype.readUInt16LE=function(e,t){return t||D(e,2,this.length),this[e]|this[e+1]<<8},e.prototype.readUInt16BE=function(e,t){return t||D(e,2,this.length),this[e]<<8|this[e+1]},e.prototype.readUInt32LE=function(e,t){return t||D(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},e.prototype.readUInt32BE=function(e,t){return t||D(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},e.prototype.readIntLE=function(e,t,i){e|=0,t|=0,i||D(e,t,this.length);for(var r=this[e],n=1,s=0;++s=n&&(r-=Math.pow(2,8*t)),r},e.prototype.readIntBE=function(e,t,i){e|=0,t|=0,i||D(e,t,this.length);for(var r=t,n=1,s=this[e+--r];r>0&&(n*=256);)s+=this[e+--r]*n;return n*=128,s>=n&&(s-=Math.pow(2,8*t)),s},e.prototype.readInt8=function(e,t){return t||D(e,1,this.length),128&this[e]?(255-this[e]+1)*-1:this[e]},e.prototype.readInt16LE=function(e,t){t||D(e,2,this.length);var i=this[e]|this[e+1]<<8;return 32768&i?4294901760|i:i},e.prototype.readInt16BE=function(e,t){t||D(e,2,this.length);var i=this[e+1]|this[e]<<8;return 32768&i?4294901760|i:i},e.prototype.readInt32LE=function(e,t){return t||D(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},e.prototype.readInt32BE=function(e,t){return t||D(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},e.prototype.readFloatLE=function(e,t){return t||D(e,4,this.length),J.read(this,e,!0,23,4)},e.prototype.readFloatBE=function(e,t){return t||D(e,4,this.length),J.read(this,e,!1,23,4)},e.prototype.readDoubleLE=function(e,t){return t||D(e,8,this.length),J.read(this,e,!0,52,8)},e.prototype.readDoubleBE=function(e,t){return t||D(e,8,this.length),J.read(this,e,!1,52,8)},e.prototype.writeUIntLE=function(e,t,i,r){if(e=+e,t|=0,i|=0,!r){var n=Math.pow(2,8*i)-1;L(this,e,t,i,n,0)}var s=1,a=0;for(this[t]=255&e;++a=0&&(a*=256);)this[t+s]=e/a&255;return t+i},e.prototype.writeUInt8=function(t,i,r){return t=+t,i|=0,r||L(this,t,i,1,255,0),e.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[i]=255&t,i+1},e.prototype.writeUInt16LE=function(t,i,r){return t=+t,i|=0,r||L(this,t,i,2,65535,0),e.TYPED_ARRAY_SUPPORT?(this[i]=255&t,this[i+1]=t>>>8):B(this,t,i,!0),i+2},e.prototype.writeUInt16BE=function(t,i,r){return t=+t,i|=0,r||L(this,t,i,2,65535,0),e.TYPED_ARRAY_SUPPORT?(this[i]=t>>>8,this[i+1]=255&t):B(this,t,i,!1),i+2},e.prototype.writeUInt32LE=function(t,i,r){return t=+t,i|=0,r||L(this,t,i,4,4294967295,0),e.TYPED_ARRAY_SUPPORT?(this[i+3]=t>>>24,this[i+2]=t>>>16,this[i+1]=t>>>8,this[i]=255&t):U(this,t,i,!0),i+4},e.prototype.writeUInt32BE=function(t,i,r){return t=+t,i|=0,r||L(this,t,i,4,4294967295,0),e.TYPED_ARRAY_SUPPORT?(this[i]=t>>>24,this[i+1]=t>>>16,this[i+2]=t>>>8,this[i+3]=255&t):U(this,t,i,!1),i+4},e.prototype.writeIntLE=function(e,t,i,r){if(e=+e,t|=0,!r){var n=Math.pow(2,8*i-1);L(this,e,t,i,n-1,-n)}var s=0,a=1,o=0;for(this[t]=255&e;++s>0)-o&255;return t+i},e.prototype.writeIntBE=function(e,t,i,r){if(e=+e,t|=0,!r){var n=Math.pow(2,8*i-1);L(this,e,t,i,n-1,-n)}var s=i-1,a=1,o=0;for(this[t+s]=255&e;--s>=0&&(a*=256);)e<0&&0===o&&0!==this[t+s+1]&&(o=1),this[t+s]=(e/a>>0)-o&255;return t+i},e.prototype.writeInt8=function(t,i,r){return t=+t,i|=0,r||L(this,t,i,1,127,-128),e.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[i]=255&t,i+1},e.prototype.writeInt16LE=function(t,i,r){return t=+t,i|=0,r||L(this,t,i,2,32767,-32768),e.TYPED_ARRAY_SUPPORT?(this[i]=255&t,this[i+1]=t>>>8):B(this,t,i,!0),i+2},e.prototype.writeInt16BE=function(t,i,r){return t=+t,i|=0,r||L(this,t,i,2,32767,-32768),e.TYPED_ARRAY_SUPPORT?(this[i]=t>>>8,this[i+1]=255&t):B(this,t,i,!1),i+2},e.prototype.writeInt32LE=function(t,i,r){return t=+t,i|=0,r||L(this,t,i,4,2147483647,-2147483648),e.TYPED_ARRAY_SUPPORT?(this[i]=255&t,this[i+1]=t>>>8,this[i+2]=t>>>16,this[i+3]=t>>>24):U(this,t,i,!0),i+4},e.prototype.writeInt32BE=function(t,i,r){return t=+t,i|=0,r||L(this,t,i,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),e.TYPED_ARRAY_SUPPORT?(this[i]=t>>>24,this[i+1]=t>>>16,this[i+2]=t>>>8,this[i+3]=255&t):U(this,t,i,!1),i+4},e.prototype.writeFloatLE=function(e,t,i){return F(this,e,t,!0,i)},e.prototype.writeFloatBE=function(e,t,i){return F(this,e,t,!1,i)},e.prototype.writeDoubleLE=function(e,t,i){return z(this,e,t,!0,i)},e.prototype.writeDoubleBE=function(e,t,i){return z(this,e,t,!1,i)},e.prototype.copy=function(t,i,r,n){if(r||(r=0),n||0===n||(n=this.length),i>=t.length&&(i=t.length),i||(i=0),n>0&&n=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-i=0;--s)t[s+i]=this[s+r];else if(a<1e3||!e.TYPED_ARRAY_SUPPORT)for(s=0;s>>=0,r=void 0===r?this.length:r>>>0,t||(t=0);var a;if("number"==typeof t)for(a=i;a`${n}/invite/${e}`,inviteLink:e=>`https://discord.gg/${e}`,CDN:"https://cdn.discordapp.com",user:e=>`${n}/users/${e}`,userChannels:e=>`${s.user(e)}/channels`,userProfile:e=>`${s.user(e)}/profile`,avatar:(e,t)=>"1"===e?t:`${s.user(e)}/avatars/${t}.jpg`,me:`${n}/users/@me`,meGuild:e=>`${s.me}/guilds/${e}`,relationships:e=>`${s.user(e)}/relationships`,note:e=>`${s.me}/notes/${e}`,guilds:`${n}/guilds`,guild:e=>`${s.guilds}/${e}`,guildIcon:(e,t)=>`${s.guild(e)}/icons/${t}.jpg`,guildPrune:e=>`${s.guild(e)}/prune`,guildEmbed:e=>`${s.guild(e)}/embed`,guildInvites:e=>`${s.guild(e)}/invites`,guildRoles:e=>`${s.guild(e)}/roles`,guildRole:(e,t)=>`${s.guildRoles(e)}/${t}`,guildBans:e=>`${s.guild(e)}/bans`,guildIntegrations:e=>`${s.guild(e)}/integrations`,guildMembers:e=>`${s.guild(e)}/members`,guildMember:(e,t)=>`${s.guildMembers(e)}/${t}`,stupidInconsistentGuildEndpoint:e=>`${s.guildMember(e,"@me")}/nick`,guildChannels:e=>`${s.guild(e)}/channels`,guildEmojis:e=>`${s.guild(e)}/emojis`,channels:`${n}/channels`,channel:e=>`${s.channels}/${e}`,channelMessages:e=>`${s.channel(e)}/messages`,channelInvites:e=>`${s.channel(e)}/invites`,channelTyping:e=>`${s.channel(e)}/typing`,channelPermissions:e=>`${s.channel(e)}/permissions`,channelMessage:(e,t)=>`${s.channelMessages(e)}/${t}`,channelWebhooks:e=>`${s.channel(e)}/webhooks`,messageReactions:(e,t)=>`${s.channelMessage(e,t)}/reactions`,messageReaction:(e,t,i,r)=>`${s.messageReactions(e,t)}/${i}`+`${r?`?limit=${r}`:""}`,selfMessageReaction:(e,t,i,r)=>`${s.messageReaction(e,t,i,r)}/@me`,userMessageReaction:(e,t,i,r,n)=>`${s.messageReaction(e,t,i,r)}/${n}`,webhook:(e,t)=>`${n}/webhooks/${e}${t?`/${t}`:""}`,myApplication:`${n}/oauth2/applications/@me`,getApp:e=>`${n}/oauth2/authorize?client_id=${e}`};t.Status={READY:0,CONNECTING:1,RECONNECTING:2,IDLE:3,NEARLY:4},t.ChannelTypes={text:0,DM:1,voice:2,groupDM:3},t.OPCodes={DISPATCH:0,HEARTBEAT:1,IDENTIFY:2,STATUS_UPDATE:3,VOICE_STATE_UPDATE:4,VOICE_GUILD_PING:5,RESUME:6,RECONNECT:7,REQUEST_GUILD_MEMBERS:8,INVALID_SESSION:9,HELLO:10,HEARTBEAT_ACK:11},t.VoiceOPCodes={IDENTIFY:0,SELECT_PROTOCOL:1,READY:2,HEARTBEAT:3,SESSION_DESCRIPTION:4,SPEAKING:5},t.Events={READY:"ready",GUILD_CREATE:"guildCreate",GUILD_DELETE:"guildDelete",GUILD_UPDATE:"guildUpdate",GUILD_UNAVAILABLE:"guildUnavailable",GUILD_AVAILABLE:"guildAvailable",GUILD_MEMBER_ADD:"guildMemberAdd",GUILD_MEMBER_REMOVE:"guildMemberRemove",GUILD_MEMBER_UPDATE:"guildMemberUpdate",GUILD_MEMBER_AVAILABLE:"guildMemberAvailable",GUILD_MEMBER_SPEAKING:"guildMemberSpeaking",GUILD_MEMBERS_CHUNK:"guildMembersChunk",GUILD_ROLE_CREATE:"roleCreate",GUILD_ROLE_DELETE:"roleDelete",GUILD_ROLE_UPDATE:"roleUpdate",GUILD_EMOJI_CREATE:"guildEmojiCreate",GUILD_EMOJI_DELETE:"guildEmojiDelete",GUILD_EMOJI_UPDATE:"guildEmojiUpdate",GUILD_BAN_ADD:"guildBanAdd",GUILD_BAN_REMOVE:"guildBanRemove",CHANNEL_CREATE:"channelCreate",CHANNEL_DELETE:"channelDelete",CHANNEL_UPDATE:"channelUpdate",CHANNEL_PINS_UPDATE:"channelPinsUpdate",MESSAGE_CREATE:"message",MESSAGE_DELETE:"messageDelete",MESSAGE_UPDATE:"messageUpdate",MESSAGE_BULK_DELETE:"messageDeleteBulk",MESSAGE_REACTION_ADD:"messageReactionAdd",MESSAGE_REACTION_REMOVE:"messageReactionRemove",MESSAGE_REACTION_REMOVE_ALL:"messageReactionRemoveAll",USER_UPDATE:"userUpdate",USER_NOTE_UPDATE:"userNoteUpdate",PRESENCE_UPDATE:"presenceUpdate",VOICE_STATE_UPDATE:"voiceStateUpdate",TYPING_START:"typingStart",TYPING_STOP:"typingStop",DISCONNECT:"disconnect",RECONNECTING:"reconnecting",ERROR:"error",WARN:"warn",DEBUG:"debug"},t.WSEvents={READY:"READY",GUILD_SYNC:"GUILD_SYNC",GUILD_CREATE:"GUILD_CREATE",GUILD_DELETE:"GUILD_DELETE",GUILD_UPDATE:"GUILD_UPDATE",GUILD_MEMBER_ADD:"GUILD_MEMBER_ADD",GUILD_MEMBER_REMOVE:"GUILD_MEMBER_REMOVE",GUILD_MEMBER_UPDATE:"GUILD_MEMBER_UPDATE",GUILD_MEMBERS_CHUNK:"GUILD_MEMBERS_CHUNK",GUILD_ROLE_CREATE:"GUILD_ROLE_CREATE",GUILD_ROLE_DELETE:"GUILD_ROLE_DELETE",GUILD_ROLE_UPDATE:"GUILD_ROLE_UPDATE",GUILD_BAN_ADD:"GUILD_BAN_ADD",GUILD_BAN_REMOVE:"GUILD_BAN_REMOVE",CHANNEL_CREATE:"CHANNEL_CREATE",CHANNEL_DELETE:"CHANNEL_DELETE",CHANNEL_UPDATE:"CHANNEL_UPDATE",CHANNEL_PINS_UPDATE:"CHANNEL_PINS_UPDATE",MESSAGE_CREATE:"MESSAGE_CREATE",MESSAGE_DELETE:"MESSAGE_DELETE",MESSAGE_UPDATE:"MESSAGE_UPDATE",MESSAGE_DELETE_BULK:"MESSAGE_DELETE_BULK",MESSAGE_REACTION_ADD:"MESSAGE_REACTION_ADD",MESSAGE_REACTION_REMOVE:"MESSAGE_REACTION_REMOVE",MESSAGE_REACTION_REMOVE_ALL:"MESSAGE_REACTION_REMOVE_ALL",USER_UPDATE:"USER_UPDATE",USER_NOTE_UPDATE:"USER_NOTE_UPDATE",PRESENCE_UPDATE:"PRESENCE_UPDATE",VOICE_STATE_UPDATE:"VOICE_STATE_UPDATE",TYPING_START:"TYPING_START",FRIEND_ADD:"RELATIONSHIP_ADD",FRIEND_REMOVE:"RELATIONSHIP_REMOVE",VOICE_SERVER_UPDATE:"VOICE_SERVER_UPDATE",RELATIONSHIP_ADD:"RELATIONSHIP_ADD",RELATIONSHIP_REMOVE:"RELATIONSHIP_REMOVE"},t.MessageTypes={0:"DEFAULT",1:"RECIPIENT_ADD",2:"RECIPIENT_REMOVE",3:"CALL",4:"CHANNEL_NAME_CHANGE",5:"CHANNEL_ICON_CHANGE",6:"PINS_ADD"};const a=t.PermissionFlags={CREATE_INSTANT_INVITE:1,KICK_MEMBERS:2,BAN_MEMBERS:4,ADMINISTRATOR:8,MANAGE_CHANNELS:16,MANAGE_GUILD:32,ADD_REACTIONS:64,READ_MESSAGES:1024,SEND_MESSAGES:2048,SEND_TTS_MESSAGES:4096,MANAGE_MESSAGES:8192,EMBED_LINKS:16384,ATTACH_FILES:32768,READ_MESSAGE_HISTORY:65536,MENTION_EVERYONE:1<<17,EXTERNAL_EMOJIS:1<<18,CONNECT:1<<20,SPEAK:1<<21,MUTE_MEMBERS:1<<22,DEAFEN_MEMBERS:1<<23,MOVE_MEMBERS:1<<24,USE_VAD:1<<25,CHANGE_NICKNAME:1<<26,MANAGE_NICKNAMES:1<<27,MANAGE_ROLES_OR_PERMISSIONS:1<<28,MANAGE_WEBHOOKS:1<<29,MANAGE_EMOJIS:1<<30};let o=0;for(const f in a)o|=a[f];t.ALL_PERMISSIONS=o,t.DEFAULT_PERMISSIONS=104324097}).call(t,i(5))},function(e,t){function i(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function r(e){return"function"==typeof e}function n(e){return"number"==typeof e}function s(e){return"object"==typeof e&&null!==e}function a(e){return void 0===e}e.exports=i,i.EventEmitter=i,i.prototype._events=void 0,i.prototype._maxListeners=void 0,i.defaultMaxListeners=10,i.prototype.setMaxListeners=function(e){if(!n(e)||e<0||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},i.prototype.emit=function(e){var t,i,n,o,f,h;if(this._events||(this._events={}),"error"===e&&(!this._events.error||s(this._events.error)&&!this._events.error.length)){if(t=arguments[1],t instanceof Error)throw t;var c=new Error('Uncaught, unspecified "error" event. ('+t+")");throw c.context=t,c}if(i=this._events[e],a(i))return!1;if(r(i))switch(arguments.length){case 1:i.call(this);break;case 2:i.call(this,arguments[1]);break;case 3:i.call(this,arguments[1],arguments[2]);break;default:o=Array.prototype.slice.call(arguments,1),i.apply(this,o)}else if(s(i))for(o=Array.prototype.slice.call(arguments,1),h=i.slice(),n=h.length,f=0;f0&&this._events[e].length>n&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace())),this},i.prototype.on=i.prototype.addListener,i.prototype.once=function(e,t){function i(){this.removeListener(e,i),n||(n=!0,t.apply(this,arguments))}if(!r(t))throw TypeError("listener must be a function");var n=!1;return i.listener=t,this.on(e,i),this},i.prototype.removeListener=function(e,t){var i,n,a,o;if(!r(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(i=this._events[e],a=i.length,n=-1,i===t||r(i.listener)&&i.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(s(i)){for(o=a;o-- >0;)if(i[o]===t||i[o].listener&&i[o].listener===t){n=o;break}if(n<0)return this;1===i.length?(i.length=0,delete this._events[e]):i.splice(n,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},i.prototype.removeAllListeners=function(e){var t,i;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(i=this._events[e],r(i))this.removeListener(e,i);else if(i)for(;i.length;)this.removeListener(e,i[i.length-1]);return delete this._events[e],this},i.prototype.listeners=function(e){var t;return t=this._events&&this._events[e]?r(this._events[e])?[this._events[e]]:this._events[e].slice():[]},i.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(r(t))return 1;if(t)return t.length}return 0},i.listenerCount=function(e,t){return e.listenerCount(t)}},function(e,t,i){(function(e){!function(e,t){"use strict";function r(e,t){if(!e)throw new Error(t||"Assertion failed")}function n(e,t){e.super_=t;var i=function(){};i.prototype=t.prototype,e.prototype=new i,e.prototype.constructor=e}function s(e,t,i){return s.isBN(e)?e:(this.negative=0,this.words=null,this.length=0,this.red=null,void(null!==e&&("le"!==t&&"be"!==t||(i=t,t=10),this._init(e||0,t||10,i||"be"))))}function a(e,t,i){for(var r=0,n=Math.min(e.length,i),s=t;s=49&&a<=54?a-49+10:a>=17&&a<=22?a-17+10:15&a}return r}function o(e,t,i,r){for(var n=0,s=Math.min(e.length,i),a=t;a=49?o-49+10:o>=17?o-17+10:o}return n}function f(e){for(var t=new Array(e.bitLength()),i=0;i>>n}return t}function h(e,t,i){i.negative=t.negative^e.negative; +var r=e.length+t.length|0;i.length=r,r=r-1|0;var n=0|e.words[0],s=0|t.words[0],a=n*s,o=67108863&a,f=a/67108864|0;i.words[0]=o;for(var h=1;h>>26,l=67108863&f,u=Math.min(h,t.length-1),d=Math.max(0,h-e.length+1);d<=u;d++){var p=h-d|0;n=0|e.words[p],s=0|t.words[d],a=n*s+l,c+=a/67108864|0,l=67108863&a}i.words[h]=0|l,f=0|c}return 0!==f?i.words[h]=0|f:i.length--,i.strip()}function c(e,t,i){i.negative=t.negative^e.negative,i.length=e.length+t.length;for(var r=0,n=0,s=0;s>>26)|0,n+=a>>>26,a&=67108863}i.words[s]=o,r=a,a=n}return 0!==r?i.words[s]=r:i.length--,i.strip()}function l(e,t,i){var r=new u;return r.mulp(e,t,i)}function u(e,t){this.x=e,this.y=t}function d(e,t){this.name=e,this.p=new s(t,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function p(){d.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function b(){d.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function m(){d.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function w(){d.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function g(e){if("string"==typeof e){var t=s._prime(e);this.m=t.p,this.prime=t}else r(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function v(e){g.call(this,e),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new s(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}"object"==typeof e?e.exports=s:t.BN=s,s.BN=s,s.wordSize=26;var _;try{_=i(0).Buffer}catch(e){}s.isBN=function(e){return e instanceof s||null!==e&&"object"==typeof e&&e.constructor.wordSize===s.wordSize&&Array.isArray(e.words)},s.max=function(e,t){return e.cmp(t)>0?e:t},s.min=function(e,t){return e.cmp(t)<0?e:t},s.prototype._init=function(e,t,i){if("number"==typeof e)return this._initNumber(e,t,i);if("object"==typeof e)return this._initArray(e,t,i);"hex"===t&&(t=16),r(t===(0|t)&&t>=2&&t<=36),e=e.toString().replace(/\s+/g,"");var n=0;"-"===e[0]&&n++,16===t?this._parseHex(e,n):this._parseBase(e,t,n),"-"===e[0]&&(this.negative=1),this.strip(),"le"===i&&this._initArray(this.toArray(),t,i)},s.prototype._initNumber=function(e,t,i){e<0&&(this.negative=1,e=-e),e<67108864?(this.words=[67108863&e],this.length=1):e<4503599627370496?(this.words=[67108863&e,e/67108864&67108863],this.length=2):(r(e<9007199254740992),this.words=[67108863&e,e/67108864&67108863,1],this.length=3),"le"===i&&this._initArray(this.toArray(),t,i)},s.prototype._initArray=function(e,t,i){if(r("number"==typeof e.length),e.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(e.length/3),this.words=new Array(this.length);for(var n=0;n=0;n-=3)a=e[n]|e[n-1]<<8|e[n-2]<<16,this.words[s]|=a<>>26-o&67108863,o+=24,o>=26&&(o-=26,s++);else if("le"===i)for(n=0,s=0;n>>26-o&67108863,o+=24,o>=26&&(o-=26,s++);return this.strip()},s.prototype._parseHex=function(e,t){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var i=0;i=t;i-=6)n=a(e,i,i+6),this.words[r]|=n<>>26-s&4194303,s+=24,s>=26&&(s-=26,r++);i+6!==t&&(n=a(e,t,i+6),this.words[r]|=n<>>26-s&4194303),this.strip()},s.prototype._parseBase=function(e,t,i){this.words=[0],this.length=1;for(var r=0,n=1;n<=67108863;n*=t)r++;r--,n=n/t|0;for(var s=e.length-i,a=s%r,f=Math.min(s,s-a)+i,h=0,c=i;c1&&0===this.words[this.length-1];)this.length--;return this._normSign()},s.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},s.prototype.inspect=function(){return(this.red?""};var y=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],k=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],E=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];s.prototype.toString=function(e,t){e=e||10,t=0|t||1;var i;if(16===e||"hex"===e){i="";for(var n=0,s=0,a=0;a>>24-n&16777215,i=0!==s||a!==this.length-1?y[6-f.length]+f+i:f+i,n+=2,n>=26&&(n-=26,a--)}for(0!==s&&(i=s.toString(16)+i);i.length%t!==0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}if(e===(0|e)&&e>=2&&e<=36){var h=k[e],c=E[e];i="";var l=this.clone();for(l.negative=0;!l.isZero();){var u=l.modn(c).toString(e);l=l.idivn(c),i=l.isZero()?u+i:y[h-u.length]+u+i}for(this.isZero()&&(i="0"+i);i.length%t!==0;)i="0"+i;return 0!==this.negative&&(i="-"+i),i}r(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},s.prototype.toJSON=function(){return this.toString(16)},s.prototype.toBuffer=function(e,t){return r("undefined"!=typeof _),this.toArrayLike(_,e,t)},s.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},s.prototype.toArrayLike=function(e,t,i){var n=this.byteLength(),s=i||Math.max(1,n);r(n<=s,"byte array longer than desired length"),r(s>0,"Requested array length <= 0"),this.strip();var a,o,f="le"===t,h=new e(s),c=this.clone();if(f){for(o=0;!c.isZero();o++)a=c.andln(255),c.iushrn(8),h[o]=a;for(;o=4096&&(i+=13,t>>>=13),t>=64&&(i+=7,t>>>=7),t>=8&&(i+=4,t>>>=4),t>=2&&(i+=2,t>>>=2),i+t},s.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,i=0;return 0===(8191&t)&&(i+=13,t>>>=13),0===(127&t)&&(i+=7,t>>>=7),0===(15&t)&&(i+=4,t>>>=4),0===(3&t)&&(i+=2,t>>>=2),0===(1&t)&&i++,i},s.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},s.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},s.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var i=0;ie.length?this.clone().iand(e):e.clone().iand(this)},s.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},s.prototype.iuxor=function(e){var t,i;this.length>e.length?(t=this,i=e):(t=e,i=this);for(var r=0;re.length?this.clone().ixor(e):e.clone().ixor(this)},s.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},s.prototype.inotn=function(e){r("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),i=e%26;this._expand(t),i>0&&t--;for(var n=0;n0&&(this.words[n]=~this.words[n]&67108863>>26-i),this.strip()},s.prototype.notn=function(e){return this.clone().inotn(e)},s.prototype.setn=function(e,t){r("number"==typeof e&&e>=0);var i=e/26|0,n=e%26;return this._expand(i+1),t?this.words[i]=this.words[i]|1<e.length?(i=this,r=e):(i=e,r=this);for(var n=0,s=0;s>>26;for(;0!==n&&s>>26;if(this.length=i.length,0!==n)this.words[this.length]=n,this.length++;else if(i!==this)for(;se.length?this.clone().iadd(e):e.clone().iadd(this)},s.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;var r,n;i>0?(r=this,n=e):(r=e,n=this);for(var s=0,a=0;a>26,this.words[a]=67108863&t;for(;0!==s&&a>26,this.words[a]=67108863&t;if(0===s&&a>>13,d=0|a[1],p=8191&d,b=d>>>13,m=0|a[2],w=8191&m,g=m>>>13,v=0|a[3],_=8191&v,y=v>>>13,k=0|a[4],E=8191&k,A=k>>>13,S=0|a[5],M=8191&S,T=S>>>13,R=0|a[6],x=8191&R,C=R>>>13,I=0|a[7],P=8191&I,O=I>>>13,N=0|a[8],D=8191&N,L=N>>>13,B=0|a[9],U=8191&B,j=B>>>13,F=0|o[0],z=8191&F,q=F>>>13,H=0|o[1],G=8191&H,V=H>>>13,W=0|o[2],K=8191&W,Z=W>>>13,Y=0|o[3],$=8191&Y,X=Y>>>13,J=0|o[4],Q=8191&J,ee=J>>>13,te=0|o[5],ie=8191&te,re=te>>>13,ne=0|o[6],se=8191&ne,ae=ne>>>13,oe=0|o[7],fe=8191&oe,he=oe>>>13,ce=0|o[8],le=8191&ce,ue=ce>>>13,de=0|o[9],pe=8191&de,be=de>>>13;i.negative=e.negative^t.negative,i.length=19,r=Math.imul(l,z),n=Math.imul(l,q),n=n+Math.imul(u,z)|0,s=Math.imul(u,q);var me=(h+r|0)+((8191&n)<<13)|0;h=(s+(n>>>13)|0)+(me>>>26)|0,me&=67108863,r=Math.imul(p,z),n=Math.imul(p,q),n=n+Math.imul(b,z)|0,s=Math.imul(b,q),r=r+Math.imul(l,G)|0,n=n+Math.imul(l,V)|0,n=n+Math.imul(u,G)|0,s=s+Math.imul(u,V)|0;var we=(h+r|0)+((8191&n)<<13)|0;h=(s+(n>>>13)|0)+(we>>>26)|0,we&=67108863,r=Math.imul(w,z),n=Math.imul(w,q),n=n+Math.imul(g,z)|0,s=Math.imul(g,q),r=r+Math.imul(p,G)|0,n=n+Math.imul(p,V)|0,n=n+Math.imul(b,G)|0,s=s+Math.imul(b,V)|0,r=r+Math.imul(l,K)|0,n=n+Math.imul(l,Z)|0,n=n+Math.imul(u,K)|0,s=s+Math.imul(u,Z)|0;var ge=(h+r|0)+((8191&n)<<13)|0;h=(s+(n>>>13)|0)+(ge>>>26)|0,ge&=67108863,r=Math.imul(_,z),n=Math.imul(_,q),n=n+Math.imul(y,z)|0,s=Math.imul(y,q),r=r+Math.imul(w,G)|0,n=n+Math.imul(w,V)|0,n=n+Math.imul(g,G)|0,s=s+Math.imul(g,V)|0,r=r+Math.imul(p,K)|0,n=n+Math.imul(p,Z)|0,n=n+Math.imul(b,K)|0,s=s+Math.imul(b,Z)|0,r=r+Math.imul(l,$)|0,n=n+Math.imul(l,X)|0,n=n+Math.imul(u,$)|0,s=s+Math.imul(u,X)|0;var ve=(h+r|0)+((8191&n)<<13)|0;h=(s+(n>>>13)|0)+(ve>>>26)|0,ve&=67108863,r=Math.imul(E,z),n=Math.imul(E,q),n=n+Math.imul(A,z)|0,s=Math.imul(A,q),r=r+Math.imul(_,G)|0,n=n+Math.imul(_,V)|0,n=n+Math.imul(y,G)|0,s=s+Math.imul(y,V)|0,r=r+Math.imul(w,K)|0,n=n+Math.imul(w,Z)|0,n=n+Math.imul(g,K)|0,s=s+Math.imul(g,Z)|0,r=r+Math.imul(p,$)|0,n=n+Math.imul(p,X)|0,n=n+Math.imul(b,$)|0,s=s+Math.imul(b,X)|0,r=r+Math.imul(l,Q)|0,n=n+Math.imul(l,ee)|0,n=n+Math.imul(u,Q)|0,s=s+Math.imul(u,ee)|0;var _e=(h+r|0)+((8191&n)<<13)|0;h=(s+(n>>>13)|0)+(_e>>>26)|0,_e&=67108863,r=Math.imul(M,z),n=Math.imul(M,q),n=n+Math.imul(T,z)|0,s=Math.imul(T,q),r=r+Math.imul(E,G)|0,n=n+Math.imul(E,V)|0,n=n+Math.imul(A,G)|0,s=s+Math.imul(A,V)|0,r=r+Math.imul(_,K)|0,n=n+Math.imul(_,Z)|0,n=n+Math.imul(y,K)|0,s=s+Math.imul(y,Z)|0,r=r+Math.imul(w,$)|0,n=n+Math.imul(w,X)|0,n=n+Math.imul(g,$)|0,s=s+Math.imul(g,X)|0,r=r+Math.imul(p,Q)|0,n=n+Math.imul(p,ee)|0,n=n+Math.imul(b,Q)|0,s=s+Math.imul(b,ee)|0,r=r+Math.imul(l,ie)|0,n=n+Math.imul(l,re)|0,n=n+Math.imul(u,ie)|0,s=s+Math.imul(u,re)|0;var ye=(h+r|0)+((8191&n)<<13)|0;h=(s+(n>>>13)|0)+(ye>>>26)|0,ye&=67108863,r=Math.imul(x,z),n=Math.imul(x,q),n=n+Math.imul(C,z)|0,s=Math.imul(C,q),r=r+Math.imul(M,G)|0,n=n+Math.imul(M,V)|0,n=n+Math.imul(T,G)|0,s=s+Math.imul(T,V)|0,r=r+Math.imul(E,K)|0,n=n+Math.imul(E,Z)|0,n=n+Math.imul(A,K)|0,s=s+Math.imul(A,Z)|0,r=r+Math.imul(_,$)|0,n=n+Math.imul(_,X)|0,n=n+Math.imul(y,$)|0,s=s+Math.imul(y,X)|0,r=r+Math.imul(w,Q)|0,n=n+Math.imul(w,ee)|0,n=n+Math.imul(g,Q)|0,s=s+Math.imul(g,ee)|0,r=r+Math.imul(p,ie)|0,n=n+Math.imul(p,re)|0,n=n+Math.imul(b,ie)|0,s=s+Math.imul(b,re)|0,r=r+Math.imul(l,se)|0,n=n+Math.imul(l,ae)|0,n=n+Math.imul(u,se)|0,s=s+Math.imul(u,ae)|0;var ke=(h+r|0)+((8191&n)<<13)|0;h=(s+(n>>>13)|0)+(ke>>>26)|0,ke&=67108863,r=Math.imul(P,z),n=Math.imul(P,q),n=n+Math.imul(O,z)|0,s=Math.imul(O,q),r=r+Math.imul(x,G)|0,n=n+Math.imul(x,V)|0,n=n+Math.imul(C,G)|0,s=s+Math.imul(C,V)|0,r=r+Math.imul(M,K)|0,n=n+Math.imul(M,Z)|0,n=n+Math.imul(T,K)|0,s=s+Math.imul(T,Z)|0,r=r+Math.imul(E,$)|0,n=n+Math.imul(E,X)|0,n=n+Math.imul(A,$)|0,s=s+Math.imul(A,X)|0,r=r+Math.imul(_,Q)|0,n=n+Math.imul(_,ee)|0,n=n+Math.imul(y,Q)|0,s=s+Math.imul(y,ee)|0,r=r+Math.imul(w,ie)|0,n=n+Math.imul(w,re)|0,n=n+Math.imul(g,ie)|0,s=s+Math.imul(g,re)|0,r=r+Math.imul(p,se)|0,n=n+Math.imul(p,ae)|0,n=n+Math.imul(b,se)|0,s=s+Math.imul(b,ae)|0,r=r+Math.imul(l,fe)|0,n=n+Math.imul(l,he)|0,n=n+Math.imul(u,fe)|0,s=s+Math.imul(u,he)|0;var Ee=(h+r|0)+((8191&n)<<13)|0;h=(s+(n>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,r=Math.imul(D,z),n=Math.imul(D,q),n=n+Math.imul(L,z)|0,s=Math.imul(L,q),r=r+Math.imul(P,G)|0,n=n+Math.imul(P,V)|0,n=n+Math.imul(O,G)|0,s=s+Math.imul(O,V)|0,r=r+Math.imul(x,K)|0,n=n+Math.imul(x,Z)|0,n=n+Math.imul(C,K)|0,s=s+Math.imul(C,Z)|0,r=r+Math.imul(M,$)|0,n=n+Math.imul(M,X)|0,n=n+Math.imul(T,$)|0,s=s+Math.imul(T,X)|0,r=r+Math.imul(E,Q)|0,n=n+Math.imul(E,ee)|0,n=n+Math.imul(A,Q)|0,s=s+Math.imul(A,ee)|0,r=r+Math.imul(_,ie)|0,n=n+Math.imul(_,re)|0,n=n+Math.imul(y,ie)|0,s=s+Math.imul(y,re)|0,r=r+Math.imul(w,se)|0,n=n+Math.imul(w,ae)|0,n=n+Math.imul(g,se)|0,s=s+Math.imul(g,ae)|0,r=r+Math.imul(p,fe)|0,n=n+Math.imul(p,he)|0,n=n+Math.imul(b,fe)|0,s=s+Math.imul(b,he)|0,r=r+Math.imul(l,le)|0,n=n+Math.imul(l,ue)|0,n=n+Math.imul(u,le)|0,s=s+Math.imul(u,ue)|0;var Ae=(h+r|0)+((8191&n)<<13)|0;h=(s+(n>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,r=Math.imul(U,z),n=Math.imul(U,q),n=n+Math.imul(j,z)|0,s=Math.imul(j,q),r=r+Math.imul(D,G)|0,n=n+Math.imul(D,V)|0,n=n+Math.imul(L,G)|0,s=s+Math.imul(L,V)|0,r=r+Math.imul(P,K)|0,n=n+Math.imul(P,Z)|0,n=n+Math.imul(O,K)|0,s=s+Math.imul(O,Z)|0,r=r+Math.imul(x,$)|0,n=n+Math.imul(x,X)|0,n=n+Math.imul(C,$)|0,s=s+Math.imul(C,X)|0,r=r+Math.imul(M,Q)|0,n=n+Math.imul(M,ee)|0,n=n+Math.imul(T,Q)|0,s=s+Math.imul(T,ee)|0,r=r+Math.imul(E,ie)|0,n=n+Math.imul(E,re)|0,n=n+Math.imul(A,ie)|0,s=s+Math.imul(A,re)|0,r=r+Math.imul(_,se)|0,n=n+Math.imul(_,ae)|0,n=n+Math.imul(y,se)|0,s=s+Math.imul(y,ae)|0,r=r+Math.imul(w,fe)|0,n=n+Math.imul(w,he)|0,n=n+Math.imul(g,fe)|0,s=s+Math.imul(g,he)|0,r=r+Math.imul(p,le)|0,n=n+Math.imul(p,ue)|0,n=n+Math.imul(b,le)|0,s=s+Math.imul(b,ue)|0,r=r+Math.imul(l,pe)|0,n=n+Math.imul(l,be)|0,n=n+Math.imul(u,pe)|0,s=s+Math.imul(u,be)|0;var Se=(h+r|0)+((8191&n)<<13)|0;h=(s+(n>>>13)|0)+(Se>>>26)|0,Se&=67108863,r=Math.imul(U,G),n=Math.imul(U,V),n=n+Math.imul(j,G)|0,s=Math.imul(j,V),r=r+Math.imul(D,K)|0,n=n+Math.imul(D,Z)|0,n=n+Math.imul(L,K)|0,s=s+Math.imul(L,Z)|0,r=r+Math.imul(P,$)|0,n=n+Math.imul(P,X)|0,n=n+Math.imul(O,$)|0,s=s+Math.imul(O,X)|0,r=r+Math.imul(x,Q)|0,n=n+Math.imul(x,ee)|0,n=n+Math.imul(C,Q)|0,s=s+Math.imul(C,ee)|0,r=r+Math.imul(M,ie)|0,n=n+Math.imul(M,re)|0,n=n+Math.imul(T,ie)|0,s=s+Math.imul(T,re)|0,r=r+Math.imul(E,se)|0,n=n+Math.imul(E,ae)|0,n=n+Math.imul(A,se)|0,s=s+Math.imul(A,ae)|0,r=r+Math.imul(_,fe)|0,n=n+Math.imul(_,he)|0,n=n+Math.imul(y,fe)|0,s=s+Math.imul(y,he)|0,r=r+Math.imul(w,le)|0,n=n+Math.imul(w,ue)|0,n=n+Math.imul(g,le)|0,s=s+Math.imul(g,ue)|0,r=r+Math.imul(p,pe)|0,n=n+Math.imul(p,be)|0,n=n+Math.imul(b,pe)|0,s=s+Math.imul(b,be)|0;var Me=(h+r|0)+((8191&n)<<13)|0;h=(s+(n>>>13)|0)+(Me>>>26)|0,Me&=67108863,r=Math.imul(U,K),n=Math.imul(U,Z),n=n+Math.imul(j,K)|0,s=Math.imul(j,Z),r=r+Math.imul(D,$)|0,n=n+Math.imul(D,X)|0,n=n+Math.imul(L,$)|0,s=s+Math.imul(L,X)|0,r=r+Math.imul(P,Q)|0,n=n+Math.imul(P,ee)|0,n=n+Math.imul(O,Q)|0,s=s+Math.imul(O,ee)|0,r=r+Math.imul(x,ie)|0,n=n+Math.imul(x,re)|0,n=n+Math.imul(C,ie)|0,s=s+Math.imul(C,re)|0,r=r+Math.imul(M,se)|0,n=n+Math.imul(M,ae)|0,n=n+Math.imul(T,se)|0,s=s+Math.imul(T,ae)|0,r=r+Math.imul(E,fe)|0,n=n+Math.imul(E,he)|0,n=n+Math.imul(A,fe)|0,s=s+Math.imul(A,he)|0,r=r+Math.imul(_,le)|0,n=n+Math.imul(_,ue)|0,n=n+Math.imul(y,le)|0,s=s+Math.imul(y,ue)|0,r=r+Math.imul(w,pe)|0,n=n+Math.imul(w,be)|0,n=n+Math.imul(g,pe)|0,s=s+Math.imul(g,be)|0;var Te=(h+r|0)+((8191&n)<<13)|0;h=(s+(n>>>13)|0)+(Te>>>26)|0,Te&=67108863,r=Math.imul(U,$),n=Math.imul(U,X),n=n+Math.imul(j,$)|0,s=Math.imul(j,X),r=r+Math.imul(D,Q)|0,n=n+Math.imul(D,ee)|0,n=n+Math.imul(L,Q)|0,s=s+Math.imul(L,ee)|0,r=r+Math.imul(P,ie)|0,n=n+Math.imul(P,re)|0,n=n+Math.imul(O,ie)|0,s=s+Math.imul(O,re)|0,r=r+Math.imul(x,se)|0,n=n+Math.imul(x,ae)|0,n=n+Math.imul(C,se)|0,s=s+Math.imul(C,ae)|0,r=r+Math.imul(M,fe)|0,n=n+Math.imul(M,he)|0,n=n+Math.imul(T,fe)|0,s=s+Math.imul(T,he)|0,r=r+Math.imul(E,le)|0,n=n+Math.imul(E,ue)|0,n=n+Math.imul(A,le)|0,s=s+Math.imul(A,ue)|0,r=r+Math.imul(_,pe)|0,n=n+Math.imul(_,be)|0,n=n+Math.imul(y,pe)|0,s=s+Math.imul(y,be)|0;var Re=(h+r|0)+((8191&n)<<13)|0;h=(s+(n>>>13)|0)+(Re>>>26)|0,Re&=67108863,r=Math.imul(U,Q),n=Math.imul(U,ee),n=n+Math.imul(j,Q)|0,s=Math.imul(j,ee),r=r+Math.imul(D,ie)|0,n=n+Math.imul(D,re)|0,n=n+Math.imul(L,ie)|0,s=s+Math.imul(L,re)|0,r=r+Math.imul(P,se)|0,n=n+Math.imul(P,ae)|0,n=n+Math.imul(O,se)|0,s=s+Math.imul(O,ae)|0,r=r+Math.imul(x,fe)|0,n=n+Math.imul(x,he)|0,n=n+Math.imul(C,fe)|0,s=s+Math.imul(C,he)|0,r=r+Math.imul(M,le)|0,n=n+Math.imul(M,ue)|0,n=n+Math.imul(T,le)|0,s=s+Math.imul(T,ue)|0,r=r+Math.imul(E,pe)|0,n=n+Math.imul(E,be)|0,n=n+Math.imul(A,pe)|0,s=s+Math.imul(A,be)|0;var xe=(h+r|0)+((8191&n)<<13)|0;h=(s+(n>>>13)|0)+(xe>>>26)|0,xe&=67108863,r=Math.imul(U,ie),n=Math.imul(U,re),n=n+Math.imul(j,ie)|0,s=Math.imul(j,re),r=r+Math.imul(D,se)|0,n=n+Math.imul(D,ae)|0,n=n+Math.imul(L,se)|0,s=s+Math.imul(L,ae)|0,r=r+Math.imul(P,fe)|0,n=n+Math.imul(P,he)|0,n=n+Math.imul(O,fe)|0,s=s+Math.imul(O,he)|0,r=r+Math.imul(x,le)|0,n=n+Math.imul(x,ue)|0,n=n+Math.imul(C,le)|0,s=s+Math.imul(C,ue)|0,r=r+Math.imul(M,pe)|0,n=n+Math.imul(M,be)|0,n=n+Math.imul(T,pe)|0,s=s+Math.imul(T,be)|0;var Ce=(h+r|0)+((8191&n)<<13)|0;h=(s+(n>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,r=Math.imul(U,se),n=Math.imul(U,ae),n=n+Math.imul(j,se)|0,s=Math.imul(j,ae),r=r+Math.imul(D,fe)|0,n=n+Math.imul(D,he)|0,n=n+Math.imul(L,fe)|0,s=s+Math.imul(L,he)|0,r=r+Math.imul(P,le)|0,n=n+Math.imul(P,ue)|0,n=n+Math.imul(O,le)|0,s=s+Math.imul(O,ue)|0,r=r+Math.imul(x,pe)|0,n=n+Math.imul(x,be)|0,n=n+Math.imul(C,pe)|0,s=s+Math.imul(C,be)|0;var Ie=(h+r|0)+((8191&n)<<13)|0;h=(s+(n>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,r=Math.imul(U,fe),n=Math.imul(U,he),n=n+Math.imul(j,fe)|0,s=Math.imul(j,he),r=r+Math.imul(D,le)|0,n=n+Math.imul(D,ue)|0,n=n+Math.imul(L,le)|0,s=s+Math.imul(L,ue)|0,r=r+Math.imul(P,pe)|0,n=n+Math.imul(P,be)|0,n=n+Math.imul(O,pe)|0,s=s+Math.imul(O,be)|0;var Pe=(h+r|0)+((8191&n)<<13)|0;h=(s+(n>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,r=Math.imul(U,le),n=Math.imul(U,ue),n=n+Math.imul(j,le)|0,s=Math.imul(j,ue),r=r+Math.imul(D,pe)|0,n=n+Math.imul(D,be)|0,n=n+Math.imul(L,pe)|0,s=s+Math.imul(L,be)|0;var Oe=(h+r|0)+((8191&n)<<13)|0;h=(s+(n>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,r=Math.imul(U,pe),n=Math.imul(U,be),n=n+Math.imul(j,pe)|0,s=Math.imul(j,be);var Ne=(h+r|0)+((8191&n)<<13)|0;return h=(s+(n>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,f[0]=me,f[1]=we,f[2]=ge,f[3]=ve,f[4]=_e,f[5]=ye,f[6]=ke,f[7]=Ee,f[8]=Ae,f[9]=Se,f[10]=Me,f[11]=Te,f[12]=Re,f[13]=xe,f[14]=Ce,f[15]=Ie,f[16]=Pe,f[17]=Oe,f[18]=Ne,0!==h&&(f[19]=h,i.length++),i};Math.imul||(A=h),s.prototype.mulTo=function(e,t){var i,r=this.length+e.length;return i=10===this.length&&10===e.length?A(this,e,t):r<63?h(this,e,t):r<1024?c(this,e,t):l(this,e,t)},u.prototype.makeRBT=function(e){for(var t=new Array(e),i=s.prototype._countBits(e)-1,r=0;r>=1;return r},u.prototype.permute=function(e,t,i,r,n,s){for(var a=0;a>>=1)n++;return 1<>>=13,i[2*a+1]=8191&s,s>>>=13;for(a=2*t;a>=26,t+=n/67108864|0,t+=s>>>26,this.words[i]=67108863&s}return 0!==t&&(this.words[i]=t,this.length++),this},s.prototype.muln=function(e){return this.clone().imuln(e)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(e){var t=f(e);if(0===t.length)return new s(1);for(var i=this,r=0;r=0);var t,i=e%26,n=(e-i)/26,s=67108863>>>26-i<<26-i;if(0!==i){var a=0;for(t=0;t>>26-i}a&&(this.words[t]=a,this.length++)}if(0!==n){for(t=this.length-1;t>=0;t--)this.words[t+n]=this.words[t];for(t=0;t=0);var n;n=t?(t-t%26)/26:0;var s=e%26,a=Math.min((e-s)/26,this.length),o=67108863^67108863>>>s<a)for(this.length-=a,h=0;h=0&&(0!==c||h>=n);h--){var l=0|this.words[h];this.words[h]=c<<26-s|l>>>s,c=l&o}return f&&0!==c&&(f.words[f.length++]=c),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},s.prototype.ishrn=function(e,t,i){return r(0===this.negative),this.iushrn(e,t,i)},s.prototype.shln=function(e){return this.clone().ishln(e)},s.prototype.ushln=function(e){return this.clone().iushln(e)},s.prototype.shrn=function(e){return this.clone().ishrn(e)},s.prototype.ushrn=function(e){return this.clone().iushrn(e)},s.prototype.testn=function(e){r("number"==typeof e&&e>=0);var t=e%26,i=(e-t)/26,n=1<=0);var t=e%26,i=(e-t)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=i)return this;if(0!==t&&i++,this.length=Math.min(i,this.length),0!==t){var n=67108863^67108863>>>t<=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},s.prototype.isubn=function(e){if(r("number"==typeof e),r(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t>26)-(f/67108864|0),this.words[n+i]=67108863&a}for(;n>26,this.words[n+i]=67108863&a;if(0===o)return this.strip();for(r(o===-1),o=0,n=0;n>26,this.words[n]=67108863&a;return this.negative=1,this.strip()},s.prototype._wordDiv=function(e,t){var i=this.length-e.length,r=this.clone(),n=e,a=0|n.words[n.length-1],o=this._countBits(a);i=26-o,0!==i&&(n=n.ushln(i),r.iushln(i),a=0|n.words[n.length-1]);var f,h=r.length-n.length;if("mod"!==t){f=new s(null),f.length=h+1,f.words=new Array(f.length);for(var c=0;c=0;u--){var d=67108864*(0|r.words[n.length+u])+(0|r.words[n.length+u-1]);for(d=Math.min(d/a|0,67108863),r._ishlnsubmul(n,d,u);0!==r.negative;)d--,r.negative=0,r._ishlnsubmul(n,1,u),r.isZero()||(r.negative^=1);f&&(f.words[u]=d)}return f&&f.strip(),r.strip(),"div"!==t&&0!==i&&r.iushrn(i),{div:f||null,mod:r}},s.prototype.divmod=function(e,t,i){if(r(!e.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var n,a,o;return 0!==this.negative&&0===e.negative?(o=this.neg().divmod(e,t),"mod"!==t&&(n=o.div.neg()),"div"!==t&&(a=o.mod.neg(),i&&0!==a.negative&&a.iadd(e)),{div:n,mod:a}):0===this.negative&&0!==e.negative?(o=this.divmod(e.neg(),t),"mod"!==t&&(n=o.div.neg()),{div:n,mod:o.mod}):0!==(this.negative&e.negative)?(o=this.neg().divmod(e.neg(),t),"div"!==t&&(a=o.mod.neg(),i&&0!==a.negative&&a.isub(e)),{div:o.div,mod:a}):e.length>this.length||this.cmp(e)<0?{div:new s(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new s(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new s(this.modn(e.words[0]))}:this._wordDiv(e,t)},s.prototype.div=function(e){return this.divmod(e,"div",!1).div},s.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},s.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},s.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var i=0!==t.div.negative?t.mod.isub(e):t.mod,r=e.ushrn(1),n=e.andln(1),s=i.cmp(r);return s<0||1===n&&0===s?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},s.prototype.modn=function(e){r(e<=67108863);for(var t=(1<<26)%e,i=0,n=this.length-1;n>=0;n--)i=(t*i+(0|this.words[n]))%e;return i},s.prototype.idivn=function(e){r(e<=67108863);for(var t=0,i=this.length-1;i>=0;i--){var n=(0|this.words[i])+67108864*t;this.words[i]=n/e|0,t=n%e}return this.strip()},s.prototype.divn=function(e){return this.clone().idivn(e)},s.prototype.egcd=function(e){r(0===e.negative),r(!e.isZero());var t=this,i=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var n=new s(1),a=new s(0),o=new s(0),f=new s(1),h=0;t.isEven()&&i.isEven();)t.iushrn(1),i.iushrn(1),++h;for(var c=i.clone(),l=t.clone();!t.isZero();){for(var u=0,d=1;0===(t.words[0]&d)&&u<26;++u,d<<=1);if(u>0)for(t.iushrn(u);u-- >0;)(n.isOdd()||a.isOdd())&&(n.iadd(c),a.isub(l)),n.iushrn(1), +a.iushrn(1);for(var p=0,b=1;0===(i.words[0]&b)&&p<26;++p,b<<=1);if(p>0)for(i.iushrn(p);p-- >0;)(o.isOdd()||f.isOdd())&&(o.iadd(c),f.isub(l)),o.iushrn(1),f.iushrn(1);t.cmp(i)>=0?(t.isub(i),n.isub(o),a.isub(f)):(i.isub(t),o.isub(n),f.isub(a))}return{a:o,b:f,gcd:i.iushln(h)}},s.prototype._invmp=function(e){r(0===e.negative),r(!e.isZero());var t=this,i=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var n=new s(1),a=new s(0),o=i.clone();t.cmpn(1)>0&&i.cmpn(1)>0;){for(var f=0,h=1;0===(t.words[0]&h)&&f<26;++f,h<<=1);if(f>0)for(t.iushrn(f);f-- >0;)n.isOdd()&&n.iadd(o),n.iushrn(1);for(var c=0,l=1;0===(i.words[0]&l)&&c<26;++c,l<<=1);if(c>0)for(i.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(o),a.iushrn(1);t.cmp(i)>=0?(t.isub(i),n.isub(a)):(i.isub(t),a.isub(n))}var u;return u=0===t.cmpn(1)?n:a,u.cmpn(0)<0&&u.iadd(e),u},s.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),i=e.clone();t.negative=0,i.negative=0;for(var r=0;t.isEven()&&i.isEven();r++)t.iushrn(1),i.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;i.isEven();)i.iushrn(1);var n=t.cmp(i);if(n<0){var s=t;t=i,i=s}else if(0===n||0===i.cmpn(1))break;t.isub(i)}return i.iushln(r)},s.prototype.invm=function(e){return this.egcd(e).a.umod(e)},s.prototype.isEven=function(){return 0===(1&this.words[0])},s.prototype.isOdd=function(){return 1===(1&this.words[0])},s.prototype.andln=function(e){return this.words[0]&e},s.prototype.bincn=function(e){r("number"==typeof e);var t=e%26,i=(e-t)/26,n=1<>>26,o&=67108863,this.words[a]=o}return 0!==s&&(this.words[a]=s,this.length++),this},s.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},s.prototype.cmpn=function(e){var t=e<0;if(0!==this.negative&&!t)return-1;if(0===this.negative&&t)return 1;this.strip();var i;if(this.length>1)i=1;else{t&&(e=-e),r(e<=67108863,"Number is too big");var n=0|this.words[0];i=n===e?0:ne.length)return 1;if(this.length=0;i--){var r=0|this.words[i],n=0|e.words[i];if(r!==n){rn&&(t=1);break}}return t},s.prototype.gtn=function(e){return 1===this.cmpn(e)},s.prototype.gt=function(e){return 1===this.cmp(e)},s.prototype.gten=function(e){return this.cmpn(e)>=0},s.prototype.gte=function(e){return this.cmp(e)>=0},s.prototype.ltn=function(e){return this.cmpn(e)===-1},s.prototype.lt=function(e){return this.cmp(e)===-1},s.prototype.lten=function(e){return this.cmpn(e)<=0},s.prototype.lte=function(e){return this.cmp(e)<=0},s.prototype.eqn=function(e){return 0===this.cmpn(e)},s.prototype.eq=function(e){return 0===this.cmp(e)},s.red=function(e){return new g(e)},s.prototype.toRed=function(e){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},s.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(e){return this.red=e,this},s.prototype.forceRed=function(e){return r(!this.red,"Already a number in reduction context"),this._forceRed(e)},s.prototype.redAdd=function(e){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},s.prototype.redIAdd=function(e){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},s.prototype.redSub=function(e){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},s.prototype.redISub=function(e){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},s.prototype.redShl=function(e){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},s.prototype.redMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},s.prototype.redIMul=function(e){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},s.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(e){return r(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var S={k256:null,p224:null,p192:null,p25519:null};d.prototype._tmp=function(){var e=new s(null);return e.words=new Array(Math.ceil(this.n/13)),e},d.prototype.ireduce=function(e){var t,i=e;do this.split(i,this.tmp),i=this.imulK(i),i=i.iadd(this.tmp),t=i.bitLength();while(t>this.n);var r=t0?i.isub(this.p):i.strip(),i},d.prototype.split=function(e,t){e.iushrn(this.n,0,t)},d.prototype.imulK=function(e){return e.imul(this.k)},n(p,d),p.prototype.split=function(e,t){for(var i=4194303,r=Math.min(e.length,9),n=0;n>>22,s=a}s>>>=22,e.words[n-10]=s,0===s&&e.length>10?e.length-=10:e.length-=9},p.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,i=0;i>>=26,e.words[i]=n,t=r}return 0!==t&&(e.words[e.length++]=t),e},s._prime=function e(t){if(S[t])return S[t];var e;if("k256"===t)e=new p;else if("p224"===t)e=new b;else if("p192"===t)e=new m;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new w}return S[t]=e,e},g.prototype._verify1=function(e){r(0===e.negative,"red works only with positives"),r(e.red,"red works only with red numbers")},g.prototype._verify2=function(e,t){r(0===(e.negative|t.negative),"red works only with positives"),r(e.red&&e.red===t.red,"red works only with red numbers")},g.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},g.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},g.prototype.add=function(e,t){this._verify2(e,t);var i=e.add(t);return i.cmp(this.m)>=0&&i.isub(this.m),i._forceRed(this)},g.prototype.iadd=function(e,t){this._verify2(e,t);var i=e.iadd(t);return i.cmp(this.m)>=0&&i.isub(this.m),i},g.prototype.sub=function(e,t){this._verify2(e,t);var i=e.sub(t);return i.cmpn(0)<0&&i.iadd(this.m),i._forceRed(this)},g.prototype.isub=function(e,t){this._verify2(e,t);var i=e.isub(t);return i.cmpn(0)<0&&i.iadd(this.m),i},g.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},g.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},g.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},g.prototype.isqr=function(e){return this.imul(e,e.clone())},g.prototype.sqr=function(e){return this.mul(e,e)},g.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(r(t%2===1),3===t){var i=this.m.add(new s(1)).iushrn(2);return this.pow(e,i)}for(var n=this.m.subn(1),a=0;!n.isZero()&&0===n.andln(1);)a++,n.iushrn(1);r(!n.isZero());var o=new s(1).toRed(this),f=o.redNeg(),h=this.m.subn(1).iushrn(1),c=this.m.bitLength();for(c=new s(2*c*c).toRed(this);0!==this.pow(c,h).cmp(f);)c.redIAdd(f);for(var l=this.pow(c,n),u=this.pow(e,n.addn(1).iushrn(1)),d=this.pow(e,n),p=a;0!==d.cmp(o);){for(var b=d,m=0;0!==b.cmp(o);m++)b=b.redSqr();r(m=0;n--){for(var c=t.words[n],l=h-1;l>=0;l--){var u=c>>l&1;a!==r[0]&&(a=this.sqr(a)),0!==u||0!==o?(o<<=1,o|=u,f++,(f===i||0===n&&0===l)&&(a=this.mul(a,r[o]),f=0,o=0)):f=0}h=26}return a},g.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},g.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},s.mont=function(e){return new v(e)},n(v,g),v.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},v.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},v.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var i=e.imul(t),r=i.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=i.isub(r).iushrn(this.shift),s=n;return n.cmp(this.m)>=0?s=n.isub(this.m):n.cmpn(0)<0&&(s=n.iadd(this.m)),s._forceRed(this)},v.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new s(0)._forceRed(this);var i=e.mul(t),r=i.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=i.isub(r).iushrn(this.shift),a=n;return n.cmp(this.m)>=0?a=n.isub(this.m):n.cmpn(0)<0&&(a=n.iadd(this.m)),a._forceRed(this)},v.prototype.invm=function(e){var t=this.imod(e._invmp(this.m).mul(this.r2));return t._forceRed(this)}}("undefined"==typeof e||e,this)}).call(t,i(117)(e))},function(e,t){function i(){throw new Error("setTimeout has not been defined")}function r(){throw new Error("clearTimeout has not been defined")}function n(e){if(c===setTimeout)return setTimeout(e,0);if((c===i||!c)&&setTimeout)return c=setTimeout,setTimeout(e,0);try{return c(e,0)}catch(t){try{return c.call(null,e,0)}catch(t){return c.call(this,e,0)}}}function s(e){if(l===clearTimeout)return clearTimeout(e);if((l===r||!l)&&clearTimeout)return l=clearTimeout,clearTimeout(e);try{return l(e)}catch(t){try{return l.call(null,e)}catch(t){return l.call(this,e)}}}function a(){b&&d&&(b=!1,d.length?p=d.concat(p):m=-1,p.length&&o())}function o(){if(!b){var e=n(a);b=!0;for(var t=p.length;t;){for(d=p,p=[];++m1)for(var i=1;i=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),b(i)?r.showHidden=i:i&&t._extend(r,i),y(r.showHidden)&&(r.showHidden=!1),y(r.depth)&&(r.depth=2),y(r.colors)&&(r.colors=!1),y(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=s),f(r,e,r.depth)}function s(e,t){var i=n.styles[t];return i?"["+n.colors[i][0]+"m"+e+"["+n.colors[i][1]+"m":e}function a(e,t){return e}function o(e){var t={};return e.forEach(function(e,i){t[e]=!0}),t}function f(e,i,r){if(e.customInspect&&i&&M(i.inspect)&&i.inspect!==t.inspect&&(!i.constructor||i.constructor.prototype!==i)){var n=i.inspect(r,e);return v(n)||(n=f(e,n,r)),n}var s=h(e,i);if(s)return s;var a=Object.keys(i),b=o(a);if(e.showHidden&&(a=Object.getOwnPropertyNames(i)),S(i)&&(a.indexOf("message")>=0||a.indexOf("description")>=0))return c(i);if(0===a.length){if(M(i)){var m=i.name?": "+i.name:"";return e.stylize("[Function"+m+"]","special")}if(k(i))return e.stylize(RegExp.prototype.toString.call(i),"regexp");if(A(i))return e.stylize(Date.prototype.toString.call(i),"date");if(S(i))return c(i)}var w="",g=!1,_=["{","}"];if(p(i)&&(g=!0,_=["[","]"]),M(i)){var y=i.name?": "+i.name:"";w=" [Function"+y+"]"}if(k(i)&&(w=" "+RegExp.prototype.toString.call(i)),A(i)&&(w=" "+Date.prototype.toUTCString.call(i)),S(i)&&(w=" "+c(i)),0===a.length&&(!g||0==i.length))return _[0]+w+_[1];if(r<0)return k(i)?e.stylize(RegExp.prototype.toString.call(i),"regexp"):e.stylize("[Object]","special");e.seen.push(i);var E;return E=g?l(e,i,r,b,a):a.map(function(t){return u(e,i,r,b,t,g)}),e.seen.pop(),d(E,w,_)}function h(e,t){if(y(t))return e.stylize("undefined","undefined");if(v(t)){var i="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(i,"string")}return g(t)?e.stylize(""+t,"number"):b(t)?e.stylize(""+t,"boolean"):m(t)?e.stylize("null","null"):void 0}function c(e){return"["+Error.prototype.toString.call(e)+"]"}function l(e,t,i,r,n){for(var s=[],a=0,o=t.length;a-1&&(o=s?o.split("\n").map(function(e){return" "+e}).join("\n").substr(2):"\n"+o.split("\n").map(function(e){return" "+e}).join("\n"))):o=e.stylize("[Circular]","special")),y(a)){if(s&&n.match(/^\d+$/))return o;a=JSON.stringify(""+n),a.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(a=a.substr(1,a.length-2),a=e.stylize(a,"name")):(a=a.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),a=e.stylize(a,"string"))}return a+": "+o}function d(e,t,i){var r=0,n=e.reduce(function(e,t){return r++,t.indexOf("\n")>=0&&r++,e+t.replace(/\u001b\[\d\d?m/g,"").length+1},0);return n>60?i[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+i[1]:i[0]+t+" "+e.join(", ")+" "+i[1]}function p(e){return Array.isArray(e)}function b(e){return"boolean"==typeof e}function m(e){return null===e}function w(e){return null==e}function g(e){return"number"==typeof e}function v(e){return"string"==typeof e}function _(e){return"symbol"==typeof e}function y(e){return void 0===e}function k(e){return E(e)&&"[object RegExp]"===R(e)}function E(e){return"object"==typeof e&&null!==e}function A(e){return E(e)&&"[object Date]"===R(e)}function S(e){return E(e)&&("[object Error]"===R(e)||e instanceof Error)}function M(e){return"function"==typeof e}function T(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||"undefined"==typeof e}function R(e){return Object.prototype.toString.call(e)}function x(e){return e<10?"0"+e.toString(10):e.toString(10)}function C(){var e=new Date,t=[x(e.getHours()),x(e.getMinutes()),x(e.getSeconds())].join(":");return[e.getDate(),D[e.getMonth()],t].join(" ")}function I(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var P=/%[sdj%]/g;t.format=function(e){if(!v(e)){for(var t=[],i=0;i=s)return e;switch(e){case"%s":return String(r[i++]);case"%d":return Number(r[i++]);case"%j":try{return JSON.stringify(r[i++])}catch(e){return"[Circular]"}default:return e}}),o=r[i];i`}sendMessage(){}sendTTSMessage(){}sendFile(){}sendCode(){}}r.applyToClass(a),e.exports=a},function(e,t){class i{constructor(e={}){this.status=e.status||"offline",this.game=e.game?new r(e.game):null}update(e){this.status=e.status||this.status,this.game=e.game?new r(e.game):null}equals(e){return e&&this.status===e.status&&this.game?this.game.equals(e.game):!e.game}}class r{constructor(e){this.name=e.name,this.type=e.type,this.url=e.url||null}get streaming(){return 1===this.type}equals(e){return e&&this.name===e.name&&this.type===e.type&&this.url===e.url}}t.Presence=i,t.Game=r},function(e,t,i){var r=t;r.utils=i(195),r.common=i(191),r.sha=i(194),r.ripemd=i(193),r.hmac=i(192),r.sha1=r.sha.sha1,r.sha256=r.sha.sha256,r.sha224=r.sha.sha224,r.sha384=r.sha.sha384,r.sha512=r.sha.sha512,r.ripemd160=r.ripemd.ripemd160},function(e,t,i){(function(e){function i(e,t){for(var i=0,r=e.length-1;r>=0;r--){var n=e[r];"."===n?e.splice(r,1):".."===n?(e.splice(r,1),i++):i&&(e.splice(r,1),i--)}if(t)for(;i--;i)e.unshift("..");return e}function r(e,t){if(e.filter)return e.filter(t);for(var i=[],r=0;r=-1&&!n;s--){var a=s>=0?arguments[s]:e.cwd();if("string"!=typeof a)throw new TypeError("Arguments to path.resolve must be strings");a&&(t=a+"/"+t,n="/"===a.charAt(0))}return t=i(r(t.split("/"),function(e){return!!e}),!n).join("/"),(n?"/":"")+t||"."},t.normalize=function(e){var n=t.isAbsolute(e),s="/"===a(e,-1);return e=i(r(e.split("/"),function(e){return!!e}),!n).join("/"),e||n||(e="."),e&&s&&(e+="/"),(n?"/":"")+e},t.isAbsolute=function(e){return"/"===e.charAt(0)},t.join=function(){var e=Array.prototype.slice.call(arguments,0);return t.normalize(r(e,function(e,t){if("string"!=typeof e)throw new TypeError("Arguments to path.join must be strings");return e}).join("/"))},t.relative=function(e,i){function r(e){for(var t=0;t=0&&""===e[i];i--);return t>i?[]:e.slice(t,i-t+1)}e=t.resolve(e).substr(1),i=t.resolve(i).substr(1);for(var n=r(e.split("/")),s=r(i.split("/")),a=Math.min(n.length,s.length),o=a,f=0;f=8*this._finalSize&&(this._update(this._block),this._block.fill(0)),this._block.writeInt32BE(t,this._blockSize-4);var i=this._update(this._block)||this._hash();return e?i.toString(e):i},i.prototype._update=function(){throw new Error("_update must be implemented by subclass")},e.exports=i}).call(t,i(0).Buffer)},function(e,t){class i{constructor(e,t){this.client=e,Object.defineProperty(this,"client",{enumerable:!1,configurable:!1}),this.type=null,t&&this.setup(t)}setup(e){this.id=e.id}get createdTimestamp(){return this.id/4194304+14200704e5}get createdAt(){return new Date(this.createdTimestamp)}delete(){return this.client.rest.methods.deleteChannel(this)}}e.exports=i},function(e,t,i){const r=i(2),n=i(6);class s{constructor(e,t){this.client=e.client,Object.defineProperty(this,"client",{enumerable:!1,configurable:!1}),this.guild=e,this.setup(t)}setup(e){this.id=e.id,this.name=e.name,this.requiresColons=e.require_colons,this.managed=e.managed,this._roles=e.roles}get createdTimestamp(){return this.id/4194304+14200704e5}get createdAt(){return new Date(this.createdTimestamp)}get roles(){const e=new n;for(const t of this._roles)this.guild.roles.has(t)&&e.set(t,this.guild.roles.get(t));return e}get url(){return`${r.Endpoints.CDN}/emojis/${this.id}.png`}toString(){return this.requiresColons?`<:${this.name}:${this.id}>`:this.name}get identifier(){return this.id?`${this.name}:${this.id}`:encodeURIComponent(this.name)}}e.exports=s},function(e,t,i){const r=i(2);class n{constructor(e,t){this.client=e.client,Object.defineProperty(this,"client",{enumerable:!1,configurable:!1}),this.guild=e,t&&this.setup(t)}setup(e){this.id=e.id,this.name=e.name,this.color=e.color,this.hoist=e.hoist,this.position=e.position,this.permissions=e.permissions,this.managed=e.managed,this.mentionable=e.mentionable}get createdTimestamp(){return this.id/4194304+14200704e5}get createdAt(){return new Date(this.createdTimestamp)}get hexColor(){let e=this.color.toString(16);for(;e.length<6;)e=`0${e}`;return`#${e}`}get members(){return this.guild.members.filter(e=>e.roles.has(this.id))}serialize(){const e={};for(const t in r.PermissionFlags)e[t]=this.hasPermission(t);return e}hasPermission(e,t=false){ +return e=this.client.resolver.resolvePermission(e),!t&&(this.permissions&r.PermissionFlags.ADMINISTRATOR)>0||(this.permissions&e)>0}hasPermissions(e,t=false){return e.every(e=>this.hasPermission(e,t))}comparePositionTo(e){return this.constructor.comparePositions(this,e)}edit(e){return this.client.rest.methods.updateGuildRole(this,e)}setName(e){return this.edit({name:e})}setColor(e){return this.edit({color:e})}setHoist(e){return this.edit({hoist:e})}setPosition(e){return this.guild.setRolePosition(this,e)}setPermissions(e){return this.edit({permissions:e})}setMentionable(e){return this.edit({mentionable:e})}delete(){return this.client.rest.methods.deleteGuildRole(this)}get editable(){if(this.managed)return!1;const e=this.guild.member(this.client.user);return!!e.hasPermission(r.PermissionFlags.MANAGE_ROLES_OR_PERMISSIONS)&&e.highestRole.comparePositionTo(this)>0}equals(e){return e&&this.id===e.id&&this.name===e.name&&this.color===e.color&&this.hoist===e.hoist&&this.position===e.position&&this.permissions===e.permissions&&this.managed===e.managed}toString(){return`<@&${this.id}>`}static comparePositions(e,t){return e.position===t.position?t.id-e.id:e.position-t.position}}e.exports=n},function(e,t,i){var r=t;r.Reporter=i(141).Reporter,r.DecoderBuffer=i(80).DecoderBuffer,r.EncoderBuffer=i(80).EncoderBuffer,r.Node=i(140)},function(e,t,i){(function(t){e.exports=function(e,i){for(var r=Math.min(e.length,i.length),n=new t(r),s=0;s65536)throw new Error("requested too many random bytes");var s=new t.Uint8Array(e);e>0&&a.getRandomValues(s);var o=new i(s.buffer);return"function"==typeof n?r.nextTick(function(){n(null,o)}):o}var a=t.crypto||t.msCrypto;a&&a.getRandomValues?e.exports=s:e.exports=n}).call(t,i(16),i(0).Buffer,i(5))},function(e,t,i){function r(e,t){Object.defineProperty(e.prototype,t,Object.getOwnPropertyDescriptor(h.prototype,t))}const n=i(14),s=i(44),a=i(69),o=i(6),f=i(31);class h{constructor(){this.messages=new o,this.lastMessageID=null}sendMessage(e,t={}){return this.client.rest.methods.sendMessage(this,e,t)}sendTTSMessage(e,t={}){return Object.assign(t,{tts:!0}),this.client.rest.methods.sendMessage(this,e,t)}sendFile(e,t,i,r={}){return t||(t="string"==typeof e?n.basename(e):e&&e.path?n.basename(e.path):"file.jpg"),this.client.resolver.resolveBuffer(e).then(e=>this.client.rest.methods.sendMessage(this,i,r,{file:e,name:t}))}sendCode(e,t,i={}){return i.split&&("object"!=typeof i.split&&(i.split={}),i.split.prepend||(i.split.prepend=`\`\`\`${e||""} +`),i.split.append||(i.split.append="\n```")),t=f(this.client.resolver.resolveString(t),!0),this.sendMessage(`\`\`\`${e||""} ${t} -\`\`\``,i)}fetchMessage(e){return this.client.rest.methods.getChannelMessage(this,e).then(e=>{const t=e instanceof s?e:new s(this,e,this.client);return this._cacheMessage(t),t})}fetchMessages(e={}){return this.client.rest.methods.getChannelMessages(this,e).then(e=>{const t=new a;for(const i of e){const e=new s(this,i,this.client);t.set(i.id,e),this._cacheMessage(e)}return t})}fetchPinnedMessages(){return this.client.rest.methods.getChannelPinnedMessages(this).then(e=>{const t=new a;for(const i of e){const e=new s(this,i,this.client);t.set(i.id,e),this._cacheMessage(e)}return t})}startTyping(e){if("undefined"!=typeof e&&e<1)throw new RangeError("Count must be at least 1.");if(this.client.user._typing.has(this.id)){const t=this.client.user._typing.get(this.id);t.count=e||t.count+1}else this.client.user._typing.set(this.id,{count:e||1,interval:this.client.setInterval(()=>{this.client.rest.methods.sendTyping(this.id)},4e3)}),this.client.rest.methods.sendTyping(this.id)}stopTyping(e=false){if(this.client.user._typing.has(this.id)){const t=this.client.user._typing.get(this.id);t.count--,(t.count<=0||e)&&(this.client.clearInterval(t.interval),this.client.user._typing.delete(this.id))}}get typing(){return this.client.user._typing.has(this.id)}get typingCount(){return this.client.user._typing.has(this.id)?this.client.user._typing.get(this.id).count:0}createCollector(e,t={}){return new o(this,e,t)}awaitMessages(e,t={}){return new Promise((i,n)=>{const r=this.createCollector(e,t);r.on("end",(e,r)=>{t.errors&&t.errors.includes(r)?n(e):i(e)})})}bulkDelete(e){if(!isNaN(e))return this.fetchMessages({limit:e}).then(e=>this.bulkDelete(e));if(e instanceof Array||e instanceof a){const t=e instanceof a?e.keyArray():e.map(e=>e.id);return this.client.rest.methods.bulkDeleteMessages(this,t)}throw new TypeError("The messages must be an Array, Collection, or number.")}_cacheMessage(e){const t=this.client.options.messageCacheMaxSize;return 0===t?null:(this.messages.size>=t&&t>0&&this.messages.delete(this.messages.firstKey()),this.messages.set(e.id,e),e)}}t.applyToClass=((e,t=false)=>{const i=["sendMessage","sendTTSMessage","sendFile","sendCode"];t&&(i.push("_cacheMessage"),i.push("fetchMessages"),i.push("fetchMessage"),i.push("bulkDelete"),i.push("startTyping"),i.push("stopTyping"),i.push("typing"),i.push("typingCount"),i.push("fetchPinnedMessages"),i.push("createCollector"),i.push("awaitMessages"));for(const r of i)n(e,r)})},function(e,t,i){(function(e){function i(e,t){for(var i=0,n=e.length-1;n>=0;n--){var r=e[n];"."===r?e.splice(n,1):".."===r?(e.splice(n,1),i++):i&&(e.splice(n,1),i--)}if(t)for(;i--;i)e.unshift("..");return e}function n(e,t){if(e.filter)return e.filter(t);for(var i=[],n=0;n=-1&&!r;s--){var o=s>=0?arguments[s]:e.cwd();if("string"!=typeof o)throw new TypeError("Arguments to path.resolve must be strings");o&&(t=o+"/"+t,r="/"===o.charAt(0))}return t=i(n(t.split("/"),function(e){return!!e}),!r).join("/"),(r?"/":"")+t||"."},t.normalize=function(e){var r=t.isAbsolute(e),s="/"===o(e,-1);return e=i(n(e.split("/"),function(e){return!!e}),!r).join("/"),e||r||(e="."),e&&s&&(e+="/"),(r?"/":"")+e},t.isAbsolute=function(e){return"/"===e.charAt(0)},t.join=function(){var e=Array.prototype.slice.call(arguments,0);return t.normalize(n(e,function(e,t){if("string"!=typeof e)throw new TypeError("Arguments to path.join must be strings");return e}).join("/"))},t.relative=function(e,i){function n(e){for(var t=0;t=0&&""===e[i];i--);return t>i?[]:e.slice(t,i-t+1)}e=t.resolve(e).substr(1),i=t.resolve(i).substr(1);for(var r=n(e.split("/")),s=n(i.split("/")),o=Math.min(r.length,s.length),a=o,l=0;lnew r(this,e)),this.attachments=new s;for(const t of e.attachments)this.attachments.set(t.id,new n(this,t));this.createdTimestamp=new Date(e.timestamp).getTime(),this.editedTimestamp=e.edited_timestamp?new Date(e.edited_timestamp).getTime():null,this.mentions={users:new s,roles:new s,channels:new s,everyone:e.mention_everyone};for(const i of e.mentions){let e=this.client.users.get(i.id);e?this.mentions.users.set(e.id,e):(e=this.client.dataManager.newUser(i),this.mentions.users.set(e.id,e))}if(e.mention_roles)for(const i of e.mention_roles){const e=this.channel.guild.roles.get(i);e&&this.mentions.roles.set(e.id,e)}if(this.channel.guild){const t=e.content.match(/<#([0-9]{14,20})>/g)||[];for(const i of t){const e=this.channel.guild.channels.get(i.match(/([0-9]{14,20})/g)[0]);e&&this.mentions.channels.set(e.id,e)}}if(this._edits=[],this.reactions=new s,e.reactions&&e.reactions.length>0)for(const a of e.reactions){const e=a.emoji.id?`${a.emoji.name}:${a.emoji.id}`:a.emoji.name;this.reactions.set(e,new l(this,a.emoji,a.count,a.me))}}patch(e){if(e.author&&(this.author=this.client.users.get(e.author.id),this.guild&&(this.member=this.guild.member(this.author))),e.content&&(this.content=e.content),e.timestamp&&(this.createdTimestamp=new Date(e.timestamp).getTime()),e.edited_timestamp&&(this.editedTimestamp=e.edited_timestamp?new Date(e.edited_timestamp).getTime():null),"tts"in e&&(this.tts=e.tts),"mention_everyone"in e&&(this.mentions.everyone=e.mention_everyone),e.nonce&&(this.nonce=e.nonce),e.embeds&&(this.embeds=e.embeds.map(e=>new r(this,e))),e.type>-1&&(this.system=!1,6===e.type&&(this.system=!0)),e.attachments){this.attachments=new s;for(const t of e.attachments)this.attachments.set(t.id,new n(this,t))}if(e.mentions)for(const t of e.mentions){let e=this.client.users.get(t.id);e?this.mentions.users.set(e.id,e):(e=this.client.dataManager.newUser(t),this.mentions.users.set(e.id,e))}if(e.mention_roles)for(const t of e.mention_roles){const e=this.channel.guild.roles.get(t);e&&this.mentions.roles.set(e.id,e)}if(e.id&&(this.id=e.id),this.channel.guild&&e.content){const t=e.content.match(/<#([0-9]{14,20})>/g)||[];for(const i of t){const e=this.channel.guild.channels.get(i.match(/([0-9]{14,20})/g)[0]);e&&this.mentions.channels.set(e.id,e)}}if(e.reactions&&(this.reactions=new s,e.reactions.length>0))for(const i of e.reactions){const t=i.emoji.id?`${i.emoji.name}:${i.emoji.id}`:i.emoji.name;this.reactions.set(t,new l(this,e.emoji,e.count,e.me))}}get createdAt(){return new Date(this.createdTimestamp)}get editedAt(){return this.editedTimestamp?new Date(this.editedTimestamp):null}get guild(){return this.channel.guild||null}get cleanContent(){return this.content.replace(/@(everyone|here)/g,"@​$1").replace(/<@!?[0-9]+>/g,e=>{const t=e.replace(/<|!|>|@/g,"");if("dm"===this.channel.type||"group"===this.channel.type)return this.client.users.has(t)?`@${this.client.users.get(t).username}`:e;const i=this.channel.guild.members.get(t);if(i)return i.nickname?`@${i.nickname}`:`@${i.user.username}`;{const i=this.client.users.get(t);return i?`@${i.username}`:e}}).replace(/<#[0-9]+>/g,e=>{const t=this.client.channels.get(e.replace(/<|#|>/g,""));return t?`#${t.name}`:e}).replace(/<@&[0-9]+>/g,e=>{if("dm"===this.channel.type||"group"===this.channel.type)return e;const t=this.guild.roles.get(e.replace(/<|@|>|&/g,""));return t?`@${t.name}`:e})}get edits(){return this._edits.slice().unshift(this)}get editable(){return this.author.id===this.client.user.id}get deletable(){return this.author.id===this.client.user.id||this.guild&&this.channel.permissionsFor(this.client.user).hasPermission(o.PermissionFlags.MANAGE_MESSAGES)}get pinnable(){return!this.guild||this.channel.permissionsFor(this.client.user).hasPermission(o.PermissionFlags.MANAGE_MESSAGES)}isMentioned(e){return e=e&&e.id?e.id:e,this.mentions.users.has(e)||this.mentions.channels.has(e)||this.mentions.roles.has(e)}edit(e,t={}){return this.client.rest.methods.updateMessage(this,e,t)}editCode(e,t){return t=a(this.client.resolver.resolveString(t),!0),this.edit(`\`\`\`${e||""} +\`\`\``,i)}fetchMessage(e){return this.client.rest.methods.getChannelMessage(this,e).then(e=>{const t=e instanceof s?e:new s(this,e,this.client);return this._cacheMessage(t),t})}fetchMessages(e={}){return this.client.rest.methods.getChannelMessages(this,e).then(e=>{const t=new o;for(const i of e){const e=new s(this,i,this.client);t.set(i.id,e),this._cacheMessage(e)}return t})}fetchPinnedMessages(){return this.client.rest.methods.getChannelPinnedMessages(this).then(e=>{const t=new o;for(const i of e){const e=new s(this,i,this.client);t.set(i.id,e),this._cacheMessage(e)}return t})}startTyping(e){if("undefined"!=typeof e&&e<1)throw new RangeError("Count must be at least 1.");if(this.client.user._typing.has(this.id)){const t=this.client.user._typing.get(this.id);t.count=e||t.count+1}else this.client.user._typing.set(this.id,{count:e||1,interval:this.client.setInterval(()=>{this.client.rest.methods.sendTyping(this.id)},4e3)}),this.client.rest.methods.sendTyping(this.id)}stopTyping(e=false){if(this.client.user._typing.has(this.id)){const t=this.client.user._typing.get(this.id);t.count--,(t.count<=0||e)&&(this.client.clearInterval(t.interval),this.client.user._typing.delete(this.id))}}get typing(){return this.client.user._typing.has(this.id)}get typingCount(){return this.client.user._typing.has(this.id)?this.client.user._typing.get(this.id).count:0}createCollector(e,t={}){return new a(this,e,t)}awaitMessages(e,t={}){return new Promise((i,r)=>{const n=this.createCollector(e,t);n.on("end",(e,n)=>{t.errors&&t.errors.includes(n)?r(e):i(e)})})}bulkDelete(e){if(!isNaN(e))return this.fetchMessages({limit:e}).then(e=>this.bulkDelete(e));if(e instanceof Array||e instanceof o){const t=e instanceof o?e.keyArray():e.map(e=>e.id);return this.client.rest.methods.bulkDeleteMessages(this,t)}throw new TypeError("The messages must be an Array, Collection, or number.")}_cacheMessage(e){const t=this.client.options.messageCacheMaxSize;return 0===t?null:(this.messages.size>=t&&t>0&&this.messages.delete(this.messages.firstKey()),this.messages.set(e.id,e),e)}}t.applyToClass=((e,t=false)=>{const i=["sendMessage","sendTTSMessage","sendFile","sendCode"];t&&(i.push("_cacheMessage"),i.push("fetchMessages"),i.push("fetchMessage"),i.push("bulkDelete"),i.push("startTyping"),i.push("stopTyping"),i.push("typing"),i.push("typingCount"),i.push("fetchPinnedMessages"),i.push("createCollector"),i.push("awaitMessages"));for(const n of i)r(e,n)})},function(e,t,i){const r=i(20),n=i(22),s=i(75),a=i(42),o=i(2),f=i(6),h=i(60);class c extends r{constructor(e,t){super(e.client,t),this.guild=e}setup(e){if(super.setup(e),this.name=e.name,this.position=e.position,this.permissionOverwrites=new f,e.permission_overwrites)for(const t of e.permission_overwrites)this.permissionOverwrites.set(t.id,new s(this,t))}permissionsFor(e){if(e=this.client.resolver.resolveGuildMember(this.guild,e),!e)return null;if(e.id===this.guild.ownerID)return new a(e,o.ALL_PERMISSIONS);let t=0;const i=e.roles;for(const r of i.values())t|=r.permissions;const n=this.overwritesFor(e,!0,i);for(const s of n.role.concat(n.member))t&=~s.denyData,t|=s.allowData;const f=Boolean(t&o.PermissionFlags.ADMINISTRATOR);return f&&(t=o.ALL_PERMISSIONS),new a(e,t)}overwritesFor(e,t=false,i=null){if(t||(e=this.client.resolver.resolveGuildMember(this.guild,e)),!e)return[];i=i||e.roles;const r=[],n=[];for(const s of this.permissionOverwrites.values())s.id===e.id?n.push(s):i.has(s.id)&&r.push(s);return{role:r,member:n}}overwritePermissions(e,t){const i={allow:0,deny:0};if(e instanceof n)i.type="role";else if(this.guild.roles.has(e))e=this.guild.roles.get(e),i.type="role";else if(e=this.client.resolver.resolveUser(e),i.type="member",!e)return Promise.reject(new TypeError("Supplied parameter was neither a User nor a Role."));i.id=e.id;const r=this.permissionOverwrites.get(e.id);r&&(i.allow=r.allowData,i.deny=r.denyData);for(const s in t)t[s]===!0?(i.allow|=o.PermissionFlags[s]||0,i.deny&=~(o.PermissionFlags[s]||0)):t[s]===!1?(i.allow&=~(o.PermissionFlags[s]||0),i.deny|=o.PermissionFlags[s]||0):null===t[s]&&(i.allow&=~(o.PermissionFlags[s]||0),i.deny&=~(o.PermissionFlags[s]||0));return this.client.rest.methods.setChannelOverwrite(this,i)}edit(e){return this.client.rest.methods.updateChannel(this,e)}setName(e){return this.edit({name:e})}setPosition(e){return this.client.rest.methods.updateChannel(this,{position:e})}setTopic(e){return this.client.rest.methods.updateChannel(this,{topic:e})}createInvite(e={}){return this.client.rest.methods.createChannelInvite(this,e)}equals(e){let t=e&&this.id===e.id&&this.type===e.type&&this.topic===e.topic&&this.position===e.position&&this.name===e.name;if(t)if(this.permissionOverwrites&&e.permissionOverwrites){const i=this.permissionOverwrites.keyArray(),r=e.permissionOverwrites.keyArray();t=h(i,r)}else t=!this.permissionOverwrites&&!e.permissionOverwrites;return t}toString(){return`<#${this.id}>`}}e.exports=c},function(e,t,i){const r=i(28),n=i(22),s=i(42),a=i(2),o=i(6),f=i(12).Presence;class h{constructor(e,t){this.client=e.client,Object.defineProperty(this,"client",{enumerable:!1,configurable:!1}),this.guild=e,this.user={},this._roles=[],t&&this.setup(t)}setup(e){this.serverDeaf=e.deaf,this.serverMute=e.mute,this.selfMute=e.self_mute,this.selfDeaf=e.self_deaf,this.voiceSessionID=e.session_id,this.voiceChannelID=e.channel_id,this.speaking=!1,this.nickname=e.nick||null,this.joinedTimestamp=new Date(e.joined_at).getTime(),this.user=e.user,this._roles=e.roles}get joinedAt(){return new Date(this.joinedTimestamp)}get presence(){return this.frozenPresence||this.guild.presences.get(this.id)||new f}get roles(){const e=new o,t=this.guild.roles.get(this.guild.id);t&&e.set(t.id,t);for(const i of this._roles){const t=this.guild.roles.get(i);t&&e.set(t.id,t)}return e}get highestRole(){return this.roles.reduce((e,t)=>!e||t.comparePositionTo(e)>0?t:e)}get mute(){return this.selfMute||this.serverMute}get deaf(){return this.selfDeaf||this.serverDeaf}get voiceChannel(){return this.guild.channels.get(this.voiceChannelID)}get id(){return this.user.id}get permissions(){if(this.user.id===this.guild.ownerID)return new s(this,a.ALL_PERMISSIONS);let e=0;const t=this.roles;for(const i of t.values())e|=i.permissions;const r=Boolean(e&a.PermissionFlags.ADMINISTRATOR);return r&&(e=a.ALL_PERMISSIONS),new s(this,e)}get kickable(){if(this.user.id===this.guild.ownerID)return!1;if(this.user.id===this.client.user.id)return!1;const e=this.guild.member(this.client.user);return!!e.hasPermission(a.PermissionFlags.KICK_MEMBERS)&&e.highestRole.comparePositionTo(this.highestRole)>0}get bannable(){if(this.user.id===this.guild.ownerID)return!1;if(this.user.id===this.client.user.id)return!1;const e=this.guild.member(this.client.user);return!!e.hasPermission(a.PermissionFlags.BAN_MEMBERS)&&e.highestRole.comparePositionTo(this.highestRole)>0}permissionsIn(e){if(e=this.client.resolver.resolveChannel(e),!e||!e.guild)throw new Error("Could not resolve channel to a guild channel.");return e.permissionsFor(this)}hasPermission(e,t=false){return!t&&this.user.id===this.guild.ownerID||this.roles.some(i=>i.hasPermission(e,t))}hasPermissions(e,t=false){return!t&&this.user.id===this.guild.ownerID||e.every(e=>this.hasPermission(e,t))}missingPermissions(e,t=false){return e.filter(e=>!this.hasPermission(e,t))}edit(e){return this.client.rest.methods.updateGuildMember(this,e)}setMute(e){return this.edit({mute:e})}setDeaf(e){return this.edit({deaf:e})}setVoiceChannel(e){return this.edit({channel:e})}setRoles(e){return this.edit({roles:e})}addRole(e){return this.addRoles([e])}addRoles(e){let t;if(e instanceof o){t=this._roles.slice();for(const i of e.values())t.push(i.id)}else t=this._roles.concat(e);return this.edit({roles:t})}removeRole(e){return this.removeRoles([e])}removeRoles(e){const t=this._roles.slice();if(e instanceof o)for(const i of e.values()){const e=t.indexOf(i.id);e>=0&&t.splice(e,1)}else for(const i of e){const e=t.indexOf(i instanceof n?i.id:i);e>=0&&t.splice(e,1)}return this.edit({roles:t})}setNickname(e){return this.edit({nick:e})}deleteDM(){return this.client.rest.methods.deleteChannel(this)}kick(){return this.client.rest.methods.kickGuildMember(this.guild,this)}ban(e=0){return this.client.rest.methods.banGuildMember(this.guild,this,e)}toString(){return`<@${this.nickname?"!":""}${this.user.id}>`}sendMessage(){}sendTTSMessage(){}sendFile(){}sendCode(){}}r.applyToClass(h),e.exports=h},function(e,t){e.exports=function(e,t=false,i=false){return t?e.replace(/```/g,"`​``"):i?e.replace(/\\(`|\\)/g,"$1").replace(/(`|\\)/g,"\\$1"):e.replace(/\\(\*|_|`|~|\\)/g,"$1").replace(/(\*|_|`|~|\\)/g,"\\$1")}},function(e,t,i){var r=t;r.bignum=i(4),r.define=i(139).define,r.base=i(23),r.constants=i(81),r.decoders=i(143),r.encoders=i(145)},function(e,t,i){(function(e){function i(e){var t,i;return t=e>o||e<0?(i=Math.abs(e)%o,e<0?o-i:i):e}function r(e){for(var t=0;t>>8^255&i^99,this.SBOX[n]=i,this.INV_SBOX[i]=n,s=e[n],a=e[s],o=e[a],r=257*e[i]^16843008*i,this.SUB_MIX[0][n]=r<<24|r>>>8,this.SUB_MIX[1][n]=r<<16|r>>>16,this.SUB_MIX[2][n]=r<<8|r>>>24,this.SUB_MIX[3][n]=r,r=16843009*o^65537*a^257*s^16843008*n,this.INV_SUB_MIX[0][i]=r<<24|r>>>8,this.INV_SUB_MIX[1][i]=r<<16|r>>>16,this.INV_SUB_MIX[2][i]=r<<8|r>>>24,this.INV_SUB_MIX[3][i]=r,0===n?n=f=1:(n=s^e[e[e[o^s]]],f^=e[e[f]]);return!0};var f=new n;a.blockSize=16,a.prototype.blockSize=a.blockSize,a.keySize=32,a.prototype.keySize=a.keySize,a.prototype._doReset=function(){var e,t,i,r,n,s;for(i=this._key,t=i.length,this._nRounds=t+6,n=4*(this._nRounds+1),this._keySchedule=[],r=0;r>>24,s=f.SBOX[s>>>24]<<24|f.SBOX[s>>>16&255]<<16|f.SBOX[s>>>8&255]<<8|f.SBOX[255&s],s^=f.RCON[r/t|0]<<24):t>6&&r%t===4?s=f.SBOX[s>>>24]<<24|f.SBOX[s>>>16&255]<<16|f.SBOX[s>>>8&255]<<8|f.SBOX[255&s]:void 0,this._keySchedule[r-t]^s);for(this._invKeySchedule=[],e=0;e>>24]]^f.INV_SUB_MIX[1][f.SBOX[s>>>16&255]]^f.INV_SUB_MIX[2][f.SBOX[s>>>8&255]]^f.INV_SUB_MIX[3][f.SBOX[255&s]];return!0},a.prototype.encryptBlock=function(t){t=s(new e(t));var i=this._doCryptBlock(t,this._keySchedule,f.SUB_MIX,f.SBOX),r=new e(16);return r.writeUInt32BE(i[0],0),r.writeUInt32BE(i[1],4),r.writeUInt32BE(i[2],8),r.writeUInt32BE(i[3],12),r},a.prototype.decryptBlock=function(t){t=s(new e(t));var i=[t[3],t[1]];t[1]=i[0],t[3]=i[1];var r=this._doCryptBlock(t,this._invKeySchedule,f.INV_SUB_MIX,f.INV_SBOX),n=new e(16);return n.writeUInt32BE(r[0],0),n.writeUInt32BE(r[3],4),n.writeUInt32BE(r[2],8),n.writeUInt32BE(r[1],12),n},a.prototype.scrub=function(){r(this._keySchedule),r(this._invKeySchedule),r(this._key)},a.prototype._doCryptBlock=function(e,t,r,n){var s,a,o,f,h,c,l,u,d;a=e[0]^t[0],o=e[1]^t[1],f=e[2]^t[2],h=e[3]^t[3],s=4;for(var p=1;p>>24]^r[1][o>>>16&255]^r[2][f>>>8&255]^r[3][255&h]^t[s++],l=r[0][o>>>24]^r[1][f>>>16&255]^r[2][h>>>8&255]^r[3][255&a]^t[s++],u=r[0][f>>>24]^r[1][h>>>16&255]^r[2][a>>>8&255]^r[3][255&o]^t[s++],d=r[0][h>>>24]^r[1][a>>>16&255]^r[2][o>>>8&255]^r[3][255&f]^t[s++],a=c,o=l,f=u,h=d;return c=(n[a>>>24]<<24|n[o>>>16&255]<<16|n[f>>>8&255]<<8|n[255&h])^t[s++],l=(n[o>>>24]<<24|n[f>>>16&255]<<16|n[h>>>8&255]<<8|n[255&a])^t[s++],u=(n[f>>>24]<<24|n[h>>>16&255]<<16|n[a>>>8&255]<<8|n[255&o])^t[s++],d=(n[h>>>24]<<24|n[a>>>16&255]<<16|n[o>>>8&255]<<8|n[255&f])^t[s++],[i(c),i(l),i(u),i(d)]},t.AES=a}).call(t,i(0).Buffer)},function(e,t){t["aes-128-ecb"]={cipher:"AES",key:128,iv:0,mode:"ECB",type:"block"},t["aes-192-ecb"]={cipher:"AES",key:192,iv:0,mode:"ECB",type:"block"},t["aes-256-ecb"]={cipher:"AES",key:256,iv:0,mode:"ECB",type:"block"},t["aes-128-cbc"]={cipher:"AES",key:128,iv:16,mode:"CBC",type:"block"},t["aes-192-cbc"]={cipher:"AES",key:192,iv:16,mode:"CBC",type:"block"},t["aes-256-cbc"]={cipher:"AES",key:256,iv:16,mode:"CBC",type:"block"},t.aes128=t["aes-128-cbc"],t.aes192=t["aes-192-cbc"],t.aes256=t["aes-256-cbc"],t["aes-128-cfb"]={cipher:"AES",key:128,iv:16,mode:"CFB",type:"stream"},t["aes-192-cfb"]={cipher:"AES",key:192,iv:16,mode:"CFB",type:"stream"},t["aes-256-cfb"]={cipher:"AES",key:256,iv:16,mode:"CFB",type:"stream"},t["aes-128-cfb8"]={cipher:"AES",key:128,iv:16,mode:"CFB8",type:"stream"},t["aes-192-cfb8"]={cipher:"AES",key:192,iv:16,mode:"CFB8",type:"stream"},t["aes-256-cfb8"]={cipher:"AES",key:256,iv:16,mode:"CFB8",type:"stream"},t["aes-128-cfb1"]={cipher:"AES",key:128,iv:16,mode:"CFB1",type:"stream"},t["aes-192-cfb1"]={cipher:"AES",key:192,iv:16,mode:"CFB1",type:"stream"},t["aes-256-cfb1"]={cipher:"AES",key:256,iv:16,mode:"CFB1",type:"stream"},t["aes-128-ofb"]={cipher:"AES",key:128,iv:16,mode:"OFB",type:"stream"},t["aes-192-ofb"]={cipher:"AES",key:192,iv:16,mode:"OFB",type:"stream"},t["aes-256-ofb"]={cipher:"AES",key:256,iv:16,mode:"OFB",type:"stream"},t["aes-128-ctr"]={cipher:"AES",key:128,iv:16,mode:"CTR",type:"stream"},t["aes-192-ctr"]={cipher:"AES",key:192,iv:16,mode:"CTR",type:"stream"},t["aes-256-ctr"]={cipher:"AES",key:256,iv:16,mode:"CTR",type:"stream"},t["aes-128-gcm"]={cipher:"AES",key:128,iv:12,mode:"GCM",type:"auth"},t["aes-192-gcm"]={cipher:"AES",key:192,iv:12,mode:"GCM",type:"auth"},t["aes-256-gcm"]={cipher:"AES",key:256,iv:12,mode:"GCM",type:"auth"}},function(e,t,i){(function(e){function r(e){for(var t,i=e.length;i--;){if(t=e.readUInt8(i),255!==t){t++,e.writeUInt8(t,i);break}e.writeUInt8(0,i)}}function n(e){var t=e._cipher.encryptBlock(e._prev);return r(e._prev),t}var s=i(24);t.encrypt=function(t,i){for(;t._cache.length0&&d.push(a),d.push(e),i&&d.push(i),a=n(t.concat(d)),d=[],o=0,r>0)for(;;){if(0===r)break;if(o===a.length)break;c[f++]=a[o],r--,o++}if(s>0&&o!==a.length)for(;;){if(0===s)break;if(o===a.length)break;l[h++]=a[o],s--,o++}if(0===r&&0===s)break}for(o=0;oe.server_max_window_bits)&&("number"!=typeof this._options.clientMaxWindowBits||e.client_max_window_bits))return(this._options.serverNoContextTakeover||e.server_no_context_takeover)&&(t.server_no_context_takeover=!0),this._options.clientNoContextTakeover&&(t.client_no_context_takeover=!0),this._options.clientNoContextTakeover!==!1&&e.client_no_context_takeover&&(t.client_no_context_takeover=!0),"number"==typeof this._options.serverMaxWindowBits?t.server_max_window_bits=this._options.serverMaxWindowBits:"number"==typeof e.server_max_window_bits&&(t.server_max_window_bits=e.server_max_window_bits),"number"==typeof this._options.clientMaxWindowBits?t.client_max_window_bits=this._options.clientMaxWindowBits:this._options.clientMaxWindowBits!==!1&&"number"==typeof e.client_max_window_bits&&(t.client_max_window_bits=e.client_max_window_bits),!0},this);if(!i)throw new Error("Doesn't support the offered configuration");return t},r.prototype.acceptAsClient=function(e){var t=e[0];if(null!=this._options.clientNoContextTakeover&&this._options.clientNoContextTakeover===!1&&t.client_no_context_takeover)throw new Error('Invalid value for "client_no_context_takeover"');if(null!=this._options.clientMaxWindowBits){if(this._options.clientMaxWindowBits===!1&&t.client_max_window_bits)throw new Error('Invalid value for "client_max_window_bits"');if("number"==typeof this._options.clientMaxWindowBits&&(!t.client_max_window_bits||t.client_max_window_bits>this._options.clientMaxWindowBits))throw new Error('Invalid value for "client_max_window_bits"')}return t},r.prototype.normalizeParams=function(e){return e.map(function(e){return Object.keys(e).forEach(function(t){var i=e[t];if(i.length>1)throw new Error("Multiple extension parameters for "+t);switch(i=i[0],t){case"server_no_context_takeover":case"client_no_context_takeover":if(i!==!0)throw new Error("invalid extension parameter value for "+t+" ("+i+")");e[t]=!0;break;case"server_max_window_bits":case"client_max_window_bits":if("string"==typeof i&&(i=parseInt(i,10),!~s.indexOf(i)))throw new Error("invalid extension parameter value for "+t+" ("+i+")");if(!this._isServer&&i===!0)throw new Error("Missing extension parameter value for "+t);e[t]=i;break;default:throw new Error("Not defined extension parameter ("+t+")")}},this),e},this)},r.prototype.decompress=function(e,i,r){function s(e){f(),r(e)}function o(e){if(void 0!==l._maxPayload&&null!==l._maxPayload&&l._maxPayload>0&&(d+=e.length,d>l._maxPayload)){u=[],f();var t={type:1009};return void r(t)}u.push(e)}function f(){l._inflate&&(l._inflate.removeListener("error",s),l._inflate.removeListener("data",o),l._inflate.writeInProgress=!1,(i&&l.params[h+"_no_context_takeover"]||l._inflate.pendingClose)&&(l._inflate.close&&l._inflate.close(),l._inflate=null))}var h=this._isServer?"client":"server";if(!this._inflate){var c=this.params[h+"_max_window_bits"];this._inflate=n.createInflateRaw({windowBits:"number"==typeof c?c:a})}this._inflate.writeInProgress=!0;var l=this,u=[],d=0;this._inflate.on("error",s).on("data",o),this._inflate.write(e),i&&this._inflate.write(new t([0,0,255,255])),this._inflate.flush(function(){f(),r(null,t.concat(u))})},r.prototype.compress=function(e,i,r){function s(e){h(),r(e)}function f(e){d.push(e)}function h(){u._deflate&&(u._deflate.removeListener("error",s),u._deflate.removeListener("data",f),u._deflate.writeInProgress=!1,(i&&u.params[c+"_no_context_takeover"]||u._deflate.pendingClose)&&(u._deflate.close&&u._deflate.close(),u._deflate=null))}var c=this._isServer?"server":"client";if(!this._deflate){var l=this.params[c+"_max_window_bits"];this._deflate=n.createDeflateRaw({flush:n.Z_SYNC_FLUSH,windowBits:"number"==typeof l?l:a,memLevel:this._options.memLevel||o})}this._deflate.writeInProgress=!0;var u=this,d=[];this._deflate.on("error",s).on("data",f),this._deflate.write(e),this._deflate.flush(function(){h();var e=t.concat(d);i&&(e=e.slice(0,e.length-4)),r(null,e)})},e.exports=r}).call(t,i(0).Buffer)},function(e,t){e.exports=function e(t,i){if(!i)return t;for(const r in t)({}).hasOwnProperty.call(i,r)?i[r]===Object(i[r])&&(i[r]=e(t[r],i[r])):i[r]=t[r];return i}},function(e,t,i){const r=i(2);class n{constructor(e,t){this.member=e,this.raw=t}serialize(){const e={};for(const t in r.PermissionFlags)e[t]=this.hasPermission(t);return e}hasPermission(e,t=false){return e=this.member.client.resolver.resolvePermission(e),!t&&(this.raw&r.PermissionFlags.ADMINISTRATOR)>0||(this.raw&e)>0}hasPermissions(e,t=false){return e.every(e=>this.hasPermission(e,t))}missingPermissions(e,t=false){return e.filter(e=>!this.hasPermission(e,t))}}e.exports=n},function(e,t,i){const r=i(11),n=i(22),s=i(21),a=i(12).Presence,o=i(30),f=i(2),h=i(6),c=i(130),l=i(60);class u{constructor(e,t){this.client=e,Object.defineProperty(this,"client",{enumerable:!1,configurable:!1}),this.members=new h,this.channels=new h,this.roles=new h,t&&(t.unavailable?(this.available=!1,this.id=t.id):(this.available=!0,this.setup(t)))}setup(e){this.name=e.name,this.icon=e.icon,this.splash=e.splash,this.region=e.region,this.memberCount=e.member_count||this.memberCount,this.large=e.large||this.large,this.presences=new h,this.features=e.features,this.emojis=new h;for(const t of e.emojis)this.emojis.set(t.id,new s(this,t));if(this.afkTimeout=e.afk_timeout,this.afkChannelID=e.afk_channel_id,this.embedEnabled=e.embed_enabled,this.verificationLevel=e.verification_level,this.joinedTimestamp=e.joined_at?new Date(e.joined_at).getTime():this.joinedTimestamp,this.id=e.id,this.available=!e.unavailable,this.features=e.features||this.features||[],e.members){this.members.clear();for(const t of e.members)this._addMember(t,!1)}if(e.owner_id&&(this.ownerID=e.owner_id),e.channels){this.channels.clear();for(const t of e.channels)this.client.dataManager.newChannel(t,this)}if(e.roles){this.roles.clear();for(const t of e.roles){const e=new n(this,t);this.roles.set(e.id,e)}}if(e.presences)for(const i of e.presences)this._setPresence(i.user.id,i);if(this._rawVoiceStates=new h,e.voice_states)for(const r of e.voice_states){this._rawVoiceStates.set(r.user_id,r);const e=this.members.get(r.user_id);e&&(e.serverMute=r.mute,e.serverDeaf=r.deaf,e.selfMute=r.self_mute,e.selfDeaf=r.self_deaf,e.voiceSessionID=r.session_id,e.voiceChannelID=r.channel_id,this.channels.get(r.channel_id).members.set(e.user.id,e))}}get createdTimestamp(){return this.id/4194304+14200704e5}get createdAt(){return new Date(this.createdTimestamp)}get joinedAt(){return new Date(this.joinedTimestamp)}get iconURL(){return this.icon?f.Endpoints.guildIcon(this.id,this.icon):null}get owner(){return this.members.get(this.ownerID)}get voiceConnection(){return this.client.voice.connections.get(this.id)||null}get defaultChannel(){return this.channels.get(this.id)}member(e){return this.client.resolver.resolveGuildMember(this,e)}fetchBans(){return this.client.rest.methods.getGuildBans(this)}fetchInvites(){return this.client.rest.methods.getGuildInvites(this)}fetchWebhooks(){return this.client.rest.methods.getGuildWebhooks(this)}fetchMember(e){return this._fetchWaiter?Promise.reject(new Error("Already fetching guild members.")):(e=this.client.resolver.resolveUser(e),e?this.members.has(e.id)?Promise.resolve(this.members.get(e.id)):this.client.rest.methods.getGuildMember(this,e):Promise.reject(new Error("User is not cached. Use Client.fetchUser first.")))}fetchMembers(e=""){return new Promise((t,i)=>{if(this._fetchWaiter)throw new Error("Already fetching guild members in ${this.id}.");return this.memberCount===this.members.size?void t(this):(this._fetchWaiter=t,this.client.ws.send({op:f.OPCodes.REQUEST_GUILD_MEMBERS,d:{guild_id:this.id,query:e,limit:0}}),this._checkChunks(),void this.client.setTimeout(()=>i(new Error("Members didn't arrive in time.")),12e4))})}edit(e){return this.client.rest.methods.updateGuild(this,e)}setName(e){return this.edit({name:e})}setRegion(e){return this.edit({region:e})}setVerificationLevel(e){return this.edit({verificationLevel:e})}setAFKChannel(e){return this.edit({afkChannel:e})}setAFKTimeout(e){return this.edit({afkTimeout:e})}setIcon(e){return this.edit({icon:e})}setOwner(e){return this.edit({owner:e})}setSplash(e){return this.edit({splash:e})}ban(e,t=0){return this.client.rest.methods.banGuildMember(this,e,t)}unban(e){return this.client.rest.methods.unbanGuildMember(this,e)}pruneMembers(e,t=false){if("number"!=typeof e)throw new TypeError("Days must be a number.");return this.client.rest.methods.pruneGuildMembers(this,e,t)}sync(){this.client.user.bot||this.client.syncGuilds([this])}createChannel(e,t){return this.client.rest.methods.createChannel(this,e,t)}createRole(e){const t=this.client.rest.methods.createGuildRole(this);return e?t.then(t=>t.edit(e)):t}createEmoji(e,t){return new Promise(i=>{e.startsWith("data:")?i(this.client.rest.methods.createEmoji(this,e,t)):this.client.resolver.resolveBuffer(e).then(e=>i(this.client.rest.methods.createEmoji(this,e,t)))})}deleteEmoji(e){return e instanceof s||(e=this.emojis.get(e)),this.client.rest.methods.deleteEmoji(e)}leave(){return this.client.rest.methods.leaveGuild(this)}delete(){return this.client.rest.methods.deleteGuild(this)}setRolePosition(e,t){if(e instanceof n)e=e.id;else if("string"!=typeof e)return Promise.reject(new Error("Supplied role is not a role or string"));if(t=Number(t),isNaN(t))return Promise.reject(new Error("Supplied position is not a number"));const i=this.roles.array().map(i=>({id:i.id,position:i.id===e?t:i.positionnew n(this,e)),this.attachments=new s;for(const t of e.attachments)this.attachments.set(t.id,new r(this,t));this.createdTimestamp=new Date(e.timestamp).getTime(),this.editedTimestamp=e.edited_timestamp?new Date(e.edited_timestamp).getTime():null,this.mentions={users:new s,roles:new s,channels:new s,everyone:e.mention_everyone};for(const i of e.mentions){let e=this.client.users.get(i.id);e?this.mentions.users.set(e.id,e):(e=this.client.dataManager.newUser(i), +this.mentions.users.set(e.id,e))}if(e.mention_roles)for(const i of e.mention_roles){const e=this.channel.guild.roles.get(i);e&&this.mentions.roles.set(e.id,e)}if(this.channel.guild){const t=e.content.match(/<#([0-9]{14,20})>/g)||[];for(const i of t){const e=this.channel.guild.channels.get(i.match(/([0-9]{14,20})/g)[0]);e&&this.mentions.channels.set(e.id,e)}}if(this._edits=[],this.reactions=new s,e.reactions&&e.reactions.length>0)for(const o of e.reactions){const e=o.emoji.id?`${o.emoji.name}:${o.emoji.id}`:o.emoji.name;this.reactions.set(e,new f(this,o.emoji,o.count,o.me))}}patch(e){if(e.author&&(this.author=this.client.users.get(e.author.id),this.guild&&(this.member=this.guild.member(this.author))),e.content&&(this.content=e.content),e.timestamp&&(this.createdTimestamp=new Date(e.timestamp).getTime()),e.edited_timestamp&&(this.editedTimestamp=e.edited_timestamp?new Date(e.edited_timestamp).getTime():null),"tts"in e&&(this.tts=e.tts),"mention_everyone"in e&&(this.mentions.everyone=e.mention_everyone),e.nonce&&(this.nonce=e.nonce),e.embeds&&(this.embeds=e.embeds.map(e=>new n(this,e))),e.type>-1&&(this.system=!1,6===e.type&&(this.system=!0)),e.attachments){this.attachments=new s;for(const t of e.attachments)this.attachments.set(t.id,new r(this,t))}if(e.mentions)for(const t of e.mentions){let e=this.client.users.get(t.id);e?this.mentions.users.set(e.id,e):(e=this.client.dataManager.newUser(t),this.mentions.users.set(e.id,e))}if(e.mention_roles)for(const t of e.mention_roles){const e=this.channel.guild.roles.get(t);e&&this.mentions.roles.set(e.id,e)}if(e.id&&(this.id=e.id),this.channel.guild&&e.content){const t=e.content.match(/<#([0-9]{14,20})>/g)||[];for(const i of t){const e=this.channel.guild.channels.get(i.match(/([0-9]{14,20})/g)[0]);e&&this.mentions.channels.set(e.id,e)}}if(e.reactions&&(this.reactions=new s,e.reactions.length>0))for(const i of e.reactions){const t=i.emoji.id?`${i.emoji.name}:${i.emoji.id}`:i.emoji.name;this.reactions.set(t,new f(this,e.emoji,e.count,e.me))}}get createdAt(){return new Date(this.createdTimestamp)}get editedAt(){return this.editedTimestamp?new Date(this.editedTimestamp):null}get guild(){return this.channel.guild||null}get cleanContent(){return this.content.replace(/@(everyone|here)/g,"@​$1").replace(/<@!?[0-9]+>/g,e=>{const t=e.replace(/<|!|>|@/g,"");if("dm"===this.channel.type||"group"===this.channel.type)return this.client.users.has(t)?`@${this.client.users.get(t).username}`:e;const i=this.channel.guild.members.get(t);if(i)return i.nickname?`@${i.nickname}`:`@${i.user.username}`;{const i=this.client.users.get(t);return i?`@${i.username}`:e}}).replace(/<#[0-9]+>/g,e=>{const t=this.client.channels.get(e.replace(/<|#|>/g,""));return t?`#${t.name}`:e}).replace(/<@&[0-9]+>/g,e=>{if("dm"===this.channel.type||"group"===this.channel.type)return e;const t=this.guild.roles.get(e.replace(/<|@|>|&/g,""));return t?`@${t.name}`:e})}get edits(){return this._edits.slice().unshift(this)}get editable(){return this.author.id===this.client.user.id}get deletable(){return this.author.id===this.client.user.id||this.guild&&this.channel.permissionsFor(this.client.user).hasPermission(a.PermissionFlags.MANAGE_MESSAGES)}get pinnable(){return!this.guild||this.channel.permissionsFor(this.client.user).hasPermission(a.PermissionFlags.MANAGE_MESSAGES)}isMentioned(e){return e=e&&e.id?e.id:e,this.mentions.users.has(e)||this.mentions.channels.has(e)||this.mentions.roles.has(e)}edit(e,t={}){return this.client.rest.methods.updateMessage(this,e,t)}editCode(e,t){return t=o(this.client.resolver.resolveString(t),!0),this.edit(`\`\`\`${e||""} ${t} -\`\`\``)}pin(){return this.client.rest.methods.pinMessage(this)}unpin(){return this.client.rest.methods.unpinMessage(this)}react(e){if(e=this.client.resolver.resolveEmojiIdentifier(e),!e)throw new TypeError("Emoji must be a string or Emoji/ReactionEmoji");return this.client.rest.methods.addMessageReaction(this,e)}clearReactions(){return this.client.rest.methods.removeMessageReactions(this)}delete(e=0){return e<=0?this.client.rest.methods.deleteMessage(this):new Promise(t=>{this.client.setTimeout(()=>{t(this.delete())},e)})}reply(e,t={}){e=this.client.resolver.resolveString(e);const i=this.guild?`${this.author}, `:"";return e=`${i}${e}`,t.split&&("object"!=typeof t.split&&(t.split={}),t.split.prepend||(t.split.prepend=i)),this.client.rest.methods.sendMessage(this.channel,e,t)}equals(e,t){if(!e)return!1;const i=!e.author&&!e.attachments;if(i)return this.id===e.id&&this.embeds.length===e.embeds.length;let n=this.id===e.id&&this.author.id===e.author.id&&this.content===e.content&&this.tts===e.tts&&this.nonce===e.nonce&&this.embeds.length===e.embeds.length&&this.attachments.length===e.attachments.length;return n&&t&&(n=this.mentions.everyone===e.mentions.everyone&&this.createdTimestamp===new Date(t.timestamp).getTime()&&this.editedTimestamp===new Date(t.edited_timestamp).getTime()),n}toString(){return this.content}_addReaction(e,t){const i=e.id?`${e.name}:${e.id}`:e.name;let n;return this.reactions.has(i)?(n=this.reactions.get(i),n.me||(n.me=t.id===this.client.user.id)):(n=new l(this,e,0,t.id===this.client.user.id),this.reactions.set(i,n)),n.users.has(t.id)?null:(n.users.set(t.id,t),n.count++,n)}_removeReaction(e,t){const i=e.id||e;if(this.reactions.has(i)){const e=this.reactions.get(i);if(e.users.has(t.id))return e.users.delete(t.id),e.count--,t.id===this.client.user.id&&(e.me=!1),e}return null}_clearReactions(){this.reactions.clear()}}e.exports=f},function(e,t){class i{constructor(e,t){this.client=e.client,Object.defineProperty(this,"client",{enumerable:!1,configurable:!1}),this.message=e,this.setup(t)}setup(e){this.id=e.id,this.filename=e.filename,this.filesize=e.size,this.url=e.url,this.proxyURL=e.proxy_url,this.height=e.height,this.width=e.width}}e.exports=i},function(e,t){class i{constructor(e,t){this.client=e.client,Object.defineProperty(this,"client",{enumerable:!1,configurable:!1}),this.message=e,this.setup(t)}setup(e){if(this.title=e.title,this.type=e.type,this.description=e.description,this.url=e.url,this.fields=[],e.fields)for(const t of e.fields)this.fields.push(new o(this,t));this.createdTimestamp=e.timestamp,this.thumbnail=e.thumbnail?new n(this,e.thumbnail):null,this.author=e.author?new s(this,e.author):null,this.provider=e.provider?new r(this,e.provider):null,this.footer=e.footer?new a(this,e.footer):null}get createdAt(){return new Date(this.createdTimestamp)}}class n{constructor(e,t){this.embed=e,this.setup(t)}setup(e){this.url=e.url,this.proxyURL=e.proxy_url,this.height=e.height,this.width=e.width}}class r{constructor(e,t){this.embed=e,this.setup(t)}setup(e){this.name=e.name,this.url=e.url}}class s{constructor(e,t){this.embed=e,this.setup(t)}setup(e){this.name=e.name,this.url=e.url}}class o{constructor(e,t){this.embed=e,this.setup(t)}setup(e){this.name=e.name,this.value=e.value,this.inline=e.inline}}class a{constructor(e,t){this.embed=e,this.setup(t)}setup(e){this.text=e.text,this.iconUrl=e.icon_url,this.proxyIconUrl=e.proxy_icon_url}}i.Thumbnail=n,i.Provider=r,i.Author=s,i.Field=o,i.Footer=a,e.exports=i},function(e,t){e.exports=function(e,t=false,i=false){return t?e.replace(/```/g,"`​``"):i?e.replace(/\\(`|\\)/g,"$1").replace(/(`|\\)/g,"\\$1"):e.replace(/\\(\*|_|`|~|\\)/g,"$1").replace(/(\*|_|`|~|\\)/g,"\\$1")}},function(e,t,i){const n=i(10),r=i(21),s=i(22);class o{constructor(e,t,i,r){this.message=e,this.me=r,this.count=i||0,this.users=new n,this._emoji=new s(this,t.name,t.id)}get emoji(){if(this._emoji instanceof r)return this._emoji;if(this._emoji.id){const e=this.message.client.emojis;if(e.has(this._emoji.id)){const t=e.get(this._emoji.id);return this._emoji=t,t}}return this._emoji}remove(e=this.message.client.user){const t=this.message;return e=this.message.client.resolver.resolveUserID(e),e?t.client.rest.methods.removeMessageReaction(t,this.emoji.identifier,e):Promise.reject("Couldn't resolve the user ID to remove from the reaction.")}fetchUsers(e=100){const t=this.message;return t.client.rest.methods.getMessageReactionUsers(t,this.emoji.identifier,e).then(e=>{this.users=new n;for(const t of e){const e=this.message.client.dataManager.newUser(t);this.users.set(e.id,e)}return this.count=this.users.size,e})}}e.exports=o},function(e,t,i){const n=i(5),r=i(10);class s{constructor(e,t){this.client=e.client,Object.defineProperty(this,"client",{enumerable:!1,configurable:!1}),this.guild=e,this.setup(t)}setup(e){this.id=e.id,this.name=e.name,this.requiresColons=e.require_colons,this.managed=e.managed,this._roles=e.roles}get createdTimestamp(){return this.id/4194304+14200704e5}get createdAt(){return new Date(this.createdTimestamp)}get roles(){const e=new r;for(const t of this._roles)this.guild.roles.has(t)&&e.set(t,this.guild.roles.get(t));return e}get url(){return`${n.Endpoints.CDN}/emojis/${this.id}.png`}toString(){return this.requiresColons?`<:${this.name}:${this.id}>`:this.name}get identifier(){return this.id?`${this.name}:${this.id}`:encodeURIComponent(this.name)}}e.exports=s},function(e,t){class i{constructor(e,t,i){this.reaction=e,this.name=t,this.id=i}get identifier(){return this.id?`${this.name}:${this.id}`:encodeURIComponent(this.name)}toString(){return this.id?`<:${this.name}:${this.id}>`:this.name}}e.exports=i},function(e,t,i){const n=i(3).EventEmitter,r=i(10);class s extends n{constructor(e,t,i={}){super(),this.channel=e,this.filter=t,this.options=i,this.ended=!1,this.collected=new r,this.listener=(e=>this.verify(e)),this.channel.client.on("message",this.listener),i.time&&this.channel.client.setTimeout(()=>this.stop("time"),i.time)}verify(e){return(!this.channel||this.channel.id===e.channel.id)&&(!!this.filter(e,this)&&(this.collected.set(e.id,e),this.emit("message",e,this),this.collected.size>=this.options.maxMatches?this.stop("matchesLimit"):this.options.max&&this.collected.size===this.options.max&&this.stop("limit"),!0))}get next(){return new Promise((e,t)=>{if(this.ended)return void t(this.collected);const i=()=>{this.removeListener("message",n),this.removeListener("end",r)},n=(...t)=>{i(),e(...t)},r=(...e)=>{i(),t(...e)};this.once("message",n),this.once("end",r)})}stop(e="user"){this.ended||(this.ended=!0,this.channel.client.removeListener("message",this.listener),this.emit("end",this.collected,e))}}e.exports=s},function(e,t){class i{constructor(e={}){this.status=e.status||"offline",this.game=e.game?new n(e.game):null}update(e){this.status=e.status||this.status,this.game=e.game?new n(e.game):null}equals(e){return e&&this.status===e.status&&this.game?this.game.equals(e.game):!e.game}}class n{constructor(e){this.name=e.name,this.type=e.type,this.url=e.url||null}get streaming(){return 1===this.type}equals(e){return e&&this.name===e.name&&this.type===e.type&&this.url===e.url}}t.Presence=i,t.Game=n},function(e,t,i){const n=i(14),r=i(26),s=i(27),o=i(5),a=i(10),l=i(24).Presence;class f{constructor(e,t){this.client=e.client,Object.defineProperty(this,"client",{enumerable:!1,configurable:!1}),this.guild=e,this.user={},this._roles=[],t&&this.setup(t)}setup(e){this.serverDeaf=e.deaf,this.serverMute=e.mute,this.selfMute=e.self_mute,this.selfDeaf=e.self_deaf,this.voiceSessionID=e.session_id,this.voiceChannelID=e.channel_id,this.speaking=!1,this.nickname=e.nick||null,this.joinedTimestamp=new Date(e.joined_at).getTime(),this.user=e.user,this._roles=e.roles}get joinedAt(){return new Date(this.joinedTimestamp)}get presence(){return this.frozenPresence||this.guild.presences.get(this.id)||new l}get roles(){const e=new a,t=this.guild.roles.get(this.guild.id);t&&e.set(t.id,t);for(const i of this._roles){const t=this.guild.roles.get(i);t&&e.set(t.id,t)}return e}get highestRole(){return this.roles.reduce((e,t)=>!e||t.comparePositionTo(e)>0?t:e)}get mute(){return this.selfMute||this.serverMute}get deaf(){return this.selfDeaf||this.serverDeaf}get voiceChannel(){return this.guild.channels.get(this.voiceChannelID)}get id(){return this.user.id}get permissions(){if(this.user.id===this.guild.ownerID)return new s(this,o.ALL_PERMISSIONS);let e=0;const t=this.roles;for(const i of t.values())e|=i.permissions;const n=Boolean(e&o.PermissionFlags.ADMINISTRATOR);return n&&(e=o.ALL_PERMISSIONS),new s(this,e)}get kickable(){if(this.user.id===this.guild.ownerID)return!1;if(this.user.id===this.client.user.id)return!1;const e=this.guild.member(this.client.user);return!!e.hasPermission(o.PermissionFlags.KICK_MEMBERS)&&e.highestRole.comparePositionTo(this.highestRole)>0}get bannable(){if(this.user.id===this.guild.ownerID)return!1;if(this.user.id===this.client.user.id)return!1;const e=this.guild.member(this.client.user);return!!e.hasPermission(o.PermissionFlags.BAN_MEMBERS)&&e.highestRole.comparePositionTo(this.highestRole)>0}permissionsIn(e){if(e=this.client.resolver.resolveChannel(e),!e||!e.guild)throw new Error("Could not resolve channel to a guild channel.");return e.permissionsFor(this)}hasPermission(e,t=false){return!t&&this.user.id===this.guild.ownerID||this.roles.some(i=>i.hasPermission(e,t))}hasPermissions(e,t=false){return!t&&this.user.id===this.guild.ownerID||e.every(e=>this.hasPermission(e,t))}missingPermissions(e,t=false){return e.filter(e=>!this.hasPermission(e,t))}edit(e){return this.client.rest.methods.updateGuildMember(this,e)}setMute(e){return this.edit({mute:e})}setDeaf(e){return this.edit({deaf:e})}setVoiceChannel(e){return this.edit({channel:e})}setRoles(e){return this.edit({roles:e})}addRole(e){return this.addRoles([e])}addRoles(e){let t;if(e instanceof a){t=this._roles.slice();for(const i of e.values())t.push(i.id)}else t=this._roles.concat(e);return this.edit({roles:t})}removeRole(e){return this.removeRoles([e])}removeRoles(e){const t=this._roles.slice();if(e instanceof a)for(const i of e.values()){const e=t.indexOf(i.id);e>=0&&t.splice(e,1)}else for(const i of e){const e=t.indexOf(i instanceof r?i.id:i);e>=0&&t.splice(e,1)}return this.edit({roles:t})}setNickname(e){return this.edit({nick:e})}deleteDM(){return this.client.rest.methods.deleteChannel(this)}kick(){return this.client.rest.methods.kickGuildMember(this.guild,this)}ban(e=0){return this.client.rest.methods.banGuildMember(this.guild,this,e)}toString(){return`<@${this.nickname?"!":""}${this.user.id}>`}sendMessage(){}sendTTSMessage(){}sendFile(){}sendCode(){}}n.applyToClass(f),e.exports=f},function(e,t,i){const n=i(5);class r{constructor(e,t){this.client=e.client,Object.defineProperty(this,"client",{enumerable:!1,configurable:!1}),this.guild=e,t&&this.setup(t)}setup(e){this.id=e.id,this.name=e.name,this.color=e.color,this.hoist=e.hoist,this.position=e.position,this.permissions=e.permissions,this.managed=e.managed,this.mentionable=e.mentionable}get createdTimestamp(){return this.id/4194304+14200704e5}get createdAt(){return new Date(this.createdTimestamp)}get hexColor(){let e=this.color.toString(16);for(;e.length<6;)e=`0${e}`;return`#${e}`}get members(){return this.guild.members.filter(e=>e.roles.has(this.id))}serialize(){const e={};for(const t in n.PermissionFlags)e[t]=this.hasPermission(t);return e}hasPermission(e,t=false){return e=this.client.resolver.resolvePermission(e),!t&&(this.permissions&n.PermissionFlags.ADMINISTRATOR)>0||(this.permissions&e)>0}hasPermissions(e,t=false){return e.every(e=>this.hasPermission(e,t))}comparePositionTo(e){return this.constructor.comparePositions(this,e)}edit(e){return this.client.rest.methods.updateGuildRole(this,e)}setName(e){return this.edit({name:e})}setColor(e){return this.edit({color:e})}setHoist(e){return this.edit({hoist:e})}setPosition(e){return this.guild.setRolePosition(this,e)}setPermissions(e){return this.edit({permissions:e})}setMentionable(e){return this.edit({mentionable:e})}delete(){return this.client.rest.methods.deleteGuildRole(this)}get editable(){if(this.managed)return!1;const e=this.guild.member(this.client.user);return!!e.hasPermission(n.PermissionFlags.MANAGE_ROLES_OR_PERMISSIONS)&&e.highestRole.comparePositionTo(this)>0}equals(e){return e&&this.id===e.id&&this.name===e.name&&this.color===e.color&&this.hoist===e.hoist&&this.position===e.position&&this.permissions===e.permissions&&this.managed===e.managed}toString(){return`<@&${this.id}>`}static comparePositions(e,t){return e.position===t.position?t.id-e.id:e.position-t.position}}e.exports=r},function(e,t,i){const n=i(5);class r{constructor(e,t){this.member=e,this.raw=t}serialize(){const e={};for(const t in n.PermissionFlags)e[t]=this.hasPermission(t);return e}hasPermission(e,t=false){return e=this.member.client.resolver.resolvePermission(e),!t&&(this.raw&n.PermissionFlags.ADMINISTRATOR)>0||(this.raw&e)>0}hasPermissions(e,t=false){return e.every(e=>this.hasPermission(e,t))}missingPermissions(e,t=false){return e.filter(e=>!this.hasPermission(e,t))}}e.exports=r},function(e,t,i){const n=i(29),r=i(30),s=i(5);class o{constructor(e,t){this.client=e,Object.defineProperty(this,"client",{enumerable:!1,configurable:!1}),this.setup(t)}setup(e){this.guild=this.client.guilds.get(e.guild.id)||new n(this.client,e.guild),this.code=e.code,this.temporary=e.temporary,this.maxAge=e.max_age,this.uses=e.uses,this.maxUses=e.max_uses,e.inviter&&(this.inviter=this.client.dataManager.newUser(e.inviter)),this.channel=this.client.channels.get(e.channel.id)||new r(this.client,e.channel),this.createdTimestamp=new Date(e.created_at).getTime()}get createdAt(){return new Date(this.createdTimestamp)}get expiresTimestamp(){return this.createdTimestamp+1e3*this.maxAge}get expiresAt(){return new Date(this.expiresTimestamp)}get url(){return s.Endpoints.inviteLink(this.code)}delete(){return this.client.rest.methods.deleteInvite(this)}toString(){return this.url}}e.exports=o},function(e,t){class i{constructor(e,t){this.client=e,Object.defineProperty(this,"client",{enumerable:!1,configurable:!1}),this.setup(t)}setup(e){this.id=e.id,this.name=e.name,this.icon=e.icon,this.splash=e.splash}}e.exports=i},function(e,t,i){const n=i(5);class r{constructor(e,t){this.client=e,Object.defineProperty(this,"client",{enumerable:!1,configurable:!1}),this.setup(t)}setup(e){this.id=e.id,this.name=e.name,this.type=n.ChannelTypes.text===e.type?"text":"voice"}}e.exports=r},function(e,t,i){const n=i(15),r=i(19);class s{constructor(e,t,i){e?(this.client=e,Object.defineProperty(this,"client",{enumerable:!1,configurable:!1}),t&&this.setup(t)):(this.id=t,this.token=i,this.client=this)}setup(e){this.name=e.name,this.token=e.token,this.avatar=e.avatar,this.id=e.id,this.guildID=e.guild_id,this.channelID=e.channel_id,e.user&&(this.owner=e.user)}sendMessage(e,t={}){return this.client.rest.methods.sendWebhookMessage(this,e,t)}sendSlackMessage(e){return this.client.rest.methods.sendSlackWebhookMessage(this,e)}sendTTSMessage(e,t={}){return Object.assign(t,{tts:!0}),this.client.rest.methods.sendWebhookMessage(this,e,t)}sendFile(e,t,i,r={}){return t||(t="string"==typeof e?n.basename(e):e&&e.path?n.basename(e.path):"file.jpg"),this.client.resolver.resolveBuffer(e).then(e=>this.client.rest.methods.sendWebhookMessage(this,i,r,{file:e,name:t}))}sendCode(e,t,i={}){return i.split&&("object"!=typeof i.split&&(i.split={}),i.split.prepend||(i.split.prepend=`\`\`\`${e||""} -`),i.split.append||(i.split.append="\n```")),t=r(this.client.resolver.resolveString(t),!0),this.sendMessage(`\`\`\`${e||""} +\`\`\``)}pin(){return this.client.rest.methods.pinMessage(this)}unpin(){return this.client.rest.methods.unpinMessage(this)}react(e){if(e=this.client.resolver.resolveEmojiIdentifier(e),!e)throw new TypeError("Emoji must be a string or Emoji/ReactionEmoji");return this.client.rest.methods.addMessageReaction(this,e)}clearReactions(){return this.client.rest.methods.removeMessageReactions(this)}delete(e=0){return e<=0?this.client.rest.methods.deleteMessage(this):new Promise(t=>{this.client.setTimeout(()=>{t(this.delete())},e)})}reply(e,t={}){e=this.client.resolver.resolveString(e);const i=this.guild?`${this.author}, `:"";return e=`${i}${e}`,t.split&&("object"!=typeof t.split&&(t.split={}),t.split.prepend||(t.split.prepend=i)),this.client.rest.methods.sendMessage(this.channel,e,t)}equals(e,t){if(!e)return!1;const i=!e.author&&!e.attachments;if(i)return this.id===e.id&&this.embeds.length===e.embeds.length;let r=this.id===e.id&&this.author.id===e.author.id&&this.content===e.content&&this.tts===e.tts&&this.nonce===e.nonce&&this.embeds.length===e.embeds.length&&this.attachments.length===e.attachments.length;return r&&t&&(r=this.mentions.everyone===e.mentions.everyone&&this.createdTimestamp===new Date(t.timestamp).getTime()&&this.editedTimestamp===new Date(t.edited_timestamp).getTime()),r}toString(){return this.content}_addReaction(e,t){const i=e.id?`${e.name}:${e.id}`:e.name;let r;return this.reactions.has(i)?(r=this.reactions.get(i),r.me||(r.me=t.id===this.client.user.id)):(r=new f(this,e,0,t.id===this.client.user.id),this.reactions.set(i,r)),r.users.has(t.id)?null:(r.users.set(t.id,t),r.count++,r)}_removeReaction(e,t){const i=e.id||e;if(this.reactions.has(i)){const e=this.reactions.get(i);if(e.users.has(t.id))return e.users.delete(t.id),e.count--,t.id===this.client.user.id&&(e.me=!1),e}return null}_clearReactions(){this.reactions.clear()}}e.exports=h},function(e,t){class i{constructor(e,t,i){this.reaction=e,this.name=t,this.id=i}get identifier(){return this.id?`${this.name}:${this.id}`:encodeURIComponent(this.name)}toString(){return this.id?`<:${this.name}:${this.id}>`:this.name}}e.exports=i},function(e,t,i){const r=i(14),n=i(31);class s{constructor(e,t,i){e?(this.client=e,Object.defineProperty(this,"client",{enumerable:!1,configurable:!1}),t&&this.setup(t)):(this.id=t,this.token=i,this.client=this)}setup(e){this.name=e.name,this.token=e.token,this.avatar=e.avatar,this.id=e.id,this.guildID=e.guild_id,this.channelID=e.channel_id,e.user&&(this.owner=e.user)}sendMessage(e,t={}){return this.client.rest.methods.sendWebhookMessage(this,e,t)}sendSlackMessage(e){return this.client.rest.methods.sendSlackWebhookMessage(this,e)}sendTTSMessage(e,t={}){return Object.assign(t,{tts:!0}),this.client.rest.methods.sendWebhookMessage(this,e,t)}sendFile(e,t,i,n={}){return t||(t="string"==typeof e?r.basename(e):e&&e.path?r.basename(e.path):"file.jpg"),this.client.resolver.resolveBuffer(e).then(e=>this.client.rest.methods.sendWebhookMessage(this,i,n,{file:e,name:t}))}sendCode(e,t,i={}){return i.split&&("object"!=typeof i.split&&(i.split={}),i.split.prepend||(i.split.prepend=`\`\`\`${e||""} +`),i.split.append||(i.split.append="\n```")),t=n(this.client.resolver.resolveString(t),!0),this.sendMessage(`\`\`\`${e||""} ${t} -\`\`\``,i)}edit(e=this.name,t){return t?this.client.resolver.resolveBuffer(t).then(t=>{const i=this.client.resolver.resolveBase64(t);return this.client.rest.methods.editWebhook(this,e,i)}):this.client.rest.methods.editWebhook(this,e).then(e=>{return this.setup(e),this})}delete(){return this.client.rest.methods.deleteWebhook(this)}}e.exports=s},function(e,t,i){const n=i(10),r=i(33);class s{constructor(e,t){this.user=e,this.client=this.user.client,Object.defineProperty(this,"client",{enumerable:!1,configurable:!1}),this.mutualGuilds=new n,this.connections=new n,this.setup(t)}setup(e){for(const t of e.mutual_guilds)this.client.guilds.has(t.id)&&this.mutualGuilds.set(t.id,this.client.guilds.get(t.id));for(const i of e.connected_accounts)this.connections.set(i.id,new r(this.user,i))}}e.exports=s},function(e,t){class i{constructor(e,t){this.user=e,this.setup(t)}setup(e){this.type=e.type,this.name=e.name,this.id=e.id,this.revoked=e.revoked,this.integrations=e.integrations}}e.exports=i},function(e,t,i){const n=i(13),r=i(35);class s extends r{setup(e){super.setup(e),this.flags=e.flags,this.owner=new n(this.client,e.owner)}}e.exports=s},function(e,t){class i{constructor(e,t){this.client=e,Object.defineProperty(this,"client",{enumerable:!1,configurable:!1}),this.setup(t)}setup(e){this.id=e.id,this.name=e.name,this.description=e.description,this.icon=e.icon,this.iconURL=`https://cdn.discordapp.com/app-icons/${this.id}/${this.icon}.jpg`,this.rpcOrigins=e.rpc_origins}get createdTimestamp(){return this.id/4194304+14200704e5}get createdAt(){return new Date(this.createdTimestamp)}toString(){return this.name}}e.exports=i},function(e,t,i){const n=i(37);class r extends n{constructor(e,t){super(e,t),this.waiting=!1,this.endpoint=t,this.timeDifference=0}push(e){super.push(e),this.handle()}execute(e){return new Promise(t=>{e.request.gen().end((i,n)=>{if(n&&n.headers&&(this.requestLimit=n.headers["x-ratelimit-limit"],this.requestResetTime=1e3*Number(n.headers["x-ratelimit-reset"]),this.requestRemaining=Number(n.headers["x-ratelimit-remaining"]),this.timeDifference=Date.now()-new Date(n.headers.date).getTime()),i)429===i.status?(this.restManager.client.setTimeout(()=>{this.waiting=!1,this.globalLimit=!1,t()},Number(n.headers["retry-after"])+500),n.headers["x-ratelimit-global"]&&(this.globalLimit=!0)):(this.queue.shift(),this.waiting=!1,e.reject(i),t(i));else{this.queue.shift(),this.globalLimit=!1;const i=n&&n.body?n.body:{};e.resolve(i),0===this.requestRemaining?this.restManager.client.setTimeout(()=>{this.waiting=!1,t(i)},this.requestResetTime-Date.now()+this.timeDifference+1e3):(this.waiting=!1,t(i))}})})}handle(){if(super.handle(),!this.waiting&&0!==this.queue.length&&!this.globalLimit){this.waiting=!0;const e=this.queue[0];this.execute(e).then(()=>this.handle())}}}e.exports=r},function(e,t){class i{constructor(e){this.restManager=e,this.queue=[]}get globalLimit(){return this.restManager.globallyRateLimited}set globalLimit(e){this.restManager.globallyRateLimited=e}push(e){this.queue.push(e)}handle(){}}e.exports=i},function(e,t,i){const n=i(37);class r extends n{constructor(e,t){super(e,t),this.requestRemaining=1,this.first=!0}push(e){super.push(e),this.handle()}handleNext(e){this.waiting||(this.waiting=!0,this.restManager.client.setTimeout(()=>{this.requestRemaining=this.requestLimit,this.waiting=!1,this.handle()},e))}execute(e){e.request.gen().end((t,i)=>{if(i&&i.headers&&(this.requestLimit=i.headers["x-ratelimit-limit"],this.requestResetTime=1e3*Number(i.headers["x-ratelimit-reset"]),this.requestRemaining=Number(i.headers["x-ratelimit-remaining"]),this.timeDifference=Date.now()-new Date(i.headers.date).getTime(),this.handleNext(this.requestResetTime-Date.now()+this.timeDifference+1e3)),t)429===t.status?(this.requestRemaining=0,this.queue.unshift(e),this.restManager.client.setTimeout(()=>{this.globalLimit=!1,this.handle()},Number(i.headers["retry-after"])+500),i.headers["x-ratelimit-global"]&&(this.globalLimit=!0)):e.reject(t);else{this.globalLimit=!1;const t=i&&i.body?i.body:{};e.resolve(t),this.first&&(this.first=!1,this.handle())}})}handle(){if(super.handle(),!(this.requestRemaining<1||0===this.queue.length||this.globalLimit))for(;this.queue.length>0&&this.requestRemaining>0;)this.execute(this.queue.shift()),this.requestRemaining--}}e.exports=r},function(e,t,i){function n(e){let t=e.split("?")[0];if(t.includes("/channels/")||t.includes("/guilds/")){const e=~t.indexOf("/channels/")?t.indexOf("/channels/"):t.indexOf("/guilds/"),i=t.substring(e).split("/")[2];t=t.replace(/(\d{8,})/g,":id").replace(":id",i)}return t}const r=i(40),s=i(5);class o{constructor(e,t,i,r,s,o){this.rest=e,this.method=t,this.url=i,this.auth=r,this.data=s,this.file=o,this.route=n(this.url)}getAuth(){if(this.rest.client.token&&this.rest.client.user&&this.rest.client.user.bot)return`Bot ${this.rest.client.token}`;if(this.rest.client.token)return this.rest.client.token;throw new Error(s.Errors.NO_TOKEN)}gen(){const e=r[this.method](this.url);if(this.auth&&e.set("authorization",this.getAuth()),this.file&&this.file.file){e.attach("file",this.file.file,this.file.name),this.data=this.data||{};for(const t in this.data)this.data[t]&&e.field(t,this.data[t])}else this.data&&e.send(this.data);return e.set("User-Agent",this.rest.userAgentManager.userAgent),e}}e.exports=o},function(e,t,i){function n(){}function r(e){if(!m(e))return e;var t=[];for(var i in e)s(t,i,e[i]);return t.join("&")}function s(e,t,i){if(null!=i)if(Array.isArray(i))i.forEach(function(i){s(e,t,i)});else if(m(i))for(var n in i)s(e,t+"["+n+"]",i[n]);else e.push(encodeURIComponent(t)+"="+encodeURIComponent(i));else null===i&&e.push(encodeURIComponent(t))}function o(e){for(var t,i,n={},r=e.split("&"),s=0,o=r.length;s=300)&&(n=new Error(t.statusText||"Unsuccessful HTTP response"),n.original=e,n.response=t,n.status=t.status)}catch(e){n=e}n?i.callback(n,t):i.callback(null,t)})}function d(e,t){var i=g("DELETE",e);return t&&i.end(t),i}var p;"undefined"!=typeof window?p=window:"undefined"!=typeof self?p=self:(console.warn("Using browser-only version of superagent in non-browser environment"),p=this);var b=i(41),w=i(42),m=i(43),g=e.exports=i(44).bind(null,c);g.getXHR=function(){if(!(!p.XMLHttpRequest||p.location&&"file:"==p.location.protocol&&p.ActiveXObject))return new XMLHttpRequest;try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(e){}try{return new ActiveXObject("Msxml2.XMLHTTP.6.0")}catch(e){}try{return new ActiveXObject("Msxml2.XMLHTTP.3.0")}catch(e){}try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(e){}throw Error("Browser-only verison of superagent could not find XHR")};var _="".trim?function(e){return e.trim()}:function(e){return e.replace(/(^\s*|\s*$)/g,"")};g.serializeObject=r,g.parseString=o,g.types={html:"text/html",json:"application/json",xml:"application/xml",urlencoded:"application/x-www-form-urlencoded",form:"application/x-www-form-urlencoded","form-data":"application/x-www-form-urlencoded"},g.serialize={"application/x-www-form-urlencoded":r,"application/json":JSON.stringify},g.parse={"application/x-www-form-urlencoded":o,"application/json":JSON.parse},u.prototype.get=function(e){return this.header[e.toLowerCase()]},u.prototype._setHeaderProperties=function(e){var t=this.header["content-type"]||"";this.type=f(t);var i=h(t);for(var n in i)this[n]=i[n]},u.prototype._parseBody=function(e){var t=g.parse[this.type];return!t&&l(this.type)&&(t=g.parse["application/json"]),t&&e&&(e.length||e instanceof Object)?t(e):null},u.prototype._setStatusProperties=function(e){1223===e&&(e=204);var t=e/100|0;this.status=this.statusCode=e,this.statusType=t,this.info=1==t,this.ok=2==t,this.clientError=4==t,this.serverError=5==t,this.error=(4==t||5==t)&&this.toError(),this.accepted=202==e,this.noContent=204==e,this.badRequest=400==e,this.unauthorized=401==e,this.notAcceptable=406==e,this.notFound=404==e,this.forbidden=403==e},u.prototype.toError=function(){var e=this.req,t=e.method,i=e.url,n="cannot "+t+" "+i+" ("+this.status+")",r=new Error(n);return r.status=this.status,r.method=t,r.url=i,r},g.Response=u,b(c.prototype),w(c.prototype),c.prototype.type=function(e){return this.set("Content-Type",g.types[e]||e),this},c.prototype.responseType=function(e){return this._responseType=e,this},c.prototype.accept=function(e){return this.set("Accept",g.types[e]||e),this},c.prototype.auth=function(e,t,i){switch(i||(i={type:"basic"}),i.type){case"basic":var n=btoa(e+":"+t);this.set("Authorization","Basic "+n);break;case"auto":this.username=e,this.password=t}return this},c.prototype.query=function(e){return"string"!=typeof e&&(e=r(e)),e&&this._query.push(e),this},c.prototype.attach=function(e,t,i){if(this._data)throw Error("superagent can't mix .send() and .attach()");return this._getFormData().append(e,t,i||t.name),this},c.prototype._getFormData=function(){return this._formData||(this._formData=new p.FormData),this._formData},c.prototype.callback=function(e,t){var i=this._callback;this.clearTimeout(),e&&this.emit("error",e),i(e,t)},c.prototype.crossDomainError=function(){var e=new Error("Request has been terminated\nPossible causes: the network is offline, Origin is not allowed by Access-Control-Allow-Origin, the page is being unloaded, etc.");e.crossDomain=!0,e.status=this.status,e.method=this.method,e.url=this.url,this.callback(e)},c.prototype.buffer=c.prototype.ca=c.prototype.agent=function(){return console.warn("This is not supported in browser version of superagent"),this},c.prototype.pipe=c.prototype.write=function(){throw Error("Streaming is not supported in browser version of superagent")},c.prototype._timeoutError=function(){var e=this._timeout,t=new Error("timeout of "+e+"ms exceeded");t.timeout=e,this.callback(t)},c.prototype._appendQueryString=function(){var e=this._query.join("&");e&&(this.url+=~this.url.indexOf("?")?"&"+e:"?"+e)},c.prototype._isHost=function(e){return e&&"object"==typeof e&&!Array.isArray(e)&&"[object Object]"!==Object.prototype.toString.call(e)},c.prototype.end=function(e){var t=this,i=this.xhr=g.getXHR(),r=this._timeout,s=this._formData||this._data;this._callback=e||n,i.onreadystatechange=function(){if(4==i.readyState){var e;try{e=i.status}catch(t){e=0}if(0==e){if(t.timedout)return t._timeoutError();if(t._aborted)return;return t.crossDomainError()}t.emit("end")}};var o=function(e,i){i.total>0&&(i.percent=i.loaded/i.total*100),i.direction=e,t.emit("progress",i)};if(this.hasListeners("progress"))try{i.onprogress=o.bind(null,"download"),i.upload&&(i.upload.onprogress=o.bind(null,"upload"))}catch(e){}if(r&&!this._timer&&(this._timer=setTimeout(function(){t.timedout=!0,t.abort()},r)),this._appendQueryString(),this.username&&this.password?i.open(this.method,this.url,!0,this.username,this.password):i.open(this.method,this.url,!0),this._withCredentials&&(i.withCredentials=!0),"GET"!=this.method&&"HEAD"!=this.method&&"string"!=typeof s&&!this._isHost(s)){var a=this._header["content-type"],f=this._serializer||g.serialize[a?a.split(";")[0]:""];!f&&l(a)&&(f=g.serialize["application/json"]),f&&(s=f(s))}for(var h in this.header)null!=this.header[h]&&i.setRequestHeader(h,this.header[h]);return this._responseType&&(i.responseType=this._responseType),this.emit("request",this),i.send("undefined"!=typeof s?s:null),this},g.Request=c,g.get=function(e,t,i){var n=g("GET",e);return"function"==typeof t&&(i=t,t=null),t&&n.query(t),i&&n.end(i),n},g.head=function(e,t,i){var n=g("HEAD",e);return"function"==typeof t&&(i=t,t=null),t&&n.send(t),i&&n.end(i),n},g.options=function(e,t,i){var n=g("OPTIONS",e);return"function"==typeof t&&(i=t,t=null),t&&n.send(t),i&&n.end(i),n},g.del=d,g.delete=d,g.patch=function(e,t,i){var n=g("PATCH",e);return"function"==typeof t&&(i=t,t=null),t&&n.send(t),i&&n.end(i),n},g.post=function(e,t,i){var n=g("POST",e);return"function"==typeof t&&(i=t,t=null),t&&n.send(t),i&&n.end(i),n},g.put=function(e,t,i){var n=g("PUT",e);return"function"==typeof t&&(i=t,t=null),t&&n.send(t),i&&n.end(i),n}},function(e,t,i){function n(e){if(e)return r(e)}function r(e){for(var t in n.prototype)e[t]=n.prototype[t];return e}e.exports=n,n.prototype.on=n.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},n.prototype.once=function(e,t){function i(){this.off(e,i),t.apply(this,arguments)}return i.fn=t,this.on(e,i),this},n.prototype.off=n.prototype.removeListener=n.prototype.removeAllListeners=n.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var i=this._callbacks["$"+e];if(!i)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var n,r=0;r{this.client.emit(n.Events.GUILD_CREATE,i)}):this.client.emit(n.Events.GUILD_CREATE,i)),i}newUser(e){if(this.client.users.has(e.id))return this.client.users.get(e.id);const t=new o(this.client,e);return this.client.users.set(t.id,t),t}newChannel(e,t){const i=this.client.channels.has(e.id);let r;return e.type===n.ChannelTypes.DM?r=new a(this.client,e):e.type===n.ChannelTypes.groupDM?r=new c(this.client,e):(t=t||this.client.guilds.get(e.guild_id),t&&(e.type===n.ChannelTypes.text?(r=new f(t,e),t.channels.set(r.id,r)):e.type===n.ChannelTypes.voice&&(r=new h(t,e),t.channels.set(r.id,r)))),r?(this.pastReady&&!i&&this.client.emit(n.Events.CHANNEL_CREATE,r),this.client.channels.set(r.id,r),r):null}newEmoji(e,t){const i=t.emojis.has(e.id);if(e&&!i){let i=new l(t,e);return this.client.emit(n.Events.EMOJI_CREATE,i),t.emojis.set(i.id,i),i}return i?t.emojis.get(e.id):null}killEmoji(e){e instanceof l&&e.guild&&(this.client.emit(n.Events.EMOJI_DELETE,e),e.guild.emojis.delete(e.id))}killGuild(e){const t=this.client.guilds.has(e.id);this.client.guilds.delete(e.id),t&&this.pastReady&&this.client.emit(n.Events.GUILD_DELETE,e)}killUser(e){this.client.users.delete(e.id)}killChannel(e){this.client.channels.delete(e.id),e instanceof u&&e.guild.channels.delete(e.id)}updateGuild(e,t){const i=r(e);e.setup(t),this.pastReady&&this.client.emit(n.Events.GUILD_UPDATE,i,e)}updateChannel(e,t){e.setup(t)}updateEmoji(e,t){const i=r(e);e.setup(t),this.client.emit(n.Events.GUILD_EMOJI_UPDATE,i,e)}}e.exports=d},function(e,t){e.exports=function(e){const t=Object.create(e);return Object.assign(t,e),t}},function(e,t,i){const n=i(13),r=i(26),s=i(21),o=i(24).Presence,a=i(25),l=i(5),f=i(10),h=i(46),u=i(48);class c{constructor(e,t){this.client=e,Object.defineProperty(this,"client",{enumerable:!1,configurable:!1}),this.members=new f,this.channels=new f,this.roles=new f,t&&(t.unavailable?(this.available=!1,this.id=t.id):(this.available=!0,this.setup(t)))}setup(e){this.name=e.name,this.icon=e.icon,this.splash=e.splash,this.region=e.region,this.memberCount=e.member_count||this.memberCount,this.large=e.large||this.large,this.presences=new f,this.features=e.features,this.emojis=new f;for(const t of e.emojis)this.emojis.set(t.id,new s(this,t));if(this.afkTimeout=e.afk_timeout,this.afkChannelID=e.afk_channel_id,this.embedEnabled=e.embed_enabled,this.verificationLevel=e.verification_level,this.joinedTimestamp=e.joined_at?new Date(e.joined_at).getTime():this.joinedTimestamp,this.id=e.id,this.available=!e.unavailable,this.features=e.features||this.features||[],e.members){this.members.clear();for(const t of e.members)this._addMember(t,!1)}if(e.owner_id&&(this.ownerID=e.owner_id),e.channels){this.channels.clear();for(const t of e.channels)this.client.dataManager.newChannel(t,this)}if(e.roles){this.roles.clear();for(const t of e.roles){const e=new r(this,t);this.roles.set(e.id,e)}}if(e.presences)for(const i of e.presences)this._setPresence(i.user.id,i);if(this._rawVoiceStates=new f,e.voice_states)for(const n of e.voice_states){this._rawVoiceStates.set(n.user_id,n);const e=this.members.get(n.user_id);e&&(e.serverMute=n.mute,e.serverDeaf=n.deaf,e.selfMute=n.self_mute,e.selfDeaf=n.self_deaf,e.voiceSessionID=n.session_id,e.voiceChannelID=n.channel_id,this.channels.get(n.channel_id).members.set(e.user.id,e))}}get createdTimestamp(){return this.id/4194304+14200704e5}get createdAt(){return new Date(this.createdTimestamp)}get joinedAt(){return new Date(this.joinedTimestamp)}get iconURL(){return this.icon?l.Endpoints.guildIcon(this.id,this.icon):null}get owner(){return this.members.get(this.ownerID)}get voiceConnection(){return this.client.voice.connections.get(this.id)||null}get defaultChannel(){return this.channels.get(this.id)}member(e){return this.client.resolver.resolveGuildMember(this,e)}fetchBans(){return this.client.rest.methods.getGuildBans(this)}fetchInvites(){return this.client.rest.methods.getGuildInvites(this)}fetchWebhooks(){return this.client.rest.methods.getGuildWebhooks(this)}fetchMember(e){return this._fetchWaiter?Promise.reject(new Error("Already fetching guild members.")):(e=this.client.resolver.resolveUser(e),e?this.members.has(e.id)?Promise.resolve(this.members.get(e.id)):this.client.rest.methods.getGuildMember(this,e):Promise.reject(new Error("User is not cached. Use Client.fetchUser first.")))}fetchMembers(e=""){return new Promise((t,i)=>{if(this._fetchWaiter)throw new Error("Already fetching guild members in ${this.id}.");return this.memberCount===this.members.size?void t(this):(this._fetchWaiter=t,this.client.ws.send({op:l.OPCodes.REQUEST_GUILD_MEMBERS,d:{guild_id:this.id,query:e,limit:0}}),this._checkChunks(),void this.client.setTimeout(()=>i(new Error("Members didn't arrive in time.")),12e4))})}edit(e){return this.client.rest.methods.updateGuild(this,e)}setName(e){return this.edit({name:e})}setRegion(e){return this.edit({region:e})}setVerificationLevel(e){return this.edit({verificationLevel:e})}setAFKChannel(e){return this.edit({afkChannel:e})}setAFKTimeout(e){return this.edit({afkTimeout:e})}setIcon(e){return this.edit({icon:e})}setOwner(e){return this.edit({owner:e})}setSplash(e){return this.edit({splash:e})}ban(e,t=0){return this.client.rest.methods.banGuildMember(this,e,t)}unban(e){return this.client.rest.methods.unbanGuildMember(this,e)}pruneMembers(e,t=false){if("number"!=typeof e)throw new TypeError("Days must be a number.");return this.client.rest.methods.pruneGuildMembers(this,e,t)}sync(){this.client.user.bot||this.client.syncGuilds([this])}createChannel(e,t){return this.client.rest.methods.createChannel(this,e,t)}createRole(e){const t=this.client.rest.methods.createGuildRole(this);return e?t.then(t=>t.edit(e)):t}createEmoji(e,t){return new Promise(i=>{e.startsWith("data:")?i(this.client.rest.methods.createEmoji(this,e,t)):this.client.resolver.resolveBuffer(e).then(e=>i(this.client.rest.methods.createEmoji(this,e,t)))})}deleteEmoji(e){return e instanceof s||(e=this.emojis.get(e)),this.client.rest.methods.deleteEmoji(e)}leave(){return this.client.rest.methods.leaveGuild(this)}delete(){return this.client.rest.methods.deleteGuild(this)}setRolePosition(e,t){if(e instanceof r)e=e.id;else if("string"!=typeof e)return Promise.reject(new Error("Supplied role is not a role or string"));if(t=Number(t),isNaN(t))return Promise.reject(new Error("Supplied position is not a number"));const i=this.roles.array().map(i=>({id:i.id,position:i.id===e?t:i.position{t.startsWith("data:")?i(this.client.rest.methods.createWebhook(this,e,t)):this.client.resolver.resolveBuffer(t).then(t=>i(this.client.rest.methods.createWebhook(this,e,t)))})}sendMessage(){}sendTTSMessage(){}sendFile(){}sendCode(){}fetchMessage(){}fetchMessages(){}fetchPinnedMessages(){}startTyping(){}stopTyping(){}get typing(){}get typingCount(){}createCollector(){}awaitMessages(){}bulkDelete(){}_cacheMessage(){}}r.applyToClass(o,!0),e.exports=o},function(e,t,i){const n=i(50),r=i(26),s=i(53),o=i(27),a=i(5),l=i(10),f=i(48);class h extends n{constructor(e,t){super(e.client,t),this.guild=e}setup(e){if(super.setup(e),this.name=e.name,this.position=e.position,this.permissionOverwrites=new l,e.permission_overwrites)for(const t of e.permission_overwrites)this.permissionOverwrites.set(t.id,new s(this,t))}permissionsFor(e){if(e=this.client.resolver.resolveGuildMember(this.guild,e),!e)return null;if(e.id===this.guild.ownerID)return new o(e,a.ALL_PERMISSIONS);let t=0;const i=e.roles;for(const n of i.values())t|=n.permissions;const r=this.overwritesFor(e,!0,i);for(const s of r.role.concat(r.member))t&=~s.denyData,t|=s.allowData;const l=Boolean(t&a.PermissionFlags.ADMINISTRATOR);return l&&(t=a.ALL_PERMISSIONS),new o(e,t)}overwritesFor(e,t=false,i=null){if(t||(e=this.client.resolver.resolveGuildMember(this.guild,e)),!e)return[];i=i||e.roles;const n=[],r=[];for(const s of this.permissionOverwrites.values())s.id===e.id?r.push(s):i.has(s.id)&&n.push(s);return{role:n,member:r}}overwritePermissions(e,t){const i={allow:0,deny:0};if(e instanceof r)i.type="role";else if(this.guild.roles.has(e))e=this.guild.roles.get(e),i.type="role";else if(e=this.client.resolver.resolveUser(e),i.type="member",!e)return Promise.reject(new TypeError("Supplied parameter was neither a User nor a Role."));i.id=e.id;const n=this.permissionOverwrites.get(e.id);n&&(i.allow=n.allowData,i.deny=n.denyData);for(const s in t)t[s]===!0?(i.allow|=a.PermissionFlags[s]||0,i.deny&=~(a.PermissionFlags[s]||0)):t[s]===!1?(i.allow&=~(a.PermissionFlags[s]||0),i.deny|=a.PermissionFlags[s]||0):null===t[s]&&(i.allow&=~(a.PermissionFlags[s]||0),i.deny&=~(a.PermissionFlags[s]||0));return this.client.rest.methods.setChannelOverwrite(this,i)}edit(e){return this.client.rest.methods.updateChannel(this,e)}setName(e){return this.edit({name:e})}setPosition(e){return this.client.rest.methods.updateChannel(this,{position:e})}setTopic(e){return this.client.rest.methods.updateChannel(this,{topic:e})}createInvite(e={}){return this.client.rest.methods.createChannelInvite(this,e)}equals(e){let t=e&&this.id===e.id&&this.type===e.type&&this.topic===e.topic&&this.position===e.position&&this.name===e.name;if(t)if(this.permissionOverwrites&&e.permissionOverwrites){const i=this.permissionOverwrites.keyArray(),n=e.permissionOverwrites.keyArray();t=f(i,n)}else t=!this.permissionOverwrites&&!e.permissionOverwrites;return t}toString(){return`<#${this.id}>`}}e.exports=h},function(e,t){class i{constructor(e,t){this.channel=e,t&&this.setup(t)}setup(e){this.id=e.id,this.type=e.type,this.denyData=e.deny,this.allowData=e.allow}delete(){return this.channel.client.rest.methods.deletePermissionOverwrites(this)}}e.exports=i},function(e,t,i){const n=i(52),r=i(10);class s extends n{constructor(e,t){super(e,t),this.members=new r,this.type="voice"}setup(e){super.setup(e),this.bitrate=e.bitrate,this.userLimit=e.user_limit}get connection(){const e=this.guild.voiceConnection;return e&&e.channel.id===this.id?e:null}get joinable(){return this.permissionsFor(this.client.user).hasPermission("CONNECT")}get speakable(){return this.permissionsFor(this.client.user).hasPermission("SPEAK")}setBitrate(e){return this.edit({bitrate:e})}setUserLimit(e){return this.edit({userLimit:e})}join(){return this.client.voice.joinChannel(this)}leave(){const e=this.client.voice.connections.get(this.guild.id);e&&e.channel.id===this.id&&e.disconnect()}}e.exports=s},function(e,t,i){const n=i(50),r=i(14),s=i(10),o=i(48);class a extends n{constructor(e,t){super(e,t),this.type="group",this.messages=new s,this._typing=new Map}setup(e){if(super.setup(e),this.name=e.name,this.icon=e.icon,this.ownerID=e.owner_id,this.recipients||(this.recipients=new s),e.recipients)for(const t of e.recipients){const e=this.client.dataManager.newUser(t); -this.recipients.set(e.id,e)}this.lastMessageID=e.last_message_id}get owner(){return this.client.users.get(this.ownerID)}equals(e){const t=e&&this.id===e.id&&this.name===e.name&&this.icon===e.icon&&this.ownerID===e.ownerID;if(t){const t=this.recipients.keyArray(),i=e.recipients.keyArray();return o(t,i)}return t}toString(){return this.name}sendMessage(){}sendTTSMessage(){}sendFile(){}sendCode(){}fetchMessage(){}fetchMessages(){}fetchPinnedMessages(){}startTyping(){}stopTyping(){}get typing(){}get typingCount(){}createCollector(){}awaitMessages(){}bulkDelete(){}_cacheMessage(){}}r.applyToClass(a,!0),e.exports=a},function(e,t,i){const n=i(5);class r{constructor(e){this.client=e,this.heartbeatInterval=null}connectToWebSocket(e,t,i){this.client.emit(n.Events.DEBUG,`Authenticated using token ${e}`),this.client.token=e;const r=this.client.setTimeout(()=>i(new Error(n.Errors.TOOK_TOO_LONG)),3e5);this.client.rest.methods.getGateway().then(s=>{this.client.emit(n.Events.DEBUG,`Using gateway ${s}`),this.client.ws.connect(s),this.client.ws.once("close",e=>{4004===e.code&&i(new Error(n.Errors.BAD_LOGIN)),4010===e.code&&i(new Error(n.Errors.INVALID_SHARD))}),this.client.once(n.Events.READY,()=>{t(e),this.client.clearTimeout(r)})},i)}setupKeepAlive(e){this.heartbeatInterval=this.client.setInterval(()=>{this.client.emit("debug","Sending heartbeat"),this.client.ws.send({op:n.OPCodes.HEARTBEAT,d:this.client.ws.sequence},!0)},e)}destroy(){return new Promise(e=>{this.client.ws.destroy(),this.client.user.bot?e():e(this.client.rest.methods.logout())})}}e.exports=r},function(e,t,i){(function(t){const n=i(15),r=i(62),s=i(40),o=i(5),a=i(63),l=i(13),f=i(16),h=i(47),u=i(50),c=i(25),d=i(21),p=i(22);class b{constructor(e){this.client=e}resolveUser(e){return e instanceof l?e:"string"==typeof e?this.client.users.get(e)||null:e instanceof c?e.user:e instanceof f?e.author:e instanceof h?e.owner:null}resolveUserID(e){return e instanceof l||e instanceof c?e.id:"string"==typeof e?e||null:e instanceof f?e.author.id:e instanceof h?e.ownerID:null}resolveGuild(e){return e instanceof h?e:"string"==typeof e?this.client.guilds.get(e)||null:null}resolveGuildMember(e,t){return t instanceof c?t:(e=this.resolveGuild(e),t=this.resolveUser(t),e&&t?e.members.get(t.id)||null:null)}resolveChannel(e){return e instanceof u?e:e instanceof f?e.channel:e instanceof h?e.channels.get(e.id)||null:"string"==typeof e?this.client.channels.get(e)||null:null}resolveInviteCode(e){const t=/discord(?:app)?\.(?:gg|com\/invite)\/([a-z0-9]{5})/i,i=t.exec(e);return i&&i[1]?i[1]:e}resolvePermission(e){if("string"==typeof e&&(e=o.PermissionFlags[e]),"number"!=typeof e||e<1)throw new Error(o.Errors.NOT_A_PERMISSION);return e}resolveString(e){return"string"==typeof e?e:e instanceof Array?e.join("\n"):String(e)}resolveBase64(e){return e instanceof t?`data:image/jpg;base64,${e.toString("base64")}`:e}resolveBuffer(e){return e instanceof t?Promise.resolve(e):this.client.browser&&e instanceof ArrayBuffer?Promise.resolve(a(e)):"string"==typeof e?new Promise((i,o)=>{if(/^https?:\/\//.test(e)){const n=s.get(e).set("Content-Type","blob");this.client.browser&&n.responseType("arraybuffer"),n.end((e,n)=>{return e?o(e):this.client.browser?i(a(n.xhr.response)):n.body instanceof t?i(n.body):o(new TypeError("Body is not a Buffer"))})}else{const t=n.resolve(e);r.stat(t,(e,n)=>{if(e&&o(e),!n||!n.isFile())throw new Error(`The file could not be found: ${t}`);r.readFile(t,(e,t)=>{e?o(e):i(t)})})}}):Promise.reject(new TypeError("The resource must be a string or Buffer."))}resolveEmojiIdentifier(e){return e instanceof d||e instanceof p?e.identifier:"string"!=typeof e||e.includes("%")?null:encodeURIComponent(e)}}e.exports=b}).call(t,i(58).Buffer)},function(e,t,i){(function(e,n){/*! - * The buffer module from node.js, for the browser. - * - * @author Feross Aboukhadijeh - * @license MIT - */ -"use strict";function r(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}function s(){return e.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function o(t,i){if(s()=s())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s().toString(16)+" bytes");return 0|e}function w(t){return+t!=t&&(t=0),e.alloc(+t)}function m(t,i){if(e.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var n=t.length;if(0===n)return 0;for(var r=!1;;)switch(i){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return W(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return Z(t).length;default:if(r)return W(t).length;i=(""+i).toLowerCase(),r=!0}}function g(e,t,i){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===i||i>this.length)&&(i=this.length),i<=0)return"";if(i>>>=0,t>>>=0,i<=t)return"";for(e||(e="utf8");;)switch(e){case"hex":return O(this,t,i);case"utf8":case"utf-8":return C(this,t,i);case"ascii":return x(this,t,i);case"latin1":case"binary":return I(this,t,i);case"base64":return R(this,t,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return N(this,t,i);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function _(e,t,i){var n=e[t];e[t]=e[i],e[i]=n}function v(t,i,n,r,s){if(0===t.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=s?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(s)return-1;n=t.length-1}else if(n<0){if(!s)return-1;n=0}if("string"==typeof i&&(i=e.from(i,r)),e.isBuffer(i))return 0===i.length?-1:k(t,i,n,r,s);if("number"==typeof i)return i&=255,e.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?s?Uint8Array.prototype.indexOf.call(t,i,n):Uint8Array.prototype.lastIndexOf.call(t,i,n):k(t,[i],n,r,s);throw new TypeError("val must be string, number or Buffer")}function k(e,t,i,n,r){function s(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}var o=1,a=e.length,l=t.length;if(void 0!==n&&(n=String(n).toLowerCase(),"ucs2"===n||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;o=2,a/=2,l/=2,i/=2}var f;if(r){var h=-1;for(f=i;fa&&(i=a-l),f=i;f>=0;f--){for(var u=!0,c=0;cr&&(n=r)):n=r;var s=t.length;if(s%2!==0)throw new TypeError("Invalid hex string");n>s/2&&(n=s/2);for(var o=0;o239?4:s>223?3:s>191?2:1;if(r+a<=i){var l,f,h,u;switch(a){case 1:s<128&&(o=s);break;case 2:l=e[r+1],128===(192&l)&&(u=(31&s)<<6|63&l,u>127&&(o=u));break;case 3:l=e[r+1],f=e[r+2],128===(192&l)&&128===(192&f)&&(u=(15&s)<<12|(63&l)<<6|63&f,u>2047&&(u<55296||u>57343)&&(o=u));break;case 4:l=e[r+1],f=e[r+2],h=e[r+3],128===(192&l)&&128===(192&f)&&128===(192&h)&&(u=(15&s)<<18|(63&l)<<12|(63&f)<<6|63&h,u>65535&&u<1114112&&(o=u))}}null===o?(o=65533,a=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|1023&o),n.push(o),r+=a}return P(n)}function P(e){var t=e.length;if(t<=ee)return String.fromCharCode.apply(String,e);for(var i="",n=0;nn)&&(i=n);for(var r="",s=t;si)throw new RangeError("Trying to access beyond buffer length")}function L(t,i,n,r,s,o){if(!e.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(i>s||it.length)throw new RangeError("Index out of range")}function U(e,t,i,n){t<0&&(t=65535+t+1);for(var r=0,s=Math.min(e.length-i,2);r>>8*(n?r:1-r)}function B(e,t,i,n){t<0&&(t=4294967295+t+1);for(var r=0,s=Math.min(e.length-i,4);r>>8*(n?r:3-r)&255}function j(e,t,i,n,r,s){if(i+n>e.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("Index out of range")}function F(e,t,i,n,r){return r||j(e,t,i,4,3.4028234663852886e38,-3.4028234663852886e38),J.write(e,t,i,n,23,4),i+4}function G(e,t,i,n,r){return r||j(e,t,i,8,1.7976931348623157e308,-1.7976931348623157e308),J.write(e,t,i,n,52,8),i+8}function H(e){if(e=z(e).replace(te,""),e.length<2)return"";for(;e.length%4!==0;)e+="=";return e}function z(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function q(e){return e<16?"0"+e.toString(16):e.toString(16)}function W(e,t){t=t||1/0;for(var i,n=e.length,r=null,s=[],o=0;o55295&&i<57344){if(!r){if(i>56319){(t-=3)>-1&&s.push(239,191,189);continue}if(o+1===n){(t-=3)>-1&&s.push(239,191,189);continue}r=i;continue}if(i<56320){(t-=3)>-1&&s.push(239,191,189),r=i;continue}i=(r-55296<<10|i-56320)+65536}else r&&(t-=3)>-1&&s.push(239,191,189);if(r=null,i<128){if((t-=1)<0)break;s.push(i)}else if(i<2048){if((t-=2)<0)break;s.push(i>>6|192,63&i|128)}else if(i<65536){if((t-=3)<0)break;s.push(i>>12|224,i>>6&63|128,63&i|128)}else{if(!(i<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;s.push(i>>18|240,i>>12&63|128,i>>6&63|128,63&i|128)}}return s}function V(e){for(var t=[],i=0;i>8,r=i%256,s.push(r),s.push(n);return s}function Z(e){return X.toByteArray(H(e))}function $(e,t,i,n){for(var r=0;r=t.length||r>=e.length);++r)t[r+i]=e[r];return r}function K(e){return e!==e}var X=i(59),J=i(60),Q=i(61);t.Buffer=e,t.SlowBuffer=w,t.INSPECT_MAX_BYTES=50,e.TYPED_ARRAY_SUPPORT=void 0!==n.TYPED_ARRAY_SUPPORT?n.TYPED_ARRAY_SUPPORT:r(),t.kMaxLength=s(),e.poolSize=8192,e._augment=function(t){return t.__proto__=e.prototype,t},e.from=function(e,t,i){return a(null,e,t,i)},e.TYPED_ARRAY_SUPPORT&&(e.prototype.__proto__=Uint8Array.prototype,e.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&e[Symbol.species]===e&&Object.defineProperty(e,Symbol.species,{value:null,configurable:!0})),e.alloc=function(e,t,i){return f(null,e,t,i)},e.allocUnsafe=function(e){return h(null,e)},e.allocUnsafeSlow=function(e){return h(null,e)},e.isBuffer=function(e){return!(null==e||!e._isBuffer)},e.compare=function(t,i){if(!e.isBuffer(t)||!e.isBuffer(i))throw new TypeError("Arguments must be Buffers");if(t===i)return 0;for(var n=t.length,r=i.length,s=0,o=Math.min(n,r);s0&&(e=this.toString("hex",0,i).match(/.{2}/g).join(" "),this.length>i&&(e+=" ... ")),""},e.prototype.compare=function(t,i,n,r,s){if(!e.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===i&&(i=0),void 0===n&&(n=t?t.length:0),void 0===r&&(r=0),void 0===s&&(s=this.length),i<0||n>t.length||r<0||s>this.length)throw new RangeError("out of range index");if(r>=s&&i>=n)return 0;if(r>=s)return-1;if(i>=n)return 1;if(i>>>=0,n>>>=0,r>>>=0,s>>>=0,this===t)return 0;for(var o=s-r,a=n-i,l=Math.min(o,a),f=this.slice(r,s),h=t.slice(i,n),u=0;ur)&&(i=r),e.length>0&&(i<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var s=!1;;)switch(n){case"hex":return y(this,e,t,i);case"utf8":case"utf-8":return E(this,e,t,i);case"ascii":return A(this,e,t,i);case"latin1":case"binary":return T(this,e,t,i);case"base64":return S(this,e,t,i);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return M(this,e,t,i);default:if(s)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),s=!0}},e.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var ee=4096;e.prototype.slice=function(t,i){var n=this.length;t=~~t,i=void 0===i?n:~~i,t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),i<0?(i+=n,i<0&&(i=0)):i>n&&(i=n),i0&&(r*=256);)n+=this[e+--t]*r;return n},e.prototype.readUInt8=function(e,t){return t||D(e,1,this.length),this[e]},e.prototype.readUInt16LE=function(e,t){return t||D(e,2,this.length),this[e]|this[e+1]<<8},e.prototype.readUInt16BE=function(e,t){return t||D(e,2,this.length),this[e]<<8|this[e+1]},e.prototype.readUInt32LE=function(e,t){return t||D(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},e.prototype.readUInt32BE=function(e,t){return t||D(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},e.prototype.readIntLE=function(e,t,i){e|=0,t|=0,i||D(e,t,this.length);for(var n=this[e],r=1,s=0;++s=r&&(n-=Math.pow(2,8*t)),n},e.prototype.readIntBE=function(e,t,i){e|=0,t|=0,i||D(e,t,this.length);for(var n=t,r=1,s=this[e+--n];n>0&&(r*=256);)s+=this[e+--n]*r;return r*=128,s>=r&&(s-=Math.pow(2,8*t)),s},e.prototype.readInt8=function(e,t){return t||D(e,1,this.length),128&this[e]?(255-this[e]+1)*-1:this[e]},e.prototype.readInt16LE=function(e,t){t||D(e,2,this.length);var i=this[e]|this[e+1]<<8;return 32768&i?4294901760|i:i},e.prototype.readInt16BE=function(e,t){t||D(e,2,this.length);var i=this[e+1]|this[e]<<8;return 32768&i?4294901760|i:i},e.prototype.readInt32LE=function(e,t){return t||D(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},e.prototype.readInt32BE=function(e,t){return t||D(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},e.prototype.readFloatLE=function(e,t){return t||D(e,4,this.length),J.read(this,e,!0,23,4)},e.prototype.readFloatBE=function(e,t){return t||D(e,4,this.length),J.read(this,e,!1,23,4)},e.prototype.readDoubleLE=function(e,t){return t||D(e,8,this.length),J.read(this,e,!0,52,8)},e.prototype.readDoubleBE=function(e,t){return t||D(e,8,this.length),J.read(this,e,!1,52,8)},e.prototype.writeUIntLE=function(e,t,i,n){if(e=+e,t|=0,i|=0,!n){var r=Math.pow(2,8*i)-1;L(this,e,t,i,r,0)}var s=1,o=0;for(this[t]=255&e;++o=0&&(o*=256);)this[t+s]=e/o&255;return t+i},e.prototype.writeUInt8=function(t,i,n){return t=+t,i|=0,n||L(this,t,i,1,255,0),e.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[i]=255&t,i+1},e.prototype.writeUInt16LE=function(t,i,n){return t=+t,i|=0,n||L(this,t,i,2,65535,0),e.TYPED_ARRAY_SUPPORT?(this[i]=255&t,this[i+1]=t>>>8):U(this,t,i,!0),i+2},e.prototype.writeUInt16BE=function(t,i,n){return t=+t,i|=0,n||L(this,t,i,2,65535,0),e.TYPED_ARRAY_SUPPORT?(this[i]=t>>>8,this[i+1]=255&t):U(this,t,i,!1),i+2},e.prototype.writeUInt32LE=function(t,i,n){return t=+t,i|=0,n||L(this,t,i,4,4294967295,0),e.TYPED_ARRAY_SUPPORT?(this[i+3]=t>>>24,this[i+2]=t>>>16,this[i+1]=t>>>8,this[i]=255&t):B(this,t,i,!0),i+4},e.prototype.writeUInt32BE=function(t,i,n){return t=+t,i|=0,n||L(this,t,i,4,4294967295,0),e.TYPED_ARRAY_SUPPORT?(this[i]=t>>>24,this[i+1]=t>>>16,this[i+2]=t>>>8,this[i+3]=255&t):B(this,t,i,!1),i+4},e.prototype.writeIntLE=function(e,t,i,n){if(e=+e,t|=0,!n){var r=Math.pow(2,8*i-1);L(this,e,t,i,r-1,-r)}var s=0,o=1,a=0;for(this[t]=255&e;++s>0)-a&255;return t+i},e.prototype.writeIntBE=function(e,t,i,n){if(e=+e,t|=0,!n){var r=Math.pow(2,8*i-1);L(this,e,t,i,r-1,-r)}var s=i-1,o=1,a=0;for(this[t+s]=255&e;--s>=0&&(o*=256);)e<0&&0===a&&0!==this[t+s+1]&&(a=1),this[t+s]=(e/o>>0)-a&255;return t+i},e.prototype.writeInt8=function(t,i,n){return t=+t,i|=0,n||L(this,t,i,1,127,-128),e.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[i]=255&t,i+1},e.prototype.writeInt16LE=function(t,i,n){return t=+t,i|=0,n||L(this,t,i,2,32767,-32768),e.TYPED_ARRAY_SUPPORT?(this[i]=255&t,this[i+1]=t>>>8):U(this,t,i,!0),i+2},e.prototype.writeInt16BE=function(t,i,n){return t=+t,i|=0,n||L(this,t,i,2,32767,-32768),e.TYPED_ARRAY_SUPPORT?(this[i]=t>>>8,this[i+1]=255&t):U(this,t,i,!1),i+2},e.prototype.writeInt32LE=function(t,i,n){return t=+t,i|=0,n||L(this,t,i,4,2147483647,-2147483648),e.TYPED_ARRAY_SUPPORT?(this[i]=255&t,this[i+1]=t>>>8,this[i+2]=t>>>16,this[i+3]=t>>>24):B(this,t,i,!0),i+4},e.prototype.writeInt32BE=function(t,i,n){return t=+t,i|=0,n||L(this,t,i,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),e.TYPED_ARRAY_SUPPORT?(this[i]=t>>>24,this[i+1]=t>>>16,this[i+2]=t>>>8,this[i+3]=255&t):B(this,t,i,!1),i+4},e.prototype.writeFloatLE=function(e,t,i){return F(this,e,t,!0,i)},e.prototype.writeFloatBE=function(e,t,i){return F(this,e,t,!1,i)},e.prototype.writeDoubleLE=function(e,t,i){return G(this,e,t,!0,i)},e.prototype.writeDoubleBE=function(e,t,i){return G(this,e,t,!1,i)},e.prototype.copy=function(t,i,n,r){if(n||(n=0),r||0===r||(r=this.length),i>=t.length&&(i=t.length),i||(i=0),r>0&&r=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),t.length-i=0;--s)t[s+i]=this[s+n];else if(o<1e3||!e.TYPED_ARRAY_SUPPORT)for(s=0;s>>=0,n=void 0===n?this.length:n>>>0,t||(t=0);var o;if("number"==typeof t)for(o=i;o0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===e[t-2]?2:"="===e[t-1]?1:0}function n(e){return 3*e.length/4-i(e)}function r(e){var t,n,r,s,o,a,l=e.length;o=i(e),a=new h(3*l/4-o),r=o>0?l-4:l;var u=0;for(t=0,n=0;t>16&255,a[u++]=s>>8&255,a[u++]=255&s;return 2===o?(s=f[e.charCodeAt(t)]<<2|f[e.charCodeAt(t+1)]>>4,a[u++]=255&s):1===o&&(s=f[e.charCodeAt(t)]<<10|f[e.charCodeAt(t+1)]<<4|f[e.charCodeAt(t+2)]>>2,a[u++]=s>>8&255,a[u++]=255&s),a}function s(e){return l[e>>18&63]+l[e>>12&63]+l[e>>6&63]+l[63&e]}function o(e,t,i){for(var n,r=[],o=t;oh?h:f+a));return 1===n?(t=e[i-1],r+=l[t>>2],r+=l[t<<4&63],r+="=="):2===n&&(t=(e[i-2]<<8)+e[i-1],r+=l[t>>10],r+=l[t>>4&63],r+=l[t<<2&63],r+="="),s.push(r),s.join("")}t.byteLength=n,t.toByteArray=r,t.fromByteArray=a;for(var l=[],f=[],h="undefined"!=typeof Uint8Array?Uint8Array:Array,u="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",c=0,d=u.length;c>1,h=-7,u=i?r-1:0,c=i?-1:1,d=e[t+u];for(u+=c,s=d&(1<<-h)-1,d>>=-h,h+=a;h>0;s=256*s+e[t+u],u+=c,h-=8);for(o=s&(1<<-h)-1,s>>=-h,h+=n;h>0;o=256*o+e[t+u],u+=c,h-=8);if(0===s)s=1-f;else{if(s===l)return o?NaN:(d?-1:1)*(1/0);o+=Math.pow(2,n),s-=f}return(d?-1:1)*o*Math.pow(2,s-n)},t.write=function(e,t,i,n,r,s){var o,a,l,f=8*s-r-1,h=(1<>1,c=23===r?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:s-1,p=n?1:-1,b=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,o=h):(o=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-o))<1&&(o--,l*=2),t+=o+u>=1?c/l:c*Math.pow(2,1-u),t*l>=2&&(o++,l/=2),o+u>=h?(a=0,o=h):o+u>=1?(a=(t*l-1)*Math.pow(2,r),o+=u):(a=t*Math.pow(2,u-1)*Math.pow(2,r),o=0));r>=8;e[i+d]=255&a,d+=p,a/=256,r-=8);for(o=o<0;e[i+d]=255&o,d+=p,o/=256,f-=8);e[i+d-p]|=128*b}},function(e,t){var i={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==i.call(e)}},function(e,t){},function(e,t,i){(function(t){function i(e){const i=new t(e.byteLength),n=new Uint8Array(e);for(var r=0;r{if(this.client.browser)throw new Error("Voice connections are not available in browsers.");if(this.pending.get(e.guild.id))throw new Error("Already connecting to this guild's voice server.");if(!e.joinable)throw new Error("You do not have permission to join this voice channel.");const n=this.connections.get(e.guild.id);if(n)return n.channel.id!==e.id&&(this.sendVoiceStateUpdate(e),this.connections.get(e.guild.id).channel=e),void t(n);const r=new f(this,e);this.pending.set(e.guild.id,r),r.on("fail",t=>{this.pending.delete(e.guild.id),i(t)}),r.on("pass",n=>{this.pending.delete(e.guild.id),this.connections.set(e.guild.id,n),n.once("ready",()=>t(n)),n.once("error",i),n.once("disconnect",()=>this.connections.delete(e.guild.id))})})}}class f extends a{constructor(e,t){super(),this.voiceManager=e,this.channel=t,this.deathTimer=this.voiceManager.client.setTimeout(()=>this.fail(new Error("Connection not established within 15 seconds.")),15e3),this.data={},this.sendVoiceStateUpdate()}checkReady(){return!!(this.data.token&&this.data.endpoint&&this.data.session_id)&&(this.pass(),!0)}setTokenAndEndpoint(e,t){return e?t?this.data.token?void this.fail(new Error("There is already a registered token for this connection.")):this.data.endpoint?void this.fail(new Error("There is already a registered endpoint for this connection.")):(t=t.match(/([^:]*)/)[0])?(this.data.token=e,this.data.endpoint=t,void this.checkReady()):void this.fail(new Error("Failed to find an endpoint.")):void this.fail(new Error("Endpoint not provided from voice server packet.")):void this.fail(new Error("Token not provided from voice server packet."))}setSessionID(e){return e?this.data.session_id?void this.fail(new Error("There is already a registered session ID for this connection.")):(this.data.session_id=e,void this.checkReady()):void this.fail(new Error("Session ID not supplied."))}clean(){clearInterval(this.deathTimer),this.emit("fail",new Error("Clean-up triggered :fourTriggered:"))}pass(){clearInterval(this.deathTimer),this.emit("pass",this.upgrade())}fail(e){this.emit("fail",e),this.clean()}sendVoiceStateUpdate(){try{this.voiceManager.sendVoiceStateUpdate(this.channel)}catch(e){this.fail(e)}}upgrade(){return new o(this)}}e.exports=l},function(e,t,i){const n=i(66),r=i(159),s=i(5),o=i(161),a=i(174),l=i(3).EventEmitter,f=i(62);class h extends l{constructor(e){super(),this.voiceManager=e.voiceManager,this.channel=e.channel,this.speaking=!1,this.receivers=[],this.authentication=e.data,this.player=new o(this),this.player.on("debug",e=>{this.emit("debug",`audio player - ${e}`)}),this.player.on("error",e=>{this.emit("warn",e),this.player.cleanup()}),this.ssrcMap=new Map,this.ready=!1,this.sockets={},this.connect()}setSpeaking(e){this.speaking!==e&&(this.speaking=e,this.sockets.ws.sendPacket({op:s.VoiceOPCodes.SPEAKING,d:{speaking:!0,delay:0}}).catch(e=>{this.emit("debug",e)}))}disconnect(){this.emit("closing"),this.voiceManager.client.ws.send({op:s.OPCodes.VOICE_STATE_UPDATE,d:{guild_id:this.channel.guild.id,channel_id:null,self_mute:!1,self_deaf:!1}}),this.emit("disconnect")}connect(){if(this.sockets.ws)throw new Error("There is already an existing WebSocket connection.");if(this.sockets.udp)throw new Error("There is already an existing UDP connection.");this.sockets.ws=new n(this),this.sockets.udp=new r(this),this.sockets.ws.on("error",e=>this.emit("error",e)),this.sockets.udp.on("error",e=>this.emit("error",e)),this.sockets.ws.once("ready",e=>{this.authentication.port=e.port,this.authentication.ssrc=e.ssrc,this.sockets.udp.findEndpointAddress().then(e=>{this.sockets.udp.createUDPSocket(e)},e=>this.emit("error",e))}),this.sockets.ws.once("sessionDescription",(e,t)=>{this.authentication.encryptionMode=e,this.authentication.secretKey=t,this.emit("ready"),this.ready=!0}),this.sockets.ws.on("speaking",e=>{const t=this.channel.guild,i=this.voiceManager.client.users.get(e.user_id);if(this.ssrcMap.set(+e.ssrc,i),!e.speaking)for(const n of this.receivers){const e=n.opusStreams.get(i.id),t=n.pcmStreams.get(i.id);e&&(e.push(null),e.open=!1,n.opusStreams.delete(i.id)),t&&(t.push(null),t.open=!1,n.pcmStreams.delete(i.id))}this.ready&&this.emit("speaking",i,e.speaking),t._memberSpeakUpdate(e.user_id,e.speaking)})}playFile(e,t){return this.playStream(f.createReadStream(e),t)}playStream(e,{seek=0,volume=1,passes=1}={}){const t={seek:seek,volume:volume,passes:passes};return this.player.playUnknownStream(e,t)}playConvertedStream(e,{seek=0,volume=1,passes=1}={}){const t={seek:seek,volume:volume,passes:passes};return this.player.playPCMStream(e,t)}createReceiver(){const e=new a(this);return this.receivers.push(e),e}}e.exports=h},function(e,t,i){const n=i(67),r=i(5),s=i(158),o=i(3).EventEmitter;class a extends o{constructor(e){super(),this.voiceConnection=e,this.attempts=0,this.connect(),this.dead=!1,this.voiceConnection.on("closing",this.shutdown.bind(this))}shutdown(){this.dead=!0,this.reset()}get client(){return this.voiceConnection.voiceManager.client}reset(){this.ws&&(this.ws.readyState!==n.CLOSED&&this.ws.close(),this.ws=null),this.clearHeartbeat()}connect(){if(!this.dead){if(this.ws&&this.reset(),this.attempts>5)return void this.emit("error",new Error(`Too many connection attempts (${this.attempts}).`));this.attempts++,this.ws=new n(`wss://${this.voiceConnection.authentication.endpoint}`),this.ws.onopen=this.onOpen.bind(this),this.ws.onmessage=this.onMessage.bind(this),this.ws.onclose=this.onClose.bind(this),this.ws.onerror=this.onError.bind(this)}}send(e){return new Promise((t,i)=>{if(!this.ws||this.ws.readyState!==n.OPEN)throw new Error(`Voice websocket not open to send ${e}.`);this.ws.send(e,null,n=>{n?i(n):t(e)})})}sendPacket(e){try{e=JSON.stringify(e)}catch(e){return Promise.reject(e)}return this.send(e)}onOpen(){this.sendPacket({op:r.OPCodes.DISPATCH,d:{server_id:this.voiceConnection.channel.guild.id,user_id:this.client.user.id,token:this.voiceConnection.authentication.token,session_id:this.voiceConnection.authentication.session_id}}).catch(()=>{this.emit("error",new Error("Tried to send join packet, but the WebSocket is not open."))})}onMessage(e){try{return this.onPacket(JSON.parse(e.data))}catch(e){return this.onError(e)}}onClose(){this.dead||this.client.setTimeout(this.connect.bind(this),1e3*this.attempts)}onError(e){this.emit("error",e)}onPacket(e){switch(e.op){case r.VoiceOPCodes.READY:this.setHeartbeat(e.d.heartbeat_interval),this.emit("ready",e.d);break;case r.VoiceOPCodes.SESSION_DESCRIPTION:this.emit("sessionDescription",e.d.mode,new s(e.d.secret_key));break;case r.VoiceOPCodes.SPEAKING:this.emit("speaking",e.d);break;default:this.emit("unknownPacket",e)}}setHeartbeat(e){return!e||isNaN(e)?void this.onError(new Error("Tried to set voice heartbeat but no valid interval was specified.")):(this.heartbeatInterval&&(this.emit("warn","A voice heartbeat interval is being overwritten"),clearInterval(this.heartbeatInterval)),void(this.heartbeatInterval=this.client.setInterval(this.sendHeartbeat.bind(this),e)))}clearHeartbeat(){return this.heartbeatInterval?(clearInterval(this.heartbeatInterval),void(this.heartbeatInterval=null)):void this.emit("warn","Tried to clear a heartbeat interval that does not exist")}sendHeartbeat(){this.sendPacket({op:r.VoiceOPCodes.HEARTBEAT,d:null}).catch(()=>{this.emit("warn","Tried to send heartbeat, but connection is not open"),this.clearHeartbeat()})}}e.exports=a},function(e,t,i){"use strict";/*! - * ws: a node.js websocket client - * Copyright(c) 2011 Einar Otto Stangvik - * MIT Licensed - */ -var n=e.exports=i(68);n.Server=i(156),n.Sender=i(116),n.Receiver=i(147),n.createServer=function(e,t){var i=new n.Server(e);return"function"==typeof t&&i.on("connection",t),i},n.connect=n.createConnection=function(e,t){var i=new n(e);return"function"==typeof t&&i.on("open",t),i}},function(e,t,i){(function(t,n){"use strict";function r(e,t,i){return this instanceof r==!1?new r(e,t,i):(P.call(this),t&&!Array.isArray(t)&&"object"==typeof t&&(i=t,t=null),"string"==typeof t&&(t=[t]),Array.isArray(t)||(t=[]),this._socket=null,this._ultron=null,this._closeReceived=!1,this.bytesReceived=0,this.readyState=null,this.supports={},this.extensions={},this._binaryType="nodebuffer",void(Array.isArray(e)?f.apply(this,e.concat(i)):h.apply(this,[e,t,i])))}function s(e,t,i){this.type="message",this.data=e,this.target=i,this.binary=t}function o(e,t,i){this.type="close",this.wasClean="undefined"==typeof e||1e3===e,this.code=e,this.reason=t,this.target=i}function a(e){this.type="open",this.target=e}function l(e,t,i){var n=t;return t&&(e&&443!=i||!e&&80!=i)&&(n=n+":"+i),n}function f(e,t,i,n){n=new E({protocolVersion:x,protocol:null,extensions:{},maxPayload:0}).merge(n),this.protocol=n.value.protocol,this.protocolVersion=n.value.protocolVersion,this.extensions=n.value.extensions,this.supports.binary="hixie-76"!==this.protocolVersion,this.upgradeReq=e,this.readyState=r.CONNECTING,this._isServer=!0,this.maxPayload=n.value.maxPayload,"hixie-76"===n.value.protocolVersion?u.call(this,M,S,t,i):u.call(this,T,A,t,i)}function h(e,i,n){if(n=new E({origin:null,protocolVersion:x,host:null,headers:null,protocol:i.join(","),agent:null,pfx:null,key:null,passphrase:null,cert:null,ca:null,ciphers:null,rejectUnauthorized:null,perMessageDeflate:!0,localAddress:null}).merge(n),8!==n.value.protocolVersion&&13!==n.value.protocolVersion)throw new Error("unsupported protocol version");var s=w.parse(e),o="ws+unix:"===s.protocol;if(!s.host&&!o)throw new Error("invalid url");var a,f="wss:"===s.protocol||"https:"===s.protocol,h=f?_:g,c=s.port||(f?443:80),d=s.auth,p={};n.value.perMessageDeflate&&(a=new C(typeof n.value.perMessageDeflate!==!0?n.value.perMessageDeflate:{},!1),p[C.extensionName]=a.offer()),this._isServer=!1,this.url=e,this.protocolVersion=n.value.protocolVersion,this.supports.binary="hixie-76"!==this.protocolVersion;var m=new t(n.value.protocolVersion+"-"+Date.now()).toString("base64"),k=v.createHash("sha1");k.update(m+"258EAFA5-E914-47DA-95CA-C5AB0DC85B11");var y=k.digest("base64"),S=n.value.agent,M=l(f,s.hostname,c),P={port:c,host:s.hostname,headers:{Connection:"Upgrade",Upgrade:"websocket",Host:M,"Sec-WebSocket-Version":n.value.protocolVersion,"Sec-WebSocket-Key":m}};if(d&&(P.headers.Authorization="Basic "+new t(d).toString("base64")),n.value.protocol&&(P.headers["Sec-WebSocket-Protocol"]=n.value.protocol),n.value.host&&(P.headers.Host=n.value.host),n.value.headers)for(var I in n.value.headers)n.value.headers.hasOwnProperty(I)&&(P.headers[I]=n.value.headers[I]);Object.keys(p).length&&(P.headers["Sec-WebSocket-Extensions"]=R.format(p)),(n.isDefinedAndNonNull("pfx")||n.isDefinedAndNonNull("key")||n.isDefinedAndNonNull("passphrase")||n.isDefinedAndNonNull("cert")||n.isDefinedAndNonNull("ca")||n.isDefinedAndNonNull("ciphers")||n.isDefinedAndNonNull("rejectUnauthorized"))&&(n.isDefinedAndNonNull("pfx")&&(P.pfx=n.value.pfx),n.isDefinedAndNonNull("key")&&(P.key=n.value.key),n.isDefinedAndNonNull("passphrase")&&(P.passphrase=n.value.passphrase),n.isDefinedAndNonNull("cert")&&(P.cert=n.value.cert),n.isDefinedAndNonNull("ca")&&(P.ca=n.value.ca),n.isDefinedAndNonNull("ciphers")&&(P.ciphers=n.value.ciphers),n.isDefinedAndNonNull("rejectUnauthorized")&&(P.rejectUnauthorized=n.value.rejectUnauthorized),S||(S=new h.Agent(P))),P.path=s.path||"/",S&&(P.agent=S),o&&(P.socketPath=s.pathname),n.value.localAddress&&(P.localAddress=n.value.localAddress),n.value.origin&&(n.value.protocolVersion<13?P.headers["Sec-WebSocket-Origin"]=n.value.origin:P.headers.Origin=n.value.origin);var O=this,N=h.request(P);N.on("error",function(e){O.emit("error",e),b.call(O,e)}),N.once("response",function(e){var t;O.emit("unexpected-response",N,e)||(t=new Error("unexpected server response ("+e.statusCode+")"),N.abort(),O.emit("error",t)),b.call(O,t)}),N.once("upgrade",function(e,t,i){if(O.readyState===r.CLOSED)return O.emit("close"),O.removeAllListeners(),void t.end();var s=e.headers["sec-websocket-accept"];if("undefined"==typeof s||s!==y)return O.emit("error","invalid server key"),O.removeAllListeners(),void t.end();var o=e.headers["sec-websocket-protocol"],l=(n.value.protocol||"").split(/, */),f=null;if(!n.value.protocol&&o?f="server sent a subprotocol even though none requested":n.value.protocol&&!o?f="server sent no subprotocol even though requested":o&&l.indexOf(o)===-1&&(f="server responded with an invalid protocol"),f)return O.emit("error",f),O.removeAllListeners(),void t.end();o&&(O.protocol=o);var h=R.parse(e.headers["sec-websocket-extensions"]);if(a&&h[C.extensionName]){try{a.accept(h[C.extensionName])}catch(e){return O.emit("error","invalid extension parameter"),O.removeAllListeners(),void t.end()}O.extensions[C.extensionName]=a}u.call(O,T,A,t,i),N.removeAllListeners(),N=null,S=null}),N.end(),this.readyState=r.CONNECTING}function u(e,t,i,s){function o(e){f||h.readyState===r.CLOSED||(f=!0,i.removeListener("data",o),l.on("data",a),s&&s.length>0&&(a(s),s=null),e&&a(e))}function a(e){h.bytesReceived+=e.length,h._receiver.add(e)}var l=this._ultron=new y(i),f=!1,h=this;i.setTimeout(0),i.setNoDelay(!0),this._receiver=new e(this.extensions,this.maxPayload),this._socket=i,l.on("end",b.bind(this)),l.on("close",b.bind(this)),l.on("error",b.bind(this)),l.on("data",o),n.nextTick(o),h._receiver.ontext=function(e,t){t=t||{},h.emit("message",e,t)},h._receiver.onbinary=function(e,t){t=t||{},t.binary=!0,h.emit("message",e,t)},h._receiver.onping=function(e,t){t=t||{},h.pong(e,{mask:!h._isServer,binary:t.binary===!0},!0),h.emit("ping",e,t)},h._receiver.onpong=function(e,t){h.emit("pong",e,t||{})},h._receiver.onclose=function(e,t,i){i=i||{},h._closeReceived=!0,h.close(e,t)},h._receiver.onerror=function(e,t){h.close("undefined"!=typeof t?t:1002,""),h.emit("error",e instanceof Error?e:new Error(e))},this._sender=new t(i,this.extensions),this._sender.on("error",function(e){h.close(1002,""),h.emit("error",e)}),this.readyState=r.OPEN,this.emit("open")}function c(e){e._queue=e._queue||[]}function d(e){var t=e._queue;if("undefined"!=typeof t){delete e._queue;for(var i=0,n=t.length;i - * MIT Licensed - */ -var w=i(69),m=i(75),g=i(78),_=i(98),v=i(99),k=i(80),y=i(114),E=i(115),A=i(116),T=i(147),S=i(153),M=i(154),R=i(155),C=i(125),P=i(3).EventEmitter,x=13,I=3e4;m.inherits(r,P),["CONNECTING","OPEN","CLOSING","CLOSED"].forEach(function(e,t){r.prototype[e]=r[e]=t}),r.prototype.close=function(e,t){if(this.readyState!==r.CLOSED){if(this.readyState===r.CONNECTING)return void(this.readyState=r.CLOSED);if(this.readyState===r.CLOSING)return void(this._closeReceived&&this._isServer&&this.terminate());var i=this;try{this.readyState=r.CLOSING,this._closeCode=e,this._closeMessage=t;var n=!this._isServer;this._sender.close(e,t,n,function(e){e&&i.emit("error",e),i._closeReceived&&i._isServer?i.terminate():(clearTimeout(i._closeTimer),i._closeTimer=setTimeout(b.bind(i,!0),I))})}catch(e){this.emit("error",e)}}},r.prototype.pause=function(){if(this.readyState!==r.OPEN)throw new Error("not opened");return this._socket.pause()},r.prototype.ping=function(e,t,i){if(this.readyState!==r.OPEN){if(i===!0)return;throw new Error("not opened")}t=t||{},"undefined"==typeof t.mask&&(t.mask=!this._isServer),this._sender.ping(e,t)},r.prototype.pong=function(e,t,i){if(this.readyState!==r.OPEN){if(i===!0)return;throw new Error("not opened")}t=t||{},"undefined"==typeof t.mask&&(t.mask=!this._isServer),this._sender.pong(e,t)},r.prototype.resume=function(){if(this.readyState!==r.OPEN)throw new Error("not opened");return this._socket.resume()},r.prototype.send=function(e,i,s){if("function"==typeof i&&(s=i,i={}),this.readyState!==r.OPEN){if("function"!=typeof s)throw new Error("not opened");return void s(new Error("not opened"))}if(e||(e=""),this._queue){var o=this;return void this._queue.push(function(){o.send(e,i,s)})}i=i||{},i.fin=!0,"undefined"==typeof i.binary&&(i.binary=e instanceof ArrayBuffer||e instanceof t||e instanceof Uint8Array||e instanceof Uint16Array||e instanceof Uint32Array||e instanceof Int8Array||e instanceof Int16Array||e instanceof Int32Array||e instanceof Float32Array||e instanceof Float64Array),"undefined"==typeof i.mask&&(i.mask=!this._isServer),"undefined"==typeof i.compress&&(i.compress=!0),this.extensions[C.extensionName]||(i.compress=!1);var a="function"==typeof k.Readable?k.Readable:k.Stream;if(e instanceof a){c(this);var o=this;p(this,e,i,function(e){n.nextTick(function(){d(o)}),"function"==typeof s&&s(e)})}else this._sender.send(e,i,s)},r.prototype.stream=function(e,t){function i(o,a){try{if(s.readyState!==r.OPEN)throw new Error("not opened");e.fin=a===!0,s._sender.send(o,e),a?d(s):n.nextTick(t.bind(null,null,i))}catch(e){"function"==typeof t?t(e):(delete s._queue,s.emit("error",e))}}"function"==typeof e&&(t=e,e={});var s=this;if("function"!=typeof t)throw new Error("callback must be provided");if(this.readyState!==r.OPEN){if("function"!=typeof t)throw new Error("not opened");return void t(new Error("not opened"))}return this._queue?void this._queue.push(function(){s.stream(e,t)}):(e=e||{},"undefined"==typeof e.mask&&(e.mask=!this._isServer),"undefined"==typeof e.compress&&(e.compress=!0),this.extensions[C.extensionName]||(e.compress=!1),c(this),void n.nextTick(t.bind(null,null,i)))},r.prototype.terminate=function(){if(this.readyState!==r.CLOSED)if(this._socket){this.readyState=r.CLOSING;try{this._socket.end()}catch(e){return void b.call(this,!0)}this._closeTimer&&clearTimeout(this._closeTimer),this._closeTimer=setTimeout(b.bind(this,!0),I)}else this.readyState===r.CONNECTING&&b.call(this,!0)},Object.defineProperty(r.prototype,"bufferedAmount",{get:function(){var e=0;return this._socket&&(e=this._socket.bufferSize||0),e}}),Object.defineProperty(r.prototype,"binaryType",{get:function(){return this._binaryType},set:function(e){if("arraybuffer"!==e&&"nodebuffer"!==e)throw new SyntaxError('unsupported binaryType: must be either "nodebuffer" or "arraybuffer"');this._binaryType=e}}),["open","error","close","message"].forEach(function(e){Object.defineProperty(r.prototype,"on"+e,{get:function(){var t=this.listeners(e)[0];return t?t._listener?t._listener:t:void 0},set:function(t){this.removeAllListeners(e),this.addEventListener(e,t)}})}),r.prototype.addEventListener=function(e,t){function i(e,i){i.binary&&"arraybuffer"===this.binaryType&&(e=new Uint8Array(e).buffer),t.call(f,new s(e,!!i.binary,f))}function n(e,i){t.call(f,new o(e,i,f))}function r(e){e.type="error",e.target=f,t.call(f,e)}function l(){t.call(f,new a(f))}var f=this;"function"==typeof t&&("message"===e?(i._listener=t,this.on(e,i)):"close"===e?(n._listener=t,this.on(e,n)):"error"===e?(r._listener=t,this.on(e,r)):"open"===e?(l._listener=t,this.on(e,l)):this.on(e,t))},e.exports=r,e.exports.buildHostHeader=l}).call(t,i(58).Buffer,i(2))},function(e,t,i){function n(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}function r(e,t,i){if(e&&f(e)&&e instanceof n)return e;var r=new n;return r.parse(e,t,i),r}function s(e){return l(e)&&(e=r(e)),e instanceof n?e.format():n.prototype.format.call(e)}function o(e,t){return r(e,!1,!0).resolve(t)}function a(e,t){return e?r(e,!1,!0).resolveObject(t):t}function l(e){return"string"==typeof e}function f(e){return"object"==typeof e&&null!==e}function h(e){return null===e}function u(e){return null==e}var c=i(70);t.parse=r,t.resolve=o,t.resolveObject=a,t.format=s,t.Url=n;var d=/^([a-z0-9.+-]+:)/i,p=/:[0-9]*$/,b=["<",">",'"',"`"," ","\r","\n","\t"],w=["{","}","|","\\","^","`"].concat(b),m=["'"].concat(w),g=["%","/","?",";","#"].concat(m),_=["/","?","#"],v=255,k=/^[a-z0-9A-Z_-]{0,63}$/,y=/^([a-z0-9A-Z_-]{0,63})(.*)$/,E={javascript:!0,"javascript:":!0},A={javascript:!0,"javascript:":!0},T={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},S=i(72);n.prototype.parse=function(e,t,i){if(!l(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var n=e;n=n.trim();var r=d.exec(n);if(r){r=r[0];var s=r.toLowerCase();this.protocol=s,n=n.substr(r.length)}if(i||r||n.match(/^\/\/[^@\/]+@[^@\/]+/)){var o="//"===n.substr(0,2);!o||r&&A[r]||(n=n.substr(2),this.slashes=!0)}if(!A[r]&&(o||r&&!T[r])){for(var a=-1,f=0;f<_.length;f++){var h=n.indexOf(_[f]);h!==-1&&(a===-1||h127?"x":R[P];if(!C.match(k)){var I=w.slice(0,f),O=w.slice(f+1),N=R.match(y);N&&(I.push(N[1]),O.unshift(N[2])),O.length&&(n="/"+O.join(".")+n),this.hostname=I.join(".");break}}}if(this.hostname.length>v?this.hostname="":this.hostname=this.hostname.toLowerCase(),!b){for(var D=this.hostname.split("."),L=[],f=0;f0)&&i.host.split("@");w&&(i.auth=w.shift(),i.host=i.hostname=w.shift())}return i.search=e.search,i.query=e.query,h(i.pathname)&&h(i.search)||(i.path=(i.pathname?i.pathname:"")+(i.search?i.search:"")),i.href=i.format(),i}if(!p.length)return i.pathname=null,i.search?i.path="/"+i.search:i.path=null,i.href=i.format(),i;for(var m=p.slice(-1)[0],g=(i.host||e.host)&&("."===m||".."===m)||""===m,_=0,v=p.length;v>=0;v--)m=p[v],"."==m?p.splice(v,1):".."===m?(p.splice(v,1),_++):_&&(p.splice(v,1),_--);if(!c&&!d)for(;_--;_)p.unshift("..");!c||""===p[0]||p[0]&&"/"===p[0].charAt(0)||p.unshift(""),g&&"/"!==p.join("/").substr(-1)&&p.push("");var k=""===p[0]||p[0]&&"/"===p[0].charAt(0);if(b){i.hostname=i.host=k?"":p.length?p.shift():"";var w=!!(i.host&&i.host.indexOf("@")>0)&&i.host.split("@");w&&(i.auth=w.shift(),i.host=i.hostname=w.shift())}return c=c||i.host&&p.length,c&&!k&&p.unshift(""),p.length?i.pathname=p.join("/"):(i.pathname=null,i.path=null),h(i.pathname)&&h(i.search)||(i.path=(i.pathname?i.pathname:"")+(i.search?i.search:"")),i.auth=e.auth||i.auth,i.slashes=i.slashes||e.slashes,i.href=i.format(),i},n.prototype.parseHost=function(){var e=this.host,t=p.exec(e);t&&(t=t[0],":"!==t&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)}},function(e,t,i){var n;(function(e,r){!function(s){function o(e){throw RangeError(I[e])}function a(e,t){for(var i=e.length,n=[];i--;)n[i]=t(e[i]);return n}function l(e,t){var i=e.split("@"),n="";i.length>1&&(n=i[0]+"@",e=i[1]),e=e.replace(x,".");var r=e.split("."),s=a(r,t).join(".");return n+s}function f(e){for(var t,i,n=[],r=0,s=e.length;r=55296&&t<=56319&&r65535&&(e-=65536,t+=D(e>>>10&1023|55296),e=56320|1023&e),t+=D(e)}).join("")}function u(e){return e-48<10?e-22:e-65<26?e-65:e-97<26?e-97:k}function c(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function d(e,t,i){var n=0;for(e=i?N(e/T):e>>1,e+=N(e/t);e>O*E>>1;n+=k)e=N(e/O);return N(n+(O+1)*e/(e+A))}function p(e){var t,i,n,r,s,a,l,f,c,p,b=[],w=e.length,m=0,g=M,_=S;for(i=e.lastIndexOf(R),i<0&&(i=0),n=0;n=128&&o("not-basic"),b.push(e.charCodeAt(n));for(r=i>0?i+1:0;r=w&&o("invalid-input"),f=u(e.charCodeAt(r++)),(f>=k||f>N((v-m)/a))&&o("overflow"),m+=f*a,c=l<=_?y:l>=_+E?E:l-_,!(fN(v/p)&&o("overflow"),a*=p;t=b.length+1,_=d(m-s,t,0==s),N(m/t)>v-g&&o("overflow"),g+=N(m/t),m%=t,b.splice(m++,0,g)}return h(b)}function b(e){var t,i,n,r,s,a,l,h,u,p,b,w,m,g,_,A=[];for(e=f(e),w=e.length,t=M,i=0,s=S,a=0;a=t&&bN((v-i)/m)&&o("overflow"),i+=(l-t)*m,t=l,a=0;av&&o("overflow"),b==t){for(h=i,u=k;p=u<=s?y:u>=s+E?E:u-s,!(h= 0x80 (not a basic code point)","invalid-input":"Invalid input"},O=k-y,N=Math.floor,D=String.fromCharCode;_={version:"1.3.2",ucs2:{decode:f,encode:h},decode:p,encode:b,toASCII:m,toUnicode:w},n=function(){return _}.call(t,i,t,e),!(void 0!==n&&(e.exports=n))}(this)}).call(t,i(71)(e),function(){return this}())},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children=[],e.webpackPolyfill=1),e}},function(e,t,i){"use strict";t.decode=t.parse=i(73),t.encode=t.stringify=i(74)},function(e,t){"use strict";function i(e,t){return Object.prototype.hasOwnProperty.call(e,t)}e.exports=function(e,t,n,r){t=t||"&",n=n||"=";var s={};if("string"!=typeof e||0===e.length)return s;var o=/\+/g;e=e.split(t);var a=1e3;r&&"number"==typeof r.maxKeys&&(a=r.maxKeys);var l=e.length;a>0&&l>a&&(l=a);for(var f=0;f=0?(h=p.substr(0,b),u=p.substr(b+1)):(h=p,u=""),c=decodeURIComponent(h),d=decodeURIComponent(u),i(s,c)?Array.isArray(s[c])?s[c].push(d):s[c]=[s[c],d]:s[c]=d}return s}},function(e,t){"use strict";var i=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}};e.exports=function(e,t,n,r){return t=t||"&",n=n||"=",null===e&&(e=void 0),"object"==typeof e?Object.keys(e).map(function(r){var s=encodeURIComponent(i(r))+n;return Array.isArray(e[r])?e[r].map(function(e){return s+encodeURIComponent(i(e))}).join(t):s+encodeURIComponent(i(e[r]))}).join(t):r?encodeURIComponent(i(r))+n+encodeURIComponent(i(e)):""}},function(e,t,i){(function(e,n){function r(e,i){var n={seen:[],stylize:o};return arguments.length>=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),b(i)?n.showHidden=i:i&&t._extend(n,i),k(n.showHidden)&&(n.showHidden=!1),k(n.depth)&&(n.depth=2),k(n.colors)&&(n.colors=!1),k(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=s),l(n,e,n.depth)}function s(e,t){var i=r.styles[t];return i?"["+r.colors[i][0]+"m"+e+"["+r.colors[i][1]+"m":e}function o(e,t){return e}function a(e){var t={};return e.forEach(function(e,i){t[e]=!0}),t}function l(e,i,n){if(e.customInspect&&i&&S(i.inspect)&&i.inspect!==t.inspect&&(!i.constructor||i.constructor.prototype!==i)){var r=i.inspect(n,e);return _(r)||(r=l(e,r,n)),r}var s=f(e,i);if(s)return s;var o=Object.keys(i),b=a(o);if(e.showHidden&&(o=Object.getOwnPropertyNames(i)),T(i)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return h(i);if(0===o.length){if(S(i)){var w=i.name?": "+i.name:"";return e.stylize("[Function"+w+"]","special")}if(y(i))return e.stylize(RegExp.prototype.toString.call(i),"regexp");if(A(i))return e.stylize(Date.prototype.toString.call(i),"date");if(T(i))return h(i)}var m="",g=!1,v=["{","}"];if(p(i)&&(g=!0,v=["[","]"]),S(i)){var k=i.name?": "+i.name:"";m=" [Function"+k+"]"}if(y(i)&&(m=" "+RegExp.prototype.toString.call(i)),A(i)&&(m=" "+Date.prototype.toUTCString.call(i)),T(i)&&(m=" "+h(i)),0===o.length&&(!g||0==i.length))return v[0]+m+v[1];if(n<0)return y(i)?e.stylize(RegExp.prototype.toString.call(i),"regexp"):e.stylize("[Object]","special");e.seen.push(i);var E;return E=g?u(e,i,n,b,o):o.map(function(t){return c(e,i,n,b,t,g)}),e.seen.pop(),d(E,m,v)}function f(e,t){if(k(t))return e.stylize("undefined","undefined");if(_(t)){var i="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(i,"string")}return g(t)?e.stylize(""+t,"number"):b(t)?e.stylize(""+t,"boolean"):w(t)?e.stylize("null","null"):void 0}function h(e){return"["+Error.prototype.toString.call(e)+"]"}function u(e,t,i,n,r){for(var s=[],o=0,a=t.length;o-1&&(a=s?a.split("\n").map(function(e){return" "+e}).join("\n").substr(2):"\n"+a.split("\n").map(function(e){return" "+e}).join("\n"))):a=e.stylize("[Circular]","special")),k(o)){if(s&&r.match(/^\d+$/))return a;o=JSON.stringify(""+r),o.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(o=o.substr(1,o.length-2),o=e.stylize(o,"name")):(o=o.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),o=e.stylize(o,"string"))}return o+": "+a}function d(e,t,i){var n=0,r=e.reduce(function(e,t){return n++,t.indexOf("\n")>=0&&n++,e+t.replace(/\u001b\[\d\d?m/g,"").length+1},0);return r>60?i[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+i[1]:i[0]+t+" "+e.join(", ")+" "+i[1]}function p(e){return Array.isArray(e)}function b(e){return"boolean"==typeof e}function w(e){return null===e}function m(e){return null==e}function g(e){return"number"==typeof e}function _(e){return"string"==typeof e}function v(e){return"symbol"==typeof e}function k(e){return void 0===e}function y(e){return E(e)&&"[object RegExp]"===R(e)}function E(e){return"object"==typeof e&&null!==e}function A(e){return E(e)&&"[object Date]"===R(e)}function T(e){return E(e)&&("[object Error]"===R(e)||e instanceof Error)}function S(e){return"function"==typeof e}function M(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||"undefined"==typeof e}function R(e){return Object.prototype.toString.call(e)}function C(e){return e<10?"0"+e.toString(10):e.toString(10)}function P(){var e=new Date,t=[C(e.getHours()),C(e.getMinutes()),C(e.getSeconds())].join(":");return[e.getDate(),D[e.getMonth()],t].join(" ")}function x(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var I=/%[sdj%]/g;t.format=function(e){if(!_(e)){for(var t=[],i=0;i=s)return e;switch(e){case"%s":return String(n[i++]);case"%d":return Number(n[i++]);case"%j":try{return JSON.stringify(n[i++])}catch(e){return"[Circular]"}default:return e}}),a=n[i];i0)if(t.ended&&!r){var a=new Error("stream.push() after EOF");e.emit("error",a)}else if(t.endEmitted&&r){var a=new Error("stream.unshift() after end event");e.emit("error",a)}else!t.decoder||r||n||(i=t.decoder.write(i)),r||(t.reading=!1),t.flowing&&0===t.length&&!t.sync?(e.emit("data",i),e.read(0)):(t.length+=t.objectMode?1:i.length,r?t.buffer.unshift(i):t.buffer.push(i),t.needReadable&&u(e)),d(e,t);else r||(t.reading=!1);return o(t)}function o(e){return!e.ended&&(e.needReadable||e.length=P)e=P;else{e--;for(var t=1;t<32;t<<=1)e|=e>>t;e++}return e}function l(e,t){return 0===t.length&&t.ended?0:t.objectMode?0===e?0:1:isNaN(e)||M.isNull(e)?t.flowing&&t.buffer.length?t.buffer[0].length:t.length:e<=0?0:(e>t.highWaterMark&&(t.highWaterMark=a(e)),e>t.length?t.ended?t.length:(t.needReadable=!0,0):e)}function f(e,t){var i=null;return M.isBuffer(t)||M.isString(t)||M.isNullOrUndefined(t)||e.objectMode||(i=new TypeError("Invalid non-string/buffer chunk")),i}function h(e,t){if(t.decoder&&!t.ended){var i=t.decoder.end();i&&i.length&&(t.buffer.push(i),t.length+=t.objectMode?1:i.length)}t.ended=!0,u(e)}function u(e){var i=e._readableState;i.needReadable=!1,i.emittedReadable||(C("emitReadable",i.flowing),i.emittedReadable=!0,i.sync?t.nextTick(function(){c(e)}):c(e))}function c(e){C("emit readable"),e.emit("readable"),g(e)}function d(e,i){i.readingMore||(i.readingMore=!0,t.nextTick(function(){p(e,i)}))}function p(e,t){for(var i=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=r)i=s?n.join(""):A.concat(n,r),n.length=0;else if(e0)throw new Error("endReadable called on non-empty stream");i.endEmitted||(i.ended=!0,t.nextTick(function(){i.endEmitted||0!==i.length||(i.endEmitted=!0,e.readable=!1,e.emit("end"))}))}function k(e,t){for(var i=0,n=e.length;i0)&&(t.emittedReadable=!1),0===e&&t.needReadable&&(t.length>=t.highWaterMark||t.ended))return C("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?v(this):u(this),null;if(e=l(e,t),0===e&&t.ended)return 0===t.length&&v(this),null;var n=t.needReadable;C("need readable",n),(0===t.length||t.length-e0?_(e,t):null,M.isNull(r)&&(t.needReadable=!0,e=0),t.length-=e,0!==t.length||t.ended||(t.needReadable=!0),i!==e&&t.ended&&0===t.length&&v(this),M.isNull(r)||this.emit("data",r),r},r.prototype._read=function(e){this.emit("error",new Error("not implemented"))},r.prototype.pipe=function(e,i){function n(e){C("onunpipe"),e===u&&s()}function r(){C("onend"),e.end()}function s(){C("cleanup"),e.removeListener("close",l),e.removeListener("finish",f),e.removeListener("drain",w),e.removeListener("error",a),e.removeListener("unpipe",n),u.removeListener("end",r),u.removeListener("end",s),u.removeListener("data",o),!c.awaitDrain||e._writableState&&!e._writableState.needDrain||w()}function o(t){C("ondata");var i=e.write(t);!1===i&&(C("false write response, pause",u._readableState.awaitDrain),u._readableState.awaitDrain++,u.pause())}function a(t){C("onerror",t),h(),e.removeListener("error",a),0===T.listenerCount(e,"error")&&e.emit("error",t)}function l(){e.removeListener("finish",f),h()}function f(){C("onfinish"),e.removeListener("close",l),h()}function h(){C("unpipe"),u.unpipe(e)}var u=this,c=this._readableState;switch(c.pipesCount){case 0:c.pipes=e;break;case 1:c.pipes=[c.pipes,e];break;default:c.pipes.push(e)}c.pipesCount+=1,C("pipe count=%d opts=%j",c.pipesCount,i);var d=(!i||i.end!==!1)&&e!==t.stdout&&e!==t.stderr,p=d?r:s;c.endEmitted?t.nextTick(p):u.once("end",p),e.on("unpipe",n);var w=b(u);return e.on("drain",w),u.on("data",o),e._events&&e._events.error?E(e._events.error)?e._events.error.unshift(a):e._events.error=[a,e._events.error]:e.on("error",a),e.once("close",l),e.once("finish",f),e.emit("pipe",u),c.flowing||(C("pipe resume"),u.resume()),e},r.prototype.unpipe=function(e){var t=this._readableState;if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this),this);if(!e){var i=t.pipes,n=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var r=0;r1){for(var i=[],n=0;n=this.charLength-this.charReceived?this.charLength-this.charReceived:e.length;if(e.copy(this.charBuffer,this.charReceived,0,i),this.charReceived+=i,this.charReceived=55296&&n<=56319)){if(this.charReceived=this.charLength=0,0===e.length)return t;break}this.charLength+=this.surrogateSize,t=""}this.detectIncompleteChar(e);var r=e.length;this.charLength&&(e.copy(this.charBuffer,0,e.length-this.charReceived,r),r-=this.charReceived),t+=e.toString(this.encoding,0,r);var r=t.length-1,n=t.charCodeAt(r);if(n>=55296&&n<=56319){var s=this.surrogateSize;return this.charLength+=s,this.charReceived+=s,this.charBuffer.copy(this.charBuffer,s,0,s),e.copy(this.charBuffer,0,0,s),t.substring(0,r)}return t},f.prototype.detectIncompleteChar=function(e){for(var t=e.length>=3?3:e.length;t>0;t--){var i=e[e.length-t];if(1==t&&i>>5==6){this.charLength=2;break}if(t<=2&&i>>4==14){this.charLength=3;break}if(t<=3&&i>>3==30){this.charLength=4;break}}this.charReceived=t},f.prototype.end=function(e){var t="";if(e&&e.length&&(t=this.write(e)),this.charReceived){var i=this.charReceived,n=this.charBuffer,r=this.encoding;t+=n.slice(0,i).toString(r)}return t}},function(e,t,i){function n(e,t){this.afterTransform=function(e,i){return r(t,e,i)},this.needTransform=!1,this.transforming=!1,this.writecb=null,this.writechunk=null}function r(e,t,i){var n=e._transformState;n.transforming=!1;var r=n.writecb;if(!r)return e.emit("error",new Error("no writecb in Transform class"));n.writechunk=null,n.writecb=null,l.isNullOrUndefined(i)||e.push(i),r&&r(t);var s=e._readableState;s.reading=!1,(s.needReadable||s.lengththis.offset&&(this.emit("data",t.slice(this.offset)),this.offset=t.length))};var l=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}},function(e,t,i){!function(){function e(e){this.message=e}var i=t,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";e.prototype=new Error,e.prototype.name="InvalidCharacterError",i.btoa||(i.btoa=function(t){for(var i,r,s=0,o=n,a="";t.charAt(0|s)||(o="=",s%1);a+=o.charAt(63&i>>8-s%1*8)){if(r=t.charCodeAt(s+=.75),r>255)throw new e("'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.");i=i<<8|r}return a}),i.atob||(i.atob=function(t){if(t=t.replace(/=+$/,""),t.length%4==1)throw new e("'atob' failed: The string to be decoded is not correctly encoded.");for(var i,r,s=0,o=0,a="";r=t.charAt(o++);~r&&(i=s%4?64*i+r:r,s++%4)?a+=String.fromCharCode(255&i>>(-2*s&6)):0)r=n.indexOf(r);return a})}()},function(e,t,i){var n=i(78),r=e.exports;for(var s in n)n.hasOwnProperty(s)&&(r[s]=n[s]);r.request=function(e,t){return e||(e={}),e.scheme="https",n.request.call(this,e,t)}},function(e,t,i){(function(e){function n(){var e=[].slice.call(arguments).join(" ");throw new Error([e,"we accept pull requests","http://github.com/dominictarr/crypto-browserify"].join("\n"))}function r(e,t){for(var i in e)t(e[i],i)}var s=i(100);t.createHash=i(102),t.createHmac=i(111),t.randomBytes=function(t,i){if(!i||!i.call)return new e(s(t));try{i.call(this,void 0,new e(s(t)))}catch(e){i(e)}},t.getHashes=function(){return["sha1","sha256","sha512","md5","rmd160"]};var o=i(112)(t);t.pbkdf2=o.pbkdf2,t.pbkdf2Sync=o.pbkdf2Sync,r(["createCredentials","createCipher","createCipheriv","createDecipher","createDecipheriv","createSign","createVerify","createDiffieHellman"],function(e){t[e]=function(){n("sorry,",e,"is not implemented yet")}})}).call(t,i(58).Buffer)},function(e,t,i){(function(t,n){!function(){var r=("undefined"==typeof window?t:window)||{};_crypto=r.crypto||r.msCrypto||i(101),e.exports=function(e){if(_crypto.getRandomValues){var t=new n(e);return _crypto.getRandomValues(t),t}if(_crypto.randomBytes)return _crypto.randomBytes(e);throw new Error("secure random number generation not supported by this browser\nuse chrome, FireFox or Internet Explorer 11")}}()}).call(t,function(){return this}(),i(58).Buffer)},function(e,t){},function(e,t,i){(function(t){function n(e){return function(){var i=[],n={update:function(e,n){return t.isBuffer(e)||(e=new t(e,n)),i.push(e),this},digest:function(n){var r=t.concat(i),s=e(r);return i=null,n?s.toString(n):s}};return n}}var r=i(103),s=n(i(108)),o=n(i(110));e.exports=function(e){return"md5"===e?new s:"rmd160"===e?new o:r(e)}}).call(t,i(58).Buffer)},function(e,t,i){var t=e.exports=function(e){var i=t[e];if(!i)throw new Error(e+" is not supported (we accept pull requests)");return new i},n=i(58).Buffer,r=i(104)(n);t.sha1=i(105)(n,r),t.sha256=i(106)(n,r),t.sha512=i(107)(n,r)},function(e,t){e.exports=function(e){function t(t,i){this._block=new e(t),this._finalSize=i,this._blockSize=t,this._len=0,this._s=0}return t.prototype.init=function(){this._s=0,this._len=0},t.prototype.update=function(t,i){"string"==typeof t&&(i=i||"utf8",t=new e(t,i));for(var n=this._len+=t.length,r=this._s=this._s||0,s=0,o=this._block;r=8*this._finalSize&&(this._update(this._block),this._block.fill(0)),this._block.writeInt32BE(t,this._blockSize-4);var i=this._update(this._block)||this._hash();return e?i.toString(e):i},t.prototype._update=function(){throw new Error("_update must be implemented by subclass")},t}},function(e,t,i){var n=i(75).inherits;e.exports=function(e,t){function i(){return p.length?p.pop().init():this instanceof i?(this._w=d,t.call(this,64,56),this._h=null,void this.init()):new i}function r(e,t,i,n){return e<20?t&i|~t&n:e<40?t^i^n:e<60?t&i|t&n|i&n:t^i^n}function s(e){return e<20?1518500249:e<40?1859775393:e<60?-1894007588:-899497514}function o(e,t){return e+t|0}function a(e,t){return e<>>32-t}var l=0,f=4,h=8,u=12,c=16,d=new("undefined"==typeof Int32Array?Array:Int32Array)(80),p=[];return n(i,t),i.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,t.prototype.init.call(this),this},i.prototype._POOL=p,i.prototype._update=function(e){var t,i,n,l,f,h,u,c,d,p;t=h=this._a,i=u=this._b,n=c=this._c,l=d=this._d,f=p=this._e;for(var b=this._w,w=0;w<80;w++){var m=b[w]=w<16?e.readInt32BE(4*w):a(b[w-3]^b[w-8]^b[w-14]^b[w-16],1),g=o(o(a(t,5),r(w,i,n,l)),o(o(f,m),s(w)));f=l,l=n,n=a(i,30),i=t,t=g}this._a=o(t,h),this._b=o(i,u),this._c=o(n,c),this._d=o(l,d),this._e=o(f,p)},i.prototype._hash=function(){p.length<100&&p.push(this);var t=new e(20);return t.writeInt32BE(0|this._a,l),t.writeInt32BE(0|this._b,f),t.writeInt32BE(0|this._c,h),t.writeInt32BE(0|this._d,u),t.writeInt32BE(0|this._e,c),t},i}},function(e,t,i){var n=i(75).inherits;e.exports=function(e,t){function i(){this.init(),this._w=d,t.call(this,64,56)}function r(e,t){return e>>>t|e<<32-t}function s(e,t){return e>>>t}function o(e,t,i){return e&t^~e&i}function a(e,t,i){return e&t^e&i^t&i}function l(e){return r(e,2)^r(e,13)^r(e,22)}function f(e){return r(e,6)^r(e,11)^r(e,25)}function h(e){return r(e,7)^r(e,18)^s(e,3)}function u(e){return r(e,17)^r(e,19)^s(e,10)}var c=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],d=new Array(64);return n(i,t),i.prototype.init=function(){return this._a=1779033703,this._b=-1150833019,this._c=1013904242,this._d=-1521486534,this._e=1359893119,this._f=-1694144372,this._g=528734635,this._h=1541459225,this._len=this._s=0,this},i.prototype._update=function(e){var t,i,n,r,s,d,p,b,w,m,g=this._w;t=0|this._a,i=0|this._b,n=0|this._c,r=0|this._d,s=0|this._e,d=0|this._f,p=0|this._g,b=0|this._h;for(var _=0;_<64;_++){var v=g[_]=_<16?e.readInt32BE(4*_):u(g[_-2])+g[_-7]+h(g[_-15])+g[_-16];w=b+f(s)+o(s,d,p)+c[_]+v,m=l(t)+a(t,i,n),b=p,p=d,d=s,s=r+w,r=n,n=i,i=t,t=w+m}this._a=t+this._a|0,this._b=i+this._b|0,this._c=n+this._c|0,this._d=r+this._d|0,this._e=s+this._e|0,this._f=d+this._f|0,this._g=p+this._g|0,this._h=b+this._h|0},i.prototype._hash=function(){var t=new e(32);return t.writeInt32BE(this._a,0),t.writeInt32BE(this._b,4),t.writeInt32BE(this._c,8),t.writeInt32BE(this._d,12),t.writeInt32BE(this._e,16),t.writeInt32BE(this._f,20),t.writeInt32BE(this._g,24),t.writeInt32BE(this._h,28),t},i}},function(e,t,i){var n=i(75).inherits;e.exports=function(e,t){function i(){this.init(),this._w=l,t.call(this,128,112)}function r(e,t,i){return e>>>i|t<<32-i}function s(e,t,i){return e&t^~e&i}function o(e,t,i){return e&t^e&i^t&i}var a=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],l=new Array(160);return n(i,t),i.prototype.init=function(){return this._a=1779033703,this._b=-1150833019,this._c=1013904242,this._d=-1521486534,this._e=1359893119,this._f=-1694144372,this._g=528734635,this._h=1541459225,this._al=-205731576,this._bl=-2067093701,this._cl=-23791573,this._dl=1595750129,this._el=-1377402159,this._fl=725511199,this._gl=-79577749,this._hl=327033209,this._len=this._s=0,this},i.prototype._update=function(e){var t,i,n,l,f,h,u,c,d,p,b,w,m,g,_,v,k=this._w;t=0|this._a,i=0|this._b,n=0|this._c,l=0|this._d,f=0|this._e,h=0|this._f,u=0|this._g,c=0|this._h,d=0|this._al,p=0|this._bl,b=0|this._cl,w=0|this._dl,m=0|this._el,g=0|this._fl,_=0|this._gl,v=0|this._hl;for(var y=0;y<80;y++){var E,A,T=2*y;if(y<16)E=k[T]=e.readInt32BE(4*T),A=k[T+1]=e.readInt32BE(4*T+4);else{var S=k[T-30],M=k[T-30+1],R=r(S,M,1)^r(S,M,8)^S>>>7,C=r(M,S,1)^r(M,S,8)^r(M,S,7);S=k[T-4],M=k[T-4+1];var P=r(S,M,19)^r(M,S,29)^S>>>6,x=r(M,S,19)^r(S,M,29)^r(M,S,6),I=k[T-14],O=k[T-14+1],N=k[T-32],D=k[T-32+1];A=C+O,E=R+I+(A>>>0>>0?1:0),A+=x,E=E+P+(A>>>0>>0?1:0),A+=D,E=E+N+(A>>>0>>0?1:0),k[T]=E,k[T+1]=A}var L=o(t,i,n),U=o(d,p,b),B=r(t,d,28)^r(d,t,2)^r(d,t,7),j=r(d,t,28)^r(t,d,2)^r(t,d,7),F=r(f,m,14)^r(f,m,18)^r(m,f,9),G=r(m,f,14)^r(m,f,18)^r(f,m,9),H=a[T],z=a[T+1],q=s(f,h,u),W=s(m,g,_),V=v+G,Y=c+F+(V>>>0>>0?1:0);V+=W,Y=Y+q+(V>>>0>>0?1:0),V+=z,Y=Y+H+(V>>>0>>0?1:0),V+=A,Y=Y+E+(V>>>0>>0?1:0);var Z=j+U,$=B+L+(Z>>>0>>0?1:0);c=u,v=_,u=h,_=g,h=f,g=m,m=w+V|0,f=l+Y+(m>>>0>>0?1:0)|0,l=n,w=b,n=i,b=p,i=t,p=d,d=V+Z|0,t=Y+$+(d>>>0>>0?1:0)|0}this._al=this._al+d|0,this._bl=this._bl+p|0,this._cl=this._cl+b|0,this._dl=this._dl+w|0,this._el=this._el+m|0,this._fl=this._fl+g|0,this._gl=this._gl+_|0,this._hl=this._hl+v|0,this._a=this._a+t+(this._al>>>0>>0?1:0)|0,this._b=this._b+i+(this._bl>>>0

>>0?1:0)|0,this._c=this._c+n+(this._cl>>>0>>0?1:0)|0,this._d=this._d+l+(this._dl>>>0>>0?1:0)|0,this._e=this._e+f+(this._el>>>0>>0?1:0)|0,this._f=this._f+h+(this._fl>>>0>>0?1:0)|0,this._g=this._g+u+(this._gl>>>0<_>>>0?1:0)|0,this._h=this._h+c+(this._hl>>>0>>0?1:0)|0},i.prototype._hash=function(){function t(e,t,n){i.writeInt32BE(e,n),i.writeInt32BE(t,n+4)}var i=new e(64);return t(this._a,this._al,0),t(this._b,this._bl,8),t(this._c,this._cl,16),t(this._d,this._dl,24),t(this._e,this._el,32),t(this._f,this._fl,40),t(this._g,this._gl,48),t(this._h,this._hl,56),i},i}},function(e,t,i){function n(e,t){e[t>>5]|=128<>>9<<4)+14]=t;for(var i=1732584193,n=-271733879,r=-1732584194,h=271733878,u=0;u>16)+(t>>16)+(i>>16);return n<<16|65535&i}function h(e,t){return e<>>32-t}var u=i(109);e.exports=function(e){return u.hash(e,n,16)}},function(e,t,i){(function(t){function i(e,i){if(e.length%s!==0){var n=e.length+(s-e.length%s);e=t.concat([e,o],n)}for(var r=[],a=i?e.readInt32BE:e.readInt32LE,l=0;l>>32-t}function l(e){var i=[1732584193,4023233417,2562383102,271733878,3285377520];"string"==typeof e&&(e=new t(e,"utf8"));var n=b(e),r=8*e.length,s=8*e.length;n[r>>>5]|=128<<24-r%32,n[(r+64>>>9<<4)+14]=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8);for(var o=0;o>>24)|4278255360&(a<<24|a>>>8)}var l=w(i);return new t(l)}e.exports=l;/** @preserve - (c) 2012 by Cédric Mesnil. All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - - - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -var f=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],h=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],u=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],c=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],d=[0,1518500249,1859775393,2400959708,2840853838],p=[1352829926,1548603684,1836072691,2053994217,0],b=function(e){for(var t=[],i=0,n=0;i>>5]|=e[i]<<24-n%32;return t},w=function(e){for(var t=[],i=0;i<32*e.length;i+=8)t.push(e[i>>>5]>>>24-i%32&255);return t},m=function(e,t,l){for(var b=0;b<16;b++){var w=l+b,m=t[w];t[w]=16711935&(m<<8|m>>>24)|4278255360&(m<<24|m>>>8)}var g,_,v,k,y,E,A,T,S,M;E=g=e[0],A=_=e[1],T=v=e[2],S=k=e[3],M=y=e[4];for(var R,b=0;b<80;b+=1)R=g+t[l+f[b]]|0,R+=b<16?i(_,v,k)+d[0]:b<32?n(_,v,k)+d[1]:b<48?r(_,v,k)+d[2]:b<64?s(_,v,k)+d[3]:o(_,v,k)+d[4],R|=0,R=a(R,u[b]),R=R+y|0,g=y,y=k,k=a(v,10),v=_,_=R,R=E+t[l+h[b]]|0,R+=b<16?o(A,T,S)+p[0]:b<32?s(A,T,S)+p[1]:b<48?r(A,T,S)+p[2]:b<64?n(A,T,S)+p[3]:i(A,T,S)+p[4],R|=0,R=a(R,c[b]),R=R+M|0,E=M,M=S,S=a(T,10),T=A,A=R;R=e[1]+v+S|0,e[1]=e[2]+k+M|0,e[2]=e[3]+y+E|0,e[3]=e[4]+g+A|0,e[4]=e[0]+_+T|0,e[0]=R}}).call(t,i(58).Buffer)},function(e,t,i){(function(t){function n(e,i){if(!(this instanceof n))return new n(e,i);this._opad=l,this._alg=e;var o="sha512"===e?128:64;i=this._key=t.isBuffer(i)?i:new t(i),i.length>o?i=r(e).update(i).digest():i.length(Math.pow(2,32)-1)*a))throw new TypeError("keylen exceeds maximum length");p.copy(f,0,0,a);for(var b=1;b0)throw n.length>1?new Error("options "+n.slice(0,n.length-1).join(", ")+" and "+n[n.length-1]+" must be defined"):new Error("option "+n[0]+" must be defined")}return Object.keys(e).forEach(function(i){i in t&&(t[i]=e[i])}),this},this.copy=function(t){var n={};return Object.keys(e).forEach(function(e){t.indexOf(e)!==-1&&(n[e]=i[e])}),n},this.read=function(e,t){if("function"==typeof t){var i=this;r.readFile(e,function(e,n){if(e)return t(e);var r=JSON.parse(n);i.merge(r),t()})}else{var n=JSON.parse(r.readFileSync(e));this.merge(n)}return this},this.isDefined=function(e){return"undefined"!=typeof i[e]},this.isDefinedAndNonNull=function(e){return"undefined"!=typeof i[e]&&null!==i[e]},Object.freeze(i),Object.freeze(this)}/*! - * Copyright(c) 2011 Einar Otto Stangvik - * MIT Licensed - */ -var r=i(62);e.exports=n},function(e,t,i){(function(t){function n(e,t){if(this instanceof n==!1)throw new TypeError("Classes can't be function-called");l.EventEmitter.call(this),this._socket=e,this.extensions=t||{},this.firstFragment=!0,this.compress=!1,this.messageHandlers=[],this.processing=!1}function r(e,t){this[t]=(65280&e)>>8,this[t+1]=255&e}function s(e,t){this[t]=(4278190080&e)>>24,this[t+1]=(16711680&e)>>16,this[t+2]=(65280&e)>>8,this[t+3]=255&e}function o(e){for(var i=new Uint8Array(e.buffer||e),n=e.byteLength||e.length,r=e.byteOffset||0,s=new t(n),o=0;o - * MIT Licensed - */ -var l=i(3),f=i(75),h=(l.EventEmitter,i(117)),u=i(118).BufferUtil,c=i(125);f.inherits(n,l.EventEmitter),n.prototype.close=function(e,i,n,s){if("undefined"!=typeof e&&("number"!=typeof e||!h.isValidErrorCode(e)))throw new Error("first argument must be a valid error code number");e=e||1e3;var o=new t(2+(i?t.byteLength(i):0));r.call(o,e,0),o.length>2&&o.write(i,2);var a=this;this.messageHandlers.push(function(e){a.frameAndSend(8,o,!0,n),e(),"function"==typeof s&&s()}),this.flush()},n.prototype.ping=function(e,t){var i=t&&t.mask,n=this;this.messageHandlers.push(function(t){n.frameAndSend(9,e||"",!0,i),t()}),this.flush()},n.prototype.pong=function(e,t){var i=t&&t.mask,n=this;this.messageHandlers.push(function(t){n.frameAndSend(10,e||"",!0,i),t()}),this.flush()},n.prototype.send=function(e,t,i){var n=!t||t.fin!==!1,r=t&&t.mask,s=t&&t.compress,o=t&&t.binary?2:1;this.firstFragment===!1?(o=0,s=!1):(this.firstFragment=!1,this.compress=s),n&&(this.firstFragment=!0);var a=this.compress,l=this;this.messageHandlers.push(function(t){l.applyExtensions(e,n,a,function(e,a){return e?void("function"==typeof i?i(e):l.emit("error",e)):(l.frameAndSend(o,a,n,r,s,i),void t())})}),this.flush()},n.prototype.frameAndSend=function(e,i,n,l,f,h){var c=!1;if(i){t.isBuffer(i)||(c=!0,!i||"undefined"==typeof i.byteLength&&"undefined"==typeof i.buffer?("number"==typeof i&&(i=i.toString()),i=new t(i)):i=o(i));var d=i.length,p=l?6:2,b=d;d>=65536?(p+=8,b=127):d>125&&(p+=2,b=126);var w=d<32768||l&&!c,m=w?d+p:p,g=new t(m);switch(g[0]=n?128|e:e,f&&(g[0]|=64),b){case 126:r.call(g,d,2);break;case 127:s.call(g,0,2),s.call(g,d,6)}if(l){g[1]=128|b;var _=a();if(g[p-4]=_[0],g[p-3]=_[1],g[p-2]=_[2],g[p-1]=_[3],w){u.mask(i,_,g,p,d);try{this._socket.write(g,"binary",h)}catch(e){"function"==typeof h?h(e):this.emit("error",e)}}else{u.mask(i,_,i,0,d);try{this._socket.write(g,"binary"),this._socket.write(i,"binary",h)}catch(e){"function"==typeof h?h(e):this.emit("error",e)}}}else if(g[1]=b,w){i.copy(g,p);try{this._socket.write(g,"binary",h)}catch(e){"function"==typeof h?h(e):this.emit("error",e)}}else try{this._socket.write(g,"binary"),this._socket.write(i,"binary",h)}catch(e){"function"==typeof h?h(e):this.emit("error",e)}}else try{this._socket.write(new t([e|(n?128:0),0|(l?128:0)].concat(l?[0,0,0,0]:[])),"binary",h)}catch(e){"function"==typeof h?h(e):this.emit("error",e)}},n.prototype.flush=function(){if(!this.processing){var e=this.messageHandlers.shift();if(e){this.processing=!0;var t=this;e(function(){t.processing=!1,t.flush()})}}},n.prototype.applyExtensions=function(e,t,i,n){i&&e?((e.buffer||e)instanceof ArrayBuffer&&(e=o(e)),this.extensions[c.extensionName].compress(e,t,n)):n(null,e)},e.exports=n}).call(t,i(58).Buffer)},function(e,t){/*! - * ws: a node.js websocket client - * Copyright(c) 2011 Einar Otto Stangvik - * MIT Licensed - */ -e.exports={isValidErrorCode:function(e){return e>=1e3&&e<=1011&&1004!=e&&1005!=e&&1006!=e||e>=3e3&&e<=4999},1e3:"normal",1001:"going away",1002:"protocol error",1003:"unsupported data",1004:"reserved",1005:"reserved for extensions",1006:"reserved for extensions",1007:"inconsistent or invalid data",1008:"policy violation",1009:"message too big",1010:"extension handshake missing",1011:"an unexpected condition prevented the request from being fulfilled"}},function(e,t,i){"use strict";/*! - * ws: a node.js websocket client - * Copyright(c) 2011 Einar Otto Stangvik - * MIT Licensed - */ -try{e.exports=i(119)}catch(t){e.exports=i(124)}},function(e,t,i){"use strict";try{e.exports=i(120)("bufferutil")}catch(t){e.exports=i(123)}},function(e,t,i){(function(n,r){function s(e){"string"==typeof e?e={bindings:e}:e||(e={}),e.__proto__=u,e.module_root||(e.module_root=t.getRoot(t.getFileName())),".node"!=a.extname(e.bindings)&&(e.bindings+=".node");for(var n,r,s,o=[],f=0,h=e.try.length;f=1.2.1 <1.3.0",type:"range"},"/home/travis/build/hydrabolt/discord.js/node_modules/node-opus"]],_from:"bindings@>=1.2.1 <1.3.0",_id:"bindings@1.2.1",_inCache:!0,_installable:!0,_location:"/bindings",_npmUser:{name:"tootallnate",email:"nathan@tootallnate.net"},_npmVersion:"1.4.14",_phantomChildren:{},_requested:{raw:"bindings@~1.2.1",scope:null,escapedName:"bindings",name:"bindings",rawSpec:"~1.2.1",spec:">=1.2.1 <1.3.0",type:"range"},_requiredBy:["/node-opus","/ref"],_resolved:"https://registry.npmjs.org/bindings/-/bindings-1.2.1.tgz",_shasum:"14ad6113812d2d37d72e67b4cacb4bb726505f11",_shrinkwrap:null,_spec:"bindings@~1.2.1",_where:"/home/travis/build/hydrabolt/discord.js/node_modules/node-opus",author:{name:"Nathan Rajlich",email:"nathan@tootallnate.net",url:"http://tootallnate.net"},bugs:{url:"https://github.com/TooTallNate/node-bindings/issues"},dependencies:{},description:"Helper module for loading your native module's .node file",devDependencies:{},directories:{},dist:{shasum:"14ad6113812d2d37d72e67b4cacb4bb726505f11",tarball:"https://registry.npmjs.org/bindings/-/bindings-1.2.1.tgz"},gitHead:"e404152ee27f8478ccbc7122ee051246e8e5ec02",homepage:"https://github.com/TooTallNate/node-bindings",keywords:["native","addon","bindings","gyp","waf","c","c++"],license:"MIT",main:"./bindings.js",maintainers:[{name:"TooTallNate",email:"nathan@tootallnate.net"},{name:"tootallnate",email:"nathan@tootallnate.net"}],name:"bindings",optionalDependencies:{},readme:"ERROR: No README data found!",repository:{type:"git",url:"git://github.com/TooTallNate/node-bindings.git"},scripts:{},version:"1.2.1"}},function(e,t){"use strict";/*! - * bufferutil: WebSocket buffer utils - * Copyright(c) 2015 Einar Otto Stangvik - * MIT Licensed - */ -e.exports.BufferUtil={merge:function(e,t){for(var i=0,n=0,r=t.length;i - * MIT Licensed - */ -t.BufferUtil={merge:function(e,t){for(var i=0,n=0,r=t.length;ne.server_max_window_bits)&&("number"!=typeof this._options.clientMaxWindowBits||e.client_max_window_bits))return(this._options.serverNoContextTakeover||e.server_no_context_takeover)&&(t.server_no_context_takeover=!0),this._options.clientNoContextTakeover&&(t.client_no_context_takeover=!0),this._options.clientNoContextTakeover!==!1&&e.client_no_context_takeover&&(t.client_no_context_takeover=!0),"number"==typeof this._options.serverMaxWindowBits?t.server_max_window_bits=this._options.serverMaxWindowBits:"number"==typeof e.server_max_window_bits&&(t.server_max_window_bits=e.server_max_window_bits),"number"==typeof this._options.clientMaxWindowBits?t.client_max_window_bits=this._options.clientMaxWindowBits:this._options.clientMaxWindowBits!==!1&&"number"==typeof e.client_max_window_bits&&(t.client_max_window_bits=e.client_max_window_bits),!0},this);if(!i)throw new Error("Doesn't support the offered configuration");return t},n.prototype.acceptAsClient=function(e){var t=e[0];if(null!=this._options.clientNoContextTakeover&&this._options.clientNoContextTakeover===!1&&t.client_no_context_takeover)throw new Error('Invalid value for "client_no_context_takeover"');if(null!=this._options.clientMaxWindowBits){if(this._options.clientMaxWindowBits===!1&&t.client_max_window_bits)throw new Error('Invalid value for "client_max_window_bits"');if("number"==typeof this._options.clientMaxWindowBits&&(!t.client_max_window_bits||t.client_max_window_bits>this._options.clientMaxWindowBits))throw new Error('Invalid value for "client_max_window_bits"')}return t},n.prototype.normalizeParams=function(e){return e.map(function(e){return Object.keys(e).forEach(function(t){var i=e[t];if(i.length>1)throw new Error("Multiple extension parameters for "+t);switch(i=i[0],t){case"server_no_context_takeover":case"client_no_context_takeover":if(i!==!0)throw new Error("invalid extension parameter value for "+t+" ("+i+")");e[t]=!0;break;case"server_max_window_bits":case"client_max_window_bits":if("string"==typeof i&&(i=parseInt(i,10),!~s.indexOf(i)))throw new Error("invalid extension parameter value for "+t+" ("+i+")");if(!this._isServer&&i===!0)throw new Error("Missing extension parameter value for "+t);e[t]=i;break;default:throw new Error("Not defined extension parameter ("+t+")")}},this),e},this)},n.prototype.decompress=function(e,i,n){function s(e){l(),n(e)}function a(e){if(void 0!==u._maxPayload&&null!==u._maxPayload&&u._maxPayload>0&&(d+=e.length,d>u._maxPayload)){c=[],l();var t={type:1009};return void n(t)}c.push(e)}function l(){u._inflate&&(u._inflate.removeListener("error",s),u._inflate.removeListener("data",a),u._inflate.writeInProgress=!1,(i&&u.params[f+"_no_context_takeover"]||u._inflate.pendingClose)&&(u._inflate.close&&u._inflate.close(),u._inflate=null))}var f=this._isServer?"client":"server";if(!this._inflate){var h=this.params[f+"_max_window_bits"];this._inflate=r.createInflateRaw({windowBits:"number"==typeof h?h:o})}this._inflate.writeInProgress=!0;var u=this,c=[],d=0;this._inflate.on("error",s).on("data",a),this._inflate.write(e),i&&this._inflate.write(new t([0,0,255,255])),this._inflate.flush(function(){l(),n(null,t.concat(c))})},n.prototype.compress=function(e,i,n){function s(e){f(),n(e)}function l(e){d.push(e)}function f(){c._deflate&&(c._deflate.removeListener("error",s),c._deflate.removeListener("data",l),c._deflate.writeInProgress=!1,(i&&c.params[h+"_no_context_takeover"]||c._deflate.pendingClose)&&(c._deflate.close&&c._deflate.close(),c._deflate=null))}var h=this._isServer?"server":"client";if(!this._deflate){var u=this.params[h+"_max_window_bits"];this._deflate=r.createDeflateRaw({flush:r.Z_SYNC_FLUSH,windowBits:"number"==typeof u?u:o,memLevel:this._options.memLevel||a})}this._deflate.writeInProgress=!0;var c=this,d=[];this._deflate.on("error",s).on("data",l),this._deflate.write(e),this._deflate.flush(function(){f();var e=t.concat(d);i&&(e=e.slice(0,e.length-4)),n(null,e)})},e.exports=n}).call(t,i(58).Buffer)},function(e,t,i){(function(e,n){function r(t,i,n){function r(){for(var e;null!==(e=t.read());)a.push(e),l+=e.length;t.once("readable",r)}function s(e){t.removeListener("end",o),t.removeListener("readable",r),n(e)}function o(){var i=e.concat(a,l);a=[],n(null,i),t.close()}var a=[],l=0;t.on("error",s),t.on("end",o),t.end(i),r()}function s(t,i){if("string"==typeof i&&(i=new e(i)),!e.isBuffer(i))throw new TypeError("Not a string or buffer");var n=b.Z_FINISH;return t._processChunk(i,n)}function o(e){return this instanceof o?void d.call(this,e,b.DEFLATE):new o(e)}function a(e){return this instanceof a?void d.call(this,e,b.INFLATE):new a(e)}function l(e){return this instanceof l?void d.call(this,e,b.GZIP):new l(e)}function f(e){return this instanceof f?void d.call(this,e,b.GUNZIP):new f(e)}function h(e){return this instanceof h?void d.call(this,e,b.DEFLATERAW):new h(e)}function u(e){return this instanceof u?void d.call(this,e,b.INFLATERAW):new u(e)}function c(e){return this instanceof c?void d.call(this,e,b.UNZIP):new c(e)}function d(i,n){if(this._opts=i=i||{},this._chunkSize=i.chunkSize||t.Z_DEFAULT_CHUNK,p.call(this,i),i.flush&&i.flush!==b.Z_NO_FLUSH&&i.flush!==b.Z_PARTIAL_FLUSH&&i.flush!==b.Z_SYNC_FLUSH&&i.flush!==b.Z_FULL_FLUSH&&i.flush!==b.Z_FINISH&&i.flush!==b.Z_BLOCK)throw new Error("Invalid flush flag: "+i.flush);if(this._flushFlag=i.flush||b.Z_NO_FLUSH,i.chunkSize&&(i.chunkSizet.Z_MAX_CHUNK))throw new Error("Invalid chunk size: "+i.chunkSize);if(i.windowBits&&(i.windowBitst.Z_MAX_WINDOWBITS))throw new Error("Invalid windowBits: "+i.windowBits);if(i.level&&(i.levelt.Z_MAX_LEVEL))throw new Error("Invalid compression level: "+i.level);if(i.memLevel&&(i.memLevelt.Z_MAX_MEMLEVEL))throw new Error("Invalid memLevel: "+i.memLevel);if(i.strategy&&i.strategy!=t.Z_FILTERED&&i.strategy!=t.Z_HUFFMAN_ONLY&&i.strategy!=t.Z_RLE&&i.strategy!=t.Z_FIXED&&i.strategy!=t.Z_DEFAULT_STRATEGY)throw new Error("Invalid strategy: "+i.strategy);if(i.dictionary&&!e.isBuffer(i.dictionary))throw new Error("Invalid dictionary: it should be a Buffer instance");this._binding=new b.Zlib(n);var r=this;this._hadError=!1,this._binding.onerror=function(e,i){r._binding=null,r._hadError=!0;var n=new Error(e);n.errno=i,n.code=t.codes[i],r.emit("error",n)};var s=t.Z_DEFAULT_COMPRESSION;"number"==typeof i.level&&(s=i.level);var o=t.Z_DEFAULT_STRATEGY;"number"==typeof i.strategy&&(o=i.strategy),this._binding.init(i.windowBits||t.Z_DEFAULT_WINDOWBITS,s,i.memLevel||t.Z_DEFAULT_MEMLEVEL,o,i.dictionary),this._buffer=new e(this._chunkSize),this._offset=0,this._closed=!1,this._level=s,this._strategy=o,this.once("end",this.close)}var p=i(127),b=i(134),w=i(75),m=i(146).ok;b.Z_MIN_WINDOWBITS=8,b.Z_MAX_WINDOWBITS=15,b.Z_DEFAULT_WINDOWBITS=15,b.Z_MIN_CHUNK=64,b.Z_MAX_CHUNK=1/0,b.Z_DEFAULT_CHUNK=16384,b.Z_MIN_MEMLEVEL=1,b.Z_MAX_MEMLEVEL=9,b.Z_DEFAULT_MEMLEVEL=8,b.Z_MIN_LEVEL=-1,b.Z_MAX_LEVEL=9,b.Z_DEFAULT_LEVEL=b.Z_DEFAULT_COMPRESSION,Object.keys(b).forEach(function(e){e.match(/^Z/)&&(t[e]=b[e])}),t.codes={Z_OK:b.Z_OK,Z_STREAM_END:b.Z_STREAM_END,Z_NEED_DICT:b.Z_NEED_DICT,Z_ERRNO:b.Z_ERRNO,Z_STREAM_ERROR:b.Z_STREAM_ERROR,Z_DATA_ERROR:b.Z_DATA_ERROR,Z_MEM_ERROR:b.Z_MEM_ERROR,Z_BUF_ERROR:b.Z_BUF_ERROR,Z_VERSION_ERROR:b.Z_VERSION_ERROR},Object.keys(t.codes).forEach(function(e){t.codes[t.codes[e]]=e}),t.Deflate=o,t.Inflate=a,t.Gzip=l,t.Gunzip=f,t.DeflateRaw=h,t.InflateRaw=u,t.Unzip=c,t.createDeflate=function(e){return new o(e)},t.createInflate=function(e){return new a(e)},t.createDeflateRaw=function(e){return new h(e)},t.createInflateRaw=function(e){return new u(e)},t.createGzip=function(e){return new l(e)},t.createGunzip=function(e){return new f(e)},t.createUnzip=function(e){return new c(e)},t.deflate=function(e,t,i){return"function"==typeof t&&(i=t,t={}),r(new o(t),e,i)},t.deflateSync=function(e,t){return s(new o(t),e)},t.gzip=function(e,t,i){return"function"==typeof t&&(i=t,t={}),r(new l(t),e,i)},t.gzipSync=function(e,t){return s(new l(t),e)},t.deflateRaw=function(e,t,i){return"function"==typeof t&&(i=t,t={}),r(new h(t),e,i)},t.deflateRawSync=function(e,t){return s(new h(t),e)},t.unzip=function(e,t,i){return"function"==typeof t&&(i=t,t={}),r(new c(t),e,i)},t.unzipSync=function(e,t){return s(new c(t),e)},t.inflate=function(e,t,i){return"function"==typeof t&&(i=t,t={}),r(new a(t),e,i)},t.inflateSync=function(e,t){return s(new a(t),e)},t.gunzip=function(e,t,i){return"function"==typeof t&&(i=t,t={}),r(new f(t),e,i)},t.gunzipSync=function(e,t){return s(new f(t),e)},t.inflateRaw=function(e,t,i){return"function"==typeof t&&(i=t,t={}),r(new u(t),e,i)},t.inflateRawSync=function(e,t){return s(new u(t),e)},w.inherits(d,p),d.prototype.params=function(e,i,r){if(et.Z_MAX_LEVEL)throw new RangeError("Invalid compression level: "+e);if(i!=t.Z_FILTERED&&i!=t.Z_HUFFMAN_ONLY&&i!=t.Z_RLE&&i!=t.Z_FIXED&&i!=t.Z_DEFAULT_STRATEGY)throw new TypeError("Invalid strategy: "+i);if(this._level!==e||this._strategy!==i){var s=this;this.flush(b.Z_SYNC_FLUSH,function(){s._binding.params(e,i),s._hadError||(s._level=e,s._strategy=i,r&&r())})}else n.nextTick(r)},d.prototype.reset=function(){return this._binding.reset()},d.prototype._flush=function(t){this._transform(new e(0),"",t)},d.prototype.flush=function(t,i){var r=this._writableState;if(("function"==typeof t||void 0===t&&!i)&&(i=t,t=b.Z_FULL_FLUSH),r.ended)i&&n.nextTick(i);else if(r.ending)i&&this.once("end",i);else if(r.needDrain){var s=this;this.once("drain",function(){s.flush(i)})}else this._flushFlag=t,this.write(new e(0),"",i)},d.prototype.close=function(e){if(e&&n.nextTick(e),!this._closed){this._closed=!0,this._binding.close();var t=this;n.nextTick(function(){t.emit("close")})}},d.prototype._transform=function(t,i,n){var r,s=this._writableState,o=s.ending||s.ended,a=o&&(!t||s.length===t.length);if(null===!t&&!e.isBuffer(t))return n(new Error("invalid input"));a?r=b.Z_FINISH:(r=this._flushFlag,t.length>=s.length&&(this._flushFlag=this._opts.flush||b.Z_NO_FLUSH));this._processChunk(t,r,n)},d.prototype._processChunk=function(t,i,n){function r(h,d){if(!l._hadError){var p=o-d;if(m(p>=0,"have should not go down"),p>0){var b=l._buffer.slice(l._offset,l._offset+p);l._offset+=p,f?l.push(b):(u.push(b),c+=b.length)}if((0===d||l._offset>=l._chunkSize)&&(o=l._chunkSize,l._offset=0,l._buffer=new e(l._chunkSize)),0===d){if(a+=s-h,s=h,!f)return!0;var w=l._binding.write(i,t,a,s,l._buffer,l._offset,l._chunkSize);return w.callback=r,void(w.buffer=t)}return!!f&&void n()}}var s=t&&t.length,o=this._chunkSize-this._offset,a=0,l=this,f="function"==typeof n;if(!f){var h,u=[],c=0;this.on("error",function(e){h=e});do var d=this._binding.writeSync(i,t,a,s,this._buffer,this._offset,o);while(!this._hadError&&r(d[0],d[1]));if(this._hadError)throw h;var p=e.concat(u,c);return this.close(),p}var b=this._binding.write(i,t,a,s,this._buffer,this._offset,o);b.buffer=t,b.callback=r},w.inherits(o,d),w.inherits(a,d),w.inherits(l,d),w.inherits(f,d),w.inherits(h,d),w.inherits(u,d),w.inherits(c,d)}).call(t,i(58).Buffer,i(2))},function(e,t,i){e.exports=i(128)},function(e,t,i){function n(e,t){this.afterTransform=function(e,i){return r(t,e,i)},this.needTransform=!1,this.transforming=!1,this.writecb=null,this.writechunk=null}function r(e,t,i){var n=e._transformState;n.transforming=!1;var r=n.writecb;if(!r)return e.emit("error",new Error("no writecb in Transform class"));n.writechunk=null,n.writecb=null,l.isNullOrUndefined(i)||e.push(i),r&&r(t);var s=e._readableState;s.reading=!1,(s.needReadable||s.length0)if(t.ended&&!r){var a=new Error("stream.push() after EOF");e.emit("error",a)}else if(t.endEmitted&&r){var a=new Error("stream.unshift() after end event");e.emit("error",a)}else!t.decoder||r||n||(i=t.decoder.write(i)),r||(t.reading=!1),t.flowing&&0===t.length&&!t.sync?(e.emit("data",i),e.read(0)):(t.length+=t.objectMode?1:i.length,r?t.buffer.unshift(i):t.buffer.push(i),t.needReadable&&u(e)),d(e,t);else r||(t.reading=!1);return o(t)}function o(e){return!e.ended&&(e.needReadable||e.length=P)e=P;else{e--;for(var t=1;t<32;t<<=1)e|=e>>t;e++}return e}function l(e,t){return 0===t.length&&t.ended?0:t.objectMode?0===e?0:1:isNaN(e)||M.isNull(e)?t.flowing&&t.buffer.length?t.buffer[0].length:t.length:e<=0?0:(e>t.highWaterMark&&(t.highWaterMark=a(e)),e>t.length?t.ended?t.length:(t.needReadable=!0,0):e)}function f(e,t){var i=null;return M.isBuffer(t)||M.isString(t)||M.isNullOrUndefined(t)||e.objectMode||(i=new TypeError("Invalid non-string/buffer chunk")),i}function h(e,t){if(t.decoder&&!t.ended){var i=t.decoder.end();i&&i.length&&(t.buffer.push(i),t.length+=t.objectMode?1:i.length)}t.ended=!0,u(e)}function u(e){var i=e._readableState;i.needReadable=!1,i.emittedReadable||(C("emitReadable",i.flowing),i.emittedReadable=!0,i.sync?t.nextTick(function(){c(e)}):c(e))}function c(e){C("emit readable"),e.emit("readable"),g(e)}function d(e,i){i.readingMore||(i.readingMore=!0,t.nextTick(function(){p(e,i)}))}function p(e,t){for(var i=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=r)i=s?n.join(""):A.concat(n,r),n.length=0;else if(e0)throw new Error("endReadable called on non-empty stream");i.endEmitted||(i.ended=!0,t.nextTick(function(){i.endEmitted||0!==i.length||(i.endEmitted=!0,e.readable=!1,e.emit("end"))}))}function k(e,t){for(var i=0,n=e.length;i0)&&(t.emittedReadable=!1),0===e&&t.needReadable&&(t.length>=t.highWaterMark||t.ended))return C("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?v(this):u(this),null;if(e=l(e,t),0===e&&t.ended)return 0===t.length&&v(this),null;var n=t.needReadable;C("need readable",n),(0===t.length||t.length-e0?_(e,t):null,M.isNull(r)&&(t.needReadable=!0,e=0),t.length-=e,0!==t.length||t.ended||(t.needReadable=!0),i!==e&&t.ended&&0===t.length&&v(this),M.isNull(r)||this.emit("data",r),r},r.prototype._read=function(e){this.emit("error",new Error("not implemented"))},r.prototype.pipe=function(e,i){function n(e){C("onunpipe"),e===u&&s()}function r(){C("onend"),e.end()}function s(){C("cleanup"),e.removeListener("close",l),e.removeListener("finish",f),e.removeListener("drain",w),e.removeListener("error",a),e.removeListener("unpipe",n),u.removeListener("end",r),u.removeListener("end",s),u.removeListener("data",o),!c.awaitDrain||e._writableState&&!e._writableState.needDrain||w()}function o(t){C("ondata");var i=e.write(t);!1===i&&(C("false write response, pause",u._readableState.awaitDrain),u._readableState.awaitDrain++,u.pause())}function a(t){C("onerror",t),h(),e.removeListener("error",a),0===T.listenerCount(e,"error")&&e.emit("error",t)}function l(){e.removeListener("finish",f),h()}function f(){C("onfinish"),e.removeListener("close",l),h()}function h(){C("unpipe"),u.unpipe(e)}var u=this,c=this._readableState;switch(c.pipesCount){case 0:c.pipes=e;break;case 1:c.pipes=[c.pipes,e];break;default:c.pipes.push(e)}c.pipesCount+=1,C("pipe count=%d opts=%j",c.pipesCount,i);var d=(!i||i.end!==!1)&&e!==t.stdout&&e!==t.stderr,p=d?r:s;c.endEmitted?t.nextTick(p):u.once("end",p),e.on("unpipe",n);var w=b(u);return e.on("drain",w),u.on("data",o),e._events&&e._events.error?E(e._events.error)?e._events.error.unshift(a):e._events.error=[a,e._events.error]:e.on("error",a),e.once("close",l),e.once("finish",f),e.emit("pipe",u),c.flowing||(C("pipe resume"),u.resume()),e},r.prototype.unpipe=function(e){var t=this._readableState;if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this),this);if(!e){var i=t.pipes,n=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var r=0;r1){for(var i=[],n=0;nt.UNZIP)throw new TypeError("Bad argument");this.mode=e,this.init_done=!1,this.write_in_progress=!1,this.pending_close=!1,this.windowBits=0,this.level=0,this.memLevel=0,this.strategy=0,this.dictionary=null}function s(e,t){for(var i=0;i4?9:0)}function s(e){for(var t=e.length;--t>=0;)e[t]=0}function o(e){var t=e.state,i=t.pending;i>e.avail_out&&(i=e.avail_out),0!==i&&(P.arraySet(e.output,t.pending_buf,t.pending_out,i,e.next_out),e.next_out+=i,t.pending_out+=i,e.total_out+=i,e.avail_out-=i,t.pending-=i,0===t.pending&&(t.pending_out=0))}function a(e,t){x._tr_flush_block(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,o(e.strm)}function l(e,t){e.pending_buf[e.pending++]=t}function f(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function h(e,t,i,n){var r=e.avail_in;return r>n&&(r=n),0===r?0:(e.avail_in-=r,P.arraySet(t,e.input,e.next_in,r,i),1===e.state.wrap?e.adler=I(e.adler,t,r,i):2===e.state.wrap&&(e.adler=O(e.adler,t,r,i)),e.next_in+=r,e.total_in+=r,r)}function u(e,t){var i,n,r=e.max_chain_length,s=e.strstart,o=e.prev_length,a=e.nice_match,l=e.strstart>e.w_size-ue?e.strstart-(e.w_size-ue):0,f=e.window,h=e.w_mask,u=e.prev,c=e.strstart+he,d=f[s+o-1],p=f[s+o];e.prev_length>=e.good_match&&(r>>=2),a>e.lookahead&&(a=e.lookahead);do if(i=t,f[i+o]===p&&f[i+o-1]===d&&f[i]===f[s]&&f[++i]===f[s+1]){s+=2,i++;do;while(f[++s]===f[++i]&&f[++s]===f[++i]&&f[++s]===f[++i]&&f[++s]===f[++i]&&f[++s]===f[++i]&&f[++s]===f[++i]&&f[++s]===f[++i]&&f[++s]===f[++i]&&so){if(e.match_start=t,o=n,n>=a)break;d=f[s+o-1],p=f[s+o]}}while((t=u[t&h])>l&&0!==--r);return o<=e.lookahead?o:e.lookahead}function c(e){var t,i,n,r,s,o=e.w_size;do{if(r=e.window_size-e.lookahead-e.strstart,e.strstart>=o+(o-ue)){P.arraySet(e.window,e.window,o,o,0),e.match_start-=o,e.strstart-=o,e.block_start-=o,i=e.hash_size,t=i;do n=e.head[--t],e.head[t]=n>=o?n-o:0;while(--i);i=o,t=i;do n=e.prev[--t],e.prev[t]=n>=o?n-o:0;while(--i);r+=o}if(0===e.strm.avail_in)break;if(i=h(e.strm,e.window,e.strstart+e.lookahead,r),e.lookahead+=i,e.lookahead+e.insert>=fe)for(s=e.strstart-e.insert,e.ins_h=e.window[s],e.ins_h=(e.ins_h<e.pending_buf_size-5&&(i=e.pending_buf_size-5);;){if(e.lookahead<=1){if(c(e),0===e.lookahead&&t===D)return ve;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var n=e.block_start+i;if((0===e.strstart||e.strstart>=n)&&(e.lookahead=e.strstart-n,e.strstart=n,a(e,!1),0===e.strm.avail_out))return ve;if(e.strstart-e.block_start>=e.w_size-ue&&(a(e,!1),0===e.strm.avail_out))return ve}return e.insert=0,t===B?(a(e,!0),0===e.strm.avail_out?ye:Ee):e.strstart>e.block_start&&(a(e,!1),0===e.strm.avail_out)?ve:ve}function p(e,t){for(var i,n;;){if(e.lookahead=fe&&(e.ins_h=(e.ins_h<=fe)if(n=x._tr_tally(e,e.strstart-e.match_start,e.match_length-fe),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=fe){e.match_length--;do e.strstart++,e.ins_h=(e.ins_h<=fe&&(e.ins_h=(e.ins_h<4096)&&(e.match_length=fe-1)),e.prev_length>=fe&&e.match_length<=e.prev_length){r=e.strstart+e.lookahead-fe,n=x._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-fe),e.lookahead-=e.prev_length-1,e.prev_length-=2;do++e.strstart<=r&&(e.ins_h=(e.ins_h<=fe&&e.strstart>0&&(r=e.strstart-1,n=o[r],n===o[++r]&&n===o[++r]&&n===o[++r])){s=e.strstart+he;do;while(n===o[++r]&&n===o[++r]&&n===o[++r]&&n===o[++r]&&n===o[++r]&&n===o[++r]&&n===o[++r]&&n===o[++r]&&re.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=fe?(i=x._tr_tally(e,1,e.match_length-fe),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(i=x._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),i&&(a(e,!1),0===e.strm.avail_out))return ve}return e.insert=0,t===B?(a(e,!0),0===e.strm.avail_out?ye:Ee):e.last_lit&&(a(e,!1),0===e.strm.avail_out)?ve:ke}function m(e,t){for(var i;;){if(0===e.lookahead&&(c(e),0===e.lookahead)){if(t===D)return ve;break}if(e.match_length=0,i=x._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,i&&(a(e,!1),0===e.strm.avail_out))return ve}return e.insert=0,t===B?(a(e,!0),0===e.strm.avail_out?ye:Ee):e.last_lit&&(a(e,!1),0===e.strm.avail_out)?ve:ke}function g(e,t,i,n,r){this.good_length=e,this.max_lazy=t,this.nice_length=i,this.max_chain=n,this.func=r}function _(e){e.window_size=2*e.w_size,s(e.head),e.max_lazy_match=C[e.level].max_lazy,e.good_match=C[e.level].good_length,e.nice_match=C[e.level].nice_length,e.max_chain_length=C[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=fe-1,e.match_available=0,e.ins_h=0}function v(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=J,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new P.Buf16(2*ae),this.dyn_dtree=new P.Buf16(2*(2*se+1)),this.bl_tree=new P.Buf16(2*(2*oe+1)),s(this.dyn_ltree),s(this.dyn_dtree),s(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new P.Buf16(le+1),this.heap=new P.Buf16(2*re+1),s(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new P.Buf16(2*re+1),s(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function k(e){var t;return e&&e.state?(e.total_in=e.total_out=0,e.data_type=X,t=e.state,t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap?de:ge,e.adler=2===t.wrap?0:1,t.last_flush=D,x._tr_init(t),F):n(e,H)}function y(e){var t=k(e);return t===F&&_(e.state),t}function E(e,t){return e&&e.state?2!==e.state.wrap?H:(e.state.gzhead=t,F):H}function A(e,t,i,r,s,o){if(!e)return H;var a=1;if(t===W&&(t=6),r<0?(a=0,r=-r):r>15&&(a=2,r-=16),s<1||s>Q||i!==J||r<8||r>15||t<0||t>9||o<0||o>$)return n(e,H);8===r&&(r=9);var l=new v;return e.state=l,l.strm=e,l.wrap=a,l.gzhead=null,l.w_bits=r,l.w_size=1<j||t<0)return e?n(e,H):H;if(a=e.state,!e.output||!e.input&&0!==e.avail_in||a.status===_e&&t!==B)return n(e,0===e.avail_out?q:H);if(a.strm=e,i=a.last_flush,a.last_flush=t,a.status===de)if(2===a.wrap)e.adler=0,l(a,31),l(a,139),l(a,8),a.gzhead?(l(a,(a.gzhead.text?1:0)+(a.gzhead.hcrc?2:0)+(a.gzhead.extra?4:0)+(a.gzhead.name?8:0)+(a.gzhead.comment?16:0)),l(a,255&a.gzhead.time),l(a,a.gzhead.time>>8&255),l(a,a.gzhead.time>>16&255),l(a,a.gzhead.time>>24&255),l(a,9===a.level?2:a.strategy>=Y||a.level<2?4:0),l(a,255&a.gzhead.os),a.gzhead.extra&&a.gzhead.extra.length&&(l(a,255&a.gzhead.extra.length),l(a,a.gzhead.extra.length>>8&255)),a.gzhead.hcrc&&(e.adler=O(e.adler,a.pending_buf,a.pending,0)),a.gzindex=0,a.status=pe):(l(a,0),l(a,0),l(a,0),l(a,0),l(a,0),l(a,9===a.level?2:a.strategy>=Y||a.level<2?4:0),l(a,Ae),a.status=ge);else{var c=J+(a.w_bits-8<<4)<<8,d=-1;d=a.strategy>=Y||a.level<2?0:a.level<6?1:6===a.level?2:3,c|=d<<6,0!==a.strstart&&(c|=ce),c+=31-c%31,a.status=ge,f(a,c),0!==a.strstart&&(f(a,e.adler>>>16),f(a,65535&e.adler)),e.adler=1}if(a.status===pe)if(a.gzhead.extra){for(h=a.pending;a.gzindex<(65535&a.gzhead.extra.length)&&(a.pending!==a.pending_buf_size||(a.gzhead.hcrc&&a.pending>h&&(e.adler=O(e.adler,a.pending_buf,a.pending-h,h)),o(e),h=a.pending,a.pending!==a.pending_buf_size));)l(a,255&a.gzhead.extra[a.gzindex]),a.gzindex++;a.gzhead.hcrc&&a.pending>h&&(e.adler=O(e.adler,a.pending_buf,a.pending-h,h)),a.gzindex===a.gzhead.extra.length&&(a.gzindex=0,a.status=be)}else a.status=be;if(a.status===be)if(a.gzhead.name){h=a.pending;do{if(a.pending===a.pending_buf_size&&(a.gzhead.hcrc&&a.pending>h&&(e.adler=O(e.adler,a.pending_buf,a.pending-h,h)),o(e),h=a.pending,a.pending===a.pending_buf_size)){u=1;break}u=a.gzindexh&&(e.adler=O(e.adler,a.pending_buf,a.pending-h,h)),0===u&&(a.gzindex=0,a.status=we)}else a.status=we;if(a.status===we)if(a.gzhead.comment){h=a.pending;do{if(a.pending===a.pending_buf_size&&(a.gzhead.hcrc&&a.pending>h&&(e.adler=O(e.adler,a.pending_buf,a.pending-h,h)),o(e),h=a.pending,a.pending===a.pending_buf_size)){u=1;break}u=a.gzindexh&&(e.adler=O(e.adler,a.pending_buf,a.pending-h,h)),0===u&&(a.status=me)}else a.status=me;if(a.status===me&&(a.gzhead.hcrc?(a.pending+2>a.pending_buf_size&&o(e),a.pending+2<=a.pending_buf_size&&(l(a,255&e.adler),l(a,e.adler>>8&255),e.adler=0,a.status=ge)):a.status=ge),0!==a.pending){if(o(e),0===e.avail_out)return a.last_flush=-1,F}else if(0===e.avail_in&&r(t)<=r(i)&&t!==B)return n(e,q);if(a.status===_e&&0!==e.avail_in)return n(e,q);if(0!==e.avail_in||0!==a.lookahead||t!==D&&a.status!==_e){var p=a.strategy===Y?m(a,t):a.strategy===Z?w(a,t):C[a.level].func(a,t);if(p!==ye&&p!==Ee||(a.status=_e),p===ve||p===ye)return 0===e.avail_out&&(a.last_flush=-1),F;if(p===ke&&(t===L?x._tr_align(a):t!==j&&(x._tr_stored_block(a,0,0,!1),t===U&&(s(a.head),0===a.lookahead&&(a.strstart=0,a.block_start=0,a.insert=0))),o(e),0===e.avail_out))return a.last_flush=-1,F}return t!==B?F:a.wrap<=0?G:(2===a.wrap?(l(a,255&e.adler),l(a,e.adler>>8&255),l(a,e.adler>>16&255),l(a,e.adler>>24&255),l(a,255&e.total_in),l(a,e.total_in>>8&255),l(a,e.total_in>>16&255),l(a,e.total_in>>24&255)):(f(a,e.adler>>>16),f(a,65535&e.adler)),o(e),a.wrap>0&&(a.wrap=-a.wrap),0!==a.pending?F:G)}function M(e){var t;return e&&e.state?(t=e.state.status,t!==de&&t!==pe&&t!==be&&t!==we&&t!==me&&t!==ge&&t!==_e?n(e,H):(e.state=null,t===ge?n(e,z):F)):H}function R(e,t){var i,n,r,o,a,l,f,h,u=t.length;if(!e||!e.state)return H;if(i=e.state,o=i.wrap,2===o||1===o&&i.status!==de||i.lookahead)return H;for(1===o&&(e.adler=I(e.adler,t,u,0)),i.wrap=0,u>=i.w_size&&(0===o&&(s(i.head),i.strstart=0,i.block_start=0,i.insert=0),h=new P.Buf8(i.w_size),P.arraySet(h,t,u-i.w_size,i.w_size,0),t=h,u=i.w_size),a=e.avail_in,l=e.next_in,f=e.input,e.avail_in=u,e.next_in=0,e.input=t,c(i);i.lookahead>=fe;){n=i.strstart,r=i.lookahead-(fe-1);do i.ins_h=(i.ins_h<=0;)e[t]=0}function r(e,t,i,n,r){this.static_tree=e,this.extra_bits=t,this.extra_base=i,this.elems=n,this.max_length=r,this.has_stree=e&&e.length}function s(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function o(e){return e<256?le[e]:le[256+(e>>>7)]}function a(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function l(e,t,i){e.bi_valid>$-i?(e.bi_buf|=t<>$-e.bi_valid,e.bi_valid+=i-$):(e.bi_buf|=t<>>=1,i<<=1;while(--t>0);return i>>>1}function u(e){16===e.bi_valid?(a(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}function c(e,t){var i,n,r,s,o,a,l=t.dyn_tree,f=t.max_code,h=t.stat_desc.static_tree,u=t.stat_desc.has_stree,c=t.stat_desc.extra_bits,d=t.stat_desc.extra_base,p=t.stat_desc.max_length,b=0;for(s=0;s<=Z;s++)e.bl_count[s]=0;for(l[2*e.heap[e.heap_max]+1]=0,i=e.heap_max+1;ip&&(s=p,b++),l[2*n+1]=s,n>f||(e.bl_count[s]++,o=0,n>=d&&(o=c[n-d]),a=l[2*n],e.opt_len+=a*(s+o),u&&(e.static_len+=a*(h[2*n+1]+o)));if(0!==b){do{for(s=p-1;0===e.bl_count[s];)s--;e.bl_count[s]--,e.bl_count[s+1]+=2,e.bl_count[p]--,b-=2}while(b>0);for(s=p;0!==s;s--)for(n=e.bl_count[s];0!==n;)r=e.heap[--i],r>f||(l[2*r+1]!==s&&(e.opt_len+=(s-l[2*r+1])*l[2*r],l[2*r+1]=s),n--)}}function d(e,t,i){var n,r,s=new Array(Z+1),o=0;for(n=1;n<=Z;n++)s[n]=o=o+i[n-1]<<1;for(r=0;r<=t;r++){var a=e[2*r+1];0!==a&&(e[2*r]=h(s[a]++,a))}}function p(){var e,t,i,n,s,o=new Array(Z+1);for(i=0,n=0;n>=7;n8?a(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0}function m(e,t,i,n){w(e),n&&(a(e,i),a(e,~i)),I.arraySet(e.pending_buf,e.window,t,i,e.pending),e.pending+=i}function g(e,t,i,n){var r=2*t,s=2*i;return e[r]>1;i>=1;i--)_(e,s,i);r=l;do i=e.heap[1],e.heap[1]=e.heap[e.heap_len--],_(e,s,1),n=e.heap[1],e.heap[--e.heap_max]=i,e.heap[--e.heap_max]=n,s[2*r]=s[2*i]+s[2*n],e.depth[r]=(e.depth[i]>=e.depth[n]?e.depth[i]:e.depth[n])+1,s[2*i+1]=s[2*n+1]=r,e.heap[1]=r++,_(e,s,1);while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],c(e,t),d(s,f,e.bl_count)}function y(e,t,i){var n,r,s=-1,o=t[1],a=0,l=7,f=4;for(0===o&&(l=138,f=3),t[2*(i+1)+1]=65535,n=0;n<=i;n++)r=o,o=t[2*(n+1)+1],++a=3&&0===e.bl_tree[2*re[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t}function T(e,t,i,n){var r;for(l(e,t-257,5),l(e,i-1,5),l(e,n-4,4),r=0;r>>=1)if(1&i&&0!==e.dyn_ltree[2*t])return N;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return D;for(t=32;t0?(e.strm.data_type===L&&(e.strm.data_type=S(e)),k(e,e.l_desc),k(e,e.d_desc),o=A(e),r=e.opt_len+3+7>>>3,s=e.static_len+3+7>>>3,s<=r&&(r=s)):r=s=i+5,i+4<=r&&t!==-1?R(e,t,i,n):e.strategy===O||s===r?(l(e,(B<<1)+(n?1:0),3),v(e,oe,ae)):(l(e,(j<<1)+(n?1:0),3),T(e,e.l_desc.max_code+1,e.d_desc.max_code+1,o+1),v(e,e.dyn_ltree,e.dyn_dtree)),b(e),n&&w(e)}function x(e,t,i){return e.pending_buf[e.d_buf+2*e.last_lit]=t>>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&i,e.last_lit++,0===t?e.dyn_ltree[2*i]++:(e.matches++,t--,e.dyn_ltree[2*(fe[i]+z+1)]++,e.dyn_dtree[2*o(t)]++),e.last_lit===e.lit_bufsize-1}var I=i(138),O=4,N=0,D=1,L=2,U=0,B=1,j=2,F=3,G=258,H=29,z=256,q=z+1+H,W=30,V=19,Y=2*q+1,Z=15,$=16,K=7,X=256,J=16,Q=17,ee=18,te=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],ie=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],ne=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],re=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],se=512,oe=new Array(2*(q+2));n(oe);var ae=new Array(2*W);n(ae);var le=new Array(se);n(le);var fe=new Array(G-F+1);n(fe);var he=new Array(H);n(he);var ue=new Array(W);n(ue);var ce,de,pe,be=!1;t._tr_init=M,t._tr_stored_block=R,t._tr_flush_block=P,t._tr_tally=x,t._tr_align=C},function(e,t){"use strict";function i(e,t,i,n){for(var r=65535&e|0,s=e>>>16&65535|0,o=0;0!==i;){o=i>2e3?2e3:i,i-=o;do r=r+t[n++]|0,s=s+r|0;while(--o);r%=65521,s%=65521}return r|s<<16|0}e.exports=i},function(e,t){"use strict";function i(){for(var e,t=[],i=0;i<256;i++){e=i;for(var n=0;n<8;n++)e=1&e?3988292384^e>>>1:e>>>1;t[i]=e}return t}function n(e,t,i,n){var s=r,o=n+i;e^=-1;for(var a=n;a>>8^s[255&(e^t[a])];return e^-1}var r=i();e.exports=n},function(e,t,i){"use strict";function n(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function r(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new g.Buf16(320),this.work=new g.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function s(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=U,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new g.Buf32(be),t.distcode=t.distdyn=new g.Buf32(we),t.sane=1,t.back=-1,C):I}function o(e){var t;return e&&e.state?(t=e.state,t.wsize=0,t.whave=0,t.wnext=0,s(e)):I}function a(e,t){var i,n;return e&&e.state?(n=e.state,t<0?(i=0,t=-t):(i=(t>>4)+1,t<48&&(t&=15)),t&&(t<8||t>15)?I:(null!==n.window&&n.wbits!==t&&(n.window=null),n.wrap=i,n.wbits=t,o(e))):I}function l(e,t){var i,n;return e?(n=new r,e.state=n,n.window=null,i=a(e,t),i!==C&&(e.state=null),i):I}function f(e){return l(e,ge)}function h(e){if(_e){var t;for(w=new g.Buf32(512),m=new g.Buf32(32),t=0;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(y(A,e.lens,0,288,w,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;y(T,e.lens,0,32,m,0,e.work,{bits:5}),_e=!1}e.lencode=w,e.lenbits=9,e.distcode=m,e.distbits=5}function u(e,t,i,n){var r,s=e.state;return null===s.window&&(s.wsize=1<=s.wsize?(g.arraySet(s.window,t,i-s.wsize,s.wsize,0),s.wnext=0,s.whave=s.wsize):(r=s.wsize-s.wnext,r>n&&(r=n),g.arraySet(s.window,t,i-n,r,s.wnext),n-=r,n?(g.arraySet(s.window,t,i-n,n,0),s.wnext=n,s.whave=s.wsize):(s.wnext+=r,s.wnext===s.wsize&&(s.wnext=0),s.whave>>8&255,i.check=v(i.check,Me,2,0),c=0,d=0,i.mode=B;break}if(i.flags=0,i.head&&(i.head.done=!1),!(1&i.wrap)||(((255&c)<<8)+(c>>8))%31){e.msg="incorrect header check",i.mode=ce;break}if((15&c)!==L){e.msg="unknown compression method",i.mode=ce;break}if(c>>>=4,d-=4,ye=(15&c)+8,0===i.wbits)i.wbits=ye;else if(ye>i.wbits){e.msg="invalid window size",i.mode=ce;break}i.dmax=1<>8&1),512&i.flags&&(Me[0]=255&c,Me[1]=c>>>8&255,i.check=v(i.check,Me,2,0)),c=0,d=0,i.mode=j;case j:for(;d<32;){if(0===l)break e;l--,c+=r[o++]<>>8&255,Me[2]=c>>>16&255,Me[3]=c>>>24&255,i.check=v(i.check,Me,4,0)),c=0,d=0,i.mode=F;case F:for(;d<16;){if(0===l)break e;l--,c+=r[o++]<>8),512&i.flags&&(Me[0]=255&c,Me[1]=c>>>8&255,i.check=v(i.check,Me,2,0)),c=0,d=0,i.mode=G;case G:if(1024&i.flags){for(;d<16;){if(0===l)break e;l--,c+=r[o++]<>>8&255,i.check=v(i.check,Me,2,0)),c=0,d=0}else i.head&&(i.head.extra=null);i.mode=H;case H:if(1024&i.flags&&(w=i.length,w>l&&(w=l),w&&(i.head&&(ye=i.head.extra_len-i.length,i.head.extra||(i.head.extra=new Array(i.head.extra_len)),g.arraySet(i.head.extra,r,o,w,ye)),512&i.flags&&(i.check=v(i.check,r,w,o)),l-=w,o+=w,i.length-=w),i.length))break e;i.length=0,i.mode=z;case z:if(2048&i.flags){if(0===l)break e;w=0;do ye=r[o+w++],i.head&&ye&&i.length<65536&&(i.head.name+=String.fromCharCode(ye));while(ye&&w>9&1,i.head.done=!0),e.adler=i.check=0,i.mode=Z;break;case V:for(;d<32;){if(0===l)break e;l--,c+=r[o++]<>>=7&d,d-=7&d,i.mode=fe;break}for(;d<3;){if(0===l)break e;l--,c+=r[o++]<>>=1,d-=1,3&c){case 0:i.mode=K;break;case 1:if(h(i),i.mode=ie,t===R){c>>>=2,d-=2;break e}break;case 2:i.mode=Q;break;case 3:e.msg="invalid block type",i.mode=ce}c>>>=2,d-=2;break;case K:for(c>>>=7&d,d-=7&d;d<32;){if(0===l)break e;l--,c+=r[o++]<>>16^65535)){e.msg="invalid stored block lengths",i.mode=ce;break}if(i.length=65535&c,c=0,d=0,i.mode=X,t===R)break e;case X:i.mode=J;case J:if(w=i.length){if(w>l&&(w=l),w>f&&(w=f),0===w)break e;g.arraySet(s,r,o,w,a),l-=w,o+=w,f-=w,a+=w,i.length-=w;break}i.mode=Z;break;case Q:for(;d<14;){if(0===l)break e;l--,c+=r[o++]<>>=5,d-=5,i.ndist=(31&c)+1,c>>>=5,d-=5,i.ncode=(15&c)+4,c>>>=4,d-=4,i.nlen>286||i.ndist>30){e.msg="too many length or distance symbols",i.mode=ce;break}i.have=0,i.mode=ee;case ee:for(;i.have>>=3,d-=3}for(;i.have<19;)i.lens[Re[i.have++]]=0;if(i.lencode=i.lendyn,i.lenbits=7,Ae={bits:i.lenbits},Ee=y(E,i.lens,0,19,i.lencode,0,i.work,Ae),i.lenbits=Ae.bits,Ee){e.msg="invalid code lengths set",i.mode=ce;break}i.have=0,i.mode=te;case te:for(;i.have>>24,me=Se>>>16&255,ge=65535&Se,!(we<=d);){if(0===l)break e;l--,c+=r[o++]<>>=we,d-=we,i.lens[i.have++]=ge;else{if(16===ge){for(Te=we+2;d>>=we,d-=we,0===i.have){e.msg="invalid bit length repeat",i.mode=ce;break}ye=i.lens[i.have-1],w=3+(3&c),c>>>=2,d-=2}else if(17===ge){for(Te=we+3;d>>=we,d-=we,ye=0,w=3+(7&c),c>>>=3,d-=3}else{for(Te=we+7;d>>=we,d-=we,ye=0,w=11+(127&c),c>>>=7,d-=7}if(i.have+w>i.nlen+i.ndist){e.msg="invalid bit length repeat",i.mode=ce;break}for(;w--;)i.lens[i.have++]=ye}}if(i.mode===ce)break;if(0===i.lens[256]){e.msg="invalid code -- missing end-of-block",i.mode=ce;break}if(i.lenbits=9,Ae={bits:i.lenbits},Ee=y(A,i.lens,0,i.nlen,i.lencode,0,i.work,Ae),i.lenbits=Ae.bits,Ee){e.msg="invalid literal/lengths set",i.mode=ce;break}if(i.distbits=6,i.distcode=i.distdyn,Ae={bits:i.distbits},Ee=y(T,i.lens,i.nlen,i.ndist,i.distcode,0,i.work,Ae),i.distbits=Ae.bits,Ee){e.msg="invalid distances set",i.mode=ce;break}if(i.mode=ie,t===R)break e;case ie:i.mode=ne;case ne:if(l>=6&&f>=258){e.next_out=a,e.avail_out=f,e.next_in=o,e.avail_in=l,i.hold=c,i.bits=d,k(e,b),a=e.next_out,s=e.output,f=e.avail_out,o=e.next_in,r=e.input,l=e.avail_in,c=i.hold,d=i.bits,i.mode===Z&&(i.back=-1);break}for(i.back=0;Se=i.lencode[c&(1<>>24,me=Se>>>16&255,ge=65535&Se,!(we<=d);){if(0===l)break e;l--,c+=r[o++]<>_e)],we=Se>>>24,me=Se>>>16&255,ge=65535&Se,!(_e+we<=d);){if(0===l)break e;l--,c+=r[o++]<>>=_e,d-=_e,i.back+=_e}if(c>>>=we,d-=we,i.back+=we,i.length=ge,0===me){i.mode=le;break}if(32&me){i.back=-1,i.mode=Z;break}if(64&me){e.msg="invalid literal/length code",i.mode=ce;break}i.extra=15&me,i.mode=re;case re:if(i.extra){for(Te=i.extra;d>>=i.extra,d-=i.extra,i.back+=i.extra}i.was=i.length,i.mode=se;case se:for(;Se=i.distcode[c&(1<>>24,me=Se>>>16&255,ge=65535&Se,!(we<=d);){if(0===l)break e;l--,c+=r[o++]<>_e)],we=Se>>>24,me=Se>>>16&255,ge=65535&Se,!(_e+we<=d);){if(0===l)break e;l--,c+=r[o++]<>>=_e,d-=_e,i.back+=_e}if(c>>>=we,d-=we,i.back+=we,64&me){e.msg="invalid distance code",i.mode=ce;break}i.offset=ge,i.extra=15&me,i.mode=oe;case oe:if(i.extra){for(Te=i.extra;d>>=i.extra,d-=i.extra,i.back+=i.extra}if(i.offset>i.dmax){e.msg="invalid distance too far back",i.mode=ce;break}i.mode=ae;case ae:if(0===f)break e;if(w=b-f,i.offset>w){if(w=i.offset-w,w>i.whave&&i.sane){e.msg="invalid distance too far back",i.mode=ce;break}w>i.wnext?(w-=i.wnext,m=i.wsize-w):m=i.wnext-w,w>i.length&&(w=i.length),be=i.window}else be=s,m=a-i.offset,w=i.length;w>f&&(w=f),f-=w,i.length-=w;do s[a++]=be[m++];while(--w);0===i.length&&(i.mode=ne);break;case le:if(0===f)break e;s[a++]=i.length,f--,i.mode=ne;break;case fe:if(i.wrap){for(;d<32;){if(0===l)break e;l--,c|=r[o++]<>>24,b>>>=y,w-=y,y=k>>>16&255,0===y)R[a++]=65535&k;else{if(!(16&y)){if(0===(64&y)){k=m[(65535&k)+(b&(1<>>=y,w-=y),w<15&&(b+=M[s++]<>>24,b>>>=y,w-=y,y=k>>>16&255,!(16&y)){if(0===(64&y)){k=g[(65535&k)+(b&(1<h){e.msg="invalid distance too far back",r.mode=i;break e}if(b>>>=y,w-=y,y=a-l,A>y){if(y=A-y,y>c&&r.sane){e.msg="invalid distance too far back",r.mode=i;break e}if(T=0,S=p,0===d){if(T+=u-y,y2;)R[a++]=S[T++],R[a++]=S[T++],R[a++]=S[T++],E-=3;E&&(R[a++]=S[T++],E>1&&(R[a++]=S[T++]))}else{T=a-A;do R[a++]=R[T++],R[a++]=R[T++],R[a++]=R[T++],E-=3;while(E>2);E&&(R[a++]=R[T++],E>1&&(R[a++]=R[T++]))}break}}break}}while(s>3,s-=E,w-=E<<3,b&=(1<=1&&0===G[I];I--);if(O>I&&(O=I),0===I)return b[w++]=20971520,b[w++]=20971520,g.bits=1,0;for(x=1;x0&&(e===a||1!==I))return-1;for(H[1]=0,C=1;Cs||e===f&&U>o)return 1;for(var W=0;;){W++,T=C-D,m[P]A?(S=z[q+m[P]],M=j[F+m[P]]):(S=96,M=0),_=1<>D)+v]=T<<24|S<<16|M|0;while(0!==v);for(_=1<>=1;if(0!==_?(B&=_-1,B+=_):B=0,P++,0===--G[C]){if(C===I)break;C=t[i+m[P]]}if(C>O&&(B&y)!==k){for(0===D&&(D=O),E+=x,N=C-D,L=1<s||e===f&&U>o)return 1;k=B&y,b[k]=O<<24|N<<16|E-w|0}}return 0!==B&&(b[E+B]=C-D<<24|64<<16|0),g.bits=O,0}},function(e,t){"use strict";e.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},function(e,t,i){(function(t){"use strict";/*! - * The buffer module from node.js, for the browser. - * - * @author Feross Aboukhadijeh - * @license MIT - */ -function n(e,t){if(e===t)return 0;for(var i=e.length,n=t.length,r=0,s=Math.min(i,n);r=0;a--)if(l[a]!==f[a])return!1;for(a=l.length-1;a>=0;a--)if(o=l[a],!d(e[o],t[o],i,n))return!1;return!0}function w(e,t,i){d(e,t,!0)&&u(e,t,i,"notDeepStrictEqual",w)}function m(e,t){if(!e||!t)return!1;if("[object RegExp]"==Object.prototype.toString.call(t))return t.test(e);try{if(e instanceof t)return!0}catch(e){}return!Error.isPrototypeOf(t)&&t.call({},e)===!0}function g(e){var t;try{e()}catch(e){t=e}return t}function _(e,t,i,n){var r;if("function"!=typeof t)throw new TypeError('"block" argument must be a function');"string"==typeof i&&(n=i,i=null),r=g(t),n=(i&&i.name?" ("+i.name+").":".")+(n?" "+n:"."),e&&!r&&u(r,i,"Missing expected exception"+n);var s="string"==typeof n,o=!e&&v.isError(r),a=!e&&r&&!i;if((o&&s&&m(r,i)||a)&&u(r,i,"Got unwanted exception"+n),e&&r&&i&&!m(r,i)||!e&&r)throw r}var v=i(75),k=Object.prototype.hasOwnProperty,y=Array.prototype.slice,E=function(){return"foo"===function(){}.name}(),A=e.exports=c,T=/\s*function\s+([^\(\s]*)\s*/;A.AssertionError=function(e){this.name="AssertionError",this.actual=e.actual,this.expected=e.expected,this.operator=e.operator,e.message?(this.message=e.message,this.generatedMessage=!1):(this.message=h(this),this.generatedMessage=!0);var t=e.stackStartFunction||u;if(Error.captureStackTrace)Error.captureStackTrace(this,t);else{var i=new Error;if(i.stack){var n=i.stack,r=a(t),s=n.indexOf("\n"+r);if(s>=0){var o=n.indexOf("\n",s+1);n=n.substring(o+1)}this.stack=n}}},v.inherits(A.AssertionError,Error),A.fail=u,A.ok=c,A.equal=function(e,t,i){e!=t&&u(e,t,i,"==",A.equal)},A.notEqual=function(e,t,i){e==t&&u(e,t,i,"!=",A.notEqual)},A.deepEqual=function(e,t,i){d(e,t,!1)||u(e,t,i,"deepEqual",A.deepEqual)},A.deepStrictEqual=function(e,t,i){d(e,t,!0)||u(e,t,i,"deepStrictEqual",A.deepStrictEqual)},A.notDeepEqual=function(e,t,i){d(e,t,!1)&&u(e,t,i,"notDeepEqual",A.notDeepEqual)},A.notDeepStrictEqual=w,A.strictEqual=function(e,t,i){e!==t&&u(e,t,i,"===",A.strictEqual)},A.notStrictEqual=function(e,t,i){e===t&&u(e,t,i,"!==",A.notStrictEqual)},A.throws=function(e,t,i){_(!0,e,t,i)},A.doesNotThrow=function(e,t,i){_(!1,e,t,i)},A.ifError=function(e){if(e)throw e};var S=Object.keys||function(e){var t=[];for(var i in e)k.call(e,i)&&t.push(i);return t}}).call(t,function(){return this}())},function(e,t,i){(function(t){function n(e,i){if(this instanceof n==!1)throw new TypeError("Classes can't be function-called");"number"==typeof e&&(i=e,e={});var r=-1;this.fragmentedBufferPool=new h(1024,function(e,t){return e.used+t},function(e){return r=r>=0?Math.ceil((r+e.used)/2):e.used});var s=-1;this.unfragmentedBufferPool=new h(1024,function(e,t){return e.used+t},function(e){return s=s>=0?Math.ceil((s+e.used)/2):e.used}),this.extensions=e||{},this.maxPayload=i||0,this.currentPayloadLength=0,this.state={activeFragmentedOperation:null,lastFragment:!1,masked:!1,opcode:0,fragmentedOperation:!1},this.overflow=[],this.headerBuffer=new t(10),this.expectOffset=0,this.expectBuffer=null,this.expectHandler=null,this.currentMessage=[],this.currentMessageLength=0,this.messageHandlers=[],this.expectHeader(2,this.processPacket),this.dead=!1,this.processing=!1,this.onerror=function(){},this.ontext=function(){},this.onbinary=function(){},this.onclose=function(){},this.onping=function(){},this.onpong=function(){}}function r(e){return(this[e]<<8)+this[e+1]}function s(e){return(this[e]<<24)+(this[e+1]<<16)+(this[e+2]<<8)+this[e+3]}function o(e,t,i,n){switch(e){default:t.copy(i,n,0,e);break;case 16:i[n+15]=t[15];case 15:i[n+14]=t[14];case 14:i[n+13]=t[13];case 13:i[n+12]=t[12];case 12:i[n+11]=t[11];case 11:i[n+10]=t[10];case 10:i[n+9]=t[9];case 9:i[n+8]=t[8];case 8:i[n+7]=t[7];case 7:i[n+6]=t[6];case 6:i[n+5]=t[5];case 5:i[n+4]=t[4];case 4:i[n+3]=t[3];case 3:i[n+2]=t[2];case 2:i[n+1]=t[1];case 1:i[n]=t[0]}}function a(e){var t={};for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i]);return t}/*! - * ws: a node.js websocket client - * Copyright(c) 2011 Einar Otto Stangvik - * MIT Licensed - */ -var l=(i(75),i(148).Validation),f=i(117),h=i(152),u=i(118).BufferUtil,c=i(125);e.exports=n,n.prototype.add=function(e){if(!this.dead){var t=e.length;if(0!=t){if(null==this.expectBuffer)return void this.overflow.push(e);var i=Math.min(t,this.expectBuffer.length-this.expectOffset);for(o(i,e,this.expectBuffer,this.expectOffset),this.expectOffset+=i,i0&&this.overflow.length>0;){var n=this.overflow.pop();i0&&this.overflow.length>0;){var n=this.overflow.pop();i=8&&t)return void this.error("control frames cannot have the Per-message Compressed bits",1002);this.state.compressed=t,this.state.opcode=i,this.state.lastFragment===!1?(this.state.fragmentedOperation=!0,this.state.activeFragmentedOperation=i):this.state.fragmentedOperation=!1}var n=d[this.state.opcode];"undefined"==typeof n?this.error("no handler for opcode "+this.state.opcode,1002):n.start.call(this,e)},n.prototype.endPacket=function(){this.dead||(this.state.fragmentedOperation?this.state.lastFragment&&this.fragmentedBufferPool.reset(!0):this.unfragmentedBufferPool.reset(!0),this.expectOffset=0,this.expectBuffer=null,this.expectHandler=null,this.state.lastFragment&&this.state.opcode===this.state.activeFragmentedOperation&&(this.state.activeFragmentedOperation=null),this.currentPayloadLength=0,this.state.lastFragment=!1,this.state.opcode=null!=this.state.activeFragmentedOperation?this.state.activeFragmentedOperation:0,this.state.masked=!1,this.expectHeader(2,this.processPacket))},n.prototype.reset=function(){this.dead||(this.state={activeFragmentedOperation:null,lastFragment:!1,masked:!1,opcode:0,fragmentedOperation:!1},this.fragmentedBufferPool.reset(!0),this.unfragmentedBufferPool.reset(!0),this.expectOffset=0,this.expectBuffer=null,this.expectHandler=null,this.overflow=[],this.currentMessage=[],this.currentMessageLength=0,this.messageHandlers=[],this.currentPayloadLength=0)},n.prototype.unmask=function(e,t,i){return null!=e&&null!=t&&u.unmask(t,e),i?t:null!=t?t.toString("utf8"):""},n.prototype.error=function(e,t){if(!this.dead)return this.reset(),"string"==typeof e?this.onerror(new Error(e),t):e.constructor==Error?this.onerror(e,t):this.onerror(new Error("An error occured"),t),this},n.prototype.flush=function(){if(!this.processing&&!this.dead){var e=this.messageHandlers.shift();if(e){this.processing=!0;var t=this;e(function(){t.processing=!1,t.flush()})}}},n.prototype.applyExtensions=function(e,t,i,n){var r=this;i?this.extensions[c.extensionName].decompress(e,t,function(e,t){if(!r.dead)return e?void n(new Error("invalid compressed data")):void n(null,t)}):n(null,e)},n.prototype.maxPayloadExceeded=function(e){if(void 0===this.maxPayload||null===this.maxPayload||this.maxPayload<1)return!1;var t=this.currentPayloadLength+e;return t0&&n.currentMessageLength+r.length0&&n.currentMessageLength+r.length1?r.call(t,0):1e3;if(!f.isValidErrorCode(e))return void i.error("invalid error code",1002);var s="";if(t&&t.length>2){var o=t.slice(2);if(!l.isValidUTF8(o))return void i.error("invalid utf8 sequence",1007);s=o.toString("utf8")}i.onclose(e,s,{masked:n.masked}),i.reset()}),this.flush()}},9:{start:function(e){var t=this;if(0==t.state.lastFragment)return void t.error("fragmented ping is not supported",1002);var i=127&e[1];i<126?d[9].getData.call(t,i):t.error("control frames cannot have more than 125 bytes of data",1002)},getData:function(e){var t=this;t.state.masked?t.expectHeader(4,function(i){var n=i;t.expectData(e,function(e){d[9].finish.call(t,n,e)})}):t.expectData(e,function(e){d[9].finish.call(t,null,e)})},finish:function(e,t){var i=this;t=this.unmask(e,t,!0);var n=a(this.state);this.messageHandlers.push(function(e){i.onping(t,{masked:n.masked,binary:!0}),e()}),this.flush(),this.endPacket()}},10:{start:function(e){var t=this;if(0==t.state.lastFragment)return void t.error("fragmented pong is not supported",1002);var i=127&e[1];i<126?d[10].getData.call(t,i):t.error("control frames cannot have more than 125 bytes of data",1002)},getData:function(e){var t=this;this.state.masked?this.expectHeader(4,function(i){var n=i;t.expectData(e,function(e){d[10].finish.call(t,n,e)})}):this.expectData(e,function(e){d[10].finish.call(t,null,e)})},finish:function(e,t){var i=this;t=i.unmask(e,t,!0);var n=a(this.state);this.messageHandlers.push(function(e){i.onpong(t,{masked:n.masked,binary:!0}),e()}),this.flush(),this.endPacket()}}}}).call(t,i(58).Buffer)},function(e,t,i){"use strict";/*! - * ws: a node.js websocket client - * Copyright(c) 2011 Einar Otto Stangvik - * MIT Licensed - */ -try{e.exports=i(149)}catch(t){e.exports=i(151)}},function(e,t,i){"use strict";try{e.exports=i(120)("validation")}catch(t){e.exports=i(150)}},function(e,t){"use strict";/*! - * UTF-8 validate: UTF-8 validation for WebSockets. - * Copyright(c) 2015 Einar Otto Stangvik - * MIT Licensed - */ -e.exports.Validation={isValidUTF8:function(e){return!0}}},function(e,t){/*! - * ws: a node.js websocket client - * Copyright(c) 2011 Einar Otto Stangvik - * MIT Licensed - */ -t.Validation={isValidUTF8:function(e){return!0}}},function(e,t,i){(function(t){function n(e,i,r){if(this instanceof n==!1)throw new TypeError("Classes can't be function-called");"function"==typeof e?(r=i,i=e,e=0):"undefined"==typeof e&&(e=0),this._growStrategy=(i||function(e,t){return e.used+t}).bind(null,this),this._shrinkStrategy=(r||function(t){return e}).bind(null,this),this._buffer=e?new t(e):null,this._offset=0,this._used=0,this._changeFactor=0,this.__defineGetter__("size",function(){return null==this._buffer?0:this._buffer.length}),this.__defineGetter__("used",function(){return this._used})}/*! - * ws: a node.js websocket client - * Copyright(c) 2011 Einar Otto Stangvik - * MIT Licensed - */ -i(75);n.prototype.get=function(e){if(null==this._buffer||this._offset+e>this._buffer.length){var i=new t(this._growStrategy(e));this._buffer=i,this._offset=0}this._used+=e;var n=this._buffer.slice(this._offset,this._offset+e);return this._offset+=e,n},n.prototype.reset=function(e){var i=this._shrinkStrategy();i - * MIT Licensed - */ -var r=i(3),s=i(75);r.EventEmitter;e.exports=n,s.inherits(n,r.EventEmitter),n.prototype.send=function(e,i,n){if(!this.isClosed){var r="string"==typeof e,s=r?t.byteLength(e):e.length,o=s>127?2:1,a=0==this.continuationFrame,l=!i||!("undefined"!=typeof i.fin&&!i.fin),f=new t((a?i&&i.binary?1+o:1:0)+s+(!l||i&&i.binary?0:1)),h=a?1:0;a&&(i&&i.binary?(f.write("€","binary"),o>1&&f.write(String.fromCharCode(128+s/128),h++,"binary"),f.write(String.fromCharCode(127&s),h++,"binary")):f.write("\0","binary")),r?f.write(e,h,"utf8"):e.copy(f,h,0),l?(i&&i.binary||f.write("ÿ",h+s,"binary"),this.continuationFrame=!1):this.continuationFrame=!0;try{this.socket.write(f,"binary",n)}catch(e){this.error(e.toString())}}},n.prototype.close=function(e,i,n,r){if(!this.isClosed){this.isClosed=!0;try{this.continuationFrame&&this.socket.write(new t([255],"binary")),this.socket.write(new t([255,0]),"binary",r)}catch(e){this.error(e.toString())}}},n.prototype.ping=function(e,t){},n.prototype.pong=function(e,t){},n.prototype.error=function(e){return this.emit("error",e),this}}).call(t,i(58).Buffer)},function(e,t,i){(function(t){function n(){if(this instanceof n==!1)throw new TypeError("Classes can't be function-called");this.state=s,this.buffers=[],this.messageEnd=-1,this.spanLength=0,this.dead=!1,this.onerror=function(){},this.ontext=function(){},this.onbinary=function(){},this.onclose=function(){},this.onping=function(){},this.onpong=function(){}}function r(e,t){for(var i=0,n=e.length;i - * MIT Licensed - */ -var s=(i(75),0),o=1,a=2,l=3;e.exports=n,n.prototype.add=function(e){function t(){if(i.state===s){if(2==e.length&&255==e[0]&&0==e[1])return i.reset(),void i.onclose();if(128===e[0])i.messageEnd=0,i.state=a,e=e.slice(1);else{if(0!==e[0])return void i.error("payload must start with 0x00 byte",!0);e=e.slice(1),i.state=o}}if(i.state===a){for(var t=0;t0&&(e=e.slice(t))}if(i.state===l){var n=i.messageEnd-i.spanLength;return e.length>=n?(i.buffers.push(e),i.spanLength+=n,i.messageEnd=n,i.parse()):(i.buffers.push(e),void(i.spanLength+=e.length))}return i.buffers.push(e),(i.messageEnd=r(e,255))!=-1?(i.spanLength+=i.messageEnd,i.parse()):void(i.spanLength+=e.length)}if(!this.dead)for(var i=this;e;)e=t()},n.prototype.cleanup=function(){this.dead=!0,this.state=s,this.buffers=[]},n.prototype.parse=function(){for(var e=new t(this.spanLength),i=0,n=0,r=this.buffers.length;n0&&a.copy(e,i,0,this.messageEnd),this.state!==o&&--this.messageEnd;var l=null;return this.messageEnd>24&255,t>>16&255,t>>8&255,255&t)))}),b.update(n.toString("binary")),i.setTimeout(0),i.setNoDelay(!0);try{var w=new t(b.digest("binary"),"binary"),m=new t(f.length+w.length);f.copy(m,0),w.copy(m,f.length),i.write(m,"binary",function(t){if(!t){var n=new d([e,i,o],{protocolVersion:"hixie-76",protocol:c});l.options.clientTracking&&(l.clients.push(n),n.on("close",function(){var e=l.clients.indexOf(n);e!=-1&&l.clients.splice(e,1)})),i.removeListener("error",s),r(n)}})}catch(e){try{i.destroy()}catch(e){}return}},m=8;if(n&&n.length>=m){var g=n.slice(0,m),_=n.length>m?n.slice(m):null;w.call(l,g,_,p())}else{var g=new t(m);n.copy(g,0);var v=n.length,_=null,k=function(e){var n=Math.min(e.length,m-v);0!==n&&(e.copy(g,v,0,n),v+=n,v==m&&(i.removeListener("data",k),n - * MIT Licensed - */ -var l=i(75),f=i(3),h=i(78),u=i(99),c=i(115),d=i(68),p=i(155),b=i(125),w=(i(157),i(69));l.inherits(n,f.EventEmitter),n.prototype.close=function(e){var t=null;try{for(var i=0,n=this.clients.length;i{s.lookup(this.voiceConnection.authentication.endpoint,(i,n)=>{return i?void t(i):(this.discordAddress=n,void e(n))})})}send(e){return new Promise((t,i)=>{if(!this.socket)throw new Error("Tried to send a UDP packet, but there is no socket available.");if(!this.discordAddress||!this.discordPort)throw new Error("Malformed UDP address or port.");this.socket.send(e,0,e.length,this.discordPort,this.discordAddress,n=>{n?i(n):t(e)})})}createUDPSocket(e){this.discordAddress=e;const i=this.socket=r.createSocket("udp4");i.once("message",e=>{const t=n(e);return t.error?void this.emit("error",t.error):(this.localAddress=t.address,this.localPort=t.port,void this.voiceConnection.sockets.ws.sendPacket({op:o.VoiceOPCodes.SELECT_PROTOCOL,d:{protocol:"udp",data:{address:t.address,port:t.port,mode:"xsalsa20_poly1305"}}}))});const s=new t(70);s.writeUIntBE(this.voiceConnection.authentication.ssrc,0,4),this.send(s)}}e.exports=l}).call(t,i(58).Buffer)},function(e,t){t.lookup=t.resolve4=t.resolve6=t.resolveCname=t.resolveMx=t.resolveNs=t.resolveTxt=t.resolveSrv=t.resolveNaptr=t.reverse=t.resolve=function(){if(arguments.length){var e=arguments[arguments.length-1];e&&"function"==typeof e&&e(null,"0.0.0.0")}}},function(e,t,i){const n=i(162),r=i(165),s=i(3).EventEmitter,o=i(171);class a extends s{constructor(e){super(),this.voiceConnection=e,this.audioToPCM=new(n.fetch()),this.opusEncoder=r.fetch(),this.currentConverter=null,this.dispatcher=null,this.audioToPCM.on("error",e=>this.emit("error",e)),this.streamingData={channels:2,count:0,sequence:0,timestamp:0,pausedTime:0},this.voiceConnection.on("closing",()=>this.cleanup(null,"voice connection closing"))}playUnknownStream(e,{seek=0,volume=1,passes=1}={}){const t={seek:seek,volume:volume,passes:passes};e.on("end",()=>{this.emit("debug","Input stream to converter has ended")}),e.on("error",e=>this.emit("error",e));const i=this.audioToPCM.createConvertStream(t.seek);return i.on("error",e=>this.emit("error",e)),i.setInput(e),this.playPCMStream(i.process.stdout,i,t)}cleanup(e,t){this.emit("debug",`Clean up triggered due to ${t}`);const i=e&&this.dispatcher&&this.dispatcher.stream===e;!this.currentConverter||e&&!i||(this.currentConverter.destroy(),this.currentConverter=null)}playPCMStream(e,t,{seek=0,volume=1,passes=1}={}){const i={seek:seek,volume:volume,passes:passes};e.on("end",()=>this.emit("debug","PCM input stream ended")),this.cleanup(null,"outstanding play stream"),this.currentConverter=t,this.dispatcher&&(this.streamingData=this.dispatcher.streamingData),e.on("error",e=>this.emit("error",e));const n=new o(this,e,this.streamingData,i);return n.on("error",e=>this.emit("error",e)),n.on("end",()=>this.cleanup(n.stream,"dispatcher ended")),n.on("speaking",e=>this.voiceConnection.setSpeaking(e)),this.dispatcher=n,n.on("debug",e=>this.emit("debug",`Stream dispatch - ${e}`)),n}}e.exports=a},function(e,t,i){t.fetch=(()=>i(163))},function(e,t,i){function n(){for(const e of["ffmpeg","avconv","./ffmpeg","./avconv"])if(!s.spawnSync(e,["-h"]).error)return e;throw new Error("FFMPEG was not found on your system, so audio cannot be played. Please make sure FFMPEG is installed and in your PATH.")}const r=i(164),s=i(62),o=i(3).EventEmitter;class a extends o{constructor(e){super(),this.process=e,this.input=null,this.process.on("error",e=>this.emit("error",e))}setInput(e){this.input=e,e.pipe(this.process.stdin,{end:!1}),this.input.on("error",e=>this.emit("error",e)),this.process.stdin.on("error",e=>this.emit("error",e))}destroy(){this.emit("debug","destroying a ffmpeg process:"),this.input&&this.input.unpipe&&this.process.stdin&&(this.input.unpipe(this.process.stdin),this.emit("unpiped the user input stream from the process input stream")),this.process.stdin&&(this.process.stdin.end(),this.emit("ended the process stdin")),this.process.stdin.destroy&&(this.process.stdin.destroy(),this.emit("destroyed the process stdin")),this.process.kill&&(this.process.kill(),this.emit("killed the process"))}}class l extends r{constructor(e){super(e),this.command=n()}handleError(e,t){e.destroy&&e.destroy(),this.emit("error",t)}createConvertStream(e=0){super.createConvertStream();const t=s.spawn(this.command,["-analyzeduration","0","-loglevel","0","-i","-","-f","s16le","-ar","48000","-ac","2","-ss",String(e),"pipe:1"],{stdio:["pipe","pipe","ignore"]});return new a(t)}}e.exports=l},function(e,t,i){const n=i(3).EventEmitter;class r extends n{constructor(e){super(),this.player=e}createConvertStream(){}}e.exports=r},function(e,t,i){function n(e){try{return new e}catch(e){return null}}const r=[i(166),i(168)];t.add=(e=>{r.push(e)}),t.fetch=(()=>{for(const e of r){const t=n(e);if(t)return t}throw new Error("Couldn't find an Opus engine.")})},function(e,t,i){const n=i(167);let r;class s extends n{constructor(e){super(e);try{r=i(!function(){var e=new Error('Cannot find module "node-opus"');throw e.code="MODULE_NOT_FOUND",e}())}catch(e){throw e}this.encoder=new r.OpusEncoder(48e3,2)}encode(e){return super.encode(e),this.encoder.encode(e,1920)}decode(e){return super.decode(e),this.encoder.decode(e,1920)}}e.exports=s},function(e,t){class i{constructor(e){this.player=e}encode(e){return e}decode(e){return e}}e.exports=i},function(e,t,i){const n=i(167);let r;class s extends n{constructor(e){super(e);try{r=i(169)}catch(e){throw e}this.encoder=new r(48e3,2)}encode(e){return super.encode(e),this.encoder.encode(e,960)}decode(e){return super.decode(e),this.encoder.decode(e)}}e.exports=s},function(e,t,i){(function(t){"use strict";function n(e,t,i){if(!~a.indexOf(e))throw new RangeError(`${e} is an invalid sampling rate.`);this.samplingRate=e,this.channels=t||1,this.application=i||s.AUDIO,this.handler=new r.OpusScriptHandler(this.samplingRate,this.channels,this.application),this.inPCMLength=l*this.channels*2,this.inPCMPointer=r._malloc(this.inPCMLength),this.inPCM=r.HEAPU16.subarray(this.inPCMPointer,this.inPCMPointer+this.inPCMLength),this.inOpusPointer=r._malloc(f),this.inOpus=r.HEAPU8.subarray(this.inOpusPointer,this.inOpusPointer+f),this.outOpusPointer=r._malloc(f),this.outOpus=r.HEAPU8.subarray(this.outOpusPointer,this.outOpusPointer+f),this.outPCMLength=l*this.channels*2,this.outPCMPointer=r._malloc(this.outPCMLength),this.outPCM=r.HEAPU16.subarray(this.outPCMPointer,this.outPCMPointer+this.outPCMLength)}var r=i(170),s={VOIP:2048,AUDIO:2049,RESTRICTED_LOWDELAY:2051},o={0:"OK","-1":"Bad argument","-2":"Buffer too small","-3":"Internal error","-4":"Invalid packet","-5":"Unimplemented","-6":"Invalid state","-7":"Memory allocation fail"},a=[8e3,12e3,16e3,24e3,48e3],l=2880,f=3828,h=4002;n.prototype.setBitrate=function(e){this.bitrate=e||64e3,r.setValue(this.bitratePointer,this.bitrate,"i32");var t=r._opus_encoder_ctl(this.handler,h,this.bitratePointer);if(t<0)throw new Error("Failed to set bitrate: "+o[""+r.getValue(t,"i32")])},n.prototype.encode=function(e,i){this.inPCM.set(e);var n=this.handler._encode(this.inPCM.byteOffset,e.length,this.outOpusPointer,i);if(n<0)throw new Error("Encode error: "+o[""+n]);return new t(this.outOpus.subarray(0,n))},n.prototype.decode=function(e){this.inOpus.set(e);var i=this.handler._decode(this.inOpusPointer,e.length,this.outPCM.byteOffset);if(i<0)throw new Error("Decode error: "+o[""+i]);return new t(this.outPCM.subarray(0,i*this.channels*2))},n.Application=s,n.Error=o,n.VALID_SAMPLING_RATES=a,n.MAX_PACKET_SIZE=f,e.exports=n}).call(t,i(58).Buffer)},function(module,exports,__webpack_require__){(function(process,__dirname,module){function globalEval(e){eval.call(null,e)}function assert(e,t){e||abort("Assertion failed: "+t)}function getCFunc(ident){var func=Module["_"+ident];if(!func)try{func=eval("_"+ident)}catch(e){}return assert(func,"Cannot call unknown function "+ident+" (perhaps LLVM optimizations or closure removed it?)"),func}function setValue(e,t,i,n){switch(i=i||"i8","*"===i.charAt(i.length-1)&&(i="i32"),i){case"i1":HEAP8[e>>0]=t;break;case"i8":HEAP8[e>>0]=t;break;case"i16":HEAP16[e>>1]=t;break;case"i32":HEAP32[e>>2]=t;break;case"i64":tempI64=[t>>>0,(tempDouble=t,+Math_abs(tempDouble)>=1?tempDouble>0?(0|Math_min(+Math_floor(tempDouble/4294967296),4294967295))>>>0:~~+Math_ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[e>>2]=tempI64[0],HEAP32[e+4>>2]=tempI64[1];break;case"float":HEAPF32[e>>2]=t;break;case"double":HEAPF64[e>>3]=t;break;default:abort("invalid type for setValue: "+i)}}function getValue(e,t,i){switch(t=t||"i8","*"===t.charAt(t.length-1)&&(t="i32"),t){case"i1":return HEAP8[e>>0];case"i8":return HEAP8[e>>0];case"i16":return HEAP16[e>>1];case"i32":return HEAP32[e>>2];case"i64":return HEAP32[e>>2];case"float":return HEAPF32[e>>2];case"double":return HEAPF64[e>>3];default:abort("invalid type for setValue: "+t)}return null}function allocate(e,t,i,n){var r,s;"number"==typeof e?(r=!0,s=e):(r=!1,s=e.length);var o,a="string"==typeof t?t:null;if(o=i==ALLOC_NONE?n:["function"==typeof _malloc?_malloc:Runtime.staticAlloc,Runtime.stackAlloc,Runtime.staticAlloc,Runtime.dynamicAlloc][void 0===i?ALLOC_STATIC:i](Math.max(s,a?1:t.length)),r){var l,n=o;for(assert(0==(3&o)),l=o+(s&-4);n>2]=0;for(l=o+s;n>0]=0;return o}if("i8"===a)return e.subarray||e.slice?HEAPU8.set(e,o):HEAPU8.set(new Uint8Array(e),o),o;for(var f,h,u,c=0;c>0],n|=i,0==i&&!t)break;if(r++,t&&r==t)break}t||(t=r);var s="";if(n<128){for(var o,a=1024;t>0;)o=String.fromCharCode.apply(String,HEAPU8.subarray(e,e+Math.min(t,a))),s=s?s+o:o,e+=a,t-=a;return s}return Module.UTF8ToString(e)}function UTF8ArrayToString(e,t){for(var i,n,r,s,o,a,l="";;){if(i=e[t++],!i)return l;if(128&i)if(n=63&e[t++],192!=(224&i))if(r=63&e[t++],224==(240&i)?i=(15&i)<<12|n<<6|r:(s=63&e[t++],240==(248&i)?i=(7&i)<<18|n<<12|r<<6|s:(o=63&e[t++],248==(252&i)?i=(3&i)<<24|n<<18|r<<12|s<<6|o:(a=63&e[t++],i=(1&i)<<30|n<<24|r<<18|s<<12|o<<6|a))),i<65536)l+=String.fromCharCode(i);else{var f=i-65536;l+=String.fromCharCode(55296|f>>10,56320|1023&f)}else l+=String.fromCharCode((31&i)<<6|n);else l+=String.fromCharCode(i)}}function stringToUTF8Array(e,t,i,n){if(!(n>0))return 0;for(var r=i,s=i+n-1,o=0;o=55296&&a<=57343&&(a=65536+((1023&a)<<10)|1023&e.charCodeAt(++o)),a<=127){if(i>=s)break;t[i++]=a}else if(a<=2047){if(i+1>=s)break;t[i++]=192|a>>6,t[i++]=128|63&a}else if(a<=65535){if(i+2>=s)break;t[i++]=224|a>>12,t[i++]=128|a>>6&63,t[i++]=128|63&a}else if(a<=2097151){if(i+3>=s)break;t[i++]=240|a>>18,t[i++]=128|a>>12&63,t[i++]=128|a>>6&63,t[i++]=128|63&a}else if(a<=67108863){if(i+4>=s)break;t[i++]=248|a>>24,t[i++]=128|a>>18&63,t[i++]=128|a>>12&63,t[i++]=128|a>>6&63,t[i++]=128|63&a}else{if(i+5>=s)break;t[i++]=252|a>>30,t[i++]=128|a>>24&63,t[i++]=128|a>>18&63,t[i++]=128|a>>12&63,t[i++]=128|a>>6&63,t[i++]=128|63&a}}return t[i]=0,i-r}function lengthBytesUTF8(e){for(var t=0,i=0;i=55296&&n<=57343&&(n=65536+((1023&n)<<10)|1023&e.charCodeAt(++i)),n<=127?++t:t+=n<=2047?2:n<=65535?3:n<=2097151?4:n<=67108863?5:6}return t}function demangle(e){var t=!!Module.___cxa_demangle;if(t)try{var i=_malloc(e.length);writeStringToMemory(e.substr(1),i);var n=_malloc(4),r=Module.___cxa_demangle(i,0,0,n);if(0===getValue(n,"i32")&&r)return Pointer_stringify(r)}catch(t){return e}finally{i&&_free(i),n&&_free(n),r&&_free(r)}return Runtime.warnOnce("warning: build with -s DEMANGLE_SUPPORT=1 to link in libcxxabi demangling"),e}function demangleAll(e){return e.replace(/__Z[\w\d_]+/g,function(e){var t=demangle(e);return e===t?e:e+" ["+t+"]"})}function jsStackTrace(){var e=new Error;if(!e.stack){try{throw new Error(0)}catch(t){e=t}if(!e.stack)return"(no stack trace available)"}return e.stack.toString()}function stackTrace(){return demangleAll(jsStackTrace())}function alignMemoryPage(e){return e%4096>0&&(e+=4096-e%4096),e}function updateGlobalBufferViews(){Module.HEAP8=HEAP8=new Int8Array(buffer),Module.HEAP16=HEAP16=new Int16Array(buffer),Module.HEAP32=HEAP32=new Int32Array(buffer),Module.HEAPU8=HEAPU8=new Uint8Array(buffer),Module.HEAPU16=HEAPU16=new Uint16Array(buffer),Module.HEAPU32=HEAPU32=new Uint32Array(buffer),Module.HEAPF32=HEAPF32=new Float32Array(buffer),Module.HEAPF64=HEAPF64=new Float64Array(buffer)}function abortOnCannotGrowMemory(){abort("Cannot enlarge memory arrays. Either (1) compile with -s TOTAL_MEMORY=X with X higher than the current value "+TOTAL_MEMORY+", (2) compile with -s ALLOW_MEMORY_GROWTH=1 which adjusts the size at runtime but prevents some optimizations, (3) set Module.TOTAL_MEMORY to a higher value before the program runs, or if you want malloc to return NULL (0) instead of this abort, compile with -s ABORTING_MALLOC=0 ")}function enlargeMemory(){abortOnCannotGrowMemory()}function callRuntimeCallbacks(e){for(;e.length>0;){var t=e.shift();if("function"!=typeof t){var i=t.func;"number"==typeof i?void 0===t.arg?Runtime.dynCall("v",i):Runtime.dynCall("vi",i,[t.arg]):i(void 0===t.arg?null:t.arg)}else t()}}function preRun(){if(Module.preRun)for("function"==typeof Module.preRun&&(Module.preRun=[Module.preRun]);Module.preRun.length;)addOnPreRun(Module.preRun.shift());callRuntimeCallbacks(__ATPRERUN__)}function ensureInitRuntime(){runtimeInitialized||(runtimeInitialized=!0,callRuntimeCallbacks(__ATINIT__))}function preMain(){callRuntimeCallbacks(__ATMAIN__)}function exitRuntime(){callRuntimeCallbacks(__ATEXIT__),runtimeExited=!0}function postRun(){if(Module.postRun)for("function"==typeof Module.postRun&&(Module.postRun=[Module.postRun]);Module.postRun.length;)addOnPostRun(Module.postRun.shift());callRuntimeCallbacks(__ATPOSTRUN__)}function addOnPreRun(e){__ATPRERUN__.unshift(e)}function addOnPostRun(e){__ATPOSTRUN__.unshift(e)}function intArrayFromString(e,t,i){var n=i>0?i:lengthBytesUTF8(e)+1,r=new Array(n),s=stringToUTF8Array(e,r,0,r.length);return t&&(r.length=s),r}function writeStringToMemory(e,t,i){for(var n=intArrayFromString(e,i),r=0;r>0]=s,r+=1}}function writeArrayToMemory(e,t){for(var i=0;i>0]=e[i]}function writeAsciiToMemory(e,t,i){for(var n=0;n>0]=e.charCodeAt(n);i||(HEAP8[t>>0]=0)}function ___setErrNo(e){return Module.___errno_location&&(HEAP32[Module.___errno_location()>>2]=e),e}function _sysconf(e){switch(e){case 30:return PAGE_SIZE;case 85:return totalMemory/PAGE_SIZE;case 132:case 133:case 12:case 137:case 138:case 15:case 235:case 16:case 17:case 18:case 19:case 20:case 149:case 13:case 10:case 236:case 153:case 9:case 21:case 22:case 159:case 154:case 14:case 77:case 78:case 139:case 80:case 81:case 82:case 68:case 67:case 164:case 11:case 29:case 47:case 48:case 95:case 52:case 51:case 46:return 200809;case 79:return 0;case 27:case 246:case 127:case 128:case 23:case 24:case 160:case 161:case 181:case 182:case 242:case 183:case 184:case 243:case 244:case 245:case 165:case 178:case 179:case 49:case 50:case 168:case 169:case 175:case 170:case 171:case 172:case 97:case 76:case 32:case 173:case 35:return-1;case 176:case 177:case 7:case 155:case 8:case 157:case 125:case 126:case 92:case 93:case 129:case 130:case 131:case 94:case 91:return 1;case 74:case 60:case 69:case 70:case 4:return 1024;case 31:case 42:case 72:return 32;case 87:case 26:case 33:return 2147483647;case 34:case 1:return 47839;case 38:case 36:return 99;case 43:case 37:return 2048;case 0:return 2097152;case 3:return 65536;case 28:return 32768;case 44:return 32767;case 75:return 16384;case 39:return 1e3;case 89:return 700;case 71:return 256;case 40:return 255;case 2:return 100;case 180:return 64;case 25:return 20;case 5:return 16;case 6:return 6;case 73:return 4;case 84:return"object"==typeof navigator?navigator.hardwareConcurrency||1:1}return ___setErrNo(ERRNO_CODES.EINVAL),-1}function embind_init_charCodes(){for(var e=new Array(256),t=0;t<256;++t)e[t]=String.fromCharCode(t);embind_charCodes=e}function readLatin1String(e){for(var t="",i=e;HEAPU8[i];)t+=embind_charCodes[HEAPU8[i++]];return t}function makeLegalFunctionName(e){if(void 0===e)return"_unknown";e=e.replace(/[^a-zA-Z0-9_]/g,"$");var t=e.charCodeAt(0);return t>=char_0&&t<=char_9?"_"+e:e}function createNamedFunction(e,t){return e=makeLegalFunctionName(e),new Function("body","return function "+e+'() {\n "use strict"; return body.apply(this, arguments);\n};\n')(t)}function extendError(e,t){var i=createNamedFunction(t,function(e){this.name=t,this.message=e;var i=new Error(e).stack;void 0!==i&&(this.stack=this.toString()+"\n"+i.replace(/^Error(:[^\n]*)?\n/,""))});return i.prototype=Object.create(e.prototype),i.prototype.constructor=i,i.prototype.toString=function(){return void 0===this.message?this.name:this.name+": "+this.message},i}function throwBindingError(e){throw new BindingError(e)}function throwInternalError(e){throw new InternalError(e)}function whenDependentTypesAreResolved(e,t,i){function n(t){var n=i(t);n.length!==e.length&&throwInternalError("Mismatched type converter count");for(var r=0;r>2]=e,e=___cxa_find_matching_catch.buffer;for(var r=0;r>2],t.adjusted=e,0|(asm.setTempRet0(n[r]),e);return e=HEAP32[e>>2],0|(asm.setTempRet0(i),e)}function ___cxa_throw(e,t,i){throw EXCEPTIONS.infos[e]={ptr:e,adjusted:e,type:t,destructor:i,refcount:0},EXCEPTIONS.last=e,"uncaught_exception"in __ZSt18uncaught_exceptionv?__ZSt18uncaught_exceptionv.uncaught_exception++:__ZSt18uncaught_exceptionv.uncaught_exception=1,e+" - Exception catching is disabled, this exception cannot be caught. Compile with -s DISABLE_EXCEPTION_CATCHING=0 or DISABLE_EXCEPTION_CATCHING=2 to catch."}function getShiftFromSize(e){switch(e){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+e)}}function __embind_register_bool(e,t,i,n,r){var s=getShiftFromSize(i);t=readLatin1String(t),registerType(e,{name:t,fromWireType:function(e){return!!e},toWireType:function(e,t){return t?n:r},argPackAdvance:8,readValueFromPointer:function(e){var n;if(1===i)n=HEAP8;else if(2===i)n=HEAP16;else{if(4!==i)throw new TypeError("Unknown boolean type size: "+t);n=HEAP32}return this.fromWireType(n[e>>s])},destructorFunction:null})}function _abort(){Module.abort()}function _free(){}function _malloc(e){var t=Runtime.dynamicAlloc(e+8);return t+8&4294967288}function simpleReadValueFromPointer(e){return this.fromWireType(HEAPU32[e>>2])}function __embind_register_std_string(e,t){t=readLatin1String(t),registerType(e,{name:t,fromWireType:function(e){for(var t=HEAPU32[e>>2],i=new Array(t),n=0;n>2]=s;for(var a=0;a255&&(_free(o),throwBindingError("String has UTF-16 code units that do not fit in 8 bits")),HEAPU8[o+4+a]=l}return null!==e&&e.push(_free,o),o},argPackAdvance:8,readValueFromPointer:simpleReadValueFromPointer,destructorFunction:function(e){_free(e)}})}function __embind_register_std_wstring(e,t,i){i=readLatin1String(i);var n,r;2===t?(n=function(){return HEAPU16},r=1):4===t&&(n=function(){return HEAPU32},r=2),registerType(e,{name:i,fromWireType:function(e){for(var t=n(),i=HEAPU32[e>>2],s=new Array(i),o=e+4>>r,a=0;a>2]=o;for(var l=a+4>>r,f=0;f>1]}:function(e){return HEAPU16[e>>1]};case 2:return i?function(e){return HEAP32[e>>2]}:function(e){return HEAPU32[e>>2]};default:throw new TypeError("Unknown integer type: "+e)}}function __embind_register_integer(e,t,i,n,r){t=readLatin1String(t),r===-1&&(r=4294967295);var s=getShiftFromSize(i),o=function(e){return e};if(0===n){var a=32-8*i;o=function(e){return e<>>a}}registerType(e,{name:t,fromWireType:o,toWireType:function(e,i){if("number"!=typeof i&&"boolean"!=typeof i)throw new TypeError('Cannot convert "'+_embind_repr(i)+'" to '+this.name);if(ir)throw new TypeError('Passing a number "'+_embind_repr(i)+'" from JS side to C/C++ side to an argument of type "'+t+'", which is outside the valid range ['+n+", "+r+"]!");return 0|i},argPackAdvance:8,readValueFromPointer:integerReadValueFromPointer(t,s,0!==n),destructorFunction:null})}function __emval_decref(e){e>4&&0===--emval_handle_array[e].refcount&&(emval_handle_array[e]=void 0,emval_free_list.push(e))}function count_emval_handles(){for(var e=0,t=5;t>=2;var t=HEAPU32,i=t[e],n=t[e+1];return new s(t.buffer,n,i)}var r=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],s=r[t];i=readLatin1String(i),registerType(e,{name:i,fromWireType:n,argPackAdvance:8,readValueFromPointer:n},{ignoreDuplicateRegistrations:!0})}function floatReadValueFromPointer(e,t){switch(t){case 2:return function(e){return this.fromWireType(HEAPF32[e>>2])};case 3:return function(e){return this.fromWireType(HEAPF64[e>>3])};default:throw new TypeError("Unknown float type: "+e)}}function __embind_register_float(e,t,i){var n=getShiftFromSize(i);t=readLatin1String(t),registerType(e,{name:t,fromWireType:function(e){return e},toWireType:function(e,t){if("number"!=typeof t&&"boolean"!=typeof t)throw new TypeError('Cannot convert "'+_embind_repr(t)+'" to '+this.name);return t},argPackAdvance:8,readValueFromPointer:floatReadValueFromPointer(t,n),destructorFunction:null})}function _emscripten_memcpy_big(e,t,i){return HEAPU8.set(HEAPU8.subarray(t,t+i),e),e}function _llvm_stackrestore(e){var t=_llvm_stacksave,i=t.LLVM_SAVEDSTACKS[e];t.LLVM_SAVEDSTACKS.splice(e,1),Runtime.stackRestore(i)}function _sbrk(e){var t=_sbrk;t.called||(DYNAMICTOP=alignMemoryPage(DYNAMICTOP),t.called=!0,assert(Runtime.dynamicAlloc),t.alloc=Runtime.dynamicAlloc,Runtime.dynamicAlloc=function(){abort("cannot dynamically allocate, sbrk now has control")});var i=DYNAMICTOP;if(0!=e){var n=t.alloc(e);if(!n)return-1>>>0}return i}function _llvm_stacksave(){var e=_llvm_stacksave;return e.LLVM_SAVEDSTACKS||(e.LLVM_SAVEDSTACKS=[]),e.LLVM_SAVEDSTACKS.push(Runtime.stackSave()),e.LLVM_SAVEDSTACKS.length-1}function ___gxx_personality_v0(){}function heap32VectorToArray(e,t){for(var i=[],n=0;n>2)+n]);return i}function runDestructors(e){for(;e.length;){var t=e.pop(),i=e.pop();i(t)}}function __embind_register_class_constructor(e,t,i,n,r,s){var o=heap32VectorToArray(t,i);r=requireFunction(n,r),whenDependentTypesAreResolved([],[e],function(e){e=e[0];var i="constructor "+e.name;if(void 0===e.registeredClass.constructor_body&&(e.registeredClass.constructor_body=[]),void 0!==e.registeredClass.constructor_body[t-1])throw new BindingError("Cannot register multiple constructors with identical number of parameters ("+(t-1)+") for class '"+e.name+"'! Overload resolution is currently only performed using the parameter count, not actual type info!");return e.registeredClass.constructor_body[t-1]=function(){throwUnboundTypeError("Cannot construct "+e.name+" due to unbound types",o)},whenDependentTypesAreResolved([],o,function(n){return e.registeredClass.constructor_body[t-1]=function(){arguments.length!==t-1&&throwBindingError(i+" called with "+arguments.length+" arguments, expected "+(t-1));var e=[],o=new Array(t);o[0]=s;for(var a=1;a>2]=t),t}function _pthread_self(){return 0}function new_(e,t){if(!(e instanceof Function))throw new TypeError("new_ called with constructor type "+typeof e+" which is not a function");var i=createNamedFunction(e.name||"unknownFunctionName",function(){});i.prototype=e.prototype;var n=new i,r=e.apply(n,t);return r instanceof Object?r:n}function craftInvokerFunction(e,t,i,n,r){var s=t.length;s<2&&throwBindingError("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var o=null!==t[1]&&null!==i,a="",l="",f=0;f0?", ":"")+l);var b="void"!==t[0].name;if(h+=(b?"var rv = ":"")+"invoker(fn"+(l.length>0?", ":"")+l+");\n",u)h+="runDestructors(destructors);\n";else for(var f=o?1:2;f0||(preRun(),runDependencies>0||Module.calledRun||(Module.setStatus?(Module.setStatus("Running..."),setTimeout(function(){setTimeout(function(){Module.setStatus("")},1),t()},1)):t()))}function exit(e,t){if(!t||!Module.noExitRuntime)throw Module.noExitRuntime||(ABORT=!0,EXITSTATUS=e,STACKTOP=initialStackTop,exitRuntime(),Module.onExit&&Module.onExit(e)),ENVIRONMENT_IS_NODE?process.exit(e):ENVIRONMENT_IS_SHELL&&"function"==typeof quit&&quit(e),new ExitStatus(e)}function abort(e){void 0!==e?(Module.print(e),Module.printErr(e),e=JSON.stringify(e)):e="",ABORT=!0,EXITSTATUS=1;var t="\nIf this abort() is unexpected, build with -s ASSERTIONS=1 which can give more information.",i="abort("+e+") at "+stackTrace()+t;throw abortDecorators&&abortDecorators.forEach(function(t){i=t(i,e)}),i}var Module;Module||(Module=("undefined"!=typeof Module?Module:null)||{});var moduleOverrides={};for(var key in Module)Module.hasOwnProperty(key)&&(moduleOverrides[key]=Module[key]);var ENVIRONMENT_IS_WEB=!1,ENVIRONMENT_IS_WORKER=!1,ENVIRONMENT_IS_NODE=!1,ENVIRONMENT_IS_SHELL=!1;if(Module.ENVIRONMENT)if("WEB"===Module.ENVIRONMENT)ENVIRONMENT_IS_WEB=!0;else if("WORKER"===Module.ENVIRONMENT)ENVIRONMENT_IS_WORKER=!0;else if("NODE"===Module.ENVIRONMENT)ENVIRONMENT_IS_NODE=!0;else{if("SHELL"!==Module.ENVIRONMENT)throw new Error("The provided Module['ENVIRONMENT'] value is not valid. It must be one of: WEB|WORKER|NODE|SHELL.");ENVIRONMENT_IS_SHELL=!0}else ENVIRONMENT_IS_WEB="object"==typeof window,ENVIRONMENT_IS_WORKER="function"==typeof importScripts,ENVIRONMENT_IS_NODE="object"==typeof process&&!0&&!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_WORKER,ENVIRONMENT_IS_SHELL=!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_NODE&&!ENVIRONMENT_IS_WORKER;if(ENVIRONMENT_IS_NODE){Module.print||(Module.print=console.log),Module.printErr||(Module.printErr=console.warn);var nodeFS,nodePath;Module.read=function(e,t){nodeFS||(nodeFS=__webpack_require__(62)),nodePath||(nodePath=__webpack_require__(15)),e=nodePath.normalize(e);var i=nodeFS.readFileSync(e);return i||e==nodePath.resolve(e)||(e=path.join(__dirname,"..","src",e),i=nodeFS.readFileSync(e)),i&&!t&&(i=i.toString()),i},Module.readBinary=function(e){var t=Module.read(e,!0);return t.buffer||(t=new Uint8Array(t)),assert(t.buffer),t},Module.load=function(e){globalEval(read(e))},Module.thisProgram||(process.argv.length>1?Module.thisProgram=process.argv[1].replace(/\\/g,"/"):Module.thisProgram="unknown-program"),Module.arguments=process.argv.slice(2),module.exports=Module,Module.inspect=function(){return"[Emscripten Module object]"}}else if(ENVIRONMENT_IS_SHELL)Module.print||(Module.print=print),"undefined"!=typeof printErr&&(Module.printErr=printErr),"undefined"!=typeof read?Module.read=read:Module.read=function(){throw"no read() available (jsc?)"},Module.readBinary=function(e){if("function"==typeof readbuffer)return new Uint8Array(readbuffer(e));var t=read(e,"binary");return assert("object"==typeof t),t},"undefined"!=typeof scriptArgs?Module.arguments=scriptArgs:"undefined"!=typeof arguments&&(Module.arguments=arguments);else{if(!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_WORKER)throw"Unknown runtime environment. Where are we?";if(Module.read=function(e){var t=new XMLHttpRequest;return t.open("GET",e,!1),t.send(null),t.responseText},Module.readAsync=function(e,t,i){var n=new XMLHttpRequest;n.open("GET",e,!0),n.responseType="arraybuffer",n.onload=function(){200==n.status||0==n.status&&n.response?t(n.response):i()},n.onerror=i,n.send(null)},"undefined"!=typeof arguments&&(Module.arguments=arguments),"undefined"!=typeof console)Module.print||(Module.print=function(e){console.log(e)}),Module.printErr||(Module.printErr=function(e){console.warn(e)});else{var TRY_USE_DUMP=!1;Module.print||(Module.print=TRY_USE_DUMP&&"undefined"!=typeof dump?function(e){dump(e)}:function(e){})}ENVIRONMENT_IS_WORKER&&(Module.load=importScripts),"undefined"==typeof Module.setWindowTitle&&(Module.setWindowTitle=function(e){document.title=e})}!Module.load&&Module.read&&(Module.load=function(e){globalEval(Module.read(e))}),Module.print||(Module.print=function(){}),Module.printErr||(Module.printErr=Module.print),Module.arguments||(Module.arguments=[]),Module.thisProgram||(Module.thisProgram="./this.program"),Module.print=Module.print,Module.printErr=Module.printErr,Module.preRun=[],Module.postRun=[];for(var key in moduleOverrides)moduleOverrides.hasOwnProperty(key)&&(Module[key]=moduleOverrides[key]);moduleOverrides=void 0;var Runtime={setTempRet0:function(e){tempRet0=e},getTempRet0:function(){return tempRet0},stackSave:function(){return STACKTOP},stackRestore:function(e){STACKTOP=e},getNativeTypeSize:function(e){switch(e){case"i1":case"i8":return 1;case"i16":return 2;case"i32":return 4;case"i64":return 8;case"float":return 4;case"double":return 8;default:if("*"===e[e.length-1])return Runtime.QUANTUM_SIZE;if("i"===e[0]){var t=parseInt(e.substr(1));return assert(t%8===0),t/8}return 0}},getNativeFieldSize:function(e){return Math.max(Runtime.getNativeTypeSize(e),Runtime.QUANTUM_SIZE)},STACK_ALIGN:16,prepVararg:function(e,t){return"double"===t||"i64"===t?7&e&&(assert(4===(7&e)),e+=4):assert(0===(3&e)),e},getAlignSize:function(e,t,i){return i||"i64"!=e&&"double"!=e?e?Math.min(t||(e?Runtime.getNativeFieldSize(e):0),Runtime.QUANTUM_SIZE):Math.min(t,8):8},dynCall:function(e,t,i){return i&&i.length?(i.splice||(i=Array.prototype.slice.call(i)),i.splice(0,0,t),Module["dynCall_"+e].apply(null,i)):Module["dynCall_"+e].call(null,t)},functionPointers:[],addFunction:function(e){for(var t=0;t=TOTAL_MEMORY){var i=enlargeMemory();if(!i)return DYNAMICTOP=t,0}return t},alignMemory:function(e,t){var i=e=Math.ceil(e/(t?t:16))*(t?t:16);return i},makeBigInt:function(e,t,i){var n=i?+(e>>>0)+4294967296*+(t>>>0):+(e>>>0)+4294967296*+(0|t);return n},GLOBAL_BASE:8,QUANTUM_SIZE:4,__dummy__:0},ABORT=!1,EXITSTATUS=0,ccall;!function(){function parseJSFunc(e){var t=e.toString().match(sourceRegex).slice(1);return{arguments:t[0],body:t[1],returnValue:t[2]}}function ensureJSsource(){if(!JSsource){JSsource={};for(var e in JSfuncs)JSfuncs.hasOwnProperty(e)&&(JSsource[e]=parseJSFunc(JSfuncs[e]))}}var JSfuncs={stackSave:function(){Runtime.stackSave()},stackRestore:function(){Runtime.stackRestore()},arrayToC:function(e){var t=Runtime.stackAlloc(e.length);return writeArrayToMemory(e,t),t},stringToC:function(e){var t=0;return null!==e&&void 0!==e&&0!==e&&(t=Runtime.stackAlloc((e.length<<2)+1),writeStringToMemory(e,t)),t}},toC={string:JSfuncs.stringToC,array:JSfuncs.arrayToC};ccall=function(e,t,i,n,r){var s=getCFunc(e),o=[],a=0;if(n)for(var l=0;l>>16,n=65535&e,r=t>>>16,s=65535&t;return n*s+(i*s+n*r<<16)|0}),Math.imul=Math.imul,Math.clz32||(Math.clz32=function(e){e>>>=0;for(var t=0;t<32;t++)if(e&1<<31-t)return t;return 32}),Math.clz32=Math.clz32;var Math_abs=Math.abs,Math_cos=Math.cos,Math_sin=Math.sin,Math_tan=Math.tan,Math_acos=Math.acos,Math_asin=Math.asin,Math_atan=Math.atan,Math_atan2=Math.atan2,Math_exp=Math.exp,Math_log=Math.log,Math_sqrt=Math.sqrt,Math_ceil=Math.ceil,Math_floor=Math.floor,Math_pow=Math.pow,Math_imul=Math.imul,Math_fround=Math.fround,Math_min=Math.min,Math_clz32=Math.clz32,runDependencies=0,runDependencyWatcher=null,dependenciesFulfilled=null;Module.preloadedImages={},Module.preloadedAudios={};var ASM_CONSTS=[];STATIC_BASE=8,STATICTOP=STATIC_BASE+35488,__ATINIT__.push({func:function(){__GLOBAL__sub_I_opusscript_encoder_cpp()}},{func:function(){__GLOBAL__sub_I_bind_cpp()}}),allocate([32,90,0,0,152,108,0,0,160,90,0,0,172,108,0,0,0,0,0,0,8,0,0,0,160,90,0,0,193,108,0,0,1,0,0,0,8,0,0,0,188,90,0,0,7,130,0,0,0,0,0,0,1,0,0,0,72,0,0,0,0,0,0,0,32,90,0,0,70,130,0,0,188,90,0,0,120,130,0,0,0,0,0,0,1,0,0,0,72,0,0,0,0,0,0,0,188,90,0,0,216,130,0,0,0,0,0,0,1,0,0,0,72,0,0,0,0,0,0,0,32,90,0,0,36,131,0,0,32,90,0,0,71,131,0,0,32,90,0,0,132,131,0,0,32,90,0,0,200,131,0,0,32,90,0,0,14,132,0,0,32,90,0,0,76,132,0,0,32,90,0,0,147,132,0,0,32,90,0,0,207,132,0,0,32,90,0,0,20,133,0,0,32,90,0,0,81,133,0,0,32,90,0,0,94,134,0,0,32,90,0,0,156,134,0,0,32,90,0,0,219,134,0,0,32,90,0,0,148,135,0,0,72,90,0,0,114,135,0,0,16,1,0,0,0,0,0,0,72,90,0,0,31,135,0,0,240,0,0,0,0,0,0,0,72,90,0,0,68,135,0,0,32,1,0,0,0,0,0,0,32,90,0,0,101,135,0,0,72,90,0,0,161,135,0,0,232,0,0,0,0,0,0,0,72,90,0,0,225,135,0,0,16,1,0,0,0,0,0,0,72,90,0,0,189,135,0,0,56,1,0,0,0,0,0,0,72,90,0,0,3,136,0,0,16,1,0,0,0,0,0,0,132,90,0,0,43,136,0,0,132,90,0,0,45,136,0,0,132,90,0,0,48,136,0,0,132,90,0,0,50,136,0,0,132,90,0,0,52,136,0,0,132,90,0,0,54,136,0,0,132,90,0,0,56,136,0,0,132,90,0,0,58,136,0,0,132,90,0,0,60,136,0,0,132,90,0,0,62,136,0,0,132,90,0,0,64,136,0,0,132,90,0,0,66,136,0,0,132,90,0,0,68,136,0,0,132,90,0,0,70,136,0,0,72,90,0,0,72,136,0,0,240,0,0,0,0,0,0,0,16,0,0,0,168,1,0,0,168,1,0,0,168,1,0,0,168,1,0,0,16,0,0,0,168,1,0,0,168,1,0,0,168,1,0,0,168,1,0,0,168,1,0,0,16,0,0,0,168,1,0,0,168,1,0,0,168,1,0,0,0,0,157,62,0,64,94,62,0,192,4,62,0,128,237,62,0,64,137,62,0,0,0,0,0,192,76,63,0,0,205,61,0,0,0,0,34,109,0,0,42,109,0,0,59,109,0,0,76,109,0,0,91,109,0,0,108,109,0,0,132,109,0,0,146,109,0,0,16,39,0,0,232,3,0,0,248,42,0,0,232,3,0,0,188,52,0,0,232,3,0,0,176,54,0,0,208,7,0,0,224,46,0,0,232,3,0,0,176,54,0,0,232,3,0,0,128,62,0,0,232,3,0,0,32,78,0,0,232,3,0,0,240,85,0,0,232,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,224,46,0,0,16,39,0,0,16,39,0,0,248,42,0,0,248,42,0,0,128,62,0,0,188,52,0,0,188,52,0,0,152,58,0,0,152,58,0,0,32,78,0,0,128,62,0,0,128,62,0,0,80,70,0,0,80,70,0,0,192,93,0,0,80,70,0,0,80,70,0,0,8,82,0,0,8,82,0,0,0,125,0,0,240,85,0,0,240,85,0,0,96,109,0,0,96,109,0,0,0,250,0,0,112,148,0,0,112,148,0,0,80,195,0,0,80,195,0,0,230,90,52,56,119,78,51,57,211,217,201,57,146,145,51,58,204,96,140,58,97,251,201,58,153,126,9,59,203,128,51,59,213,37,99,59,119,46,140,59,168,138,169,59,69,184,201,59,135,166,236,59,232,46,9,60,174,102,29,60,247,2,51,60,147,255,73,60,79,88,98,60,94,17,124,60,46,145,139,60,189,199,153,60,92,172,168,60,243,60,184,60,129,121,200,60,238,95,217,60,57,240,234,60,99,42,253,60,53,7,8,61,16,204,17,61,205,228,27,61,97,80,38,61,203,14,49,61,0,31,60,61,254,128,71,61,198,52,83,61,63,56,95,61,105,139,107,61,69,46,120,61,105,144,130,61,123,48,137,61,224,247,143,61,138,229,150,61,123,249,157,61,177,51,165,61,33,147,172,61,80,24,180,61,51,194,187,61,79,145,195,61,18,132,203,61,2,155,211,61,31,214,219,61,215,51,228,61,175,180,236,61,33,88,245,61,168,29,254,61,161,130,3,62,242,6,8,62,199,155,12,62,221,64,17,62,52,246,21,62,69,187,26,62,17,144,31,62,84,116,36,62,203,103,41,62,51,106,46,62,141,123,51,62,82,155,56,62,197,201,61,62,28,6,67,62,89,80,72,62,122,168,77,62,183,13,83,62,82,128,88,62,8,0,94,62,84,140,99,62,242,36,105,62,37,202,110,62,36,123,116,62,172,55,122,62,0,0,128,62,171,233,130,62,249,216,133,62,133,205,136,62,80,199,139,62,55,198,142,62,247,201,145,62,179,210,148,62,38,224,151,62,15,242,154,62,108,8,158,62,28,35,161,62,255,65,164,62,208,100,167,62,177,139,170,62,28,182,173,62,84,228,176,62,211,21,180,62,186,74,183,62,232,130,186,62,249,189,189,62,13,252,192,62,226,60,196,62,86,128,199,62,71,198,202,62,149,14,206,62,251,88,209,62,122,165,212,62,241,243,215,62,28,68,219,62,217,149,222,62,8,233,225,62,167,61,229,62,83,147,232,62,12,234,235,62,175,65,239,62,28,154,242,62,14,243,245,62,136,76,249,62,34,166,252,62,0,0,0,63,239,172,1,63,188,89,3,63,121,6,5,63,242,178,6,63,41,95,8,63,250,10,10,63,86,182,11,63,44,97,13,63,124,11,15,63,19,181,16,63,242,93,18,63,8,6,20,63,67,173,21,63,130,83,23,63,182,248,24,63,220,156,26,63,213,63,28,63,143,225,29,63,249,129,31,63,4,33,33,63,140,190,34,63,163,90,36,63,23,245,37,63,214,141,39,63,242,36,41,63,40,186,42,63,152,77,44,63,1,223,45,63,114,110,47,63,202,251,48,63,249,134,50,63,237,15,52,63,167,150,53,63,4,27,55,63,229,156,56,63,88,28,58,63,61,153,59,63,131,19,61,63,42,139,62,63,0,0,64,63,21,114,65,63,55,225,66,63,119,77,68,63,195,182,69,63,235,28,71,63,254,127,72,63,236,223,73,63,146,60,75,63,225,149,76,63,234,235,77,63,121,62,79,63,143,141,80,63,43,217,81,63,29,33,83,63,115,101,84,63,13,166,85,63,235,226,86,63,252,27,88,63,47,81,89,63,115,130,90,63,201,175,91,63,14,217,92,63,67,254,93,63,88,31,95,63,75,60,96,63,252,84,97,63,106,105,98,63,133,121,99,63,60,133,100,63,160,140,101,63,126,143,102,63,214,141,103,63,186,135,104,63,246,124,105,63,156,109,106,63,138,89,107,63,209,64,108,63,79,35,109,63,4,1,110,63,241,217,110,63,243,173,111,63,28,125,112,63,73,71,113,63,124,12,114,63,180,204,114,63,240,135,115,63,16,62,116,63,19,239,116,63,250,154,117,63,179,65,118,63,63,227,118,63,141,127,119,63,173,22,120,63,126,168,120,63,1,53,121,63,52,188,121,63,24,62,122,63,157,186,122,63,194,49,123,63,119,163,123,63,187,15,124,63,159,118,124,63,2,216,124,63,244,51,125,63,101,138,125,63,68,219,125,63,179,38,126,63,143,108,126,63,235,172,126,63,163,231,126,63,218,28,127,63,127,76,127,63,129,118,127,63,2,155,127,63,208,185,127,63,28,211,127,63,197,230,127,63,203,244,127,63,47,253,127,63,0,0,128,63,2,0,0,0,4,0,0,0,6,0,0,0,8,0,0,0,10,0,0,0,12,0,0,0,14,0,0,0,16,0,0,0,20,0,0,0,24,0,0,0,28,0,0,0,32,0,0,0,40,0,0,0,48,0,0,0,56,0,0,0,68,0,0,0,80,0,0,0,96,0,0,0,120,0,0,0,1,0,0,0,2,0,0,0,4,0,0,0,6,0,0,0,8,0,0,0,10,0,0,0,12,0,0,0,14,0,0,0,16,0,0,0,20,0,0,0,24,0,0,0,28,0,0,0,32,0,0,0,40,0,0,0,48,0,0,0,56,0,0,0,68,0,0,0,80,0,0,0,96,0,0,0,120,0,0,0,160,0,0,0,200,0,0,0,0,0,128,62,0,0,128,62,0,0,128,62,0,0,128,62,0,0,128,62,0,0,128,62,0,0,128,62,0,0,128,62,0,0,128,62,0,0,128,62,0,0,128,62,0,0,128,62,0,0,128,62,0,0,128,62,0,0,128,62,0,0,128,62,208,37,180,62,151,57,173,62,9,165,159,62,250,237,139,62,205,172,101,62,248,169,42,62,52,48,210,61,90,241,13,61,90,241,13,189,52,48,210,189,248,169,42,190,205,172,101,190,250,237,139,190,9,165,159,190,151,57,173,190,208,37,180,190,135,138,177,62,27,131,150,62,96,35,73,62,196,66,141,61,196,66,141,189,96,35,73,190,27,131,150,190,135,138,177,190,135,138,177,190,27,131,150,190,96,35,73,190,196,66,141,189,196,66,141,61,96,35,73,62,27,131,150,62,135,138,177,62,151,57,173,62,205,172,101,62,90,241,13,61,248,169,42,190,9,165,159,190,208,37,180,190,250,237,139,190,52,48,210,189,52,48,210,61,250,237,139,62,208,37,180,62,9,165,159,62,248,169,42,62,90,241,13,189,205,172,101,190,151,57,173,190,125,61,167,62,210,139,10,62,210,139,10,190,125,61,167,190,125,61,167,190,210,139,10,190,210,139,10,62,125,61,167,62,125,61,167,62,210,139,10,62,210,139,10,190,125,61,167,190,125,61,167,190,210,139,10,190,210,139,10,62,125,61,167,62,9,165,159,62,90,241,13,61,250,237,139,190,151,57,173,190,52,48,210,189,205,172,101,62,208,37,180,62,248,169,42,62,248,169,42,190,208,37,180,190,205,172,101,190,52,48,210,61,151,57,173,62,250,237,139,62,90,241,13,189,9,165,159,190,27,131,150,62,196,66,141,189,135,138,177,190,96,35,73,190,96,35,73,62,135,138,177,62,196,66,141,61,27,131,150,190,27,131,150,190,196,66,141,61,135,138,177,62,96,35,73,62,96,35,73,190,135,138,177,190,196,66,141,189,27,131,150,62,250,237,139,62,248,169,42,190,151,57,173,190,90,241,13,61,208,37,180,62,52,48,210,61,9,165,159,190,205,172,101,190,205,172,101,62,9,165,159,62,52,48,210,189,208,37,180,190,90,241,13,189,151,57,173,62,248,169,42,62,250,237,139,190,22,235,181,64,30,107,94,64,35,164,226,63,185,197,204,63,91,124,113,64,184,115,10,64,116,96,161,63,136,245,142,63,19,155,245,63,0,0,0,0,5,193,35,61,233,125,163,61,37,150,244,61,226,116,34,62,172,28,74,62,221,37,113,62,52,186,139,62,180,119,158,62,228,191,176,62,173,136,194,62,37,201,211,62,24,122,228,62,24,149,244,62,200,10,2,63,28,124,9,63,73,157,16,63,202,109,23,63,192,237,29,63,159,29,36,63,84,254,41,63,46,145,47,63,224,215,52,63,99,212,57,63,240,136,62,63,211,247,66,63,171,35,71,63,23,15,75,63,216,188,78,63,173,47,82,63,106,106,85,63,206,111,88,63,154,66,91,63,142,229,93,63,75,91,96,63,110,166,98,63,100,201,100,63,155,198,102,63,111,160,104,63,247,88,106,63,128,242,107,63,223,110,109,63,11,208,110,63,202,23,112,63,224,71,113,63,225,97,114,63,77,103,115,63,150,89,116,63,12,58,117,63,255,9,118,63,138,202,118,63,187,124,119,63,192,33,120,63,98,186,120,63,157,71,121,63,75,202,121,63,36,67,122,63,242,178,122,63,59,26,123,63,200,121,123,63,32,210,123,63,200,35,124,63,55,111,124,63,242,180,124,63,94,245,124,63,224,48,125,63,236,103,125,63,183,154,125,63,180,201,125,63,6,245,125,63,17,29,126,63,24,66,126,63,78,100,126,63,211,131,126,63,253,160,126,63,237,187,126,63,195,212,126,63,179,235,126,63,239,0,127,63,135,20,127,63,141,38,127,63,67,55,127,63,170,70,127,63,227,84,127,63,15,98,127,63,47,110,127,63,100,121,127,63,190,131,127,63,63,141,127,63,24,150,127,63,56,158,127,63,194,165,127,63,163,172,127,63,16,179,127,63,245,184,127,63,119,190,127,63,114,195,127,63,25,200,127,63,108,204,127,63,91,208,127,63,6,212,127,63,111,215,127,63,131,218,127,63,102,221,127,63,21,224,127,63,130,226,127,63,205,228,127,63,230,230,127,63,205,232,127,63,146,234,127,63,70,236,127,63,200,237,127,63,40,239,127,63,120,240,127,63,166,241,127,63,195,242,127,63,191,243,127,63,186,244,127,63,148,245,127,63,94,246,127,63,39,247,127,63,207,247,127,63,119,248,127,63,253,248,127,63,148,249,127,63,9,250,127,63,127,250,127,63,244,250,127,63,89,251,127,63,173,251,127,63,1,252,127,63,84,252,127,63,152,252,127,63,219,252,127,63,30,253,127,63,80,253,127,63,130,253,127,63,181,253,127,63,231,253,127,63,9,254,127,63,59,254,127,63,93,254,127,63,126,254,127,63,143,254,127,63,176,254,127,63,210,254,127,63,227,254,127,63,244,254,127,63,21,255,127,63,38,255,127,63,55,255,127,63,71,255,127,63,88,255,127,63,88,255,127,63,105,255,127,63,122,255,127,63,122,255,127,63,139,255,127,63,155,255,127,63,155,255,127,63,155,255,127,63,172,255,127,63,172,255,127,63,189,255,127,63,189,255,127,63,189,255,127,63,206,255,127,63,206,255,127,63,206,255,127,63,206,255,127,63,206,255,127,63,222,255,127,63,222,255,127,63,222,255,127,63,222,255,127,63,222,255,127,63,222,255,127,63,239,255,127,63,239,255,127,63,239,255,127,63,239,255,127,63,239,255,127,63,239,255,127,63,239,255,127,63,239,255,127,63,239,255,127,63,239,255,127,63,239,255,127,63,239,255,127,63,239,255,127,63,0,0,128,63,0,0,128,63,0,0,128,63,0,0,128,63,0,0,128,63,0,0,128,63,0,0,128,63,0,0,128,63,0,0,128,63,0,0,128,63,0,0,128,63,92,201,154,191,92,181,225,188,29,102,249,60,41,7,147,189,76,199,183,189,254,214,206,61,107,200,73,189,213,203,143,61,162,63,153,60,131,208,139,59,7,3,132,61,170,154,224,189,251,30,245,189,156,141,17,188,11,14,47,62,98,192,50,62,25,231,135,190,14,59,130,189,104,203,145,190,133,66,136,191,57,185,79,62,205,228,19,64,254,212,48,192,107,127,215,190,71,229,50,63,144,218,206,64,190,165,135,61,26,70,155,61,241,153,81,61,23,176,46,61,228,249,236,61,194,18,135,190,137,197,57,188,107,74,66,190,44,114,190,189,15,94,147,190,234,136,189,61,164,240,234,60,161,171,163,188,103,180,69,190,98,101,132,62,179,149,151,60,242,210,237,61,140,77,203,61,221,29,0,188,97,51,136,190,116,69,145,62,227,199,40,65,110,133,40,191,198,53,86,63,106,222,81,65,36,209,160,192,56,103,140,191,137,42,151,189,64,184,167,60,103,126,53,60,37,104,2,187,152,220,139,59,239,146,24,62,41,174,154,61,238,207,229,61,197,96,84,189,236,162,232,60,105,97,197,60,53,77,78,189,26,24,25,190,227,199,8,190,182,159,12,190,150,33,238,61,117,202,115,62,250,97,164,61,125,168,30,61,218,27,188,61,180,142,129,64,129,149,79,64,2,43,55,191,225,93,2,65,218,44,239,193,246,40,148,63,255,147,255,189,102,233,185,60,124,187,64,189,90,0,9,189,207,206,19,61,20,106,55,61,121,110,41,187,165,84,157,188,137,151,231,189,90,72,224,61,75,81,51,189,51,156,28,61,194,238,34,188,128,99,31,190,82,12,48,62,141,123,99,190,91,8,6,191,166,34,58,189,54,144,14,191,23,244,66,63,23,217,44,192,69,13,98,191,113,29,99,63,107,15,63,63,168,25,186,190,127,137,184,62,66,91,14,61,15,97,124,188,56,153,225,59,58,135,27,188,169,33,128,61,86,182,79,189,178,164,23,61,110,10,117,60,67,86,119,61,71,94,145,189,118,138,21,189,47,196,202,61,104,185,34,189,150,10,146,62,113,231,2,62,77,45,27,190,59,29,136,62,111,117,170,189,14,67,85,61,140,214,101,63,202,224,224,62,144,131,64,192,163,1,248,63,103,68,209,190,54,172,153,62,227,194,181,191,69,74,243,61,178,70,61,189,146,230,79,61,22,83,196,188,77,235,128,189,165,98,8,188,160,53,223,189,183,222,5,189,46,143,213,61,96,168,136,189,8,242,66,61,75,175,141,61,63,127,107,189,121,33,13,190,10,242,83,190,129,236,37,190,88,114,85,190,45,39,17,62,57,41,148,190,154,153,73,191,163,146,186,61,240,50,51,62,10,46,2,192,198,80,68,64,133,124,156,63,95,210,6,64,48,139,159,61,171,63,98,190,60,106,12,62,216,26,128,189,100,118,150,189,195,14,51,62,84,195,14,190,131,32,198,61,103,30,170,61,167,7,101,190,13,250,210,61,147,139,209,189,146,6,103,62,123,20,30,62,83,93,64,62,22,226,15,188,77,188,3,62,60,50,190,190,86,68,245,190,73,76,32,62,106,48,141,63,196,124,161,191,19,13,178,61,28,181,18,190,57,185,11,64,18,218,56,192,38,27,207,61,119,219,157,190,203,101,99,62,140,44,105,190,51,31,12,188,188,93,47,60,26,189,253,59,149,207,151,188,8,181,250,60,252,55,111,190,62,86,165,61,13,54,245,188,175,150,27,62,31,19,137,190,22,143,70,61,87,93,7,62,150,148,107,190,235,59,183,62,168,114,154,61,167,149,226,61,103,155,163,191,174,216,83,64,156,192,84,63,188,118,89,190,203,161,165,193,252,24,147,191,62,46,0,61,22,207,170,188,109,194,3,188,13,228,52,60,76,23,226,60,94,191,253,58,3,71,93,188,3,132,201,187,99,6,79,61,150,27,49,188,190,138,88,58,58,177,199,188,119,103,165,190,169,211,139,61,238,8,15,191,175,7,211,189,41,34,51,62,108,152,1,190,136,13,214,189,43,79,216,62,52,234,139,189,171,91,185,191,106,189,51,63,173,78,54,63,236,24,215,190,201,60,38,64,232,221,243,188,27,145,57,189,185,75,7,189,85,29,13,189,165,90,213,188,35,17,122,189,144,195,187,61,245,244,209,60,72,108,215,189,184,241,157,61,150,18,184,189,131,161,62,190,154,92,164,190,4,27,103,190,120,11,52,62,56,129,129,62,107,40,61,63,2,212,26,64,153,129,234,61,4,200,160,190,198,164,27,63,129,178,221,63,87,38,6,192,164,253,27,191,240,80,152,63,51,53,233,61,233,239,53,190,169,237,160,189,98,49,178,190,76,105,194,189,155,132,156,188,254,240,171,62,96,4,109,189,194,104,6,62,43,18,243,189,64,75,7,190,254,95,117,190,119,167,65,58,2,102,62,190,146,232,5,190,239,116,223,190,94,16,17,190,187,191,16,61,20,198,91,189,132,137,197,189,111,45,99,62,109,168,248,63,76,137,228,191,91,211,116,64,35,190,111,64,182,185,23,64,227,170,182,191,215,183,61,61,62,230,104,189,170,229,88,61,29,114,211,189,226,147,174,190,198,194,208,61,79,145,79,191,195,98,52,62,3,119,240,62,144,222,203,60,19,213,219,189,99,71,19,190,169,61,59,189,229,122,71,63,75,144,17,190,9,129,33,61,106,161,36,62,200,38,53,191,91,181,27,191,126,24,137,63,124,155,162,191,249,189,17,64,54,205,203,64,10,20,5,63,165,73,85,192,70,122,1,190,179,80,193,189,15,198,217,60,14,62,126,61,52,147,57,60,169,249,130,190,29,176,150,189,125,219,130,189,206,112,195,189,88,226,81,190,21,24,149,59,62,81,99,61,5,105,38,190,235,230,18,191,183,124,132,62,140,185,75,62,61,164,179,60,75,230,192,190,43,50,2,191,22,24,157,189,25,142,39,191,248,165,143,64,103,237,88,64,227,25,22,192,193,57,49,193,167,116,139,64,15,127,213,63,227,129,82,189,253,114,140,189,204,192,55,188,190,157,243,57,254,123,112,190,116,92,173,190,227,167,17,190,212,126,43,190,24,177,15,190,150,176,214,189,48,100,213,189,144,204,52,60,123,190,230,189,57,165,178,61,42,224,46,190,69,155,179,189,224,157,252,61,43,133,32,190,158,208,75,62,116,208,101,189,126,54,102,63,242,249,167,61,143,194,165,191,164,231,241,60,55,166,17,64,235,228,112,191,169,2,36,188,156,111,228,189,154,93,7,190,171,9,226,189,126,29,24,61,207,152,147,188,19,0,45,188,234,106,161,60,33,229,39,61,192,163,92,189,78,155,209,189,224,208,64,189,139,78,54,62,105,25,137,190,231,167,216,189,95,207,215,189,194,73,127,61,52,190,47,189,194,195,52,62,247,234,35,190,168,58,18,192,101,141,246,191,116,98,95,62,180,188,26,65,146,116,83,64,160,55,225,191,122,200,4,62,228,73,242,61,246,36,16,62,235,223,138,61,12,62,77,59,137,205,108,188,56,33,254,188,96,209,200,188,25,60,12,62,132,189,25,62,45,11,230,61,121,161,154,189,35,221,143,190,130,83,127,190,19,129,46,191,240,31,1,61,12,6,151,62,139,187,38,61,202,197,144,62,4,57,176,190,69,129,234,192,30,81,97,190,142,119,15,191,191,154,239,191,3,62,227,192,179,210,8,65,196,66,5,64,192,93,118,62,189,24,162,63,174,156,253,60,179,152,140,191,122,142,92,63,186,189,196,191,106,106,137,63,198,138,140,64,99,180,38,192,82,12,192,62,126,200,251,61,169,231,85,59,40,244,70,63,137,7,2,192,108,206,113,191,82,242,128,64,216,127,133,190,63,111,14,63,148,220,97,190,2,183,226,191,40,212,91,191,230,150,194,191,215,190,72,191,25,32,177,62,201,21,72,189,50,146,165,190,160,168,64,191,202,112,4,63,170,96,96,63,69,100,184,191,174,185,195,190,108,236,198,191,0,0,128,63,0,0,0,64,0,0,64,64,0,0,128,64,0,0,160,64,0,0,192,64,0,0,224,64,0,0,0,65,0,0,128,65,0,0,192,65,0,0,16,66,0,0,48,66,0,0,72,66,0,0,96,66,0,0,120,66,0,0,134,66,0,0,144,66,0,0,158,66,0,0,176,66,0,0,212,66,0,0,6,67,0,0,128,63,0,0,128,63,0,0,128,63,0,0,128,63,0,0,128,63,0,0,128,63,0,0,128,63,0,0,0,64,0,0,0,64,0,0,0,64,0,0,0,64,0,0,0,64,0,0,0,64,0,0,0,64,0,0,64,64,0,0,64,64,0,0,128,64,0,0,160,64,0,0,192,64,0,0,0,65,0,0,0,65,149,139,0,0,55,152,0,0,255,165,0,0,4,181,0,0,103,197,0,0,69,215,0,0,193,234,0,0,255,255,0,0,128,187,0,0,120,0,0,0,21,0,0,0,21,0,0,0,0,154,89,63,0,0,0,0,0,0,128,63,0,0,128,63,220,90,0,0,3,0,0,0,8,0,0,0,120,0,0,0,11,0,0,0,58,110,0,0,8,91,0,0,36,21,0,0,128,7,0,0,3,0,0,0,4,23,0,0,60,38,0,0,116,38,0,0,172,38,0,0,228,38,0,0,136,1,0,0,58,98,0,0,33,111,0,0,169,112,0,0,106,28,141,56,82,187,30,58,8,105,220,58,130,237,87,59,137,99,178,59,3,42,5,60,48,220,57,60,180,62,119,60,28,163,158,60,209,242,197,60,254,134,241,60,155,171,16,61,5,173,42,61,132,194,70,61,83,230,100,61,17,137,130,61,135,159,147,61,203,178,165,61,209,190,184,61,58,191,204,61,84,175,225,61,20,138,247,61,14,37,7,62,217,244,18,62,95,49,31,62,104,215,43,62,138,227,56,62,48,82,70,62,148,31,84,62,191,71,98,62,142,198,112,62,176,151,127,62,82,91,135,62,96,15,143,62,152,229,150,62,121,219,158,62,112,238,166,62,216,27,175,62,251,96,183,62,17,187,191,62,70,39,200,62,183,162,208,62,120,42,217,62,148,187,225,62,12,83,234,62,222,237,242,62,6,137,251,62,190,16,2,63,31,90,6,63,36,159,10,63,80,222,14,63,43,22,19,63,65,69,23,63,37,106,27,63,115,131,31,63,206,143,35,63,230,141,39,63,116,124,43,63,63,90,47,63,25,38,51,63,231,222,54,63,153,131,58,63,51,19,62,63,197,140,65,63,119,239,68,63,127,58,72,63,39,109,75,63,206,134,78,63,229,134,81,63,241,108,84,63,142,56,87,63,105,233,89,63,69,127,92,63,250,249,94,63,115,89,97,63,175,157,99,63,193,198,101,63,207,212,103,63,17,200,105,63,210,160,107,63,110,95,109,63,80,4,111,63,244,143,112,63,230,2,114,63,189,93,115,63,31,161,116,63,191,205,117,63,87,228,118,63,176,229,119,63,151,210,120,63,227,171,121,63,115,114,122,63,39,39,123,63,231,202,123,63,157,94,124,63,53,227,124,63,156,89,125,63,189,194,125,63,134,31,126,63,222,112,126,63,171,183,126,63,207,244,126,63,38,41,127,63,134,85,127,63,190,122,127,63,150,153,127,63,204,178,127,63,20,199,127,63,28,215,127,63,130,227,127,63,221,236,127,63,182,243,127,63,138,248,127,63,200,251,127,63,214,253,127,63,7,255,127,63,165,255,127,63,232,255,127,63,253,255,127,63,0,0,128,63,224,1,0,0,135,136,8,59,255,255,255,255,5,0,96,0,3,0,32,0,4,0,8,0,2,0,4,0,4,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,50,91,0,0,60,23,0,0,0,0,0,0,0,0,128,63,0,0,0,128,99,250,127,63,191,117,86,188,139,233,127,63,10,113,214,188,121,205,127,63,231,206,32,189,47,166,127,63,58,94,86,189,175,115,127,63,19,242,133,189,249,53,127,63,42,175,160,189,18,237,126,63,51,101,187,189,253,152,126,63,4,19,214,189,188,57,126,63,115,183,240,189,85,207,125,63,168,168,5,190,203,89,125,63,187,239,18,190,37,217,124,63,92,48,32,190,103,77,124,63,245,105,45,190,152,182,123,63,243,155,58,190,190,20,123,63,194,197,71,190,226,103,122,63,205,230,84,190,9,176,121,63,130,254,97,190,60,237,120,63,77,12,111,190,132,31,120,63,156,15,124,190,234,70,119,63,238,131,132,190,119,99,118,63,62,250,138,190,54,117,117,63,117,106,145,190,48,124,116,63,76,212,151,190,113,120,115,63,122,55,158,190,3,106,114,63,183,147,164,190,244,80,113,63,188,232,170,190,79,45,112,63,65,54,177,190,33,255,110,63,1,124,183,190,118,198,109,63,180,185,189,190,94,131,108,63,21,239,195,190,231,53,107,63,222,27,202,190,30,222,105,63,201,63,208,190,18,124,104,63,146,90,214,190,212,15,103,63,243,107,220,190,116,153,101,63,170,115,226,190,1,25,100,63,113,113,232,190,141,142,98,63,7,101,238,190,40,250,96,63,39,78,244,190,230,91,95,63,144,44,250,190,215,179,93,63,0,0,0,191,15,2,92,63,27,228,2,191,160,70,90,63,119,194,5,191,158,129,88,63,246,154,8,191,29,179,86,63,119,109,11,191,49,219,84,63,218,57,14,191,239,249,82,63,0,0,17,191,108,15,81,63,202,191,19,191,189,27,79,63,24,121,22,191,248,30,77,63,205,43,25,191,52,25,75,63,202,215,27,191,136,10,73,63,241,124,30,191,10,243,70,63,36,27,33,191,209,210,68,63,70,178,35,191,247,169,66,63,58,66,38,191,147,120,64,63,227,202,40,191,189,62,62,63,37,76,43,191,143,252,59,63,227,197,45,191,34,178,57,63,1,56,48,191,144,95,55,63,101,162,50,191,243,4,53,63,243,4,53,191,101,162,50,63,144,95,55,191,1,56,48,63,34,178,57,191,227,197,45,63,143,252,59,191,37,76,43,63,189,62,62,191,227,202,40,63,147,120,64,191,58,66,38,63,247,169,66,191,70,178,35,63,209,210,68,191,36,27,33,63,10,243,70,191,241,124,30,63,136,10,73,191,202,215,27,63,52,25,75,191,205,43,25,63,248,30,77,191,24,121,22,63,189,27,79,191,202,191,19,63,108,15,81,191,0,0,17,63,239,249,82,191,218,57,14,63,49,219,84,191,119,109,11,63,29,179,86,191,246,154,8,63,158,129,88,191,119,194,5,63,160,70,90,191,27,228,2,63,15,2,92,191,0,0,0,63,215,179,93,191,144,44,250,62,230,91,95,191,39,78,244,62,40,250,96,191,7,101,238,62,141,142,98,191,113,113,232,62,1,25,100,191,170,115,226,62,116,153,101,191,243,107,220,62,212,15,103,191,146,90,214,62,18,124,104,191,201,63,208,62,30,222,105,191,222,27,202,62,231,53,107,191,21,239,195,62,94,131,108,191,180,185,189,62,118,198,109,191,1,124,183,62,33,255,110,191,65,54,177,62,79,45,112,191,188,232,170,62,244,80,113,191,183,147,164,62,3,106,114,191,122,55,158,62,113,120,115,191,76,212,151,62,48,124,116,191,117,106,145,62,54,117,117,191,62,250,138,62,119,99,118,191,238,131,132,62,234,70,119,191,156,15,124,62,132,31,120,191,77,12,111,62,60,237,120,191,130,254,97,62,9,176,121,191,205,230,84,62,226,103,122,191,194,197,71,62,190,20,123,191,243,155,58,62,152,182,123,191,245,105,45,62,103,77,124,191,92,48,32,62,37,217,124,191,187,239,18,62,203,89,125,191,168,168,5,62,85,207,125,191,115,183,240,61,188,57,126,191,4,19,214,61,253,152,126,191,51,101,187,61,18,237,126,191,42,175,160,61,249,53,127,191,19,242,133,61,175,115,127,191,58,94,86,61,47,166,127,191,231,206,32,61,121,205,127,191,10,113,214,60,139,233,127,191,191,117,86,60,99,250,127,191,0,48,141,36,0,0,128,191,191,117,86,188,99,250,127,191,10,113,214,188,139,233,127,191,231,206,32,189,121,205,127,191,58,94,86,189,47,166,127,191,19,242,133,189,175,115,127,191,42,175,160,189,249,53,127,191,51,101,187,189,18,237,126,191,4,19,214,189,253,152,126,191,115,183,240,189,188,57,126,191,168,168,5,190,85,207,125,191,187,239,18,190,203,89,125,191,92,48,32,190,37,217,124,191,245,105,45,190,103,77,124,191,243,155,58,190,152,182,123,191,194,197,71,190,190,20,123,191,205,230,84,190,226,103,122,191,130,254,97,190,9,176,121,191,77,12,111,190,60,237,120,191,156,15,124,190,132,31,120,191,238,131,132,190,234,70,119,191,62,250,138,190,119,99,118,191,117,106,145,190,54,117,117,191,76,212,151,190,48,124,116,191,122,55,158,190,113,120,115,191,183,147,164,190,3,106,114,191,188,232,170,190,244,80,113,191,65,54,177,190,79,45,112,191,1,124,183,190,33,255,110,191,180,185,189,190,118,198,109,191,21,239,195,190,94,131,108,191,222,27,202,190,231,53,107,191,201,63,208,190,30,222,105,191,146,90,214,190,18,124,104,191,243,107,220,190,212,15,103,191,170,115,226,190,116,153,101,191,113,113,232,190,1,25,100,191,7,101,238,190,141,142,98,191,39,78,244,190,40,250,96,191,144,44,250,190,230,91,95,191,0,0,0,191,215,179,93,191,27,228,2,191,15,2,92,191,119,194,5,191,160,70,90,191,246,154,8,191,158,129,88,191,119,109,11,191,29,179,86,191,218,57,14,191,49,219,84,191,0,0,17,191,239,249,82,191,202,191,19,191,108,15,81,191,24,121,22,191,189,27,79,191,205,43,25,191,248,30,77,191,202,215,27,191,52,25,75,191,241,124,30,191,136,10,73,191,36,27,33,191,10,243,70,191,70,178,35,191,209,210,68,191,58,66,38,191,247,169,66,191,227,202,40,191,147,120,64,191,37,76,43,191,189,62,62,191,227,197,45,191,143,252,59,191,1,56,48,191,34,178,57,191,101,162,50,191,144,95,55,191,243,4,53,191,243,4,53,191,144,95,55,191,101,162,50,191,34,178,57,191,1,56,48,191,143,252,59,191,227,197,45,191,189,62,62,191,37,76,43,191,147,120,64,191,227,202,40,191,247,169,66,191,58,66,38,191,209,210,68,191,70,178,35,191,10,243,70,191,36,27,33,191,136,10,73,191,241,124,30,191,52,25,75,191,202,215,27,191,248,30,77,191,205,43,25,191,189,27,79,191,24,121,22,191,108,15,81,191,202,191,19,191,239,249,82,191,0,0,17,191,49,219,84,191,218,57,14,191,29,179,86,191,119,109,11,191,158,129,88,191,246,154,8,191,160,70,90,191,119,194,5,191,15,2,92,191,27,228,2,191,215,179,93,191,0,0,0,191,230,91,95,191,144,44,250,190,40,250,96,191,39,78,244,190,141,142,98,191,7,101,238,190,1,25,100,191,113,113,232,190,116,153,101,191,170,115,226,190,212,15,103,191,243,107,220,190,18,124,104,191,146,90,214,190,30,222,105,191,201,63,208,190,231,53,107,191,222,27,202,190,94,131,108,191,21,239,195,190,118,198,109,191,180,185,189,190,33,255,110,191,1,124,183,190,79,45,112,191,65,54,177,190,244,80,113,191,188,232,170,190,3,106,114,191,183,147,164,190,113,120,115,191,122,55,158,190,48,124,116,191,76,212,151,190,54,117,117,191,117,106,145,190,119,99,118,191,62,250,138,190,234,70,119,191,238,131,132,190,132,31,120,191,156,15,124,190,60,237,120,191,77,12,111,190,9,176,121,191,130,254,97,190,226,103,122,191,205,230,84,190,190,20,123,191,194,197,71,190,152,182,123,191,243,155,58,190,103,77,124,191,245,105,45,190,37,217,124,191,92,48,32,190,203,89,125,191,187,239,18,190,85,207,125,191,168,168,5,190,188,57,126,191,115,183,240,189,253,152,126,191,4,19,214,189,18,237,126,191,51,101,187,189,249,53,127,191,42,175,160,189,175,115,127,191,19,242,133,189,47,166,127,191,58,94,86,189,121,205,127,191,231,206,32,189,139,233,127,191,10,113,214,188,99,250,127,191,191,117,86,188,0,0,128,191,0,48,13,165,99,250,127,191,191,117,86,60,139,233,127,191,10,113,214,60,121,205,127,191,231,206,32,61,47,166,127,191,58,94,86,61,175,115,127,191,19,242,133,61,249,53,127,191,42,175,160,61,18,237,126,191,51,101,187,61,253,152,126,191,4,19,214,61,188,57,126,191,115,183,240,61,85,207,125,191,168,168,5,62,203,89,125,191,187,239,18,62,37,217,124,191,92,48,32,62,103,77,124,191,245,105,45,62,152,182,123,191,243,155,58,62,190,20,123,191,194,197,71,62,226,103,122,191,205,230,84,62,9,176,121,191,130,254,97,62,60,237,120,191,77,12,111,62,132,31,120,191,156,15,124,62,234,70,119,191,238,131,132,62,119,99,118,191,62,250,138,62,54,117,117,191,117,106,145,62,48,124,116,191,76,212,151,62,113,120,115,191,122,55,158,62,3,106,114,191,183,147,164,62,244,80,113,191,188,232,170,62,79,45,112,191,65,54,177,62,33,255,110,191,1,124,183,62,118,198,109,191,180,185,189,62,94,131,108,191,21,239,195,62,231,53,107,191,222,27,202,62,30,222,105,191,201,63,208,62,18,124,104,191,146,90,214,62,212,15,103,191,243,107,220,62,116,153,101,191,170,115,226,62,1,25,100,191,113,113,232,62,141,142,98,191,7,101,238,62,40,250,96,191,39,78,244,62,230,91,95,191,144,44,250,62,215,179,93,191,0,0,0,63,15,2,92,191,27,228,2,63,160,70,90,191,119,194,5,63,158,129,88,191,246,154,8,63,29,179,86,191,119,109,11,63,49,219,84,191,218,57,14,63,239,249,82,191,0,0,17,63,108,15,81,191,202,191,19,63,189,27,79,191,24,121,22,63,248,30,77,191,205,43,25,63,52,25,75,191,202,215,27,63,136,10,73,191,241,124,30,63,10,243,70,191,36,27,33,63,209,210,68,191,70,178,35,63,247,169,66,191,58,66,38,63,147,120,64,191,227,202,40,63,189,62,62,191,37,76,43,63,143,252,59,191,227,197,45,63,34,178,57,191,1,56,48,63,144,95,55,191,101,162,50,63,243,4,53,191,243,4,53,63,101,162,50,191,144,95,55,63,1,56,48,191,34,178,57,63,227,197,45,191,143,252,59,63,37,76,43,191,189,62,62,63,227,202,40,191,147,120,64,63,58,66,38,191,247,169,66,63,70,178,35,191,209,210,68,63,36,27,33,191,10,243,70,63,241,124,30,191,136,10,73,63,202,215,27,191,52,25,75,63,205,43,25,191,248,30,77,63,24,121,22,191,189,27,79,63,202,191,19,191,108,15,81,63,0,0,17,191,239,249,82,63,218,57,14,191,49,219,84,63,119,109,11,191,29,179,86,63,246,154,8,191,158,129,88,63,119,194,5,191,160,70,90,63,27,228,2,191,15,2,92,63,0,0,0,191,215,179,93,63,144,44,250,190,230,91,95,63,39,78,244,190,40,250,96,63,7,101,238,190,141,142,98,63,113,113,232,190,1,25,100,63,170,115,226,190,116,153,101,63,243,107,220,190,212,15,103,63,146,90,214,190,18,124,104,63,201,63,208,190,30,222,105,63,222,27,202,190,231,53,107,63,21,239,195,190,94,131,108,63,180,185,189,190,118,198,109,63,1,124,183,190,33,255,110,63,65,54,177,190,79,45,112,63,188,232,170,190,244,80,113,63,183,147,164,190,3,106,114,63,122,55,158,190,113,120,115,63,76,212,151,190,48,124,116,63,117,106,145,190,54,117,117,63,62,250,138,190,119,99,118,63,238,131,132,190,234,70,119,63,156,15,124,190,132,31,120,63,77,12,111,190,60,237,120,63,130,254,97,190,9,176,121,63,205,230,84,190,226,103,122,63,194,197,71,190,190,20,123,63,243,155,58,190,152,182,123,63,245,105,45,190,103,77,124,63,92,48,32,190,37,217,124,63,187,239,18,190,203,89,125,63,168,168,5,190,85,207,125,63,115,183,240,189,188,57,126,63,4,19,214,189,253,152,126,63,51,101,187,189,18,237,126,63,42,175,160,189,249,53,127,63,19,242,133,189,175,115,127,63,58,94,86,189,47,166,127,63,231,206,32,189,121,205,127,63,10,113,214,188,139,233,127,63,191,117,86,188,99,250,127,63,0,200,83,165,0,0,128,63,191,117,86,60,99,250,127,63,10,113,214,60,139,233,127,63,231,206,32,61,121,205,127,63,58,94,86,61,47,166,127,63,19,242,133,61,175,115,127,63,42,175,160,61,249,53,127,63,51,101,187,61,18,237,126,63,4,19,214,61,253,152,126,63,115,183,240,61,188,57,126,63,168,168,5,62,85,207,125,63,187,239,18,62,203,89,125,63,92,48,32,62,37,217,124,63,245,105,45,62,103,77,124,63,243,155,58,62,152,182,123,63,194,197,71,62,190,20,123,63,205,230,84,62,226,103,122,63,130,254,97,62,9,176,121,63,77,12,111,62,60,237,120,63,156,15,124,62,132,31,120,63,238,131,132,62,234,70,119,63,62,250,138,62,119,99,118,63,117,106,145,62,54,117,117,63,76,212,151,62,48,124,116,63,122,55,158,62,113,120,115,63,183,147,164,62,3,106,114,63,188,232,170,62,244,80,113,63,65,54,177,62,79,45,112,63,1,124,183,62,33,255,110,63,180,185,189,62,118,198,109,63,21,239,195,62,94,131,108,63,222,27,202,62,231,53,107,63,201,63,208,62,30,222,105,63,146,90,214,62,18,124,104,63,243,107,220,62,212,15,103,63,170,115,226,62,116,153,101,63,113,113,232,62,1,25,100,63,7,101,238,62,141,142,98,63,39,78,244,62,40,250,96,63,144,44,250,62,230,91,95,63,0,0,0,63,215,179,93,63,27,228,2,63,15,2,92,63,119,194,5,63,160,70,90,63,246,154,8,63,158,129,88,63,119,109,11,63,29,179,86,63,218,57,14,63,49,219,84,63,0,0,17,63,239,249,82,63,202,191,19,63,108,15,81,63,24,121,22,63,189,27,79,63,205,43,25,63,248,30,77,63,202,215,27,63,52,25,75,63,241,124,30,63,136,10,73,63,36,27,33,63,10,243,70,63,70,178,35,63,209,210,68,63,58,66,38,63,247,169,66,63,227,202,40,63,147,120,64,63,37,76,43,63,189,62,62,63,227,197,45,63,143,252,59,63,1,56,48,63,34,178,57,63,101,162,50,63,144,95,55,63,243,4,53,63,243,4,53,63,144,95,55,63,101,162,50,63,34,178,57,63,1,56,48,63,143,252,59,63,227,197,45,63,189,62,62,63,37,76,43,63,147,120,64,63,227,202,40,63,247,169,66,63,58,66,38,63,209,210,68,63,70,178,35,63,10,243,70,63,36,27,33,63,136,10,73,63,241,124,30,63,52,25,75,63,202,215,27,63,248,30,77,63,205,43,25,63,189,27,79,63,24,121,22,63,108,15,81,63,202,191,19,63,239,249,82,63,0,0,17,63,49,219,84,63,218,57,14,63,29,179,86,63,119,109,11,63,158,129,88,63,246,154,8,63,160,70,90,63,119,194,5,63,15,2,92,63,27,228,2,63,215,179,93,63,0,0,0,63,230,91,95,63,144,44,250,62,40,250,96,63,39,78,244,62,141,142,98,63,7,101,238,62,1,25,100,63,113,113,232,62,116,153,101,63,170,115,226,62,212,15,103,63,243,107,220,62,18,124,104,63,146,90,214,62,30,222,105,63,201,63,208,62,231,53,107,63,222,27,202,62,94,131,108,63,21,239,195,62,118,198,109,63,180,185,189,62,33,255,110,63,1,124,183,62,79,45,112,63,65,54,177,62,244,80,113,63,188,232,170,62,3,106,114,63,183,147,164,62,113,120,115,63,122,55,158,62,48,124,116,63,76,212,151,62,54,117,117,63,117,106,145,62,119,99,118,63,62,250,138,62,234,70,119,63,238,131,132,62,132,31,120,63,156,15,124,62,60,237,120,63,77,12,111,62,9,176,121,63,130,254,97,62,226,103,122,63,205,230,84,62,190,20,123,63,194,197,71,62,152,182,123,63,243,155,58,62,103,77,124,63,245,105,45,62,37,217,124,63,92,48,32,62,203,89,125,63,187,239,18,62,85,207,125,63,168,168,5,62,188,57,126,63,115,183,240,61,253,152,126,63,4,19,214,61,18,237,126,63,51,101,187,61,249,53,127,63,42,175,160,61,175,115,127,63,19,242,133,61,47,166,127,63,58,94,86,61,121,205,127,63,231,206,32,61,139,233,127,63,10,113,214,60,99,250,127,63,191,117,86,60,240,0,0,0,137,136,136,59,1,0,0,0,5,0,48,0,3,0,16,0,4,0,4,0,4,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,242,94,0,0,60,23,0,0,0,0,0,0,120,0,0,0,136,136,8,60,2,0,0,0,5,0,24,0,3,0,8,0,2,0,4,0,4,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,210,96,0,0,60,23,0,0,0,0,0,0,60,0,0,0,137,136,136,60,3,0,0,0,5,0,12,0,3,0,4,0,4,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,194,97,0,0,60,23,0,0,0,0,0,0,255,255,127,63,142,255,127,63,106,254,127,63,147,252,127,63,7,250,127,63,200,246,127,63,214,242,127,63,48,238,127,63,214,232,127,63,200,226,127,63,7,220,127,63,147,212,127,63,107,204,127,63,143,195,127,63,0,186,127,63,189,175,127,63,199,164,127,63,29,153,127,63,192,140,127,63,176,127,127,63,236,113,127,63,118,99,127,63,75,84,127,63,110,68,127,63,222,51,127,63,154,34,127,63,163,16,127,63,250,253,126,63,157,234,126,63,141,214,126,63,203,193,126,63,86,172,126,63,46,150,126,63,83,127,126,63,198,103,126,63,134,79,126,63,148,54,126,63,239,28,126,63,152,2,126,63,143,231,125,63,211,203,125,63,102,175,125,63,70,146,125,63,116,116,125,63,241,85,125,63,188,54,125,63,213,22,125,63,60,246,124,63,242,212,124,63,246,178,124,63,73,144,124,63,235,108,124,63,219,72,124,63,27,36,124,63,169,254,123,63,135,216,123,63,180,177,123,63,48,138,123,63,252,97,123,63,23,57,123,63,130,15,123,63,61,229,122,63,72,186,122,63,162,142,122,63,77,98,122,63,72,53,122,63,148,7,122,63,48,217,121,63,29,170,121,63,90,122,121,63,233,73,121,63,200,24,121,63,249,230,120,63],"i8",ALLOC_NONE,Runtime.GLOBAL_BASE), +\`\`\``,i)}edit(e=this.name,t){return t?this.client.resolver.resolveBuffer(t).then(t=>{const i=this.client.resolver.resolveBase64(t);return this.client.rest.methods.editWebhook(this,e,i)}):this.client.rest.methods.editWebhook(this,e).then(e=>{return this.setup(e),this})}delete(){return this.client.rest.methods.deleteWebhook(this)}}e.exports=s},function(e,t,i){function r(){return Object.keys(a)}var n=i(150);t.createCipher=t.Cipher=n.createCipher,t.createCipheriv=t.Cipheriv=n.createCipheriv;var s=i(149);t.createDecipher=t.Decipher=s.createDecipher,t.createDecipheriv=t.Decipheriv=s.createDecipheriv;var a=i(34);t.listCiphers=t.getCiphers=r},function(e,t,i){(function(t){function r(e){var t=s(e),i=t.toRed(a.mont(e.modulus)).redPow(new a(e.publicExponent)).fromRed();return{blinder:i,unblinder:t.invm(e.modulus)}}function n(e,i){var n=r(i),s=i.modulus.byteLength(),o=(a.mont(i.modulus),new a(e).mul(n.blinder).umod(i.modulus)),f=o.toRed(a.mont(i.prime1)),h=o.toRed(a.mont(i.prime2)),c=i.coefficient,l=i.prime1,u=i.prime2,d=f.redPow(i.exponent1),p=h.redPow(i.exponent2);d=d.fromRed(),p=p.fromRed();var b=d.isub(p).imul(c).umod(l);return b.imul(u),p.iadd(b),new t(p.imul(n.unblinder).umod(i.modulus).toArray(!1,s))}function s(e){for(var t=e.modulus.byteLength(),i=new a(o(t));i.cmp(e.modulus)>=0||!i.umod(e.prime1)||!i.umod(e.prime2);)i=new a(o(t));return i}var a=i(4),o=i(27);e.exports=n,n.getr=s}).call(t,i(0).Buffer)},function(e,t,i){"use strict";(function(e){var r=i(0),n=r.Buffer,s=r.SlowBuffer,a=r.kMaxLength||2147483647;t.alloc=function(e,t,i){if("function"==typeof n.alloc)return n.alloc(e,t,i);if("number"==typeof i)throw new TypeError("encoding must not be number");if("number"!=typeof e)throw new TypeError("size must be a number");if(e>a)throw new RangeError("size is too large");var r=i,s=t;void 0===s&&(r=void 0,s=0);var o=new n(e);if("string"==typeof s)for(var f=new n(s,r),h=f.length,c=-1;++ca)throw new RangeError("size is too large");return new n(e)},t.from=function(t,i,r){if("function"==typeof n.from&&(!e.Uint8Array||Uint8Array.from!==n.from))return n.from(t,i,r);if("number"==typeof t)throw new TypeError('"value" argument must not be a number');if("string"==typeof t)return new n(t,i);if("undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer){var s=i;if(1===arguments.length)return new n(t);"undefined"==typeof s&&(s=0);var a=r;if("undefined"==typeof a&&(a=t.byteLength-s),s>=t.byteLength)throw new RangeError("'offset' is out of bounds");if(a>t.byteLength-s)throw new RangeError("'length' is out of bounds");return new n(t.slice(s,s+a))}if(n.isBuffer(t)){var o=new n(t.length);return t.copy(o,0,0,t.length),o}if(t){if(Array.isArray(t)||"undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return new n(t);if("Buffer"===t.type&&Array.isArray(t.data))return new n(t.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")},t.allocUnsafeSlow=function(e){if("function"==typeof n.allocUnsafeSlow)return n.allocUnsafeSlow(e);if("number"!=typeof e)throw new TypeError("size must be a number");if(e>=a)throw new RangeError("size is too large");return new s(e)}}).call(t,i(16))},function(e,t,i){"use strict";(function(t){function r(e,i){a.call(this),e=e.toLowerCase(),"string"==typeof i&&(i=new t(i));var r="sha512"===e||"sha384"===e?128:64;this._alg=e,this._key=i,i.length>r?i=n(e).update(i).digest():i.length-1?r:A;o.WritableState=a;var M=i(25);M.inherits=i(1);var T,R={deprecate:i(232)};!function(){try{T=i(9)}catch(e){}finally{T||(T=i(3).EventEmitter)}}();var x=i(0).Buffer,C=i(49);M.inherits(o,T);var I;a.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(a.prototype,"buffer",{get:R.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.")})}catch(e){}}();var I;o.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},o.prototype.write=function(e,t,i){var r=this._writableState,s=!1;return"function"==typeof t&&(i=t,t=null),x.isBuffer(e)?t="buffer":t||(t=r.defaultEncoding),"function"!=typeof i&&(i=n),r.ended?f(this,i):h(this,r,e,i)&&(r.pendingcb++,s=l(this,r,e,t,i)),s},o.prototype.cork=function(){var e=this._writableState;e.corked++},o.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.finished||e.bufferProcessing||!e.bufferedRequest||g(this,e))},o.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+e);return this._writableState.defaultEncoding=e,this},o.prototype._write=function(e,t,i){i(new Error("not implemented"))},o.prototype._writev=null,o.prototype.end=function(e,t,i){var r=this._writableState;"function"==typeof e?(i=e,e=null,t=null):"function"==typeof t&&(i=t,t=null),null!==e&&void 0!==e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||k(this,r,i)}}).call(t,i(5),i(58).setImmediate)},function(e,t,i){function r(e){if(e&&!f(e))throw new Error("Unknown encoding: "+e)}function n(e){return e.toString(this.encoding)}function s(e){this.charReceived=e.length%2,this.charLength=this.charReceived?2:0}function a(e){this.charReceived=e.length%3,this.charLength=this.charReceived?3:0}var o=i(0).Buffer,f=o.isEncoding||function(e){switch(e&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}},h=t.StringDecoder=function(e){switch(this.encoding=(e||"utf8").toLowerCase().replace(/[-_]/,""),r(e),this.encoding){case"utf8":this.surrogateSize=3;break;case"ucs2":case"utf16le":this.surrogateSize=2,this.detectIncompleteChar=s;break;case"base64":this.surrogateSize=3,this.detectIncompleteChar=a;break;default:return void(this.write=n)}this.charBuffer=new o(6),this.charReceived=0,this.charLength=0};h.prototype.write=function(e){for(var t="";this.charLength;){var i=e.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:e.length;if(e.copy(this.charBuffer,this.charReceived,0,i),this.charReceived+=i,this.charReceived=55296&&r<=56319)){if(this.charReceived=this.charLength=0,0===e.length)return t;break}this.charLength+=this.surrogateSize,t=""}this.detectIncompleteChar(e);var n=e.length;this.charLength&&(e.copy(this.charBuffer,0,e.length-this.charReceived,n),n-=this.charReceived),t+=e.toString(this.encoding,0,n);var n=t.length-1,r=t.charCodeAt(n);if(r>=55296&&r<=56319){var s=this.surrogateSize;return this.charLength+=s,this.charReceived+=s,this.charBuffer.copy(this.charBuffer,s,0,s),e.copy(this.charBuffer,0,0,s),t.substring(0,n)}return t},h.prototype.detectIncompleteChar=function(e){for(var t=e.length>=3?3:e.length;t>0;t--){var i=e[e.length-t];if(1==t&&i>>5==6){this.charLength=2;break}if(t<=2&&i>>4==14){this.charLength=3;break}if(t<=3&&i>>3==30){this.charLength=4;break}}this.charReceived=t},h.prototype.end=function(e){var t="";if(e&&e.length&&(t=this.write(e)),this.charReceived){var i=this.charReceived,r=this.charBuffer,n=this.encoding;t+=r.slice(0,i).toString(n)}return t}},function(e,t,i){function r(){}function n(e){if(!w(e))return e;var t=[];for(var i in e)s(t,i,e[i]);return t.join("&")}function s(e,t,i){if(null!=i)if(Array.isArray(i))i.forEach(function(i){s(e,t,i)});else if(w(i))for(var r in i)s(e,t+"["+r+"]",i[r]);else e.push(encodeURIComponent(t)+"="+encodeURIComponent(i));else null===i&&e.push(encodeURIComponent(t))}function a(e){for(var t,i,r={},n=e.split("&"),s=0,a=n.length;s=300)&&(r=new Error(t.statusText||"Unsuccessful HTTP response"),r.original=e,r.response=t,r.status=t.status)}catch(e){r=e}r?i.callback(r,t):i.callback(null,t)})}function d(e,t){var i=g("DELETE",e);return t&&i.end(t),i}var p;"undefined"!=typeof window?p=window:"undefined"!=typeof self?p=self:(console.warn("Using browser-only version of superagent in non-browser environment"),p=this);var b=i(161),m=i(227),w=i(115),g=e.exports=i(228).bind(null,u);g.getXHR=function(){if(!(!p.XMLHttpRequest||p.location&&"file:"==p.location.protocol&&p.ActiveXObject))return new XMLHttpRequest;try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(e){}try{return new ActiveXObject("Msxml2.XMLHTTP.6.0")}catch(e){}try{return new ActiveXObject("Msxml2.XMLHTTP.3.0")}catch(e){}try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(e){}throw Error("Browser-only verison of superagent could not find XHR")};var v="".trim?function(e){return e.trim()}:function(e){return e.replace(/(^\s*|\s*$)/g,"")};g.serializeObject=n,g.parseString=a,g.types={html:"text/html",json:"application/json",xml:"application/xml",urlencoded:"application/x-www-form-urlencoded",form:"application/x-www-form-urlencoded","form-data":"application/x-www-form-urlencoded"},g.serialize={"application/x-www-form-urlencoded":n,"application/json":JSON.stringify},g.parse={"application/x-www-form-urlencoded":a,"application/json":JSON.parse},l.prototype.get=function(e){return this.header[e.toLowerCase()]},l.prototype._setHeaderProperties=function(e){var t=this.header["content-type"]||"";this.type=h(t);var i=c(t);for(var r in i)this[r]=i[r]},l.prototype._parseBody=function(e){var t=g.parse[this.type];return!t&&f(this.type)&&(t=g.parse["application/json"]),t&&e&&(e.length||e instanceof Object)?t(e):null},l.prototype._setStatusProperties=function(e){1223===e&&(e=204);var t=e/100|0;this.status=this.statusCode=e,this.statusType=t,this.info=1==t,this.ok=2==t,this.clientError=4==t,this.serverError=5==t,this.error=(4==t||5==t)&&this.toError(),this.accepted=202==e,this.noContent=204==e,this.badRequest=400==e,this.unauthorized=401==e,this.notAcceptable=406==e,this.notFound=404==e,this.forbidden=403==e},l.prototype.toError=function(){var e=this.req,t=e.method,i=e.url,r="cannot "+t+" "+i+" ("+this.status+")",n=new Error(r);return n.status=this.status,n.method=t,n.url=i,n},g.Response=l,b(u.prototype),m(u.prototype),u.prototype.type=function(e){return this.set("Content-Type",g.types[e]||e),this},u.prototype.responseType=function(e){return this._responseType=e,this},u.prototype.accept=function(e){return this.set("Accept",g.types[e]||e),this},u.prototype.auth=function(e,t,i){switch(i||(i={type:"basic"}),i.type){case"basic":var r=btoa(e+":"+t);this.set("Authorization","Basic "+r);break;case"auto":this.username=e,this.password=t}return this},u.prototype.query=function(e){return"string"!=typeof e&&(e=n(e)),e&&this._query.push(e),this},u.prototype.attach=function(e,t,i){if(this._data)throw Error("superagent can't mix .send() and .attach()");return this._getFormData().append(e,t,i||t.name),this},u.prototype._getFormData=function(){return this._formData||(this._formData=new p.FormData),this._formData},u.prototype.callback=function(e,t){var i=this._callback;this.clearTimeout(),e&&this.emit("error",e),i(e,t)},u.prototype.crossDomainError=function(){var e=new Error("Request has been terminated\nPossible causes: the network is offline, Origin is not allowed by Access-Control-Allow-Origin, the page is being unloaded, etc.");e.crossDomain=!0,e.status=this.status,e.method=this.method,e.url=this.url,this.callback(e)},u.prototype.buffer=u.prototype.ca=u.prototype.agent=function(){return console.warn("This is not supported in browser version of superagent"),this},u.prototype.pipe=u.prototype.write=function(){throw Error("Streaming is not supported in browser version of superagent")},u.prototype._timeoutError=function(){var e=this._timeout,t=new Error("timeout of "+e+"ms exceeded");t.timeout=e,this.callback(t)},u.prototype._appendQueryString=function(){var e=this._query.join("&");e&&(this.url+=~this.url.indexOf("?")?"&"+e:"?"+e)},u.prototype._isHost=function(e){return e&&"object"==typeof e&&!Array.isArray(e)&&"[object Object]"!==Object.prototype.toString.call(e)},u.prototype.end=function(e){var t=this,i=this.xhr=g.getXHR(),n=this._timeout,s=this._formData||this._data;this._callback=e||r,i.onreadystatechange=function(){if(4==i.readyState){var e;try{e=i.status}catch(t){e=0}if(0==e){if(t.timedout)return t._timeoutError();if(t._aborted)return;return t.crossDomainError()}t.emit("end")}};var a=function(e,i){i.total>0&&(i.percent=i.loaded/i.total*100),i.direction=e,t.emit("progress",i)};if(this.hasListeners("progress"))try{i.onprogress=a.bind(null,"download"),i.upload&&(i.upload.onprogress=a.bind(null,"upload"))}catch(e){}if(n&&!this._timer&&(this._timer=setTimeout(function(){t.timedout=!0,t.abort()},n)),this._appendQueryString(),this.username&&this.password?i.open(this.method,this.url,!0,this.username,this.password):i.open(this.method,this.url,!0),this._withCredentials&&(i.withCredentials=!0),"GET"!=this.method&&"HEAD"!=this.method&&"string"!=typeof s&&!this._isHost(s)){var o=this._header["content-type"],h=this._serializer||g.serialize[o?o.split(";")[0]:""];!h&&f(o)&&(h=g.serialize["application/json"]),h&&(s=h(s))}for(var c in this.header)null!=this.header[c]&&i.setRequestHeader(c,this.header[c]);return this._responseType&&(i.responseType=this._responseType),this.emit("request",this),i.send("undefined"!=typeof s?s:null),this},g.Request=u,g.get=function(e,t,i){var r=g("GET",e);return"function"==typeof t&&(i=t,t=null),t&&r.query(t),i&&r.end(i),r},g.head=function(e,t,i){var r=g("HEAD",e);return"function"==typeof t&&(i=t,t=null),t&&r.send(t),i&&r.end(i),r},g.options=function(e,t,i){var r=g("OPTIONS",e);return"function"==typeof t&&(i=t,t=null),t&&r.send(t),i&&r.end(i),r},g.del=d,g.delete=d,g.patch=function(e,t,i){var r=g("PATCH",e);return"function"==typeof t&&(i=t,t=null),t&&r.send(t),i&&r.end(i),r},g.post=function(e,t,i){var r=g("POST",e);return"function"==typeof t&&(i=t,t=null),t&&r.send(t),i&&r.end(i),r},g.put=function(e,t,i){var r=g("PUT",e);return"function"==typeof t&&(i=t,t=null),t&&r.send(t),i&&r.end(i),r}},function(e,t,i){(function(e,r){function n(e,t){this._id=e,this._clearFn=t}var s=i(5).nextTick,a=Function.prototype.apply,o=Array.prototype.slice,f={},h=0;t.setTimeout=function(){return new n(a.call(setTimeout,window,arguments),clearTimeout)},t.setInterval=function(){return new n(a.call(setInterval,window,arguments),clearInterval)},t.clearTimeout=t.clearInterval=function(e){e.close()},n.prototype.unref=n.prototype.ref=function(){},n.prototype.close=function(){this._clearFn.call(window,this._id)},t.enroll=function(e,t){clearTimeout(e._idleTimeoutId),e._idleTimeout=t},t.unenroll=function(e){clearTimeout(e._idleTimeoutId),e._idleTimeout=-1},t._unrefActive=t.active=function(e){clearTimeout(e._idleTimeoutId);var t=e._idleTimeout;t>=0&&(e._idleTimeoutId=setTimeout(function(){e._onTimeout&&e._onTimeout()},t))},t.setImmediate="function"==typeof e?e:function(e){var i=h++,r=!(arguments.length<2)&&o.call(arguments,1);return f[i]=!0,s(function(){f[i]&&(r?e.apply(null,r):e.call(null),t.clearImmediate(i))}),i},t.clearImmediate="function"==typeof r?r:function(e){delete f[e]}}).call(t,i(58).setImmediate,i(58).clearImmediate)},function(e,t,i){"use strict";function r(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}function n(e,t,i){if(e&&h.isObject(e)&&e instanceof r)return e;var n=new r;return n.parse(e,t,i),n}function s(e){return h.isString(e)&&(e=n(e)),e instanceof r?e.format():r.prototype.format.call(e)}function a(e,t){return n(e,!1,!0).resolve(t)}function o(e,t){return e?n(e,!1,!0).resolveObject(t):t}var f=i(218),h=i(239);t.parse=n,t.resolve=a,t.resolveObject=o,t.format=s,t.Url=r;var c=/^([a-z0-9.+-]+:)/i,l=/:[0-9]*$/,u=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,d=["<",">",'"',"`"," ","\r","\n","\t"],p=["{","}","|","\\","^","`"].concat(d),b=["'"].concat(p),m=["%","/","?",";","#"].concat(b),w=["/","?","#"],g=255,v=/^[+a-z0-9A-Z_-]{0,63}$/,_=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,y={javascript:!0,"javascript:":!0},k={javascript:!0,"javascript:":!0},E={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},A=i(221);r.prototype.parse=function(e,t,i){if(!h.isString(e))throw new TypeError("Parameter 'url' must be a string, not "+typeof e);var r=e.indexOf("?"),n=r!==-1&&r127?"x":N[L];if(!D.match(v)){var U=P.slice(0,T),j=P.slice(T+1),F=N.match(_);F&&(U.push(F[1]),j.unshift(F[2])),j.length&&(o="/"+j.join(".")+o),this.hostname=U.join(".");break}}}this.hostname.length>g?this.hostname="":this.hostname=this.hostname.toLowerCase(),I||(this.hostname=f.toASCII(this.hostname));var z=this.port?":"+this.port:"",q=this.hostname||"";this.host=q+z,this.href+=this.host,I&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==o[0]&&(o="/"+o))}if(!y[p])for(var T=0,O=b.length;T0)&&i.host.split("@");S&&(i.auth=S.shift(),i.host=i.hostname=S.shift())}return i.search=e.search,i.query=e.query,h.isNull(i.pathname)&&h.isNull(i.search)||(i.path=(i.pathname?i.pathname:"")+(i.search?i.search:"")),i.href=i.format(),i}if(!y.length)return i.pathname=null,i.search?i.path="/"+i.search:i.path=null,i.href=i.format(),i;for(var M=y.slice(-1)[0],T=(i.host||e.host||y.length>1)&&("."===M||".."===M)||""===M,R=0,x=y.length;x>=0;x--)M=y[x],"."===M?y.splice(x,1):".."===M?(y.splice(x,1),R++):R&&(y.splice(x,1),R--);if(!v&&!_)for(;R--;R)y.unshift("..");!v||""===y[0]||y[0]&&"/"===y[0].charAt(0)||y.unshift(""),T&&"/"!==y.join("/").substr(-1)&&y.push("");var C=""===y[0]||y[0]&&"/"===y[0].charAt(0);if(A){i.hostname=i.host=C?"":y.length?y.shift():"";var S=!!(i.host&&i.host.indexOf("@")>0)&&i.host.split("@");S&&(i.auth=S.shift(),i.host=i.hostname=S.shift())}return v=v||i.host&&y.length,v&&!C&&y.unshift(""),y.length?i.pathname=y.join("/"):(i.pathname=null,i.path=null),h.isNull(i.pathname)&&h.isNull(i.search)||(i.path=(i.pathname?i.pathname:"")+(i.search?i.search:"")),i.auth=e.auth||i.auth,i.slashes=i.slashes||e.slashes,i.href=i.format(),i},r.prototype.parseHost=function(){var e=this.host,t=l.exec(e);t&&(t=t[0],":"!==t&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)}},function(e,t){e.exports=function(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(const i in e){const r=e[i],n=t.indexOf(r);n&&t.splice(n,1)}return 0===t.length}},function(e,t){e.exports={name:"discord.js",version:"10.0.1",description:"A powerful library for interacting with the Discord API",main:"./src/index",scripts:{test:"eslint src && node docs/generator test",docs:"node docs/generator","test-docs":"node docs/generator test",lint:"eslint src","web-dist":"npm install && node ./node_modules/parallel-webpack/bin/run.js"},repository:{type:"git",url:"git+https://github.com/hydrabolt/discord.js.git"},keywords:["discord","api","bot","client","node","discordapp"],author:"Amish Shah ",license:"Apache-2.0",bugs:{url:"https://github.com/hydrabolt/discord.js/issues"},homepage:"https://github.com/hydrabolt/discord.js#readme",dependencies:{superagent:"^3.0.0",tweetnacl:"^0.14.3",ws:"^1.1.1"},peerDependencies:{"node-opus":"^0.2.0",opusscript:"^0.0.1"},devDependencies:{bufferutil:"^1.2.1",eslint:"^3.10.0","jsdoc-to-markdown":"^2.0.0","json-loader":"^0.5.4","parallel-webpack":"^1.5.0","uglify-js":"github:mishoo/UglifyJS2#harmony","utf-8-validate":"^1.2.1",webpack:"2.1.0-beta.27",zlibjs:"github:imaya/zlib.js"},engines:{node:">=6.0.0"}}},function(e,t,i){(function(t){const r=i(10),n=i(14),s=i(132),a=i(133);class o{constructor(e,i,s=[]){this.manager=e,this.id=i,this.env=Object.assign({},t.env,{SHARD_ID:this.id,SHARD_COUNT:this.manager.totalShards,CLIENT_TOKEN:this.manager.token}),this.process=r.fork(n.resolve(this.manager.file),s,{env:this.env}),this.process.on("message",this._handleMessage.bind(this)),this.process.once("exit",()=>{this.manager.respawn&&this.manager.createShard(this.id)}),this._evals=new Map,this._fetches=new Map}send(e){return new Promise((t,i)=>{const r=this.process.send(e,e=>{e?i(e):t(this)});if(!r)throw new Error("Failed to send message to shard's process.")})}fetchClientValue(e){if(this._fetches.has(e))return this._fetches.get(e);const t=new Promise((t,i)=>{const r=i=>{i&&i._fetchProp===e&&(this.process.removeListener("message",r),this._fetches.delete(e),t(i._result))};this.process.on("message",r),this.send({_fetchProp:e}).catch(t=>{this.process.removeListener("message",r),this._fetches.delete(e),i(t)})});return this._fetches.set(e,t),t}eval(e){if(this._evals.has(e))return this._evals.get(e);const t=new Promise((t,i)=>{const r=n=>{n&&n._eval===e&&(this.process.removeListener("message",r),this._evals.delete(e),n._error?i(s(n._error)):t(n._result))};this.process.on("message",r),this.send({_eval:e}).catch(t=>{this.process.removeListener("message",r),this._evals.delete(e),i(t)})});return this._evals.set(e,t),t}_handleMessage(e){if(e){if(e._sFetchProp)return void this.manager.fetchClientValues(e._sFetchProp).then(t=>this.send({_sFetchProp:e._sFetchProp,_result:t}),t=>this.send({_sFetchProp:e._sFetchProp,_error:a(t)}));if(e._sEval)return void this.manager.broadcastEval(e._sEval).then(t=>this.send({_sEval:e._sEval,_result:t}),t=>this.send({_sEval:e._sEval,_error:a(t)}))}this.manager.emit("message",this,e)}}e.exports=o}).call(t,i(5))},function(e,t,i){(function(t){const r=i(132),n=i(133);class s{constructor(e){this.client=e,t.on("message",this._handleMessage.bind(this))}get id(){return this.client.options.shardId}get count(){return this.client.options.shardCount}send(e){return new Promise((i,r)=>{const n=t.send(e,e=>{e?r(e):i()});if(!n)throw new Error("Failed to send message to master process.")})}fetchClientValues(e){return new Promise((i,n)=>{const s=a=>{a&&a._sFetchProp===e&&(t.removeListener("message",s),a._error?n(r(a._error)):i(a._result))};t.on("message",s),this.send({_sFetchProp:e}).catch(e=>{t.removeListener("message",s),n(e)})})}broadcastEval(e){return new Promise((i,n)=>{const s=a=>{a&&a._sEval===e&&(t.removeListener("message",s),a._error?n(r(a._error)):i(a._result))};t.on("message",s),this.send({_sEval:e}).catch(e=>{t.removeListener("message",s),n(e)})})}_handleMessage(e){if(e)if(e._fetchProp){const t=e._fetchProp.split(".");let i=this.client;for(const r of t)i=i[r];this._respond("fetchProp",{_fetchProp:e._fetchProp,_result:i})}else if(e._eval)try{this._respond("eval",{_eval:e._eval,_result:this.client._eval(e._eval)})}catch(t){this._respond("eval",{_eval:e._eval,_error:n(t)})}}_respond(e,t){this.send(t).catch(t=>this.client.emit("error",`Error when sending ${e} response to master process: ${t}`))}static singleton(e){return this._singleton?e.emit("error","Multiple clients created in child process; only the first will handle sharding helpers."):this._singleton=new this(e),this._singleton}}e.exports=s}).call(t,i(5))},function(e,t,i){const r=i(11),n=i(72);class s extends n{setup(e){super.setup(e),this.flags=e.flags,this.owner=new r(this.client,e.owner)}}e.exports=s},function(e,t,i){const r=i(20),n=i(28),s=i(6);class a extends r{constructor(e,t){super(e,t),this.type="dm",this.messages=new s,this._typing=new Map}setup(e){super.setup(e),this.recipient=this.client.dataManager.newUser(e.recipients[0]),this.lastMessageID=e.last_message_id}toString(){return this.recipient.toString()}sendMessage(){}sendTTSMessage(){}sendFile(){}sendCode(){}fetchMessage(){}fetchMessages(){}fetchPinnedMessages(){}startTyping(){}stopTyping(){}get typing(){}get typingCount(){}createCollector(){}awaitMessages(){}bulkDelete(){}_cacheMessage(){}}n.applyToClass(a,!0),e.exports=a},function(e,t,i){const r=i(20),n=i(28),s=i(6),a=i(60);class o extends r{constructor(e,t){super(e,t),this.type="group",this.messages=new s,this._typing=new Map}setup(e){if(super.setup(e),this.name=e.name,this.icon=e.icon,this.ownerID=e.owner_id,this.recipients||(this.recipients=new s),e.recipients)for(const t of e.recipients){const e=this.client.dataManager.newUser(t);this.recipients.set(e.id,e)}this.lastMessageID=e.last_message_id}get owner(){return this.client.users.get(this.ownerID)}equals(e){const t=e&&this.id===e.id&&this.name===e.name&&this.icon===e.icon&&this.ownerID===e.ownerID;if(t){const t=this.recipients.keyArray(),i=e.recipients.keyArray();return a(t,i)}return t}toString(){return this.name}sendMessage(){}sendTTSMessage(){}sendFile(){}sendCode(){}fetchMessage(){}fetchMessages(){}fetchPinnedMessages(){}startTyping(){}stopTyping(){}get typing(){}get typingCount(){}createCollector(){}awaitMessages(){}bulkDelete(){}_cacheMessage(){}}n.applyToClass(o,!0),e.exports=o},function(e,t,i){const r=i(73),n=i(74),s=i(2);class a{constructor(e,t){this.client=e,Object.defineProperty(this,"client",{enumerable:!1,configurable:!1}),this.setup(t)}setup(e){this.guild=this.client.guilds.get(e.guild.id)||new r(this.client,e.guild),this.code=e.code,this.temporary=e.temporary,this.maxAge=e.max_age,this.uses=e.uses,this.maxUses=e.max_uses,e.inviter&&(this.inviter=this.client.dataManager.newUser(e.inviter)),this.channel=this.client.channels.get(e.channel.id)||new n(this.client,e.channel),this.createdTimestamp=new Date(e.created_at).getTime()}get createdAt(){return new Date(this.createdTimestamp)}get expiresTimestamp(){return this.createdTimestamp+1e3*this.maxAge}get expiresAt(){return new Date(this.expiresTimestamp)}get url(){return s.Endpoints.inviteLink(this.code)}delete(){return this.client.rest.methods.deleteInvite(this)}toString(){return this.url}}e.exports=a},function(e,t){class i{constructor(e,t){this.client=e.client,Object.defineProperty(this,"client",{enumerable:!1,configurable:!1}),this.message=e,this.setup(t)}setup(e){this.id=e.id,this.filename=e.filename,this.filesize=e.size,this.url=e.url,this.proxyURL=e.proxy_url,this.height=e.height,this.width=e.width}}e.exports=i},function(e,t,i){const r=i(3).EventEmitter,n=i(6);class s extends r{constructor(e,t,i={}){super(),this.channel=e,this.filter=t,this.options=i,this.ended=!1,this.collected=new n,this.listener=(e=>this.verify(e)),this.channel.client.on("message",this.listener),i.time&&this.channel.client.setTimeout(()=>this.stop("time"),i.time)}verify(e){return(!this.channel||this.channel.id===e.channel.id)&&(!!this.filter(e,this)&&(this.collected.set(e.id,e),this.emit("message",e,this),this.collected.size>=this.options.maxMatches?this.stop("matchesLimit"):this.options.max&&this.collected.size===this.options.max&&this.stop("limit"),!0))}get next(){return new Promise((e,t)=>{if(this.ended)return void t(this.collected);const i=()=>{this.removeListener("message",r),this.removeListener("end",n)},r=(...t)=>{i(),e(...t)},n=(...e)=>{i(),t(...e)};this.once("message",r),this.once("end",n)})}stop(e="user"){this.ended||(this.ended=!0,this.channel.client.removeListener("message",this.listener),this.emit("end",this.collected,e))}}e.exports=s},function(e,t){class i{constructor(e,t){this.client=e.client,Object.defineProperty(this,"client",{enumerable:!1,configurable:!1}),this.message=e,this.setup(t)}setup(e){if(this.title=e.title,this.type=e.type,this.description=e.description,this.url=e.url,this.fields=[],e.fields)for(const t of e.fields)this.fields.push(new a(this,t));this.createdTimestamp=e.timestamp,this.thumbnail=e.thumbnail?new r(this,e.thumbnail):null,this.author=e.author?new s(this,e.author):null,this.provider=e.provider?new n(this,e.provider):null,this.footer=e.footer?new o(this,e.footer):null}get createdAt(){return new Date(this.createdTimestamp)}}class r{constructor(e,t){this.embed=e,this.setup(t)}setup(e){this.url=e.url,this.proxyURL=e.proxy_url,this.height=e.height,this.width=e.width}}class n{constructor(e,t){this.embed=e,this.setup(t)}setup(e){this.name=e.name,this.url=e.url}}class s{constructor(e,t){this.embed=e,this.setup(t)}setup(e){this.name=e.name,this.url=e.url}}class a{constructor(e,t){this.embed=e,this.setup(t)}setup(e){this.name=e.name,this.value=e.value,this.inline=e.inline}}class o{constructor(e,t){this.embed=e,this.setup(t)}setup(e){this.text=e.text,this.iconUrl=e.icon_url,this.proxyIconUrl=e.proxy_icon_url}}i.Thumbnail=r,i.Provider=n,i.Author=s,i.Field=a,i.Footer=o,e.exports=i},function(e,t,i){const r=i(6),n=i(21),s=i(45);class a{constructor(e,t,i,n){this.message=e,this.me=n,this.count=i||0,this.users=new r,this._emoji=new s(this,t.name,t.id)}get emoji(){if(this._emoji instanceof n)return this._emoji;if(this._emoji.id){const e=this.message.client.emojis;if(e.has(this._emoji.id)){const t=e.get(this._emoji.id);return this._emoji=t,t}}return this._emoji}remove(e=this.message.client.user){const t=this.message;return e=this.message.client.resolver.resolveUserID(e),e?t.client.rest.methods.removeMessageReaction(t,this.emoji.identifier,e):Promise.reject("Couldn't resolve the user ID to remove from the reaction.")}fetchUsers(e=100){const t=this.message;return t.client.rest.methods.getMessageReactionUsers(t,this.emoji.identifier,e).then(e=>{this.users=new r;for(const t of e){const e=this.message.client.dataManager.newUser(t);this.users.set(e.id,e)}return this.count=this.users.size,e})}}e.exports=a},function(e,t){class i{constructor(e,t){this.client=e,Object.defineProperty(this,"client",{enumerable:!1,configurable:!1}),this.setup(t)}setup(e){this.id=e.id,this.name=e.name,this.description=e.description,this.icon=e.icon,this.iconURL=`https://cdn.discordapp.com/app-icons/${this.id}/${this.icon}.jpg`,this.rpcOrigins=e.rpc_origins}get createdTimestamp(){return this.id/4194304+14200704e5}get createdAt(){return new Date(this.createdTimestamp)}toString(){return this.name}}e.exports=i},function(e,t){class i{constructor(e,t){this.client=e,Object.defineProperty(this,"client",{enumerable:!1,configurable:!1}),this.setup(t)}setup(e){this.id=e.id,this.name=e.name,this.icon=e.icon,this.splash=e.splash}}e.exports=i},function(e,t,i){const r=i(2);class n{constructor(e,t){this.client=e,Object.defineProperty(this,"client",{enumerable:!1,configurable:!1}),this.setup(t)}setup(e){this.id=e.id,this.name=e.name,this.type=r.ChannelTypes.text===e.type?"text":"voice"}}e.exports=n},function(e,t){class i{constructor(e,t){this.channel=e,t&&this.setup(t)}setup(e){this.id=e.id,this.type=e.type,this.denyData=e.deny,this.allowData=e.allow}delete(){return this.channel.client.rest.methods.deletePermissionOverwrites(this)}}e.exports=i},function(e,t,i){const r=i(29),n=i(28),s=i(6);class a extends r{constructor(e,t){super(e,t),this.type="text",this.messages=new s,this._typing=new Map}setup(e){super.setup(e),this.topic=e.topic,this.lastMessageID=e.last_message_id}get members(){const e=new s;for(const t of this.guild.members.values())this.permissionsFor(t).hasPermission("READ_MESSAGES")&&e.set(t.id,t);return e}fetchWebhooks(){return this.client.rest.methods.getChannelWebhooks(this)}createWebhook(e,t){return new Promise(i=>{t.startsWith("data:")?i(this.client.rest.methods.createWebhook(this,e,t)):this.client.resolver.resolveBuffer(t).then(t=>i(this.client.rest.methods.createWebhook(this,e,t)))})}sendMessage(){}sendTTSMessage(){}sendFile(){}sendCode(){}fetchMessage(){}fetchMessages(){}fetchPinnedMessages(){}startTyping(){}stopTyping(){}get typing(){}get typingCount(){}createCollector(){}awaitMessages(){}bulkDelete(){}_cacheMessage(){}}n.applyToClass(a,!0),e.exports=a},function(e,t,i){const r=i(29),n=i(6);class s extends r{constructor(e,t){super(e,t),this.members=new n,this.type="voice"}setup(e){super.setup(e),this.bitrate=e.bitrate,this.userLimit=e.user_limit}get connection(){const e=this.guild.voiceConnection;return e&&e.channel.id===this.id?e:null}get joinable(){return this.permissionsFor(this.client.user).hasPermission("CONNECT")}get speakable(){return this.permissionsFor(this.client.user).hasPermission("SPEAK")}setBitrate(e){return this.edit({bitrate:e})}setUserLimit(e){return this.edit({userLimit:e})}join(){return this.client.voice.joinChannel(this)}leave(){const e=this.client.voice.connections.get(this.guild.id);e&&e.channel.id===this.id&&e.disconnect()}}e.exports=s},function(e,t,i){const r=i(57),n=i(2).Endpoints.botGateway;e.exports=function(e){return new Promise((t,i)=>{if(!e)throw new Error("A token must be provided.");r.get(n).set("Authorization",`Bot ${e.replace(/^Bot\s*/i,"")}`).end((e,r)=>{e&&i(e),t(r.body.shards)})})}},function(e,t){e.exports=function(e,{maxLength=1950,char="\n",prepend="",append=""}={}){if(e.length<=maxLength)return e;const t=e.split(char);if(1===t.length)throw new Error("Message exceeds the max length and contains no split characters.");const i=[""];let r=0;for(let n=0;nmaxLength&&(i[r]+=append,i.push(prepend),r++),i[r]+=(i[r].length>0&&i[r]!==prepend?char:"")+t[n];return i}},function(e,t,i){function r(e,t){return a.call(this,t),o.isBuffer(e)?(this.base=e,this.offset=0,void(this.length=e.length)):void this.error("Input not Buffer")}function n(e,t){if(Array.isArray(e))this.length=0,this.value=e.map(function(e){return e instanceof n||(e=new n(e,t)),this.length+=e.length,e},this);else if("number"==typeof e){if(!(0<=e&&e<=255))return t.error("non-byte EncoderBuffer value");this.value=e,this.length=1}else if("string"==typeof e)this.value=e,this.length=o.byteLength(e);else{if(!o.isBuffer(e))return t.error("Unsupported type: "+typeof e);this.value=e,this.length=e.length}}var s=i(1),a=i(23).Reporter,o=i(0).Buffer;s(r,a),t.DecoderBuffer=r,r.prototype.save=function(){return{offset:this.offset,reporter:a.prototype.save.call(this)}},r.prototype.restore=function(e){var t=new r(this.base);return t.offset=e.offset,t.length=this.offset,this.offset=e.offset,a.prototype.restore.call(this,e.reporter),t},r.prototype.isEmpty=function(){return this.offset===this.length},r.prototype.readUInt8=function(e){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(e||"DecoderBuffer overrun")},r.prototype.skip=function(e,t){if(!(this.offset+e<=this.length))return this.error(t||"DecoderBuffer overrun");var i=new r(this.base);return i._reporterState=this._reporterState,i.offset=this.offset,i.length=this.offset+e,this.offset+=e,i},r.prototype.raw=function(e){return this.base.slice(e?e.offset:this.offset,this.length)},t.EncoderBuffer=n,n.prototype.join=function(e,t){return e||(e=new o(this.length)),t||(t=0),0===this.length?e:(Array.isArray(this.value)?this.value.forEach(function(i){i.join(e,t),t+=i.length}):("number"==typeof this.value?e[t]=this.value:"string"==typeof this.value?e.write(this.value,t):o.isBuffer(this.value)&&this.value.copy(e,t),t+=this.length),e)}},function(e,t,i){var r=t;r._reverse=function(e){var t={};return Object.keys(e).forEach(function(i){(0|i)==i&&(i|=0);var r=e[i];t[r]=i}),t},r.der=i(142)},function(e,t,i){function r(e){this.enc="der",this.name=e.name,this.entity=e,this.tree=new n,this.tree._init(e.body)}function n(e){h.Node.call(this,"der",e)}function s(e,t){var i=e.readUInt8(t);if(e.isError(i))return i;var r=l.tagClass[i>>6],n=0===(32&i);if(31===(31&i)){var s=i;for(i=0;128===(128&s);){if(s=e.readUInt8(t),e.isError(s))return s;i<<=7,i|=127&s}}else i&=31;var a=l.tag[i];return{cls:r,primitive:n,tag:i,tagStr:a}}function a(e,t,i){var r=e.readUInt8(i);if(e.isError(r))return r;if(!t&&128===r)return null;if(0===(128&r))return r;var n=127&r;if(n>=4)return e.error("length octect is too long");r=0;for(var s=0;s=31?r.error("Multi-octet tag encoding unsupported"):(t||(n|=32),n|=l.tagClassByName[i||"universal"]<<6)}var o=i(1),f=i(0).Buffer,h=i(32),c=h.base,l=h.constants.der;e.exports=r,r.prototype.encode=function(e,t){return this.tree._encode(e,t).join()},o(n,c.Node),n.prototype._encodeComposite=function(e,t,i,r){var n=a(e,t,i,this.reporter);if(r.length<128){var s=new f(2);return s[0]=n,s[1]=r.length,this._createEncoderBuffer([s,r])}for(var o=1,h=r.length;h>=256;h>>=8)o++;var s=new f(2+o);s[0]=n,s[1]=128|o;for(var h=1+o,c=r.length;c>0;h--,c>>=8)s[h]=255&c;return this._createEncoderBuffer([s,r])},n.prototype._encodeStr=function(e,t){if("bitstr"===t)return this._createEncoderBuffer([0|e.unused,e.data]);if("bmpstr"===t){for(var i=new f(2*e.length),r=0;r=40)return this.reporter.error("Second objid identifier OOB");e.splice(0,2,40*e[0]+e[1])}for(var n=0,r=0;r=128;s>>=7)n++}for(var a=new f(n),o=a.length-1,r=e.length-1;r>=0;r--){var s=e[r];for(a[o--]=127&s;(s>>=7)>0;)a[o--]=128|127&s}return this._createEncoderBuffer(a)},n.prototype._encodeTime=function(e,t){var i,r=new Date(e);return"gentime"===t?i=[s(r.getFullYear()),s(r.getUTCMonth()+1),s(r.getUTCDate()),s(r.getUTCHours()),s(r.getUTCMinutes()),s(r.getUTCSeconds()),"Z"].join(""):"utctime"===t?i=[s(r.getFullYear()%100),s(r.getUTCMonth()+1),s(r.getUTCDate()),s(r.getUTCHours()),s(r.getUTCMinutes()),s(r.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+t+" time is not supported yet"),this._encodeStr(i,"octstr")},n.prototype._encodeNull=function(){return this._createEncoderBuffer("")},n.prototype._encodeInt=function(e,t){if("string"==typeof e){if(!t)return this.reporter.error("String int or enum given, but no values map");if(!t.hasOwnProperty(e))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(e));e=t[e]}if("number"!=typeof e&&!f.isBuffer(e)){var i=e.toArray();!e.sign&&128&i[0]&&i.unshift(0),e=new f(i)}if(f.isBuffer(e)){var r=e.length;0===e.length&&r++;var n=new f(r);return e.copy(n),0===e.length&&(n[0]=0),this._createEncoderBuffer(n)}if(e<128)return this._createEncoderBuffer(e);if(e<256)return this._createEncoderBuffer([0,e]);for(var r=1,s=e;s>=256;s>>=8)r++;for(var n=new Array(r),s=n.length-1;s>=0;s--)n[s]=255&e,e>>=8;return 128&n[0]&&n.unshift(0),this._createEncoderBuffer(new f(n))},n.prototype._encodeBool=function(e){return this._createEncoderBuffer(e?255:0)},n.prototype._use=function(e,t){return"function"==typeof e&&(e=e(t)),e._getEncoder("der").tree},n.prototype._skipDefault=function(e,t,i){var r,n=this._baseState;if(null===n.default)return!1;var s=e.join();if(void 0===n.defaultBuffer&&(n.defaultBuffer=this._encodeValue(n.default,t,i).join()),s.length!==n.defaultBuffer.length)return!1;for(r=0;r>o%8,e._prev=r(e._prev,i?s:a);return h}function r(t,i){var r=t.length,n=-1,s=new e(t.length);for(t=e.concat([t,new e([i])]);++n>7;return s}t.encrypt=function(t,r,n){for(var s=r.length,a=new e(s),o=-1;++ot.Z_MAX_CHUNK))throw new Error("Invalid chunk size: "+i.chunkSize);if(i.windowBits&&(i.windowBitst.Z_MAX_WINDOWBITS))throw new Error("Invalid windowBits: "+i.windowBits);if(i.level&&(i.levelt.Z_MAX_LEVEL))throw new Error("Invalid compression level: "+i.level);if(i.memLevel&&(i.memLevelt.Z_MAX_MEMLEVEL))throw new Error("Invalid memLevel: "+i.memLevel);if(i.strategy&&i.strategy!=t.Z_FILTERED&&i.strategy!=t.Z_HUFFMAN_ONLY&&i.strategy!=t.Z_RLE&&i.strategy!=t.Z_FIXED&&i.strategy!=t.Z_DEFAULT_STRATEGY)throw new Error("Invalid strategy: "+i.strategy);if(i.dictionary&&!e.isBuffer(i.dictionary))throw new Error("Invalid dictionary: it should be a Buffer instance");this._binding=new b.Zlib(r);var n=this;this._hadError=!1,this._binding.onerror=function(e,i){n._binding=null,n._hadError=!0;var r=new Error(e);r.errno=i,r.code=t.codes[i],n.emit("error",r)};var s=t.Z_DEFAULT_COMPRESSION;"number"==typeof i.level&&(s=i.level);var a=t.Z_DEFAULT_STRATEGY;"number"==typeof i.strategy&&(a=i.strategy),this._binding.init(i.windowBits||t.Z_DEFAULT_WINDOWBITS,s,i.memLevel||t.Z_DEFAULT_MEMLEVEL,a,i.dictionary),this._buffer=new e(this._chunkSize),this._offset=0,this._closed=!1,this._level=s,this._strategy=a,this.once("end",this.close)}var p=i(114),b=i(158),m=i(8),w=i(147).ok;b.Z_MIN_WINDOWBITS=8,b.Z_MAX_WINDOWBITS=15,b.Z_DEFAULT_WINDOWBITS=15,b.Z_MIN_CHUNK=64,b.Z_MAX_CHUNK=1/0,b.Z_DEFAULT_CHUNK=16384,b.Z_MIN_MEMLEVEL=1,b.Z_MAX_MEMLEVEL=9,b.Z_DEFAULT_MEMLEVEL=8,b.Z_MIN_LEVEL=-1,b.Z_MAX_LEVEL=9,b.Z_DEFAULT_LEVEL=b.Z_DEFAULT_COMPRESSION,Object.keys(b).forEach(function(e){e.match(/^Z/)&&(t[e]=b[e])}),t.codes={Z_OK:b.Z_OK,Z_STREAM_END:b.Z_STREAM_END,Z_NEED_DICT:b.Z_NEED_DICT,Z_ERRNO:b.Z_ERRNO,Z_STREAM_ERROR:b.Z_STREAM_ERROR,Z_DATA_ERROR:b.Z_DATA_ERROR,Z_MEM_ERROR:b.Z_MEM_ERROR,Z_BUF_ERROR:b.Z_BUF_ERROR,Z_VERSION_ERROR:b.Z_VERSION_ERROR},Object.keys(t.codes).forEach(function(e){t.codes[t.codes[e]]=e}),t.Deflate=a,t.Inflate=o,t.Gzip=f,t.Gunzip=h,t.DeflateRaw=c,t.InflateRaw=l,t.Unzip=u,t.createDeflate=function(e){return new a(e)},t.createInflate=function(e){return new o(e)},t.createDeflateRaw=function(e){return new c(e)},t.createInflateRaw=function(e){return new l(e)},t.createGzip=function(e){return new f(e)},t.createGunzip=function(e){return new h(e)},t.createUnzip=function(e){return new u(e)},t.deflate=function(e,t,i){return"function"==typeof t&&(i=t,t={}),n(new a(t),e,i)},t.deflateSync=function(e,t){return s(new a(t),e)},t.gzip=function(e,t,i){return"function"==typeof t&&(i=t,t={}),n(new f(t),e,i)},t.gzipSync=function(e,t){return s(new f(t),e)},t.deflateRaw=function(e,t,i){return"function"==typeof t&&(i=t,t={}),n(new c(t),e,i)},t.deflateRawSync=function(e,t){return s(new c(t),e)},t.unzip=function(e,t,i){return"function"==typeof t&&(i=t,t={}),n(new u(t),e,i)},t.unzipSync=function(e,t){return s(new u(t),e)},t.inflate=function(e,t,i){return"function"==typeof t&&(i=t,t={}),n(new o(t),e,i)},t.inflateSync=function(e,t){return s(new o(t),e)},t.gunzip=function(e,t,i){return"function"==typeof t&&(i=t,t={}),n(new h(t),e,i)},t.gunzipSync=function(e,t){return s(new h(t),e)},t.inflateRaw=function(e,t,i){return"function"==typeof t&&(i=t,t={}),n(new l(t),e,i)},t.inflateRawSync=function(e,t){return s(new l(t),e)},m.inherits(d,p),d.prototype.params=function(e,i,n){if(et.Z_MAX_LEVEL)throw new RangeError("Invalid compression level: "+e);if(i!=t.Z_FILTERED&&i!=t.Z_HUFFMAN_ONLY&&i!=t.Z_RLE&&i!=t.Z_FIXED&&i!=t.Z_DEFAULT_STRATEGY)throw new TypeError("Invalid strategy: "+i);if(this._level!==e||this._strategy!==i){var s=this;this.flush(b.Z_SYNC_FLUSH,function(){s._binding.params(e,i),s._hadError||(s._level=e,s._strategy=i,n&&n())})}else r.nextTick(n)},d.prototype.reset=function(){return this._binding.reset()},d.prototype._flush=function(t){this._transform(new e(0),"",t)},d.prototype.flush=function(t,i){var n=this._writableState;if(("function"==typeof t||void 0===t&&!i)&&(i=t,t=b.Z_FULL_FLUSH),n.ended)i&&r.nextTick(i);else if(n.ending)i&&this.once("end",i);else if(n.needDrain){var s=this;this.once("drain",function(){s.flush(i)})}else this._flushFlag=t,this.write(new e(0),"",i)},d.prototype.close=function(e){if(e&&r.nextTick(e),!this._closed){this._closed=!0,this._binding.close();var t=this;r.nextTick(function(){t.emit("close")})}},d.prototype._transform=function(t,i,r){var n,s=this._writableState,a=s.ending||s.ended,o=a&&(!t||s.length===t.length);if(null===!t&&!e.isBuffer(t))return r(new Error("invalid input"));o?n=b.Z_FINISH:(n=this._flushFlag,t.length>=s.length&&(this._flushFlag=this._opts.flush||b.Z_NO_FLUSH));this._processChunk(t,n,r)},d.prototype._processChunk=function(t,i,r){function n(c,d){if(!f._hadError){var p=a-d;if(w(p>=0,"have should not go down"),p>0){var b=f._buffer.slice(f._offset,f._offset+p);f._offset+=p,h?f.push(b):(l.push(b),u+=b.length)}if((0===d||f._offset>=f._chunkSize)&&(a=f._chunkSize,f._offset=0,f._buffer=new e(f._chunkSize)),0===d){if(o+=s-c,s=c,!h)return!0;var m=f._binding.write(i,t,o,s,f._buffer,f._offset,f._chunkSize);return m.callback=n,void(m.buffer=t)}return!!h&&void r()}}var s=t&&t.length,a=this._chunkSize-this._offset,o=0,f=this,h="function"==typeof r;if(!h){var c,l=[],u=0;this.on("error",function(e){c=e});do var d=this._binding.writeSync(i,t,o,s,this._buffer,this._offset,a);while(!this._hadError&&n(d[0],d[1]));if(this._hadError)throw c;var p=e.concat(l,u);return this.close(),p}var b=this._binding.write(i,t,o,s,this._buffer,this._offset,a);b.buffer=t,b.callback=n},m.inherits(a,d),m.inherits(o,d),m.inherits(f,d),m.inherits(h,d),m.inherits(c,d),m.inherits(l,d),m.inherits(u,d)}).call(t,i(0).Buffer,i(5))},function(e,t,i){"use strict";function r(e,t){e[t>>5]|=128<>>9<<4)+14]=t;for(var i=1732584193,r=-271733879,n=-1732584194,c=271733878,l=0;l>16)+(t>>16)+(i>>16);return r<<16|65535&i}function c(e,t){return e<>>32-t}var l=i(163);e.exports=function(e){return l.hash(e,r,16)}},function(e,t,i){(function(t){function r(){this.init(),this._w=d,l.call(this,64,56)}function n(e,t,i){return i^e&(t^i)}function s(e,t,i){return e&t|i&(e|t)}function a(e){return(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10)}function o(e){return(e>>>6|e<<26)^(e>>>11|e<<21)^(e>>>25|e<<7)}function f(e){return(e>>>7|e<<25)^(e>>>18|e<<14)^e>>>3}function h(e){return(e>>>17|e<<15)^(e>>>19|e<<13)^e>>>10}var c=i(1),l=i(19),u=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],d=new Array(64);c(r,l),r.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this},r.prototype._update=function(e){for(var t=this._w,i=0|this._a,r=0|this._b,c=0|this._c,l=0|this._d,d=0|this._e,p=0|this._f,b=0|this._g,m=0|this._h,w=0;w<16;++w)t[w]=e.readInt32BE(4*w);for(;w<64;++w)t[w]=h(t[w-2])+t[w-7]+f(t[w-15])+t[w-16]|0;for(var g=0;g<64;++g){var v=m+o(d)+n(d,p,b)+u[g]+t[g]|0,_=a(i)+s(i,r,c)|0;m=b,b=p,p=d,d=l+v|0,l=c,c=r,r=i,i=v+_|0}this._a=i+this._a|0,this._b=r+this._b|0,this._c=c+this._c|0,this._d=l+this._d|0,this._e=d+this._e|0,this._f=p+this._f|0,this._g=b+this._g|0,this._h=m+this._h|0},r.prototype._hash=function(){var e=new t(32);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e.writeInt32BE(this._h,28),e},e.exports=r}).call(t,i(0).Buffer)},function(e,t,i){(function(t){function r(){this.init(),this._w=m,p.call(this,128,112)}function n(e,t,i){return i^e&(t^i)}function s(e,t,i){return e&t|i&(e|t)}function a(e,t){return(e>>>28|t<<4)^(t>>>2|e<<30)^(t>>>7|e<<25)}function o(e,t){return(e>>>14|t<<18)^(e>>>18|t<<14)^(t>>>9|e<<23)}function f(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^e>>>7}function h(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^(e>>>7|t<<25)}function c(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^e>>>6}function l(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^(e>>>6|t<<26)}function u(e,t){return e>>>0>>0?1:0}var d=i(1),p=i(19),b=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],m=new Array(160);d(r,p),r.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this},r.prototype._update=function(e){for(var t=this._w,i=0|this._ah,r=0|this._bh,d=0|this._ch,p=0|this._dh,m=0|this._eh,w=0|this._fh,g=0|this._gh,v=0|this._hh,_=0|this._al,y=0|this._bl,k=0|this._cl,E=0|this._dl,A=0|this._el,S=0|this._fl,M=0|this._gl,T=0|this._hl,R=0;R<32;R+=2)t[R]=e.readInt32BE(4*R),t[R+1]=e.readInt32BE(4*R+4);for(;R<160;R+=2){var x=t[R-30],C=t[R-30+1],I=f(x,C),P=h(C,x);x=t[R-4],C=t[R-4+1];var O=c(x,C),N=l(C,x),D=t[R-14],L=t[R-14+1],B=t[R-32],U=t[R-32+1],j=P+L|0,F=I+D+u(j,P)|0;j=j+N|0,F=F+O+u(j,N)|0,j=j+U|0,F=F+B+u(j,U)|0,t[R]=F,t[R+1]=j}for(var z=0;z<160;z+=2){F=t[z],j=t[z+1];var q=s(i,r,d),H=s(_,y,k),G=a(i,_),V=a(_,i),W=o(m,A),K=o(A,m),Z=b[z],Y=b[z+1],$=n(m,w,g),X=n(A,S,M),J=T+K|0,Q=v+W+u(J,T)|0;J=J+X|0,Q=Q+$+u(J,X)|0,J=J+Y|0,Q=Q+Z+u(J,Y)|0,J=J+j|0,Q=Q+F+u(J,j)|0;var ee=V+H|0,te=G+q+u(ee,V)|0;v=g,T=M,g=w,M=S,w=m,S=A,A=E+J|0,m=p+Q+u(A,E)|0,p=d,E=k,d=r,k=y,r=i,y=_,_=J+ee|0,i=Q+te+u(_,J)|0}this._al=this._al+_|0,this._bl=this._bl+y|0,this._cl=this._cl+k|0,this._dl=this._dl+E|0,this._el=this._el+A|0,this._fl=this._fl+S|0,this._gl=this._gl+M|0,this._hl=this._hl+T|0,this._ah=this._ah+i+u(this._al,_)|0,this._bh=this._bh+r+u(this._bl,y)|0,this._ch=this._ch+d+u(this._cl,k)|0,this._dh=this._dh+p+u(this._dl,E)|0,this._eh=this._eh+m+u(this._el,A)|0,this._fh=this._fh+w+u(this._fl,S)|0,this._gh=this._gh+g+u(this._gl,M)|0,this._hh=this._hh+v+u(this._hl,T)|0},r.prototype._hash=function(){function e(e,t,r){i.writeInt32BE(e,r),i.writeInt32BE(t,r+4)}var i=new t(64);return e(this._ah,this._al,0),e(this._bh,this._bl,8),e(this._ch,this._cl,16),e(this._dh,this._dl,24),e(this._eh,this._el,32),e(this._fh,this._fl,40),e(this._gh,this._gl,48),e(this._hh,this._hl,56),i},e.exports=r}).call(t,i(0).Buffer)},function(e,t,i){function r(){if(null!==v)return v;var e=1048576,t=[];t[0]=2;for(var i=1,r=3;re;)i.ishrn(1);if(i.isEven()&&i.iadd(u),i.testn(1)||i.iadd(d),t.cmp(d)){if(!t.cmp(p))for(;i.mod(b).cmp(m);)i.iadd(g)}else for(;i.mod(h).cmp(w);)i.iadd(g);if(r=i.shrn(1),n(r)&&n(i)&&s(r)&&s(i)&&l.test(r)&&l.test(i))return i}}var o=i(27);e.exports=a,a.simpleSieve=n,a.fermatTest=s;var f=i(4),h=new f(24),c=i(103),l=new c,u=new f(1),d=new f(2),p=new f(5),b=(new f(16),new f(8),new f(10)),m=new f(3),w=(new f(7),new f(11)),g=new f(4),v=(new f(12),null)},function(e,t){var i={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==i.call(e)}},function(e,t,i){function r(e){this.rand=e||new s.Rand}var n=i(4),s=i(86);e.exports=r,r.create=function(e){return new r(e)},r.prototype._rand=function(e){var t=e.bitLength(),i=this.rand.generate(Math.ceil(t/8));i[0]|=3;var r=7&t;return 0!==r&&(i[i.length-1]>>=7-r),new n(i)},r.prototype.test=function(e,t,i){var r=e.bitLength(),s=n.mont(e),a=new n(1).toRed(s);t||(t=Math.max(1,r/48|0));for(var o=e.subn(1),f=o.subn(1),h=0;!o.testn(h);h++);for(var c=e.shrn(h),l=o.toRed(s),u=!0;t>0;t--){var d=this._rand(f);i&&i(d);var p=d.toRed(s).redPow(c);if(0!==p.cmp(a)&&0!==p.cmp(l)){for(var b=1;b0;t--){var l=this._rand(o),u=e.gcd(l);if(0!==u.cmpn(1))return u;var d=l.toRed(r).redPow(h);if(0!==d.cmp(s)&&0!==d.cmp(c)){for(var p=1;p0)throw r.length>1?new Error("options "+r.slice(0,r.length-1).join(", ")+" and "+r[r.length-1]+" must be defined"):new Error("option "+r[0]+" must be defined")}return Object.keys(e).forEach(function(i){i in t&&(t[i]=e[i])}),this},this.copy=function(t){var r={};return Object.keys(e).forEach(function(e){t.indexOf(e)!==-1&&(r[e]=i[e])}),r},this.read=function(e,t){if("function"==typeof t){var i=this;n.readFile(e,function(e,r){if(e)return t(e);var n=JSON.parse(r);i.merge(n),t()})}else{var r=JSON.parse(n.readFileSync(e));this.merge(r)}return this},this.isDefined=function(e){return"undefined"!=typeof i[e]},this.isDefinedAndNonNull=function(e){return"undefined"!=typeof i[e]&&null!==i[e]},Object.freeze(i),Object.freeze(this)}/*! + * Copyright(c) 2011 Einar Otto Stangvik + * MIT Licensed + */ +var n=i(10);e.exports=r},function(e,t){"use strict";function i(e,t,i,r){for(var n=65535&e|0,s=e>>>16&65535|0,a=0;0!==i;){a=i>2e3?2e3:i,i-=a;do n=n+t[r++]|0,s=s+n|0;while(--a);n%=65521,s%=65521}return n|s<<16|0}e.exports=i},function(e,t){"use strict";function i(){for(var e,t=[],i=0;i<256;i++){e=i;for(var r=0;r<8;r++)e=1&e?3988292384^e>>>1:e>>>1;t[i]=e}return t}function r(e,t,i,r){var s=n,a=r+i;e^=-1;for(var o=r;o>>8^s[255&(e^t[o])];return e^-1}var n=i();e.exports=r},function(e,t){"use strict";e.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},function(e,t,i){(function(e,r){var n=i(50),s=i(214);t.pbkdf2=function(e,i,r,n,a,o){if("function"==typeof a&&(o=a,a=void 0),s(r,n),"function"!=typeof o)throw new Error("No callback provided to pbkdf2");setTimeout(function(){o(null,t.pbkdf2Sync(e,i,r,n,a))})};var a;if(e.browser)a="utf-8";else{var o=parseInt(e.version.split(".")[0].slice(1),10);a=o>=6?"utf-8":"binary"}t.pbkdf2Sync=function(e,t,i,o,f){r.isBuffer(e)||(e=new r(e,a)),r.isBuffer(t)||(t=new r(t,a)),s(i,o),f=f||"sha1";var h,c=1,l=new r(o),u=new r(t.length+4);t.copy(u,0,0,t.length);for(var d,p,b=1;b<=c;b++){u.writeUInt32BE(b,t.length);var m=n(f,e).update(u).digest();h||(h=m.length,p=new r(h),c=Math.ceil(o/h),d=o-(c-1)*h),m.copy(p,0,0,h);for(var w=1;w0)if(t.ended&&!n){var a=new Error("stream.push() after EOF");e.emit("error",a)}else if(t.endEmitted&&n){var f=new Error("stream.unshift() after end event");e.emit("error",f)}else{var h;!t.decoder||n||r||(i=t.decoder.write(i),h=!t.objectMode&&0===i.length),n||(t.reading=!1),h||(t.flowing&&0===t.length&&!t.sync?(e.emit("data",i),e.read(0)):(t.length+=t.objectMode?1:i.length,n?t.buffer.unshift(i):t.buffer.push(i),t.needReadable&&u(e))),p(e,t)}else n||(t.reading=!1);return o(t)}function o(e){return!e.ended&&(e.needReadable||e.length=z?e=z:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function h(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!==e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=f(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function c(e,t){var i=null;return O.isBuffer(t)||"string"==typeof t||null===t||void 0===t||e.objectMode||(i=new TypeError("Invalid non-string/buffer chunk")),i}function l(e,t){if(!t.ended){if(t.decoder){var i=t.decoder.end();i&&i.length&&(t.buffer.push(i),t.length+=t.objectMode?1:i.length)}t.ended=!0,u(e)}}function u(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(B("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?x(d,e):d(e))}function d(e){B("emit readable"),e.emit("readable"),_(e)}function p(e,t){t.readingMore||(t.readingMore=!0,x(b,e,t))}function b(e,t){for(var i=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(i=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):i=k(e,t.buffer,t.decoder),i}function k(e,t,i){var r;return es.length?s.length:e;if(n+=a===s.length?s:s.slice(0,e),e-=a,0===e){a===s.length?(++r,i.next?t.head=i.next:t.head=t.tail=null):(t.head=i,i.data=s.slice(a));break}++r}return t.length-=r,n}function A(e,t){var i=N.allocUnsafe(e),r=t.head,n=1;for(r.data.copy(i),e-=r.data.length;r=r.next;){var s=r.data,a=e>s.length?s.length:e;if(s.copy(i,i.length-e,0,a),e-=a,0===e){a===s.length?(++n,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=s.slice(a));break}++n}return t.length-=n,i}function S(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,x(M,t,e))}function M(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function T(e,t){for(var i=0,r=e.length;i=t.highWaterMark||t.ended))return B("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?S(this):u(this),null;if(e=h(e,t),0===e&&t.ended)return 0===t.length&&S(this),null;var r=t.needReadable;B("need readable",r),(0===t.length||t.length-e0?y(e,t):null,null===n?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),i!==e&&t.ended&&S(this)),null!==n&&this.emit("data",n),n},s.prototype._read=function(e){this.emit("error",new Error("not implemented"))},s.prototype.pipe=function(e,i){function n(e){B("onunpipe"),e===u&&a()}function s(){B("onend"),e.end()}function a(){B("cleanup"),e.removeListener("close",h),e.removeListener("finish",c),e.removeListener("drain",w),e.removeListener("error",f),e.removeListener("unpipe",n),u.removeListener("end",s),u.removeListener("end",a),u.removeListener("data",o),g=!0,!d.awaitDrain||e._writableState&&!e._writableState.needDrain||w()}function o(t){B("ondata"),v=!1;var i=e.write(t);!1!==i||v||((1===d.pipesCount&&d.pipes===e||d.pipesCount>1&&R(d.pipes,e)!==-1)&&!g&&(B("false write response, pause",u._readableState.awaitDrain),u._readableState.awaitDrain++,v=!0),u.pause())}function f(t){B("onerror",t),l(),e.removeListener("error",f),0===P(e,"error")&&e.emit("error",t)}function h(){e.removeListener("finish",c),l()}function c(){B("onfinish"),e.removeListener("close",h),l()}function l(){B("unpipe"),u.unpipe(e)}var u=this,d=this._readableState;switch(d.pipesCount){case 0:d.pipes=e;break;case 1:d.pipes=[d.pipes,e];break;default:d.pipes.push(e)}d.pipesCount+=1,B("pipe count=%d opts=%j",d.pipesCount,i);var p=(!i||i.end!==!1)&&e!==t.stdout&&e!==t.stderr,b=p?s:a;d.endEmitted?x(b):u.once("end",b),e.on("unpipe",n);var w=m(u);e.on("drain",w);var g=!1,v=!1;return u.on("data",o),r(e,"error",f),e.once("close",h),e.once("finish",c),e.emit("pipe",u),d.flowing||(B("pipe resume"),u.resume()),e},s.prototype.unpipe=function(e){var t=this._readableState;if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this),this);if(!e){var i=t.pipes,r=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var n=0;n>24&255,e[t+1]=i>>16&255,e[t+2]=i>>8&255,e[t+3]=255&i,e[t+4]=r>>24&255,e[t+5]=r>>16&255,e[t+6]=r>>8&255,e[t+7]=255&r}function r(e,t,i,r,n){var s,a=0;for(s=0;s>>8)-1}function n(e,t,i,n){return r(e,t,i,n,16)}function s(e,t,i,n){return r(e,t,i,n,32)}function a(e,t,i,r){for(var n,s=255&r[0]|(255&r[1])<<8|(255&r[2])<<16|(255&r[3])<<24,a=255&i[0]|(255&i[1])<<8|(255&i[2])<<16|(255&i[3])<<24,o=255&i[4]|(255&i[5])<<8|(255&i[6])<<16|(255&i[7])<<24,f=255&i[8]|(255&i[9])<<8|(255&i[10])<<16|(255&i[11])<<24,h=255&i[12]|(255&i[13])<<8|(255&i[14])<<16|(255&i[15])<<24,c=255&r[4]|(255&r[5])<<8|(255&r[6])<<16|(255&r[7])<<24,l=255&t[0]|(255&t[1])<<8|(255&t[2])<<16|(255&t[3])<<24,u=255&t[4]|(255&t[5])<<8|(255&t[6])<<16|(255&t[7])<<24,d=255&t[8]|(255&t[9])<<8|(255&t[10])<<16|(255&t[11])<<24,p=255&t[12]|(255&t[13])<<8|(255&t[14])<<16|(255&t[15])<<24,b=255&r[8]|(255&r[9])<<8|(255&r[10])<<16|(255&r[11])<<24,m=255&i[16]|(255&i[17])<<8|(255&i[18])<<16|(255&i[19])<<24,w=255&i[20]|(255&i[21])<<8|(255&i[22])<<16|(255&i[23])<<24,g=255&i[24]|(255&i[25])<<8|(255&i[26])<<16|(255&i[27])<<24,v=255&i[28]|(255&i[29])<<8|(255&i[30])<<16|(255&i[31])<<24,_=255&r[12]|(255&r[13])<<8|(255&r[14])<<16|(255&r[15])<<24,y=s,k=a,E=o,A=f,S=h,M=c,T=l,R=u,x=d,C=p,I=b,P=m,O=w,N=g,D=v,L=_,B=0;B<20;B+=2)n=y+O|0,S^=n<<7|n>>>25,n=S+y|0,x^=n<<9|n>>>23,n=x+S|0,O^=n<<13|n>>>19,n=O+x|0,y^=n<<18|n>>>14,n=M+k|0,C^=n<<7|n>>>25,n=C+M|0,N^=n<<9|n>>>23,n=N+C|0,k^=n<<13|n>>>19,n=k+N|0,M^=n<<18|n>>>14,n=I+T|0,D^=n<<7|n>>>25,n=D+I|0,E^=n<<9|n>>>23,n=E+D|0,T^=n<<13|n>>>19,n=T+E|0,I^=n<<18|n>>>14,n=L+P|0,A^=n<<7|n>>>25,n=A+L|0,R^=n<<9|n>>>23,n=R+A|0,P^=n<<13|n>>>19,n=P+R|0,L^=n<<18|n>>>14,n=y+A|0,k^=n<<7|n>>>25,n=k+y|0,E^=n<<9|n>>>23,n=E+k|0,A^=n<<13|n>>>19,n=A+E|0,y^=n<<18|n>>>14,n=M+S|0,T^=n<<7|n>>>25,n=T+M|0,R^=n<<9|n>>>23,n=R+T|0,S^=n<<13|n>>>19,n=S+R|0,M^=n<<18|n>>>14,n=I+C|0,P^=n<<7|n>>>25,n=P+I|0,x^=n<<9|n>>>23,n=x+P|0,C^=n<<13|n>>>19,n=C+x|0,I^=n<<18|n>>>14,n=L+D|0,O^=n<<7|n>>>25,n=O+L|0,N^=n<<9|n>>>23,n=N+O|0,D^=n<<13|n>>>19,n=D+N|0,L^=n<<18|n>>>14;y=y+s|0,k=k+a|0,E=E+o|0,A=A+f|0,S=S+h|0,M=M+c|0,T=T+l|0,R=R+u|0,x=x+d|0,C=C+p|0,I=I+b|0,P=P+m|0,O=O+w|0,N=N+g|0,D=D+v|0,L=L+_|0,e[0]=y>>>0&255,e[1]=y>>>8&255,e[2]=y>>>16&255,e[3]=y>>>24&255,e[4]=k>>>0&255,e[5]=k>>>8&255,e[6]=k>>>16&255,e[7]=k>>>24&255,e[8]=E>>>0&255,e[9]=E>>>8&255,e[10]=E>>>16&255,e[11]=E>>>24&255,e[12]=A>>>0&255,e[13]=A>>>8&255,e[14]=A>>>16&255,e[15]=A>>>24&255,e[16]=S>>>0&255,e[17]=S>>>8&255,e[18]=S>>>16&255,e[19]=S>>>24&255,e[20]=M>>>0&255,e[21]=M>>>8&255,e[22]=M>>>16&255,e[23]=M>>>24&255,e[24]=T>>>0&255,e[25]=T>>>8&255,e[26]=T>>>16&255,e[27]=T>>>24&255,e[28]=R>>>0&255,e[29]=R>>>8&255,e[30]=R>>>16&255,e[31]=R>>>24&255,e[32]=x>>>0&255,e[33]=x>>>8&255,e[34]=x>>>16&255,e[35]=x>>>24&255,e[36]=C>>>0&255,e[37]=C>>>8&255,e[38]=C>>>16&255,e[39]=C>>>24&255,e[40]=I>>>0&255,e[41]=I>>>8&255,e[42]=I>>>16&255,e[43]=I>>>24&255,e[44]=P>>>0&255,e[45]=P>>>8&255,e[46]=P>>>16&255,e[47]=P>>>24&255,e[48]=O>>>0&255,e[49]=O>>>8&255,e[50]=O>>>16&255,e[51]=O>>>24&255,e[52]=N>>>0&255,e[53]=N>>>8&255,e[54]=N>>>16&255,e[55]=N>>>24&255,e[56]=D>>>0&255,e[57]=D>>>8&255,e[58]=D>>>16&255,e[59]=D>>>24&255,e[60]=L>>>0&255,e[61]=L>>>8&255,e[62]=L>>>16&255,e[63]=L>>>24&255}function o(e,t,i,r){for(var n,s=255&r[0]|(255&r[1])<<8|(255&r[2])<<16|(255&r[3])<<24,a=255&i[0]|(255&i[1])<<8|(255&i[2])<<16|(255&i[3])<<24,o=255&i[4]|(255&i[5])<<8|(255&i[6])<<16|(255&i[7])<<24,f=255&i[8]|(255&i[9])<<8|(255&i[10])<<16|(255&i[11])<<24,h=255&i[12]|(255&i[13])<<8|(255&i[14])<<16|(255&i[15])<<24,c=255&r[4]|(255&r[5])<<8|(255&r[6])<<16|(255&r[7])<<24,l=255&t[0]|(255&t[1])<<8|(255&t[2])<<16|(255&t[3])<<24,u=255&t[4]|(255&t[5])<<8|(255&t[6])<<16|(255&t[7])<<24,d=255&t[8]|(255&t[9])<<8|(255&t[10])<<16|(255&t[11])<<24,p=255&t[12]|(255&t[13])<<8|(255&t[14])<<16|(255&t[15])<<24,b=255&r[8]|(255&r[9])<<8|(255&r[10])<<16|(255&r[11])<<24,m=255&i[16]|(255&i[17])<<8|(255&i[18])<<16|(255&i[19])<<24,w=255&i[20]|(255&i[21])<<8|(255&i[22])<<16|(255&i[23])<<24,g=255&i[24]|(255&i[25])<<8|(255&i[26])<<16|(255&i[27])<<24,v=255&i[28]|(255&i[29])<<8|(255&i[30])<<16|(255&i[31])<<24,_=255&r[12]|(255&r[13])<<8|(255&r[14])<<16|(255&r[15])<<24,y=s,k=a,E=o,A=f,S=h,M=c,T=l,R=u,x=d,C=p,I=b,P=m,O=w,N=g,D=v,L=_,B=0;B<20;B+=2)n=y+O|0,S^=n<<7|n>>>25,n=S+y|0,x^=n<<9|n>>>23,n=x+S|0,O^=n<<13|n>>>19,n=O+x|0,y^=n<<18|n>>>14,n=M+k|0,C^=n<<7|n>>>25,n=C+M|0,N^=n<<9|n>>>23,n=N+C|0,k^=n<<13|n>>>19,n=k+N|0,M^=n<<18|n>>>14,n=I+T|0,D^=n<<7|n>>>25,n=D+I|0,E^=n<<9|n>>>23,n=E+D|0,T^=n<<13|n>>>19,n=T+E|0,I^=n<<18|n>>>14,n=L+P|0,A^=n<<7|n>>>25,n=A+L|0,R^=n<<9|n>>>23,n=R+A|0,P^=n<<13|n>>>19,n=P+R|0,L^=n<<18|n>>>14,n=y+A|0,k^=n<<7|n>>>25,n=k+y|0,E^=n<<9|n>>>23,n=E+k|0,A^=n<<13|n>>>19,n=A+E|0,y^=n<<18|n>>>14,n=M+S|0,T^=n<<7|n>>>25,n=T+M|0,R^=n<<9|n>>>23,n=R+T|0,S^=n<<13|n>>>19,n=S+R|0,M^=n<<18|n>>>14,n=I+C|0,P^=n<<7|n>>>25,n=P+I|0,x^=n<<9|n>>>23,n=x+P|0,C^=n<<13|n>>>19,n=C+x|0,I^=n<<18|n>>>14,n=L+D|0,O^=n<<7|n>>>25,n=O+L|0,N^=n<<9|n>>>23,n=N+O|0,D^=n<<13|n>>>19,n=D+N|0,L^=n<<18|n>>>14;e[0]=y>>>0&255,e[1]=y>>>8&255,e[2]=y>>>16&255,e[3]=y>>>24&255,e[4]=M>>>0&255,e[5]=M>>>8&255,e[6]=M>>>16&255,e[7]=M>>>24&255,e[8]=I>>>0&255,e[9]=I>>>8&255,e[10]=I>>>16&255,e[11]=I>>>24&255,e[12]=L>>>0&255,e[13]=L>>>8&255,e[14]=L>>>16&255,e[15]=L>>>24&255,e[16]=T>>>0&255,e[17]=T>>>8&255,e[18]=T>>>16&255,e[19]=T>>>24&255,e[20]=R>>>0&255,e[21]=R>>>8&255,e[22]=R>>>16&255,e[23]=R>>>24&255,e[24]=x>>>0&255,e[25]=x>>>8&255,e[26]=x>>>16&255,e[27]=x>>>24&255,e[28]=C>>>0&255,e[29]=C>>>8&255,e[30]=C>>>16&255,e[31]=C>>>24&255}function f(e,t,i,r){a(e,t,i,r)}function h(e,t,i,r){o(e,t,i,r)}function c(e,t,i,r,n,s,a){var o,h,c=new Uint8Array(16),l=new Uint8Array(64);for(h=0;h<16;h++)c[h]=0;for(h=0;h<8;h++)c[h]=s[h];for(;n>=64;){for(f(l,c,a,ue),h=0;h<64;h++)e[t+h]=i[r+h]^l[h];for(o=1,h=8;h<16;h++)o=o+(255&c[h])|0,c[h]=255&o,o>>>=8;n-=64,t+=64,r+=64}if(n>0)for(f(l,c,a,ue),h=0;h=64;){for(f(h,o,n,ue),a=0;a<64;a++)e[t+a]=h[a];for(s=1,a=8;a<16;a++)s=s+(255&o[a])|0,o[a]=255&s,s>>>=8;i-=64,t+=64}if(i>0)for(f(h,o,n,ue),a=0;a>16&1),s[i-1]&=65535;s[15]=a[15]-32767-(s[14]>>16&1),n=s[15]>>16&1,s[14]&=65535,_(a,s,1-n)}for(i=0;i<16;i++)e[2*i]=255&a[i],e[2*i+1]=a[i]>>8}function k(e,t){var i=new Uint8Array(32),r=new Uint8Array(32);return y(i,e),y(r,t),s(i,0,r,0)}function E(e){var t=new Uint8Array(32);return y(t,e),1&t[0]}function A(e,t){var i;for(i=0;i<16;i++)e[i]=t[2*i]+(t[2*i+1]<<8);e[15]&=32767}function S(e,t,i){for(var r=0;r<16;r++)e[r]=t[r]+i[r]}function M(e,t,i){for(var r=0;r<16;r++)e[r]=t[r]-i[r]}function T(e,t,i){var r,n,s=0,a=0,o=0,f=0,h=0,c=0,l=0,u=0,d=0,p=0,b=0,m=0,w=0,g=0,v=0,_=0,y=0,k=0,E=0,A=0,S=0,M=0,T=0,R=0,x=0,C=0,I=0,P=0,O=0,N=0,D=0,L=i[0],B=i[1],U=i[2],j=i[3],F=i[4],z=i[5],q=i[6],H=i[7],G=i[8],V=i[9],W=i[10],K=i[11],Z=i[12],Y=i[13],$=i[14],X=i[15];r=t[0],s+=r*L,a+=r*B,o+=r*U,f+=r*j,h+=r*F,c+=r*z,l+=r*q,u+=r*H,d+=r*G,p+=r*V,b+=r*W,m+=r*K,w+=r*Z,g+=r*Y,v+=r*$,_+=r*X,r=t[1],a+=r*L,o+=r*B,f+=r*U,h+=r*j,c+=r*F,l+=r*z,u+=r*q,d+=r*H,p+=r*G,b+=r*V,m+=r*W,w+=r*K,g+=r*Z,v+=r*Y,_+=r*$,y+=r*X,r=t[2],o+=r*L,f+=r*B,h+=r*U,c+=r*j,l+=r*F,u+=r*z,d+=r*q,p+=r*H,b+=r*G,m+=r*V,w+=r*W,g+=r*K,v+=r*Z,_+=r*Y,y+=r*$,k+=r*X,r=t[3],f+=r*L,h+=r*B,c+=r*U,l+=r*j,u+=r*F,d+=r*z,p+=r*q,b+=r*H,m+=r*G,w+=r*V,g+=r*W,v+=r*K,_+=r*Z,y+=r*Y,k+=r*$,E+=r*X,r=t[4],h+=r*L,c+=r*B,l+=r*U,u+=r*j,d+=r*F,p+=r*z,b+=r*q,m+=r*H,w+=r*G,g+=r*V,v+=r*W,_+=r*K,y+=r*Z,k+=r*Y,E+=r*$,A+=r*X,r=t[5],c+=r*L,l+=r*B,u+=r*U,d+=r*j,p+=r*F,b+=r*z,m+=r*q,w+=r*H,g+=r*G,v+=r*V,_+=r*W,y+=r*K,k+=r*Z,E+=r*Y,A+=r*$,S+=r*X,r=t[6],l+=r*L,u+=r*B,d+=r*U,p+=r*j,b+=r*F,m+=r*z,w+=r*q,g+=r*H,v+=r*G,_+=r*V,y+=r*W,k+=r*K,E+=r*Z,A+=r*Y,S+=r*$,M+=r*X,r=t[7],u+=r*L,d+=r*B,p+=r*U,b+=r*j,m+=r*F,w+=r*z,g+=r*q,v+=r*H,_+=r*G,y+=r*V,k+=r*W,E+=r*K,A+=r*Z,S+=r*Y,M+=r*$,T+=r*X,r=t[8],d+=r*L,p+=r*B,b+=r*U,m+=r*j,w+=r*F,g+=r*z,v+=r*q,_+=r*H,y+=r*G,k+=r*V,E+=r*W,A+=r*K,S+=r*Z,M+=r*Y,T+=r*$,R+=r*X,r=t[9],p+=r*L,b+=r*B,m+=r*U,w+=r*j,g+=r*F,v+=r*z,_+=r*q,y+=r*H,k+=r*G,E+=r*V,A+=r*W,S+=r*K,M+=r*Z,T+=r*Y,R+=r*$,x+=r*X,r=t[10],b+=r*L,m+=r*B,w+=r*U,g+=r*j,v+=r*F,_+=r*z,y+=r*q,k+=r*H,E+=r*G,A+=r*V,S+=r*W,M+=r*K,T+=r*Z,R+=r*Y,x+=r*$,C+=r*X,r=t[11],m+=r*L,w+=r*B,g+=r*U,v+=r*j,_+=r*F,y+=r*z,k+=r*q,E+=r*H,A+=r*G,S+=r*V,M+=r*W,T+=r*K;R+=r*Z;x+=r*Y,C+=r*$,I+=r*X,r=t[12],w+=r*L,g+=r*B,v+=r*U,_+=r*j,y+=r*F,k+=r*z,E+=r*q,A+=r*H,S+=r*G,M+=r*V,T+=r*W,R+=r*K,x+=r*Z,C+=r*Y,I+=r*$,P+=r*X,r=t[13],g+=r*L,v+=r*B,_+=r*U,y+=r*j,k+=r*F,E+=r*z,A+=r*q,S+=r*H,M+=r*G,T+=r*V,R+=r*W,x+=r*K,C+=r*Z,I+=r*Y,P+=r*$,O+=r*X,r=t[14],v+=r*L,_+=r*B,y+=r*U,k+=r*j,E+=r*F,A+=r*z,S+=r*q,M+=r*H,T+=r*G,R+=r*V,x+=r*W,C+=r*K,I+=r*Z,P+=r*Y,O+=r*$,N+=r*X,r=t[15],_+=r*L,y+=r*B,k+=r*U,E+=r*j,A+=r*F,S+=r*z,M+=r*q,T+=r*H,R+=r*G,x+=r*V,C+=r*W,I+=r*K,P+=r*Z,O+=r*Y,N+=r*$,D+=r*X,s+=38*y,a+=38*k,o+=38*E,f+=38*A,h+=38*S,c+=38*M,l+=38*T,u+=38*R,d+=38*x,p+=38*C,b+=38*I,m+=38*P,w+=38*O,g+=38*N,v+=38*D,n=1,r=s+n+65535,n=Math.floor(r/65536),s=r-65536*n,r=a+n+65535,n=Math.floor(r/65536),a=r-65536*n,r=o+n+65535,n=Math.floor(r/65536),o=r-65536*n,r=f+n+65535,n=Math.floor(r/65536),f=r-65536*n,r=h+n+65535,n=Math.floor(r/65536),h=r-65536*n,r=c+n+65535,n=Math.floor(r/65536),c=r-65536*n,r=l+n+65535,n=Math.floor(r/65536),l=r-65536*n,r=u+n+65535,n=Math.floor(r/65536),u=r-65536*n,r=d+n+65535,n=Math.floor(r/65536),d=r-65536*n,r=p+n+65535,n=Math.floor(r/65536),p=r-65536*n,r=b+n+65535,n=Math.floor(r/65536),b=r-65536*n,r=m+n+65535,n=Math.floor(r/65536),m=r-65536*n,r=w+n+65535,n=Math.floor(r/65536),w=r-65536*n,r=g+n+65535,n=Math.floor(r/65536),g=r-65536*n,r=v+n+65535,n=Math.floor(r/65536),v=r-65536*n,r=_+n+65535,n=Math.floor(r/65536),_=r-65536*n,s+=n-1+37*(n-1),n=1,r=s+n+65535,n=Math.floor(r/65536),s=r-65536*n,r=a+n+65535,n=Math.floor(r/65536),a=r-65536*n,r=o+n+65535,n=Math.floor(r/65536),o=r-65536*n,r=f+n+65535,n=Math.floor(r/65536),f=r-65536*n,r=h+n+65535,n=Math.floor(r/65536),h=r-65536*n,r=c+n+65535,n=Math.floor(r/65536),c=r-65536*n,r=l+n+65535,n=Math.floor(r/65536),l=r-65536*n,r=u+n+65535,n=Math.floor(r/65536),u=r-65536*n,r=d+n+65535,n=Math.floor(r/65536),d=r-65536*n,r=p+n+65535,n=Math.floor(r/65536),p=r-65536*n,r=b+n+65535,n=Math.floor(r/65536),b=r-65536*n,r=m+n+65535,n=Math.floor(r/65536),m=r-65536*n,r=w+n+65535,n=Math.floor(r/65536),w=r-65536*n,r=g+n+65535,n=Math.floor(r/65536),g=r-65536*n,r=v+n+65535,n=Math.floor(r/65536),v=r-65536*n,r=_+n+65535,n=Math.floor(r/65536),_=r-65536*n,s+=n-1+37*(n-1),e[0]=s,e[1]=a,e[2]=o,e[3]=f,e[4]=h,e[5]=c,e[6]=l,e[7]=u,e[8]=d,e[9]=p,e[10]=b,e[11]=m,e[12]=w,e[13]=g;e[14]=v;e[15]=_}function R(e,t){T(e,t,t)}function x(e,t){var i,r=ee();for(i=0;i<16;i++)r[i]=t[i];for(i=253;i>=0;i--)R(r,r),2!==i&&4!==i&&T(r,r,t);for(i=0;i<16;i++)e[i]=r[i]}function C(e,t){var i,r=ee();for(i=0;i<16;i++)r[i]=t[i];for(i=250;i>=0;i--)R(r,r),1!==i&&T(r,r,t);for(i=0;i<16;i++)e[i]=r[i]}function I(e,t,i){var r,n,s=new Uint8Array(32),a=new Float64Array(80),o=ee(),f=ee(),h=ee(),c=ee(),l=ee(),u=ee();for(n=0;n<31;n++)s[n]=t[n];for(s[31]=127&t[31]|64,s[0]&=248,A(a,i),n=0;n<16;n++)f[n]=a[n],c[n]=o[n]=h[n]=0;for(o[0]=c[0]=1,n=254;n>=0;--n)r=s[n>>>3]>>>(7&n)&1,_(o,f,r),_(h,c,r),S(l,o,h),M(o,o,h),S(h,f,c),M(f,f,c),R(c,l),R(u,o),T(o,h,o),T(h,f,l),S(l,o,h),M(o,o,h),R(f,o),M(h,c,u),T(o,h,ae),S(o,o,c),T(h,h,o),T(o,c,u),T(c,f,a),R(f,l),_(o,f,r),_(h,c,r);for(n=0;n<16;n++)a[n+16]=o[n],a[n+32]=h[n],a[n+48]=f[n],a[n+64]=c[n];var d=a.subarray(32),p=a.subarray(16);return x(d,d),T(p,p,d),y(e,p),0}function P(e,t){return I(e,t,re)}function O(e,t){return te(t,32),P(e,t)}function N(e,t,i){var r=new Uint8Array(32);return I(r,i,t),h(e,ie,r,ue)}function D(e,t,i,r,n,s){var a=new Uint8Array(32);return N(a,n,s),pe(e,t,i,r,a)}function L(e,t,i,r,n,s){var a=new Uint8Array(32);return N(a,n,s),be(e,t,i,r,a)}function B(e,t,i,r){for(var n,s,a,o,f,h,c,l,u,d,p,b,m,w,g,v,_,y,k,E,A,S,M,T,R,x,C=new Int32Array(16),I=new Int32Array(16),P=e[0],O=e[1],N=e[2],D=e[3],L=e[4],B=e[5],U=e[6],j=e[7],F=t[0],z=t[1],q=t[2],H=t[3],G=t[4],V=t[5],W=t[6],K=t[7],Z=0;r>=128;){for(k=0;k<16;k++)E=8*k+Z,C[k]=i[E+0]<<24|i[E+1]<<16|i[E+2]<<8|i[E+3],I[k]=i[E+4]<<24|i[E+5]<<16|i[E+6]<<8|i[E+7];for(k=0;k<80;k++)if(n=P,s=O,a=N,o=D,f=L,h=B,c=U,l=j,u=F,d=z,p=q,b=H,m=G,w=V,g=W,v=K,A=j,S=K,M=65535&S,T=S>>>16,R=65535&A,x=A>>>16,A=(L>>>14|G<<18)^(L>>>18|G<<14)^(G>>>9|L<<23),S=(G>>>14|L<<18)^(G>>>18|L<<14)^(L>>>9|G<<23),M+=65535&S,T+=S>>>16,R+=65535&A,x+=A>>>16,A=L&B^~L&U,S=G&V^~G&W,M+=65535&S,T+=S>>>16,R+=65535&A,x+=A>>>16,A=me[2*k],S=me[2*k+1],M+=65535&S,T+=S>>>16,R+=65535&A,x+=A>>>16,A=C[k%16],S=I[k%16],M+=65535&S,T+=S>>>16,R+=65535&A,x+=A>>>16,T+=M>>>16,R+=T>>>16,x+=R>>>16,_=65535&R|x<<16,y=65535&M|T<<16,A=_,S=y,M=65535&S,T=S>>>16,R=65535&A,x=A>>>16,A=(P>>>28|F<<4)^(F>>>2|P<<30)^(F>>>7|P<<25),S=(F>>>28|P<<4)^(P>>>2|F<<30)^(P>>>7|F<<25),M+=65535&S,T+=S>>>16,R+=65535&A,x+=A>>>16,A=P&O^P&N^O&N,S=F&z^F&q^z&q,M+=65535&S,T+=S>>>16,R+=65535&A,x+=A>>>16,T+=M>>>16,R+=T>>>16,x+=R>>>16,l=65535&R|x<<16,v=65535&M|T<<16,A=o,S=b,M=65535&S,T=S>>>16,R=65535&A,x=A>>>16,A=_,S=y,M+=65535&S,T+=S>>>16,R+=65535&A,x+=A>>>16,T+=M>>>16,R+=T>>>16,x+=R>>>16,o=65535&R|x<<16,b=65535&M|T<<16,O=n,N=s,D=a,L=o,B=f,U=h,j=c,P=l,z=u,q=d,H=p,G=b,V=m,W=w,K=g,F=v,k%16===15)for(E=0;E<16;E++)A=C[E],S=I[E],M=65535&S,T=S>>>16,R=65535&A,x=A>>>16,A=C[(E+9)%16],S=I[(E+9)%16],M+=65535&S,T+=S>>>16,R+=65535&A,x+=A>>>16,_=C[(E+1)%16],y=I[(E+1)%16],A=(_>>>1|y<<31)^(_>>>8|y<<24)^_>>>7,S=(y>>>1|_<<31)^(y>>>8|_<<24)^(y>>>7|_<<25),M+=65535&S,T+=S>>>16,R+=65535&A,x+=A>>>16,_=C[(E+14)%16],y=I[(E+14)%16],A=(_>>>19|y<<13)^(y>>>29|_<<3)^_>>>6,S=(y>>>19|_<<13)^(_>>>29|y<<3)^(y>>>6|_<<26),M+=65535&S,T+=S>>>16,R+=65535&A,x+=A>>>16,T+=M>>>16,R+=T>>>16,x+=R>>>16,C[E]=65535&R|x<<16,I[E]=65535&M|T<<16;A=P,S=F,M=65535&S,T=S>>>16,R=65535&A,x=A>>>16,A=e[0],S=t[0],M+=65535&S,T+=S>>>16,R+=65535&A,x+=A>>>16,T+=M>>>16,R+=T>>>16,x+=R>>>16,e[0]=P=65535&R|x<<16,t[0]=F=65535&M|T<<16,A=O,S=z,M=65535&S,T=S>>>16,R=65535&A,x=A>>>16,A=e[1],S=t[1],M+=65535&S,T+=S>>>16,R+=65535&A,x+=A>>>16,T+=M>>>16,R+=T>>>16,x+=R>>>16,e[1]=O=65535&R|x<<16,t[1]=z=65535&M|T<<16,A=N,S=q,M=65535&S,T=S>>>16,R=65535&A,x=A>>>16,A=e[2],S=t[2],M+=65535&S,T+=S>>>16,R+=65535&A,x+=A>>>16,T+=M>>>16,R+=T>>>16,x+=R>>>16,e[2]=N=65535&R|x<<16,t[2]=q=65535&M|T<<16,A=D,S=H,M=65535&S,T=S>>>16,R=65535&A,x=A>>>16,A=e[3],S=t[3],M+=65535&S,T+=S>>>16,R+=65535&A,x+=A>>>16,T+=M>>>16,R+=T>>>16,x+=R>>>16,e[3]=D=65535&R|x<<16,t[3]=H=65535&M|T<<16,A=L,S=G,M=65535&S,T=S>>>16,R=65535&A,x=A>>>16,A=e[4],S=t[4],M+=65535&S,T+=S>>>16,R+=65535&A,x+=A>>>16,T+=M>>>16,R+=T>>>16,x+=R>>>16,e[4]=L=65535&R|x<<16,t[4]=G=65535&M|T<<16,A=B,S=V,M=65535&S,T=S>>>16,R=65535&A,x=A>>>16,A=e[5],S=t[5],M+=65535&S,T+=S>>>16,R+=65535&A,x+=A>>>16,T+=M>>>16,R+=T>>>16,x+=R>>>16,e[5]=B=65535&R|x<<16,t[5]=V=65535&M|T<<16,A=U,S=W,M=65535&S,T=S>>>16,R=65535&A,x=A>>>16,A=e[6],S=t[6],M+=65535&S,T+=S>>>16,R+=65535&A,x+=A>>>16,T+=M>>>16,R+=T>>>16,x+=R>>>16,e[6]=U=65535&R|x<<16,t[6]=W=65535&M|T<<16,A=j,S=K,M=65535&S,T=S>>>16,R=65535&A,x=A>>>16,A=e[7],S=t[7],M+=65535&S,T+=S>>>16,R+=65535&A,x+=A>>>16,T+=M>>>16,R+=T>>>16,x+=R>>>16,e[7]=j=65535&R|x<<16,t[7]=K=65535&M|T<<16,Z+=128,r-=128}return r}function U(e,i,r){var n,s=new Int32Array(8),a=new Int32Array(8),o=new Uint8Array(256),f=r;for(s[0]=1779033703,s[1]=3144134277,s[2]=1013904242,s[3]=2773480762,s[4]=1359893119,s[5]=2600822924,s[6]=528734635,s[7]=1541459225,a[0]=4089235720,a[1]=2227873595,a[2]=4271175723,a[3]=1595750129,a[4]=2917565137,a[5]=725511199,a[6]=4215389547,a[7]=327033209,B(s,a,i,r),r%=128,n=0;n=0;--n)r=i[n/8|0]>>(7&n)&1,F(e,t,r),j(t,e),j(e,e),F(e,t,r)}function H(e,t){var i=[ee(),ee(),ee(),ee()];g(i[0],he),g(i[1],ce),g(i[2],se),T(i[3],he,ce),q(e,i,t)}function G(e,t,i){var r,n=new Uint8Array(64),s=[ee(),ee(),ee(),ee()];for(i||te(t,32),U(n,t,32),n[0]&=248,n[31]&=127,n[31]|=64,H(s,n),z(e,s),r=0;r<32;r++)t[r+32]=e[r];return 0}function V(e,t){var i,r,n,s;for(r=63;r>=32;--r){for(i=0,n=r-32,s=r-12;n>8,t[n]-=256*i;t[n]+=i,t[r]=0}for(i=0,n=0;n<32;n++)t[n]+=i-(t[31]>>4)*we[n],i=t[n]>>8,t[n]&=255;for(n=0;n<32;n++)t[n]-=i*we[n];for(r=0;r<32;r++)t[r+1]+=t[r]>>8,e[r]=255&t[r]}function W(e){var t,i=new Float64Array(64);for(t=0;t<64;t++)i[t]=e[t];for(t=0;t<64;t++)e[t]=0;V(e,i)}function K(e,t,i,r){var n,s,a=new Uint8Array(64),o=new Uint8Array(64),f=new Uint8Array(64),h=new Float64Array(64),c=[ee(),ee(),ee(),ee()];U(a,r,32),a[0]&=248,a[31]&=127,a[31]|=64;var l=i+64;for(n=0;n>7&&M(e[0],ne,e[0]),T(e[3],e[0],e[1]),0)}function Y(e,t,i,r){var n,a,o=new Uint8Array(32),f=new Uint8Array(64),h=[ee(),ee(),ee(),ee()],c=[ee(),ee(),ee(),ee()];if(a=-1,i<64)return-1;if(Z(c,r))return-1;for(n=0;n>>13|i<<3),r=255&e[4]|(255&e[5])<<8,this.r[2]=7939&(i>>>10|r<<6),n=255&e[6]|(255&e[7])<<8,this.r[3]=8191&(r>>>7|n<<9),s=255&e[8]|(255&e[9])<<8,this.r[4]=255&(n>>>4|s<<12),this.r[5]=s>>>1&8190,a=255&e[10]|(255&e[11])<<8,this.r[6]=8191&(s>>>14|a<<2),o=255&e[12]|(255&e[13])<<8,this.r[7]=8065&(a>>>11|o<<5),f=255&e[14]|(255&e[15])<<8,this.r[8]=8191&(o>>>8|f<<8),this.r[9]=f>>>5&127,this.pad[0]=255&e[16]|(255&e[17])<<8,this.pad[1]=255&e[18]|(255&e[19])<<8,this.pad[2]=255&e[20]|(255&e[21])<<8,this.pad[3]=255&e[22]|(255&e[23])<<8,this.pad[4]=255&e[24]|(255&e[25])<<8,this.pad[5]=255&e[26]|(255&e[27])<<8,this.pad[6]=255&e[28]|(255&e[29])<<8,this.pad[7]=255&e[30]|(255&e[31])<<8};de.prototype.blocks=function(e,t,i){for(var r,n,s,a,o,f,h,c,l,u,d,p,b,m,w,g,v,_,y,k=this.fin?0:2048,E=this.h[0],A=this.h[1],S=this.h[2],M=this.h[3],T=this.h[4],R=this.h[5],x=this.h[6],C=this.h[7],I=this.h[8],P=this.h[9],O=this.r[0],N=this.r[1],D=this.r[2],L=this.r[3],B=this.r[4],U=this.r[5],j=this.r[6],F=this.r[7],z=this.r[8],q=this.r[9];i>=16;)r=255&e[t+0]|(255&e[t+1])<<8,E+=8191&r,n=255&e[t+2]|(255&e[t+3])<<8,A+=8191&(r>>>13|n<<3),s=255&e[t+4]|(255&e[t+5])<<8,S+=8191&(n>>>10|s<<6),a=255&e[t+6]|(255&e[t+7])<<8,M+=8191&(s>>>7|a<<9),o=255&e[t+8]|(255&e[t+9])<<8,T+=8191&(a>>>4|o<<12),R+=o>>>1&8191,f=255&e[t+10]|(255&e[t+11])<<8,x+=8191&(o>>>14|f<<2),h=255&e[t+12]|(255&e[t+13])<<8,C+=8191&(f>>>11|h<<5),c=255&e[t+14]|(255&e[t+15])<<8,I+=8191&(h>>>8|c<<8),P+=c>>>5|k,l=0,u=l,u+=E*O,u+=A*(5*q),u+=S*(5*z),u+=M*(5*F),u+=T*(5*j),l=u>>>13,u&=8191,u+=R*(5*U),u+=x*(5*B),u+=C*(5*L),u+=I*(5*D),u+=P*(5*N),l+=u>>>13,u&=8191,d=l,d+=E*N,d+=A*O,d+=S*(5*q),d+=M*(5*z),d+=T*(5*F),l=d>>>13,d&=8191,d+=R*(5*j),d+=x*(5*U),d+=C*(5*B),d+=I*(5*L),d+=P*(5*D),l+=d>>>13,d&=8191,p=l,p+=E*D,p+=A*N,p+=S*O,p+=M*(5*q),p+=T*(5*z),l=p>>>13,p&=8191,p+=R*(5*F),p+=x*(5*j),p+=C*(5*U),p+=I*(5*B),p+=P*(5*L),l+=p>>>13,p&=8191,b=l,b+=E*L,b+=A*D,b+=S*N,b+=M*O,b+=T*(5*q),l=b>>>13,b&=8191,b+=R*(5*z),b+=x*(5*F),b+=C*(5*j),b+=I*(5*U),b+=P*(5*B),l+=b>>>13,b&=8191,m=l,m+=E*B,m+=A*L,m+=S*D,m+=M*N,m+=T*O,l=m>>>13,m&=8191,m+=R*(5*q),m+=x*(5*z),m+=C*(5*F),m+=I*(5*j),m+=P*(5*U),l+=m>>>13,m&=8191,w=l,w+=E*U,w+=A*B,w+=S*L,w+=M*D,w+=T*N,l=w>>>13,w&=8191,w+=R*O,w+=x*(5*q),w+=C*(5*z),w+=I*(5*F),w+=P*(5*j),l+=w>>>13,w&=8191,g=l,g+=E*j,g+=A*U,g+=S*B,g+=M*L,g+=T*D,l=g>>>13,g&=8191,g+=R*N,g+=x*O,g+=C*(5*q),g+=I*(5*z),g+=P*(5*F),l+=g>>>13,g&=8191,v=l,v+=E*F,v+=A*j,v+=S*U,v+=M*B,v+=T*L,l=v>>>13,v&=8191,v+=R*D,v+=x*N,v+=C*O,v+=I*(5*q),v+=P*(5*z),l+=v>>>13,v&=8191,_=l,_+=E*z,_+=A*F,_+=S*j,_+=M*U,_+=T*B,l=_>>>13,_&=8191,_+=R*L,_+=x*D,_+=C*N,_+=I*O,_+=P*(5*q),l+=_>>>13,_&=8191,y=l,y+=E*q,y+=A*z,y+=S*F,y+=M*j,y+=T*U,l=y>>>13,y&=8191,y+=R*B,y+=x*L,y+=C*D,y+=I*N,y+=P*O,l+=y>>>13,y&=8191,l=(l<<2)+l|0,l=l+u|0,u=8191&l,l>>>=13,d+=l,E=u,A=d,S=p,M=b,T=m,R=w,x=g,C=v,I=_,P=y,t+=16,i-=16;this.h[0]=E,this.h[1]=A,this.h[2]=S,this.h[3]=M,this.h[4]=T,this.h[5]=R,this.h[6]=x,this.h[7]=C,this.h[8]=I,this.h[9]=P},de.prototype.finish=function(e,t){var i,r,n,s,a=new Uint16Array(10);if(this.leftover){for(s=this.leftover,this.buffer[s++]=1;s<16;s++)this.buffer[s]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(i=this.h[1]>>>13,this.h[1]&=8191,s=2;s<10;s++)this.h[s]+=i,i=this.h[s]>>>13,this.h[s]&=8191;for(this.h[0]+=5*i,i=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=i,i=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=i,a[0]=this.h[0]+5,i=a[0]>>>13,a[0]&=8191,s=1;s<10;s++)a[s]=this.h[s]+i,i=a[s]>>>13,a[s]&=8191;for(a[9]-=8192,r=(1^i)-1,s=0;s<10;s++)a[s]&=r;for(r=~r,s=0;s<10;s++)this.h[s]=this.h[s]&r|a[s];for(this.h[0]=65535&(this.h[0]|this.h[1]<<13),this.h[1]=65535&(this.h[1]>>>3|this.h[2]<<10),this.h[2]=65535&(this.h[2]>>>6|this.h[3]<<7),this.h[3]=65535&(this.h[3]>>>9|this.h[4]<<4),this.h[4]=65535&(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14),this.h[5]=65535&(this.h[6]>>>2|this.h[7]<<11),this.h[6]=65535&(this.h[7]>>>5|this.h[8]<<8),this.h[7]=65535&(this.h[8]>>>8|this.h[9]<<5),n=this.h[0]+this.pad[0],this.h[0]=65535&n,s=1;s<8;s++)n=(this.h[s]+this.pad[s]|0)+(n>>>16)|0,this.h[s]=65535&n;e[t+0]=this.h[0]>>>0&255,e[t+1]=this.h[0]>>>8&255,e[t+2]=this.h[1]>>>0&255,e[t+3]=this.h[1]>>>8&255,e[t+4]=this.h[2]>>>0&255,e[t+5]=this.h[2]>>>8&255,e[t+6]=this.h[3]>>>0&255,e[t+7]=this.h[3]>>>8&255,e[t+8]=this.h[4]>>>0&255,e[t+9]=this.h[4]>>>8&255,e[t+10]=this.h[5]>>>0&255,e[t+11]=this.h[5]>>>8&255,e[t+12]=this.h[6]>>>0&255,e[t+13]=this.h[6]>>>8&255,e[t+14]=this.h[7]>>>0&255,e[t+15]=this.h[7]>>>8&255},de.prototype.update=function(e,t,i){var r,n;if(this.leftover){for(n=16-this.leftover,n>i&&(n=i),r=0;r=16&&(n=i-i%16,this.blocks(e,t,n),t+=n,i-=n),i){for(r=0;r=0},e.sign.keyPair=function(){var e=new Uint8Array(Ie),t=new Uint8Array(Pe);return G(e,t),{publicKey:e,secretKey:t}},e.sign.keyPair.fromSecretKey=function(e){if(J(e),e.length!==Pe)throw new Error("bad secret key size");for(var t=new Uint8Array(Ie),i=0;i + * MIT Licensed + */ +var r=e.exports=i(125);r.Server=i(246),r.Sender=i(124),r.Receiver=i(123),r.createServer=function(e,t){var i=new r.Server(e);return"function"==typeof t&&i.on("connection",t),i},r.connect=r.createConnection=function(e,t){var i=new r(e);return"function"==typeof t&&i.on("open",t),i}},function(e,t,i){"use strict";/*! + * ws: a node.js websocket client + * Copyright(c) 2011 Einar Otto Stangvik + * MIT Licensed + */ +try{e.exports=i(160)}catch(t){e.exports=i(241)}},function(e,t){/*! + * ws: a node.js websocket client + * Copyright(c) 2011 Einar Otto Stangvik + * MIT Licensed + */ +e.exports={isValidErrorCode:function(e){return e>=1e3&&e<=1011&&1004!=e&&1005!=e&&1006!=e||e>=3e3&&e<=4999},1e3:"normal",1001:"going away",1002:"protocol error",1003:"unsupported data",1004:"reserved",1005:"reserved for extensions",1006:"reserved for extensions",1007:"inconsistent or invalid data",1008:"policy violation",1009:"message too big",1010:"extension handshake missing",1011:"an unexpected condition prevented the request from being fulfilled"}},function(e,t,i){function r(e){e=e||"";var t={};return e.split(",").forEach(function(e){var i=e.split(";"),r=i.shift().trim(),n=t[r]=t[r]||[],s={};i.forEach(function(e){var t=e.trim().split("="),i=t[0],r=t[1];"undefined"==typeof r?r=!0:('"'===r[0]&&(r=r.slice(1)),'"'===r[r.length-1]&&(r=r.slice(0,r.length-1))),(s[i]=s[i]||[]).push(r)}),n.push(s)}),t}function n(e){return Object.keys(e).map(function(t){var i=e[t];return s.isArray(i)||(i=[i]),i.map(function(e){return[t].concat(Object.keys(e).map(function(t){var i=e[t];return s.isArray(i)||(i=[i]),i.map(function(e){return e===!0?t:t+"="+e}).join("; ")})).join("; ")}).join(", ")}).join(", ")}var s=i(8);t.parse=r,t.format=n},function(e,t,i){(function(t){function r(e,i){if(this instanceof r==!1)throw new TypeError("Classes can't be function-called");"number"==typeof e&&(i=e,e={});var n=-1;this.fragmentedBufferPool=new c(1024,function(e,t){return e.used+t},function(e){return n=n>=0?Math.ceil((n+e.used)/2):e.used});var s=-1;this.unfragmentedBufferPool=new c(1024,function(e,t){return e.used+t},function(e){return s=s>=0?Math.ceil((s+e.used)/2):e.used}),this.extensions=e||{},this.maxPayload=i||0,this.currentPayloadLength=0,this.state={activeFragmentedOperation:null,lastFragment:!1,masked:!1,opcode:0,fragmentedOperation:!1},this.overflow=[],this.headerBuffer=new t(10),this.expectOffset=0,this.expectBuffer=null,this.expectHandler=null,this.currentMessage=[],this.currentMessageLength=0,this.messageHandlers=[],this.expectHeader(2,this.processPacket),this.dead=!1,this.processing=!1,this.onerror=function(){},this.ontext=function(){},this.onbinary=function(){},this.onclose=function(){},this.onping=function(){},this.onpong=function(){}}function n(e){return(this[e]<<8)+this[e+1]}function s(e){return(this[e]<<24)+(this[e+1]<<16)+(this[e+2]<<8)+this[e+3]}function a(e,t,i,r){switch(e){default:t.copy(i,r,0,e);break;case 16:i[r+15]=t[15];case 15:i[r+14]=t[14];case 14:i[r+13]=t[13];case 13:i[r+12]=t[12];case 12:i[r+11]=t[11];case 11:i[r+10]=t[10];case 10:i[r+9]=t[9];case 9:i[r+8]=t[8];case 8:i[r+7]=t[7];case 7:i[r+6]=t[6];case 6:i[r+5]=t[5];case 5:i[r+4]=t[4];case 4:i[r+3]=t[3];case 3:i[r+2]=t[2];case 2:i[r+1]=t[1];case 1:i[r]=t[0]}}function o(e){var t={};for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i]);return t}/*! + * ws: a node.js websocket client + * Copyright(c) 2011 Einar Otto Stangvik + * MIT Licensed + */ +var f=(i(8),i(245).Validation),h=i(121),c=i(240),l=i(120).BufferUtil,u=i(40);e.exports=r,r.prototype.add=function(e){if(!this.dead){var t=e.length;if(0!=t){if(null==this.expectBuffer)return void this.overflow.push(e);var i=Math.min(t,this.expectBuffer.length-this.expectOffset);for(a(i,e,this.expectBuffer,this.expectOffset),this.expectOffset+=i,i0&&this.overflow.length>0;){var r=this.overflow.pop();i0&&this.overflow.length>0;){var r=this.overflow.pop();i=8&&t)return void this.error("control frames cannot have the Per-message Compressed bits",1002);this.state.compressed=t,this.state.opcode=i,this.state.lastFragment===!1?(this.state.fragmentedOperation=!0,this.state.activeFragmentedOperation=i):this.state.fragmentedOperation=!1}var r=d[this.state.opcode];"undefined"==typeof r?this.error("no handler for opcode "+this.state.opcode,1002):r.start.call(this,e)},r.prototype.endPacket=function(){this.dead||(this.state.fragmentedOperation?this.state.lastFragment&&this.fragmentedBufferPool.reset(!0):this.unfragmentedBufferPool.reset(!0),this.expectOffset=0,this.expectBuffer=null,this.expectHandler=null,this.state.lastFragment&&this.state.opcode===this.state.activeFragmentedOperation&&(this.state.activeFragmentedOperation=null),this.currentPayloadLength=0,this.state.lastFragment=!1,this.state.opcode=null!=this.state.activeFragmentedOperation?this.state.activeFragmentedOperation:0,this.state.masked=!1,this.expectHeader(2,this.processPacket))},r.prototype.reset=function(){this.dead||(this.state={activeFragmentedOperation:null,lastFragment:!1,masked:!1,opcode:0,fragmentedOperation:!1},this.fragmentedBufferPool.reset(!0),this.unfragmentedBufferPool.reset(!0),this.expectOffset=0,this.expectBuffer=null,this.expectHandler=null,this.overflow=[],this.currentMessage=[],this.currentMessageLength=0,this.messageHandlers=[],this.currentPayloadLength=0)},r.prototype.unmask=function(e,t,i){return null!=e&&null!=t&&l.unmask(t,e),i?t:null!=t?t.toString("utf8"):""},r.prototype.error=function(e,t){if(!this.dead)return this.reset(),"string"==typeof e?this.onerror(new Error(e),t):e.constructor==Error?this.onerror(e,t):this.onerror(new Error("An error occured"),t),this},r.prototype.flush=function(){if(!this.processing&&!this.dead){var e=this.messageHandlers.shift();if(e){this.processing=!0;var t=this;e(function(){t.processing=!1,t.flush()})}}},r.prototype.applyExtensions=function(e,t,i,r){var n=this;i?this.extensions[u.extensionName].decompress(e,t,function(e,t){if(!n.dead)return e?void r(new Error("invalid compressed data")):void r(null,t)}):r(null,e)},r.prototype.maxPayloadExceeded=function(e){if(void 0===this.maxPayload||null===this.maxPayload||this.maxPayload<1)return!1;var t=this.currentPayloadLength+e;return t0&&r.currentMessageLength+n.length0&&r.currentMessageLength+n.length1?n.call(t,0):1e3;if(!h.isValidErrorCode(e))return void i.error("invalid error code",1002);var s="";if(t&&t.length>2){var a=t.slice(2);if(!f.isValidUTF8(a))return void i.error("invalid utf8 sequence",1007);s=a.toString("utf8")}i.onclose(e,s,{masked:r.masked}),i.reset()}),this.flush()}},9:{start:function(e){var t=this;if(0==t.state.lastFragment)return void t.error("fragmented ping is not supported",1002);var i=127&e[1];i<126?d[9].getData.call(t,i):t.error("control frames cannot have more than 125 bytes of data",1002)},getData:function(e){var t=this;t.state.masked?t.expectHeader(4,function(i){var r=i;t.expectData(e,function(e){d[9].finish.call(t,r,e)})}):t.expectData(e,function(e){d[9].finish.call(t,null,e)})},finish:function(e,t){var i=this;t=this.unmask(e,t,!0);var r=o(this.state);this.messageHandlers.push(function(e){i.onping(t,{masked:r.masked,binary:!0}),e()}),this.flush(),this.endPacket()}},10:{start:function(e){var t=this;if(0==t.state.lastFragment)return void t.error("fragmented pong is not supported",1002);var i=127&e[1];i<126?d[10].getData.call(t,i):t.error("control frames cannot have more than 125 bytes of data",1002)},getData:function(e){var t=this;this.state.masked?this.expectHeader(4,function(i){var r=i;t.expectData(e,function(e){d[10].finish.call(t,r,e)})}):this.expectData(e,function(e){d[10].finish.call(t,null,e)})},finish:function(e,t){var i=this;t=i.unmask(e,t,!0);var r=o(this.state);this.messageHandlers.push(function(e){i.onpong(t,{masked:r.masked,binary:!0}),e()}),this.flush(),this.endPacket()}}}}).call(t,i(0).Buffer)},function(e,t,i){(function(t){function r(e,t){if(this instanceof r==!1)throw new TypeError("Classes can't be function-called");f.EventEmitter.call(this),this._socket=e,this.extensions=t||{},this.firstFragment=!0,this.compress=!1,this.messageHandlers=[],this.processing=!1}function n(e,t){this[t]=(65280&e)>>8,this[t+1]=255&e}function s(e,t){this[t]=(4278190080&e)>>24,this[t+1]=(16711680&e)>>16,this[t+2]=(65280&e)>>8,this[t+3]=255&e}function a(e){for(var i=new Uint8Array(e.buffer||e),r=e.byteLength||e.length,n=e.byteOffset||0,s=new t(r),a=0;a + * MIT Licensed + */ +var f=i(3),h=i(8),c=(f.EventEmitter,i(121)),l=i(120).BufferUtil,u=i(40);h.inherits(r,f.EventEmitter),r.prototype.close=function(e,i,r,s){if("undefined"!=typeof e&&("number"!=typeof e||!c.isValidErrorCode(e)))throw new Error("first argument must be a valid error code number");e=e||1e3;var a=new t(2+(i?t.byteLength(i):0));n.call(a,e,0),a.length>2&&a.write(i,2);var o=this;this.messageHandlers.push(function(e){o.frameAndSend(8,a,!0,r),e(),"function"==typeof s&&s()}),this.flush()},r.prototype.ping=function(e,t){var i=t&&t.mask,r=this;this.messageHandlers.push(function(t){r.frameAndSend(9,e||"",!0,i),t()}),this.flush()},r.prototype.pong=function(e,t){var i=t&&t.mask,r=this;this.messageHandlers.push(function(t){r.frameAndSend(10,e||"",!0,i),t()}),this.flush()},r.prototype.send=function(e,t,i){var r=!t||t.fin!==!1,n=t&&t.mask,s=t&&t.compress,a=t&&t.binary?2:1;this.firstFragment===!1?(a=0,s=!1):(this.firstFragment=!1,this.compress=s),r&&(this.firstFragment=!0);var o=this.compress,f=this;this.messageHandlers.push(function(t){f.applyExtensions(e,r,o,function(e,o){return e?void("function"==typeof i?i(e):f.emit("error",e)):(f.frameAndSend(a,o,r,n,s,i),void t())})}),this.flush()},r.prototype.frameAndSend=function(e,i,r,f,h,c){var u=!1;if(i){t.isBuffer(i)||(u=!0,!i||"undefined"==typeof i.byteLength&&"undefined"==typeof i.buffer?("number"==typeof i&&(i=i.toString()),i=new t(i)):i=a(i));var d=i.length,p=f?6:2,b=d;d>=65536?(p+=8,b=127):d>125&&(p+=2,b=126);var m=d<32768||f&&!u,w=m?d+p:p,g=new t(w);switch(g[0]=r?128|e:e,h&&(g[0]|=64),b){case 126:n.call(g,d,2);break;case 127:s.call(g,0,2),s.call(g,d,6)}if(f){g[1]=128|b;var v=o();if(g[p-4]=v[0],g[p-3]=v[1],g[p-2]=v[2],g[p-1]=v[3],m){l.mask(i,v,g,p,d);try{this._socket.write(g,"binary",c)}catch(e){"function"==typeof c?c(e):this.emit("error",e)}}else{l.mask(i,v,i,0,d);try{this._socket.write(g,"binary"),this._socket.write(i,"binary",c)}catch(e){"function"==typeof c?c(e):this.emit("error",e)}}}else if(g[1]=b,m){i.copy(g,p);try{this._socket.write(g,"binary",c)}catch(e){"function"==typeof c?c(e):this.emit("error",e)}}else try{this._socket.write(g,"binary"),this._socket.write(i,"binary",c)}catch(e){"function"==typeof c?c(e):this.emit("error",e)}}else try{this._socket.write(new t([e|(r?128:0),0|(f?128:0)].concat(f?[0,0,0,0]:[])),"binary",c)}catch(e){"function"==typeof c?c(e):this.emit("error",e)}},r.prototype.flush=function(){if(!this.processing){var e=this.messageHandlers.shift();if(e){this.processing=!0;var t=this;e(function(){t.processing=!1,t.flush()})}}},r.prototype.applyExtensions=function(e,t,i,r){i&&e?((e.buffer||e)instanceof ArrayBuffer&&(e=a(e)),this.extensions[u.extensionName].compress(e,t,r)):r(null,e)},e.exports=r}).call(t,i(0).Buffer)},function(e,t,i){"use strict";(function(t,r){function n(e,t,i){return this instanceof n==!1?new n(e,t,i):(C.call(this),t&&!Array.isArray(t)&&"object"==typeof t&&(i=t,t=null),"string"==typeof t&&(t=[t]),Array.isArray(t)||(t=[]),this._socket=null,this._ultron=null,this._closeReceived=!1,this.bytesReceived=0,this.readyState=null,this.supports={},this.extensions={},this._binaryType="nodebuffer",void(Array.isArray(e)?h.apply(this,e.concat(i)):c.apply(this,[e,t,i])))}function s(e,t,i){this.type="message",this.data=e,this.target=i,this.binary=t}function a(e,t,i){this.type="close",this.wasClean="undefined"==typeof e||1e3===e,this.code=e,this.reason=t,this.target=i}function o(e){this.type="open",this.target=e}function f(e,t,i){var r=t;return t&&(e&&443!=i||!e&&80!=i)&&(r=r+":"+i),r}function h(e,t,i,r){r=new E({protocolVersion:I,protocol:null,extensions:{},maxPayload:0}).merge(r),this.protocol=r.value.protocol,this.protocolVersion=r.value.protocolVersion,this.extensions=r.value.extensions,this.supports.binary="hixie-76"!==this.protocolVersion,this.upgradeReq=e,this.readyState=n.CONNECTING,this._isServer=!0,this.maxPayload=r.value.maxPayload,"hixie-76"===r.value.protocolVersion?l.call(this,T,M,t,i):l.call(this,S,A,t,i)}function c(e,i,r){if(r=new E({origin:null,protocolVersion:I,host:null,headers:null,protocol:i.join(","),agent:null,pfx:null,key:null,passphrase:null,cert:null,ca:null,ciphers:null,rejectUnauthorized:null,perMessageDeflate:!0,localAddress:null}).merge(r),8!==r.value.protocolVersion&&13!==r.value.protocolVersion)throw new Error("unsupported protocol version");var s=m.parse(e),a="ws+unix:"===s.protocol;if(!s.host&&!a)throw new Error("invalid url");var o,h="wss:"===s.protocol||"https:"===s.protocol,c=h?v:g,u=s.port||(h?443:80),d=s.auth,p={};r.value.perMessageDeflate&&(o=new x(typeof r.value.perMessageDeflate!==!0?r.value.perMessageDeflate:{},!1),p[x.extensionName]=o.offer()),this._isServer=!1,this.url=e,this.protocolVersion=r.value.protocolVersion,this.supports.binary="hixie-76"!==this.protocolVersion;var w=new t(r.value.protocolVersion+"-"+Date.now()).toString("base64"),y=_.createHash("sha1");y.update(w+"258EAFA5-E914-47DA-95CA-C5AB0DC85B11");var k=y.digest("base64"),M=r.value.agent,T=f(h,s.hostname,u),C={port:u,host:s.hostname,headers:{Connection:"Upgrade",Upgrade:"websocket",Host:T,"Sec-WebSocket-Version":r.value.protocolVersion,"Sec-WebSocket-Key":w}};if(d&&(C.headers.Authorization="Basic "+new t(d).toString("base64")),r.value.protocol&&(C.headers["Sec-WebSocket-Protocol"]=r.value.protocol),r.value.host&&(C.headers.Host=r.value.host),r.value.headers)for(var P in r.value.headers)r.value.headers.hasOwnProperty(P)&&(C.headers[P]=r.value.headers[P]);Object.keys(p).length&&(C.headers["Sec-WebSocket-Extensions"]=R.format(p)),(r.isDefinedAndNonNull("pfx")||r.isDefinedAndNonNull("key")||r.isDefinedAndNonNull("passphrase")||r.isDefinedAndNonNull("cert")||r.isDefinedAndNonNull("ca")||r.isDefinedAndNonNull("ciphers")||r.isDefinedAndNonNull("rejectUnauthorized"))&&(r.isDefinedAndNonNull("pfx")&&(C.pfx=r.value.pfx),r.isDefinedAndNonNull("key")&&(C.key=r.value.key),r.isDefinedAndNonNull("passphrase")&&(C.passphrase=r.value.passphrase),r.isDefinedAndNonNull("cert")&&(C.cert=r.value.cert),r.isDefinedAndNonNull("ca")&&(C.ca=r.value.ca),r.isDefinedAndNonNull("ciphers")&&(C.ciphers=r.value.ciphers),r.isDefinedAndNonNull("rejectUnauthorized")&&(C.rejectUnauthorized=r.value.rejectUnauthorized),M||(M=new c.Agent(C))),C.path=s.path||"/",M&&(C.agent=M),a&&(C.socketPath=s.pathname),r.value.localAddress&&(C.localAddress=r.value.localAddress),r.value.origin&&(r.value.protocolVersion<13?C.headers["Sec-WebSocket-Origin"]=r.value.origin:C.headers.Origin=r.value.origin);var O=this,N=c.request(C);N.on("error",function(e){O.emit("error",e),b.call(O,e)}),N.once("response",function(e){var t;O.emit("unexpected-response",N,e)||(t=new Error("unexpected server response ("+e.statusCode+")"),N.abort(),O.emit("error",t)),b.call(O,t)}),N.once("upgrade",function(e,t,i){if(O.readyState===n.CLOSED)return O.emit("close"),O.removeAllListeners(),void t.end();var s=e.headers["sec-websocket-accept"];if("undefined"==typeof s||s!==k)return O.emit("error","invalid server key"),O.removeAllListeners(),void t.end();var a=e.headers["sec-websocket-protocol"],f=(r.value.protocol||"").split(/, */),h=null;if(!r.value.protocol&&a?h="server sent a subprotocol even though none requested":r.value.protocol&&!a?h="server sent no subprotocol even though requested":a&&f.indexOf(a)===-1&&(h="server responded with an invalid protocol"),h)return O.emit("error",h),O.removeAllListeners(),void t.end();a&&(O.protocol=a);var c=R.parse(e.headers["sec-websocket-extensions"]);if(o&&c[x.extensionName]){try{o.accept(c[x.extensionName])}catch(e){return O.emit("error","invalid extension parameter"),O.removeAllListeners(),void t.end()}O.extensions[x.extensionName]=o}l.call(O,S,A,t,i),N.removeAllListeners(),N=null,M=null}),N.end(),this.readyState=n.CONNECTING}function l(e,t,i,s){function a(e){h||c.readyState===n.CLOSED||(h=!0,i.removeListener("data",a),f.on("data",o),s&&s.length>0&&(o(s),s=null),e&&o(e))}function o(e){c.bytesReceived+=e.length,c._receiver.add(e)}var f=this._ultron=new k(i),h=!1,c=this;i.setTimeout(0),i.setNoDelay(!0),this._receiver=new e(this.extensions,this.maxPayload),this._socket=i,f.on("end",b.bind(this)),f.on("close",b.bind(this)),f.on("error",b.bind(this)),f.on("data",a),r.nextTick(a),c._receiver.ontext=function(e,t){t=t||{},c.emit("message",e,t)},c._receiver.onbinary=function(e,t){t=t||{},t.binary=!0,c.emit("message",e,t)},c._receiver.onping=function(e,t){t=t||{},c.pong(e,{mask:!c._isServer,binary:t.binary===!0},!0),c.emit("ping",e,t)},c._receiver.onpong=function(e,t){c.emit("pong",e,t||{})},c._receiver.onclose=function(e,t,i){i=i||{},c._closeReceived=!0,c.close(e,t)},c._receiver.onerror=function(e,t){c.close("undefined"!=typeof t?t:1002,""),c.emit("error",e instanceof Error?e:new Error(e))},this._sender=new t(i,this.extensions),this._sender.on("error",function(e){c.close(1002,""),c.emit("error",e)}),this.readyState=n.OPEN,this.emit("open")}function u(e){e._queue=e._queue||[]}function d(e){var t=e._queue;if("undefined"!=typeof t){delete e._queue;for(var i=0,r=t.length;i + * MIT Licensed + */ +var m=i(59),w=i(8),g=i(52),v=i(236),_=i(118),y=i(9),k=i(229),E=i(104),A=i(124),S=i(123),M=i(243),T=i(242),R=i(122),x=i(40),C=i(3).EventEmitter,I=13,P=3e4;w.inherits(n,C),["CONNECTING","OPEN","CLOSING","CLOSED"].forEach(function(e,t){n.prototype[e]=n[e]=t}),n.prototype.close=function(e,t){if(this.readyState!==n.CLOSED){if(this.readyState===n.CONNECTING)return void(this.readyState=n.CLOSED);if(this.readyState===n.CLOSING)return void(this._closeReceived&&this._isServer&&this.terminate());var i=this;try{this.readyState=n.CLOSING,this._closeCode=e,this._closeMessage=t;var r=!this._isServer;this._sender.close(e,t,r,function(e){e&&i.emit("error",e),i._closeReceived&&i._isServer?i.terminate():(clearTimeout(i._closeTimer),i._closeTimer=setTimeout(b.bind(i,!0),P))})}catch(e){this.emit("error",e)}}},n.prototype.pause=function(){if(this.readyState!==n.OPEN)throw new Error("not opened");return this._socket.pause()},n.prototype.ping=function(e,t,i){if(this.readyState!==n.OPEN){if(i===!0)return;throw new Error("not opened")}t=t||{},"undefined"==typeof t.mask&&(t.mask=!this._isServer),this._sender.ping(e,t)},n.prototype.pong=function(e,t,i){if(this.readyState!==n.OPEN){if(i===!0)return;throw new Error("not opened")}t=t||{},"undefined"==typeof t.mask&&(t.mask=!this._isServer),this._sender.pong(e,t)},n.prototype.resume=function(){if(this.readyState!==n.OPEN)throw new Error("not opened");return this._socket.resume()},n.prototype.send=function(e,i,s){if("function"==typeof i&&(s=i,i={}),this.readyState!==n.OPEN){if("function"!=typeof s)throw new Error("not opened");return void s(new Error("not opened"))}if(e||(e=""),this._queue){var a=this;return void this._queue.push(function(){a.send(e,i,s)})}i=i||{},i.fin=!0,"undefined"==typeof i.binary&&(i.binary=e instanceof ArrayBuffer||e instanceof t||e instanceof Uint8Array||e instanceof Uint16Array||e instanceof Uint32Array||e instanceof Int8Array||e instanceof Int16Array||e instanceof Int32Array||e instanceof Float32Array||e instanceof Float64Array),"undefined"==typeof i.mask&&(i.mask=!this._isServer),"undefined"==typeof i.compress&&(i.compress=!0),this.extensions[x.extensionName]||(i.compress=!1);var o="function"==typeof y.Readable?y.Readable:y.Stream;if(e instanceof o){u(this);var a=this;p(this,e,i,function(e){r.nextTick(function(){d(a)}),"function"==typeof s&&s(e)})}else this._sender.send(e,i,s)},n.prototype.stream=function(e,t){function i(a,o){try{if(s.readyState!==n.OPEN)throw new Error("not opened");e.fin=o===!0,s._sender.send(a,e),o?d(s):r.nextTick(t.bind(null,null,i))}catch(e){"function"==typeof t?t(e):(delete s._queue,s.emit("error",e))}}"function"==typeof e&&(t=e,e={});var s=this;if("function"!=typeof t)throw new Error("callback must be provided");if(this.readyState!==n.OPEN){if("function"!=typeof t)throw new Error("not opened");return void t(new Error("not opened"))}return this._queue?void this._queue.push(function(){s.stream(e,t)}):(e=e||{},"undefined"==typeof e.mask&&(e.mask=!this._isServer),"undefined"==typeof e.compress&&(e.compress=!0),this.extensions[x.extensionName]||(e.compress=!1),u(this),void r.nextTick(t.bind(null,null,i)))},n.prototype.terminate=function(){if(this.readyState!==n.CLOSED)if(this._socket){this.readyState=n.CLOSING;try{this._socket.end()}catch(e){return void b.call(this,!0)}this._closeTimer&&clearTimeout(this._closeTimer),this._closeTimer=setTimeout(b.bind(this,!0),P)}else this.readyState===n.CONNECTING&&b.call(this,!0)},Object.defineProperty(n.prototype,"bufferedAmount",{get:function(){var e=0;return this._socket&&(e=this._socket.bufferSize||0),e}}),Object.defineProperty(n.prototype,"binaryType",{get:function(){return this._binaryType},set:function(e){if("arraybuffer"!==e&&"nodebuffer"!==e)throw new SyntaxError('unsupported binaryType: must be either "nodebuffer" or "arraybuffer"');this._binaryType=e}}),["open","error","close","message"].forEach(function(e){Object.defineProperty(n.prototype,"on"+e,{get:function(){var t=this.listeners(e)[0];return t?t._listener?t._listener:t:void 0},set:function(t){this.removeAllListeners(e),this.addEventListener(e,t)}})}),n.prototype.addEventListener=function(e,t){function i(e,i){i.binary&&"arraybuffer"===this.binaryType&&(e=new Uint8Array(e).buffer),t.call(h,new s(e,!!i.binary,h))}function r(e,i){t.call(h,new a(e,i,h))}function n(e){e.type="error",e.target=h,t.call(h,e)}function f(){t.call(h,new o(h))}var h=this;"function"==typeof t&&("message"===e?(i._listener=t,this.on(e,i)):"close"===e?(r._listener=t,this.on(e,r)):"error"===e?(n._listener=t,this.on(e,n)):"open"===e?(f._listener=t,this.on(e,f)):this.on(e,t))},e.exports=n,e.exports.buildHostHeader=f}).call(t,i(0).Buffer,i(5))},function(e,t,i){(function(t){const r=i(14),n=i(10),s=i(57),a=i(2),o=i(131),f=i(11),h=i(44),c=i(43),l=i(20),u=i(30),d=i(21),p=i(45);class b{constructor(e){this.client=e}resolveUser(e){return e instanceof f?e:"string"==typeof e?this.client.users.get(e)||null:e instanceof u?e.user:e instanceof h?e.author:e instanceof c?e.owner:null}resolveUserID(e){return e instanceof f||e instanceof u?e.id:"string"==typeof e?e||null:e instanceof h?e.author.id:e instanceof c?e.ownerID:null}resolveGuild(e){return e instanceof c?e:"string"==typeof e?this.client.guilds.get(e)||null:null}resolveGuildMember(e,t){return t instanceof u?t:(e=this.resolveGuild(e),t=this.resolveUser(t),e&&t?e.members.get(t.id)||null:null)}resolveChannel(e){return e instanceof l?e:e instanceof h?e.channel:e instanceof c?e.channels.get(e.id)||null:"string"==typeof e?this.client.channels.get(e)||null:null}resolveInviteCode(e){const t=/discord(?:app)?\.(?:gg|com\/invite)\/([a-z0-9]{5})/i,i=t.exec(e);return i&&i[1]?i[1]:e}resolvePermission(e){if("string"==typeof e&&(e=a.PermissionFlags[e]),"number"!=typeof e||e<1)throw new Error(a.Errors.NOT_A_PERMISSION);return e}resolveString(e){return"string"==typeof e?e:e instanceof Array?e.join("\n"):String(e)}resolveBase64(e){return e instanceof t?`data:image/jpg;base64,${e.toString("base64")}`:e}resolveBuffer(e){return e instanceof t?Promise.resolve(e):this.client.browser&&e instanceof ArrayBuffer?Promise.resolve(o(e)):"string"==typeof e?new Promise((i,a)=>{if(/^https?:\/\//.test(e)){const r=s.get(e).set("Content-Type","blob");this.client.browser&&r.responseType("arraybuffer"),r.end((e,r)=>{return e?a(e):this.client.browser?i(o(r.xhr.response)):r.body instanceof t?i(r.body):a(new TypeError("Body is not a Buffer"))})}else{const t=r.resolve(e);n.stat(t,(e,r)=>{if(e&&a(e),!r||!r.isFile())throw new Error(`The file could not be found: ${t}`);n.readFile(t,(e,t)=>{e?a(e):i(t)})})}}):Promise.reject(new TypeError("The resource must be a string or Buffer."))}resolveEmojiIdentifier(e){return e instanceof d||e instanceof p?e.identifier:"string"!=typeof e||e.includes("%")?null:encodeURIComponent(e)}}e.exports=b}).call(t,i(0).Buffer)},function(e,t,i){const r=i(256),n=i(253),s=i(255),a=i(254),o=i(252),f=i(2);class h{constructor(e){this.client=e,this.handlers={},this.userAgentManager=new r(this),this.methods=new n(this),this.rateLimitedEndpoints={},this.globallyRateLimited=!1}push(e,t){return new Promise((i,r)=>{e.push({request:t,resolve:i,reject:r})})}getRequestHandler(){switch(this.client.options.apiRequestMethod){case"sequential":return s;case"burst":return a;default:throw new Error(f.Errors.INVALID_RATE_LIMIT_METHOD)}}makeRequest(e,t,i,r,n){const s=new o(this,e,t,i,r,n);if(!this.handlers[s.route]){const e=this.getRequestHandler();this.handlers[s.route]=new e(this,s.route)}return this.push(this.handlers[s.route],s)}}e.exports=h},function(e,t){class i{constructor(e){this.restManager=e,this.queue=[]}get globalLimit(){return this.restManager.globallyRateLimited}set globalLimit(e){this.restManager.globallyRateLimited=e}push(e){this.queue.push(e)}handle(){}}e.exports=i},function(e,t){class i{constructor(e){this.player=e}encode(e){return e}decode(e){return e}}e.exports=i},function(e,t){e.exports=function(e){const t=Object.create(e);return Object.assign(t,e),t}},function(e,t,i){(function(t){function i(e){const i=new t(e.byteLength),r=new Uint8Array(e);for(var n=0;n0&&this.setInterval(this.sweepMessages.bind(this),1e3*this.options.messageSweepInterval)}get status(){return this.ws.status}get uptime(){return this.readyAt?Date.now()-this.readyAt:null}get voiceConnections(){return this.voice.connections}get emojis(){const e=new Collection;for(const t of this.guilds.values())for(const i of t.emojis.values())e.set(i.id,i);return e}get readyTimestamp(){return this.readyAt?this.readyAt.getTime():null}login(e,t=null){return t?this.rest.methods.loginEmailPassword(e,t):this.rest.methods.loginToken(e)}destroy(){for(const e of this._timeouts)clearTimeout(e);for(const t of this._intervals)clearInterval(t);return this._timeouts.clear(),this._intervals.clear(),this.token=null,this.email=null,this.password=null,this.manager.destroy()}syncGuilds(e=this.guilds){this.user.bot||this.ws.send({op:12,d:e instanceof Collection?e.keyArray():e.map(e=>e.id)})}fetchUser(e){return this.users.has(e)?Promise.resolve(this.users.get(e)):this.rest.methods.getUser(e)}fetchInvite(e){const t=this.resolver.resolveInviteCode(e);return this.rest.methods.getInvite(t)}fetchWebhook(e,t){return this.rest.methods.getWebhook(e,t)}sweepMessages(e=this.options.messageCacheLifetime){if("number"!=typeof e||isNaN(e))throw new TypeError("The lifetime must be a number.");if(e<=0)return this.emit("debug","Didn't sweep messages - lifetime is unlimited"),-1;const t=1e3*e,i=Date.now();let r=0,n=0;for(const s of this.channels.values())if(s.messages){r++;for(const e of s.messages.values())i-(e.editedTimestamp||e.createdTimestamp)>t&&(s.messages.delete(e.id),n++)}return this.emit("debug",`Swept ${n} messages older than ${e} seconds in ${r} text-based channels`),n}fetchApplication(){if(!this.user.bot)throw new Error(Constants.Errors.NO_BOT_ACCOUNT);return this.rest.methods.getMyApplication()}setTimeout(e,t,...i){const r=setTimeout(()=>{e(),this._timeouts.delete(r)},t,...i);return this._timeouts.add(r),r}clearTimeout(e){clearTimeout(e),this._timeouts.delete(e)}setInterval(e,t,...i){const r=setInterval(e,t,...i);return this._intervals.add(r),r}clearInterval(e){clearInterval(e),this._intervals.delete(e)}_setPresence(e,t){return this.presences.get(e)?void this.presences.get(e).update(t):void this.presences.set(e,new Presence(t))}_eval(script){return eval(script)}_validateOptions(e=this.options){if("number"!=typeof e.shardCount||isNaN(e.shardCount))throw new TypeError("The shardCount option must be a number.");if("number"!=typeof e.shardId||isNaN(e.shardId))throw new TypeError("The shardId option must be a number.");if(e.shardCount<0)throw new RangeError("The shardCount option must be at least 0.");if(e.shardId<0)throw new RangeError("The shardId option must be at least 0.");if(0!==e.shardId&&e.shardId>=e.shardCount)throw new RangeError("The shardId option must be less than shardCount.");if("number"!=typeof e.messageCacheMaxSize||isNaN(e.messageCacheMaxSize))throw new TypeError("The messageCacheMaxSize option must be a number.");if("number"!=typeof e.messageCacheLifetime||isNaN(e.messageCacheLifetime))throw new TypeError("The messageCacheLifetime option must be a number.");if("number"!=typeof e.messageSweepInterval||isNaN(e.messageSweepInterval))throw new TypeError("The messageSweepInterval option must be a number.");if("boolean"!=typeof e.fetchAllMembers)throw new TypeError("The fetchAllMembers option must be a boolean.");if("boolean"!=typeof e.disableEveryone)throw new TypeError("The disableEveryone option must be a boolean.");if("number"!=typeof e.restWsBridgeTimeout||isNaN(e.restWsBridgeTimeout))throw new TypeError("The restWsBridgeTimeout option must be a number.");if(!(e.disabledEvents instanceof Array))throw new TypeError("The disabledEvents option must be an Array.")}}module.exports=Client}).call(exports,__webpack_require__(5))},function(e,t,i){const r=i(46),n=i(127),s=i(126),a=i(41),o=i(2);class f extends r{constructor(e,t,i){super(null,e,t),this.options=a(o.DefaultOptions,i),this.rest=new n(this),this.resolver=new s(this)}}e.exports=f},function(e,t,i){(function(t){const r=i(14),n=i(10),s=i(3).EventEmitter,a=i(41),o=i(62),f=i(6),h=i(78);class c extends s{constructor(e,i={}){if(super(),i=a({totalShards:"auto",respawn:!0,shardArgs:[],token:null},i),this.file=e,!e)throw new Error("File must be specified.");r.isAbsolute(e)||(this.file=r.resolve(t.cwd(),e));const s=n.statSync(this.file);if(!s.isFile())throw new Error("File path does not point to a file.");if(this.totalShards=i.totalShards,"auto"!==this.totalShards){if("number"!=typeof this.totalShards||isNaN(this.totalShards))throw new TypeError("Amount of shards must be a number.");if(this.totalShards<1)throw new RangeError("Amount of shards must be at least 1.");if(this.totalShards!==Math.floor(this.totalShards))throw new RangeError("Amount of shards must be an integer.")}this.respawn=i.respawn,this.shardArgs=i.shardArgs,this.token=i.token?i.token.replace(/^Bot\s*/i,""):null,this.shards=new f}createShard(e=this.shards.size){const t=new o(this,e,this.shardArgs);return this.shards.set(e,t),this.emit("launch",t),Promise.resolve(t)}spawn(e=this.totalShards,t=5500){if("auto"===e)return h(this.token).then(e=>{return this.totalShards=e,this._spawn(e,t)});if("number"!=typeof e||isNaN(e))throw new TypeError("Amount of shards must be a number.");if(e<1)throw new RangeError("Amount of shards must be at least 1.");if(e!==Math.floor(e))throw new TypeError("Amount of shards must be an integer.");return this._spawn(e,t)}_spawn(e,t){return new Promise(i=>{if(this.shards.size>=e)throw new Error(`Already spawned ${this.shards.size} shards.`);if(this.totalShards=e,this.createShard(),this.shards.size>=this.totalShards)return void i(this.shards);if(t<=0){for(;this.shards.size{this.createShard(),this.shards.size>=this.totalShards&&(clearInterval(e),i(this.shards))},t)}})}broadcast(e){const t=[];for(const i of this.shards.values())t.push(i.send(e));return Promise.all(t)}broadcastEval(e){const t=[];for(const i of this.shards.values())t.push(i.eval(e));return Promise.all(t)}fetchClientValues(e){if(0===this.shards.size)return Promise.reject(new Error("No shards have been spawned."));if(this.shards.size!==this.totalShards)return Promise.reject(new Error("Still spawning shards."));const t=[];for(const i of this.shards.values())t.push(i.fetchClientValue(e));return Promise.all(t)}}e.exports=c}).call(t,i(5))},function(e,t,i){const r=i(11),n=i(6);class s extends r{setup(e){super.setup(e),this.verified=e.verified,this.email=e.email,this.localPresence={},this._typing=new Map,this.friends=new n,this.blocked=new n,this.notes=new n}edit(e){return this.client.rest.methods.updateCurrentUser(e)}setUsername(e){return this.client.rest.methods.updateCurrentUser({username:e})}setEmail(e){return this.client.rest.methods.updateCurrentUser({email:e})}setPassword(e){return this.client.rest.methods.updateCurrentUser({password:e})}setAvatar(e){return e.startsWith("data:")?this.client.rest.methods.updateCurrentUser({avatar:e}):this.client.resolver.resolveBuffer(e).then(e=>this.client.rest.methods.updateCurrentUser({avatar:e}))}setStatus(e){return this.setPresence({status:e})}setGame(e,t){return this.setPresence({game:{name:e,url:t}})}setAFK(e){return this.setPresence({afk:e})}addFriend(e){return e=this.client.resolver.resolveUser(e),this.client.rest.methods.addFriend(e)}removeFriend(e){return e=this.client.resolver.resolveUser(e),this.client.rest.methods.removeFriend(e)}createGuild(e,t,i=null){return i?i.startsWith("data:")?this.client.rest.methods.createGuild({name:e,icon:i,region:t}):this.client.resolver.resolveBuffer(i).then(i=>this.client.rest.methods.createGuild({name:e,icon:i,region:t})):this.client.rest.methods.createGuild({name:e,icon:i,region:t})}setPresence(e){return new Promise(t=>{let i=this.localPresence.status||this.presence.status,r=this.localPresence.game,n=this.localPresence.afk||this.presence.afk;if(!r&&this.presence.game&&(r={name:this.presence.game.name,type:this.presence.game.type,url:this.presence.game.url}),e.status){if("string"!=typeof e.status)throw new TypeError("Status must be a string");i=e.status}e.game&&(r=e.game,r.url&&(r.type=1)),"undefined"!=typeof e.afk&&(n=e.afk),n=Boolean(n),this.localPresence={status:i,game:r,afk:n},this.localPresence.since=0,this.localPresence.game=this.localPresence.game||null,this.client.ws.send({op:3,d:this.localPresence}),this.client._setPresence(this.id,this.localPresence),t(this)})}}e.exports=s},function(e,t,i){!function(){function e(e){this.message=e}var i=t,r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";e.prototype=new Error,e.prototype.name="InvalidCharacterError",i.btoa||(i.btoa=function(t){for(var i,n,s=0,a=r,o="";t.charAt(0|s)||(a="=",s%1);o+=a.charAt(63&i>>8-s%1*8)){if(n=t.charCodeAt(s+=.75),n>255)throw new e("'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.");i=i<<8|n}return o}),i.atob||(i.atob=function(t){if(t=t.replace(/=+$/,""),t.length%4==1)throw new e("'atob' failed: The string to be decoded is not correctly encoded.");for(var i,n,s=0,a=0,o="";n=t.charAt(a++);~n&&(i=s%4?64*i+n:n,s++%4)?o+=String.fromCharCode(255&i>>(-2*s&6)):0)n=r.indexOf(n);return o})}()},function(e,t,i){function r(e,t){this.name=e,this.body=t,this.decoders={},this.encoders={}}var n=i(32),s=i(1),a=t;a.define=function(e,t){return new r(e,t)},r.prototype._createNamed=function(e){var t;try{t=i(235).runInThisContext("(function "+this.name+"(entity) {\n this._initNamed(entity);\n})")}catch(e){t=function(e){this._initNamed(e)}}return s(t,e),t.prototype._initNamed=function(t){e.call(this,t)},new t(this)},r.prototype._getDecoder=function(e){return e=e||"der",this.decoders.hasOwnProperty(e)||(this.decoders[e]=this._createNamed(n.decoders[e])),this.decoders[e]},r.prototype.decode=function(e,t,i){return this._getDecoder(t).decode(e,i)},r.prototype._getEncoder=function(e){return e=e||"der",this.encoders.hasOwnProperty(e)||(this.encoders[e]=this._createNamed(n.encoders[e])),this.encoders[e]},r.prototype.encode=function(e,t,i){return this._getEncoder(t).encode(e,i)}},function(e,t,i){function r(e,t){var i={};this._baseState=i,i.enc=e,i.parent=t||null,i.children=null,i.tag=null,i.args=null,i.reverseArgs=null,i.choice=null,i.optional=!1,i.any=!1,i.obj=!1,i.use=null,i.useDecoder=null,i.key=null,i.default=null,i.explicit=null,i.implicit=null,i.contains=null,i.parent||(i.children=[],this._wrap())}var n=i(23).Reporter,s=i(23).EncoderBuffer,a=i(23).DecoderBuffer,o=i(26),f=["seq","seqof","set","setof","objid","bool","gentime","utctime","null_","enum","int","objDesc","bitstr","bmpstr","charstr","genstr","graphstr","ia5str","iso646str","numstr","octstr","printstr","t61str","unistr","utf8str","videostr"],h=["key","obj","use","optional","explicit","implicit","def","choice","any","contains"].concat(f),c=["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"];e.exports=r;var l=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];r.prototype.clone=function(){var e=this._baseState,t={};l.forEach(function(i){t[i]=e[i]});var i=new this.constructor(t.parent);return i._baseState=t,i},r.prototype._wrap=function(){var e=this._baseState;h.forEach(function(t){this[t]=function(){var i=new this.constructor(this);return e.children.push(i),i[t].apply(i,arguments)}},this)},r.prototype._init=function(e){var t=this._baseState;o(null===t.parent),e.call(this),t.children=t.children.filter(function(e){return e._baseState.parent===this},this),o.equal(t.children.length,1,"Root node can have only one child")},r.prototype._useArgs=function(e){var t=this._baseState,i=e.filter(function(e){return e instanceof this.constructor},this);e=e.filter(function(e){return!(e instanceof this.constructor)},this),0!==i.length&&(o(null===t.children),t.children=i,i.forEach(function(e){e._baseState.parent=this},this)),0!==e.length&&(o(null===t.args),t.args=e,t.reverseArgs=e.map(function(e){if("object"!=typeof e||e.constructor!==Object)return e;var t={};return Object.keys(e).forEach(function(i){i==(0|i)&&(i|=0);var r=e[i];t[r]=i}),t}))},c.forEach(function(e){r.prototype[e]=function(){var t=this._baseState;throw new Error(e+" not implemented for encoding: "+t.enc)}}),f.forEach(function(e){r.prototype[e]=function(){var t=this._baseState,i=Array.prototype.slice.call(arguments);return o(null===t.tag),t.tag=e,this._useArgs(i),this}}),r.prototype.use=function(e){o(e);var t=this._baseState;return o(null===t.use),t.use=e,this},r.prototype.optional=function(){var e=this._baseState;return e.optional=!0,this},r.prototype.def=function(e){var t=this._baseState;return o(null===t.default),t.default=e,t.optional=!0,this},r.prototype.explicit=function(e){var t=this._baseState;return o(null===t.explicit&&null===t.implicit),t.explicit=e,this},r.prototype.implicit=function(e){var t=this._baseState;return o(null===t.explicit&&null===t.implicit),t.implicit=e,this},r.prototype.obj=function(){var e=this._baseState,t=Array.prototype.slice.call(arguments);return e.obj=!0,0!==t.length&&this._useArgs(t),this},r.prototype.key=function(e){var t=this._baseState;return o(null===t.key),t.key=e,this},r.prototype.any=function(){var e=this._baseState;return e.any=!0,this},r.prototype.choice=function(e){var t=this._baseState;return o(null===t.choice),t.choice=e,this._useArgs(Object.keys(e).map(function(t){return e[t]})),this},r.prototype.contains=function(e){var t=this._baseState;return o(null===t.use),t.contains=e,this},r.prototype._decode=function(e,t){var i=this._baseState;if(null===i.parent)return e.wrapResult(i.children[0]._decode(e,t));var r=i.default,n=!0,s=null;if(null!==i.key&&(s=e.enterKey(i.key)),i.optional){var o=null;if(null!==i.explicit?o=i.explicit:null!==i.implicit?o=i.implicit:null!==i.tag&&(o=i.tag),null!==o||i.any){if(n=this._peekTag(e,o,i.any),e.isError(n))return n}else{var f=e.save();try{null===i.choice?this._decodeGeneric(i.tag,e,t):this._decodeChoice(e,t),n=!0}catch(e){n=!1}e.restore(f)}}var h;if(i.obj&&n&&(h=e.enterObject()),n){if(null!==i.explicit){var c=this._decodeTag(e,i.explicit);if(e.isError(c))return c;e=c}var l=e.offset;if(null===i.use&&null===i.choice){if(i.any)var f=e.save();var u=this._decodeTag(e,null!==i.implicit?i.implicit:i.tag,i.any);if(e.isError(u))return u;i.any?r=e.raw(f):e=u}if(t&&t.track&&null!==i.tag&&t.track(e.path(),l,e.length,"tagged"),t&&t.track&&null!==i.tag&&t.track(e.path(),e.offset,e.length,"content"),r=i.any?r:null===i.choice?this._decodeGeneric(i.tag,e,t):this._decodeChoice(e,t),e.isError(r))return r;if(i.any||null!==i.choice||null===i.children||i.children.forEach(function(i){i._decode(e,t)}),i.contains&&("octstr"===i.tag||"bitstr"===i.tag)){var d=new a(r);r=this._getUse(i.contains,e._reporterState.obj)._decode(d,t)}}return i.obj&&n&&(r=e.leaveObject(h)),null===i.key||null===r&&n!==!0?null!==s&&e.exitKey(s):e.leaveKey(s,i.key,r),r},r.prototype._decodeGeneric=function(e,t,i){var r=this._baseState;return"seq"===e||"set"===e?null:"seqof"===e||"setof"===e?this._decodeList(t,e,r.args[0],i):/str$/.test(e)?this._decodeStr(t,e,i):"objid"===e&&r.args?this._decodeObjid(t,r.args[0],r.args[1],i):"objid"===e?this._decodeObjid(t,null,null,i):"gentime"===e||"utctime"===e?this._decodeTime(t,e,i):"null_"===e?this._decodeNull(t,i):"bool"===e?this._decodeBool(t,i):"objDesc"===e?this._decodeStr(t,e,i):"int"===e||"enum"===e?this._decodeInt(t,r.args&&r.args[0],i):null!==r.use?this._getUse(r.use,t._reporterState.obj)._decode(t,i):t.error("unknown tag: "+e)},r.prototype._getUse=function(e,t){var i=this._baseState;return i.useDecoder=this._use(e,t),o(null===i.useDecoder._baseState.parent),i.useDecoder=i.useDecoder._baseState.children[0],i.implicit!==i.useDecoder._baseState.implicit&&(i.useDecoder=i.useDecoder.clone(),i.useDecoder._baseState.implicit=i.implicit),i.useDecoder},r.prototype._decodeChoice=function(e,t){var i=this._baseState,r=null,n=!1;return Object.keys(i.choice).some(function(s){var a=e.save(),o=i.choice[s];try{var f=o._decode(e,t);if(e.isError(f))return!1;r={type:s,value:f},n=!0}catch(t){return e.restore(a),!1}return!0},this),n?r:e.error("Choice not matched")},r.prototype._createEncoderBuffer=function(e){return new s(e,this.reporter)},r.prototype._encode=function(e,t,i){var r=this._baseState;if(null===r.default||r.default!==e){var n=this._encodeValue(e,t,i);if(void 0!==n&&!this._skipDefault(n,t,i))return n}},r.prototype._encodeValue=function(e,t,i){var r=this._baseState;if(null===r.parent)return r.children[0]._encode(e,t||new n);var s=null;if(this.reporter=t,r.optional&&void 0===e){if(null===r.default)return;e=r.default}var a=null,o=!1;if(r.any)s=this._createEncoderBuffer(e);else if(r.choice)s=this._encodeChoice(e,t);else if(r.contains)a=this._getUse(r.contains,i)._encode(e,t),o=!0;else if(r.children)a=r.children.map(function(i){if("null_"===i._baseState.tag)return i._encode(null,t,e);if(null===i._baseState.key)return t.error("Child should have a key");var r=t.enterKey(i._baseState.key);if("object"!=typeof e)return t.error("Child expected, but input is not object");var n=i._encode(e[i._baseState.key],t,e);return t.leaveKey(r),n},this).filter(function(e){return e}),a=this._createEncoderBuffer(a);else if("seqof"===r.tag||"setof"===r.tag){if(!r.args||1!==r.args.length)return t.error("Too many args for : "+r.tag);if(!Array.isArray(e))return t.error("seqof/setof, but data is not Array");var f=this.clone();f._baseState.implicit=null,a=this._createEncoderBuffer(e.map(function(i){var r=this._baseState;return this._getUse(r.args[0],e)._encode(i,t)},f))}else null!==r.use?s=this._getUse(r.use,i)._encode(e,t):(a=this._encodePrimitive(r.tag,e),o=!0);var s;if(!r.any&&null===r.choice){var h=null!==r.implicit?r.implicit:r.tag,c=null===r.implicit?"universal":"context";null===h?null===r.use&&t.error("Tag could be ommited only for .use()"):null===r.use&&(s=this._encodeComposite(h,o,c,a))}return null!==r.explicit&&(s=this._encodeComposite(r.explicit,!1,"context",s)),s},r.prototype._encodeChoice=function(e,t){var i=this._baseState,r=i.choice[e.type];return r||o(!1,e.type+" not found in "+JSON.stringify(Object.keys(i.choice))),r._encode(e.value,t)},r.prototype._encodePrimitive=function(e,t){var i=this._baseState;if(/str$/.test(e))return this._encodeStr(t,e);if("objid"===e&&i.args)return this._encodeObjid(t,i.reverseArgs[0],i.args[1]);if("objid"===e)return this._encodeObjid(t,null,null);if("gentime"===e||"utctime"===e)return this._encodeTime(t,e);if("null_"===e)return this._encodeNull();if("int"===e||"enum"===e)return this._encodeInt(t,i.args&&i.reverseArgs[0]);if("bool"===e)return this._encodeBool(t);if("objDesc"===e)return this._encodeStr(t,e);throw new Error("Unsupported tag: "+e)},r.prototype._isNumstr=function(e){return/^[0-9 ]*$/.test(e)},r.prototype._isPrintstr=function(e){return/^[A-Za-z0-9 '\(\)\+,\-\.\/:=\?]*$/.test(e)}},function(e,t,i){function r(e){this._reporterState={obj:null,path:[],options:e||{},errors:[]}}function n(e,t){this.path=e,this.rethrow(t)}var s=i(1);t.Reporter=r,r.prototype.isError=function(e){return e instanceof n},r.prototype.save=function(){var e=this._reporterState;return{obj:e.obj,pathLen:e.path.length}},r.prototype.restore=function(e){var t=this._reporterState;t.obj=e.obj,t.path=t.path.slice(0,e.pathLen)},r.prototype.enterKey=function(e){return this._reporterState.path.push(e)},r.prototype.exitKey=function(e){var t=this._reporterState;t.path=t.path.slice(0,e-1)},r.prototype.leaveKey=function(e,t,i){var r=this._reporterState;this.exitKey(e),null!==r.obj&&(r.obj[t]=i)},r.prototype.path=function(){return this._reporterState.path.join("/")},r.prototype.enterObject=function(){var e=this._reporterState,t=e.obj;return e.obj={},t},r.prototype.leaveObject=function(e){var t=this._reporterState,i=t.obj;return t.obj=e,i},r.prototype.error=function(e){var t,i=this._reporterState,r=e instanceof n;if(t=r?e:new n(i.path.map(function(e){return"["+JSON.stringify(e)+"]"}).join(""),e.message||e,e.stack),!i.options.partial)throw t;return r||i.errors.push(t),t},r.prototype.wrapResult=function(e){var t=this._reporterState;return t.options.partial?{result:this.isError(e)?null:e,errors:t.errors}:e},s(n,Error),n.prototype.rethrow=function(e){if(this.message=e+" at: "+(this.path||"(shallow)"),Error.captureStackTrace&&Error.captureStackTrace(this,n),!this.stack)try{throw new Error(this.message)}catch(e){this.stack=e.stack}return this}},function(e,t,i){var r=i(81);t.tagClass={0:"universal",1:"application",2:"context",3:"private"},t.tagClassByName=r._reverse(t.tagClass),t.tag={0:"end",1:"bool",2:"int",3:"bitstr",4:"octstr",5:"null_",6:"objid",7:"objDesc",8:"external",9:"real",10:"enum",11:"embed",12:"utf8str",13:"relativeOid",16:"seq",17:"set",18:"numstr",19:"printstr",20:"t61str",21:"videostr",22:"ia5str",23:"utctime",24:"gentime",25:"graphstr",26:"iso646str",27:"genstr",28:"unistr",29:"charstr",30:"bmpstr"},t.tagByName=r._reverse(t.tag)},function(e,t,i){var r=t;r.der=i(82),r.pem=i(144)},function(e,t,i){function r(e){a.call(this,e),this.enc="pem"}var n=i(1),s=i(0).Buffer,a=i(82);n(r,a),e.exports=r,r.prototype.decode=function(e,t){for(var i=e.toString().split(/[\r\n]+/g),r=t.label.toUpperCase(),n=/^-----(BEGIN|END) ([^-]+)-----$/,o=-1,f=-1,h=0;h + * @license MIT + */ +function r(e,t){if(e===t)return 0;for(var i=e.length,r=t.length,n=0,s=Math.min(i,r);n=0;o--)if(f[o]!==h[o])return!1;for(o=f.length-1;o>=0;o--)if(a=f[o],!d(e[a],t[a],i,r))return!1;return!0}function m(e,t,i){d(e,t,!0)&&l(e,t,i,"notDeepStrictEqual",m)}function w(e,t){if(!e||!t)return!1;if("[object RegExp]"==Object.prototype.toString.call(t))return t.test(e);try{if(e instanceof t)return!0}catch(e){}return!Error.isPrototypeOf(t)&&t.call({},e)===!0}function g(e){var t;try{e()}catch(e){t=e}return t}function v(e,t,i,r){var n;if("function"!=typeof t)throw new TypeError('"block" argument must be a function');"string"==typeof i&&(r=i,i=null),n=g(t),r=(i&&i.name?" ("+i.name+").":".")+(r?" "+r:"."),e&&!n&&l(n,i,"Missing expected exception"+r);var s="string"==typeof r,a=!e&&_.isError(n),o=!e&&n&&!i;if((a&&s&&w(n,i)||o)&&l(n,i,"Got unwanted exception"+r),e&&n&&i&&!w(n,i)||!e&&n)throw n}var _=i(8),y=Object.prototype.hasOwnProperty,k=Array.prototype.slice,E=function(){return"foo"===function(){}.name}(),A=e.exports=u,S=/\s*function\s+([^\(\s]*)\s*/;A.AssertionError=function(e){this.name="AssertionError",this.actual=e.actual,this.expected=e.expected,this.operator=e.operator,e.message?(this.message=e.message,this.generatedMessage=!1):(this.message=c(this),this.generatedMessage=!0);var t=e.stackStartFunction||l;if(Error.captureStackTrace)Error.captureStackTrace(this,t);else{var i=new Error;if(i.stack){var r=i.stack,n=o(t),s=r.indexOf("\n"+n);if(s>=0){var a=r.indexOf("\n",s+1);r=r.substring(a+1)}this.stack=r}}},_.inherits(A.AssertionError,Error),A.fail=l,A.ok=u,A.equal=function(e,t,i){e!=t&&l(e,t,i,"==",A.equal)},A.notEqual=function(e,t,i){e==t&&l(e,t,i,"!=",A.notEqual)},A.deepEqual=function(e,t,i){d(e,t,!1)||l(e,t,i,"deepEqual",A.deepEqual)},A.deepStrictEqual=function(e,t,i){d(e,t,!0)||l(e,t,i,"deepStrictEqual",A.deepStrictEqual)},A.notDeepEqual=function(e,t,i){d(e,t,!1)&&l(e,t,i,"notDeepEqual",A.notDeepEqual)},A.notDeepStrictEqual=m,A.strictEqual=function(e,t,i){e!==t&&l(e,t,i,"===",A.strictEqual)},A.notStrictEqual=function(e,t,i){e===t&&l(e,t,i,"!==",A.notStrictEqual)},A.throws=function(e,t,i){v(!0,e,t,i)},A.doesNotThrow=function(e,t,i){v(!1,e,t,i)},A.ifError=function(e){if(e)throw e};var M=Object.keys||function(e){var t=[];for(var i in e)y.call(e,i)&&t.push(i);return t}}).call(t,i(16))},function(e,t){"use strict";function i(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===e[t-2]?2:"="===e[t-1]?1:0}function r(e){return 3*e.length/4-i(e)}function n(e){var t,r,n,s,a,o,f=e.length;a=i(e),o=new c(3*f/4-a),n=a>0?f-4:f;var l=0;for(t=0,r=0;t>16&255,o[l++]=s>>8&255,o[l++]=255&s;return 2===a?(s=h[e.charCodeAt(t)]<<2|h[e.charCodeAt(t+1)]>>4,o[l++]=255&s):1===a&&(s=h[e.charCodeAt(t)]<<10|h[e.charCodeAt(t+1)]<<4|h[e.charCodeAt(t+2)]>>2,o[l++]=s>>8&255,o[l++]=255&s),o}function s(e){return f[e>>18&63]+f[e>>12&63]+f[e>>6&63]+f[63&e]}function a(e,t,i){for(var r,n=[],a=t;ac?c:h+o));return 1===r?(t=e[i-1],n+=f[t>>2],n+=f[t<<4&63],n+="=="):2===r&&(t=(e[i-2]<<8)+e[i-1],n+=f[t>>10],n+=f[t>>4&63],n+=f[t<<2&63],n+="="),s.push(n),s.join("")}t.byteLength=r,t.toByteArray=n,t.fromByteArray=o;for(var f=[],h=[],c="undefined"!=typeof Uint8Array?Uint8Array:Array,l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",u=0,d=l.length;u16)return t=this.cache.slice(0,16),this.cache=this.cache.slice(16),t}else if(this.cache.length>=16)return t=this.cache.slice(0,16),this.cache=this.cache.slice(16),t;return null},n.prototype.flush=function(){if(this.cache.length)return this.cache};var b={ECB:i(92),CBC:i(88),CFB:i(89),CFB8:i(91),CFB1:i(90),OFB:i(93),CTR:i(35),GCM:i(35)};t.createDecipher=o,t.createDecipheriv=a}).call(t,i(0).Buffer)},function(e,t,i){(function(e){function r(t,i,s){return this instanceof r?(f.call(this),this._cache=new n,this._cipher=new o.AES(i),this._prev=new e(s.length),s.copy(this._prev),this._mode=t,void(this._autopadding=!0)):new r(t,i,s)}function n(){return this instanceof n?void(this.cache=new e("")):new n}function s(t,i,n){var s=c[t.toLowerCase()];if(!s)throw new TypeError("invalid suite type");if("string"==typeof n&&(n=new e(n)),"string"==typeof i&&(i=new e(i)),i.length!==s.key/8)throw new TypeError("invalid key length "+i.length);if(n.length!==s.iv)throw new TypeError("invalid iv length "+n.length);return"stream"===s.type?new u(p[s.mode],i,n):"auth"===s.type?new d(p[s.mode],i,n):new r(p[s.mode],i,n)}function a(e,t){var i=c[e.toLowerCase()];if(!i)throw new TypeError("invalid suite type");var r=l(t,!1,i.key,i.iv);return s(e,r.key,r.iv)}var o=i(33),f=i(17),h=i(1),c=i(34),l=i(37),u=i(94),d=i(87);h(r,f),r.prototype._update=function(t){this._cache.add(t);for(var i,r,n=[];i=this._cache.get();)r=this._mode.encrypt(this,i),n.push(r);return e.concat(n)},r.prototype._final=function(){var e=this._cache.flush();if(this._autopadding)return e=this._mode.encrypt(this,e),this._cipher.scrub(),e;if("10101010101010101010101010101010"!==e.toString("hex"))throw this._cipher.scrub(),new Error("data not multiple of block length")},r.prototype.setAutoPadding=function(e){return this._autopadding=!!e,this},n.prototype.add=function(t){this.cache=e.concat([this.cache,t])},n.prototype.get=function(){if(this.cache.length>15){var e=this.cache.slice(0,16);return this.cache=this.cache.slice(16),e}return null},n.prototype.flush=function(){for(var t=16-this.cache.length,i=new e(t),r=-1;++rf||e<0?(i=Math.abs(e)%f,e<0?f-i:i):e}function a(e,t){return[e[0]^t[0],e[1]^t[1],e[2]^t[2],e[3]^t[3]]}var o=new t(16);o.fill(0),e.exports=i,i.prototype.ghash=function(e){for(var t=-1;++t0;e--)s[e]=s[e]>>>1|(1&s[e-1])<<31;s[0]=s[0]>>>1,i&&(s[0]=s[0]^225<<24)}this.state=n(o)},i.prototype.update=function(e){this.cache=t.concat([this.cache,e]);for(var i;this.cache.length>=16;)i=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(i)},i.prototype.final=function(e,i){return this.cache.length&&this.ghash(t.concat([this.cache,o],16)),this.ghash(n([0,e,0,i])),this.state};var f=Math.pow(2,32)}).call(t,i(0).Buffer)},function(e,t,i){function r(e,t){var i,r;if(e=e.toLowerCase(),u[e])i=u[e].key,r=u[e].iv;else{if(!l[e])throw new TypeError("invalid suite type");i=8*l[e].key,r=l[e].iv}var n=f(t,!1,i,r);return s(e,n.key,n.iv)}function n(e,t){var i,r;if(e=e.toLowerCase(),u[e])i=u[e].key,r=u[e].iv;else{if(!l[e])throw new TypeError("invalid suite type");i=8*l[e].key,r=l[e].iv}var n=f(t,!1,i,r);return a(e,n.key,n.iv)}function s(e,t,i){if(e=e.toLowerCase(),u[e])return h.createCipheriv(e,t,i);if(l[e])return new c({key:t,iv:i,mode:e});throw new TypeError("invalid suite type")}function a(e,t,i){if(e=e.toLowerCase(),u[e])return h.createDecipheriv(e,t,i);if(l[e])return new c({key:t,iv:i,mode:e,decrypt:!0});throw new TypeError("invalid suite type")}function o(){return Object.keys(l).concat(h.getCiphers())}var f=i(37),h=i(47),c=i(153),l=i(154),u=i(34);t.createCipher=t.Cipher=r,t.createCipheriv=t.Cipheriv=s,t.createDecipher=t.Decipher=n,t.createDecipheriv=t.Decipheriv=a,t.listCiphers=t.getCiphers=o},function(e,t,i){(function(t){function r(e){n.call(this);var i,r=e.mode.toLowerCase(),s=o[r];i=e.decrypt?"decrypt":"encrypt";var a=e.key;"des-ede"!==r&&"des-ede-cbc"!==r||(a=t.concat([a,a.slice(0,8)]));var f=e.iv;this._des=s.create({key:a,iv:f,type:i})}var n=i(17),s=i(51),a=i(1),o={"des-ede3-cbc":s.CBC.instantiate(s.EDE),"des-ede3":s.EDE,"des-ede-cbc":s.CBC.instantiate(s.EDE),"des-ede":s.EDE,"des-cbc":s.CBC.instantiate(s.DES),"des-ecb":s.DES};o.des=o["des-cbc"],o.des3=o["des-ede3-cbc"],e.exports=r,a(r,n),r.prototype._update=function(e){return new t(this._des.update(e))},r.prototype._final=function(){return new t(this._des.final())}}).call(t,i(0).Buffer)},function(e,t){t["des-ecb"]={key:8,iv:0},t["des-cbc"]=t.des={key:8,iv:8},t["des-ede3-cbc"]=t.des3={key:24,iv:8},t["des-ede3"]={key:24,iv:0},t["des-ede-cbc"]={key:16,iv:8},t["des-ede"]={key:16,iv:0}},function(e,t,i){(function(t){function r(e){l.Writable.call(this);var t=d[e];if(!t)throw new Error("Unknown message digest");this._hashType=t.hash,this._hash=f(t.hash),this._tag=t.id,this._signType=t.sign}function n(e){l.Writable.call(this);var t=d[e];if(!t)throw new Error("Unknown message digest");this._hash=f(t.hash),this._tag=t.id,this._signType=t.sign}function s(e){return new r(e)}function a(e){return new n(e)}var o=i(95),f=i(18),h=i(1),c=i(156),l=i(9),u=i(157),d={};Object.keys(o).forEach(function(e){d[e]=d[e.toLowerCase()]=o[e]}),h(r,l.Writable),r.prototype._write=function(e,t,i){this._hash.update(e),i()},r.prototype.update=function(e,i){return"string"==typeof e&&(e=new t(e,i)),this._hash.update(e),this},r.prototype.sign=function(e,i){this.end();var r=this._hash.digest(),n=c(t.concat([this._tag,r]),e,this._hashType,this._signType);return i?n.toString(i):n},h(n,l.Writable),n.prototype._write=function(e,t,i){this._hash.update(e),i()},n.prototype.update=function(e,i){return"string"==typeof e&&(e=new t(e,i)),this._hash.update(e),this},n.prototype.verify=function(e,i,r){"string"==typeof i&&(i=new t(i,r)),this.end();var n=this._hash.digest();return u(i,t.concat([this._tag,n]),e,this._signType)},e.exports={Sign:s,Verify:a,createSign:s,createVerify:a}}).call(t,i(0).Buffer)},function(e,t,i){(function(t){function r(e,t,i,r){var a=m(t);if(a.curve){if("ecdsa"!==r)throw new Error("wrong private key type");return n(e,a)}if("dsa"===a.type){if("dsa"!==r)throw new Error("wrong private key type");return s(e,a,i)}if("rsa"!==r)throw new Error("wrong private key type");for(var o=a.modulus.byteLength(),f=[0,1];e.length+f.length+10&&i.ishrn(r),i}function h(e,i){e=f(e,i),e=e.mod(i);var r=new t(e.toArray());if(r.length=t)throw new Error("invalid sig")}var o=i(96),f=i(7),h=i(39),c=i(4),l=f.ec;e.exports=r}).call(t,i(0).Buffer)},function(e,t,i){(function(e,r){function n(e){if(et.UNZIP)throw new TypeError("Bad argument");this.mode=e,this.init_done=!1,this.write_in_progress=!1,this.pending_close=!1,this.windowBits=0,this.level=0,this.memLevel=0,this.strategy=0,this.dictionary=null}function s(e,t){for(var i=0;i + * MIT Licensed + */ +e.exports.BufferUtil={merge:function(e,t){for(var i=0,r=0,n=t.length;i>>5]|=e[i]<<24-r%32;return t}function r(e){for(var t=[],i=0;i<32*e.length;i+=8)t.push(e[i>>>5]>>>24-i%32&255);return t}function n(e,t,i){for(var r=0;r<16;r++){var n=i+r,l=t[n];t[n]=16711935&(l<<8|l>>>24)|4278255360&(l<<24|l>>>8)}var g,v,_,y,k,E,A,S,M,T;E=g=e[0],A=v=e[1],S=_=e[2],M=y=e[3],T=k=e[4];var R;for(r=0;r<80;r+=1)R=g+t[i+u[r]]|0,R+=r<16?s(v,_,y)+m[0]:r<32?a(v,_,y)+m[1]:r<48?o(v,_,y)+m[2]:r<64?f(v,_,y)+m[3]:h(v,_,y)+m[4],R|=0,R=c(R,p[r]),R=R+k|0,g=k,k=y,y=c(_,10),_=v,v=R,R=E+t[i+d[r]]|0,R+=r<16?h(A,S,M)+w[0]:r<32?f(A,S,M)+w[1]:r<48?o(A,S,M)+w[2]:r<64?a(A,S,M)+w[3]:s(A,S,M)+w[4],R|=0,R=c(R,b[r]),R=R+T|0,E=T,T=M,M=c(S,10),S=A,A=R;R=e[1]+_+M|0,e[1]=e[2]+y+T|0,e[2]=e[3]+k+E|0,e[3]=e[4]+g+A|0,e[4]=e[0]+v+S|0,e[0]=R}function s(e,t,i){return e^t^i}function a(e,t,i){return e&t|~e&i}function o(e,t,i){return(e|~t)^i}function f(e,t,i){return e&i|t&~i}function h(e,t,i){return e^(t|~i)}function c(e,t){return e<>>32-t}function l(e){var s=[1732584193,4023233417,2562383102,271733878,3285377520];"string"==typeof e&&(e=new t(e,"utf8"));var a=i(e),o=8*e.length,f=8*e.length;a[o>>>5]|=128<<24-o%32,a[(o+64>>>9<<4)+14]=16711935&(f<<8|f>>>24)|4278255360&(f<<24|f>>>8);for(var h=0;h>>24)|4278255360&(c<<24|c>>>8)}var l=r(s);return new t(l)}/** @preserve +(c) 2012 by Cédric Mesnil. All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + + - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ +var u=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],d=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],p=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],b=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],m=[0,1518500249,1859775393,2400959708,2840853838],w=[1352829926,1548603684,1836072691,2053994217,0];e.exports=l}).call(t,i(0).Buffer)},function(e,t,i){var t=e.exports=function(e){e=e.toLowerCase();var i=t[e];if(!i)throw new Error(e+" is not supported (we accept pull requests)");return new i};t.sha=i(166),t.sha1=i(167),t.sha224=i(168),t.sha256=i(99),t.sha384=i(169),t.sha512=i(100)},function(e,t,i){(function(t){function r(){this.init(),this._w=c,f.call(this,64,56)}function n(e){return e<<5|e>>>27}function s(e){return e<<30|e>>>2}function a(e,t,i,r){return 0===e?t&i|~t&r:2===e?t&i|t&r|i&r:t^i^r}var o=i(1),f=i(19),h=[1518500249,1859775393,-1894007588,-899497514],c=new Array(80);o(r,f),r.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},r.prototype._update=function(e){for(var t=this._w,i=0|this._a,r=0|this._b,o=0|this._c,f=0|this._d,c=0|this._e,l=0;l<16;++l)t[l]=e.readInt32BE(4*l);for(;l<80;++l)t[l]=t[l-3]^t[l-8]^t[l-14]^t[l-16];for(var u=0;u<80;++u){var d=~~(u/20),p=n(i)+a(d,r,o,f)+c+t[u]+h[d]|0;c=f,f=o,o=s(r),r=i,i=p}this._a=i+this._a|0,this._b=r+this._b|0,this._c=o+this._c|0,this._d=f+this._d|0,this._e=c+this._e|0},r.prototype._hash=function(){var e=new t(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e},e.exports=r}).call(t,i(0).Buffer)},function(e,t,i){(function(t){function r(){this.init(),this._w=l,h.call(this,64,56)}function n(e){return e<<1|e>>>31}function s(e){return e<<5|e>>>27}function a(e){return e<<30|e>>>2}function o(e,t,i,r){return 0===e?t&i|~t&r:2===e?t&i|t&r|i&r:t^i^r}var f=i(1),h=i(19),c=[1518500249,1859775393,-1894007588,-899497514],l=new Array(80);f(r,h),r.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},r.prototype._update=function(e){for(var t=this._w,i=0|this._a,r=0|this._b,f=0|this._c,h=0|this._d,l=0|this._e,u=0;u<16;++u)t[u]=e.readInt32BE(4*u);for(;u<80;++u)t[u]=n(t[u-3]^t[u-8]^t[u-14]^t[u-16]);for(var d=0;d<80;++d){var p=~~(d/20),b=s(i)+o(p,r,f,h)+l+t[d]+c[p]|0;l=h,h=f,f=a(r),r=i,i=b}this._a=i+this._a|0,this._b=r+this._b|0,this._c=f+this._c|0,this._d=h+this._d|0,this._e=l+this._e|0},r.prototype._hash=function(){var e=new t(20);return e.writeInt32BE(0|this._a,0),e.writeInt32BE(0|this._b,4),e.writeInt32BE(0|this._c,8),e.writeInt32BE(0|this._d,12),e.writeInt32BE(0|this._e,16),e},e.exports=r}).call(t,i(0).Buffer)},function(e,t,i){(function(t){function r(){this.init(),this._w=o,a.call(this,64,56)}var n=i(1),s=i(99),a=i(19),o=new Array(64);n(r,s),r.prototype.init=function(){return this._a=3238371032,this._b=914150663,this._c=812702999,this._d=4144912697,this._e=4290775857,this._f=1750603025,this._g=1694076839,this._h=3204075428,this},r.prototype._hash=function(){var e=new t(28);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e},e.exports=r}).call(t,i(0).Buffer)},function(e,t,i){(function(t){function r(){this.init(),this._w=o,a.call(this,128,112)}var n=i(1),s=i(100),a=i(19),o=new Array(160);n(r,s),r.prototype.init=function(){return this._ah=3418070365,this._bh=1654270250,this._ch=2438529370,this._dh=355462360,this._eh=1731405415,this._fh=2394180231,this._gh=3675008525,this._hh=1203062813,this._al=3238371032,this._bl=914150663,this._cl=812702999,this._dl=4144912697,this._el=4290775857,this._fl=1750603025,this._gl=1694076839,this._hl=3204075428,this},r.prototype._hash=function(){function e(e,t,r){i.writeInt32BE(e,r),i.writeInt32BE(t,r+4)}var i=new t(48);return e(this._ah,this._al,0),e(this._bh,this._bl,8),e(this._ch,this._cl,16),e(this._dh,this._dl,24),e(this._eh,this._el,32),e(this._fh,this._fl,40),i},e.exports=r}).call(t,i(0).Buffer)},function(e,t,i){"use strict";function r(e){s.equal(e.length,8,"Invalid IV length"),this.iv=new Array(8);for(var t=0;t0;r--)t+=this._buffer(e,t),i+=this._flushBuffer(n,i);return t+=this._buffer(e,t),n},r.prototype.final=function(e){var t;e&&(t=this.update(e));var i;return i="encrypt"===this.type?this._finalEncrypt():this._finalDecrypt(),t?t.concat(i):i},r.prototype._pad=function(e,t){if(0===t)return!1;for(;t>>1];i=f.r28shl(i,a),r=f.r28shl(r,a),f.pc2(i,r,e.keys,n)}},n.prototype._update=function(e,t,i,r){var n=this._desState,s=f.readUInt32BE(e,t),a=f.readUInt32BE(e,t+4);f.ip(s,a,n.tmp,0),s=n.tmp[0],a=n.tmp[1],"encrypt"===this.type?this._encrypt(n,s,a,n.tmp,0):this._decrypt(n,s,a,n.tmp,0),s=n.tmp[0],a=n.tmp[1],f.writeUInt32BE(i,s,r),f.writeUInt32BE(i,a,r+4)},n.prototype._pad=function(e,t){for(var i=e.length-t,r=t;r>>0,s=d}f.rip(a,s,r,n)},n.prototype._decrypt=function(e,t,i,r,n){for(var s=i,a=t,o=e.keys.length-2;o>=0;o-=2){var h=e.keys[o],c=e.keys[o+1];f.expand(s,e.tmp,0),h^=e.tmp[0],c^=e.tmp[1];var l=f.substitute(h,c),u=f.permute(l),d=s;s=(a^u)>>>0,a=d}f.rip(s,a,r,n)}},function(e,t,i){"use strict";function r(e,t){s.equal(t.length,24,"Invalid key length");var i=t.slice(0,8),r=t.slice(8,16),n=t.slice(16,24);"encrypt"===e?this.ciphers=[h.create({type:"encrypt",key:i}),h.create({type:"decrypt",key:r}),h.create({type:"encrypt",key:n})]:this.ciphers=[h.create({type:"decrypt",key:n}),h.create({type:"encrypt",key:r}),h.create({type:"decrypt",key:i})]}function n(e){f.call(this,e);var t=new r(this.type,this.options.key);this._edeState=t}var s=i(26),a=i(1),o=i(51),f=o.Cipher,h=o.DES;a(n,f),e.exports=n,n.create=function(e){return new n(e)},n.prototype._update=function(e,t,i,r){var n=this._edeState;n.ciphers[0]._update(e,t,i,r),n.ciphers[1]._update(i,r,i,r),n.ciphers[2]._update(i,r,i,r)},n.prototype._pad=h.prototype._pad,n.prototype._unpad=h.prototype._unpad},function(e,t){"use strict";t.readUInt32BE=function(e,t){var i=e[0+t]<<24|e[1+t]<<16|e[2+t]<<8|e[3+t];return i>>>0},t.writeUInt32BE=function(e,t,i){e[0+i]=t>>>24,e[1+i]=t>>>16&255,e[2+i]=t>>>8&255,e[3+i]=255&t},t.ip=function(e,t,i,r){for(var n=0,s=0,a=6;a>=0;a-=2){for(var o=0;o<=24;o+=8)n<<=1,n|=t>>>o+a&1;for(var o=0;o<=24;o+=8)n<<=1,n|=e>>>o+a&1}for(var a=6;a>=0;a-=2){for(var o=1;o<=25;o+=8)s<<=1,s|=t>>>o+a&1;for(var o=1;o<=25;o+=8)s<<=1,s|=e>>>o+a&1}i[r+0]=n>>>0,i[r+1]=s>>>0},t.rip=function(e,t,i,r){for(var n=0,s=0,a=0;a<4;a++)for(var o=24;o>=0;o-=8)n<<=1,n|=t>>>o+a&1,n<<=1,n|=e>>>o+a&1;for(var a=4;a<8;a++)for(var o=24;o>=0;o-=8)s<<=1,s|=t>>>o+a&1,s<<=1,s|=e>>>o+a&1;i[r+0]=n>>>0,i[r+1]=s>>>0},t.pc1=function(e,t,i,r){for(var n=0,s=0,a=7;a>=5;a--){for(var o=0;o<=24;o+=8)n<<=1,n|=t>>o+a&1;for(var o=0;o<=24;o+=8)n<<=1,n|=e>>o+a&1}for(var o=0;o<=24;o+=8)n<<=1,n|=t>>o+a&1;for(var a=1;a<=3;a++){for(var o=0;o<=24;o+=8)s<<=1,s|=t>>o+a&1;for(var o=0;o<=24;o+=8)s<<=1,s|=e>>o+a&1}for(var o=0;o<=24;o+=8)s<<=1,s|=e>>o+a&1;i[r+0]=n>>>0,i[r+1]=s>>>0},t.r28shl=function(e,t){return e<>>28-t};var i=[14,11,17,4,27,23,25,0,13,22,7,18,5,9,16,24,2,20,12,21,1,8,15,26,15,4,25,19,9,1,26,16,5,11,23,8,12,7,17,0,22,3,10,14,6,20,27,24];t.pc2=function(e,t,r,n){for(var s=0,a=0,o=i.length>>>1,f=0;f>>i[f]&1;for(var f=o;f>>i[f]&1;r[n+0]=s>>>0,r[n+1]=a>>>0},t.expand=function(e,t,i){var r=0,n=0;r=(1&e)<<5|e>>>27;for(var s=23;s>=15;s-=4)r<<=6,r|=e>>>s&63;for(var s=11;s>=3;s-=4)n|=e>>>s&63,n<<=6;n|=(31&e)<<1|e>>>31,t[i+0]=r>>>0,t[i+1]=n>>>0};var r=[14,0,4,15,13,7,1,4,2,14,15,2,11,13,8,1,3,10,10,6,6,12,12,11,5,9,9,5,0,3,7,8,4,15,1,12,14,8,8,2,13,4,6,9,2,1,11,7,15,5,12,11,9,3,7,14,3,10,10,0,5,6,0,13,15,3,1,13,8,4,14,7,6,15,11,2,3,8,4,14,9,12,7,0,2,1,13,10,12,6,0,9,5,11,10,5,0,13,14,8,7,10,11,1,10,3,4,15,13,4,1,2,5,11,8,6,12,7,6,12,9,0,3,5,2,14,15,9,10,13,0,7,9,0,14,9,6,3,3,4,15,6,5,10,1,2,13,8,12,5,7,14,11,12,4,11,2,15,8,1,13,1,6,10,4,13,9,0,8,6,15,9,3,8,0,7,11,4,1,15,2,14,12,3,5,11,10,5,14,2,7,12,7,13,13,8,14,11,3,5,0,6,6,15,9,0,10,3,1,4,2,7,8,2,5,12,11,1,12,10,4,14,15,9,10,3,6,15,9,0,0,6,12,10,11,1,7,13,13,8,15,9,1,4,3,5,14,11,5,12,2,7,8,2,4,14,2,14,12,11,4,2,1,12,7,4,10,7,11,13,6,1,8,5,5,0,3,15,15,10,13,3,0,9,14,8,9,6,4,11,2,8,1,12,11,7,10,1,13,14,7,2,8,13,15,6,9,15,12,0,5,9,6,10,3,4,0,5,14,3,12,10,1,15,10,4,15,2,9,7,2,12,6,9,8,5,0,6,13,1,3,13,4,14,14,0,7,11,5,3,11,8,9,4,14,3,15,2,5,12,2,9,8,5,12,15,3,10,7,11,0,14,4,1,10,7,1,6,13,0,11,8,6,13,4,13,11,0,2,11,14,7,15,4,0,9,8,1,13,10,3,14,12,3,9,5,7,12,5,2,10,15,6,8,1,6,1,6,4,11,11,13,13,8,12,1,3,4,7,10,14,7,10,9,15,5,6,0,8,15,0,14,5,2,9,3,2,12,13,1,2,15,8,13,4,8,6,10,15,3,11,7,1,4,10,12,9,5,3,6,14,11,5,0,0,14,12,9,7,2,7,2,11,1,4,14,1,7,9,4,12,10,14,8,2,13,0,15,6,12,10,9,13,0,15,3,3,5,5,6,8,11];t.substitute=function(e,t){for(var i=0,n=0;n<4;n++){var s=e>>>18-6*n&63,a=r[64*n+s];i<<=4,i|=a}for(var n=0;n<4;n++){var s=t>>>18-6*n&63,a=r[256+64*n+s];i<<=4,i|=a}return i>>>0};var n=[16,25,12,11,3,20,4,15,31,17,9,6,27,14,1,22,30,24,8,18,0,5,29,23,13,19,2,26,10,21,28,7];t.permute=function(e){for(var t=0,i=0;i>>n[i]&1;return t>>>0},t.padSplit=function(e,t,i){for(var r=e.toString(2);r.length0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}function n(e,t){this.curve=e,this.type=t,this.precomputed=null}var s=i(4),a=i(7),o=a.utils,f=o.getNAF,h=o.getJSF,c=o.assert;e.exports=r,r.prototype.point=function(){throw new Error("Not implemented")},r.prototype.validate=function(){throw new Error("Not implemented")},r.prototype._fixedNafMul=function(e,t){c(e.precomputed);var i=e._getDoubles(),r=f(t,1),n=(1<=a;t--)o=(o<<1)+r[t];s.push(o)}for(var h=this.jpoint(null,null,null),l=this.jpoint(null,null,null),u=n;u>0;u--){for(var a=0;a=0;o--){for(var t=0;o>=0&&0===s[o];o--)t++;if(o>=0&&t++,a=a.dblp(t),o<0)break;var h=s[o];c(0!==h),a="affine"===e.type?h>0?a.mixedAdd(n[h-1>>1]):a.mixedAdd(n[-h-1>>1].neg()):h>0?a.add(n[h-1>>1]):a.add(n[-h-1>>1].neg())}return"affine"===e.type?a.toP():a},r.prototype._wnafMulAdd=function(e,t,i,r,n){for(var s=this._wnafT1,a=this._wnafT2,o=this._wnafT3,c=0,l=0;l=1;l-=2){var p=l-1,b=l;if(1===s[p]&&1===s[b]){var m=[t[p],null,null,t[b]];0===t[p].y.cmp(t[b].y)?(m[1]=t[p].add(t[b]),m[2]=t[p].toJ().mixedAdd(t[b].neg())):0===t[p].y.cmp(t[b].y.redNeg())?(m[1]=t[p].toJ().mixedAdd(t[b]),m[2]=t[p].add(t[b].neg())):(m[1]=t[p].toJ().mixedAdd(t[b]),m[2]=t[p].toJ().mixedAdd(t[b].neg()));var w=[-3,-1,-5,-7,0,7,5,1,3],g=h(i[p],i[b]);c=Math.max(g[0].length,c),o[p]=new Array(c),o[b]=new Array(c);for(var v=0;v=0;l--){for(var A=0;l>=0;){for(var S=!0,v=0;v=0&&A++,k=k.dblp(A),l<0)break;for(var v=0;v0?u=a[v][M-1>>1]:M<0&&(u=a[v][-M-1>>1].neg()),k="affine"===u.type?k.mixedAdd(u):k.add(u))}}for(var l=0;l=Math.ceil((e.bitLength()+1)/t.step)},n.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var i=[this],r=this,n=0;n":""},n.prototype.isInfinity=function(){return 0===this.x.cmpn(0)&&0===this.y.cmp(this.z)},n.prototype._extDbl=function(){var e=this.x.redSqr(),t=this.y.redSqr(),i=this.z.redSqr();i=i.redIAdd(i);var r=this.curve._mulA(e),n=this.x.redAdd(this.y).redSqr().redISub(e).redISub(t),s=r.redAdd(t),a=s.redSub(i),o=r.redSub(t),f=n.redMul(a),h=s.redMul(o),c=n.redMul(o),l=a.redMul(s);return this.curve.point(f,h,l,c)},n.prototype._projDbl=function(){var e,t,i,r=this.x.redAdd(this.y).redSqr(),n=this.x.redSqr(),s=this.y.redSqr();if(this.curve.twisted){var a=this.curve._mulA(n),o=a.redAdd(s);if(this.zOne)e=r.redSub(n).redSub(s).redMul(o.redSub(this.curve.two)),t=o.redMul(a.redSub(s)),i=o.redSqr().redSub(o).redSub(o);else{var f=this.z.redSqr(),h=o.redSub(f).redISub(f);e=r.redSub(n).redISub(s).redMul(h),t=o.redMul(a.redSub(s)),i=o.redMul(h)}}else{var a=n.redAdd(s),f=this.curve._mulC(this.c.redMul(this.z)).redSqr(),h=a.redSub(f).redSub(f);e=this.curve._mulC(r.redISub(a)).redMul(h),t=this.curve._mulC(a).redMul(n.redISub(s)),i=a.redMul(h)}return this.curve.point(e,t,i)},n.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},n.prototype._extAdd=function(e){var t=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),i=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),r=this.t.redMul(this.curve.dd).redMul(e.t),n=this.z.redMul(e.z.redAdd(e.z)),s=i.redSub(t),a=n.redSub(r),o=n.redAdd(r),f=i.redAdd(t),h=s.redMul(a),c=o.redMul(f),l=s.redMul(f),u=a.redMul(o);return this.curve.point(h,c,u,l)},n.prototype._projAdd=function(e){var t,i,r=this.z.redMul(e.z),n=r.redSqr(),s=this.x.redMul(e.x),a=this.y.redMul(e.y),o=this.curve.d.redMul(s).redMul(a),f=n.redSub(o),h=n.redAdd(o),c=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(s).redISub(a),l=r.redMul(f).redMul(c);return this.curve.twisted?(t=r.redMul(h).redMul(a.redSub(this.curve._mulA(s))),i=f.redMul(h)):(t=r.redMul(h).redMul(a.redSub(s)),i=this.curve._mulC(f).redMul(h)),this.curve.point(l,t,i)},n.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)},n.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)},n.prototype.mulAdd=function(e,t,i){return this.curve._wnafMulAdd(1,[this,t],[e,i],2,!1)},n.prototype.jmulAdd=function(e,t,i){return this.curve._wnafMulAdd(1,[this,t],[e,i],2,!0)},n.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&(this.t=this.t.redMul(e)),this.z=this.curve.one,this.zOne=!0,this},n.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},n.prototype.getX=function(){return this.normalize(),this.x.fromRed()},n.prototype.getY=function(){return this.normalize(),this.y.fromRed()},n.prototype.eq=function(e){return this===e||0===this.getX().cmp(e.getX())&&0===this.getY().cmp(e.getY())},n.prototype.eqXToP=function(e){var t=e.toRed(this.curve.red).redMul(this.z);if(0===this.x.cmp(t))return!0;for(var i=e.clone(),r=this.curve.redN.redMul(this.z);;){if(i.iadd(this.curve.n),i.cmp(this.curve.p)>=0)return!1;if(t.redIAdd(r),0===this.x.cmp(t))return!0}return!1},n.prototype.toP=n.prototype.normalize,n.prototype.mixedAdd=n.prototype.add},function(e,t,i){"use strict";function r(e){f.call(this,"mont",e),this.a=new a(e.a,16).toRed(this.red),this.b=new a(e.b,16).toRed(this.red),this.i4=new a(4).toRed(this.red).redInvm(),this.two=new a(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}function n(e,t,i){f.BasePoint.call(this,e,"projective"),null===t&&null===i?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new a(t,16),this.z=new a(i,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}var s=i(36),a=i(4),o=i(1),f=s.base,h=i(7),c=h.utils;o(r,f),e.exports=r,r.prototype.validate=function(e){var t=e.normalize().x,i=t.redSqr(),r=i.redMul(t).redAdd(i.redMul(this.a)).redAdd(t),n=r.redSqrt();return 0===n.redSqr().cmp(r)},o(n,f.BasePoint),r.prototype.decodePoint=function(e,t){return this.point(c.toArray(e,t),1)},r.prototype.point=function(e,t){return new n(this,e,t)},r.prototype.pointFromJSON=function(e){return n.fromJSON(this,e)},n.prototype.precompute=function(){},n.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},n.fromJSON=function(e,t){return new n(e,t[0],t[1]||e.one)},n.prototype.inspect=function(){return this.isInfinity()?"":""},n.prototype.isInfinity=function(){return 0===this.z.cmpn(0)},n.prototype.dbl=function(){var e=this.x.redAdd(this.z),t=e.redSqr(),i=this.x.redSub(this.z),r=i.redSqr(),n=t.redSub(r),s=t.redMul(r),a=n.redMul(r.redAdd(this.curve.a24.redMul(n)));return this.curve.point(s,a)},n.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},n.prototype.diffAdd=function(e,t){var i=this.x.redAdd(this.z),r=this.x.redSub(this.z),n=e.x.redAdd(e.z),s=e.x.redSub(e.z),a=s.redMul(i),o=n.redMul(r),f=t.z.redMul(a.redAdd(o).redSqr()),h=t.x.redMul(a.redISub(o).redSqr());return this.curve.point(f,h)},n.prototype.mul=function(e){for(var t=e.clone(),i=this,r=this.curve.point(null,null),n=this,s=[];0!==t.cmpn(0);t.iushrn(1))s.push(t.andln(1));for(var a=s.length-1;a>=0;a--)0===s[a]?(i=i.diffAdd(r,n),r=r.dbl()):(r=i.diffAdd(r,n),i=i.dbl());return r},n.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},n.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},n.prototype.eq=function(e){return 0===this.getX().cmp(e.getX())},n.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},n.prototype.getX=function(){return this.normalize(),this.x.fromRed()}},function(e,t,i){"use strict";function r(e){c.call(this,"short",e),this.a=new f(e.a,16).toRed(this.red),this.b=new f(e.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(e),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}function n(e,t,i,r){c.BasePoint.call(this,e,"affine"),null===t&&null===i?(this.x=null,this.y=null,this.inf=!0):(this.x=new f(t,16),this.y=new f(i,16),r&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function s(e,t,i,r){c.BasePoint.call(this,e,"jacobian"),null===t&&null===i&&null===r?(this.x=this.curve.one,this.y=this.curve.one,this.z=new f(0)):(this.x=new f(t,16),this.y=new f(i,16),this.z=new f(r,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}var a=i(36),o=i(7),f=i(4),h=i(1),c=a.base,l=o.utils.assert;h(r,c),e.exports=r,r.prototype._getEndomorphism=function(e){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var t,i;if(e.beta)t=new f(e.beta,16).toRed(this.red);else{var r=this._getEndoRoots(this.p);t=r[0].cmp(r[1])<0?r[0]:r[1],t=t.toRed(this.red)}if(e.lambda)i=new f(e.lambda,16);else{var n=this._getEndoRoots(this.n);0===this.g.mul(n[0]).x.cmp(this.g.x.redMul(t))?i=n[0]:(i=n[1],l(0===this.g.mul(i).x.cmp(this.g.x.redMul(t))))}var s;return s=e.basis?e.basis.map(function(e){return{a:new f(e.a,16),b:new f(e.b,16)}}):this._getEndoBasis(i),{beta:t,lambda:i,basis:s}}},r.prototype._getEndoRoots=function(e){var t=e===this.p?this.red:f.mont(e),i=new f(2).toRed(t).redInvm(),r=i.redNeg(),n=new f(3).toRed(t).redNeg().redSqrt().redMul(i),s=r.redAdd(n).fromRed(),a=r.redSub(n).fromRed();return[s,a]},r.prototype._getEndoBasis=function(e){for(var t,i,r,n,s,a,o,h,c,l=this.n.ushrn(Math.floor(this.n.bitLength()/2)),u=e,d=this.n.clone(),p=new f(1),b=new f(0),m=new f(0),w=new f(1),g=0;0!==u.cmpn(0);){var v=d.div(u);h=d.sub(v.mul(u)),c=m.sub(v.mul(p));var _=w.sub(v.mul(b));if(!r&&h.cmp(l)<0)t=o.neg(),i=p,r=h.neg(),n=c;else if(r&&2===++g)break;o=h,d=u,u=h,m=p,p=c,w=b,b=_}s=h.neg(),a=c;var y=r.sqr().add(n.sqr()),k=s.sqr().add(a.sqr());return k.cmp(y)>=0&&(s=t,a=i),r.negative&&(r=r.neg(),n=n.neg()),s.negative&&(s=s.neg(),a=a.neg()),[{a:r,b:n},{a:s,b:a}]},r.prototype._endoSplit=function(e){var t=this.endo.basis,i=t[0],r=t[1],n=r.b.mul(e).divRound(this.n),s=i.b.neg().mul(e).divRound(this.n),a=n.mul(i.a),o=s.mul(r.a),f=n.mul(i.b),h=s.mul(r.b),c=e.sub(a).sub(o),l=f.add(h).neg();return{k1:c,k2:l}},r.prototype.pointFromX=function(e,t){e=new f(e,16),e.red||(e=e.toRed(this.red));var i=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),r=i.redSqrt();if(0!==r.redSqr().redSub(i).cmp(this.zero))throw new Error("invalid point");var n=r.fromRed().isOdd();return(t&&!n||!t&&n)&&(r=r.redNeg()), +this.point(e,r)},r.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,i=e.y,r=this.a.redMul(t),n=t.redSqr().redMul(t).redIAdd(r).redIAdd(this.b);return 0===i.redSqr().redISub(n).cmpn(0)},r.prototype._endoWnafMulAdd=function(e,t,i){for(var r=this._endoWnafT1,n=this._endoWnafT2,s=0;s":""},n.prototype.isInfinity=function(){return this.inf},n.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(0===this.x.cmp(e.x))return this.curve.point(null,null);var t=this.y.redSub(e.y);0!==t.cmpn(0)&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var i=t.redSqr().redISub(this.x).redISub(e.x),r=t.redMul(this.x.redSub(i)).redISub(this.y);return this.curve.point(i,r)},n.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(0===e.cmpn(0))return this.curve.point(null,null);var t=this.curve.a,i=this.x.redSqr(),r=e.redInvm(),n=i.redAdd(i).redIAdd(i).redIAdd(t).redMul(r),s=n.redSqr().redISub(this.x.redAdd(this.x)),a=n.redMul(this.x.redSub(s)).redISub(this.y);return this.curve.point(s,a)},n.prototype.getX=function(){return this.x.fromRed()},n.prototype.getY=function(){return this.y.fromRed()},n.prototype.mul=function(e){return e=new f(e,16),this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},n.prototype.mulAdd=function(e,t,i){var r=[this,t],n=[e,i];return this.curve.endo?this.curve._endoWnafMulAdd(r,n):this.curve._wnafMulAdd(1,r,n,2)},n.prototype.jmulAdd=function(e,t,i){var r=[this,t],n=[e,i];return this.curve.endo?this.curve._endoWnafMulAdd(r,n,!0):this.curve._wnafMulAdd(1,r,n,2,!0)},n.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||0===this.x.cmp(e.x)&&0===this.y.cmp(e.y))},n.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var i=this.precomputed,r=function(e){return e.neg()};t.precomputed={naf:i.naf&&{wnd:i.naf.wnd,points:i.naf.points.map(r)},doubles:i.doubles&&{step:i.doubles.step,points:i.doubles.points.map(r)}}}return t},n.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var e=this.curve.jpoint(this.x,this.y,this.curve.one);return e},h(s,c.BasePoint),r.prototype.jpoint=function(e,t,i){return new s(this,e,t,i)},s.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),i=this.x.redMul(t),r=this.y.redMul(t).redMul(e);return this.curve.point(i,r)},s.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},s.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),i=this.z.redSqr(),r=this.x.redMul(t),n=e.x.redMul(i),s=this.y.redMul(t.redMul(e.z)),a=e.y.redMul(i.redMul(this.z)),o=r.redSub(n),f=s.redSub(a);if(0===o.cmpn(0))return 0!==f.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var h=o.redSqr(),c=h.redMul(o),l=r.redMul(h),u=f.redSqr().redIAdd(c).redISub(l).redISub(l),d=f.redMul(l.redISub(u)).redISub(s.redMul(c)),p=this.z.redMul(e.z).redMul(o);return this.curve.jpoint(u,d,p)},s.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),i=this.x,r=e.x.redMul(t),n=this.y,s=e.y.redMul(t).redMul(this.z),a=i.redSub(r),o=n.redSub(s);if(0===a.cmpn(0))return 0!==o.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var f=a.redSqr(),h=f.redMul(a),c=i.redMul(f),l=o.redSqr().redIAdd(h).redISub(c).redISub(c),u=o.redMul(c.redISub(l)).redISub(n.redMul(h)),d=this.z.redMul(a);return this.curve.jpoint(l,u,d)},s.prototype.dblp=function(e){if(0===e)return this;if(this.isInfinity())return this;if(!e)return this.dbl();if(this.curve.zeroA||this.curve.threeA){for(var t=this,i=0;i=0)return!1;if(i.redIAdd(n),0===this.x.cmp(i))return!0}return!1},s.prototype.inspect=function(){return this.isInfinity()?"":""},s.prototype.isInfinity=function(){return 0===this.z.cmpn(0)}},function(e,t,i){"use strict";function r(e){"short"===e.type?this.curve=new o.curve.short(e):"edwards"===e.type?this.curve=new o.curve.edwards(e):this.curve=new o.curve.mont(e),this.g=this.curve.g,this.n=this.curve.n,this.hash=e.hash,f(this.g.validate(),"Invalid curve"),f(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function n(e,t){Object.defineProperty(s,e,{configurable:!0,enumerable:!0,get:function(){var i=new r(t);return Object.defineProperty(s,e,{configurable:!0,enumerable:!0,value:i}),i}})}var s=t,a=i(13),o=i(7),f=o.utils.assert;s.PresetCurve=r,n("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:a.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),n("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:a.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),n("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:a.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),n("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:a.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),n("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:a.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),n("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"0",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:a.sha256,gRed:!1,g:["9"]}),n("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:a.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var h;try{h=i(189)}catch(e){h=void 0}n("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:a.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",h]})},function(e,t,i){"use strict";function r(e){return this instanceof r?("string"==typeof e&&(o(s.curves.hasOwnProperty(e),"Unknown curve "+e),e=s.curves[e]),e instanceof s.curves.PresetCurve&&(e={curve:e}),this.curve=e.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=e.curve.g,this.g.precompute(e.curve.n.bitLength()+1),void(this.hash=e.hash||e.curve.hash)):new r(e)}var n=i(4),s=i(7),a=s.utils,o=a.assert,f=i(183),h=i(184);e.exports=r,r.prototype.keyPair=function(e){return new f(this,e)},r.prototype.keyFromPrivate=function(e,t){return f.fromPrivate(this,e,t)},r.prototype.keyFromPublic=function(e,t){return f.fromPublic(this,e,t)},r.prototype.genKeyPair=function(e){e||(e={});for(var t=new s.hmacDRBG({hash:this.hash,pers:e.pers,entropy:e.entropy||s.rand(this.hash.hmacStrength),nonce:this.n.toArray()}),i=this.n.byteLength(),r=this.n.sub(new n(2));;){var a=new n(t.generate(i));if(!(a.cmp(r)>0))return a.iaddn(1),this.keyFromPrivate(a)}},r.prototype._truncateToN=function(e,t){var i=8*e.byteLength()-this.n.bitLength();return i>0&&(e=e.ushrn(i)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e},r.prototype.sign=function(e,t,i,r){"object"==typeof i&&(r=i,i=null),r||(r={}),t=this.keyFromPrivate(t,i),e=this._truncateToN(new n(e,16));for(var a=this.n.byteLength(),o=t.getPrivate().toArray("be",a),f=e.toArray("be",a),c=new s.hmacDRBG({hash:this.hash,entropy:o,nonce:f,pers:r.pers,persEnc:r.persEnc}),l=this.n.sub(new n(1)),u=0;!0;u++){var d=r.k?r.k(u):new n(c.generate(this.n.byteLength()));if(d=this._truncateToN(d,!0),!(d.cmpn(1)<=0||d.cmp(l)>=0)){var p=this.g.mul(d);if(!p.isInfinity()){var b=p.getX(),m=b.umod(this.n);if(0!==m.cmpn(0)){var w=d.invm(this.n).mul(m.mul(t.getPrivate()).iadd(e));if(w=w.umod(this.n),0!==w.cmpn(0)){var g=(p.getY().isOdd()?1:0)|(0!==b.cmp(m)?2:0);return r.canonical&&w.cmp(this.nh)>0&&(w=this.n.sub(w),g^=1),new h({r:m,s:w,recoveryParam:g})}}}}}},r.prototype.verify=function(e,t,i,r){e=this._truncateToN(new n(e,16)),i=this.keyFromPublic(i,r),t=new h(t,"hex");var s=t.r,a=t.s;if(s.cmpn(1)<0||s.cmp(this.n)>=0)return!1;if(a.cmpn(1)<0||a.cmp(this.n)>=0)return!1;var o=a.invm(this.n),f=o.mul(e).umod(this.n),c=o.mul(s).umod(this.n);if(!this.curve._maxwellTrick){var l=this.g.mulAdd(f,i.getPublic(),c);return!l.isInfinity()&&0===l.getX().umod(this.n).cmp(s)}var l=this.g.jmulAdd(f,i.getPublic(),c);return!l.isInfinity()&&l.eqXToP(s)},r.prototype.recoverPubKey=function(e,t,i,r){o((3&i)===i,"The recovery param is more than two bits"),t=new h(t,r);var s=this.n,a=new n(e),f=t.r,c=t.s,l=1&i,u=i>>1;if(f.cmp(this.curve.p.umod(this.curve.n))>=0&&u)throw new Error("Unable to find sencond key candinate");f=u?this.curve.pointFromX(f.add(this.curve.n),l):this.curve.pointFromX(f,l);var d=t.r.invm(s),p=s.sub(a).mul(d).umod(s),b=c.mul(d).umod(s);return this.g.mulAdd(p,f,b)},r.prototype.getKeyRecoveryParam=function(e,t,i,r){if(t=new h(t,r),null!==t.recoveryParam)return t.recoveryParam;for(var n=0;n<4;n++){var s;try{s=this.recoverPubKey(e,t,n)}catch(e){continue}if(s.eq(i))return n}throw new Error("Unable to find valid recovery factor")}},function(e,t,i){"use strict";function r(e,t){this.ec=e,this.priv=null,this.pub=null,t.priv&&this._importPrivate(t.priv,t.privEnc),t.pub&&this._importPublic(t.pub,t.pubEnc)}var n=i(4);e.exports=r,r.fromPublic=function(e,t,i){return t instanceof r?t:new r(e,{pub:t,pubEnc:i})},r.fromPrivate=function(e,t,i){return t instanceof r?t:new r(e,{priv:t,privEnc:i})},r.prototype.validate=function(){var e=this.getPublic();return e.isInfinity()?{result:!1,reason:"Invalid public key"}:e.validate()?e.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},r.prototype.getPublic=function(e,t){return"string"==typeof e&&(t=e,e=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),t?this.pub.encode(t,e):this.pub},r.prototype.getPrivate=function(e){return"hex"===e?this.priv.toString(16,2):this.priv},r.prototype._importPrivate=function(e,t){this.priv=new n(e,t||16),this.priv=this.priv.umod(this.ec.curve.n)},r.prototype._importPublic=function(e,t){return e.x||e.y?void(this.pub=this.ec.curve.point(e.x,e.y)):void(this.pub=this.ec.curve.decodePoint(e,t))},r.prototype.derive=function(e){return e.mul(this.priv).getX()},r.prototype.sign=function(e,t,i){return this.ec.sign(e,this,t,i)},r.prototype.verify=function(e,t){return this.ec.verify(e,t,this)},r.prototype.inspect=function(){return""}},function(e,t,i){"use strict";function r(e,t){return e instanceof r?e:void(this._importDER(e,t)||(l(e.r&&e.s,"Signature without r or s"),this.r=new f(e.r,16),this.s=new f(e.s,16),void 0===e.recoveryParam?this.recoveryParam=null:this.recoveryParam=e.recoveryParam))}function n(){this.place=0}function s(e,t){var i=e[t.place++];if(!(128&i))return i;for(var r=15&i,n=0,s=0,a=t.place;s>>3);for(e.push(128|i);--i;)e.push(t>>>(i<<3)&255);e.push(t)}var f=i(4),h=i(7),c=h.utils,l=c.assert;e.exports=r,r.prototype._importDER=function(e,t){e=c.toArray(e,t);var i=new n;if(48!==e[i.place++])return!1;var r=s(e,i);if(r+i.place!==e.length)return!1;if(2!==e[i.place++])return!1;var a=s(e,i),o=e.slice(i.place,a+i.place);if(i.place+=a,2!==e[i.place++])return!1;var h=s(e,i);if(e.length!==h+i.place)return!1;var l=e.slice(i.place,h+i.place);return 0===o[0]&&128&o[1]&&(o=o.slice(1)),0===l[0]&&128&l[1]&&(l=l.slice(1)),this.r=new f(o),this.s=new f(l),this.recoveryParam=null,!0},r.prototype.toDER=function(e){var t=this.r.toArray(),i=this.s.toArray();for(128&t[0]&&(t=[0].concat(t)),128&i[0]&&(i=[0].concat(i)),t=a(t),i=a(i);!(i[0]||128&i[1]);)i=i.slice(1);var r=[2];o(r,t.length),r=r.concat(t),r.push(2),o(r,i.length);var n=r.concat(i),s=[48];return o(s,n.length),s=s.concat(n),c.encode(s,e)}},function(e,t,i){"use strict";function r(e){if(o("ed25519"===e,"only tested with ed25519 so far"),!(this instanceof r))return new r(e);var e=s.curves[e].curve;this.curve=e,this.g=e.g,this.g.precompute(e.n.bitLength()+1),this.pointClass=e.point().constructor,this.encodingLength=Math.ceil(e.n.bitLength()/8),this.hash=n.sha512}var n=i(13),s=i(7),a=s.utils,o=a.assert,f=a.parseBytes,h=i(186),c=i(187);e.exports=r,r.prototype.sign=function(e,t){e=f(e);var i=this.keyFromSecret(t),r=this.hashInt(i.messagePrefix(),e),n=this.g.mul(r),s=this.encodePoint(n),a=this.hashInt(s,i.pubBytes(),e).mul(i.priv()),o=r.add(a).umod(this.curve.n);return this.makeSignature({R:n,S:o,Rencoded:s})},r.prototype.verify=function(e,t,i){e=f(e),t=this.makeSignature(t);var r=this.keyFromPublic(i),n=this.hashInt(t.Rencoded(),r.pubBytes(),e),s=this.g.mul(t.S()),a=t.R().add(r.pub().mul(n));return a.eq(s)},r.prototype.hashInt=function(){for(var e=this.hash(),t=0;t=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(t,i,n)}var n=i(13),s=i(7),a=s.utils,o=a.assert;e.exports=r,r.prototype._init=function(e,t,i){var r=e.concat(t).concat(i);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var n=0;n=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(i||[])),this.reseed=1},r.prototype.generate=function(e,t,i,r){if(this.reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof t&&(r=i,i=t,t=null),i&&(i=a.toArray(i,r),this._update(i));for(var n=[];n.length>8,a=255&n;s?i.push(s,a):i.push(a)}return i}function n(e){return 1===e.length?"0"+e:e}function s(e){for(var t="",i=0;i=0;){var s;if(n.isOdd()){var a=n.andln(r-1);s=a>(r>>1)-1?(r>>1)-a:a,n.isubn(s)}else s=0;i.push(s);for(var o=0!==n.cmpn(0)&&0===n.andln(r-1)?t+1:1,f=1;f0||t.cmpn(-n)>0;){var s=e.andln(3)+r&3,a=t.andln(3)+n&3;3===s&&(s=-1),3===a&&(a=-1);var o;if(0===(1&s))o=0;else{var f=e.andln(7)+r&7;o=3!==f&&5!==f||2!==a?s:-s}i[0].push(o);var h;if(0===(1&a))h=0;else{var f=t.andln(7)+n&7;h=3!==f&&5!==f||2!==s?a:-a}i[1].push(h),2*r===o+1&&(r=1-r),2*n===h+1&&(n=1-n),e.iushrn(1),t.iushrn(1)}return i}function f(e,t,i){var r="_"+t;e.prototype[t]=function(){return void 0!==this[r]?this[r]:this[r]=i.call(this)}}function h(e){return"string"==typeof e?l.toArray(e,"hex"):e}function c(e){return new u(e,"hex","le")}var l=t,u=i(4);l.assert=function(e,t){if(!e)throw new Error(t||"Assertion failed")},l.toArray=r,l.zero2=n,l.toHex=s,l.encode=function(e,t){return"hex"===t?s(e):e},l.getNAF=a,l.getJSF=o,l.cachedProperty=f,l.parseBytes=h,l.intFromLE=c},function(e,t,i){function r(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}var n=i(13),s=n.utils,a=s.assert;t.BlockHash=r,r.prototype.update=function(e,t){if(e=s.toArray(e,t),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){e=this.pending;var i=e.length%this._delta8;this.pending=e.slice(e.length-i,e.length),0===this.pending.length&&(this.pending=null),e=s.join32(e,0,e.length-i,this.endian);for(var r=0;r>>24&255,r[n++]=e>>>16&255,r[n++]=e>>>8&255,r[n++]=255&e}else{r[n++]=255&e,r[n++]=e>>>8&255,r[n++]=e>>>16&255,r[n++]=e>>>24&255,r[n++]=0,r[n++]=0,r[n++]=0,r[n++]=0;for(var s=8;sthis.blockSize&&(e=(new this.Hash).update(e).digest()),a(e.length<=this.blockSize);for(var t=e.length;t>>3}function p(e){return I(e,17)^I(e,19)^e>>>10}function b(e,t,i,r){return 0===e?f(t,i,r):1===e||3===e?c(t,i,r):2===e?h(t,i,r):void 0}function m(e,t,i,r,n,s){var a=e&i^~e&n;return a<0&&(a+=4294967296),a}function w(e,t,i,r,n,s){var a=t&r^~t&s;return a<0&&(a+=4294967296),a}function g(e,t,i,r,n,s){var a=e&i^e&n^i&n;return a<0&&(a+=4294967296),a}function v(e,t,i,r,n,s){var a=t&r^t&s^r&s;return a<0&&(a+=4294967296),a}function _(e,t){var i=L(e,t,28),r=L(t,e,2),n=L(t,e,7),s=i^r^n;return s<0&&(s+=4294967296),s}function y(e,t){var i=B(e,t,28),r=B(t,e,2),n=B(t,e,7),s=i^r^n;return s<0&&(s+=4294967296),s}function k(e,t){var i=L(e,t,14),r=L(e,t,18),n=L(t,e,9),s=i^r^n;return s<0&&(s+=4294967296),s}function E(e,t){var i=B(e,t,14),r=B(e,t,18),n=B(t,e,9),s=i^r^n;return s<0&&(s+=4294967296),s}function A(e,t){var i=L(e,t,1),r=L(e,t,8),n=U(e,t,7),s=i^r^n;return s<0&&(s+=4294967296),s}function S(e,t){var i=B(e,t,1),r=B(e,t,8),n=j(e,t,7),s=i^r^n;return s<0&&(s+=4294967296),s}function M(e,t){var i=L(e,t,19),r=L(t,e,29),n=U(e,t,6),s=i^r^n;return s<0&&(s+=4294967296),s}function T(e,t){var i=B(e,t,19),r=B(t,e,29),n=j(e,t,6),s=i^r^n;return s<0&&(s+=4294967296),s}var R=i(13),x=R.utils,C=x.assert,I=x.rotr32,P=x.rotl32,O=x.sum32,N=x.sum32_4,D=x.sum32_5,L=x.rotr64_hi,B=x.rotr64_lo,U=x.shr64_hi,j=x.shr64_lo,F=x.sum64,z=x.sum64_hi,q=x.sum64_lo,H=x.sum64_4_hi,G=x.sum64_4_lo,V=x.sum64_5_hi,W=x.sum64_5_lo,K=R.common.BlockHash,Z=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],Y=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],$=[1518500249,1859775393,2400959708,3395469782];x.inherits(r,K),t.sha256=r,r.blockSize=512,r.outSize=256,r.hmacStrength=192,r.padLength=64,r.prototype._update=function(e,t){for(var i=this.W,r=0;r<16;r++)i[r]=e[t+r];for(;r>8,a=255&n;s?i.push(s,a):i.push(a)}else for(var r=0;r>>24|e>>>8&65280|e<<8&16711680|(255&e)<<24;return t>>>0}function a(e,t){for(var i="",r=0;r>>0}return s}function c(e,t){for(var i=new Array(4*e.length),r=0,n=0;r>>24,i[n+1]=s>>>16&255,i[n+2]=s>>>8&255,i[n+3]=255&s):(i[n+3]=s>>>24,i[n+2]=s>>>16&255,i[n+1]=s>>>8&255,i[n]=255&s)}return i}function l(e,t){return e>>>t|e<<32-t}function u(e,t){return e<>>32-t}function d(e,t){return e+t>>>0}function p(e,t,i){return e+t+i>>>0}function b(e,t,i,r){return e+t+i+r>>>0}function m(e,t,i,r,n){return e+t+i+r+n>>>0}function w(e,t){if(!e)throw new Error(t||"Assertion failed")}function g(e,t,i,r){var n=e[t],s=e[t+1],a=r+s>>>0,o=(a>>0,e[t+1]=a}function v(e,t,i,r){var n=t+r>>>0,s=(n>>0}function _(e,t,i,r){var n=t+r;return n>>>0}function y(e,t,i,r,n,s,a,o){var f=0,h=t;h=h+r>>>0,f+=h>>0,f+=h>>0,f+=h>>0}function k(e,t,i,r,n,s,a,o){var f=t+r+s+o;return f>>>0}function E(e,t,i,r,n,s,a,o,f,h){var c=0,l=t;l=l+r>>>0,c+=l>>0,c+=l>>0,c+=l>>0,c+=l>>0}function A(e,t,i,r,n,s,a,o,f,h){var c=t+r+s+o+h;return c>>>0}function S(e,t,i){var r=t<<32-i|e>>>i;return r>>>0}function M(e,t,i){var r=e<<32-i|t>>>i;return r>>>0}function T(e,t,i){return e>>>i}function R(e,t,i){var r=e<<32-i|t>>>i;return r>>>0}var x=t,C=i(1);x.toArray=r,x.toHex=n,x.htonl=s,x.toHex32=a,x.zero2=o,x.zero8=f,x.join32=h,x.split32=c,x.rotr32=l,x.rotl32=u,x.sum32=d,x.sum32_3=p,x.sum32_4=b,x.sum32_5=m,x.assert=w,x.inherits=C,t.sum64=g,t.sum64_hi=v,t.sum64_lo=_,t.sum64_4_hi=y,t.sum64_4_lo=k,t.sum64_5_hi=E,t.sum64_5_lo=A,t.rotr64_hi=S,t.rotr64_lo=M,t.shr64_hi=T,t.shr64_lo=R},function(e,t,i){var r=i(9),n=i(197),s=i(138),a=i(1),o=e.exports=function(e,t){var i=this;i.writable=!0,i.xhr=e,i.body=[],i.uri=(t.protocol||"http:")+"//"+t.host+(t.port?":"+t.port:"")+(t.path||"/"),"undefined"==typeof t.withCredentials&&(t.withCredentials=!0);try{e.withCredentials=t.withCredentials}catch(e){}if(t.responseType)try{e.responseType=t.responseType}catch(e){}if(e.open(t.method||"GET",i.uri,!0),e.onerror=function(e){i.emit("error",new Error("Network error"))},i._headers={},t.headers)for(var r=f(t.headers),a=0;athis.offset&&(this.emit("data",t.slice(this.offset)),this.offset=t.length))};var f=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}},function(e,t){t.read=function(e,t,i,r,n){var s,a,o=8*n-r-1,f=(1<>1,c=-7,l=i?n-1:0,u=i?-1:1,d=e[t+l];for(l+=u,s=d&(1<<-c)-1,d>>=-c,c+=o;c>0;s=256*s+e[t+l],l+=u,c-=8);for(a=s&(1<<-c)-1,s>>=-c,c+=r;c>0;a=256*a+e[t+l],l+=u,c-=8);if(0===s)s=1-h;else{if(s===f)return a?NaN:(d?-1:1)*(1/0);a+=Math.pow(2,r),s-=h}return(d?-1:1)*a*Math.pow(2,s-r)},t.write=function(e,t,i,r,n,s){var a,o,f,h=8*s-n-1,c=(1<>1,u=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,d=r?0:s-1,p=r?1:-1,b=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(o=isNaN(t)?1:0,a=c):(a=Math.floor(Math.log(t)/Math.LN2),t*(f=Math.pow(2,-a))<1&&(a--,f*=2),t+=a+l>=1?u/f:u*Math.pow(2,1-l),t*f>=2&&(a++,f/=2),a+l>=c?(o=0,a=c):a+l>=1?(o=(t*f-1)*Math.pow(2,n),a+=l):(o=t*Math.pow(2,l-1)*Math.pow(2,n),a=0));n>=8;e[i+d]=255&o,d+=p,o/=256,n-=8);for(a=a<0;e[i+d]=255&a,d+=p,a/=256,h-=8);e[i+d-p]|=128*b}},function(e,t){var i=[].indexOf;e.exports=function(e,t){if(i)return e.indexOf(t);for(var r=0;r=6.0.0 <7.0.0",type:"range"},"/home/travis/build/hydrabolt/discord.js/node_modules/browserify-sign"]],_from:"elliptic@>=6.0.0 <7.0.0",_id:"elliptic@6.3.2",_inCache:!0,_location:"/elliptic",_nodeVersion:"6.3.0",_npmOperationalInternal:{host:"packages-16-east.internal.npmjs.com",tmp:"tmp/elliptic-6.3.2.tgz_1473938837205_0.3108903462998569"},_npmUser:{name:"indutny",email:"fedor@indutny.com"},_npmVersion:"3.10.3",_phantomChildren:{},_requested:{raw:"elliptic@^6.0.0",scope:null,escapedName:"elliptic",name:"elliptic",rawSpec:"^6.0.0",spec:">=6.0.0 <7.0.0",type:"range"},_requiredBy:["/browserify-sign","/create-ecdh"],_resolved:"https://registry.npmjs.org/elliptic/-/elliptic-6.3.2.tgz",_shasum:"e4c81e0829cf0a65ab70e998b8232723b5c1bc48",_shrinkwrap:null,_spec:"elliptic@^6.0.0",_where:"/home/travis/build/hydrabolt/discord.js/node_modules/browserify-sign",author:{name:"Fedor Indutny",email:"fedor@indutny.com"},bugs:{url:"https://github.com/indutny/elliptic/issues"},dependencies:{"bn.js":"^4.4.0",brorand:"^1.0.1","hash.js":"^1.0.0",inherits:"^2.0.1"},description:"EC cryptography",devDependencies:{brfs:"^1.4.3",coveralls:"^2.11.3",grunt:"^0.4.5","grunt-browserify":"^5.0.0","grunt-contrib-connect":"^1.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^1.0.1","grunt-mocha-istanbul":"^3.0.1","grunt-saucelabs":"^8.6.2",istanbul:"^0.4.2",jscs:"^2.9.0",jshint:"^2.6.0",mocha:"^2.1.0"},directories:{},dist:{shasum:"e4c81e0829cf0a65ab70e998b8232723b5c1bc48",tarball:"https://registry.npmjs.org/elliptic/-/elliptic-6.3.2.tgz"},files:["lib"],gitHead:"cbace4683a4a548dc0306ef36756151a20299cd5",homepage:"https://github.com/indutny/elliptic",keywords:["EC","Elliptic","curve","Cryptography"],license:"MIT",main:"lib/elliptic.js",maintainers:[{name:"indutny",email:"fedor@indutny.com"}],name:"elliptic",optionalDependencies:{},readme:"ERROR: No README data found!",repository:{type:"git",url:"git+ssh://git@github.com/indutny/elliptic.git"},scripts:{jscs:"jscs benchmarks/*.js lib/*.js lib/**/*.js lib/**/**/*.js test/index.js",jshint:"jscs benchmarks/*.js lib/*.js lib/**/*.js lib/**/**/*.js test/index.js",lint:"npm run jscs && npm run jshint",test:"npm run lint && npm run unit",unit:"istanbul test _mocha --reporter=spec test/index.js",version:"grunt dist && git add dist/"},version:"6.3.2"}},function(e,t){e.exports={"2.16.840.1.101.3.4.1.1":"aes-128-ecb","2.16.840.1.101.3.4.1.2":"aes-128-cbc","2.16.840.1.101.3.4.1.3":"aes-128-ofb","2.16.840.1.101.3.4.1.4":"aes-128-cfb","2.16.840.1.101.3.4.1.21":"aes-192-ecb","2.16.840.1.101.3.4.1.22":"aes-192-cbc","2.16.840.1.101.3.4.1.23":"aes-192-ofb","2.16.840.1.101.3.4.1.24":"aes-192-cfb","2.16.840.1.101.3.4.1.41":"aes-256-ecb","2.16.840.1.101.3.4.1.42":"aes-256-cbc","2.16.840.1.101.3.4.1.43":"aes-256-ofb","2.16.840.1.101.3.4.1.44":"aes-256-cfb"}},function(module,exports,__webpack_require__){(function(process,__dirname){function globalEval(e){eval.call(null,e)}function assert(e,t){e||abort("Assertion failed: "+t)}function getCFunc(ident){var func=Module["_"+ident];if(!func)try{func=eval("_"+ident)}catch(e){}return assert(func,"Cannot call unknown function "+ident+" (perhaps LLVM optimizations or closure removed it?)"),func}function setValue(e,t,i,r){switch(i=i||"i8","*"===i.charAt(i.length-1)&&(i="i32"),i){case"i1":HEAP8[e>>0]=t;break;case"i8":HEAP8[e>>0]=t;break;case"i16":HEAP16[e>>1]=t;break;case"i32":HEAP32[e>>2]=t;break;case"i64":tempI64=[t>>>0,(tempDouble=t,+Math_abs(tempDouble)>=1?tempDouble>0?(0|Math_min(+Math_floor(tempDouble/4294967296),4294967295))>>>0:~~+Math_ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[e>>2]=tempI64[0],HEAP32[e+4>>2]=tempI64[1];break;case"float":HEAPF32[e>>2]=t;break;case"double":HEAPF64[e>>3]=t;break;default:abort("invalid type for setValue: "+i)}}function getValue(e,t,i){switch(t=t||"i8","*"===t.charAt(t.length-1)&&(t="i32"),t){case"i1":return HEAP8[e>>0];case"i8":return HEAP8[e>>0];case"i16":return HEAP16[e>>1];case"i32":return HEAP32[e>>2];case"i64":return HEAP32[e>>2];case"float":return HEAPF32[e>>2];case"double":return HEAPF64[e>>3];default:abort("invalid type for setValue: "+t)}return null}function allocate(e,t,i,r){var n,s;"number"==typeof e?(n=!0,s=e):(n=!1,s=e.length);var a,o="string"==typeof t?t:null;if(a=i==ALLOC_NONE?r:["function"==typeof _malloc?_malloc:Runtime.staticAlloc,Runtime.stackAlloc,Runtime.staticAlloc,Runtime.dynamicAlloc][void 0===i?ALLOC_STATIC:i](Math.max(s,o?1:t.length)),n){var f,r=a;for(assert(0==(3&a)),f=a+(s&-4);r>2]=0;for(f=a+s;r>0]=0;return a}if("i8"===o)return e.subarray||e.slice?HEAPU8.set(e,a):HEAPU8.set(new Uint8Array(e),a),a;for(var h,c,l,u=0;u>0],r|=i,0==i&&!t)break;if(n++,t&&n==t)break}t||(t=n);var s="";if(r<128){for(var a,o=1024;t>0;)a=String.fromCharCode.apply(String,HEAPU8.subarray(e,e+Math.min(t,o))),s=s?s+a:a,e+=o,t-=o;return s}return Module.UTF8ToString(e)}function UTF8ArrayToString(e,t){for(var i,r,n,s,a,o,f="";;){if(i=e[t++],!i)return f;if(128&i)if(r=63&e[t++],192!=(224&i))if(n=63&e[t++],224==(240&i)?i=(15&i)<<12|r<<6|n:(s=63&e[t++],240==(248&i)?i=(7&i)<<18|r<<12|n<<6|s:(a=63&e[t++],248==(252&i)?i=(3&i)<<24|r<<18|n<<12|s<<6|a:(o=63&e[t++],i=(1&i)<<30|r<<24|n<<18|s<<12|a<<6|o))),i<65536)f+=String.fromCharCode(i);else{var h=i-65536;f+=String.fromCharCode(55296|h>>10,56320|1023&h)}else f+=String.fromCharCode((31&i)<<6|r);else f+=String.fromCharCode(i)}}function stringToUTF8Array(e,t,i,r){if(!(r>0))return 0;for(var n=i,s=i+r-1,a=0;a=55296&&o<=57343&&(o=65536+((1023&o)<<10)|1023&e.charCodeAt(++a)),o<=127){if(i>=s)break;t[i++]=o}else if(o<=2047){if(i+1>=s)break;t[i++]=192|o>>6,t[i++]=128|63&o}else if(o<=65535){if(i+2>=s)break;t[i++]=224|o>>12,t[i++]=128|o>>6&63,t[i++]=128|63&o}else if(o<=2097151){if(i+3>=s)break;t[i++]=240|o>>18,t[i++]=128|o>>12&63,t[i++]=128|o>>6&63,t[i++]=128|63&o}else if(o<=67108863){if(i+4>=s)break;t[i++]=248|o>>24,t[i++]=128|o>>18&63,t[i++]=128|o>>12&63,t[i++]=128|o>>6&63,t[i++]=128|63&o}else{if(i+5>=s)break;t[i++]=252|o>>30,t[i++]=128|o>>24&63,t[i++]=128|o>>18&63,t[i++]=128|o>>12&63,t[i++]=128|o>>6&63,t[i++]=128|63&o}}return t[i]=0,i-n}function lengthBytesUTF8(e){for(var t=0,i=0;i=55296&&r<=57343&&(r=65536+((1023&r)<<10)|1023&e.charCodeAt(++i)),r<=127?++t:t+=r<=2047?2:r<=65535?3:r<=2097151?4:r<=67108863?5:6}return t}function demangle(e){var t=!!Module.___cxa_demangle;if(t)try{var i=_malloc(e.length);writeStringToMemory(e.substr(1),i);var r=_malloc(4),n=Module.___cxa_demangle(i,0,0,r);if(0===getValue(r,"i32")&&n)return Pointer_stringify(n)}catch(t){return e}finally{i&&_free(i),r&&_free(r),n&&_free(n)}return Runtime.warnOnce("warning: build with -s DEMANGLE_SUPPORT=1 to link in libcxxabi demangling"),e}function demangleAll(e){return e.replace(/__Z[\w\d_]+/g,function(e){var t=demangle(e);return e===t?e:e+" ["+t+"]"})}function jsStackTrace(){var e=new Error;if(!e.stack){try{throw new Error(0)}catch(t){e=t}if(!e.stack)return"(no stack trace available)"}return e.stack.toString()}function stackTrace(){return demangleAll(jsStackTrace())}function alignMemoryPage(e){return e%4096>0&&(e+=4096-e%4096),e}function updateGlobalBufferViews(){Module.HEAP8=HEAP8=new Int8Array(buffer),Module.HEAP16=HEAP16=new Int16Array(buffer),Module.HEAP32=HEAP32=new Int32Array(buffer),Module.HEAPU8=HEAPU8=new Uint8Array(buffer),Module.HEAPU16=HEAPU16=new Uint16Array(buffer),Module.HEAPU32=HEAPU32=new Uint32Array(buffer),Module.HEAPF32=HEAPF32=new Float32Array(buffer),Module.HEAPF64=HEAPF64=new Float64Array(buffer)}function abortOnCannotGrowMemory(){abort("Cannot enlarge memory arrays. Either (1) compile with -s TOTAL_MEMORY=X with X higher than the current value "+TOTAL_MEMORY+", (2) compile with -s ALLOW_MEMORY_GROWTH=1 which adjusts the size at runtime but prevents some optimizations, (3) set Module.TOTAL_MEMORY to a higher value before the program runs, or if you want malloc to return NULL (0) instead of this abort, compile with -s ABORTING_MALLOC=0 ")}function enlargeMemory(){abortOnCannotGrowMemory()}function callRuntimeCallbacks(e){for(;e.length>0;){var t=e.shift();if("function"!=typeof t){var i=t.func;"number"==typeof i?void 0===t.arg?Runtime.dynCall("v",i):Runtime.dynCall("vi",i,[t.arg]):i(void 0===t.arg?null:t.arg)}else t()}}function preRun(){if(Module.preRun)for("function"==typeof Module.preRun&&(Module.preRun=[Module.preRun]);Module.preRun.length;)addOnPreRun(Module.preRun.shift());callRuntimeCallbacks(__ATPRERUN__)}function ensureInitRuntime(){runtimeInitialized||(runtimeInitialized=!0,callRuntimeCallbacks(__ATINIT__))}function preMain(){callRuntimeCallbacks(__ATMAIN__)}function exitRuntime(){callRuntimeCallbacks(__ATEXIT__),runtimeExited=!0}function postRun(){if(Module.postRun)for("function"==typeof Module.postRun&&(Module.postRun=[Module.postRun]);Module.postRun.length;)addOnPostRun(Module.postRun.shift());callRuntimeCallbacks(__ATPOSTRUN__)}function addOnPreRun(e){__ATPRERUN__.unshift(e)}function addOnPostRun(e){__ATPOSTRUN__.unshift(e)}function intArrayFromString(e,t,i){var r=i>0?i:lengthBytesUTF8(e)+1,n=new Array(r),s=stringToUTF8Array(e,n,0,n.length);return t&&(n.length=s),n}function writeStringToMemory(e,t,i){for(var r=intArrayFromString(e,i),n=0;n>0]=s,n+=1}}function writeArrayToMemory(e,t){for(var i=0;i>0]=e[i]}function writeAsciiToMemory(e,t,i){for(var r=0;r>0]=e.charCodeAt(r);i||(HEAP8[t>>0]=0)}function ___setErrNo(e){return Module.___errno_location&&(HEAP32[Module.___errno_location()>>2]=e),e}function _sysconf(e){switch(e){case 30:return PAGE_SIZE;case 85:return totalMemory/PAGE_SIZE;case 132:case 133:case 12:case 137:case 138:case 15:case 235:case 16:case 17:case 18:case 19:case 20:case 149:case 13:case 10:case 236:case 153:case 9:case 21:case 22:case 159:case 154:case 14:case 77:case 78:case 139:case 80:case 81:case 82:case 68:case 67:case 164:case 11:case 29:case 47:case 48:case 95:case 52:case 51:case 46:return 200809;case 79:return 0;case 27:case 246:case 127:case 128:case 23:case 24:case 160:case 161:case 181:case 182:case 242:case 183:case 184:case 243:case 244:case 245:case 165:case 178:case 179:case 49:case 50:case 168:case 169:case 175:case 170:case 171:case 172:case 97:case 76:case 32:case 173:case 35:return-1;case 176:case 177:case 7:case 155:case 8:case 157:case 125:case 126:case 92:case 93:case 129:case 130:case 131:case 94:case 91:return 1;case 74:case 60:case 69:case 70:case 4:return 1024;case 31:case 42:case 72:return 32;case 87:case 26:case 33:return 2147483647;case 34:case 1:return 47839;case 38:case 36:return 99;case 43:case 37:return 2048;case 0:return 2097152;case 3:return 65536;case 28:return 32768;case 44:return 32767;case 75:return 16384;case 39:return 1e3;case 89:return 700;case 71:return 256;case 40:return 255;case 2:return 100;case 180:return 64;case 25:return 20;case 5:return 16;case 6:return 6;case 73:return 4;case 84:return"object"==typeof navigator?navigator.hardwareConcurrency||1:1}return ___setErrNo(ERRNO_CODES.EINVAL),-1}function embind_init_charCodes(){for(var e=new Array(256),t=0;t<256;++t)e[t]=String.fromCharCode(t);embind_charCodes=e}function readLatin1String(e){for(var t="",i=e;HEAPU8[i];)t+=embind_charCodes[HEAPU8[i++]];return t}function makeLegalFunctionName(e){if(void 0===e)return"_unknown";e=e.replace(/[^a-zA-Z0-9_]/g,"$");var t=e.charCodeAt(0);return t>=char_0&&t<=char_9?"_"+e:e}function createNamedFunction(e,t){return e=makeLegalFunctionName(e),new Function("body","return function "+e+'() {\n "use strict"; return body.apply(this, arguments);\n};\n')(t)}function extendError(e,t){var i=createNamedFunction(t,function(e){this.name=t,this.message=e;var i=new Error(e).stack;void 0!==i&&(this.stack=this.toString()+"\n"+i.replace(/^Error(:[^\n]*)?\n/,""))});return i.prototype=Object.create(e.prototype),i.prototype.constructor=i,i.prototype.toString=function(){return void 0===this.message?this.name:this.name+": "+this.message},i}function throwBindingError(e){throw new BindingError(e)}function throwInternalError(e){throw new InternalError(e)}function whenDependentTypesAreResolved(e,t,i){function r(t){var r=i(t);r.length!==e.length&&throwInternalError("Mismatched type converter count");for(var n=0;n>2]=e,e=___cxa_find_matching_catch.buffer;for(var n=0;n>2],t.adjusted=e,0|(asm.setTempRet0(r[n]),e);return e=HEAP32[e>>2],0|(asm.setTempRet0(i),e)}function ___cxa_throw(e,t,i){throw EXCEPTIONS.infos[e]={ptr:e,adjusted:e,type:t,destructor:i,refcount:0},EXCEPTIONS.last=e,"uncaught_exception"in __ZSt18uncaught_exceptionv?__ZSt18uncaught_exceptionv.uncaught_exception++:__ZSt18uncaught_exceptionv.uncaught_exception=1,e+" - Exception catching is disabled, this exception cannot be caught. Compile with -s DISABLE_EXCEPTION_CATCHING=0 or DISABLE_EXCEPTION_CATCHING=2 to catch."}function getShiftFromSize(e){switch(e){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+e)}}function __embind_register_bool(e,t,i,r,n){var s=getShiftFromSize(i);t=readLatin1String(t),registerType(e,{name:t,fromWireType:function(e){return!!e},toWireType:function(e,t){return t?r:n},argPackAdvance:8,readValueFromPointer:function(e){var r;if(1===i)r=HEAP8;else if(2===i)r=HEAP16;else{if(4!==i)throw new TypeError("Unknown boolean type size: "+t);r=HEAP32}return this.fromWireType(r[e>>s])},destructorFunction:null})}function _abort(){Module.abort()}function _free(){}function _malloc(e){var t=Runtime.dynamicAlloc(e+8);return t+8&4294967288}function simpleReadValueFromPointer(e){return this.fromWireType(HEAPU32[e>>2])}function __embind_register_std_string(e,t){t=readLatin1String(t),registerType(e,{name:t,fromWireType:function(e){for(var t=HEAPU32[e>>2],i=new Array(t),r=0;r>2]=s;for(var o=0;o255&&(_free(a),throwBindingError("String has UTF-16 code units that do not fit in 8 bits")),HEAPU8[a+4+o]=f}return null!==e&&e.push(_free,a),a},argPackAdvance:8,readValueFromPointer:simpleReadValueFromPointer,destructorFunction:function(e){_free(e)}})}function __embind_register_std_wstring(e,t,i){i=readLatin1String(i);var r,n;2===t?(r=function(){return HEAPU16},n=1):4===t&&(r=function(){return HEAPU32},n=2),registerType(e,{name:i,fromWireType:function(e){for(var t=r(),i=HEAPU32[e>>2],s=new Array(i),a=e+4>>n,o=0;o>2]=a;for(var f=o+4>>n,h=0;h>1]}:function(e){return HEAPU16[e>>1]};case 2:return i?function(e){return HEAP32[e>>2]}:function(e){return HEAPU32[e>>2]};default:throw new TypeError("Unknown integer type: "+e)}}function __embind_register_integer(e,t,i,r,n){t=readLatin1String(t),n===-1&&(n=4294967295);var s=getShiftFromSize(i),a=function(e){return e};if(0===r){var o=32-8*i;a=function(e){return e<>>o}}registerType(e,{name:t,fromWireType:a,toWireType:function(e,i){if("number"!=typeof i&&"boolean"!=typeof i)throw new TypeError('Cannot convert "'+_embind_repr(i)+'" to '+this.name);if(in)throw new TypeError('Passing a number "'+_embind_repr(i)+'" from JS side to C/C++ side to an argument of type "'+t+'", which is outside the valid range ['+r+", "+n+"]!");return 0|i},argPackAdvance:8,readValueFromPointer:integerReadValueFromPointer(t,s,0!==r),destructorFunction:null})}function __emval_decref(e){e>4&&0===--emval_handle_array[e].refcount&&(emval_handle_array[e]=void 0,emval_free_list.push(e))}function count_emval_handles(){for(var e=0,t=5;t>=2;var t=HEAPU32,i=t[e],r=t[e+1];return new s(t.buffer,r,i)}var n=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],s=n[t];i=readLatin1String(i),registerType(e,{name:i,fromWireType:r,argPackAdvance:8,readValueFromPointer:r},{ignoreDuplicateRegistrations:!0})}function floatReadValueFromPointer(e,t){switch(t){case 2:return function(e){return this.fromWireType(HEAPF32[e>>2])};case 3:return function(e){return this.fromWireType(HEAPF64[e>>3])};default:throw new TypeError("Unknown float type: "+e)}}function __embind_register_float(e,t,i){var r=getShiftFromSize(i);t=readLatin1String(t),registerType(e,{name:t,fromWireType:function(e){return e},toWireType:function(e,t){if("number"!=typeof t&&"boolean"!=typeof t)throw new TypeError('Cannot convert "'+_embind_repr(t)+'" to '+this.name);return t},argPackAdvance:8,readValueFromPointer:floatReadValueFromPointer(t,r),destructorFunction:null})}function _emscripten_memcpy_big(e,t,i){return HEAPU8.set(HEAPU8.subarray(t,t+i),e),e}function _llvm_stackrestore(e){var t=_llvm_stacksave,i=t.LLVM_SAVEDSTACKS[e];t.LLVM_SAVEDSTACKS.splice(e,1),Runtime.stackRestore(i)}function _sbrk(e){var t=_sbrk;t.called||(DYNAMICTOP=alignMemoryPage(DYNAMICTOP),t.called=!0,assert(Runtime.dynamicAlloc),t.alloc=Runtime.dynamicAlloc,Runtime.dynamicAlloc=function(){abort("cannot dynamically allocate, sbrk now has control")});var i=DYNAMICTOP;if(0!=e){var r=t.alloc(e);if(!r)return-1>>>0}return i}function _llvm_stacksave(){var e=_llvm_stacksave;return e.LLVM_SAVEDSTACKS||(e.LLVM_SAVEDSTACKS=[]),e.LLVM_SAVEDSTACKS.push(Runtime.stackSave()),e.LLVM_SAVEDSTACKS.length-1}function ___gxx_personality_v0(){}function heap32VectorToArray(e,t){for(var i=[],r=0;r>2)+r]);return i}function runDestructors(e){for(;e.length;){var t=e.pop(),i=e.pop();i(t)}}function __embind_register_class_constructor(e,t,i,r,n,s){var a=heap32VectorToArray(t,i);n=requireFunction(r,n),whenDependentTypesAreResolved([],[e],function(e){e=e[0];var i="constructor "+e.name;if(void 0===e.registeredClass.constructor_body&&(e.registeredClass.constructor_body=[]),void 0!==e.registeredClass.constructor_body[t-1])throw new BindingError("Cannot register multiple constructors with identical number of parameters ("+(t-1)+") for class '"+e.name+"'! Overload resolution is currently only performed using the parameter count, not actual type info!");return e.registeredClass.constructor_body[t-1]=function(){throwUnboundTypeError("Cannot construct "+e.name+" due to unbound types",a)},whenDependentTypesAreResolved([],a,function(r){return e.registeredClass.constructor_body[t-1]=function(){arguments.length!==t-1&&throwBindingError(i+" called with "+arguments.length+" arguments, expected "+(t-1));var e=[],a=new Array(t);a[0]=s;for(var o=1;o>2]=t),t}function _pthread_self(){return 0}function new_(e,t){if(!(e instanceof Function))throw new TypeError("new_ called with constructor type "+typeof e+" which is not a function");var i=createNamedFunction(e.name||"unknownFunctionName",function(){});i.prototype=e.prototype;var r=new i,n=e.apply(r,t);return n instanceof Object?n:r}function craftInvokerFunction(e,t,i,r,n){var s=t.length;s<2&&throwBindingError("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var a=null!==t[1]&&null!==i,o="",f="",h=0;h0?", ":"")+f);var b="void"!==t[0].name;if(c+=(b?"var rv = ":"")+"invoker(fn"+(f.length>0?", ":"")+f+");\n",l)c+="runDestructors(destructors);\n";else for(var h=a?1:2;h0||(preRun(),runDependencies>0||Module.calledRun||(Module.setStatus?(Module.setStatus("Running..."),setTimeout(function(){setTimeout(function(){Module.setStatus("")},1),t()},1)):t()))}function exit(e,t){if(!t||!Module.noExitRuntime)throw Module.noExitRuntime||(ABORT=!0,EXITSTATUS=e,STACKTOP=initialStackTop,exitRuntime(),Module.onExit&&Module.onExit(e)),ENVIRONMENT_IS_NODE?process.exit(e):ENVIRONMENT_IS_SHELL&&"function"==typeof quit&&quit(e),new ExitStatus(e)}function abort(e){void 0!==e?(Module.print(e),Module.printErr(e),e=JSON.stringify(e)):e="",ABORT=!0,EXITSTATUS=1;var t="\nIf this abort() is unexpected, build with -s ASSERTIONS=1 which can give more information.",i="abort("+e+") at "+stackTrace()+t;throw abortDecorators&&abortDecorators.forEach(function(t){i=t(i,e)}),i}var Module;Module||(Module=("undefined"!=typeof Module?Module:null)||{});var moduleOverrides={};for(var key in Module)Module.hasOwnProperty(key)&&(moduleOverrides[key]=Module[key]);var ENVIRONMENT_IS_WEB=!1,ENVIRONMENT_IS_WORKER=!1,ENVIRONMENT_IS_NODE=!1,ENVIRONMENT_IS_SHELL=!1;if(Module.ENVIRONMENT)if("WEB"===Module.ENVIRONMENT)ENVIRONMENT_IS_WEB=!0;else if("WORKER"===Module.ENVIRONMENT)ENVIRONMENT_IS_WORKER=!0;else if("NODE"===Module.ENVIRONMENT)ENVIRONMENT_IS_NODE=!0;else{if("SHELL"!==Module.ENVIRONMENT)throw new Error("The provided Module['ENVIRONMENT'] value is not valid. It must be one of: WEB|WORKER|NODE|SHELL.");ENVIRONMENT_IS_SHELL=!0}else ENVIRONMENT_IS_WEB="object"==typeof window,ENVIRONMENT_IS_WORKER="function"==typeof importScripts,ENVIRONMENT_IS_NODE="object"==typeof process&&!0&&!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_WORKER,ENVIRONMENT_IS_SHELL=!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_NODE&&!ENVIRONMENT_IS_WORKER;if(ENVIRONMENT_IS_NODE){Module.print||(Module.print=console.log),Module.printErr||(Module.printErr=console.warn);var nodeFS,nodePath;Module.read=function(e,t){nodeFS||(nodeFS=__webpack_require__(10)),nodePath||(nodePath=__webpack_require__(14)),e=nodePath.normalize(e);var i=nodeFS.readFileSync(e);return i||e==nodePath.resolve(e)||(e=path.join(__dirname,"..","src",e),i=nodeFS.readFileSync(e)),i&&!t&&(i=i.toString()),i},Module.readBinary=function(e){var t=Module.read(e,!0);return t.buffer||(t=new Uint8Array(t)),assert(t.buffer),t},Module.load=function(e){globalEval(read(e))},Module.thisProgram||(process.argv.length>1?Module.thisProgram=process.argv[1].replace(/\\/g,"/"):Module.thisProgram="unknown-program"),Module.arguments=process.argv.slice(2),module.exports=Module,Module.inspect=function(){return"[Emscripten Module object]"}}else if(ENVIRONMENT_IS_SHELL)Module.print||(Module.print=print),"undefined"!=typeof printErr&&(Module.printErr=printErr),"undefined"!=typeof read?Module.read=read:Module.read=function(){throw"no read() available (jsc?)"},Module.readBinary=function(e){if("function"==typeof readbuffer)return new Uint8Array(readbuffer(e));var t=read(e,"binary");return assert("object"==typeof t),t},"undefined"!=typeof scriptArgs?Module.arguments=scriptArgs:"undefined"!=typeof arguments&&(Module.arguments=arguments);else{if(!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_WORKER)throw"Unknown runtime environment. Where are we?";if(Module.read=function(e){var t=new XMLHttpRequest;return t.open("GET",e,!1),t.send(null),t.responseText},Module.readAsync=function(e,t,i){var r=new XMLHttpRequest;r.open("GET",e,!0),r.responseType="arraybuffer",r.onload=function(){200==r.status||0==r.status&&r.response?t(r.response):i()},r.onerror=i,r.send(null)},"undefined"!=typeof arguments&&(Module.arguments=arguments),"undefined"!=typeof console)Module.print||(Module.print=function(e){console.log(e)}),Module.printErr||(Module.printErr=function(e){console.warn(e)});else{var TRY_USE_DUMP=!1;Module.print||(Module.print=TRY_USE_DUMP&&"undefined"!=typeof dump?function(e){dump(e)}:function(e){})}ENVIRONMENT_IS_WORKER&&(Module.load=importScripts),"undefined"==typeof Module.setWindowTitle&&(Module.setWindowTitle=function(e){document.title=e})}!Module.load&&Module.read&&(Module.load=function(e){globalEval(Module.read(e))}),Module.print||(Module.print=function(){}),Module.printErr||(Module.printErr=Module.print),Module.arguments||(Module.arguments=[]),Module.thisProgram||(Module.thisProgram="./this.program"),Module.print=Module.print,Module.printErr=Module.printErr,Module.preRun=[],Module.postRun=[];for(var key in moduleOverrides)moduleOverrides.hasOwnProperty(key)&&(Module[key]=moduleOverrides[key]);moduleOverrides=void 0;var Runtime={setTempRet0:function(e){tempRet0=e},getTempRet0:function(){return tempRet0},stackSave:function(){return STACKTOP},stackRestore:function(e){STACKTOP=e},getNativeTypeSize:function(e){switch(e){case"i1":case"i8":return 1;case"i16":return 2;case"i32":return 4;case"i64":return 8;case"float":return 4;case"double":return 8;default:if("*"===e[e.length-1])return Runtime.QUANTUM_SIZE;if("i"===e[0]){var t=parseInt(e.substr(1));return assert(t%8===0),t/8}return 0}},getNativeFieldSize:function(e){return Math.max(Runtime.getNativeTypeSize(e),Runtime.QUANTUM_SIZE)},STACK_ALIGN:16,prepVararg:function(e,t){return"double"===t||"i64"===t?7&e&&(assert(4===(7&e)),e+=4):assert(0===(3&e)),e},getAlignSize:function(e,t,i){return i||"i64"!=e&&"double"!=e?e?Math.min(t||(e?Runtime.getNativeFieldSize(e):0),Runtime.QUANTUM_SIZE):Math.min(t,8):8},dynCall:function(e,t,i){return i&&i.length?(i.splice||(i=Array.prototype.slice.call(i)),i.splice(0,0,t),Module["dynCall_"+e].apply(null,i)):Module["dynCall_"+e].call(null,t)},functionPointers:[],addFunction:function(e){for(var t=0;t=TOTAL_MEMORY){var i=enlargeMemory();if(!i)return DYNAMICTOP=t,0}return t},alignMemory:function(e,t){var i=e=Math.ceil(e/(t?t:16))*(t?t:16);return i},makeBigInt:function(e,t,i){var r=i?+(e>>>0)+4294967296*+(t>>>0):+(e>>>0)+4294967296*+(0|t);return r},GLOBAL_BASE:8,QUANTUM_SIZE:4,__dummy__:0},ABORT=!1,EXITSTATUS=0,ccall;!function(){function parseJSFunc(e){var t=e.toString().match(sourceRegex).slice(1);return{arguments:t[0],body:t[1],returnValue:t[2]}}function ensureJSsource(){if(!JSsource){JSsource={};for(var e in JSfuncs)JSfuncs.hasOwnProperty(e)&&(JSsource[e]=parseJSFunc(JSfuncs[e]))}}var JSfuncs={stackSave:function(){Runtime.stackSave()},stackRestore:function(){Runtime.stackRestore()},arrayToC:function(e){var t=Runtime.stackAlloc(e.length);return writeArrayToMemory(e,t),t},stringToC:function(e){var t=0;return null!==e&&void 0!==e&&0!==e&&(t=Runtime.stackAlloc((e.length<<2)+1),writeStringToMemory(e,t)),t}},toC={string:JSfuncs.stringToC,array:JSfuncs.arrayToC};ccall=function(e,t,i,r,n){var s=getCFunc(e),a=[],o=0;if(r)for(var f=0;f>>16,r=65535&e,n=t>>>16,s=65535&t;return r*s+(i*s+r*n<<16)|0}),Math.imul=Math.imul,Math.clz32||(Math.clz32=function(e){e>>>=0;for(var t=0;t<32;t++)if(e&1<<31-t)return t; +return 32}),Math.clz32=Math.clz32;var Math_abs=Math.abs,Math_cos=Math.cos,Math_sin=Math.sin,Math_tan=Math.tan,Math_acos=Math.acos,Math_asin=Math.asin,Math_atan=Math.atan,Math_atan2=Math.atan2,Math_exp=Math.exp,Math_log=Math.log,Math_sqrt=Math.sqrt,Math_ceil=Math.ceil,Math_floor=Math.floor,Math_pow=Math.pow,Math_imul=Math.imul,Math_fround=Math.fround,Math_min=Math.min,Math_clz32=Math.clz32,runDependencies=0,runDependencyWatcher=null,dependenciesFulfilled=null;Module.preloadedImages={},Module.preloadedAudios={};var ASM_CONSTS=[];STATIC_BASE=8,STATICTOP=STATIC_BASE+35488,__ATINIT__.push({func:function(){__GLOBAL__sub_I_opusscript_encoder_cpp()}},{func:function(){__GLOBAL__sub_I_bind_cpp()}}),allocate([32,90,0,0,152,108,0,0,160,90,0,0,172,108,0,0,0,0,0,0,8,0,0,0,160,90,0,0,193,108,0,0,1,0,0,0,8,0,0,0,188,90,0,0,7,130,0,0,0,0,0,0,1,0,0,0,72,0,0,0,0,0,0,0,32,90,0,0,70,130,0,0,188,90,0,0,120,130,0,0,0,0,0,0,1,0,0,0,72,0,0,0,0,0,0,0,188,90,0,0,216,130,0,0,0,0,0,0,1,0,0,0,72,0,0,0,0,0,0,0,32,90,0,0,36,131,0,0,32,90,0,0,71,131,0,0,32,90,0,0,132,131,0,0,32,90,0,0,200,131,0,0,32,90,0,0,14,132,0,0,32,90,0,0,76,132,0,0,32,90,0,0,147,132,0,0,32,90,0,0,207,132,0,0,32,90,0,0,20,133,0,0,32,90,0,0,81,133,0,0,32,90,0,0,94,134,0,0,32,90,0,0,156,134,0,0,32,90,0,0,219,134,0,0,32,90,0,0,148,135,0,0,72,90,0,0,114,135,0,0,16,1,0,0,0,0,0,0,72,90,0,0,31,135,0,0,240,0,0,0,0,0,0,0,72,90,0,0,68,135,0,0,32,1,0,0,0,0,0,0,32,90,0,0,101,135,0,0,72,90,0,0,161,135,0,0,232,0,0,0,0,0,0,0,72,90,0,0,225,135,0,0,16,1,0,0,0,0,0,0,72,90,0,0,189,135,0,0,56,1,0,0,0,0,0,0,72,90,0,0,3,136,0,0,16,1,0,0,0,0,0,0,132,90,0,0,43,136,0,0,132,90,0,0,45,136,0,0,132,90,0,0,48,136,0,0,132,90,0,0,50,136,0,0,132,90,0,0,52,136,0,0,132,90,0,0,54,136,0,0,132,90,0,0,56,136,0,0,132,90,0,0,58,136,0,0,132,90,0,0,60,136,0,0,132,90,0,0,62,136,0,0,132,90,0,0,64,136,0,0,132,90,0,0,66,136,0,0,132,90,0,0,68,136,0,0,132,90,0,0,70,136,0,0,72,90,0,0,72,136,0,0,240,0,0,0,0,0,0,0,16,0,0,0,168,1,0,0,168,1,0,0,168,1,0,0,168,1,0,0,16,0,0,0,168,1,0,0,168,1,0,0,168,1,0,0,168,1,0,0,168,1,0,0,16,0,0,0,168,1,0,0,168,1,0,0,168,1,0,0,0,0,157,62,0,64,94,62,0,192,4,62,0,128,237,62,0,64,137,62,0,0,0,0,0,192,76,63,0,0,205,61,0,0,0,0,34,109,0,0,42,109,0,0,59,109,0,0,76,109,0,0,91,109,0,0,108,109,0,0,132,109,0,0,146,109,0,0,16,39,0,0,232,3,0,0,248,42,0,0,232,3,0,0,188,52,0,0,232,3,0,0,176,54,0,0,208,7,0,0,224,46,0,0,232,3,0,0,176,54,0,0,232,3,0,0,128,62,0,0,232,3,0,0,32,78,0,0,232,3,0,0,240,85,0,0,232,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,224,46,0,0,16,39,0,0,16,39,0,0,248,42,0,0,248,42,0,0,128,62,0,0,188,52,0,0,188,52,0,0,152,58,0,0,152,58,0,0,32,78,0,0,128,62,0,0,128,62,0,0,80,70,0,0,80,70,0,0,192,93,0,0,80,70,0,0,80,70,0,0,8,82,0,0,8,82,0,0,0,125,0,0,240,85,0,0,240,85,0,0,96,109,0,0,96,109,0,0,0,250,0,0,112,148,0,0,112,148,0,0,80,195,0,0,80,195,0,0,230,90,52,56,119,78,51,57,211,217,201,57,146,145,51,58,204,96,140,58,97,251,201,58,153,126,9,59,203,128,51,59,213,37,99,59,119,46,140,59,168,138,169,59,69,184,201,59,135,166,236,59,232,46,9,60,174,102,29,60,247,2,51,60,147,255,73,60,79,88,98,60,94,17,124,60,46,145,139,60,189,199,153,60,92,172,168,60,243,60,184,60,129,121,200,60,238,95,217,60,57,240,234,60,99,42,253,60,53,7,8,61,16,204,17,61,205,228,27,61,97,80,38,61,203,14,49,61,0,31,60,61,254,128,71,61,198,52,83,61,63,56,95,61,105,139,107,61,69,46,120,61,105,144,130,61,123,48,137,61,224,247,143,61,138,229,150,61,123,249,157,61,177,51,165,61,33,147,172,61,80,24,180,61,51,194,187,61,79,145,195,61,18,132,203,61,2,155,211,61,31,214,219,61,215,51,228,61,175,180,236,61,33,88,245,61,168,29,254,61,161,130,3,62,242,6,8,62,199,155,12,62,221,64,17,62,52,246,21,62,69,187,26,62,17,144,31,62,84,116,36,62,203,103,41,62,51,106,46,62,141,123,51,62,82,155,56,62,197,201,61,62,28,6,67,62,89,80,72,62,122,168,77,62,183,13,83,62,82,128,88,62,8,0,94,62,84,140,99,62,242,36,105,62,37,202,110,62,36,123,116,62,172,55,122,62,0,0,128,62,171,233,130,62,249,216,133,62,133,205,136,62,80,199,139,62,55,198,142,62,247,201,145,62,179,210,148,62,38,224,151,62,15,242,154,62,108,8,158,62,28,35,161,62,255,65,164,62,208,100,167,62,177,139,170,62,28,182,173,62,84,228,176,62,211,21,180,62,186,74,183,62,232,130,186,62,249,189,189,62,13,252,192,62,226,60,196,62,86,128,199,62,71,198,202,62,149,14,206,62,251,88,209,62,122,165,212,62,241,243,215,62,28,68,219,62,217,149,222,62,8,233,225,62,167,61,229,62,83,147,232,62,12,234,235,62,175,65,239,62,28,154,242,62,14,243,245,62,136,76,249,62,34,166,252,62,0,0,0,63,239,172,1,63,188,89,3,63,121,6,5,63,242,178,6,63,41,95,8,63,250,10,10,63,86,182,11,63,44,97,13,63,124,11,15,63,19,181,16,63,242,93,18,63,8,6,20,63,67,173,21,63,130,83,23,63,182,248,24,63,220,156,26,63,213,63,28,63,143,225,29,63,249,129,31,63,4,33,33,63,140,190,34,63,163,90,36,63,23,245,37,63,214,141,39,63,242,36,41,63,40,186,42,63,152,77,44,63,1,223,45,63,114,110,47,63,202,251,48,63,249,134,50,63,237,15,52,63,167,150,53,63,4,27,55,63,229,156,56,63,88,28,58,63,61,153,59,63,131,19,61,63,42,139,62,63,0,0,64,63,21,114,65,63,55,225,66,63,119,77,68,63,195,182,69,63,235,28,71,63,254,127,72,63,236,223,73,63,146,60,75,63,225,149,76,63,234,235,77,63,121,62,79,63,143,141,80,63,43,217,81,63,29,33,83,63,115,101,84,63,13,166,85,63,235,226,86,63,252,27,88,63,47,81,89,63,115,130,90,63,201,175,91,63,14,217,92,63,67,254,93,63,88,31,95,63,75,60,96,63,252,84,97,63,106,105,98,63,133,121,99,63,60,133,100,63,160,140,101,63,126,143,102,63,214,141,103,63,186,135,104,63,246,124,105,63,156,109,106,63,138,89,107,63,209,64,108,63,79,35,109,63,4,1,110,63,241,217,110,63,243,173,111,63,28,125,112,63,73,71,113,63,124,12,114,63,180,204,114,63,240,135,115,63,16,62,116,63,19,239,116,63,250,154,117,63,179,65,118,63,63,227,118,63,141,127,119,63,173,22,120,63,126,168,120,63,1,53,121,63,52,188,121,63,24,62,122,63,157,186,122,63,194,49,123,63,119,163,123,63,187,15,124,63,159,118,124,63,2,216,124,63,244,51,125,63,101,138,125,63,68,219,125,63,179,38,126,63,143,108,126,63,235,172,126,63,163,231,126,63,218,28,127,63,127,76,127,63,129,118,127,63,2,155,127,63,208,185,127,63,28,211,127,63,197,230,127,63,203,244,127,63,47,253,127,63,0,0,128,63,2,0,0,0,4,0,0,0,6,0,0,0,8,0,0,0,10,0,0,0,12,0,0,0,14,0,0,0,16,0,0,0,20,0,0,0,24,0,0,0,28,0,0,0,32,0,0,0,40,0,0,0,48,0,0,0,56,0,0,0,68,0,0,0,80,0,0,0,96,0,0,0,120,0,0,0,1,0,0,0,2,0,0,0,4,0,0,0,6,0,0,0,8,0,0,0,10,0,0,0,12,0,0,0,14,0,0,0,16,0,0,0,20,0,0,0,24,0,0,0,28,0,0,0,32,0,0,0,40,0,0,0,48,0,0,0,56,0,0,0,68,0,0,0,80,0,0,0,96,0,0,0,120,0,0,0,160,0,0,0,200,0,0,0,0,0,128,62,0,0,128,62,0,0,128,62,0,0,128,62,0,0,128,62,0,0,128,62,0,0,128,62,0,0,128,62,0,0,128,62,0,0,128,62,0,0,128,62,0,0,128,62,0,0,128,62,0,0,128,62,0,0,128,62,0,0,128,62,208,37,180,62,151,57,173,62,9,165,159,62,250,237,139,62,205,172,101,62,248,169,42,62,52,48,210,61,90,241,13,61,90,241,13,189,52,48,210,189,248,169,42,190,205,172,101,190,250,237,139,190,9,165,159,190,151,57,173,190,208,37,180,190,135,138,177,62,27,131,150,62,96,35,73,62,196,66,141,61,196,66,141,189,96,35,73,190,27,131,150,190,135,138,177,190,135,138,177,190,27,131,150,190,96,35,73,190,196,66,141,189,196,66,141,61,96,35,73,62,27,131,150,62,135,138,177,62,151,57,173,62,205,172,101,62,90,241,13,61,248,169,42,190,9,165,159,190,208,37,180,190,250,237,139,190,52,48,210,189,52,48,210,61,250,237,139,62,208,37,180,62,9,165,159,62,248,169,42,62,90,241,13,189,205,172,101,190,151,57,173,190,125,61,167,62,210,139,10,62,210,139,10,190,125,61,167,190,125,61,167,190,210,139,10,190,210,139,10,62,125,61,167,62,125,61,167,62,210,139,10,62,210,139,10,190,125,61,167,190,125,61,167,190,210,139,10,190,210,139,10,62,125,61,167,62,9,165,159,62,90,241,13,61,250,237,139,190,151,57,173,190,52,48,210,189,205,172,101,62,208,37,180,62,248,169,42,62,248,169,42,190,208,37,180,190,205,172,101,190,52,48,210,61,151,57,173,62,250,237,139,62,90,241,13,189,9,165,159,190,27,131,150,62,196,66,141,189,135,138,177,190,96,35,73,190,96,35,73,62,135,138,177,62,196,66,141,61,27,131,150,190,27,131,150,190,196,66,141,61,135,138,177,62,96,35,73,62,96,35,73,190,135,138,177,190,196,66,141,189,27,131,150,62,250,237,139,62,248,169,42,190,151,57,173,190,90,241,13,61,208,37,180,62,52,48,210,61,9,165,159,190,205,172,101,190,205,172,101,62,9,165,159,62,52,48,210,189,208,37,180,190,90,241,13,189,151,57,173,62,248,169,42,62,250,237,139,190,22,235,181,64,30,107,94,64,35,164,226,63,185,197,204,63,91,124,113,64,184,115,10,64,116,96,161,63,136,245,142,63,19,155,245,63,0,0,0,0,5,193,35,61,233,125,163,61,37,150,244,61,226,116,34,62,172,28,74,62,221,37,113,62,52,186,139,62,180,119,158,62,228,191,176,62,173,136,194,62,37,201,211,62,24,122,228,62,24,149,244,62,200,10,2,63,28,124,9,63,73,157,16,63,202,109,23,63,192,237,29,63,159,29,36,63,84,254,41,63,46,145,47,63,224,215,52,63,99,212,57,63,240,136,62,63,211,247,66,63,171,35,71,63,23,15,75,63,216,188,78,63,173,47,82,63,106,106,85,63,206,111,88,63,154,66,91,63,142,229,93,63,75,91,96,63,110,166,98,63,100,201,100,63,155,198,102,63,111,160,104,63,247,88,106,63,128,242,107,63,223,110,109,63,11,208,110,63,202,23,112,63,224,71,113,63,225,97,114,63,77,103,115,63,150,89,116,63,12,58,117,63,255,9,118,63,138,202,118,63,187,124,119,63,192,33,120,63,98,186,120,63,157,71,121,63,75,202,121,63,36,67,122,63,242,178,122,63,59,26,123,63,200,121,123,63,32,210,123,63,200,35,124,63,55,111,124,63,242,180,124,63,94,245,124,63,224,48,125,63,236,103,125,63,183,154,125,63,180,201,125,63,6,245,125,63,17,29,126,63,24,66,126,63,78,100,126,63,211,131,126,63,253,160,126,63,237,187,126,63,195,212,126,63,179,235,126,63,239,0,127,63,135,20,127,63,141,38,127,63,67,55,127,63,170,70,127,63,227,84,127,63,15,98,127,63,47,110,127,63,100,121,127,63,190,131,127,63,63,141,127,63,24,150,127,63,56,158,127,63,194,165,127,63,163,172,127,63,16,179,127,63,245,184,127,63,119,190,127,63,114,195,127,63,25,200,127,63,108,204,127,63,91,208,127,63,6,212,127,63,111,215,127,63,131,218,127,63,102,221,127,63,21,224,127,63,130,226,127,63,205,228,127,63,230,230,127,63,205,232,127,63,146,234,127,63,70,236,127,63,200,237,127,63,40,239,127,63,120,240,127,63,166,241,127,63,195,242,127,63,191,243,127,63,186,244,127,63,148,245,127,63,94,246,127,63,39,247,127,63,207,247,127,63,119,248,127,63,253,248,127,63,148,249,127,63,9,250,127,63,127,250,127,63,244,250,127,63,89,251,127,63,173,251,127,63,1,252,127,63,84,252,127,63,152,252,127,63,219,252,127,63,30,253,127,63,80,253,127,63,130,253,127,63,181,253,127,63,231,253,127,63,9,254,127,63,59,254,127,63,93,254,127,63,126,254,127,63,143,254,127,63,176,254,127,63,210,254,127,63,227,254,127,63,244,254,127,63,21,255,127,63,38,255,127,63,55,255,127,63,71,255,127,63,88,255,127,63,88,255,127,63,105,255,127,63,122,255,127,63,122,255,127,63,139,255,127,63,155,255,127,63,155,255,127,63,155,255,127,63,172,255,127,63,172,255,127,63,189,255,127,63,189,255,127,63,189,255,127,63,206,255,127,63,206,255,127,63,206,255,127,63,206,255,127,63,206,255,127,63,222,255,127,63,222,255,127,63,222,255,127,63,222,255,127,63,222,255,127,63,222,255,127,63,239,255,127,63,239,255,127,63,239,255,127,63,239,255,127,63,239,255,127,63,239,255,127,63,239,255,127,63,239,255,127,63,239,255,127,63,239,255,127,63,239,255,127,63,239,255,127,63,239,255,127,63,0,0,128,63,0,0,128,63,0,0,128,63,0,0,128,63,0,0,128,63,0,0,128,63,0,0,128,63,0,0,128,63,0,0,128,63,0,0,128,63,0,0,128,63,92,201,154,191,92,181,225,188,29,102,249,60,41,7,147,189,76,199,183,189,254,214,206,61,107,200,73,189,213,203,143,61,162,63,153,60,131,208,139,59,7,3,132,61,170,154,224,189,251,30,245,189,156,141,17,188,11,14,47,62,98,192,50,62,25,231,135,190,14,59,130,189,104,203,145,190,133,66,136,191,57,185,79,62,205,228,19,64,254,212,48,192,107,127,215,190,71,229,50,63,144,218,206,64,190,165,135,61,26,70,155,61,241,153,81,61,23,176,46,61,228,249,236,61,194,18,135,190,137,197,57,188,107,74,66,190,44,114,190,189,15,94,147,190,234,136,189,61,164,240,234,60,161,171,163,188,103,180,69,190,98,101,132,62,179,149,151,60,242,210,237,61,140,77,203,61,221,29,0,188,97,51,136,190,116,69,145,62,227,199,40,65,110,133,40,191,198,53,86,63,106,222,81,65,36,209,160,192,56,103,140,191,137,42,151,189,64,184,167,60,103,126,53,60,37,104,2,187,152,220,139,59,239,146,24,62,41,174,154,61,238,207,229,61,197,96,84,189,236,162,232,60,105,97,197,60,53,77,78,189,26,24,25,190,227,199,8,190,182,159,12,190,150,33,238,61,117,202,115,62,250,97,164,61,125,168,30,61,218,27,188,61,180,142,129,64,129,149,79,64,2,43,55,191,225,93,2,65,218,44,239,193,246,40,148,63,255,147,255,189,102,233,185,60,124,187,64,189,90,0,9,189,207,206,19,61,20,106,55,61,121,110,41,187,165,84,157,188,137,151,231,189,90,72,224,61,75,81,51,189,51,156,28,61,194,238,34,188,128,99,31,190,82,12,48,62,141,123,99,190,91,8,6,191,166,34,58,189,54,144,14,191,23,244,66,63,23,217,44,192,69,13,98,191,113,29,99,63,107,15,63,63,168,25,186,190,127,137,184,62,66,91,14,61,15,97,124,188,56,153,225,59,58,135,27,188,169,33,128,61,86,182,79,189,178,164,23,61,110,10,117,60,67,86,119,61,71,94,145,189,118,138,21,189,47,196,202,61,104,185,34,189,150,10,146,62,113,231,2,62,77,45,27,190,59,29,136,62,111,117,170,189,14,67,85,61,140,214,101,63,202,224,224,62,144,131,64,192,163,1,248,63,103,68,209,190,54,172,153,62,227,194,181,191,69,74,243,61,178,70,61,189,146,230,79,61,22,83,196,188,77,235,128,189,165,98,8,188,160,53,223,189,183,222,5,189,46,143,213,61,96,168,136,189,8,242,66,61,75,175,141,61,63,127,107,189,121,33,13,190,10,242,83,190,129,236,37,190,88,114,85,190,45,39,17,62,57,41,148,190,154,153,73,191,163,146,186,61,240,50,51,62,10,46,2,192,198,80,68,64,133,124,156,63,95,210,6,64,48,139,159,61,171,63,98,190,60,106,12,62,216,26,128,189,100,118,150,189,195,14,51,62,84,195,14,190,131,32,198,61,103,30,170,61,167,7,101,190,13,250,210,61,147,139,209,189,146,6,103,62,123,20,30,62,83,93,64,62,22,226,15,188,77,188,3,62,60,50,190,190,86,68,245,190,73,76,32,62,106,48,141,63,196,124,161,191,19,13,178,61,28,181,18,190,57,185,11,64,18,218,56,192,38,27,207,61,119,219,157,190,203,101,99,62,140,44,105,190,51,31,12,188,188,93,47,60,26,189,253,59,149,207,151,188,8,181,250,60,252,55,111,190,62,86,165,61,13,54,245,188,175,150,27,62,31,19,137,190,22,143,70,61,87,93,7,62,150,148,107,190,235,59,183,62,168,114,154,61,167,149,226,61,103,155,163,191,174,216,83,64,156,192,84,63,188,118,89,190,203,161,165,193,252,24,147,191,62,46,0,61,22,207,170,188,109,194,3,188,13,228,52,60,76,23,226,60,94,191,253,58,3,71,93,188,3,132,201,187,99,6,79,61,150,27,49,188,190,138,88,58,58,177,199,188,119,103,165,190,169,211,139,61,238,8,15,191,175,7,211,189,41,34,51,62,108,152,1,190,136,13,214,189,43,79,216,62,52,234,139,189,171,91,185,191,106,189,51,63,173,78,54,63,236,24,215,190,201,60,38,64,232,221,243,188,27,145,57,189,185,75,7,189,85,29,13,189,165,90,213,188,35,17,122,189,144,195,187,61,245,244,209,60,72,108,215,189,184,241,157,61,150,18,184,189,131,161,62,190,154,92,164,190,4,27,103,190,120,11,52,62,56,129,129,62,107,40,61,63,2,212,26,64,153,129,234,61,4,200,160,190,198,164,27,63,129,178,221,63,87,38,6,192,164,253,27,191,240,80,152,63,51,53,233,61,233,239,53,190,169,237,160,189,98,49,178,190,76,105,194,189,155,132,156,188,254,240,171,62,96,4,109,189,194,104,6,62,43,18,243,189,64,75,7,190,254,95,117,190,119,167,65,58,2,102,62,190,146,232,5,190,239,116,223,190,94,16,17,190,187,191,16,61,20,198,91,189,132,137,197,189,111,45,99,62,109,168,248,63,76,137,228,191,91,211,116,64,35,190,111,64,182,185,23,64,227,170,182,191,215,183,61,61,62,230,104,189,170,229,88,61,29,114,211,189,226,147,174,190,198,194,208,61,79,145,79,191,195,98,52,62,3,119,240,62,144,222,203,60,19,213,219,189,99,71,19,190,169,61,59,189,229,122,71,63,75,144,17,190,9,129,33,61,106,161,36,62,200,38,53,191,91,181,27,191,126,24,137,63,124,155,162,191,249,189,17,64,54,205,203,64,10,20,5,63,165,73,85,192,70,122,1,190,179,80,193,189,15,198,217,60,14,62,126,61,52,147,57,60,169,249,130,190,29,176,150,189,125,219,130,189,206,112,195,189,88,226,81,190,21,24,149,59,62,81,99,61,5,105,38,190,235,230,18,191,183,124,132,62,140,185,75,62,61,164,179,60,75,230,192,190,43,50,2,191,22,24,157,189,25,142,39,191,248,165,143,64,103,237,88,64,227,25,22,192,193,57,49,193,167,116,139,64,15,127,213,63,227,129,82,189,253,114,140,189,204,192,55,188,190,157,243,57,254,123,112,190,116,92,173,190,227,167,17,190,212,126,43,190,24,177,15,190,150,176,214,189,48,100,213,189,144,204,52,60,123,190,230,189,57,165,178,61,42,224,46,190,69,155,179,189,224,157,252,61,43,133,32,190,158,208,75,62,116,208,101,189,126,54,102,63,242,249,167,61,143,194,165,191,164,231,241,60,55,166,17,64,235,228,112,191,169,2,36,188,156,111,228,189,154,93,7,190,171,9,226,189,126,29,24,61,207,152,147,188,19,0,45,188,234,106,161,60,33,229,39,61,192,163,92,189,78,155,209,189,224,208,64,189,139,78,54,62,105,25,137,190,231,167,216,189,95,207,215,189,194,73,127,61,52,190,47,189,194,195,52,62,247,234,35,190,168,58,18,192,101,141,246,191,116,98,95,62,180,188,26,65,146,116,83,64,160,55,225,191,122,200,4,62,228,73,242,61,246,36,16,62,235,223,138,61,12,62,77,59,137,205,108,188,56,33,254,188,96,209,200,188,25,60,12,62,132,189,25,62,45,11,230,61,121,161,154,189,35,221,143,190,130,83,127,190,19,129,46,191,240,31,1,61,12,6,151,62,139,187,38,61,202,197,144,62,4,57,176,190,69,129,234,192,30,81,97,190,142,119,15,191,191,154,239,191,3,62,227,192,179,210,8,65,196,66,5,64,192,93,118,62,189,24,162,63,174,156,253,60,179,152,140,191,122,142,92,63,186,189,196,191,106,106,137,63,198,138,140,64,99,180,38,192,82,12,192,62,126,200,251,61,169,231,85,59,40,244,70,63,137,7,2,192,108,206,113,191,82,242,128,64,216,127,133,190,63,111,14,63,148,220,97,190,2,183,226,191,40,212,91,191,230,150,194,191,215,190,72,191,25,32,177,62,201,21,72,189,50,146,165,190,160,168,64,191,202,112,4,63,170,96,96,63,69,100,184,191,174,185,195,190,108,236,198,191,0,0,128,63,0,0,0,64,0,0,64,64,0,0,128,64,0,0,160,64,0,0,192,64,0,0,224,64,0,0,0,65,0,0,128,65,0,0,192,65,0,0,16,66,0,0,48,66,0,0,72,66,0,0,96,66,0,0,120,66,0,0,134,66,0,0,144,66,0,0,158,66,0,0,176,66,0,0,212,66,0,0,6,67,0,0,128,63,0,0,128,63,0,0,128,63,0,0,128,63,0,0,128,63,0,0,128,63,0,0,128,63,0,0,0,64,0,0,0,64,0,0,0,64,0,0,0,64,0,0,0,64,0,0,0,64,0,0,0,64,0,0,64,64,0,0,64,64,0,0,128,64,0,0,160,64,0,0,192,64,0,0,0,65,0,0,0,65,149,139,0,0,55,152,0,0,255,165,0,0,4,181,0,0,103,197,0,0,69,215,0,0,193,234,0,0,255,255,0,0,128,187,0,0,120,0,0,0,21,0,0,0,21,0,0,0,0,154,89,63,0,0,0,0,0,0,128,63,0,0,128,63,220,90,0,0,3,0,0,0,8,0,0,0,120,0,0,0,11,0,0,0,58,110,0,0,8,91,0,0,36,21,0,0,128,7,0,0,3,0,0,0,4,23,0,0,60,38,0,0,116,38,0,0,172,38,0,0,228,38,0,0,136,1,0,0,58,98,0,0,33,111,0,0,169,112,0,0,106,28,141,56,82,187,30,58,8,105,220,58,130,237,87,59,137,99,178,59,3,42,5,60,48,220,57,60,180,62,119,60,28,163,158,60,209,242,197,60,254,134,241,60,155,171,16,61,5,173,42,61,132,194,70,61,83,230,100,61,17,137,130,61,135,159,147,61,203,178,165,61,209,190,184,61,58,191,204,61,84,175,225,61,20,138,247,61,14,37,7,62,217,244,18,62,95,49,31,62,104,215,43,62,138,227,56,62,48,82,70,62,148,31,84,62,191,71,98,62,142,198,112,62,176,151,127,62,82,91,135,62,96,15,143,62,152,229,150,62,121,219,158,62,112,238,166,62,216,27,175,62,251,96,183,62,17,187,191,62,70,39,200,62,183,162,208,62,120,42,217,62,148,187,225,62,12,83,234,62,222,237,242,62,6,137,251,62,190,16,2,63,31,90,6,63,36,159,10,63,80,222,14,63,43,22,19,63,65,69,23,63,37,106,27,63,115,131,31,63,206,143,35,63,230,141,39,63,116,124,43,63,63,90,47,63,25,38,51,63,231,222,54,63,153,131,58,63,51,19,62,63,197,140,65,63,119,239,68,63,127,58,72,63,39,109,75,63,206,134,78,63,229,134,81,63,241,108,84,63,142,56,87,63,105,233,89,63,69,127,92,63,250,249,94,63,115,89,97,63,175,157,99,63,193,198,101,63,207,212,103,63,17,200,105,63,210,160,107,63,110,95,109,63,80,4,111,63,244,143,112,63,230,2,114,63,189,93,115,63,31,161,116,63,191,205,117,63,87,228,118,63,176,229,119,63,151,210,120,63,227,171,121,63,115,114,122,63,39,39,123,63,231,202,123,63,157,94,124,63,53,227,124,63,156,89,125,63,189,194,125,63,134,31,126,63,222,112,126,63,171,183,126,63,207,244,126,63,38,41,127,63,134,85,127,63,190,122,127,63,150,153,127,63,204,178,127,63,20,199,127,63,28,215,127,63,130,227,127,63,221,236,127,63,182,243,127,63,138,248,127,63,200,251,127,63,214,253,127,63,7,255,127,63,165,255,127,63,232,255,127,63,253,255,127,63,0,0,128,63,224,1,0,0,135,136,8,59,255,255,255,255,5,0,96,0,3,0,32,0,4,0,8,0,2,0,4,0,4,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,50,91,0,0,60,23,0,0,0,0,0,0,0,0,128,63,0,0,0,128,99,250,127,63,191,117,86,188,139,233,127,63,10,113,214,188,121,205,127,63,231,206,32,189,47,166,127,63,58,94,86,189,175,115,127,63,19,242,133,189,249,53,127,63,42,175,160,189,18,237,126,63,51,101,187,189,253,152,126,63,4,19,214,189,188,57,126,63,115,183,240,189,85,207,125,63,168,168,5,190,203,89,125,63,187,239,18,190,37,217,124,63,92,48,32,190,103,77,124,63,245,105,45,190,152,182,123,63,243,155,58,190,190,20,123,63,194,197,71,190,226,103,122,63,205,230,84,190,9,176,121,63,130,254,97,190,60,237,120,63,77,12,111,190,132,31,120,63,156,15,124,190,234,70,119,63,238,131,132,190,119,99,118,63,62,250,138,190,54,117,117,63,117,106,145,190,48,124,116,63,76,212,151,190,113,120,115,63,122,55,158,190,3,106,114,63,183,147,164,190,244,80,113,63,188,232,170,190,79,45,112,63,65,54,177,190,33,255,110,63,1,124,183,190,118,198,109,63,180,185,189,190,94,131,108,63,21,239,195,190,231,53,107,63,222,27,202,190,30,222,105,63,201,63,208,190,18,124,104,63,146,90,214,190,212,15,103,63,243,107,220,190,116,153,101,63,170,115,226,190,1,25,100,63,113,113,232,190,141,142,98,63,7,101,238,190,40,250,96,63,39,78,244,190,230,91,95,63,144,44,250,190,215,179,93,63,0,0,0,191,15,2,92,63,27,228,2,191,160,70,90,63,119,194,5,191,158,129,88,63,246,154,8,191,29,179,86,63,119,109,11,191,49,219,84,63,218,57,14,191,239,249,82,63,0,0,17,191,108,15,81,63,202,191,19,191,189,27,79,63,24,121,22,191,248,30,77,63,205,43,25,191,52,25,75,63,202,215,27,191,136,10,73,63,241,124,30,191,10,243,70,63,36,27,33,191,209,210,68,63,70,178,35,191,247,169,66,63,58,66,38,191,147,120,64,63,227,202,40,191,189,62,62,63,37,76,43,191,143,252,59,63,227,197,45,191,34,178,57,63,1,56,48,191,144,95,55,63,101,162,50,191,243,4,53,63,243,4,53,191,101,162,50,63,144,95,55,191,1,56,48,63,34,178,57,191,227,197,45,63,143,252,59,191,37,76,43,63,189,62,62,191,227,202,40,63,147,120,64,191,58,66,38,63,247,169,66,191,70,178,35,63,209,210,68,191,36,27,33,63,10,243,70,191,241,124,30,63,136,10,73,191,202,215,27,63,52,25,75,191,205,43,25,63,248,30,77,191,24,121,22,63,189,27,79,191,202,191,19,63,108,15,81,191,0,0,17,63,239,249,82,191,218,57,14,63,49,219,84,191,119,109,11,63,29,179,86,191,246,154,8,63,158,129,88,191,119,194,5,63,160,70,90,191,27,228,2,63,15,2,92,191,0,0,0,63,215,179,93,191,144,44,250,62,230,91,95,191,39,78,244,62,40,250,96,191,7,101,238,62,141,142,98,191,113,113,232,62,1,25,100,191,170,115,226,62,116,153,101,191,243,107,220,62,212,15,103,191,146,90,214,62,18,124,104,191,201,63,208,62,30,222,105,191,222,27,202,62,231,53,107,191,21,239,195,62,94,131,108,191,180,185,189,62,118,198,109,191,1,124,183,62,33,255,110,191,65,54,177,62,79,45,112,191,188,232,170,62,244,80,113,191,183,147,164,62,3,106,114,191,122,55,158,62,113,120,115,191,76,212,151,62,48,124,116,191,117,106,145,62,54,117,117,191,62,250,138,62,119,99,118,191,238,131,132,62,234,70,119,191,156,15,124,62,132,31,120,191,77,12,111,62,60,237,120,191,130,254,97,62,9,176,121,191,205,230,84,62,226,103,122,191,194,197,71,62,190,20,123,191,243,155,58,62,152,182,123,191,245,105,45,62,103,77,124,191,92,48,32,62,37,217,124,191,187,239,18,62,203,89,125,191,168,168,5,62,85,207,125,191,115,183,240,61,188,57,126,191,4,19,214,61,253,152,126,191,51,101,187,61,18,237,126,191,42,175,160,61,249,53,127,191,19,242,133,61,175,115,127,191,58,94,86,61,47,166,127,191,231,206,32,61,121,205,127,191,10,113,214,60,139,233,127,191,191,117,86,60,99,250,127,191,0,48,141,36,0,0,128,191,191,117,86,188,99,250,127,191,10,113,214,188,139,233,127,191,231,206,32,189,121,205,127,191,58,94,86,189,47,166,127,191,19,242,133,189,175,115,127,191,42,175,160,189,249,53,127,191,51,101,187,189,18,237,126,191,4,19,214,189,253,152,126,191,115,183,240,189,188,57,126,191,168,168,5,190,85,207,125,191,187,239,18,190,203,89,125,191,92,48,32,190,37,217,124,191,245,105,45,190,103,77,124,191,243,155,58,190,152,182,123,191,194,197,71,190,190,20,123,191,205,230,84,190,226,103,122,191,130,254,97,190,9,176,121,191,77,12,111,190,60,237,120,191,156,15,124,190,132,31,120,191,238,131,132,190,234,70,119,191,62,250,138,190,119,99,118,191,117,106,145,190,54,117,117,191,76,212,151,190,48,124,116,191,122,55,158,190,113,120,115,191,183,147,164,190,3,106,114,191,188,232,170,190,244,80,113,191,65,54,177,190,79,45,112,191,1,124,183,190,33,255,110,191,180,185,189,190,118,198,109,191,21,239,195,190,94,131,108,191,222,27,202,190,231,53,107,191,201,63,208,190,30,222,105,191,146,90,214,190,18,124,104,191,243,107,220,190,212,15,103,191,170,115,226,190,116,153,101,191,113,113,232,190,1,25,100,191,7,101,238,190,141,142,98,191,39,78,244,190,40,250,96,191,144,44,250,190,230,91,95,191,0,0,0,191,215,179,93,191,27,228,2,191,15,2,92,191,119,194,5,191,160,70,90,191,246,154,8,191,158,129,88,191,119,109,11,191,29,179,86,191,218,57,14,191,49,219,84,191,0,0,17,191,239,249,82,191,202,191,19,191,108,15,81,191,24,121,22,191,189,27,79,191,205,43,25,191,248,30,77,191,202,215,27,191,52,25,75,191,241,124,30,191,136,10,73,191,36,27,33,191,10,243,70,191,70,178,35,191,209,210,68,191,58,66,38,191,247,169,66,191,227,202,40,191,147,120,64,191,37,76,43,191,189,62,62,191,227,197,45,191,143,252,59,191,1,56,48,191,34,178,57,191,101,162,50,191,144,95,55,191,243,4,53,191,243,4,53,191,144,95,55,191,101,162,50,191,34,178,57,191,1,56,48,191,143,252,59,191,227,197,45,191,189,62,62,191,37,76,43,191,147,120,64,191,227,202,40,191,247,169,66,191,58,66,38,191,209,210,68,191,70,178,35,191,10,243,70,191,36,27,33,191,136,10,73,191,241,124,30,191,52,25,75,191,202,215,27,191,248,30,77,191,205,43,25,191,189,27,79,191,24,121,22,191,108,15,81,191,202,191,19,191,239,249,82,191,0,0,17,191,49,219,84,191,218,57,14,191,29,179,86,191,119,109,11,191,158,129,88,191,246,154,8,191,160,70,90,191,119,194,5,191,15,2,92,191,27,228,2,191,215,179,93,191,0,0,0,191,230,91,95,191,144,44,250,190,40,250,96,191,39,78,244,190,141,142,98,191,7,101,238,190,1,25,100,191,113,113,232,190,116,153,101,191,170,115,226,190,212,15,103,191,243,107,220,190,18,124,104,191,146,90,214,190,30,222,105,191,201,63,208,190,231,53,107,191,222,27,202,190,94,131,108,191,21,239,195,190,118,198,109,191,180,185,189,190,33,255,110,191,1,124,183,190,79,45,112,191,65,54,177,190,244,80,113,191,188,232,170,190,3,106,114,191,183,147,164,190,113,120,115,191,122,55,158,190,48,124,116,191,76,212,151,190,54,117,117,191,117,106,145,190,119,99,118,191,62,250,138,190,234,70,119,191,238,131,132,190,132,31,120,191,156,15,124,190,60,237,120,191,77,12,111,190,9,176,121,191,130,254,97,190,226,103,122,191,205,230,84,190,190,20,123,191,194,197,71,190,152,182,123,191,243,155,58,190,103,77,124,191,245,105,45,190,37,217,124,191,92,48,32,190,203,89,125,191,187,239,18,190,85,207,125,191,168,168,5,190,188,57,126,191,115,183,240,189,253,152,126,191,4,19,214,189,18,237,126,191,51,101,187,189,249,53,127,191,42,175,160,189,175,115,127,191,19,242,133,189,47,166,127,191,58,94,86,189,121,205,127,191,231,206,32,189,139,233,127,191,10,113,214,188,99,250,127,191,191,117,86,188,0,0,128,191,0,48,13,165,99,250,127,191,191,117,86,60,139,233,127,191,10,113,214,60,121,205,127,191,231,206,32,61,47,166,127,191,58,94,86,61,175,115,127,191,19,242,133,61,249,53,127,191,42,175,160,61,18,237,126,191,51,101,187,61,253,152,126,191,4,19,214,61,188,57,126,191,115,183,240,61,85,207,125,191,168,168,5,62,203,89,125,191,187,239,18,62,37,217,124,191,92,48,32,62,103,77,124,191,245,105,45,62,152,182,123,191,243,155,58,62,190,20,123,191,194,197,71,62,226,103,122,191,205,230,84,62,9,176,121,191,130,254,97,62,60,237,120,191,77,12,111,62,132,31,120,191,156,15,124,62,234,70,119,191,238,131,132,62,119,99,118,191,62,250,138,62,54,117,117,191,117,106,145,62,48,124,116,191,76,212,151,62,113,120,115,191,122,55,158,62,3,106,114,191,183,147,164,62,244,80,113,191,188,232,170,62,79,45,112,191,65,54,177,62,33,255,110,191,1,124,183,62,118,198,109,191,180,185,189,62,94,131,108,191,21,239,195,62,231,53,107,191,222,27,202,62,30,222,105,191,201,63,208,62,18,124,104,191,146,90,214,62,212,15,103,191,243,107,220,62,116,153,101,191,170,115,226,62,1,25,100,191,113,113,232,62,141,142,98,191,7,101,238,62,40,250,96,191,39,78,244,62,230,91,95,191,144,44,250,62,215,179,93,191,0,0,0,63,15,2,92,191,27,228,2,63,160,70,90,191,119,194,5,63,158,129,88,191,246,154,8,63,29,179,86,191,119,109,11,63,49,219,84,191,218,57,14,63,239,249,82,191,0,0,17,63,108,15,81,191,202,191,19,63,189,27,79,191,24,121,22,63,248,30,77,191,205,43,25,63,52,25,75,191,202,215,27,63,136,10,73,191,241,124,30,63,10,243,70,191,36,27,33,63,209,210,68,191,70,178,35,63,247,169,66,191,58,66,38,63,147,120,64,191,227,202,40,63,189,62,62,191,37,76,43,63,143,252,59,191,227,197,45,63,34,178,57,191,1,56,48,63,144,95,55,191,101,162,50,63,243,4,53,191,243,4,53,63,101,162,50,191,144,95,55,63,1,56,48,191,34,178,57,63,227,197,45,191,143,252,59,63,37,76,43,191,189,62,62,63,227,202,40,191,147,120,64,63,58,66,38,191,247,169,66,63,70,178,35,191,209,210,68,63,36,27,33,191,10,243,70,63,241,124,30,191,136,10,73,63,202,215,27,191,52,25,75,63,205,43,25,191,248,30,77,63,24,121,22,191,189,27,79,63,202,191,19,191,108,15,81,63,0,0,17,191,239,249,82,63,218,57,14,191,49,219,84,63,119,109,11,191,29,179,86,63,246,154,8,191,158,129,88,63,119,194,5,191,160,70,90,63,27,228,2,191,15,2,92,63,0,0,0,191,215,179,93,63,144,44,250,190,230,91,95,63,39,78,244,190,40,250,96,63,7,101,238,190,141,142,98,63,113,113,232,190,1,25,100,63,170,115,226,190,116,153,101,63,243,107,220,190,212,15,103,63,146,90,214,190,18,124,104,63,201,63,208,190,30,222,105,63,222,27,202,190,231,53,107,63,21,239,195,190,94,131,108,63,180,185,189,190,118,198,109,63,1,124,183,190,33,255,110,63,65,54,177,190,79,45,112,63,188,232,170,190,244,80,113,63,183,147,164,190,3,106,114,63,122,55,158,190,113,120,115,63,76,212,151,190,48,124,116,63,117,106,145,190,54,117,117,63,62,250,138,190,119,99,118,63,238,131,132,190,234,70,119,63,156,15,124,190,132,31,120,63,77,12,111,190,60,237,120,63,130,254,97,190,9,176,121,63,205,230,84,190,226,103,122,63,194,197,71,190,190,20,123,63,243,155,58,190,152,182,123,63,245,105,45,190,103,77,124,63,92,48,32,190,37,217,124,63,187,239,18,190,203,89,125,63,168,168,5,190,85,207,125,63,115,183,240,189,188,57,126,63,4,19,214,189,253,152,126,63,51,101,187,189,18,237,126,63,42,175,160,189,249,53,127,63,19,242,133,189,175,115,127,63,58,94,86,189,47,166,127,63,231,206,32,189,121,205,127,63,10,113,214,188,139,233,127,63,191,117,86,188,99,250,127,63,0,200,83,165,0,0,128,63,191,117,86,60,99,250,127,63,10,113,214,60,139,233,127,63,231,206,32,61,121,205,127,63,58,94,86,61,47,166,127,63,19,242,133,61,175,115,127,63,42,175,160,61,249,53,127,63,51,101,187,61,18,237,126,63,4,19,214,61,253,152,126,63,115,183,240,61,188,57,126,63,168,168,5,62,85,207,125,63,187,239,18,62,203,89,125,63,92,48,32,62,37,217,124,63,245,105,45,62,103,77,124,63,243,155,58,62,152,182,123,63,194,197,71,62,190,20,123,63,205,230,84,62,226,103,122,63,130,254,97,62,9,176,121,63,77,12,111,62,60,237,120,63,156,15,124,62,132,31,120,63,238,131,132,62,234,70,119,63,62,250,138,62,119,99,118,63,117,106,145,62,54,117,117,63,76,212,151,62,48,124,116,63,122,55,158,62,113,120,115,63,183,147,164,62,3,106,114,63,188,232,170,62,244,80,113,63,65,54,177,62,79,45,112,63,1,124,183,62,33,255,110,63,180,185,189,62,118,198,109,63,21,239,195,62,94,131,108,63,222,27,202,62,231,53,107,63,201,63,208,62,30,222,105,63,146,90,214,62,18,124,104,63,243,107,220,62,212,15,103,63,170,115,226,62,116,153,101,63,113,113,232,62,1,25,100,63,7,101,238,62,141,142,98,63,39,78,244,62,40,250,96,63,144,44,250,62,230,91,95,63,0,0,0,63,215,179,93,63,27,228,2,63,15,2,92,63,119,194,5,63,160,70,90,63,246,154,8,63,158,129,88,63,119,109,11,63,29,179,86,63,218,57,14,63,49,219,84,63,0,0,17,63,239,249,82,63,202,191,19,63,108,15,81,63,24,121,22,63,189,27,79,63,205,43,25,63,248,30,77,63,202,215,27,63,52,25,75,63,241,124,30,63,136,10,73,63,36,27,33,63,10,243,70,63,70,178,35,63,209,210,68,63,58,66,38,63,247,169,66,63,227,202,40,63,147,120,64,63,37,76,43,63,189,62,62,63,227,197,45,63,143,252,59,63,1,56,48,63,34,178,57,63,101,162,50,63,144,95,55,63,243,4,53,63,243,4,53,63,144,95,55,63,101,162,50,63,34,178,57,63,1,56,48,63,143,252,59,63,227,197,45,63,189,62,62,63,37,76,43,63,147,120,64,63,227,202,40,63,247,169,66,63,58,66,38,63,209,210,68,63,70,178,35,63,10,243,70,63,36,27,33,63,136,10,73,63,241,124,30,63,52,25,75,63,202,215,27,63,248,30,77,63,205,43,25,63,189,27,79,63,24,121,22,63,108,15,81,63,202,191,19,63,239,249,82,63,0,0,17,63,49,219,84,63,218,57,14,63,29,179,86,63,119,109,11,63,158,129,88,63,246,154,8,63,160,70,90,63,119,194,5,63,15,2,92,63,27,228,2,63,215,179,93,63,0,0,0,63,230,91,95,63,144,44,250,62,40,250,96,63,39,78,244,62,141,142,98,63,7,101,238,62,1,25,100,63,113,113,232,62,116,153,101,63,170,115,226,62,212,15,103,63,243,107,220,62,18,124,104,63,146,90,214,62,30,222,105,63,201,63,208,62,231,53,107,63,222,27,202,62,94,131,108,63,21,239,195,62,118,198,109,63,180,185,189,62,33,255,110,63,1,124,183,62,79,45,112,63,65,54,177,62,244,80,113,63,188,232,170,62,3,106,114,63,183,147,164,62,113,120,115,63,122,55,158,62,48,124,116,63,76,212,151,62,54,117,117,63,117,106,145,62,119,99,118,63,62,250,138,62,234,70,119,63,238,131,132,62,132,31,120,63,156,15,124,62,60,237,120,63,77,12,111,62,9,176,121,63,130,254,97,62,226,103,122,63,205,230,84,62,190,20,123,63,194,197,71,62,152,182,123,63,243,155,58,62,103,77,124,63,245,105,45,62,37,217,124,63,92,48,32,62,203,89,125,63,187,239,18,62,85,207,125,63,168,168,5,62,188,57,126,63,115,183,240,61,253,152,126,63,4,19,214,61,18,237,126,63,51,101,187,61,249,53,127,63,42,175,160,61,175,115,127,63,19,242,133,61,47,166,127,63,58,94,86,61,121,205,127,63,231,206,32,61,139,233,127,63,10,113,214,60,99,250,127,63,191,117,86,60,240,0,0,0,137,136,136,59,1,0,0,0,5,0,48,0,3,0,16,0,4,0,4,0,4,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,242,94,0,0,60,23,0,0,0,0,0,0,120,0,0,0,136,136,8,60,2,0,0,0,5,0,24,0,3,0,8,0,2,0,4,0,4,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,210,96,0,0,60,23,0,0,0,0,0,0,60,0,0,0,137,136,136,60,3,0,0,0,5,0,12,0,3,0,4,0,4,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,194,97,0,0,60,23,0,0,0,0,0,0,255,255,127,63,142,255,127,63,106,254,127,63,147,252,127,63,7,250,127,63,200,246,127,63,214,242,127,63,48,238,127,63,214,232,127,63,200,226,127,63,7,220,127,63,147,212,127,63,107,204,127,63,143,195,127,63,0,186,127,63,189,175,127,63,199,164,127,63,29,153,127,63,192,140,127,63,176,127,127,63,236,113,127,63,118,99,127,63,75,84,127,63,110,68,127,63,222,51,127,63,154,34,127,63,163,16,127,63,250,253,126,63,157,234,126,63,141,214,126,63,203,193,126,63,86,172,126,63,46,150,126,63,83,127,126,63,198,103,126,63,134,79,126,63,148,54,126,63,239,28,126,63,152,2,126,63,143,231,125,63,211,203,125,63,102,175,125,63,70,146,125,63,116,116,125,63,241,85,125,63,188,54,125,63,213,22,125,63,60,246,124,63,242,212,124,63,246,178,124,63,73,144,124,63,235,108,124,63,219,72,124,63,27,36,124,63,169,254,123,63,135,216,123,63,180,177,123,63,48,138,123,63,252,97,123,63,23,57,123,63,130,15,123,63,61,229,122,63,72,186,122,63,162,142,122,63,77,98,122,63,72,53,122,63,148,7,122,63,48,217,121,63,29,170,121,63,90,122,121,63,233,73,121,63,200,24,121,63,249,230,120,63],"i8",ALLOC_NONE,Runtime.GLOBAL_BASE), allocate([123,180,120,63,78,129,120,63,115,77,120,63,234,24,120,63,178,227,119,63,205,173,119,63,58,119,119,63,249,63,119,63,10,8,119,63,110,207,118,63,37,150,118,63,47,92,118,63,140,33,118,63,60,230,117,63,64,170,117,63,151,109,117,63,66,48,117,63,65,242,116,63,148,179,116,63,59,116,116,63,55,52,116,63,135,243,115,63,44,178,115,63,38,112,115,63,118,45,115,63,26,234,114,63,20,166,114,63,100,97,114,63,10,28,114,63,5,214,113,63,87,143,113,63,0,72,113,63,255,255,112,63,85,183,112,63,2,110,112,63,6,36,112,63,98,217,111,63,21,142,111,63,32,66,111,63,132,245,110,63,63,168,110,63,83,90,110,63,192,11,110,63,134,188,109,63,165,108,109,63,29,28,109,63,239,202,108,63,27,121,108,63,161,38,108,63,128,211,107,63,187,127,107,63,80,43,107,63,64,214,106,63,140,128,106,63,50,42,106,63,53,211,105,63,147,123,105,63,77,35,105,63,100,202,104,63,216,112,104,63,168,22,104,63,213,187,103,63,96,96,103,63,72,4,103,63,143,167,102,63,51,74,102,63,54,236,101,63,151,141,101,63,87,46,101,63,119,206,100,63,245,109,100,63,212,12,100,63,18,171,99,63,177,72,99,63,176,229,98,63,16,130,98,63,209,29,98,63,243,184,97,63,119,83,97,63,92,237,96,63,164,134,96,63,78,31,96,63,91,183,95,63,203,78,95,63,158,229,94,63,213,123,94,63,112,17,94,63,110,166,93,63,210,58,93,63,154,206,92,63,198,97,92,63,89,244,91,63,81,134,91,63,174,23,91,63,114,168,90,63,157,56,90,63,46,200,89,63,39,87,89,63,135,229,88,63,79,115,88,63,127,0,88,63,23,141,87,63,24,25,87,63,130,164,86,63,86,47,86,63,147,185,85,63,58,67,85,63,75,204,84,63,199,84,84,63,174,220,83,63,1,100,83,63,191,234,82,63,233,112,82,63,127,246,81,63,130,123,81,63,242,255,80,63,207,131,80,63,26,7,80,63,210,137,79,63,250,11,79,63,144,141,78,63,148,14,78,63,9,143,77,63,237,14,77,63,65,142,76,63,5,13,76,63,59,139,75,63,225,8,75,63,249,133,74,63,131,2,74,63,127,126,73,63,238,249,72,63,207,116,72,63,36,239,71,63,237,104,71,63,41,226,70,63,218,90,70,63,0,211,69,63,155,74,69,63,172,193,68,63,50,56,68,63,47,174,67,63,162,35,67,63,141,152,66,63,239,12,66,63,200,128,65,63,26,244,64,63,229,102,64,63,40,217,63,63,229,74,63,63,27,188,62,63,204,44,62,63,247,156,61,63,157,12,61,63,190,123,60,63,92,234,59,63,117,88,59,63,10,198,58,63,29,51,58,63,173,159,57,63,187,11,57,63,71,119,56,63,81,226,55,63,218,76,55,63,227,182,54,63,107,32,54,63,116,137,53,63,253,241,52,63,7,90,52,63,147,193,51,63,160,40,51,63,48,143,50,63,66,245,49,63,216,90,49,63,241,191,48,63,142,36,48,63,175,136,47,63,85,236,46,63,129,79,46,63,50,178,45,63,105,20,45,63,39,118,44,63,107,215,43,63,55,56,43,63,139,152,42,63,103,248,41,63,204,87,41,63,186,182,40,63,50,21,40,63,51,115,39,63,191,208,38,63,214,45,38,63,121,138,37,63,167,230,36,63,97,66,36,63,169,157,35,63,125,248,34,63,223,82,34,63,207,172,33,63,77,6,33,63,91,95,32,63,248,183,31,63,37,16,31,63,226,103,30,63,48,191,29,63,16,22,29,63,129,108,28,63,132,194,27,63,26,24,27,63,67,109,26,63,0,194,25,63,81,22,25,63,54,106,24,63,177,189,23,63,193,16,23,63,103,99,22,63,163,181,21,63,118,7,21,63,225,88,20,63,228,169,19,63,127,250,18,63,179,74,18,63,128,154,17,63,231,233,16,63,232,56,16,63,132,135,15,63,187,213,14,63,142,35,14,63,254,112,13,63,10,190,12,63,179,10,12,63,250,86,11,63,223,162,10,63,99,238,9,63,134,57,9,63,73,132,8,63,172,206,7,63,175,24,7,63,84,98,6,63,155,171,5,63,131,244,4,63,15,61,4,63,61,133,3,63,15,205,2,63,134,20,2,63,161,91,1,63,97,162,0,63,143,209,255,62,167,93,254,62,14,233,252,62,194,115,251,62,198,253,249,62,27,135,248,62,193,15,247,62,186,151,245,62,6,31,244,62,168,165,242,62,158,43,241,62,236,176,239,62,145,53,238,62,144,185,236,62,232,60,235,62,154,191,233,62,169,65,232,62,21,195,230,62,223,67,229,62,8,196,227,62,145,67,226,62,124,194,224,62,200,64,223,62,120,190,221,62,140,59,220,62,6,184,218,62,230,51,217,62,46,175,215,62,223,41,214,62,249,163,212,62,125,29,211,62,110,150,209,62,204,14,208,62,151,134,206,62,210,253,204,62,125,116,203,62,153,234,201,62,39,96,200,62,40,213,198,62,159,73,197,62,138,189,195,62,236,48,194,62,198,163,192,62,25,22,191,62,230,135,189,62,45,249,187,62,241,105,186,62,50,218,184,62,241,73,183,62,47,185,181,62,238,39,180,62,47,150,178,62,242,3,177,62,57,113,175,62,4,222,173,62,86,74,172,62,47,182,170,62,144,33,169,62,122,140,167,62,239,246,165,62,239,96,164,62,124,202,162,62,151,51,161,62,64,156,159,62,122,4,158,62,68,108,156,62,161,211,154,62,145,58,153,62,22,161,151,62,48,7,150,62,225,108,148,62,41,210,146,62,11,55,145,62,135,155,143,62,158,255,141,62,81,99,140,62,162,198,138,62,145,41,137,62,32,140,135,62,80,238,133,62,34,80,132,62,151,177,130,62,176,18,129,62,222,230,126,62,169,167,123,62,195,103,120,62,47,39,117,62,238,229,113,62,4,164,110,62,115,97,107,62,60,30,104,62,98,218,100,62,232,149,97,62,207,80,94,62,26,11,91,62,204,196,87,62,230,125,84,62,107,54,81,62,93,238,77,62,191,165,74,62,146,92,71,62,218,18,68,62,151,200,64,62,206,125,61,62,128,50,58,62,174,230,54,62,93,154,51,62,141,77,48,62,66,0,45,62,125,178,41,62,66,100,38,62,145,21,35,62,110,198,31,62,219,118,28,62,218,38,25,62,109,214,21,62,152,133,18,62,91,52,15,62,186,226,11,62,183,144,8,62,84,62,5,62,148,235,1,62,240,48,253,61,6,138,246,61,113,226,239,61,51,58,233,61,79,145,226,61,207,231,219,61,181,61,213,61,3,147,206,61,192,231,199,61,242,59,193,61,156,143,186,61,195,226,179,61,108,53,173,61,155,135,166,61,85,217,159,61,159,42,153,61,126,123,146,61,246,203,139,61,11,28,133,61,135,215,124,61,70,118,111,61,93,20,98,61,214,177,84,61,185,78,71,61,16,235,57,61,229,134,44,61,64,34,31,61,44,189,17,61,178,87,4,61,181,227,237,60,96,23,211,60,118,74,184,60,11,125,157,60,50,175,130,60,250,193,79,60,254,36,26,60,42,15,201,59,153,167,59,59,46,125,214,185,210,70,113,187,171,222,227,187,166,140,39,188,129,41,93,188,225,98,137,188,160,48,164,188,236,253,190,188,179,202,217,188,224,150,244,188,49,177,7,189,147,22,21,189,140,123,34,189,19,224,47,189,30,68,61,189,165,167,74,189,157,10,88,189,254,108,101,189,190,206,114,189,234,23,128,189,27,200,134,189,237,119,141,189,92,39,148,189,99,214,154,189,253,132,161,189,38,51,168,189,217,224,174,189,17,142,181,189,202,58,188,189,254,230,194,189,170,146,201,189,200,61,208,189,84,232,214,189,74,146,221,189,164,59,228,189,93,228,234,189,114,140,241,189,221,51,248,189,154,218,254,189,82,192,2,190,252,18,6,190,71,101,9,190,50,183,12,190,186,8,16,190,221,89,19,190,152,170,22,190,234,250,25,190,208,74,29,190,71,154,32,190,78,233,35,190,225,55,39,190,0,134,42,190,166,211,45,190,211,32,49,190,131,109,52,190,181,185,55,190,101,5,59,190,147,80,62,190,58,155,65,190,90,229,68,190,240,46,72,190,249,119,75,190,116,192,78,190,93,8,82,190,179,79,85,190,115,150,88,190,156,220,91,190,42,34,95,190,27,103,98,190,109,171,101,190,31,239,104,190,44,50,108,190,148,116,111,190,84,182,114,190,106,247,117,190,211,55,121,190,141,119,124,190,150,182,127,190,117,122,129,190,69,25,131,190,185,183,132,190,208,85,134,190,136,243,135,190,225,144,137,190,218,45,139,190,112,202,140,190,164,102,142,190,116,2,144,190,223,157,145,190,228,56,147,190,129,211,148,190,182,109,150,190,129,7,152,190,226,160,153,190,215,57,155,190,95,210,156,190,121,106,158,190,35,2,160,190,94,153,161,190,38,48,163,190,125,198,164,190,96,92,166,190,206,241,167,190,198,134,169,190,71,27,171,190,80,175,172,190,224,66,174,190,245,213,175,190,143,104,177,190,173,250,178,190,77,140,180,190,110,29,182,190,16,174,183,190,48,62,185,190,207,205,186,190,234,92,188,190,130,235,189,190,148,121,191,190,31,7,193,190,35,148,194,190,159,32,196,190,145,172,197,190,248,55,199,190,211,194,200,190,34,77,202,190,226,214,203,190,19,96,205,190,181,232,206,190,197,112,208,190,66,248,209,190,45,127,211,190,131,5,213,190,67,139,214,190,109,16,216,190,255,148,217,190,249,24,219,190,89,156,220,190,29,31,222,190,70,161,223,190,211,34,225,190,193,163,226,190,16,36,228,190,190,163,229,190,204,34,231,190,56,161,232,190,0,31,234,190,36,156,235,190,162,24,237,190,122,148,238,190,171,15,240,190,51,138,241,190,18,4,243,190,70,125,244,190,207,245,245,190,170,109,247,190,217,228,248,190,88,91,250,190,40,209,251,190,71,70,253,190,181,186,254,190,56,23,0,191,187,208,0,191,228,137,1,191,178,66,2,191,37,251,2,191,59,179,3,191,246,106,4,191,83,34,5,191,83,217,5,191,245,143,6,191,56,70,7,191,29,252,7,191,162,177,8,191,199,102,9,191,140,27,10,191,240,207,10,191,243,131,11,191,147,55,12,191,209,234,12,191,172,157,13,191,36,80,14,191,56,2,15,191,232,179,15,191,50,101,16,191,24,22,17,191,151,198,17,191,176,118,18,191,99,38,19,191,174,213,19,191,145,132,20,191,13,51,21,191,31,225,21,191,200,142,22,191,8,60,23,191,221,232,23,191,72,149,24,191,72,65,25,191,220,236,25,191,4,152,26,191,192,66,27,191,15,237,27,191,240,150,28,191,99,64,29,191,104,233,29,191,254,145,30,191,37,58,31,191,220,225,31,191,35,137,32,191,250,47,33,191,95,214,33,191,82,124,34,191,212,33,35,191,227,198,35,191,127,107,36,191,167,15,37,191,92,179,37,191,157,86,38,191,104,249,38,191,191,155,39,191,160,61,40,191,11,223,40,191,255,127,41,191,125,32,42,191,131,192,42,191,17,96,43,191,39,255,43,191,196,157,44,191,232,59,45,191,146,217,45,191,195,118,46,191,121,19,47,191,180,175,47,191,115,75,48,191,183,230,48,191,127,129,49,191,203,27,50,191,153,181,50,191,234,78,51,191,189,231,51,191,18,128,52,191,232,23,53,191,63,175,53,191,22,70,54,191,110,220,54,191,69,114,55,191,156,7,56,191,113,156,56,191,197,48,57,191,150,196,57,191,230,87,58,191,178,234,58,191,252,124,59,191,194,14,60,191,3,160,60,191,193,48,61,191,250,192,61,191,173,80,62,191,219,223,62,191,131,110,63,191,165,252,63,191,64,138,64,191,83,23,65,191,224,163,65,191,228,47,66,191,96,187,66,191,83,70,67,191,190,208,67,191,158,90,68,191,246,227,68,191,194,108,69,191,5,245,69,191,188,124,70,191,232,3,71,191,137,138,71,191,157,16,72,191,37,150,72,191,32,27,73,191,142,159,73,191,111,35,74,191,193,166,74,191,134,41,75,191,188,171,75,191,99,45,76,191,122,174,76,191,2,47,77,191,250,174,77,191,98,46,78,191,57,173,78,191,126,43,79,191,51,169,79,191,85,38,80,191,230,162,80,191,228,30,81,191,80,154,81,191,40,21,82,191,109,143,82,191,30,9,83,191,59,130,83,191,195,250,83,191,183,114,84,191,22,234,84,191,223,96,85,191,18,215,85,191,176,76,86,191,183,193,86,191,39,54,87,191,0,170,87,191,66,29,88,191,236,143,88,191,254,1,89,191,120,115,89,191,89,228,89,191,162,84,90,191,81,196,90,191,102,51,91,191,226,161,91,191,195,15,92,191,10,125,92,191,183,233,92,191,200,85,93,191,62,193,93,191,24,44,94,191,87,150,94,191,249,255,94,191,255,104,95,191,104,209,95,191,51,57,96,191,98,160,96,191,243,6,97,191,229,108,97,191,58,210,97,191,240,54,98,191,8,155,98,191,128,254,98,191,89,97,99,191,146,195,99,191,44,37,100,191,37,134,100,191,126,230,100,191,55,70,101,191,78,165,101,191,197,3,102,191,154,97,102,191,205,190,102,191,94,27,103,191,77,119,103,191,154,210,103,191,68,45,104,191,75,135,104,191,174,224,104,191,111,57,105,191,139,145,105,191,4,233,105,191,217,63,106,191,9,150,106,191,148,235,106,191,123,64,107,191,188,148,107,191,89,232,107,191,79,59,108,191,160,141,108,191,75,223,108,191,79,48,109,191,173,128,109,191,101,208,109,191,117,31,110,191,223,109,110,191,161,187,110,191,187,8,111,191,46,85,111,191,248,160,111,191,27,236,111,191,149,54,112,191,103,128,112,191,144,201,112,191,15,18,113,191,230,89,113,191,19,161,113,191,151,231,113,191,113,45,114,191,160,114,114,191,38,183,114,191,1,251,114,191,50,62,115,191,184,128,115,191,148,194,115,191,196,3,116,191,73,68,116,191,34,132,116,191,80,195,116,191,210,1,117,191,168,63,117,191,210,124,117,191,80,185,117,191,33,245,117,191,69,48,118,191,189,106,118,191,136,164,118,191,166,221,118,191,22,22,119,191,217,77,119,191,239,132,119,191,87,187,119,191,17,241,119,191,29,38,120,191,122,90,120,191,42,142,120,191,43,193,120,191,125,243,120,191,33,37,121,191,22,86,121,191,92,134,121,191,242,181,121,191,218,228,121,191,18,19,122,191,154,64,122,191,115,109,122,191,157,153,122,191,22,197,122,191,223,239,122,191,248,25,123,191,97,67,123,191,26,108,123,191,34,148,123,191,122,187,123,191,32,226,123,191,23,8,124,191,92,45,124,191,240,81,124,191,211,117,124,191,5,153,124,191,134,187,124,191,85,221,124,191,115,254,124,191,223,30,125,191,154,62,125,191,163,93,125,191,250,123,125,191,159,153,125,191,146,182,125,191,211,210,125,191,98,238,125,191,63,9,126,191,105,35,126,191,225,60,126,191,167,85,126,191,186,109,126,191,27,133,126,191,201,155,126,191,196,177,126,191,13,199,126,191,162,219,126,191,133,239,126,191,181,2,127,191,50,21,127,191,252,38,127,191,19,56,127,191,118,72,127,191,39,88,127,191,36,103,127,191,110,117,127,191,5,131,127,191,232,143,127,191,25,156,127,191,149,167,127,191,95,178,127,191,116,188,127,191,215,197,127,191,133,206,127,191,129,214,127,191,200,221,127,191,93,228,127,191,61,234,127,191,106,239,127,191,227,243,127,191,169,247,127,191,187,250,127,191,25,253,127,191,196,254,127,191,187,255,127,191,250,255,127,63,57,254,127,63,169,249,127,63,75,242,127,63,30,232,127,63,35,219,127,63,89,203,127,63,193,184,127,63,91,163,127,63,40,139,127,63,39,112,127,63,90,82,127,63,191,49,127,63,88,14,127,63,37,232,126,63,38,191,126,63,92,147,126,63,200,100,126,63,105,51,126,63,65,255,125,63,79,200,125,63,150,142,125,63,20,82,125,63,203,18,125,63,188,208,124,63,231,139,124,63,77,68,124,63,239,249,123,63,205,172,123,63,233,92,123,63,67,10,123,63,221,180,122,63,182,92,122,63,209,1,122,63,46,164,121,63,206,67,121,63,178,224,120,63,220,122,120,63,76,18,120,63,4,167,119,63,4,57,119,63,79,200,118,63,228,84,118,63,198,222,117,63,246,101,117,63,117,234,116,63,68,108,116,63,101,235,115,63,218,103,115,63,163,225,114,63,194,88,114,63,57,205,113,63,9,63,113,63,52,174,112,63,187,26,112,63,160,132,111,63,228,235,110,63,138,80,110,63,147,178,109,63,1,18,109,63,213,110,108,63,17,201,107,63,183,32,107,63,201,117,106,63,73,200,105,63,57,24,105,63,155,101,104,63,111,176,103,63,186,248,102,63,124,62,102,63,184,129,101,63,111,194,100,63,164,0,100,63,90,60,99,63,145,117,98,63,76,172,97,63,142,224,96,63,89,18,96,63,174,65,95,63,145,110,94,63,3,153,93,63,8,193,92,63,160,230,91,63,207,9,91,63,152,42,90,63,251,72,89,63,253,100,88,63,159,126,87,63,229,149,86,63,208,170,85,63,99,189,84,63,161,205,83,63,140,219,82,63,39,231,81,63,117,240,80,63,121,247,79,63,52,252,78,63,171,254,77,63,223,254,76,63,212,252,75,63,140,248,74,63,10,242,73,63,82,233,72,63,101,222,71,63,71,209,70,63,251,193,69,63,132,176,68,63,229,156,67,63,32,135,66,63,58,111,65,63,52,85,64,63,19,57,63,63,216,26,62,63,136,250,60,63,38,216,59,63,180,179,58,63,54,141,57,63,175,100,56,63,34,58,55,63,147,13,54,63,5,223,52,63,124,174,51,63,249,123,50,63,130,71,49,63,25,17,48,63,194,216,46,63,127,158,45,63,86,98,44,63,72,36,43,63,90,228,41,63,144,162,40,63,235,94,39,63,113,25,38,63,37,210,36,63,9,137,35,63,35,62,34,63,117,241,32,63,4,163,31,63,210,82,30,63,228,0,29,63,61,173,27,63,225,87,26,63,211,0,25,63,25,168,23,63,180,77,22,63,170,241,20,63,253,147,19,63,178,52,18,63,204,211,16,63,80,113,15,63,66,13,14,63,164,167,12,63,124,64,11,63,205,215,9,63,154,109,8,63,233,1,7,63,189,148,5,63,25,38,4,63,3,182,2,63,126,68,1,63,28,163,255,62,110,186,252,62,250,206,249,62,202,224,246,62,228,239,243,62,81,252,240,62,26,6,238,62,71,13,235,62,224,17,232,62,237,19,229,62,119,19,226,62,135,16,223,62,36,11,220,62,88,3,217,62,42,249,213,62,164,236,210,62,205,221,207,62,175,204,204,62,82,185,201,62,191,163,198,62,254,139,195,62,24,114,192,62,22,86,189,62,0,56,186,62,224,23,183,62,189,245,179,62,161,209,176,62,149,171,173,62,162,131,170,62,207,89,167,62,39,46,164,62,178,0,161,62,121,209,157,62,133,160,154,62,223,109,151,62,143,57,148,62,160,3,145,62,26,204,141,62,5,147,138,62,107,88,135,62,86,28,132,62,205,222,128,62,182,63,123,62,16,191,116,62,187,59,110,62,201,181,103,62,77,45,97,62,89,162,90,62,255,20,84,62,81,133,77,62,99,243,70,62,70,95,64,62,13,201,57,62,202,48,51,62,144,150,44,62,114,250,37,62,130,92,31,62,210,188,24,62,118,27,18,62,127,120,11,62,1,212,4,62,29,92,252,61,114,13,239,61,41,188,225,61,102,104,212,61,78,18,199,61,8,186,185,61,184,95,172,61,132,3,159,61,146,165,145,61,7,70,132,61,18,202,109,61,122,5,83,61,145,62,56,61,164,117,29,61,252,170,2,61,202,189,207,60,86,35,154,60,97,14,73,60,197,167,187,59,61,122,86,186,9,70,241,187,18,221,99,188,80,138,167,188,65,36,221,188,227,93,9,189,35,40,36,189,150,240,62,189,242,182,89,189,234,122,116,189,26,158,135,189,66,253,148,189,200,90,162,189,134,182,175,189,87,16,189,189,22,104,202,189,155,189,215,189,195,16,229,189,105,97,242,189,101,175,255,189,74,125,6,190,104,33,13,190,250,195,19,190,237,100,26,190,46,4,33,190,172,161,39,190,83,61,46,190,16,215,52,190,210,110,59,190,134,4,66,190,25,152,72,190,121,41,79,190,148,184,85,190,86,69,92,190,174,207,98,190,137,87,105,190,214,220,111,190,128,95,118,190,120,223,124,190,84,174,129,190,129,235,132,190,56,39,136,190,114,97,139,190,36,154,142,190,69,209,145,190,205,6,149,190,179,58,152,190,238,108,155,190,116,157,158,190,61,204,161,190,64,249,164,190,115,36,168,190,207,77,171,190,73,117,174,190,218,154,177,190,120,190,180,190,27,224,183,190,186,255,186,190,75,29,190,190,199,56,193,190,37,82,196,190,91,105,199,190,97,126,202,190,48,145,205,190,188,161,208,190,0,176,211,190,241,187,214,190,135,197,217,190,186,204,220,190,129,209,223,190,211,211,226,190,169,211,229,190,250,208,232,190,189,203,235,190,234,195,238,190,120,185,241,190,96,172,244,190,154,156,247,190,28,138,250,190,223,116,253,190,109,46,0,191,3,161,1,191,45,18,3,191,230,129,4,191,44,240,5,191,250,92,7,191,76,200,8,191,30,50,10,191,108,154,11,191,50,1,13,191,108,102,14,191,23,202,15,191,45,44,17,191,172,140,18,191,144,235,19,191,213,72,21,191,118,164,22,191,113,254,23,191,192,86,25,191,98,173,26,191,81,2,28,191,138,85,29,191,9,167,30,191,203,246,31,191,204,68,33,191,9,145,34,191,124,219,35,191,36,36,37,191,253,106,38,191,2,176,39,191,48,243,40,191,132,52,42,191,250,115,43,191,143,177,44,191,63,237,45,191,7,39,47,191,227,94,48,191,208,148,49,191,202,200,50,191,206,250,51,191,218,42,53,191,232,88,54,191,247,132,55,191,2,175,56,191,7,215,57,191,3,253,58,191,241,32,60,191,207,66,61,191,154,98,62,191,79,128,63,191,233,155,64,191,104,181,65,191,198,204,66,191,1,226,67,191,23,245,68,191,3,6,70,191,196,20,71,191,86,33,72,191,182,43,73,191,225,51,74,191,212,57,75,191,141,61,76,191,9,63,77,191,68,62,78,191,61,59,79,191,240,53,80,191,90,46,81,191,121,36,82,191,74,24,83,191,202,9,84,191,247,248,84,191,206,229,85,191,77,208,86,191,112,184,87,191,55,158,88,191,156,129,89,191,160,98,90,191,62,65,91,191,117,29,92,191,65,247,92,191,162,206,93,191,148,163,94,191,20,118,95,191,34,70,96,191,186,19,97,191,217,222,97,191,127,167,98,191,169,109,99,191,84,49,100,191,126,242,100,191,38,177,101,191,73,109,102,191,229,38,103,191,248,221,103,191,128,146,104,191,123,68,105,191,232,243,105,191,195,160,106,191,12,75,107,191,192,242,107,191,222,151,108,191,100,58,109,191,80,218,109,191,160,119,110,191,83,18,111,191,102,170,111,191,217,63,112,191,169,210,112,191,213,98,113,191,91,240,113,191,58,123,114,191,113,3,115,191,253,136,115,191,222,11,116,191,17,140,116,191,150,9,117,191,107,132,117,191,143,252,117,191,0,114,118,191,189,228,118,191,198,84,119,191,24,194,119,191,178,44,120,191,147,148,120,191,187,249,120,191,40,92,121,191,217,187,121,191,205,24,122,191,2,115,122,191,121,202,122,191,47,31,123,191,36,113,123,191,88,192,123,191,201,12,124,191,118,86,124,191,95,157,124,191,130,225,124,191,224,34,125,191,119,97,125,191,71,157,125,191,79,214,125,191,142,12,126,191,4,64,126,191,176,112,126,191,146,158,126,191,169,201,126,191,245,241,126,191,117,23,127,191,41,58,127,191,16,90,127,191,43,119,127,191,120,145,127,191,248,168,127,191,170,189,127,191,143,207,127,191,165,222,127,191,237,234,127,191,102,244,127,191,17,251,127,191,237,254,127,191,234,255,127,63,229,248,127,63,166,230,127,63,45,201,127,63,124,160,127,63,149,108,127,63,121,45,127,63,44,227,126,63,177,141,126,63,11,45,126,63,63,193,125,63,82,74,125,63,72,200,124,63,40,59,124,63,247,162,123,63,189,255,122,63,128,81,122,63,72,152,121,63,30,212,120,63,9,5,120,63,19,43,119,63,70,70,118,63,172,86,117,63,78,92,116,63,56,87,115,63,118,71,114,63,19,45,113,63,28,8,112,63,158,216,110,63,165,158,109,63,64,90,108,63,126,11,107,63,107,178,105,63,25,79,104,63,150,225,102,63,242,105,101,63,62,232,99,63,139,92,98,63,234,198,96,63,109,39,95,63,38,126,93,63,40,203,91,63,133,14,90,63,83,72,88,63,163,120,86,63,139,159,84,63,32,189,82,63,118,209,80,63,163,220,78,63,189,222,76,63,219,215,74,63,19,200,72,63,124,175,70,63,46,142,68,63,65,100,66,63,206,49,64,63,236,246,61,63,180,179,59,63,66,104,57,63,173,20,55,63,16,185,52,63,134,85,50,63,41,234,47,63,21,119,45,63,101,252,42,63,53,122,40,63,161,240,37,63,198,95,35,63,192,199,32,63,172,40,30,63,169,130,27,63,212,213,24,63,74,34,22,63,42,104,19,63,147,167,16,63,164,224,13,63,123,19,11,63,57,64,8,63,253,102,5,63,231,135,2,63,45,70,255,62,91,113,249,62,151,145,243,62,36,167,237,62,69,178,231,62,60,179,225,62,76,170,219,62,186,151,213,62,201,123,207,62,190,86,201,62,223,40,195,62,112,242,188,62,183,179,182,62,251,108,176,62,129,30,170,62,146,200,163,62,115,107,157,62,108,7,151,62,197,156,144,62,199,43,138,62,185,180,131,62,199,111,122,62,33,107,109,62,17,92,96,62,41,67,83,62,253,32,70,62,32,246,56,62,38,195,43,62,164,136,30,62,45,71,17,62,87,255,3,62,110,99,237,61,194,189,210,61,218,14,184,61,222,87,157,61,251,153,130,61,188,172,79,61,101,28,26,61,153,10,201,60,42,167,59,60,193,120,214,186,45,68,113,188,87,215,227,188,76,129,39,189,148,15,93,189,21,74,137,189,90,6,164,189,109,187,190,189,34,104,217,189,78,11,244,189,227,81,7,190,47,152,20,190,247,215,33,190,165,16,47,190,166,65,60,190,100,106,73,190,77,138,86,190,205,160,99,190,80,173,112,190,69,175,125,190,13,83,133,190,158,200,139,190,13,56,146,190,18,161,152,190,102,3,159,190,191,94,165,190,216,178,171,190,105,255,177,190,43,68,184,190,216,128,190,190,42,181,196,190,219,224,202,190,165,3,209,190,69,29,215,190,117,45,221,190,241,51,227,190,118,48,233,190,192,34,239,190,141,10,245,190,155,231,250,190,211,92,0,191,56,64,3,191,219,29,6,191,155,245,8,191,90,199,11,191,247,146,14,191,84,88,17,191,80,23,20,191,205,207,22,191,172,129,25,191,208,44,28,191,26,209,30,191,109,110,33,191,171,4,36,191,183,147,38,191,116,27,41,191,199,155,43,191,147,20,46,191,187,133,48,191,38,239,50,191,183,80,53,191,85,170,55,191,227,251,57,191,74,69,60,191,110,134,62,191,55,191,64,191,139,239,66,191,83,23,69,191,117,54,71,191,218,76,73,191,107,90,75,191,16,95,77,191,179,90,79,191,62,77,81,191,154,54,83,191,179,22,85,191,114,237,86,191,197,186,88,191,149,126,90,191,208,56,92,191,98,233,93,191,56,144,95,191,64,45,97,191,103,192,98,191,156,73,100,191,206,200,101,191,235,61,103,191,227,168,104,191,167,9,106,191,39,96,107,191,84,172,108,191,31,238,109,191,122,37,111,191,88,82,112,191,171,116,113,191,103,140,114,191,127,153,115,191,231,155,116,191,149,147,117,191,126,128,118,191,150,98,119,191,212,57,120,191,47,6,121,191,158,199,121,191,23,126,122,191,148,41,123,191,13,202,123,191,122,95,124,191,213,233,124,191,24,105,125,191,62,221,125,191,64,70,126,191,28,164,126,191,204,246,126,191,77,62,127,191,156,122,127,191,182,171,127,191,153,209,127,191,67,236,127,191,180,251,127,191,166,255,127,63,148,227,127,63,156,154,127,63,204,36,127,63,56,130,126,63,253,178,125,63,63,183,124,63,42,143,123,63,243,58,122,63,212,186,120,63,17,15,119,63,246,55,117,63,213,53,115,63,8,9,113,63,241,177,110,63,249,48,108,63,144,134,105,63,47,179,102,63,83,183,99,63,132,147,96,63,78,72,93,63,69,214,89,63,3,62,86,63,43,128,82,63,101,157,78,63,94,150,74,63,204,107,70,63,106,30,66,63,249,174,61,63,64,30,57,63,13,109,52,63,50,156,47,63,135,172,42,63,235,158,37,63,63,116,32,63,109,45,27,63,97,203,21,63,13,79,16,63,104,185,10,63,107,11,5,63,46,140,254,62,221,212,242,62,241,242,230,62,127,232,218,62,166,183,206,62,136,98,194,62,78,235,181,62,42,84,169,62,81,159,156,62,253,206,143,62,109,229,130,62,206,201,107,62,98,159,81,62,48,80,55,62,211,224,28,62,241,85,2,62,98,104,207,61,124,0,154,61,36,251,72,61,27,164,187,60,243,119,86,187,100,61,241,188,187,192,99,189,103,93,167,189,20,189,220,189,3,251,8,190,115,127,35,190,52,231,61,190,164,45,88,190,38,78,114,190,18,34,134,190,137,5,147,190,52,207,159,190,213,124,172,190,51,12,185,190,26,123,197,190,91,199,209,190,205,238,221,190,80,239,233,190,199,198,245,190,144,185,0,191,38,121,6,191,36,33,12,191,141,176,17,191,102,38,23,191,186,129,28,191,152,193,33,191,21,229,38,191,74,235,43,191,86,211,48,191,91,156,53,191,131,69,58,191,253,205,62,191,252,52,67,191,188,121,71,191,125,155,75,191,132,153,79,191,31,115,83,191,161,39,87,191,99,182,90,191,198,30,94,191,48,96,97,191,15,122,100,191,216,107,103,191,7,53,106,191,31,213,108,191,169,75,111,191,55,152,113,191,98,186,115,191,201,177,117,191,22,126,119,191,246,30,121,191,33,148,122,191,85,221,123,191,89,250,124,191,250,234,125,191,14,175,126,191,116,70,127,191,15,177,127,191,206,238,127,191,0,0,0,0,0,0,0,0,3,0,0,0,2,0,0,0,3,0,0,0,2,0,0,0,5,0,0,0,2,0,0,0,3,0,0,0,2,0,0,0,3,0,0,0,2,0,0,0,5,0,0,0,2,0,0,0,3,0,0,0,2,0,0,0,0,0,206,64,0,0,200,64,0,0,184,64,0,0,170,64,0,0,162,64,0,0,154,64,0,0,144,64,0,0,140,64,0,0,156,64,0,0,150,64,0,0,146,64,0,0,142,64,0,0,156,64,0,0,148,64,0,0,138,64,0,0,144,64,0,0,140,64,0,0,148,64,0,0,152,64,0,0,142,64,0,0,112,64,0,0,112,64,0,0,112,64,0,0,112,64,0,0,112,64,0,134,107,63,0,20,46,63,0,112,189,62,0,208,76,62,0,0,102,63,0,0,76,63,0,0,38,63,0,0,0,63,15,0,0,0,10,0,0,0,5,0,0,0,6,0,0,0,4,0,0,0,3,0,0,0,0,115,0,0,8,115,0,0,24,115,0,0,56,115,0,0,64,115,0,0,80,115,0,0,112,115,0,0,152,115,0,0,232,115,0,0,136,116,0,0,144,116,0,0,160,116,0,0,0,0,0,0,64,31,0,0,184,36,0,0,236,44,0,0,188,52,0,0,92,68,0,0,168,97,0,0,128,56,1,0,0,0,0,0,40,35,0,0,224,46,0,0,164,56,0,0,68,72,0,0,180,95,0,0,172,138,0,0,128,56,1,0,0,0,0,0,4,41,0,0,176,54,0,0,104,66,0,0,252,83,0,0,84,111,0,0,16,164,0,0,128,56,1,0,222,116,0,0,225,116,0,0,10,103,242,14,86,205,228,29,10,103,242,14,117,82,130,12,89,154,4,25,117,82,130,12,70,17,49,10,237,3,98,20,70,17,49,10,218,2,215,7,249,198,173,15,218,2,215,7,34,182,82,5,218,250,164,10,34,182,82,5,70,243,46,30,43,227,75,14,31,102,128,24,28,44,29,10,218,97,72,18,237,156,244,6,236,48,19,11,227,144,165,4,237,164,29,2,10,223,107,3,1,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,2,0,0,0,1,0,0,0,7,0,0,0,0,0,0,0,4,0,0,0,3,0,0,0,6,0,0,0,1,0,0,0,5,0,0,0,2,0,0,0,15,0,0,0,0,0,0,0,8,0,0,0,7,0,0,0,12,0,0,0,3,0,0,0,11,0,0,0,4,0,0,0,14,0,0,0,1,0,0,0,9,0,0,0,6,0,0,0,13,0,0,0,2,0,0,0,10,0,0,0,5,0,0,0,144,69,0,0,80,72,0,0,12,75,0,0,196,77,0,0,120,80,0,0,40,83,0,0,212,85,0,0,60,87,0,0,248,87,0,0,108,88,0,0,184,88,0,0,240,88,0,0,16,89,0,0,40,89,0,0,52,89,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,3,0,0,0,5,0,0,0,7,0,0,0,9,0,0,0,11,0,0,0,13,0,0,0,15,0,0,0,17,0,0,0,19,0,0,0,21,0,0,0,23,0,0,0,25,0,0,0,27,0,0,0,29,0,0,0,31,0,0,0,33,0,0,0,35,0,0,0,37,0,0,0,39,0,0,0,41,0,0,0,43,0,0,0,45,0,0,0,47,0,0,0,49,0,0,0,51,0,0,0,53,0,0,0,55,0,0,0,57,0,0,0,59,0,0,0,61,0,0,0,63,0,0,0,65,0,0,0,67,0,0,0,69,0,0,0,71,0,0,0,73,0,0,0,75,0,0,0,77,0,0,0,79,0,0,0,81,0,0,0,83,0,0,0,85,0,0,0,87,0,0,0,89,0,0,0,91,0,0,0,93,0,0,0,95,0,0,0,97,0,0,0,99,0,0,0,101,0,0,0,103,0,0,0,105,0,0,0,107,0,0,0,109,0,0,0,111,0,0,0,113,0,0,0,115,0,0,0,117,0,0,0,119,0,0,0,121,0,0,0,123,0,0,0,125,0,0,0,127,0,0,0,129,0,0,0,131,0,0,0,133,0,0,0,135,0,0,0,137,0,0,0,139,0,0,0,141,0,0,0,143,0,0,0,145,0,0,0,147,0,0,0,149,0,0,0,151,0,0,0,153,0,0,0,155,0,0,0,157,0,0,0,159,0,0,0,161,0,0,0,163,0,0,0,165,0,0,0,167,0,0,0,169,0,0,0,171,0,0,0,173,0,0,0,175,0,0,0,177,0,0,0,179,0,0,0,181,0,0,0,183,0,0,0,185,0,0,0,187,0,0,0,189,0,0,0,191,0,0,0,193,0,0,0,195,0,0,0,197,0,0,0,199,0,0,0,201,0,0,0,203,0,0,0,205,0,0,0,207,0,0,0,209,0,0,0,211,0,0,0,213,0,0,0,215,0,0,0,217,0,0,0,219,0,0,0,221,0,0,0,223,0,0,0,225,0,0,0,227,0,0,0,229,0,0,0,231,0,0,0,233,0,0,0,235,0,0,0,237,0,0,0,239,0,0,0,241,0,0,0,243,0,0,0,245,0,0,0,247,0,0,0,249,0,0,0,251,0,0,0,253,0,0,0,255,0,0,0,1,1,0,0,3,1,0,0,5,1,0,0,7,1,0,0,9,1,0,0,11,1,0,0,13,1,0,0,15,1,0,0,17,1,0,0,19,1,0,0,21,1,0,0,23,1,0,0,25,1,0,0,27,1,0,0,29,1,0,0,31,1,0,0,33,1,0,0,35,1,0,0,37,1,0,0,39,1,0,0,41,1,0,0,43,1,0,0,45,1,0,0,47,1,0,0,49,1,0,0,51,1,0,0,53,1,0,0,55,1,0,0,57,1,0,0,59,1,0,0,61,1,0,0,63,1,0,0,65,1,0,0,67,1,0,0,69,1,0,0,71,1,0,0,73,1,0,0,75,1,0,0,77,1,0,0,79,1,0,0,81,1,0,0,83,1,0,0,85,1,0,0,87,1,0,0,89,1,0,0,91,1,0,0,93,1,0,0,95,1,0,0,13,0,0,0,25,0,0,0,41,0,0,0,61,0,0,0,85,0,0,0,113,0,0,0,145,0,0,0,181,0,0,0,221,0,0,0,9,1,0,0,57,1,0,0,109,1,0,0,165,1,0,0,225,1,0,0,33,2,0,0,101,2,0,0,173,2,0,0,249,2,0,0,73,3,0,0,157,3,0,0,245,3,0,0,81,4,0,0,177,4,0,0,21,5,0,0,125,5,0,0,233,5,0,0,89,6,0,0,205,6,0,0,69,7,0,0,193,7,0,0,65,8,0,0,197,8,0,0,77,9,0,0,217,9,0,0,105,10,0,0,253,10,0,0,149,11,0,0,49,12,0,0,209,12,0,0,117,13,0,0,29,14,0,0,201,14,0,0,121,15,0,0,45,16,0,0,229,16,0,0,161,17,0,0,97,18,0,0,37,19,0,0,237,19,0,0,185,20,0,0,137,21,0,0,93,22,0,0,53,23,0,0,17,24,0,0,241,24,0,0,213,25,0,0,189,26,0,0,169,27,0,0,153,28,0,0,141,29,0,0,133,30,0,0,129,31,0,0,129,32,0,0,133,33,0,0,141,34,0,0,153,35,0,0,169,36,0,0,189,37,0,0,213,38,0,0,241,39,0,0,17,41,0,0,53,42,0,0,93,43,0,0,137,44,0,0,185,45,0,0,237,46,0,0,37,48,0,0,97,49,0,0,161,50,0,0,229,51,0,0,45,53,0,0,121,54,0,0,201,55,0,0,29,57,0,0,117,58,0,0,209,59,0,0,49,61,0,0,149,62,0,0,253,63,0,0,105,65,0,0,217,66,0,0,77,68,0,0,197,69,0,0,65,71,0,0,193,72,0,0,69,74,0,0,205,75,0,0,89,77,0,0,233,78,0,0,125,80,0,0,21,82,0,0,177,83,0,0,81,85,0,0,245,86,0,0,157,88,0,0,73,90,0,0,249,91,0,0,173,93,0,0,101,95,0,0,33,97,0,0,225,98,0,0,165,100,0,0,109,102,0,0,57,104,0,0,9,106,0,0,221,107,0,0,181,109,0,0,145,111,0,0,113,113,0,0,85,115,0,0,61,117,0,0,41,119,0,0,25,121,0,0,13,123,0,0,5,125,0,0,1,127,0,0,1,129,0,0,5,131,0,0,13,133,0,0,25,135,0,0,41,137,0,0,61,139,0,0,85,141,0,0,113,143,0,0,145,145,0,0,181,147,0,0,221,149,0,0,9,152,0,0,57,154,0,0,109,156,0,0,165,158,0,0,225,160],"i8",ALLOC_NONE,Runtime.GLOBAL_BASE+10240), allocate([33,163,0,0,101,165,0,0,173,167,0,0,249,169,0,0,73,172,0,0,157,174,0,0,245,176,0,0,81,179,0,0,177,181,0,0,21,184,0,0,125,186,0,0,233,188,0,0,89,191,0,0,205,193,0,0,69,196,0,0,193,198,0,0,65,201,0,0,197,203,0,0,77,206,0,0,217,208,0,0,105,211,0,0,253,213,0,0,149,216,0,0,49,219,0,0,209,221,0,0,117,224,0,0,29,227,0,0,201,229,0,0,121,232,0,0,45,235,0,0,229,237,0,0,161,240,0,0,63,0,0,0,129,0,0,0,231,0,0,0,121,1,0,0,63,2,0,0,65,3,0,0,135,4,0,0,25,6,0,0,255,7,0,0,65,10,0,0,231,12,0,0,249,15,0,0,127,19,0,0,129,23,0,0,7,28,0,0,25,33,0,0,191,38,0,0,1,45,0,0,231,51,0,0,121,59,0,0,191,67,0,0,193,76,0,0,135,86,0,0,25,97,0,0,127,108,0,0,193,120,0,0,231,133,0,0,249,147,0,0,255,162,0,0,1,179,0,0,7,196,0,0,25,214,0,0,63,233,0,0,129,253,0,0,231,18,1,0,121,41,1,0,63,65,1,0,65,90,1,0,135,116,1,0,25,144,1,0,255,172,1,0,65,203,1,0,231,234,1,0,249,11,2,0,127,46,2,0,129,82,2,0,7,120,2,0,25,159,2,0,191,199,2,0,1,242,2,0,231,29,3,0,121,75,3,0,191,122,3,0,193,171,3,0,135,222,3,0,25,19,4,0,127,73,4,0,193,129,4,0,231,187,4,0,249,247,4,0,255,53,5,0,1,118,5,0,7,184,5,0,25,252,5,0,63,66,6,0,129,138,6,0,231,212,6,0,121,33,7,0,63,112,7,0,65,193,7,0,135,20,8,0,25,106,8,0,255,193,8,0,65,28,9,0,231,120,9,0,249,215,9,0,127,57,10,0,129,157,10,0,7,4,11,0,25,109,11,0,191,216,11,0,1,71,12,0,231,183,12,0,121,43,13,0,191,161,13,0,193,26,14,0,135,150,14,0,25,21,15,0,127,150,15,0,193,26,16,0,231,161,16,0,249,43,17,0,255,184,17,0,1,73,18,0,7,220,18,0,25,114,19,0,63,11,20,0,129,167,20,0,231,70,21,0,121,233,21,0,63,143,22,0,65,56,23,0,135,228,23,0,25,148,24,0,255,70,25,0,65,253,25,0,231,182,26,0,249,115,27,0,127,52,28,0,129,248,28,0,7,192,29,0,25,139,30,0,191,89,31,0,1,44,32,0,231,1,33,0,121,219,33,0,191,184,34,0,193,153,35,0,135,126,36,0,25,103,37,0,127,83,38,0,193,67,39,0,231,55,40,0,249,47,41,0,255,43,42,0,1,44,43,0,7,48,44,0,25,56,45,0,63,68,46,0,129,84,47,0,231,104,48,0,121,129,49,0,63,158,50,0,65,191,51,0,135,228,52,0,25,14,54,0,255,59,55,0,65,110,56,0,231,164,57,0,249,223,58,0,127,31,60,0,129,99,61,0,7,172,62,0,25,249,63,0,191,74,65,0,1,161,66,0,231,251,67,0,121,91,69,0,191,191,70,0,193,40,72,0,135,150,73,0,25,9,75,0,127,128,76,0,193,252,77,0,231,125,79,0,249,3,81,0,255,142,82,0,1,31,84,0,7,180,85,0,25,78,87,0,63,237,88,0,129,145,90,0,231,58,92,0,121,233,93,0,63,157,95,0,65,86,97,0,135,20,99,0,25,216,100,0,255,160,102,0,65,111,104,0,231,66,106,0,249,27,108,0,127,250,109,0,65,1,0,0,169,2,0,0,9,5,0,0,193,8,0,0,65,14,0,0,9,22,0,0,169,32,0,0,193,46,0,0,1,65,0,0,41,88,0,0,9,117,0,0,129,152,0,0,129,195,0,0,9,247,0,0,41,52,1,0,1,124,1,0,193,207,1,0,169,48,2,0,9,160,2,0,65,31,3,0,193,175,3,0,9,83,4,0,169,10,5,0,65,216,5,0,129,189,6,0,41,188,7,0,9,214,8,0,1,13,10,0,1,99,11,0,9,218,12,0,41,116,14,0,129,51,16,0,65,26,18,0,169,42,20,0,9,103,22,0,193,209,24,0,65,109,27,0,9,60,30,0,169,64,33,0,193,125,36,0,1,246,39,0,41,172,43,0,9,163,47,0,129,221,51,0,129,94,56,0,9,41,61,0,41,64,66,0,1,167,71,0,193,96,77,0,169,112,83,0,9,218,89,0,65,160,96,0,193,198,103,0,9,81,111,0,169,66,119,0,65,159,127,0,129,106,136,0,41,168,145,0,9,92,155,0,1,138,165,0,1,54,176,0,9,100,187,0,41,24,199,0,129,86,211,0,65,35,224,0,169,130,237,0,9,121,251,0,193,10,10,1,65,60,25,1,9,18,41,1,169,144,57,1,193,188,74,1,1,155,92,1,41,48,111,1,9,129,130,1,129,146,150,1,129,105,171,1,9,11,193,1,41,124,215,1,1,194,238,1,193,225,6,2,169,224,31,2,9,196,57,2,65,145,84,2,193,77,112,2,9,255,140,2,169,170,170,2,65,86,201,2,129,7,233,2,41,196,9,3,9,146,43,3,1,119,78,3,1,121,114,3,9,158,151,3,41,236,189,3,129,105,229,3,65,28,14,4,169,10,56,4,9,59,99,4,193,179,143,4,65,123,189,4,9,152,236,4,169,16,29,5,193,235,78,5,1,48,130,5,41,228,182,5,9,15,237,5,129,183,36,6,129,228,93,6,9,157,152,6,41,232,212,6,1,205,18,7,193,82,82,7,169,128,147,7,9,94,214,7,65,242,26,8,193,68,97,8,9,93,169,8,169,66,243,8,65,253,62,9,129,148,140,9,41,16,220,9,9,120,45,10,1,212,128,10,1,44,214,10,9,136,45,11,41,240,134,11,129,108,226,11,65,5,64,12,169,194,159,12,9,173,1,13,193,204,101,13,65,42,204,13,9,206,52,14,169,192,159,14,193,10,13,15,1,181,124,15,41,200,238,15,9,77,99,16,129,76,218,16,129,207,83,17,9,223,207,17,41,132,78,18,1,200,207,18,193,179,83,19,169,80,218,19,9,168,99,20,65,195,239,20,193,171,126,21,9,107,16,22,169,10,165,22,65,148,60,23,129,17,215,23,41,140,116,24,9,14,21,25,1,161,184,25,1,79,95,26,9,34,9,27,41,36,182,27,129,95,102,28,65,222,25,29,169,170,208,29,9,207,138,30,193,85,72,31,65,73,9,32,9,180,205,32,169,160,149,33,193,25,97,34,1,42,48,35,41,220,2,36,9,59,217,36,129,81,179,37,147,6,0,0,69,14,0,0,15,28,0,0,17,51,0,0,91,87,0,0,13,142,0,0,119,221,0,0,57,77,1,0,99,230,1,0,149,179,2,0,31,193,3,0,33,29,5,0,171,215,6,0,221,2,9,0,7,179,11,0,201,254,14,0,51,255,18,0,229,207,23,0,47,143,29,0,49,94,36,0,251,96,44,0,173,190,53,0,151,161,64,0,89,55,77,0,3,177,91,0,53,67,108,0,63,38,127,0,65,150,148,0,75,211,172,0,125,33,200,0,39,201,230,0,233,22,9,1,211,91,47,1,133,237,89,1,79,38,137,1,81,101,189,1,155,14,247,1,77,139,54,2,183,73,124,2,121,189,200,2,163,95,28,3,213,174,119,3,95,47,219,3,97,107,71,4,235,242,188,4,29,92,60,5,71,67,198,5,9,75,91,6,115,28,252,6,37,103,169,7,111,225,99,8,113,72,44,9,59,96,3,10,237,243,233,10,215,213,224,11,153,223,232,12,67,242,2,14,117,246,47,15,127,220,112,16,129,156,198,17,139,54,50,19,189,178,180,20,103,33,79,22,41,155,2,24,19,65,208,25,197,60,185,27,143,192,190,29,145,7,226,31,219,85,36,34,141,248,134,36,247,69,11,39,185,157,178,41,227,104,126,44,21,26,112,47,159,45,137,50,161,41,203,53,43,158,55,57,93,37,208,60,135,99,150,64,73,7,140,68,179,201,178,72,101,110,12,77,175,195,154,81,177,162,95,86,123,239,92,91,45,153,148,96,23,154,8,102,217,247,186,107,131,195,173,113,181,25,227,119,191,34,93,126,29,35,0,0,113,77,0,0,145,156,0,0,253,38,1,0,101,12,2,0,233,119,3,0,153,162,5,0,53,214,8,0,45,112,13,0,225,228,19,0,33,195,28,0,237,183,40,0,117,146,56,0,89,72,77,0,41,250,103,0,37,248,137,0,61,199,180,0,81,38,234,0,177,19,44,1,221,210,124,1,133,242,222,1,201,82,85,2,185,43,227,2,21,20,140,3,77,8,84,4,193,113,63,5,65,46,83,6,205,151,148,7,149,140,9,9,57,119,184,10,73,87,168,12,5,202,224,14,93,19,106,17,49,39,77,20,209,178,147,23,189,38,72,27,165,192,117,31,169,149,40,36,217,156,109,41,245,185,82,47,109,200,230,53,161,166,57,61,97,65,92,69,173,159,96,78,181,238,89,88,25,142,92,99,105,28,126,111,229,131,213,124,255,189,0,0,1,168,1,0,143,107,3,0,241,158,6,0,63,35,12,0,193,61,21,0,143,182,35,0,241,252,57,0,255,81,91,0,1,250,139,0,15,117,209,0,113,191,50,1,63,154,184,1,193,220,109,2,15,207,95,3,113,142,158,4,255,123,61,6,1,182,83,8,143,156,252,10,241,97,88,14,63,167,140,18,193,37,197,23,143,101,52,30,241,129,20,38,255,251,167,47,1,156,58,59,15,98,34,73,113,134,192,89,63,138,130,109,193,88,227,132,1,14,4,0,145,33,9,0,17,44,19,0,65,238,37,0,65,79,71,0,145,67,128,0,17,247,221,0,1,70,115,1,1,146,90,2,17,1,184,3,145,53,188,5,65,143,167,8,65,6,206,12,17,178,155,18,145,15,154,26,1,26,118,37,1,76,7,52,145,158,87,71,17,157,172,96,65,166,145,129,35,81,22,0,197,158,50,0,23,185,107,0,153,246,216,0,107,137,160,1,13,196,254,2,31,1,80,5,33,217,29,9,51,108,48,15,213,162,164,24,167,103,8,39,41,253,125,60,123,181,231,91,29,119,29,137,175,160,45,201,173,142,123,0,137,230,25,1,57,150,94,2,61,22,216,4,181,99,119,9,225,40,198,17,33,3,52,32,117,72,130,56,125,87,87,96,191,91,175,2,129,216,39,6,247,132,94,13,233,254,173,27,127,139,235,54,129,183,229,104,23,3,156,193,193,12,255,14,57,106,133,34,25,238,145,75,129,120,43,158,51,225,9,84,32,0,10,0,20,46,100,1,221,121,0,0,188,100,0,0,29,123,0,0,93,123,0,0,111,123,0,0,15,124,0,0,87,124,0,0,60,103,0,0,32,0,16,0,102,38,171,1,159,124,0,0,82,103,0,0,159,126,0,0,223,126,0,0,253,126,0,0,253,127,0,0,69,128,0,0,82,107,0,0,48,117,0,0,112,23,0,0,32,209,255,255,32,209,255,255,0,64,0,0,108,34,0,0,66,15,0,0,18,6,0,0,77,2,0,0,219,0,0,0,237,0,0,0,153,0,0,0,73,0,0,0,30,0,0,0,12,0,0,0,7,0,0,0,0,64,0,0,147,93,0,0,189,112,0,0,237,121,0,0,178,125,0,0,36,127,0,0,0,0,0,0,240,0,0,0,1,0,0,0,2,0,0,0,3,0,0,0,4,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,5,0,0,0,3,0,0,0,4,0,0,0,1,0,0,0,2,0,0,0,2,0,0,0,2,0,0,0,0,0,0,0,40,1,0,0,6,0,0,0,7,0,0,0,1,0,0,0,0,0,0,0,88,1,0,0,1,0,0,0,8,0,0,0,3,0,0,0,4,0,0,0,2,0,0,0,0,0,0,0,72,1,0,0,1,0,0,0,9,0,0,0,3,0,0,0,4,0,0,0,3,0,0,0,0,0,0,0,216,1,0,0,1,0,0,0,10,0,0,0,3,0,0,0,4,0,0,0,1,0,0,0,3,0,0,0,3,0,0,0,3,0,0,0,0,0,1,0,2,0,3,0,4,0,5,0,6,0,7,0,8,0,10,0,12,0,14,0,16,0,20,0,24,0,28,0,34,0,40,0,48,0,60,0,78,0,100,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,0,8,0,8,0,8,0,16,0,16,0,16,0,21,0,21,0,24,0,29,0,34,0,36,0,0,0,96,0,192,0,32,1,128,1,32,0,128,0,224,0,64,1,160,1,64,0,160,0,0,1,96,1,192,1,8,0,104,0,200,0,40,1,136,1,40,0,136,0,232,0,72,1,168,1,72,0,168,0,8,1,104,1,200,1,16,0,112,0,208,0,48,1,144,1,48,0,144,0,240,0,80,1,176,1,80,0,176,0,16,1,112,1,208,1,24,0,120,0,216,0,56,1,152,1,56,0,152,0,248,0,88,1,184,1,88,0,184,0,24,1,120,1,216,1,4,0,100,0,196,0,36,1,132,1,36,0,132,0,228,0,68,1,164,1,68,0,164,0,4,1,100,1,196,1,12,0,108,0,204,0,44,1,140,1,44,0,140,0,236,0,76,1,172,1,76,0,172,0,12,1,108,1,204,1,20,0,116,0,212,0,52,1,148,1,52,0,148,0,244,0,84,1,180,1,84,0,180,0,20,1,116,1,212,1,28,0,124,0,220,0,60,1,156,1,60,0,156,0,252,0,92,1,188,1,92,0,188,0,28,1,124,1,220,1,1,0,97,0,193,0,33,1,129,1,33,0,129,0,225,0,65,1,161,1,65,0,161,0,1,1,97,1,193,1,9,0,105,0,201,0,41,1,137,1,41,0,137,0,233,0,73,1,169,1,73,0,169,0,9,1,105,1,201,1,17,0,113,0,209,0,49,1,145,1,49,0,145,0,241,0,81,1,177,1,81,0,177,0,17,1,113,1,209,1,25,0,121,0,217,0,57,1,153,1,57,0,153,0,249,0,89,1,185,1,89,0,185,0,25,1,121,1,217,1,5,0,101,0,197,0,37,1,133,1,37,0,133,0,229,0,69,1,165,1,69,0,165,0,5,1,101,1,197,1,13,0,109,0,205,0,45,1,141,1,45,0,141,0,237,0,77,1,173,1,77,0,173,0,13,1,109,1,205,1,21,0,117,0,213,0,53,1,149,1,53,0,149,0,245,0,85,1,181,1,85,0,181,0,21,1,117,1,213,1,29,0,125,0,221,0,61,1,157,1,61,0,157,0,253,0,93,1,189,1,93,0,189,0,29,1,125,1,221,1,2,0,98,0,194,0,34,1,130,1,34,0,130,0,226,0,66,1,162,1,66,0,162,0,2,1,98,1,194,1,10,0,106,0,202,0,42,1,138,1,42,0,138,0,234,0,74,1,170,1,74,0,170,0,10,1,106,1,202,1,18,0,114,0,210,0,50,1,146,1,50,0,146,0,242,0,82,1,178,1,82,0,178,0,18,1,114,1,210,1,26,0,122,0,218,0,58,1,154,1,58,0,154,0,250,0,90,1,186,1,90,0,186,0,26,1,122,1,218,1,6,0,102,0,198,0,38,1,134,1,38,0,134,0,230,0,70,1,166,1,70,0,166,0,6,1,102,1,198,1,14,0,110,0,206,0,46,1,142,1,46,0,142,0,238,0,78,1,174,1,78,0,174,0,14,1,110,1,206,1,22,0,118,0,214,0,54,1,150,1,54,0,150,0,246,0,86,1,182,1,86,0,182,0,22,1,118,1,214,1,30,0,126,0,222,0,62,1,158,1,62,0,158,0,254,0,94,1,190,1,94,0,190,0,30,1,126,1,222,1,3,0,99,0,195,0,35,1,131,1,35,0,131,0,227,0,67,1,163,1,67,0,163,0,3,1,99,1,195,1,11,0,107,0,203,0,43,1,139,1,43,0,139,0,235,0,75,1,171,1,75,0,171,0,11,1,107,1,203,1,19,0,115,0,211,0,51,1,147,1,51,0,147,0,243,0,83,1,179,1,83,0,179,0,19,1,115,1,211,1,27,0,123,0,219,0,59,1,155,1,59,0,155,0,251,0,91,1,187,1,91,0,187,0,27,1,123,1,219,1,7,0,103,0,199,0,39,1,135,1,39,0,135,0,231,0,71,1,167,1,71,0,167,0,7,1,103,1,199,1,15,0,111,0,207,0,47,1,143,1,47,0,143,0,239,0,79,1,175,1,79,0,175,0,15,1,111,1,207,1,23,0,119,0,215,0,55,1,151,1,55,0,151,0,247,0,87,1,183,1,87,0,183,0,23,1,119,1,215,1,31,0,127,0,223,0,63,1,159,1,63,0,159,0,255,0,95,1,191,1,95,0,191,0,31,1,127,1,223,1,0,0,48,0,96,0,144,0,192,0,16,0,64,0,112,0,160,0,208,0,32,0,80,0,128,0,176,0,224,0,4,0,52,0,100,0,148,0,196,0,20,0,68,0,116,0,164,0,212,0,36,0,84,0,132,0,180,0,228,0,8,0,56,0,104,0,152,0,200,0,24,0,72,0,120,0,168,0,216,0,40,0,88,0,136,0,184,0,232,0,12,0,60,0,108,0,156,0,204,0,28,0,76,0,124,0,172,0,220,0,44,0,92,0,140,0,188,0,236,0,1,0,49,0,97,0,145,0,193,0,17,0,65,0,113,0,161,0,209,0,33,0,81,0,129,0,177,0,225,0,5,0,53,0,101,0,149,0,197,0,21,0,69,0,117,0,165,0,213,0,37,0,85,0,133,0,181,0,229,0,9,0,57,0,105,0,153,0,201,0,25,0,73,0,121,0,169,0,217,0,41,0,89,0,137,0,185,0,233,0,13,0,61,0,109,0,157,0,205,0,29,0,77,0,125,0,173,0,221,0,45,0,93,0,141,0,189,0,237,0,2,0,50,0,98,0,146,0,194,0,18,0,66,0,114,0,162,0,210,0,34,0,82,0,130,0,178,0,226,0,6,0,54,0,102,0,150,0,198,0,22,0,70,0,118,0,166,0,214,0,38,0,86,0,134,0,182,0,230,0,10,0,58,0,106,0,154,0,202,0,26,0,74,0,122,0,170,0,218,0,42,0,90,0,138,0,186,0,234,0,14,0,62,0,110,0,158,0,206,0,30,0,78,0,126,0,174,0,222,0,46,0,94,0,142,0,190,0,238,0,3,0,51,0,99,0,147,0,195,0,19,0,67,0,115,0,163,0,211,0,35,0,83,0,131,0,179,0,227,0,7,0,55,0,103,0,151,0,199,0,23,0,71,0,119,0,167,0,215,0,39,0,87,0,135,0,183,0,231,0,11,0,59,0,107,0,155,0,203,0,27,0,75,0,123,0,171,0,219,0,43,0,91,0,139,0,187,0,235,0,15,0,63,0,111,0,159,0,207,0,31,0,79,0,127,0,175,0,223,0,47,0,95,0,143,0,191,0,239,0,0,0,24,0,48,0,72,0,96,0,8,0,32,0,56,0,80,0,104,0,16,0,40,0,64,0,88,0,112,0,4,0,28,0,52,0,76,0,100,0,12,0,36,0,60,0,84,0,108,0,20,0,44,0,68,0,92,0,116,0,1,0,25,0,49,0,73,0,97,0,9,0,33,0,57,0,81,0,105,0,17,0,41,0,65,0,89,0,113,0,5,0,29,0,53,0,77,0,101,0,13,0,37,0,61,0,85,0,109,0,21,0,45,0,69,0,93,0,117,0,2,0,26,0,50,0,74,0,98,0,10,0,34,0,58,0,82,0,106,0,18,0,42,0,66,0,90,0,114,0,6,0,30,0,54,0,78,0,102,0,14,0,38,0,62,0,86,0,110,0,22,0,46,0,70,0,94,0,118,0,3,0,27,0,51,0,75,0,99,0,11,0,35,0,59,0,83,0,107,0,19,0,43,0,67,0,91,0,115,0,7,0,31,0,55,0,79,0,103,0,15,0,39,0,63,0,87,0,111,0,23,0,47,0,71,0,95,0,119,0,0,0,12,0,24,0,36,0,48,0,4,0,16,0,28,0,40,0,52,0,8,0,20,0,32,0,44,0,56,0,1,0,13,0,25,0,37,0,49,0,5,0,17,0,29,0,41,0,53,0,9,0,21,0,33,0,45,0,57,0,2,0,14,0,26,0,38,0,50,0,6,0,18,0,30,0,42,0,54,0,10,0,22,0,34,0,46,0,58,0,3,0,15,0,27,0,39,0,51,0,7,0,19,0,31,0,43,0,55,0,11,0,23,0,35,0,47,0,59,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0,41,0,41,0,41,0,82,0,82,0,123,0,164,0,200,0,222,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,41,0,41,0,41,0,41,0,123,0,123,0,123,0,164,0,164,0,240,0,10,1,27,1,39,1,41,0,41,0,41,0,41,0,41,0,41,0,41,0,41,0,123,0,123,0,123,0,123,0,240,0,240,0,240,0,10,1,10,1,49,1,62,1,72,1,80,1,123,0,123,0,123,0,123,0,123,0,123,0,123,0,123,0,240,0,240,0,240,0,240,0,49,1,49,1,49,1,62,1,62,1,87,1,95,1,102,1,108,1,240,0,240,0,240,0,240,0,240,0,240,0,240,0,240,0,49,1,49,1,49,1,49,1,87,1,87,1,87,1,95,1,95,1,114,1,120,1,126,1,131,1,18,0,29,0,38,0,40,0,46,0,52,0,62,0,84,0,92,202,190,216,182,223,154,226,156,230,120,236,122,244,204,252,52,3,134,11,136,19,100,25,102,29,74,32,66,39,164,53,100,0,240,0,32,0,100,0,205,60,0,48,0,32,42,175,213,201,207,255,64,0,17,0,99,255,97,1,16,254,163,0,39,43,189,86,217,255,6,0,91,0,86,255,186,0,23,0,128,252,192,24,216,77,237,255,220,255,102,0,167,255,232,255,72,1,73,252,8,10,37,62,135,199,61,201,64,0,128,0,134,255,36,0,54,1,0,253,72,2,51,36,69,69,12,0,128,0,18,0,114,255,32,1,139,255,159,252,27,16,123,56,104,2,13,200,246,255,39,0,58,0,210,255,172,255,120,0,184,0,197,254,227,253,4,5,4,21,64,35,230,62,198,196,243,255,0,0,20,0,26,0,5,0,225,255,213,255,252,255,65,0,90,0,7,0,99,255,8,255,212,255,81,2,47,6,52,10,199,12,228,87,5,197,3,0,242,255,236,255,241,255,2,0,25,0,37,0,25,0,240,255,185,255,149,255,177,255,50,0,36,1,111,2,214,3,8,5,184,5,148,107,103,196,17,0,12,0,8,0,1,0,246,255,234,255,226,255,224,255,234,255,3,0,44,0,100,0,168,0,243,0,61,1,125,1,173,1,199,1,189,0,168,253,105,2,103,119,117,0,97,255,210,251,8,116,52,0,221,0,168,246,116,110,252,255,17,2,234,242,229,102,208,255,246,2,140,240,165,93,176,255,137,3,117,239,6,83,157,255,204,3,130,239,102,71,149,255,199,3,139,240,39,59,153,255,128,3,97,242,174,46,165,255,5,3,207,244,94,34,185,255,99,2,161,247,152,22,210,255,169,1,161,250,180,11,0,64,202,69,27,76,255,82,130,90,179,98,162,107,96,117,184,126,154,121,154,121,102,102,184,126,51,115,81,11,10,9,10,9,10,9,239,8,239,8,10,9,252,8,23,9,239,8,72,11,20,10,90,9,63,9,10,9,226,8,226,8,226,8,226,8,146,8,183,9,36,9,36,9,10,9,10,9,10,9,36,9,36,9,63,9,50,9,144,12,206,10,36,9,36,9,10,9,226,8,173,8,159,8,213,8,146,8,156,9,170,9,63,9,90,9,90,9,90,9,90,9,63,9,103,9,10,9,151,13,240,11,79,8,159,8,226,8,226,8,226,8,239,8,10,9,213,8,210,12,69,12,20,10,90,9,199,8,173,8,159,8,146,8,146,8,66,8,0,16,5,15,173,8,60,10,60,10,103,9,10,9,90,9,63,9,26,8,106,12,172,12,63,9,173,8,249,9,130,9,36,9,10,9,119,8,173,8,10,13,160,13,166,10,146,8,213,8,156,9,50,9,63,9,159,8,53,8,50,9,116,9,23,9,63,9,90,9,116,9,116,9,116,9,156,9,63,9,195,14,45,14,130,9,223,9,63,9,226,8,226,8,252,8,159,8,0,8,182,12,153,12,153,10,30,11,143,9,23,9,252,8,252,8,226,8,79,8,191,12,228,12,193,10,246,10,143,9,213,8,213,8,199,8,79,8,53,8,57,11,165,11,73,10,63,9,103,9,50,9,146,8,199,8,199,8,66,8,153,12,125,12,73,10,20,10,226,8,133,8,199,8,173,8,173,8,93,8,106,12,238,12,180,10,103,9,226,8,226,8,226,8,239,8,146,8,66,8,69,12,200,12,156,9,13,8,239,8,196,9,63,9,183,9,130,9,133,8,179,13,210,12,10,9,140,10,87,10,170,9,63,9,90,9,36,9,79,8,95,13,207,13,222,11,240,11,252,8,158,7,173,8,226,8,226,8,226,8,76,13,38,13,39,8,127,10,57,11,50,9,116,9,226,8,170,9,236,9,176,14,160,13,158,7,100,10,81,11,223,9,90,9,63,9,156,9,213,8,212,11,200,12,180,10,72,11,180,10,106,8,79,8,239,8,186,8,199,8,111,14,73,14,233,7,177,7,100,10,140,10,20,10,196,9,23,9,63,9,135,12,85,13,50,9,26,8,72,11,72,11,36,9,183,9,199,8,119,8,10,13,38,13,30,11,220,10,23,9,106,8,226,8,239,8,66,8,13,8,23,9,252,8,133,8,119,8,133,8,63,9,73,10,140,10,140,10,249,9,103,9,130,9,173,8,213,8,173,8,173,8,36,9,116,9,47,10,140,10,222,11,172,12,246,10,72,11,170,9,26,8,252,8,10,9,50,9,76,9,173,8,106,8,79,8,239,8,196,9,233,10,233,10,60,10,20,10,63,9,92,14,129,14,186,8,46,7,133,8,193,10,166,10,113,10,209,9,159,8,233,10,88,12,166,10,249,9,30,11,209,9,133,8,90,9,173,8,133,8,250,0,3,0,6,0,3,0,3,0,3,0,4,0,3,0,3,0,3,0,205,1,73,14,109,11,109,11,109,11,109,11,109,11,109,11,109,11,109,11,109,11,109,11,109,11,147,11,147,11,109,11,30,11,144,12,13,12,156,11,240,11,240,11,194,11,194,11,194,11,147,11,147,11,194,11,156,11,72,11,30,11,30,11,166,10,80,15,174,15,165,11,135,12,135,12,118,11,240,11,30,11,50,12,172,12,109,11,30,11,60,10,249,9,220,10,109,11,188,13,125,12,194,11,31,12,203,11,72,11,109,11,109,11,109,11,109,11,72,11,72,11,72,11,72,11,72,11,193,10,190,19,190,19,118,11,245,13,57,13,240,11,13,12,233,10,88,12,88,12,156,11,30,11,209,9,236,9,193,10,72,11,76,17,53,16,140,10,193,10,156,11,194,11,109,11,30,11,165,11,203,11,109,11,109,11,109,11,109,11,72,11,166,10,36,14,203,11,156,11,240,11,240,11,57,11,246,10,240,11,144,12,231,11,165,11,219,12,219,12,165,11,238,12,175,11,107,20,150,19,236,9,10,13,198,13,57,13,125,12,22,12,48,13,165,11,140,10,87,10,127,10,233,10,30,11,113,10,217,19,54,20,7,18,76,17,156,9,81,11,231,11,135,12,97,12,127,10,180,10,72,11,30,11,233,10,30,11,140,10,50,12,72,11,147,11,109,11,109,11,109,11,109,11,147,11,147,11,147,11,147,11,109,11,109,11,147,11,147,11,147,11,106,16,135,12,165,11,31,12,194,11,72,11,72,11,109,11,156,11,57,11,100,11,203,11,156,11,194,11,125,12,57,11,176,14,176,14,172,12,31,12,165,11,72,11,109,11,72,11,156,11,118,11,233,10,233,10,30,11,72,11,72,11,100,10,14,15,174,15,135,12,50,12,172,12,118,11,231,11,147,11,147,11,13,12,30,11,233,10,233,10,233,10,233,10,20,10,5,15,240,15,29,13,188,13,22,12,180,10,194,11,118,11,50,12,13,12,30,11,30,11,87,10,87,10,30,11,246,10,27,20,30,19,153,12,5,15,113,13,97,12,81,11,85,13,123,13,140,10,20,10,113,10,180,10,30,11,246,10,193,10,13,16,205,14,219,12,88,12,109,11,72,11,72,11,109,11,233,10,180,10,233,10,180,10,233,10,30,11,72,11,246,10,217,19,190,19,231,11,217,13,172,12,240,11,13,12,128,11,31,12,81,11,180,10,180,10,180,10,30,11,233,10,60,10,213,16,213,16,44,11,223,9,135,12,48,13,48,13,3,12,3,12,48,13,240,11,30,11,87,10,20,10,166,10,193,10,240,11,100,11,246,10,72,11,180,10,127,10,81,11,31,12,78,12,78,12,144,12,97,12,240,11,194,11,147,11,30,11,23,17,42,15,109,11,72,11,30,11,72,11,30,11,30,11,72,11,72,11,72,11,30,11,72,11,109,11,72,11,30,11,165,11,100,11,100,11,165,11,165,11,240,11,50,12,144,12,78,12,240,11,194,11,156,11,156,11,156,11,109,11,180,10,133,16,53,16,238,12,19,13,109,11,147,11,72,11,165,11,165,11,30,11,233,10,180,10,30,11,30,11,30,11,233,10,240,15,174,15,31,12,194,11,109,11,109,11,109,11,72,11,109,11,109,11,30,11,30,11,30,11,233,10,72,11,220,10,7,18,223,17,97,12,113,13,135,12,165,11,81,11,222,11,50,12,180,10,127,10,127,10,127,10,180,10,233,10,140,10,53,16,173,16,205,14,73,14,166,10,220,10,72,11,72,11,194,11,156,11,109,11,30,11,127,10,127,10,233,10,72,11,119,16,226,13,193,10,30,11,30,11,72,11,72,11,72,11,109,11,109,11,72,11,109,11,109,11,109,11,147,11,72,11,54,20,57,19,213,8,104,13,205,14,151,13,19,13,30,11,238,12,151,13,78,12,81,11,156,9,183,9,193,10,109,11,123,13,101,14,50,12,125,12,29,13,231,11,135,12,135,12,165,11,144,12,13,12,109,11,109,11,127,10,236,9,130,9,165,11,194,11,233,10,233,10,180,10,233,10,30,11,156,11,240,11,31,12,78,12,78,12,78,12,31,12,194,11,194,11,128,11,57,11,127,10,166,10,220,10,194,11,104,13,217,13,29,13,172,12,240,11,194,11,147,11,109,11,72,11,30,11,203,11,128,11,81,11,194,11,194,11,156,11,203,11,31,12,240,11,240,11,194,11,72,11,30,11,109,11,109,11,72,11,80,15,127,15,194,11,125,12,29,13,144,12,219,12,219,12,151,13,120,14,113,13,166,10,133,8,156,9,20,10,47,10,100,0,3,0,40,0,3,0,3,0,3,0,5,0,14,0,14,0,10,0,11,0,3,0,8,0,9,0,7,0,3,0,91,1,0,32,254,31,246,31,234,31,216,31,194,31,168,31,136,31,98,31,58,31,10,31,216,30,160,30,98,30,34,30,220,29,144,29,66,29,238,28,150,28,58,28,216,27,114,27,10,27,156,26,42,26,180,25,58,25,188,24,60,24,182,23,46,23,160,22,16,22,126,21,232,20,78,20,176,19,16,19,110,18,200,17,30,17,116,16,198,15,22,15,100,14,174,13,248,12,64,12,132,11,200,10,10,10,74,9,138,8,198,7,2,7,62,6,120,5,178,4,234,3,34,3,90,2,146,1,202,0,0,0,54,255,110,254,166,253,222,252,22,252,78,251,136,250,194,249,254,248,58,248,118,247,182,246,246,245,56,245,124,244,192,243,8,243,82,242,156,241,234,240,58,240,140,239,226,238,56,238,146,237,240,236,80,236,178,235,24,235,130,234,240,233,96,233,210,232,74,232,196,231,68,231,198,230,76,230,214,229,100,229,246,228,142,228,40,228,198,227,106,227,18,227,190,226,112,226,36,226,222,225,158,225,96,225,40,225,246,224,198,224,158,224,120,224,88,224,62,224,40,224,22,224,10,224,2,224,0,224,79,112,117,115,83,99,114,105,112,116,72,97,110,100,108,101,114,0,95,101,110,99,111,100,101,0,95,100,101,99,111,100,101,0,49,55,79,112,117,115,83,99,114,105,112,116,72,97,110,100,108,101,114,0,80,49,55,79,112,117,115,83,99,114,105,112,116,72,97,110,100,108,101,114,0,80,75,49,55,79,112,117,115,83,99,114,105,112,116,72,97,110,100,108,101,114,0,105,105,0,118,0,118,105,0,105,105,105,105,105,0,105,105,105,105,105,105,105,0,105,105,105,105,105,105,0,0,255,0,255,0,255,0,255,0,255,0,254,1,0,1,255,0,254,0,253,2,0,1,255,0,254,0,253,3,0,1,255,117,110,107,110,111,119,110,32,101,114,114,111,114,0,115,117,99,99,101,115,115,0,105,110,118,97,108,105,100,32,97,114,103,117,109,101,110,116,0,98,117,102,102,101,114,32,116,111,111,32,115,109,97,108,108,0,105,110,116,101,114,110,97,108,32,101,114,114,111,114,0,99,111,114,114,117,112,116,101,100,32,115,116,114,101,97,109,0,114,101,113,117,101,115,116,32,110,111,116,32,105,109,112,108,101,109,101,110,116,101,100,0,105,110,118,97,108,105,100,32,115,116,97,116,101,0,109,101,109,111,114,121,32,97,108,108,111,99,97,116,105,111,110,32,102,97,105,108,101,100,0,255,255,156,110,86,70,59,51,45,40,37,33,31,28,26,25,23,22,21,20,19,18,17,16,16,15,15,14,13,13,12,12,12,12,11,11,11,10,10,10,9,9,9,9,9,9,8,8,8,8,8,7,7,7,7,7,7,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,25,23,2,0,126,124,119,109,87,41,19,9,4,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,90,80,75,69,63,56,49,40,34,29,20,18,10,0,0,0,0,0,0,0,0,110,100,90,84,78,71,65,58,51,45,39,32,26,20,12,0,0,0,0,0,0,118,110,103,93,86,80,75,70,65,59,53,47,40,31,23,15,4,0,0,0,0,126,119,112,104,95,89,83,78,72,66,60,54,47,39,32,25,17,12,1,0,0,134,127,120,114,103,97,91,85,78,72,66,60,54,47,41,35,29,23,16,10,1,144,137,130,124,113,107,101,95,88,82,76,70,64,57,51,45,39,33,26,15,1,152,145,138,132,123,117,111,105,98,92,86,80,74,67,61,55,49,43,36,20,1,162,155,148,142,133,127,121,115,108,102,96,90,84,77,71,65,59,53,46,30,1,172,165,158,152,143,137,131,125,118,112,106,100,94,87,81,75,69,63,56,45,20,200,200,200,200,200,200,200,200,198,193,188,183,178,173,168,163,158,153,148,129,104,40,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,40,15,23,28,31,34,36,38,39,41,42,43,44,45,46,47,47,49,50,51,52,53,54,55,55,57,58,59,60,61,62,63,63,65,66,67,68,69,70,71,71,40,20,33,41,48,53,57,61,64,66,69,71,73,75,76,78,80,82,85,87,89,91,92,94,96,98,101,103,105,107,108,110,112,114,117,119,121,123,124,126,128,40,23,39,51,60,67,73,79,83,87,91,94,97,100,102,105,107,111,115,118,121,124,126,129,131,135,139,142,145,148,150,153,155,159,163,166,169,172,174,177,179,35,28,49,65,78,89,99,107,114,120,126,132,136,141,145,149,153,159,165,171,176,180,185,189,192,199,205,211,216,220,225,229,232,239,245,251,21,33,58,79,97,112,125,137,148,157,166,174,182,189,195,201,207,217,227,235,243,251,17,35,63,86,106,123,139,152,165,177,187,197,206,214,222,230,237,250,25,31,55,75,91,105,117,128,138,146,154,161,168,174,180,185,190,200,208,215,222,229,235,240,245,255,16,36,65,89,110,128,144,159,173,185,196,207,217,226,234,242,250,11,41,74,103,128,151,172,191,209,225,241,255,9,43,79,110,138,163,186,207,227,246,12,39,71,99,123,144,164,182,198,214,228,241,253,9,44,81,113,142,168,192,214,235,255,7,49,90,127,160,191,220,247,6,51,95,134,170,203,234,7,47,87,123,155,184,212,237,6,52,97,137,174,208,240,5,57,106,151,192,231,5,59,111,158,202,243,5,55,103,147,187,224,5,60,113,161,206,248,4,65,122,175,224,4,67,127,182,234,224,224,224,224,224,224,224,224,160,160,160,160,185,185,185,178,178,168,134,61,37,224,224,224,224,224,224,224,224,240,240,240,240,207,207,207,198,198,183,144,66,40,160,160,160,160,160,160,160,160,185,185,185,185,193,193,193,183,183,172,138,64,38,240,240,240,240,240,240,240,240,207,207,207,207,204,204,204,193,193,180,143,66,40,185,185,185,185,185,185,185,185,193,193,193,193,193,193,193,183,183,172,138,65,39,207,207,207,207,207,207,207,207,204,204,204,204,201,201,201,188,188,176,141,66,40,193,193,193,193,193,193,193,193,193,193,193,193,194,194,194,184,184,173,139,65,39,204,204,204,204,204,204,204,204,201,201,201,201,198,198,198,187,187,175,140,66,40,72,127,65,129,66,128,65,128,64,128,62,128,64,128,64,128,92,78,92,79,92,78,90,79,116,41,115,40,114,40,132,26,132,26,145,17,161,12,176,10,177,11,24,179,48,138,54,135,54,132,53,134,56,133,55,132,55,132,61,114,70,96,74,88,75,88,87,74,89,66,91,67,100,59,108,50,120,40,122,37,97,43,78,50,83,78,84,81,88,75,86,74,87,71,90,73,93,74,93,74,109,40,114,36,117,34,117,34,143,17,145,18,146,19,162,12,165,10,178,7,189,6,190,8,177,9,23,178,54,115,63,102,66,98,69,99,74,89,71,91,73,91,78,89,86,80,92,66,93,64,102,59,103,60,104,60,117,52,123,44,138,35,133,31,97,38,77,45,61,90,93,60,105,42,107,41,110,45,116,38,113,38,112,38,124,26,132,27,136,19,140,20,155,14,159,16,158,18,170,13,177,10,187,8,192,6,175,9,159,10,21,178,59,110,71,86,75,85,84,83,91,66,88,73,87,72,92,75,98,72,105,58,107,54,115,52,114,55,112,56,129,51,132,40,150,33,140,29,98,35,77,42,42,121,96,66,108,43,111,40,117,44,123,32,120,36,119,33,127,33,134,34,139,21,147,23,152,20,158,25,154,26,166,21,173,16,184,13,184,10,150,13,139,15,22,178,63,114,74,82,84,83,92,82,103,62,96,72,96,67,101,73,107,72,113,55,118,52,125,52,118,52,117,55,135,49,137,39,157,32,145,29,97,33,77,40,2,1,0,0,8,13,16,19,21,23,24,26,27,28,29,30,31,32,32,33,34,34,35,36,36,37,37,224,112,44,15,3,2,1,0,254,237,192,132,70,23,4,0,255,252,226,155,61,11,2,0,250,245,234,203,71,50,42,38,35,33,31,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0,179,99,0,71,56,43,30,21,12,6,0,199,165,144,124,109,96,84,71,61,51,42,32,23,15,8,0,241,225,211,199,187,175,164,153,142,132,123,114,105,96,88,80,72,64,57,50,44,38,33,29,24,20,16,12,9,5,2,0,15,131,138,138,155,155,173,173,69,93,115,118,131,138,141,138,150,150,155,150,155,160,166,160,131,128,134,141,141,141,145,145,145,150,155,155,155,155,160,160,160,160,166,166,173,173,182,192,182,192,192,192,205,192,205,224,4,6,24,7,5,0,0,2,0,0,12,28,41,13,252,247,15,42,25,14,1,254,62,41,247,246,37,65,252,3,250,4,66,7,248,16,14,38,253,33,13,22,39,23,12,255,36,64,27,250,249,10,55,43,17,1,1,8,1,1,6,245,74,53,247,244,55,76,244,8,253,3,93,27,252,26,39,59,3,248,2,0,77,11,9,248,22,44,250,7,40,9,26,3,9,249,20,101,249,4,3,248,42,26,0,241,33,68,2,23,254,55,46,254,15,3,255,21,16,41,250,27,61,39,5,245,42,88,4,1,254,60,65,6,252,255,251,73,56,1,247,19,94,29,247,0,12,99,6,4,8,237,102,46,243,3,2,13,3,2,9,235,84,72,238,245,46,104,234,8,18,38,48,23,0,240,70,83,235,11,5,245,117,22,248,250,23,117,244,3,3,248,95,28,4,246,15,77,60,241,255,4,124,2,252,3,38,84,24,231,2,13,42,13,31,21,252,56,46,255,255,35,79,243,19,249,65,88,247,242,20,4,81,49,227,20,0,75,3,239,5,247,44,92,248,1,253,22,69,31,250,95,41,244,5,39,67,16,252,1,0,250,120,55,220,243,44,122,4,232,81,5,11,3,7,2,0,9,10,88,46,2,90,87,93,91,82,98,109,120,118,12,113,115,117,119,99,59,87,111,63,111,112,80,126,124,125,124,129,121,126,23,132,127,127,127,126,127,122,133,130,134,101,118,119,145,126,86,124,120,123,119,170,173,107,109,8,16,32,249,247,246,245,244,234,210,202,201,200,197,174,82,59,56,55,54,46,22,12,11,10,9,7,0,64,0,203,150,0,215,195,166,125,110,82,0,120,0,128,64,0,232,158,10,0,230,0,243,221,192,181,0,171,85,0,192,128,64,0,205,154,102,51,0,213,171,128,85,43,0,224,192,160,128,96,64,32,0,100,40,16,7,3,1,0,253,250,244,233,212,182,150,131,120,110,98,85,72,60,49,40,32,25,19,15,13,11,9,8,7,6,5,4,3,2,1,0,210,208,206,203,199,193,183,168,142,104,74,52,37,27,20,14,10,6,4,2,0,223,201,183,167,152,138,124,111,98,88,79,70,62,56,50,44,39,35,31,27,24,21,18,16,14,12,10,8,6,4,3,2,1,0,188,176,155,138,119,97,67,43,26,10,0,165,119,80,61,47,35,27,20,14,9,4,0,113,63,0,125,51,26,18,15,12,11,10,9,8,7,6,5,4,3,2,1,0,198,105,45,22,15,12,11,10,9,8,7,6,5,4,3,2,1,0,213,162,116,83,59,43,32,24,18,15,12,9,7,6,5,3,2,0,239,187,116,59,28,16,11,10,9,8,7,6,5,4,3,2,1,0,250,229,188,135,86,51,30,19,13,10,8,6,5,4,3,2,1,0,249,235,213,185,156,128,103,83,66,53,42,33,26,21,17,13,10,0,254,249,235,206,164,118,77,46,27,16,10,7,5,4,3,2,1,0,255,253,249,239,220,191,156,119,85,57,37,23,15,10,6,4,2,0,255,253,251,246,237,223,203,179,152,124,98,75,55,40,29,21,15,0,255,254,253,247,220,162,106,67,42,28,18,12,9,6,4,3,2,0,31,57,107,160,205,205,255,255,255,255,255,255,255,255,255,255,255,255,69,47,67,111,166,205,255,255,255,255,255,255,255,255,255,255,255,255,82,74,79,95,109,128,145,160,173,205,205,205,224,255,255,224,255,224,125,74,59,69,97,141,182,255,255,255,255,255,255,255,255,255,255,255,173,115,85,73,76,92,115,145,173,205,224,224,255,255,255,255,255,255,166,134,113,102,101,102,107,118,125,138,145,155,166,182,192,192,205,150,224,182,134,101,83,79,85,97,120,145,173,205,224,255,255,255,255,255,255,224,192,150,120,101,92,89,93,102,118,134,160,182,192,224,224,224,255,224,224,182,155,134,118,109,104,102,106,111,118,131,145,160,173,131,241,190,178,132,87,74,41,14,0,223,193,157,140,106,57,39,18,0,131,74,141,79,80,138,95,104,134,95,99,91,125,93,76,123,115,123,128,0,214,42,0,235,128,21,0,244,184,72,11,0,248,214,128,42,7,0,248,225,170,80,25,5,0,251,236,198,126,54,18,3,0,250,238,211,159,82,35,15,5,0,250,231,203,168,128,88,53,25,6,0,252,238,216,185,148,108,71,40,18,4,0,253,243,225,199,166,128,90,57,31,13,3,0,254,246,233,212,183,147,109,73,44,23,10,2,0,255,250,240,223,198,166,128,90,58,33,16,6,1,0,255,251,244,231,210,181,146,110,75,46,25,12,5,1,0,255,253,248,238,221,196,164,128,92,60,35,18,8,3,1,0,255,253,249,242,229,208,180,146,110,76,48,27,14,7,3,1,0,129,0,207,50,0,236,129,20,0,245,185,72,10,0,249,213,129,42,6,0,250,226,169,87,27,4,0,251,233,194,130,62,20,4,0,250,236,207,160,99,47,17,3,0,255,240,217,182,131,81,41,11,1,0,255,254,233,201,159,107,61,20,2,1,0,255,249,233,206,170,128,86,50,23,7,1,0,255,250,238,217,186,148,108,70,39,18,6,1,0,255,252,243,226,200,166,128,90,56,30,13,4,1,0,255,252,245,231],"i8",ALLOC_NONE,Runtime.GLOBAL_BASE+20480),allocate([209,180,146,110,76,47,25,11,4,1,0,255,253,248,237,219,194,163,128,93,62,37,19,8,3,1,0,255,254,250,241,226,205,177,145,111,79,51,30,15,6,2,1,0,129,0,203,54,0,234,129,23,0,245,184,73,10,0,250,215,129,41,5,0,252,232,173,86,24,3,0,253,240,200,129,56,15,2,0,253,244,217,164,94,38,10,1,0,253,245,226,189,132,71,27,7,1,0,253,246,231,203,159,105,56,23,6,1,0,255,248,235,213,179,133,85,47,19,5,1,0,255,254,243,221,194,159,117,70,37,12,2,1,0,255,254,248,234,208,171,128,85,48,22,8,2,1,0,255,254,250,240,220,189,149,107,67,36,16,6,2,1,0,255,254,251,243,227,201,166,128,90,55,29,13,5,2,1,0,255,254,252,246,234,213,183,147,109,73,43,22,10,4,2,1,0,130,0,200,58,0,231,130,26,0,244,184,76,12,0,249,214,130,43,6,0,252,232,173,87,24,3,0,253,241,203,131,56,14,2,0,254,246,221,167,94,35,8,1,0,254,249,232,193,130,65,23,5,1,0,255,251,239,211,162,99,45,15,4,1,0,255,251,243,223,186,131,74,33,11,3,1,0,255,252,245,230,202,158,105,57,24,8,2,1,0,255,253,247,235,214,179,132,84,44,19,7,2,1,0,255,254,250,240,223,196,159,112,69,36,15,6,2,1,0,255,254,253,245,231,209,176,136,93,55,27,11,3,2,1,0,255,254,253,252,239,221,194,158,117,76,42,18,4,3,2,1,0,0,0,2,5,9,14,20,27,35,44,54,65,77,90,104,119,135,254,49,67,77,82,93,99,198,11,18,24,31,36,45,255,46,66,78,87,94,104,208,14,21,32,42,51,66,255,94,104,109,112,115,118,248,53,69,80,88,95,102,6,0,3,0,7,3,0,1,10,0,2,6,18,10,12,4,0,2,0,0,0,9,4,7,4,0,3,12,7,7,0,1,1,1,2,3,3,3,2,3,3,3,2,3,3,3,0,3,12,15,48,51,60,63,192,195,204,207,240,243,252,255,12,35,60,83,108,132,157,180,206,228,15,32,55,77,101,125,151,175,201,225,19,42,66,89,114,137,162,184,209,230,12,25,50,72,97,120,147,172,200,223,26,44,69,90,114,135,159,180,205,225,13,22,53,80,106,130,156,180,205,228,15,25,44,64,90,115,142,168,196,222,19,24,62,82,100,120,145,168,190,214,22,31,50,79,103,120,151,170,203,227,21,29,45,65,106,124,150,171,196,224,30,49,75,97,121,142,165,186,209,229,19,25,52,70,93,116,143,166,192,219,26,34,62,75,97,118,145,167,194,217,25,33,56,70,91,113,143,165,196,223,21,34,51,72,97,117,145,171,196,222,20,29,50,67,90,117,144,168,197,221,22,31,48,66,95,117,146,168,196,222,24,33,51,77,116,134,158,180,200,224,21,28,70,87,106,124,149,170,194,217,26,33,53,64,83,117,152,173,204,225,27,34,65,95,108,129,155,174,210,225,20,26,72,99,113,131,154,176,200,219,34,43,61,78,93,114,155,177,205,229,23,29,54,97,124,138,163,179,209,229,30,38,56,89,118,129,158,178,200,231,21,29,49,63,85,111,142,163,193,222,27,48,77,103,133,158,179,196,215,232,29,47,74,99,124,151,176,198,220,237,33,42,61,76,93,121,155,174,207,225,29,53,87,112,136,154,170,188,208,227,24,30,52,84,131,150,166,186,203,229,37,48,64,84,104,118,156,177,201,230,212,178,148,129,108,96,85,82,79,77,61,59,57,56,51,49,48,45,42,41,40,38,36,34,31,30,21,12,10,3,1,0,255,245,244,236,233,225,217,203,190,176,175,161,149,136,125,114,102,91,81,71,60,52,43,35,28,20,19,18,12,11,5,0,179,138,140,148,151,149,153,151,163,116,67,82,59,92,72,100,89,92,16,0,0,0,0,99,66,36,36,34,36,34,34,34,34,83,69,36,52,34,116,102,70,68,68,176,102,68,68,34,65,85,68,84,36,116,141,152,139,170,132,187,184,216,137,132,249,168,185,139,104,102,100,68,68,178,218,185,185,170,244,216,187,187,170,244,187,187,219,138,103,155,184,185,137,116,183,155,152,136,132,217,184,184,170,164,217,171,155,139,244,169,184,185,170,164,216,223,218,138,214,143,188,218,168,244,141,136,155,170,168,138,220,219,139,164,219,202,216,137,168,186,246,185,139,116,185,219,185,138,100,100,134,100,102,34,68,68,100,68,168,203,221,218,168,167,154,136,104,70,164,246,171,137,139,137,155,218,219,139,255,254,253,238,14,3,2,1,0,255,254,252,218,35,3,2,1,0,255,254,250,208,59,4,2,1,0,255,254,246,194,71,10,2,1,0,255,252,236,183,82,8,2,1,0,255,252,235,180,90,17,2,1,0,255,248,224,171,97,30,4,1,0,255,254,236,173,95,37,7,1,0,255,255,255,131,6,145,255,255,255,255,255,236,93,15,96,255,255,255,255,255,194,83,25,71,221,255,255,255,255,162,73,34,66,162,255,255,255,210,126,73,43,57,173,255,255,255,201,125,71,48,58,130,255,255,255,166,110,73,57,62,104,210,255,255,251,123,65,55,68,100,171,255,7,23,38,54,69,85,100,116,131,147,162,178,193,208,223,239,13,25,41,55,69,83,98,112,127,142,157,171,187,203,220,236,15,21,34,51,61,78,92,106,126,136,152,167,185,205,225,240,10,21,36,50,63,79,95,110,126,141,157,173,189,205,221,237,17,20,37,51,59,78,89,107,123,134,150,164,184,205,224,240,10,15,32,51,67,81,96,112,129,142,158,173,189,204,220,236,8,21,37,51,65,79,98,113,126,138,155,168,179,192,209,218,12,15,34,55,63,78,87,108,118,131,148,167,185,203,219,236,16,19,32,36,56,79,91,108,118,136,154,171,186,204,220,237,11,28,43,58,74,89,105,120,135,150,165,180,196,211,226,241,6,16,33,46,60,75,92,107,123,137,156,169,185,199,214,225,11,19,30,44,57,74,89,105,121,135,152,169,186,202,218,234,12,19,29,46,57,71,88,100,120,132,148,165,182,199,216,233,17,23,35,46,56,77,92,106,123,134,152,167,185,204,222,237,14,17,45,53,63,75,89,107,115,132,151,171,188,206,221,240,9,16,29,40,56,71,88,103,119,137,154,171,189,205,222,237,16,19,36,48,57,76,87,105,118,132,150,167,185,202,218,236,12,17,29,54,71,81,94,104,126,136,149,164,182,201,221,237,15,28,47,62,79,97,115,129,142,155,168,180,194,208,223,238,8,14,30,45,62,78,94,111,127,143,159,175,192,207,223,239,17,30,49,62,79,92,107,119,132,145,160,174,190,204,220,235,14,19,36,45,61,76,91,108,121,138,154,172,189,205,222,238,12,18,31,45,60,76,91,107,123,138,154,171,187,204,221,236,13,17,31,43,53,70,83,103,114,131,149,167,185,203,220,237,17,22,35,42,58,78,93,110,125,139,155,170,188,206,224,240,8,15,34,50,67,83,99,115,131,146,162,178,193,209,224,239,13,16,41,66,73,86,95,111,128,137,150,163,183,206,225,241,17,25,37,52,63,75,92,102,119,132,144,160,175,191,212,231,19,31,49,65,83,100,117,133,147,161,174,187,200,213,227,242,18,31,52,68,88,103,117,126,138,149,163,177,192,207,223,239,16,29,47,61,76,90,106,119,133,147,161,176,193,209,224,240,15,21,35,50,61,73,86,97,110,119,129,141,175,198,218,237,225,204,201,184,183,175,158,154,153,135,119,115,113,110,109,99,98,95,79,68,52,50,48,45,43,32,31,27,18,10,3,0,255,251,235,230,212,201,196,182,167,166,163,151,138,124,110,104,90,78,76,70,69,57,45,34,24,21,11,6,5,4,3,0,175,148,160,176,178,173,174,164,177,174,196,182,198,192,182,68,62,66,60,72,117,85,90,118,136,151,142,160,142,155,0,0,0,0,0,0,0,1,100,102,102,68,68,36,34,96,164,107,158,185,180,185,139,102,64,66,36,34,34,0,1,32,208,139,141,191,152,185,155,104,96,171,104,166,102,102,102,132,1,0,0,0,0,16,16,0,80,109,78,107,185,139,103,101,208,212,141,139,173,153,123,103,36,0,0,0,0,0,0,1,48,0,0,0,0,0,0,32,68,135,123,119,119,103,69,98,68,103,120,118,118,102,71,98,134,136,157,184,182,153,139,134,208,168,248,75,189,143,121,107,32,49,34,34,34,0,17,2,210,235,139,123,185,137,105,134,98,135,104,182,100,183,171,134,100,70,68,70,66,66,34,131,64,166,102,68,36,2,1,0,134,166,102,68,34,34,66,132,212,246,158,139,107,107,87,102,100,219,125,122,137,118,103,132,114,135,137,105,171,106,50,34,164,214,141,143,185,151,121,103,192,34,0,0,0,0,0,1,208,109,74,187,134,249,159,137,102,110,154,118,87,101,119,101,0,2,0,36,36,66,68,35,96,164,102,100,36,0,2,33,167,138,174,102,100,84,2,2,100,107,120,119,36,197,24,0,255,254,253,244,12,3,2,1,0,255,254,252,224,38,3,2,1,0,255,254,251,209,57,4,2,1,0,255,254,244,195,69,4,2,1,0,255,251,232,184,84,7,2,1,0,255,254,240,186,86,14,2,1,0,255,254,239,178,91,30,5,1,0,255,248,227,177,100,19,2,1,0,255,255,255,156,4,154,255,255,255,255,255,227,102,15,92,255,255,255,255,255,213,83,24,72,236,255,255,255,255,150,76,33,63,214,255,255,255,190,121,77,43,55,185,255,255,255,245,137,71,43,59,139,255,255,255,255,131,66,50,66,107,194,255,255,166,116,76,55,53,125,255,255,0,15,8,7,4,11,12,3,2,13,10,5,6,9,14,1,0,9,6,3,4,5,8,1,2,7,0,1,0,0,0,1,0,0,1,255,1,255,2,254,2,254,3,253,0,1,0,1,255,2,255,2,254,3,254,3,253,7,254,7,0,2,255,255,255,0,0,1,1,0,1,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,255,2,1,0,1,1,0,0,255,255,0,0,1,255,0,1,255,0,255,1,254,2,254,254,2,253,2,3,253,252,3,252,4,4,251,5,250,251,6,249,6,5,8,247,0,0,1,0,0,0,0,0,0,0,255,1,0,0,1,255,0,1,255,255,1,255,2,1,255,2,254,254,2,254,2,2,3,253,0,1,0,0,0,0,0,0,1,0,1,0,0,1,255,1,0,0,2,1,255,2,255,255,2,255,2,2,255,3,254,254,254,3,0,1,0,0,1,0,1,255,2,255,2,255,2,3,254,3,254,254,4,4,253,5,253,252,6,252,6,5,251,8,250,251,249,9,251,8,255,6,255,6,252,10,250,10,254,6,255,6,251,10,247,12,253,7,254,7,249,13,16,24,34,118,111,105,100,0,98,111,111,108,0,99,104,97,114,0,115,105,103,110,101,100,32,99,104,97,114,0,117,110,115,105,103,110,101,100,32,99,104,97,114,0,115,104,111,114,116,0,117,110,115,105,103,110,101,100,32,115,104,111,114,116,0,105,110,116,0,117,110,115,105,103,110,101,100,32,105,110,116,0,108,111,110,103,0,117,110,115,105,103,110,101,100,32,108,111,110,103,0,102,108,111,97,116,0,100,111,117,98,108,101,0,78,83,116,51,95,95,49,49,50,98,97,115,105,99,95,115,116,114,105,110,103,73,99,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,99,69,69,78,83,95,57,97,108,108,111,99,97,116,111,114,73,99,69,69,69,69,0,78,83,116,51,95,95,49,50,49,95,95,98,97,115,105,99,95,115,116,114,105,110,103,95,99,111,109,109,111,110,73,76,98,49,69,69,69,0,115,116,100,58,58,115,116,114,105,110,103,0,78,83,116,51,95,95,49,49,50,98,97,115,105,99,95,115,116,114,105,110,103,73,104,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,104,69,69,78,83,95,57,97,108,108,111,99,97,116,111,114,73,104,69,69,69,69,0,115,116,100,58,58,98,97,115,105,99,95,115,116,114,105,110,103,60,117,110,115,105,103,110,101,100,32,99,104,97,114,62,0,78,83,116,51,95,95,49,49,50,98,97,115,105,99,95,115,116,114,105,110,103,73,119,78,83,95,49,49,99,104,97,114,95,116,114,97,105,116,115,73,119,69,69,78,83,95,57,97,108,108,111,99,97,116,111,114,73,119,69,69,69,69,0,115,116,100,58,58,119,115,116,114,105,110,103,0,78,49,48,101,109,115,99,114,105,112,116,101,110,51,118,97,108,69,0,101,109,115,99,114,105,112,116,101,110,58,58,118,97,108,0,78,49,48,101,109,115,99,114,105,112,116,101,110,49,49,109,101,109,111,114,121,95,118,105,101,119,73,99,69,69,0,101,109,115,99,114,105,112,116,101,110,58,58,109,101,109,111,114,121,95,118,105,101,119,60,99,104,97,114,62,0,78,49,48,101,109,115,99,114,105,112,116,101,110,49,49,109,101,109,111,114,121,95,118,105,101,119,73,97,69,69,0,101,109,115,99,114,105,112,116,101,110,58,58,109,101,109,111,114,121,95,118,105,101,119,60,115,105,103,110,101,100,32,99,104,97,114,62,0,78,49,48,101,109,115,99,114,105,112,116,101,110,49,49,109,101,109,111,114,121,95,118,105,101,119,73,104,69,69,0,101,109,115,99,114,105,112,116,101,110,58,58,109,101,109,111,114,121,95,118,105,101,119,60,117,110,115,105,103,110,101,100,32,99,104,97,114,62,0,78,49,48,101,109,115,99,114,105,112,116,101,110,49,49,109,101,109,111,114,121,95,118,105,101,119,73,115,69,69,0,101,109,115,99,114,105,112,116,101,110,58,58,109,101,109,111,114,121,95,118,105,101,119,60,115,104,111,114,116,62,0,78,49,48,101,109,115,99,114,105,112,116,101,110,49,49,109,101,109,111,114,121,95,118,105,101,119,73,116,69,69,0,101,109,115,99,114,105,112,116,101,110,58,58,109,101,109,111,114,121,95,118,105,101,119,60,117,110,115,105,103,110,101,100,32,115,104,111,114,116,62,0,78,49,48,101,109,115,99,114,105,112,116,101,110,49,49,109,101,109,111,114,121,95,118,105,101,119,73,105,69,69,0,101,109,115,99,114,105,112,116,101,110,58,58,109,101,109,111,114,121,95,118,105,101,119,60,105,110,116,62,0,78,49,48,101,109,115,99,114,105,112,116,101,110,49,49,109,101,109,111,114,121,95,118,105,101,119,73,106,69,69,0,101,109,115,99,114,105,112,116,101,110,58,58,109,101,109,111,114,121,95,118,105,101,119,60,117,110,115,105,103,110,101,100,32,105,110,116,62,0,78,49,48,101,109,115,99,114,105,112,116,101,110,49,49,109,101,109,111,114,121,95,118,105,101,119,73,108,69,69,0,101,109,115,99,114,105,112,116,101,110,58,58,109,101,109,111,114,121,95,118,105,101,119,60,108,111,110,103,62,0,78,49,48,101,109,115,99,114,105,112,116,101,110,49,49,109,101,109,111,114,121,95,118,105,101,119,73,109,69,69,0,101,109,115,99,114,105,112,116,101,110,58,58,109,101,109,111,114,121,95,118,105,101,119,60,117,110,115,105,103,110,101,100,32,108,111,110,103,62,0,101,109,115,99,114,105,112,116,101,110,58,58,109,101,109,111,114,121,95,118,105,101,119,60,105,110,116,56,95,116,62,0,101,109,115,99,114,105,112,116,101,110,58,58,109,101,109,111,114,121,95,118,105,101,119,60,117,105,110,116,56,95,116,62,0,101,109,115,99,114,105,112,116,101,110,58,58,109,101,109,111,114,121,95,118,105,101,119,60,105,110,116,49,54,95,116,62,0,101,109,115,99,114,105,112,116,101,110,58,58,109,101,109,111,114,121,95,118,105,101,119,60,117,105,110,116,49,54,95,116,62,0,101,109,115,99,114,105,112,116,101,110,58,58,109,101,109,111,114,121,95,118,105,101,119,60,105,110,116,51,50,95,116,62,0,101,109,115,99,114,105,112,116,101,110,58,58,109,101,109,111,114,121,95,118,105,101,119,60,117,105,110,116,51,50,95,116,62,0,78,49,48,101,109,115,99,114,105,112,116,101,110,49,49,109,101,109,111,114,121,95,118,105,101,119,73,102,69,69,0,101,109,115,99,114,105,112,116,101,110,58,58,109,101,109,111,114,121,95,118,105,101,119,60,102,108,111,97,116,62,0,78,49,48,101,109,115,99,114,105,112,116,101,110,49,49,109,101,109,111,114,121,95,118,105,101,119,73,100,69,69,0,101,109,115,99,114,105,112,116,101,110,58,58,109,101,109,111,114,121,95,118,105,101,119,60,100,111,117,98,108,101,62,0,78,49,48,101,109,115,99,114,105,112,116,101,110,49,49,109,101,109,111,114,121,95,118,105,101,119,73,101,69,69,0,101,109,115,99,114,105,112,116,101,110,58,58,109,101,109,111,114,121,95,118,105,101,119,60,108,111,110,103,32,100,111,117,98,108,101,62,0,78,49,48,95,95,99,120,120,97,98,105,118,49,50,48,95,95,115,105,95,99,108,97,115,115,95,116,121,112,101,95,105,110,102,111,69,0,78,49,48,95,95,99,120,120,97,98,105,118,49,49,54,95,95,115,104,105,109,95,116,121,112,101,95,105,110,102,111,69,0,83,116,57,116,121,112,101,95,105,110,102,111,0,78,49,48,95,95,99,120,120,97,98,105,118,49,49,55,95,95,99,108,97,115,115,95,116,121,112,101,95,105,110,102,111,69,0,83,116,57,101,120,99,101,112,116,105,111,110,0,83,116,57,98,97,100,95,97,108,108,111,99,0,115,116,100,58,58,98,97,100,95,97,108,108,111,99,0,78,49,48,95,95,99,120,120,97,98,105,118,49,49,57,95,95,112,111,105,110,116,101,114,95,116,121,112,101,95,105,110,102,111,69,0,78,49,48,95,95,99,120,120,97,98,105,118,49,49,55,95,95,112,98,97,115,101,95,116,121,112,101,95,105,110,102,111,69,0,78,49,48,95,95,99,120,120,97,98,105,118,49,50,51,95,95,102,117,110,100,97,109,101,110,116,97,108,95,116,121,112,101,95,105,110,102,111,69,0,118,0,68,110,0,98,0,99,0,104,0,97,0,115,0,116,0,105,0,106,0,108,0,109,0,102,0,100,0,78,49,48,95,95,99,120,120,97,98,105,118,49,50,49,95,95,118,109,105,95,99,108,97,115,115,95,116,121,112,101,95,105,110,102,111,69,0],"i8",ALLOC_NONE,Runtime.GLOBAL_BASE+30720); -var tempDoublePtr=STATICTOP;STATICTOP+=16;var ERRNO_CODES={EPERM:1,ENOENT:2,ESRCH:3,EINTR:4,EIO:5,ENXIO:6,E2BIG:7,ENOEXEC:8,EBADF:9,ECHILD:10,EAGAIN:11,EWOULDBLOCK:11,ENOMEM:12,EACCES:13,EFAULT:14,ENOTBLK:15,EBUSY:16,EEXIST:17,EXDEV:18,ENODEV:19,ENOTDIR:20,EISDIR:21,EINVAL:22,ENFILE:23,EMFILE:24,ENOTTY:25,ETXTBSY:26,EFBIG:27,ENOSPC:28,ESPIPE:29,EROFS:30,EMLINK:31,EPIPE:32,EDOM:33,ERANGE:34,ENOMSG:42,EIDRM:43,ECHRNG:44,EL2NSYNC:45,EL3HLT:46,EL3RST:47,ELNRNG:48,EUNATCH:49,ENOCSI:50,EL2HLT:51,EDEADLK:35,ENOLCK:37,EBADE:52,EBADR:53,EXFULL:54,ENOANO:55,EBADRQC:56,EBADSLT:57,EDEADLOCK:35,EBFONT:59,ENOSTR:60,ENODATA:61,ETIME:62,ENOSR:63,ENONET:64,ENOPKG:65,EREMOTE:66,ENOLINK:67,EADV:68,ESRMNT:69,ECOMM:70,EPROTO:71,EMULTIHOP:72,EDOTDOT:73,EBADMSG:74,ENOTUNIQ:76,EBADFD:77,EREMCHG:78,ELIBACC:79,ELIBBAD:80,ELIBSCN:81,ELIBMAX:82,ELIBEXEC:83,ENOSYS:38,ENOTEMPTY:39,ENAMETOOLONG:36,ELOOP:40,EOPNOTSUPP:95,EPFNOSUPPORT:96,ECONNRESET:104,ENOBUFS:105,EAFNOSUPPORT:97,EPROTOTYPE:91,ENOTSOCK:88,ENOPROTOOPT:92,ESHUTDOWN:108,ECONNREFUSED:111,EADDRINUSE:98,ECONNABORTED:103,ENETUNREACH:101,ENETDOWN:100,ETIMEDOUT:110,EHOSTDOWN:112,EHOSTUNREACH:113,EINPROGRESS:115,EALREADY:114,EDESTADDRREQ:89,EMSGSIZE:90,EPROTONOSUPPORT:93,ESOCKTNOSUPPORT:94,EADDRNOTAVAIL:99,ENETRESET:102,EISCONN:106,ENOTCONN:107,ETOOMANYREFS:109,EUSERS:87,EDQUOT:122,ESTALE:116,ENOTSUP:95,ENOMEDIUM:123,EILSEQ:84,EOVERFLOW:75,ECANCELED:125,ENOTRECOVERABLE:131,EOWNERDEAD:130,ESTRPIPE:86},embind_charCodes=void 0,awaitingDependencies={},registeredTypes={},typeDependencies={},char_0=48,char_9=57,BindingError=void 0,InternalError=void 0,EXCEPTIONS={last:0,caught:[],infos:{},deAdjust:function(e){if(!e||EXCEPTIONS.infos[e])return e;for(var t in EXCEPTIONS.infos){var i=EXCEPTIONS.infos[t];if(i.adjusted===e)return t}return e},addRef:function(e){if(e){var t=EXCEPTIONS.infos[e];t.refcount++}},decRef:function(e){if(e){var t=EXCEPTIONS.infos[e];assert(t.refcount>0),t.refcount--,0===t.refcount&&(t.destructor&&Runtime.dynCall("vi",t.destructor,[e]),delete EXCEPTIONS.infos[e],___cxa_free_exception(e))}},clearRef:function(e){if(e){var t=EXCEPTIONS.infos[e];t.refcount=0}}};Module._memset=_memset,Module._free=_free,Module._malloc=_malloc;var delayFunction=void 0,deletionQueue=[],registeredPointers={},registeredInstances={},UnboundTypeError=void 0,_llvm_fabs_f64=Math_abs;Module._i64Add=_i64Add;var emval_free_list=[],emval_handle_array=[{},{value:void 0},{value:null},{value:!0},{value:!1}];Module._bitshift64Ashr=_bitshift64Ashr,Module._bitshift64Lshr=_bitshift64Lshr,Module._memcpy=_memcpy;var _llvm_pow_f64=Math_pow;Module._memmove=_memmove,embind_init_charCodes(),BindingError=Module.BindingError=extendError(Error,"BindingError"),InternalError=Module.InternalError=extendError(Error,"InternalError"),init_ClassHandle(),init_RegisteredPointer(),init_embind(),UnboundTypeError=Module.UnboundTypeError=extendError(Error,"UnboundTypeError"),init_emval(),STACK_BASE=STACKTOP=Runtime.alignMemory(STATICTOP),staticSealed=!0,STACK_MAX=STACK_BASE+TOTAL_STACK,DYNAMIC_BASE=DYNAMICTOP=Runtime.alignMemory(STACK_MAX);var cttz_i8=allocate([8,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,6,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,7,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,6,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0],"i8",ALLOC_DYNAMIC);Module.asmGlobalArg={Math:Math,Int8Array:Int8Array,Int16Array:Int16Array,Int32Array:Int32Array,Uint8Array:Uint8Array,Uint16Array:Uint16Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array,NaN:NaN,Infinity:1/0},Module.asmLibraryArg={abort:abort,assert:assert,invoke_iiii:invoke_iiii,invoke_viiiii:invoke_viiiii,invoke_vi:invoke_vi,invoke_iiiiiii:invoke_iiiiiii,invoke_ii:invoke_ii,invoke_viiiiiii:invoke_viiiiiii,invoke_v:invoke_v,invoke_iiiii:invoke_iiiii,invoke_viiiiii:invoke_viiiiii,invoke_iiiiii:invoke_iiiiii,invoke_viiii:invoke_viiii,floatReadValueFromPointer:floatReadValueFromPointer,simpleReadValueFromPointer:simpleReadValueFromPointer,throwInternalError:throwInternalError,get_first_emval:get_first_emval,_llvm_fabs_f64:_llvm_fabs_f64,getLiveInheritedInstances:getLiveInheritedInstances,__ZSt18uncaught_exceptionv:__ZSt18uncaught_exceptionv,ClassHandle:ClassHandle,getShiftFromSize:getShiftFromSize,_sbrk:_sbrk,_emscripten_memcpy_big:_emscripten_memcpy_big,runDestructor:runDestructor,_sysconf:_sysconf,throwInstanceAlreadyDeleted:throwInstanceAlreadyDeleted,__embind_register_std_string:__embind_register_std_string,init_RegisteredPointer:init_RegisteredPointer,ClassHandle_isAliasOf:ClassHandle_isAliasOf,_llvm_stacksave:_llvm_stacksave,flushPendingDeletes:flushPendingDeletes,makeClassHandle:makeClassHandle,whenDependentTypesAreResolved:whenDependentTypesAreResolved,__embind_register_class_constructor:__embind_register_class_constructor,init_ClassHandle:init_ClassHandle,ClassHandle_clone:ClassHandle_clone,RegisteredClass:RegisteredClass,_llvm_stackrestore:_llvm_stackrestore,___cxa_find_matching_catch:___cxa_find_matching_catch,embind_init_charCodes:embind_init_charCodes,___setErrNo:___setErrNo,__embind_register_bool:__embind_register_bool,___resumeException:___resumeException,createNamedFunction:createNamedFunction,__embind_register_emval:__embind_register_emval,__emval_decref:__emval_decref,init_embind:init_embind,constNoSmartPtrRawPointerToWireType:constNoSmartPtrRawPointerToWireType,heap32VectorToArray:heap32VectorToArray,ClassHandle_delete:ClassHandle_delete,RegisteredPointer_destructor:RegisteredPointer_destructor,ensureOverloadTable:ensureOverloadTable,_time:_time,new_:new_,downcastPointer:downcastPointer,replacePublicSymbol:replacePublicSymbol,__embind_register_class:__embind_register_class,_llvm_pow_f64:_llvm_pow_f64,ClassHandle_deleteLater:ClassHandle_deleteLater,RegisteredPointer_deleteObject:RegisteredPointer_deleteObject,ClassHandle_isDeleted:ClassHandle_isDeleted,__embind_register_integer:__embind_register_integer,___cxa_allocate_exception:___cxa_allocate_exception,_embind_repr:_embind_repr,RegisteredPointer:RegisteredPointer,_exp2:_exp2,craftInvokerFunction:craftInvokerFunction,runDestructors:runDestructors,makeLegalFunctionName:makeLegalFunctionName,upcastPointer:upcastPointer,init_emval:init_emval,shallowCopyInternalPointer:shallowCopyInternalPointer,nonConstNoSmartPtrRawPointerToWireType:nonConstNoSmartPtrRawPointerToWireType,_abort:_abort,throwBindingError:throwBindingError,getTypeName:getTypeName,exposePublicSymbol:exposePublicSymbol,RegisteredPointer_fromWireType:RegisteredPointer_fromWireType,__embind_register_memory_view:__embind_register_memory_view,getInheritedInstance:getInheritedInstance,setDelayFunction:setDelayFunction,___gxx_personality_v0:___gxx_personality_v0,extendError:extendError,__embind_register_void:__embind_register_void,RegisteredPointer_getPointee:RegisteredPointer_getPointee,__emval_register:__emval_register,__embind_register_std_wstring:__embind_register_std_wstring,__embind_register_class_function:__embind_register_class_function,throwUnboundTypeError:throwUnboundTypeError,readLatin1String:readLatin1String,_pthread_self:_pthread_self,getBasestPointer:getBasestPointer,getInheritedInstanceCount:getInheritedInstanceCount,__embind_register_float:__embind_register_float,integerReadValueFromPointer:integerReadValueFromPointer,genericPointerToWireType:genericPointerToWireType,registerType:registerType,___cxa_throw:___cxa_throw,count_emval_handles:count_emval_handles,requireFunction:requireFunction,STACKTOP:STACKTOP,STACK_MAX:STACK_MAX,tempDoublePtr:tempDoublePtr,ABORT:ABORT,cttz_i8:cttz_i8};var asm=function(e,t,i){"use asm";var n=new e.Int8Array(i);var r=new e.Int16Array(i);var s=new e.Int32Array(i);var o=new e.Uint8Array(i);var a=new e.Uint16Array(i);var l=new e.Uint32Array(i);var f=new e.Float32Array(i);var h=new e.Float64Array(i);var u=t.STACKTOP|0;var c=t.STACK_MAX|0;var d=t.tempDoublePtr|0;var p=t.ABORT|0;var b=t.cttz_i8|0;var w=0;var m=0;var g=0;var _=0;var v=e.NaN,k=e.Infinity;var y=0,E=0,A=0,T=0,S=0,M=0,R=0,C=0,P=0;var x=0;var I=0;var O=0;var N=0;var D=0;var L=0;var U=0;var B=0;var j=0;var F=0;var G=e.Math.floor;var H=e.Math.abs;var z=e.Math.sqrt;var q=e.Math.pow;var W=e.Math.cos;var V=e.Math.sin;var Y=e.Math.tan;var Z=e.Math.acos;var $=e.Math.asin;var K=e.Math.atan;var X=e.Math.atan2;var J=e.Math.exp;var Q=e.Math.log;var ee=e.Math.ceil;var te=e.Math.imul;var ie=e.Math.min;var ne=e.Math.clz32;var re=t.abort;var se=t.assert;var oe=t.invoke_iiii;var ae=t.invoke_viiiii;var le=t.invoke_vi;var fe=t.invoke_iiiiiii;var he=t.invoke_ii;var ue=t.invoke_viiiiiii;var ce=t.invoke_v;var de=t.invoke_iiiii;var pe=t.invoke_viiiiii;var be=t.invoke_iiiiii;var we=t.invoke_viiii;var me=t.floatReadValueFromPointer;var ge=t.simpleReadValueFromPointer;var _e=t.throwInternalError;var ve=t.get_first_emval;var ke=t._llvm_fabs_f64;var ye=t.getLiveInheritedInstances;var Ee=t.__ZSt18uncaught_exceptionv;var Ae=t.ClassHandle;var Te=t.getShiftFromSize;var Se=t._sbrk;var Me=t._emscripten_memcpy_big;var Re=t.runDestructor;var Ce=t._sysconf;var Pe=t.throwInstanceAlreadyDeleted;var xe=t.__embind_register_std_string;var Ie=t.init_RegisteredPointer;var Oe=t.ClassHandle_isAliasOf;var Ne=t._llvm_stacksave;var De=t.flushPendingDeletes;var Le=t.makeClassHandle;var Ue=t.whenDependentTypesAreResolved;var Be=t.__embind_register_class_constructor;var je=t.init_ClassHandle;var Fe=t.ClassHandle_clone;var Ge=t.RegisteredClass;var He=t._llvm_stackrestore;var ze=t.___cxa_find_matching_catch;var qe=t.embind_init_charCodes;var We=t.___setErrNo;var Ve=t.__embind_register_bool;var Ye=t.___resumeException;var Ze=t.createNamedFunction;var $e=t.__embind_register_emval;var Ke=t.__emval_decref;var Xe=t.init_embind;var Je=t.constNoSmartPtrRawPointerToWireType;var Qe=t.heap32VectorToArray;var et=t.ClassHandle_delete;var tt=t.RegisteredPointer_destructor;var it=t.ensureOverloadTable;var nt=t._time;var rt=t.new_;var st=t.downcastPointer;var ot=t.replacePublicSymbol;var at=t.__embind_register_class;var lt=t._llvm_pow_f64;var ft=t.ClassHandle_deleteLater;var ht=t.RegisteredPointer_deleteObject;var ut=t.ClassHandle_isDeleted;var ct=t.__embind_register_integer;var dt=t.___cxa_allocate_exception;var pt=t._embind_repr;var bt=t.RegisteredPointer;var wt=t._exp2;var mt=t.craftInvokerFunction;var gt=t.runDestructors;var _t=t.makeLegalFunctionName;var vt=t.upcastPointer;var kt=t.init_emval;var yt=t.shallowCopyInternalPointer;var Et=t.nonConstNoSmartPtrRawPointerToWireType;var At=t._abort;var Tt=t.throwBindingError;var St=t.getTypeName;var Mt=t.exposePublicSymbol;var Rt=t.RegisteredPointer_fromWireType;var Ct=t.__embind_register_memory_view;var Pt=t.getInheritedInstance;var xt=t.setDelayFunction;var It=t.___gxx_personality_v0;var Ot=t.extendError;var Nt=t.__embind_register_void;var Dt=t.RegisteredPointer_getPointee;var Lt=t.__emval_register;var Ut=t.__embind_register_std_wstring;var Bt=t.__embind_register_class_function;var jt=t.throwUnboundTypeError;var Ft=t.readLatin1String;var Gt=t._pthread_self;var Ht=t.getBasestPointer;var zt=t.getInheritedInstanceCount;var qt=t.__embind_register_float;var Wt=t.integerReadValueFromPointer;var Vt=t.genericPointerToWireType;var Yt=t.registerType;var Zt=t.___cxa_throw;var $t=t.count_emval_handles;var Kt=t.requireFunction;var Xt=0;function Jt(e,t,i,a,l,h){e=e|0;t=t|0;i=i|0;a=a|0;l=l|0;h=h|0;var c=0,p=0,b=0,w=0,m=0,g=0,_=0,v=0,k=0,y=0,E=0,A=0,T=0,S=0,M=0,R=0,C=0,P=0,x=0,I=0,O=0,N=0,D=0,L=0,U=0,B=0,j=0,F=0,q=0,W=0,V=0,Y=0,Z=0,$=0,K=0,X=0,J=0,ee=0,ie=0,re=0,se=0,oe=0,ae=0,le=0,fe=0,he=0,ue=0,ce=0,de=0,pe=0,be=0,we=0,me=0,ge=0,_e=0,ve=0,ke=0,ye=0,Ee=0,Ae=0,Te=0,Se=0,Me=0,Re=0,Ce=0,Pe=0,xe=0,Ie=0,Oe=0,De=0,Le=0,Ue=0,Be=0,je=0,Fe=0,Ge=0,ze=0,qe=0,We=0,Ve=0,Ye=0,Ze=0,$e=0,Ke=0,Xe=0,Je=0,Qe=0,et=0,tt=0,it=0,nt=0,rt=0,st=0;rt=u;u=u+192|0;Y=rt+80|0;m=rt+32|0;Ke=rt+28|0;L=rt+24|0;ze=rt+20|0;Ge=rt+16|0;J=rt+12|0;xe=rt+8|0;Pe=rt+4|0;U=rt;et=s[e+4>>2]|0;$e=s[e+8>>2]|0;s[Ke>>2]=15;f[L>>2]=0;s[ze>>2]=0;s[J>>2]=0;Fe=s[e>>2]|0;Ve=Fe+8|0;nt=s[Ve>>2]|0;N=s[Fe+4>>2]|0;Oe=Fe+32|0;ye=s[Oe>>2]|0;tt=s[e+32>>2]|0;it=s[e+36>>2]|0;Ce=(tt|0)!=0;f[xe>>2]=0;if((l|0)<2|(t|0)==0){e=-1;u=rt;return e|0}V=e+28|0;c=te(s[V>>2]|0,i)|0;pe=Fe+44|0;Me=Fe+36|0;i=s[Me>>2]|0;Ee=0;while(1){if((Ee|0)>(i|0)){i=-1;Te=631;break}if((s[pe>>2]<>2]<>2]|0;We=s[h+28>>2]|0;P=ne(We|0)|0;qe=32-P|0;We=We>>>(qe+-16|0);Re=(We>>>12)+-8|0;P=Be+(P+-32)|0;O=P+4>>3;Re=(Be<<3)-((qe<<3)+(Re+(We>>>0>(s[5272+(Re<<2)>>2]|0)>>>0&1)))|0}l=(l|0)<1275?l:1275;w=l-O|0;ve=e+44|0;i=s[e+40>>2]|0;if(!(s[ve>>2]|0))if((i|0)==-1)Te=13;else{We=te(i,c)|0;Te=s[Fe>>2]|0;Te=((We+((P|0)>1?P:0)+(Te<<2)|0)/(Te<<3|0)|0)-((s[e+48>>2]|0)!=0&1)|0;We=(l|0)<(Te|0);l=((We?l:Te)|0)<2?2:We?l:Te;Te=13}else if((i|0)==-1){i=-1;Te=13}else{Le=s[Fe>>2]|0;Le=((te(i,c)|0)+(Le>>4)|0)/(Le>>3|0)|0;p=l;I=Le>>6}if((Te|0)==13){p=l;I=l-O|0;Le=0}l=te(($e*40|0)+20|0,(400>>>Ee)+-50|0)|0;c=(p*400>>3-Ee)-l|0;if((i|0)==-1)Ue=c;else{Ue=i-l|0;Ue=(c|0)<(Ue|0)?c:Ue}if(b){s[m>>2]=a;s[m+8>>2]=0;s[m+12>>2]=0;s[m+16>>2]=0;s[m+20>>2]=33;s[m+24>>2]=0;s[m+28>>2]=-2147483648;s[m+40>>2]=-1;s[m+32>>2]=0;s[m+36>>2]=0;s[m+4>>2]=p;s[m+44>>2]=0;We=m}else We=h;Se=(Le|0)>0;if(((Se?(s[e+52>>2]|0)!=0:0)?(_=(P|0)==1?2:0,v=(Le<<1)-(s[e+176>>2]|0)>>6,E=(_|0)>(v|0),((E?_:v)|0)<(w|0)):0)?(A=E?_:v,(A|0)<(w|0)):0){p=O+A|0;De=s[We>>2]|0;qe=s[We+8>>2]|0;Be=0-qe|0;c=We+4|0;Mr(De+p+Be|0,De+(s[c>>2]|0)+Be|0,qe|0)|0;s[c>>2]=p;c=A}else c=w;x=p<<3;de=s[Fe+12>>2]|0;de=(it|0)>(de|0)?de:it;B=je+N|0;m=te(et,B)|0;qe=Ne()|0;W=u;u=u+((1*(m<<2)|0)+15&-16)|0;m=e+192|0;g=+f[m>>2];l=te($e,je-N|0)|0;w=s[V>>2]|0;l=(l|0)/(w|0)|0;i=0;k=0;y=0;while(1){if((i|0)>=(l|0))break;Ie=+f[t+(i<<2)>>2];i=i+1|0;k=k>Ie?k:Ie;y=y(k>Ie?k:Ie))){i=0;k=0;g=0;while(1){if((i|0)>=(l|0))break;Ie=+f[t+(i<<2)>>2];i=i+1|0;k=k>Ie?k:Ie;g=gg)g=k}b=t+(l<<2)|0;i=(te($e,N)|0)/(w|0)|0;l=0;k=0;y=0;while(1){if((l|0)>=(i|0))break;Ie=+f[b+(l<<2)>>2];l=l+1|0;k=k>Ie?k:Ie;y=yIe?k:Ie;f[m>>2]=Ie;g=g>Ie?g:Ie;be=e+60|0;T=g<=1/+(1<>2]|0);C=T&1;if((P|0)==1){M=We+28|0;l=s[M>>2]|0;i=l>>>15;l=l-i|0;A=We+32|0;if(T)s[A>>2]=(s[A>>2]|0)+l;else i=l;s[M>>2]=i;m=We+36|0;R=We+20|0;a=We+40|0;h=We+24|0;_=We+8|0;v=We+4|0;E=We+44|0;while(1){if(i>>>0>=8388609)break;l=s[A>>2]|0;w=l>>>23;if((w|0)==255)s[m>>2]=(s[m>>2]|0)+1;else{b=l>>>31;i=s[a>>2]|0;if((i|0)>-1){l=s[h>>2]|0;if((l+(s[_>>2]|0)|0)>>>0<(s[v>>2]|0)>>>0){s[h>>2]=l+1;n[(s[We>>2]|0)+l>>0]=i+b;i=0}else i=-1;s[E>>2]=s[E>>2]|i}i=s[m>>2]|0;if(i|0){b=b+255&255;do{l=s[h>>2]|0;if((l+(s[_>>2]|0)|0)>>>0<(s[v>>2]|0)>>>0){s[h>>2]=l+1;n[(s[We>>2]|0)+l>>0]=b;l=0;i=s[m>>2]|0}else l=-1;s[E>>2]=s[E>>2]|l;i=i+-1|0;s[m>>2]=i}while((i|0)!=0)}s[a>>2]=w&255;l=s[A>>2]|0;i=s[M>>2]|0}s[A>>2]=l<<8&2147483392;i=i<<8;s[M>>2]=i;s[R>>2]=(s[R>>2]|0)+8}if(T){if(Se){b=O+2|0;b=(p|0)<(b|0)?p:b;l=s[We>>2]|0;p=s[_>>2]|0;i=0-p|0;Mr(l+b+i|0,l+(s[v>>2]|0)+i|0,p|0)|0;s[v>>2]=b;p=b;i=s[M>>2]|0;l=b;c=2;b=b<<3}else{l=I;b=x}P=p<<3;Be=s[R>>2]|0;s[R>>2]=Be+(P-(Be+((ne(i|0)|0)+-32)));Be=C}else{l=I;Be=0;P=1;b=x}}else{l=I;Be=0;b=x}T=e+16|0;M=Fe+16|0;R=Fe+20|0;C=je<<2;v=g>65536;A=0;do{m=v&(s[T>>2]|0)!=0;h=t+(A<<2)|0;_=W+((te(A,B)|0)<<2)+(N<<2)|0;a=s[V>>2]|0;E=e+160+(A<<2)|0;k=+f[M>>2];g=+f[E>>2];e:do if(+f[R>>2]==0){if((a|0)!=1){i=(je|0)/(a|0)|0;Te=64;break}if(m){i=je;Te=65}else{i=0;while(1){if((i|0)>=(je|0))break e;Ie=+f[h+((te(i,et)|0)<<2)>>2]*32768;f[_+(i<<2)>>2]=Ie-g;i=i+1|0;g=k*Ie}}}else{i=(je|0)/(a|0)|0;if((a|0)==1)Te=65;else Te=64}while(0);if((Te|0)==64){yr(_|0,0,C|0)|0;Te=65}e:do if((Te|0)==65){Te=0;w=0;while(1){if((w|0)>=(i|0))break;f[_+((te(w,a)|0)<<2)>>2]=+f[h+((te(w,et)|0)<<2)>>2]*32768;w=w+1|0}t:do if(m){w=0;while(1){if((w|0)>=(i|0)){i=0;break t}De=_+((te(w,a)|0)<<2)|0;Ie=+f[De>>2];ke=Ie>65536;Ae=Ie<-65536&(ke^1);f[De>>2]=Ae|ke?Ae?-65536:65536:Ie;w=w+1|0}}else i=0;while(0);while(1){if((i|0)>=(je|0))break e;De=_+(i<<2)|0;Ie=+f[De>>2];f[De>>2]=Ie-g;i=i+1|0;g=k*Ie}}while(0);f[E>>2]=g;A=A+1|0}while((A|0)<(et|0));Ae=e+68|0;if((((s[Ae>>2]|0)!=0&(c|0)>3|(c|0)>($e*12|0))&(Ce^1)&(Be|0)==0?(s[e+20>>2]|0)==0:0)?(s[e+24>>2]|0)>4:0){if((s[e+116>>2]|0)==0|(Ee|0)==3)i=0;else i=(s[e+64>>2]|0)==5010;i=i^1}else i=0;ue=e+100|0;De=s[ue>>2]|0;i=Qt(e,W,D,et,je,De,Ke,L,U,i&1,c)|0;Ie=+f[L>>2];if(!(Ie>.4000000059604645)?!(+f[e+108>>2]>.4000000059604645):0)ke=0;else Te=82;do if((Te|0)==82){if(s[e+120>>2]|0?!(+f[e+124>>2]>.3):0){ke=0;break}oe=+(s[Ke>>2]|0);fe=+(s[e+104>>2]|0);ke=(oe>fe*1.26|oe(b|0))){h=We+28|0;i=s[h>>2]|0;i=i-(i>>>1)|0;s[h>>2]=i;_=We+32|0;v=We+36|0;E=We+20|0;A=We+40|0;T=We+24|0;M=We+8|0;R=We+4|0;C=We+44|0;while(1){if(i>>>0>=8388609)break e;w=s[_>>2]|0;a=w>>>23;if((a|0)==255)s[v>>2]=(s[v>>2]|0)+1;else{m=w>>>31;i=s[A>>2]|0;if((i|0)>-1){w=s[T>>2]|0;if((w+(s[M>>2]|0)|0)>>>0<(s[R>>2]|0)>>>0){s[T>>2]=w+1;n[(s[We>>2]|0)+w>>0]=i+m;i=0}else i=-1;s[C>>2]=s[C>>2]|i}i=s[v>>2]|0;if(i|0){m=m+255&255;do{w=s[T>>2]|0;if((w+(s[M>>2]|0)|0)>>>0<(s[R>>2]|0)>>>0){s[T>>2]=w+1;n[(s[We>>2]|0)+w>>0]=m;w=0;i=s[v>>2]|0}else w=-1;s[C>>2]=s[C>>2]|w;i=i+-1|0;s[v>>2]=i}while((i|0)!=0)}s[A>>2]=a&255;w=s[_>>2]|0;i=s[h>>2]|0}s[_>>2]=w<<8&2147483392;i=i<<8;s[h>>2]=i;s[E>>2]=(s[E>>2]|0)+8}}}else{C=We+28|0;w=s[C>>2]|0;i=w>>>1;P=We+32|0;w=(s[P>>2]|0)+(w-i)|0;s[P>>2]=w;s[C>>2]=i;x=We+36|0;I=We+20|0;O=We+40|0;N=We+24|0;t=We+8|0;D=We+4|0;L=We+44|0;while(1){if(i>>>0>=8388609)break;a=w>>>23;if((a|0)==255)s[x>>2]=(s[x>>2]|0)+1;else{m=w>>>31;i=s[O>>2]|0;if((i|0)>-1){w=s[N>>2]|0;if((w+(s[t>>2]|0)|0)>>>0<(s[D>>2]|0)>>>0){s[N>>2]=w+1;n[(s[We>>2]|0)+w>>0]=i+m;i=0}else i=-1;s[L>>2]=s[L>>2]|i}i=s[x>>2]|0;if(i|0){m=m+255&255;do{w=s[N>>2]|0;if((w+(s[t>>2]|0)|0)>>>0<(s[D>>2]|0)>>>0){s[N>>2]=w+1;n[(s[We>>2]|0)+w>>0]=m;w=0;i=s[x>>2]|0}else w=-1;s[L>>2]=s[L>>2]|w;i=i+-1|0;s[x>>2]=i}while((i|0)!=0)}s[O>>2]=a&255;w=s[P>>2]|0;i=s[C>>2]|0}w=w<<8&2147483392;s[P>>2]=w;i=i<<8;s[C>>2]=i;s[I>>2]=(s[I>>2]|0)+8}M=s[Ke>>2]|0;h=M+1|0;s[Ke>>2]=h;R=ne(h|0)|0;E=32-R|0;_=E+-5|0;m=(i>>>0)/6|0;if(!_)i=i-(te(m,10-E|0)|0)|0;else{w=w+(i-(te(m,11-E|0)|0))|0;s[P>>2]=w;i=m}s[C>>2]=i;while(1){if(i>>>0>=8388609)break;a=w>>>23;if((a|0)==255)s[x>>2]=(s[x>>2]|0)+1;else{m=w>>>31;i=s[O>>2]|0;if((i|0)>-1){w=s[N>>2]|0;if((w+(s[t>>2]|0)|0)>>>0<(s[D>>2]|0)>>>0){s[N>>2]=w+1;n[(s[We>>2]|0)+w>>0]=i+m;i=0}else i=-1;s[L>>2]=s[L>>2]|i}i=s[x>>2]|0;if(i|0){m=m+255&255;do{w=s[N>>2]|0;if((w+(s[t>>2]|0)|0)>>>0<(s[D>>2]|0)>>>0){s[N>>2]=w+1;n[(s[We>>2]|0)+w>>0]=m;w=0;i=s[x>>2]|0}else w=-1;s[L>>2]=s[L>>2]|w;i=i+-1|0;s[x>>2]=i}while((i|0)!=0)}s[O>>2]=a&255;w=s[P>>2]|0;i=s[C>>2]|0}w=w<<8&2147483392;s[P>>2]=w;i=i<<8;s[C>>2]=i;s[I>>2]=(s[I>>2]|0)+8}v=h-(16<<_)|0;E=E+-1|0;A=We+12|0;i=s[A>>2]|0;T=We+16|0;a=s[T>>2]|0;if((a+E|0)>>>0>32){h=7-a|0;h=a+((h|0)>-8?h:-8)&-8;_=a;do{w=s[t>>2]|0;m=s[D>>2]|0;if(((s[N>>2]|0)+w|0)>>>0>>0){w=w+1|0;s[t>>2]=w;n[(s[We>>2]|0)+(m-w)>>0]=i;w=0}else w=-1;s[L>>2]=s[L>>2]|w;i=i>>>8;_=_+-8|0}while((_|0)>7);a=a+-8-h|0}i=i|v<>2]=i;s[T>>2]=w;m=(s[I>>2]|0)+E|0;s[I>>2]=m;s[Ke>>2]=M;v=s[U>>2]|0;if((w+3|0)>>>0>32){_=a+23|0;h=R+-24-a|0;h=a+((h|0)>-8?h:-8)+31-R&-8;do{m=s[t>>2]|0;a=s[D>>2]|0;if(((s[N>>2]|0)+m|0)>>>0>>0){m=m+1|0;s[t>>2]=m;n[(s[We>>2]|0)+(a-m)>>0]=i;m=0}else m=-1;s[L>>2]=s[L>>2]|m;i=i>>>8;w=w+-8|0}while((w|0)>7);m=s[I>>2]|0;w=_-R-h|0}s[A>>2]=i|v<>2]=w+3;m=m+3|0;s[I>>2]=m;i=s[C>>2]|0;w=i>>>2;if((De|0)>0){_e=o[29345+(De+-1)>>0]|0;ge=i-(te(w,_e)|0)|0;s[P>>2]=(s[P>>2]|0)+ge;w=te(w,_e-(o[29345+De>>0]|0)|0)|0}else w=i-(te(w,o[29345+De>>0]|0)|0)|0;s[C>>2]=w;i=m;while(1){if(w>>>0>=8388609)break e;m=s[P>>2]|0;a=m>>>23;if((a|0)==255)s[x>>2]=(s[x>>2]|0)+1;else{m=m>>>31;i=s[O>>2]|0;if((i|0)>-1){w=s[N>>2]|0;if((w+(s[t>>2]|0)|0)>>>0<(s[D>>2]|0)>>>0){s[N>>2]=w+1;n[(s[We>>2]|0)+w>>0]=i+m;i=0}else i=-1;s[L>>2]=s[L>>2]|i}i=s[x>>2]|0;if(i|0){m=m+255&255;do{w=s[N>>2]|0;if((w+(s[t>>2]|0)|0)>>>0<(s[D>>2]|0)>>>0){s[N>>2]=w+1;n[(s[We>>2]|0)+w>>0]=m;w=0;i=s[x>>2]|0}else w=-1;s[L>>2]=s[L>>2]|w;i=i+-1|0;s[x>>2]=i}while((i|0)!=0)}s[O>>2]=a&255;m=s[P>>2]|0;w=s[C>>2]|0;i=s[I>>2]|0}s[P>>2]=m<<8&2147483392;w=w<<8;s[C>>2]=w;i=i+8|0;s[I>>2]=i}}while(0);we=e+24|0;if((s[we>>2]|0)>0?(s[Ae>>2]|0)==0:0)x=ei(W,B,et,xe,J)|0;else x=0;D=(Ee|0)>0;e:do if(D?((s[We+20>>2]|0)+((ne(s[We+28>>2]|0)|0)+-32)+3|0)<=(b|0):0)if(x){R=(te(et,je)|0)<<2;M=u;u=u+((1*R|0)+15&-16)|0;R=u;u=u+((1*(Ze<<2)|0)+15&-16)|0;C=u;u=u+((1*(Ze<<2)|0)+15&-16)|0;T=te($e,nt)|0;P=u;u=u+((1*(T<<2)|0)+15&-16)|0;if((s[we>>2]|0)>7){ti(Fe,0,W,M,$e,et,Ee,s[V>>2]|0);i=s[Oe>>2]|0;w=s[pe>>2]<=(de|0))break;_=r[i+(A<<1)>>1]|0;a=M+(m+(_<>1]|0)-_<=(_|0))break;fe=+f[a+(E<<2)>>2];E=E+1|0;g=g+fe*fe}fe=+z(+(g+1.0000000272452012e-27));f[R+(A+(te(v,s[Ve>>2]|0)|0)<<2)>>2]=fe;A=h}v=v+1|0}while((v|0)<($e|0));w=0;do{i=0;while(1){if((i|0)>=(de|0)){i=de;break}_e=i+(te(w,s[Ve>>2]|0)|0)|0;fe=+Q(+ +f[R+(_e<<2)>>2])*1.4426950408889634;f[P+(_e<<2)>>2]=fe-+f[17220+(i<<2)>>2];i=i+1|0}while(1){if((i|0)>=(it|0))break;f[P+((te(w,s[Ve>>2]|0)|0)+i<<2)>>2]=-14;i=i+1|0}w=w+1|0}while((w|0)<($e|0));g=+(Ee|0)*.5;i=0;while(1){if((i|0)>=(T|0)){O=1;I=0;i=x;x=$;_e=0;break e}_e=P+(i<<2)|0;f[_e>>2]=+f[_e>>2]+g;i=i+1|0}}else{O=0;I=0;i=x;x=$;_e=0}}else{i=x;w=0;Te=171}else{i=0;w=1;Te=171}while(0);if((Te|0)==171){R=(te(et,je)|0)<<2;M=u;u=u+((1*R|0)+15&-16)|0;R=u;u=u+((1*(Ze<<2)|0)+15&-16)|0;C=u;u=u+((1*(Ze<<2)|0)+15&-16)|0;O=(te($e,nt)|0)<<2;P=u;u=u+((1*O|0)+15&-16)|0;O=0;I=1;x=0;_e=w}ti(Fe,x,W,M,$e,et,Ee,s[V>>2]|0);ge=(et|0)==2;if(ge&($e|0)==1)s[J>>2]=0;w=s[Oe>>2]|0;m=s[pe>>2]<=(de|0))break;v=r[w+(T<<1)>>1]|0;h=M+(a+(v<>1]|0)-v<=(v|0))break;fe=+f[h+(A<<2)>>2];A=A+1|0;g=g+fe*fe}fe=+z(+(g+1.0000000272452012e-27));f[R+(T+(te(E,s[Ve>>2]|0)|0)<<2)>>2]=fe;T=_}E=E+1|0}while((E|0)<($e|0));E=(s[Ae>>2]|0)==0;e:do if(E)m=0;else{w=2;while(1){if((w|0)>=(it|0)){m=0;break e}me=R+(w<<2)|0;oe=+f[me>>2];fe=+f[R>>2]*9999999747378752e-20;fe=oe>2]=fe>1.0000000036274937e-15?fe:1.0000000036274937e-15;w=w+1|0}}while(0);do{w=0;while(1){if((w|0)>=(de|0)){w=de;break}me=w+(te(m,s[Ve>>2]|0)|0)|0;fe=+Q(+ +f[R+(me<<2)>>2])*1.4426950408889634;f[C+(me<<2)>>2]=fe-+f[17220+(w<<2)>>2];w=w+1|0}while(1){if((w|0)>=(it|0))break;f[C+((te(m,s[Ve>>2]|0)|0)+w<<2)>>2]=-14;w=w+1|0}m=m+1|0}while((m|0)<($e|0));me=te($e,nt)|0;F=u;u=u+((1*(me<<2)|0)+15&-16)|0;yr(F|0,0,it<<2|0)|0;if(!Ce?(q=s[e+204>>2]|0,!((q|0)==0|E^1)):0){v=s[e+92>>2]|0;v=(v|0)<2?2:v;_=0;w=0;k=0;g=0;while(1){if((_|0)>=($e|0))break;h=te(nt,_)|0;a=0;y=g;while(1){if((a|0)>=(v|0))break;g=+f[q+(h+a<<2)>>2];m=g<.25;do if(g>-2|m^1){if(m){if(!(g>0))break}else g=.25;g=g*.5}else g=-2;while(0);le=a+1|0;ce=(r[ye+(le<<1)>>1]|0)-(r[ye+(a<<1)>>1]|0)|0;w=w+ce|0;k=k+g*+((a<<1|1)-v|0);a=le;y=y+g*+(ce|0)}_=_+1|0;g=y}g=g/+(w|0)+.20000000298023224;k=k*6/+(te(te(te($e,v+-1|0)|0,v+1|0)|0,v)|0)*.5;w=k<.03099999949336052;k=w?w&!(k>-.03099999949336052)?-.03099999949336052:k:.03099999949336052;w=(r[ye+(v<<1)>>1]|0)/2|0;_=0;while(1){m=_+1|0;if((r[ye+(m<<1)>>1]|0)<(w|0))_=m;else break}a=($e|0)==2;w=0;h=0;while(1){if((h|0)>=(v|0))break;m=q+(h<<2)|0;if(a){ce=q+(nt+h<<2)|0;m=+f[m>>2]>+f[ce>>2]?m:ce}y=+f[m>>2];y=(y<0?y:0)-(g+k*+(h-_|0));if(y>.25){f[F+(h<<2)>>2]=y+-.25;w=w+1|0}h=h+1|0}e:do if((w|0)>2){g=g+.25;if(g>0){yr(F|0,0,v<<2|0)|0;k=0;g=0;break}else w=0;while(1){if((w|0)>=(v|0))break e;ce=F+(w<<2)|0;fe=+f[ce>>2]+-.25;f[ce>>2]=fe<0?0:fe;w=w+1|0}}while(0);fe=g+.20000000298023224;Z=k*64}else{fe=0;Z=0}if(E){y=I?0:+(Ee|0)*.5;w=($e|0)==2;k=-10;S=0;m=tt;while(1){if((m|0)>=(it|0))break;oe=k+-1;g=+f[C+(m<<2)>>2]-y;g=oe>g?oe:g;do if(w){k=+f[C+(m+nt<<2)>>2]-y;if(g>k)break;g=k}while(0);k=g;S=S+g;m=m+1|0}ce=e+208|0;j=+f[ce>>2];oe=S/+(it-tt|0)-j;ae=oe<-1.5;le=oe>3&(ae^1);oe=le|ae?le?3:-1.5:oe;f[ce>>2]=j+oe*.019999999552965164}else oe=0;if(!O)Sr(P|0,C|0,me<<2|0)|0;e:do if(D){t=We+20|0;m=s[t>>2]|0;N=We+28|0;w=s[N>>2]|0;do if((i|0)==0?(m+((ne(w|0)|0)+-32)+3|0)<=(b|0):0){if((s[we>>2]|0)<=4){h=w;_=m;E=M;i=0;m=x;break}if(!E){h=w;_=m;E=M;i=0;m=x;break}if(Ce){h=w;_=m;E=M;i=0;m=x;break}t:do if(($e|0)==1){i=s[Xe>>2]|0;s[Y>>2]=i;g=(s[d>>2]=i,+f[d>>2]);i=0;while(1){i=i+1|0;if((i|0)>=(it|0))break t;j=+f[Xe+(i<<2)>>2];j=g+-1>j?g+-1:j;f[Y+(i<<2)>>2]=j;g=j}}else{j=+f[Xe>>2];g=+f[Xe+(nt<<2)>>2];g=j>g?j:g;f[Y>>2]=g;i=0;while(1){i=i+1|0;if((i|0)>=(it|0))break t;S=+f[Xe+(i<<2)>>2];j=+f[Xe+(i+nt<<2)>>2];ce=S>j;j=g+-1>(ce?S:j)?g+-1:ce?S:j;f[Y+(i<<2)>>2]=j;g=j}}while(0);i=it+-2|0;while(1){if((i|0)<0)break;ce=Y+(i<<2)|0;S=+f[ce>>2];j=+f[Y+(i+1<<2)>>2]+-1;f[ce>>2]=S>j?S:j;i=i+-1|0}i=it+-1|0;m=0;g=0;do{w=te(m,nt)|0;a=2;while(1){if((a|0)>=(i|0))break;S=+f[C+(a+w<<2)>>2];j=+f[Y+(a<<2)>>2];j=(S<0?0:S)-(j<0?0:j);a=a+1|0;g=g+(j<0?0:j)}m=m+1|0}while((m|0)<($e|0));if(g/+(te(it+-3|0,$e)|0)>1){ti(Fe,$,W,M,$e,et,Ee,s[V>>2]|0);i=s[Oe>>2]|0;w=s[pe>>2]<=(de|0))break;_=r[i+(A<<1)>>1]|0;a=M+(m+(_<>1]|0)-_<=(_|0))break;j=+f[a+(E<<2)>>2];E=E+1|0;g=g+j*j}j=+z(+(g+1.0000000272452012e-27));f[R+(A+(te(v,s[Ve>>2]|0)|0)<<2)>>2]=j;A=h}v=v+1|0}while((v|0)<($e|0));w=0;do{i=0;while(1){if((i|0)>=(de|0)){i=de;break}ce=i+(te(w,s[Ve>>2]|0)|0)|0;j=+Q(+ +f[R+(ce<<2)>>2])*1.4426950408889634;f[C+(ce<<2)>>2]=j-+f[17220+(i<<2)>>2];i=i+1|0}while(1){if((i|0)>=(it|0))break;f[C+((te(w,s[Ve>>2]|0)|0)+i<<2)>>2]=-14;i=i+1|0}w=w+1|0}while((w|0)<($e|0));g=+(Ee|0)*.5;i=0;while(1){if((i|0)>=(me|0))break;ce=P+(i<<2)|0;f[ce>>2]=+f[ce>>2]+g;i=i+1|0}f[xe>>2]=.20000000298023224;w=M;i=1;m=$}else{w=M;i=0;m=x}h=s[N>>2]|0;_=s[t>>2]|0;E=w}else{h=w;_=m;E=M;m=x}while(0);if((_+((ne(h|0)|0)+-32)+3|0)>(b|0)){ce=i;X=m;break}a=h>>>3;w=h-a|0;O=We+32|0;if(i){s[O>>2]=(s[O>>2]|0)+w;w=a}s[N>>2]=w;v=We+36|0;A=We+40|0;T=We+24|0;M=We+8|0;x=We+4|0;I=We+44|0;a=_;while(1){if(w>>>0>=8388609){ce=i;X=m;break e}h=s[O>>2]|0;_=h>>>23;if((_|0)==255)s[v>>2]=(s[v>>2]|0)+1;else{h=h>>>31;w=s[A>>2]|0;if((w|0)>-1){a=s[T>>2]|0;if((a+(s[M>>2]|0)|0)>>>0<(s[x>>2]|0)>>>0){s[T>>2]=a+1;n[(s[We>>2]|0)+a>>0]=w+h;w=0}else w=-1;s[I>>2]=s[I>>2]|w}w=s[v>>2]|0;if(w|0){h=h+255&255;do{a=s[T>>2]|0;if((a+(s[M>>2]|0)|0)>>>0<(s[x>>2]|0)>>>0){s[T>>2]=a+1;n[(s[We>>2]|0)+a>>0]=h;a=0;w=s[v>>2]|0}else a=-1;s[I>>2]=s[I>>2]|a;w=w+-1|0;s[v>>2]=w}while((w|0)!=0)}s[A>>2]=_&255;h=s[O>>2]|0;w=s[N>>2]|0;a=s[t>>2]|0}s[O>>2]=h<<8&2147483392;w=w<<8;s[N>>2]=w;a=a+8|0;s[t>>2]=a}}else{E=M;ce=i;X=x}while(0);w=(te($e,je)|0)<<2;K=u;u=u+((1*w|0)+15&-16)|0;w=s[Oe>>2]|0;m=s[pe>>2]<=(de|0))break;g=1/(+f[R+(i+(te(v,s[Ve>>2]|0)|0)<<2)>>2]+1.0000000272452012e-27);h=i+1|0;_=r[w+(h<<1)>>1]<>1]<=(_|0)){i=h;continue e}le=i+a|0;f[K+(le<<2)>>2]=+f[E+(le<<2)>>2]*g;i=i+1|0}}v=v+1|0;if((v|0)>=($e|0))break}$=u;u=u+((1*(nt<<2)|0)+15&-16)|0;e:do if((l|0)<($e*15|0))if(Ce&(l|0)<15){i=0;Te=320}else{i=0;Te=322}else{if(Ce)if((l|0)<15){i=0;Te=320;break}else{i=0;Te=322;break}if((s[we>>2]|0)<=1){i=0;Te=322;break}if(s[Ae>>2]|0){i=0;Te=322;break}i=(1280/(l|0)|0)+2|0;i=ii(Fe,de,ce,$,(i|0)<5?5:i,K,je,Ee,+f[xe>>2],s[J>>2]|0)|0;w=$+(de+-1<<2)|0;m=de;while(1){if((m|0)>=(it|0))break e;s[$+(m<<2)>>2]=s[w>>2];m=m+1|0}}while(0);e:do if((Te|0)==320)while(1){Te=0;if((i|0)>=(it|0)){i=ce;break e}s[$+(i<<2)>>2]=0;i=i+1|0;Te=320}else if((Te|0)==322)while(1){Te=0;if((i|0)>=(it|0)){i=0;break e}s[$+(i<<2)>>2]=ce;i=i+1|0;Te=322}while(0);ae=u;u=u+((1*(me<<2)|0)+15&-16)|0;h=0;do{w=te(h,nt)|0;_=tt;while(1){if((_|0)>=(it|0))break;m=_+w|0;a=C+(m<<2)|0;g=+f[a>>2];if(+H(+(g-+f[Xe+(m<<2)>>2]))<2)f[a>>2]=g-+f[Ye+(m<<2)>>2]*.25;_=_+1|0}h=h+1|0}while((h|0)<($e|0));Ti(Fe,tt,it,de,C,Xe,b,ae,We,$e,Ee,c,s[e+12>>2]|0,e+84|0,(s[we>>2]|0)>3&1,s[e+56>>2]|0,s[Ae>>2]|0);ie=We+4|0;w=s[ie>>2]<<3;re=We+20|0;h=s[re>>2]|0;le=We+28|0;a=s[le>>2]|0;v=h+((ne(a|0)|0)+-32)|0;m=(ce|0)!=0;_=m?2:4;if(D)O=(v+_+1|0)>>>0<=w>>>0;else O=0;I=w-(O&1)|0;x=m?4:5;W=We+32|0;V=We+36|0;Y=We+40|0;J=We+24|0;ee=We+8|0;se=We+44|0;E=0;M=tt;T=0;while(1){if((M|0)>=(it|0))break;w=$+(M<<2)|0;if((v+_|0)>>>0>I>>>0){s[w>>2]=E;m=E;w=T}else{A=s[w>>2]|0;_=a>>>_;m=a-_|0;w=(A|0)==(E|0);if(!w)s[W>>2]=(s[W>>2]|0)+m;_=w?m:_;s[le>>2]=_;w=h;while(1){if(_>>>0>=8388609)break;m=s[W>>2]|0;h=m>>>23;if((h|0)==255){s[V>>2]=(s[V>>2]|0)+1;a=_}else{a=m>>>31;w=s[Y>>2]|0;if((w|0)>-1){m=s[J>>2]|0;if((m+(s[ee>>2]|0)|0)>>>0<(s[ie>>2]|0)>>>0){s[J>>2]=m+1;n[(s[We>>2]|0)+m>>0]=w+a;w=0}else w=-1;s[se>>2]=s[se>>2]|w}w=s[V>>2]|0;if(w|0){a=a+255&255;do{m=s[J>>2]|0;if((m+(s[ee>>2]|0)|0)>>>0<(s[ie>>2]|0)>>>0){s[J>>2]=m+1;n[(s[We>>2]|0)+m>>0]=a;m=0;w=s[V>>2]|0}else m=-1;s[se>>2]=s[se>>2]|m;w=w+-1|0;s[V>>2]=w}while((w|0)!=0)}s[Y>>2]=h&255;m=s[W>>2]|0;a=s[le>>2]|0;w=s[re>>2]|0}s[W>>2]=m<<8&2147483392;_=a<<8;s[le>>2]=_;w=w+8|0;s[re>>2]=w}h=w;a=_;m=A;v=w+((ne(_|0)|0)+-32)|0;w=T|A}E=m;M=M+1|0;_=x;T=w}_=ce<<2;do if(O){if((n[_+T+(27892+(Ee<<3))>>0]|0)==(n[(_|2)+T+(27892+(Ee<<3))>>0]|0)){i=0;w=a;break}w=a>>>1;m=a-w|0;if(!i)w=m;else s[W>>2]=(s[W>>2]|0)+m;s[le>>2]=w;m=h;while(1){if(w>>>0>=8388609)break;a=s[W>>2]|0;h=a>>>23;if((h|0)==255)s[V>>2]=(s[V>>2]|0)+1;else{a=a>>>31;w=s[Y>>2]|0;if((w|0)>-1){m=s[J>>2]|0;if((m+(s[ee>>2]|0)|0)>>>0<(s[ie>>2]|0)>>>0){s[J>>2]=m+1;n[(s[We>>2]|0)+m>>0]=w+a;w=0}else w=-1;s[se>>2]=s[se>>2]|w}w=s[V>>2]|0;if(w|0){a=a+255&255;do{m=s[J>>2]|0;if((m+(s[ee>>2]|0)|0)>>>0<(s[ie>>2]|0)>>>0){s[J>>2]=m+1;n[(s[We>>2]|0)+m>>0]=a;m=0;w=s[V>>2]|0}else m=-1;s[se>>2]=s[se>>2]|m;w=w+-1|0;s[V>>2]=w}while((w|0)!=0)}s[Y>>2]=h&255;a=s[W>>2]|0;w=s[le>>2]|0;m=s[re>>2]|0}s[W>>2]=a<<8&2147483392;w=w<<8;s[le>>2]=w;m=m+8|0;s[re>>2]=m}i=i<<1;h=m}else{i=0;w=a}while(0);i=_+i|0;m=tt;while(1){if((m|0)>=(it|0))break;q=$+(m<<2)|0;s[q>>2]=n[i+(s[q>>2]|0)+(27892+(Ee<<3))>>0];m=m+1|0}e:do if((h+((ne(w|0)|0)+-32)+4|0)<=(b|0)){t:do if(!(s[Ae>>2]|0)){i:do if(Ce){if(!(s[we>>2]|0)){s[e+80>>2]=0;Te=415;break}i=e+80|0;if(!ce){s[i>>2]=3;i=3;Te=414;break t}else{s[i>>2]=2;i=2;Te=414;break t}}else{i=s[we>>2]|0;do if(!X){if((i|0)<3|(c|0)<($e*10|0))break;L=e+88|0;B=e+80|0;U=s[B>>2]|0;D=e+96|0;t=s[Oe>>2]|0;I=s[pe>>2]<>1]|0)-(r[t+(de+-1<<1)>>1]|0)<>2]=0;i=0;c=w>>>5;break i}else{N=0;i=0;c=0;m=0}do{O=te(N,I)|0;x=0;while(1){if((x|0)>=(de|0))break;E=r[t+(x<<1)>>1]|0;a=K+(E<>1]|0)-E<>2];j=j*j*g;_=_+1|0;A=A+(j<.25&1)|0;T=T+(j<.015625&1)|0;M=M+(j<.0625&1)|0}if((x|0)>((s[Ve>>2]|0)+-4|0))i=i+((M+A<<5>>>0)/(E>>>0)|0)|0;x=v;c=c+1|0;m=m+(((T<<1|0)>=(E|0)&1)+((M<<1|0)>=(E|0)&1)+((A<<1|0)>=(E|0)&1)<<8)|0}N=N+1|0}while((N|0)<($e|0));if(!he){if(!i)i=0;else i=(i>>>0)/((te(4-(s[Ve>>2]|0)+de|0,$e)|0)>>>0)|0;i=(s[D>>2]|0)+i>>1;s[D>>2]=i;switch(s[ue>>2]|0){case 2:{i=i+4|0;break}case 0:{i=i+-4|0;break}default:{}}s[ue>>2]=(i|0)>22?2:(i|0)>18&1}i=((m>>>0)/(c>>>0)|0)+(s[L>>2]|0)>>1;s[L>>2]=i;i=(i*3|0)+(3-U<<7|64)+2>>2;do if((i|0)>=80){if((i|0)<256){i=2;break}i=(i|0)<384&1;s[B>>2]=i;c=w>>>5;if((i|0)>0){Te=418;break t}else break i}else i=3;while(0);s[B>>2]=i;c=w>>>5;Te=418;break t}while(0);c=e+80|0;if(!i){s[c>>2]=0;Te=415;break}else{s[c>>2]=2;i=2;Te=414;break t}}while(0);if((Te|0)==415){i=0;c=w>>>5}i=w-(te(c,o[28203+i>>0]|0)|0)|0}else{s[ue>>2]=0;s[e+80>>2]=2;i=2;Te=414}while(0);if((Te|0)==414){c=w>>>5;Te=418}if((Te|0)==418){pe=o[28203+(i+-1)>>0]|0;de=w-(te(c,pe)|0)|0;s[W>>2]=(s[W>>2]|0)+de;i=te(c,pe-(o[28203+i>>0]|0)|0)|0}s[le>>2]=i;c=h;while(1){if(i>>>0>=8388609)break e;w=s[W>>2]|0;m=w>>>23;if((m|0)==255)s[V>>2]=(s[V>>2]|0)+1;else{w=w>>>31;i=s[Y>>2]|0;if((i|0)>-1){c=s[J>>2]|0;if((c+(s[ee>>2]|0)|0)>>>0<(s[ie>>2]|0)>>>0){ -s[J>>2]=c+1;n[(s[We>>2]|0)+c>>0]=i+w;i=0}else i=-1;s[se>>2]=s[se>>2]|i}i=s[V>>2]|0;if(i|0){w=w+255&255;do{c=s[J>>2]|0;if((c+(s[ee>>2]|0)|0)>>>0<(s[ie>>2]|0)>>>0){s[J>>2]=c+1;n[(s[We>>2]|0)+c>>0]=w;c=0;i=s[V>>2]|0}else c=-1;s[se>>2]=s[se>>2]|c;i=i+-1|0;s[V>>2]=i}while((i|0)!=0)}s[Y>>2]=m&255;w=s[W>>2]|0;i=s[le>>2]|0;c=s[re>>2]|0}s[W>>2]=w<<8&2147483392;i=i<<8;s[le>>2]=i;c=c+8|0;s[re>>2]=c}}while(0);q=u;u=u+((1*(nt<<2)|0)+15&-16)|0;O=e+52|0;j=+ni(C,P,nt,tt,it,$e,q,s[be>>2]|0,s[Fe+56>>2]|0,ce,s[ve>>2]|0,s[O>>2]|0,ye,Ee,l,Pe,s[Ae>>2]|0,F);if(s[Ae>>2]|0)s[q>>2]=(l|0)>26?8:(l|0)/3|0;N=u;u=u+((1*(nt<<2)|0)+15&-16)|0;i=s[Ve>>2]|0;l=(Ee<<1)+$e+-1|0;c=Fe+104|0;w=0;while(1){if((w|0)>=(i|0))break;ve=w+1|0;be=s[Oe>>2]|0;pe=(te(i,l)|0)+w|0;s[N+(w<<2)>>2]=(te(te((o[(s[c>>2]|0)+pe>>0]|0)+64|0,$e)|0,(r[be+(ve<<1)>>1]|0)-(r[be+(w<<1)>>1]|0)<>2;w=ve}P=b<<3;be=s[re>>2]|0;i=s[le>>2]|0;ve=32-(ne(i|0)|0)|0;x=i>>>(ve+-16|0);A=(x>>>12)+-8|0;l=be;c=6;b=tt;A=(be<<3)-((ve<<3)+(A+(x>>>0>(s[5272+(A<<2)>>2]|0)>>>0&1)))|0;x=0;while(1){if((b|0)>=(it|0))break;M=b+1|0;a=(te($e,(r[ye+(M<<1)>>1]|0)-(r[ye+(b<<1)>>1]|0)|0)|0)<=(P-T|0))break;if((v|0)>=(s[h>>2]|0))break;m=(_|0)<(s[E>>2]|0);b=i>>>b;i=i-b|0;if(m){s[W>>2]=(s[W>>2]|0)+i;i=b}s[le>>2]=i;while(1){if(i>>>0>=8388609)break;b=s[W>>2]|0;w=b>>>23;if((w|0)==255)s[V>>2]=(s[V>>2]|0)+1;else{b=b>>>31;i=s[Y>>2]|0;if((i|0)>-1){l=s[J>>2]|0;if((l+(s[ee>>2]|0)|0)>>>0<(s[ie>>2]|0)>>>0){s[J>>2]=l+1;n[(s[We>>2]|0)+l>>0]=i+b;i=0}else i=-1;s[se>>2]=s[se>>2]|i}i=s[V>>2]|0;if(i|0){b=b+255&255;do{l=s[J>>2]|0;if((l+(s[ee>>2]|0)|0)>>>0<(s[ie>>2]|0)>>>0){s[J>>2]=l+1;n[(s[We>>2]|0)+l>>0]=b;l=0;i=s[V>>2]|0}else l=-1;s[se>>2]=s[se>>2]|l;i=i+-1|0;s[V>>2]=i}while((i|0)!=0)}s[Y>>2]=w&255;b=s[W>>2]|0;i=s[le>>2]|0;l=s[re>>2]|0}s[W>>2]=b<<8&2147483392;i=i<<8;s[le>>2]=i;l=l+8|0;s[re>>2]=l}be=32-(ne(i|0)|0)|0;ve=i>>>(be+-16|0);w=(ve>>>12)+-8|0;w=(l<<3)-((be<<3)+(w+(ve>>>0>(s[5272+(w<<2)>>2]|0)>>>0&1)))|0;if(!m)break;v=v+a|0;b=1;_=_+1|0;T=T+a|0}if(_)c=(c|0)<3?2:c+-1|0;s[E>>2]=v;b=M;A=w;x=T}F=($e|0)==2;if(F){if(!Ee)m=0;else{c=0;g=1.0000000036274937e-15;k=1.0000000036274937e-15;e:while(1){if((c|0)==13)break;ye=s[Oe>>2]|0;b=c+1|0;w=r[ye+(b<<1)>>1]<>1]<=(w|0)){c=b;continue e}y=+f[K+(c<<2)>>2];S=+f[K+(c+je<<2)>>2];c=c+1|0;g=g+(+H(+y)+ +H(+S));k=k+(+H(+(y+S))+ +H(+(y-S)))}}m=r[(s[Oe>>2]|0)+26>>1]<>2]=+(m+((Ee|0)<2?5:13)|0)*(k*.7071070075035095)>+(m|0)*g&1;m=Ee}g=+((Ue|0)/1e3|0|0);w=e+200|0;c=s[w>>2]|0;b=0;while(1){if((b|0)>=21)break;if(+f[5104+(b<<2)>>2]>g)break;b=b+1|0}if(!((b|0)>(c|0)?+f[5104+(c<<2)>>2]+ +f[5188+(c<<2)>>2]>g:0))Te=480;do if((Te|0)==480){if((b|0)>=(c|0)){c=b;break}Ee=c+-1|0;if(!(+f[5104+(Ee<<2)>>2]-+f[5188+(Ee<<2)>>2](c|0);s[w>>2]=(it|0)<((B?tt:c)|0)?it:B?tt:c;B=m}else B=Ee;if((A+48|0)>(P-x|0))I=5;else{do if((tt|0)>0)Te=487;else{if(s[Ae>>2]|0){Te=487;break}h=e+196|0;S=+f[xe>>2];_=s[e+200>>2]|0;if(F){c=0;g=0;while(1){if((c|0)==8)break;w=s[Oe>>2]|0;b=r[w+(c<<1)>>1]|0;a=b<>1]|0)-b<=(b|0))break;y=k+ +f[m+(w<<2)>>2]*+f[a+(w<<2)>>2];w=w+1|0;k=y}g=g+k}k=+H(+(g*.125));k=k>1?1:k;c=8;y=k;while(1){if((c|0)>=(_|0))break;w=s[Oe>>2]|0;b=r[w+(c<<1)>>1]|0;a=b<>1]|0)-b<=(b|0))break;st=g+ +f[m+(w<<2)>>2]*+f[a+(w<<2)>>2];w=w+1|0;g=st}st=+H(+g);y=y1?1:st;k=+Q(+(1.0010000467300415-k*k))*1.4426950408889634;g=k*.5;st=+Q(+(1.0010000467300415-st*st))*1.4426950408889634;k=k*.75;y=+f[h>>2]+.25;st=-((g>st?g:st)*.5);f[h>>2]=y=(b|0))break;g=g+ +f[C+(c+(te(w,s[Ve>>2]|0)|0)<<2)>>2]*+((c<<1)+2-it|0);c=c+1|0}w=w+1|0}while((w|0)<($e|0));g=(g/+(te(b,$e)|0)+1)/6;ye=g>2;Ee=g<-2&(ye^1);g=k-(Ee|ye?Ee?-2:2:g)-Z-S*2;if(s[e+120>>2]|0){st=(+f[e+128>>2]+.05000000074505806)*2;ye=st>2;Ee=st<-2&(ye^1);g=g-(Ee|ye?Ee?-2:2:st)}c=~~+G(+(g+.5));if((c|0)>10){b=i>>>7;c=10;Te=512;break}b=i>>>7;if((c|0)>=0){if((c|0)>0){Te=512;break}}else c=0;m=c;i=i-(te(b,o[28207+c>>0]|0)|0)|0}while(0);if((Te|0)==487){f[e+196>>2]=0;b=i>>>7;c=5;Te=512}if((Te|0)==512){Te=o[28207+(c+-1)>>0]|0;m=i-(te(b,Te)|0)|0;s[W>>2]=(s[W>>2]|0)+m;m=c;i=te(b,Te-(o[28207+c>>0]|0)|0)|0}s[le>>2]=i;b=l;while(1){if(i>>>0>=8388609)break;l=s[W>>2]|0;w=l>>>23;if((w|0)==255){s[V>>2]=(s[V>>2]|0)+1;c=l;l=b}else{c=l>>>31;i=s[Y>>2]|0;if((i|0)>-1){l=s[J>>2]|0;if((l+(s[ee>>2]|0)|0)>>>0<(s[ie>>2]|0)>>>0){s[J>>2]=l+1;n[(s[We>>2]|0)+l>>0]=i+c;i=0}else i=-1;s[se>>2]=s[se>>2]|i}i=s[V>>2]|0;if(i|0){c=c+255&255;do{l=s[J>>2]|0;if((l+(s[ee>>2]|0)|0)>>>0<(s[ie>>2]|0)>>>0){s[J>>2]=l+1;n[(s[We>>2]|0)+l>>0]=c;l=0;i=s[V>>2]|0}else l=-1;s[se>>2]=s[se>>2]|l;i=i+-1|0;s[V>>2]=i}while((i|0)!=0)}s[Y>>2]=w&255;c=s[W>>2]|0;i=s[le>>2]|0;l=s[re>>2]|0}s[W>>2]=c<<8&2147483392;i=i<<8;s[le>>2]=i;b=l+8|0;s[re>>2]=b}Ee=32-(ne(i|0)|0)|0;Te=i>>>(Ee+-16|0);A=(Te>>>12)+-8|0;l=b;I=m;A=(b<<3)-((Ee<<3)+(A+(Te>>>0>(s[5272+(A<<2)>>2]|0)>>>0&1)))|0}if(Se){M=(s[Me>>2]|0)-B|0;l=3-B|0;C=1275>>>l;C=(p|0)<(C|0)?p:C;if(Ce){i=($e*72|0)+32|0;i=(Le|0)<(i|0)?0:Le-i|0}else i=Le-(($e*320|0)+160)|0;T=(s[O>>2]|0)==0;if(T)E=i;else E=i+(s[e+184>>2]>>M)|0;if(Ce){i=s[e+156>>2]|0;st=+f[xe>>2];i=~~(+(E+((i|0)<100?96>>>l:0)-((i|0)>100?144>>>l:0)|0)+(st+-.25)*400);Oe=(A+x+63>>6)+2|0;l=Re+296+x+63>>6;i=!(st>.699999988079071)|(i|0)>400?i:400;l=(Oe|0)>(l|0)?Oe:l}else{l=s[e+92>>2]|0;b=s[e+200>>2]|0;k=+f[e+196>>2];w=s[Pe>>2]|0;y=+f[xe>>2];p=s[e+64>>2]|0;_=s[Ae>>2]|0;v=(s[e+204>>2]|0)!=0;h=s[Ve>>2]|0;a=s[Oe>>2]|0;l=(l|0)==0?h:l;i=r[a+(l<<1)>>1]<(b|0)?b:l)<<1)>>1]<>2]|0)==0;do if(c)i=E;else{g=+f[e+136>>2];if(!(g<.4)){i=E;break}i=E-~~(+(m<<3|0)*(.4000000059604645-g))|0}while(0);if(F){Oe=(l|0)>(b|0)?b:l;Oe=(r[a+(Oe<<1)>>1]<>2]+-.15000000596046448;g=+(m<<3|0);i=i+~~(g*1.2000000476837158*((st<0?0:st)+-.09000000357627869))|0;if(!ke)break;i=i+~~(g*.800000011920929)|0}while(0);if(v&(_|0)==0){Oe=i+~~(+(m<<3|0)*fe)|0;i=(i|0)/4|0;i=(i|0)>(Oe|0)?i:Oe}xe=~~(+((te(r[a+(h+-2<<1)>>1]<>2;Oe=(xe|0)>(Oe|0)?xe:Oe;i=(i|0)<(Oe|0)?i:Oe;do if(!(v&(_|0)==0)){if(!T)i=~~(+(i-E|0)*.6700000166893005)+E|0;if(!(y<.20000000298023224&(v^1)))break;Oe=96e3-Ue|0;xe=(Oe|0)>32e3;i=i+~~(((Ue|0)>96e3&(xe^1)?0:xe?.09919999539852142:+(Oe|0)*3099999958067201e-21)*oe*+(i|0))|0}while(0);l=E<<1;i=(l|0)<(i|0)?l:i;l=(A+x+63>>6)+2|0}p=i+A|0;b=p+32>>6;b=(l|0)>(b|0)?l:b;b=(C|0)<(b|0)?C:b;w=(Be|0)==0;i=w?b:2;l=e+188|0;c=s[l>>2]|0;if((c|0)<970){s[l>>2]=c+1;g=1/+(c+21|0)}else g=.0010000000474974513;do if(!T){l=e+176|0;s[l>>2]=(s[l>>2]|0)+((w?b<<6:128)-Le);l=e+184|0;Oe=e+180|0;c=s[Oe>>2]|0;c=c+~~(g*+(((w?p-Le|0:0)<>2]|0)-c|0))|0;s[Oe>>2]=c;s[l>>2]=0-c;l=e+176|0;c=s[l>>2]|0;if((c|0)>=0)break;s[l>>2]=0;i=w?b+((c|0)/-64|0)|0:2}while(0);U=(C|0)<(i|0)?C:i;Le=s[We>>2]|0;l=s[ee>>2]|0;i=0-l|0;Mr(Le+U+i|0,Le+(s[ie>>2]|0)+i|0,l|0)|0;s[ie>>2]=U;l=s[re>>2]|0;i=s[le>>2]|0}else U=p;t=u;u=u+((1*(nt<<2)|0)+15&-16)|0;P=u;u=u+((1*(nt<<2)|0)+15&-16)|0;D=u;u=u+((1*(nt<<2)|0)+15&-16)|0;x=U<<6;Le=32-(ne(i|0)|0)|0;L=i>>>(Le+-16|0);i=(L>>>12)+-8|0;i=x+((Le<<3)+(i+(L>>>0>(s[5272+(i<<2)>>2]|0)>>>0&1))-(l<<3))+-1|0;L=(ce|0)==0;if((B|0)>1&(L^1))M=(i|0)>=((B<<3)+16|0);else M=0;C=M?8:0;l=i-C|0;if(!(s[e+120>>2]|0))i=it+-1|0;else{do if((Ue|0)<($e*32e3|0))i=13;else{if((Ue|0)<($e*48e3|0)){i=16;break}if((Ue|0)<($e*6e4|0)){i=18;break}i=(Ue|0)<($e*8e4|0)?19:20}while(0);Ue=s[e+144>>2]|0;i=(Ue|0)>(i|0)?Ue:i}T=e+200|0;c=e+92|0;A=Mi(Fe,tt,it,q,N,I,T,ze,l,Ge,P,t,D,$e,B,We,1,s[c>>2]|0,(s[Ae>>2]|0)==0?i:1)|0;i=s[c>>2]|0;if(!i)i=A;else{Le=i+1|0;i=i+-1|0;Ue=(i|0)>(A|0);i=(Le|0)<((Ue?i:A)|0)?Le:Ue?i:A}s[c>>2]=i;O=We+12|0;N=We+16|0;E=tt;while(1){if((E|0)>=(it|0))break;a=s[t+(E<<2)>>2]|0;if((a|0)>=1){h=65536<>16;g=+(h|0);k=+(1<<14-a|0);_=h+-1|0;i=s[Ve>>2]|0;v=0;do{m=~~+G(+((+f[ae+(E+(te(v,i)|0)<<2)>>2]+.5)*g));m=(m|0)<(h|0)?m:_;m=(m|0)<0?0:m;i=s[O>>2]|0;l=s[N>>2]|0;if((l+a|0)>>>0>32){b=7-l|0;b=l+((b|0)>-8?b:-8)&-8;w=l;do{c=s[ee>>2]|0;p=s[ie>>2]|0;if(((s[J>>2]|0)+c|0)>>>0

>>0){c=c+1|0;s[ee>>2]=c;n[(s[We>>2]|0)+(p-c)>>0]=i;c=0}else c=-1;s[se>>2]=s[se>>2]|c;i=i>>>8;w=w+-8|0}while((w|0)>7);l=l+-8-b|0}s[O>>2]=i|m<>2]=l+a;s[re>>2]=(s[re>>2]|0)+a;st=(+(m|0)+.5)*k*6103515625e-14+-.5;i=Xe+(E+(te(v,s[Ve>>2]|0)|0)<<2)|0;f[i>>2]=+f[i>>2]+st;i=s[Ve>>2]|0;Ue=ae+(E+(te(v,i)|0)<<2)|0;f[Ue>>2]=+f[Ue>>2]-st;v=v+1|0}while((v|0)<($e|0))}E=E+1|0}Ue=u;u=u+((1*me|0)+15&-16)|0;I=e+76|0;on(1,Fe,tt,it,K,F?K+(je<<2)|0:0,Ue,R,P,X,s[e+80>>2]|0,s[ze>>2]|0,s[T>>2]|0,$,x-C|0,s[Ge>>2]|0,We,B,A,I,s[we>>2]|0,s[e+72>>2]|0);if(M){m=(s[e+116>>2]|0)<2&1;i=s[O>>2]|0;l=s[N>>2]|0;if((l+1|0)>>>0>32){b=7-l|0;b=l+((b|0)>-8?b:-8)&-8;w=l;do{c=s[ee>>2]|0;p=s[ie>>2]|0;if(((s[J>>2]|0)+c|0)>>>0

>>0){c=c+1|0;s[ee>>2]=c;n[(s[We>>2]|0)+(p-c)>>0]=i;c=0}else c=-1;s[se>>2]=s[se>>2]|c;i=i>>>8;w=w+-8|0}while((w|0)>7);l=l+-8-b|0}s[O>>2]=i|m<>2]=l+1;i=(s[re>>2]|0)+1|0;s[re>>2]=i}else i=s[re>>2]|0;i=(U<<3)-(i+((ne(s[le>>2]|0)|0)+-32))|0;E=0;while(1){if((E|0)==2)break;else v=tt;while(1){if(!((v|0)<(it|0)&(i|0)>=($e|0)))break;l=s[t+(v<<2)>>2]|0;do if((l|0)<=7){if((s[D+(v<<2)>>2]|0)!=(E|0))break;g=+(1<<14-l+-1|0);l=s[Ve>>2]|0;c=s[N>>2]|0;p=s[O>>2]|0;_=0;do{h=!(+f[ae+(v+(te(_,l)|0)<<2)>>2]<0);a=h&1;if((c+1|0)>>>0>32){w=7-c|0;w=c+((w|0)>-8?w:-8)&-8;m=c;l=p;do{p=s[ee>>2]|0;b=s[ie>>2]|0;if(((s[J>>2]|0)+p|0)>>>0>>0){p=p+1|0;s[ee>>2]=p;n[(s[We>>2]|0)+(b-p)>>0]=l;p=0}else p=-1;s[se>>2]=s[se>>2]|p;l=l>>>8;m=m+-8|0}while((m|0)>7);c=c+-8-w|0}else l=p;p=l|a<>2]=p;s[N>>2]=c;s[re>>2]=(s[re>>2]|0)+1;st=(+(h&1)+-.5)*g*6103515625e-14;l=Xe+(v+(te(_,s[Ve>>2]|0)|0)<<2)|0;f[l>>2]=+f[l>>2]+st;l=s[Ve>>2]|0;ze=ae+(v+(te(_,l)|0)<<2)|0;f[ze>>2]=+f[ze>>2]-st;i=i+-1|0;_=_+1|0}while((_|0)<($e|0))}while(0);v=v+1|0}E=E+1|0}p=Ze<<2;yr(Ye|0,0,p|0)|0;l=0;do{i=te(l,nt)|0;c=tt;while(1){if((c|0)>=(it|0))break;Ve=c+i|0;st=+f[ae+(Ve<<2)>>2];Ge=st>.5;ze=st<-.5&(Ge^1);f[Ye+(Ve<<2)>>2]=ze|Ge?ze?-.5:.5:st;c=c+1|0}l=l+1|0}while((l|0)<($e|0));e:do if(Be|0){i=0;while(1){if((i|0)>=(me|0))break e;f[Xe+(i<<2)>>2]=-28;i=i+1|0}}while(0);s[e+104>>2]=s[Ke>>2];f[e+108>>2]=Ie;s[e+112>>2]=De;if(ge&($e|0)==1)Sr(Xe+(nt<<2)|0,Xe|0,nt<<2|0)|0;e:do if(L){Sr(Qe|0,Je|0,p|0)|0;Sr(Je|0,Xe|0,p|0)|0;c=0}else{i=0;while(1){if((i|0)>=(Ze|0)){c=0;break e}Ke=Je+(i<<2)|0;Ie=+f[Ke>>2];st=+f[Xe+(i<<2)>>2];f[Ke>>2]=Ie=(tt|0)){i=it;break}Ke=l+i|0;f[Xe+(Ke<<2)>>2]=0;f[Qe+(Ke<<2)>>2]=-28;f[Je+(Ke<<2)>>2]=-28;i=i+1|0}while(1){if((i|0)>=(nt|0))break;Ke=l+i|0;f[Xe+(Ke<<2)>>2]=0;f[Qe+(Ke<<2)>>2]=-28;f[Je+(Ke<<2)>>2]=-28;i=i+1|0}c=c+1|0}while((c|0)<(et|0));l=e+116|0;if(!(ce|_e))i=0;else i=(s[l>>2]|0)+1|0;s[l>>2]=i;s[I>>2]=s[le>>2];ui(We);e=(s[se>>2]|0)==0?U:-3;He(qe|0);u=rt;return e|0}function Qt(e,t,i,n,r,o,a,l,h,c,d){e=e|0;t=t|0;i=i|0;n=n|0;r=r|0;o=o|0;a=a|0;l=l|0;h=h|0;c=c|0;d=d|0;var p=0,b=0,w=0,m=0,g=0,_=0,v=0,k=0,y=0,E=0,A=0,T=0,S=0,M=0,R=0,C=0,P=0,x=0,I=0,O=0,N=0,D=0,L=0,U=0,B=0;U=u;u=u+16|0;L=U+8|0;_=U;y=s[e>>2]|0;O=s[y+4>>2]|0;w=r+1024|0;D=(te(w,n)|0)<<2;N=u;u=u+((1*D|0)+15&-16)|0;s[L>>2]=N;s[L+4>>2]=N+(w<<2);N=O+r|0;D=r<<2;p=0;do{I=s[L+(p<<2)>>2]|0;Sr(I|0,i+(p<<10<<2)|0,4096)|0;Sr(I+4096|0,t+((te(p,N)|0)<<2)+(O<<2)|0,D|0)|0;p=p+1|0}while((p|0)<(n|0));if(!c){s[_>>2]=15;I=e+104|0;x=15;v=0}else{g=Ne()|0;p=u;u=u+((1*(w>>1<<2)|0)+15&-16)|0;bi(L,p,w,n);mi(p+2048|0,p,r,979,_);s[_>>2]=1024-(s[_>>2]|0);c=e+104|0;b=+_i(p,r,_,s[c>>2]|0,+f[e+108>>2]);p=s[_>>2]|0;if((p|0)>1022){s[_>>2]=1022;p=1022}v=b*.699999988079071;P=s[e+56>>2]|0;v=(P|0)>2?v*.5:v;He(g|0);I=c;x=p;v=(P|0)>8?0:(P|0)>4?v*.5:v}w=s[I>>2]|0;P=x-w|0;b=(((P|0)>-1?P:0-P|0)*10|0)>(x|0)?.4000000059604645:.20000000298023224;if((d|0)>=25){if((d|0)<35)k=11}else{b=b+.10000000149011612;k=11}if((k|0)==11)b=b+.10000000149011612;P=e+108|0;m=+f[P>>2];b=m>.4000000059604645?b+-.10000000149011612:b;b=m>.550000011920929?b+-.10000000149011612:b;if(v<(b>.20000000298023224?b:.20000000298023224)){m=0;C=0;p=0}else{c=+H(+(v-m))<.10000000149011612;c=~~+G(+((c?m:v)*32/3+.5));p=c+-1|0;if((p|0)<=7)if((c|0)<1)p=0;else k=15;else{p=7;k=15}m=+(p+1|0)*.09375;C=1}S=y+44|0;M=O<<2;b=-m;R=e+112|0;y=y+60|0;E=(r|0)>1024;A=1024-r<<2;T=0-r|0;c=0;while(1){d=s[S>>2]|0;k=d-O|0;s[I>>2]=(w|0)>15?w:15;w=t+((te(c,N)|0)<<2)|0;g=e+212+((te(c,O)|0)<<2)|0;Sr(w|0,g|0,M|0)|0;if((d|0)==(O|0))d=s[L+(c<<2)>>2]|0;else{d=s[L+(c<<2)>>2]|0;B=s[I>>2]|0;v=-+f[P>>2];_=s[R>>2]|0;As(w+(O<<2)|0,d+4096|0,B,B,k,v,v,_,_,0,0)}_=d+4096|0;As(w+(O<<2)+(k<<2)|0,_+(k<<2)|0,s[I>>2]|0,x,r-k|0,-+f[P>>2],b,s[R>>2]|0,o,s[y>>2]|0,O);Sr(g|0,w+(r<<2)|0,M|0)|0;w=i+(c<<10<<2)|0;if(E)Sr(w|0,d+(r<<2)|0,4096)|0;else{Mr(w|0,w+(r<<2)|0,A|0)|0;Sr(w+4096+(T<<2)|0,_|0,D|0)|0}c=c+1|0;if((c|0)>=(n|0))break;w=s[I>>2]|0}f[l>>2]=m;s[a>>2]=x;s[h>>2]=p;u=U;return C|0}function ei(e,t,i,n,r){e=e|0;t=t|0;i=i|0;n=n|0;r=r|0;var a=0,l=0,h=0,c=0,d=0,p=0,b=0,w=0,m=0,g=0,_=0,v=0,k=0,y=0,E=0,A=0,T=0,S=0;E=u;p=u;u=u+((1*(t<<2)|0)+15&-16)|0;b=(t|0)/2|0;w=+(b|0);m=+(b|0);g=b+-5|0;_=(b*6|0)+-102|0;v=0;k=0;while(1){if((v|0)>=(i|0))break;h=te(v,t)|0;c=0;a=0;l=0;while(1){if((c|0)>=(t|0))break;A=+f[e+(c+h<<2)>>2];d=a+A;f[p+(c<<2)>>2]=d;c=c+1|0;a=l+d-A*2;l=A-d*.5}h=p;c=h+48|0;do{s[h>>2]=0;h=h+4|0}while((h|0)<(c|0));h=0;d=0;a=0;while(1){if((h|0)>=(b|0)){h=b;l=0;break}c=h<<1;A=+f[p+(c<<2)>>2];l=+f[p+((c|1)<<2)>>2];l=A*A+l*l;A=a+(l-a)*.0625;f[p+(h<<2)>>2]=A;h=h+1|0;d=d+l;a=A}e:while(1){c=h;a=l;while(1){h=c+-1|0;if((c|0)<=0)break e;c=p+(h<<2)|0;a=a+(+f[c>>2]-a)*.125;f[c>>2]=a;if(l>a)c=h;else{l=a;continue e}}}a=m/(+z(+(d*l*.5*w))+1.0000000036274937e-15)*64;h=12;c=0;while(1){if((h|0)>=(g|0))break;A=+G(+(a*(+f[p+(h<<2)>>2]+1.0000000036274937e-15)));S=A>127;T=A<0&(S^1);h=h+4|0;c=c+(o[28075+~~(T|S?T?0:127:A)>>0]|0)|0}h=(c<<8|0)/(_|0)|0;if((h|0)>(k|0))s[r>>2]=v;else h=k;v=v+1|0;k=h}h=(k|0)>200&1;a=+z(+ +(k*27|0))+-42;if(!(a<0))if(a>163)l=163;else y=20;else{a=0;y=20}if((y|0)==20)l=a;if(l*.006899999920278788+-.139<0){A=0;A=+z(+A);f[n>>2]=A;u=E;return h|0}A=(a>163?163:a)*.006899999920278788+-.139;A=+z(+A);f[n>>2]=A;u=E;return h|0}function ti(e,t,i,n,r,o,a,l){e=e|0;t=t|0;i=i|0;n=n|0;r=r|0;o=o|0;a=a|0;l=l|0;var h=0,u=0,c=0,d=0,p=0,b=0,w=0,m=0,g=0,_=0,v=0;w=s[e+4>>2]|0;b=(t|0)==0;_=s[e+44>>2]<<(b?a:0);g=b?1:t;b=(s[e+36>>2]|0)-(b?a:0)|0;p=e+64|0;m=te(g,_)|0;d=m+w|0;t=e+60|0;c=0;do{a=i+((te(c,d)|0)<<2)|0;e=te(te(c,_)|0,g)|0;h=0;while(1){if((h|0)>=(g|0))break;v=a+((te(h,_)|0)<<2)|0;di(p,v,n+(h+e<<2)|0,s[t>>2]|0,w,b,g);h=h+1|0}c=c+1|0}while((c|0)<(o|0));e:do if((o|0)==2&(r|0)==1){t=0;while(1){if((t|0)>=(m|0))break e;v=n+(t<<2)|0;f[v>>2]=+f[v>>2]*.5+ +f[n+(m+t<<2)>>2]*.5;t=t+1|0}}while(0);if((l|0)==1)return;c=(m|0)/(l|0)|0;u=+(l|0);t=m-c<<2;e=0;do{a=te(te(e,g)|0,_)|0;h=0;while(1){if((h|0)>=(c|0))break;v=n+(a+h<<2)|0;f[v>>2]=+f[v>>2]*u;h=h+1|0}yr(n+(a+c<<2)|0,0,t|0)|0;e=e+1|0}while((e|0)<(r|0));return}function ii(e,t,i,o,a,l,h,c,d,p){e=e|0;t=t|0;i=i|0;o=o|0;a=a|0;l=l|0;h=h|0;c=c|0;d=+d;p=p|0;var b=0,w=0,m=0,g=0,_=0,v=0,k=0,y=0,E=0,A=0,T=0,S=0,M=0,R=0,C=0,P=0,x=0,I=0,O=0,N=0,D=0,L=0,U=0,B=0,j=0,F=0,G=0,z=0,q=0;F=u;u=u+16|0;D=F;O=.5-d;O=(O<-.25?-.25:O)*.03999999910593033;U=u;u=u+((1*(t<<2)|0)+15&-16)|0;I=s[e+32>>2]|0;L=t+-1|0;B=(r[I+(t<<1)>>1]|0)-(r[I+(L<<1)>>1]|0)<=(t|0))break;R=y+1|0;e=r[I+(y<<1)>>1]|0;C=(r[I+(R<<1)>>1]|0)-e|0;k=C<=(k|0))break;d=d+ +H(+ +f[P+(e<<2)>>2]);e=e+1|0}_=d+(N?0:+(c|0))*O*d;if(!(N|C)){Sr(x|0,P|0,h|0)|0;e=k>>c>>1;h=0;while(1){if((h|0)<(A|0))p=0;else{d=0;e=0;break}while(1){if((p|0)>=(e|0))break;g=x+((te(T,p)|0)+h<<2)|0;G=+f[g>>2]*.7071067690849304;v=x+(((p<<1|1)<>2]*.7071067690849304;f[g>>2]=G+d;f[v>>2]=G-d;p=p+1|0}h=h+1|0}while(1){if((e|0)>=(k|0))break;d=d+ +H(+ +f[x+(e<<2)>>2]);e=e+1|0}d=d+S*d;if(d<_){g=-1;v=0}else{d=_;g=0;v=0}}else{d=_;g=0;v=0}while(1){if((v|0)>=(((C|N^1)&1^1)+c|0))break;m=N?v+1|0:c-v+-1|0;e=1<>v>>1;p=e<<1;b=0;while(1){if((b|0)<(e|0))w=0;else{_=0;e=0;break}while(1){if((w|0)>=(h|0))break;q=P+((te(p,w)|0)+b<<2)|0;_=+f[q>>2]*.7071067690849304;z=P+(((w<<1|1)<>2]*.7071067690849304;f[q>>2]=_+G;f[z>>2]=_-G;w=w+1|0}b=b+1|0}while(1){if((e|0)>=(k|0))break;_=_+ +H(+ +f[P+(e<<2)>>2]);e=e+1|0}G=_+ +(m|0)*O*_;z=G>2]=h;if(!C){y=R;continue}if(!((h|0)==0|(h|0)==(M|0))){y=R;continue}s[e>>2]=h+-1;y=R}g=i<<2;m=0;while(1){if((m|0)==2)break;h=g+(m<<1)|0;e=27892+(c<<3)+h|0;h=(h|1)+(27892+(c<<3))|0;p=0;b=N?a:0;w=1;while(1){if((w|0)>=(t|0))break;l=b+a|0;z=p+a|0;q=s[U+(w<<2)>>2]|0;i=q-(n[e>>0]<<1)|0;q=q-(n[h>>0]<<1)|0;p=((p|0)<(l|0)?p:l)+((i|0)>-1?i:0-i|0)|0;b=((z|0)<(b|0)?z:b)+((q|0)>-1?q:0-q|0)|0;w=w+1|0}s[D+(m<<2)>>2]=(p|0)<(b|0)?p:b;m=m+1|0}m=N?0:(s[D+4>>2]|0)<(s[D>>2]|0)&1;p=g|m<<1;w=27892+(c<<3)+p|0;p=(p|1)+(27892+(c<<3))|0;b=0;e=N?a:0;h=1;while(1){if((h|0)>=(t|0))break;N=e+a|0;i=(b|0)<(N|0);s[B+(h<<2)>>2]=i&1^1;z=b+a|0;c=(z|0)<(e|0);s[j+(h<<2)>>2]=c&1^1;q=s[U+(h<<2)>>2]|0;D=q-(n[w>>0]<<1)|0;q=q-(n[p>>0]<<1)|0;b=(i?b:N)+((D|0)>-1?D:0-D|0)|0;e=(c?z:e)+((q|0)>-1?q:0-q|0)|0;h=h+1|0}h=(b|0)>=(e|0)&1;s[o+(L<<2)>>2]=h;e=t+-2|0;while(1){if((e|0)<=-1)break;q=s[((h|0)==1?j:B)+(e+1<<2)>>2]|0;s[o+(e<<2)>>2]=q;h=q;e=e+-1|0}u=F;return m|0}function ni(e,t,i,n,o,a,l,h,c,p,b,w,m,g,_,v,k,y){e=e|0;t=t|0;i=i|0;n=n|0;o=o|0;a=a|0;l=l|0;h=h|0;c=c|0;p=p|0;b=b|0;w=w|0;m=m|0;g=g|0;_=_|0;v=v|0;k=k|0;y=y|0;var E=0,A=0,T=0,S=0,M=0,R=0,C=0,P=0,x=0,I=0,O=0,N=0,D=0,L=0,U=0,B=0,j=0,F=0,G=0,H=0,z=0,q=0,W=0,V=0,Y=0;W=u;F=te(a,i)|0;z=u;u=u+((1*(F<<2)|0)+15&-16)|0;G=u;u=u+((1*(F<<2)|0)+15&-16)|0;yr(l|0,0,i<<2|0)|0;E=+(9-h|0);h=0;while(1){if((h|0)>=(o|0)){c=0;E=-31.899999618530273;break}F=h+5|0;f[G+(h<<2)>>2]=+(r[c+(h<<1)>>1]|0)*.0625+.5+E-+f[17220+(h<<2)>>2]+ +(te(F,F)|0)*.006200000178068876;h=h+1|0}while(1){h=te(c,i)|0;A=0;H=E;while(1){if((A|0)>=(o|0))break;L=+f[e+(h+A<<2)>>2]-+f[G+(A<<2)>>2];A=A+1|0;H=H>L?H:L}c=c+1|0;if((c|0)>=(a|0))break;else E=H}if(!((_|0)>50&(g|0)>0&(k|0)==0)){q=0;s[v>>2]=q;u=W;return+H}U=o+-2|0;B=o+-1|0;F=0;h=0;while(1){S=te(F,i)|0;j=z+(S<<2)|0;T=t+(S<<2)|0;c=s[T>>2]|0;s[j>>2]=c;L=(s[d>>2]=c,+f[d>>2]);E=L;c=1;C=h;while(1){if((c|0)>=(o|0)){c=C;break}k=S+c|0;D=+f[t+(k<<2)>>2];k=D>+f[t+(k+-1<<2)>>2]+.5?c:C;D=E+1.5>2]=D;E=D;c=c+1|0;C=k}while(1){h=c+-1|0;if((c|0)<=0){k=2;break}k=j+(h<<2)|0;O=+f[k>>2];N=+f[j+(c<<2)>>2]+2;D=+f[t+(S+h<<2)>>2];A=N>2]=O<(A?N:D)?O:A?N:D;c=h}while(1){if((k|0)>=(U|0))break;A=j+(k<<2)|0;x=+f[A>>2];c=t+(S+k+-2<<2)|0;E=+f[c+8>>2];I=+f[c>>2];O=+f[c+4>>2];h=I>O;V=h?I:O;M=h?O:I;N=+f[c+12>>2];D=+f[c+16>>2];c=N>D;R=c?D:N;P=c?N:D;Y=M>R;R=Y?M:R;M=Y?P:V;P=Y?V:P;do if(E>M)if(MM+-1)E=x;else{V=h?I:O;M=h?O:I;R=c?D:N;P=c?N:D;Y=M>R;R=Y?M:R;M=Y?P:V;P=Y?V:P;do if(E>M)if(M>2]=E;k=k+1|0}R=+f[T+4>>2];Y=L>R;E=Y?R:L;R=Y?L:R;M=+f[T+8>>2];if(!(R>2];f[j>>2]=M>R?M:R;Y=j+4|0;M=+f[Y>>2];f[Y>>2]=M>R?M:R;Y=t+(S+o+-3<<2)|0;R=+f[Y>>2];M=+f[Y+4>>2];S=R>M;E=S?M:R;M=S?R:M;R=+f[Y+8>>2];if(!(M>2];f[h>>2]=L>V?L:V;h=j+(B<<2)|0;L=+f[h>>2];f[h>>2]=L>V?L:V;h=0;while(1){if((h|0)>=(o|0))break;Y=j+(h<<2)|0;L=+f[Y>>2];V=+f[G+(h<<2)>>2];f[Y>>2]=L>V?L:V;h=h+1|0}F=F+1|0;if((F|0)>=(a|0))break;else h=C}e:do if((a|0)==2){h=n;while(1){if((h|0)>=(o|0)){h=n;break e}G=h+i|0;t=z+(G<<2)|0;V=+f[t>>2];Y=z+(h<<2)|0;L=+f[Y>>2]+-4;L=V>L?V:L;f[t>>2]=L;V=+f[Y>>2];L=L+-4;L=V>L?V:L;f[Y>>2]=L;L=+f[e+(h<<2)>>2]-L;V=+f[e+(G<<2)>>2]-+f[t>>2];f[Y>>2]=((L<0?0:L)+(V<0?0:V))*.5;h=h+1|0}}else{h=n;while(1){if((h|0)>=(o|0)){h=n;break e}Y=z+(h<<2)|0;V=+f[e+(h<<2)>>2]-+f[Y>>2];f[Y>>2]=V<0?0:V;h=h+1|0}}while(0);while(1){if((h|0)>=(o|0))break;Y=z+(h<<2)|0;L=+f[Y>>2];V=+f[y+(h<<2)>>2];f[Y>>2]=L>V?L:V;h=h+1|0}C=(b|0)==0;e:do if((C|(w|0)!=0)&(p|0)==0){h=n;while(1){if((h|0)>=(o|0))break e;Y=z+(h<<2)|0;f[Y>>2]=+f[Y>>2]*.5;h=h+1|0}}while(0);S=(_|0)/4|0;T=(w|0)==0;h=0;while(1){if((n|0)>=(o|0)){q=76;break}if((n|0)>=8){c=z+(n<<2)|0;E=+f[c>>2];if((n|0)>11){E=E*.5;f[c>>2]=E}}else{c=z+(n<<2)|0;E=+f[c>>2]*2;f[c>>2]=E}E=E<4?E:4;f[c>>2]=E;k=n+1|0;c=(te((r[m+(k<<1)>>1]|0)-(r[m+(n<<1)>>1]|0)|0,a)|0)<=6)if((c|0)>48){Y=~~(E*8);A=Y;c=((te(Y,c)|0)<<3|0)/8|0;break}else{c=~~(E*+(c|0)/6);A=c;c=c*48|0;break}else{Y=~~E;A=Y;c=(te(Y,c)|0)<<3}while(0);if(!((T|(p|0)!=0)&(C^1))?(h+c>>6|0)>(S|0):0)break;s[l+(n<<2)>>2]=A;n=k;h=h+c|0}if((q|0)==76){s[v>>2]=h;u=W;return+H}Y=S<<6;s[l+(n<<2)>>2]=Y-h;s[v>>2]=Y;u=W;return+H}function ri(e,t,i){e=e|0;t=t|0;i=i|0;var n=0,r=0,o=0,a=0;o=u;u=u+16|0;n=o;s[n>>2]=i;do switch(t|0){case 10010:{r=(s[n>>2]|0)+(4-1)&~(4-1);t=s[r>>2]|0;s[n>>2]=r+4;if((t|0)>=0?(t|0)<(s[(s[e>>2]|0)+8>>2]|0):0){s[e+20>>2]=t;t=25}else t=26;break}case 10012:{r=(s[n>>2]|0)+(4-1)&~(4-1);t=s[r>>2]|0;s[n>>2]=r+4;if((t|0)>=1?(t|0)<=(s[(s[e>>2]|0)+8>>2]|0):0){s[e+24>>2]=t;t=25}else t=26;break}case 10008:{r=(s[n>>2]|0)+(4-1)&~(4-1);t=s[r>>2]|0;s[n>>2]=r+4;if((t+-1|0)>>>0>1)t=26;else{s[e+12>>2]=t;t=25}break}case 10007:{r=(s[n>>2]|0)+(4-1)&~(4-1);t=s[r>>2]|0;s[n>>2]=r+4;if(!t)t=26;else{e=e+40|0;s[t>>2]=s[e>>2];s[e>>2]=0;t=25}break}case 4027:{r=(s[n>>2]|0)+(4-1)&~(4-1);t=s[r>>2]|0;s[n>>2]=r+4;if(!t)t=26;else{s[t>>2]=(s[e+4>>2]|0)/(s[e+16>>2]|0)|0;t=25}break}case 4028:{r=s[e+8>>2]|0;t=e+88+((te((s[e+4>>2]|0)+2048|0,r)|0)<<2)+(r*24<<2)|0;a=s[e>>2]|0;n=s[a+8>>2]|0;i=n<<1;t=t+(i<<2)|0;i=t+(i<<2)|0;yr(e+36|0,0,((te((s[a+4>>2]|0)+2048|0,r)|0)<<2)+88+(r*96|0)+(n<<5)+-36|0)|0;r=0;while(1){if((r|0)>=(n<<1|0))break;f[i+(r<<2)>>2]=-28;f[t+(r<<2)>>2]=-28;n=s[(s[e>>2]|0)+8>>2]|0;r=r+1|0}s[e+52>>2]=1;t=25;break}case 4033:{a=(s[n>>2]|0)+(4-1)&~(4-1);t=s[a>>2]|0;s[n>>2]=a+4;if(!t)t=26;else{s[t>>2]=s[e+56>>2];t=25}break}case 10015:{a=(s[n>>2]|0)+(4-1)&~(4-1);t=s[a>>2]|0;s[n>>2]=a+4;if(!t)t=26;else{s[t>>2]=s[e>>2];t=25}break}case 10016:{a=(s[n>>2]|0)+(4-1)&~(4-1);t=s[a>>2]|0;s[n>>2]=a+4;s[e+28>>2]=t;t=25;break}case 4031:{a=(s[n>>2]|0)+(4-1)&~(4-1);t=s[a>>2]|0;s[n>>2]=a+4;if(!t)t=26;else{s[t>>2]=s[e+36>>2];t=25}break}default:{u=o;return}}while(0);if((t|0)==25){u=o;return}else if((t|0)==26){u=o;return}}function si(e,t,i,a,l,h,c){e=e|0;t=t|0;i=i|0;a=a|0;l=l|0;h=h|0;c=c|0;var d=0,p=0,b=0,w=0,m=0,g=0,_=0,v=0,k=0,y=0,E=0,A=0,T=0,S=0,M=0,R=0,C=0,P=0,x=0,I=0,O=0,N=0,D=0,L=0,U=0,B=0,j=0,F=0,G=0,H=0,q=0,W=0,V=0,Y=0,Z=0,$=0,K=0,X=0,Q=0,ee=0,ie=0,re=0,se=0,oe=0,ae=0,le=0,fe=0,he=0,ue=0,ce=0,de=0,pe=0,be=0,we=0,me=0,ge=0,_e=0,ve=0,ke=0,ye=0,Ee=0,Ae=0,Te=0,Se=0,Me=0,Re=0,Ce=0,Pe=0,xe=0,Ie=0;Ie=u;u=u+96|0;D=Ie;M=Ie+40|0;Q=Ie+32|0;xe=Ie+24|0;re=Ie+16|0;ie=Ie+12|0;ee=Ie+8|0;Te=s[e+8>>2]|0;s[re>>2]=0;s[ie>>2]=0;ce=s[e+12>>2]|0;Ce=s[e>>2]|0;he=Ce+8|0;Pe=s[he>>2]|0;we=s[Ce+4>>2]|0;ue=Ce+32|0;H=s[ue>>2]|0;Se=s[e+20>>2]|0;Me=s[e+24>>2]|0;Re=e+16|0;ke=te(s[Re>>2]|0,l)|0;p=we+2048|0;ye=e+88+((te(p,Te)|0)<<2)+(Te*24<<2)|0;ge=Pe<<1;Ee=ye+(ge<<2)|0;Ae=Ee+(ge<<2)|0;me=Ae+(ge<<2)|0;be=Ce+44|0;l=s[Ce+36>>2]|0;de=0;while(1){if((de|0)>(l|0)){l=-1;L=268;break}if((s[be>>2]<>>0>1275|(a|0)==0){e=-1;u=Ie;return e|0}ve=s[be>>2]<>2]=_e;s[xe+(d<<2)>>2]=_e+8192+(l<<2);d=d+1|0}while((d|0)<(Te|0));fe=s[Ce+12>>2]|0;fe=(Me|0)>(fe|0)?fe:Me;if((t|0)==0|(i|0)<2){oi(e,ve,de);li(xe,a,ve,Te,s[Re>>2]|0,Ce+16|0,e+80|0,c);e=(ke|0)/(s[Re>>2]|0)|0;u=Ie;return e|0}_e=e+48|0;s[e+52>>2]=(s[_e>>2]|0)!=0&1;e:do if(!h){s[M>>2]=t;s[M+4>>2]=i;s[M+8>>2]=0;s[M+12>>2]=0;s[M+16>>2]=0;_=M+20|0;s[_>>2]=9;v=M+24|0;s[v>>2]=0;k=M+28|0;s[k>>2]=128;if(!i){l=0;d=0}else{s[v>>2]=1;l=1;d=o[t>>0]|0}y=M+40|0;s[y>>2]=d;g=d>>>1^127;E=M+32|0;s[E>>2]=g;s[M+44>>2]=0;p=128;h=9;while(1){if(p>>>0>=8388609){h=M;break e}h=h+8|0;s[_>>2]=h;p=p<<8;s[k>>2]=p;if(l>>>0>>0){w=l+1|0;s[v>>2]=w;m=o[t+l>>0]|0}else{w=l;m=0}s[y>>2]=m;le=((d<<8|m)>>>1&255|g<<8&2147483392)^255;s[E>>2]=le;l=w;d=m;g=le}}while(0);se=(ce|0)==1;e:do if(se){l=0;while(1){if((l|0)>=(Pe|0))break e;le=ye+(l<<2)|0;I=+f[le>>2];O=+f[ye+(Pe+l<<2)>>2];f[le>>2]=I>O?I:O;l=l+1|0}}while(0);oe=i<<3;ae=h+20|0;l=s[ae>>2]|0;le=h+28|0;m=s[le>>2]|0;p=l+((ne(m|0)|0)+-32)|0;if((p|0)<(oe|0))if((p|0)==1){y=h+32|0;p=s[y>>2]|0;w=m>>>15;E=p>>>0>>0;d=E&1;if(!E){p=p-w|0;s[y>>2]=p;w=m-w|0}s[le>>2]=w;_=h+40|0;v=h+24|0;k=h+4|0;while(1){if(w>>>0>=8388609)break;l=l+8|0;s[ae>>2]=l;w=w<<8;s[le>>2]=w;g=s[_>>2]|0;m=s[v>>2]|0;if(m>>>0<(s[k>>2]|0)>>>0){s[v>>2]=m+1;m=o[(s[h>>2]|0)+m>>0]|0}else m=0;s[_>>2]=m;X=((g<<8|m)>>>1&255|p<<8&2147483392)^255;s[y>>2]=X;p=X}if(E){p=w;L=31}else{d=0;p=1}}else{w=m;d=0}else{p=m;d=1;L=31}if((L|0)==31){l=l+(oe-(l+((ne(p|0)|0)+-32)))|0;s[ae>>2]=l;w=p;p=oe}if((Se|0)!=0|(p+16|0)>(oe|0)){X=0;K=0;b=0}else{N=h+32|0;p=s[N>>2]|0;m=w>>>1;_=p>>>0>>0;if(!_){p=p-m|0;s[N>>2]=p;m=w-m|0}s[le>>2]=m;C=h+40|0;P=h+24|0;x=h+4|0;while(1){if(m>>>0>=8388609)break;l=l+8|0;s[ae>>2]=l;m=m<<8;s[le>>2]=m;g=s[C>>2]|0;w=s[P>>2]|0;if(w>>>0<(s[x>>2]|0)>>>0){s[P>>2]=w+1;w=o[(s[h>>2]|0)+w>>0]|0}else w=0;s[C>>2]=w;X=((g<<8|w)>>>1&255|p<<8&2147483392)^255;s[N>>2]=X;p=X}if(_){M=hi(h,6)|0;k=16<>2]|0;R=h+16|0;p=s[R>>2]|0;if(p>>>0>>0){_=h+8|0;g=s[x>>2]|0;v=p+8|0;v=p+(((v|0)>25?v:25)+-1-p&-8)|0;w=s[_>>2]|0;do{if(w>>>0>>0){m=w+1|0;s[_>>2]=m;w=m;m=o[(s[h>>2]|0)+(g-m)>>0]|0}else m=0;l=l|m<>>y;w=m-y|0;s[t>>2]=p;s[R>>2]=w;E=(s[ae>>2]|0)+y|0;s[ae>>2]=E;l=k+(l&(1<>>0<3){k=h+8|0;v=s[x>>2]|0;_=m+4-M|0;_=m+(M+((_|0)>25?_:25)+3-m&-8)+4|0;m=s[k>>2]|0;do{if(m>>>0>>0){g=m+1|0;s[k>>2]=g;m=g;g=o[(s[h>>2]|0)+(v-g)>>0]|0}else g=0;p=p|g<>2]=p>>>3;s[R>>2]=w+-3;w=E+3|0;s[ae>>2]=w;m=s[le>>2]|0;e:do if((w+((ne(m|0)|0)+-32)+2|0)>(oe|0))p=0;else{_=s[N>>2]|0;v=m>>>2;p=-1;while(1){p=p+1|0;g=te(v,o[29345+p>>0]|0)|0;if(_>>>0>=g>>>0)break;else m=g}v=_-g|0;s[N>>2]=v;m=m-g|0;s[le>>2]=m;while(1){if(m>>>0>=8388609)break e;w=w+8|0;s[ae>>2]=w;m=m<<8;s[le>>2]=m;_=s[C>>2]|0;g=s[P>>2]|0;if(g>>>0<(s[x>>2]|0)>>>0){s[P>>2]=g+1;g=o[(s[h>>2]|0)+g>>0]|0}else g=0;s[C>>2]=g;X=((_<<8|g)>>>1&255|v<<8&2147483392)^255;s[N>>2]=X;v=X}}while(0);g=w;b=+(k+1|0)*.09375}else{g=l;b=0;l=0;p=0}X=l;K=p;l=g;w=m;p=g+((ne(m|0)|0)+-32)|0}G=(de|0)>0;if(!((p+3|0)>(oe|0)|G^1)){y=h+32|0;p=s[y>>2]|0;m=w>>>3;E=p>>>0>>0;M=E&1;if(E)w=m;else{p=p-m|0;s[y>>2]=p;w=w-m|0}s[le>>2]=w;_=h+40|0;v=h+24|0;k=h+4|0;while(1){if(w>>>0>=8388609)break;l=l+8|0;s[ae>>2]=l;w=w<<8;s[le>>2]=w;g=s[_>>2]|0;m=s[v>>2]|0;if(m>>>0<(s[k>>2]|0)>>>0){s[v>>2]=m+1;m=o[(s[h>>2]|0)+m>>0]|0}else m=0;s[_>>2]=m;$=((g<<8|m)>>>1&255|p<<8&2147483392)^255;s[y>>2]=$;p=$}p=l+((ne(w|0)|0)+-32)|0;if(E)Z=pe;else L=72}else L=72;if((L|0)==72){M=0;Z=0}if((p+3|0)<=(oe|0)){y=h+32|0;p=s[y>>2]|0;m=w>>>3;v=p>>>0>>0;t=v&1;if(!v){p=p-m|0;s[y>>2]=p;m=w-m|0}s[le>>2]=m;k=h+40|0;w=h+24|0;E=h+4|0;while(1){if(m>>>0>=8388609)break;l=l+8|0;s[ae>>2]=l;m=m<<8;s[le>>2]=m;_=s[k>>2]|0;g=s[w>>2]|0;if(g>>>0<(s[E>>2]|0)>>>0){s[w>>2]=g+1;g=o[(s[h>>2]|0)+g>>0]|0}else g=0;s[k>>2]=g;$=((_<<8|g)>>>1&255|p<<8&2147483392)^255;s[y>>2]=$;p=$}$=D;s[$>>2]=0;s[$+4>>2]=0;if(v){l=y;p=k;m=h;$=E;F=t;A=.149993896484375;T=0;_=D}else{g=E;l=y;p=k;m=h;_=D;L=83}}else{g=D;s[g>>2]=0;s[g+4>>2]=0;g=h+4|0;l=h+32|0;p=h+40|0;w=h+24|0;m=h;_=D;L=83}if((L|0)==83){$=g;F=0;A=+f[17320+(de<<2)>>2];T=+f[17336+(de<<2)>>2]}D=s[$>>2]<<3;L=h+36|0;j=Se;while(1){if((j|0)>=(Me|0))break;U=(j|0)<20;B=0;do{k=s[ae>>2]|0;N=s[le>>2]|0;g=k+((ne(N|0)|0)+-32)|0;v=D-g|0;e:do if((v|0)<=14){if((v|0)>1){y=s[l>>2]|0;E=N>>>2;t=-1;v=N;while(1){t=t+1|0;g=te(E,o[29345+t>>0]|0)|0;if(y>>>0>=g>>>0)break;else v=g}E=y-g|0;s[l>>2]=E;v=v-g|0;s[le>>2]=v;g=k;while(1){if(v>>>0>=8388609)break;g=g+8|0;s[ae>>2]=g;v=v<<8;s[le>>2]=v;y=s[p>>2]|0;k=s[w>>2]|0;if(k>>>0<(s[$>>2]|0)>>>0){s[w>>2]=k+1;k=o[(s[m>>2]|0)+k>>0]|0}else k=0;s[p>>2]=k;Y=((y<<8|k)>>>1&255|E<<8&2147483392)^255;s[l>>2]=Y;E=Y}g=t>>1^0-(t&1);break}if((D|0)>(g|0)){v=s[l>>2]|0;g=N>>>1;t=v>>>0>>0;if(!t){v=v-g|0;s[l>>2]=v;g=N-g|0}s[le>>2]=g;while(1){if(g>>>0>=8388609)break;k=k+8|0;s[ae>>2]=k;g=g<<8;s[le>>2]=g;E=s[p>>2]|0;y=s[w>>2]|0;if(y>>>0<(s[$>>2]|0)>>>0){s[w>>2]=y+1;y=o[(s[m>>2]|0)+y>>0]|0}else y=0;s[p>>2]=y;Y=((E<<8|y)>>>1&255|v<<8&2147483392)^255;s[l>>2]=Y;v=Y}g=t<<31>>31}else g=-1}else{R=(U?j:20)<<1;g=o[29009+(de*84|0)+(F*42|0)+R>>0]<<7;R=o[(R|1)+(29009+(de*84|0)+(F*42|0))>>0]<<6;P=N>>>15;s[L>>2]=P;x=s[l>>2]|0;C=(x>>>0)/(P>>>0)|0;Y=C+1|0;C=32768-(Y+(Y>>>0>32768?32767-C|0:0))|0;if(C>>>0>>0){y=g;v=0;g=0}else{v=te(32736-g|0,16384-R|0)|0;E=1;while(1){Y=v>>>15;y=Y+1|0;if(!Y)break;v=y<<1;t=g+v|0;if(C>>>0>>0)break;v=te(v+-2|0,R)|0;g=t;E=E+1|0}if(y>>>0<2){Y=(C-g|0)>>>1;g=g+(Y<<1)|0;E=E+Y|0}v=g+y|0;Y=C>>>0>>0;v=Y?g:v;g=Y?0-E|0:E}y=v+y|0;y=y>>>0<32768?y:32768;Y=te(P,32768-y|0)|0;t=x-Y|0;s[l>>2]=t;y=te(P,y-v|0)|0;y=(v|0)==0?N-Y|0:y;s[le>>2]=y;v=k;while(1){if(y>>>0>=8388609)break e;v=v+8|0;s[ae>>2]=v;y=y<<8;s[le>>2]=y;E=s[p>>2]|0;k=s[w>>2]|0;if(k>>>0<(s[$>>2]|0)>>>0){s[w>>2]=k+1;k=o[(s[m>>2]|0)+k>>0]|0}else k=0;s[p>>2]=k;Y=((E<<8|k)>>>1&255|t<<8&2147483392)^255;s[l>>2]=Y;t=Y}}while(0);O=+(g|0);V=ye+(j+(te(B,s[he>>2]|0)|0)<<2)|0;I=+f[V>>2];f[V>>2]=I<-9?-9:I;V=ye+(j+(te(B,s[he>>2]|0)|0)<<2)|0;Y=_+(B<<2)|0;f[V>>2]=T*+f[V>>2]+ +f[Y>>2]+O;f[Y>>2]=+f[Y>>2]+O-A*O;B=B+1|0}while((B|0)<(ce|0));j=j+1|0}Y=Ne()|0;V=u;u=u+((1*(Pe<<2)|0)+15&-16)|0;j=s[$>>2]|0;g=j<<3;v=s[ae>>2]|0;k=s[le>>2]|0;E=v+((ne(k|0)|0)+-32)|0;_=(M|0)!=0;y=_?2:4;if(G)N=(E+y+1|0)>>>0<=g>>>0;else N=0;x=g-(N&1)|0;P=_?4:5;R=0;C=Se;g=E;t=0;while(1){if((C|0)>=(Me|0))break;if((g+y|0)>>>0>x>>>0){E=R;_=t}else{_=s[l>>2]|0;g=k>>>y;W=_>>>0>>0;E=W&1;if(!W){_=_-g|0;s[l>>2]=_;g=k-g|0}s[le>>2]=g;y=v;while(1){if(g>>>0>=8388609)break;y=y+8|0;s[ae>>2]=y;g=g<<8;s[le>>2]=g;k=s[p>>2]|0;v=s[w>>2]|0;if(v>>>0>>0){s[w>>2]=v+1;v=o[(s[m>>2]|0)+v>>0]|0}else v=0;s[p>>2]=v;W=((k<<8|v)>>>1&255|_<<8&2147483392)^255;s[l>>2]=W;_=W}_=R^E;v=y;k=g;E=_;g=y+((ne(g|0)|0)+-32)|0;_=t|_}s[V+(C<<2)>>2]=E;R=E;C=C+1|0;y=P;t=_}R=M<<2;if(N?(n[R+t+(27892+(de<<3))>>0]|0)!=(n[(R|2)+t+(27892+(de<<3))>>0]|0):0){_=s[l>>2]|0;g=k>>>1;W=_>>>0>>0;t=W&1;if(!W){_=_-g|0;s[l>>2]=_;g=k-g|0}s[le>>2]=g;while(1){if(g>>>0>=8388609)break;v=v+8|0;s[ae>>2]=v;g=g<<8;s[le>>2]=g;y=s[p>>2]|0;k=s[w>>2]|0;if(k>>>0>>0){s[w>>2]=k+1;k=o[(s[m>>2]|0)+k>>0]|0}else k=0;s[p>>2]=k;W=((y<<8|k)>>>1&255|_<<8&2147483392)^255;s[l>>2]=W;_=W}E=g;g=t<<1}else{E=k;g=0}g=R+g|0;_=Se;while(1){if((_|0)>=(Me|0))break;W=V+(_<<2)|0;s[W>>2]=n[g+(s[W>>2]|0)+(27892+(de<<3))>>0];_=_+1|0}e:do if((v+((ne(E|0)|0)+-32)+4|0)>(oe|0)){g=v;_=E;t=2}else{k=s[l>>2]|0;y=E>>>5;t=-1;_=E;while(1){t=t+1|0;g=te(y,o[28203+t>>0]|0)|0;if(k>>>0>=g>>>0)break;else _=g}y=k-g|0;s[l>>2]=y;_=_-g|0;s[le>>2]=_;g=v;while(1){if(_>>>0>=8388609)break e;g=g+8|0;s[ae>>2]=g;v=_<<8;s[le>>2]=v;k=s[p>>2]|0;_=s[w>>2]|0;if(_>>>0>>0){s[w>>2]=_+1;_=o[(s[m>>2]|0)+_>>0]|0}else _=0;s[p>>2]=_;W=((k<<8|_)>>>1&255|y<<8&2147483392)^255;s[l>>2]=W;_=v;y=W}}while(0);B=u;u=u+((1*(Pe<<2)|0)+15&-16)|0;v=s[he>>2]|0;k=(de<<1)+ce+-1|0;y=Ce+104|0;E=0;while(1){if((E|0)>=(v|0))break;W=E+1|0;q=s[ue>>2]|0;G=(te(v,k)|0)+E|0;s[B+(E<<2)>>2]=(te(te((o[(s[y>>2]|0)+G>>0]|0)+64|0,ce)|0,(r[q+(W<<1)>>1]|0)-(r[q+(E<<1)>>1]|0)<>2;E=W}U=u;u=u+((1*(Pe<<2)|0)+15&-16)|0;G=i<<6;q=32-(ne(_|0)|0)|0;W=_>>>(q+-16|0);y=(W>>>12)+-8|0;R=g;D=6;L=Se;g=(g<<3)-((q<<3)+(y+(W>>>0>(s[5272+(y<<2)>>2]|0)>>>0&1)))|0;y=G;while(1){ -if((L|0)>=(Me|0))break;N=L+1|0;C=(te(ce,(r[H+(N<<1)>>1]|0)-(r[H+(L<<1)>>1]|0)|0)|0)<=(x|0))break;if((R|0)>=(s[P>>2]|0))break;g=s[l>>2]|0;k=_>>>k;E=g>>>0>>0;if(E)_=k;else{g=g-k|0;s[l>>2]=g;_=_-k|0}s[le>>2]=_;while(1){if(_>>>0>=8388609)break;v=v+8|0;s[ae>>2]=v;_=_<<8;s[le>>2]=_;y=s[p>>2]|0;k=s[w>>2]|0;if(k>>>0>>0){s[w>>2]=k+1;k=o[(s[m>>2]|0)+k>>0]|0}else k=0;s[p>>2]=k;W=((y<<8|k)>>>1&255|g<<8&2147483392)^255;s[l>>2]=W;g=W}q=32-(ne(_|0)|0)|0;W=_>>>(q+-16|0);g=(W>>>12)+-8|0;g=(v<<3)-((q<<3)+(g+(W>>>0>(s[5272+(g<<2)>>2]|0)>>>0&1)))|0;if(!E)break;R=R+C|0;k=1;x=x-C|0}s[U+(L<<2)>>2]=R;if((R|0)<=0){R=v;L=N;y=x;continue}R=v;D=(D|0)<3?2:D+-1|0;L=N;y=x}i=u;u=u+((1*(Pe<<2)|0)+15&-16)|0;e:do if((g+48|0)>(y|0)){p=R;l=_;w=5}else{v=s[l>>2]|0;k=_>>>7;E=-1;while(1){E=E+1|0;g=te(k,o[28207+E>>0]|0)|0;if(v>>>0>=g>>>0)break;else _=g}y=v-g|0;s[l>>2]=y;_=_-g|0;s[le>>2]=_;g=R;while(1){if(_>>>0>=8388609){p=g;l=_;w=E;break e}g=g+8|0;s[ae>>2]=g;v=_<<8;s[le>>2]=v;k=s[p>>2]|0;_=s[w>>2]|0;if(_>>>0>>0){s[w>>2]=_+1;_=o[(s[m>>2]|0)+_>>0]|0}else _=0;s[p>>2]=_;W=((k<<8|_)>>>1&255|y<<8&2147483392)^255;s[l>>2]=W;_=v;y=W}}while(0);q=32-(ne(l|0)|0)|0;W=l>>>(q+-16|0);l=(W>>>12)+-8|0;l=G+((q<<3)+(l+(W>>>0>(s[5272+(l<<2)>>2]|0)>>>0&1))-(p<<3))+-1|0;W=(M|0)==0;if((de|0)>1&(W^1))P=(l|0)>=((de<<3)+16|0);else P=0;x=P?8:0;q=u;u=u+((1*(Pe<<2)|0)+15&-16)|0;j=u;u=u+((1*(Pe<<2)|0)+15&-16)|0;C=Mi(Ce,Se,Me,U,B,w,re,ie,l-x|0,ee,q,i,j,ce,de,h,0,0,0)|0;N=h+12|0;D=h+16|0;L=h+8|0;R=Se;while(1){if((R|0)>=(Me|0))break;k=s[i+(R<<2)>>2]|0;if((k|0)>=1){y=(1<>2]|0;l=s[D>>2]|0;E=0;do{if(l>>>0>>0){_=l+8|0;v=((_|0)>25?_:25)+-1-l&-8;p=w;do{w=s[L>>2]|0;g=s[$>>2]|0;if(w>>>0>>0){w=w+1|0;s[L>>2]=w;w=o[(s[m>>2]|0)+(g-w)>>0]|0}else w=0;p=p|w<>>k;l=l-k|0;s[N>>2]=w;s[D>>2]=l;s[ae>>2]=(s[ae>>2]|0)+k;H=ye+(R+(te(E,s[he>>2]|0)|0)<<2)|0;f[H>>2]=+f[H>>2]+((+(p&y|0)+.5)*A*6103515625e-14+-.5);E=E+1|0}while((E|0)<(ce|0))}R=R+1|0}l=2048-ve+((we|0)/2|0)<<2;p=0;do{H=s[Q+(p<<2)>>2]|0;Mr(H|0,H+(ve<<2)|0,l|0)|0;p=p+1|0}while((p|0)<(Te|0));B=te(ce,Pe)|0;U=u;u=u+((1*B|0)+15&-16)|0;H=(te(ce,ve)|0)<<2;F=u;u=u+((1*H|0)+15&-16)|0;H=e+36|0;on(0,Ce,Se,Me,F,(ce|0)==2?F+(ve<<2)|0:0,U,0,q,Z,t,s[ie>>2]|0,s[re>>2]|0,V,G-x|0,s[ee>>2]|0,h,de,C,H,0,s[e+32>>2]|0);if(P){p=s[N>>2]|0;l=s[D>>2]|0;if(!l){g=s[$>>2]|0;w=s[L>>2]|0;_=0;do{if(w>>>0>>0){l=w+1|0;s[L>>2]=l;w=l;l=o[(s[m>>2]|0)+(g-l)>>0]|0}else l=0;p=p|l<<_;_=_+8|0}while((_|0)<25);l=32}s[N>>2]=p>>>1;s[D>>2]=l+-1;l=(s[ae>>2]|0)+1|0;s[ae>>2]=l;t=p&1}else{l=s[ae>>2]|0;t=0}p=oe-(l+((ne(s[le>>2]|0)|0)+-32))|0;E=0;while(1){if((E|0)==2)break;else y=Se;while(1){if(!((y|0)<(Me|0)&(p|0)>=(ce|0)))break;w=s[i+(y<<2)>>2]|0;do if((w|0)<=7){if((s[j+(y<<2)>>2]|0)!=(E|0))break;A=+(1<<14-w+-1|0);g=s[D>>2]|0;_=s[N>>2]|0;k=0;do{if(!g){v=0;while(1){w=s[L>>2]|0;g=s[$>>2]|0;if(w>>>0>>0){w=w+1|0;s[L>>2]=w;w=o[(s[m>>2]|0)+(g-w)>>0]|0}else w=0;w=_|w<=25){g=32;break}else _=w}}else w=_;_=w>>>1;g=g+-1|0;s[N>>2]=_;s[D>>2]=g;l=l+1|0;s[ae>>2]=l;re=ye+(y+(te(k,s[he>>2]|0)|0)<<2)|0;f[re>>2]=+f[re>>2]+(+(w&1|0)+-.5)*A*6103515625e-14;p=p+-1|0;k=k+1|0}while((k|0)<(ce|0))}while(0);y=y+1|0}E=E+1|0}e:do if(t|0){v=(de|0)==3;l=s[H>>2]|0;R=Se;t:while(1){if((R|0)>=(Me|0))break e;k=R+1|0;y=s[ue>>2]|0;y=(r[y+(k<<1)>>1]|0)-(r[y+(R<<1)>>1]|0)|0;I=+J(+(+(((((s[q+(R<<2)>>2]|0)+1|0)>>>0)/(y>>>0)|0)>>>de|0)*-.125*.6931471805599453))*.5;E=y<>2]|0;m=(te(p,w)|0)+R|0;T=+f[Ee+(m<<2)>>2];A=+f[Ae+(m<<2)>>2];do if(se){re=w+R|0;S=+f[Ee+(re<<2)>>2];T=T>S?T:S;S=+f[Ae+(re<<2)>>2];if(A>S)break;A=S}while(0);A=+f[ye+(m<<2)>>2]-(T>2]|0)+(R<<1)>>1]<=(pe|0))break;i:do if(!(o[g>>0]&1<=(y|0)){w=1;break i}re=(te(l,1664525)|0)+1013904223|0;f[_+((w<>2]=(re&32768|0)==0?T:A;l=re;w=w+1|0}}while(0);m=m+1|0}i:do if(w|0){w=0;A=0;while(1){if((w|0)>=(E|0))break;S=+f[_+(w<<2)>>2];w=w+1|0;A=A+S*S}A=1/+z(+(A+1.0000000036274937e-15));m=0;w=_;while(1){if((m|0)>=(E|0))break i;f[w>>2]=A*+f[w>>2];m=m+1|0;w=w+4|0}}while(0);p=p+1|0;if((p|0)>=(ce|0)){R=k;continue t}}}}while(0);e:do if(d|0){l=0;while(1){if((l|0)>=(B|0))break e;f[ye+(l<<2)>>2]=-28;l=l+1|0}}while(0);ai(Ce,F,xe,ye,Se,fe,ce,Te,M,de,s[Re>>2]|0,d);w=e+56|0;m=e+60|0;g=e+68|0;_=e+64|0;v=e+76|0;k=e+72|0;y=Ce+60|0;l=(de|0)==0;p=0;do{de=s[w>>2]|0;de=(de|0)>15?de:15;s[w>>2]=de;ce=s[m>>2]|0;ce=(ce|0)>15?ce:15;s[m>>2]=ce;d=s[xe+(p<<2)>>2]|0;As(d,d,ce,de,s[be>>2]|0,+f[g>>2],+f[_>>2],s[v>>2]|0,s[k>>2]|0,s[y>>2]|0,we);if(!l){de=s[be>>2]|0;ce=d+(de<<2)|0;As(ce,ce,s[w>>2]|0,X,ve-de|0,+f[_>>2],b,s[k>>2]|0,K,s[y>>2]|0,we)}p=p+1|0}while((p|0)<(Te|0));s[m>>2]=s[w>>2];s[g>>2]=s[_>>2];s[v>>2]=s[k>>2];s[w>>2]=X;f[_>>2]=b;s[k>>2]=K;if(!l){s[m>>2]=X;f[g>>2]=b;s[v>>2]=K}if(se)Sr(ye+(Pe<<2)|0,ye|0,Pe<<2|0)|0;e:do if(W){l=Pe<<3;Sr(Ae|0,Ee|0,l|0)|0;Sr(Ee|0,ye|0,l|0)|0;b=(s[_e>>2]|0)<10?+(pe|0)*.0010000000474974513:1;l=0;while(1){if((l|0)>=(ge|0)){p=0;break e}we=me+(l<<2)|0;I=+f[we>>2]+b;O=+f[ye+(l<<2)>>2];f[we>>2]=I=(ge|0)){p=0;break e}me=Ee+(l<<2)|0;I=+f[me>>2];O=+f[ye+(l<<2)>>2];f[me>>2]=I=(Se|0)){l=Me;break}ge=d+l|0;f[ye+(ge<<2)>>2]=0;f[Ae+(ge<<2)>>2]=-28;f[Ee+(ge<<2)>>2]=-28;l=l+1|0}while(1){if((l|0)>=(Pe|0))break;ge=d+l|0;f[ye+(ge<<2)>>2]=0;f[Ae+(ge<<2)>>2]=-28;f[Ee+(ge<<2)>>2]=-28;l=l+1|0}p=p+1|0}while((p|0)!=2);s[H>>2]=s[le>>2];li(xe,a,ve,Te,s[Re>>2]|0,Ce+16|0,e+80|0,c);s[_e>>2]=0;if(((s[ae>>2]|0)+((ne(s[le>>2]|0)|0)+-32)|0)>(oe|0))l=-3;else{if(s[h+44>>2]|0)s[e+40>>2]=1;l=(ke|0)/(s[Re>>2]|0)|0}He(Y|0);e=l;u=Ie;return e|0}function oi(e,t,i){e=e|0;t=t|0;i=i|0;var n=0,o=0,a=0,l=0,h=0,c=0,d=0,p=0,b=0,w=0,m=0,g=0,_=0,v=0,k=0,y=0,E=0,A=0,T=0,S=0,M=0,R=0,C=0,P=0,x=0,I=0,O=0,N=0,D=0,L=0,U=0,B=0,j=0,F=0,G=0,H=0,q=0,W=0,V=0,Y=0,Z=0,$=0,K=0,X=0;$=u;u=u+8512|0;h=$+8504|0;l=$+4408|0;Z=$+4400|0;T=$+4392|0;F=$+296|0;j=$+192|0;G=$+96|0;H=$;Y=s[e+8>>2]|0;S=s[e>>2]|0;d=s[S+8>>2]|0;V=s[S+4>>2]|0;A=s[S+32>>2]|0;n=V+2048|0;B=0-t|0;o=0;do{W=e+88+((te(o,n)|0)<<2)|0;s[Z+(o<<2)>>2]=W;s[T+(o<<2)>>2]=W+8192+(B<<2);o=o+1|0}while((o|0)<(Y|0));U=e+88+((te(n,Y)|0)<<2)|0;y=U+(Y*24<<2)|0;c=d<<1;c=y+(c<<2)+(c<<2)+(c<<2)|0;q=e+48|0;W=s[q>>2]|0;E=s[e+20>>2]|0;if((W|0)<5&(E|0)==0?(s[e+52>>2]|0)==0:0){L=(W|0)==0;if(L){bi(Z,l,2048,Y);mi(l+1440|0,l,1328,620,h);D=720-(s[h>>2]|0)|0;s[e+44>>2]=D;N=1}else{N=.800000011920929;D=s[e+44>>2]|0}I=Ne()|0;O=u;u=u+((1*(V<<2)|0)+15&-16)|0;v=s[S+60>>2]|0;y=D<<1;E=(y|0)<1024;A=F+4096|0;i=2048-t|0;T=i<<2;S=1024-D|0;M=V+t|0;R=1024-t+S|0;C=i+-1|0;P=e+56|0;x=e+64|0;p=e+72|0;b=(V|0)/2|0;w=V+-1|0;_=0;do{g=s[Z+(_<<2)>>2]|0;n=0;while(1){if((n|0)==1024)break;s[F+(n<<2)>>2]=s[g+(n+1024<<2)>>2];n=n+1|0}if(L){Ai(F,j,v,V,24,1024);f[j>>2]=+f[j>>2]*1.000100016593933;n=1;while(1){if((n|0)==25)break;e=j+(n<<2)|0;m=+f[e>>2];k=+(n|0);f[e>>2]=m-m*6400000711437315e-20*k*k;n=n+1|0}vi(U+(_*24<<2)|0,j,24)}l=E?y:1024;n=2048-l+-1|0;o=0;while(1){if((o|0)==24)break;s[G+(o<<2)>>2]=s[g+(n-o<<2)>>2];o=o+1|0}h=A+(0-l<<2)|0;d=U+(_*24<<2)|0;ki(h,d,h,l,G);h=l>>1;c=1024-h|0;n=1024-l|0;a=1;m=1;o=0;while(1){if((o|0)>=(h|0))break;K=+f[F+(c+o<<2)>>2];k=+f[F+(n+o<<2)>>2];a=a+K*K;m=m+k*k;o=o+1|0}m=+z(+((a=(M|0)){n=0;break}e=(o|0)<(D|0);K=e?a:a*m;e=o-(e?0:D)|0;f[g+(i+n<<2)>>2]=K*+f[F+(S+e<<2)>>2];X=+f[g+(R+e<<2)>>2];k=k+X*X;a=K;n=n+1|0;o=e+1|0}while(1){if((n|0)==24)break;s[H+(n<<2)>>2]=s[g+(C-n<<2)>>2];n=n+1|0}o=g+8192|0;n=o+(B<<2)|0;Ei(n,d,n,M,H);a=0;n=0;while(1){if((n|0)>=(M|0))break;X=+f[g+(i+n<<2)>>2];a=a+X*X;n=n+1|0}e:do if(k>a*.20000000298023224){if(k=(V|0)){n=V;break}e=g+(i+n<<2)|0;f[e>>2]=(1-+f[v+(n<<2)>>2]*a)*+f[e>>2];n=n+1|0}while(1){if((n|0)>=(M|0))break e;e=g+(i+n<<2)|0;f[e>>2]=m*+f[e>>2];n=n+1|0}}}else{n=0;while(1){if((n|0)>=(M|0))break e;f[g+(i+n<<2)>>2]=0;n=n+1|0}}while(0);e=s[P>>2]|0;X=-+f[x>>2];n=s[p>>2]|0;As(O,o,e,e,V,X,X,n,n,0,0);n=0;while(1){if((n|0)>=(b|0))break;f[g+(n+2048<<2)>>2]=+f[v+(n<<2)>>2]*+f[O+(w-n<<2)>>2]+ +f[v+(V-n+-1<<2)>>2]*+f[O+(n<<2)>>2];n=n+1|0}_=_+1|0}while((_|0)<(Y|0));He(I|0);Z=W+1|0;s[q>>2]=Z;u=$;return}n=s[e+24>>2]|0;g=s[S+12>>2]|0;l=(n|0)<(g|0);g=(E|0)>((l?n:g)|0)?E:l?n:g;l=te(Y,t)|0;_=Ne()|0;v=u;u=u+((1*(l<<2)|0)+15&-16)|0;a=(W|0)==0?1.5:.5;l=0;do{o=te(l,d)|0;h=E;while(1){if((h|0)>=(n|0))break;H=o+h|0;K=+f[c+(H<<2)>>2];H=y+(H<<2)|0;X=+f[H>>2]-a;f[H>>2]=K>X?K:X;h=h+1|0}l=l+1|0}while((l|0)<(Y|0));p=e+36|0;w=0;n=s[p>>2]|0;while(1){if((w|0)>=(Y|0))break;b=te(w,t)|0;o=E;e:while(1){if((o|0)>=(g|0))break;d=r[A+(o<<1)>>1]|0;h=b+(d<>1]|0)-d<=(d|0))break;H=(te(n,1664525)|0)+1013904223|0;f[v+(h+l<<2)>>2]=+(H>>20|0);l=l+1|0;n=H}c=v+(h<<2)|0;l=0;a=0;while(1){if((l|0)>=(d|0))break;X=+f[c+(l<<2)>>2];l=l+1|0;a=a+X*X}a=1/+z(+(a+1.0000000036274937e-15));h=0;l=c;while(1){if((h|0)>=(d|0))continue e;f[l>>2]=a*+f[l>>2];h=h+1|0;l=l+4|0}}w=w+1|0}s[p>>2]=n;n=2048-t+(V>>>1)<<2;o=0;do{V=s[Z+(o<<2)>>2]|0;Mr(V|0,V+(t<<2)|0,n|0)|0;o=o+1|0}while((o|0)<(Y|0));ai(S,v,T,y,E,g,Y,Y,0,i,s[e+16>>2]|0,0);He(_|0);Z=W+1|0;s[q>>2]=Z;u=$;return}function ai(e,t,i,n,r,o,a,l,h,c,d,p){e=e|0;t=t|0;i=i|0;n=n|0;r=r|0;o=o|0;a=a|0;l=l|0;h=h|0;c=c|0;d=d|0;p=p|0;var b=0,w=0,m=0,g=0,_=0,v=0,k=0,y=0,E=0,A=0,T=0,S=0,M=0,R=0;R=u;S=s[e+4>>2]|0;_=s[e+8>>2]|0;v=e+44|0;m=s[v>>2]|0;y=m<>2]|0)-(E?c:0)|0;switch(l|0){case 2:{if((a|0)==1){sn(s[e+32>>2]|0,m,t,M,n,r,o,k,d,p);w=i+4|0;a=(s[w>>2]|0)+(((S|0)/2|0)<<2)|0;Sr(a|0,M|0,y<<2|0)|0;b=e+64|0;c=e+60|0;h=0;while(1){if((h|0)>=(A|0)){h=0;break}y=(s[i>>2]|0)+((te(T,h)|0)<<2)|0;pi(b,a+(h<<2)|0,y,s[c>>2]|0,S,E,A);h=h+1|0}while(1){if((h|0)>=(A|0))break;i=(s[w>>2]|0)+((te(T,h)|0)<<2)|0;pi(b,M+(h<<2)|0,i,s[c>>2]|0,S,E,A);h=h+1|0}u=R;return}break}case 1:{if((a|0)==2){c=(s[i>>2]|0)+(((S|0)/2|0)<<2)|0;h=e+32|0;sn(s[h>>2]|0,m,t,M,n,r,o,k,d,p);sn(s[h>>2]|0,s[v>>2]|0,t+(y<<2)|0,c,n+(_<<2)|0,r,o,k,d,p);h=0;while(1){if((h|0)>=(y|0))break;r=M+(h<<2)|0;f[r>>2]=+f[r>>2]*.5+ +f[c+(h<<2)>>2]*.5;h=h+1|0}a=e+64|0;h=e+60|0;c=0;while(1){if((c|0)>=(A|0))break;y=(s[i>>2]|0)+((te(T,c)|0)<<2)|0;pi(a,M+(c<<2)|0,y,s[h>>2]|0,S,E,A);c=c+1|0}u=R;return}break}default:{}}g=e+32|0;w=e+64|0;b=e+60|0;h=0;c=m;while(1){e=t+((te(h,y)|0)<<2)|0;a=n+((te(h,_)|0)<<2)|0;sn(s[g>>2]|0,c,e,M,a,r,o,k,d,p);c=i+(h<<2)|0;a=0;while(1){if((a|0)>=(A|0))break;e=(s[c>>2]|0)+((te(T,a)|0)<<2)|0;pi(w,M+(a<<2)|0,e,s[b>>2]|0,S,E,A);a=a+1|0}h=h+1|0;if((h|0)>=(l|0))break;c=s[v>>2]|0}u=R;return}function li(e,t,i,n,r,o,a,l){e=e|0;t=t|0;i=i|0;n=n|0;r=r|0;o=o|0;a=a|0;l=l|0;var h=0,c=0,d=0,p=0,b=0,w=0,m=0,g=0,_=0,v=0,k=0,y=0,E=0,A=0,T=0;E=u;if((r|0)==1&(n|0)==2&(l|0)==0){p=+f[o>>2];b=s[e>>2]|0;l=s[e+4>>2]|0;o=a+4|0;h=0;c=+f[a>>2];d=+f[o>>2];while(1){if((h|0)>=(i|0))break;T=+f[b+(h<<2)>>2]+1.0000000031710769e-30+c;A=+f[l+(h<<2)>>2]+1.0000000031710769e-30+d;e=h<<1;f[t+(e<<2)>>2]=T*30517578125e-15;f[t+((e|1)<<2)>>2]=A*30517578125e-15;h=h+1|0;c=T*p;d=A*p}f[a>>2]=c;f[o>>2]=d;u=E;return}k=Ne()|0;y=u;u=u+((1*(i<<2)|0)+15&-16)|0;d=+f[o>>2];m=(i|0)/(r|0)|0;g=(r|0)>1;l=0;_=0;do{h=a+(_<<2)|0;c=+f[h>>2];b=s[e+(_<<2)>>2]|0;w=t+(_<<2)|0;if(!g){o=0;while(1){if((o|0)>=(i|0))break;T=+f[b+(o<<2)>>2]+1.0000000031710769e-30+c;f[w+((te(o,n)|0)<<2)>>2]=T*30517578125e-15;o=o+1|0;c=d*T}f[h>>2]=c;if(!l)l=0;else v=14}else{l=0;while(1){if((l|0)>=(i|0))break;T=+f[b+(l<<2)>>2]+1.0000000031710769e-30+c;f[y+(l<<2)>>2]=T;l=l+1|0;c=d*T}f[h>>2]=c;l=1;v=14}e:do if((v|0)==14){v=0;o=0;while(1){if((o|0)>=(m|0))break e;f[w+((te(o,n)|0)<<2)>>2]=+f[y+((te(o,r)|0)<<2)>>2]*30517578125e-15;o=o+1|0}}while(0);_=_+1|0}while((_|0)<(n|0));He(k|0);u=E;return}function fi(e,t,i,n){e=e|0;t=t|0;i=i|0;n=n|0;var r=0,a=0,l=0,f=0,h=0,u=0,c=0,d=0;r=s[e+36>>2]|0;n=te(r,n-i|0)|0;d=e+32|0;a=(s[d>>2]|0)-n|0;s[d>>2]=a;if(!t){u=e+28|0;c=u;n=(s[u>>2]|0)-n|0}else{c=e+28|0;n=te(r,i-t|0)|0}s[c>>2]=n;l=e+20|0;f=e+40|0;h=e+24|0;u=e+4|0;t=a;while(1){if(n>>>0>=8388609)break;s[l>>2]=(s[l>>2]|0)+8;n=n<<8;s[c>>2]=n;i=s[f>>2]|0;r=s[h>>2]|0;if(r>>>0<(s[u>>2]|0)>>>0){s[h>>2]=r+1;r=o[(s[e>>2]|0)+r>>0]|0}else r=0;s[f>>2]=r;a=((i<<8|r)>>>1&255|t<<8&2147483392)^255;s[d>>2]=a;t=a}return}function hi(e,t){e=e|0;t=t|0;var i=0,n=0,r=0,a=0,l=0,f=0,h=0,u=0,c=0,d=0,p=0;p=t+-1|0;i=32-(ne(p|0)|0)|0;if((i|0)<=8){c=e+28|0;f=s[c>>2]|0;a=(f>>>0)/(t>>>0)|0;s[e+36>>2]=a;d=e+32|0;u=s[d>>2]|0;h=((u>>>0)/(a>>>0)|0)+1|0;h=h>>>0>t>>>0?t:h;i=t-h|0;l=te(a,t-(i+1)|0)|0;u=u-l|0;s[d>>2]=u;t=(h|0)==(t|0)?f-l|0:a;s[c>>2]=t;a=e+20|0;l=e+40|0;f=e+24|0;h=e+4|0;while(1){if(t>>>0>=8388609)break;s[a>>2]=(s[a>>2]|0)+8;t=t<<8;s[c>>2]=t;r=s[l>>2]|0;n=s[f>>2]|0;if(n>>>0<(s[h>>2]|0)>>>0){s[f>>2]=n+1;n=o[(s[e>>2]|0)+n>>0]|0}else n=0;s[l>>2]=n;p=((r<<8|n)>>>1&255|u<<8&2147483392)^255;s[d>>2]=p;u=p}return i|0}d=i+-8|0;u=(p>>>d)+1|0;h=((s[e+28>>2]|0)>>>0)/(u>>>0)|0;s[e+36>>2]=h;h=(((s[e+32>>2]|0)>>>0)/(h>>>0)|0)+1|0;h=u-(u>>>0>>0?u:h)|0;fi(e,h,h+1|0,u);h=h<>2]|0;c=e+16|0;t=s[c>>2]|0;if(t>>>0>>0){l=e+8|0;a=s[e+4>>2]|0;f=t+8|0;f=t+(((f|0)>25?f:25)+-1-t&-8)|0;n=s[l>>2]|0;do{if(n>>>0>>0){r=n+1|0;s[l>>2]=r;n=r;r=o[(s[e>>2]|0)+(a-r)>>0]|0}else r=0;i=i|r<>2]=i>>>d;s[c>>2]=t-d;c=e+20|0;s[c>>2]=(s[c>>2]|0)+d;i=h|i&(1<>>0<=p>>>0){e=i;return e|0}s[e+44>>2]=1;e=p;return e|0}function ui(e){e=e|0;var t=0,i=0,r=0,a=0,l=0,f=0,h=0,u=0,c=0,d=0,p=0,b=0,w=0,m=0,g=0;g=s[e+28>>2]|0;a=ne(g|0)|0;t=2147483647>>>a;i=s[e+32>>2]|0;r=i+t&~t;if((r|t)>>>0>=(i+g|0)>>>0){r=t>>>1;r=i+r&~r;a=a+1|0}c=e+36|0;d=e+40|0;m=e+24|0;p=e+8|0;b=e+4|0;g=e+44|0;w=a+7&-8;h=a;while(1){if((h|0)<=0)break;f=r>>>23;if((f|0)==255)s[c>>2]=(s[c>>2]|0)+1;else{l=r>>>31;t=s[d>>2]|0;if((t|0)>-1){i=s[m>>2]|0;if((i+(s[p>>2]|0)|0)>>>0<(s[b>>2]|0)>>>0){s[m>>2]=i+1;n[(s[e>>2]|0)+i>>0]=t+l;t=0}else t=-1;s[g>>2]=s[g>>2]|t}t=s[c>>2]|0;if(t|0){l=l+255&255;do{i=s[m>>2]|0;if((i+(s[p>>2]|0)|0)>>>0<(s[b>>2]|0)>>>0){s[m>>2]=i+1;n[(s[e>>2]|0)+i>>0]=l;i=0;t=s[c>>2]|0}else i=-1;s[g>>2]=s[g>>2]|i;t=t+-1|0;s[c>>2]=t}while((t|0)!=0)}s[d>>2]=f&255}r=r<<8&2147483392;h=h+-8|0}i=s[d>>2]|0;if((i|0)>-1){t=s[m>>2]|0;if((t+(s[p>>2]|0)|0)>>>0<(s[b>>2]|0)>>>0){s[m>>2]=t+1;n[(s[e>>2]|0)+t>>0]=i;t=0}else t=-1;s[g>>2]=s[g>>2]|t;t=s[c>>2]|0;if(!t)u=26;else u=23}else{t=s[c>>2]|0;if(t|0)u=23}if((u|0)==23)while(1){i=s[m>>2]|0;if((i+(s[p>>2]|0)|0)>>>0<(s[b>>2]|0)>>>0){s[m>>2]=i+1;n[(s[e>>2]|0)+i>>0]=-1;i=0;t=s[c>>2]|0}else i=-1;s[g>>2]=s[g>>2]|i;t=t+-1|0;s[c>>2]=t;if(!t){u=26;break}else u=23}if((u|0)==26)s[d>>2]=0;f=s[e+16>>2]|0;l=f+~((f|0)<7?f:7)+8&-8;h=f;t=s[e+12>>2]|0;while(1){if((h|0)<=7)break;i=s[p>>2]|0;r=s[b>>2]|0;if(((s[m>>2]|0)+i|0)>>>0>>0){i=i+1|0;s[p>>2]=i;n[(s[e>>2]|0)+(r-i)>>0]=t;i=0}else i=-1;s[g>>2]=s[g>>2]|i;h=h+-8|0;t=t>>>8}l=f-l|0;if(s[g>>2]|0)return;d=s[m>>2]|0;yr((s[e>>2]|0)+d|0,0,(s[b>>2]|0)-d-(s[p>>2]|0)|0)|0;if((l|0)<=0)return;f=s[p>>2]|0;r=s[b>>2]|0;if(r>>>0<=f>>>0){s[g>>2]=-1;return}i=w-a|0;if((l|0)>(i|0)?((s[m>>2]|0)+f|0)>>>0>=r>>>0:0){s[g>>2]=-1;t=t&(1<>2]|0)+(r-f+-1)|0;n[e>>0]=o[e>>0]|0|t;return}function ci(e,t){e=e|0;t=t|0;var i=0,n=0,o=0,a=0,l=0,h=0,c=0,d=0,p=0,b=0,w=0,m=0,g=0,_=0,v=0,k=0,y=0,E=0,A=0,T=0,S=0,M=0,R=0,C=0,P=0,x=0,I=0,O=0,N=0,D=0,L=0,U=0,B=0,j=0,F=0,G=0,H=0,z=0,q=0,W=0,V=0,Y=0,Z=0,$=0;C=u;u=u+32|0;R=C;M=s[e+8>>2]|0;M=(M|0)>0?M:0;s[R>>2]=1;i=1;n=0;while(1){o=n<<1;S=r[e+12+((o|1)<<1)>>1]|0;i=te(i,r[e+12+(o<<1)>>1]|0)|0;o=n+1|0;s[R+(o<<2)>>2]=i;if(S<<16>>16==1)break;else n=o}S=e+48|0;A=r[e+12+((o<<1)+-1<<1)>>1]|0;while(1){if((n|0)<=-1)break;i=n<<1;if(!n)T=1;else T=r[e+12+(i+-1<<1)>>1]|0;e:do switch(r[e+12+(i<<1)>>1]|0){case 2:{o=s[R+(n<<2)>>2]|0;i=t;a=0;while(1){if((a|0)>=(o|0))break e;E=i+32|0;k=+f[E>>2];A=i+36|0;v=+f[A>>2];h=+f[i>>2];f[E>>2]=h-k;E=i+4|0;y=+f[E>>2];f[A>>2]=y-v;f[i>>2]=h+k;f[E>>2]=y+v;E=i+40|0;v=+f[E>>2];A=i+44|0;y=+f[A>>2];k=(v+y)*.7071067690849304;v=(y-v)*.7071067690849304;_=i+8|0;y=+f[_>>2];f[E>>2]=y-k;E=i+12|0;h=+f[E>>2];f[A>>2]=h-v;f[_>>2]=y+k;f[E>>2]=h+v;E=i+52|0;v=+f[E>>2];_=i+48|0;h=+f[_>>2];A=i+16|0;k=+f[A>>2];f[_>>2]=k-v;_=i+20|0;y=+f[_>>2];f[E>>2]=y+h;f[A>>2]=k+v;f[_>>2]=y-h;_=i+60|0;h=+f[_>>2];A=i+56|0;y=+f[A>>2];v=(h-y)*.7071067690849304;y=(h+y)*-.7071067690849304;E=i+24|0;h=+f[E>>2];f[A>>2]=h-v;A=i+28|0;k=+f[A>>2];f[_>>2]=k-y;f[E>>2]=h+v;f[A>>2]=k+y;i=i+64|0;a=a+1|0}}case 4:{_=s[R+(n<<2)>>2]|0;d=_<=(_|0))break e;y=+f[i>>2];p=i+16|0;D=+f[p>>2];h=y-D;w=i+4|0;x=+f[w>>2];b=i+20|0;O=+f[b>>2];k=x-O;D=y+D;O=x+O;m=i+8|0;x=+f[m>>2];E=i+24|0;y=+f[E>>2];N=x+y;g=i+12|0;P=+f[g>>2];A=i+28|0;v=+f[A>>2];I=P+v;f[p>>2]=D-N;f[b>>2]=O-I;f[i>>2]=D+N;f[w>>2]=O+I;y=x-y;v=P-v;f[m>>2]=h+v;f[g>>2]=k-y;f[E>>2]=h-v;f[A>>2]=k+y;i=i+32|0;o=o+1|0}}o=A<<1;a=A*3|0;l=d<<1;c=d*3|0;p=0;while(1){if((p|0)>=(_|0))break e;i=t+((te(p,T)|0)<<3)|0;g=s[S>>2]|0;b=0;w=g;m=g;while(1){if((b|0)>=(A|0))break;B=i+(A<<3)|0;P=+f[B>>2];v=+f[w>>2];U=i+(A<<3)+4|0;x=+f[U>>2];y=+f[w+4>>2];h=P*v-x*y;v=P*y+x*v;G=i+(o<<3)|0;x=+f[G>>2];y=+f[m>>2];F=i+(o<<3)+4|0;P=+f[F>>2];O=+f[m+4>>2];k=x*y-P*O;y=x*O+P*y;L=i+(a<<3)|0;P=+f[L>>2];O=+f[g>>2];E=i+(a<<3)+4|0;x=+f[E>>2];I=+f[g+4>>2];D=P*O-x*I;O=P*I+x*O;x=+f[i>>2];I=x-k;j=i+4|0;P=+f[j>>2];N=P-y;k=x+k;f[i>>2]=k;y=P+y;f[j>>2]=y;P=h+D;x=v+O;D=h-D;O=v-O;f[G>>2]=k-P;f[F>>2]=y-x;f[i>>2]=+f[i>>2]+P;f[j>>2]=+f[j>>2]+x;f[B>>2]=I+O;f[U>>2]=N-D;f[L>>2]=I-O;f[E>>2]=N+D;i=i+8|0;b=b+1|0;w=w+(d<<3)|0;m=m+(l<<3)|0;g=g+(c<<3)|0}p=p+1|0}}case 3:{o=s[R+(n<<2)>>2]|0;a=o<>2]|0)+(c<<3)+4>>2];c=a<<1;d=0;while(1){if((d|0)>=(o|0))break e;i=t+((te(d,T)|0)<<3)|0;w=s[S>>2]|0;p=A;b=w;while(1){F=i+(A<<3)|0;I=+f[F>>2];x=+f[b>>2];G=i+(A<<3)+4|0;y=+f[G>>2];N=+f[b+4>>2];P=I*x-y*N;x=I*N+y*x;B=i+(l<<3)|0;y=+f[B>>2];N=+f[w>>2];j=i+(l<<3)+4|0;I=+f[j>>2];O=+f[w+4>>2];D=y*N-I*O;N=y*O+I*N;I=P+D;O=x+N;f[F>>2]=+f[i>>2]-I*.5;U=i+4|0;f[G>>2]=+f[U>>2]-O*.5;D=(P-D)*h;N=(x-N)*h;f[i>>2]=+f[i>>2]+I;f[U>>2]=+f[U>>2]+O;f[B>>2]=+f[F>>2]+N;f[j>>2]=+f[G>>2]-D;f[F>>2]=+f[F>>2]-N;f[G>>2]=+f[G>>2]+D;p=p+-1|0;if(!p)break;else{i=i+8|0;b=b+(a<<3)|0;w=w+(c<<3)|0}}d=d+1|0}}case 5:{i=s[R+(n<<2)>>2]|0;o=i<>2]|0;h=+f[a+(l<<3)>>2];v=+f[a+(l<<3)+4>>2];l=te(o<<1,A)|0;k=+f[a+(l<<3)>>2];y=+f[a+(l<<3)+4>>2];l=A<<1;c=A*3|0;d=A<<2;_=0;while(1){if((_|0)>=(i|0))break e;g=t+((te(_,T)|0)<<3)|0;p=g;b=g+(A<<3)|0;w=g+(l<<3)|0;m=g+(c<<3)|0;g=g+(d<<3)|0;E=0;while(1){if((E|0)>=(A|0))break;W=+f[p>>2];U=p+4|0;z=+f[U>>2];q=+f[b>>2];L=te(E,o)|0;I=+f[a+(L<<3)>>2];B=b+4|0;Z=+f[B>>2];$=+f[a+(L<<3)+4>>2];N=q*I-Z*$;I=q*$+Z*I;Z=+f[w>>2];L=te(E<<1,o)|0;$=+f[a+(L<<3)>>2];F=w+4|0;q=+f[F>>2];P=+f[a+(L<<3)+4>>2];Y=Z*$-q*P;$=Z*P+q*$;q=+f[m>>2];L=te(E*3|0,o)|0;P=+f[a+(L<<3)>>2];G=m+4|0;Z=+f[G>>2];O=+f[a+(L<<3)+4>>2];D=q*P-Z*O;P=q*O+Z*P;Z=+f[g>>2];L=te(E<<2,o)|0;O=+f[a+(L<<3)>>2];j=g+4|0;q=+f[j>>2];H=+f[a+(L<<3)+4>>2];x=Z*O-q*H;O=Z*H+q*O;q=N+x;H=I+O;x=N-x;O=I-O;I=Y+D;N=$+P;D=Y-D;P=$-P;f[p>>2]=W+(q+I);f[U>>2]=z+(H+N);$=W+(q*h+I*k);Y=z+(H*h+N*k);Z=O*v+P*y;V=x*v+D*y;f[b>>2]=$-Z;f[B>>2]=Y+V;f[g>>2]=$+Z;f[j>>2]=Y-V;I=W+(q*k+I*h);N=z+(H*k+N*h);O=P*v-O*y;D=x*y-D*v;f[w>>2]=I+O;f[F>>2]=N+D;f[m>>2]=I-O;f[G>>2]=N-D;p=p+8|0;b=b+8|0;w=w+8|0;m=m+8|0;g=g+8|0;E=E+1|0}_=_+1|0}}default:{}}while(0);n=n+-1|0;A=T}u=C;return}function di(e,t,i,n,o,a,l){e=e|0;t=t|0;i=i|0;n=n|0;o=o|0;a=a|0;l=l|0;var h=0,c=0,d=0,p=0,b=0,w=0,m=0,g=0,_=0,v=0,k=0,y=0,E=0,A=0,T=0,S=0,M=0,R=0;A=u;_=s[e+8+(a<<2)>>2]|0;v=+f[_+4>>2];h=s[e>>2]|0;c=0;E=s[e+24>>2]|0;while(1){y=h>>1;if((c|0)>=(a|0))break;h=y;c=c+1|0;E=E+(y<<2)|0}k=h>>2;e=u;u=u+((1*(y<<2)|0)+15&-16)|0;h=u;u=u+((1*(k<<3)|0)+15&-16)|0;a=o>>1;w=n+(a<<2)|0;m=o+3>>2;g=0-y|0;p=0;b=w;w=w+-4|0;d=t+(a<<2)|0;a=t+(y<<2)+-4+(a<<2)|0;c=e;while(1){if((p|0)>=(m|0))break;T=+f[w>>2];S=+f[b>>2];f[c>>2]=T*+f[d+(y<<2)>>2]+S*+f[a>>2];f[c+4>>2]=S*+f[d>>2]-T*+f[a+(g<<2)>>2];p=p+1|0;b=b+8|0;w=w+-8|0;d=d+8|0;a=a+-8|0;c=c+8|0}t=n+(o<<2)|0;b=k-m|0;while(1){if((p|0)>=(b|0))break;s[c>>2]=s[a>>2];s[c+4>>2]=s[d>>2];p=p+1|0;d=d+8|0;a=a+-8|0;c=c+8|0}w=p;b=n;p=t+-4|0;while(1){if((w|0)>=(k|0))break;f[c>>2]=+f[p>>2]*+f[a>>2]-+f[b>>2]*+f[d+(g<<2)>>2];f[c+4>>2]=+f[p>>2]*+f[d>>2]+ +f[b>>2]*+f[a+(y<<2)>>2];w=w+1|0;b=b+8|0;p=p+-8|0;d=d+8|0;a=a+-8|0;c=c+8|0}c=_+44|0;a=0;while(1){if((a|0)>=(k|0))break;M=+f[E+(a<<2)>>2];S=+f[E+(k+a<<2)>>2];T=+f[e>>2];R=+f[e+4>>2];g=r[(s[c>>2]|0)+(a<<1)>>1]|0;f[h+(g<<3)>>2]=v*(T*M-R*S);f[h+(g<<3)+4>>2]=v*(R*M+T*S);a=a+1|0;e=e+8|0}ci(_,h);d=l<<1;p=0-d|0;c=0;a=i;e=i+((te(y+-1|0,l)|0)<<2)|0;while(1){if((c|0)>=(k|0))break;M=+f[h+4>>2];S=+f[E+(k+c<<2)>>2];T=+f[h>>2];R=+f[E+(c<<2)>>2];f[a>>2]=M*S-T*R;f[e>>2]=T*S+M*R;h=h+8|0;c=c+1|0;a=a+(d<<2)|0;e=e+(p<<2)|0}u=A;return}function pi(e,t,i,n,o,a,l){e=e|0;t=t|0;i=i|0;n=n|0;o=o|0;a=a|0;l=l|0;var h=0,u=0,c=0,d=0,p=0,b=0,w=0,m=0,g=0,_=0,v=0,k=0,y=0,E=0,A=0;h=s[e>>2]|0;u=0;m=s[e+24>>2]|0;while(1){w=h>>1;if((u|0)>=(a|0))break;h=w;u=u+1|0;m=m+(w<<2)|0}b=h>>2;g=t+((te(w+-1|0,l)|0)<<2)|0;h=i+(o>>1<<2)|0;p=s[e+8+(a<<2)>>2]|0;a=l<<1;l=0-a|0;c=s[p+44>>2]|0;d=0;u=t;e=g;while(1){if((d|0)>=(b|0))break;v=+f[e>>2];k=+f[m+(d<<2)>>2];y=+f[u>>2];_=+f[m+(b+d<<2)>>2];g=r[c>>1]<<1;f[h+((g|1)<<2)>>2]=v*k+y*_;f[h+(g<<2)>>2]=y*k-v*_;c=c+2|0;d=d+1|0;u=u+(a<<2)|0;e=e+(l<<2)|0}ci(p,h);a=b+1>>1;e=h+(w<<2)|0;l=0;while(1){u=e+-8|0;if((l|0)>=(a|0))break;g=h+4|0;A=+f[g>>2];v=+f[h>>2];y=+f[m+(l<<2)>>2];E=+f[m+(b+l<<2)>>2];t=e+-4|0;_=+f[t>>2];k=+f[u>>2];f[h>>2]=A*y+v*E;f[t>>2]=A*E-v*y;y=+f[m+(b-l+-1<<2)>>2];v=+f[m+(w-l+-1<<2)>>2];f[u>>2]=_*y+k*v;f[g>>2]=_*v-k*y;e=u;l=l+1|0;h=h+8|0}a=(o|0)/2|0;h=i+(o<<2)|0;u=n+(o<<2)|0;e=0;while(1){u=u+-4|0;h=h+-4|0;if((e|0)>=(a|0))break;A=+f[h>>2];y=+f[i>>2];E=+f[u>>2];k=+f[n>>2];f[i>>2]=E*y-k*A;f[h>>2]=k*y+E*A;e=e+1|0;n=n+4|0;i=i+4|0}return}function bi(e,t,i,n){e=e|0;t=t|0;i=i|0;n=n|0;var r=0,o=0,a=0,l=0,h=0,c=0,d=0,p=0,b=0,w=0,m=0,g=0,_=0,v=0,k=0,y=0,E=0,A=0;v=u;u=u+48|0;o=v+16|0;g=v;_=i>>1;i=1;while(1){if((i|0)>=(_|0))break;k=i<<1;y=s[e>>2]|0;f[t+(i<<2)>>2]=((+f[y+(k+-1<<2)>>2]+ +f[y+((k|1)<<2)>>2])*.5+ +f[y+(k<<2)>>2])*.5;i=i+1|0}y=s[e>>2]|0;f[t>>2]=(+f[y+4>>2]*.5+ +f[y>>2])*.5;if((n|0)==2){i=e+4|0;n=1;while(1){if((n|0)>=(_|0))break;k=n<<1;e=s[i>>2]|0;y=t+(n<<2)|0;f[y>>2]=+f[y>>2]+((+f[e+(k+-1<<2)>>2]+ +f[e+((k|1)<<2)>>2])*.5+ +f[e+(k<<2)>>2])*.5;n=n+1|0}y=s[i>>2]|0;f[t>>2]=+f[t>>2]+(+f[y+4>>2]*.5+ +f[y>>2])*.5}Ai(t,o,0,0,4,_);f[o>>2]=+f[o>>2]*1.000100016593933;i=1;while(1){if((i|0)==5)break;y=o+(i<<2)|0;w=+f[y>>2];m=+(i|0)*.00800000037997961;f[y>>2]=w-w*m*m;i=i+1|0}vi(g,o,4);i=0;r=1;while(1){if((i|0)==4)break;m=r*.8999999761581421;y=g+(i<<2)|0;f[y>>2]=+f[y>>2]*m;i=i+1|0;r=m}w=+f[g>>2];b=w+.800000011920929;m=+f[g+4>>2];w=m+w*.800000011920929;r=+f[g+8>>2];m=r+m*.800000011920929;a=+f[g+12>>2];r=a+r*.800000011920929;a=a*.800000011920929;i=0;l=0;h=0;c=0;d=0;p=0;while(1){if((i|0)>=(_|0))break;y=t+(i<<2)|0;A=+f[y>>2];f[y>>2]=A+b*l+w*h+m*c+r*d+a*p;E=l;i=i+1|0;l=A;p=d;d=c;c=h;h=E}u=v;return}function wi(e,t,i,n,r){e=e|0;t=t|0;i=i|0;n=n|0;r=r|0;var o=0,a=0,l=0,h=0,u=0,c=0,p=0,b=0,w=0,m=0,g=0,_=0,v=0,k=0,y=0,E=0,A=0,T=0,S=0,M=0,R=0,C=0,P=0,x=0,I=0,O=0,N=0,D=0,L=0,U=0,B=0;v=r+-3|0;k=n+-3|0;A=((k|0)>0?k:0)+3|0;y=A&-4;T=e+(y<<2)|0;l=r+-3|0;l=((l|0)>0?l:0)+3&-4;E=0;A=t+((A|3)<<2)|0;while(1){if((E|0)>=(v|0))break;S=t+(E<<2)|0;p=e;b=S+12|0;w=0;c=0;u=0;a=0;o=0;h=+f[S>>2];g=+f[S+4>>2];_=+f[S+8>>2];m=0;while(1){if((w|0)>=(k|0))break;x=+f[p>>2];m=+f[b>>2];B=(s[d>>2]=c,+f[d>>2])+x*h;U=(s[d>>2]=u,+f[d>>2])+x*g;L=(s[d>>2]=a,+f[d>>2])+x*_;D=+f[p+4>>2];C=+f[b+4>>2];N=+f[p+8>>2];R=+f[b+8>>2];x=(s[d>>2]=o,+f[d>>2])+x*m+D*C+N*R;P=+f[p+12>>2];M=+f[b+12>>2];O=(f[d>>2]=B+D*g+N*_+P*m,s[d>>2]|0);I=(f[d>>2]=U+D*_+N*m+P*C,s[d>>2]|0);S=(f[d>>2]=L+D*m+N*C+P*R,s[d>>2]|0);p=p+16|0;b=b+16|0;w=w+4|0;c=O;u=I;a=S;o=(f[d>>2]=x+P*M,s[d>>2]|0);h=C;g=R;_=M}w=y|1;if((y|0)<(n|0)){B=+f[T>>2];m=+f[A>>2];c=(f[d>>2]=(s[d>>2]=c,+f[d>>2])+B*h,s[d>>2]|0);u=(f[d>>2]=(s[d>>2]=u,+f[d>>2])+B*g,s[d>>2]|0);a=(f[d>>2]=(s[d>>2]=a,+f[d>>2])+B*_,s[d>>2]|0);p=T+4|0;b=A+4|0;o=(f[d>>2]=(s[d>>2]=o,+f[d>>2])+B*m,s[d>>2]|0)}else{p=T;b=A}if((w|0)<(n|0)){B=+f[p>>2];h=+f[b>>2];c=(f[d>>2]=(s[d>>2]=c,+f[d>>2])+B*g,s[d>>2]|0);u=(f[d>>2]=(s[d>>2]=u,+f[d>>2])+B*_,s[d>>2]|0);a=(f[d>>2]=(s[d>>2]=a,+f[d>>2])+B*m,s[d>>2]|0);p=p+4|0;b=b+4|0;o=(f[d>>2]=(s[d>>2]=o,+f[d>>2])+B*h,s[d>>2]|0)}if((w+1|0)<(n|0)){B=+f[p>>2];c=(f[d>>2]=(s[d>>2]=c,+f[d>>2])+B*_,s[d>>2]|0);u=(f[d>>2]=(s[d>>2]=u,+f[d>>2])+B*m,s[d>>2]|0);a=(f[d>>2]=(s[d>>2]=a,+f[d>>2])+B*h,s[d>>2]|0);o=(f[d>>2]=(s[d>>2]=o,+f[d>>2])+B*+f[b>>2],s[d>>2]|0)}s[i+(E<<2)>>2]=c;s[i+((E|1)<<2)>>2]=u;s[i+((E|2)<<2)>>2]=a;s[i+((E|3)<<2)>>2]=o;E=E+4|0;A=A+16|0}while(1){if((l|0)>=(r|0))break;o=t+(l<<2)|0;a=0;h=0;while(1){if((a|0)>=(n|0))break;B=h+ +f[e+(a<<2)>>2]*+f[o+(a<<2)>>2];a=a+1|0;h=B}f[i+(l<<2)>>2]=h;l=l+1|0}return}function mi(e,t,i,n,r){e=e|0;t=t|0;i=i|0;n=n|0;r=r|0;var o=0,a=0,l=0,h=0,c=0,d=0,p=0,b=0,w=0,m=0,g=0,_=0,v=0;v=u;u=u+16|0;m=v;c=m;s[c>>2]=0;s[c+4>>2]=0;c=i>>2;d=u;u=u+((1*(c<<2)|0)+15&-16)|0;p=i+n>>2;b=u;u=u+((1*(p<<2)|0)+15&-16)|0;g=n>>1;_=u;u=u+((1*(g<<2)|0)+15&-16)|0;h=0;while(1){if((h|0)>=(c|0))break;s[d+(h<<2)>>2]=s[e+(h<<1<<2)>>2];h=h+1|0}h=0;while(1){if((h|0)>=(p|0))break;s[b+(h<<2)>>2]=s[t+(h<<1<<2)>>2];h=h+1|0}n=n>>2;wi(d,b,_,c,n);gi(_,b,c,n,m);n=s[m>>2]<<1;w=s[m+4>>2]<<1;h=i>>1;p=0;while(1){if((p|0)>=(g|0))break;c=_+(p<<2)|0;f[c>>2]=0;i=p-n|0;if(!((((i|0)>-1?i:0-i|0)|0)>2?(i=p-w|0,(((i|0)>-1?i:0-i|0)|0)>2):0)){d=t+(p<<2)|0;b=0;o=0;while(1){if((b|0)>=(h|0))break;l=o+ +f[e+(b<<2)>>2]*+f[d+(b<<2)>>2];b=b+1|0;o=l}f[c>>2]=o<-1?-1:o}p=p+1|0}gi(_,t,h,g,m);h=s[m>>2]|0;if(!((h|0)>0&(h|0)<(g+-1|0))){_=0;g=h<<1;_=g-_|0;s[r>>2]=_;u=v;return}a=+f[_+(h+-1<<2)>>2];l=+f[_+(h<<2)>>2];o=+f[_+(h+1<<2)>>2];if(o-a>(l-a)*.699999988079071){_=1;g=h<<1;_=g-_|0;s[r>>2]=_;u=v;return}if(a-o>(l-o)*.699999988079071){_=-1;g=h<<1;_=g-_|0;s[r>>2]=_;u=v;return}_=0;g=h<<1;_=g-_|0;s[r>>2]=_;u=v;return}function gi(e,t,i,n,r){e=e|0;t=t|0;i=i|0;n=n|0;r=r|0;var o=0,a=0,l=0,h=0,u=0,c=0,p=0,b=0,w=0,m=0,g=0,_=0,v=0;s[r>>2]=0;g=r+4|0;s[g>>2]=1;a=1;o=0;while(1){if((o|0)>=(i|0)){o=0;b=0;h=0;w=-1082130432;u=-1082130432;m=0;break}l=+f[t+(o<<2)>>2];a=a+l*l;o=o+1|0}while(1){if((m|0)>=(n|0))break;l=+f[e+(m<<2)>>2];do if(l>0?(_=l*9.999999960041972e-13,_=_*_,l=_*(s[d>>2]=h,+f[d>>2]),l>(s[d>>2]=u,+f[d>>2])*a):0){l=_*(s[d>>2]=b,+f[d>>2]);if(l>(s[d>>2]=w,+f[d>>2])*a){s[g>>2]=o;p=(f[d>>2]=_,s[d>>2]|0);c=(f[d>>2]=a,s[d>>2]|0);s[r>>2]=m;o=m;h=b;u=w;break}else{u=(f[d>>2]=_,s[d>>2]|0);h=(f[d>>2]=a,s[d>>2]|0);s[g>>2]=m;c=b;p=w;break}}else{c=b;p=w}while(0);v=+f[t+(m+i<<2)>>2];l=+f[t+(m<<2)>>2];l=a+(v*v-l*l);a=l<1?1:l;b=c;w=p;m=m+1|0}return}function _i(e,t,i,n,r){e=e|0;t=t|0;i=i|0;n=n|0;r=+r;var o=0,a=0,l=0,h=0,c=0,d=0,p=0,b=0,w=0,m=0,g=0,_=0,v=0,k=0,y=0,E=0,A=0,T=0,S=0,M=0,R=0,C=0,P=0,x=0;x=u;u=u+2064|0;P=x+2052|0;y=s[i>>2]|0;T=(n|0)/2|0;C=(t|0)/2|0;R=e+2048|0;y=(y|0)>1023?511:(y|0)/2|0;s[i>>2]=y;E=x;n=R+(0-y<<2)|0;t=0;A=0;a=0;while(1){if((t|0)>=(C|0))break;k=+f[R+(t<<2)>>2];S=a+k*+f[n+(t<<2)>>2];t=t+1|0;A=A+k*k;a=S}f[E>>2]=A;n=1;o=A;while(1){if((n|0)==513)break;k=+f[R+(0-n<<2)>>2];S=+f[R+(C-n<<2)>>2];S=o+k*k-S*S;f[E+(n<<2)>>2]=S<0?0:S;n=n+1|0;o=S}w=+f[E+(y<<2)>>2];S=a/+z(+(A*w+1));g=y<<1;_=S*.699999988079071;v=S*.8500000238418579;k=r*.5;M=y;m=2;while(1){if((m|0)>=16)break;n=m<<1;b=((g+m|0)>>>0)/(n>>>0)|0;if((b|0)<7)break;if((m|0)==2){d=b+y|0;d=(d|0)>512?y:d}else d=(((te(s[17156+(m<<2)>>2]<<1,y)|0)+m|0)>>>0)/(n>>>0)|0;n=R+(0-b<<2)|0;t=R+(0-d<<2)|0;e=0;o=0;l=0;while(1){if((e|0)>=(C|0))break;c=+f[R+(e<<2)>>2];p=l+c*+f[t+(e<<2)>>2];c=o+c*+f[n+(e<<2)>>2];e=e+1|0;o=c;l=p}p=(o+l)*.5;l=(+f[E+(b<<2)>>2]+ +f[E+(d<<2)>>2])*.5;o=p/+z(+(A*l+1));n=b-T|0;n=(n|0)>-1?n:0-n|0;if((n|0)>=2)if((n|0)<3){d=(te(m*5|0,m)|0)<(y|0);c=d?k:0}else c=0;else c=r;h=_-c;h=h<.30000001192092896?.30000001192092896:h;if((b|0)<21){h=v-c;if(h<.4000000059604645)h=.4000000059604645}if(o>h){n=b;a=p}else{n=M;l=w;o=S}M=n;w=l;S=o;m=m+1|0}o=a<0?0:a;if(!(w<=o))h=o/(w+1);else h=1;e=0;while(1){if((e|0)==3)break;n=R+(1-(M+e)<<2)|0;t=0;o=0;while(1){if((t|0)>=(C|0))break;r=o+ +f[R+(t<<2)>>2]*+f[n+(t<<2)>>2];t=t+1|0;o=r}f[P+(e<<2)>>2]=o;e=e+1|0}a=+f[P+8>>2];l=+f[P>>2];o=+f[P+4>>2];if(a-l>(o-l)*.699999988079071){P=1;C=h>S;r=C?S:h;C=M<<1;P=C+P|0;C=(P|0)<15;P=C?15:P;s[i>>2]=P;u=x;return+r}if(l-a>(o-a)*.699999988079071){P=-1;C=h>S;r=C?S:h;C=M<<1;P=C+P|0;C=(P|0)<15;P=C?15:P;s[i>>2]=P;u=x;return+r}P=0;C=h>S;r=C?S:h;C=M<<1;P=C+P|0;C=(P|0)<15;P=C?15:P;s[i>>2]=P;u=x;return+r}function vi(e,t,i){e=e|0;t=t|0;i=i|0;var n=0,r=0,s=0,o=0,a=0,l=0,h=0,u=0,c=0,d=0,p=0;r=+f[t>>2];yr(e|0,0,i<<2|0)|0;if(+f[t>>2]!=0)h=0;else return;while(1){if((h|0)<(i|0)){n=0;s=0}else{n=9;break}while(1){if((h|0)==(n|0))break;o=s+ +f[e+(n<<2)>>2]*+f[t+(h-n<<2)>>2];n=n+1|0;s=o}a=h;h=h+1|0;s=(s+ +f[t+(h<<2)>>2])/r;o=-s;f[e+(a<<2)>>2]=o;n=h>>1;a=a+-1|0;l=0;while(1){if((l|0)>=(n|0))break;p=e+(l<<2)|0;c=+f[p>>2];u=e+(a-l<<2)|0;d=+f[u>>2];f[p>>2]=c+d*o;f[u>>2]=d+c*o;l=l+1|0}r=r-s*s*r;if(r<+f[t>>2]*.0010000000474974513){n=9;break}}if((n|0)==9)return}function ki(e,t,i,n,r){e=e|0;t=t|0;i=i|0;n=n|0;r=r|0;var o=0,a=0,l=0,h=0,c=0,d=0,p=0,b=0,w=0,m=0,g=0;w=u;u=u+112|0;d=w+96|0;p=w;b=u;u=u+((1*(n+24<<2)|0)+15&-16)|0;o=0;while(1){if((o|0)==24)break;s[p+(o<<2)>>2]=s[t+(24-o+-1<<2)>>2];o=o+1|0}o=0;while(1){if((o|0)==24){o=0;break}s[b+(o<<2)>>2]=s[r+(24-o+-1<<2)>>2];o=o+1|0}while(1){if((o|0)>=(n|0)){o=0;break}s[b+(o+24<<2)>>2]=s[e+(o<<2)>>2];o=o+1|0}while(1){if((o|0)==24)break;s[r+(o<<2)>>2]=s[e+(n-o+-1<<2)>>2];o=o+1|0}t=n+-3|0;r=d+4|0;l=d+8|0;h=d+12|0;o=((t|0)>0?t:0)+3&-4;c=0;while(1){if((c|0)>=(t|0))break;s[d>>2]=0;s[d+4>>2]=0;s[d+8>>2]=0;s[d+12>>2]=0;yi(p,b+(c<<2)|0,d,24);f[i+(c<<2)>>2]=+f[e+(c<<2)>>2]+ +f[d>>2];m=c|1;f[i+(m<<2)>>2]=+f[e+(m<<2)>>2]+ +f[r>>2];m=c|2;f[i+(m<<2)>>2]=+f[e+(m<<2)>>2]+ +f[l>>2];m=c|3;f[i+(m<<2)>>2]=+f[e+(m<<2)>>2]+ +f[h>>2];c=c+4|0}while(1){if((o|0)<(n|0)){t=0;a=0}else break;while(1){if((t|0)==24)break;g=a+ +f[p+(t<<2)>>2]*+f[b+(o+t<<2)>>2];t=t+1|0;a=g}f[i+(o<<2)>>2]=+f[e+(o<<2)>>2]+a;o=o+1|0}u=w;return}function yi(e,t,i,n){e=e|0;t=t|0;i=i|0;n=n|0;var r=0,s=0,o=0,a=0,l=0,h=0,u=0,c=0,d=0,p=0,b=0,w=0,m=0,g=0,_=0,v=0,k=0,y=0,E=0,A=0,T=0;l=n+-3|0;p=i+4|0;b=i+8|0;w=i+12|0;u=((l|0)>0?l:0)+3|0;c=u&-4;u=u|3;s=e;o=t+12|0;h=0;r=+f[t>>2];d=+f[t+4>>2];m=+f[t+8>>2];a=0;while(1){if((h|0)>=(l|0))break;y=+f[s>>2];a=+f[o>>2];T=+f[i>>2]+y*r;f[i>>2]=T;A=+f[p>>2]+y*d;f[p>>2]=A;E=+f[b>>2]+y*m;f[b>>2]=E;y=+f[w>>2]+y*a;f[w>>2]=y;k=+f[s+4>>2];v=+f[o+4>>2];T=T+k*d;f[i>>2]=T;A=A+k*m;f[p>>2]=A;E=E+k*a;f[b>>2]=E;k=y+k*v;f[w>>2]=k;y=+f[s+8>>2];_=+f[o+8>>2];T=T+y*m;f[i>>2]=T;A=A+y*a;f[p>>2]=A;E=E+y*v;f[b>>2]=E;y=k+y*_;f[w>>2]=y;k=+f[s+12>>2];g=+f[o+12>>2];f[i>>2]=T+k*a;f[p>>2]=A+k*v;f[b>>2]=E+k*_;f[w>>2]=y+k*g;s=s+16|0;o=o+16|0;h=h+4|0;r=v;d=_;m=g}o=e+(c<<2)|0;s=t+(u<<2)|0;l=c|1;if((c|0)<(n|0)){T=+f[o>>2];a=+f[s>>2];f[i>>2]=+f[i>>2]+T*r;f[p>>2]=+f[p>>2]+T*d;f[b>>2]=+f[b>>2]+T*m;f[w>>2]=+f[w>>2]+T*a;o=o+4|0;s=s+4|0}if((l|0)<(n|0)){T=+f[o>>2];r=+f[s>>2];f[i>>2]=+f[i>>2]+T*d;f[p>>2]=+f[p>>2]+T*m;f[b>>2]=+f[b>>2]+T*a;f[w>>2]=+f[w>>2]+T*r;o=o+4|0;s=s+4|0}if((l+1|0)>=(n|0))return;A=+f[o>>2];T=+f[s>>2];f[i>>2]=+f[i>>2]+A*m;f[p>>2]=+f[p>>2]+A*a;f[b>>2]=+f[b>>2]+A*r;f[w>>2]=+f[w>>2]+A*T;return}function Ei(e,t,i,n,r){e=e|0;t=t|0;i=i|0;n=n|0;r=r|0;var o=0,a=0,l=0,h=0,c=0,d=0,p=0,b=0,w=0,m=0,g=0,_=0,v=0,k=0,y=0,E=0,A=0,T=0,S=0;v=u;u=u+112|0;m=v+96|0;g=v;a=n+24|0;_=u;u=u+((1*(a<<2)|0)+15&-16)|0;o=0;while(1){if((o|0)==24)break;s[g+(o<<2)>>2]=s[t+(24-o+-1<<2)>>2];o=o+1|0}o=0;while(1){if((o|0)==24){o=24;break}f[_+(o<<2)>>2]=-+f[r+(24-o+-1<<2)>>2];o=o+1|0}while(1){if((o|0)>=(a|0))break;f[_+(o<<2)>>2]=0;o=o+1|0}a=n+-3|0;h=m+4|0;c=m+8|0;d=m+12|0;p=t+4|0;b=t+8|0;o=n+-3|0;o=((o|0)>0?o:0)+3&-4;w=0;while(1){if((w|0)>=(a|0))break;s[m>>2]=s[e+(w<<2)>>2];S=w|1;s[h>>2]=s[e+(S<<2)>>2];A=w|2;s[c>>2]=s[e+(A<<2)>>2];k=w|3;s[d>>2]=s[e+(k<<2)>>2];yi(g,_+(w<<2)|0,m,24);T=+f[m>>2];l=-T;f[_+(w+24<<2)>>2]=l;f[i+(w<<2)>>2]=T;T=+f[h>>2]+ +f[t>>2]*l;f[h>>2]=T;y=-T;f[_+(w+25<<2)>>2]=y;f[i+(S<<2)>>2]=T; -T=+f[c>>2]+ +f[t>>2]*y+ +f[p>>2]*l;f[c>>2]=T;E=-T;f[_+(w+26<<2)>>2]=E;f[i+(A<<2)>>2]=T;l=+f[d>>2]+ +f[t>>2]*E+ +f[p>>2]*y+ +f[b>>2]*l;f[d>>2]=l;f[_+(w+27<<2)>>2]=-l;f[i+(k<<2)>>2]=l;w=w+4|0}while(1){if((o|0)>=(n|0)){o=0;break}a=0;l=+f[e+(o<<2)>>2];while(1){if((a|0)==24)break;T=l-+f[g+(a<<2)>>2]*+f[_+(o+a<<2)>>2];a=a+1|0;l=T}f[_+(o+24<<2)>>2]=l;f[i+(o<<2)>>2]=l;o=o+1|0}while(1){if((o|0)==24)break;s[r+(o<<2)>>2]=s[i+(n-o+-1<<2)>>2];o=o+1|0}u=v;return}function Ai(e,t,i,n,r,o){e=e|0;t=t|0;i=i|0;n=n|0;r=r|0;o=o|0;var a=0,l=0,h=0,c=0,d=0,p=0;d=u;c=o-r|0;h=u;u=u+((1*(o<<2)|0)+15&-16)|0;e:do if(!n)h=e;else{l=0;while(1){if((l|0)>=(o|0)){l=0;break}s[h+(l<<2)>>2]=s[e+(l<<2)>>2];l=l+1|0}while(1){if((l|0)>=(n|0))break e;a=+f[i+(l<<2)>>2];f[h+(l<<2)>>2]=+f[e+(l<<2)>>2]*a;p=o-l+-1|0;f[h+(p<<2)>>2]=+f[e+(p<<2)>>2]*a;l=l+1|0}}while(0);wi(h,h,t,c,r+1|0);n=0;while(1){if((n|0)>(r|0))break;a=0;l=n+c|0;while(1){if((l|0)>=(o|0))break;a=a+ +f[h+(l<<2)>>2]*+f[h+(l-n<<2)>>2];l=l+1|0}p=t+(n<<2)|0;f[p>>2]=+f[p>>2]+a;n=n+1|0}u=d;return}function Ti(e,t,i,n,r,o,a,l,h,c,d,p,b,w,m,g,_){e=e|0;t=t|0;i=i|0;n=n|0;r=r|0;o=o|0;a=a|0;l=l|0;h=h|0;c=c|0;d=d|0;p=p|0;b=b|0;w=w|0;m=m|0;g=g|0;_=_|0;var v=0,k=0,y=0,E=0,A=0,T=0,S=0,M=0,R=0,C=0,P=0,x=0,I=0,O=0,N=0,D=0,L=0,U=0,B=0,j=0,F=0,G=0,H=0,z=0,q=0,W=0;q=u;u=u+96|0;F=q+72|0;G=q+48|0;H=q+24|0;z=q;if(!b)if((m|0)==0?(v=i-t|0,+f[w>>2]>+(te(c<<1,v)|0)):0)E=(te(v,c)|0)<(p|0);else E=0;else E=1;y=+(a>>>0)*+f[w>>2]*+(g|0)/+(c<<9|0);j=e+8|0;A=s[j>>2]|0;g=0;k=0;do{b=te(g,A)|0;v=t;while(1){if((v|0)>=(n|0))break;U=v+b|0;W=+f[r+(U<<2)>>2]-+f[o+(U<<2)>>2];k=k+W*W;v=v+1|0}g=g+1|0}while((g|0)<(c|0));U=~~y;y=k>200?200:k;D=h+20|0;g=s[D>>2]|0;L=h+28|0;b=s[L>>2]|0;N=g+((ne(b|0)|0)+-32)|0;v=(N+3|0)>>>0>a>>>0;O=v?0:E&1;if((i-t|0)>10?(T=+(p|0)*.125,!(T>16)):0)k=T;else k=16;k=(_|0)==0?k:3;s[F>>2]=s[h>>2];s[F+4>>2]=s[h+4>>2];s[F+8>>2]=s[h+8>>2];s[F+12>>2]=s[h+12>>2];s[F+16>>2]=s[h+16>>2];s[F+20>>2]=s[h+20>>2];I=h+24|0;C=s[I>>2]|0;s[G>>2]=s[L>>2];s[G+4>>2]=s[L+4>>2];s[G+8>>2]=s[L+8>>2];s[G+12>>2]=s[L+12>>2];s[G+16>>2]=s[L+16>>2];R=te(A,c)|0;P=u;u=u+((1*(R<<2)|0)+15&-16)|0;x=u;u=u+((1*(R<<2)|0)+15&-16)|0;Sr(P|0,o|0,R<<2|0)|0;R=v|(m|0)==0;if(R)if(!O){M=C;S=0}else{Si(e,t,i,r,P,a,N,29009+(d*84|0)+42|0,x,h,c,d,1,k,_)|0;B=22}else{v=Si(e,t,i,r,P,a,N,29009+(d*84|0)+42|0,x,h,c,d,1,k,_)|0;if(!O){g=s[D>>2]|0;b=s[L>>2]|0;M=s[I>>2]|0;S=v}else B=22}if((B|0)==22){Sr(o|0,P|0,(te(s[j>>2]|0,c)|0)<<2|0)|0;Sr(l|0,x|0,(te(s[j>>2]|0,c)|0)<<2|0)|0;W=y;f[w>>2]=W;u=q;return}E=32-(ne(b|0)|0)|0;n=b>>>(E+-16|0);b=(n>>>12)+-8|0;b=(g<<3)-((E<<3)+(b+(n>>>0>(s[5272+(b<<2)>>2]|0)>>>0&1)))|0;g=s[h>>2]|0;n=h+4|0;s[H>>2]=s[n>>2];s[H+4>>2]=s[n+4>>2];s[H+8>>2]=s[n+8>>2];s[H+12>>2]=s[n+12>>2];s[H+16>>2]=s[n+16>>2];s[z>>2]=s[L>>2];s[z+4>>2]=s[L+4>>2];s[z+8>>2]=s[L+8>>2];s[z+12>>2]=s[L+12>>2];s[z+16>>2]=s[L+16>>2];E=g+C|0;p=M-C|0;A=Ne()|0;m=u;u=u+((1*((M|0)==(C|0)?1:p)|0)+15&-16)|0;Sr(m|0,E|0,p|0)|0;s[h>>2]=s[F>>2];s[h+4>>2]=s[F+4>>2];s[h+8>>2]=s[F+8>>2];s[h+12>>2]=s[F+12>>2];s[h+16>>2]=s[F+16>>2];s[h+20>>2]=s[F+20>>2];s[I>>2]=C;s[L>>2]=s[G>>2];s[L+4>>2]=s[G+4>>2];s[L+8>>2]=s[G+8>>2];s[L+12>>2]=s[G+12>>2];s[L+16>>2]=s[G+16>>2];v=Si(e,t,i,r,o,a,N,29009+(d*84|0)+(O*42|0)|0,l,h,c,d,0,k,_)|0;do if(!R){if((S|0)>=(v|0)){if((S|0)!=(v|0))break;e=s[L>>2]|0;_=32-(ne(e|0)|0)|0;e=e>>>(_+-16|0);t=(e>>>12)+-8|0;if(((s[D>>2]<<3)-((_<<3)+(t+(e>>>0>(s[5272+(t<<2)>>2]|0)>>>0&1)))+U|0)<=(b|0))break}s[h>>2]=g;s[n>>2]=s[H>>2];s[n+4>>2]=s[H+4>>2];s[n+8>>2]=s[H+8>>2];s[n+12>>2]=s[H+12>>2];s[n+16>>2]=s[H+16>>2];s[I>>2]=M;s[L>>2]=s[z>>2];s[L+4>>2]=s[z+4>>2];s[L+8>>2]=s[z+8>>2];s[L+12>>2]=s[z+12>>2];s[L+16>>2]=s[z+16>>2];Sr(E|0,m|0,p|0)|0;Sr(o|0,P|0,(te(s[j>>2]|0,c)|0)<<2|0)|0;Sr(l|0,x|0,(te(s[j>>2]|0,c)|0)<<2|0)|0;He(A|0);W=y;f[w>>2]=W;u=q;return}while(0);He(A|0);W=+f[17336+(d<<2)>>2];W=W*W*+f[w>>2]+y;f[w>>2]=W;u=q;return}function Si(e,t,i,r,a,l,h,c,d,p,b,w,m,g,_){e=e|0;t=t|0;i=i|0;r=r|0;a=a|0;l=l|0;h=h|0;c=c|0;d=d|0;p=p|0;b=b|0;w=w|0;m=m|0;g=+g;_=_|0;var v=0,k=0,y=0,E=0,A=0,T=0,S=0,M=0,R=0,C=0,P=0,x=0,I=0,O=0,N=0,D=0,L=0,U=0,B=0,j=0,F=0,H=0,z=0,q=0,W=0,V=0,Y=0,Z=0,$=0,K=0,X=0,J=0,Q=0,ee=0,ie=0;ie=u;u=u+16|0;ee=ie;X=ee;s[X>>2]=0;s[X+4>>2]=0;e:do if((h+3|0)<=(l|0)){O=p+28|0;v=s[O>>2]|0;h=v>>>3;v=v-h|0;I=p+32|0;if(!m)h=v;else s[I>>2]=(s[I>>2]|0)+v;s[O>>2]=h;T=p+36|0;S=p+20|0;M=p+40|0;R=p+24|0;C=p+8|0;P=p+4|0;x=p+44|0;while(1){if(h>>>0>=8388609)break e;v=s[I>>2]|0;y=v>>>23;if((y|0)==255)s[T>>2]=(s[T>>2]|0)+1;else{k=v>>>31;h=s[M>>2]|0;if((h|0)>-1){v=s[R>>2]|0;if((v+(s[C>>2]|0)|0)>>>0<(s[P>>2]|0)>>>0){s[R>>2]=v+1;n[(s[p>>2]|0)+v>>0]=h+k;h=0}else h=-1;s[x>>2]=s[x>>2]|h}h=s[T>>2]|0;if(h|0){k=k+255&255;do{v=s[R>>2]|0;if((v+(s[C>>2]|0)|0)>>>0<(s[P>>2]|0)>>>0){s[R>>2]=v+1;n[(s[p>>2]|0)+v>>0]=k;v=0;h=s[T>>2]|0}else v=-1;s[x>>2]=s[x>>2]|v;h=h+-1|0;s[T>>2]=h}while((h|0)!=0)}s[M>>2]=y&255;v=s[I>>2]|0;h=s[O>>2]|0}s[I>>2]=v<<8&2147483392;h=h<<8;s[O>>2]=h;s[S>>2]=(s[S>>2]|0)+8}}while(0);if(!m){Q=+f[17320+(w<<2)>>2];J=+f[17336+(w<<2)>>2]}else{Q=.149993896484375;J=0}Z=e+8|0;$=p+20|0;K=p+28|0;X=b*3|0;e=(_|0)==0;_=p+32|0;U=p+36|0;B=p+40|0;j=p+24|0;F=p+8|0;H=p+4|0;z=p+44|0;h=0;Y=t;while(1){if((Y|0)>=(i|0))break;q=te(X,i-Y|0)|0;W=(Y|0)!=(t|0);V=(Y|0)<20;w=0;do{m=Y+(te(w,s[Z>>2]|0)|0)|0;A=+f[r+(m<<2)>>2];E=+f[a+(m<<2)>>2];L=J*(E<-9?-9:E);m=ee+(w<<2)|0;N=+f[m>>2];D=A-L-N;v=~~+G(+(D+.5));E=(E<-28?-28:E)-g;if((v|0)<0&A0?0:O}else O=v;y=s[$>>2]|0;I=s[K>>2]|0;T=y+((ne(I|0)|0)+-32)|0;S=l-T|0;k=S-q|0;if((k|0)<24&W){v=(O|0)>1?1:O;if((k|0)<16)v=(v|0)<-1?-1:v}else v=O;v=e|(Y|0)<2|(v|0)<0?v:0;e:do if((S|0)<=14)if((S|0)>1){v=(v|0)<-1?-1:(v|0)<1?v:1;k=v<<1^v>>31;T=I>>>2;if((k|0)>0){x=o[29345+(k+-1)>>0]|0;I=I-(te(T,x)|0)|0;s[_>>2]=(s[_>>2]|0)+I;k=te(T,x-(o[29345+k>>0]|0)|0)|0}else k=I-(te(T,o[29345+k>>0]|0)|0)|0;s[K>>2]=k;while(1){if(k>>>0>=8388609)break e;T=s[_>>2]|0;S=T>>>23;if((S|0)==255)s[U>>2]=(s[U>>2]|0)+1;else{T=T>>>31;k=s[B>>2]|0;if((k|0)>-1){y=s[j>>2]|0;if((y+(s[F>>2]|0)|0)>>>0<(s[H>>2]|0)>>>0){s[j>>2]=y+1;n[(s[p>>2]|0)+y>>0]=k+T;k=0}else k=-1;s[z>>2]=s[z>>2]|k}k=s[U>>2]|0;if(k|0){T=T+255&255;do{y=s[j>>2]|0;if((y+(s[F>>2]|0)|0)>>>0<(s[H>>2]|0)>>>0){s[j>>2]=y+1;n[(s[p>>2]|0)+y>>0]=T;y=0;k=s[U>>2]|0}else y=-1;s[z>>2]=s[z>>2]|y;k=k+-1|0;s[U>>2]=k}while((k|0)!=0)}s[B>>2]=S&255;T=s[_>>2]|0;k=s[K>>2]|0;y=s[$>>2]|0}s[_>>2]=T<<8&2147483392;k=k<<8;s[K>>2]=k;y=y+8|0;s[$>>2]=y}}else{if((T|0)>=(l|0)){v=-1;break}T=I>>>1;k=I-T|0;if((v|0)>-1)v=0;else{s[_>>2]=(s[_>>2]|0)+k;k=T}s[K>>2]=k;while(1){if(k>>>0>=8388609)break e;T=s[_>>2]|0;S=T>>>23;if((S|0)==255)s[U>>2]=(s[U>>2]|0)+1;else{T=T>>>31;k=s[B>>2]|0;if((k|0)>-1){y=s[j>>2]|0;if((y+(s[F>>2]|0)|0)>>>0<(s[H>>2]|0)>>>0){s[j>>2]=y+1;n[(s[p>>2]|0)+y>>0]=k+T;k=0}else k=-1;s[z>>2]=s[z>>2]|k}k=s[U>>2]|0;if(k|0){T=T+255&255;do{y=s[j>>2]|0;if((y+(s[F>>2]|0)|0)>>>0<(s[H>>2]|0)>>>0){s[j>>2]=y+1;n[(s[p>>2]|0)+y>>0]=T;y=0;k=s[U>>2]|0}else y=-1;s[z>>2]=s[z>>2]|y;k=k+-1|0;s[U>>2]=k}while((k|0)!=0)}s[B>>2]=S&255;T=s[_>>2]|0;k=s[K>>2]|0;y=s[$>>2]|0}s[_>>2]=T<<8&2147483392;k=k<<8;s[K>>2]=k;y=y+8|0;s[$>>2]=y}}else{S=(V?Y:20)<<1;k=(o[c+S>>0]|0)<<7;S=(o[c+(S|1)>>0]|0)<<6;if(v){P=v>>31;M=v+P^P;T=te(32736-k|0,16384-S|0)|0;R=k;C=1;while(1){k=T>>>15;if(!k){x=36;break}if((M|0)<=(C|0)){x=37;break}x=k<<1;T=te(x,S)|0;R=R+(x+2)|0;C=C+1|0}if((x|0)==36){x=0;S=M-C|0;v=(32768-R-P>>1)+-1|0;v=(S|0)<(v|0)?S:v;S=R+((v<<1|1)+P)|0;k=32768-S|0;k=k>>>0>1?1:k;v=C+v+P^P}else if((x|0)==37){x=0;S=k+1|0;k=S;S=R+(S&~P)|0}T=I>>>15;if(!S)x=40;else{I=I-(te(T,32768-S|0)|0)|0;s[_>>2]=(s[_>>2]|0)+I;k=te(T,k)|0}}else{T=I>>>15;v=0;x=40}if((x|0)==40)k=I-(te(T,32768-k|0)|0)|0;s[K>>2]=k;T=k;k=y;while(1){if(T>>>0>=8388609)break e;y=s[_>>2]|0;S=y>>>23;if((S|0)==255)s[U>>2]=(s[U>>2]|0)+1;else{T=y>>>31;k=s[B>>2]|0;if((k|0)>-1){y=s[j>>2]|0;if((y+(s[F>>2]|0)|0)>>>0<(s[H>>2]|0)>>>0){s[j>>2]=y+1;n[(s[p>>2]|0)+y>>0]=k+T;k=0}else k=-1;s[z>>2]=s[z>>2]|k}k=s[U>>2]|0;if(k|0){T=T+255&255;do{y=s[j>>2]|0;if((y+(s[F>>2]|0)|0)>>>0<(s[H>>2]|0)>>>0){s[j>>2]=y+1;n[(s[p>>2]|0)+y>>0]=T;y=0;k=s[U>>2]|0}else y=-1;s[z>>2]=s[z>>2]|y;k=k+-1|0;s[U>>2]=k}while((k|0)!=0)}s[B>>2]=S&255;y=s[_>>2]|0;T=s[K>>2]|0;k=s[$>>2]|0}s[_>>2]=y<<8&2147483392;T=T<<8;s[K>>2]=T;k=k+8|0;s[$>>2]=k}}while(0);A=+(v|0);f[d+(Y+(te(w,s[Z>>2]|0)|0)<<2)>>2]=D-A;O=O-v|0;h=h+((O|0)>-1?O:0-O|0)|0;f[a+(Y+(te(w,s[Z>>2]|0)|0)<<2)>>2]=L+N+A;f[m>>2]=N+A-Q*A;w=w+1|0}while((w|0)<(b|0));Y=Y+1|0}u=ie;return(e?h:0)|0}function Mi(e,t,i,a,l,f,h,c,d,p,b,w,m,g,_,v,k,y,E){e=e|0;t=t|0;i=i|0;a=a|0;l=l|0;f=f|0;h=h|0;c=c|0;d=d|0;p=p|0;b=b|0;w=w|0;m=m|0;g=g|0;_=_|0;v=v|0;k=k|0;y=y|0;E=E|0;var A=0,T=0,S=0,M=0,R=0,C=0,P=0,x=0,I=0,O=0,N=0,D=0,L=0,U=0,B=0,j=0,F=0,G=0,H=0,z=0,q=0,W=0,V=0,Y=0,Z=0,$=0,K=0,X=0,J=0,Q=0,ee=0,ie=0;ie=u;d=(d|0)>0?d:0;I=s[e+8>>2]|0;G=(d|0)>7?8:0;d=d-G|0;ee=(g|0)==2;if(ee?(A=o[29348+(i-t)>>0]|0,(d|0)>=(A|0)):0){d=d-A|0;Y=(d|0)>7?8:0;d=d-Y|0}else{Y=0;A=0}U=u;u=u+((1*(I<<2)|0)+15&-16)|0;B=u;u=u+((1*(I<<2)|0)+15&-16)|0;F=u;u=u+((1*(I<<2)|0)+15&-16)|0;L=u;u=u+((1*(I<<2)|0)+15&-16)|0;J=g<<3;Q=e+32|0;f=f+-5-_|0;T=_+3|0;S=t;while(1){if((S|0)>=(i|0))break;K=S+1|0;$=s[Q>>2]|0;$=(r[$+(K<<1)>>1]|0)-(r[$+(S<<1)>>1]|0)|0;Z=$*3<<_<<3>>4;s[F+(S<<2)>>2]=(J|0)>(Z|0)?J:Z;Z=(te(te(te($,g)|0,f)|0,i-S+-1|0)|0)<>6;s[L+(S<<2)>>2]=Z-(($<<_|0)==1?J:0);S=K}O=s[e+48>>2]|0;N=e+52|0;x=O+-1|0;D=1;do{R=D+x>>1;C=te(R,I)|0;P=0;f=i;T=0;e:while(1){t:while(1){M=f;do{f=M;M=M+-1|0;if((f|0)<=(t|0))break e;K=s[Q>>2]|0;f=te((r[K+(f<<1)>>1]|0)-(r[K+(M<<1)>>1]|0)|0,g)|0;f=(te(f,o[(s[N>>2]|0)+(C+M)>>0]|0)|0)<<_>>2;if((f|0)>0){f=f+(s[L+(M<<2)>>2]|0)|0;f=(f|0)<0?0:f}S=f+(s[a+(M<<2)>>2]|0)|0;if((S|0)>=(s[F+(M<<2)>>2]|0)|P)break t}while((S|0)<(J|0));f=M;T=T+J|0}K=s[l+(M<<2)>>2]|0;P=1;f=M;T=T+((S|0)<(K|0)?S:K)|0}K=(T|0)>(d|0);D=K?D:R+1|0;x=K?R+-1|0:x}while((D|0)<=(x|0));x=te(D+-1|0,I)|0;M=te(D,I)|0;R=(D|0)>1;P=t;j=t;while(1){if((P|0)>=(i|0))break;C=P+1|0;f=s[Q>>2]|0;f=te((r[f+(C<<1)>>1]|0)-(r[f+(P<<1)>>1]|0)|0,g)|0;T=s[N>>2]|0;S=(te(f,o[T+(x+P)>>0]|0)|0)<<_>>2;if((D|0)<(O|0))f=(te(f,o[T+(M+P)>>0]|0)|0)<<_>>2;else f=s[l+(P<<2)>>2]|0;if((S|0)>0){T=S+(s[L+(P<<2)>>2]|0)|0;T=(T|0)<0?0:T}else T=S;if((f|0)>0){f=f+(s[L+(P<<2)>>2]|0)|0;f=(f|0)<0?0:f}K=s[a+(P<<2)>>2]|0;$=T+(R?K:0)|0;Z=f+K|0;K=(K|0)>0?P:j;s[U+(P<<2)>>2]=$;s[B+(P<<2)>>2]=(Z|0)<($|0)?0:Z-$|0;P=C;j=K}Z=(g|0)>1;K=Z&1;C=64;P=0;x=0;while(1){if((P|0)==6)break;M=x+C>>1;R=0;f=i;T=0;e:while(1){t:while(1){do{$=f;f=f+-1|0;if(($|0)<=(t|0))break e;S=(s[U+(f<<2)>>2]|0)+((te(M,s[B+(f<<2)>>2]|0)|0)>>6)|0;if((S|0)>=(s[F+(f<<2)>>2]|0)|R)break t}while((S|0)<(J|0));T=T+J|0}$=s[l+(f<<2)>>2]|0;R=1;T=T+((S|0)<($|0)?S:$)|0}$=(T|0)>(d|0);C=$?M:C;P=P+1|0;x=$?x:M}$=_<<3;T=0;S=i;M=0;while(1){f=S+-1|0;if((S|0)<=(t|0))break;W=(s[U+(f<<2)>>2]|0)+((te(x,s[B+(f<<2)>>2]|0)|0)>>6)|0;S=(T|0)==0?(W|0)<(s[F+(f<<2)>>2]|0):0;W=S?(W|0)<(J|0)?0:J:W;V=s[l+(f<<2)>>2]|0;V=(W|0)<(V|0)?W:V;s[b+(f<<2)>>2]=V;T=S&1^1;S=f;M=M+V|0}O=J+8|0;N=(k|0)==0;B=v+28|0;k=v+32|0;H=v+20|0;z=v+40|0;q=v+24|0;W=v+4|0;I=t+2|0;D=v+36|0;L=v+8|0;a=v+44|0;V=i;U=M;e:while(1){P=V+-1|0;if((P|0)<=(j|0)){X=45;break}R=d-U|0;f=s[Q>>2]|0;x=r[f+(V<<1)>>1]|0;S=r[f+(t<<1)>>1]|0;T=x-S|0;C=(R>>>0)/(T>>>0)|0;T=R-(te(T,C)|0)|0;f=r[f+(P<<1)>>1]|0;S=T+(S-f)|0;f=x-f|0;x=b+(P<<2)|0;T=s[x>>2]|0;S=T+(te(C,f)|0)+((S|0)>0?S:0)|0;C=s[F+(P<<2)>>2]|0;if((S|0)<(((C|0)>(O|0)?C:O)|0)){M=T;T=U}else{t:do if(N){f=s[B>>2]|0;M=s[k>>2]|0;T=f>>>1;C=M>>>0>>0;if(C)f=M;else{R=M-T|0;s[k>>2]=R;T=f-T|0;f=R}s[B>>2]=T;while(1){if(T>>>0>=8388609)break;s[H>>2]=(s[H>>2]|0)+8;T=T<<8;s[B>>2]=T;R=s[z>>2]|0;M=s[q>>2]|0;if(M>>>0<(s[W>>2]|0)>>>0){s[q>>2]=M+1;M=o[(s[v>>2]|0)+M>>0]|0}else M=0;s[z>>2]=M;R=((R<<8|M)>>>1&255|f<<8&2147483392)^255;s[k>>2]=R;f=R}if(C)break e}else{if((V|0)<=(I|0)){X=50;break e}if(!((P|0)>(E|0)?1:(S|0)<=((te((V|0)<=(y|0)?7:9,f)|0)<<_<<3>>4|0))){X=50;break e}f=s[B>>2]|0;f=f-(f>>>1)|0;s[B>>2]=f;while(1){if(f>>>0>=8388609)break t;T=s[k>>2]|0;R=T>>>23;if((R|0)==255)s[D>>2]=(s[D>>2]|0)+1;else{M=T>>>31;f=s[z>>2]|0;if((f|0)>-1){T=s[q>>2]|0;if((T+(s[L>>2]|0)|0)>>>0<(s[W>>2]|0)>>>0){s[q>>2]=T+1;n[(s[v>>2]|0)+T>>0]=f+M;f=0}else f=-1;s[a>>2]=s[a>>2]|f}f=s[D>>2]|0;if(f|0){M=M+255&255;do{T=s[q>>2]|0;if((T+(s[L>>2]|0)|0)>>>0<(s[W>>2]|0)>>>0){s[q>>2]=T+1;n[(s[v>>2]|0)+T>>0]=M;T=0;f=s[D>>2]|0}else T=-1;s[a>>2]=s[a>>2]|T;f=f+-1|0;s[D>>2]=f}while((f|0)!=0)}s[z>>2]=R&255;T=s[k>>2]|0;f=s[B>>2]|0}s[k>>2]=T<<8&2147483392;f=f<<8;s[B>>2]=f;s[H>>2]=(s[H>>2]|0)+8}}while(0);M=s[x>>2]|0;S=S+-8|0;T=U+8|0}if((A|0)>0)f=o[29348+(P-t)>>0]|0;else f=A;V=(S|0)<(J|0);U=T-(M+A)+f+(V?0:J)|0;s[x>>2]=V?0:J;A=f;V=P}e:do if((X|0)==45)d=d+G|0;else if((X|0)==50){T=s[B>>2]|0;f=T>>>1;T=(s[k>>2]|0)+(T-f)|0;s[k>>2]=T;s[B>>2]=f;while(1){if(f>>>0>=8388609)break e;M=T>>>23;if((M|0)==255)s[D>>2]=(s[D>>2]|0)+1;else{S=T>>>31;f=s[z>>2]|0;if((f|0)>-1){T=s[q>>2]|0;if((T+(s[L>>2]|0)|0)>>>0<(s[W>>2]|0)>>>0){s[q>>2]=T+1;n[(s[v>>2]|0)+T>>0]=f+S;f=0}else f=-1;s[a>>2]=s[a>>2]|f}f=s[D>>2]|0;if(f|0){S=S+255&255;do{T=s[q>>2]|0;if((T+(s[L>>2]|0)|0)>>>0<(s[W>>2]|0)>>>0){s[q>>2]=T+1;n[(s[v>>2]|0)+T>>0]=S;T=0;f=s[D>>2]|0}else T=-1;s[a>>2]=s[a>>2]|T;f=f+-1|0;s[D>>2]=f}while((f|0)!=0)}s[z>>2]=M&255;T=s[k>>2]|0;f=s[B>>2]|0}T=T<<8&2147483392;s[k>>2]=T;f=f<<8;s[B>>2]=f;s[H>>2]=(s[H>>2]|0)+8}}while(0);e:do if((A|0)>0){if(N){s[h>>2]=(hi(v,V+1-t|0)|0)+t;break}T=s[h>>2]|0;T=(T|0)<(V|0)?T:V;s[h>>2]=T;R=T-t|0;S=V+1-t|0;f=S+-1|0;A=32-(ne(f|0)|0)|0;if((A|0)<=8){f=s[B>>2]|0;A=(f>>>0)/(S>>>0)|0;if((T|0)==(t|0))A=f-(te(A,S-(R+1)|0)|0)|0;else{E=f-(te(A,S-R|0)|0)|0;s[k>>2]=(s[k>>2]|0)+E}s[B>>2]=A;while(1){if(A>>>0>=8388609)break e;f=s[k>>2]|0;S=f>>>23;if((S|0)==255)s[D>>2]=(s[D>>2]|0)+1;else{T=f>>>31;A=s[z>>2]|0;if((A|0)>-1){f=s[q>>2]|0;if((f+(s[L>>2]|0)|0)>>>0<(s[W>>2]|0)>>>0){s[q>>2]=f+1;n[(s[v>>2]|0)+f>>0]=A+T;A=0}else A=-1;s[a>>2]=s[a>>2]|A}A=s[D>>2]|0;if(A|0){T=T+255&255;do{f=s[q>>2]|0;if((f+(s[L>>2]|0)|0)>>>0<(s[W>>2]|0)>>>0){s[q>>2]=f+1;n[(s[v>>2]|0)+f>>0]=T;f=0;A=s[D>>2]|0}else f=-1;s[a>>2]=s[a>>2]|f;A=A+-1|0;s[D>>2]=A}while((A|0)!=0)}s[z>>2]=S&255;f=s[k>>2]|0;A=s[B>>2]|0}s[k>>2]=f<<8&2147483392;A=A<<8;s[B>>2]=A;s[H>>2]=(s[H>>2]|0)+8}}I=A+-8|0;f=f>>>I;T=f+1|0;S=R>>>I;M=s[B>>2]|0;A=(M>>>0)/(T>>>0)|0;if(!S)A=M-(te(A,f)|0)|0;else{E=M-(te(A,T-S|0)|0)|0;s[k>>2]=(s[k>>2]|0)+E}s[B>>2]=A;while(1){if(A>>>0>=8388609)break;f=s[k>>2]|0;S=f>>>23;if((S|0)==255)s[D>>2]=(s[D>>2]|0)+1;else{T=f>>>31;A=s[z>>2]|0;if((A|0)>-1){f=s[q>>2]|0;if((f+(s[L>>2]|0)|0)>>>0<(s[W>>2]|0)>>>0){s[q>>2]=f+1;n[(s[v>>2]|0)+f>>0]=A+T;A=0}else A=-1;s[a>>2]=s[a>>2]|A}A=s[D>>2]|0;if(A|0){T=T+255&255;do{f=s[q>>2]|0;if((f+(s[L>>2]|0)|0)>>>0<(s[W>>2]|0)>>>0){s[q>>2]=f+1;n[(s[v>>2]|0)+f>>0]=T;f=0;A=s[D>>2]|0}else f=-1;s[a>>2]=s[a>>2]|f;A=A+-1|0;s[D>>2]=A}while((A|0)!=0)}s[z>>2]=S&255;f=s[k>>2]|0;A=s[B>>2]|0}s[k>>2]=f<<8&2147483392;A=A<<8;s[B>>2]=A;s[H>>2]=(s[H>>2]|0)+8}C=(1<>2]|0;x=v+16|0;f=s[x>>2]|0;if((f+I|0)>>>0>32){M=7-f|0;M=f+((M|0)>-8?M:-8)&-8;R=f;do{T=s[L>>2]|0;S=s[W>>2]|0;if(((s[q>>2]|0)+T|0)>>>0>>0){T=T+1|0;s[L>>2]=T;n[(s[v>>2]|0)+(S-T)>>0]=A;T=0}else T=-1;s[a>>2]=s[a>>2]|T;A=A>>>8;R=R+-8|0}while((R|0)>7);f=f+-8-M|0}s[P>>2]=A|C<>2]=f+I;s[H>>2]=(s[H>>2]|0)+I}else s[h>>2]=0;while(0);e:do if((s[h>>2]|0)>(t|0))if(!Y)X=169;else{if(N){A=s[B>>2]|0;T=s[k>>2]|0;f=A>>>1;Y=T>>>0>>0;M=Y&1;if(Y)A=T;else{Y=T-f|0;s[k>>2]=Y;f=A-f|0;A=Y}s[B>>2]=f;while(1){if(f>>>0>=8388609)break;s[H>>2]=(s[H>>2]|0)+8;f=f<<8;s[B>>2]=f;S=s[z>>2]|0;T=s[q>>2]|0;if(T>>>0<(s[W>>2]|0)>>>0){s[q>>2]=T+1;T=o[(s[v>>2]|0)+T>>0]|0}else T=0;s[z>>2]=T;Y=((S<<8|T)>>>1&255|A<<8&2147483392)^255;s[k>>2]=Y;A=Y}s[c>>2]=M;break}f=s[B>>2]|0;A=f>>>1;f=f-A|0;if(!(s[c>>2]|0))A=f;else s[k>>2]=(s[k>>2]|0)+f;s[B>>2]=A;while(1){if(A>>>0>=8388609)break e;f=s[k>>2]|0;S=f>>>23;if((S|0)==255)s[D>>2]=(s[D>>2]|0)+1;else{T=f>>>31;A=s[z>>2]|0;if((A|0)>-1){f=s[q>>2]|0;if((f+(s[L>>2]|0)|0)>>>0<(s[W>>2]|0)>>>0){s[q>>2]=f+1;n[(s[v>>2]|0)+f>>0]=A+T;A=0}else A=-1;s[a>>2]=s[a>>2]|A}A=s[D>>2]|0;if(A|0){T=T+255&255;do{f=s[q>>2]|0;if((f+(s[L>>2]|0)|0)>>>0<(s[W>>2]|0)>>>0){s[q>>2]=f+1;n[(s[v>>2]|0)+f>>0]=T;f=0;A=s[D>>2]|0}else f=-1;s[a>>2]=s[a>>2]|f;A=A+-1|0;s[D>>2]=A}while((A|0)!=0)}s[z>>2]=S&255;f=s[k>>2]|0;A=s[B>>2]|0}s[k>>2]=f<<8&2147483392;A=A<<8;s[B>>2]=A;s[H>>2]=(s[H>>2]|0)+8}}else{d=d+Y|0;X=169}while(0);if((X|0)==169)s[c>>2]=0;f=d-U|0;T=s[Q>>2]|0;T=(r[T+(V<<1)>>1]|0)-(r[T+(t<<1)>>1]|0)|0;d=(f>>>0)/(T>>>0)|0;T=te(T,d)|0;A=t;while(1){if((A|0)>=(V|0))break;X=A+1|0;Y=s[Q>>2]|0;Y=te(d,(r[Y+(X<<1)>>1]|0)-(r[Y+(A<<1)>>1]|0)|0)|0;v=b+(A<<2)|0;s[v>>2]=(s[v>>2]|0)+Y;A=X}A=t;d=f-T|0;while(1){if((A|0)>=(V|0))break;v=A+1|0;X=s[Q>>2]|0;X=(r[X+(v<<1)>>1]|0)-(r[X+(A<<1)>>1]|0)|0;X=(d|0)<(X|0)?d:X;Y=b+(A<<2)|0;s[Y>>2]=(s[Y>>2]|0)+X;A=v;d=d-X|0}O=e+56|0;x=Z?4:3;I=0;while(1){if((t|0)>=(V|0))break;P=t+1|0;S=s[Q>>2]|0;S=(r[S+(P<<1)>>1]|0)-(r[S+(t<<1)>>1]|0)<<_;C=b+(t<<2)|0;A=(s[C>>2]|0)+I|0;if((S|0)>1){d=s[l+(t<<2)>>2]|0;d=(A|0)>(d|0)?A-d|0:0;M=A-d|0;s[C>>2]=M;A=te(S,g)|0;if(ee&(S|0)>2?(s[c>>2]|0)==0:0)f=(t|0)<(s[h>>2]|0);else f=0;R=A+(f&1)|0;T=te(R,(r[(s[O>>2]|0)+(t<<1)>>1]|0)+$|0)|0;A=(T>>1)+(te(R,-21)|0)|0;if((S|0)==2)A=A+(R<<3>>2)|0;f=M+A|0;if((f|0)>=(R<<4|0))if((f|0)<(R*24|0))S=A+(T>>3)|0;else S=A;else S=A+(T>>2)|0;A=M+S+(R<<2)|0;A=((((A|0)<0?0:A)>>>0)/(R>>>0)|0)>>>3;T=w+(t<<2)|0;s[T>>2]=A;e=te(A,g)|0;f=s[C>>2]|0;if((e|0)>(f>>3|0)){A=f>>K>>3;s[T>>2]=A}e=(A|0)<8?A:8;s[T>>2]=e;e=te(e,R<<3)|0;s[m+(t<<2)>>2]=(e|0)>=((s[C>>2]|0)+S|0)&1;e=(te(s[T>>2]|0,g)|0)<<3;s[C>>2]=(s[C>>2]|0)-e}else{d=(A|0)<(J|0)?0:A-J|0;s[C>>2]=A-d;s[w+(t<<2)>>2]=0;s[m+(t<<2)>>2]=1}if((d|0)<=0){I=d;t=P;continue}Z=d>>x;X=w+(t<<2)|0;v=s[X>>2]|0;e=8-v|0;e=(Z|0)<(e|0)?Z:e;s[X>>2]=v+e;e=(te(e,g)|0)<<3;s[m+(t<<2)>>2]=(e|0)>=(d-I|0)&1;I=d-e|0;t=P}s[p>>2]=I;while(1){if((t|0)>=(i|0))break;c=b+(t<<2)|0;h=w+(t<<2)|0;s[h>>2]=s[c>>2]>>K>>3;s[c>>2]=0;s[m+(t<<2)>>2]=(s[h>>2]|0)<1&1;t=t+1|0}u=ie;return V|0}function Ri(e,t,i,n){e=e|0;t=t|0;i=i|0;n=n|0;var r=0,o=0,a=0,l=0,h=0,c=0,d=0,p=0,b=0,w=0,m=0,g=0,_=0;_=u;m=u;u=u+((1*(n<<2)|0)+15&-16)|0;g=u;u=u+((1*(n<<2)|0)+15&-16)|0;r=0;do{w=e+(r<<2)|0;p=+f[w>>2];s[g+(r<<2)>>2]=p<0&1;f[w>>2]=+H(+p);s[t+(r<<2)>>2]=0;f[m+(r<<2)>>2]=0;r=r+1|0}while((r|0)<(n|0));if((n>>1|0)<(i|0)){r=0;o=0;do{o=o+ +f[e+(r<<2)>>2];r=r+1|0}while((r|0)<(n|0));if(!(o>1.0000000036274937e-15&o<64)){f[e>>2]=1;r=1;do{f[e+(r<<2)>>2]=0;r=r+1|0}while((r|0)<(n|0));o=1}l=(+(i|0)+.8)*(1/o);h=0;r=i;a=0;o=0;do{b=e+(h<<2)|0;w=~~+G(+(l*+f[b>>2]));s[t+(h<<2)>>2]=w;p=+(w|0);o=o+p*p;a=a+ +f[b>>2]*p;f[m+(h<<2)>>2]=p*2;r=r-w|0;h=h+1|0}while((h|0)<(n|0))}else{r=i;a=0;o=0}if((r|0)>(n+3|0)){p=+(r|0);o=o+p*p+p*+f[m>>2];s[t>>2]=(s[t>>2]|0)+r;r=0}w=0;while(1){if((w|0)>=(r|0)){r=0;break}o=o+1;p=a+ +f[e>>2];d=o+ +f[m>>2];h=0;p=p*p;b=1;while(1){c=a+ +f[e+(b<<2)>>2];l=o+ +f[m+(b<<2)>>2];c=c*c;i=d*c>l*p;h=i?b:h;b=b+1|0;if((b|0)>=(n|0))break;else{d=i?l:d;p=i?c:p}}d=+f[e+(h<<2)>>2];b=m+(h<<2)|0;p=+f[b>>2];f[b>>2]=p+2;b=t+(h<<2)|0;s[b>>2]=(s[b>>2]|0)+1;w=w+1|0;a=a+d;o=o+p}do{e=t+(r<<2)|0;m=s[g+(r<<2)>>2]|0;s[e>>2]=(s[e>>2]^0-m)+m;r=r+1|0}while((r|0)<(n|0));u=_;return+o}function Ci(e,t,i,r,o,a,l,h){e=e|0;t=t|0;i=i|0;r=r|0;o=o|0;a=a|0;l=+l;h=h|0;var c=0,d=0,p=0,b=0,w=0,m=0,g=0,_=0,v=0,k=0,y=0,E=0,A=0,T=0,S=0,M=0,R=0,C=0,P=0;P=u;C=u;u=u+((1*(t+3<<2)|0)+15&-16)|0;Pi(e,t,1,o,i,r);d=+Ri(e,C,i,t);b=t+-1|0;m=s[C+(b<<2)>>2]|0;c=m>>>31;m=(m|0)>-1?m:0-m|0;while(1){w=b;b=b+-1|0;p=t-b|0;c=c+(s[(s[17748+(((p|0)<(m|0)?p:m)<<2)>>2]|0)+(((p|0)>(m|0)?p:m)<<2)>>2]|0)|0;R=s[C+(b<<2)>>2]|0;m=m+((R|0)>-1?R:0-R|0)|0;if((R|0)<0){M=m+1|0;M=c+(s[(s[17748+(((p|0)>(m|0)?M:p)<<2)>>2]|0)+(((p|0)>(M|0)?p:M)<<2)>>2]|0)|0}else M=c;if((w|0)<=1)break;else c=M}p=(t|0)>(i|0);b=i+1|0;b=(s[(s[17748+(((t|0)<(i|0)?t:i)<<2)>>2]|0)+((p?t:i)<<2)>>2]|0)+(s[(s[17748+((p?b:t)<<2)>>2]|0)+(((b|0)<(t|0)?t:b)<<2)>>2]|0)|0;p=b+-1|0;c=32-(ne(p|0)|0)|0;e:do if((c|0)>8){R=c+-8|0;c=p>>>R;p=c+1|0;b=M>>>R;k=a+28|0;w=s[k>>2]|0;m=(w>>>0)/(p>>>0)|0;if(!b){m=w-(te(m,c)|0)|0;s[k>>2]=m;v=a+32|0}else{S=w-(te(m,p-b|0)|0)|0;v=a+32|0;s[v>>2]=(s[v>>2]|0)+S;s[k>>2]=m}g=a+36|0;S=a+20|0;_=a+40|0;y=a+24|0;E=a+8|0;A=a+4|0;T=a+44|0;while(1){if(m>>>0>=8388609)break;c=s[v>>2]|0;w=c>>>23;if((w|0)==255)s[g>>2]=(s[g>>2]|0)+1;else{b=c>>>31;c=s[_>>2]|0;if((c|0)>-1){p=s[y>>2]|0;if((p+(s[E>>2]|0)|0)>>>0<(s[A>>2]|0)>>>0){s[y>>2]=p+1;n[(s[a>>2]|0)+p>>0]=c+b;c=0}else c=-1;s[T>>2]=s[T>>2]|c}c=s[g>>2]|0;if(c|0){b=b+255&255;do{p=s[y>>2]|0;if((p+(s[E>>2]|0)|0)>>>0<(s[A>>2]|0)>>>0){s[y>>2]=p+1;n[(s[a>>2]|0)+p>>0]=b;p=0;c=s[g>>2]|0}else p=-1;s[T>>2]=s[T>>2]|p;c=c+-1|0;s[g>>2]=c}while((c|0)!=0)}s[_>>2]=w&255;c=s[v>>2]|0;m=s[k>>2]|0}s[v>>2]=c<<8&2147483392;m=m<<8;s[k>>2]=m;s[S>>2]=(s[S>>2]|0)+8}_=(1<>2]|0;k=a+16|0;p=s[k>>2]|0;if((p+R|0)>>>0>32){m=7-p|0;m=p+((m|0)>-8?m:-8)&-8;g=p;do{b=s[E>>2]|0;w=s[A>>2]|0;if(((s[y>>2]|0)+b|0)>>>0>>0){b=b+1|0;s[E>>2]=b;n[(s[a>>2]|0)+(w-b)>>0]=c;b=0}else b=-1;s[T>>2]=s[T>>2]|b;c=c>>>8;g=g+-8|0}while((g|0)>7);p=p+-8-m|0}s[v>>2]=c|_<>2]=p+R;s[S>>2]=(s[S>>2]|0)+R}else{T=a+28|0;c=s[T>>2]|0;p=(c>>>0)/(b>>>0)|0;if(!M){p=c-(te(p,b+-1|0)|0)|0;s[T>>2]=p;A=a+32|0}else{R=c-(te(p,b-M|0)|0)|0;A=a+32|0;s[A>>2]=(s[A>>2]|0)+R;s[T>>2]=p}m=a+36|0;g=a+20|0;_=a+40|0;v=a+24|0;k=a+8|0;y=a+4|0;E=a+44|0;while(1){if(p>>>0>=8388609)break e;c=s[A>>2]|0;w=c>>>23;if((w|0)==255)s[m>>2]=(s[m>>2]|0)+1;else{b=c>>>31;c=s[_>>2]|0;if((c|0)>-1){p=s[v>>2]|0;if((p+(s[k>>2]|0)|0)>>>0<(s[y>>2]|0)>>>0){s[v>>2]=p+1;n[(s[a>>2]|0)+p>>0]=c+b;c=0}else c=-1;s[E>>2]=s[E>>2]|c}c=s[m>>2]|0;if(c|0){b=b+255&255;do{p=s[v>>2]|0;if((p+(s[k>>2]|0)|0)>>>0<(s[y>>2]|0)>>>0){s[v>>2]=p+1;n[(s[a>>2]|0)+p>>0]=b;p=0;c=s[m>>2]|0}else p=-1;s[E>>2]=s[E>>2]|p;c=c+-1|0;s[m>>2]=c}while((c|0)!=0)}s[_>>2]=w&255;c=s[A>>2]|0;p=s[T>>2]|0}s[A>>2]=c<<8&2147483392;p=p<<8;s[T>>2]=p;s[g>>2]=(s[g>>2]|0)+8}}while(0);if(h|0){d=1/+z(+d)*l;c=0;do{f[e+(c<<2)>>2]=d*+(s[C+(c<<2)>>2]|0);c=c+1|0}while((c|0)<(t|0));Pi(e,t,-1,o,i,r)}if((o|0)<2){o=1;u=P;return o|0}m=(t>>>0)/(o>>>0)|0;c=0;g=0;do{p=te(g,m)|0;b=0;w=0;do{w=w|s[C+(p+b<<2)>>2];b=b+1|0}while((b|0)<(m|0));c=c|((w|0)!=0&1)<=(t|0)|(o|0)==0)return;k=+(t|0)/+((te(s[17352+(o+-1<<2)>>2]|0,r)|0)+t|0);k=k*k*.5;v=+W(+(k*1.5707963705062866));k=+W(+((1-k)*1.5707963705062866));e:do if((n<<3|0)>(t|0))o=0;else{r=n>>2;o=1;while(1){if(((te((te(o,o)|0)+o|0,n)|0)+r|0)>=(t|0))break e;o=o+1|0}}while(0);_=(t>>>0)/(n>>>0)|0;a=(i|0)<0;l=(o|0)==0;h=-k;u=_+-1|0;c=_+-3|0;d=_+-2|0;p=-v;b=_-o|0;w=_-(o<<1)|0;m=w+-1|0;g=0;while(1){if((g|0)>=(n|0))break;i=e+((te(g,_)|0)<<2)|0;e:do if(!a){r=i;t=0;while(1){if((t|0)>=(u|0))break;A=+f[r>>2];y=r+4|0;E=+f[y>>2];f[y>>2]=E*v+A*h;f[r>>2]=A*v+E*k;r=y;t=t+1|0}r=i+(c<<2)|0;t=d;while(1){if((t|0)<=0)break;E=+f[r>>2];y=r+4|0;A=+f[y>>2];f[y>>2]=A*v+E*h;f[r>>2]=E*v+A*k;r=r+-4|0;t=t+-1|0}if(!l){r=i;t=0;while(1){if((t|0)>=(b|0))break;E=+f[r>>2];y=r+(o<<2)|0;A=+f[y>>2];f[y>>2]=A*k+E*p;f[r>>2]=E*k+A*v;r=r+4|0;t=t+1|0}r=i+(m<<2)|0;t=w;while(1){if((t|0)<=0)break e;E=+f[r>>2];y=r+(o<<2)|0;A=+f[y>>2];f[y>>2]=A*k+E*p;f[r>>2]=E*k+A*v;r=r+-4|0;t=t+-1|0}}}else{t:do if(l){r=i;t=0}else{r=i;t=0;while(1){if((t|0)>=(b|0))break;E=+f[r>>2];y=r+(o<<2)|0;A=+f[y>>2];f[y>>2]=A*k+E*v;f[r>>2]=E*k+A*p;r=r+4|0;t=t+1|0}r=i+(m<<2)|0;t=w;while(1){if((t|0)<=0){r=i;t=0;break t}E=+f[r>>2];y=r+(o<<2)|0;A=+f[y>>2];f[y>>2]=A*k+E*v;f[r>>2]=E*k+A*p;r=r+-4|0;t=t+-1|0}}while(0);while(1){if((t|0)>=(u|0))break;E=+f[r>>2];y=r+4|0;A=+f[y>>2];f[y>>2]=A*v+E*k;f[r>>2]=E*v+A*h;r=y;t=t+1|0}r=i+(c<<2)|0;t=d;while(1){if((t|0)<=0)break e;E=+f[r>>2];y=r+4|0;A=+f[y>>2];f[y>>2]=A*v+E*k;f[r>>2]=E*v+A*h;r=r+-4|0;t=t+-1|0}}while(0);g=g+1|0}return}function xi(e,t,i,n,r,o,a){e=e|0;t=t|0;i=i|0;n=n|0;r=r|0;o=o|0;a=+a;var l=0,h=0,c=0,d=0,p=0,b=0,w=0,m=0,g=0,_=0,v=0,k=0,y=0;v=u;_=u;u=u+((1*(t<<2)|0)+15&-16)|0;g=(t|0)>(i|0);p=i+1|0;w=t;m=i;p=hi(o,(s[(s[17748+(((t|0)<(i|0)?t:i)<<2)>>2]|0)+((g?t:i)<<2)>>2]|0)+(s[(s[17748+((g?p:t)<<2)>>2]|0)+(((p|0)<(t|0)?t:p)<<2)>>2]|0)|0)|0;g=_;l=0;while(1){if((w|0)<=2)break;do if((m|0)<(w|0)){o=s[(s[17748+(m<<2)>>2]|0)+(w<<2)>>2]|0;h=s[(s[17748+(m+1<<2)>>2]|0)+(w<<2)>>2]|0;if(p>>>0>=o>>>0&p>>>0>>0){s[g>>2]=0;h=p-o|0;o=m;break}d=p>>>0>=h>>>0;h=p-(d?h:0)|0;o=m;do{o=o+-1|0;c=s[(s[17748+(o<<2)>>2]|0)+(w<<2)>>2]|0}while(h>>>0>>0);b=d<<31>>31;m=m-o+b^b;s[g>>2]=m<<16>>16;k=+((m&65535)<<16>>16);h=h-c|0;l=l+k*k}else{c=s[17748+(w<<2)>>2]|0;d=s[c+(m+1<<2)>>2]|0;h=p>>>0>=d>>>0;b=h<<31>>31;d=p-(h?d:0)|0;e:do if((s[c+(w<<2)>>2]|0)>>>0>d>>>0){o=w;do{o=o+-1|0;h=s[(s[17748+(o<<2)>>2]|0)+(w<<2)>>2]|0}while(h>>>0>d>>>0)}else{o=m;while(1){h=s[c+(o<<2)>>2]|0;if(h>>>0<=d>>>0)break e;o=o+-1|0}}while(0);m=m-o+b^b;s[g>>2]=m<<16>>16;k=+((m&65535)<<16>>16);h=d-h|0;l=l+k*k}while(0);w=w+-1|0;m=o;p=h;g=g+4|0}o=m<<1|1;h=p>>>0>=o>>>0;c=h<<31>>31;o=p-(h?o:0)|0;h=(o+1|0)>>>1;if(h)o=o-((h<<1)+-1)|0;m=m-h+c^c;s[g>>2]=m<<16>>16;y=+((m&65535)<<16>>16);o=h-o^0-o;s[g+4>>2]=o<<16>>16;k=+((o&65535)<<16>>16);l=1/+z(+(l+y*y+k*k))*a;o=0;do{f[e+(o<<2)>>2]=l*+(s[_+(o<<2)>>2]|0);o=o+1|0}while((o|0)<(t|0));Pi(e,t,-1,r,i,n);if((r|0)<2){r=1;u=v;return r|0}p=(t>>>0)/(r>>>0)|0;o=0;b=0;do{h=te(b,p)|0;c=0;d=0;do{d=d|s[_+(h+c<<2)>>2];c=c+1|0}while((c|0)<(p|0));o=o|((d|0)!=0&1)<>2]=0;s[B+4>>2]=0;B=t+4|0;e:do if(!l)l=s[B>>2]|0;else{d=0;while(1){l=s[B>>2]|0;if((d|0)>=(l|0))break e;s[e+(d*4260|0)+2388>>2]=0;d=d+1|0}}while(0);F=e+8536|0;if((l|0)>(s[F>>2]|0)){l=e+4260|0;yr(l|0,0,4260)|0;s[e+6636>>2]=1;s[l>>2]=65536;s[e+8408>>2]=0;s[e+8412>>2]=3176576;s[e+8428>>2]=s[e+6588>>2]<<7;s[e+8500>>2]=65536;s[e+8504>>2]=65536;s[e+8516>>2]=20;s[e+8512>>2]=2;l=s[B>>2]|0}if((l|0)==1?(s[F>>2]|0)==2:0)U=(s[t+12>>2]|0)==((s[e+2316>>2]|0)*1e3|0);else U=0;O=e+2388|0;e:do if(!(s[O>>2]|0)){E=t+16|0;A=t+12|0;T=t+8|0;y=0;S=0;t:while(1){if((y|0)>=(l|0))break e;switch(s[E>>2]|0){case 0:{s[e+(y*4260|0)+2392>>2]=1;s[e+(y*4260|0)+2324>>2]=2;l=2;break}case 10:{s[e+(y*4260|0)+2392>>2]=1;s[e+(y*4260|0)+2324>>2]=2;l=2;break}case 20:{s[e+(y*4260|0)+2392>>2]=1;s[e+(y*4260|0)+2324>>2]=4;l=4;break}case 40:{s[e+(y*4260|0)+2392>>2]=2;s[e+(y*4260|0)+2324>>2]=4;l=4;break}case 60:{s[e+(y*4260|0)+2392>>2]=3;s[e+(y*4260|0)+2324>>2]=4;l=4;break}default:{l=-203;M=183;break t}}g=s[A>>2]>>10;_=g+1|0;v=(_|0)==8;switch(g|0){case 7:case 11:case 15:break;default:{l=-200;M=183;break t}}p=s[T>>2]|0;k=_<<16>>16;s[e+(y*4260|0)+2332>>2]=k*5;b=e+(y*4260|0)+2324|0;w=te(l,k*327680>>16)|0;m=e+(y*4260|0)+2316|0;l=e+(y*4260|0)+2320|0;if((s[m>>2]|0)==(_|0)?(s[l>>2]|0)==(p|0):0){l=1;d=0;M=23}else{d=Hi(e+(y*4260|0)+2432|0,k*1e3|0,p,0)|0;s[l>>2]=p;l=(s[m>>2]|0)==(_|0);if(l)M=23;else M=24}if((M|0)==23){M=0;if((w|0)!=(s[e+(y*4260|0)+2328>>2]|0))M=24}if((M|0)==24){M=0;p=(s[b>>2]|0)==4;b=e+(y*4260|0)+2384|0;do if(v)if(p){s[b>>2]=30064;break}else{s[b>>2]=30087;break}else if(p){s[b>>2]=30030;break}else{s[b>>2]=30075;break}while(0);if(!l){s[e+(y*4260|0)+2336>>2]=k*20;switch(g|0){case 7:case 11:{s[e+(y*4260|0)+2340>>2]=10;s[e+(y*4260|0)+2732>>2]=22896;if((_|0)==12)s[e+(y*4260|0)+2380>>2]=29956;else M=37;break}default:{s[e+(y*4260|0)+2340>>2]=16;s[e+(y*4260|0)+2732>>2]=22936;if((_|0)==16)s[e+(y*4260|0)+2380>>2]=29962;else M=37}}if((M|0)==37?(0,v):0)s[e+(y*4260|0)+2380>>2]=29947;s[e+(y*4260|0)+2376>>2]=1;s[e+(y*4260|0)+2308>>2]=100;n[e+(y*4260|0)+2312>>0]=10;s[e+(y*4260|0)+4164>>2]=0;yr(e+(y*4260|0)+1284|0,0,1024)|0}s[m>>2]=_;s[e+(y*4260|0)+2328>>2]=w}l=s[B>>2]|0;y=y+1|0;S=S+d|0}if((M|0)==183){u=G;return l|0}}else S=0;while(0);d=s[t>>2]|0;do if((d|0)==2)if((l|0)==2){if((s[e+8532>>2]|0)!=1?(s[F>>2]|0)!=1:0){l=2;break}s[e+8520>>2]=0;s[e+8528>>2]=0;Sr(e+6692|0,e+2432|0,300)|0;l=s[t>>2]|0}else l=2;else l=d;while(0);s[e+8532>>2]=l;s[F>>2]=s[B>>2];I=t+8|0;if(((s[I>>2]|0)+-8e3|0)>>>0>4e4){e=-200;u=G;return e|0}N=(i|0)==1;e:do if(!N?(s[O>>2]|0)==0:0){A=f+28|0;T=f+32|0;M=f+20|0;R=f+40|0;C=f+24|0;P=f+4|0;_=0;while(1){l=s[B>>2]|0;if((_|0)>=(l|0)){v=0;break}w=e+(_*4260|0)+2392|0;m=0;while(1){p=s[A>>2]|0;d=s[T>>2]|0;l=p>>>1;b=d>>>0>>0;g=b&1;if((m|0)>=(s[w>>2]|0))break;if(!b){d=d-l|0;s[T>>2]=d;l=p-l|0}s[A>>2]=l;while(1){if(l>>>0>=8388609)break;s[M>>2]=(s[M>>2]|0)+8;l=l<<8;s[A>>2]=l;b=s[R>>2]|0;p=s[C>>2]|0;if(p>>>0<(s[P>>2]|0)>>>0){s[C>>2]=p+1;p=o[(s[f>>2]|0)+p>>0]|0}else p=0;s[R>>2]=p;E=((b<<8|p)>>>1&255|d<<8&2147483392)^255;s[T>>2]=E;d=E}s[e+(_*4260|0)+2404+(m<<2)>>2]=g;m=m+1|0}if(!b){d=d-l|0;s[T>>2]=d;l=p-l|0}s[A>>2]=l;while(1){if(l>>>0>=8388609)break;s[M>>2]=(s[M>>2]|0)+8;l=l<<8;s[A>>2]=l;b=s[R>>2]|0;p=s[C>>2]|0;if(p>>>0<(s[P>>2]|0)>>>0){s[C>>2]=p+1;p=o[(s[f>>2]|0)+p>>0]|0}else p=0;s[R>>2]=p;E=((b<<8|p)>>>1&255|d<<8&2147483392)^255;s[T>>2]=E;d=E}s[e+(_*4260|0)+2416>>2]=g;_=_+1|0}while(1){if((v|0)>=(l|0))break;l=e+(v*4260|0)+2420|0;s[l>>2]=0;s[l+4>>2]=0;s[l+8>>2]=0;t:do if(s[e+(v*4260|0)+2416>>2]|0){_=e+(v*4260|0)+2392|0;d=s[_>>2]|0;if((d|0)==1){s[l>>2]=1;break}l=s[17520+(d+-2<<2)>>2]|0;m=s[A>>2]|0;d=s[T>>2]|0;p=m>>>8;g=-1;while(1){b=g+1|0;w=te(p,o[l+b>>0]|0)|0;if(d>>>0>>0){g=b;m=w}else break}b=d-w|0;s[T>>2]=b;l=m-w|0;s[A>>2]=l;while(1){if(l>>>0>=8388609)break;s[M>>2]=(s[M>>2]|0)+8;l=l<<8;s[A>>2]=l;p=s[R>>2]|0;d=s[C>>2]|0;if(d>>>0<(s[P>>2]|0)>>>0){s[C>>2]=d+1;d=o[(s[f>>2]|0)+d>>0]|0}else d=0;s[R>>2]=d;E=((p<<8|d)>>>1&255|b<<8&2147483392)^255;s[T>>2]=E;b=E}l=g+2|0;d=0;while(1){if((d|0)>=(s[_>>2]|0))break t;s[e+(v*4260|0)+2420+(d<<2)>>2]=l>>>d&1;d=d+1|0}}while(0);l=s[B>>2]|0;v=v+1|0}if(!i){y=e+2392|0;E=e+6680|0;d=0;k=0;while(1){if((k|0)>=(s[y>>2]|0))break e;g=E+(k<<2)|0;_=(k|0)>0;v=k+-1|0;m=0;while(1){if((m|0)>=(l|0))break;if(s[e+(m*4260|0)+2420+(k<<2)>>2]|0){t:do if((l|0)==2&(m|0)==0?(Yi(f,L),(s[g>>2]|0)==0):0){w=s[A>>2]|0;l=s[T>>2]|0;p=w>>>8;d=-1;while(1){d=d+1|0;b=te(p,o[29916+d>>0]|0)|0;if(l>>>0>=b>>>0)break;else w=b}p=l-b|0;s[T>>2]=p;l=w-b|0;s[A>>2]=l;w=p;while(1){if(l>>>0>=8388609)break t;s[M>>2]=(s[M>>2]|0)+8;l=l<<8;s[A>>2]=l;b=s[R>>2]|0;p=s[C>>2]|0;if(p>>>0<(s[P>>2]|0)>>>0){s[C>>2]=p+1;p=o[(s[f>>2]|0)+p>>0]|0}else p=0;s[R>>2]=p;b=((b<<8|p)>>>1&255|w<<8&2147483392)^255;s[T>>2]=b;w=b}}while(0);if(_?(s[e+(m*4260|0)+2420+(v<<2)>>2]|0)!=0:0)l=2;else l=0;pn(e+(m*4260|0)|0,f,k,1,l);bn(f,x,n[e+(m*4260|0)+2765>>0]|0,n[e+(m*4260|0)+2766>>0]|0,s[e+(m*4260|0)+2328>>2]|0);l=s[B>>2]|0}m=m+1|0}k=k+1|0}}else d=0}else d=0;while(0);l=s[B>>2]|0;do if((l|0)==2){switch(i|0){case 0:{Yi(f,L);if(!(s[e+6664+(s[O>>2]<<2)>>2]|0))M=112;else{d=0;M=121}break}case 2:{if((s[e+2420+(s[O>>2]<<2)>>2]|0)==1){Yi(f,L);if(!(s[e+6680+(s[O>>2]<<2)>>2]|0))M=112;else{d=0;M=121}}else M=108;break}default:M=108}e:do if((M|0)==108){l=e+8520|0;p=0;while(1){if((p|0)==2)break e;s[L+(p<<2)>>2]=r[l+(p<<1)>>1];p=p+1|0}}else if((M|0)==112){k=f+28|0;w=s[k>>2]|0;y=f+32|0;l=s[y>>2]|0;p=w>>>8;d=-1;while(1){d=d+1|0;b=te(p,o[29916+d>>0]|0)|0;if(l>>>0>=b>>>0)break;else w=b}v=l-b|0;s[y>>2]=v;l=w-b|0;s[k>>2]=l;w=f+20|0;m=f+40|0;g=f+24|0;_=f+4|0;while(1){if(l>>>0>=8388609){M=121;break e}s[w>>2]=(s[w>>2]|0)+8;l=l<<8;s[k>>2]=l;b=s[m>>2]|0;p=s[g>>2]|0;if(p>>>0<(s[_>>2]|0)>>>0){s[g>>2]=p+1;p=o[(s[f>>2]|0)+p>>0]|0}else p=0;s[m>>2]=p;x=((b<<8|p)>>>1&255|v<<8&2147483392)^255;s[y>>2]=x;v=x}}while(0);if((M|0)==121){l=s[B>>2]|0;if((l|0)!=2)break}if((d|0)==0?(s[e+8540>>2]|0)==1:0){yr(e+5544|0,0,1024)|0;s[e+6568>>2]=100;n[e+6572>>0]=10;s[e+8424>>2]=0;s[e+6636>>2]=1;l=s[B>>2]|0}else l=2}while(0);R=te(s[t+12>>2]|0,l)|0;R=(R|0)<(te(s[I>>2]|0,s[t>>2]|0)|0);if(R){P=Ne()|0;s[j>>2]=h;M=h+(s[e+2328>>2]<<1)+4|0;s[j+4>>2]=M;w=h}else{M=e+2328|0;x=te(l,(s[M>>2]|0)+2|0)|0;P=Ne()|0;w=u;u=u+((1*(x<<1)|0)+15&-16)|0;s[j>>2]=w;M=w+(s[M>>2]<<1)+4|0;s[j+4>>2]=M}if(!i){C=e+8540|0;b=(d|0)==0&1}else{l=e+8540|0;if(s[l>>2]|0)if((s[B>>2]|0)==2&(i|0)==2)p=(s[e+6680+(s[e+6648>>2]<<2)>>2]|0)==1;else p=0;else p=1;C=l;b=p&1}p=(i|0)==2;m=0;while(1){l=s[B>>2]|0;if((m|0)>=(l|0))break;if((m|0)==0|(b|0)!=0){l=(s[O>>2]|0)-m|0;do if((l|0)<1)l=0;else{if(p){l=s[e+(m*4260|0)+2420+(l+-1<<2)>>2]|0?2:0;break}if((m|0)>0?s[C>>2]|0:0){l=1;break}l=2}while(0);l=S+(dn(e+(m*4260|0)|0,f,(s[j+(m<<2)>>2]|0)+4|0,D,i,l)|0)|0}else{yr((s[j+(m<<2)>>2]|0)+4|0,0,s[D>>2]<<1|0)|0;l=S}S=e+(m*4260|0)+2388|0;s[S>>2]=(s[S>>2]|0)+1;m=m+1|0;S=l}e:do if((s[t>>2]|0)==2&(l|0)==2){ -E=e+8520|0;A=e+2316|0;l=s[A>>2]|0;T=s[D>>2]|0;k=e+8524|0;m=a[k>>1]|a[k+2>>1]<<16;r[w>>1]=m;r[w+2>>1]=m>>>16;m=e+8528|0;g=a[m>>1]|a[m+2>>1]<<16;r[M>>1]=g;r[M+2>>1]=g>>>16;g=w+(T<<1)|0;g=a[g>>1]|a[g+2>>1]<<16;r[k>>1]=g;r[k+2>>1]=g>>>16;k=M+(T<<1)|0;k=a[k>>1]|a[k+2>>1]<<16;r[m>>1]=k;r[m+2>>1]=k>>>16;m=r[E>>1]|0;k=e+8522|0;g=r[k>>1]|0;l=l<<3;y=s[L>>2]|0;p=(65536/(l|0)|0)<<16>>16;_=((te(y-(m&65535)<<16>>16,p)|0)>>15)+1>>1;v=s[L+4>>2]|0;p=((te(v-(g&65535)<<16>>16,p)|0)>>15)+1>>1;b=0;m=m<<16>>16;g=g<<16>>16;while(1){if((b|0)>=(l|0))break;D=m+_|0;L=g+p|0;f=b+1|0;x=r[w+(f<<1)>>1]|0;z=(r[w+(b<<1)>>1]|0)+(r[w+(b+2<<1)>>1]|0)+(x<<1)|0;i=M+(f<<1)|0;H=D<<16>>16;O=L<<16>>16;O=((r[i>>1]<<8)+((te(z>>7,H)|0)+((te(z<<9&65024,H)|0)>>16))+((te(x>>5,O)|0)+((te(x<<11&63488,O)|0)>>16))>>7)+1>>1;r[i>>1]=(O|0)>32767?32767:((O|0)<-32768?-32768:O)&65535;b=f;m=D;g=L}p=y<<16>>16;b=v<<16>>16;while(1){if((l|0)>=(T|0))break;z=l+1|0;L=r[w+(z<<1)>>1]|0;D=(r[w+(l<<1)>>1]|0)+(r[w+(l+2<<1)>>1]|0)+(L<<1)|0;H=M+(z<<1)|0;L=((r[H>>1]<<8)+((te(D>>7,p)|0)+((te(D<<9&65024,p)|0)>>16))+((te(L>>5,b)|0)+((te(L<<11&63488,b)|0)>>16))>>7)+1>>1;r[H>>1]=(L|0)>32767?32767:((L|0)<-32768?-32768:L)&65535;l=z}r[E>>1]=y;r[k>>1]=v;l=0;while(1){if((l|0)>=(T|0)){_=A;g=T;break e}z=l+1|0;D=w+(z<<1)|0;i=r[D>>1]|0;H=M+(z<<1)|0;L=r[H>>1]|0;f=i+L|0;L=i-L|0;r[D>>1]=(f|0)>32767?32767:((f|0)<-32768?-32768:f)&65535;r[H>>1]=(L|0)>32767?32767:((L|0)<-32768?-32768:L)&65535;l=z}}else{_=e+8524|0;g=a[_>>1]|a[_+2>>1]<<16;r[w>>1]=g;r[w+2>>1]=g>>>16;g=s[D>>2]|0;w=s[j>>2]|0;z=w+(g<<1)|0;z=a[z>>1]|a[z+2>>1]<<16;r[_>>1]=z;r[_+2>>1]=z>>>16;_=e+2316|0}while(0);p=te(g,s[I>>2]|0)|0;p=(p|0)/((s[_>>2]<<16>>16)*1e3|0)|0;s[c>>2]=p;l=s[t>>2]|0;b=(l|0)==2;if(b){m=u;u=u+((1*((b?p:1)<<1)|0)+15&-16)|0}else m=h;if(R){z=s[e+2328>>2]|0;H=te(s[B>>2]|0,z+2|0)|0;w=u;u=u+((1*(H<<1)|0)+15&-16)|0;Sr(w|0,h|0,H<<1|0)|0;s[j>>2]=w;s[j+4>>2]=w+(z<<1)+4}b=0;while(1){p=s[B>>2]|0;if((b|0)>=(((l|0)<(p|0)?l:p)|0))break;zi(e+(b*4260|0)+2432|0,m,(s[j+(b<<2)>>2]|0)+2|0,g);l=s[t>>2]|0;if((l|0)==2){l=0;while(1){if((l|0)>=(s[c>>2]|0))break;r[h+(b+(l<<1)<<1)>>1]=r[m+(l<<1)>>1]|0;l=l+1|0}l=s[t>>2]|0}b=b+1|0}e:do if((l|0)==2&(p|0)==1){if(!U){l=0;while(1){if((l|0)>=(s[c>>2]|0))break e;z=l<<1;r[h+((z|1)<<1)>>1]=r[h+(z<<1)>>1]|0;l=l+1|0}}zi(e+6692|0,m,w+2|0,g);l=0;while(1){if((l|0)>=(s[c>>2]|0))break e;r[h+((l<<1|1)<<1)>>1]=r[m+(l<<1)>>1]|0;l=l+1|0}}while(0);if((s[e+4164>>2]|0)==2)l=te(s[e+2308>>2]|0,s[17364+((s[_>>2]|0)+-8>>2<<2)>>2]|0)|0;else l=0;s[t+20>>2]=l;e:do if(N){l=0;while(1){if((l|0)>=(s[F>>2]|0))break e;n[e+(l*4260|0)+2312>>0]=10;l=l+1|0}}else s[C>>2]=d;while(0);He(P|0);z=S;u=G;return z|0}function Oi(e,t,i){e=e|0;t=t|0;i=i|0;var n=0,r=0,o=0;yr(e|0,0,20400)|0;n=0;r=0;while(1){if((n|0)==2)break;o=r+(Fi(e+(n*10156|0)|0,t)|0)|0;n=n+1|0;r=o}s[e+20376>>2]=1;o=e+20380|0;s[o>>2]=1;s[i>>2]=1;s[i+4>>2]=s[o>>2];s[i+8>>2]=s[e+4648>>2];s[i+12>>2]=s[e+4656>>2];s[i+16>>2]=s[e+4660>>2];s[i+20>>2]=s[e+4664>>2];s[i+24>>2]=s[e+4704>>2];s[i+28>>2]=s[e+4700>>2];s[i+32>>2]=s[e+4708>>2];s[i+36>>2]=s[e+4716>>2];s[i+40>>2]=s[e+6180>>2];s[i+48>>2]=s[e+6168>>2];s[i+52>>2]=s[e+4768>>2];o=e+4668|0;s[i+72>>2]=(s[o>>2]<<16>>16)*1e3;s[i+76>>2]=s[e+4628>>2];if((s[o>>2]|0)!=16){n=0;n=n&1;o=i+80|0;s[o>>2]=n;return r|0}n=(s[e+28>>2]|0)==0;n=n&1;o=i+80|0;s[o>>2]=n;return r|0}function Ni(e,t,i,l,f,h,c){e=e|0;t=t|0;i=i|0;l=l|0;f=f|0;h=h|0;c=c|0;var d=0,p=0,b=0,w=0,m=0,g=0,_=0,v=0,k=0,y=0,E=0,A=0,T=0,S=0,M=0,R=0,C=0,P=0,x=0,I=0,O=0,N=0,D=0,L=0,U=0,B=0,j=0,F=0,G=0,H=0,z=0,q=0,W=0,V=0,Y=0,Z=0,$=0,K=0,X=0,J=0,Q=0,ee=0,ie=0,re=0,se=0,oe=0,ae=0,le=0,fe=0,he=0,ue=0,ce=0,de=0,pe=0,be=0,we=0,me=0,ge=0,_e=0,ve=0,ke=0,ye=0,Ee=0,Ae=0,Te=0,Se=0,Me=0,Re=0,Ce=0,Pe=0,xe=0,Ie=0,Oe=0,De=0,Le=0,Ue=0,Be=0,je=0,Fe=0,Ge=0,ze=0,qe=0,We=0,Ve=0,Ye=0,Ze=0,$e=0,Ke=0,Xe=0,Je=0,Qe=0,et=0,tt=0,it=0,nt=0,rt=0,st=0,ot=0,at=0;at=u;u=u+16|0;st=at;if(s[t+68>>2]|0){s[e+4756>>2]=1;s[e+14912>>2]=1}nt=e+15996|0;s[nt>>2]=0;rt=e+5840|0;s[rt>>2]=0;B=t+8|0;p=s[B>>2]|0;e:do if((p|0)<24e3){if((p|0)<12e3){switch(p|0){case 8e3:break e;default:d=-102}u=at;return d|0}if((p|0)<16e3){switch(p|0){case 12e3:break e;default:d=-102}u=at;return d|0}else{switch(p|0){case 16e3:break e;default:d=-102}u=at;return d|0}}else if((p|0)<44100)if((p|0)<32e3){switch(p|0){case 24e3:break e;default:d=-102}u=at;return d|0}else{switch(p|0){case 32e3:break e;default:d=-102}u=at;return d|0}else if((p|0)<48e3){switch(p|0){case 44100:break e;default:d=-102}u=at;return d|0}else{switch(p|0){case 48e3:break e;default:d=-102}u=at;return d|0}while(0);U=t+20|0;p=s[U>>2]|0;e:do if((p|0)>=12e3)if((p|0)<16e3){switch(p|0){case 12e3:break e;default:d=-102}u=at;return d|0}else{switch(p|0){case 16e3:break e;default:d=-102}u=at;return d|0}else{switch(p|0){case 8e3:break e;default:d=-102}u=at;return d|0}while(0);D=t+12|0;b=s[D>>2]|0;e:do if((b|0)>=12e3)if((b|0)<16e3){switch(b|0){case 12e3:break e;default:d=-102}u=at;return d|0}else{switch(b|0){case 16e3:break e;default:d=-102}u=at;return d|0}else{switch(b|0){case 8e3:break e;default:d=-102}u=at;return d|0}while(0);L=t+16|0;w=s[L>>2]|0;e:do if((w|0)>=12e3)if((w|0)<16e3){switch(w|0){case 12e3:break e;default:d=-102}u=at;return d|0}else{switch(w|0){case 16e3:break e;default:d=-102}u=at;return d|0}else{switch(w|0){case 8e3:break e;default:d=-102}u=at;return d|0}while(0);if((w|0)>(p|0)|(b|0)<(p|0)|(w|0)>(b|0)){e=-102;u=at;return e|0}it=t+24|0;switch(s[it>>2]|0){case 60:case 40:case 20:case 10:break;default:{e=-103;u=at;return e|0}}I=t+32|0;if((s[I>>2]|0)>>>0>100){e=-105;u=at;return e|0}O=t+48|0;if((s[O>>2]|0)>>>0>1){e=-108;u=at;return e|0}et=t+52|0;if((s[et>>2]|0)>>>0>1){e=-109;u=at;return e|0}N=t+40|0;if((s[N>>2]|0)>>>0>1){e=-107;u=at;return e|0}p=s[t>>2]|0;if((p+-1|0)>>>0>1){e=-111;u=at;return e|0}ot=t+4|0;b=s[ot>>2]|0;if((b+-1|0)>>>0>1|(b|0)>(p|0)){e=-111;u=at;return e|0}tt=t+36|0;if((s[tt>>2]|0)>>>0>10){e=-106;u=at;return e|0}x=t+88|0;s[x>>2]=0;w=e+20380|0;if((b|0)>(s[w>>2]|0)){b=e+10156|0;p=Fi(b,s[e+5184>>2]|0)|0;s[e+20312>>2]=0;s[e+20320>>2]=0;s[e+20324>>2]=0;s[e+20328>>2]=1;s[e+20332>>2]=0;s[e+20336>>2]=1;r[e+20342>>1]=0;r[e+20340>>1]=16384;if((s[e+20376>>2]|0)==2){Sr(e+16024|0,e+5868|0,300)|0;Ke=e;Xe=s[Ke+4>>2]|0;Je=b;s[Je>>2]=s[Ke>>2];s[Je+4>>2]=Xe}}else p=0;if((s[it>>2]|0)==(s[e+4704>>2]|0))P=(s[w>>2]|0)!=(s[ot>>2]|0);else P=1;s[e+20376>>2]=s[t>>2];s[w>>2]=s[ot>>2];b=l*100|0;w=s[B>>2]|0;C=(b|0)/(w|0)|0;Xe=(C|0)>1?C>>1:1;Je=(c|0)==0;e:do if(Je){if((te(C,w)|0)!=(b|0)|(l|0)<0){e=-101;u=at;return e|0}if((l*1e3|0)>(te(s[it>>2]|0,w)|0)){e=-101;u=at;return e|0}else{Ke=e;c=0;m=0;break}}else{if((C|0)!=1){e=-101;u=at;return e|0}b=0;while(1){w=s[ot>>2]|0;if((b|0)>=(w|0))break;p=Fi(e+(b*10156|0)|0,s[e+(b*10156|0)+5184>>2]|0)|0;b=b+1|0}m=s[it>>2]|0;s[it>>2]=10;c=s[tt>>2]|0;s[tt>>2]=0;b=0;while(1){if((b|0)>=(w|0)){Ke=e;break e}s[e+(b*10156|0)+4760>>2]=0;s[e+(b*10156|0)+4772>>2]=1;w=s[ot>>2]|0;b=b+1|0}}while(0);$e=e+4668|0;Ve=e+20392|0;S=t+44|0;M=t+64|0;Ye=t+56|0;Ze=e+5836|0;R=0;while(1){if((R|0)>=(s[ot>>2]|0))break;if((R|0)==1)k=s[$e>>2]|0;else k=0;y=Ke+(R*10156|0)|0;_=s[Ve>>2]|0;T=Ke+(R*10156|0)+6168|0;s[T>>2]=s[O>>2];s[Ke+(R*10156|0)+4768>>2]=s[et>>2];p=s[B>>2]|0;s[Ke+(R*10156|0)+4648>>2]=p;b=s[D>>2]|0;s[Ke+(R*10156|0)+4656>>2]=b;w=s[L>>2]|0;s[Ke+(R*10156|0)+4660>>2]=w;v=s[U>>2]|0;s[Ke+(R*10156|0)+4664>>2]=v;s[Ke+(R*10156|0)+6180>>2]=s[N>>2];s[Ke+(R*10156|0)+5844>>2]=s[t>>2];s[Ke+(R*10156|0)+5848>>2]=s[ot>>2];s[Ke+(R*10156|0)+4628>>2]=_;s[Ke+(R*10156|0)+5852>>2]=R;A=Ke+(R*10156|0)+4760|0;do if(!(s[A>>2]|0))Qe=41;else{if(s[Ke+(R*10156|0)+4772>>2]|0){Qe=41;break}if((p|0)==(s[Ke+(R*10156|0)+4652>>2]|0))break;p=s[Ke+(R*10156|0)+4668>>2]|0;if((p|0)<=0)break;d=Gi(y,p)|0;Qe=110}while(0);if((Qe|0)==41){Qe=0;E=Ke+(R*10156|0)+4668|0;d=s[E>>2]|0;We=d<<16>>16;g=We*1e3|0;do if(We){if((g|0)>(p|0)|(g|0)>(b|0)|(g|0)<(w|0)){d=(p|0)<(b|0)?p:b;d=(((d|0)>(w|0)?d:w)|0)/1e3|0;break}w=Ke+(R*10156|0)+24|0;p=s[w>>2]|0;if((p|0)>255)s[Ke+(R*10156|0)+28>>2]=0;if((_|0)==0?(s[M>>2]|0)==0:0)break;if((g|0)>(v|0)){b=Ke+(R*10156|0)+28|0;if(!(s[b>>2]|0)){s[w>>2]=256;p=Ke+(R*10156|0)+16|0;s[p>>2]=0;s[p+4>>2]=0;p=256}if(s[M>>2]|0){s[b>>2]=0;d=(d|0)==16?12:8;break}if((p|0)<1){s[x>>2]=1;We=s[Ye>>2]|0;s[Ye>>2]=We-((We*5|0)/((s[it>>2]|0)+5|0)|0);break}else{s[b>>2]=-2;break}}if((g|0)>=(v|0)){p=Ke+(R*10156|0)+28|0;if((s[p>>2]|0)>=0)break;s[p>>2]=1;break}if(s[M>>2]|0){s[w>>2]=0;We=Ke+(R*10156|0)+16|0;s[We>>2]=0;s[We+4>>2]=0;s[Ke+(R*10156|0)+28>>2]=1;d=(d|0)==8?12:16;break}p=Ke+(R*10156|0)+28|0;if(!(s[p>>2]|0)){s[x>>2]=1;We=s[Ye>>2]|0;s[Ye>>2]=We-((We*5|0)/((s[it>>2]|0)+5|0)|0);break}else{s[p>>2]=1;break}}else d=(((v|0)<(p|0)?v:p)|0)/1e3|0;while(0);_=(k|0)==0?d:k;v=Gi(y,_)|0;w=s[it>>2]|0;g=Ke+(R*10156|0)+4704|0;if((s[g>>2]|0)==(w|0)){d=s[E>>2]|0;w=0}else{d=(w|0)==10;e:do if(!d){switch(w|0){case 60:case 40:case 20:{b=0;break}default:if((w|0)<11){b=-103;Qe=70;break e}else b=-103}s[Ke+(R*10156|0)+5836>>2]=(w|0)/20|0;s[Ke+(R*10156|0)+4672>>2]=4;d=_<<16>>16;s[Ke+(R*10156|0)+4676>>2]=d*20;s[Ke+(R*10156|0)+4640>>2]=d*24;d=s[E>>2]|0;p=Ke+(R*10156|0)+4780|0;if((d|0)==8){s[p>>2]=30064;d=8;p=b;break}else{s[p>>2]=30030;p=b;break}}else{b=0;Qe=70}while(0);do if((Qe|0)==70){Qe=0;s[Ke+(R*10156|0)+5836>>2]=1;s[Ke+(R*10156|0)+4672>>2]=d?2:1;d=_<<16>>16;s[Ke+(R*10156|0)+4676>>2]=te(w<<16>>16,d)|0;s[Ke+(R*10156|0)+4640>>2]=d*14;d=s[E>>2]|0;p=Ke+(R*10156|0)+4780|0;if((d|0)==8){s[p>>2]=30087;d=8;p=b;break}else{s[p>>2]=30075;p=b;break}}while(0);s[g>>2]=w;s[Ke+(R*10156|0)+4700>>2]=0;w=p}e:do if((d|0)!=(_|0)){d=Ke+(R*10156|0)+7260|0;s[d>>2]=0;s[d+4>>2]=0;s[d+8>>2]=0;p=Ke+(R*10156|0)+16|0;s[p>>2]=0;s[p+4>>2]=0;s[Ke+(R*10156|0)+5832>>2]=0;s[Ke+(R*10156|0)+5840>>2]=0;s[Ke+(R*10156|0)+4700>>2]=0;yr(Ke+(R*10156|0)+144|0,0,4480)|0;s[Ke+(R*10156|0)+4636>>2]=100;s[Ke+(R*10156|0)+4756>>2]=1;n[d>>0]=10;s[Ke+(R*10156|0)+4568>>2]=100;s[Ke+(R*10156|0)+4584>>2]=65536;n[Ke+(R*10156|0)+4633>>0]=0;s[E>>2]=_;d=s[Ke+(R*10156|0)+4672>>2]|0;p=(d|0)==4;b=Ke+(R*10156|0)+4780|0;t:do if((_|0)==8)if(p){s[b>>2]=30064;d=4;Qe=86;break}else{s[b>>2]=30087;Qe=86;break}else{if(p){s[b>>2]=30030;d=4}else s[b>>2]=30075;switch(_|0){case 8:case 12:{Qe=86;break t}default:{}}s[Ke+(R*10156|0)+4732>>2]=16;s[Ke+(R*10156|0)+4784>>2]=22936}while(0);if((Qe|0)==86){s[Ke+(R*10156|0)+4732>>2]=10;s[Ke+(R*10156|0)+4784>>2]=22896}s[Ke+(R*10156|0)+4680>>2]=_*5;s[Ke+(R*10156|0)+4676>>2]=te(_*327680>>16,d<<16>>16)|0;We=_<<16;Qe=We>>16;s[Ke+(R*10156|0)+4684>>2]=Qe*20;s[Ke+(R*10156|0)+4688>>2]=We>>15;s[Ke+(R*10156|0)+4644>>2]=Qe*18;s[Ke+(R*10156|0)+4640>>2]=te(Qe,(d|0)==4?24:14)|0;switch(_|0){case 16:{s[Ke+(R*10156|0)+4776>>2]=29962;_=16;break e}case 12:{s[Ke+(R*10156|0)+4776>>2]=29956;_=12;break e}default:{s[Ke+(R*10156|0)+4776>>2]=29947;break e}}}while(0);d=v+w|0;g=s[tt>>2]|0;do if((g|0)>=1){if((g|0)<2){s[Ke+(R*10156|0)+4736>>2]=1;s[Ke+(R*10156|0)+4744>>2]=49807;p=Ke+(R*10156|0)+4740|0;s[p>>2]=8;s[Ke+(R*10156|0)+4728>>2]=14;w=_*5|0;s[Ke+(R*10156|0)+4692>>2]=w;s[Ke+(R*10156|0)+4720>>2]=1;s[Ke+(R*10156|0)+4724>>2]=0;s[Ke+(R*10156|0)+4752>>2]=3;s[Ke+(R*10156|0)+4764>>2]=0;b=8;break}if((g|0)<3){s[Ke+(R*10156|0)+4736>>2]=0;s[Ke+(R*10156|0)+4744>>2]=52429;p=Ke+(R*10156|0)+4740|0;s[p>>2]=6;s[Ke+(R*10156|0)+4728>>2]=12;w=_*3|0;s[Ke+(R*10156|0)+4692>>2]=w;s[Ke+(R*10156|0)+4720>>2]=2;s[Ke+(R*10156|0)+4724>>2]=0;s[Ke+(R*10156|0)+4752>>2]=2;s[Ke+(R*10156|0)+4764>>2]=0;b=6;break}if((g|0)<4){s[Ke+(R*10156|0)+4736>>2]=1;s[Ke+(R*10156|0)+4744>>2]=49807;p=Ke+(R*10156|0)+4740|0;s[p>>2]=8;s[Ke+(R*10156|0)+4728>>2]=14;w=_*5|0;s[Ke+(R*10156|0)+4692>>2]=w;s[Ke+(R*10156|0)+4720>>2]=2;s[Ke+(R*10156|0)+4724>>2]=0;s[Ke+(R*10156|0)+4752>>2]=4;s[Ke+(R*10156|0)+4764>>2]=0;b=8;break}if((g|0)<6){s[Ke+(R*10156|0)+4736>>2]=1;s[Ke+(R*10156|0)+4744>>2]=48497;p=Ke+(R*10156|0)+4740|0;s[p>>2]=10;s[Ke+(R*10156|0)+4728>>2]=16;w=_*5|0;s[Ke+(R*10156|0)+4692>>2]=w;s[Ke+(R*10156|0)+4720>>2]=2;s[Ke+(R*10156|0)+4724>>2]=1;s[Ke+(R*10156|0)+4752>>2]=6;s[Ke+(R*10156|0)+4764>>2]=_*983;b=10;break}p=Ke+(R*10156|0)+4736|0;if((g|0)<8){s[p>>2]=1;s[Ke+(R*10156|0)+4744>>2]=47186;p=Ke+(R*10156|0)+4740|0;s[p>>2]=12;s[Ke+(R*10156|0)+4728>>2]=20;w=_*5|0;s[Ke+(R*10156|0)+4692>>2]=w;s[Ke+(R*10156|0)+4720>>2]=3;s[Ke+(R*10156|0)+4724>>2]=1;s[Ke+(R*10156|0)+4752>>2]=8;s[Ke+(R*10156|0)+4764>>2]=_*983;b=12;break}else{s[p>>2]=2;s[Ke+(R*10156|0)+4744>>2]=45875;p=Ke+(R*10156|0)+4740|0;s[p>>2]=16;s[Ke+(R*10156|0)+4728>>2]=24;w=_*5|0;s[Ke+(R*10156|0)+4692>>2]=w;s[Ke+(R*10156|0)+4720>>2]=4;s[Ke+(R*10156|0)+4724>>2]=1;s[Ke+(R*10156|0)+4752>>2]=16;s[Ke+(R*10156|0)+4764>>2]=_*983;b=16;break}}else{s[Ke+(R*10156|0)+4736>>2]=0;s[Ke+(R*10156|0)+4744>>2]=52429;p=Ke+(R*10156|0)+4740|0;s[p>>2]=6;s[Ke+(R*10156|0)+4728>>2]=12;w=_*3|0;s[Ke+(R*10156|0)+4692>>2]=w;s[Ke+(R*10156|0)+4720>>2]=1;s[Ke+(R*10156|0)+4724>>2]=0;s[Ke+(R*10156|0)+4752>>2]=2;s[Ke+(R*10156|0)+4764>>2]=0;b=6}while(0);We=s[Ke+(R*10156|0)+4732>>2]|0;s[p>>2]=(b|0)<(We|0)?b:We;s[Ke+(R*10156|0)+4696>>2]=(_*5|0)+(w<<1);s[Ke+(R*10156|0)+4716>>2]=g;p=s[I>>2]|0;s[Ke+(R*10156|0)+4708>>2]=p;We=Ke+(R*10156|0)+6184|0;b=s[We>>2]|0;Qe=s[S>>2]|0;s[We>>2]=Qe;do if(Qe|0)if(!b){s[Ke+(R*10156|0)+6188>>2]=7;break}else{Qe=7-(((p>>16)*26214|0)+(((p&65535)*26214|0)>>>16))|0;s[Ke+(R*10156|0)+6188>>2]=(Qe|0)>2?Qe:2;break}while(0);s[A>>2]=1;Qe=110}if((Qe|0)==110?(Qe=0,d|0):0){Qe=439;break}e:do if((s[Ke+(R*10156|0)+4756>>2]|0)!=0|P){p=0;while(1){if((p|0)>=(s[Ze>>2]|0))break e;s[Ke+(R*10156|0)+4816+(p<<2)>>2]=0;p=p+1|0}}while(0);s[Ke+(R*10156|0)+6172>>2]=s[T>>2];R=R+1|0;p=0}if((Qe|0)==439){u=at;return d|0}I=C*10|0;L=s[$e>>2]|0;O=te(I,L)|0;N=e+4648|0;L=(te(O,s[N>>2]|0)|0)/(L*1e3|0)|0;qe=Ne()|0;D=u;u=u+((1*(L<<1)|0)+15&-16)|0;L=e+4676|0;U=e+5832|0;Ge=e+20384|0;B=e+16024|0;j=e+5868|0;F=e+5188|0;G=e+14832|0;H=e+15988|0;z=e+14824|0;q=e+15344|0;W=f+28|0;V=f+32|0;Y=f+36|0;Z=f+20|0;$=f+40|0;K=f+24|0;X=f+8|0;J=f+4|0;Q=f+44|0;ee=e+20346|0;ie=e+14972|0;re=e+20364|0;se=e+20368|0;oe=e+4633|0;ae=e+4636|0;le=e+4788|0;fe=e+8|0;he=e+4624|0;ue=t+28|0;ce=e+20372|0;de=e+20312|0;pe=e+5192|0;be=e+15348|0;ze=t+60|0;we=e+20396|0;me=e+17416|0;ge=e+10300|0;_e=e+10172|0;ve=e+14792|0;ke=e+14724|0;ye=e+14789|0;Ee=e+14740|0;Ae=e+14912|0;Te=e+10156|0;Se=e+15346|0;Me=e+14780|0;Re=e+15013|0;Ce=e+16332|0;Pe=e+16328|0;xe=e+14968|0;Ie=e+5190|0;We=e+4857|0;Oe=e+6176|0;De=e+6172|0;Le=st+4|0;Ue=Xe<<1;Be=Xe+-1|0;je=e+20388|0;Fe=e+20316|0;_=i;x=0;while(1){w=s[U>>2]|0;g=(s[L>>2]|0)-w|0;g=(g|0)<(O|0)?g:O;P=te(g,s[N>>2]|0)|0;P=(P|0)/((s[$e>>2]|0)*1e3|0)|0;do if((s[t>>2]|0)==2)if((s[ot>>2]|0)==2){d=s[rt>>2]|0;b=0;while(1){if((b|0)>=(P|0))break;r[D+(b<<1)>>1]=r[_+(b<<1<<1)>>1]|0;b=b+1|0}if((s[Ge>>2]|0)==1&(d|0)==0)Sr(B|0,j|0,300)|0;zi(j,F+(w+2<<1)|0,D,P);s[U>>2]=(s[U>>2]|0)+g;b=s[H>>2]|0;w=(s[G>>2]|0)-b|0;d=te(I,s[z>>2]|0)|0;d=(w|0)<(d|0)?w:d;w=0;while(1){if((w|0)>=(P|0))break;r[D+(w<<1)>>1]=r[_+((w<<1|1)<<1)>>1]|0;w=w+1|0}zi(B,q+(b+2<<1)|0,D,P);s[H>>2]=(s[H>>2]|0)+d;d=s[U>>2]|0;break}else{if((s[ot>>2]|0)==1)d=0;else{Qe=136;break}while(1){if((d|0)>=(P|0))break;i=d<<1;i=(r[_+(i<<1)>>1]|0)+(r[_+((i|1)<<1)>>1]|0)|0;r[D+(d<<1)>>1]=(i>>>1)+(i&1);d=d+1|0}zi(j,F+(w+2<<1)|0,D,P);e:do if((s[Ge>>2]|0)==2){if(s[rt>>2]|0)break;zi(B,q+((s[H>>2]|0)+2<<1)|0,D,P);d=0;while(1){if((d|0)>=(s[L>>2]|0))break e;i=F+((s[U>>2]|0)+d+2<<1)|0;r[i>>1]=((r[i>>1]|0)+(r[q+((s[H>>2]|0)+d+2<<1)>>1]|0)|0)>>>1;d=d+1|0}}while(0);d=(s[U>>2]|0)+g|0;s[U>>2]=d;break}else Qe=136;while(0);if((Qe|0)==136){Qe=0;Sr(D|0,_|0,P<<1|0)|0;zi(j,F+(w+2<<1)|0,D,P);d=(s[U>>2]|0)+g|0;s[U>>2]=d}R=_+((te(P,s[t>>2]|0)|0)<<1)|0;C=l-P|0;s[Ve>>2]=0;if((d|0)<(s[L>>2]|0)){d=0;break}if(!((s[rt>>2]|0)!=0|Je^1)){d=256>>>(te((s[Ze>>2]|0)+1|0,s[ot>>2]|0)|0);i=s[W>>2]|0;d=i-(te(i>>>8,0-d&255)|0)|0;s[W>>2]=d;while(1){if(d>>>0>=8388609){v=0;break}b=s[V>>2]|0;g=b>>>23;if((g|0)==255)s[Y>>2]=(s[Y>>2]|0)+1;else{w=b>>>31;d=s[$>>2]|0;if((d|0)>-1){b=s[K>>2]|0;if((b+(s[X>>2]|0)|0)>>>0<(s[J>>2]|0)>>>0){s[K>>2]=b+1;n[(s[f>>2]|0)+b>>0]=d+w;d=0}else d=-1;s[Q>>2]=s[Q>>2]|d}d=s[Y>>2]|0;if(d|0){w=w+255&255;do{b=s[K>>2]|0;if((b+(s[X>>2]|0)|0)>>>0<(s[J>>2]|0)>>>0){s[K>>2]=b+1;n[(s[f>>2]|0)+b>>0]=w;b=0;d=s[Y>>2]|0}else b=-1;s[Q>>2]=s[Q>>2]|b;d=d+-1|0;s[Y>>2]=d}while((d|0)!=0)}s[$>>2]=g&255;b=s[V>>2]|0;d=s[W>>2]|0}s[V>>2]=b<<8&2147483392;d=d<<8;s[W>>2]=d;s[Z>>2]=(s[Z>>2]|0)+8}while(1){d=s[ot>>2]|0;if((v|0)>=(d|0)){M=0;break}b=s[Ke+(v*10156|0)+5836>>2]|0;_=0;d=0;while(1){if((d|0)>=(b|0))break;_=_|s[Ke+(v*10156|0)+4816+(d<<2)>>2]<>0]=(_|0)>0&1;e:do if((_|0)!=0&(b|0)>1){g=_+-1|0;d=s[17520+(b+-2<<2)>>2]|0;b=s[W>>2]|0;w=b>>>8;if((_|0)>1){i=d+(_+-2)|0;M=b-(te(w,o[i>>0]|0)|0)|0;s[V>>2]=(s[V>>2]|0)+M;d=te(w,(o[i>>0]|0)-(o[d+g>>0]|0)|0)|0}else d=b-(te(w,o[d+g>>0]|0)|0)|0;s[W>>2]=d;while(1){if(d>>>0>=8388609)break e;b=s[V>>2]|0;g=b>>>23;if((g|0)==255)s[Y>>2]=(s[Y>>2]|0)+1;else{w=b>>>31;d=s[$>>2]|0;if((d|0)>-1){b=s[K>>2]|0;if((b+(s[X>>2]|0)|0)>>>0<(s[J>>2]|0)>>>0){s[K>>2]=b+1;n[(s[f>>2]|0)+b>>0]=d+w;d=0}else d=-1;s[Q>>2]=s[Q>>2]|d}d=s[Y>>2]|0;if(d|0){w=w+255&255;do{b=s[K>>2]|0;if((b+(s[X>>2]|0)|0)>>>0<(s[J>>2]|0)>>>0){s[K>>2]=b+1;n[(s[f>>2]|0)+b>>0]=w;b=0;d=s[Y>>2]|0}else b=-1;s[Q>>2]=s[Q>>2]|b;d=d+-1|0;s[Y>>2]=d}while((d|0)!=0)}s[$>>2]=g&255;b=s[V>>2]|0;d=s[W>>2]|0}s[V>>2]=b<<8&2147483392;d=d<<8;s[W>>2]=d;s[Z>>2]=(s[Z>>2]|0)+8}}while(0);v=v+1|0}while(1){if((M|0)>=(s[Ze>>2]|0)){b=0;break}k=ee+(M*6|0)+2|0;y=ee+(M*6|0)+5|0;E=ie+(M<<2)|0;A=re+M|0;T=(M|0)>0;S=M+-1|0;v=0;while(1){if((v|0)>=(d|0))break;if(s[Ke+(v*10156|0)+4816+(M<<2)>>2]|0){e:do if((d|0)==2&(v|0)==0){d=((n[k>>0]|0)*5|0)+(n[y>>0]|0)|0;b=s[W>>2]|0;w=b>>>8;if((d|0)>0){i=o[29891+(d+-1)>>0]|0;_=b-(te(w,i)|0)|0;s[V>>2]=(s[V>>2]|0)+_;d=te(w,i-(o[29891+d>>0]|0)|0)|0}else d=b-(te(w,o[29891+d>>0]|0)|0)|0;s[W>>2]=d;while(1){if(d>>>0>=8388609){_=0;break}b=s[V>>2]|0;g=b>>>23;if((g|0)==255)s[Y>>2]=(s[Y>>2]|0)+1;else{w=b>>>31;d=s[$>>2]|0;if((d|0)>-1){b=s[K>>2]|0;if((b+(s[X>>2]|0)|0)>>>0<(s[J>>2]|0)>>>0){s[K>>2]=b+1;n[(s[f>>2]|0)+b>>0]=d+w;d=0}else d=-1;s[Q>>2]=s[Q>>2]|d}d=s[Y>>2]|0;if(d|0){w=w+255&255;do{b=s[K>>2]|0;if((b+(s[X>>2]|0)|0)>>>0<(s[J>>2]|0)>>>0){s[K>>2]=b+1;n[(s[f>>2]|0)+b>>0]=w;b=0;d=s[Y>>2]|0}else b=-1;s[Q>>2]=s[Q>>2]|b;d=d+-1|0;s[Y>>2]=d}while((d|0)!=0)}s[$>>2]=g&255;b=s[V>>2]|0;d=s[W>>2]|0}s[V>>2]=b<<8&2147483392;d=d<<8;s[W>>2]=d;s[Z>>2]=(s[Z>>2]|0)+8}while(1){if((_|0)==2)break;i=n[ee+(M*6|0)+(_*3|0)>>0]|0;b=i<<24>>24;w=d>>>8;if(i<<24>>24>0){i=o[29944+(b+-1)>>0]|0;d=d-(te(w,i)|0)|0;s[V>>2]=(s[V>>2]|0)+d;d=te(w,i-(o[29944+b>>0]|0)|0)|0}else d=d-(te(w,o[29944+b>>0]|0)|0)|0;s[W>>2]=d;while(1){if(d>>>0>=8388609)break;b=s[V>>2]|0;g=b>>>23;if((g|0)==255)s[Y>>2]=(s[Y>>2]|0)+1;else{w=b>>>31;d=s[$>>2]|0;if((d|0)>-1){b=s[K>>2]|0;if((b+(s[X>>2]|0)|0)>>>0<(s[J>>2]|0)>>>0){s[K>>2]=b+1;n[(s[f>>2]|0)+b>>0]=d+w;d=0}else d=-1;s[Q>>2]=s[Q>>2]|d}d=s[Y>>2]|0;if(d|0){w=w+255&255;do{b=s[K>>2]|0;if((b+(s[X>>2]|0)|0)>>>0<(s[J>>2]|0)>>>0){s[K>>2]=b+1;n[(s[f>>2]|0)+b>>0]=w;b=0;d=s[Y>>2]|0}else b=-1;s[Q>>2]=s[Q>>2]|b;d=d+-1|0;s[Y>>2]=d}while((d|0)!=0)}s[$>>2]=g&255;b=s[V>>2]|0;d=s[W>>2]|0}s[V>>2]=b<<8&2147483392;d=d<<8;s[W>>2]=d;s[Z>>2]=(s[Z>>2]|0)+8}i=n[ee+(M*6|0)+(_*3|0)+1>>0]|0;b=i<<24>>24;w=d>>>8;if(i<<24>>24>0){i=o[29951+(b+-1)>>0]|0;d=d-(te(w,i)|0)|0;s[V>>2]=(s[V>>2]|0)+d;d=te(w,i-(o[29951+b>>0]|0)|0)|0}else d=d-(te(w,o[29951+b>>0]|0)|0)|0;s[W>>2]=d;while(1){if(d>>>0>=8388609)break;b=s[V>>2]|0;g=b>>>23;if((g|0)==255)s[Y>>2]=(s[Y>>2]|0)+1;else{w=b>>>31;d=s[$>>2]|0;if((d|0)>-1){b=s[K>>2]|0;if((b+(s[X>>2]|0)|0)>>>0<(s[J>>2]|0)>>>0){s[K>>2]=b+1;n[(s[f>>2]|0)+b>>0]=d+w;d=0}else d=-1;s[Q>>2]=s[Q>>2]|d}d=s[Y>>2]|0;if(d|0){w=w+255&255;do{b=s[K>>2]|0;if((b+(s[X>>2]|0)|0)>>>0<(s[J>>2]|0)>>>0){s[K>>2]=b+1;n[(s[f>>2]|0)+b>>0]=w;b=0;d=s[Y>>2]|0}else b=-1;s[Q>>2]=s[Q>>2]|b;d=d+-1|0;s[Y>>2]=d}while((d|0)!=0)}s[$>>2]=g&255;b=s[V>>2]|0;d=s[W>>2]|0}s[V>>2]=b<<8&2147483392;d=d<<8;s[W>>2]=d;s[Z>>2]=(s[Z>>2]|0)+8}_=_+1|0}if(s[E>>2]|0)break;i=n[A>>0]|0;b=i<<24>>24;w=d>>>8;if(i<<24>>24>0){i=o[29916+(b+-1)>>0]|0;d=d-(te(w,i)|0)|0;s[V>>2]=(s[V>>2]|0)+d;d=te(w,i-(o[29916+b>>0]|0)|0)|0}else d=d-(te(w,o[29916+b>>0]|0)|0)|0;s[W>>2]=d;while(1){if(d>>>0>=8388609)break e;b=s[V>>2]|0;g=b>>>23;if((g|0)==255)s[Y>>2]=(s[Y>>2]|0)+1;else{w=b>>>31;b=s[$>>2]|0;if((b|0)>-1){d=s[K>>2]|0;if((d+(s[X>>2]|0)|0)>>>0<(s[J>>2]|0)>>>0){s[K>>2]=d+1;n[(s[f>>2]|0)+d>>0]=b+w;d=0}else d=-1;s[Q>>2]=s[Q>>2]|d}d=s[Y>>2]|0;if(d|0){w=w+255&255;do{b=s[K>>2]|0;if((b+(s[X>>2]|0)|0)>>>0<(s[J>>2]|0)>>>0){s[K>>2]=b+1;n[(s[f>>2]|0)+b>>0]=w;b=0;d=s[Y>>2]|0}else b=-1;s[Q>>2]=s[Q>>2]|b;d=d+-1|0;s[Y>>2]=d}while((d|0)!=0)}s[$>>2]=g&255;b=s[V>>2]|0;d=s[W>>2]|0}s[V>>2]=b<<8&2147483392;d=d<<8;s[W>>2]=d;s[Z>>2]=(s[Z>>2]|0)+8}}while(0);if(T?(s[Ke+(v*10156|0)+4816+(S<<2)>>2]|0)!=0:0)d=2;else d=0;Di(Ke+(v*10156|0)|0,f,M,1,d);Li(f,n[Ke+(v*10156|0)+6192+(M*36|0)+29>>0]|0,n[Ke+(v*10156|0)+6192+(M*36|0)+30>>0]|0,Ke+(v*10156|0)+6300+(M*320|0)|0,s[Ke+(v*10156|0)+4676>>2]|0);d=s[ot>>2]|0}v=v+1|0}M=M+1|0}while(1){if((b|0)>=(d|0))break;d=Ke+(b*10156|0)+4816|0;s[d>>2]=0;s[d+4>>2]=0;s[d+8>>2]=0;d=s[ot>>2]|0;b=b+1|0}s[se>>2]=(s[Z>>2]|0)+((ne(s[W>>2]|0)|0)+-32)}if((n[oe>>0]|0)==2){d=te(s[$e>>2]|0,65536e3)|0;d=(d|0)/(s[ae>>2]|0)|0;g=ne(d|0)|0;b=24-g|0;w=0-b|0;do if(b)if((b|0)<0){d=d<>>(b+32|0);break}else{d=d<<32-b|d>>>b;break}while(0);T=d&127;T=T+(((te(T,128-T|0)|0)*179|0)>>>16)+(31-g<<7)|0;M=s[le>>2]|0;i=0-M<<2;M=M<<16>>16;S=te(i>>16,M)|0;M=te(i&65532,M)|0;i=(T<<16)+-183762944>>16;i=T+-2048+((te(S+(M>>16)>>16,i)|0)+((te(S+(M>>>16)&65535,i)|0)>>16))|0;M=s[fe>>2]|0;i=i-(M>>8)|0;i=(i|0)<0?i*3|0:i;i=te(s[he>>2]<<16>>16,(i|0)>51?51:((i|0)<-51?-51:i)<<16>>16)|0;i=M+(((i>>16)*6554|0)+(((i&65535)*6554|0)>>>16))|0;s[fe>>2]=(i|0)>217856?217856:(i|0)<193536?193536:i}g=s[ue>>2]|0;b=s[it>>2]|0;d=(te(g,b)|0)/1e3|0;if(Je)d=d-(s[se>>2]|0)|0;w=(d|0)/(s[Ze>>2]|0)|0;d=te(w<<16>>16,(b|0)==10?100:50)|0;d=d-(s[ce>>2]<<1)|0;do if(Je){b=s[rt>>2]|0;if((b|0)<=0)break;i=(s[Z>>2]|0)+((ne(s[W>>2]|0)|0)+-32)|0;d=d-(i-(s[se>>2]|0)-(te(w,b)|0)<<1)|0}while(0);do if((g|0)>5e3){if((d|0)>(g|0))break;g=(d|0)<5e3?5e3:d}else{if((d|0)>5e3){g=5e3;break}g=(d|0)<(g|0)?g:d}while(0);e:do if((s[ot>>2]|0)==2){d=s[rt>>2]|0;Bi(de,pe,be,ee+(d*6|0)|0,re+d|0,st,g,s[he>>2]|0,s[ze>>2]|0,s[$e>>2]|0,s[L>>2]|0);d=s[rt>>2]|0;do if(!(n[re+d>>0]|0)){if((s[we>>2]|0)==1){s[me>>2]=0;s[me+4>>2]=0;s[me+8>>2]=0;i=_e;s[i>>2]=0;s[i+4>>2]=0;yr(ge|0,0,4480)|0;s[ve>>2]=100;s[ke>>2]=100;n[me>>0]=10;n[ye>>0]=0;s[Ee>>2]=65536;s[Ae>>2]=1}An(Te,Se);if((s[Me>>2]|0)>=13){s[Ce>>2]=0;s[Pe>>2]=0;n[Re>>0]=1;n[(s[nt>>2]|0)+(Te+4812)>>0]=1;break}n[Re>>0]=0;d=s[Ce>>2]|0;i=d+1|0;s[Ce>>2]=i;do if((i|0)<10)s[Pe>>2]=0;else{if((d|0)<=29)break;s[Ce>>2]=10;s[Pe>>2]=0}while(0);n[(s[nt>>2]|0)+(Te+4812)>>0]=0}else n[xe+d>>0]=0;while(0);if(!Je)break;k=s[rt>>2]|0;d=((n[ee+(k*6|0)+2>>0]|0)*5|0)+(n[ee+(k*6|0)+5>>0]|0)|0;b=s[W>>2]|0;w=b>>>8;if((d|0)>0){i=o[29891+(d+-1)>>0]|0;M=b-(te(w,i)|0)|0;s[V>>2]=(s[V>>2]|0)+M;d=te(w,i-(o[29891+d>>0]|0)|0)|0}else d=b-(te(w,o[29891+d>>0]|0)|0)|0;s[W>>2]=d;while(1){if(d>>>0>=8388609){w=d;v=0;break}b=s[V>>2]|0;_=b>>>23;if((_|0)==255)s[Y>>2]=(s[Y>>2]|0)+1;else{w=b>>>31;d=s[$>>2]|0;if((d|0)>-1){b=s[K>>2]|0;if((b+(s[X>>2]|0)|0)>>>0<(s[J>>2]|0)>>>0){s[K>>2]=b+1;n[(s[f>>2]|0)+b>>0]=d+w;d=0}else d=-1;s[Q>>2]=s[Q>>2]|d}d=s[Y>>2]|0;if(d|0){w=w+255&255;do{b=s[K>>2]|0;if((b+(s[X>>2]|0)|0)>>>0<(s[J>>2]|0)>>>0){s[K>>2]=b+1;n[(s[f>>2]|0)+b>>0]=w;b=0;d=s[Y>>2]|0}else b=-1;s[Q>>2]=s[Q>>2]|b;d=d+-1|0;s[Y>>2]=d}while((d|0)!=0)}s[$>>2]=_&255;b=s[V>>2]|0;d=s[W>>2]|0}s[V>>2]=b<<8&2147483392;d=d<<8;s[W>>2]=d;s[Z>>2]=(s[Z>>2]|0)+8}while(1){if((v|0)==2)break;i=n[ee+(k*6|0)+(v*3|0)>>0]|0;d=i<<24>>24;b=w>>>8;if(i<<24>>24>0){i=o[29944+(d+-1)>>0]|0;M=w-(te(b,i)|0)|0;s[V>>2]=(s[V>>2]|0)+M;d=te(b,i-(o[29944+d>>0]|0)|0)|0}else d=w-(te(b,o[29944+d>>0]|0)|0)|0;s[W>>2]=d;while(1){if(d>>>0>=8388609)break;b=s[V>>2]|0;_=b>>>23;if((_|0)==255)s[Y>>2]=(s[Y>>2]|0)+1;else{w=b>>>31;d=s[$>>2]|0;if((d|0)>-1){b=s[K>>2]|0;if((b+(s[X>>2]|0)|0)>>>0<(s[J>>2]|0)>>>0){s[K>>2]=b+1;n[(s[f>>2]|0)+b>>0]=d+w;d=0}else d=-1;s[Q>>2]=s[Q>>2]|d}d=s[Y>>2]|0;if(d|0){w=w+255&255;do{b=s[K>>2]|0;if((b+(s[X>>2]|0)|0)>>>0<(s[J>>2]|0)>>>0){s[K>>2]=b+1;n[(s[f>>2]|0)+b>>0]=w;b=0;d=s[Y>>2]|0}else b=-1;s[Q>>2]=s[Q>>2]|b;d=d+-1|0;s[Y>>2]=d}while((d|0)!=0)}s[$>>2]=_&255;b=s[V>>2]|0;d=s[W>>2]|0}s[V>>2]=b<<8&2147483392;d=d<<8;s[W>>2]=d;s[Z>>2]=(s[Z>>2]|0)+8}i=n[ee+(k*6|0)+(v*3|0)+1>>0]|0;b=i<<24>>24;w=d>>>8;if(i<<24>>24>0){i=o[29951+(b+-1)>>0]|0;d=d-(te(w,i)|0)|0;s[V>>2]=(s[V>>2]|0)+d;d=te(w,i-(o[29951+b>>0]|0)|0)|0}else d=d-(te(w,o[29951+b>>0]|0)|0)|0;s[W>>2]=d;while(1){if(d>>>0>=8388609)break;b=s[V>>2]|0;_=b>>>23;if((_|0)==255)s[Y>>2]=(s[Y>>2]|0)+1;else{w=b>>>31;d=s[$>>2]|0;if((d|0)>-1){b=s[K>>2]|0;if((b+(s[X>>2]|0)|0)>>>0<(s[J>>2]|0)>>>0){s[K>>2]=b+1;n[(s[f>>2]|0)+b>>0]=d+w;d=0}else d=-1;s[Q>>2]=s[Q>>2]|d}d=s[Y>>2]|0;if(d|0){w=w+255&255;do{b=s[K>>2]|0;if((b+(s[X>>2]|0)|0)>>>0<(s[J>>2]|0)>>>0){s[K>>2]=b+1;n[(s[f>>2]|0)+b>>0]=w;b=0;d=s[Y>>2]|0}else b=-1;s[Q>>2]=s[Q>>2]|b;d=d+-1|0;s[Y>>2]=d}while((d|0)!=0)}s[$>>2]=_&255;b=s[V>>2]|0;d=s[W>>2]|0}s[V>>2]=b<<8&2147483392;d=d<<8;s[W>>2]=d;s[Z>>2]=(s[Z>>2]|0)+8}w=d;v=v+1|0}d=s[rt>>2]|0;if(n[xe+d>>0]|0)break;i=n[re+d>>0]|0;d=i<<24>>24;b=w>>>8;if(i<<24>>24>0){i=o[29916+(d+-1)>>0]|0;M=w-(te(b,i)|0)|0;s[V>>2]=(s[V>>2]|0)+M;d=te(b,i-(o[29916+d>>0]|0)|0)|0}else d=w-(te(b,o[29916+d>>0]|0)|0)|0;s[W>>2]=d;while(1){if(d>>>0>=8388609)break e;b=s[V>>2]|0;_=b>>>23;if((_|0)==255)s[Y>>2]=(s[Y>>2]|0)+1;else{w=b>>>31;d=s[$>>2]|0;if((d|0)>-1){b=s[K>>2]|0;if((b+(s[X>>2]|0)|0)>>>0<(s[J>>2]|0)>>>0){s[K>>2]=b+1;n[(s[f>>2]|0)+b>>0]=d+w;d=0}else d=-1;s[Q>>2]=s[Q>>2]|d}d=s[Y>>2]|0;if(d|0){w=w+255&255;do{b=s[K>>2]|0;if((b+(s[X>>2]|0)|0)>>>0<(s[J>>2]|0)>>>0){s[K>>2]=b+1;n[(s[f>>2]|0)+b>>0]=w;b=0;d=s[Y>>2]|0}else b=-1;s[Q>>2]=s[Q>>2]|b;d=d+-1|0;s[Y>>2]=d}while((d|0)!=0)}s[$>>2]=_&255;b=s[V>>2]|0;d=s[W>>2]|0}s[V>>2]=b<<8&2147483392;d=d<<8;s[W>>2]=d;s[Z>>2]=(s[Z>>2]|0)+8}}else{s[F>>2]=s[Fe>>2];i=F+(s[L>>2]<<1)|0;i=a[i>>1]|a[i+2>>1]<<16;r[Fe>>1]=i;r[Fe+2>>1]=i>>>16}while(0);An(e,Ie);if((s[he>>2]|0)<13){n[We>>0]=0;d=s[Oe>>2]|0;i=d+1|0;s[Oe>>2]=i;do if((i|0)<10)s[De>>2]=0;else{if((d|0)<=29)break;s[Oe>>2]=10;s[De>>2]=0}while(0);n[(s[rt>>2]|0)+(e+4812)>>0]=0}else{s[Oe>>2]=0;s[De>>2]=0;n[We>>0]=1;n[(s[rt>>2]|0)+(e+4812)>>0]=1}k=(x|0)==0;y=s[Le>>2]|0;E=(x|0)==(Be|0);A=(x|0)==1;T=0;while(1){d=s[ot>>2]|0;if((T|0)>=(d|0))break;b=s[Ye>>2]|0;e:do switch(Xe|0){case 2:{if(!k){w=b;break e}w=(b*3|0)/5|0;break}case 3:{if(k){w=(b<<1|0)/5|0;break e}if(!A){w=b;break e}w=(b*3|0)/4|0;break}default:w=b}while(0);_=E&(s[et>>2]|0)!=0&1;do if((d|0)==1){d=g;v=_}else{d=s[st+(T<<2)>>2]|0;if((T|0)!=0|(y|0)<1){v=_;break}w=w-((b|0)/(Ue|0)|0)|0;v=0}while(0);if((d|0)>0){p=(d|0)>8e4?8e4:(d|0)<5e3?5e3:d;d=Ke+(T*10156|0)+4700|0;e:do if((p|0)!=(s[d>>2]|0)){s[d>>2]=p;_=s[Ke+(T*10156|0)+4668>>2]|0;_=(_|0)==8?17424:(_|0)==12?17456:17488;d=(s[Ke+(T*10156|0)+4672>>2]|0)==2?p+-2200|0:p;b=1;while(1){if((b|0)>=8)break e;p=s[_+(b<<2)>>2]|0;if((d|0)<=(p|0))break;b=b+1|0}i=b+-1|0;M=s[_+(i<<2)>>2]|0;i=r[25356+(i<<1)>>1]|0;s[Ke+(T*10156|0)+4808>>2]=(i<<6)+(te((d-M<<6|0)/(p-M|0)|0,(r[25356+(b<<1)>>1]|0)-i|0)|0)}while(0);do if((s[rt>>2]|0)>(T|0)){if((T|0)>0?s[we>>2]|0:0){d=1;break}d=2}else d=0;while(0);p=Xi(Ke+(T*10156|0)|0,h,f,d,w,v)|0}s[Ke+(T*10156|0)+4760>>2]=0;s[Ke+(T*10156|0)+5832>>2]=0;i=Ke+(T*10156|0)+5840|0;s[i>>2]=(s[i>>2]|0)+1;T=T+1|0}w=s[rt>>2]|0;s[we>>2]=n[re+(w+-1)>>0];do if((s[h>>2]|0)>0){if((w|0)!=(s[Ze>>2]|0))break;g=s[ot>>2]|0;k=0;v=0;while(1){if((v|0)>=(g|0))break;_=s[Ke+(v*10156|0)+5836>>2]|0;d=k;b=0;while(1){d=d<<1;if((b|0)>=(_|0))break;d=d|n[Ke+(v*10156|0)+4812+b>>0];b=b+1|0}k=d|n[Ke+(v*10156|0)+4815>>0];v=v+1|0}do if(Je){d=te(w+1|0,g)|0;b=8-d|0;w=(1<>2]|0){i=s[f>>2]|0;n[i>>0]=o[i>>0]&(w^255)|k<>2]|0;if((g|0)>-1){s[$>>2]=g&~w|k<>2]|0)>>>0>-2147483648>>>d>>>0){s[Q>>2]=-1;break}else{s[V>>2]=s[V>>2]&~(w<<23)|k<>2]|0){if((s[ot>>2]|0)!=1?(s[Pe>>2]|0)==0:0)break;s[h>>2]=0}while(0);d=(s[ce>>2]|0)+(s[h>>2]<<3)|0;s[ce>>2]=d;d=d-((te(s[ue>>2]|0,s[it>>2]|0)|0)/1e3|0)|0;s[ce>>2]=(d|0)>1e4?1e4:(d|0)<0?0:d;d=s[je>>2]|0;if((s[he>>2]|0)<(((d<<16>>16)*3188>>16)+13|0)){s[Ve>>2]=1;s[je>>2]=0;break}else{s[Ve>>2]=0;s[je>>2]=d+(s[it>>2]|0);break}}while(0);if((l|0)==(P|0)){Qe=428;break}_=R;l=C;x=x+1|0}if((Qe|0)==428)d=s[Ve>>2]|0;s[Ge>>2]=s[ot>>2];s[t+76>>2]=d;if((s[$e>>2]|0)==16)d=(s[e+28>>2]|0)==0;else d=0;s[t+80>>2]=d&1;s[t+72>>2]=(s[$e>>2]<<16>>16)*1e3;if(!(s[ze>>2]|0))d=r[e+20340>>1]|0;else d=0;s[t+84>>2]=d;e:do if(!Je){s[it>>2]=m;s[tt>>2]=c;d=0;while(1){if((d|0)>=(s[ot>>2]|0))break e;s[Ke+(d*10156|0)+4760>>2]=0;s[Ke+(d*10156|0)+4772>>2]=0;d=d+1|0}}while(0);s[t+92>>2]=n[We>>0];s[t+96>>2]=r[25404+(n[We>>0]>>1<<2)+(n[e+4858>>0]<<1)>>1];He(qe|0);e=p;u=at;return e|0}function Di(e,t,i,a,l){e=e|0;t=t|0;i=i|0;a=a|0;l=l|0;var f=0,h=0,c=0,d=0,p=0,b=0,w=0,m=0,g=0,_=0,v=0,k=0,y=0,E=0,A=0,T=0,S=0,M=0,R=0,C=0,P=0,x=0;x=u;u=u+48|0;E=x;k=x+32|0;R=(a|0)==0;P=R?e+4828|0:e+6192+(i*36|0)|0;C=P+29|0;h=(n[C>>0]<<1)+(n[P+30>>0]|0)|0;e:do if((h|0)>1|R^1){i=h+-2|0;v=t+28|0;a=s[v>>2]|0;f=a>>>8;if((h|0)>2){R=o[29933+(h+-3)>>0]|0;M=a-(te(f,R)|0)|0;c=t+32|0;s[c>>2]=(s[c>>2]|0)+M;i=te(f,R-(o[29933+i>>0]|0)|0)|0;s[v>>2]=i}else{i=a-(te(f,o[29933+i>>0]|0)|0)|0;s[v>>2]=i;c=t+32|0}d=t+36|0;p=t+20|0;b=t+40|0;w=t+24|0;m=t+8|0;g=t+4|0;_=t+44|0;while(1){if(i>>>0>=8388609){h=i;break e}a=s[c>>2]|0;h=a>>>23;if((h|0)==255)s[d>>2]=(s[d>>2]|0)+1;else{f=a>>>31;i=s[b>>2]|0;if((i|0)>-1){a=s[w>>2]|0;if((a+(s[m>>2]|0)|0)>>>0<(s[g>>2]|0)>>>0){s[w>>2]=a+1;n[(s[t>>2]|0)+a>>0]=i+f;i=0}else i=-1;s[_>>2]=s[_>>2]|i}i=s[d>>2]|0;if(i|0){f=f+255&255;do{a=s[w>>2]|0;if((a+(s[m>>2]|0)|0)>>>0<(s[g>>2]|0)>>>0){s[w>>2]=a+1;n[(s[t>>2]|0)+a>>0]=f;a=0;i=s[d>>2]|0}else a=-1;s[_>>2]=s[_>>2]|a;i=i+-1|0;s[d>>2]=i}while((i|0)!=0)}s[b>>2]=h&255;a=s[c>>2]|0;i=s[v>>2]|0}s[c>>2]=a<<8&2147483392;i=i<<8;s[v>>2]=i;s[p>>2]=(s[p>>2]|0)+8}}else{v=t+28|0;i=s[v>>2]|0;a=i>>>8;if((h|0)>0){R=o[29937+(h+-1)>>0]|0;i=i-(te(a,R)|0)|0;c=t+32|0;s[c>>2]=(s[c>>2]|0)+i;i=te(a,R-(o[29937+h>>0]|0)|0)|0;s[v>>2]=i}else{i=i-(te(a,o[29937+h>>0]|0)|0)|0;s[v>>2]=i;c=t+32|0}d=t+36|0;p=t+20|0;b=t+40|0;w=t+24|0;m=t+8|0;g=t+4|0;_=t+44|0;while(1){if(i>>>0>=8388609){h=i;break e}a=s[c>>2]|0;h=a>>>23;if((h|0)==255)s[d>>2]=(s[d>>2]|0)+1;else{f=a>>>31;i=s[b>>2]|0;if((i|0)>-1){a=s[w>>2]|0;if((a+(s[m>>2]|0)|0)>>>0<(s[g>>2]|0)>>>0){s[w>>2]=a+1;n[(s[t>>2]|0)+a>>0]=i+f;i=0}else i=-1;s[_>>2]=s[_>>2]|i}i=s[d>>2]|0;if(i|0){f=f+255&255;do{a=s[w>>2]|0;if((a+(s[m>>2]|0)|0)>>>0<(s[g>>2]|0)>>>0){s[w>>2]=a+1;n[(s[t>>2]|0)+a>>0]=f;a=0;i=s[d>>2]|0}else a=-1;s[_>>2]=s[_>>2]|a;i=i+-1|0;s[d>>2]=i}while((i|0)!=0)}s[b>>2]=h&255;a=s[c>>2]|0;i=s[v>>2]|0}s[c>>2]=a<<8&2147483392;i=i<<8;s[v>>2]=i;s[p>>2]=(s[p>>2]|0)+8}}while(0);y=(l|0)==2;i=n[P>>0]|0;a=i<<24>>24;e:do if(y){b=t+28|0;f=h>>>8;if(i<<24>>24>0){i=o[29396+(a+-1)>>0]|0;R=h-(te(f,i)|0)|0;c=t+32|0;s[c>>2]=(s[c>>2]|0)+R;i=te(f,i-(o[29396+a>>0]|0)|0)|0;s[b>>2]=i}else{i=h-(te(f,o[29396+a>>0]|0)|0)|0;s[b>>2]=i;c=t+32|0}d=t+36|0;p=t+20|0;w=t+40|0;m=t+24|0;g=t+8|0;_=t+4|0;v=t+44|0;while(1){if(i>>>0>=8388609){R=c;M=d;S=_;break e}a=s[c>>2]|0;h=a>>>23;if((h|0)==255)s[d>>2]=(s[d>>2]|0)+1;else{f=a>>>31;i=s[w>>2]|0;if((i|0)>-1){a=s[m>>2]|0;if((a+(s[g>>2]|0)|0)>>>0<(s[_>>2]|0)>>>0){s[m>>2]=a+1;n[(s[t>>2]|0)+a>>0]=i+f;i=0}else i=-1;s[v>>2]=s[v>>2]|i}i=s[d>>2]|0;if(i|0){f=f+255&255;do{a=s[m>>2]|0;if((a+(s[g>>2]|0)|0)>>>0<(s[_>>2]|0)>>>0){s[m>>2]=a+1;n[(s[t>>2]|0)+a>>0]=f;a=0;i=s[d>>2]|0}else a=-1;s[v>>2]=s[v>>2]|a;i=i+-1|0;s[d>>2]=i}while((i|0)!=0)}s[w>>2]=h&255;a=s[c>>2]|0;i=s[b>>2]|0}s[c>>2]=a<<8&2147483392;i=i<<8;s[b>>2]=i;s[p>>2]=(s[p>>2]|0)+8}}else{i=a>>3;a=n[C>>0]|0;b=t+28|0;f=h>>>8;if((i|0)>0){R=o[i+-1+(29372+(a<<3))>>0]|0;M=h-(te(f,R)|0)|0;c=t+32|0;s[c>>2]=(s[c>>2]|0)+M;i=te(f,R-(o[29372+(a<<3)+i>>0]|0)|0)|0;s[b>>2]=i}else{i=h-(te(f,o[29372+(a<<3)+i>>0]|0)|0)|0;s[b>>2]=i;c=t+32|0}d=t+36|0;p=t+20|0;w=t+40|0;m=t+24|0;g=t+8|0;_=t+4|0;v=t+44|0;while(1){if(i>>>0>=8388609)break;a=s[c>>2]|0;h=a>>>23;if((h|0)==255)s[d>>2]=(s[d>>2]|0)+1;else{f=a>>>31;i=s[w>>2]|0;if((i|0)>-1){a=s[m>>2]|0;if((a+(s[g>>2]|0)|0)>>>0<(s[_>>2]|0)>>>0){s[m>>2]=a+1;n[(s[t>>2]|0)+a>>0]=i+f;i=0}else i=-1;s[v>>2]=s[v>>2]|i}i=s[d>>2]|0;if(i|0){f=f+255&255;do{a=s[m>>2]|0;if((a+(s[g>>2]|0)|0)>>>0<(s[_>>2]|0)>>>0){s[m>>2]=a+1;n[(s[t>>2]|0)+a>>0]=f; -a=0;i=s[d>>2]|0}else a=-1;s[v>>2]=s[v>>2]|a;i=i+-1|0;s[d>>2]=i}while((i|0)!=0)}s[w>>2]=h&255;a=s[c>>2]|0;i=s[b>>2]|0}s[c>>2]=a<<8&2147483392;i=i<<8;s[b>>2]=i;s[p>>2]=(s[p>>2]|0)+8}a=o[P>>0]&7;f=i>>>8;h=n[29962+a>>0]|0;if(!a)i=i-(te(f,h&255)|0)|0;else{R=o[29962+(a+-1)>>0]|0;i=i-(te(f,R)|0)|0;s[c>>2]=(s[c>>2]|0)+i;i=te(f,R-(h&255)|0)|0}s[b>>2]=i;while(1){if(i>>>0>=8388609){R=c;M=d;S=_;break e}a=s[c>>2]|0;h=a>>>23;if((h|0)==255)s[d>>2]=(s[d>>2]|0)+1;else{f=a>>>31;i=s[w>>2]|0;if((i|0)>-1){a=s[m>>2]|0;if((a+(s[g>>2]|0)|0)>>>0<(s[_>>2]|0)>>>0){s[m>>2]=a+1;n[(s[t>>2]|0)+a>>0]=i+f;i=0}else i=-1;s[v>>2]=s[v>>2]|i}i=s[d>>2]|0;if(i|0){f=f+255&255;do{a=s[m>>2]|0;if((a+(s[g>>2]|0)|0)>>>0<(s[_>>2]|0)>>>0){s[m>>2]=a+1;n[(s[t>>2]|0)+a>>0]=f;a=0;i=s[d>>2]|0}else a=-1;s[v>>2]=s[v>>2]|a;i=i+-1|0;s[d>>2]=i}while((i|0)!=0)}s[w>>2]=h&255;a=s[c>>2]|0;i=s[b>>2]|0}s[c>>2]=a<<8&2147483392;i=i<<8;s[b>>2]=i;s[p>>2]=(s[p>>2]|0)+8}}while(0);A=e+4672|0;c=1;while(1){if((c|0)>=(s[A>>2]|0))break;_=n[P+c>>0]|0;a=_<<24>>24;f=i>>>8;if(_<<24>>24>0){_=o[29396+(a+-1)>>0]|0;i=i-(te(f,_)|0)|0;s[R>>2]=(s[R>>2]|0)+i;i=te(f,_-(o[29396+a>>0]|0)|0)|0}else i=i-(te(f,o[29396+a>>0]|0)|0)|0;s[b>>2]=i;while(1){if(i>>>0>=8388609)break;a=s[R>>2]|0;h=a>>>23;if((h|0)==255)s[M>>2]=(s[M>>2]|0)+1;else{f=a>>>31;i=s[w>>2]|0;if((i|0)>-1){a=s[m>>2]|0;if((a+(s[g>>2]|0)|0)>>>0<(s[S>>2]|0)>>>0){s[m>>2]=a+1;n[(s[t>>2]|0)+a>>0]=i+f;i=0}else i=-1;s[v>>2]=s[v>>2]|i}i=s[M>>2]|0;if(i|0){f=f+255&255;do{a=s[m>>2]|0;if((a+(s[g>>2]|0)|0)>>>0<(s[S>>2]|0)>>>0){s[m>>2]=a+1;n[(s[t>>2]|0)+a>>0]=f;a=0;i=s[M>>2]|0}else a=-1;s[v>>2]=s[v>>2]|a;i=i+-1|0;s[M>>2]=i}while((i|0)!=0)}s[w>>2]=h&255;a=s[R>>2]|0;i=s[b>>2]|0}s[R>>2]=a<<8&2147483392;i=i<<8;s[b>>2]=i;s[p>>2]=(s[p>>2]|0)+8}c=c+1|0}c=P+8|0;d=n[c>>0]|0;a=d<<24>>24;_=e+4784|0;h=s[_>>2]|0;f=te(n[C>>0]>>1,r[h>>1]|0)|0;f=(s[h+16>>2]|0)+f|0;h=i>>>8;if(d<<24>>24>0){d=f+(a+-1)|0;i=i-(te(h,o[d>>0]|0)|0)|0;s[R>>2]=(s[R>>2]|0)+i;i=te(h,(o[d>>0]|0)-(o[f+a>>0]|0)|0)|0}else i=i-(te(h,o[f+a>>0]|0)|0)|0;s[b>>2]=i;while(1){if(i>>>0>=8388609)break;a=s[R>>2]|0;h=a>>>23;if((h|0)==255)s[M>>2]=(s[M>>2]|0)+1;else{f=a>>>31;i=s[w>>2]|0;if((i|0)>-1){a=s[m>>2]|0;if((a+(s[g>>2]|0)|0)>>>0<(s[S>>2]|0)>>>0){s[m>>2]=a+1;n[(s[t>>2]|0)+a>>0]=i+f;i=0}else i=-1;s[v>>2]=s[v>>2]|i}i=s[M>>2]|0;if(i|0){f=f+255&255;do{a=s[m>>2]|0;if((a+(s[g>>2]|0)|0)>>>0<(s[S>>2]|0)>>>0){s[m>>2]=a+1;n[(s[t>>2]|0)+a>>0]=f;a=0;i=s[M>>2]|0}else a=-1;s[v>>2]=s[v>>2]|a;i=i+-1|0;s[M>>2]=i}while((i|0)!=0)}s[w>>2]=h&255;a=s[R>>2]|0;i=s[b>>2]|0}s[R>>2]=a<<8&2147483392;i=i<<8;s[b>>2]=i;s[p>>2]=(s[p>>2]|0)+8}Ui(E,k,s[_>>2]|0,n[c>>0]|0);f=0;e:while(1){i=s[_>>2]|0;if((f|0)>=(r[i+2>>1]|0))break;d=f+1|0;c=P+8+d|0;a=n[c>>0]|0;if(a<<24>>24>3){i=(s[i+28>>2]|0)+(r[E+(f<<1)>>1]|0)|0;a=s[b>>2]|0;h=a>>>8;k=i+7|0;a=a-(te(h,o[k>>0]|0)|0)|0;a=(s[R>>2]|0)+a|0;s[R>>2]=a;i=te(h,(o[k>>0]|0)-(o[i+8>>0]|0)|0)|0;s[b>>2]=i;while(1){if(i>>>0>=8388609)break;h=a>>>23;if((h|0)==255)s[M>>2]=(s[M>>2]|0)+1;else{f=a>>>31;i=s[w>>2]|0;if((i|0)>-1){a=s[m>>2]|0;if((a+(s[g>>2]|0)|0)>>>0<(s[S>>2]|0)>>>0){s[m>>2]=a+1;n[(s[t>>2]|0)+a>>0]=i+f;i=0}else i=-1;s[v>>2]=s[v>>2]|i}i=s[M>>2]|0;if(i|0){f=f+255&255;do{a=s[m>>2]|0;if((a+(s[g>>2]|0)|0)>>>0<(s[S>>2]|0)>>>0){s[m>>2]=a+1;n[(s[t>>2]|0)+a>>0]=f;a=0;i=s[M>>2]|0}else a=-1;s[v>>2]=s[v>>2]|a;i=i+-1|0;s[M>>2]=i}while((i|0)!=0)}s[w>>2]=h&255;a=s[R>>2]|0;i=s[b>>2]|0}a=a<<8&2147483392;s[R>>2]=a;i=i<<8;s[b>>2]=i;s[p>>2]=(s[p>>2]|0)+8}k=n[c>>0]|0;f=k<<24>>24;h=f+-4|0;c=i>>>8;if(k<<24>>24>4){k=o[29970+(f+-5)>>0]|0;a=a+(i-(te(c,k)|0))|0;s[R>>2]=a;i=te(c,k-(o[29970+h>>0]|0)|0)|0}else i=i-(te(c,o[29970+h>>0]|0)|0)|0;s[b>>2]=i;while(1){if(i>>>0>=8388609){f=d;continue e}h=a>>>23;if((h|0)==255)s[M>>2]=(s[M>>2]|0)+1;else{f=a>>>31;i=s[w>>2]|0;if((i|0)>-1){a=s[m>>2]|0;if((a+(s[g>>2]|0)|0)>>>0<(s[S>>2]|0)>>>0){s[m>>2]=a+1;n[(s[t>>2]|0)+a>>0]=i+f;i=0}else i=-1;s[v>>2]=s[v>>2]|i}i=s[M>>2]|0;if(i|0){f=f+255&255;do{a=s[m>>2]|0;if((a+(s[g>>2]|0)|0)>>>0<(s[S>>2]|0)>>>0){s[m>>2]=a+1;n[(s[t>>2]|0)+a>>0]=f;a=0;i=s[M>>2]|0}else a=-1;s[v>>2]=s[v>>2]|a;i=i+-1|0;s[M>>2]=i}while((i|0)!=0)}s[w>>2]=h&255;a=s[R>>2]|0;i=s[b>>2]|0}a=a<<8&2147483392;s[R>>2]=a;i=i<<8;s[b>>2]=i;s[p>>2]=(s[p>>2]|0)+8}}if(a<<24>>24>=-3){k=a<<24>>24;i=(s[i+28>>2]|0)+(r[E+(f<<1)>>1]|0)|0;f=s[b>>2]|0;h=f>>>8;c=i+(k+3)|0;f=f-(te(h,o[c>>0]|0)|0)|0;s[R>>2]=(s[R>>2]|0)+f;i=te(h,(o[c>>0]|0)-(o[i+(k+4)>>0]|0)|0)|0;s[b>>2]=i;while(1){if(i>>>0>=8388609){f=d;continue e}a=s[R>>2]|0;h=a>>>23;if((h|0)==255)s[M>>2]=(s[M>>2]|0)+1;else{f=a>>>31;i=s[w>>2]|0;if((i|0)>-1){a=s[m>>2]|0;if((a+(s[g>>2]|0)|0)>>>0<(s[S>>2]|0)>>>0){s[m>>2]=a+1;n[(s[t>>2]|0)+a>>0]=i+f;i=0}else i=-1;s[v>>2]=s[v>>2]|i}i=s[M>>2]|0;if(i|0){f=f+255&255;do{a=s[m>>2]|0;if((a+(s[g>>2]|0)|0)>>>0<(s[S>>2]|0)>>>0){s[m>>2]=a+1;n[(s[t>>2]|0)+a>>0]=f;a=0;i=s[M>>2]|0}else a=-1;s[v>>2]=s[v>>2]|a;i=i+-1|0;s[M>>2]=i}while((i|0)!=0)}s[w>>2]=h&255;a=s[R>>2]|0;i=s[b>>2]|0}s[R>>2]=a<<8&2147483392;i=i<<8;s[b>>2]=i;s[p>>2]=(s[p>>2]|0)+8}}k=s[b>>2]|0;i=k-(te(k>>>8,o[(s[i+28>>2]|0)+(r[E+(f<<1)>>1]|0)>>0]|0)|0)|0;s[b>>2]=i;while(1){if(i>>>0>=8388609)break;a=s[R>>2]|0;h=a>>>23;if((h|0)==255)s[M>>2]=(s[M>>2]|0)+1;else{f=a>>>31;i=s[w>>2]|0;if((i|0)>-1){a=s[m>>2]|0;if((a+(s[g>>2]|0)|0)>>>0<(s[S>>2]|0)>>>0){s[m>>2]=a+1;n[(s[t>>2]|0)+a>>0]=i+f;i=0}else i=-1;s[v>>2]=s[v>>2]|i}i=s[M>>2]|0;if(i|0){f=f+255&255;do{a=s[m>>2]|0;if((a+(s[g>>2]|0)|0)>>>0<(s[S>>2]|0)>>>0){s[m>>2]=a+1;n[(s[t>>2]|0)+a>>0]=f;a=0;i=s[M>>2]|0}else a=-1;s[v>>2]=s[v>>2]|a;i=i+-1|0;s[M>>2]=i}while((i|0)!=0)}s[w>>2]=h&255;a=s[R>>2]|0;i=s[b>>2]|0}s[R>>2]=a<<8&2147483392;i=i<<8;s[b>>2]=i;s[p>>2]=(s[p>>2]|0)+8}a=-4-(n[c>>0]|0)|0;f=i>>>8;if((a|0)>0){k=o[29970+(a+-1)>>0]|0;i=i-(te(f,k)|0)|0;s[R>>2]=(s[R>>2]|0)+i;i=te(f,k-(o[29970+a>>0]|0)|0)|0}else i=i-(te(f,o[29970+a>>0]|0)|0)|0;s[b>>2]=i;while(1){if(i>>>0>=8388609){f=d;continue e}a=s[R>>2]|0;h=a>>>23;if((h|0)==255)s[M>>2]=(s[M>>2]|0)+1;else{f=a>>>31;i=s[w>>2]|0;if((i|0)>-1){a=s[m>>2]|0;if((a+(s[g>>2]|0)|0)>>>0<(s[S>>2]|0)>>>0){s[m>>2]=a+1;n[(s[t>>2]|0)+a>>0]=i+f;i=0}else i=-1;s[v>>2]=s[v>>2]|i}i=s[M>>2]|0;if(i|0){f=f+255&255;do{a=s[m>>2]|0;if((a+(s[g>>2]|0)|0)>>>0<(s[S>>2]|0)>>>0){s[m>>2]=a+1;n[(s[t>>2]|0)+a>>0]=f;a=0;i=s[M>>2]|0}else a=-1;s[v>>2]=s[v>>2]|a;i=i+-1|0;s[M>>2]=i}while((i|0)!=0)}s[w>>2]=h&255;a=s[R>>2]|0;i=s[b>>2]|0}s[R>>2]=a<<8&2147483392;i=i<<8;s[b>>2]=i;s[p>>2]=(s[p>>2]|0)+8}}e:do if((s[A>>2]|0)==4){E=n[P+31>>0]|0;i=E<<24>>24;a=s[b>>2]|0;f=a>>>8;if(E<<24>>24>0){E=o[29939+(i+-1)>>0]|0;k=a-(te(f,E)|0)|0;s[R>>2]=(s[R>>2]|0)+k;i=te(f,E-(o[29939+i>>0]|0)|0)|0}else i=a-(te(f,o[29939+i>>0]|0)|0)|0;s[b>>2]=i;while(1){if(i>>>0>=8388609)break e;a=s[R>>2]|0;h=a>>>23;if((h|0)==255)s[M>>2]=(s[M>>2]|0)+1;else{f=a>>>31;i=s[w>>2]|0;if((i|0)>-1){a=s[m>>2]|0;if((a+(s[g>>2]|0)|0)>>>0<(s[S>>2]|0)>>>0){s[m>>2]=a+1;n[(s[t>>2]|0)+a>>0]=i+f;i=0}else i=-1;s[v>>2]=s[v>>2]|i}i=s[M>>2]|0;if(i|0){f=f+255&255;do{a=s[m>>2]|0;if((a+(s[g>>2]|0)|0)>>>0<(s[S>>2]|0)>>>0){s[m>>2]=a+1;n[(s[t>>2]|0)+a>>0]=f;a=0;i=s[M>>2]|0}else a=-1;s[v>>2]=s[v>>2]|a;i=i+-1|0;s[M>>2]=i}while((i|0)!=0)}s[w>>2]=h&255;a=s[R>>2]|0;i=s[b>>2]|0}s[R>>2]=a<<8&2147483392;i=i<<8;s[b>>2]=i;s[p>>2]=(s[p>>2]|0)+8}}while(0);e:do if((n[C>>0]|0)==2){if(y?(s[e+5860>>2]|0)==2:0){a=P+26|0;i=e+5864|0;f=(r[a>>1]|0)-(r[i>>1]|0)|0;if((f+8|0)>>>0<=19){d=f+9|0;h=s[b>>2]|0;c=h>>>8;if((f|0)>-9){f=o[30009+(f+8)>>0]|0;_=h-(te(c,f)|0)|0;s[R>>2]=(s[R>>2]|0)+_;_=0;f=te(c,f-(o[30009+d>>0]|0)|0)|0}else{f=0;T=243}}else{h=s[b>>2]|0;c=h>>>8;d=0;f=1;T=243}if((T|0)==243){_=f;f=h-(te(c,o[30009+d>>0]|0)|0)|0}s[b>>2]=f;while(1){if(f>>>0>=8388609)break;h=s[R>>2]|0;d=h>>>23;if((d|0)==255)s[M>>2]=(s[M>>2]|0)+1;else{c=h>>>31;f=s[w>>2]|0;if((f|0)>-1){h=s[m>>2]|0;if((h+(s[g>>2]|0)|0)>>>0<(s[S>>2]|0)>>>0){s[m>>2]=h+1;n[(s[t>>2]|0)+h>>0]=f+c;f=0}else f=-1;s[v>>2]=s[v>>2]|f}f=s[M>>2]|0;if(f|0){c=c+255&255;do{h=s[m>>2]|0;if((h+(s[g>>2]|0)|0)>>>0<(s[S>>2]|0)>>>0){s[m>>2]=h+1;n[(s[t>>2]|0)+h>>0]=c;h=0;f=s[M>>2]|0}else h=-1;s[v>>2]=s[v>>2]|h;f=f+-1|0;s[M>>2]=f}while((f|0)!=0)}s[w>>2]=d&255;h=s[R>>2]|0;f=s[b>>2]|0}s[R>>2]=h<<8&2147483392;f=f<<8;s[b>>2]=f;s[p>>2]=(s[p>>2]|0)+8}if(_)T=260}else T=260;if((T|0)==260){a=P+26|0;f=r[a>>1]|0;d=s[e+4668>>2]|0;i=(f|0)/(d>>1|0)|0;d=f-(te(i<<16>>16,d<<15>>16)|0)|0;f=s[b>>2]|0;h=f>>>8;if((i|0)>0){T=o[29977+(i+-1)>>0]|0;E=f-(te(h,T)|0)|0;s[R>>2]=(s[R>>2]|0)+E;i=te(h,T-(o[29977+i>>0]|0)|0)|0}else i=f-(te(h,o[29977+i>>0]|0)|0)|0;s[b>>2]=i;while(1){if(i>>>0>=8388609)break;f=s[R>>2]|0;c=f>>>23;if((c|0)==255)s[M>>2]=(s[M>>2]|0)+1;else{h=f>>>31;i=s[w>>2]|0;if((i|0)>-1){f=s[m>>2]|0;if((f+(s[g>>2]|0)|0)>>>0<(s[S>>2]|0)>>>0){s[m>>2]=f+1;n[(s[t>>2]|0)+f>>0]=i+h;i=0}else i=-1;s[v>>2]=s[v>>2]|i}i=s[M>>2]|0;if(i|0){h=h+255&255;do{f=s[m>>2]|0;if((f+(s[g>>2]|0)|0)>>>0<(s[S>>2]|0)>>>0){s[m>>2]=f+1;n[(s[t>>2]|0)+f>>0]=h;f=0;i=s[M>>2]|0}else f=-1;s[v>>2]=s[v>>2]|f;i=i+-1|0;s[M>>2]=i}while((i|0)!=0)}s[w>>2]=c&255;f=s[R>>2]|0;i=s[b>>2]|0}s[R>>2]=f<<8&2147483392;i=i<<8;s[b>>2]=i;s[p>>2]=(s[p>>2]|0)+8}f=s[e+4776>>2]|0;h=i>>>8;if((d|0)>0){T=f+(d+-1)|0;i=i-(te(h,o[T>>0]|0)|0)|0;s[R>>2]=(s[R>>2]|0)+i;i=te(h,(o[T>>0]|0)-(o[f+d>>0]|0)|0)|0}else i=i-(te(h,o[f+d>>0]|0)|0)|0;s[b>>2]=i;while(1){if(i>>>0>=8388609)break;f=s[R>>2]|0;c=f>>>23;if((c|0)==255)s[M>>2]=(s[M>>2]|0)+1;else{h=f>>>31;i=s[w>>2]|0;if((i|0)>-1){f=s[m>>2]|0;if((f+(s[g>>2]|0)|0)>>>0<(s[S>>2]|0)>>>0){s[m>>2]=f+1;n[(s[t>>2]|0)+f>>0]=i+h;i=0}else i=-1;s[v>>2]=s[v>>2]|i}i=s[M>>2]|0;if(i|0){h=h+255&255;do{f=s[m>>2]|0;if((f+(s[g>>2]|0)|0)>>>0<(s[S>>2]|0)>>>0){s[m>>2]=f+1;n[(s[t>>2]|0)+f>>0]=h;f=0;i=s[M>>2]|0}else f=-1;s[v>>2]=s[v>>2]|f;i=i+-1|0;s[M>>2]=i}while((i|0)!=0)}s[w>>2]=c&255;f=s[R>>2]|0;i=s[b>>2]|0}s[R>>2]=f<<8&2147483392;i=i<<8;s[b>>2]=i;s[p>>2]=(s[p>>2]|0)+8}i=e+5864|0}r[i>>1]=r[a>>1]|0;T=n[P+28>>0]|0;i=T<<24>>24;a=s[e+4780>>2]|0;f=s[b>>2]|0;h=f>>>8;if(T<<24>>24>0){T=a+(i+-1)|0;E=f-(te(h,o[T>>0]|0)|0)|0;s[R>>2]=(s[R>>2]|0)+E;i=te(h,(o[T>>0]|0)-(o[a+i>>0]|0)|0)|0}else i=f-(te(h,o[a+i>>0]|0)|0)|0;s[b>>2]=i;while(1){if(i>>>0>=8388609)break;a=s[R>>2]|0;h=a>>>23;if((h|0)==255)s[M>>2]=(s[M>>2]|0)+1;else{f=a>>>31;i=s[w>>2]|0;if((i|0)>-1){a=s[m>>2]|0;if((a+(s[g>>2]|0)|0)>>>0<(s[S>>2]|0)>>>0){s[m>>2]=a+1;n[(s[t>>2]|0)+a>>0]=i+f;i=0}else i=-1;s[v>>2]=s[v>>2]|i}i=s[M>>2]|0;if(i|0){f=f+255&255;do{a=s[m>>2]|0;if((a+(s[g>>2]|0)|0)>>>0<(s[S>>2]|0)>>>0){s[m>>2]=a+1;n[(s[t>>2]|0)+a>>0]=f;a=0;i=s[M>>2]|0}else a=-1;s[v>>2]=s[v>>2]|a;i=i+-1|0;s[M>>2]=i}while((i|0)!=0)}s[w>>2]=h&255;a=s[R>>2]|0;i=s[b>>2]|0}s[R>>2]=a<<8&2147483392;i=i<<8;s[b>>2]=i;s[p>>2]=(s[p>>2]|0)+8}d=P+32|0;T=n[d>>0]|0;a=T<<24>>24;f=i>>>8;if(T<<24>>24>0){T=o[29437+(a+-1)>>0]|0;i=i-(te(f,T)|0)|0;s[R>>2]=(s[R>>2]|0)+i;i=te(f,T-(o[29437+a>>0]|0)|0)|0}else i=i-(te(f,o[29437+a>>0]|0)|0)|0;s[b>>2]=i;while(1){if(i>>>0>=8388609){h=i;c=0;break}a=s[R>>2]|0;h=a>>>23;if((h|0)==255)s[M>>2]=(s[M>>2]|0)+1;else{f=a>>>31;i=s[w>>2]|0;if((i|0)>-1){a=s[m>>2]|0;if((a+(s[g>>2]|0)|0)>>>0<(s[S>>2]|0)>>>0){s[m>>2]=a+1;n[(s[t>>2]|0)+a>>0]=i+f;i=0}else i=-1;s[v>>2]=s[v>>2]|i}i=s[M>>2]|0;if(i|0){f=f+255&255;do{a=s[m>>2]|0;if((a+(s[g>>2]|0)|0)>>>0<(s[S>>2]|0)>>>0){s[m>>2]=a+1;n[(s[t>>2]|0)+a>>0]=f;a=0;i=s[M>>2]|0}else a=-1;s[v>>2]=s[v>>2]|a;i=i+-1|0;s[M>>2]=i}while((i|0)!=0)}s[w>>2]=h&255;a=s[R>>2]|0;i=s[b>>2]|0}s[R>>2]=a<<8&2147483392;i=i<<8;s[b>>2]=i;s[p>>2]=(s[p>>2]|0)+8}while(1){if((c|0)>=(s[A>>2]|0))break;T=n[P+4+c>>0]|0;i=T<<24>>24;a=s[17376+(n[d>>0]<<2)>>2]|0;f=h>>>8;if(T<<24>>24>0){T=a+(i+-1)|0;E=h-(te(f,o[T>>0]|0)|0)|0;s[R>>2]=(s[R>>2]|0)+E;i=te(f,(o[T>>0]|0)-(o[a+i>>0]|0)|0)|0}else i=h-(te(f,o[a+i>>0]|0)|0)|0;s[b>>2]=i;while(1){if(i>>>0>=8388609)break;a=s[R>>2]|0;h=a>>>23;if((h|0)==255)s[M>>2]=(s[M>>2]|0)+1;else{f=a>>>31;i=s[w>>2]|0;if((i|0)>-1){a=s[m>>2]|0;if((a+(s[g>>2]|0)|0)>>>0<(s[S>>2]|0)>>>0){s[m>>2]=a+1;n[(s[t>>2]|0)+a>>0]=i+f;i=0}else i=-1;s[v>>2]=s[v>>2]|i}i=s[M>>2]|0;if(i|0){f=f+255&255;do{a=s[m>>2]|0;if((a+(s[g>>2]|0)|0)>>>0<(s[S>>2]|0)>>>0){s[m>>2]=a+1;n[(s[t>>2]|0)+a>>0]=f;a=0;i=s[M>>2]|0}else a=-1;s[v>>2]=s[v>>2]|a;i=i+-1|0;s[M>>2]=i}while((i|0)!=0)}s[w>>2]=h&255;a=s[R>>2]|0;i=s[b>>2]|0}s[R>>2]=a<<8&2147483392;i=i<<8;s[b>>2]=i;s[p>>2]=(s[p>>2]|0)+8}h=i;c=c+1|0}if(!l){l=n[P+33>>0]|0;i=l<<24>>24;a=h>>>8;if(l<<24>>24>0){l=o[29930+(i+-1)>>0]|0;T=h-(te(a,l)|0)|0;s[R>>2]=(s[R>>2]|0)+T;i=te(a,l-(o[29930+i>>0]|0)|0)|0}else i=h-(te(a,o[29930+i>>0]|0)|0)|0;s[b>>2]=i;while(1){if(i>>>0>=8388609)break e;a=s[R>>2]|0;h=a>>>23;if((h|0)==255)s[M>>2]=(s[M>>2]|0)+1;else{f=a>>>31;i=s[w>>2]|0;if((i|0)>-1){a=s[m>>2]|0;if((a+(s[g>>2]|0)|0)>>>0<(s[S>>2]|0)>>>0){s[m>>2]=a+1;n[(s[t>>2]|0)+a>>0]=i+f;i=0}else i=-1;s[v>>2]=s[v>>2]|i}i=s[M>>2]|0;if(i|0){f=f+255&255;do{a=s[m>>2]|0;if((a+(s[g>>2]|0)|0)>>>0<(s[S>>2]|0)>>>0){s[m>>2]=a+1;n[(s[t>>2]|0)+a>>0]=f;a=0;i=s[M>>2]|0}else a=-1;s[v>>2]=s[v>>2]|a;i=i+-1|0;s[M>>2]=i}while((i|0)!=0)}s[w>>2]=h&255;a=s[R>>2]|0;i=s[b>>2]|0}s[R>>2]=a<<8&2147483392;i=i<<8;s[b>>2]=i;s[p>>2]=(s[p>>2]|0)+8}}}while(0);s[e+5860>>2]=n[C>>0];e=n[P+34>>0]|0;i=e<<24>>24;a=s[b>>2]|0;f=a>>>8;if(e<<24>>24>0){e=o[29947+(i+-1)>>0]|0;P=a-(te(f,e)|0)|0;s[R>>2]=(s[R>>2]|0)+P;i=te(f,e-(o[29947+i>>0]|0)|0)|0}else i=a-(te(f,o[29947+i>>0]|0)|0)|0;s[b>>2]=i;while(1){if(i>>>0>=8388609)break;a=s[R>>2]|0;h=a>>>23;if((h|0)==255)s[M>>2]=(s[M>>2]|0)+1;else{f=a>>>31;i=s[w>>2]|0;if((i|0)>-1){a=s[m>>2]|0;if((a+(s[g>>2]|0)|0)>>>0<(s[S>>2]|0)>>>0){s[m>>2]=a+1;n[(s[t>>2]|0)+a>>0]=i+f;i=0}else i=-1;s[v>>2]=s[v>>2]|i}i=s[M>>2]|0;if(i|0){f=f+255&255;do{a=s[m>>2]|0;if((a+(s[g>>2]|0)|0)>>>0<(s[S>>2]|0)>>>0){s[m>>2]=a+1;n[(s[t>>2]|0)+a>>0]=f;a=0;i=s[M>>2]|0}else a=-1;s[v>>2]=s[v>>2]|a;i=i+-1|0;s[M>>2]=i}while((i|0)!=0)}s[w>>2]=h&255;a=s[R>>2]|0;i=s[b>>2]|0}s[R>>2]=a<<8&2147483392;i=i<<8;s[b>>2]=i;s[p>>2]=(s[p>>2]|0)+8}u=x;return}function Li(e,t,i,r,a){e=e|0;t=t|0;i=i|0;r=r|0;a=a|0;var l=0,f=0,h=0,c=0,d=0,p=0,b=0,w=0,m=0,g=0,_=0,v=0,k=0,y=0,E=0,A=0,T=0,S=0,M=0,R=0,C=0,P=0,x=0,I=0,O=0,N=0,D=0,L=0,U=0,B=0,j=0,F=0,G=0,H=0,z=0,q=0,W=0;W=u;u=u+96|0;q=W+56|0;x=W+40|0;I=W+32|0;m=W;s[m>>2]=0;s[m+4>>2]=0;s[m+8>>2]=0;s[m+12>>2]=0;s[m+16>>2]=0;s[m+20>>2]=0;s[m+24>>2]=0;s[m+28>>2]=0;l=a>>4;if((l<<4|0)<(a|0)){l=l+1|0;f=r+a|0;h=f+16|0;do{n[f>>0]=0;f=f+1|0}while((f|0)<(h|0))}f=l<<4;P=u;u=u+((1*(f<<2)|0)+15&-16)|0;h=0;while(1){if((h|0)>=(f|0))break;G=n[r+h>>0]|0;z=G<<24>>24;s[P+(h<<2)>>2]=G<<24>>24>0?z:0-z|0;z=h|1;G=n[r+z>>0]|0;H=G<<24>>24;s[P+(z<<2)>>2]=G<<24>>24>0?H:0-H|0;z=h|2;H=n[r+z>>0]|0;G=H<<24>>24;s[P+(z<<2)>>2]=H<<24>>24>0?G:0-G|0;z=h|3;G=n[r+z>>0]|0;H=G<<24>>24;s[P+(z<<2)>>2]=G<<24>>24>0?H:0-H|0;h=h+4|0}z=u;u=u+((1*(l<<2)|0)+15&-16)|0;O=u;u=u+((1*(l<<2)|0)+15&-16)|0;b=P;w=0;while(1){if((w|0)>=(l|0))break;d=O+(w<<2)|0;s[d>>2]=0;p=z+(w<<2)|0;h=0;e:while(1){if((h|0)<8){f=h<<1;f=(s[b+(f<<2)>>2]|0)+(s[b+((f|1)<<2)>>2]|0)|0;if((f|0)>8)c=1;else{s[m+(h<<2)>>2]=f;h=h+1|0;continue}}else c=0;h=0;while(1){if((h|0)>=4){f=0;break}f=h<<1;f=(s[m+(f<<2)>>2]|0)+(s[m+((f|1)<<2)>>2]|0)|0;if((f|0)>10){f=1;break}s[m+(h<<2)>>2]=f;h=h+1|0}c=c+f|0;h=0;while(1){if((h|0)>=2){f=0;break}f=h<<1;f=(s[m+(f<<2)>>2]|0)+(s[m+((f|1)<<2)>>2]|0)|0;if((f|0)>12){f=1;break}s[m+(h<<2)>>2]=f;h=h+1|0}c=c+f|0;h=0;while(1){if((h|0)>=1){f=0;break}f=h<<1;f=(s[m+(f<<2)>>2]|0)+(s[m+((f|1)<<2)>>2]|0)|0;if((f|0)>16){f=1;break}s[p+(h<<2)>>2]=f;h=h+1|0}if((c|0)==(0-f|0))break;s[d>>2]=(s[d>>2]|0)+1;f=0;while(1){if((f|0)==16){h=0;continue e}H=b+(f<<2)|0;s[H>>2]=s[H>>2]>>1;f=f+1|0}}b=b+64|0;w=w+1|0}w=t>>1;_=0;d=0;p=2147483647;while(1){if((d|0)==9)break;h=30270+(d*18|0)+17|0;c=0;b=o[30450+(w*9|0)+d>>0]|0;while(1){if((c|0)>=(l|0))break;if((s[O+(c<<2)>>2]|0)>0)f=h;else f=(s[z+(c<<2)>>2]|0)+(30270+(d*18|0))|0;c=c+1|0;b=b+(o[f>>0]|0)|0}H=(b|0)<(p|0);_=H?d:_;d=d+1|0;p=H?b:p}H=e+28|0;f=s[H>>2]|0;h=f>>>8;if((_|0)>0){G=o[_+-1+(30432+(w*9|0))>>0]|0;f=f-(te(h,G)|0)|0;N=e+32|0;s[N>>2]=(s[N>>2]|0)+f;f=te(h,G-(o[30432+(w*9|0)+_>>0]|0)|0)|0;s[H>>2]=f}else{f=f-(te(h,o[30432+(w*9|0)+_>>0]|0)|0)|0;s[H>>2]=f;N=e+32|0}D=e+36|0;L=e+20|0;U=e+40|0;B=e+24|0;j=e+8|0;F=e+4|0;G=e+44|0;while(1){if(f>>>0>=8388609)break;h=s[N>>2]|0;d=h>>>23;if((d|0)==255)s[D>>2]=(s[D>>2]|0)+1;else{c=h>>>31;f=s[U>>2]|0;if((f|0)>-1){h=s[B>>2]|0;if((h+(s[j>>2]|0)|0)>>>0<(s[F>>2]|0)>>>0){s[B>>2]=h+1;n[(s[e>>2]|0)+h>>0]=f+c;f=0}else f=-1;s[G>>2]=s[G>>2]|f}f=s[D>>2]|0;if(f|0){c=c+255&255;do{h=s[B>>2]|0;if((h+(s[j>>2]|0)|0)>>>0<(s[F>>2]|0)>>>0){s[B>>2]=h+1;n[(s[e>>2]|0)+h>>0]=c;h=0;f=s[D>>2]|0}else h=-1;s[G>>2]=s[G>>2]|h;f=f+-1|0;s[D>>2]=f}while((f|0)!=0)}s[U>>2]=d&255;h=s[N>>2]|0;f=s[H>>2]|0}s[N>>2]=h<<8&2147483392;f=f<<8;s[H>>2]=f;s[L>>2]=(s[L>>2]|0)+8}m=30090+(_*18|0)+16|0;g=30090+(_*18|0)+17|0;w=0;while(1){if((w|0)>=(l|0))break;p=s[O+(w<<2)>>2]|0;e:do if(!p){h=s[z+(w<<2)>>2]|0;c=f>>>8;if((h|0)>0){C=o[h+-1+(30090+(_*18|0))>>0]|0;f=f-(te(c,C)|0)|0;s[N>>2]=(s[N>>2]|0)+f;f=te(c,C-(o[30090+(_*18|0)+h>>0]|0)|0)|0}else f=f-(te(c,o[30090+(_*18|0)+h>>0]|0)|0)|0;s[H>>2]=f;while(1){if(f>>>0>=8388609)break e;h=s[N>>2]|0;d=h>>>23;if((d|0)==255)s[D>>2]=(s[D>>2]|0)+1;else{c=h>>>31;f=s[U>>2]|0;if((f|0)>-1){h=s[B>>2]|0;if((h+(s[j>>2]|0)|0)>>>0<(s[F>>2]|0)>>>0){s[B>>2]=h+1;n[(s[e>>2]|0)+h>>0]=f+c;f=0}else f=-1;s[G>>2]=s[G>>2]|f}f=s[D>>2]|0;if(f|0){c=c+255&255;do{h=s[B>>2]|0;if((h+(s[j>>2]|0)|0)>>>0<(s[F>>2]|0)>>>0){s[B>>2]=h+1;n[(s[e>>2]|0)+h>>0]=c;h=0;f=s[D>>2]|0}else h=-1;s[G>>2]=s[G>>2]|h;f=f+-1|0;s[D>>2]=f}while((f|0)!=0)}s[U>>2]=d&255;h=s[N>>2]|0;f=s[H>>2]|0}s[N>>2]=h<<8&2147483392;f=f<<8;s[H>>2]=f;s[L>>2]=(s[L>>2]|0)+8}}else{R=f>>>8;C=o[m>>0]|0;h=f-(te(R,C)|0)|0;h=(s[N>>2]|0)+h|0;s[N>>2]=h;f=te(R,C-(o[g>>0]|0)|0)|0;s[H>>2]=f;while(1){if(f>>>0>=8388609)break;d=h>>>23;if((d|0)==255)s[D>>2]=(s[D>>2]|0)+1;else{c=h>>>31;f=s[U>>2]|0;if((f|0)>-1){h=s[B>>2]|0;if((h+(s[j>>2]|0)|0)>>>0<(s[F>>2]|0)>>>0){s[B>>2]=h+1;n[(s[e>>2]|0)+h>>0]=f+c;f=0}else f=-1;s[G>>2]=s[G>>2]|f}f=s[D>>2]|0;if(f|0){c=c+255&255;do{h=s[B>>2]|0;if((h+(s[j>>2]|0)|0)>>>0<(s[F>>2]|0)>>>0){s[B>>2]=h+1;n[(s[e>>2]|0)+h>>0]=c;h=0;f=s[D>>2]|0}else h=-1;s[G>>2]=s[G>>2]|h;f=f+-1|0;s[D>>2]=f}while((f|0)!=0)}s[U>>2]=d&255;h=s[N>>2]|0;f=s[H>>2]|0}h=h<<8&2147483392;s[N>>2]=h;f=f<<8;s[H>>2]=f;s[L>>2]=(s[L>>2]|0)+8}b=p+-1|0;p=0;while(1){if((p|0)>=(b|0))break;C=f>>>8<<1;h=h+(f-C)|0;s[N>>2]=h;s[H>>2]=C;f=C;while(1){if(f>>>0>=8388609)break;d=h>>>23;if((d|0)==255)s[D>>2]=(s[D>>2]|0)+1;else{c=h>>>31;f=s[U>>2]|0;if((f|0)>-1){h=s[B>>2]|0;if((h+(s[j>>2]|0)|0)>>>0<(s[F>>2]|0)>>>0){s[B>>2]=h+1;n[(s[e>>2]|0)+h>>0]=f+c;f=0}else f=-1;s[G>>2]=s[G>>2]|f}f=s[D>>2]|0;if(f|0){c=c+255&255;do{h=s[B>>2]|0;if((h+(s[j>>2]|0)|0)>>>0<(s[F>>2]|0)>>>0){s[B>>2]=h+1;n[(s[e>>2]|0)+h>>0]=c;h=0;f=s[D>>2]|0}else h=-1;s[G>>2]=s[G>>2]|h;f=f+-1|0;s[D>>2]=f}while((f|0)!=0)}s[U>>2]=d&255;h=s[N>>2]|0;f=s[H>>2]|0}h=h<<8&2147483392;s[N>>2]=h;f=f<<8;s[H>>2]=f;s[L>>2]=(s[L>>2]|0)+8}p=p+1|0}c=s[z+(w<<2)>>2]|0;d=f>>>8;if((c|0)>0){C=o[30252+(c+-1)>>0]|0;h=h+(f-(te(d,C)|0))|0;s[N>>2]=h;f=te(d,C-(o[30252+c>>0]|0)|0)|0}else f=f-(te(d,o[30252+c>>0]|0)|0)|0;s[H>>2]=f;while(1){if(f>>>0>=8388609)break e;d=h>>>23;if((d|0)==255)s[D>>2]=(s[D>>2]|0)+1;else{c=h>>>31;f=s[U>>2]|0;if((f|0)>-1){h=s[B>>2]|0;if((h+(s[j>>2]|0)|0)>>>0<(s[F>>2]|0)>>>0){s[B>>2]=h+1;n[(s[e>>2]|0)+h>>0]=f+c;f=0}else f=-1;s[G>>2]=s[G>>2]|f}f=s[D>>2]|0;if(f|0){c=c+255&255;do{h=s[B>>2]|0;if((h+(s[j>>2]|0)|0)>>>0<(s[F>>2]|0)>>>0){s[B>>2]=h+1;n[(s[e>>2]|0)+h>>0]=c;h=0;f=s[D>>2]|0}else h=-1;s[G>>2]=s[G>>2]|h;f=f+-1|0;s[D>>2]=f}while((f|0)!=0)}s[U>>2]=d&255;h=s[N>>2]|0;f=s[H>>2]|0}h=h<<8&2147483392;s[N>>2]=h;f=f<<8;s[H>>2]=f;s[L>>2]=(s[L>>2]|0)+8}}while(0);w=w+1|0}_=q+4|0;v=q+8|0;k=x+4|0;y=q+12|0;E=x+8|0;A=I+4|0;T=q+16|0;S=q+20|0;M=q+24|0;R=x+12|0;C=q+28|0;g=0;h=0;while(1){if((g|0)>=(l|0)){_=0;break}if((s[z+(g<<2)>>2]|0)>0){m=P+(g<<4<<2)|0;c=0;while(1){if((c|0)==8){c=0;break}w=c<<1;s[q+(c<<2)>>2]=(s[m+(w<<2)>>2]|0)+(s[m+((w|1)<<2)>>2]|0);c=c+1|0}while(1){if((c|0)==4){c=0;break}w=c<<1;s[x+(c<<2)>>2]=(s[q+(w<<2)>>2]|0)+(s[q+((w|1)<<2)>>2]|0);c=c+1|0}while(1){if((c|0)==2){c=0;break}w=c<<1;s[I+(c<<2)>>2]=(s[x+(w<<2)>>2]|0)+(s[x+((w|1)<<2)>>2]|0);c=c+1|0}while(1){if((c|0)==1)break;h=c<<1;c=c+1|0;h=(s[I+(h<<2)>>2]|0)+(s[I+((h|1)<<2)>>2]|0)|0}b=s[I>>2]|0;e:do if((h|0)>0){c=30924+(o[31076+h>>0]|0)|0;d=f>>>8;if((b|0)>0){w=o[c+(b+-1)>>0]|0;f=f-(te(d,w)|0)|0;s[N>>2]=(s[N>>2]|0)+f;f=te(d,w-(o[c+b>>0]|0)|0)|0}else f=f-(te(d,o[c+b>>0]|0)|0)|0;s[H>>2]=f;while(1){if(f>>>0>=8388609)break e;c=s[N>>2]|0;p=c>>>23;if((p|0)==255)s[D>>2]=(s[D>>2]|0)+1;else{d=c>>>31;f=s[U>>2]|0;if((f|0)>-1){c=s[B>>2]|0;if((c+(s[j>>2]|0)|0)>>>0<(s[F>>2]|0)>>>0){s[B>>2]=c+1;n[(s[e>>2]|0)+c>>0]=f+d;f=0}else f=-1;s[G>>2]=s[G>>2]|f}f=s[D>>2]|0;if(f|0){d=d+255&255;do{c=s[B>>2]|0;if((c+(s[j>>2]|0)|0)>>>0<(s[F>>2]|0)>>>0){s[B>>2]=c+1;n[(s[e>>2]|0)+c>>0]=d;c=0;f=s[D>>2]|0}else c=-1;s[G>>2]=s[G>>2]|c;f=f+-1|0;s[D>>2]=f}while((f|0)!=0)}s[U>>2]=p&255;c=s[N>>2]|0;f=s[H>>2]|0}s[N>>2]=c<<8&2147483392;f=f<<8;s[H>>2]=f;s[L>>2]=(s[L>>2]|0)+8}}while(0);w=s[x>>2]|0;e:do if((b|0)>0){c=30772+(o[31076+b>>0]|0)|0;d=f>>>8;if((w|0)>0){b=o[c+(w+-1)>>0]|0;f=f-(te(d,b)|0)|0;s[N>>2]=(s[N>>2]|0)+f;f=te(d,b-(o[c+w>>0]|0)|0)|0}else f=f-(te(d,o[c+w>>0]|0)|0)|0;s[H>>2]=f;while(1){if(f>>>0>=8388609)break e;c=s[N>>2]|0;p=c>>>23;if((p|0)==255)s[D>>2]=(s[D>>2]|0)+1;else{d=c>>>31;f=s[U>>2]|0;if((f|0)>-1){c=s[B>>2]|0;if((c+(s[j>>2]|0)|0)>>>0<(s[F>>2]|0)>>>0){s[B>>2]=c+1;n[(s[e>>2]|0)+c>>0]=f+d;f=0}else f=-1;s[G>>2]=s[G>>2]|f}f=s[D>>2]|0;if(f|0){d=d+255&255;do{c=s[B>>2]|0;if((c+(s[j>>2]|0)|0)>>>0<(s[F>>2]|0)>>>0){s[B>>2]=c+1;n[(s[e>>2]|0)+c>>0]=d;c=0;f=s[D>>2]|0}else c=-1;s[G>>2]=s[G>>2]|c;f=f+-1|0;s[D>>2]=f}while((f|0)!=0)}s[U>>2]=p&255;c=s[N>>2]|0;f=s[H>>2]|0}s[N>>2]=c<<8&2147483392;f=f<<8;s[H>>2]=f;s[L>>2]=(s[L>>2]|0)+8}}while(0);b=s[q>>2]|0;e:do if((w|0)>0){c=30620+(o[31076+w>>0]|0)|0;d=f>>>8;if((b|0)>0){w=o[c+(b+-1)>>0]|0;f=f-(te(d,w)|0)|0;s[N>>2]=(s[N>>2]|0)+f;f=te(d,w-(o[c+b>>0]|0)|0)|0}else f=f-(te(d,o[c+b>>0]|0)|0)|0;s[H>>2]=f;while(1){if(f>>>0>=8388609)break e;c=s[N>>2]|0;p=c>>>23;if((p|0)==255)s[D>>2]=(s[D>>2]|0)+1;else{d=c>>>31;f=s[U>>2]|0;if((f|0)>-1){c=s[B>>2]|0;if((c+(s[j>>2]|0)|0)>>>0<(s[F>>2]|0)>>>0){s[B>>2]=c+1;n[(s[e>>2]|0)+c>>0]=f+d;f=0}else f=-1;s[G>>2]=s[G>>2]|f}f=s[D>>2]|0;if(f|0){d=d+255&255;do{c=s[B>>2]|0;if((c+(s[j>>2]|0)|0)>>>0<(s[F>>2]|0)>>>0){s[B>>2]=c+1;n[(s[e>>2]|0)+c>>0]=d;c=0;f=s[D>>2]|0}else c=-1;s[G>>2]=s[G>>2]|c;f=f+-1|0;s[D>>2]=f}while((f|0)!=0)}s[U>>2]=p&255;c=s[N>>2]|0;f=s[H>>2]|0}s[N>>2]=c<<8&2147483392;f=f<<8;s[H>>2]=f;s[L>>2]=(s[L>>2]|0)+8}}while(0);p=s[m>>2]|0;e:do if((b|0)>0){c=30468+(o[31076+b>>0]|0)|0;d=f>>>8;if((p|0)>0){w=o[c+(p+-1)>>0]|0;f=f-(te(d,w)|0)|0;s[N>>2]=(s[N>>2]|0)+f;f=te(d,w-(o[c+p>>0]|0)|0)|0}else f=f-(te(d,o[c+p>>0]|0)|0)|0;s[H>>2]=f;while(1){if(f>>>0>=8388609)break e;c=s[N>>2]|0;p=c>>>23;if((p|0)==255)s[D>>2]=(s[D>>2]|0)+1;else{d=c>>>31;f=s[U>>2]|0;if((f|0)>-1){c=s[B>>2]|0;if((c+(s[j>>2]|0)|0)>>>0<(s[F>>2]|0)>>>0){s[B>>2]=c+1;n[(s[e>>2]|0)+c>>0]=f+d;f=0}else f=-1;s[G>>2]=s[G>>2]|f}f=s[D>>2]|0;if(f|0){d=d+255&255;do{c=s[B>>2]|0;if((c+(s[j>>2]|0)|0)>>>0<(s[F>>2]|0)>>>0){s[B>>2]=c+1;n[(s[e>>2]|0)+c>>0]=d;c=0;f=s[D>>2]|0}else c=-1;s[G>>2]=s[G>>2]|c;f=f+-1|0;s[D>>2]=f}while((f|0)!=0)}s[U>>2]=p&255;c=s[N>>2]|0;f=s[H>>2]|0}s[N>>2]=c<<8&2147483392;f=f<<8;s[H>>2]=f;s[L>>2]=(s[L>>2]|0)+8}}while(0);p=s[m+8>>2]|0;c=s[_>>2]|0;e:do if((c|0)>0){c=30468+(o[31076+c>>0]|0)|0;d=f>>>8;if((p|0)>0){w=o[c+(p+-1)>>0]|0;f=f-(te(d,w)|0)|0;s[N>>2]=(s[N>>2]|0)+f;f=te(d,w-(o[c+p>>0]|0)|0)|0}else f=f-(te(d,o[c+p>>0]|0)|0)|0;s[H>>2]=f;while(1){if(f>>>0>=8388609)break e;c=s[N>>2]|0;p=c>>>23;if((p|0)==255)s[D>>2]=(s[D>>2]|0)+1;else{d=c>>>31;f=s[U>>2]|0;if((f|0)>-1){c=s[B>>2]|0;if((c+(s[j>>2]|0)|0)>>>0<(s[F>>2]|0)>>>0){s[B>>2]=c+1;n[(s[e>>2]|0)+c>>0]=f+d;f=0}else f=-1;s[G>>2]=s[G>>2]|f}f=s[D>>2]|0;if(f|0){d=d+255&255;do{c=s[B>>2]|0;if((c+(s[j>>2]|0)|0)>>>0<(s[F>>2]|0)>>>0){s[B>>2]=c+1;n[(s[e>>2]|0)+c>>0]=d;c=0;f=s[D>>2]|0}else c=-1;s[G>>2]=s[G>>2]|c;f=f+-1|0;s[D>>2]=f}while((f|0)!=0)}s[U>>2]=p&255;c=s[N>>2]|0;f=s[H>>2]|0}s[N>>2]=c<<8&2147483392;f=f<<8;s[H>>2]=f;s[L>>2]=(s[L>>2]|0)+8}}while(0);b=s[v>>2]|0;c=s[k>>2]|0;e:do if((c|0)>0){c=30620+(o[31076+c>>0]|0)|0;d=f>>>8;if((b|0)>0){w=o[c+(b+-1)>>0]|0;f=f-(te(d,w)|0)|0;s[N>>2]=(s[N>>2]|0)+f;f=te(d,w-(o[c+b>>0]|0)|0)|0}else f=f-(te(d,o[c+b>>0]|0)|0)|0;s[H>>2]=f;while(1){if(f>>>0>=8388609)break e;c=s[N>>2]|0;p=c>>>23;if((p|0)==255)s[D>>2]=(s[D>>2]|0)+1;else{d=c>>>31;f=s[U>>2]|0;if((f|0)>-1){c=s[B>>2]|0;if((c+(s[j>>2]|0)|0)>>>0<(s[F>>2]|0)>>>0){s[B>>2]=c+1;n[(s[e>>2]|0)+c>>0]=f+d;f=0}else f=-1;s[G>>2]=s[G>>2]|f}f=s[D>>2]|0;if(f|0){d=d+255&255;do{c=s[B>>2]|0;if((c+(s[j>>2]|0)|0)>>>0<(s[F>>2]|0)>>>0){s[B>>2]=c+1;n[(s[e>>2]|0)+c>>0]=d;c=0;f=s[D>>2]|0}else c=-1;s[G>>2]=s[G>>2]|c;f=f+-1|0;s[D>>2]=f}while((f|0)!=0)}s[U>>2]=p&255;c=s[N>>2]|0;f=s[H>>2]|0}s[N>>2]=c<<8&2147483392;f=f<<8;s[H>>2]=f;s[L>>2]=(s[L>>2]|0)+8}}while(0);p=s[m+16>>2]|0;e:do if((b|0)>0){c=30468+(o[31076+b>>0]|0)|0;d=f>>>8;if((p|0)>0){w=o[c+(p+-1)>>0]|0;f=f-(te(d,w)|0)|0;s[N>>2]=(s[N>>2]|0)+f;f=te(d,w-(o[c+p>>0]|0)|0)|0}else f=f-(te(d,o[c+p>>0]|0)|0)|0;s[H>>2]=f;while(1){if(f>>>0>=8388609)break e;c=s[N>>2]|0;p=c>>>23;if((p|0)==255)s[D>>2]=(s[D>>2]|0)+1;else{d=c>>>31;f=s[U>>2]|0;if((f|0)>-1){c=s[B>>2]|0;if((c+(s[j>>2]|0)|0)>>>0<(s[F>>2]|0)>>>0){s[B>>2]=c+1;n[(s[e>>2]|0)+c>>0]=f+d;f=0}else f=-1;s[G>>2]=s[G>>2]|f}f=s[D>>2]|0;if(f|0){d=d+255&255;do{c=s[B>>2]|0;if((c+(s[j>>2]|0)|0)>>>0<(s[F>>2]|0)>>>0){s[B>>2]=c+1;n[(s[e>>2]|0)+c>>0]=d;c=0;f=s[D>>2]|0}else c=-1;s[G>>2]=s[G>>2]|c;f=f+-1|0;s[D>>2]=f}while((f|0)!=0)}s[U>>2]=p&255;c=s[N>>2]|0;f=s[H>>2]|0}s[N>>2]=c<<8&2147483392;f=f<<8;s[H>>2]=f;s[L>>2]=(s[L>>2]|0)+8}}while(0);p=s[m+24>>2]|0;c=s[y>>2]|0;e:do if((c|0)>0){c=30468+(o[31076+c>>0]|0)|0;d=f>>>8;if((p|0)>0){w=o[c+(p+-1)>>0]|0;f=f-(te(d,w)|0)|0;s[N>>2]=(s[N>>2]|0)+f;f=te(d,w-(o[c+p>>0]|0)|0)|0}else f=f-(te(d,o[c+p>>0]|0)|0)|0;s[H>>2]=f;while(1){if(f>>>0>=8388609)break e;c=s[N>>2]|0;p=c>>>23;if((p|0)==255)s[D>>2]=(s[D>>2]|0)+1;else{d=c>>>31;f=s[U>>2]|0;if((f|0)>-1){c=s[B>>2]|0;if((c+(s[j>>2]|0)|0)>>>0<(s[F>>2]|0)>>>0){s[B>>2]=c+1;n[(s[e>>2]|0)+c>>0]=f+d;f=0}else f=-1;s[G>>2]=s[G>>2]|f}f=s[D>>2]|0;if(f|0){d=d+255&255;do{c=s[B>>2]|0;if((c+(s[j>>2]|0)|0)>>>0<(s[F>>2]|0)>>>0){s[B>>2]=c+1;n[(s[e>>2]|0)+c>>0]=d;c=0;f=s[D>>2]|0}else c=-1;s[G>>2]=s[G>>2]|c;f=f+-1|0;s[D>>2]=f}while((f|0)!=0)}s[U>>2]=p&255;c=s[N>>2]|0;f=s[H>>2]|0}s[N>>2]=c<<8&2147483392;f=f<<8;s[H>>2]=f;s[L>>2]=(s[L>>2]|0)+8}}while(0);b=s[E>>2]|0;c=s[A>>2]|0;e:do if((c|0)>0){c=30772+(o[31076+c>>0]|0)|0;d=f>>>8;if((b|0)>0){w=o[c+(b+-1)>>0]|0;f=f-(te(d,w)|0)|0;s[N>>2]=(s[N>>2]|0)+f;f=te(d,w-(o[c+b>>0]|0)|0)|0}else f=f-(te(d,o[c+b>>0]|0)|0)|0;s[H>>2]=f;while(1){if(f>>>0>=8388609)break e;c=s[N>>2]|0;p=c>>>23;if((p|0)==255)s[D>>2]=(s[D>>2]|0)+1;else{d=c>>>31;f=s[U>>2]|0;if((f|0)>-1){c=s[B>>2]|0;if((c+(s[j>>2]|0)|0)>>>0<(s[F>>2]|0)>>>0){s[B>>2]=c+1;n[(s[e>>2]|0)+c>>0]=f+d;f=0}else f=-1;s[G>>2]=s[G>>2]|f}f=s[D>>2]|0;if(f|0){d=d+255&255;do{c=s[B>>2]|0;if((c+(s[j>>2]|0)|0)>>>0<(s[F>>2]|0)>>>0){s[B>>2]=c+1;n[(s[e>>2]|0)+c>>0]=d;c=0;f=s[D>>2]|0}else c=-1;s[G>>2]=s[G>>2]|c;f=f+-1|0;s[D>>2]=f}while((f|0)!=0)}s[U>>2]=p&255;c=s[N>>2]|0;f=s[H>>2]|0}s[N>>2]=c<<8&2147483392;f=f<<8;s[H>>2]=f;s[L>>2]=(s[L>>2]|0)+8}}while(0);w=s[T>>2]|0;e:do if((b|0)>0){c=30620+(o[31076+b>>0]|0)|0;d=f>>>8;if((w|0)>0){b=o[c+(w+-1)>>0]|0;f=f-(te(d,b)|0)|0;s[N>>2]=(s[N>>2]|0)+f;f=te(d,b-(o[c+w>>0]|0)|0)|0}else f=f-(te(d,o[c+w>>0]|0)|0)|0;s[H>>2]=f;while(1){if(f>>>0>=8388609)break e;c=s[N>>2]|0;p=c>>>23;if((p|0)==255)s[D>>2]=(s[D>>2]|0)+1;else{d=c>>>31;f=s[U>>2]|0;if((f|0)>-1){c=s[B>>2]|0;if((c+(s[j>>2]|0)|0)>>>0<(s[F>>2]|0)>>>0){s[B>>2]=c+1;n[(s[e>>2]|0)+c>>0]=f+d;f=0}else f=-1;s[G>>2]=s[G>>2]|f}f=s[D>>2]|0;if(f|0){d=d+255&255;do{c=s[B>>2]|0;if((c+(s[j>>2]|0)|0)>>>0<(s[F>>2]|0)>>>0){s[B>>2]=c+1;n[(s[e>>2]|0)+c>>0]=d;c=0;f=s[D>>2]|0}else c=-1;s[G>>2]=s[G>>2]|c;f=f+-1|0;s[D>>2]=f}while((f|0)!=0)}s[U>>2]=p&255;c=s[N>>2]|0;f=s[H>>2]|0}s[N>>2]=c<<8&2147483392;f=f<<8;s[H>>2]=f;s[L>>2]=(s[L>>2]|0)+8}}while(0);p=s[m+32>>2]|0;e:do if((w|0)>0){c=30468+(o[31076+w>>0]|0)|0;d=f>>>8;if((p|0)>0){w=o[c+(p+-1)>>0]|0;f=f-(te(d,w)|0)|0;s[N>>2]=(s[N>>2]|0)+f;f=te(d,w-(o[c+p>>0]|0)|0)|0}else f=f-(te(d,o[c+p>>0]|0)|0)|0;s[H>>2]=f;while(1){if(f>>>0>=8388609)break e;c=s[N>>2]|0;p=c>>>23;if((p|0)==255)s[D>>2]=(s[D>>2]|0)+1;else{d=c>>>31;f=s[U>>2]|0;if((f|0)>-1){c=s[B>>2]|0;if((c+(s[j>>2]|0)|0)>>>0<(s[F>>2]|0)>>>0){s[B>>2]=c+1;n[(s[e>>2]|0)+c>>0]=f+d;f=0}else f=-1;s[G>>2]=s[G>>2]|f}f=s[D>>2]|0;if(f|0){d=d+255&255;do{c=s[B>>2]|0;if((c+(s[j>>2]|0)|0)>>>0<(s[F>>2]|0)>>>0){s[B>>2]=c+1;n[(s[e>>2]|0)+c>>0]=d;c=0;f=s[D>>2]|0}else c=-1;s[G>>2]=s[G>>2]|c;f=f+-1|0;s[D>>2]=f}while((f|0)!=0)}s[U>>2]=p&255;c=s[N>>2]|0;f=s[H>>2]|0}s[N>>2]=c<<8&2147483392;f=f<<8;s[H>>2]=f;s[L>>2]=(s[L>>2]|0)+8}}while(0);p=s[m+40>>2]|0;c=s[S>>2]|0;e:do if((c|0)>0){c=30468+(o[31076+c>>0]|0)|0;d=f>>>8;if((p|0)>0){w=o[c+(p+-1)>>0]|0;f=f-(te(d,w)|0)|0;s[N>>2]=(s[N>>2]|0)+f;f=te(d,w-(o[c+p>>0]|0)|0)|0}else f=f-(te(d,o[c+p>>0]|0)|0)|0;s[H>>2]=f;while(1){if(f>>>0>=8388609)break e;c=s[N>>2]|0;p=c>>>23;if((p|0)==255)s[D>>2]=(s[D>>2]|0)+1;else{d=c>>>31;f=s[U>>2]|0;if((f|0)>-1){c=s[B>>2]|0;if((c+(s[j>>2]|0)|0)>>>0<(s[F>>2]|0)>>>0){s[B>>2]=c+1;n[(s[e>>2]|0)+c>>0]=f+d;f=0}else f=-1;s[G>>2]=s[G>>2]|f}f=s[D>>2]|0;if(f|0){d=d+255&255;do{c=s[B>>2]|0;if((c+(s[j>>2]|0)|0)>>>0<(s[F>>2]|0)>>>0){s[B>>2]=c+1;n[(s[e>>2]|0)+c>>0]=d;c=0;f=s[D>>2]|0}else c=-1;s[G>>2]=s[G>>2]|c;f=f+-1|0;s[D>>2]=f}while((f|0)!=0)}s[U>>2]=p&255;c=s[N>>2]|0;f=s[H>>2]|0}s[N>>2]=c<<8&2147483392;f=f<<8;s[H>>2]=f;s[L>>2]=(s[L>>2]|0)+8}}while(0);b=s[M>>2]|0;c=s[R>>2]|0;e:do if((c|0)>0){c=30620+(o[31076+c>>0]|0)|0;d=f>>>8;if((b|0)>0){w=o[c+(b+-1)>>0]|0;f=f-(te(d,w)|0)|0;s[N>>2]=(s[N>>2]|0)+f;f=te(d,w-(o[c+b>>0]|0)|0)|0}else f=f-(te(d,o[c+b>>0]|0)|0)|0;s[H>>2]=f;while(1){if(f>>>0>=8388609)break e;c=s[N>>2]|0;p=c>>>23;if((p|0)==255)s[D>>2]=(s[D>>2]|0)+1;else{d=c>>>31;f=s[U>>2]|0;if((f|0)>-1){c=s[B>>2]|0;if((c+(s[j>>2]|0)|0)>>>0<(s[F>>2]|0)>>>0){s[B>>2]=c+1;n[(s[e>>2]|0)+c>>0]=f+d;f=0}else f=-1;s[G>>2]=s[G>>2]|f}f=s[D>>2]|0;if(f|0){d=d+255&255;do{c=s[B>>2]|0;if((c+(s[j>>2]|0)|0)>>>0<(s[F>>2]|0)>>>0){s[B>>2]=c+1;n[(s[e>>2]|0)+c>>0]=d;c=0;f=s[D>>2]|0}else c=-1;s[G>>2]=s[G>>2]|c;f=f+-1|0;s[D>>2]=f}while((f|0)!=0)}s[U>>2]=p&255;c=s[N>>2]|0;f=s[H>>2]|0}s[N>>2]=c<<8&2147483392;f=f<<8;s[H>>2]=f;s[L>>2]=(s[L>>2]|0)+8}}while(0);p=s[m+48>>2]|0;e:do if((b|0)>0){c=30468+(o[31076+b>>0]|0)|0;d=f>>>8;if((p|0)>0){w=o[c+(p+-1)>>0]|0;f=f-(te(d,w)|0)|0;s[N>>2]=(s[N>>2]|0)+f;f=te(d,w-(o[c+p>>0]|0)|0)|0}else f=f-(te(d,o[c+p>>0]|0)|0)|0;s[H>>2]=f;while(1){if(f>>>0>=8388609)break e;c=s[N>>2]|0;p=c>>>23;if((p|0)==255)s[D>>2]=(s[D>>2]|0)+1;else{d=c>>>31;f=s[U>>2]|0;if((f|0)>-1){c=s[B>>2]|0;if((c+(s[j>>2]|0)|0)>>>0<(s[F>>2]|0)>>>0){s[B>>2]=c+1;n[(s[e>>2]|0)+c>>0]=f+d;f=0}else f=-1;s[G>>2]=s[G>>2]|f}f=s[D>>2]|0;if(f|0){d=d+255&255;do{c=s[B>>2]|0;if((c+(s[j>>2]|0)|0)>>>0<(s[F>>2]|0)>>>0){s[B>>2]=c+1;n[(s[e>>2]|0)+c>>0]=d;c=0;f=s[D>>2]|0}else c=-1;s[G>>2]=s[G>>2]|c;f=f+-1|0;s[D>>2]=f}while((f|0)!=0)}s[U>>2]=p&255;c=s[N>>2]|0;f=s[H>>2]|0}s[N>>2]=c<<8&2147483392;f=f<<8;s[H>>2]=f;s[L>>2]=(s[L>>2]|0)+8}}while(0);p=s[m+56>>2]|0;c=s[C>>2]|0;e:do if((c|0)>0){c=30468+(o[31076+c>>0]|0)|0;d=f>>>8;if((p|0)>0){m=o[c+(p+-1)>>0]|0;f=f-(te(d,m)|0)|0;s[N>>2]=(s[N>>2]|0)+f;f=te(d,m-(o[c+p>>0]|0)|0)|0}else f=f-(te(d,o[c+p>>0]|0)|0)|0;s[H>>2]=f;while(1){if(f>>>0>=8388609)break e;c=s[N>>2]|0;p=c>>>23;if((p|0)==255)s[D>>2]=(s[D>>2]|0)+1;else{d=c>>>31;f=s[U>>2]|0;if((f|0)>-1){c=s[B>>2]|0;if((c+(s[j>>2]|0)|0)>>>0<(s[F>>2]|0)>>>0){s[B>>2]=c+1;n[(s[e>>2]|0)+c>>0]=f+d;f=0}else f=-1;s[G>>2]=s[G>>2]|f}f=s[D>>2]|0;if(f|0){d=d+255&255;do{c=s[B>>2]|0;if((c+(s[j>>2]|0)|0)>>>0<(s[F>>2]|0)>>>0){s[B>>2]=c+1;n[(s[e>>2]|0)+c>>0]=d;c=0;f=s[D>>2]|0}else c=-1;s[G>>2]=s[G>>2]|c;f=f+-1|0;s[D>>2]=f}while((f|0)!=0)}s[U>>2]=p&255;c=s[N>>2]|0;f=s[H>>2]|0}s[N>>2]=c<<8&2147483392;f=f<<8;s[H>>2]=f;s[L>>2]=(s[L>>2]|0)+8}}while(0)}g=g+1|0}while(1){if((_|0)>=(l|0))break;m=s[O+(_<<2)>>2]|0;e:do if((m|0)>0){g=r+(_<<4)|0;w=0;while(1){if((w|0)==16)break e;h=n[g+w>>0]|0;b=h<<24>>24;b=(h<<24>>24>0?b:0-b|0)<<24>>24;h=m;t:while(1){p=h+-1|0;if((h|0)<=1)break;h=b>>>p&1;c=f>>>8;d=n[29928+h>>0]|0;if(!h)f=f-(te(c,d&255)|0)|0;else{I=o[29928+(h+-1)>>0]|0;f=f-(te(c,I)|0)|0;s[N>>2]=(s[N>>2]|0)+f;f=te(c,I-(d&255)|0)|0}s[H>>2]=f;while(1){if(f>>>0>=8388609){h=p;continue t}h=s[N>>2]|0;d=h>>>23;if((d|0)==255)s[D>>2]=(s[D>>2]|0)+1;else{ -c=h>>>31;f=s[U>>2]|0;if((f|0)>-1){h=s[B>>2]|0;if((h+(s[j>>2]|0)|0)>>>0<(s[F>>2]|0)>>>0){s[B>>2]=h+1;n[(s[e>>2]|0)+h>>0]=f+c;f=0}else f=-1;s[G>>2]=s[G>>2]|f}f=s[D>>2]|0;if(f|0){c=c+255&255;do{h=s[B>>2]|0;if((h+(s[j>>2]|0)|0)>>>0<(s[F>>2]|0)>>>0){s[B>>2]=h+1;n[(s[e>>2]|0)+h>>0]=c;h=0;f=s[D>>2]|0}else h=-1;s[G>>2]=s[G>>2]|h;f=f+-1|0;s[D>>2]=f}while((f|0)!=0)}s[U>>2]=d&255;h=s[N>>2]|0;f=s[H>>2]|0}s[N>>2]=h<<8&2147483392;f=f<<8;s[H>>2]=f;s[L>>2]=(s[L>>2]|0)+8}}h=b&1;c=f>>>8;d=n[29928+h>>0]|0;if(!h)f=f-(te(c,d&255)|0)|0;else{I=o[29928+(h+-1)>>0]|0;f=f-(te(c,I)|0)|0;s[N>>2]=(s[N>>2]|0)+f;f=te(c,I-(d&255)|0)|0}s[H>>2]=f;while(1){if(f>>>0>=8388609)break;h=s[N>>2]|0;d=h>>>23;if((d|0)==255)s[D>>2]=(s[D>>2]|0)+1;else{c=h>>>31;f=s[U>>2]|0;if((f|0)>-1){h=s[B>>2]|0;if((h+(s[j>>2]|0)|0)>>>0<(s[F>>2]|0)>>>0){s[B>>2]=h+1;n[(s[e>>2]|0)+h>>0]=f+c;f=0}else f=-1;s[G>>2]=s[G>>2]|f}f=s[D>>2]|0;if(f|0){c=c+255&255;do{h=s[B>>2]|0;if((h+(s[j>>2]|0)|0)>>>0<(s[F>>2]|0)>>>0){s[B>>2]=h+1;n[(s[e>>2]|0)+h>>0]=c;h=0;f=s[D>>2]|0}else h=-1;s[G>>2]=s[G>>2]|h;f=f+-1|0;s[D>>2]=f}while((f|0)!=0)}s[U>>2]=d&255;h=s[N>>2]|0;f=s[H>>2]|0}s[N>>2]=h<<8&2147483392;f=f<<8;s[H>>2]=f;s[L>>2]=(s[L>>2]|0)+8}w=w+1|0}}while(0);_=_+1|0}n[q+1>>0]=0;m=31093+(((t<<1)+i<<16>>16)*7|0)|0;w=a+8>>4;l=f;b=0;p=r;while(1){if((b|0)>=(w|0))break;f=s[z+(b<<2)>>2]|0;e:do if((f|0)>0){n[q>>0]=n[m+((f&30)>>>0<6?f&31:6)>>0]|0;d=0;while(1){if((d|0)==16)break e;f=n[p+d>>0]|0;t:do if(f<<24>>24){f=f<<24>>24>>15;h=f+1|0;c=l>>>8;if((f|0)>-1){r=o[q+f>>0]|0;l=l-(te(c,r)|0)|0;s[N>>2]=(s[N>>2]|0)+l;l=te(c,r-(o[q+h>>0]|0)|0)|0}else l=l-(te(c,o[q+h>>0]|0)|0)|0;s[H>>2]=l;while(1){if(l>>>0>=8388609)break t;f=s[N>>2]|0;c=f>>>23;if((c|0)==255)s[D>>2]=(s[D>>2]|0)+1;else{h=f>>>31;l=s[U>>2]|0;if((l|0)>-1){f=s[B>>2]|0;if((f+(s[j>>2]|0)|0)>>>0<(s[F>>2]|0)>>>0){s[B>>2]=f+1;n[(s[e>>2]|0)+f>>0]=l+h;l=0}else l=-1;s[G>>2]=s[G>>2]|l}l=s[D>>2]|0;if(l|0){h=h+255&255;do{f=s[B>>2]|0;if((f+(s[j>>2]|0)|0)>>>0<(s[F>>2]|0)>>>0){s[B>>2]=f+1;n[(s[e>>2]|0)+f>>0]=h;f=0;l=s[D>>2]|0}else f=-1;s[G>>2]=s[G>>2]|f;l=l+-1|0;s[D>>2]=l}while((l|0)!=0)}s[U>>2]=c&255;f=s[N>>2]|0;l=s[H>>2]|0}s[N>>2]=f<<8&2147483392;l=l<<8;s[H>>2]=l;s[L>>2]=(s[L>>2]|0)+8}}while(0);d=d+1|0}}while(0);b=b+1|0;p=p+16|0}u=W;return}function Ui(e,t,i,o){e=e|0;t=t|0;i=i|0;o=o|0;var a=0,l=0,f=0,h=0,u=0;f=i+2|0;a=r[f>>1]|0;o=(te(a<<16>>16,o)|0)/2|0;l=i+20|0;o=(s[i+24>>2]|0)+o|0;i=0;while(1){if((i|0)>=(a<<16>>16|0))break;u=n[o>>0]|0;h=u&255;r[e+(i<<1)>>1]=(h>>>1&7)*9;n[t+i>>0]=n[(s[l>>2]|0)+(i+((r[f>>1]|0)+-1&0-(h&1)))>>0]|0;a=i|1;r[e+(a<<1)>>1]=((u&255)>>>5&255)*9;n[t+a>>0]=n[(s[l>>2]|0)+(i+((r[f>>1]|0)+-1&0-(h>>>4&1))+1)>>0]|0;a=r[f>>1]|0;o=o+1|0;i=i+2|0}return}function Bi(e,t,i,o,l,f,h,c,d,p,b){e=e|0;t=t|0;i=i|0;o=o|0;l=l|0;f=f|0;h=h|0;c=c|0;d=d|0;p=p|0;b=b|0;var w=0,m=0,g=0,_=0,v=0,k=0,y=0,E=0,A=0,T=0,S=0,M=0,R=0,C=0,P=0,x=0;C=u;u=u+16|0;S=C+8|0;y=C+4|0;k=C;M=t+-4|0;w=b+2|0;R=u;u=u+((1*(w<<1)|0)+15&-16)|0;m=0;while(1){if((m|0)>=(w|0))break;A=m+-2|0;v=r[t+(A<<1)>>1]|0;A=r[i+(A<<1)>>1]|0;E=v+A|0;A=v-A|0;r[M+(m<<1)>>1]=(E>>>1)+(E&1);A=(A>>1)+(A&1)|0;r[R+(m<<1)>>1]=(A|0)>32767?32767:((A|0)<-32768?-32768:A)&65535;m=m+1|0}v=e+4|0;g=a[v>>1]|a[v+2>>1]<<16;r[M>>1]=g;r[M+2>>1]=g>>>16;g=e+8|0;m=a[g>>1]|a[g+2>>1]<<16;s[R>>2]=m;w=M+(b<<1)|0;w=a[w>>1]|a[w+2>>1]<<16;r[v>>1]=w;r[v+2>>1]=w>>>16;v=R+(b<<1)|0;v=a[v>>1]|a[v+2>>1]<<16;r[g>>1]=v;r[g+2>>1]=v>>>16;g=u;u=u+((1*(b<<1)|0)+15&-16)|0;v=u;u=u+((1*(b<<1)|0)+15&-16)|0;w=0;while(1){if((w|0)>=(b|0))break;A=w+1|0;_=r[M+(A<<1)>>1]|0;E=((r[M+(w<<1)>>1]|0)+(r[M+(w+2<<1)>>1]|0)+(_<<16>>16<<1)>>1)+1>>1;r[g+(w<<1)>>1]=E;r[v+(w<<1)>>1]=(_&65535)-E;w=A}t=u;u=u+((1*(b<<1)|0)+15&-16)|0;_=u;u=u+((1*(b<<1)|0)+15&-16)|0;w=m&65535;m=0;while(1){if((m|0)>=(b|0))break;A=m+1|0;E=r[R+(A<<1)>>1]|0;P=((w<<16>>16)+(r[R+(m+2<<1)>>1]|0)+(E<<16>>16<<1)>>1)+1>>1;r[t+(m<<1)>>1]=P;r[_+(m<<1)>>1]=(E&65535)-P;w=E;m=A}w=(p*10|0)==(b|0);E=w?328:655;c=c<<16>>16;c=te(c,c)|0;c=(te(c>>>16,E)|0)+((te(c&65535,E)|0)>>>16)|0;E=Zi(y,g,t,e+12|0,b,c)|0;s[S>>2]=E;_=Zi(k,v,_,e+20|0,b,c)|0;A=S+4|0;s[A>>2]=_;g=(s[k>>2]|0)+((s[y>>2]<<16>>16)*3|0)|0;g=(g|0)<65536?g:65536;v=h-(w?1200:600)|0;v=(v|0)<1?1:v;t=((p<<16>>16)*900|0)+2e3|0;w=g*3|0;m=ji(v,w+851968|0,19)|0;s[f>>2]=m;if((m|0)<(t|0)){s[f>>2]=t;h=v-t|0;s[f+4>>2]=h;P=t<<16>>16;w=ji((h<<1)-t|0,(te(w+65536>>16,P)|0)+((te(w&65535,P)|0)>>16)|0,16)|0;if((w|0)>16384)w=16384;else w=(w|0)<0?0:w}else{s[f+4>>2]=v-m;w=16384}m=e+28|0;y=r[m>>1]|0;h=y&65535;P=c<<16>>16;r[m>>1]=h+((te(w-(y<<16>>16)>>16,P)|0)+((te(w-h&65535,P)|0)>>>16));n[l>>0]=0;e:do if(!d){do if(!(r[e+30>>1]|0)){if((v<<3|0)>=(t*13|0)){w=s[m>>2]|0;P=w<<16>>16;if(((te(g>>16,P)|0)+((te(g&65535,P)|0)>>16)|0)<819)w=w&65535;else{if((w>>>16&65535)<<16>>16){T=23;break}w=r[m>>1]|0;break}}else w=r[m>>1]|0;s[S>>2]=(te(w<<16>>16,E<<16>>16)|0)>>14;s[A>>2]=(te(w<<16>>16,_<<16>>16)|0)>>14;Ki(S,o);s[S>>2]=0;s[A>>2]=0;s[f>>2]=v;s[f+4>>2]=0;n[l>>0]=1;m=0;T=31;break e}else T=23;while(0);do if((T|0)==23){if((v<<3|0)>=(t*11|0)){w=r[m>>1]|0;P=w<<16>>16;if(((te(g>>16,P)|0)+((te(g&65535,P)|0)>>16)|0)>=328)break}else w=r[m>>1]|0;w=w<<16>>16;s[S>>2]=(te(w,E<<16>>16)|0)>>14;s[A>>2]=(te(w,_<<16>>16)|0)>>14;Ki(S,o);s[S>>2]=0;s[A>>2]=0;w=0;T=30;break e}while(0);if(w<<16>>16>15565){Ki(S,o);w=16384;T=30;break}else{w=w<<16>>16;s[S>>2]=(te(w,E<<16>>16)|0)>>14;s[A>>2]=(te(w,_<<16>>16)|0)>>14;Ki(S,o);w=r[m>>1]|0;T=30;break}}else{s[S>>2]=0;s[A>>2]=0;Ki(S,o);w=0;T=30}while(0);if((T|0)==30)if((n[l>>0]|0)==1){m=w;T=31}else{r[e+32>>1]=0;T=35}do if((T|0)==31){w=e+32|0;P=(a[w>>1]|0)+(b-(p<<3))|0;r[w>>1]=P;if((P<<16>>16|0)<(p*5|0)){n[l>>0]=0;T=36;break}else{r[w>>1]=1e4;w=m;T=35;break}}while(0);if((T|0)==35)if(!(n[l>>0]|0)){m=w;T=36}if((T|0)==36){w=f+4|0;if((s[w>>2]|0)<1){s[w>>2]=1;s[f>>2]=(v|0)<2?1:v+-1|0;w=m}else w=m}c=s[e>>2]|0;d=e+30|0;_=r[d>>1]|0;k=_<<16>>16;m=p<<3;E=s[S>>2]|0;g=(65536/(m|0)|0)<<16>>16;y=((te(E-c<<16>>16,g)|0)>>15)+1>>1;h=s[A>>2]|0;t=((te(h-(c>>>16)<<16>>16,g)|0)>>15)+1>>1;g=(te(w-k>>16,g)|0)+((te(w-(_&65535)&65535,g)|0)>>16)<<10;_=0;v=0-(c<<16>>16)|0;c=0-(c>>16)|0;k=k<<10;while(1){if((_|0)>=(m|0))break;p=v-y|0;S=c-t|0;P=k+g|0;f=_+1|0;T=r[M+(f<<1)>>1]|0;A=(r[M+(_<<1)>>1]|0)+(r[M+(_+2<<1)>>1]|0)+(T<<1)|0;x=r[R+(f<<1)>>1]|0;o=p<<16>>16;l=S<<16>>16;l=((te(P>>16,x)|0)+((te(P&64512,x)|0)>>16)+((te(A>>7,o)|0)+((te(A<<9&65024,o)|0)>>16))+((te(T>>5,l)|0)+((te(T<<11&63488,l)|0)>>16))>>7)+1>>1;r[i+(_+-1<<1)>>1]=(l|0)>32767?32767:((l|0)<-32768?-32768:l)&65535;_=f;v=p;c=S;k=P}t=e+2|0;g=w>>6;_=w<<10&64512;v=0-E<<16>>16;c=0-h<<16>>16;while(1){if((m|0)>=(b|0))break;x=m+1|0;P=r[M+(x<<1)>>1]|0;S=(r[M+(m<<1)>>1]|0)+(r[M+(m+2<<1)>>1]|0)+(P<<1)|0;p=r[R+(x<<1)>>1]|0;P=((te(g,p)|0)+((te(_,p)|0)>>16)+((te(S>>7,v)|0)+((te(S<<9&65024,v)|0)>>16))+((te(P>>5,c)|0)+((te(P<<11&63488,c)|0)>>16))>>7)+1>>1;r[i+(m+-1<<1)>>1]=(P|0)>32767?32767:((P|0)<-32768?-32768:P)&65535;m=x}r[e>>1]=E;r[t>>1]=h;r[d>>1]=w;u=C;return}function ji(e,t,i){e=e|0;t=t|0;i=i|0;var n=0,r=0,s=0,o=0;if((e|0)<=0)if(!e)r=32;else{n=0-e|0;s=3}else{n=e;s=3}if((s|0)==3)r=ne(n|0)|0;e=e<>16|0)|0)<<16>>16;o=(te(e>>16,t)|0)+((te(e&65535,t)|0)>>16)|0;s=Nr(s|0,((s|0)<0)<<31>>31|0,o|0,((o|0)<0)<<31>>31|0)|0;s=Tr(s|0,x|0,29)|0;s=e-(s&-8)|0;t=o+((te(s>>16,t)|0)+((te(s&65535,t)|0)>>16))|0;n=r+28-n-i|0;if((n|0)>=0)return((n|0)<32?t>>n:0)|0;n=0-n|0;e=-2147483648>>n;r=2147483647>>>n;if((e|0)>(r|0)){if((t|0)>(e|0)){o=e;o=o<(r|0)){o=r;o=o<>2]=t;s[e+8>>2]=193536;s[e+12>>2]=193536;s[e+4756>>2]=1;t=e+32|0;i=t+112|0;do{s[t>>2]=0;t=t+4|0}while((t|0)<(i|0));t=0;while(1){if((t|0)==4){t=0;break}i=t+1|0;n=50/(i|0)|0;s[e+124+(t<<2)>>2]=(n|0)>1?n:1;t=i}while(1){if((t|0)==4)break;n=(s[e+124+(t<<2)>>2]|0)*100|0;s[e+92+(t<<2)>>2]=n;s[e+108+(t<<2)>>2]=2147483647/(n|0)|0;t=t+1|0}s[e+140>>2]=15;t=0;while(1){if((t|0)==4)break;s[e+72+(t<<2)>>2]=25600;t=t+1|0}return 0}function Gi(e,t){e=e|0;t=t|0;var i=0,n=0,o=0,a=0,l=0,h=0,c=0,p=0,b=0,w=0,m=0,g=0,_=0,v=0;v=u;u=u+304|0;m=v;b=e+4668|0;n=s[b>>2]|0;if((n|0)==(t|0)?(i=e+4648|0,(s[e+4652>>2]|0)==(s[i>>2]|0)):0){g=i;_=0;g=s[g>>2]|0;e=e+4652|0;s[e>>2]=g;u=v;return _|0}if(!n){_=e+4648|0;g=_;_=Hi(e+5868|0,s[_>>2]|0,t*1e3|0,1)|0;g=s[g>>2]|0;e=e+4652|0;s[e>>2]=g;u=v;return _|0}w=((s[e+4672>>2]|0)*10|0)+5|0;p=te(w,n)|0;n=te(w,t)|0;g=Ne()|0;_=u;u=u+((1*(((p|0)>(n|0)?p:n)<<1)|0)+15&-16)|0;i=p;while(1){c=i+-1|0;if((i|0)<=0)break;a=+f[e+7272+(c<<2)>>2];o=(f[d>>2]=a,s[d>>2]|0);l=(o&2130706432)>>>0>1249902592;if(!l){i=(o|0)<0;h=i?a+-8388608+8388608:a+8388608+-8388608;if(h==0)h=i?-0:0}else h=a;if((~~h|0)<=32767){if(!l){i=(o|0)<0;h=i?a+-8388608+8388608:a+8388608+-8388608;if(h==0)h=i?-0:0}else h=a;if((~~h|0)<-32768)i=-32768;else{if(!l){i=(o|0)<0;a=i?a+-8388608+8388608:a+8388608+-8388608;if(a==0)a=i?-0:0}i=~~a}}else i=32767;r[_+(c<<1)>>1]=i;i=c}c=e+4648|0;l=Hi(m,(s[b>>2]<<16>>16)*1e3|0,s[c>>2]|0,0)|0;w=te(w,(s[c>>2]|0)/1e3|0)|0;b=u;u=u+((1*(w<<1)|0)+15&-16)|0;zi(m,b,_,p);m=e+5868|0;o=Hi(m,s[c>>2]|0,(t<<16>>16)*1e3|0,1)|0;zi(m,_,b,w);while(1){i=n+-1|0;if((n|0)<=0)break;f[e+7272+(i<<2)>>2]=+(r[_+(i<<1)>>1]|0);n=i}He(g|0);g=c;_=l+o|0;g=s[g>>2]|0;e=e+4652|0;s[e>>2]=g;u=v;return _|0}function Hi(e,t,i,r){e=e|0;t=t|0;i=i|0;r=r|0;var o=0,a=0,l=0;yr(e|0,0,300)|0;if(!r){e:do if((t|0)>=12e3)if((t|0)<16e3){switch(t|0){case 12e3:break e;default:r=-1}return r|0}else{switch(t|0){case 16e3:break e;default:r=-1}return r|0}else{switch(t|0){case 8e3:break e;default:r=-1}return r|0}while(0);e:do if((i|0)<16e3)if((i|0)<12e3){switch(i|0){case 8e3:break e;default:r=-1}return r|0}else{switch(i|0){case 12e3:break e;default:r=-1}return r|0}else{if((i|0)<24e3){switch(i|0){case 16e3:break e;default:r=-1}return r|0}if((i|0)<48e3){switch(i|0){case 24e3:break e;default:r=-1}return r|0}else{switch(i|0){case 48e3:break e;default:r=-1}return r|0}}while(0);s[e+292>>2]=n[((i>>12)-((i|0)>16e3&1)>>((i|0)>24e3&1))+-1+(31150+((((t>>12)-((t|0)>16e3&1)>>((t|0)>24e3&1))+-1|0)*5|0))>>0]}else{e:do if((t|0)<16e3)if((t|0)<12e3){switch(t|0){case 8e3:break e;default:r=-1}return r|0}else{switch(t|0){case 12e3:break e;default:r=-1}return r|0}else{if((t|0)<24e3){switch(t|0){case 16e3:break e;default:r=-1}return r|0}if((t|0)<48e3){switch(t|0){case 24e3:break e;default:r=-1}return r|0}else{switch(t|0){case 48e3:break e;default:r=-1}return r|0}}while(0);e:do if((i|0)>=12e3)if((i|0)<16e3){switch(i|0){case 12e3:break e;default:r=-1}return r|0}else{switch(i|0){case 16e3:break e;default:r=-1}return r|0}else{switch(i|0){case 8e3:break e;default:r=-1}return r|0}while(0);s[e+292>>2]=n[((i>>12)-((i|0)>16e3&1)>>((i|0)>24e3&1))+-1+(31135+((((t>>12)-((t|0)>16e3&1)>>((t|0)>24e3&1))+-1|0)*3|0))>>0]}l=(t|0)/1e3|0;s[e+284>>2]=l;s[e+288>>2]=(i|0)/1e3|0;s[e+268>>2]=l*10;do if((i|0)>(t|0)){r=e+264|0;if((t<<1|0)==(i|0)){s[r>>2]=1;r=0;break}else{s[r>>2]=2;r=1;break}}else{r=e+264|0;if((i|0)>=(t|0)){s[r>>2]=0;r=0;break}s[r>>2]=3;r=i<<2;if((r|0)==(t*3|0)){s[e+280>>2]=3;s[e+276>>2]=18;s[e+296>>2]=25418;r=0;break}o=i*3|0;if((o|0)==(t<<1|0)){s[e+280>>2]=2;s[e+276>>2]=18;s[e+296>>2]=25476;r=0;break}if((i<<1|0)==(t|0)){s[e+280>>2]=1;s[e+276>>2]=24;s[e+296>>2]=25516;r=0;break}if((o|0)==(t|0)){s[e+280>>2]=1;s[e+276>>2]=36;s[e+296>>2]=25544;r=0;break}if((r|0)==(t|0)){s[e+280>>2]=1;s[e+276>>2]=36;s[e+296>>2]=25584;r=0;break}if((i*6|0)==(t|0)){s[e+280>>2]=1;s[e+276>>2]=36;s[e+296>>2]=25624;r=0;break}else{t=-1;return t|0}}while(0);o=((t<<(r|14)|0)/(i|0)|0)<<2;a=e+272|0;s[a>>2]=o;l=i<<16>>16;e=(i>>15)+1>>1;r=t<>16,l)|0)+((te(o&65535,l)|0)>>16)+(te(o,e)|0)|0)>=(r|0)){r=0;break}t=o+1|0;s[a>>2]=t;o=t}return r|0}function zi(e,t,i,n){e=e|0;t=t|0;i=i|0;n=n|0;var r=0,o=0,a=0,l=0;r=e+284|0;a=e+292|0;l=s[a>>2]|0;o=(s[r>>2]|0)-l|0;Sr(e+168+(l<<1)|0,i|0,o<<1|0)|0;switch(s[e+264>>2]|0){case 1:{l=e+168|0;Vi(e,t,l,s[r>>2]|0);Vi(e,t+(s[e+288>>2]<<1)|0,i+(o<<1)|0,n-(s[r>>2]|0)|0);r=l;break}case 2:{l=e+168|0;Wi(e,t,l,s[r>>2]|0);Wi(e,t+(s[e+288>>2]<<1)|0,i+(o<<1)|0,n-(s[r>>2]|0)|0);r=l;break}case 3:{l=e+168|0;qi(e,t,l,s[r>>2]|0);qi(e,t+(s[e+288>>2]<<1)|0,i+(o<<1)|0,n-(s[r>>2]|0)|0);r=l;break}default:{l=e+168|0;Sr(t|0,l|0,s[r>>2]<<1|0)|0;Sr(t+(s[e+288>>2]<<1)|0,i+(o<<1)|0,n-(s[r>>2]|0)<<1|0)|0;r=l}}l=s[a>>2]|0;Sr(r|0,i+(n-l<<1)|0,l<<1|0)|0;return}function qi(e,t,i,n){e=e|0;t=t|0;i=i|0;n=n|0;var o=0,a=0,l=0,f=0,h=0,c=0,d=0,p=0,b=0,w=0,m=0,g=0,_=0,v=0,k=0,y=0,E=0,A=0,T=0,S=0,M=0,R=0,C=0,P=0,x=0,I=0,O=0,N=0,D=0,L=0,U=0,B=0,j=0,F=0,G=0,H=0,z=0,q=0;j=u;d=e+268|0;h=s[d>>2]|0;E=e+276|0;f=s[E>>2]|0;L=u;u=u+((1*(h+f<<2)|0)+15&-16)|0;U=e+24|0;Sr(L|0,U|0,f<<2|0)|0;B=e+296|0;D=s[B>>2]|0;p=D+4|0;b=s[e+272>>2]|0;w=e+4|0;m=e+280|0;g=D+6|0;_=D+8|0;v=D+10|0;k=D+12|0;y=D+14|0;A=D+16|0;T=D+18|0;S=D+20|0;M=D+22|0;R=D+24|0;C=D+26|0;P=D+28|0;x=D+30|0;I=D+32|0;O=D+34|0;N=D+36|0;D=D+38|0;c=i;i=h;while(1){h=(n|0)<(i|0)?n:i;i=L+(f<<2)|0;o=s[B>>2]|0;a=o+2|0;l=0;while(1){if((l|0)>=(h|0))break;G=(s[e>>2]|0)+(r[c+(l<<1)>>1]<<8)|0;s[i+(l<<2)>>2]=G;G=G<<2;H=G>>16;F=r[o>>1]|0;G=G&65532;s[e>>2]=(s[w>>2]|0)+((te(H,F)|0)+((te(G,F)|0)>>16));F=r[a>>1]|0;s[w>>2]=(te(H,F)|0)+((te(G,F)|0)>>16);l=l+1|0}l=h<<16;i=s[m>>2]|0;e:do switch(f|0){case 18:{a=i<<16>>16;o=i+-1|0;i=0;while(1){if((i|0)>=(l|0))break e;G=L+(i>>16<<2)|0;H=(te(i&65535,a)|0)>>16;F=p+(H*9<<1)|0;f=s[G>>2]|0;q=r[F>>1]|0;q=(te(f>>16,q)|0)+((te(f&65535,q)|0)>>16)|0;f=s[G+4>>2]|0;z=r[F+2>>1]|0;z=q+((te(f>>16,z)|0)+((te(f&65535,z)|0)>>16))|0;f=s[G+8>>2]|0;q=r[F+4>>1]|0;q=z+((te(f>>16,q)|0)+((te(f&65535,q)|0)>>16))|0;f=s[G+12>>2]|0;z=r[F+6>>1]|0;z=q+((te(f>>16,z)|0)+((te(f&65535,z)|0)>>16))|0;f=s[G+16>>2]|0;q=r[F+8>>1]|0;q=z+((te(f>>16,q)|0)+((te(f&65535,q)|0)>>16))|0;f=s[G+20>>2]|0;z=r[F+10>>1]|0;z=q+((te(f>>16,z)|0)+((te(f&65535,z)|0)>>16))|0;f=s[G+24>>2]|0;q=r[F+12>>1]|0;q=z+((te(f>>16,q)|0)+((te(f&65535,q)|0)>>16))|0;f=s[G+28>>2]|0;z=r[F+14>>1]|0;z=q+((te(f>>16,z)|0)+((te(f&65535,z)|0)>>16))|0;f=s[G+32>>2]|0;F=r[F+16>>1]|0;F=z+((te(f>>16,F)|0)+((te(f&65535,F)|0)>>16))|0;H=p+((o-H|0)*9<<1)|0;f=s[G+68>>2]|0;z=r[H>>1]|0;z=F+((te(f>>16,z)|0)+((te(f&65535,z)|0)>>16))|0;f=s[G+64>>2]|0;F=r[H+2>>1]|0;F=z+((te(f>>16,F)|0)+((te(f&65535,F)|0)>>16))|0;f=s[G+60>>2]|0;z=r[H+4>>1]|0;z=F+((te(f>>16,z)|0)+((te(f&65535,z)|0)>>16))|0;f=s[G+56>>2]|0;F=r[H+6>>1]|0;F=z+((te(f>>16,F)|0)+((te(f&65535,F)|0)>>16))|0;f=s[G+52>>2]|0;z=r[H+8>>1]|0;z=F+((te(f>>16,z)|0)+((te(f&65535,z)|0)>>16))|0;f=s[G+48>>2]|0;F=r[H+10>>1]|0;F=z+((te(f>>16,F)|0)+((te(f&65535,F)|0)>>16))|0;f=s[G+44>>2]|0;z=r[H+12>>1]|0;z=F+((te(f>>16,z)|0)+((te(f&65535,z)|0)>>16))|0;f=s[G+40>>2]|0;F=r[H+14>>1]|0;F=z+((te(f>>16,F)|0)+((te(f&65535,F)|0)>>16))|0;G=s[G+36>>2]|0;H=r[H+16>>1]|0;H=(F+((te(G>>16,H)|0)+((te(G&65535,H)|0)>>16))>>5)+1>>1;r[t>>1]=(H|0)>32767?32767:((H|0)<-32768?-32768:H)&65535;t=t+2|0;i=i+b|0}}case 24:{i=0;while(1){if((i|0)>=(l|0))break e;z=L+(i>>16<<2)|0;q=(s[z>>2]|0)+(s[z+92>>2]|0)|0;H=r[p>>1]|0;H=(te(q>>16,H)|0)+((te(q&65535,H)|0)>>16)|0;q=(s[z+4>>2]|0)+(s[z+88>>2]|0)|0;G=r[g>>1]|0;G=H+((te(q>>16,G)|0)+((te(q&65535,G)|0)>>16))|0;q=(s[z+8>>2]|0)+(s[z+84>>2]|0)|0;H=r[_>>1]|0;H=G+((te(q>>16,H)|0)+((te(q&65535,H)|0)>>16))|0;q=(s[z+12>>2]|0)+(s[z+80>>2]|0)|0;G=r[v>>1]|0;G=H+((te(q>>16,G)|0)+((te(q&65535,G)|0)>>16))|0;q=(s[z+16>>2]|0)+(s[z+76>>2]|0)|0;H=r[k>>1]|0;H=G+((te(q>>16,H)|0)+((te(q&65535,H)|0)>>16))|0;q=(s[z+20>>2]|0)+(s[z+72>>2]|0)|0;G=r[y>>1]|0;G=H+((te(q>>16,G)|0)+((te(q&65535,G)|0)>>16))|0;q=(s[z+24>>2]|0)+(s[z+68>>2]|0)|0;H=r[A>>1]|0;H=G+((te(q>>16,H)|0)+((te(q&65535,H)|0)>>16))|0;q=(s[z+28>>2]|0)+(s[z+64>>2]|0)|0;G=r[T>>1]|0;G=H+((te(q>>16,G)|0)+((te(q&65535,G)|0)>>16))|0;q=(s[z+32>>2]|0)+(s[z+60>>2]|0)|0;H=r[S>>1]|0;H=G+((te(q>>16,H)|0)+((te(q&65535,H)|0)>>16))|0;q=(s[z+36>>2]|0)+(s[z+56>>2]|0)|0;G=r[M>>1]|0;G=H+((te(q>>16,G)|0)+((te(q&65535,G)|0)>>16))|0;q=(s[z+40>>2]|0)+(s[z+52>>2]|0)|0;H=r[R>>1]|0;H=G+((te(q>>16,H)|0)+((te(q&65535,H)|0)>>16))|0;z=(s[z+44>>2]|0)+(s[z+48>>2]|0)|0;q=r[C>>1]|0;q=(H+((te(z>>16,q)|0)+((te(z&65535,q)|0)>>16))>>5)+1>>1;r[t>>1]=(q|0)>32767?32767:((q|0)<-32768?-32768:q)&65535;t=t+2|0;i=i+b|0}}case 36:{i=0;while(1){if((i|0)>=(l|0))break e;z=L+(i>>16<<2)|0;q=(s[z>>2]|0)+(s[z+140>>2]|0)|0;H=r[p>>1]|0;H=(te(q>>16,H)|0)+((te(q&65535,H)|0)>>16)|0;q=(s[z+4>>2]|0)+(s[z+136>>2]|0)|0;G=r[g>>1]|0;G=H+((te(q>>16,G)|0)+((te(q&65535,G)|0)>>16))|0;q=(s[z+8>>2]|0)+(s[z+132>>2]|0)|0;H=r[_>>1]|0;H=G+((te(q>>16,H)|0)+((te(q&65535,H)|0)>>16))|0;q=(s[z+12>>2]|0)+(s[z+128>>2]|0)|0;G=r[v>>1]|0;G=H+((te(q>>16,G)|0)+((te(q&65535,G)|0)>>16))|0;q=(s[z+16>>2]|0)+(s[z+124>>2]|0)|0;H=r[k>>1]|0;H=G+((te(q>>16,H)|0)+((te(q&65535,H)|0)>>16))|0;q=(s[z+20>>2]|0)+(s[z+120>>2]|0)|0;G=r[y>>1]|0;G=H+((te(q>>16,G)|0)+((te(q&65535,G)|0)>>16))|0;q=(s[z+24>>2]|0)+(s[z+116>>2]|0)|0;H=r[A>>1]|0;H=G+((te(q>>16,H)|0)+((te(q&65535,H)|0)>>16))|0;q=(s[z+28>>2]|0)+(s[z+112>>2]|0)|0;G=r[T>>1]|0;G=H+((te(q>>16,G)|0)+((te(q&65535,G)|0)>>16))|0;q=(s[z+32>>2]|0)+(s[z+108>>2]|0)|0;H=r[S>>1]|0;H=G+((te(q>>16,H)|0)+((te(q&65535,H)|0)>>16))|0;q=(s[z+36>>2]|0)+(s[z+104>>2]|0)|0;G=r[M>>1]|0;G=H+((te(q>>16,G)|0)+((te(q&65535,G)|0)>>16))|0;q=(s[z+40>>2]|0)+(s[z+100>>2]|0)|0;H=r[R>>1]|0;H=G+((te(q>>16,H)|0)+((te(q&65535,H)|0)>>16))|0;q=(s[z+44>>2]|0)+(s[z+96>>2]|0)|0;G=r[C>>1]|0;G=H+((te(q>>16,G)|0)+((te(q&65535,G)|0)>>16))|0;q=(s[z+48>>2]|0)+(s[z+92>>2]|0)|0;H=r[P>>1]|0;H=G+((te(q>>16,H)|0)+((te(q&65535,H)|0)>>16))|0;q=(s[z+52>>2]|0)+(s[z+88>>2]|0)|0;G=r[x>>1]|0;G=H+((te(q>>16,G)|0)+((te(q&65535,G)|0)>>16))|0;q=(s[z+56>>2]|0)+(s[z+84>>2]|0)|0;H=r[I>>1]|0;H=G+((te(q>>16,H)|0)+((te(q&65535,H)|0)>>16))|0;q=(s[z+60>>2]|0)+(s[z+80>>2]|0)|0;G=r[O>>1]|0;G=H+((te(q>>16,G)|0)+((te(q&65535,G)|0)>>16))|0;q=(s[z+64>>2]|0)+(s[z+76>>2]|0)|0;H=r[N>>1]|0;H=G+((te(q>>16,H)|0)+((te(q&65535,H)|0)>>16))|0;z=(s[z+68>>2]|0)+(s[z+72>>2]|0)|0;q=r[D>>1]|0;q=(H+((te(z>>16,q)|0)+((te(z&65535,q)|0)>>16))>>5)+1>>1;r[t>>1]=(q|0)>32767?32767:((q|0)<-32768?-32768:q)&65535;t=t+2|0;i=i+b|0}}default:{}}while(0);n=n-h|0;if((n|0)<=1)break;f=s[E>>2]|0;Sr(L|0,L+(h<<2)|0,f<<2|0)|0;c=c+(h<<1)|0;i=s[d>>2]|0}Sr(U|0,L+(h<<2)|0,s[E>>2]<<2|0)|0;u=j;return}function Wi(e,t,i,n){e=e|0;t=t|0;i=i|0;n=n|0;var o=0,a=0,l=0,f=0,h=0,c=0,d=0,p=0,b=0,w=0,m=0,g=0;b=u;f=e+268|0;l=s[f>>2]|0;h=u;u=u+((1*((l<<1)+8<<1)|0)+15&-16)|0;c=e+24|0;r[h>>1]=r[c>>1]|0;r[h+2>>1]=r[c+2>>1]|0;r[h+4>>1]=r[c+4>>1]|0;r[h+6>>1]=r[c+6>>1]|0;r[h+8>>1]=r[c+8>>1]|0;r[h+10>>1]=r[c+10>>1]|0;r[h+12>>1]=r[c+12>>1]|0;r[h+14>>1]=r[c+14>>1]|0;d=s[e+272>>2]|0;p=h+16|0;o=t;t=l;while(1){l=(n|0)<(t|0)?n:t;Vi(e,p,i,l);a=l<<17;t=0;while(1){if((t|0)>=(a|0))break;w=((t&65535)*12|0)>>>16;m=h+(t>>16<<1)|0;g=te(r[m>>1]|0,r[25664+(w<<3)>>1]|0)|0;g=g+(te(r[m+2>>1]|0,r[25664+(w<<3)+2>>1]|0)|0)|0;g=g+(te(r[m+4>>1]|0,r[25664+(w<<3)+4>>1]|0)|0)|0;g=g+(te(r[m+6>>1]|0,r[25664+(w<<3)+6>>1]|0)|0)|0;w=11-w|0;g=g+(te(r[m+8>>1]|0,r[25664+(w<<3)+6>>1]|0)|0)|0;g=g+(te(r[m+10>>1]|0,r[25664+(w<<3)+4>>1]|0)|0)|0;g=g+(te(r[m+12>>1]|0,r[25664+(w<<3)+2>>1]|0)|0)|0;w=(g+(te(r[m+14>>1]|0,r[25664+(w<<3)>>1]|0)|0)>>14)+1>>1;r[o>>1]=(w|0)>32767?32767:((w|0)<-32768?-32768:w)&65535;o=o+2|0;t=t+d|0}n=n-l|0;if((n|0)<=0)break;t=h+(l<<1<<1)|0;r[h>>1]=r[t>>1]|0;r[h+2>>1]=r[t+2>>1]|0;r[h+4>>1]=r[t+4>>1]|0;r[h+6>>1]=r[t+6>>1]|0;r[h+8>>1]=r[t+8>>1]|0;r[h+10>>1]=r[t+10>>1]|0;r[h+12>>1]=r[t+12>>1]|0;r[h+14>>1]=r[t+14>>1]|0;i=i+(l<<1)|0;t=s[f>>2]|0}g=h+(l<<1<<1)|0;r[c>>1]=r[g>>1]|0;r[c+2>>1]=r[g+2>>1]|0;r[c+4>>1]=r[g+4>>1]|0;r[c+6>>1]=r[g+6>>1]|0;r[c+8>>1]=r[g+8>>1]|0;r[c+10>>1]=r[g+10>>1]|0;r[c+12>>1]=r[g+12>>1]|0;r[c+14>>1]=r[g+14>>1]|0;u=b;return}function Vi(e,t,i,n){e=e|0;t=t|0;i=i|0;n=n|0;var o=0,a=0,l=0,f=0,h=0,u=0,c=0,d=0,p=0,b=0;o=e+4|0;a=e+8|0;l=e+12|0;f=e+16|0;h=e+20|0;u=0;while(1){if((u|0)>=(n|0))break;b=r[i+(u<<1)>>1]<<10;d=s[e>>2]|0;c=b-d|0;c=((c>>16)*1746|0)+(((c&65535)*1746|0)>>>16)|0;d=d+c|0;s[e>>2]=b+c;c=s[o>>2]|0;p=d-c|0;p=((p>>16)*14986|0)+(((p&65535)*14986|0)>>>16)|0;c=c+p|0;s[o>>2]=d+p;p=c-(s[a>>2]|0)|0;d=(te(p>>16,-26453)|0)+((te(p&65535,-26453)|0)>>16)|0;s[a>>2]=c+(p+d);d=(c+d>>9)+1>>1;c=u<<1;r[t+(c<<1)>>1]=(d|0)>32767?32767:((d|0)<-32768?-32768:d)&65535;d=s[l>>2]|0;p=b-d|0;p=((p>>16)*6854|0)+(((p&65535)*6854|0)>>>16)|0;d=d+p|0;s[l>>2]=b+p;p=s[f>>2]|0;b=d-p|0;b=((b>>16)*25769|0)+(((b&65535)*25769|0)>>>16)|0;p=p+b|0;s[f>>2]=d+b;b=p-(s[h>>2]|0)|0;d=(te(b>>16,-9994)|0)+((te(b&65535,-9994)|0)>>16)|0;s[h>>2]=p+(b+d);d=(p+d>>9)+1>>1;r[t+((c|1)<<1)>>1]=(d|0)>32767?32767:((d|0)<-32768?-32768:d)&65535;u=u+1|0}return}function Yi(e,t){e=e|0;t=t|0;var i=0,n=0,a=0,l=0,f=0,h=0,c=0,d=0,p=0,b=0,w=0,m=0,g=0,_=0;_=u;u=u+32|0;g=_;w=e+28|0;l=s[w>>2]|0;m=e+32|0;i=s[m>>2]|0;n=l>>>8;f=-1;while(1){f=f+1|0;a=te(n,o[29891+f>>0]|0)|0;if(i>>>0>=a>>>0)break;else l=a}h=i-a|0;s[m>>2]=h;i=l-a|0;s[w>>2]=i;c=e+20|0;d=e+40|0;p=e+24|0;b=e+4|0;l=h;while(1){if(i>>>0>=8388609)break;s[c>>2]=(s[c>>2]|0)+8;i=i<<8;s[w>>2]=i;a=s[d>>2]|0;n=s[p>>2]|0;if(n>>>0<(s[b>>2]|0)>>>0){s[p>>2]=n+1;n=o[(s[e>>2]|0)+n>>0]|0}else n=0;s[d>>2]=n;h=((a<<8|n)>>>1&255|l<<8&2147483392)^255;s[m>>2]=h;l=h}h=(f|0)/5|0;s[g+8>>2]=h;s[g+20>>2]=f+(te(h,-5)|0);h=0;while(1){if((h|0)==2){i=0;break}a=i>>>8;f=-1;while(1){f=f+1|0;n=te(a,o[29944+f>>0]|0)|0;if(l>>>0>=n>>>0)break;else i=n}l=l-n|0;s[m>>2]=l;i=i-n|0;s[w>>2]=i;while(1){if(i>>>0>=8388609)break;s[c>>2]=(s[c>>2]|0)+8;i=i<<8;s[w>>2]=i;a=s[d>>2]|0;n=s[p>>2]|0;if(n>>>0<(s[b>>2]|0)>>>0){s[p>>2]=n+1;n=o[(s[e>>2]|0)+n>>0]|0}else n=0;s[d>>2]=n;a=((a<<8|n)>>>1&255|l<<8&2147483392)^255;s[m>>2]=a;l=a}s[g+(h*12|0)>>2]=f;a=i>>>8;f=-1;while(1){f=f+1|0;n=te(a,o[29951+f>>0]|0)|0;if(l>>>0>=n>>>0)break;else i=n}l=l-n|0;s[m>>2]=l;i=i-n|0;s[w>>2]=i;while(1){if(i>>>0>=8388609)break;s[c>>2]=(s[c>>2]|0)+8;i=i<<8;s[w>>2]=i;a=s[d>>2]|0;n=s[p>>2]|0;if(n>>>0<(s[b>>2]|0)>>>0){s[p>>2]=n+1;n=o[(s[e>>2]|0)+n>>0]|0}else n=0;s[d>>2]=n;a=((a<<8|n)>>>1&255|l<<8&2147483392)^255;s[m>>2]=a;l=a}s[g+(h*12|0)+4>>2]=f;h=h+1|0}while(1){if((i|0)==2)break;m=g+(i*12|0)|0;e=(s[m>>2]|0)+((s[g+(i*12|0)+8>>2]|0)*3|0)|0;s[m>>2]=e;m=r[25372+(e<<1)>>1]|0;e=r[25372+(e+1<<1)>>1]|0;e=(te((e<<16>>16)-m>>16,429522944)|0)+(((e&65535)-m&65535)*6554|0)>>16;s[t+(i<<2)>>2]=m+(te(e,s[g+(i*12|0)+4>>2]<<17>>16|1)|0);i=i+1|0}s[t>>2]=(s[t>>2]|0)-(s[t+4>>2]|0);u=_;return}function Zi(e,t,i,n,o,a){e=e|0;t=t|0;i=i|0;n=n|0;o=o|0;a=a|0;var l=0,f=0,h=0,c=0,d=0,p=0,b=0,w=0,m=0,g=0,_=0,v=0,k=0;k=u;u=u+16|0;p=k+12|0;b=k+8|0;l=k+4|0;m=k;Dn(l,p,t,o);Dn(m,b,i,o);p=s[p>>2]|0;b=s[b>>2]|0;f=(p|0)>(b|0)?p:b;f=f+(f&1)|0;b=s[m>>2]>>f-b;s[m>>2]=b;p=s[l>>2]>>f-p;p=(p|0)>1?p:1;s[l>>2]=p;l=0;w=0;while(1){if((l|0)>=(o|0))break;v=w+((te(r[t+(l<<1)>>1]|0,r[i+(l<<1)>>1]|0)|0)>>f)|0;l=l+1|0;w=v}v=$i(w,p,13)|0;v=(v|0)>16384?16384:(v|0)<-16384?-16384:v;h=v<<16>>16;c=(te(v>>16,h)|0)+((te(v&65535,h)|0)>>16)|0;i=(c|0)>0?c:0-c|0;i=(i|0)<(a|0)?a:i;_=f>>1;a=s[n>>2]|0;t=ne(p|0)|0;l=24-t|0;o=0-l|0;do if(l)if((l|0)<0){l=p<>>(l+32|0);break}else{l=p<<32-l|p>>>l;break}else l=p;while(0);o=((t&1|0)==0?46214:32768)>>>(t>>>1);t=(te(l&127,13959168)|0)>>>16;g=i<<16>>16;t=te((o+((te(o>>16,t)|0)+((te(o&65535,t)|0)>>>16))<<_)-a>>16,g)|0;i=ne(p|0)|0;l=24-i|0;o=0-l|0;do if(l)if((l|0)<0){l=p<>>(l+32|0);break}else{l=p<<32-l|p>>>l;break}else l=p;while(0);f=((i&1|0)==0?46214:32768)>>>(i>>>1);d=(te(l&127,13959168)|0)>>>16;d=a+(t+((te((f+((te(f>>16,d)|0)+((te(f&65535,d)|0)>>>16))<<_)-a&65535,g)|0)>>16))|0;s[n>>2]=d;l=c<<16>>16;l=b-((te(w>>16,h)|0)+((te(w&65535,h)|0)>>16)<<4)+((te(p>>16,l)|0)+((te(p&65535,l)|0)>>16)<<6)|0;s[m>>2]=l;h=n+4|0;c=s[h>>2]|0;a=(l|0)<1;if(a){n=0;m=te(0-c>>16,g)|0;_=n<<_;_=_-c|0;_=_&65535;g=te(_,g)|0;g=g>>16;g=m+g|0;g=c+g|0;s[h>>2]=g;_=(d|0)>1;_=_?d:1;_=$i(g,_,14)|0;g=(_|0)>32767;m=(_|0)<0;_=m?0:_;_=g?32767:_;s[e>>2]=_;u=k;return v|0}i=ne(l|0)|0;o=24-i|0;t=0-o|0;do if(o)if((o|0)<0){o=l<>>(o+32|0);break}else{o=l<<32-o|l>>>o;break}else o=l;while(0);m=((i&1|0)==0?46214:32768)>>>(i>>>1);f=(te(o&127,13959168)|0)>>>16;f=te((m+((te(m>>16,f)|0)+((te(m&65535,f)|0)>>>16))<<_)-c>>16,g)|0;if(a){n=0;m=f;_=n<<_;_=_-c|0;_=_&65535;g=te(_,g)|0;g=g>>16;g=m+g|0;g=c+g|0;s[h>>2]=g;_=(d|0)>1;_=_?d:1;_=$i(g,_,14)|0;g=(_|0)>32767;m=(_|0)<0;_=m?0:_;_=g?32767:_;s[e>>2]=_;u=k;return v|0}i=ne(l|0)|0;o=24-i|0;t=0-o|0;do if(o)if((o|0)<0){l=l<>>(o+32|0);break}else{l=l<<32-o|l>>>o;break}while(0);m=((i&1|0)==0?46214:32768)>>>(i>>>1);n=(te(l&127,13959168)|0)>>>16;n=m+((te(m>>16,n)|0)+((te(m&65535,n)|0)>>>16))|0;m=f;_=n<<_;_=_-c|0;_=_&65535;g=te(_,g)|0;g=g>>16;g=m+g|0;g=c+g|0;s[h>>2]=g;_=(d|0)>1;_=_?d:1;_=$i(g,_,14)|0;g=(_|0)>32767;m=(_|0)<0;_=m?0:_;_=g?32767:_;s[e>>2]=_;u=k;return v|0}function $i(e,t,i){e=e|0;t=t|0;i=i|0;var n=0,r=0,s=0,o=0;if((e|0)<=0)if(!e)r=32;else{n=0-e|0;s=3}else{n=e;s=3}if((s|0)==3)r=ne(n|0)|0;e=e<>16|0)|0)<<16>>16;o=(te(e>>16,t)|0)+((te(e&65535,t)|0)>>16)|0;s=Nr(s|0,((s|0)<0)<<31>>31|0,o|0,((o|0)<0)<<31>>31|0)|0;s=Tr(s|0,x|0,29)|0;s=e-(s&-8)|0;t=o+((te(s>>16,t)|0)+((te(s&65535,t)|0)>>16))|0;n=r+28-n-i|0;if((n|0)>=0)return((n|0)<32?t>>n:0)|0;n=0-n|0;e=-2147483648>>n;r=2147483647>>>n;if((e|0)>(r|0)){if((t|0)>(e|0)){o=e;o=o<(r|0)){o=r;o=o<=15)break;u=r[25372+(o<<1)>>1]|0;c=o+1|0;d=r[25372+(c<<1)>>1]|0;d=(te((d<<16>>16)-u>>16,429522944)|0)+(((d&65535)-u&65535)*6554|0)>>16;h=o&255;l=a;f=0;while(1){if((f|0)>=5){a=l;o=c;continue e}o=u+(te(d,f<<17>>16|1)|0)|0;a=s[b>>2]|0;a=(a|0)>(o|0)?a-o|0:o-a|0;if((a|0)>=(l|0))break e;n[w>>0]=h;n[p>>0]=f;l=a;f=f+1|0;i=o}}d=n[w>>0]|0;p=(d<<24>>24|0)/3|0;n[t+(m*3|0)+2>>0]=p;n[w>>0]=(d&255)+(te(p,-3)|0);s[b>>2]=i;m=m+1|0}s[e>>2]=(s[e>>2]|0)-(s[e+4>>2]|0);return}function Xi(e,t,i,l,c,p){e=e|0;t=t|0;i=i|0;l=l|0;c=c|0;p=p|0;var b=0,w=0,m=0,g=0,_=0,v=0,k=0,y=0,E=0,A=0,T=0,S=0,M=0,R=0,C=0,P=0,x=0,I=0,O=0,N=0,D=0,L=0,U=0,B=0,j=0,F=0,G=0,q=0,W=0,V=0,Y=0,Z=0,$=0,K=0,X=0,Q=0,ee=0,ie=0,re=0,se=0,oe=0,ae=0,le=0,fe=0,he=0,ue=0,ce=0,de=0,pe=0,be=0,we=0,me=0,ge=0,_e=0,ve=0,ke=0,ye=0,Ee=0,Ae=0,Te=0,Se=0,Me=0,Re=0,Ce=0,Pe=0,xe=0,Ie=0,Oe=0,Ne=0,De=0,Le=0,Ue=0,Be=0,je=0,Fe=0,Ge=0,He=0,ze=0,qe=0,We=0,Ve=0,Ye=0,Ze=0,$e=0,Ke=0,Xe=0,Je=0,Qe=0,et=0,tt=0,it=0,nt=0,rt=0,st=0,ot=0,at=0,lt=0,ft=0,ht=0,ut=0;lt=u;u=u+35104|0;He=lt+272|0;Ge=lt+72|0;Ue=lt+29992|0;Le=lt+29352|0;ue=lt+28712|0;ce=lt+28392|0;Fe=lt+48|0;je=lt+26008|0;Be=lt+24472|0;ie=lt+11992|0;re=lt+11896|0;Z=lt+33512|0;le=lt+9176|0;ae=lt+6456|0;F=lt+32232|0;G=lt+31272|0;j=lt+6384|0;Ie=lt+6320|0;Ne=lt+6256|0;Oe=lt+4720|0;tt=lt+23720|0;se=lt+21032|0;rt=lt+20984|0;st=lt+24|0;ot=lt;it=lt+16536|0;nt=lt+12088|0;et=lt+12072|0;Je=lt+33824|0;Qe=lt+12056|0;Ke=lt+33816|0;Xe=lt+12040|0;s[Qe>>2]=0;s[Qe+4>>2]=0;s[Qe+8>>2]=0;s[Qe+12>>2]=0;Ye=e+4712|0;Ze=s[Ye>>2]|0;s[Ye>>2]=Ze+1;Ye=e+4862|0;n[Ye>>0]=Ze&3;Ze=e+4684|0;he=s[Ze>>2]|0;$e=e+7272+(he<<2)|0;he=se+(he<<2)|0;D=e+5190|0;Ve=e+4676|0;b=s[Ve>>2]|0;g=s[e+28>>2]|0;if(g){_=e+24|0;v=s[_>>2]|0;m=256-v<<10;E=m>>16;m=m-(E<<16)|0;e:do if((E|0)<4){if((m|0)<=0){ze=17528+(E*12|0)|0;s[He>>2]=s[ze>>2];s[He+4>>2]=s[ze+4>>2];s[He+8>>2]=s[ze+8>>2];ze=17588+(E<<3)|0;qe=s[ze+4>>2]|0;We=Ge;s[We>>2]=s[ze>>2];s[We+4>>2]=qe;break}A=E+1|0;T=m<<16>>16;if((m|0)<32768){m=0;while(1){if((m|0)==3){m=0;break}qe=s[17528+(E*12|0)+(m<<2)>>2]|0;We=(s[17528+(A*12|0)+(m<<2)>>2]|0)-qe|0;s[He+(m<<2)>>2]=qe+((te(We>>16,T)|0)+((te(We&65535,T)|0)>>16));m=m+1|0}while(1){if((m|0)==2)break e;qe=s[17588+(E<<3)+(m<<2)>>2]|0;We=(s[17588+(A<<3)+(m<<2)>>2]|0)-qe|0;s[Ge+(m<<2)>>2]=qe+((te(We>>16,T)|0)+((te(We&65535,T)|0)>>16));m=m+1|0}}else{m=0;while(1){if((m|0)==3){m=0;break}qe=s[17528+(A*12|0)+(m<<2)>>2]|0;We=qe-(s[17528+(E*12|0)+(m<<2)>>2]|0)|0;s[He+(m<<2)>>2]=qe+((te(We>>16,T)|0)+((te(We&65535,T)|0)>>16));m=m+1|0}while(1){if((m|0)==2)break e;qe=s[17588+(A<<3)+(m<<2)>>2]|0;We=qe-(s[17588+(E<<3)+(m<<2)>>2]|0)|0;s[Ge+(m<<2)>>2]=qe+((te(We>>16,T)|0)+((te(We&65535,T)|0)>>16));m=m+1|0}}}else{s[He>>2]=s[4394];s[He+4>>2]=s[4395];s[He+8>>2]=s[4396];We=Ge;s[We>>2]=35497197;s[We+4>>2]=57401098}while(0);m=v+g|0;s[_>>2]=(m|0)>256?256:(m|0)<0?0:m;m=e+16|0;T=0-(s[Ge>>2]|0)|0;g=T&16383;C=0-(s[Ge+4>>2]|0)|0;_=C&16383;E=s[He>>2]|0;v=E>>16;E=E&65535;A=e+20|0;T=T>>>14<<16>>16;M=s[He+4>>2]|0;S=M>>16;M=M&65535;C=C>>>14<<16>>16;x=s[He+8>>2]|0;P=x>>16;x=x&65535;I=0;while(1){if((I|0)>=(b|0))break;We=D+(I<<1)|0;ze=r[We>>1]|0;qe=(s[m>>2]|0)+((te(v,ze)|0)+((te(E,ze)|0)>>16))<<2;Pe=qe>>16;xe=qe&65532;s[m>>2]=(s[A>>2]|0)+(((te(Pe,g)|0)+((te(xe,g)|0)>>>16)>>13)+1>>1)+((te(Pe,T)|0)+((te(xe,T)|0)>>16))+((te(S,ze)|0)+((te(M,ze)|0)>>16));s[A>>2]=(((te(Pe,_)|0)+((te(xe,_)|0)>>>16)>>13)+1>>1)+((te(Pe,C)|0)+((te(xe,C)|0)>>16))+((te(P,ze)|0)+((te(x,ze)|0)>>16));qe=qe+16383>>14;r[We>>1]=(qe|0)>32767?32767:((qe|0)<-32768?-32768:qe)&65535;I=I+1|0}b=s[Ve>>2]|0}We=e+4668|0;g=$e+((s[We>>2]|0)*5<<2)|0;while(1){m=b+-1|0;if((b|0)<=0){b=0;break}f[g+(m<<2)>>2]=+(r[D+(m<<1)>>1]|0);b=m}while(1){if((b|0)==8)break;qe=$e+(((s[We>>2]|0)*5|0)+(te(b,s[Ve>>2]>>3)|0)<<2)|0;f[qe>>2]=+f[qe>>2]+ +(1-(b&2)|0)*9.999999974752427e-7;b=b+1|0}qe=e+4772|0;e:do if(!(s[qe>>2]|0)){_=s[e+4688>>2]|0;S=s[Ze>>2]|0;T=_+(s[Ve>>2]|0)+S|0;S=$e+(0-S<<2)|0;v=s[e+4640>>2]|0;b=S+(T<<2)+(0-v<<2)|0;k=3.1415927410125732/+(_+1|0);y=2-k*k;w=0;m=0;while(1){if((m|0)>=(_|0))break;f[Oe+(m<<2)>>2]=+f[b+(m<<2)>>2]*.5*(w+k);ze=m|1;f[Oe+(ze<<2)>>2]=+f[b+(ze<<2)>>2]*k;B=y*k-w;ze=m|2;f[Oe+(ze<<2)>>2]=+f[b+(ze<<2)>>2]*.5*(k+B);ze=m|3;f[Oe+(ze<<2)>>2]=+f[b+(ze<<2)>>2]*B;w=B;k=y*B-k;m=m+4|0}ze=Oe+(_<<2)|0;g=b+(_<<2)|0;m=v-(_<<1)|0;Sr(ze|0,g|0,m<<2|0)|0;b=ze+(m<<2)|0;m=g+(m<<2)|0;w=1;k=y*.5;g=0;while(1){if((g|0)>=(_|0))break;f[b+(g<<2)>>2]=+f[m+(g<<2)>>2]*.5*(w+k);ze=g|1;f[b+(ze<<2)>>2]=+f[m+(ze<<2)>>2]*k;B=y*k-w;ze=g|2;f[b+(ze<<2)>>2]=+f[m+(ze<<2)>>2]*.5*(k+B);ze=g|3;f[b+(ze<<2)>>2]=+f[m+(ze<<2)>>2]*B;w=B;k=y*B-k;g=g+4|0}A=e+4740|0;E=s[A>>2]|0;b=(E|0)<(v|0)?E+1|0:v;m=0;while(1){if((m|0)>=(b|0))break;f[j+(m<<2)>>2]=+nn(Oe,Oe+(m<<2)|0,v-m|0);m=m+1|0}k=+f[j>>2];k=k+(k*.0010000000474974513+1);f[j>>2]=k;b=0;while(1){if((b|0)>(E|0))break;B=+f[j+(b<<2)>>2];h[He+(b<<4)+8>>3]=B;h[He+(b<<4)>>3]=B;b=b+1|0}fe=He+8|0;g=0;t:while(1){if((E|0)<=(g|0))break;b=g+1|0;w=+h[fe>>3];w=-+h[He+(b<<4)>>3]/(w>9.999999717180685e-10?w:9.999999717180685e-10);f[Ne+(g<<2)>>2]=w;m=E-g|0;_=0;while(1){if((_|0)>=(m|0)){g=b;continue t}xe=He+(_+g+1<<4)|0;B=+h[xe>>3];ze=He+(_<<4)+8|0;U=+h[ze>>3];h[xe>>3]=B+U*w;h[ze>>3]=U+B*w;_=_+1|0}}B=+h[fe>>3];oe=tt+704|0;f[oe>>2]=k/(B>1?B:1);g=0;while(1){if((g|0)>=(E|0))break;w=+f[Ne+(g<<2)>>2];b=g+1|0;m=b>>1;_=0;while(1){if((_|0)>=(m|0))break;xe=Ie+(_<<2)|0;B=+f[xe>>2];ze=Ie+(g-_+-1<<2)|0;U=+f[ze>>2];f[xe>>2]=B+U*w;f[ze>>2]=U+B*w;_=_+1|0}f[Ie+(g<<2)>>2]=-w;g=b}b=E+-1|0;w=.9900000095367432;m=0;while(1){if((m|0)>=(b|0))break;ze=Ie+(m<<2)|0;f[ze>>2]=+f[ze>>2]*w;w=w*.9900000095367432;m=m+1|0}ze=Ie+(b<<2)|0;f[ze>>2]=+f[ze>>2]*w;Ji(se,Ie,S,T,E);ze=e+4857|0;b=n[ze>>0]|0;do if(b<<24>>24!=0?(s[e+4756>>2]|0)==0:0){R=.6000000238418579-+(s[A>>2]|0)*.004000000189989805-+(s[e+4624>>2]|0)*.10000000149011612*.00390625-+(n[e+4633>>0]>>1|0)*.15000000596046448-+(s[e+4804>>2]|0)*.10000000149011612*30517578125e-15;D=tt+228|0;Q=e+4854|0;ee=e+4856|0;j=e+10152|0;x=s[e+4636>>2]|0;y=+(s[e+4744>>2]|0)*152587890625e-16;W=s[We>>2]|0;V=s[e+4736>>2]|0;K=s[e+4672>>2]|0;E=te((K*5|0)+20|0,W)|0;P=K*20|0;m=P+80|0;C=(K*40|0)+160|0;Y=W*5|0;X=W<<1;$=W*18|0;q=$+-1|0;I=(W|0)==16;t:do if(I){b=E;while(1){v=b+-1|0;if((b|0)<=0)break;w=+f[se+(v<<2)>>2];g=(f[d>>2]=w,s[d>>2]|0);_=(g&2130706432)>>>0>1249902592;if(!_){b=(g|0)<0;k=b?w+-8388608+8388608:w+8388608+-8388608;if(k==0)k=b?-0:0}else k=w;if((~~k|0)<=32767){if(!_){b=(g|0)<0;k=b?w+-8388608+8388608:w+8388608+-8388608;if(k==0)k=b?-0:0}else k=w;if((~~k|0)<-32768)b=-32768;else{if(!_){b=(g|0)<0;w=b?w+-8388608+8388608:w+8388608+-8388608;if(w==0)w=b?-0:0}b=~~w}}else b=32767;r[F+(v<<1)>>1]=b;b=v}g=Fe;s[g>>2]=0;s[g+4>>2]=0;On(Fe,ue,F,E);g=C;while(1){b=g+-1|0;if((g|0)<=0){b=ue;break t}f[Ue+(b<<2)>>2]=+(r[ue+(b<<1)>>1]|0); -g=b}}else{if((W|0)==12)b=E;else{b=C;while(1){v=b+-1|0;if((b|0)<=0)break;w=+f[se+(v<<2)>>2];g=(f[d>>2]=w,s[d>>2]|0);_=(g&2130706432)>>>0>1249902592;if(!_){b=(g|0)<0;k=b?w+-8388608+8388608:w+8388608+-8388608;if(k==0)k=b?-0:0}else k=w;if((~~k|0)<=32767){if(!_){b=(g|0)<0;k=b?w+-8388608+8388608:w+8388608+-8388608;if(k==0)k=b?-0:0}else k=w;if((~~k|0)<-32768)b=-32768;else{if(!_){b=(g|0)<0;w=b?w+-8388608+8388608:w+8388608+-8388608;if(w==0)w=b?-0:0}b=~~w}}else b=32767;r[ue+(v<<1)>>1]=b;b=v}b=ue;break}while(1){v=b+-1|0;if((b|0)<=0)break;w=+f[se+(v<<2)>>2];g=(f[d>>2]=w,s[d>>2]|0);_=(g&2130706432)>>>0>1249902592;if(!_){b=(g|0)<0;k=b?w+-8388608+8388608:w+8388608+-8388608;if(k==0)k=b?-0:0}else k=w;if((~~k|0)<=32767){if(!_){b=(g|0)<0;k=b?w+-8388608+8388608:w+8388608+-8388608;if(k==0)k=b?-0:0}else k=w;if((~~k|0)<-32768)b=-32768;else{if(!_){b=(g|0)<0;w=b?w+-8388608+8388608:w+8388608+-8388608;if(w==0)w=b?-0:0}b=~~w}}else b=32767;r[G+(v<<1)>>1]=b;b=v}s[Fe>>2]=0;s[Fe+4>>2]=0;s[Fe+8>>2]=0;s[Fe+12>>2]=0;s[Fe+16>>2]=0;s[Fe+20>>2]=0;s[He>>2]=0;s[He+4>>2]=0;s[He+8>>2]=0;s[He+12>>2]=0;T=Fe+16|0;S=He+16|0;M=Fe+20|0;v=ue;A=G;b=E;while(1){E=(b|0)<480?b:480;g=0;while(1){if((g|0)>=(E|0)){g=He;_=E;break}xe=(s[T>>2]|0)+(r[A+(g<<1)>>1]<<8)|0;s[S+(g<<2)>>2]=xe;xe=xe<<2;Pe=xe>>16;xe=xe&65532;s[T>>2]=(s[M>>2]|0)+((te(Pe,-2797)|0)+((te(xe,-2797)|0)>>16));s[M>>2]=(te(Pe,-6507)|0)+((te(xe,-6507)|0)>>16);g=g+1|0}while(1){if((_|0)<=2)break;Te=s[g>>2]|0;Me=g+4|0;Se=s[Me>>2]|0;Re=g+8|0;Pe=s[Re>>2]|0;xe=g+12|0;Ce=s[xe>>2]|0;Ce=(((Te>>16)*4697|0)+(((Te&65535)*4697|0)>>>16)+(((Se>>16)*10739|0)+(((Se&65535)*10739|0)>>>16))+(((Pe>>16)*8276|0)+(((Pe&65535)*8276|0)>>>16))+(((Ce>>16)*1567|0)+(((Ce&65535)*1567|0)>>>16))>>5)+1>>1;r[v>>1]=(Ce|0)>32767?32767:((Ce|0)<-32768?-32768:Ce)&65535;Me=s[Me>>2]|0;Re=s[Re>>2]|0;Ce=s[xe>>2]|0;Pe=s[g+16>>2]|0;Pe=(((Me>>16)*1567|0)+(((Me&65535)*1567|0)>>>16)+(((Re>>16)*8276|0)+(((Re&65535)*8276|0)>>>16))+(((Ce>>16)*10739|0)+(((Ce&65535)*10739|0)>>>16))+(((Pe>>16)*4697|0)+(((Pe&65535)*4697|0)>>>16))>>5)+1>>1;r[v+2>>1]=(Pe|0)>32767?32767:((Pe|0)<-32768?-32768:Pe)&65535;v=v+4|0;g=xe;_=_+-3|0}b=b-E|0;if((b|0)<=0)break;xe=He+(E<<2)|0;s[He>>2]=s[xe>>2];s[He+4>>2]=s[xe+4>>2];s[He+8>>2]=s[xe+8>>2];s[He+12>>2]=s[xe+12>>2];A=A+(E<<1)|0}g=He+(E<<2)|0;s[Fe>>2]=s[g>>2];s[Fe+4>>2]=s[g+4>>2];s[Fe+8>>2]=s[g+8>>2];s[Fe+12>>2]=s[g+12>>2];g=C;while(1){b=g+-1|0;if((g|0)<=0){b=ue;break t}f[Ue+(b<<2)>>2]=+(r[ue+(b<<1)>>1]|0);g=b}}while(0);xe=Fe;s[xe>>2]=0;s[xe+4>>2]=0;On(Fe,ce,b,C);while(1){b=m+-1|0;if((m|0)<=0)break;f[Le+(b<<2)>>2]=+(r[ce+(b<<1)>>1]|0);m=b}b=P+79|0;while(1){if((b|0)<=0)break;m=Le+(b<<2)|0;b=b+-1|0;w=+(~~+f[m>>2]|0)+ +f[Le+(b<<2)>>2];if(!(w>32767)){if(w<-32768)w=-32768}else w=32767;f[m>>2]=+(~~w<<16>>16)}yr(je|0,0,K*596|0)|0;b=K>>1;m=Be+256|0;A=je+32|0;v=0;E=Le+320|0;while(1){if((v|0)>=(b|0)){b=72;break}g=E+-32|0;wi(E,E+-288|0,Be,40,65);B=+f[m>>2];w=+tn(E,40);w=w+ +tn(g,40)+16e4;f[A>>2]=+f[A>>2]+B*2/w;_=9;while(1){if((_|0)==73)break;xe=g+-4|0;U=+f[xe>>2];B=+f[g+156>>2];B=w+(U*U-B*B);Pe=je+(_<<2)|0;f[Pe>>2]=+f[Pe>>2]+ +f[Be+(72-_<<2)>>2]*2/B;g=xe;_=_+1|0;w=B}v=v+1|0;E=E+160|0}while(1){if((b|0)<=7)break;xe=je+(b<<2)|0;B=+f[xe>>2];f[xe>>2]=B-B*+(b|0)*.000244140625;b=b+-1|0}E=V<<1;m=E+4|0;b=0;while(1){if((b|0)>=(m|0)){b=1;break}s[re+(b<<2)>>2]=b;b=b+1|0}while(1){if((b|0)>=(m|0))break;w=+f[A+(b<<2)>>2];_=b;while(1){g=_+-1|0;if((_|0)<=0)break;k=+f[A+(g<<2)>>2];if(!(w>k))break;f[A+(_<<2)>>2]=k;s[re+(_<<2)>>2]=s[re+(g<<2)>>2];_=g}f[A+(_<<2)>>2]=w;s[re+(_<<2)>>2]=b;b=b+1|0}v=A+(E+3<<2)|0;b=E+2|0;g=m;while(1){if((g|0)>=65)break;w=+f[A+(g<<2)>>2];if(w>+f[v>>2]){_=b;while(1){if((_|0)<=-1)break;k=+f[A+(_<<2)>>2];if(!(w>k))break;xe=_+1|0;f[A+(xe<<2)>>2]=k;s[re+(xe<<2)>>2]=s[re+(_<<2)>>2];_=_+-1|0}xe=_+1|0;f[A+(xe<<2)>>2]=w;s[re+(xe<<2)>>2]=g}g=g+1|0}w=+f[A>>2];do if(w<.20000000298023224){yr(D|0,0,K<<2|0)|0;f[j>>2]=0;r[Q>>1]=0;n[ee>>0]=0;b=0}else{w=w*y;b=0;while(1){if((b|0)>=(m|0))break;if(!(+f[je+(b+8<<2)>>2]>w)){m=b;break}xe=re+(b<<2)|0;s[xe>>2]=(s[xe>>2]<<1)+16;b=b+1|0}b=11;while(1){if((b|0)==148){b=0;break}r[Z+(b<<1)>>1]=0;b=b+1|0}while(1){if((b|0)>=(m|0)){b=146;break}r[Z+(s[re+(b<<2)>>2]<<1)>>1]=1;b=b+1|0}while(1){if((b|0)<=15){m=16;P=0;break}xe=b+-1|0;Pe=Z+(b<<1)|0;r[Pe>>1]=(a[Pe>>1]|0)+((a[Z+(xe<<1)>>1]|0)+(a[Z+(b+-2<<1)>>1]|0));b=xe}while(1){if((m|0)==144){b=146;break}b=m+1|0;if((r[Z+(b<<1)>>1]|0)<=0){m=b;continue}s[re+(P<<2)>>2]=m;m=b;P=P+1|0}while(1){if((b|0)<=15){m=16;b=0;break}xe=b+-1|0;Pe=Z+(b<<1)|0;r[Pe>>1]=(a[Pe>>1]|0)+((a[Z+(xe<<1)>>1]|0)+(a[Z+(b+-2<<1)>>1]|0)+(a[Z+(b+-3<<1)>>1]|0));b=xe}while(1){if((m|0)==147)break;if((r[Z+(m<<1)>>1]|0)>0){r[Z+(b<<1)>>1]=m+65534;b=b+1|0}m=m+1|0}yr(je|0,0,2384)|0;A=(W|0)==8;v=0;E=A?se+640|0:Ue+640|0;while(1){if((v|0)>=(K|0))break;k=+tn(E,40)+1;_=0;while(1){if((_|0)>=(b|0))break;g=r[Z+(_<<1)>>1]|0;m=E+(0-g<<2)|0;w=+nn(m,E,40);if(w>0)w=w*2/(+tn(m,40)+k);else w=0;f[je+(v*596|0)+(g<<2)>>2]=w;_=_+1|0}v=v+1|0;E=E+160|0}if((x|0)>0){if((W|0)==12)b=(x<<1|0)/3|0;else b=x>>(I&1);m=b;B=+Hn(+(b|0))*3.32192809488736}else{m=x;B=0}F=(K|0)==4;if(F){M=32969;C=11;S=A&(V|0)>0?11:3}else{M=32935;C=3;S=3}L=+(K|0);U=L*.20000000298023224;A=(m|0)>0;R=L*R;m=0;O=0;N=-1e3;E=0;T=-1;while(1){if((E|0)>=(P|0))break;v=s[re+(E<<2)>>2]|0;_=0;while(1){if((_|0)>=(S|0)){g=0;y=-1e3;b=0;break}b=ie+(_<<2)|0;f[b>>2]=0;w=0;g=0;while(1){if((g|0)>=(K|0))break;y=w+ +f[je+(g*596|0)+(v+(n[M+((te(g,C)|0)+_)>>0]|0)<<2)>>2];f[b>>2]=y;w=y;g=g+1|0}_=_+1|0}while(1){if((b|0)>=(S|0))break;k=+f[ie+(b<<2)>>2];xe=k>y;g=xe?b:g;y=xe?k:y;b=b+1|0}k=+Hn(+(v|0))*3.32192809488736;w=y-U*k;if(A){k=k-B;k=k*k;w=w-U*+f[j>>2]*k/(k+.5)}xe=w>N&y>R;m=xe?g:m;O=xe?y:O;N=xe?w:N;E=E+1|0;T=xe?v:T}if((T|0)==-1){s[D>>2]=0;s[D+4>>2]=0;s[D+8>>2]=0;s[D+12>>2]=0;f[j>>2]=0;r[Q>>1]=0;n[ee>>0]=0;b=0;break}f[j>>2]=O/L;if((W|0)>8){if((W|0)==12){b=(T<<16>>16)*3|0;b=(b>>1)+(b&1)|0}else b=T<<1;if((X|0)<($|0))if((b|0)<($|0))E=(b|0)<(X|0)?X:b;else E=q;else if((b|0)>(X|0))E=X;else E=(b|0)<(q|0)?q:b;D=E+-2|0;D=(D|0)>(X|0)?D:X;j=E+2|0;j=(j|0)<(q|0)?j:q;if(F){M=33013;C=33149+(V<<3)|0;P=34;x=n[33173+V>>0]|0}else{M=32941;C=32965;P=12;x=12}I=se+(W*20<<2)|0;v=0-D|0;T=0;S=I;while(1){if((T|0)>=(K|0))break;b=T<<1;A=n[C+b>>0]|0;b=n[C+(b|1)>>0]|0;wi(S,S+(v<<2)+(0-b<<2)|0,He,Y,b-A+1|0);m=A;g=0;while(1){if((b|0)<(m|0))break;s[Ge+(g<<2)>>2]=s[He+(b-m<<2)>>2];m=m+1|0;g=g+1|0}b=te(T,P)|0;g=0;while(1){if((g|0)>=(x|0))break;m=(n[M+(b+g)>>0]|0)-A|0;_=0;while(1){if((_|0)==5)break;s[ae+(T*680|0)+(g*20|0)+(_<<2)>>2]=s[Ge+(m+_<<2)>>2];_=_+1|0}g=g+1|0}T=T+1|0;S=S+(Y<<2)|0}if(F){A=33013;T=33149+(V<<3)|0;S=34;C=n[33173+V>>0]|0}else{A=32941;T=32965;S=12;C=12}M=0;P=I;while(1){if((M|0)>=(K|0))break;m=M<<1;v=n[T+m>>0]|0;b=P+(0-(v+D)<<2)|0;w=+tn(b,Y)+.001;f[Ge>>2]=w;m=(n[T+(m|1)>>0]|0)-v|0;g=1;while(1){if((g|0)>(m|0))break;U=+f[b+(Y-g<<2)>>2];B=+f[b+(0-g<<2)>>2];B=w-U*U+B*B;f[Ge+(g<<2)>>2]=B;w=B;g=g+1|0}b=te(M,S)|0;g=0;while(1){if((g|0)>=(C|0))break;m=(n[A+(b+g)>>0]|0)-v|0;_=0;while(1){if((_|0)==5)break;s[le+(M*680|0)+(g*20|0)+(_<<2)>>2]=s[Ge+(m+_<<2)>>2];_=_+1|0}g=g+1|0}M=M+1|0;P=P+(Y<<2)|0}O=.05000000074505806/+(E|0);if(F){S=33013;M=34;T=n[33173+V>>0]|0}else{S=32941;M=12;T=12}R=+tn(I,te(Y,K)|0)+1;m=0;w=-1e3;v=D;A=0;while(1){if((v|0)>(j|0))break;else{_=0;b=E}while(1){if((_|0)<(T|0)){k=0;y=R;g=0}else break;while(1){if((g|0)>=(K|0))break;k=k+ +f[ae+(g*680|0)+(_*20|0)+(A<<2)>>2];y=y+ +f[le+(g*680|0)+(_*20|0)+(A<<2)>>2];g=g+1|0}if(k>0)k=k*2/y*(1-O*+(_|0));else k=0;if(k>w){xe=(v+(n[33013+_>>0]|0)|0)<($|0);m=xe?_:m;w=xe?k:w;b=xe?v:b}_=_+1|0}v=v+1|0;A=A+1|0;E=b}g=(X|0)>($|0);v=0;while(1){if((v|0)>=(K|0))break;b=E+(n[S+((te(v,M)|0)+m)>>0]|0)|0;_=tt+228+(v<<2)|0;s[_>>2]=b;do if(g){if((b|0)>(X|0)){b=X;break}b=(b|0)<($|0)?$:b}else{if((b|0)>($|0)){b=$;break}b=(b|0)<(X|0)?X:b}while(0);s[_>>2]=b;v=v+1|0}b=E-X|0}else{b=0;while(1){if((b|0)>=(K|0))break;xe=T+(n[M+((te(b,C)|0)+m)>>0]|0)|0;s[tt+228+(b<<2)>>2]=(xe|0)>144?144:(xe|0)<16?16:xe;b=b+1|0}b=T+65520|0}r[Q>>1]=b;n[ee>>0]=m;b=1}while(0);if(b){n[ze>>0]=2;b=2;break}else{n[ze>>0]=1;b=1;break}}else at=264;while(0);if((at|0)==264){xe=tt+228|0;s[xe>>2]=0;s[xe+4>>2]=0;s[xe+8>>2]=0;s[xe+12>>2]=0;r[e+4854>>1]=0;n[e+4856>>0]=0;f[e+10152>>2]=0}A=$e+(0-(s[e+4692>>2]|0)<<2)|0;Me=e+4808|0;k=+(s[Me>>2]|0);w=k*.0078125;j=s[e+4788>>2]|0;y=+(j+(s[e+4792>>2]|0)|0)*.5*30517578125e-15;Re=tt+696|0;f[Re>>2]=y;N=1/(+J(+-((w+-20)*.25))+1);Ce=tt+700|0;f[Ce>>2]=N;if(!(s[e+4768>>2]|0)){B=1-+(s[e+4624>>2]|0)*.00390625;w=w-N*2*(y*.5+.5)*B*B}F=b<<24>>24==2;do if(!F){O=w+(k*-.4000000059604645*.0078125+6)*(1-y);m=s[We>>2]<<1;v=e+4672|0;b=s[v>>2]|0;E=((b<<16>>16)*5|0)/2|0;y=+(m|0);w=0;g=0;k=0;_=he;while(1){if((g|0)>=(E|0))break;R=+Hn(y+ +tn(_,m))*3.32192809488736;if((g|0)>0)w=w+ +H(+(R-k));g=g+1|0;k=R;_=_+(m<<2)|0}m=e+4858|0;if(w>+(E+-1|0)*.6000000238418579){n[m>>0]=0;xe=v;break}else{n[m>>0]=1;xe=v;break}}else{O=w+ +f[e+10152>>2]*2;n[e+4858>>0]=0;b=e+4672|0;xe=b;b=s[b>>2]|0}while(0);U=+f[oe>>2]*.0010000000474974513;U=.9399999976158142/(U*U+1);D=s[e+4764>>2]|0;R=+(D|0)*152587890625e-16+N*.009999999776482582;P=e+4696|0;Pe=e+4680|0;x=e+4728|0;N=R;L=1-R*R;I=0;E=A;while(1){if((I|0)>=(b|0))break;m=s[We>>2]|0;g=m*3|0;A=s[P>>2]|0;v=(A-g|0)/2|0;k=3.1415927410125732/+(v+1|0);y=2-k*k;w=0;_=0;while(1){if((_|0)>=(v|0))break;f[Ue+(_<<2)>>2]=+f[E+(_<<2)>>2]*.5*(w+k);Se=_|1;f[Ue+(Se<<2)>>2]=+f[E+(Se<<2)>>2]*k;B=y*k-w;Se=_|2;f[Ue+(Se<<2)>>2]=+f[E+(Se<<2)>>2]*.5*(k+B);Se=_|3;f[Ue+(Se<<2)>>2]=+f[E+(Se<<2)>>2]*B;w=B;k=y*B-k;_=_+4|0}Sr(Ue+(v<<2)|0,E+(v<<2)|0,m*12|0)|0;g=v+g|0;m=Ue+(g<<2)|0;g=E+(g<<2)|0;w=1;k=y*.5;_=0;while(1){if((_|0)>=(v|0))break;f[m+(_<<2)>>2]=+f[g+(_<<2)>>2]*.5*(w+k);Se=_|1;f[m+(Se<<2)>>2]=+f[g+(Se<<2)>>2]*k;B=y*k-w;Se=_|2;f[m+(Se<<2)>>2]=+f[g+(Se<<2)>>2]*.5*(k+B);Se=_|3;f[m+(Se<<2)>>2]=+f[g+(Se<<2)>>2]*B;w=B;k=y*B-k;_=_+4|0}E=E+(s[Pe>>2]<<2)|0;T=(D|0)>0;C=s[x>>2]|0;t:do if(T){yr(He|0,0,200)|0;yr(Ge|0,0,200)|0;g=He+(C<<3)|0;_=Ge+(C<<3)|0;w=0;v=0;while(1){if((v|0)>=(A|0)){m=0;break}m=0;k=+f[Ue+(v<<2)>>2];while(1){if((m|0)>=(C|0))break;Te=m|1;Ae=He+(Te<<3)|0;ft=+h[Ae>>3];B=w+N*(ft-k);h[He+(m<<3)>>3]=k;Se=Ge+(m<<3)|0;h[Se>>3]=+h[Se>>3]+ +h[He>>3]*k;Se=m+2|0;y=+h[He+(Se<<3)>>3];h[Ae>>3]=B;Te=Ge+(Te<<3)|0;h[Te>>3]=+h[Te>>3]+ +h[He>>3]*B;w=y;m=Se;k=ft+N*(y-B)}h[g>>3]=k;w=+h[He>>3];h[_>>3]=+h[_>>3]+w*k;v=v+1|0}while(1){if((m|0)>(C|0))break;f[Le+(m<<2)>>2]=+h[Ge+(m<<3)>>3];m=m+1|0}}else{m=(C|0)<(A|0)?C+1|0:A;g=0;while(1){if((g|0)>=(m|0))break t;f[Le+(g<<2)>>2]=+nn(Ue,Ue+(g<<2)|0,A-g|0);g=g+1|0}}while(0);ft=+f[Le>>2];f[Le>>2]=ft+(ft*29999999242136255e-21+1);m=0;while(1){if((m|0)>(C|0)){_=0;break}ft=+f[Le+(m<<2)>>2];h[He+(m<<4)+8>>3]=ft;h[He+(m<<4)>>3]=ft;m=m+1|0}t:while(1){if((C|0)<=(_|0))break;m=_+1|0;w=+h[fe>>3];w=-+h[He+(m<<4)>>3]/(w>9.999999717180685e-10?w:9.999999717180685e-10);f[ue+(_<<2)>>2]=w;g=C-_|0;v=0;while(1){if((v|0)>=(g|0)){_=m;continue t}Te=He+(v+_+1<<4)|0;ft=+h[Te>>3];Se=He+(v<<4)+8|0;B=+h[Se>>3];h[Te>>3]=ft+B*w;h[Se>>3]=B+ft*w;v=v+1|0}}w=+h[fe>>3];M=tt+244+(I*24<<2)|0;_=0;while(1){if((_|0)>=(C|0))break;k=+f[ue+(_<<2)>>2];m=_+1|0;g=m>>1;v=0;while(1){if((v|0)>=(g|0))break;Te=M+(v<<2)|0;ft=+f[Te>>2];Se=M+(_-v+-1<<2)|0;B=+f[Se>>2];f[Te>>2]=ft+B*k;f[Se>>2]=B+ft*k;v=v+1|0}f[M+(_<<2)>>2]=-k;_=m}k=+z(+w);m=tt+(I<<2)|0;f[m>>2]=k;S=C+-1|0;if(T){w=+f[M+(S<<2)>>2];g=C+-2|0;while(1){w=R*w;if((g|0)<=-1)break;w=+f[M+(g<<2)>>2]-w;g=g+-1|0}f[m>>2]=k*(1/(w+1));w=U;m=0}else{w=U;m=0}while(1){if((m|0)>=(S|0))break;Se=M+(m<<2)|0;f[Se>>2]=+f[Se>>2]*w;w=w*U;m=m+1|0}A=M+(S<<2)|0;w=+f[A>>2]*w;f[A>>2]=w;t:do if(T){m=C;while(1){if((m|0)<=1)break;Se=M+(m+-2<<2)|0;ft=+f[Se>>2]-w*R;f[Se>>2]=ft;w=ft;m=m+-1|0}w=L/(+f[M>>2]*R+1);m=0;while(1){if((m|0)>=(C|0)){m=0;v=0;break}Se=M+(m<<2)|0;f[Se>>2]=+f[Se>>2]*w;m=m+1|0}while(1){if((v|0)<10){g=0;_=m;k=-1}else break t;while(1){if((g|0)>=(C|0))break;ft=+H(+ +f[M+(g<<2)>>2]);Se=ft>k;Te=Se?g:_;g=g+1|0;_=Te;k=Se?ft:k}if(!(k<=3.999000072479248))m=1;else break t;while(1){if((m|0)>=(C|0))break;Se=M+(m+-1<<2)|0;f[Se>>2]=+f[Se>>2]+ +f[M+(m<<2)>>2]*R;m=m+1|0}w=1/w;m=0;while(1){if((m|0)>=(C|0))break;Se=M+(m<<2)|0;f[Se>>2]=+f[Se>>2]*w;m=m+1|0}w=.9900000095367432-(+(v|0)*.10000000149011612+.800000011920929)*(k+-3.999000072479248)/(k*+(_+1|0));k=w;m=0;while(1){if((m|0)>=(S|0))break;Se=M+(m<<2)|0;f[Se>>2]=+f[Se>>2]*k;k=k*w;m=m+1|0}w=+f[A>>2]*k;f[A>>2]=w;m=C;while(1){if((m|0)<=1)break;Se=M+(m+-2<<2)|0;ft=+f[Se>>2]-w*R;f[Se>>2]=ft;w=ft;m=m+-1|0}w=L/(+f[M>>2]*R+1);m=0;while(1){if((m|0)>=(C|0))break;Se=M+(m<<2)|0;f[Se>>2]=+f[Se>>2]*w;m=m+1|0}m=_;v=v+1|0}}else{m=0;_=0;while(1){if((_|0)<10){g=0;w=-1}else break t;while(1){if((g|0)>=(C|0))break;ft=+H(+ +f[M+(g<<2)>>2]);Se=ft>w;Te=Se?g:m;g=g+1|0;m=Te;w=Se?ft:w}if(w<=3.999000072479248)break t;w=.9900000095367432-(+(_|0)*.10000000149011612+.800000011920929)*(w+-3.999000072479248)/(w*+(m+1|0));k=w;g=0;while(1){if((g|0)>=(S|0))break;Se=M+(g<<2)|0;f[Se>>2]=+f[Se>>2]*k;k=k*w;g=g+1|0}f[A>>2]=+f[A>>2]*k;_=_+1|0}}while(0);I=I+1|0}w=+wt(+(O*-.1599999964237213));m=0;while(1){if((m|0)>=(b|0))break;Se=tt+(m<<2)|0;f[Se>>2]=+f[Se>>2]*w+1.2483305931091309;m=m+1|0}Se=e+4624|0;w=+(s[Se>>2]|0);k=((+(j|0)*30517578125e-15+-1)*.5+1)*4*(w*.00390625);t:do if(F){m=0;while(1){if((m|0)>=(b|0))break;ft=.20000000298023224/+(s[We>>2]|0)+3/+(s[tt+228+(m<<2)>>2]|0);f[tt+628+(m<<2)>>2]=ft+-1;f[tt+644+(m<<2)>>2]=1-ft-ft*k;m=m+1|0}k=-.25-w*.26249998807907104*.00390625}else{ft=1.2999999523162842/+(s[We>>2]|0);g=tt+628|0;f[g>>2]=ft+-1;_=tt+644|0;f[_>>2]=1-ft-ft*k*.6000000238418579;m=1;while(1){if((m|0)>=(b|0)){k=-.25;break t}s[tt+628+(m<<2)>>2]=s[g>>2];s[tt+644+(m<<2)>>2]=s[_>>2];m=m+1|0}}while(0);if(F)w=((1-(1-+f[Ce>>2])*+f[Re>>2])*.20000000298023224+.30000001192092896)*+z(+ +f[e+10152>>2]);else w=0;m=e+7264|0;g=e+7268|0;_=0;while(1){if((_|0)>=(b|0))break;ft=+f[m>>2];ft=ft+(w-ft)*.4000000059604645;f[m>>2]=ft;f[tt+676+(_<<2)>>2]=ft;ft=+f[g>>2];ft=ft+(k-ft)*.4000000059604645;f[g>>2]=ft;f[tt+660+(_<<2)>>2]=ft;_=_+1|0}m=0;while(1){if((m|0)>=(b|0))break;f[Fe+(m<<2)>>2]=1/+f[tt+(m<<2)>>2];m=m+1|0}if(F){C=s[Pe>>2]|0;P=C+5|0;A=he;T=ue;S=0;M=ce;while(1){if((S|0)>=(b|0))break;_=A+(-2-(s[tt+228+(S<<2)>>2]|0)<<2)|0;m=_+16|0;w=+tn(m,C);f[T>>2]=w;g=1;while(1){if((g|0)==5)break;B=+f[m+(0-g<<2)>>2];ft=+f[m+(C-g<<2)>>2];ft=w+(B*B-ft*ft);f[T+(g*6<<2)>>2]=ft;w=ft;g=g+1|0}E=1;v=_+12|0;while(1){if((E|0)==5){g=0;break}w=+nn(m,v,C);ft=w;f[T+(E*5<<2)>>2]=ft;f[T+(E<<2)>>2]=ft;g=5-E|0;_=1;while(1){if((_|0)>=(g|0))break;Ae=0-_|0;Te=C-_|0;ft=w+(+f[m+(Ae<<2)>>2]*+f[v+(Ae<<2)>>2]-+f[m+(Te<<2)>>2]*+f[v+(Te<<2)>>2]);B=ft;Te=E+_|0;f[T+((Te*5|0)+_<<2)>>2]=B;f[T+((_*5|0)+Te<<2)>>2]=B;w=ft;_=_+1|0}E=E+1|0;v=v+-4|0}while(1){if((g|0)==5)break;f[M+(g<<2)>>2]=+nn(m,A,C);g=g+1|0;m=m+-4|0}ft=+tn(A,P);w=(+f[T>>2]+ +f[T+96>>2])*.014999999664723873+1;w=1/(ft>w?ft:w);m=0;while(1){if((m|0)>=24){m=24;break}Te=T+(m<<2)|0;f[Te>>2]=+f[Te>>2]*w;Te=T+((m|1)<<2)|0;f[Te>>2]=+f[Te>>2]*w;Te=T+((m|2)<<2)|0;f[Te>>2]=+f[Te>>2]*w;Te=T+((m|3)<<2)|0;f[Te>>2]=+f[Te>>2]*w;m=m+4|0}while(1){if((m|0)==25){m=0;break}Te=T+(m<<2)|0;f[Te>>2]=+f[Te>>2]*w;m=m+1|0}while(1){if((m|0)>=4){m=4;break}Te=M+(m<<2)|0;f[Te>>2]=+f[Te>>2]*w;Te=M+((m|1)<<2)|0;f[Te>>2]=+f[Te>>2]*w;Te=M+((m|2)<<2)|0;f[Te>>2]=+f[Te>>2]*w;Te=M+((m|3)<<2)|0;f[Te>>2]=+f[Te>>2]*w;m=m+4|0}while(1){if((m|0)==5)break;Te=M+(m<<2)|0;f[Te>>2]=+f[Te>>2]*w;m=m+1|0}A=A+(C<<2)|0;T=T+100|0;S=S+1|0;M=M+20|0}ke=e+4832|0;Te=e+4748|0;_=s[Pe>>2]|0;Ee=s[xe>>2]|0;m=Ee*25|0;g=0;while(1){if((g|0)>=(m|0))break;w=+f[ue+(g<<2)>>2]*131072;b=(f[d>>2]=w,s[d>>2]|0);if((b&2130706432)>>>0<=1249902592){b=(b|0)<0;w=b?w+-8388608+8388608:w+8388608+-8388608;if(w==0)w=b?-0:0}s[Ue+(g<<2)>>2]=~~w;g=g+1|0}ve=e+4860|0;Ae=tt+708|0;ye=Ee*5|0;m=0;while(1){if((m|0)>=(ye|0))break;w=+f[ce+(m<<2)>>2]*131072;b=(f[d>>2]=w,s[d>>2]|0);if((b&2130706432)>>>0<=1249902592){b=(b|0)<0;w=b?w+-8388608+8388608:w+8388608+-8388608;if(w==0)w=b?-0:0}s[Le+(m<<2)>>2]=~~w;m=m+1|0}me=_<<16>>16;_e=0;b=0;ge=0;m=2147483647;E=0;while(1){if((ge|0)==3)break;ce=s[17388+(ge<<2)>>2]|0;de=s[17400+(ge<<2)>>2]|0;pe=s[17412+(ge<<2)>>2]|0;be=n[29888+ge>>0]|0;we=Ue;S=b;he=0;T=0;E=0;b=s[Te>>2]|0;ue=Le;while(1){if((he|0)>=(Ee|0))break;fe=5333-b|0;g=fe+896|0;if((fe|0)>=-896)if((g|0)>3966)g=2147483647;else{_=g>>7;A=1<<_;v=g&127;if((g|0)<2048)g=v+((te(te(v,128-v|0)|0,-174)|0)>>16)<<_>>7;else g=te(A>>7,v+((te(te(v,128-v|0)|0,-174)|0)>>16)|0)|0;g=A+g|0}else g=0;x=g+-51|0;I=He+he|0;D=s[ue>>2]<<7;j=s[ue+4>>2]<<7;F=s[ue+8>>2]<<7;G=s[ue+12>>2]<<7;oe=0-(s[ue+16>>2]<<7)|0;n[I>>0]=0;q=we+4|0;W=we+8|0;V=we+12|0;Y=we+16|0;Z=we+28|0;$=we+32|0;K=we+36|0;X=we+24|0;Q=we+52|0;ee=we+56|0;ie=we+48|0;re=we+76|0;se=we+72|0;oe=oe<<1;ae=we+96|0;le=de;fe=S;C=0;P=2147483647;M=2147483647;while(1){if((C|0)>=(be|0))break;v=o[pe+C>>0]|0;ht=n[le+1>>0]|0;S=(te(s[q>>2]|0,ht)|0)-D|0;_=n[le+2>>0]|0;S=S+(te(s[W>>2]|0,_)|0)|0;A=n[le+3>>0]|0;S=S+(te(s[V>>2]|0,A)|0)|0;g=n[le+4>>0]|0;S=S+(te(s[Y>>2]|0,g)|0)<<1;ut=n[le>>0]|0;S=S+(te(s[we>>2]|0,ut)|0)|0;ut=(te(S>>16,ut)|0)+((te(S&65535,ut)|0)>>16)+32801|0;S=(te(s[Z>>2]|0,_)|0)-j|0;S=S+(te(s[$>>2]|0,A)|0)|0;S=S+(te(s[K>>2]|0,g)|0)<<1;S=S+(te(s[X>>2]|0,ht)|0)|0;ht=ut+((te(S>>16,ht)|0)+((te(S&65535,ht)|0)>>16))|0;S=(te(s[Q>>2]|0,A)|0)-F|0;S=S+(te(s[ee>>2]|0,g)|0)<<1;S=S+(te(s[ie>>2]|0,_)|0)|0;_=ht+((te(S>>16,_)|0)+((te(S&65535,_)|0)>>16))|0;S=(te(s[re>>2]|0,g)|0)-G<<1;S=S+(te(s[se>>2]|0,A)|0)|0;A=_+((te(S>>16,A)|0)+((te(S&65535,A)|0)>>16))|0;S=oe+(te(s[ae>>2]|0,g)|0)|0;g=A+((te(S>>16,g)|0)+((te(S&65535,g)|0)>>16))|0;do if((g|0)>-1){g=g+((v|0)>(x|0)?v-x<<11:0)|0;S=ne(g|0)|0;_=24-S|0;A=0-_|0;do if(_)if((_|0)<0){_=g<>>(_+32|0);break}else{_=g<<32-_|g>>>_;break}else _=g;while(0);_=_&127;_=te(me,(_+(((te(_,128-_|0)|0)*179|0)>>>16)+(31-S<<7)<<16)+-125829120>>16)|0;_=_+(o[ce+C>>0]<<2)|0;if((_|0)>(P|0)){v=fe;_=P;g=M;break}n[I>>0]=C}else{v=fe;_=P;g=M}while(0);le=le+5|0;fe=v;C=C+1|0;P=_;M=g}E=E+M|0;E=(E|0)<0?2147483647:E;T=T+P|0;T=(T|0)<0?2147483647:T;g=fe+51|0;A=ne(g|0)|0;_=24-A|0;v=0-_|0;do if(_)if((_|0)<0){_=g<>>(_+32|0);break}else{_=g<<32-_|g>>>_;break}else _=g;while(0);ut=_&127;if((b+(ut+(((te(ut,128-ut|0)|0)*179|0)>>>16)+(31-A<<7))|0)<896)b=0;else{A=ne(g|0)|0;_=24-A|0;v=0-_|0;do if(_)if((_|0)<0){g=g<>>(_+32|0);break}else{g=g<<32-_|g>>>_;break}while(0);ut=g&127;b=b+(ut+(((te(ut,128-ut|0)|0)*179|0)>>>16)+(31-A<<7))+-896|0}we=we+100|0;S=fe;he=he+1|0;ue=ue+20|0}if((T|0)>(m|0))b=_e;else{n[ve>>0]=ge;Sr(ke|0,He|0,Ee|0)|0;m=T}_e=b;b=S;ge=ge+1|0}b=s[17400+(n[ve>>0]<<2)>>2]|0;_=0;while(1){if((_|0)>=(Ee|0))break;m=e+4832+_|0;g=_*5|0;v=0;while(1){if((v|0)==5)break;r[Ge+(g+v<<1)>>1]=n[b+(((n[m>>0]|0)*5|0)+v)>>0]<<7;v=v+1|0}_=_+1|0}b=E>>((Ee|0)==2?1:2);s[Te>>2]=_e;_=ne(b|0)|0;m=24-_|0;g=0-m|0;do if(m)if((m|0)<0){b=b<>>(m+32|0);break}else{b=b<<32-m|b>>>m;break}while(0);b=b&127;b=(b+(((te(b,128-b|0)|0)*179|0)>>>16)+(31-_<<7)<<16)+-125829120>>16;m=0;while(1){if((m|0)>=(ye|0))break;f[tt+144+(m<<2)>>2]=+(r[Ge+(m<<1)>>1]|0)*6103515625e-14;m=m+1|0}w=+(te(b,-3)|0)*.0078125;f[Ae>>2]=w;if(!l){w=+((s[e+4708>>2]|0)+(s[e+5836>>2]|0)|0)*w*.10000000149011612;if(!(w>2)){if(w<0)w=0}else w=2;b=~~w;n[e+4861>>0]=b}else{n[e+4861>>0]=0;b=0}f[tt+224>>2]=+(r[25412+(b<<24>>24<<1)>>1]|0)*6103515625e-14;M=s[e+4732>>2]|0;v=s[Pe>>2]|0;E=s[xe>>2]|0;A=v+M|0;T=Be;S=0;M=$e+(0-M<<2)|0;while(1){if((S|0)>=(E|0))break;g=0-(s[tt+228+(S<<2)>>2]|0)|0;k=+f[Fe+(S<<2)>>2];b=S*5|0;m=0;while(1){if((m|0)==5)break;s[He+(m<<2)>>2]=s[tt+144+(b+m<<2)>>2];m=m+1|0}_=0;g=M+(g<<2)|0;while(1){if((_|0)>=(A|0))break;m=s[M+(_<<2)>>2]|0;b=T+(_<<2)|0;s[b>>2]=m;w=(s[d>>2]=m,+f[d>>2]);m=0;while(1){if((m|0)==5)break;ft=w-+f[He+(m<<2)>>2]*+f[g+(2-m<<2)>>2];f[b>>2]=ft;w=ft;m=m+1|0}f[b>>2]=w*k;_=_+1|0;g=g+4|0}T=T+(A<<2)|0;S=S+1|0;M=M+(v<<2)|0}}else{T=e+4732|0;A=s[T>>2]|0;m=A;v=0;E=Be;A=$e+(0-A<<2)|0;while(1){if((v|0)>=(b|0))break;w=+f[Fe+(v<<2)>>2];b=s[Pe>>2]|0;_=b+m|0;g=_&65532;b=m+b&65532;m=0;while(1){if((m|0)>=(g|0))break;f[E+(m<<2)>>2]=+f[A+(m<<2)>>2]*w;ut=m|1;f[E+(ut<<2)>>2]=+f[A+(ut<<2)>>2]*w;ut=m|2;f[E+(ut<<2)>>2]=+f[A+(ut<<2)>>2]*w;ut=m|3;f[E+(ut<<2)>>2]=+f[A+(ut<<2)>>2]*w;m=m+4|0}while(1){if((b|0)>=(_|0))break;f[E+(b<<2)>>2]=+f[A+(b<<2)>>2]*w;b=b+1|0}ut=s[Pe>>2]|0;ht=s[T>>2]|0;b=s[xe>>2]|0;m=ht;v=v+1|0;E=E+(ut+ht<<2)|0;A=A+(ut<<2)|0}yr(tt+144|0,0,b*20|0)|0;f[tt+708>>2]=0;s[e+4748>>2]=0}b=e+4756|0;if(!(s[b>>2]|0)){k=+wt(+(+f[tt+708>>2]/3))/1e4;k=k/(+f[Ce>>2]*.75+.25)}else k=.009999999776482582;S=e+4732|0;A=s[S>>2]|0;E=(s[Pe>>2]|0)+A|0;T=e+4859|0;n[T>>0]=4;w=+Ln(Ie,Be,k,E,s[xe>>2]|0,A);A=e+4724|0;t:do if((s[A>>2]|0?(s[b>>2]|0)==0:0)?(s[xe>>2]|0)==4:0){v=E<<1;w=w-+Ln(Ne,Be+(v<<2)|0,k,E,2,s[S>>2]|0);Qi(je,Ne,s[S>>2]|0);_=3;y=3.4028234663852886e38;while(1){if((_|0)<=-1)break t;g=s[S>>2]|0;b=_<<16>>16;m=0;while(1){if((m|0)>=(g|0))break;ut=a[e+4592+(m<<1)>>1]|0;r[Le+(m<<1)>>1]=ut+((te((a[je+(m<<1)>>1]|0)-ut<<16>>16,b)|0)>>>2);m=m+1|0}Pn(Ue,Le,g);b=0;while(1){if((b|0)>=(g|0))break;f[Ne+(b<<2)>>2]=+(r[Ue+(b<<1)>>1]|0)*.000244140625;b=b+1|0}Ji(Oe,Ne,Be,v,s[S>>2]|0);ut=s[S>>2]|0;ht=Oe+(ut<<2)|0;ut=E-ut|0;k=+tn(ht,ut);k=k+ +tn(ht+(E<<2)|0,ut);if(!(ky)break t}else{n[T>>0]=_;w=k}_=_+-1|0;y=k}}while(0);if((n[T>>0]|0)==4)Qi(je,Ie,s[S>>2]|0);_=s[Se>>2]<<16>>16;_=(te(_,-5)|0)+(_*59246>>16)+3146|0;_=_+((s[xe>>2]|0)==2?_>>1:0)|0;In(Le,je,s[S>>2]|0);t:do if((s[A>>2]|0)==1?(De=n[T>>0]|0,De<<24>>24<4):0){b=De<<24>>24;m=s[S>>2]|0;g=0;while(1){if((g|0)>=(m|0))break;ut=a[e+4592+(g<<1)>>1]|0;r[Ue+(g<<1)>>1]=ut+((te((a[je+(g<<1)>>1]|0)-ut<<16>>16,b)|0)>>>2);g=g+1|0}In(He,Ue,m);m=n[T>>0]|0;m=(te(m,m)|0)<<27;b=s[S>>2]|0;m=m>>16;g=0;while(1){if((g|0)>=(b|0)){m=1;break t}ut=Le+(g<<1)|0;r[ut>>1]=((r[ut>>1]|0)>>>1)+((te(r[He+(g<<1)>>1]|0,m)|0)>>>16);g=g+1|0}}else m=0;while(0);jn(e+4836|0,je,s[e+4784>>2]|0,Le,_,s[e+4752>>2]|0,n[ze>>0]|0);b=Ge+32|0;Pn(b,je,s[S>>2]|0);if(m){b=n[T>>0]|0;m=s[S>>2]|0;g=0;while(1){if((g|0)>=(m|0))break;ut=a[e+4592+(g<<1)>>1]|0;r[Ue+(g<<1)>>1]=ut+((te((a[je+(g<<1)>>1]|0)-ut<<16>>16,b)|0)>>>2);g=g+1|0}Pn(Ge,Ue,m)}else Sr(Ge|0,b|0,s[S>>2]<<1|0)|0;g=0;while(1){if((g|0)==2)break;b=s[S>>2]|0;m=0;while(1){if((m|0)>=(b|0))break;f[tt+16+(g<<6)+(m<<2)>>2]=+(r[Ge+(g<<5)+(m<<1)>>1]|0)*.000244140625;m=m+1|0}g=g+1|0}v=s[Pe>>2]|0;ut=s[xe>>2]|0;b=s[S>>2]|0;m=He+(b<<2)|0;_=b+v|0;g=_<<1;Ji(He,tt+16|0,Be,g,b);ft=+f[tt>>2];f[tt+712>>2]=ft*ft*+tn(m,v);ft=+f[tt+4>>2];_=m+(_<<2)|0;f[tt+716>>2]=ft*ft*+tn(_,v);if((ut|0)==4){Ji(He,tt+80|0,Be+(g<<2)|0,g,b);ft=+f[tt+8>>2];f[tt+720>>2]=ft*ft*+tn(m,v);ft=+f[tt+12>>2];f[tt+724>>2]=ft*ft*+tn(_,v)}E=e+4592|0;b=je;v=E+32|0;do{r[E>>1]=r[b>>1]|0;E=E+2|0;b=b+2|0}while((E|0)<(v|0));t:do if((n[ze>>0]|0)==2){w=1-1/(+J(+-((+f[tt+708>>2]+-12)*.25))+1)*.5;b=s[xe>>2]|0;m=0;while(1){if((m|0)>=(b|0)){m=b;break t}ut=tt+(m<<2)|0;f[ut>>2]=+f[ut>>2]*w;m=m+1|0}}else m=s[xe>>2]|0;while(0);w=+wt(+((21-+(s[Me>>2]|0)*.0078125)*.33000001311302185));w=w/+(s[Pe>>2]|0);b=0;while(1){if((b|0)>=(m|0)){b=0;break}ut=tt+(b<<2)|0;ft=+f[ut>>2];ft=+z(+(ft*ft+ +f[tt+712+(b<<2)>>2]*w));f[ut>>2]=ft<32767?ft:32767;b=b+1|0}while(1){if((b|0)>=(m|0))break;s[Ge+(b<<2)>>2]=~~(+f[tt+(b<<2)>>2]*65536);b=b+1|0}Sr(tt+728|0,Ge|0,m<<2|0)|0;b=e+7260|0;ue=tt+744|0;n[ue>>0]=n[b>>0]|0;ce=e+4828|0;de=(l|0)==2;pe=de&1;wn(ce,Ge,b,pe,m);b=s[xe>>2]|0;m=0;while(1){if((m|0)>=(b|0))break;f[tt+(m<<2)>>2]=+(s[Ge+(m<<2)>>2]|0)*152587890625e-16;m=m+1|0}g=n[ze>>0]|0;do if(g<<24>>24==2){m=e+4858|0;if(+f[tt+708>>2]+ +(s[e+4804>>2]|0)*30517578125e-15>1){n[m>>0]=0;he=m;m=0;break}else{n[m>>0]=1;he=m;m=1;break}}else{m=e+4858|0;he=m;m=n[m>>0]|0}while(0);ut=s[Se>>2]|0;fe=tt+692|0;f[fe>>2]=+(s[e+4720>>2]|0)*-.05000000074505806+1.2000000476837158+ +(ut|0)*-.20000000298023224*.00390625+ +f[Re>>2]*-.10000000149011612+ +f[Ce>>2]*-.20000000298023224+ +(r[25404+(g<<24>>24>>1<<2)+(m<<24>>24<<1)>>1]|0)*.0009765625*.800000011920929;le=e+5840|0;m=s[le>>2]|0;_=e+6192+(m*36|0)|0;if((s[e+6184>>2]|0)!=0&(ut|0)>77){s[e+4816+(m<<2)>>2]=1;Sr(He|0,e+144|0,4448)|0;E=_;b=ce;v=E+36|0;do{r[E>>1]=r[b>>1]|0;E=E+2|0;b=b+2|0}while((E|0)<(v|0));g=s[xe>>2]|0;Sr(Fe|0,tt|0,g<<2|0)|0;b=s[le>>2]|0;do if(!b)at=544;else{if(!(s[e+4816+(b+-1<<2)>>2]|0)){at=544;break}m=e+4632|0;b=g}while(0);if((at|0)==544){m=e+4632|0;n[m>>0]=n[e+7260>>0]|0;b=(o[_>>0]|0)+(s[e+6188>>2]|0)|0;n[_>>0]=(b&255)<<24>>24<63?b&255:63;b=s[xe>>2]|0}mn(Ge,_,m,pe,b);b=s[xe>>2]|0;m=0;while(1){if((m|0)>=(b|0))break;f[tt+(m<<2)>>2]=+(s[Ge+(m<<2)>>2]|0)*152587890625e-16;m=m+1|0}en(e,tt,_,He,e+6300+((s[le>>2]|0)*320|0)|0,$e);b=s[xe>>2]|0;Sr(tt|0,Fe|0,b<<2|0)|0}g=0;m=0;while(1){if((m|0)>=(b|0))break;g=(n[e+4828+m>>0]|0)+(g<<8)|0;m=m+1|0}E=rt;b=i;v=E+48|0;do{s[E>>2]=s[b>>2];E=E+4|0;b=b+4|0}while((E|0)<(v|0));V=e+144|0;Sr(it|0,V|0,4448)|0;Y=n[Ye>>0]|0;Z=e+5864|0;$=r[Z>>1]|0;K=e+5860|0;X=s[K>>2]|0;Q=e+7260|0;ee=c+-5|0;ie=i+24|0;re=i+28|0;se=e+4828|0;oe=e+4864|0;ae=i+20|0;D=0;S=0;M=0;q=256;G=0;C=0;j=-1;T=-1;W=0;F=0;P=0;m=0;while(1){A=(g|0)==(j|0);do if(!A){if((g|0)==(T|0)){b=P;at=571;break}if((W|0)>0){E=i;b=rt;v=E+48|0;do{s[E>>2]=s[b>>2];E=E+4|0;b=b+4|0}while((E|0)<(v|0));Sr(V|0,it|0,4448)|0;n[Ye>>0]=Y;r[Z>>1]=$;s[K>>2]=X}en(e,tt,se,V,oe,$e);_=(W|0)==6;if(_&(S|0)==0){s[st>>2]=s[i>>2];s[st+4>>2]=s[i+4>>2];s[st+8>>2]=s[i+8>>2];s[st+12>>2]=s[i+12>>2];s[st+16>>2]=s[i+16>>2];s[st+20>>2]=s[i+20>>2];v=s[ie>>2]|0;s[ot>>2]=s[re>>2];s[ot+4>>2]=s[re+4>>2];s[ot+8>>2]=s[re+8>>2];s[ot+12>>2]=s[re+12>>2];s[ot+16>>2]=s[re+16>>2]}else v=m;Di(e,i,s[le>>2]|0,0,l);Li(i,n[ze>>0]|0,n[he>>0]|0,oe,s[Ve>>2]|0);b=(s[ae>>2]|0)+((ne(s[re>>2]|0)|0)+-32)|0;if(_&(S|0)==0&(b|0)>(c|0)){s[i>>2]=s[st>>2];s[i+4>>2]=s[st+4>>2];s[i+8>>2]=s[st+8>>2];s[i+12>>2]=s[st+12>>2];s[i+16>>2]=s[st+16>>2];s[i+20>>2]=s[st+20>>2];s[ie>>2]=v;s[re>>2]=s[ot>>2];s[re+4>>2]=s[ot+4>>2];s[re+8>>2]=s[ot+8>>2];s[re+12>>2]=s[ot+12>>2];s[re+16>>2]=s[ot+16>>2];b=n[ue>>0]|0;n[Q>>0]=b;m=0;while(1){if((m|0)>=(s[xe>>2]|0))break;n[e+4828+m>>0]=4;m=m+1|0}if(!de)n[ce>>0]=b;r[Z>>1]=$;s[K>>2]=X;b=0;while(1){if((b|0)>=(s[Ve>>2]|0))break;n[e+4864+b>>0]=0;b=b+1|0}Di(e,i,s[le>>2]|0,0,l);Li(i,n[ze>>0]|0,n[he>>0]|0,oe,s[Ve>>2]|0);b=(s[ae>>2]|0)+((ne(s[re>>2]|0)|0)+-32)|0}if(W|p|0){m=v;at=571;break}if((b|0)>(c|0))x=v;else break e}else{b=F;at=571}while(0);if((at|0)==571){at=0;if((W|0)==6)break;else x=m}I=(b|0)>(c|0);t:do if(I){if(S|0){M=1;A=G;C=q<<16>>16;E=j;T=g;v=F;P=b;break}if((W|0)>1){ft=+f[fe>>2]*1.5;f[fe>>2]=ft>1.5?ft:1.5;n[he>>0]=0;M=0;g=-1}else{M=1;C=q<<16>>16;P=b}v=s[xe>>2]|0;E=(W|0)==0;T=0;i:while(1){if((T|0)>=(v|0)){S=0;A=G;E=j;T=g;v=F;break t}_=s[Pe>>2]|0;A=T+1|0;m=te(A,_)|0;_=te(T,_)|0;S=0;while(1){if((_|0)>=(m|0))break;ht=n[e+4864+_>>0]|0;ut=ht<<24>>24;_=_+1|0;S=S+(ht<<24>>24>-1?ut:0-ut|0)|0}m=Xe+(T<<2)|0;do if(!E){_=Qe+(T<<2)|0;if((S|0)<(s[m>>2]|0)?(s[_>>2]|0)==0:0)break;s[_>>2]=1;T=A;continue i}while(0);s[m>>2]=S;r[Ke+(T<<1)>>1]=q;T=A}}else{if((b|0)>=(ee|0))break e;m=q<<16>>16;if(A){S=1;A=m;E=g;v=b;break}s[st>>2]=s[i>>2];s[st+4>>2]=s[i+4>>2];s[st+8>>2]=s[i+8>>2];s[st+12>>2]=s[i+12>>2];s[st+16>>2]=s[i+16>>2];s[st+20>>2]=s[i+20>>2];x=s[ie>>2]|0;s[ot>>2]=s[re>>2];s[ot+4>>2]=s[re+4>>2];s[ot+8>>2]=s[re+8>>2];s[ot+12>>2]=s[re+12>>2];s[ot+16>>2]=s[re+16>>2];Sr(Je|0,s[i>>2]|0,x|0)|0;Sr(nt|0,V|0,4448)|0;D=n[Q>>0]|0;S=1;A=m;E=g;v=b}while(0);do if(!(S&M)){if(I){if(q<<16>>16>=16384){_=32767;break}_=q<<16>>16<<1&65535;break}m=(b-c<<7|0)/(s[Ve>>2]|0)|0;b=m+2048|0;do if((m|0)<-2048)b=0;else{if((b|0)>3966){b=2147483647;break}g=b>>7;_=1<>16)<>7;else b=te(_>>7,b+((te(te(b,128-b|0)|0,-174)|0)>>16)|0)|0;b=_+b|0}while(0);_=q<<16>>16;_=(te(b>>16,_)|0)+((te(b&65535,_)|0)>>>16)&65535}else{_=C-A|0;m=A+((te(_,c-v|0)|0)/(P-v|0)|0)|0;g=m<<16>>16;_=_>>2;b=A+_|0;if((g|0)<=(b|0)){b=C-_|0;b=(g|0)<(b|0)?b:m}_=b&65535}while(0);b=s[xe>>2]|0;m=0;while(1){if((m|0)>=(b|0))break;if(!(s[Qe+(m<<2)>>2]|0))g=_;else g=r[Ke+(m<<1)>>1]|0;ht=s[tt+728+(m<<2)>>2]|0;ut=g<<16>>16;ut=(te(ht>>16,ut)|0)+((te(ht&65535,ut)|0)>>16)|0;s[et+(m<<2)>>2]=(ut|0)>8388607?2147483392:((ut|0)<-8388608?-8388608:ut)<<8;m=m+1|0}n[Q>>0]=n[ue>>0]|0;wn(ce,et,Q,pe,b);m=s[xe>>2]|0;g=0;b=0;while(1){if((b|0)>=(m|0)){b=0;break}g=(n[e+4828+b>>0]|0)+(g<<8)|0;b=b+1|0}while(1){if((b|0)>=(m|0))break;f[tt+(b<<2)>>2]=+(s[et+(b<<2)>>2]|0)*152587890625e-16;b=b+1|0}q=_;G=A;j=E;W=W+1|0;F=v;m=x}if((S|0)!=0&(A|(b|0)>(c|0))){s[i>>2]=s[st>>2];s[i+4>>2]=s[st+4>>2];s[i+8>>2]=s[st+8>>2];s[i+12>>2]=s[st+12>>2];s[i+16>>2]=s[st+16>>2];s[i+20>>2]=s[st+20>>2];s[ie>>2]=m;s[re>>2]=s[ot>>2];s[re+4>>2]=s[ot+4>>2];s[re+8>>2]=s[ot+8>>2];s[re+12>>2]=s[ot+12>>2];s[re+16>>2]=s[ot+16>>2];Sr(s[i>>2]|0,Je|0,m|0)|0;Sr(V|0,nt|0,4448)|0;n[Q>>0]=D}}while(0);Mr(e+7272|0,e+7272+(s[Ve>>2]<<2)|0,(s[Ze>>2]|0)+((s[We>>2]|0)*5|0)<<2|0)|0;if(s[qe>>2]|0){ut=0;s[t>>2]=ut;u=lt;return 0}s[e+4636>>2]=s[tt+228+((s[e+4672>>2]|0)+-1<<2)>>2];n[e+4633>>0]=n[e+4857>>0]|0;s[e+4756>>2]=0;ut=(s[i+20>>2]|0)+((ne(s[i+28>>2]|0)|0)+-32)+7>>3;s[t>>2]=ut;u=lt;return 0}function Ji(e,t,i,n,r){e=e|0;t=t|0;i=i|0;n=n|0;r=r|0;var s=0,o=0,a=0,l=0,h=0,u=0,c=0,d=0,p=0,b=0,w=0,m=0,g=0,_=0,v=0,k=0,y=0;switch(r|0){case 6:{s=t+4|0;o=t+8|0;a=t+12|0;l=t+16|0;h=t+20|0;u=6;while(1){if((u|0)>=(n|0))break;k=i+(u+-1<<2)|0;f[e+(u<<2)>>2]=+f[k+4>>2]-(+f[k>>2]*+f[t>>2]+ +f[k+-4>>2]*+f[s>>2]+ +f[k+-8>>2]*+f[o>>2]+ +f[k+-12>>2]*+f[a>>2]+ +f[k+-16>>2]*+f[l>>2]+ +f[k+-20>>2]*+f[h>>2]);u=u+1|0}i=r<<2;yr(e|0,0,i|0)|0;return}case 8:{s=t+4|0;o=t+8|0;a=t+12|0;l=t+16|0;h=t+20|0;u=t+24|0;c=t+28|0;d=8;while(1){if((d|0)>=(n|0))break;k=i+(d+-1<<2)|0;f[e+(d<<2)>>2]=+f[k+4>>2]-(+f[k>>2]*+f[t>>2]+ +f[k+-4>>2]*+f[s>>2]+ +f[k+-8>>2]*+f[o>>2]+ +f[k+-12>>2]*+f[a>>2]+ +f[k+-16>>2]*+f[l>>2]+ +f[k+-20>>2]*+f[h>>2]+ +f[k+-24>>2]*+f[u>>2]+ +f[k+-28>>2]*+f[c>>2]);d=d+1|0}i=r<<2;yr(e|0,0,i|0)|0;return}case 10:{s=t+4|0;o=t+8|0;a=t+12|0;l=t+16|0;h=t+20|0;u=t+24|0;c=t+28|0;d=t+32|0;p=t+36|0;b=10;while(1){if((b|0)>=(n|0))break;k=i+(b+-1<<2)|0;f[e+(b<<2)>>2]=+f[k+4>>2]-(+f[k>>2]*+f[t>>2]+ +f[k+-4>>2]*+f[s>>2]+ +f[k+-8>>2]*+f[o>>2]+ +f[k+-12>>2]*+f[a>>2]+ +f[k+-16>>2]*+f[l>>2]+ +f[k+-20>>2]*+f[h>>2]+ +f[k+-24>>2]*+f[u>>2]+ +f[k+-28>>2]*+f[c>>2]+ +f[k+-32>>2]*+f[d>>2]+ +f[k+-36>>2]*+f[p>>2]);b=b+1|0}i=r<<2;yr(e|0,0,i|0)|0;return}case 12:{s=t+4|0;o=t+8|0;a=t+12|0;l=t+16|0;h=t+20|0;u=t+24|0;c=t+28|0;d=t+32|0;p=t+36|0;b=t+40|0;w=t+44|0;m=12;while(1){if((m|0)>=(n|0))break;k=i+(m+-1<<2)|0;f[e+(m<<2)>>2]=+f[k+4>>2]-(+f[k>>2]*+f[t>>2]+ +f[k+-4>>2]*+f[s>>2]+ +f[k+-8>>2]*+f[o>>2]+ +f[k+-12>>2]*+f[a>>2]+ +f[k+-16>>2]*+f[l>>2]+ +f[k+-20>>2]*+f[h>>2]+ +f[k+-24>>2]*+f[u>>2]+ +f[k+-28>>2]*+f[c>>2]+ +f[k+-32>>2]*+f[d>>2]+ +f[k+-36>>2]*+f[p>>2]+ +f[k+-40>>2]*+f[b>>2]+ +f[k+-44>>2]*+f[w>>2]);m=m+1|0}i=r<<2;yr(e|0,0,i|0)|0;return}case 16:{s=t+4|0;o=t+8|0;d=t+12|0;p=t+16|0;b=t+20|0;w=t+24|0;m=t+28|0;g=t+32|0;_=t+36|0;v=t+40|0;a=t+44|0;l=t+48|0;h=t+52|0;u=t+56|0;c=t+60|0;k=16;while(1){if((k|0)>=(n|0))break;y=i+(k+-1<<2)|0;f[e+(k<<2)>>2]=+f[y+4>>2]-(+f[y>>2]*+f[t>>2]+ +f[y+-4>>2]*+f[s>>2]+ +f[y+-8>>2]*+f[o>>2]+ +f[y+-12>>2]*+f[d>>2]+ +f[y+-16>>2]*+f[p>>2]+ +f[y+-20>>2]*+f[b>>2]+ +f[y+-24>>2]*+f[w>>2]+ +f[y+-28>>2]*+f[m>>2]+ +f[y+-32>>2]*+f[g>>2]+ +f[y+-36>>2]*+f[_>>2]+ +f[y+-40>>2]*+f[v>>2]+ +f[y+-44>>2]*+f[a>>2]+ +f[y+-48>>2]*+f[l>>2]+ +f[y+-52>>2]*+f[h>>2]+ +f[y+-56>>2]*+f[u>>2]+ +f[y+-60>>2]*+f[c>>2]);k=k+1|0}y=r<<2;yr(e|0,0,y|0)|0;return}default:{y=r<<2;yr(e|0,0,y|0)|0;return}}}function Qi(e,t,i){e=e|0;t=t|0;i=i|0;var n=0,o=0,l=0,h=0,c=0,p=0,b=0,w=0,m=0,g=0,_=0,v=0,k=0,y=0,E=0,A=0,T=0,S=0,M=0,R=0,C=0,P=0,x=0,I=0,O=0,N=0,D=0,L=0,U=0,B=0,j=0,F=0,G=0,H=0,z=0,q=0,W=0;W=u;u=u+176|0;F=W+124|0;H=W+72|0;G=W+64|0;z=W;o=0;while(1){if((o|0)>=(i|0))break;l=+f[t+(o<<2)>>2]*65536;n=(f[d>>2]=l,s[d>>2]|0);if((n&2130706432)>>>0<=1249902592){n=(n|0)<0;l=n?l+-8388608+8388608:l+8388608+-8388608;if(l==0)l=n?-0:0}s[z+(o<<2)>>2]=~~l;o=o+1|0}s[G>>2]=F;s[G+4>>2]=H;U=i>>1;B=F+(U<<2)|0;s[B>>2]=65536;j=H+(U<<2)|0;s[j>>2]=65536;n=0;while(1){if((U|0)<=(n|0))break;L=s[z+(U-n+-1<<2)>>2]|0;D=s[z+(n+U<<2)>>2]|0;s[F+(n<<2)>>2]=0-L-D;s[H+(n<<2)>>2]=D-L;n=n+1|0}n=U;while(1){if((n|0)<=0){n=2;break}L=n+-1|0;D=F+(L<<2)|0;s[D>>2]=(s[D>>2]|0)-(s[F+(n<<2)>>2]|0);D=H+(L<<2)|0;s[D>>2]=(s[D>>2]|0)+(s[H+(n<<2)>>2]|0);n=L}while(1){if((n|0)>(U|0)){n=2;break}else o=U;while(1){if((o|0)<=(n|0))break;L=F+(o+-2<<2)|0;s[L>>2]=(s[L>>2]|0)-(s[F+(o<<2)>>2]|0);o=o+-1|0}L=F+(n+-2<<2)|0;s[L>>2]=(s[L>>2]|0)-(s[F+(n<<2)>>2]<<1);n=n+1|0}while(1){if((n|0)>(U|0))break;else o=U;while(1){if((o|0)<=(n|0))break;L=H+(o+-2<<2)|0;s[L>>2]=(s[L>>2]|0)-(s[H+(o<<2)>>2]|0); -o=o+-1|0}L=H+(n+-2<<2)|0;s[L>>2]=(s[L>>2]|0)-(s[H+(n<<2)>>2]<<1);n=n+1|0}n=s[B>>2]|0;L=(U|0)==8;e:do if(L)n=(s[F>>2]|0)+((s[F+4>>2]|0)+((s[F+8>>2]|0)+((s[F+12>>2]|0)+((s[F+16>>2]|0)+((s[F+20>>2]|0)+((s[F+24>>2]|0)+((s[F+28>>2]|0)+(n<<1)<<1)<<1)<<1)<<1)<<1)<<1)<<1)|0;else{t=U;while(1){o=t+-1|0;if((t|0)<=0)break e;t=o;n=(s[F+(o<<2)>>2]|0)+(n<<1)|0}}while(0);e:do if((n|0)<0){r[e>>1]=0;n=s[j>>2]|0;if(L){o=H;t=1;n=(s[H>>2]|0)+((s[H+4>>2]|0)+((s[H+8>>2]|0)+((s[H+12>>2]|0)+((s[H+16>>2]|0)+((s[H+20>>2]|0)+((s[H+24>>2]|0)+((s[H+28>>2]|0)+(n<<1)<<1)<<1)<<1)<<1)<<1)<<1)<<1)|0;break}else t=U;while(1){o=t+-1|0;if((t|0)<=0){o=H;t=1;break e}t=o;n=(s[H+(o<<2)>>2]|0)+(n<<1)|0}}else{o=F;t=0}while(0);y=F+28|0;E=F+24|0;A=F+20|0;T=F+16|0;S=F+12|0;M=F+8|0;R=F+4|0;C=H+28|0;P=H+24|0;x=H+20|0;I=H+16|0;O=H+12|0;N=H+8|0;D=H+4|0;k=0;e:while(1){p=1;h=0;c=8192;t:while(1){v=p;while(1){p=r[27508+(v<<1)>>1]|0;b=Tn(o,p,U)|0;if((n|0)<1){if((b|0)>=(h|0))break;if(!((n|0)<0|(b|0)>(0-h|0)))break}else if((b|0)<=(0-h|0))break;if((v|0)>127)break t;else{v=v+1|0;h=0;c=p;n=b}}h=(b|0)==0&1;g=-256;_=0;while(1){if((_|0)==3)break;w=c+p|0;w=(w>>1)+(w&1)|0;m=Tn(o,w,U)|0;if((n|0)<1)if((m&n|0)>-1){p=w;b=m}else q=42;else if((m|0)<1){p=w;b=m}else q=42;if((q|0)==42){q=0;g=g+(128>>>_)|0;c=w;n=m}_=_+1|0}o=n-b|0;if((((n|0)>0?n:0-n|0)|0)<65536)if((n|0)==(b|0))n=g;else n=g+(((n<<5)+(o>>1)|0)/(o|0)|0)|0;else n=g+((n|0)/(o>>5|0)|0)|0;n=(v<<8)+n|0;r[e+(t<<1)>>1]=(n|0)<32767?n:32767;n=t+1|0;if((n|0)>=(i|0)){q=77;break e}p=v;o=s[G+((n&1)<<2)>>2]|0;t=n;c=r[27508+(v+-1<<1)>>1]|0;n=1-(n&2)<<12}h=k+1|0;if((k|0)>15)break;Mn(z,i,65536-(1<>2]=65536;s[j>>2]=65536;n=0;while(1){if((U|0)<=(n|0)){n=U;break}k=s[z+(U-n+-1<<2)>>2]|0;v=s[z+(n+U<<2)>>2]|0;s[F+(n<<2)>>2]=0-k-v;s[H+(n<<2)>>2]=v-k;n=n+1|0}while(1){if((n|0)<=0){n=2;break}k=n+-1|0;v=F+(k<<2)|0;s[v>>2]=(s[v>>2]|0)-(s[F+(n<<2)>>2]|0);v=H+(k<<2)|0;s[v>>2]=(s[v>>2]|0)+(s[H+(n<<2)>>2]|0);n=k}while(1){if((n|0)>(U|0)){n=2;break}else o=U;while(1){if((o|0)<=(n|0))break;k=F+(o+-2<<2)|0;s[k>>2]=(s[k>>2]|0)-(s[F+(o<<2)>>2]|0);o=o+-1|0}k=F+(n+-2<<2)|0;s[k>>2]=(s[k>>2]|0)-(s[F+(n<<2)>>2]<<1);n=n+1|0}while(1){if((n|0)>(U|0))break;else o=U;while(1){if((o|0)<=(n|0))break;k=H+(o+-2<<2)|0;s[k>>2]=(s[k>>2]|0)-(s[H+(o<<2)>>2]|0);o=o+-1|0}k=H+(n+-2<<2)|0;s[k>>2]=(s[k>>2]|0)-(s[H+(n<<2)>>2]<<1);n=n+1|0}n=s[B>>2]|0;t:do if(L)n=(s[F>>2]|0)+((s[R>>2]|0)+((s[M>>2]|0)+((s[S>>2]|0)+((s[T>>2]|0)+((s[A>>2]|0)+((s[E>>2]|0)+((s[y>>2]|0)+(n<<1)<<1)<<1)<<1)<<1)<<1)<<1)<<1)|0;else{t=U;while(1){o=t+-1|0;if((t|0)<=0)break t;t=o;n=(s[F+(o<<2)>>2]|0)+(n<<1)|0}}while(0);if((n|0)>=0){k=h;o=F;t=0;continue}r[e>>1]=0;n=s[j>>2]|0;if(L){k=h;o=H;t=1;n=(s[H>>2]|0)+((s[D>>2]|0)+((s[N>>2]|0)+((s[O>>2]|0)+((s[I>>2]|0)+((s[x>>2]|0)+((s[P>>2]|0)+((s[C>>2]|0)+(n<<1)<<1)<<1)<<1)<<1)<<1)<<1)<<1)|0;continue}else t=U;while(1){o=t+-1|0;if((t|0)<=0){k=h;o=H;t=1;continue e}t=o;n=(s[H+(o<<2)>>2]|0)+(n<<1)|0}}if((q|0)==77){u=W;return}n=32768/(i+1|0)|0;r[e>>1]=n;o=1;while(1){if((o|0)>=(i|0))break;q=(n&65535)+(a[e>>1]|0)|0;r[e+(o<<1)>>1]=q;n=q;o=o+1|0}u=W;return}function en(e,t,i,o,a,l){e=e|0;t=t|0;i=i|0;o=o|0;a=a|0;l=l|0;var h=0,c=0,p=0,b=0,w=0,m=0,g=0,_=0,v=0,k=0,y=0,E=0,A=0,T=0,S=0,M=0,R=0,C=0,P=0;P=u;u=u+1008|0;C=P+360|0;E=P+48|0;M=P+296|0;S=P+256|0;y=P+64|0;T=P+32|0;R=P+16|0;A=P;k=s[e+4672>>2]|0;b=e+4728|0;_=0;while(1){if((_|0)>=(k|0)){w=0;break}w=s[b>>2]|0;m=_*24|0;v=0;while(1){if((v|0)>=(w|0))break;g=m+v|0;h=+f[t+244+(g<<2)>>2]*8192;c=(f[d>>2]=h,s[d>>2]|0);if((c&2130706432)>>>0<=1249902592){c=(c|0)<0;h=c?h+-8388608+8388608:h+8388608+-8388608;if(h==0)h=c?-0:0}r[y+(g<<1)>>1]=~~h;v=v+1|0}_=_+1|0}while(1){if((w|0)>=(k|0))break;h=+f[t+644+(w<<2)>>2]*16384;c=(f[d>>2]=h,s[d>>2]|0);if((c&2130706432)>>>0<=1249902592){c=(c|0)<0;h=c?h+-8388608+8388608:h+8388608+-8388608;if(h==0)h=c?-0:0}b=~~h<<16;h=+f[t+628+(w<<2)>>2]*16384;c=(f[d>>2]=h,s[d>>2]|0);if((c&2130706432)>>>0<=1249902592){c=(c|0)<0;h=c?h+-8388608+8388608:h+8388608+-8388608;if(h==0)h=c?-0:0}s[T+(w<<2)>>2]=b|~~h&65535;h=+f[t+660+(w<<2)>>2]*16384;c=(f[d>>2]=h,s[d>>2]|0);if((c&2130706432)>>>0<=1249902592){c=(c|0)<0;h=c?h+-8388608+8388608:h+8388608+-8388608;if(h==0)h=c?-0:0}s[R+(w<<2)>>2]=~~h;h=+f[t+676+(w<<2)>>2]*16384;c=(f[d>>2]=h,s[d>>2]|0);if((c&2130706432)>>>0<=1249902592){c=(c|0)<0;h=c?h+-8388608+8388608:h+8388608+-8388608;if(h==0)h=c?-0:0}s[A+(w<<2)>>2]=~~h;w=w+1|0}h=+f[t+692>>2]*1024;c=(f[d>>2]=h,s[d>>2]|0);if((c&2130706432)>>>0<=1249902592){c=(c|0)<0;h=c?h+-8388608+8388608:h+8388608+-8388608;if(h==0)h=c?-0:0}b=k*5|0;w=0;while(1){if((w|0)>=(b|0))break;p=+f[t+144+(w<<2)>>2]*16384;c=(f[d>>2]=p,s[d>>2]|0);if((c&2130706432)>>>0<=1249902592){c=(c|0)<0;p=c?p+-8388608+8388608:p+8388608+-8388608;if(p==0)p=c?-0:0}r[S+(w<<1)>>1]=~~p;w=w+1|0}_=~~h;b=e+4732|0;g=0;while(1){if((g|0)==2){b=0;break}w=s[b>>2]|0;m=0;while(1){if((m|0)>=(w|0))break;h=+f[t+16+(g<<6)+(m<<2)>>2]*4096;c=(f[d>>2]=h,s[d>>2]|0);if((c&2130706432)>>>0<=1249902592){c=(c|0)<0;h=c?h+-8388608+8388608:h+8388608+-8388608;if(h==0)h=c?-0:0}r[M+(g<<5)+(m<<1)>>1]=~~h;m=m+1|0}g=g+1|0}while(1){if((b|0)>=(k|0))break;h=+f[t+(b<<2)>>2]*65536;c=(f[d>>2]=h,s[d>>2]|0);if((c&2130706432)>>>0<=1249902592){c=(c|0)<0;h=c?h+-8388608+8388608:h+8388608+-8388608;if(h==0)h=c?-0:0}s[E+(b<<2)>>2]=~~h;b=b+1|0}if((n[i+29>>0]|0)==2)w=r[25412+(n[i+33>>0]<<1)>>1]|0;else w=0;b=s[e+4676>>2]|0;m=0;while(1){if((m|0)>=(b|0))break;h=+f[l+(m<<2)>>2];c=(f[d>>2]=h,s[d>>2]|0);if((c&2130706432)>>>0<=1249902592){c=(c|0)<0;h=c?h+-8388608+8388608:h+8388608+-8388608;if(h==0)h=c?-0:0}r[C+(m<<1)>>1]=~~h;m=m+1|0}if((s[e+4720>>2]|0)<=1?(s[e+4764>>2]|0)<=0:0){_n(e,o,i,C,a,M,S,y,A,R,T,E,t+228|0,_,w);u=P;return}vn(e,o,i,C,a,M,S,y,A,R,T,E,t+228|0,_,w);u=P;return}function tn(e,t){e=e|0;t=t|0;var i=0,n=0,r=0,s=0,o=0,a=0,l=0,h=0;r=t+-3|0;n=((r|0)>0?r:0)+3&-4;s=0;i=0;while(1){if((s|0)>=(r|0))break;h=+f[e+(s<<2)>>2];l=+f[e+((s|1)<<2)>>2];a=+f[e+((s|2)<<2)>>2];o=+f[e+((s|3)<<2)>>2];s=s+4|0;i=i+(h*h+l*l+a*a+o*o)}while(1){if((n|0)>=(t|0))break;h=+f[e+(n<<2)>>2];n=n+1|0;i=i+h*h}return+i}function nn(e,t,i){e=e|0;t=t|0;i=i|0;var n=0,r=0,s=0,o=0,a=0,l=0,h=0,u=0;s=i+-3|0;r=((s|0)>0?s:0)+3&-4;o=0;n=0;while(1){if((o|0)>=(s|0))break;u=o|1;h=o|2;l=o|3;a=n+(+f[e+(o<<2)>>2]*+f[t+(o<<2)>>2]+ +f[e+(u<<2)>>2]*+f[t+(u<<2)>>2]+ +f[e+(h<<2)>>2]*+f[t+(h<<2)>>2]+ +f[e+(l<<2)>>2]*+f[t+(l<<2)>>2]);o=o+4|0;n=a}while(1){if((r|0)>=(i|0))break;a=n+ +f[e+(r<<2)>>2]*+f[t+(r<<2)>>2];r=r+1|0;n=a}return+n}function rn(e,t,i,a,l,f,h,u){e=e|0;t=t|0;i=i|0;a=a|0;l=l|0;f=f|0;h=h|0;u=u|0;var c=0,d=0,p=0,b=0,w=0,m=0,g=0,_=0,v=0,k=0,y=0,E=0,A=0,T=0,S=0,M=0,R=0,C=0,P=0,x=0,I=0,O=0,N=0,D=0,L=0,U=0,B=0,j=0,F=0,G=0,H=0,z=0,q=0;if((f|0)==0|(t|0)<0){f=-1;return f|0}if(!t){f=-4;return f|0}q=n[e>>0]|0;do if(q<<24>>24>=0){if((q&96)==96){p=(q&8)==0?480:960;break}d=(q&255)>>>3&3;if((d|0)==3)p=2880;else p=(48e3<>>0)/100|0}else p=(48e3<<((q&255)>>>3&3)>>>0)/400|0;while(0);w=e+1|0;E=t+-1|0;e:do switch(q&3|0){case 0:{R=w;C=E;P=0;x=1;b=E;S=0;v=47;break}case 1:{if(!i)if(!(E&1)){N=(E|0)/2|0;r[f>>1]=N;I=w;O=2;D=0;v=61;break e}else{f=-4;return f|0}else{j=w;B=E;F=1;H=2;G=E;z=0;v=48}break}case 2:{if((t|0)<2){r[f>>1]=-1;f=-4;return f|0}d=n[w>>0]|0;do if((d&255)<252){p=1;d=d&255}else{if((t|0)>=3){p=2;d=(o[e+2>>0]<<2)+(d&255)&65535;break}r[f>>1]=-1;f=-4;return f|0}while(0);r[f>>1]=d;t=E-p|0;d=d<<16>>16;if((t|0)<(d|0)){f=-4;return f|0}else{R=w+p|0;C=t;P=0;x=2;b=t-d|0;S=0;v=47;break e}}default:{if((t|0)<2){f=-4;return f|0}d=e+2|0;_=n[w>>0]|0;M=_&63;if((M|0)==0|(te(p,M)|0)>>>0>5760){f=-4;return f|0}p=t+-2|0;if(_&64){w=0;while(1){if((p|0)<1){A=-4;v=74;break}g=d+1|0;m=n[d>>0]|0;if(m<<24>>24!=-1)break;d=g;p=p+-255|0;w=w+254|0}if((v|0)==74)return A|0;t=m&255;d=p+-1-t|0;if((d|0)<0){f=-4;return f|0}else{m=d;y=w+t|0}}else{g=d;m=p;y=0}v=(_&255)>>>7;k=v&255^1;if(v<<24>>24!=1){if(i|0){j=g;B=m;F=k;H=M;G=E;z=y;v=48;break e}b=(m|0)/(M|0)|0;if((te(b,M)|0)!=(m|0)){f=-4;return f|0}d=M+-1|0;p=b&65535;t=0;while(1){if((t|0)>=(d|0)){R=g;C=m;P=k;x=M;S=y;v=47;break e}r[f+(t<<1)>>1]=p;t=t+1|0}}v=M+-1|0;_=m;w=0;while(1){if((w|0)>=(v|0)){v=41;break}T=f+(w<<1)|0;if((_|0)<1){v=33;break}d=n[g>>0]|0;if((d&255)<252){d=d&255;r[T>>1]=d;p=1}else{if((_|0)<2){v=37;break}d=(o[g+1>>0]<<2)+(d&255)&65535;r[T>>1]=d;p=2}t=_-p|0;d=d<<16>>16;if((d|0)>(t|0)){A=-4;v=74;break}g=g+p|0;_=t;w=w+1|0;m=m-(p+d)|0}if((v|0)==33){r[T>>1]=-1;f=-4;return f|0}else if((v|0)==37){r[T>>1]=-1;f=-4;return f|0}else if((v|0)==41){if((m|0)<0)A=-4;else{R=g;C=_;P=k;x=M;b=m;S=y;v=47;break e}return A|0}else if((v|0)==74)return A|0}}while(0);if((v|0)==47)if(!i){I=R;O=x;N=b;D=S;v=61}else{j=R;B=C;F=P;H=x;G=b;z=S;v=48}e:do if((v|0)==48){c=f+(H<<1)+-2|0;if((B|0)<1){r[c>>1]=-1;f=-4;return f|0}d=n[j>>0]|0;do if((d&255)<252){U=d&255;r[c>>1]=U;t=1;c=U}else{if((B|0)>=2){U=(o[j+1>>0]<<2)+(d&255)&65535;r[c>>1]=U;t=2;c=U;break}r[c>>1]=-1;f=-4;return f|0}while(0);p=B-t|0;b=H+-1|0;w=f+(b<<1)|0;d=c<<16>>16;if((d|0)>(p|0)){f=-4;return f|0}c=j+t|0;if(!F){if((t+d|0)>(G|0))A=-4;else{L=H;U=z;break}return A|0}if((te(d,H)|0)>(p|0)){f=-4;return f|0}else d=0;while(1){if((d|0)>=(b|0)){L=H;U=z;break e}r[f+(d<<1)>>1]=r[w>>1]|0;d=d+1|0}}else if((v|0)==61)if((N|0)>1275){f=-4;return f|0}else{r[f+(O+-1<<1)>>1]=N;c=I;L=O;U=D;break}while(0);if(h|0)s[h>>2]=c-e;p=(l|0)==0;d=0;while(1){if((d|0)>=(L|0))break;if(!p)s[l+(d<<2)>>2]=c;c=c+(r[f+(d<<1)>>1]|0)|0;d=d+1|0}if(u|0)s[u>>2]=U+(c-e);if(!a){f=L;return f|0}n[a>>0]=q;f=L;return f|0}function sn(e,t,i,n,s,o,a,l,h,u){e=e|0;t=t|0;i=i|0;n=n|0;s=s|0;o=o|0;a=a|0;l=l|0;h=h|0;u=u|0;var c=0,d=0,p=0,b=0,w=0;w=te(t,l)|0;t=te(r[e+(a<<1)>>1]|0,l)|0;if((h|0)!=1){b=(w|0)/(h|0)|0;t=(t|0)<(b|0)?t:b}p=(u|0)==0;b=p?a:0;c=p?o:0;p=p?t:0;h=e+(c<<1)|0;t=r[h>>1]|0;o=te(t<<16>>16,l)|0;a=n;u=0;while(1){if((u|0)>=(te(t<<16>>16,l)|0))break;f[a>>2]=0;t=r[h>>1]|0;a=a+4|0;u=u+1|0}t=c;h=i+(o<<2)|0;e:while(1){if((t|0)>=(b|0))break;u=te(r[e+(t<<1)>>1]|0,l)|0;c=t+1|0;i=te(r[e+(c<<1)>>1]|0,l)|0;d=+J(+((+f[s+(t<<2)>>2]+ +f[17220+(t<<2)>>2])*.6931471805599453));o=a;t=u;u=h;while(1){h=u+4|0;a=o+4|0;f[o>>2]=+f[u>>2]*d;t=t+1|0;if((t|0)<(i|0)){o=a;u=h}else{t=c;continue e}}}yr(n+(p<<2)|0,0,w-p<<2|0)|0;return}function on(e,t,i,a,l,h,c,d,p,b,w,m,g,_,v,k,y,E,A,T,S,M){e=e|0;t=t|0;i=i|0;a=a|0;l=l|0;h=h|0;c=c|0;d=d|0;p=p|0;b=b|0;w=w|0;m=m|0;g=g|0;_=_|0;v=v|0;k=k|0;y=y|0;E=E|0;A=A|0;T=T|0;S=S|0;M=M|0;var R=0,C=0,P=0,x=0,I=0,O=0,N=0,D=0,L=0,U=0,B=0,j=0,F=0,G=0,H=0,z=0,q=0,W=0,V=0,Y=0,Z=0,$=0,K=0,X=0,J=0,Q=0,ee=0,ie=0,re=0,se=0,oe=0,ae=0,le=0,fe=0,he=0,ue=0,ce=0,de=0,pe=0,be=0,we=0,me=0,ge=0,_e=0,ve=0,ke=0,ye=0,Ee=0,Ae=0,Te=0,Se=0,Me=0,Re=0,Ce=0,Pe=0,xe=0,Ie=0,Oe=0,Ne=0,De=0,Le=0,Ue=0,Be=0,je=0,Fe=0,Ge=0;Fe=u;u=u+1520|0;Ne=Fe+192|0;Ue=Fe+24|0;Be=Fe;je=Fe+144|0;De=Fe+92|0;Le=Fe+40|0;Oe=Fe+244|0;Ce=s[t+32>>2]|0;Ie=h|0?2:1;C=(e|0)==0;if(C){Me=0;Re=1}else{Te=(h|0)!=0&(m|0)==0;Re=(S|0)>7;Me=TeℜRe=Te&Re}_e=(b|0)==0?1:1<>1]<>2]|0;b=r[Ce+(S+-1<<1)>>1]|0;R=b<>1]|0)-b<>2]=d;s[Ne+28>>2]=y;s[Ne>>2]=e;s[Ne+16>>2]=g;s[Ne+8>>2]=t;de=Ne+40|0;s[de>>2]=s[T>>2];s[Ne+20>>2]=w;s[Ne+44>>2]=M;s[Ne+4>>2]=Re&1;se=Ne+48|0;s[se>>2]=0;oe=Ne+12|0;ae=a+-1|0;le=(h|0)==0;fe=y+20|0;he=y+28|0;ue=Ne+32|0;ce=Ne+24|0;X=t+12|0;J=(1<<_e)+-1|0;Q=y+4|0;ee=y+8|0;ie=y+24|0;re=(_e|0)>1;K=i;M=0;R=1;while(1){if((K|0)>=(a|0))break;s[oe>>2]=K;z=(K|0)==(ae|0);q=Ce+(K<<1)|0;Z=r[q>>1]<>1]<>2]|0;S=32-(ne(W|0)|0)|0;W=W>>>(S+-16|0);$=(W>>>12)+-8|0;$=(s[fe>>2]<<3)-((S<<3)+($+(W>>>0>(s[5272+($<<2)>>2]|0)>>>0&1)))|0;W=k-((K|0)==(i|0)?0:$)|0;S=v-$|0;s[ue>>2]=S+-1;if((K|0)<(A|0)?(Pe=A-K|0,Pe=(s[p+(K<<2)>>2]|0)+((W|0)/(((Pe|0)>3?3:Pe)|0)|0)|0,xe=(S|0)<(Pe|0),!(((xe?S:Pe)|0)<16384&((xe?S:Pe)|0)<0)):0)V=((xe?S:Pe)|0)>16383?16383:xe?S:Pe;else V=0;if(Re?((r[q>>1]<=(r[ve>>1]<>2]|0;s[ce>>2]=B;H=(K|0)<(s[X>>2]|0);b=H?b:0;G=H?C:Ee;H=H?e:le?0:Ee;b=z?Me?b:0:b;if((M|0)!=0?(w|0)!=3|re|(B|0)<0:0){t=(r[Ce+(M<<1)>>1]<>1]<(S|0));S=S+Z|0;e=M+-1|0;while(1){R=e+1|0;if((r[Ce+(R<<1)>>1]<>0];R=R|o[c+(B+Ie+-1)>>0];if((C|0)<(e|0))C=C+1|0;else{C=S;I=R;break}}}else{t=-1;C=J;I=J}e:do if(m)if((K|0)==(g|0)){if(!Re){Se=31;break}S=Ce+(g<<1)|0;R=0;while(1){if((R|0)>=((r[S>>1]<>2]=(+f[Se>>2]+ +f[Te+(R<<2)>>2])*.5;R=R+1|0}}else{k=(V|0)/2|0;R=(t|0)==-1;S=R?0:Ee+(t<<2)|0;if(z){S=an(Ne,G,Z,k,_e,S,E,0,1,b,C)|0;C=R?0:Te+(t<<2)|0;R=0}else{S=an(Ne,G,Z,k,_e,S,E,Ee+(r[q>>1]<>1]<>1]<>2]=0;if(z)S=0;else S=Ee+(r[q>>1]<>2];F=+f[d+(K+(s[ye>>2]|0)<<2)>>2];N=(j>2]|0;m=s[Q>>2]|0;s[Ue>>2]=s[ee>>2];s[Ue+4>>2]=s[ee+4>>2];s[Ue+8>>2]=s[ee+8>>2];s[Ue+12>>2]=s[ee+12>>2];k=s[ie>>2]|0;s[Be>>2]=s[he>>2];s[Be+4>>2]=s[he+4>>2];s[Be+8>>2]=s[he+8>>2];s[Be+12>>2]=s[he+12>>2];s[Be+16>>2]=s[he+16>>2];S=De;R=Ne;C=S+52|0;do{s[S>>2]=s[R>>2];S=S+4|0;R=R+4|0}while((S|0)<(C|0));U=Z<<2;Sr(pe|0,G|0,U|0)|0;Sr(be|0,H|0,U|0)|0;s[se>>2]=-1;O=(t|0)==-1;if(z)S=0;else S=Ee+(r[q>>1]<=(Z|0)){S=0;P=0;break}N=x+ +f[pe+(S<<2)>>2]*+f[G+(S<<2)>>2];S=S+1|0;x=N}while(1){if((S|0)>=(Z|0))break;N=P+ +f[be+(S<<2)>>2]*+f[H+(S<<2)>>2];S=S+1|0;P=N}N=j*x+F*P;S=je;R=y;C=S+48|0;do{s[S>>2]=s[R>>2];S=S+4|0;R=R+4|0}while((S|0)<(C|0));S=Le;R=Ne;C=S+52|0;do{s[S>>2]=s[R>>2];S=S+4|0;R=R+4|0}while((S|0)<(C|0));Sr(we|0,G|0,U|0)|0;Sr(me|0,H|0,U|0)|0;if(!z)Sr(ge|0,Ee+(r[q>>1]<>2]=e;s[Q>>2]=m;s[ee>>2]=s[Ue>>2];s[ee+4>>2]=s[Ue+4>>2];s[ee+8>>2]=s[Ue+8>>2];s[ee+12>>2]=s[Ue+12>>2];s[ie>>2]=k;s[he>>2]=s[Be>>2];s[he+4>>2]=s[Be+4>>2];s[he+8>>2]=s[Be+8>>2];s[he+12>>2]=s[Be+12>>2];s[he+16>>2]=s[Be+16>>2];S=Ne;R=De;C=S+48|0;do{s[S>>2]=s[R>>2];S=S+4|0;R=R+4|0}while((S|0)<(C|0));Sr(G|0,pe|0,U|0)|0;Sr(H|0,be|0,U|0)|0;s[se>>2]=1;if(z)S=0;else S=Ee+(r[q>>1]<=(Z|0)){S=0;P=0;break}P=x+ +f[pe+(S<<2)>>2]*+f[G+(S<<2)>>2];S=S+1|0;x=P}while(1){if((S|0)>=(Z|0))break;Ge=P+ +f[be+(S<<2)>>2]*+f[H+(S<<2)>>2];S=S+1|0;P=Ge}if(!(N>=j*x+F*P)){m=0;e=R;S=R}else{S=y;R=je;C=S+48|0;do{s[S>>2]=s[R>>2];S=S+4|0;R=R+4|0}while((S|0)<(C|0));S=Ne;R=Le;C=S+52|0;do{s[S>>2]=s[R>>2];S=S+4|0;R=R+4|0}while((S|0)<(C|0));Sr(G|0,we|0,U|0)|0;Sr(H|0,me|0,U|0)|0;if(!z)Sr(Ee+(r[q>>1]<>0]=e;n[c+(k+Ie+-1)>>0]=S;k=W+((s[p+(K<<2)>>2]|0)+$)|0;K=Y;R=(V|0)>(Z<<3|0)&1}s[T>>2]=s[de>>2];u=Fe;return}function an(e,t,i,r,a,l,h,u,c,d,p){e=e|0;t=t|0;i=i|0;r=r|0;a=a|0;l=l|0;h=h|0;u=u|0;c=+c;d=d|0;p=p|0;var b=0,w=0,m=0,g=0,_=0,v=0,k=0,y=0,E=0,A=0,T=0,S=0,M=0,R=0,C=0;b=s[e>>2]|0;k=s[e+24>>2]|0;A=(a|0)==1&1;v=(i>>>0)/(a>>>0)|0;if((i|0)==1){y=s[e+28>>2]|0;T=e+32|0;E=y+12|0;h=y+16|0;r=y+20|0;k=y+8|0;a=y+4|0;g=y+24|0;_=y+44|0;A=e+4|0;if((s[T>>2]|0)>7){if(!b){d=s[E>>2]|0;l=s[h>>2]|0;if(!l){b=s[a>>2]|0;p=s[k>>2]|0;w=0;do{if(p>>>0>>0){l=p+1|0;s[k>>2]=l;p=l;l=o[(s[y>>2]|0)+(b-l)>>0]|0}else l=0;d=d|l<>>1}else{v=+f[t>>2]<0&1;d=s[E>>2]|0;b=s[h>>2]|0;if((b+1|0)>>>0>32){w=7-b|0;w=b+((w|0)>-8?w:-8)&-8;m=b;do{l=s[k>>2]|0;p=s[a>>2]|0;if(((s[g>>2]|0)+l|0)>>>0

>>0){l=l+1|0;s[k>>2]=l;n[(s[y>>2]|0)+(p-l)>>0]=d;l=0}else l=-1;s[_>>2]=s[_>>2]|l;d=d>>>8;m=m+-8|0}while((m|0)>7);b=b+-8-w|0}l=v;p=b+1|0;d=d|v<>2]=d;s[h>>2]=p;s[r>>2]=(s[r>>2]|0)+1;s[T>>2]=(s[T>>2]|0)+-8}else l=0;if(s[A>>2]|0)f[t>>2]=l|0?-1:1;if(!u){u=1;return u|0}s[u>>2]=s[t>>2];u=1;return u|0}T=(k|0)>0?k:0;do if(d)if(!l)d=0;else{if((T|0)==0?!((v&1|0)==0&(k|0)<0|(a|0)>1):0){d=l;break}Sr(d|0,l|0,i<<2|0)|0}else d=l;while(0);y=(b|0)==0;E=(d|0)==0;_=0;while(1){if((_|0)>=(T|0))break;e:do if(!y){l=1<<_;b=i>>_>>1;w=l<<1;m=0;while(1){if((m|0)<(l|0))g=0;else break e;while(1){if((g|0)>=(b|0))break;C=t+((te(w,g)|0)+m<<2)|0;R=+f[C>>2]*.7071067690849304;S=t+(((g<<1|1)<<_)+m<<2)|0;M=+f[S>>2]*.7071067690849304;f[C>>2]=R+M;f[S>>2]=R-M;g=g+1|0}m=m+1|0}}while(0);e:do if(!E){l=1<<_;b=i>>_>>1;w=l<<1;m=0;while(1){if((m|0)<(l|0))g=0;else break e;while(1){if((g|0)>=(b|0))break;S=d+((te(w,g)|0)+m<<2)|0;M=+f[S>>2]*.7071067690849304;C=d+(((g<<1|1)<<_)+m<<2)|0;R=+f[C>>2]*.7071067690849304;f[S>>2]=M+R;f[C>>2]=M-R;g=g+1|0}m=m+1|0}}while(0);p=o[31165+(p&15)>>0]|0|(o[31165+(p>>4)>>0]|0)<<2;_=_+1|0}a=a>>T;_=p;l=v<>1;b=a<<1;w=0;while(1){if((w|0)<(a|0))m=0;else break e;while(1){if((m|0)>=(p|0))break;S=t+((te(b,m)|0)+w<<2)|0;M=+f[S>>2]*.7071067690849304;C=t+((te(m<<1|1,a)|0)+w<<2)|0;R=+f[C>>2]*.7071067690849304;f[S>>2]=M+R;f[C>>2]=M-R;m=m+1|0}w=w+1|0}}while(0);e:do if(E){l=l>>1;p=a<<1}else{l=l>>1;p=a<<1;b=0;while(1){if((b|0)<(a|0))w=0;else break e;while(1){if((w|0)>=(l|0))break;S=d+((te(p,w)|0)+b<<2)|0;M=+f[S>>2]*.7071067690849304;C=d+((te(w<<1|1,a)|0)+b<<2)|0;R=+f[C>>2]*.7071067690849304;f[S>>2]=M+R;f[C>>2]=M-R;w=w+1|0}b=b+1|0}}while(0);C=_|_<1;if(b){if(!y)ln(t,l>>T,a<>T,a<>2]|0)){C=p;return C|0}if(b){un(t,l>>T,a<=(v|0)){g=0;break}g=a>>1;l=l<<1;d=l>>1;b=g<<1;w=0;while(1){if((w|0)<(g|0))m=0;else break;while(1){if((m|0)>=(d|0))break;S=t+((te(b,m)|0)+w<<2)|0;M=+f[S>>2]*.7071067690849304;C=t+((te(m<<1|1,g)|0)+w<<2)|0;R=+f[C>>2]*.7071067690849304;f[S>>2]=M+R;f[C>>2]=M-R;m=m+1|0}w=w+1|0}a=g;p=p|p>>>g;_=_+1|0}while(1){if((g|0)>=(T|0))break;l=n[31181+p>>0]|0;d=1<>g>>1;b=d<<1;w=0;while(1){if((w|0)<(d|0))m=0;else break;while(1){if((m|0)>=(p|0))break;S=t+((te(b,m)|0)+w<<2)|0;M=+f[S>>2]*.7071067690849304;C=t+(((m<<1|1)<>2]*.7071067690849304;f[S>>2]=M+R;f[C>>2]=M-R;m=m+1|0}w=w+1|0}p=l&255;g=g+1|0}l=a<=(i|0))break e;f[u+(d<<2)>>2]=c*+f[t+(d<<2)>>2];d=d+1|0}}while(0);C=p&(1<=(i|0))break;n=te(r,t)|0;o=0;while(1){if((o|0)>=(t|0))break;s[f+(n+o<<2)>>2]=s[e+((te(o,i)|0)+r<<2)>>2];o=o+1|0}r=r+1|0}i=l<<2;Sr(e|0,f|0,i|0)|0;u=h;return}n=17628+(i<<2)+-8|0;o=0;while(1){if((o|0)>=(i|0))break;r=n+(o<<2)|0;a=0;while(1){if((a|0)>=(t|0))break;c=s[e+((te(a,i)|0)+o<<2)>>2]|0;s[f+((te(s[r>>2]|0,t)|0)+a<<2)>>2]=c;a=a+1|0}o=o+1|0}c=l<<2;Sr(e|0,f|0,c|0)|0;u=h;return}function fn(e,t,i,a,l,h,c,d,p){e=e|0;t=t|0;i=i|0;a=a|0;l=l|0;h=h|0;c=c|0;d=+d;p=p|0;var b=0,w=0,m=0,g=0,_=0,v=0,k=0,y=0,E=0,A=0,T=0,S=0,M=0,R=0,C=0,P=0,x=0;P=u;u=u+32|0;T=P+28|0;C=P+24|0;m=P;s[T>>2]=a;s[C>>2]=p;M=s[e>>2]|0;E=s[e+8>>2]|0;A=s[e+12>>2]|0;R=s[e+20>>2]|0;S=s[e+28>>2]|0;_=E+100|0;v=c+1|0;y=E+8|0;g=(te(v,s[y>>2]|0)|0)+A|0;E=E+96|0;g=(s[_>>2]|0)+(r[(s[E>>2]|0)+(g<<1)>>1]|0)|0;w=n[g>>0]|0;if((c|0)!=-1?(i|0)>2?((o[g+(w&255)>>0]|0)+12|0)<(a|0):0:0){y=i>>1;E=t+(y<<2)|0;A=c+-1|0;if((l|0)==1)s[C>>2]=p&1|p<<1;_=l+1>>1;hn(e,m,t,E,y,T,_,l,A,0,C);a=s[m+12>>2]|0;v=s[m+16>>2]|0;w=s[m+20>>2]|0;k=+(s[m+4>>2]|0)*30517578125e-15;b=+(s[m+8>>2]|0)*30517578125e-15;do if(!((l|0)<2|(v&16383|0)==0))if((v|0)>8192){a=a-(a>>5-c)|0;break}else{a=a+(y<<3>>6-c)|0;a=(a|0)>0?0:a;break}while(0);c=s[T>>2]|0;m=(c-a|0)/2|0;g=(c|0)<(m|0);m=((g?c:m)|0)<0?0:g?c:m;c=c-m|0;g=e+32|0;w=(s[g>>2]|0)-w|0;s[g>>2]=w;a=(h|0)==0?0:h+(y<<2)|0;if((m|0)<(c|0)){C=s[C>>2]|0;i=(fn(e,E,y,c,_,a,A,b*d,C>>_)|0)<<(l>>1);l=c+((s[g>>2]|0)-w)|0;h=i|(fn(e,t,y,m+((l|0)<25|(v|0)==16384?0:l+-24|0)|0,_,h,A,k*d,C)|0);u=P;return h|0}else{C=s[C>>2]|0;i=fn(e,t,y,m,_,h,A,k*d,C)|0;h=m+((s[g>>2]|0)-w)|0;h=i|(fn(e,E,y,c+((h|0)<25|(v|0)==0?0:h+-24|0)|0,_,a,A,b*d,C>>_)|0)<<(l>>1);u=P;return h|0}}c=a+-1|0;w=w&255;a=0;m=0;while(1){if((a|0)==6)break;T=m+w+1>>1;x=(o[g+T>>0]|0)<(c|0);w=x?w:T;a=a+1|0;m=x?T:m}if(!m)a=-1;else a=o[g+m>>0]|0;a=(c-a|0)>((o[g+w>>0]|0)-c|0)?w:m;if(!a)w=0;else w=(o[g+a>>0]|0)+1|0;c=e+32|0;g=w;w=(s[c>>2]|0)-w|0;while(1){s[c>>2]=w;if(!((w|0)<0&(a|0)>0))break;w=w+g|0;s[c>>2]=w;a=a+-1|0;if(!a)m=0;else m=(o[(s[_>>2]|0)+(r[(s[E>>2]|0)+((te(v,s[y>>2]|0)|0)+A<<1)>>1]|0)+a>>0]|0)+1|0;g=m;w=w-m|0}if(a|0){if((a|0)>=8)a=(a&7|8)<<(a>>3)+-1;if(!M){x=xi(t,i,a,R,l,S,d)|0;u=P;return x|0}else{x=Ci(t,i,a,R,l,S,d,s[e+4>>2]|0)|0;u=P;return x|0}}if(!(s[e+4>>2]|0)){x=0;u=P;return x|0}a=(1<>2]=w;if(!w){yr(t|0,0,i<<2|0)|0;x=0;u=P;return x|0}m=e+40|0;e:do if(!h){w=0;while(1){if((w|0)>=(i|0))break e;x=(te(s[m>>2]|0,1664525)|0)+1013904223|0;s[m>>2]=x;f[t+(w<<2)>>2]=+(x>>20|0);w=w+1|0}}else{a=0;while(1){if((a|0)>=(i|0)){a=w;break e}x=(te(s[m>>2]|0,1664525)|0)+1013904223|0;s[m>>2]=x;f[t+(a<<2)>>2]=+f[h+(a<<2)>>2]+((x&32768|0)==0?-.00390625:.00390625);a=a+1|0}}while(0);w=0;b=0;while(1){if((w|0)>=(i|0))break;k=+f[t+(w<<2)>>2];w=w+1|0;b=b+k*k}b=1/+z(+(b+1.0000000036274937e-15))*d;w=0;while(1){if((w|0)>=(i|0))break;f[t>>2]=b*+f[t>>2];w=w+1|0;t=t+4|0}u=P;return a|0}function hn(e,t,i,a,l,h,u,c,d,p,b){e=e|0;t=t|0;i=i|0;a=a|0;l=l|0;h=h|0;u=u|0;c=c|0;d=d|0;p=p|0;b=b|0;var w=0,m=0,g=0,_=0,v=0,k=0,y=0,E=0,A=0,T=0,S=0,M=0,R=0,C=0,P=0,x=0,I=0,O=0,N=0,D=0,L=0,U=0,B=0,j=0,F=0,H=0,q=0,W=0;E=s[e>>2]|0;L=s[e+8>>2]|0;U=s[e+12>>2]|0;v=s[e+16>>2]|0;q=s[e+28>>2]|0;D=s[e+36>>2]|0;_=(r[(s[L+56>>2]|0)+(U<<1)>>1]|0)+(d<<3)|0;d=_>>1;N=(p|0)==0;do if(!N)if((l|0)==2){p=d+-16|0;g=2;break}else{p=d+-4|0;g=(l<<1)+-1|0;break}else{p=d+-4|0;g=(l<<1)+-1|0}while(0);d=s[h>>2]|0;p=((te(g,p)|0)+d|0)/(g|0)|0;H=d-_+-32|0;p=(H|0)<(p|0)?H:p;if((p|0)<=64)if((p|0)<4)p=1;else y=8;else{p=64;y=8}if((y|0)==8)p=(r[25760+((p&7)<<1)>>1]>>14-(p>>3))+1&-2;I=N|(U|0)<(v|0)?p:1;O=(E|0)==0;if(O)p=0;else{e:do if(N){p=0;w=0;while(1){if((p|0)>=(l|0)){p=0;m=0;break}T=+f[i+(p<<2)>>2];p=p+1|0;w=w+T*T}while(1){if((p|0)>=(l|0))break;T=+f[a+(p<<2)>>2];p=p+1|0;m=m+T*T}w=w+1.0000000036274937e-15;m=m+1.0000000036274937e-15}else{w=1.0000000036274937e-15;m=1.0000000036274937e-15;p=0;while(1){if((p|0)>=(l|0))break e;W=+f[i+(p<<2)>>2];T=+f[a+(p<<2)>>2];k=W+T;T=W-T;w=w+k*k;m=m+T*T;p=p+1|0}}while(0);T=+z(+w);k=+z(+m);w=T*T;m=k*k;do if(!(w+m<1.000000045813705e-18))if(w>2]|0;j=x<<3;F=q+28|0;M=s[F>>2]|0;C=32-(ne(M|0)|0)|0;P=M>>>(C+-16|0);H=(P>>>12)+-8|0;H=(C<<3)+(H+(P>>>0>(s[5272+(H<<2)>>2]|0)>>>0&1))|0;e:do if((I|0)==1)if(!N){if(O)g=0;else{N=(p|0)>8192;g=N&1;t:do if(N){d=0;while(1){if((d|0)>=(l|0))break t;N=a+(d<<2)|0;f[N>>2]=-+f[N>>2];d=d+1|0}}while(0);w=+f[D+(U<<2)>>2];W=+f[D+((s[L+8>>2]|0)+U<<2)>>2];m=+z(+(w*w+1.0000000036274937e-15+W*W))+1.0000000036274937e-15;w=w/m;m=W/m;d=0;while(1){if((d|0)>=(l|0))break;U=i+(d<<2)|0;f[U>>2]=w*+f[U>>2]+m*+f[a+(d<<2)>>2];d=d+1|0}d=s[h>>2]|0}if((d|0)>16?(s[e+32>>2]|0)>16:0){_=s[F>>2]|0;if(O){c=q+32|0;p=s[c>>2]|0;d=_>>>2;a=p>>>0>>0;g=a&1;if(!a){p=p-d|0;s[c>>2]=p;d=_-d|0}s[F>>2]=d;y=q+40|0;E=q+24|0;A=q+4|0;while(1){if(d>>>0>=8388609){p=0;break e}s[B>>2]=(s[B>>2]|0)+8;d=d<<8;s[F>>2]=d;v=s[y>>2]|0;_=s[E>>2]|0;if(_>>>0<(s[A>>2]|0)>>>0){s[E>>2]=_+1;_=o[(s[q>>2]|0)+_>>0]|0}else _=0;s[y>>2]=_;a=((v<<8|_)>>>1&255|p<<8&2147483392)^255;s[c>>2]=a;p=a}}p=_>>>2;d=_-p|0;M=q+32|0;if(g){s[M>>2]=(s[M>>2]|0)+d;d=p}s[F>>2]=d;y=q+36|0;E=q+40|0;A=q+24|0;c=q+8|0;e=q+4|0;S=q+44|0;while(1){if(d>>>0>=8388609){p=0;break e}p=s[M>>2]|0;v=p>>>23;if((v|0)==255)s[y>>2]=(s[y>>2]|0)+1;else{_=p>>>31;d=s[E>>2]|0;if((d|0)>-1){p=s[A>>2]|0;if((p+(s[c>>2]|0)|0)>>>0<(s[e>>2]|0)>>>0){s[A>>2]=p+1;n[(s[q>>2]|0)+p>>0]=d+_;d=0}else d=-1;s[S>>2]=s[S>>2]|d}d=s[y>>2]|0;if(d|0){_=_+255&255;do{p=s[A>>2]|0;if((p+(s[c>>2]|0)|0)>>>0<(s[e>>2]|0)>>>0){s[A>>2]=p+1;n[(s[q>>2]|0)+p>>0]=_;p=0;d=s[y>>2]|0}else p=-1;s[S>>2]=s[S>>2]|p;d=d+-1|0;s[y>>2]=d}while((d|0)!=0)}s[E>>2]=v&255;p=s[M>>2]|0;d=s[F>>2]|0}s[M>>2]=p<<8&2147483392;d=d<<8;s[F>>2]=d;s[B>>2]=(s[B>>2]|0)+8}}else{g=0;p=0}}else g=0;else{do if(!O){if(!N?(A=s[e+48>>2]|0,A|0):0){p=(te(p,I)|0)+((((p|0)>8192?32767:-32767)|0)/(I|0)|0)|0;P=(p|0)<0;p=((I|0)>((P?0:p>>14)|0)?P?0:p>>14:I+-1|0)+(A>>>31^1)|0;break}p=(te(p,I)|0)+8192>>14}while(0);t:do if((l|0)>2&(N^1)){y=(I|0)/2|0;E=(y*3|0)+3|0;A=E+y|0;if(O){_=(M>>>0)/(A>>>0)|0;s[q+36>>2]=_;e=q+32|0;v=s[e>>2]|0;d=((v>>>0)/(_>>>0)|0)+1|0;d=A-(A>>>0>>0?A:d)|0;if((d|0)<(E|0))p=(d|0)/3|0;else p=y+1+(d-E)|0;d=(p|0)>(y|0);if(d)g=p+-1-y+E|0;else g=p*3|0;E=d?p-y+E|0:(p*3|0)+3|0;A=te(_,A-E|0)|0;y=v-A|0;s[e>>2]=y;E=te(_,E-g|0)|0;g=(g|0)==0?M-A|0:E;s[F>>2]=g;E=q+40|0;A=q+24|0;c=q+4|0;d=x;while(1){if(g>>>0>=8388609)break t;d=d+8|0;s[B>>2]=d;g=g<<8;s[F>>2]=g;v=s[E>>2]|0;_=s[A>>2]|0;if(_>>>0<(s[c>>2]|0)>>>0){s[A>>2]=_+1;_=o[(s[q>>2]|0)+_>>0]|0}else _=0;s[E>>2]=_;x=((v<<8|_)>>>1&255|y<<8&2147483392)^255;s[e>>2]=x;y=x}}d=(p|0)>(y|0);if(d)_=p+-1-y+E|0;else _=p*3|0;d=d?p-y+E|0:(p*3|0)+3|0;g=(M>>>0)/(A>>>0)|0;if(!_){d=M-(te(g,A-d|0)|0)|0;s[F>>2]=d;y=q+32|0}else{P=M-(te(g,A-_|0)|0)|0;y=q+32|0;s[y>>2]=(s[y>>2]|0)+P;d=te(g,d-_|0)|0;s[F>>2]=d}E=q+36|0;A=q+40|0;c=q+24|0;e=q+8|0;S=q+4|0;M=q+44|0;g=x;while(1){if(d>>>0>=8388609)break t;_=s[y>>2]|0;v=_>>>23;if((v|0)==255)s[E>>2]=(s[E>>2]|0)+1;else{_=_>>>31;d=s[A>>2]|0;if((d|0)>-1){g=s[c>>2]|0;if((g+(s[e>>2]|0)|0)>>>0<(s[S>>2]|0)>>>0){s[c>>2]=g+1;n[(s[q>>2]|0)+g>>0]=d+_;d=0}else d=-1;s[M>>2]=s[M>>2]|d}d=s[E>>2]|0;if(d|0){_=_+255&255;do{g=s[c>>2]|0;if((g+(s[e>>2]|0)|0)>>>0<(s[S>>2]|0)>>>0){s[c>>2]=g+1;n[(s[q>>2]|0)+g>>0]=_;g=0;d=s[E>>2]|0}else g=-1;s[M>>2]=s[M>>2]|g;d=d+-1|0;s[E>>2]=d}while((d|0)!=0)}s[A>>2]=v&255;_=s[y>>2]|0;d=s[F>>2]|0;g=s[B>>2]|0}s[y>>2]=_<<8&2147483392;d=d<<8;s[F>>2]=d;g=g+8|0;s[B>>2]=g}}else{if(!((c|0)>1|N^1)){g=I>>1;_=g+1|0;e=te(_,_)|0;if(O){A=(M>>>0)/(e>>>0)|0;s[q+36>>2]=A;S=q+32|0;c=s[S>>2]|0;p=((c>>>0)/(A>>>0)|0)+1|0;p=e>>>0

>>0?e:p;d=e-p|0;if((d|0)<((te(g,_)|0)>>1|0)){d=d<<3|1;v=32-(ne(d|0)|0)+-1>>1;_=1<>>0

>>0;y=y+(g?0:_)|0;if((v|0)<=0)break;else{d=d-(g?0:p)|0;_=_>>>1;v=v+-1|0}}p=(y+-1|0)>>>1;g=p+1|0;d=(te(p,g)|0)>>>1}else{E=I<<1;d=(p<<3)+-7|0;v=32-(ne(d|0)|0)+-1>>1;_=1<>>0

>>0;y=y+(g?0:_)|0;if((v|0)<=0)break;else{d=d-(g?0:p)|0;_=_>>>1;v=v+-1|0}}p=(E+2-y|0)>>>1;g=I+1-p|0;d=e-((te(g,I+2-p|0)|0)>>1)|0}E=te(A,e-(d+g)|0)|0;y=c-E|0;s[S>>2]=y;g=te(A,g)|0;g=(d|0)==0?M-E|0:g;s[F>>2]=g;E=q+40|0;A=q+24|0;c=q+4|0;d=x;while(1){if(g>>>0>=8388609)break t;d=d+8|0;s[B>>2]=d;g=g<<8;s[F>>2]=g;v=s[E>>2]|0;_=s[A>>2]|0;if(_>>>0<(s[c>>2]|0)>>>0){s[A>>2]=_+1;_=o[(s[q>>2]|0)+_>>0]|0}else _=0;s[E>>2]=_;x=((v<<8|_)>>>1&255|y<<8&2147483392)^255;s[S>>2]=x;y=x}}P=(p|0)>(g|0);d=P?I+1-p|0:p+1|0;if(P)_=e-((te(I+1-p|0,I+2-p|0)|0)>>1)|0;else _=(te(p,p+1|0)|0)>>1;g=(M>>>0)/(e>>>0)|0;if(!_){d=M-(te(g,e-d|0)|0)|0;s[F>>2]=d;y=q+32|0}else{P=M-(te(g,e-_|0)|0)|0;y=q+32|0;s[y>>2]=(s[y>>2]|0)+P;d=te(g,d)|0;s[F>>2]=d}E=q+36|0;A=q+40|0;c=q+24|0;e=q+8|0;S=q+4|0;M=q+44|0;g=x;while(1){if(d>>>0>=8388609)break t;_=s[y>>2]|0;v=_>>>23;if((v|0)==255)s[E>>2]=(s[E>>2]|0)+1;else{_=_>>>31;d=s[A>>2]|0;if((d|0)>-1){g=s[c>>2]|0;if((g+(s[e>>2]|0)|0)>>>0<(s[S>>2]|0)>>>0){s[c>>2]=g+1;n[(s[q>>2]|0)+g>>0]=d+_;d=0}else d=-1;s[M>>2]=s[M>>2]|d}d=s[E>>2]|0;if(d|0){_=_+255&255;do{g=s[c>>2]|0;if((g+(s[e>>2]|0)|0)>>>0<(s[S>>2]|0)>>>0){s[c>>2]=g+1;n[(s[q>>2]|0)+g>>0]=_;g=0;d=s[E>>2]|0}else g=-1;s[M>>2]=s[M>>2]|g;d=d+-1|0;s[E>>2]=d}while((d|0)!=0)}s[A>>2]=v&255;_=s[y>>2]|0;d=s[F>>2]|0;g=s[B>>2]|0}s[y>>2]=_<<8&2147483392;d=d<<8;s[F>>2]=d;g=g+8|0;s[B>>2]=g}}_=I+1|0;if(O){g=0;p=((hi(q,_)|0)<<14>>>0)/(I>>>0)|0;break e}d=32-(ne(I|0)|0)|0;if((d|0)<=8){d=(M>>>0)/(_>>>0)|0;if(!p){d=M-(te(d,I)|0)|0;s[F>>2]=d;M=q+32|0}else{P=M-(te(d,_-p|0)|0)|0;M=q+32|0;s[M>>2]=(s[M>>2]|0)+P;s[F>>2]=d}y=q+36|0;E=q+40|0;A=q+24|0;c=q+8|0;e=q+4|0;S=q+44|0;g=x;while(1){if(d>>>0>=8388609)break t;_=s[M>>2]|0;v=_>>>23;if((v|0)==255)s[y>>2]=(s[y>>2]|0)+1;else{_=_>>>31;d=s[E>>2]|0;if((d|0)>-1){g=s[A>>2]|0;if((g+(s[c>>2]|0)|0)>>>0<(s[e>>2]|0)>>>0){s[A>>2]=g+1;n[(s[q>>2]|0)+g>>0]=d+_;d=0}else d=-1;s[S>>2]=s[S>>2]|d}d=s[y>>2]|0;if(d|0){_=_+255&255;do{g=s[A>>2]|0;if((g+(s[c>>2]|0)|0)>>>0<(s[e>>2]|0)>>>0){s[A>>2]=g+1;n[(s[q>>2]|0)+g>>0]=_;g=0;d=s[y>>2]|0}else g=-1;s[S>>2]=s[S>>2]|g;d=d+-1|0;s[y>>2]=d}while((d|0)!=0)}s[E>>2]=v&255;_=s[M>>2]|0;d=s[F>>2]|0;g=s[B>>2]|0}s[M>>2]=_<<8&2147483392;d=d<<8;s[F>>2]=d;g=g+8|0;s[B>>2]=g}}P=d+-8|0;d=I>>>P;g=d+1|0;_=p>>>P;v=(M>>>0)/(g>>>0)|0;if(!_){v=M-(te(v,d)|0)|0;s[F>>2]=v;c=q+32|0}else{C=M-(te(v,g-_|0)|0)|0;c=q+32|0;s[c>>2]=(s[c>>2]|0)+C;s[F>>2]=v}E=q+36|0;A=q+40|0;S=q+24|0;M=q+8|0;R=q+4|0;C=q+44|0;_=x;while(1){if(v>>>0>=8388609)break;d=s[c>>2]|0;y=d>>>23;if((y|0)==255)s[E>>2]=(s[E>>2]|0)+1;else{_=d>>>31;d=s[A>>2]|0;if((d|0)>-1){g=s[S>>2]|0;if((g+(s[M>>2]|0)|0)>>>0<(s[R>>2]|0)>>>0){s[S>>2]=g+1;n[(s[q>>2]|0)+g>>0]=d+_;d=0}else d=-1;s[C>>2]=s[C>>2]|d}d=s[E>>2]|0;if(d|0){_=_+255&255;do{g=s[S>>2]|0;if((g+(s[M>>2]|0)|0)>>>0<(s[R>>2]|0)>>>0){s[S>>2]=g+1;n[(s[q>>2]|0)+g>>0]=_;g=0;d=s[E>>2]|0}else g=-1;s[C>>2]=s[C>>2]|g;d=d+-1|0;s[E>>2]=d}while((d|0)!=0)}s[A>>2]=y&255;d=s[c>>2]|0;v=s[F>>2]|0;_=s[B>>2]|0}s[c>>2]=d<<8&2147483392;v=v<<8;s[F>>2]=v;_=_+8|0;s[B>>2]=_}A=(1<>2]|0;e=q+16|0;g=s[e>>2]|0;if((g+P|0)>>>0>32){E=7-g|0;E=g+((E|0)>-8?E:-8)&-8;y=g;do{_=s[M>>2]|0;v=s[R>>2]|0;if(((s[S>>2]|0)+_|0)>>>0>>0){_=_+1|0;s[M>>2]=_;n[(s[q>>2]|0)+(v-_)>>0]=d;_=0}else _=-1;s[C>>2]=s[C>>2]|_;d=d>>>8;y=y+-8|0}while((y|0)>7);_=s[B>>2]|0;g=g+-8-E|0}s[c>>2]=d|A<>2]=g+P;s[B>>2]=_+P}while(0);p=(p<<14>>>0)/(I>>>0)|0;if(O|N)g=0;else{if(p|0){d=0;while(1){if((d|0)>=(l|0)){g=0;break e}U=i+(d<<2)|0;W=+f[U>>2]*.7071067690849304;q=a+(d<<2)|0;T=+f[q>>2]*.7071067690849304;f[U>>2]=W+T;f[q>>2]=T-W;d=d+1|0}}w=+f[D+(U<<2)>>2];W=+f[D+((s[L+8>>2]|0)+U<<2)>>2];m=+z(+(w*w+1.0000000036274937e-15+W*W))+1.0000000036274937e-15;w=w/m;m=W/m;d=0;while(1){if((d|0)>=(l|0)){g=0;p=0;break e}q=i+(d<<2)|0;f[q>>2]=w*+f[q>>2]+m*+f[a+(d<<2)>>2];d=d+1|0}}}while(0);q=s[F>>2]|0;F=32-(ne(q|0)|0)|0;q=q>>>(F+-16|0);d=(q>>>12)+-8|0;d=(s[B>>2]<<3)-((F<<3)+(d+(q>>>0>(s[5272+(d<<2)>>2]|0)>>>0&1)))+(H-j)|0;s[h>>2]=(s[h>>2]|0)-d;e:do if((p|0)<16384){switch(p|0){case 0:break;default:break e}s[b>>2]=s[b>>2]&(1<>2]=g;b=t+4|0;s[b>>2]=u;b=t+8|0;s[b>>2]=l;b=t+12|0;s[b>>2]=h;b=t+16|0;s[b>>2]=p;t=t+20|0;s[t>>2]=d;return}else{switch(p|0){case 16384:break;default:break e}s[b>>2]=s[b>>2]&(1<>2]=g;b=t+4|0;s[b>>2]=u;b=t+8|0;s[b>>2]=l;b=t+12|0;s[b>>2]=h;b=t+16|0;s[b>>2]=p;t=t+20|0;s[t>>2]=d;return}while(0);H=p<<16>>16;H=((te(H,H)|0)+4096|0)>>>13;u=H<<16>>16;u=(32767-H+(((te(u,(((te(u,(((te(u,-626)|0)+16384|0)>>>15<<16)+542441472>>16)|0)+16384|0)>>>15<<16)+-501415936>>16)|0)+16384|0)>>>15)<<16)+65536>>16;H=16384-p<<16>>16;H=((te(H,H)|0)+4096|0)>>>13;b=H<<16>>16;b=(32767-H+(((te(b,(((te(b,(((te(b,-626)|0)+16384|0)>>>15<<16)+542441472>>16)|0)+16384|0)>>>15<<16)+-501415936>>16)|0)+16384|0)>>>15)<<16)+65536>>16;H=32-(ne(u|0)|0)|0;F=32-(ne(b|0)|0)|0;q=b<<15-F<<16>>16;h=u<<15-H<<16>>16;h=(te((l<<23)+-8388608>>16,(F-H<<11)+(((te(q,(((te(q,-2597)|0)+16384|0)>>>15<<16)+519831552>>16)|0)+16384|0)>>>15)-(((te(h,(((te(h,-2597)|0)+16384|0)>>>15<<16)+519831552>>16)|0)+16384|0)>>>15)<<16>>16)|0)+16384>>15; -l=b;s[t>>2]=g;b=t+4|0;s[b>>2]=u;b=t+8|0;s[b>>2]=l;b=t+12|0;s[b>>2]=h;b=t+16|0;s[b>>2]=p;t=t+20|0;s[t>>2]=d;return}function un(e,t,i,n){e=e|0;t=t|0;i=i|0;n=n|0;var r=0,o=0,a=0,l=0,f=0,h=0;h=u;l=te(t,i)|0;f=u;u=u+((1*(l<<2)|0)+15&-16)|0;if(!n){r=0;while(1){if((r|0)>=(i|0))break;n=te(r,t)|0;o=0;while(1){if((o|0)>=(t|0))break;s[f+((te(o,i)|0)+r<<2)>>2]=s[e+(n+o<<2)>>2];o=o+1|0}r=r+1|0}i=l<<2;Sr(e|0,f|0,i|0)|0;u=h;return}n=17628+(i<<2)+-8|0;o=0;while(1){if((o|0)>=(i|0))break;r=n+(o<<2)|0;a=0;while(1){if((a|0)>=(t|0))break;s[f+((te(a,i)|0)+o<<2)>>2]=s[e+((te(s[r>>2]|0,t)|0)+a<<2)>>2];a=a+1|0}o=o+1|0}i=l<<2;Sr(e|0,f|0,i|0)|0;u=h;return}function cn(e,t,i,r,a,l,h,c,d,p,b){e=e|0;t=t|0;i=i|0;r=r|0;a=a|0;l=l|0;h=h|0;c=c|0;d=d|0;p=p|0;b=b|0;var w=0,m=0,g=0,_=0,v=0,k=0,y=0,E=0,A=0,T=0,S=0,M=0,R=0,C=0,P=0,x=0,I=0,O=0,N=0,D=0,L=0,U=0,B=0,j=0;B=u;u=u+32|0;w=B+28|0;E=B+24|0;v=B;s[w>>2]=a;s[E>>2]=b;y=s[e>>2]|0;U=s[e+28>>2]|0;if((r|0)==1){h=e+32|0;l=(y|0)==0;c=U+12|0;C=U+16|0;P=U+20|0;x=U+8|0;I=U+4|0;O=U+24|0;b=U+44|0;T=e+4|0;S=i|0?2:1;M=0;R=t;while(1){if((s[h>>2]|0)>7){if(l){w=s[c>>2]|0;a=s[C>>2]|0;if(!a){k=s[I>>2]|0;v=s[x>>2]|0;y=0;do{if(v>>>0>>0){a=v+1|0;s[x>>2]=a;v=a;a=o[(s[U>>2]|0)+(k-a)>>0]|0}else a=0;w=w|a<>>1}else{A=+f[R>>2]<0&1;w=s[c>>2]|0;k=s[C>>2]|0;if((k+1|0)>>>0>32){y=7-k|0;y=k+((y|0)>-8?y:-8)&-8;E=k;do{a=s[x>>2]|0;v=s[I>>2]|0;if(((s[O>>2]|0)+a|0)>>>0>>0){a=a+1|0;s[x>>2]=a;n[(s[U>>2]|0)+(v-a)>>0]=w;a=0}else a=-1;s[b>>2]=s[b>>2]|a;w=w>>>8;E=E+-8|0}while((E|0)>7);k=k+-8-y|0}a=A;v=k+1|0;w=w|A<>2]=w;s[C>>2]=v;s[P>>2]=(s[P>>2]|0)+1;s[h>>2]=(s[h>>2]|0)+-8}else a=0;if(s[T>>2]|0)f[R>>2]=a|0?-1:1;M=M+1|0;if((M|0)>=(S|0))break;else R=i}if(!d){i=1;u=B;return i|0}s[d>>2]=s[t>>2];i=1;u=B;return i|0}hn(e,v,t,i,r,w,l,l,c,1,E);D=s[v>>2]|0;T=s[v+16>>2]|0;A=s[v+20>>2]|0;L=+(s[v+4>>2]|0)*30517578125e-15;m=+(s[v+8>>2]|0)*30517578125e-15;N=(r|0)==2;do if(N){a=s[w>>2]|0;if((T|0)<16384)switch(T|0){case 0:{w=0;break}default:k=26}else switch(T|0){case 16384:{w=0;break}default:k=26}if((k|0)==26)w=8;O=a-w|0;x=(T|0)>8192;I=e+32|0;s[I>>2]=(s[I>>2]|0)-(A+w);I=x?i:t;x=x?t:i;do if(!w)a=0;else{if(!y){A=U+12|0;w=s[A>>2]|0;T=U+16|0;a=s[T>>2]|0;if(!a){y=U+8|0;k=s[U+4>>2]|0;v=s[y>>2]|0;E=0;do{if(v>>>0>>0){v=v+1|0;s[y>>2]=v;a=o[(s[U>>2]|0)+(k-v)>>0]|0}else a=0;w=w|a<>2]=w>>>1;s[T>>2]=a+-1;a=U+20|0;s[a>>2]=(s[a>>2]|0)+1;a=w&1;break}a=+f[I>>2]*+f[x+4>>2]-+f[I+4>>2]*+f[x>>2]<0&1;C=U+12|0;w=s[C>>2]|0;P=U+16|0;v=s[P>>2]|0;if((v+1|0)>>>0>32){E=U+24|0;A=U+8|0;T=U+4|0;S=U+44|0;M=7-v|0;M=v+((M|0)>-8?M:-8)&-8;R=v;do{k=s[A>>2]|0;y=s[T>>2]|0;if(((s[E>>2]|0)+k|0)>>>0>>0){k=k+1|0;s[A>>2]=k;n[(s[U>>2]|0)+(y-k)>>0]=w;k=0}else k=-1;s[S>>2]=s[S>>2]|k;w=w>>>8;R=R+-8|0}while((R|0)>7);v=v+-8-M|0}s[C>>2]=w|a<>2]=v+1;U=U+20|0;s[U>>2]=(s[U>>2]|0)+1}while(0);U=1-(a<<1)|0;a=an(e,I,2,O,l,h,c,d,1,p,b)|0;f[x>>2]=+(0-U|0)*+f[I+4>>2];f[x+4>>2]=+(U|0)*+f[I>>2];if(s[e+4>>2]|0){f[t>>2]=L*+f[t>>2];U=t+4|0;f[U>>2]=L*+f[U>>2];g=m*+f[i>>2];f[i>>2]=g;d=i+4|0;f[d>>2]=m*+f[d>>2];_=+f[t>>2];f[t>>2]=_-g;f[i>>2]=_+ +f[i>>2];_=+f[U>>2];f[U>>2]=_-+f[d>>2];f[d>>2]=_+ +f[d>>2]}}else{k=s[w>>2]|0;v=(k-(s[v+12>>2]|0)|0)/2|0;y=(k|0)<(v|0);v=((y?k:v)|0)<0?0:y?k:v;k=k-v|0;y=e+32|0;w=(s[y>>2]|0)-A|0;s[y>>2]=w;a=s[E>>2]|0;if((v|0)<(k|0)){b=an(e,i,r,k,l,0,c,0,m,0,a>>l)|0;U=k+((s[y>>2]|0)-w)|0;a=b|(an(e,t,r,v+((U|0)<25|(T|0)==16384?0:U+-24|0)|0,l,h,c,d,1,p,a)|0);break}else{U=an(e,t,r,v,l,h,c,d,1,p,a)|0;d=v+((s[y>>2]|0)-w)|0;a=U|(an(e,i,r,k+((d|0)<25|(T|0)==0?0:d+-24|0)|0,l,0,c,0,m,0,a>>l)|0);break}}while(0);if(!(s[e+4>>2]|0)){i=a;u=B;return i|0}e:do if(!N){w=0;m=0;g=0;while(1){if((w|0)>=(r|0))break;_=+f[i+(w<<2)>>2];j=m+_*+f[t+(w<<2)>>2];w=w+1|0;m=j;g=g+_*_}j=L*L+g;g=m*L*2;m=j-g;g=j+g;if(g<.0006000000284984708|m<.0006000000284984708){Sr(i|0,t|0,r<<2|0)|0;break}_=1/+z(+m);m=1/+z(+g);w=0;while(1){if((w|0)>=(r|0))break e;U=t+(w<<2)|0;g=+f[U>>2]*L;d=i+(w<<2)|0;j=+f[d>>2];f[U>>2]=_*(g-j);f[d>>2]=m*(g+j);w=w+1|0}}while(0);if(!D){i=a;u=B;return i|0}else w=0;while(1){if((w|0)>=(r|0))break;t=i+(w<<2)|0;f[t>>2]=-+f[t>>2];w=w+1|0}u=B;return a|0}function dn(e,t,i,o,a,l){e=e|0;t=t|0;i=i|0;o=o|0;a=a|0;l=l|0;var f=0,h=0,c=0,d=0,p=0,b=0,w=0,m=0,g=0,_=0,v=0,k=0,y=0,E=0,A=0,T=0,S=0,M=0,R=0,C=0,P=0,x=0,I=0,O=0;O=u;u=u+208|0;C=O+176|0;P=O+144|0;I=O;R=e+2328|0;x=s[R>>2]|0;M=I+136|0;s[M>>2]=0;switch(a|0){case 0:{f=e+2388|0;h=4;break}case 2:{f=e+2388|0;if((s[e+2420+(s[f>>2]<<2)>>2]|0)==1)h=4;else h=57;break}default:h=57}if((h|0)==4){S=Ne()|0;v=u;u=u+((1*((x+15&-16)<<1)|0)+15&-16)|0;pn(e,t,s[f>>2]|0,a,l);T=e+2765|0;bn(t,v,n[T>>0]|0,n[e+2766>>0]|0,s[R>>2]|0);A=e+2324|0;mn(I+16|0,e+2736|0,e+2312|0,(l|0)==2&1,s[A>>2]|0);gn(C,e+2744|0,s[e+2732>>2]|0);k=I+64|0;y=e+2340|0;Pn(k,C,s[y>>2]|0);E=e+2376|0;f=e+2767|0;if((s[E>>2]|0)!=1){f=n[f>>0]|0;if(f<<24>>24<4){a=s[y>>2]|0;t=0;while(1){if((t|0)>=(a|0))break;_=r[e+2344+(t<<1)>>1]|0;r[P+(t<<1)>>1]=(_&65535)+((te(f<<24>>24,(r[C+(t<<1)>>1]|0)-(_<<16>>16)|0)|0)>>>2);t=t+1|0}Pn(I+32|0,P,a);a=s[y>>2]|0}else h=11}else{n[f>>0]=4;h=11}if((h|0)==11){a=s[y>>2]|0;Sr(I+32|0,k|0,a<<1|0)|0}Sr(e+2344|0,C|0,a<<1|0)|0;f=e+4160|0;if(s[f>>2]|0){l=a+-1|0;a=63570;t=0;while(1){if((t|0)>=(l|0))break;_=I+32+(t<<1)|0;r[_>>1]=(((te(a,r[_>>1]|0)|0)>>>15)+1|0)>>>1;a=a+(((te(a,-1966)|0)>>15)+1>>1)|0;t=t+1|0}t=I+32+(l<<1)|0;r[t>>1]=(((te(a,r[t>>1]|0)|0)>>>15)+1|0)>>>1;a=63570;t=0;while(1){if((t|0)>=(l|0))break;_=I+64+(t<<1)|0;r[_>>1]=(((te(a,r[_>>1]|0)|0)>>>15)+1|0)>>>1;a=a+(((te(a,-1966)|0)>>15)+1>>1)|0;t=t+1|0}_=I+64+(l<<1)|0;r[_>>1]=(((te(a,r[_>>1]|0)|0)>>>15)+1|0)>>>1}if((n[T>>0]|0)==2){a=e+2316|0;h=s[a>>2]|0;_=s[A>>2]|0;l=(h|0)==8;w=(_|0)==4;m=l?w?11:3:w?34:12;w=l?w?32969:32935:w?33013:32941;h=h<<16;l=h>>15;h=(h>>16)*18|0;c=l+(r[e+2762>>1]|0)|0;d=n[e+2764>>0]|0;p=(l|0)>(h|0);g=0;while(1){if((g|0)>=(_|0))break;t=c+(n[w+((te(g,m)|0)+d)>>0]|0)|0;b=I+(g<<2)|0;s[b>>2]=t;if(p)if((t|0)>(l|0))t=l;else t=(t|0)<(h|0)?h:t;else if((t|0)>(h|0))t=h;else t=(t|0)<(l|0)?l:t;s[b>>2]=t;g=g+1|0}l=r[e+2768>>1]|0;t=s[17400+((l&65535)<<24>>24<<2)>>2]|0;l=(l&65535)>>>8;p=0;while(1){if((p|0)>=(_|0))break;h=(n[e+2740+p>>0]|0)*5|0;c=p*5|0;d=0;while(1){if((d|0)==5)break;r[I+96+(c+d<<1)>>1]=n[t+(h+d)>>0]<<7;d=d+1|0}p=p+1|0}s[M>>2]=r[25412+((l&65535)<<24>>24<<1)>>1]}else{a=s[A>>2]|0;yr(I|0,0,a<<2|0)|0;yr(I+96|0,0,a*10|0)|0;n[e+2768>>0]=0;s[M>>2]=0;a=e+2316|0}Bn(e,I,i,v);t=s[a>>2]|0;a=e+4248|0;if((t|0)!=(s[a>>2]|0)){s[e+4168>>2]=s[R>>2]<<7;s[e+4240>>2]=65536;s[e+4244>>2]=65536;s[e+4256>>2]=20;s[e+4252>>2]=2;s[a>>2]=t}g=e+4168|0;v=n[T>>0]|0;_=e+4164|0;s[_>>2]=v<<24>>24;e:do if(v<<24>>24==2){a=e+2332|0;d=s[a>>2]|0;p=s[A>>2]|0;b=p+-1|0;w=e+4172|0;c=s[I+(b<<2)>>2]|0;t=0;m=0;while(1){if((te(m,d)|0)>=(c|0)|(m|0)==(p|0))break;else{l=0;h=0}while(1){if((l|0)==5)break;v=h+(r[I+96+(((b-m|0)*5|0)+l<<1)>>1]|0)|0;l=l+1|0;h=v}if((h|0)>(t|0)){t=I+96+((p+65535-m<<16>>16)*5<<1)|0;r[w>>1]=r[t>>1]|0;r[w+2>>1]=r[t+2>>1]|0;r[w+4>>1]=r[t+4>>1]|0;r[w+6>>1]=r[t+6>>1]|0;r[w+8>>1]=r[t+8>>1]|0;s[g>>2]=s[I+(b-m<<2)>>2]<<8;t=h}m=m+1|0}s[w>>2]=0;s[w+4>>2]=0;r[w+8>>1]=0;r[e+4176>>1]=t;if((t|0)<11469){t=(11744256/(((t|0)>1?t:1)|0)|0)<<16>>16;l=0;while(1){if((l|0)==5)break e;v=e+4172+(l<<1)|0;r[v>>1]=(te(r[v>>1]|0,t)|0)>>>10;l=l+1|0}}if((t|0)>15565){t=(255016960/(t|0)|0)<<16>>16;l=0;while(1){if((l|0)==5)break e;v=e+4172+(l<<1)|0;r[v>>1]=(te(r[v>>1]|0,t)|0)>>>14;l=l+1|0}}}else{s[g>>2]=(t<<16>>16)*4608;a=e+4172|0;s[a>>2]=0;s[a+4>>2]=0;r[a+8>>1]=0;a=e+2332|0}while(0);Sr(e+4182|0,k|0,s[y>>2]<<1|0)|0;r[e+4236>>1]=s[M>>2];M=s[A>>2]|0;k=I+16+(M+-2<<2)|0;y=s[k+4>>2]|0;A=e+4240|0;s[A>>2]=s[k>>2];s[A+4>>2]=y;s[e+4256>>2]=s[a>>2];s[e+4252>>2]=M;s[f>>2]=0;s[_>>2]=n[T>>0];s[E>>2]=0;He(S|0);a=I}else if((h|0)==57){n[e+2765>>0]=s[e+4164>>2];f=s[e+2316>>2]|0;a=e+4248|0;if((f|0)!=(s[a>>2]|0)){s[e+4168>>2]=x<<7;s[e+4240>>2]=65536;s[e+4244>>2]=65536;s[e+4256>>2]=20;s[e+4252>>2]=2;s[a>>2]=f}yn(e,I,i);f=e+4160|0;s[f>>2]=(s[f>>2]|0)+1;a=I}S=s[R>>2]|0;M=(s[e+2336>>2]|0)-S|0;Mr(e+1348|0,e+1348+(S<<1)|0,M<<1|0)|0;Sr(e+1348+(M<<1)|0,i|0,s[R>>2]<<1|0)|0;Un(e,a,i,x);if(s[f>>2]|0){Dn(e+4228|0,e+4232|0,i,x);s[e+4216>>2]=1;i=e+2324|0;i=s[i>>2]|0;i=i+-1|0;i=I+(i<<2)|0;i=s[i>>2]|0;I=e+2308|0;s[I>>2]=i;s[o>>2]=x;u=O;return 0}h=e+4216|0;e:do if(s[h>>2]|0){Dn(P,C,i,x);f=s[C>>2]|0;a=s[e+4232>>2]|0;if((f|0)<=(a|0)){if((f|0)<(a|0))s[P>>2]=s[P>>2]>>a-f}else{C=e+4228|0;s[C>>2]=s[C>>2]>>f-a}f=s[P>>2]|0;a=e+4228|0;t=s[a>>2]|0;if((f|0)>(t|0)){R=ne(t|0)|0;C=t<>2]=C;R=25-R|0;f=f>>((R|0)>0?R:0);s[P>>2]=f;f=(C|0)/(((f|0)>1?f:1)|0)|0;if((f|0)<1)f=0;else{l=ne(f|0)|0;a=24-l|0;t=0-a|0;do if(a)if((a|0)<0){f=f<>>(a+32|0);break}else{f=f<<32-a|f>>>a;break}while(0);P=((l&1|0)==0?46214:32768)>>>(l>>>1);f=(te(f&127,13959168)|0)>>>16;f=P+((te(P>>16,f)|0)+((te(P&65535,f)|0)>>>16))<<4}t=((65536-f|0)/(x|0)|0)<<2;a=0;while(1){if((a|0)>=(x|0))break e;P=i+(a<<1)|0;C=r[P>>1]|0;r[P>>1]=(te(f>>16,C)|0)+((te(f&65532,C)|0)>>>16);f=f+t|0;if((f|0)>65536)break e;a=a+1|0}}}while(0);s[h>>2]=0;i=e+2324|0;i=s[i>>2]|0;i=i+-1|0;i=I+(i<<2)|0;i=s[i>>2]|0;I=e+2308|0;s[I>>2]=i;s[o>>2]=x;u=O;return 0}function pn(e,t,i,l,f){e=e|0;t=t|0;i=i|0;l=l|0;f=f|0;var h=0,c=0,d=0,p=0,b=0,w=0,m=0,g=0,_=0,v=0,k=0,y=0,E=0,A=0,T=0,S=0,M=0,R=0,C=0,P=0;P=u;u=u+48|0;T=P;y=P+32|0;e:do if((l|0)==0?(s[e+2404+(i<<2)>>2]|0)==0:0){g=t+28|0;d=s[g>>2]|0;_=t+32|0;l=s[_>>2]|0;h=d>>>8;i=-1;while(1){i=i+1|0;c=te(h,o[29937+i>>0]|0)|0;if(l>>>0>=c>>>0)break;else d=c}m=l-c|0;s[_>>2]=m;l=d-c|0;s[g>>2]=l;d=t+20|0;p=t+40|0;b=t+24|0;w=t+4|0;while(1){if(l>>>0>=8388609)break e;s[d>>2]=(s[d>>2]|0)+8;l=l<<8;s[g>>2]=l;c=s[p>>2]|0;h=s[b>>2]|0;if(h>>>0<(s[w>>2]|0)>>>0){s[b>>2]=h+1;h=o[(s[t>>2]|0)+h>>0]|0}else h=0;s[p>>2]=h;C=((c<<8|h)>>>1&255|m<<8&2147483392)^255;s[_>>2]=C;m=C}}else M=3;while(0);if((M|0)==3){m=t+28|0;d=s[m>>2]|0;g=t+32|0;l=s[g>>2]|0;h=d>>>8;_=-1;while(1){c=_+1|0;i=te(h,o[29933+c>>0]|0)|0;if(l>>>0>>0){_=c;d=i}else break}w=l-i|0;s[g>>2]=w;i=d-i|0;s[m>>2]=i;c=t+20|0;d=t+40|0;p=t+24|0;b=t+4|0;while(1){if(i>>>0>=8388609)break;s[c>>2]=(s[c>>2]|0)+8;i=i<<8;s[m>>2]=i;h=s[d>>2]|0;l=s[p>>2]|0;if(l>>>0<(s[b>>2]|0)>>>0){s[p>>2]=l+1;l=o[(s[t>>2]|0)+l>>0]|0}else l=0;s[d>>2]=l;C=((h<<8|l)>>>1&255|w<<8&2147483392)^255;s[g>>2]=C;w=C}i=_+3|0}l=i>>>1;C=e+2765|0;n[C>>0]=l;n[e+2766>>0]=i&1;E=(f|0)==2;if(E){_=t+28|0;c=s[_>>2]|0;m=t+32|0;l=s[m>>2]|0;h=c>>>8;g=-1;while(1){g=g+1|0;i=te(h,o[29396+g>>0]|0)|0;if(l>>>0>=i>>>0)break;else c=i}R=l-i|0;s[m>>2]=R;i=c-i|0;s[_>>2]=i;d=t+20|0;p=t+40|0;b=t+24|0;w=t+4|0;c=R;while(1){if(i>>>0>=8388609)break;s[d>>2]=(s[d>>2]|0)+8;i=i<<8;s[_>>2]=i;h=s[p>>2]|0;l=s[b>>2]|0;if(l>>>0<(s[w>>2]|0)>>>0){s[b>>2]=l+1;l=o[(s[t>>2]|0)+l>>0]|0}else l=0;s[p>>2]=l;R=((h<<8|l)>>>1&255|c<<8&2147483392)^255;s[m>>2]=R;c=R}n[e+2736>>0]=g;k=m;R=d;v=b;S=t}else{i=l<<24>>24;_=t+28|0;d=s[_>>2]|0;k=t+32|0;l=s[k>>2]|0;h=d>>>8;m=-1;while(1){m=m+1|0;c=te(h,o[29372+(i<<3)+m>>0]|0)|0;if(l>>>0>=c>>>0)break;else d=c}R=l-c|0;s[k>>2]=R;i=d-c|0;s[_>>2]=i;g=t+20|0;p=t+40|0;v=t+24|0;w=t+4|0;c=R;while(1){if(i>>>0>=8388609)break;s[g>>2]=(s[g>>2]|0)+8;i=i<<8;s[_>>2]=i;h=s[p>>2]|0;l=s[v>>2]|0;if(l>>>0<(s[w>>2]|0)>>>0){s[v>>2]=l+1;l=o[(s[t>>2]|0)+l>>0]|0}else l=0;s[p>>2]=l;R=((h<<8|l)>>>1&255|c<<8&2147483392)^255;s[k>>2]=R;c=R}b=e+2736|0;n[b>>0]=m<<3;c=s[_>>2]|0;i=s[k>>2]|0;l=c>>>8;d=-1;while(1){d=d+1|0;h=te(l,o[29962+d>>0]|0)|0;if(i>>>0>=h>>>0)break;else c=h}R=i-h|0;s[k>>2]=R;i=c-h|0;s[_>>2]=i;c=R;while(1){if(i>>>0>=8388609)break;s[g>>2]=(s[g>>2]|0)+8;i=i<<8;s[_>>2]=i;h=s[p>>2]|0;l=s[v>>2]|0;if(l>>>0<(s[w>>2]|0)>>>0){s[v>>2]=l+1;l=o[(s[t>>2]|0)+l>>0]|0}else l=0;s[p>>2]=l;R=((h<<8|l)>>>1&255|c<<8&2147483392)^255;s[k>>2]=R;c=R}n[b>>0]=(o[b>>0]|0)+d;R=g;S=t}A=e+2324|0;d=1;while(1){if((d|0)>=(s[A>>2]|0))break;c=s[_>>2]|0;i=s[k>>2]|0;l=c>>>8;b=-1;while(1){b=b+1|0;h=te(l,o[29396+b>>0]|0)|0;if(i>>>0>=h>>>0)break;else c=h}t=i-h|0;s[k>>2]=t;i=c-h|0;s[_>>2]=i;c=t;while(1){if(i>>>0>=8388609)break;s[R>>2]=(s[R>>2]|0)+8;i=i<<8;s[_>>2]=i;h=s[p>>2]|0;l=s[v>>2]|0;if(l>>>0<(s[w>>2]|0)>>>0){s[v>>2]=l+1;l=o[(s[S>>2]|0)+l>>0]|0}else l=0;s[p>>2]=l;t=((h<<8|l)>>>1&255|c<<8&2147483392)^255;s[k>>2]=t;c=t}n[e+2736+d>>0]=b;d=d+1|0}t=e+2732|0;d=s[t>>2]|0;i=te(n[C>>0]>>1,r[d>>1]|0)|0;i=(s[d+16>>2]|0)+i|0;d=s[_>>2]|0;l=s[k>>2]|0;h=d>>>8;b=-1;while(1){b=b+1|0;c=te(h,o[i+b>>0]|0)|0;if(l>>>0>=c>>>0)break;else d=c}g=l-c|0;s[k>>2]=g;i=d-c|0;s[_>>2]=i;c=g;while(1){if(i>>>0>=8388609)break;s[R>>2]=(s[R>>2]|0)+8;i=i<<8;s[_>>2]=i;h=s[p>>2]|0;l=s[v>>2]|0;if(l>>>0<(s[w>>2]|0)>>>0){s[v>>2]=l+1;l=o[(s[S>>2]|0)+l>>0]|0}else l=0;s[p>>2]=l;g=((h<<8|l)>>>1&255|c<<8&2147483392)^255;s[k>>2]=g;c=g}n[e+2744>>0]=b;Ui(T,y,s[t>>2]|0,b<<24>>24);g=0;while(1){i=s[t>>2]|0;if((g|0)>=(r[i+2>>1]|0))break;l=(s[i+28>>2]|0)+(r[T+(g<<1)>>1]|0)|0;b=s[_>>2]|0;h=s[k>>2]|0;c=b>>>8;m=-1;while(1){i=m+1|0;d=te(c,o[l+i>>0]|0)|0;if(h>>>0>>0){m=i;b=d}else break}y=h-d|0;s[k>>2]=y;h=b-d|0;s[_>>2]=h;b=y;while(1){if(h>>>0>=8388609)break;s[R>>2]=(s[R>>2]|0)+8;h=h<<8;s[_>>2]=h;c=s[p>>2]|0;l=s[v>>2]|0;if(l>>>0<(s[w>>2]|0)>>>0){s[v>>2]=l+1;l=o[(s[S>>2]|0)+l>>0]|0}else l=0;s[p>>2]=l;y=((c<<8|l)>>>1&255|b<<8&2147483392)^255;s[k>>2]=y;b=y}switch(m|0){case-1:{c=h>>>8;d=-1;while(1){i=d+1|0;l=te(c,o[29970+i>>0]|0)|0;if(b>>>0>>0){d=i;h=l}else break}c=b-l|0;s[k>>2]=c;i=h-l|0;s[_>>2]=i;while(1){if(i>>>0>=8388609)break;s[R>>2]=(s[R>>2]|0)+8;i=i<<8;s[_>>2]=i;h=s[p>>2]|0;l=s[v>>2]|0;if(l>>>0<(s[w>>2]|0)>>>0){s[v>>2]=l+1;l=o[(s[S>>2]|0)+l>>0]|0}else l=0;s[p>>2]=l;y=((h<<8|l)>>>1&255|c<<8&2147483392)^255;s[k>>2]=y;c=y}i=~d;break}case 7:{c=h>>>8;d=-1;while(1){i=d+1|0;l=te(c,o[29970+i>>0]|0)|0;if(b>>>0>>0){d=i;h=l}else break}c=b-l|0;s[k>>2]=c;i=h-l|0;s[_>>2]=i;while(1){if(i>>>0>=8388609)break;s[R>>2]=(s[R>>2]|0)+8;i=i<<8;s[_>>2]=i;h=s[p>>2]|0;l=s[v>>2]|0;if(l>>>0<(s[w>>2]|0)>>>0){s[v>>2]=l+1;l=o[(s[S>>2]|0)+l>>0]|0}else l=0;s[p>>2]=l;y=((h<<8|l)>>>1&255|c<<8&2147483392)^255;s[k>>2]=y;c=y}i=d+9|0;break}default:{}}y=g+1|0;n[e+2744+y>>0]=i+252;g=y}if((s[A>>2]|0)==4){c=s[_>>2]|0;i=s[k>>2]|0;l=c>>>8;d=-1;while(1){d=d+1|0;h=te(l,o[29939+d>>0]|0)|0;if(i>>>0>=h>>>0)break;else c=h}T=i-h|0;s[k>>2]=T;i=c-h|0;s[_>>2]=i;c=T;while(1){if(i>>>0>=8388609)break;s[R>>2]=(s[R>>2]|0)+8;i=i<<8;s[_>>2]=i;h=s[p>>2]|0;l=s[v>>2]|0;if(l>>>0<(s[w>>2]|0)>>>0){s[v>>2]=l+1;l=o[(s[S>>2]|0)+l>>0]|0}else l=0;s[p>>2]=l;T=((h<<8|l)>>>1&255|c<<8&2147483392)^255;s[k>>2]=T;c=T}n[e+2767>>0]=d}else n[e+2767>>0]=4;do if((n[C>>0]|0)==2){if(E?(s[e+2396>>2]|0)==2:0){c=s[_>>2]|0;i=s[k>>2]|0;l=c>>>8;b=-1;while(1){d=b+1|0;h=te(l,o[30009+d>>0]|0)|0;if(i>>>0>>0){b=d;c=h}else break}T=i-h|0;s[k>>2]=T;i=c-h|0;s[_>>2]=i;c=T;while(1){if(i>>>0>=8388609)break;s[R>>2]=(s[R>>2]|0)+8;i=i<<8;s[_>>2]=i;h=s[p>>2]|0;l=s[v>>2]|0;if(l>>>0<(s[w>>2]|0)>>>0){s[v>>2]=l+1;l=o[(s[S>>2]|0)+l>>0]|0}else l=0;s[p>>2]=l;T=((h<<8|l)>>>1&255|c<<8&2147483392)^255;s[k>>2]=T;c=T}if((d&65535)<<16>>16>0){i=e+2400|0;l=(a[i>>1]|0)+(b+65528)&65535;r[e+2762>>1]=l}else M=108}else M=108;if((M|0)==108){c=s[_>>2]|0;i=s[k>>2]|0;l=c>>>8;d=-1;while(1){d=d+1|0;h=te(l,o[29977+d>>0]|0)|0;if(i>>>0>=h>>>0)break;else c=h}M=i-h|0;s[k>>2]=M;i=c-h|0;s[_>>2]=i;c=M;while(1){if(i>>>0>=8388609)break;s[R>>2]=(s[R>>2]|0)+8;i=i<<8;s[_>>2]=i;h=s[p>>2]|0;l=s[v>>2]|0;if(l>>>0<(s[w>>2]|0)>>>0){s[v>>2]=l+1;l=o[(s[S>>2]|0)+l>>0]|0}else l=0;s[p>>2]=l;M=((h<<8|l)>>>1&255|c<<8&2147483392)^255;s[k>>2]=M;c=M}m=e+2762|0;r[m>>1]=te(d<<16>>16,s[e+2316>>2]>>1)|0;i=s[e+2380>>2]|0;d=s[_>>2]|0;l=s[k>>2]|0;h=d>>>8;b=-1;while(1){b=b+1|0;c=te(h,o[i+b>>0]|0)|0;if(l>>>0>=c>>>0)break;else d=c}M=l-c|0;s[k>>2]=M;i=d-c|0;s[_>>2]=i;c=M;while(1){if(i>>>0>=8388609)break;s[R>>2]=(s[R>>2]|0)+8;i=i<<8;s[_>>2]=i;h=s[p>>2]|0;l=s[v>>2]|0;if(l>>>0<(s[w>>2]|0)>>>0){s[v>>2]=l+1;l=o[(s[S>>2]|0)+l>>0]|0}else l=0;s[p>>2]=l;M=((h<<8|l)>>>1&255|c<<8&2147483392)^255;s[k>>2]=M;c=M}l=(a[m>>1]|0)+b&65535;r[m>>1]=l;i=e+2400|0}r[i>>1]=l;i=s[e+2384>>2]|0;d=s[_>>2]|0;l=s[k>>2]|0;h=d>>>8;b=-1;while(1){b=b+1|0;c=te(h,o[i+b>>0]|0)|0;if(l>>>0>=c>>>0)break;else d=c}M=l-c|0;s[k>>2]=M;i=d-c|0;s[_>>2]=i;c=M;while(1){if(i>>>0>=8388609)break;s[R>>2]=(s[R>>2]|0)+8;i=i<<8;s[_>>2]=i;h=s[p>>2]|0;l=s[v>>2]|0;if(l>>>0<(s[w>>2]|0)>>>0){s[v>>2]=l+1;l=o[(s[S>>2]|0)+l>>0]|0}else l=0;s[p>>2]=l;M=((h<<8|l)>>>1&255|c<<8&2147483392)^255;s[k>>2]=M;c=M}n[e+2764>>0]=b;c=s[_>>2]|0;i=s[k>>2]|0;l=c>>>8;d=-1;while(1){d=d+1|0;h=te(l,o[29437+d>>0]|0)|0;if(i>>>0>=h>>>0)break;else c=h}M=i-h|0;s[k>>2]=M;i=c-h|0;s[_>>2]=i;c=M;while(1){if(i>>>0>=8388609)break;s[R>>2]=(s[R>>2]|0)+8;i=i<<8;s[_>>2]=i;h=s[p>>2]|0;l=s[v>>2]|0;if(l>>>0<(s[w>>2]|0)>>>0){s[v>>2]=l+1;l=o[(s[S>>2]|0)+l>>0]|0}else l=0;s[p>>2]=l;M=((h<<8|l)>>>1&255|c<<8&2147483392)^255;s[k>>2]=M;c=M}g=e+2768|0;n[g>>0]=d;b=0;while(1){if((b|0)>=(s[A>>2]|0))break;i=s[17376+(n[g>>0]<<2)>>2]|0;d=s[_>>2]|0;l=s[k>>2]|0;h=d>>>8;m=-1;while(1){m=m+1|0;c=te(h,o[i+m>>0]|0)|0;if(l>>>0>=c>>>0)break;else d=c}M=l-c|0;s[k>>2]=M;i=d-c|0;s[_>>2]=i;c=M;while(1){if(i>>>0>=8388609)break;s[R>>2]=(s[R>>2]|0)+8;i=i<<8;s[_>>2]=i;h=s[p>>2]|0;l=s[v>>2]|0;if(l>>>0<(s[w>>2]|0)>>>0){s[v>>2]=l+1;l=o[(s[S>>2]|0)+l>>0]|0}else l=0;s[p>>2]=l;M=((h<<8|l)>>>1&255|c<<8&2147483392)^255;s[k>>2]=M;c=M}n[e+2740+b>>0]=m;b=b+1|0}if(f|0){n[e+2769>>0]=0;break}c=s[_>>2]|0;i=s[k>>2]|0;l=c>>>8;d=-1;while(1){d=d+1|0;h=te(l,o[29930+d>>0]|0)|0;if(i>>>0>=h>>>0)break;else c=h}f=i-h|0;s[k>>2]=f;i=c-h|0;s[_>>2]=i;c=f;while(1){if(i>>>0>=8388609)break;s[R>>2]=(s[R>>2]|0)+8;i=i<<8;s[_>>2]=i;h=s[p>>2]|0;l=s[v>>2]|0;if(l>>>0<(s[w>>2]|0)>>>0){s[v>>2]=l+1;l=o[(s[S>>2]|0)+l>>0]|0}else l=0;s[p>>2]=l;f=((h<<8|l)>>>1&255|c<<8&2147483392)^255;s[k>>2]=f;c=f}n[e+2769>>0]=d}while(0);s[e+2396>>2]=n[C>>0];c=s[_>>2]|0;i=s[k>>2]|0;l=c>>>8;d=-1;while(1){d=d+1|0;h=te(l,o[29947+d>>0]|0)|0;if(i>>>0>=h>>>0)break;else c=h}f=i-h|0;s[k>>2]=f;i=c-h|0;s[_>>2]=i;c=f;while(1){if(i>>>0>=8388609)break;s[R>>2]=(s[R>>2]|0)+8;i=i<<8;s[_>>2]=i;h=s[p>>2]|0;l=s[v>>2]|0;if(l>>>0<(s[w>>2]|0)>>>0){s[v>>2]=l+1;l=o[(s[S>>2]|0)+l>>0]|0}else l=0;s[p>>2]=l;f=((h<<8|l)>>>1&255|c<<8&2147483392)^255;s[k>>2]=f;c=f}n[e+2770>>0]=d;u=P;return}function bn(e,t,i,a,l){e=e|0;t=t|0;i=i|0;a=a|0;l=l|0;var f=0,h=0,c=0,d=0,p=0,b=0,w=0,m=0,g=0,_=0,v=0,k=0,y=0,E=0,A=0,T=0,S=0,M=0,R=0,C=0,P=0,x=0,I=0,O=0,N=0,D=0;D=u;u=u+176|0;O=D+160|0;N=D+80|0;S=D;f=i>>1;x=e+28|0;p=s[x>>2]|0;I=e+32|0;c=s[I>>2]|0;d=p>>>8;v=-1;while(1){v=v+1|0;h=te(d,o[30432+(f*9|0)+v>>0]|0)|0;if(c>>>0>=h>>>0)break;else p=h}d=c-h|0;s[I>>2]=d;f=p-h|0;s[x>>2]=f;M=e+20|0;R=e+40|0;C=e+24|0;P=e+4|0;while(1){if(f>>>0>=8388609)break;s[M>>2]=(s[M>>2]|0)+8;f=f<<8;s[x>>2]=f;c=s[R>>2]|0;h=s[C>>2]|0;if(h>>>0<(s[P>>2]|0)>>>0){s[C>>2]=h+1;h=o[(s[e>>2]|0)+h>>0]|0}else h=0;s[R>>2]=h;T=((c<<8|h)>>>1&255|d<<8&2147483392)^255;s[I>>2]=T;d=T}T=l>>4;T=T+((T<<4|0)<(l|0)&1)|0;_=0;while(1){if((_|0)>=(T|0)){E=0;break}g=S+(_<<2)|0;s[g>>2]=0;c=f>>>8;p=-1;while(1){p=p+1|0;h=te(c,o[30090+(v*18|0)+p>>0]|0)|0;if(d>>>0>=h>>>0)break;else f=h}d=d-h|0;s[I>>2]=d;f=f-h|0;s[x>>2]=f;while(1){if(f>>>0>=8388609)break;s[M>>2]=(s[M>>2]|0)+8;f=f<<8;s[x>>2]=f;c=s[R>>2]|0;h=s[C>>2]|0;if(h>>>0<(s[P>>2]|0)>>>0){s[C>>2]=h+1;h=o[(s[e>>2]|0)+h>>0]|0}else h=0;s[R>>2]=h;E=((c<<8|h)>>>1&255|d<<8&2147483392)^255;s[I>>2]=E;d=E}m=N+(_<<2)|0;c=0;h=p;e:while(1){s[m>>2]=h;if((h|0)!=17)break;w=c+1|0;s[g>>2]=w;p=30252+((w|0)==10&1)|0;b=f>>>8;h=-1;while(1){h=h+1|0;c=te(b,o[p+h>>0]|0)|0;if(d>>>0>=c>>>0)break;else f=c}d=d-c|0;s[I>>2]=d;f=f-c|0;s[x>>2]=f;while(1){if(f>>>0>=8388609){c=w;continue e}s[M>>2]=(s[M>>2]|0)+8;f=f<<8;s[x>>2]=f;p=s[R>>2]|0;c=s[C>>2]|0;if(c>>>0<(s[P>>2]|0)>>>0){s[C>>2]=c+1;c=o[(s[e>>2]|0)+c>>0]|0}else c=0;s[R>>2]=c;E=((p<<8|c)>>>1&255|d<<8&2147483392)^255;s[I>>2]=E;d=E}}_=_+1|0}while(1){if((E|0)>=(T|0)){g=0;break}w=s[N+(E<<2)>>2]|0;f=t+(E<<16>>12<<1)|0;if((w|0)>0){h=30924+(o[31076+w>>0]|0)|0;b=s[x>>2]|0;c=s[I>>2]|0;d=b>>>8;g=-1;while(1){g=g+1|0;p=te(d,o[h+g>>0]|0)|0;if(c>>>0>=p>>>0)break;else b=p}y=c-p|0;s[I>>2]=y;h=b-p|0;s[x>>2]=h;p=y;while(1){if(h>>>0>=8388609)break;s[M>>2]=(s[M>>2]|0)+8;h=h<<8;s[x>>2]=h;d=s[R>>2]|0;c=s[C>>2]|0;if(c>>>0<(s[P>>2]|0)>>>0){s[C>>2]=c+1;c=o[(s[e>>2]|0)+c>>0]|0}else c=0;s[R>>2]=c;y=((d<<8|c)>>>1&255|p<<8&2147483392)^255;s[I>>2]=y;p=y}k=w-g|0;y=k&65535;m=g<<16>>16;if((g&65535)<<16>>16>0){h=30772+(o[31076+m>>0]|0)|0;b=s[x>>2]|0;c=s[I>>2]|0;d=b>>>8;w=-1;while(1){w=w+1|0;p=te(d,o[h+w>>0]|0)|0;if(c>>>0>=p>>>0)break;else b=p}v=c-p|0;s[I>>2]=v;h=b-p|0;s[x>>2]=h;p=v;while(1){if(h>>>0>=8388609)break;s[M>>2]=(s[M>>2]|0)+8;h=h<<8;s[x>>2]=h;d=s[R>>2]|0;c=s[C>>2]|0;if(c>>>0<(s[P>>2]|0)>>>0){s[C>>2]=c+1;c=o[(s[e>>2]|0)+c>>0]|0}else c=0;s[R>>2]=c;v=((d<<8|c)>>>1&255|p<<8&2147483392)^255;s[I>>2]=v;p=v}v=w&65535;h=m-w&65535;m=v<<16>>16;if(v<<16>>16>0){c=30620+(o[31076+m>>0]|0)|0;w=s[x>>2]|0;d=s[I>>2]|0;p=w>>>8;g=-1;while(1){g=g+1|0;b=te(p,o[c+g>>0]|0)|0;if(d>>>0>=b>>>0)break;else w=b}v=d-b|0;s[I>>2]=v;c=w-b|0;s[x>>2]=c;b=v;while(1){if(c>>>0>=8388609)break;s[M>>2]=(s[M>>2]|0)+8;c=c<<8;s[x>>2]=c;p=s[R>>2]|0;d=s[C>>2]|0;if(d>>>0<(s[P>>2]|0)>>>0){s[C>>2]=d+1;d=o[(s[e>>2]|0)+d>>0]|0}else d=0;s[R>>2]=d;v=((p<<8|d)>>>1&255|b<<8&2147483392)^255;s[I>>2]=v;b=v}_=g&65535;v=m-g&65535;c=f+2|0;g=_<<16>>16;if(_<<16>>16>0){d=30468+(o[31076+g>>0]|0)|0;m=s[x>>2]|0;p=s[I>>2]|0;b=m>>>8;_=-1;while(1){_=_+1|0;w=te(b,o[d+_>>0]|0)|0;if(p>>>0>=w>>>0)break;else m=w}b=p-w|0;s[I>>2]=b;d=m-w|0;s[x>>2]=d;w=b;while(1){if(d>>>0>=8388609)break;s[M>>2]=(s[M>>2]|0)+8;d=d<<8;s[x>>2]=d;b=s[R>>2]|0;p=s[C>>2]|0;if(p>>>0<(s[P>>2]|0)>>>0){s[C>>2]=p+1;p=o[(s[e>>2]|0)+p>>0]|0}else p=0;s[R>>2]=p;m=((b<<8|p)>>>1&255|w<<8&2147483392)^255;s[I>>2]=m;w=m}r[f>>1]=_;p=g-_&65535;d=v;v=h}else{d=v;A=62}}else A=52}else{h=0;A=52}if((A|0)==52){c=f+2|0;d=0;A=62}if((A|0)==62){A=0;r[f>>1]=0;p=0;v=h}r[c>>1]=p;m=f+4|0;_=f+6|0;g=d<<16>>16;if(d<<16>>16>0){h=30468+(o[31076+g>>0]|0)|0;b=s[x>>2]|0;c=s[I>>2]|0;d=b>>>8;w=-1;while(1){w=w+1|0;p=te(d,o[h+w>>0]|0)|0;if(c>>>0>=p>>>0)break;else b=p}d=c-p|0;s[I>>2]=d;h=b-p|0;s[x>>2]=h;p=d;while(1){if(h>>>0>=8388609)break;s[M>>2]=(s[M>>2]|0)+8;h=h<<8;s[x>>2]=h;d=s[R>>2]|0;c=s[C>>2]|0;if(c>>>0<(s[P>>2]|0)>>>0){s[C>>2]=c+1;c=o[(s[e>>2]|0)+c>>0]|0}else c=0;s[R>>2]=c;b=((d<<8|c)>>>1&255|p<<8&2147483392)^255;s[I>>2]=b;p=b}r[m>>1]=w;h=g-w&65535}else{r[m>>1]=0;h=0}r[_>>1]=h;m=v<<16>>16;if(v<<16>>16>0){h=30620+(o[31076+m>>0]|0)|0;b=s[x>>2]|0;c=s[I>>2]|0;d=b>>>8;w=-1;while(1){w=w+1|0;p=te(d,o[h+w>>0]|0)|0;if(c>>>0>=p>>>0)break;else b=p}v=c-p|0;s[I>>2]=v;h=b-p|0;s[x>>2]=h;p=v;while(1){if(h>>>0>=8388609)break;s[M>>2]=(s[M>>2]|0)+8;h=h<<8;s[x>>2]=h;d=s[R>>2]|0;c=s[C>>2]|0;if(c>>>0<(s[P>>2]|0)>>>0){s[C>>2]=c+1;c=o[(s[e>>2]|0)+c>>0]|0}else c=0;s[R>>2]=c;v=((d<<8|c)>>>1&255|p<<8&2147483392)^255;s[I>>2]=v;p=v}v=w&65535;d=m-w&65535;c=f+8|0;h=f+10|0;_=v<<16>>16;if(v<<16>>16>0){p=30468+(o[31076+_>>0]|0)|0;g=s[x>>2]|0;b=s[I>>2]|0;w=g>>>8;v=-1;while(1){v=v+1|0;m=te(w,o[p+v>>0]|0)|0;if(b>>>0>=m>>>0)break;else g=m}w=b-m|0;s[I>>2]=w;p=g-m|0;s[x>>2]=p;m=w;while(1){if(p>>>0>=8388609)break;s[M>>2]=(s[M>>2]|0)+8;p=p<<8;s[x>>2]=p;w=s[R>>2]|0;b=s[C>>2]|0;if(b>>>0<(s[P>>2]|0)>>>0){s[C>>2]=b+1;b=o[(s[e>>2]|0)+b>>0]|0}else b=0;s[R>>2]=b;g=((w<<8|b)>>>1&255|m<<8&2147483392)^255;s[I>>2]=g;m=g}r[c>>1]=v;c=_-v&65535}else A=91}else{c=f+8|0;h=f+10|0;d=0;A=91}if((A|0)==91){A=0;r[c>>1]=0;c=0}r[h>>1]=c;m=f+12|0;_=f+14|0;g=d<<16>>16;if(d<<16>>16>0){h=30468+(o[31076+g>>0]|0)|0;b=s[x>>2]|0;c=s[I>>2]|0;d=b>>>8;w=-1;while(1){w=w+1|0;p=te(d,o[h+w>>0]|0)|0;if(c>>>0>=p>>>0)break;else b=p}v=c-p|0;s[I>>2]=v;h=b-p|0;s[x>>2]=h;p=v;while(1){if(h>>>0>=8388609)break;s[M>>2]=(s[M>>2]|0)+8;h=h<<8;s[x>>2]=h;d=s[R>>2]|0;c=s[C>>2]|0;if(c>>>0<(s[P>>2]|0)>>>0){s[C>>2]=c+1;c=o[(s[e>>2]|0)+c>>0]|0}else c=0;s[R>>2]=c;v=((d<<8|c)>>>1&255|p<<8&2147483392)^255;s[I>>2]=v;p=v}r[m>>1]=w;h=g-w&65535}else{r[m>>1]=0;h=0}r[_>>1]=h;m=k<<16>>16;if(y<<16>>16>0){h=30772+(o[31076+m>>0]|0)|0;b=s[x>>2]|0;c=s[I>>2]|0;d=b>>>8;w=-1;while(1){w=w+1|0;p=te(d,o[h+w>>0]|0)|0;if(c>>>0>=p>>>0)break;else b=p}y=c-p|0;s[I>>2]=y;h=b-p|0;s[x>>2]=h;p=y;while(1){if(h>>>0>=8388609)break;s[M>>2]=(s[M>>2]|0)+8;h=h<<8;s[x>>2]=h;d=s[R>>2]|0;c=s[C>>2]|0;if(c>>>0<(s[P>>2]|0)>>>0){s[C>>2]=c+1;c=o[(s[e>>2]|0)+c>>0]|0}else c=0;s[R>>2]=c;y=((d<<8|c)>>>1&255|p<<8&2147483392)^255;s[I>>2]=y;p=y}y=w&65535;h=m-w&65535;m=y<<16>>16;if(y<<16>>16>0){c=30620+(o[31076+m>>0]|0)|0;w=s[x>>2]|0;d=s[I>>2]|0;p=w>>>8;g=-1;while(1){g=g+1|0;b=te(p,o[c+g>>0]|0)|0;if(d>>>0>=b>>>0)break;else w=b}y=d-b|0;s[I>>2]=y;c=w-b|0;s[x>>2]=c;b=y;while(1){if(c>>>0>=8388609)break;s[M>>2]=(s[M>>2]|0)+8;c=c<<8;s[x>>2]=c;p=s[R>>2]|0;d=s[C>>2]|0;if(d>>>0<(s[P>>2]|0)>>>0){s[C>>2]=d+1;d=o[(s[e>>2]|0)+d>>0]|0}else d=0;s[R>>2]=d;y=((p<<8|d)>>>1&255|b<<8&2147483392)^255;s[I>>2]=y;b=y}y=g&65535;p=m-g&65535;_=f+16|0;c=f+18|0;v=y<<16>>16;if(y<<16>>16>0){d=30468+(o[31076+v>>0]|0)|0;g=s[x>>2]|0;b=s[I>>2]|0;w=g>>>8;k=-1;while(1){k=k+1|0;m=te(w,o[d+k>>0]|0)|0;if(b>>>0>=m>>>0)break;else g=m}y=b-m|0;s[I>>2]=y;d=g-m|0;s[x>>2]=d;m=y;while(1){if(d>>>0>=8388609)break;s[M>>2]=(s[M>>2]|0)+8;d=d<<8;s[x>>2]=d;w=s[R>>2]|0;b=s[C>>2]|0;if(b>>>0<(s[P>>2]|0)>>>0){s[C>>2]=b+1;b=o[(s[e>>2]|0)+b>>0]|0}else b=0;s[R>>2]=b;y=((w<<8|b)>>>1&255|m<<8&2147483392)^255;s[I>>2]=y;m=y}r[_>>1]=k;d=v-k&65535;v=h}else{d=_;A=128}}else A=118}else{h=0;A=118}if((A|0)==118){d=f+16|0;c=f+18|0;p=0;A=128}if((A|0)==128){A=0;r[d>>1]=0;d=0;v=h}r[c>>1]=d;m=f+20|0;_=f+22|0;g=p<<16>>16;if(p<<16>>16>0){h=30468+(o[31076+g>>0]|0)|0;b=s[x>>2]|0;c=s[I>>2]|0;d=b>>>8;w=-1;while(1){w=w+1|0;p=te(d,o[h+w>>0]|0)|0;if(c>>>0>=p>>>0)break;else b=p}y=c-p|0;s[I>>2]=y;h=b-p|0;s[x>>2]=h;p=y;while(1){if(h>>>0>=8388609)break;s[M>>2]=(s[M>>2]|0)+8;h=h<<8;s[x>>2]=h;d=s[R>>2]|0;c=s[C>>2]|0;if(c>>>0<(s[P>>2]|0)>>>0){s[C>>2]=c+1;c=o[(s[e>>2]|0)+c>>0]|0}else c=0;s[R>>2]=c;y=((d<<8|c)>>>1&255|p<<8&2147483392)^255;s[I>>2]=y;p=y}r[m>>1]=w;h=g-w&65535}else{r[m>>1]=0;h=0}r[_>>1]=h;m=v<<16>>16;if(v<<16>>16>0){h=30620+(o[31076+m>>0]|0)|0;b=s[x>>2]|0;c=s[I>>2]|0;d=b>>>8;w=-1;while(1){w=w+1|0;p=te(d,o[h+w>>0]|0)|0;if(c>>>0>=p>>>0)break;else b=p}y=c-p|0;s[I>>2]=y;h=b-p|0;s[x>>2]=h;p=y;while(1){if(h>>>0>=8388609)break;s[M>>2]=(s[M>>2]|0)+8;h=h<<8;s[x>>2]=h;d=s[R>>2]|0;c=s[C>>2]|0;if(c>>>0<(s[P>>2]|0)>>>0){s[C>>2]=c+1;c=o[(s[e>>2]|0)+c>>0]|0}else c=0;s[R>>2]=c;y=((d<<8|c)>>>1&255|p<<8&2147483392)^255;s[I>>2]=y;p=y}y=w&65535;d=m-w&65535;c=f+24|0;h=f+26|0;_=y<<16>>16;if(y<<16>>16>0){p=30468+(o[31076+_>>0]|0)|0;g=s[x>>2]|0;b=s[I>>2]|0;w=g>>>8;v=-1;while(1){v=v+1|0;m=te(w,o[p+v>>0]|0)|0;if(b>>>0>=m>>>0)break;else g=m}y=b-m|0;s[I>>2]=y;p=g-m|0;s[x>>2]=p;m=y;while(1){if(p>>>0>=8388609)break;s[M>>2]=(s[M>>2]|0)+8;p=p<<8;s[x>>2]=p;w=s[R>>2]|0;b=s[C>>2]|0;if(b>>>0<(s[P>>2]|0)>>>0){s[C>>2]=b+1;b=o[(s[e>>2]|0)+b>>0]|0}else b=0;s[R>>2]=b;y=((w<<8|b)>>>1&255|m<<8&2147483392)^255;s[I>>2]=y;m=y}r[c>>1]=v;c=_-v&65535}else A=157}else{c=f+24|0;h=f+26|0;d=0;A=157}if((A|0)==157){A=0;r[c>>1]=0;c=0}r[h>>1]=c;m=f+28|0;g=f+30|0;w=d<<16>>16;if(d<<16>>16>0){f=30468+(o[31076+w>>0]|0)|0;p=s[x>>2]|0;h=s[I>>2]|0;c=p>>>8;b=-1;while(1){b=b+1|0;d=te(c,o[f+b>>0]|0)|0;if(h>>>0>=d>>>0)break;else p=d}y=h-d|0;s[I>>2]=y;f=p-d|0;s[x>>2]=f;d=y;while(1){if(f>>>0>=8388609)break;s[M>>2]=(s[M>>2]|0)+8;f=f<<8;s[x>>2]=f;c=s[R>>2]|0;h=s[C>>2]|0;if(h>>>0<(s[P>>2]|0)>>>0){s[C>>2]=h+1;h=o[(s[e>>2]|0)+h>>0]|0}else h=0;s[R>>2]=h;y=((c<<8|h)>>>1&255|d<<8&2147483392)^255;s[I>>2]=y;d=y}r[m>>1]=b;f=w-b&65535}else{r[m>>1]=0;f=0}r[g>>1]=f}else{h=f+32|0;do{r[f>>1]=0;f=f+2|0}while((f|0)<(h|0))}E=E+1|0}while(1){if((g|0)>=(T|0))break;p=s[S+(g<<2)>>2]|0;if((p|0)>0){b=t+(g<<16>>12<<1)|0;v=0;while(1){if((v|0)==16)break;w=b+(v<<1)|0;m=r[w>>1]|0;_=0;while(1){if((_|0)==(p|0))break;d=s[x>>2]|0;f=s[I>>2]|0;h=d>>>8;k=-1;while(1){k=k+1|0;c=te(h,o[29928+k>>0]|0)|0;if(f>>>0>=c>>>0)break;else d=c}A=f-c|0;s[I>>2]=A;f=d-c|0;s[x>>2]=f;d=A;while(1){if(f>>>0>=8388609)break;s[M>>2]=(s[M>>2]|0)+8;f=f<<8;s[x>>2]=f;c=s[R>>2]|0;h=s[C>>2]|0;if(h>>>0<(s[P>>2]|0)>>>0){s[C>>2]=h+1;h=o[(s[e>>2]|0)+h>>0]|0}else h=0;s[R>>2]=h;A=((c<<8|h)>>>1&255|d<<8&2147483392)^255;s[I>>2]=A;d=A}m=(m<<1)+k|0;_=_+1|0}r[w>>1]=m;v=v+1|0}A=N+(g<<2)|0;s[A>>2]=s[A>>2]|p<<5}g=g+1|0}n[O+1>>0]=0;_=31093+(((i<<1)+a<<16>>16)*7|0)|0;m=l+8>>4;g=0;while(1){if((g|0)>=(m|0))break;f=s[N+(g<<2)>>2]|0;e:do if((f|0)>0){n[O>>0]=n[_+((f&30)>>>0<6?f&31:6)>>0]|0;b=0;while(1){if((b|0)==16)break e;p=t+(b<<1)|0;if((r[p>>1]|0)>0){d=s[x>>2]|0;f=s[I>>2]|0;h=d>>>8;w=-1;while(1){w=w+1|0;c=te(h,o[O+w>>0]|0)|0;if(f>>>0>=c>>>0)break;else d=c}l=f-c|0;s[I>>2]=l;f=d-c|0;s[x>>2]=f;d=l;while(1){if(f>>>0>=8388609)break;s[M>>2]=(s[M>>2]|0)+8;f=f<<8;s[x>>2]=f;c=s[R>>2]|0;h=s[C>>2]|0;if(h>>>0<(s[P>>2]|0)>>>0){s[C>>2]=h+1;h=o[(s[e>>2]|0)+h>>0]|0}else h=0;s[R>>2]=h;l=((c<<8|h)>>>1&255|d<<8&2147483392)^255;s[I>>2]=l;d=l}r[p>>1]=te(r[p>>1]|0,(w<<1)+-1|0)|0}b=b+1|0}}while(0);g=g+1|0;t=t+32|0}u=D;return}function wn(e,t,i,r,a){e=e|0;t=t|0;i=i|0;r=r|0;a=a|0;var l=0,f=0,h=0,u=0,c=0,d=0;d=0;while(1){if((d|0)>=(a|0))break;c=t+(d<<2)|0;l=s[c>>2]|0;u=ne(l|0)|0;f=24-u|0;h=0-f|0;do if(f)if((f|0)<0){l=l<>>(f+32|0);break}else{l=l<<32-f|l>>>f;break}while(0);h=l&127;h=(((h+(((te(h,128-h|0)|0)*179|0)>>>16)+(31-u<<7)<<16)+-136970240>>16)*2251|0)>>>16;l=h&255;u=e+d|0;n[u>>0]=l;if((h<<24>>24|0)<(n[i>>0]|0)){l=l+1<<24>>24;n[u>>0]=l}if(l<<24>>24>63)l=63;else l=(l<<24>>24>0?l:0)<<24>>24;n[u>>0]=l;if(!(d|r)){l=(n[i>>0]|0)+-4|0;f=n[e>>0]|0;if((l|0)>63){if((f<<24>>24|0)<=(l|0))l=(f<<24>>24>63?f:63)<<24>>24}else if(f<<24>>24>63)l=63;else{u=f<<24>>24;l=(u|0)<(l|0)?l:u}l=l&255;n[e>>0]=l;n[i>>0]=l}else{f=(l&255)-(o[i>>0]|0)|0;l=f&255;n[u>>0]=l;h=(n[i>>0]|0)+8|0;f=f<<24>>24;if((f|0)>(h|0)){l=h+((f-h+1|0)>>>1)&255;n[u>>0]=l}if(l<<24>>24>36)l=36;else l=(l<<24>>24>-4?l:-4)<<24>>24;n[u>>0]=l;if((l|0)>(h|0))l=(n[i>>0]|0)+((l<<1)-h)|0;else l=(o[i>>0]|0)+(l&255)|0;n[i>>0]=l;n[u>>0]=(o[u>>0]|0)+4;l=n[i>>0]|0}l=l<<24>>24;l=(l*29|0)+(l*7281>>16)|0;h=l+2090|0;if((h|0)<3967)if((l|0)<-2090)l=0;else{l=h>>7;u=1<>16)<>7;else l=te(u>>7,f+((te(te(f,128-f|0)|0,-174)|0)>>16)|0)|0;l=u+l|0}else l=2147483647;s[c>>2]=l;d=d+1|0}return}function mn(e,t,i,r,o){e=e|0;t=t|0;i=i|0;r=r|0;o=o|0;var a=0,l=0,f=0,h=0,u=0;u=0;while(1){if((u|0)>=(o|0))break;do if(u|r){a=(n[t+u>>0]|0)+-4|0;l=n[i>>0]|0;f=l<<24>>24;h=f+8|0;if((a|0)>(h|0)){l=f+((a<<1)-h)|0;break}else{l=(l&255)+a|0;break}}else{h=n[t>>0]|0;l=(n[i>>0]|0)+-16|0;l=(h|0)>(l|0)?h:l}while(0);a=l&255;n[i>>0]=a;if(a<<24>>24<=63)if(a<<24>>24<0)a=0;else a=l<<24>>24;else a=63;n[i>>0]=a;a=(a*29|0)+(a*7281>>16)|0;f=a+2090|0;if((f|0)<3967)if((a|0)<-2090)a=0;else{a=f>>7;h=1<>16)<>7;else a=te(h>>7,l+((te(te(l,128-l|0)|0,-174)|0)>>16)|0)|0;a=h+a|0}else a=2147483647;s[e+(u<<2)>>2]=a;u=u+1|0}return}function gn(e,t,i){e=e|0;t=t|0;i=i|0;var a=0,l=0,f=0,h=0,c=0,d=0,p=0,b=0,w=0,m=0,g=0,_=0;_=u;u=u+80|0;w=_+64|0;g=_;Ui(_+32|0,w,i,n[t>>0]|0);c=t+1|0;d=r[i+4>>1]|0;m=i+2|0;a=r[m>>1]|0;p=a<<16>>16;l=p;f=0;while(1){b=l+-1|0;if((l|0)<=0)break;h=(te(f<<16>>16,o[w+b>>0]|0)|0)>>8;l=n[c+b>>0]|0;f=l<<24>>24<<10;if(l<<24>>24>0)l=f+-102|0;else l=l<<24>>24<0?f|102:f;f=h+((te(l>>16,d)|0)+((te(l&65535,d)|0)>>16))|0;r[g+(b<<1)>>1]=f;l=b}h=te(n[t>>0]|0,p)|0;f=(s[i+8>>2]|0)+h|0;h=(s[i+12>>2]|0)+(h<<1)|0;l=0;while(1){a=a<<16>>16;if((l|0)>=(a|0))break;a=((r[g+(l<<1)>>1]<<14|0)/(r[h+(l<<1)>>1]|0)|0)+(o[f+l>>0]<<7)|0;r[e+(l<<1)>>1]=(a|0)>32767?32767:((a|0)<0?0:a)&65535;a=r[m>>1]|0;l=l+1|0}xn(e,s[i+36>>2]|0,a);u=_;return}function _n(e,t,i,o,a,l,f,h,c,d,p,b,w,m,g){e=e|0;t=t|0;i=i|0;o=o|0;a=a|0;l=l|0;f=f|0;h=h|0;c=c|0;d=d|0;p=p|0;b=b|0;w=w|0;m=m|0;g=g|0;var _=0,v=0,k=0,y=0,E=0,A=0,T=0,S=0,M=0,R=0,C=0,P=0,I=0,O=0,N=0,D=0,L=0,U=0,B=0,j=0,F=0,G=0,H=0,z=0,q=0,W=0,V=0,Y=0,Z=0,$=0,K=0,X=0,J=0,Q=0,ee=0,ie=0,re=0,se=0,oe=0,ae=0,le=0,fe=0,he=0,ue=0,ce=0,de=0,pe=0,be=0,we=0,me=0,ge=0,_e=0,ve=0,ke=0,ye=0,Ee=0,Ae=0,Te=0,Se=0,Me=0,Re=0,Ce=0,Pe=0,xe=0,Ie=0,Oe=0,Ne=0,De=0,Le=0,Ue=0,Be=0,je=0,Fe=0,Ge=0,He=0,ze=0,qe=0,We=0,Ve=0,Ye=0,Ze=0,$e=0,Ke=0,Xe=0,Je=0,Qe=0,et=0,tt=0;et=u;Xe=t+4436|0;s[Xe>>2]=n[i+34>>0];Je=t+4424|0;ge=s[Je>>2]|0;Ze=r[i+30>>1]|0;De=i+29|0;Le=r[25404+(n[De>>0]>>1<<2)+((Ze&65535)<<24>>24<<1)>>1]|0;Ze=(Ze&-256)<<16>>16!=1024&1;Ue=e+4684|0;me=s[Ue>>2]|0;Be=e+4676|0;Ge=me+(s[Be>>2]|0)|0;je=u;u=u+((1*(Ge<<2)|0)+15&-16)|0;Fe=u;u=u+((1*(Ge<<1)|0)+15&-16)|0;Ge=e+4680|0;He=u;u=u+((1*(s[Ge>>2]<<2)|0)+15&-16)|0;ze=t+4432|0;s[ze>>2]=me; -me=s[Ue>>2]|0;qe=t+4428|0;s[qe>>2]=me;We=e+4672|0;Ve=Ze^1;Ye=t+4444|0;Ze=Ze<<1^3;$e=e+4732|0;Ke=t+4440|0;Me=e+4728|0;Re=t+3996|0;Ce=t+4420|0;Pe=t+4320|0;xe=t+4416|0;Ie=(m|0)>2048;Ne=(m|0)/2|0;Oe=Ne+-512|0;Ne=512-Ne|0;ve=m<<16>>16;ke=Le+944|0;ye=te(Le,ve)|0;Ee=te(ke<<16>>16,ve)|0;Ae=Le+-944|0;Te=te(944-Le<<16>>16,ve)|0;Se=t+3840|0;_e=g<<16>>16;e=me;me=0;m=ge;ge=t+(s[Ue>>2]<<1)|0;while(1){i=s[We>>2]|0;if((me|0)>=(i|0))break;pe=l+((me>>1|Ve)<<4<<1)|0;be=f+(me*5<<1)|0;we=h+(me*24<<1)|0;R=s[c+(me<<2)>>2]|0;M=R>>2;R=M|R<<15;s[Ye>>2]=0;i=n[De>>0]|0;g=w+(me<<2)|0;if(i<<24>>24==2){i=s[g>>2]|0;if(!(me&Ze)){T=s[Ue>>2]|0;e=s[$e>>2]|0;y=T-i-e+-2|0;Rn(Fe+(y<<1)|0,t+(y+(te(me,s[Ge>>2]|0)|0)<<1)|0,pe,T-y|0,e);s[Ye>>2]=1;e=s[Ue>>2]|0;s[qe>>2]=e;y=1;T=n[De>>0]|0;m=i}else{y=0;T=2;m=i}}else{y=0;T=i}A=s[g>>2]|0;S=b+(me<<2)|0;E=s[S>>2]|0;g=(E|0)>1;i=ne((g?E:1)|0)|0;g=(g?E:1)<>16;v=536870911/(ue|0)|0;ce=v<<16;de=ce>>16;g=536870912-((te(ue,de)|0)+((te(g&65535,de)|0)>>16))<<3;v=ce+((te(g>>16,de)|0)+((te(g&65528,de)|0)>>16))+(te(g,(v>>15)+1>>1)|0)|0;i=62-i|0;g=i+-47|0;if((g|0)<1){_=47-i|0;i=-2147483648>>_;g=2147483647>>>_;if((i|0)>(g|0)){if((v|0)<=(i|0))i=(v|0)<(g|0)?g:v}else if((v|0)>(g|0))i=g;else i=(v|0)<(i|0)?i:v;i=i<<_}else i=(g|0)<32?v>>g:0;_=(i>>4)+1|0;g=_>>>1<<16>>16;_=(_>>16)+1>>1;k=s[Ge>>2]|0;v=0;while(1){if((v|0)>=(k|0))break;ce=r[o+(v<<1)>>1]|0;de=ce<<16>>16;s[He+(v<<2)>>2]=(te(de>>16,g)|0)+((te(ce&65535,g)|0)>>16)+(te(de,_)|0);v=v+1|0}e:do if(y|0){if(!me)i=(te(i>>16,_e)|0)+((te(i&65535,_e)|0)>>16)<<2;_=i>>16;i=i&65535;g=e-A+-2|0;while(1){if((g|0)>=(e|0))break e;de=r[Fe+(g<<1)>>1]|0;s[je+(g<<2)>>2]=(te(_,de)|0)+((te(i,de)|0)>>16);g=g+1|0}}while(0);g=s[Ke>>2]|0;if((E|0)==(g|0))i=T;else{if((g|0)<=0)if(!g)_=32;else{i=0-g|0;Qe=26}else{i=g;Qe=26}if((Qe|0)==26){Qe=0;_=ne(i|0)|0}e=g<<_+-1;if((E|0)<=0)if(!E)i=32;else{i=0-E|0;Qe=29}else{i=E;Qe=29}if((Qe|0)==29){Qe=0;i=ne(i|0)|0}i=i+-1|0;ce=E<>16|0)|0)<<16>>16;de=(te(e>>16,v)|0)+((te(e&65535,v)|0)>>16)|0;ce=Nr(ce|0,((ce|0)<0)<<31>>31|0,de|0,((de|0)<0)<<31>>31|0)|0;ce=Tr(ce|0,x|0,29)|0;e=e-(ce&-8)|0;v=de+((te(e>>16,v)|0)+((te(e&65535,v)|0)>>16))|0;i=_+28-i|0;e=i+-16|0;if((i|0)<16){g=16-i|0;i=-2147483648>>g;e=2147483647>>>g;if((i|0)>(e|0)){if((v|0)<=(i|0))i=(v|0)<(e|0)?e:v}else if((v|0)>(e|0))i=e;else i=(v|0)<(i|0)?i:v;g=i<>e:0;e=s[ze>>2]|0;_=g>>16;v=g&65535;i=e;e=e-(s[Ue>>2]|0)|0;while(1){if((e|0)>=(i|0))break;i=t+1280+(e<<2)|0;de=s[i>>2]|0;ce=de<<16>>16;s[i>>2]=(te(_,ce)|0)+((te(v,ce)|0)>>16)+(te(g,(de>>15)+1>>1)|0);i=s[ze>>2]|0;e=e+1|0}e:do if(T<<24>>24==2?(s[Ye>>2]|0)==0:0){e=s[qe>>2]|0;i=e-A+-2|0;while(1){if((i|0)>=(e|0))break e;de=je+(i<<2)|0;ce=s[de>>2]|0;ue=ce<<16>>16;s[de>>2]=(te(_,ue)|0)+((te(v,ue)|0)>>16)+(te(g,(ce>>15)+1>>1)|0);i=i+1|0}}while(0);i=s[xe>>2]|0;de=i<<16>>16;s[xe>>2]=(te(_,de)|0)+((te(v,de)|0)>>16)+(te(g,(i>>15)+1>>1)|0);i=s[Ce>>2]|0;de=i<<16>>16;s[Ce>>2]=(te(_,de)|0)+((te(v,de)|0)>>16)+(te(g,(i>>15)+1>>1)|0);i=0;while(1){if((i|0)==40){i=0;break}de=t+3840+(i<<2)|0;ce=s[de>>2]|0;ue=ce<<16>>16;s[de>>2]=(te(_,ue)|0)+((te(v,ue)|0)>>16)+(te(g,(ce>>15)+1>>1)|0);i=i+1|0}while(1){if((i|0)==24)break;de=t+4320+(i<<2)|0;ce=s[de>>2]|0;ue=ce<<16>>16;s[de>>2]=(te(_,ue)|0)+((te(v,ue)|0)>>16)+(te(g,(ce>>15)+1>>1)|0);i=i+1|0}s[Ke>>2]=s[S>>2];e=s[qe>>2]|0;E=s[S>>2]|0;i=n[De>>0]|0;k=s[Ge>>2]|0}V=s[p+(me<<2)>>2]|0;Z=s[Me>>2]|0;ae=s[$e>>2]|0;$=ae>>1;K=pe+2|0;X=pe+4|0;J=pe+6|0;Q=pe+8|0;ee=pe+10|0;ie=pe+12|0;re=pe+14|0;se=pe+16|0;oe=pe+18|0;ae=(ae|0)==16;le=pe+20|0;fe=pe+22|0;he=pe+24|0;ue=pe+26|0;ce=pe+28|0;de=pe+30|0;L=i<<24>>24==2;U=be+2|0;B=be+4|0;j=be+6|0;F=be+8|0;G=Z>>1;z=Z+-1|0;H=t+4320+(z<<2)|0;z=we+(z<<1)|0;q=s[d+(me<<2)>>2]<<16>>16;W=V<<16>>16;V=V>>16;Y=(m|0)>0;D=M<<16>>16;O=R>>16;N=E>>>6<<16>>16;P=(E>>21)+1>>1;i=e;I=0;e=je+(e-m+2<<2)|0;C=Re;v=t+1280+((s[ze>>2]|0)-m+1<<2)|0;while(1){if((I|0)>=(k|0))break;s[Xe>>2]=(te(s[Xe>>2]|0,196314165)|0)+907633515;R=s[C>>2]|0;M=r[pe>>1]|0;M=$+((te(R>>16,M)|0)+((te(R&65535,M)|0)>>16))|0;R=s[C+-4>>2]|0;i=r[K>>1]|0;i=M+((te(R>>16,i)|0)+((te(R&65535,i)|0)>>16))|0;R=s[C+-8>>2]|0;M=r[X>>1]|0;M=i+((te(R>>16,M)|0)+((te(R&65535,M)|0)>>16))|0;R=s[C+-12>>2]|0;i=r[J>>1]|0;i=M+((te(R>>16,i)|0)+((te(R&65535,i)|0)>>16))|0;R=s[C+-16>>2]|0;M=r[Q>>1]|0;M=i+((te(R>>16,M)|0)+((te(R&65535,M)|0)>>16))|0;R=s[C+-20>>2]|0;i=r[ee>>1]|0;i=M+((te(R>>16,i)|0)+((te(R&65535,i)|0)>>16))|0;R=s[C+-24>>2]|0;M=r[ie>>1]|0;M=i+((te(R>>16,M)|0)+((te(R&65535,M)|0)>>16))|0;R=s[C+-28>>2]|0;i=r[re>>1]|0;i=M+((te(R>>16,i)|0)+((te(R&65535,i)|0)>>16))|0;R=s[C+-32>>2]|0;M=r[se>>1]|0;M=i+((te(R>>16,M)|0)+((te(R&65535,M)|0)>>16))|0;R=s[C+-36>>2]|0;i=r[oe>>1]|0;i=M+((te(R>>16,i)|0)+((te(R&65535,i)|0)>>16))|0;if(ae){R=s[C+-40>>2]|0;M=r[le>>1]|0;M=i+((te(R>>16,M)|0)+((te(R&65535,M)|0)>>16))|0;R=s[C+-44>>2]|0;i=r[fe>>1]|0;i=M+((te(R>>16,i)|0)+((te(R&65535,i)|0)>>16))|0;R=s[C+-48>>2]|0;M=r[he>>1]|0;M=i+((te(R>>16,M)|0)+((te(R&65535,M)|0)>>16))|0;R=s[C+-52>>2]|0;i=r[ue>>1]|0;i=M+((te(R>>16,i)|0)+((te(R&65535,i)|0)>>16))|0;R=s[C+-56>>2]|0;M=r[ce>>1]|0;M=i+((te(R>>16,M)|0)+((te(R&65535,M)|0)>>16))|0;R=s[C+-60>>2]|0;i=r[de>>1]|0;i=M+((te(R>>16,i)|0)+((te(R&65535,i)|0)>>16))|0}if(L){R=s[e>>2]|0;M=r[be>>1]|0;M=(te(R>>16,M)|0)+((te(R&65535,M)|0)>>16)+2|0;R=s[e+-4>>2]|0;S=r[U>>1]|0;S=M+((te(R>>16,S)|0)+((te(R&65535,S)|0)>>16))|0;R=s[e+-8>>2]|0;M=r[B>>1]|0;M=S+((te(R>>16,M)|0)+((te(R&65535,M)|0)>>16))|0;R=s[e+-12>>2]|0;S=r[j>>1]|0;S=M+((te(R>>16,S)|0)+((te(R&65535,S)|0)>>16))|0;R=s[e+-16>>2]|0;M=r[F>>1]|0;M=S+((te(R>>16,M)|0)+((te(R&65535,M)|0)>>16))|0;R=e+4|0}else{M=0;R=e}S=s[Ce>>2]|0;_=s[Pe>>2]|0;s[Pe>>2]=S;g=r[we>>1]|0;e=2;g=G+((te(S>>16,g)|0)+((te(S&65535,g)|0)>>16))|0;while(1){if((e|0)>=(Z|0))break;E=e+-1|0;T=t+4320+(E<<2)|0;A=s[T>>2]|0;s[T>>2]=_;E=r[we+(E<<1)>>1]|0;T=t+4320+(e<<2)|0;S=s[T>>2]|0;s[T>>2]=A;E=E<<16>>16;T=r[we+(e<<1)>>1]|0;e=e+2|0;g=g+((te(_>>16,E)|0)+((te(_&65535,E)|0)>>16))+((te(A>>16,T)|0)+((te(A&65535,T)|0)>>16))|0;_=S}s[H>>2]=_;A=r[z>>1]|0;A=g+((te(_>>16,A)|0)+((te(_&65535,A)|0)>>16))<<1;T=s[xe>>2]|0;e=T>>16;T=T&65535;A=A+((te(e,q)|0)+((te(T,q)|0)>>16))|0;S=s[t+1280+((s[ze>>2]|0)+-1<<2)>>2]|0;T=(te(S>>16,W)|0)+((te(S&65535,W)|0)>>16)+(te(e,V)|0)+((te(T,V)|0)>>16)|0;e=(i<<2)-A-T|0;if(Y){y=(s[v>>2]|0)+(s[v+-8>>2]|0)|0;y=(te(y>>16,D)|0)+((te(y&65535,D)|0)>>16)|0;E=s[v+-4>>2]|0;S=v+4|0;e=M-(y+(te(E>>16,O)|0)+((te(E&65535,O)|0)>>16)<<1)+(e<<1)>>2}else{S=v;e=e>>1}E=He+(I<<2)|0;y=(s[E>>2]|0)-(e+1>>1)|0;y=(s[Xe>>2]|0)<0?0-y|0:y;y=(y|0)>30720?30720:(y|0)<-31744?-31744:y;e=y-Le|0;do if(Ie){if((e|0)>(Oe|0)){e=e-Oe|0;Qe=70;break}if((e|0)>=(Ne|0))if((e|0)<0){Qe=73;break}else{e=Le;g=ke;_=ye;v=Ee;break}else{e=e+Oe|0;Qe=70;break}}else Qe=70;while(0);e:do if((Qe|0)==70){Qe=0;e=e>>10;if((e|0)>0){_=(e<<10)+-80+Le|0;v=_+1024|0;e=_;g=v;_=te(_<<16>>16,ve)|0;v=te(v<<16>>16,ve)|0;break}switch(e|0){case 0:{e=Le;g=ke;_=ye;v=Ee;break e}case-1:{Qe=73;break e}default:{}}v=(e<<10|80)+Le|0;e=v;g=v+1024|0;_=te(0-v<<16>>16,ve)|0;v=te(-1024-v<<16>>16,ve)|0}while(0);if((Qe|0)==73){Qe=0;e=Ae;g=Le;_=Te;v=ye}tt=y-e<<16>>16;y=y-g<<16>>16;v=(v+(te(y,y)|0)|0)<(_+(te(tt,tt)|0)|0);v=v?g:e;e=a+I|0;n[e>>0]=((v>>>9)+1|0)>>>1;v=v<<4;M=((s[Xe>>2]|0)<0?0-v|0:v)+(M<<1)|0;i=M+(i<<4)|0;v=((te(i>>16,N)|0)+((te(i&65534,N)|0)>>16)+(te(i,P)|0)>>7)+1>>1;r[ge+(I<<1)>>1]=(v|0)>32767?32767:((v|0)<-32768?-32768:v)&65535;v=C+4|0;s[v>>2]=i;i=i-(s[E>>2]<<4)|0;s[Ce>>2]=i;i=i-(A<<2)|0;s[xe>>2]=i;s[t+1280+(s[ze>>2]<<2)>>2]=i-(T<<2);i=s[qe>>2]|0;s[je+(i<<2)>>2]=M<<1;s[ze>>2]=(s[ze>>2]|0)+1;i=i+1|0;s[qe>>2]=i;s[Xe>>2]=(s[Xe>>2]|0)+(n[e>>0]|0);I=I+1|0;e=R;C=v;v=S}Sr(Se|0,t+3840+(k<<2)|0,160)|0;tt=s[Ge>>2]|0;o=o+(tt<<1)|0;a=a+tt|0;e=i;me=me+1|0;ge=ge+(tt<<1)|0}s[Je>>2]=s[w+(i+-1<<2)>>2];Mr(t|0,t+(s[Be>>2]<<1)|0,s[Ue>>2]<<1|0)|0;Mr(t+1280|0,t+1280+(s[Be>>2]<<2)|0,s[Ue>>2]<<2|0)|0;u=et;return}function vn(e,t,i,a,l,f,h,c,d,p,b,w,m,g,_){e=e|0;t=t|0;i=i|0;a=a|0;l=l|0;f=f|0;h=h|0;c=c|0;d=d|0;p=p|0;b=b|0;w=w|0;m=m|0;g=g|0;_=_|0;var v=0,k=0,y=0,E=0,A=0,T=0,S=0,M=0,R=0,C=0,P=0,I=0,O=0,N=0,D=0,L=0,U=0,B=0,j=0,F=0,G=0,H=0,z=0,q=0,W=0,V=0,Y=0,Z=0,$=0,K=0,X=0,J=0,Q=0,ee=0,ie=0,re=0,se=0,oe=0,ae=0,le=0,fe=0,he=0,ue=0,ce=0,de=0,pe=0,be=0,we=0,me=0,ge=0,_e=0,ve=0;ge=u;u=u+176|0;he=ge+160|0;oe=ge;ue=t+4424|0;S=s[ue>>2]|0;re=e+4720|0;v=s[re>>2]|0;pe=u;u=u+((1*(v*1396|0)|0)+15&-16)|0;yr(pe|0,0,v*1396|0)|0;fe=i+34|0;be=t+4416|0;we=t+4420|0;me=e+4684|0;ce=t+3840|0;de=t+4320|0;k=0;while(1){if((k|0)>=(v|0))break;y=k+(o[fe>>0]|0)&3;s[pe+(k*1396|0)+1384>>2]=y;s[pe+(k*1396|0)+1388>>2]=y;s[pe+(k*1396|0)+1392>>2]=0;s[pe+(k*1396|0)+1376>>2]=s[be>>2];s[pe+(k*1396|0)+1380>>2]=s[we>>2];s[pe+(k*1396|0)+1120>>2]=s[t+1280+((s[me>>2]|0)+-1<<2)>>2];Sr(pe+(k*1396|0)|0,ce|0,160)|0;y=pe+(k*1396|0)+1280|0;A=de;T=y+96|0;do{s[y>>2]=s[A>>2];y=y+4|0;A=A+4|0}while((y|0)<(T|0));k=k+1|0}y=r[i+30>>1]|0;X=i+29|0;se=n[X>>0]|0;J=r[25404+(se<<24>>24>>1<<2)+((y&65535)<<24>>24<<1)>>1]|0;s[he>>2]=0;le=e+4680|0;E=s[le>>2]|0;v=(E|0)>40?40:E;e:do if(se<<24>>24!=2)if((S|0)>0){ee=S+-3|0;ee=(v|0)<(ee|0)?v:ee}else ee=v;else{i=s[e+4672>>2]|0;k=0;while(1){if((k|0)>=(i|0)){ee=v;break e}se=(s[m+(k<<2)>>2]|0)+-3|0;v=(v|0)<(se|0)?v:se;k=k+1|0}}while(0);G=(y&-256)<<16>>16!=1024&1;K=s[me>>2]|0;se=e+4676|0;Z=K+(s[se>>2]|0)|0;V=u;u=u+((1*(Z<<2)|0)+15&-16)|0;Y=u;u=u+((1*(Z<<1)|0)+15&-16)|0;Z=u;u=u+((1*(E<<2)|0)+15&-16)|0;Q=t+4432|0;s[Q>>2]=K;B=t+4428|0;s[B>>2]=s[me>>2];ie=e+4672|0;j=G^1;F=t+4444|0;G=G<<1^3;$=pe+1392|0;H=w+4|0;z=e+4732|0;q=t+4440|0;W=e+4728|0;U=e+4764|0;L=_<<16>>16;D=0;i=S;K=t+(K<<1)|0;k=0;while(1){if((D|0)>=(s[ie>>2]|0))break;P=f+((D>>1|j)<<4<<1)|0;I=h+(D*5<<1)|0;O=c+(D*24<<1)|0;N=s[d+(D<<2)>>2]|0;N=N>>2|N>>>1<<16;s[F>>2]=0;v=n[X>>0]|0;A=m+(D<<2)|0;if(v<<24>>24==2){E=s[A>>2]|0;if(!(D&G)){e:do if((D|0)==2){i=s[re>>2]|0;v=s[$>>2]|0;y=0;k=1;while(1){if((k|0)>=(i|0)){v=0;break}R=s[pe+(k*1396|0)+1392>>2]|0;C=(R|0)<(v|0);v=C?R:v;y=C?k:y;k=k+1|0}while(1){if((v|0)>=(i|0))break;if((v|0)!=(y|0)){C=pe+(v*1396|0)+1392|0;s[C>>2]=(s[C>>2]|0)+134217727}v=v+1|0}v=0;k=(s[he>>2]|0)+ee|0;while(1){if((v|0)>=(ee|0)){k=0;break e}C=(k+-1|0)%40|0;C=(C|0)<0?C+40|0:C;R=v-ee|0;n[l+R>>0]=(((s[pe+(y*1396|0)+640+(C<<2)>>2]|0)>>>9)+1|0)>>>1;S=s[pe+(y*1396|0)+800+(C<<2)>>2]|0;M=s[H>>2]|0;_=M<<16>>16;M=((te(S>>16,_)|0)+((te(S&65535,_)|0)>>16)+(te(S,(M>>15)+1>>1)|0)>>13)+1>>1;r[K+(R<<1)>>1]=(M|0)>32767?32767:((M|0)<-32768?-32768:M)&65535;s[t+1280+((s[Q>>2]|0)-ee+v<<2)>>2]=s[pe+(y*1396|0)+1120+(C<<2)>>2];v=v+1|0;k=C}}while(0);C=s[me>>2]|0;_=s[z>>2]|0;v=C-E-_+-2|0;Rn(Y+(v<<1)|0,t+(v+(te(D,s[le>>2]|0)|0)<<1)|0,P,C-v|0,_);s[B>>2]=s[me>>2];s[F>>2]=1;_=1;v=n[X>>0]|0;C=E;R=k}else{_=0;v=2;C=E;R=k}}else{_=0;C=i;R=k}k=s[re>>2]|0;S=s[A>>2]|0;M=w+(D<<2)|0;y=s[M>>2]|0;E=(y|0)>1;i=ne((E?y:1)|0)|0;E=(E?y:1)<>16;T=536870911/(_e|0)|0;A=T<<16;e=A>>16;E=536870912-((te(_e,e)|0)+((te(E&65535,e)|0)>>16))<<3;T=A+((te(E>>16,e)|0)+((te(E&65528,e)|0)>>16))+(te(E,(T>>15)+1>>1)|0)|0;i=62-i|0;E=i+-47|0;if((E|0)<1){A=47-i|0;i=-2147483648>>A;E=2147483647>>>A;if((i|0)>(E|0)){if((T|0)<=(i|0))i=(T|0)<(E|0)?E:T}else if((T|0)>(E|0))i=E;else i=(T|0)<(i|0)?i:T;E=i<>E:0;T=(E>>4)+1|0;A=T>>>1<<16>>16;T=(T>>16)+1>>1;i=s[le>>2]|0;e=0;while(1){if((e|0)>=(i|0))break;ve=r[a+(e<<1)>>1]|0;_e=ve<<16>>16;s[Z+(e<<2)>>2]=(te(_e>>16,A)|0)+((te(ve&65535,A)|0)>>16)+(te(_e,T)|0);e=e+1|0}e:do if(_|0){if(!D)E=(te(E>>16,L)|0)+((te(E&65535,L)|0)>>16)<<2;T=s[B>>2]|0;e=E>>16;E=E&65535;A=T-S+-2|0;while(1){if((A|0)>=(T|0))break e;ve=r[Y+(A<<1)>>1]|0;s[V+(A<<2)>>2]=(te(e,ve)|0)+((te(E,ve)|0)>>16);A=A+1|0}}while(0);E=s[q>>2]|0;if((y|0)!=(E|0)){if((E|0)<=0)if(!E)A=32;else{i=0-E|0;ae=46}else{i=E;ae=46}if((ae|0)==46){ae=0;A=ne(i|0)|0}E=E<>16|0)|0)<<16>>16;ve=(te(E>>16,T)|0)+((te(E&65535,T)|0)>>16)|0;y=Nr(y|0,((y|0)<0)<<31>>31|0,ve|0,((ve|0)<0)<<31>>31|0)|0;y=Tr(y|0,x|0,29)|0;y=E-(y&-8)|0;T=ve+((te(y>>16,T)|0)+((te(y&65535,T)|0)>>16))|0;i=A+28-i|0;y=i+-16|0;if((i|0)<16){E=16-i|0;i=-2147483648>>E;y=2147483647>>>E;if((i|0)>(y|0)){if((T|0)<=(i|0))i=(T|0)<(y|0)?y:T}else if((T|0)>(y|0))i=y;else i=(T|0)<(i|0)?i:T;E=i<>y:0;y=s[Q>>2]|0;A=E>>16;T=E&65535;i=y;y=y-(s[me>>2]|0)|0;while(1){if((y|0)>=(i|0))break;i=t+1280+(y<<2)|0;ve=s[i>>2]|0;_e=ve<<16>>16;s[i>>2]=(te(A,_e)|0)+((te(T,_e)|0)>>16)+(te(E,(ve>>15)+1>>1)|0);i=s[Q>>2]|0;y=y+1|0}e:do if(v<<24>>24==2?(s[F>>2]|0)==0:0){v=s[B>>2]|0;i=v-ee|0;v=v-S+-2|0;while(1){if((v|0)>=(i|0)){i=0;break e}ve=V+(v<<2)|0;_e=s[ve>>2]|0;S=_e<<16>>16;s[ve>>2]=(te(A,S)|0)+((te(T,S)|0)>>16)+(te(E,(_e>>15)+1>>1)|0);v=v+1|0}}else i=0;while(0);while(1){if((i|0)>=(k|0))break;v=pe+(i*1396|0)+1376|0;ve=s[v>>2]|0;_e=ve<<16>>16;s[v>>2]=(te(A,_e)|0)+((te(T,_e)|0)>>16)+(te(E,(ve>>15)+1>>1)|0);v=pe+(i*1396|0)+1380|0;ve=s[v>>2]|0;_e=ve<<16>>16;s[v>>2]=(te(A,_e)|0)+((te(T,_e)|0)>>16)+(te(E,(ve>>15)+1>>1)|0);v=0;while(1){if((v|0)==40){v=0;break}ve=pe+(i*1396|0)+(v<<2)|0;_e=s[ve>>2]|0;S=_e<<16>>16;s[ve>>2]=(te(A,S)|0)+((te(T,S)|0)>>16)+(te(E,(_e>>15)+1>>1)|0);v=v+1|0}while(1){if((v|0)==24){v=0;break}ve=pe+(i*1396|0)+1280+(v<<2)|0;_e=s[ve>>2]|0;S=_e<<16>>16;s[ve>>2]=(te(A,S)|0)+((te(T,S)|0)>>16)+(te(E,(_e>>15)+1>>1)|0);v=v+1|0}while(1){if((v|0)==40)break;ve=pe+(i*1396|0)+960+(v<<2)|0;_e=s[ve>>2]|0;S=_e<<16>>16;s[ve>>2]=(te(A,S)|0)+((te(T,S)|0)>>16)+(te(E,(_e>>15)+1>>1)|0);ve=pe+(i*1396|0)+1120+(v<<2)|0;_e=s[ve>>2]|0;S=_e<<16>>16;s[ve>>2]=(te(A,S)|0)+((te(T,S)|0)>>16)+(te(E,(_e>>15)+1>>1)|0);v=v+1|0}i=i+1|0}s[q>>2]=s[M>>2];v=n[X>>0]|0;y=s[M>>2]|0;i=s[le>>2]|0;k=s[re>>2]|0}kn(t,pe,v<<24>>24,Z,l,K,V,oe,P,I,O,C,N,s[p+(D<<2)>>2]|0,s[b+(D<<2)>>2]|0,y,g,J,i,R,s[W>>2]|0,s[z>>2]|0,s[U>>2]|0,k,he,ee);k=s[le>>2]|0;a=a+(k<<1)|0;l=l+k|0;D=D+1|0;i=C;K=K+(k<<1)|0;k=R+1|0}i=s[re>>2]|0;v=s[$>>2]|0;E=0;k=1;while(1){if((k|0)>=(i|0))break;_e=s[pe+(k*1396|0)+1392>>2]|0;ve=(_e|0)<(v|0);v=ve?_e:v;E=ve?k:E;k=k+1|0}n[fe>>0]=s[pe+(E*1396|0)+1388>>2];i=s[w+((s[ie>>2]|0)+-1<<2)>>2]|0;k=i>>>6<<16>>16;i=(i>>21)+1>>1;y=0;v=(s[he>>2]|0)+ee|0;while(1){if((y|0)>=(ee|0))break;ve=(v+-1|0)%40|0;ve=(ve|0)<0?ve+40|0:ve;_e=y-ee|0;n[l+_e>>0]=(((s[pe+(E*1396|0)+640+(ve<<2)>>2]|0)>>>9)+1|0)>>>1;he=s[pe+(E*1396|0)+800+(ve<<2)>>2]|0;he=((te(he>>16,k)|0)+((te(he&65535,k)|0)>>16)+(te(he,i)|0)>>7)+1>>1;r[K+(_e<<1)>>1]=(he|0)>32767?32767:((he|0)<-32768?-32768:he)&65535;s[t+1280+((s[Q>>2]|0)-ee+y<<2)>>2]=s[pe+(E*1396|0)+1120+(ve<<2)>>2];y=y+1|0;v=ve}Sr(ce|0,pe+(E*1396|0)+(s[le>>2]<<2)|0,160)|0;y=de;A=pe+(E*1396|0)+1280|0;T=y+96|0;do{s[y>>2]=s[A>>2];y=y+4|0;A=A+4|0}while((y|0)<(T|0));s[be>>2]=s[pe+(E*1396|0)+1376>>2];s[we>>2]=s[pe+(E*1396|0)+1380>>2];s[ue>>2]=s[m+((s[ie>>2]|0)+-1<<2)>>2];Mr(t|0,t+(s[se>>2]<<1)|0,s[me>>2]<<1|0)|0;Mr(t+1280|0,t+1280+(s[se>>2]<<2)|0,s[me>>2]<<2|0)|0;u=ge;return}function kn(e,t,i,o,a,l,f,h,c,d,p,b,w,m,g,_,v,k,y,E,A,T,S,M,R,C){e=e|0;t=t|0;i=i|0;o=o|0;a=a|0;l=l|0;f=f|0;h=h|0;c=c|0;d=d|0;p=p|0;b=b|0;w=w|0;m=m|0;g=g|0;_=_|0;v=v|0;k=k|0;y=y|0;E=E|0;A=A|0;T=T|0;S=S|0;M=M|0;R=R|0;C=C|0;var P=0,x=0,I=0,O=0,N=0,D=0,L=0,U=0,B=0,j=0,F=0,G=0,H=0,z=0,q=0,W=0,V=0,Y=0,Z=0,$=0,K=0,X=0,J=0,Q=0,ee=0,ie=0,ne=0,re=0,se=0,oe=0,ae=0,le=0,fe=0,he=0,ue=0,ce=0,de=0,pe=0,be=0,we=0,me=0,ge=0,_e=0,ve=0,ke=0,ye=0,Ee=0,Ae=0,Te=0,Se=0,Me=0,Re=0,Ce=0,Pe=0,xe=0,Ie=0,Oe=0,Ne=0,De=0,Le=0,Ue=0;Ne=u;Pe=u;u=u+((1*(M*56|0)|0)+15&-16)|0;xe=e+4432|0;Ie=e+4428|0;Ce=_>>6;ye=(i|0)==2;Ee=d+2|0;Ae=d+4|0;Te=d+6|0;Se=d+8|0;Me=(b|0)>0;Re=w<<16>>16;ue=w>>16;ce=T>>1;de=c+2|0;pe=c+4|0;be=c+6|0;we=c+8|0;me=c+10|0;ge=c+12|0;_e=c+14|0;ve=c+16|0;ke=c+18|0;re=(T|0)==16;se=c+20|0;oe=c+22|0;ae=c+24|0;le=c+26|0;fe=c+28|0;he=c+30|0;Q=S<<16>>16;ee=A>>1;ie=A+-1|0;ne=p+(ie<<1)|0;X=m<<16>>16;J=g<<16>>16;Y=g>>16;Z=(v|0)>2048;K=(v|0)/2|0;$=K+-512|0;K=512-K|0;j=v<<16>>16;F=k+944|0;G=te(k<<16>>16,j)|0;H=te(F<<16>>16,j)|0;z=k+-944|0;q=te(944-k<<16>>16,j)|0;W=Pe+4|0;V=Pe+32|0;U=(E|0)<1;B=0;_=f+((s[Ie>>2]|0)-b+2<<2)|0;i=e+1280+((s[xe>>2]|0)-b+1<<2)|0;while(1){if((B|0)>=(y|0)){_=0;break}if(ye){D=s[_>>2]|0;N=r[d>>1]|0;N=(te(D>>16,N)|0)+((te(D&65535,N)|0)>>16)+2|0;D=s[_+-4>>2]|0;L=r[Ee>>1]|0;L=N+((te(D>>16,L)|0)+((te(D&65535,L)|0)>>16))|0;D=s[_+-8>>2]|0;N=r[Ae>>1]|0;N=L+((te(D>>16,N)|0)+((te(D&65535,N)|0)>>16))|0;D=s[_+-12>>2]|0;L=r[Te>>1]|0;L=N+((te(D>>16,L)|0)+((te(D&65535,L)|0)>>16))|0;D=s[_+-16>>2]|0;N=r[Se>>1]|0;N=L+((te(D>>16,N)|0)+((te(D&65535,N)|0)>>16))<<1;D=_+4|0}else{N=0;D=_}if(Me){L=(s[i>>2]|0)+(s[i+-8>>2]|0)|0;L=(te(L>>16,Re)|0)+((te(L&65535,Re)|0)>>16)|0;O=s[i+-4>>2]|0;O=N-(L+(te(O>>16,ue)|0)+((te(O&65535,ue)|0)>>16)<<2)|0;L=i+4|0}else{O=0;L=i}P=B+39|0;x=o+(B<<2)|0;I=0;while(1){if((I|0)>=(M|0))break;S=t+(I*1396|0)+1384|0;s[S>>2]=(te(s[S>>2]|0,196314165)|0)+907633515;_=t+(I*1396|0)+(P<<2)|0;b=s[_>>2]|0;E=r[c>>1]|0;E=ce+((te(b>>16,E)|0)+((te(b&65535,E)|0)>>16))|0;b=s[_+-4>>2]|0;i=r[de>>1]|0;i=E+((te(b>>16,i)|0)+((te(b&65535,i)|0)>>16))|0;b=s[_+-8>>2]|0;E=r[pe>>1]|0;E=i+((te(b>>16,E)|0)+((te(b&65535,E)|0)>>16))|0;b=s[_+-12>>2]|0;i=r[be>>1]|0;i=E+((te(b>>16,i)|0)+((te(b&65535,i)|0)>>16))|0;b=s[_+-16>>2]|0;E=r[we>>1]|0;E=i+((te(b>>16,E)|0)+((te(b&65535,E)|0)>>16))|0;b=s[_+-20>>2]|0;i=r[me>>1]|0;i=E+((te(b>>16,i)|0)+((te(b&65535,i)|0)>>16))|0;b=s[_+-24>>2]|0;E=r[ge>>1]|0;E=i+((te(b>>16,E)|0)+((te(b&65535,E)|0)>>16))|0;b=s[_+-28>>2]|0;i=r[_e>>1]|0;i=E+((te(b>>16,i)|0)+((te(b&65535,i)|0)>>16))|0;b=s[_+-32>>2]|0;E=r[ve>>1]|0;E=i+((te(b>>16,E)|0)+((te(b&65535,E)|0)>>16))|0;b=s[_+-36>>2]|0;i=r[ke>>1]|0;i=E+((te(b>>16,i)|0)+((te(b&65535,i)|0)>>16))|0;if(re){b=s[_+-40>>2]|0;E=r[se>>1]|0;E=i+((te(b>>16,E)|0)+((te(b&65535,E)|0)>>16))|0;b=s[_+-44>>2]|0;i=r[oe>>1]|0;i=E+((te(b>>16,i)|0)+((te(b&65535,i)|0)>>16))|0;b=s[_+-48>>2]|0;E=r[ae>>1]|0;E=i+((te(b>>16,E)|0)+((te(b&65535,E)|0)>>16))|0;b=s[_+-52>>2]|0;i=r[le>>1]|0;i=E+((te(b>>16,i)|0)+((te(b&65535,i)|0)>>16))|0;b=s[_+-56>>2]|0;E=r[fe>>1]|0;E=i+((te(b>>16,E)|0)+((te(b&65535,E)|0)>>16))|0;b=s[_+-60>>2]|0;i=r[he>>1]|0;i=E+((te(b>>16,i)|0)+((te(b&65535,i)|0)>>16))|0}w=t+(I*1396|0)+1280|0;_=s[w>>2]|0;b=(s[t+(I*1396|0)+1380>>2]|0)+((te(_>>16,Q)|0)+((te(_&65535,Q)|0)>>16))|0;T=(s[t+(I*1396|0)+1284>>2]|0)-b|0;T=_+((te(T>>16,Q)|0)+((te(T&65535,Q)|0)>>16))|0;s[w>>2]=b;w=r[p>>1]|0;_=2;w=ee+((te(b>>16,w)|0)+((te(b&65535,w)|0)>>16))|0;while(1){if((_|0)>=(A|0))break;m=_+-1|0;b=t+(I*1396|0)+1280+(m<<2)|0;v=t+(I*1396|0)+1280+(_<<2)|0;E=s[v>>2]|0;g=E-T|0;g=(s[b>>2]|0)+((te(g>>16,Q)|0)+((te(g&65535,Q)|0)>>16))|0;s[b>>2]=T;m=r[p+(m<<1)>>1]|0;b=s[t+(I*1396|0)+1280+((_|1)<<2)>>2]|0;s[v>>2]=g;m=m<<16>>16;v=r[p+(_<<1)>>1]|0;b=b-g|0;_=_+2|0;w=w+((te(T>>16,m)|0)+((te(T&65535,m)|0)>>16))+((te(g>>16,v)|0)+((te(g&65535,v)|0)>>16))|0;T=E+((te(b>>16,Q)|0)+((te(b&65535,Q)|0)>>16))|0}b=i<<4;s[t+(I*1396|0)+1280+(ie<<2)>>2]=T;g=r[ne>>1]|0;g=w+((te(T>>16,g)|0)+((te(T&65535,g)|0)>>16))<<1;v=s[t+(I*1396|0)+1376>>2]|0;E=v>>16;v=v&65535;g=g+((te(E,X)|0)+((te(v,X)|0)>>16))<<2;m=s[t+(I*1396|0)+1120+(s[R>>2]<<2)>>2]|0;v=(te(m>>16,J)|0)+((te(m&65535,J)|0)>>16)+(te(E,Y)|0)+((te(v,Y)|0)>>16)<<2;E=s[x>>2]|0;m=E-((O+b-(g+v)>>3)+1>>1)|0;S=(s[S>>2]|0)<0;m=S?0-m|0:m;m=(m|0)>30720?30720:(m|0)<-31744?-31744:m;_=m-k|0;do if(Z){if((_|0)>($|0)){_=_-$|0;Oe=20;break}if((_|0)>=(K|0))if((_|0)<0){Oe=23;break}else{_=k;i=F;w=G;T=H;break}else{_=_+$|0;Oe=20;break}}else Oe=20;while(0);e:do if((Oe|0)==20){Oe=0;_=_>>10;if((_|0)>0){w=(_<<10)+-80+k|0;T=w+1024|0;_=w;i=T;w=te(w<<16>>16,j)|0;T=te(T<<16>>16,j)|0;break}switch(_|0){case 0:{_=k;i=F;w=G;T=H;break e}case-1:{Oe=23;break e}default:{}}T=(_<<10|80)+k|0;_=T;i=T+1024|0;w=te(0-T<<16>>16,j)|0;T=te(-1024-T<<16>>16,j)|0}while(0);if((Oe|0)==23){Oe=0;_=z;i=k;w=q;T=G}De=m-_<<16>>16;De=w+(te(De,De)|0)>>10;m=m-i<<16>>16;m=T+(te(m,m)|0)>>10;Le=(De|0)<(m|0);Ue=s[t+(I*1396|0)+1392>>2]|0;w=Le?_:i;T=Le?i:_;s[Pe+(I*56|0)+4>>2]=Ue+(Le?De:m);s[Pe+(I*56|0)+32>>2]=Ue+(Le?m:De);s[Pe+(I*56|0)>>2]=w;s[Pe+(I*56|0)+28>>2]=T;i=w<<4;i=(S?0-i|0:i)+N|0;w=i+b|0;m=E<<4;E=w-m|0;s[Pe+(I*56|0)+16>>2]=E;E=E-g|0;s[Pe+(I*56|0)+20>>2]=E-v;s[Pe+(I*56|0)+12>>2]=E;s[Pe+(I*56|0)+24>>2]=i;s[Pe+(I*56|0)+8>>2]=w;E=T<<4;E=(S?0-E|0:E)+N|0;b=E+b|0;m=b-m|0;s[Pe+(I*56|0)+44>>2]=m;g=m-g|0;s[Pe+(I*56|0)+48>>2]=g-v;s[Pe+(I*56|0)+40>>2]=g;s[Pe+(I*56|0)+52>>2]=E;s[Pe+(I*56|0)+36>>2]=b;I=I+1|0}_=((s[R>>2]|0)+-1|0)%40|0;g=(_|0)<0;i=_+40|0;s[R>>2]=g?i:_;_=(g?i:_)+C|0;i=s[W>>2]|0;g=0;w=1;while(1){if((w|0)>=(M|0))break;Le=s[Pe+(w*56|0)+4>>2]|0;Ue=(Le|0)<(i|0);i=Ue?Le:i;g=Ue?w:g;w=w+1|0}m=(_|0)%40|0;_=s[t+(g*1396|0)+480+(m<<2)>>2]|0;i=0;while(1){if((i|0)>=(M|0))break;if((s[t+(i*1396|0)+480+(m<<2)>>2]|0)!=(_|0)){Ue=Pe+(i*56|0)+4|0;s[Ue>>2]=(s[Ue>>2]|0)+134217727;Ue=Pe+(i*56|0)+32|0;s[Ue>>2]=(s[Ue>>2]|0)+134217727}i=i+1|0}_=s[W>>2]|0;i=0;w=s[V>>2]|0;T=0;S=1;while(1){if((S|0)>=(M|0))break;N=s[Pe+(S*56|0)+4>>2]|0;De=(N|0)>(_|0);Le=s[Pe+(S*56|0)+32>>2]|0;Ue=(Le|0)<(w|0);_=De?N:_;i=De?S:i;w=Ue?Le:w;T=Ue?S:T;S=S+1|0}if((w|0)<(_|0)){Sr(t+(i*1396|0)+(B<<2)|0,t+(T*1396|0)+(B<<2)|0,1396-(B<<2)|0)|0;Ue=Pe+(i*56|0)|0;Le=Pe+(T*56|0)+28|0;s[Ue>>2]=s[Le>>2];s[Ue+4>>2]=s[Le+4>>2];s[Ue+8>>2]=s[Le+8>>2];s[Ue+12>>2]=s[Le+12>>2];s[Ue+16>>2]=s[Le+16>>2];s[Ue+20>>2]=s[Le+20>>2];s[Ue+24>>2]=s[Le+24>>2]}if(!(U&(B|0)<(C|0))){Ue=B-C|0;n[a+Ue>>0]=(((s[t+(g*1396|0)+640+(m<<2)>>2]|0)>>>9)+1|0)>>>1;De=s[t+(g*1396|0)+800+(m<<2)>>2]|0;Le=s[h+(m<<2)>>2]|0;N=Le<<16>>16;Le=((te(De>>16,N)|0)+((te(De&65535,N)|0)>>16)+(te(De,(Le>>15)+1>>1)|0)>>7)+1>>1;r[l+(Ue<<1)>>1]=(Le|0)>32767?32767:((Le|0)<-32768?-32768:Le)&65535;s[e+1280+((s[xe>>2]|0)-C<<2)>>2]=s[t+(g*1396|0)+1120+(m<<2)>>2];s[f+((s[Ie>>2]|0)-C<<2)>>2]=s[t+(g*1396|0)+960+(m<<2)>>2]}s[xe>>2]=(s[xe>>2]|0)+1;s[Ie>>2]=(s[Ie>>2]|0)+1;_=B+40|0;i=0;while(1){if((i|0)>=(M|0))break;s[t+(i*1396|0)+1376>>2]=s[Pe+(i*56|0)+12>>2];s[t+(i*1396|0)+1380>>2]=s[Pe+(i*56|0)+16>>2];Ue=s[Pe+(i*56|0)+8>>2]|0;s[t+(i*1396|0)+(_<<2)>>2]=Ue;s[t+(i*1396|0)+800+(s[R>>2]<<2)>>2]=Ue;Ue=s[Pe+(i*56|0)>>2]|0;s[t+(i*1396|0)+640+(s[R>>2]<<2)>>2]=Ue;s[t+(i*1396|0)+960+(s[R>>2]<<2)>>2]=s[Pe+(i*56|0)+24>>2]<<1;s[t+(i*1396|0)+1120+(s[R>>2]<<2)>>2]=s[Pe+(i*56|0)+20>>2];Le=t+(i*1396|0)+1384|0;Ue=(s[Le>>2]|0)+((Ue>>9)+1>>1)|0;s[Le>>2]=Ue;s[t+(i*1396|0)+480+(s[R>>2]<<2)>>2]=Ue;s[t+(i*1396|0)+1392>>2]=s[Pe+(i*56|0)+4>>2];i=i+1|0}s[h+(s[R>>2]<<2)>>2]=Ce;B=B+1|0;_=D;i=L}while(1){if((_|0)>=(M|0))break;Sr(t+(_*1396|0)|0,t+(_*1396|0)+(y<<2)|0,160)|0;_=_+1|0}u=Ne;return}function yn(e,t,i){e=e|0;t=t|0;i=i|0;var o=0,l=0,f=0,h=0,c=0,d=0,p=0,b=0,w=0,m=0,g=0,_=0,v=0,k=0,y=0,E=0,A=0,T=0,S=0,M=0,R=0,C=0,P=0,x=0,I=0,O=0,N=0,D=0,L=0,U=0,B=0,j=0,F=0,G=0,H=0,z=0;z=u;u=u+64|0;h=z+20|0;c=z+16|0;l=z+12|0;f=z+8|0;H=z+24|0;o=z;N=e+2336|0;b=s[N>>2]|0;G=e+2328|0;D=u;u=u+((1*(b+(s[G>>2]|0)<<2)|0)+15&-16)|0;g=u;u=u+((1*(b<<1)|0)+15&-16)|0;s[o>>2]=s[e+4240>>2]>>6;b=e+4244|0;B=s[b>>2]|0;U=B>>6;s[o+4>>2]=U;if(s[e+2376>>2]|0){p=e+4182|0;d=p+32|0;do{r[p>>1]=0;p=p+2|0}while((p|0)<(d|0))}I=e+2332|0;O=e+2324|0;En(l,h,f,c,e+4|0,o,s[I>>2]|0,s[O>>2]|0);o=s[e+4252>>2]|0;if((s[l>>2]>>s[c>>2]|0)<(s[f>>2]>>s[h>>2]|0)){o=te(o+-1|0,s[e+4256>>2]|0)|0;o=(o|0)<128?0:o+-128|0}else{o=te(o,s[e+4256>>2]|0)|0;o=(o|0)<128?0:o+-128|0}x=e+4+(o<<2)|0;M=e+4172|0;j=e+4224|0;d=r[j>>1]|0;h=e+4160|0;p=s[h>>2]|0;F=(p|0)>1;m=r[25776+((F?1:p)<<1)>>1]|0;c=e+4164|0;p=r[((s[c>>2]|0)==2?25780:25784)+((F?1:p)<<1)>>1]|0;F=e+2340|0;l=(s[F>>2]|0)+-1|0;o=64881;f=0;while(1){if((f|0)>=(l|0))break;L=e+4182+(f<<1)|0;r[L>>1]=(((te(o,r[L>>1]|0)|0)>>>15)+1|0)>>>1;o=o+(((te(o,-655)|0)>>15)+1>>1)|0;f=f+1|0}f=e+4182+(l<<1)|0;r[f>>1]=(((te(o,r[f>>1]|0)|0)>>>15)+1|0)>>>1;o=e+4182|0;f=s[F>>2]|0;Sr(H|0,o|0,f<<1|0)|0;do if(!(s[h>>2]|0)){if((s[c>>2]|0)==2){o=0;l=16384;while(1){if((o|0)==5)break;L=(l&65535)-(a[e+4172+(o<<1)>>1]|0)&65535;o=o+1|0;l=L}d=(te((l<<16>>16<3277?3277:l)<<16>>16,r[e+4236>>1]|0)|0)>>>14&65535;break}o=Cn(o,f)|0;if((o|0)<=134217728)if((o|0)<4194304)o=4194304;else w=16;else{o=134217728;w=16}d=o<<3;p=(te(d>>16,p)|0)+((te(d&65528,p)|0)>>16)>>14;d=16384}while(0);L=e+4220|0;A=s[L>>2]|0;S=e+4168|0;E=(s[S>>2]>>7)+1>>1;T=s[N>>2]|0;c=T-E-f+-2|0;Rn(g+(c<<1)|0,e+1348+(c<<1)|0,H,T-c|0,f);l=s[b>>2]|0;if((l|0)<=0)if(!l)o=32;else{o=0-l|0;w=20}else{o=l;w=20}if((w|0)==20)o=ne(o|0)|0;l=l<>16;h=536870911/(R|0)|0;C=h<<16;P=C>>16;l=536870912-((te(R,P)|0)+((te(l&65535,P)|0)>>16))<<3;h=C+((te(l>>16,P)|0)+((te(l&65528,P)|0)>>16))+(te(l,(h>>15)+1>>1)|0)|0;o=62-o|0;l=o+-46|0;if((l|0)>=1)if((l|0)<32){o=h>>l;w=30}else o=0;else{f=46-o|0;o=-2147483648>>f;l=2147483647>>>f;if((o|0)>(l|0)){if((h|0)<=(o|0))o=(h|0)<(l|0)?l:h}else if((h|0)>(l|0))o=l;else o=(h|0)<(o|0)?o:h;o=o<>2]|0;h=o>>16;l=o&65535;o=c+(s[F>>2]|0)|0;while(1){if((o|0)>=(f|0))break;P=r[g+(o<<1)>>1]|0;s[D+(o<<2)>>2]=(te(h,P)|0)+((te(l,P)|0)>>16);o=o+1|0}_=e+4174|0;v=e+4176|0;k=e+4178|0;y=e+4180|0;w=m<<16>>16;m=e+2765|0;g=e+2316|0;p=p<<16>>16;b=0;P=E;C=d;R=A;l=T;while(1){if((b|0)>=(s[O>>2]|0))break;c=C<<16>>16;f=s[I>>2]|0;h=0;o=D+(l-P+2<<2)|0;d=R;while(1){if((h|0)>=(f|0)){o=0;break}P=s[o>>2]|0;T=r[M>>1]|0;T=(te(P>>16,T)|0)+((te(P&65535,T)|0)>>16)+2|0;P=s[o+-4>>2]|0;R=r[_>>1]|0;R=T+((te(P>>16,R)|0)+((te(P&65535,R)|0)>>16))|0;P=s[o+-8>>2]|0;T=r[v>>1]|0;T=R+((te(P>>16,T)|0)+((te(P&65535,T)|0)>>16))|0;P=s[o+-12>>2]|0;R=r[k>>1]|0;R=T+((te(P>>16,R)|0)+((te(P&65535,R)|0)>>16))|0;P=s[o+-16>>2]|0;T=r[y>>1]|0;T=R+((te(P>>16,T)|0)+((te(P&65535,T)|0)>>16))|0;P=(te(d,196314165)|0)+907633515|0;R=s[x+(P>>>25<<2)>>2]|0;s[D+(l<<2)>>2]=T+((te(R>>16,c)|0)+((te(R&65535,c)|0)>>16))<<2;h=h+1|0;o=o+4|0;d=P;l=l+1|0}while(1){if((o|0)==5)break;P=e+4172+(o<<1)|0;r[P>>1]=(te(w,r[P>>1]|0)|0)>>>15;o=o+1|0}if(!(n[m>>0]|0))o=C;else o=(te(c,p)|0)>>>15&65535;C=s[S>>2]|0;C=C+(((C>>16)*655|0)+(((C&65535)*655|0)>>>16))|0;s[S>>2]=C;P=(s[g>>2]<<16>>16)*4608|0;P=(C|0)<(P|0)?C:P;s[S>>2]=P;b=b+1|0;P=(P>>7)+1>>1;C=o;R=d}M=D+((s[N>>2]|0)+-16<<2)|0;S=e+1284|0;p=M;o=S;d=p+64|0;do{s[p>>2]=s[o>>2];p=p+4|0;o=o+4|0}while((p|0)<(d|0));w=r[H>>1]|0;m=r[H+2>>1]|0;g=r[H+4>>1]|0;_=r[H+6>>1]|0;v=r[H+8>>1]|0;k=r[H+10>>1]|0;y=r[H+12>>1]|0;E=r[H+14>>1]|0;A=r[H+16>>1]|0;T=r[H+18>>1]|0;b=U<<16>>16;d=(B>>21)+1>>1;p=0;while(1){o=s[G>>2]|0;if((p|0)>=(o|0))break;o=s[M+(p+15<<2)>>2]|0;o=(s[F>>2]>>1)+((te(o>>16,w)|0)+((te(o&65535,w)|0)>>16))|0;c=s[M+(p+14<<2)>>2]|0;c=o+((te(c>>16,m)|0)+((te(c&65535,m)|0)>>16))|0;o=s[M+(p+13<<2)>>2]|0;o=c+((te(o>>16,g)|0)+((te(o&65535,g)|0)>>16))|0;c=s[M+(p+12<<2)>>2]|0;c=o+((te(c>>16,_)|0)+((te(c&65535,_)|0)>>16))|0;o=s[M+(p+11<<2)>>2]|0;o=c+((te(o>>16,v)|0)+((te(o&65535,v)|0)>>16))|0;c=s[M+(p+10<<2)>>2]|0;c=o+((te(c>>16,k)|0)+((te(c&65535,k)|0)>>16))|0;o=s[M+(p+9<<2)>>2]|0;o=c+((te(o>>16,y)|0)+((te(o&65535,y)|0)>>16))|0;c=s[M+(p+8<<2)>>2]|0;c=o+((te(c>>16,E)|0)+((te(c&65535,E)|0)>>16))|0;o=s[M+(p+7<<2)>>2]|0;o=c+((te(o>>16,A)|0)+((te(o&65535,A)|0)>>16))|0;c=s[M+(p+6<<2)>>2]|0;c=o+((te(c>>16,T)|0)+((te(c&65535,T)|0)>>16))|0;o=s[F>>2]|0;l=p+16|0;f=10;while(1){if((f|0)>=(o|0))break;U=s[M+(l-f+-1<<2)>>2]|0;B=r[H+(f<<1)>>1]|0;c=c+((te(U>>16,B)|0)+((te(U&65535,B)|0)>>16))|0;f=f+1|0}h=M+(l<<2)|0;o=s[h>>2]|0;l=(c|0)>134217727;f=l?2147483632:((c|0)<-134217728?-134217728:c)<<4;if((o+(l?2147483632:((c|0)<-134217728?-134217728:c)<<4)|0)>-1)if((o&f|0)<0)o=-2147483648;else o=o+(l?2147483632:((c|0)<-134217728?-134217728:c)<<4)|0;else if((o|f|0)>-1)o=2147483647;else o=o+(l?2147483632:((c|0)<-134217728?-134217728:c)<<4)|0;s[h>>2]=o;B=((te(o>>16,b)|0)+((te(o&65535,b)|0)>>16)+(te(o,d)|0)>>7)+1>>1;r[i+(p<<1)>>1]=(B|0)>32767?32767:((B|0)<-32768?-32768:B)&65535;p=p+1|0}p=S;o=M+(o<<2)|0;d=p+64|0;do{s[p>>2]=s[o>>2];p=p+4|0;o=o+4|0}while((p|0)<(d|0));s[L>>2]=R;r[j>>1]=C;o=0;while(1){if((o|0)==4)break;s[t+(o<<2)>>2]=P;o=o+1|0}u=z;return}function En(e,t,i,n,o,a,l,f){e=e|0;t=t|0;i=i|0;n=n|0;o=o|0;a=a|0;l=l|0;f=f|0;var h=0,c=0,d=0,p=0,b=0,w=0,m=0,g=0,_=0,v=0;m=u;h=u;u=u+((1*(l<<1<<1)|0)+15&-16)|0;p=h;w=0;while(1){if((w|0)==2)break;c=te(w+f+-2|0,l)|0;d=a+(w<<2)|0;b=0;while(1){if((b|0)>=(l|0))break;_=s[o+(b+c<<2)>>2]|0;g=s[d>>2]|0;v=g<<16>>16;g=(te(_>>16,v)|0)+((te(_&65535,v)|0)>>16)+(te(_,(g>>15)+1>>1)|0)>>8;r[p+(b<<1)>>1]=(g|0)>32767?32767:((g|0)<-32768?-32768:g)&65535;b=b+1|0}p=p+(l<<1)|0;w=w+1|0}Dn(e,t,h,l);Dn(i,n,h+(l<<1)|0,l);u=m;return}function An(e,t){e=e|0;t=t|0;var i=0,n=0,o=0,l=0,f=0,h=0,c=0,d=0,p=0,b=0,w=0,m=0,g=0,_=0,v=0,k=0,y=0;k=u;u=u+48|0;g=k+32|0;v=k+16|0;w=k;_=e+4676|0;h=s[_>>2]|0;d=h>>1;i=h>>2;o=h>>3;s[w>>2]=0;p=o+i|0;s[w+4>>2]=p;c=p+o|0;s[w+8>>2]=c;f=c+i|0;s[w+12>>2]=f;b=u;u=u+((1*(f+d<<1)|0)+15&-16)|0;Sn(t,e+32|0,b,b+(f<<1)|0,h);Sn(b,e+40|0,b,b+(c<<1)|0,d);Sn(b,e+48|0,b,b+(p<<1)|0,i);i=b+(o+-1<<1)|0;t=r[i>>1]>>1;r[i>>1]=t;i=t;while(1){n=o+-1|0;if((o|0)<=1)break;d=b+(o+-2<<1)|0;p=r[d>>1]>>1;r[d>>1]=p;r[b+(n<<1)>>1]=(i&65535)-(p&65535);i=p;o=n}c=e+88|0;r[b>>1]=(a[b>>1]|0)-(a[c>>1]|0);r[c>>1]=t;c=0;i=0;while(1){if((c|0)==4)break;o=4-c|0;o=s[_>>2]>>((o|0)<3?o:3)>>2;l=e+56+(c<<2)|0;t=s[l>>2]|0;f=g+(c<<2)|0;s[f>>2]=t;h=w+(c<<2)|0;d=0;p=0;while(1){if((p|0)==4)break;else{n=0;i=0}while(1){if((n|0)>=(o|0))break;y=r[b+((s[h>>2]|0)+n+d<<1)>>1]>>3;n=n+1|0;i=i+(te(y,y)|0)|0}if((p|0)<3){t=t+i|0;t=(t|0)<0?2147483647:t}else{t=t+(i>>1)|0;t=(t|0)<0?2147483647:t}s[f>>2]=t;d=d+o|0;p=p+1|0}s[l>>2]=i;c=c+1|0}h=e+140|0;t=s[h>>2]|0;if((t|0)<1e3)f=32767/((t>>4)+1|0)|0;else f=0;l=0;while(1){if((l|0)==4)break;n=e+92+(l<<2)|0;i=s[n>>2]|0;t=(s[g+(l<<2)>>2]|0)+(s[e+124+(l<<2)>>2]|0)|0;t=(t|0)<0?2147483647:t;o=2147483647/(t|0)|0;if((t|0)<=(i<<3|0))if((t|0)<(i|0))t=1024;else{y=i<<16>>16;w=te(o>>16,y)|0;y=te(o&65535,y)|0;t=te(o,(i>>15)+1>>1)|0;t=w+(y>>16)+t>>16<<11|(w+(y>>>16)+t|0)>>>5&2047}else t=128;w=e+108+(l<<2)|0;p=s[w>>2]|0;b=o-p|0;y=((t|0)>(f|0)?t:f)<<16>>16;y=p+((te(b>>16,y)|0)+((te(b&65535,y)|0)>>16))|0;s[w>>2]=y;y=2147483647/(y|0)|0;s[n>>2]=(y|0)<16777215?y:16777215;l=l+1|0}s[h>>2]=(s[h>>2]|0)+1;p=0;b=0;l=0;while(1){if((p|0)==4)break;h=s[g+(p<<2)>>2]|0;c=s[e+92+(p<<2)>>2]|0;d=h-c|0;if((d|0)>0){if(h>>>0<8388608)t=(h<<8|0)/(c+1|0)|0;else t=(h|0)/((c>>8)+1|0)|0;s[v+(p<<2)>>2]=t;o=ne(t|0)|0;i=24-o|0;n=0-i|0;do if(i)if((i|0)<0){t=t<>>(i+32|0);break}else{t=t<<32-i|t>>>i;break}while(0);t=t&127;t=t+(((te(t,128-t|0)|0)*179|0)>>>16)+(31-o<<7)+-1024|0;f=t<<16>>16;l=l+(te(f,f)|0)|0;if((d|0)<1048576){n=ne(d|0)|0;n=(h|0)==(c|0)?32:n;t=24-n|0;i=0-t|0;do if(t)if((t|0)<0){t=d<>>(t+32|0);break}else{t=d<<32-t|d>>>t;break}else t=d;while(0);n=((n&1|0)==0?46214:32768)>>>(n>>>1);o=(te(t&127,13959168)|0)>>>16;o=te(n+((te(n>>16,o)|0)+((te(n&65535,o)|0)>>>16))<<6>>16,f)|0;n=ne(d|0)|0;n=(h|0)==(c|0)?32:n;t=24-n|0;i=0-t|0;do if(t)if((t|0)<0){t=d<>>(t+32|0);break}else{t=d<<32-t|d>>>t;break}else t=d;while(0);y=((n&1|0)==0?46214:32768)>>>(n>>>1);t=(te(t&127,13959168)|0)>>>16;t=o+((te(y+((te(y>>16,t)|0)+((te(y&65535,t)|0)>>>16))<<6&65472,f)|0)>>16)|0}y=s[22976+(p<<2)>>2]|0;i=t<<16>>16;i=b+((te(y>>16,i)|0)+((te(y&65535,i)|0)>>16))|0;t=l}else{s[v+(p<<2)>>2]=256;i=b;t=l}p=p+1|0;b=i;l=t}t=(l|0)/4|0;do if((l|0)>=4){o=ne(t|0)|0;o=(l+3|0)>>>0<7?32:o;i=24-o|0;n=0-i|0;do if(i)if((i|0)<0){t=t<>>(i+32|0);break}else{t=t<<32-i|t>>>i;break}while(0);i=((o&1|0)==0?46214:32768)>>>(o>>>1);t=(te(t&127,13959168)|0)>>>16;t=((i+((te(i>>16,t)|0)+((te(i&65535,t)|0)>>>16))|0)*196608>>16)*45e3>>16;i=t+-128|0;if((t|0)<128)if((i|0)<-191){t=0;break}else{t=128-t|0;m=53;break}if((i|0)>191)t=32767;else{t=i>>5;t=(s[23040+(t<<2)>>2]|0)+(te(s[23016+(t<<2)>>2]<<16>>16,i&31)|0)|0}}else{t=128;m=53}while(0);if((m|0)==53){y=t>>5;t=(s[22992+(y<<2)>>2]|0)-(te(s[23016+(y<<2)>>2]<<16>>16,t&31)|0)|0}if((b|0)<0){i=0-b|0;if((b|0)<-191)i=0;else{y=i>>5;i=(s[22992+(y<<2)>>2]|0)-(te(s[23016+(y<<2)>>2]<<16>>16,i&31)|0)|0}}else if((b|0)>191)i=32767;else{i=b>>5;i=(s[23040+(i<<2)>>2]|0)+(te(s[23016+(i<<2)>>2]<<16>>16,b&31)|0)|0}s[e+4804>>2]=(i<<1)+-32768;i=0;n=0;while(1){if((i|0)==4)break;m=i+1|0;y=n+(te(m,(s[g+(i<<2)>>2]|0)-(s[e+92+(i<<2)>>2]|0)>>4)|0)|0;i=m;n=y}if((n|0)>=1){if((n|0)<32768){i=n<<((s[_>>2]|0)==((s[e+4668>>2]|0)*10|0)?16:15);l=ne(i|0)|0;n=24-l|0;o=0-n|0;do if(n)if((n|0)<0){i=i<>>(n+32|0);break}else{i=i<<32-n|i>>>n;break}while(0);g=((l&1|0)==0?46214:32768)>>>(l>>>1);y=(te(i&127,13959168)|0)>>>16;y=g+((te(g>>16,y)|0)+((te(g&65535,y)|0)>>>16))+32768|0;t=t<<16>>16;t=(te(y>>16,t)|0)+((te(y&65535,t)|0)>>16)|0}}else t=t>>1;f=t>>7;s[e+4624>>2]=(f|0)<255?f:255;f=t<<16>>16;f=((te(t>>16,f)|0)<<16)+(te(t&65535,f)|0)|0;f=f>>((s[_>>2]|0)==((s[e+4668>>2]|0)*10|0)?21:20);l=0;while(1){ -if((l|0)==4)break;o=e+72+(l<<2)|0;i=s[o>>2]|0;t=(s[v+(l<<2)>>2]|0)-i|0;t=i+((te(t>>16,f)|0)+((te(t&65535,f)|0)>>16))|0;s[o>>2]=t;o=ne(t|0)|0;i=24-o|0;n=0-i|0;do if(i)if((i|0)<0){t=t<>>(i+32|0);break}else{t=t<<32-i|t>>>i;break}while(0);t=t&127;t=((t+(((te(t,128-t|0)|0)*179|0)>>>16)+(31-o<<7)|0)*3|0)+-5120|0;i=t>>4;if((i|0)<0){t=0-i|0;if((i|0)<-191)t=0;else{y=t>>5;t=(s[22992+(y<<2)>>2]|0)-(te(s[23016+(y<<2)>>2]<<16>>16,t&31)|0)|0}}else if((i|0)>191)t=32767;else{t=t>>9;t=(s[23040+(t<<2)>>2]|0)+(te(s[23016+(t<<2)>>2]<<16>>16,i&31)|0)|0}s[e+4788+(l<<2)>>2]=t;l=l+1|0}u=k;return}function Tn(e,t,i){e=e|0;t=t|0;i=i|0;var n=0,r=0,o=0;n=s[e+(i<<2)>>2]|0;r=t<<4;if((i|0)==8){t=t<<20>>16;o=(r>>15)+1>>1;i=(s[e+28>>2]|0)+((te(n>>16,t)|0)+((te(n&65535,t)|0)>>16))+(te(n,o)|0)|0;i=(s[e+24>>2]|0)+((te(i>>16,t)|0)+((te(i&65535,t)|0)>>16))+(te(i,o)|0)|0;i=(s[e+20>>2]|0)+((te(i>>16,t)|0)+((te(i&65535,t)|0)>>16))+(te(i,o)|0)|0;i=(s[e+16>>2]|0)+((te(i>>16,t)|0)+((te(i&65535,t)|0)>>16))+(te(i,o)|0)|0;i=(s[e+12>>2]|0)+((te(i>>16,t)|0)+((te(i&65535,t)|0)>>16))+(te(i,o)|0)|0;i=(s[e+8>>2]|0)+((te(i>>16,t)|0)+((te(i&65535,t)|0)>>16))+(te(i,o)|0)|0;i=(s[e+4>>2]|0)+((te(i>>16,t)|0)+((te(i&65535,t)|0)>>16))+(te(i,o)|0)|0;e=(s[e>>2]|0)+((te(i>>16,t)|0)+((te(i&65535,t)|0)>>16))+(te(i,o)|0)|0;return e|0}o=t<<20>>16;r=(r>>15)+1>>1;while(1){t=i+-1|0;if((i|0)<=0)break;i=t;n=(s[e+(t<<2)>>2]|0)+((te(n>>16,o)|0)+((te(n&65535,o)|0)>>16))+(te(n,r)|0)|0}return n|0}function Sn(e,t,i,n,o){e=e|0;t=t|0;i=i|0;n=n|0;o=o|0;var a=0,l=0,f=0,h=0,u=0,c=0,d=0;o=o>>1;a=t+4|0;l=0;while(1){if((l|0)>=(o|0))break;c=l<<1;d=r[e+(c<<1)>>1]<<10;u=d-(s[t>>2]|0)|0;h=(te(u>>16,-24290)|0)+((te(u&65535,-24290)|0)>>16)|0;f=d+h|0;s[t>>2]=d+(u+h);c=r[e+((c|1)<<1)>>1]<<10;h=s[a>>2]|0;u=c-h|0;u=((u>>16)*10788|0)+(((u&65535)*10788|0)>>>16)|0;h=h+u|0;s[a>>2]=c+u;u=(h+f>>10)+1>>1;r[i+(l<<1)>>1]=(u|0)>32767?32767:((u|0)<-32768?-32768:u)&65535;f=(h-f>>10)+1>>1;r[n+(l<<1)>>1]=(f|0)>32767?32767:((f|0)<-32768?-32768:f)&65535;l=l+1|0}return}function Mn(e,t,i){e=e|0;t=t|0;i=i|0;var n=0,r=0,o=0,a=0,l=0,f=0;o=i+-65536|0;r=t+-1|0;n=0;while(1){t=i>>16;if((n|0)>=(r|0))break;a=e+(n<<2)|0;l=s[a>>2]|0;f=l<<16>>16;s[a>>2]=(te(t,f)|0)+((te(i&65535,f)|0)>>16)+(te(i,(l>>15)+1>>1)|0);i=i+(((te(i,o)|0)>>15)+1>>1)|0;n=n+1|0}f=e+(r<<2)|0;l=s[f>>2]|0;a=l<<16>>16;s[f>>2]=(te(t,a)|0)+((te(i&65535,a)|0)>>16)+(te(i,(l>>15)+1>>1)|0);return}function Rn(e,t,i,n,s){e=e|0;t=t|0;i=i|0;n=n|0;s=s|0;var o=0,a=0,l=0,f=0,h=0,u=0,c=0,d=0,p=0,b=0;o=i+2|0;a=i+4|0;l=i+6|0;f=i+8|0;h=i+10|0;c=s;while(1){if((c|0)>=(n|0))break;u=t+(c+-1<<1)|0;p=te(r[u>>1]|0,r[i>>1]|0)|0;p=p+(te(r[u+-2>>1]|0,r[o>>1]|0)|0)|0;p=p+(te(r[u+-4>>1]|0,r[a>>1]|0)|0)|0;p=p+(te(r[u+-6>>1]|0,r[l>>1]|0)|0)|0;p=p+(te(r[u+-8>>1]|0,r[f>>1]|0)|0)|0;d=6;p=p+(te(r[u+-10>>1]|0,r[h>>1]|0)|0)|0;while(1){if((d|0)>=(s|0))break;b=p+(te(r[u+(0-d<<1)>>1]|0,r[i+(d<<1)>>1]|0)|0)|0;b=b+(te(r[u+(~d<<1)>>1]|0,r[i+((d|1)<<1)>>1]|0)|0)|0;d=d+2|0;p=b}b=((r[u+2>>1]<<12)-p>>11)+1>>1;r[e+(c<<1)>>1]=(b|0)>32767?32767:((b|0)<-32768?-32768:b)&65535;c=c+1|0}yr(e|0,0,s<<1|0)|0;return}function Cn(e,t){e=e|0;t=t|0;var i=0,n=0,o=0,a=0,l=0,f=0,h=0,c=0,d=0,p=0,b=0,w=0,m=0,g=0,_=0,v=0,k=0,y=0;y=u;u=u+96|0;v=y;i=0;n=0;while(1){if((n|0)>=(t|0))break;_=r[e+(n<<1)>>1]|0;s[v+(n<<2)>>2]=_<<12;i=i+_|0;n=n+1|0}if((i|0)>4095){u=y;return 0}o=1073741824;n=0;e:while(1){_=t+-1|0;e=s[v+(_<<2)>>2]|0;i=(e+16773022|0)>>>0>33546044;if((t|0)<=1){k=44;break}if(i){k=46;break}m=0-(e<<7)|0;g=((m|0)<0)<<31>>31;Nr(m|0,g|0,m|0,g|0)|0;a=1073741824-x|0;w=Nr(o|0,n|0,a|0,((a|0)<0)<<31>>31|0)|0;w=Tr(w|0,x|0,30)|0;w=w&-4;if((w|0)<107374){k=46;break}if((a|0)<=0)if(!a){e=32;i=30;l=0}else{e=0-a|0;k=11}else{e=a;k=11}if((k|0)==11){k=0;l=32-(ne(e|0)|0)|0;e=ne(e|0)|0;i=l+30|0}b=a<>16;o=536870911/(c|0)|0;d=o<<16;p=d>>16;b=536870912-((te(c,p)|0)+((te(b&65535,p)|0)>>16))<<3;o=d+((te(b>>16,p)|0)+((te(b&65528,p)|0)>>16))+(te(b,(o>>15)+1>>1)|0)|0;e=62-e-i|0;if((e|0)<1){n=0-e|0;e=-2147483648>>n;i=2147483647>>>n;if((e|0)>(i|0)){if((o|0)<=(e|0))e=(o|0)<(i|0)?i:o}else if((o|0)>(i|0))e=i;else e=(o|0)<(e|0)?e:o;b=e<>e:0;c=t>>1;d=(l|0)==1;p=((b|0)<0)<<31>>31;l=l+-1|0;h=0;while(1){if((h|0)>=(c|0))break;t=v+(h<<2)|0;o=s[t>>2]|0;f=v+(_-h+-1<<2)|0;a=s[f>>2]|0;e=Nr(a|0,((a|0)<0)<<31>>31|0,m|0,g|0)|0;e=Tr(e|0,x|0,30)|0;e=Er(e|0,x|0,1,0)|0;e=Tr(e|0,x|0,1)|0;i=o-e|0;n=(i|0)>-1;if(d){if(n){n=(o&(e^-2147483648)|0)<0?-2147483648:i;n=Nr(n|0,((n|0)<0)<<31>>31|0,b|0,p|0)|0;n=Ar(n|0,x|0,1)|0;e=(o&(e^-2147483648)|0)<0?-2147483648:i;i=n;n=x}else{n=((o^-2147483648)&e|0)<0?2147483647:i;n=Nr(n|0,((n|0)<0)<<31>>31|0,b|0,p|0)|0;n=Ar(n|0,x|0,1)|0;e=((o^-2147483648)&e|0)<0?2147483647:i;i=n;n=x}e=Nr(e|0,((e|0)<0)<<31>>31|0,b|0,p|0)|0;e=Er(i|0,n|0,e&1|0,0)|0;i=x}else{if(n)e=(o&(e^-2147483648)|0)<0?-2147483648:i;else e=((o^-2147483648)&e|0)<0?2147483647:i;e=Nr(e|0,((e|0)<0)<<31>>31|0,b|0,p|0)|0;e=Ar(e|0,x|0,l|0)|0;e=Er(e|0,x|0,1,0)|0;e=Ar(e|0,x|0,1)|0;i=x}n=Er(e|0,i|0,-2147483648,0)|0;i=x;if(i>>>0>0|(i|0)==0&n>>>0>4294967295){k=46;break e}s[t>>2]=e;e=Nr(o|0,((o|0)<0)<<31>>31|0,m|0,g|0)|0;e=Tr(e|0,x|0,30)|0;e=Er(e|0,x|0,1,0)|0;e=Tr(e|0,x|0,1)|0;i=a-e|0;n=(i|0)>-1;if(d){if(n){n=(a&(e^-2147483648)|0)<0?-2147483648:i;n=Nr(n|0,((n|0)<0)<<31>>31|0,b|0,p|0)|0;n=Ar(n|0,x|0,1)|0;e=(a&(e^-2147483648)|0)<0?-2147483648:i;i=n;n=x}else{n=((a^-2147483648)&e|0)<0?2147483647:i;n=Nr(n|0,((n|0)<0)<<31>>31|0,b|0,p|0)|0;n=Ar(n|0,x|0,1)|0;e=((a^-2147483648)&e|0)<0?2147483647:i;i=n;n=x}e=Nr(e|0,((e|0)<0)<<31>>31|0,b|0,p|0)|0;e=Er(i|0,n|0,e&1|0,0)|0;i=x}else{if(n)e=(a&(e^-2147483648)|0)<0?-2147483648:i;else e=((a^-2147483648)&e|0)<0?2147483647:i;e=Nr(e|0,((e|0)<0)<<31>>31|0,b|0,p|0)|0;e=Ar(e|0,x|0,l|0)|0;e=Er(e|0,x|0,1,0)|0;e=Ar(e|0,x|0,1)|0;i=x}a=Er(e|0,i|0,-2147483648,0)|0;o=x;if(o>>>0>0|(o|0)==0&a>>>0>4294967295){k=46;break e}s[f>>2]=e;h=h+1|0}o=w;n=((w|0)<0)<<31>>31;t=_}if((k|0)==44)if(i){u=y;return 0}else{v=0-(s[v>>2]<<7)|0;k=((v|0)<0)<<31>>31;Nr(v|0,k|0,v|0,k|0)|0;k=1073741824-x|0;k=Nr(o|0,n|0,k|0,((k|0)<0)<<31>>31|0)|0;k=Tr(k|0,x|0,30)|0;k=k&-4;u=y;return((k|0)<107374?0:k)|0}else if((k|0)==46){u=y;return 0}return 0}function Pn(e,t,i){e=e|0;t=t|0;i=i|0;var n=0,a=0,l=0,f=0,h=0,c=0,d=0,p=0,b=0,w=0,m=0,g=0,_=0,v=0;g=u;u=u+304|0;d=g+200|0;b=g+148|0;w=g+96|0;m=g;n=(i|0)==16?32909:32925;a=0;while(1){if((a|0)>=(i|0))break;c=r[t+(a<<1)>>1]|0;p=c>>8;h=r[27508+(p<<1)>>1]|0;p=((h<<8)+(te((r[27508+(p+1<<1)>>1]|0)-h|0,c-(p<<8)|0)|0)>>3)+1>>1;s[d+(o[n+a>>0]<<2)>>2]=p;a=a+1|0}p=i>>1;s[b>>2]=65536;c=b+4|0;h=1;n=0-(s[d>>2]|0)|0;while(1){s[c>>2]=n;if((h|0)>=(p|0))break;t=s[d+(h<<1<<2)>>2]|0;f=s[b+(h+-1<<2)>>2]|0;a=((t|0)<0)<<31>>31;n=s[b+(h<<2)>>2]|0;n=Nr(t|0,a|0,n|0,((n|0)<0)<<31>>31|0)|0;n=Tr(n|0,x|0,15)|0;n=Er(n|0,x|0,1,0)|0;n=Tr(n|0,x|0,1)|0;l=h+1|0;s[b+(l<<2)>>2]=(f<<1)-n;n=h;while(1){if((n|0)<=1)break;h=s[b+(n+-2<<2)>>2]|0;v=Nr(t|0,a|0,f|0,((f|0)<0)<<31>>31|0)|0;v=Tr(v|0,x|0,15)|0;v=Er(v|0,x|0,1,0)|0;v=Tr(v|0,x|0,1)|0;_=b+(n<<2)|0;s[_>>2]=(s[_>>2]|0)+(h-v);f=h;n=n+-1|0}h=l;n=(s[c>>2]|0)-t|0}c=d+4|0;s[w>>2]=65536;d=w+4|0;h=1;n=0-(s[c>>2]|0)|0;while(1){s[d>>2]=n;if((h|0)>=(p|0)){n=0;break}l=s[c+(h<<1<<2)>>2]|0;a=s[w+(h+-1<<2)>>2]|0;f=((l|0)<0)<<31>>31;n=s[w+(h<<2)>>2]|0;n=Nr(l|0,f|0,n|0,((n|0)<0)<<31>>31|0)|0;n=Tr(n|0,x|0,15)|0;n=Er(n|0,x|0,1,0)|0;n=Tr(n|0,x|0,1)|0;t=h+1|0;s[w+(t<<2)>>2]=(a<<1)-n;n=h;while(1){if((n|0)<=1)break;v=s[w+(n+-2<<2)>>2]|0;h=Nr(l|0,f|0,a|0,((a|0)<0)<<31>>31|0)|0;h=Tr(h|0,x|0,15)|0;h=Er(h|0,x|0,1,0)|0;h=Tr(h|0,x|0,1)|0;_=w+(n<<2)|0;s[_>>2]=(s[_>>2]|0)+(v-h);a=v;n=n+-1|0}h=t;n=(s[d>>2]|0)-l|0}while(1){if((n|0)>=(p|0))break;v=n+1|0;_=(s[b+(v<<2)>>2]|0)+(s[b+(n<<2)>>2]|0)|0;d=(s[w+(v<<2)>>2]|0)-(s[w+(n<<2)>>2]|0)|0;s[m+(n<<2)>>2]=0-d-_;s[m+(i-n+-1<<2)>>2]=d-_;n=v}l=0;n=0;while(1){if((l|0)<10){t=0;a=0}else break;while(1){if((t|0)>=(i|0))break;v=s[m+(t<<2)>>2]|0;v=(v|0)>0?v:0-v|0;_=(v|0)>(a|0);n=_?t:n;t=t+1|0;a=_?v:a}t=(a>>4)+1>>1;if((t|0)<=32767)break;v=(t|0)<163838?t:163838;Mn(m,i,65470-(((v<<14)+-536854528|0)/((te(v,n+1|0)|0)>>2|0)|0)|0);l=l+1|0}e:do if((l|0)==10){n=0;while(1){if((n|0)>=(i|0)){n=0;break e}v=m+(n<<2)|0;_=(s[v>>2]>>4)+1>>1;_=(_|0)>32767?32767:(_|0)<-32768?-32768:_;r[e+(n<<1)>>1]=_;s[v>>2]=_<<16>>11;n=n+1|0}}else{n=0;while(1){if((n|0)>=(i|0)){n=0;break e}r[e+(n<<1)>>1]=(((s[m+(n<<2)>>2]|0)>>>4)+1|0)>>>1;n=n+1|0}}while(0);while(1){if(!((Cn(e,i)|0)==0&(n|0)<16))break;Mn(m,i,65536-(2<=(i|0))break;r[e+(t<<1)>>1]=(((s[m+(t<<2)>>2]|0)>>>4)+1|0)>>>1;t=t+1|0}n=n+1|0}u=g;return}function xn(e,t,i){e=e|0;t=t|0;i=i|0;var n=0,s=0,o=0,l=0,f=0,h=0,u=0,c=0,d=0,p=0,b=0,w=0,m=0;b=e+(i+-1<<1)|0;w=t+(i<<1)|0;d=0;while(1){if((d|0)>=20)break;f=r[e>>1]|0;l=r[t>>1]|0;n=f;s=0;o=1;f=(f<<16>>16)-(l<<16>>16)|0;while(1){if((o|0)>=(i|0))break;h=r[e+(o<<1)>>1]|0;c=(h<<16>>16)-((n<<16>>16)+(r[t+(o<<1)>>1]|0))|0;u=(c|0)<(f|0);n=h;s=u?o:s;o=o+1|0;f=u?c:f}u=32768-((r[b>>1]|0)+(r[w>>1]|0))|0;h=(u|0)<(f|0);c=h?i:s;if(((h?u:f)|0)>-1){p=36;break}do if(!c)r[e>>1]=l;else{if((c|0)==(i|0)){r[b>>1]=32768-(a[w>>1]|0);break}else{n=0;l=0}while(1){if((n|0)>=(c|0))break;u=l+(r[t+(n<<1)>>1]|0)|0;n=n+1|0;l=u}h=t+(c<<1)|0;u=r[h>>1]|0;s=u>>1;n=i;o=32768;while(1){if((n|0)<=(c|0))break;f=o-(r[t+(n<<1)>>1]|0)|0;n=n+-1|0;o=f}n=l+s|0;o=o-s|0;f=e+(c+-1<<1)|0;m=r[f>>1]|0;l=e+(c<<1)|0;s=r[l>>1]|0;s=((m<<16>>16)+(s<<16>>16)>>1)+((m&65535)+(s&65535)&1)|0;if((n|0)>(o|0)){if((s|0)<=(n|0))n=(s|0)<(o|0)?o:s}else if((s|0)>(o|0))n=o;else n=(s|0)<(n|0)?n:s;m=n-(u>>>1)|0;r[f>>1]=m;r[l>>1]=m+(a[h>>1]|0)}while(0);d=d+1|0}if((p|0)==36)return;if((d|0)==20)o=1;else return;while(1){if((o|0)>=(i|0))break;n=r[e+(o<<1)>>1]|0;f=o;while(1){l=f+-1|0;if((f|0)<=0)break;s=r[e+(l<<1)>>1]|0;if(n<<16>>16>=s<<16>>16)break;r[e+(f<<1)>>1]=s;f=l}r[e+(f<<1)>>1]=n;o=o+1|0}s=r[e>>1]|0;n=r[t>>1]|0;n=s<<16>>16>n<<16>>16?s:n;r[e>>1]=n;n=n<<16>>16;s=1;while(1){if((s|0)>=(i|0))break;p=e+(s<<1)|0;d=r[p>>1]|0;m=n+(r[t+(s<<1)>>1]|0)|0;m=(m|0)>32767?32767:((m|0)<-32768?-32768:m)<<16>>16;m=(d|0)>(m|0)?d:m;r[p>>1]=m;n=m;s=s+1|0}n=r[b>>1]|0;s=32768-(r[w>>1]|0)|0;s=(n|0)<(s|0)?n:s;r[b>>1]=s;n=i+-2|0;while(1){if((n|0)<=-1)break;i=e+(n<<1)|0;w=r[i>>1]|0;m=(s<<16>>16)-(r[t+(n+1<<1)>>1]|0)|0;m=(w|0)<(m|0)?w:m;r[i>>1]=m;s=m;n=n+-1|0}return}function In(e,t,i){e=e|0;t=t|0;i=i|0;var n=0,s=0,o=0,a=0,l=0,f=0;n=r[t>>1]|0;s=(r[t+2>>1]|0)-(n<<16>>16)|0;s=131072/(((s|0)>1?s:1)|0)|0;n=(131072/((n<<16>>16>1?n:1)<<16>>16|0)|0)+s|0;r[e>>1]=(n|0)<32767?n:32767;i=i+-1|0;n=1;while(1){if((n|0)>=(i|0))break;l=n+1|0;o=t+(l<<1)|0;f=(r[o>>1]|0)-(r[t+(n<<1)>>1]|0)|0;f=131072/(((f|0)>1?f:1)|0)|0;a=f+s|0;r[e+(n<<1)>>1]=(a|0)<32767?a:32767;a=n+2|0;o=(r[t+(a<<1)>>1]|0)-(r[o>>1]|0)|0;o=131072/(((o|0)>1?o:1)|0)|0;f=f+o|0;r[e+(l<<1)>>1]=(f|0)<32767?f:32767;n=a;s=o}f=32768-(r[t+(i<<1)>>1]|0)|0;f=(131072/(((f|0)>1?f:1)|0)|0)+s|0;r[e+(i<<1)>>1]=(f|0)<32767?f:32767;return}function On(e,t,i,n){e=e|0;t=t|0;i=i|0;n=n|0;var o=0,a=0,l=0,f=0,h=0,u=0,c=0;n=n>>1;o=e+4|0;a=0;while(1){if((a|0)>=(n|0))break;c=a<<1;u=r[i+(c<<1)>>1]<<10;f=u-(s[e>>2]|0)|0;h=(te(f>>16,-25727)|0)+((te(f&65535,-25727)|0)>>16)|0;s[e>>2]=u+(f+h);c=r[i+((c|1)<<1)>>1]<<10;f=s[o>>2]|0;l=c-f|0;l=((l>>16)*9872|0)+(((l&65535)*9872|0)>>>16)|0;s[o>>2]=c+l;l=(u+h+f+l>>10)+1>>1;r[t+(a<<1)>>1]=(l|0)>32767?32767:((l|0)<-32768?-32768:l)&65535;a=a+1|0}return}function Nn(e,t,i,n){e=e|0;t=t|0;i=i|0;n=n|0;var r=0,o=0,a=0,l=0,f=0,h=0;r=0;while(1){if((r|0)>=(n|0)){a=1;break}s[t+(r<<2)>>2]=r;r=r+1|0}while(1){if((a|0)>=(n|0))break;o=s[e+(a<<2)>>2]|0;f=a;while(1){l=f+-1|0;if((f|0)<=0)break;r=s[e+(l<<2)>>2]|0;if((o|0)>=(r|0))break;s[e+(f<<2)>>2]=r;s[t+(f<<2)>>2]=s[t+(l<<2)>>2];f=l}s[e+(f<<2)>>2]=o;s[t+(f<<2)>>2]=a;a=a+1|0}f=e+(n+-1<<2)|0;h=n+-2|0;a=n;while(1){if((a|0)>=(i|0))break;r=s[e+(a<<2)>>2]|0;if((r|0)<(s[f>>2]|0)){l=h;while(1){if((l|0)<=-1)break;o=s[e+(l<<2)>>2]|0;if((r|0)>=(o|0))break;n=l+1|0;s[e+(n<<2)>>2]=o;s[t+(n<<2)>>2]=s[t+(l<<2)>>2];l=l+-1|0}n=l+1|0;s[e+(n<<2)>>2]=r;s[t+(n<<2)>>2]=a}a=a+1|0}return}function Dn(e,t,i,n){e=e|0;t=t|0;i=i|0;n=n|0;var o=0,a=0,l=0,f=0,h=0,u=0,c=0;f=31-(ne(n|0)|0)|0;h=n+-1|0;a=((h|0)>0?h:0)+1&-2;l=0;o=n;while(1){if((l|0)>=(h|0))break;c=r[i+(l<<1)>>1]|0;c=te(c,c)|0;u=r[i+((l|1)<<1)>>1]|0;l=l+2|0;o=o+((c+(te(u,u)|0)|0)>>>f)|0}if((a|0)<(n|0)){c=r[i+(a<<1)>>1]|0;o=o+((te(c,c)|0)>>>f)|0}o=f+3-(ne(o|0)|0)|0;o=(o|0)<0?0:o;a=n+-1|0;a=((a|0)>0?a:0)+1&-2;l=0;f=0;while(1){if((l|0)>=(h|0))break;u=r[i+(l<<1)>>1]|0;u=te(u,u)|0;c=r[i+((l|1)<<1)>>1]|0;l=l+2|0;f=f+((u+(te(c,c)|0)|0)>>>o)|0}if((a|0)>=(n|0)){c=f;s[t>>2]=o;s[e>>2]=c;return}c=r[i+(a<<1)>>1]|0;c=f+((te(c,c)|0)>>>o)|0;s[t>>2]=o;s[e>>2]=c;return}function Ln(e,t,i,n,r,s){e=e|0;t=t|0;i=+i;n=n|0;r=r|0;s=s|0;var o=0,a=0,l=0,c=0,d=0,p=0,b=0,w=0,m=0,g=0,_=0,v=0,k=0,y=0,E=0,A=0,T=0,S=0,M=0,R=0,C=0,P=0,x=0,I=0,O=0,N=0;P=u;u=u+976|0;A=P+784|0;T=P+592|0;R=P+392|0;E=P+192|0;C=P;o=+tn(t,te(r,n)|0);yr(A|0,0,192)|0;c=0;while(1){if((c|0)>=(r|0))break;a=t+((te(c,n)|0)<<2)|0;l=1;while(1){if((l|0)>(s|0))break;M=+nn(a,a+(l<<2)|0,n-l|0);y=A+(l+-1<<3)|0;h[y>>3]=+h[y>>3]+M;l=l+1|0}c=c+1|0}Sr(T|0,A|0,192)|0;M=o*9999999747378752e-21;v=o+M+9.999999717180685e-10;h[R>>3]=v;h[E>>3]=v;v=i;k=1;l=0;y=2;_=1;while(1){if((l|0)>=(s|0))break;c=n-l|0;p=c+-1|0;m=0;while(1){if((m|0)>=(r|0))break;w=t+((te(m,n)|0)<<2)|0;i=+f[w+(l<<2)>>2];d=+f[w+(p<<2)>>2];a=0;b=i;g=d;while(1){if((l|0)==(a|0)){a=0;break}O=+f[w+(l-a+-1<<2)>>2];N=A+(a<<3)|0;h[N>>3]=+h[N>>3]-i*O;I=+f[w+(c+a<<2)>>2];N=T+(a<<3)|0;h[N>>3]=+h[N>>3]-d*I;x=+h[C+(a<<3)>>3];a=a+1|0;b=b+O*x;g=g+I*x}while(1){if((a|0)==(k|0))break;N=R+(a<<3)|0;h[N>>3]=+h[N>>3]-b*+f[w+(l-a<<2)>>2];N=E+(a<<3)|0;h[N>>3]=+h[N>>3]-g*+f[w+(c+a+-1<<2)>>2];a=a+1|0}m=m+1|0}a=0;i=+h[A+(l<<3)>>3];b=+h[T+(l<<3)>>3];while(1){if((l|0)==(a|0))break;O=+h[C+(a<<3)>>3];N=l-a+-1|0;a=a+1|0;i=i+ +h[T+(N<<3)>>3]*O;b=b+ +h[A+(N<<3)>>3]*O}w=l+1|0;h[R+(w<<3)>>3]=i;h[E+(w<<3)>>3]=b;a=0;i=+h[E>>3];d=+h[R>>3];while(1){if((l|0)==(a|0))break;I=+h[C+(a<<3)>>3];N=a+1|0;O=b+ +h[E+(l-a<<3)>>3]*I;a=N;i=i+ +h[E+(N<<3)>>3]*I;d=d+ +h[R+(N<<3)>>3]*I;b=O}d=b*-2/(d+i);i=_*(1-d*d);if(!(i<=v))a=0;else{d=+z(+(1-v/_));i=v;d=b>0?-d:d;a=1}c=w>>1;p=0;while(1){if((p|0)>=(c|0))break;m=C+(p<<3)|0;O=+h[m>>3];N=C+(l-p+-1<<3)|0;I=+h[N>>3];h[m>>3]=O+d*I;h[N>>3]=I+d*O;p=p+1|0}h[C+(l<<3)>>3]=d;if(!a)a=0;else{S=29;break}while(1){if((a|0)==(y|0))break;m=R+(a<<3)|0;O=+h[m>>3];N=E+(l-a+1<<3)|0;I=+h[N>>3];h[m>>3]=O+d*I;h[N>>3]=I+d*O;a=a+1|0}k=k+1|0;l=w;y=y+1|0;_=i}if((S|0)==29){while(1){l=l+1|0;if((l|0)>=(s|0))break;h[C+(l<<3)>>3]=0;S=29}if(a|0){a=0;while(1){if((a|0)>=(s|0)){a=0;break}f[e+(a<<2)>>2]=-+h[C+(a<<3)>>3];a=a+1|0}while(1){if((a|0)>=(r|0))break;o=o-+tn(t+((te(a,n)|0)<<2)|0,s);a=a+1|0}O=o*i;u=P;return+O}}a=0;o=+h[R>>3];i=1;while(1){if((a|0)>=(s|0))break;O=+h[C+(a<<3)>>3];N=a+1|0;I=+h[R+(N<<3)>>3];f[e+(a<<2)>>2]=-O;a=N;o=o+I*O;i=i+O*O}O=o-M*i;u=P;return+O}function Un(e,t,i,n){e=e|0;t=t|0;i=i|0;n=n|0;var o=0,a=0,l=0,f=0,h=0,c=0,d=0,p=0,b=0,w=0,m=0,g=0,_=0,v=0,k=0,y=0,E=0,A=0,T=0,S=0,M=0,R=0,C=0,P=0,x=0,I=0,O=0,N=0;N=u;u=u+32|0;O=N;p=e+2772|0;o=e+2316|0;l=e+4156|0;if((s[o>>2]|0)!=(s[l>>2]|0)){f=e+2340|0;a=s[f>>2]|0;h=32767/(a+1|0)|0;c=0;d=0;while(1){if((d|0)>=(a|0))break;I=c+h|0;r[e+4052+(d<<1)>>1]=I;a=s[f>>2]|0;c=I;d=d+1|0}s[e+4148>>2]=0;s[e+4152>>2]=3176576;s[l>>2]=s[o>>2]}c=e+4160|0;do if(!(s[c>>2]|0)){if(!(s[e+4164>>2]|0)){o=e+2340|0;a=0;while(1){if((a|0)>=(s[o>>2]|0))break;P=r[e+2344+(a<<1)>>1]|0;I=e+4052+(a<<1)|0;C=r[I>>1]|0;x=C&65535;r[I>>1]=x+((((P<<16>>16)-(C<<16>>16)>>16)*16348|0)+((((P&65535)-x&65535)*16348|0)>>>16));a=a+1|0}h=e+2324|0;o=s[h>>2]|0;a=0;l=0;f=0;while(1){if((a|0)>=(o|0))break;x=s[t+16+(a<<2)>>2]|0;P=(x|0)>(l|0);I=P?a:f;a=a+1|0;l=P?x:l;f=I}l=e+2332|0;a=s[l>>2]|0;Mr(e+2772+(a<<2)|0,p|0,(te(o+-1|0,a)|0)<<2|0)|0;l=s[l>>2]|0;Sr(p|0,e+4+((te(f,l)|0)<<2)|0,l<<2|0)|0;l=e+4148|0;o=s[h>>2]|0;a=0;while(1){if((a|0)>=(o|0))break;x=s[l>>2]|0;I=(s[t+16+(a<<2)>>2]|0)-x|0;s[l>>2]=x+(((I>>16)*4634|0)+(((I&65535)*4634|0)>>>16));a=a+1|0}if(s[c>>2]|0)break}yr(e+4084|0,0,s[e+2340>>2]<<2|0)|0;u=N;return}while(0);x=Ne()|0;I=u;u=u+((1*(n+16<<2)|0)+15&-16)|0;P=r[e+4224>>1]|0;o=P<<16>>16;a=s[e+4244>>2]|0;f=a<<16>>16;a=(te(o>>16,f)|0)+((te(P&65535,f)|0)>>16)+(te(o,(a>>15)+1>>1)|0)|0;o=s[e+4148>>2]|0;f=a>>16;if((a|0)>2097151|(o|0)>8388608){l=o>>16;l=te(l,l)|0;a=(te(f,f)|0)<<5;o=l-a|0;if((o|0)<1)c=0;else{f=ne(o|0)|0;f=(l|0)==(a|0)?32:f;a=24-f|0;l=0-a|0;do if(a)if((a|0)<0){o=o<>>(a+32|0);break}else{o=o<<32-a|o>>>a;break}while(0);P=((f&1|0)==0?46214:32768)>>>(f>>>1);c=(te(o&127,13959168)|0)>>>16;c=P+((te(P>>16,c)|0)+((te(P&65535,c)|0)>>>16))<<16}}else{P=a<<16>>16;l=o<<16>>16;l=(te(o>>16,l)|0)+((te(o&65535,l)|0)>>16)+(te(o,(o>>15)+1>>1)|0)|0;a=(te(f,P)|0)+((te(a&65535,P)|0)>>16)+(te(a,(a>>15)+1>>1)|0)<<5;o=l-a|0;if((o|0)<1)c=0;else{f=ne(o|0)|0;f=(l|0)==(a|0)?32:f;a=24-f|0;l=0-a|0;do if(a)if((a|0)<0){o=o<>>(a+32|0);break}else{o=o<<32-a|o>>>a;break}while(0);P=((f&1|0)==0?46214:32768)>>>(f>>>1);c=(te(o&127,13959168)|0)>>>16;c=P+((te(P>>16,c)|0)+((te(P&65535,c)|0)>>>16))<<8}}o=I+64|0;l=255;while(1){if((l|0)<=(n|0))break;l=l>>1}a=e+4152|0;f=0;h=s[a>>2]|0;while(1){if((f|0)>=(n|0))break;P=(te(h,196314165)|0)+907633515|0;s[o+(f<<2)>>2]=s[e+2772+((P>>24&l)<<2)>>2];f=f+1|0;h=P}s[a>>2]=h;P=e+2340|0;Pn(O,e+4052|0,s[P>>2]|0);C=e+4084|0;o=I;a=C;l=o+64|0;do{s[o>>2]=s[a>>2];o=o+4|0;a=a+4|0}while((o|0)<(l|0));e=r[O>>1]|0;b=r[O+2>>1]|0;w=r[O+4>>1]|0;m=r[O+6>>1]|0;g=r[O+8>>1]|0;_=r[O+10>>1]|0;v=r[O+12>>1]|0;k=r[O+14>>1]|0;y=r[O+16>>1]|0;E=r[O+18>>1]|0;A=r[O+20>>1]|0;T=r[O+22>>1]|0;S=r[O+24>>1]|0;M=r[O+26>>1]|0;R=r[O+28>>1]|0;p=r[O+30>>1]|0;t=c<<10>>16;c=(c>>21)+1>>1;d=0;while(1){if((d|0)>=(n|0))break;O=s[I+(d+15<<2)>>2]|0;O=(s[P>>2]>>1)+((te(O>>16,e)|0)+((te(O&65535,e)|0)>>16))|0;o=s[I+(d+14<<2)>>2]|0;o=O+((te(o>>16,b)|0)+((te(o&65535,b)|0)>>16))|0;O=s[I+(d+13<<2)>>2]|0;O=o+((te(O>>16,w)|0)+((te(O&65535,w)|0)>>16))|0;o=s[I+(d+12<<2)>>2]|0;o=O+((te(o>>16,m)|0)+((te(o&65535,m)|0)>>16))|0;O=s[I+(d+11<<2)>>2]|0;O=o+((te(O>>16,g)|0)+((te(O&65535,g)|0)>>16))|0;o=s[I+(d+10<<2)>>2]|0;o=O+((te(o>>16,_)|0)+((te(o&65535,_)|0)>>16))|0;O=s[I+(d+9<<2)>>2]|0;O=o+((te(O>>16,v)|0)+((te(O&65535,v)|0)>>16))|0;o=s[I+(d+8<<2)>>2]|0;o=O+((te(o>>16,k)|0)+((te(o&65535,k)|0)>>16))|0;O=s[I+(d+7<<2)>>2]|0;O=o+((te(O>>16,y)|0)+((te(O&65535,y)|0)>>16))|0;o=s[I+(d+6<<2)>>2]|0;o=O+((te(o>>16,E)|0)+((te(o&65535,E)|0)>>16))|0;if((s[P>>2]|0)==16){O=s[I+(d+5<<2)>>2]|0;O=o+((te(O>>16,A)|0)+((te(O&65535,A)|0)>>16))|0;o=s[I+(d+4<<2)>>2]|0;o=O+((te(o>>16,T)|0)+((te(o&65535,T)|0)>>16))|0;O=s[I+(d+3<<2)>>2]|0;O=o+((te(O>>16,S)|0)+((te(O&65535,S)|0)>>16))|0;o=s[I+(d+2<<2)>>2]|0;o=O+((te(o>>16,M)|0)+((te(o&65535,M)|0)>>16))|0;O=s[I+(d+1<<2)>>2]|0;O=o+((te(O>>16,R)|0)+((te(O&65535,R)|0)>>16))|0;o=s[I+(d<<2)>>2]|0;o=O+((te(o>>16,p)|0)+((te(o&65535,p)|0)>>16))|0}h=I+(d+16<<2)|0;a=s[h>>2]|0;l=(o|0)>134217727;f=l?2147483632:((o|0)<-134217728?-134217728:o)<<4;if((a+(l?2147483632:((o|0)<-134217728?-134217728:o)<<4)|0)>-1)if((a&f|0)<0)o=-2147483648;else o=a+(l?2147483632:((o|0)<-134217728?-134217728:o)<<4)|0;else if((a|f|0)>-1)o=2147483647;else o=a+(l?2147483632:((o|0)<-134217728?-134217728:o)<<4)|0;s[h>>2]=o;f=i+(d<<1)|0;l=r[f>>1]|0;o=((te(o>>16,t)|0)+((te(o&65535,t)|0)>>16)+(te(o,c)|0)>>7)+1>>1;a=(o|0)>32767;if((l+(a?32767:(o|0)<-32768?-32768:o)|0)<=32767)if((l+(a?32767:(o|0)<-32768?-32768:o)|0)<-32768)o=-32768;else o=l+(a?32767:(o|0)<-32768?-32768:o)|0;else o=32767;r[f>>1]=o;d=d+1|0}o=C;a=I+(n<<2)|0;l=o+64|0;do{s[o>>2]=s[a>>2];o=o+4|0;a=a+4|0}while((o|0)<(l|0));He(x|0);u=N;return}function Bn(e,t,i,o){e=e|0;t=t|0;i=i|0;o=o|0;var a=0,l=0,f=0,h=0,c=0,d=0,p=0,b=0,w=0,m=0,g=0,_=0,v=0,k=0,y=0,E=0,A=0,T=0,S=0,M=0,R=0,C=0,P=0,I=0,O=0,N=0,D=0,L=0,U=0,B=0,j=0,F=0,G=0,H=0,z=0,q=0,W=0,V=0,Y=0,Z=0,$=0,K=0,X=0,J=0,Q=0,ee=0,ie=0,re=0,se=0;re=u;u=u+32|0;ie=re;Z=e+2336|0;Q=s[Z>>2]|0;X=u;u=u+((1*(Q<<1)|0)+15&-16)|0;p=e+2328|0;l=s[p>>2]|0;J=u;u=u+((1*(Q+l<<2)|0)+15&-16)|0;Q=e+2332|0;d=s[Q>>2]|0;ee=u;u=u+((1*(d<<2)|0)+15&-16)|0;$=u;u=u+((1*(d+16<<2)|0)+15&-16)|0;d=r[e+2766>>1]|0;K=e+2765|0;w=(d&65535)>>>8&255;d=r[25404+(n[K>>0]>>1<<2)+((d&65535)<<24>>24<<1)>>1]<<4;b=0;a=n[e+2770>>0]|0;while(1){if((b|0)>=(l|0))break;h=(te(a,196314165)|0)+907633515|0;c=o+(b<<1)|0;l=r[c>>1]|0;a=l<<16>>16<<14;f=e+4+(b<<2)|0;s[f>>2]=a;if(l<<16>>16<=0){if(l<<16>>16<0){a=a|1280;s[f>>2]=a}}else{a=a+-1280|0;s[f>>2]=a}l=a+d|0;s[f>>2]=(h|0)<0?0-l|0:l;l=s[p>>2]|0;b=b+1|0;a=h+(r[c>>1]|0)|0}H=e+1284|0;a=$;l=H;f=a+64|0;do{s[a>>2]=s[l>>2];a=a+4|0;l=l+4|0}while((a|0)<(f|0));z=e+2324|0;q=e+2340|0;W=e+4160|0;V=t+136|0;v=w<<24>>24>3;k=ie+2|0;y=ie+4|0;E=ie+6|0;A=ie+8|0;T=ie+10|0;S=ie+12|0;M=ie+14|0;R=ie+16|0;C=ie+18|0;P=ie+20|0;I=ie+22|0;O=ie+24|0;N=ie+26|0;D=ie+28|0;L=ie+30|0;U=e+4164|0;B=e+2308|0;j=0;F=e+4|0;G=i;o=s[Z>>2]|0;while(1){if((j|0)>=(s[z>>2]|0))break;p=t+32+(j>>1<<5)|0;Sr(ie|0,p|0,s[q>>2]<<1|0)|0;m=t+96+(j*5<<1)|0;d=n[K>>0]|0;_=s[t+16+(j<<2)>>2]|0;g=_>>>6;c=(_|0)>0;if(!c)if(!_)a=32;else{a=0-_|0;Y=12}else{a=_;Y=12}if((Y|0)==12){Y=0;a=ne(a|0)|0}l=_<>16;h=536870911/(f|0)|0;b=h<<16;w=b>>16;l=536870912-((te(f,w)|0)+((te(l&65535,w)|0)>>16))<<3;h=b+((te(l>>16,w)|0)+((te(l&65528,w)|0)>>16))+(te(l,(h>>15)+1>>1)|0)|0;a=62-a|0;l=a+-47|0;if((l|0)<1){f=47-a|0;a=-2147483648>>f;l=2147483647>>>f;if((a|0)>(l|0)){if((h|0)<=(a|0))a=(h|0)<(l|0)?l:h}else if((h|0)>(l|0))a=l;else a=(h|0)<(a|0)?a:h;a=a<>l:0;f=s[e>>2]|0;e:do if((_|0)==(f|0))c=65536;else{if((f|0)<=0)if(!f)h=32;else{l=0-f|0;Y=24}else{l=f;Y=24}if((Y|0)==24){Y=0;h=ne(l|0)|0}f=f<>16|0)|0)<<16>>16;w=(te(f>>16,c)|0)+((te(f&65535,c)|0)>>16)|0;b=Nr(b|0,((b|0)<0)<<31>>31|0,w|0,((w|0)<0)<<31>>31|0)|0;b=Tr(b|0,x|0,29)|0;f=f-(b&-8)|0;c=w+((te(f>>16,c)|0)+((te(f&65535,c)|0)>>16))|0;l=h+28-l|0;f=l+-16|0;if((l|0)<16){h=16-l|0;l=-2147483648>>h;f=2147483647>>>h;if((l|0)>(f|0)){if((c|0)<=(l|0))l=(c|0)<(f|0)?f:c}else if((c|0)>(f|0))l=f;else l=(c|0)<(l|0)?l:c;l=l<>f:0;f=l>>16;h=l&65535;c=0;while(1){if((c|0)==16){c=l;break e}w=$+(c<<2)|0;b=s[w>>2]|0;se=b<<16>>16;s[w>>2]=(te(f,se)|0)+((te(h,se)|0)>>16)+(te(l,(b>>15)+1>>1)|0);c=c+1|0}}while(0);s[e>>2]=_;if((s[W>>2]|0)!=0?d<<24>>24!=2&(s[U>>2]|0)==2&(j|0)<2:0){r[m>>1]=0;r[m+2>>1]=0;r[m+4>>1]=0;r[m+6>>1]=0;r[m+8>>1]=0;r[m+4>>1]=4096;w=s[B>>2]|0;s[t+(j<<2)>>2]=w;Y=44}else if(d<<24>>24==2){w=s[t+(j<<2)>>2]|0;Y=44}else b=F;e:do if((Y|0)==44){Y=0;d=(j|0)==0;t:do if(!d){if(!((j|0)!=2|v)){f=s[Z>>2]|0;h=s[q>>2]|0;l=f-w-h+-2|0;if((j|0)!=2){Y=49;break}Sr(e+1348+(f<<1)|0,i|0,s[Q>>2]<<2|0)|0;f=s[Z>>2]|0;h=s[q>>2]|0;Y=49;break}if((c|0)!=65536){a=w+2|0;l=c>>16;f=c&65535;h=0;while(1){if((h|0)>=(a|0))break t;se=J+(o-h+-1<<2)|0;b=s[se>>2]|0;p=b<<16>>16;s[se>>2]=(te(l,p)|0)+((te(f,p)|0)>>16)+(te(c,(b>>15)+1>>1)|0);h=h+1|0}}}else{f=s[Z>>2]|0;h=s[q>>2]|0;l=f-w-h+-2|0;Y=49}while(0);t:do if((Y|0)==49){Y=0;Rn(X+(l<<1)|0,e+1348+(l+(te(j,s[Q>>2]|0)|0)<<1)|0,p,f-l|0,h);if(d){se=s[V>>2]<<16>>16;a=(te(a>>16,se)|0)+((te(a&65535,se)|0)>>16)<<2}f=w+2|0;h=a>>16;a=a&65535;l=0;while(1){if((l|0)>=(f|0))break t;se=r[X+((s[Z>>2]|0)-l+-1<<1)>>1]|0;s[J+(o-l+-1<<2)>>2]=(te(h,se)|0)+((te(a,se)|0)>>16);l=l+1|0}}while(0);h=m+2|0;c=m+4|0;d=m+6|0;p=m+8|0;f=s[Q>>2]|0;b=0;a=J+(o-w+2<<2)|0;l=o;while(1){if((b|0)>=(f|0)){b=ee;o=l;break e}w=s[a>>2]|0;se=r[m>>1]|0;se=(te(w>>16,se)|0)+((te(w&65535,se)|0)>>16)+2|0;w=s[a+-4>>2]|0;o=r[h>>1]|0;o=se+((te(w>>16,o)|0)+((te(w&65535,o)|0)>>16))|0;w=s[a+-8>>2]|0;se=r[c>>1]|0;se=o+((te(w>>16,se)|0)+((te(w&65535,se)|0)>>16))|0;w=s[a+-12>>2]|0;o=r[d>>1]|0;o=se+((te(w>>16,o)|0)+((te(w&65535,o)|0)>>16))|0;w=s[a+-16>>2]|0;se=r[p>>1]|0;se=o+((te(w>>16,se)|0)+((te(w&65535,se)|0)>>16))|0;se=(s[F+(b<<2)>>2]|0)+(se<<1)|0;s[ee+(b<<2)>>2]=se;s[J+(l<<2)>>2]=se<<1;b=b+1|0;a=a+4|0;l=l+1|0}}while(0);p=g<<16>>16;c=(_>>21)+1>>1;d=0;while(1){h=s[Q>>2]|0;if((d|0)>=(h|0))break;se=s[$+(d+15<<2)>>2]|0;_=r[ie>>1]|0;_=(s[q>>2]>>1)+((te(se>>16,_)|0)+((te(se&65535,_)|0)>>16))|0;se=s[$+(d+14<<2)>>2]|0;a=r[k>>1]|0;a=_+((te(se>>16,a)|0)+((te(se&65535,a)|0)>>16))|0;se=s[$+(d+13<<2)>>2]|0;_=r[y>>1]|0;_=a+((te(se>>16,_)|0)+((te(se&65535,_)|0)>>16))|0;se=s[$+(d+12<<2)>>2]|0;a=r[E>>1]|0;a=_+((te(se>>16,a)|0)+((te(se&65535,a)|0)>>16))|0;se=s[$+(d+11<<2)>>2]|0;_=r[A>>1]|0;_=a+((te(se>>16,_)|0)+((te(se&65535,_)|0)>>16))|0;se=s[$+(d+10<<2)>>2]|0;a=r[T>>1]|0;a=_+((te(se>>16,a)|0)+((te(se&65535,a)|0)>>16))|0;se=s[$+(d+9<<2)>>2]|0;_=r[S>>1]|0;_=a+((te(se>>16,_)|0)+((te(se&65535,_)|0)>>16))|0;se=s[$+(d+8<<2)>>2]|0;a=r[M>>1]|0;a=_+((te(se>>16,a)|0)+((te(se&65535,a)|0)>>16))|0;se=s[$+(d+7<<2)>>2]|0;_=r[R>>1]|0;_=a+((te(se>>16,_)|0)+((te(se&65535,_)|0)>>16))|0;se=s[$+(d+6<<2)>>2]|0;a=r[C>>1]|0;a=_+((te(se>>16,a)|0)+((te(se&65535,a)|0)>>16))|0;if((s[q>>2]|0)==16){se=s[$+(d+5<<2)>>2]|0;_=r[P>>1]|0;_=a+((te(se>>16,_)|0)+((te(se&65535,_)|0)>>16))|0;se=s[$+(d+4<<2)>>2]|0;a=r[I>>1]|0;a=_+((te(se>>16,a)|0)+((te(se&65535,a)|0)>>16))|0;se=s[$+(d+3<<2)>>2]|0;_=r[O>>1]|0;_=a+((te(se>>16,_)|0)+((te(se&65535,_)|0)>>16))|0;se=s[$+(d+2<<2)>>2]|0;a=r[N>>1]|0;a=_+((te(se>>16,a)|0)+((te(se&65535,a)|0)>>16))|0;se=s[$+(d+1<<2)>>2]|0;_=r[D>>1]|0;_=a+((te(se>>16,_)|0)+((te(se&65535,_)|0)>>16))|0;se=s[$+(d<<2)>>2]|0;a=r[L>>1]|0;a=_+((te(se>>16,a)|0)+((te(se&65535,a)|0)>>16))|0}l=s[b+(d<<2)>>2]|0;f=(a|0)>134217727;h=f?2147483632:((a|0)<-134217728?-134217728:a)<<4;if((l+(f?2147483632:((a|0)<-134217728?-134217728:a)<<4)|0)>-1)if((l&h|0)<0)a=-2147483648;else a=l+(f?2147483632:((a|0)<-134217728?-134217728:a)<<4)|0;else if((l|h|0)>-1)a=2147483647;else a=l+(f?2147483632:((a|0)<-134217728?-134217728:a)<<4)|0;s[$+(d+16<<2)>>2]=a;se=((te(a>>16,p)|0)+((te(a&65535,p)|0)>>16)+(te(a,c)|0)>>7)+1>>1;r[G+(d<<1)>>1]=(se|0)>32767?32767:((se|0)<-32768?-32768:se)&65535;d=d+1|0}a=$;l=$+(h<<2)|0;f=a+64|0;do{s[a>>2]=s[l>>2];a=a+4|0;l=l+4|0}while((a|0)<(f|0));j=j+1|0;F=F+(h<<2)|0;G=G+(h<<1)|0}a=H;l=$;f=a+64|0;do{s[a>>2]=s[l>>2];a=a+4|0;l=l+4|0}while((a|0)<(f|0));u=re;return}function jn(e,t,i,l,f,h,c){e=e|0;t=t|0;i=i|0;l=l|0;f=f|0;h=h|0;c=c|0;var d=0,p=0,b=0,w=0,m=0,g=0,_=0,v=0,k=0,y=0,E=0,A=0,T=0,S=0,M=0,R=0,C=0,P=0,I=0,O=0,N=0,D=0,L=0,U=0,B=0,j=0,F=0,G=0,H=0,z=0,q=0,W=0,V=0,Y=0,Z=0,$=0,K=0,X=0,J=0,Q=0,ee=0,ie=0,re=0,se=0,oe=0,ae=0,le=0;se=u;u=u+448|0;X=se+232|0;K=se+376|0;ie=se+344|0;q=se+200|0;V=se+184|0;W=se+168|0;J=se+88|0;Q=se+8|0;Z=se;re=se+312|0;Y=se+280|0;ee=se+360|0;$=se+248|0;H=i+2|0;xn(t,s[i+36>>2]|0,r[H>>1]|0);d=s[i>>2]|0;y=u;u=u+((1*((d&65535)<<2)|0)+15&-16)|0;z=i+8|0;G=i+12|0;k=d<<16>>16;d=d>>16;p=s[z>>2]|0;b=0;v=s[G>>2]|0;while(1){if((b|0)<(k|0)){m=d;g=0;_=0}else break;while(1){w=m+-2|0;if((w|0)<=-1)break;B=m+-1|0;B=te((a[t+(B<<1)>>1]|0)-(o[p+B>>0]<<7)<<16>>16,r[v+(B<<1)>>1]|0)|0;U=g>>1;F=te((a[t+(w<<1)>>1]|0)-(o[p+w>>0]<<7)<<16>>16,r[v+(w<<1)>>1]|0)|0;j=B>>1;m=w;g=F;_=_+((B|0)>(U|0)?B-U|0:U-B|0)+((F|0)>(j|0)?F-j|0:j-F|0)|0}s[y+(b<<2)>>2]=_;p=p+d|0;b=b+1|0;v=v+(d<<1)|0}F=u;u=u+((1*(h<<2)|0)+15&-16)|0;Nn(y,F,k,h);D=u;u=u+((1*(h<<2)|0)+15&-16)|0;L=u;u=u+((1*(h<<4)|0)+15&-16)|0;U=i+32|0;B=i+4|0;j=f<<16>>16;O=c>>1;N=i+16|0;P=f<<14>>16;I=0;while(1){if((I|0)>=(h|0))break;C=s[F+(I<<2)>>2]|0;m=r[H>>1]|0;_=te(C,m)|0;g=(s[z>>2]|0)+_|0;_=(s[G>>2]|0)+(_<<1)|0;v=0;while(1){if((v|0)>=(m|0))break;R=r[_+(v<<1)>>1]|0;r[re+(v<<1)>>1]=(te((a[t+(v<<1)>>1]|0)-(o[g+v>>0]<<7)<<16>>16,R)|0)>>>14;p=r[l+(v<<1)>>1]|0;S=p<<16>>16;R=te(R,R)|0;p=ne((p<<16>>16>0?S:0-S|0)|0)|0;S=S<>16|0)|0)<<16>>16;M=(te(S>>16,w)|0)+((te(S&65535,w)|0)>>16)|0;R=Nr(R|0,((R|0)<0)<<31>>31|0,M|0,((M|0)<0)<<31>>31|0)|0;R=Tr(R|0,x|0,29)|0;R=S-(R&-8)|0;w=M+((te(R>>16,w)|0)+((te(R&65535,w)|0)>>16))|0;d=p+28-d|0;p=d+-21|0;if((d|0)<21){b=21-d|0;d=-2147483648>>b;p=2147483647>>>b;if((d|0)>(p|0)){if((w|0)<=(d|0))d=(w|0)<(p|0)?p:w}else if((w|0)>(p|0))d=p;else d=(w|0)<(d|0)?d:w;d=d<>p:0;r[Y+(v<<1)>>1]=d;v=v+1|0}Ui($,ee,i,C);R=I<<4;M=s[U>>2]|0;g=s[B>>2]|0;b=g<<16>>16;w=r[H>>1]|0;m=-10;while(1){if((m|0)==10)break;d=m<<10;p=d+1024|0;e:do if((m|0)>0){d=(m<<26>>16)+-102|0;p=(p<<16>>16)+-102|0}else{switch(m|0){case 0:{p=(p<<16>>16)+-102|0;break e}case-1:{d=-1024;break}default:p=p|102}d=d|102}while(0);S=m+10|0;s[J+(S<<2)>>2]=(te(d<<16>>16,b)|0)>>16;s[Q+(S<<2)>>2]=(te(p<<16>>16,b)|0)>>16;m=m+1|0}s[q>>2]=0;r[ie>>1]=0;S=w<<16>>16;A=g>>16;d=S;E=1;e:while(1){T=E<<1;c=(T|0)<5;t:while(1){f=d+-1|0;if((d|0)<=0){g=2147483647;w=0;d=0;break e}p=M+(r[$+(f<<1)>>1]|0)|0;b=r[re+(f<<1)>>1]|0;w=ee+f|0;m=Y+(f<<1)|0;k=0;while(1){if((k|0)>=(E|0))break;v=ie+(k<<1)|0;_=(te(o[w>>0]|0,r[v>>1]|0)|0)>>8;d=(te(A,b-_<<16>>16)|0)>>16;d=(d|0)>9?9:(d|0)<-10?-10:d;n[K+(k<<4)+f>>0]=d;y=d+10|0;g=(s[J+(y<<2)>>2]|0)+_|0;_=(s[Q+(y<<2)>>2]|0)+_|0;r[v>>1]=g;v=k+E|0;r[ie+(v<<1)>>1]=_;do if((d|0)>2)if((d|0)==3){y=o[p+7>>0]|0;d=280;break}else{d=d*43|0;y=d+108|0;d=d+151|0;break}else{if((d|0)>=-3){y=o[p+(d+4)>>0]|0;d=o[p+(d+5)>>0]|0;break}if((d|0)==-4){y=280;d=o[p+1>>0]|0;break}else{d=te(d,-43)|0;y=d+108|0;d=d+65|0;break}}while(0);ae=q+(k<<2)|0;oe=s[ae>>2]|0;le=b-g<<16>>16;le=te(le,le)|0;g=r[m>>1]|0;s[ae>>2]=oe+(te(le,g)|0)+(te(j,y<<16>>16)|0);y=b-_<<16>>16;s[q+(v<<2)>>2]=oe+(te(te(y,y)|0,g)|0)+(te(j,d<<16>>16)|0);k=k+1|0}if(c){d=0;break}else _=0;while(1){if((_|0)==4){d=0;m=0;p=0;b=0;w=2147483647;break}b=q+(_<<2)|0;d=s[b>>2]|0;p=_+4|0;w=q+(p<<2)|0;g=s[w>>2]|0;m=W+(_<<2)|0;if((d|0)>(g|0)){s[m>>2]=d;s[b>>2]=g;s[w>>2]=d;ae=ie+(_<<1)|0;le=r[ae>>1]|0;d=ie+(p<<1)|0;r[ae>>1]=r[d>>1]|0;r[d>>1]=le;d=g}else{s[m>>2]=g;p=_}s[V+(_<<2)>>2]=d;s[X+(_<<2)>>2]=p;_=_+1|0}while(1){if((p|0)<4){le=s[W+(p<<2)>>2]|0;ae=(w|0)>(le|0);oe=s[V+(p<<2)>>2]|0;y=(b|0)<(oe|0);d=y?p:d;m=ae?p:m;p=p+1|0;b=y?oe:b;w=ae?le:w;continue}if((w|0)>=(b|0)){d=0;break}s[X+(d<<2)>>2]=s[X+(m<<2)>>2]^4;b=m+4|0;s[q+(d<<2)>>2]=s[q+(b<<2)>>2];r[ie+(d<<1)>>1]=r[ie+(b<<1)>>1]|0;s[V+(d<<2)>>2]=0;s[W+(m<<2)>>2]=2147483647;b=K+(d<<4)|0;d=K+(m<<4)|0;p=b+16|0;do{n[b>>0]=n[d>>0]|0;b=b+1|0;d=d+1|0}while((b|0)<(p|0));d=0;m=0;p=0;b=0;w=2147483647}while(1){if((d|0)==4){d=f;continue t}le=K+(d<<4)+f|0;n[le>>0]=(o[le>>0]|0)+((s[X+(d<<2)>>2]|0)>>>2);d=d+1|0}}while(1){if((d|0)>=(E|0)){d=T;break}n[K+(d+E<<4)+f>>0]=(o[K+(d<<4)+f>>0]|0)+1;d=d+1|0}while(1){if((d|0)>=4){d=f;E=T;continue e}n[K+(d<<4)+f>>0]=n[K+(d-T<<4)+f>>0]|0;d=d+1|0}}while(1){if((d|0)==8)break;ae=s[q+(d<<2)>>2]|0;le=(g|0)>(ae|0);g=le?ae:g;w=le?d:w;d=d+1|0}d=L+R|0;p=w&3;b=0;while(1){if((b|0)>=(S|0))break;n[d+b>>0]=n[K+(p<<4)+b>>0]|0;b=b+1|0}n[d>>0]=(o[d>>0]|0)+(w>>>2);m=D+(I<<2)|0;s[m>>2]=g;d=te(O,r[i>>1]|0)|0;d=(s[N>>2]|0)+d|0;p=n[d+C>>0]|0;if(!C)d=256-(p&255)|0;else d=(o[d+(C+-1)>>0]|0)-(p&255)|0;w=ne(d|0)|0;p=24-w|0;b=0-p|0;do if(p)if((p|0)<0){d=d<>>(p+32|0);break}else{d=d<<32-p|d>>>p;break}while(0);le=d&127;s[m>>2]=g+(te(1024-(le+(((te(le,128-le|0)|0)*179|0)>>>16)+(31-w<<7))<<16>>16,P)|0);I=I+1|0}Nn(D,Z,h,1);le=s[Z>>2]|0;n[e>>0]=s[F+(le<<2)>>2];Sr(e+1|0,L+(le<<4)|0,r[H>>1]|0)|0;gn(t,e,i);u=se;return}function Fn(){Nt(360,33176);Ve(376,33181,1,1,0);ct(384,33186,1,-128,127);ct(400,33191,1,-128,127);ct(392,33203,1,0,255);ct(408,33217,2,-32768,32767);ct(416,33223,2,0,65535);ct(424,33238,4,-2147483648,2147483647);ct(432,33242,4,0,-1);ct(440,33255,4,-2147483648,2147483647);ct(448,33260,4,0,-1);qt(456,33274,4);qt(464,33280,8);xe(48,33388);xe(80,33463);Ut(104,4,33559);$e(128,33591);Ct(136,0,33638);Ct(144,0,33699);Ct(152,1,33767);Ct(160,2,33837);Ct(168,3,33899);Ct(176,4,33970);Ct(184,5,34030);Ct(192,4,34099);Ct(200,5,34160);Ct(144,0,34199);Ct(152,1,34231);Ct(160,2,34264);Ct(168,3,34297);Ct(176,4,34331);Ct(184,5,34364);Ct(208,6,34429);Ct(216,7,34491);Ct(224,7,34554);return}function Gn(e){e=e|0;var t=0,i=0,r=0,o=0;o=s[e+4>>2]|0;r=o;e:do if(!(r&3)){e=o;i=4}else{t=o;e=r;while(1){if(!(n[t>>0]|0))break e;t=t+1|0;e=t;if(!(e&3)){e=t;i=4;break}}}while(0);if((i|0)==4){while(1){t=s[e>>2]|0;if(!((t&-2139062144^-2139062144)&t+-16843009))e=e+4|0;else break}if((t&255)<<24>>24)do e=e+1|0;while((n[e>>0]|0)!=0)}e=e-r+1|0;t=zn(e)|0;if(!t){o=0;return o|0}Sr(t|0,o|0,e|0)|0;o=t;return o|0}function Hn(e){e=+e;var t=0,i=0,n=0,r=0,o=0,a=0,l=0,f=0,u=0;h[d>>3]=e;i=s[d>>2]|0;t=s[d+4>>2]|0;n=(t|0)<0;do if(n|t>>>0<1048576){o=+H(+e);h[d>>3]=o;if((s[d>>2]|0)==0&(s[d+4>>2]|0)==0){e=-1/(e*e);break}if(n){e=(e-e)/0;break}else{h[d>>3]=e*0x40000000000000;t=s[d+4>>2]|0;n=s[d>>2]|0;i=-1077;r=9;break}}else if(t>>>0<=2146435071)if((i|0)==0&0==0&(t|0)==1072693248)e=0;else{ -n=i;i=-1023;r=9}while(0);if((r|0)==9){r=t+614242|0;s[d>>2]=n;s[d+4>>2]=(r&1048575)+1072079006;l=+h[d>>3]+-1;a=l*(l*.5);f=l/(l+2);u=f*f;e=u*u;h[d>>3]=l-a;n=s[d+4>>2]|0;s[d>>2]=0;s[d+4>>2]=n;o=+h[d>>3];e=l-o-a+f*(a+(e*(e*(e*.15313837699209373+.22222198432149784)+.3999999999940942)+u*(e*(e*(e*.14798198605116586+.1818357216161805)+.2857142874366239)+.6666666666666735)));u=o*.4342944818781689;a=+(i+(r>>>20)|0);f=a*.30102999566361177;l=f+u;e=l+(u+(f-l)+(e*.4342944818781689+(a*3.694239077158931e-13+(o+e)*2.5082946711645275e-11)))}return+e}function zn(e){e=e|0;var t=0,i=0,n=0,r=0,o=0,a=0,l=0,f=0,h=0,u=0,c=0,d=0,p=0,b=0,w=0,m=0,g=0,_=0,v=0,k=0,y=0,E=0,A=0,T=0,S=0,M=0,R=0,C=0,P=0,x=0,I=0;do if(e>>>0<245){p=e>>>0<11?16:e+11&-8;e=p>>>3;f=s[8744]|0;t=f>>>e;if(t&3|0){t=(t&1^1)+e|0;i=35016+(t<<1<<2)|0;n=i+8|0;r=s[n>>2]|0;o=r+8|0;a=s[o>>2]|0;do if((i|0)!=(a|0)){if(a>>>0<(s[8748]|0)>>>0)At();e=a+12|0;if((s[e>>2]|0)==(r|0)){s[e>>2]=i;s[n>>2]=a;break}else At()}else s[8744]=f&~(1<>2]=I|3;I=r+I+4|0;s[I>>2]=s[I>>2]|1;I=o;return I|0}a=s[8746]|0;if(p>>>0>a>>>0){if(t|0){i=2<>>12&16;i=i>>>l;r=i>>>5&8;i=i>>>r;o=i>>>2&4;i=i>>>o;n=i>>>1&2;i=i>>>n;t=i>>>1&1;t=(r|l|o|n|t)+(i>>>t)|0;i=35016+(t<<1<<2)|0;n=i+8|0;o=s[n>>2]|0;l=o+8|0;r=s[l>>2]|0;do if((i|0)!=(r|0)){if(r>>>0<(s[8748]|0)>>>0)At();e=r+12|0;if((s[e>>2]|0)==(o|0)){s[e>>2]=i;s[n>>2]=r;h=s[8746]|0;break}else At()}else{s[8744]=f&~(1<>2]=p|3;n=o+p|0;s[n+4>>2]=a|1;s[n+a>>2]=a;if(h|0){r=s[8749]|0;t=h>>>3;i=35016+(t<<1<<2)|0;e=s[8744]|0;t=1<>2]|0;if(t>>>0<(s[8748]|0)>>>0)At();else{u=e;c=t}}else{s[8744]=e|t;u=i+8|0;c=i}s[u>>2]=r;s[c+12>>2]=r;s[r+8>>2]=c;s[r+12>>2]=i}s[8746]=a;s[8749]=n;I=l;return I|0}e=s[8745]|0;if(e){l=(e&0-e)+-1|0;x=l>>>12&16;l=l>>>x;P=l>>>5&8;l=l>>>P;I=l>>>2&4;l=l>>>I;t=l>>>1&2;l=l>>>t;f=l>>>1&1;f=s[35280+((P|x|I|t|f)+(l>>>f)<<2)>>2]|0;l=(s[f+4>>2]&-8)-p|0;t=f;while(1){e=s[t+16>>2]|0;if(!e){e=s[t+20>>2]|0;if(!e)break}t=(s[e+4>>2]&-8)-p|0;I=t>>>0>>0;l=I?t:l;t=e;f=I?e:f}r=s[8748]|0;if(f>>>0>>0)At();a=f+p|0;if(f>>>0>=a>>>0)At();o=s[f+24>>2]|0;i=s[f+12>>2]|0;do if((i|0)==(f|0)){t=f+20|0;e=s[t>>2]|0;if(!e){t=f+16|0;e=s[t>>2]|0;if(!e){d=0;break}}while(1){i=e+20|0;n=s[i>>2]|0;if(n|0){e=n;t=i;continue}i=e+16|0;n=s[i>>2]|0;if(!n)break;else{e=n;t=i}}if(t>>>0>>0)At();else{s[t>>2]=0;d=e;break}}else{n=s[f+8>>2]|0;if(n>>>0>>0)At();e=n+12|0;if((s[e>>2]|0)!=(f|0))At();t=i+8|0;if((s[t>>2]|0)==(f|0)){s[e>>2]=i;s[t>>2]=n;d=i;break}else At()}while(0);do if(o|0){e=s[f+28>>2]|0;t=35280+(e<<2)|0;if((f|0)==(s[t>>2]|0)){s[t>>2]=d;if(!d){s[8745]=s[8745]&~(1<>>0<(s[8748]|0)>>>0)At();e=o+16|0;if((s[e>>2]|0)==(f|0))s[e>>2]=d;else s[o+20>>2]=d;if(!d)break}t=s[8748]|0;if(d>>>0>>0)At();s[d+24>>2]=o;e=s[f+16>>2]|0;do if(e|0)if(e>>>0>>0)At();else{s[d+16>>2]=e;s[e+24>>2]=d;break}while(0);e=s[f+20>>2]|0;if(e|0)if(e>>>0<(s[8748]|0)>>>0)At();else{s[d+20>>2]=e;s[e+24>>2]=d;break}}while(0);if(l>>>0<16){I=l+p|0;s[f+4>>2]=I|3;I=f+I+4|0;s[I>>2]=s[I>>2]|1}else{s[f+4>>2]=p|3;s[a+4>>2]=l|1;s[a+l>>2]=l;e=s[8746]|0;if(e|0){n=s[8749]|0;t=e>>>3;i=35016+(t<<1<<2)|0;e=s[8744]|0;t=1<>2]|0;if(t>>>0<(s[8748]|0)>>>0)At();else{b=e;w=t}}else{s[8744]=e|t;b=i+8|0;w=i}s[b>>2]=n;s[w+12>>2]=n;s[n+8>>2]=w;s[n+12>>2]=i}s[8746]=l;s[8749]=a}I=f+8|0;return I|0}}}else if(e>>>0<=4294967231){e=e+11|0;p=e&-8;h=s[8745]|0;if(h){i=0-p|0;e=e>>>8;if(e)if(p>>>0>16777215)f=31;else{w=(e+1048320|0)>>>16&8;T=e<>>16&4;T=T<>>16&2;f=14-(b|w|f)+(T<>>15)|0;f=p>>>(f+7|0)&1|f<<1}else f=0;t=s[35280+(f<<2)>>2]|0;e:do if(!t){e=0;t=0;T=86}else{r=i;e=0;a=p<<((f|0)==31?0:25-(f>>>1)|0);l=t;t=0;while(1){n=s[l+4>>2]&-8;i=n-p|0;if(i>>>0>>0)if((n|0)==(p|0)){e=l;t=l;T=90;break e}else t=l;else i=r;n=s[l+20>>2]|0;l=s[l+16+(a>>>31<<2)>>2]|0;e=(n|0)==0|(n|0)==(l|0)?e:n;n=(l|0)==0;if(n){T=86;break}else{r=i;a=a<<(n&1^1)}}}while(0);if((T|0)==86){if((e|0)==0&(t|0)==0){e=2<>>12&16;w=w>>>c;u=w>>>5&8;w=w>>>u;d=w>>>2&4;w=w>>>d;b=w>>>1&2;w=w>>>b;e=w>>>1&1;e=s[35280+((u|c|d|b|e)+(w>>>e)<<2)>>2]|0}if(!e){l=i;f=t}else T=90}if((T|0)==90)while(1){T=0;w=(s[e+4>>2]&-8)-p|0;n=w>>>0>>0;i=n?w:i;t=n?e:t;n=s[e+16>>2]|0;if(n|0){e=n;T=90;continue}e=s[e+20>>2]|0;if(!e){l=i;f=t;break}else T=90}if((f|0)!=0?l>>>0<((s[8746]|0)-p|0)>>>0:0){r=s[8748]|0;if(f>>>0>>0)At();a=f+p|0;if(f>>>0>=a>>>0)At();o=s[f+24>>2]|0;i=s[f+12>>2]|0;do if((i|0)==(f|0)){t=f+20|0;e=s[t>>2]|0;if(!e){t=f+16|0;e=s[t>>2]|0;if(!e){g=0;break}}while(1){i=e+20|0;n=s[i>>2]|0;if(n|0){e=n;t=i;continue}i=e+16|0;n=s[i>>2]|0;if(!n)break;else{e=n;t=i}}if(t>>>0>>0)At();else{s[t>>2]=0;g=e;break}}else{n=s[f+8>>2]|0;if(n>>>0>>0)At();e=n+12|0;if((s[e>>2]|0)!=(f|0))At();t=i+8|0;if((s[t>>2]|0)==(f|0)){s[e>>2]=i;s[t>>2]=n;g=i;break}else At()}while(0);do if(o|0){e=s[f+28>>2]|0;t=35280+(e<<2)|0;if((f|0)==(s[t>>2]|0)){s[t>>2]=g;if(!g){s[8745]=s[8745]&~(1<>>0<(s[8748]|0)>>>0)At();e=o+16|0;if((s[e>>2]|0)==(f|0))s[e>>2]=g;else s[o+20>>2]=g;if(!g)break}t=s[8748]|0;if(g>>>0>>0)At();s[g+24>>2]=o;e=s[f+16>>2]|0;do if(e|0)if(e>>>0>>0)At();else{s[g+16>>2]=e;s[e+24>>2]=g;break}while(0);e=s[f+20>>2]|0;if(e|0)if(e>>>0<(s[8748]|0)>>>0)At();else{s[g+20>>2]=e;s[e+24>>2]=g;break}}while(0);do if(l>>>0>=16){s[f+4>>2]=p|3;s[a+4>>2]=l|1;s[a+l>>2]=l;e=l>>>3;if(l>>>0<256){i=35016+(e<<1<<2)|0;t=s[8744]|0;e=1<>2]|0;if(t>>>0<(s[8748]|0)>>>0)At();else{_=e;k=t}}else{s[8744]=t|e;_=i+8|0;k=i}s[_>>2]=a;s[k+12>>2]=a;s[a+8>>2]=k;s[a+12>>2]=i;break}e=l>>>8;if(e)if(l>>>0>16777215)i=31;else{x=(e+1048320|0)>>>16&8;I=e<>>16&4;I=I<>>16&2;i=14-(P|x|i)+(I<>>15)|0;i=l>>>(i+7|0)&1|i<<1}else i=0;n=35280+(i<<2)|0;s[a+28>>2]=i;e=a+16|0;s[e+4>>2]=0;s[e>>2]=0;e=s[8745]|0;t=1<>2]=a;s[a+24>>2]=n;s[a+12>>2]=a;s[a+8>>2]=a;break}i=l<<((i|0)==31?0:25-(i>>>1)|0);n=s[n>>2]|0;while(1){if((s[n+4>>2]&-8|0)==(l|0)){T=148;break}t=n+16+(i>>>31<<2)|0;e=s[t>>2]|0;if(!e){T=145;break}else{i=i<<1;n=e}}if((T|0)==145)if(t>>>0<(s[8748]|0)>>>0)At();else{s[t>>2]=a;s[a+24>>2]=n;s[a+12>>2]=a;s[a+8>>2]=a;break}else if((T|0)==148){e=n+8|0;t=s[e>>2]|0;I=s[8748]|0;if(t>>>0>=I>>>0&n>>>0>=I>>>0){s[t+12>>2]=a;s[e>>2]=a;s[a+8>>2]=t;s[a+12>>2]=n;s[a+24>>2]=0;break}else At()}}else{I=l+p|0;s[f+4>>2]=I|3;I=f+I+4|0;s[I>>2]=s[I>>2]|1}while(0);I=f+8|0;return I|0}}}else p=-1;while(0);i=s[8746]|0;if(i>>>0>=p>>>0){e=i-p|0;t=s[8749]|0;if(e>>>0>15){I=t+p|0;s[8749]=I;s[8746]=e;s[I+4>>2]=e|1;s[I+e>>2]=e;s[t+4>>2]=p|3}else{s[8746]=0;s[8749]=0;s[t+4>>2]=i|3;I=t+i+4|0;s[I>>2]=s[I>>2]|1}I=t+8|0;return I|0}e=s[8747]|0;if(e>>>0>p>>>0){P=e-p|0;s[8747]=P;I=s[8750]|0;x=I+p|0;s[8750]=x;s[x+4>>2]=P|1;s[I+4>>2]=p|3;I=I+8|0;return I|0}do if(!(s[8862]|0)){e=Ce(30)|0;if(!(e+-1&e)){s[8864]=e;s[8863]=e;s[8865]=-1;s[8866]=-1;s[8867]=0;s[8855]=0;s[8862]=(nt(0)|0)&-16^1431655768;break}else At()}while(0);a=p+48|0;n=s[8864]|0;l=p+47|0;i=n+l|0;n=0-n|0;f=i&n;if(f>>>0<=p>>>0){I=0;return I|0}e=s[8854]|0;if(e|0?(_=s[8852]|0,k=_+f|0,k>>>0<=_>>>0|k>>>0>e>>>0):0){I=0;return I|0}e:do if(!(s[8855]&4)){t=s[8750]|0;t:do if(t){r=35424;while(1){e=s[r>>2]|0;if(e>>>0<=t>>>0?(m=r+4|0,(e+(s[m>>2]|0)|0)>>>0>t>>>0):0)break;e=s[r+8>>2]|0;if(!e){T=173;break t}else r=e}e=i-(s[8747]|0)&n;if(e>>>0<2147483647){t=Se(e|0)|0;if((t|0)==((s[r>>2]|0)+(s[m>>2]|0)|0)){if((t|0)!=(-1|0)){a=t;o=e;T=193;break e}}else T=183}}else T=173;while(0);do if((T|0)==173?(v=Se(0)|0,(v|0)!=(-1|0)):0){e=v;t=s[8863]|0;i=t+-1|0;if(!(i&e))e=f;else e=f-e+(i+e&0-t)|0;t=s[8852]|0;i=t+e|0;if(e>>>0>p>>>0&e>>>0<2147483647){k=s[8854]|0;if(k|0?i>>>0<=t>>>0|i>>>0>k>>>0:0)break;t=Se(e|0)|0;if((t|0)==(v|0)){a=v;o=e;T=193;break e}else T=183}}while(0);t:do if((T|0)==183){i=0-e|0;do if(a>>>0>e>>>0&(e>>>0<2147483647&(t|0)!=(-1|0))?(y=s[8864]|0,y=l-e+y&0-y,y>>>0<2147483647):0)if((Se(y|0)|0)==(-1|0)){Se(i|0)|0;break t}else{e=y+e|0;break}while(0);if((t|0)!=(-1|0)){a=t;o=e;T=193;break e}}while(0);s[8855]=s[8855]|4;T=190}else T=190;while(0);if((((T|0)==190?f>>>0<2147483647:0)?(E=Se(f|0)|0,A=Se(0)|0,E>>>0>>0&((E|0)!=(-1|0)&(A|0)!=(-1|0))):0)?(o=A-E|0,o>>>0>(p+40|0)>>>0):0){a=E;T=193}if((T|0)==193){e=(s[8852]|0)+o|0;s[8852]=e;if(e>>>0>(s[8853]|0)>>>0)s[8853]=e;h=s[8750]|0;do if(h){r=35424;while(1){e=s[r>>2]|0;t=r+4|0;i=s[t>>2]|0;if((a|0)==(e+i|0)){T=203;break}n=s[r+8>>2]|0;if(!n)break;else r=n}if(((T|0)==203?(s[r+12>>2]&8|0)==0:0)?h>>>0>>0&h>>>0>=e>>>0:0){s[t>>2]=i+o;I=h+8|0;I=(I&7|0)==0?0:0-I&7;x=h+I|0;I=o-I+(s[8747]|0)|0;s[8750]=x;s[8747]=I;s[x+4>>2]=I|1;s[x+I+4>>2]=40;s[8751]=s[8866];break}e=s[8748]|0;if(a>>>0>>0){s[8748]=a;l=a}else l=e;t=a+o|0;e=35424;while(1){if((s[e>>2]|0)==(t|0)){T=211;break}e=s[e+8>>2]|0;if(!e){t=35424;break}}if((T|0)==211)if(!(s[e+12>>2]&8)){s[e>>2]=a;c=e+4|0;s[c>>2]=(s[c>>2]|0)+o;c=a+8|0;c=a+((c&7|0)==0?0:0-c&7)|0;e=t+8|0;e=t+((e&7|0)==0?0:0-e&7)|0;u=c+p|0;f=e-c-p|0;s[c+4>>2]=p|3;do if((e|0)!=(h|0)){if((e|0)==(s[8749]|0)){I=(s[8746]|0)+f|0;s[8746]=I;s[8749]=u;s[u+4>>2]=I|1;s[u+I>>2]=I;break}t=s[e+4>>2]|0;if((t&3|0)==1){a=t&-8;r=t>>>3;e:do if(t>>>0>=256){o=s[e+24>>2]|0;n=s[e+12>>2]|0;do if((n|0)==(e|0)){n=e+16|0;i=n+4|0;t=s[i>>2]|0;if(!t){t=s[n>>2]|0;if(!t){P=0;break}else i=n}while(1){n=t+20|0;r=s[n>>2]|0;if(r|0){t=r;i=n;continue}n=t+16|0;r=s[n>>2]|0;if(!r)break;else{t=r;i=n}}if(i>>>0>>0)At();else{s[i>>2]=0;P=t;break}}else{r=s[e+8>>2]|0;if(r>>>0>>0)At();t=r+12|0;if((s[t>>2]|0)!=(e|0))At();i=n+8|0;if((s[i>>2]|0)==(e|0)){s[t>>2]=n;s[i>>2]=r;P=n;break}else At()}while(0);if(!o)break;t=s[e+28>>2]|0;i=35280+(t<<2)|0;do if((e|0)!=(s[i>>2]|0)){if(o>>>0<(s[8748]|0)>>>0)At();t=o+16|0;if((s[t>>2]|0)==(e|0))s[t>>2]=P;else s[o+20>>2]=P;if(!P)break e}else{s[i>>2]=P;if(P|0)break;s[8745]=s[8745]&~(1<>>0>>0)At();s[P+24>>2]=o;t=e+16|0;i=s[t>>2]|0;do if(i|0)if(i>>>0>>0)At();else{s[P+16>>2]=i;s[i+24>>2]=P;break}while(0);t=s[t+4>>2]|0;if(!t)break;if(t>>>0<(s[8748]|0)>>>0)At();else{s[P+20>>2]=t;s[t+24>>2]=P;break}}else{i=s[e+8>>2]|0;n=s[e+12>>2]|0;t=35016+(r<<1<<2)|0;do if((i|0)!=(t|0)){if(i>>>0>>0)At();if((s[i+12>>2]|0)==(e|0))break;At()}while(0);if((n|0)==(i|0)){s[8744]=s[8744]&~(1<>>0>>0)At();t=n+8|0;if((s[t>>2]|0)==(e|0)){M=t;break}At()}while(0);s[i+12>>2]=n;s[M>>2]=i}while(0);e=e+a|0;r=a+f|0}else r=f;e=e+4|0;s[e>>2]=s[e>>2]&-2;s[u+4>>2]=r|1;s[u+r>>2]=r;e=r>>>3;if(r>>>0<256){i=35016+(e<<1<<2)|0;t=s[8744]|0;e=1<>2]|0;if(t>>>0>=(s[8748]|0)>>>0){x=e;I=t;break}At()}while(0);s[x>>2]=u;s[I+12>>2]=u;s[u+8>>2]=I;s[u+12>>2]=i;break}e=r>>>8;do if(!e)i=0;else{if(r>>>0>16777215){i=31;break}x=(e+1048320|0)>>>16&8;I=e<>>16&4;I=I<>>16&2;i=14-(P|x|i)+(I<>>15)|0;i=r>>>(i+7|0)&1|i<<1}while(0);n=35280+(i<<2)|0;s[u+28>>2]=i;e=u+16|0;s[e+4>>2]=0;s[e>>2]=0;e=s[8745]|0;t=1<>2]=u;s[u+24>>2]=n;s[u+12>>2]=u;s[u+8>>2]=u;break}i=r<<((i|0)==31?0:25-(i>>>1)|0);n=s[n>>2]|0;while(1){if((s[n+4>>2]&-8|0)==(r|0)){T=281;break}t=n+16+(i>>>31<<2)|0;e=s[t>>2]|0;if(!e){T=278;break}else{i=i<<1;n=e}}if((T|0)==278)if(t>>>0<(s[8748]|0)>>>0)At();else{s[t>>2]=u;s[u+24>>2]=n;s[u+12>>2]=u;s[u+8>>2]=u;break}else if((T|0)==281){e=n+8|0;t=s[e>>2]|0;I=s[8748]|0;if(t>>>0>=I>>>0&n>>>0>=I>>>0){s[t+12>>2]=u;s[e>>2]=u;s[u+8>>2]=t;s[u+12>>2]=n;s[u+24>>2]=0;break}else At()}}else{I=(s[8747]|0)+f|0;s[8747]=I;s[8750]=u;s[u+4>>2]=I|1}while(0);I=c+8|0;return I|0}else t=35424;while(1){e=s[t>>2]|0;if(e>>>0<=h>>>0?(S=e+(s[t+4>>2]|0)|0,S>>>0>h>>>0):0)break;t=s[t+8>>2]|0}r=S+-47|0;t=r+8|0;t=r+((t&7|0)==0?0:0-t&7)|0;r=h+16|0;t=t>>>0>>0?h:t;e=t+8|0;i=a+8|0;i=(i&7|0)==0?0:0-i&7;I=a+i|0;i=o+-40-i|0;s[8750]=I;s[8747]=i;s[I+4>>2]=i|1;s[I+i+4>>2]=40;s[8751]=s[8866];i=t+4|0;s[i>>2]=27;s[e>>2]=s[8856];s[e+4>>2]=s[8857];s[e+8>>2]=s[8858];s[e+12>>2]=s[8859];s[8856]=a;s[8857]=o;s[8859]=0;s[8858]=e;e=t+24|0;do{e=e+4|0;s[e>>2]=7}while((e+4|0)>>>0>>0);if((t|0)!=(h|0)){o=t-h|0;s[i>>2]=s[i>>2]&-2;s[h+4>>2]=o|1;s[t>>2]=o;e=o>>>3;if(o>>>0<256){i=35016+(e<<1<<2)|0;t=s[8744]|0;e=1<>2]|0;if(t>>>0<(s[8748]|0)>>>0)At();else{R=e;C=t}}else{s[8744]=t|e;R=i+8|0;C=i}s[R>>2]=h;s[C+12>>2]=h;s[h+8>>2]=C;s[h+12>>2]=i;break}e=o>>>8;if(e)if(o>>>0>16777215)i=31;else{x=(e+1048320|0)>>>16&8;I=e<>>16&4;I=I<>>16&2;i=14-(P|x|i)+(I<>>15)|0;i=o>>>(i+7|0)&1|i<<1}else i=0;n=35280+(i<<2)|0;s[h+28>>2]=i;s[h+20>>2]=0;s[r>>2]=0;e=s[8745]|0;t=1<>2]=h;s[h+24>>2]=n;s[h+12>>2]=h;s[h+8>>2]=h;break}i=o<<((i|0)==31?0:25-(i>>>1)|0);n=s[n>>2]|0;while(1){if((s[n+4>>2]&-8|0)==(o|0)){T=307;break}t=n+16+(i>>>31<<2)|0;e=s[t>>2]|0;if(!e){T=304;break}else{i=i<<1;n=e}}if((T|0)==304)if(t>>>0<(s[8748]|0)>>>0)At();else{s[t>>2]=h;s[h+24>>2]=n;s[h+12>>2]=h;s[h+8>>2]=h;break}else if((T|0)==307){e=n+8|0;t=s[e>>2]|0;I=s[8748]|0;if(t>>>0>=I>>>0&n>>>0>=I>>>0){s[t+12>>2]=h;s[e>>2]=h;s[h+8>>2]=t;s[h+12>>2]=n;s[h+24>>2]=0;break}else At()}}}else{I=s[8748]|0;if((I|0)==0|a>>>0>>0)s[8748]=a;s[8856]=a;s[8857]=o;s[8859]=0;s[8753]=s[8862];s[8752]=-1;e=0;do{I=35016+(e<<1<<2)|0;s[I+12>>2]=I;s[I+8>>2]=I;e=e+1|0}while((e|0)!=32);I=a+8|0;I=(I&7|0)==0?0:0-I&7;x=a+I|0;I=o+-40-I|0;s[8750]=x;s[8747]=I;s[x+4>>2]=I|1;s[x+I+4>>2]=40;s[8751]=s[8866]}while(0);e=s[8747]|0;if(e>>>0>p>>>0){P=e-p|0;s[8747]=P;I=s[8750]|0;x=I+p|0;s[8750]=x;s[x+4>>2]=P|1;s[I+4>>2]=p|3;I=I+8|0;return I|0}}if(!(s[8732]|0))e=34972;else e=s[(Gt()|0)+64>>2]|0;s[e>>2]=12;I=0;return I|0}function qn(e){e=e|0;var t=0,i=0,n=0,r=0,o=0,a=0,l=0,f=0,h=0,u=0,c=0,d=0,p=0,b=0,w=0;if(!e)return;i=e+-8|0;a=s[8748]|0;if(i>>>0>>0)At();e=s[e+-4>>2]|0;t=e&3;if((t|0)==1)At();n=e&-8;c=i+n|0;do if(!(e&1)){e=s[i>>2]|0;if(!t)return;h=i+(0-e)|0;f=e+n|0;if(h>>>0>>0)At();if((h|0)==(s[8749]|0)){e=c+4|0;t=s[e>>2]|0;if((t&3|0)!=3){w=h;r=f;break}s[8746]=f;s[e>>2]=t&-2;s[h+4>>2]=f|1;s[h+f>>2]=f;return}n=e>>>3;if(e>>>0<256){t=s[h+8>>2]|0;i=s[h+12>>2]|0;e=35016+(n<<1<<2)|0;if((t|0)!=(e|0)){if(t>>>0>>0)At();if((s[t+12>>2]|0)!=(h|0))At()}if((i|0)==(t|0)){s[8744]=s[8744]&~(1<>>0>>0)At();e=i+8|0;if((s[e>>2]|0)==(h|0))o=e;else At()}else o=i+8|0;s[t+12>>2]=i;s[o>>2]=t;w=h;r=f;break}o=s[h+24>>2]|0;i=s[h+12>>2]|0;do if((i|0)==(h|0)){i=h+16|0;t=i+4|0;e=s[t>>2]|0;if(!e){e=s[i>>2]|0;if(!e){l=0;break}else t=i}while(1){i=e+20|0;n=s[i>>2]|0;if(n|0){e=n;t=i;continue}i=e+16|0;n=s[i>>2]|0;if(!n)break;else{e=n;t=i}}if(t>>>0>>0)At();else{s[t>>2]=0;l=e;break}}else{n=s[h+8>>2]|0;if(n>>>0>>0)At();e=n+12|0;if((s[e>>2]|0)!=(h|0))At();t=i+8|0;if((s[t>>2]|0)==(h|0)){s[e>>2]=i;s[t>>2]=n;l=i;break}else At()}while(0);if(o){e=s[h+28>>2]|0;t=35280+(e<<2)|0;if((h|0)==(s[t>>2]|0)){s[t>>2]=l;if(!l){s[8745]=s[8745]&~(1<>>0<(s[8748]|0)>>>0)At();e=o+16|0;if((s[e>>2]|0)==(h|0))s[e>>2]=l;else s[o+20>>2]=l;if(!l){w=h;r=f;break}}i=s[8748]|0;if(l>>>0>>0)At();s[l+24>>2]=o;e=h+16|0;t=s[e>>2]|0;do if(t|0)if(t>>>0>>0)At();else{s[l+16>>2]=t;s[t+24>>2]=l;break}while(0);e=s[e+4>>2]|0;if(e)if(e>>>0<(s[8748]|0)>>>0)At();else{s[l+20>>2]=e;s[e+24>>2]=l;w=h;r=f;break}else{w=h;r=f}}else{w=h;r=f}}else{w=i;r=n}while(0);if(w>>>0>=c>>>0)At();e=c+4|0;t=s[e>>2]|0;if(!(t&1))At();if(!(t&2)){if((c|0)==(s[8750]|0)){b=(s[8747]|0)+r|0;s[8747]=b;s[8750]=w;s[w+4>>2]=b|1;if((w|0)!=(s[8749]|0))return;s[8749]=0;s[8746]=0;return}if((c|0)==(s[8749]|0)){b=(s[8746]|0)+r|0;s[8746]=b;s[8749]=w;s[w+4>>2]=b|1;s[w+b>>2]=b;return}r=(t&-8)+r|0;n=t>>>3;do if(t>>>0>=256){o=s[c+24>>2]|0;e=s[c+12>>2]|0;do if((e|0)==(c|0)){i=c+16|0;t=i+4|0;e=s[t>>2]|0;if(!e){e=s[i>>2]|0;if(!e){d=0;break}else t=i}while(1){i=e+20|0;n=s[i>>2]|0;if(n|0){e=n;t=i;continue}i=e+16|0;n=s[i>>2]|0;if(!n)break;else{e=n;t=i}}if(t>>>0<(s[8748]|0)>>>0)At();else{s[t>>2]=0;d=e;break}}else{t=s[c+8>>2]|0;if(t>>>0<(s[8748]|0)>>>0)At();i=t+12|0;if((s[i>>2]|0)!=(c|0))At();n=e+8|0;if((s[n>>2]|0)==(c|0)){s[i>>2]=e;s[n>>2]=t;d=e;break}else At()}while(0);if(o|0){e=s[c+28>>2]|0;t=35280+(e<<2)|0;if((c|0)==(s[t>>2]|0)){s[t>>2]=d;if(!d){s[8745]=s[8745]&~(1<>>0<(s[8748]|0)>>>0)At();e=o+16|0;if((s[e>>2]|0)==(c|0))s[e>>2]=d;else s[o+20>>2]=d;if(!d)break}i=s[8748]|0;if(d>>>0>>0)At();s[d+24>>2]=o;e=c+16|0;t=s[e>>2]|0;do if(t|0)if(t>>>0>>0)At();else{s[d+16>>2]=t;s[t+24>>2]=d;break}while(0);e=s[e+4>>2]|0;if(e|0)if(e>>>0<(s[8748]|0)>>>0)At();else{s[d+20>>2]=e;s[e+24>>2]=d;break}}}else{t=s[c+8>>2]|0;i=s[c+12>>2]|0;e=35016+(n<<1<<2)|0;if((t|0)!=(e|0)){if(t>>>0<(s[8748]|0)>>>0)At();if((s[t+12>>2]|0)!=(c|0))At()}if((i|0)==(t|0)){s[8744]=s[8744]&~(1<>>0<(s[8748]|0)>>>0)At();e=i+8|0;if((s[e>>2]|0)==(c|0))u=e;else At()}else u=i+8|0;s[t+12>>2]=i;s[u>>2]=t}while(0);s[w+4>>2]=r|1;s[w+r>>2]=r;if((w|0)==(s[8749]|0)){s[8746]=r;return}}else{s[e>>2]=t&-2;s[w+4>>2]=r|1;s[w+r>>2]=r}e=r>>>3;if(r>>>0<256){i=35016+(e<<1<<2)|0;t=s[8744]|0;e=1<>2]|0;if(t>>>0<(s[8748]|0)>>>0)At();else{p=e;b=t}}else{s[8744]=t|e;p=i+8|0;b=i}s[p>>2]=w;s[b+12>>2]=w;s[w+8>>2]=b;s[w+12>>2]=i;return}e=r>>>8;if(e)if(r>>>0>16777215)i=31;else{p=(e+1048320|0)>>>16&8;b=e<>>16&4;b=b<>>16&2;i=14-(d|p|i)+(b<>>15)|0;i=r>>>(i+7|0)&1|i<<1}else i=0;n=35280+(i<<2)|0;s[w+28>>2]=i;s[w+20>>2]=0;s[w+16>>2]=0;e=s[8745]|0;t=1<>>1)|0);n=s[n>>2]|0;while(1){if((s[n+4>>2]&-8|0)==(r|0)){e=130;break}t=n+16+(i>>>31<<2)|0;e=s[t>>2]|0;if(!e){e=127;break}else{i=i<<1;n=e}}if((e|0)==127)if(t>>>0<(s[8748]|0)>>>0)At();else{s[t>>2]=w;s[w+24>>2]=n;s[w+12>>2]=w;s[w+8>>2]=w;break}else if((e|0)==130){e=n+8|0;t=s[e>>2]|0;b=s[8748]|0;if(t>>>0>=b>>>0&n>>>0>=b>>>0){s[t+12>>2]=w;s[e>>2]=w;s[w+8>>2]=t;s[w+12>>2]=n;s[w+24>>2]=0;break}else At()}}else{s[8745]=e|t;s[n>>2]=w;s[w+24>>2]=n;s[w+12>>2]=w;s[w+8>>2]=w}while(0);w=(s[8752]|0)+-1|0;s[8752]=w;if(!w)e=35432;else return;while(1){e=s[e>>2]|0;if(!e)break;else e=e+8|0}s[8752]=-1;return}function Wn(e){e=e|0;return}function Vn(e){e=e|0;qn(e);return}function Yn(e){e=e|0;return}function Zn(e){e=e|0;return}function $n(e,t,i){e=e|0;t=t|0;i=i|0;var n=0,r=0,o=0,a=0;a=u;u=u+64|0;o=a;if((e|0)!=(t|0))if((t|0)!=0?(r=Kn(t,240)|0,(r|0)!=0):0){t=o;n=t+56|0;do{s[t>>2]=0;t=t+4|0}while((t|0)<(n|0));s[o>>2]=r;s[o+8>>2]=e;s[o+12>>2]=-1;s[o+48>>2]=1;Qs[s[(s[r>>2]|0)+28>>2]&3](r,o,s[i>>2]|0,1);if((s[o+24>>2]|0)==1){s[i>>2]=s[o+16>>2];t=1}else t=0}else t=0;else t=1;u=a;return t|0}function Kn(e,t){e=e|0;t=t|0;var i=0,o=0,a=0,l=0,f=0,h=0,c=0,d=0,p=0,b=0,w=0,m=0,g=0;g=u;u=u+64|0;m=g;w=s[e>>2]|0;b=e+(s[w+-8>>2]|0)|0;w=s[w+-4>>2]|0;s[m>>2]=t;s[m+4>>2]=e;s[m+8>>2]=272;h=m+12|0;c=m+16|0;e=m+20|0;i=m+24|0;o=m+28|0;a=m+32|0;l=m+40|0;f=(w|0)==(t|0);d=h;p=d+40|0;do{s[d>>2]=0;d=d+4|0}while((d|0)<(p|0));r[h+40>>1]=0;n[h+42>>0]=0;e:do if(f){s[m+48>>2]=1;Xs[s[(s[t>>2]|0)+20>>2]&3](t,m,b,b,1,0);e=(s[i>>2]|0)==1?b:0}else{qs[s[(s[w>>2]|0)+24>>2]&3](w,m,b,1,0);switch(s[m+36>>2]|0){case 0:{e=(s[l>>2]|0)==1&(s[o>>2]|0)==1&(s[a>>2]|0)==1?s[e>>2]|0:0;break e}case 1:break;default:{e=0;break e}}if((s[i>>2]|0)!=1?!((s[l>>2]|0)==0&(s[o>>2]|0)==1&(s[a>>2]|0)==1):0){e=0;break}e=s[c>>2]|0}while(0);u=g;return e|0}function Xn(e,t,i,n,r,o){e=e|0;t=t|0;i=i|0;n=n|0;r=r|0;o=o|0;if((e|0)==(s[t+8>>2]|0))Jn(t,i,n,r);else{e=s[e+8>>2]|0;Xs[s[(s[e>>2]|0)+20>>2]&3](e,t,i,n,r,o)}return}function Jn(e,t,i,r){e=e|0;t=t|0;i=i|0;r=r|0;var o=0;n[e+53>>0]=1;do if((s[e+4>>2]|0)==(i|0)){n[e+52>>0]=1;i=e+16|0;o=s[i>>2]|0;if(!o){s[i>>2]=t;s[e+24>>2]=r;s[e+36>>2]=1;if(!((r|0)==1?(s[e+48>>2]|0)==1:0))break;n[e+54>>0]=1;break}if((o|0)!=(t|0)){r=e+36|0;s[r>>2]=(s[r>>2]|0)+1;n[e+54>>0]=1;break}o=e+24|0;i=s[o>>2]|0;if((i|0)==2){s[o>>2]=r;i=r}if((i|0)==1?(s[e+48>>2]|0)==1:0)n[e+54>>0]=1}while(0);return}function Qn(e,t,i,r,o){e=e|0;t=t|0;i=i|0;r=r|0;o=o|0;var a=0,l=0,f=0;do if((e|0)==(s[t+8>>2]|0)){if((s[t+4>>2]|0)==(i|0)?(a=t+28|0,(s[a>>2]|0)!=1):0)s[a>>2]=r}else{if((e|0)!=(s[t>>2]|0)){f=s[e+8>>2]|0;qs[s[(s[f>>2]|0)+24>>2]&3](f,t,i,r,o);break}if((s[t+16>>2]|0)!=(i|0)?(f=t+20|0,(s[f>>2]|0)!=(i|0)):0){s[t+32>>2]=r;l=t+44|0;if((s[l>>2]|0)==4)break;a=t+52|0;n[a>>0]=0;r=t+53|0;n[r>>0]=0;e=s[e+8>>2]|0;Xs[s[(s[e>>2]|0)+20>>2]&3](e,t,i,i,1,o);if(n[r>>0]|0)if(!(n[a>>0]|0)){a=1;r=13}else r=17;else{a=0;r=13}do if((r|0)==13){s[f>>2]=i;i=t+40|0;s[i>>2]=(s[i>>2]|0)+1;if((s[t+36>>2]|0)==1?(s[t+24>>2]|0)==2:0){n[t+54>>0]=1;if(a){r=17;break}else{a=4;break}}if(a)r=17;else a=4}while(0);if((r|0)==17)a=3;s[l>>2]=a;break}if((r|0)==1)s[t+32>>2]=1}while(0);return}function er(e,t,i,r){e=e|0;t=t|0;i=i|0;r=r|0;var o=0;do if((e|0)==(s[t+8>>2]|0)){e=t+16|0;o=s[e>>2]|0;if(!o){s[e>>2]=i;s[t+24>>2]=r;s[t+36>>2]=1;break}if((o|0)!=(i|0)){r=t+36|0;s[r>>2]=(s[r>>2]|0)+1;s[t+24>>2]=2;n[t+54>>0]=1;break}e=t+24|0;if((s[e>>2]|0)==2)s[e>>2]=r}else{o=s[e+8>>2]|0;Qs[s[(s[o>>2]|0)+28>>2]&3](o,t,i,r)}while(0);return}function tr(e){e=e|0;qn(e);return}function ir(e,t,i,n,r,o){e=e|0;t=t|0;i=i|0;n=n|0;r=r|0;o=o|0;if((e|0)==(s[t+8>>2]|0))Jn(t,i,n,r);return}function nr(e,t,i,r,o){e=e|0;t=t|0;i=i|0;r=r|0;o=o|0;var a=0,l=0;do if((e|0)==(s[t+8>>2]|0)){if((s[t+4>>2]|0)==(i|0)?(l=t+28|0,(s[l>>2]|0)!=1):0)s[l>>2]=r}else if((e|0)==(s[t>>2]|0)){if((s[t+16>>2]|0)!=(i|0)?(a=t+20|0,(s[a>>2]|0)!=(i|0)):0){s[t+32>>2]=r;s[a>>2]=i;o=t+40|0;s[o>>2]=(s[o>>2]|0)+1;if((s[t+36>>2]|0)==1?(s[t+24>>2]|0)==2:0)n[t+54>>0]=1;s[t+44>>2]=4;break}if((r|0)==1)s[t+32>>2]=1}while(0);return}function rr(e,t,i,r){e=e|0;t=t|0;i=i|0;r=r|0;var o=0;do if((e|0)==(s[t+8>>2]|0)){e=t+16|0;o=s[e>>2]|0;if(!o){s[e>>2]=i;s[t+24>>2]=r;s[t+36>>2]=1;break}if((o|0)!=(i|0)){r=t+36|0;s[r>>2]=(s[r>>2]|0)+1;s[t+24>>2]=2;n[t+54>>0]=1;break}e=t+24|0;if((s[e>>2]|0)==2)s[e>>2]=r}while(0);return}function sr(e){e=e|0;return}function or(e){e=e|0;qn(e);return}function ar(e){e=e|0;return 34734}function lr(e){e=e|0;qn(e);return}function fr(e,t,i){e=e|0;t=t|0;i=i|0;return(e|0)==(t|0)|0}function hr(e){e=e|0;qn(e);return}function ur(e,t,i){e=e|0;t=t|0;i=i|0;var n=0,r=0,o=0,a=0,l=0,f=0;f=u;u=u+64|0;l=f;s[i>>2]=s[s[i>>2]>>2];if(!((e|0)==(t|0)|(t|0)==368))if(((t|0)!=0?(n=Kn(t,328)|0,(n|0)!=0):0)?(s[n+8>>2]&~s[e+8>>2]|0)==0:0){t=s[e+12>>2]|0;e=n+12|0;if(!((t|0)==360?1:(t|0)==(s[e>>2]|0)))if((((t|0)!=0?(o=Kn(t,240)|0,(o|0)!=0):0)?(r=s[e>>2]|0,(r|0)!=0):0)?(a=Kn(r,240)|0,(a|0)!=0):0){e=l;t=e+56|0;do{s[e>>2]=0;e=e+4|0}while((e|0)<(t|0));s[l>>2]=a;s[l+8>>2]=o;s[l+12>>2]=-1;s[l+48>>2]=1;Qs[s[(s[a>>2]|0)+28>>2]&3](a,l,s[i>>2]|0,1);if((s[l+24>>2]|0)==1){s[i>>2]=s[l+16>>2];e=1}else e=0}else e=0;else e=1}else e=0;else e=1;u=f;return e|0}function cr(e){e=e|0;qn(e);return}function dr(e,t,i,o,a,l){e=e|0;t=t|0;i=i|0;o=o|0;a=a|0;l=l|0;var f=0,h=0,u=0,c=0,d=0,p=0,b=0,w=0,m=0;if((e|0)==(s[t+8>>2]|0))Jn(t,i,o,a);else{p=t+52|0;m=r[p>>1]|0;b=m&255;w=t+53|0;m=(m&65535)>>>8&255;d=s[e+12>>2]|0;h=e+16+(d<<3)|0;n[p>>0]=0;n[w>>0]=0;pr(e+16|0,t,i,o,a,l);e:do if((d|0)>1){u=t+24|0;c=e+8|0;d=t+54|0;f=e+24|0;do{if(n[d>>0]|0)break e;e=r[p>>1]|0;if(!((e&255)<<24>>24)){if((e&65535)>=256?(s[c>>2]&1|0)==0:0)break e}else{if((s[u>>2]|0)==1)break e;if(!(s[c>>2]&2))break e}n[p>>0]=0;n[w>>0]=0;pr(f,t,i,o,a,l);f=f+8|0}while(f>>>0>>0)}while(0);n[p>>0]=b;n[w>>0]=m}return}function pr(e,t,i,n,r,o){e=e|0;t=t|0;i=i|0;n=n|0;r=r|0;o=o|0;var a=0,l=0;l=s[e+4>>2]|0;a=l>>8;if(l&1)a=s[(s[n>>2]|0)+a>>2]|0;e=s[e>>2]|0;Xs[s[(s[e>>2]|0)+20>>2]&3](e,t,i,n+a|0,l&2|0?r:2,o);return}function br(e,t,i,r,o){e=e|0;t=t|0;i=i|0;r=r|0;o=o|0;var a=0,l=0,f=0,h=0,u=0,c=0,d=0,p=0,b=0,w=0;e:do if((e|0)==(s[t+8>>2]|0)){if((s[t+4>>2]|0)==(i|0)?(a=t+28|0,(s[a>>2]|0)!=1):0)s[a>>2]=r}else{if((e|0)!=(s[t>>2]|0)){w=s[e+12>>2]|0;f=e+16+(w<<3)|0;wr(e+16|0,t,i,r,o);a=e+24|0;if((w|0)<=1)break;e=s[e+8>>2]|0;if((e&2|0)==0?(h=t+36|0,(s[h>>2]|0)!=1):0){if(!(e&1)){e=t+54|0;while(1){if(n[e>>0]|0)break e;if((s[h>>2]|0)==1)break e;wr(a,t,i,r,o);a=a+8|0;if(a>>>0>=f>>>0)break e}}e=t+24|0;l=t+54|0;while(1){if(n[l>>0]|0)break e;if((s[h>>2]|0)==1?(s[e>>2]|0)==1:0)break e;wr(a,t,i,r,o);a=a+8|0;if(a>>>0>=f>>>0)break e}}e=t+54|0;while(1){if(n[e>>0]|0)break e;wr(a,t,i,r,o);a=a+8|0;if(a>>>0>=f>>>0)break e}}if((s[t+16>>2]|0)!=(i|0)?(w=t+20|0,(s[w>>2]|0)!=(i|0)):0){s[t+32>>2]=r;b=t+44|0;if((s[b>>2]|0)==4)break;f=e+16+(s[e+12>>2]<<3)|0;h=t+52|0;r=t+53|0;d=t+54|0;u=e+8|0;p=t+24|0;c=0;a=0;l=e+16|0;t:while(1){if(l>>>0>=f>>>0){e=20;break}n[h>>0]=0;n[r>>0]=0;pr(l,t,i,i,1,o);if(n[d>>0]|0){e=20;break}do if(n[r>>0]|0){if(!(n[h>>0]|0))if(!(s[u>>2]&1)){a=1;e=20;break t}else{e=c;a=1;break}if((s[p>>2]|0)==1){e=25;break t}if(!(s[u>>2]&2)){e=25;break t}else{e=1;a=1}}else e=c;while(0);c=e;l=l+8|0}do if((e|0)==20){if((!c?(s[w>>2]=i,i=t+40|0,s[i>>2]=(s[i>>2]|0)+1,(s[t+36>>2]|0)==1):0)?(s[p>>2]|0)==2:0){n[d>>0]=1;if(a){e=25;break}else{a=4;break}}if(a)e=25;else a=4}while(0);if((e|0)==25)a=3;s[b>>2]=a;break}if((r|0)==1)s[t+32>>2]=1}while(0);return}function wr(e,t,i,n,r){e=e|0;t=t|0;i=i|0;n=n|0;r=r|0;var o=0,a=0;a=s[e+4>>2]|0;o=a>>8;if(a&1)o=s[(s[i>>2]|0)+o>>2]|0;e=s[e>>2]|0;qs[s[(s[e>>2]|0)+24>>2]&3](e,t,i+o|0,a&2|0?n:2,r);return}function mr(e,t,i,r){e=e|0;t=t|0;i=i|0;r=r|0;var o=0,a=0;e:do if((e|0)==(s[t+8>>2]|0)){e=t+16|0;o=s[e>>2]|0;if(!o){s[e>>2]=i;s[t+24>>2]=r;s[t+36>>2]=1;break}if((o|0)!=(i|0)){r=t+36|0;s[r>>2]=(s[r>>2]|0)+1;s[t+24>>2]=2;n[t+54>>0]=1;break}e=t+24|0;if((s[e>>2]|0)==2)s[e>>2]=r}else{a=s[e+12>>2]|0;o=e+16+(a<<3)|0;gr(e+16|0,t,i,r);if((a|0)>1){a=t+54|0;e=e+24|0;do{gr(e,t,i,r);if(n[a>>0]|0)break e;e=e+8|0}while(e>>>0>>0)}}while(0);return}function gr(e,t,i,n){e=e|0;t=t|0;i=i|0;n=n|0;var r=0,o=0;o=s[e+4>>2]|0;r=o>>8;if(o&1)r=s[(s[i>>2]|0)+r>>2]|0;e=s[e>>2]|0;Qs[s[(s[e>>2]|0)+28>>2]&3](e,t,i+r|0,o&2|0?n:2);return}function _r(e,t,i){e=e|0;t=t|0;i=i|0;var n=0,r=0;r=u;u=u+16|0;n=r;s[n>>2]=s[i>>2];e=zs[s[(s[e>>2]|0)+16>>2]&7](e,t,n)|0;if(e)s[i>>2]=s[n>>2];u=r;return e&1|0}function vr(e){e=e|0;if(!e)e=0;else e=(Kn(e,328)|0)!=0;return e&1|0}function kr(){}function yr(e,t,i){e=e|0;t=t|0;i=i|0;var r=0,o=0,a=0,l=0;r=e+i|0;if((i|0)>=20){t=t&255;a=e&3;l=t|t<<8|t<<16|t<<24;o=r&~3;if(a){a=e+4-a|0;while((e|0)<(a|0)){n[e>>0]=t;e=e+1|0}}while((e|0)<(o|0)){s[e>>2]=l;e=e+4|0}}while((e|0)<(r|0)){n[e>>0]=t;e=e+1|0}return e-i|0}function Er(e,t,i,n){e=e|0;t=t|0;i=i|0;n=n|0;i=e+i>>>0;return(x=t+n+(i>>>0>>0|0)>>>0,i|0)|0}function Ar(e,t,i){e=e|0;t=t|0;i=i|0;if((i|0)<32){x=t>>i;return e>>>i|(t&(1<>i-32|0}function Tr(e,t,i){e=e|0;t=t|0;i=i|0;if((i|0)<32){x=t>>>i;return e>>>i|(t&(1<>>i-32|0}function Sr(e,t,i){e=e|0;t=t|0;i=i|0;var r=0;if((i|0)>=4096)return Me(e|0,t|0,i|0)|0;r=e|0;if((e&3)==(t&3)){while(e&3){if(!i)return r|0;n[e>>0]=n[t>>0]|0;e=e+1|0;t=t+1|0;i=i-1|0}while((i|0)>=4){s[e>>2]=s[t>>2];e=e+4|0;t=t+4|0;i=i-4|0}}while((i|0)>0){n[e>>0]=n[t>>0]|0;e=e+1|0;t=t+1|0;i=i-1|0}return r|0}function Mr(e,t,i){e=e|0;t=t|0;i=i|0;var r=0;if((t|0)<(e|0)&(e|0)<(t+i|0)){r=e;t=t+i|0;e=e+i|0;while((i|0)>0){e=e-1|0;t=t-1|0;i=i-1|0;n[e>>0]=n[t>>0]|0}e=r}else Sr(e,t,i)|0;return e|0}function Rr(e,t,i,n){e=e|0;t=t|0;i=i|0;n=n|0;n=t-n-(i>>>0>e>>>0|0)>>>0;return(x=n,e-i>>>0|0)|0}function Cr(e,t,i){e=e|0;t=t|0;i=i|0;if((i|0)<32){x=t<>>32-i;return e<>0]|0;if((t|0)<8)return t|0;t=n[b+(e>>8&255)>>0]|0;if((t|0)<8)return t+8|0;t=n[b+(e>>16&255)>>0]|0;if((t|0)<8)return t+16|0;return(n[b+(e>>>24)>>0]|0)+24|0}function xr(e,t){e=e|0;t=t|0;var i=0,n=0,r=0,s=0;s=e&65535;r=t&65535;i=te(r,s)|0;n=e>>>16;e=(i>>>16)+(te(r,n)|0)|0;r=t>>>16;t=te(r,s)|0;return(x=(e>>>16)+(te(r,n)|0)+(((e&65535)+t|0)>>>16)|0,e+t<<16|i&65535|0)|0}function Ir(e,t,i,n){e=e|0;t=t|0;i=i|0;n=n|0;var r=0,s=0,o=0,a=0,l=0,f=0;f=t>>31|((t|0)<0?-1:0)<<1;l=((t|0)<0?-1:0)>>31|((t|0)<0?-1:0)<<1;s=n>>31|((n|0)<0?-1:0)<<1;r=((n|0)<0?-1:0)>>31|((n|0)<0?-1:0)<<1;a=Rr(f^e|0,l^t|0,f|0,l|0)|0;o=x;e=s^f;t=r^l;return Rr((Ur(a,o,Rr(s^i|0,r^n|0,s|0,r|0)|0,x,0)|0)^e|0,x^t|0,e|0,t|0)|0}function Or(e,t,i,n){e=e|0;t=t|0;i=i|0;n=n|0;var r=0,o=0,a=0,l=0,f=0,h=0;r=u;u=u+16|0;l=r|0;a=t>>31|((t|0)<0?-1:0)<<1;o=((t|0)<0?-1:0)>>31|((t|0)<0?-1:0)<<1;h=n>>31|((n|0)<0?-1:0)<<1;f=((n|0)<0?-1:0)>>31|((n|0)<0?-1:0)<<1;e=Rr(a^e|0,o^t|0,a|0,o|0)|0;t=x;Ur(e,t,Rr(h^i|0,f^n|0,h|0,f|0)|0,x,l)|0;n=Rr(s[l>>2]^a|0,s[l+4>>2]^o|0,a|0,o|0)|0;i=x;u=r;return(x=i,n)|0}function Nr(e,t,i,n){e=e|0;t=t|0;i=i|0;n=n|0;var r=0,s=0;r=e;s=i;i=xr(r,s)|0;e=x;return(x=(te(t,s)|0)+(te(n,r)|0)+e|e&0,i|0|0)|0}function Dr(e,t,i,n){e=e|0;t=t|0;i=i|0;n=n|0;return Ur(e,t,i,n,0)|0}function Lr(e,t,i,n){e=e|0;t=t|0;i=i|0;n=n|0;var r=0,o=0;o=u;u=u+16|0;r=o|0;Ur(e,t,i,n,r)|0;u=o;return(x=s[r+4>>2]|0,s[r>>2]|0)|0}function Ur(e,t,i,n,r){e=e|0;t=t|0;i=i|0;n=n|0;r=r|0;var o=0,a=0,l=0,f=0,h=0,u=0,c=0,d=0,p=0,b=0;u=e;f=t;h=f;a=i;d=n;l=d;if(!h){o=(r|0)!=0;if(!l){if(o){s[r>>2]=(u>>>0)%(a>>>0);s[r+4>>2]=0}d=0;r=(u>>>0)/(a>>>0)>>>0;return(x=d,r)|0}else{if(!o){d=0;r=0;return(x=d,r)|0}s[r>>2]=e|0;s[r+4>>2]=t&0;d=0;r=0;return(x=d,r)|0}}o=(l|0)==0;do if(a){if(!o){o=(ne(l|0)|0)-(ne(h|0)|0)|0;if(o>>>0<=31){c=o+1|0;l=31-o|0;t=o-31>>31;a=c;e=u>>>(c>>>0)&t|h<>>(c>>>0)&t;o=0;l=u<>2]=e|0;s[r+4>>2]=f|t&0;d=0;r=0;return(x=d,r)|0}o=a-1|0;if(o&a|0){l=(ne(a|0)|0)+33-(ne(h|0)|0)|0;b=64-l|0;c=32-l|0;f=c>>31;p=l-32|0;t=p>>31;a=l;e=c-1>>31&h>>>(p>>>0)|(h<>>(l>>>0))&t;t=t&h>>>(l>>>0);o=u<>>(p>>>0))&f|u<>31;break}if(r|0){s[r>>2]=o&u;s[r+4>>2]=0}if((a|0)==1){p=f|t&0;b=e|0|0;return(x=p,b)|0}else{b=Pr(a|0)|0;p=h>>>(b>>>0)|0;b=h<<32-b|u>>>(b>>>0)|0;return(x=p,b)|0}}else{if(o){if(r|0){s[r>>2]=(h>>>0)%(a>>>0);s[r+4>>2]=0}p=0;b=(h>>>0)/(a>>>0)>>>0;return(x=p,b)|0}if(!u){if(r|0){s[r>>2]=0;s[r+4>>2]=(h>>>0)%(l>>>0)}p=0;b=(h>>>0)/(l>>>0)>>>0;return(x=p,b)|0}o=l-1|0;if(!(o&l)){if(r|0){s[r>>2]=e|0;s[r+4>>2]=o&h|t&0}p=0;b=h>>>((Pr(l|0)|0)>>>0);return(x=p,b)|0}o=(ne(l|0)|0)-(ne(h|0)|0)|0;if(o>>>0<=30){t=o+1|0;l=31-o|0;a=t;e=h<>>(t>>>0);t=h>>>(t>>>0);o=0;l=u<>2]=e|0;s[r+4>>2]=f|t&0;p=0;b=0;return(x=p,b)|0}while(0);if(!a){h=l;f=0;l=0}else{c=i|0|0;u=d|n&0;h=Er(c|0,u|0,-1,-1)|0;i=x;f=l;l=0;do{n=f;f=o>>>31|f<<1;o=l|o<<1;n=e<<1|n>>>31|0;d=e>>>31|t<<1|0;Rr(h|0,i|0,n|0,d|0)|0;b=x;p=b>>31|((b|0)<0?-1:0)<<1;l=p&1;e=Rr(n|0,d|0,p&c|0,(((b|0)<0?-1:0)>>31|((b|0)<0?-1:0)<<1)&u|0)|0;t=x;a=a-1|0}while((a|0)!=0);h=f;f=0}a=0;if(r|0){s[r>>2]=e;s[r+4>>2]=t}p=(o|0)>>>31|(h|a)<<1|(a<<1|o>>>31)&0|f;b=(o<<1|0>>>31)&-2|l;return(x=p,b)|0}function Br(e,t,i,n){e=e|0;t=t|0;i=i|0;n=n|0;return zs[e&7](t|0,i|0,n|0)|0}function jr(e,t,i,n,r,s){e=e|0;t=t|0;i=i|0;n=n|0;r=r|0;s=s|0;qs[e&3](t|0,i|0,n|0,r|0,s|0)}function Fr(e,t){e=e|0;t=t|0;Ws[e&15](t|0)}function Gr(e,t,i,n,r,s,o){e=e|0;t=t|0;i=i|0;n=n|0;r=r|0;s=s|0;o=o|0;return Vs[e&1](t|0,i|0,n|0,r|0,s|0,o|0)|0}function Hr(e,t){e=e|0;t=t|0;return Ys[e&3](t|0)|0}function zr(e,t,i,n,r,s,o,a){e=e|0;t=t|0;i=i|0;n=n|0;r=r|0;s=s|0;o=o|0;a=a|0;Zs[e&1](t|0,i|0,n|0,r|0,s|0,o|0,a|0)}function qr(e){e=e|0;$s[e&0]()}function Wr(e,t,i,n,r){e=e|0;t=t|0;i=i|0;n=n|0;r=r|0;return Ks[e&3](t|0,i|0,n|0,r|0)|0}function Vr(e,t,i,n,r,s,o){e=e|0;t=t|0;i=i|0;n=n|0;r=r|0;s=s|0;o=o|0;Xs[e&3](t|0,i|0,n|0,r|0,s|0,o|0)}function Yr(e,t,i,n,r,s){e=e|0;t=t|0;i=i|0;n=n|0;r=r|0;s=s|0;return Js[e&3](t|0,i|0,n|0,r|0,s|0)|0}function Zr(e,t,i,n,r){e=e|0;t=t|0;i=i|0;n=n|0;r=r|0;Qs[e&3](t|0,i|0,n|0,r|0)}function $r(e,t,i){e=e|0;t=t|0;i=i|0;re(0);return 0}function Kr(e,t,i,n,r){e=e|0;t=t|0;i=i|0;n=n|0;r=r|0;re(1)}function Xr(e){e=e|0;re(2)}function Jr(e,t,i,n,r,s){e=e|0;t=t|0;i=i|0;n=n|0;r=r|0;s=s|0;re(3);return 0}function Qr(e){e=e|0;re(4);return 0}function es(e,t,i,n,r,s,o){e=e|0;t=t|0;i=i|0;n=n|0;r=r|0;s=s|0;o=o|0;re(5)}function ts(){re(6)}function is(e,t,i,n){e=e|0;t=t|0;i=i|0;n=n|0;re(7);return 0}function ns(e,t,i,n,r,s){e=e|0;t=t|0;i=i|0;n=n|0;r=r|0;s=s|0;re(8)}function rs(e,t,i,n,r){e=e|0;t=t|0;i=i|0;n=n|0;r=r|0;re(9);return 0}function ss(e,t,i,n){e=e|0;t=t|0;i=i|0;n=n|0;re(10)}function os(e){e=e|0;var t=0;t=u;u=u+e|0;u=u+15&-16;return t|0}function as(){return u|0}function ls(e){e=e|0;u=e}function fs(e,t){e=e|0;t=t|0;u=e;c=t}function hs(e,t){e=e|0;t=t|0;if(!w){w=e;m=t}}function us(e){e=e|0; -n[d>>0]=n[e>>0];n[d+1>>0]=n[e+1>>0];n[d+2>>0]=n[e+2>>0];n[d+3>>0]=n[e+3>>0]}function cs(e){e=e|0;n[d>>0]=n[e>>0];n[d+1>>0]=n[e+1>>0];n[d+2>>0]=n[e+2>>0];n[d+3>>0]=n[e+3>>0];n[d+4>>0]=n[e+4>>0];n[d+5>>0]=n[e+5>>0];n[d+6>>0]=n[e+6>>0];n[d+7>>0]=n[e+7>>0]}function ds(e){e=e|0;x=e}function ps(){return x|0}function bs(e,t,i,n,o){e=e|0;t=t|0;i=i|0;n=n|0;o=o|0;var l=0,f=0;if((i|0)>0){l=0;do{f=l<<1;r[t+(l<<1)>>1]=r[t+((f|1)<<1)>>1]<<8|a[t+(f<<1)>>1];l=l+1|0}while((l|0)!=(i|0))}return Ls(s[e+12>>2]|0,t,o,n)|0}function ws(e,t,i,n){e=e|0;t=t|0;i=i|0;n=n|0;var o=0,l=0,f=0;o=e+20|0;l=Rs(s[e+16>>2]|0,t,i,s[o>>2]|0)|0;i=s[e+4>>2]|0;if((te(i,l)|0)<=0)return l|0;o=s[o>>2]|0;i=te(l,i)|0;t=0;do{f=o+(t<<1)|0;e=t<<1;r[n+(e<<1)>>1]=(a[f>>1]|0)&255;r[n+((e|1)<<1)>>1]=(a[f>>1]|0)>>>8;t=t+1|0}while((t|0)!=(i|0));return l|0}function ms(e){e=e|0;return 8}function gs(e){e=e|0;if(!e)return;qn(s[e+12>>2]|0);qn(s[e+16>>2]|0);qn(e);return}function _s(e,t,i){e=e|0;t=t|0;i=i|0;var n=0,r=0,o=0,a=0,l=0,f=0,h=0,c=0;c=u;u=u+16|0;h=c+4|0;f=c;while(1){l=zn(24)|0;if(l|0)break;n=s[8868]|0;s[8868]=n+0;if(!n){a=5;break}$s[n&0]()}if((a|0)==5){c=dt(4)|0;s[c>>2]=23152;Zt(c|0,296,6)}o=s[e>>2]|0;r=s[t>>2]|0;t=s[i>>2]|0;s[l>>2]=t;s[l+4>>2]=r;s[l+8>>2]=o;e=r*11520|0;e=e>>>0>2147483647?-1:e<<1;e=(e|0)==0?1:e;while(1){n=zn(e)|0;if(n|0){a=11;break}n=s[8868]|0;s[8868]=n+0;if(!n){a=10;break}$s[n&0]()}if((a|0)==10){c=dt(4)|0;s[c>>2]=23152;Zt(c|0,296,6)}else if((a|0)==11){s[l+20>>2]=n;s[l+12>>2]=xs(o,r,t,h)|0;s[l+16>>2]=Ss(o,r,f)|0;u=c;return l|0}return 0}function vs(e,t,i,n){e=e|0;t=t|0;i=i|0;n=n|0;var r=0,o=0,a=0,l=0;r=u;u=u+16|0;l=r+8|0;a=r+4|0;o=r;s[l>>2]=t;s[a>>2]=i;s[o>>2]=n;e=zs[e&7](l,a,o)|0;u=r;return e|0}function ks(e,t,i,n,r,o){e=e|0;t=t|0;i=i|0;n=n|0;r=r|0;o=o|0;var a=0,l=0;a=s[e>>2]|0;l=s[e+4>>2]|0;e=t+(l>>1)|0;if(l&1)a=s[(s[e>>2]|0)+a>>2]|0;return Js[a&3](e,i,n,r,o)|0}function ys(e,t,i,n,r){e=e|0;t=t|0;i=i|0;n=n|0;r=r|0;var o=0,a=0;o=s[e>>2]|0;a=s[e+4>>2]|0;e=t+(a>>1)|0;if(a&1)o=s[(s[e>>2]|0)+o>>2]|0;return Ks[o&3](e,i,n,r)|0}function Es(){var e=0,t=0;at(8,16,32,0,27863,2,27866,0,27866,0,27766,27868,11);Be(8,4,488,27871,1,4);while(1){e=zn(8)|0;if(e|0)break;e=s[8868]|0;s[8868]=e+0;if(!e){t=5;break}$s[e&0]()}if((t|0)==5){t=dt(4)|0;s[t>>2]=23152;Zt(t|0,296,6)}s[e>>2]=1;s[e+4>>2]=0;Bt(8,27784,6,504,27877,1,e|0,0);while(1){e=zn(8)|0;if(e|0){t=11;break}e=s[8868]|0;s[8868]=e+0;if(!e){t=10;break}$s[e&0]()}if((t|0)==10){t=dt(4)|0;s[t>>2]=23152;Zt(t|0,296,6)}else if((t|0)==11){s[e>>2]=2;s[e+4>>2]=0;Bt(8,27792,5,528,27885,2,e|0,0);return}}function As(e,t,i,n,r,s,o,a,l,h,u){e=e|0;t=t|0;i=i|0;n=n|0;r=r|0;s=+s;o=+o;a=a|0;l=l|0;h=h|0;u=u|0;var c=0,d=0,p=0,b=0,w=0,m=0,g=0,_=0,v=0,k=0,y=0,E=0,A=0,T=0,S=0,M=0,R=0,C=0;if(s==0&o==0){if((t|0)==(e|0))return;Mr(e|0,t|0,r<<2|0)|0;return}g=(i|0)>15?i:15;S=(n|0)>15?n:15;m=+f[548+(a*12|0)>>2]*s;b=+f[548+(a*12|0)+4>>2]*s;w=+f[548+(a*12|0)+8>>2]*s;E=+f[548+(l*12|0)>>2]*o;A=+f[548+(l*12|0)+4>>2]*o;T=+f[548+(l*12|0)+8>>2]*o;_=1-S|0;v=0-S|0;k=~S;y=-2-S|0;i=s==o&(g|0)==(S|0)&(a|0)==(l|0)?0:u;n=0;s=+f[t+(_<<2)>>2];c=+f[t+(v<<2)>>2];d=+f[t+(k<<2)>>2];p=+f[t+(y<<2)>>2];while(1){if((n|0)>=(i|0))break;R=+f[t+(n-S+2<<2)>>2];M=+f[h+(n<<2)>>2];M=M*M;C=1-M;l=n-g|0;f[e+(n<<2)>>2]=+f[t+(n<<2)>>2]+C*m*+f[t+(l<<2)>>2]+C*b*(+f[t+(l+1<<2)>>2]+ +f[t+(l+-1<<2)>>2])+C*w*(+f[t+(l+2<<2)>>2]+ +f[t+(l+-2<<2)>>2])+M*E*c+M*A*(s+d)+M*T*(R+p);M=s;n=n+1|0;s=R;p=d;d=c;c=M}if(o==0){if((t|0)==(e|0))return;Mr(e+(i<<2)|0,t+(i<<2)|0,r-i<<2|0)|0;return}else{a=e+(n<<2)|0;u=t+(n<<2)|0;i=r-n|0;n=0;p=+f[u+(_<<2)>>2];d=+f[u+(v<<2)>>2];c=+f[u+(k<<2)>>2];s=+f[u+(y<<2)>>2];while(1){if((n|0)>=(i|0))break;R=+f[u+(n-S+2<<2)>>2];f[a+(n<<2)>>2]=+f[u+(n<<2)>>2]+d*E+(p+c)*A+(R+s)*T;C=p;n=n+1|0;p=R;s=c;c=d;d=C}return}}function Ts(e){e=e|0;if((e+7|0)>>>0>7){e=27924;return e|0}e=s[584+(0-e<<2)>>2]|0;return e|0}function Ss(e,t,i){e=e|0;t=t|0;i=i|0;var n=0,o=0,a=0,l=0,f=0,h=0,c=0,d=0,p=0,b=0,w=0,m=0,g=0,_=0;g=u;u=u+16|0;w=g+8|0;p=g;e:do if((e|0)<16e3)if((e|0)<12e3)switch(e|0){case 8e3:{a=2;break e}default:break e}else switch(e|0){case 12e3:{a=2;break e}default:break e}else{if((e|0)<24e3)switch(e|0){case 16e3:{a=2;break e}default:break e}if((e|0)<48e3)switch(e|0){case 24e3:{a=2;break e}default:break e}else switch(e|0){case 48e3:{a=2;break e}default:break e}}while(0);if((a|0)==2?(t+-1|0)>>>0<2:0){d=t*96|0;m=zn((t*8672|0)+88+d+9304|0)|0;if(!m){if(!i){i=0;u=g;return i|0}s[i>>2]=-7;i=0;u=g;return i|0}e:do if((e|0)<16e3)if((e|0)<12e3)switch(e|0){case 8e3:{a=9;break e}default:{n=-1;break e}}else switch(e|0){case 12e3:{a=9;break e}default:{n=-1;break e}}else{if((e|0)<24e3)switch(e|0){case 16e3:{a=9;break e}default:{n=-1;break e}}if((e|0)<48e3)switch(e|0){case 24e3:{a=9;break e}default:{n=-1;break e}}else switch(e|0){case 48e3:{a=9;break e}default:{n=-1;break e}}}while(0);do if((a|0)==9)if((t+-1|0)>>>0<2){yr(m|0,0,(t*8672|0)+88+d+9304|0)|0;s[m+4>>2]=88;s[m>>2]=8632;n=m+88|0;b=m+8632|0;s[m+8>>2]=t;s[m+48>>2]=t;s[m+12>>2]=e;s[m+24>>2]=e;s[m+16>>2]=t;c=0;while(1){if((c|0)==2)break;o=n+(c*4260|0)|0;yr(o|0,0,4260)|0;s[n+(c*4260|0)+2376>>2]=1;s[o>>2]=65536;o=n+(c*4260|0)+2340|0;l=s[o>>2]|0;a=32767/(l+1|0)|0;f=0;h=0;while(1){if((h|0)>=(l|0))break;_=f+a|0;r[n+(c*4260|0)+4052+(h<<1)>>1]=_;l=s[o>>2]|0;f=_;h=h+1|0}s[n+(c*4260|0)+4148>>2]=0;s[n+(c*4260|0)+4152>>2]=3176576;s[n+(c*4260|0)+4168>>2]=s[n+(c*4260|0)+2328>>2]<<7;s[n+(c*4260|0)+4240>>2]=65536;s[n+(c*4260|0)+4244>>2]=65536;s[n+(c*4260|0)+4256>>2]=20;s[n+(c*4260|0)+4252>>2]=2;c=c+1|0}_=m+8608|0;s[_>>2]=0;s[_+4>>2]=0;s[_+8>>2]=0;s[m+8628>>2]=0;if(t>>>0<=2){yr(b|0,0,(t*8672|0)+88+d+672|0)|0;s[b>>2]=5304;s[m+8636>>2]=120;s[m+8640>>2]=t;s[m+8644>>2]=t;o=m+8648|0;s[o>>2]=1;s[m+8652>>2]=0;s[m+8656>>2]=21;s[m+8660>>2]=1;s[m+8664>>2]=0;ri(b,4028,p);e:do if((e|0)<16e3)if((e|0)<12e3){switch(e|0){case 8e3:break;default:{a=22;break e}}n=6;a=23;break}else{switch(e|0){case 12e3:break;default:{a=22;break e}}n=4;a=23;break}else{if((e|0)<24e3){switch(e|0){case 16e3:break;default:{a=22;break e}}n=3;a=23;break}if((e|0)>=48e3)switch(e|0){case 48e3:{n=1;a=23;break e}default:{a=22;break e}}switch(e|0){case 24e3:break;default:{a=22;break e}}n=2;a=23}while(0);if((a|0)==22){s[o>>2]=0;n=-3;break}else if((a|0)==23){s[o>>2]=n;s[w>>2]=0;ri(b,10016,w);s[m+60>>2]=0;s[m+64>>2]=(e|0)/400|0;s[m+44>>2]=0;n=0;break}}else n=-3}else n=-1;while(0);if(i|0)s[i>>2]=n;if(!n){_=m;u=g;return _|0}qn(m);_=0;u=g;return _|0}if(!i){_=0;u=g;return _|0}s[i>>2]=-1;_=0;u=g;return _|0}function Ms(e,t,i,n,a,l){e=e|0;t=t|0;i=i|0;n=n|0;a=a|0;l=l|0;var h=0,c=0,d=0,p=0,b=0,w=0,m=0,g=0,_=0,v=0,k=0,y=0,E=0,A=0,T=0,S=0,M=0,R=0,C=0,P=0,x=0,I=0,O=0,N=0,D=0,L=0,U=0,B=0,j=0,F=0,G=0,H=0,z=0,q=0,W=0,V=0,Y=0,Z=0,$=0,K=0,X=0,Q=0,ee=0,ie=0,re=0,se=0,oe=0,ae=0;ae=u;u=u+160|0;K=ae+80|0;$=ae+72|0;Z=ae+64|0;V=ae+56|0;z=ae+48|0;G=ae+40|0;F=ae+32|0;j=ae+24|0;B=ae+16|0;U=ae+8|0;L=ae;se=ae+96|0;M=ae+92|0;oe=ae+88|0;H=ae+144|0;W=ae+84|0;s[oe>>2]=0;S=e+(s[e+4>>2]|0)|0;Y=e+(s[e>>2]|0)|0;ie=e+12|0;h=s[ie>>2]|0;q=(h|0)/50|0;T=q>>1;ee=q>>2;re=q>>3;if((re|0)>(a|0)){e=-2;u=ae;return e|0}h=((h|0)/25|0)*3|0;h=(h|0)>(a|0)?a:h;do if((i|0)>=2)if(t){p=s[e+64>>2]|0;d=s[e+56>>2]|0;s[se>>2]=t;s[se+4>>2]=i;s[se+8>>2]=0;s[se+12>>2]=0;s[se+16>>2]=0;m=se+20|0;s[m>>2]=9;g=se+24|0;s[g>>2]=0;_=se+28|0;s[_>>2]=128;s[g>>2]=1;E=o[t>>0]|0;v=se+40|0;s[v>>2]=E;A=E>>>1^127;k=se+32|0;s[k>>2]=A;s[se+44>>2]=0;c=128;a=9;w=1;while(1){if(c>>>0>=8388609)break;a=a+8|0;s[m>>2]=a;c=c<<8;s[_>>2]=c;if(w>>>0>>0){Q=w+1|0;s[g>>2]=Q;y=o[t+w>>0]|0;w=Q}else y=0;s[v>>2]=y;Q=((E<<8|y)>>>1&255|A<<8&2147483392)^255;s[k>>2]=Q;E=y;A=Q}a=s[e+60>>2]|0;if((a|0)>0){a=(a|0)==1002;if((d|0)!=1002){if(!a){a=t;c=h;P=27;break}x=te(ee,s[e+8>>2]|0)|0;Q=Ne()|0;X=p;I=0;O=1;break}if(!a?(s[e+68>>2]|0)==0:0){X=te(ee,s[e+8>>2]|0)|0;Q=Ne()|0;I=u;u=u+((1*(X<<2)|0)+15&-16)|0;Ms(e,0,0,I,(ee|0)<(p|0)?ee:p,0)|0;X=p;d=1002;x=1;O=1}else{a=t;c=h;d=1002;P=27}}else{a=t;c=h;P=27}}else P=10;else{P=s[e+64>>2]|0;h=(h|0)<(P|0)?h:P;P=10}while(0);do if((P|0)==10){d=s[e+60>>2]|0;if(!d){a=e+8|0;c=0;while(1){if((c|0)>=(te(h,s[a>>2]|0)|0))break;f[n+(c<<2)>>2]=0;c=c+1|0}u=ae;return h|0}if((h|0)<=(q|0)){if((h|0)>=(q|0)){a=0;c=h;p=h;P=27;break}if((h|0)>(T|0)){a=0;c=h;p=T;P=27;break}if((d|0)==1e3){a=0;c=h;p=h;d=1e3;P=27;break}a=0;c=h;p=(h|0)>(ee|0)&(h|0)<(T|0)?ee:h;P=27;break}p=e+8|0;a=n;d=h;while(1){c=Ms(e,0,0,a,(d|0)<(q|0)?d:q,0)|0;if((c|0)<0){h=c;P=158;break}d=d-c|0;a=a+((te(c,s[p>>2]|0)|0)<<2)|0;if((d|0)<=0){P=158;break}}if((P|0)==158){u=ae;return h|0}}while(0);if((P|0)==27){t=a;h=c;Q=Ne()|0;X=p;I=0;x=1;O=0}e:do if((X|0)>(h|0))h=-1;else{if((d|0)==1002){M=u;u=u+16|0;d=1002}else{v=e+8|0;h=s[v>>2]|0;if((T|0)>(X|0)){T=(te(T,h)|0)<<1;_=u;u=u+((1*T|0)+15&-16)|0}else{T=(te(X,h)|0)<<1;_=u;u=u+((1*T|0)+15&-16)|0}if((s[e+60>>2]|0)==1002){m=0;while(1){if((m|0)==2)break;h=S+(m*4260|0)|0;yr(h|0,0,4260)|0;s[S+(m*4260|0)+2376>>2]=1;s[h>>2]=65536;h=S+(m*4260|0)+2340|0;c=s[h>>2]|0;a=32767/(c+1|0)|0;p=0;w=0;while(1){if((w|0)>=(c|0))break;T=p+a|0;r[S+(m*4260|0)+4052+(w<<1)>>1]=T;c=s[h>>2]|0;p=T;w=w+1|0}s[S+(m*4260|0)+4148>>2]=0;s[S+(m*4260|0)+4152>>2]=3176576;s[S+(m*4260|0)+4168>>2]=s[S+(m*4260|0)+2328>>2]<<7;s[S+(m*4260|0)+4240>>2]=65536;s[S+(m*4260|0)+4244>>2]=65536;s[S+(m*4260|0)+4256>>2]=20;s[S+(m*4260|0)+4252>>2]=2;m=m+1|0}T=S+8520|0;s[T>>2]=0;s[T+4>>2]=0;s[T+8>>2]=0;s[S+8540>>2]=0}T=(X*1e3|0)/(s[ie>>2]|0)|0;s[e+32>>2]=(T|0)<10?10:T;if(!t)p=1;else{s[e+20>>2]=s[e+48>>2];t:do if((d|0)==1e3)switch(s[e+52>>2]|0){case 1101:{s[e+28>>2]=8e3;break t}case 1102:{s[e+28>>2]=12e3;break t}case 1103:{s[e+28>>2]=16e3;break t}default:{s[e+28>>2]=16e3;break t}}else s[e+28>>2]=16e3;while(0);p=l<<1}c=e+16|0;w=(p|0)==0;m=0;g=_;while(1){t:do if(!(Ii(S,c,p,(m|0)==0&1,se,g,M)|0))h=s[v>>2]|0;else{if(w){h=-3;break e}s[M>>2]=X;a=0;while(1){h=s[v>>2]|0;if((a|0)>=(te(X,h)|0))break t;r[g+(a<<1)>>1]=0;a=a+1|0}}while(0);T=s[M>>2]|0;m=m+T|0;g=g+((te(T,h)|0)<<1)|0;if((m|0)>=(X|0)){M=_;break}}}S=(l|0)==0;do if(S)if((d|0)!=1002)if((t|0)!=0?(N=se+20|0,C=s[N>>2]|0,D=se+28|0,R=s[D>>2]|0,P=C+((ne(R|0)|0)+-32)+17|0,(P+((s[e+56>>2]|0)==1001?20:0)|0)<=(i<<3|0)):0){E=(d|0)==1001;A=se+32|0;a=s[A>>2]|0;if(E){h=R>>>12;v=a>>>0>>0;k=v&1;if(!v){a=a-h|0;s[A>>2]=a;h=R-h|0}s[D>>2]=h;m=se+40|0;g=se+24|0;_=se+4|0;c=h;h=C;while(1){if(c>>>0>=8388609)break;h=h+8|0;s[N>>2]=h;p=c<<8;s[D>>2]=p;w=s[m>>2]|0;c=s[g>>2]|0;if(c>>>0<(s[_>>2]|0)>>>0){s[g>>2]=c+1;c=o[(s[se>>2]|0)+c>>0]|0}else c=0;s[m>>2]=c;P=((w<<8|c)>>>1&255|a<<8&2147483392)^255;s[A>>2]=P;c=p;a=P}if(v){w=c;p=a}else{h=i;a=0;c=0;p=0;P=90;break}}else{w=R;p=a;h=C;k=1}c=w>>>1;P=p>>>0>>0;a=P&1;if(!P){p=p-c|0;s[A>>2]=p;c=w-c|0}s[D>>2]=c;_=se+40|0;v=se+24|0;y=se+4|0;while(1){if(c>>>0>=8388609)break;h=h+8|0;s[N>>2]=h;c=c<<8;s[D>>2]=c;m=s[_>>2]|0;w=s[v>>2]|0;if(w>>>0<(s[y>>2]|0)>>>0){s[v>>2]=w+1;w=o[(s[se>>2]|0)+w>>0]|0}else w=0;s[_>>2]=w;P=((m<<8|w)>>>1&255|p<<8&2147483392)^255;s[A>>2]=P;p=P}if(E){P=c>>>8;s[se+36>>2]=P;g=(p>>>0)/(P>>>0)|0;C=g+1|0;g=256-(C+(C>>>0>256?255-g|0:0))|0;C=te(P,255-g|0)|0;m=p-C|0;s[A>>2]=m;c=(g|0)==0?c-C|0:P;s[D>>2]=c;while(1){if(c>>>0>=8388609)break;h=h+8|0;s[N>>2]=h;c=c<<8;s[D>>2]=c;w=s[_>>2]|0;p=s[v>>2]|0;if(p>>>0<(s[y>>2]|0)>>>0){s[v>>2]=p+1;p=o[(s[se>>2]|0)+p>>0]|0}else p=0;s[_>>2]=p;P=((w<<8|p)>>>1&255|m<<8&2147483392)^255;s[A>>2]=P;m=P}p=g+2|0}else p=i-(h+((ne(c|0)|0)+-32)+7>>3)|0;P=i-p|0;c=(P<<3|0)<(h+((ne(c|0)|0)+-32)|0);p=c?0:p;s[y>>2]=(s[y>>2]|0)-p;h=c?0:P;c=c?0:k;P=90}else{h=i;a=0;c=0;p=0;P=91}else{T=i;A=0;c=0;p=0;a=0}else{h=i;a=0;c=0;p=0;P=90}while(0);if((P|0)==90)if((d|0)==1002){T=h;A=a;a=0}else P=91;if((P|0)==91){T=h;A=a;a=17}switch(s[e+52>>2]|0){case 1101:{h=13;break}case 1103:case 1102:{h=17;break}case 1104:{h=19;break}default:h=21}s[L>>2]=h;ri(Y,10012,L);s[U>>2]=s[e+48>>2];ri(Y,10008,U);E=(c|0)==0;if(!E){U=(te(ee,s[e+8>>2]|0)|0)<<2;h=u;u=u+((1*U|0)+15&-16)|0;if(!A){g=h;y=I;_=0}else{s[B>>2]=0;ri(Y,10010,B);si(Y,t+T|0,p,h,ee,0,0)|0;s[j>>2]=oe;ri(Y,4031,j);g=h;y=I;_=0}}else{h=u;u=u+((1*(x<<2)|0)+15&-16)|0;do if(!((O|0)==0|(d|0)==1002))if((ee|0)<(X|0)){Ms(e,0,0,h,ee,0)|0;break}else{Ms(e,0,0,h,X,0)|0;break}else h=I;while(0);g=u;u=u+16|0;y=h;_=O}s[F>>2]=a;ri(Y,10010,F);do if((d|0)==1e3){r[H>>1]=-1;h=e+8|0;a=0;while(1){if((a|0)>=(te(X,s[h>>2]|0)|0))break;f[n+(a<<2)>>2]=0;a=a+1|0}if((s[e+60>>2]|0)==1001){if(!(E|(A|0)==0)?s[e+68>>2]|0:0){h=0;d=1e3;P=116;break}s[z>>2]=0;ri(Y,10010,z);si(Y,H,2,n,re,0,0)|0;h=0;d=1e3;P=116}else{h=0;d=1e3;P=116}}else{h=(q|0)<(X|0)?q:X;q=s[e+60>>2]|0;if((d|0)!=(q|0)&(q|0)>0?(s[e+68>>2]|0)==0:0)ri(Y,4028,G);h=si(Y,S?t:0,T,n,h,se,0)|0;if((d|0)==1002){k=h;v=d}else P=116}while(0);t:do if((P|0)==116){a=e+8|0;c=0;while(1){if((c|0)>=(te(X,s[a>>2]|0)|0)){k=h;v=d;break t}q=n+(c<<2)|0;f[q>>2]=+f[q>>2]+ +(r[M+(c<<1)>>1]|0)*30517578125e-15;c=c+1|0}}while(0);s[V>>2]=W;ri(Y,10015,V);m=s[(s[W>>2]|0)+60>>2]|0;t:do if(!E){if(!A){ri(Y,4028,Z);s[$>>2]=0;ri(Y,10010,$);si(Y,t+T|0,p,g,ee,0,0)|0;s[K>>2]=oe;ri(Y,4031,K);p=s[e+8>>2]|0;w=n+((te(p,X-re|0)|0)<<2)|0;h=g+((te(p,re)|0)<<2)|0;a=48e3/(s[ie>>2]|0)|0;c=0;while(1){if((c|0)<(p|0))d=0;else break t;while(1){if((d|0)>=(re|0))break;b=+f[m+((te(d,a)|0)<<2)>>2];b=b*b;$=(te(d,p)|0)+c|0;K=w+($<<2)|0;f[K>>2]=b*+f[h+($<<2)>>2]+(1-b)*+f[K>>2];d=d+1|0}c=c+1|0}}a=e+8|0;c=0;while(1){w=s[a>>2]|0;if((c|0)<(w|0))h=0;else break;while(1){if((h|0)>=(re|0))break;K=(te(s[a>>2]|0,h)|0)+c|0;s[n+(K<<2)>>2]=s[g+(K<<2)>>2];h=h+1|0}c=c+1|0}a=te(w,re)|0;h=g+(a<<2)|0;a=n+(a<<2)|0;c=48e3/(s[ie>>2]|0)|0;d=0;while(1){if((d|0)<(w|0))p=0;else break t;while(1){if((p|0)>=(re|0))break;b=+f[m+((te(p,c)|0)<<2)>>2];b=b*b;$=(te(p,w)|0)+d|0;K=a+($<<2)|0;f[K>>2]=b*+f[K>>2]+(1-b)*+f[h+($<<2)>>2];p=p+1|0}d=d+1|0}}while(0);t:do if(_|0){a=e+8|0;if((X|0)<(ee|0)){d=s[a>>2]|0;h=48e3/(s[ie>>2]|0)|0;a=0;while(1){if((a|0)<(d|0))c=0;else break t;while(1){if((c|0)>=(re|0))break;b=+f[m+((te(c,h)|0)<<2)>>2];b=b*b;ee=(te(c,d)|0)+a|0;ie=n+(ee<<2)|0;f[ie>>2]=b*+f[ie>>2]+(1-b)*+f[y+(ee<<2)>>2];c=c+1|0}a=a+1|0}}else h=0;while(1){w=s[a>>2]|0;c=te(w,re)|0;if((h|0)>=(c|0))break;s[n+(h<<2)>>2]=s[y+(h<<2)>>2];h=h+1|0}p=y+(c<<2)|0;d=n+(c<<2)|0;h=48e3/(s[ie>>2]|0)|0;a=0;while(1){if((a|0)<(w|0))c=0;else break t;while(1){if((c|0)>=(re|0))break;b=+f[m+((te(c,h)|0)<<2)>>2];b=b*b;ee=(te(c,w)|0)+a|0;ie=d+(ee<<2)|0;f[ie>>2]=b*+f[ie>>2]+(1-b)*+f[p+(ee<<2)>>2];c=c+1|0}a=a+1|0}}while(0);h=s[e+40>>2]|0;t:do if(h|0){b=+J(+(+(h|0)*.0006488140788860619*.6931471805599453));h=e+8|0;a=0;while(1){if((a|0)>=(te(X,s[h>>2]|0)|0))break t;re=n+(a<<2)|0;f[re>>2]=+f[re>>2]*b;a=a+1|0}}while(0);if((T|0)<2)h=0;else h=s[se+28>>2]^s[oe>>2];s[e+84>>2]=h;s[e+60>>2]=v;s[e+68>>2]=(A|0)==0&(E^1)&1;h=(k|0)<0?k:X}while(0);He(Q|0);e=h;u=ae;return e|0}function Rs(e,t,i,a){e=e|0;t=t|0;i=i|0;a=a|0;var l=0,h=0,c=0,p=0,b=0,w=0,m=0,g=0,_=0,v=0,k=0,y=0,E=0,A=0,T=0,S=0,M=0,R=0,C=0,P=0,x=0;C=u;u=u+112|0;A=C;E=C+104|0;T=C+8|0;_=(t|0)==0;do if((i|0)>0&(_^1)){w=s[e+12>>2]|0;c=n[t>>0]|0;p=c&255;e:do switch(p&3|0){case 0:{b=1;break}case 3:if((i|0)<2){a=-4;u=C;return a|0}else{h=o[t+1>>0]&63;v=5;break e}default:{h=2;v=5}}while(0);if((v|0)==5)b=h;do if(c<<24>>24>=0)if((c&96)==96)if(!(c&8)){h=(w|0)/100|0;break}else{h=(w|0)/50|0;break}else{h=p>>>3&3;if((h|0)==3){h=(w*60|0)/1e3|0;break}else{h=(w<>>3&3)|0)/400|0;while(0);h=te(b,h)|0;if((h*25|0)<=(w*3|0)&(h|0)>0){y=(h|0)>5760?5760:h;break}else{a=-4;u=C;return a|0}}else y=5760;while(0);S=e+8|0;h=te(y,s[S>>2]|0)|0;M=Ne()|0;R=u;u=u+((1*(h<<2)|0)+15&-16)|0;h=(i|0)==0;e:do if(h|_)if(!((y|0)%((s[e+12>>2]|0)/400|0|0)|0))if(h|_){c=0;do{h=Ms(e,0,0,R+((te(c,s[S>>2]|0)|0)<<2)|0,y-c|0,0)|0;if((h|0)<0){c=h;break e}c=c+h|0}while((c|0)<(y|0));s[e+72>>2]=c}else v=23;else c=-1;else v=23;while(0);e:do if((v|0)==23)if((i|0)>=0){w=n[t>>0]|0;do if(w<<24>>24>=0){v=(w&96)==96;b=v?1001:1e3;if(v)p=(w&16)>>>4|1104;else p=((w&255)>>>5&3)+1101|0;h=s[e+12>>2]|0;if((w&96)==96)if(!(w&8)){_=(h|0)/100|0;break}else{_=(h|0)/50|0;break}else{c=(w&255)>>>3&3;if((c|0)==3){_=(h*60|0)/1e3|0;break}else{_=(h<>>5&3;_=(s[e+12>>2]<<((w&255)>>>3&3)|0)/400|0;p=(p|0)==0?1101:p+1102|0;b=1002}while(0);h=((w&4)>>>2)+1|0;c=rn(t,i,0,E,0,T,A,0)|0;if((c|0)>=0)if((te(c,_)|0)<=(y|0)){w=t+(s[A>>2]|0)|0;s[e+56>>2]=b;s[e+52>>2]=p;s[e+64>>2]=_;s[e+48>>2]=h;h=w;w=0;t=0;while(1){if((w|0)>=(c|0))break;p=T+(w<<1)|0;b=Ms(e,h,r[p>>1]|0,R+((te(t,s[S>>2]|0)|0)<<2)|0,y-t|0,0)|0;if((b|0)<0){c=b;break e}h=h+(r[p>>1]|0)|0;w=w+1|0;t=t+b|0}s[e+72>>2]=t;E=s[S>>2]|0;if((E|0)<1|(t|0)<1)c=t;else{h=te(t,E)|0;c=0;while(1){if((c|0)>=(h|0)){i=0;break}T=R+(c<<2)|0;k=+f[T>>2];i=k>2;A=k<-2&(i^1);f[T>>2]=A|i?A?-2:2:k;c=c+1|0}while(1){if((i|0)==(E|0)){c=t;break e}v=R+(i<<2)|0;y=e+76+(i<<2)|0;l=+f[y>>2];c=0;while(1){if((c|0)>=(t|0))break;h=v+((te(c,E)|0)<<2)|0;m=+f[h>>2];g=m*l;if(g>=0)break;f[h>>2]=m+g*m;c=c+1|0}k=+f[v>>2];w=0;while(1){c=w;while(1){if((c|0)>=(t|0))break;g=+f[v+((te(c,E)|0)<<2)>>2];if(g>1|g<-1)break;c=c+1|0}if((c|0)==(t|0)){l=0;break}g=+f[v+((te(c,E)|0)<<2)>>2];l=+H(+g);p=c;while(1){if((p|0)<=0){_=c;m=l;b=c;break}h=p+-1|0;if(!(g*+f[v+((te(h,E)|0)<<2)>>2]>=0)){_=c;m=l;b=c;break}else p=h}while(1){if((_|0)>=(t|0))break;l=+f[v+((te(_,E)|0)<<2)>>2];if(!(g*l>=0))break;l=+H(+l);A=l>m;T=A?_:b;_=_+1|0;m=A?l:m;b=T}if(!p)c=g*+f[v>>2]>=0;else c=0;l=(m+-1)/(m*m);l=l+l*2.4e-7;l=g>0?-l:l;h=p;while(1){if((h|0)>=(_|0))break;T=v+((te(h,E)|0)<<2)|0;g=+f[T>>2];f[T>>2]=g+l*g*g;h=h+1|0}t:do if(c&(b|0)>1){m=k-+f[v>>2];g=m/+(b|0);h=w;while(1){if((h|0)>=(b|0))break t;P=m-g;T=v+((te(h,E)|0)<<2)|0;x=+f[T>>2]+P;f[T>>2]=x;w=x>1;A=x<-1&(w^1);f[T>>2]=A|w?A?-1:1:x;h=h+1|0;m=P}}while(0);if((_|0)==(t|0))break;else w=_}f[y>>2]=l;i=i+1|0}}}else c=-2}else c=-1;while(0);e:do if((c|0)>0){p=0;while(1){if((p|0)>=(te(c,s[S>>2]|0)|0))break e;l=+f[R+(p<<2)>>2]*32768;if(l>-32768){if(!(l<32767))l=32767}else l=-32768;h=(f[d>>2]=l,s[d>>2]|0);if((h&2130706432)>>>0<=1249902592){h=(h|0)<0;l=h?l+-8388608+8388608:l+8388608+-8388608;if(l==0)l=h?-0:0}r[a+(p<<1)>>1]=~~l;p=p+1|0}}while(0);He(M|0);a=c;u=C;return a|0}function Cs(e,t,i){e=e|0;t=t|0;i=i|0;var n=0,o=0,a=0,l=0,f=0,h=0,c=0,d=0;c=u;u=u+32|0;o=c+8|0;a=c;f=c+16|0;n=s[e+4>>2]|0;l=e+(s[e>>2]|0)|0;s[f>>2]=i;e:do switch(t|0){case 4009:{h=(s[f>>2]|0)+(4-1)&~(4-1);n=s[h>>2]|0;s[f>>2]=h+4;if(!n)t=26;else{s[n>>2]=s[e+52>>2];n=0;t=25}break}case 4031:{h=(s[f>>2]|0)+(4-1)&~(4-1);n=s[h>>2]|0;s[f>>2]=h+4;if(!n)t=26;else{s[n>>2]=s[e+84>>2];n=0;t=25}break}case 4028:{f=e+n|0;h=e+48|0;n=h;t=n+40|0;do{s[n>>2]=0;n=n+4|0}while((n|0)<(t|0));ri(l,4028,a);l=0;while(1){if((l|0)==2)break;n=f+(l*4260|0)|0;yr(n|0,0,4260)|0;s[f+(l*4260|0)+2376>>2]=1;s[n>>2]=65536;n=f+(l*4260|0)+2340|0;i=s[n>>2]|0;t=32767/(i+1|0)|0;o=0;a=0;while(1){if((a|0)>=(i|0))break;d=o+t|0;r[f+(l*4260|0)+4052+(a<<1)>>1]=d;i=s[n>>2]|0;o=d;a=a+1|0}s[f+(l*4260|0)+4148>>2]=0;s[f+(l*4260|0)+4152>>2]=3176576;s[f+(l*4260|0)+4168>>2]=s[f+(l*4260|0)+2328>>2]<<7;s[f+(l*4260|0)+4240>>2]=65536;s[f+(l*4260|0)+4244>>2]=65536;s[f+(l*4260|0)+4256>>2]=20;s[f+(l*4260|0)+4252>>2]=2;l=l+1|0}n=f+8520|0;s[n>>2]=0;s[n+4>>2]=0;s[n+8>>2]=0;s[f+8540>>2]=0;s[h>>2]=s[e+8>>2];s[e+64>>2]=(s[e+12>>2]|0)/400|0;n=0;t=25;break}case 4029:{d=(s[f>>2]|0)+(4-1)&~(4-1);n=s[d>>2]|0;s[f>>2]=d+4;if(!n)t=26;else{s[n>>2]=s[e+12>>2];n=0;t=25}break}case 4033:{d=(s[f>>2]|0)+(4-1)&~(4-1);n=s[d>>2]|0;s[f>>2]=d+4;if(n)if((s[e+60>>2]|0)==1002){s[o>>2]=n;ri(l,4033,o);n=0;t=25;break e}else{s[n>>2]=s[e+36>>2];n=0;t=25;break e}else t=26;break}case 4045:{d=(s[f>>2]|0)+(4-1)&~(4-1);n=s[d>>2]|0;s[f>>2]=d+4;if(!n)t=26;else{s[n>>2]=s[e+40>>2];n=0;t=25}break}case 4034:{d=(s[f>>2]|0)+(4-1)&~(4-1);n=s[d>>2]|0;s[f>>2]=d+4;if((n+32768|0)>>>0>65535)t=26;else{s[e+40>>2]=n;n=0;t=25}break}case 4039:{d=(s[f>>2]|0)+(4-1)&~(4-1);n=s[d>>2]|0;s[f>>2]=d+4;if(!n)t=26;else{s[n>>2]=s[e+72>>2];n=0;t=25}break}default:{n=-5;t=25}}while(0);if((t|0)==25){d=n;u=c;return d|0}else if((t|0)==26){d=-1;u=c;return d|0}return 0}function Ps(e){e=e|0;qn(e);return}function xs(e,t,i,n){e=e|0;t=t|0;i=i|0;n=n|0;var o=0,a=0,l=0,h=0,c=0,d=0,p=0,b=0,w=0,m=0,g=0,_=0;_=u;u=u+32|0;w=_+16|0;b=_+8|0;c=_;e:do if((e|0)<16e3)if((e|0)<12e3)switch(e|0){case 8e3:{g=2;break e}default:break e}else switch(e|0){case 12e3:{g=2;break e}default:break e}else{if((e|0)<24e3)switch(e|0){case 16e3:{g=2;break e}default:break e}if((e|0)<48e3)switch(e|0){case 24e3:{g=2;break e}default:break e}else switch(e|0){case 48e3:{g=2;break e}default:break e}}while(0);e:do if((g|0)==2?(t+-1|0)>>>0<2:0){switch(i|0){case 2048:case 2049:case 2051:break;default:break e}l=t<<12;m=zn((t*480|0)+212+l+(t*336|0)+39448|0)|0;if(!m){if(!n){g=0;u=_;return g|0}s[n>>2]=-7;g=0;u=_;return g|0}t:do if((e|0)<16e3)if((e|0)<12e3)switch(e|0){case 8e3:{g=10;break t}default:{o=-1;break t}}else switch(e|0){case 12e3:{g=10;break t}default:{o=-1;break t}}else{if((e|0)<24e3)switch(e|0){case 16e3:{g=10;break t}default:{o=-1;break t}}if((e|0)<48e3)switch(e|0){case 24e3:{g=10;break t}default:{o=-1;break t}}else switch(e|0){case 48e3:{g=10;break t}default:{o=-1;break t}}}while(0);t:do if((g|0)==10)if((t+-1|0)>>>0<2){switch(i|0){case 2048:case 2049:case 2051:break;default:{o=-1;break t}}yr(m|0,0,(t*480|0)+212+l+(t*336|0)+39448|0)|0;s[m+4>>2]=19048;s[m>>2]=39448;d=m+39448|0;s[m+112>>2]=t;s[m+15104>>2]=t;p=m+144|0;s[p>>2]=e;a=m+180|0;s[a>>2]=0;o=m+8|0;if(!(Oi(m+19048|0,0,o)|0)){s[o>>2]=t;s[m+12>>2]=t;s[m+16>>2]=s[p>>2];s[m+20>>2]=16e3;s[m+24>>2]=8e3;s[m+28>>2]=16e3;s[m+32>>2]=20;s[m+36>>2]=25e3;s[m+40>>2]=0;h=m+44|0;s[h>>2]=9;s[m+48>>2]=0;s[m+56>>2]=0;s[m+60>>2]=0;s[m+76>>2]=0;o=s[a>>2]|0;yr(d|0,0,(t*480|0)+212+l+(t*336|0)|0)|0;s[d>>2]=5304;s[m+39452>>2]=t;s[m+39456>>2]=t;a=m+39476|0;s[a>>2]=1;s[m+39480>>2]=0;s[m+39484>>2]=21;s[m+39496>>2]=1;s[m+39520>>2]=o;s[m+39500>>2]=1;s[m+39464>>2]=1;s[m+39488>>2]=-1;s[m+39492>>2]=0;s[m+39460>>2]=0;s[m+39472>>2]=5;s[m+39508>>2]=24;Hs(d,4028,c)|0;i:do if((e|0)<16e3)if((e|0)<12e3){switch(e|0){case 8e3:break;default:{g=18;break i}}o=6;break}else{switch(e|0){case 12e3:break;default:{g=18;break i}}o=4;break}else{if((e|0)<24e3){switch(e|0){case 16e3:break;default:{g=18;break i}}o=3;break}if((e|0)>=48e3)switch(e|0){case 48e3:{o=1;break i}default:{g=18;break i}}switch(e|0){case 24e3:break;default:{g=18;break i}}o=2}while(0);if((g|0)==18)o=0;s[a>>2]=o;s[b>>2]=0;Hs(d,10016,b)|0;s[w>>2]=s[h>>2];Hs(d,4010,w)|0;s[m+148>>2]=1;s[m+152>>2]=1;s[m+164>>2]=-1e3;s[m+160>>2]=(te(e,t)|0)+3e3;s[m+108>>2]=i;s[m+124>>2]=-1e3;s[m+128>>2]=-1e3;s[m+132>>2]=1105;s[m+120>>2]=-1e3;s[m+136>>2]=-1e3;s[m+140>>2]=-1;o=s[p>>2]|0;s[m+172>>2]=(o|0)/100|0;s[m+168>>2]=24;s[m+156>>2]=5e3;s[m+116>>2]=(o|0)/250|0;r[m+15108>>1]=16384;f[m+15116>>2]=1;s[m+15112>>2]=193536;s[m+15164>>2]=1;s[m+15136>>2]=1001;s[m+15152>>2]=1105;yr(m+188|0,0,14916)|0;o=0}else o=-3}else o=-1;while(0);if(n|0)s[n>>2]=o;if(!o){g=m;u=_;return g|0}qn(m);g=0;u=_;return g|0}while(0);if(!n){g=0;u=_;return g|0}s[n>>2]=-1;g=0;u=_;return g|0}function Is(e,t,i,n,s,o,a){e=e|0;t=t|0;i=i|0;n=n|0;s=s|0;o=o|0;a=a|0;var l=0,h=0,u=0,c=0;h=0;while(1){if((h|0)>=(i|0))break;f[t+(h<<2)>>2]=+(r[e+((te(h+n|0,a)|0)+s<<1)>>1]|0);h=h+1|0}u=(o|0)>-1;e:do if(!u)if((o|0)==-2){s=1;while(1){if((s|0)<(a|0))h=0;else{s=12;break e}while(1){if((h|0)>=(i|0))break;l=+(r[e+((te(h+n|0,a)|0)+s<<1)>>1]|0);c=t+(h<<2)|0;f[c>>2]=+f[c>>2]+l;h=h+1|0}s=s+1|0}}else s=14;else{s=0;while(1){if((s|0)>=(i|0)){s=12;break e}l=+(r[e+((te(s+n|0,a)|0)+o<<1)>>1]|0);c=t+(s<<2)|0;f[c>>2]=+f[c>>2]+l;s=s+1|0}}while(0);if((s|0)==12)if((o|0)==-2)l=30517578125e-15/+(a|0);else s=14;if((s|0)==14)l=u?152587890625e-16:30517578125e-15;s=0;while(1){if((s|0)>=(i|0))break;c=t+(s<<2)|0;f[c>>2]=+f[c>>2]*l;s=s+1|0}return}function Os(e,t,i,n,r,o,a,l){e=e|0;t=t|0;i=i|0;n=n|0;r=r|0;o=o|0;a=a|0;l=l|0;var h=0,c=0,p=0,b=0,w=0,m=0,g=0,_=0,v=0,k=0,y=0,E=0,A=0,T=0,S=0,M=0,R=0,C=0,P=0,x=0,I=0;P=u;u=u+3296|0;S=P+1760|0;R=P+224|0;C=P+112|0;T=P;m=(n|0)/400|0;g=u;u=u+((1*(m<<2)|0)+15&-16)|0;M=s[o>>2]|0;s[C>>2]=M;f[T>>2]=1/((s[d>>2]=M,+f[d>>2])+1.0000000036274937e-15);M=(a|0)==0;if(M){n=t;c=0;w=1}else{c=(m<<1)-a|0;n=s[o+4>>2]|0;s[C+4>>2]=n;f[T+4>>2]=1/((s[d>>2]=n,+f[d>>2])+1.0000000036274937e-15);n=s[o+8>>2]|0;s[C+8>>2]=n;f[T+8>>2]=1/((s[d>>2]=n,+f[d>>2])+1.0000000036274937e-15);n=t-c|0;w=3}a=(n|0)/(m|0)|0;a=(a|0)<24?a:24;n=0;h=0;while(1){if((n|0)>=(a|0))break;t=(te(n,m)|0)+c|0;Zs[l&1](e,g,m,t,0,-2,i);t=0;h=(n|0)==0?+f[g>>2]:h;p=1.0000000036274937e-15;while(1){if((t|0)>=(m|0))break;v=+f[g+(t<<2)>>2];y=v-h;t=t+1|0;h=v;p=p+y*y}A=n+w|0;f[C+(A<<2)>>2]=p;f[T+(A<<2)>>2]=1/p;n=n+1|0}A=n+w|0;s[C+(A<<2)>>2]=s[C+(A+-1<<2)>>2];if(!M){a=a+2|0;a=(a|0)>24?24:a}E=~~+((i*60|0)+40|0);A=(r|0)/400|0;if((r|0)>=32e3)if((r|0)>64399)y=1;else y=+(A+-80|0)/80;else y=0;n=0;while(1){if((n|0)==16){w=0;break}s[R+(n<<2)>>2]=-1;f[S+(n<<2)>>2]=1e10;n=n+1|0}while(1){if((w|0)==4){k=1;break}b=+((A<(a|0)?a:c;t=0;h=0;p=0;while(1){if((t|0)>(n|0))break;v=p+ +f[T+(t<<2)>>2];_=h+ +f[C+(t<<2)>>2];t=t+1|0;h=_;p=v}k=n+1|0;h=(h*p/+(te(k,k)|0)+-2)*.05000000074505806;if(+z(+(h<=0?0:h))>1)h=1;else h=+z(+(h<=0?0:h));f[S+(c<<2)>>2]=b*(y*h+1);s[R+(c<<2)>>2]=w;w=w+1|0}while(1){if((a|0)<=(k|0))break;r=k+-1|0;n=2;while(1){if((n|0)==16)break;i=n+-1|0;s[S+(k<<6)+(n<<2)>>2]=s[S+(r<<6)+(i<<2)>>2];s[R+(k<<6)+(n<<2)>>2]=i;n=n+1|0}m=S+(r<<6)+4|0;g=C+(k<<2)|0;l=T+(k<<2)|0;e=a-k|0;v=+(e|0);i=0;while(1){if((i|0)==4)break;w=1<>2]=1;_=+f[m>>2];n=1;while(1){if((n|0)==4)break;n=n+1|0;t=(1<>2];if(!(h<_))continue;s[c>>2]=t;_=h}b=+((A<(e|0);n=c?e:w;t=0;h=0;p=0;while(1){if((t|0)>(n|0))break;x=p+ +f[l+(t<<2)>>2];I=h+ +f[g+(t<<2)>>2];t=t+1|0;h=I;p=x}t=n+1|0;h=(h*p/+(te(t,t)|0)+-2)*.05000000074505806;if(+z(+(h<=0?0:h))>1)h=1;else h=+z(+(h<=0?0:h));h=b*(y*h+1);n=S+(k<<6)+(w<<2)|0;f[n>>2]=_;if(c)h=h*v/+(w|0);f[n>>2]=_+h;i=i+1|0}k=k+1|0}n=a+-1|0;h=+f[S+(n<<6)+4>>2];t=1;c=2;while(1){if((c|0)==16)break;I=+f[S+(n<<6)+(c<<2)>>2];T=I>2]|0;a=n}n=1<>2]=s[C+(n<<2)>>2];if(M){u=P;return t|0}s[o+4>>2]=s[C+(n+1<<2)>>2];s[o+8>>2]=s[C+(n+2<<2)>>2];u=P;return t|0}function Ns(e,t,i,o,a,l,h,c,p,b,w,m,g){e=e|0;t=t|0;i=i|0;o=o|0;a=a|0;l=l|0;h=h|0;c=c|0;p=p|0;b=b|0;w=w|0;m=m|0;g=g|0;var _=0,v=0,k=0,y=0,E=0,A=0,T=0,S=0,M=0,R=0,C=0,P=0,x=0,I=0,O=0,N=0,D=0,L=0,U=0,B=0,j=0,F=0,q=0,W=0,V=0,Y=0,Z=0,$=0,K=0,X=0,Q=0,ee=0,ie=0,re=0,se=0,oe=0,ae=0,le=0,fe=0,he=0,ue=0,ce=0,de=0,pe=0,be=0,we=0,me=0,ge=0,_e=0,ve=0,ke=0,ye=0,Ee=0,Ae=0,Te=0,Se=0,Me=0,Re=0,Ce=0,Pe=0,xe=0,Ie=0,Oe=0,De=0,Le=0,Ue=0,Be=0,je=0,Fe=0,Ge=0,ze=0,qe=0,We=0,Ve=0,Ye=0,Ze=0,$e=0,Ke=0,Xe=0,Je=0,Qe=0,et=0,tt=0,it=0,nt=0,rt=0,st=0,ot=0,at=0,lt=0,ft=0,ht=0,ut=0,ct=0,dt=0,pt=0,bt=0,wt=0,mt=0,gt=0,_t=0,vt=0,kt=0,yt=0;pt=u;u=u+1280|0;st=pt+832|0;nt=pt+824|0;it=pt+816|0;tt=pt+808|0;et=pt+800|0;Qe=pt+792|0;Ke=pt+784|0;$e=pt+776|0;Ze=pt+768|0;Ye=pt+760|0;ct=pt+456|0;We=pt+448|0;qe=pt+440|0;ze=pt+432|0;Ge=pt+424|0;Fe=pt+416|0;je=pt+408|0;Be=pt+400|0;Ue=pt+392|0;Te=pt+384|0;Ae=pt+376|0;Ee=pt+368|0;ye=pt+360|0;ke=pt+352|0;ge=pt+344|0;me=pt+336|0;we=pt+328|0;ve=pt+320|0;_e=pt+312|0;Y=pt+304|0;C=pt;pe=pt+1272|0;Je=pt+1224|0;lt=pt+1220|0;Me=pt+1216|0;ft=pt+1184|0;V=pt+1152|0;ee=pt+852|0;ue=pt+848|0;De=pt+840|0;Ve=pt+1278|0;rt=pt+1276|0;s[lt>>2]=0;R=(a|0)>1276?1276:a;ut=e+19044|0;s[ut>>2]=0;be=e+156|0;if(!(s[be>>2]|0)){k=i*400|0;v=e+144|0;_=s[v>>2]|0;if((k|0)!=(_|0))if(!((i*200|0)==(_|0)|(i*100|0)==(_|0))?(dt=i*50|0,!((dt|0)==(_|0)|(i*25|0)==(_|0)|(dt|0)==(_*3|0))):0){o=-1;u=pt;return o|0}else{dt=v;v=k}else{dt=v;v=k;_=k}}else{_=e+144|0;dt=_;v=i*400|0;_=s[_>>2]|0}if((v|0)<(_|0)|(R|0)<1){o=-1;u=pt;return o|0}de=e+(s[e+4>>2]|0)|0;Xe=e+(s[e>>2]|0)|0;Q=e+108|0;if((s[Q>>2]|0)==2051)Se=0;else Se=s[e+116>>2]|0;X=s[e+168>>2]|0;X=(X|0)>(l|0)?l:X;s[C>>2]=Me;Hs(Xe,10015,C)|0;s[ft>>2]=0;M=e+44|0;do if((s[M>>2]|0)>6?(s[dt>>2]|0)==48e3:0){k=e+112|0;_=te(s[k>>2]|0,i)|0;v=0;E=0;A=0;while(1){if((v|0)>=(_|0))break;L=+f[t+(v<<2)>>2];v=v+1|0;E=E>L?E:L;A=AL?E:L)<=1/+(1<>2]=0;v=1;l=-1;y=-1;Oe=1;break}l=s[e+8696>>2]|0;y=s[e+8700>>2]|0;Gs(e+188|0,s[Me>>2]|0,h,c,i,p,b,w,48e3,X,m,ft);if(+f[ft+28>>2]>.10000000149011612){h=e+19040|0;E=+f[h>>2];v=te(s[k>>2]|0,i)|0;_=0;O=0;while(1){if((_|0)>=(v|0))break;L=+f[t+(_<<2)>>2];_=_+1|0;O=O+L*L}E=E*.999;A=+(v|0);if(!(E>O/A)){_=0;E=0;while(1){if((_|0)>=(v|0))break;L=+f[t+(_<<2)>>2];_=_+1|0;E=E+L*L}E=E/A}f[h>>2]=E;ht=25}else ht=25}else{l=-1;y=-1;ht=25}while(0);do if((ht|0)==25){s[e+140>>2]=-1;v=s[ft>>2]|0;k=e+19032|0;s[k>>2]=0;v=(v|0)==0;if(!v){if((s[e+124>>2]|0)==-1e3)s[e+140>>2]=~~+G(+((1-+f[ft+20>>2])*100+.5));_=s[ft+24>>2]|0;if((_|0)<13){s[k>>2]=1101;q=k;Oe=0;break}if((_|0)<15){s[k>>2]=1102;q=k;Oe=0;break}if((_|0)<17){s[k>>2]=1103;q=k;Oe=0;break}if((_|0)<19){s[k>>2]=1104;q=k;Oe=0;break}else{s[k>>2]=1105;q=k;Oe=0;break}}else{q=k;Oe=0}}while(0);ot=e+112|0;T=s[ot>>2]|0;S=(T|0)==2;if(S?(s[e+120>>2]|0)!=1:0){c=(s[dt>>2]|0)/(i|0)|0;_=(c|0)<50;E=25/+(c|0);k=i+-3|0;h=0;A=0;O=0;N=0;while(1){if((h|0)>=(k|0))break;at=h<<1;vt=+f[t+(at<<2)>>2];wt=+f[t+((at|1)<<2)>>2];_t=+f[t+((at|2)<<2)>>2];bt=+f[t+((at|3)<<2)>>2];gt=+f[t+((at|4)<<2)>>2];D=+f[t+((at|5)<<2)>>2];mt=+f[t+((at|6)<<2)>>2];L=+f[t+((at|7)<<2)>>2];h=h+4|0;A=A+(vt*vt+_t*_t+gt*gt+mt*mt);O=O+(vt*wt+_t*bt+gt*D+mt*L);N=N+(wt*wt+bt*bt+D*D+L*L)}vt=_?.5:1-E;Le=e+15172|0;E=+f[Le>>2];E=E+vt*(A-E);f[Le>>2]=E;_=e+15176|0;A=+f[_>>2];A=A+vt*(O-A);f[_>>2]=A;at=e+15180|0;O=+f[at>>2];O=O+vt*(N-O);f[at>>2]=O;E=E<0?0:E;f[Le>>2]=E;A=A<0?0:A;f[_>>2]=A;O=O<0?0:O;f[at>>2]=O;if((E>O?E:O)>.0007999999797903001){gt=+z(+E);vt=+z(+O);E=+z(+gt);_t=+z(+vt);vt=gt*vt;gt=A>2]=gt;vt=gt/(vt+1.0000000036274937e-15);_t=+z(+(1-vt*vt))*(+H(+(E-_t))/(E+1.0000000036274937e-15+_t));at=e+15184|0;E=+f[at>>2];vt=+(c|0);E=E+(_t-E)/vt;f[at>>2]=E;at=e+15188|0;vt=+f[at>>2]-.019999999552965164/vt;E=vt>E?vt:E;f[at>>2]=E}else E=+f[e+15188>>2];E=E*20;if(E>1)E=1}else E=0;if(!i)_=(s[dt>>2]|0)/400|0;else _=i;k=s[e+164>>2]|0;switch(k|0){case-1e3:{I=s[dt>>2]|0;k=((I*60|0)/(_|0)|0)+(te(I,T)|0)|0;break}case-1:{I=s[dt>>2]|0;k=(te(R<<3,I)|0)/(_|0)|0;break}default:I=s[dt>>2]|0}xe=e+160|0;s[xe>>2]=k;_=(I|0)/(i|0)|0;at=e+148|0;B=(s[at>>2]|0)==0;if(B){U=(I*3|0)/(i|0)|0;Le=(((k*3|0)/8|0)+((U|0)/2|0)|0)/(U|0)|0;Le=(Le|0)<(R|0)?Le:R;U=((te(Le,U)|0)<<3|0)/3|0;s[xe>>2]=U}else{U=k;Le=R}do if(!((Le|0)<3|(U|0)<(_*24|0))){if((_|0)<50){k=te(Le,_)|0;if((k|0)<300|(U|0)<2400)break;else oe=k}else oe=te(_,Le)|0;ae=oe<<3;P=s[M>>2]|0;F=e+40|0;x=s[F>>2]|0;M=_+-50|0;k=U-(te((T*40|0)+20|0,M)|0)|0;if(B)k=k-((k|0)/12|0)|0;R=P+90|0;h=(te(k,R)|0)/100|0;C=(x*12|0)+20|0;h=h-((te(h,x)|0)/(C|0)|0)|0;k=s[e+124>>2]|0;do if((k|0)!=3001)if((k|0)!=3002){k=s[e+140>>2]|0;if((k|0)>-1){j=k*327>>8;j=(s[Q>>2]|0)!=2049|(j|0)<115?j:115;break}else{j=(s[Q>>2]|0)==2048?115:48;break}}else j=0;else j=127;while(0);W=e+120|0;k=s[W>>2]|0;Ie=e+15104|0;do if((k|0)==-1e3|S^1)if(S){T=(h|0)>(((s[Ie>>2]|0)==2?23e3:25e3)|0)?2:1;s[Ie>>2]=T;break}else{s[Ie>>2]=T;break}else{s[Ie>>2]=k;T=k}while(0);k=U-(te((T*40|0)+20|0,M)|0)|0;if(B)k=k-((k|0)/12|0)|0;c=(te(k,R)|0)/100|0;c=c-((te(c,x)|0)/(C|0)|0)|0;h=s[Q>>2]|0;do if((h|0)!=2051){k=s[e+136>>2]|0;do if((k|0)==-1e3){vt=1-E;k=~~(vt*16e3+E*16e3);k=k+((te(te(j,j)|0,~~(vt*64e3+E*36e3)-k|0)|0)>>14)|0;k=(h|0)==2048?k+8e3|0:k;h=s[e+15140>>2]|0;if((h|0)==1002)k=k+-4e3|0;else k=(h|0)>0?k+4e3|0:k;k=(c|0)>=(k|0)?1002:1e3;h=e+15136|0;s[h>>2]=k;do if(s[e+48>>2]|0){if((x|0)<=(128-j>>4|0))break;s[h>>2]=1e3;k=1e3}while(0);if(!(s[e+184>>2]|0)){s[e+56>>2]=0;v=h;ht=112;break}if(!v){s[e+56>>2]=0;v=h;ht=112;break}s[e+56>>2]=Oe^1;if(!((Oe|0)==0&(j|0)>100)){v=h;ht=112;break}s[h>>2]=1e3;v=h;k=1e3}else{v=e+15136|0;s[v>>2]=k;ht=112}while(0);if((ht|0)==112)if((k|0)==1002){Pe=v;v=1002;break}if(((I|0)/100|0|0)>(i|0)){s[v>>2]=1002;Pe=v;v=1002}else{Pe=v;v=k}}else{Pe=e+15136|0;s[Pe>>2]=1002;v=1002}while(0);$=e+176|0;if(s[$>>2]|0){s[Pe>>2]=1002;v=1002}ie=(_|0)>50;if((Le|0)<((te(ie?9e3:6e3,i)|0)/(I<<3|0)|0|0)){s[Pe>>2]=1002;v=1002}do if((T|0)==1?(s[e+15144>>2]|0)==2:0){k=e+68|0;if((s[k>>2]|0)!=0|(v|0)==1002){ht=124;break}h=e+15140|0;if((s[h>>2]|0)==1002){ht=124;break}s[k>>2]=1;s[Ie>>2]=2;Re=h;h=2}else ht=124;while(0);if((ht|0)==124){s[e+68>>2]=0;Re=e+15140|0;h=T}S=s[Re>>2]|0;do if((S|0)>0){k=(v|0)==1002;if((S|0)==1002&(k^1)){Ce=(v|0)!=1002;k=Ce&1;if(Ce){c=k;k=1;Ce=0;break}}else{if(!k){c=0;k=0;Ce=0;break}if((S|0)==1002){ -v=1002;c=0;k=0;Ce=0;break}k=(v|0)!=1002&1}if(((I|0)/100|0|0)>(i|0)){v=1002;c=k;k=0;Ce=0;break}s[Pe>>2]=S;v=S;c=k;k=1;Ce=1}else{c=0;k=0;Ce=0}while(0);h=U-(te((h*40|0)+20|0,M)|0)|0;if(B)h=h-((h|0)/12|0)|0;h=(te(h,R)|0)/100|0;e:do switch(v|0){case 1001:case 1e3:{if((P|0)<2)h=(h<<2|0)/5|0;le=h-((te(h,x)|0)/((x*6|0)+10|0)|0)|0;break}case 1002:{if((P|0)>=5){le=h;break e}le=(h*9|0)/10|0;break}default:le=h-((te(h,x)|0)/(C|0)|0)|0}while(0);fe=e+15160|0;if(!(s[fe>>2]|0))if(!k){re=c;h=0;k=0;se=0}else{h=0;ht=145}else{s[fe>>2]=0;c=1;h=1;k=1;ht=145}do if((ht|0)==145){T=(I|0)/200|0;T=(te(Le,T)|0)/(T+i|0)|0;T=(T|0)>257?257:T;if(B){re=c;se=T;break}se=(U|0)/1600|0;re=c;se=(T|0)<(se|0)?T:se}while(0);if((v|0)!=1002&(S|0)==1002){v=s[e+180>>2]|0;yr(de|0,0,20400)|0;h=0;while(1){if((h|0)==2)break;Fi(de+(h*10156|0)|0,v)|0;h=h+1|0}s[de+20376>>2]=1;s[de+20380>>2]=1;K=1}else K=h;M=(s[Pe>>2]|0)==1002;do if(M)ht=156;else{if(s[e+15164>>2]|0){ht=156;break}if(s[e+84>>2]|0){ht=156;break}h=e+15152|0;B=h;h=s[h>>2]|0}while(0);do if((ht|0)==156){if((s[ot>>2]|0)==2?(s[W>>2]|0)!=1:0){c=616;T=616}else{c=616;T=616}v=te(j,j)|0;h=0;while(1){if((h|0)==8)break;ce=s[c+(h<<2)>>2]|0;s[V+(h<<2)>>2]=ce+((te(v,(s[T+(h<<2)>>2]|0)-ce|0)|0)>>14);h=h+1|0}S=(s[e+15164>>2]|0)==0;T=e+15156|0;h=1105;do{c=h<<1;v=s[V+(c+-2204<<2)>>2]|0;c=s[V+(c+-2203<<2)>>2]|0;do if(S)if((s[T>>2]|0)<(h|0)){v=v+c|0;break}else{v=v-c|0;break}while(0);if((le|0)>=(v|0))break;h=h+-1|0}while((h|0)>1101);s[T>>2]=h;v=e+15152|0;s[v>>2]=h;if(M|S^1){B=v;break}if(!((s[e+88>>2]|0)==0&(h|0)>1103)){B=v;break}s[v>>2]=1103;B=v;h=1103}while(0);v=s[e+132>>2]|0;if((h|0)>(v|0))s[B>>2]=v;else v=h;U=e+128|0;h=s[U>>2]|0;T=(h|0)==-1e3;if(!T){s[B>>2]=h;v=h}if((ae|0)<15e3&(M^1)){v=(v|0)<1103?v:1103;s[B>>2]=v}h=s[dt>>2]|0;if((h|0)<24001&(v|0)>1104){s[B>>2]=1104;v=1104}if((h|0)<16001&(v|0)>1103){s[B>>2]=1103;v=1103}if((h|0)<12001&(v|0)>1102){s[B>>2]=1102;v=1102}if((h|0)<8001&(v|0)>1101){s[B>>2]=1101;v=1101}c=s[q>>2]|0;if(!((c|0)==0|T^1)){h=s[Ie>>2]|0;do if((le|0)>(h*18e3|0)|M^1){if(!((le|0)>(h*24e3|0)|M^1)){h=1102;break}if((le|0)<=(h*3e4|0)){h=1103;break}h=(le|0)>(h*44e3|0)?1105:1104}else h=1101;while(0);ce=(c|0)>(h|0)?c:h;s[q>>2]=ce;v=(v|0)<(ce|0)?v:ce;s[B>>2]=v}C=s[F>>2]|0;j=e+52|0;P=s[j>>2]|0;e:do if((s[e+48>>2]|0)==0|(C|0)==0|M)v=0;else{T=(C|0)<25;S=125-C|0;M=(C|0)<6;R=v;while(1){c=R<<1;h=s[648+(c+-2202<<2)>>2]|0;c=s[648+(c+-2201<<2)>>2]|0;switch(P|0){case 1:{h=h-c|0;break}case 0:{h=h+c|0;break}default:{}}ce=((te(h,T?S:100)|0)>>16)*655|0;h=(ce+((((te(h,T?125-C|0:100)|0)&65535)*655|0)>>>16)|0)<(le|0);if(h|M){v=h&1;break e}if((R|0)<=1101)break;ce=R+-1|0;s[B>>2]=ce;R=ce}s[B>>2]=v;v=0}while(0);s[j>>2]=v;s[Y>>2]=X;Hs(Xe,4036,Y)|0;h=s[Pe>>2]|0;v=(h|0)==1002;do if(v){if((s[B>>2]|0)!=1102)break;s[B>>2]=1103}while(0);if(s[$>>2]|0)s[B>>2]=1101;c=s[dt>>2]|0;do if(((c|0)/50|0|0)<(i|0)){if(!v?(Z=s[B>>2]|0,(Z|0)<=1103):0){U=Z;break}if((l|0)!=-1){s[e+8696>>2]=l;s[e+8700>>2]=y}M=((c|0)/25|0|0)<(i|0)?3:2;h=(a+-3|0)/(M|0)|0;h=(h|0)>1276?1276:h;R=te(M,h)|0;I=Ne()|0;c=u;u=u+((1*R|0)+15&-16)|0;s[ee+4>>2]=0;R=e+136|0;C=s[R>>2]|0;P=s[U>>2]|0;x=s[W>>2]|0;s[R>>2]=s[Pe>>2];s[U>>2]=s[B>>2];_=s[Ie>>2]|0;s[W>>2]=_;T=e+68|0;S=s[T>>2]|0;if(!S)s[e+15144>>2]=_;else s[W>>2]=1;_=(Ce|0)!=0;v=M+-1|0;y=0;while(1){if((y|0)>=(M|0)){ht=222;break}s[T>>2]=0;if(_&(y|0)==(v|0))s[R>>2]=1002;l=s[dt>>2]|0;k=c+(te(y,h)|0)|0;l=Ns(e,t+((te(y,(te(s[ot>>2]|0,l)|0)/50|0)|0)<<2)|0,(l|0)/50|0,k,h,X,0,0,p,b,w,m,g)|0;if((l|0)<0){_=-3;break}if((js(ee,k,l)|0)<0){_=-3;break}y=y+1|0}do if((ht|0)==222){v=(s[at>>2]|0)==0;if(v){_=((s[xe>>2]|0)*3|0)/(1200/(M>>>0)|0|0)|0;_=(_|0)<(a|0)?_:a}else _=a;_=Fs(ee,M,o,_,v&1)|0;if((_|0)<0){_=-3;break}s[R>>2]=C;s[U>>2]=P;s[W>>2]=x;s[T>>2]=S}while(0);He(I|0);o=_;u=pt;return o|0}else U=s[B>>2]|0;while(0);do if((h|0)==1e3){if((U|0)<=1103)break;s[Pe>>2]=1001}else{if(!((h|0)==1001&(U|0)<1104))break;s[Pe>>2]=1e3}while(0);ee=Le-se|0;c=(te(s[xe>>2]|0,i)|0)/(c<<3|0)|0;c=((ee|0)<(c|0)?ee:c)+-1|0;ee=o+1|0;w=Le+-1|0;s[Je>>2]=ee;p=Je+8|0;s[p>>2]=0;s[Je+12>>2]=0;s[Je+16>>2]=0;he=Je+20|0;s[he>>2]=33;W=Je+24|0;s[W>>2]=0;a=Je+28|0;s[a>>2]=-2147483648;V=Je+40|0;s[V>>2]=-1;Y=Je+32|0;s[Y>>2]=0;Z=Je+36|0;s[Z>>2]=0;b=Je+4|0;s[b>>2]=w;X=Je+44|0;s[X>>2]=0;q=Se+i|0;F=te(q,s[ot>>2]|0)|0;ce=Ne()|0;m=u;u=u+((1*(F<<2)|0)+15&-16)|0;F=e+172|0;R=s[ot>>2]|0;M=te(Se,R)|0;Sr(m|0,e+15192+((te((s[F>>2]|0)-Se|0,R)|0)<<2)|0,M<<2|0)|0;C=(s[Pe>>2]|0)==1002;if(C)v=193536;else v=s[de+8>>2]|0;I=e+15112|0;x=s[I>>2]|0;v=v-x|0;v=x+(((v>>16)*983|0)+(((v&65535)*983|0)>>>16))|0;s[I>>2]=v;e:do if((s[Q>>2]|0)==2048){y=v>>8;do if((y|0)<0)v=0;else{if((y|0)>3966){v=2147483647;break}v=v>>15;h=1<>16)<>7;else v=te(h>>7,l+((te(te(l,128-l|0)|0,-174)|0)>>16)|0)|0;v=h+v|0}while(0);S=m+(M<<2)|0;y=e+15120|0;T=((v<<16>>16)*2471|0)/((s[dt>>2]|0)/1e3|0|0)|0;v=te(T,-471)|0;l=v+268435456|0;Q=l>>6;P=l>>22;h=T<<16>>16;kt=te(T>>16,h)|0;h=te(T&65535,h)|0;T=te(T,(T>>15)+1>>1)|0;yt=kt+(h>>>16)+T<<16>>16;x=Q&65535;I=Q<<16>>16;E=+((te(P,yt)|0)+((te(x,yt)|0)>>16)+(te(Q,(kt+(h>>16)+T+-8388608>>15)+1>>1)|0)|0)*3.725290298461914e-9;A=+((te(P,I)|0)+((te(x,I)|0)>>16)+(te(Q,(l>>21)+1>>1)|0)|0)*3.725290298461914e-9;O=+(l|0)*3.725290298461914e-9;N=+(-268435456-v<<1|0)*3.725290298461914e-9;v=e+15124|0;l=0;while(1){if((l|0)>=(i|0))break;yt=te(l,R)|0;gt=+f[t+(yt<<2)>>2];_t=O*gt;vt=+f[y>>2]+_t;f[y>>2]=+f[v>>2]-vt*E+N*gt;f[v>>2]=_t-vt*A+1.0000000031710769e-30;f[S+(yt<<2)>>2]=vt;l=l+1|0}if((R|0)!=2)break;h=t+4|0;T=e+15128|0;v=S+4|0;l=e+15132|0;y=0;while(1){if((y|0)>=(i|0))break e;yt=y<<1;gt=+f[h+(yt<<2)>>2];_t=O*gt;vt=+f[T>>2]+_t;f[T>>2]=+f[l>>2]-vt*E+N*gt;f[l>>2]=_t-vt*A+1.0000000031710769e-30;f[v+(yt<<2)>>2]=vt;y=y+1|0}}else{h=m+(M<<2)|0;T=e+15120|0;D=12/+(s[dt>>2]|0);L=1-D;A=+f[T>>2];S=e+15124|0;E=+f[S>>2];if((R|0)!=2){v=0;while(1){if((v|0)>=(i|0))break;_t=+f[t+(v<<2)>>2];vt=_t-A;f[h+(v<<2)>>2]=vt-E;v=v+1|0;A=D*_t+1.0000000031710769e-30+L*A;E=D*vt+1.0000000031710769e-30+L*E}f[T>>2]=A;f[S>>2]=E;break}v=e+15128|0;l=e+15132|0;y=0;O=+f[v>>2];N=+f[l>>2];while(1){if((y|0)>=(i|0))break;kt=y<<1;mt=+f[t+(kt<<2)>>2];yt=kt|1;_t=+f[t+(yt<<2)>>2];gt=mt-A;vt=_t-O;f[h+(kt<<2)>>2]=gt-E;f[h+(yt<<2)>>2]=vt-N;y=y+1|0;A=D*mt+1.0000000031710769e-30+L*A;E=D*gt+1.0000000031710769e-30+L*E;O=D*_t+1.0000000031710769e-30+L*O;N=D*vt+1.0000000031710769e-30+L*N}f[T>>2]=A;f[S>>2]=E;f[v>>2]=O;f[l>>2]=N}while(0);do if(g|0){v=m+(M<<2)|0;l=te(R,i)|0;y=0;E=0;while(1){if((y|0)>=(l|0))break;vt=+f[v+(y<<2)>>2];y=y+1|0;E=E+vt*vt}if(!(!(E<1e9)|(E!=E|0!=0)))break;yr(v|0,0,l<<2|0)|0;yt=e+15120|0;s[yt>>2]=0;s[yt+4>>2]=0;s[yt+8>>2]=0;s[yt+12>>2]=0}while(0);do if(C){A=1;C=re;ht=353}else{h=te(R,i)|0;I=Ne()|0;x=u;u=u+((1*(h<<1)|0)+15&-16)|0;h=te(c<<3,_)|0;C=s[Pe>>2]|0;P=(C|0)==1001;do if(!P){s[e+36>>2]=h;_=s[e+15168>>2]|0;if(!_){M=h;A=1}else{N=1;ht=275}}else{y=s[at>>2]|0;v=((s[dt>>2]|0)==(i*50|0)?2:1)+(s[j>>2]<<1)|0;l=1;while(1){if((l|0)>=7){ht=268;break}_=s[688+(l*20|0)>>2]|0;if((_|0)>(h|0)){ht=271;break}l=l+1|0}do if((ht|0)==268)if((l|0)==7){_=(s[808+(v<<2)>>2]|0)+((h+-64e3|0)/2|0)|0;break}else{_=s[688+(l*20|0)>>2]|0;ht=271;break}while(0);if((ht|0)==271){kt=l+-1|0;yt=s[688+(kt*20|0)>>2]|0;_=((te(s[688+(kt*20|0)+(v<<2)>>2]|0,_-h|0)|0)+(te(s[688+(l*20|0)+(v<<2)>>2]|0,h-yt|0)|0)|0)/(_-yt|0)|0}v=(y|0)==0?_+100|0:_;v=(U|0)==1104?v+300|0:v;s[e+36>>2]=v;_=s[e+15168>>2]|0;if(_|0){h=v;N=1;ht=275;break}M=v;A=1-+J(+(+(v-h|0)*.0009765625*.6931471805599453))}while(0);do if((ht|0)==275){if(!(s[at>>2]|0)){M=h;A=N;break}if(s[$>>2]|0){M=h;A=N;break}R=s[B>>2]|0;if((R|0)==1101){S=13;O=8e3}else{yt=(R|0)==1102;S=yt?15:17;O=yt?12e3:16e3}l=s[ot>>2]|0;T=0;E=0;while(1){if((T|0)>=(l|0))break;y=T*21|0;M=0;while(1){if((M|0)>=(S|0))break;A=+f[_+(y+M<<2)>>2];v=A<.5;do if(A>-2|v^1){if(v){if(!(A>0))break}else A=.5;A=A*.5}else A=-2;while(0);M=M+1|0;E=E+A}T=T+1|0}yt=~~(O*(E/+(S|0)*+(l|0)+.20000000298023224));v=(te(h,-2)|0)/3|0;v=(yt|0)>(v|0)?yt:v;if((R&-2|0)==1104)_=(v*3|0)/5|0;else _=v;M=h+_|0;s[e+36>>2]=M;yt=te(v,i)|0;A=N;c=c+((yt|0)/(s[dt>>2]<<3|0)|0)|0}while(0);R=s[dt>>2]|0;s[e+32>>2]=(i*1e3|0)/(R|0)|0;l=s[ot>>2]|0;s[e+8>>2]=l;s[e+12>>2]=s[Ie>>2];switch(U|0){case 1101:{s[e+28>>2]=8e3;_=8e3;break}case 1102:{s[e+28>>2]=12e3;_=12e3;break}default:{s[e+28>>2]=16e3;_=16e3}}s[e+24>>2]=P?16e3:8e3;h=e+20|0;s[h>>2]=16e3;do if((C|0)==1e3){if(ie)y=(oe<<4|0)/3|0;else y=ae;if((y|0)>=8e3)break;s[h>>2]=12e3;v=e+28|0;_=_>>>0>12e3?12e3:_;s[v>>2]=_;if((y|0)>=7e3)break;s[h>>2]=8e3;s[v>>2]=(_|0)>8e3?8e3:_}while(0);T=(s[at>>2]|0)==0;s[e+60>>2]=T&1;_=w-se|0;_=(_|0)>1275?1275:_;s[pe>>2]=_;_=_<<3;S=e+64|0;s[S>>2]=_;do if(T){if(!P)break;s[S>>2]=(te(M,i)|0)/(R|0)|0}else{if(!P)break;h=(te(_,R)|0)/(i|0)|0;v=((R|0)==(i*50|0)?2:1)+(s[j>>2]<<1)|0;y=1;while(1){if((y|0)>=7){ht=310;break}_=s[688+(y*20|0)>>2]|0;if((_|0)>(h|0)){ht=313;break}y=y+1|0}do if((ht|0)==310)if((y|0)==7){_=(s[808+(v<<2)>>2]|0)+((h+-64e3|0)/2|0)|0;break}else{_=s[688+(y*20|0)>>2]|0;ht=313;break}while(0);if((ht|0)==313){kt=y+-1|0;yt=s[688+(kt*20|0)>>2]|0;_=((te(s[688+(kt*20|0)+(v<<2)>>2]|0,_-h|0)|0)+(te(s[688+(y*20|0)+(v<<2)>>2]|0,h-yt|0)|0)|0)/(_-yt|0)|0}yt=T?_+100|0:_;s[S>>2]=(te((U|0)==1104?yt+300|0:yt,i)|0)/(R|0)|0}while(0);if(K){s[ue>>2]=0;yt=(R|0)/400|0;v=te(l,(s[F>>2]|0)-(s[e+116>>2]|0)-yt|0)|0;kt=e+15192+(v<<2)|0;y=s[Me>>2]|0;Ds(kt,kt,0,1,s[y+4>>2]|0,yt,l,s[y+60>>2]|0,R);yr(e+15192|0,0,v<<2|0)|0;v=s[F>>2]|0;l=te(v,s[ot>>2]|0)|0;y=0;while(1){if((y|0)>=(l|0))break;E=+f[e+15192+(y<<2)>>2]*32768;do if(E>-32768){if(E<32767)break;E=32767}else E=-32768;while(0);_=(f[d>>2]=E,s[d>>2]|0);do if((_&2130706432)>>>0<=1249902592){_=(_|0)<0;E=_?E+-8388608+8388608:E+8388608+-8388608;if(!(E==0))break;E=_?-0:0}while(0);r[x+(y<<1)>>1]=~~E;y=y+1|0}Ni(de,e+8|0,x,v,0,ue,1)|0;l=s[ot>>2]|0}v=te(l,i)|0;y=0;while(1){if((y|0)>=(v|0))break;E=+f[m+((te(Se,l)|0)+y<<2)>>2]*32768;do if(E>-32768){if(E<32767)break;E=32767}else E=-32768;while(0);_=(f[d>>2]=E,s[d>>2]|0);do if((_&2130706432)>>>0<=1249902592){_=(_|0)<0;E=_?E+-8388608+8388608:E+8388608+-8388608;if(!(E==0))break;E=_?-0:0}while(0);r[x+(y<<1)>>1]=~~E;y=y+1|0}if(!(Ni(de,e+8|0,x,i,Je,pe,0)|0)){if(s[pe>>2]|0){do if((s[Pe>>2]|0)==1e3){_=s[e+80>>2]|0;if((_|0)==8e3){v=1101;break}if((_|0)==12e3){v=1102;break}v=(_|0)==16e3?1103:U}else v=U;while(0);yt=s[e+96>>2]|0;s[e+72>>2]=yt;if(!yt)_=re;else{s[fe>>2]=1;_=0;k=1}He(I|0);C=_;U=v;ht=353;break}s[ut>>2]=0;k=s[Pe>>2]|0;l=s[Ie>>2]|0;_=(s[dt>>2]|0)/(i|0)|0;v=0;while(1){if((_|0)>=400)break;_=_<<1;v=v+1|0}switch(k|0){case 1e3:{_=(U<<5)+96&224|(v<<3)+-16;break}case 1002:{_=((U|0)<1102?0:(U<<5)+64&96)|v<<3|128;break}default:_=U<<4|(v<<3)+240|96}n[o>>0]=_|((l|0)==2&1)<<2;_=1}else _=-3;He(I|0)}while(0);e:do if((ht|0)==353){switch(U|0){case 1101:{_=13;break}case 1103:case 1102:{_=17;break}case 1104:{_=19;break}default:_=21}s[_e>>2]=_;Hs(Xe,10012,_e)|0;s[ve>>2]=s[Ie>>2];Hs(Xe,10008,ve)|0;s[we>>2]=-1;Hs(Xe,4002,we)|0;do if((s[Pe>>2]|0)==1e3){l=s[ot>>2]|0;c=((te(l,s[dt>>2]|0)|0)/400|0)<<2;h=u;u=u+((1*c|0)+15&-16)|0;c=0}else{s[me>>2]=0;Hs(Xe,4006,me)|0;s[ge>>2]=(s[e+76>>2]|0)==0?2:0;Hs(Xe,10002,ge)|0;do if((s[Pe>>2]|0)==1001){_=(s[he>>2]|0)+((ne(s[a>>2]|0)|0)+-32)+7>>3;_=(k|0)==0?_:_+3|0;if(!(s[at>>2]|0)){c=(_|0)>(c|0)?_:c;break}else{s[ke>>2]=(s[xe>>2]|0)-(s[e+36>>2]|0);Hs(Xe,4002,ke)|0;s[ye>>2]=0;Hs(Xe,4020,ye)|0;c=w-se|0;break}}else{if(!(s[at>>2]|0))break;do if((s[be>>2]|0)==5010){_=s[dt>>2]|0;if(((_|0)/50|0|0)==(i|0)){_=0;break}_=te(((s[Ie>>2]|0)*60|0)+40|0,((_|0)/(i|0)|0)+-50|0)|0;if(!(s[ft>>2]|0))break;_=~~(+(_|0)*(+f[ft+4>>2]*.5+1))}else _=0;while(0);s[Ee>>2]=1;Hs(Xe,4006,Ee)|0;s[Ae>>2]=s[e+152>>2];Hs(Xe,4020,Ae)|0;s[Te>>2]=(s[xe>>2]|0)+_;Hs(Xe,4002,Te)|0;c=w-se|0}while(0);_=s[Pe>>2]|0;v=s[ot>>2]|0;l=s[dt>>2]|0;y=(te(v,l)|0)/400|0;h=u;u=u+((1*(y<<2)|0)+15&-16)|0;if((_|0)==1e3){l=v;break}yt=s[Re>>2]|0;if(!((_|0)!=(yt|0)&(yt|0)>0)){l=v;break}Sr(h|0,e+15192+((te((s[F>>2]|0)-Se-((l|0)/400|0)|0,v)|0)<<2)|0,y<<2|0)|0;l=v}while(0);_=s[F>>2]|0;v=e+15192|0;if((te(l,_-q|0)|0)>0){yt=te(l,_-i-Se|0)|0;Mr(v|0,e+15192+((te(l,i)|0)<<2)|0,yt<<2|0)|0;Sr(e+15192+(yt<<2)|0,m|0,(te(q,l)|0)<<2|0)|0}else Sr(v|0,m+((te(q-_|0,l)|0)<<2)|0,(te(_,l)|0)<<2|0)|0;_=e+15116|0;E=+f[_>>2];if(E<1|A<1){yt=s[Me>>2]|0;Ds(m,m,E,A,s[yt+4>>2]|0,i,s[ot>>2]|0,s[yt+60>>2]|0,s[dt>>2]|0)}f[_>>2]=A;M=s[Pe>>2]|0;R=(M|0)==1001;if(!(R?(s[Ie>>2]|0)!=1:0)){if((le|0)>=24e3){_=le+-24e3|0;if((_<<1|0)>16384)_=16384;else ht=381}else{_=0;ht=381}if((ht|0)==381)_=_<<1;s[e+92>>2]=_}do if(!(s[e+15168>>2]|0)){if((s[ot>>2]|0)!=2)break;S=e+15108|0;_=r[S>>1]|0;T=s[e+92>>2]|0;if(!(_<<16>>16<16384|(T|0)<16384))break;y=s[Me>>2]|0;v=s[y+60>>2]|0;l=48e3/(s[dt>>2]|0)|0;y=(s[y+4>>2]|0)/(l|0)|0;E=1-+(_<<16>>16)*6103515625e-14;A=1-+(T|0)*6103515625e-14;_=0;while(1){if((_|0)>=(y|0))break;vt=+f[v+((te(_,l)|0)<<2)>>2];vt=vt*vt;yt=_<<1;kt=m+(yt<<2)|0;gt=+f[kt>>2];yt=m+((yt|1)<<2)|0;_t=+f[yt>>2];vt=(vt*A+(1-vt)*E)*((gt-_t)*.5);f[kt>>2]=gt-vt;f[yt>>2]=_t+vt;_=_+1|0}while(1){if((_|0)>=(i|0))break;yt=_<<1;kt=m+(yt<<2)|0;gt=+f[kt>>2];yt=m+((yt|1)<<2)|0;_t=+f[yt>>2];vt=A*((gt-_t)*.5);f[kt>>2]=gt-vt;f[yt>>2]=_t+vt;_=_+1|0}r[S>>1]=T}while(0);t:do if((M|0)==1002)ht=456;else{v=s[he>>2]|0;_=s[a>>2]|0;l=v+((ne(_|0)|0)+-32)|0;if((l+17+(R?20:0)|0)>((Le<<3)+-8|0)){ht=456;break}i:do if(R){if(!k){if((l+37|0)>(c<<3|0)){ht=456;break t}_=_-(_>>>12)|0}else{yt=_>>>12;s[Y>>2]=(s[Y>>2]|0)+(_-yt);_=yt}s[a>>2]=_;while(1){if(_>>>0>=8388609){l=_;y=v;break i}l=s[Y>>2]|0;y=l>>>23;if((y|0)==255)s[Z>>2]=(s[Z>>2]|0)+1;else{l=l>>>31;_=s[V>>2]|0;if((_|0)>-1){v=s[W>>2]|0;if((v+(s[p>>2]|0)|0)>>>0<(s[b>>2]|0)>>>0){s[W>>2]=v+1;n[(s[Je>>2]|0)+v>>0]=_+l;_=0}else _=-1;s[X>>2]=s[X>>2]|_}_=s[Z>>2]|0;if(_|0){l=l+255&255;do{v=s[W>>2]|0;if((v+(s[p>>2]|0)|0)>>>0<(s[b>>2]|0)>>>0){s[W>>2]=v+1;n[(s[Je>>2]|0)+v>>0]=l;v=0;_=s[Z>>2]|0}else v=-1;s[X>>2]=s[X>>2]|v;_=_+-1|0;s[Z>>2]=_}while((_|0)!=0)}s[V>>2]=y&255;l=s[Y>>2]|0;_=s[a>>2]|0;v=s[he>>2]|0}s[Y>>2]=l<<8&2147483392;_=_<<8;s[a>>2]=_;v=v+8|0;s[he>>2]=v}}else{l=_;y=v}while(0);if(!k){ht=456;break}_=l>>>1;v=l-_|0;if(!C)_=v;else s[Y>>2]=(s[Y>>2]|0)+v;s[a>>2]=_;v=y;while(1){if(_>>>0>=8388609)break;l=s[Y>>2]|0;y=l>>>23;if((y|0)==255)s[Z>>2]=(s[Z>>2]|0)+1;else{l=l>>>31;_=s[V>>2]|0;if((_|0)>-1){v=s[W>>2]|0;if((v+(s[p>>2]|0)|0)>>>0<(s[b>>2]|0)>>>0){s[W>>2]=v+1;n[(s[Je>>2]|0)+v>>0]=_+l;_=0}else _=-1;s[X>>2]=s[X>>2]|_}_=s[Z>>2]|0;if(_|0){l=l+255&255;do{v=s[W>>2]|0;if((v+(s[p>>2]|0)|0)>>>0<(s[b>>2]|0)>>>0){s[W>>2]=v+1;n[(s[Je>>2]|0)+v>>0]=l;v=0;_=s[Z>>2]|0}else v=-1;s[X>>2]=s[X>>2]|v;_=_+-1|0;s[Z>>2]=_}while((_|0)!=0)}s[V>>2]=y&255;l=s[Y>>2]|0;_=s[a>>2]|0;v=s[he>>2]|0}s[Y>>2]=l<<8&2147483392;_=_<<8;s[a>>2]=_;v=v+8|0;s[he>>2]=v}y=(s[Pe>>2]|0)==1001;if(y)l=c;else l=v+((ne(_|0)|0)+-32)+7>>3;yt=w-l|0;l=(s[xe>>2]|0)/1600|0;l=(yt|0)<(l|0)?yt:l;if((l|0)>=2)if((l|0)>257)T=257;else ht=436;else{l=2;ht=436}if((ht|0)==436)T=l;if(!y){S=T;break}l=_>>>8;if((T|0)==2)_=_+(te(l,-255)|0)|0;else{_=_-(te(l,258-T|0)|0)|0;s[Y>>2]=(s[Y>>2]|0)+_;_=l}s[a>>2]=_;while(1){if(_>>>0>=8388609){S=T;break t}l=s[Y>>2]|0;y=l>>>23;if((y|0)==255)s[Z>>2]=(s[Z>>2]|0)+1;else{l=l>>>31;_=s[V>>2]|0;if((_|0)>-1){v=s[W>>2]|0;if((v+(s[p>>2]|0)|0)>>>0<(s[b>>2]|0)>>>0){s[W>>2]=v+1;n[(s[Je>>2]|0)+v>>0]=_+l;_=0}else _=-1;s[X>>2]=s[X>>2]|_}_=s[Z>>2]|0;if(_|0){l=l+255&255;do{v=s[W>>2]|0;if((v+(s[p>>2]|0)|0)>>>0<(s[b>>2]|0)>>>0){s[W>>2]=v+1;n[(s[Je>>2]|0)+v>>0]=l;v=0;_=s[Z>>2]|0}else v=-1;s[X>>2]=s[X>>2]|v;_=_+-1|0;s[Z>>2]=_}while((_|0)!=0)}s[V>>2]=y&255;l=s[Y>>2]|0;_=s[a>>2]|0;v=s[he>>2]|0}s[Y>>2]=l<<8&2147483392;_=_<<8;s[a>>2]=_;v=v+8|0;s[he>>2]=v}}while(0);if((ht|0)==456){s[fe>>2]=0;k=0;S=0}yt=s[Pe>>2]|0;v=(yt|0)==1002?0:17;if((yt|0)==1e3){_=(s[he>>2]|0)+((ne(s[a>>2]|0)|0)+-32)+7>>3;ui(Je);y=_}else{y=w-S|0;y=(y|0)<(c|0)?y:c;kt=s[Je>>2]|0;_=s[p>>2]|0;yt=0-_|0;Mr(kt+y+yt|0,kt+(s[b>>2]|0)+yt|0,_|0)|0;s[b>>2]=y;_=0}l=(k|0)==0;if(l?(s[Pe>>2]|0)==1e3:0)ht=464;else ht=462;do if((ht|0)==462){s[Ue>>2]=ft;Hs(Xe,10022,Ue)|0;if((s[Pe>>2]|0)!=1001){ht=464;break}s[De>>2]=s[e+100>>2];s[De+4>>2]=s[e+104>>2];s[Be>>2]=De;Hs(Xe,10028,Be)|0}while(0);if((ht|0)==464){s[je>>2]=0;Hs(Xe,10028,je)|0}if(!(l|(C|0)==0)){s[Fe>>2]=0;Hs(Xe,10010,Fe)|0;s[Ge>>2]=0;Hs(Xe,4006,Ge)|0;s[ze>>2]=-1;Hs(Xe,4002,ze)|0;if((Jt(Xe,m,(s[dt>>2]|0)/200|0,ee+y|0,S,0)|0)<0){_=-3;break}s[qe>>2]=lt;Hs(Xe,4031,qe)|0;Hs(Xe,4028,We)|0}s[ct>>2]=v;Hs(Xe,10010,ct)|0;v=s[Pe>>2]|0;do if((v|0)==1e3)ht=482;else{yt=s[Re>>2]|0;if((v|0)!=(yt|0)&(yt|0)>0){Hs(Xe,4028,Ye)|0;Jt(Xe,h,(s[dt>>2]|0)/400|0,Ve,2,0)|0;s[Ze>>2]=0;Hs(Xe,10002,Ze)|0}if(((s[he>>2]|0)+((ne(s[a>>2]|0)|0)+-32)|0)>(y<<3|0)){ht=482;break}do if(!(l|(C|0)==0)){if((s[Pe>>2]|0)!=1001)break;if(!(s[at>>2]|0))break;s[$e>>2]=(s[xe>>2]|0)-(s[e+36>>2]|0);Hs(Xe,4002,$e)|0}while(0);s[Ke>>2]=s[at>>2];Hs(Xe,4006,Ke)|0;_=Jt(Xe,m,i,0,y,Je)|0;if((_|0)<0){_=-3;break e}if(l){k=0;ht=488;break}if(!C){v=y;ht=484;break}v=s[Pe>>2]|0;if((v|0)!=1001){T=k;break}if(!(s[at>>2]|0)){ht=488;break}Sr(ee+_|0,ee+y|0,S|0)|0;ht=488}while(0);do if((ht|0)==482){if(l){k=0;ht=488;break}else v=y;if(!C)ht=484;else ht=488}while(0);if((ht|0)==484){y=s[dt>>2]|0;l=(y|0)/200|0;y=(y|0)/400|0;Hs(Xe,4028,Qe)|0;s[et>>2]=0;Hs(Xe,10010,et)|0;s[tt>>2]=0;Hs(Xe,10002,tt)|0;s[it>>2]=0;Hs(Xe,4006,it)|0;s[nt>>2]=-1;Hs(Xe,4002,nt)|0;if((s[Pe>>2]|0)==1001){kt=s[Je>>2]|0;v=s[p>>2]|0;yt=0-v|0;Mr(kt+_+yt|0,kt+(s[b>>2]|0)+yt|0,v|0)|0;s[b>>2]=_;v=_}yt=i-l|0;Jt(Xe,m+((te(s[ot>>2]|0,yt-y|0)|0)<<2)|0,y,rt,2,0)|0;if((Jt(Xe,m+((te(s[ot>>2]|0,yt)|0)<<2)|0,l,ee+v|0,S,0)|0)<0){_=-3;break}s[st>>2]=lt;Hs(Xe,4031,st)|0;ht=488}if((ht|0)==488){v=s[Pe>>2]|0;T=k}y=s[Ie>>2]|0;k=(s[dt>>2]|0)/(i|0)|0;l=0;while(1){if((k|0)>=400)break;k=k<<1;l=l+1|0}switch(v|0){case 1e3:{v=(U<<5)+96&224|(l<<3)+-16;break}case 1002:{v=((U|0)<1102?0:(U<<5)+64&96)|l<<3|128;break}default:v=U<<4|(l<<3)+240|96}n[o>>0]=v|((y|0)==2&1)<<2;c=s[a>>2]|0;s[ut>>2]=c^s[lt>>2];if(!Ce)v=s[Pe>>2]|0;else v=1002;s[Re>>2]=v;h=s[Ie>>2]|0;s[e+15144>>2]=h;s[e+15148>>2]=i;s[e+15164>>2]=0;t:do if(s[e+184>>2]|0){do if(!(s[ft>>2]|0)){if(!Oe)break t;v=e+19036|0}else{v=e+19036|0;A=+f[e+19040>>2];if(Oe|0)break;y=+f[ft+28>>2]<.10000000149011612;if(y){k=te(s[ot>>2]|0,i)|0;l=0;E=0;while(1){if((l|0)>=(k|0))break;vt=+f[t+(l<<2)>>2];l=l+1|0;E=E+vt*vt}if(!((E/+(k|0)*316.2300109863281<=A|0)==0|y^1))break}s[v>>2]=0;break t}while(0);yt=s[v>>2]|0;k=yt+1|0;s[v>>2]=k;if((yt|0)<=9)break;if((k|0)>=31){s[v>>2]=10;break}s[ut>>2]=0;k=s[Pe>>2]|0;_=(s[dt>>2]|0)/(i|0)|0;v=0;while(1){if((_|0)>=400)break;_=_<<1;v=v+1|0}switch(k|0){case 1e3:{_=(U<<5)+96&224|(v<<3)+-16;break}case 1002:{_=((U|0)<1102?0:(U<<5)+64&96)|v<<3|128;break}default:_=U<<4|(v<<3)+240|96}n[o>>0]=_|((h|0)==2&1)<<2;_=1;break e}while(0);t:do if(((s[he>>2]|0)+((ne(c|0)|0)+-32)|0)>((Le<<3)+-8|0)){if((Le|0)<2){_=-2;break e}n[ee>>0]=0;s[ut>>2]=0;_=1}else{if(!((s[Pe>>2]|0)==1e3&(T|0)==0))break;while(1){if((_|0)<=2)break t;if(n[o+_>>0]|0)break t;_=_+-1|0}}while(0);_=_+(S+1)|0;t:do if(!(s[at>>2]|0)){i:do if((_|0)>=1){do if((_|0)!=(Le|0)){if((_|0)>(Le|0))break i;v=ct+4|0;s[v>>2]=0;yt=o+Le+(0-_)|0;Mr(yt|0,o|0,_|0)|0;if(js(ct,yt,_)|0)break i;_=Fs(ct,s[v>>2]|0,o,Le,1)|0;if((_|0)>0)break;if(!_){_=Le;break t}else{_=-3;break e}}while(0);_=Le;break t}while(0);_=-3;break e}while(0)}while(0);He(ce|0);yt=_;u=pt;return yt|0}while(0);k=s[e+15136>>2]|0;v=s[e+15152>>2]|0;v=(v|0)==0?1101:v;k=(k|0)==0?1e3:k;e:do if((_|0)>100)ht=63;else{if((_|0)<50|(k|0)==1e3)if((v|0)>1103){v=1103;y=1e3;break}else{k=1e3;ht=64;break}switch(k|0){case 1002:{ht=63;break e}case 1001:break;default:{y=k;break e}}v=(v|0)>1104?v:1104;y=1001}while(0);if((ht|0)==63)if((v|0)==1102){v=1101;y=1002}else{k=1002;ht=64}if((ht|0)==64)y=k;l=s[e+15104>>2]|0;k=0;while(1){if((_|0)>=400)break;_=_<<1;k=k+1|0}switch(y|0){case 1e3:{_=(v<<5)+96&224|(k<<3)+-16;break}case 1002:{_=((v|0)<1102?0:(v<<5)+64&96)|k<<3|128;break}default:_=v<<4|(k<<3)+240|96}_=(_|((l|0)==2&1)<<2)&255;n[o>>0]=_;if(s[at>>2]|0){yt=1;u=pt;return yt|0}do if((Le|0)==1)ht=78;else{if((Le|0)>=1){v=C+4|0;s[v>>2]=0;yt=o+Le+-1|0;n[yt>>0]=_;_=js(C,yt,1)|0;if(!_){_=Fs(C,s[v>>2]|0,o,Le,1)|0;if((_|0)>0){ht=78;break}if(!_)break;u=pt;return _|0}}else _=-1;yt=_;u=pt;return yt|0}while(0);yt=Le;u=pt;return yt|0}function Ds(e,t,i,n,r,s,o,a,l){e=e|0;t=t|0;i=+i;n=+n;r=r|0;s=s|0;o=o|0;a=a|0;l=l|0;var h=0,u=0,c=0;h=48e3/(l|0)|0;u=(r|0)/(h|0)|0;e:do if((o|0)==1){l=0;while(1){if((l|0)>=(u|0)){l=0;break e}c=+f[a+((te(l,h)|0)<<2)>>2];c=c*c;f[t+(l<<2)>>2]=(c*n+(1-c)*i)*+f[e+(l<<2)>>2];l=l+1|0}}else{l=0;while(1){if((l|0)>=(u|0)){l=0;break e}c=+f[a+((te(l,h)|0)<<2)>>2];c=c*c;c=c*n+(1-c)*i;r=l<<1;f[t+(r<<2)>>2]=c*+f[e+(r<<2)>>2];r=r|1;f[t+(r<<2)>>2]=c*+f[e+(r<<2)>>2];l=l+1|0}}while(0);do{r=u;while(1){if((r|0)>=(s|0))break;a=(te(r,o)|0)+l|0;f[t+(a<<2)>>2]=+f[e+(a<<2)>>2]*n;r=r+1|0}l=l+1|0}while((l|0)<(o|0));return}function Ls(e,t,i,n){e=e|0;t=t|0;i=i|0;n=n|0;var o=0,a=0,l=0,h=0,c=0,d=0,p=0,b=0;b=u;if((s[e+108>>2]|0)==2051)o=0;else o=s[e+116>>2]|0;l=s[e+156>>2]|0;p=e+112|0;h=s[e+144>>2]|0;a=(l|0)==5010;e:do if(((h|0)/200|0|0)>(i|0)|a^1){o=(h|0)/400|0;if((o|0)<=(i|0)){if((l|0)!=5e3){if(a)o=(h|0)/50|0;else{if((l+-5001|0)>>>0>=6){c=-1;break}c=(h*3|0)/50|0;o=o<(i|0)){c=-1;break}}else o=i;if(!((o*400|0)==(h|0)|(o*200|0)==(h|0)|(o*100|0)==(h|0))?(c=o*50|0,!((c|0)==(h|0)|(o*25|0)==(h|0)|(c|0)==(h*3|0))):0)c=-1;else d=16}else c=-1}else{l=(h|0)/400|0;a=Os(t,i,s[p>>2]|0,h,s[e+160>>2]|0,e+7060|0,o,1)|0;while(1){o=l<-1?o:-1;o=s[p>>2]|0;a=te(c,o)|0;l=u;u=u+((1*(a<<2)|0)+15&-16)|0;h=0;while(1){if((h|0)>=(a|0))break;f[l+(h<<2)>>2]=+(r[t+(h<<1)>>1]|0)*30517578125e-15;h=h+1|0}e=Ns(e,l,c,n,3828,16,t,i,0,-2,o,1,0)|0;u=b;return e|0}function Us(e,t,i){e=e|0;t=t|0;i=i|0;var n=0,o=0,a=0,l=0,h=0,c=0,d=0,p=0,b=0,w=0;w=u;u=u+80|0;l=w+48|0;o=w+40|0;n=w+32|0;d=w+24|0;c=w+16|0;h=w+8|0;a=w;b=w+56|0;s[b>>2]=i;p=e+(s[e>>2]|0)|0;e:do switch(t|0){case 4e3:{p=(s[b>>2]|0)+(4-1)&~(4-1);t=s[p>>2]|0;s[b>>2]=p+4;switch(t|0){case 2051:case 2049:case 2048:break;default:{i=-1;t=108;break e}}i=e+108|0;if((s[e+15164>>2]|0)==0?(s[i>>2]|0)!=(t|0):0){i=-1;t=108;break e}s[i>>2]=t;i=0;t=108;break}case 4001:{p=(s[b>>2]|0)+(4-1)&~(4-1);i=s[p>>2]|0;s[b>>2]=p+4;if(!i)t=109;else{s[i>>2]=s[e+108>>2];i=0;t=108}break}case 4002:{p=(s[b>>2]|0)+(4-1)&~(4-1);i=s[p>>2]|0;s[b>>2]=p+4;if((i|0)!=-1e3)if((i|0)!=-1){if((i|0)<1){t=109;break e}if((i|0)<501)i=500;else{b=(s[e+112>>2]|0)*3e5|0;i=(i|0)>(b|0)?b:i}}else i=-1;else i=-1e3;s[e+164>>2]=i;i=0;t=108;break}case 4003:{p=(s[b>>2]|0)+(4-1)&~(4-1);n=s[p>>2]|0;s[b>>2]=p+4;if(!n)t=109;else{i=s[e+15148>>2]|0;if(!i)t=(s[e+144>>2]|0)/400|0;else t=i;i=s[e+164>>2]|0;switch(i|0){case-1e3:{i=s[e+144>>2]|0;i=((i*60|0)/(t|0)|0)+(te(i,s[e+112>>2]|0)|0)|0;break}case-1:{i=((s[e+144>>2]|0)*10208|0)/(t|0)|0;break}default:{}}s[n>>2]=i;i=0;t=108}break}case 4022:{p=(s[b>>2]|0)+(4-1)&~(4-1);i=s[p>>2]|0;s[b>>2]=p+4;if((i|0)<1){if((i|0)!=-1e3){t=109;break e}}else if((i|0)>(s[e+112>>2]|0)){t=109;break e}s[e+120>>2]=i;i=0;t=108;break}case 4023:{p=(s[b>>2]|0)+(4-1)&~(4-1);i=s[p>>2]|0;s[b>>2]=p+4;if(!i)t=109;else{s[i>>2]=s[e+120>>2];i=0;t=108}break}case 4004:{p=(s[b>>2]|0)+(4-1)&~(4-1);i=s[p>>2]|0;s[b>>2]=p+4;if((i+-1101|0)>>>0>4)t=109;else{s[e+132>>2]=i;switch(i|0){case 1101:{s[e+20>>2]=8e3;i=0;t=108;break e}case 1102:{s[e+20>>2]=12e3;i=0;t=108;break e}default:{s[e+20>>2]=16e3;i=0;t=108;break e}}}break}case 4005:{p=(s[b>>2]|0)+(4-1)&~(4-1);i=s[p>>2]|0;s[b>>2]=p+4;if(!i)t=109;else{s[i>>2]=s[e+132>>2];i=0;t=108}break}case 4008:{p=(s[b>>2]|0)+(4-1)&~(4-1);i=s[p>>2]|0;s[b>>2]=p+4;if((i|0)>=1101){if((i|0)>1105){t=109;break e}s[e+128>>2]=i;if((i|0)==1101){s[e+20>>2]=8e3;i=0;t=108;break e}else t=i;i=e+20|0;if((t|0)==1102){s[i>>2]=12e3;i=0;t=108;break e}}else{if((i|0)!=-1e3){t=109;break e}s[e+128>>2]=-1e3;i=e+20|0}s[i>>2]=16e3;i=0;t=108;break}case 4009:{p=(s[b>>2]|0)+(4-1)&~(4-1);i=s[p>>2]|0;s[b>>2]=p+4;if(!i)t=109;else{s[i>>2]=s[e+15152>>2];i=0;t=108}break}case 4016:{p=(s[b>>2]|0)+(4-1)&~(4-1);i=s[p>>2]|0;s[b>>2]=p+4;if(i>>>0>1)t=109;else{s[e+184>>2]=i;i=0;t=108}break}case 4017:{p=(s[b>>2]|0)+(4-1)&~(4-1);i=s[p>>2]|0;s[b>>2]=p+4;if(!i)t=109;else{s[i>>2]=s[e+184>>2];i=0;t=108}break}case 4010:{d=(s[b>>2]|0)+(4-1)&~(4-1);i=s[d>>2]|0;s[b>>2]=d+4;if(i>>>0>10)t=109;else{s[e+44>>2]=i;s[a>>2]=i;Hs(p,4010,a)|0;i=0;t=108}break}case 4011:{p=(s[b>>2]|0)+(4-1)&~(4-1);i=s[p>>2]|0;s[b>>2]=p+4;if(!i)t=109;else{s[i>>2]=s[e+44>>2];i=0;t=108}break}case 4012:{p=(s[b>>2]|0)+(4-1)&~(4-1);i=s[p>>2]|0;s[b>>2]=p+4;if(i>>>0>1)t=109;else{s[e+48>>2]=i;i=0;t=108}break}case 4013:{p=(s[b>>2]|0)+(4-1)&~(4-1);i=s[p>>2]|0;s[b>>2]=p+4;if(!i)t=109;else{s[i>>2]=s[e+48>>2];i=0;t=108}break}case 4014:{d=(s[b>>2]|0)+(4-1)&~(4-1);i=s[d>>2]|0;s[b>>2]=d+4;if(i>>>0>100)t=109;else{s[e+40>>2]=i;s[h>>2]=i;Hs(p,4014,h)|0;i=0;t=108}break}case 4015:{p=(s[b>>2]|0)+(4-1)&~(4-1);i=s[p>>2]|0;s[b>>2]=p+4;if(!i)t=109;else{s[i>>2]=s[e+40>>2];i=0;t=108}break}case 4006:{p=(s[b>>2]|0)+(4-1)&~(4-1);i=s[p>>2]|0;s[b>>2]=p+4;if(i>>>0>1)t=109;else{s[e+148>>2]=i;s[e+60>>2]=1-i;i=0;t=108}break}case 4007:{p=(s[b>>2]|0)+(4-1)&~(4-1);i=s[p>>2]|0;s[b>>2]=p+4;if(!i)t=109;else{s[i>>2]=s[e+148>>2];i=0;t=108}break}case 11018:{p=(s[b>>2]|0)+(4-1)&~(4-1);i=s[p>>2]|0;s[b>>2]=p+4;if((i+1|0)>>>0>101)t=109;else{s[e+140>>2]=i;i=0;t=108}break}case 11019:{p=(s[b>>2]|0)+(4-1)&~(4-1);i=s[p>>2]|0;s[b>>2]=p+4;if(!i)t=109;else{s[i>>2]=s[e+140>>2];i=0;t=108}break}case 4020:{p=(s[b>>2]|0)+(4-1)&~(4-1);i=s[p>>2]|0;s[b>>2]=p+4;if(i>>>0>1)t=109;else{s[e+152>>2]=i;i=0;t=108}break}case 4021:{p=(s[b>>2]|0)+(4-1)&~(4-1);i=s[p>>2]|0;s[b>>2]=p+4;if(!i)t=109;else{s[i>>2]=s[e+152>>2];i=0;t=108}break}case 4024:{p=(s[b>>2]|0)+(4-1)&~(4-1);i=s[p>>2]|0;s[b>>2]=p+4;if((i|0)<3001)switch(i|0){case-1e3:break;default:{t=109;break e}}else switch(i|0){case 3002:case 3001:break;default:{t=109;break e}}s[e+124>>2]=i;i=0;t=108;break}case 4025:{p=(s[b>>2]|0)+(4-1)&~(4-1);i=s[p>>2]|0;s[b>>2]=p+4;if(!i)t=109;else{s[i>>2]=s[e+124>>2];i=0;t=108}break}case 4027:{p=(s[b>>2]|0)+(4-1)&~(4-1);t=s[p>>2]|0;s[b>>2]=p+4;if(t){i=(s[e+144>>2]|0)/400|0;s[t>>2]=i;if((s[e+108>>2]|0)==2051){i=0;t=108}else{s[t>>2]=i+(s[e+116>>2]|0);i=0;t=108}}else t=109;break}case 4029:{p=(s[b>>2]|0)+(4-1)&~(4-1);i=s[p>>2]|0;s[b>>2]=p+4;if(!i)t=109;else{s[i>>2]=s[e+144>>2];i=0;t=108}break}case 4031:{p=(s[b>>2]|0)+(4-1)&~(4-1);i=s[p>>2]|0;s[b>>2]=p+4;if(!i)t=109;else{s[i>>2]=s[e+19044>>2];i=0;t=108}break}case 4036:{p=(s[b>>2]|0)+(4-1)&~(4-1);i=s[p>>2]|0;s[b>>2]=p+4;if((i+-8|0)>>>0>16)t=109;else{s[e+168>>2]=i;i=0;t=108}break}case 4037:{p=(s[b>>2]|0)+(4-1)&~(4-1);i=s[p>>2]|0;s[b>>2]=p+4;if(!i)t=109;else{s[i>>2]=s[e+168>>2];i=0;t=108}break}case 4040:{d=(s[b>>2]|0)+(4-1)&~(4-1);i=s[d>>2]|0;s[b>>2]=d+4;switch(i|0){case 5010:case 5006:case 5005:case 5004:case 5003:case 5002:case 5001:case 5e3:break;default:{t=109;break e}}s[e+156>>2]=i;s[c>>2]=i;Hs(p,4040,c)|0;i=0;t=108;break}case 4041:{p=(s[b>>2]|0)+(4-1)&~(4-1);i=s[p>>2]|0;s[b>>2]=p+4;if(!i)t=109;else{s[i>>2]=s[e+156>>2];i=0;t=108}break}case 4042:{p=(s[b>>2]|0)+(4-1)&~(4-1);i=s[p>>2]|0;s[b>>2]=p+4;if(i>>>0>1)t=109;else{s[e+76>>2]=i;i=0;t=108}break}case 4043:{p=(s[b>>2]|0)+(4-1)&~(4-1);i=s[p>>2]|0;s[b>>2]=p+4;if(!i)t=109;else{s[i>>2]=s[e+76>>2];i=0;t=108}break}case 4028:{n=e+(s[e+4>>2]|0)|0;o=e+15104|0;yr(e+192|0,0,18856)|0;Hs(p,4028,d)|0;i=s[e+180>>2]|0;yr(n|0,0,20400)|0;t=0;while(1){if((t|0)==2)break;Fi(n+(t*10156|0)|0,i)|0;t=t+1|0}s[n+20376>>2]=1;s[n+20380>>2]=1;s[o>>2]=s[e+112>>2];r[e+15108>>1]=16384;f[e+15116>>2]=1;s[e+15164>>2]=1;s[e+15136>>2]=1001;s[e+15152>>2]=1105;s[e+15112>>2]=193536;i=0;t=108;break}case 11002:{p=(s[b>>2]|0)+(4-1)&~(4-1);i=s[p>>2]|0;s[b>>2]=p+4;if((i|0)<1e3){if((i|0)!=-1e3){t=109;break e}}else if((i|0)>1002){t=109;break e}s[e+136>>2]=i;i=0;t=108;break}case 10024:{t=(s[b>>2]|0)+(4-1)&~(4-1);i=s[t>>2]|0;s[b>>2]=t+4;s[e+176>>2]=i;s[n>>2]=i;i=Hs(p,10024,n)|0;t=108;break}case 10026:{t=(s[b>>2]|0)+(4-1)&~(4-1);i=s[t>>2]|0;s[b>>2]=t+4;s[e+15168>>2]=i;s[o>>2]=i;i=Hs(p,10026,o)|0;t=108;break}case 10015:{e=(s[b>>2]|0)+(4-1)&~(4-1);i=s[e>>2]|0;s[b>>2]=e+4;if(!i)t=109;else{s[l>>2]=i;i=Hs(p,10015,l)|0;t=108}break}default:{i=-5;t=108}}while(0);if((t|0)==108){e=i;u=w;return e|0}else if((t|0)==109){e=-1;u=w;return e|0}return 0}function Bs(e){e=e|0;qn(e);return}function js(e,t,i){e=e|0;t=t|0;i=i|0;var r=0,a=0,l=0,f=0,h=0,c=0;c=u;u=u+16|0;f=c;if((i|0)<1){h=-4;u=c;return h|0}h=e+4|0;l=s[h>>2]|0;e:do if(l){if(((n[e>>0]^n[t>>0])&255)>=4){h=-4;u=c;return h|0}}else{n[e>>0]=n[t>>0]|0;r=n[t>>0]|0;do if(r<<24>>24>=0)if((r&96)==96){if(r&8){r=160;break}s[e+296>>2]=80;break e}else{r=(r&255)>>>3&3;if((r|0)==3){r=480;break}s[e+296>>2]=(8e3<>>0)/100|0;break e}else r=(8e3<<((r&255)>>>3&3)>>>0)/400|0;while(0);s[e+296>>2]=r}while(0);r=(o[t>>0]|0)&3;if(r)if((r|0)==3){if((i|0)<2){h=-4;u=c;return h|0}r=(o[t+1>>0]|0)&63;if(!r){h=-4;u=c;return h|0}else a=r}else a=2;else a=1;if((te(a+l|0,s[e+296>>2]|0)|0)>960){h=-4;u=c;return h|0}r=rn(t,i,0,f,e+8+(l<<2)|0,e+200+(l<<1)|0,0,0)|0;if((r|0)<1){h=r;u=c;return h|0}s[h>>2]=(s[h>>2]|0)+a;h=0;u=c;return h|0}function Fs(e,t,i,a,l){e=e|0;t=t|0;i=i|0;a=a|0;l=l|0;var f=0,h=0,u=0,c=0,d=0,p=0,b=0;if((t|0)<1){e=-1;return e|0}if((s[e+4>>2]|0)<(t|0)){e=-1;return e|0}p=e+200|0;e:do switch(t|0){case 1:{f=r[p>>1]|0;if((f|0)<(a|0)){n[i>>0]=o[e>>0]&252;h=i+1|0;f=f+1|0;d=14;break e}else{e=-2;return e|0}}case 2:{f=r[e+202>>1]|0;h=r[p>>1]|0;if(f<<16>>16==h<<16>>16){f=f<<16>>16<<1|1;if((f|0)>(a|0)){e=-2;return e|0}else{n[i>>0]=o[e>>0]&252|1;h=i+1|0;d=14;break e}}f=(h<<16>>16)+(f<<16>>16)+2+(h<<16>>16>251&1)|0;if((f|0)>(a|0)){e=-2;return e|0}c=i+1|0;n[i>>0]=o[e>>0]&252|2;h=r[p>>1]|0;u=h<<16>>16;if(h<<16>>16<252){n[c>>0]=h;h=1}else{h=u|252;n[c>>0]=h;n[i+2>>0]=(u-(h&255)|0)>>>2;h=2}h=c+h|0;d=14;break}default:{f=1;d=15}}while(0);if((d|0)==14)if((l|0)!=0&(f|0)<(a|0)){f=1;d=15}e:do if((d|0)==15){while(1){if((f|0)>=(t|0)){d=23;break}if((r[e+200+(f<<1)>>1]|0)!=(r[p>>1]|0)){d=17;break}f=f+1|0;d=15}do if((d|0)==17){f=t+-1|0;h=0;u=2;while(1){if((h|0)>=(f|0))break;p=r[e+200+(h<<1)>>1]|0;h=h+1|0;u=u+((p<<16>>16>251?2:1)+(p<<16>>16))|0}f=u+(r[e+200+(f<<1)>>1]|0)|0;if((f|0)>(a|0)){e=-2;return e|0}else{n[i>>0]=o[e>>0]|3;u=t|128;n[i+1>>0]=u;c=1;break}}else if((d|0)==23){f=(te(r[p>>1]|0,t)|0)+2|0;if((f|0)>(a|0)){e=-2;return e|0}else{n[i>>0]=o[e>>0]|3;n[i+1>>0]=t;u=t;c=0;break}}while(0);h=i+2|0;if((l|0)!=0?(b=a-f|0,(f|0)!=(a|0)):0){n[i+1>>0]=u|64;f=(b+-1|0)/255|0;u=0;while(1){if((u|0)>=(f|0))break;n[h>>0]=-1;u=u+1|0;h=h+1|0}n[h>>0]=b+(te(f,-255)|0)+255;h=h+1|0;f=a}if(c){d=t+-1|0;p=0;while(1){if((p|0)>=(d|0))break e;u=r[e+200+(p<<1)>>1]|0;c=u<<16>>16;if(u<<16>>16<252){n[h>>0]=u;u=1}else{u=c|252;n[h>>0]=u;n[h+1>>0]=(c-(u&255)|0)>>>2;u=2}p=p+1|0;h=h+u|0}}}while(0);u=0;while(1){if((u|0)>=(t|0))break;b=e+200+(u<<1)|0;Mr(h|0,s[e+8+(u<<2)>>2]|0,r[b>>1]|0)|0;u=u+1|0;h=h+(r[b>>1]|0)|0}if(!l){e=f;return e|0}u=i+a|0;while(1){if(h>>>0>=u>>>0)break;n[h>>0]=0;h=h+1|0}return f|0}function Gs(e,t,i,n,o,a,l,h,c,d,p,b){e=e|0;t=t|0;i=i|0;n=n|0;o=o|0;a=a|0;l=l|0;h=h|0;c=c|0;d=d|0;p=p|0;b=b|0;var w=0,m=0,g=0,_=0,v=0,k=0,y=0,E=0,A=0,T=0,S=0,M=0,R=0,C=0,P=0,x=0,I=0,O=0,N=0,D=0,L=0,U=0,B=0,j=0,F=0,W=0,V=0,Y=0,Z=0,$=0,K=0,X=0,J=0,ee=0,te=0,ie=0,ne=0,re=0,se=0,oe=0,ae=0,le=0,fe=0,he=0,ue=0,ce=0,de=0,pe=0,be=0,we=0,me=0,ge=0,_e=0,ve=0,ke=0,ye=0,Ee=0,Ae=0,Te=0,Se=0,Me=0,Re=0,Ce=0,Pe=0,xe=0,Ie=0,Oe=0,Ne=0,De=0,Le=0,Ue=0,Be=0;Le=u;u=u+10288|0;Ce=Le+9888|0;Se=Le+9816|0;xe=Le+9744|0;Te=Le+9712|0;Me=Le+9608|0;Re=Le+9600|0;Pe=Le+5760|0;Oe=Le+1920|0;Ne=Le+960|0;Ie=Le;if(!i)c=e+8504|0;else{ve=(c*195|0)/100|0;ve=(ve|0)<(n|0)?ve:n;ke=e+6884|0;W=s[ke>>2]|0;ye=e+6864|0;Ee=e+6868|0;Ae=e+6844|0;V=t+72|0;Y=e+5764|0;c=e+8504|0;Z=e+2884|0;$=e+4804|0;K=e+3844|0;X=e+6856|0;J=(d|0)<8;ee=e+6848|0;te=e+6852|0;ie=e+5840|0;ne=Me+80|0;re=Me+84|0;se=Me+88|0;oe=Me+92|0;ae=Me+96|0;le=Re+4|0;fe=e+6888|0;he=e+7688|0;ue=e+6892|0;ce=e+7692|0;de=e+7684|0;pe=e+8484|0;be=e+8500|0;we=e+8492|0;me=e+8496|0;ge=e+8488|0;_e=e+6860|0;B=d+-8|0;F=W;W=ve-W|0;while(1){j=(W|0)>480;m=j?480:W;s[ye>>2]=(s[ye>>2]|0)+1;n=s[Ee>>2]|0;D=(n|0)>19?.05000000074505806:1/+(n+1|0);U=n+1|0;N=(n|0)>49?.019999999552965164:1/+(U|0);T=(n|0)>999;I=1/+(U|0);if((n|0)<4){f[Ae>>2]=.5;t=s[V>>2]|0;if(!n){s[Y>>2]=240;d=240;n=t}else{n=t;De=7}}else{n=s[V>>2]|0;De=7}if((De|0)==7){De=0;d=s[Y>>2]|0}t=720-d|0;Zs[p&1](i,e+2884+(d<<2)|0,(t|0)>(m|0)?m:t,F,a,l,h); -d=s[Y>>2]|0;t=d+m|0;do if((t|0)<720)s[Y>>2]=t;else{L=s[c>>2]|0;U=e+8516+(L<<5)|0;s[c>>2]=L+((L|0)>198?-199:1);t=0;while(1){if((t|0)==240)break;x=+f[828+(t<<2)>>2];f[Pe+(t<<3)>>2]=x*+f[e+2884+(t<<2)>>2];f[Pe+(t<<3)+4>>2]=x*+f[e+2884+(t+240<<2)>>2];O=480-t+-1|0;f[Pe+(O<<3)>>2]=x*+f[e+2884+(O<<2)>>2];f[Pe+(O<<3)+4>>2]=x*+f[e+2884+(720-t+-1<<2)>>2];t=t+1|0}Sr(Z|0,$|0,960)|0;t=d+-720+m|0;Zs[p&1](i,K,t,F+720-d|0,a,l,h);s[Y>>2]=t+240;w=+f[n+4>>2];t=n+44|0;d=0;while(1){if((d|0)>=(s[n>>2]|0))break;x=+f[Pe+(d<<3)+4>>2];f[Oe+(r[(s[t>>2]|0)+(d<<1)>>1]<<3)>>2]=w*+f[Pe+(d<<3)>>2];f[Oe+(r[(s[t>>2]|0)+(d<<1)>>1]<<3)+4>>2]=w*x;d=d+1|0}ci(n,Oe);x=+f[Oe>>2];if(x!=x|0!=0){s[U>>2]=0;break}else d=1;while(1){if((d|0)==240)break;E=+f[Oe+(d<<3)>>2];O=480-d|0;_=+f[Oe+(O<<3)>>2];w=E+_;v=+f[Oe+(d<<3)+4>>2];y=+f[Oe+(O<<3)+4>>2];g=v-y;y=v+y;E=_-E;_=w*w;v=g*g;do if(!(_+v<1.000000045813705e-18))if(_>2];t=e+964+(d<<2)|0;k=v-+f[t>>2];w=y*y;g=E*E;do if(!(w+g<1.000000045813705e-18))if(w>2]=+H(+M)+ +H(+x);x=x*x;x=x*x;O=e+1924+(d<<2)|0;f[Ne+(d<<2)>>2]=1/((+f[O>>2]+R*R*2+x)*.25*62341.81640625+1)+-.014999999664723873;f[n>>2]=C;f[t>>2]=P;f[O>>2]=x;d=d+1|0}O=e+8516+(L<<5)+16|0;f[O>>2]=0;e:do if(!(s[Ee>>2]|0)){n=0;while(1){if((n|0)==18){m=0;M=0;E=0;R=0;w=0;C=0;P=0;x=0;break e}f[e+6420+(n<<2)>>2]=1e10;f[e+6492+(n<<2)>>2]=-1e10;n=n+1|0}}else{m=0;M=0;E=0;R=0;w=0;C=0;P=0;x=0}while(0);while(1){if((m|0)>=18)break;d=m+1|0;n=s[1788+(d<<2)>>2]|0;_=0;t=s[1788+(m<<2)>>2]|0;g=0;A=0;while(1){if((t|0)>=(n|0))break;Ue=+f[Oe+(t<<3)>>2];S=480-t|0;y=+f[Oe+(S<<3)>>2];k=+f[Oe+(t<<3)+4>>2];v=+f[Oe+(S<<3)+4>>2];v=Ue*Ue+y*y+k*k+v*v;k=g+v*2*(.5-+f[Ie+(t<<2)>>2]);y=A+v*+f[Ne+(t<<2)>>2];_=_+v;t=t+1|0;g=k;A=y}if(!(_<1e9)|(_!=_|0!=0)){De=37;break}f[e+5844+((s[X>>2]|0)*72|0)+(m<<2)>>2]=_;k=_+1.0000000036274937e-15;E=E+g/k;v=_+1.000000013351432e-10;y=M+ +z(+v);v=+Q(+v);f[xe+(m<<2)>>2]=v;n=e+6420+(m<<2)|0;_=+f[n>>2]+.009999999776482582;_=v<_?v:_;f[n>>2]=_;t=e+6492+(m<<2)|0;g=+f[t>>2]+-.10000000149011612;g=v>g?v:g;f[t>>2]=g;if(g<_+1){g=g+.5;f[t>>2]=g;_=_+-.5;f[n>>2]=_}v=(v-_)/(g+1.0000000036274937e-15-_);g=0;_=0;n=0;while(1){if((n|0)==8)break;Ue=+f[e+5844+(n*72|0)+(m<<2)>>2];g=g+ +z(+Ue);_=_+Ue;n=n+1|0}_=g/+z(+(_*8+1e-15));_=_>.9900000095367432?.9900000095367432:_;_=_*_;_=_*_;Ue=A/k;n=e+5768+(m<<2)|0;g=_*+f[n>>2];g=Ue>g?Ue:g;f[Se+(m<<2)>>2]=g;w=w+g;if((m|0)>8)w=w-+f[Se+(m+-9<<2)>>2];A=(+(m+-18|0)*.029999999329447746+1)*w;f[n>>2]=g;Ue=x+g*+(m+-8|0);m=d;M=y;R=R+_;C=C>A?C:A;P=P+v;x=Ue}if((De|0)==37){De=0;s[U>>2]=0;break}y=J?.0005699999746866524:.0005699999746866524/+(1<>2]|0;d=T+1|0;m=s[1864+(d<<2)>>2]|0;v=0;n=t;while(1){if((n|0)>=(m|0))break;_=+f[Oe+(n<<3)>>2];I=+f[Oe+(n<<3)+4>>2];Be=480-n|0;A=+f[Oe+(Be<<3)>>2];Ue=+f[Oe+(Be<<3)+4>>2];v=v+(_*_+A*A+I*I+Ue*Ue);n=n+1|0}_=g>v?g:v;Be=e+6564+(T<<2)|0;g=k*+f[Be>>2];g=g>v?g:v;f[Be>>2]=g;g=v>g?v:g;w=w*.05000000074505806;w=w>g?w:g;if(!(g>w*.1&g*1e9>_)){Be=S;T=d;g=_;S=Be;continue}if(!(g>y*+(m-t|0))){Be=S;T=d;g=_;S=Be;continue}S=T;T=d;g=_}m=s[Ee>>2]|0;T=(m|0)<3?20:S;M=+Hn(M)*20;I=+f[ee>>2]+-.029999999329447746;I=I>M?I:M;f[ee>>2]=I;Ue=+f[te>>2]*(1-N);f[te>>2]=M>2]*+f[xe+(t<<2)>>2];t=t+1|0;w=Ue}f[Te+(d<<2)>>2]=w;d=d+1|0}g=R/18;M=E/18;f[O>>2]=M+(1-M)*((m|0)<10?.5:P/18);N=C/9;Ue=+f[ie>>2]*.800000011920929;Ue=N>Ue?N:Ue;f[ie>>2]=Ue;d=e+8516+(L<<5)+8|0;f[d>>2]=x*.015625;s[X>>2]=((s[X>>2]|0)+1|0)%8|0;s[Ee>>2]=(s[Ee>>2]|0)+1;t=e+8516+(L<<5)+4|0;f[t>>2]=Ue;n=0;while(1){if((n|0)==4)break;f[Me+(n<<2)>>2]=(+f[Te+(n<<2)>>2]+ +f[e+6648+(n+24<<2)>>2])*-.12298999726772308+(+f[e+6648+(n<<2)>>2]+ +f[e+6648+(n+16<<2)>>2])*.49195000529289246+ +f[e+6648+(n+8<<2)>>2]*.6969299912452698-+f[e+6776+(n<<2)>>2]*1.4349000453948975;n=n+1|0}w=1-D;n=0;while(1){if((n|0)==4){n=0;break}Be=e+6776+(n<<2)|0;f[Be>>2]=w*+f[Be>>2]+D*+f[Te+(n<<2)>>2];n=n+1|0}while(1){if((n|0)==4){n=0;break}f[Me+(n+4<<2)>>2]=(+f[Te+(n<<2)>>2]-+f[e+6648+(n+24<<2)>>2])*.6324599981307983+(+f[e+6648+(n<<2)>>2]-+f[e+6648+(n+16<<2)>>2])*.31622999906539917;n=n+1|0}while(1){if((n|0)==3)break;Be=n+8|0;f[Me+(Be<<2)>>2]=(+f[Te+(n<<2)>>2]+ +f[e+6648+(n+24<<2)>>2])*.5345199704170227-(+f[e+6648+(n<<2)>>2]+ +f[e+6648+(n+16<<2)>>2])*.26725998520851135-+f[e+6648+(Be<<2)>>2]*.5345199704170227;n=n+1|0}e:do if((s[Ee>>2]|0)>5){n=0;while(1){if((n|0)==9){n=0;break e}Be=e+6808+(n<<2)|0;Ue=+f[Me+(n<<2)>>2];f[Be>>2]=w*+f[Be>>2]+D*Ue*Ue;n=n+1|0}}else n=0;while(0);while(1){if((n|0)==8){n=0;break}Be=e+6648+(n+16<<2)|0;s[e+6648+(n+24<<2)>>2]=s[Be>>2];S=e+6648+(n+8<<2)|0;s[Be>>2]=s[S>>2];Be=e+6648+(n<<2)|0;s[S>>2]=s[Be>>2];s[Be>>2]=s[Te+(n<<2)>>2];n=n+1|0}while(1){if((n|0)==9)break;Ue=+z(+ +f[e+6808+(n<<2)>>2]);f[Me+(n+11<<2)>>2]=Ue-+f[2464+(n<<2)>>2];n=n+1|0}f[ne>>2]=+f[t>>2]+-.154723;f[re>>2]=+f[O>>2]+-.724643;f[se>>2]=g+-.743717;f[oe>>2]=+f[d>>2]+.069216;f[ae>>2]=+f[te>>2]+-.06793;n=3304;m=0;while(1){if((m|0)==16){n=4968;m=0;break}t=n;d=0;w=+f[n>>2];while(1){t=t+4|0;if((d|0)==25)break;Ue=w+ +f[Me+(d<<2)>>2]*+f[t>>2];d=d+1|0;w=Ue}n=n+104|0;if(w<8)if(w>-8)if(w!=w|0!=0)w=0;else{Be=w<0;w=Be?-w:w;O=~~+G(+(w*25+.5));w=w-+(O|0)*.03999999910593033;Ue=+f[2500+(O<<2)>>2];w=(Be?-1:1)*(Ue+w*(1-Ue*Ue)*(1-Ue*w))}else w=-1;else w=1;f[Ce+(m<<2)>>2]=w;m=m+1|0}while(1){if((m|0)==2)break;t=n;d=0;w=+f[n>>2];while(1){t=t+4|0;if((d|0)==16)break;Ue=w+ +f[Ce+(d<<2)>>2]*+f[t>>2];d=d+1|0;w=Ue}n=n+68|0;if(w<8)if(w>-8)if(w!=w|0!=0)w=0;else{Be=w<0;w=Be?-w:w;O=~~+G(+(w*25+.5));w=w-+(O|0)*.03999999910593033;Ue=+f[2500+(O<<2)>>2];w=(Be?-1:1)*(Ue+w*(1-Ue*Ue)*(1-Ue*w))}else w=-1;else w=1;f[Re+(m<<2)>>2]=w;m=m+1|0}A=(+f[Re>>2]+1)*.5;E=+f[le>>2]*.5+.5;E=E*E;f[le>>2]=E;A=E*A+(1-E)*.5;f[Re>>2]=A;f[e+8516+(L<<5)+28>>2]=E;v=E*4999999873689376e-20;Be=A>.949999988079071;O=A<.05000000074505806&(Be^1);y=O|Be?O?.05000000074505806:.949999988079071:A;D=+f[Ae>>2];O=D>.949999988079071;Be=D<.05000000074505806&(O^1);k=Be|O?Be?.05000000074505806:.949999988079071:D;N=1-D;g=1-v;y=+H(+(y-k))*.05000000074505806/(y*(1-k)+k*(1-y))+.009999999776482582;k=+q(+(1-A),+y);y=+q(+A,+y);Ue=(D*g+N*v)*y;Ue=Ue/((N*g+D*v)*k+Ue);f[Ae>>2]=Ue;f[e+8516+(L<<5)+20>>2]=Ue;if((s[Ee>>2]|0)==1){f[fe>>2]=.5;f[he>>2]=.5;w=.5}else w=+f[fe>>2];w=w+ +f[ue>>2];_=+f[he>>2]+ +f[ce>>2];f[fe>>2]=w*g*k;f[he>>2]=_*g*y;n=1;while(1){if((n|0)==199)break;Be=n+1|0;f[e+6888+(n<<2)>>2]=+f[e+6888+(Be<<2)>>2]*k;f[e+7688+(n<<2)>>2]=+f[e+7688+(Be<<2)>>2]*y;n=Be}f[de>>2]=_*v*k;f[pe>>2]=w*v*y;n=0;w=9.999999682655225e-21;while(1){if((n|0)==200)break;Ue=w+(+f[e+6888+(n<<2)>>2]+ +f[e+7688+(n<<2)>>2]);n=n+1|0;w=Ue}w=1/w;n=0;while(1){if((n|0)==200)break;Be=e+6888+(n<<2)|0;f[Be>>2]=+f[Be>>2]*w;Be=e+7688+(n<<2)|0;f[Be>>2]=+f[Be>>2]*w;n=n+1|0}if(E>.75){w=+f[Ae>>2];if(w>.9){Be=(s[be>>2]|0)+1|0;s[be>>2]=(Be|0)<500?Be:500;D=+f[we>>2];Ue=A-D;f[we>>2]=D+1/+(Be|0)*(Ue<-.20000000298023224?-.20000000298023224:Ue)}if(w<.1){Be=(s[me>>2]|0)+1|0;s[me>>2]=(Be|0)<500?Be:500;D=+f[ge>>2];Ue=A-D;f[ge>>2]=D+1/+(Be|0)*(Ue>.20000000298023224?.20000000298023224:Ue)}}else{if(!(s[be>>2]|0))f[we>>2]=.8999999761581421;if(!(s[me>>2]|0))f[ge>>2]=.10000000149011612}n=+f[Ae>>2]>.5&1;if((s[_e>>2]|0)!=(n|0))s[ye>>2]=0;s[_e>>2]=n;s[e+8516+(L<<5)+24>>2]=T;f[e+8516+(L<<5)+12>>2]=M;s[U>>2]=1}while(0);if(j){F=F+480|0;W=W+-480|0}else break}s[ke>>2]=ve-o}s[b>>2]=0;m=e+8508|0;n=s[m>>2]|0;t=s[c>>2]|0;d=t-n|0;d=(d|0)<0?d+200|0:d;if((o|0)<481|(t|0)==(n|0))c=n;else{c=n+1|0;c=(c|0)==200?0:c}n=(c|0)==(t|0)?t+-1|0:c;n=e+8516+(((n|0)<0?199:n)<<5)|0;s[b>>2]=s[n>>2];s[b+4>>2]=s[n+4>>2];s[b+8>>2]=s[n+8>>2];s[b+12>>2]=s[n+12>>2];s[b+16>>2]=s[n+16>>2];s[b+20>>2]=s[n+20>>2];s[b+24>>2]=s[n+24>>2];s[b+28>>2]=s[n+28>>2];n=e+8512|0;c=(s[n>>2]|0)+((o|0)/120|0)|0;s[n>>2]=c;while(1){if((c|0)<=3)break;Be=c+-4|0;s[n>>2]=Be;s[m>>2]=(s[m>>2]|0)+1;c=Be}c=s[m>>2]|0;if((c|0)>199)s[m>>2]=c+-200;c=(d|0)>10?210-d|0:200;n=0;w=0;while(1){if((n|0)>=(c|0))break;Ue=w+ +f[e+7688+(n<<2)>>2];n=n+1|0;w=Ue}while(1){if((n|0)>=200)break;Ue=w+ +f[e+6888+(n<<2)>>2];n=n+1|0;w=Ue}f[b+20>>2]=w*+f[e+8492>>2]+(1-w)*+f[e+8488>>2];u=Le;return}function Hs(e,t,i){e=e|0;t=t|0;i=i|0;var n=0,r=0,o=0,a=0,l=0,h=0;l=u;u=u+16|0;n=l;s[n>>2]=i;do switch(t|0){case 4010:{a=(s[n>>2]|0)+(4-1)&~(4-1);t=s[a>>2]|0;s[n>>2]=a+4;if(t>>>0>10)t=40;else{s[e+24>>2]=t;t=39}break}case 10010:{a=(s[n>>2]|0)+(4-1)&~(4-1);t=s[a>>2]|0;s[n>>2]=a+4;if((t|0)>=0?(t|0)<(s[(s[e>>2]|0)+8>>2]|0):0){s[e+32>>2]=t;t=39}else t=40;break}case 10012:{a=(s[n>>2]|0)+(4-1)&~(4-1);t=s[a>>2]|0;s[n>>2]=a+4;if((t|0)>=1?(t|0)<=(s[(s[e>>2]|0)+8>>2]|0):0){s[e+36>>2]=t;t=39}else t=40;break}case 10002:{a=(s[n>>2]|0)+(4-1)&~(4-1);t=s[a>>2]|0;s[n>>2]=a+4;if(t>>>0>2)t=40;else{s[e+20>>2]=(t|0)<2&1;s[e+12>>2]=(t|0)==0&1;t=39}break}case 4014:{a=(s[n>>2]|0)+(4-1)&~(4-1);t=s[a>>2]|0;s[n>>2]=a+4;if(t>>>0>100)t=40;else{s[e+56>>2]=t;t=39}break}case 4020:{a=(s[n>>2]|0)+(4-1)&~(4-1);t=s[a>>2]|0;s[n>>2]=a+4;s[e+52>>2]=t;t=39;break}case 4006:{a=(s[n>>2]|0)+(4-1)&~(4-1);t=s[a>>2]|0;s[n>>2]=a+4;s[e+44>>2]=t;t=39;break}case 4002:{a=(s[n>>2]|0)+(4-1)&~(4-1);t=s[a>>2]|0;s[n>>2]=a+4;if((t|0)>500|(t|0)==-1){a=(s[e+4>>2]|0)*26e4|0;s[e+40>>2]=(t|0)<(a|0)?t:a;t=39}else t=40;break}case 10008:{a=(s[n>>2]|0)+(4-1)&~(4-1);t=s[a>>2]|0;s[n>>2]=a+4;if((t+-1|0)>>>0>1)t=40;else{s[e+8>>2]=t;t=39}break}case 4036:{a=(s[n>>2]|0)+(4-1)&~(4-1);t=s[a>>2]|0;s[n>>2]=a+4;if((t+-8|0)>>>0>16)t=40;else{s[e+60>>2]=t;t=39}break}case 4037:{a=(s[n>>2]|0)+(4-1)&~(4-1);t=s[a>>2]|0;s[n>>2]=a+4;s[t>>2]=s[e+60>>2];t=39;break}case 4040:{a=(s[n>>2]|0)+(4-1)&~(4-1);t=s[a>>2]|0;s[n>>2]=a+4;s[e+64>>2]=t;t=39;break}case 4028:{t=e+4|0;o=s[t>>2]|0;r=s[e>>2]|0;h=s[r+4>>2]|0;i=e+212+((te(o,h+1024|0)|0)<<2)|0;a=s[r+8>>2]|0;n=te(o,a)|0;i=i+(n<<2)|0;n=i+(n<<2)|0;yr(e+76|0,0,((te(h,o)|0)<<2)+212+(o<<12)+((te(o<<2,a)|0)<<2)+-76|0)|0;a=0;while(1){if((a|0)>=(te(o,s[r+8>>2]|0)|0))break;f[n+(a<<2)>>2]=-28;f[i+(a<<2)>>2]=-28;r=s[e>>2]|0;o=s[t>>2]|0;a=a+1|0}s[e+184>>2]=0;f[e+84>>2]=1;s[e+80>>2]=2;s[e+88>>2]=256;s[e+96>>2]=0;s[e+100>>2]=0;t=39;break}case 10016:{h=(s[n>>2]|0)+(4-1)&~(4-1);t=s[h>>2]|0;s[n>>2]=h+4;s[e+48>>2]=t;t=39;break}case 10022:{h=(s[n>>2]|0)+(4-1)&~(4-1);t=s[h>>2]|0;s[n>>2]=h+4;if(!t)t=39;else{h=e+120|0;s[h>>2]=s[t>>2];s[h+4>>2]=s[t+4>>2];s[h+8>>2]=s[t+8>>2];s[h+12>>2]=s[t+12>>2];s[h+16>>2]=s[t+16>>2];s[h+20>>2]=s[t+20>>2];s[h+24>>2]=s[t+24>>2];s[h+28>>2]=s[t+28>>2];t=39}break}case 10028:{h=(s[n>>2]|0)+(4-1)&~(4-1);t=s[h>>2]|0;s[n>>2]=h+4;if(!t)t=39;else{a=t;h=s[a+4>>2]|0;t=e+152|0;s[t>>2]=s[a>>2];s[t+4>>2]=h;t=39}break}case 10015:{h=(s[n>>2]|0)+(4-1)&~(4-1);t=s[h>>2]|0;s[n>>2]=h+4;if(!t)t=40;else{s[t>>2]=s[e>>2];t=39}break}case 4031:{h=(s[n>>2]|0)+(4-1)&~(4-1);t=s[h>>2]|0;s[n>>2]=h+4;if(!t)t=40;else{s[t>>2]=s[e+76>>2];t=39}break}case 10024:{h=(s[n>>2]|0)+(4-1)&~(4-1);t=s[h>>2]|0;s[n>>2]=h+4;s[e+68>>2]=t;t=39;break}case 10026:{h=(s[n>>2]|0)+(4-1)&~(4-1);t=s[h>>2]|0;s[n>>2]=h+4;s[e+204>>2]=t;t=39;break}default:{h=-5;u=l;return h|0}}while(0);if((t|0)==39){h=0;u=l;return h|0}else if((t|0)==40){h=-1;u=l;return h|0}return 0}var zs=[$r,$n,fr,ur,_s,$r,$r,$r];var qs=[Kr,nr,Qn,br];var Ws=[Xr,Wn,tr,Yn,Zn,Vn,sr,or,lr,hr,cr,gs,Xr,Xr,Xr,Xr];var Vs=[Jr,ks];var Ys=[Qr,ar,ms,Qr];var Zs=[es,Is];var $s=[ts];var Ks=[is,vs,ws,is];var Xs=[ns,ir,Xn,dr];var Js=[rs,bs,ys,rs];var Qs=[ss,rr,er,mr];return{___cxa_can_catch:_r,_free:qn,_opus_strerror:Ts,_opus_decoder_create:Ss,___cxa_is_pointer_type:vr,_i64Add:Er,_memmove:Mr,_bitshift64Ashr:Ar,_opus_encoder_destroy:Bs,_memset:yr,_malloc:zn,_opus_decoder_destroy:Ps,_opus_encoder_create:xs,_memcpy:Sr,___getTypeName:Gn,_bitshift64Lshr:Tr,_opus_decoder_ctl:Cs,_opus_encoder_ctl:Us,__GLOBAL__sub_I_opusscript_encoder_cpp:Es,__GLOBAL__sub_I_bind_cpp:Fn,runPostSets:kr,stackAlloc:os,stackSave:as,stackRestore:ls,establishStackSpace:fs,setThrew:hs,setTempRet0:ds,getTempRet0:ps,dynCall_iiii:Br,dynCall_viiiii:jr,dynCall_vi:Fr,dynCall_iiiiiii:Gr,dynCall_ii:Hr,dynCall_viiiiiii:zr,dynCall_v:qr,dynCall_iiiii:Wr,dynCall_viiiiii:Vr,dynCall_iiiiii:Yr,dynCall_viiii:Zr}}(Module.asmGlobalArg,Module.asmLibraryArg,buffer),runPostSets=Module.runPostSets=asm.runPostSets,___cxa_can_catch=Module.___cxa_can_catch=asm.___cxa_can_catch,__GLOBAL__sub_I_bind_cpp=Module.__GLOBAL__sub_I_bind_cpp=asm.__GLOBAL__sub_I_bind_cpp,_free=Module._free=asm._free,_opus_strerror=Module._opus_strerror=asm._opus_strerror,_opus_decoder_create=Module._opus_decoder_create=asm._opus_decoder_create,___cxa_is_pointer_type=Module.___cxa_is_pointer_type=asm.___cxa_is_pointer_type,_i64Add=Module._i64Add=asm._i64Add,_memmove=Module._memmove=asm._memmove,_bitshift64Ashr=Module._bitshift64Ashr=asm._bitshift64Ashr,_opus_encoder_destroy=Module._opus_encoder_destroy=asm._opus_encoder_destroy,_memset=Module._memset=asm._memset,_malloc=Module._malloc=asm._malloc,_opus_decoder_destroy=Module._opus_decoder_destroy=asm._opus_decoder_destroy,_opus_encoder_create=Module._opus_encoder_create=asm._opus_encoder_create,_memcpy=Module._memcpy=asm._memcpy,___getTypeName=Module.___getTypeName=asm.___getTypeName,_bitshift64Lshr=Module._bitshift64Lshr=asm._bitshift64Lshr,_opus_encoder_ctl=Module._opus_encoder_ctl=asm._opus_encoder_ctl,_opus_decoder_ctl=Module._opus_decoder_ctl=asm._opus_decoder_ctl,__GLOBAL__sub_I_opusscript_encoder_cpp=Module.__GLOBAL__sub_I_opusscript_encoder_cpp=asm.__GLOBAL__sub_I_opusscript_encoder_cpp,dynCall_iiii=Module.dynCall_iiii=asm.dynCall_iiii,dynCall_viiiii=Module.dynCall_viiiii=asm.dynCall_viiiii,dynCall_vi=Module.dynCall_vi=asm.dynCall_vi,dynCall_iiiiiii=Module.dynCall_iiiiiii=asm.dynCall_iiiiiii,dynCall_ii=Module.dynCall_ii=asm.dynCall_ii,dynCall_viiiiiii=Module.dynCall_viiiiiii=asm.dynCall_viiiiiii,dynCall_v=Module.dynCall_v=asm.dynCall_v,dynCall_iiiii=Module.dynCall_iiiii=asm.dynCall_iiiii,dynCall_viiiiii=Module.dynCall_viiiiii=asm.dynCall_viiiiii,dynCall_iiiiii=Module.dynCall_iiiiii=asm.dynCall_iiiiii,dynCall_viiii=Module.dynCall_viiii=asm.dynCall_viiii;Runtime.stackAlloc=asm.stackAlloc,Runtime.stackSave=asm.stackSave,Runtime.stackRestore=asm.stackRestore,Runtime.establishStackSpace=asm.establishStackSpace,Runtime.setTempRet0=asm.setTempRet0,Runtime.getTempRet0=asm.getTempRet0,ExitStatus.prototype=new Error,ExitStatus.prototype.constructor=ExitStatus;var initialStackTop,preloadStartTime=null,calledMain=!1;dependenciesFulfilled=function e(){Module.calledRun||run(),Module.calledRun||(dependenciesFulfilled=e)},Module.callMain=Module.callMain=function(e){function t(){for(var e=0;e<3;e++)n.push(0)}e=e||[],ensureInitRuntime();var i=e.length+1,n=[allocate(intArrayFromString(Module.thisProgram),"i8",ALLOC_NORMAL)];t();for(var r=0;r0;)Module.preInit.pop()();var shouldRunNow=!0;Module.noInitialRun&&(shouldRunNow=!1),run()}).call(exports,__webpack_require__(2),"node_modules/opusscript/build",__webpack_require__(71)(module))},function(e,t,i){(function(t){const n=i(3).EventEmitter,r=i(172),s=new t(24);s.fill(0);class o extends n{constructor(e,t,i,n){super(),this.player=e,this.stream=t,this.streamingData={channels:2,count:0,sequence:i.sequence,timestamp:i.timestamp,pausedTime:0},this._startStreaming(),this._triggered=!1,this._volume=n.volume,this.passes=n.passes||1,this.paused=!1,this.setVolume(n.volume||1)}get time(){return this.streamingData.count*(this.streamingData.length||0)}get totalStreamTime(){return this.time+this.streamingData.pausedTime}get volume(){return this._volume}setVolume(e){this._volume=e}setVolumeDecibels(e){this._volume=Math.pow(10,e/20)}setVolumeLogarithmic(e){this._volume=Math.pow(e,1.660964)}pause(){this._setPaused(!0)}resume(){this._setPaused(!1)}end(){this._triggerTerminalState("end","user requested")}_setSpeaking(e){this.speaking=e,this.emit("speaking",e)}_sendBuffer(e,t,i){let n=this.passes;const r=this._createPacket(t,i,this.player.opusEncoder.encode(e));for(;n--;)this.player.voiceConnection.sockets.udp.send(r).catch(e=>this.emit("debug",`Failed to send a packet ${e}`))}_createPacket(e,i,n){const o=new t(n.length+28);o.fill(0),o[0]=128,o[1]=120,o.writeUIntBE(e,2,2),o.writeUIntBE(i,4,4),o.writeUIntBE(this.player.voiceConnection.authentication.ssrc,8,4),o.copy(s,0,0,12),n=r.secretbox(n,s,this.player.voiceConnection.authentication.secretKey.key);for(let a=0;a=e.length-1);n+=2){const t=Math.min(32767,Math.max(-32767,Math.floor(this._volume*e.readInt16LE(n))));i.writeInt16LE(t,n)}return i}_send(){try{if(this._triggered)return void this._setSpeaking(!1);const e=this.streamingData;if(e.missed>=5)return void this._triggerTerminalState("end","Stream is not generating quickly enough.");if(this.paused)return e.pausedTime+=10*e.length,void this.player.voiceConnection.voiceManager.client.setTimeout(()=>this._send(),10*e.length);this._setSpeaking(!0),e.startTime||(this.emit("start"),e.startTime=Date.now());const i=1920*e.channels;let n=this.stream.read(i);if(!n)return e.missed++,e.pausedTime+=10*e.length,void this.player.voiceConnection.voiceManager.client.setTimeout(()=>this._send(),10*e.length);if(e.missed=0,n.length!==i){const e=new t(i).fill(0);n.copy(e),n=e}n=this._applyVolume(n),e.count++,e.sequence=e.sequence+1<65536?e.sequence+1:0,e.timestamp=e.timestamp+4294967295?e.timestamp+960:0,this._sendBuffer(n,e.sequence,e.timestamp);const r=e.length+(e.startTime+e.pausedTime+e.count*e.length-Date.now());this.player.voiceConnection.voiceManager.client.setTimeout(()=>this._send(),r)}catch(e){this._triggerTerminalState("error",e)}}_triggerEnd(){this.emit("end")}_triggerError(e){this.emit("end"),this.emit("error",e)}_triggerTerminalState(e,t){if(!this._triggered)switch(this.emit("debug",`Triggered terminal state ${e} - stream is now dead`),this._triggered=!0,this._setSpeaking(!1),e){case"end":this._triggerEnd(t);break;case"error":this._triggerError(t);break;default:this.emit("error","Unknown trigger state")}}_startStreaming(){if(!this.stream)return void this.emit("error","No stream");this.stream.on("end",e=>this._triggerTerminalState("end",e)),this.stream.on("error",e=>this._triggerTerminalState("error",e));const e=this.streamingData;e.length=20,e.missed=0,this.stream.once("readable",()=>this._send())}_setPaused(e){e?(this.paused=!0,this._setSpeaking(!1)):(this.paused=!1,this._setSpeaking(!0))}}e.exports=o}).call(t,i(58).Buffer)},function(e,t,i){!function(e){"use strict";function t(e,t,i,n){e[t]=i>>24&255,e[t+1]=i>>16&255,e[t+2]=i>>8&255,e[t+3]=255&i,e[t+4]=n>>24&255,e[t+5]=n>>16&255,e[t+6]=n>>8&255,e[t+7]=255&n}function n(e,t,i,n,r){var s,o=0;for(s=0;s>>8)-1}function r(e,t,i,r){return n(e,t,i,r,16)}function s(e,t,i,r){return n(e,t,i,r,32)}function o(e,t,i,n){for(var r,s=255&n[0]|(255&n[1])<<8|(255&n[2])<<16|(255&n[3])<<24,o=255&i[0]|(255&i[1])<<8|(255&i[2])<<16|(255&i[3])<<24,a=255&i[4]|(255&i[5])<<8|(255&i[6])<<16|(255&i[7])<<24,l=255&i[8]|(255&i[9])<<8|(255&i[10])<<16|(255&i[11])<<24,f=255&i[12]|(255&i[13])<<8|(255&i[14])<<16|(255&i[15])<<24,h=255&n[4]|(255&n[5])<<8|(255&n[6])<<16|(255&n[7])<<24,u=255&t[0]|(255&t[1])<<8|(255&t[2])<<16|(255&t[3])<<24,c=255&t[4]|(255&t[5])<<8|(255&t[6])<<16|(255&t[7])<<24,d=255&t[8]|(255&t[9])<<8|(255&t[10])<<16|(255&t[11])<<24,p=255&t[12]|(255&t[13])<<8|(255&t[14])<<16|(255&t[15])<<24,b=255&n[8]|(255&n[9])<<8|(255&n[10])<<16|(255&n[11])<<24,w=255&i[16]|(255&i[17])<<8|(255&i[18])<<16|(255&i[19])<<24,m=255&i[20]|(255&i[21])<<8|(255&i[22])<<16|(255&i[23])<<24,g=255&i[24]|(255&i[25])<<8|(255&i[26])<<16|(255&i[27])<<24,_=255&i[28]|(255&i[29])<<8|(255&i[30])<<16|(255&i[31])<<24,v=255&n[12]|(255&n[13])<<8|(255&n[14])<<16|(255&n[15])<<24,k=s,y=o,E=a,A=l,T=f,S=h,M=u,R=c,C=d,P=p,x=b,I=w,O=m,N=g,D=_,L=v,U=0;U<20;U+=2)r=k+O|0,T^=r<<7|r>>>25,r=T+k|0,C^=r<<9|r>>>23,r=C+T|0,O^=r<<13|r>>>19,r=O+C|0,k^=r<<18|r>>>14,r=S+y|0,P^=r<<7|r>>>25,r=P+S|0,N^=r<<9|r>>>23,r=N+P|0,y^=r<<13|r>>>19,r=y+N|0,S^=r<<18|r>>>14,r=x+M|0,D^=r<<7|r>>>25,r=D+x|0,E^=r<<9|r>>>23,r=E+D|0,M^=r<<13|r>>>19,r=M+E|0,x^=r<<18|r>>>14,r=L+I|0,A^=r<<7|r>>>25,r=A+L|0,R^=r<<9|r>>>23,r=R+A|0,I^=r<<13|r>>>19,r=I+R|0,L^=r<<18|r>>>14,r=k+A|0,y^=r<<7|r>>>25,r=y+k|0,E^=r<<9|r>>>23,r=E+y|0,A^=r<<13|r>>>19,r=A+E|0,k^=r<<18|r>>>14,r=S+T|0,M^=r<<7|r>>>25,r=M+S|0,R^=r<<9|r>>>23,r=R+M|0,T^=r<<13|r>>>19,r=T+R|0,S^=r<<18|r>>>14,r=x+P|0,I^=r<<7|r>>>25,r=I+x|0,C^=r<<9|r>>>23,r=C+I|0,P^=r<<13|r>>>19,r=P+C|0,x^=r<<18|r>>>14,r=L+D|0,O^=r<<7|r>>>25,r=O+L|0,N^=r<<9|r>>>23,r=N+O|0,D^=r<<13|r>>>19,r=D+N|0,L^=r<<18|r>>>14;k=k+s|0,y=y+o|0,E=E+a|0,A=A+l|0,T=T+f|0,S=S+h|0,M=M+u|0,R=R+c|0,C=C+d|0,P=P+p|0,x=x+b|0,I=I+w|0,O=O+m|0,N=N+g|0,D=D+_|0,L=L+v|0,e[0]=k>>>0&255,e[1]=k>>>8&255,e[2]=k>>>16&255,e[3]=k>>>24&255,e[4]=y>>>0&255,e[5]=y>>>8&255,e[6]=y>>>16&255,e[7]=y>>>24&255,e[8]=E>>>0&255,e[9]=E>>>8&255,e[10]=E>>>16&255,e[11]=E>>>24&255,e[12]=A>>>0&255,e[13]=A>>>8&255,e[14]=A>>>16&255,e[15]=A>>>24&255,e[16]=T>>>0&255,e[17]=T>>>8&255,e[18]=T>>>16&255,e[19]=T>>>24&255,e[20]=S>>>0&255,e[21]=S>>>8&255,e[22]=S>>>16&255,e[23]=S>>>24&255,e[24]=M>>>0&255,e[25]=M>>>8&255,e[26]=M>>>16&255,e[27]=M>>>24&255,e[28]=R>>>0&255,e[29]=R>>>8&255,e[30]=R>>>16&255,e[31]=R>>>24&255,e[32]=C>>>0&255,e[33]=C>>>8&255,e[34]=C>>>16&255,e[35]=C>>>24&255,e[36]=P>>>0&255,e[37]=P>>>8&255,e[38]=P>>>16&255,e[39]=P>>>24&255,e[40]=x>>>0&255,e[41]=x>>>8&255,e[42]=x>>>16&255,e[43]=x>>>24&255,e[44]=I>>>0&255,e[45]=I>>>8&255,e[46]=I>>>16&255,e[47]=I>>>24&255,e[48]=O>>>0&255,e[49]=O>>>8&255,e[50]=O>>>16&255,e[51]=O>>>24&255,e[52]=N>>>0&255,e[53]=N>>>8&255,e[54]=N>>>16&255,e[55]=N>>>24&255,e[56]=D>>>0&255,e[57]=D>>>8&255,e[58]=D>>>16&255,e[59]=D>>>24&255,e[60]=L>>>0&255,e[61]=L>>>8&255,e[62]=L>>>16&255,e[63]=L>>>24&255}function a(e,t,i,n){for(var r,s=255&n[0]|(255&n[1])<<8|(255&n[2])<<16|(255&n[3])<<24,o=255&i[0]|(255&i[1])<<8|(255&i[2])<<16|(255&i[3])<<24,a=255&i[4]|(255&i[5])<<8|(255&i[6])<<16|(255&i[7])<<24,l=255&i[8]|(255&i[9])<<8|(255&i[10])<<16|(255&i[11])<<24,f=255&i[12]|(255&i[13])<<8|(255&i[14])<<16|(255&i[15])<<24,h=255&n[4]|(255&n[5])<<8|(255&n[6])<<16|(255&n[7])<<24,u=255&t[0]|(255&t[1])<<8|(255&t[2])<<16|(255&t[3])<<24,c=255&t[4]|(255&t[5])<<8|(255&t[6])<<16|(255&t[7])<<24,d=255&t[8]|(255&t[9])<<8|(255&t[10])<<16|(255&t[11])<<24,p=255&t[12]|(255&t[13])<<8|(255&t[14])<<16|(255&t[15])<<24,b=255&n[8]|(255&n[9])<<8|(255&n[10])<<16|(255&n[11])<<24,w=255&i[16]|(255&i[17])<<8|(255&i[18])<<16|(255&i[19])<<24,m=255&i[20]|(255&i[21])<<8|(255&i[22])<<16|(255&i[23])<<24,g=255&i[24]|(255&i[25])<<8|(255&i[26])<<16|(255&i[27])<<24,_=255&i[28]|(255&i[29])<<8|(255&i[30])<<16|(255&i[31])<<24,v=255&n[12]|(255&n[13])<<8|(255&n[14])<<16|(255&n[15])<<24,k=s,y=o,E=a,A=l,T=f,S=h,M=u,R=c,C=d,P=p,x=b,I=w,O=m,N=g,D=_,L=v,U=0;U<20;U+=2)r=k+O|0,T^=r<<7|r>>>25,r=T+k|0,C^=r<<9|r>>>23,r=C+T|0,O^=r<<13|r>>>19,r=O+C|0,k^=r<<18|r>>>14,r=S+y|0,P^=r<<7|r>>>25,r=P+S|0,N^=r<<9|r>>>23,r=N+P|0,y^=r<<13|r>>>19,r=y+N|0,S^=r<<18|r>>>14,r=x+M|0,D^=r<<7|r>>>25,r=D+x|0,E^=r<<9|r>>>23,r=E+D|0,M^=r<<13|r>>>19,r=M+E|0,x^=r<<18|r>>>14,r=L+I|0,A^=r<<7|r>>>25,r=A+L|0,R^=r<<9|r>>>23,r=R+A|0,I^=r<<13|r>>>19,r=I+R|0,L^=r<<18|r>>>14,r=k+A|0,y^=r<<7|r>>>25,r=y+k|0,E^=r<<9|r>>>23,r=E+y|0,A^=r<<13|r>>>19,r=A+E|0,k^=r<<18|r>>>14,r=S+T|0,M^=r<<7|r>>>25,r=M+S|0,R^=r<<9|r>>>23,r=R+M|0,T^=r<<13|r>>>19,r=T+R|0,S^=r<<18|r>>>14,r=x+P|0,I^=r<<7|r>>>25,r=I+x|0,C^=r<<9|r>>>23,r=C+I|0,P^=r<<13|r>>>19,r=P+C|0,x^=r<<18|r>>>14,r=L+D|0,O^=r<<7|r>>>25,r=O+L|0,N^=r<<9|r>>>23,r=N+O|0,D^=r<<13|r>>>19,r=D+N|0,L^=r<<18|r>>>14;e[0]=k>>>0&255,e[1]=k>>>8&255,e[2]=k>>>16&255,e[3]=k>>>24&255,e[4]=S>>>0&255,e[5]=S>>>8&255,e[6]=S>>>16&255,e[7]=S>>>24&255,e[8]=x>>>0&255,e[9]=x>>>8&255,e[10]=x>>>16&255,e[11]=x>>>24&255,e[12]=L>>>0&255,e[13]=L>>>8&255,e[14]=L>>>16&255,e[15]=L>>>24&255,e[16]=M>>>0&255,e[17]=M>>>8&255,e[18]=M>>>16&255,e[19]=M>>>24&255,e[20]=R>>>0&255,e[21]=R>>>8&255,e[22]=R>>>16&255,e[23]=R>>>24&255,e[24]=C>>>0&255,e[25]=C>>>8&255,e[26]=C>>>16&255,e[27]=C>>>24&255,e[28]=P>>>0&255,e[29]=P>>>8&255,e[30]=P>>>16&255,e[31]=P>>>24&255}function l(e,t,i,n){o(e,t,i,n)}function f(e,t,i,n){a(e,t,i,n)}function h(e,t,i,n,r,s,o){var a,f,h=new Uint8Array(16),u=new Uint8Array(64);for(f=0;f<16;f++)h[f]=0;for(f=0;f<8;f++)h[f]=s[f];for(;r>=64;){for(l(u,h,o,ce),f=0;f<64;f++)e[t+f]=i[n+f]^u[f];for(a=1,f=8;f<16;f++)a=a+(255&h[f])|0,h[f]=255&a,a>>>=8;r-=64,t+=64,n+=64}if(r>0)for(l(u,h,o,ce),f=0;f=64;){for(l(f,a,r,ce),o=0;o<64;o++)e[t+o]=f[o];for(s=1,o=8;o<16;o++)s=s+(255&a[o])|0,a[o]=255&s,s>>>=8;i-=64,t+=64}if(i>0)for(l(f,a,r,ce),o=0;o>16&1),s[i-1]&=65535;s[15]=o[15]-32767-(s[14]>>16&1),r=s[15]>>16&1,s[14]&=65535,v(o,s,1-r)}for(i=0;i<16;i++)e[2*i]=255&o[i],e[2*i+1]=o[i]>>8}function y(e,t){var i=new Uint8Array(32),n=new Uint8Array(32);return k(i,e),k(n,t),s(i,0,n,0)}function E(e){var t=new Uint8Array(32);return k(t,e),1&t[0]}function A(e,t){var i;for(i=0;i<16;i++)e[i]=t[2*i]+(t[2*i+1]<<8);e[15]&=32767}function T(e,t,i){for(var n=0;n<16;n++)e[n]=t[n]+i[n]}function S(e,t,i){for(var n=0;n<16;n++)e[n]=t[n]-i[n]}function M(e,t,i){var n,r,s=0,o=0,a=0,l=0,f=0,h=0,u=0,c=0,d=0,p=0,b=0,w=0,m=0,g=0,_=0,v=0,k=0,y=0,E=0,A=0,T=0,S=0,M=0,R=0,C=0,P=0,x=0,I=0,O=0,N=0,D=0,L=i[0],U=i[1],B=i[2],j=i[3],F=i[4],G=i[5],H=i[6],z=i[7],q=i[8],W=i[9],V=i[10],Y=i[11],Z=i[12],$=i[13],K=i[14],X=i[15];n=t[0],s+=n*L,o+=n*U,a+=n*B,l+=n*j,f+=n*F,h+=n*G,u+=n*H,c+=n*z,d+=n*q,p+=n*W,b+=n*V,w+=n*Y,m+=n*Z,g+=n*$,_+=n*K,v+=n*X,n=t[1],o+=n*L,a+=n*U,l+=n*B,f+=n*j,h+=n*F,u+=n*G,c+=n*H,d+=n*z,p+=n*q,b+=n*W,w+=n*V,m+=n*Y,g+=n*Z,_+=n*$,v+=n*K,k+=n*X,n=t[2],a+=n*L,l+=n*U,f+=n*B,h+=n*j,u+=n*F,c+=n*G,d+=n*H,p+=n*z,b+=n*q,w+=n*W,m+=n*V,g+=n*Y,_+=n*Z,v+=n*$,k+=n*K,y+=n*X,n=t[3],l+=n*L,f+=n*U,h+=n*B,u+=n*j,c+=n*F,d+=n*G,p+=n*H,b+=n*z,w+=n*q,m+=n*W,g+=n*V,_+=n*Y,v+=n*Z,k+=n*$,y+=n*K,E+=n*X,n=t[4],f+=n*L,h+=n*U,u+=n*B,c+=n*j,d+=n*F,p+=n*G,b+=n*H,w+=n*z,m+=n*q,g+=n*W,_+=n*V,v+=n*Y,k+=n*Z,y+=n*$,E+=n*K,A+=n*X,n=t[5],h+=n*L,u+=n*U,c+=n*B,d+=n*j,p+=n*F,b+=n*G,w+=n*H,m+=n*z,g+=n*q,_+=n*W,v+=n*V,k+=n*Y,y+=n*Z,E+=n*$,A+=n*K,T+=n*X,n=t[6],u+=n*L,c+=n*U,d+=n*B,p+=n*j,b+=n*F,w+=n*G,m+=n*H,g+=n*z,_+=n*q,v+=n*W,k+=n*V,y+=n*Y,E+=n*Z,A+=n*$,T+=n*K,S+=n*X,n=t[7],c+=n*L,d+=n*U,p+=n*B,b+=n*j,w+=n*F,m+=n*G,g+=n*H,_+=n*z,v+=n*q,k+=n*W,y+=n*V,E+=n*Y,A+=n*Z,T+=n*$,S+=n*K,M+=n*X,n=t[8],d+=n*L,p+=n*U,b+=n*B,w+=n*j,m+=n*F,g+=n*G,_+=n*H,v+=n*z,k+=n*q,y+=n*W,E+=n*V,A+=n*Y,T+=n*Z,S+=n*$,M+=n*K,R+=n*X,n=t[9],p+=n*L,b+=n*U,w+=n*B,m+=n*j,g+=n*F,_+=n*G,v+=n*H,k+=n*z,y+=n*q,E+=n*W,A+=n*V,T+=n*Y,S+=n*Z,M+=n*$,R+=n*K,C+=n*X,n=t[10],b+=n*L,w+=n*U,m+=n*B,g+=n*j,_+=n*F,v+=n*G,k+=n*H,y+=n*z,E+=n*q,A+=n*W,T+=n*V,S+=n*Y,M+=n*Z,R+=n*$,C+=n*K,P+=n*X,n=t[11],w+=n*L,m+=n*U,g+=n*B,_+=n*j,v+=n*F,k+=n*G,y+=n*H,E+=n*z,A+=n*q,T+=n*W,S+=n*V,M+=n*Y;R+=n*Z;C+=n*$,P+=n*K,x+=n*X,n=t[12],m+=n*L,g+=n*U,_+=n*B,v+=n*j,k+=n*F,y+=n*G,E+=n*H,A+=n*z,T+=n*q,S+=n*W,M+=n*V,R+=n*Y,C+=n*Z,P+=n*$,x+=n*K,I+=n*X,n=t[13],g+=n*L,_+=n*U,v+=n*B,k+=n*j,y+=n*F,E+=n*G,A+=n*H,T+=n*z,S+=n*q,M+=n*W,R+=n*V,C+=n*Y,P+=n*Z,x+=n*$,I+=n*K,O+=n*X,n=t[14],_+=n*L,v+=n*U,k+=n*B,y+=n*j,E+=n*F,A+=n*G,T+=n*H,S+=n*z,M+=n*q,R+=n*W,C+=n*V,P+=n*Y,x+=n*Z,I+=n*$,O+=n*K,N+=n*X,n=t[15],v+=n*L,k+=n*U,y+=n*B,E+=n*j,A+=n*F,T+=n*G,S+=n*H,M+=n*z,R+=n*q,C+=n*W,P+=n*V,x+=n*Y,I+=n*Z,O+=n*$,N+=n*K,D+=n*X,s+=38*k,o+=38*y,a+=38*E,l+=38*A,f+=38*T,h+=38*S,u+=38*M,c+=38*R,d+=38*C,p+=38*P,b+=38*x,w+=38*I,m+=38*O,g+=38*N,_+=38*D,r=1,n=s+r+65535,r=Math.floor(n/65536),s=n-65536*r,n=o+r+65535,r=Math.floor(n/65536),o=n-65536*r,n=a+r+65535,r=Math.floor(n/65536),a=n-65536*r,n=l+r+65535,r=Math.floor(n/65536),l=n-65536*r,n=f+r+65535,r=Math.floor(n/65536),f=n-65536*r,n=h+r+65535,r=Math.floor(n/65536),h=n-65536*r,n=u+r+65535,r=Math.floor(n/65536),u=n-65536*r,n=c+r+65535,r=Math.floor(n/65536),c=n-65536*r,n=d+r+65535,r=Math.floor(n/65536),d=n-65536*r,n=p+r+65535,r=Math.floor(n/65536),p=n-65536*r,n=b+r+65535,r=Math.floor(n/65536),b=n-65536*r,n=w+r+65535,r=Math.floor(n/65536),w=n-65536*r,n=m+r+65535,r=Math.floor(n/65536),m=n-65536*r,n=g+r+65535,r=Math.floor(n/65536),g=n-65536*r,n=_+r+65535,r=Math.floor(n/65536),_=n-65536*r,n=v+r+65535,r=Math.floor(n/65536),v=n-65536*r,s+=r-1+37*(r-1),r=1,n=s+r+65535,r=Math.floor(n/65536),s=n-65536*r,n=o+r+65535,r=Math.floor(n/65536),o=n-65536*r,n=a+r+65535,r=Math.floor(n/65536),a=n-65536*r,n=l+r+65535,r=Math.floor(n/65536),l=n-65536*r,n=f+r+65535,r=Math.floor(n/65536),f=n-65536*r,n=h+r+65535,r=Math.floor(n/65536),h=n-65536*r,n=u+r+65535,r=Math.floor(n/65536),u=n-65536*r,n=c+r+65535,r=Math.floor(n/65536),c=n-65536*r,n=d+r+65535,r=Math.floor(n/65536),d=n-65536*r,n=p+r+65535,r=Math.floor(n/65536),p=n-65536*r,n=b+r+65535,r=Math.floor(n/65536),b=n-65536*r,n=w+r+65535,r=Math.floor(n/65536),w=n-65536*r,n=m+r+65535,r=Math.floor(n/65536),m=n-65536*r,n=g+r+65535,r=Math.floor(n/65536),g=n-65536*r,n=_+r+65535,r=Math.floor(n/65536),_=n-65536*r,n=v+r+65535,r=Math.floor(n/65536),v=n-65536*r,s+=r-1+37*(r-1),e[0]=s,e[1]=o,e[2]=a,e[3]=l,e[4]=f,e[5]=h,e[6]=u,e[7]=c,e[8]=d,e[9]=p,e[10]=b,e[11]=w,e[12]=m,e[13]=g;e[14]=_;e[15]=v}function R(e,t){M(e,t,t)}function C(e,t){var i,n=ee();for(i=0;i<16;i++)n[i]=t[i];for(i=253;i>=0;i--)R(n,n),2!==i&&4!==i&&M(n,n,t);for(i=0;i<16;i++)e[i]=n[i]}function P(e,t){var i,n=ee();for(i=0;i<16;i++)n[i]=t[i];for(i=250;i>=0;i--)R(n,n),1!==i&&M(n,n,t);for(i=0;i<16;i++)e[i]=n[i]}function x(e,t,i){var n,r,s=new Uint8Array(32),o=new Float64Array(80),a=ee(),l=ee(),f=ee(),h=ee(),u=ee(),c=ee();for(r=0;r<31;r++)s[r]=t[r];for(s[31]=127&t[31]|64,s[0]&=248,A(o,i),r=0;r<16;r++)l[r]=o[r],h[r]=a[r]=f[r]=0;for(a[0]=h[0]=1,r=254;r>=0;--r)n=s[r>>>3]>>>(7&r)&1, -v(a,l,n),v(f,h,n),T(u,a,f),S(a,a,f),T(f,l,h),S(l,l,h),R(h,u),R(c,a),M(a,f,a),M(f,l,u),T(u,a,f),S(a,a,f),R(l,a),S(f,h,c),M(a,f,oe),T(a,a,h),M(f,f,a),M(a,h,c),M(h,l,o),R(l,u),v(a,l,n),v(f,h,n);for(r=0;r<16;r++)o[r+16]=a[r],o[r+32]=f[r],o[r+48]=l[r],o[r+64]=h[r];var d=o.subarray(32),p=o.subarray(16);return C(d,d),M(p,p,d),k(e,p),0}function I(e,t){return x(e,t,ne)}function O(e,t){return te(t,32),I(e,t)}function N(e,t,i){var n=new Uint8Array(32);return x(n,i,t),f(e,ie,n,ce)}function D(e,t,i,n,r,s){var o=new Uint8Array(32);return N(o,r,s),pe(e,t,i,n,o)}function L(e,t,i,n,r,s){var o=new Uint8Array(32);return N(o,r,s),be(e,t,i,n,o)}function U(e,t,i,n){for(var r,s,o,a,l,f,h,u,c,d,p,b,w,m,g,_,v,k,y,E,A,T,S,M,R,C,P=new Int32Array(16),x=new Int32Array(16),I=e[0],O=e[1],N=e[2],D=e[3],L=e[4],U=e[5],B=e[6],j=e[7],F=t[0],G=t[1],H=t[2],z=t[3],q=t[4],W=t[5],V=t[6],Y=t[7],Z=0;n>=128;){for(y=0;y<16;y++)E=8*y+Z,P[y]=i[E+0]<<24|i[E+1]<<16|i[E+2]<<8|i[E+3],x[y]=i[E+4]<<24|i[E+5]<<16|i[E+6]<<8|i[E+7];for(y=0;y<80;y++)if(r=I,s=O,o=N,a=D,l=L,f=U,h=B,u=j,c=F,d=G,p=H,b=z,w=q,m=W,g=V,_=Y,A=j,T=Y,S=65535&T,M=T>>>16,R=65535&A,C=A>>>16,A=(L>>>14|q<<18)^(L>>>18|q<<14)^(q>>>9|L<<23),T=(q>>>14|L<<18)^(q>>>18|L<<14)^(L>>>9|q<<23),S+=65535&T,M+=T>>>16,R+=65535&A,C+=A>>>16,A=L&U^~L&B,T=q&W^~q&V,S+=65535&T,M+=T>>>16,R+=65535&A,C+=A>>>16,A=we[2*y],T=we[2*y+1],S+=65535&T,M+=T>>>16,R+=65535&A,C+=A>>>16,A=P[y%16],T=x[y%16],S+=65535&T,M+=T>>>16,R+=65535&A,C+=A>>>16,M+=S>>>16,R+=M>>>16,C+=R>>>16,v=65535&R|C<<16,k=65535&S|M<<16,A=v,T=k,S=65535&T,M=T>>>16,R=65535&A,C=A>>>16,A=(I>>>28|F<<4)^(F>>>2|I<<30)^(F>>>7|I<<25),T=(F>>>28|I<<4)^(I>>>2|F<<30)^(I>>>7|F<<25),S+=65535&T,M+=T>>>16,R+=65535&A,C+=A>>>16,A=I&O^I&N^O&N,T=F&G^F&H^G&H,S+=65535&T,M+=T>>>16,R+=65535&A,C+=A>>>16,M+=S>>>16,R+=M>>>16,C+=R>>>16,u=65535&R|C<<16,_=65535&S|M<<16,A=a,T=b,S=65535&T,M=T>>>16,R=65535&A,C=A>>>16,A=v,T=k,S+=65535&T,M+=T>>>16,R+=65535&A,C+=A>>>16,M+=S>>>16,R+=M>>>16,C+=R>>>16,a=65535&R|C<<16,b=65535&S|M<<16,O=r,N=s,D=o,L=a,U=l,B=f,j=h,I=u,G=c,H=d,z=p,q=b,W=w,V=m,Y=g,F=_,y%16===15)for(E=0;E<16;E++)A=P[E],T=x[E],S=65535&T,M=T>>>16,R=65535&A,C=A>>>16,A=P[(E+9)%16],T=x[(E+9)%16],S+=65535&T,M+=T>>>16,R+=65535&A,C+=A>>>16,v=P[(E+1)%16],k=x[(E+1)%16],A=(v>>>1|k<<31)^(v>>>8|k<<24)^v>>>7,T=(k>>>1|v<<31)^(k>>>8|v<<24)^(k>>>7|v<<25),S+=65535&T,M+=T>>>16,R+=65535&A,C+=A>>>16,v=P[(E+14)%16],k=x[(E+14)%16],A=(v>>>19|k<<13)^(k>>>29|v<<3)^v>>>6,T=(k>>>19|v<<13)^(v>>>29|k<<3)^(k>>>6|v<<26),S+=65535&T,M+=T>>>16,R+=65535&A,C+=A>>>16,M+=S>>>16,R+=M>>>16,C+=R>>>16,P[E]=65535&R|C<<16,x[E]=65535&S|M<<16;A=I,T=F,S=65535&T,M=T>>>16,R=65535&A,C=A>>>16,A=e[0],T=t[0],S+=65535&T,M+=T>>>16,R+=65535&A,C+=A>>>16,M+=S>>>16,R+=M>>>16,C+=R>>>16,e[0]=I=65535&R|C<<16,t[0]=F=65535&S|M<<16,A=O,T=G,S=65535&T,M=T>>>16,R=65535&A,C=A>>>16,A=e[1],T=t[1],S+=65535&T,M+=T>>>16,R+=65535&A,C+=A>>>16,M+=S>>>16,R+=M>>>16,C+=R>>>16,e[1]=O=65535&R|C<<16,t[1]=G=65535&S|M<<16,A=N,T=H,S=65535&T,M=T>>>16,R=65535&A,C=A>>>16,A=e[2],T=t[2],S+=65535&T,M+=T>>>16,R+=65535&A,C+=A>>>16,M+=S>>>16,R+=M>>>16,C+=R>>>16,e[2]=N=65535&R|C<<16,t[2]=H=65535&S|M<<16,A=D,T=z,S=65535&T,M=T>>>16,R=65535&A,C=A>>>16,A=e[3],T=t[3],S+=65535&T,M+=T>>>16,R+=65535&A,C+=A>>>16,M+=S>>>16,R+=M>>>16,C+=R>>>16,e[3]=D=65535&R|C<<16,t[3]=z=65535&S|M<<16,A=L,T=q,S=65535&T,M=T>>>16,R=65535&A,C=A>>>16,A=e[4],T=t[4],S+=65535&T,M+=T>>>16,R+=65535&A,C+=A>>>16,M+=S>>>16,R+=M>>>16,C+=R>>>16,e[4]=L=65535&R|C<<16,t[4]=q=65535&S|M<<16,A=U,T=W,S=65535&T,M=T>>>16,R=65535&A,C=A>>>16,A=e[5],T=t[5],S+=65535&T,M+=T>>>16,R+=65535&A,C+=A>>>16,M+=S>>>16,R+=M>>>16,C+=R>>>16,e[5]=U=65535&R|C<<16,t[5]=W=65535&S|M<<16,A=B,T=V,S=65535&T,M=T>>>16,R=65535&A,C=A>>>16,A=e[6],T=t[6],S+=65535&T,M+=T>>>16,R+=65535&A,C+=A>>>16,M+=S>>>16,R+=M>>>16,C+=R>>>16,e[6]=B=65535&R|C<<16,t[6]=V=65535&S|M<<16,A=j,T=Y,S=65535&T,M=T>>>16,R=65535&A,C=A>>>16,A=e[7],T=t[7],S+=65535&T,M+=T>>>16,R+=65535&A,C+=A>>>16,M+=S>>>16,R+=M>>>16,C+=R>>>16,e[7]=j=65535&R|C<<16,t[7]=Y=65535&S|M<<16,Z+=128,n-=128}return n}function B(e,i,n){var r,s=new Int32Array(8),o=new Int32Array(8),a=new Uint8Array(256),l=n;for(s[0]=1779033703,s[1]=3144134277,s[2]=1013904242,s[3]=2773480762,s[4]=1359893119,s[5]=2600822924,s[6]=528734635,s[7]=1541459225,o[0]=4089235720,o[1]=2227873595,o[2]=4271175723,o[3]=1595750129,o[4]=2917565137,o[5]=725511199,o[6]=4215389547,o[7]=327033209,U(s,o,i,n),n%=128,r=0;r=0;--r)n=i[r/8|0]>>(7&r)&1,F(e,t,n),j(t,e),j(e,e),F(e,t,n)}function z(e,t){var i=[ee(),ee(),ee(),ee()];g(i[0],fe),g(i[1],he),g(i[2],se),M(i[3],fe,he),H(e,i,t)}function q(e,t,i){var n,r=new Uint8Array(64),s=[ee(),ee(),ee(),ee()];for(i||te(t,32),B(r,t,32),r[0]&=248,r[31]&=127,r[31]|=64,z(s,r),G(e,s),n=0;n<32;n++)t[n+32]=e[n];return 0}function W(e,t){var i,n,r,s;for(n=63;n>=32;--n){for(i=0,r=n-32,s=n-12;r>8,t[r]-=256*i;t[r]+=i,t[n]=0}for(i=0,r=0;r<32;r++)t[r]+=i-(t[31]>>4)*me[r],i=t[r]>>8,t[r]&=255;for(r=0;r<32;r++)t[r]-=i*me[r];for(n=0;n<32;n++)t[n+1]+=t[n]>>8,e[n]=255&t[n]}function V(e){var t,i=new Float64Array(64);for(t=0;t<64;t++)i[t]=e[t];for(t=0;t<64;t++)e[t]=0;W(e,i)}function Y(e,t,i,n){var r,s,o=new Uint8Array(64),a=new Uint8Array(64),l=new Uint8Array(64),f=new Float64Array(64),h=[ee(),ee(),ee(),ee()];B(o,n,32),o[0]&=248,o[31]&=127,o[31]|=64;var u=i+64;for(r=0;r>7&&S(e[0],re,e[0]),M(e[3],e[0],e[1]),0)}function $(e,t,i,n){var r,o,a=new Uint8Array(32),l=new Uint8Array(64),f=[ee(),ee(),ee(),ee()],h=[ee(),ee(),ee(),ee()];if(o=-1,i<64)return-1;if(Z(h,n))return-1;for(r=0;r>>13|i<<3),n=255&e[4]|(255&e[5])<<8,this.r[2]=7939&(i>>>10|n<<6),r=255&e[6]|(255&e[7])<<8,this.r[3]=8191&(n>>>7|r<<9),s=255&e[8]|(255&e[9])<<8,this.r[4]=255&(r>>>4|s<<12),this.r[5]=s>>>1&8190,o=255&e[10]|(255&e[11])<<8,this.r[6]=8191&(s>>>14|o<<2),a=255&e[12]|(255&e[13])<<8,this.r[7]=8065&(o>>>11|a<<5),l=255&e[14]|(255&e[15])<<8,this.r[8]=8191&(a>>>8|l<<8),this.r[9]=l>>>5&127,this.pad[0]=255&e[16]|(255&e[17])<<8,this.pad[1]=255&e[18]|(255&e[19])<<8,this.pad[2]=255&e[20]|(255&e[21])<<8,this.pad[3]=255&e[22]|(255&e[23])<<8,this.pad[4]=255&e[24]|(255&e[25])<<8,this.pad[5]=255&e[26]|(255&e[27])<<8,this.pad[6]=255&e[28]|(255&e[29])<<8,this.pad[7]=255&e[30]|(255&e[31])<<8};de.prototype.blocks=function(e,t,i){for(var n,r,s,o,a,l,f,h,u,c,d,p,b,w,m,g,_,v,k,y=this.fin?0:2048,E=this.h[0],A=this.h[1],T=this.h[2],S=this.h[3],M=this.h[4],R=this.h[5],C=this.h[6],P=this.h[7],x=this.h[8],I=this.h[9],O=this.r[0],N=this.r[1],D=this.r[2],L=this.r[3],U=this.r[4],B=this.r[5],j=this.r[6],F=this.r[7],G=this.r[8],H=this.r[9];i>=16;)n=255&e[t+0]|(255&e[t+1])<<8,E+=8191&n,r=255&e[t+2]|(255&e[t+3])<<8,A+=8191&(n>>>13|r<<3),s=255&e[t+4]|(255&e[t+5])<<8,T+=8191&(r>>>10|s<<6),o=255&e[t+6]|(255&e[t+7])<<8,S+=8191&(s>>>7|o<<9),a=255&e[t+8]|(255&e[t+9])<<8,M+=8191&(o>>>4|a<<12),R+=a>>>1&8191,l=255&e[t+10]|(255&e[t+11])<<8,C+=8191&(a>>>14|l<<2),f=255&e[t+12]|(255&e[t+13])<<8,P+=8191&(l>>>11|f<<5),h=255&e[t+14]|(255&e[t+15])<<8,x+=8191&(f>>>8|h<<8),I+=h>>>5|y,u=0,c=u,c+=E*O,c+=A*(5*H),c+=T*(5*G),c+=S*(5*F),c+=M*(5*j),u=c>>>13,c&=8191,c+=R*(5*B),c+=C*(5*U),c+=P*(5*L),c+=x*(5*D),c+=I*(5*N),u+=c>>>13,c&=8191,d=u,d+=E*N,d+=A*O,d+=T*(5*H),d+=S*(5*G),d+=M*(5*F),u=d>>>13,d&=8191,d+=R*(5*j),d+=C*(5*B),d+=P*(5*U),d+=x*(5*L),d+=I*(5*D),u+=d>>>13,d&=8191,p=u,p+=E*D,p+=A*N,p+=T*O,p+=S*(5*H),p+=M*(5*G),u=p>>>13,p&=8191,p+=R*(5*F),p+=C*(5*j),p+=P*(5*B),p+=x*(5*U),p+=I*(5*L),u+=p>>>13,p&=8191,b=u,b+=E*L,b+=A*D,b+=T*N,b+=S*O,b+=M*(5*H),u=b>>>13,b&=8191,b+=R*(5*G),b+=C*(5*F),b+=P*(5*j),b+=x*(5*B),b+=I*(5*U),u+=b>>>13,b&=8191,w=u,w+=E*U,w+=A*L,w+=T*D,w+=S*N,w+=M*O,u=w>>>13,w&=8191,w+=R*(5*H),w+=C*(5*G),w+=P*(5*F),w+=x*(5*j),w+=I*(5*B),u+=w>>>13,w&=8191,m=u,m+=E*B,m+=A*U,m+=T*L,m+=S*D,m+=M*N,u=m>>>13,m&=8191,m+=R*O,m+=C*(5*H),m+=P*(5*G),m+=x*(5*F),m+=I*(5*j),u+=m>>>13,m&=8191,g=u,g+=E*j,g+=A*B,g+=T*U,g+=S*L,g+=M*D,u=g>>>13,g&=8191,g+=R*N,g+=C*O,g+=P*(5*H),g+=x*(5*G),g+=I*(5*F),u+=g>>>13,g&=8191,_=u,_+=E*F,_+=A*j,_+=T*B,_+=S*U,_+=M*L,u=_>>>13,_&=8191,_+=R*D,_+=C*N,_+=P*O,_+=x*(5*H),_+=I*(5*G),u+=_>>>13,_&=8191,v=u,v+=E*G,v+=A*F,v+=T*j,v+=S*B,v+=M*U,u=v>>>13,v&=8191,v+=R*L,v+=C*D,v+=P*N,v+=x*O,v+=I*(5*H),u+=v>>>13,v&=8191,k=u,k+=E*H,k+=A*G,k+=T*F,k+=S*j,k+=M*B,u=k>>>13,k&=8191,k+=R*U,k+=C*L,k+=P*D,k+=x*N,k+=I*O,u+=k>>>13,k&=8191,u=(u<<2)+u|0,u=u+c|0,c=8191&u,u>>>=13,d+=u,E=c,A=d,T=p,S=b,M=w,R=m,C=g,P=_,x=v,I=k,t+=16,i-=16;this.h[0]=E,this.h[1]=A,this.h[2]=T,this.h[3]=S,this.h[4]=M,this.h[5]=R,this.h[6]=C,this.h[7]=P,this.h[8]=x,this.h[9]=I},de.prototype.finish=function(e,t){var i,n,r,s,o=new Uint16Array(10);if(this.leftover){for(s=this.leftover,this.buffer[s++]=1;s<16;s++)this.buffer[s]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(i=this.h[1]>>>13,this.h[1]&=8191,s=2;s<10;s++)this.h[s]+=i,i=this.h[s]>>>13,this.h[s]&=8191;for(this.h[0]+=5*i,i=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=i,i=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=i,o[0]=this.h[0]+5,i=o[0]>>>13,o[0]&=8191,s=1;s<10;s++)o[s]=this.h[s]+i,i=o[s]>>>13,o[s]&=8191;for(o[9]-=8192,n=(1^i)-1,s=0;s<10;s++)o[s]&=n;for(n=~n,s=0;s<10;s++)this.h[s]=this.h[s]&n|o[s];for(this.h[0]=65535&(this.h[0]|this.h[1]<<13),this.h[1]=65535&(this.h[1]>>>3|this.h[2]<<10),this.h[2]=65535&(this.h[2]>>>6|this.h[3]<<7),this.h[3]=65535&(this.h[3]>>>9|this.h[4]<<4),this.h[4]=65535&(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14),this.h[5]=65535&(this.h[6]>>>2|this.h[7]<<11),this.h[6]=65535&(this.h[7]>>>5|this.h[8]<<8),this.h[7]=65535&(this.h[8]>>>8|this.h[9]<<5),r=this.h[0]+this.pad[0],this.h[0]=65535&r,s=1;s<8;s++)r=(this.h[s]+this.pad[s]|0)+(r>>>16)|0,this.h[s]=65535&r;e[t+0]=this.h[0]>>>0&255,e[t+1]=this.h[0]>>>8&255,e[t+2]=this.h[1]>>>0&255,e[t+3]=this.h[1]>>>8&255,e[t+4]=this.h[2]>>>0&255,e[t+5]=this.h[2]>>>8&255,e[t+6]=this.h[3]>>>0&255,e[t+7]=this.h[3]>>>8&255,e[t+8]=this.h[4]>>>0&255,e[t+9]=this.h[4]>>>8&255,e[t+10]=this.h[5]>>>0&255,e[t+11]=this.h[5]>>>8&255,e[t+12]=this.h[6]>>>0&255,e[t+13]=this.h[6]>>>8&255,e[t+14]=this.h[7]>>>0&255,e[t+15]=this.h[7]>>>8&255},de.prototype.update=function(e,t,i){var n,r;if(this.leftover){for(r=16-this.leftover,r>i&&(r=i),n=0;n=16&&(r=i-i%16,this.blocks(e,t,r),t+=r,i-=r),i){for(n=0;n=0},e.sign.keyPair=function(){var e=new Uint8Array(xe),t=new Uint8Array(Ie);return q(e,t),{publicKey:e,secretKey:t}},e.sign.keyPair.fromSecretKey=function(e){if(J(e),e.length!==Ie)throw new Error("bad secret key size");for(var t=new Uint8Array(xe),i=0;i{const t=+e.readUInt32BE(8).toString(10),i=this.voiceConnection.ssrcMap.get(t);if(i){if(this.queues.get(t))return this.queues.get(t).push(e),this.queues.get(t).map(e=>this.handlePacket(e,i)),void this.queues.delete(t);this.handlePacket(e,i)}else this.queues.has(t)||this.queues.set(t,[]),this.queues.get(t).push(e)}),this.voiceConnection.sockets.udp.socket.on("message",this._listener)}recreate(){this.destroyed&&(this.voiceConnection.sockets.udp.socket.on("message",this._listener),this.destroyed=!1)}destroy(){this.voiceConnection.sockets.udp.socket.removeListener("message",this._listener);for(const e of this.pcmStreams)e[1]._push(null),this.pcmStreams.delete(e[0]);for(const e of this.opusStreams)e[1]._push(null),this.opusStreams.delete(e[0]);this.destroyed=!0}createOpusStream(e){if(e=this.voiceConnection.voiceManager.client.resolver.resolveUser(e),!e)throw new Error("Couldn't resolve the user to create Opus stream.");if(this.opusStreams.get(e.id))throw new Error("There is already an existing stream for that user.");const t=new s;return this.opusStreams.set(e.id,t),t}createPCMStream(e){if(e=this.voiceConnection.voiceManager.client.resolver.resolveUser(e),!e)throw new Error("Couldn't resolve the user to create PCM stream.");if(this.pcmStreams.get(e.id))throw new Error("There is already an existing stream for that user.");const t=new s;return this.pcmStreams.set(e.id,t),t}handlePacket(e,i){e.copy(o,0,0,12);let n=r.secretbox.open(e.slice(12),o,this.voiceConnection.authentication.secretKey.key);if(!n)return void this.emit("warn","Failed to decrypt voice packet");if(n=new t(n),this.opusStreams.get(i.id)&&this.opusStreams.get(i.id)._push(n),this.emit("opus",i,n),this.listenerCount("pcm")>0||this.pcmStreams.size>0){const e=this.voiceConnection.player.opusEncoder.decode(n);this.pcmStreams.get(i.id)&&this.pcmStreams.get(i.id)._push(e),this.emit("pcm",i,e)}}}e.exports=a}).call(t,i(58).Buffer)},function(e,t,i){const n=i(80).Readable;class r extends n{constructor(){super(),this._packets=[],this.open=!0}_read(){}_push(e){this.open&&this.push(e)}}e.exports=r},function(e,t,i){const n="undefined"!=typeof window,r=n?window.WebSocket:i(67),s=i(3).EventEmitter,o=i(5),a=n?i(177).inflateSync:i(126).inflateSync,l=i(178),f=i(63);class h extends s{constructor(e){super(),this.client=e,this.packetManager=new l(this),this.status=o.Status.IDLE,this.sessionID=null,this.sequence=-1,this.gateway=null,this.normalReady=!1,this.ws=null,this.disabledEvents={};for(const t in e.options.disabledEvents)this.disabledEvents[t]=!0;this.first=!0}_connect(e){this.client.emit("debug",`Connecting to gateway ${e}`),this.normalReady=!1,this.status!==o.Status.RECONNECTING&&(this.status=o.Status.CONNECTING),this.ws=new r(e),n&&(this.ws.binaryType="arraybuffer"),this.ws.onopen=(()=>this.eventOpen()),this.ws.onclose=(e=>this.eventClose(e)),this.ws.onmessage=(e=>this.eventMessage(e)),this.ws.onerror=(e=>this.eventError(e)),this._queue=[],this._remaining=3}connect(e){this.first?(this._connect(e),this.first=!1):this.client.setTimeout(()=>this._connect(e),5500)}send(e,t=false){return t?void this._send(JSON.stringify(e)):(this._queue.push(JSON.stringify(e)),void this.doQueue())}destroy(){this.ws.close(1e3),this._queue=[],this.status=o.Status.IDLE}_send(e){this.ws.readyState===r.OPEN&&(this.emit("send",e),this.ws.send(e))}doQueue(){const e=this._queue[0];if(this.ws.readyState===r.OPEN&&e){if(0===this._remaining)return void this.client.setTimeout(()=>{this.doQueue()},1e3);this._remaining--,this._send(e),this._queue.shift(),this.doQueue(),this.client.setTimeout(()=>this._remaining++,1e3)}}eventOpen(){this.client.emit("debug","Connection to gateway opened"),this.status===o.Status.RECONNECTING?this._sendResume():this._sendNewIdentify()}_sendResume(){if(!this.sessionID)return void this._sendNewIdentify();this.client.emit("debug","Identifying as resumed session");const e={token:this.client.token,session_id:this.sessionID,seq:this.sequence};this.send({op:o.OPCodes.RESUME,d:e})}_sendNewIdentify(){this.reconnecting=!1;const e=this.client.options.ws;e.token=this.client.token,this.client.options.shardCount>0&&(e.shard=[Number(this.client.options.shardId),Number(this.client.options.shardCount)]),this.client.emit("debug","Identifying as new session"),this.send({op:o.OPCodes.IDENTIFY,d:e}),this.sequence=-1}eventClose(e){this.emit("close",e),this.client.clearInterval(this.client.manager.heartbeatInterval),this.reconnecting||this.client.emit(o.Events.DISCONNECT),4004!==e.code&&4010!==e.code&&(this.reconnecting||1e3===e.code||this.tryReconnect())}eventMessage(e){let t=e.data;try{"string"!=typeof t&&(t instanceof ArrayBuffer&&(t=f(t)),t=a(t).toString()),t=JSON.parse(t)}catch(e){return this.eventError(new Error(o.Errors.BAD_WS_MESSAGE))}return this.client.emit("raw",t),t.op===o.OPCodes.HELLO&&this.client.manager.setupKeepAlive(t.d.heartbeat_interval),this.packetManager.handle(t)}eventError(e){this.client.listenerCount("error")>0&&this.client.emit("error",e),this.ws.close()}_emitReady(e=true){this.status=o.Status.READY,this.client.emit(o.Events.READY),this.packetManager.handleQueue(),this.normalReady=e}checkIfReady(){if(this.status!==o.Status.READY&&this.status!==o.Status.NEARLY){let e=0;for(const t of this.client.guilds.keys())e+=this.client.guilds.get(t).available?0:1;if(0===e){if(this.status=o.Status.NEARLY,this.client.options.fetchAllMembers){const e=this.client.guilds.map(e=>e.fetchMembers());return void Promise.all(e).then(()=>this._emitReady(),e=>{this.client.emit(o.Events.WARN,"Error in pre-ready guild member fetching"),this.client.emit(o.Events.ERROR,e),this._emitReady()})}this._emitReady()}}}tryReconnect(){this.status=o.Status.RECONNECTING,this.ws.close(),this.packetManager.handleQueue(),this.client.emit(o.Events.RECONNECTING),this.connect(this.client.ws.gateway)}}e.exports=h},function(e,t,i){(function(e,i){/** @license zlib.js 2012 - imaya [ https://github.com/imaya/zlib.js ] The MIT License */(function(){"use strict";function n(e){throw e}function r(e,t){this.index="number"==typeof t?t:0,this.m=0,this.buffer=e instanceof(L?Uint8Array:Array)?e:new(L?Uint8Array:Array)(32768),2*this.buffer.length<=this.index&&n(Error("invalid index")),this.buffer.length<=this.index&&this.f()}function s(e,t,i){var n,r="number"==typeof t?t:t=0,s="number"==typeof i?i:e.length;for(n=-1,r=7&s;r--;++t)n=n>>>8^q[255&(n^e[t])];for(r=s>>3;r--;t+=8)n=n>>>8^q[255&(n^e[t])],n=n>>>8^q[255&(n^e[t+1])],n=n>>>8^q[255&(n^e[t+2])],n=n>>>8^q[255&(n^e[t+3])],n=n>>>8^q[255&(n^e[t+4])],n=n>>>8^q[255&(n^e[t+5])],n=n>>>8^q[255&(n^e[t+6])],n=n>>>8^q[255&(n^e[t+7])];return(4294967295^n)>>>0}function o(){}function a(e){this.buffer=new(L?Uint16Array:Array)(2*e),this.length=0}function l(e){var t,i,n,r,s,o,a,l,f,h,u=e.length,c=0,d=Number.POSITIVE_INFINITY;for(l=0;lc&&(c=e[l]),e[l]>=1;for(h=n<<16|l,f=o;f>16&255,s[o++]=i>>24;var a;switch(D){case 1===r:a=[0,r-1,0];break;case 2===r:a=[1,r-2,0];break;case 3===r:a=[2,r-3,0];break;case 4===r:a=[3,r-4,0];break;case 6>=r:a=[4,r-5,1];break;case 8>=r:a=[5,r-7,1];break;case 12>=r:a=[6,r-9,2];break;case 16>=r:a=[7,r-13,2];break;case 24>=r:a=[8,r-17,3];break;case 32>=r:a=[9,r-25,3];break;case 48>=r:a=[10,r-33,4];break;case 64>=r:a=[11,r-49,4];break;case 96>=r:a=[12,r-65,5];break;case 128>=r:a=[13,r-97,5];break;case 192>=r:a=[14,r-129,6];break;case 256>=r:a=[15,r-193,6];break;case 384>=r:a=[16,r-257,7];break;case 512>=r:a=[17,r-385,7];break;case 768>=r:a=[18,r-513,8];break;case 1024>=r:a=[19,r-769,8];break;case 1536>=r:a=[20,r-1025,9];break;case 2048>=r:a=[21,r-1537,9];break;case 3072>=r:a=[22,r-2049,10];break;case 4096>=r:a=[23,r-3073,10];break;case 6144>=r:a=[24,r-4097,11];break;case 8192>=r:a=[25,r-6145,11];break;case 12288>=r:a=[26,r-8193,12];break;case 16384>=r:a=[27,r-12289,12];break;case 24576>=r:a=[28,r-16385,13];break;case 32768>=r:a=[29,r-24577,13];break;default:n("invalid distance")}i=a,s[o++]=i[0],s[o++]=i[1],s[o++]=i[2];var l,f;for(l=0,f=s.length;l=o;)g[o++]=0;for(o=0;29>=o;)_[o++]=0}for(g[256]=1,r=0,s=t.length;r=s){for(u&&i(u,-1),o=0,a=s-r;os&&t+sf&&(r=n,f=s),258===s)break}return new h(f,t-r)}function d(e,t){var i,n,r,s,o,l=e.length,f=new a(572),h=new(L?Uint8Array:Array)(l);if(!L)for(s=0;s2*f[s-1]+h[s]&&(f[s]=2*f[s-1]+h[s]),c[s]=Array(f[s]),d[s]=Array(f[s]);for(r=0;re[r]?(c[s][o]=a,d[s][o]=t,l+=2):(c[s][o]=e[r],d[s][o]=r,++r);p[s]=0,1===h[s]&&n(s)}return u}function b(e){var t,i,n,r,s=new(L?Uint16Array:Array)(e.length),o=[],a=[],l=0;for(t=0,i=e.length;t>>=1;return s}function w(e,t){this.input=e,this.b=this.c=0,this.g={},t&&(t.flags&&(this.g=t.flags),"string"==typeof t.filename&&(this.filename=t.filename),"string"==typeof t.comment&&(this.w=t.comment),t.deflateOptions&&(this.l=t.deflateOptions)),this.l||(this.l={})}function m(e,t){switch(this.o=[],this.p=32768,this.e=this.j=this.c=this.s=0,this.input=L?new Uint8Array(e):e,this.u=!1,this.q=ie,this.L=!1,!t&&(t={})||(t.index&&(this.c=t.index), -t.bufferSize&&(this.p=t.bufferSize),t.bufferType&&(this.q=t.bufferType),t.resize&&(this.L=t.resize)),this.q){case te:this.b=32768,this.a=new(L?Uint8Array:Array)(32768+this.p+258);break;case ie:this.b=0,this.a=new(L?Uint8Array:Array)(this.p),this.f=this.T,this.z=this.P,this.r=this.R;break;default:n(Error("invalid inflate mode"))}}function g(e,t){for(var i,r=e.j,s=e.e,o=e.input,a=e.c,l=o.length;s=l&&n(Error("input buffer is broken")),r|=o[a++]<>>t,e.e=s-t,e.c=a,i}function _(e,t){for(var i,n,r=e.j,s=e.e,o=e.input,a=e.c,l=o.length,f=t[0],h=t[1];s=l);)r|=o[a++]<>>16,e.j=r>>n,e.e=s-n,e.c=a,65535&i}function v(e){function t(e,t,i){var n,r,s,o=this.I;for(s=0;s>>0;e=n}for(var r,s=1,o=0,a=e.length,l=0;0>>0}function E(e,t){var i,r;switch(this.input=e,this.c=0,!t&&(t={})||(t.index&&(this.c=t.index),t.verify&&(this.W=t.verify)),i=e[this.c++],r=e[this.c++],15&i){case ke:this.method=ke;break;default:n(Error("unsupported compression method"))}0!==((i<<8)+r)%31&&n(Error("invalid fcheck flag:"+((i<<8)+r)%31)),32&r&&n(Error("fdict flag is not supported")),this.K=new m(e,{index:this.c,bufferSize:t.bufferSize,bufferType:t.bufferType,resize:t.resize})}function A(e,t){this.input=e,this.a=new(L?Uint8Array:Array)(32768),this.k=ye.t;var i,n={};!t&&(t={})||"number"!=typeof t.compressionType||(this.k=t.compressionType);for(i in t)n[i]=t[i];n.outputBuffer=this.a,this.J=new f(this.input,n)}function T(t,i,n){e.nextTick(function(){var e,r;try{r=S(t,n)}catch(t){e=t}i(e,r)})}function S(e,t){var i;return i=new A(e).h(),t||(t={}),t.H?i:O(i)}function M(t,i,n){e.nextTick(function(){var e,r;try{r=R(t,n)}catch(t){e=t}i(e,r)})}function R(e,t){var i;return e.subarray=e.slice,i=new E(e).i(),t||(t={}),t.noBuffer?i:O(i)}function C(t,i,n){e.nextTick(function(){var e,r;try{r=P(t,n)}catch(t){e=t}i(e,r)})}function P(e,t){var i;return e.subarray=e.slice,i=new w(e).h(),t||(t={}),t.H?i:O(i)}function x(t,i,n){e.nextTick(function(){var e,r;try{r=I(t,n)}catch(t){e=t}i(e,r)})}function I(e,t){var i;return e.subarray=e.slice,i=new k(e).i(),t||(t={}),t.H?i:O(i)}function O(e){var t,n,r=new i(e.length);for(t=0,n=e.length;t>>8&255]<<16|H[e>>>16&255]<<8|H[e>>>24&255])>>32-t:H[e]>>8-t),8>t+o)a=a<>t-n-1&1,8===++o&&(o=0,r[s++]=H[a],a=0,s===r.length&&(r=this.f()));r[s]=a,this.buffer=r,this.m=o,this.index=s},r.prototype.finish=function(){var e,t=this.buffer,i=this.index;return 0U;++U){for(var j=U,F=j,G=7,j=j>>>1;j;j>>>=1)F<<=1,F|=1&j,--G;B[U]=(F<>>0}var H=B,z=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117],q=L?new Uint32Array(z):z;a.prototype.getParent=function(e){return 2*((e-2)/4|0)},a.prototype.push=function(e,t){var i,n,r,s=this.buffer;for(i=this.length,s[this.length++]=t,s[this.length++]=e;0s[n]);)r=s[i],s[i]=s[n],s[n]=r,r=s[i+1],s[i+1]=s[n+1],s[n+1]=r,i=n;return this.length},a.prototype.pop=function(){var e,t,i,n,r,s=this.buffer;for(t=s[0],e=s[1],this.length-=2,s[0]=s[this.length],s[1]=s[this.length+1],r=0;(n=2*r+2,!(n>=this.length))&&(n+2s[n]&&(n+=2),s[n]>s[r]);)i=s[r],s[r]=s[n],s[n]=i,i=s[r+1],s[r+1]=s[n+1],s[n+1]=i,r=n;return{index:e,value:t,length:this.length}};var W,V=2,Y={NONE:0,M:1,t:V,Y:3},Z=[];for(W=0;288>W;W++)switch(D){case 143>=W:Z.push([W+48,8]);break;case 255>=W:Z.push([W-144+400,9]);break;case 279>=W:Z.push([W-256+0,7]);break;case 287>=W:Z.push([W-280+192,8]);break;default:n("invalid literal: "+W)}f.prototype.h=function(){var e,t,i,s,o=this.input;switch(this.k){case 0:for(i=0,s=o.length;i>>8&255,m[g++]=255&c,m[g++]=c>>>8&255,L)m.set(a,g),g+=a.length,m=m.subarray(0,g);else{for(p=0,w=a.length;p$)for(;0<$--;)ie[X++]=0,ne[0]++;else for(;0<$;)J=138>$?$:138,J>$-3&&J<$&&(J=$-3),10>=J?(ie[X++]=17,ie[X++]=J-3,ne[17]++):(ie[X++]=18,ie[X++]=J-11,ne[18]++),$-=J;else if(ie[X++]=te[W],ne[te[W]]++,$--,3>$)for(;0<$--;)ie[X++]=te[W],ne[te[W]]++;else for(;0<$;)J=6>$?$:6,J>$-3&&J<$&&(J=$-3),ie[X++]=16,ie[X++]=J-3,ne[16]++,$-=J}for(e=L?ie.subarray(0,X):ie.slice(0,X),O=d(ne,7),F=0;19>F;F++)q[F]=O[z[F]];for(R=19;4=e:return[265,e-11,1];case 14>=e:return[266,e-13,1];case 16>=e:return[267,e-15,1];case 18>=e:return[268,e-17,1];case 22>=e:return[269,e-19,2];case 26>=e:return[270,e-23,2];case 30>=e:return[271,e-27,2];case 34>=e:return[272,e-31,2];case 42>=e:return[273,e-35,3];case 50>=e:return[274,e-43,3];case 58>=e:return[275,e-51,3];case 66>=e:return[276,e-59,3];case 82>=e:return[277,e-67,4];case 98>=e:return[278,e-83,4];case 114>=e:return[279,e-99,4];case 130>=e:return[280,e-115,4];case 162>=e:return[281,e-131,5];case 194>=e:return[282,e-163,5];case 226>=e:return[283,e-195,5];case 257>=e:return[284,e-227,5];case 258===e:return[285,e-258,0];default:n("invalid length: "+e)}}var t,i,r=[];for(t=3;258>=t;t++)i=e(t),r[t]=i[2]<<24|i[1]<<16|i[0];return r}(),K=L?new Uint32Array($):$;w.prototype.h=function(){var e,t,i,n,r,o,a,l,h=new(L?Uint8Array:Array)(32768),u=0,c=this.input,d=this.c,p=this.filename,b=this.w;if(h[u++]=31,h[u++]=139,h[u++]=8,e=0,this.g.fname&&(e|=Q),this.g.fcomment&&(e|=ee),this.g.fhcrc&&(e|=J),h[u++]=e,t=(Date.now?Date.now():+new Date)/1e3|0,h[u++]=255&t,h[u++]=t>>>8&255,h[u++]=t>>>16&255,h[u++]=t>>>24&255,h[u++]=0,h[u++]=X,this.g.fname!==N){for(a=0,l=p.length;a>>8&255),h[u++]=255&o;h[u++]=0}if(this.g.comment){for(a=0,l=b.length;a>>8&255),h[u++]=255&o;h[u++]=0}return this.g.fhcrc&&(i=65535&s(h,0,u),h[u++]=255&i,h[u++]=i>>>8&255),this.l.outputBuffer=h,this.l.outputIndex=u,r=new f(c,this.l),h=r.h(),u=r.b,L&&(u+8>h.buffer.byteLength?(this.a=new Uint8Array(u+8),this.a.set(new Uint8Array(h.buffer)),h=this.a):h=new Uint8Array(h.buffer)),n=s(c,N,N),h[u++]=255&n,h[u++]=n>>>8&255,h[u++]=n>>>16&255,h[u++]=n>>>24&255,l=c.length,h[u++]=255&l,h[u++]=l>>>8&255,h[u++]=l>>>16&255,h[u++]=l>>>24&255,this.c=d,L&&u>>=1){case 0:var t=this.input,i=this.c,r=this.a,s=this.b,o=t.length,a=N,l=N,f=r.length,h=N;switch(this.e=this.j=0,i+1>=o&&n(Error("invalid uncompressed block header: LEN")),a=t[i++]|t[i++]<<8,i+1>=o&&n(Error("invalid uncompressed block header: NLEN")),l=t[i++]|t[i++]<<8,a===~l&&n(Error("invalid uncompressed block header: length verify")),i+a>t.length&&n(Error("input buffer is broken")),this.q){case te:for(;s+a>r.length;){if(h=f-s,a-=h,L)r.set(t.subarray(i,i+h),s),s+=h,i+=h;else for(;h--;)r[s++]=t[i++];this.b=s,r=this.f(),s=this.b}break;case ie:for(;s+a>r.length;)r=this.f({B:2});break;default:n(Error("invalid inflate mode"))}if(L)r.set(t.subarray(i,i+a),s),s+=a,i+=a;else for(;a--;)r[s++]=t[i++];this.c=i,this.b=s,this.a=r;break;case 1:this.r(ge,ve);break;case 2:v(this);break;default:n(Error("unknown BTYPE: "+e))}}return this.z()};var ne,re,se=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],oe=L?new Uint16Array(se):se,ae=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,258,258],le=L?new Uint16Array(ae):ae,fe=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0],he=L?new Uint8Array(fe):fe,ue=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577],ce=L?new Uint16Array(ue):ue,de=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],pe=L?new Uint8Array(de):de,be=new(L?Uint8Array:Array)(288);for(ne=0,re=be.length;ne=ne?8:255>=ne?9:279>=ne?7:8;var we,me,ge=l(be),_e=new(L?Uint8Array:Array)(30);for(we=0,me=_e.length;wer)n>=l&&(this.b=n,i=this.f(),n=this.b),i[n++]=r;else for(s=r-257,a=le[s],0=l&&(this.b=n,i=this.f(),n=this.b);a--;)i[n]=i[n++-o];for(;8<=this.e;)this.e-=8,this.c--;this.b=n},m.prototype.R=function(e,t){var i=this.a,n=this.b;this.A=e;for(var r,s,o,a,l=i.length;256!==(r=_(this,e));)if(256>r)n>=l&&(i=this.f(),l=i.length),i[n++]=r;else for(s=r-257,a=le[s],0l&&(i=this.f(),l=i.length);a--;)i[n]=i[n++-o];for(;8<=this.e;)this.e-=8,this.c--;this.b=n},m.prototype.f=function(){var e,t,i=new(L?Uint8Array:Array)(this.b-32768),n=this.b-32768,r=this.a;if(L)i.set(r.subarray(32768,i.length));else for(e=0,t=i.length;ee;++e)r[e]=r[n+e];return this.b=32768,r},m.prototype.T=function(e){var t,i,n,r,s=this.input.length/this.c+1|0,o=this.input,a=this.a;return e&&("number"==typeof e.B&&(s=e.B),"number"==typeof e.N&&(s+=e.N)),2>s?(i=(o.length-this.c)/this.A[2],r=258*(i/2)|0,n=rt&&(this.a.length=t),e=this.a),this.buffer=e},k.prototype.i=function(){for(var e=this.input.length;this.c>>0,s(a,N,N)!==d&&n(Error("invalid CRC-32 checksum: 0x"+s(a,N,N).toString(16)+" / 0x"+d.toString(16))),t.$=i=(p[b++]|p[b++]<<8|p[b++]<<16|p[b++]<<24)>>>0,(4294967295&a.length)!==i&&n(Error("invalid input size: "+(4294967295&a.length)+" / "+i)),this.G.push(t),this.c=b}this.S=D;var w,g,_,v=this.G,k=0,y=0;for(w=0,g=v.length;w>>0,t!==y(e)&&n(Error("invalid adler-32 checksum"))),e};var ke=8,ye=Y;A.prototype.h=function(){var e,t,i,r,s,o,a,l=0;switch(a=this.a,e=ke){case ke:t=Math.LOG2E*Math.log(32768)-8;break;default:n(Error("invalid compression method"))}switch(i=t<<4|e,a[l++]=i,e){case ke:switch(this.k){case ye.NONE:s=0;break;case ye.M:s=1;break;case ye.t:s=2;break;default:n(Error("unsupported compression type"))}break;default:n(Error("invalid compression method"))}return r=s<<6|0,a[l++]=r|31-(256*i+r)%31,o=y(this.input),this.J.b=l,a=this.J.h(),l=a.length,L&&(a=new Uint8Array(a.buffer),a.length<=l+4&&(this.a=new Uint8Array(a.length+4),this.a.set(a),a=this.a),a=a.subarray(0,l+4)),a[l++]=o>>24&255,a[l++]=o>>16&255,a[l++]=o>>8&255,a[l++]=255&o,a},t.deflate=T,t.deflateSync=S,t.inflate=M,t.inflateSync=R,t.gzip=C,t.gzipSync=P,t.gunzip=x,t.gunzipSync=I}).call(this)}).call(t,i(2),i(58).Buffer)},function(e,t,i){const n=i(5),r=[n.WSEvents.READY,n.WSEvents.GUILD_CREATE,n.WSEvents.GUILD_DELETE,n.WSEvents.GUILD_MEMBERS_CHUNK,n.WSEvents.GUILD_MEMBER_ADD,n.WSEvents.GUILD_MEMBER_REMOVE];class s{constructor(e){this.ws=e,this.handlers={},this.queue=[],this.register(n.WSEvents.READY,"Ready"),this.register(n.WSEvents.GUILD_CREATE,"GuildCreate"),this.register(n.WSEvents.GUILD_DELETE,"GuildDelete"),this.register(n.WSEvents.GUILD_UPDATE,"GuildUpdate"),this.register(n.WSEvents.GUILD_BAN_ADD,"GuildBanAdd"),this.register(n.WSEvents.GUILD_BAN_REMOVE,"GuildBanRemove"),this.register(n.WSEvents.GUILD_MEMBER_ADD,"GuildMemberAdd"),this.register(n.WSEvents.GUILD_MEMBER_REMOVE,"GuildMemberRemove"),this.register(n.WSEvents.GUILD_MEMBER_UPDATE,"GuildMemberUpdate"),this.register(n.WSEvents.GUILD_ROLE_CREATE,"GuildRoleCreate"),this.register(n.WSEvents.GUILD_ROLE_DELETE,"GuildRoleDelete"),this.register(n.WSEvents.GUILD_ROLE_UPDATE,"GuildRoleUpdate"),this.register(n.WSEvents.GUILD_MEMBERS_CHUNK,"GuildMembersChunk"),this.register(n.WSEvents.CHANNEL_CREATE,"ChannelCreate"),this.register(n.WSEvents.CHANNEL_DELETE,"ChannelDelete"),this.register(n.WSEvents.CHANNEL_UPDATE,"ChannelUpdate"),this.register(n.WSEvents.PRESENCE_UPDATE,"PresenceUpdate"),this.register(n.WSEvents.USER_UPDATE,"UserUpdate"),this.register(n.WSEvents.USER_NOTE_UPDATE,"UserNoteUpdate"),this.register(n.WSEvents.VOICE_STATE_UPDATE,"VoiceStateUpdate"),this.register(n.WSEvents.TYPING_START,"TypingStart"),this.register(n.WSEvents.MESSAGE_CREATE,"MessageCreate"),this.register(n.WSEvents.MESSAGE_DELETE,"MessageDelete"),this.register(n.WSEvents.MESSAGE_UPDATE,"MessageUpdate"),this.register(n.WSEvents.VOICE_SERVER_UPDATE,"VoiceServerUpdate"),this.register(n.WSEvents.MESSAGE_DELETE_BULK,"MessageDeleteBulk"),this.register(n.WSEvents.CHANNEL_PINS_UPDATE,"ChannelPinsUpdate"),this.register(n.WSEvents.GUILD_SYNC,"GuildSync"),this.register(n.WSEvents.RELATIONSHIP_ADD,"RelationshipAdd"),this.register(n.WSEvents.RELATIONSHIP_REMOVE,"RelationshipRemove"),this.register(n.WSEvents.MESSAGE_REACTION_ADD,"MessageReactionAdd"),this.register(n.WSEvents.MESSAGE_REACTION_REMOVE,"MessageReactionRemove"),this.register(n.WSEvents.MESSAGE_REACTION_REMOVE_ALL,"MessageReactionRemoveAll")}get client(){return this.ws.client}register(e,t){const n=i(179)(`./handlers/${t}`);this.handlers[e]=new n(this)}handleQueue(){this.queue.forEach((e,t)=>{this.handle(this.queue[t]),this.queue.splice(t,1)})}setSequence(e){e&&e>this.ws.sequence&&(this.ws.sequence=e)}handle(e){return e.op===n.OPCodes.RECONNECT?(this.setSequence(e.s),this.ws.tryReconnect(),!1):e.op===n.OPCodes.INVALID_SESSION?(this.ws.sessionID=null,this.ws._sendNewIdentify(),!1):(e.op===n.OPCodes.HEARTBEAT_ACK&&this.ws.client.emit("debug","Heartbeat acknowledged"),this.ws.status===n.Status.RECONNECTING&&(this.ws.reconnecting=!1,this.ws.checkIfReady()),this.setSequence(e.s),void 0===this.ws.disabledEvents[e.t]&&(this.ws.status!==n.Status.READY&&r.indexOf(e.t)===-1?(this.queue.push(e),!1):!!this.handlers[e.t]&&this.handlers[e.t].handle(e)))}}e.exports=s},function(e,t,i){function n(e){return i(r(e))}function r(e){return s[e]||function(){throw new Error("Cannot find module '"+e+"'.")}()}var s={"./WebSocketPacketManager":178,"./WebSocketPacketManager.js":178,"./handlers/AbstractHandler":180,"./handlers/AbstractHandler.js":180,"./handlers/ChannelCreate":181,"./handlers/ChannelCreate.js":181,"./handlers/ChannelDelete":182,"./handlers/ChannelDelete.js":182,"./handlers/ChannelPinsUpdate":183,"./handlers/ChannelPinsUpdate.js":183,"./handlers/ChannelUpdate":184,"./handlers/ChannelUpdate.js":184,"./handlers/GuildBanAdd":185,"./handlers/GuildBanAdd.js":185,"./handlers/GuildBanRemove":186,"./handlers/GuildBanRemove.js":186,"./handlers/GuildCreate":187,"./handlers/GuildCreate.js":187,"./handlers/GuildDelete":188,"./handlers/GuildDelete.js":188,"./handlers/GuildEmojiUpdate":189,"./handlers/GuildEmojiUpdate.js":189,"./handlers/GuildMemberAdd":190,"./handlers/GuildMemberAdd.js":190,"./handlers/GuildMemberRemove":191,"./handlers/GuildMemberRemove.js":191,"./handlers/GuildMemberUpdate":192,"./handlers/GuildMemberUpdate.js":192,"./handlers/GuildMembersChunk":193,"./handlers/GuildMembersChunk.js":193,"./handlers/GuildRoleCreate":194,"./handlers/GuildRoleCreate.js":194,"./handlers/GuildRoleDelete":195,"./handlers/GuildRoleDelete.js":195,"./handlers/GuildRoleUpdate":196,"./handlers/GuildRoleUpdate.js":196,"./handlers/GuildSync":197,"./handlers/GuildSync.js":197,"./handlers/GuildUpdate":198,"./handlers/GuildUpdate.js":198,"./handlers/MessageCreate":199,"./handlers/MessageCreate.js":199,"./handlers/MessageDelete":200,"./handlers/MessageDelete.js":200,"./handlers/MessageDeleteBulk":201,"./handlers/MessageDeleteBulk.js":201,"./handlers/MessageReactionAdd":202,"./handlers/MessageReactionAdd.js":202,"./handlers/MessageReactionRemove":203,"./handlers/MessageReactionRemove.js":203,"./handlers/MessageReactionRemoveAll":204,"./handlers/MessageReactionRemoveAll.js":204,"./handlers/MessageUpdate":205,"./handlers/MessageUpdate.js":205,"./handlers/PresenceUpdate":206,"./handlers/PresenceUpdate.js":206,"./handlers/Ready":207,"./handlers/Ready.js":207,"./handlers/RelationshipAdd":209,"./handlers/RelationshipAdd.js":209,"./handlers/RelationshipRemove":210,"./handlers/RelationshipRemove.js":210,"./handlers/TypingStart":211,"./handlers/TypingStart.js":211,"./handlers/UserNoteUpdate":212,"./handlers/UserNoteUpdate.js":212,"./handlers/UserUpdate":213,"./handlers/UserUpdate.js":213,"./handlers/VoiceServerUpdate":214,"./handlers/VoiceServerUpdate.js":214,"./handlers/VoiceStateUpdate":215,"./handlers/VoiceStateUpdate.js":215};n.keys=function(){return Object.keys(s)},n.resolve=r,e.exports=n,n.id=179},function(e,t){class i{constructor(e){this.packetManager=e}handle(e){return e}}e.exports=i},function(e,t,i){const n=i(180);class r extends n{handle(e){const t=this.packetManager.client,i=e.d;t.actions.ChannelCreate.handle(i)}}e.exports=r},function(e,t,i){const n=i(180),r=i(5);class s extends n{handle(e){const t=this.packetManager.client,i=e.d,n=t.actions.ChannelDelete.handle(i);n.channel&&t.emit(r.Events.CHANNEL_DELETE,n.channel)}}e.exports=s},function(e,t,i){const n=i(180),r=i(5);class s extends n{handle(e){const t=this.packetManager.client,i=e.d,n=t.channels.get(i.channel_id),s=new Date(i.last_pin_timestamp);n&&s&&t.emit(r.Events.CHANNEL_PINS_UPDATE,n,s)}}e.exports=s},function(e,t,i){const n=i(180);class r extends n{handle(e){const t=this.packetManager.client,i=e.d;t.actions.ChannelUpdate.handle(i)}}e.exports=r},function(e,t,i){const n=i(180),r=i(5);class s extends n{handle(e){const t=this.packetManager.client,i=e.d,n=t.guilds.get(i.guild_id),s=t.users.get(i.user.id);n&&s&&t.emit(r.Events.GUILD_BAN_ADD,n,s)}}e.exports=s},function(e,t,i){const n=i(180);class r extends n{handle(e){const t=this.packetManager.client,i=e.d;t.actions.GuildBanRemove.handle(i)}}e.exports=r},function(e,t,i){const n=i(180);class r extends n{handle(e){const t=this.packetManager.client,i=e.d,n=t.guilds.get(i.id);n?n.available||i.unavailable||(n.setup(i),this.packetManager.ws.checkIfReady()):t.dataManager.newGuild(i)}}e.exports=r},function(e,t,i){const n=i(180),r=i(5);class s extends n{handle(e){const t=this.packetManager.client,i=e.d,n=t.actions.GuildDelete.handle(i);n.guild&&t.emit(r.Events.GUILD_DELETE,n.guild)}}e.exports=s},function(e,t,i){const n=i(180);class r extends n{handle(e){const t=this.packetManager.client,i=e.d,n=t.guilds.get(i.guild_id);n&&t.actions.EmojiUpdate.handle(i,n)}}e.exports=r},function(e,t,i){const n=i(180);class r extends n{handle(e){const t=this.packetManager.client,i=e.d,n=t.guilds.get(i.guild_id);n&&(n.memberCount++,n._addMember(i))}}e.exports=r},function(e,t,i){const n=i(180);class r extends n{handle(e){const t=this.packetManager.client,i=e.d;t.actions.GuildMemberRemove.handle(i)}}e.exports=r},function(e,t,i){const n=i(180);class r extends n{handle(e){const t=this.packetManager.client,i=e.d,n=t.guilds.get(i.guild_id);if(n){const e=n.members.get(i.user.id);e&&n._updateMember(e,i)}}}e.exports=r},function(e,t,i){const n=i(180),r=i(5);class s extends n{handle(e){const t=this.packetManager.client,i=e.d,n=t.guilds.get(i.guild_id),s=[];if(n)for(const o of i.members)s.push(n._addMember(o,!1));n._checkChunks(),t.emit(r.Events.GUILD_MEMBERS_CHUNK,s)}}e.exports=s},function(e,t,i){const n=i(180);class r extends n{handle(e){const t=this.packetManager.client,i=e.d;t.actions.GuildRoleCreate.handle(i)}}e.exports=r},function(e,t,i){const n=i(180);class r extends n{handle(e){const t=this.packetManager.client,i=e.d;t.actions.GuildRoleDelete.handle(i)}}e.exports=r},function(e,t,i){const n=i(180);class r extends n{handle(e){const t=this.packetManager.client,i=e.d;t.actions.GuildRoleUpdate.handle(i)}}e.exports=r},function(e,t,i){const n=i(180);class r extends n{handle(e){const t=this.packetManager.client,i=e.d;t.actions.GuildSync.handle(i)}}e.exports=r},function(e,t,i){const n=i(180);class r extends n{handle(e){const t=this.packetManager.client,i=e.d;t.actions.GuildUpdate.handle(i)}}e.exports=r},function(e,t,i){const n=i(180),r=i(5);class s extends n{handle(e){const t=this.packetManager.client,i=e.d,n=t.actions.MessageCreate.handle(i);n.message&&t.emit(r.Events.MESSAGE_CREATE,n.message)}}e.exports=s},function(e,t,i){const n=i(180),r=i(5);class s extends n{handle(e){const t=this.packetManager.client,i=e.d,n=t.actions.MessageDelete.handle(i);n.message&&t.emit(r.Events.MESSAGE_DELETE,n.message)}}e.exports=s},function(e,t,i){const n=i(180);class r extends n{handle(e){const t=this.packetManager.client,i=e.d;t.actions.MessageDeleteBulk.handle(i)}}e.exports=r},function(e,t,i){const n=i(180);class r extends n{handle(e){const t=this.packetManager.client,i=e.d;t.actions.MessageReactionAdd.handle(i)}}e.exports=r},function(e,t,i){const n=i(180);class r extends n{handle(e){const t=this.packetManager.client,i=e.d;t.actions.MessageReactionRemove.handle(i)}}e.exports=r},function(e,t,i){const n=i(180);class r extends n{handle(e){const t=this.packetManager.client,i=e.d;t.actions.MessageReactionRemoveAll.handle(i)}}e.exports=r},function(e,t,i){const n=i(180);class r extends n{handle(e){const t=this.packetManager.client,i=e.d;t.actions.MessageUpdate.handle(i)}}e.exports=r},function(e,t,i){const n=i(180),r=i(5),s=i(46);class o extends n{handle(e){const t=this.packetManager.client,i=e.d;let n=t.users.get(i.user.id);const o=t.guilds.get(i.guild_id);if(!n){if(!i.user.username)return;n=t.dataManager.newUser(i.user)}const a=s(n);if(n.patch(i.user),n.equals(a)||t.emit(r.Events.USER_UPDATE,a,n),o){let e=o.members.get(n.id);if(e||"offline"===i.status||(e=o._addMember({user:n,roles:i.roles,deaf:!1,mute:!1},!1),t.emit(r.Events.GUILD_MEMBER_AVAILABLE,e)),e){const a=s(e);e.presence&&(a.frozenPresence=s(e.presence)),o._setPresence(n.id,i),t.emit(r.Events.PRESENCE_UPDATE,a,e)}else o._setPresence(n.id,i)}}}e.exports=o},function(e,t,i){const n=i(180),r=i(208);class s extends n{handle(e){const t=this.packetManager.client,i=e.d,n=new r(t,i.user);t.user=n,t.readyAt=new Date,t.users.set(n.id,n);for(const s of i.guilds)t.dataManager.newGuild(s);for(const o of i.private_channels)t.dataManager.newChannel(o);for(const a of i.relationships){const e=t.dataManager.newUser(a.user);1===a.type?t.user.friends.set(e.id,e):2===a.type&&t.user.blocked.set(e.id,e)}i.presences=i.presences||[];for(const l of i.presences)t.dataManager.newUser(l.user),t._setPresence(l.user.id,l);if(i.notes)for(const f in i.notes){let e=i.notes[f];e.length||(e=null),t.user.notes.set(f,e)}!t.user.bot&&t.options.sync&&t.setInterval(t.syncGuilds.bind(t),3e4),t.once("ready",t.syncGuilds.bind(t)),t.users.has("1")||t.dataManager.newUser({id:"1",username:"Clyde",discriminator:"0000",avatar:"https://discordapp.com/assets/f78426a064bc9dd24847519259bc42af.png",bot:!0,status:"online",game:null,verified:!0}),t.setTimeout(()=>{t.ws.normalReady||t.ws._emitReady(!1)},1200*i.guilds.length),this.packetManager.ws.sessionID=i.session_id,this.packetManager.ws.checkIfReady()}}e.exports=s},function(e,t,i){const n=i(13),r=i(10);class s extends n{setup(e){super.setup(e),this.verified=e.verified,this.email=e.email,this.localPresence={},this._typing=new Map,this.friends=new r,this.blocked=new r,this.notes=new r}edit(e){return this.client.rest.methods.updateCurrentUser(e)}setUsername(e){return this.client.rest.methods.updateCurrentUser({username:e})}setEmail(e){return this.client.rest.methods.updateCurrentUser({email:e})}setPassword(e){return this.client.rest.methods.updateCurrentUser({password:e})}setAvatar(e){return e.startsWith("data:")?this.client.rest.methods.updateCurrentUser({avatar:e}):this.client.resolver.resolveBuffer(e).then(e=>this.client.rest.methods.updateCurrentUser({avatar:e}))}setStatus(e){return this.setPresence({status:e})}setGame(e,t){return this.setPresence({game:{name:e,url:t}})}setAFK(e){return this.setPresence({afk:e})}addFriend(e){return e=this.client.resolver.resolveUser(e),this.client.rest.methods.addFriend(e)}removeFriend(e){return e=this.client.resolver.resolveUser(e),this.client.rest.methods.removeFriend(e)}createGuild(e,t,i=null){return i?i.startsWith("data:")?this.client.rest.methods.createGuild({name:e,icon:i,region:t}):this.client.resolver.resolveBuffer(i).then(i=>this.client.rest.methods.createGuild({name:e,icon:i,region:t})):this.client.rest.methods.createGuild({name:e,icon:i,region:t})}setPresence(e){return new Promise(t=>{let i=this.localPresence.status||this.presence.status,n=this.localPresence.game,r=this.localPresence.afk||this.presence.afk;if(!n&&this.presence.game&&(n={name:this.presence.game.name,type:this.presence.game.type,url:this.presence.game.url}),e.status){if("string"!=typeof e.status)throw new TypeError("Status must be a string");i=e.status}e.game&&(n=e.game,n.url&&(n.type=1)),"undefined"!=typeof e.afk&&(r=e.afk), -r=Boolean(r),this.localPresence={status:i,game:n,afk:r},this.localPresence.since=0,this.localPresence.game=this.localPresence.game||null,this.client.ws.send({op:3,d:this.localPresence}),this.client._setPresence(this.id,this.localPresence),t(this)})}}e.exports=s},function(e,t,i){const n=i(180);class r extends n{handle(e){const t=this.packetManager.client,i=e.d;1===i.type?t.fetchUser(i.id).then(e=>{t.user.friends.set(e.id,e)}):2===i.type&&t.fetchUser(i.id).then(e=>{t.user.blocked.set(e.id,e)})}}e.exports=r},function(e,t,i){const n=i(180);class r extends n{handle(e){const t=this.packetManager.client,i=e.d;2===i.type?t.user.blocked.has(i.id)&&t.user.blocked.delete(i.id):1===i.type&&t.user.friends.has(i.id)&&t.user.friends.delete(i.id)}}e.exports=r},function(e,t,i){function n(e,t){return e.client.setTimeout(()=>{e.client.emit(s.Events.TYPING_STOP,e,t,e._typing.get(t.id)),e._typing.delete(t.id)},6e3)}const r=i(180),s=i(5);class o extends r{handle(e){const t=this.packetManager.client,i=e.d,r=t.channels.get(i.channel_id),o=t.users.get(i.user_id),l=new Date(1e3*i.timestamp);if(r&&o){if("voice"===r.type)return void t.emit(s.Events.WARN,`Discord sent a typing packet to voice channel ${r.id}`);if(r._typing.has(o.id)){const e=r._typing.get(o.id);e.lastTimestamp=l,e.resetTimeout(n(r,o))}else r._typing.set(o.id,new a(t,l,l,n(r,o))),t.emit(s.Events.TYPING_START,r,o)}}}class a{constructor(e,t,i,n){this.client=e,this.since=t,this.lastTimestamp=i,this._timeout=n}resetTimeout(e){this.client.clearTimeout(this._timeout),this._timeout=e}get elapsedTime(){return Date.now()-this.since}}e.exports=o},function(e,t,i){const n=i(180);class r extends n{handle(e){const t=this.packetManager.client,i=e.d;t.actions.UserNoteUpdate.handle(i)}}e.exports=r},function(e,t,i){const n=i(180);class r extends n{handle(e){const t=this.packetManager.client,i=e.d;t.actions.UserUpdate.handle(i)}}e.exports=r},function(e,t,i){const n=i(180);class r extends n{handle(e){const t=this.packetManager.client,i=e.d;t.emit("self.voiceServer",i)}}e.exports=r},function(e,t,i){const n=i(180),r=i(5),s=i(46);class o extends n{handle(e){const t=this.packetManager.client,i=e.d,n=t.guilds.get(i.guild_id);if(n){const e=n.members.get(i.user_id);if(e){const n=s(e);e.voiceChannel&&e.voiceChannel.id!==i.channel_id&&e.voiceChannel.members.delete(n.id),i.channel_id||(e.speaking=null),e.user.id===t.user.id&&i.channel_id&&t.emit("self.voiceStateUpdate",i);const o=t.channels.get(i.channel_id);o&&o.members.set(e.user.id,e),e.serverMute=i.mute,e.serverDeaf=i.deaf,e.selfMute=i.self_mute,e.selfDeaf=i.self_deaf,e.voiceSessionID=i.session_id,e.voiceChannelID=i.channel_id,t.emit(r.Events.VOICE_STATE_UPDATE,n,e)}}}}e.exports=o},function(e,t,i){class n{constructor(e){this.client=e,this.register("MessageCreate"),this.register("MessageDelete"),this.register("MessageDeleteBulk"),this.register("MessageUpdate"),this.register("MessageReactionAdd"),this.register("MessageReactionRemove"),this.register("MessageReactionRemoveAll"),this.register("ChannelCreate"),this.register("ChannelDelete"),this.register("ChannelUpdate"),this.register("GuildDelete"),this.register("GuildUpdate"),this.register("GuildMemberGet"),this.register("GuildMemberRemove"),this.register("GuildBanRemove"),this.register("GuildRoleCreate"),this.register("GuildRoleDelete"),this.register("GuildRoleUpdate"),this.register("UserGet"),this.register("UserUpdate"),this.register("UserNoteUpdate"),this.register("GuildSync"),this.register("GuildEmojiCreate"),this.register("GuildEmojiDelete"),this.register("GuildEmojiUpdate"),this.register("GuildRolesPositionUpdate")}register(e){const t=i(217)(`./${e}`);this[e]=new t(this.client)}}e.exports=n},function(e,t,i){function n(e){return i(r(e))}function r(e){return s[e]||function(){throw new Error("Cannot find module '"+e+"'.")}()}var s={"./Action":218,"./Action.js":218,"./ActionsManager":216,"./ActionsManager.js":216,"./ChannelCreate":219,"./ChannelCreate.js":219,"./ChannelDelete":220,"./ChannelDelete.js":220,"./ChannelUpdate":221,"./ChannelUpdate.js":221,"./GuildBanRemove":222,"./GuildBanRemove.js":222,"./GuildDelete":223,"./GuildDelete.js":223,"./GuildEmojiCreate":224,"./GuildEmojiCreate.js":224,"./GuildEmojiDelete":225,"./GuildEmojiDelete.js":225,"./GuildEmojiUpdate":226,"./GuildEmojiUpdate.js":226,"./GuildMemberGet":227,"./GuildMemberGet.js":227,"./GuildMemberRemove":228,"./GuildMemberRemove.js":228,"./GuildRoleCreate":229,"./GuildRoleCreate.js":229,"./GuildRoleDelete":230,"./GuildRoleDelete.js":230,"./GuildRoleUpdate":231,"./GuildRoleUpdate.js":231,"./GuildRolesPositionUpdate":232,"./GuildRolesPositionUpdate.js":232,"./GuildSync":233,"./GuildSync.js":233,"./GuildUpdate":234,"./GuildUpdate.js":234,"./MessageCreate":235,"./MessageCreate.js":235,"./MessageDelete":236,"./MessageDelete.js":236,"./MessageDeleteBulk":237,"./MessageDeleteBulk.js":237,"./MessageReactionAdd":238,"./MessageReactionAdd.js":238,"./MessageReactionRemove":239,"./MessageReactionRemove.js":239,"./MessageReactionRemoveAll":240,"./MessageReactionRemoveAll.js":240,"./MessageUpdate":241,"./MessageUpdate.js":241,"./UserGet":242,"./UserGet.js":242,"./UserNoteUpdate":243,"./UserNoteUpdate.js":243,"./UserUpdate":244,"./UserUpdate.js":244};n.keys=function(){return Object.keys(s)},n.resolve=r,e.exports=n,n.id=217},function(e,t){class i{constructor(e){this.client=e}handle(e){return e}}e.exports=i},function(e,t,i){const n=i(218);class r extends n{handle(e){const t=this.client,i=t.dataManager.newChannel(e);return{channel:i}}}e.exports=r},function(e,t,i){const n=i(218);class r extends n{constructor(e){super(e),this.deleted=new Map}handle(e){const t=this.client;let i=t.channels.get(e.id);return i?(t.dataManager.killChannel(i),this.deleted.set(i.id,i),this.scheduleForDeletion(i.id)):i=this.deleted.get(e.id)||null,{channel:i}}scheduleForDeletion(e){this.client.setTimeout(()=>this.deleted.delete(e),this.client.options.restWsBridgeTimeout)}}e.exports=r},function(e,t,i){const n=i(218),r=i(5),s=i(46);class o extends n{handle(e){const t=this.client,i=t.channels.get(e.id);if(i){const n=s(i);return i.setup(e),t.emit(r.Events.CHANNEL_UPDATE,n,i),{old:n,updated:i}}return{old:null,updated:null}}}e.exports=o},function(e,t,i){const n=i(218),r=i(5);class s extends n{handle(e){const t=this.client,i=t.guilds.get(e.guild_id),n=t.dataManager.newUser(e.user);i&&n&&t.emit(r.Events.GUILD_BAN_REMOVE,i,n)}}e.exports=s},function(e,t,i){const n=i(218),r=i(5);class s extends n{constructor(e){super(e),this.deleted=new Map}handle(e){const t=this.client;let i=t.guilds.get(e.id);if(i){if(i.available&&e.unavailable)return i.available=!1,t.emit(r.Events.GUILD_UNAVAILABLE,i),{guild:null};t.guilds.delete(i.id),this.deleted.set(i.id,i),this.scheduleForDeletion(i.id)}else i=this.deleted.get(e.id)||null;return{guild:i}}scheduleForDeletion(e){this.client.setTimeout(()=>this.deleted.delete(e),this.client.options.restWsBridgeTimeout)}}e.exports=s},function(e,t,i){const n=i(218);class r extends n{handle(e,t){const i=this.client,n=i.dataManager.newEmoji(e,t);return{emoji:n}}}e.exports=r},function(e,t,i){const n=i(218);class r extends n{handle(e){const t=this.client;return t.dataManager.killEmoji(e),{data:e}}}e.exports=r},function(e,t,i){const n=i(218);class r extends n{handle(e,t){const i=this.client;for(let n of e.emojis){const e=t.emojis.has(n.id);e?i.dataManager.updateEmoji(t.emojis.get(n.id),n):n=i.dataManager.newEmoji(n,t)}for(let n of t.emojis)e.emoijs.has(n.id)||i.dataManager.killEmoji(n);return{emojis:e.emojis}}}e.exports=r},function(e,t,i){const n=i(218);class r extends n{handle(e,t){const i=e._addMember(t,!1);return{member:i}}}e.exports=r},function(e,t,i){const n=i(218),r=i(5);class s extends n{constructor(e){super(e),this.deleted=new Map}handle(e){const t=this.client,i=t.guilds.get(e.guild_id);if(i){let n=i.members.get(e.user.id);return n?(i.memberCount--,i._removeMember(n),this.deleted.set(i.id+e.user.id,n),t.status===r.Status.READY&&t.emit(r.Events.GUILD_MEMBER_REMOVE,n),this.scheduleForDeletion(i.id,e.user.id)):n=this.deleted.get(i.id+e.user.id)||null,{guild:i,member:n}}return{guild:i,member:null}}scheduleForDeletion(e,t){this.client.setTimeout(()=>this.deleted.delete(e+t),this.client.options.restWsBridgeTimeout)}}e.exports=s},function(e,t,i){const n=i(218),r=i(5),s=i(26);class o extends n{handle(e){const t=this.client,i=t.guilds.get(e.guild_id);if(i){const n=i.roles.has(e.role.id),o=new s(i,e.role);return i.roles.set(o.id,o),n||t.emit(r.Events.GUILD_ROLE_CREATE,o),{role:o}}return{role:null}}}e.exports=o},function(e,t,i){const n=i(218),r=i(5);class s extends n{constructor(e){super(e),this.deleted=new Map}handle(e){const t=this.client,i=t.guilds.get(e.guild_id);if(i){let n=i.roles.get(e.role_id);return n?(i.roles.delete(e.role_id),this.deleted.set(i.id+e.role_id,n),this.scheduleForDeletion(i.id,e.role_id),t.emit(r.Events.GUILD_ROLE_DELETE,n)):n=this.deleted.get(i.id+e.role_id)||null,{role:n}}return{role:null}}scheduleForDeletion(e,t){this.client.setTimeout(()=>this.deleted.delete(e+t),this.client.options.restWsBridgeTimeout)}}e.exports=s},function(e,t,i){const n=i(218),r=i(5),s=i(46);class o extends n{handle(e){const t=this.client,i=t.guilds.get(e.guild_id);if(i){const n=e.role;let o=null;const a=i.roles.get(n.id);return a&&(o=s(a),a.setup(e.role),t.emit(r.Events.GUILD_ROLE_UPDATE,o,a)),{old:o,updated:a}}return{old:null,updated:null}}}e.exports=o},function(e,t,i){const n=i(218);class r extends n{handle(e){const t=this.client,i=t.guilds.get(e.guild_id);if(i)for(const n of e.roles){const e=i.roles.get(n.id);e&&(e.position=n.position)}return{guild:i}}}e.exports=r},function(e,t,i){const n=i(218);class r extends n{handle(e){const t=this.client,i=t.guilds.get(e.id);if(i){e.presences=e.presences||[];for(const t of e.presences)i._setPresence(t.user.id,t);e.members=e.members||[];for(const n of e.members){const e=i.members.get(n.user.id);e?i._updateMember(e,n):i._addMember(n)}}}}e.exports=r},function(e,t,i){const n=i(218),r=i(5),s=i(46);class o extends n{handle(e){const t=this.client,i=t.guilds.get(e.id);if(i){const n=s(i);return i.setup(e),t.emit(r.Events.GUILD_UPDATE,n,i),{old:n,updated:i}}return{old:null,updated:null}}}e.exports=o},function(e,t,i){const n=i(218),r=i(16);class s extends n{handle(e){const t=this.client,i=t.channels.get((e instanceof Array?e[0]:e).channel_id);if(i){if(e instanceof Array){const n=new Array(e.length);for(let s=0;sthis.deleted.delete(e+t),this.client.options.restWsBridgeTimeout)}}e.exports=r},function(e,t,i){const n=i(218),r=i(10),s=i(5);class o extends n{handle(e){const t=this.client,i=t.channels.get(e.channel_id),n=e.ids,o=new r;for(const a of n){const e=i.messages.get(a);e&&o.set(e.id,e)}return o.size>0&&t.emit(s.Events.MESSAGE_BULK_DELETE,o),{messages:o}}}e.exports=o},function(e,t,i){const n=i(218),r=i(5);class s extends n{handle(e){const t=this.client.users.get(e.user_id);if(!t)return!1;const i=this.client.channels.get(e.channel_id);if(!i||"voice"===i.type)return!1;const n=i.messages.get(e.message_id);if(!n)return!1;if(!e.emoji)return!1;const s=n._addReaction(e.emoji,t);return s&&this.client.emit(r.Events.MESSAGE_REACTION_ADD,s,t),{message:n,reaction:s,user:t}}}e.exports=s},function(e,t,i){const n=i(218),r=i(5);class s extends n{handle(e){const t=this.client.users.get(e.user_id);if(!t)return!1;const i=this.client.channels.get(e.channel_id);if(!i||"voice"===i.type)return!1;const n=i.messages.get(e.message_id);if(!n)return!1;if(!e.emoji)return!1;const s=n._removeReaction(e.emoji,t);return s&&this.client.emit(r.Events.MESSAGE_REACTION_REMOVE,s,t),{message:n,reaction:s,user:t}}}e.exports=s},function(e,t,i){const n=i(218),r=i(5);class s extends n{handle(e){const t=this.client.channels.get(e.channel_id);if(!t||"voice"===t.type)return!1;const i=t.messages.get(e.message_id);return!!i&&(i._clearReactions(),this.client.emit(r.Events.MESSAGE_REACTION_REMOVE_ALL,i),{message:i})}}e.exports=s},function(e,t,i){const n=i(218),r=i(5),s=i(46);class o extends n{handle(e){const t=this.client,i=t.channels.get(e.channel_id);if(i){const n=i.messages.get(e.id);if(n){const i=s(n);return n.patch(e),n._edits.unshift(i),t.emit(r.Events.MESSAGE_UPDATE,i,n),{old:i,updated:n}}return{old:n,updated:n}}return{old:null,updated:null}}}e.exports=o},function(e,t,i){const n=i(218);class r extends n{handle(e){const t=this.client,i=t.dataManager.newUser(e);return{user:i}}}e.exports=r},function(e,t,i){const n=i(218),r=i(5);class s extends n{handle(e){const t=this.client,i=t.user.notes.get(e.id),n=e.note.length?e.note:null;return t.user.notes.set(e.id,n),t.emit(r.Events.USER_NOTE_UPDATE,e.id,i,n),{old:i,updated:n}}}e.exports=s},function(e,t,i){const n=i(218),r=i(5),s=i(46);class o extends n{handle(e){const t=this.client;if(t.user){if(t.user.equals(e))return{old:t.user,updated:t.user};const i=s(t.user);return t.user.patch(e),t.emit(r.Events.USER_UPDATE,i,t.user),{old:i,updated:t.user}}return{old:null,updated:null}}}e.exports=o},function(e,t,i){(function(t){const n=i(246),r=i(247);class s{constructor(e){this.client=e,t.on("message",this._handleMessage.bind(this))}get id(){return this.client.options.shardId}get count(){return this.client.options.shardCount}send(e){return new Promise((i,n)=>{const r=t.send(e,e=>{e?n(e):i()});if(!r)throw new Error("Failed to send message to master process.")})}fetchClientValues(e){return new Promise((i,r)=>{const s=o=>{o&&o._sFetchProp===e&&(t.removeListener("message",s),o._error?r(n(o._error)):i(o._result))};t.on("message",s),this.send({_sFetchProp:e}).catch(e=>{t.removeListener("message",s),r(e)})})}broadcastEval(e){return new Promise((i,r)=>{const s=o=>{o&&o._sEval===e&&(t.removeListener("message",s),o._error?r(n(o._error)):i(o._result))};t.on("message",s),this.send({_sEval:e}).catch(e=>{t.removeListener("message",s),r(e)})})}_handleMessage(e){if(e)if(e._fetchProp){const t=e._fetchProp.split(".");let i=this.client;for(const n of t)i=i[n];this._respond("fetchProp",{_fetchProp:e._fetchProp,_result:i})}else if(e._eval)try{this._respond("eval",{_eval:e._eval,_result:this.client._eval(e._eval)})}catch(t){this._respond("eval",{_eval:e._eval,_error:r(t)})}}_respond(e,t){this.send(t).catch(t=>this.client.emit("error",`Error when sending ${e} response to master process: ${t}`))}static singleton(e){return this._singleton?e.emit("error","Multiple clients created in child process; only the first will handle sharding helpers."):this._singleton=new this(e),this._singleton}}e.exports=s}).call(t,i(2))},function(e,t){e.exports=function(e){const t=new Error(e.message);return t.name=e.name,t.stack=e.stack,t}},function(e,t){e.exports=function(e){const t={};return t.name=e.name,t.message=e.message,t.stack=e.stack,t}},function(e,t,i){const n=i(31),r=i(7),s=i(57),o=i(4),a=i(5);class l extends n{constructor(e,t,i){super(null,e,t),this.options=o(a.DefaultOptions,i),this.rest=new r(this),this.resolver=new s(this)}}e.exports=l},function(e,t,i){(function(t){const n=i(62),r=i(15),s=i(246),o=i(247);class a{constructor(e,i,s=[]){this.manager=e,this.id=i,this.env=Object.assign({},t.env,{SHARD_ID:this.id,SHARD_COUNT:this.manager.totalShards,CLIENT_TOKEN:this.manager.token}),this.process=n.fork(r.resolve(this.manager.file),s,{env:this.env}),this.process.on("message",this._handleMessage.bind(this)),this.process.once("exit",()=>{this.manager.respawn&&this.manager.createShard(this.id)}),this._evals=new Map,this._fetches=new Map}send(e){return new Promise((t,i)=>{const n=this.process.send(e,e=>{e?i(e):t(this)});if(!n)throw new Error("Failed to send message to shard's process.")})}fetchClientValue(e){if(this._fetches.has(e))return this._fetches.get(e);const t=new Promise((t,i)=>{const n=i=>{i&&i._fetchProp===e&&(this.process.removeListener("message",n),this._fetches.delete(e),t(i._result))};this.process.on("message",n),this.send({_fetchProp:e}).catch(t=>{this.process.removeListener("message",n),this._fetches.delete(e),i(t)})});return this._fetches.set(e,t),t}eval(e){if(this._evals.has(e))return this._evals.get(e);const t=new Promise((t,i)=>{const n=r=>{r&&r._eval===e&&(this.process.removeListener("message",n),this._evals.delete(e),r._error?i(s(r._error)):t(r._result))};this.process.on("message",n),this.send({_eval:e}).catch(t=>{this.process.removeListener("message",n),this._evals.delete(e),i(t)})});return this._evals.set(e,t),t}_handleMessage(e){if(e){if(e._sFetchProp)return void this.manager.fetchClientValues(e._sFetchProp).then(t=>this.send({_sFetchProp:e._sFetchProp,_result:t}),t=>this.send({_sFetchProp:e._sFetchProp,_error:o(t)}));if(e._sEval)return void this.manager.broadcastEval(e._sEval).then(t=>this.send({_sEval:e._sEval,_result:t}),t=>this.send({_sEval:e._sEval,_error:o(t)}))}this.manager.emit("message",this,e)}}e.exports=a}).call(t,i(2))},function(e,t,i){(function(t){const n=i(15),r=i(62),s=i(3).EventEmitter,o=i(4),a=i(249),l=i(10),f=i(251);class h extends s{constructor(e,i={}){if(super(),i=o({totalShards:"auto",respawn:!0,shardArgs:[],token:null},i),this.file=e,!e)throw new Error("File must be specified.");n.isAbsolute(e)||(this.file=n.resolve(t.cwd(),e));const s=r.statSync(this.file);if(!s.isFile())throw new Error("File path does not point to a file.");if(this.totalShards=i.totalShards,"auto"!==this.totalShards){if("number"!=typeof this.totalShards||isNaN(this.totalShards))throw new TypeError("Amount of shards must be a number.");if(this.totalShards<1)throw new RangeError("Amount of shards must be at least 1.");if(this.totalShards!==Math.floor(this.totalShards))throw new RangeError("Amount of shards must be an integer.")}this.respawn=i.respawn,this.shardArgs=i.shardArgs,this.token=i.token?i.token.replace(/^Bot\s*/i,""):null,this.shards=new l}createShard(e=this.shards.size){const t=new a(this,e,this.shardArgs);return this.shards.set(e,t),this.emit("launch",t),Promise.resolve(t)}spawn(e=this.totalShards,t=5500){if("auto"===e)return f(this.token).then(e=>{return this.totalShards=e,this._spawn(e,t)});if("number"!=typeof e||isNaN(e))throw new TypeError("Amount of shards must be a number.");if(e<1)throw new RangeError("Amount of shards must be at least 1.");if(e!==Math.floor(e))throw new TypeError("Amount of shards must be an integer.");return this._spawn(e,t)}_spawn(e,t){return new Promise(i=>{if(this.shards.size>=e)throw new Error(`Already spawned ${this.shards.size} shards.`);if(this.totalShards=e,this.createShard(),this.shards.size>=this.totalShards)return void i(this.shards);if(t<=0){for(;this.shards.size{this.createShard(),this.shards.size>=this.totalShards&&(clearInterval(e),i(this.shards))},t)}})}broadcast(e){const t=[];for(const i of this.shards.values())t.push(i.send(e));return Promise.all(t)}broadcastEval(e){const t=[];for(const i of this.shards.values())t.push(i.eval(e));return Promise.all(t)}fetchClientValues(e){if(0===this.shards.size)return Promise.reject(new Error("No shards have been spawned."));if(this.shards.size!==this.totalShards)return Promise.reject(new Error("Still spawning shards."));const t=[];for(const i of this.shards.values())t.push(i.fetchClientValue(e));return Promise.all(t)}}e.exports=h}).call(t,i(2))},function(e,t,i){const n=i(40),r=i(5).Endpoints.botGateway;e.exports=function(e){return new Promise((t,i)=>{if(!e)throw new Error("A token must be provided.");n.get(r).set("Authorization",`Bot ${e.replace(/^Bot\s*/i,"")}`).end((e,n)=>{e&&i(e),t(n.body.shards)})})}}]); \ No newline at end of file +var tempDoublePtr=STATICTOP;STATICTOP+=16;var ERRNO_CODES={EPERM:1,ENOENT:2,ESRCH:3,EINTR:4,EIO:5,ENXIO:6,E2BIG:7,ENOEXEC:8,EBADF:9,ECHILD:10,EAGAIN:11,EWOULDBLOCK:11,ENOMEM:12,EACCES:13,EFAULT:14,ENOTBLK:15,EBUSY:16,EEXIST:17,EXDEV:18,ENODEV:19,ENOTDIR:20,EISDIR:21,EINVAL:22,ENFILE:23,EMFILE:24,ENOTTY:25,ETXTBSY:26,EFBIG:27,ENOSPC:28,ESPIPE:29,EROFS:30,EMLINK:31,EPIPE:32,EDOM:33,ERANGE:34,ENOMSG:42,EIDRM:43,ECHRNG:44,EL2NSYNC:45,EL3HLT:46,EL3RST:47,ELNRNG:48,EUNATCH:49,ENOCSI:50,EL2HLT:51,EDEADLK:35,ENOLCK:37,EBADE:52,EBADR:53,EXFULL:54,ENOANO:55,EBADRQC:56,EBADSLT:57,EDEADLOCK:35,EBFONT:59,ENOSTR:60,ENODATA:61,ETIME:62,ENOSR:63,ENONET:64,ENOPKG:65,EREMOTE:66,ENOLINK:67,EADV:68,ESRMNT:69,ECOMM:70,EPROTO:71,EMULTIHOP:72,EDOTDOT:73,EBADMSG:74,ENOTUNIQ:76,EBADFD:77,EREMCHG:78,ELIBACC:79,ELIBBAD:80,ELIBSCN:81,ELIBMAX:82,ELIBEXEC:83,ENOSYS:38,ENOTEMPTY:39,ENAMETOOLONG:36,ELOOP:40,EOPNOTSUPP:95,EPFNOSUPPORT:96,ECONNRESET:104,ENOBUFS:105,EAFNOSUPPORT:97,EPROTOTYPE:91,ENOTSOCK:88,ENOPROTOOPT:92,ESHUTDOWN:108,ECONNREFUSED:111,EADDRINUSE:98,ECONNABORTED:103,ENETUNREACH:101,ENETDOWN:100,ETIMEDOUT:110,EHOSTDOWN:112,EHOSTUNREACH:113,EINPROGRESS:115,EALREADY:114,EDESTADDRREQ:89,EMSGSIZE:90,EPROTONOSUPPORT:93,ESOCKTNOSUPPORT:94,EADDRNOTAVAIL:99,ENETRESET:102,EISCONN:106,ENOTCONN:107,ETOOMANYREFS:109,EUSERS:87,EDQUOT:122,ESTALE:116,ENOTSUP:95,ENOMEDIUM:123,EILSEQ:84,EOVERFLOW:75,ECANCELED:125,ENOTRECOVERABLE:131,EOWNERDEAD:130,ESTRPIPE:86},embind_charCodes=void 0,awaitingDependencies={},registeredTypes={},typeDependencies={},char_0=48,char_9=57,BindingError=void 0,InternalError=void 0,EXCEPTIONS={last:0,caught:[],infos:{},deAdjust:function(e){if(!e||EXCEPTIONS.infos[e])return e;for(var t in EXCEPTIONS.infos){var i=EXCEPTIONS.infos[t];if(i.adjusted===e)return t}return e},addRef:function(e){if(e){var t=EXCEPTIONS.infos[e];t.refcount++}},decRef:function(e){if(e){var t=EXCEPTIONS.infos[e];assert(t.refcount>0),t.refcount--,0===t.refcount&&(t.destructor&&Runtime.dynCall("vi",t.destructor,[e]),delete EXCEPTIONS.infos[e],___cxa_free_exception(e))}},clearRef:function(e){if(e){var t=EXCEPTIONS.infos[e];t.refcount=0}}};Module._memset=_memset,Module._free=_free,Module._malloc=_malloc;var delayFunction=void 0,deletionQueue=[],registeredPointers={},registeredInstances={},UnboundTypeError=void 0,_llvm_fabs_f64=Math_abs;Module._i64Add=_i64Add;var emval_free_list=[],emval_handle_array=[{},{value:void 0},{value:null},{value:!0},{value:!1}];Module._bitshift64Ashr=_bitshift64Ashr,Module._bitshift64Lshr=_bitshift64Lshr,Module._memcpy=_memcpy;var _llvm_pow_f64=Math_pow;Module._memmove=_memmove,embind_init_charCodes(),BindingError=Module.BindingError=extendError(Error,"BindingError"),InternalError=Module.InternalError=extendError(Error,"InternalError"),init_ClassHandle(),init_RegisteredPointer(),init_embind(),UnboundTypeError=Module.UnboundTypeError=extendError(Error,"UnboundTypeError"),init_emval(),STACK_BASE=STACKTOP=Runtime.alignMemory(STATICTOP),staticSealed=!0,STACK_MAX=STACK_BASE+TOTAL_STACK,DYNAMIC_BASE=DYNAMICTOP=Runtime.alignMemory(STACK_MAX);var cttz_i8=allocate([8,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,6,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,7,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,6,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,5,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0,4,0,1,0,2,0,1,0,3,0,1,0,2,0,1,0],"i8",ALLOC_DYNAMIC);Module.asmGlobalArg={Math:Math,Int8Array:Int8Array,Int16Array:Int16Array,Int32Array:Int32Array,Uint8Array:Uint8Array,Uint16Array:Uint16Array,Uint32Array:Uint32Array,Float32Array:Float32Array,Float64Array:Float64Array,NaN:NaN,Infinity:1/0},Module.asmLibraryArg={abort:abort,assert:assert,invoke_iiii:invoke_iiii,invoke_viiiii:invoke_viiiii,invoke_vi:invoke_vi,invoke_iiiiiii:invoke_iiiiiii,invoke_ii:invoke_ii,invoke_viiiiiii:invoke_viiiiiii,invoke_v:invoke_v,invoke_iiiii:invoke_iiiii,invoke_viiiiii:invoke_viiiiii,invoke_iiiiii:invoke_iiiiii,invoke_viiii:invoke_viiii,floatReadValueFromPointer:floatReadValueFromPointer,simpleReadValueFromPointer:simpleReadValueFromPointer,throwInternalError:throwInternalError,get_first_emval:get_first_emval,_llvm_fabs_f64:_llvm_fabs_f64,getLiveInheritedInstances:getLiveInheritedInstances,__ZSt18uncaught_exceptionv:__ZSt18uncaught_exceptionv,ClassHandle:ClassHandle,getShiftFromSize:getShiftFromSize,_sbrk:_sbrk,_emscripten_memcpy_big:_emscripten_memcpy_big,runDestructor:runDestructor,_sysconf:_sysconf,throwInstanceAlreadyDeleted:throwInstanceAlreadyDeleted,__embind_register_std_string:__embind_register_std_string,init_RegisteredPointer:init_RegisteredPointer,ClassHandle_isAliasOf:ClassHandle_isAliasOf,_llvm_stacksave:_llvm_stacksave,flushPendingDeletes:flushPendingDeletes,makeClassHandle:makeClassHandle,whenDependentTypesAreResolved:whenDependentTypesAreResolved,__embind_register_class_constructor:__embind_register_class_constructor,init_ClassHandle:init_ClassHandle,ClassHandle_clone:ClassHandle_clone,RegisteredClass:RegisteredClass,_llvm_stackrestore:_llvm_stackrestore,___cxa_find_matching_catch:___cxa_find_matching_catch,embind_init_charCodes:embind_init_charCodes,___setErrNo:___setErrNo,__embind_register_bool:__embind_register_bool,___resumeException:___resumeException,createNamedFunction:createNamedFunction,__embind_register_emval:__embind_register_emval,__emval_decref:__emval_decref,init_embind:init_embind,constNoSmartPtrRawPointerToWireType:constNoSmartPtrRawPointerToWireType,heap32VectorToArray:heap32VectorToArray,ClassHandle_delete:ClassHandle_delete,RegisteredPointer_destructor:RegisteredPointer_destructor,ensureOverloadTable:ensureOverloadTable,_time:_time,new_:new_,downcastPointer:downcastPointer,replacePublicSymbol:replacePublicSymbol,__embind_register_class:__embind_register_class,_llvm_pow_f64:_llvm_pow_f64,ClassHandle_deleteLater:ClassHandle_deleteLater,RegisteredPointer_deleteObject:RegisteredPointer_deleteObject,ClassHandle_isDeleted:ClassHandle_isDeleted,__embind_register_integer:__embind_register_integer,___cxa_allocate_exception:___cxa_allocate_exception,_embind_repr:_embind_repr,RegisteredPointer:RegisteredPointer,_exp2:_exp2,craftInvokerFunction:craftInvokerFunction,runDestructors:runDestructors,makeLegalFunctionName:makeLegalFunctionName,upcastPointer:upcastPointer,init_emval:init_emval,shallowCopyInternalPointer:shallowCopyInternalPointer,nonConstNoSmartPtrRawPointerToWireType:nonConstNoSmartPtrRawPointerToWireType,_abort:_abort,throwBindingError:throwBindingError,getTypeName:getTypeName,exposePublicSymbol:exposePublicSymbol,RegisteredPointer_fromWireType:RegisteredPointer_fromWireType,__embind_register_memory_view:__embind_register_memory_view,getInheritedInstance:getInheritedInstance,setDelayFunction:setDelayFunction,___gxx_personality_v0:___gxx_personality_v0,extendError:extendError,__embind_register_void:__embind_register_void,RegisteredPointer_getPointee:RegisteredPointer_getPointee,__emval_register:__emval_register,__embind_register_std_wstring:__embind_register_std_wstring,__embind_register_class_function:__embind_register_class_function,throwUnboundTypeError:throwUnboundTypeError,readLatin1String:readLatin1String,_pthread_self:_pthread_self,getBasestPointer:getBasestPointer,getInheritedInstanceCount:getInheritedInstanceCount,__embind_register_float:__embind_register_float,integerReadValueFromPointer:integerReadValueFromPointer,genericPointerToWireType:genericPointerToWireType,registerType:registerType,___cxa_throw:___cxa_throw,count_emval_handles:count_emval_handles,requireFunction:requireFunction,STACKTOP:STACKTOP,STACK_MAX:STACK_MAX,tempDoublePtr:tempDoublePtr,ABORT:ABORT,cttz_i8:cttz_i8};var asm=function(e,t,i){"use asm";var r=new e.Int8Array(i);var n=new e.Int16Array(i);var s=new e.Int32Array(i);var a=new e.Uint8Array(i);var o=new e.Uint16Array(i);var f=new e.Uint32Array(i);var h=new e.Float32Array(i);var c=new e.Float64Array(i);var l=t.STACKTOP|0;var u=t.STACK_MAX|0;var d=t.tempDoublePtr|0;var p=t.ABORT|0;var b=t.cttz_i8|0;var m=0;var w=0;var g=0;var v=0;var _=e.NaN,y=e.Infinity;var k=0,E=0,A=0,S=0,M=0,T=0,R=0,x=0,C=0;var I=0;var P=0;var O=0;var N=0;var D=0;var L=0;var B=0;var U=0;var j=0;var F=0;var z=e.Math.floor;var q=e.Math.abs;var H=e.Math.sqrt;var G=e.Math.pow;var V=e.Math.cos;var W=e.Math.sin;var K=e.Math.tan;var Z=e.Math.acos;var Y=e.Math.asin;var $=e.Math.atan;var X=e.Math.atan2;var J=e.Math.exp;var Q=e.Math.log;var ee=e.Math.ceil;var te=e.Math.imul;var ie=e.Math.min;var re=e.Math.clz32;var ne=t.abort;var se=t.assert;var ae=t.invoke_iiii;var oe=t.invoke_viiiii;var fe=t.invoke_vi;var he=t.invoke_iiiiiii;var ce=t.invoke_ii;var le=t.invoke_viiiiiii;var ue=t.invoke_v;var de=t.invoke_iiiii;var pe=t.invoke_viiiiii;var be=t.invoke_iiiiii;var me=t.invoke_viiii;var we=t.floatReadValueFromPointer;var ge=t.simpleReadValueFromPointer;var ve=t.throwInternalError;var _e=t.get_first_emval;var ye=t._llvm_fabs_f64;var ke=t.getLiveInheritedInstances;var Ee=t.__ZSt18uncaught_exceptionv;var Ae=t.ClassHandle;var Se=t.getShiftFromSize;var Me=t._sbrk;var Te=t._emscripten_memcpy_big;var Re=t.runDestructor;var xe=t._sysconf;var Ce=t.throwInstanceAlreadyDeleted;var Ie=t.__embind_register_std_string;var Pe=t.init_RegisteredPointer;var Oe=t.ClassHandle_isAliasOf;var Ne=t._llvm_stacksave;var De=t.flushPendingDeletes;var Le=t.makeClassHandle;var Be=t.whenDependentTypesAreResolved;var Ue=t.__embind_register_class_constructor;var je=t.init_ClassHandle;var Fe=t.ClassHandle_clone;var ze=t.RegisteredClass;var qe=t._llvm_stackrestore;var He=t.___cxa_find_matching_catch;var Ge=t.embind_init_charCodes;var Ve=t.___setErrNo;var We=t.__embind_register_bool;var Ke=t.___resumeException;var Ze=t.createNamedFunction;var Ye=t.__embind_register_emval;var $e=t.__emval_decref;var Xe=t.init_embind;var Je=t.constNoSmartPtrRawPointerToWireType;var Qe=t.heap32VectorToArray;var et=t.ClassHandle_delete;var tt=t.RegisteredPointer_destructor;var it=t.ensureOverloadTable;var rt=t._time;var nt=t.new_;var st=t.downcastPointer;var at=t.replacePublicSymbol;var ot=t.__embind_register_class;var ft=t._llvm_pow_f64;var ht=t.ClassHandle_deleteLater;var ct=t.RegisteredPointer_deleteObject;var lt=t.ClassHandle_isDeleted;var ut=t.__embind_register_integer;var dt=t.___cxa_allocate_exception;var pt=t._embind_repr;var bt=t.RegisteredPointer;var mt=t._exp2;var wt=t.craftInvokerFunction;var gt=t.runDestructors;var vt=t.makeLegalFunctionName;var _t=t.upcastPointer;var yt=t.init_emval;var kt=t.shallowCopyInternalPointer;var Et=t.nonConstNoSmartPtrRawPointerToWireType;var At=t._abort;var St=t.throwBindingError;var Mt=t.getTypeName;var Tt=t.exposePublicSymbol;var Rt=t.RegisteredPointer_fromWireType;var xt=t.__embind_register_memory_view;var Ct=t.getInheritedInstance;var It=t.setDelayFunction;var Pt=t.___gxx_personality_v0;var Ot=t.extendError;var Nt=t.__embind_register_void;var Dt=t.RegisteredPointer_getPointee;var Lt=t.__emval_register;var Bt=t.__embind_register_std_wstring;var Ut=t.__embind_register_class_function;var jt=t.throwUnboundTypeError;var Ft=t.readLatin1String;var zt=t._pthread_self;var qt=t.getBasestPointer;var Ht=t.getInheritedInstanceCount;var Gt=t.__embind_register_float;var Vt=t.integerReadValueFromPointer;var Wt=t.genericPointerToWireType;var Kt=t.registerType;var Zt=t.___cxa_throw;var Yt=t.count_emval_handles;var $t=t.requireFunction;var Xt=0;function Jt(e,t,i,o,f,c){e=e|0;t=t|0;i=i|0;o=o|0;f=f|0;c=c|0;var u=0,p=0,b=0,m=0,w=0,g=0,v=0,_=0,y=0,k=0,E=0,A=0,S=0,M=0,T=0,R=0,x=0,C=0,I=0,P=0,O=0,N=0,D=0,L=0,B=0,U=0,j=0,F=0,G=0,V=0,W=0,K=0,Z=0,Y=0,$=0,X=0,J=0,ee=0,ie=0,ne=0,se=0,ae=0,oe=0,fe=0,he=0,ce=0,le=0,ue=0,de=0,pe=0,be=0,me=0,we=0,ge=0,ve=0,_e=0,ye=0,ke=0,Ee=0,Ae=0,Se=0,Me=0,Te=0,Re=0,xe=0,Ce=0,Ie=0,Pe=0,Oe=0,De=0,Le=0,Be=0,Ue=0,je=0,Fe=0,ze=0,He=0,Ge=0,Ve=0,We=0,Ke=0,Ze=0,Ye=0,$e=0,Xe=0,Je=0,Qe=0,et=0,tt=0,it=0,rt=0,nt=0,st=0;nt=l;l=l+192|0;K=nt+80|0;w=nt+32|0;$e=nt+28|0;L=nt+24|0;He=nt+20|0;ze=nt+16|0;J=nt+12|0;Ie=nt+8|0;Ce=nt+4|0;B=nt;et=s[e+4>>2]|0;Ye=s[e+8>>2]|0;s[$e>>2]=15;h[L>>2]=0;s[He>>2]=0;s[J>>2]=0;Fe=s[e>>2]|0;We=Fe+8|0;rt=s[We>>2]|0;N=s[Fe+4>>2]|0;Oe=Fe+32|0;ke=s[Oe>>2]|0;tt=s[e+32>>2]|0;it=s[e+36>>2]|0;xe=(tt|0)!=0;h[Ie>>2]=0;if((f|0)<2|(t|0)==0){e=-1;l=nt;return e|0}W=e+28|0;u=te(s[W>>2]|0,i)|0;pe=Fe+44|0;Te=Fe+36|0;i=s[Te>>2]|0;Ee=0;while(1){if((Ee|0)>(i|0)){i=-1;Se=631;break}if((s[pe>>2]<>2]<>2]|0;Ve=s[c+28>>2]|0;C=re(Ve|0)|0;Ge=32-C|0;Ve=Ve>>>(Ge+-16|0);Re=(Ve>>>12)+-8|0;C=Ue+(C+-32)|0;O=C+4>>3;Re=(Ue<<3)-((Ge<<3)+(Re+(Ve>>>0>(s[5272+(Re<<2)>>2]|0)>>>0&1)))|0}f=(f|0)<1275?f:1275;m=f-O|0;_e=e+44|0;i=s[e+40>>2]|0;if(!(s[_e>>2]|0))if((i|0)==-1)Se=13;else{Ve=te(i,u)|0;Se=s[Fe>>2]|0;Se=((Ve+((C|0)>1?C:0)+(Se<<2)|0)/(Se<<3|0)|0)-((s[e+48>>2]|0)!=0&1)|0;Ve=(f|0)<(Se|0);f=((Ve?f:Se)|0)<2?2:Ve?f:Se;Se=13}else if((i|0)==-1){i=-1;Se=13}else{Le=s[Fe>>2]|0;Le=((te(i,u)|0)+(Le>>4)|0)/(Le>>3|0)|0;p=f;P=Le>>6}if((Se|0)==13){p=f;P=f-O|0;Le=0}f=te((Ye*40|0)+20|0,(400>>>Ee)+-50|0)|0;u=(p*400>>3-Ee)-f|0;if((i|0)==-1)Be=u;else{Be=i-f|0;Be=(u|0)<(Be|0)?u:Be}if(b){s[w>>2]=o;s[w+8>>2]=0;s[w+12>>2]=0;s[w+16>>2]=0;s[w+20>>2]=33;s[w+24>>2]=0;s[w+28>>2]=-2147483648;s[w+40>>2]=-1;s[w+32>>2]=0;s[w+36>>2]=0;s[w+4>>2]=p;s[w+44>>2]=0;Ve=w}else Ve=c;Me=(Le|0)>0;if(((Me?(s[e+52>>2]|0)!=0:0)?(v=(C|0)==1?2:0,_=(Le<<1)-(s[e+176>>2]|0)>>6,E=(v|0)>(_|0),((E?v:_)|0)<(m|0)):0)?(A=E?v:_,(A|0)<(m|0)):0){p=O+A|0;De=s[Ve>>2]|0;Ge=s[Ve+8>>2]|0;Ue=0-Ge|0;u=Ve+4|0;Tn(De+p+Ue|0,De+(s[u>>2]|0)+Ue|0,Ge|0)|0;s[u>>2]=p;u=A}else u=m;I=p<<3;de=s[Fe+12>>2]|0;de=(it|0)>(de|0)?de:it;U=je+N|0;w=te(et,U)|0;Ge=Ne()|0;V=l;l=l+((1*(w<<2)|0)+15&-16)|0;w=e+192|0;g=+h[w>>2];f=te(Ye,je-N|0)|0;m=s[W>>2]|0;f=(f|0)/(m|0)|0;i=0;y=0;k=0;while(1){if((i|0)>=(f|0))break;Pe=+h[t+(i<<2)>>2];i=i+1|0;y=y>Pe?y:Pe;k=k(y>Pe?y:Pe))){i=0;y=0;g=0;while(1){if((i|0)>=(f|0))break;Pe=+h[t+(i<<2)>>2];i=i+1|0;y=y>Pe?y:Pe;g=gg)g=y}b=t+(f<<2)|0;i=(te(Ye,N)|0)/(m|0)|0;f=0;y=0;k=0;while(1){if((f|0)>=(i|0))break;Pe=+h[b+(f<<2)>>2];f=f+1|0;y=y>Pe?y:Pe;k=kPe?y:Pe;h[w>>2]=Pe;g=g>Pe?g:Pe;be=e+60|0;S=g<=1/+(1<>2]|0);x=S&1;if((C|0)==1){T=Ve+28|0;f=s[T>>2]|0;i=f>>>15;f=f-i|0;A=Ve+32|0;if(S)s[A>>2]=(s[A>>2]|0)+f;else i=f;s[T>>2]=i;w=Ve+36|0;R=Ve+20|0;o=Ve+40|0;c=Ve+24|0;v=Ve+8|0;_=Ve+4|0;E=Ve+44|0;while(1){if(i>>>0>=8388609)break;f=s[A>>2]|0;m=f>>>23;if((m|0)==255)s[w>>2]=(s[w>>2]|0)+1;else{b=f>>>31;i=s[o>>2]|0;if((i|0)>-1){f=s[c>>2]|0;if((f+(s[v>>2]|0)|0)>>>0<(s[_>>2]|0)>>>0){s[c>>2]=f+1;r[(s[Ve>>2]|0)+f>>0]=i+b;i=0}else i=-1;s[E>>2]=s[E>>2]|i}i=s[w>>2]|0;if(i|0){b=b+255&255;do{f=s[c>>2]|0;if((f+(s[v>>2]|0)|0)>>>0<(s[_>>2]|0)>>>0){s[c>>2]=f+1;r[(s[Ve>>2]|0)+f>>0]=b;f=0;i=s[w>>2]|0}else f=-1;s[E>>2]=s[E>>2]|f;i=i+-1|0;s[w>>2]=i}while((i|0)!=0)}s[o>>2]=m&255;f=s[A>>2]|0;i=s[T>>2]|0}s[A>>2]=f<<8&2147483392;i=i<<8;s[T>>2]=i;s[R>>2]=(s[R>>2]|0)+8}if(S){if(Me){b=O+2|0;b=(p|0)<(b|0)?p:b;f=s[Ve>>2]|0;p=s[v>>2]|0;i=0-p|0;Tn(f+b+i|0,f+(s[_>>2]|0)+i|0,p|0)|0;s[_>>2]=b;p=b;i=s[T>>2]|0;f=b;u=2;b=b<<3}else{f=P;b=I}C=p<<3;Ue=s[R>>2]|0;s[R>>2]=Ue+(C-(Ue+((re(i|0)|0)+-32)));Ue=x}else{f=P;Ue=0;C=1;b=I}}else{f=P;Ue=0;b=I}S=e+16|0;T=Fe+16|0;R=Fe+20|0;x=je<<2;_=g>65536;A=0;do{w=_&(s[S>>2]|0)!=0;c=t+(A<<2)|0;v=V+((te(A,U)|0)<<2)+(N<<2)|0;o=s[W>>2]|0;E=e+160+(A<<2)|0;y=+h[T>>2];g=+h[E>>2];e:do if(+h[R>>2]==0){if((o|0)!=1){i=(je|0)/(o|0)|0;Se=64;break}if(w){i=je;Se=65}else{i=0;while(1){if((i|0)>=(je|0))break e;Pe=+h[c+((te(i,et)|0)<<2)>>2]*32768;h[v+(i<<2)>>2]=Pe-g;i=i+1|0;g=y*Pe}}}else{i=(je|0)/(o|0)|0;if((o|0)==1)Se=65;else Se=64}while(0);if((Se|0)==64){kn(v|0,0,x|0)|0;Se=65}e:do if((Se|0)==65){Se=0;m=0;while(1){if((m|0)>=(i|0))break;h[v+((te(m,o)|0)<<2)>>2]=+h[c+((te(m,et)|0)<<2)>>2]*32768;m=m+1|0}t:do if(w){m=0;while(1){if((m|0)>=(i|0)){i=0;break t}De=v+((te(m,o)|0)<<2)|0;Pe=+h[De>>2];ye=Pe>65536;Ae=Pe<-65536&(ye^1);h[De>>2]=Ae|ye?Ae?-65536:65536:Pe;m=m+1|0}}else i=0;while(0);while(1){if((i|0)>=(je|0))break e;De=v+(i<<2)|0;Pe=+h[De>>2];h[De>>2]=Pe-g;i=i+1|0;g=y*Pe}}while(0);h[E>>2]=g;A=A+1|0}while((A|0)<(et|0));Ae=e+68|0;if((((s[Ae>>2]|0)!=0&(u|0)>3|(u|0)>(Ye*12|0))&(xe^1)&(Ue|0)==0?(s[e+20>>2]|0)==0:0)?(s[e+24>>2]|0)>4:0){if((s[e+116>>2]|0)==0|(Ee|0)==3)i=0;else i=(s[e+64>>2]|0)==5010;i=i^1}else i=0;le=e+100|0;De=s[le>>2]|0;i=Qt(e,V,D,et,je,De,$e,L,B,i&1,u)|0;Pe=+h[L>>2];if(!(Pe>.4000000059604645)?!(+h[e+108>>2]>.4000000059604645):0)ye=0;else Se=82;do if((Se|0)==82){if(s[e+120>>2]|0?!(+h[e+124>>2]>.3):0){ye=0;break}ae=+(s[$e>>2]|0);he=+(s[e+104>>2]|0);ye=(ae>he*1.26|ae(b|0))){c=Ve+28|0;i=s[c>>2]|0;i=i-(i>>>1)|0;s[c>>2]=i;v=Ve+32|0;_=Ve+36|0;E=Ve+20|0;A=Ve+40|0;S=Ve+24|0;T=Ve+8|0;R=Ve+4|0;x=Ve+44|0;while(1){if(i>>>0>=8388609)break e;m=s[v>>2]|0;o=m>>>23;if((o|0)==255)s[_>>2]=(s[_>>2]|0)+1;else{w=m>>>31;i=s[A>>2]|0;if((i|0)>-1){m=s[S>>2]|0;if((m+(s[T>>2]|0)|0)>>>0<(s[R>>2]|0)>>>0){s[S>>2]=m+1;r[(s[Ve>>2]|0)+m>>0]=i+w;i=0}else i=-1;s[x>>2]=s[x>>2]|i}i=s[_>>2]|0;if(i|0){w=w+255&255;do{m=s[S>>2]|0;if((m+(s[T>>2]|0)|0)>>>0<(s[R>>2]|0)>>>0){s[S>>2]=m+1;r[(s[Ve>>2]|0)+m>>0]=w;m=0;i=s[_>>2]|0}else m=-1;s[x>>2]=s[x>>2]|m;i=i+-1|0;s[_>>2]=i}while((i|0)!=0)}s[A>>2]=o&255;m=s[v>>2]|0;i=s[c>>2]|0}s[v>>2]=m<<8&2147483392;i=i<<8;s[c>>2]=i;s[E>>2]=(s[E>>2]|0)+8}}}else{x=Ve+28|0;m=s[x>>2]|0;i=m>>>1;C=Ve+32|0;m=(s[C>>2]|0)+(m-i)|0;s[C>>2]=m;s[x>>2]=i;I=Ve+36|0;P=Ve+20|0;O=Ve+40|0;N=Ve+24|0;t=Ve+8|0;D=Ve+4|0;L=Ve+44|0;while(1){if(i>>>0>=8388609)break;o=m>>>23;if((o|0)==255)s[I>>2]=(s[I>>2]|0)+1;else{w=m>>>31;i=s[O>>2]|0;if((i|0)>-1){m=s[N>>2]|0;if((m+(s[t>>2]|0)|0)>>>0<(s[D>>2]|0)>>>0){s[N>>2]=m+1;r[(s[Ve>>2]|0)+m>>0]=i+w;i=0}else i=-1;s[L>>2]=s[L>>2]|i}i=s[I>>2]|0;if(i|0){w=w+255&255;do{m=s[N>>2]|0;if((m+(s[t>>2]|0)|0)>>>0<(s[D>>2]|0)>>>0){s[N>>2]=m+1;r[(s[Ve>>2]|0)+m>>0]=w;m=0;i=s[I>>2]|0}else m=-1;s[L>>2]=s[L>>2]|m;i=i+-1|0;s[I>>2]=i}while((i|0)!=0)}s[O>>2]=o&255;m=s[C>>2]|0;i=s[x>>2]|0}m=m<<8&2147483392;s[C>>2]=m;i=i<<8;s[x>>2]=i;s[P>>2]=(s[P>>2]|0)+8}T=s[$e>>2]|0;c=T+1|0;s[$e>>2]=c;R=re(c|0)|0;E=32-R|0;v=E+-5|0;w=(i>>>0)/6|0;if(!v)i=i-(te(w,10-E|0)|0)|0;else{m=m+(i-(te(w,11-E|0)|0))|0;s[C>>2]=m;i=w}s[x>>2]=i;while(1){if(i>>>0>=8388609)break;o=m>>>23;if((o|0)==255)s[I>>2]=(s[I>>2]|0)+1;else{w=m>>>31;i=s[O>>2]|0;if((i|0)>-1){m=s[N>>2]|0;if((m+(s[t>>2]|0)|0)>>>0<(s[D>>2]|0)>>>0){s[N>>2]=m+1;r[(s[Ve>>2]|0)+m>>0]=i+w;i=0}else i=-1;s[L>>2]=s[L>>2]|i}i=s[I>>2]|0;if(i|0){w=w+255&255;do{m=s[N>>2]|0;if((m+(s[t>>2]|0)|0)>>>0<(s[D>>2]|0)>>>0){s[N>>2]=m+1;r[(s[Ve>>2]|0)+m>>0]=w;m=0;i=s[I>>2]|0}else m=-1;s[L>>2]=s[L>>2]|m;i=i+-1|0;s[I>>2]=i}while((i|0)!=0)}s[O>>2]=o&255;m=s[C>>2]|0;i=s[x>>2]|0}m=m<<8&2147483392;s[C>>2]=m;i=i<<8;s[x>>2]=i;s[P>>2]=(s[P>>2]|0)+8}_=c-(16<>2]|0;S=Ve+16|0;o=s[S>>2]|0;if((o+E|0)>>>0>32){c=7-o|0;c=o+((c|0)>-8?c:-8)&-8;v=o;do{m=s[t>>2]|0;w=s[D>>2]|0;if(((s[N>>2]|0)+m|0)>>>0>>0){m=m+1|0;s[t>>2]=m;r[(s[Ve>>2]|0)+(w-m)>>0]=i;m=0}else m=-1;s[L>>2]=s[L>>2]|m;i=i>>>8;v=v+-8|0}while((v|0)>7);o=o+-8-c|0}i=i|_<>2]=i;s[S>>2]=m;w=(s[P>>2]|0)+E|0;s[P>>2]=w;s[$e>>2]=T;_=s[B>>2]|0;if((m+3|0)>>>0>32){v=o+23|0;c=R+-24-o|0;c=o+((c|0)>-8?c:-8)+31-R&-8;do{w=s[t>>2]|0;o=s[D>>2]|0;if(((s[N>>2]|0)+w|0)>>>0>>0){w=w+1|0;s[t>>2]=w;r[(s[Ve>>2]|0)+(o-w)>>0]=i;w=0}else w=-1;s[L>>2]=s[L>>2]|w;i=i>>>8;m=m+-8|0}while((m|0)>7);w=s[P>>2]|0;m=v-R-c|0}s[A>>2]=i|_<>2]=m+3;w=w+3|0;s[P>>2]=w;i=s[x>>2]|0;m=i>>>2;if((De|0)>0){ve=a[29345+(De+-1)>>0]|0;ge=i-(te(m,ve)|0)|0;s[C>>2]=(s[C>>2]|0)+ge;m=te(m,ve-(a[29345+De>>0]|0)|0)|0}else m=i-(te(m,a[29345+De>>0]|0)|0)|0;s[x>>2]=m;i=w;while(1){if(m>>>0>=8388609)break e;w=s[C>>2]|0;o=w>>>23;if((o|0)==255)s[I>>2]=(s[I>>2]|0)+1;else{w=w>>>31;i=s[O>>2]|0;if((i|0)>-1){m=s[N>>2]|0;if((m+(s[t>>2]|0)|0)>>>0<(s[D>>2]|0)>>>0){s[N>>2]=m+1;r[(s[Ve>>2]|0)+m>>0]=i+w;i=0}else i=-1;s[L>>2]=s[L>>2]|i}i=s[I>>2]|0;if(i|0){w=w+255&255;do{m=s[N>>2]|0;if((m+(s[t>>2]|0)|0)>>>0<(s[D>>2]|0)>>>0){s[N>>2]=m+1;r[(s[Ve>>2]|0)+m>>0]=w;m=0;i=s[I>>2]|0}else m=-1;s[L>>2]=s[L>>2]|m;i=i+-1|0;s[I>>2]=i}while((i|0)!=0)}s[O>>2]=o&255;w=s[C>>2]|0;m=s[x>>2]|0;i=s[P>>2]|0}s[C>>2]=w<<8&2147483392;m=m<<8;s[x>>2]=m;i=i+8|0;s[P>>2]=i}}while(0);me=e+24|0;if((s[me>>2]|0)>0?(s[Ae>>2]|0)==0:0)I=ei(V,U,et,Ie,J)|0;else I=0;D=(Ee|0)>0;e:do if(D?((s[Ve+20>>2]|0)+((re(s[Ve+28>>2]|0)|0)+-32)+3|0)<=(b|0):0)if(I){R=(te(et,je)|0)<<2;T=l;l=l+((1*R|0)+15&-16)|0;R=l;l=l+((1*(Ze<<2)|0)+15&-16)|0;x=l;l=l+((1*(Ze<<2)|0)+15&-16)|0;S=te(Ye,rt)|0;C=l;l=l+((1*(S<<2)|0)+15&-16)|0;if((s[me>>2]|0)>7){ti(Fe,0,V,T,Ye,et,Ee,s[W>>2]|0);i=s[Oe>>2]|0;m=s[pe>>2]<=(de|0))break;v=n[i+(A<<1)>>1]|0;o=T+(w+(v<>1]|0)-v<=(v|0))break;he=+h[o+(E<<2)>>2];E=E+1|0;g=g+he*he}he=+H(+(g+1.0000000272452012e-27));h[R+(A+(te(_,s[We>>2]|0)|0)<<2)>>2]=he;A=c}_=_+1|0}while((_|0)<(Ye|0));m=0;do{i=0;while(1){if((i|0)>=(de|0)){i=de;break}ve=i+(te(m,s[We>>2]|0)|0)|0;he=+Q(+ +h[R+(ve<<2)>>2])*1.4426950408889634;h[C+(ve<<2)>>2]=he-+h[17220+(i<<2)>>2];i=i+1|0}while(1){if((i|0)>=(it|0))break;h[C+((te(m,s[We>>2]|0)|0)+i<<2)>>2]=-14;i=i+1|0}m=m+1|0}while((m|0)<(Ye|0));g=+(Ee|0)*.5;i=0;while(1){if((i|0)>=(S|0)){O=1;P=0;i=I;I=Y;ve=0;break e}ve=C+(i<<2)|0;h[ve>>2]=+h[ve>>2]+g;i=i+1|0}}else{O=0;P=0;i=I;I=Y;ve=0}}else{i=I;m=0;Se=171}else{i=0;m=1;Se=171}while(0);if((Se|0)==171){R=(te(et,je)|0)<<2;T=l;l=l+((1*R|0)+15&-16)|0;R=l;l=l+((1*(Ze<<2)|0)+15&-16)|0;x=l;l=l+((1*(Ze<<2)|0)+15&-16)|0;O=(te(Ye,rt)|0)<<2;C=l;l=l+((1*O|0)+15&-16)|0;O=0;P=1;I=0;ve=m}ti(Fe,I,V,T,Ye,et,Ee,s[W>>2]|0);ge=(et|0)==2;if(ge&(Ye|0)==1)s[J>>2]=0;m=s[Oe>>2]|0;w=s[pe>>2]<=(de|0))break;_=n[m+(S<<1)>>1]|0;c=T+(o+(_<>1]|0)-_<=(_|0))break;he=+h[c+(A<<2)>>2];A=A+1|0;g=g+he*he}he=+H(+(g+1.0000000272452012e-27));h[R+(S+(te(E,s[We>>2]|0)|0)<<2)>>2]=he;S=v}E=E+1|0}while((E|0)<(Ye|0));E=(s[Ae>>2]|0)==0;e:do if(E)w=0;else{m=2;while(1){if((m|0)>=(it|0)){w=0;break e}we=R+(m<<2)|0;ae=+h[we>>2];he=+h[R>>2]*9999999747378752e-20;he=ae>2]=he>1.0000000036274937e-15?he:1.0000000036274937e-15;m=m+1|0}}while(0);do{m=0;while(1){if((m|0)>=(de|0)){m=de;break}we=m+(te(w,s[We>>2]|0)|0)|0;he=+Q(+ +h[R+(we<<2)>>2])*1.4426950408889634;h[x+(we<<2)>>2]=he-+h[17220+(m<<2)>>2];m=m+1|0}while(1){if((m|0)>=(it|0))break;h[x+((te(w,s[We>>2]|0)|0)+m<<2)>>2]=-14;m=m+1|0}w=w+1|0}while((w|0)<(Ye|0));we=te(Ye,rt)|0;F=l;l=l+((1*(we<<2)|0)+15&-16)|0;kn(F|0,0,it<<2|0)|0;if(!xe?(G=s[e+204>>2]|0,!((G|0)==0|E^1)):0){_=s[e+92>>2]|0;_=(_|0)<2?2:_;v=0;m=0;y=0;g=0;while(1){if((v|0)>=(Ye|0))break;c=te(rt,v)|0;o=0;k=g;while(1){if((o|0)>=(_|0))break;g=+h[G+(c+o<<2)>>2];w=g<.25;do if(g>-2|w^1){if(w){if(!(g>0))break}else g=.25;g=g*.5}else g=-2;while(0);fe=o+1|0;ue=(n[ke+(fe<<1)>>1]|0)-(n[ke+(o<<1)>>1]|0)|0;m=m+ue|0;y=y+g*+((o<<1|1)-_|0);o=fe;k=k+g*+(ue|0)}v=v+1|0;g=k}g=g/+(m|0)+.20000000298023224;y=y*6/+(te(te(te(Ye,_+-1|0)|0,_+1|0)|0,_)|0)*.5;m=y<.03099999949336052;y=m?m&!(y>-.03099999949336052)?-.03099999949336052:y:.03099999949336052;m=(n[ke+(_<<1)>>1]|0)/2|0;v=0;while(1){w=v+1|0;if((n[ke+(w<<1)>>1]|0)<(m|0))v=w;else break}o=(Ye|0)==2;m=0;c=0;while(1){if((c|0)>=(_|0))break;w=G+(c<<2)|0;if(o){ue=G+(rt+c<<2)|0;w=+h[w>>2]>+h[ue>>2]?w:ue}k=+h[w>>2];k=(k<0?k:0)-(g+y*+(c-v|0));if(k>.25){h[F+(c<<2)>>2]=k+-.25;m=m+1|0}c=c+1|0}e:do if((m|0)>2){g=g+.25;if(g>0){kn(F|0,0,_<<2|0)|0;y=0;g=0;break}else m=0;while(1){if((m|0)>=(_|0))break e;ue=F+(m<<2)|0;he=+h[ue>>2]+-.25;h[ue>>2]=he<0?0:he;m=m+1|0}}while(0);he=g+.20000000298023224;Z=y*64}else{he=0;Z=0}if(E){k=P?0:+(Ee|0)*.5;m=(Ye|0)==2;y=-10;M=0;w=tt;while(1){if((w|0)>=(it|0))break;ae=y+-1;g=+h[x+(w<<2)>>2]-k;g=ae>g?ae:g;do if(m){y=+h[x+(w+rt<<2)>>2]-k;if(g>y)break;g=y}while(0);y=g;M=M+g;w=w+1|0}ue=e+208|0;j=+h[ue>>2];ae=M/+(it-tt|0)-j;oe=ae<-1.5;fe=ae>3&(oe^1);ae=fe|oe?fe?3:-1.5:ae;h[ue>>2]=j+ae*.019999999552965164}else ae=0;if(!O)Mn(C|0,x|0,we<<2|0)|0;e:do if(D){t=Ve+20|0;w=s[t>>2]|0;N=Ve+28|0;m=s[N>>2]|0;do if((i|0)==0?(w+((re(m|0)|0)+-32)+3|0)<=(b|0):0){if((s[me>>2]|0)<=4){c=m;v=w;E=T;i=0;w=I;break}if(!E){c=m;v=w;E=T;i=0;w=I;break}if(xe){c=m;v=w;E=T;i=0;w=I;break}t:do if((Ye|0)==1){i=s[Xe>>2]|0;s[K>>2]=i;g=(s[d>>2]=i,+h[d>>2]);i=0;while(1){i=i+1|0;if((i|0)>=(it|0))break t;j=+h[Xe+(i<<2)>>2];j=g+-1>j?g+-1:j;h[K+(i<<2)>>2]=j;g=j}}else{j=+h[Xe>>2];g=+h[Xe+(rt<<2)>>2];g=j>g?j:g;h[K>>2]=g;i=0;while(1){i=i+1|0;if((i|0)>=(it|0))break t;M=+h[Xe+(i<<2)>>2];j=+h[Xe+(i+rt<<2)>>2];ue=M>j;j=g+-1>(ue?M:j)?g+-1:ue?M:j;h[K+(i<<2)>>2]=j;g=j}}while(0);i=it+-2|0;while(1){if((i|0)<0)break;ue=K+(i<<2)|0;M=+h[ue>>2];j=+h[K+(i+1<<2)>>2]+-1;h[ue>>2]=M>j?M:j;i=i+-1|0}i=it+-1|0;w=0;g=0;do{m=te(w,rt)|0;o=2;while(1){if((o|0)>=(i|0))break;M=+h[x+(o+m<<2)>>2];j=+h[K+(o<<2)>>2];j=(M<0?0:M)-(j<0?0:j);o=o+1|0;g=g+(j<0?0:j)}w=w+1|0}while((w|0)<(Ye|0));if(g/+(te(it+-3|0,Ye)|0)>1){ti(Fe,Y,V,T,Ye,et,Ee,s[W>>2]|0);i=s[Oe>>2]|0;m=s[pe>>2]<=(de|0))break;v=n[i+(A<<1)>>1]|0;o=T+(w+(v<>1]|0)-v<=(v|0))break;j=+h[o+(E<<2)>>2];E=E+1|0;g=g+j*j}j=+H(+(g+1.0000000272452012e-27));h[R+(A+(te(_,s[We>>2]|0)|0)<<2)>>2]=j;A=c}_=_+1|0}while((_|0)<(Ye|0));m=0;do{i=0;while(1){if((i|0)>=(de|0)){i=de;break}ue=i+(te(m,s[We>>2]|0)|0)|0;j=+Q(+ +h[R+(ue<<2)>>2])*1.4426950408889634;h[x+(ue<<2)>>2]=j-+h[17220+(i<<2)>>2];i=i+1|0}while(1){if((i|0)>=(it|0))break;h[x+((te(m,s[We>>2]|0)|0)+i<<2)>>2]=-14;i=i+1|0}m=m+1|0}while((m|0)<(Ye|0));g=+(Ee|0)*.5;i=0;while(1){if((i|0)>=(we|0))break;ue=C+(i<<2)|0;h[ue>>2]=+h[ue>>2]+g;i=i+1|0}h[Ie>>2]=.20000000298023224;m=T;i=1;w=Y}else{m=T;i=0;w=I}c=s[N>>2]|0;v=s[t>>2]|0;E=m}else{c=m;v=w;E=T;w=I}while(0);if((v+((re(c|0)|0)+-32)+3|0)>(b|0)){ue=i;X=w;break}o=c>>>3;m=c-o|0;O=Ve+32|0;if(i){s[O>>2]=(s[O>>2]|0)+m;m=o}s[N>>2]=m;_=Ve+36|0;A=Ve+40|0;S=Ve+24|0;T=Ve+8|0;I=Ve+4|0;P=Ve+44|0;o=v;while(1){if(m>>>0>=8388609){ue=i;X=w;break e}c=s[O>>2]|0;v=c>>>23;if((v|0)==255)s[_>>2]=(s[_>>2]|0)+1;else{c=c>>>31;m=s[A>>2]|0;if((m|0)>-1){o=s[S>>2]|0;if((o+(s[T>>2]|0)|0)>>>0<(s[I>>2]|0)>>>0){s[S>>2]=o+1;r[(s[Ve>>2]|0)+o>>0]=m+c;m=0}else m=-1;s[P>>2]=s[P>>2]|m}m=s[_>>2]|0;if(m|0){c=c+255&255;do{o=s[S>>2]|0;if((o+(s[T>>2]|0)|0)>>>0<(s[I>>2]|0)>>>0){s[S>>2]=o+1;r[(s[Ve>>2]|0)+o>>0]=c;o=0;m=s[_>>2]|0}else o=-1;s[P>>2]=s[P>>2]|o;m=m+-1|0;s[_>>2]=m}while((m|0)!=0)}s[A>>2]=v&255;c=s[O>>2]|0;m=s[N>>2]|0;o=s[t>>2]|0}s[O>>2]=c<<8&2147483392;m=m<<8;s[N>>2]=m;o=o+8|0;s[t>>2]=o}}else{E=T;ue=i;X=I}while(0);m=(te(Ye,je)|0)<<2;$=l;l=l+((1*m|0)+15&-16)|0;m=s[Oe>>2]|0;w=s[pe>>2]<=(de|0))break;g=1/(+h[R+(i+(te(_,s[We>>2]|0)|0)<<2)>>2]+1.0000000272452012e-27);c=i+1|0;v=n[m+(c<<1)>>1]<>1]<=(v|0)){i=c;continue e}fe=i+o|0;h[$+(fe<<2)>>2]=+h[E+(fe<<2)>>2]*g;i=i+1|0}}_=_+1|0;if((_|0)>=(Ye|0))break}Y=l;l=l+((1*(rt<<2)|0)+15&-16)|0;e:do if((f|0)<(Ye*15|0))if(xe&(f|0)<15){i=0;Se=320}else{i=0;Se=322}else{if(xe)if((f|0)<15){i=0;Se=320;break}else{i=0;Se=322;break}if((s[me>>2]|0)<=1){i=0;Se=322;break}if(s[Ae>>2]|0){i=0;Se=322;break}i=(1280/(f|0)|0)+2|0;i=ii(Fe,de,ue,Y,(i|0)<5?5:i,$,je,Ee,+h[Ie>>2],s[J>>2]|0)|0;m=Y+(de+-1<<2)|0;w=de;while(1){if((w|0)>=(it|0))break e;s[Y+(w<<2)>>2]=s[m>>2];w=w+1|0}}while(0);e:do if((Se|0)==320)while(1){Se=0;if((i|0)>=(it|0)){i=ue;break e}s[Y+(i<<2)>>2]=0;i=i+1|0;Se=320}else if((Se|0)==322)while(1){Se=0;if((i|0)>=(it|0)){i=0;break e}s[Y+(i<<2)>>2]=ue;i=i+1|0;Se=322}while(0);oe=l;l=l+((1*(we<<2)|0)+15&-16)|0;c=0;do{m=te(c,rt)|0;v=tt;while(1){if((v|0)>=(it|0))break;w=v+m|0;o=x+(w<<2)|0;g=+h[o>>2];if(+q(+(g-+h[Xe+(w<<2)>>2]))<2)h[o>>2]=g-+h[Ke+(w<<2)>>2]*.25;v=v+1|0}c=c+1|0}while((c|0)<(Ye|0));Si(Fe,tt,it,de,x,Xe,b,oe,Ve,Ye,Ee,u,s[e+12>>2]|0,e+84|0,(s[me>>2]|0)>3&1,s[e+56>>2]|0,s[Ae>>2]|0);ie=Ve+4|0;m=s[ie>>2]<<3;ne=Ve+20|0;c=s[ne>>2]|0;fe=Ve+28|0;o=s[fe>>2]|0;_=c+((re(o|0)|0)+-32)|0;w=(ue|0)!=0;v=w?2:4;if(D)O=(_+v+1|0)>>>0<=m>>>0;else O=0;P=m-(O&1)|0;I=w?4:5;V=Ve+32|0;W=Ve+36|0;K=Ve+40|0;J=Ve+24|0;ee=Ve+8|0;se=Ve+44|0;E=0;T=tt;S=0;while(1){if((T|0)>=(it|0))break;m=Y+(T<<2)|0;if((_+v|0)>>>0>P>>>0){s[m>>2]=E;w=E;m=S}else{A=s[m>>2]|0;v=o>>>v;w=o-v|0;m=(A|0)==(E|0);if(!m)s[V>>2]=(s[V>>2]|0)+w;v=m?w:v;s[fe>>2]=v;m=c;while(1){if(v>>>0>=8388609)break;w=s[V>>2]|0;c=w>>>23;if((c|0)==255){s[W>>2]=(s[W>>2]|0)+1;o=v}else{o=w>>>31;m=s[K>>2]|0;if((m|0)>-1){w=s[J>>2]|0;if((w+(s[ee>>2]|0)|0)>>>0<(s[ie>>2]|0)>>>0){s[J>>2]=w+1;r[(s[Ve>>2]|0)+w>>0]=m+o;m=0}else m=-1;s[se>>2]=s[se>>2]|m}m=s[W>>2]|0;if(m|0){o=o+255&255;do{w=s[J>>2]|0;if((w+(s[ee>>2]|0)|0)>>>0<(s[ie>>2]|0)>>>0){s[J>>2]=w+1;r[(s[Ve>>2]|0)+w>>0]=o;w=0;m=s[W>>2]|0}else w=-1;s[se>>2]=s[se>>2]|w;m=m+-1|0;s[W>>2]=m}while((m|0)!=0)}s[K>>2]=c&255;w=s[V>>2]|0;o=s[fe>>2]|0;m=s[ne>>2]|0}s[V>>2]=w<<8&2147483392;v=o<<8;s[fe>>2]=v;m=m+8|0;s[ne>>2]=m}c=m;o=v;w=A;_=m+((re(v|0)|0)+-32)|0;m=S|A}E=w;T=T+1|0;v=I;S=m}v=ue<<2;do if(O){if((r[v+S+(27892+(Ee<<3))>>0]|0)==(r[(v|2)+S+(27892+(Ee<<3))>>0]|0)){i=0;m=o;break}m=o>>>1;w=o-m|0;if(!i)m=w;else s[V>>2]=(s[V>>2]|0)+w;s[fe>>2]=m;w=c;while(1){if(m>>>0>=8388609)break;o=s[V>>2]|0;c=o>>>23;if((c|0)==255)s[W>>2]=(s[W>>2]|0)+1;else{o=o>>>31;m=s[K>>2]|0;if((m|0)>-1){w=s[J>>2]|0;if((w+(s[ee>>2]|0)|0)>>>0<(s[ie>>2]|0)>>>0){s[J>>2]=w+1;r[(s[Ve>>2]|0)+w>>0]=m+o;m=0}else m=-1;s[se>>2]=s[se>>2]|m}m=s[W>>2]|0;if(m|0){o=o+255&255;do{w=s[J>>2]|0;if((w+(s[ee>>2]|0)|0)>>>0<(s[ie>>2]|0)>>>0){s[J>>2]=w+1;r[(s[Ve>>2]|0)+w>>0]=o;w=0;m=s[W>>2]|0}else w=-1;s[se>>2]=s[se>>2]|w;m=m+-1|0;s[W>>2]=m}while((m|0)!=0)}s[K>>2]=c&255;o=s[V>>2]|0;m=s[fe>>2]|0;w=s[ne>>2]|0}s[V>>2]=o<<8&2147483392;m=m<<8;s[fe>>2]=m;w=w+8|0;s[ne>>2]=w}i=i<<1;c=w}else{i=0;m=o}while(0);i=v+i|0;w=tt;while(1){if((w|0)>=(it|0))break;G=Y+(w<<2)|0;s[G>>2]=r[i+(s[G>>2]|0)+(27892+(Ee<<3))>>0];w=w+1|0}e:do if((c+((re(m|0)|0)+-32)+4|0)<=(b|0)){t:do if(!(s[Ae>>2]|0)){i:do if(xe){if(!(s[me>>2]|0)){s[e+80>>2]=0;Se=415;break}i=e+80|0;if(!ue){s[i>>2]=3;i=3;Se=414;break t}else{s[i>>2]=2;i=2;Se=414;break t}}else{i=s[me>>2]|0;do if(!X){if((i|0)<3|(u|0)<(Ye*10|0))break;L=e+88|0;U=e+80|0;B=s[U>>2]|0;D=e+96|0;t=s[Oe>>2]|0;P=s[pe>>2]<>1]|0)-(n[t+(de+-1<<1)>>1]|0)<>2]=0;i=0;u=m>>>5;break i}else{N=0;i=0;u=0;w=0}do{O=te(N,P)|0;I=0;while(1){if((I|0)>=(de|0))break;E=n[t+(I<<1)>>1]|0;o=$+(E<>1]|0)-E<>2];j=j*j*g;v=v+1|0;A=A+(j<.25&1)|0;S=S+(j<.015625&1)|0;T=T+(j<.0625&1)|0}if((I|0)>((s[We>>2]|0)+-4|0))i=i+((T+A<<5>>>0)/(E>>>0)|0)|0;I=_;u=u+1|0;w=w+(((S<<1|0)>=(E|0)&1)+((T<<1|0)>=(E|0)&1)+((A<<1|0)>=(E|0)&1)<<8)|0}N=N+1|0}while((N|0)<(Ye|0));if(!ce){if(!i)i=0;else i=(i>>>0)/((te(4-(s[We>>2]|0)+de|0,Ye)|0)>>>0)|0;i=(s[D>>2]|0)+i>>1;s[D>>2]=i;switch(s[le>>2]|0){case 2:{i=i+4|0;break}case 0:{i=i+-4|0;break}default:{}}s[le>>2]=(i|0)>22?2:(i|0)>18&1}i=((w>>>0)/(u>>>0)|0)+(s[L>>2]|0)>>1;s[L>>2]=i;i=(i*3|0)+(3-B<<7|64)+2>>2;do if((i|0)>=80){if((i|0)<256){i=2;break}i=(i|0)<384&1;s[U>>2]=i;u=m>>>5;if((i|0)>0){Se=418;break t}else break i}else i=3;while(0);s[U>>2]=i;u=m>>>5;Se=418;break t}while(0);u=e+80|0;if(!i){s[u>>2]=0;Se=415;break}else{s[u>>2]=2;i=2;Se=414;break t}}while(0);if((Se|0)==415){i=0;u=m>>>5}i=m-(te(u,a[28203+i>>0]|0)|0)|0}else{s[le>>2]=0;s[e+80>>2]=2;i=2;Se=414}while(0);if((Se|0)==414){u=m>>>5;Se=418}if((Se|0)==418){pe=a[28203+(i+-1)>>0]|0;de=m-(te(u,pe)|0)|0;s[V>>2]=(s[V>>2]|0)+de;i=te(u,pe-(a[28203+i>>0]|0)|0)|0}s[fe>>2]=i;u=c;while(1){if(i>>>0>=8388609)break e;m=s[V>>2]|0;w=m>>>23;if((w|0)==255)s[W>>2]=(s[W>>2]|0)+1;else{m=m>>>31;i=s[K>>2]|0;if((i|0)>-1){u=s[J>>2]|0;if((u+(s[ee>>2]|0)|0)>>>0<(s[ie>>2]|0)>>>0){ +s[J>>2]=u+1;r[(s[Ve>>2]|0)+u>>0]=i+m;i=0}else i=-1;s[se>>2]=s[se>>2]|i}i=s[W>>2]|0;if(i|0){m=m+255&255;do{u=s[J>>2]|0;if((u+(s[ee>>2]|0)|0)>>>0<(s[ie>>2]|0)>>>0){s[J>>2]=u+1;r[(s[Ve>>2]|0)+u>>0]=m;u=0;i=s[W>>2]|0}else u=-1;s[se>>2]=s[se>>2]|u;i=i+-1|0;s[W>>2]=i}while((i|0)!=0)}s[K>>2]=w&255;m=s[V>>2]|0;i=s[fe>>2]|0;u=s[ne>>2]|0}s[V>>2]=m<<8&2147483392;i=i<<8;s[fe>>2]=i;u=u+8|0;s[ne>>2]=u}}while(0);G=l;l=l+((1*(rt<<2)|0)+15&-16)|0;O=e+52|0;j=+ri(x,C,rt,tt,it,Ye,G,s[be>>2]|0,s[Fe+56>>2]|0,ue,s[_e>>2]|0,s[O>>2]|0,ke,Ee,f,Ce,s[Ae>>2]|0,F);if(s[Ae>>2]|0)s[G>>2]=(f|0)>26?8:(f|0)/3|0;N=l;l=l+((1*(rt<<2)|0)+15&-16)|0;i=s[We>>2]|0;f=(Ee<<1)+Ye+-1|0;u=Fe+104|0;m=0;while(1){if((m|0)>=(i|0))break;_e=m+1|0;be=s[Oe>>2]|0;pe=(te(i,f)|0)+m|0;s[N+(m<<2)>>2]=(te(te((a[(s[u>>2]|0)+pe>>0]|0)+64|0,Ye)|0,(n[be+(_e<<1)>>1]|0)-(n[be+(m<<1)>>1]|0)<>2;m=_e}C=b<<3;be=s[ne>>2]|0;i=s[fe>>2]|0;_e=32-(re(i|0)|0)|0;I=i>>>(_e+-16|0);A=(I>>>12)+-8|0;f=be;u=6;b=tt;A=(be<<3)-((_e<<3)+(A+(I>>>0>(s[5272+(A<<2)>>2]|0)>>>0&1)))|0;I=0;while(1){if((b|0)>=(it|0))break;T=b+1|0;o=(te(Ye,(n[ke+(T<<1)>>1]|0)-(n[ke+(b<<1)>>1]|0)|0)|0)<=(C-S|0))break;if((_|0)>=(s[c>>2]|0))break;w=(v|0)<(s[E>>2]|0);b=i>>>b;i=i-b|0;if(w){s[V>>2]=(s[V>>2]|0)+i;i=b}s[fe>>2]=i;while(1){if(i>>>0>=8388609)break;b=s[V>>2]|0;m=b>>>23;if((m|0)==255)s[W>>2]=(s[W>>2]|0)+1;else{b=b>>>31;i=s[K>>2]|0;if((i|0)>-1){f=s[J>>2]|0;if((f+(s[ee>>2]|0)|0)>>>0<(s[ie>>2]|0)>>>0){s[J>>2]=f+1;r[(s[Ve>>2]|0)+f>>0]=i+b;i=0}else i=-1;s[se>>2]=s[se>>2]|i}i=s[W>>2]|0;if(i|0){b=b+255&255;do{f=s[J>>2]|0;if((f+(s[ee>>2]|0)|0)>>>0<(s[ie>>2]|0)>>>0){s[J>>2]=f+1;r[(s[Ve>>2]|0)+f>>0]=b;f=0;i=s[W>>2]|0}else f=-1;s[se>>2]=s[se>>2]|f;i=i+-1|0;s[W>>2]=i}while((i|0)!=0)}s[K>>2]=m&255;b=s[V>>2]|0;i=s[fe>>2]|0;f=s[ne>>2]|0}s[V>>2]=b<<8&2147483392;i=i<<8;s[fe>>2]=i;f=f+8|0;s[ne>>2]=f}be=32-(re(i|0)|0)|0;_e=i>>>(be+-16|0);m=(_e>>>12)+-8|0;m=(f<<3)-((be<<3)+(m+(_e>>>0>(s[5272+(m<<2)>>2]|0)>>>0&1)))|0;if(!w)break;_=_+o|0;b=1;v=v+1|0;S=S+o|0}if(v)u=(u|0)<3?2:u+-1|0;s[E>>2]=_;b=T;A=m;I=S}F=(Ye|0)==2;if(F){if(!Ee)w=0;else{u=0;g=1.0000000036274937e-15;y=1.0000000036274937e-15;e:while(1){if((u|0)==13)break;ke=s[Oe>>2]|0;b=u+1|0;m=n[ke+(b<<1)>>1]<>1]<=(m|0)){u=b;continue e}k=+h[$+(u<<2)>>2];M=+h[$+(u+je<<2)>>2];u=u+1|0;g=g+(+q(+k)+ +q(+M));y=y+(+q(+(k+M))+ +q(+(k-M)))}}w=n[(s[Oe>>2]|0)+26>>1]<>2]=+(w+((Ee|0)<2?5:13)|0)*(y*.7071070075035095)>+(w|0)*g&1;w=Ee}g=+((Be|0)/1e3|0|0);m=e+200|0;u=s[m>>2]|0;b=0;while(1){if((b|0)>=21)break;if(+h[5104+(b<<2)>>2]>g)break;b=b+1|0}if(!((b|0)>(u|0)?+h[5104+(u<<2)>>2]+ +h[5188+(u<<2)>>2]>g:0))Se=480;do if((Se|0)==480){if((b|0)>=(u|0)){u=b;break}Ee=u+-1|0;if(!(+h[5104+(Ee<<2)>>2]-+h[5188+(Ee<<2)>>2](u|0);s[m>>2]=(it|0)<((U?tt:u)|0)?it:U?tt:u;U=w}else U=Ee;if((A+48|0)>(C-I|0))P=5;else{do if((tt|0)>0)Se=487;else{if(s[Ae>>2]|0){Se=487;break}c=e+196|0;M=+h[Ie>>2];v=s[e+200>>2]|0;if(F){u=0;g=0;while(1){if((u|0)==8)break;m=s[Oe>>2]|0;b=n[m+(u<<1)>>1]|0;o=b<>1]|0)-b<=(b|0))break;k=y+ +h[w+(m<<2)>>2]*+h[o+(m<<2)>>2];m=m+1|0;y=k}g=g+y}y=+q(+(g*.125));y=y>1?1:y;u=8;k=y;while(1){if((u|0)>=(v|0))break;m=s[Oe>>2]|0;b=n[m+(u<<1)>>1]|0;o=b<>1]|0)-b<=(b|0))break;st=g+ +h[w+(m<<2)>>2]*+h[o+(m<<2)>>2];m=m+1|0;g=st}st=+q(+g);k=k1?1:st;y=+Q(+(1.0010000467300415-y*y))*1.4426950408889634;g=y*.5;st=+Q(+(1.0010000467300415-st*st))*1.4426950408889634;y=y*.75;k=+h[c>>2]+.25;st=-((g>st?g:st)*.5);h[c>>2]=k=(b|0))break;g=g+ +h[x+(u+(te(m,s[We>>2]|0)|0)<<2)>>2]*+((u<<1)+2-it|0);u=u+1|0}m=m+1|0}while((m|0)<(Ye|0));g=(g/+(te(b,Ye)|0)+1)/6;ke=g>2;Ee=g<-2&(ke^1);g=y-(Ee|ke?Ee?-2:2:g)-Z-M*2;if(s[e+120>>2]|0){st=(+h[e+128>>2]+.05000000074505806)*2;ke=st>2;Ee=st<-2&(ke^1);g=g-(Ee|ke?Ee?-2:2:st)}u=~~+z(+(g+.5));if((u|0)>10){b=i>>>7;u=10;Se=512;break}b=i>>>7;if((u|0)>=0){if((u|0)>0){Se=512;break}}else u=0;w=u;i=i-(te(b,a[28207+u>>0]|0)|0)|0}while(0);if((Se|0)==487){h[e+196>>2]=0;b=i>>>7;u=5;Se=512}if((Se|0)==512){Se=a[28207+(u+-1)>>0]|0;w=i-(te(b,Se)|0)|0;s[V>>2]=(s[V>>2]|0)+w;w=u;i=te(b,Se-(a[28207+u>>0]|0)|0)|0}s[fe>>2]=i;b=f;while(1){if(i>>>0>=8388609)break;f=s[V>>2]|0;m=f>>>23;if((m|0)==255){s[W>>2]=(s[W>>2]|0)+1;u=f;f=b}else{u=f>>>31;i=s[K>>2]|0;if((i|0)>-1){f=s[J>>2]|0;if((f+(s[ee>>2]|0)|0)>>>0<(s[ie>>2]|0)>>>0){s[J>>2]=f+1;r[(s[Ve>>2]|0)+f>>0]=i+u;i=0}else i=-1;s[se>>2]=s[se>>2]|i}i=s[W>>2]|0;if(i|0){u=u+255&255;do{f=s[J>>2]|0;if((f+(s[ee>>2]|0)|0)>>>0<(s[ie>>2]|0)>>>0){s[J>>2]=f+1;r[(s[Ve>>2]|0)+f>>0]=u;f=0;i=s[W>>2]|0}else f=-1;s[se>>2]=s[se>>2]|f;i=i+-1|0;s[W>>2]=i}while((i|0)!=0)}s[K>>2]=m&255;u=s[V>>2]|0;i=s[fe>>2]|0;f=s[ne>>2]|0}s[V>>2]=u<<8&2147483392;i=i<<8;s[fe>>2]=i;b=f+8|0;s[ne>>2]=b}Ee=32-(re(i|0)|0)|0;Se=i>>>(Ee+-16|0);A=(Se>>>12)+-8|0;f=b;P=w;A=(b<<3)-((Ee<<3)+(A+(Se>>>0>(s[5272+(A<<2)>>2]|0)>>>0&1)))|0}if(Me){T=(s[Te>>2]|0)-U|0;f=3-U|0;x=1275>>>f;x=(p|0)<(x|0)?p:x;if(xe){i=(Ye*72|0)+32|0;i=(Le|0)<(i|0)?0:Le-i|0}else i=Le-((Ye*320|0)+160)|0;S=(s[O>>2]|0)==0;if(S)E=i;else E=i+(s[e+184>>2]>>T)|0;if(xe){i=s[e+156>>2]|0;st=+h[Ie>>2];i=~~(+(E+((i|0)<100?96>>>f:0)-((i|0)>100?144>>>f:0)|0)+(st+-.25)*400);Oe=(A+I+63>>6)+2|0;f=Re+296+I+63>>6;i=!(st>.699999988079071)|(i|0)>400?i:400;f=(Oe|0)>(f|0)?Oe:f}else{f=s[e+92>>2]|0;b=s[e+200>>2]|0;y=+h[e+196>>2];m=s[Ce>>2]|0;k=+h[Ie>>2];p=s[e+64>>2]|0;v=s[Ae>>2]|0;_=(s[e+204>>2]|0)!=0;c=s[We>>2]|0;o=s[Oe>>2]|0;f=(f|0)==0?c:f;i=n[o+(f<<1)>>1]<(b|0)?b:f)<<1)>>1]<>2]|0)==0;do if(u)i=E;else{g=+h[e+136>>2];if(!(g<.4)){i=E;break}i=E-~~(+(w<<3|0)*(.4000000059604645-g))|0}while(0);if(F){Oe=(f|0)>(b|0)?b:f;Oe=(n[o+(Oe<<1)>>1]<>2]+-.15000000596046448;g=+(w<<3|0);i=i+~~(g*1.2000000476837158*((st<0?0:st)+-.09000000357627869))|0;if(!ye)break;i=i+~~(g*.800000011920929)|0}while(0);if(_&(v|0)==0){Oe=i+~~(+(w<<3|0)*he)|0;i=(i|0)/4|0;i=(i|0)>(Oe|0)?i:Oe}Ie=~~(+((te(n[o+(c+-2<<1)>>1]<>2;Oe=(Ie|0)>(Oe|0)?Ie:Oe;i=(i|0)<(Oe|0)?i:Oe;do if(!(_&(v|0)==0)){if(!S)i=~~(+(i-E|0)*.6700000166893005)+E|0;if(!(k<.20000000298023224&(_^1)))break;Oe=96e3-Be|0;Ie=(Oe|0)>32e3;i=i+~~(((Be|0)>96e3&(Ie^1)?0:Ie?.09919999539852142:+(Oe|0)*3099999958067201e-21)*ae*+(i|0))|0}while(0);f=E<<1;i=(f|0)<(i|0)?f:i;f=(A+I+63>>6)+2|0}p=i+A|0;b=p+32>>6;b=(f|0)>(b|0)?f:b;b=(x|0)<(b|0)?x:b;m=(Ue|0)==0;i=m?b:2;f=e+188|0;u=s[f>>2]|0;if((u|0)<970){s[f>>2]=u+1;g=1/+(u+21|0)}else g=.0010000000474974513;do if(!S){f=e+176|0;s[f>>2]=(s[f>>2]|0)+((m?b<<6:128)-Le);f=e+184|0;Oe=e+180|0;u=s[Oe>>2]|0;u=u+~~(g*+(((m?p-Le|0:0)<>2]|0)-u|0))|0;s[Oe>>2]=u;s[f>>2]=0-u;f=e+176|0;u=s[f>>2]|0;if((u|0)>=0)break;s[f>>2]=0;i=m?b+((u|0)/-64|0)|0:2}while(0);B=(x|0)<(i|0)?x:i;Le=s[Ve>>2]|0;f=s[ee>>2]|0;i=0-f|0;Tn(Le+B+i|0,Le+(s[ie>>2]|0)+i|0,f|0)|0;s[ie>>2]=B;f=s[ne>>2]|0;i=s[fe>>2]|0}else B=p;t=l;l=l+((1*(rt<<2)|0)+15&-16)|0;C=l;l=l+((1*(rt<<2)|0)+15&-16)|0;D=l;l=l+((1*(rt<<2)|0)+15&-16)|0;I=B<<6;Le=32-(re(i|0)|0)|0;L=i>>>(Le+-16|0);i=(L>>>12)+-8|0;i=I+((Le<<3)+(i+(L>>>0>(s[5272+(i<<2)>>2]|0)>>>0&1))-(f<<3))+-1|0;L=(ue|0)==0;if((U|0)>1&(L^1))T=(i|0)>=((U<<3)+16|0);else T=0;x=T?8:0;f=i-x|0;if(!(s[e+120>>2]|0))i=it+-1|0;else{do if((Be|0)<(Ye*32e3|0))i=13;else{if((Be|0)<(Ye*48e3|0)){i=16;break}if((Be|0)<(Ye*6e4|0)){i=18;break}i=(Be|0)<(Ye*8e4|0)?19:20}while(0);Be=s[e+144>>2]|0;i=(Be|0)>(i|0)?Be:i}S=e+200|0;u=e+92|0;A=Ti(Fe,tt,it,G,N,P,S,He,f,ze,C,t,D,Ye,U,Ve,1,s[u>>2]|0,(s[Ae>>2]|0)==0?i:1)|0;i=s[u>>2]|0;if(!i)i=A;else{Le=i+1|0;i=i+-1|0;Be=(i|0)>(A|0);i=(Le|0)<((Be?i:A)|0)?Le:Be?i:A}s[u>>2]=i;O=Ve+12|0;N=Ve+16|0;E=tt;while(1){if((E|0)>=(it|0))break;o=s[t+(E<<2)>>2]|0;if((o|0)>=1){c=65536<>16;g=+(c|0);y=+(1<<14-o|0);v=c+-1|0;i=s[We>>2]|0;_=0;do{w=~~+z(+((+h[oe+(E+(te(_,i)|0)<<2)>>2]+.5)*g));w=(w|0)<(c|0)?w:v;w=(w|0)<0?0:w;i=s[O>>2]|0;f=s[N>>2]|0;if((f+o|0)>>>0>32){b=7-f|0;b=f+((b|0)>-8?b:-8)&-8;m=f;do{u=s[ee>>2]|0;p=s[ie>>2]|0;if(((s[J>>2]|0)+u|0)>>>0

>>0){u=u+1|0;s[ee>>2]=u;r[(s[Ve>>2]|0)+(p-u)>>0]=i;u=0}else u=-1;s[se>>2]=s[se>>2]|u;i=i>>>8;m=m+-8|0}while((m|0)>7);f=f+-8-b|0}s[O>>2]=i|w<>2]=f+o;s[ne>>2]=(s[ne>>2]|0)+o;st=(+(w|0)+.5)*y*6103515625e-14+-.5;i=Xe+(E+(te(_,s[We>>2]|0)|0)<<2)|0;h[i>>2]=+h[i>>2]+st;i=s[We>>2]|0;Be=oe+(E+(te(_,i)|0)<<2)|0;h[Be>>2]=+h[Be>>2]-st;_=_+1|0}while((_|0)<(Ye|0))}E=E+1|0}Be=l;l=l+((1*we|0)+15&-16)|0;P=e+76|0;sr(1,Fe,tt,it,$,F?$+(je<<2)|0:0,Be,R,C,X,s[e+80>>2]|0,s[He>>2]|0,s[S>>2]|0,Y,I-x|0,s[ze>>2]|0,Ve,U,A,P,s[me>>2]|0,s[e+72>>2]|0);if(T){w=(s[e+116>>2]|0)<2&1;i=s[O>>2]|0;f=s[N>>2]|0;if((f+1|0)>>>0>32){b=7-f|0;b=f+((b|0)>-8?b:-8)&-8;m=f;do{u=s[ee>>2]|0;p=s[ie>>2]|0;if(((s[J>>2]|0)+u|0)>>>0

>>0){u=u+1|0;s[ee>>2]=u;r[(s[Ve>>2]|0)+(p-u)>>0]=i;u=0}else u=-1;s[se>>2]=s[se>>2]|u;i=i>>>8;m=m+-8|0}while((m|0)>7);f=f+-8-b|0}s[O>>2]=i|w<>2]=f+1;i=(s[ne>>2]|0)+1|0;s[ne>>2]=i}else i=s[ne>>2]|0;i=(B<<3)-(i+((re(s[fe>>2]|0)|0)+-32))|0;E=0;while(1){if((E|0)==2)break;else _=tt;while(1){if(!((_|0)<(it|0)&(i|0)>=(Ye|0)))break;f=s[t+(_<<2)>>2]|0;do if((f|0)<=7){if((s[D+(_<<2)>>2]|0)!=(E|0))break;g=+(1<<14-f+-1|0);f=s[We>>2]|0;u=s[N>>2]|0;p=s[O>>2]|0;v=0;do{c=!(+h[oe+(_+(te(v,f)|0)<<2)>>2]<0);o=c&1;if((u+1|0)>>>0>32){m=7-u|0;m=u+((m|0)>-8?m:-8)&-8;w=u;f=p;do{p=s[ee>>2]|0;b=s[ie>>2]|0;if(((s[J>>2]|0)+p|0)>>>0>>0){p=p+1|0;s[ee>>2]=p;r[(s[Ve>>2]|0)+(b-p)>>0]=f;p=0}else p=-1;s[se>>2]=s[se>>2]|p;f=f>>>8;w=w+-8|0}while((w|0)>7);u=u+-8-m|0}else f=p;p=f|o<>2]=p;s[N>>2]=u;s[ne>>2]=(s[ne>>2]|0)+1;st=(+(c&1)+-.5)*g*6103515625e-14;f=Xe+(_+(te(v,s[We>>2]|0)|0)<<2)|0;h[f>>2]=+h[f>>2]+st;f=s[We>>2]|0;He=oe+(_+(te(v,f)|0)<<2)|0;h[He>>2]=+h[He>>2]-st;i=i+-1|0;v=v+1|0}while((v|0)<(Ye|0))}while(0);_=_+1|0}E=E+1|0}p=Ze<<2;kn(Ke|0,0,p|0)|0;f=0;do{i=te(f,rt)|0;u=tt;while(1){if((u|0)>=(it|0))break;We=u+i|0;st=+h[oe+(We<<2)>>2];ze=st>.5;He=st<-.5&(ze^1);h[Ke+(We<<2)>>2]=He|ze?He?-.5:.5:st;u=u+1|0}f=f+1|0}while((f|0)<(Ye|0));e:do if(Ue|0){i=0;while(1){if((i|0)>=(we|0))break e;h[Xe+(i<<2)>>2]=-28;i=i+1|0}}while(0);s[e+104>>2]=s[$e>>2];h[e+108>>2]=Pe;s[e+112>>2]=De;if(ge&(Ye|0)==1)Mn(Xe+(rt<<2)|0,Xe|0,rt<<2|0)|0;e:do if(L){Mn(Qe|0,Je|0,p|0)|0;Mn(Je|0,Xe|0,p|0)|0;u=0}else{i=0;while(1){if((i|0)>=(Ze|0)){u=0;break e}$e=Je+(i<<2)|0;Pe=+h[$e>>2];st=+h[Xe+(i<<2)>>2];h[$e>>2]=Pe=(tt|0)){i=it;break}$e=f+i|0;h[Xe+($e<<2)>>2]=0;h[Qe+($e<<2)>>2]=-28;h[Je+($e<<2)>>2]=-28;i=i+1|0}while(1){if((i|0)>=(rt|0))break;$e=f+i|0;h[Xe+($e<<2)>>2]=0;h[Qe+($e<<2)>>2]=-28;h[Je+($e<<2)>>2]=-28;i=i+1|0}u=u+1|0}while((u|0)<(et|0));f=e+116|0;if(!(ue|ve))i=0;else i=(s[f>>2]|0)+1|0;s[f>>2]=i;s[P>>2]=s[fe>>2];li(Ve);e=(s[se>>2]|0)==0?B:-3;qe(Ge|0);l=nt;return e|0}function Qt(e,t,i,r,n,a,o,f,c,u,d){e=e|0;t=t|0;i=i|0;r=r|0;n=n|0;a=a|0;o=o|0;f=f|0;c=c|0;u=u|0;d=d|0;var p=0,b=0,m=0,w=0,g=0,v=0,_=0,y=0,k=0,E=0,A=0,S=0,M=0,T=0,R=0,x=0,C=0,I=0,P=0,O=0,N=0,D=0,L=0,B=0,U=0;B=l;l=l+16|0;L=B+8|0;v=B;k=s[e>>2]|0;O=s[k+4>>2]|0;m=n+1024|0;D=(te(m,r)|0)<<2;N=l;l=l+((1*D|0)+15&-16)|0;s[L>>2]=N;s[L+4>>2]=N+(m<<2);N=O+n|0;D=n<<2;p=0;do{P=s[L+(p<<2)>>2]|0;Mn(P|0,i+(p<<10<<2)|0,4096)|0;Mn(P+4096|0,t+((te(p,N)|0)<<2)+(O<<2)|0,D|0)|0;p=p+1|0}while((p|0)<(r|0));if(!u){s[v>>2]=15;P=e+104|0;I=15;_=0}else{g=Ne()|0;p=l;l=l+((1*(m>>1<<2)|0)+15&-16)|0;bi(L,p,m,r);wi(p+2048|0,p,n,979,v);s[v>>2]=1024-(s[v>>2]|0);u=e+104|0;b=+vi(p,n,v,s[u>>2]|0,+h[e+108>>2]);p=s[v>>2]|0;if((p|0)>1022){s[v>>2]=1022;p=1022}_=b*.699999988079071;C=s[e+56>>2]|0;_=(C|0)>2?_*.5:_;qe(g|0);P=u;I=p;_=(C|0)>8?0:(C|0)>4?_*.5:_}m=s[P>>2]|0;C=I-m|0;b=(((C|0)>-1?C:0-C|0)*10|0)>(I|0)?.4000000059604645:.20000000298023224;if((d|0)>=25){if((d|0)<35)y=11}else{b=b+.10000000149011612;y=11}if((y|0)==11)b=b+.10000000149011612;C=e+108|0;w=+h[C>>2];b=w>.4000000059604645?b+-.10000000149011612:b;b=w>.550000011920929?b+-.10000000149011612:b;if(_<(b>.20000000298023224?b:.20000000298023224)){w=0;x=0;p=0}else{u=+q(+(_-w))<.10000000149011612;u=~~+z(+((u?w:_)*32/3+.5));p=u+-1|0;if((p|0)<=7)if((u|0)<1)p=0;else y=15;else{p=7;y=15}w=+(p+1|0)*.09375;x=1}M=k+44|0;T=O<<2;b=-w;R=e+112|0;k=k+60|0;E=(n|0)>1024;A=1024-n<<2;S=0-n|0;u=0;while(1){d=s[M>>2]|0;y=d-O|0;s[P>>2]=(m|0)>15?m:15;m=t+((te(u,N)|0)<<2)|0;g=e+212+((te(u,O)|0)<<2)|0;Mn(m|0,g|0,T|0)|0;if((d|0)==(O|0))d=s[L+(u<<2)>>2]|0;else{d=s[L+(u<<2)>>2]|0;U=s[P>>2]|0;_=-+h[C>>2];v=s[R>>2]|0;As(m+(O<<2)|0,d+4096|0,U,U,y,_,_,v,v,0,0)}v=d+4096|0;As(m+(O<<2)+(y<<2)|0,v+(y<<2)|0,s[P>>2]|0,I,n-y|0,-+h[C>>2],b,s[R>>2]|0,a,s[k>>2]|0,O);Mn(g|0,m+(n<<2)|0,T|0)|0;m=i+(u<<10<<2)|0;if(E)Mn(m|0,d+(n<<2)|0,4096)|0;else{Tn(m|0,m+(n<<2)|0,A|0)|0;Mn(m+4096+(S<<2)|0,v|0,D|0)|0}u=u+1|0;if((u|0)>=(r|0))break;m=s[P>>2]|0}h[f>>2]=w;s[o>>2]=I;s[c>>2]=p;l=B;return x|0}function ei(e,t,i,r,n){e=e|0;t=t|0;i=i|0;r=r|0;n=n|0;var o=0,f=0,c=0,u=0,d=0,p=0,b=0,m=0,w=0,g=0,v=0,_=0,y=0,k=0,E=0,A=0,S=0,M=0;E=l;p=l;l=l+((1*(t<<2)|0)+15&-16)|0;b=(t|0)/2|0;m=+(b|0);w=+(b|0);g=b+-5|0;v=(b*6|0)+-102|0;_=0;y=0;while(1){if((_|0)>=(i|0))break;c=te(_,t)|0;u=0;o=0;f=0;while(1){if((u|0)>=(t|0))break;A=+h[e+(u+c<<2)>>2];d=o+A;h[p+(u<<2)>>2]=d;u=u+1|0;o=f+d-A*2;f=A-d*.5}c=p;u=c+48|0;do{s[c>>2]=0;c=c+4|0}while((c|0)<(u|0));c=0;d=0;o=0;while(1){if((c|0)>=(b|0)){c=b;f=0;break}u=c<<1;A=+h[p+(u<<2)>>2];f=+h[p+((u|1)<<2)>>2];f=A*A+f*f;A=o+(f-o)*.0625;h[p+(c<<2)>>2]=A;c=c+1|0;d=d+f;o=A}e:while(1){u=c;o=f;while(1){c=u+-1|0;if((u|0)<=0)break e;u=p+(c<<2)|0;o=o+(+h[u>>2]-o)*.125;h[u>>2]=o;if(f>o)u=c;else{f=o;continue e}}}o=w/(+H(+(d*f*.5*m))+1.0000000036274937e-15)*64;c=12;u=0;while(1){if((c|0)>=(g|0))break;A=+z(+(o*(+h[p+(c<<2)>>2]+1.0000000036274937e-15)));M=A>127;S=A<0&(M^1);c=c+4|0;u=u+(a[28075+~~(S|M?S?0:127:A)>>0]|0)|0}c=(u<<8|0)/(v|0)|0;if((c|0)>(y|0))s[n>>2]=_;else c=y;_=_+1|0;y=c}c=(y|0)>200&1;o=+H(+ +(y*27|0))+-42;if(!(o<0))if(o>163)f=163;else k=20;else{o=0;k=20}if((k|0)==20)f=o;if(f*.006899999920278788+-.139<0){A=0;A=+H(+A);h[r>>2]=A;l=E;return c|0}A=(o>163?163:o)*.006899999920278788+-.139;A=+H(+A);h[r>>2]=A;l=E;return c|0}function ti(e,t,i,r,n,a,o,f){e=e|0;t=t|0;i=i|0;r=r|0;n=n|0;a=a|0;o=o|0;f=f|0;var c=0,l=0,u=0,d=0,p=0,b=0,m=0,w=0,g=0,v=0,_=0;m=s[e+4>>2]|0;b=(t|0)==0;v=s[e+44>>2]<<(b?o:0);g=b?1:t;b=(s[e+36>>2]|0)-(b?o:0)|0;p=e+64|0;w=te(g,v)|0;d=w+m|0;t=e+60|0;u=0;do{o=i+((te(u,d)|0)<<2)|0;e=te(te(u,v)|0,g)|0;c=0;while(1){if((c|0)>=(g|0))break;_=o+((te(c,v)|0)<<2)|0;di(p,_,r+(c+e<<2)|0,s[t>>2]|0,m,b,g);c=c+1|0}u=u+1|0}while((u|0)<(a|0));e:do if((a|0)==2&(n|0)==1){t=0;while(1){if((t|0)>=(w|0))break e;_=r+(t<<2)|0;h[_>>2]=+h[_>>2]*.5+ +h[r+(w+t<<2)>>2]*.5;t=t+1|0}}while(0);if((f|0)==1)return;u=(w|0)/(f|0)|0;l=+(f|0);t=w-u<<2;e=0;do{o=te(te(e,g)|0,v)|0;c=0;while(1){if((c|0)>=(u|0))break;_=r+(o+c<<2)|0;h[_>>2]=+h[_>>2]*l;c=c+1|0}kn(r+(o+u<<2)|0,0,t|0)|0;e=e+1|0}while((e|0)<(n|0));return}function ii(e,t,i,a,o,f,c,u,d,p){e=e|0;t=t|0;i=i|0;a=a|0;o=o|0;f=f|0;c=c|0;u=u|0;d=+d;p=p|0;var b=0,m=0,w=0,g=0,v=0,_=0,y=0,k=0,E=0,A=0,S=0,M=0,T=0,R=0,x=0,C=0,I=0,P=0,O=0,N=0,D=0,L=0,B=0,U=0,j=0,F=0,z=0,H=0,G=0;F=l;l=l+16|0;D=F;O=.5-d;O=(O<-.25?-.25:O)*.03999999910593033;B=l;l=l+((1*(t<<2)|0)+15&-16)|0;P=s[e+32>>2]|0;L=t+-1|0;U=(n[P+(t<<1)>>1]|0)-(n[P+(L<<1)>>1]|0)<=(t|0))break;R=k+1|0;e=n[P+(k<<1)>>1]|0;x=(n[P+(R<<1)>>1]|0)-e|0;y=x<=(y|0))break;d=d+ +q(+ +h[C+(e<<2)>>2]);e=e+1|0}v=d+(N?0:+(u|0))*O*d;if(!(N|x)){Mn(I|0,C|0,c|0)|0;e=y>>u>>1;c=0;while(1){if((c|0)<(A|0))p=0;else{d=0;e=0;break}while(1){if((p|0)>=(e|0))break;g=I+((te(S,p)|0)+c<<2)|0;z=+h[g>>2]*.7071067690849304;_=I+(((p<<1|1)<>2]*.7071067690849304;h[g>>2]=z+d;h[_>>2]=z-d;p=p+1|0}c=c+1|0}while(1){if((e|0)>=(y|0))break;d=d+ +q(+ +h[I+(e<<2)>>2]);e=e+1|0}d=d+M*d;if(d=(((x|N^1)&1^1)+u|0))break;w=N?_+1|0:u-_+-1|0;e=1<<_;c=y>>_>>1;p=e<<1;b=0;while(1){if((b|0)<(e|0))m=0;else{v=0;e=0;break}while(1){if((m|0)>=(c|0))break;G=C+((te(p,m)|0)+b<<2)|0;v=+h[G>>2]*.7071067690849304;H=C+(((m<<1|1)<<_)+b<<2)|0;z=+h[H>>2]*.7071067690849304;h[G>>2]=v+z;h[H>>2]=v-z;m=m+1|0}b=b+1|0}while(1){if((e|0)>=(y|0))break;v=v+ +q(+ +h[C+(e<<2)>>2]);e=e+1|0}z=v+ +(w|0)*O*v;H=z>2]=c;if(!x){k=R;continue}if(!((c|0)==0|(c|0)==(T|0))){k=R;continue}s[e>>2]=c+-1;k=R}g=i<<2;w=0;while(1){if((w|0)==2)break;c=g+(w<<1)|0;e=27892+(u<<3)+c|0;c=(c|1)+(27892+(u<<3))|0;p=0;b=N?o:0;m=1;while(1){if((m|0)>=(t|0))break;f=b+o|0;H=p+o|0;G=s[B+(m<<2)>>2]|0;i=G-(r[e>>0]<<1)|0;G=G-(r[c>>0]<<1)|0;p=((p|0)<(f|0)?p:f)+((i|0)>-1?i:0-i|0)|0;b=((H|0)<(b|0)?H:b)+((G|0)>-1?G:0-G|0)|0;m=m+1|0}s[D+(w<<2)>>2]=(p|0)<(b|0)?p:b;w=w+1|0}w=N?0:(s[D+4>>2]|0)<(s[D>>2]|0)&1;p=g|w<<1;m=27892+(u<<3)+p|0;p=(p|1)+(27892+(u<<3))|0;b=0;e=N?o:0;c=1;while(1){if((c|0)>=(t|0))break;N=e+o|0;i=(b|0)<(N|0);s[U+(c<<2)>>2]=i&1^1;H=b+o|0;u=(H|0)<(e|0);s[j+(c<<2)>>2]=u&1^1;G=s[B+(c<<2)>>2]|0;D=G-(r[m>>0]<<1)|0;G=G-(r[p>>0]<<1)|0;b=(i?b:N)+((D|0)>-1?D:0-D|0)|0;e=(u?H:e)+((G|0)>-1?G:0-G|0)|0;c=c+1|0}c=(b|0)>=(e|0)&1;s[a+(L<<2)>>2]=c;e=t+-2|0;while(1){if((e|0)<=-1)break;G=s[((c|0)==1?j:U)+(e+1<<2)>>2]|0;s[a+(e<<2)>>2]=G;c=G;e=e+-1|0}l=F;return w|0}function ri(e,t,i,r,a,o,f,c,u,p,b,m,w,g,v,_,y,k){e=e|0;t=t|0;i=i|0;r=r|0;a=a|0;o=o|0;f=f|0;c=c|0;u=u|0;p=p|0;b=b|0;m=m|0;w=w|0;g=g|0;v=v|0;_=_|0;y=y|0;k=k|0;var E=0,A=0,S=0,M=0,T=0,R=0,x=0,C=0,I=0,P=0,O=0,N=0,D=0,L=0,B=0,U=0,j=0,F=0,z=0,q=0,H=0,G=0,V=0,W=0,K=0;V=l;F=te(o,i)|0;H=l;l=l+((1*(F<<2)|0)+15&-16)|0;z=l;l=l+((1*(F<<2)|0)+15&-16)|0;kn(f|0,0,i<<2|0)|0;E=+(9-c|0);c=0;while(1){if((c|0)>=(a|0)){u=0;E=-31.899999618530273;break}F=c+5|0;h[z+(c<<2)>>2]=+(n[u+(c<<1)>>1]|0)*.0625+.5+E-+h[17220+(c<<2)>>2]+ +(te(F,F)|0)*.006200000178068876;c=c+1|0}while(1){c=te(u,i)|0;A=0;q=E;while(1){if((A|0)>=(a|0))break;L=+h[e+(c+A<<2)>>2]-+h[z+(A<<2)>>2];A=A+1|0;q=q>L?q:L}u=u+1|0;if((u|0)>=(o|0))break;else E=q}if(!((v|0)>50&(g|0)>0&(y|0)==0)){G=0;s[_>>2]=G;l=V;return+q}B=a+-2|0;U=a+-1|0;F=0;c=0;while(1){M=te(F,i)|0;j=H+(M<<2)|0;S=t+(M<<2)|0;u=s[S>>2]|0;s[j>>2]=u;L=(s[d>>2]=u,+h[d>>2]);E=L;u=1;x=c;while(1){if((u|0)>=(a|0)){u=x;break}y=M+u|0;D=+h[t+(y<<2)>>2];y=D>+h[t+(y+-1<<2)>>2]+.5?u:x;D=E+1.5>2]=D;E=D;u=u+1|0;x=y}while(1){c=u+-1|0;if((u|0)<=0){y=2;break}y=j+(c<<2)|0;O=+h[y>>2];N=+h[j+(u<<2)>>2]+2;D=+h[t+(M+c<<2)>>2];A=N>2]=O<(A?N:D)?O:A?N:D;u=c}while(1){if((y|0)>=(B|0))break;A=j+(y<<2)|0;I=+h[A>>2];u=t+(M+y+-2<<2)|0;E=+h[u+8>>2];P=+h[u>>2];O=+h[u+4>>2];c=P>O;W=c?P:O;T=c?O:P;N=+h[u+12>>2];D=+h[u+16>>2];u=N>D;R=u?D:N;C=u?N:D;K=T>R;R=K?T:R;T=K?C:W;C=K?W:C;do if(E>T)if(TT+-1)E=I;else{W=c?P:O;T=c?O:P;R=u?D:N;C=u?N:D;K=T>R;R=K?T:R;T=K?C:W;C=K?W:C;do if(E>T)if(T>2]=E;y=y+1|0}R=+h[S+4>>2];K=L>R;E=K?R:L;R=K?L:R;T=+h[S+8>>2];if(!(R>2];h[j>>2]=T>R?T:R;K=j+4|0;T=+h[K>>2];h[K>>2]=T>R?T:R;K=t+(M+a+-3<<2)|0;R=+h[K>>2];T=+h[K+4>>2];M=R>T;E=M?T:R;T=M?R:T;R=+h[K+8>>2];if(!(T>2];h[c>>2]=L>W?L:W;c=j+(U<<2)|0;L=+h[c>>2];h[c>>2]=L>W?L:W;c=0;while(1){if((c|0)>=(a|0))break;K=j+(c<<2)|0;L=+h[K>>2];W=+h[z+(c<<2)>>2];h[K>>2]=L>W?L:W;c=c+1|0}F=F+1|0;if((F|0)>=(o|0))break;else c=x}e:do if((o|0)==2){c=r;while(1){if((c|0)>=(a|0)){c=r;break e}z=c+i|0;t=H+(z<<2)|0;W=+h[t>>2];K=H+(c<<2)|0;L=+h[K>>2]+-4;L=W>L?W:L;h[t>>2]=L;W=+h[K>>2];L=L+-4;L=W>L?W:L;h[K>>2]=L;L=+h[e+(c<<2)>>2]-L;W=+h[e+(z<<2)>>2]-+h[t>>2];h[K>>2]=((L<0?0:L)+(W<0?0:W))*.5;c=c+1|0}}else{c=r;while(1){if((c|0)>=(a|0)){c=r;break e}K=H+(c<<2)|0;W=+h[e+(c<<2)>>2]-+h[K>>2];h[K>>2]=W<0?0:W;c=c+1|0}}while(0);while(1){if((c|0)>=(a|0))break;K=H+(c<<2)|0;L=+h[K>>2];W=+h[k+(c<<2)>>2];h[K>>2]=L>W?L:W;c=c+1|0}x=(b|0)==0;e:do if((x|(m|0)!=0)&(p|0)==0){c=r;while(1){if((c|0)>=(a|0))break e;K=H+(c<<2)|0;h[K>>2]=+h[K>>2]*.5;c=c+1|0}}while(0);M=(v|0)/4|0;S=(m|0)==0;c=0;while(1){if((r|0)>=(a|0)){G=76;break}if((r|0)>=8){u=H+(r<<2)|0;E=+h[u>>2];if((r|0)>11){E=E*.5;h[u>>2]=E}}else{u=H+(r<<2)|0;E=+h[u>>2]*2;h[u>>2]=E}E=E<4?E:4;h[u>>2]=E;y=r+1|0;u=(te((n[w+(y<<1)>>1]|0)-(n[w+(r<<1)>>1]|0)|0,o)|0)<=6)if((u|0)>48){K=~~(E*8);A=K;u=((te(K,u)|0)<<3|0)/8|0;break}else{u=~~(E*+(u|0)/6);A=u;u=u*48|0;break}else{K=~~E;A=K;u=(te(K,u)|0)<<3}while(0);if(!((S|(p|0)!=0)&(x^1))?(c+u>>6|0)>(M|0):0)break;s[f+(r<<2)>>2]=A;r=y;c=c+u|0}if((G|0)==76){s[_>>2]=c;l=V;return+q}K=M<<6;s[f+(r<<2)>>2]=K-c;s[_>>2]=K;l=V;return+q}function ni(e,t,i){e=e|0;t=t|0;i=i|0;var r=0,n=0,a=0,o=0;a=l;l=l+16|0;r=a;s[r>>2]=i;do switch(t|0){case 10010:{n=(s[r>>2]|0)+(4-1)&~(4-1);t=s[n>>2]|0;s[r>>2]=n+4;if((t|0)>=0?(t|0)<(s[(s[e>>2]|0)+8>>2]|0):0){s[e+20>>2]=t;t=25}else t=26;break}case 10012:{n=(s[r>>2]|0)+(4-1)&~(4-1);t=s[n>>2]|0;s[r>>2]=n+4;if((t|0)>=1?(t|0)<=(s[(s[e>>2]|0)+8>>2]|0):0){s[e+24>>2]=t;t=25}else t=26;break}case 10008:{n=(s[r>>2]|0)+(4-1)&~(4-1);t=s[n>>2]|0;s[r>>2]=n+4;if((t+-1|0)>>>0>1)t=26;else{s[e+12>>2]=t;t=25}break}case 10007:{n=(s[r>>2]|0)+(4-1)&~(4-1);t=s[n>>2]|0;s[r>>2]=n+4;if(!t)t=26;else{e=e+40|0;s[t>>2]=s[e>>2];s[e>>2]=0;t=25}break}case 4027:{n=(s[r>>2]|0)+(4-1)&~(4-1);t=s[n>>2]|0;s[r>>2]=n+4;if(!t)t=26;else{s[t>>2]=(s[e+4>>2]|0)/(s[e+16>>2]|0)|0;t=25}break}case 4028:{n=s[e+8>>2]|0;t=e+88+((te((s[e+4>>2]|0)+2048|0,n)|0)<<2)+(n*24<<2)|0;o=s[e>>2]|0;r=s[o+8>>2]|0;i=r<<1;t=t+(i<<2)|0;i=t+(i<<2)|0;kn(e+36|0,0,((te((s[o+4>>2]|0)+2048|0,n)|0)<<2)+88+(n*96|0)+(r<<5)+-36|0)|0;n=0;while(1){if((n|0)>=(r<<1|0))break;h[i+(n<<2)>>2]=-28;h[t+(n<<2)>>2]=-28;r=s[(s[e>>2]|0)+8>>2]|0;n=n+1|0}s[e+52>>2]=1;t=25;break}case 4033:{o=(s[r>>2]|0)+(4-1)&~(4-1);t=s[o>>2]|0;s[r>>2]=o+4;if(!t)t=26;else{s[t>>2]=s[e+56>>2];t=25}break}case 10015:{o=(s[r>>2]|0)+(4-1)&~(4-1);t=s[o>>2]|0;s[r>>2]=o+4;if(!t)t=26;else{s[t>>2]=s[e>>2];t=25}break}case 10016:{o=(s[r>>2]|0)+(4-1)&~(4-1);t=s[o>>2]|0;s[r>>2]=o+4;s[e+28>>2]=t;t=25;break}case 4031:{o=(s[r>>2]|0)+(4-1)&~(4-1);t=s[o>>2]|0;s[r>>2]=o+4;if(!t)t=26;else{s[t>>2]=s[e+36>>2];t=25}break}default:{l=a;return}}while(0);if((t|0)==25){l=a;return}else if((t|0)==26){l=a;return}}function si(e,t,i,o,f,c,u){e=e|0;t=t|0;i=i|0;o=o|0;f=f|0;c=c|0;u=u|0;var d=0,p=0,b=0,m=0,w=0,g=0,v=0,_=0,y=0,k=0,E=0,A=0,S=0,M=0,T=0,R=0,x=0,C=0,I=0,P=0,O=0,N=0,D=0,L=0,B=0,U=0,j=0,F=0,z=0,q=0,G=0,V=0,W=0,K=0,Z=0,Y=0,$=0,X=0,Q=0,ee=0,ie=0,ne=0,se=0,ae=0,oe=0,fe=0,he=0,ce=0,le=0,ue=0,de=0,pe=0,be=0,me=0,we=0,ge=0,ve=0,_e=0,ye=0,ke=0,Ee=0,Ae=0,Se=0,Me=0,Te=0,Re=0,xe=0,Ce=0,Ie=0,Pe=0;Pe=l;l=l+96|0;D=Pe;T=Pe+40|0;Q=Pe+32|0;Ie=Pe+24|0;ne=Pe+16|0;ie=Pe+12|0;ee=Pe+8|0;Se=s[e+8>>2]|0;s[ne>>2]=0;s[ie>>2]=0;ue=s[e+12>>2]|0;xe=s[e>>2]|0;ce=xe+8|0;Ce=s[ce>>2]|0;me=s[xe+4>>2]|0;le=xe+32|0;q=s[le>>2]|0;Me=s[e+20>>2]|0;Te=s[e+24>>2]|0;Re=e+16|0;ye=te(s[Re>>2]|0,f)|0;p=me+2048|0;ke=e+88+((te(p,Se)|0)<<2)+(Se*24<<2)|0;ge=Ce<<1;Ee=ke+(ge<<2)|0;Ae=Ee+(ge<<2)|0;we=Ae+(ge<<2)|0;be=xe+44|0;f=s[xe+36>>2]|0;de=0;while(1){if((de|0)>(f|0)){f=-1;L=268;break}if((s[be>>2]<>>0>1275|(o|0)==0){e=-1;l=Pe;return e|0}_e=s[be>>2]<>2]=ve;s[Ie+(d<<2)>>2]=ve+8192+(f<<2);d=d+1|0}while((d|0)<(Se|0));he=s[xe+12>>2]|0;he=(Te|0)>(he|0)?he:Te;if((t|0)==0|(i|0)<2){ai(e,_e,de);fi(Ie,o,_e,Se,s[Re>>2]|0,xe+16|0,e+80|0,u);e=(ye|0)/(s[Re>>2]|0)|0;l=Pe;return e|0}ve=e+48|0;s[e+52>>2]=(s[ve>>2]|0)!=0&1;e:do if(!c){s[T>>2]=t;s[T+4>>2]=i;s[T+8>>2]=0;s[T+12>>2]=0;s[T+16>>2]=0;v=T+20|0;s[v>>2]=9;_=T+24|0;s[_>>2]=0;y=T+28|0;s[y>>2]=128;if(!i){f=0;d=0}else{s[_>>2]=1;f=1;d=a[t>>0]|0}k=T+40|0;s[k>>2]=d;g=d>>>1^127;E=T+32|0;s[E>>2]=g;s[T+44>>2]=0;p=128;c=9;while(1){if(p>>>0>=8388609){c=T;break e}c=c+8|0;s[v>>2]=c;p=p<<8;s[y>>2]=p;if(f>>>0>>0){m=f+1|0;s[_>>2]=m;w=a[t+f>>0]|0}else{m=f;w=0}s[k>>2]=w;fe=((d<<8|w)>>>1&255|g<<8&2147483392)^255;s[E>>2]=fe;f=m;d=w;g=fe}}while(0);se=(ue|0)==1;e:do if(se){f=0;while(1){if((f|0)>=(Ce|0))break e;fe=ke+(f<<2)|0;P=+h[fe>>2];O=+h[ke+(Ce+f<<2)>>2];h[fe>>2]=P>O?P:O;f=f+1|0}}while(0);ae=i<<3;oe=c+20|0;f=s[oe>>2]|0;fe=c+28|0;w=s[fe>>2]|0;p=f+((re(w|0)|0)+-32)|0;if((p|0)<(ae|0))if((p|0)==1){k=c+32|0;p=s[k>>2]|0;m=w>>>15;E=p>>>0>>0;d=E&1;if(!E){p=p-m|0;s[k>>2]=p;m=w-m|0}s[fe>>2]=m;v=c+40|0;_=c+24|0;y=c+4|0;while(1){if(m>>>0>=8388609)break;f=f+8|0;s[oe>>2]=f;m=m<<8;s[fe>>2]=m;g=s[v>>2]|0;w=s[_>>2]|0;if(w>>>0<(s[y>>2]|0)>>>0){s[_>>2]=w+1;w=a[(s[c>>2]|0)+w>>0]|0}else w=0;s[v>>2]=w;X=((g<<8|w)>>>1&255|p<<8&2147483392)^255;s[k>>2]=X;p=X}if(E){p=m;L=31}else{d=0;p=1}}else{m=w;d=0}else{p=w;d=1;L=31}if((L|0)==31){f=f+(ae-(f+((re(p|0)|0)+-32)))|0;s[oe>>2]=f;m=p;p=ae}if((Me|0)!=0|(p+16|0)>(ae|0)){X=0;$=0;b=0}else{N=c+32|0;p=s[N>>2]|0;w=m>>>1;v=p>>>0>>0;if(!v){p=p-w|0;s[N>>2]=p;w=m-w|0}s[fe>>2]=w;x=c+40|0;C=c+24|0;I=c+4|0;while(1){if(w>>>0>=8388609)break;f=f+8|0;s[oe>>2]=f;w=w<<8;s[fe>>2]=w;g=s[x>>2]|0;m=s[C>>2]|0;if(m>>>0<(s[I>>2]|0)>>>0){s[C>>2]=m+1;m=a[(s[c>>2]|0)+m>>0]|0}else m=0;s[x>>2]=m;X=((g<<8|m)>>>1&255|p<<8&2147483392)^255;s[N>>2]=X;p=X}if(v){T=ci(c,6)|0;y=16<>2]|0;R=c+16|0;p=s[R>>2]|0;if(p>>>0>>0){v=c+8|0;g=s[I>>2]|0;_=p+8|0;_=p+(((_|0)>25?_:25)+-1-p&-8)|0;m=s[v>>2]|0;do{if(m>>>0>>0){w=m+1|0;s[v>>2]=w;m=w;w=a[(s[c>>2]|0)+(g-w)>>0]|0}else w=0;f=f|w<>>k;m=w-k|0;s[t>>2]=p;s[R>>2]=m;E=(s[oe>>2]|0)+k|0;s[oe>>2]=E;f=y+(f&(1<>>0<3){y=c+8|0;_=s[I>>2]|0;v=w+4-T|0;v=w+(T+((v|0)>25?v:25)+3-w&-8)+4|0;w=s[y>>2]|0;do{if(w>>>0<_>>>0){g=w+1|0;s[y>>2]=g;w=g;g=a[(s[c>>2]|0)+(_-g)>>0]|0}else g=0;p=p|g<>2]=p>>>3;s[R>>2]=m+-3;m=E+3|0;s[oe>>2]=m;w=s[fe>>2]|0;e:do if((m+((re(w|0)|0)+-32)+2|0)>(ae|0))p=0;else{v=s[N>>2]|0;_=w>>>2;p=-1;while(1){p=p+1|0;g=te(_,a[29345+p>>0]|0)|0;if(v>>>0>=g>>>0)break;else w=g}_=v-g|0;s[N>>2]=_;w=w-g|0;s[fe>>2]=w;while(1){if(w>>>0>=8388609)break e;m=m+8|0;s[oe>>2]=m;w=w<<8;s[fe>>2]=w;v=s[x>>2]|0;g=s[C>>2]|0;if(g>>>0<(s[I>>2]|0)>>>0){s[C>>2]=g+1;g=a[(s[c>>2]|0)+g>>0]|0}else g=0;s[x>>2]=g;X=((v<<8|g)>>>1&255|_<<8&2147483392)^255;s[N>>2]=X;_=X}}while(0);g=m;b=+(y+1|0)*.09375}else{g=f;b=0;f=0;p=0}X=f;$=p;f=g;m=w;p=g+((re(w|0)|0)+-32)|0}z=(de|0)>0;if(!((p+3|0)>(ae|0)|z^1)){k=c+32|0;p=s[k>>2]|0;w=m>>>3;E=p>>>0>>0;T=E&1;if(E)m=w;else{p=p-w|0;s[k>>2]=p;m=m-w|0}s[fe>>2]=m;v=c+40|0;_=c+24|0;y=c+4|0;while(1){if(m>>>0>=8388609)break;f=f+8|0;s[oe>>2]=f;m=m<<8;s[fe>>2]=m;g=s[v>>2]|0;w=s[_>>2]|0;if(w>>>0<(s[y>>2]|0)>>>0){s[_>>2]=w+1;w=a[(s[c>>2]|0)+w>>0]|0}else w=0;s[v>>2]=w;Y=((g<<8|w)>>>1&255|p<<8&2147483392)^255;s[k>>2]=Y;p=Y}p=f+((re(m|0)|0)+-32)|0;if(E)Z=pe;else L=72}else L=72;if((L|0)==72){T=0;Z=0}if((p+3|0)<=(ae|0)){k=c+32|0;p=s[k>>2]|0;w=m>>>3;_=p>>>0>>0;t=_&1;if(!_){p=p-w|0;s[k>>2]=p;w=m-w|0}s[fe>>2]=w;y=c+40|0;m=c+24|0;E=c+4|0;while(1){if(w>>>0>=8388609)break;f=f+8|0;s[oe>>2]=f;w=w<<8;s[fe>>2]=w;v=s[y>>2]|0;g=s[m>>2]|0;if(g>>>0<(s[E>>2]|0)>>>0){s[m>>2]=g+1;g=a[(s[c>>2]|0)+g>>0]|0}else g=0;s[y>>2]=g;Y=((v<<8|g)>>>1&255|p<<8&2147483392)^255;s[k>>2]=Y;p=Y}Y=D;s[Y>>2]=0;s[Y+4>>2]=0;if(_){f=k;p=y;w=c;Y=E;F=t;A=.149993896484375;S=0;v=D}else{g=E;f=k;p=y;w=c;v=D;L=83}}else{g=D;s[g>>2]=0;s[g+4>>2]=0;g=c+4|0;f=c+32|0;p=c+40|0;m=c+24|0;w=c;v=D;L=83}if((L|0)==83){Y=g;F=0;A=+h[17320+(de<<2)>>2];S=+h[17336+(de<<2)>>2]}D=s[Y>>2]<<3;L=c+36|0;j=Me;while(1){if((j|0)>=(Te|0))break;B=(j|0)<20;U=0;do{y=s[oe>>2]|0;N=s[fe>>2]|0;g=y+((re(N|0)|0)+-32)|0;_=D-g|0;e:do if((_|0)<=14){if((_|0)>1){k=s[f>>2]|0;E=N>>>2;t=-1;_=N;while(1){t=t+1|0;g=te(E,a[29345+t>>0]|0)|0;if(k>>>0>=g>>>0)break;else _=g}E=k-g|0;s[f>>2]=E;_=_-g|0;s[fe>>2]=_;g=y;while(1){if(_>>>0>=8388609)break;g=g+8|0;s[oe>>2]=g;_=_<<8;s[fe>>2]=_;k=s[p>>2]|0;y=s[m>>2]|0;if(y>>>0<(s[Y>>2]|0)>>>0){s[m>>2]=y+1;y=a[(s[w>>2]|0)+y>>0]|0}else y=0;s[p>>2]=y;K=((k<<8|y)>>>1&255|E<<8&2147483392)^255;s[f>>2]=K;E=K}g=t>>1^0-(t&1);break}if((D|0)>(g|0)){_=s[f>>2]|0;g=N>>>1;t=_>>>0>>0;if(!t){_=_-g|0;s[f>>2]=_;g=N-g|0}s[fe>>2]=g;while(1){if(g>>>0>=8388609)break;y=y+8|0;s[oe>>2]=y;g=g<<8;s[fe>>2]=g;E=s[p>>2]|0;k=s[m>>2]|0;if(k>>>0<(s[Y>>2]|0)>>>0){s[m>>2]=k+1;k=a[(s[w>>2]|0)+k>>0]|0}else k=0;s[p>>2]=k;K=((E<<8|k)>>>1&255|_<<8&2147483392)^255;s[f>>2]=K;_=K}g=t<<31>>31}else g=-1}else{R=(B?j:20)<<1;g=a[29009+(de*84|0)+(F*42|0)+R>>0]<<7;R=a[(R|1)+(29009+(de*84|0)+(F*42|0))>>0]<<6;C=N>>>15;s[L>>2]=C;I=s[f>>2]|0;x=(I>>>0)/(C>>>0)|0;K=x+1|0;x=32768-(K+(K>>>0>32768?32767-x|0:0))|0;if(x>>>0>>0){k=g;_=0;g=0}else{_=te(32736-g|0,16384-R|0)|0;E=1;while(1){K=_>>>15;k=K+1|0;if(!K)break;_=k<<1;t=g+_|0;if(x>>>0>>0)break;_=te(_+-2|0,R)|0;g=t;E=E+1|0}if(k>>>0<2){K=(x-g|0)>>>1;g=g+(K<<1)|0;E=E+K|0}_=g+k|0;K=x>>>0<_>>>0;_=K?g:_;g=K?0-E|0:E}k=_+k|0;k=k>>>0<32768?k:32768;K=te(C,32768-k|0)|0;t=I-K|0;s[f>>2]=t;k=te(C,k-_|0)|0;k=(_|0)==0?N-K|0:k;s[fe>>2]=k;_=y;while(1){if(k>>>0>=8388609)break e;_=_+8|0;s[oe>>2]=_;k=k<<8;s[fe>>2]=k;E=s[p>>2]|0;y=s[m>>2]|0;if(y>>>0<(s[Y>>2]|0)>>>0){s[m>>2]=y+1;y=a[(s[w>>2]|0)+y>>0]|0}else y=0;s[p>>2]=y;K=((E<<8|y)>>>1&255|t<<8&2147483392)^255;s[f>>2]=K;t=K}}while(0);O=+(g|0);W=ke+(j+(te(U,s[ce>>2]|0)|0)<<2)|0;P=+h[W>>2];h[W>>2]=P<-9?-9:P;W=ke+(j+(te(U,s[ce>>2]|0)|0)<<2)|0;K=v+(U<<2)|0;h[W>>2]=S*+h[W>>2]+ +h[K>>2]+O;h[K>>2]=+h[K>>2]+O-A*O;U=U+1|0}while((U|0)<(ue|0));j=j+1|0}K=Ne()|0;W=l;l=l+((1*(Ce<<2)|0)+15&-16)|0;j=s[Y>>2]|0;g=j<<3;_=s[oe>>2]|0;y=s[fe>>2]|0;E=_+((re(y|0)|0)+-32)|0;v=(T|0)!=0;k=v?2:4;if(z)N=(E+k+1|0)>>>0<=g>>>0;else N=0;I=g-(N&1)|0;C=v?4:5;R=0;x=Me;g=E;t=0;while(1){if((x|0)>=(Te|0))break;if((g+k|0)>>>0>I>>>0){E=R;v=t}else{v=s[f>>2]|0;g=y>>>k;V=v>>>0>>0;E=V&1;if(!V){v=v-g|0;s[f>>2]=v;g=y-g|0}s[fe>>2]=g;k=_;while(1){if(g>>>0>=8388609)break;k=k+8|0;s[oe>>2]=k;g=g<<8;s[fe>>2]=g;y=s[p>>2]|0;_=s[m>>2]|0;if(_>>>0>>0){s[m>>2]=_+1;_=a[(s[w>>2]|0)+_>>0]|0}else _=0;s[p>>2]=_;V=((y<<8|_)>>>1&255|v<<8&2147483392)^255;s[f>>2]=V;v=V}v=R^E;_=k;y=g;E=v;g=k+((re(g|0)|0)+-32)|0;v=t|v}s[W+(x<<2)>>2]=E;R=E;x=x+1|0;k=C;t=v}R=T<<2;if(N?(r[R+t+(27892+(de<<3))>>0]|0)!=(r[(R|2)+t+(27892+(de<<3))>>0]|0):0){v=s[f>>2]|0;g=y>>>1;V=v>>>0>>0;t=V&1;if(!V){v=v-g|0;s[f>>2]=v;g=y-g|0}s[fe>>2]=g;while(1){if(g>>>0>=8388609)break;_=_+8|0;s[oe>>2]=_;g=g<<8;s[fe>>2]=g;k=s[p>>2]|0;y=s[m>>2]|0;if(y>>>0>>0){s[m>>2]=y+1;y=a[(s[w>>2]|0)+y>>0]|0}else y=0;s[p>>2]=y;V=((k<<8|y)>>>1&255|v<<8&2147483392)^255;s[f>>2]=V;v=V}E=g;g=t<<1}else{E=y;g=0}g=R+g|0;v=Me;while(1){if((v|0)>=(Te|0))break;V=W+(v<<2)|0;s[V>>2]=r[g+(s[V>>2]|0)+(27892+(de<<3))>>0];v=v+1|0}e:do if((_+((re(E|0)|0)+-32)+4|0)>(ae|0)){g=_;v=E;t=2}else{y=s[f>>2]|0;k=E>>>5;t=-1;v=E;while(1){t=t+1|0;g=te(k,a[28203+t>>0]|0)|0;if(y>>>0>=g>>>0)break;else v=g}k=y-g|0;s[f>>2]=k;v=v-g|0;s[fe>>2]=v;g=_;while(1){if(v>>>0>=8388609)break e;g=g+8|0;s[oe>>2]=g;_=v<<8;s[fe>>2]=_;y=s[p>>2]|0;v=s[m>>2]|0;if(v>>>0>>0){s[m>>2]=v+1;v=a[(s[w>>2]|0)+v>>0]|0}else v=0;s[p>>2]=v;V=((y<<8|v)>>>1&255|k<<8&2147483392)^255;s[f>>2]=V;v=_;k=V}}while(0);U=l;l=l+((1*(Ce<<2)|0)+15&-16)|0;_=s[ce>>2]|0;y=(de<<1)+ue+-1|0;k=xe+104|0;E=0;while(1){if((E|0)>=(_|0))break;V=E+1|0;G=s[le>>2]|0;z=(te(_,y)|0)+E|0;s[U+(E<<2)>>2]=(te(te((a[(s[k>>2]|0)+z>>0]|0)+64|0,ue)|0,(n[G+(V<<1)>>1]|0)-(n[G+(E<<1)>>1]|0)<>2;E=V}B=l;l=l+((1*(Ce<<2)|0)+15&-16)|0;z=i<<6;G=32-(re(v|0)|0)|0;V=v>>>(G+-16|0);k=(V>>>12)+-8|0;R=g;D=6;L=Me;g=(g<<3)-((G<<3)+(k+(V>>>0>(s[5272+(k<<2)>>2]|0)>>>0&1)))|0;k=z;while(1){ +if((L|0)>=(Te|0))break;N=L+1|0;x=(te(ue,(n[q+(N<<1)>>1]|0)-(n[q+(L<<1)>>1]|0)|0)|0)<=(I|0))break;if((R|0)>=(s[C>>2]|0))break;g=s[f>>2]|0;y=v>>>y;E=g>>>0>>0;if(E)v=y;else{g=g-y|0;s[f>>2]=g;v=v-y|0}s[fe>>2]=v;while(1){if(v>>>0>=8388609)break;_=_+8|0;s[oe>>2]=_;v=v<<8;s[fe>>2]=v;k=s[p>>2]|0;y=s[m>>2]|0;if(y>>>0>>0){s[m>>2]=y+1;y=a[(s[w>>2]|0)+y>>0]|0}else y=0;s[p>>2]=y;V=((k<<8|y)>>>1&255|g<<8&2147483392)^255;s[f>>2]=V;g=V}G=32-(re(v|0)|0)|0;V=v>>>(G+-16|0);g=(V>>>12)+-8|0;g=(_<<3)-((G<<3)+(g+(V>>>0>(s[5272+(g<<2)>>2]|0)>>>0&1)))|0;if(!E)break;R=R+x|0;y=1;I=I-x|0}s[B+(L<<2)>>2]=R;if((R|0)<=0){R=_;L=N;k=I;continue}R=_;D=(D|0)<3?2:D+-1|0;L=N;k=I}i=l;l=l+((1*(Ce<<2)|0)+15&-16)|0;e:do if((g+48|0)>(k|0)){p=R;f=v;m=5}else{_=s[f>>2]|0;y=v>>>7;E=-1;while(1){E=E+1|0;g=te(y,a[28207+E>>0]|0)|0;if(_>>>0>=g>>>0)break;else v=g}k=_-g|0;s[f>>2]=k;v=v-g|0;s[fe>>2]=v;g=R;while(1){if(v>>>0>=8388609){p=g;f=v;m=E;break e}g=g+8|0;s[oe>>2]=g;_=v<<8;s[fe>>2]=_;y=s[p>>2]|0;v=s[m>>2]|0;if(v>>>0>>0){s[m>>2]=v+1;v=a[(s[w>>2]|0)+v>>0]|0}else v=0;s[p>>2]=v;V=((y<<8|v)>>>1&255|k<<8&2147483392)^255;s[f>>2]=V;v=_;k=V}}while(0);G=32-(re(f|0)|0)|0;V=f>>>(G+-16|0);f=(V>>>12)+-8|0;f=z+((G<<3)+(f+(V>>>0>(s[5272+(f<<2)>>2]|0)>>>0&1))-(p<<3))+-1|0;V=(T|0)==0;if((de|0)>1&(V^1))C=(f|0)>=((de<<3)+16|0);else C=0;I=C?8:0;G=l;l=l+((1*(Ce<<2)|0)+15&-16)|0;j=l;l=l+((1*(Ce<<2)|0)+15&-16)|0;x=Ti(xe,Me,Te,B,U,m,ne,ie,f-I|0,ee,G,i,j,ue,de,c,0,0,0)|0;N=c+12|0;D=c+16|0;L=c+8|0;R=Me;while(1){if((R|0)>=(Te|0))break;y=s[i+(R<<2)>>2]|0;if((y|0)>=1){k=(1<>2]|0;f=s[D>>2]|0;E=0;do{if(f>>>0>>0){v=f+8|0;_=((v|0)>25?v:25)+-1-f&-8;p=m;do{m=s[L>>2]|0;g=s[Y>>2]|0;if(m>>>0>>0){m=m+1|0;s[L>>2]=m;m=a[(s[w>>2]|0)+(g-m)>>0]|0}else m=0;p=p|m<>>y;f=f-y|0;s[N>>2]=m;s[D>>2]=f;s[oe>>2]=(s[oe>>2]|0)+y;q=ke+(R+(te(E,s[ce>>2]|0)|0)<<2)|0;h[q>>2]=+h[q>>2]+((+(p&k|0)+.5)*A*6103515625e-14+-.5);E=E+1|0}while((E|0)<(ue|0))}R=R+1|0}f=2048-_e+((me|0)/2|0)<<2;p=0;do{q=s[Q+(p<<2)>>2]|0;Tn(q|0,q+(_e<<2)|0,f|0)|0;p=p+1|0}while((p|0)<(Se|0));U=te(ue,Ce)|0;B=l;l=l+((1*U|0)+15&-16)|0;q=(te(ue,_e)|0)<<2;F=l;l=l+((1*q|0)+15&-16)|0;q=e+36|0;sr(0,xe,Me,Te,F,(ue|0)==2?F+(_e<<2)|0:0,B,0,G,Z,t,s[ie>>2]|0,s[ne>>2]|0,W,z-I|0,s[ee>>2]|0,c,de,x,q,0,s[e+32>>2]|0);if(C){p=s[N>>2]|0;f=s[D>>2]|0;if(!f){g=s[Y>>2]|0;m=s[L>>2]|0;v=0;do{if(m>>>0>>0){f=m+1|0;s[L>>2]=f;m=f;f=a[(s[w>>2]|0)+(g-f)>>0]|0}else f=0;p=p|f<>2]=p>>>1;s[D>>2]=f+-1;f=(s[oe>>2]|0)+1|0;s[oe>>2]=f;t=p&1}else{f=s[oe>>2]|0;t=0}p=ae-(f+((re(s[fe>>2]|0)|0)+-32))|0;E=0;while(1){if((E|0)==2)break;else k=Me;while(1){if(!((k|0)<(Te|0)&(p|0)>=(ue|0)))break;m=s[i+(k<<2)>>2]|0;do if((m|0)<=7){if((s[j+(k<<2)>>2]|0)!=(E|0))break;A=+(1<<14-m+-1|0);g=s[D>>2]|0;v=s[N>>2]|0;y=0;do{if(!g){_=0;while(1){m=s[L>>2]|0;g=s[Y>>2]|0;if(m>>>0>>0){m=m+1|0;s[L>>2]=m;m=a[(s[w>>2]|0)+(g-m)>>0]|0}else m=0;m=v|m<<_;_=_+8|0;if((_|0)>=25){g=32;break}else v=m}}else m=v;v=m>>>1;g=g+-1|0;s[N>>2]=v;s[D>>2]=g;f=f+1|0;s[oe>>2]=f;ne=ke+(k+(te(y,s[ce>>2]|0)|0)<<2)|0;h[ne>>2]=+h[ne>>2]+(+(m&1|0)+-.5)*A*6103515625e-14;p=p+-1|0;y=y+1|0}while((y|0)<(ue|0))}while(0);k=k+1|0}E=E+1|0}e:do if(t|0){_=(de|0)==3;f=s[q>>2]|0;R=Me;t:while(1){if((R|0)>=(Te|0))break e;y=R+1|0;k=s[le>>2]|0;k=(n[k+(y<<1)>>1]|0)-(n[k+(R<<1)>>1]|0)|0;P=+J(+(+(((((s[G+(R<<2)>>2]|0)+1|0)>>>0)/(k>>>0)|0)>>>de|0)*-.125*.6931471805599453))*.5;E=k<>2]|0;w=(te(p,m)|0)+R|0;S=+h[Ee+(w<<2)>>2];A=+h[Ae+(w<<2)>>2];do if(se){ne=m+R|0;M=+h[Ee+(ne<<2)>>2];S=S>M?S:M;M=+h[Ae+(ne<<2)>>2];if(A>M)break;A=M}while(0);A=+h[ke+(w<<2)>>2]-(S>2]|0)+(R<<1)>>1]<=(pe|0))break;i:do if(!(a[g>>0]&1<=(k|0)){m=1;break i}ne=(te(f,1664525)|0)+1013904223|0;h[v+((m<>2]=(ne&32768|0)==0?S:A;f=ne;m=m+1|0}}while(0);w=w+1|0}i:do if(m|0){m=0;A=0;while(1){if((m|0)>=(E|0))break;M=+h[v+(m<<2)>>2];m=m+1|0;A=A+M*M}A=1/+H(+(A+1.0000000036274937e-15));w=0;m=v;while(1){if((w|0)>=(E|0))break i;h[m>>2]=A*+h[m>>2];w=w+1|0;m=m+4|0}}while(0);p=p+1|0;if((p|0)>=(ue|0)){R=y;continue t}}}}while(0);e:do if(d|0){f=0;while(1){if((f|0)>=(U|0))break e;h[ke+(f<<2)>>2]=-28;f=f+1|0}}while(0);oi(xe,F,Ie,ke,Me,he,ue,Se,T,de,s[Re>>2]|0,d);m=e+56|0;w=e+60|0;g=e+68|0;v=e+64|0;_=e+76|0;y=e+72|0;k=xe+60|0;f=(de|0)==0;p=0;do{de=s[m>>2]|0;de=(de|0)>15?de:15;s[m>>2]=de;ue=s[w>>2]|0;ue=(ue|0)>15?ue:15;s[w>>2]=ue;d=s[Ie+(p<<2)>>2]|0;As(d,d,ue,de,s[be>>2]|0,+h[g>>2],+h[v>>2],s[_>>2]|0,s[y>>2]|0,s[k>>2]|0,me);if(!f){de=s[be>>2]|0;ue=d+(de<<2)|0;As(ue,ue,s[m>>2]|0,X,_e-de|0,+h[v>>2],b,s[y>>2]|0,$,s[k>>2]|0,me)}p=p+1|0}while((p|0)<(Se|0));s[w>>2]=s[m>>2];s[g>>2]=s[v>>2];s[_>>2]=s[y>>2];s[m>>2]=X;h[v>>2]=b;s[y>>2]=$;if(!f){s[w>>2]=X;h[g>>2]=b;s[_>>2]=$}if(se)Mn(ke+(Ce<<2)|0,ke|0,Ce<<2|0)|0;e:do if(V){f=Ce<<3;Mn(Ae|0,Ee|0,f|0)|0;Mn(Ee|0,ke|0,f|0)|0;b=(s[ve>>2]|0)<10?+(pe|0)*.0010000000474974513:1;f=0;while(1){if((f|0)>=(ge|0)){p=0;break e}me=we+(f<<2)|0;P=+h[me>>2]+b;O=+h[ke+(f<<2)>>2];h[me>>2]=P=(ge|0)){p=0;break e}we=Ee+(f<<2)|0;P=+h[we>>2];O=+h[ke+(f<<2)>>2];h[we>>2]=P=(Me|0)){f=Te;break}ge=d+f|0;h[ke+(ge<<2)>>2]=0;h[Ae+(ge<<2)>>2]=-28;h[Ee+(ge<<2)>>2]=-28;f=f+1|0}while(1){if((f|0)>=(Ce|0))break;ge=d+f|0;h[ke+(ge<<2)>>2]=0;h[Ae+(ge<<2)>>2]=-28;h[Ee+(ge<<2)>>2]=-28;f=f+1|0}p=p+1|0}while((p|0)!=2);s[q>>2]=s[fe>>2];fi(Ie,o,_e,Se,s[Re>>2]|0,xe+16|0,e+80|0,u);s[ve>>2]=0;if(((s[oe>>2]|0)+((re(s[fe>>2]|0)|0)+-32)|0)>(ae|0))f=-3;else{if(s[c+44>>2]|0)s[e+40>>2]=1;f=(ye|0)/(s[Re>>2]|0)|0}qe(K|0);e=f;l=Pe;return e|0}function ai(e,t,i){e=e|0;t=t|0;i=i|0;var r=0,a=0,o=0,f=0,c=0,u=0,d=0,p=0,b=0,m=0,w=0,g=0,v=0,_=0,y=0,k=0,E=0,A=0,S=0,M=0,T=0,R=0,x=0,C=0,I=0,P=0,O=0,N=0,D=0,L=0,B=0,U=0,j=0,F=0,z=0,q=0,G=0,V=0,W=0,K=0,Z=0,Y=0,$=0,X=0;Y=l;l=l+8512|0;c=Y+8504|0;f=Y+4408|0;Z=Y+4400|0;S=Y+4392|0;F=Y+296|0;j=Y+192|0;z=Y+96|0;q=Y;K=s[e+8>>2]|0;M=s[e>>2]|0;d=s[M+8>>2]|0;W=s[M+4>>2]|0;A=s[M+32>>2]|0;r=W+2048|0;U=0-t|0;a=0;do{V=e+88+((te(a,r)|0)<<2)|0;s[Z+(a<<2)>>2]=V;s[S+(a<<2)>>2]=V+8192+(U<<2);a=a+1|0}while((a|0)<(K|0));B=e+88+((te(r,K)|0)<<2)|0;k=B+(K*24<<2)|0;u=d<<1;u=k+(u<<2)+(u<<2)+(u<<2)|0;G=e+48|0;V=s[G>>2]|0;E=s[e+20>>2]|0;if((V|0)<5&(E|0)==0?(s[e+52>>2]|0)==0:0){L=(V|0)==0;if(L){bi(Z,f,2048,K);wi(f+1440|0,f,1328,620,c);D=720-(s[c>>2]|0)|0;s[e+44>>2]=D;N=1}else{N=.800000011920929;D=s[e+44>>2]|0}P=Ne()|0;O=l;l=l+((1*(W<<2)|0)+15&-16)|0;_=s[M+60>>2]|0;k=D<<1;E=(k|0)<1024;A=F+4096|0;i=2048-t|0;S=i<<2;M=1024-D|0;T=W+t|0;R=1024-t+M|0;x=i+-1|0;C=e+56|0;I=e+64|0;p=e+72|0;b=(W|0)/2|0;m=W+-1|0;v=0;do{g=s[Z+(v<<2)>>2]|0;r=0;while(1){if((r|0)==1024)break;s[F+(r<<2)>>2]=s[g+(r+1024<<2)>>2];r=r+1|0}if(L){Ai(F,j,_,W,24,1024);h[j>>2]=+h[j>>2]*1.000100016593933;r=1;while(1){if((r|0)==25)break;e=j+(r<<2)|0;w=+h[e>>2];y=+(r|0);h[e>>2]=w-w*6400000711437315e-20*y*y;r=r+1|0}_i(B+(v*24<<2)|0,j,24)}f=E?k:1024;r=2048-f+-1|0;a=0;while(1){if((a|0)==24)break;s[z+(a<<2)>>2]=s[g+(r-a<<2)>>2];a=a+1|0}c=A+(0-f<<2)|0;d=B+(v*24<<2)|0;yi(c,d,c,f,z);c=f>>1;u=1024-c|0;r=1024-f|0;o=1;w=1;a=0;while(1){if((a|0)>=(c|0))break;$=+h[F+(u+a<<2)>>2];y=+h[F+(r+a<<2)>>2];o=o+$*$;w=w+y*y;a=a+1|0}w=+H(+((o=(T|0)){r=0;break}e=(a|0)<(D|0);$=e?o:o*w;e=a-(e?0:D)|0;h[g+(i+r<<2)>>2]=$*+h[F+(M+e<<2)>>2];X=+h[g+(R+e<<2)>>2];y=y+X*X;o=$;r=r+1|0;a=e+1|0}while(1){if((r|0)==24)break;s[q+(r<<2)>>2]=s[g+(x-r<<2)>>2];r=r+1|0}a=g+8192|0;r=a+(U<<2)|0;Ei(r,d,r,T,q);o=0;r=0;while(1){if((r|0)>=(T|0))break;X=+h[g+(i+r<<2)>>2];o=o+X*X;r=r+1|0}e:do if(y>o*.20000000298023224){if(y=(W|0)){r=W;break}e=g+(i+r<<2)|0;h[e>>2]=(1-+h[_+(r<<2)>>2]*o)*+h[e>>2];r=r+1|0}while(1){if((r|0)>=(T|0))break e;e=g+(i+r<<2)|0;h[e>>2]=w*+h[e>>2];r=r+1|0}}}else{r=0;while(1){if((r|0)>=(T|0))break e;h[g+(i+r<<2)>>2]=0;r=r+1|0}}while(0);e=s[C>>2]|0;X=-+h[I>>2];r=s[p>>2]|0;As(O,a,e,e,W,X,X,r,r,0,0);r=0;while(1){if((r|0)>=(b|0))break;h[g+(r+2048<<2)>>2]=+h[_+(r<<2)>>2]*+h[O+(m-r<<2)>>2]+ +h[_+(W-r+-1<<2)>>2]*+h[O+(r<<2)>>2];r=r+1|0}v=v+1|0}while((v|0)<(K|0));qe(P|0);Z=V+1|0;s[G>>2]=Z;l=Y;return}r=s[e+24>>2]|0;g=s[M+12>>2]|0;f=(r|0)<(g|0);g=(E|0)>((f?r:g)|0)?E:f?r:g;f=te(K,t)|0;v=Ne()|0;_=l;l=l+((1*(f<<2)|0)+15&-16)|0;o=(V|0)==0?1.5:.5;f=0;do{a=te(f,d)|0;c=E;while(1){if((c|0)>=(r|0))break;q=a+c|0;$=+h[u+(q<<2)>>2];q=k+(q<<2)|0;X=+h[q>>2]-o;h[q>>2]=$>X?$:X;c=c+1|0}f=f+1|0}while((f|0)<(K|0));p=e+36|0;m=0;r=s[p>>2]|0;while(1){if((m|0)>=(K|0))break;b=te(m,t)|0;a=E;e:while(1){if((a|0)>=(g|0))break;d=n[A+(a<<1)>>1]|0;c=b+(d<>1]|0)-d<=(d|0))break;q=(te(r,1664525)|0)+1013904223|0;h[_+(c+f<<2)>>2]=+(q>>20|0);f=f+1|0;r=q}u=_+(c<<2)|0;f=0;o=0;while(1){if((f|0)>=(d|0))break;X=+h[u+(f<<2)>>2];f=f+1|0;o=o+X*X}o=1/+H(+(o+1.0000000036274937e-15));c=0;f=u;while(1){if((c|0)>=(d|0))continue e;h[f>>2]=o*+h[f>>2];c=c+1|0;f=f+4|0}}m=m+1|0}s[p>>2]=r;r=2048-t+(W>>>1)<<2;a=0;do{W=s[Z+(a<<2)>>2]|0;Tn(W|0,W+(t<<2)|0,r|0)|0;a=a+1|0}while((a|0)<(K|0));oi(M,_,S,k,E,g,K,K,0,i,s[e+16>>2]|0,0);qe(v|0);Z=V+1|0;s[G>>2]=Z;l=Y;return}function oi(e,t,i,r,n,a,o,f,c,u,d,p){e=e|0;t=t|0;i=i|0;r=r|0;n=n|0;a=a|0;o=o|0;f=f|0;c=c|0;u=u|0;d=d|0;p=p|0;var b=0,m=0,w=0,g=0,v=0,_=0,y=0,k=0,E=0,A=0,S=0,M=0,T=0,R=0;R=l;M=s[e+4>>2]|0;v=s[e+8>>2]|0;_=e+44|0;w=s[_>>2]|0;k=w<>2]|0)-(E?u:0)|0;switch(f|0){case 2:{if((o|0)==1){nr(s[e+32>>2]|0,w,t,T,r,n,a,y,d,p);m=i+4|0;o=(s[m>>2]|0)+(((M|0)/2|0)<<2)|0;Mn(o|0,T|0,k<<2|0)|0;b=e+64|0;u=e+60|0;c=0;while(1){if((c|0)>=(A|0)){c=0;break}k=(s[i>>2]|0)+((te(S,c)|0)<<2)|0;pi(b,o+(c<<2)|0,k,s[u>>2]|0,M,E,A);c=c+1|0}while(1){if((c|0)>=(A|0))break;i=(s[m>>2]|0)+((te(S,c)|0)<<2)|0;pi(b,T+(c<<2)|0,i,s[u>>2]|0,M,E,A);c=c+1|0}l=R;return}break}case 1:{if((o|0)==2){u=(s[i>>2]|0)+(((M|0)/2|0)<<2)|0;c=e+32|0;nr(s[c>>2]|0,w,t,T,r,n,a,y,d,p);nr(s[c>>2]|0,s[_>>2]|0,t+(k<<2)|0,u,r+(v<<2)|0,n,a,y,d,p);c=0;while(1){if((c|0)>=(k|0))break;n=T+(c<<2)|0;h[n>>2]=+h[n>>2]*.5+ +h[u+(c<<2)>>2]*.5;c=c+1|0}o=e+64|0;c=e+60|0;u=0;while(1){if((u|0)>=(A|0))break;k=(s[i>>2]|0)+((te(S,u)|0)<<2)|0;pi(o,T+(u<<2)|0,k,s[c>>2]|0,M,E,A);u=u+1|0}l=R;return}break}default:{}}g=e+32|0;m=e+64|0;b=e+60|0;c=0;u=w;while(1){e=t+((te(c,k)|0)<<2)|0;o=r+((te(c,v)|0)<<2)|0;nr(s[g>>2]|0,u,e,T,o,n,a,y,d,p);u=i+(c<<2)|0;o=0;while(1){if((o|0)>=(A|0))break;e=(s[u>>2]|0)+((te(S,o)|0)<<2)|0;pi(m,T+(o<<2)|0,e,s[b>>2]|0,M,E,A);o=o+1|0}c=c+1|0;if((c|0)>=(f|0))break;u=s[_>>2]|0}l=R;return}function fi(e,t,i,r,n,a,o,f){e=e|0;t=t|0;i=i|0;r=r|0;n=n|0;a=a|0;o=o|0;f=f|0;var c=0,u=0,d=0,p=0,b=0,m=0,w=0,g=0,v=0,_=0,y=0,k=0,E=0,A=0,S=0;E=l;if((n|0)==1&(r|0)==2&(f|0)==0){p=+h[a>>2];b=s[e>>2]|0;f=s[e+4>>2]|0;a=o+4|0;c=0;u=+h[o>>2];d=+h[a>>2];while(1){if((c|0)>=(i|0))break;S=+h[b+(c<<2)>>2]+1.0000000031710769e-30+u;A=+h[f+(c<<2)>>2]+1.0000000031710769e-30+d;e=c<<1;h[t+(e<<2)>>2]=S*30517578125e-15;h[t+((e|1)<<2)>>2]=A*30517578125e-15;c=c+1|0;u=S*p;d=A*p}h[o>>2]=u;h[a>>2]=d;l=E;return}y=Ne()|0;k=l;l=l+((1*(i<<2)|0)+15&-16)|0;d=+h[a>>2];w=(i|0)/(n|0)|0;g=(n|0)>1;f=0;v=0;do{c=o+(v<<2)|0;u=+h[c>>2];b=s[e+(v<<2)>>2]|0;m=t+(v<<2)|0;if(!g){a=0;while(1){if((a|0)>=(i|0))break;S=+h[b+(a<<2)>>2]+1.0000000031710769e-30+u;h[m+((te(a,r)|0)<<2)>>2]=S*30517578125e-15;a=a+1|0;u=d*S}h[c>>2]=u;if(!f)f=0;else _=14}else{f=0;while(1){if((f|0)>=(i|0))break;S=+h[b+(f<<2)>>2]+1.0000000031710769e-30+u;h[k+(f<<2)>>2]=S;f=f+1|0;u=d*S}h[c>>2]=u;f=1;_=14}e:do if((_|0)==14){_=0;a=0;while(1){if((a|0)>=(w|0))break e;h[m+((te(a,r)|0)<<2)>>2]=+h[k+((te(a,n)|0)<<2)>>2]*30517578125e-15;a=a+1|0}}while(0);v=v+1|0}while((v|0)<(r|0));qe(y|0);l=E;return}function hi(e,t,i,r){e=e|0;t=t|0;i=i|0;r=r|0;var n=0,o=0,f=0,h=0,c=0,l=0,u=0,d=0;n=s[e+36>>2]|0;r=te(n,r-i|0)|0;d=e+32|0;o=(s[d>>2]|0)-r|0;s[d>>2]=o;if(!t){l=e+28|0;u=l;r=(s[l>>2]|0)-r|0}else{u=e+28|0;r=te(n,i-t|0)|0}s[u>>2]=r;f=e+20|0;h=e+40|0;c=e+24|0;l=e+4|0;t=o;while(1){if(r>>>0>=8388609)break;s[f>>2]=(s[f>>2]|0)+8;r=r<<8;s[u>>2]=r;i=s[h>>2]|0;n=s[c>>2]|0;if(n>>>0<(s[l>>2]|0)>>>0){s[c>>2]=n+1;n=a[(s[e>>2]|0)+n>>0]|0}else n=0;s[h>>2]=n;o=((i<<8|n)>>>1&255|t<<8&2147483392)^255;s[d>>2]=o;t=o}return}function ci(e,t){e=e|0;t=t|0;var i=0,r=0,n=0,o=0,f=0,h=0,c=0,l=0,u=0,d=0,p=0;p=t+-1|0;i=32-(re(p|0)|0)|0;if((i|0)<=8){u=e+28|0;h=s[u>>2]|0;o=(h>>>0)/(t>>>0)|0;s[e+36>>2]=o;d=e+32|0;l=s[d>>2]|0;c=((l>>>0)/(o>>>0)|0)+1|0;c=c>>>0>t>>>0?t:c;i=t-c|0;f=te(o,t-(i+1)|0)|0;l=l-f|0;s[d>>2]=l;t=(c|0)==(t|0)?h-f|0:o;s[u>>2]=t;o=e+20|0;f=e+40|0;h=e+24|0;c=e+4|0;while(1){if(t>>>0>=8388609)break;s[o>>2]=(s[o>>2]|0)+8;t=t<<8;s[u>>2]=t;n=s[f>>2]|0;r=s[h>>2]|0;if(r>>>0<(s[c>>2]|0)>>>0){s[h>>2]=r+1;r=a[(s[e>>2]|0)+r>>0]|0}else r=0;s[f>>2]=r;p=((n<<8|r)>>>1&255|l<<8&2147483392)^255;s[d>>2]=p;l=p}return i|0}d=i+-8|0;l=(p>>>d)+1|0;c=((s[e+28>>2]|0)>>>0)/(l>>>0)|0;s[e+36>>2]=c;c=(((s[e+32>>2]|0)>>>0)/(c>>>0)|0)+1|0;c=l-(l>>>0>>0?l:c)|0;hi(e,c,c+1|0,l);c=c<>2]|0;u=e+16|0;t=s[u>>2]|0;if(t>>>0>>0){f=e+8|0;o=s[e+4>>2]|0;h=t+8|0;h=t+(((h|0)>25?h:25)+-1-t&-8)|0;r=s[f>>2]|0;do{if(r>>>0>>0){n=r+1|0;s[f>>2]=n;r=n;n=a[(s[e>>2]|0)+(o-n)>>0]|0}else n=0;i=i|n<>2]=i>>>d;s[u>>2]=t-d;u=e+20|0;s[u>>2]=(s[u>>2]|0)+d;i=c|i&(1<>>0<=p>>>0){e=i;return e|0}s[e+44>>2]=1;e=p;return e|0}function li(e){e=e|0;var t=0,i=0,n=0,o=0,f=0,h=0,c=0,l=0,u=0,d=0,p=0,b=0,m=0,w=0,g=0;g=s[e+28>>2]|0;o=re(g|0)|0;t=2147483647>>>o;i=s[e+32>>2]|0;n=i+t&~t;if((n|t)>>>0>=(i+g|0)>>>0){n=t>>>1;n=i+n&~n;o=o+1|0}u=e+36|0;d=e+40|0;w=e+24|0;p=e+8|0;b=e+4|0;g=e+44|0;m=o+7&-8;c=o;while(1){if((c|0)<=0)break;h=n>>>23;if((h|0)==255)s[u>>2]=(s[u>>2]|0)+1;else{f=n>>>31;t=s[d>>2]|0;if((t|0)>-1){i=s[w>>2]|0;if((i+(s[p>>2]|0)|0)>>>0<(s[b>>2]|0)>>>0){s[w>>2]=i+1;r[(s[e>>2]|0)+i>>0]=t+f;t=0}else t=-1;s[g>>2]=s[g>>2]|t}t=s[u>>2]|0;if(t|0){f=f+255&255;do{i=s[w>>2]|0;if((i+(s[p>>2]|0)|0)>>>0<(s[b>>2]|0)>>>0){s[w>>2]=i+1;r[(s[e>>2]|0)+i>>0]=f;i=0;t=s[u>>2]|0}else i=-1;s[g>>2]=s[g>>2]|i;t=t+-1|0;s[u>>2]=t}while((t|0)!=0)}s[d>>2]=h&255}n=n<<8&2147483392;c=c+-8|0}i=s[d>>2]|0;if((i|0)>-1){t=s[w>>2]|0;if((t+(s[p>>2]|0)|0)>>>0<(s[b>>2]|0)>>>0){s[w>>2]=t+1;r[(s[e>>2]|0)+t>>0]=i;t=0}else t=-1;s[g>>2]=s[g>>2]|t;t=s[u>>2]|0;if(!t)l=26;else l=23}else{t=s[u>>2]|0;if(t|0)l=23}if((l|0)==23)while(1){i=s[w>>2]|0;if((i+(s[p>>2]|0)|0)>>>0<(s[b>>2]|0)>>>0){s[w>>2]=i+1;r[(s[e>>2]|0)+i>>0]=-1;i=0;t=s[u>>2]|0}else i=-1;s[g>>2]=s[g>>2]|i;t=t+-1|0;s[u>>2]=t;if(!t){l=26;break}else l=23}if((l|0)==26)s[d>>2]=0;h=s[e+16>>2]|0;f=h+~((h|0)<7?h:7)+8&-8;c=h;t=s[e+12>>2]|0;while(1){if((c|0)<=7)break;i=s[p>>2]|0;n=s[b>>2]|0;if(((s[w>>2]|0)+i|0)>>>0>>0){i=i+1|0;s[p>>2]=i;r[(s[e>>2]|0)+(n-i)>>0]=t;i=0}else i=-1;s[g>>2]=s[g>>2]|i;c=c+-8|0;t=t>>>8}f=h-f|0;if(s[g>>2]|0)return;d=s[w>>2]|0;kn((s[e>>2]|0)+d|0,0,(s[b>>2]|0)-d-(s[p>>2]|0)|0)|0;if((f|0)<=0)return;h=s[p>>2]|0;n=s[b>>2]|0;if(n>>>0<=h>>>0){s[g>>2]=-1;return}i=m-o|0;if((f|0)>(i|0)?((s[w>>2]|0)+h|0)>>>0>=n>>>0:0){s[g>>2]=-1;t=t&(1<>2]|0)+(n-h+-1)|0;r[e>>0]=a[e>>0]|0|t;return}function ui(e,t){e=e|0;t=t|0;var i=0,r=0,a=0,o=0,f=0,c=0,u=0,d=0,p=0,b=0,m=0,w=0,g=0,v=0,_=0,y=0,k=0,E=0,A=0,S=0,M=0,T=0,R=0,x=0,C=0,I=0,P=0,O=0,N=0,D=0,L=0,B=0,U=0,j=0,F=0,z=0,q=0,H=0,G=0,V=0,W=0,K=0,Z=0,Y=0;x=l;l=l+32|0;R=x;T=s[e+8>>2]|0;T=(T|0)>0?T:0;s[R>>2]=1;i=1;r=0;while(1){a=r<<1;M=n[e+12+((a|1)<<1)>>1]|0;i=te(i,n[e+12+(a<<1)>>1]|0)|0;a=r+1|0;s[R+(a<<2)>>2]=i;if(M<<16>>16==1)break;else r=a}M=e+48|0;A=n[e+12+((a<<1)+-1<<1)>>1]|0;while(1){if((r|0)<=-1)break;i=r<<1;if(!r)S=1;else S=n[e+12+(i+-1<<1)>>1]|0;e:do switch(n[e+12+(i<<1)>>1]|0){case 2:{a=s[R+(r<<2)>>2]|0;i=t;o=0;while(1){if((o|0)>=(a|0))break e;E=i+32|0;y=+h[E>>2];A=i+36|0;_=+h[A>>2];c=+h[i>>2];h[E>>2]=c-y;E=i+4|0;k=+h[E>>2];h[A>>2]=k-_;h[i>>2]=c+y;h[E>>2]=k+_;E=i+40|0;_=+h[E>>2];A=i+44|0;k=+h[A>>2];y=(_+k)*.7071067690849304;_=(k-_)*.7071067690849304;v=i+8|0;k=+h[v>>2];h[E>>2]=k-y;E=i+12|0;c=+h[E>>2];h[A>>2]=c-_;h[v>>2]=k+y;h[E>>2]=c+_;E=i+52|0;_=+h[E>>2];v=i+48|0;c=+h[v>>2];A=i+16|0;y=+h[A>>2];h[v>>2]=y-_;v=i+20|0;k=+h[v>>2];h[E>>2]=k+c;h[A>>2]=y+_;h[v>>2]=k-c;v=i+60|0;c=+h[v>>2];A=i+56|0;k=+h[A>>2];_=(c-k)*.7071067690849304;k=(c+k)*-.7071067690849304;E=i+24|0;c=+h[E>>2];h[A>>2]=c-_;A=i+28|0;y=+h[A>>2];h[v>>2]=y-k;h[E>>2]=c+_;h[A>>2]=y+k;i=i+64|0;o=o+1|0}}case 4:{v=s[R+(r<<2)>>2]|0;d=v<=(v|0))break e;k=+h[i>>2];p=i+16|0;D=+h[p>>2];c=k-D;m=i+4|0;I=+h[m>>2];b=i+20|0;O=+h[b>>2];y=I-O;D=k+D;O=I+O;w=i+8|0;I=+h[w>>2];E=i+24|0;k=+h[E>>2];N=I+k;g=i+12|0;C=+h[g>>2];A=i+28|0;_=+h[A>>2];P=C+_;h[p>>2]=D-N;h[b>>2]=O-P;h[i>>2]=D+N;h[m>>2]=O+P;k=I-k;_=C-_;h[w>>2]=c+_;h[g>>2]=y-k;h[E>>2]=c-_;h[A>>2]=y+k;i=i+32|0;a=a+1|0}}a=A<<1;o=A*3|0;f=d<<1;u=d*3|0;p=0;while(1){if((p|0)>=(v|0))break e;i=t+((te(p,S)|0)<<3)|0;g=s[M>>2]|0;b=0;m=g;w=g;while(1){if((b|0)>=(A|0))break;U=i+(A<<3)|0;C=+h[U>>2];_=+h[m>>2];B=i+(A<<3)+4|0;I=+h[B>>2];k=+h[m+4>>2];c=C*_-I*k;_=C*k+I*_;z=i+(a<<3)|0;I=+h[z>>2];k=+h[w>>2];F=i+(a<<3)+4|0;C=+h[F>>2];O=+h[w+4>>2];y=I*k-C*O;k=I*O+C*k;L=i+(o<<3)|0;C=+h[L>>2];O=+h[g>>2];E=i+(o<<3)+4|0;I=+h[E>>2];P=+h[g+4>>2];D=C*O-I*P;O=C*P+I*O;I=+h[i>>2];P=I-y;j=i+4|0;C=+h[j>>2];N=C-k;y=I+y;h[i>>2]=y;k=C+k;h[j>>2]=k;C=c+D;I=_+O;D=c-D;O=_-O;h[z>>2]=y-C;h[F>>2]=k-I;h[i>>2]=+h[i>>2]+C;h[j>>2]=+h[j>>2]+I;h[U>>2]=P+O;h[B>>2]=N-D;h[L>>2]=P-O;h[E>>2]=N+D;i=i+8|0;b=b+1|0;m=m+(d<<3)|0;w=w+(f<<3)|0;g=g+(u<<3)|0}p=p+1|0}}case 3:{a=s[R+(r<<2)>>2]|0;o=a<>2]|0)+(u<<3)+4>>2];u=o<<1;d=0;while(1){if((d|0)>=(a|0))break e;i=t+((te(d,S)|0)<<3)|0;m=s[M>>2]|0;p=A;b=m;while(1){F=i+(A<<3)|0;P=+h[F>>2];I=+h[b>>2];z=i+(A<<3)+4|0;k=+h[z>>2];N=+h[b+4>>2];C=P*I-k*N;I=P*N+k*I;U=i+(f<<3)|0;k=+h[U>>2];N=+h[m>>2];j=i+(f<<3)+4|0;P=+h[j>>2];O=+h[m+4>>2];D=k*N-P*O;N=k*O+P*N;P=C+D;O=I+N;h[F>>2]=+h[i>>2]-P*.5;B=i+4|0;h[z>>2]=+h[B>>2]-O*.5;D=(C-D)*c;N=(I-N)*c;h[i>>2]=+h[i>>2]+P;h[B>>2]=+h[B>>2]+O;h[U>>2]=+h[F>>2]+N;h[j>>2]=+h[z>>2]-D;h[F>>2]=+h[F>>2]-N;h[z>>2]=+h[z>>2]+D;p=p+-1|0;if(!p)break;else{i=i+8|0;b=b+(o<<3)|0;m=m+(u<<3)|0}}d=d+1|0}}case 5:{i=s[R+(r<<2)>>2]|0;a=i<>2]|0;c=+h[o+(f<<3)>>2];_=+h[o+(f<<3)+4>>2];f=te(a<<1,A)|0;y=+h[o+(f<<3)>>2];k=+h[o+(f<<3)+4>>2];f=A<<1;u=A*3|0;d=A<<2;v=0;while(1){if((v|0)>=(i|0))break e;g=t+((te(v,S)|0)<<3)|0;p=g;b=g+(A<<3)|0;m=g+(f<<3)|0;w=g+(u<<3)|0;g=g+(d<<3)|0;E=0;while(1){if((E|0)>=(A|0))break;V=+h[p>>2];B=p+4|0;H=+h[B>>2];G=+h[b>>2];L=te(E,a)|0;P=+h[o+(L<<3)>>2];U=b+4|0;Z=+h[U>>2];Y=+h[o+(L<<3)+4>>2];N=G*P-Z*Y;P=G*Y+Z*P;Z=+h[m>>2];L=te(E<<1,a)|0;Y=+h[o+(L<<3)>>2];F=m+4|0;G=+h[F>>2];C=+h[o+(L<<3)+4>>2];K=Z*Y-G*C;Y=Z*C+G*Y;G=+h[w>>2];L=te(E*3|0,a)|0;C=+h[o+(L<<3)>>2];z=w+4|0;Z=+h[z>>2];O=+h[o+(L<<3)+4>>2];D=G*C-Z*O;C=G*O+Z*C;Z=+h[g>>2];L=te(E<<2,a)|0;O=+h[o+(L<<3)>>2];j=g+4|0;G=+h[j>>2];q=+h[o+(L<<3)+4>>2];I=Z*O-G*q;O=Z*q+G*O;G=N+I;q=P+O;I=N-I;O=P-O;P=K+D;N=Y+C;D=K-D;C=Y-C;h[p>>2]=V+(G+P);h[B>>2]=H+(q+N);Y=V+(G*c+P*y);K=H+(q*c+N*y);Z=O*_+C*k;W=I*_+D*k;h[b>>2]=Y-Z;h[U>>2]=K+W;h[g>>2]=Y+Z;h[j>>2]=K-W;P=V+(G*y+P*c);N=H+(q*y+N*c);O=C*_-O*k;D=I*k-D*_;h[m>>2]=P+O;h[F>>2]=N+D;h[w>>2]=P-O;h[z>>2]=N-D;p=p+8|0;b=b+8|0;m=m+8|0;w=w+8|0;g=g+8|0;E=E+1|0}v=v+1|0}}default:{}}while(0);r=r+-1|0;A=S}l=x;return}function di(e,t,i,r,a,o,f){e=e|0;t=t|0;i=i|0;r=r|0;a=a|0;o=o|0;f=f|0;var c=0,u=0,d=0,p=0,b=0,m=0,w=0,g=0,v=0,_=0,y=0,k=0,E=0,A=0,S=0,M=0,T=0,R=0;A=l;v=s[e+8+(o<<2)>>2]|0;_=+h[v+4>>2];c=s[e>>2]|0;u=0;E=s[e+24>>2]|0;while(1){k=c>>1;if((u|0)>=(o|0))break;c=k;u=u+1|0;E=E+(k<<2)|0}y=c>>2;e=l;l=l+((1*(k<<2)|0)+15&-16)|0;c=l;l=l+((1*(y<<3)|0)+15&-16)|0;o=a>>1;m=r+(o<<2)|0;w=a+3>>2;g=0-k|0;p=0;b=m;m=m+-4|0;d=t+(o<<2)|0;o=t+(k<<2)+-4+(o<<2)|0;u=e;while(1){if((p|0)>=(w|0))break;S=+h[m>>2];M=+h[b>>2];h[u>>2]=S*+h[d+(k<<2)>>2]+M*+h[o>>2];h[u+4>>2]=M*+h[d>>2]-S*+h[o+(g<<2)>>2];p=p+1|0;b=b+8|0;m=m+-8|0;d=d+8|0;o=o+-8|0;u=u+8|0}t=r+(a<<2)|0;b=y-w|0;while(1){if((p|0)>=(b|0))break;s[u>>2]=s[o>>2];s[u+4>>2]=s[d>>2];p=p+1|0;d=d+8|0;o=o+-8|0;u=u+8|0}m=p;b=r;p=t+-4|0;while(1){if((m|0)>=(y|0))break;h[u>>2]=+h[p>>2]*+h[o>>2]-+h[b>>2]*+h[d+(g<<2)>>2];h[u+4>>2]=+h[p>>2]*+h[d>>2]+ +h[b>>2]*+h[o+(k<<2)>>2];m=m+1|0;b=b+8|0;p=p+-8|0;d=d+8|0;o=o+-8|0;u=u+8|0}u=v+44|0;o=0;while(1){if((o|0)>=(y|0))break;T=+h[E+(o<<2)>>2];M=+h[E+(y+o<<2)>>2];S=+h[e>>2];R=+h[e+4>>2];g=n[(s[u>>2]|0)+(o<<1)>>1]|0;h[c+(g<<3)>>2]=_*(S*T-R*M);h[c+(g<<3)+4>>2]=_*(R*T+S*M);o=o+1|0;e=e+8|0}ui(v,c);d=f<<1;p=0-d|0;u=0;o=i;e=i+((te(k+-1|0,f)|0)<<2)|0;while(1){if((u|0)>=(y|0))break;T=+h[c+4>>2];M=+h[E+(y+u<<2)>>2];S=+h[c>>2];R=+h[E+(u<<2)>>2];h[o>>2]=T*M-S*R;h[e>>2]=S*M+T*R;c=c+8|0;u=u+1|0;o=o+(d<<2)|0;e=e+(p<<2)|0}l=A;return}function pi(e,t,i,r,a,o,f){e=e|0;t=t|0;i=i|0;r=r|0;a=a|0;o=o|0;f=f|0;var c=0,l=0,u=0,d=0,p=0,b=0,m=0,w=0,g=0,v=0,_=0,y=0,k=0,E=0,A=0;c=s[e>>2]|0;l=0;w=s[e+24>>2]|0;while(1){m=c>>1;if((l|0)>=(o|0))break;c=m;l=l+1|0;w=w+(m<<2)|0}b=c>>2;g=t+((te(m+-1|0,f)|0)<<2)|0;c=i+(a>>1<<2)|0;p=s[e+8+(o<<2)>>2]|0;o=f<<1;f=0-o|0;u=s[p+44>>2]|0;d=0;l=t;e=g;while(1){if((d|0)>=(b|0))break;_=+h[e>>2];y=+h[w+(d<<2)>>2];k=+h[l>>2];v=+h[w+(b+d<<2)>>2];g=n[u>>1]<<1;h[c+((g|1)<<2)>>2]=_*y+k*v;h[c+(g<<2)>>2]=k*y-_*v;u=u+2|0;d=d+1|0;l=l+(o<<2)|0;e=e+(f<<2)|0}ui(p,c);o=b+1>>1;e=c+(m<<2)|0;f=0;while(1){l=e+-8|0;if((f|0)>=(o|0))break;g=c+4|0;A=+h[g>>2];_=+h[c>>2];k=+h[w+(f<<2)>>2];E=+h[w+(b+f<<2)>>2];t=e+-4|0;v=+h[t>>2];y=+h[l>>2];h[c>>2]=A*k+_*E;h[t>>2]=A*E-_*k;k=+h[w+(b-f+-1<<2)>>2];_=+h[w+(m-f+-1<<2)>>2];h[l>>2]=v*k+y*_;h[g>>2]=v*_-y*k;e=l;f=f+1|0;c=c+8|0}o=(a|0)/2|0;c=i+(a<<2)|0;l=r+(a<<2)|0;e=0;while(1){l=l+-4|0;c=c+-4|0;if((e|0)>=(o|0))break;A=+h[c>>2];k=+h[i>>2];E=+h[l>>2];y=+h[r>>2];h[i>>2]=E*k-y*A;h[c>>2]=y*k+E*A;e=e+1|0;r=r+4|0;i=i+4|0}return}function bi(e,t,i,r){e=e|0;t=t|0;i=i|0;r=r|0;var n=0,a=0,o=0,f=0,c=0,u=0,d=0,p=0,b=0,m=0,w=0,g=0,v=0,_=0,y=0,k=0,E=0,A=0;_=l;l=l+48|0;a=_+16|0;g=_;v=i>>1;i=1;while(1){if((i|0)>=(v|0))break;y=i<<1;k=s[e>>2]|0;h[t+(i<<2)>>2]=((+h[k+(y+-1<<2)>>2]+ +h[k+((y|1)<<2)>>2])*.5+ +h[k+(y<<2)>>2])*.5;i=i+1|0}k=s[e>>2]|0;h[t>>2]=(+h[k+4>>2]*.5+ +h[k>>2])*.5;if((r|0)==2){i=e+4|0;r=1;while(1){if((r|0)>=(v|0))break;y=r<<1;e=s[i>>2]|0;k=t+(r<<2)|0;h[k>>2]=+h[k>>2]+((+h[e+(y+-1<<2)>>2]+ +h[e+((y|1)<<2)>>2])*.5+ +h[e+(y<<2)>>2])*.5;r=r+1|0}k=s[i>>2]|0;h[t>>2]=+h[t>>2]+(+h[k+4>>2]*.5+ +h[k>>2])*.5}Ai(t,a,0,0,4,v);h[a>>2]=+h[a>>2]*1.000100016593933;i=1;while(1){if((i|0)==5)break;k=a+(i<<2)|0;m=+h[k>>2];w=+(i|0)*.00800000037997961;h[k>>2]=m-m*w*w;i=i+1|0}_i(g,a,4);i=0;n=1;while(1){if((i|0)==4)break;w=n*.8999999761581421;k=g+(i<<2)|0;h[k>>2]=+h[k>>2]*w;i=i+1|0;n=w}m=+h[g>>2];b=m+.800000011920929;w=+h[g+4>>2];m=w+m*.800000011920929;n=+h[g+8>>2];w=n+w*.800000011920929;o=+h[g+12>>2];n=o+n*.800000011920929;o=o*.800000011920929;i=0;f=0;c=0;u=0;d=0;p=0;while(1){if((i|0)>=(v|0))break;k=t+(i<<2)|0;A=+h[k>>2];h[k>>2]=A+b*f+m*c+w*u+n*d+o*p;E=f;i=i+1|0;f=A;p=d;d=u;u=c;c=E}l=_;return}function mi(e,t,i,r,n){e=e|0;t=t|0;i=i|0;r=r|0;n=n|0;var a=0,o=0,f=0,c=0,l=0,u=0,p=0,b=0,m=0,w=0,g=0,v=0,_=0,y=0,k=0,E=0,A=0,S=0,M=0,T=0,R=0,x=0,C=0,I=0,P=0,O=0,N=0,D=0,L=0,B=0,U=0;_=n+-3|0;y=r+-3|0;A=((y|0)>0?y:0)+3|0;k=A&-4;S=e+(k<<2)|0;f=n+-3|0;f=((f|0)>0?f:0)+3&-4;E=0;A=t+((A|3)<<2)|0;while(1){if((E|0)>=(_|0))break;M=t+(E<<2)|0;p=e;b=M+12|0;m=0;u=0;l=0;o=0;a=0;c=+h[M>>2];g=+h[M+4>>2];v=+h[M+8>>2];w=0;while(1){if((m|0)>=(y|0))break;I=+h[p>>2];w=+h[b>>2];U=(s[d>>2]=u,+h[d>>2])+I*c;B=(s[d>>2]=l,+h[d>>2])+I*g;L=(s[d>>2]=o,+h[d>>2])+I*v;D=+h[p+4>>2];x=+h[b+4>>2];N=+h[p+8>>2];R=+h[b+8>>2];I=(s[d>>2]=a,+h[d>>2])+I*w+D*x+N*R;C=+h[p+12>>2];T=+h[b+12>>2];O=(h[d>>2]=U+D*g+N*v+C*w,s[d>>2]|0);P=(h[d>>2]=B+D*v+N*w+C*x,s[d>>2]|0);M=(h[d>>2]=L+D*w+N*x+C*R,s[d>>2]|0);p=p+16|0;b=b+16|0;m=m+4|0;u=O;l=P;o=M;a=(h[d>>2]=I+C*T,s[d>>2]|0);c=x;g=R;v=T}m=k|1;if((k|0)<(r|0)){U=+h[S>>2];w=+h[A>>2];u=(h[d>>2]=(s[d>>2]=u,+h[d>>2])+U*c,s[d>>2]|0);l=(h[d>>2]=(s[d>>2]=l,+h[d>>2])+U*g,s[d>>2]|0);o=(h[d>>2]=(s[d>>2]=o,+h[d>>2])+U*v,s[d>>2]|0);p=S+4|0;b=A+4|0;a=(h[d>>2]=(s[d>>2]=a,+h[d>>2])+U*w,s[d>>2]|0)}else{p=S;b=A}if((m|0)<(r|0)){U=+h[p>>2];c=+h[b>>2];u=(h[d>>2]=(s[d>>2]=u,+h[d>>2])+U*g,s[d>>2]|0);l=(h[d>>2]=(s[d>>2]=l,+h[d>>2])+U*v,s[d>>2]|0);o=(h[d>>2]=(s[d>>2]=o,+h[d>>2])+U*w,s[d>>2]|0);p=p+4|0;b=b+4|0;a=(h[d>>2]=(s[d>>2]=a,+h[d>>2])+U*c,s[d>>2]|0)}if((m+1|0)<(r|0)){U=+h[p>>2];u=(h[d>>2]=(s[d>>2]=u,+h[d>>2])+U*v,s[d>>2]|0);l=(h[d>>2]=(s[d>>2]=l,+h[d>>2])+U*w,s[d>>2]|0);o=(h[d>>2]=(s[d>>2]=o,+h[d>>2])+U*c,s[d>>2]|0);a=(h[d>>2]=(s[d>>2]=a,+h[d>>2])+U*+h[b>>2],s[d>>2]|0)}s[i+(E<<2)>>2]=u;s[i+((E|1)<<2)>>2]=l;s[i+((E|2)<<2)>>2]=o;s[i+((E|3)<<2)>>2]=a;E=E+4|0;A=A+16|0}while(1){if((f|0)>=(n|0))break;a=t+(f<<2)|0;o=0;c=0;while(1){if((o|0)>=(r|0))break;U=c+ +h[e+(o<<2)>>2]*+h[a+(o<<2)>>2];o=o+1|0;c=U}h[i+(f<<2)>>2]=c;f=f+1|0}return}function wi(e,t,i,r,n){e=e|0;t=t|0;i=i|0;r=r|0;n=n|0;var a=0,o=0,f=0,c=0,u=0,d=0,p=0,b=0,m=0,w=0,g=0,v=0,_=0;_=l;l=l+16|0;w=_;u=w;s[u>>2]=0;s[u+4>>2]=0;u=i>>2;d=l;l=l+((1*(u<<2)|0)+15&-16)|0;p=i+r>>2;b=l;l=l+((1*(p<<2)|0)+15&-16)|0;g=r>>1;v=l;l=l+((1*(g<<2)|0)+15&-16)|0;c=0;while(1){if((c|0)>=(u|0))break;s[d+(c<<2)>>2]=s[e+(c<<1<<2)>>2];c=c+1|0}c=0;while(1){if((c|0)>=(p|0))break;s[b+(c<<2)>>2]=s[t+(c<<1<<2)>>2];c=c+1|0}r=r>>2;mi(d,b,v,u,r);gi(v,b,u,r,w);r=s[w>>2]<<1;m=s[w+4>>2]<<1;c=i>>1;p=0;while(1){if((p|0)>=(g|0))break;u=v+(p<<2)|0;h[u>>2]=0;i=p-r|0;if(!((((i|0)>-1?i:0-i|0)|0)>2?(i=p-m|0,(((i|0)>-1?i:0-i|0)|0)>2):0)){d=t+(p<<2)|0;b=0;a=0;while(1){if((b|0)>=(c|0))break;f=a+ +h[e+(b<<2)>>2]*+h[d+(b<<2)>>2];b=b+1|0;a=f}h[u>>2]=a<-1?-1:a}p=p+1|0}gi(v,t,c,g,w);c=s[w>>2]|0;if(!((c|0)>0&(c|0)<(g+-1|0))){v=0;g=c<<1;v=g-v|0;s[n>>2]=v;l=_;return}o=+h[v+(c+-1<<2)>>2];f=+h[v+(c<<2)>>2];a=+h[v+(c+1<<2)>>2];if(a-o>(f-o)*.699999988079071){v=1;g=c<<1;v=g-v|0;s[n>>2]=v;l=_;return}if(o-a>(f-a)*.699999988079071){v=-1;g=c<<1;v=g-v|0;s[n>>2]=v;l=_;return}v=0;g=c<<1;v=g-v|0;s[n>>2]=v;l=_;return}function gi(e,t,i,r,n){e=e|0;t=t|0;i=i|0;r=r|0;n=n|0;var a=0,o=0,f=0,c=0,l=0,u=0,p=0,b=0,m=0,w=0,g=0,v=0,_=0;s[n>>2]=0;g=n+4|0;s[g>>2]=1;o=1;a=0;while(1){if((a|0)>=(i|0)){a=0;b=0;c=0;m=-1082130432;l=-1082130432;w=0;break}f=+h[t+(a<<2)>>2];o=o+f*f;a=a+1|0}while(1){if((w|0)>=(r|0))break;f=+h[e+(w<<2)>>2];do if(f>0?(v=f*9.999999960041972e-13,v=v*v,f=v*(s[d>>2]=c,+h[d>>2]),f>(s[d>>2]=l,+h[d>>2])*o):0){f=v*(s[d>>2]=b,+h[d>>2]);if(f>(s[d>>2]=m,+h[d>>2])*o){s[g>>2]=a;p=(h[d>>2]=v,s[d>>2]|0);u=(h[d>>2]=o,s[d>>2]|0);s[n>>2]=w;a=w;c=b;l=m;break}else{l=(h[d>>2]=v,s[d>>2]|0);c=(h[d>>2]=o,s[d>>2]|0);s[g>>2]=w;u=b;p=m;break}}else{u=b;p=m}while(0);_=+h[t+(w+i<<2)>>2];f=+h[t+(w<<2)>>2];f=o+(_*_-f*f);o=f<1?1:f;b=u;m=p;w=w+1|0}return}function vi(e,t,i,r,n){e=e|0;t=t|0;i=i|0;r=r|0;n=+n;var a=0,o=0,f=0,c=0,u=0,d=0,p=0,b=0,m=0,w=0,g=0,v=0,_=0,y=0,k=0,E=0,A=0,S=0,M=0,T=0,R=0,x=0,C=0,I=0;I=l;l=l+2064|0;C=I+2052|0;k=s[i>>2]|0;S=(r|0)/2|0;x=(t|0)/2|0;R=e+2048|0;k=(k|0)>1023?511:(k|0)/2|0;s[i>>2]=k;E=I;r=R+(0-k<<2)|0;t=0;A=0;o=0;while(1){if((t|0)>=(x|0))break;y=+h[R+(t<<2)>>2];M=o+y*+h[r+(t<<2)>>2];t=t+1|0;A=A+y*y;o=M}h[E>>2]=A;r=1;a=A;while(1){if((r|0)==513)break;y=+h[R+(0-r<<2)>>2];M=+h[R+(x-r<<2)>>2];M=a+y*y-M*M;h[E+(r<<2)>>2]=M<0?0:M;r=r+1|0;a=M}m=+h[E+(k<<2)>>2];M=o/+H(+(A*m+1));g=k<<1;v=M*.699999988079071;_=M*.8500000238418579;y=n*.5;T=k;w=2;while(1){if((w|0)>=16)break;r=w<<1;b=((g+w|0)>>>0)/(r>>>0)|0;if((b|0)<7)break;if((w|0)==2){d=b+k|0;d=(d|0)>512?k:d}else d=(((te(s[17156+(w<<2)>>2]<<1,k)|0)+w|0)>>>0)/(r>>>0)|0;r=R+(0-b<<2)|0;t=R+(0-d<<2)|0;e=0;a=0;f=0;while(1){if((e|0)>=(x|0))break;u=+h[R+(e<<2)>>2];p=f+u*+h[t+(e<<2)>>2];u=a+u*+h[r+(e<<2)>>2];e=e+1|0;a=u;f=p}p=(a+f)*.5;f=(+h[E+(b<<2)>>2]+ +h[E+(d<<2)>>2])*.5;a=p/+H(+(A*f+1));r=b-S|0;r=(r|0)>-1?r:0-r|0;if((r|0)>=2)if((r|0)<3){d=(te(w*5|0,w)|0)<(k|0);u=d?y:0}else u=0;else u=n;c=v-u;c=c<.30000001192092896?.30000001192092896:c;if((b|0)<21){c=_-u;if(c<.4000000059604645)c=.4000000059604645}if(a>c){r=b;o=p}else{r=T;f=m;a=M}T=r;m=f;M=a;w=w+1|0}a=o<0?0:o;if(!(m<=a))c=a/(m+1);else c=1;e=0;while(1){if((e|0)==3)break;r=R+(1-(T+e)<<2)|0;t=0;a=0;while(1){if((t|0)>=(x|0))break;n=a+ +h[R+(t<<2)>>2]*+h[r+(t<<2)>>2];t=t+1|0;a=n}h[C+(e<<2)>>2]=a;e=e+1|0}o=+h[C+8>>2];f=+h[C>>2];a=+h[C+4>>2];if(o-f>(a-f)*.699999988079071){C=1;x=c>M;n=x?M:c;x=T<<1;C=x+C|0;x=(C|0)<15;C=x?15:C;s[i>>2]=C;l=I;return+n}if(f-o>(a-o)*.699999988079071){C=-1;x=c>M;n=x?M:c;x=T<<1;C=x+C|0;x=(C|0)<15;C=x?15:C;s[i>>2]=C;l=I;return+n}C=0;x=c>M;n=x?M:c;x=T<<1;C=x+C|0;x=(C|0)<15;C=x?15:C;s[i>>2]=C;l=I;return+n}function _i(e,t,i){e=e|0;t=t|0;i=i|0;var r=0,n=0,s=0,a=0,o=0,f=0,c=0,l=0,u=0,d=0,p=0;n=+h[t>>2];kn(e|0,0,i<<2|0)|0;if(+h[t>>2]!=0)c=0;else return;while(1){if((c|0)<(i|0)){r=0;s=0}else{r=9;break}while(1){if((c|0)==(r|0))break;a=s+ +h[e+(r<<2)>>2]*+h[t+(c-r<<2)>>2];r=r+1|0;s=a}o=c;c=c+1|0;s=(s+ +h[t+(c<<2)>>2])/n;a=-s;h[e+(o<<2)>>2]=a;r=c>>1;o=o+-1|0;f=0;while(1){if((f|0)>=(r|0))break;p=e+(f<<2)|0;u=+h[p>>2];l=e+(o-f<<2)|0;d=+h[l>>2];h[p>>2]=u+d*a;h[l>>2]=d+u*a;f=f+1|0}n=n-s*s*n;if(n<+h[t>>2]*.0010000000474974513){r=9;break}}if((r|0)==9)return}function yi(e,t,i,r,n){e=e|0;t=t|0;i=i|0;r=r|0;n=n|0;var a=0,o=0,f=0,c=0,u=0,d=0,p=0,b=0,m=0,w=0,g=0;m=l;l=l+112|0;d=m+96|0;p=m;b=l;l=l+((1*(r+24<<2)|0)+15&-16)|0;a=0;while(1){if((a|0)==24)break;s[p+(a<<2)>>2]=s[t+(24-a+-1<<2)>>2];a=a+1|0}a=0;while(1){if((a|0)==24){a=0;break}s[b+(a<<2)>>2]=s[n+(24-a+-1<<2)>>2];a=a+1|0}while(1){if((a|0)>=(r|0)){a=0;break}s[b+(a+24<<2)>>2]=s[e+(a<<2)>>2];a=a+1|0}while(1){if((a|0)==24)break;s[n+(a<<2)>>2]=s[e+(r-a+-1<<2)>>2];a=a+1|0}t=r+-3|0;n=d+4|0;f=d+8|0;c=d+12|0;a=((t|0)>0?t:0)+3&-4;u=0;while(1){if((u|0)>=(t|0))break;s[d>>2]=0;s[d+4>>2]=0;s[d+8>>2]=0;s[d+12>>2]=0;ki(p,b+(u<<2)|0,d,24);h[i+(u<<2)>>2]=+h[e+(u<<2)>>2]+ +h[d>>2];w=u|1;h[i+(w<<2)>>2]=+h[e+(w<<2)>>2]+ +h[n>>2];w=u|2;h[i+(w<<2)>>2]=+h[e+(w<<2)>>2]+ +h[f>>2];w=u|3;h[i+(w<<2)>>2]=+h[e+(w<<2)>>2]+ +h[c>>2];u=u+4|0}while(1){if((a|0)<(r|0)){t=0;o=0}else break;while(1){if((t|0)==24)break;g=o+ +h[p+(t<<2)>>2]*+h[b+(a+t<<2)>>2];t=t+1|0;o=g}h[i+(a<<2)>>2]=+h[e+(a<<2)>>2]+o;a=a+1|0}l=m;return}function ki(e,t,i,r){e=e|0;t=t|0;i=i|0;r=r|0;var n=0,s=0,a=0,o=0,f=0,c=0,l=0,u=0,d=0,p=0,b=0,m=0,w=0,g=0,v=0,_=0,y=0,k=0,E=0,A=0,S=0;f=r+-3|0;p=i+4|0;b=i+8|0;m=i+12|0;l=((f|0)>0?f:0)+3|0;u=l&-4;l=l|3;s=e;a=t+12|0;c=0;n=+h[t>>2];d=+h[t+4>>2];w=+h[t+8>>2];o=0;while(1){if((c|0)>=(f|0))break;k=+h[s>>2];o=+h[a>>2];S=+h[i>>2]+k*n;h[i>>2]=S;A=+h[p>>2]+k*d;h[p>>2]=A;E=+h[b>>2]+k*w;h[b>>2]=E;k=+h[m>>2]+k*o;h[m>>2]=k;y=+h[s+4>>2];_=+h[a+4>>2];S=S+y*d;h[i>>2]=S;A=A+y*w;h[p>>2]=A;E=E+y*o;h[b>>2]=E;y=k+y*_;h[m>>2]=y;k=+h[s+8>>2];v=+h[a+8>>2];S=S+k*w;h[i>>2]=S;A=A+k*o;h[p>>2]=A;E=E+k*_;h[b>>2]=E;k=y+k*v;h[m>>2]=k;y=+h[s+12>>2];g=+h[a+12>>2];h[i>>2]=S+y*o;h[p>>2]=A+y*_;h[b>>2]=E+y*v;h[m>>2]=k+y*g;s=s+16|0;a=a+16|0;c=c+4|0;n=_;d=v;w=g}a=e+(u<<2)|0;s=t+(l<<2)|0;f=u|1;if((u|0)<(r|0)){S=+h[a>>2];o=+h[s>>2];h[i>>2]=+h[i>>2]+S*n;h[p>>2]=+h[p>>2]+S*d;h[b>>2]=+h[b>>2]+S*w;h[m>>2]=+h[m>>2]+S*o;a=a+4|0;s=s+4|0}if((f|0)<(r|0)){S=+h[a>>2];n=+h[s>>2];h[i>>2]=+h[i>>2]+S*d;h[p>>2]=+h[p>>2]+S*w;h[b>>2]=+h[b>>2]+S*o;h[m>>2]=+h[m>>2]+S*n;a=a+4|0;s=s+4|0}if((f+1|0)>=(r|0))return;A=+h[a>>2];S=+h[s>>2];h[i>>2]=+h[i>>2]+A*w;h[p>>2]=+h[p>>2]+A*o;h[b>>2]=+h[b>>2]+A*n;h[m>>2]=+h[m>>2]+A*S;return}function Ei(e,t,i,r,n){e=e|0;t=t|0;i=i|0;r=r|0;n=n|0;var a=0,o=0,f=0,c=0,u=0,d=0,p=0,b=0,m=0,w=0,g=0,v=0,_=0,y=0,k=0,E=0,A=0,S=0,M=0;_=l;l=l+112|0;w=_+96|0;g=_;o=r+24|0;v=l;l=l+((1*(o<<2)|0)+15&-16)|0;a=0;while(1){if((a|0)==24)break;s[g+(a<<2)>>2]=s[t+(24-a+-1<<2)>>2];a=a+1|0}a=0;while(1){if((a|0)==24){a=24;break}h[v+(a<<2)>>2]=-+h[n+(24-a+-1<<2)>>2];a=a+1|0}while(1){if((a|0)>=(o|0))break;h[v+(a<<2)>>2]=0;a=a+1|0}o=r+-3|0;c=w+4|0;u=w+8|0;d=w+12|0;p=t+4|0;b=t+8|0;a=r+-3|0;a=((a|0)>0?a:0)+3&-4;m=0;while(1){if((m|0)>=(o|0))break;s[w>>2]=s[e+(m<<2)>>2];M=m|1;s[c>>2]=s[e+(M<<2)>>2];A=m|2;s[u>>2]=s[e+(A<<2)>>2];y=m|3;s[d>>2]=s[e+(y<<2)>>2];ki(g,v+(m<<2)|0,w,24);S=+h[w>>2];f=-S;h[v+(m+24<<2)>>2]=f;h[i+(m<<2)>>2]=S;S=+h[c>>2]+ +h[t>>2]*f;h[c>>2]=S;k=-S;h[v+(m+25<<2)>>2]=k;h[i+(M<<2)>>2]=S; +S=+h[u>>2]+ +h[t>>2]*k+ +h[p>>2]*f;h[u>>2]=S;E=-S;h[v+(m+26<<2)>>2]=E;h[i+(A<<2)>>2]=S;f=+h[d>>2]+ +h[t>>2]*E+ +h[p>>2]*k+ +h[b>>2]*f;h[d>>2]=f;h[v+(m+27<<2)>>2]=-f;h[i+(y<<2)>>2]=f;m=m+4|0}while(1){if((a|0)>=(r|0)){a=0;break}o=0;f=+h[e+(a<<2)>>2];while(1){if((o|0)==24)break;S=f-+h[g+(o<<2)>>2]*+h[v+(a+o<<2)>>2];o=o+1|0;f=S}h[v+(a+24<<2)>>2]=f;h[i+(a<<2)>>2]=f;a=a+1|0}while(1){if((a|0)==24)break;s[n+(a<<2)>>2]=s[i+(r-a+-1<<2)>>2];a=a+1|0}l=_;return}function Ai(e,t,i,r,n,a){e=e|0;t=t|0;i=i|0;r=r|0;n=n|0;a=a|0;var o=0,f=0,c=0,u=0,d=0,p=0;d=l;u=a-n|0;c=l;l=l+((1*(a<<2)|0)+15&-16)|0;e:do if(!r)c=e;else{f=0;while(1){if((f|0)>=(a|0)){f=0;break}s[c+(f<<2)>>2]=s[e+(f<<2)>>2];f=f+1|0}while(1){if((f|0)>=(r|0))break e;o=+h[i+(f<<2)>>2];h[c+(f<<2)>>2]=+h[e+(f<<2)>>2]*o;p=a-f+-1|0;h[c+(p<<2)>>2]=+h[e+(p<<2)>>2]*o;f=f+1|0}}while(0);mi(c,c,t,u,n+1|0);r=0;while(1){if((r|0)>(n|0))break;o=0;f=r+u|0;while(1){if((f|0)>=(a|0))break;o=o+ +h[c+(f<<2)>>2]*+h[c+(f-r<<2)>>2];f=f+1|0}p=t+(r<<2)|0;h[p>>2]=+h[p>>2]+o;r=r+1|0}l=d;return}function Si(e,t,i,r,n,a,o,f,c,u,d,p,b,m,w,g,v){e=e|0;t=t|0;i=i|0;r=r|0;n=n|0;a=a|0;o=o|0;f=f|0;c=c|0;u=u|0;d=d|0;p=p|0;b=b|0;m=m|0;w=w|0;g=g|0;v=v|0;var _=0,y=0,k=0,E=0,A=0,S=0,M=0,T=0,R=0,x=0,C=0,I=0,P=0,O=0,N=0,D=0,L=0,B=0,U=0,j=0,F=0,z=0,q=0,H=0,G=0,V=0;G=l;l=l+96|0;F=G+72|0;z=G+48|0;q=G+24|0;H=G;if(!b)if((w|0)==0?(_=i-t|0,+h[m>>2]>+(te(u<<1,_)|0)):0)E=(te(_,u)|0)<(p|0);else E=0;else E=1;k=+(o>>>0)*+h[m>>2]*+(g|0)/+(u<<9|0);j=e+8|0;A=s[j>>2]|0;g=0;y=0;do{b=te(g,A)|0;_=t;while(1){if((_|0)>=(r|0))break;B=_+b|0;V=+h[n+(B<<2)>>2]-+h[a+(B<<2)>>2];y=y+V*V;_=_+1|0}g=g+1|0}while((g|0)<(u|0));B=~~k;k=y>200?200:y;D=c+20|0;g=s[D>>2]|0;L=c+28|0;b=s[L>>2]|0;N=g+((re(b|0)|0)+-32)|0;_=(N+3|0)>>>0>o>>>0;O=_?0:E&1;if((i-t|0)>10?(S=+(p|0)*.125,!(S>16)):0)y=S;else y=16;y=(v|0)==0?y:3;s[F>>2]=s[c>>2];s[F+4>>2]=s[c+4>>2];s[F+8>>2]=s[c+8>>2];s[F+12>>2]=s[c+12>>2];s[F+16>>2]=s[c+16>>2];s[F+20>>2]=s[c+20>>2];P=c+24|0;x=s[P>>2]|0;s[z>>2]=s[L>>2];s[z+4>>2]=s[L+4>>2];s[z+8>>2]=s[L+8>>2];s[z+12>>2]=s[L+12>>2];s[z+16>>2]=s[L+16>>2];R=te(A,u)|0;C=l;l=l+((1*(R<<2)|0)+15&-16)|0;I=l;l=l+((1*(R<<2)|0)+15&-16)|0;Mn(C|0,a|0,R<<2|0)|0;R=_|(w|0)==0;if(R)if(!O){T=x;M=0}else{Mi(e,t,i,n,C,o,N,29009+(d*84|0)+42|0,I,c,u,d,1,y,v)|0;U=22}else{_=Mi(e,t,i,n,C,o,N,29009+(d*84|0)+42|0,I,c,u,d,1,y,v)|0;if(!O){g=s[D>>2]|0;b=s[L>>2]|0;T=s[P>>2]|0;M=_}else U=22}if((U|0)==22){Mn(a|0,C|0,(te(s[j>>2]|0,u)|0)<<2|0)|0;Mn(f|0,I|0,(te(s[j>>2]|0,u)|0)<<2|0)|0;V=k;h[m>>2]=V;l=G;return}E=32-(re(b|0)|0)|0;r=b>>>(E+-16|0);b=(r>>>12)+-8|0;b=(g<<3)-((E<<3)+(b+(r>>>0>(s[5272+(b<<2)>>2]|0)>>>0&1)))|0;g=s[c>>2]|0;r=c+4|0;s[q>>2]=s[r>>2];s[q+4>>2]=s[r+4>>2];s[q+8>>2]=s[r+8>>2];s[q+12>>2]=s[r+12>>2];s[q+16>>2]=s[r+16>>2];s[H>>2]=s[L>>2];s[H+4>>2]=s[L+4>>2];s[H+8>>2]=s[L+8>>2];s[H+12>>2]=s[L+12>>2];s[H+16>>2]=s[L+16>>2];E=g+x|0;p=T-x|0;A=Ne()|0;w=l;l=l+((1*((T|0)==(x|0)?1:p)|0)+15&-16)|0;Mn(w|0,E|0,p|0)|0;s[c>>2]=s[F>>2];s[c+4>>2]=s[F+4>>2];s[c+8>>2]=s[F+8>>2];s[c+12>>2]=s[F+12>>2];s[c+16>>2]=s[F+16>>2];s[c+20>>2]=s[F+20>>2];s[P>>2]=x;s[L>>2]=s[z>>2];s[L+4>>2]=s[z+4>>2];s[L+8>>2]=s[z+8>>2];s[L+12>>2]=s[z+12>>2];s[L+16>>2]=s[z+16>>2];_=Mi(e,t,i,n,a,o,N,29009+(d*84|0)+(O*42|0)|0,f,c,u,d,0,y,v)|0;do if(!R){if((M|0)>=(_|0)){if((M|0)!=(_|0))break;e=s[L>>2]|0;v=32-(re(e|0)|0)|0;e=e>>>(v+-16|0);t=(e>>>12)+-8|0;if(((s[D>>2]<<3)-((v<<3)+(t+(e>>>0>(s[5272+(t<<2)>>2]|0)>>>0&1)))+B|0)<=(b|0))break}s[c>>2]=g;s[r>>2]=s[q>>2];s[r+4>>2]=s[q+4>>2];s[r+8>>2]=s[q+8>>2];s[r+12>>2]=s[q+12>>2];s[r+16>>2]=s[q+16>>2];s[P>>2]=T;s[L>>2]=s[H>>2];s[L+4>>2]=s[H+4>>2];s[L+8>>2]=s[H+8>>2];s[L+12>>2]=s[H+12>>2];s[L+16>>2]=s[H+16>>2];Mn(E|0,w|0,p|0)|0;Mn(a|0,C|0,(te(s[j>>2]|0,u)|0)<<2|0)|0;Mn(f|0,I|0,(te(s[j>>2]|0,u)|0)<<2|0)|0;qe(A|0);V=k;h[m>>2]=V;l=G;return}while(0);qe(A|0);V=+h[17336+(d<<2)>>2];V=V*V*+h[m>>2]+k;h[m>>2]=V;l=G;return}function Mi(e,t,i,n,o,f,c,u,d,p,b,m,w,g,v){e=e|0;t=t|0;i=i|0;n=n|0;o=o|0;f=f|0;c=c|0;u=u|0;d=d|0;p=p|0;b=b|0;m=m|0;w=w|0;g=+g;v=v|0;var _=0,y=0,k=0,E=0,A=0,S=0,M=0,T=0,R=0,x=0,C=0,I=0,P=0,O=0,N=0,D=0,L=0,B=0,U=0,j=0,F=0,q=0,H=0,G=0,V=0,W=0,K=0,Z=0,Y=0,$=0,X=0,J=0,Q=0,ee=0,ie=0;ie=l;l=l+16|0;ee=ie;X=ee;s[X>>2]=0;s[X+4>>2]=0;e:do if((c+3|0)<=(f|0)){O=p+28|0;_=s[O>>2]|0;c=_>>>3;_=_-c|0;P=p+32|0;if(!w)c=_;else s[P>>2]=(s[P>>2]|0)+_;s[O>>2]=c;S=p+36|0;M=p+20|0;T=p+40|0;R=p+24|0;x=p+8|0;C=p+4|0;I=p+44|0;while(1){if(c>>>0>=8388609)break e;_=s[P>>2]|0;k=_>>>23;if((k|0)==255)s[S>>2]=(s[S>>2]|0)+1;else{y=_>>>31;c=s[T>>2]|0;if((c|0)>-1){_=s[R>>2]|0;if((_+(s[x>>2]|0)|0)>>>0<(s[C>>2]|0)>>>0){s[R>>2]=_+1;r[(s[p>>2]|0)+_>>0]=c+y;c=0}else c=-1;s[I>>2]=s[I>>2]|c}c=s[S>>2]|0;if(c|0){y=y+255&255;do{_=s[R>>2]|0;if((_+(s[x>>2]|0)|0)>>>0<(s[C>>2]|0)>>>0){s[R>>2]=_+1;r[(s[p>>2]|0)+_>>0]=y;_=0;c=s[S>>2]|0}else _=-1;s[I>>2]=s[I>>2]|_;c=c+-1|0;s[S>>2]=c}while((c|0)!=0)}s[T>>2]=k&255;_=s[P>>2]|0;c=s[O>>2]|0}s[P>>2]=_<<8&2147483392;c=c<<8;s[O>>2]=c;s[M>>2]=(s[M>>2]|0)+8}}while(0);if(!w){Q=+h[17320+(m<<2)>>2];J=+h[17336+(m<<2)>>2]}else{Q=.149993896484375;J=0}Z=e+8|0;Y=p+20|0;$=p+28|0;X=b*3|0;e=(v|0)==0;v=p+32|0;B=p+36|0;U=p+40|0;j=p+24|0;F=p+8|0;q=p+4|0;H=p+44|0;c=0;K=t;while(1){if((K|0)>=(i|0))break;G=te(X,i-K|0)|0;V=(K|0)!=(t|0);W=(K|0)<20;m=0;do{w=K+(te(m,s[Z>>2]|0)|0)|0;A=+h[n+(w<<2)>>2];E=+h[o+(w<<2)>>2];L=J*(E<-9?-9:E);w=ee+(m<<2)|0;N=+h[w>>2];D=A-L-N;_=~~+z(+(D+.5));E=(E<-28?-28:E)-g;if((_|0)<0&A0?0:O}else O=_;k=s[Y>>2]|0;P=s[$>>2]|0;S=k+((re(P|0)|0)+-32)|0;M=f-S|0;y=M-G|0;if((y|0)<24&V){_=(O|0)>1?1:O;if((y|0)<16)_=(_|0)<-1?-1:_}else _=O;_=e|(K|0)<2|(_|0)<0?_:0;e:do if((M|0)<=14)if((M|0)>1){_=(_|0)<-1?-1:(_|0)<1?_:1;y=_<<1^_>>31;S=P>>>2;if((y|0)>0){I=a[29345+(y+-1)>>0]|0;P=P-(te(S,I)|0)|0;s[v>>2]=(s[v>>2]|0)+P;y=te(S,I-(a[29345+y>>0]|0)|0)|0}else y=P-(te(S,a[29345+y>>0]|0)|0)|0;s[$>>2]=y;while(1){if(y>>>0>=8388609)break e;S=s[v>>2]|0;M=S>>>23;if((M|0)==255)s[B>>2]=(s[B>>2]|0)+1;else{S=S>>>31;y=s[U>>2]|0;if((y|0)>-1){k=s[j>>2]|0;if((k+(s[F>>2]|0)|0)>>>0<(s[q>>2]|0)>>>0){s[j>>2]=k+1;r[(s[p>>2]|0)+k>>0]=y+S;y=0}else y=-1;s[H>>2]=s[H>>2]|y}y=s[B>>2]|0;if(y|0){S=S+255&255;do{k=s[j>>2]|0;if((k+(s[F>>2]|0)|0)>>>0<(s[q>>2]|0)>>>0){s[j>>2]=k+1;r[(s[p>>2]|0)+k>>0]=S;k=0;y=s[B>>2]|0}else k=-1;s[H>>2]=s[H>>2]|k;y=y+-1|0;s[B>>2]=y}while((y|0)!=0)}s[U>>2]=M&255;S=s[v>>2]|0;y=s[$>>2]|0;k=s[Y>>2]|0}s[v>>2]=S<<8&2147483392;y=y<<8;s[$>>2]=y;k=k+8|0;s[Y>>2]=k}}else{if((S|0)>=(f|0)){_=-1;break}S=P>>>1;y=P-S|0;if((_|0)>-1)_=0;else{s[v>>2]=(s[v>>2]|0)+y;y=S}s[$>>2]=y;while(1){if(y>>>0>=8388609)break e;S=s[v>>2]|0;M=S>>>23;if((M|0)==255)s[B>>2]=(s[B>>2]|0)+1;else{S=S>>>31;y=s[U>>2]|0;if((y|0)>-1){k=s[j>>2]|0;if((k+(s[F>>2]|0)|0)>>>0<(s[q>>2]|0)>>>0){s[j>>2]=k+1;r[(s[p>>2]|0)+k>>0]=y+S;y=0}else y=-1;s[H>>2]=s[H>>2]|y}y=s[B>>2]|0;if(y|0){S=S+255&255;do{k=s[j>>2]|0;if((k+(s[F>>2]|0)|0)>>>0<(s[q>>2]|0)>>>0){s[j>>2]=k+1;r[(s[p>>2]|0)+k>>0]=S;k=0;y=s[B>>2]|0}else k=-1;s[H>>2]=s[H>>2]|k;y=y+-1|0;s[B>>2]=y}while((y|0)!=0)}s[U>>2]=M&255;S=s[v>>2]|0;y=s[$>>2]|0;k=s[Y>>2]|0}s[v>>2]=S<<8&2147483392;y=y<<8;s[$>>2]=y;k=k+8|0;s[Y>>2]=k}}else{M=(W?K:20)<<1;y=(a[u+M>>0]|0)<<7;M=(a[u+(M|1)>>0]|0)<<6;if(_){C=_>>31;T=_+C^C;S=te(32736-y|0,16384-M|0)|0;R=y;x=1;while(1){y=S>>>15;if(!y){I=36;break}if((T|0)<=(x|0)){I=37;break}I=y<<1;S=te(I,M)|0;R=R+(I+2)|0;x=x+1|0}if((I|0)==36){I=0;M=T-x|0;_=(32768-R-C>>1)+-1|0;_=(M|0)<(_|0)?M:_;M=R+((_<<1|1)+C)|0;y=32768-M|0;y=y>>>0>1?1:y;_=x+_+C^C}else if((I|0)==37){I=0;M=y+1|0;y=M;M=R+(M&~C)|0}S=P>>>15;if(!M)I=40;else{P=P-(te(S,32768-M|0)|0)|0;s[v>>2]=(s[v>>2]|0)+P;y=te(S,y)|0}}else{S=P>>>15;_=0;I=40}if((I|0)==40)y=P-(te(S,32768-y|0)|0)|0;s[$>>2]=y;S=y;y=k;while(1){if(S>>>0>=8388609)break e;k=s[v>>2]|0;M=k>>>23;if((M|0)==255)s[B>>2]=(s[B>>2]|0)+1;else{S=k>>>31;y=s[U>>2]|0;if((y|0)>-1){k=s[j>>2]|0;if((k+(s[F>>2]|0)|0)>>>0<(s[q>>2]|0)>>>0){s[j>>2]=k+1;r[(s[p>>2]|0)+k>>0]=y+S;y=0}else y=-1;s[H>>2]=s[H>>2]|y}y=s[B>>2]|0;if(y|0){S=S+255&255;do{k=s[j>>2]|0;if((k+(s[F>>2]|0)|0)>>>0<(s[q>>2]|0)>>>0){s[j>>2]=k+1;r[(s[p>>2]|0)+k>>0]=S;k=0;y=s[B>>2]|0}else k=-1;s[H>>2]=s[H>>2]|k;y=y+-1|0;s[B>>2]=y}while((y|0)!=0)}s[U>>2]=M&255;k=s[v>>2]|0;S=s[$>>2]|0;y=s[Y>>2]|0}s[v>>2]=k<<8&2147483392;S=S<<8;s[$>>2]=S;y=y+8|0;s[Y>>2]=y}}while(0);A=+(_|0);h[d+(K+(te(m,s[Z>>2]|0)|0)<<2)>>2]=D-A;O=O-_|0;c=c+((O|0)>-1?O:0-O|0)|0;h[o+(K+(te(m,s[Z>>2]|0)|0)<<2)>>2]=L+N+A;h[w>>2]=N+A-Q*A;m=m+1|0}while((m|0)<(b|0));K=K+1|0}l=ie;return(e?c:0)|0}function Ti(e,t,i,o,f,h,c,u,d,p,b,m,w,g,v,_,y,k,E){e=e|0;t=t|0;i=i|0;o=o|0;f=f|0;h=h|0;c=c|0;u=u|0;d=d|0;p=p|0;b=b|0;m=m|0;w=w|0;g=g|0;v=v|0;_=_|0;y=y|0;k=k|0;E=E|0;var A=0,S=0,M=0,T=0,R=0,x=0,C=0,I=0,P=0,O=0,N=0,D=0,L=0,B=0,U=0,j=0,F=0,z=0,q=0,H=0,G=0,V=0,W=0,K=0,Z=0,Y=0,$=0,X=0,J=0,Q=0,ee=0,ie=0;ie=l;d=(d|0)>0?d:0;P=s[e+8>>2]|0;z=(d|0)>7?8:0;d=d-z|0;ee=(g|0)==2;if(ee?(A=a[29348+(i-t)>>0]|0,(d|0)>=(A|0)):0){d=d-A|0;K=(d|0)>7?8:0;d=d-K|0}else{K=0;A=0}B=l;l=l+((1*(P<<2)|0)+15&-16)|0;U=l;l=l+((1*(P<<2)|0)+15&-16)|0;F=l;l=l+((1*(P<<2)|0)+15&-16)|0;L=l;l=l+((1*(P<<2)|0)+15&-16)|0;J=g<<3;Q=e+32|0;h=h+-5-v|0;S=v+3|0;M=t;while(1){if((M|0)>=(i|0))break;$=M+1|0;Y=s[Q>>2]|0;Y=(n[Y+($<<1)>>1]|0)-(n[Y+(M<<1)>>1]|0)|0;Z=Y*3<>4;s[F+(M<<2)>>2]=(J|0)>(Z|0)?J:Z;Z=(te(te(te(Y,g)|0,h)|0,i-M+-1|0)|0)<>6;s[L+(M<<2)>>2]=Z-((Y<>2]|0;N=e+52|0;I=O+-1|0;D=1;do{R=D+I>>1;x=te(R,P)|0;C=0;h=i;S=0;e:while(1){t:while(1){T=h;do{h=T;T=T+-1|0;if((h|0)<=(t|0))break e;$=s[Q>>2]|0;h=te((n[$+(h<<1)>>1]|0)-(n[$+(T<<1)>>1]|0)|0,g)|0;h=(te(h,a[(s[N>>2]|0)+(x+T)>>0]|0)|0)<>2;if((h|0)>0){h=h+(s[L+(T<<2)>>2]|0)|0;h=(h|0)<0?0:h}M=h+(s[o+(T<<2)>>2]|0)|0;if((M|0)>=(s[F+(T<<2)>>2]|0)|C)break t}while((M|0)<(J|0));h=T;S=S+J|0}$=s[f+(T<<2)>>2]|0;C=1;h=T;S=S+((M|0)<($|0)?M:$)|0}$=(S|0)>(d|0);D=$?D:R+1|0;I=$?R+-1|0:I}while((D|0)<=(I|0));I=te(D+-1|0,P)|0;T=te(D,P)|0;R=(D|0)>1;C=t;j=t;while(1){if((C|0)>=(i|0))break;x=C+1|0;h=s[Q>>2]|0;h=te((n[h+(x<<1)>>1]|0)-(n[h+(C<<1)>>1]|0)|0,g)|0;S=s[N>>2]|0;M=(te(h,a[S+(I+C)>>0]|0)|0)<>2;if((D|0)<(O|0))h=(te(h,a[S+(T+C)>>0]|0)|0)<>2;else h=s[f+(C<<2)>>2]|0;if((M|0)>0){S=M+(s[L+(C<<2)>>2]|0)|0;S=(S|0)<0?0:S}else S=M;if((h|0)>0){h=h+(s[L+(C<<2)>>2]|0)|0;h=(h|0)<0?0:h}$=s[o+(C<<2)>>2]|0;Y=S+(R?$:0)|0;Z=h+$|0;$=($|0)>0?C:j;s[B+(C<<2)>>2]=Y;s[U+(C<<2)>>2]=(Z|0)<(Y|0)?0:Z-Y|0;C=x;j=$}Z=(g|0)>1;$=Z&1;x=64;C=0;I=0;while(1){if((C|0)==6)break;T=I+x>>1;R=0;h=i;S=0;e:while(1){t:while(1){do{Y=h;h=h+-1|0;if((Y|0)<=(t|0))break e;M=(s[B+(h<<2)>>2]|0)+((te(T,s[U+(h<<2)>>2]|0)|0)>>6)|0;if((M|0)>=(s[F+(h<<2)>>2]|0)|R)break t}while((M|0)<(J|0));S=S+J|0}Y=s[f+(h<<2)>>2]|0;R=1;S=S+((M|0)<(Y|0)?M:Y)|0}Y=(S|0)>(d|0);x=Y?T:x;C=C+1|0;I=Y?I:T}Y=v<<3;S=0;M=i;T=0;while(1){h=M+-1|0;if((M|0)<=(t|0))break;V=(s[B+(h<<2)>>2]|0)+((te(I,s[U+(h<<2)>>2]|0)|0)>>6)|0;M=(S|0)==0?(V|0)<(s[F+(h<<2)>>2]|0):0;V=M?(V|0)<(J|0)?0:J:V;W=s[f+(h<<2)>>2]|0;W=(V|0)<(W|0)?V:W;s[b+(h<<2)>>2]=W;S=M&1^1;M=h;T=T+W|0}O=J+8|0;N=(y|0)==0;U=_+28|0;y=_+32|0;q=_+20|0;H=_+40|0;G=_+24|0;V=_+4|0;P=t+2|0;D=_+36|0;L=_+8|0;o=_+44|0;W=i;B=T;e:while(1){C=W+-1|0;if((C|0)<=(j|0)){X=45;break}R=d-B|0;h=s[Q>>2]|0;I=n[h+(W<<1)>>1]|0;M=n[h+(t<<1)>>1]|0;S=I-M|0;x=(R>>>0)/(S>>>0)|0;S=R-(te(S,x)|0)|0;h=n[h+(C<<1)>>1]|0;M=S+(M-h)|0;h=I-h|0;I=b+(C<<2)|0;S=s[I>>2]|0;M=S+(te(x,h)|0)+((M|0)>0?M:0)|0;x=s[F+(C<<2)>>2]|0;if((M|0)<(((x|0)>(O|0)?x:O)|0)){T=S;S=B}else{t:do if(N){h=s[U>>2]|0;T=s[y>>2]|0;S=h>>>1;x=T>>>0>>0;if(x)h=T;else{R=T-S|0;s[y>>2]=R;S=h-S|0;h=R}s[U>>2]=S;while(1){if(S>>>0>=8388609)break;s[q>>2]=(s[q>>2]|0)+8;S=S<<8;s[U>>2]=S;R=s[H>>2]|0;T=s[G>>2]|0;if(T>>>0<(s[V>>2]|0)>>>0){s[G>>2]=T+1;T=a[(s[_>>2]|0)+T>>0]|0}else T=0;s[H>>2]=T;R=((R<<8|T)>>>1&255|h<<8&2147483392)^255;s[y>>2]=R;h=R}if(x)break e}else{if((W|0)<=(P|0)){X=50;break e}if(!((C|0)>(E|0)?1:(M|0)<=((te((W|0)<=(k|0)?7:9,h)|0)<>4|0))){X=50;break e}h=s[U>>2]|0;h=h-(h>>>1)|0;s[U>>2]=h;while(1){if(h>>>0>=8388609)break t;S=s[y>>2]|0;R=S>>>23;if((R|0)==255)s[D>>2]=(s[D>>2]|0)+1;else{T=S>>>31;h=s[H>>2]|0;if((h|0)>-1){S=s[G>>2]|0;if((S+(s[L>>2]|0)|0)>>>0<(s[V>>2]|0)>>>0){s[G>>2]=S+1;r[(s[_>>2]|0)+S>>0]=h+T;h=0}else h=-1;s[o>>2]=s[o>>2]|h}h=s[D>>2]|0;if(h|0){T=T+255&255;do{S=s[G>>2]|0;if((S+(s[L>>2]|0)|0)>>>0<(s[V>>2]|0)>>>0){s[G>>2]=S+1;r[(s[_>>2]|0)+S>>0]=T;S=0;h=s[D>>2]|0}else S=-1;s[o>>2]=s[o>>2]|S;h=h+-1|0;s[D>>2]=h}while((h|0)!=0)}s[H>>2]=R&255;S=s[y>>2]|0;h=s[U>>2]|0}s[y>>2]=S<<8&2147483392;h=h<<8;s[U>>2]=h;s[q>>2]=(s[q>>2]|0)+8}}while(0);T=s[I>>2]|0;M=M+-8|0;S=B+8|0}if((A|0)>0)h=a[29348+(C-t)>>0]|0;else h=A;W=(M|0)<(J|0);B=S-(T+A)+h+(W?0:J)|0;s[I>>2]=W?0:J;A=h;W=C}e:do if((X|0)==45)d=d+z|0;else if((X|0)==50){S=s[U>>2]|0;h=S>>>1;S=(s[y>>2]|0)+(S-h)|0;s[y>>2]=S;s[U>>2]=h;while(1){if(h>>>0>=8388609)break e;T=S>>>23;if((T|0)==255)s[D>>2]=(s[D>>2]|0)+1;else{M=S>>>31;h=s[H>>2]|0;if((h|0)>-1){S=s[G>>2]|0;if((S+(s[L>>2]|0)|0)>>>0<(s[V>>2]|0)>>>0){s[G>>2]=S+1;r[(s[_>>2]|0)+S>>0]=h+M;h=0}else h=-1;s[o>>2]=s[o>>2]|h}h=s[D>>2]|0;if(h|0){M=M+255&255;do{S=s[G>>2]|0;if((S+(s[L>>2]|0)|0)>>>0<(s[V>>2]|0)>>>0){s[G>>2]=S+1;r[(s[_>>2]|0)+S>>0]=M;S=0;h=s[D>>2]|0}else S=-1;s[o>>2]=s[o>>2]|S;h=h+-1|0;s[D>>2]=h}while((h|0)!=0)}s[H>>2]=T&255;S=s[y>>2]|0;h=s[U>>2]|0}S=S<<8&2147483392;s[y>>2]=S;h=h<<8;s[U>>2]=h;s[q>>2]=(s[q>>2]|0)+8}}while(0);e:do if((A|0)>0){if(N){s[c>>2]=(ci(_,W+1-t|0)|0)+t;break}S=s[c>>2]|0;S=(S|0)<(W|0)?S:W;s[c>>2]=S;R=S-t|0;M=W+1-t|0;h=M+-1|0;A=32-(re(h|0)|0)|0;if((A|0)<=8){h=s[U>>2]|0;A=(h>>>0)/(M>>>0)|0;if((S|0)==(t|0))A=h-(te(A,M-(R+1)|0)|0)|0;else{E=h-(te(A,M-R|0)|0)|0;s[y>>2]=(s[y>>2]|0)+E}s[U>>2]=A;while(1){if(A>>>0>=8388609)break e;h=s[y>>2]|0;M=h>>>23;if((M|0)==255)s[D>>2]=(s[D>>2]|0)+1;else{S=h>>>31;A=s[H>>2]|0;if((A|0)>-1){h=s[G>>2]|0;if((h+(s[L>>2]|0)|0)>>>0<(s[V>>2]|0)>>>0){s[G>>2]=h+1;r[(s[_>>2]|0)+h>>0]=A+S;A=0}else A=-1;s[o>>2]=s[o>>2]|A}A=s[D>>2]|0;if(A|0){S=S+255&255;do{h=s[G>>2]|0;if((h+(s[L>>2]|0)|0)>>>0<(s[V>>2]|0)>>>0){s[G>>2]=h+1;r[(s[_>>2]|0)+h>>0]=S;h=0;A=s[D>>2]|0}else h=-1;s[o>>2]=s[o>>2]|h;A=A+-1|0;s[D>>2]=A}while((A|0)!=0)}s[H>>2]=M&255;h=s[y>>2]|0;A=s[U>>2]|0}s[y>>2]=h<<8&2147483392;A=A<<8;s[U>>2]=A;s[q>>2]=(s[q>>2]|0)+8}}P=A+-8|0;h=h>>>P;S=h+1|0;M=R>>>P;T=s[U>>2]|0;A=(T>>>0)/(S>>>0)|0;if(!M)A=T-(te(A,h)|0)|0;else{E=T-(te(A,S-M|0)|0)|0;s[y>>2]=(s[y>>2]|0)+E}s[U>>2]=A;while(1){if(A>>>0>=8388609)break;h=s[y>>2]|0;M=h>>>23;if((M|0)==255)s[D>>2]=(s[D>>2]|0)+1;else{S=h>>>31;A=s[H>>2]|0;if((A|0)>-1){h=s[G>>2]|0;if((h+(s[L>>2]|0)|0)>>>0<(s[V>>2]|0)>>>0){s[G>>2]=h+1;r[(s[_>>2]|0)+h>>0]=A+S;A=0}else A=-1;s[o>>2]=s[o>>2]|A}A=s[D>>2]|0;if(A|0){S=S+255&255;do{h=s[G>>2]|0;if((h+(s[L>>2]|0)|0)>>>0<(s[V>>2]|0)>>>0){s[G>>2]=h+1;r[(s[_>>2]|0)+h>>0]=S;h=0;A=s[D>>2]|0}else h=-1;s[o>>2]=s[o>>2]|h;A=A+-1|0;s[D>>2]=A}while((A|0)!=0)}s[H>>2]=M&255;h=s[y>>2]|0;A=s[U>>2]|0}s[y>>2]=h<<8&2147483392;A=A<<8;s[U>>2]=A;s[q>>2]=(s[q>>2]|0)+8}x=(1<>2]|0;I=_+16|0;h=s[I>>2]|0;if((h+P|0)>>>0>32){T=7-h|0;T=h+((T|0)>-8?T:-8)&-8;R=h;do{S=s[L>>2]|0;M=s[V>>2]|0;if(((s[G>>2]|0)+S|0)>>>0>>0){S=S+1|0;s[L>>2]=S;r[(s[_>>2]|0)+(M-S)>>0]=A;S=0}else S=-1;s[o>>2]=s[o>>2]|S;A=A>>>8;R=R+-8|0}while((R|0)>7);h=h+-8-T|0}s[C>>2]=A|x<>2]=h+P;s[q>>2]=(s[q>>2]|0)+P}else s[c>>2]=0;while(0);e:do if((s[c>>2]|0)>(t|0))if(!K)X=169;else{if(N){A=s[U>>2]|0;S=s[y>>2]|0;h=A>>>1;K=S>>>0>>0;T=K&1;if(K)A=S;else{K=S-h|0;s[y>>2]=K;h=A-h|0;A=K}s[U>>2]=h;while(1){if(h>>>0>=8388609)break;s[q>>2]=(s[q>>2]|0)+8;h=h<<8;s[U>>2]=h;M=s[H>>2]|0;S=s[G>>2]|0;if(S>>>0<(s[V>>2]|0)>>>0){s[G>>2]=S+1;S=a[(s[_>>2]|0)+S>>0]|0}else S=0;s[H>>2]=S;K=((M<<8|S)>>>1&255|A<<8&2147483392)^255;s[y>>2]=K;A=K}s[u>>2]=T;break}h=s[U>>2]|0;A=h>>>1;h=h-A|0;if(!(s[u>>2]|0))A=h;else s[y>>2]=(s[y>>2]|0)+h;s[U>>2]=A;while(1){if(A>>>0>=8388609)break e;h=s[y>>2]|0;M=h>>>23;if((M|0)==255)s[D>>2]=(s[D>>2]|0)+1;else{S=h>>>31;A=s[H>>2]|0;if((A|0)>-1){h=s[G>>2]|0;if((h+(s[L>>2]|0)|0)>>>0<(s[V>>2]|0)>>>0){s[G>>2]=h+1;r[(s[_>>2]|0)+h>>0]=A+S;A=0}else A=-1;s[o>>2]=s[o>>2]|A}A=s[D>>2]|0;if(A|0){S=S+255&255;do{h=s[G>>2]|0;if((h+(s[L>>2]|0)|0)>>>0<(s[V>>2]|0)>>>0){s[G>>2]=h+1;r[(s[_>>2]|0)+h>>0]=S;h=0;A=s[D>>2]|0}else h=-1;s[o>>2]=s[o>>2]|h;A=A+-1|0;s[D>>2]=A}while((A|0)!=0)}s[H>>2]=M&255;h=s[y>>2]|0;A=s[U>>2]|0}s[y>>2]=h<<8&2147483392;A=A<<8;s[U>>2]=A;s[q>>2]=(s[q>>2]|0)+8}}else{d=d+K|0;X=169}while(0);if((X|0)==169)s[u>>2]=0;h=d-B|0;S=s[Q>>2]|0;S=(n[S+(W<<1)>>1]|0)-(n[S+(t<<1)>>1]|0)|0;d=(h>>>0)/(S>>>0)|0;S=te(S,d)|0;A=t;while(1){if((A|0)>=(W|0))break;X=A+1|0;K=s[Q>>2]|0;K=te(d,(n[K+(X<<1)>>1]|0)-(n[K+(A<<1)>>1]|0)|0)|0;_=b+(A<<2)|0;s[_>>2]=(s[_>>2]|0)+K;A=X}A=t;d=h-S|0;while(1){if((A|0)>=(W|0))break;_=A+1|0;X=s[Q>>2]|0;X=(n[X+(_<<1)>>1]|0)-(n[X+(A<<1)>>1]|0)|0;X=(d|0)<(X|0)?d:X;K=b+(A<<2)|0;s[K>>2]=(s[K>>2]|0)+X;A=_;d=d-X|0}O=e+56|0;I=Z?4:3;P=0;while(1){if((t|0)>=(W|0))break;C=t+1|0;M=s[Q>>2]|0;M=(n[M+(C<<1)>>1]|0)-(n[M+(t<<1)>>1]|0)<>2]|0)+P|0;if((M|0)>1){d=s[f+(t<<2)>>2]|0;d=(A|0)>(d|0)?A-d|0:0;T=A-d|0;s[x>>2]=T;A=te(M,g)|0;if(ee&(M|0)>2?(s[u>>2]|0)==0:0)h=(t|0)<(s[c>>2]|0);else h=0;R=A+(h&1)|0;S=te(R,(n[(s[O>>2]|0)+(t<<1)>>1]|0)+Y|0)|0;A=(S>>1)+(te(R,-21)|0)|0;if((M|0)==2)A=A+(R<<3>>2)|0;h=T+A|0;if((h|0)>=(R<<4|0))if((h|0)<(R*24|0))M=A+(S>>3)|0;else M=A;else M=A+(S>>2)|0;A=T+M+(R<<2)|0;A=((((A|0)<0?0:A)>>>0)/(R>>>0)|0)>>>3;S=m+(t<<2)|0;s[S>>2]=A;e=te(A,g)|0;h=s[x>>2]|0;if((e|0)>(h>>3|0)){A=h>>$>>3;s[S>>2]=A}e=(A|0)<8?A:8;s[S>>2]=e;e=te(e,R<<3)|0;s[w+(t<<2)>>2]=(e|0)>=((s[x>>2]|0)+M|0)&1;e=(te(s[S>>2]|0,g)|0)<<3;s[x>>2]=(s[x>>2]|0)-e}else{d=(A|0)<(J|0)?0:A-J|0;s[x>>2]=A-d;s[m+(t<<2)>>2]=0;s[w+(t<<2)>>2]=1}if((d|0)<=0){P=d;t=C;continue}Z=d>>I;X=m+(t<<2)|0;_=s[X>>2]|0;e=8-_|0;e=(Z|0)<(e|0)?Z:e;s[X>>2]=_+e;e=(te(e,g)|0)<<3;s[w+(t<<2)>>2]=(e|0)>=(d-P|0)&1;P=d-e|0;t=C}s[p>>2]=P;while(1){if((t|0)>=(i|0))break;u=b+(t<<2)|0;c=m+(t<<2)|0;s[c>>2]=s[u>>2]>>$>>3;s[u>>2]=0;s[w+(t<<2)>>2]=(s[c>>2]|0)<1&1;t=t+1|0}l=ie;return W|0}function Ri(e,t,i,r){e=e|0;t=t|0;i=i|0;r=r|0;var n=0,a=0,o=0,f=0,c=0,u=0,d=0,p=0,b=0,m=0,w=0,g=0,v=0;v=l;w=l;l=l+((1*(r<<2)|0)+15&-16)|0;g=l;l=l+((1*(r<<2)|0)+15&-16)|0;n=0;do{m=e+(n<<2)|0;p=+h[m>>2];s[g+(n<<2)>>2]=p<0&1;h[m>>2]=+q(+p);s[t+(n<<2)>>2]=0;h[w+(n<<2)>>2]=0;n=n+1|0}while((n|0)<(r|0));if((r>>1|0)<(i|0)){n=0;a=0;do{a=a+ +h[e+(n<<2)>>2];n=n+1|0}while((n|0)<(r|0));if(!(a>1.0000000036274937e-15&a<64)){h[e>>2]=1;n=1;do{h[e+(n<<2)>>2]=0;n=n+1|0}while((n|0)<(r|0));a=1}f=(+(i|0)+.8)*(1/a);c=0;n=i;o=0;a=0;do{b=e+(c<<2)|0;m=~~+z(+(f*+h[b>>2]));s[t+(c<<2)>>2]=m;p=+(m|0);a=a+p*p;o=o+ +h[b>>2]*p;h[w+(c<<2)>>2]=p*2;n=n-m|0;c=c+1|0}while((c|0)<(r|0))}else{n=i;o=0;a=0}if((n|0)>(r+3|0)){p=+(n|0);a=a+p*p+p*+h[w>>2];s[t>>2]=(s[t>>2]|0)+n;n=0}m=0;while(1){if((m|0)>=(n|0)){n=0;break}a=a+1;p=o+ +h[e>>2];d=a+ +h[w>>2];c=0;p=p*p;b=1;while(1){u=o+ +h[e+(b<<2)>>2];f=a+ +h[w+(b<<2)>>2];u=u*u;i=d*u>f*p;c=i?b:c;b=b+1|0;if((b|0)>=(r|0))break;else{d=i?f:d;p=i?u:p}}d=+h[e+(c<<2)>>2];b=w+(c<<2)|0;p=+h[b>>2];h[b>>2]=p+2;b=t+(c<<2)|0;s[b>>2]=(s[b>>2]|0)+1;m=m+1|0;o=o+d;a=a+p}do{e=t+(n<<2)|0;w=s[g+(n<<2)>>2]|0;s[e>>2]=(s[e>>2]^0-w)+w;n=n+1|0}while((n|0)<(r|0));l=v;return+a}function xi(e,t,i,n,a,o,f,c){e=e|0;t=t|0;i=i|0;n=n|0;a=a|0;o=o|0;f=+f;c=c|0;var u=0,d=0,p=0,b=0,m=0,w=0,g=0,v=0,_=0,y=0,k=0,E=0,A=0,S=0,M=0,T=0,R=0,x=0,C=0;C=l;x=l;l=l+((1*(t+3<<2)|0)+15&-16)|0;Ci(e,t,1,a,i,n);d=+Ri(e,x,i,t);b=t+-1|0;w=s[x+(b<<2)>>2]|0;u=w>>>31;w=(w|0)>-1?w:0-w|0;while(1){m=b;b=b+-1|0;p=t-b|0;u=u+(s[(s[17748+(((p|0)<(w|0)?p:w)<<2)>>2]|0)+(((p|0)>(w|0)?p:w)<<2)>>2]|0)|0;R=s[x+(b<<2)>>2]|0;w=w+((R|0)>-1?R:0-R|0)|0;if((R|0)<0){T=w+1|0;T=u+(s[(s[17748+(((p|0)>(w|0)?T:p)<<2)>>2]|0)+(((p|0)>(T|0)?p:T)<<2)>>2]|0)|0}else T=u;if((m|0)<=1)break;else u=T}p=(t|0)>(i|0);b=i+1|0;b=(s[(s[17748+(((t|0)<(i|0)?t:i)<<2)>>2]|0)+((p?t:i)<<2)>>2]|0)+(s[(s[17748+((p?b:t)<<2)>>2]|0)+(((b|0)<(t|0)?t:b)<<2)>>2]|0)|0;p=b+-1|0;u=32-(re(p|0)|0)|0;e:do if((u|0)>8){R=u+-8|0;u=p>>>R;p=u+1|0;b=T>>>R;y=o+28|0;m=s[y>>2]|0;w=(m>>>0)/(p>>>0)|0;if(!b){w=m-(te(w,u)|0)|0;s[y>>2]=w;_=o+32|0}else{M=m-(te(w,p-b|0)|0)|0;_=o+32|0;s[_>>2]=(s[_>>2]|0)+M;s[y>>2]=w}g=o+36|0;M=o+20|0;v=o+40|0;k=o+24|0;E=o+8|0;A=o+4|0;S=o+44|0;while(1){if(w>>>0>=8388609)break;u=s[_>>2]|0;m=u>>>23;if((m|0)==255)s[g>>2]=(s[g>>2]|0)+1;else{b=u>>>31;u=s[v>>2]|0;if((u|0)>-1){p=s[k>>2]|0;if((p+(s[E>>2]|0)|0)>>>0<(s[A>>2]|0)>>>0){s[k>>2]=p+1;r[(s[o>>2]|0)+p>>0]=u+b;u=0}else u=-1;s[S>>2]=s[S>>2]|u}u=s[g>>2]|0;if(u|0){b=b+255&255;do{p=s[k>>2]|0;if((p+(s[E>>2]|0)|0)>>>0<(s[A>>2]|0)>>>0){s[k>>2]=p+1;r[(s[o>>2]|0)+p>>0]=b;p=0;u=s[g>>2]|0}else p=-1;s[S>>2]=s[S>>2]|p;u=u+-1|0;s[g>>2]=u}while((u|0)!=0)}s[v>>2]=m&255;u=s[_>>2]|0;w=s[y>>2]|0}s[_>>2]=u<<8&2147483392;w=w<<8;s[y>>2]=w;s[M>>2]=(s[M>>2]|0)+8}v=(1<>2]|0;y=o+16|0;p=s[y>>2]|0;if((p+R|0)>>>0>32){w=7-p|0;w=p+((w|0)>-8?w:-8)&-8;g=p;do{b=s[E>>2]|0;m=s[A>>2]|0;if(((s[k>>2]|0)+b|0)>>>0>>0){b=b+1|0;s[E>>2]=b;r[(s[o>>2]|0)+(m-b)>>0]=u;b=0}else b=-1;s[S>>2]=s[S>>2]|b;u=u>>>8;g=g+-8|0}while((g|0)>7);p=p+-8-w|0}s[_>>2]=u|v<>2]=p+R;s[M>>2]=(s[M>>2]|0)+R}else{S=o+28|0;u=s[S>>2]|0;p=(u>>>0)/(b>>>0)|0;if(!T){p=u-(te(p,b+-1|0)|0)|0;s[S>>2]=p;A=o+32|0}else{R=u-(te(p,b-T|0)|0)|0;A=o+32|0;s[A>>2]=(s[A>>2]|0)+R;s[S>>2]=p}w=o+36|0;g=o+20|0;v=o+40|0;_=o+24|0;y=o+8|0;k=o+4|0;E=o+44|0;while(1){if(p>>>0>=8388609)break e;u=s[A>>2]|0;m=u>>>23;if((m|0)==255)s[w>>2]=(s[w>>2]|0)+1;else{b=u>>>31;u=s[v>>2]|0;if((u|0)>-1){p=s[_>>2]|0;if((p+(s[y>>2]|0)|0)>>>0<(s[k>>2]|0)>>>0){s[_>>2]=p+1;r[(s[o>>2]|0)+p>>0]=u+b;u=0}else u=-1;s[E>>2]=s[E>>2]|u}u=s[w>>2]|0;if(u|0){b=b+255&255;do{p=s[_>>2]|0;if((p+(s[y>>2]|0)|0)>>>0<(s[k>>2]|0)>>>0){s[_>>2]=p+1;r[(s[o>>2]|0)+p>>0]=b;p=0;u=s[w>>2]|0}else p=-1;s[E>>2]=s[E>>2]|p;u=u+-1|0;s[w>>2]=u}while((u|0)!=0)}s[v>>2]=m&255;u=s[A>>2]|0;p=s[S>>2]|0}s[A>>2]=u<<8&2147483392;p=p<<8;s[S>>2]=p;s[g>>2]=(s[g>>2]|0)+8}}while(0);if(c|0){d=1/+H(+d)*f;u=0;do{h[e+(u<<2)>>2]=d*+(s[x+(u<<2)>>2]|0);u=u+1|0}while((u|0)<(t|0));Ci(e,t,-1,a,i,n)}if((a|0)<2){a=1;l=C;return a|0}w=(t>>>0)/(a>>>0)|0;u=0;g=0;do{p=te(g,w)|0;b=0;m=0;do{m=m|s[x+(p+b<<2)>>2];b=b+1|0}while((b|0)<(w|0));u=u|((m|0)!=0&1)<=(t|0)|(a|0)==0)return;y=+(t|0)/+((te(s[17352+(a+-1<<2)>>2]|0,n)|0)+t|0);y=y*y*.5;_=+V(+(y*1.5707963705062866));y=+V(+((1-y)*1.5707963705062866));e:do if((r<<3|0)>(t|0))a=0;else{n=r>>2;a=1;while(1){if(((te((te(a,a)|0)+a|0,r)|0)+n|0)>=(t|0))break e;a=a+1|0}}while(0);v=(t>>>0)/(r>>>0)|0;o=(i|0)<0;f=(a|0)==0;c=-y;l=v+-1|0;u=v+-3|0;d=v+-2|0;p=-_;b=v-a|0;m=v-(a<<1)|0;w=m+-1|0;g=0;while(1){if((g|0)>=(r|0))break;i=e+((te(g,v)|0)<<2)|0;e:do if(!o){n=i;t=0;while(1){if((t|0)>=(l|0))break;A=+h[n>>2];k=n+4|0;E=+h[k>>2];h[k>>2]=E*_+A*c;h[n>>2]=A*_+E*y;n=k;t=t+1|0}n=i+(u<<2)|0;t=d;while(1){if((t|0)<=0)break;E=+h[n>>2];k=n+4|0;A=+h[k>>2];h[k>>2]=A*_+E*c;h[n>>2]=E*_+A*y;n=n+-4|0;t=t+-1|0}if(!f){n=i;t=0;while(1){if((t|0)>=(b|0))break;E=+h[n>>2];k=n+(a<<2)|0;A=+h[k>>2];h[k>>2]=A*y+E*p;h[n>>2]=E*y+A*_;n=n+4|0;t=t+1|0}n=i+(w<<2)|0;t=m;while(1){if((t|0)<=0)break e;E=+h[n>>2];k=n+(a<<2)|0;A=+h[k>>2];h[k>>2]=A*y+E*p;h[n>>2]=E*y+A*_;n=n+-4|0;t=t+-1|0}}}else{t:do if(f){n=i;t=0}else{n=i;t=0;while(1){if((t|0)>=(b|0))break;E=+h[n>>2];k=n+(a<<2)|0;A=+h[k>>2];h[k>>2]=A*y+E*_;h[n>>2]=E*y+A*p;n=n+4|0;t=t+1|0}n=i+(w<<2)|0;t=m;while(1){if((t|0)<=0){n=i;t=0;break t}E=+h[n>>2];k=n+(a<<2)|0;A=+h[k>>2];h[k>>2]=A*y+E*_;h[n>>2]=E*y+A*p;n=n+-4|0;t=t+-1|0}}while(0);while(1){if((t|0)>=(l|0))break;E=+h[n>>2];k=n+4|0;A=+h[k>>2];h[k>>2]=A*_+E*y;h[n>>2]=E*_+A*c;n=k;t=t+1|0}n=i+(u<<2)|0;t=d;while(1){if((t|0)<=0)break e;E=+h[n>>2];k=n+4|0;A=+h[k>>2];h[k>>2]=A*_+E*y;h[n>>2]=E*_+A*c;n=n+-4|0;t=t+-1|0}}while(0);g=g+1|0}return}function Ii(e,t,i,r,n,a,o){e=e|0;t=t|0;i=i|0;r=r|0;n=n|0;a=a|0;o=+o;var f=0,c=0,u=0,d=0,p=0,b=0,m=0,w=0,g=0,v=0,_=0,y=0,k=0;_=l;v=l;l=l+((1*(t<<2)|0)+15&-16)|0;g=(t|0)>(i|0);p=i+1|0;m=t;w=i;p=ci(a,(s[(s[17748+(((t|0)<(i|0)?t:i)<<2)>>2]|0)+((g?t:i)<<2)>>2]|0)+(s[(s[17748+((g?p:t)<<2)>>2]|0)+(((p|0)<(t|0)?t:p)<<2)>>2]|0)|0)|0;g=v;f=0;while(1){if((m|0)<=2)break;do if((w|0)<(m|0)){a=s[(s[17748+(w<<2)>>2]|0)+(m<<2)>>2]|0;c=s[(s[17748+(w+1<<2)>>2]|0)+(m<<2)>>2]|0;if(p>>>0>=a>>>0&p>>>0>>0){s[g>>2]=0;c=p-a|0;a=w;break}d=p>>>0>=c>>>0;c=p-(d?c:0)|0;a=w;do{a=a+-1|0;u=s[(s[17748+(a<<2)>>2]|0)+(m<<2)>>2]|0}while(c>>>0>>0);b=d<<31>>31;w=w-a+b^b;s[g>>2]=w<<16>>16;y=+((w&65535)<<16>>16);c=c-u|0;f=f+y*y}else{u=s[17748+(m<<2)>>2]|0;d=s[u+(w+1<<2)>>2]|0;c=p>>>0>=d>>>0;b=c<<31>>31;d=p-(c?d:0)|0;e:do if((s[u+(m<<2)>>2]|0)>>>0>d>>>0){a=m;do{a=a+-1|0;c=s[(s[17748+(a<<2)>>2]|0)+(m<<2)>>2]|0}while(c>>>0>d>>>0)}else{a=w;while(1){c=s[u+(a<<2)>>2]|0;if(c>>>0<=d>>>0)break e;a=a+-1|0}}while(0);w=w-a+b^b;s[g>>2]=w<<16>>16;y=+((w&65535)<<16>>16);c=d-c|0;f=f+y*y}while(0);m=m+-1|0;w=a;p=c;g=g+4|0}a=w<<1|1;c=p>>>0>=a>>>0;u=c<<31>>31;a=p-(c?a:0)|0;c=(a+1|0)>>>1;if(c)a=a-((c<<1)+-1)|0;w=w-c+u^u;s[g>>2]=w<<16>>16;k=+((w&65535)<<16>>16);a=c-a^0-a;s[g+4>>2]=a<<16>>16;y=+((a&65535)<<16>>16);f=1/+H(+(f+k*k+y*y))*o;a=0;do{h[e+(a<<2)>>2]=f*+(s[v+(a<<2)>>2]|0);a=a+1|0}while((a|0)<(t|0));Ci(e,t,-1,n,i,r);if((n|0)<2){n=1;l=_;return n|0}p=(t>>>0)/(n>>>0)|0;a=0;b=0;do{c=te(b,p)|0;u=0;d=0;do{d=d|s[v+(c+u<<2)>>2];u=u+1|0}while((u|0)<(p|0));a=a|((d|0)!=0&1)<>2]=0;s[U+4>>2]=0;U=t+4|0;e:do if(!f)f=s[U>>2]|0;else{d=0;while(1){f=s[U>>2]|0;if((d|0)>=(f|0))break e;s[e+(d*4260|0)+2388>>2]=0;d=d+1|0}}while(0);F=e+8536|0;if((f|0)>(s[F>>2]|0)){f=e+4260|0;kn(f|0,0,4260)|0;s[e+6636>>2]=1;s[f>>2]=65536;s[e+8408>>2]=0;s[e+8412>>2]=3176576;s[e+8428>>2]=s[e+6588>>2]<<7;s[e+8500>>2]=65536;s[e+8504>>2]=65536;s[e+8516>>2]=20;s[e+8512>>2]=2;f=s[U>>2]|0}if((f|0)==1?(s[F>>2]|0)==2:0)B=(s[t+12>>2]|0)==((s[e+2316>>2]|0)*1e3|0);else B=0;O=e+2388|0;e:do if(!(s[O>>2]|0)){E=t+16|0;A=t+12|0;S=t+8|0;k=0;M=0;t:while(1){if((k|0)>=(f|0))break e;switch(s[E>>2]|0){case 0:{s[e+(k*4260|0)+2392>>2]=1;s[e+(k*4260|0)+2324>>2]=2;f=2;break}case 10:{s[e+(k*4260|0)+2392>>2]=1;s[e+(k*4260|0)+2324>>2]=2;f=2;break}case 20:{s[e+(k*4260|0)+2392>>2]=1;s[e+(k*4260|0)+2324>>2]=4;f=4;break}case 40:{s[e+(k*4260|0)+2392>>2]=2;s[e+(k*4260|0)+2324>>2]=4;f=4;break}case 60:{s[e+(k*4260|0)+2392>>2]=3;s[e+(k*4260|0)+2324>>2]=4;f=4;break}default:{f=-203;T=183;break t}}g=s[A>>2]>>10;v=g+1|0;_=(v|0)==8;switch(g|0){case 7:case 11:case 15:break;default:{f=-200;T=183;break t}}p=s[S>>2]|0;y=v<<16>>16;s[e+(k*4260|0)+2332>>2]=y*5;b=e+(k*4260|0)+2324|0;m=te(f,y*327680>>16)|0;w=e+(k*4260|0)+2316|0;f=e+(k*4260|0)+2320|0;if((s[w>>2]|0)==(v|0)?(s[f>>2]|0)==(p|0):0){f=1;d=0;T=23}else{d=qi(e+(k*4260|0)+2432|0,y*1e3|0,p,0)|0;s[f>>2]=p;f=(s[w>>2]|0)==(v|0);if(f)T=23;else T=24}if((T|0)==23){T=0;if((m|0)!=(s[e+(k*4260|0)+2328>>2]|0))T=24}if((T|0)==24){T=0;p=(s[b>>2]|0)==4;b=e+(k*4260|0)+2384|0;do if(_)if(p){s[b>>2]=30064;break}else{s[b>>2]=30087;break}else if(p){s[b>>2]=30030;break}else{s[b>>2]=30075;break}while(0);if(!f){s[e+(k*4260|0)+2336>>2]=y*20;switch(g|0){case 7:case 11:{s[e+(k*4260|0)+2340>>2]=10;s[e+(k*4260|0)+2732>>2]=22896;if((v|0)==12)s[e+(k*4260|0)+2380>>2]=29956;else T=37;break}default:{s[e+(k*4260|0)+2340>>2]=16;s[e+(k*4260|0)+2732>>2]=22936;if((v|0)==16)s[e+(k*4260|0)+2380>>2]=29962;else T=37}}if((T|0)==37?(0,_):0)s[e+(k*4260|0)+2380>>2]=29947;s[e+(k*4260|0)+2376>>2]=1;s[e+(k*4260|0)+2308>>2]=100;r[e+(k*4260|0)+2312>>0]=10;s[e+(k*4260|0)+4164>>2]=0;kn(e+(k*4260|0)+1284|0,0,1024)|0}s[w>>2]=v;s[e+(k*4260|0)+2328>>2]=m}f=s[U>>2]|0;k=k+1|0;M=M+d|0}if((T|0)==183){l=z;return f|0}}else M=0;while(0);d=s[t>>2]|0;do if((d|0)==2)if((f|0)==2){if((s[e+8532>>2]|0)!=1?(s[F>>2]|0)!=1:0){f=2;break}s[e+8520>>2]=0;s[e+8528>>2]=0;Mn(e+6692|0,e+2432|0,300)|0;f=s[t>>2]|0}else f=2;else f=d;while(0);s[e+8532>>2]=f;s[F>>2]=s[U>>2];P=t+8|0;if(((s[P>>2]|0)+-8e3|0)>>>0>4e4){e=-200;l=z;return e|0}N=(i|0)==1;e:do if(!N?(s[O>>2]|0)==0:0){A=h+28|0;S=h+32|0;T=h+20|0;R=h+40|0;x=h+24|0;C=h+4|0;v=0;while(1){f=s[U>>2]|0;if((v|0)>=(f|0)){_=0;break}m=e+(v*4260|0)+2392|0;w=0;while(1){p=s[A>>2]|0;d=s[S>>2]|0;f=p>>>1;b=d>>>0>>0;g=b&1;if((w|0)>=(s[m>>2]|0))break;if(!b){d=d-f|0;s[S>>2]=d;f=p-f|0}s[A>>2]=f;while(1){if(f>>>0>=8388609)break;s[T>>2]=(s[T>>2]|0)+8;f=f<<8;s[A>>2]=f;b=s[R>>2]|0;p=s[x>>2]|0;if(p>>>0<(s[C>>2]|0)>>>0){s[x>>2]=p+1;p=a[(s[h>>2]|0)+p>>0]|0}else p=0;s[R>>2]=p;E=((b<<8|p)>>>1&255|d<<8&2147483392)^255;s[S>>2]=E;d=E}s[e+(v*4260|0)+2404+(w<<2)>>2]=g;w=w+1|0}if(!b){d=d-f|0;s[S>>2]=d;f=p-f|0}s[A>>2]=f;while(1){if(f>>>0>=8388609)break;s[T>>2]=(s[T>>2]|0)+8;f=f<<8;s[A>>2]=f;b=s[R>>2]|0;p=s[x>>2]|0;if(p>>>0<(s[C>>2]|0)>>>0){s[x>>2]=p+1;p=a[(s[h>>2]|0)+p>>0]|0}else p=0;s[R>>2]=p;E=((b<<8|p)>>>1&255|d<<8&2147483392)^255;s[S>>2]=E;d=E}s[e+(v*4260|0)+2416>>2]=g;v=v+1|0}while(1){if((_|0)>=(f|0))break;f=e+(_*4260|0)+2420|0;s[f>>2]=0;s[f+4>>2]=0;s[f+8>>2]=0;t:do if(s[e+(_*4260|0)+2416>>2]|0){v=e+(_*4260|0)+2392|0;d=s[v>>2]|0;if((d|0)==1){s[f>>2]=1;break}f=s[17520+(d+-2<<2)>>2]|0;w=s[A>>2]|0;d=s[S>>2]|0;p=w>>>8;g=-1;while(1){b=g+1|0;m=te(p,a[f+b>>0]|0)|0;if(d>>>0>>0){g=b;w=m}else break}b=d-m|0;s[S>>2]=b;f=w-m|0;s[A>>2]=f;while(1){if(f>>>0>=8388609)break;s[T>>2]=(s[T>>2]|0)+8;f=f<<8;s[A>>2]=f;p=s[R>>2]|0;d=s[x>>2]|0;if(d>>>0<(s[C>>2]|0)>>>0){s[x>>2]=d+1;d=a[(s[h>>2]|0)+d>>0]|0}else d=0;s[R>>2]=d;E=((p<<8|d)>>>1&255|b<<8&2147483392)^255;s[S>>2]=E;b=E}f=g+2|0;d=0;while(1){if((d|0)>=(s[v>>2]|0))break t;s[e+(_*4260|0)+2420+(d<<2)>>2]=f>>>d&1;d=d+1|0}}while(0);f=s[U>>2]|0;_=_+1|0}if(!i){k=e+2392|0;E=e+6680|0;d=0;y=0;while(1){if((y|0)>=(s[k>>2]|0))break e;g=E+(y<<2)|0;v=(y|0)>0;_=y+-1|0;w=0;while(1){if((w|0)>=(f|0))break;if(s[e+(w*4260|0)+2420+(y<<2)>>2]|0){t:do if((f|0)==2&(w|0)==0?(Ki(h,L),(s[g>>2]|0)==0):0){m=s[A>>2]|0;f=s[S>>2]|0;p=m>>>8;d=-1;while(1){d=d+1|0;b=te(p,a[29916+d>>0]|0)|0;if(f>>>0>=b>>>0)break;else m=b}p=f-b|0;s[S>>2]=p;f=m-b|0;s[A>>2]=f;m=p;while(1){if(f>>>0>=8388609)break t;s[T>>2]=(s[T>>2]|0)+8;f=f<<8;s[A>>2]=f;b=s[R>>2]|0;p=s[x>>2]|0;if(p>>>0<(s[C>>2]|0)>>>0){s[x>>2]=p+1;p=a[(s[h>>2]|0)+p>>0]|0}else p=0;s[R>>2]=p;b=((b<<8|p)>>>1&255|m<<8&2147483392)^255;s[S>>2]=b;m=b}}while(0);if(v?(s[e+(w*4260|0)+2420+(_<<2)>>2]|0)!=0:0)f=2;else f=0;dr(e+(w*4260|0)|0,h,y,1,f);pr(h,I,r[e+(w*4260|0)+2765>>0]|0,r[e+(w*4260|0)+2766>>0]|0,s[e+(w*4260|0)+2328>>2]|0);f=s[U>>2]|0}w=w+1|0}y=y+1|0}}else d=0}else d=0;while(0);f=s[U>>2]|0;do if((f|0)==2){switch(i|0){case 0:{Ki(h,L);if(!(s[e+6664+(s[O>>2]<<2)>>2]|0))T=112;else{d=0;T=121}break}case 2:{if((s[e+2420+(s[O>>2]<<2)>>2]|0)==1){Ki(h,L);if(!(s[e+6680+(s[O>>2]<<2)>>2]|0))T=112;else{d=0;T=121}}else T=108;break}default:T=108}e:do if((T|0)==108){f=e+8520|0;p=0;while(1){if((p|0)==2)break e;s[L+(p<<2)>>2]=n[f+(p<<1)>>1];p=p+1|0}}else if((T|0)==112){y=h+28|0;m=s[y>>2]|0;k=h+32|0;f=s[k>>2]|0;p=m>>>8;d=-1;while(1){d=d+1|0;b=te(p,a[29916+d>>0]|0)|0;if(f>>>0>=b>>>0)break;else m=b}_=f-b|0;s[k>>2]=_;f=m-b|0;s[y>>2]=f;m=h+20|0;w=h+40|0;g=h+24|0;v=h+4|0;while(1){if(f>>>0>=8388609){T=121;break e}s[m>>2]=(s[m>>2]|0)+8;f=f<<8;s[y>>2]=f;b=s[w>>2]|0;p=s[g>>2]|0;if(p>>>0<(s[v>>2]|0)>>>0){s[g>>2]=p+1;p=a[(s[h>>2]|0)+p>>0]|0}else p=0;s[w>>2]=p;I=((b<<8|p)>>>1&255|_<<8&2147483392)^255;s[k>>2]=I;_=I}}while(0);if((T|0)==121){f=s[U>>2]|0;if((f|0)!=2)break}if((d|0)==0?(s[e+8540>>2]|0)==1:0){kn(e+5544|0,0,1024)|0;s[e+6568>>2]=100;r[e+6572>>0]=10;s[e+8424>>2]=0;s[e+6636>>2]=1;f=s[U>>2]|0}else f=2}while(0);R=te(s[t+12>>2]|0,f)|0;R=(R|0)<(te(s[P>>2]|0,s[t>>2]|0)|0);if(R){C=Ne()|0;s[j>>2]=c;T=c+(s[e+2328>>2]<<1)+4|0;s[j+4>>2]=T;m=c}else{T=e+2328|0;I=te(f,(s[T>>2]|0)+2|0)|0;C=Ne()|0;m=l;l=l+((1*(I<<1)|0)+15&-16)|0;s[j>>2]=m;T=m+(s[T>>2]<<1)+4|0;s[j+4>>2]=T}if(!i){x=e+8540|0;b=(d|0)==0&1}else{f=e+8540|0;if(s[f>>2]|0)if((s[U>>2]|0)==2&(i|0)==2)p=(s[e+6680+(s[e+6648>>2]<<2)>>2]|0)==1;else p=0;else p=1;x=f;b=p&1}p=(i|0)==2;w=0;while(1){f=s[U>>2]|0;if((w|0)>=(f|0))break;if((w|0)==0|(b|0)!=0){f=(s[O>>2]|0)-w|0;do if((f|0)<1)f=0;else{if(p){f=s[e+(w*4260|0)+2420+(f+-1<<2)>>2]|0?2:0;break}if((w|0)>0?s[x>>2]|0:0){f=1;break}f=2}while(0);f=M+(ur(e+(w*4260|0)|0,h,(s[j+(w<<2)>>2]|0)+4|0,D,i,f)|0)|0}else{kn((s[j+(w<<2)>>2]|0)+4|0,0,s[D>>2]<<1|0)|0;f=M}M=e+(w*4260|0)+2388|0;s[M>>2]=(s[M>>2]|0)+1;w=w+1|0;M=f}e:do if((s[t>>2]|0)==2&(f|0)==2){ +E=e+8520|0;A=e+2316|0;f=s[A>>2]|0;S=s[D>>2]|0;y=e+8524|0;w=o[y>>1]|o[y+2>>1]<<16;n[m>>1]=w;n[m+2>>1]=w>>>16;w=e+8528|0;g=o[w>>1]|o[w+2>>1]<<16;n[T>>1]=g;n[T+2>>1]=g>>>16;g=m+(S<<1)|0;g=o[g>>1]|o[g+2>>1]<<16;n[y>>1]=g;n[y+2>>1]=g>>>16;y=T+(S<<1)|0;y=o[y>>1]|o[y+2>>1]<<16;n[w>>1]=y;n[w+2>>1]=y>>>16;w=n[E>>1]|0;y=e+8522|0;g=n[y>>1]|0;f=f<<3;k=s[L>>2]|0;p=(65536/(f|0)|0)<<16>>16;v=((te(k-(w&65535)<<16>>16,p)|0)>>15)+1>>1;_=s[L+4>>2]|0;p=((te(_-(g&65535)<<16>>16,p)|0)>>15)+1>>1;b=0;w=w<<16>>16;g=g<<16>>16;while(1){if((b|0)>=(f|0))break;D=w+v|0;L=g+p|0;h=b+1|0;I=n[m+(h<<1)>>1]|0;H=(n[m+(b<<1)>>1]|0)+(n[m+(b+2<<1)>>1]|0)+(I<<1)|0;i=T+(h<<1)|0;q=D<<16>>16;O=L<<16>>16;O=((n[i>>1]<<8)+((te(H>>7,q)|0)+((te(H<<9&65024,q)|0)>>16))+((te(I>>5,O)|0)+((te(I<<11&63488,O)|0)>>16))>>7)+1>>1;n[i>>1]=(O|0)>32767?32767:((O|0)<-32768?-32768:O)&65535;b=h;w=D;g=L}p=k<<16>>16;b=_<<16>>16;while(1){if((f|0)>=(S|0))break;H=f+1|0;L=n[m+(H<<1)>>1]|0;D=(n[m+(f<<1)>>1]|0)+(n[m+(f+2<<1)>>1]|0)+(L<<1)|0;q=T+(H<<1)|0;L=((n[q>>1]<<8)+((te(D>>7,p)|0)+((te(D<<9&65024,p)|0)>>16))+((te(L>>5,b)|0)+((te(L<<11&63488,b)|0)>>16))>>7)+1>>1;n[q>>1]=(L|0)>32767?32767:((L|0)<-32768?-32768:L)&65535;f=H}n[E>>1]=k;n[y>>1]=_;f=0;while(1){if((f|0)>=(S|0)){v=A;g=S;break e}H=f+1|0;D=m+(H<<1)|0;i=n[D>>1]|0;q=T+(H<<1)|0;L=n[q>>1]|0;h=i+L|0;L=i-L|0;n[D>>1]=(h|0)>32767?32767:((h|0)<-32768?-32768:h)&65535;n[q>>1]=(L|0)>32767?32767:((L|0)<-32768?-32768:L)&65535;f=H}}else{v=e+8524|0;g=o[v>>1]|o[v+2>>1]<<16;n[m>>1]=g;n[m+2>>1]=g>>>16;g=s[D>>2]|0;m=s[j>>2]|0;H=m+(g<<1)|0;H=o[H>>1]|o[H+2>>1]<<16;n[v>>1]=H;n[v+2>>1]=H>>>16;v=e+2316|0}while(0);p=te(g,s[P>>2]|0)|0;p=(p|0)/((s[v>>2]<<16>>16)*1e3|0)|0;s[u>>2]=p;f=s[t>>2]|0;b=(f|0)==2;if(b){w=l;l=l+((1*((b?p:1)<<1)|0)+15&-16)|0}else w=c;if(R){H=s[e+2328>>2]|0;q=te(s[U>>2]|0,H+2|0)|0;m=l;l=l+((1*(q<<1)|0)+15&-16)|0;Mn(m|0,c|0,q<<1|0)|0;s[j>>2]=m;s[j+4>>2]=m+(H<<1)+4}b=0;while(1){p=s[U>>2]|0;if((b|0)>=(((f|0)<(p|0)?f:p)|0))break;Hi(e+(b*4260|0)+2432|0,w,(s[j+(b<<2)>>2]|0)+2|0,g);f=s[t>>2]|0;if((f|0)==2){f=0;while(1){if((f|0)>=(s[u>>2]|0))break;n[c+(b+(f<<1)<<1)>>1]=n[w+(f<<1)>>1]|0;f=f+1|0}f=s[t>>2]|0}b=b+1|0}e:do if((f|0)==2&(p|0)==1){if(!B){f=0;while(1){if((f|0)>=(s[u>>2]|0))break e;H=f<<1;n[c+((H|1)<<1)>>1]=n[c+(H<<1)>>1]|0;f=f+1|0}}Hi(e+6692|0,w,m+2|0,g);f=0;while(1){if((f|0)>=(s[u>>2]|0))break e;n[c+((f<<1|1)<<1)>>1]=n[w+(f<<1)>>1]|0;f=f+1|0}}while(0);if((s[e+4164>>2]|0)==2)f=te(s[e+2308>>2]|0,s[17364+((s[v>>2]|0)+-8>>2<<2)>>2]|0)|0;else f=0;s[t+20>>2]=f;e:do if(N){f=0;while(1){if((f|0)>=(s[F>>2]|0))break e;r[e+(f*4260|0)+2312>>0]=10;f=f+1|0}}else s[x>>2]=d;while(0);qe(C|0);H=M;l=z;return H|0}function Oi(e,t,i){e=e|0;t=t|0;i=i|0;var r=0,n=0,a=0;kn(e|0,0,20400)|0;r=0;n=0;while(1){if((r|0)==2)break;a=n+(Fi(e+(r*10156|0)|0,t)|0)|0;r=r+1|0;n=a}s[e+20376>>2]=1;a=e+20380|0;s[a>>2]=1;s[i>>2]=1;s[i+4>>2]=s[a>>2];s[i+8>>2]=s[e+4648>>2];s[i+12>>2]=s[e+4656>>2];s[i+16>>2]=s[e+4660>>2];s[i+20>>2]=s[e+4664>>2];s[i+24>>2]=s[e+4704>>2];s[i+28>>2]=s[e+4700>>2];s[i+32>>2]=s[e+4708>>2];s[i+36>>2]=s[e+4716>>2];s[i+40>>2]=s[e+6180>>2];s[i+48>>2]=s[e+6168>>2];s[i+52>>2]=s[e+4768>>2];a=e+4668|0;s[i+72>>2]=(s[a>>2]<<16>>16)*1e3;s[i+76>>2]=s[e+4628>>2];if((s[a>>2]|0)!=16){r=0;r=r&1;a=i+80|0;s[a>>2]=r;return n|0}r=(s[e+28>>2]|0)==0;r=r&1;a=i+80|0;s[a>>2]=r;return n|0}function Ni(e,t,i,f,h,c,u){e=e|0;t=t|0;i=i|0;f=f|0;h=h|0;c=c|0;u=u|0;var d=0,p=0,b=0,m=0,w=0,g=0,v=0,_=0,y=0,k=0,E=0,A=0,S=0,M=0,T=0,R=0,x=0,C=0,I=0,P=0,O=0,N=0,D=0,L=0,B=0,U=0,j=0,F=0,z=0,q=0,H=0,G=0,V=0,W=0,K=0,Z=0,Y=0,$=0,X=0,J=0,Q=0,ee=0,ie=0,ne=0,se=0,ae=0,oe=0,fe=0,he=0,ce=0,le=0,ue=0,de=0,pe=0,be=0,me=0,we=0,ge=0,ve=0,_e=0,ye=0,ke=0,Ee=0,Ae=0,Se=0,Me=0,Te=0,Re=0,xe=0,Ce=0,Ie=0,Pe=0,Oe=0,De=0,Le=0,Be=0,Ue=0,je=0,Fe=0,ze=0,He=0,Ge=0,Ve=0,We=0,Ke=0,Ze=0,Ye=0,$e=0,Xe=0,Je=0,Qe=0,et=0,tt=0,it=0,rt=0,nt=0,st=0,at=0,ot=0;ot=l;l=l+16|0;st=ot;if(s[t+68>>2]|0){s[e+4756>>2]=1;s[e+14912>>2]=1}rt=e+15996|0;s[rt>>2]=0;nt=e+5840|0;s[nt>>2]=0;U=t+8|0;p=s[U>>2]|0;e:do if((p|0)<24e3){if((p|0)<12e3){switch(p|0){case 8e3:break e;default:d=-102}l=ot;return d|0}if((p|0)<16e3){switch(p|0){case 12e3:break e;default:d=-102}l=ot;return d|0}else{switch(p|0){case 16e3:break e;default:d=-102}l=ot;return d|0}}else if((p|0)<44100)if((p|0)<32e3){switch(p|0){case 24e3:break e;default:d=-102}l=ot;return d|0}else{switch(p|0){case 32e3:break e;default:d=-102}l=ot;return d|0}else if((p|0)<48e3){switch(p|0){case 44100:break e;default:d=-102}l=ot;return d|0}else{switch(p|0){case 48e3:break e;default:d=-102}l=ot;return d|0}while(0);B=t+20|0;p=s[B>>2]|0;e:do if((p|0)>=12e3)if((p|0)<16e3){switch(p|0){case 12e3:break e;default:d=-102}l=ot;return d|0}else{switch(p|0){case 16e3:break e;default:d=-102}l=ot;return d|0}else{switch(p|0){case 8e3:break e;default:d=-102}l=ot;return d|0}while(0);D=t+12|0;b=s[D>>2]|0;e:do if((b|0)>=12e3)if((b|0)<16e3){switch(b|0){case 12e3:break e;default:d=-102}l=ot;return d|0}else{switch(b|0){case 16e3:break e;default:d=-102}l=ot;return d|0}else{switch(b|0){case 8e3:break e;default:d=-102}l=ot;return d|0}while(0);L=t+16|0;m=s[L>>2]|0;e:do if((m|0)>=12e3)if((m|0)<16e3){switch(m|0){case 12e3:break e;default:d=-102}l=ot;return d|0}else{switch(m|0){case 16e3:break e;default:d=-102}l=ot;return d|0}else{switch(m|0){case 8e3:break e;default:d=-102}l=ot;return d|0}while(0);if((m|0)>(p|0)|(b|0)<(p|0)|(m|0)>(b|0)){e=-102;l=ot;return e|0}it=t+24|0;switch(s[it>>2]|0){case 60:case 40:case 20:case 10:break;default:{e=-103;l=ot;return e|0}}P=t+32|0;if((s[P>>2]|0)>>>0>100){e=-105;l=ot;return e|0}O=t+48|0;if((s[O>>2]|0)>>>0>1){e=-108;l=ot;return e|0}et=t+52|0;if((s[et>>2]|0)>>>0>1){e=-109;l=ot;return e|0}N=t+40|0;if((s[N>>2]|0)>>>0>1){e=-107;l=ot;return e|0}p=s[t>>2]|0;if((p+-1|0)>>>0>1){e=-111;l=ot;return e|0}at=t+4|0;b=s[at>>2]|0;if((b+-1|0)>>>0>1|(b|0)>(p|0)){e=-111;l=ot;return e|0}tt=t+36|0;if((s[tt>>2]|0)>>>0>10){e=-106;l=ot;return e|0}I=t+88|0;s[I>>2]=0;m=e+20380|0;if((b|0)>(s[m>>2]|0)){b=e+10156|0;p=Fi(b,s[e+5184>>2]|0)|0;s[e+20312>>2]=0;s[e+20320>>2]=0;s[e+20324>>2]=0;s[e+20328>>2]=1;s[e+20332>>2]=0;s[e+20336>>2]=1;n[e+20342>>1]=0;n[e+20340>>1]=16384;if((s[e+20376>>2]|0)==2){Mn(e+16024|0,e+5868|0,300)|0;$e=e;Xe=s[$e+4>>2]|0;Je=b;s[Je>>2]=s[$e>>2];s[Je+4>>2]=Xe}}else p=0;if((s[it>>2]|0)==(s[e+4704>>2]|0))C=(s[m>>2]|0)!=(s[at>>2]|0);else C=1;s[e+20376>>2]=s[t>>2];s[m>>2]=s[at>>2];b=f*100|0;m=s[U>>2]|0;x=(b|0)/(m|0)|0;Xe=(x|0)>1?x>>1:1;Je=(u|0)==0;e:do if(Je){if((te(x,m)|0)!=(b|0)|(f|0)<0){e=-101;l=ot;return e|0}if((f*1e3|0)>(te(s[it>>2]|0,m)|0)){e=-101;l=ot;return e|0}else{$e=e;u=0;w=0;break}}else{if((x|0)!=1){e=-101;l=ot;return e|0}b=0;while(1){m=s[at>>2]|0;if((b|0)>=(m|0))break;p=Fi(e+(b*10156|0)|0,s[e+(b*10156|0)+5184>>2]|0)|0;b=b+1|0}w=s[it>>2]|0;s[it>>2]=10;u=s[tt>>2]|0;s[tt>>2]=0;b=0;while(1){if((b|0)>=(m|0)){$e=e;break e}s[e+(b*10156|0)+4760>>2]=0;s[e+(b*10156|0)+4772>>2]=1;m=s[at>>2]|0;b=b+1|0}}while(0);Ye=e+4668|0;We=e+20392|0;M=t+44|0;T=t+64|0;Ke=t+56|0;Ze=e+5836|0;R=0;while(1){if((R|0)>=(s[at>>2]|0))break;if((R|0)==1)y=s[Ye>>2]|0;else y=0;k=$e+(R*10156|0)|0;v=s[We>>2]|0;S=$e+(R*10156|0)+6168|0;s[S>>2]=s[O>>2];s[$e+(R*10156|0)+4768>>2]=s[et>>2];p=s[U>>2]|0;s[$e+(R*10156|0)+4648>>2]=p;b=s[D>>2]|0;s[$e+(R*10156|0)+4656>>2]=b;m=s[L>>2]|0;s[$e+(R*10156|0)+4660>>2]=m;_=s[B>>2]|0;s[$e+(R*10156|0)+4664>>2]=_;s[$e+(R*10156|0)+6180>>2]=s[N>>2];s[$e+(R*10156|0)+5844>>2]=s[t>>2];s[$e+(R*10156|0)+5848>>2]=s[at>>2];s[$e+(R*10156|0)+4628>>2]=v;s[$e+(R*10156|0)+5852>>2]=R;A=$e+(R*10156|0)+4760|0;do if(!(s[A>>2]|0))Qe=41;else{if(s[$e+(R*10156|0)+4772>>2]|0){Qe=41;break}if((p|0)==(s[$e+(R*10156|0)+4652>>2]|0))break;p=s[$e+(R*10156|0)+4668>>2]|0;if((p|0)<=0)break;d=zi(k,p)|0;Qe=110}while(0);if((Qe|0)==41){Qe=0;E=$e+(R*10156|0)+4668|0;d=s[E>>2]|0;Ve=d<<16>>16;g=Ve*1e3|0;do if(Ve){if((g|0)>(p|0)|(g|0)>(b|0)|(g|0)<(m|0)){d=(p|0)<(b|0)?p:b;d=(((d|0)>(m|0)?d:m)|0)/1e3|0;break}m=$e+(R*10156|0)+24|0;p=s[m>>2]|0;if((p|0)>255)s[$e+(R*10156|0)+28>>2]=0;if((v|0)==0?(s[T>>2]|0)==0:0)break;if((g|0)>(_|0)){b=$e+(R*10156|0)+28|0;if(!(s[b>>2]|0)){s[m>>2]=256;p=$e+(R*10156|0)+16|0;s[p>>2]=0;s[p+4>>2]=0;p=256}if(s[T>>2]|0){s[b>>2]=0;d=(d|0)==16?12:8;break}if((p|0)<1){s[I>>2]=1;Ve=s[Ke>>2]|0;s[Ke>>2]=Ve-((Ve*5|0)/((s[it>>2]|0)+5|0)|0);break}else{s[b>>2]=-2;break}}if((g|0)>=(_|0)){p=$e+(R*10156|0)+28|0;if((s[p>>2]|0)>=0)break;s[p>>2]=1;break}if(s[T>>2]|0){s[m>>2]=0;Ve=$e+(R*10156|0)+16|0;s[Ve>>2]=0;s[Ve+4>>2]=0;s[$e+(R*10156|0)+28>>2]=1;d=(d|0)==8?12:16;break}p=$e+(R*10156|0)+28|0;if(!(s[p>>2]|0)){s[I>>2]=1;Ve=s[Ke>>2]|0;s[Ke>>2]=Ve-((Ve*5|0)/((s[it>>2]|0)+5|0)|0);break}else{s[p>>2]=1;break}}else d=(((_|0)<(p|0)?_:p)|0)/1e3|0;while(0);v=(y|0)==0?d:y;_=zi(k,v)|0;m=s[it>>2]|0;g=$e+(R*10156|0)+4704|0;if((s[g>>2]|0)==(m|0)){d=s[E>>2]|0;m=0}else{d=(m|0)==10;e:do if(!d){switch(m|0){case 60:case 40:case 20:{b=0;break}default:if((m|0)<11){b=-103;Qe=70;break e}else b=-103}s[$e+(R*10156|0)+5836>>2]=(m|0)/20|0;s[$e+(R*10156|0)+4672>>2]=4;d=v<<16>>16;s[$e+(R*10156|0)+4676>>2]=d*20;s[$e+(R*10156|0)+4640>>2]=d*24;d=s[E>>2]|0;p=$e+(R*10156|0)+4780|0;if((d|0)==8){s[p>>2]=30064;d=8;p=b;break}else{s[p>>2]=30030;p=b;break}}else{b=0;Qe=70}while(0);do if((Qe|0)==70){Qe=0;s[$e+(R*10156|0)+5836>>2]=1;s[$e+(R*10156|0)+4672>>2]=d?2:1;d=v<<16>>16;s[$e+(R*10156|0)+4676>>2]=te(m<<16>>16,d)|0;s[$e+(R*10156|0)+4640>>2]=d*14;d=s[E>>2]|0;p=$e+(R*10156|0)+4780|0;if((d|0)==8){s[p>>2]=30087;d=8;p=b;break}else{s[p>>2]=30075;p=b;break}}while(0);s[g>>2]=m;s[$e+(R*10156|0)+4700>>2]=0;m=p}e:do if((d|0)!=(v|0)){d=$e+(R*10156|0)+7260|0;s[d>>2]=0;s[d+4>>2]=0;s[d+8>>2]=0;p=$e+(R*10156|0)+16|0;s[p>>2]=0;s[p+4>>2]=0;s[$e+(R*10156|0)+5832>>2]=0;s[$e+(R*10156|0)+5840>>2]=0;s[$e+(R*10156|0)+4700>>2]=0;kn($e+(R*10156|0)+144|0,0,4480)|0;s[$e+(R*10156|0)+4636>>2]=100;s[$e+(R*10156|0)+4756>>2]=1;r[d>>0]=10;s[$e+(R*10156|0)+4568>>2]=100;s[$e+(R*10156|0)+4584>>2]=65536;r[$e+(R*10156|0)+4633>>0]=0;s[E>>2]=v;d=s[$e+(R*10156|0)+4672>>2]|0;p=(d|0)==4;b=$e+(R*10156|0)+4780|0;t:do if((v|0)==8)if(p){s[b>>2]=30064;d=4;Qe=86;break}else{s[b>>2]=30087;Qe=86;break}else{if(p){s[b>>2]=30030;d=4}else s[b>>2]=30075;switch(v|0){case 8:case 12:{Qe=86;break t}default:{}}s[$e+(R*10156|0)+4732>>2]=16;s[$e+(R*10156|0)+4784>>2]=22936}while(0);if((Qe|0)==86){s[$e+(R*10156|0)+4732>>2]=10;s[$e+(R*10156|0)+4784>>2]=22896}s[$e+(R*10156|0)+4680>>2]=v*5;s[$e+(R*10156|0)+4676>>2]=te(v*327680>>16,d<<16>>16)|0;Ve=v<<16;Qe=Ve>>16;s[$e+(R*10156|0)+4684>>2]=Qe*20;s[$e+(R*10156|0)+4688>>2]=Ve>>15;s[$e+(R*10156|0)+4644>>2]=Qe*18;s[$e+(R*10156|0)+4640>>2]=te(Qe,(d|0)==4?24:14)|0;switch(v|0){case 16:{s[$e+(R*10156|0)+4776>>2]=29962;v=16;break e}case 12:{s[$e+(R*10156|0)+4776>>2]=29956;v=12;break e}default:{s[$e+(R*10156|0)+4776>>2]=29947;break e}}}while(0);d=_+m|0;g=s[tt>>2]|0;do if((g|0)>=1){if((g|0)<2){s[$e+(R*10156|0)+4736>>2]=1;s[$e+(R*10156|0)+4744>>2]=49807;p=$e+(R*10156|0)+4740|0;s[p>>2]=8;s[$e+(R*10156|0)+4728>>2]=14;m=v*5|0;s[$e+(R*10156|0)+4692>>2]=m;s[$e+(R*10156|0)+4720>>2]=1;s[$e+(R*10156|0)+4724>>2]=0;s[$e+(R*10156|0)+4752>>2]=3;s[$e+(R*10156|0)+4764>>2]=0;b=8;break}if((g|0)<3){s[$e+(R*10156|0)+4736>>2]=0;s[$e+(R*10156|0)+4744>>2]=52429;p=$e+(R*10156|0)+4740|0;s[p>>2]=6;s[$e+(R*10156|0)+4728>>2]=12;m=v*3|0;s[$e+(R*10156|0)+4692>>2]=m;s[$e+(R*10156|0)+4720>>2]=2;s[$e+(R*10156|0)+4724>>2]=0;s[$e+(R*10156|0)+4752>>2]=2;s[$e+(R*10156|0)+4764>>2]=0;b=6;break}if((g|0)<4){s[$e+(R*10156|0)+4736>>2]=1;s[$e+(R*10156|0)+4744>>2]=49807;p=$e+(R*10156|0)+4740|0;s[p>>2]=8;s[$e+(R*10156|0)+4728>>2]=14;m=v*5|0;s[$e+(R*10156|0)+4692>>2]=m;s[$e+(R*10156|0)+4720>>2]=2;s[$e+(R*10156|0)+4724>>2]=0;s[$e+(R*10156|0)+4752>>2]=4;s[$e+(R*10156|0)+4764>>2]=0;b=8;break}if((g|0)<6){s[$e+(R*10156|0)+4736>>2]=1;s[$e+(R*10156|0)+4744>>2]=48497;p=$e+(R*10156|0)+4740|0;s[p>>2]=10;s[$e+(R*10156|0)+4728>>2]=16;m=v*5|0;s[$e+(R*10156|0)+4692>>2]=m;s[$e+(R*10156|0)+4720>>2]=2;s[$e+(R*10156|0)+4724>>2]=1;s[$e+(R*10156|0)+4752>>2]=6;s[$e+(R*10156|0)+4764>>2]=v*983;b=10;break}p=$e+(R*10156|0)+4736|0;if((g|0)<8){s[p>>2]=1;s[$e+(R*10156|0)+4744>>2]=47186;p=$e+(R*10156|0)+4740|0;s[p>>2]=12;s[$e+(R*10156|0)+4728>>2]=20;m=v*5|0;s[$e+(R*10156|0)+4692>>2]=m;s[$e+(R*10156|0)+4720>>2]=3;s[$e+(R*10156|0)+4724>>2]=1;s[$e+(R*10156|0)+4752>>2]=8;s[$e+(R*10156|0)+4764>>2]=v*983;b=12;break}else{s[p>>2]=2;s[$e+(R*10156|0)+4744>>2]=45875;p=$e+(R*10156|0)+4740|0;s[p>>2]=16;s[$e+(R*10156|0)+4728>>2]=24;m=v*5|0;s[$e+(R*10156|0)+4692>>2]=m;s[$e+(R*10156|0)+4720>>2]=4;s[$e+(R*10156|0)+4724>>2]=1;s[$e+(R*10156|0)+4752>>2]=16;s[$e+(R*10156|0)+4764>>2]=v*983;b=16;break}}else{s[$e+(R*10156|0)+4736>>2]=0;s[$e+(R*10156|0)+4744>>2]=52429;p=$e+(R*10156|0)+4740|0;s[p>>2]=6;s[$e+(R*10156|0)+4728>>2]=12;m=v*3|0;s[$e+(R*10156|0)+4692>>2]=m;s[$e+(R*10156|0)+4720>>2]=1;s[$e+(R*10156|0)+4724>>2]=0;s[$e+(R*10156|0)+4752>>2]=2;s[$e+(R*10156|0)+4764>>2]=0;b=6}while(0);Ve=s[$e+(R*10156|0)+4732>>2]|0;s[p>>2]=(b|0)<(Ve|0)?b:Ve;s[$e+(R*10156|0)+4696>>2]=(v*5|0)+(m<<1);s[$e+(R*10156|0)+4716>>2]=g;p=s[P>>2]|0;s[$e+(R*10156|0)+4708>>2]=p;Ve=$e+(R*10156|0)+6184|0;b=s[Ve>>2]|0;Qe=s[M>>2]|0;s[Ve>>2]=Qe;do if(Qe|0)if(!b){s[$e+(R*10156|0)+6188>>2]=7;break}else{Qe=7-(((p>>16)*26214|0)+(((p&65535)*26214|0)>>>16))|0;s[$e+(R*10156|0)+6188>>2]=(Qe|0)>2?Qe:2;break}while(0);s[A>>2]=1;Qe=110}if((Qe|0)==110?(Qe=0,d|0):0){Qe=439;break}e:do if((s[$e+(R*10156|0)+4756>>2]|0)!=0|C){p=0;while(1){if((p|0)>=(s[Ze>>2]|0))break e;s[$e+(R*10156|0)+4816+(p<<2)>>2]=0;p=p+1|0}}while(0);s[$e+(R*10156|0)+6172>>2]=s[S>>2];R=R+1|0;p=0}if((Qe|0)==439){l=ot;return d|0}P=x*10|0;L=s[Ye>>2]|0;O=te(P,L)|0;N=e+4648|0;L=(te(O,s[N>>2]|0)|0)/(L*1e3|0)|0;Ge=Ne()|0;D=l;l=l+((1*(L<<1)|0)+15&-16)|0;L=e+4676|0;B=e+5832|0;ze=e+20384|0;U=e+16024|0;j=e+5868|0;F=e+5188|0;z=e+14832|0;q=e+15988|0;H=e+14824|0;G=e+15344|0;V=h+28|0;W=h+32|0;K=h+36|0;Z=h+20|0;Y=h+40|0;$=h+24|0;X=h+8|0;J=h+4|0;Q=h+44|0;ee=e+20346|0;ie=e+14972|0;ne=e+20364|0;se=e+20368|0;ae=e+4633|0;oe=e+4636|0;fe=e+4788|0;he=e+8|0;ce=e+4624|0;le=t+28|0;ue=e+20372|0;de=e+20312|0;pe=e+5192|0;be=e+15348|0;He=t+60|0;me=e+20396|0;we=e+17416|0;ge=e+10300|0;ve=e+10172|0;_e=e+14792|0;ye=e+14724|0;ke=e+14789|0;Ee=e+14740|0;Ae=e+14912|0;Se=e+10156|0;Me=e+15346|0;Te=e+14780|0;Re=e+15013|0;xe=e+16332|0;Ce=e+16328|0;Ie=e+14968|0;Pe=e+5190|0;Ve=e+4857|0;Oe=e+6176|0;De=e+6172|0;Le=st+4|0;Be=Xe<<1;Ue=Xe+-1|0;je=e+20388|0;Fe=e+20316|0;v=i;I=0;while(1){m=s[B>>2]|0;g=(s[L>>2]|0)-m|0;g=(g|0)<(O|0)?g:O;C=te(g,s[N>>2]|0)|0;C=(C|0)/((s[Ye>>2]|0)*1e3|0)|0;do if((s[t>>2]|0)==2)if((s[at>>2]|0)==2){d=s[nt>>2]|0;b=0;while(1){if((b|0)>=(C|0))break;n[D+(b<<1)>>1]=n[v+(b<<1<<1)>>1]|0;b=b+1|0}if((s[ze>>2]|0)==1&(d|0)==0)Mn(U|0,j|0,300)|0;Hi(j,F+(m+2<<1)|0,D,C);s[B>>2]=(s[B>>2]|0)+g;b=s[q>>2]|0;m=(s[z>>2]|0)-b|0;d=te(P,s[H>>2]|0)|0;d=(m|0)<(d|0)?m:d;m=0;while(1){if((m|0)>=(C|0))break;n[D+(m<<1)>>1]=n[v+((m<<1|1)<<1)>>1]|0;m=m+1|0}Hi(U,G+(b+2<<1)|0,D,C);s[q>>2]=(s[q>>2]|0)+d;d=s[B>>2]|0;break}else{if((s[at>>2]|0)==1)d=0;else{Qe=136;break}while(1){if((d|0)>=(C|0))break;i=d<<1;i=(n[v+(i<<1)>>1]|0)+(n[v+((i|1)<<1)>>1]|0)|0;n[D+(d<<1)>>1]=(i>>>1)+(i&1);d=d+1|0}Hi(j,F+(m+2<<1)|0,D,C);e:do if((s[ze>>2]|0)==2){if(s[nt>>2]|0)break;Hi(U,G+((s[q>>2]|0)+2<<1)|0,D,C);d=0;while(1){if((d|0)>=(s[L>>2]|0))break e;i=F+((s[B>>2]|0)+d+2<<1)|0;n[i>>1]=((n[i>>1]|0)+(n[G+((s[q>>2]|0)+d+2<<1)>>1]|0)|0)>>>1;d=d+1|0}}while(0);d=(s[B>>2]|0)+g|0;s[B>>2]=d;break}else Qe=136;while(0);if((Qe|0)==136){Qe=0;Mn(D|0,v|0,C<<1|0)|0;Hi(j,F+(m+2<<1)|0,D,C);d=(s[B>>2]|0)+g|0;s[B>>2]=d}R=v+((te(C,s[t>>2]|0)|0)<<1)|0;x=f-C|0;s[We>>2]=0;if((d|0)<(s[L>>2]|0)){d=0;break}if(!((s[nt>>2]|0)!=0|Je^1)){d=256>>>(te((s[Ze>>2]|0)+1|0,s[at>>2]|0)|0);i=s[V>>2]|0;d=i-(te(i>>>8,0-d&255)|0)|0;s[V>>2]=d;while(1){if(d>>>0>=8388609){_=0;break}b=s[W>>2]|0;g=b>>>23;if((g|0)==255)s[K>>2]=(s[K>>2]|0)+1;else{m=b>>>31;d=s[Y>>2]|0;if((d|0)>-1){b=s[$>>2]|0;if((b+(s[X>>2]|0)|0)>>>0<(s[J>>2]|0)>>>0){s[$>>2]=b+1;r[(s[h>>2]|0)+b>>0]=d+m;d=0}else d=-1;s[Q>>2]=s[Q>>2]|d}d=s[K>>2]|0;if(d|0){m=m+255&255;do{b=s[$>>2]|0;if((b+(s[X>>2]|0)|0)>>>0<(s[J>>2]|0)>>>0){s[$>>2]=b+1;r[(s[h>>2]|0)+b>>0]=m;b=0;d=s[K>>2]|0}else b=-1;s[Q>>2]=s[Q>>2]|b;d=d+-1|0;s[K>>2]=d}while((d|0)!=0)}s[Y>>2]=g&255;b=s[W>>2]|0;d=s[V>>2]|0}s[W>>2]=b<<8&2147483392;d=d<<8;s[V>>2]=d;s[Z>>2]=(s[Z>>2]|0)+8}while(1){d=s[at>>2]|0;if((_|0)>=(d|0)){T=0;break}b=s[$e+(_*10156|0)+5836>>2]|0;v=0;d=0;while(1){if((d|0)>=(b|0))break;v=v|s[$e+(_*10156|0)+4816+(d<<2)>>2]<>0]=(v|0)>0&1;e:do if((v|0)!=0&(b|0)>1){g=v+-1|0;d=s[17520+(b+-2<<2)>>2]|0;b=s[V>>2]|0;m=b>>>8;if((v|0)>1){i=d+(v+-2)|0;T=b-(te(m,a[i>>0]|0)|0)|0;s[W>>2]=(s[W>>2]|0)+T;d=te(m,(a[i>>0]|0)-(a[d+g>>0]|0)|0)|0}else d=b-(te(m,a[d+g>>0]|0)|0)|0;s[V>>2]=d;while(1){if(d>>>0>=8388609)break e;b=s[W>>2]|0;g=b>>>23;if((g|0)==255)s[K>>2]=(s[K>>2]|0)+1;else{m=b>>>31;d=s[Y>>2]|0;if((d|0)>-1){b=s[$>>2]|0;if((b+(s[X>>2]|0)|0)>>>0<(s[J>>2]|0)>>>0){s[$>>2]=b+1;r[(s[h>>2]|0)+b>>0]=d+m;d=0}else d=-1;s[Q>>2]=s[Q>>2]|d}d=s[K>>2]|0;if(d|0){m=m+255&255;do{b=s[$>>2]|0;if((b+(s[X>>2]|0)|0)>>>0<(s[J>>2]|0)>>>0){s[$>>2]=b+1;r[(s[h>>2]|0)+b>>0]=m;b=0;d=s[K>>2]|0}else b=-1;s[Q>>2]=s[Q>>2]|b;d=d+-1|0;s[K>>2]=d}while((d|0)!=0)}s[Y>>2]=g&255;b=s[W>>2]|0;d=s[V>>2]|0}s[W>>2]=b<<8&2147483392;d=d<<8;s[V>>2]=d;s[Z>>2]=(s[Z>>2]|0)+8}}while(0);_=_+1|0}while(1){if((T|0)>=(s[Ze>>2]|0)){b=0;break}y=ee+(T*6|0)+2|0;k=ee+(T*6|0)+5|0;E=ie+(T<<2)|0;A=ne+T|0;S=(T|0)>0;M=T+-1|0;_=0;while(1){if((_|0)>=(d|0))break;if(s[$e+(_*10156|0)+4816+(T<<2)>>2]|0){e:do if((d|0)==2&(_|0)==0){d=((r[y>>0]|0)*5|0)+(r[k>>0]|0)|0;b=s[V>>2]|0;m=b>>>8;if((d|0)>0){i=a[29891+(d+-1)>>0]|0;v=b-(te(m,i)|0)|0;s[W>>2]=(s[W>>2]|0)+v;d=te(m,i-(a[29891+d>>0]|0)|0)|0}else d=b-(te(m,a[29891+d>>0]|0)|0)|0;s[V>>2]=d;while(1){if(d>>>0>=8388609){v=0;break}b=s[W>>2]|0;g=b>>>23;if((g|0)==255)s[K>>2]=(s[K>>2]|0)+1;else{m=b>>>31;d=s[Y>>2]|0;if((d|0)>-1){b=s[$>>2]|0;if((b+(s[X>>2]|0)|0)>>>0<(s[J>>2]|0)>>>0){s[$>>2]=b+1;r[(s[h>>2]|0)+b>>0]=d+m;d=0}else d=-1;s[Q>>2]=s[Q>>2]|d}d=s[K>>2]|0;if(d|0){m=m+255&255;do{b=s[$>>2]|0;if((b+(s[X>>2]|0)|0)>>>0<(s[J>>2]|0)>>>0){s[$>>2]=b+1;r[(s[h>>2]|0)+b>>0]=m;b=0;d=s[K>>2]|0}else b=-1;s[Q>>2]=s[Q>>2]|b;d=d+-1|0;s[K>>2]=d}while((d|0)!=0)}s[Y>>2]=g&255;b=s[W>>2]|0;d=s[V>>2]|0}s[W>>2]=b<<8&2147483392;d=d<<8;s[V>>2]=d;s[Z>>2]=(s[Z>>2]|0)+8}while(1){if((v|0)==2)break;i=r[ee+(T*6|0)+(v*3|0)>>0]|0;b=i<<24>>24;m=d>>>8;if(i<<24>>24>0){i=a[29944+(b+-1)>>0]|0;d=d-(te(m,i)|0)|0;s[W>>2]=(s[W>>2]|0)+d;d=te(m,i-(a[29944+b>>0]|0)|0)|0}else d=d-(te(m,a[29944+b>>0]|0)|0)|0;s[V>>2]=d;while(1){if(d>>>0>=8388609)break;b=s[W>>2]|0;g=b>>>23;if((g|0)==255)s[K>>2]=(s[K>>2]|0)+1;else{m=b>>>31;d=s[Y>>2]|0;if((d|0)>-1){b=s[$>>2]|0;if((b+(s[X>>2]|0)|0)>>>0<(s[J>>2]|0)>>>0){s[$>>2]=b+1;r[(s[h>>2]|0)+b>>0]=d+m;d=0}else d=-1;s[Q>>2]=s[Q>>2]|d}d=s[K>>2]|0;if(d|0){m=m+255&255;do{b=s[$>>2]|0;if((b+(s[X>>2]|0)|0)>>>0<(s[J>>2]|0)>>>0){s[$>>2]=b+1;r[(s[h>>2]|0)+b>>0]=m;b=0;d=s[K>>2]|0}else b=-1;s[Q>>2]=s[Q>>2]|b;d=d+-1|0;s[K>>2]=d}while((d|0)!=0)}s[Y>>2]=g&255;b=s[W>>2]|0;d=s[V>>2]|0}s[W>>2]=b<<8&2147483392;d=d<<8;s[V>>2]=d;s[Z>>2]=(s[Z>>2]|0)+8}i=r[ee+(T*6|0)+(v*3|0)+1>>0]|0;b=i<<24>>24;m=d>>>8;if(i<<24>>24>0){i=a[29951+(b+-1)>>0]|0;d=d-(te(m,i)|0)|0;s[W>>2]=(s[W>>2]|0)+d;d=te(m,i-(a[29951+b>>0]|0)|0)|0}else d=d-(te(m,a[29951+b>>0]|0)|0)|0;s[V>>2]=d;while(1){if(d>>>0>=8388609)break;b=s[W>>2]|0;g=b>>>23;if((g|0)==255)s[K>>2]=(s[K>>2]|0)+1;else{m=b>>>31;d=s[Y>>2]|0;if((d|0)>-1){b=s[$>>2]|0;if((b+(s[X>>2]|0)|0)>>>0<(s[J>>2]|0)>>>0){s[$>>2]=b+1;r[(s[h>>2]|0)+b>>0]=d+m;d=0}else d=-1;s[Q>>2]=s[Q>>2]|d}d=s[K>>2]|0;if(d|0){m=m+255&255;do{b=s[$>>2]|0;if((b+(s[X>>2]|0)|0)>>>0<(s[J>>2]|0)>>>0){s[$>>2]=b+1;r[(s[h>>2]|0)+b>>0]=m;b=0;d=s[K>>2]|0}else b=-1;s[Q>>2]=s[Q>>2]|b;d=d+-1|0;s[K>>2]=d}while((d|0)!=0)}s[Y>>2]=g&255;b=s[W>>2]|0;d=s[V>>2]|0}s[W>>2]=b<<8&2147483392;d=d<<8;s[V>>2]=d;s[Z>>2]=(s[Z>>2]|0)+8}v=v+1|0}if(s[E>>2]|0)break;i=r[A>>0]|0;b=i<<24>>24;m=d>>>8;if(i<<24>>24>0){i=a[29916+(b+-1)>>0]|0;d=d-(te(m,i)|0)|0;s[W>>2]=(s[W>>2]|0)+d;d=te(m,i-(a[29916+b>>0]|0)|0)|0}else d=d-(te(m,a[29916+b>>0]|0)|0)|0;s[V>>2]=d;while(1){if(d>>>0>=8388609)break e;b=s[W>>2]|0;g=b>>>23;if((g|0)==255)s[K>>2]=(s[K>>2]|0)+1;else{m=b>>>31;b=s[Y>>2]|0;if((b|0)>-1){d=s[$>>2]|0;if((d+(s[X>>2]|0)|0)>>>0<(s[J>>2]|0)>>>0){s[$>>2]=d+1;r[(s[h>>2]|0)+d>>0]=b+m;d=0}else d=-1;s[Q>>2]=s[Q>>2]|d}d=s[K>>2]|0;if(d|0){m=m+255&255;do{b=s[$>>2]|0;if((b+(s[X>>2]|0)|0)>>>0<(s[J>>2]|0)>>>0){s[$>>2]=b+1;r[(s[h>>2]|0)+b>>0]=m;b=0;d=s[K>>2]|0}else b=-1;s[Q>>2]=s[Q>>2]|b;d=d+-1|0;s[K>>2]=d}while((d|0)!=0)}s[Y>>2]=g&255;b=s[W>>2]|0;d=s[V>>2]|0}s[W>>2]=b<<8&2147483392;d=d<<8;s[V>>2]=d;s[Z>>2]=(s[Z>>2]|0)+8}}while(0);if(S?(s[$e+(_*10156|0)+4816+(M<<2)>>2]|0)!=0:0)d=2;else d=0;Di($e+(_*10156|0)|0,h,T,1,d);Li(h,r[$e+(_*10156|0)+6192+(T*36|0)+29>>0]|0,r[$e+(_*10156|0)+6192+(T*36|0)+30>>0]|0,$e+(_*10156|0)+6300+(T*320|0)|0,s[$e+(_*10156|0)+4676>>2]|0);d=s[at>>2]|0}_=_+1|0}T=T+1|0}while(1){if((b|0)>=(d|0))break;d=$e+(b*10156|0)+4816|0;s[d>>2]=0;s[d+4>>2]=0;s[d+8>>2]=0;d=s[at>>2]|0;b=b+1|0}s[se>>2]=(s[Z>>2]|0)+((re(s[V>>2]|0)|0)+-32)}if((r[ae>>0]|0)==2){d=te(s[Ye>>2]|0,65536e3)|0;d=(d|0)/(s[oe>>2]|0)|0;g=re(d|0)|0;b=24-g|0;m=0-b|0;do if(b)if((b|0)<0){d=d<>>(b+32|0);break}else{d=d<<32-b|d>>>b;break}while(0);S=d&127;S=S+(((te(S,128-S|0)|0)*179|0)>>>16)+(31-g<<7)|0;T=s[fe>>2]|0;i=0-T<<2;T=T<<16>>16;M=te(i>>16,T)|0;T=te(i&65532,T)|0;i=(S<<16)+-183762944>>16;i=S+-2048+((te(M+(T>>16)>>16,i)|0)+((te(M+(T>>>16)&65535,i)|0)>>16))|0;T=s[he>>2]|0;i=i-(T>>8)|0;i=(i|0)<0?i*3|0:i;i=te(s[ce>>2]<<16>>16,(i|0)>51?51:((i|0)<-51?-51:i)<<16>>16)|0;i=T+(((i>>16)*6554|0)+(((i&65535)*6554|0)>>>16))|0;s[he>>2]=(i|0)>217856?217856:(i|0)<193536?193536:i}g=s[le>>2]|0;b=s[it>>2]|0;d=(te(g,b)|0)/1e3|0;if(Je)d=d-(s[se>>2]|0)|0;m=(d|0)/(s[Ze>>2]|0)|0;d=te(m<<16>>16,(b|0)==10?100:50)|0;d=d-(s[ue>>2]<<1)|0;do if(Je){b=s[nt>>2]|0;if((b|0)<=0)break;i=(s[Z>>2]|0)+((re(s[V>>2]|0)|0)+-32)|0;d=d-(i-(s[se>>2]|0)-(te(m,b)|0)<<1)|0}while(0);do if((g|0)>5e3){if((d|0)>(g|0))break;g=(d|0)<5e3?5e3:d}else{if((d|0)>5e3){g=5e3;break}g=(d|0)<(g|0)?g:d}while(0);e:do if((s[at>>2]|0)==2){d=s[nt>>2]|0;Ui(de,pe,be,ee+(d*6|0)|0,ne+d|0,st,g,s[ce>>2]|0,s[He>>2]|0,s[Ye>>2]|0,s[L>>2]|0);d=s[nt>>2]|0;do if(!(r[ne+d>>0]|0)){if((s[me>>2]|0)==1){s[we>>2]=0;s[we+4>>2]=0;s[we+8>>2]=0;i=ve;s[i>>2]=0;s[i+4>>2]=0;kn(ge|0,0,4480)|0;s[_e>>2]=100;s[ye>>2]=100;r[we>>0]=10;r[ke>>0]=0;s[Ee>>2]=65536;s[Ae>>2]=1}Er(Se,Me);if((s[Te>>2]|0)>=13){s[xe>>2]=0;s[Ce>>2]=0;r[Re>>0]=1;r[(s[rt>>2]|0)+(Se+4812)>>0]=1;break}r[Re>>0]=0;d=s[xe>>2]|0;i=d+1|0;s[xe>>2]=i;do if((i|0)<10)s[Ce>>2]=0;else{if((d|0)<=29)break;s[xe>>2]=10;s[Ce>>2]=0}while(0);r[(s[rt>>2]|0)+(Se+4812)>>0]=0}else r[Ie+d>>0]=0;while(0);if(!Je)break;y=s[nt>>2]|0;d=((r[ee+(y*6|0)+2>>0]|0)*5|0)+(r[ee+(y*6|0)+5>>0]|0)|0;b=s[V>>2]|0;m=b>>>8;if((d|0)>0){i=a[29891+(d+-1)>>0]|0;T=b-(te(m,i)|0)|0;s[W>>2]=(s[W>>2]|0)+T;d=te(m,i-(a[29891+d>>0]|0)|0)|0}else d=b-(te(m,a[29891+d>>0]|0)|0)|0;s[V>>2]=d;while(1){if(d>>>0>=8388609){m=d;_=0;break}b=s[W>>2]|0;v=b>>>23;if((v|0)==255)s[K>>2]=(s[K>>2]|0)+1;else{m=b>>>31;d=s[Y>>2]|0;if((d|0)>-1){b=s[$>>2]|0;if((b+(s[X>>2]|0)|0)>>>0<(s[J>>2]|0)>>>0){s[$>>2]=b+1;r[(s[h>>2]|0)+b>>0]=d+m;d=0}else d=-1;s[Q>>2]=s[Q>>2]|d}d=s[K>>2]|0;if(d|0){m=m+255&255;do{b=s[$>>2]|0;if((b+(s[X>>2]|0)|0)>>>0<(s[J>>2]|0)>>>0){s[$>>2]=b+1;r[(s[h>>2]|0)+b>>0]=m;b=0;d=s[K>>2]|0}else b=-1;s[Q>>2]=s[Q>>2]|b;d=d+-1|0;s[K>>2]=d}while((d|0)!=0)}s[Y>>2]=v&255;b=s[W>>2]|0;d=s[V>>2]|0}s[W>>2]=b<<8&2147483392;d=d<<8;s[V>>2]=d;s[Z>>2]=(s[Z>>2]|0)+8}while(1){if((_|0)==2)break;i=r[ee+(y*6|0)+(_*3|0)>>0]|0;d=i<<24>>24;b=m>>>8;if(i<<24>>24>0){i=a[29944+(d+-1)>>0]|0;T=m-(te(b,i)|0)|0;s[W>>2]=(s[W>>2]|0)+T;d=te(b,i-(a[29944+d>>0]|0)|0)|0}else d=m-(te(b,a[29944+d>>0]|0)|0)|0;s[V>>2]=d;while(1){if(d>>>0>=8388609)break;b=s[W>>2]|0;v=b>>>23;if((v|0)==255)s[K>>2]=(s[K>>2]|0)+1;else{m=b>>>31;d=s[Y>>2]|0;if((d|0)>-1){b=s[$>>2]|0;if((b+(s[X>>2]|0)|0)>>>0<(s[J>>2]|0)>>>0){s[$>>2]=b+1;r[(s[h>>2]|0)+b>>0]=d+m;d=0}else d=-1;s[Q>>2]=s[Q>>2]|d}d=s[K>>2]|0;if(d|0){m=m+255&255;do{b=s[$>>2]|0;if((b+(s[X>>2]|0)|0)>>>0<(s[J>>2]|0)>>>0){s[$>>2]=b+1;r[(s[h>>2]|0)+b>>0]=m;b=0;d=s[K>>2]|0}else b=-1;s[Q>>2]=s[Q>>2]|b;d=d+-1|0;s[K>>2]=d}while((d|0)!=0)}s[Y>>2]=v&255;b=s[W>>2]|0;d=s[V>>2]|0}s[W>>2]=b<<8&2147483392;d=d<<8;s[V>>2]=d;s[Z>>2]=(s[Z>>2]|0)+8}i=r[ee+(y*6|0)+(_*3|0)+1>>0]|0;b=i<<24>>24;m=d>>>8;if(i<<24>>24>0){i=a[29951+(b+-1)>>0]|0;d=d-(te(m,i)|0)|0;s[W>>2]=(s[W>>2]|0)+d;d=te(m,i-(a[29951+b>>0]|0)|0)|0}else d=d-(te(m,a[29951+b>>0]|0)|0)|0;s[V>>2]=d;while(1){if(d>>>0>=8388609)break;b=s[W>>2]|0;v=b>>>23;if((v|0)==255)s[K>>2]=(s[K>>2]|0)+1;else{m=b>>>31;d=s[Y>>2]|0;if((d|0)>-1){b=s[$>>2]|0;if((b+(s[X>>2]|0)|0)>>>0<(s[J>>2]|0)>>>0){s[$>>2]=b+1;r[(s[h>>2]|0)+b>>0]=d+m;d=0}else d=-1;s[Q>>2]=s[Q>>2]|d}d=s[K>>2]|0;if(d|0){m=m+255&255;do{b=s[$>>2]|0;if((b+(s[X>>2]|0)|0)>>>0<(s[J>>2]|0)>>>0){s[$>>2]=b+1;r[(s[h>>2]|0)+b>>0]=m;b=0;d=s[K>>2]|0}else b=-1;s[Q>>2]=s[Q>>2]|b;d=d+-1|0;s[K>>2]=d}while((d|0)!=0)}s[Y>>2]=v&255;b=s[W>>2]|0;d=s[V>>2]|0}s[W>>2]=b<<8&2147483392;d=d<<8;s[V>>2]=d;s[Z>>2]=(s[Z>>2]|0)+8}m=d;_=_+1|0}d=s[nt>>2]|0;if(r[Ie+d>>0]|0)break;i=r[ne+d>>0]|0;d=i<<24>>24;b=m>>>8;if(i<<24>>24>0){i=a[29916+(d+-1)>>0]|0;T=m-(te(b,i)|0)|0;s[W>>2]=(s[W>>2]|0)+T;d=te(b,i-(a[29916+d>>0]|0)|0)|0}else d=m-(te(b,a[29916+d>>0]|0)|0)|0;s[V>>2]=d;while(1){if(d>>>0>=8388609)break e;b=s[W>>2]|0;v=b>>>23;if((v|0)==255)s[K>>2]=(s[K>>2]|0)+1;else{m=b>>>31;d=s[Y>>2]|0;if((d|0)>-1){b=s[$>>2]|0;if((b+(s[X>>2]|0)|0)>>>0<(s[J>>2]|0)>>>0){s[$>>2]=b+1;r[(s[h>>2]|0)+b>>0]=d+m;d=0}else d=-1;s[Q>>2]=s[Q>>2]|d}d=s[K>>2]|0;if(d|0){m=m+255&255;do{b=s[$>>2]|0;if((b+(s[X>>2]|0)|0)>>>0<(s[J>>2]|0)>>>0){s[$>>2]=b+1;r[(s[h>>2]|0)+b>>0]=m;b=0;d=s[K>>2]|0}else b=-1;s[Q>>2]=s[Q>>2]|b;d=d+-1|0;s[K>>2]=d}while((d|0)!=0)}s[Y>>2]=v&255;b=s[W>>2]|0;d=s[V>>2]|0}s[W>>2]=b<<8&2147483392;d=d<<8;s[V>>2]=d;s[Z>>2]=(s[Z>>2]|0)+8}}else{s[F>>2]=s[Fe>>2];i=F+(s[L>>2]<<1)|0;i=o[i>>1]|o[i+2>>1]<<16;n[Fe>>1]=i;n[Fe+2>>1]=i>>>16}while(0);Er(e,Pe);if((s[ce>>2]|0)<13){r[Ve>>0]=0;d=s[Oe>>2]|0;i=d+1|0;s[Oe>>2]=i;do if((i|0)<10)s[De>>2]=0;else{if((d|0)<=29)break;s[Oe>>2]=10;s[De>>2]=0}while(0);r[(s[nt>>2]|0)+(e+4812)>>0]=0}else{s[Oe>>2]=0;s[De>>2]=0;r[Ve>>0]=1;r[(s[nt>>2]|0)+(e+4812)>>0]=1}y=(I|0)==0;k=s[Le>>2]|0;E=(I|0)==(Ue|0);A=(I|0)==1;S=0;while(1){d=s[at>>2]|0;if((S|0)>=(d|0))break;b=s[Ke>>2]|0;e:do switch(Xe|0){case 2:{if(!y){m=b;break e}m=(b*3|0)/5|0;break}case 3:{if(y){m=(b<<1|0)/5|0;break e}if(!A){m=b;break e}m=(b*3|0)/4|0;break}default:m=b}while(0);v=E&(s[et>>2]|0)!=0&1;do if((d|0)==1){d=g;_=v}else{d=s[st+(S<<2)>>2]|0;if((S|0)!=0|(k|0)<1){_=v;break}m=m-((b|0)/(Be|0)|0)|0;_=0}while(0);if((d|0)>0){p=(d|0)>8e4?8e4:(d|0)<5e3?5e3:d;d=$e+(S*10156|0)+4700|0;e:do if((p|0)!=(s[d>>2]|0)){s[d>>2]=p;v=s[$e+(S*10156|0)+4668>>2]|0;v=(v|0)==8?17424:(v|0)==12?17456:17488;d=(s[$e+(S*10156|0)+4672>>2]|0)==2?p+-2200|0:p;b=1;while(1){if((b|0)>=8)break e;p=s[v+(b<<2)>>2]|0;if((d|0)<=(p|0))break;b=b+1|0}i=b+-1|0;T=s[v+(i<<2)>>2]|0;i=n[25356+(i<<1)>>1]|0;s[$e+(S*10156|0)+4808>>2]=(i<<6)+(te((d-T<<6|0)/(p-T|0)|0,(n[25356+(b<<1)>>1]|0)-i|0)|0)}while(0);do if((s[nt>>2]|0)>(S|0)){if((S|0)>0?s[me>>2]|0:0){d=1;break}d=2}else d=0;while(0);p=Xi($e+(S*10156|0)|0,c,h,d,m,_)|0}s[$e+(S*10156|0)+4760>>2]=0;s[$e+(S*10156|0)+5832>>2]=0;i=$e+(S*10156|0)+5840|0;s[i>>2]=(s[i>>2]|0)+1;S=S+1|0}m=s[nt>>2]|0;s[me>>2]=r[ne+(m+-1)>>0];do if((s[c>>2]|0)>0){if((m|0)!=(s[Ze>>2]|0))break;g=s[at>>2]|0;y=0;_=0;while(1){if((_|0)>=(g|0))break;v=s[$e+(_*10156|0)+5836>>2]|0;d=y;b=0;while(1){d=d<<1;if((b|0)>=(v|0))break;d=d|r[$e+(_*10156|0)+4812+b>>0];b=b+1|0}y=d|r[$e+(_*10156|0)+4815>>0];_=_+1|0}do if(Je){d=te(m+1|0,g)|0;b=8-d|0;m=(1<>2]|0){i=s[h>>2]|0;r[i>>0]=a[i>>0]&(m^255)|y<>2]|0;if((g|0)>-1){s[Y>>2]=g&~m|y<>2]|0)>>>0>-2147483648>>>d>>>0){s[Q>>2]=-1;break}else{s[W>>2]=s[W>>2]&~(m<<23)|y<>2]|0){if((s[at>>2]|0)!=1?(s[Ce>>2]|0)==0:0)break;s[c>>2]=0}while(0);d=(s[ue>>2]|0)+(s[c>>2]<<3)|0;s[ue>>2]=d;d=d-((te(s[le>>2]|0,s[it>>2]|0)|0)/1e3|0)|0;s[ue>>2]=(d|0)>1e4?1e4:(d|0)<0?0:d;d=s[je>>2]|0;if((s[ce>>2]|0)<(((d<<16>>16)*3188>>16)+13|0)){s[We>>2]=1;s[je>>2]=0;break}else{s[We>>2]=0;s[je>>2]=d+(s[it>>2]|0);break}}while(0);if((f|0)==(C|0)){Qe=428;break}v=R;f=x;I=I+1|0}if((Qe|0)==428)d=s[We>>2]|0;s[ze>>2]=s[at>>2];s[t+76>>2]=d;if((s[Ye>>2]|0)==16)d=(s[e+28>>2]|0)==0;else d=0;s[t+80>>2]=d&1;s[t+72>>2]=(s[Ye>>2]<<16>>16)*1e3;if(!(s[He>>2]|0))d=n[e+20340>>1]|0;else d=0;s[t+84>>2]=d;e:do if(!Je){s[it>>2]=w;s[tt>>2]=u;d=0;while(1){if((d|0)>=(s[at>>2]|0))break e;s[$e+(d*10156|0)+4760>>2]=0;s[$e+(d*10156|0)+4772>>2]=0;d=d+1|0}}while(0);s[t+92>>2]=r[Ve>>0];s[t+96>>2]=n[25404+(r[Ve>>0]>>1<<2)+(r[e+4858>>0]<<1)>>1];qe(Ge|0);e=p;l=ot;return e|0}function Di(e,t,i,o,f){e=e|0;t=t|0;i=i|0;o=o|0;f=f|0;var h=0,c=0,u=0,d=0,p=0,b=0,m=0,w=0,g=0,v=0,_=0,y=0,k=0,E=0,A=0,S=0,M=0,T=0,R=0,x=0,C=0,I=0;I=l;l=l+48|0;E=I;y=I+32|0;R=(o|0)==0;C=R?e+4828|0:e+6192+(i*36|0)|0;x=C+29|0;c=(r[x>>0]<<1)+(r[C+30>>0]|0)|0;e:do if((c|0)>1|R^1){i=c+-2|0;_=t+28|0;o=s[_>>2]|0;h=o>>>8;if((c|0)>2){R=a[29933+(c+-3)>>0]|0;T=o-(te(h,R)|0)|0;u=t+32|0;s[u>>2]=(s[u>>2]|0)+T;i=te(h,R-(a[29933+i>>0]|0)|0)|0;s[_>>2]=i}else{i=o-(te(h,a[29933+i>>0]|0)|0)|0;s[_>>2]=i;u=t+32|0}d=t+36|0;p=t+20|0;b=t+40|0;m=t+24|0;w=t+8|0;g=t+4|0;v=t+44|0;while(1){if(i>>>0>=8388609){c=i;break e}o=s[u>>2]|0;c=o>>>23;if((c|0)==255)s[d>>2]=(s[d>>2]|0)+1;else{h=o>>>31;i=s[b>>2]|0;if((i|0)>-1){o=s[m>>2]|0;if((o+(s[w>>2]|0)|0)>>>0<(s[g>>2]|0)>>>0){s[m>>2]=o+1;r[(s[t>>2]|0)+o>>0]=i+h;i=0}else i=-1;s[v>>2]=s[v>>2]|i}i=s[d>>2]|0;if(i|0){h=h+255&255;do{o=s[m>>2]|0;if((o+(s[w>>2]|0)|0)>>>0<(s[g>>2]|0)>>>0){s[m>>2]=o+1;r[(s[t>>2]|0)+o>>0]=h;o=0;i=s[d>>2]|0}else o=-1;s[v>>2]=s[v>>2]|o;i=i+-1|0;s[d>>2]=i}while((i|0)!=0)}s[b>>2]=c&255;o=s[u>>2]|0;i=s[_>>2]|0}s[u>>2]=o<<8&2147483392;i=i<<8;s[_>>2]=i;s[p>>2]=(s[p>>2]|0)+8}}else{_=t+28|0;i=s[_>>2]|0;o=i>>>8;if((c|0)>0){R=a[29937+(c+-1)>>0]|0;i=i-(te(o,R)|0)|0;u=t+32|0;s[u>>2]=(s[u>>2]|0)+i;i=te(o,R-(a[29937+c>>0]|0)|0)|0;s[_>>2]=i}else{i=i-(te(o,a[29937+c>>0]|0)|0)|0;s[_>>2]=i;u=t+32|0}d=t+36|0;p=t+20|0;b=t+40|0;m=t+24|0;w=t+8|0;g=t+4|0;v=t+44|0;while(1){if(i>>>0>=8388609){c=i;break e}o=s[u>>2]|0;c=o>>>23;if((c|0)==255)s[d>>2]=(s[d>>2]|0)+1;else{h=o>>>31;i=s[b>>2]|0;if((i|0)>-1){o=s[m>>2]|0;if((o+(s[w>>2]|0)|0)>>>0<(s[g>>2]|0)>>>0){s[m>>2]=o+1;r[(s[t>>2]|0)+o>>0]=i+h;i=0}else i=-1;s[v>>2]=s[v>>2]|i}i=s[d>>2]|0;if(i|0){h=h+255&255;do{o=s[m>>2]|0;if((o+(s[w>>2]|0)|0)>>>0<(s[g>>2]|0)>>>0){s[m>>2]=o+1;r[(s[t>>2]|0)+o>>0]=h;o=0;i=s[d>>2]|0}else o=-1;s[v>>2]=s[v>>2]|o;i=i+-1|0;s[d>>2]=i}while((i|0)!=0)}s[b>>2]=c&255;o=s[u>>2]|0;i=s[_>>2]|0}s[u>>2]=o<<8&2147483392;i=i<<8;s[_>>2]=i;s[p>>2]=(s[p>>2]|0)+8}}while(0);k=(f|0)==2;i=r[C>>0]|0;o=i<<24>>24;e:do if(k){b=t+28|0;h=c>>>8;if(i<<24>>24>0){i=a[29396+(o+-1)>>0]|0;R=c-(te(h,i)|0)|0;u=t+32|0;s[u>>2]=(s[u>>2]|0)+R;i=te(h,i-(a[29396+o>>0]|0)|0)|0;s[b>>2]=i}else{i=c-(te(h,a[29396+o>>0]|0)|0)|0;s[b>>2]=i;u=t+32|0}d=t+36|0;p=t+20|0;m=t+40|0;w=t+24|0;g=t+8|0;v=t+4|0;_=t+44|0;while(1){if(i>>>0>=8388609){R=u;T=d;M=v;break e}o=s[u>>2]|0;c=o>>>23;if((c|0)==255)s[d>>2]=(s[d>>2]|0)+1;else{h=o>>>31;i=s[m>>2]|0;if((i|0)>-1){o=s[w>>2]|0;if((o+(s[g>>2]|0)|0)>>>0<(s[v>>2]|0)>>>0){s[w>>2]=o+1;r[(s[t>>2]|0)+o>>0]=i+h;i=0}else i=-1;s[_>>2]=s[_>>2]|i}i=s[d>>2]|0;if(i|0){h=h+255&255;do{o=s[w>>2]|0;if((o+(s[g>>2]|0)|0)>>>0<(s[v>>2]|0)>>>0){s[w>>2]=o+1;r[(s[t>>2]|0)+o>>0]=h;o=0;i=s[d>>2]|0}else o=-1;s[_>>2]=s[_>>2]|o;i=i+-1|0;s[d>>2]=i}while((i|0)!=0)}s[m>>2]=c&255;o=s[u>>2]|0;i=s[b>>2]|0}s[u>>2]=o<<8&2147483392;i=i<<8;s[b>>2]=i;s[p>>2]=(s[p>>2]|0)+8}}else{i=o>>3;o=r[x>>0]|0;b=t+28|0;h=c>>>8;if((i|0)>0){R=a[i+-1+(29372+(o<<3))>>0]|0;T=c-(te(h,R)|0)|0;u=t+32|0;s[u>>2]=(s[u>>2]|0)+T;i=te(h,R-(a[29372+(o<<3)+i>>0]|0)|0)|0;s[b>>2]=i}else{i=c-(te(h,a[29372+(o<<3)+i>>0]|0)|0)|0;s[b>>2]=i;u=t+32|0}d=t+36|0;p=t+20|0;m=t+40|0;w=t+24|0;g=t+8|0;v=t+4|0;_=t+44|0;while(1){if(i>>>0>=8388609)break;o=s[u>>2]|0;c=o>>>23;if((c|0)==255)s[d>>2]=(s[d>>2]|0)+1;else{h=o>>>31;i=s[m>>2]|0;if((i|0)>-1){o=s[w>>2]|0;if((o+(s[g>>2]|0)|0)>>>0<(s[v>>2]|0)>>>0){s[w>>2]=o+1;r[(s[t>>2]|0)+o>>0]=i+h;i=0}else i=-1;s[_>>2]=s[_>>2]|i}i=s[d>>2]|0;if(i|0){h=h+255&255;do{o=s[w>>2]|0;if((o+(s[g>>2]|0)|0)>>>0<(s[v>>2]|0)>>>0){s[w>>2]=o+1;r[(s[t>>2]|0)+o>>0]=h; +o=0;i=s[d>>2]|0}else o=-1;s[_>>2]=s[_>>2]|o;i=i+-1|0;s[d>>2]=i}while((i|0)!=0)}s[m>>2]=c&255;o=s[u>>2]|0;i=s[b>>2]|0}s[u>>2]=o<<8&2147483392;i=i<<8;s[b>>2]=i;s[p>>2]=(s[p>>2]|0)+8}o=a[C>>0]&7;h=i>>>8;c=r[29962+o>>0]|0;if(!o)i=i-(te(h,c&255)|0)|0;else{R=a[29962+(o+-1)>>0]|0;i=i-(te(h,R)|0)|0;s[u>>2]=(s[u>>2]|0)+i;i=te(h,R-(c&255)|0)|0}s[b>>2]=i;while(1){if(i>>>0>=8388609){R=u;T=d;M=v;break e}o=s[u>>2]|0;c=o>>>23;if((c|0)==255)s[d>>2]=(s[d>>2]|0)+1;else{h=o>>>31;i=s[m>>2]|0;if((i|0)>-1){o=s[w>>2]|0;if((o+(s[g>>2]|0)|0)>>>0<(s[v>>2]|0)>>>0){s[w>>2]=o+1;r[(s[t>>2]|0)+o>>0]=i+h;i=0}else i=-1;s[_>>2]=s[_>>2]|i}i=s[d>>2]|0;if(i|0){h=h+255&255;do{o=s[w>>2]|0;if((o+(s[g>>2]|0)|0)>>>0<(s[v>>2]|0)>>>0){s[w>>2]=o+1;r[(s[t>>2]|0)+o>>0]=h;o=0;i=s[d>>2]|0}else o=-1;s[_>>2]=s[_>>2]|o;i=i+-1|0;s[d>>2]=i}while((i|0)!=0)}s[m>>2]=c&255;o=s[u>>2]|0;i=s[b>>2]|0}s[u>>2]=o<<8&2147483392;i=i<<8;s[b>>2]=i;s[p>>2]=(s[p>>2]|0)+8}}while(0);A=e+4672|0;u=1;while(1){if((u|0)>=(s[A>>2]|0))break;v=r[C+u>>0]|0;o=v<<24>>24;h=i>>>8;if(v<<24>>24>0){v=a[29396+(o+-1)>>0]|0;i=i-(te(h,v)|0)|0;s[R>>2]=(s[R>>2]|0)+i;i=te(h,v-(a[29396+o>>0]|0)|0)|0}else i=i-(te(h,a[29396+o>>0]|0)|0)|0;s[b>>2]=i;while(1){if(i>>>0>=8388609)break;o=s[R>>2]|0;c=o>>>23;if((c|0)==255)s[T>>2]=(s[T>>2]|0)+1;else{h=o>>>31;i=s[m>>2]|0;if((i|0)>-1){o=s[w>>2]|0;if((o+(s[g>>2]|0)|0)>>>0<(s[M>>2]|0)>>>0){s[w>>2]=o+1;r[(s[t>>2]|0)+o>>0]=i+h;i=0}else i=-1;s[_>>2]=s[_>>2]|i}i=s[T>>2]|0;if(i|0){h=h+255&255;do{o=s[w>>2]|0;if((o+(s[g>>2]|0)|0)>>>0<(s[M>>2]|0)>>>0){s[w>>2]=o+1;r[(s[t>>2]|0)+o>>0]=h;o=0;i=s[T>>2]|0}else o=-1;s[_>>2]=s[_>>2]|o;i=i+-1|0;s[T>>2]=i}while((i|0)!=0)}s[m>>2]=c&255;o=s[R>>2]|0;i=s[b>>2]|0}s[R>>2]=o<<8&2147483392;i=i<<8;s[b>>2]=i;s[p>>2]=(s[p>>2]|0)+8}u=u+1|0}u=C+8|0;d=r[u>>0]|0;o=d<<24>>24;v=e+4784|0;c=s[v>>2]|0;h=te(r[x>>0]>>1,n[c>>1]|0)|0;h=(s[c+16>>2]|0)+h|0;c=i>>>8;if(d<<24>>24>0){d=h+(o+-1)|0;i=i-(te(c,a[d>>0]|0)|0)|0;s[R>>2]=(s[R>>2]|0)+i;i=te(c,(a[d>>0]|0)-(a[h+o>>0]|0)|0)|0}else i=i-(te(c,a[h+o>>0]|0)|0)|0;s[b>>2]=i;while(1){if(i>>>0>=8388609)break;o=s[R>>2]|0;c=o>>>23;if((c|0)==255)s[T>>2]=(s[T>>2]|0)+1;else{h=o>>>31;i=s[m>>2]|0;if((i|0)>-1){o=s[w>>2]|0;if((o+(s[g>>2]|0)|0)>>>0<(s[M>>2]|0)>>>0){s[w>>2]=o+1;r[(s[t>>2]|0)+o>>0]=i+h;i=0}else i=-1;s[_>>2]=s[_>>2]|i}i=s[T>>2]|0;if(i|0){h=h+255&255;do{o=s[w>>2]|0;if((o+(s[g>>2]|0)|0)>>>0<(s[M>>2]|0)>>>0){s[w>>2]=o+1;r[(s[t>>2]|0)+o>>0]=h;o=0;i=s[T>>2]|0}else o=-1;s[_>>2]=s[_>>2]|o;i=i+-1|0;s[T>>2]=i}while((i|0)!=0)}s[m>>2]=c&255;o=s[R>>2]|0;i=s[b>>2]|0}s[R>>2]=o<<8&2147483392;i=i<<8;s[b>>2]=i;s[p>>2]=(s[p>>2]|0)+8}Bi(E,y,s[v>>2]|0,r[u>>0]|0);h=0;e:while(1){i=s[v>>2]|0;if((h|0)>=(n[i+2>>1]|0))break;d=h+1|0;u=C+8+d|0;o=r[u>>0]|0;if(o<<24>>24>3){i=(s[i+28>>2]|0)+(n[E+(h<<1)>>1]|0)|0;o=s[b>>2]|0;c=o>>>8;y=i+7|0;o=o-(te(c,a[y>>0]|0)|0)|0;o=(s[R>>2]|0)+o|0;s[R>>2]=o;i=te(c,(a[y>>0]|0)-(a[i+8>>0]|0)|0)|0;s[b>>2]=i;while(1){if(i>>>0>=8388609)break;c=o>>>23;if((c|0)==255)s[T>>2]=(s[T>>2]|0)+1;else{h=o>>>31;i=s[m>>2]|0;if((i|0)>-1){o=s[w>>2]|0;if((o+(s[g>>2]|0)|0)>>>0<(s[M>>2]|0)>>>0){s[w>>2]=o+1;r[(s[t>>2]|0)+o>>0]=i+h;i=0}else i=-1;s[_>>2]=s[_>>2]|i}i=s[T>>2]|0;if(i|0){h=h+255&255;do{o=s[w>>2]|0;if((o+(s[g>>2]|0)|0)>>>0<(s[M>>2]|0)>>>0){s[w>>2]=o+1;r[(s[t>>2]|0)+o>>0]=h;o=0;i=s[T>>2]|0}else o=-1;s[_>>2]=s[_>>2]|o;i=i+-1|0;s[T>>2]=i}while((i|0)!=0)}s[m>>2]=c&255;o=s[R>>2]|0;i=s[b>>2]|0}o=o<<8&2147483392;s[R>>2]=o;i=i<<8;s[b>>2]=i;s[p>>2]=(s[p>>2]|0)+8}y=r[u>>0]|0;h=y<<24>>24;c=h+-4|0;u=i>>>8;if(y<<24>>24>4){y=a[29970+(h+-5)>>0]|0;o=o+(i-(te(u,y)|0))|0;s[R>>2]=o;i=te(u,y-(a[29970+c>>0]|0)|0)|0}else i=i-(te(u,a[29970+c>>0]|0)|0)|0;s[b>>2]=i;while(1){if(i>>>0>=8388609){h=d;continue e}c=o>>>23;if((c|0)==255)s[T>>2]=(s[T>>2]|0)+1;else{h=o>>>31;i=s[m>>2]|0;if((i|0)>-1){o=s[w>>2]|0;if((o+(s[g>>2]|0)|0)>>>0<(s[M>>2]|0)>>>0){s[w>>2]=o+1;r[(s[t>>2]|0)+o>>0]=i+h;i=0}else i=-1;s[_>>2]=s[_>>2]|i}i=s[T>>2]|0;if(i|0){h=h+255&255;do{o=s[w>>2]|0;if((o+(s[g>>2]|0)|0)>>>0<(s[M>>2]|0)>>>0){s[w>>2]=o+1;r[(s[t>>2]|0)+o>>0]=h;o=0;i=s[T>>2]|0}else o=-1;s[_>>2]=s[_>>2]|o;i=i+-1|0;s[T>>2]=i}while((i|0)!=0)}s[m>>2]=c&255;o=s[R>>2]|0;i=s[b>>2]|0}o=o<<8&2147483392;s[R>>2]=o;i=i<<8;s[b>>2]=i;s[p>>2]=(s[p>>2]|0)+8}}if(o<<24>>24>=-3){y=o<<24>>24;i=(s[i+28>>2]|0)+(n[E+(h<<1)>>1]|0)|0;h=s[b>>2]|0;c=h>>>8;u=i+(y+3)|0;h=h-(te(c,a[u>>0]|0)|0)|0;s[R>>2]=(s[R>>2]|0)+h;i=te(c,(a[u>>0]|0)-(a[i+(y+4)>>0]|0)|0)|0;s[b>>2]=i;while(1){if(i>>>0>=8388609){h=d;continue e}o=s[R>>2]|0;c=o>>>23;if((c|0)==255)s[T>>2]=(s[T>>2]|0)+1;else{h=o>>>31;i=s[m>>2]|0;if((i|0)>-1){o=s[w>>2]|0;if((o+(s[g>>2]|0)|0)>>>0<(s[M>>2]|0)>>>0){s[w>>2]=o+1;r[(s[t>>2]|0)+o>>0]=i+h;i=0}else i=-1;s[_>>2]=s[_>>2]|i}i=s[T>>2]|0;if(i|0){h=h+255&255;do{o=s[w>>2]|0;if((o+(s[g>>2]|0)|0)>>>0<(s[M>>2]|0)>>>0){s[w>>2]=o+1;r[(s[t>>2]|0)+o>>0]=h;o=0;i=s[T>>2]|0}else o=-1;s[_>>2]=s[_>>2]|o;i=i+-1|0;s[T>>2]=i}while((i|0)!=0)}s[m>>2]=c&255;o=s[R>>2]|0;i=s[b>>2]|0}s[R>>2]=o<<8&2147483392;i=i<<8;s[b>>2]=i;s[p>>2]=(s[p>>2]|0)+8}}y=s[b>>2]|0;i=y-(te(y>>>8,a[(s[i+28>>2]|0)+(n[E+(h<<1)>>1]|0)>>0]|0)|0)|0;s[b>>2]=i;while(1){if(i>>>0>=8388609)break;o=s[R>>2]|0;c=o>>>23;if((c|0)==255)s[T>>2]=(s[T>>2]|0)+1;else{h=o>>>31;i=s[m>>2]|0;if((i|0)>-1){o=s[w>>2]|0;if((o+(s[g>>2]|0)|0)>>>0<(s[M>>2]|0)>>>0){s[w>>2]=o+1;r[(s[t>>2]|0)+o>>0]=i+h;i=0}else i=-1;s[_>>2]=s[_>>2]|i}i=s[T>>2]|0;if(i|0){h=h+255&255;do{o=s[w>>2]|0;if((o+(s[g>>2]|0)|0)>>>0<(s[M>>2]|0)>>>0){s[w>>2]=o+1;r[(s[t>>2]|0)+o>>0]=h;o=0;i=s[T>>2]|0}else o=-1;s[_>>2]=s[_>>2]|o;i=i+-1|0;s[T>>2]=i}while((i|0)!=0)}s[m>>2]=c&255;o=s[R>>2]|0;i=s[b>>2]|0}s[R>>2]=o<<8&2147483392;i=i<<8;s[b>>2]=i;s[p>>2]=(s[p>>2]|0)+8}o=-4-(r[u>>0]|0)|0;h=i>>>8;if((o|0)>0){y=a[29970+(o+-1)>>0]|0;i=i-(te(h,y)|0)|0;s[R>>2]=(s[R>>2]|0)+i;i=te(h,y-(a[29970+o>>0]|0)|0)|0}else i=i-(te(h,a[29970+o>>0]|0)|0)|0;s[b>>2]=i;while(1){if(i>>>0>=8388609){h=d;continue e}o=s[R>>2]|0;c=o>>>23;if((c|0)==255)s[T>>2]=(s[T>>2]|0)+1;else{h=o>>>31;i=s[m>>2]|0;if((i|0)>-1){o=s[w>>2]|0;if((o+(s[g>>2]|0)|0)>>>0<(s[M>>2]|0)>>>0){s[w>>2]=o+1;r[(s[t>>2]|0)+o>>0]=i+h;i=0}else i=-1;s[_>>2]=s[_>>2]|i}i=s[T>>2]|0;if(i|0){h=h+255&255;do{o=s[w>>2]|0;if((o+(s[g>>2]|0)|0)>>>0<(s[M>>2]|0)>>>0){s[w>>2]=o+1;r[(s[t>>2]|0)+o>>0]=h;o=0;i=s[T>>2]|0}else o=-1;s[_>>2]=s[_>>2]|o;i=i+-1|0;s[T>>2]=i}while((i|0)!=0)}s[m>>2]=c&255;o=s[R>>2]|0;i=s[b>>2]|0}s[R>>2]=o<<8&2147483392;i=i<<8;s[b>>2]=i;s[p>>2]=(s[p>>2]|0)+8}}e:do if((s[A>>2]|0)==4){E=r[C+31>>0]|0;i=E<<24>>24;o=s[b>>2]|0;h=o>>>8;if(E<<24>>24>0){E=a[29939+(i+-1)>>0]|0;y=o-(te(h,E)|0)|0;s[R>>2]=(s[R>>2]|0)+y;i=te(h,E-(a[29939+i>>0]|0)|0)|0}else i=o-(te(h,a[29939+i>>0]|0)|0)|0;s[b>>2]=i;while(1){if(i>>>0>=8388609)break e;o=s[R>>2]|0;c=o>>>23;if((c|0)==255)s[T>>2]=(s[T>>2]|0)+1;else{h=o>>>31;i=s[m>>2]|0;if((i|0)>-1){o=s[w>>2]|0;if((o+(s[g>>2]|0)|0)>>>0<(s[M>>2]|0)>>>0){s[w>>2]=o+1;r[(s[t>>2]|0)+o>>0]=i+h;i=0}else i=-1;s[_>>2]=s[_>>2]|i}i=s[T>>2]|0;if(i|0){h=h+255&255;do{o=s[w>>2]|0;if((o+(s[g>>2]|0)|0)>>>0<(s[M>>2]|0)>>>0){s[w>>2]=o+1;r[(s[t>>2]|0)+o>>0]=h;o=0;i=s[T>>2]|0}else o=-1;s[_>>2]=s[_>>2]|o;i=i+-1|0;s[T>>2]=i}while((i|0)!=0)}s[m>>2]=c&255;o=s[R>>2]|0;i=s[b>>2]|0}s[R>>2]=o<<8&2147483392;i=i<<8;s[b>>2]=i;s[p>>2]=(s[p>>2]|0)+8}}while(0);e:do if((r[x>>0]|0)==2){if(k?(s[e+5860>>2]|0)==2:0){o=C+26|0;i=e+5864|0;h=(n[o>>1]|0)-(n[i>>1]|0)|0;if((h+8|0)>>>0<=19){d=h+9|0;c=s[b>>2]|0;u=c>>>8;if((h|0)>-9){h=a[30009+(h+8)>>0]|0;v=c-(te(u,h)|0)|0;s[R>>2]=(s[R>>2]|0)+v;v=0;h=te(u,h-(a[30009+d>>0]|0)|0)|0}else{h=0;S=243}}else{c=s[b>>2]|0;u=c>>>8;d=0;h=1;S=243}if((S|0)==243){v=h;h=c-(te(u,a[30009+d>>0]|0)|0)|0}s[b>>2]=h;while(1){if(h>>>0>=8388609)break;c=s[R>>2]|0;d=c>>>23;if((d|0)==255)s[T>>2]=(s[T>>2]|0)+1;else{u=c>>>31;h=s[m>>2]|0;if((h|0)>-1){c=s[w>>2]|0;if((c+(s[g>>2]|0)|0)>>>0<(s[M>>2]|0)>>>0){s[w>>2]=c+1;r[(s[t>>2]|0)+c>>0]=h+u;h=0}else h=-1;s[_>>2]=s[_>>2]|h}h=s[T>>2]|0;if(h|0){u=u+255&255;do{c=s[w>>2]|0;if((c+(s[g>>2]|0)|0)>>>0<(s[M>>2]|0)>>>0){s[w>>2]=c+1;r[(s[t>>2]|0)+c>>0]=u;c=0;h=s[T>>2]|0}else c=-1;s[_>>2]=s[_>>2]|c;h=h+-1|0;s[T>>2]=h}while((h|0)!=0)}s[m>>2]=d&255;c=s[R>>2]|0;h=s[b>>2]|0}s[R>>2]=c<<8&2147483392;h=h<<8;s[b>>2]=h;s[p>>2]=(s[p>>2]|0)+8}if(v)S=260}else S=260;if((S|0)==260){o=C+26|0;h=n[o>>1]|0;d=s[e+4668>>2]|0;i=(h|0)/(d>>1|0)|0;d=h-(te(i<<16>>16,d<<15>>16)|0)|0;h=s[b>>2]|0;c=h>>>8;if((i|0)>0){S=a[29977+(i+-1)>>0]|0;E=h-(te(c,S)|0)|0;s[R>>2]=(s[R>>2]|0)+E;i=te(c,S-(a[29977+i>>0]|0)|0)|0}else i=h-(te(c,a[29977+i>>0]|0)|0)|0;s[b>>2]=i;while(1){if(i>>>0>=8388609)break;h=s[R>>2]|0;u=h>>>23;if((u|0)==255)s[T>>2]=(s[T>>2]|0)+1;else{c=h>>>31;i=s[m>>2]|0;if((i|0)>-1){h=s[w>>2]|0;if((h+(s[g>>2]|0)|0)>>>0<(s[M>>2]|0)>>>0){s[w>>2]=h+1;r[(s[t>>2]|0)+h>>0]=i+c;i=0}else i=-1;s[_>>2]=s[_>>2]|i}i=s[T>>2]|0;if(i|0){c=c+255&255;do{h=s[w>>2]|0;if((h+(s[g>>2]|0)|0)>>>0<(s[M>>2]|0)>>>0){s[w>>2]=h+1;r[(s[t>>2]|0)+h>>0]=c;h=0;i=s[T>>2]|0}else h=-1;s[_>>2]=s[_>>2]|h;i=i+-1|0;s[T>>2]=i}while((i|0)!=0)}s[m>>2]=u&255;h=s[R>>2]|0;i=s[b>>2]|0}s[R>>2]=h<<8&2147483392;i=i<<8;s[b>>2]=i;s[p>>2]=(s[p>>2]|0)+8}h=s[e+4776>>2]|0;c=i>>>8;if((d|0)>0){S=h+(d+-1)|0;i=i-(te(c,a[S>>0]|0)|0)|0;s[R>>2]=(s[R>>2]|0)+i;i=te(c,(a[S>>0]|0)-(a[h+d>>0]|0)|0)|0}else i=i-(te(c,a[h+d>>0]|0)|0)|0;s[b>>2]=i;while(1){if(i>>>0>=8388609)break;h=s[R>>2]|0;u=h>>>23;if((u|0)==255)s[T>>2]=(s[T>>2]|0)+1;else{c=h>>>31;i=s[m>>2]|0;if((i|0)>-1){h=s[w>>2]|0;if((h+(s[g>>2]|0)|0)>>>0<(s[M>>2]|0)>>>0){s[w>>2]=h+1;r[(s[t>>2]|0)+h>>0]=i+c;i=0}else i=-1;s[_>>2]=s[_>>2]|i}i=s[T>>2]|0;if(i|0){c=c+255&255;do{h=s[w>>2]|0;if((h+(s[g>>2]|0)|0)>>>0<(s[M>>2]|0)>>>0){s[w>>2]=h+1;r[(s[t>>2]|0)+h>>0]=c;h=0;i=s[T>>2]|0}else h=-1;s[_>>2]=s[_>>2]|h;i=i+-1|0;s[T>>2]=i}while((i|0)!=0)}s[m>>2]=u&255;h=s[R>>2]|0;i=s[b>>2]|0}s[R>>2]=h<<8&2147483392;i=i<<8;s[b>>2]=i;s[p>>2]=(s[p>>2]|0)+8}i=e+5864|0}n[i>>1]=n[o>>1]|0;S=r[C+28>>0]|0;i=S<<24>>24;o=s[e+4780>>2]|0;h=s[b>>2]|0;c=h>>>8;if(S<<24>>24>0){S=o+(i+-1)|0;E=h-(te(c,a[S>>0]|0)|0)|0;s[R>>2]=(s[R>>2]|0)+E;i=te(c,(a[S>>0]|0)-(a[o+i>>0]|0)|0)|0}else i=h-(te(c,a[o+i>>0]|0)|0)|0;s[b>>2]=i;while(1){if(i>>>0>=8388609)break;o=s[R>>2]|0;c=o>>>23;if((c|0)==255)s[T>>2]=(s[T>>2]|0)+1;else{h=o>>>31;i=s[m>>2]|0;if((i|0)>-1){o=s[w>>2]|0;if((o+(s[g>>2]|0)|0)>>>0<(s[M>>2]|0)>>>0){s[w>>2]=o+1;r[(s[t>>2]|0)+o>>0]=i+h;i=0}else i=-1;s[_>>2]=s[_>>2]|i}i=s[T>>2]|0;if(i|0){h=h+255&255;do{o=s[w>>2]|0;if((o+(s[g>>2]|0)|0)>>>0<(s[M>>2]|0)>>>0){s[w>>2]=o+1;r[(s[t>>2]|0)+o>>0]=h;o=0;i=s[T>>2]|0}else o=-1;s[_>>2]=s[_>>2]|o;i=i+-1|0;s[T>>2]=i}while((i|0)!=0)}s[m>>2]=c&255;o=s[R>>2]|0;i=s[b>>2]|0}s[R>>2]=o<<8&2147483392;i=i<<8;s[b>>2]=i;s[p>>2]=(s[p>>2]|0)+8}d=C+32|0;S=r[d>>0]|0;o=S<<24>>24;h=i>>>8;if(S<<24>>24>0){S=a[29437+(o+-1)>>0]|0;i=i-(te(h,S)|0)|0;s[R>>2]=(s[R>>2]|0)+i;i=te(h,S-(a[29437+o>>0]|0)|0)|0}else i=i-(te(h,a[29437+o>>0]|0)|0)|0;s[b>>2]=i;while(1){if(i>>>0>=8388609){c=i;u=0;break}o=s[R>>2]|0;c=o>>>23;if((c|0)==255)s[T>>2]=(s[T>>2]|0)+1;else{h=o>>>31;i=s[m>>2]|0;if((i|0)>-1){o=s[w>>2]|0;if((o+(s[g>>2]|0)|0)>>>0<(s[M>>2]|0)>>>0){s[w>>2]=o+1;r[(s[t>>2]|0)+o>>0]=i+h;i=0}else i=-1;s[_>>2]=s[_>>2]|i}i=s[T>>2]|0;if(i|0){h=h+255&255;do{o=s[w>>2]|0;if((o+(s[g>>2]|0)|0)>>>0<(s[M>>2]|0)>>>0){s[w>>2]=o+1;r[(s[t>>2]|0)+o>>0]=h;o=0;i=s[T>>2]|0}else o=-1;s[_>>2]=s[_>>2]|o;i=i+-1|0;s[T>>2]=i}while((i|0)!=0)}s[m>>2]=c&255;o=s[R>>2]|0;i=s[b>>2]|0}s[R>>2]=o<<8&2147483392;i=i<<8;s[b>>2]=i;s[p>>2]=(s[p>>2]|0)+8}while(1){if((u|0)>=(s[A>>2]|0))break;S=r[C+4+u>>0]|0;i=S<<24>>24;o=s[17376+(r[d>>0]<<2)>>2]|0;h=c>>>8;if(S<<24>>24>0){S=o+(i+-1)|0;E=c-(te(h,a[S>>0]|0)|0)|0;s[R>>2]=(s[R>>2]|0)+E;i=te(h,(a[S>>0]|0)-(a[o+i>>0]|0)|0)|0}else i=c-(te(h,a[o+i>>0]|0)|0)|0;s[b>>2]=i;while(1){if(i>>>0>=8388609)break;o=s[R>>2]|0;c=o>>>23;if((c|0)==255)s[T>>2]=(s[T>>2]|0)+1;else{h=o>>>31;i=s[m>>2]|0;if((i|0)>-1){o=s[w>>2]|0;if((o+(s[g>>2]|0)|0)>>>0<(s[M>>2]|0)>>>0){s[w>>2]=o+1;r[(s[t>>2]|0)+o>>0]=i+h;i=0}else i=-1;s[_>>2]=s[_>>2]|i}i=s[T>>2]|0;if(i|0){h=h+255&255;do{o=s[w>>2]|0;if((o+(s[g>>2]|0)|0)>>>0<(s[M>>2]|0)>>>0){s[w>>2]=o+1;r[(s[t>>2]|0)+o>>0]=h;o=0;i=s[T>>2]|0}else o=-1;s[_>>2]=s[_>>2]|o;i=i+-1|0;s[T>>2]=i}while((i|0)!=0)}s[m>>2]=c&255;o=s[R>>2]|0;i=s[b>>2]|0}s[R>>2]=o<<8&2147483392;i=i<<8;s[b>>2]=i;s[p>>2]=(s[p>>2]|0)+8}c=i;u=u+1|0}if(!f){f=r[C+33>>0]|0;i=f<<24>>24;o=c>>>8;if(f<<24>>24>0){f=a[29930+(i+-1)>>0]|0;S=c-(te(o,f)|0)|0;s[R>>2]=(s[R>>2]|0)+S;i=te(o,f-(a[29930+i>>0]|0)|0)|0}else i=c-(te(o,a[29930+i>>0]|0)|0)|0;s[b>>2]=i;while(1){if(i>>>0>=8388609)break e;o=s[R>>2]|0;c=o>>>23;if((c|0)==255)s[T>>2]=(s[T>>2]|0)+1;else{h=o>>>31;i=s[m>>2]|0;if((i|0)>-1){o=s[w>>2]|0;if((o+(s[g>>2]|0)|0)>>>0<(s[M>>2]|0)>>>0){s[w>>2]=o+1;r[(s[t>>2]|0)+o>>0]=i+h;i=0}else i=-1;s[_>>2]=s[_>>2]|i}i=s[T>>2]|0;if(i|0){h=h+255&255;do{o=s[w>>2]|0;if((o+(s[g>>2]|0)|0)>>>0<(s[M>>2]|0)>>>0){s[w>>2]=o+1;r[(s[t>>2]|0)+o>>0]=h;o=0;i=s[T>>2]|0}else o=-1;s[_>>2]=s[_>>2]|o;i=i+-1|0;s[T>>2]=i}while((i|0)!=0)}s[m>>2]=c&255;o=s[R>>2]|0;i=s[b>>2]|0}s[R>>2]=o<<8&2147483392;i=i<<8;s[b>>2]=i;s[p>>2]=(s[p>>2]|0)+8}}}while(0);s[e+5860>>2]=r[x>>0];e=r[C+34>>0]|0;i=e<<24>>24;o=s[b>>2]|0;h=o>>>8;if(e<<24>>24>0){e=a[29947+(i+-1)>>0]|0;C=o-(te(h,e)|0)|0;s[R>>2]=(s[R>>2]|0)+C;i=te(h,e-(a[29947+i>>0]|0)|0)|0}else i=o-(te(h,a[29947+i>>0]|0)|0)|0;s[b>>2]=i;while(1){if(i>>>0>=8388609)break;o=s[R>>2]|0;c=o>>>23;if((c|0)==255)s[T>>2]=(s[T>>2]|0)+1;else{h=o>>>31;i=s[m>>2]|0;if((i|0)>-1){o=s[w>>2]|0;if((o+(s[g>>2]|0)|0)>>>0<(s[M>>2]|0)>>>0){s[w>>2]=o+1;r[(s[t>>2]|0)+o>>0]=i+h;i=0}else i=-1;s[_>>2]=s[_>>2]|i}i=s[T>>2]|0;if(i|0){h=h+255&255;do{o=s[w>>2]|0;if((o+(s[g>>2]|0)|0)>>>0<(s[M>>2]|0)>>>0){s[w>>2]=o+1;r[(s[t>>2]|0)+o>>0]=h;o=0;i=s[T>>2]|0}else o=-1;s[_>>2]=s[_>>2]|o;i=i+-1|0;s[T>>2]=i}while((i|0)!=0)}s[m>>2]=c&255;o=s[R>>2]|0;i=s[b>>2]|0}s[R>>2]=o<<8&2147483392;i=i<<8;s[b>>2]=i;s[p>>2]=(s[p>>2]|0)+8}l=I;return}function Li(e,t,i,n,o){e=e|0;t=t|0;i=i|0;n=n|0;o=o|0;var f=0,h=0,c=0,u=0,d=0,p=0,b=0,m=0,w=0,g=0,v=0,_=0,y=0,k=0,E=0,A=0,S=0,M=0,T=0,R=0,x=0,C=0,I=0,P=0,O=0,N=0,D=0,L=0,B=0,U=0,j=0,F=0,z=0,q=0,H=0,G=0,V=0;V=l;l=l+96|0;G=V+56|0;I=V+40|0;P=V+32|0;w=V;s[w>>2]=0;s[w+4>>2]=0;s[w+8>>2]=0;s[w+12>>2]=0;s[w+16>>2]=0;s[w+20>>2]=0;s[w+24>>2]=0;s[w+28>>2]=0;f=o>>4;if((f<<4|0)<(o|0)){f=f+1|0;h=n+o|0;c=h+16|0;do{r[h>>0]=0;h=h+1|0}while((h|0)<(c|0))}h=f<<4;C=l;l=l+((1*(h<<2)|0)+15&-16)|0;c=0;while(1){if((c|0)>=(h|0))break;z=r[n+c>>0]|0;H=z<<24>>24;s[C+(c<<2)>>2]=z<<24>>24>0?H:0-H|0;H=c|1;z=r[n+H>>0]|0;q=z<<24>>24;s[C+(H<<2)>>2]=z<<24>>24>0?q:0-q|0;H=c|2;q=r[n+H>>0]|0;z=q<<24>>24;s[C+(H<<2)>>2]=q<<24>>24>0?z:0-z|0;H=c|3;z=r[n+H>>0]|0;q=z<<24>>24;s[C+(H<<2)>>2]=z<<24>>24>0?q:0-q|0;c=c+4|0}H=l;l=l+((1*(f<<2)|0)+15&-16)|0;O=l;l=l+((1*(f<<2)|0)+15&-16)|0;b=C;m=0;while(1){if((m|0)>=(f|0))break;d=O+(m<<2)|0;s[d>>2]=0;p=H+(m<<2)|0;c=0;e:while(1){if((c|0)<8){h=c<<1;h=(s[b+(h<<2)>>2]|0)+(s[b+((h|1)<<2)>>2]|0)|0;if((h|0)>8)u=1;else{s[w+(c<<2)>>2]=h;c=c+1|0;continue}}else u=0;c=0;while(1){if((c|0)>=4){h=0;break}h=c<<1;h=(s[w+(h<<2)>>2]|0)+(s[w+((h|1)<<2)>>2]|0)|0;if((h|0)>10){h=1;break}s[w+(c<<2)>>2]=h;c=c+1|0}u=u+h|0;c=0;while(1){if((c|0)>=2){h=0;break}h=c<<1;h=(s[w+(h<<2)>>2]|0)+(s[w+((h|1)<<2)>>2]|0)|0;if((h|0)>12){h=1;break}s[w+(c<<2)>>2]=h;c=c+1|0}u=u+h|0;c=0;while(1){if((c|0)>=1){h=0;break}h=c<<1;h=(s[w+(h<<2)>>2]|0)+(s[w+((h|1)<<2)>>2]|0)|0;if((h|0)>16){h=1;break}s[p+(c<<2)>>2]=h;c=c+1|0}if((u|0)==(0-h|0))break;s[d>>2]=(s[d>>2]|0)+1;h=0;while(1){if((h|0)==16){c=0;continue e}q=b+(h<<2)|0;s[q>>2]=s[q>>2]>>1;h=h+1|0}}b=b+64|0;m=m+1|0}m=t>>1;v=0;d=0;p=2147483647;while(1){if((d|0)==9)break;c=30270+(d*18|0)+17|0;u=0;b=a[30450+(m*9|0)+d>>0]|0;while(1){if((u|0)>=(f|0))break;if((s[O+(u<<2)>>2]|0)>0)h=c;else h=(s[H+(u<<2)>>2]|0)+(30270+(d*18|0))|0;u=u+1|0;b=b+(a[h>>0]|0)|0}q=(b|0)<(p|0);v=q?d:v;d=d+1|0;p=q?b:p}q=e+28|0;h=s[q>>2]|0;c=h>>>8;if((v|0)>0){z=a[v+-1+(30432+(m*9|0))>>0]|0;h=h-(te(c,z)|0)|0;N=e+32|0;s[N>>2]=(s[N>>2]|0)+h;h=te(c,z-(a[30432+(m*9|0)+v>>0]|0)|0)|0;s[q>>2]=h}else{h=h-(te(c,a[30432+(m*9|0)+v>>0]|0)|0)|0;s[q>>2]=h;N=e+32|0}D=e+36|0;L=e+20|0;B=e+40|0;U=e+24|0;j=e+8|0;F=e+4|0;z=e+44|0;while(1){if(h>>>0>=8388609)break;c=s[N>>2]|0;d=c>>>23;if((d|0)==255)s[D>>2]=(s[D>>2]|0)+1;else{u=c>>>31;h=s[B>>2]|0;if((h|0)>-1){c=s[U>>2]|0;if((c+(s[j>>2]|0)|0)>>>0<(s[F>>2]|0)>>>0){s[U>>2]=c+1;r[(s[e>>2]|0)+c>>0]=h+u;h=0}else h=-1;s[z>>2]=s[z>>2]|h}h=s[D>>2]|0;if(h|0){u=u+255&255;do{c=s[U>>2]|0;if((c+(s[j>>2]|0)|0)>>>0<(s[F>>2]|0)>>>0){s[U>>2]=c+1;r[(s[e>>2]|0)+c>>0]=u;c=0;h=s[D>>2]|0}else c=-1;s[z>>2]=s[z>>2]|c;h=h+-1|0;s[D>>2]=h}while((h|0)!=0)}s[B>>2]=d&255;c=s[N>>2]|0;h=s[q>>2]|0}s[N>>2]=c<<8&2147483392;h=h<<8;s[q>>2]=h;s[L>>2]=(s[L>>2]|0)+8}w=30090+(v*18|0)+16|0;g=30090+(v*18|0)+17|0;m=0;while(1){if((m|0)>=(f|0))break;p=s[O+(m<<2)>>2]|0;e:do if(!p){c=s[H+(m<<2)>>2]|0;u=h>>>8;if((c|0)>0){x=a[c+-1+(30090+(v*18|0))>>0]|0;h=h-(te(u,x)|0)|0;s[N>>2]=(s[N>>2]|0)+h;h=te(u,x-(a[30090+(v*18|0)+c>>0]|0)|0)|0}else h=h-(te(u,a[30090+(v*18|0)+c>>0]|0)|0)|0;s[q>>2]=h;while(1){if(h>>>0>=8388609)break e;c=s[N>>2]|0;d=c>>>23;if((d|0)==255)s[D>>2]=(s[D>>2]|0)+1;else{u=c>>>31;h=s[B>>2]|0;if((h|0)>-1){c=s[U>>2]|0;if((c+(s[j>>2]|0)|0)>>>0<(s[F>>2]|0)>>>0){s[U>>2]=c+1;r[(s[e>>2]|0)+c>>0]=h+u;h=0}else h=-1;s[z>>2]=s[z>>2]|h}h=s[D>>2]|0;if(h|0){u=u+255&255;do{c=s[U>>2]|0;if((c+(s[j>>2]|0)|0)>>>0<(s[F>>2]|0)>>>0){s[U>>2]=c+1;r[(s[e>>2]|0)+c>>0]=u;c=0;h=s[D>>2]|0}else c=-1;s[z>>2]=s[z>>2]|c;h=h+-1|0;s[D>>2]=h}while((h|0)!=0)}s[B>>2]=d&255;c=s[N>>2]|0;h=s[q>>2]|0}s[N>>2]=c<<8&2147483392;h=h<<8;s[q>>2]=h;s[L>>2]=(s[L>>2]|0)+8}}else{R=h>>>8;x=a[w>>0]|0;c=h-(te(R,x)|0)|0;c=(s[N>>2]|0)+c|0;s[N>>2]=c;h=te(R,x-(a[g>>0]|0)|0)|0;s[q>>2]=h;while(1){if(h>>>0>=8388609)break;d=c>>>23;if((d|0)==255)s[D>>2]=(s[D>>2]|0)+1;else{u=c>>>31;h=s[B>>2]|0;if((h|0)>-1){c=s[U>>2]|0;if((c+(s[j>>2]|0)|0)>>>0<(s[F>>2]|0)>>>0){s[U>>2]=c+1;r[(s[e>>2]|0)+c>>0]=h+u;h=0}else h=-1;s[z>>2]=s[z>>2]|h}h=s[D>>2]|0;if(h|0){u=u+255&255;do{c=s[U>>2]|0;if((c+(s[j>>2]|0)|0)>>>0<(s[F>>2]|0)>>>0){s[U>>2]=c+1;r[(s[e>>2]|0)+c>>0]=u;c=0;h=s[D>>2]|0}else c=-1;s[z>>2]=s[z>>2]|c;h=h+-1|0;s[D>>2]=h}while((h|0)!=0)}s[B>>2]=d&255;c=s[N>>2]|0;h=s[q>>2]|0}c=c<<8&2147483392;s[N>>2]=c;h=h<<8;s[q>>2]=h;s[L>>2]=(s[L>>2]|0)+8}b=p+-1|0;p=0;while(1){if((p|0)>=(b|0))break;x=h>>>8<<1;c=c+(h-x)|0;s[N>>2]=c;s[q>>2]=x;h=x;while(1){if(h>>>0>=8388609)break;d=c>>>23;if((d|0)==255)s[D>>2]=(s[D>>2]|0)+1;else{u=c>>>31;h=s[B>>2]|0;if((h|0)>-1){c=s[U>>2]|0;if((c+(s[j>>2]|0)|0)>>>0<(s[F>>2]|0)>>>0){s[U>>2]=c+1;r[(s[e>>2]|0)+c>>0]=h+u;h=0}else h=-1;s[z>>2]=s[z>>2]|h}h=s[D>>2]|0;if(h|0){u=u+255&255;do{c=s[U>>2]|0;if((c+(s[j>>2]|0)|0)>>>0<(s[F>>2]|0)>>>0){s[U>>2]=c+1;r[(s[e>>2]|0)+c>>0]=u;c=0;h=s[D>>2]|0}else c=-1;s[z>>2]=s[z>>2]|c;h=h+-1|0;s[D>>2]=h}while((h|0)!=0)}s[B>>2]=d&255;c=s[N>>2]|0;h=s[q>>2]|0}c=c<<8&2147483392;s[N>>2]=c;h=h<<8;s[q>>2]=h;s[L>>2]=(s[L>>2]|0)+8}p=p+1|0}u=s[H+(m<<2)>>2]|0;d=h>>>8;if((u|0)>0){x=a[30252+(u+-1)>>0]|0;c=c+(h-(te(d,x)|0))|0;s[N>>2]=c;h=te(d,x-(a[30252+u>>0]|0)|0)|0}else h=h-(te(d,a[30252+u>>0]|0)|0)|0;s[q>>2]=h;while(1){if(h>>>0>=8388609)break e;d=c>>>23;if((d|0)==255)s[D>>2]=(s[D>>2]|0)+1;else{u=c>>>31;h=s[B>>2]|0;if((h|0)>-1){c=s[U>>2]|0;if((c+(s[j>>2]|0)|0)>>>0<(s[F>>2]|0)>>>0){s[U>>2]=c+1;r[(s[e>>2]|0)+c>>0]=h+u;h=0}else h=-1;s[z>>2]=s[z>>2]|h}h=s[D>>2]|0;if(h|0){u=u+255&255;do{c=s[U>>2]|0;if((c+(s[j>>2]|0)|0)>>>0<(s[F>>2]|0)>>>0){s[U>>2]=c+1;r[(s[e>>2]|0)+c>>0]=u;c=0;h=s[D>>2]|0}else c=-1;s[z>>2]=s[z>>2]|c;h=h+-1|0;s[D>>2]=h}while((h|0)!=0)}s[B>>2]=d&255;c=s[N>>2]|0;h=s[q>>2]|0}c=c<<8&2147483392;s[N>>2]=c;h=h<<8;s[q>>2]=h;s[L>>2]=(s[L>>2]|0)+8}}while(0);m=m+1|0}v=G+4|0;_=G+8|0;y=I+4|0;k=G+12|0;E=I+8|0;A=P+4|0;S=G+16|0;M=G+20|0;T=G+24|0;R=I+12|0;x=G+28|0;g=0;c=0;while(1){if((g|0)>=(f|0)){v=0;break}if((s[H+(g<<2)>>2]|0)>0){w=C+(g<<4<<2)|0;u=0;while(1){if((u|0)==8){u=0;break}m=u<<1;s[G+(u<<2)>>2]=(s[w+(m<<2)>>2]|0)+(s[w+((m|1)<<2)>>2]|0);u=u+1|0}while(1){if((u|0)==4){u=0;break}m=u<<1;s[I+(u<<2)>>2]=(s[G+(m<<2)>>2]|0)+(s[G+((m|1)<<2)>>2]|0);u=u+1|0}while(1){if((u|0)==2){u=0;break}m=u<<1;s[P+(u<<2)>>2]=(s[I+(m<<2)>>2]|0)+(s[I+((m|1)<<2)>>2]|0);u=u+1|0}while(1){if((u|0)==1)break;c=u<<1;u=u+1|0;c=(s[P+(c<<2)>>2]|0)+(s[P+((c|1)<<2)>>2]|0)|0}b=s[P>>2]|0;e:do if((c|0)>0){u=30924+(a[31076+c>>0]|0)|0;d=h>>>8;if((b|0)>0){m=a[u+(b+-1)>>0]|0;h=h-(te(d,m)|0)|0;s[N>>2]=(s[N>>2]|0)+h;h=te(d,m-(a[u+b>>0]|0)|0)|0}else h=h-(te(d,a[u+b>>0]|0)|0)|0;s[q>>2]=h;while(1){if(h>>>0>=8388609)break e;u=s[N>>2]|0;p=u>>>23;if((p|0)==255)s[D>>2]=(s[D>>2]|0)+1;else{d=u>>>31;h=s[B>>2]|0;if((h|0)>-1){u=s[U>>2]|0;if((u+(s[j>>2]|0)|0)>>>0<(s[F>>2]|0)>>>0){s[U>>2]=u+1;r[(s[e>>2]|0)+u>>0]=h+d;h=0}else h=-1;s[z>>2]=s[z>>2]|h}h=s[D>>2]|0;if(h|0){d=d+255&255;do{u=s[U>>2]|0;if((u+(s[j>>2]|0)|0)>>>0<(s[F>>2]|0)>>>0){s[U>>2]=u+1;r[(s[e>>2]|0)+u>>0]=d;u=0;h=s[D>>2]|0}else u=-1;s[z>>2]=s[z>>2]|u;h=h+-1|0;s[D>>2]=h}while((h|0)!=0)}s[B>>2]=p&255;u=s[N>>2]|0;h=s[q>>2]|0}s[N>>2]=u<<8&2147483392;h=h<<8;s[q>>2]=h;s[L>>2]=(s[L>>2]|0)+8}}while(0);m=s[I>>2]|0;e:do if((b|0)>0){u=30772+(a[31076+b>>0]|0)|0;d=h>>>8;if((m|0)>0){b=a[u+(m+-1)>>0]|0;h=h-(te(d,b)|0)|0;s[N>>2]=(s[N>>2]|0)+h;h=te(d,b-(a[u+m>>0]|0)|0)|0}else h=h-(te(d,a[u+m>>0]|0)|0)|0;s[q>>2]=h;while(1){if(h>>>0>=8388609)break e;u=s[N>>2]|0;p=u>>>23;if((p|0)==255)s[D>>2]=(s[D>>2]|0)+1;else{d=u>>>31;h=s[B>>2]|0;if((h|0)>-1){u=s[U>>2]|0;if((u+(s[j>>2]|0)|0)>>>0<(s[F>>2]|0)>>>0){s[U>>2]=u+1;r[(s[e>>2]|0)+u>>0]=h+d;h=0}else h=-1;s[z>>2]=s[z>>2]|h}h=s[D>>2]|0;if(h|0){d=d+255&255;do{u=s[U>>2]|0;if((u+(s[j>>2]|0)|0)>>>0<(s[F>>2]|0)>>>0){s[U>>2]=u+1;r[(s[e>>2]|0)+u>>0]=d;u=0;h=s[D>>2]|0}else u=-1;s[z>>2]=s[z>>2]|u;h=h+-1|0;s[D>>2]=h}while((h|0)!=0)}s[B>>2]=p&255;u=s[N>>2]|0;h=s[q>>2]|0}s[N>>2]=u<<8&2147483392;h=h<<8;s[q>>2]=h;s[L>>2]=(s[L>>2]|0)+8}}while(0);b=s[G>>2]|0;e:do if((m|0)>0){u=30620+(a[31076+m>>0]|0)|0;d=h>>>8;if((b|0)>0){m=a[u+(b+-1)>>0]|0;h=h-(te(d,m)|0)|0;s[N>>2]=(s[N>>2]|0)+h;h=te(d,m-(a[u+b>>0]|0)|0)|0}else h=h-(te(d,a[u+b>>0]|0)|0)|0;s[q>>2]=h;while(1){if(h>>>0>=8388609)break e;u=s[N>>2]|0;p=u>>>23;if((p|0)==255)s[D>>2]=(s[D>>2]|0)+1;else{d=u>>>31;h=s[B>>2]|0;if((h|0)>-1){u=s[U>>2]|0;if((u+(s[j>>2]|0)|0)>>>0<(s[F>>2]|0)>>>0){s[U>>2]=u+1;r[(s[e>>2]|0)+u>>0]=h+d;h=0}else h=-1;s[z>>2]=s[z>>2]|h}h=s[D>>2]|0;if(h|0){d=d+255&255;do{u=s[U>>2]|0;if((u+(s[j>>2]|0)|0)>>>0<(s[F>>2]|0)>>>0){s[U>>2]=u+1;r[(s[e>>2]|0)+u>>0]=d;u=0;h=s[D>>2]|0}else u=-1;s[z>>2]=s[z>>2]|u;h=h+-1|0;s[D>>2]=h}while((h|0)!=0)}s[B>>2]=p&255;u=s[N>>2]|0;h=s[q>>2]|0}s[N>>2]=u<<8&2147483392;h=h<<8;s[q>>2]=h;s[L>>2]=(s[L>>2]|0)+8}}while(0);p=s[w>>2]|0;e:do if((b|0)>0){u=30468+(a[31076+b>>0]|0)|0;d=h>>>8;if((p|0)>0){m=a[u+(p+-1)>>0]|0;h=h-(te(d,m)|0)|0;s[N>>2]=(s[N>>2]|0)+h;h=te(d,m-(a[u+p>>0]|0)|0)|0}else h=h-(te(d,a[u+p>>0]|0)|0)|0;s[q>>2]=h;while(1){if(h>>>0>=8388609)break e;u=s[N>>2]|0;p=u>>>23;if((p|0)==255)s[D>>2]=(s[D>>2]|0)+1;else{d=u>>>31;h=s[B>>2]|0;if((h|0)>-1){u=s[U>>2]|0;if((u+(s[j>>2]|0)|0)>>>0<(s[F>>2]|0)>>>0){s[U>>2]=u+1;r[(s[e>>2]|0)+u>>0]=h+d;h=0}else h=-1;s[z>>2]=s[z>>2]|h}h=s[D>>2]|0;if(h|0){d=d+255&255;do{u=s[U>>2]|0;if((u+(s[j>>2]|0)|0)>>>0<(s[F>>2]|0)>>>0){s[U>>2]=u+1;r[(s[e>>2]|0)+u>>0]=d;u=0;h=s[D>>2]|0}else u=-1;s[z>>2]=s[z>>2]|u;h=h+-1|0;s[D>>2]=h}while((h|0)!=0)}s[B>>2]=p&255;u=s[N>>2]|0;h=s[q>>2]|0}s[N>>2]=u<<8&2147483392;h=h<<8;s[q>>2]=h;s[L>>2]=(s[L>>2]|0)+8}}while(0);p=s[w+8>>2]|0;u=s[v>>2]|0;e:do if((u|0)>0){u=30468+(a[31076+u>>0]|0)|0;d=h>>>8;if((p|0)>0){m=a[u+(p+-1)>>0]|0;h=h-(te(d,m)|0)|0;s[N>>2]=(s[N>>2]|0)+h;h=te(d,m-(a[u+p>>0]|0)|0)|0}else h=h-(te(d,a[u+p>>0]|0)|0)|0;s[q>>2]=h;while(1){if(h>>>0>=8388609)break e;u=s[N>>2]|0;p=u>>>23;if((p|0)==255)s[D>>2]=(s[D>>2]|0)+1;else{d=u>>>31;h=s[B>>2]|0;if((h|0)>-1){u=s[U>>2]|0;if((u+(s[j>>2]|0)|0)>>>0<(s[F>>2]|0)>>>0){s[U>>2]=u+1;r[(s[e>>2]|0)+u>>0]=h+d;h=0}else h=-1;s[z>>2]=s[z>>2]|h}h=s[D>>2]|0;if(h|0){d=d+255&255;do{u=s[U>>2]|0;if((u+(s[j>>2]|0)|0)>>>0<(s[F>>2]|0)>>>0){s[U>>2]=u+1;r[(s[e>>2]|0)+u>>0]=d;u=0;h=s[D>>2]|0}else u=-1;s[z>>2]=s[z>>2]|u;h=h+-1|0;s[D>>2]=h}while((h|0)!=0)}s[B>>2]=p&255;u=s[N>>2]|0;h=s[q>>2]|0}s[N>>2]=u<<8&2147483392;h=h<<8;s[q>>2]=h;s[L>>2]=(s[L>>2]|0)+8}}while(0);b=s[_>>2]|0;u=s[y>>2]|0;e:do if((u|0)>0){u=30620+(a[31076+u>>0]|0)|0;d=h>>>8;if((b|0)>0){m=a[u+(b+-1)>>0]|0;h=h-(te(d,m)|0)|0;s[N>>2]=(s[N>>2]|0)+h;h=te(d,m-(a[u+b>>0]|0)|0)|0}else h=h-(te(d,a[u+b>>0]|0)|0)|0;s[q>>2]=h;while(1){if(h>>>0>=8388609)break e;u=s[N>>2]|0;p=u>>>23;if((p|0)==255)s[D>>2]=(s[D>>2]|0)+1;else{d=u>>>31;h=s[B>>2]|0;if((h|0)>-1){u=s[U>>2]|0;if((u+(s[j>>2]|0)|0)>>>0<(s[F>>2]|0)>>>0){s[U>>2]=u+1;r[(s[e>>2]|0)+u>>0]=h+d;h=0}else h=-1;s[z>>2]=s[z>>2]|h}h=s[D>>2]|0;if(h|0){d=d+255&255;do{u=s[U>>2]|0;if((u+(s[j>>2]|0)|0)>>>0<(s[F>>2]|0)>>>0){s[U>>2]=u+1;r[(s[e>>2]|0)+u>>0]=d;u=0;h=s[D>>2]|0}else u=-1;s[z>>2]=s[z>>2]|u;h=h+-1|0;s[D>>2]=h}while((h|0)!=0)}s[B>>2]=p&255;u=s[N>>2]|0;h=s[q>>2]|0}s[N>>2]=u<<8&2147483392;h=h<<8;s[q>>2]=h;s[L>>2]=(s[L>>2]|0)+8}}while(0);p=s[w+16>>2]|0;e:do if((b|0)>0){u=30468+(a[31076+b>>0]|0)|0;d=h>>>8;if((p|0)>0){m=a[u+(p+-1)>>0]|0;h=h-(te(d,m)|0)|0;s[N>>2]=(s[N>>2]|0)+h;h=te(d,m-(a[u+p>>0]|0)|0)|0}else h=h-(te(d,a[u+p>>0]|0)|0)|0;s[q>>2]=h;while(1){if(h>>>0>=8388609)break e;u=s[N>>2]|0;p=u>>>23;if((p|0)==255)s[D>>2]=(s[D>>2]|0)+1;else{d=u>>>31;h=s[B>>2]|0;if((h|0)>-1){u=s[U>>2]|0;if((u+(s[j>>2]|0)|0)>>>0<(s[F>>2]|0)>>>0){s[U>>2]=u+1;r[(s[e>>2]|0)+u>>0]=h+d;h=0}else h=-1;s[z>>2]=s[z>>2]|h}h=s[D>>2]|0;if(h|0){d=d+255&255;do{u=s[U>>2]|0;if((u+(s[j>>2]|0)|0)>>>0<(s[F>>2]|0)>>>0){s[U>>2]=u+1;r[(s[e>>2]|0)+u>>0]=d;u=0;h=s[D>>2]|0}else u=-1;s[z>>2]=s[z>>2]|u;h=h+-1|0;s[D>>2]=h}while((h|0)!=0)}s[B>>2]=p&255;u=s[N>>2]|0;h=s[q>>2]|0}s[N>>2]=u<<8&2147483392;h=h<<8;s[q>>2]=h;s[L>>2]=(s[L>>2]|0)+8}}while(0);p=s[w+24>>2]|0;u=s[k>>2]|0;e:do if((u|0)>0){u=30468+(a[31076+u>>0]|0)|0;d=h>>>8;if((p|0)>0){m=a[u+(p+-1)>>0]|0;h=h-(te(d,m)|0)|0;s[N>>2]=(s[N>>2]|0)+h;h=te(d,m-(a[u+p>>0]|0)|0)|0}else h=h-(te(d,a[u+p>>0]|0)|0)|0;s[q>>2]=h;while(1){if(h>>>0>=8388609)break e;u=s[N>>2]|0;p=u>>>23;if((p|0)==255)s[D>>2]=(s[D>>2]|0)+1;else{d=u>>>31;h=s[B>>2]|0;if((h|0)>-1){u=s[U>>2]|0;if((u+(s[j>>2]|0)|0)>>>0<(s[F>>2]|0)>>>0){s[U>>2]=u+1;r[(s[e>>2]|0)+u>>0]=h+d;h=0}else h=-1;s[z>>2]=s[z>>2]|h}h=s[D>>2]|0;if(h|0){d=d+255&255;do{u=s[U>>2]|0;if((u+(s[j>>2]|0)|0)>>>0<(s[F>>2]|0)>>>0){s[U>>2]=u+1;r[(s[e>>2]|0)+u>>0]=d;u=0;h=s[D>>2]|0}else u=-1;s[z>>2]=s[z>>2]|u;h=h+-1|0;s[D>>2]=h}while((h|0)!=0)}s[B>>2]=p&255;u=s[N>>2]|0;h=s[q>>2]|0}s[N>>2]=u<<8&2147483392;h=h<<8;s[q>>2]=h;s[L>>2]=(s[L>>2]|0)+8}}while(0);b=s[E>>2]|0;u=s[A>>2]|0;e:do if((u|0)>0){u=30772+(a[31076+u>>0]|0)|0;d=h>>>8;if((b|0)>0){m=a[u+(b+-1)>>0]|0;h=h-(te(d,m)|0)|0;s[N>>2]=(s[N>>2]|0)+h;h=te(d,m-(a[u+b>>0]|0)|0)|0}else h=h-(te(d,a[u+b>>0]|0)|0)|0;s[q>>2]=h;while(1){if(h>>>0>=8388609)break e;u=s[N>>2]|0;p=u>>>23;if((p|0)==255)s[D>>2]=(s[D>>2]|0)+1;else{d=u>>>31;h=s[B>>2]|0;if((h|0)>-1){u=s[U>>2]|0;if((u+(s[j>>2]|0)|0)>>>0<(s[F>>2]|0)>>>0){s[U>>2]=u+1;r[(s[e>>2]|0)+u>>0]=h+d;h=0}else h=-1;s[z>>2]=s[z>>2]|h}h=s[D>>2]|0;if(h|0){d=d+255&255;do{u=s[U>>2]|0;if((u+(s[j>>2]|0)|0)>>>0<(s[F>>2]|0)>>>0){s[U>>2]=u+1;r[(s[e>>2]|0)+u>>0]=d;u=0;h=s[D>>2]|0}else u=-1;s[z>>2]=s[z>>2]|u;h=h+-1|0;s[D>>2]=h}while((h|0)!=0)}s[B>>2]=p&255;u=s[N>>2]|0;h=s[q>>2]|0}s[N>>2]=u<<8&2147483392;h=h<<8;s[q>>2]=h;s[L>>2]=(s[L>>2]|0)+8}}while(0);m=s[S>>2]|0;e:do if((b|0)>0){u=30620+(a[31076+b>>0]|0)|0;d=h>>>8;if((m|0)>0){b=a[u+(m+-1)>>0]|0;h=h-(te(d,b)|0)|0;s[N>>2]=(s[N>>2]|0)+h;h=te(d,b-(a[u+m>>0]|0)|0)|0}else h=h-(te(d,a[u+m>>0]|0)|0)|0;s[q>>2]=h;while(1){if(h>>>0>=8388609)break e;u=s[N>>2]|0;p=u>>>23;if((p|0)==255)s[D>>2]=(s[D>>2]|0)+1;else{d=u>>>31;h=s[B>>2]|0;if((h|0)>-1){u=s[U>>2]|0;if((u+(s[j>>2]|0)|0)>>>0<(s[F>>2]|0)>>>0){s[U>>2]=u+1;r[(s[e>>2]|0)+u>>0]=h+d;h=0}else h=-1;s[z>>2]=s[z>>2]|h}h=s[D>>2]|0;if(h|0){d=d+255&255;do{u=s[U>>2]|0;if((u+(s[j>>2]|0)|0)>>>0<(s[F>>2]|0)>>>0){s[U>>2]=u+1;r[(s[e>>2]|0)+u>>0]=d;u=0;h=s[D>>2]|0}else u=-1;s[z>>2]=s[z>>2]|u;h=h+-1|0;s[D>>2]=h}while((h|0)!=0)}s[B>>2]=p&255;u=s[N>>2]|0;h=s[q>>2]|0}s[N>>2]=u<<8&2147483392;h=h<<8;s[q>>2]=h;s[L>>2]=(s[L>>2]|0)+8}}while(0);p=s[w+32>>2]|0;e:do if((m|0)>0){u=30468+(a[31076+m>>0]|0)|0;d=h>>>8;if((p|0)>0){m=a[u+(p+-1)>>0]|0;h=h-(te(d,m)|0)|0;s[N>>2]=(s[N>>2]|0)+h;h=te(d,m-(a[u+p>>0]|0)|0)|0}else h=h-(te(d,a[u+p>>0]|0)|0)|0;s[q>>2]=h;while(1){if(h>>>0>=8388609)break e;u=s[N>>2]|0;p=u>>>23;if((p|0)==255)s[D>>2]=(s[D>>2]|0)+1;else{d=u>>>31;h=s[B>>2]|0;if((h|0)>-1){u=s[U>>2]|0;if((u+(s[j>>2]|0)|0)>>>0<(s[F>>2]|0)>>>0){s[U>>2]=u+1;r[(s[e>>2]|0)+u>>0]=h+d;h=0}else h=-1;s[z>>2]=s[z>>2]|h}h=s[D>>2]|0;if(h|0){d=d+255&255;do{u=s[U>>2]|0;if((u+(s[j>>2]|0)|0)>>>0<(s[F>>2]|0)>>>0){s[U>>2]=u+1;r[(s[e>>2]|0)+u>>0]=d;u=0;h=s[D>>2]|0}else u=-1;s[z>>2]=s[z>>2]|u;h=h+-1|0;s[D>>2]=h}while((h|0)!=0)}s[B>>2]=p&255;u=s[N>>2]|0;h=s[q>>2]|0}s[N>>2]=u<<8&2147483392;h=h<<8;s[q>>2]=h;s[L>>2]=(s[L>>2]|0)+8}}while(0);p=s[w+40>>2]|0;u=s[M>>2]|0;e:do if((u|0)>0){u=30468+(a[31076+u>>0]|0)|0;d=h>>>8;if((p|0)>0){m=a[u+(p+-1)>>0]|0;h=h-(te(d,m)|0)|0;s[N>>2]=(s[N>>2]|0)+h;h=te(d,m-(a[u+p>>0]|0)|0)|0}else h=h-(te(d,a[u+p>>0]|0)|0)|0;s[q>>2]=h;while(1){if(h>>>0>=8388609)break e;u=s[N>>2]|0;p=u>>>23;if((p|0)==255)s[D>>2]=(s[D>>2]|0)+1;else{d=u>>>31;h=s[B>>2]|0;if((h|0)>-1){u=s[U>>2]|0;if((u+(s[j>>2]|0)|0)>>>0<(s[F>>2]|0)>>>0){s[U>>2]=u+1;r[(s[e>>2]|0)+u>>0]=h+d;h=0}else h=-1;s[z>>2]=s[z>>2]|h}h=s[D>>2]|0;if(h|0){d=d+255&255;do{u=s[U>>2]|0;if((u+(s[j>>2]|0)|0)>>>0<(s[F>>2]|0)>>>0){s[U>>2]=u+1;r[(s[e>>2]|0)+u>>0]=d;u=0;h=s[D>>2]|0}else u=-1;s[z>>2]=s[z>>2]|u;h=h+-1|0;s[D>>2]=h}while((h|0)!=0)}s[B>>2]=p&255;u=s[N>>2]|0;h=s[q>>2]|0}s[N>>2]=u<<8&2147483392;h=h<<8;s[q>>2]=h;s[L>>2]=(s[L>>2]|0)+8}}while(0);b=s[T>>2]|0;u=s[R>>2]|0;e:do if((u|0)>0){u=30620+(a[31076+u>>0]|0)|0;d=h>>>8;if((b|0)>0){m=a[u+(b+-1)>>0]|0;h=h-(te(d,m)|0)|0;s[N>>2]=(s[N>>2]|0)+h;h=te(d,m-(a[u+b>>0]|0)|0)|0}else h=h-(te(d,a[u+b>>0]|0)|0)|0;s[q>>2]=h;while(1){if(h>>>0>=8388609)break e;u=s[N>>2]|0;p=u>>>23;if((p|0)==255)s[D>>2]=(s[D>>2]|0)+1;else{d=u>>>31;h=s[B>>2]|0;if((h|0)>-1){u=s[U>>2]|0;if((u+(s[j>>2]|0)|0)>>>0<(s[F>>2]|0)>>>0){s[U>>2]=u+1;r[(s[e>>2]|0)+u>>0]=h+d;h=0}else h=-1;s[z>>2]=s[z>>2]|h}h=s[D>>2]|0;if(h|0){d=d+255&255;do{u=s[U>>2]|0;if((u+(s[j>>2]|0)|0)>>>0<(s[F>>2]|0)>>>0){s[U>>2]=u+1;r[(s[e>>2]|0)+u>>0]=d;u=0;h=s[D>>2]|0}else u=-1;s[z>>2]=s[z>>2]|u;h=h+-1|0;s[D>>2]=h}while((h|0)!=0)}s[B>>2]=p&255;u=s[N>>2]|0;h=s[q>>2]|0}s[N>>2]=u<<8&2147483392;h=h<<8;s[q>>2]=h;s[L>>2]=(s[L>>2]|0)+8}}while(0);p=s[w+48>>2]|0;e:do if((b|0)>0){u=30468+(a[31076+b>>0]|0)|0;d=h>>>8;if((p|0)>0){m=a[u+(p+-1)>>0]|0;h=h-(te(d,m)|0)|0;s[N>>2]=(s[N>>2]|0)+h;h=te(d,m-(a[u+p>>0]|0)|0)|0}else h=h-(te(d,a[u+p>>0]|0)|0)|0;s[q>>2]=h;while(1){if(h>>>0>=8388609)break e;u=s[N>>2]|0;p=u>>>23;if((p|0)==255)s[D>>2]=(s[D>>2]|0)+1;else{d=u>>>31;h=s[B>>2]|0;if((h|0)>-1){u=s[U>>2]|0;if((u+(s[j>>2]|0)|0)>>>0<(s[F>>2]|0)>>>0){s[U>>2]=u+1;r[(s[e>>2]|0)+u>>0]=h+d;h=0}else h=-1;s[z>>2]=s[z>>2]|h}h=s[D>>2]|0;if(h|0){d=d+255&255;do{u=s[U>>2]|0;if((u+(s[j>>2]|0)|0)>>>0<(s[F>>2]|0)>>>0){s[U>>2]=u+1;r[(s[e>>2]|0)+u>>0]=d;u=0;h=s[D>>2]|0}else u=-1;s[z>>2]=s[z>>2]|u;h=h+-1|0;s[D>>2]=h}while((h|0)!=0)}s[B>>2]=p&255;u=s[N>>2]|0;h=s[q>>2]|0}s[N>>2]=u<<8&2147483392;h=h<<8;s[q>>2]=h;s[L>>2]=(s[L>>2]|0)+8}}while(0);p=s[w+56>>2]|0;u=s[x>>2]|0;e:do if((u|0)>0){u=30468+(a[31076+u>>0]|0)|0;d=h>>>8;if((p|0)>0){w=a[u+(p+-1)>>0]|0;h=h-(te(d,w)|0)|0;s[N>>2]=(s[N>>2]|0)+h;h=te(d,w-(a[u+p>>0]|0)|0)|0}else h=h-(te(d,a[u+p>>0]|0)|0)|0;s[q>>2]=h;while(1){if(h>>>0>=8388609)break e;u=s[N>>2]|0;p=u>>>23;if((p|0)==255)s[D>>2]=(s[D>>2]|0)+1;else{d=u>>>31;h=s[B>>2]|0;if((h|0)>-1){u=s[U>>2]|0;if((u+(s[j>>2]|0)|0)>>>0<(s[F>>2]|0)>>>0){s[U>>2]=u+1;r[(s[e>>2]|0)+u>>0]=h+d;h=0}else h=-1;s[z>>2]=s[z>>2]|h}h=s[D>>2]|0;if(h|0){d=d+255&255;do{u=s[U>>2]|0;if((u+(s[j>>2]|0)|0)>>>0<(s[F>>2]|0)>>>0){s[U>>2]=u+1;r[(s[e>>2]|0)+u>>0]=d;u=0;h=s[D>>2]|0}else u=-1;s[z>>2]=s[z>>2]|u;h=h+-1|0;s[D>>2]=h}while((h|0)!=0)}s[B>>2]=p&255;u=s[N>>2]|0;h=s[q>>2]|0}s[N>>2]=u<<8&2147483392;h=h<<8;s[q>>2]=h;s[L>>2]=(s[L>>2]|0)+8}}while(0)}g=g+1|0}while(1){if((v|0)>=(f|0))break;w=s[O+(v<<2)>>2]|0;e:do if((w|0)>0){g=n+(v<<4)|0;m=0;while(1){if((m|0)==16)break e;c=r[g+m>>0]|0;b=c<<24>>24;b=(c<<24>>24>0?b:0-b|0)<<24>>24;c=w;t:while(1){p=c+-1|0;if((c|0)<=1)break;c=b>>>p&1;u=h>>>8;d=r[29928+c>>0]|0;if(!c)h=h-(te(u,d&255)|0)|0;else{P=a[29928+(c+-1)>>0]|0;h=h-(te(u,P)|0)|0;s[N>>2]=(s[N>>2]|0)+h;h=te(u,P-(d&255)|0)|0}s[q>>2]=h;while(1){if(h>>>0>=8388609){c=p;continue t}c=s[N>>2]|0;d=c>>>23;if((d|0)==255)s[D>>2]=(s[D>>2]|0)+1;else{ +u=c>>>31;h=s[B>>2]|0;if((h|0)>-1){c=s[U>>2]|0;if((c+(s[j>>2]|0)|0)>>>0<(s[F>>2]|0)>>>0){s[U>>2]=c+1;r[(s[e>>2]|0)+c>>0]=h+u;h=0}else h=-1;s[z>>2]=s[z>>2]|h}h=s[D>>2]|0;if(h|0){u=u+255&255;do{c=s[U>>2]|0;if((c+(s[j>>2]|0)|0)>>>0<(s[F>>2]|0)>>>0){s[U>>2]=c+1;r[(s[e>>2]|0)+c>>0]=u;c=0;h=s[D>>2]|0}else c=-1;s[z>>2]=s[z>>2]|c;h=h+-1|0;s[D>>2]=h}while((h|0)!=0)}s[B>>2]=d&255;c=s[N>>2]|0;h=s[q>>2]|0}s[N>>2]=c<<8&2147483392;h=h<<8;s[q>>2]=h;s[L>>2]=(s[L>>2]|0)+8}}c=b&1;u=h>>>8;d=r[29928+c>>0]|0;if(!c)h=h-(te(u,d&255)|0)|0;else{P=a[29928+(c+-1)>>0]|0;h=h-(te(u,P)|0)|0;s[N>>2]=(s[N>>2]|0)+h;h=te(u,P-(d&255)|0)|0}s[q>>2]=h;while(1){if(h>>>0>=8388609)break;c=s[N>>2]|0;d=c>>>23;if((d|0)==255)s[D>>2]=(s[D>>2]|0)+1;else{u=c>>>31;h=s[B>>2]|0;if((h|0)>-1){c=s[U>>2]|0;if((c+(s[j>>2]|0)|0)>>>0<(s[F>>2]|0)>>>0){s[U>>2]=c+1;r[(s[e>>2]|0)+c>>0]=h+u;h=0}else h=-1;s[z>>2]=s[z>>2]|h}h=s[D>>2]|0;if(h|0){u=u+255&255;do{c=s[U>>2]|0;if((c+(s[j>>2]|0)|0)>>>0<(s[F>>2]|0)>>>0){s[U>>2]=c+1;r[(s[e>>2]|0)+c>>0]=u;c=0;h=s[D>>2]|0}else c=-1;s[z>>2]=s[z>>2]|c;h=h+-1|0;s[D>>2]=h}while((h|0)!=0)}s[B>>2]=d&255;c=s[N>>2]|0;h=s[q>>2]|0}s[N>>2]=c<<8&2147483392;h=h<<8;s[q>>2]=h;s[L>>2]=(s[L>>2]|0)+8}m=m+1|0}}while(0);v=v+1|0}r[G+1>>0]=0;w=31093+(((t<<1)+i<<16>>16)*7|0)|0;m=o+8>>4;f=h;b=0;p=n;while(1){if((b|0)>=(m|0))break;h=s[H+(b<<2)>>2]|0;e:do if((h|0)>0){r[G>>0]=r[w+((h&30)>>>0<6?h&31:6)>>0]|0;d=0;while(1){if((d|0)==16)break e;h=r[p+d>>0]|0;t:do if(h<<24>>24){h=h<<24>>24>>15;c=h+1|0;u=f>>>8;if((h|0)>-1){n=a[G+h>>0]|0;f=f-(te(u,n)|0)|0;s[N>>2]=(s[N>>2]|0)+f;f=te(u,n-(a[G+c>>0]|0)|0)|0}else f=f-(te(u,a[G+c>>0]|0)|0)|0;s[q>>2]=f;while(1){if(f>>>0>=8388609)break t;h=s[N>>2]|0;u=h>>>23;if((u|0)==255)s[D>>2]=(s[D>>2]|0)+1;else{c=h>>>31;f=s[B>>2]|0;if((f|0)>-1){h=s[U>>2]|0;if((h+(s[j>>2]|0)|0)>>>0<(s[F>>2]|0)>>>0){s[U>>2]=h+1;r[(s[e>>2]|0)+h>>0]=f+c;f=0}else f=-1;s[z>>2]=s[z>>2]|f}f=s[D>>2]|0;if(f|0){c=c+255&255;do{h=s[U>>2]|0;if((h+(s[j>>2]|0)|0)>>>0<(s[F>>2]|0)>>>0){s[U>>2]=h+1;r[(s[e>>2]|0)+h>>0]=c;h=0;f=s[D>>2]|0}else h=-1;s[z>>2]=s[z>>2]|h;f=f+-1|0;s[D>>2]=f}while((f|0)!=0)}s[B>>2]=u&255;h=s[N>>2]|0;f=s[q>>2]|0}s[N>>2]=h<<8&2147483392;f=f<<8;s[q>>2]=f;s[L>>2]=(s[L>>2]|0)+8}}while(0);d=d+1|0}}while(0);b=b+1|0;p=p+16|0}l=V;return}function Bi(e,t,i,a){e=e|0;t=t|0;i=i|0;a=a|0;var o=0,f=0,h=0,c=0,l=0;h=i+2|0;o=n[h>>1]|0;a=(te(o<<16>>16,a)|0)/2|0;f=i+20|0;a=(s[i+24>>2]|0)+a|0;i=0;while(1){if((i|0)>=(o<<16>>16|0))break;l=r[a>>0]|0;c=l&255;n[e+(i<<1)>>1]=(c>>>1&7)*9;r[t+i>>0]=r[(s[f>>2]|0)+(i+((n[h>>1]|0)+-1&0-(c&1)))>>0]|0;o=i|1;n[e+(o<<1)>>1]=((l&255)>>>5&255)*9;r[t+o>>0]=r[(s[f>>2]|0)+(i+((n[h>>1]|0)+-1&0-(c>>>4&1))+1)>>0]|0;o=n[h>>1]|0;a=a+1|0;i=i+2|0}return}function Ui(e,t,i,a,f,h,c,u,d,p,b){e=e|0;t=t|0;i=i|0;a=a|0;f=f|0;h=h|0;c=c|0;u=u|0;d=d|0;p=p|0;b=b|0;var m=0,w=0,g=0,v=0,_=0,y=0,k=0,E=0,A=0,S=0,M=0,T=0,R=0,x=0,C=0,I=0;x=l;l=l+16|0;M=x+8|0;k=x+4|0;y=x;T=t+-4|0;m=b+2|0;R=l;l=l+((1*(m<<1)|0)+15&-16)|0;w=0;while(1){if((w|0)>=(m|0))break;A=w+-2|0;_=n[t+(A<<1)>>1]|0;A=n[i+(A<<1)>>1]|0;E=_+A|0;A=_-A|0;n[T+(w<<1)>>1]=(E>>>1)+(E&1);A=(A>>1)+(A&1)|0;n[R+(w<<1)>>1]=(A|0)>32767?32767:((A|0)<-32768?-32768:A)&65535;w=w+1|0}_=e+4|0;g=o[_>>1]|o[_+2>>1]<<16;n[T>>1]=g;n[T+2>>1]=g>>>16;g=e+8|0;w=o[g>>1]|o[g+2>>1]<<16;s[R>>2]=w;m=T+(b<<1)|0;m=o[m>>1]|o[m+2>>1]<<16;n[_>>1]=m;n[_+2>>1]=m>>>16;_=R+(b<<1)|0;_=o[_>>1]|o[_+2>>1]<<16;n[g>>1]=_;n[g+2>>1]=_>>>16;g=l;l=l+((1*(b<<1)|0)+15&-16)|0;_=l;l=l+((1*(b<<1)|0)+15&-16)|0;m=0;while(1){if((m|0)>=(b|0))break;A=m+1|0;v=n[T+(A<<1)>>1]|0;E=((n[T+(m<<1)>>1]|0)+(n[T+(m+2<<1)>>1]|0)+(v<<16>>16<<1)>>1)+1>>1;n[g+(m<<1)>>1]=E;n[_+(m<<1)>>1]=(v&65535)-E;m=A}t=l;l=l+((1*(b<<1)|0)+15&-16)|0;v=l;l=l+((1*(b<<1)|0)+15&-16)|0;m=w&65535;w=0;while(1){if((w|0)>=(b|0))break;A=w+1|0;E=n[R+(A<<1)>>1]|0;C=((m<<16>>16)+(n[R+(w+2<<1)>>1]|0)+(E<<16>>16<<1)>>1)+1>>1;n[t+(w<<1)>>1]=C;n[v+(w<<1)>>1]=(E&65535)-C;m=E;w=A}m=(p*10|0)==(b|0);E=m?328:655;u=u<<16>>16;u=te(u,u)|0;u=(te(u>>>16,E)|0)+((te(u&65535,E)|0)>>>16)|0;E=Zi(k,g,t,e+12|0,b,u)|0;s[M>>2]=E;v=Zi(y,_,v,e+20|0,b,u)|0;A=M+4|0;s[A>>2]=v;g=(s[y>>2]|0)+((s[k>>2]<<16>>16)*3|0)|0;g=(g|0)<65536?g:65536;_=c-(m?1200:600)|0;_=(_|0)<1?1:_;t=((p<<16>>16)*900|0)+2e3|0;m=g*3|0;w=ji(_,m+851968|0,19)|0;s[h>>2]=w;if((w|0)<(t|0)){s[h>>2]=t;c=_-t|0;s[h+4>>2]=c;C=t<<16>>16;m=ji((c<<1)-t|0,(te(m+65536>>16,C)|0)+((te(m&65535,C)|0)>>16)|0,16)|0;if((m|0)>16384)m=16384;else m=(m|0)<0?0:m}else{s[h+4>>2]=_-w;m=16384}w=e+28|0;k=n[w>>1]|0;c=k&65535;C=u<<16>>16;n[w>>1]=c+((te(m-(k<<16>>16)>>16,C)|0)+((te(m-c&65535,C)|0)>>>16));r[f>>0]=0;e:do if(!d){do if(!(n[e+30>>1]|0)){if((_<<3|0)>=(t*13|0)){m=s[w>>2]|0;C=m<<16>>16;if(((te(g>>16,C)|0)+((te(g&65535,C)|0)>>16)|0)<819)m=m&65535;else{if((m>>>16&65535)<<16>>16){S=23;break}m=n[w>>1]|0;break}}else m=n[w>>1]|0;s[M>>2]=(te(m<<16>>16,E<<16>>16)|0)>>14;s[A>>2]=(te(m<<16>>16,v<<16>>16)|0)>>14;$i(M,a);s[M>>2]=0;s[A>>2]=0;s[h>>2]=_;s[h+4>>2]=0;r[f>>0]=1;w=0;S=31;break e}else S=23;while(0);do if((S|0)==23){if((_<<3|0)>=(t*11|0)){m=n[w>>1]|0;C=m<<16>>16;if(((te(g>>16,C)|0)+((te(g&65535,C)|0)>>16)|0)>=328)break}else m=n[w>>1]|0;m=m<<16>>16;s[M>>2]=(te(m,E<<16>>16)|0)>>14;s[A>>2]=(te(m,v<<16>>16)|0)>>14;$i(M,a);s[M>>2]=0;s[A>>2]=0;m=0;S=30;break e}while(0);if(m<<16>>16>15565){$i(M,a);m=16384;S=30;break}else{m=m<<16>>16;s[M>>2]=(te(m,E<<16>>16)|0)>>14;s[A>>2]=(te(m,v<<16>>16)|0)>>14;$i(M,a);m=n[w>>1]|0;S=30;break}}else{s[M>>2]=0;s[A>>2]=0;$i(M,a);m=0;S=30}while(0);if((S|0)==30)if((r[f>>0]|0)==1){w=m;S=31}else{n[e+32>>1]=0;S=35}do if((S|0)==31){m=e+32|0;C=(o[m>>1]|0)+(b-(p<<3))|0;n[m>>1]=C;if((C<<16>>16|0)<(p*5|0)){r[f>>0]=0;S=36;break}else{n[m>>1]=1e4;m=w;S=35;break}}while(0);if((S|0)==35)if(!(r[f>>0]|0)){w=m;S=36}if((S|0)==36){m=h+4|0;if((s[m>>2]|0)<1){s[m>>2]=1;s[h>>2]=(_|0)<2?1:_+-1|0;m=w}else m=w}u=s[e>>2]|0;d=e+30|0;v=n[d>>1]|0;y=v<<16>>16;w=p<<3;E=s[M>>2]|0;g=(65536/(w|0)|0)<<16>>16;k=((te(E-u<<16>>16,g)|0)>>15)+1>>1;c=s[A>>2]|0;t=((te(c-(u>>>16)<<16>>16,g)|0)>>15)+1>>1;g=(te(m-y>>16,g)|0)+((te(m-(v&65535)&65535,g)|0)>>16)<<10;v=0;_=0-(u<<16>>16)|0;u=0-(u>>16)|0;y=y<<10;while(1){if((v|0)>=(w|0))break;p=_-k|0;M=u-t|0;C=y+g|0;h=v+1|0;S=n[T+(h<<1)>>1]|0;A=(n[T+(v<<1)>>1]|0)+(n[T+(v+2<<1)>>1]|0)+(S<<1)|0;I=n[R+(h<<1)>>1]|0;a=p<<16>>16;f=M<<16>>16;f=((te(C>>16,I)|0)+((te(C&64512,I)|0)>>16)+((te(A>>7,a)|0)+((te(A<<9&65024,a)|0)>>16))+((te(S>>5,f)|0)+((te(S<<11&63488,f)|0)>>16))>>7)+1>>1;n[i+(v+-1<<1)>>1]=(f|0)>32767?32767:((f|0)<-32768?-32768:f)&65535;v=h;_=p;u=M;y=C}t=e+2|0;g=m>>6;v=m<<10&64512;_=0-E<<16>>16;u=0-c<<16>>16;while(1){if((w|0)>=(b|0))break;I=w+1|0;C=n[T+(I<<1)>>1]|0;M=(n[T+(w<<1)>>1]|0)+(n[T+(w+2<<1)>>1]|0)+(C<<1)|0;p=n[R+(I<<1)>>1]|0;C=((te(g,p)|0)+((te(v,p)|0)>>16)+((te(M>>7,_)|0)+((te(M<<9&65024,_)|0)>>16))+((te(C>>5,u)|0)+((te(C<<11&63488,u)|0)>>16))>>7)+1>>1;n[i+(w+-1<<1)>>1]=(C|0)>32767?32767:((C|0)<-32768?-32768:C)&65535;w=I}n[e>>1]=E;n[t>>1]=c;n[d>>1]=m;l=x;return}function ji(e,t,i){e=e|0;t=t|0;i=i|0;var r=0,n=0,s=0,a=0;if((e|0)<=0)if(!e)n=32;else{r=0-e|0;s=3}else{r=e;s=3}if((s|0)==3)n=re(r|0)|0;e=e<>16|0)|0)<<16>>16;a=(te(e>>16,t)|0)+((te(e&65535,t)|0)>>16)|0;s=Nn(s|0,((s|0)<0)<<31>>31|0,a|0,((a|0)<0)<<31>>31|0)|0;s=Sn(s|0,I|0,29)|0;s=e-(s&-8)|0;t=a+((te(s>>16,t)|0)+((te(s&65535,t)|0)>>16))|0;r=n+28-r-i|0;if((r|0)>=0)return((r|0)<32?t>>r:0)|0;r=0-r|0;e=-2147483648>>r;n=2147483647>>>r;if((e|0)>(n|0)){if((t|0)>(e|0)){a=e;a=a<(n|0)){a=n;a=a<>2]=t;s[e+8>>2]=193536;s[e+12>>2]=193536;s[e+4756>>2]=1;t=e+32|0;i=t+112|0;do{s[t>>2]=0;t=t+4|0}while((t|0)<(i|0));t=0;while(1){if((t|0)==4){t=0;break}i=t+1|0;r=50/(i|0)|0;s[e+124+(t<<2)>>2]=(r|0)>1?r:1;t=i}while(1){if((t|0)==4)break;r=(s[e+124+(t<<2)>>2]|0)*100|0;s[e+92+(t<<2)>>2]=r;s[e+108+(t<<2)>>2]=2147483647/(r|0)|0;t=t+1|0}s[e+140>>2]=15;t=0;while(1){if((t|0)==4)break;s[e+72+(t<<2)>>2]=25600;t=t+1|0}return 0}function zi(e,t){e=e|0;t=t|0;var i=0,r=0,a=0,o=0,f=0,c=0,u=0,p=0,b=0,m=0,w=0,g=0,v=0,_=0;_=l;l=l+304|0;w=_;b=e+4668|0;r=s[b>>2]|0;if((r|0)==(t|0)?(i=e+4648|0,(s[e+4652>>2]|0)==(s[i>>2]|0)):0){g=i;v=0;g=s[g>>2]|0;e=e+4652|0;s[e>>2]=g;l=_;return v|0}if(!r){v=e+4648|0;g=v;v=qi(e+5868|0,s[v>>2]|0,t*1e3|0,1)|0;g=s[g>>2]|0;e=e+4652|0;s[e>>2]=g;l=_;return v|0}m=((s[e+4672>>2]|0)*10|0)+5|0;p=te(m,r)|0;r=te(m,t)|0;g=Ne()|0;v=l;l=l+((1*(((p|0)>(r|0)?p:r)<<1)|0)+15&-16)|0;i=p;while(1){u=i+-1|0;if((i|0)<=0)break;o=+h[e+7272+(u<<2)>>2];a=(h[d>>2]=o,s[d>>2]|0);f=(a&2130706432)>>>0>1249902592;if(!f){i=(a|0)<0;c=i?o+-8388608+8388608:o+8388608+-8388608;if(c==0)c=i?-0:0}else c=o;if((~~c|0)<=32767){if(!f){i=(a|0)<0;c=i?o+-8388608+8388608:o+8388608+-8388608;if(c==0)c=i?-0:0}else c=o;if((~~c|0)<-32768)i=-32768;else{if(!f){i=(a|0)<0;o=i?o+-8388608+8388608:o+8388608+-8388608;if(o==0)o=i?-0:0}i=~~o}}else i=32767;n[v+(u<<1)>>1]=i;i=u}u=e+4648|0;f=qi(w,(s[b>>2]<<16>>16)*1e3|0,s[u>>2]|0,0)|0;m=te(m,(s[u>>2]|0)/1e3|0)|0;b=l;l=l+((1*(m<<1)|0)+15&-16)|0;Hi(w,b,v,p);w=e+5868|0;a=qi(w,s[u>>2]|0,(t<<16>>16)*1e3|0,1)|0;Hi(w,v,b,m);while(1){i=r+-1|0;if((r|0)<=0)break;h[e+7272+(i<<2)>>2]=+(n[v+(i<<1)>>1]|0);r=i}qe(g|0);g=u;v=f+a|0;g=s[g>>2]|0;e=e+4652|0;s[e>>2]=g;l=_;return v|0}function qi(e,t,i,n){e=e|0;t=t|0;i=i|0;n=n|0;var a=0,o=0,f=0;kn(e|0,0,300)|0;if(!n){e:do if((t|0)>=12e3)if((t|0)<16e3){switch(t|0){case 12e3:break e;default:n=-1}return n|0}else{switch(t|0){case 16e3:break e;default:n=-1}return n|0}else{switch(t|0){case 8e3:break e;default:n=-1}return n|0}while(0);e:do if((i|0)<16e3)if((i|0)<12e3){switch(i|0){case 8e3:break e;default:n=-1}return n|0}else{switch(i|0){case 12e3:break e;default:n=-1}return n|0}else{if((i|0)<24e3){switch(i|0){case 16e3:break e;default:n=-1}return n|0}if((i|0)<48e3){switch(i|0){case 24e3:break e;default:n=-1}return n|0}else{switch(i|0){case 48e3:break e;default:n=-1}return n|0}}while(0);s[e+292>>2]=r[((i>>12)-((i|0)>16e3&1)>>((i|0)>24e3&1))+-1+(31150+((((t>>12)-((t|0)>16e3&1)>>((t|0)>24e3&1))+-1|0)*5|0))>>0]}else{e:do if((t|0)<16e3)if((t|0)<12e3){switch(t|0){case 8e3:break e;default:n=-1}return n|0}else{switch(t|0){case 12e3:break e;default:n=-1}return n|0}else{if((t|0)<24e3){switch(t|0){case 16e3:break e;default:n=-1}return n|0}if((t|0)<48e3){switch(t|0){case 24e3:break e;default:n=-1}return n|0}else{switch(t|0){case 48e3:break e;default:n=-1}return n|0}}while(0);e:do if((i|0)>=12e3)if((i|0)<16e3){switch(i|0){case 12e3:break e;default:n=-1}return n|0}else{switch(i|0){case 16e3:break e;default:n=-1}return n|0}else{switch(i|0){case 8e3:break e;default:n=-1}return n|0}while(0);s[e+292>>2]=r[((i>>12)-((i|0)>16e3&1)>>((i|0)>24e3&1))+-1+(31135+((((t>>12)-((t|0)>16e3&1)>>((t|0)>24e3&1))+-1|0)*3|0))>>0]}f=(t|0)/1e3|0;s[e+284>>2]=f;s[e+288>>2]=(i|0)/1e3|0;s[e+268>>2]=f*10;do if((i|0)>(t|0)){n=e+264|0;if((t<<1|0)==(i|0)){s[n>>2]=1;n=0;break}else{s[n>>2]=2;n=1;break}}else{n=e+264|0;if((i|0)>=(t|0)){s[n>>2]=0;n=0;break}s[n>>2]=3;n=i<<2;if((n|0)==(t*3|0)){s[e+280>>2]=3;s[e+276>>2]=18;s[e+296>>2]=25418;n=0;break}a=i*3|0;if((a|0)==(t<<1|0)){s[e+280>>2]=2;s[e+276>>2]=18;s[e+296>>2]=25476;n=0;break}if((i<<1|0)==(t|0)){s[e+280>>2]=1;s[e+276>>2]=24;s[e+296>>2]=25516;n=0;break}if((a|0)==(t|0)){s[e+280>>2]=1;s[e+276>>2]=36;s[e+296>>2]=25544;n=0;break}if((n|0)==(t|0)){s[e+280>>2]=1;s[e+276>>2]=36;s[e+296>>2]=25584;n=0;break}if((i*6|0)==(t|0)){s[e+280>>2]=1;s[e+276>>2]=36;s[e+296>>2]=25624;n=0;break}else{t=-1;return t|0}}while(0);a=((t<<(n|14)|0)/(i|0)|0)<<2;o=e+272|0;s[o>>2]=a;f=i<<16>>16;e=(i>>15)+1>>1;n=t<>16,f)|0)+((te(a&65535,f)|0)>>16)+(te(a,e)|0)|0)>=(n|0)){n=0;break}t=a+1|0;s[o>>2]=t;a=t}return n|0}function Hi(e,t,i,r){e=e|0;t=t|0;i=i|0;r=r|0;var n=0,a=0,o=0,f=0;n=e+284|0;o=e+292|0;f=s[o>>2]|0;a=(s[n>>2]|0)-f|0;Mn(e+168+(f<<1)|0,i|0,a<<1|0)|0;switch(s[e+264>>2]|0){case 1:{f=e+168|0;Wi(e,t,f,s[n>>2]|0);Wi(e,t+(s[e+288>>2]<<1)|0,i+(a<<1)|0,r-(s[n>>2]|0)|0);n=f;break}case 2:{f=e+168|0;Vi(e,t,f,s[n>>2]|0);Vi(e,t+(s[e+288>>2]<<1)|0,i+(a<<1)|0,r-(s[n>>2]|0)|0);n=f;break}case 3:{f=e+168|0;Gi(e,t,f,s[n>>2]|0);Gi(e,t+(s[e+288>>2]<<1)|0,i+(a<<1)|0,r-(s[n>>2]|0)|0);n=f;break}default:{f=e+168|0;Mn(t|0,f|0,s[n>>2]<<1|0)|0;Mn(t+(s[e+288>>2]<<1)|0,i+(a<<1)|0,r-(s[n>>2]|0)<<1|0)|0;n=f}}f=s[o>>2]|0;Mn(n|0,i+(r-f<<1)|0,f<<1|0)|0;return}function Gi(e,t,i,r){e=e|0;t=t|0;i=i|0;r=r|0;var a=0,o=0,f=0,h=0,c=0,u=0,d=0,p=0,b=0,m=0,w=0,g=0,v=0,_=0,y=0,k=0,E=0,A=0,S=0,M=0,T=0,R=0,x=0,C=0,I=0,P=0,O=0,N=0,D=0,L=0,B=0,U=0,j=0,F=0,z=0,q=0,H=0,G=0;j=l;d=e+268|0;c=s[d>>2]|0;E=e+276|0;h=s[E>>2]|0;L=l;l=l+((1*(c+h<<2)|0)+15&-16)|0;B=e+24|0;Mn(L|0,B|0,h<<2|0)|0;U=e+296|0;D=s[U>>2]|0;p=D+4|0;b=s[e+272>>2]|0;m=e+4|0;w=e+280|0;g=D+6|0;v=D+8|0;_=D+10|0;y=D+12|0;k=D+14|0;A=D+16|0;S=D+18|0;M=D+20|0;T=D+22|0;R=D+24|0;x=D+26|0;C=D+28|0;I=D+30|0;P=D+32|0;O=D+34|0;N=D+36|0;D=D+38|0;u=i;i=c;while(1){c=(r|0)<(i|0)?r:i;i=L+(h<<2)|0;a=s[U>>2]|0;o=a+2|0;f=0;while(1){if((f|0)>=(c|0))break;z=(s[e>>2]|0)+(n[u+(f<<1)>>1]<<8)|0;s[i+(f<<2)>>2]=z;z=z<<2;q=z>>16;F=n[a>>1]|0;z=z&65532;s[e>>2]=(s[m>>2]|0)+((te(q,F)|0)+((te(z,F)|0)>>16));F=n[o>>1]|0;s[m>>2]=(te(q,F)|0)+((te(z,F)|0)>>16);f=f+1|0}f=c<<16;i=s[w>>2]|0;e:do switch(h|0){case 18:{o=i<<16>>16;a=i+-1|0;i=0;while(1){if((i|0)>=(f|0))break e;z=L+(i>>16<<2)|0;q=(te(i&65535,o)|0)>>16;F=p+(q*9<<1)|0;h=s[z>>2]|0;G=n[F>>1]|0;G=(te(h>>16,G)|0)+((te(h&65535,G)|0)>>16)|0;h=s[z+4>>2]|0;H=n[F+2>>1]|0;H=G+((te(h>>16,H)|0)+((te(h&65535,H)|0)>>16))|0;h=s[z+8>>2]|0;G=n[F+4>>1]|0;G=H+((te(h>>16,G)|0)+((te(h&65535,G)|0)>>16))|0;h=s[z+12>>2]|0;H=n[F+6>>1]|0;H=G+((te(h>>16,H)|0)+((te(h&65535,H)|0)>>16))|0;h=s[z+16>>2]|0;G=n[F+8>>1]|0;G=H+((te(h>>16,G)|0)+((te(h&65535,G)|0)>>16))|0;h=s[z+20>>2]|0;H=n[F+10>>1]|0;H=G+((te(h>>16,H)|0)+((te(h&65535,H)|0)>>16))|0;h=s[z+24>>2]|0;G=n[F+12>>1]|0;G=H+((te(h>>16,G)|0)+((te(h&65535,G)|0)>>16))|0;h=s[z+28>>2]|0;H=n[F+14>>1]|0;H=G+((te(h>>16,H)|0)+((te(h&65535,H)|0)>>16))|0;h=s[z+32>>2]|0;F=n[F+16>>1]|0;F=H+((te(h>>16,F)|0)+((te(h&65535,F)|0)>>16))|0;q=p+((a-q|0)*9<<1)|0;h=s[z+68>>2]|0;H=n[q>>1]|0;H=F+((te(h>>16,H)|0)+((te(h&65535,H)|0)>>16))|0;h=s[z+64>>2]|0;F=n[q+2>>1]|0;F=H+((te(h>>16,F)|0)+((te(h&65535,F)|0)>>16))|0;h=s[z+60>>2]|0;H=n[q+4>>1]|0;H=F+((te(h>>16,H)|0)+((te(h&65535,H)|0)>>16))|0;h=s[z+56>>2]|0;F=n[q+6>>1]|0;F=H+((te(h>>16,F)|0)+((te(h&65535,F)|0)>>16))|0;h=s[z+52>>2]|0;H=n[q+8>>1]|0;H=F+((te(h>>16,H)|0)+((te(h&65535,H)|0)>>16))|0;h=s[z+48>>2]|0;F=n[q+10>>1]|0;F=H+((te(h>>16,F)|0)+((te(h&65535,F)|0)>>16))|0;h=s[z+44>>2]|0;H=n[q+12>>1]|0;H=F+((te(h>>16,H)|0)+((te(h&65535,H)|0)>>16))|0;h=s[z+40>>2]|0;F=n[q+14>>1]|0;F=H+((te(h>>16,F)|0)+((te(h&65535,F)|0)>>16))|0;z=s[z+36>>2]|0;q=n[q+16>>1]|0;q=(F+((te(z>>16,q)|0)+((te(z&65535,q)|0)>>16))>>5)+1>>1;n[t>>1]=(q|0)>32767?32767:((q|0)<-32768?-32768:q)&65535;t=t+2|0;i=i+b|0}}case 24:{i=0;while(1){if((i|0)>=(f|0))break e;H=L+(i>>16<<2)|0;G=(s[H>>2]|0)+(s[H+92>>2]|0)|0;q=n[p>>1]|0;q=(te(G>>16,q)|0)+((te(G&65535,q)|0)>>16)|0;G=(s[H+4>>2]|0)+(s[H+88>>2]|0)|0;z=n[g>>1]|0;z=q+((te(G>>16,z)|0)+((te(G&65535,z)|0)>>16))|0;G=(s[H+8>>2]|0)+(s[H+84>>2]|0)|0;q=n[v>>1]|0;q=z+((te(G>>16,q)|0)+((te(G&65535,q)|0)>>16))|0;G=(s[H+12>>2]|0)+(s[H+80>>2]|0)|0;z=n[_>>1]|0;z=q+((te(G>>16,z)|0)+((te(G&65535,z)|0)>>16))|0;G=(s[H+16>>2]|0)+(s[H+76>>2]|0)|0;q=n[y>>1]|0;q=z+((te(G>>16,q)|0)+((te(G&65535,q)|0)>>16))|0;G=(s[H+20>>2]|0)+(s[H+72>>2]|0)|0;z=n[k>>1]|0;z=q+((te(G>>16,z)|0)+((te(G&65535,z)|0)>>16))|0;G=(s[H+24>>2]|0)+(s[H+68>>2]|0)|0;q=n[A>>1]|0;q=z+((te(G>>16,q)|0)+((te(G&65535,q)|0)>>16))|0;G=(s[H+28>>2]|0)+(s[H+64>>2]|0)|0;z=n[S>>1]|0;z=q+((te(G>>16,z)|0)+((te(G&65535,z)|0)>>16))|0;G=(s[H+32>>2]|0)+(s[H+60>>2]|0)|0;q=n[M>>1]|0;q=z+((te(G>>16,q)|0)+((te(G&65535,q)|0)>>16))|0;G=(s[H+36>>2]|0)+(s[H+56>>2]|0)|0;z=n[T>>1]|0;z=q+((te(G>>16,z)|0)+((te(G&65535,z)|0)>>16))|0;G=(s[H+40>>2]|0)+(s[H+52>>2]|0)|0;q=n[R>>1]|0;q=z+((te(G>>16,q)|0)+((te(G&65535,q)|0)>>16))|0;H=(s[H+44>>2]|0)+(s[H+48>>2]|0)|0;G=n[x>>1]|0;G=(q+((te(H>>16,G)|0)+((te(H&65535,G)|0)>>16))>>5)+1>>1;n[t>>1]=(G|0)>32767?32767:((G|0)<-32768?-32768:G)&65535;t=t+2|0;i=i+b|0}}case 36:{i=0;while(1){if((i|0)>=(f|0))break e;H=L+(i>>16<<2)|0;G=(s[H>>2]|0)+(s[H+140>>2]|0)|0;q=n[p>>1]|0;q=(te(G>>16,q)|0)+((te(G&65535,q)|0)>>16)|0;G=(s[H+4>>2]|0)+(s[H+136>>2]|0)|0;z=n[g>>1]|0;z=q+((te(G>>16,z)|0)+((te(G&65535,z)|0)>>16))|0;G=(s[H+8>>2]|0)+(s[H+132>>2]|0)|0;q=n[v>>1]|0;q=z+((te(G>>16,q)|0)+((te(G&65535,q)|0)>>16))|0;G=(s[H+12>>2]|0)+(s[H+128>>2]|0)|0;z=n[_>>1]|0;z=q+((te(G>>16,z)|0)+((te(G&65535,z)|0)>>16))|0;G=(s[H+16>>2]|0)+(s[H+124>>2]|0)|0;q=n[y>>1]|0;q=z+((te(G>>16,q)|0)+((te(G&65535,q)|0)>>16))|0;G=(s[H+20>>2]|0)+(s[H+120>>2]|0)|0;z=n[k>>1]|0;z=q+((te(G>>16,z)|0)+((te(G&65535,z)|0)>>16))|0;G=(s[H+24>>2]|0)+(s[H+116>>2]|0)|0;q=n[A>>1]|0;q=z+((te(G>>16,q)|0)+((te(G&65535,q)|0)>>16))|0;G=(s[H+28>>2]|0)+(s[H+112>>2]|0)|0;z=n[S>>1]|0;z=q+((te(G>>16,z)|0)+((te(G&65535,z)|0)>>16))|0;G=(s[H+32>>2]|0)+(s[H+108>>2]|0)|0;q=n[M>>1]|0;q=z+((te(G>>16,q)|0)+((te(G&65535,q)|0)>>16))|0;G=(s[H+36>>2]|0)+(s[H+104>>2]|0)|0;z=n[T>>1]|0;z=q+((te(G>>16,z)|0)+((te(G&65535,z)|0)>>16))|0;G=(s[H+40>>2]|0)+(s[H+100>>2]|0)|0;q=n[R>>1]|0;q=z+((te(G>>16,q)|0)+((te(G&65535,q)|0)>>16))|0;G=(s[H+44>>2]|0)+(s[H+96>>2]|0)|0;z=n[x>>1]|0;z=q+((te(G>>16,z)|0)+((te(G&65535,z)|0)>>16))|0;G=(s[H+48>>2]|0)+(s[H+92>>2]|0)|0;q=n[C>>1]|0;q=z+((te(G>>16,q)|0)+((te(G&65535,q)|0)>>16))|0;G=(s[H+52>>2]|0)+(s[H+88>>2]|0)|0;z=n[I>>1]|0;z=q+((te(G>>16,z)|0)+((te(G&65535,z)|0)>>16))|0;G=(s[H+56>>2]|0)+(s[H+84>>2]|0)|0;q=n[P>>1]|0;q=z+((te(G>>16,q)|0)+((te(G&65535,q)|0)>>16))|0;G=(s[H+60>>2]|0)+(s[H+80>>2]|0)|0;z=n[O>>1]|0;z=q+((te(G>>16,z)|0)+((te(G&65535,z)|0)>>16))|0;G=(s[H+64>>2]|0)+(s[H+76>>2]|0)|0;q=n[N>>1]|0;q=z+((te(G>>16,q)|0)+((te(G&65535,q)|0)>>16))|0;H=(s[H+68>>2]|0)+(s[H+72>>2]|0)|0;G=n[D>>1]|0;G=(q+((te(H>>16,G)|0)+((te(H&65535,G)|0)>>16))>>5)+1>>1;n[t>>1]=(G|0)>32767?32767:((G|0)<-32768?-32768:G)&65535;t=t+2|0;i=i+b|0}}default:{}}while(0);r=r-c|0;if((r|0)<=1)break;h=s[E>>2]|0;Mn(L|0,L+(c<<2)|0,h<<2|0)|0;u=u+(c<<1)|0;i=s[d>>2]|0}Mn(B|0,L+(c<<2)|0,s[E>>2]<<2|0)|0;l=j;return}function Vi(e,t,i,r){e=e|0;t=t|0;i=i|0;r=r|0;var a=0,o=0,f=0,h=0,c=0,u=0,d=0,p=0,b=0,m=0,w=0,g=0;b=l;h=e+268|0;f=s[h>>2]|0;c=l;l=l+((1*((f<<1)+8<<1)|0)+15&-16)|0;u=e+24|0;n[c>>1]=n[u>>1]|0;n[c+2>>1]=n[u+2>>1]|0;n[c+4>>1]=n[u+4>>1]|0;n[c+6>>1]=n[u+6>>1]|0;n[c+8>>1]=n[u+8>>1]|0;n[c+10>>1]=n[u+10>>1]|0;n[c+12>>1]=n[u+12>>1]|0;n[c+14>>1]=n[u+14>>1]|0;d=s[e+272>>2]|0;p=c+16|0;a=t;t=f;while(1){f=(r|0)<(t|0)?r:t;Wi(e,p,i,f);o=f<<17;t=0;while(1){if((t|0)>=(o|0))break;m=((t&65535)*12|0)>>>16;w=c+(t>>16<<1)|0;g=te(n[w>>1]|0,n[25664+(m<<3)>>1]|0)|0;g=g+(te(n[w+2>>1]|0,n[25664+(m<<3)+2>>1]|0)|0)|0;g=g+(te(n[w+4>>1]|0,n[25664+(m<<3)+4>>1]|0)|0)|0;g=g+(te(n[w+6>>1]|0,n[25664+(m<<3)+6>>1]|0)|0)|0;m=11-m|0;g=g+(te(n[w+8>>1]|0,n[25664+(m<<3)+6>>1]|0)|0)|0;g=g+(te(n[w+10>>1]|0,n[25664+(m<<3)+4>>1]|0)|0)|0;g=g+(te(n[w+12>>1]|0,n[25664+(m<<3)+2>>1]|0)|0)|0;m=(g+(te(n[w+14>>1]|0,n[25664+(m<<3)>>1]|0)|0)>>14)+1>>1;n[a>>1]=(m|0)>32767?32767:((m|0)<-32768?-32768:m)&65535;a=a+2|0;t=t+d|0}r=r-f|0;if((r|0)<=0)break;t=c+(f<<1<<1)|0;n[c>>1]=n[t>>1]|0;n[c+2>>1]=n[t+2>>1]|0;n[c+4>>1]=n[t+4>>1]|0;n[c+6>>1]=n[t+6>>1]|0;n[c+8>>1]=n[t+8>>1]|0;n[c+10>>1]=n[t+10>>1]|0;n[c+12>>1]=n[t+12>>1]|0;n[c+14>>1]=n[t+14>>1]|0;i=i+(f<<1)|0;t=s[h>>2]|0}g=c+(f<<1<<1)|0;n[u>>1]=n[g>>1]|0;n[u+2>>1]=n[g+2>>1]|0;n[u+4>>1]=n[g+4>>1]|0;n[u+6>>1]=n[g+6>>1]|0;n[u+8>>1]=n[g+8>>1]|0;n[u+10>>1]=n[g+10>>1]|0;n[u+12>>1]=n[g+12>>1]|0;n[u+14>>1]=n[g+14>>1]|0;l=b;return}function Wi(e,t,i,r){e=e|0;t=t|0;i=i|0;r=r|0;var a=0,o=0,f=0,h=0,c=0,l=0,u=0,d=0,p=0,b=0;a=e+4|0;o=e+8|0;f=e+12|0;h=e+16|0;c=e+20|0;l=0;while(1){if((l|0)>=(r|0))break;b=n[i+(l<<1)>>1]<<10;d=s[e>>2]|0;u=b-d|0;u=((u>>16)*1746|0)+(((u&65535)*1746|0)>>>16)|0;d=d+u|0;s[e>>2]=b+u;u=s[a>>2]|0;p=d-u|0;p=((p>>16)*14986|0)+(((p&65535)*14986|0)>>>16)|0;u=u+p|0;s[a>>2]=d+p;p=u-(s[o>>2]|0)|0;d=(te(p>>16,-26453)|0)+((te(p&65535,-26453)|0)>>16)|0;s[o>>2]=u+(p+d);d=(u+d>>9)+1>>1;u=l<<1;n[t+(u<<1)>>1]=(d|0)>32767?32767:((d|0)<-32768?-32768:d)&65535;d=s[f>>2]|0;p=b-d|0;p=((p>>16)*6854|0)+(((p&65535)*6854|0)>>>16)|0;d=d+p|0;s[f>>2]=b+p;p=s[h>>2]|0;b=d-p|0;b=((b>>16)*25769|0)+(((b&65535)*25769|0)>>>16)|0;p=p+b|0;s[h>>2]=d+b;b=p-(s[c>>2]|0)|0;d=(te(b>>16,-9994)|0)+((te(b&65535,-9994)|0)>>16)|0;s[c>>2]=p+(b+d);d=(p+d>>9)+1>>1;n[t+((u|1)<<1)>>1]=(d|0)>32767?32767:((d|0)<-32768?-32768:d)&65535;l=l+1|0}return}function Ki(e,t){e=e|0;t=t|0;var i=0,r=0,o=0,f=0,h=0,c=0,u=0,d=0,p=0,b=0,m=0,w=0,g=0,v=0;v=l;l=l+32|0;g=v;m=e+28|0;f=s[m>>2]|0;w=e+32|0;i=s[w>>2]|0;r=f>>>8;h=-1;while(1){h=h+1|0;o=te(r,a[29891+h>>0]|0)|0;if(i>>>0>=o>>>0)break;else f=o}c=i-o|0;s[w>>2]=c;i=f-o|0;s[m>>2]=i;u=e+20|0;d=e+40|0;p=e+24|0;b=e+4|0;f=c;while(1){if(i>>>0>=8388609)break;s[u>>2]=(s[u>>2]|0)+8;i=i<<8;s[m>>2]=i;o=s[d>>2]|0;r=s[p>>2]|0;if(r>>>0<(s[b>>2]|0)>>>0){s[p>>2]=r+1;r=a[(s[e>>2]|0)+r>>0]|0}else r=0;s[d>>2]=r;c=((o<<8|r)>>>1&255|f<<8&2147483392)^255;s[w>>2]=c;f=c}c=(h|0)/5|0;s[g+8>>2]=c;s[g+20>>2]=h+(te(c,-5)|0);c=0;while(1){if((c|0)==2){i=0;break}o=i>>>8;h=-1;while(1){h=h+1|0;r=te(o,a[29944+h>>0]|0)|0;if(f>>>0>=r>>>0)break;else i=r}f=f-r|0;s[w>>2]=f;i=i-r|0;s[m>>2]=i;while(1){if(i>>>0>=8388609)break;s[u>>2]=(s[u>>2]|0)+8;i=i<<8;s[m>>2]=i;o=s[d>>2]|0;r=s[p>>2]|0;if(r>>>0<(s[b>>2]|0)>>>0){s[p>>2]=r+1;r=a[(s[e>>2]|0)+r>>0]|0}else r=0;s[d>>2]=r;o=((o<<8|r)>>>1&255|f<<8&2147483392)^255;s[w>>2]=o;f=o}s[g+(c*12|0)>>2]=h;o=i>>>8;h=-1;while(1){h=h+1|0;r=te(o,a[29951+h>>0]|0)|0;if(f>>>0>=r>>>0)break;else i=r}f=f-r|0;s[w>>2]=f;i=i-r|0;s[m>>2]=i;while(1){if(i>>>0>=8388609)break;s[u>>2]=(s[u>>2]|0)+8;i=i<<8;s[m>>2]=i;o=s[d>>2]|0;r=s[p>>2]|0;if(r>>>0<(s[b>>2]|0)>>>0){s[p>>2]=r+1;r=a[(s[e>>2]|0)+r>>0]|0}else r=0;s[d>>2]=r;o=((o<<8|r)>>>1&255|f<<8&2147483392)^255;s[w>>2]=o;f=o}s[g+(c*12|0)+4>>2]=h;c=c+1|0}while(1){if((i|0)==2)break;w=g+(i*12|0)|0;e=(s[w>>2]|0)+((s[g+(i*12|0)+8>>2]|0)*3|0)|0;s[w>>2]=e;w=n[25372+(e<<1)>>1]|0;e=n[25372+(e+1<<1)>>1]|0;e=(te((e<<16>>16)-w>>16,429522944)|0)+(((e&65535)-w&65535)*6554|0)>>16;s[t+(i<<2)>>2]=w+(te(e,s[g+(i*12|0)+4>>2]<<17>>16|1)|0);i=i+1|0}s[t>>2]=(s[t>>2]|0)-(s[t+4>>2]|0);l=v;return}function Zi(e,t,i,r,a,o){e=e|0;t=t|0;i=i|0;r=r|0;a=a|0;o=o|0;var f=0,h=0,c=0,u=0,d=0,p=0,b=0,m=0,w=0,g=0,v=0,_=0,y=0;y=l;l=l+16|0;p=y+12|0;b=y+8|0;f=y+4|0;w=y;Nr(f,p,t,a);Nr(w,b,i,a);p=s[p>>2]|0;b=s[b>>2]|0;h=(p|0)>(b|0)?p:b;h=h+(h&1)|0;b=s[w>>2]>>h-b;s[w>>2]=b;p=s[f>>2]>>h-p;p=(p|0)>1?p:1;s[f>>2]=p;f=0;m=0;while(1){if((f|0)>=(a|0))break;_=m+((te(n[t+(f<<1)>>1]|0,n[i+(f<<1)>>1]|0)|0)>>h)|0;f=f+1|0;m=_}_=Yi(m,p,13)|0;_=(_|0)>16384?16384:(_|0)<-16384?-16384:_;c=_<<16>>16;u=(te(_>>16,c)|0)+((te(_&65535,c)|0)>>16)|0;i=(u|0)>0?u:0-u|0;i=(i|0)<(o|0)?o:i;v=h>>1;o=s[r>>2]|0;t=re(p|0)|0;f=24-t|0;a=0-f|0;do if(f)if((f|0)<0){f=p<>>(f+32|0);break}else{f=p<<32-f|p>>>f;break}else f=p;while(0);a=((t&1|0)==0?46214:32768)>>>(t>>>1);t=(te(f&127,13959168)|0)>>>16;g=i<<16>>16;t=te((a+((te(a>>16,t)|0)+((te(a&65535,t)|0)>>>16))<>16,g)|0;i=re(p|0)|0;f=24-i|0;a=0-f|0;do if(f)if((f|0)<0){f=p<>>(f+32|0);break}else{f=p<<32-f|p>>>f;break}else f=p;while(0);h=((i&1|0)==0?46214:32768)>>>(i>>>1);d=(te(f&127,13959168)|0)>>>16;d=o+(t+((te((h+((te(h>>16,d)|0)+((te(h&65535,d)|0)>>>16))<>16))|0;s[r>>2]=d;f=u<<16>>16;f=b-((te(m>>16,c)|0)+((te(m&65535,c)|0)>>16)<<4)+((te(p>>16,f)|0)+((te(p&65535,f)|0)>>16)<<6)|0;s[w>>2]=f;c=r+4|0;u=s[c>>2]|0;o=(f|0)<1;if(o){r=0;w=te(0-u>>16,g)|0;v=r<>16;g=w+g|0;g=u+g|0;s[c>>2]=g;v=(d|0)>1;v=v?d:1;v=Yi(g,v,14)|0;g=(v|0)>32767;w=(v|0)<0;v=w?0:v;v=g?32767:v;s[e>>2]=v;l=y;return _|0}i=re(f|0)|0;a=24-i|0;t=0-a|0;do if(a)if((a|0)<0){a=f<>>(a+32|0);break}else{a=f<<32-a|f>>>a;break}else a=f;while(0);w=((i&1|0)==0?46214:32768)>>>(i>>>1);h=(te(a&127,13959168)|0)>>>16;h=te((w+((te(w>>16,h)|0)+((te(w&65535,h)|0)>>>16))<>16,g)|0;if(o){r=0;w=h;v=r<>16;g=w+g|0;g=u+g|0;s[c>>2]=g;v=(d|0)>1;v=v?d:1;v=Yi(g,v,14)|0;g=(v|0)>32767;w=(v|0)<0;v=w?0:v;v=g?32767:v;s[e>>2]=v;l=y;return _|0}i=re(f|0)|0;a=24-i|0;t=0-a|0;do if(a)if((a|0)<0){f=f<>>(a+32|0);break}else{f=f<<32-a|f>>>a;break}while(0);w=((i&1|0)==0?46214:32768)>>>(i>>>1);r=(te(f&127,13959168)|0)>>>16;r=w+((te(w>>16,r)|0)+((te(w&65535,r)|0)>>>16))|0;w=h;v=r<>16;g=w+g|0;g=u+g|0;s[c>>2]=g;v=(d|0)>1;v=v?d:1;v=Yi(g,v,14)|0;g=(v|0)>32767;w=(v|0)<0;v=w?0:v;v=g?32767:v;s[e>>2]=v;l=y;return _|0}function Yi(e,t,i){e=e|0;t=t|0;i=i|0;var r=0,n=0,s=0,a=0;if((e|0)<=0)if(!e)n=32;else{r=0-e|0;s=3}else{r=e;s=3}if((s|0)==3)n=re(r|0)|0;e=e<>16|0)|0)<<16>>16;a=(te(e>>16,t)|0)+((te(e&65535,t)|0)>>16)|0;s=Nn(s|0,((s|0)<0)<<31>>31|0,a|0,((a|0)<0)<<31>>31|0)|0;s=Sn(s|0,I|0,29)|0;s=e-(s&-8)|0;t=a+((te(s>>16,t)|0)+((te(s&65535,t)|0)>>16))|0;r=n+28-r-i|0;if((r|0)>=0)return((r|0)<32?t>>r:0)|0;r=0-r|0;e=-2147483648>>r;n=2147483647>>>r;if((e|0)>(n|0)){if((t|0)>(e|0)){a=e;a=a<(n|0)){a=n;a=a<=15)break;l=n[25372+(a<<1)>>1]|0;u=a+1|0;d=n[25372+(u<<1)>>1]|0;d=(te((d<<16>>16)-l>>16,429522944)|0)+(((d&65535)-l&65535)*6554|0)>>16;c=a&255;f=o;h=0;while(1){if((h|0)>=5){o=f;a=u;continue e}a=l+(te(d,h<<17>>16|1)|0)|0;o=s[b>>2]|0;o=(o|0)>(a|0)?o-a|0:a-o|0;if((o|0)>=(f|0))break e;r[m>>0]=c;r[p>>0]=h;f=o;h=h+1|0;i=a}}d=r[m>>0]|0;p=(d<<24>>24|0)/3|0;r[t+(w*3|0)+2>>0]=p;r[m>>0]=(d&255)+(te(p,-3)|0);s[b>>2]=i;w=w+1|0}s[e>>2]=(s[e>>2]|0)-(s[e+4>>2]|0);return}function Xi(e,t,i,f,u,p){e=e|0;t=t|0;i=i|0;f=f|0;u=u|0;p=p|0;var b=0,m=0,w=0,g=0,v=0,_=0,y=0,k=0,E=0,A=0,S=0,M=0,T=0,R=0,x=0,C=0,I=0,P=0,O=0,N=0,D=0,L=0,B=0,U=0,j=0,F=0,z=0,G=0,V=0,W=0,K=0,Z=0,Y=0,$=0,X=0,Q=0,ee=0,ie=0,ne=0,se=0,ae=0,oe=0,fe=0,he=0,ce=0,le=0,ue=0,de=0,pe=0,be=0,me=0,we=0,ge=0,ve=0,_e=0,ye=0,ke=0,Ee=0,Ae=0,Se=0,Me=0,Te=0,Re=0,xe=0,Ce=0,Ie=0,Pe=0,Oe=0,Ne=0,De=0,Le=0,Be=0,Ue=0,je=0,Fe=0,ze=0,qe=0,He=0,Ge=0,Ve=0,We=0,Ke=0,Ze=0,Ye=0,$e=0,Xe=0,Je=0,Qe=0,et=0,tt=0,it=0,rt=0,nt=0,st=0,at=0,ot=0,ft=0,ht=0,ct=0,lt=0;ft=l;l=l+35104|0;qe=ft+272|0;ze=ft+72|0;Be=ft+29992|0;Le=ft+29352|0;le=ft+28712|0;ue=ft+28392|0;Fe=ft+48|0;je=ft+26008|0;Ue=ft+24472|0;ie=ft+11992|0;ne=ft+11896|0;Z=ft+33512|0;fe=ft+9176|0;oe=ft+6456|0;F=ft+32232|0;z=ft+31272|0;j=ft+6384|0;Pe=ft+6320|0;Ne=ft+6256|0;Oe=ft+4720|0;tt=ft+23720|0;se=ft+21032|0;nt=ft+20984|0;st=ft+24|0;at=ft;it=ft+16536|0;rt=ft+12088|0;et=ft+12072|0;Je=ft+33824|0;Qe=ft+12056|0;$e=ft+33816|0;Xe=ft+12040|0;s[Qe>>2]=0;s[Qe+4>>2]=0;s[Qe+8>>2]=0;s[Qe+12>>2]=0;Ke=e+4712|0;Ze=s[Ke>>2]|0;s[Ke>>2]=Ze+1;Ke=e+4862|0;r[Ke>>0]=Ze&3;Ze=e+4684|0;ce=s[Ze>>2]|0;Ye=e+7272+(ce<<2)|0;ce=se+(ce<<2)|0;D=e+5190|0;We=e+4676|0;b=s[We>>2]|0;g=s[e+28>>2]|0;if(g){v=e+24|0;_=s[v>>2]|0;w=256-_<<10;E=w>>16;w=w-(E<<16)|0;e:do if((E|0)<4){if((w|0)<=0){He=17528+(E*12|0)|0;s[qe>>2]=s[He>>2];s[qe+4>>2]=s[He+4>>2];s[qe+8>>2]=s[He+8>>2];He=17588+(E<<3)|0;Ge=s[He+4>>2]|0;Ve=ze;s[Ve>>2]=s[He>>2];s[Ve+4>>2]=Ge;break}A=E+1|0;S=w<<16>>16;if((w|0)<32768){w=0;while(1){if((w|0)==3){w=0;break}Ge=s[17528+(E*12|0)+(w<<2)>>2]|0;Ve=(s[17528+(A*12|0)+(w<<2)>>2]|0)-Ge|0;s[qe+(w<<2)>>2]=Ge+((te(Ve>>16,S)|0)+((te(Ve&65535,S)|0)>>16));w=w+1|0}while(1){if((w|0)==2)break e;Ge=s[17588+(E<<3)+(w<<2)>>2]|0;Ve=(s[17588+(A<<3)+(w<<2)>>2]|0)-Ge|0;s[ze+(w<<2)>>2]=Ge+((te(Ve>>16,S)|0)+((te(Ve&65535,S)|0)>>16));w=w+1|0}}else{w=0;while(1){if((w|0)==3){w=0;break}Ge=s[17528+(A*12|0)+(w<<2)>>2]|0;Ve=Ge-(s[17528+(E*12|0)+(w<<2)>>2]|0)|0;s[qe+(w<<2)>>2]=Ge+((te(Ve>>16,S)|0)+((te(Ve&65535,S)|0)>>16));w=w+1|0}while(1){if((w|0)==2)break e;Ge=s[17588+(A<<3)+(w<<2)>>2]|0;Ve=Ge-(s[17588+(E<<3)+(w<<2)>>2]|0)|0;s[ze+(w<<2)>>2]=Ge+((te(Ve>>16,S)|0)+((te(Ve&65535,S)|0)>>16));w=w+1|0}}}else{s[qe>>2]=s[4394];s[qe+4>>2]=s[4395];s[qe+8>>2]=s[4396];Ve=ze;s[Ve>>2]=35497197;s[Ve+4>>2]=57401098}while(0);w=_+g|0;s[v>>2]=(w|0)>256?256:(w|0)<0?0:w;w=e+16|0;S=0-(s[ze>>2]|0)|0;g=S&16383;x=0-(s[ze+4>>2]|0)|0;v=x&16383;E=s[qe>>2]|0;_=E>>16;E=E&65535;A=e+20|0;S=S>>>14<<16>>16;T=s[qe+4>>2]|0;M=T>>16;T=T&65535;x=x>>>14<<16>>16;I=s[qe+8>>2]|0;C=I>>16;I=I&65535;P=0;while(1){if((P|0)>=(b|0))break;Ve=D+(P<<1)|0;He=n[Ve>>1]|0;Ge=(s[w>>2]|0)+((te(_,He)|0)+((te(E,He)|0)>>16))<<2;Ce=Ge>>16;Ie=Ge&65532;s[w>>2]=(s[A>>2]|0)+(((te(Ce,g)|0)+((te(Ie,g)|0)>>>16)>>13)+1>>1)+((te(Ce,S)|0)+((te(Ie,S)|0)>>16))+((te(M,He)|0)+((te(T,He)|0)>>16));s[A>>2]=(((te(Ce,v)|0)+((te(Ie,v)|0)>>>16)>>13)+1>>1)+((te(Ce,x)|0)+((te(Ie,x)|0)>>16))+((te(C,He)|0)+((te(I,He)|0)>>16));Ge=Ge+16383>>14;n[Ve>>1]=(Ge|0)>32767?32767:((Ge|0)<-32768?-32768:Ge)&65535;P=P+1|0}b=s[We>>2]|0}Ve=e+4668|0;g=Ye+((s[Ve>>2]|0)*5<<2)|0;while(1){w=b+-1|0;if((b|0)<=0){b=0;break}h[g+(w<<2)>>2]=+(n[D+(w<<1)>>1]|0);b=w}while(1){if((b|0)==8)break;Ge=Ye+(((s[Ve>>2]|0)*5|0)+(te(b,s[We>>2]>>3)|0)<<2)|0;h[Ge>>2]=+h[Ge>>2]+ +(1-(b&2)|0)*9.999999974752427e-7;b=b+1|0}Ge=e+4772|0;e:do if(!(s[Ge>>2]|0)){v=s[e+4688>>2]|0;M=s[Ze>>2]|0;S=v+(s[We>>2]|0)+M|0;M=Ye+(0-M<<2)|0;_=s[e+4640>>2]|0;b=M+(S<<2)+(0-_<<2)|0;y=3.1415927410125732/+(v+1|0);k=2-y*y;m=0;w=0;while(1){if((w|0)>=(v|0))break;h[Oe+(w<<2)>>2]=+h[b+(w<<2)>>2]*.5*(m+y);He=w|1;h[Oe+(He<<2)>>2]=+h[b+(He<<2)>>2]*y;U=k*y-m;He=w|2;h[Oe+(He<<2)>>2]=+h[b+(He<<2)>>2]*.5*(y+U);He=w|3;h[Oe+(He<<2)>>2]=+h[b+(He<<2)>>2]*U;m=U;y=k*U-y;w=w+4|0}He=Oe+(v<<2)|0;g=b+(v<<2)|0;w=_-(v<<1)|0;Mn(He|0,g|0,w<<2|0)|0;b=He+(w<<2)|0;w=g+(w<<2)|0;m=1;y=k*.5;g=0;while(1){if((g|0)>=(v|0))break;h[b+(g<<2)>>2]=+h[w+(g<<2)>>2]*.5*(m+y);He=g|1;h[b+(He<<2)>>2]=+h[w+(He<<2)>>2]*y;U=k*y-m;He=g|2;h[b+(He<<2)>>2]=+h[w+(He<<2)>>2]*.5*(y+U);He=g|3;h[b+(He<<2)>>2]=+h[w+(He<<2)>>2]*U;m=U;y=k*U-y;g=g+4|0}A=e+4740|0;E=s[A>>2]|0;b=(E|0)<(_|0)?E+1|0:_;w=0;while(1){if((w|0)>=(b|0))break;h[j+(w<<2)>>2]=+ir(Oe,Oe+(w<<2)|0,_-w|0);w=w+1|0}y=+h[j>>2];y=y+(y*.0010000000474974513+1);h[j>>2]=y;b=0;while(1){if((b|0)>(E|0))break;U=+h[j+(b<<2)>>2];c[qe+(b<<4)+8>>3]=U;c[qe+(b<<4)>>3]=U;b=b+1|0}he=qe+8|0;g=0;t:while(1){if((E|0)<=(g|0))break;b=g+1|0;m=+c[he>>3];m=-+c[qe+(b<<4)>>3]/(m>9.999999717180685e-10?m:9.999999717180685e-10);h[Ne+(g<<2)>>2]=m;w=E-g|0;v=0;while(1){if((v|0)>=(w|0)){g=b;continue t}Ie=qe+(v+g+1<<4)|0;U=+c[Ie>>3];He=qe+(v<<4)+8|0;B=+c[He>>3];c[Ie>>3]=U+B*m;c[He>>3]=B+U*m;v=v+1|0}}U=+c[he>>3];ae=tt+704|0;h[ae>>2]=y/(U>1?U:1);g=0;while(1){if((g|0)>=(E|0))break;m=+h[Ne+(g<<2)>>2];b=g+1|0;w=b>>1;v=0;while(1){if((v|0)>=(w|0))break;Ie=Pe+(v<<2)|0;U=+h[Ie>>2];He=Pe+(g-v+-1<<2)|0;B=+h[He>>2];h[Ie>>2]=U+B*m;h[He>>2]=B+U*m;v=v+1|0}h[Pe+(g<<2)>>2]=-m;g=b}b=E+-1|0;m=.9900000095367432;w=0;while(1){if((w|0)>=(b|0))break;He=Pe+(w<<2)|0;h[He>>2]=+h[He>>2]*m;m=m*.9900000095367432;w=w+1|0}He=Pe+(b<<2)|0;h[He>>2]=+h[He>>2]*m;Ji(se,Pe,M,S,E);He=e+4857|0;b=r[He>>0]|0;do if(b<<24>>24!=0?(s[e+4756>>2]|0)==0:0){R=.6000000238418579-+(s[A>>2]|0)*.004000000189989805-+(s[e+4624>>2]|0)*.10000000149011612*.00390625-+(r[e+4633>>0]>>1|0)*.15000000596046448-+(s[e+4804>>2]|0)*.10000000149011612*30517578125e-15;D=tt+228|0;Q=e+4854|0;ee=e+4856|0;j=e+10152|0;I=s[e+4636>>2]|0;k=+(s[e+4744>>2]|0)*152587890625e-16;V=s[Ve>>2]|0;W=s[e+4736>>2]|0;$=s[e+4672>>2]|0;E=te(($*5|0)+20|0,V)|0;C=$*20|0;w=C+80|0;x=($*40|0)+160|0;K=V*5|0;X=V<<1;Y=V*18|0;G=Y+-1|0;P=(V|0)==16;t:do if(P){b=E;while(1){_=b+-1|0;if((b|0)<=0)break;m=+h[se+(_<<2)>>2];g=(h[d>>2]=m,s[d>>2]|0);v=(g&2130706432)>>>0>1249902592;if(!v){b=(g|0)<0;y=b?m+-8388608+8388608:m+8388608+-8388608;if(y==0)y=b?-0:0}else y=m;if((~~y|0)<=32767){if(!v){b=(g|0)<0;y=b?m+-8388608+8388608:m+8388608+-8388608;if(y==0)y=b?-0:0}else y=m;if((~~y|0)<-32768)b=-32768;else{if(!v){b=(g|0)<0;m=b?m+-8388608+8388608:m+8388608+-8388608;if(m==0)m=b?-0:0}b=~~m}}else b=32767;n[F+(_<<1)>>1]=b;b=_}g=Fe;s[g>>2]=0;s[g+4>>2]=0;Pr(Fe,le,F,E);g=x;while(1){b=g+-1|0;if((g|0)<=0){b=le;break t}h[Be+(b<<2)>>2]=+(n[le+(b<<1)>>1]|0); +g=b}}else{if((V|0)==12)b=E;else{b=x;while(1){_=b+-1|0;if((b|0)<=0)break;m=+h[se+(_<<2)>>2];g=(h[d>>2]=m,s[d>>2]|0);v=(g&2130706432)>>>0>1249902592;if(!v){b=(g|0)<0;y=b?m+-8388608+8388608:m+8388608+-8388608;if(y==0)y=b?-0:0}else y=m;if((~~y|0)<=32767){if(!v){b=(g|0)<0;y=b?m+-8388608+8388608:m+8388608+-8388608;if(y==0)y=b?-0:0}else y=m;if((~~y|0)<-32768)b=-32768;else{if(!v){b=(g|0)<0;m=b?m+-8388608+8388608:m+8388608+-8388608;if(m==0)m=b?-0:0}b=~~m}}else b=32767;n[le+(_<<1)>>1]=b;b=_}b=le;break}while(1){_=b+-1|0;if((b|0)<=0)break;m=+h[se+(_<<2)>>2];g=(h[d>>2]=m,s[d>>2]|0);v=(g&2130706432)>>>0>1249902592;if(!v){b=(g|0)<0;y=b?m+-8388608+8388608:m+8388608+-8388608;if(y==0)y=b?-0:0}else y=m;if((~~y|0)<=32767){if(!v){b=(g|0)<0;y=b?m+-8388608+8388608:m+8388608+-8388608;if(y==0)y=b?-0:0}else y=m;if((~~y|0)<-32768)b=-32768;else{if(!v){b=(g|0)<0;m=b?m+-8388608+8388608:m+8388608+-8388608;if(m==0)m=b?-0:0}b=~~m}}else b=32767;n[z+(_<<1)>>1]=b;b=_}s[Fe>>2]=0;s[Fe+4>>2]=0;s[Fe+8>>2]=0;s[Fe+12>>2]=0;s[Fe+16>>2]=0;s[Fe+20>>2]=0;s[qe>>2]=0;s[qe+4>>2]=0;s[qe+8>>2]=0;s[qe+12>>2]=0;S=Fe+16|0;M=qe+16|0;T=Fe+20|0;_=le;A=z;b=E;while(1){E=(b|0)<480?b:480;g=0;while(1){if((g|0)>=(E|0)){g=qe;v=E;break}Ie=(s[S>>2]|0)+(n[A+(g<<1)>>1]<<8)|0;s[M+(g<<2)>>2]=Ie;Ie=Ie<<2;Ce=Ie>>16;Ie=Ie&65532;s[S>>2]=(s[T>>2]|0)+((te(Ce,-2797)|0)+((te(Ie,-2797)|0)>>16));s[T>>2]=(te(Ce,-6507)|0)+((te(Ie,-6507)|0)>>16);g=g+1|0}while(1){if((v|0)<=2)break;Se=s[g>>2]|0;Te=g+4|0;Me=s[Te>>2]|0;Re=g+8|0;Ce=s[Re>>2]|0;Ie=g+12|0;xe=s[Ie>>2]|0;xe=(((Se>>16)*4697|0)+(((Se&65535)*4697|0)>>>16)+(((Me>>16)*10739|0)+(((Me&65535)*10739|0)>>>16))+(((Ce>>16)*8276|0)+(((Ce&65535)*8276|0)>>>16))+(((xe>>16)*1567|0)+(((xe&65535)*1567|0)>>>16))>>5)+1>>1;n[_>>1]=(xe|0)>32767?32767:((xe|0)<-32768?-32768:xe)&65535;Te=s[Te>>2]|0;Re=s[Re>>2]|0;xe=s[Ie>>2]|0;Ce=s[g+16>>2]|0;Ce=(((Te>>16)*1567|0)+(((Te&65535)*1567|0)>>>16)+(((Re>>16)*8276|0)+(((Re&65535)*8276|0)>>>16))+(((xe>>16)*10739|0)+(((xe&65535)*10739|0)>>>16))+(((Ce>>16)*4697|0)+(((Ce&65535)*4697|0)>>>16))>>5)+1>>1;n[_+2>>1]=(Ce|0)>32767?32767:((Ce|0)<-32768?-32768:Ce)&65535;_=_+4|0;g=Ie;v=v+-3|0}b=b-E|0;if((b|0)<=0)break;Ie=qe+(E<<2)|0;s[qe>>2]=s[Ie>>2];s[qe+4>>2]=s[Ie+4>>2];s[qe+8>>2]=s[Ie+8>>2];s[qe+12>>2]=s[Ie+12>>2];A=A+(E<<1)|0}g=qe+(E<<2)|0;s[Fe>>2]=s[g>>2];s[Fe+4>>2]=s[g+4>>2];s[Fe+8>>2]=s[g+8>>2];s[Fe+12>>2]=s[g+12>>2];g=x;while(1){b=g+-1|0;if((g|0)<=0){b=le;break t}h[Be+(b<<2)>>2]=+(n[le+(b<<1)>>1]|0);g=b}}while(0);Ie=Fe;s[Ie>>2]=0;s[Ie+4>>2]=0;Pr(Fe,ue,b,x);while(1){b=w+-1|0;if((w|0)<=0)break;h[Le+(b<<2)>>2]=+(n[ue+(b<<1)>>1]|0);w=b}b=C+79|0;while(1){if((b|0)<=0)break;w=Le+(b<<2)|0;b=b+-1|0;m=+(~~+h[w>>2]|0)+ +h[Le+(b<<2)>>2];if(!(m>32767)){if(m<-32768)m=-32768}else m=32767;h[w>>2]=+(~~m<<16>>16)}kn(je|0,0,$*596|0)|0;b=$>>1;w=Ue+256|0;A=je+32|0;_=0;E=Le+320|0;while(1){if((_|0)>=(b|0)){b=72;break}g=E+-32|0;mi(E,E+-288|0,Ue,40,65);U=+h[w>>2];m=+tr(E,40);m=m+ +tr(g,40)+16e4;h[A>>2]=+h[A>>2]+U*2/m;v=9;while(1){if((v|0)==73)break;Ie=g+-4|0;B=+h[Ie>>2];U=+h[g+156>>2];U=m+(B*B-U*U);Ce=je+(v<<2)|0;h[Ce>>2]=+h[Ce>>2]+ +h[Ue+(72-v<<2)>>2]*2/U;g=Ie;v=v+1|0;m=U}_=_+1|0;E=E+160|0}while(1){if((b|0)<=7)break;Ie=je+(b<<2)|0;U=+h[Ie>>2];h[Ie>>2]=U-U*+(b|0)*.000244140625;b=b+-1|0}E=W<<1;w=E+4|0;b=0;while(1){if((b|0)>=(w|0)){b=1;break}s[ne+(b<<2)>>2]=b;b=b+1|0}while(1){if((b|0)>=(w|0))break;m=+h[A+(b<<2)>>2];v=b;while(1){g=v+-1|0;if((v|0)<=0)break;y=+h[A+(g<<2)>>2];if(!(m>y))break;h[A+(v<<2)>>2]=y;s[ne+(v<<2)>>2]=s[ne+(g<<2)>>2];v=g}h[A+(v<<2)>>2]=m;s[ne+(v<<2)>>2]=b;b=b+1|0}_=A+(E+3<<2)|0;b=E+2|0;g=w;while(1){if((g|0)>=65)break;m=+h[A+(g<<2)>>2];if(m>+h[_>>2]){v=b;while(1){if((v|0)<=-1)break;y=+h[A+(v<<2)>>2];if(!(m>y))break;Ie=v+1|0;h[A+(Ie<<2)>>2]=y;s[ne+(Ie<<2)>>2]=s[ne+(v<<2)>>2];v=v+-1|0}Ie=v+1|0;h[A+(Ie<<2)>>2]=m;s[ne+(Ie<<2)>>2]=g}g=g+1|0}m=+h[A>>2];do if(m<.20000000298023224){kn(D|0,0,$<<2|0)|0;h[j>>2]=0;n[Q>>1]=0;r[ee>>0]=0;b=0}else{m=m*k;b=0;while(1){if((b|0)>=(w|0))break;if(!(+h[je+(b+8<<2)>>2]>m)){w=b;break}Ie=ne+(b<<2)|0;s[Ie>>2]=(s[Ie>>2]<<1)+16;b=b+1|0}b=11;while(1){if((b|0)==148){b=0;break}n[Z+(b<<1)>>1]=0;b=b+1|0}while(1){if((b|0)>=(w|0)){b=146;break}n[Z+(s[ne+(b<<2)>>2]<<1)>>1]=1;b=b+1|0}while(1){if((b|0)<=15){w=16;C=0;break}Ie=b+-1|0;Ce=Z+(b<<1)|0;n[Ce>>1]=(o[Ce>>1]|0)+((o[Z+(Ie<<1)>>1]|0)+(o[Z+(b+-2<<1)>>1]|0));b=Ie}while(1){if((w|0)==144){b=146;break}b=w+1|0;if((n[Z+(b<<1)>>1]|0)<=0){w=b;continue}s[ne+(C<<2)>>2]=w;w=b;C=C+1|0}while(1){if((b|0)<=15){w=16;b=0;break}Ie=b+-1|0;Ce=Z+(b<<1)|0;n[Ce>>1]=(o[Ce>>1]|0)+((o[Z+(Ie<<1)>>1]|0)+(o[Z+(b+-2<<1)>>1]|0)+(o[Z+(b+-3<<1)>>1]|0));b=Ie}while(1){if((w|0)==147)break;if((n[Z+(w<<1)>>1]|0)>0){n[Z+(b<<1)>>1]=w+65534;b=b+1|0}w=w+1|0}kn(je|0,0,2384)|0;A=(V|0)==8;_=0;E=A?se+640|0:Be+640|0;while(1){if((_|0)>=($|0))break;y=+tr(E,40)+1;v=0;while(1){if((v|0)>=(b|0))break;g=n[Z+(v<<1)>>1]|0;w=E+(0-g<<2)|0;m=+ir(w,E,40);if(m>0)m=m*2/(+tr(w,40)+y);else m=0;h[je+(_*596|0)+(g<<2)>>2]=m;v=v+1|0}_=_+1|0;E=E+160|0}if((I|0)>0){if((V|0)==12)b=(I<<1|0)/3|0;else b=I>>(P&1);w=b;U=+zr(+(b|0))*3.32192809488736}else{w=I;U=0}F=($|0)==4;if(F){T=32969;x=11;M=A&(W|0)>0?11:3}else{T=32935;x=3;M=3}L=+($|0);B=L*.20000000298023224;A=(w|0)>0;R=L*R;w=0;O=0;N=-1e3;E=0;S=-1;while(1){if((E|0)>=(C|0))break;_=s[ne+(E<<2)>>2]|0;v=0;while(1){if((v|0)>=(M|0)){g=0;k=-1e3;b=0;break}b=ie+(v<<2)|0;h[b>>2]=0;m=0;g=0;while(1){if((g|0)>=($|0))break;k=m+ +h[je+(g*596|0)+(_+(r[T+((te(g,x)|0)+v)>>0]|0)<<2)>>2];h[b>>2]=k;m=k;g=g+1|0}v=v+1|0}while(1){if((b|0)>=(M|0))break;y=+h[ie+(b<<2)>>2];Ie=y>k;g=Ie?b:g;k=Ie?y:k;b=b+1|0}y=+zr(+(_|0))*3.32192809488736;m=k-B*y;if(A){y=y-U;y=y*y;m=m-B*+h[j>>2]*y/(y+.5)}Ie=m>N&k>R;w=Ie?g:w;O=Ie?k:O;N=Ie?m:N;E=E+1|0;S=Ie?_:S}if((S|0)==-1){s[D>>2]=0;s[D+4>>2]=0;s[D+8>>2]=0;s[D+12>>2]=0;h[j>>2]=0;n[Q>>1]=0;r[ee>>0]=0;b=0;break}h[j>>2]=O/L;if((V|0)>8){if((V|0)==12){b=(S<<16>>16)*3|0;b=(b>>1)+(b&1)|0}else b=S<<1;if((X|0)<(Y|0))if((b|0)<(Y|0))E=(b|0)<(X|0)?X:b;else E=G;else if((b|0)>(X|0))E=X;else E=(b|0)<(G|0)?G:b;D=E+-2|0;D=(D|0)>(X|0)?D:X;j=E+2|0;j=(j|0)<(G|0)?j:G;if(F){T=33013;x=33149+(W<<3)|0;C=34;I=r[33173+W>>0]|0}else{T=32941;x=32965;C=12;I=12}P=se+(V*20<<2)|0;_=0-D|0;S=0;M=P;while(1){if((S|0)>=($|0))break;b=S<<1;A=r[x+b>>0]|0;b=r[x+(b|1)>>0]|0;mi(M,M+(_<<2)+(0-b<<2)|0,qe,K,b-A+1|0);w=A;g=0;while(1){if((b|0)<(w|0))break;s[ze+(g<<2)>>2]=s[qe+(b-w<<2)>>2];w=w+1|0;g=g+1|0}b=te(S,C)|0;g=0;while(1){if((g|0)>=(I|0))break;w=(r[T+(b+g)>>0]|0)-A|0;v=0;while(1){if((v|0)==5)break;s[oe+(S*680|0)+(g*20|0)+(v<<2)>>2]=s[ze+(w+v<<2)>>2];v=v+1|0}g=g+1|0}S=S+1|0;M=M+(K<<2)|0}if(F){A=33013;S=33149+(W<<3)|0;M=34;x=r[33173+W>>0]|0}else{A=32941;S=32965;M=12;x=12}T=0;C=P;while(1){if((T|0)>=($|0))break;w=T<<1;_=r[S+w>>0]|0;b=C+(0-(_+D)<<2)|0;m=+tr(b,K)+.001;h[ze>>2]=m;w=(r[S+(w|1)>>0]|0)-_|0;g=1;while(1){if((g|0)>(w|0))break;B=+h[b+(K-g<<2)>>2];U=+h[b+(0-g<<2)>>2];U=m-B*B+U*U;h[ze+(g<<2)>>2]=U;m=U;g=g+1|0}b=te(T,M)|0;g=0;while(1){if((g|0)>=(x|0))break;w=(r[A+(b+g)>>0]|0)-_|0;v=0;while(1){if((v|0)==5)break;s[fe+(T*680|0)+(g*20|0)+(v<<2)>>2]=s[ze+(w+v<<2)>>2];v=v+1|0}g=g+1|0}T=T+1|0;C=C+(K<<2)|0}O=.05000000074505806/+(E|0);if(F){M=33013;T=34;S=r[33173+W>>0]|0}else{M=32941;T=12;S=12}R=+tr(P,te(K,$)|0)+1;w=0;m=-1e3;_=D;A=0;while(1){if((_|0)>(j|0))break;else{v=0;b=E}while(1){if((v|0)<(S|0)){y=0;k=R;g=0}else break;while(1){if((g|0)>=($|0))break;y=y+ +h[oe+(g*680|0)+(v*20|0)+(A<<2)>>2];k=k+ +h[fe+(g*680|0)+(v*20|0)+(A<<2)>>2];g=g+1|0}if(y>0)y=y*2/k*(1-O*+(v|0));else y=0;if(y>m){Ie=(_+(r[33013+v>>0]|0)|0)<(Y|0);w=Ie?v:w;m=Ie?y:m;b=Ie?_:b}v=v+1|0}_=_+1|0;A=A+1|0;E=b}g=(X|0)>(Y|0);_=0;while(1){if((_|0)>=($|0))break;b=E+(r[M+((te(_,T)|0)+w)>>0]|0)|0;v=tt+228+(_<<2)|0;s[v>>2]=b;do if(g){if((b|0)>(X|0)){b=X;break}b=(b|0)<(Y|0)?Y:b}else{if((b|0)>(Y|0)){b=Y;break}b=(b|0)<(X|0)?X:b}while(0);s[v>>2]=b;_=_+1|0}b=E-X|0}else{b=0;while(1){if((b|0)>=($|0))break;Ie=S+(r[T+((te(b,x)|0)+w)>>0]|0)|0;s[tt+228+(b<<2)>>2]=(Ie|0)>144?144:(Ie|0)<16?16:Ie;b=b+1|0}b=S+65520|0}n[Q>>1]=b;r[ee>>0]=w;b=1}while(0);if(b){r[He>>0]=2;b=2;break}else{r[He>>0]=1;b=1;break}}else ot=264;while(0);if((ot|0)==264){Ie=tt+228|0;s[Ie>>2]=0;s[Ie+4>>2]=0;s[Ie+8>>2]=0;s[Ie+12>>2]=0;n[e+4854>>1]=0;r[e+4856>>0]=0;h[e+10152>>2]=0}A=Ye+(0-(s[e+4692>>2]|0)<<2)|0;Te=e+4808|0;y=+(s[Te>>2]|0);m=y*.0078125;j=s[e+4788>>2]|0;k=+(j+(s[e+4792>>2]|0)|0)*.5*30517578125e-15;Re=tt+696|0;h[Re>>2]=k;N=1/(+J(+-((m+-20)*.25))+1);xe=tt+700|0;h[xe>>2]=N;if(!(s[e+4768>>2]|0)){U=1-+(s[e+4624>>2]|0)*.00390625;m=m-N*2*(k*.5+.5)*U*U}F=b<<24>>24==2;do if(!F){O=m+(y*-.4000000059604645*.0078125+6)*(1-k);w=s[Ve>>2]<<1;_=e+4672|0;b=s[_>>2]|0;E=((b<<16>>16)*5|0)/2|0;k=+(w|0);m=0;g=0;y=0;v=ce;while(1){if((g|0)>=(E|0))break;R=+zr(k+ +tr(v,w))*3.32192809488736;if((g|0)>0)m=m+ +q(+(R-y));g=g+1|0;y=R;v=v+(w<<2)|0}w=e+4858|0;if(m>+(E+-1|0)*.6000000238418579){r[w>>0]=0;Ie=_;break}else{r[w>>0]=1;Ie=_;break}}else{O=m+ +h[e+10152>>2]*2;r[e+4858>>0]=0;b=e+4672|0;Ie=b;b=s[b>>2]|0}while(0);B=+h[ae>>2]*.0010000000474974513;B=.9399999976158142/(B*B+1);D=s[e+4764>>2]|0;R=+(D|0)*152587890625e-16+N*.009999999776482582;C=e+4696|0;Ce=e+4680|0;I=e+4728|0;N=R;L=1-R*R;P=0;E=A;while(1){if((P|0)>=(b|0))break;w=s[Ve>>2]|0;g=w*3|0;A=s[C>>2]|0;_=(A-g|0)/2|0;y=3.1415927410125732/+(_+1|0);k=2-y*y;m=0;v=0;while(1){if((v|0)>=(_|0))break;h[Be+(v<<2)>>2]=+h[E+(v<<2)>>2]*.5*(m+y);Me=v|1;h[Be+(Me<<2)>>2]=+h[E+(Me<<2)>>2]*y;U=k*y-m;Me=v|2;h[Be+(Me<<2)>>2]=+h[E+(Me<<2)>>2]*.5*(y+U);Me=v|3;h[Be+(Me<<2)>>2]=+h[E+(Me<<2)>>2]*U;m=U;y=k*U-y;v=v+4|0}Mn(Be+(_<<2)|0,E+(_<<2)|0,w*12|0)|0;g=_+g|0;w=Be+(g<<2)|0;g=E+(g<<2)|0;m=1;y=k*.5;v=0;while(1){if((v|0)>=(_|0))break;h[w+(v<<2)>>2]=+h[g+(v<<2)>>2]*.5*(m+y);Me=v|1;h[w+(Me<<2)>>2]=+h[g+(Me<<2)>>2]*y;U=k*y-m;Me=v|2;h[w+(Me<<2)>>2]=+h[g+(Me<<2)>>2]*.5*(y+U);Me=v|3;h[w+(Me<<2)>>2]=+h[g+(Me<<2)>>2]*U;m=U;y=k*U-y;v=v+4|0}E=E+(s[Ce>>2]<<2)|0;S=(D|0)>0;x=s[I>>2]|0;t:do if(S){kn(qe|0,0,200)|0;kn(ze|0,0,200)|0;g=qe+(x<<3)|0;v=ze+(x<<3)|0;m=0;_=0;while(1){if((_|0)>=(A|0)){w=0;break}w=0;y=+h[Be+(_<<2)>>2];while(1){if((w|0)>=(x|0))break;Se=w|1;Ae=qe+(Se<<3)|0;ht=+c[Ae>>3];U=m+N*(ht-y);c[qe+(w<<3)>>3]=y;Me=ze+(w<<3)|0;c[Me>>3]=+c[Me>>3]+ +c[qe>>3]*y;Me=w+2|0;k=+c[qe+(Me<<3)>>3];c[Ae>>3]=U;Se=ze+(Se<<3)|0;c[Se>>3]=+c[Se>>3]+ +c[qe>>3]*U;m=k;w=Me;y=ht+N*(k-U)}c[g>>3]=y;m=+c[qe>>3];c[v>>3]=+c[v>>3]+m*y;_=_+1|0}while(1){if((w|0)>(x|0))break;h[Le+(w<<2)>>2]=+c[ze+(w<<3)>>3];w=w+1|0}}else{w=(x|0)<(A|0)?x+1|0:A;g=0;while(1){if((g|0)>=(w|0))break t;h[Le+(g<<2)>>2]=+ir(Be,Be+(g<<2)|0,A-g|0);g=g+1|0}}while(0);ht=+h[Le>>2];h[Le>>2]=ht+(ht*29999999242136255e-21+1);w=0;while(1){if((w|0)>(x|0)){v=0;break}ht=+h[Le+(w<<2)>>2];c[qe+(w<<4)+8>>3]=ht;c[qe+(w<<4)>>3]=ht;w=w+1|0}t:while(1){if((x|0)<=(v|0))break;w=v+1|0;m=+c[he>>3];m=-+c[qe+(w<<4)>>3]/(m>9.999999717180685e-10?m:9.999999717180685e-10);h[le+(v<<2)>>2]=m;g=x-v|0;_=0;while(1){if((_|0)>=(g|0)){v=w;continue t}Se=qe+(_+v+1<<4)|0;ht=+c[Se>>3];Me=qe+(_<<4)+8|0;U=+c[Me>>3];c[Se>>3]=ht+U*m;c[Me>>3]=U+ht*m;_=_+1|0}}m=+c[he>>3];T=tt+244+(P*24<<2)|0;v=0;while(1){if((v|0)>=(x|0))break;y=+h[le+(v<<2)>>2];w=v+1|0;g=w>>1;_=0;while(1){if((_|0)>=(g|0))break;Se=T+(_<<2)|0;ht=+h[Se>>2];Me=T+(v-_+-1<<2)|0;U=+h[Me>>2];h[Se>>2]=ht+U*y;h[Me>>2]=U+ht*y;_=_+1|0}h[T+(v<<2)>>2]=-y;v=w}y=+H(+m);w=tt+(P<<2)|0;h[w>>2]=y;M=x+-1|0;if(S){m=+h[T+(M<<2)>>2];g=x+-2|0;while(1){m=R*m;if((g|0)<=-1)break;m=+h[T+(g<<2)>>2]-m;g=g+-1|0}h[w>>2]=y*(1/(m+1));m=B;w=0}else{m=B;w=0}while(1){if((w|0)>=(M|0))break;Me=T+(w<<2)|0;h[Me>>2]=+h[Me>>2]*m;m=m*B;w=w+1|0}A=T+(M<<2)|0;m=+h[A>>2]*m;h[A>>2]=m;t:do if(S){w=x;while(1){if((w|0)<=1)break;Me=T+(w+-2<<2)|0;ht=+h[Me>>2]-m*R;h[Me>>2]=ht;m=ht;w=w+-1|0}m=L/(+h[T>>2]*R+1);w=0;while(1){if((w|0)>=(x|0)){w=0;_=0;break}Me=T+(w<<2)|0;h[Me>>2]=+h[Me>>2]*m;w=w+1|0}while(1){if((_|0)<10){g=0;v=w;y=-1}else break t;while(1){if((g|0)>=(x|0))break;ht=+q(+ +h[T+(g<<2)>>2]);Me=ht>y;Se=Me?g:v;g=g+1|0;v=Se;y=Me?ht:y}if(!(y<=3.999000072479248))w=1;else break t;while(1){if((w|0)>=(x|0))break;Me=T+(w+-1<<2)|0;h[Me>>2]=+h[Me>>2]+ +h[T+(w<<2)>>2]*R;w=w+1|0}m=1/m;w=0;while(1){if((w|0)>=(x|0))break;Me=T+(w<<2)|0;h[Me>>2]=+h[Me>>2]*m;w=w+1|0}m=.9900000095367432-(+(_|0)*.10000000149011612+.800000011920929)*(y+-3.999000072479248)/(y*+(v+1|0));y=m;w=0;while(1){if((w|0)>=(M|0))break;Me=T+(w<<2)|0;h[Me>>2]=+h[Me>>2]*y;y=y*m;w=w+1|0}m=+h[A>>2]*y;h[A>>2]=m;w=x;while(1){if((w|0)<=1)break;Me=T+(w+-2<<2)|0;ht=+h[Me>>2]-m*R;h[Me>>2]=ht;m=ht;w=w+-1|0}m=L/(+h[T>>2]*R+1);w=0;while(1){if((w|0)>=(x|0))break;Me=T+(w<<2)|0;h[Me>>2]=+h[Me>>2]*m;w=w+1|0}w=v;_=_+1|0}}else{w=0;v=0;while(1){if((v|0)<10){g=0;m=-1}else break t;while(1){if((g|0)>=(x|0))break;ht=+q(+ +h[T+(g<<2)>>2]);Me=ht>m;Se=Me?g:w;g=g+1|0;w=Se;m=Me?ht:m}if(m<=3.999000072479248)break t;m=.9900000095367432-(+(v|0)*.10000000149011612+.800000011920929)*(m+-3.999000072479248)/(m*+(w+1|0));y=m;g=0;while(1){if((g|0)>=(M|0))break;Me=T+(g<<2)|0;h[Me>>2]=+h[Me>>2]*y;y=y*m;g=g+1|0}h[A>>2]=+h[A>>2]*y;v=v+1|0}}while(0);P=P+1|0}m=+mt(+(O*-.1599999964237213));w=0;while(1){if((w|0)>=(b|0))break;Me=tt+(w<<2)|0;h[Me>>2]=+h[Me>>2]*m+1.2483305931091309;w=w+1|0}Me=e+4624|0;m=+(s[Me>>2]|0);y=((+(j|0)*30517578125e-15+-1)*.5+1)*4*(m*.00390625);t:do if(F){w=0;while(1){if((w|0)>=(b|0))break;ht=.20000000298023224/+(s[Ve>>2]|0)+3/+(s[tt+228+(w<<2)>>2]|0);h[tt+628+(w<<2)>>2]=ht+-1;h[tt+644+(w<<2)>>2]=1-ht-ht*y;w=w+1|0}y=-.25-m*.26249998807907104*.00390625}else{ht=1.2999999523162842/+(s[Ve>>2]|0);g=tt+628|0;h[g>>2]=ht+-1;v=tt+644|0;h[v>>2]=1-ht-ht*y*.6000000238418579;w=1;while(1){if((w|0)>=(b|0)){y=-.25;break t}s[tt+628+(w<<2)>>2]=s[g>>2];s[tt+644+(w<<2)>>2]=s[v>>2];w=w+1|0}}while(0);if(F)m=((1-(1-+h[xe>>2])*+h[Re>>2])*.20000000298023224+.30000001192092896)*+H(+ +h[e+10152>>2]);else m=0;w=e+7264|0;g=e+7268|0;v=0;while(1){if((v|0)>=(b|0))break;ht=+h[w>>2];ht=ht+(m-ht)*.4000000059604645;h[w>>2]=ht;h[tt+676+(v<<2)>>2]=ht;ht=+h[g>>2];ht=ht+(y-ht)*.4000000059604645;h[g>>2]=ht;h[tt+660+(v<<2)>>2]=ht;v=v+1|0}w=0;while(1){if((w|0)>=(b|0))break;h[Fe+(w<<2)>>2]=1/+h[tt+(w<<2)>>2];w=w+1|0}if(F){x=s[Ce>>2]|0;C=x+5|0;A=ce;S=le;M=0;T=ue;while(1){if((M|0)>=(b|0))break;v=A+(-2-(s[tt+228+(M<<2)>>2]|0)<<2)|0;w=v+16|0;m=+tr(w,x);h[S>>2]=m;g=1;while(1){if((g|0)==5)break;U=+h[w+(0-g<<2)>>2];ht=+h[w+(x-g<<2)>>2];ht=m+(U*U-ht*ht);h[S+(g*6<<2)>>2]=ht;m=ht;g=g+1|0}E=1;_=v+12|0;while(1){if((E|0)==5){g=0;break}m=+ir(w,_,x);ht=m;h[S+(E*5<<2)>>2]=ht;h[S+(E<<2)>>2]=ht;g=5-E|0;v=1;while(1){if((v|0)>=(g|0))break;Ae=0-v|0;Se=x-v|0;ht=m+(+h[w+(Ae<<2)>>2]*+h[_+(Ae<<2)>>2]-+h[w+(Se<<2)>>2]*+h[_+(Se<<2)>>2]);U=ht;Se=E+v|0;h[S+((Se*5|0)+v<<2)>>2]=U;h[S+((v*5|0)+Se<<2)>>2]=U;m=ht;v=v+1|0}E=E+1|0;_=_+-4|0}while(1){if((g|0)==5)break;h[T+(g<<2)>>2]=+ir(w,A,x);g=g+1|0;w=w+-4|0}ht=+tr(A,C);m=(+h[S>>2]+ +h[S+96>>2])*.014999999664723873+1;m=1/(ht>m?ht:m);w=0;while(1){if((w|0)>=24){w=24;break}Se=S+(w<<2)|0;h[Se>>2]=+h[Se>>2]*m;Se=S+((w|1)<<2)|0;h[Se>>2]=+h[Se>>2]*m;Se=S+((w|2)<<2)|0;h[Se>>2]=+h[Se>>2]*m;Se=S+((w|3)<<2)|0;h[Se>>2]=+h[Se>>2]*m;w=w+4|0}while(1){if((w|0)==25){w=0;break}Se=S+(w<<2)|0;h[Se>>2]=+h[Se>>2]*m;w=w+1|0}while(1){if((w|0)>=4){w=4;break}Se=T+(w<<2)|0;h[Se>>2]=+h[Se>>2]*m;Se=T+((w|1)<<2)|0;h[Se>>2]=+h[Se>>2]*m;Se=T+((w|2)<<2)|0;h[Se>>2]=+h[Se>>2]*m;Se=T+((w|3)<<2)|0;h[Se>>2]=+h[Se>>2]*m;w=w+4|0}while(1){if((w|0)==5)break;Se=T+(w<<2)|0;h[Se>>2]=+h[Se>>2]*m;w=w+1|0}A=A+(x<<2)|0;S=S+100|0;M=M+1|0;T=T+20|0}ye=e+4832|0;Se=e+4748|0;v=s[Ce>>2]|0;Ee=s[Ie>>2]|0;w=Ee*25|0;g=0;while(1){if((g|0)>=(w|0))break;m=+h[le+(g<<2)>>2]*131072;b=(h[d>>2]=m,s[d>>2]|0);if((b&2130706432)>>>0<=1249902592){b=(b|0)<0;m=b?m+-8388608+8388608:m+8388608+-8388608;if(m==0)m=b?-0:0}s[Be+(g<<2)>>2]=~~m;g=g+1|0}_e=e+4860|0;Ae=tt+708|0;ke=Ee*5|0;w=0;while(1){if((w|0)>=(ke|0))break;m=+h[ue+(w<<2)>>2]*131072;b=(h[d>>2]=m,s[d>>2]|0);if((b&2130706432)>>>0<=1249902592){b=(b|0)<0;m=b?m+-8388608+8388608:m+8388608+-8388608;if(m==0)m=b?-0:0}s[Le+(w<<2)>>2]=~~m;w=w+1|0}we=v<<16>>16;ve=0;b=0;ge=0;w=2147483647;E=0;while(1){if((ge|0)==3)break;ue=s[17388+(ge<<2)>>2]|0;de=s[17400+(ge<<2)>>2]|0;pe=s[17412+(ge<<2)>>2]|0;be=r[29888+ge>>0]|0;me=Be;M=b;ce=0;S=0;E=0;b=s[Se>>2]|0;le=Le;while(1){if((ce|0)>=(Ee|0))break;he=5333-b|0;g=he+896|0;if((he|0)>=-896)if((g|0)>3966)g=2147483647;else{v=g>>7;A=1<>16)<>7;else g=te(A>>7,_+((te(te(_,128-_|0)|0,-174)|0)>>16)|0)|0;g=A+g|0}else g=0;I=g+-51|0;P=qe+ce|0;D=s[le>>2]<<7;j=s[le+4>>2]<<7;F=s[le+8>>2]<<7;z=s[le+12>>2]<<7;ae=0-(s[le+16>>2]<<7)|0;r[P>>0]=0;G=me+4|0;V=me+8|0;W=me+12|0;K=me+16|0;Z=me+28|0;Y=me+32|0;$=me+36|0;X=me+24|0;Q=me+52|0;ee=me+56|0;ie=me+48|0;ne=me+76|0;se=me+72|0;ae=ae<<1;oe=me+96|0;fe=de;he=M;x=0;C=2147483647;T=2147483647;while(1){if((x|0)>=(be|0))break;_=a[pe+x>>0]|0;ct=r[fe+1>>0]|0;M=(te(s[G>>2]|0,ct)|0)-D|0;v=r[fe+2>>0]|0;M=M+(te(s[V>>2]|0,v)|0)|0;A=r[fe+3>>0]|0;M=M+(te(s[W>>2]|0,A)|0)|0;g=r[fe+4>>0]|0;M=M+(te(s[K>>2]|0,g)|0)<<1;lt=r[fe>>0]|0;M=M+(te(s[me>>2]|0,lt)|0)|0;lt=(te(M>>16,lt)|0)+((te(M&65535,lt)|0)>>16)+32801|0;M=(te(s[Z>>2]|0,v)|0)-j|0;M=M+(te(s[Y>>2]|0,A)|0)|0;M=M+(te(s[$>>2]|0,g)|0)<<1;M=M+(te(s[X>>2]|0,ct)|0)|0;ct=lt+((te(M>>16,ct)|0)+((te(M&65535,ct)|0)>>16))|0;M=(te(s[Q>>2]|0,A)|0)-F|0;M=M+(te(s[ee>>2]|0,g)|0)<<1;M=M+(te(s[ie>>2]|0,v)|0)|0;v=ct+((te(M>>16,v)|0)+((te(M&65535,v)|0)>>16))|0;M=(te(s[ne>>2]|0,g)|0)-z<<1;M=M+(te(s[se>>2]|0,A)|0)|0;A=v+((te(M>>16,A)|0)+((te(M&65535,A)|0)>>16))|0;M=ae+(te(s[oe>>2]|0,g)|0)|0;g=A+((te(M>>16,g)|0)+((te(M&65535,g)|0)>>16))|0;do if((g|0)>-1){g=g+((_|0)>(I|0)?_-I<<11:0)|0;M=re(g|0)|0;v=24-M|0;A=0-v|0;do if(v)if((v|0)<0){v=g<>>(v+32|0);break}else{v=g<<32-v|g>>>v;break}else v=g;while(0);v=v&127;v=te(we,(v+(((te(v,128-v|0)|0)*179|0)>>>16)+(31-M<<7)<<16)+-125829120>>16)|0;v=v+(a[ue+x>>0]<<2)|0;if((v|0)>(C|0)){_=he;v=C;g=T;break}r[P>>0]=x}else{_=he;v=C;g=T}while(0);fe=fe+5|0;he=_;x=x+1|0;C=v;T=g}E=E+T|0;E=(E|0)<0?2147483647:E;S=S+C|0;S=(S|0)<0?2147483647:S;g=he+51|0;A=re(g|0)|0;v=24-A|0;_=0-v|0;do if(v)if((v|0)<0){v=g<<_|g>>>(v+32|0);break}else{v=g<<32-v|g>>>v;break}else v=g;while(0);lt=v&127;if((b+(lt+(((te(lt,128-lt|0)|0)*179|0)>>>16)+(31-A<<7))|0)<896)b=0;else{A=re(g|0)|0;v=24-A|0;_=0-v|0;do if(v)if((v|0)<0){g=g<<_|g>>>(v+32|0);break}else{g=g<<32-v|g>>>v;break}while(0);lt=g&127;b=b+(lt+(((te(lt,128-lt|0)|0)*179|0)>>>16)+(31-A<<7))+-896|0}me=me+100|0;M=he;ce=ce+1|0;le=le+20|0}if((S|0)>(w|0))b=ve;else{r[_e>>0]=ge;Mn(ye|0,qe|0,Ee|0)|0;w=S}ve=b;b=M;ge=ge+1|0}b=s[17400+(r[_e>>0]<<2)>>2]|0;v=0;while(1){if((v|0)>=(Ee|0))break;w=e+4832+v|0;g=v*5|0;_=0;while(1){if((_|0)==5)break;n[ze+(g+_<<1)>>1]=r[b+(((r[w>>0]|0)*5|0)+_)>>0]<<7;_=_+1|0}v=v+1|0}b=E>>((Ee|0)==2?1:2);s[Se>>2]=ve;v=re(b|0)|0;w=24-v|0;g=0-w|0;do if(w)if((w|0)<0){b=b<>>(w+32|0);break}else{b=b<<32-w|b>>>w;break}while(0);b=b&127;b=(b+(((te(b,128-b|0)|0)*179|0)>>>16)+(31-v<<7)<<16)+-125829120>>16;w=0;while(1){if((w|0)>=(ke|0))break;h[tt+144+(w<<2)>>2]=+(n[ze+(w<<1)>>1]|0)*6103515625e-14;w=w+1|0}m=+(te(b,-3)|0)*.0078125;h[Ae>>2]=m;if(!f){m=+((s[e+4708>>2]|0)+(s[e+5836>>2]|0)|0)*m*.10000000149011612;if(!(m>2)){if(m<0)m=0}else m=2;b=~~m;r[e+4861>>0]=b}else{r[e+4861>>0]=0;b=0}h[tt+224>>2]=+(n[25412+(b<<24>>24<<1)>>1]|0)*6103515625e-14;T=s[e+4732>>2]|0;_=s[Ce>>2]|0;E=s[Ie>>2]|0;A=_+T|0;S=Ue;M=0;T=Ye+(0-T<<2)|0;while(1){if((M|0)>=(E|0))break;g=0-(s[tt+228+(M<<2)>>2]|0)|0;y=+h[Fe+(M<<2)>>2];b=M*5|0;w=0;while(1){if((w|0)==5)break;s[qe+(w<<2)>>2]=s[tt+144+(b+w<<2)>>2];w=w+1|0}v=0;g=T+(g<<2)|0;while(1){if((v|0)>=(A|0))break;w=s[T+(v<<2)>>2]|0;b=S+(v<<2)|0;s[b>>2]=w;m=(s[d>>2]=w,+h[d>>2]);w=0;while(1){if((w|0)==5)break;ht=m-+h[qe+(w<<2)>>2]*+h[g+(2-w<<2)>>2];h[b>>2]=ht;m=ht;w=w+1|0}h[b>>2]=m*y;v=v+1|0;g=g+4|0}S=S+(A<<2)|0;M=M+1|0;T=T+(_<<2)|0}}else{S=e+4732|0;A=s[S>>2]|0;w=A;_=0;E=Ue;A=Ye+(0-A<<2)|0;while(1){if((_|0)>=(b|0))break;m=+h[Fe+(_<<2)>>2];b=s[Ce>>2]|0;v=b+w|0;g=v&65532;b=w+b&65532;w=0;while(1){if((w|0)>=(g|0))break;h[E+(w<<2)>>2]=+h[A+(w<<2)>>2]*m;lt=w|1;h[E+(lt<<2)>>2]=+h[A+(lt<<2)>>2]*m;lt=w|2;h[E+(lt<<2)>>2]=+h[A+(lt<<2)>>2]*m;lt=w|3;h[E+(lt<<2)>>2]=+h[A+(lt<<2)>>2]*m;w=w+4|0}while(1){if((b|0)>=(v|0))break;h[E+(b<<2)>>2]=+h[A+(b<<2)>>2]*m;b=b+1|0}lt=s[Ce>>2]|0;ct=s[S>>2]|0;b=s[Ie>>2]|0;w=ct;_=_+1|0;E=E+(lt+ct<<2)|0;A=A+(lt<<2)|0}kn(tt+144|0,0,b*20|0)|0;h[tt+708>>2]=0;s[e+4748>>2]=0}b=e+4756|0;if(!(s[b>>2]|0)){y=+mt(+(+h[tt+708>>2]/3))/1e4;y=y/(+h[xe>>2]*.75+.25)}else y=.009999999776482582;M=e+4732|0;A=s[M>>2]|0;E=(s[Ce>>2]|0)+A|0;S=e+4859|0;r[S>>0]=4;m=+Dr(Pe,Ue,y,E,s[Ie>>2]|0,A);A=e+4724|0;t:do if((s[A>>2]|0?(s[b>>2]|0)==0:0)?(s[Ie>>2]|0)==4:0){_=E<<1;m=m-+Dr(Ne,Ue+(_<<2)|0,y,E,2,s[M>>2]|0);Qi(je,Ne,s[M>>2]|0);v=3;k=3.4028234663852886e38;while(1){if((v|0)<=-1)break t;g=s[M>>2]|0;b=v<<16>>16;w=0;while(1){if((w|0)>=(g|0))break;lt=o[e+4592+(w<<1)>>1]|0;n[Le+(w<<1)>>1]=lt+((te((o[je+(w<<1)>>1]|0)-lt<<16>>16,b)|0)>>>2);w=w+1|0}xr(Be,Le,g);b=0;while(1){if((b|0)>=(g|0))break;h[Ne+(b<<2)>>2]=+(n[Be+(b<<1)>>1]|0)*.000244140625;b=b+1|0}Ji(Oe,Ne,Ue,_,s[M>>2]|0);lt=s[M>>2]|0;ct=Oe+(lt<<2)|0;lt=E-lt|0;y=+tr(ct,lt);y=y+ +tr(ct+(E<<2)|0,lt);if(!(yk)break t}else{r[S>>0]=v;m=y}v=v+-1|0;k=y}}while(0);if((r[S>>0]|0)==4)Qi(je,Pe,s[M>>2]|0);v=s[Me>>2]<<16>>16;v=(te(v,-5)|0)+(v*59246>>16)+3146|0;v=v+((s[Ie>>2]|0)==2?v>>1:0)|0;Ir(Le,je,s[M>>2]|0);t:do if((s[A>>2]|0)==1?(De=r[S>>0]|0,De<<24>>24<4):0){b=De<<24>>24;w=s[M>>2]|0;g=0;while(1){if((g|0)>=(w|0))break;lt=o[e+4592+(g<<1)>>1]|0;n[Be+(g<<1)>>1]=lt+((te((o[je+(g<<1)>>1]|0)-lt<<16>>16,b)|0)>>>2);g=g+1|0}Ir(qe,Be,w);w=r[S>>0]|0;w=(te(w,w)|0)<<27;b=s[M>>2]|0;w=w>>16;g=0;while(1){if((g|0)>=(b|0)){w=1;break t}lt=Le+(g<<1)|0;n[lt>>1]=((n[lt>>1]|0)>>>1)+((te(n[qe+(g<<1)>>1]|0,w)|0)>>>16);g=g+1|0}}else w=0;while(0);Ur(e+4836|0,je,s[e+4784>>2]|0,Le,v,s[e+4752>>2]|0,r[He>>0]|0);b=ze+32|0;xr(b,je,s[M>>2]|0);if(w){b=r[S>>0]|0;w=s[M>>2]|0;g=0;while(1){if((g|0)>=(w|0))break;lt=o[e+4592+(g<<1)>>1]|0;n[Be+(g<<1)>>1]=lt+((te((o[je+(g<<1)>>1]|0)-lt<<16>>16,b)|0)>>>2);g=g+1|0}xr(ze,Be,w)}else Mn(ze|0,b|0,s[M>>2]<<1|0)|0;g=0;while(1){if((g|0)==2)break;b=s[M>>2]|0;w=0;while(1){if((w|0)>=(b|0))break;h[tt+16+(g<<6)+(w<<2)>>2]=+(n[ze+(g<<5)+(w<<1)>>1]|0)*.000244140625;w=w+1|0}g=g+1|0}_=s[Ce>>2]|0;lt=s[Ie>>2]|0;b=s[M>>2]|0;w=qe+(b<<2)|0;v=b+_|0;g=v<<1;Ji(qe,tt+16|0,Ue,g,b);ht=+h[tt>>2];h[tt+712>>2]=ht*ht*+tr(w,_);ht=+h[tt+4>>2];v=w+(v<<2)|0;h[tt+716>>2]=ht*ht*+tr(v,_);if((lt|0)==4){Ji(qe,tt+80|0,Ue+(g<<2)|0,g,b);ht=+h[tt+8>>2];h[tt+720>>2]=ht*ht*+tr(w,_);ht=+h[tt+12>>2];h[tt+724>>2]=ht*ht*+tr(v,_)}E=e+4592|0;b=je;_=E+32|0;do{n[E>>1]=n[b>>1]|0;E=E+2|0;b=b+2|0}while((E|0)<(_|0));t:do if((r[He>>0]|0)==2){m=1-1/(+J(+-((+h[tt+708>>2]+-12)*.25))+1)*.5;b=s[Ie>>2]|0;w=0;while(1){if((w|0)>=(b|0)){w=b;break t}lt=tt+(w<<2)|0;h[lt>>2]=+h[lt>>2]*m;w=w+1|0}}else w=s[Ie>>2]|0;while(0);m=+mt(+((21-+(s[Te>>2]|0)*.0078125)*.33000001311302185));m=m/+(s[Ce>>2]|0);b=0;while(1){if((b|0)>=(w|0)){b=0;break}lt=tt+(b<<2)|0;ht=+h[lt>>2];ht=+H(+(ht*ht+ +h[tt+712+(b<<2)>>2]*m));h[lt>>2]=ht<32767?ht:32767;b=b+1|0}while(1){if((b|0)>=(w|0))break;s[ze+(b<<2)>>2]=~~(+h[tt+(b<<2)>>2]*65536);b=b+1|0}Mn(tt+728|0,ze|0,w<<2|0)|0;b=e+7260|0;le=tt+744|0;r[le>>0]=r[b>>0]|0;ue=e+4828|0;de=(f|0)==2;pe=de&1;br(ue,ze,b,pe,w);b=s[Ie>>2]|0;w=0;while(1){if((w|0)>=(b|0))break;h[tt+(w<<2)>>2]=+(s[ze+(w<<2)>>2]|0)*152587890625e-16;w=w+1|0}g=r[He>>0]|0;do if(g<<24>>24==2){w=e+4858|0;if(+h[tt+708>>2]+ +(s[e+4804>>2]|0)*30517578125e-15>1){r[w>>0]=0;ce=w;w=0;break}else{r[w>>0]=1;ce=w;w=1;break}}else{w=e+4858|0;ce=w;w=r[w>>0]|0}while(0);lt=s[Me>>2]|0;he=tt+692|0;h[he>>2]=+(s[e+4720>>2]|0)*-.05000000074505806+1.2000000476837158+ +(lt|0)*-.20000000298023224*.00390625+ +h[Re>>2]*-.10000000149011612+ +h[xe>>2]*-.20000000298023224+ +(n[25404+(g<<24>>24>>1<<2)+(w<<24>>24<<1)>>1]|0)*.0009765625*.800000011920929;fe=e+5840|0;w=s[fe>>2]|0;v=e+6192+(w*36|0)|0;if((s[e+6184>>2]|0)!=0&(lt|0)>77){s[e+4816+(w<<2)>>2]=1;Mn(qe|0,e+144|0,4448)|0;E=v;b=ue;_=E+36|0;do{n[E>>1]=n[b>>1]|0;E=E+2|0;b=b+2|0}while((E|0)<(_|0));g=s[Ie>>2]|0;Mn(Fe|0,tt|0,g<<2|0)|0;b=s[fe>>2]|0;do if(!b)ot=544;else{if(!(s[e+4816+(b+-1<<2)>>2]|0)){ot=544;break}w=e+4632|0;b=g}while(0);if((ot|0)==544){w=e+4632|0;r[w>>0]=r[e+7260>>0]|0;b=(a[v>>0]|0)+(s[e+6188>>2]|0)|0;r[v>>0]=(b&255)<<24>>24<63?b&255:63;b=s[Ie>>2]|0}mr(ze,v,w,pe,b);b=s[Ie>>2]|0;w=0;while(1){if((w|0)>=(b|0))break;h[tt+(w<<2)>>2]=+(s[ze+(w<<2)>>2]|0)*152587890625e-16;w=w+1|0}er(e,tt,v,qe,e+6300+((s[fe>>2]|0)*320|0)|0,Ye);b=s[Ie>>2]|0;Mn(tt|0,Fe|0,b<<2|0)|0}g=0;w=0;while(1){if((w|0)>=(b|0))break;g=(r[e+4828+w>>0]|0)+(g<<8)|0;w=w+1|0}E=nt;b=i;_=E+48|0;do{s[E>>2]=s[b>>2];E=E+4|0;b=b+4|0}while((E|0)<(_|0));W=e+144|0;Mn(it|0,W|0,4448)|0;K=r[Ke>>0]|0;Z=e+5864|0;Y=n[Z>>1]|0;$=e+5860|0;X=s[$>>2]|0;Q=e+7260|0;ee=u+-5|0;ie=i+24|0;ne=i+28|0;se=e+4828|0;ae=e+4864|0;oe=i+20|0;D=0;M=0;T=0;G=256;z=0;x=0;j=-1;S=-1;V=0;F=0;C=0;w=0;while(1){A=(g|0)==(j|0);do if(!A){if((g|0)==(S|0)){b=C;ot=571;break}if((V|0)>0){E=i;b=nt;_=E+48|0;do{s[E>>2]=s[b>>2];E=E+4|0;b=b+4|0}while((E|0)<(_|0));Mn(W|0,it|0,4448)|0;r[Ke>>0]=K;n[Z>>1]=Y;s[$>>2]=X}er(e,tt,se,W,ae,Ye);v=(V|0)==6;if(v&(M|0)==0){s[st>>2]=s[i>>2];s[st+4>>2]=s[i+4>>2];s[st+8>>2]=s[i+8>>2];s[st+12>>2]=s[i+12>>2];s[st+16>>2]=s[i+16>>2];s[st+20>>2]=s[i+20>>2];_=s[ie>>2]|0;s[at>>2]=s[ne>>2];s[at+4>>2]=s[ne+4>>2];s[at+8>>2]=s[ne+8>>2];s[at+12>>2]=s[ne+12>>2];s[at+16>>2]=s[ne+16>>2]}else _=w;Di(e,i,s[fe>>2]|0,0,f);Li(i,r[He>>0]|0,r[ce>>0]|0,ae,s[We>>2]|0);b=(s[oe>>2]|0)+((re(s[ne>>2]|0)|0)+-32)|0;if(v&(M|0)==0&(b|0)>(u|0)){s[i>>2]=s[st>>2];s[i+4>>2]=s[st+4>>2];s[i+8>>2]=s[st+8>>2];s[i+12>>2]=s[st+12>>2];s[i+16>>2]=s[st+16>>2];s[i+20>>2]=s[st+20>>2];s[ie>>2]=_;s[ne>>2]=s[at>>2];s[ne+4>>2]=s[at+4>>2];s[ne+8>>2]=s[at+8>>2];s[ne+12>>2]=s[at+12>>2];s[ne+16>>2]=s[at+16>>2];b=r[le>>0]|0;r[Q>>0]=b;w=0;while(1){if((w|0)>=(s[Ie>>2]|0))break;r[e+4828+w>>0]=4;w=w+1|0}if(!de)r[ue>>0]=b;n[Z>>1]=Y;s[$>>2]=X;b=0;while(1){if((b|0)>=(s[We>>2]|0))break;r[e+4864+b>>0]=0;b=b+1|0}Di(e,i,s[fe>>2]|0,0,f);Li(i,r[He>>0]|0,r[ce>>0]|0,ae,s[We>>2]|0);b=(s[oe>>2]|0)+((re(s[ne>>2]|0)|0)+-32)|0}if(V|p|0){w=_;ot=571;break}if((b|0)>(u|0))I=_;else break e}else{b=F;ot=571}while(0);if((ot|0)==571){ot=0;if((V|0)==6)break;else I=w}P=(b|0)>(u|0);t:do if(P){if(M|0){T=1;A=z;x=G<<16>>16;E=j;S=g;_=F;C=b;break}if((V|0)>1){ht=+h[he>>2]*1.5;h[he>>2]=ht>1.5?ht:1.5;r[ce>>0]=0;T=0;g=-1}else{T=1;x=G<<16>>16;C=b}_=s[Ie>>2]|0;E=(V|0)==0;S=0;i:while(1){if((S|0)>=(_|0)){M=0;A=z;E=j;S=g;_=F;break t}v=s[Ce>>2]|0;A=S+1|0;w=te(A,v)|0;v=te(S,v)|0;M=0;while(1){if((v|0)>=(w|0))break;ct=r[e+4864+v>>0]|0;lt=ct<<24>>24;v=v+1|0;M=M+(ct<<24>>24>-1?lt:0-lt|0)|0}w=Xe+(S<<2)|0;do if(!E){v=Qe+(S<<2)|0;if((M|0)<(s[w>>2]|0)?(s[v>>2]|0)==0:0)break;s[v>>2]=1;S=A;continue i}while(0);s[w>>2]=M;n[$e+(S<<1)>>1]=G;S=A}}else{if((b|0)>=(ee|0))break e;w=G<<16>>16;if(A){M=1;A=w;E=g;_=b;break}s[st>>2]=s[i>>2];s[st+4>>2]=s[i+4>>2];s[st+8>>2]=s[i+8>>2];s[st+12>>2]=s[i+12>>2];s[st+16>>2]=s[i+16>>2];s[st+20>>2]=s[i+20>>2];I=s[ie>>2]|0;s[at>>2]=s[ne>>2];s[at+4>>2]=s[ne+4>>2];s[at+8>>2]=s[ne+8>>2];s[at+12>>2]=s[ne+12>>2];s[at+16>>2]=s[ne+16>>2];Mn(Je|0,s[i>>2]|0,I|0)|0;Mn(rt|0,W|0,4448)|0;D=r[Q>>0]|0;M=1;A=w;E=g;_=b}while(0);do if(!(M&T)){if(P){if(G<<16>>16>=16384){v=32767;break}v=G<<16>>16<<1&65535;break}w=(b-u<<7|0)/(s[We>>2]|0)|0;b=w+2048|0;do if((w|0)<-2048)b=0;else{if((b|0)>3966){b=2147483647;break}g=b>>7;v=1<>16)<>7;else b=te(v>>7,b+((te(te(b,128-b|0)|0,-174)|0)>>16)|0)|0;b=v+b|0}while(0);v=G<<16>>16;v=(te(b>>16,v)|0)+((te(b&65535,v)|0)>>>16)&65535}else{v=x-A|0;w=A+((te(v,u-_|0)|0)/(C-_|0)|0)|0;g=w<<16>>16;v=v>>2;b=A+v|0;if((g|0)<=(b|0)){b=x-v|0;b=(g|0)<(b|0)?b:w}v=b&65535}while(0);b=s[Ie>>2]|0;w=0;while(1){if((w|0)>=(b|0))break;if(!(s[Qe+(w<<2)>>2]|0))g=v;else g=n[$e+(w<<1)>>1]|0;ct=s[tt+728+(w<<2)>>2]|0;lt=g<<16>>16;lt=(te(ct>>16,lt)|0)+((te(ct&65535,lt)|0)>>16)|0;s[et+(w<<2)>>2]=(lt|0)>8388607?2147483392:((lt|0)<-8388608?-8388608:lt)<<8;w=w+1|0}r[Q>>0]=r[le>>0]|0;br(ue,et,Q,pe,b);w=s[Ie>>2]|0;g=0;b=0;while(1){if((b|0)>=(w|0)){b=0;break}g=(r[e+4828+b>>0]|0)+(g<<8)|0;b=b+1|0}while(1){if((b|0)>=(w|0))break;h[tt+(b<<2)>>2]=+(s[et+(b<<2)>>2]|0)*152587890625e-16;b=b+1|0}G=v;z=A;j=E;V=V+1|0;F=_;w=I}if((M|0)!=0&(A|(b|0)>(u|0))){s[i>>2]=s[st>>2];s[i+4>>2]=s[st+4>>2];s[i+8>>2]=s[st+8>>2];s[i+12>>2]=s[st+12>>2];s[i+16>>2]=s[st+16>>2];s[i+20>>2]=s[st+20>>2];s[ie>>2]=w;s[ne>>2]=s[at>>2];s[ne+4>>2]=s[at+4>>2];s[ne+8>>2]=s[at+8>>2];s[ne+12>>2]=s[at+12>>2];s[ne+16>>2]=s[at+16>>2];Mn(s[i>>2]|0,Je|0,w|0)|0;Mn(W|0,rt|0,4448)|0;r[Q>>0]=D}}while(0);Tn(e+7272|0,e+7272+(s[We>>2]<<2)|0,(s[Ze>>2]|0)+((s[Ve>>2]|0)*5|0)<<2|0)|0;if(s[Ge>>2]|0){lt=0;s[t>>2]=lt;l=ft;return 0}s[e+4636>>2]=s[tt+228+((s[e+4672>>2]|0)+-1<<2)>>2];r[e+4633>>0]=r[e+4857>>0]|0;s[e+4756>>2]=0;lt=(s[i+20>>2]|0)+((re(s[i+28>>2]|0)|0)+-32)+7>>3;s[t>>2]=lt;l=ft;return 0}function Ji(e,t,i,r,n){e=e|0;t=t|0;i=i|0;r=r|0;n=n|0;var s=0,a=0,o=0,f=0,c=0,l=0,u=0,d=0,p=0,b=0,m=0,w=0,g=0,v=0,_=0,y=0,k=0;switch(n|0){case 6:{s=t+4|0;a=t+8|0;o=t+12|0;f=t+16|0;c=t+20|0;l=6;while(1){if((l|0)>=(r|0))break;y=i+(l+-1<<2)|0;h[e+(l<<2)>>2]=+h[y+4>>2]-(+h[y>>2]*+h[t>>2]+ +h[y+-4>>2]*+h[s>>2]+ +h[y+-8>>2]*+h[a>>2]+ +h[y+-12>>2]*+h[o>>2]+ +h[y+-16>>2]*+h[f>>2]+ +h[y+-20>>2]*+h[c>>2]);l=l+1|0}i=n<<2;kn(e|0,0,i|0)|0;return}case 8:{s=t+4|0;a=t+8|0;o=t+12|0;f=t+16|0;c=t+20|0;l=t+24|0;u=t+28|0;d=8;while(1){if((d|0)>=(r|0))break;y=i+(d+-1<<2)|0;h[e+(d<<2)>>2]=+h[y+4>>2]-(+h[y>>2]*+h[t>>2]+ +h[y+-4>>2]*+h[s>>2]+ +h[y+-8>>2]*+h[a>>2]+ +h[y+-12>>2]*+h[o>>2]+ +h[y+-16>>2]*+h[f>>2]+ +h[y+-20>>2]*+h[c>>2]+ +h[y+-24>>2]*+h[l>>2]+ +h[y+-28>>2]*+h[u>>2]);d=d+1|0}i=n<<2;kn(e|0,0,i|0)|0;return}case 10:{s=t+4|0;a=t+8|0;o=t+12|0;f=t+16|0;c=t+20|0;l=t+24|0;u=t+28|0;d=t+32|0;p=t+36|0;b=10;while(1){if((b|0)>=(r|0))break;y=i+(b+-1<<2)|0;h[e+(b<<2)>>2]=+h[y+4>>2]-(+h[y>>2]*+h[t>>2]+ +h[y+-4>>2]*+h[s>>2]+ +h[y+-8>>2]*+h[a>>2]+ +h[y+-12>>2]*+h[o>>2]+ +h[y+-16>>2]*+h[f>>2]+ +h[y+-20>>2]*+h[c>>2]+ +h[y+-24>>2]*+h[l>>2]+ +h[y+-28>>2]*+h[u>>2]+ +h[y+-32>>2]*+h[d>>2]+ +h[y+-36>>2]*+h[p>>2]);b=b+1|0}i=n<<2;kn(e|0,0,i|0)|0;return}case 12:{s=t+4|0;a=t+8|0;o=t+12|0;f=t+16|0;c=t+20|0;l=t+24|0;u=t+28|0;d=t+32|0;p=t+36|0;b=t+40|0;m=t+44|0;w=12;while(1){if((w|0)>=(r|0))break;y=i+(w+-1<<2)|0;h[e+(w<<2)>>2]=+h[y+4>>2]-(+h[y>>2]*+h[t>>2]+ +h[y+-4>>2]*+h[s>>2]+ +h[y+-8>>2]*+h[a>>2]+ +h[y+-12>>2]*+h[o>>2]+ +h[y+-16>>2]*+h[f>>2]+ +h[y+-20>>2]*+h[c>>2]+ +h[y+-24>>2]*+h[l>>2]+ +h[y+-28>>2]*+h[u>>2]+ +h[y+-32>>2]*+h[d>>2]+ +h[y+-36>>2]*+h[p>>2]+ +h[y+-40>>2]*+h[b>>2]+ +h[y+-44>>2]*+h[m>>2]);w=w+1|0}i=n<<2;kn(e|0,0,i|0)|0;return}case 16:{s=t+4|0;a=t+8|0;d=t+12|0;p=t+16|0;b=t+20|0;m=t+24|0;w=t+28|0;g=t+32|0;v=t+36|0;_=t+40|0;o=t+44|0;f=t+48|0;c=t+52|0;l=t+56|0;u=t+60|0;y=16;while(1){if((y|0)>=(r|0))break;k=i+(y+-1<<2)|0;h[e+(y<<2)>>2]=+h[k+4>>2]-(+h[k>>2]*+h[t>>2]+ +h[k+-4>>2]*+h[s>>2]+ +h[k+-8>>2]*+h[a>>2]+ +h[k+-12>>2]*+h[d>>2]+ +h[k+-16>>2]*+h[p>>2]+ +h[k+-20>>2]*+h[b>>2]+ +h[k+-24>>2]*+h[m>>2]+ +h[k+-28>>2]*+h[w>>2]+ +h[k+-32>>2]*+h[g>>2]+ +h[k+-36>>2]*+h[v>>2]+ +h[k+-40>>2]*+h[_>>2]+ +h[k+-44>>2]*+h[o>>2]+ +h[k+-48>>2]*+h[f>>2]+ +h[k+-52>>2]*+h[c>>2]+ +h[k+-56>>2]*+h[l>>2]+ +h[k+-60>>2]*+h[u>>2]);y=y+1|0}k=n<<2;kn(e|0,0,k|0)|0;return}default:{k=n<<2;kn(e|0,0,k|0)|0;return}}}function Qi(e,t,i){e=e|0;t=t|0;i=i|0;var r=0,a=0,f=0,c=0,u=0,p=0,b=0,m=0,w=0,g=0,v=0,_=0,y=0,k=0,E=0,A=0,S=0,M=0,T=0,R=0,x=0,C=0,I=0,P=0,O=0,N=0,D=0,L=0,B=0,U=0,j=0,F=0,z=0,q=0,H=0,G=0,V=0;V=l;l=l+176|0;F=V+124|0;q=V+72|0;z=V+64|0;H=V;a=0;while(1){if((a|0)>=(i|0))break;f=+h[t+(a<<2)>>2]*65536;r=(h[d>>2]=f,s[d>>2]|0);if((r&2130706432)>>>0<=1249902592){r=(r|0)<0;f=r?f+-8388608+8388608:f+8388608+-8388608;if(f==0)f=r?-0:0}s[H+(a<<2)>>2]=~~f;a=a+1|0}s[z>>2]=F;s[z+4>>2]=q;B=i>>1;U=F+(B<<2)|0;s[U>>2]=65536;j=q+(B<<2)|0;s[j>>2]=65536;r=0;while(1){if((B|0)<=(r|0))break;L=s[H+(B-r+-1<<2)>>2]|0;D=s[H+(r+B<<2)>>2]|0;s[F+(r<<2)>>2]=0-L-D;s[q+(r<<2)>>2]=D-L;r=r+1|0}r=B;while(1){if((r|0)<=0){r=2;break}L=r+-1|0;D=F+(L<<2)|0;s[D>>2]=(s[D>>2]|0)-(s[F+(r<<2)>>2]|0);D=q+(L<<2)|0;s[D>>2]=(s[D>>2]|0)+(s[q+(r<<2)>>2]|0);r=L}while(1){if((r|0)>(B|0)){r=2;break}else a=B;while(1){if((a|0)<=(r|0))break;L=F+(a+-2<<2)|0;s[L>>2]=(s[L>>2]|0)-(s[F+(a<<2)>>2]|0);a=a+-1|0}L=F+(r+-2<<2)|0;s[L>>2]=(s[L>>2]|0)-(s[F+(r<<2)>>2]<<1);r=r+1|0}while(1){if((r|0)>(B|0))break;else a=B;while(1){if((a|0)<=(r|0))break;L=q+(a+-2<<2)|0;s[L>>2]=(s[L>>2]|0)-(s[q+(a<<2)>>2]|0); +a=a+-1|0}L=q+(r+-2<<2)|0;s[L>>2]=(s[L>>2]|0)-(s[q+(r<<2)>>2]<<1);r=r+1|0}r=s[U>>2]|0;L=(B|0)==8;e:do if(L)r=(s[F>>2]|0)+((s[F+4>>2]|0)+((s[F+8>>2]|0)+((s[F+12>>2]|0)+((s[F+16>>2]|0)+((s[F+20>>2]|0)+((s[F+24>>2]|0)+((s[F+28>>2]|0)+(r<<1)<<1)<<1)<<1)<<1)<<1)<<1)<<1)|0;else{t=B;while(1){a=t+-1|0;if((t|0)<=0)break e;t=a;r=(s[F+(a<<2)>>2]|0)+(r<<1)|0}}while(0);e:do if((r|0)<0){n[e>>1]=0;r=s[j>>2]|0;if(L){a=q;t=1;r=(s[q>>2]|0)+((s[q+4>>2]|0)+((s[q+8>>2]|0)+((s[q+12>>2]|0)+((s[q+16>>2]|0)+((s[q+20>>2]|0)+((s[q+24>>2]|0)+((s[q+28>>2]|0)+(r<<1)<<1)<<1)<<1)<<1)<<1)<<1)<<1)|0;break}else t=B;while(1){a=t+-1|0;if((t|0)<=0){a=q;t=1;break e}t=a;r=(s[q+(a<<2)>>2]|0)+(r<<1)|0}}else{a=F;t=0}while(0);k=F+28|0;E=F+24|0;A=F+20|0;S=F+16|0;M=F+12|0;T=F+8|0;R=F+4|0;x=q+28|0;C=q+24|0;I=q+20|0;P=q+16|0;O=q+12|0;N=q+8|0;D=q+4|0;y=0;e:while(1){p=1;c=0;u=8192;t:while(1){_=p;while(1){p=n[27508+(_<<1)>>1]|0;b=Ar(a,p,B)|0;if((r|0)<1){if((b|0)>=(c|0))break;if(!((r|0)<0|(b|0)>(0-c|0)))break}else if((b|0)<=(0-c|0))break;if((_|0)>127)break t;else{_=_+1|0;c=0;u=p;r=b}}c=(b|0)==0&1;g=-256;v=0;while(1){if((v|0)==3)break;m=u+p|0;m=(m>>1)+(m&1)|0;w=Ar(a,m,B)|0;if((r|0)<1)if((w&r|0)>-1){p=m;b=w}else G=42;else if((w|0)<1){p=m;b=w}else G=42;if((G|0)==42){G=0;g=g+(128>>>v)|0;u=m;r=w}v=v+1|0}a=r-b|0;if((((r|0)>0?r:0-r|0)|0)<65536)if((r|0)==(b|0))r=g;else r=g+(((r<<5)+(a>>1)|0)/(a|0)|0)|0;else r=g+((r|0)/(a>>5|0)|0)|0;r=(_<<8)+r|0;n[e+(t<<1)>>1]=(r|0)<32767?r:32767;r=t+1|0;if((r|0)>=(i|0)){G=77;break e}p=_;a=s[z+((r&1)<<2)>>2]|0;t=r;u=n[27508+(_+-1<<1)>>1]|0;r=1-(r&2)<<12}c=y+1|0;if((y|0)>15)break;Mr(H,i,65536-(1<>2]=65536;s[j>>2]=65536;r=0;while(1){if((B|0)<=(r|0)){r=B;break}y=s[H+(B-r+-1<<2)>>2]|0;_=s[H+(r+B<<2)>>2]|0;s[F+(r<<2)>>2]=0-y-_;s[q+(r<<2)>>2]=_-y;r=r+1|0}while(1){if((r|0)<=0){r=2;break}y=r+-1|0;_=F+(y<<2)|0;s[_>>2]=(s[_>>2]|0)-(s[F+(r<<2)>>2]|0);_=q+(y<<2)|0;s[_>>2]=(s[_>>2]|0)+(s[q+(r<<2)>>2]|0);r=y}while(1){if((r|0)>(B|0)){r=2;break}else a=B;while(1){if((a|0)<=(r|0))break;y=F+(a+-2<<2)|0;s[y>>2]=(s[y>>2]|0)-(s[F+(a<<2)>>2]|0);a=a+-1|0}y=F+(r+-2<<2)|0;s[y>>2]=(s[y>>2]|0)-(s[F+(r<<2)>>2]<<1);r=r+1|0}while(1){if((r|0)>(B|0))break;else a=B;while(1){if((a|0)<=(r|0))break;y=q+(a+-2<<2)|0;s[y>>2]=(s[y>>2]|0)-(s[q+(a<<2)>>2]|0);a=a+-1|0}y=q+(r+-2<<2)|0;s[y>>2]=(s[y>>2]|0)-(s[q+(r<<2)>>2]<<1);r=r+1|0}r=s[U>>2]|0;t:do if(L)r=(s[F>>2]|0)+((s[R>>2]|0)+((s[T>>2]|0)+((s[M>>2]|0)+((s[S>>2]|0)+((s[A>>2]|0)+((s[E>>2]|0)+((s[k>>2]|0)+(r<<1)<<1)<<1)<<1)<<1)<<1)<<1)<<1)|0;else{t=B;while(1){a=t+-1|0;if((t|0)<=0)break t;t=a;r=(s[F+(a<<2)>>2]|0)+(r<<1)|0}}while(0);if((r|0)>=0){y=c;a=F;t=0;continue}n[e>>1]=0;r=s[j>>2]|0;if(L){y=c;a=q;t=1;r=(s[q>>2]|0)+((s[D>>2]|0)+((s[N>>2]|0)+((s[O>>2]|0)+((s[P>>2]|0)+((s[I>>2]|0)+((s[C>>2]|0)+((s[x>>2]|0)+(r<<1)<<1)<<1)<<1)<<1)<<1)<<1)<<1)|0;continue}else t=B;while(1){a=t+-1|0;if((t|0)<=0){y=c;a=q;t=1;continue e}t=a;r=(s[q+(a<<2)>>2]|0)+(r<<1)|0}}if((G|0)==77){l=V;return}r=32768/(i+1|0)|0;n[e>>1]=r;a=1;while(1){if((a|0)>=(i|0))break;G=(r&65535)+(o[e>>1]|0)|0;n[e+(a<<1)>>1]=G;r=G;a=a+1|0}l=V;return}function er(e,t,i,a,o,f){e=e|0;t=t|0;i=i|0;a=a|0;o=o|0;f=f|0;var c=0,u=0,p=0,b=0,m=0,w=0,g=0,v=0,_=0,y=0,k=0,E=0,A=0,S=0,M=0,T=0,R=0,x=0,C=0;C=l;l=l+1008|0;x=C+360|0;E=C+48|0;T=C+296|0;M=C+256|0;k=C+64|0;S=C+32|0;R=C+16|0;A=C;y=s[e+4672>>2]|0;b=e+4728|0;v=0;while(1){if((v|0)>=(y|0)){m=0;break}m=s[b>>2]|0;w=v*24|0;_=0;while(1){if((_|0)>=(m|0))break;g=w+_|0;c=+h[t+244+(g<<2)>>2]*8192;u=(h[d>>2]=c,s[d>>2]|0);if((u&2130706432)>>>0<=1249902592){u=(u|0)<0;c=u?c+-8388608+8388608:c+8388608+-8388608;if(c==0)c=u?-0:0}n[k+(g<<1)>>1]=~~c;_=_+1|0}v=v+1|0}while(1){if((m|0)>=(y|0))break;c=+h[t+644+(m<<2)>>2]*16384;u=(h[d>>2]=c,s[d>>2]|0);if((u&2130706432)>>>0<=1249902592){u=(u|0)<0;c=u?c+-8388608+8388608:c+8388608+-8388608;if(c==0)c=u?-0:0}b=~~c<<16;c=+h[t+628+(m<<2)>>2]*16384;u=(h[d>>2]=c,s[d>>2]|0);if((u&2130706432)>>>0<=1249902592){u=(u|0)<0;c=u?c+-8388608+8388608:c+8388608+-8388608;if(c==0)c=u?-0:0}s[S+(m<<2)>>2]=b|~~c&65535;c=+h[t+660+(m<<2)>>2]*16384;u=(h[d>>2]=c,s[d>>2]|0);if((u&2130706432)>>>0<=1249902592){u=(u|0)<0;c=u?c+-8388608+8388608:c+8388608+-8388608;if(c==0)c=u?-0:0}s[R+(m<<2)>>2]=~~c;c=+h[t+676+(m<<2)>>2]*16384;u=(h[d>>2]=c,s[d>>2]|0);if((u&2130706432)>>>0<=1249902592){u=(u|0)<0;c=u?c+-8388608+8388608:c+8388608+-8388608;if(c==0)c=u?-0:0}s[A+(m<<2)>>2]=~~c;m=m+1|0}c=+h[t+692>>2]*1024;u=(h[d>>2]=c,s[d>>2]|0);if((u&2130706432)>>>0<=1249902592){u=(u|0)<0;c=u?c+-8388608+8388608:c+8388608+-8388608;if(c==0)c=u?-0:0}b=y*5|0;m=0;while(1){if((m|0)>=(b|0))break;p=+h[t+144+(m<<2)>>2]*16384;u=(h[d>>2]=p,s[d>>2]|0);if((u&2130706432)>>>0<=1249902592){u=(u|0)<0;p=u?p+-8388608+8388608:p+8388608+-8388608;if(p==0)p=u?-0:0}n[M+(m<<1)>>1]=~~p;m=m+1|0}v=~~c;b=e+4732|0;g=0;while(1){if((g|0)==2){b=0;break}m=s[b>>2]|0;w=0;while(1){if((w|0)>=(m|0))break;c=+h[t+16+(g<<6)+(w<<2)>>2]*4096;u=(h[d>>2]=c,s[d>>2]|0);if((u&2130706432)>>>0<=1249902592){u=(u|0)<0;c=u?c+-8388608+8388608:c+8388608+-8388608;if(c==0)c=u?-0:0}n[T+(g<<5)+(w<<1)>>1]=~~c;w=w+1|0}g=g+1|0}while(1){if((b|0)>=(y|0))break;c=+h[t+(b<<2)>>2]*65536;u=(h[d>>2]=c,s[d>>2]|0);if((u&2130706432)>>>0<=1249902592){u=(u|0)<0;c=u?c+-8388608+8388608:c+8388608+-8388608;if(c==0)c=u?-0:0}s[E+(b<<2)>>2]=~~c;b=b+1|0}if((r[i+29>>0]|0)==2)m=n[25412+(r[i+33>>0]<<1)>>1]|0;else m=0;b=s[e+4676>>2]|0;w=0;while(1){if((w|0)>=(b|0))break;c=+h[f+(w<<2)>>2];u=(h[d>>2]=c,s[d>>2]|0);if((u&2130706432)>>>0<=1249902592){u=(u|0)<0;c=u?c+-8388608+8388608:c+8388608+-8388608;if(c==0)c=u?-0:0}n[x+(w<<1)>>1]=~~c;w=w+1|0}if((s[e+4720>>2]|0)<=1?(s[e+4764>>2]|0)<=0:0){gr(e,a,i,x,o,T,M,k,A,R,S,E,t+228|0,v,m);l=C;return}vr(e,a,i,x,o,T,M,k,A,R,S,E,t+228|0,v,m);l=C;return}function tr(e,t){e=e|0;t=t|0;var i=0,r=0,n=0,s=0,a=0,o=0,f=0,c=0;n=t+-3|0;r=((n|0)>0?n:0)+3&-4;s=0;i=0;while(1){if((s|0)>=(n|0))break;c=+h[e+(s<<2)>>2];f=+h[e+((s|1)<<2)>>2];o=+h[e+((s|2)<<2)>>2];a=+h[e+((s|3)<<2)>>2];s=s+4|0;i=i+(c*c+f*f+o*o+a*a)}while(1){if((r|0)>=(t|0))break;c=+h[e+(r<<2)>>2];r=r+1|0;i=i+c*c}return+i}function ir(e,t,i){e=e|0;t=t|0;i=i|0;var r=0,n=0,s=0,a=0,o=0,f=0,c=0,l=0;s=i+-3|0;n=((s|0)>0?s:0)+3&-4;a=0;r=0;while(1){if((a|0)>=(s|0))break;l=a|1;c=a|2;f=a|3;o=r+(+h[e+(a<<2)>>2]*+h[t+(a<<2)>>2]+ +h[e+(l<<2)>>2]*+h[t+(l<<2)>>2]+ +h[e+(c<<2)>>2]*+h[t+(c<<2)>>2]+ +h[e+(f<<2)>>2]*+h[t+(f<<2)>>2]);a=a+4|0;r=o}while(1){if((n|0)>=(i|0))break;o=r+ +h[e+(n<<2)>>2]*+h[t+(n<<2)>>2];n=n+1|0;r=o}return+r}function rr(e,t,i,o,f,h,c,l){e=e|0;t=t|0;i=i|0;o=o|0;f=f|0;h=h|0;c=c|0;l=l|0;var u=0,d=0,p=0,b=0,m=0,w=0,g=0,v=0,_=0,y=0,k=0,E=0,A=0,S=0,M=0,T=0,R=0,x=0,C=0,I=0,P=0,O=0,N=0,D=0,L=0,B=0,U=0,j=0,F=0,z=0,q=0,H=0,G=0;if((h|0)==0|(t|0)<0){h=-1;return h|0}if(!t){h=-4;return h|0}G=r[e>>0]|0;do if(G<<24>>24>=0){if((G&96)==96){p=(G&8)==0?480:960;break}d=(G&255)>>>3&3;if((d|0)==3)p=2880;else p=(48e3<>>0)/100|0}else p=(48e3<<((G&255)>>>3&3)>>>0)/400|0;while(0);m=e+1|0;E=t+-1|0;e:do switch(G&3|0){case 0:{R=m;x=E;C=0;I=1;b=E;M=0;_=47;break}case 1:{if(!i)if(!(E&1)){N=(E|0)/2|0;n[h>>1]=N;P=m;O=2;D=0;_=61;break e}else{h=-4;return h|0}else{j=m;U=E;F=1;q=2;z=E;H=0;_=48}break}case 2:{if((t|0)<2){n[h>>1]=-1;h=-4;return h|0}d=r[m>>0]|0;do if((d&255)<252){p=1;d=d&255}else{if((t|0)>=3){p=2;d=(a[e+2>>0]<<2)+(d&255)&65535;break}n[h>>1]=-1;h=-4;return h|0}while(0);n[h>>1]=d;t=E-p|0;d=d<<16>>16;if((t|0)<(d|0)){h=-4;return h|0}else{R=m+p|0;x=t;C=0;I=2;b=t-d|0;M=0;_=47;break e}}default:{if((t|0)<2){h=-4;return h|0}d=e+2|0;v=r[m>>0]|0;T=v&63;if((T|0)==0|(te(p,T)|0)>>>0>5760){h=-4;return h|0}p=t+-2|0;if(v&64){m=0;while(1){if((p|0)<1){A=-4;_=74;break}g=d+1|0;w=r[d>>0]|0;if(w<<24>>24!=-1)break;d=g;p=p+-255|0;m=m+254|0}if((_|0)==74)return A|0;t=w&255;d=p+-1-t|0;if((d|0)<0){h=-4;return h|0}else{w=d;k=m+t|0}}else{g=d;w=p;k=0}_=(v&255)>>>7;y=_&255^1;if(_<<24>>24!=1){if(i|0){j=g;U=w;F=y;q=T;z=E;H=k;_=48;break e}b=(w|0)/(T|0)|0;if((te(b,T)|0)!=(w|0)){h=-4;return h|0}d=T+-1|0;p=b&65535;t=0;while(1){if((t|0)>=(d|0)){R=g;x=w;C=y;I=T;M=k;_=47;break e}n[h+(t<<1)>>1]=p;t=t+1|0}}_=T+-1|0;v=w;m=0;while(1){if((m|0)>=(_|0)){_=41;break}S=h+(m<<1)|0;if((v|0)<1){_=33;break}d=r[g>>0]|0;if((d&255)<252){d=d&255;n[S>>1]=d;p=1}else{if((v|0)<2){_=37;break}d=(a[g+1>>0]<<2)+(d&255)&65535;n[S>>1]=d;p=2}t=v-p|0;d=d<<16>>16;if((d|0)>(t|0)){A=-4;_=74;break}g=g+p|0;v=t;m=m+1|0;w=w-(p+d)|0}if((_|0)==33){n[S>>1]=-1;h=-4;return h|0}else if((_|0)==37){n[S>>1]=-1;h=-4;return h|0}else if((_|0)==41){if((w|0)<0)A=-4;else{R=g;x=v;C=y;I=T;b=w;M=k;_=47;break e}return A|0}else if((_|0)==74)return A|0}}while(0);if((_|0)==47)if(!i){P=R;O=I;N=b;D=M;_=61}else{j=R;U=x;F=C;q=I;z=b;H=M;_=48}e:do if((_|0)==48){u=h+(q<<1)+-2|0;if((U|0)<1){n[u>>1]=-1;h=-4;return h|0}d=r[j>>0]|0;do if((d&255)<252){B=d&255;n[u>>1]=B;t=1;u=B}else{if((U|0)>=2){B=(a[j+1>>0]<<2)+(d&255)&65535;n[u>>1]=B;t=2;u=B;break}n[u>>1]=-1;h=-4;return h|0}while(0);p=U-t|0;b=q+-1|0;m=h+(b<<1)|0;d=u<<16>>16;if((d|0)>(p|0)){h=-4;return h|0}u=j+t|0;if(!F){if((t+d|0)>(z|0))A=-4;else{L=q;B=H;break}return A|0}if((te(d,q)|0)>(p|0)){h=-4;return h|0}else d=0;while(1){if((d|0)>=(b|0)){L=q;B=H;break e}n[h+(d<<1)>>1]=n[m>>1]|0;d=d+1|0}}else if((_|0)==61)if((N|0)>1275){h=-4;return h|0}else{n[h+(O+-1<<1)>>1]=N;u=P;L=O;B=D;break}while(0);if(c|0)s[c>>2]=u-e;p=(f|0)==0;d=0;while(1){if((d|0)>=(L|0))break;if(!p)s[f+(d<<2)>>2]=u;u=u+(n[h+(d<<1)>>1]|0)|0;d=d+1|0}if(l|0)s[l>>2]=B+(u-e);if(!o){h=L;return h|0}r[o>>0]=G;h=L;return h|0}function nr(e,t,i,r,s,a,o,f,c,l){e=e|0;t=t|0;i=i|0;r=r|0;s=s|0;a=a|0;o=o|0;f=f|0;c=c|0;l=l|0;var u=0,d=0,p=0,b=0,m=0;m=te(t,f)|0;t=te(n[e+(o<<1)>>1]|0,f)|0;if((c|0)!=1){b=(m|0)/(c|0)|0;t=(t|0)<(b|0)?t:b}p=(l|0)==0;b=p?o:0;u=p?a:0;p=p?t:0;c=e+(u<<1)|0;t=n[c>>1]|0;a=te(t<<16>>16,f)|0;o=r;l=0;while(1){if((l|0)>=(te(t<<16>>16,f)|0))break;h[o>>2]=0;t=n[c>>1]|0;o=o+4|0;l=l+1|0}t=u;c=i+(a<<2)|0;e:while(1){if((t|0)>=(b|0))break;l=te(n[e+(t<<1)>>1]|0,f)|0;u=t+1|0;i=te(n[e+(u<<1)>>1]|0,f)|0;d=+J(+((+h[s+(t<<2)>>2]+ +h[17220+(t<<2)>>2])*.6931471805599453));a=o;t=l;l=c;while(1){c=l+4|0;o=a+4|0;h[a>>2]=+h[l>>2]*d;t=t+1|0;if((t|0)<(i|0)){a=o;l=c}else{t=u;continue e}}}kn(r+(p<<2)|0,0,m-p<<2|0)|0;return}function sr(e,t,i,o,f,c,u,d,p,b,m,w,g,v,_,y,k,E,A,S,M,T){e=e|0;t=t|0;i=i|0;o=o|0;f=f|0;c=c|0;u=u|0;d=d|0;p=p|0;b=b|0;m=m|0;w=w|0;g=g|0;v=v|0;_=_|0;y=y|0;k=k|0;E=E|0;A=A|0;S=S|0;M=M|0;T=T|0;var R=0,x=0,C=0,I=0,P=0,O=0,N=0,D=0,L=0,B=0,U=0,j=0,F=0,z=0,q=0,H=0,G=0,V=0,W=0,K=0,Z=0,Y=0,$=0,X=0,J=0,Q=0,ee=0,ie=0,ne=0,se=0,ae=0,oe=0,fe=0,he=0,ce=0,le=0,ue=0,de=0,pe=0,be=0,me=0,we=0,ge=0,ve=0,_e=0,ye=0,ke=0,Ee=0,Ae=0,Se=0,Me=0,Te=0,Re=0,xe=0,Ce=0,Ie=0,Pe=0,Oe=0,Ne=0,De=0,Le=0,Be=0,Ue=0,je=0,Fe=0,ze=0;Fe=l;l=l+1520|0;Ne=Fe+192|0;Be=Fe+24|0;Ue=Fe;je=Fe+144|0;De=Fe+92|0;Le=Fe+40|0;Oe=Fe+244|0;xe=s[t+32>>2]|0;Pe=c|0?2:1;x=(e|0)==0;if(x){Te=0;Re=1}else{Se=(c|0)!=0&(w|0)==0;Re=(M|0)>7;Te=SeℜRe=Se&Re}ve=(b|0)==0?1:1<>1]<>2]|0;b=n[xe+(M+-1<<1)>>1]|0;R=b<>1]|0)-b<>2]=d;s[Ne+28>>2]=k;s[Ne>>2]=e;s[Ne+16>>2]=g;s[Ne+8>>2]=t;de=Ne+40|0;s[de>>2]=s[S>>2];s[Ne+20>>2]=m;s[Ne+44>>2]=T;s[Ne+4>>2]=Re&1;se=Ne+48|0;s[se>>2]=0;ae=Ne+12|0;oe=o+-1|0;fe=(c|0)==0;he=k+20|0;ce=k+28|0;le=Ne+32|0;ue=Ne+24|0;X=t+12|0;J=(1<1;$=i;T=0;R=1;while(1){if(($|0)>=(o|0))break;s[ae>>2]=$;H=($|0)==(oe|0);G=xe+($<<1)|0;Z=n[G>>1]<>1]<>2]|0;M=32-(re(V|0)|0)|0;V=V>>>(M+-16|0);Y=(V>>>12)+-8|0;Y=(s[he>>2]<<3)-((M<<3)+(Y+(V>>>0>(s[5272+(Y<<2)>>2]|0)>>>0&1)))|0;V=y-(($|0)==(i|0)?0:Y)|0;M=_-Y|0;s[le>>2]=M+-1;if(($|0)<(A|0)?(Ce=A-$|0,Ce=(s[p+($<<2)>>2]|0)+((V|0)/(((Ce|0)>3?3:Ce)|0)|0)|0,Ie=(M|0)<(Ce|0),!(((Ie?M:Ce)|0)<16384&((Ie?M:Ce)|0)<0)):0)W=((Ie?M:Ce)|0)>16383?16383:Ie?M:Ce;else W=0;if(Re?((n[G>>1]<=(n[_e>>1]<>2]|0;s[ue>>2]=U;q=($|0)<(s[X>>2]|0);b=q?b:0;z=q?x:Ee;q=q?e:fe?0:Ee;b=H?Te?b:0:b;if((T|0)!=0?(m|0)!=3|ne|(U|0)<0:0){t=(n[xe+(T<<1)>>1]<>1]<(M|0));M=M+Z|0;e=T+-1|0;while(1){R=e+1|0;if((n[xe+(R<<1)>>1]<>0];R=R|a[u+(U+Pe+-1)>>0];if((x|0)<(e|0))x=x+1|0;else{x=M;P=R;break}}}else{t=-1;x=J;P=J}e:do if(w)if(($|0)==(g|0)){if(!Re){Me=31;break}M=xe+(g<<1)|0;R=0;while(1){if((R|0)>=((n[M>>1]<>2]=(+h[Me>>2]+ +h[Se+(R<<2)>>2])*.5;R=R+1|0}}else{y=(W|0)/2|0;R=(t|0)==-1;M=R?0:Ee+(t<<2)|0;if(H){M=ar(Ne,z,Z,y,ve,M,E,0,1,b,x)|0;x=R?0:Se+(t<<2)|0;R=0}else{M=ar(Ne,z,Z,y,ve,M,E,Ee+(n[G>>1]<>1]<>1]<>2]=0;if(H)M=0;else M=Ee+(n[G>>1]<>2];F=+h[d+($+(s[ke>>2]|0)<<2)>>2];N=(j>2]|0;w=s[Q>>2]|0;s[Be>>2]=s[ee>>2];s[Be+4>>2]=s[ee+4>>2];s[Be+8>>2]=s[ee+8>>2];s[Be+12>>2]=s[ee+12>>2];y=s[ie>>2]|0;s[Ue>>2]=s[ce>>2];s[Ue+4>>2]=s[ce+4>>2];s[Ue+8>>2]=s[ce+8>>2];s[Ue+12>>2]=s[ce+12>>2];s[Ue+16>>2]=s[ce+16>>2];M=De;R=Ne;x=M+52|0;do{s[M>>2]=s[R>>2];M=M+4|0;R=R+4|0}while((M|0)<(x|0));B=Z<<2;Mn(pe|0,z|0,B|0)|0;Mn(be|0,q|0,B|0)|0;s[se>>2]=-1;O=(t|0)==-1;if(H)M=0;else M=Ee+(n[G>>1]<=(Z|0)){M=0;C=0;break}N=I+ +h[pe+(M<<2)>>2]*+h[z+(M<<2)>>2];M=M+1|0;I=N}while(1){if((M|0)>=(Z|0))break;N=C+ +h[be+(M<<2)>>2]*+h[q+(M<<2)>>2];M=M+1|0;C=N}N=j*I+F*C;M=je;R=k;x=M+48|0;do{s[M>>2]=s[R>>2];M=M+4|0;R=R+4|0}while((M|0)<(x|0));M=Le;R=Ne;x=M+52|0;do{s[M>>2]=s[R>>2];M=M+4|0;R=R+4|0}while((M|0)<(x|0));Mn(me|0,z|0,B|0)|0;Mn(we|0,q|0,B|0)|0;if(!H)Mn(ge|0,Ee+(n[G>>1]<>2]=e;s[Q>>2]=w;s[ee>>2]=s[Be>>2];s[ee+4>>2]=s[Be+4>>2];s[ee+8>>2]=s[Be+8>>2];s[ee+12>>2]=s[Be+12>>2];s[ie>>2]=y;s[ce>>2]=s[Ue>>2];s[ce+4>>2]=s[Ue+4>>2];s[ce+8>>2]=s[Ue+8>>2];s[ce+12>>2]=s[Ue+12>>2];s[ce+16>>2]=s[Ue+16>>2];M=Ne;R=De;x=M+48|0;do{s[M>>2]=s[R>>2];M=M+4|0;R=R+4|0}while((M|0)<(x|0));Mn(z|0,pe|0,B|0)|0;Mn(q|0,be|0,B|0)|0;s[se>>2]=1;if(H)M=0;else M=Ee+(n[G>>1]<=(Z|0)){M=0;C=0;break}C=I+ +h[pe+(M<<2)>>2]*+h[z+(M<<2)>>2];M=M+1|0;I=C}while(1){if((M|0)>=(Z|0))break;ze=C+ +h[be+(M<<2)>>2]*+h[q+(M<<2)>>2];M=M+1|0;C=ze}if(!(N>=j*I+F*C)){w=0;e=R;M=R}else{M=k;R=je;x=M+48|0;do{s[M>>2]=s[R>>2];M=M+4|0;R=R+4|0}while((M|0)<(x|0));M=Ne;R=Le;x=M+52|0;do{s[M>>2]=s[R>>2];M=M+4|0;R=R+4|0}while((M|0)<(x|0));Mn(z|0,me|0,B|0)|0;Mn(q|0,we|0,B|0)|0;if(!H)Mn(Ee+(n[G>>1]<>0]=e;r[u+(y+Pe+-1)>>0]=M;y=V+((s[p+($<<2)>>2]|0)+Y)|0;$=K;R=(W|0)>(Z<<3|0)&1}s[S>>2]=s[de>>2];l=Fe;return}function ar(e,t,i,n,o,f,c,l,u,d,p){e=e|0;t=t|0;i=i|0;n=n|0;o=o|0;f=f|0;c=c|0;l=l|0;u=+u;d=d|0;p=p|0;var b=0,m=0,w=0,g=0,v=0,_=0,y=0,k=0,E=0,A=0,S=0,M=0,T=0,R=0,x=0;b=s[e>>2]|0;y=s[e+24>>2]|0;A=(o|0)==1&1;_=(i>>>0)/(o>>>0)|0;if((i|0)==1){k=s[e+28>>2]|0;S=e+32|0;E=k+12|0;c=k+16|0;n=k+20|0;y=k+8|0;o=k+4|0;g=k+24|0;v=k+44|0;A=e+4|0;if((s[S>>2]|0)>7){if(!b){d=s[E>>2]|0;f=s[c>>2]|0;if(!f){b=s[o>>2]|0;p=s[y>>2]|0;m=0;do{if(p>>>0>>0){f=p+1|0;s[y>>2]=f;p=f;f=a[(s[k>>2]|0)+(b-f)>>0]|0}else f=0;d=d|f<>>1}else{_=+h[t>>2]<0&1;d=s[E>>2]|0;b=s[c>>2]|0;if((b+1|0)>>>0>32){m=7-b|0;m=b+((m|0)>-8?m:-8)&-8;w=b;do{f=s[y>>2]|0;p=s[o>>2]|0;if(((s[g>>2]|0)+f|0)>>>0

>>0){f=f+1|0;s[y>>2]=f;r[(s[k>>2]|0)+(p-f)>>0]=d;f=0}else f=-1;s[v>>2]=s[v>>2]|f;d=d>>>8;w=w+-8|0}while((w|0)>7);b=b+-8-m|0}f=_;p=b+1|0;d=d|_<>2]=d;s[c>>2]=p;s[n>>2]=(s[n>>2]|0)+1;s[S>>2]=(s[S>>2]|0)+-8}else f=0;if(s[A>>2]|0)h[t>>2]=f|0?-1:1;if(!l){l=1;return l|0}s[l>>2]=s[t>>2];l=1;return l|0}S=(y|0)>0?y:0;do if(d)if(!f)d=0;else{if((S|0)==0?!((_&1|0)==0&(y|0)<0|(o|0)>1):0){d=f;break}Mn(d|0,f|0,i<<2|0)|0}else d=f;while(0);k=(b|0)==0;E=(d|0)==0;v=0;while(1){if((v|0)>=(S|0))break;e:do if(!k){f=1<>v>>1;m=f<<1;w=0;while(1){if((w|0)<(f|0))g=0;else break e;while(1){if((g|0)>=(b|0))break;x=t+((te(m,g)|0)+w<<2)|0;R=+h[x>>2]*.7071067690849304;M=t+(((g<<1|1)<>2]*.7071067690849304;h[x>>2]=R+T;h[M>>2]=R-T;g=g+1|0}w=w+1|0}}while(0);e:do if(!E){f=1<>v>>1;m=f<<1;w=0;while(1){if((w|0)<(f|0))g=0;else break e;while(1){if((g|0)>=(b|0))break;M=d+((te(m,g)|0)+w<<2)|0;T=+h[M>>2]*.7071067690849304;x=d+(((g<<1|1)<>2]*.7071067690849304;h[M>>2]=T+R;h[x>>2]=T-R;g=g+1|0}w=w+1|0}}while(0);p=a[31165+(p&15)>>0]|0|(a[31165+(p>>4)>>0]|0)<<2;v=v+1|0}o=o>>S;v=p;f=_<>1;b=o<<1;m=0;while(1){if((m|0)<(o|0))w=0;else break e;while(1){if((w|0)>=(p|0))break;M=t+((te(b,w)|0)+m<<2)|0;T=+h[M>>2]*.7071067690849304;x=t+((te(w<<1|1,o)|0)+m<<2)|0;R=+h[x>>2]*.7071067690849304;h[M>>2]=T+R;h[x>>2]=T-R;w=w+1|0}m=m+1|0}}while(0);e:do if(E){f=f>>1;p=o<<1}else{f=f>>1;p=o<<1;b=0;while(1){if((b|0)<(o|0))m=0;else break e;while(1){if((m|0)>=(f|0))break;M=d+((te(p,m)|0)+b<<2)|0;T=+h[M>>2]*.7071067690849304;x=d+((te(m<<1|1,o)|0)+b<<2)|0;R=+h[x>>2]*.7071067690849304;h[M>>2]=T+R;h[x>>2]=T-R;m=m+1|0}b=b+1|0}}while(0);x=v|v<1;if(b){if(!k)or(t,f>>S,o<>S,o<>2]|0)){x=p;return x|0}if(b){cr(t,f>>S,o<=(_|0)){g=0;break}g=o>>1;f=f<<1;d=f>>1;b=g<<1;m=0;while(1){if((m|0)<(g|0))w=0;else break;while(1){if((w|0)>=(d|0))break;M=t+((te(b,w)|0)+m<<2)|0;T=+h[M>>2]*.7071067690849304;x=t+((te(w<<1|1,g)|0)+m<<2)|0;R=+h[x>>2]*.7071067690849304;h[M>>2]=T+R;h[x>>2]=T-R;w=w+1|0}m=m+1|0}o=g;p=p|p>>>g;v=v+1|0}while(1){if((g|0)>=(S|0))break;f=r[31181+p>>0]|0;d=1<>g>>1;b=d<<1;m=0;while(1){if((m|0)<(d|0))w=0;else break;while(1){if((w|0)>=(p|0))break;M=t+((te(b,w)|0)+m<<2)|0;T=+h[M>>2]*.7071067690849304;x=t+(((w<<1|1)<>2]*.7071067690849304;h[M>>2]=T+R;h[x>>2]=T-R;w=w+1|0}m=m+1|0}p=f&255;g=g+1|0}f=o<=(i|0))break e;h[l+(d<<2)>>2]=u*+h[t+(d<<2)>>2];d=d+1|0}}while(0);x=p&(1<=(i|0))break;r=te(n,t)|0;a=0;while(1){if((a|0)>=(t|0))break;s[h+(r+a<<2)>>2]=s[e+((te(a,i)|0)+n<<2)>>2];a=a+1|0}n=n+1|0}i=f<<2;Mn(e|0,h|0,i|0)|0;l=c;return}r=17628+(i<<2)+-8|0;a=0;while(1){if((a|0)>=(i|0))break;n=r+(a<<2)|0;o=0;while(1){if((o|0)>=(t|0))break;u=s[e+((te(o,i)|0)+a<<2)>>2]|0;s[h+((te(s[n>>2]|0,t)|0)+o<<2)>>2]=u;o=o+1|0}a=a+1|0}u=f<<2;Mn(e|0,h|0,u|0)|0;l=c;return}function fr(e,t,i,o,f,c,u,d,p){e=e|0;t=t|0;i=i|0;o=o|0;f=f|0;c=c|0;u=u|0;d=+d;p=p|0;var b=0,m=0,w=0,g=0,v=0,_=0,y=0,k=0,E=0,A=0,S=0,M=0,T=0,R=0,x=0,C=0,I=0;C=l;l=l+32|0;S=C+28|0;x=C+24|0;w=C;s[S>>2]=o;s[x>>2]=p;T=s[e>>2]|0;E=s[e+8>>2]|0;A=s[e+12>>2]|0;R=s[e+20>>2]|0;M=s[e+28>>2]|0;v=E+100|0;_=u+1|0;k=E+8|0;g=(te(_,s[k>>2]|0)|0)+A|0;E=E+96|0;g=(s[v>>2]|0)+(n[(s[E>>2]|0)+(g<<1)>>1]|0)|0;m=r[g>>0]|0;if((u|0)!=-1?(i|0)>2?((a[g+(m&255)>>0]|0)+12|0)<(o|0):0:0){k=i>>1;E=t+(k<<2)|0;A=u+-1|0;if((f|0)==1)s[x>>2]=p&1|p<<1;v=f+1>>1;hr(e,w,t,E,k,S,v,f,A,0,x);o=s[w+12>>2]|0;_=s[w+16>>2]|0;m=s[w+20>>2]|0;y=+(s[w+4>>2]|0)*30517578125e-15;b=+(s[w+8>>2]|0)*30517578125e-15;do if(!((f|0)<2|(_&16383|0)==0))if((_|0)>8192){o=o-(o>>5-u)|0;break}else{o=o+(k<<3>>6-u)|0;o=(o|0)>0?0:o;break}while(0);u=s[S>>2]|0;w=(u-o|0)/2|0;g=(u|0)<(w|0);w=((g?u:w)|0)<0?0:g?u:w;u=u-w|0;g=e+32|0;m=(s[g>>2]|0)-m|0;s[g>>2]=m;o=(c|0)==0?0:c+(k<<2)|0;if((w|0)<(u|0)){x=s[x>>2]|0;i=(fr(e,E,k,u,v,o,A,b*d,x>>v)|0)<<(f>>1);f=u+((s[g>>2]|0)-m)|0;c=i|(fr(e,t,k,w+((f|0)<25|(_|0)==16384?0:f+-24|0)|0,v,c,A,y*d,x)|0);l=C;return c|0}else{x=s[x>>2]|0;i=fr(e,t,k,w,v,c,A,y*d,x)|0;c=w+((s[g>>2]|0)-m)|0;c=i|(fr(e,E,k,u+((c|0)<25|(_|0)==0?0:c+-24|0)|0,v,o,A,b*d,x>>v)|0)<<(f>>1);l=C;return c|0}}u=o+-1|0;m=m&255;o=0;w=0;while(1){if((o|0)==6)break;S=w+m+1>>1;I=(a[g+S>>0]|0)<(u|0);m=I?m:S;o=o+1|0;w=I?S:w}if(!w)o=-1;else o=a[g+w>>0]|0;o=(u-o|0)>((a[g+m>>0]|0)-u|0)?m:w;if(!o)m=0;else m=(a[g+o>>0]|0)+1|0;u=e+32|0;g=m;m=(s[u>>2]|0)-m|0;while(1){s[u>>2]=m;if(!((m|0)<0&(o|0)>0))break;m=m+g|0;s[u>>2]=m;o=o+-1|0;if(!o)w=0;else w=(a[(s[v>>2]|0)+(n[(s[E>>2]|0)+((te(_,s[k>>2]|0)|0)+A<<1)>>1]|0)+o>>0]|0)+1|0;g=w;m=m-w|0}if(o|0){if((o|0)>=8)o=(o&7|8)<<(o>>3)+-1;if(!T){I=Ii(t,i,o,R,f,M,d)|0;l=C;return I|0}else{I=xi(t,i,o,R,f,M,d,s[e+4>>2]|0)|0;l=C;return I|0}}if(!(s[e+4>>2]|0)){I=0;l=C;return I|0}o=(1<>2]=m;if(!m){kn(t|0,0,i<<2|0)|0;I=0;l=C;return I|0}w=e+40|0;e:do if(!c){m=0;while(1){if((m|0)>=(i|0))break e;I=(te(s[w>>2]|0,1664525)|0)+1013904223|0;s[w>>2]=I;h[t+(m<<2)>>2]=+(I>>20|0);m=m+1|0}}else{o=0;while(1){if((o|0)>=(i|0)){o=m;break e}I=(te(s[w>>2]|0,1664525)|0)+1013904223|0;s[w>>2]=I;h[t+(o<<2)>>2]=+h[c+(o<<2)>>2]+((I&32768|0)==0?-.00390625:.00390625);o=o+1|0}}while(0);m=0;b=0;while(1){if((m|0)>=(i|0))break;y=+h[t+(m<<2)>>2];m=m+1|0;b=b+y*y}b=1/+H(+(b+1.0000000036274937e-15))*d;m=0;while(1){if((m|0)>=(i|0))break;h[t>>2]=b*+h[t>>2];m=m+1|0;t=t+4|0}l=C;return o|0}function hr(e,t,i,o,f,c,l,u,d,p,b){e=e|0;t=t|0;i=i|0;o=o|0;f=f|0;c=c|0;l=l|0;u=u|0;d=d|0;p=p|0;b=b|0;var m=0,w=0,g=0,v=0,_=0,y=0,k=0,E=0,A=0,S=0,M=0,T=0,R=0,x=0,C=0,I=0,P=0,O=0,N=0,D=0,L=0,B=0,U=0,j=0,F=0,q=0,G=0,V=0;E=s[e>>2]|0;L=s[e+8>>2]|0;B=s[e+12>>2]|0;_=s[e+16>>2]|0;G=s[e+28>>2]|0;D=s[e+36>>2]|0;v=(n[(s[L+56>>2]|0)+(B<<1)>>1]|0)+(d<<3)|0;d=v>>1;N=(p|0)==0;do if(!N)if((f|0)==2){p=d+-16|0;g=2;break}else{p=d+-4|0;g=(f<<1)+-1|0;break}else{p=d+-4|0;g=(f<<1)+-1|0}while(0);d=s[c>>2]|0;p=((te(g,p)|0)+d|0)/(g|0)|0;q=d-v+-32|0;p=(q|0)<(p|0)?q:p;if((p|0)<=64)if((p|0)<4)p=1;else k=8;else{p=64;k=8}if((k|0)==8)p=(n[25760+((p&7)<<1)>>1]>>14-(p>>3))+1&-2;P=N|(B|0)<(_|0)?p:1;O=(E|0)==0;if(O)p=0;else{e:do if(N){p=0;m=0;while(1){if((p|0)>=(f|0)){p=0;w=0;break}S=+h[i+(p<<2)>>2];p=p+1|0;m=m+S*S}while(1){if((p|0)>=(f|0))break;S=+h[o+(p<<2)>>2];p=p+1|0;w=w+S*S}m=m+1.0000000036274937e-15;w=w+1.0000000036274937e-15}else{m=1.0000000036274937e-15;w=1.0000000036274937e-15;p=0;while(1){if((p|0)>=(f|0))break e;V=+h[i+(p<<2)>>2];S=+h[o+(p<<2)>>2];y=V+S;S=V-S;m=m+y*y;w=w+S*S;p=p+1|0}}while(0);S=+H(+m);y=+H(+w);m=S*S;w=y*y;do if(!(m+w<1.000000045813705e-18))if(m>2]|0;j=I<<3;F=G+28|0;T=s[F>>2]|0;x=32-(re(T|0)|0)|0;C=T>>>(x+-16|0);q=(C>>>12)+-8|0;q=(x<<3)+(q+(C>>>0>(s[5272+(q<<2)>>2]|0)>>>0&1))|0;e:do if((P|0)==1)if(!N){if(O)g=0;else{N=(p|0)>8192;g=N&1;t:do if(N){d=0;while(1){if((d|0)>=(f|0))break t;N=o+(d<<2)|0;h[N>>2]=-+h[N>>2];d=d+1|0}}while(0);m=+h[D+(B<<2)>>2];V=+h[D+((s[L+8>>2]|0)+B<<2)>>2];w=+H(+(m*m+1.0000000036274937e-15+V*V))+1.0000000036274937e-15;m=m/w;w=V/w;d=0;while(1){if((d|0)>=(f|0))break;B=i+(d<<2)|0;h[B>>2]=m*+h[B>>2]+w*+h[o+(d<<2)>>2];d=d+1|0}d=s[c>>2]|0}if((d|0)>16?(s[e+32>>2]|0)>16:0){v=s[F>>2]|0;if(O){u=G+32|0;p=s[u>>2]|0;d=v>>>2;o=p>>>0>>0;g=o&1;if(!o){p=p-d|0;s[u>>2]=p;d=v-d|0}s[F>>2]=d;k=G+40|0;E=G+24|0;A=G+4|0;while(1){if(d>>>0>=8388609){p=0;break e}s[U>>2]=(s[U>>2]|0)+8;d=d<<8;s[F>>2]=d;_=s[k>>2]|0;v=s[E>>2]|0;if(v>>>0<(s[A>>2]|0)>>>0){s[E>>2]=v+1;v=a[(s[G>>2]|0)+v>>0]|0}else v=0;s[k>>2]=v;o=((_<<8|v)>>>1&255|p<<8&2147483392)^255;s[u>>2]=o;p=o}}p=v>>>2;d=v-p|0;T=G+32|0;if(g){s[T>>2]=(s[T>>2]|0)+d;d=p}s[F>>2]=d;k=G+36|0;E=G+40|0;A=G+24|0;u=G+8|0;e=G+4|0;M=G+44|0;while(1){if(d>>>0>=8388609){p=0;break e}p=s[T>>2]|0;_=p>>>23;if((_|0)==255)s[k>>2]=(s[k>>2]|0)+1;else{v=p>>>31;d=s[E>>2]|0;if((d|0)>-1){p=s[A>>2]|0;if((p+(s[u>>2]|0)|0)>>>0<(s[e>>2]|0)>>>0){s[A>>2]=p+1;r[(s[G>>2]|0)+p>>0]=d+v;d=0}else d=-1;s[M>>2]=s[M>>2]|d}d=s[k>>2]|0;if(d|0){v=v+255&255;do{p=s[A>>2]|0;if((p+(s[u>>2]|0)|0)>>>0<(s[e>>2]|0)>>>0){s[A>>2]=p+1;r[(s[G>>2]|0)+p>>0]=v;p=0;d=s[k>>2]|0}else p=-1;s[M>>2]=s[M>>2]|p;d=d+-1|0;s[k>>2]=d}while((d|0)!=0)}s[E>>2]=_&255;p=s[T>>2]|0;d=s[F>>2]|0}s[T>>2]=p<<8&2147483392;d=d<<8;s[F>>2]=d;s[U>>2]=(s[U>>2]|0)+8}}else{g=0;p=0}}else g=0;else{do if(!O){if(!N?(A=s[e+48>>2]|0,A|0):0){p=(te(p,P)|0)+((((p|0)>8192?32767:-32767)|0)/(P|0)|0)|0;C=(p|0)<0;p=((P|0)>((C?0:p>>14)|0)?C?0:p>>14:P+-1|0)+(A>>>31^1)|0;break}p=(te(p,P)|0)+8192>>14}while(0);t:do if((f|0)>2&(N^1)){k=(P|0)/2|0;E=(k*3|0)+3|0;A=E+k|0;if(O){v=(T>>>0)/(A>>>0)|0;s[G+36>>2]=v;e=G+32|0;_=s[e>>2]|0;d=((_>>>0)/(v>>>0)|0)+1|0;d=A-(A>>>0>>0?A:d)|0;if((d|0)<(E|0))p=(d|0)/3|0;else p=k+1+(d-E)|0;d=(p|0)>(k|0);if(d)g=p+-1-k+E|0;else g=p*3|0;E=d?p-k+E|0:(p*3|0)+3|0;A=te(v,A-E|0)|0;k=_-A|0;s[e>>2]=k;E=te(v,E-g|0)|0;g=(g|0)==0?T-A|0:E;s[F>>2]=g;E=G+40|0;A=G+24|0;u=G+4|0;d=I;while(1){if(g>>>0>=8388609)break t;d=d+8|0;s[U>>2]=d;g=g<<8;s[F>>2]=g;_=s[E>>2]|0;v=s[A>>2]|0;if(v>>>0<(s[u>>2]|0)>>>0){s[A>>2]=v+1;v=a[(s[G>>2]|0)+v>>0]|0}else v=0;s[E>>2]=v;I=((_<<8|v)>>>1&255|k<<8&2147483392)^255;s[e>>2]=I;k=I}}d=(p|0)>(k|0);if(d)v=p+-1-k+E|0;else v=p*3|0;d=d?p-k+E|0:(p*3|0)+3|0;g=(T>>>0)/(A>>>0)|0;if(!v){d=T-(te(g,A-d|0)|0)|0;s[F>>2]=d;k=G+32|0}else{C=T-(te(g,A-v|0)|0)|0;k=G+32|0;s[k>>2]=(s[k>>2]|0)+C;d=te(g,d-v|0)|0;s[F>>2]=d}E=G+36|0;A=G+40|0;u=G+24|0;e=G+8|0;M=G+4|0;T=G+44|0;g=I;while(1){if(d>>>0>=8388609)break t;v=s[k>>2]|0;_=v>>>23;if((_|0)==255)s[E>>2]=(s[E>>2]|0)+1;else{v=v>>>31;d=s[A>>2]|0;if((d|0)>-1){g=s[u>>2]|0;if((g+(s[e>>2]|0)|0)>>>0<(s[M>>2]|0)>>>0){s[u>>2]=g+1;r[(s[G>>2]|0)+g>>0]=d+v;d=0}else d=-1;s[T>>2]=s[T>>2]|d}d=s[E>>2]|0;if(d|0){v=v+255&255;do{g=s[u>>2]|0;if((g+(s[e>>2]|0)|0)>>>0<(s[M>>2]|0)>>>0){s[u>>2]=g+1;r[(s[G>>2]|0)+g>>0]=v;g=0;d=s[E>>2]|0}else g=-1;s[T>>2]=s[T>>2]|g;d=d+-1|0;s[E>>2]=d}while((d|0)!=0)}s[A>>2]=_&255;v=s[k>>2]|0;d=s[F>>2]|0;g=s[U>>2]|0}s[k>>2]=v<<8&2147483392;d=d<<8;s[F>>2]=d;g=g+8|0;s[U>>2]=g}}else{if(!((u|0)>1|N^1)){g=P>>1;v=g+1|0;e=te(v,v)|0;if(O){A=(T>>>0)/(e>>>0)|0;s[G+36>>2]=A;M=G+32|0;u=s[M>>2]|0;p=((u>>>0)/(A>>>0)|0)+1|0;p=e>>>0

>>0?e:p;d=e-p|0;if((d|0)<((te(g,v)|0)>>1|0)){d=d<<3|1;_=32-(re(d|0)|0)+-1>>1;v=1<<_;k=0;while(1){p=(k<<1)+v<<_;g=d>>>0

>>0;k=k+(g?0:v)|0;if((_|0)<=0)break;else{d=d-(g?0:p)|0;v=v>>>1;_=_+-1|0}}p=(k+-1|0)>>>1;g=p+1|0;d=(te(p,g)|0)>>>1}else{E=P<<1;d=(p<<3)+-7|0;_=32-(re(d|0)|0)+-1>>1;v=1<<_;k=0;while(1){p=(k<<1)+v<<_;g=d>>>0

>>0;k=k+(g?0:v)|0;if((_|0)<=0)break;else{d=d-(g?0:p)|0;v=v>>>1;_=_+-1|0}}p=(E+2-k|0)>>>1;g=P+1-p|0;d=e-((te(g,P+2-p|0)|0)>>1)|0}E=te(A,e-(d+g)|0)|0;k=u-E|0;s[M>>2]=k;g=te(A,g)|0;g=(d|0)==0?T-E|0:g;s[F>>2]=g;E=G+40|0;A=G+24|0;u=G+4|0;d=I;while(1){if(g>>>0>=8388609)break t;d=d+8|0;s[U>>2]=d;g=g<<8;s[F>>2]=g;_=s[E>>2]|0;v=s[A>>2]|0;if(v>>>0<(s[u>>2]|0)>>>0){s[A>>2]=v+1;v=a[(s[G>>2]|0)+v>>0]|0}else v=0;s[E>>2]=v;I=((_<<8|v)>>>1&255|k<<8&2147483392)^255;s[M>>2]=I;k=I}}C=(p|0)>(g|0);d=C?P+1-p|0:p+1|0;if(C)v=e-((te(P+1-p|0,P+2-p|0)|0)>>1)|0;else v=(te(p,p+1|0)|0)>>1;g=(T>>>0)/(e>>>0)|0;if(!v){d=T-(te(g,e-d|0)|0)|0;s[F>>2]=d;k=G+32|0}else{C=T-(te(g,e-v|0)|0)|0;k=G+32|0;s[k>>2]=(s[k>>2]|0)+C;d=te(g,d)|0;s[F>>2]=d}E=G+36|0;A=G+40|0;u=G+24|0;e=G+8|0;M=G+4|0;T=G+44|0;g=I;while(1){if(d>>>0>=8388609)break t;v=s[k>>2]|0;_=v>>>23;if((_|0)==255)s[E>>2]=(s[E>>2]|0)+1;else{v=v>>>31;d=s[A>>2]|0;if((d|0)>-1){g=s[u>>2]|0;if((g+(s[e>>2]|0)|0)>>>0<(s[M>>2]|0)>>>0){s[u>>2]=g+1;r[(s[G>>2]|0)+g>>0]=d+v;d=0}else d=-1;s[T>>2]=s[T>>2]|d}d=s[E>>2]|0;if(d|0){v=v+255&255;do{g=s[u>>2]|0;if((g+(s[e>>2]|0)|0)>>>0<(s[M>>2]|0)>>>0){s[u>>2]=g+1;r[(s[G>>2]|0)+g>>0]=v;g=0;d=s[E>>2]|0}else g=-1;s[T>>2]=s[T>>2]|g;d=d+-1|0;s[E>>2]=d}while((d|0)!=0)}s[A>>2]=_&255;v=s[k>>2]|0;d=s[F>>2]|0;g=s[U>>2]|0}s[k>>2]=v<<8&2147483392;d=d<<8;s[F>>2]=d;g=g+8|0;s[U>>2]=g}}v=P+1|0;if(O){g=0;p=((ci(G,v)|0)<<14>>>0)/(P>>>0)|0;break e}d=32-(re(P|0)|0)|0;if((d|0)<=8){d=(T>>>0)/(v>>>0)|0;if(!p){d=T-(te(d,P)|0)|0;s[F>>2]=d;T=G+32|0}else{C=T-(te(d,v-p|0)|0)|0;T=G+32|0;s[T>>2]=(s[T>>2]|0)+C;s[F>>2]=d}k=G+36|0;E=G+40|0;A=G+24|0;u=G+8|0;e=G+4|0;M=G+44|0;g=I;while(1){if(d>>>0>=8388609)break t;v=s[T>>2]|0;_=v>>>23;if((_|0)==255)s[k>>2]=(s[k>>2]|0)+1;else{v=v>>>31;d=s[E>>2]|0;if((d|0)>-1){g=s[A>>2]|0;if((g+(s[u>>2]|0)|0)>>>0<(s[e>>2]|0)>>>0){s[A>>2]=g+1;r[(s[G>>2]|0)+g>>0]=d+v;d=0}else d=-1;s[M>>2]=s[M>>2]|d}d=s[k>>2]|0;if(d|0){v=v+255&255;do{g=s[A>>2]|0;if((g+(s[u>>2]|0)|0)>>>0<(s[e>>2]|0)>>>0){s[A>>2]=g+1;r[(s[G>>2]|0)+g>>0]=v;g=0;d=s[k>>2]|0}else g=-1;s[M>>2]=s[M>>2]|g;d=d+-1|0;s[k>>2]=d}while((d|0)!=0)}s[E>>2]=_&255;v=s[T>>2]|0;d=s[F>>2]|0;g=s[U>>2]|0}s[T>>2]=v<<8&2147483392;d=d<<8;s[F>>2]=d;g=g+8|0;s[U>>2]=g}}C=d+-8|0;d=P>>>C;g=d+1|0;v=p>>>C;_=(T>>>0)/(g>>>0)|0;if(!v){_=T-(te(_,d)|0)|0;s[F>>2]=_;u=G+32|0}else{x=T-(te(_,g-v|0)|0)|0;u=G+32|0;s[u>>2]=(s[u>>2]|0)+x;s[F>>2]=_}E=G+36|0;A=G+40|0;M=G+24|0;T=G+8|0;R=G+4|0;x=G+44|0;v=I;while(1){if(_>>>0>=8388609)break;d=s[u>>2]|0;k=d>>>23;if((k|0)==255)s[E>>2]=(s[E>>2]|0)+1;else{v=d>>>31;d=s[A>>2]|0;if((d|0)>-1){g=s[M>>2]|0;if((g+(s[T>>2]|0)|0)>>>0<(s[R>>2]|0)>>>0){s[M>>2]=g+1;r[(s[G>>2]|0)+g>>0]=d+v;d=0}else d=-1;s[x>>2]=s[x>>2]|d}d=s[E>>2]|0;if(d|0){v=v+255&255;do{g=s[M>>2]|0;if((g+(s[T>>2]|0)|0)>>>0<(s[R>>2]|0)>>>0){s[M>>2]=g+1;r[(s[G>>2]|0)+g>>0]=v;g=0;d=s[E>>2]|0}else g=-1;s[x>>2]=s[x>>2]|g;d=d+-1|0;s[E>>2]=d}while((d|0)!=0)}s[A>>2]=k&255;d=s[u>>2]|0;_=s[F>>2]|0;v=s[U>>2]|0}s[u>>2]=d<<8&2147483392;_=_<<8;s[F>>2]=_;v=v+8|0;s[U>>2]=v}A=(1<>2]|0;e=G+16|0;g=s[e>>2]|0;if((g+C|0)>>>0>32){E=7-g|0;E=g+((E|0)>-8?E:-8)&-8;k=g;do{v=s[T>>2]|0;_=s[R>>2]|0;if(((s[M>>2]|0)+v|0)>>>0<_>>>0){v=v+1|0;s[T>>2]=v;r[(s[G>>2]|0)+(_-v)>>0]=d;v=0}else v=-1;s[x>>2]=s[x>>2]|v;d=d>>>8;k=k+-8|0}while((k|0)>7);v=s[U>>2]|0;g=g+-8-E|0}s[u>>2]=d|A<>2]=g+C;s[U>>2]=v+C}while(0);p=(p<<14>>>0)/(P>>>0)|0;if(O|N)g=0;else{if(p|0){d=0;while(1){if((d|0)>=(f|0)){g=0;break e}B=i+(d<<2)|0;V=+h[B>>2]*.7071067690849304;G=o+(d<<2)|0;S=+h[G>>2]*.7071067690849304;h[B>>2]=V+S;h[G>>2]=S-V;d=d+1|0}}m=+h[D+(B<<2)>>2];V=+h[D+((s[L+8>>2]|0)+B<<2)>>2];w=+H(+(m*m+1.0000000036274937e-15+V*V))+1.0000000036274937e-15;m=m/w;w=V/w;d=0;while(1){if((d|0)>=(f|0)){g=0;p=0;break e}G=i+(d<<2)|0;h[G>>2]=m*+h[G>>2]+w*+h[o+(d<<2)>>2];d=d+1|0}}}while(0);G=s[F>>2]|0;F=32-(re(G|0)|0)|0;G=G>>>(F+-16|0);d=(G>>>12)+-8|0;d=(s[U>>2]<<3)-((F<<3)+(d+(G>>>0>(s[5272+(d<<2)>>2]|0)>>>0&1)))+(q-j)|0;s[c>>2]=(s[c>>2]|0)-d;e:do if((p|0)<16384){switch(p|0){case 0:break;default:break e}s[b>>2]=s[b>>2]&(1<>2]=g;b=t+4|0;s[b>>2]=l;b=t+8|0;s[b>>2]=f;b=t+12|0;s[b>>2]=c;b=t+16|0;s[b>>2]=p;t=t+20|0;s[t>>2]=d;return}else{switch(p|0){case 16384:break;default:break e}s[b>>2]=s[b>>2]&(1<>2]=g;b=t+4|0;s[b>>2]=l;b=t+8|0;s[b>>2]=f;b=t+12|0;s[b>>2]=c;b=t+16|0;s[b>>2]=p;t=t+20|0;s[t>>2]=d;return}while(0);q=p<<16>>16;q=((te(q,q)|0)+4096|0)>>>13;l=q<<16>>16;l=(32767-q+(((te(l,(((te(l,(((te(l,-626)|0)+16384|0)>>>15<<16)+542441472>>16)|0)+16384|0)>>>15<<16)+-501415936>>16)|0)+16384|0)>>>15)<<16)+65536>>16;q=16384-p<<16>>16;q=((te(q,q)|0)+4096|0)>>>13;b=q<<16>>16;b=(32767-q+(((te(b,(((te(b,(((te(b,-626)|0)+16384|0)>>>15<<16)+542441472>>16)|0)+16384|0)>>>15<<16)+-501415936>>16)|0)+16384|0)>>>15)<<16)+65536>>16;q=32-(re(l|0)|0)|0;F=32-(re(b|0)|0)|0;G=b<<15-F<<16>>16;c=l<<15-q<<16>>16;c=(te((f<<23)+-8388608>>16,(F-q<<11)+(((te(G,(((te(G,-2597)|0)+16384|0)>>>15<<16)+519831552>>16)|0)+16384|0)>>>15)-(((te(c,(((te(c,-2597)|0)+16384|0)>>>15<<16)+519831552>>16)|0)+16384|0)>>>15)<<16>>16)|0)+16384>>15; +f=b;s[t>>2]=g;b=t+4|0;s[b>>2]=l;b=t+8|0;s[b>>2]=f;b=t+12|0;s[b>>2]=c;b=t+16|0;s[b>>2]=p;t=t+20|0;s[t>>2]=d;return}function cr(e,t,i,r){e=e|0;t=t|0;i=i|0;r=r|0;var n=0,a=0,o=0,f=0,h=0,c=0;c=l;f=te(t,i)|0;h=l;l=l+((1*(f<<2)|0)+15&-16)|0;if(!r){n=0;while(1){if((n|0)>=(i|0))break;r=te(n,t)|0;a=0;while(1){if((a|0)>=(t|0))break;s[h+((te(a,i)|0)+n<<2)>>2]=s[e+(r+a<<2)>>2];a=a+1|0}n=n+1|0}i=f<<2;Mn(e|0,h|0,i|0)|0;l=c;return}r=17628+(i<<2)+-8|0;a=0;while(1){if((a|0)>=(i|0))break;n=r+(a<<2)|0;o=0;while(1){if((o|0)>=(t|0))break;s[h+((te(o,i)|0)+a<<2)>>2]=s[e+((te(s[n>>2]|0,t)|0)+o<<2)>>2];o=o+1|0}a=a+1|0}i=f<<2;Mn(e|0,h|0,i|0)|0;l=c;return}function lr(e,t,i,n,o,f,c,u,d,p,b){e=e|0;t=t|0;i=i|0;n=n|0;o=o|0;f=f|0;c=c|0;u=u|0;d=d|0;p=p|0;b=b|0;var m=0,w=0,g=0,v=0,_=0,y=0,k=0,E=0,A=0,S=0,M=0,T=0,R=0,x=0,C=0,I=0,P=0,O=0,N=0,D=0,L=0,B=0,U=0,j=0;U=l;l=l+32|0;m=U+28|0;E=U+24|0;_=U;s[m>>2]=o;s[E>>2]=b;k=s[e>>2]|0;B=s[e+28>>2]|0;if((n|0)==1){c=e+32|0;f=(k|0)==0;u=B+12|0;x=B+16|0;C=B+20|0;I=B+8|0;P=B+4|0;O=B+24|0;b=B+44|0;S=e+4|0;M=i|0?2:1;T=0;R=t;while(1){if((s[c>>2]|0)>7){if(f){m=s[u>>2]|0;o=s[x>>2]|0;if(!o){y=s[P>>2]|0;_=s[I>>2]|0;k=0;do{if(_>>>0>>0){o=_+1|0;s[I>>2]=o;_=o;o=a[(s[B>>2]|0)+(y-o)>>0]|0}else o=0;m=m|o<>>1}else{A=+h[R>>2]<0&1;m=s[u>>2]|0;y=s[x>>2]|0;if((y+1|0)>>>0>32){k=7-y|0;k=y+((k|0)>-8?k:-8)&-8;E=y;do{o=s[I>>2]|0;_=s[P>>2]|0;if(((s[O>>2]|0)+o|0)>>>0<_>>>0){o=o+1|0;s[I>>2]=o;r[(s[B>>2]|0)+(_-o)>>0]=m;o=0}else o=-1;s[b>>2]=s[b>>2]|o;m=m>>>8;E=E+-8|0}while((E|0)>7);y=y+-8-k|0}o=A;_=y+1|0;m=m|A<>2]=m;s[x>>2]=_;s[C>>2]=(s[C>>2]|0)+1;s[c>>2]=(s[c>>2]|0)+-8}else o=0;if(s[S>>2]|0)h[R>>2]=o|0?-1:1;T=T+1|0;if((T|0)>=(M|0))break;else R=i}if(!d){i=1;l=U;return i|0}s[d>>2]=s[t>>2];i=1;l=U;return i|0}hr(e,_,t,i,n,m,f,f,u,1,E);D=s[_>>2]|0;S=s[_+16>>2]|0;A=s[_+20>>2]|0;L=+(s[_+4>>2]|0)*30517578125e-15;w=+(s[_+8>>2]|0)*30517578125e-15;N=(n|0)==2;do if(N){o=s[m>>2]|0;if((S|0)<16384)switch(S|0){case 0:{m=0;break}default:y=26}else switch(S|0){case 16384:{m=0;break}default:y=26}if((y|0)==26)m=8;O=o-m|0;I=(S|0)>8192;P=e+32|0;s[P>>2]=(s[P>>2]|0)-(A+m);P=I?i:t;I=I?t:i;do if(!m)o=0;else{if(!k){A=B+12|0;m=s[A>>2]|0;S=B+16|0;o=s[S>>2]|0;if(!o){k=B+8|0;y=s[B+4>>2]|0;_=s[k>>2]|0;E=0;do{if(_>>>0>>0){_=_+1|0;s[k>>2]=_;o=a[(s[B>>2]|0)+(y-_)>>0]|0}else o=0;m=m|o<>2]=m>>>1;s[S>>2]=o+-1;o=B+20|0;s[o>>2]=(s[o>>2]|0)+1;o=m&1;break}o=+h[P>>2]*+h[I+4>>2]-+h[P+4>>2]*+h[I>>2]<0&1;x=B+12|0;m=s[x>>2]|0;C=B+16|0;_=s[C>>2]|0;if((_+1|0)>>>0>32){E=B+24|0;A=B+8|0;S=B+4|0;M=B+44|0;T=7-_|0;T=_+((T|0)>-8?T:-8)&-8;R=_;do{y=s[A>>2]|0;k=s[S>>2]|0;if(((s[E>>2]|0)+y|0)>>>0>>0){y=y+1|0;s[A>>2]=y;r[(s[B>>2]|0)+(k-y)>>0]=m;y=0}else y=-1;s[M>>2]=s[M>>2]|y;m=m>>>8;R=R+-8|0}while((R|0)>7);_=_+-8-T|0}s[x>>2]=m|o<<_;s[C>>2]=_+1;B=B+20|0;s[B>>2]=(s[B>>2]|0)+1}while(0);B=1-(o<<1)|0;o=ar(e,P,2,O,f,c,u,d,1,p,b)|0;h[I>>2]=+(0-B|0)*+h[P+4>>2];h[I+4>>2]=+(B|0)*+h[P>>2];if(s[e+4>>2]|0){h[t>>2]=L*+h[t>>2];B=t+4|0;h[B>>2]=L*+h[B>>2];g=w*+h[i>>2];h[i>>2]=g;d=i+4|0;h[d>>2]=w*+h[d>>2];v=+h[t>>2];h[t>>2]=v-g;h[i>>2]=v+ +h[i>>2];v=+h[B>>2];h[B>>2]=v-+h[d>>2];h[d>>2]=v+ +h[d>>2]}}else{y=s[m>>2]|0;_=(y-(s[_+12>>2]|0)|0)/2|0;k=(y|0)<(_|0);_=((k?y:_)|0)<0?0:k?y:_;y=y-_|0;k=e+32|0;m=(s[k>>2]|0)-A|0;s[k>>2]=m;o=s[E>>2]|0;if((_|0)<(y|0)){b=ar(e,i,n,y,f,0,u,0,w,0,o>>f)|0;B=y+((s[k>>2]|0)-m)|0;o=b|(ar(e,t,n,_+((B|0)<25|(S|0)==16384?0:B+-24|0)|0,f,c,u,d,1,p,o)|0);break}else{B=ar(e,t,n,_,f,c,u,d,1,p,o)|0;d=_+((s[k>>2]|0)-m)|0;o=B|(ar(e,i,n,y+((d|0)<25|(S|0)==0?0:d+-24|0)|0,f,0,u,0,w,0,o>>f)|0);break}}while(0);if(!(s[e+4>>2]|0)){i=o;l=U;return i|0}e:do if(!N){m=0;w=0;g=0;while(1){if((m|0)>=(n|0))break;v=+h[i+(m<<2)>>2];j=w+v*+h[t+(m<<2)>>2];m=m+1|0;w=j;g=g+v*v}j=L*L+g;g=w*L*2;w=j-g;g=j+g;if(g<.0006000000284984708|w<.0006000000284984708){Mn(i|0,t|0,n<<2|0)|0;break}v=1/+H(+w);w=1/+H(+g);m=0;while(1){if((m|0)>=(n|0))break e;B=t+(m<<2)|0;g=+h[B>>2]*L;d=i+(m<<2)|0;j=+h[d>>2];h[B>>2]=v*(g-j);h[d>>2]=w*(g+j);m=m+1|0}}while(0);if(!D){i=o;l=U;return i|0}else m=0;while(1){if((m|0)>=(n|0))break;t=i+(m<<2)|0;h[t>>2]=-+h[t>>2];m=m+1|0}l=U;return o|0}function ur(e,t,i,a,o,f){e=e|0;t=t|0;i=i|0;a=a|0;o=o|0;f=f|0;var h=0,c=0,u=0,d=0,p=0,b=0,m=0,w=0,g=0,v=0,_=0,y=0,k=0,E=0,A=0,S=0,M=0,T=0,R=0,x=0,C=0,I=0,P=0,O=0;O=l;l=l+208|0;x=O+176|0;C=O+144|0;P=O;R=e+2328|0;I=s[R>>2]|0;T=P+136|0;s[T>>2]=0;switch(o|0){case 0:{h=e+2388|0;c=4;break}case 2:{h=e+2388|0;if((s[e+2420+(s[h>>2]<<2)>>2]|0)==1)c=4;else c=57;break}default:c=57}if((c|0)==4){M=Ne()|0;_=l;l=l+((1*((I+15&-16)<<1)|0)+15&-16)|0;dr(e,t,s[h>>2]|0,o,f);S=e+2765|0;pr(t,_,r[S>>0]|0,r[e+2766>>0]|0,s[R>>2]|0);A=e+2324|0;mr(P+16|0,e+2736|0,e+2312|0,(f|0)==2&1,s[A>>2]|0);wr(x,e+2744|0,s[e+2732>>2]|0);y=P+64|0;k=e+2340|0;xr(y,x,s[k>>2]|0);E=e+2376|0;h=e+2767|0;if((s[E>>2]|0)!=1){h=r[h>>0]|0;if(h<<24>>24<4){o=s[k>>2]|0;t=0;while(1){if((t|0)>=(o|0))break;v=n[e+2344+(t<<1)>>1]|0;n[C+(t<<1)>>1]=(v&65535)+((te(h<<24>>24,(n[x+(t<<1)>>1]|0)-(v<<16>>16)|0)|0)>>>2);t=t+1|0}xr(P+32|0,C,o);o=s[k>>2]|0}else c=11}else{r[h>>0]=4;c=11}if((c|0)==11){o=s[k>>2]|0;Mn(P+32|0,y|0,o<<1|0)|0}Mn(e+2344|0,x|0,o<<1|0)|0;h=e+4160|0;if(s[h>>2]|0){f=o+-1|0;o=63570;t=0;while(1){if((t|0)>=(f|0))break;v=P+32+(t<<1)|0;n[v>>1]=(((te(o,n[v>>1]|0)|0)>>>15)+1|0)>>>1;o=o+(((te(o,-1966)|0)>>15)+1>>1)|0;t=t+1|0}t=P+32+(f<<1)|0;n[t>>1]=(((te(o,n[t>>1]|0)|0)>>>15)+1|0)>>>1;o=63570;t=0;while(1){if((t|0)>=(f|0))break;v=P+64+(t<<1)|0;n[v>>1]=(((te(o,n[v>>1]|0)|0)>>>15)+1|0)>>>1;o=o+(((te(o,-1966)|0)>>15)+1>>1)|0;t=t+1|0}v=P+64+(f<<1)|0;n[v>>1]=(((te(o,n[v>>1]|0)|0)>>>15)+1|0)>>>1}if((r[S>>0]|0)==2){o=e+2316|0;c=s[o>>2]|0;v=s[A>>2]|0;f=(c|0)==8;m=(v|0)==4;w=f?m?11:3:m?34:12;m=f?m?32969:32935:m?33013:32941;c=c<<16;f=c>>15;c=(c>>16)*18|0;u=f+(n[e+2762>>1]|0)|0;d=r[e+2764>>0]|0;p=(f|0)>(c|0);g=0;while(1){if((g|0)>=(v|0))break;t=u+(r[m+((te(g,w)|0)+d)>>0]|0)|0;b=P+(g<<2)|0;s[b>>2]=t;if(p)if((t|0)>(f|0))t=f;else t=(t|0)<(c|0)?c:t;else if((t|0)>(c|0))t=c;else t=(t|0)<(f|0)?f:t;s[b>>2]=t;g=g+1|0}f=n[e+2768>>1]|0;t=s[17400+((f&65535)<<24>>24<<2)>>2]|0;f=(f&65535)>>>8;p=0;while(1){if((p|0)>=(v|0))break;c=(r[e+2740+p>>0]|0)*5|0;u=p*5|0;d=0;while(1){if((d|0)==5)break;n[P+96+(u+d<<1)>>1]=r[t+(c+d)>>0]<<7;d=d+1|0}p=p+1|0}s[T>>2]=n[25412+((f&65535)<<24>>24<<1)>>1]}else{o=s[A>>2]|0;kn(P|0,0,o<<2|0)|0;kn(P+96|0,0,o*10|0)|0;r[e+2768>>0]=0;s[T>>2]=0;o=e+2316|0}Br(e,P,i,_);t=s[o>>2]|0;o=e+4248|0;if((t|0)!=(s[o>>2]|0)){s[e+4168>>2]=s[R>>2]<<7;s[e+4240>>2]=65536;s[e+4244>>2]=65536;s[e+4256>>2]=20;s[e+4252>>2]=2;s[o>>2]=t}g=e+4168|0;_=r[S>>0]|0;v=e+4164|0;s[v>>2]=_<<24>>24;e:do if(_<<24>>24==2){o=e+2332|0;d=s[o>>2]|0;p=s[A>>2]|0;b=p+-1|0;m=e+4172|0;u=s[P+(b<<2)>>2]|0;t=0;w=0;while(1){if((te(w,d)|0)>=(u|0)|(w|0)==(p|0))break;else{f=0;c=0}while(1){if((f|0)==5)break;_=c+(n[P+96+(((b-w|0)*5|0)+f<<1)>>1]|0)|0;f=f+1|0;c=_}if((c|0)>(t|0)){t=P+96+((p+65535-w<<16>>16)*5<<1)|0;n[m>>1]=n[t>>1]|0;n[m+2>>1]=n[t+2>>1]|0;n[m+4>>1]=n[t+4>>1]|0;n[m+6>>1]=n[t+6>>1]|0;n[m+8>>1]=n[t+8>>1]|0;s[g>>2]=s[P+(b-w<<2)>>2]<<8;t=c}w=w+1|0}s[m>>2]=0;s[m+4>>2]=0;n[m+8>>1]=0;n[e+4176>>1]=t;if((t|0)<11469){t=(11744256/(((t|0)>1?t:1)|0)|0)<<16>>16;f=0;while(1){if((f|0)==5)break e;_=e+4172+(f<<1)|0;n[_>>1]=(te(n[_>>1]|0,t)|0)>>>10;f=f+1|0}}if((t|0)>15565){t=(255016960/(t|0)|0)<<16>>16;f=0;while(1){if((f|0)==5)break e;_=e+4172+(f<<1)|0;n[_>>1]=(te(n[_>>1]|0,t)|0)>>>14;f=f+1|0}}}else{s[g>>2]=(t<<16>>16)*4608;o=e+4172|0;s[o>>2]=0;s[o+4>>2]=0;n[o+8>>1]=0;o=e+2332|0}while(0);Mn(e+4182|0,y|0,s[k>>2]<<1|0)|0;n[e+4236>>1]=s[T>>2];T=s[A>>2]|0;y=P+16+(T+-2<<2)|0;k=s[y+4>>2]|0;A=e+4240|0;s[A>>2]=s[y>>2];s[A+4>>2]=k;s[e+4256>>2]=s[o>>2];s[e+4252>>2]=T;s[h>>2]=0;s[v>>2]=r[S>>0];s[E>>2]=0;qe(M|0);o=P}else if((c|0)==57){r[e+2765>>0]=s[e+4164>>2];h=s[e+2316>>2]|0;o=e+4248|0;if((h|0)!=(s[o>>2]|0)){s[e+4168>>2]=I<<7;s[e+4240>>2]=65536;s[e+4244>>2]=65536;s[e+4256>>2]=20;s[e+4252>>2]=2;s[o>>2]=h}yr(e,P,i);h=e+4160|0;s[h>>2]=(s[h>>2]|0)+1;o=P}M=s[R>>2]|0;T=(s[e+2336>>2]|0)-M|0;Tn(e+1348|0,e+1348+(M<<1)|0,T<<1|0)|0;Mn(e+1348+(T<<1)|0,i|0,s[R>>2]<<1|0)|0;Lr(e,o,i,I);if(s[h>>2]|0){Nr(e+4228|0,e+4232|0,i,I);s[e+4216>>2]=1;i=e+2324|0;i=s[i>>2]|0;i=i+-1|0;i=P+(i<<2)|0;i=s[i>>2]|0;P=e+2308|0;s[P>>2]=i;s[a>>2]=I;l=O;return 0}c=e+4216|0;e:do if(s[c>>2]|0){Nr(C,x,i,I);h=s[x>>2]|0;o=s[e+4232>>2]|0;if((h|0)<=(o|0)){if((h|0)<(o|0))s[C>>2]=s[C>>2]>>o-h}else{x=e+4228|0;s[x>>2]=s[x>>2]>>h-o}h=s[C>>2]|0;o=e+4228|0;t=s[o>>2]|0;if((h|0)>(t|0)){R=re(t|0)|0;x=t<>2]=x;R=25-R|0;h=h>>((R|0)>0?R:0);s[C>>2]=h;h=(x|0)/(((h|0)>1?h:1)|0)|0;if((h|0)<1)h=0;else{f=re(h|0)|0;o=24-f|0;t=0-o|0;do if(o)if((o|0)<0){h=h<>>(o+32|0);break}else{h=h<<32-o|h>>>o;break}while(0);C=((f&1|0)==0?46214:32768)>>>(f>>>1);h=(te(h&127,13959168)|0)>>>16;h=C+((te(C>>16,h)|0)+((te(C&65535,h)|0)>>>16))<<4}t=((65536-h|0)/(I|0)|0)<<2;o=0;while(1){if((o|0)>=(I|0))break e;C=i+(o<<1)|0;x=n[C>>1]|0;n[C>>1]=(te(h>>16,x)|0)+((te(h&65532,x)|0)>>>16);h=h+t|0;if((h|0)>65536)break e;o=o+1|0}}}while(0);s[c>>2]=0;i=e+2324|0;i=s[i>>2]|0;i=i+-1|0;i=P+(i<<2)|0;i=s[i>>2]|0;P=e+2308|0;s[P>>2]=i;s[a>>2]=I;l=O;return 0}function dr(e,t,i,f,h){e=e|0;t=t|0;i=i|0;f=f|0;h=h|0;var c=0,u=0,d=0,p=0,b=0,m=0,w=0,g=0,v=0,_=0,y=0,k=0,E=0,A=0,S=0,M=0,T=0,R=0,x=0,C=0;C=l;l=l+48|0;S=C;k=C+32|0;e:do if((f|0)==0?(s[e+2404+(i<<2)>>2]|0)==0:0){g=t+28|0;d=s[g>>2]|0;v=t+32|0;f=s[v>>2]|0;c=d>>>8;i=-1;while(1){i=i+1|0;u=te(c,a[29937+i>>0]|0)|0;if(f>>>0>=u>>>0)break;else d=u}w=f-u|0;s[v>>2]=w;f=d-u|0;s[g>>2]=f;d=t+20|0;p=t+40|0;b=t+24|0;m=t+4|0;while(1){if(f>>>0>=8388609)break e;s[d>>2]=(s[d>>2]|0)+8;f=f<<8;s[g>>2]=f;u=s[p>>2]|0;c=s[b>>2]|0;if(c>>>0<(s[m>>2]|0)>>>0){s[b>>2]=c+1;c=a[(s[t>>2]|0)+c>>0]|0}else c=0;s[p>>2]=c;x=((u<<8|c)>>>1&255|w<<8&2147483392)^255;s[v>>2]=x;w=x}}else T=3;while(0);if((T|0)==3){w=t+28|0;d=s[w>>2]|0;g=t+32|0;f=s[g>>2]|0;c=d>>>8;v=-1;while(1){u=v+1|0;i=te(c,a[29933+u>>0]|0)|0;if(f>>>0>>0){v=u;d=i}else break}m=f-i|0;s[g>>2]=m;i=d-i|0;s[w>>2]=i;u=t+20|0;d=t+40|0;p=t+24|0;b=t+4|0;while(1){if(i>>>0>=8388609)break;s[u>>2]=(s[u>>2]|0)+8;i=i<<8;s[w>>2]=i;c=s[d>>2]|0;f=s[p>>2]|0;if(f>>>0<(s[b>>2]|0)>>>0){s[p>>2]=f+1;f=a[(s[t>>2]|0)+f>>0]|0}else f=0;s[d>>2]=f;x=((c<<8|f)>>>1&255|m<<8&2147483392)^255;s[g>>2]=x;m=x}i=v+3|0}f=i>>>1;x=e+2765|0;r[x>>0]=f;r[e+2766>>0]=i&1;E=(h|0)==2;if(E){v=t+28|0;u=s[v>>2]|0;w=t+32|0;f=s[w>>2]|0;c=u>>>8;g=-1;while(1){g=g+1|0;i=te(c,a[29396+g>>0]|0)|0;if(f>>>0>=i>>>0)break;else u=i}R=f-i|0;s[w>>2]=R;i=u-i|0;s[v>>2]=i;d=t+20|0;p=t+40|0;b=t+24|0;m=t+4|0;u=R;while(1){if(i>>>0>=8388609)break;s[d>>2]=(s[d>>2]|0)+8;i=i<<8;s[v>>2]=i;c=s[p>>2]|0;f=s[b>>2]|0;if(f>>>0<(s[m>>2]|0)>>>0){s[b>>2]=f+1;f=a[(s[t>>2]|0)+f>>0]|0}else f=0;s[p>>2]=f;R=((c<<8|f)>>>1&255|u<<8&2147483392)^255;s[w>>2]=R;u=R}r[e+2736>>0]=g;y=w;R=d;_=b;M=t}else{i=f<<24>>24;v=t+28|0;d=s[v>>2]|0;y=t+32|0;f=s[y>>2]|0;c=d>>>8;w=-1;while(1){w=w+1|0;u=te(c,a[29372+(i<<3)+w>>0]|0)|0;if(f>>>0>=u>>>0)break;else d=u}R=f-u|0;s[y>>2]=R;i=d-u|0;s[v>>2]=i;g=t+20|0;p=t+40|0;_=t+24|0;m=t+4|0;u=R;while(1){if(i>>>0>=8388609)break;s[g>>2]=(s[g>>2]|0)+8;i=i<<8;s[v>>2]=i;c=s[p>>2]|0;f=s[_>>2]|0;if(f>>>0<(s[m>>2]|0)>>>0){s[_>>2]=f+1;f=a[(s[t>>2]|0)+f>>0]|0}else f=0;s[p>>2]=f;R=((c<<8|f)>>>1&255|u<<8&2147483392)^255;s[y>>2]=R;u=R}b=e+2736|0;r[b>>0]=w<<3;u=s[v>>2]|0;i=s[y>>2]|0;f=u>>>8;d=-1;while(1){d=d+1|0;c=te(f,a[29962+d>>0]|0)|0;if(i>>>0>=c>>>0)break;else u=c}R=i-c|0;s[y>>2]=R;i=u-c|0;s[v>>2]=i;u=R;while(1){if(i>>>0>=8388609)break;s[g>>2]=(s[g>>2]|0)+8;i=i<<8;s[v>>2]=i;c=s[p>>2]|0;f=s[_>>2]|0;if(f>>>0<(s[m>>2]|0)>>>0){s[_>>2]=f+1;f=a[(s[t>>2]|0)+f>>0]|0}else f=0;s[p>>2]=f;R=((c<<8|f)>>>1&255|u<<8&2147483392)^255;s[y>>2]=R;u=R}r[b>>0]=(a[b>>0]|0)+d;R=g;M=t}A=e+2324|0;d=1;while(1){if((d|0)>=(s[A>>2]|0))break;u=s[v>>2]|0;i=s[y>>2]|0;f=u>>>8;b=-1;while(1){b=b+1|0;c=te(f,a[29396+b>>0]|0)|0;if(i>>>0>=c>>>0)break;else u=c}t=i-c|0;s[y>>2]=t;i=u-c|0;s[v>>2]=i;u=t;while(1){if(i>>>0>=8388609)break;s[R>>2]=(s[R>>2]|0)+8;i=i<<8;s[v>>2]=i;c=s[p>>2]|0;f=s[_>>2]|0;if(f>>>0<(s[m>>2]|0)>>>0){s[_>>2]=f+1;f=a[(s[M>>2]|0)+f>>0]|0}else f=0;s[p>>2]=f;t=((c<<8|f)>>>1&255|u<<8&2147483392)^255;s[y>>2]=t;u=t}r[e+2736+d>>0]=b;d=d+1|0}t=e+2732|0;d=s[t>>2]|0;i=te(r[x>>0]>>1,n[d>>1]|0)|0;i=(s[d+16>>2]|0)+i|0;d=s[v>>2]|0;f=s[y>>2]|0;c=d>>>8;b=-1;while(1){b=b+1|0;u=te(c,a[i+b>>0]|0)|0;if(f>>>0>=u>>>0)break;else d=u}g=f-u|0;s[y>>2]=g;i=d-u|0;s[v>>2]=i;u=g;while(1){if(i>>>0>=8388609)break;s[R>>2]=(s[R>>2]|0)+8;i=i<<8;s[v>>2]=i;c=s[p>>2]|0;f=s[_>>2]|0;if(f>>>0<(s[m>>2]|0)>>>0){s[_>>2]=f+1;f=a[(s[M>>2]|0)+f>>0]|0}else f=0;s[p>>2]=f;g=((c<<8|f)>>>1&255|u<<8&2147483392)^255;s[y>>2]=g;u=g}r[e+2744>>0]=b;Bi(S,k,s[t>>2]|0,b<<24>>24);g=0;while(1){i=s[t>>2]|0;if((g|0)>=(n[i+2>>1]|0))break;f=(s[i+28>>2]|0)+(n[S+(g<<1)>>1]|0)|0;b=s[v>>2]|0;c=s[y>>2]|0;u=b>>>8;w=-1;while(1){i=w+1|0;d=te(u,a[f+i>>0]|0)|0;if(c>>>0>>0){w=i;b=d}else break}k=c-d|0;s[y>>2]=k;c=b-d|0;s[v>>2]=c;b=k;while(1){if(c>>>0>=8388609)break;s[R>>2]=(s[R>>2]|0)+8;c=c<<8;s[v>>2]=c;u=s[p>>2]|0;f=s[_>>2]|0;if(f>>>0<(s[m>>2]|0)>>>0){s[_>>2]=f+1;f=a[(s[M>>2]|0)+f>>0]|0}else f=0;s[p>>2]=f;k=((u<<8|f)>>>1&255|b<<8&2147483392)^255;s[y>>2]=k;b=k}switch(w|0){case-1:{u=c>>>8;d=-1;while(1){i=d+1|0;f=te(u,a[29970+i>>0]|0)|0;if(b>>>0>>0){d=i;c=f}else break}u=b-f|0;s[y>>2]=u;i=c-f|0;s[v>>2]=i;while(1){if(i>>>0>=8388609)break;s[R>>2]=(s[R>>2]|0)+8;i=i<<8;s[v>>2]=i;c=s[p>>2]|0;f=s[_>>2]|0;if(f>>>0<(s[m>>2]|0)>>>0){s[_>>2]=f+1;f=a[(s[M>>2]|0)+f>>0]|0}else f=0;s[p>>2]=f;k=((c<<8|f)>>>1&255|u<<8&2147483392)^255;s[y>>2]=k;u=k}i=~d;break}case 7:{u=c>>>8;d=-1;while(1){i=d+1|0;f=te(u,a[29970+i>>0]|0)|0;if(b>>>0>>0){d=i;c=f}else break}u=b-f|0;s[y>>2]=u;i=c-f|0;s[v>>2]=i;while(1){if(i>>>0>=8388609)break;s[R>>2]=(s[R>>2]|0)+8;i=i<<8;s[v>>2]=i;c=s[p>>2]|0;f=s[_>>2]|0;if(f>>>0<(s[m>>2]|0)>>>0){s[_>>2]=f+1;f=a[(s[M>>2]|0)+f>>0]|0}else f=0;s[p>>2]=f;k=((c<<8|f)>>>1&255|u<<8&2147483392)^255;s[y>>2]=k;u=k}i=d+9|0;break}default:{}}k=g+1|0;r[e+2744+k>>0]=i+252;g=k}if((s[A>>2]|0)==4){u=s[v>>2]|0;i=s[y>>2]|0;f=u>>>8;d=-1;while(1){d=d+1|0;c=te(f,a[29939+d>>0]|0)|0;if(i>>>0>=c>>>0)break;else u=c}S=i-c|0;s[y>>2]=S;i=u-c|0;s[v>>2]=i;u=S;while(1){if(i>>>0>=8388609)break;s[R>>2]=(s[R>>2]|0)+8;i=i<<8;s[v>>2]=i;c=s[p>>2]|0;f=s[_>>2]|0;if(f>>>0<(s[m>>2]|0)>>>0){s[_>>2]=f+1;f=a[(s[M>>2]|0)+f>>0]|0}else f=0;s[p>>2]=f;S=((c<<8|f)>>>1&255|u<<8&2147483392)^255;s[y>>2]=S;u=S}r[e+2767>>0]=d}else r[e+2767>>0]=4;do if((r[x>>0]|0)==2){if(E?(s[e+2396>>2]|0)==2:0){u=s[v>>2]|0;i=s[y>>2]|0;f=u>>>8;b=-1;while(1){d=b+1|0;c=te(f,a[30009+d>>0]|0)|0;if(i>>>0>>0){b=d;u=c}else break}S=i-c|0;s[y>>2]=S;i=u-c|0;s[v>>2]=i;u=S;while(1){if(i>>>0>=8388609)break;s[R>>2]=(s[R>>2]|0)+8;i=i<<8;s[v>>2]=i;c=s[p>>2]|0;f=s[_>>2]|0;if(f>>>0<(s[m>>2]|0)>>>0){s[_>>2]=f+1;f=a[(s[M>>2]|0)+f>>0]|0}else f=0;s[p>>2]=f;S=((c<<8|f)>>>1&255|u<<8&2147483392)^255;s[y>>2]=S;u=S}if((d&65535)<<16>>16>0){i=e+2400|0;f=(o[i>>1]|0)+(b+65528)&65535;n[e+2762>>1]=f}else T=108}else T=108;if((T|0)==108){u=s[v>>2]|0;i=s[y>>2]|0;f=u>>>8;d=-1;while(1){d=d+1|0;c=te(f,a[29977+d>>0]|0)|0;if(i>>>0>=c>>>0)break;else u=c}T=i-c|0;s[y>>2]=T;i=u-c|0;s[v>>2]=i;u=T;while(1){if(i>>>0>=8388609)break;s[R>>2]=(s[R>>2]|0)+8;i=i<<8;s[v>>2]=i;c=s[p>>2]|0;f=s[_>>2]|0;if(f>>>0<(s[m>>2]|0)>>>0){s[_>>2]=f+1;f=a[(s[M>>2]|0)+f>>0]|0}else f=0;s[p>>2]=f;T=((c<<8|f)>>>1&255|u<<8&2147483392)^255;s[y>>2]=T;u=T}w=e+2762|0;n[w>>1]=te(d<<16>>16,s[e+2316>>2]>>1)|0;i=s[e+2380>>2]|0;d=s[v>>2]|0;f=s[y>>2]|0;c=d>>>8;b=-1;while(1){b=b+1|0;u=te(c,a[i+b>>0]|0)|0;if(f>>>0>=u>>>0)break;else d=u}T=f-u|0;s[y>>2]=T;i=d-u|0;s[v>>2]=i;u=T;while(1){if(i>>>0>=8388609)break;s[R>>2]=(s[R>>2]|0)+8;i=i<<8;s[v>>2]=i;c=s[p>>2]|0;f=s[_>>2]|0;if(f>>>0<(s[m>>2]|0)>>>0){s[_>>2]=f+1;f=a[(s[M>>2]|0)+f>>0]|0}else f=0;s[p>>2]=f;T=((c<<8|f)>>>1&255|u<<8&2147483392)^255;s[y>>2]=T;u=T}f=(o[w>>1]|0)+b&65535;n[w>>1]=f;i=e+2400|0}n[i>>1]=f;i=s[e+2384>>2]|0;d=s[v>>2]|0;f=s[y>>2]|0;c=d>>>8;b=-1;while(1){b=b+1|0;u=te(c,a[i+b>>0]|0)|0;if(f>>>0>=u>>>0)break;else d=u}T=f-u|0;s[y>>2]=T;i=d-u|0;s[v>>2]=i;u=T;while(1){if(i>>>0>=8388609)break;s[R>>2]=(s[R>>2]|0)+8;i=i<<8;s[v>>2]=i;c=s[p>>2]|0;f=s[_>>2]|0;if(f>>>0<(s[m>>2]|0)>>>0){s[_>>2]=f+1;f=a[(s[M>>2]|0)+f>>0]|0}else f=0;s[p>>2]=f;T=((c<<8|f)>>>1&255|u<<8&2147483392)^255;s[y>>2]=T;u=T}r[e+2764>>0]=b;u=s[v>>2]|0;i=s[y>>2]|0;f=u>>>8;d=-1;while(1){d=d+1|0;c=te(f,a[29437+d>>0]|0)|0;if(i>>>0>=c>>>0)break;else u=c}T=i-c|0;s[y>>2]=T;i=u-c|0;s[v>>2]=i;u=T;while(1){if(i>>>0>=8388609)break;s[R>>2]=(s[R>>2]|0)+8;i=i<<8;s[v>>2]=i;c=s[p>>2]|0;f=s[_>>2]|0;if(f>>>0<(s[m>>2]|0)>>>0){s[_>>2]=f+1;f=a[(s[M>>2]|0)+f>>0]|0}else f=0;s[p>>2]=f;T=((c<<8|f)>>>1&255|u<<8&2147483392)^255;s[y>>2]=T;u=T}g=e+2768|0;r[g>>0]=d;b=0;while(1){if((b|0)>=(s[A>>2]|0))break;i=s[17376+(r[g>>0]<<2)>>2]|0;d=s[v>>2]|0;f=s[y>>2]|0;c=d>>>8;w=-1;while(1){w=w+1|0;u=te(c,a[i+w>>0]|0)|0;if(f>>>0>=u>>>0)break;else d=u}T=f-u|0;s[y>>2]=T;i=d-u|0;s[v>>2]=i;u=T;while(1){if(i>>>0>=8388609)break;s[R>>2]=(s[R>>2]|0)+8;i=i<<8;s[v>>2]=i;c=s[p>>2]|0;f=s[_>>2]|0;if(f>>>0<(s[m>>2]|0)>>>0){s[_>>2]=f+1;f=a[(s[M>>2]|0)+f>>0]|0}else f=0;s[p>>2]=f;T=((c<<8|f)>>>1&255|u<<8&2147483392)^255;s[y>>2]=T;u=T}r[e+2740+b>>0]=w;b=b+1|0}if(h|0){r[e+2769>>0]=0;break}u=s[v>>2]|0;i=s[y>>2]|0;f=u>>>8;d=-1;while(1){d=d+1|0;c=te(f,a[29930+d>>0]|0)|0;if(i>>>0>=c>>>0)break;else u=c}h=i-c|0;s[y>>2]=h;i=u-c|0;s[v>>2]=i;u=h;while(1){if(i>>>0>=8388609)break;s[R>>2]=(s[R>>2]|0)+8;i=i<<8;s[v>>2]=i;c=s[p>>2]|0;f=s[_>>2]|0;if(f>>>0<(s[m>>2]|0)>>>0){s[_>>2]=f+1;f=a[(s[M>>2]|0)+f>>0]|0}else f=0;s[p>>2]=f;h=((c<<8|f)>>>1&255|u<<8&2147483392)^255;s[y>>2]=h;u=h}r[e+2769>>0]=d}while(0);s[e+2396>>2]=r[x>>0];u=s[v>>2]|0;i=s[y>>2]|0;f=u>>>8;d=-1;while(1){d=d+1|0;c=te(f,a[29947+d>>0]|0)|0;if(i>>>0>=c>>>0)break;else u=c}h=i-c|0;s[y>>2]=h;i=u-c|0;s[v>>2]=i;u=h;while(1){if(i>>>0>=8388609)break;s[R>>2]=(s[R>>2]|0)+8;i=i<<8;s[v>>2]=i;c=s[p>>2]|0;f=s[_>>2]|0;if(f>>>0<(s[m>>2]|0)>>>0){s[_>>2]=f+1;f=a[(s[M>>2]|0)+f>>0]|0}else f=0;s[p>>2]=f;h=((c<<8|f)>>>1&255|u<<8&2147483392)^255;s[y>>2]=h;u=h}r[e+2770>>0]=d;l=C;return}function pr(e,t,i,o,f){e=e|0;t=t|0;i=i|0;o=o|0;f=f|0;var h=0,c=0,u=0,d=0,p=0,b=0,m=0,w=0,g=0,v=0,_=0,y=0,k=0,E=0,A=0,S=0,M=0,T=0,R=0,x=0,C=0,I=0,P=0,O=0,N=0,D=0;D=l;l=l+176|0;O=D+160|0;N=D+80|0;M=D;h=i>>1;I=e+28|0;p=s[I>>2]|0;P=e+32|0;u=s[P>>2]|0;d=p>>>8;_=-1;while(1){_=_+1|0;c=te(d,a[30432+(h*9|0)+_>>0]|0)|0;if(u>>>0>=c>>>0)break;else p=c}d=u-c|0;s[P>>2]=d;h=p-c|0;s[I>>2]=h;T=e+20|0;R=e+40|0;x=e+24|0;C=e+4|0;while(1){if(h>>>0>=8388609)break;s[T>>2]=(s[T>>2]|0)+8;h=h<<8;s[I>>2]=h;u=s[R>>2]|0;c=s[x>>2]|0;if(c>>>0<(s[C>>2]|0)>>>0){s[x>>2]=c+1;c=a[(s[e>>2]|0)+c>>0]|0}else c=0;s[R>>2]=c;S=((u<<8|c)>>>1&255|d<<8&2147483392)^255;s[P>>2]=S;d=S}S=f>>4;S=S+((S<<4|0)<(f|0)&1)|0;v=0;while(1){if((v|0)>=(S|0)){E=0;break}g=M+(v<<2)|0;s[g>>2]=0;u=h>>>8;p=-1;while(1){p=p+1|0;c=te(u,a[30090+(_*18|0)+p>>0]|0)|0;if(d>>>0>=c>>>0)break;else h=c}d=d-c|0;s[P>>2]=d;h=h-c|0;s[I>>2]=h;while(1){if(h>>>0>=8388609)break;s[T>>2]=(s[T>>2]|0)+8;h=h<<8;s[I>>2]=h;u=s[R>>2]|0;c=s[x>>2]|0;if(c>>>0<(s[C>>2]|0)>>>0){s[x>>2]=c+1;c=a[(s[e>>2]|0)+c>>0]|0}else c=0;s[R>>2]=c;E=((u<<8|c)>>>1&255|d<<8&2147483392)^255;s[P>>2]=E;d=E}w=N+(v<<2)|0;u=0;c=p;e:while(1){s[w>>2]=c;if((c|0)!=17)break;m=u+1|0;s[g>>2]=m;p=30252+((m|0)==10&1)|0;b=h>>>8;c=-1;while(1){c=c+1|0;u=te(b,a[p+c>>0]|0)|0;if(d>>>0>=u>>>0)break;else h=u}d=d-u|0;s[P>>2]=d;h=h-u|0;s[I>>2]=h;while(1){if(h>>>0>=8388609){u=m;continue e}s[T>>2]=(s[T>>2]|0)+8;h=h<<8;s[I>>2]=h;p=s[R>>2]|0;u=s[x>>2]|0;if(u>>>0<(s[C>>2]|0)>>>0){s[x>>2]=u+1;u=a[(s[e>>2]|0)+u>>0]|0}else u=0;s[R>>2]=u;E=((p<<8|u)>>>1&255|d<<8&2147483392)^255;s[P>>2]=E;d=E}}v=v+1|0}while(1){if((E|0)>=(S|0)){g=0;break}m=s[N+(E<<2)>>2]|0;h=t+(E<<16>>12<<1)|0;if((m|0)>0){c=30924+(a[31076+m>>0]|0)|0;b=s[I>>2]|0;u=s[P>>2]|0;d=b>>>8;g=-1;while(1){g=g+1|0;p=te(d,a[c+g>>0]|0)|0;if(u>>>0>=p>>>0)break;else b=p}k=u-p|0;s[P>>2]=k;c=b-p|0;s[I>>2]=c;p=k;while(1){if(c>>>0>=8388609)break;s[T>>2]=(s[T>>2]|0)+8;c=c<<8;s[I>>2]=c;d=s[R>>2]|0;u=s[x>>2]|0;if(u>>>0<(s[C>>2]|0)>>>0){s[x>>2]=u+1;u=a[(s[e>>2]|0)+u>>0]|0}else u=0;s[R>>2]=u;k=((d<<8|u)>>>1&255|p<<8&2147483392)^255;s[P>>2]=k;p=k}y=m-g|0;k=y&65535;w=g<<16>>16;if((g&65535)<<16>>16>0){c=30772+(a[31076+w>>0]|0)|0;b=s[I>>2]|0;u=s[P>>2]|0;d=b>>>8;m=-1;while(1){m=m+1|0;p=te(d,a[c+m>>0]|0)|0;if(u>>>0>=p>>>0)break;else b=p}_=u-p|0;s[P>>2]=_;c=b-p|0;s[I>>2]=c;p=_;while(1){if(c>>>0>=8388609)break;s[T>>2]=(s[T>>2]|0)+8;c=c<<8;s[I>>2]=c;d=s[R>>2]|0;u=s[x>>2]|0;if(u>>>0<(s[C>>2]|0)>>>0){s[x>>2]=u+1;u=a[(s[e>>2]|0)+u>>0]|0}else u=0;s[R>>2]=u;_=((d<<8|u)>>>1&255|p<<8&2147483392)^255;s[P>>2]=_;p=_}_=m&65535;c=w-m&65535;w=_<<16>>16;if(_<<16>>16>0){u=30620+(a[31076+w>>0]|0)|0;m=s[I>>2]|0;d=s[P>>2]|0;p=m>>>8;g=-1;while(1){g=g+1|0;b=te(p,a[u+g>>0]|0)|0;if(d>>>0>=b>>>0)break;else m=b}_=d-b|0;s[P>>2]=_;u=m-b|0;s[I>>2]=u;b=_;while(1){if(u>>>0>=8388609)break;s[T>>2]=(s[T>>2]|0)+8;u=u<<8;s[I>>2]=u;p=s[R>>2]|0;d=s[x>>2]|0;if(d>>>0<(s[C>>2]|0)>>>0){s[x>>2]=d+1;d=a[(s[e>>2]|0)+d>>0]|0}else d=0;s[R>>2]=d;_=((p<<8|d)>>>1&255|b<<8&2147483392)^255;s[P>>2]=_;b=_}v=g&65535;_=w-g&65535;u=h+2|0;g=v<<16>>16;if(v<<16>>16>0){d=30468+(a[31076+g>>0]|0)|0;w=s[I>>2]|0;p=s[P>>2]|0;b=w>>>8;v=-1;while(1){v=v+1|0;m=te(b,a[d+v>>0]|0)|0;if(p>>>0>=m>>>0)break;else w=m}b=p-m|0;s[P>>2]=b;d=w-m|0;s[I>>2]=d;m=b;while(1){if(d>>>0>=8388609)break;s[T>>2]=(s[T>>2]|0)+8;d=d<<8;s[I>>2]=d;b=s[R>>2]|0;p=s[x>>2]|0;if(p>>>0<(s[C>>2]|0)>>>0){s[x>>2]=p+1;p=a[(s[e>>2]|0)+p>>0]|0}else p=0;s[R>>2]=p;w=((b<<8|p)>>>1&255|m<<8&2147483392)^255;s[P>>2]=w;m=w}n[h>>1]=v;p=g-v&65535;d=_;_=c}else{d=_;A=62}}else A=52}else{c=0;A=52}if((A|0)==52){u=h+2|0;d=0;A=62}if((A|0)==62){A=0;n[h>>1]=0;p=0;_=c}n[u>>1]=p;w=h+4|0;v=h+6|0;g=d<<16>>16;if(d<<16>>16>0){c=30468+(a[31076+g>>0]|0)|0;b=s[I>>2]|0;u=s[P>>2]|0;d=b>>>8;m=-1;while(1){m=m+1|0;p=te(d,a[c+m>>0]|0)|0;if(u>>>0>=p>>>0)break;else b=p}d=u-p|0;s[P>>2]=d;c=b-p|0;s[I>>2]=c;p=d;while(1){if(c>>>0>=8388609)break;s[T>>2]=(s[T>>2]|0)+8;c=c<<8;s[I>>2]=c;d=s[R>>2]|0;u=s[x>>2]|0;if(u>>>0<(s[C>>2]|0)>>>0){s[x>>2]=u+1;u=a[(s[e>>2]|0)+u>>0]|0}else u=0;s[R>>2]=u;b=((d<<8|u)>>>1&255|p<<8&2147483392)^255;s[P>>2]=b;p=b}n[w>>1]=m;c=g-m&65535}else{n[w>>1]=0;c=0}n[v>>1]=c;w=_<<16>>16;if(_<<16>>16>0){c=30620+(a[31076+w>>0]|0)|0;b=s[I>>2]|0;u=s[P>>2]|0;d=b>>>8;m=-1;while(1){m=m+1|0;p=te(d,a[c+m>>0]|0)|0;if(u>>>0>=p>>>0)break;else b=p}_=u-p|0;s[P>>2]=_;c=b-p|0;s[I>>2]=c;p=_;while(1){if(c>>>0>=8388609)break;s[T>>2]=(s[T>>2]|0)+8;c=c<<8;s[I>>2]=c;d=s[R>>2]|0;u=s[x>>2]|0;if(u>>>0<(s[C>>2]|0)>>>0){s[x>>2]=u+1;u=a[(s[e>>2]|0)+u>>0]|0}else u=0;s[R>>2]=u;_=((d<<8|u)>>>1&255|p<<8&2147483392)^255;s[P>>2]=_;p=_}_=m&65535;d=w-m&65535;u=h+8|0;c=h+10|0;v=_<<16>>16;if(_<<16>>16>0){p=30468+(a[31076+v>>0]|0)|0;g=s[I>>2]|0;b=s[P>>2]|0;m=g>>>8;_=-1;while(1){_=_+1|0;w=te(m,a[p+_>>0]|0)|0;if(b>>>0>=w>>>0)break;else g=w}m=b-w|0;s[P>>2]=m;p=g-w|0;s[I>>2]=p;w=m;while(1){if(p>>>0>=8388609)break;s[T>>2]=(s[T>>2]|0)+8;p=p<<8;s[I>>2]=p;m=s[R>>2]|0;b=s[x>>2]|0;if(b>>>0<(s[C>>2]|0)>>>0){s[x>>2]=b+1;b=a[(s[e>>2]|0)+b>>0]|0}else b=0;s[R>>2]=b;g=((m<<8|b)>>>1&255|w<<8&2147483392)^255;s[P>>2]=g;w=g}n[u>>1]=_;u=v-_&65535}else A=91}else{u=h+8|0;c=h+10|0;d=0;A=91}if((A|0)==91){A=0;n[u>>1]=0;u=0}n[c>>1]=u;w=h+12|0;v=h+14|0;g=d<<16>>16;if(d<<16>>16>0){c=30468+(a[31076+g>>0]|0)|0;b=s[I>>2]|0;u=s[P>>2]|0;d=b>>>8;m=-1;while(1){m=m+1|0;p=te(d,a[c+m>>0]|0)|0;if(u>>>0>=p>>>0)break;else b=p}_=u-p|0;s[P>>2]=_;c=b-p|0;s[I>>2]=c;p=_;while(1){if(c>>>0>=8388609)break;s[T>>2]=(s[T>>2]|0)+8;c=c<<8;s[I>>2]=c;d=s[R>>2]|0;u=s[x>>2]|0;if(u>>>0<(s[C>>2]|0)>>>0){s[x>>2]=u+1;u=a[(s[e>>2]|0)+u>>0]|0}else u=0;s[R>>2]=u;_=((d<<8|u)>>>1&255|p<<8&2147483392)^255;s[P>>2]=_;p=_}n[w>>1]=m;c=g-m&65535}else{n[w>>1]=0;c=0}n[v>>1]=c;w=y<<16>>16;if(k<<16>>16>0){c=30772+(a[31076+w>>0]|0)|0;b=s[I>>2]|0;u=s[P>>2]|0;d=b>>>8;m=-1;while(1){m=m+1|0;p=te(d,a[c+m>>0]|0)|0;if(u>>>0>=p>>>0)break;else b=p}k=u-p|0;s[P>>2]=k;c=b-p|0;s[I>>2]=c;p=k;while(1){if(c>>>0>=8388609)break;s[T>>2]=(s[T>>2]|0)+8;c=c<<8;s[I>>2]=c;d=s[R>>2]|0;u=s[x>>2]|0;if(u>>>0<(s[C>>2]|0)>>>0){s[x>>2]=u+1;u=a[(s[e>>2]|0)+u>>0]|0}else u=0;s[R>>2]=u;k=((d<<8|u)>>>1&255|p<<8&2147483392)^255;s[P>>2]=k;p=k}k=m&65535;c=w-m&65535;w=k<<16>>16;if(k<<16>>16>0){u=30620+(a[31076+w>>0]|0)|0;m=s[I>>2]|0;d=s[P>>2]|0;p=m>>>8;g=-1;while(1){g=g+1|0;b=te(p,a[u+g>>0]|0)|0;if(d>>>0>=b>>>0)break;else m=b}k=d-b|0;s[P>>2]=k;u=m-b|0;s[I>>2]=u;b=k;while(1){if(u>>>0>=8388609)break;s[T>>2]=(s[T>>2]|0)+8;u=u<<8;s[I>>2]=u;p=s[R>>2]|0;d=s[x>>2]|0;if(d>>>0<(s[C>>2]|0)>>>0){s[x>>2]=d+1;d=a[(s[e>>2]|0)+d>>0]|0}else d=0;s[R>>2]=d;k=((p<<8|d)>>>1&255|b<<8&2147483392)^255;s[P>>2]=k;b=k}k=g&65535;p=w-g&65535;v=h+16|0;u=h+18|0;_=k<<16>>16;if(k<<16>>16>0){d=30468+(a[31076+_>>0]|0)|0;g=s[I>>2]|0;b=s[P>>2]|0;m=g>>>8;y=-1;while(1){y=y+1|0;w=te(m,a[d+y>>0]|0)|0;if(b>>>0>=w>>>0)break;else g=w}k=b-w|0;s[P>>2]=k;d=g-w|0;s[I>>2]=d;w=k;while(1){if(d>>>0>=8388609)break;s[T>>2]=(s[T>>2]|0)+8;d=d<<8;s[I>>2]=d;m=s[R>>2]|0;b=s[x>>2]|0;if(b>>>0<(s[C>>2]|0)>>>0){s[x>>2]=b+1;b=a[(s[e>>2]|0)+b>>0]|0}else b=0;s[R>>2]=b;k=((m<<8|b)>>>1&255|w<<8&2147483392)^255;s[P>>2]=k;w=k}n[v>>1]=y;d=_-y&65535;_=c}else{d=v;A=128}}else A=118}else{c=0;A=118}if((A|0)==118){d=h+16|0;u=h+18|0;p=0;A=128}if((A|0)==128){A=0;n[d>>1]=0;d=0;_=c}n[u>>1]=d;w=h+20|0;v=h+22|0;g=p<<16>>16;if(p<<16>>16>0){c=30468+(a[31076+g>>0]|0)|0;b=s[I>>2]|0;u=s[P>>2]|0;d=b>>>8;m=-1;while(1){m=m+1|0;p=te(d,a[c+m>>0]|0)|0;if(u>>>0>=p>>>0)break;else b=p}k=u-p|0;s[P>>2]=k;c=b-p|0;s[I>>2]=c;p=k;while(1){if(c>>>0>=8388609)break;s[T>>2]=(s[T>>2]|0)+8;c=c<<8;s[I>>2]=c;d=s[R>>2]|0;u=s[x>>2]|0;if(u>>>0<(s[C>>2]|0)>>>0){s[x>>2]=u+1;u=a[(s[e>>2]|0)+u>>0]|0}else u=0;s[R>>2]=u;k=((d<<8|u)>>>1&255|p<<8&2147483392)^255;s[P>>2]=k;p=k}n[w>>1]=m;c=g-m&65535}else{n[w>>1]=0;c=0}n[v>>1]=c;w=_<<16>>16;if(_<<16>>16>0){c=30620+(a[31076+w>>0]|0)|0;b=s[I>>2]|0;u=s[P>>2]|0;d=b>>>8;m=-1;while(1){m=m+1|0;p=te(d,a[c+m>>0]|0)|0;if(u>>>0>=p>>>0)break;else b=p}k=u-p|0;s[P>>2]=k;c=b-p|0;s[I>>2]=c;p=k;while(1){if(c>>>0>=8388609)break;s[T>>2]=(s[T>>2]|0)+8;c=c<<8;s[I>>2]=c;d=s[R>>2]|0;u=s[x>>2]|0;if(u>>>0<(s[C>>2]|0)>>>0){s[x>>2]=u+1;u=a[(s[e>>2]|0)+u>>0]|0}else u=0;s[R>>2]=u;k=((d<<8|u)>>>1&255|p<<8&2147483392)^255;s[P>>2]=k;p=k}k=m&65535;d=w-m&65535;u=h+24|0;c=h+26|0;v=k<<16>>16;if(k<<16>>16>0){p=30468+(a[31076+v>>0]|0)|0;g=s[I>>2]|0;b=s[P>>2]|0;m=g>>>8;_=-1;while(1){_=_+1|0;w=te(m,a[p+_>>0]|0)|0;if(b>>>0>=w>>>0)break;else g=w}k=b-w|0;s[P>>2]=k;p=g-w|0;s[I>>2]=p;w=k;while(1){if(p>>>0>=8388609)break;s[T>>2]=(s[T>>2]|0)+8;p=p<<8;s[I>>2]=p;m=s[R>>2]|0;b=s[x>>2]|0;if(b>>>0<(s[C>>2]|0)>>>0){s[x>>2]=b+1;b=a[(s[e>>2]|0)+b>>0]|0}else b=0;s[R>>2]=b;k=((m<<8|b)>>>1&255|w<<8&2147483392)^255;s[P>>2]=k;w=k}n[u>>1]=_;u=v-_&65535}else A=157}else{u=h+24|0;c=h+26|0;d=0;A=157}if((A|0)==157){A=0;n[u>>1]=0;u=0}n[c>>1]=u;w=h+28|0;g=h+30|0;m=d<<16>>16;if(d<<16>>16>0){h=30468+(a[31076+m>>0]|0)|0;p=s[I>>2]|0;c=s[P>>2]|0;u=p>>>8;b=-1;while(1){b=b+1|0;d=te(u,a[h+b>>0]|0)|0;if(c>>>0>=d>>>0)break;else p=d}k=c-d|0;s[P>>2]=k;h=p-d|0;s[I>>2]=h;d=k;while(1){if(h>>>0>=8388609)break;s[T>>2]=(s[T>>2]|0)+8;h=h<<8;s[I>>2]=h;u=s[R>>2]|0;c=s[x>>2]|0;if(c>>>0<(s[C>>2]|0)>>>0){s[x>>2]=c+1;c=a[(s[e>>2]|0)+c>>0]|0}else c=0;s[R>>2]=c;k=((u<<8|c)>>>1&255|d<<8&2147483392)^255;s[P>>2]=k;d=k}n[w>>1]=b;h=m-b&65535}else{n[w>>1]=0;h=0}n[g>>1]=h}else{c=h+32|0;do{n[h>>1]=0;h=h+2|0}while((h|0)<(c|0))}E=E+1|0}while(1){if((g|0)>=(S|0))break;p=s[M+(g<<2)>>2]|0;if((p|0)>0){b=t+(g<<16>>12<<1)|0;_=0;while(1){if((_|0)==16)break;m=b+(_<<1)|0;w=n[m>>1]|0;v=0;while(1){if((v|0)==(p|0))break;d=s[I>>2]|0;h=s[P>>2]|0;c=d>>>8;y=-1;while(1){y=y+1|0;u=te(c,a[29928+y>>0]|0)|0;if(h>>>0>=u>>>0)break;else d=u}A=h-u|0;s[P>>2]=A;h=d-u|0;s[I>>2]=h;d=A;while(1){if(h>>>0>=8388609)break;s[T>>2]=(s[T>>2]|0)+8;h=h<<8;s[I>>2]=h;u=s[R>>2]|0;c=s[x>>2]|0;if(c>>>0<(s[C>>2]|0)>>>0){s[x>>2]=c+1;c=a[(s[e>>2]|0)+c>>0]|0}else c=0;s[R>>2]=c;A=((u<<8|c)>>>1&255|d<<8&2147483392)^255;s[P>>2]=A;d=A}w=(w<<1)+y|0;v=v+1|0}n[m>>1]=w;_=_+1|0}A=N+(g<<2)|0;s[A>>2]=s[A>>2]|p<<5}g=g+1|0}r[O+1>>0]=0;v=31093+(((i<<1)+o<<16>>16)*7|0)|0;w=f+8>>4;g=0;while(1){if((g|0)>=(w|0))break;h=s[N+(g<<2)>>2]|0;e:do if((h|0)>0){r[O>>0]=r[v+((h&30)>>>0<6?h&31:6)>>0]|0;b=0;while(1){if((b|0)==16)break e;p=t+(b<<1)|0;if((n[p>>1]|0)>0){d=s[I>>2]|0;h=s[P>>2]|0;c=d>>>8;m=-1;while(1){m=m+1|0;u=te(c,a[O+m>>0]|0)|0;if(h>>>0>=u>>>0)break;else d=u}f=h-u|0;s[P>>2]=f;h=d-u|0;s[I>>2]=h;d=f;while(1){if(h>>>0>=8388609)break;s[T>>2]=(s[T>>2]|0)+8;h=h<<8;s[I>>2]=h;u=s[R>>2]|0;c=s[x>>2]|0;if(c>>>0<(s[C>>2]|0)>>>0){s[x>>2]=c+1;c=a[(s[e>>2]|0)+c>>0]|0}else c=0;s[R>>2]=c;f=((u<<8|c)>>>1&255|d<<8&2147483392)^255;s[P>>2]=f;d=f}n[p>>1]=te(n[p>>1]|0,(m<<1)+-1|0)|0}b=b+1|0}}while(0);g=g+1|0;t=t+32|0}l=D;return}function br(e,t,i,n,o){e=e|0;t=t|0;i=i|0;n=n|0;o=o|0;var f=0,h=0,c=0,l=0,u=0,d=0;d=0;while(1){if((d|0)>=(o|0))break;u=t+(d<<2)|0;f=s[u>>2]|0;l=re(f|0)|0;h=24-l|0;c=0-h|0;do if(h)if((h|0)<0){f=f<>>(h+32|0);break}else{f=f<<32-h|f>>>h;break}while(0);c=f&127;c=(((c+(((te(c,128-c|0)|0)*179|0)>>>16)+(31-l<<7)<<16)+-136970240>>16)*2251|0)>>>16;f=c&255;l=e+d|0;r[l>>0]=f;if((c<<24>>24|0)<(r[i>>0]|0)){f=f+1<<24>>24;r[l>>0]=f}if(f<<24>>24>63)f=63;else f=(f<<24>>24>0?f:0)<<24>>24;r[l>>0]=f;if(!(d|n)){f=(r[i>>0]|0)+-4|0;h=r[e>>0]|0;if((f|0)>63){if((h<<24>>24|0)<=(f|0))f=(h<<24>>24>63?h:63)<<24>>24}else if(h<<24>>24>63)f=63;else{l=h<<24>>24;f=(l|0)<(f|0)?f:l}f=f&255;r[e>>0]=f;r[i>>0]=f}else{h=(f&255)-(a[i>>0]|0)|0;f=h&255;r[l>>0]=f;c=(r[i>>0]|0)+8|0;h=h<<24>>24;if((h|0)>(c|0)){f=c+((h-c+1|0)>>>1)&255;r[l>>0]=f}if(f<<24>>24>36)f=36;else f=(f<<24>>24>-4?f:-4)<<24>>24;r[l>>0]=f;if((f|0)>(c|0))f=(r[i>>0]|0)+((f<<1)-c)|0;else f=(a[i>>0]|0)+(f&255)|0;r[i>>0]=f;r[l>>0]=(a[l>>0]|0)+4;f=r[i>>0]|0}f=f<<24>>24;f=(f*29|0)+(f*7281>>16)|0;c=f+2090|0;if((c|0)<3967)if((f|0)<-2090)f=0;else{f=c>>7;l=1<>16)<>7;else f=te(l>>7,h+((te(te(h,128-h|0)|0,-174)|0)>>16)|0)|0;f=l+f|0}else f=2147483647;s[u>>2]=f;d=d+1|0}return}function mr(e,t,i,n,a){e=e|0;t=t|0;i=i|0;n=n|0;a=a|0;var o=0,f=0,h=0,c=0,l=0;l=0;while(1){if((l|0)>=(a|0))break;do if(l|n){o=(r[t+l>>0]|0)+-4|0;f=r[i>>0]|0;h=f<<24>>24;c=h+8|0;if((o|0)>(c|0)){f=h+((o<<1)-c)|0;break}else{f=(f&255)+o|0;break}}else{c=r[t>>0]|0;f=(r[i>>0]|0)+-16|0;f=(c|0)>(f|0)?c:f}while(0);o=f&255;r[i>>0]=o;if(o<<24>>24<=63)if(o<<24>>24<0)o=0;else o=f<<24>>24;else o=63;r[i>>0]=o;o=(o*29|0)+(o*7281>>16)|0;h=o+2090|0;if((h|0)<3967)if((o|0)<-2090)o=0;else{o=h>>7;c=1<>16)<>7;else o=te(c>>7,f+((te(te(f,128-f|0)|0,-174)|0)>>16)|0)|0;o=c+o|0}else o=2147483647;s[e+(l<<2)>>2]=o;l=l+1|0}return}function wr(e,t,i){e=e|0;t=t|0;i=i|0;var o=0,f=0,h=0,c=0,u=0,d=0,p=0,b=0,m=0,w=0,g=0,v=0;v=l;l=l+80|0;m=v+64|0;g=v;Bi(v+32|0,m,i,r[t>>0]|0);u=t+1|0;d=n[i+4>>1]|0;w=i+2|0;o=n[w>>1]|0;p=o<<16>>16;f=p;h=0;while(1){b=f+-1|0;if((f|0)<=0)break;c=(te(h<<16>>16,a[m+b>>0]|0)|0)>>8;f=r[u+b>>0]|0;h=f<<24>>24<<10;if(f<<24>>24>0)f=h+-102|0;else f=f<<24>>24<0?h|102:h;h=c+((te(f>>16,d)|0)+((te(f&65535,d)|0)>>16))|0;n[g+(b<<1)>>1]=h;f=b}c=te(r[t>>0]|0,p)|0;h=(s[i+8>>2]|0)+c|0;c=(s[i+12>>2]|0)+(c<<1)|0;f=0;while(1){o=o<<16>>16;if((f|0)>=(o|0))break;o=((n[g+(f<<1)>>1]<<14|0)/(n[c+(f<<1)>>1]|0)|0)+(a[h+f>>0]<<7)|0;n[e+(f<<1)>>1]=(o|0)>32767?32767:((o|0)<0?0:o)&65535;o=n[w>>1]|0;f=f+1|0}Cr(e,s[i+36>>2]|0,o);l=v;return}function gr(e,t,i,a,o,f,h,c,u,d,p,b,m,w,g){e=e|0;t=t|0;i=i|0;a=a|0;o=o|0;f=f|0;h=h|0;c=c|0;u=u|0;d=d|0;p=p|0;b=b|0;m=m|0;w=w|0;g=g|0;var v=0,_=0,y=0,k=0,E=0,A=0,S=0,M=0,T=0,R=0,x=0,C=0,P=0,O=0,N=0,D=0,L=0,B=0,U=0,j=0,F=0,z=0,q=0,H=0,G=0,V=0,W=0,K=0,Z=0,Y=0,$=0,X=0,J=0,Q=0,ee=0,ie=0,ne=0,se=0,ae=0,oe=0,fe=0,he=0,ce=0,le=0,ue=0,de=0,pe=0,be=0,me=0,we=0,ge=0,ve=0,_e=0,ye=0,ke=0,Ee=0,Ae=0,Se=0,Me=0,Te=0,Re=0,xe=0,Ce=0,Ie=0,Pe=0,Oe=0,Ne=0,De=0,Le=0,Be=0,Ue=0,je=0,Fe=0,ze=0,qe=0,He=0,Ge=0,Ve=0,We=0,Ke=0,Ze=0,Ye=0,$e=0,Xe=0,Je=0,Qe=0,et=0,tt=0;et=l;Xe=t+4436|0;s[Xe>>2]=r[i+34>>0];Je=t+4424|0;ge=s[Je>>2]|0;Ze=n[i+30>>1]|0;De=i+29|0;Le=n[25404+(r[De>>0]>>1<<2)+((Ze&65535)<<24>>24<<1)>>1]|0;Ze=(Ze&-256)<<16>>16!=1024&1;Be=e+4684|0;we=s[Be>>2]|0;Ue=e+4676|0;ze=we+(s[Ue>>2]|0)|0;je=l;l=l+((1*(ze<<2)|0)+15&-16)|0;Fe=l;l=l+((1*(ze<<1)|0)+15&-16)|0;ze=e+4680|0;qe=l;l=l+((1*(s[ze>>2]<<2)|0)+15&-16)|0;He=t+4432|0;s[He>>2]=we; +we=s[Be>>2]|0;Ge=t+4428|0;s[Ge>>2]=we;Ve=e+4672|0;We=Ze^1;Ke=t+4444|0;Ze=Ze<<1^3;Ye=e+4732|0;$e=t+4440|0;Te=e+4728|0;Re=t+3996|0;xe=t+4420|0;Ce=t+4320|0;Ie=t+4416|0;Pe=(w|0)>2048;Ne=(w|0)/2|0;Oe=Ne+-512|0;Ne=512-Ne|0;_e=w<<16>>16;ye=Le+944|0;ke=te(Le,_e)|0;Ee=te(ye<<16>>16,_e)|0;Ae=Le+-944|0;Se=te(944-Le<<16>>16,_e)|0;Me=t+3840|0;ve=g<<16>>16;e=we;we=0;w=ge;ge=t+(s[Be>>2]<<1)|0;while(1){i=s[Ve>>2]|0;if((we|0)>=(i|0))break;pe=f+((we>>1|We)<<4<<1)|0;be=h+(we*5<<1)|0;me=c+(we*24<<1)|0;R=s[u+(we<<2)>>2]|0;T=R>>2;R=T|R<<15;s[Ke>>2]=0;i=r[De>>0]|0;g=m+(we<<2)|0;if(i<<24>>24==2){i=s[g>>2]|0;if(!(we&Ze)){S=s[Be>>2]|0;e=s[Ye>>2]|0;k=S-i-e+-2|0;Tr(Fe+(k<<1)|0,t+(k+(te(we,s[ze>>2]|0)|0)<<1)|0,pe,S-k|0,e);s[Ke>>2]=1;e=s[Be>>2]|0;s[Ge>>2]=e;k=1;S=r[De>>0]|0;w=i}else{k=0;S=2;w=i}}else{k=0;S=i}A=s[g>>2]|0;M=b+(we<<2)|0;E=s[M>>2]|0;g=(E|0)>1;i=re((g?E:1)|0)|0;g=(g?E:1)<>16;_=536870911/(le|0)|0;ue=_<<16;de=ue>>16;g=536870912-((te(le,de)|0)+((te(g&65535,de)|0)>>16))<<3;_=ue+((te(g>>16,de)|0)+((te(g&65528,de)|0)>>16))+(te(g,(_>>15)+1>>1)|0)|0;i=62-i|0;g=i+-47|0;if((g|0)<1){v=47-i|0;i=-2147483648>>v;g=2147483647>>>v;if((i|0)>(g|0)){if((_|0)<=(i|0))i=(_|0)<(g|0)?g:_}else if((_|0)>(g|0))i=g;else i=(_|0)<(i|0)?i:_;i=i<>g:0;v=(i>>4)+1|0;g=v>>>1<<16>>16;v=(v>>16)+1>>1;y=s[ze>>2]|0;_=0;while(1){if((_|0)>=(y|0))break;ue=n[a+(_<<1)>>1]|0;de=ue<<16>>16;s[qe+(_<<2)>>2]=(te(de>>16,g)|0)+((te(ue&65535,g)|0)>>16)+(te(de,v)|0);_=_+1|0}e:do if(k|0){if(!we)i=(te(i>>16,ve)|0)+((te(i&65535,ve)|0)>>16)<<2;v=i>>16;i=i&65535;g=e-A+-2|0;while(1){if((g|0)>=(e|0))break e;de=n[Fe+(g<<1)>>1]|0;s[je+(g<<2)>>2]=(te(v,de)|0)+((te(i,de)|0)>>16);g=g+1|0}}while(0);g=s[$e>>2]|0;if((E|0)==(g|0))i=S;else{if((g|0)<=0)if(!g)v=32;else{i=0-g|0;Qe=26}else{i=g;Qe=26}if((Qe|0)==26){Qe=0;v=re(i|0)|0}e=g<>16|0)|0)<<16>>16;de=(te(e>>16,_)|0)+((te(e&65535,_)|0)>>16)|0;ue=Nn(ue|0,((ue|0)<0)<<31>>31|0,de|0,((de|0)<0)<<31>>31|0)|0;ue=Sn(ue|0,I|0,29)|0;e=e-(ue&-8)|0;_=de+((te(e>>16,_)|0)+((te(e&65535,_)|0)>>16))|0;i=v+28-i|0;e=i+-16|0;if((i|0)<16){g=16-i|0;i=-2147483648>>g;e=2147483647>>>g;if((i|0)>(e|0)){if((_|0)<=(i|0))i=(_|0)<(e|0)?e:_}else if((_|0)>(e|0))i=e;else i=(_|0)<(i|0)?i:_;g=i<>e:0;e=s[He>>2]|0;v=g>>16;_=g&65535;i=e;e=e-(s[Be>>2]|0)|0;while(1){if((e|0)>=(i|0))break;i=t+1280+(e<<2)|0;de=s[i>>2]|0;ue=de<<16>>16;s[i>>2]=(te(v,ue)|0)+((te(_,ue)|0)>>16)+(te(g,(de>>15)+1>>1)|0);i=s[He>>2]|0;e=e+1|0}e:do if(S<<24>>24==2?(s[Ke>>2]|0)==0:0){e=s[Ge>>2]|0;i=e-A+-2|0;while(1){if((i|0)>=(e|0))break e;de=je+(i<<2)|0;ue=s[de>>2]|0;le=ue<<16>>16;s[de>>2]=(te(v,le)|0)+((te(_,le)|0)>>16)+(te(g,(ue>>15)+1>>1)|0);i=i+1|0}}while(0);i=s[Ie>>2]|0;de=i<<16>>16;s[Ie>>2]=(te(v,de)|0)+((te(_,de)|0)>>16)+(te(g,(i>>15)+1>>1)|0);i=s[xe>>2]|0;de=i<<16>>16;s[xe>>2]=(te(v,de)|0)+((te(_,de)|0)>>16)+(te(g,(i>>15)+1>>1)|0);i=0;while(1){if((i|0)==40){i=0;break}de=t+3840+(i<<2)|0;ue=s[de>>2]|0;le=ue<<16>>16;s[de>>2]=(te(v,le)|0)+((te(_,le)|0)>>16)+(te(g,(ue>>15)+1>>1)|0);i=i+1|0}while(1){if((i|0)==24)break;de=t+4320+(i<<2)|0;ue=s[de>>2]|0;le=ue<<16>>16;s[de>>2]=(te(v,le)|0)+((te(_,le)|0)>>16)+(te(g,(ue>>15)+1>>1)|0);i=i+1|0}s[$e>>2]=s[M>>2];e=s[Ge>>2]|0;E=s[M>>2]|0;i=r[De>>0]|0;y=s[ze>>2]|0}W=s[p+(we<<2)>>2]|0;Z=s[Te>>2]|0;oe=s[Ye>>2]|0;Y=oe>>1;$=pe+2|0;X=pe+4|0;J=pe+6|0;Q=pe+8|0;ee=pe+10|0;ie=pe+12|0;ne=pe+14|0;se=pe+16|0;ae=pe+18|0;oe=(oe|0)==16;fe=pe+20|0;he=pe+22|0;ce=pe+24|0;le=pe+26|0;ue=pe+28|0;de=pe+30|0;L=i<<24>>24==2;B=be+2|0;U=be+4|0;j=be+6|0;F=be+8|0;z=Z>>1;H=Z+-1|0;q=t+4320+(H<<2)|0;H=me+(H<<1)|0;G=s[d+(we<<2)>>2]<<16>>16;V=W<<16>>16;W=W>>16;K=(w|0)>0;D=T<<16>>16;O=R>>16;N=E>>>6<<16>>16;C=(E>>21)+1>>1;i=e;P=0;e=je+(e-w+2<<2)|0;x=Re;_=t+1280+((s[He>>2]|0)-w+1<<2)|0;while(1){if((P|0)>=(y|0))break;s[Xe>>2]=(te(s[Xe>>2]|0,196314165)|0)+907633515;R=s[x>>2]|0;T=n[pe>>1]|0;T=Y+((te(R>>16,T)|0)+((te(R&65535,T)|0)>>16))|0;R=s[x+-4>>2]|0;i=n[$>>1]|0;i=T+((te(R>>16,i)|0)+((te(R&65535,i)|0)>>16))|0;R=s[x+-8>>2]|0;T=n[X>>1]|0;T=i+((te(R>>16,T)|0)+((te(R&65535,T)|0)>>16))|0;R=s[x+-12>>2]|0;i=n[J>>1]|0;i=T+((te(R>>16,i)|0)+((te(R&65535,i)|0)>>16))|0;R=s[x+-16>>2]|0;T=n[Q>>1]|0;T=i+((te(R>>16,T)|0)+((te(R&65535,T)|0)>>16))|0;R=s[x+-20>>2]|0;i=n[ee>>1]|0;i=T+((te(R>>16,i)|0)+((te(R&65535,i)|0)>>16))|0;R=s[x+-24>>2]|0;T=n[ie>>1]|0;T=i+((te(R>>16,T)|0)+((te(R&65535,T)|0)>>16))|0;R=s[x+-28>>2]|0;i=n[ne>>1]|0;i=T+((te(R>>16,i)|0)+((te(R&65535,i)|0)>>16))|0;R=s[x+-32>>2]|0;T=n[se>>1]|0;T=i+((te(R>>16,T)|0)+((te(R&65535,T)|0)>>16))|0;R=s[x+-36>>2]|0;i=n[ae>>1]|0;i=T+((te(R>>16,i)|0)+((te(R&65535,i)|0)>>16))|0;if(oe){R=s[x+-40>>2]|0;T=n[fe>>1]|0;T=i+((te(R>>16,T)|0)+((te(R&65535,T)|0)>>16))|0;R=s[x+-44>>2]|0;i=n[he>>1]|0;i=T+((te(R>>16,i)|0)+((te(R&65535,i)|0)>>16))|0;R=s[x+-48>>2]|0;T=n[ce>>1]|0;T=i+((te(R>>16,T)|0)+((te(R&65535,T)|0)>>16))|0;R=s[x+-52>>2]|0;i=n[le>>1]|0;i=T+((te(R>>16,i)|0)+((te(R&65535,i)|0)>>16))|0;R=s[x+-56>>2]|0;T=n[ue>>1]|0;T=i+((te(R>>16,T)|0)+((te(R&65535,T)|0)>>16))|0;R=s[x+-60>>2]|0;i=n[de>>1]|0;i=T+((te(R>>16,i)|0)+((te(R&65535,i)|0)>>16))|0}if(L){R=s[e>>2]|0;T=n[be>>1]|0;T=(te(R>>16,T)|0)+((te(R&65535,T)|0)>>16)+2|0;R=s[e+-4>>2]|0;M=n[B>>1]|0;M=T+((te(R>>16,M)|0)+((te(R&65535,M)|0)>>16))|0;R=s[e+-8>>2]|0;T=n[U>>1]|0;T=M+((te(R>>16,T)|0)+((te(R&65535,T)|0)>>16))|0;R=s[e+-12>>2]|0;M=n[j>>1]|0;M=T+((te(R>>16,M)|0)+((te(R&65535,M)|0)>>16))|0;R=s[e+-16>>2]|0;T=n[F>>1]|0;T=M+((te(R>>16,T)|0)+((te(R&65535,T)|0)>>16))|0;R=e+4|0}else{T=0;R=e}M=s[xe>>2]|0;v=s[Ce>>2]|0;s[Ce>>2]=M;g=n[me>>1]|0;e=2;g=z+((te(M>>16,g)|0)+((te(M&65535,g)|0)>>16))|0;while(1){if((e|0)>=(Z|0))break;E=e+-1|0;S=t+4320+(E<<2)|0;A=s[S>>2]|0;s[S>>2]=v;E=n[me+(E<<1)>>1]|0;S=t+4320+(e<<2)|0;M=s[S>>2]|0;s[S>>2]=A;E=E<<16>>16;S=n[me+(e<<1)>>1]|0;e=e+2|0;g=g+((te(v>>16,E)|0)+((te(v&65535,E)|0)>>16))+((te(A>>16,S)|0)+((te(A&65535,S)|0)>>16))|0;v=M}s[q>>2]=v;A=n[H>>1]|0;A=g+((te(v>>16,A)|0)+((te(v&65535,A)|0)>>16))<<1;S=s[Ie>>2]|0;e=S>>16;S=S&65535;A=A+((te(e,G)|0)+((te(S,G)|0)>>16))|0;M=s[t+1280+((s[He>>2]|0)+-1<<2)>>2]|0;S=(te(M>>16,V)|0)+((te(M&65535,V)|0)>>16)+(te(e,W)|0)+((te(S,W)|0)>>16)|0;e=(i<<2)-A-S|0;if(K){k=(s[_>>2]|0)+(s[_+-8>>2]|0)|0;k=(te(k>>16,D)|0)+((te(k&65535,D)|0)>>16)|0;E=s[_+-4>>2]|0;M=_+4|0;e=T-(k+(te(E>>16,O)|0)+((te(E&65535,O)|0)>>16)<<1)+(e<<1)>>2}else{M=_;e=e>>1}E=qe+(P<<2)|0;k=(s[E>>2]|0)-(e+1>>1)|0;k=(s[Xe>>2]|0)<0?0-k|0:k;k=(k|0)>30720?30720:(k|0)<-31744?-31744:k;e=k-Le|0;do if(Pe){if((e|0)>(Oe|0)){e=e-Oe|0;Qe=70;break}if((e|0)>=(Ne|0))if((e|0)<0){Qe=73;break}else{e=Le;g=ye;v=ke;_=Ee;break}else{e=e+Oe|0;Qe=70;break}}else Qe=70;while(0);e:do if((Qe|0)==70){Qe=0;e=e>>10;if((e|0)>0){v=(e<<10)+-80+Le|0;_=v+1024|0;e=v;g=_;v=te(v<<16>>16,_e)|0;_=te(_<<16>>16,_e)|0;break}switch(e|0){case 0:{e=Le;g=ye;v=ke;_=Ee;break e}case-1:{Qe=73;break e}default:{}}_=(e<<10|80)+Le|0;e=_;g=_+1024|0;v=te(0-_<<16>>16,_e)|0;_=te(-1024-_<<16>>16,_e)|0}while(0);if((Qe|0)==73){Qe=0;e=Ae;g=Le;v=Se;_=ke}tt=k-e<<16>>16;k=k-g<<16>>16;_=(_+(te(k,k)|0)|0)<(v+(te(tt,tt)|0)|0);_=_?g:e;e=o+P|0;r[e>>0]=((_>>>9)+1|0)>>>1;_=_<<4;T=((s[Xe>>2]|0)<0?0-_|0:_)+(T<<1)|0;i=T+(i<<4)|0;_=((te(i>>16,N)|0)+((te(i&65534,N)|0)>>16)+(te(i,C)|0)>>7)+1>>1;n[ge+(P<<1)>>1]=(_|0)>32767?32767:((_|0)<-32768?-32768:_)&65535;_=x+4|0;s[_>>2]=i;i=i-(s[E>>2]<<4)|0;s[xe>>2]=i;i=i-(A<<2)|0;s[Ie>>2]=i;s[t+1280+(s[He>>2]<<2)>>2]=i-(S<<2);i=s[Ge>>2]|0;s[je+(i<<2)>>2]=T<<1;s[He>>2]=(s[He>>2]|0)+1;i=i+1|0;s[Ge>>2]=i;s[Xe>>2]=(s[Xe>>2]|0)+(r[e>>0]|0);P=P+1|0;e=R;x=_;_=M}Mn(Me|0,t+3840+(y<<2)|0,160)|0;tt=s[ze>>2]|0;a=a+(tt<<1)|0;o=o+tt|0;e=i;we=we+1|0;ge=ge+(tt<<1)|0}s[Je>>2]=s[m+(i+-1<<2)>>2];Tn(t|0,t+(s[Ue>>2]<<1)|0,s[Be>>2]<<1|0)|0;Tn(t+1280|0,t+1280+(s[Ue>>2]<<2)|0,s[Be>>2]<<2|0)|0;l=et;return}function vr(e,t,i,o,f,h,c,u,d,p,b,m,w,g,v){e=e|0;t=t|0;i=i|0;o=o|0;f=f|0;h=h|0;c=c|0;u=u|0;d=d|0;p=p|0;b=b|0;m=m|0;w=w|0;g=g|0;v=v|0;var _=0,y=0,k=0,E=0,A=0,S=0,M=0,T=0,R=0,x=0,C=0,P=0,O=0,N=0,D=0,L=0,B=0,U=0,j=0,F=0,z=0,q=0,H=0,G=0,V=0,W=0,K=0,Z=0,Y=0,$=0,X=0,J=0,Q=0,ee=0,ie=0,ne=0,se=0,ae=0,oe=0,fe=0,he=0,ce=0,le=0,ue=0,de=0,pe=0,be=0,me=0,we=0,ge=0,ve=0,_e=0;ge=l;l=l+176|0;ce=ge+160|0;ae=ge;le=t+4424|0;M=s[le>>2]|0;ne=e+4720|0;_=s[ne>>2]|0;pe=l;l=l+((1*(_*1396|0)|0)+15&-16)|0;kn(pe|0,0,_*1396|0)|0;he=i+34|0;be=t+4416|0;me=t+4420|0;we=e+4684|0;ue=t+3840|0;de=t+4320|0;y=0;while(1){if((y|0)>=(_|0))break;k=y+(a[he>>0]|0)&3;s[pe+(y*1396|0)+1384>>2]=k;s[pe+(y*1396|0)+1388>>2]=k;s[pe+(y*1396|0)+1392>>2]=0;s[pe+(y*1396|0)+1376>>2]=s[be>>2];s[pe+(y*1396|0)+1380>>2]=s[me>>2];s[pe+(y*1396|0)+1120>>2]=s[t+1280+((s[we>>2]|0)+-1<<2)>>2];Mn(pe+(y*1396|0)|0,ue|0,160)|0;k=pe+(y*1396|0)+1280|0;A=de;S=k+96|0;do{s[k>>2]=s[A>>2];k=k+4|0;A=A+4|0}while((k|0)<(S|0));y=y+1|0}k=n[i+30>>1]|0;X=i+29|0;se=r[X>>0]|0;J=n[25404+(se<<24>>24>>1<<2)+((k&65535)<<24>>24<<1)>>1]|0;s[ce>>2]=0;fe=e+4680|0;E=s[fe>>2]|0;_=(E|0)>40?40:E;e:do if(se<<24>>24!=2)if((M|0)>0){ee=M+-3|0;ee=(_|0)<(ee|0)?_:ee}else ee=_;else{i=s[e+4672>>2]|0;y=0;while(1){if((y|0)>=(i|0)){ee=_;break e}se=(s[w+(y<<2)>>2]|0)+-3|0;_=(_|0)<(se|0)?_:se;y=y+1|0}}while(0);z=(k&-256)<<16>>16!=1024&1;$=s[we>>2]|0;se=e+4676|0;Z=$+(s[se>>2]|0)|0;W=l;l=l+((1*(Z<<2)|0)+15&-16)|0;K=l;l=l+((1*(Z<<1)|0)+15&-16)|0;Z=l;l=l+((1*(E<<2)|0)+15&-16)|0;Q=t+4432|0;s[Q>>2]=$;U=t+4428|0;s[U>>2]=s[we>>2];ie=e+4672|0;j=z^1;F=t+4444|0;z=z<<1^3;Y=pe+1392|0;q=m+4|0;H=e+4732|0;G=t+4440|0;V=e+4728|0;B=e+4764|0;L=v<<16>>16;D=0;i=M;$=t+($<<1)|0;y=0;while(1){if((D|0)>=(s[ie>>2]|0))break;C=h+((D>>1|j)<<4<<1)|0;P=c+(D*5<<1)|0;O=u+(D*24<<1)|0;N=s[d+(D<<2)>>2]|0;N=N>>2|N>>>1<<16;s[F>>2]=0;_=r[X>>0]|0;A=w+(D<<2)|0;if(_<<24>>24==2){E=s[A>>2]|0;if(!(D&z)){e:do if((D|0)==2){i=s[ne>>2]|0;_=s[Y>>2]|0;k=0;y=1;while(1){if((y|0)>=(i|0)){_=0;break}R=s[pe+(y*1396|0)+1392>>2]|0;x=(R|0)<(_|0);_=x?R:_;k=x?y:k;y=y+1|0}while(1){if((_|0)>=(i|0))break;if((_|0)!=(k|0)){x=pe+(_*1396|0)+1392|0;s[x>>2]=(s[x>>2]|0)+134217727}_=_+1|0}_=0;y=(s[ce>>2]|0)+ee|0;while(1){if((_|0)>=(ee|0)){y=0;break e}x=(y+-1|0)%40|0;x=(x|0)<0?x+40|0:x;R=_-ee|0;r[f+R>>0]=(((s[pe+(k*1396|0)+640+(x<<2)>>2]|0)>>>9)+1|0)>>>1;M=s[pe+(k*1396|0)+800+(x<<2)>>2]|0;T=s[q>>2]|0;v=T<<16>>16;T=((te(M>>16,v)|0)+((te(M&65535,v)|0)>>16)+(te(M,(T>>15)+1>>1)|0)>>13)+1>>1;n[$+(R<<1)>>1]=(T|0)>32767?32767:((T|0)<-32768?-32768:T)&65535;s[t+1280+((s[Q>>2]|0)-ee+_<<2)>>2]=s[pe+(k*1396|0)+1120+(x<<2)>>2];_=_+1|0;y=x}}while(0);x=s[we>>2]|0;v=s[H>>2]|0;_=x-E-v+-2|0;Tr(K+(_<<1)|0,t+(_+(te(D,s[fe>>2]|0)|0)<<1)|0,C,x-_|0,v);s[U>>2]=s[we>>2];s[F>>2]=1;v=1;_=r[X>>0]|0;x=E;R=y}else{v=0;_=2;x=E;R=y}}else{v=0;x=i;R=y}y=s[ne>>2]|0;M=s[A>>2]|0;T=m+(D<<2)|0;k=s[T>>2]|0;E=(k|0)>1;i=re((E?k:1)|0)|0;E=(E?k:1)<>16;S=536870911/(ve|0)|0;A=S<<16;e=A>>16;E=536870912-((te(ve,e)|0)+((te(E&65535,e)|0)>>16))<<3;S=A+((te(E>>16,e)|0)+((te(E&65528,e)|0)>>16))+(te(E,(S>>15)+1>>1)|0)|0;i=62-i|0;E=i+-47|0;if((E|0)<1){A=47-i|0;i=-2147483648>>A;E=2147483647>>>A;if((i|0)>(E|0)){if((S|0)<=(i|0))i=(S|0)<(E|0)?E:S}else if((S|0)>(E|0))i=E;else i=(S|0)<(i|0)?i:S;E=i<>E:0;S=(E>>4)+1|0;A=S>>>1<<16>>16;S=(S>>16)+1>>1;i=s[fe>>2]|0;e=0;while(1){if((e|0)>=(i|0))break;_e=n[o+(e<<1)>>1]|0;ve=_e<<16>>16;s[Z+(e<<2)>>2]=(te(ve>>16,A)|0)+((te(_e&65535,A)|0)>>16)+(te(ve,S)|0);e=e+1|0}e:do if(v|0){if(!D)E=(te(E>>16,L)|0)+((te(E&65535,L)|0)>>16)<<2;S=s[U>>2]|0;e=E>>16;E=E&65535;A=S-M+-2|0;while(1){if((A|0)>=(S|0))break e;_e=n[K+(A<<1)>>1]|0;s[W+(A<<2)>>2]=(te(e,_e)|0)+((te(E,_e)|0)>>16);A=A+1|0}}while(0);E=s[G>>2]|0;if((k|0)!=(E|0)){if((E|0)<=0)if(!E)A=32;else{i=0-E|0;oe=46}else{i=E;oe=46}if((oe|0)==46){oe=0;A=re(i|0)|0}E=E<>16|0)|0)<<16>>16;_e=(te(E>>16,S)|0)+((te(E&65535,S)|0)>>16)|0;k=Nn(k|0,((k|0)<0)<<31>>31|0,_e|0,((_e|0)<0)<<31>>31|0)|0;k=Sn(k|0,I|0,29)|0;k=E-(k&-8)|0;S=_e+((te(k>>16,S)|0)+((te(k&65535,S)|0)>>16))|0;i=A+28-i|0;k=i+-16|0;if((i|0)<16){E=16-i|0;i=-2147483648>>E;k=2147483647>>>E;if((i|0)>(k|0)){if((S|0)<=(i|0))i=(S|0)<(k|0)?k:S}else if((S|0)>(k|0))i=k;else i=(S|0)<(i|0)?i:S;E=i<>k:0;k=s[Q>>2]|0;A=E>>16;S=E&65535;i=k;k=k-(s[we>>2]|0)|0;while(1){if((k|0)>=(i|0))break;i=t+1280+(k<<2)|0;_e=s[i>>2]|0;ve=_e<<16>>16;s[i>>2]=(te(A,ve)|0)+((te(S,ve)|0)>>16)+(te(E,(_e>>15)+1>>1)|0);i=s[Q>>2]|0;k=k+1|0}e:do if(_<<24>>24==2?(s[F>>2]|0)==0:0){_=s[U>>2]|0;i=_-ee|0;_=_-M+-2|0;while(1){if((_|0)>=(i|0)){i=0;break e}_e=W+(_<<2)|0;ve=s[_e>>2]|0;M=ve<<16>>16;s[_e>>2]=(te(A,M)|0)+((te(S,M)|0)>>16)+(te(E,(ve>>15)+1>>1)|0);_=_+1|0}}else i=0;while(0);while(1){if((i|0)>=(y|0))break;_=pe+(i*1396|0)+1376|0;_e=s[_>>2]|0;ve=_e<<16>>16;s[_>>2]=(te(A,ve)|0)+((te(S,ve)|0)>>16)+(te(E,(_e>>15)+1>>1)|0);_=pe+(i*1396|0)+1380|0;_e=s[_>>2]|0;ve=_e<<16>>16;s[_>>2]=(te(A,ve)|0)+((te(S,ve)|0)>>16)+(te(E,(_e>>15)+1>>1)|0);_=0;while(1){if((_|0)==40){_=0;break}_e=pe+(i*1396|0)+(_<<2)|0;ve=s[_e>>2]|0;M=ve<<16>>16;s[_e>>2]=(te(A,M)|0)+((te(S,M)|0)>>16)+(te(E,(ve>>15)+1>>1)|0);_=_+1|0}while(1){if((_|0)==24){_=0;break}_e=pe+(i*1396|0)+1280+(_<<2)|0;ve=s[_e>>2]|0;M=ve<<16>>16;s[_e>>2]=(te(A,M)|0)+((te(S,M)|0)>>16)+(te(E,(ve>>15)+1>>1)|0);_=_+1|0}while(1){if((_|0)==40)break;_e=pe+(i*1396|0)+960+(_<<2)|0;ve=s[_e>>2]|0;M=ve<<16>>16;s[_e>>2]=(te(A,M)|0)+((te(S,M)|0)>>16)+(te(E,(ve>>15)+1>>1)|0);_e=pe+(i*1396|0)+1120+(_<<2)|0;ve=s[_e>>2]|0;M=ve<<16>>16;s[_e>>2]=(te(A,M)|0)+((te(S,M)|0)>>16)+(te(E,(ve>>15)+1>>1)|0);_=_+1|0}i=i+1|0}s[G>>2]=s[T>>2];_=r[X>>0]|0;k=s[T>>2]|0;i=s[fe>>2]|0;y=s[ne>>2]|0}_r(t,pe,_<<24>>24,Z,f,$,W,ae,C,P,O,x,N,s[p+(D<<2)>>2]|0,s[b+(D<<2)>>2]|0,k,g,J,i,R,s[V>>2]|0,s[H>>2]|0,s[B>>2]|0,y,ce,ee);y=s[fe>>2]|0;o=o+(y<<1)|0;f=f+y|0;D=D+1|0;i=x;$=$+(y<<1)|0;y=R+1|0}i=s[ne>>2]|0;_=s[Y>>2]|0;E=0;y=1;while(1){if((y|0)>=(i|0))break;ve=s[pe+(y*1396|0)+1392>>2]|0;_e=(ve|0)<(_|0);_=_e?ve:_;E=_e?y:E;y=y+1|0}r[he>>0]=s[pe+(E*1396|0)+1388>>2];i=s[m+((s[ie>>2]|0)+-1<<2)>>2]|0;y=i>>>6<<16>>16;i=(i>>21)+1>>1;k=0;_=(s[ce>>2]|0)+ee|0;while(1){if((k|0)>=(ee|0))break;_e=(_+-1|0)%40|0;_e=(_e|0)<0?_e+40|0:_e;ve=k-ee|0;r[f+ve>>0]=(((s[pe+(E*1396|0)+640+(_e<<2)>>2]|0)>>>9)+1|0)>>>1;ce=s[pe+(E*1396|0)+800+(_e<<2)>>2]|0;ce=((te(ce>>16,y)|0)+((te(ce&65535,y)|0)>>16)+(te(ce,i)|0)>>7)+1>>1;n[$+(ve<<1)>>1]=(ce|0)>32767?32767:((ce|0)<-32768?-32768:ce)&65535;s[t+1280+((s[Q>>2]|0)-ee+k<<2)>>2]=s[pe+(E*1396|0)+1120+(_e<<2)>>2];k=k+1|0;_=_e}Mn(ue|0,pe+(E*1396|0)+(s[fe>>2]<<2)|0,160)|0;k=de;A=pe+(E*1396|0)+1280|0;S=k+96|0;do{s[k>>2]=s[A>>2];k=k+4|0;A=A+4|0}while((k|0)<(S|0));s[be>>2]=s[pe+(E*1396|0)+1376>>2];s[me>>2]=s[pe+(E*1396|0)+1380>>2];s[le>>2]=s[w+((s[ie>>2]|0)+-1<<2)>>2];Tn(t|0,t+(s[se>>2]<<1)|0,s[we>>2]<<1|0)|0;Tn(t+1280|0,t+1280+(s[se>>2]<<2)|0,s[we>>2]<<2|0)|0;l=ge;return}function _r(e,t,i,a,o,f,h,c,u,d,p,b,m,w,g,v,_,y,k,E,A,S,M,T,R,x){e=e|0;t=t|0;i=i|0;a=a|0;o=o|0;f=f|0;h=h|0;c=c|0;u=u|0;d=d|0;p=p|0;b=b|0;m=m|0;w=w|0;g=g|0;v=v|0;_=_|0;y=y|0;k=k|0;E=E|0;A=A|0;S=S|0;M=M|0;T=T|0;R=R|0;x=x|0;var C=0,I=0,P=0,O=0,N=0,D=0,L=0,B=0,U=0,j=0,F=0,z=0,q=0,H=0,G=0,V=0,W=0,K=0,Z=0,Y=0,$=0,X=0,J=0,Q=0,ee=0,ie=0,re=0,ne=0,se=0,ae=0,oe=0,fe=0,he=0,ce=0,le=0,ue=0,de=0,pe=0,be=0,me=0,we=0,ge=0,ve=0,_e=0,ye=0,ke=0,Ee=0,Ae=0,Se=0,Me=0,Te=0,Re=0,xe=0,Ce=0,Ie=0,Pe=0,Oe=0,Ne=0,De=0,Le=0,Be=0;Ne=l;Ce=l;l=l+((1*(T*56|0)|0)+15&-16)|0;Ie=e+4432|0;Pe=e+4428|0;xe=v>>6;ke=(i|0)==2;Ee=d+2|0;Ae=d+4|0;Se=d+6|0;Me=d+8|0;Te=(b|0)>0;Re=m<<16>>16;le=m>>16;ue=S>>1;de=u+2|0;pe=u+4|0;be=u+6|0;me=u+8|0;we=u+10|0;ge=u+12|0;ve=u+14|0;_e=u+16|0;ye=u+18|0;ne=(S|0)==16;se=u+20|0;ae=u+22|0;oe=u+24|0;fe=u+26|0;he=u+28|0;ce=u+30|0;Q=M<<16>>16;ee=A>>1;ie=A+-1|0;re=p+(ie<<1)|0;X=w<<16>>16;J=g<<16>>16;K=g>>16;Z=(_|0)>2048;$=(_|0)/2|0;Y=$+-512|0;$=512-$|0;j=_<<16>>16;F=y+944|0;z=te(y<<16>>16,j)|0;q=te(F<<16>>16,j)|0;H=y+-944|0;G=te(944-y<<16>>16,j)|0;V=Ce+4|0;W=Ce+32|0;B=(E|0)<1;U=0;v=h+((s[Pe>>2]|0)-b+2<<2)|0;i=e+1280+((s[Ie>>2]|0)-b+1<<2)|0;while(1){if((U|0)>=(k|0)){v=0;break}if(ke){D=s[v>>2]|0;N=n[d>>1]|0;N=(te(D>>16,N)|0)+((te(D&65535,N)|0)>>16)+2|0;D=s[v+-4>>2]|0;L=n[Ee>>1]|0;L=N+((te(D>>16,L)|0)+((te(D&65535,L)|0)>>16))|0;D=s[v+-8>>2]|0;N=n[Ae>>1]|0;N=L+((te(D>>16,N)|0)+((te(D&65535,N)|0)>>16))|0;D=s[v+-12>>2]|0;L=n[Se>>1]|0;L=N+((te(D>>16,L)|0)+((te(D&65535,L)|0)>>16))|0;D=s[v+-16>>2]|0;N=n[Me>>1]|0;N=L+((te(D>>16,N)|0)+((te(D&65535,N)|0)>>16))<<1;D=v+4|0}else{N=0;D=v}if(Te){L=(s[i>>2]|0)+(s[i+-8>>2]|0)|0;L=(te(L>>16,Re)|0)+((te(L&65535,Re)|0)>>16)|0;O=s[i+-4>>2]|0;O=N-(L+(te(O>>16,le)|0)+((te(O&65535,le)|0)>>16)<<2)|0;L=i+4|0}else{O=0;L=i}C=U+39|0;I=a+(U<<2)|0;P=0;while(1){if((P|0)>=(T|0))break;M=t+(P*1396|0)+1384|0;s[M>>2]=(te(s[M>>2]|0,196314165)|0)+907633515;v=t+(P*1396|0)+(C<<2)|0;b=s[v>>2]|0;E=n[u>>1]|0;E=ue+((te(b>>16,E)|0)+((te(b&65535,E)|0)>>16))|0;b=s[v+-4>>2]|0;i=n[de>>1]|0;i=E+((te(b>>16,i)|0)+((te(b&65535,i)|0)>>16))|0;b=s[v+-8>>2]|0;E=n[pe>>1]|0;E=i+((te(b>>16,E)|0)+((te(b&65535,E)|0)>>16))|0;b=s[v+-12>>2]|0;i=n[be>>1]|0;i=E+((te(b>>16,i)|0)+((te(b&65535,i)|0)>>16))|0;b=s[v+-16>>2]|0;E=n[me>>1]|0;E=i+((te(b>>16,E)|0)+((te(b&65535,E)|0)>>16))|0;b=s[v+-20>>2]|0;i=n[we>>1]|0;i=E+((te(b>>16,i)|0)+((te(b&65535,i)|0)>>16))|0;b=s[v+-24>>2]|0;E=n[ge>>1]|0;E=i+((te(b>>16,E)|0)+((te(b&65535,E)|0)>>16))|0;b=s[v+-28>>2]|0;i=n[ve>>1]|0;i=E+((te(b>>16,i)|0)+((te(b&65535,i)|0)>>16))|0;b=s[v+-32>>2]|0;E=n[_e>>1]|0;E=i+((te(b>>16,E)|0)+((te(b&65535,E)|0)>>16))|0;b=s[v+-36>>2]|0;i=n[ye>>1]|0;i=E+((te(b>>16,i)|0)+((te(b&65535,i)|0)>>16))|0;if(ne){b=s[v+-40>>2]|0;E=n[se>>1]|0;E=i+((te(b>>16,E)|0)+((te(b&65535,E)|0)>>16))|0;b=s[v+-44>>2]|0;i=n[ae>>1]|0;i=E+((te(b>>16,i)|0)+((te(b&65535,i)|0)>>16))|0;b=s[v+-48>>2]|0;E=n[oe>>1]|0;E=i+((te(b>>16,E)|0)+((te(b&65535,E)|0)>>16))|0;b=s[v+-52>>2]|0;i=n[fe>>1]|0;i=E+((te(b>>16,i)|0)+((te(b&65535,i)|0)>>16))|0;b=s[v+-56>>2]|0;E=n[he>>1]|0;E=i+((te(b>>16,E)|0)+((te(b&65535,E)|0)>>16))|0;b=s[v+-60>>2]|0;i=n[ce>>1]|0;i=E+((te(b>>16,i)|0)+((te(b&65535,i)|0)>>16))|0}m=t+(P*1396|0)+1280|0;v=s[m>>2]|0;b=(s[t+(P*1396|0)+1380>>2]|0)+((te(v>>16,Q)|0)+((te(v&65535,Q)|0)>>16))|0;S=(s[t+(P*1396|0)+1284>>2]|0)-b|0;S=v+((te(S>>16,Q)|0)+((te(S&65535,Q)|0)>>16))|0;s[m>>2]=b;m=n[p>>1]|0;v=2;m=ee+((te(b>>16,m)|0)+((te(b&65535,m)|0)>>16))|0;while(1){if((v|0)>=(A|0))break;w=v+-1|0;b=t+(P*1396|0)+1280+(w<<2)|0;_=t+(P*1396|0)+1280+(v<<2)|0;E=s[_>>2]|0;g=E-S|0;g=(s[b>>2]|0)+((te(g>>16,Q)|0)+((te(g&65535,Q)|0)>>16))|0;s[b>>2]=S;w=n[p+(w<<1)>>1]|0;b=s[t+(P*1396|0)+1280+((v|1)<<2)>>2]|0;s[_>>2]=g;w=w<<16>>16;_=n[p+(v<<1)>>1]|0;b=b-g|0;v=v+2|0;m=m+((te(S>>16,w)|0)+((te(S&65535,w)|0)>>16))+((te(g>>16,_)|0)+((te(g&65535,_)|0)>>16))|0;S=E+((te(b>>16,Q)|0)+((te(b&65535,Q)|0)>>16))|0}b=i<<4;s[t+(P*1396|0)+1280+(ie<<2)>>2]=S;g=n[re>>1]|0;g=m+((te(S>>16,g)|0)+((te(S&65535,g)|0)>>16))<<1;_=s[t+(P*1396|0)+1376>>2]|0;E=_>>16;_=_&65535;g=g+((te(E,X)|0)+((te(_,X)|0)>>16))<<2;w=s[t+(P*1396|0)+1120+(s[R>>2]<<2)>>2]|0;_=(te(w>>16,J)|0)+((te(w&65535,J)|0)>>16)+(te(E,K)|0)+((te(_,K)|0)>>16)<<2;E=s[I>>2]|0;w=E-((O+b-(g+_)>>3)+1>>1)|0;M=(s[M>>2]|0)<0;w=M?0-w|0:w;w=(w|0)>30720?30720:(w|0)<-31744?-31744:w;v=w-y|0;do if(Z){if((v|0)>(Y|0)){v=v-Y|0;Oe=20;break}if((v|0)>=($|0))if((v|0)<0){Oe=23;break}else{v=y;i=F;m=z;S=q;break}else{v=v+Y|0;Oe=20;break}}else Oe=20;while(0);e:do if((Oe|0)==20){Oe=0;v=v>>10;if((v|0)>0){m=(v<<10)+-80+y|0;S=m+1024|0;v=m;i=S;m=te(m<<16>>16,j)|0;S=te(S<<16>>16,j)|0;break}switch(v|0){case 0:{v=y;i=F;m=z;S=q;break e}case-1:{Oe=23;break e}default:{}}S=(v<<10|80)+y|0;v=S;i=S+1024|0;m=te(0-S<<16>>16,j)|0;S=te(-1024-S<<16>>16,j)|0}while(0);if((Oe|0)==23){Oe=0;v=H;i=y;m=G;S=z}De=w-v<<16>>16;De=m+(te(De,De)|0)>>10;w=w-i<<16>>16;w=S+(te(w,w)|0)>>10;Le=(De|0)<(w|0);Be=s[t+(P*1396|0)+1392>>2]|0;m=Le?v:i;S=Le?i:v;s[Ce+(P*56|0)+4>>2]=Be+(Le?De:w);s[Ce+(P*56|0)+32>>2]=Be+(Le?w:De);s[Ce+(P*56|0)>>2]=m;s[Ce+(P*56|0)+28>>2]=S;i=m<<4;i=(M?0-i|0:i)+N|0;m=i+b|0;w=E<<4;E=m-w|0;s[Ce+(P*56|0)+16>>2]=E;E=E-g|0;s[Ce+(P*56|0)+20>>2]=E-_;s[Ce+(P*56|0)+12>>2]=E;s[Ce+(P*56|0)+24>>2]=i;s[Ce+(P*56|0)+8>>2]=m;E=S<<4;E=(M?0-E|0:E)+N|0;b=E+b|0;w=b-w|0;s[Ce+(P*56|0)+44>>2]=w;g=w-g|0;s[Ce+(P*56|0)+48>>2]=g-_;s[Ce+(P*56|0)+40>>2]=g;s[Ce+(P*56|0)+52>>2]=E;s[Ce+(P*56|0)+36>>2]=b;P=P+1|0}v=((s[R>>2]|0)+-1|0)%40|0;g=(v|0)<0;i=v+40|0;s[R>>2]=g?i:v;v=(g?i:v)+x|0;i=s[V>>2]|0;g=0;m=1;while(1){if((m|0)>=(T|0))break;Le=s[Ce+(m*56|0)+4>>2]|0;Be=(Le|0)<(i|0);i=Be?Le:i;g=Be?m:g;m=m+1|0}w=(v|0)%40|0;v=s[t+(g*1396|0)+480+(w<<2)>>2]|0;i=0;while(1){if((i|0)>=(T|0))break;if((s[t+(i*1396|0)+480+(w<<2)>>2]|0)!=(v|0)){Be=Ce+(i*56|0)+4|0;s[Be>>2]=(s[Be>>2]|0)+134217727;Be=Ce+(i*56|0)+32|0;s[Be>>2]=(s[Be>>2]|0)+134217727}i=i+1|0}v=s[V>>2]|0;i=0;m=s[W>>2]|0;S=0;M=1;while(1){if((M|0)>=(T|0))break;N=s[Ce+(M*56|0)+4>>2]|0;De=(N|0)>(v|0);Le=s[Ce+(M*56|0)+32>>2]|0;Be=(Le|0)<(m|0);v=De?N:v;i=De?M:i;m=Be?Le:m;S=Be?M:S;M=M+1|0}if((m|0)<(v|0)){Mn(t+(i*1396|0)+(U<<2)|0,t+(S*1396|0)+(U<<2)|0,1396-(U<<2)|0)|0;Be=Ce+(i*56|0)|0;Le=Ce+(S*56|0)+28|0;s[Be>>2]=s[Le>>2];s[Be+4>>2]=s[Le+4>>2];s[Be+8>>2]=s[Le+8>>2];s[Be+12>>2]=s[Le+12>>2];s[Be+16>>2]=s[Le+16>>2];s[Be+20>>2]=s[Le+20>>2];s[Be+24>>2]=s[Le+24>>2]}if(!(B&(U|0)<(x|0))){Be=U-x|0;r[o+Be>>0]=(((s[t+(g*1396|0)+640+(w<<2)>>2]|0)>>>9)+1|0)>>>1;De=s[t+(g*1396|0)+800+(w<<2)>>2]|0;Le=s[c+(w<<2)>>2]|0;N=Le<<16>>16;Le=((te(De>>16,N)|0)+((te(De&65535,N)|0)>>16)+(te(De,(Le>>15)+1>>1)|0)>>7)+1>>1;n[f+(Be<<1)>>1]=(Le|0)>32767?32767:((Le|0)<-32768?-32768:Le)&65535;s[e+1280+((s[Ie>>2]|0)-x<<2)>>2]=s[t+(g*1396|0)+1120+(w<<2)>>2];s[h+((s[Pe>>2]|0)-x<<2)>>2]=s[t+(g*1396|0)+960+(w<<2)>>2]}s[Ie>>2]=(s[Ie>>2]|0)+1;s[Pe>>2]=(s[Pe>>2]|0)+1;v=U+40|0;i=0;while(1){if((i|0)>=(T|0))break;s[t+(i*1396|0)+1376>>2]=s[Ce+(i*56|0)+12>>2];s[t+(i*1396|0)+1380>>2]=s[Ce+(i*56|0)+16>>2];Be=s[Ce+(i*56|0)+8>>2]|0;s[t+(i*1396|0)+(v<<2)>>2]=Be;s[t+(i*1396|0)+800+(s[R>>2]<<2)>>2]=Be;Be=s[Ce+(i*56|0)>>2]|0;s[t+(i*1396|0)+640+(s[R>>2]<<2)>>2]=Be;s[t+(i*1396|0)+960+(s[R>>2]<<2)>>2]=s[Ce+(i*56|0)+24>>2]<<1;s[t+(i*1396|0)+1120+(s[R>>2]<<2)>>2]=s[Ce+(i*56|0)+20>>2];Le=t+(i*1396|0)+1384|0;Be=(s[Le>>2]|0)+((Be>>9)+1>>1)|0;s[Le>>2]=Be;s[t+(i*1396|0)+480+(s[R>>2]<<2)>>2]=Be;s[t+(i*1396|0)+1392>>2]=s[Ce+(i*56|0)+4>>2];i=i+1|0}s[c+(s[R>>2]<<2)>>2]=xe;U=U+1|0;v=D;i=L}while(1){if((v|0)>=(T|0))break;Mn(t+(v*1396|0)|0,t+(v*1396|0)+(k<<2)|0,160)|0;v=v+1|0}l=Ne;return}function yr(e,t,i){e=e|0;t=t|0;i=i|0;var a=0,f=0,h=0,c=0,u=0,d=0,p=0,b=0,m=0,w=0,g=0,v=0,_=0,y=0,k=0,E=0,A=0,S=0,M=0,T=0,R=0,x=0,C=0,I=0,P=0,O=0,N=0,D=0,L=0,B=0,U=0,j=0,F=0,z=0,q=0,H=0;H=l;l=l+64|0;c=H+20|0;u=H+16|0;f=H+12|0;h=H+8|0;q=H+24|0;a=H;N=e+2336|0;b=s[N>>2]|0;z=e+2328|0;D=l;l=l+((1*(b+(s[z>>2]|0)<<2)|0)+15&-16)|0;g=l;l=l+((1*(b<<1)|0)+15&-16)|0;s[a>>2]=s[e+4240>>2]>>6;b=e+4244|0;U=s[b>>2]|0;B=U>>6;s[a+4>>2]=B;if(s[e+2376>>2]|0){p=e+4182|0;d=p+32|0;do{n[p>>1]=0;p=p+2|0}while((p|0)<(d|0))}P=e+2332|0;O=e+2324|0;kr(f,c,h,u,e+4|0,a,s[P>>2]|0,s[O>>2]|0);a=s[e+4252>>2]|0;if((s[f>>2]>>s[u>>2]|0)<(s[h>>2]>>s[c>>2]|0)){a=te(a+-1|0,s[e+4256>>2]|0)|0;a=(a|0)<128?0:a+-128|0}else{a=te(a,s[e+4256>>2]|0)|0;a=(a|0)<128?0:a+-128|0}I=e+4+(a<<2)|0;T=e+4172|0;j=e+4224|0;d=n[j>>1]|0;c=e+4160|0;p=s[c>>2]|0;F=(p|0)>1;w=n[25776+((F?1:p)<<1)>>1]|0;u=e+4164|0;p=n[((s[u>>2]|0)==2?25780:25784)+((F?1:p)<<1)>>1]|0;F=e+2340|0;f=(s[F>>2]|0)+-1|0;a=64881;h=0;while(1){if((h|0)>=(f|0))break;L=e+4182+(h<<1)|0;n[L>>1]=(((te(a,n[L>>1]|0)|0)>>>15)+1|0)>>>1;a=a+(((te(a,-655)|0)>>15)+1>>1)|0;h=h+1|0}h=e+4182+(f<<1)|0;n[h>>1]=(((te(a,n[h>>1]|0)|0)>>>15)+1|0)>>>1;a=e+4182|0;h=s[F>>2]|0;Mn(q|0,a|0,h<<1|0)|0;do if(!(s[c>>2]|0)){if((s[u>>2]|0)==2){a=0;f=16384;while(1){if((a|0)==5)break;L=(f&65535)-(o[e+4172+(a<<1)>>1]|0)&65535;a=a+1|0;f=L}d=(te((f<<16>>16<3277?3277:f)<<16>>16,n[e+4236>>1]|0)|0)>>>14&65535;break}a=Rr(a,h)|0;if((a|0)<=134217728)if((a|0)<4194304)a=4194304;else m=16;else{a=134217728;m=16}d=a<<3;p=(te(d>>16,p)|0)+((te(d&65528,p)|0)>>16)>>14;d=16384}while(0);L=e+4220|0;A=s[L>>2]|0;M=e+4168|0;E=(s[M>>2]>>7)+1>>1;S=s[N>>2]|0;u=S-E-h+-2|0;Tr(g+(u<<1)|0,e+1348+(u<<1)|0,q,S-u|0,h);f=s[b>>2]|0;if((f|0)<=0)if(!f)a=32;else{a=0-f|0;m=20}else{a=f;m=20}if((m|0)==20)a=re(a|0)|0;f=f<>16;c=536870911/(R|0)|0;x=c<<16;C=x>>16;f=536870912-((te(R,C)|0)+((te(f&65535,C)|0)>>16))<<3;c=x+((te(f>>16,C)|0)+((te(f&65528,C)|0)>>16))+(te(f,(c>>15)+1>>1)|0)|0;a=62-a|0;f=a+-46|0;if((f|0)>=1)if((f|0)<32){a=c>>f;m=30}else a=0;else{h=46-a|0;a=-2147483648>>h;f=2147483647>>>h;if((a|0)>(f|0)){if((c|0)<=(a|0))a=(c|0)<(f|0)?f:c}else if((c|0)>(f|0))a=f;else a=(c|0)<(a|0)?a:c;a=a<>2]|0;c=a>>16;f=a&65535;a=u+(s[F>>2]|0)|0;while(1){if((a|0)>=(h|0))break;C=n[g+(a<<1)>>1]|0;s[D+(a<<2)>>2]=(te(c,C)|0)+((te(f,C)|0)>>16);a=a+1|0}v=e+4174|0;_=e+4176|0;y=e+4178|0;k=e+4180|0;m=w<<16>>16;w=e+2765|0;g=e+2316|0;p=p<<16>>16;b=0;C=E;x=d;R=A;f=S;while(1){if((b|0)>=(s[O>>2]|0))break;u=x<<16>>16;h=s[P>>2]|0;c=0;a=D+(f-C+2<<2)|0;d=R;while(1){if((c|0)>=(h|0)){a=0;break}C=s[a>>2]|0;S=n[T>>1]|0;S=(te(C>>16,S)|0)+((te(C&65535,S)|0)>>16)+2|0;C=s[a+-4>>2]|0;R=n[v>>1]|0;R=S+((te(C>>16,R)|0)+((te(C&65535,R)|0)>>16))|0;C=s[a+-8>>2]|0;S=n[_>>1]|0;S=R+((te(C>>16,S)|0)+((te(C&65535,S)|0)>>16))|0;C=s[a+-12>>2]|0;R=n[y>>1]|0;R=S+((te(C>>16,R)|0)+((te(C&65535,R)|0)>>16))|0;C=s[a+-16>>2]|0;S=n[k>>1]|0;S=R+((te(C>>16,S)|0)+((te(C&65535,S)|0)>>16))|0;C=(te(d,196314165)|0)+907633515|0;R=s[I+(C>>>25<<2)>>2]|0;s[D+(f<<2)>>2]=S+((te(R>>16,u)|0)+((te(R&65535,u)|0)>>16))<<2;c=c+1|0;a=a+4|0;d=C;f=f+1|0}while(1){if((a|0)==5)break;C=e+4172+(a<<1)|0;n[C>>1]=(te(m,n[C>>1]|0)|0)>>>15;a=a+1|0}if(!(r[w>>0]|0))a=x;else a=(te(u,p)|0)>>>15&65535;x=s[M>>2]|0;x=x+(((x>>16)*655|0)+(((x&65535)*655|0)>>>16))|0;s[M>>2]=x;C=(s[g>>2]<<16>>16)*4608|0;C=(x|0)<(C|0)?x:C;s[M>>2]=C;b=b+1|0;C=(C>>7)+1>>1;x=a;R=d}T=D+((s[N>>2]|0)+-16<<2)|0;M=e+1284|0;p=T;a=M;d=p+64|0;do{s[p>>2]=s[a>>2];p=p+4|0;a=a+4|0}while((p|0)<(d|0));m=n[q>>1]|0;w=n[q+2>>1]|0;g=n[q+4>>1]|0;v=n[q+6>>1]|0;_=n[q+8>>1]|0;y=n[q+10>>1]|0;k=n[q+12>>1]|0;E=n[q+14>>1]|0;A=n[q+16>>1]|0;S=n[q+18>>1]|0;b=B<<16>>16;d=(U>>21)+1>>1;p=0;while(1){a=s[z>>2]|0;if((p|0)>=(a|0))break;a=s[T+(p+15<<2)>>2]|0;a=(s[F>>2]>>1)+((te(a>>16,m)|0)+((te(a&65535,m)|0)>>16))|0;u=s[T+(p+14<<2)>>2]|0;u=a+((te(u>>16,w)|0)+((te(u&65535,w)|0)>>16))|0;a=s[T+(p+13<<2)>>2]|0;a=u+((te(a>>16,g)|0)+((te(a&65535,g)|0)>>16))|0;u=s[T+(p+12<<2)>>2]|0;u=a+((te(u>>16,v)|0)+((te(u&65535,v)|0)>>16))|0;a=s[T+(p+11<<2)>>2]|0;a=u+((te(a>>16,_)|0)+((te(a&65535,_)|0)>>16))|0;u=s[T+(p+10<<2)>>2]|0;u=a+((te(u>>16,y)|0)+((te(u&65535,y)|0)>>16))|0;a=s[T+(p+9<<2)>>2]|0;a=u+((te(a>>16,k)|0)+((te(a&65535,k)|0)>>16))|0;u=s[T+(p+8<<2)>>2]|0;u=a+((te(u>>16,E)|0)+((te(u&65535,E)|0)>>16))|0;a=s[T+(p+7<<2)>>2]|0;a=u+((te(a>>16,A)|0)+((te(a&65535,A)|0)>>16))|0;u=s[T+(p+6<<2)>>2]|0;u=a+((te(u>>16,S)|0)+((te(u&65535,S)|0)>>16))|0;a=s[F>>2]|0;f=p+16|0;h=10;while(1){if((h|0)>=(a|0))break;B=s[T+(f-h+-1<<2)>>2]|0;U=n[q+(h<<1)>>1]|0;u=u+((te(B>>16,U)|0)+((te(B&65535,U)|0)>>16))|0;h=h+1|0}c=T+(f<<2)|0;a=s[c>>2]|0;f=(u|0)>134217727;h=f?2147483632:((u|0)<-134217728?-134217728:u)<<4;if((a+(f?2147483632:((u|0)<-134217728?-134217728:u)<<4)|0)>-1)if((a&h|0)<0)a=-2147483648;else a=a+(f?2147483632:((u|0)<-134217728?-134217728:u)<<4)|0;else if((a|h|0)>-1)a=2147483647;else a=a+(f?2147483632:((u|0)<-134217728?-134217728:u)<<4)|0;s[c>>2]=a;U=((te(a>>16,b)|0)+((te(a&65535,b)|0)>>16)+(te(a,d)|0)>>7)+1>>1;n[i+(p<<1)>>1]=(U|0)>32767?32767:((U|0)<-32768?-32768:U)&65535;p=p+1|0}p=M;a=T+(a<<2)|0;d=p+64|0;do{s[p>>2]=s[a>>2];p=p+4|0;a=a+4|0}while((p|0)<(d|0));s[L>>2]=R;n[j>>1]=x;a=0;while(1){if((a|0)==4)break;s[t+(a<<2)>>2]=C;a=a+1|0}l=H;return}function kr(e,t,i,r,a,o,f,h){e=e|0;t=t|0;i=i|0;r=r|0;a=a|0;o=o|0;f=f|0;h=h|0;var c=0,u=0,d=0,p=0,b=0,m=0,w=0,g=0,v=0,_=0;w=l;c=l;l=l+((1*(f<<1<<1)|0)+15&-16)|0;p=c;m=0;while(1){if((m|0)==2)break;u=te(m+h+-2|0,f)|0;d=o+(m<<2)|0;b=0;while(1){if((b|0)>=(f|0))break;v=s[a+(b+u<<2)>>2]|0;g=s[d>>2]|0;_=g<<16>>16;g=(te(v>>16,_)|0)+((te(v&65535,_)|0)>>16)+(te(v,(g>>15)+1>>1)|0)>>8;n[p+(b<<1)>>1]=(g|0)>32767?32767:((g|0)<-32768?-32768:g)&65535;b=b+1|0}p=p+(f<<1)|0;m=m+1|0}Nr(e,t,c,f);Nr(i,r,c+(f<<1)|0,f);l=w;return}function Er(e,t){e=e|0;t=t|0;var i=0,r=0,a=0,f=0,h=0,c=0,u=0,d=0,p=0,b=0,m=0,w=0,g=0,v=0,_=0,y=0,k=0;y=l;l=l+48|0;g=y+32|0;_=y+16|0;m=y;v=e+4676|0;c=s[v>>2]|0;d=c>>1;i=c>>2;a=c>>3;s[m>>2]=0;p=a+i|0;s[m+4>>2]=p;u=p+a|0;s[m+8>>2]=u;h=u+i|0;s[m+12>>2]=h;b=l;l=l+((1*(h+d<<1)|0)+15&-16)|0;Sr(t,e+32|0,b,b+(h<<1)|0,c);Sr(b,e+40|0,b,b+(u<<1)|0,d);Sr(b,e+48|0,b,b+(p<<1)|0,i);i=b+(a+-1<<1)|0;t=n[i>>1]>>1;n[i>>1]=t;i=t;while(1){r=a+-1|0;if((a|0)<=1)break;d=b+(a+-2<<1)|0;p=n[d>>1]>>1;n[d>>1]=p;n[b+(r<<1)>>1]=(i&65535)-(p&65535);i=p;a=r}u=e+88|0;n[b>>1]=(o[b>>1]|0)-(o[u>>1]|0);n[u>>1]=t;u=0;i=0;while(1){if((u|0)==4)break;a=4-u|0;a=s[v>>2]>>((a|0)<3?a:3)>>2;f=e+56+(u<<2)|0;t=s[f>>2]|0;h=g+(u<<2)|0;s[h>>2]=t;c=m+(u<<2)|0;d=0;p=0;while(1){if((p|0)==4)break;else{r=0;i=0}while(1){if((r|0)>=(a|0))break;k=n[b+((s[c>>2]|0)+r+d<<1)>>1]>>3;r=r+1|0;i=i+(te(k,k)|0)|0}if((p|0)<3){t=t+i|0;t=(t|0)<0?2147483647:t}else{t=t+(i>>1)|0;t=(t|0)<0?2147483647:t}s[h>>2]=t;d=d+a|0;p=p+1|0}s[f>>2]=i;u=u+1|0}c=e+140|0;t=s[c>>2]|0;if((t|0)<1e3)h=32767/((t>>4)+1|0)|0;else h=0;f=0;while(1){if((f|0)==4)break;r=e+92+(f<<2)|0;i=s[r>>2]|0;t=(s[g+(f<<2)>>2]|0)+(s[e+124+(f<<2)>>2]|0)|0;t=(t|0)<0?2147483647:t;a=2147483647/(t|0)|0;if((t|0)<=(i<<3|0))if((t|0)<(i|0))t=1024;else{k=i<<16>>16;m=te(a>>16,k)|0;k=te(a&65535,k)|0;t=te(a,(i>>15)+1>>1)|0;t=m+(k>>16)+t>>16<<11|(m+(k>>>16)+t|0)>>>5&2047}else t=128;m=e+108+(f<<2)|0;p=s[m>>2]|0;b=a-p|0;k=((t|0)>(h|0)?t:h)<<16>>16;k=p+((te(b>>16,k)|0)+((te(b&65535,k)|0)>>16))|0;s[m>>2]=k;k=2147483647/(k|0)|0;s[r>>2]=(k|0)<16777215?k:16777215;f=f+1|0}s[c>>2]=(s[c>>2]|0)+1;p=0;b=0;f=0;while(1){if((p|0)==4)break;c=s[g+(p<<2)>>2]|0;u=s[e+92+(p<<2)>>2]|0;d=c-u|0;if((d|0)>0){if(c>>>0<8388608)t=(c<<8|0)/(u+1|0)|0;else t=(c|0)/((u>>8)+1|0)|0;s[_+(p<<2)>>2]=t;a=re(t|0)|0;i=24-a|0;r=0-i|0;do if(i)if((i|0)<0){t=t<>>(i+32|0);break}else{t=t<<32-i|t>>>i;break}while(0);t=t&127;t=t+(((te(t,128-t|0)|0)*179|0)>>>16)+(31-a<<7)+-1024|0;h=t<<16>>16;f=f+(te(h,h)|0)|0;if((d|0)<1048576){r=re(d|0)|0;r=(c|0)==(u|0)?32:r;t=24-r|0;i=0-t|0;do if(t)if((t|0)<0){t=d<>>(t+32|0);break}else{t=d<<32-t|d>>>t;break}else t=d;while(0);r=((r&1|0)==0?46214:32768)>>>(r>>>1);a=(te(t&127,13959168)|0)>>>16;a=te(r+((te(r>>16,a)|0)+((te(r&65535,a)|0)>>>16))<<6>>16,h)|0;r=re(d|0)|0;r=(c|0)==(u|0)?32:r;t=24-r|0;i=0-t|0;do if(t)if((t|0)<0){t=d<>>(t+32|0);break}else{t=d<<32-t|d>>>t;break}else t=d;while(0);k=((r&1|0)==0?46214:32768)>>>(r>>>1);t=(te(t&127,13959168)|0)>>>16;t=a+((te(k+((te(k>>16,t)|0)+((te(k&65535,t)|0)>>>16))<<6&65472,h)|0)>>16)|0}k=s[22976+(p<<2)>>2]|0;i=t<<16>>16;i=b+((te(k>>16,i)|0)+((te(k&65535,i)|0)>>16))|0;t=f}else{s[_+(p<<2)>>2]=256;i=b;t=f}p=p+1|0;b=i;f=t}t=(f|0)/4|0;do if((f|0)>=4){a=re(t|0)|0;a=(f+3|0)>>>0<7?32:a;i=24-a|0;r=0-i|0;do if(i)if((i|0)<0){t=t<>>(i+32|0);break}else{t=t<<32-i|t>>>i;break}while(0);i=((a&1|0)==0?46214:32768)>>>(a>>>1);t=(te(t&127,13959168)|0)>>>16;t=((i+((te(i>>16,t)|0)+((te(i&65535,t)|0)>>>16))|0)*196608>>16)*45e3>>16;i=t+-128|0;if((t|0)<128)if((i|0)<-191){t=0;break}else{t=128-t|0;w=53;break}if((i|0)>191)t=32767;else{t=i>>5;t=(s[23040+(t<<2)>>2]|0)+(te(s[23016+(t<<2)>>2]<<16>>16,i&31)|0)|0}}else{t=128;w=53}while(0);if((w|0)==53){k=t>>5;t=(s[22992+(k<<2)>>2]|0)-(te(s[23016+(k<<2)>>2]<<16>>16,t&31)|0)|0}if((b|0)<0){i=0-b|0;if((b|0)<-191)i=0;else{k=i>>5;i=(s[22992+(k<<2)>>2]|0)-(te(s[23016+(k<<2)>>2]<<16>>16,i&31)|0)|0}}else if((b|0)>191)i=32767;else{i=b>>5;i=(s[23040+(i<<2)>>2]|0)+(te(s[23016+(i<<2)>>2]<<16>>16,b&31)|0)|0}s[e+4804>>2]=(i<<1)+-32768;i=0;r=0;while(1){if((i|0)==4)break;w=i+1|0;k=r+(te(w,(s[g+(i<<2)>>2]|0)-(s[e+92+(i<<2)>>2]|0)>>4)|0)|0;i=w;r=k}if((r|0)>=1){if((r|0)<32768){i=r<<((s[v>>2]|0)==((s[e+4668>>2]|0)*10|0)?16:15);f=re(i|0)|0;r=24-f|0;a=0-r|0;do if(r)if((r|0)<0){i=i<>>(r+32|0);break}else{i=i<<32-r|i>>>r;break}while(0);g=((f&1|0)==0?46214:32768)>>>(f>>>1);k=(te(i&127,13959168)|0)>>>16;k=g+((te(g>>16,k)|0)+((te(g&65535,k)|0)>>>16))+32768|0;t=t<<16>>16;t=(te(k>>16,t)|0)+((te(k&65535,t)|0)>>16)|0}}else t=t>>1;h=t>>7;s[e+4624>>2]=(h|0)<255?h:255;h=t<<16>>16;h=((te(t>>16,h)|0)<<16)+(te(t&65535,h)|0)|0;h=h>>((s[v>>2]|0)==((s[e+4668>>2]|0)*10|0)?21:20);f=0;while(1){ +if((f|0)==4)break;a=e+72+(f<<2)|0;i=s[a>>2]|0;t=(s[_+(f<<2)>>2]|0)-i|0;t=i+((te(t>>16,h)|0)+((te(t&65535,h)|0)>>16))|0;s[a>>2]=t;a=re(t|0)|0;i=24-a|0;r=0-i|0;do if(i)if((i|0)<0){t=t<>>(i+32|0);break}else{t=t<<32-i|t>>>i;break}while(0);t=t&127;t=((t+(((te(t,128-t|0)|0)*179|0)>>>16)+(31-a<<7)|0)*3|0)+-5120|0;i=t>>4;if((i|0)<0){t=0-i|0;if((i|0)<-191)t=0;else{k=t>>5;t=(s[22992+(k<<2)>>2]|0)-(te(s[23016+(k<<2)>>2]<<16>>16,t&31)|0)|0}}else if((i|0)>191)t=32767;else{t=t>>9;t=(s[23040+(t<<2)>>2]|0)+(te(s[23016+(t<<2)>>2]<<16>>16,i&31)|0)|0}s[e+4788+(f<<2)>>2]=t;f=f+1|0}l=y;return}function Ar(e,t,i){e=e|0;t=t|0;i=i|0;var r=0,n=0,a=0;r=s[e+(i<<2)>>2]|0;n=t<<4;if((i|0)==8){t=t<<20>>16;a=(n>>15)+1>>1;i=(s[e+28>>2]|0)+((te(r>>16,t)|0)+((te(r&65535,t)|0)>>16))+(te(r,a)|0)|0;i=(s[e+24>>2]|0)+((te(i>>16,t)|0)+((te(i&65535,t)|0)>>16))+(te(i,a)|0)|0;i=(s[e+20>>2]|0)+((te(i>>16,t)|0)+((te(i&65535,t)|0)>>16))+(te(i,a)|0)|0;i=(s[e+16>>2]|0)+((te(i>>16,t)|0)+((te(i&65535,t)|0)>>16))+(te(i,a)|0)|0;i=(s[e+12>>2]|0)+((te(i>>16,t)|0)+((te(i&65535,t)|0)>>16))+(te(i,a)|0)|0;i=(s[e+8>>2]|0)+((te(i>>16,t)|0)+((te(i&65535,t)|0)>>16))+(te(i,a)|0)|0;i=(s[e+4>>2]|0)+((te(i>>16,t)|0)+((te(i&65535,t)|0)>>16))+(te(i,a)|0)|0;e=(s[e>>2]|0)+((te(i>>16,t)|0)+((te(i&65535,t)|0)>>16))+(te(i,a)|0)|0;return e|0}a=t<<20>>16;n=(n>>15)+1>>1;while(1){t=i+-1|0;if((i|0)<=0)break;i=t;r=(s[e+(t<<2)>>2]|0)+((te(r>>16,a)|0)+((te(r&65535,a)|0)>>16))+(te(r,n)|0)|0}return r|0}function Sr(e,t,i,r,a){e=e|0;t=t|0;i=i|0;r=r|0;a=a|0;var o=0,f=0,h=0,c=0,l=0,u=0,d=0;a=a>>1;o=t+4|0;f=0;while(1){if((f|0)>=(a|0))break;u=f<<1;d=n[e+(u<<1)>>1]<<10;l=d-(s[t>>2]|0)|0;c=(te(l>>16,-24290)|0)+((te(l&65535,-24290)|0)>>16)|0;h=d+c|0;s[t>>2]=d+(l+c);u=n[e+((u|1)<<1)>>1]<<10;c=s[o>>2]|0;l=u-c|0;l=((l>>16)*10788|0)+(((l&65535)*10788|0)>>>16)|0;c=c+l|0;s[o>>2]=u+l;l=(c+h>>10)+1>>1;n[i+(f<<1)>>1]=(l|0)>32767?32767:((l|0)<-32768?-32768:l)&65535;h=(c-h>>10)+1>>1;n[r+(f<<1)>>1]=(h|0)>32767?32767:((h|0)<-32768?-32768:h)&65535;f=f+1|0}return}function Mr(e,t,i){e=e|0;t=t|0;i=i|0;var r=0,n=0,a=0,o=0,f=0,h=0;a=i+-65536|0;n=t+-1|0;r=0;while(1){t=i>>16;if((r|0)>=(n|0))break;o=e+(r<<2)|0;f=s[o>>2]|0;h=f<<16>>16;s[o>>2]=(te(t,h)|0)+((te(i&65535,h)|0)>>16)+(te(i,(f>>15)+1>>1)|0);i=i+(((te(i,a)|0)>>15)+1>>1)|0;r=r+1|0}h=e+(n<<2)|0;f=s[h>>2]|0;o=f<<16>>16;s[h>>2]=(te(t,o)|0)+((te(i&65535,o)|0)>>16)+(te(i,(f>>15)+1>>1)|0);return}function Tr(e,t,i,r,s){e=e|0;t=t|0;i=i|0;r=r|0;s=s|0;var a=0,o=0,f=0,h=0,c=0,l=0,u=0,d=0,p=0,b=0;a=i+2|0;o=i+4|0;f=i+6|0;h=i+8|0;c=i+10|0;u=s;while(1){if((u|0)>=(r|0))break;l=t+(u+-1<<1)|0;p=te(n[l>>1]|0,n[i>>1]|0)|0;p=p+(te(n[l+-2>>1]|0,n[a>>1]|0)|0)|0;p=p+(te(n[l+-4>>1]|0,n[o>>1]|0)|0)|0;p=p+(te(n[l+-6>>1]|0,n[f>>1]|0)|0)|0;p=p+(te(n[l+-8>>1]|0,n[h>>1]|0)|0)|0;d=6;p=p+(te(n[l+-10>>1]|0,n[c>>1]|0)|0)|0;while(1){if((d|0)>=(s|0))break;b=p+(te(n[l+(0-d<<1)>>1]|0,n[i+(d<<1)>>1]|0)|0)|0;b=b+(te(n[l+(~d<<1)>>1]|0,n[i+((d|1)<<1)>>1]|0)|0)|0;d=d+2|0;p=b}b=((n[l+2>>1]<<12)-p>>11)+1>>1;n[e+(u<<1)>>1]=(b|0)>32767?32767:((b|0)<-32768?-32768:b)&65535;u=u+1|0}kn(e|0,0,s<<1|0)|0;return}function Rr(e,t){e=e|0;t=t|0;var i=0,r=0,a=0,o=0,f=0,h=0,c=0,u=0,d=0,p=0,b=0,m=0,w=0,g=0,v=0,_=0,y=0,k=0;k=l;l=l+96|0;_=k;i=0;r=0;while(1){if((r|0)>=(t|0))break;v=n[e+(r<<1)>>1]|0;s[_+(r<<2)>>2]=v<<12;i=i+v|0;r=r+1|0}if((i|0)>4095){l=k;return 0}a=1073741824;r=0;e:while(1){v=t+-1|0;e=s[_+(v<<2)>>2]|0;i=(e+16773022|0)>>>0>33546044;if((t|0)<=1){y=44;break}if(i){y=46;break}w=0-(e<<7)|0;g=((w|0)<0)<<31>>31;Nn(w|0,g|0,w|0,g|0)|0;o=1073741824-I|0;m=Nn(a|0,r|0,o|0,((o|0)<0)<<31>>31|0)|0;m=Sn(m|0,I|0,30)|0;m=m&-4;if((m|0)<107374){y=46;break}if((o|0)<=0)if(!o){e=32;i=30;f=0}else{e=0-o|0;y=11}else{e=o;y=11}if((y|0)==11){y=0;f=32-(re(e|0)|0)|0;e=re(e|0)|0;i=f+30|0}b=o<>16;a=536870911/(u|0)|0;d=a<<16;p=d>>16;b=536870912-((te(u,p)|0)+((te(b&65535,p)|0)>>16))<<3;a=d+((te(b>>16,p)|0)+((te(b&65528,p)|0)>>16))+(te(b,(a>>15)+1>>1)|0)|0;e=62-e-i|0;if((e|0)<1){r=0-e|0;e=-2147483648>>r;i=2147483647>>>r;if((e|0)>(i|0)){if((a|0)<=(e|0))e=(a|0)<(i|0)?i:a}else if((a|0)>(i|0))e=i;else e=(a|0)<(e|0)?e:a;b=e<>e:0;u=t>>1;d=(f|0)==1;p=((b|0)<0)<<31>>31;f=f+-1|0;c=0;while(1){if((c|0)>=(u|0))break;t=_+(c<<2)|0;a=s[t>>2]|0;h=_+(v-c+-1<<2)|0;o=s[h>>2]|0;e=Nn(o|0,((o|0)<0)<<31>>31|0,w|0,g|0)|0;e=Sn(e|0,I|0,30)|0;e=En(e|0,I|0,1,0)|0;e=Sn(e|0,I|0,1)|0;i=a-e|0;r=(i|0)>-1;if(d){if(r){r=(a&(e^-2147483648)|0)<0?-2147483648:i;r=Nn(r|0,((r|0)<0)<<31>>31|0,b|0,p|0)|0;r=An(r|0,I|0,1)|0;e=(a&(e^-2147483648)|0)<0?-2147483648:i;i=r;r=I}else{r=((a^-2147483648)&e|0)<0?2147483647:i;r=Nn(r|0,((r|0)<0)<<31>>31|0,b|0,p|0)|0;r=An(r|0,I|0,1)|0;e=((a^-2147483648)&e|0)<0?2147483647:i;i=r;r=I}e=Nn(e|0,((e|0)<0)<<31>>31|0,b|0,p|0)|0;e=En(i|0,r|0,e&1|0,0)|0;i=I}else{if(r)e=(a&(e^-2147483648)|0)<0?-2147483648:i;else e=((a^-2147483648)&e|0)<0?2147483647:i;e=Nn(e|0,((e|0)<0)<<31>>31|0,b|0,p|0)|0;e=An(e|0,I|0,f|0)|0;e=En(e|0,I|0,1,0)|0;e=An(e|0,I|0,1)|0;i=I}r=En(e|0,i|0,-2147483648,0)|0;i=I;if(i>>>0>0|(i|0)==0&r>>>0>4294967295){y=46;break e}s[t>>2]=e;e=Nn(a|0,((a|0)<0)<<31>>31|0,w|0,g|0)|0;e=Sn(e|0,I|0,30)|0;e=En(e|0,I|0,1,0)|0;e=Sn(e|0,I|0,1)|0;i=o-e|0;r=(i|0)>-1;if(d){if(r){r=(o&(e^-2147483648)|0)<0?-2147483648:i;r=Nn(r|0,((r|0)<0)<<31>>31|0,b|0,p|0)|0;r=An(r|0,I|0,1)|0;e=(o&(e^-2147483648)|0)<0?-2147483648:i;i=r;r=I}else{r=((o^-2147483648)&e|0)<0?2147483647:i;r=Nn(r|0,((r|0)<0)<<31>>31|0,b|0,p|0)|0;r=An(r|0,I|0,1)|0;e=((o^-2147483648)&e|0)<0?2147483647:i;i=r;r=I}e=Nn(e|0,((e|0)<0)<<31>>31|0,b|0,p|0)|0;e=En(i|0,r|0,e&1|0,0)|0;i=I}else{if(r)e=(o&(e^-2147483648)|0)<0?-2147483648:i;else e=((o^-2147483648)&e|0)<0?2147483647:i;e=Nn(e|0,((e|0)<0)<<31>>31|0,b|0,p|0)|0;e=An(e|0,I|0,f|0)|0;e=En(e|0,I|0,1,0)|0;e=An(e|0,I|0,1)|0;i=I}o=En(e|0,i|0,-2147483648,0)|0;a=I;if(a>>>0>0|(a|0)==0&o>>>0>4294967295){y=46;break e}s[h>>2]=e;c=c+1|0}a=m;r=((m|0)<0)<<31>>31;t=v}if((y|0)==44)if(i){l=k;return 0}else{_=0-(s[_>>2]<<7)|0;y=((_|0)<0)<<31>>31;Nn(_|0,y|0,_|0,y|0)|0;y=1073741824-I|0;y=Nn(a|0,r|0,y|0,((y|0)<0)<<31>>31|0)|0;y=Sn(y|0,I|0,30)|0;y=y&-4;l=k;return((y|0)<107374?0:y)|0}else if((y|0)==46){l=k;return 0}return 0}function xr(e,t,i){e=e|0;t=t|0;i=i|0;var r=0,o=0,f=0,h=0,c=0,u=0,d=0,p=0,b=0,m=0,w=0,g=0,v=0,_=0;g=l;l=l+304|0;d=g+200|0;b=g+148|0;m=g+96|0;w=g;r=(i|0)==16?32909:32925;o=0;while(1){if((o|0)>=(i|0))break;u=n[t+(o<<1)>>1]|0;p=u>>8;c=n[27508+(p<<1)>>1]|0;p=((c<<8)+(te((n[27508+(p+1<<1)>>1]|0)-c|0,u-(p<<8)|0)|0)>>3)+1>>1;s[d+(a[r+o>>0]<<2)>>2]=p;o=o+1|0}p=i>>1;s[b>>2]=65536;u=b+4|0;c=1;r=0-(s[d>>2]|0)|0;while(1){s[u>>2]=r;if((c|0)>=(p|0))break;t=s[d+(c<<1<<2)>>2]|0;h=s[b+(c+-1<<2)>>2]|0;o=((t|0)<0)<<31>>31;r=s[b+(c<<2)>>2]|0;r=Nn(t|0,o|0,r|0,((r|0)<0)<<31>>31|0)|0;r=Sn(r|0,I|0,15)|0;r=En(r|0,I|0,1,0)|0;r=Sn(r|0,I|0,1)|0;f=c+1|0;s[b+(f<<2)>>2]=(h<<1)-r;r=c;while(1){if((r|0)<=1)break;c=s[b+(r+-2<<2)>>2]|0;_=Nn(t|0,o|0,h|0,((h|0)<0)<<31>>31|0)|0;_=Sn(_|0,I|0,15)|0;_=En(_|0,I|0,1,0)|0;_=Sn(_|0,I|0,1)|0;v=b+(r<<2)|0;s[v>>2]=(s[v>>2]|0)+(c-_);h=c;r=r+-1|0}c=f;r=(s[u>>2]|0)-t|0}u=d+4|0;s[m>>2]=65536;d=m+4|0;c=1;r=0-(s[u>>2]|0)|0;while(1){s[d>>2]=r;if((c|0)>=(p|0)){r=0;break}f=s[u+(c<<1<<2)>>2]|0;o=s[m+(c+-1<<2)>>2]|0;h=((f|0)<0)<<31>>31;r=s[m+(c<<2)>>2]|0;r=Nn(f|0,h|0,r|0,((r|0)<0)<<31>>31|0)|0;r=Sn(r|0,I|0,15)|0;r=En(r|0,I|0,1,0)|0;r=Sn(r|0,I|0,1)|0;t=c+1|0;s[m+(t<<2)>>2]=(o<<1)-r;r=c;while(1){if((r|0)<=1)break;_=s[m+(r+-2<<2)>>2]|0;c=Nn(f|0,h|0,o|0,((o|0)<0)<<31>>31|0)|0;c=Sn(c|0,I|0,15)|0;c=En(c|0,I|0,1,0)|0;c=Sn(c|0,I|0,1)|0;v=m+(r<<2)|0;s[v>>2]=(s[v>>2]|0)+(_-c);o=_;r=r+-1|0}c=t;r=(s[d>>2]|0)-f|0}while(1){if((r|0)>=(p|0))break;_=r+1|0;v=(s[b+(_<<2)>>2]|0)+(s[b+(r<<2)>>2]|0)|0;d=(s[m+(_<<2)>>2]|0)-(s[m+(r<<2)>>2]|0)|0;s[w+(r<<2)>>2]=0-d-v;s[w+(i-r+-1<<2)>>2]=d-v;r=_}f=0;r=0;while(1){if((f|0)<10){t=0;o=0}else break;while(1){if((t|0)>=(i|0))break;_=s[w+(t<<2)>>2]|0;_=(_|0)>0?_:0-_|0;v=(_|0)>(o|0);r=v?t:r;t=t+1|0;o=v?_:o}t=(o>>4)+1>>1;if((t|0)<=32767)break;_=(t|0)<163838?t:163838;Mr(w,i,65470-(((_<<14)+-536854528|0)/((te(_,r+1|0)|0)>>2|0)|0)|0);f=f+1|0}e:do if((f|0)==10){r=0;while(1){if((r|0)>=(i|0)){r=0;break e}_=w+(r<<2)|0;v=(s[_>>2]>>4)+1>>1;v=(v|0)>32767?32767:(v|0)<-32768?-32768:v;n[e+(r<<1)>>1]=v;s[_>>2]=v<<16>>11;r=r+1|0}}else{r=0;while(1){if((r|0)>=(i|0)){r=0;break e}n[e+(r<<1)>>1]=(((s[w+(r<<2)>>2]|0)>>>4)+1|0)>>>1;r=r+1|0}}while(0);while(1){if(!((Rr(e,i)|0)==0&(r|0)<16))break;Mr(w,i,65536-(2<=(i|0))break;n[e+(t<<1)>>1]=(((s[w+(t<<2)>>2]|0)>>>4)+1|0)>>>1;t=t+1|0}r=r+1|0}l=g;return}function Cr(e,t,i){e=e|0;t=t|0;i=i|0;var r=0,s=0,a=0,f=0,h=0,c=0,l=0,u=0,d=0,p=0,b=0,m=0,w=0;b=e+(i+-1<<1)|0;m=t+(i<<1)|0;d=0;while(1){if((d|0)>=20)break;h=n[e>>1]|0;f=n[t>>1]|0;r=h;s=0;a=1;h=(h<<16>>16)-(f<<16>>16)|0;while(1){if((a|0)>=(i|0))break;c=n[e+(a<<1)>>1]|0;u=(c<<16>>16)-((r<<16>>16)+(n[t+(a<<1)>>1]|0))|0;l=(u|0)<(h|0);r=c;s=l?a:s;a=a+1|0;h=l?u:h}l=32768-((n[b>>1]|0)+(n[m>>1]|0))|0;c=(l|0)<(h|0);u=c?i:s;if(((c?l:h)|0)>-1){p=36;break}do if(!u)n[e>>1]=f;else{if((u|0)==(i|0)){n[b>>1]=32768-(o[m>>1]|0);break}else{r=0;f=0}while(1){if((r|0)>=(u|0))break;l=f+(n[t+(r<<1)>>1]|0)|0;r=r+1|0;f=l}c=t+(u<<1)|0;l=n[c>>1]|0;s=l>>1;r=i;a=32768;while(1){if((r|0)<=(u|0))break;h=a-(n[t+(r<<1)>>1]|0)|0;r=r+-1|0;a=h}r=f+s|0;a=a-s|0;h=e+(u+-1<<1)|0;w=n[h>>1]|0;f=e+(u<<1)|0;s=n[f>>1]|0;s=((w<<16>>16)+(s<<16>>16)>>1)+((w&65535)+(s&65535)&1)|0;if((r|0)>(a|0)){if((s|0)<=(r|0))r=(s|0)<(a|0)?a:s}else if((s|0)>(a|0))r=a;else r=(s|0)<(r|0)?r:s;w=r-(l>>>1)|0;n[h>>1]=w;n[f>>1]=w+(o[c>>1]|0)}while(0);d=d+1|0}if((p|0)==36)return;if((d|0)==20)a=1;else return;while(1){if((a|0)>=(i|0))break;r=n[e+(a<<1)>>1]|0;h=a;while(1){f=h+-1|0;if((h|0)<=0)break;s=n[e+(f<<1)>>1]|0;if(r<<16>>16>=s<<16>>16)break;n[e+(h<<1)>>1]=s;h=f}n[e+(h<<1)>>1]=r;a=a+1|0}s=n[e>>1]|0;r=n[t>>1]|0;r=s<<16>>16>r<<16>>16?s:r;n[e>>1]=r;r=r<<16>>16;s=1;while(1){if((s|0)>=(i|0))break;p=e+(s<<1)|0;d=n[p>>1]|0;w=r+(n[t+(s<<1)>>1]|0)|0;w=(w|0)>32767?32767:((w|0)<-32768?-32768:w)<<16>>16;w=(d|0)>(w|0)?d:w;n[p>>1]=w;r=w;s=s+1|0}r=n[b>>1]|0;s=32768-(n[m>>1]|0)|0;s=(r|0)<(s|0)?r:s;n[b>>1]=s;r=i+-2|0;while(1){if((r|0)<=-1)break;i=e+(r<<1)|0;m=n[i>>1]|0;w=(s<<16>>16)-(n[t+(r+1<<1)>>1]|0)|0;w=(m|0)<(w|0)?m:w;n[i>>1]=w;s=w;r=r+-1|0}return}function Ir(e,t,i){e=e|0;t=t|0;i=i|0;var r=0,s=0,a=0,o=0,f=0,h=0;r=n[t>>1]|0;s=(n[t+2>>1]|0)-(r<<16>>16)|0;s=131072/(((s|0)>1?s:1)|0)|0;r=(131072/((r<<16>>16>1?r:1)<<16>>16|0)|0)+s|0;n[e>>1]=(r|0)<32767?r:32767;i=i+-1|0;r=1;while(1){if((r|0)>=(i|0))break;f=r+1|0;a=t+(f<<1)|0;h=(n[a>>1]|0)-(n[t+(r<<1)>>1]|0)|0;h=131072/(((h|0)>1?h:1)|0)|0;o=h+s|0;n[e+(r<<1)>>1]=(o|0)<32767?o:32767;o=r+2|0;a=(n[t+(o<<1)>>1]|0)-(n[a>>1]|0)|0;a=131072/(((a|0)>1?a:1)|0)|0;h=h+a|0;n[e+(f<<1)>>1]=(h|0)<32767?h:32767;r=o;s=a}h=32768-(n[t+(i<<1)>>1]|0)|0;h=(131072/(((h|0)>1?h:1)|0)|0)+s|0;n[e+(i<<1)>>1]=(h|0)<32767?h:32767;return}function Pr(e,t,i,r){e=e|0;t=t|0;i=i|0;r=r|0;var a=0,o=0,f=0,h=0,c=0,l=0,u=0;r=r>>1;a=e+4|0;o=0;while(1){if((o|0)>=(r|0))break;u=o<<1;l=n[i+(u<<1)>>1]<<10;h=l-(s[e>>2]|0)|0;c=(te(h>>16,-25727)|0)+((te(h&65535,-25727)|0)>>16)|0;s[e>>2]=l+(h+c);u=n[i+((u|1)<<1)>>1]<<10;h=s[a>>2]|0;f=u-h|0;f=((f>>16)*9872|0)+(((f&65535)*9872|0)>>>16)|0;s[a>>2]=u+f;f=(l+c+h+f>>10)+1>>1;n[t+(o<<1)>>1]=(f|0)>32767?32767:((f|0)<-32768?-32768:f)&65535;o=o+1|0}return}function Or(e,t,i,r){e=e|0;t=t|0;i=i|0;r=r|0;var n=0,a=0,o=0,f=0,h=0,c=0;n=0;while(1){if((n|0)>=(r|0)){o=1;break}s[t+(n<<2)>>2]=n;n=n+1|0}while(1){if((o|0)>=(r|0))break;a=s[e+(o<<2)>>2]|0;h=o;while(1){f=h+-1|0;if((h|0)<=0)break;n=s[e+(f<<2)>>2]|0;if((a|0)>=(n|0))break;s[e+(h<<2)>>2]=n;s[t+(h<<2)>>2]=s[t+(f<<2)>>2];h=f}s[e+(h<<2)>>2]=a;s[t+(h<<2)>>2]=o;o=o+1|0}h=e+(r+-1<<2)|0;c=r+-2|0;o=r;while(1){if((o|0)>=(i|0))break;n=s[e+(o<<2)>>2]|0;if((n|0)<(s[h>>2]|0)){f=c;while(1){if((f|0)<=-1)break;a=s[e+(f<<2)>>2]|0;if((n|0)>=(a|0))break;r=f+1|0;s[e+(r<<2)>>2]=a;s[t+(r<<2)>>2]=s[t+(f<<2)>>2];f=f+-1|0}r=f+1|0;s[e+(r<<2)>>2]=n;s[t+(r<<2)>>2]=o}o=o+1|0}return}function Nr(e,t,i,r){e=e|0;t=t|0;i=i|0;r=r|0;var a=0,o=0,f=0,h=0,c=0,l=0,u=0;h=31-(re(r|0)|0)|0;c=r+-1|0;o=((c|0)>0?c:0)+1&-2;f=0;a=r;while(1){if((f|0)>=(c|0))break;u=n[i+(f<<1)>>1]|0;u=te(u,u)|0;l=n[i+((f|1)<<1)>>1]|0;f=f+2|0;a=a+((u+(te(l,l)|0)|0)>>>h)|0}if((o|0)<(r|0)){u=n[i+(o<<1)>>1]|0;a=a+((te(u,u)|0)>>>h)|0}a=h+3-(re(a|0)|0)|0;a=(a|0)<0?0:a;o=r+-1|0;o=((o|0)>0?o:0)+1&-2;f=0;h=0;while(1){if((f|0)>=(c|0))break;l=n[i+(f<<1)>>1]|0;l=te(l,l)|0;u=n[i+((f|1)<<1)>>1]|0;f=f+2|0;h=h+((l+(te(u,u)|0)|0)>>>a)|0}if((o|0)>=(r|0)){u=h;s[t>>2]=a;s[e>>2]=u;return}u=n[i+(o<<1)>>1]|0;u=h+((te(u,u)|0)>>>a)|0;s[t>>2]=a;s[e>>2]=u;return}function Dr(e,t,i,r,n,s){e=e|0;t=t|0;i=+i;r=r|0;n=n|0;s=s|0;var a=0,o=0,f=0,u=0,d=0,p=0,b=0,m=0,w=0,g=0,v=0,_=0,y=0,k=0,E=0,A=0,S=0,M=0,T=0,R=0,x=0,C=0,I=0,P=0,O=0,N=0;C=l;l=l+976|0;A=C+784|0;S=C+592|0;R=C+392|0;E=C+192|0;x=C;a=+tr(t,te(n,r)|0);kn(A|0,0,192)|0;u=0;while(1){if((u|0)>=(n|0))break;o=t+((te(u,r)|0)<<2)|0;f=1;while(1){if((f|0)>(s|0))break;T=+ir(o,o+(f<<2)|0,r-f|0);k=A+(f+-1<<3)|0;c[k>>3]=+c[k>>3]+T;f=f+1|0}u=u+1|0}Mn(S|0,A|0,192)|0;T=a*9999999747378752e-21;_=a+T+9.999999717180685e-10;c[R>>3]=_;c[E>>3]=_;_=i;y=1;f=0;k=2;v=1;while(1){if((f|0)>=(s|0))break;u=r-f|0;p=u+-1|0;w=0;while(1){if((w|0)>=(n|0))break;m=t+((te(w,r)|0)<<2)|0;i=+h[m+(f<<2)>>2];d=+h[m+(p<<2)>>2];o=0;b=i;g=d;while(1){if((f|0)==(o|0)){o=0;break}O=+h[m+(f-o+-1<<2)>>2];N=A+(o<<3)|0;c[N>>3]=+c[N>>3]-i*O;P=+h[m+(u+o<<2)>>2];N=S+(o<<3)|0;c[N>>3]=+c[N>>3]-d*P;I=+c[x+(o<<3)>>3];o=o+1|0;b=b+O*I;g=g+P*I}while(1){if((o|0)==(y|0))break;N=R+(o<<3)|0;c[N>>3]=+c[N>>3]-b*+h[m+(f-o<<2)>>2];N=E+(o<<3)|0;c[N>>3]=+c[N>>3]-g*+h[m+(u+o+-1<<2)>>2];o=o+1|0}w=w+1|0}o=0;i=+c[A+(f<<3)>>3];b=+c[S+(f<<3)>>3];while(1){if((f|0)==(o|0))break;O=+c[x+(o<<3)>>3];N=f-o+-1|0;o=o+1|0;i=i+ +c[S+(N<<3)>>3]*O;b=b+ +c[A+(N<<3)>>3]*O}m=f+1|0;c[R+(m<<3)>>3]=i;c[E+(m<<3)>>3]=b;o=0;i=+c[E>>3];d=+c[R>>3];while(1){if((f|0)==(o|0))break;P=+c[x+(o<<3)>>3];N=o+1|0;O=b+ +c[E+(f-o<<3)>>3]*P;o=N;i=i+ +c[E+(N<<3)>>3]*P;d=d+ +c[R+(N<<3)>>3]*P;b=O}d=b*-2/(d+i);i=v*(1-d*d);if(!(i<=_))o=0;else{d=+H(+(1-_/v));i=_;d=b>0?-d:d;o=1}u=m>>1;p=0;while(1){if((p|0)>=(u|0))break;w=x+(p<<3)|0;O=+c[w>>3];N=x+(f-p+-1<<3)|0;P=+c[N>>3];c[w>>3]=O+d*P;c[N>>3]=P+d*O;p=p+1|0}c[x+(f<<3)>>3]=d;if(!o)o=0;else{M=29;break}while(1){if((o|0)==(k|0))break;w=R+(o<<3)|0;O=+c[w>>3];N=E+(f-o+1<<3)|0;P=+c[N>>3];c[w>>3]=O+d*P;c[N>>3]=P+d*O;o=o+1|0}y=y+1|0;f=m;k=k+1|0;v=i}if((M|0)==29){while(1){f=f+1|0;if((f|0)>=(s|0))break;c[x+(f<<3)>>3]=0;M=29}if(o|0){o=0;while(1){if((o|0)>=(s|0)){o=0;break}h[e+(o<<2)>>2]=-+c[x+(o<<3)>>3];o=o+1|0}while(1){if((o|0)>=(n|0))break;a=a-+tr(t+((te(o,r)|0)<<2)|0,s);o=o+1|0}O=a*i;l=C;return+O}}o=0;a=+c[R>>3];i=1;while(1){if((o|0)>=(s|0))break;O=+c[x+(o<<3)>>3];N=o+1|0;P=+c[R+(N<<3)>>3];h[e+(o<<2)>>2]=-O;o=N;a=a+P*O;i=i+O*O}O=a-T*i;l=C;return+O}function Lr(e,t,i,r){e=e|0;t=t|0;i=i|0;r=r|0;var a=0,o=0,f=0,h=0,c=0,u=0,d=0,p=0,b=0,m=0,w=0,g=0,v=0,_=0,y=0,k=0,E=0,A=0,S=0,M=0,T=0,R=0,x=0,C=0,I=0,P=0,O=0,N=0;N=l;l=l+32|0;O=N;p=e+2772|0;a=e+2316|0;f=e+4156|0;if((s[a>>2]|0)!=(s[f>>2]|0)){h=e+2340|0;o=s[h>>2]|0;c=32767/(o+1|0)|0;u=0;d=0;while(1){if((d|0)>=(o|0))break;P=u+c|0;n[e+4052+(d<<1)>>1]=P;o=s[h>>2]|0;u=P;d=d+1|0}s[e+4148>>2]=0;s[e+4152>>2]=3176576;s[f>>2]=s[a>>2]}u=e+4160|0;do if(!(s[u>>2]|0)){if(!(s[e+4164>>2]|0)){a=e+2340|0;o=0;while(1){if((o|0)>=(s[a>>2]|0))break;C=n[e+2344+(o<<1)>>1]|0;P=e+4052+(o<<1)|0;x=n[P>>1]|0;I=x&65535;n[P>>1]=I+((((C<<16>>16)-(x<<16>>16)>>16)*16348|0)+((((C&65535)-I&65535)*16348|0)>>>16));o=o+1|0}c=e+2324|0;a=s[c>>2]|0;o=0;f=0;h=0;while(1){if((o|0)>=(a|0))break;I=s[t+16+(o<<2)>>2]|0;C=(I|0)>(f|0);P=C?o:h;o=o+1|0;f=C?I:f;h=P}f=e+2332|0;o=s[f>>2]|0;Tn(e+2772+(o<<2)|0,p|0,(te(a+-1|0,o)|0)<<2|0)|0;f=s[f>>2]|0;Mn(p|0,e+4+((te(h,f)|0)<<2)|0,f<<2|0)|0;f=e+4148|0;a=s[c>>2]|0;o=0;while(1){if((o|0)>=(a|0))break;I=s[f>>2]|0;P=(s[t+16+(o<<2)>>2]|0)-I|0;s[f>>2]=I+(((P>>16)*4634|0)+(((P&65535)*4634|0)>>>16));o=o+1|0}if(s[u>>2]|0)break}kn(e+4084|0,0,s[e+2340>>2]<<2|0)|0;l=N;return}while(0);I=Ne()|0;P=l;l=l+((1*(r+16<<2)|0)+15&-16)|0;C=n[e+4224>>1]|0;a=C<<16>>16;o=s[e+4244>>2]|0;h=o<<16>>16;o=(te(a>>16,h)|0)+((te(C&65535,h)|0)>>16)+(te(a,(o>>15)+1>>1)|0)|0;a=s[e+4148>>2]|0;h=o>>16;if((o|0)>2097151|(a|0)>8388608){f=a>>16;f=te(f,f)|0;o=(te(h,h)|0)<<5;a=f-o|0;if((a|0)<1)u=0;else{h=re(a|0)|0;h=(f|0)==(o|0)?32:h;o=24-h|0;f=0-o|0;do if(o)if((o|0)<0){a=a<>>(o+32|0);break}else{a=a<<32-o|a>>>o;break}while(0);C=((h&1|0)==0?46214:32768)>>>(h>>>1);u=(te(a&127,13959168)|0)>>>16;u=C+((te(C>>16,u)|0)+((te(C&65535,u)|0)>>>16))<<16}}else{C=o<<16>>16;f=a<<16>>16;f=(te(a>>16,f)|0)+((te(a&65535,f)|0)>>16)+(te(a,(a>>15)+1>>1)|0)|0;o=(te(h,C)|0)+((te(o&65535,C)|0)>>16)+(te(o,(o>>15)+1>>1)|0)<<5;a=f-o|0;if((a|0)<1)u=0;else{h=re(a|0)|0;h=(f|0)==(o|0)?32:h;o=24-h|0;f=0-o|0;do if(o)if((o|0)<0){a=a<>>(o+32|0);break}else{a=a<<32-o|a>>>o;break}while(0);C=((h&1|0)==0?46214:32768)>>>(h>>>1);u=(te(a&127,13959168)|0)>>>16;u=C+((te(C>>16,u)|0)+((te(C&65535,u)|0)>>>16))<<8}}a=P+64|0;f=255;while(1){if((f|0)<=(r|0))break;f=f>>1}o=e+4152|0;h=0;c=s[o>>2]|0;while(1){if((h|0)>=(r|0))break;C=(te(c,196314165)|0)+907633515|0;s[a+(h<<2)>>2]=s[e+2772+((C>>24&f)<<2)>>2];h=h+1|0;c=C}s[o>>2]=c;C=e+2340|0;xr(O,e+4052|0,s[C>>2]|0);x=e+4084|0;a=P;o=x;f=a+64|0;do{s[a>>2]=s[o>>2];a=a+4|0;o=o+4|0}while((a|0)<(f|0));e=n[O>>1]|0;b=n[O+2>>1]|0;m=n[O+4>>1]|0;w=n[O+6>>1]|0;g=n[O+8>>1]|0;v=n[O+10>>1]|0;_=n[O+12>>1]|0;y=n[O+14>>1]|0;k=n[O+16>>1]|0;E=n[O+18>>1]|0;A=n[O+20>>1]|0;S=n[O+22>>1]|0;M=n[O+24>>1]|0;T=n[O+26>>1]|0;R=n[O+28>>1]|0;p=n[O+30>>1]|0;t=u<<10>>16;u=(u>>21)+1>>1;d=0;while(1){if((d|0)>=(r|0))break;O=s[P+(d+15<<2)>>2]|0;O=(s[C>>2]>>1)+((te(O>>16,e)|0)+((te(O&65535,e)|0)>>16))|0;a=s[P+(d+14<<2)>>2]|0;a=O+((te(a>>16,b)|0)+((te(a&65535,b)|0)>>16))|0;O=s[P+(d+13<<2)>>2]|0;O=a+((te(O>>16,m)|0)+((te(O&65535,m)|0)>>16))|0;a=s[P+(d+12<<2)>>2]|0;a=O+((te(a>>16,w)|0)+((te(a&65535,w)|0)>>16))|0;O=s[P+(d+11<<2)>>2]|0;O=a+((te(O>>16,g)|0)+((te(O&65535,g)|0)>>16))|0;a=s[P+(d+10<<2)>>2]|0;a=O+((te(a>>16,v)|0)+((te(a&65535,v)|0)>>16))|0;O=s[P+(d+9<<2)>>2]|0;O=a+((te(O>>16,_)|0)+((te(O&65535,_)|0)>>16))|0;a=s[P+(d+8<<2)>>2]|0;a=O+((te(a>>16,y)|0)+((te(a&65535,y)|0)>>16))|0;O=s[P+(d+7<<2)>>2]|0;O=a+((te(O>>16,k)|0)+((te(O&65535,k)|0)>>16))|0;a=s[P+(d+6<<2)>>2]|0;a=O+((te(a>>16,E)|0)+((te(a&65535,E)|0)>>16))|0;if((s[C>>2]|0)==16){O=s[P+(d+5<<2)>>2]|0;O=a+((te(O>>16,A)|0)+((te(O&65535,A)|0)>>16))|0;a=s[P+(d+4<<2)>>2]|0;a=O+((te(a>>16,S)|0)+((te(a&65535,S)|0)>>16))|0;O=s[P+(d+3<<2)>>2]|0;O=a+((te(O>>16,M)|0)+((te(O&65535,M)|0)>>16))|0;a=s[P+(d+2<<2)>>2]|0;a=O+((te(a>>16,T)|0)+((te(a&65535,T)|0)>>16))|0;O=s[P+(d+1<<2)>>2]|0;O=a+((te(O>>16,R)|0)+((te(O&65535,R)|0)>>16))|0;a=s[P+(d<<2)>>2]|0;a=O+((te(a>>16,p)|0)+((te(a&65535,p)|0)>>16))|0}c=P+(d+16<<2)|0;o=s[c>>2]|0;f=(a|0)>134217727;h=f?2147483632:((a|0)<-134217728?-134217728:a)<<4;if((o+(f?2147483632:((a|0)<-134217728?-134217728:a)<<4)|0)>-1)if((o&h|0)<0)a=-2147483648;else a=o+(f?2147483632:((a|0)<-134217728?-134217728:a)<<4)|0;else if((o|h|0)>-1)a=2147483647;else a=o+(f?2147483632:((a|0)<-134217728?-134217728:a)<<4)|0;s[c>>2]=a;h=i+(d<<1)|0;f=n[h>>1]|0;a=((te(a>>16,t)|0)+((te(a&65535,t)|0)>>16)+(te(a,u)|0)>>7)+1>>1;o=(a|0)>32767;if((f+(o?32767:(a|0)<-32768?-32768:a)|0)<=32767)if((f+(o?32767:(a|0)<-32768?-32768:a)|0)<-32768)a=-32768;else a=f+(o?32767:(a|0)<-32768?-32768:a)|0;else a=32767;n[h>>1]=a;d=d+1|0}a=x;o=P+(r<<2)|0;f=a+64|0;do{s[a>>2]=s[o>>2];a=a+4|0;o=o+4|0}while((a|0)<(f|0));qe(I|0);l=N;return}function Br(e,t,i,a){e=e|0;t=t|0;i=i|0;a=a|0;var o=0,f=0,h=0,c=0,u=0,d=0,p=0,b=0,m=0,w=0,g=0,v=0,_=0,y=0,k=0,E=0,A=0,S=0,M=0,T=0,R=0,x=0,C=0,P=0,O=0,N=0,D=0,L=0,B=0,U=0,j=0,F=0,z=0,q=0,H=0,G=0,V=0,W=0,K=0,Z=0,Y=0,$=0,X=0,J=0,Q=0,ee=0,ie=0,ne=0,se=0;ne=l;l=l+32|0;ie=ne;Z=e+2336|0;Q=s[Z>>2]|0;X=l;l=l+((1*(Q<<1)|0)+15&-16)|0;p=e+2328|0;f=s[p>>2]|0;J=l;l=l+((1*(Q+f<<2)|0)+15&-16)|0;Q=e+2332|0;d=s[Q>>2]|0;ee=l;l=l+((1*(d<<2)|0)+15&-16)|0;Y=l;l=l+((1*(d+16<<2)|0)+15&-16)|0;d=n[e+2766>>1]|0;$=e+2765|0;m=(d&65535)>>>8&255;d=n[25404+(r[$>>0]>>1<<2)+((d&65535)<<24>>24<<1)>>1]<<4;b=0;o=r[e+2770>>0]|0;while(1){if((b|0)>=(f|0))break;c=(te(o,196314165)|0)+907633515|0;u=a+(b<<1)|0;f=n[u>>1]|0;o=f<<16>>16<<14;h=e+4+(b<<2)|0;s[h>>2]=o;if(f<<16>>16<=0){if(f<<16>>16<0){o=o|1280;s[h>>2]=o}}else{o=o+-1280|0;s[h>>2]=o}f=o+d|0;s[h>>2]=(c|0)<0?0-f|0:f;f=s[p>>2]|0;b=b+1|0;o=c+(n[u>>1]|0)|0}q=e+1284|0;o=Y;f=q;h=o+64|0;do{s[o>>2]=s[f>>2];o=o+4|0;f=f+4|0}while((o|0)<(h|0));H=e+2324|0;G=e+2340|0;V=e+4160|0;W=t+136|0;_=m<<24>>24>3;y=ie+2|0;k=ie+4|0;E=ie+6|0;A=ie+8|0;S=ie+10|0;M=ie+12|0;T=ie+14|0;R=ie+16|0;x=ie+18|0;C=ie+20|0;P=ie+22|0;O=ie+24|0;N=ie+26|0;D=ie+28|0;L=ie+30|0;B=e+4164|0;U=e+2308|0;j=0;F=e+4|0;z=i;a=s[Z>>2]|0;while(1){if((j|0)>=(s[H>>2]|0))break;p=t+32+(j>>1<<5)|0;Mn(ie|0,p|0,s[G>>2]<<1|0)|0;w=t+96+(j*5<<1)|0;d=r[$>>0]|0;v=s[t+16+(j<<2)>>2]|0;g=v>>>6;u=(v|0)>0;if(!u)if(!v)o=32;else{o=0-v|0;K=12}else{o=v;K=12}if((K|0)==12){K=0;o=re(o|0)|0}f=v<>16;c=536870911/(h|0)|0;b=c<<16;m=b>>16;f=536870912-((te(h,m)|0)+((te(f&65535,m)|0)>>16))<<3;c=b+((te(f>>16,m)|0)+((te(f&65528,m)|0)>>16))+(te(f,(c>>15)+1>>1)|0)|0;o=62-o|0;f=o+-47|0;if((f|0)<1){h=47-o|0;o=-2147483648>>h;f=2147483647>>>h;if((o|0)>(f|0)){if((c|0)<=(o|0))o=(c|0)<(f|0)?f:c}else if((c|0)>(f|0))o=f;else o=(c|0)<(o|0)?o:c;o=o<>f:0;h=s[e>>2]|0;e:do if((v|0)==(h|0))u=65536;else{if((h|0)<=0)if(!h)c=32;else{f=0-h|0;K=24}else{f=h;K=24}if((K|0)==24){K=0;c=re(f|0)|0}h=h<>16|0)|0)<<16>>16;m=(te(h>>16,u)|0)+((te(h&65535,u)|0)>>16)|0;b=Nn(b|0,((b|0)<0)<<31>>31|0,m|0,((m|0)<0)<<31>>31|0)|0;b=Sn(b|0,I|0,29)|0;h=h-(b&-8)|0;u=m+((te(h>>16,u)|0)+((te(h&65535,u)|0)>>16))|0;f=c+28-f|0;h=f+-16|0;if((f|0)<16){c=16-f|0;f=-2147483648>>c;h=2147483647>>>c;if((f|0)>(h|0)){if((u|0)<=(f|0))f=(u|0)<(h|0)?h:u}else if((u|0)>(h|0))f=h;else f=(u|0)<(f|0)?f:u;f=f<>h:0;h=f>>16;c=f&65535;u=0;while(1){if((u|0)==16){u=f;break e}m=Y+(u<<2)|0;b=s[m>>2]|0;se=b<<16>>16;s[m>>2]=(te(h,se)|0)+((te(c,se)|0)>>16)+(te(f,(b>>15)+1>>1)|0);u=u+1|0}}while(0);s[e>>2]=v;if((s[V>>2]|0)!=0?d<<24>>24!=2&(s[B>>2]|0)==2&(j|0)<2:0){n[w>>1]=0;n[w+2>>1]=0;n[w+4>>1]=0;n[w+6>>1]=0;n[w+8>>1]=0;n[w+4>>1]=4096;m=s[U>>2]|0;s[t+(j<<2)>>2]=m;K=44}else if(d<<24>>24==2){m=s[t+(j<<2)>>2]|0;K=44}else b=F;e:do if((K|0)==44){K=0;d=(j|0)==0;t:do if(!d){if(!((j|0)!=2|_)){h=s[Z>>2]|0;c=s[G>>2]|0;f=h-m-c+-2|0;if((j|0)!=2){K=49;break}Mn(e+1348+(h<<1)|0,i|0,s[Q>>2]<<2|0)|0;h=s[Z>>2]|0;c=s[G>>2]|0;K=49;break}if((u|0)!=65536){o=m+2|0;f=u>>16;h=u&65535;c=0;while(1){if((c|0)>=(o|0))break t;se=J+(a-c+-1<<2)|0;b=s[se>>2]|0;p=b<<16>>16;s[se>>2]=(te(f,p)|0)+((te(h,p)|0)>>16)+(te(u,(b>>15)+1>>1)|0);c=c+1|0}}}else{h=s[Z>>2]|0;c=s[G>>2]|0;f=h-m-c+-2|0;K=49}while(0);t:do if((K|0)==49){K=0;Tr(X+(f<<1)|0,e+1348+(f+(te(j,s[Q>>2]|0)|0)<<1)|0,p,h-f|0,c);if(d){se=s[W>>2]<<16>>16;o=(te(o>>16,se)|0)+((te(o&65535,se)|0)>>16)<<2}h=m+2|0;c=o>>16;o=o&65535;f=0;while(1){if((f|0)>=(h|0))break t;se=n[X+((s[Z>>2]|0)-f+-1<<1)>>1]|0;s[J+(a-f+-1<<2)>>2]=(te(c,se)|0)+((te(o,se)|0)>>16);f=f+1|0}}while(0);c=w+2|0;u=w+4|0;d=w+6|0;p=w+8|0;h=s[Q>>2]|0;b=0;o=J+(a-m+2<<2)|0;f=a;while(1){if((b|0)>=(h|0)){b=ee;a=f;break e}m=s[o>>2]|0;se=n[w>>1]|0;se=(te(m>>16,se)|0)+((te(m&65535,se)|0)>>16)+2|0;m=s[o+-4>>2]|0;a=n[c>>1]|0;a=se+((te(m>>16,a)|0)+((te(m&65535,a)|0)>>16))|0;m=s[o+-8>>2]|0;se=n[u>>1]|0;se=a+((te(m>>16,se)|0)+((te(m&65535,se)|0)>>16))|0;m=s[o+-12>>2]|0;a=n[d>>1]|0;a=se+((te(m>>16,a)|0)+((te(m&65535,a)|0)>>16))|0;m=s[o+-16>>2]|0;se=n[p>>1]|0;se=a+((te(m>>16,se)|0)+((te(m&65535,se)|0)>>16))|0;se=(s[F+(b<<2)>>2]|0)+(se<<1)|0;s[ee+(b<<2)>>2]=se;s[J+(f<<2)>>2]=se<<1;b=b+1|0;o=o+4|0;f=f+1|0}}while(0);p=g<<16>>16;u=(v>>21)+1>>1;d=0;while(1){c=s[Q>>2]|0;if((d|0)>=(c|0))break;se=s[Y+(d+15<<2)>>2]|0;v=n[ie>>1]|0;v=(s[G>>2]>>1)+((te(se>>16,v)|0)+((te(se&65535,v)|0)>>16))|0;se=s[Y+(d+14<<2)>>2]|0;o=n[y>>1]|0;o=v+((te(se>>16,o)|0)+((te(se&65535,o)|0)>>16))|0;se=s[Y+(d+13<<2)>>2]|0;v=n[k>>1]|0;v=o+((te(se>>16,v)|0)+((te(se&65535,v)|0)>>16))|0;se=s[Y+(d+12<<2)>>2]|0;o=n[E>>1]|0;o=v+((te(se>>16,o)|0)+((te(se&65535,o)|0)>>16))|0;se=s[Y+(d+11<<2)>>2]|0;v=n[A>>1]|0;v=o+((te(se>>16,v)|0)+((te(se&65535,v)|0)>>16))|0;se=s[Y+(d+10<<2)>>2]|0;o=n[S>>1]|0;o=v+((te(se>>16,o)|0)+((te(se&65535,o)|0)>>16))|0;se=s[Y+(d+9<<2)>>2]|0;v=n[M>>1]|0;v=o+((te(se>>16,v)|0)+((te(se&65535,v)|0)>>16))|0;se=s[Y+(d+8<<2)>>2]|0;o=n[T>>1]|0;o=v+((te(se>>16,o)|0)+((te(se&65535,o)|0)>>16))|0;se=s[Y+(d+7<<2)>>2]|0;v=n[R>>1]|0;v=o+((te(se>>16,v)|0)+((te(se&65535,v)|0)>>16))|0;se=s[Y+(d+6<<2)>>2]|0;o=n[x>>1]|0;o=v+((te(se>>16,o)|0)+((te(se&65535,o)|0)>>16))|0;if((s[G>>2]|0)==16){se=s[Y+(d+5<<2)>>2]|0;v=n[C>>1]|0;v=o+((te(se>>16,v)|0)+((te(se&65535,v)|0)>>16))|0;se=s[Y+(d+4<<2)>>2]|0;o=n[P>>1]|0;o=v+((te(se>>16,o)|0)+((te(se&65535,o)|0)>>16))|0;se=s[Y+(d+3<<2)>>2]|0;v=n[O>>1]|0;v=o+((te(se>>16,v)|0)+((te(se&65535,v)|0)>>16))|0;se=s[Y+(d+2<<2)>>2]|0;o=n[N>>1]|0;o=v+((te(se>>16,o)|0)+((te(se&65535,o)|0)>>16))|0;se=s[Y+(d+1<<2)>>2]|0;v=n[D>>1]|0;v=o+((te(se>>16,v)|0)+((te(se&65535,v)|0)>>16))|0;se=s[Y+(d<<2)>>2]|0;o=n[L>>1]|0;o=v+((te(se>>16,o)|0)+((te(se&65535,o)|0)>>16))|0}f=s[b+(d<<2)>>2]|0;h=(o|0)>134217727;c=h?2147483632:((o|0)<-134217728?-134217728:o)<<4;if((f+(h?2147483632:((o|0)<-134217728?-134217728:o)<<4)|0)>-1)if((f&c|0)<0)o=-2147483648;else o=f+(h?2147483632:((o|0)<-134217728?-134217728:o)<<4)|0;else if((f|c|0)>-1)o=2147483647;else o=f+(h?2147483632:((o|0)<-134217728?-134217728:o)<<4)|0;s[Y+(d+16<<2)>>2]=o;se=((te(o>>16,p)|0)+((te(o&65535,p)|0)>>16)+(te(o,u)|0)>>7)+1>>1;n[z+(d<<1)>>1]=(se|0)>32767?32767:((se|0)<-32768?-32768:se)&65535;d=d+1|0}o=Y;f=Y+(c<<2)|0;h=o+64|0;do{s[o>>2]=s[f>>2];o=o+4|0;f=f+4|0}while((o|0)<(h|0));j=j+1|0;F=F+(c<<2)|0;z=z+(c<<1)|0}o=q;f=Y;h=o+64|0;do{s[o>>2]=s[f>>2];o=o+4|0;f=f+4|0}while((o|0)<(h|0));l=ne;return}function Ur(e,t,i,f,h,c,u){e=e|0;t=t|0;i=i|0;f=f|0;h=h|0;c=c|0;u=u|0;var d=0,p=0,b=0,m=0,w=0,g=0,v=0,_=0,y=0,k=0,E=0,A=0,S=0,M=0,T=0,R=0,x=0,C=0,P=0,O=0,N=0,D=0,L=0,B=0,U=0,j=0,F=0,z=0,q=0,H=0,G=0,V=0,W=0,K=0,Z=0,Y=0,$=0,X=0,J=0,Q=0,ee=0,ie=0,ne=0,se=0,ae=0,oe=0,fe=0;se=l;l=l+448|0;X=se+232|0;$=se+376|0;ie=se+344|0;G=se+200|0;W=se+184|0;V=se+168|0;J=se+88|0;Q=se+8|0;Z=se;ne=se+312|0;K=se+280|0;ee=se+360|0;Y=se+248|0;q=i+2|0;Cr(t,s[i+36>>2]|0,n[q>>1]|0);d=s[i>>2]|0;k=l;l=l+((1*((d&65535)<<2)|0)+15&-16)|0;H=i+8|0;z=i+12|0;y=d<<16>>16;d=d>>16;p=s[H>>2]|0;b=0;_=s[z>>2]|0;while(1){if((b|0)<(y|0)){w=d;g=0;v=0}else break;while(1){m=w+-2|0;if((m|0)<=-1)break;U=w+-1|0;U=te((o[t+(U<<1)>>1]|0)-(a[p+U>>0]<<7)<<16>>16,n[_+(U<<1)>>1]|0)|0;B=g>>1;F=te((o[t+(m<<1)>>1]|0)-(a[p+m>>0]<<7)<<16>>16,n[_+(m<<1)>>1]|0)|0;j=U>>1;w=m;g=F;v=v+((U|0)>(B|0)?U-B|0:B-U|0)+((F|0)>(j|0)?F-j|0:j-F|0)|0}s[k+(b<<2)>>2]=v;p=p+d|0;b=b+1|0;_=_+(d<<1)|0}F=l;l=l+((1*(c<<2)|0)+15&-16)|0;Or(k,F,y,c);D=l;l=l+((1*(c<<2)|0)+15&-16)|0;L=l;l=l+((1*(c<<4)|0)+15&-16)|0;B=i+32|0;U=i+4|0;j=h<<16>>16;O=u>>1;N=i+16|0;C=h<<14>>16;P=0;while(1){if((P|0)>=(c|0))break;x=s[F+(P<<2)>>2]|0;w=n[q>>1]|0;v=te(x,w)|0;g=(s[H>>2]|0)+v|0;v=(s[z>>2]|0)+(v<<1)|0;_=0;while(1){if((_|0)>=(w|0))break;R=n[v+(_<<1)>>1]|0;n[ne+(_<<1)>>1]=(te((o[t+(_<<1)>>1]|0)-(a[g+_>>0]<<7)<<16>>16,R)|0)>>>14;p=n[f+(_<<1)>>1]|0;M=p<<16>>16;R=te(R,R)|0;p=re((p<<16>>16>0?M:0-M|0)|0)|0;M=M<>16|0)|0)<<16>>16;T=(te(M>>16,m)|0)+((te(M&65535,m)|0)>>16)|0;R=Nn(R|0,((R|0)<0)<<31>>31|0,T|0,((T|0)<0)<<31>>31|0)|0;R=Sn(R|0,I|0,29)|0;R=M-(R&-8)|0;m=T+((te(R>>16,m)|0)+((te(R&65535,m)|0)>>16))|0;d=p+28-d|0;p=d+-21|0;if((d|0)<21){b=21-d|0;d=-2147483648>>b;p=2147483647>>>b;if((d|0)>(p|0)){if((m|0)<=(d|0))d=(m|0)<(p|0)?p:m}else if((m|0)>(p|0))d=p;else d=(m|0)<(d|0)?d:m;d=d<>p:0;n[K+(_<<1)>>1]=d;_=_+1|0}Bi(Y,ee,i,x);R=P<<4;T=s[B>>2]|0;g=s[U>>2]|0;b=g<<16>>16;m=n[q>>1]|0;w=-10;while(1){if((w|0)==10)break;d=w<<10;p=d+1024|0;e:do if((w|0)>0){d=(w<<26>>16)+-102|0;p=(p<<16>>16)+-102|0}else{switch(w|0){case 0:{p=(p<<16>>16)+-102|0;break e}case-1:{d=-1024;break}default:p=p|102}d=d|102}while(0);M=w+10|0;s[J+(M<<2)>>2]=(te(d<<16>>16,b)|0)>>16;s[Q+(M<<2)>>2]=(te(p<<16>>16,b)|0)>>16;w=w+1|0}s[G>>2]=0;n[ie>>1]=0;M=m<<16>>16;A=g>>16;d=M;E=1;e:while(1){S=E<<1;u=(S|0)<5;t:while(1){h=d+-1|0;if((d|0)<=0){g=2147483647;m=0;d=0;break e}p=T+(n[Y+(h<<1)>>1]|0)|0;b=n[ne+(h<<1)>>1]|0;m=ee+h|0;w=K+(h<<1)|0;y=0;while(1){if((y|0)>=(E|0))break;_=ie+(y<<1)|0;v=(te(a[m>>0]|0,n[_>>1]|0)|0)>>8;d=(te(A,b-v<<16>>16)|0)>>16;d=(d|0)>9?9:(d|0)<-10?-10:d;r[$+(y<<4)+h>>0]=d;k=d+10|0;g=(s[J+(k<<2)>>2]|0)+v|0;v=(s[Q+(k<<2)>>2]|0)+v|0;n[_>>1]=g;_=y+E|0;n[ie+(_<<1)>>1]=v;do if((d|0)>2)if((d|0)==3){k=a[p+7>>0]|0;d=280;break}else{d=d*43|0;k=d+108|0;d=d+151|0;break}else{if((d|0)>=-3){k=a[p+(d+4)>>0]|0;d=a[p+(d+5)>>0]|0;break}if((d|0)==-4){k=280;d=a[p+1>>0]|0;break}else{d=te(d,-43)|0;k=d+108|0;d=d+65|0;break}}while(0);oe=G+(y<<2)|0;ae=s[oe>>2]|0;fe=b-g<<16>>16;fe=te(fe,fe)|0;g=n[w>>1]|0;s[oe>>2]=ae+(te(fe,g)|0)+(te(j,k<<16>>16)|0);k=b-v<<16>>16;s[G+(_<<2)>>2]=ae+(te(te(k,k)|0,g)|0)+(te(j,d<<16>>16)|0);y=y+1|0}if(u){d=0;break}else v=0;while(1){if((v|0)==4){d=0;w=0;p=0;b=0;m=2147483647;break}b=G+(v<<2)|0;d=s[b>>2]|0;p=v+4|0;m=G+(p<<2)|0;g=s[m>>2]|0;w=V+(v<<2)|0;if((d|0)>(g|0)){s[w>>2]=d;s[b>>2]=g;s[m>>2]=d;oe=ie+(v<<1)|0;fe=n[oe>>1]|0;d=ie+(p<<1)|0;n[oe>>1]=n[d>>1]|0;n[d>>1]=fe;d=g}else{s[w>>2]=g;p=v}s[W+(v<<2)>>2]=d;s[X+(v<<2)>>2]=p;v=v+1|0}while(1){if((p|0)<4){fe=s[V+(p<<2)>>2]|0;oe=(m|0)>(fe|0);ae=s[W+(p<<2)>>2]|0;k=(b|0)<(ae|0);d=k?p:d;w=oe?p:w;p=p+1|0;b=k?ae:b;m=oe?fe:m;continue}if((m|0)>=(b|0)){d=0;break}s[X+(d<<2)>>2]=s[X+(w<<2)>>2]^4;b=w+4|0;s[G+(d<<2)>>2]=s[G+(b<<2)>>2];n[ie+(d<<1)>>1]=n[ie+(b<<1)>>1]|0;s[W+(d<<2)>>2]=0;s[V+(w<<2)>>2]=2147483647;b=$+(d<<4)|0;d=$+(w<<4)|0;p=b+16|0;do{r[b>>0]=r[d>>0]|0;b=b+1|0;d=d+1|0}while((b|0)<(p|0));d=0;w=0;p=0;b=0;m=2147483647}while(1){if((d|0)==4){d=h;continue t}fe=$+(d<<4)+h|0;r[fe>>0]=(a[fe>>0]|0)+((s[X+(d<<2)>>2]|0)>>>2);d=d+1|0}}while(1){if((d|0)>=(E|0)){d=S;break}r[$+(d+E<<4)+h>>0]=(a[$+(d<<4)+h>>0]|0)+1;d=d+1|0}while(1){if((d|0)>=4){d=h;E=S;continue e}r[$+(d<<4)+h>>0]=r[$+(d-S<<4)+h>>0]|0;d=d+1|0}}while(1){if((d|0)==8)break;oe=s[G+(d<<2)>>2]|0;fe=(g|0)>(oe|0);g=fe?oe:g;m=fe?d:m;d=d+1|0}d=L+R|0;p=m&3;b=0;while(1){if((b|0)>=(M|0))break;r[d+b>>0]=r[$+(p<<4)+b>>0]|0;b=b+1|0}r[d>>0]=(a[d>>0]|0)+(m>>>2);w=D+(P<<2)|0;s[w>>2]=g;d=te(O,n[i>>1]|0)|0;d=(s[N>>2]|0)+d|0;p=r[d+x>>0]|0;if(!x)d=256-(p&255)|0;else d=(a[d+(x+-1)>>0]|0)-(p&255)|0;m=re(d|0)|0;p=24-m|0;b=0-p|0;do if(p)if((p|0)<0){d=d<>>(p+32|0);break}else{d=d<<32-p|d>>>p;break}while(0);fe=d&127;s[w>>2]=g+(te(1024-(fe+(((te(fe,128-fe|0)|0)*179|0)>>>16)+(31-m<<7))<<16>>16,C)|0);P=P+1|0}Or(D,Z,c,1);fe=s[Z>>2]|0;r[e>>0]=s[F+(fe<<2)>>2];Mn(e+1|0,L+(fe<<4)|0,n[q>>1]|0)|0;wr(t,e,i);l=se;return}function jr(){Nt(360,33176);We(376,33181,1,1,0);ut(384,33186,1,-128,127);ut(400,33191,1,-128,127);ut(392,33203,1,0,255);ut(408,33217,2,-32768,32767);ut(416,33223,2,0,65535);ut(424,33238,4,-2147483648,2147483647);ut(432,33242,4,0,-1);ut(440,33255,4,-2147483648,2147483647);ut(448,33260,4,0,-1);Gt(456,33274,4);Gt(464,33280,8);Ie(48,33388);Ie(80,33463);Bt(104,4,33559);Ye(128,33591);xt(136,0,33638);xt(144,0,33699);xt(152,1,33767);xt(160,2,33837);xt(168,3,33899);xt(176,4,33970);xt(184,5,34030);xt(192,4,34099);xt(200,5,34160);xt(144,0,34199);xt(152,1,34231);xt(160,2,34264);xt(168,3,34297);xt(176,4,34331);xt(184,5,34364);xt(208,6,34429);xt(216,7,34491);xt(224,7,34554);return}function Fr(e){e=e|0;var t=0,i=0,n=0,a=0;a=s[e+4>>2]|0;n=a;e:do if(!(n&3)){e=a;i=4}else{t=a;e=n;while(1){if(!(r[t>>0]|0))break e;t=t+1|0;e=t;if(!(e&3)){e=t;i=4;break}}}while(0);if((i|0)==4){while(1){t=s[e>>2]|0;if(!((t&-2139062144^-2139062144)&t+-16843009))e=e+4|0;else break}if((t&255)<<24>>24)do e=e+1|0;while((r[e>>0]|0)!=0)}e=e-n+1|0;t=qr(e)|0;if(!t){a=0;return a|0}Mn(t|0,a|0,e|0)|0;a=t;return a|0}function zr(e){e=+e;var t=0,i=0,r=0,n=0,a=0,o=0,f=0,h=0,l=0;c[d>>3]=e;i=s[d>>2]|0;t=s[d+4>>2]|0;r=(t|0)<0;do if(r|t>>>0<1048576){a=+q(+e);c[d>>3]=a;if((s[d>>2]|0)==0&(s[d+4>>2]|0)==0){e=-1/(e*e);break}if(r){e=(e-e)/0;break}else{c[d>>3]=e*0x40000000000000;t=s[d+4>>2]|0;r=s[d>>2]|0;i=-1077;n=9;break}}else if(t>>>0<=2146435071)if((i|0)==0&0==0&(t|0)==1072693248)e=0;else{ +r=i;i=-1023;n=9}while(0);if((n|0)==9){n=t+614242|0;s[d>>2]=r;s[d+4>>2]=(n&1048575)+1072079006;f=+c[d>>3]+-1;o=f*(f*.5);h=f/(f+2);l=h*h;e=l*l;c[d>>3]=f-o;r=s[d+4>>2]|0;s[d>>2]=0;s[d+4>>2]=r;a=+c[d>>3];e=f-a-o+h*(o+(e*(e*(e*.15313837699209373+.22222198432149784)+.3999999999940942)+l*(e*(e*(e*.14798198605116586+.1818357216161805)+.2857142874366239)+.6666666666666735)));l=a*.4342944818781689;o=+(i+(n>>>20)|0);h=o*.30102999566361177;f=h+l;e=f+(l+(h-f)+(e*.4342944818781689+(o*3.694239077158931e-13+(a+e)*2.5082946711645275e-11)))}return+e}function qr(e){e=e|0;var t=0,i=0,r=0,n=0,a=0,o=0,f=0,h=0,c=0,l=0,u=0,d=0,p=0,b=0,m=0,w=0,g=0,v=0,_=0,y=0,k=0,E=0,A=0,S=0,M=0,T=0,R=0,x=0,C=0,I=0,P=0;do if(e>>>0<245){p=e>>>0<11?16:e+11&-8;e=p>>>3;h=s[8744]|0;t=h>>>e;if(t&3|0){t=(t&1^1)+e|0;i=35016+(t<<1<<2)|0;r=i+8|0;n=s[r>>2]|0;a=n+8|0;o=s[a>>2]|0;do if((i|0)!=(o|0)){if(o>>>0<(s[8748]|0)>>>0)At();e=o+12|0;if((s[e>>2]|0)==(n|0)){s[e>>2]=i;s[r>>2]=o;break}else At()}else s[8744]=h&~(1<>2]=P|3;P=n+P+4|0;s[P>>2]=s[P>>2]|1;P=a;return P|0}o=s[8746]|0;if(p>>>0>o>>>0){if(t|0){i=2<>>12&16;i=i>>>f;n=i>>>5&8;i=i>>>n;a=i>>>2&4;i=i>>>a;r=i>>>1&2;i=i>>>r;t=i>>>1&1;t=(n|f|a|r|t)+(i>>>t)|0;i=35016+(t<<1<<2)|0;r=i+8|0;a=s[r>>2]|0;f=a+8|0;n=s[f>>2]|0;do if((i|0)!=(n|0)){if(n>>>0<(s[8748]|0)>>>0)At();e=n+12|0;if((s[e>>2]|0)==(a|0)){s[e>>2]=i;s[r>>2]=n;c=s[8746]|0;break}else At()}else{s[8744]=h&~(1<>2]=p|3;r=a+p|0;s[r+4>>2]=o|1;s[r+o>>2]=o;if(c|0){n=s[8749]|0;t=c>>>3;i=35016+(t<<1<<2)|0;e=s[8744]|0;t=1<>2]|0;if(t>>>0<(s[8748]|0)>>>0)At();else{l=e;u=t}}else{s[8744]=e|t;l=i+8|0;u=i}s[l>>2]=n;s[u+12>>2]=n;s[n+8>>2]=u;s[n+12>>2]=i}s[8746]=o;s[8749]=r;P=f;return P|0}e=s[8745]|0;if(e){f=(e&0-e)+-1|0;I=f>>>12&16;f=f>>>I;C=f>>>5&8;f=f>>>C;P=f>>>2&4;f=f>>>P;t=f>>>1&2;f=f>>>t;h=f>>>1&1;h=s[35280+((C|I|P|t|h)+(f>>>h)<<2)>>2]|0;f=(s[h+4>>2]&-8)-p|0;t=h;while(1){e=s[t+16>>2]|0;if(!e){e=s[t+20>>2]|0;if(!e)break}t=(s[e+4>>2]&-8)-p|0;P=t>>>0>>0;f=P?t:f;t=e;h=P?e:h}n=s[8748]|0;if(h>>>0>>0)At();o=h+p|0;if(h>>>0>=o>>>0)At();a=s[h+24>>2]|0;i=s[h+12>>2]|0;do if((i|0)==(h|0)){t=h+20|0;e=s[t>>2]|0;if(!e){t=h+16|0;e=s[t>>2]|0;if(!e){d=0;break}}while(1){i=e+20|0;r=s[i>>2]|0;if(r|0){e=r;t=i;continue}i=e+16|0;r=s[i>>2]|0;if(!r)break;else{e=r;t=i}}if(t>>>0>>0)At();else{s[t>>2]=0;d=e;break}}else{r=s[h+8>>2]|0;if(r>>>0>>0)At();e=r+12|0;if((s[e>>2]|0)!=(h|0))At();t=i+8|0;if((s[t>>2]|0)==(h|0)){s[e>>2]=i;s[t>>2]=r;d=i;break}else At()}while(0);do if(a|0){e=s[h+28>>2]|0;t=35280+(e<<2)|0;if((h|0)==(s[t>>2]|0)){s[t>>2]=d;if(!d){s[8745]=s[8745]&~(1<>>0<(s[8748]|0)>>>0)At();e=a+16|0;if((s[e>>2]|0)==(h|0))s[e>>2]=d;else s[a+20>>2]=d;if(!d)break}t=s[8748]|0;if(d>>>0>>0)At();s[d+24>>2]=a;e=s[h+16>>2]|0;do if(e|0)if(e>>>0>>0)At();else{s[d+16>>2]=e;s[e+24>>2]=d;break}while(0);e=s[h+20>>2]|0;if(e|0)if(e>>>0<(s[8748]|0)>>>0)At();else{s[d+20>>2]=e;s[e+24>>2]=d;break}}while(0);if(f>>>0<16){P=f+p|0;s[h+4>>2]=P|3;P=h+P+4|0;s[P>>2]=s[P>>2]|1}else{s[h+4>>2]=p|3;s[o+4>>2]=f|1;s[o+f>>2]=f;e=s[8746]|0;if(e|0){r=s[8749]|0;t=e>>>3;i=35016+(t<<1<<2)|0;e=s[8744]|0;t=1<>2]|0;if(t>>>0<(s[8748]|0)>>>0)At();else{b=e;m=t}}else{s[8744]=e|t;b=i+8|0;m=i}s[b>>2]=r;s[m+12>>2]=r;s[r+8>>2]=m;s[r+12>>2]=i}s[8746]=f;s[8749]=o}P=h+8|0;return P|0}}}else if(e>>>0<=4294967231){e=e+11|0;p=e&-8;c=s[8745]|0;if(c){i=0-p|0;e=e>>>8;if(e)if(p>>>0>16777215)h=31;else{m=(e+1048320|0)>>>16&8;S=e<>>16&4;S=S<>>16&2;h=14-(b|m|h)+(S<>>15)|0;h=p>>>(h+7|0)&1|h<<1}else h=0;t=s[35280+(h<<2)>>2]|0;e:do if(!t){e=0;t=0;S=86}else{n=i;e=0;o=p<<((h|0)==31?0:25-(h>>>1)|0);f=t;t=0;while(1){r=s[f+4>>2]&-8;i=r-p|0;if(i>>>0>>0)if((r|0)==(p|0)){e=f;t=f;S=90;break e}else t=f;else i=n;r=s[f+20>>2]|0;f=s[f+16+(o>>>31<<2)>>2]|0;e=(r|0)==0|(r|0)==(f|0)?e:r;r=(f|0)==0;if(r){S=86;break}else{n=i;o=o<<(r&1^1)}}}while(0);if((S|0)==86){if((e|0)==0&(t|0)==0){e=2<>>12&16;m=m>>>u;l=m>>>5&8;m=m>>>l;d=m>>>2&4;m=m>>>d;b=m>>>1&2;m=m>>>b;e=m>>>1&1;e=s[35280+((l|u|d|b|e)+(m>>>e)<<2)>>2]|0}if(!e){f=i;h=t}else S=90}if((S|0)==90)while(1){S=0;m=(s[e+4>>2]&-8)-p|0;r=m>>>0>>0;i=r?m:i;t=r?e:t;r=s[e+16>>2]|0;if(r|0){e=r;S=90;continue}e=s[e+20>>2]|0;if(!e){f=i;h=t;break}else S=90}if((h|0)!=0?f>>>0<((s[8746]|0)-p|0)>>>0:0){n=s[8748]|0;if(h>>>0>>0)At();o=h+p|0;if(h>>>0>=o>>>0)At();a=s[h+24>>2]|0;i=s[h+12>>2]|0;do if((i|0)==(h|0)){t=h+20|0;e=s[t>>2]|0;if(!e){t=h+16|0;e=s[t>>2]|0;if(!e){g=0;break}}while(1){i=e+20|0;r=s[i>>2]|0;if(r|0){e=r;t=i;continue}i=e+16|0;r=s[i>>2]|0;if(!r)break;else{e=r;t=i}}if(t>>>0>>0)At();else{s[t>>2]=0;g=e;break}}else{r=s[h+8>>2]|0;if(r>>>0>>0)At();e=r+12|0;if((s[e>>2]|0)!=(h|0))At();t=i+8|0;if((s[t>>2]|0)==(h|0)){s[e>>2]=i;s[t>>2]=r;g=i;break}else At()}while(0);do if(a|0){e=s[h+28>>2]|0;t=35280+(e<<2)|0;if((h|0)==(s[t>>2]|0)){s[t>>2]=g;if(!g){s[8745]=s[8745]&~(1<>>0<(s[8748]|0)>>>0)At();e=a+16|0;if((s[e>>2]|0)==(h|0))s[e>>2]=g;else s[a+20>>2]=g;if(!g)break}t=s[8748]|0;if(g>>>0>>0)At();s[g+24>>2]=a;e=s[h+16>>2]|0;do if(e|0)if(e>>>0>>0)At();else{s[g+16>>2]=e;s[e+24>>2]=g;break}while(0);e=s[h+20>>2]|0;if(e|0)if(e>>>0<(s[8748]|0)>>>0)At();else{s[g+20>>2]=e;s[e+24>>2]=g;break}}while(0);do if(f>>>0>=16){s[h+4>>2]=p|3;s[o+4>>2]=f|1;s[o+f>>2]=f;e=f>>>3;if(f>>>0<256){i=35016+(e<<1<<2)|0;t=s[8744]|0;e=1<>2]|0;if(t>>>0<(s[8748]|0)>>>0)At();else{v=e;y=t}}else{s[8744]=t|e;v=i+8|0;y=i}s[v>>2]=o;s[y+12>>2]=o;s[o+8>>2]=y;s[o+12>>2]=i;break}e=f>>>8;if(e)if(f>>>0>16777215)i=31;else{I=(e+1048320|0)>>>16&8;P=e<>>16&4;P=P<>>16&2;i=14-(C|I|i)+(P<>>15)|0;i=f>>>(i+7|0)&1|i<<1}else i=0;r=35280+(i<<2)|0;s[o+28>>2]=i;e=o+16|0;s[e+4>>2]=0;s[e>>2]=0;e=s[8745]|0;t=1<>2]=o;s[o+24>>2]=r;s[o+12>>2]=o;s[o+8>>2]=o;break}i=f<<((i|0)==31?0:25-(i>>>1)|0);r=s[r>>2]|0;while(1){if((s[r+4>>2]&-8|0)==(f|0)){S=148;break}t=r+16+(i>>>31<<2)|0;e=s[t>>2]|0;if(!e){S=145;break}else{i=i<<1;r=e}}if((S|0)==145)if(t>>>0<(s[8748]|0)>>>0)At();else{s[t>>2]=o;s[o+24>>2]=r;s[o+12>>2]=o;s[o+8>>2]=o;break}else if((S|0)==148){e=r+8|0;t=s[e>>2]|0;P=s[8748]|0;if(t>>>0>=P>>>0&r>>>0>=P>>>0){s[t+12>>2]=o;s[e>>2]=o;s[o+8>>2]=t;s[o+12>>2]=r;s[o+24>>2]=0;break}else At()}}else{P=f+p|0;s[h+4>>2]=P|3;P=h+P+4|0;s[P>>2]=s[P>>2]|1}while(0);P=h+8|0;return P|0}}}else p=-1;while(0);i=s[8746]|0;if(i>>>0>=p>>>0){e=i-p|0;t=s[8749]|0;if(e>>>0>15){P=t+p|0;s[8749]=P;s[8746]=e;s[P+4>>2]=e|1;s[P+e>>2]=e;s[t+4>>2]=p|3}else{s[8746]=0;s[8749]=0;s[t+4>>2]=i|3;P=t+i+4|0;s[P>>2]=s[P>>2]|1}P=t+8|0;return P|0}e=s[8747]|0;if(e>>>0>p>>>0){C=e-p|0;s[8747]=C;P=s[8750]|0;I=P+p|0;s[8750]=I;s[I+4>>2]=C|1;s[P+4>>2]=p|3;P=P+8|0;return P|0}do if(!(s[8862]|0)){e=xe(30)|0;if(!(e+-1&e)){s[8864]=e;s[8863]=e;s[8865]=-1;s[8866]=-1;s[8867]=0;s[8855]=0;s[8862]=(rt(0)|0)&-16^1431655768;break}else At()}while(0);o=p+48|0;r=s[8864]|0;f=p+47|0;i=r+f|0;r=0-r|0;h=i&r;if(h>>>0<=p>>>0){P=0;return P|0}e=s[8854]|0;if(e|0?(v=s[8852]|0,y=v+h|0,y>>>0<=v>>>0|y>>>0>e>>>0):0){P=0;return P|0}e:do if(!(s[8855]&4)){t=s[8750]|0;t:do if(t){n=35424;while(1){e=s[n>>2]|0;if(e>>>0<=t>>>0?(w=n+4|0,(e+(s[w>>2]|0)|0)>>>0>t>>>0):0)break;e=s[n+8>>2]|0;if(!e){S=173;break t}else n=e}e=i-(s[8747]|0)&r;if(e>>>0<2147483647){t=Me(e|0)|0;if((t|0)==((s[n>>2]|0)+(s[w>>2]|0)|0)){if((t|0)!=(-1|0)){o=t;a=e;S=193;break e}}else S=183}}else S=173;while(0);do if((S|0)==173?(_=Me(0)|0,(_|0)!=(-1|0)):0){e=_;t=s[8863]|0;i=t+-1|0;if(!(i&e))e=h;else e=h-e+(i+e&0-t)|0;t=s[8852]|0;i=t+e|0;if(e>>>0>p>>>0&e>>>0<2147483647){y=s[8854]|0;if(y|0?i>>>0<=t>>>0|i>>>0>y>>>0:0)break;t=Me(e|0)|0;if((t|0)==(_|0)){o=_;a=e;S=193;break e}else S=183}}while(0);t:do if((S|0)==183){i=0-e|0;do if(o>>>0>e>>>0&(e>>>0<2147483647&(t|0)!=(-1|0))?(k=s[8864]|0,k=f-e+k&0-k,k>>>0<2147483647):0)if((Me(k|0)|0)==(-1|0)){Me(i|0)|0;break t}else{e=k+e|0;break}while(0);if((t|0)!=(-1|0)){o=t;a=e;S=193;break e}}while(0);s[8855]=s[8855]|4;S=190}else S=190;while(0);if((((S|0)==190?h>>>0<2147483647:0)?(E=Me(h|0)|0,A=Me(0)|0,E>>>0>>0&((E|0)!=(-1|0)&(A|0)!=(-1|0))):0)?(a=A-E|0,a>>>0>(p+40|0)>>>0):0){o=E;S=193}if((S|0)==193){e=(s[8852]|0)+a|0;s[8852]=e;if(e>>>0>(s[8853]|0)>>>0)s[8853]=e;c=s[8750]|0;do if(c){n=35424;while(1){e=s[n>>2]|0;t=n+4|0;i=s[t>>2]|0;if((o|0)==(e+i|0)){S=203;break}r=s[n+8>>2]|0;if(!r)break;else n=r}if(((S|0)==203?(s[n+12>>2]&8|0)==0:0)?c>>>0>>0&c>>>0>=e>>>0:0){s[t>>2]=i+a;P=c+8|0;P=(P&7|0)==0?0:0-P&7;I=c+P|0;P=a-P+(s[8747]|0)|0;s[8750]=I;s[8747]=P;s[I+4>>2]=P|1;s[I+P+4>>2]=40;s[8751]=s[8866];break}e=s[8748]|0;if(o>>>0>>0){s[8748]=o;f=o}else f=e;t=o+a|0;e=35424;while(1){if((s[e>>2]|0)==(t|0)){S=211;break}e=s[e+8>>2]|0;if(!e){t=35424;break}}if((S|0)==211)if(!(s[e+12>>2]&8)){s[e>>2]=o;u=e+4|0;s[u>>2]=(s[u>>2]|0)+a;u=o+8|0;u=o+((u&7|0)==0?0:0-u&7)|0;e=t+8|0;e=t+((e&7|0)==0?0:0-e&7)|0;l=u+p|0;h=e-u-p|0;s[u+4>>2]=p|3;do if((e|0)!=(c|0)){if((e|0)==(s[8749]|0)){P=(s[8746]|0)+h|0;s[8746]=P;s[8749]=l;s[l+4>>2]=P|1;s[l+P>>2]=P;break}t=s[e+4>>2]|0;if((t&3|0)==1){o=t&-8;n=t>>>3;e:do if(t>>>0>=256){a=s[e+24>>2]|0;r=s[e+12>>2]|0;do if((r|0)==(e|0)){r=e+16|0;i=r+4|0;t=s[i>>2]|0;if(!t){t=s[r>>2]|0;if(!t){C=0;break}else i=r}while(1){r=t+20|0;n=s[r>>2]|0;if(n|0){t=n;i=r;continue}r=t+16|0;n=s[r>>2]|0;if(!n)break;else{t=n;i=r}}if(i>>>0>>0)At();else{s[i>>2]=0;C=t;break}}else{n=s[e+8>>2]|0;if(n>>>0>>0)At();t=n+12|0;if((s[t>>2]|0)!=(e|0))At();i=r+8|0;if((s[i>>2]|0)==(e|0)){s[t>>2]=r;s[i>>2]=n;C=r;break}else At()}while(0);if(!a)break;t=s[e+28>>2]|0;i=35280+(t<<2)|0;do if((e|0)!=(s[i>>2]|0)){if(a>>>0<(s[8748]|0)>>>0)At();t=a+16|0;if((s[t>>2]|0)==(e|0))s[t>>2]=C;else s[a+20>>2]=C;if(!C)break e}else{s[i>>2]=C;if(C|0)break;s[8745]=s[8745]&~(1<>>0>>0)At();s[C+24>>2]=a;t=e+16|0;i=s[t>>2]|0;do if(i|0)if(i>>>0>>0)At();else{s[C+16>>2]=i;s[i+24>>2]=C;break}while(0);t=s[t+4>>2]|0;if(!t)break;if(t>>>0<(s[8748]|0)>>>0)At();else{s[C+20>>2]=t;s[t+24>>2]=C;break}}else{i=s[e+8>>2]|0;r=s[e+12>>2]|0;t=35016+(n<<1<<2)|0;do if((i|0)!=(t|0)){if(i>>>0>>0)At();if((s[i+12>>2]|0)==(e|0))break;At()}while(0);if((r|0)==(i|0)){s[8744]=s[8744]&~(1<>>0>>0)At();t=r+8|0;if((s[t>>2]|0)==(e|0)){T=t;break}At()}while(0);s[i+12>>2]=r;s[T>>2]=i}while(0);e=e+o|0;n=o+h|0}else n=h;e=e+4|0;s[e>>2]=s[e>>2]&-2;s[l+4>>2]=n|1;s[l+n>>2]=n;e=n>>>3;if(n>>>0<256){i=35016+(e<<1<<2)|0;t=s[8744]|0;e=1<>2]|0;if(t>>>0>=(s[8748]|0)>>>0){I=e;P=t;break}At()}while(0);s[I>>2]=l;s[P+12>>2]=l;s[l+8>>2]=P;s[l+12>>2]=i;break}e=n>>>8;do if(!e)i=0;else{if(n>>>0>16777215){i=31;break}I=(e+1048320|0)>>>16&8;P=e<>>16&4;P=P<>>16&2;i=14-(C|I|i)+(P<>>15)|0;i=n>>>(i+7|0)&1|i<<1}while(0);r=35280+(i<<2)|0;s[l+28>>2]=i;e=l+16|0;s[e+4>>2]=0;s[e>>2]=0;e=s[8745]|0;t=1<>2]=l;s[l+24>>2]=r;s[l+12>>2]=l;s[l+8>>2]=l;break}i=n<<((i|0)==31?0:25-(i>>>1)|0);r=s[r>>2]|0;while(1){if((s[r+4>>2]&-8|0)==(n|0)){S=281;break}t=r+16+(i>>>31<<2)|0;e=s[t>>2]|0;if(!e){S=278;break}else{i=i<<1;r=e}}if((S|0)==278)if(t>>>0<(s[8748]|0)>>>0)At();else{s[t>>2]=l;s[l+24>>2]=r;s[l+12>>2]=l;s[l+8>>2]=l;break}else if((S|0)==281){e=r+8|0;t=s[e>>2]|0;P=s[8748]|0;if(t>>>0>=P>>>0&r>>>0>=P>>>0){s[t+12>>2]=l;s[e>>2]=l;s[l+8>>2]=t;s[l+12>>2]=r;s[l+24>>2]=0;break}else At()}}else{P=(s[8747]|0)+h|0;s[8747]=P;s[8750]=l;s[l+4>>2]=P|1}while(0);P=u+8|0;return P|0}else t=35424;while(1){e=s[t>>2]|0;if(e>>>0<=c>>>0?(M=e+(s[t+4>>2]|0)|0,M>>>0>c>>>0):0)break;t=s[t+8>>2]|0}n=M+-47|0;t=n+8|0;t=n+((t&7|0)==0?0:0-t&7)|0;n=c+16|0;t=t>>>0>>0?c:t;e=t+8|0;i=o+8|0;i=(i&7|0)==0?0:0-i&7;P=o+i|0;i=a+-40-i|0;s[8750]=P;s[8747]=i;s[P+4>>2]=i|1;s[P+i+4>>2]=40;s[8751]=s[8866];i=t+4|0;s[i>>2]=27;s[e>>2]=s[8856];s[e+4>>2]=s[8857];s[e+8>>2]=s[8858];s[e+12>>2]=s[8859];s[8856]=o;s[8857]=a;s[8859]=0;s[8858]=e;e=t+24|0;do{e=e+4|0;s[e>>2]=7}while((e+4|0)>>>0>>0);if((t|0)!=(c|0)){a=t-c|0;s[i>>2]=s[i>>2]&-2;s[c+4>>2]=a|1;s[t>>2]=a;e=a>>>3;if(a>>>0<256){i=35016+(e<<1<<2)|0;t=s[8744]|0;e=1<>2]|0;if(t>>>0<(s[8748]|0)>>>0)At();else{R=e;x=t}}else{s[8744]=t|e;R=i+8|0;x=i}s[R>>2]=c;s[x+12>>2]=c;s[c+8>>2]=x;s[c+12>>2]=i;break}e=a>>>8;if(e)if(a>>>0>16777215)i=31;else{I=(e+1048320|0)>>>16&8;P=e<>>16&4;P=P<>>16&2;i=14-(C|I|i)+(P<>>15)|0;i=a>>>(i+7|0)&1|i<<1}else i=0;r=35280+(i<<2)|0;s[c+28>>2]=i;s[c+20>>2]=0;s[n>>2]=0;e=s[8745]|0;t=1<>2]=c;s[c+24>>2]=r;s[c+12>>2]=c;s[c+8>>2]=c;break}i=a<<((i|0)==31?0:25-(i>>>1)|0);r=s[r>>2]|0;while(1){if((s[r+4>>2]&-8|0)==(a|0)){S=307;break}t=r+16+(i>>>31<<2)|0;e=s[t>>2]|0;if(!e){S=304;break}else{i=i<<1;r=e}}if((S|0)==304)if(t>>>0<(s[8748]|0)>>>0)At();else{s[t>>2]=c;s[c+24>>2]=r;s[c+12>>2]=c;s[c+8>>2]=c;break}else if((S|0)==307){e=r+8|0;t=s[e>>2]|0;P=s[8748]|0;if(t>>>0>=P>>>0&r>>>0>=P>>>0){s[t+12>>2]=c;s[e>>2]=c;s[c+8>>2]=t;s[c+12>>2]=r;s[c+24>>2]=0;break}else At()}}}else{P=s[8748]|0;if((P|0)==0|o>>>0

>>0)s[8748]=o;s[8856]=o;s[8857]=a;s[8859]=0;s[8753]=s[8862];s[8752]=-1;e=0;do{P=35016+(e<<1<<2)|0;s[P+12>>2]=P;s[P+8>>2]=P;e=e+1|0}while((e|0)!=32);P=o+8|0;P=(P&7|0)==0?0:0-P&7;I=o+P|0;P=a+-40-P|0;s[8750]=I;s[8747]=P;s[I+4>>2]=P|1;s[I+P+4>>2]=40;s[8751]=s[8866]}while(0);e=s[8747]|0;if(e>>>0>p>>>0){C=e-p|0;s[8747]=C;P=s[8750]|0;I=P+p|0;s[8750]=I;s[I+4>>2]=C|1;s[P+4>>2]=p|3;P=P+8|0;return P|0}}if(!(s[8732]|0))e=34972;else e=s[(zt()|0)+64>>2]|0;s[e>>2]=12;P=0;return P|0}function Hr(e){e=e|0;var t=0,i=0,r=0,n=0,a=0,o=0,f=0,h=0,c=0,l=0,u=0,d=0,p=0,b=0,m=0;if(!e)return;i=e+-8|0;o=s[8748]|0;if(i>>>0>>0)At();e=s[e+-4>>2]|0;t=e&3;if((t|0)==1)At();r=e&-8;u=i+r|0;do if(!(e&1)){e=s[i>>2]|0;if(!t)return;c=i+(0-e)|0;h=e+r|0;if(c>>>0>>0)At();if((c|0)==(s[8749]|0)){e=u+4|0;t=s[e>>2]|0;if((t&3|0)!=3){m=c;n=h;break}s[8746]=h;s[e>>2]=t&-2;s[c+4>>2]=h|1;s[c+h>>2]=h;return}r=e>>>3;if(e>>>0<256){t=s[c+8>>2]|0;i=s[c+12>>2]|0;e=35016+(r<<1<<2)|0;if((t|0)!=(e|0)){if(t>>>0>>0)At();if((s[t+12>>2]|0)!=(c|0))At()}if((i|0)==(t|0)){s[8744]=s[8744]&~(1<>>0>>0)At();e=i+8|0;if((s[e>>2]|0)==(c|0))a=e;else At()}else a=i+8|0;s[t+12>>2]=i;s[a>>2]=t;m=c;n=h;break}a=s[c+24>>2]|0;i=s[c+12>>2]|0;do if((i|0)==(c|0)){i=c+16|0;t=i+4|0;e=s[t>>2]|0;if(!e){e=s[i>>2]|0;if(!e){f=0;break}else t=i}while(1){i=e+20|0;r=s[i>>2]|0;if(r|0){e=r;t=i;continue}i=e+16|0;r=s[i>>2]|0;if(!r)break;else{e=r;t=i}}if(t>>>0>>0)At();else{s[t>>2]=0;f=e;break}}else{r=s[c+8>>2]|0;if(r>>>0>>0)At();e=r+12|0;if((s[e>>2]|0)!=(c|0))At();t=i+8|0;if((s[t>>2]|0)==(c|0)){s[e>>2]=i;s[t>>2]=r;f=i;break}else At()}while(0);if(a){e=s[c+28>>2]|0;t=35280+(e<<2)|0;if((c|0)==(s[t>>2]|0)){s[t>>2]=f;if(!f){s[8745]=s[8745]&~(1<>>0<(s[8748]|0)>>>0)At();e=a+16|0;if((s[e>>2]|0)==(c|0))s[e>>2]=f;else s[a+20>>2]=f;if(!f){m=c;n=h;break}}i=s[8748]|0;if(f>>>0>>0)At();s[f+24>>2]=a;e=c+16|0;t=s[e>>2]|0;do if(t|0)if(t>>>0>>0)At();else{s[f+16>>2]=t;s[t+24>>2]=f;break}while(0);e=s[e+4>>2]|0;if(e)if(e>>>0<(s[8748]|0)>>>0)At();else{s[f+20>>2]=e;s[e+24>>2]=f;m=c;n=h;break}else{m=c;n=h}}else{m=c;n=h}}else{m=i;n=r}while(0);if(m>>>0>=u>>>0)At();e=u+4|0;t=s[e>>2]|0;if(!(t&1))At();if(!(t&2)){if((u|0)==(s[8750]|0)){b=(s[8747]|0)+n|0;s[8747]=b;s[8750]=m;s[m+4>>2]=b|1;if((m|0)!=(s[8749]|0))return;s[8749]=0;s[8746]=0;return}if((u|0)==(s[8749]|0)){b=(s[8746]|0)+n|0;s[8746]=b;s[8749]=m;s[m+4>>2]=b|1;s[m+b>>2]=b;return}n=(t&-8)+n|0;r=t>>>3;do if(t>>>0>=256){a=s[u+24>>2]|0;e=s[u+12>>2]|0;do if((e|0)==(u|0)){i=u+16|0;t=i+4|0;e=s[t>>2]|0;if(!e){e=s[i>>2]|0;if(!e){d=0;break}else t=i}while(1){i=e+20|0;r=s[i>>2]|0;if(r|0){e=r;t=i;continue}i=e+16|0;r=s[i>>2]|0;if(!r)break;else{e=r;t=i}}if(t>>>0<(s[8748]|0)>>>0)At();else{s[t>>2]=0;d=e;break}}else{t=s[u+8>>2]|0;if(t>>>0<(s[8748]|0)>>>0)At();i=t+12|0;if((s[i>>2]|0)!=(u|0))At();r=e+8|0;if((s[r>>2]|0)==(u|0)){s[i>>2]=e;s[r>>2]=t;d=e;break}else At()}while(0);if(a|0){e=s[u+28>>2]|0;t=35280+(e<<2)|0;if((u|0)==(s[t>>2]|0)){s[t>>2]=d;if(!d){s[8745]=s[8745]&~(1<>>0<(s[8748]|0)>>>0)At();e=a+16|0;if((s[e>>2]|0)==(u|0))s[e>>2]=d;else s[a+20>>2]=d;if(!d)break}i=s[8748]|0;if(d>>>0>>0)At();s[d+24>>2]=a;e=u+16|0;t=s[e>>2]|0;do if(t|0)if(t>>>0>>0)At();else{s[d+16>>2]=t;s[t+24>>2]=d;break}while(0);e=s[e+4>>2]|0;if(e|0)if(e>>>0<(s[8748]|0)>>>0)At();else{s[d+20>>2]=e;s[e+24>>2]=d;break}}}else{t=s[u+8>>2]|0;i=s[u+12>>2]|0;e=35016+(r<<1<<2)|0;if((t|0)!=(e|0)){if(t>>>0<(s[8748]|0)>>>0)At();if((s[t+12>>2]|0)!=(u|0))At()}if((i|0)==(t|0)){s[8744]=s[8744]&~(1<>>0<(s[8748]|0)>>>0)At();e=i+8|0;if((s[e>>2]|0)==(u|0))l=e;else At()}else l=i+8|0;s[t+12>>2]=i;s[l>>2]=t}while(0);s[m+4>>2]=n|1;s[m+n>>2]=n;if((m|0)==(s[8749]|0)){s[8746]=n;return}}else{s[e>>2]=t&-2;s[m+4>>2]=n|1;s[m+n>>2]=n}e=n>>>3;if(n>>>0<256){i=35016+(e<<1<<2)|0;t=s[8744]|0;e=1<>2]|0;if(t>>>0<(s[8748]|0)>>>0)At();else{p=e;b=t}}else{s[8744]=t|e;p=i+8|0;b=i}s[p>>2]=m;s[b+12>>2]=m;s[m+8>>2]=b;s[m+12>>2]=i;return}e=n>>>8;if(e)if(n>>>0>16777215)i=31;else{p=(e+1048320|0)>>>16&8;b=e<>>16&4;b=b<>>16&2;i=14-(d|p|i)+(b<>>15)|0;i=n>>>(i+7|0)&1|i<<1}else i=0;r=35280+(i<<2)|0;s[m+28>>2]=i;s[m+20>>2]=0;s[m+16>>2]=0;e=s[8745]|0;t=1<>>1)|0);r=s[r>>2]|0;while(1){if((s[r+4>>2]&-8|0)==(n|0)){e=130;break}t=r+16+(i>>>31<<2)|0;e=s[t>>2]|0;if(!e){e=127;break}else{i=i<<1;r=e}}if((e|0)==127)if(t>>>0<(s[8748]|0)>>>0)At();else{s[t>>2]=m;s[m+24>>2]=r;s[m+12>>2]=m;s[m+8>>2]=m;break}else if((e|0)==130){e=r+8|0;t=s[e>>2]|0;b=s[8748]|0;if(t>>>0>=b>>>0&r>>>0>=b>>>0){s[t+12>>2]=m;s[e>>2]=m;s[m+8>>2]=t;s[m+12>>2]=r;s[m+24>>2]=0;break}else At()}}else{s[8745]=e|t;s[r>>2]=m;s[m+24>>2]=r;s[m+12>>2]=m;s[m+8>>2]=m}while(0);m=(s[8752]|0)+-1|0;s[8752]=m;if(!m)e=35432;else return;while(1){e=s[e>>2]|0;if(!e)break;else e=e+8|0}s[8752]=-1;return}function Gr(e){e=e|0;return}function Vr(e){e=e|0;Hr(e);return}function Wr(e){e=e|0;return}function Kr(e){e=e|0;return}function Zr(e,t,i){e=e|0;t=t|0;i=i|0;var r=0,n=0,a=0,o=0;o=l;l=l+64|0;a=o;if((e|0)!=(t|0))if((t|0)!=0?(n=Yr(t,240)|0,(n|0)!=0):0){t=a;r=t+56|0;do{s[t>>2]=0;t=t+4|0}while((t|0)<(r|0));s[a>>2]=n;s[a+8>>2]=e;s[a+12>>2]=-1;s[a+48>>2]=1;Qs[s[(s[n>>2]|0)+28>>2]&3](n,a,s[i>>2]|0,1);if((s[a+24>>2]|0)==1){s[i>>2]=s[a+16>>2];t=1}else t=0}else t=0;else t=1;l=o;return t|0}function Yr(e,t){e=e|0;t=t|0;var i=0,a=0,o=0,f=0,h=0,c=0,u=0,d=0,p=0,b=0,m=0,w=0,g=0;g=l;l=l+64|0;w=g;m=s[e>>2]|0;b=e+(s[m+-8>>2]|0)|0;m=s[m+-4>>2]|0;s[w>>2]=t;s[w+4>>2]=e;s[w+8>>2]=272;c=w+12|0;u=w+16|0;e=w+20|0;i=w+24|0;a=w+28|0;o=w+32|0;f=w+40|0;h=(m|0)==(t|0);d=c;p=d+40|0;do{s[d>>2]=0;d=d+4|0}while((d|0)<(p|0));n[c+40>>1]=0;r[c+42>>0]=0;e:do if(h){s[w+48>>2]=1;Xs[s[(s[t>>2]|0)+20>>2]&3](t,w,b,b,1,0);e=(s[i>>2]|0)==1?b:0}else{Gs[s[(s[m>>2]|0)+24>>2]&3](m,w,b,1,0);switch(s[w+36>>2]|0){case 0:{e=(s[f>>2]|0)==1&(s[a>>2]|0)==1&(s[o>>2]|0)==1?s[e>>2]|0:0;break e}case 1:break;default:{e=0;break e}}if((s[i>>2]|0)!=1?!((s[f>>2]|0)==0&(s[a>>2]|0)==1&(s[o>>2]|0)==1):0){e=0;break}e=s[u>>2]|0}while(0);l=g;return e|0}function $r(e,t,i,r,n,a){e=e|0;t=t|0;i=i|0;r=r|0;n=n|0;a=a|0;if((e|0)==(s[t+8>>2]|0))Xr(t,i,r,n);else{e=s[e+8>>2]|0;Xs[s[(s[e>>2]|0)+20>>2]&3](e,t,i,r,n,a)}return}function Xr(e,t,i,n){e=e|0;t=t|0;i=i|0;n=n|0;var a=0;r[e+53>>0]=1;do if((s[e+4>>2]|0)==(i|0)){r[e+52>>0]=1;i=e+16|0;a=s[i>>2]|0;if(!a){s[i>>2]=t;s[e+24>>2]=n;s[e+36>>2]=1;if(!((n|0)==1?(s[e+48>>2]|0)==1:0))break;r[e+54>>0]=1;break}if((a|0)!=(t|0)){n=e+36|0;s[n>>2]=(s[n>>2]|0)+1;r[e+54>>0]=1;break}a=e+24|0;i=s[a>>2]|0;if((i|0)==2){s[a>>2]=n;i=n}if((i|0)==1?(s[e+48>>2]|0)==1:0)r[e+54>>0]=1}while(0);return}function Jr(e,t,i,n,a){e=e|0;t=t|0;i=i|0;n=n|0;a=a|0;var o=0,f=0,h=0;do if((e|0)==(s[t+8>>2]|0)){if((s[t+4>>2]|0)==(i|0)?(o=t+28|0,(s[o>>2]|0)!=1):0)s[o>>2]=n}else{if((e|0)!=(s[t>>2]|0)){h=s[e+8>>2]|0;Gs[s[(s[h>>2]|0)+24>>2]&3](h,t,i,n,a);break}if((s[t+16>>2]|0)!=(i|0)?(h=t+20|0,(s[h>>2]|0)!=(i|0)):0){s[t+32>>2]=n;f=t+44|0;if((s[f>>2]|0)==4)break;o=t+52|0;r[o>>0]=0;n=t+53|0;r[n>>0]=0;e=s[e+8>>2]|0;Xs[s[(s[e>>2]|0)+20>>2]&3](e,t,i,i,1,a);if(r[n>>0]|0)if(!(r[o>>0]|0)){o=1;n=13}else n=17;else{o=0;n=13}do if((n|0)==13){s[h>>2]=i;i=t+40|0;s[i>>2]=(s[i>>2]|0)+1;if((s[t+36>>2]|0)==1?(s[t+24>>2]|0)==2:0){r[t+54>>0]=1;if(o){n=17;break}else{o=4;break}}if(o)n=17;else o=4}while(0);if((n|0)==17)o=3;s[f>>2]=o;break}if((n|0)==1)s[t+32>>2]=1}while(0);return}function Qr(e,t,i,n){e=e|0;t=t|0;i=i|0;n=n|0;var a=0;do if((e|0)==(s[t+8>>2]|0)){e=t+16|0;a=s[e>>2]|0;if(!a){s[e>>2]=i;s[t+24>>2]=n;s[t+36>>2]=1;break}if((a|0)!=(i|0)){n=t+36|0;s[n>>2]=(s[n>>2]|0)+1;s[t+24>>2]=2;r[t+54>>0]=1;break}e=t+24|0;if((s[e>>2]|0)==2)s[e>>2]=n}else{a=s[e+8>>2]|0;Qs[s[(s[a>>2]|0)+28>>2]&3](a,t,i,n)}while(0);return}function en(e){e=e|0;Hr(e);return}function tn(e,t,i,r,n,a){e=e|0;t=t|0;i=i|0;r=r|0;n=n|0;a=a|0;if((e|0)==(s[t+8>>2]|0))Xr(t,i,r,n);return}function rn(e,t,i,n,a){e=e|0;t=t|0;i=i|0;n=n|0;a=a|0;var o=0,f=0;do if((e|0)==(s[t+8>>2]|0)){if((s[t+4>>2]|0)==(i|0)?(f=t+28|0,(s[f>>2]|0)!=1):0)s[f>>2]=n}else if((e|0)==(s[t>>2]|0)){if((s[t+16>>2]|0)!=(i|0)?(o=t+20|0,(s[o>>2]|0)!=(i|0)):0){s[t+32>>2]=n;s[o>>2]=i;a=t+40|0;s[a>>2]=(s[a>>2]|0)+1;if((s[t+36>>2]|0)==1?(s[t+24>>2]|0)==2:0)r[t+54>>0]=1;s[t+44>>2]=4;break}if((n|0)==1)s[t+32>>2]=1}while(0);return}function nn(e,t,i,n){e=e|0;t=t|0;i=i|0;n=n|0;var a=0;do if((e|0)==(s[t+8>>2]|0)){e=t+16|0;a=s[e>>2]|0;if(!a){s[e>>2]=i;s[t+24>>2]=n;s[t+36>>2]=1;break}if((a|0)!=(i|0)){n=t+36|0;s[n>>2]=(s[n>>2]|0)+1;s[t+24>>2]=2;r[t+54>>0]=1;break}e=t+24|0;if((s[e>>2]|0)==2)s[e>>2]=n}while(0);return}function sn(e){e=e|0;return}function an(e){e=e|0;Hr(e);return}function on(e){e=e|0;return 34734}function fn(e){e=e|0;Hr(e);return}function hn(e,t,i){e=e|0;t=t|0;i=i|0;return(e|0)==(t|0)|0}function cn(e){e=e|0;Hr(e);return}function ln(e,t,i){e=e|0;t=t|0;i=i|0;var r=0,n=0,a=0,o=0,f=0,h=0;h=l;l=l+64|0;f=h;s[i>>2]=s[s[i>>2]>>2];if(!((e|0)==(t|0)|(t|0)==368))if(((t|0)!=0?(r=Yr(t,328)|0,(r|0)!=0):0)?(s[r+8>>2]&~s[e+8>>2]|0)==0:0){t=s[e+12>>2]|0;e=r+12|0;if(!((t|0)==360?1:(t|0)==(s[e>>2]|0)))if((((t|0)!=0?(a=Yr(t,240)|0,(a|0)!=0):0)?(n=s[e>>2]|0,(n|0)!=0):0)?(o=Yr(n,240)|0,(o|0)!=0):0){e=f;t=e+56|0;do{s[e>>2]=0;e=e+4|0}while((e|0)<(t|0));s[f>>2]=o;s[f+8>>2]=a;s[f+12>>2]=-1;s[f+48>>2]=1;Qs[s[(s[o>>2]|0)+28>>2]&3](o,f,s[i>>2]|0,1);if((s[f+24>>2]|0)==1){s[i>>2]=s[f+16>>2];e=1}else e=0}else e=0;else e=1}else e=0;else e=1;l=h;return e|0}function un(e){e=e|0;Hr(e);return}function dn(e,t,i,a,o,f){e=e|0;t=t|0;i=i|0;a=a|0;o=o|0;f=f|0;var h=0,c=0,l=0,u=0,d=0,p=0,b=0,m=0,w=0;if((e|0)==(s[t+8>>2]|0))Xr(t,i,a,o);else{p=t+52|0;w=n[p>>1]|0;b=w&255;m=t+53|0;w=(w&65535)>>>8&255;d=s[e+12>>2]|0;c=e+16+(d<<3)|0;r[p>>0]=0;r[m>>0]=0;pn(e+16|0,t,i,a,o,f);e:do if((d|0)>1){l=t+24|0;u=e+8|0;d=t+54|0;h=e+24|0;do{if(r[d>>0]|0)break e;e=n[p>>1]|0;if(!((e&255)<<24>>24)){if((e&65535)>=256?(s[u>>2]&1|0)==0:0)break e}else{if((s[l>>2]|0)==1)break e;if(!(s[u>>2]&2))break e}r[p>>0]=0;r[m>>0]=0;pn(h,t,i,a,o,f);h=h+8|0}while(h>>>0>>0)}while(0);r[p>>0]=b;r[m>>0]=w}return}function pn(e,t,i,r,n,a){e=e|0;t=t|0;i=i|0;r=r|0;n=n|0;a=a|0;var o=0,f=0;f=s[e+4>>2]|0;o=f>>8;if(f&1)o=s[(s[r>>2]|0)+o>>2]|0;e=s[e>>2]|0;Xs[s[(s[e>>2]|0)+20>>2]&3](e,t,i,r+o|0,f&2|0?n:2,a);return}function bn(e,t,i,n,a){e=e|0;t=t|0;i=i|0;n=n|0;a=a|0;var o=0,f=0,h=0,c=0,l=0,u=0,d=0,p=0,b=0,m=0;e:do if((e|0)==(s[t+8>>2]|0)){if((s[t+4>>2]|0)==(i|0)?(o=t+28|0,(s[o>>2]|0)!=1):0)s[o>>2]=n}else{if((e|0)!=(s[t>>2]|0)){m=s[e+12>>2]|0;h=e+16+(m<<3)|0;mn(e+16|0,t,i,n,a);o=e+24|0;if((m|0)<=1)break;e=s[e+8>>2]|0;if((e&2|0)==0?(c=t+36|0,(s[c>>2]|0)!=1):0){if(!(e&1)){e=t+54|0;while(1){if(r[e>>0]|0)break e;if((s[c>>2]|0)==1)break e;mn(o,t,i,n,a);o=o+8|0;if(o>>>0>=h>>>0)break e}}e=t+24|0;f=t+54|0;while(1){if(r[f>>0]|0)break e;if((s[c>>2]|0)==1?(s[e>>2]|0)==1:0)break e;mn(o,t,i,n,a);o=o+8|0;if(o>>>0>=h>>>0)break e}}e=t+54|0;while(1){if(r[e>>0]|0)break e;mn(o,t,i,n,a);o=o+8|0;if(o>>>0>=h>>>0)break e}}if((s[t+16>>2]|0)!=(i|0)?(m=t+20|0,(s[m>>2]|0)!=(i|0)):0){s[t+32>>2]=n;b=t+44|0;if((s[b>>2]|0)==4)break;h=e+16+(s[e+12>>2]<<3)|0;c=t+52|0;n=t+53|0;d=t+54|0;l=e+8|0;p=t+24|0;u=0;o=0;f=e+16|0;t:while(1){if(f>>>0>=h>>>0){e=20;break}r[c>>0]=0;r[n>>0]=0;pn(f,t,i,i,1,a);if(r[d>>0]|0){e=20;break}do if(r[n>>0]|0){if(!(r[c>>0]|0))if(!(s[l>>2]&1)){o=1;e=20;break t}else{e=u;o=1;break}if((s[p>>2]|0)==1){e=25;break t}if(!(s[l>>2]&2)){e=25;break t}else{e=1;o=1}}else e=u;while(0);u=e;f=f+8|0}do if((e|0)==20){if((!u?(s[m>>2]=i,i=t+40|0,s[i>>2]=(s[i>>2]|0)+1,(s[t+36>>2]|0)==1):0)?(s[p>>2]|0)==2:0){r[d>>0]=1;if(o){e=25;break}else{o=4;break}}if(o)e=25;else o=4}while(0);if((e|0)==25)o=3;s[b>>2]=o;break}if((n|0)==1)s[t+32>>2]=1}while(0);return}function mn(e,t,i,r,n){e=e|0;t=t|0;i=i|0;r=r|0;n=n|0;var a=0,o=0;o=s[e+4>>2]|0;a=o>>8;if(o&1)a=s[(s[i>>2]|0)+a>>2]|0;e=s[e>>2]|0;Gs[s[(s[e>>2]|0)+24>>2]&3](e,t,i+a|0,o&2|0?r:2,n);return}function wn(e,t,i,n){e=e|0;t=t|0;i=i|0;n=n|0;var a=0,o=0;e:do if((e|0)==(s[t+8>>2]|0)){e=t+16|0;a=s[e>>2]|0;if(!a){s[e>>2]=i;s[t+24>>2]=n;s[t+36>>2]=1;break}if((a|0)!=(i|0)){n=t+36|0;s[n>>2]=(s[n>>2]|0)+1;s[t+24>>2]=2;r[t+54>>0]=1;break}e=t+24|0;if((s[e>>2]|0)==2)s[e>>2]=n}else{o=s[e+12>>2]|0;a=e+16+(o<<3)|0;gn(e+16|0,t,i,n);if((o|0)>1){o=t+54|0;e=e+24|0;do{gn(e,t,i,n);if(r[o>>0]|0)break e;e=e+8|0}while(e>>>0>>0)}}while(0);return}function gn(e,t,i,r){e=e|0;t=t|0;i=i|0;r=r|0;var n=0,a=0;a=s[e+4>>2]|0;n=a>>8;if(a&1)n=s[(s[i>>2]|0)+n>>2]|0;e=s[e>>2]|0;Qs[s[(s[e>>2]|0)+28>>2]&3](e,t,i+n|0,a&2|0?r:2);return}function vn(e,t,i){e=e|0;t=t|0;i=i|0;var r=0,n=0;n=l;l=l+16|0;r=n;s[r>>2]=s[i>>2];e=Hs[s[(s[e>>2]|0)+16>>2]&7](e,t,r)|0;if(e)s[i>>2]=s[r>>2];l=n;return e&1|0}function _n(e){e=e|0;if(!e)e=0;else e=(Yr(e,328)|0)!=0;return e&1|0}function yn(){}function kn(e,t,i){e=e|0;t=t|0;i=i|0;var n=0,a=0,o=0,f=0;n=e+i|0;if((i|0)>=20){t=t&255;o=e&3;f=t|t<<8|t<<16|t<<24;a=n&~3;if(o){o=e+4-o|0;while((e|0)<(o|0)){r[e>>0]=t;e=e+1|0}}while((e|0)<(a|0)){s[e>>2]=f;e=e+4|0}}while((e|0)<(n|0)){r[e>>0]=t;e=e+1|0}return e-i|0}function En(e,t,i,r){e=e|0;t=t|0;i=i|0;r=r|0;i=e+i>>>0;return(I=t+r+(i>>>0>>0|0)>>>0,i|0)|0}function An(e,t,i){e=e|0;t=t|0;i=i|0;if((i|0)<32){I=t>>i;return e>>>i|(t&(1<>i-32|0}function Sn(e,t,i){e=e|0;t=t|0;i=i|0;if((i|0)<32){I=t>>>i;return e>>>i|(t&(1<>>i-32|0}function Mn(e,t,i){e=e|0;t=t|0;i=i|0;var n=0;if((i|0)>=4096)return Te(e|0,t|0,i|0)|0;n=e|0;if((e&3)==(t&3)){while(e&3){if(!i)return n|0;r[e>>0]=r[t>>0]|0;e=e+1|0;t=t+1|0;i=i-1|0}while((i|0)>=4){s[e>>2]=s[t>>2];e=e+4|0;t=t+4|0;i=i-4|0}}while((i|0)>0){r[e>>0]=r[t>>0]|0;e=e+1|0;t=t+1|0;i=i-1|0}return n|0}function Tn(e,t,i){e=e|0;t=t|0;i=i|0;var n=0;if((t|0)<(e|0)&(e|0)<(t+i|0)){n=e;t=t+i|0;e=e+i|0;while((i|0)>0){e=e-1|0;t=t-1|0;i=i-1|0;r[e>>0]=r[t>>0]|0}e=n}else Mn(e,t,i)|0;return e|0}function Rn(e,t,i,r){e=e|0;t=t|0;i=i|0;r=r|0;r=t-r-(i>>>0>e>>>0|0)>>>0;return(I=r,e-i>>>0|0)|0}function xn(e,t,i){e=e|0;t=t|0;i=i|0;if((i|0)<32){I=t<>>32-i;return e<>0]|0;if((t|0)<8)return t|0;t=r[b+(e>>8&255)>>0]|0;if((t|0)<8)return t+8|0;t=r[b+(e>>16&255)>>0]|0;if((t|0)<8)return t+16|0;return(r[b+(e>>>24)>>0]|0)+24|0}function In(e,t){e=e|0;t=t|0;var i=0,r=0,n=0,s=0;s=e&65535;n=t&65535;i=te(n,s)|0;r=e>>>16;e=(i>>>16)+(te(n,r)|0)|0;n=t>>>16;t=te(n,s)|0;return(I=(e>>>16)+(te(n,r)|0)+(((e&65535)+t|0)>>>16)|0,e+t<<16|i&65535|0)|0}function Pn(e,t,i,r){e=e|0;t=t|0;i=i|0;r=r|0;var n=0,s=0,a=0,o=0,f=0,h=0;h=t>>31|((t|0)<0?-1:0)<<1;f=((t|0)<0?-1:0)>>31|((t|0)<0?-1:0)<<1;s=r>>31|((r|0)<0?-1:0)<<1;n=((r|0)<0?-1:0)>>31|((r|0)<0?-1:0)<<1;o=Rn(h^e|0,f^t|0,h|0,f|0)|0;a=I;e=s^h;t=n^f;return Rn((Bn(o,a,Rn(s^i|0,n^r|0,s|0,n|0)|0,I,0)|0)^e|0,I^t|0,e|0,t|0)|0}function On(e,t,i,r){e=e|0;t=t|0;i=i|0;r=r|0;var n=0,a=0,o=0,f=0,h=0,c=0;n=l;l=l+16|0;f=n|0;o=t>>31|((t|0)<0?-1:0)<<1;a=((t|0)<0?-1:0)>>31|((t|0)<0?-1:0)<<1;c=r>>31|((r|0)<0?-1:0)<<1;h=((r|0)<0?-1:0)>>31|((r|0)<0?-1:0)<<1;e=Rn(o^e|0,a^t|0,o|0,a|0)|0;t=I;Bn(e,t,Rn(c^i|0,h^r|0,c|0,h|0)|0,I,f)|0;r=Rn(s[f>>2]^o|0,s[f+4>>2]^a|0,o|0,a|0)|0;i=I;l=n;return(I=i,r)|0}function Nn(e,t,i,r){e=e|0;t=t|0;i=i|0;r=r|0;var n=0,s=0;n=e;s=i;i=In(n,s)|0;e=I;return(I=(te(t,s)|0)+(te(r,n)|0)+e|e&0,i|0|0)|0}function Dn(e,t,i,r){e=e|0;t=t|0;i=i|0;r=r|0;return Bn(e,t,i,r,0)|0}function Ln(e,t,i,r){e=e|0;t=t|0;i=i|0;r=r|0;var n=0,a=0;a=l;l=l+16|0;n=a|0;Bn(e,t,i,r,n)|0;l=a;return(I=s[n+4>>2]|0,s[n>>2]|0)|0}function Bn(e,t,i,r,n){e=e|0;t=t|0;i=i|0;r=r|0;n=n|0;var a=0,o=0,f=0,h=0,c=0,l=0,u=0,d=0,p=0,b=0;l=e;h=t;c=h;o=i;d=r;f=d;if(!c){a=(n|0)!=0;if(!f){if(a){s[n>>2]=(l>>>0)%(o>>>0);s[n+4>>2]=0}d=0;n=(l>>>0)/(o>>>0)>>>0;return(I=d,n)|0}else{if(!a){d=0;n=0;return(I=d,n)|0}s[n>>2]=e|0;s[n+4>>2]=t&0;d=0;n=0;return(I=d,n)|0}}a=(f|0)==0;do if(o){if(!a){a=(re(f|0)|0)-(re(c|0)|0)|0;if(a>>>0<=31){u=a+1|0;f=31-a|0;t=a-31>>31;o=u;e=l>>>(u>>>0)&t|c<>>(u>>>0)&t;a=0;f=l<>2]=e|0;s[n+4>>2]=h|t&0;d=0;n=0;return(I=d,n)|0}a=o-1|0;if(a&o|0){f=(re(o|0)|0)+33-(re(c|0)|0)|0;b=64-f|0;u=32-f|0;h=u>>31;p=f-32|0;t=p>>31;o=f;e=u-1>>31&c>>>(p>>>0)|(c<>>(f>>>0))&t;t=t&c>>>(f>>>0);a=l<>>(p>>>0))&h|l<>31;break}if(n|0){s[n>>2]=a&l;s[n+4>>2]=0}if((o|0)==1){p=h|t&0;b=e|0|0;return(I=p,b)|0}else{b=Cn(o|0)|0;p=c>>>(b>>>0)|0;b=c<<32-b|l>>>(b>>>0)|0;return(I=p,b)|0}}else{if(a){if(n|0){s[n>>2]=(c>>>0)%(o>>>0);s[n+4>>2]=0}p=0;b=(c>>>0)/(o>>>0)>>>0;return(I=p,b)|0}if(!l){if(n|0){s[n>>2]=0;s[n+4>>2]=(c>>>0)%(f>>>0)}p=0;b=(c>>>0)/(f>>>0)>>>0;return(I=p,b)|0}a=f-1|0;if(!(a&f)){if(n|0){s[n>>2]=e|0;s[n+4>>2]=a&c|t&0}p=0;b=c>>>((Cn(f|0)|0)>>>0);return(I=p,b)|0}a=(re(f|0)|0)-(re(c|0)|0)|0;if(a>>>0<=30){t=a+1|0;f=31-a|0;o=t;e=c<>>(t>>>0);t=c>>>(t>>>0);a=0;f=l<>2]=e|0;s[n+4>>2]=h|t&0;p=0;b=0;return(I=p,b)|0}while(0);if(!o){c=f;h=0;f=0}else{u=i|0|0;l=d|r&0;c=En(u|0,l|0,-1,-1)|0;i=I;h=f;f=0;do{r=h;h=a>>>31|h<<1;a=f|a<<1;r=e<<1|r>>>31|0;d=e>>>31|t<<1|0;Rn(c|0,i|0,r|0,d|0)|0;b=I;p=b>>31|((b|0)<0?-1:0)<<1;f=p&1;e=Rn(r|0,d|0,p&u|0,(((b|0)<0?-1:0)>>31|((b|0)<0?-1:0)<<1)&l|0)|0;t=I;o=o-1|0}while((o|0)!=0);c=h;h=0}o=0;if(n|0){s[n>>2]=e;s[n+4>>2]=t}p=(a|0)>>>31|(c|o)<<1|(o<<1|a>>>31)&0|h;b=(a<<1|0>>>31)&-2|f;return(I=p,b)|0}function Un(e,t,i,r){e=e|0;t=t|0;i=i|0;r=r|0;return Hs[e&7](t|0,i|0,r|0)|0}function jn(e,t,i,r,n,s){e=e|0;t=t|0;i=i|0;r=r|0;n=n|0;s=s|0;Gs[e&3](t|0,i|0,r|0,n|0,s|0)}function Fn(e,t){e=e|0;t=t|0;Vs[e&15](t|0)}function zn(e,t,i,r,n,s,a){e=e|0;t=t|0;i=i|0;r=r|0;n=n|0;s=s|0;a=a|0;return Ws[e&1](t|0,i|0,r|0,n|0,s|0,a|0)|0}function qn(e,t){e=e|0;t=t|0;return Ks[e&3](t|0)|0}function Hn(e,t,i,r,n,s,a,o){e=e|0;t=t|0;i=i|0;r=r|0;n=n|0;s=s|0;a=a|0;o=o|0;Zs[e&1](t|0,i|0,r|0,n|0,s|0,a|0,o|0)}function Gn(e){e=e|0;Ys[e&0]()}function Vn(e,t,i,r,n){e=e|0;t=t|0;i=i|0;r=r|0;n=n|0;return $s[e&3](t|0,i|0,r|0,n|0)|0}function Wn(e,t,i,r,n,s,a){e=e|0;t=t|0;i=i|0;r=r|0;n=n|0;s=s|0;a=a|0;Xs[e&3](t|0,i|0,r|0,n|0,s|0,a|0)}function Kn(e,t,i,r,n,s){e=e|0;t=t|0;i=i|0;r=r|0;n=n|0;s=s|0;return Js[e&3](t|0,i|0,r|0,n|0,s|0)|0}function Zn(e,t,i,r,n){e=e|0;t=t|0;i=i|0;r=r|0;n=n|0;Qs[e&3](t|0,i|0,r|0,n|0)}function Yn(e,t,i){e=e|0;t=t|0;i=i|0;ne(0);return 0}function $n(e,t,i,r,n){e=e|0;t=t|0;i=i|0;r=r|0;n=n|0;ne(1)}function Xn(e){e=e|0;ne(2)}function Jn(e,t,i,r,n,s){e=e|0;t=t|0;i=i|0;r=r|0;n=n|0;s=s|0;ne(3);return 0}function Qn(e){e=e|0;ne(4);return 0}function es(e,t,i,r,n,s,a){e=e|0;t=t|0;i=i|0;r=r|0;n=n|0;s=s|0;a=a|0;ne(5)}function ts(){ne(6)}function is(e,t,i,r){e=e|0;t=t|0;i=i|0;r=r|0;ne(7);return 0}function rs(e,t,i,r,n,s){e=e|0;t=t|0;i=i|0;r=r|0;n=n|0;s=s|0;ne(8)}function ns(e,t,i,r,n){e=e|0;t=t|0;i=i|0;r=r|0;n=n|0;ne(9);return 0}function ss(e,t,i,r){e=e|0;t=t|0;i=i|0;r=r|0;ne(10)}function as(e){e=e|0;var t=0;t=l;l=l+e|0;l=l+15&-16;return t|0}function os(){return l|0}function fs(e){e=e|0;l=e}function hs(e,t){e=e|0;t=t|0;l=e;u=t}function cs(e,t){e=e|0;t=t|0;if(!m){m=e;w=t}}function ls(e){e=e|0; +r[d>>0]=r[e>>0];r[d+1>>0]=r[e+1>>0];r[d+2>>0]=r[e+2>>0];r[d+3>>0]=r[e+3>>0]}function us(e){e=e|0;r[d>>0]=r[e>>0];r[d+1>>0]=r[e+1>>0];r[d+2>>0]=r[e+2>>0];r[d+3>>0]=r[e+3>>0];r[d+4>>0]=r[e+4>>0];r[d+5>>0]=r[e+5>>0];r[d+6>>0]=r[e+6>>0];r[d+7>>0]=r[e+7>>0]}function ds(e){e=e|0;I=e}function ps(){return I|0}function bs(e,t,i,r,a){e=e|0;t=t|0;i=i|0;r=r|0;a=a|0;var f=0,h=0;if((i|0)>0){f=0;do{h=f<<1;n[t+(f<<1)>>1]=n[t+((h|1)<<1)>>1]<<8|o[t+(h<<1)>>1];f=f+1|0}while((f|0)!=(i|0))}return Ls(s[e+12>>2]|0,t,a,r)|0}function ms(e,t,i,r){e=e|0;t=t|0;i=i|0;r=r|0;var a=0,f=0,h=0;a=e+20|0;f=Rs(s[e+16>>2]|0,t,i,s[a>>2]|0)|0;i=s[e+4>>2]|0;if((te(i,f)|0)<=0)return f|0;a=s[a>>2]|0;i=te(f,i)|0;t=0;do{h=a+(t<<1)|0;e=t<<1;n[r+(e<<1)>>1]=(o[h>>1]|0)&255;n[r+((e|1)<<1)>>1]=(o[h>>1]|0)>>>8;t=t+1|0}while((t|0)!=(i|0));return f|0}function ws(e){e=e|0;return 8}function gs(e){e=e|0;if(!e)return;Hr(s[e+12>>2]|0);Hr(s[e+16>>2]|0);Hr(e);return}function vs(e,t,i){e=e|0;t=t|0;i=i|0;var r=0,n=0,a=0,o=0,f=0,h=0,c=0,u=0;u=l;l=l+16|0;c=u+4|0;h=u;while(1){f=qr(24)|0;if(f|0)break;r=s[8868]|0;s[8868]=r+0;if(!r){o=5;break}Ys[r&0]()}if((o|0)==5){u=dt(4)|0;s[u>>2]=23152;Zt(u|0,296,6)}a=s[e>>2]|0;n=s[t>>2]|0;t=s[i>>2]|0;s[f>>2]=t;s[f+4>>2]=n;s[f+8>>2]=a;e=n*11520|0;e=e>>>0>2147483647?-1:e<<1;e=(e|0)==0?1:e;while(1){r=qr(e)|0;if(r|0){o=11;break}r=s[8868]|0;s[8868]=r+0;if(!r){o=10;break}Ys[r&0]()}if((o|0)==10){u=dt(4)|0;s[u>>2]=23152;Zt(u|0,296,6)}else if((o|0)==11){s[f+20>>2]=r;s[f+12>>2]=Is(a,n,t,c)|0;s[f+16>>2]=Ms(a,n,h)|0;l=u;return f|0}return 0}function _s(e,t,i,r){e=e|0;t=t|0;i=i|0;r=r|0;var n=0,a=0,o=0,f=0;n=l;l=l+16|0;f=n+8|0;o=n+4|0;a=n;s[f>>2]=t;s[o>>2]=i;s[a>>2]=r;e=Hs[e&7](f,o,a)|0;l=n;return e|0}function ys(e,t,i,r,n,a){e=e|0;t=t|0;i=i|0;r=r|0;n=n|0;a=a|0;var o=0,f=0;o=s[e>>2]|0;f=s[e+4>>2]|0;e=t+(f>>1)|0;if(f&1)o=s[(s[e>>2]|0)+o>>2]|0;return Js[o&3](e,i,r,n,a)|0}function ks(e,t,i,r,n){e=e|0;t=t|0;i=i|0;r=r|0;n=n|0;var a=0,o=0;a=s[e>>2]|0;o=s[e+4>>2]|0;e=t+(o>>1)|0;if(o&1)a=s[(s[e>>2]|0)+a>>2]|0;return $s[a&3](e,i,r,n)|0}function Es(){var e=0,t=0;ot(8,16,32,0,27863,2,27866,0,27866,0,27766,27868,11);Ue(8,4,488,27871,1,4);while(1){e=qr(8)|0;if(e|0)break;e=s[8868]|0;s[8868]=e+0;if(!e){t=5;break}Ys[e&0]()}if((t|0)==5){t=dt(4)|0;s[t>>2]=23152;Zt(t|0,296,6)}s[e>>2]=1;s[e+4>>2]=0;Ut(8,27784,6,504,27877,1,e|0,0);while(1){e=qr(8)|0;if(e|0){t=11;break}e=s[8868]|0;s[8868]=e+0;if(!e){t=10;break}Ys[e&0]()}if((t|0)==10){t=dt(4)|0;s[t>>2]=23152;Zt(t|0,296,6)}else if((t|0)==11){s[e>>2]=2;s[e+4>>2]=0;Ut(8,27792,5,528,27885,2,e|0,0);return}}function As(e,t,i,r,n,s,a,o,f,c,l){e=e|0;t=t|0;i=i|0;r=r|0;n=n|0;s=+s;a=+a;o=o|0;f=f|0;c=c|0;l=l|0;var u=0,d=0,p=0,b=0,m=0,w=0,g=0,v=0,_=0,y=0,k=0,E=0,A=0,S=0,M=0,T=0,R=0,x=0;if(s==0&a==0){if((t|0)==(e|0))return;Tn(e|0,t|0,n<<2|0)|0;return}g=(i|0)>15?i:15;M=(r|0)>15?r:15;w=+h[548+(o*12|0)>>2]*s;b=+h[548+(o*12|0)+4>>2]*s;m=+h[548+(o*12|0)+8>>2]*s;E=+h[548+(f*12|0)>>2]*a;A=+h[548+(f*12|0)+4>>2]*a;S=+h[548+(f*12|0)+8>>2]*a;v=1-M|0;_=0-M|0;y=~M;k=-2-M|0;i=s==a&(g|0)==(M|0)&(o|0)==(f|0)?0:l;r=0;s=+h[t+(v<<2)>>2];u=+h[t+(_<<2)>>2];d=+h[t+(y<<2)>>2];p=+h[t+(k<<2)>>2];while(1){if((r|0)>=(i|0))break;R=+h[t+(r-M+2<<2)>>2];T=+h[c+(r<<2)>>2];T=T*T;x=1-T;f=r-g|0;h[e+(r<<2)>>2]=+h[t+(r<<2)>>2]+x*w*+h[t+(f<<2)>>2]+x*b*(+h[t+(f+1<<2)>>2]+ +h[t+(f+-1<<2)>>2])+x*m*(+h[t+(f+2<<2)>>2]+ +h[t+(f+-2<<2)>>2])+T*E*u+T*A*(s+d)+T*S*(R+p);T=s;r=r+1|0;s=R;p=d;d=u;u=T}if(a==0){if((t|0)==(e|0))return;Tn(e+(i<<2)|0,t+(i<<2)|0,n-i<<2|0)|0;return}else{o=e+(r<<2)|0;l=t+(r<<2)|0;i=n-r|0;r=0;p=+h[l+(v<<2)>>2];d=+h[l+(_<<2)>>2];u=+h[l+(y<<2)>>2];s=+h[l+(k<<2)>>2];while(1){if((r|0)>=(i|0))break;R=+h[l+(r-M+2<<2)>>2];h[o+(r<<2)>>2]=+h[l+(r<<2)>>2]+d*E+(p+u)*A+(R+s)*S;x=p;r=r+1|0;p=R;s=u;u=d;d=x}return}}function Ss(e){e=e|0;if((e+7|0)>>>0>7){e=27924;return e|0}e=s[584+(0-e<<2)>>2]|0;return e|0}function Ms(e,t,i){e=e|0;t=t|0;i=i|0;var r=0,a=0,o=0,f=0,h=0,c=0,u=0,d=0,p=0,b=0,m=0,w=0,g=0,v=0;g=l;l=l+16|0;m=g+8|0;p=g;e:do if((e|0)<16e3)if((e|0)<12e3)switch(e|0){case 8e3:{o=2;break e}default:break e}else switch(e|0){case 12e3:{o=2;break e}default:break e}else{if((e|0)<24e3)switch(e|0){case 16e3:{o=2;break e}default:break e}if((e|0)<48e3)switch(e|0){case 24e3:{o=2;break e}default:break e}else switch(e|0){case 48e3:{o=2;break e}default:break e}}while(0);if((o|0)==2?(t+-1|0)>>>0<2:0){d=t*96|0;w=qr((t*8672|0)+88+d+9304|0)|0;if(!w){if(!i){i=0;l=g;return i|0}s[i>>2]=-7;i=0;l=g;return i|0}e:do if((e|0)<16e3)if((e|0)<12e3)switch(e|0){case 8e3:{o=9;break e}default:{r=-1;break e}}else switch(e|0){case 12e3:{o=9;break e}default:{r=-1;break e}}else{if((e|0)<24e3)switch(e|0){case 16e3:{o=9;break e}default:{r=-1;break e}}if((e|0)<48e3)switch(e|0){case 24e3:{o=9;break e}default:{r=-1;break e}}else switch(e|0){case 48e3:{o=9;break e}default:{r=-1;break e}}}while(0);do if((o|0)==9)if((t+-1|0)>>>0<2){kn(w|0,0,(t*8672|0)+88+d+9304|0)|0;s[w+4>>2]=88;s[w>>2]=8632;r=w+88|0;b=w+8632|0;s[w+8>>2]=t;s[w+48>>2]=t;s[w+12>>2]=e;s[w+24>>2]=e;s[w+16>>2]=t;u=0;while(1){if((u|0)==2)break;a=r+(u*4260|0)|0;kn(a|0,0,4260)|0;s[r+(u*4260|0)+2376>>2]=1;s[a>>2]=65536;a=r+(u*4260|0)+2340|0;f=s[a>>2]|0;o=32767/(f+1|0)|0;h=0;c=0;while(1){if((c|0)>=(f|0))break;v=h+o|0;n[r+(u*4260|0)+4052+(c<<1)>>1]=v;f=s[a>>2]|0;h=v;c=c+1|0}s[r+(u*4260|0)+4148>>2]=0;s[r+(u*4260|0)+4152>>2]=3176576;s[r+(u*4260|0)+4168>>2]=s[r+(u*4260|0)+2328>>2]<<7;s[r+(u*4260|0)+4240>>2]=65536;s[r+(u*4260|0)+4244>>2]=65536;s[r+(u*4260|0)+4256>>2]=20;s[r+(u*4260|0)+4252>>2]=2;u=u+1|0}v=w+8608|0;s[v>>2]=0;s[v+4>>2]=0;s[v+8>>2]=0;s[w+8628>>2]=0;if(t>>>0<=2){kn(b|0,0,(t*8672|0)+88+d+672|0)|0;s[b>>2]=5304;s[w+8636>>2]=120;s[w+8640>>2]=t;s[w+8644>>2]=t;a=w+8648|0;s[a>>2]=1;s[w+8652>>2]=0;s[w+8656>>2]=21;s[w+8660>>2]=1;s[w+8664>>2]=0;ni(b,4028,p);e:do if((e|0)<16e3)if((e|0)<12e3){switch(e|0){case 8e3:break;default:{o=22;break e}}r=6;o=23;break}else{switch(e|0){case 12e3:break;default:{o=22;break e}}r=4;o=23;break}else{if((e|0)<24e3){switch(e|0){case 16e3:break;default:{o=22;break e}}r=3;o=23;break}if((e|0)>=48e3)switch(e|0){case 48e3:{r=1;o=23;break e}default:{o=22;break e}}switch(e|0){case 24e3:break;default:{o=22;break e}}r=2;o=23}while(0);if((o|0)==22){s[a>>2]=0;r=-3;break}else if((o|0)==23){s[a>>2]=r;s[m>>2]=0;ni(b,10016,m);s[w+60>>2]=0;s[w+64>>2]=(e|0)/400|0;s[w+44>>2]=0;r=0;break}}else r=-3}else r=-1;while(0);if(i|0)s[i>>2]=r;if(!r){v=w;l=g;return v|0}Hr(w);v=0;l=g;return v|0}if(!i){v=0;l=g;return v|0}s[i>>2]=-1;v=0;l=g;return v|0}function Ts(e,t,i,r,o,f){e=e|0;t=t|0;i=i|0;r=r|0;o=o|0;f=f|0;var c=0,u=0,d=0,p=0,b=0,m=0,w=0,g=0,v=0,_=0,y=0,k=0,E=0,A=0,S=0,M=0,T=0,R=0,x=0,C=0,I=0,P=0,O=0,N=0,D=0,L=0,B=0,U=0,j=0,F=0,z=0,q=0,H=0,G=0,V=0,W=0,K=0,Z=0,Y=0,$=0,X=0,Q=0,ee=0,ie=0,ne=0,se=0,ae=0,oe=0;oe=l;l=l+160|0;$=oe+80|0;Y=oe+72|0;Z=oe+64|0;W=oe+56|0;H=oe+48|0;z=oe+40|0;F=oe+32|0;j=oe+24|0;U=oe+16|0;B=oe+8|0;L=oe;se=oe+96|0;T=oe+92|0;ae=oe+88|0;q=oe+144|0;V=oe+84|0;s[ae>>2]=0;M=e+(s[e+4>>2]|0)|0;K=e+(s[e>>2]|0)|0;ie=e+12|0;c=s[ie>>2]|0;G=(c|0)/50|0;S=G>>1;ee=G>>2;ne=G>>3;if((ne|0)>(o|0)){e=-2;l=oe;return e|0}c=((c|0)/25|0)*3|0;c=(c|0)>(o|0)?o:c;do if((i|0)>=2)if(t){p=s[e+64>>2]|0;d=s[e+56>>2]|0;s[se>>2]=t;s[se+4>>2]=i;s[se+8>>2]=0;s[se+12>>2]=0;s[se+16>>2]=0;w=se+20|0;s[w>>2]=9;g=se+24|0;s[g>>2]=0;v=se+28|0;s[v>>2]=128;s[g>>2]=1;E=a[t>>0]|0;_=se+40|0;s[_>>2]=E;A=E>>>1^127;y=se+32|0;s[y>>2]=A;s[se+44>>2]=0;u=128;o=9;m=1;while(1){if(u>>>0>=8388609)break;o=o+8|0;s[w>>2]=o;u=u<<8;s[v>>2]=u;if(m>>>0>>0){Q=m+1|0;s[g>>2]=Q;k=a[t+m>>0]|0;m=Q}else k=0;s[_>>2]=k;Q=((E<<8|k)>>>1&255|A<<8&2147483392)^255;s[y>>2]=Q;E=k;A=Q}o=s[e+60>>2]|0;if((o|0)>0){o=(o|0)==1002;if((d|0)!=1002){if(!o){o=t;u=c;C=27;break}I=te(ee,s[e+8>>2]|0)|0;Q=Ne()|0;X=p;P=0;O=1;break}if(!o?(s[e+68>>2]|0)==0:0){X=te(ee,s[e+8>>2]|0)|0;Q=Ne()|0;P=l;l=l+((1*(X<<2)|0)+15&-16)|0;Ts(e,0,0,P,(ee|0)<(p|0)?ee:p,0)|0;X=p;d=1002;I=1;O=1}else{o=t;u=c;d=1002;C=27}}else{o=t;u=c;C=27}}else C=10;else{C=s[e+64>>2]|0;c=(c|0)<(C|0)?c:C;C=10}while(0);do if((C|0)==10){d=s[e+60>>2]|0;if(!d){o=e+8|0;u=0;while(1){if((u|0)>=(te(c,s[o>>2]|0)|0))break;h[r+(u<<2)>>2]=0;u=u+1|0}l=oe;return c|0}if((c|0)<=(G|0)){if((c|0)>=(G|0)){o=0;u=c;p=c;C=27;break}if((c|0)>(S|0)){o=0;u=c;p=S;C=27;break}if((d|0)==1e3){o=0;u=c;p=c;d=1e3;C=27;break}o=0;u=c;p=(c|0)>(ee|0)&(c|0)<(S|0)?ee:c;C=27;break}p=e+8|0;o=r;d=c;while(1){u=Ts(e,0,0,o,(d|0)<(G|0)?d:G,0)|0;if((u|0)<0){c=u;C=158;break}d=d-u|0;o=o+((te(u,s[p>>2]|0)|0)<<2)|0;if((d|0)<=0){C=158;break}}if((C|0)==158){l=oe;return c|0}}while(0);if((C|0)==27){t=o;c=u;Q=Ne()|0;X=p;P=0;I=1;O=0}e:do if((X|0)>(c|0))c=-1;else{if((d|0)==1002){T=l;l=l+16|0;d=1002}else{_=e+8|0;c=s[_>>2]|0;if((S|0)>(X|0)){S=(te(S,c)|0)<<1;v=l;l=l+((1*S|0)+15&-16)|0}else{S=(te(X,c)|0)<<1;v=l;l=l+((1*S|0)+15&-16)|0}if((s[e+60>>2]|0)==1002){w=0;while(1){if((w|0)==2)break;c=M+(w*4260|0)|0;kn(c|0,0,4260)|0;s[M+(w*4260|0)+2376>>2]=1;s[c>>2]=65536;c=M+(w*4260|0)+2340|0;u=s[c>>2]|0;o=32767/(u+1|0)|0;p=0;m=0;while(1){if((m|0)>=(u|0))break;S=p+o|0;n[M+(w*4260|0)+4052+(m<<1)>>1]=S;u=s[c>>2]|0;p=S;m=m+1|0}s[M+(w*4260|0)+4148>>2]=0;s[M+(w*4260|0)+4152>>2]=3176576;s[M+(w*4260|0)+4168>>2]=s[M+(w*4260|0)+2328>>2]<<7;s[M+(w*4260|0)+4240>>2]=65536;s[M+(w*4260|0)+4244>>2]=65536;s[M+(w*4260|0)+4256>>2]=20;s[M+(w*4260|0)+4252>>2]=2;w=w+1|0}S=M+8520|0;s[S>>2]=0;s[S+4>>2]=0;s[S+8>>2]=0;s[M+8540>>2]=0}S=(X*1e3|0)/(s[ie>>2]|0)|0;s[e+32>>2]=(S|0)<10?10:S;if(!t)p=1;else{s[e+20>>2]=s[e+48>>2];t:do if((d|0)==1e3)switch(s[e+52>>2]|0){case 1101:{s[e+28>>2]=8e3;break t}case 1102:{s[e+28>>2]=12e3;break t}case 1103:{s[e+28>>2]=16e3;break t}default:{s[e+28>>2]=16e3;break t}}else s[e+28>>2]=16e3;while(0);p=f<<1}u=e+16|0;m=(p|0)==0;w=0;g=v;while(1){t:do if(!(Pi(M,u,p,(w|0)==0&1,se,g,T)|0))c=s[_>>2]|0;else{if(m){c=-3;break e}s[T>>2]=X;o=0;while(1){c=s[_>>2]|0;if((o|0)>=(te(X,c)|0))break t;n[g+(o<<1)>>1]=0;o=o+1|0}}while(0);S=s[T>>2]|0;w=w+S|0;g=g+((te(S,c)|0)<<1)|0;if((w|0)>=(X|0)){T=v;break}}}M=(f|0)==0;do if(M)if((d|0)!=1002)if((t|0)!=0?(N=se+20|0,x=s[N>>2]|0,D=se+28|0,R=s[D>>2]|0,C=x+((re(R|0)|0)+-32)+17|0,(C+((s[e+56>>2]|0)==1001?20:0)|0)<=(i<<3|0)):0){E=(d|0)==1001;A=se+32|0;o=s[A>>2]|0;if(E){c=R>>>12;_=o>>>0>>0;y=_&1;if(!_){o=o-c|0;s[A>>2]=o;c=R-c|0}s[D>>2]=c;w=se+40|0;g=se+24|0;v=se+4|0;u=c;c=x;while(1){if(u>>>0>=8388609)break;c=c+8|0;s[N>>2]=c;p=u<<8;s[D>>2]=p;m=s[w>>2]|0;u=s[g>>2]|0;if(u>>>0<(s[v>>2]|0)>>>0){s[g>>2]=u+1;u=a[(s[se>>2]|0)+u>>0]|0}else u=0;s[w>>2]=u;C=((m<<8|u)>>>1&255|o<<8&2147483392)^255;s[A>>2]=C;u=p;o=C}if(_){m=u;p=o}else{c=i;o=0;u=0;p=0;C=90;break}}else{m=R;p=o;c=x;y=1}u=m>>>1;C=p>>>0>>0;o=C&1;if(!C){p=p-u|0;s[A>>2]=p;u=m-u|0}s[D>>2]=u;v=se+40|0;_=se+24|0;k=se+4|0;while(1){if(u>>>0>=8388609)break;c=c+8|0;s[N>>2]=c;u=u<<8;s[D>>2]=u;w=s[v>>2]|0;m=s[_>>2]|0;if(m>>>0<(s[k>>2]|0)>>>0){s[_>>2]=m+1;m=a[(s[se>>2]|0)+m>>0]|0}else m=0;s[v>>2]=m;C=((w<<8|m)>>>1&255|p<<8&2147483392)^255;s[A>>2]=C;p=C}if(E){C=u>>>8;s[se+36>>2]=C;g=(p>>>0)/(C>>>0)|0;x=g+1|0;g=256-(x+(x>>>0>256?255-g|0:0))|0;x=te(C,255-g|0)|0;w=p-x|0;s[A>>2]=w;u=(g|0)==0?u-x|0:C;s[D>>2]=u;while(1){if(u>>>0>=8388609)break;c=c+8|0;s[N>>2]=c;u=u<<8;s[D>>2]=u;m=s[v>>2]|0;p=s[_>>2]|0;if(p>>>0<(s[k>>2]|0)>>>0){s[_>>2]=p+1;p=a[(s[se>>2]|0)+p>>0]|0}else p=0;s[v>>2]=p;C=((m<<8|p)>>>1&255|w<<8&2147483392)^255;s[A>>2]=C;w=C}p=g+2|0}else p=i-(c+((re(u|0)|0)+-32)+7>>3)|0;C=i-p|0;u=(C<<3|0)<(c+((re(u|0)|0)+-32)|0);p=u?0:p;s[k>>2]=(s[k>>2]|0)-p;c=u?0:C;u=u?0:y;C=90}else{c=i;o=0;u=0;p=0;C=91}else{S=i;A=0;u=0;p=0;o=0}else{c=i;o=0;u=0;p=0;C=90}while(0);if((C|0)==90)if((d|0)==1002){S=c;A=o;o=0}else C=91;if((C|0)==91){S=c;A=o;o=17}switch(s[e+52>>2]|0){case 1101:{c=13;break}case 1103:case 1102:{c=17;break}case 1104:{c=19;break}default:c=21}s[L>>2]=c;ni(K,10012,L);s[B>>2]=s[e+48>>2];ni(K,10008,B);E=(u|0)==0;if(!E){B=(te(ee,s[e+8>>2]|0)|0)<<2;c=l;l=l+((1*B|0)+15&-16)|0;if(!A){g=c;k=P;v=0}else{s[U>>2]=0;ni(K,10010,U);si(K,t+S|0,p,c,ee,0,0)|0;s[j>>2]=ae;ni(K,4031,j);g=c;k=P;v=0}}else{c=l;l=l+((1*(I<<2)|0)+15&-16)|0;do if(!((O|0)==0|(d|0)==1002))if((ee|0)<(X|0)){Ts(e,0,0,c,ee,0)|0;break}else{Ts(e,0,0,c,X,0)|0;break}else c=P;while(0);g=l;l=l+16|0;k=c;v=O}s[F>>2]=o;ni(K,10010,F);do if((d|0)==1e3){n[q>>1]=-1;c=e+8|0;o=0;while(1){if((o|0)>=(te(X,s[c>>2]|0)|0))break;h[r+(o<<2)>>2]=0;o=o+1|0}if((s[e+60>>2]|0)==1001){if(!(E|(A|0)==0)?s[e+68>>2]|0:0){c=0;d=1e3;C=116;break}s[H>>2]=0;ni(K,10010,H);si(K,q,2,r,ne,0,0)|0;c=0;d=1e3;C=116}else{c=0;d=1e3;C=116}}else{c=(G|0)<(X|0)?G:X;G=s[e+60>>2]|0;if((d|0)!=(G|0)&(G|0)>0?(s[e+68>>2]|0)==0:0)ni(K,4028,z);c=si(K,M?t:0,S,r,c,se,0)|0;if((d|0)==1002){y=c;_=d}else C=116}while(0);t:do if((C|0)==116){o=e+8|0;u=0;while(1){if((u|0)>=(te(X,s[o>>2]|0)|0)){y=c;_=d;break t}G=r+(u<<2)|0;h[G>>2]=+h[G>>2]+ +(n[T+(u<<1)>>1]|0)*30517578125e-15;u=u+1|0}}while(0);s[W>>2]=V;ni(K,10015,W);w=s[(s[V>>2]|0)+60>>2]|0;t:do if(!E){if(!A){ni(K,4028,Z);s[Y>>2]=0;ni(K,10010,Y);si(K,t+S|0,p,g,ee,0,0)|0;s[$>>2]=ae;ni(K,4031,$);p=s[e+8>>2]|0;m=r+((te(p,X-ne|0)|0)<<2)|0;c=g+((te(p,ne)|0)<<2)|0;o=48e3/(s[ie>>2]|0)|0;u=0;while(1){if((u|0)<(p|0))d=0;else break t;while(1){if((d|0)>=(ne|0))break;b=+h[w+((te(d,o)|0)<<2)>>2];b=b*b;Y=(te(d,p)|0)+u|0;$=m+(Y<<2)|0;h[$>>2]=b*+h[c+(Y<<2)>>2]+(1-b)*+h[$>>2];d=d+1|0}u=u+1|0}}o=e+8|0;u=0;while(1){m=s[o>>2]|0;if((u|0)<(m|0))c=0;else break;while(1){if((c|0)>=(ne|0))break;$=(te(s[o>>2]|0,c)|0)+u|0;s[r+($<<2)>>2]=s[g+($<<2)>>2];c=c+1|0}u=u+1|0}o=te(m,ne)|0;c=g+(o<<2)|0;o=r+(o<<2)|0;u=48e3/(s[ie>>2]|0)|0;d=0;while(1){if((d|0)<(m|0))p=0;else break t;while(1){if((p|0)>=(ne|0))break;b=+h[w+((te(p,u)|0)<<2)>>2];b=b*b;Y=(te(p,m)|0)+d|0;$=o+(Y<<2)|0;h[$>>2]=b*+h[$>>2]+(1-b)*+h[c+(Y<<2)>>2];p=p+1|0}d=d+1|0}}while(0);t:do if(v|0){o=e+8|0;if((X|0)<(ee|0)){d=s[o>>2]|0;c=48e3/(s[ie>>2]|0)|0;o=0;while(1){if((o|0)<(d|0))u=0;else break t;while(1){if((u|0)>=(ne|0))break;b=+h[w+((te(u,c)|0)<<2)>>2];b=b*b;ee=(te(u,d)|0)+o|0;ie=r+(ee<<2)|0;h[ie>>2]=b*+h[ie>>2]+(1-b)*+h[k+(ee<<2)>>2];u=u+1|0}o=o+1|0}}else c=0;while(1){m=s[o>>2]|0;u=te(m,ne)|0;if((c|0)>=(u|0))break;s[r+(c<<2)>>2]=s[k+(c<<2)>>2];c=c+1|0}p=k+(u<<2)|0;d=r+(u<<2)|0;c=48e3/(s[ie>>2]|0)|0;o=0;while(1){if((o|0)<(m|0))u=0;else break t;while(1){if((u|0)>=(ne|0))break;b=+h[w+((te(u,c)|0)<<2)>>2];b=b*b;ee=(te(u,m)|0)+o|0;ie=d+(ee<<2)|0;h[ie>>2]=b*+h[ie>>2]+(1-b)*+h[p+(ee<<2)>>2];u=u+1|0}o=o+1|0}}while(0);c=s[e+40>>2]|0;t:do if(c|0){b=+J(+(+(c|0)*.0006488140788860619*.6931471805599453));c=e+8|0;o=0;while(1){if((o|0)>=(te(X,s[c>>2]|0)|0))break t;ne=r+(o<<2)|0;h[ne>>2]=+h[ne>>2]*b;o=o+1|0}}while(0);if((S|0)<2)c=0;else c=s[se+28>>2]^s[ae>>2];s[e+84>>2]=c;s[e+60>>2]=_;s[e+68>>2]=(A|0)==0&(E^1)&1;c=(y|0)<0?y:X}while(0);qe(Q|0);e=c;l=oe;return e|0}function Rs(e,t,i,o){e=e|0;t=t|0;i=i|0;o=o|0;var f=0,c=0,u=0,p=0,b=0,m=0,w=0,g=0,v=0,_=0,y=0,k=0,E=0,A=0,S=0,M=0,T=0,R=0,x=0,C=0,I=0;x=l;l=l+112|0;A=x;E=x+104|0;S=x+8|0;v=(t|0)==0;do if((i|0)>0&(v^1)){m=s[e+12>>2]|0;u=r[t>>0]|0;p=u&255;e:do switch(p&3|0){case 0:{b=1;break}case 3:if((i|0)<2){o=-4;l=x;return o|0}else{c=a[t+1>>0]&63;_=5;break e}default:{c=2;_=5}}while(0);if((_|0)==5)b=c;do if(u<<24>>24>=0)if((u&96)==96)if(!(u&8)){c=(m|0)/100|0;break}else{c=(m|0)/50|0;break}else{c=p>>>3&3;if((c|0)==3){c=(m*60|0)/1e3|0;break}else{c=(m<>>3&3)|0)/400|0;while(0);c=te(b,c)|0;if((c*25|0)<=(m*3|0)&(c|0)>0){k=(c|0)>5760?5760:c;break}else{o=-4;l=x;return o|0}}else k=5760;while(0);M=e+8|0;c=te(k,s[M>>2]|0)|0;T=Ne()|0;R=l;l=l+((1*(c<<2)|0)+15&-16)|0;c=(i|0)==0;e:do if(c|v)if(!((k|0)%((s[e+12>>2]|0)/400|0|0)|0))if(c|v){u=0;do{c=Ts(e,0,0,R+((te(u,s[M>>2]|0)|0)<<2)|0,k-u|0,0)|0;if((c|0)<0){u=c;break e}u=u+c|0}while((u|0)<(k|0));s[e+72>>2]=u}else _=23;else u=-1;else _=23;while(0);e:do if((_|0)==23)if((i|0)>=0){m=r[t>>0]|0;do if(m<<24>>24>=0){_=(m&96)==96;b=_?1001:1e3;if(_)p=(m&16)>>>4|1104;else p=((m&255)>>>5&3)+1101|0;c=s[e+12>>2]|0;if((m&96)==96)if(!(m&8)){v=(c|0)/100|0;break}else{v=(c|0)/50|0;break}else{u=(m&255)>>>3&3;if((u|0)==3){v=(c*60|0)/1e3|0;break}else{v=(c<>>5&3;v=(s[e+12>>2]<<((m&255)>>>3&3)|0)/400|0;p=(p|0)==0?1101:p+1102|0;b=1002}while(0);c=((m&4)>>>2)+1|0;u=rr(t,i,0,E,0,S,A,0)|0;if((u|0)>=0)if((te(u,v)|0)<=(k|0)){m=t+(s[A>>2]|0)|0;s[e+56>>2]=b;s[e+52>>2]=p;s[e+64>>2]=v;s[e+48>>2]=c;c=m;m=0;t=0;while(1){if((m|0)>=(u|0))break;p=S+(m<<1)|0;b=Ts(e,c,n[p>>1]|0,R+((te(t,s[M>>2]|0)|0)<<2)|0,k-t|0,0)|0;if((b|0)<0){u=b;break e}c=c+(n[p>>1]|0)|0;m=m+1|0;t=t+b|0}s[e+72>>2]=t;E=s[M>>2]|0;if((E|0)<1|(t|0)<1)u=t;else{c=te(t,E)|0;u=0;while(1){if((u|0)>=(c|0)){i=0;break}S=R+(u<<2)|0;y=+h[S>>2];i=y>2;A=y<-2&(i^1);h[S>>2]=A|i?A?-2:2:y;u=u+1|0}while(1){if((i|0)==(E|0)){u=t;break e}_=R+(i<<2)|0;k=e+76+(i<<2)|0;f=+h[k>>2];u=0;while(1){if((u|0)>=(t|0))break;c=_+((te(u,E)|0)<<2)|0;w=+h[c>>2];g=w*f;if(g>=0)break;h[c>>2]=w+g*w;u=u+1|0}y=+h[_>>2];m=0;while(1){u=m;while(1){if((u|0)>=(t|0))break;g=+h[_+((te(u,E)|0)<<2)>>2];if(g>1|g<-1)break;u=u+1|0}if((u|0)==(t|0)){f=0;break}g=+h[_+((te(u,E)|0)<<2)>>2];f=+q(+g);p=u;while(1){if((p|0)<=0){v=u;w=f;b=u;break}c=p+-1|0;if(!(g*+h[_+((te(c,E)|0)<<2)>>2]>=0)){v=u;w=f;b=u;break}else p=c}while(1){if((v|0)>=(t|0))break;f=+h[_+((te(v,E)|0)<<2)>>2];if(!(g*f>=0))break;f=+q(+f);A=f>w;S=A?v:b;v=v+1|0;w=A?f:w;b=S}if(!p)u=g*+h[_>>2]>=0;else u=0;f=(w+-1)/(w*w);f=f+f*2.4e-7;f=g>0?-f:f;c=p;while(1){if((c|0)>=(v|0))break;S=_+((te(c,E)|0)<<2)|0;g=+h[S>>2];h[S>>2]=g+f*g*g;c=c+1|0}t:do if(u&(b|0)>1){w=y-+h[_>>2];g=w/+(b|0);c=m;while(1){if((c|0)>=(b|0))break t;C=w-g;S=_+((te(c,E)|0)<<2)|0;I=+h[S>>2]+C;h[S>>2]=I;m=I>1;A=I<-1&(m^1);h[S>>2]=A|m?A?-1:1:I;c=c+1|0;w=C}}while(0);if((v|0)==(t|0))break;else m=v}h[k>>2]=f;i=i+1|0}}}else u=-2}else u=-1;while(0);e:do if((u|0)>0){p=0;while(1){if((p|0)>=(te(u,s[M>>2]|0)|0))break e;f=+h[R+(p<<2)>>2]*32768;if(f>-32768){if(!(f<32767))f=32767}else f=-32768;c=(h[d>>2]=f,s[d>>2]|0);if((c&2130706432)>>>0<=1249902592){c=(c|0)<0;f=c?f+-8388608+8388608:f+8388608+-8388608;if(f==0)f=c?-0:0}n[o+(p<<1)>>1]=~~f;p=p+1|0}}while(0);qe(T|0);o=u;l=x;return o|0}function xs(e,t,i){e=e|0;t=t|0;i=i|0;var r=0,a=0,o=0,f=0,h=0,c=0,u=0,d=0;u=l;l=l+32|0;a=u+8|0;o=u;h=u+16|0;r=s[e+4>>2]|0;f=e+(s[e>>2]|0)|0;s[h>>2]=i;e:do switch(t|0){case 4009:{c=(s[h>>2]|0)+(4-1)&~(4-1);r=s[c>>2]|0;s[h>>2]=c+4;if(!r)t=26;else{s[r>>2]=s[e+52>>2];r=0;t=25}break}case 4031:{c=(s[h>>2]|0)+(4-1)&~(4-1);r=s[c>>2]|0;s[h>>2]=c+4;if(!r)t=26;else{s[r>>2]=s[e+84>>2];r=0;t=25}break}case 4028:{h=e+r|0;c=e+48|0;r=c;t=r+40|0;do{s[r>>2]=0;r=r+4|0}while((r|0)<(t|0));ni(f,4028,o);f=0;while(1){if((f|0)==2)break;r=h+(f*4260|0)|0;kn(r|0,0,4260)|0;s[h+(f*4260|0)+2376>>2]=1;s[r>>2]=65536;r=h+(f*4260|0)+2340|0;i=s[r>>2]|0;t=32767/(i+1|0)|0;a=0;o=0;while(1){if((o|0)>=(i|0))break;d=a+t|0;n[h+(f*4260|0)+4052+(o<<1)>>1]=d;i=s[r>>2]|0;a=d;o=o+1|0}s[h+(f*4260|0)+4148>>2]=0;s[h+(f*4260|0)+4152>>2]=3176576;s[h+(f*4260|0)+4168>>2]=s[h+(f*4260|0)+2328>>2]<<7;s[h+(f*4260|0)+4240>>2]=65536;s[h+(f*4260|0)+4244>>2]=65536;s[h+(f*4260|0)+4256>>2]=20;s[h+(f*4260|0)+4252>>2]=2;f=f+1|0}r=h+8520|0;s[r>>2]=0;s[r+4>>2]=0;s[r+8>>2]=0;s[h+8540>>2]=0;s[c>>2]=s[e+8>>2];s[e+64>>2]=(s[e+12>>2]|0)/400|0;r=0;t=25;break}case 4029:{d=(s[h>>2]|0)+(4-1)&~(4-1);r=s[d>>2]|0;s[h>>2]=d+4;if(!r)t=26;else{s[r>>2]=s[e+12>>2];r=0;t=25}break}case 4033:{d=(s[h>>2]|0)+(4-1)&~(4-1);r=s[d>>2]|0;s[h>>2]=d+4;if(r)if((s[e+60>>2]|0)==1002){s[a>>2]=r;ni(f,4033,a);r=0;t=25;break e}else{s[r>>2]=s[e+36>>2];r=0;t=25;break e}else t=26;break}case 4045:{d=(s[h>>2]|0)+(4-1)&~(4-1);r=s[d>>2]|0;s[h>>2]=d+4;if(!r)t=26;else{s[r>>2]=s[e+40>>2];r=0;t=25}break}case 4034:{d=(s[h>>2]|0)+(4-1)&~(4-1);r=s[d>>2]|0;s[h>>2]=d+4;if((r+32768|0)>>>0>65535)t=26;else{s[e+40>>2]=r;r=0;t=25}break}case 4039:{d=(s[h>>2]|0)+(4-1)&~(4-1);r=s[d>>2]|0;s[h>>2]=d+4;if(!r)t=26;else{s[r>>2]=s[e+72>>2];r=0;t=25}break}default:{r=-5;t=25}}while(0);if((t|0)==25){d=r;l=u;return d|0}else if((t|0)==26){d=-1;l=u;return d|0}return 0}function Cs(e){e=e|0;Hr(e);return}function Is(e,t,i,r){e=e|0;t=t|0;i=i|0;r=r|0;var a=0,o=0,f=0,c=0,u=0,d=0,p=0,b=0,m=0,w=0,g=0,v=0;v=l;l=l+32|0;m=v+16|0;b=v+8|0;u=v;e:do if((e|0)<16e3)if((e|0)<12e3)switch(e|0){case 8e3:{g=2;break e}default:break e}else switch(e|0){case 12e3:{g=2;break e}default:break e}else{if((e|0)<24e3)switch(e|0){case 16e3:{g=2;break e}default:break e}if((e|0)<48e3)switch(e|0){case 24e3:{g=2;break e}default:break e}else switch(e|0){case 48e3:{g=2;break e}default:break e}}while(0);e:do if((g|0)==2?(t+-1|0)>>>0<2:0){switch(i|0){case 2048:case 2049:case 2051:break;default:break e}f=t<<12;w=qr((t*480|0)+212+f+(t*336|0)+39448|0)|0;if(!w){if(!r){g=0;l=v;return g|0}s[r>>2]=-7;g=0;l=v;return g|0}t:do if((e|0)<16e3)if((e|0)<12e3)switch(e|0){case 8e3:{g=10;break t}default:{a=-1;break t}}else switch(e|0){case 12e3:{g=10;break t}default:{a=-1;break t}}else{if((e|0)<24e3)switch(e|0){case 16e3:{g=10;break t}default:{a=-1;break t}}if((e|0)<48e3)switch(e|0){case 24e3:{g=10;break t}default:{a=-1;break t}}else switch(e|0){case 48e3:{g=10;break t}default:{a=-1;break t}}}while(0);t:do if((g|0)==10)if((t+-1|0)>>>0<2){switch(i|0){case 2048:case 2049:case 2051:break;default:{a=-1;break t}}kn(w|0,0,(t*480|0)+212+f+(t*336|0)+39448|0)|0;s[w+4>>2]=19048;s[w>>2]=39448;d=w+39448|0;s[w+112>>2]=t;s[w+15104>>2]=t;p=w+144|0;s[p>>2]=e;o=w+180|0;s[o>>2]=0;a=w+8|0;if(!(Oi(w+19048|0,0,a)|0)){s[a>>2]=t;s[w+12>>2]=t;s[w+16>>2]=s[p>>2];s[w+20>>2]=16e3;s[w+24>>2]=8e3;s[w+28>>2]=16e3;s[w+32>>2]=20;s[w+36>>2]=25e3;s[w+40>>2]=0;c=w+44|0;s[c>>2]=9;s[w+48>>2]=0;s[w+56>>2]=0;s[w+60>>2]=0;s[w+76>>2]=0;a=s[o>>2]|0;kn(d|0,0,(t*480|0)+212+f+(t*336|0)|0)|0;s[d>>2]=5304;s[w+39452>>2]=t;s[w+39456>>2]=t;o=w+39476|0;s[o>>2]=1;s[w+39480>>2]=0;s[w+39484>>2]=21;s[w+39496>>2]=1;s[w+39520>>2]=a;s[w+39500>>2]=1;s[w+39464>>2]=1;s[w+39488>>2]=-1;s[w+39492>>2]=0;s[w+39460>>2]=0;s[w+39472>>2]=5;s[w+39508>>2]=24;qs(d,4028,u)|0;i:do if((e|0)<16e3)if((e|0)<12e3){switch(e|0){case 8e3:break;default:{g=18;break i}}a=6;break}else{switch(e|0){case 12e3:break;default:{g=18;break i}}a=4;break}else{if((e|0)<24e3){switch(e|0){case 16e3:break;default:{g=18;break i}}a=3;break}if((e|0)>=48e3)switch(e|0){case 48e3:{a=1;break i}default:{g=18;break i}}switch(e|0){case 24e3:break;default:{g=18;break i}}a=2}while(0);if((g|0)==18)a=0;s[o>>2]=a;s[b>>2]=0;qs(d,10016,b)|0;s[m>>2]=s[c>>2];qs(d,4010,m)|0;s[w+148>>2]=1;s[w+152>>2]=1;s[w+164>>2]=-1e3;s[w+160>>2]=(te(e,t)|0)+3e3;s[w+108>>2]=i;s[w+124>>2]=-1e3;s[w+128>>2]=-1e3;s[w+132>>2]=1105;s[w+120>>2]=-1e3;s[w+136>>2]=-1e3;s[w+140>>2]=-1;a=s[p>>2]|0;s[w+172>>2]=(a|0)/100|0;s[w+168>>2]=24;s[w+156>>2]=5e3;s[w+116>>2]=(a|0)/250|0;n[w+15108>>1]=16384;h[w+15116>>2]=1;s[w+15112>>2]=193536;s[w+15164>>2]=1;s[w+15136>>2]=1001;s[w+15152>>2]=1105;kn(w+188|0,0,14916)|0;a=0}else a=-3}else a=-1;while(0);if(r|0)s[r>>2]=a;if(!a){g=w;l=v;return g|0}Hr(w);g=0;l=v;return g|0}while(0);if(!r){g=0;l=v;return g|0}s[r>>2]=-1;g=0;l=v;return g|0}function Ps(e,t,i,r,s,a,o){e=e|0;t=t|0;i=i|0;r=r|0;s=s|0;a=a|0;o=o|0;var f=0,c=0,l=0,u=0;c=0;while(1){if((c|0)>=(i|0))break;h[t+(c<<2)>>2]=+(n[e+((te(c+r|0,o)|0)+s<<1)>>1]|0);c=c+1|0}l=(a|0)>-1;e:do if(!l)if((a|0)==-2){s=1;while(1){if((s|0)<(o|0))c=0;else{s=12;break e}while(1){if((c|0)>=(i|0))break;f=+(n[e+((te(c+r|0,o)|0)+s<<1)>>1]|0);u=t+(c<<2)|0;h[u>>2]=+h[u>>2]+f;c=c+1|0}s=s+1|0}}else s=14;else{s=0;while(1){if((s|0)>=(i|0)){s=12;break e}f=+(n[e+((te(s+r|0,o)|0)+a<<1)>>1]|0);u=t+(s<<2)|0;h[u>>2]=+h[u>>2]+f;s=s+1|0}}while(0);if((s|0)==12)if((a|0)==-2)f=30517578125e-15/+(o|0);else s=14;if((s|0)==14)f=l?152587890625e-16:30517578125e-15;s=0;while(1){if((s|0)>=(i|0))break;u=t+(s<<2)|0;h[u>>2]=+h[u>>2]*f;s=s+1|0}return}function Os(e,t,i,r,n,a,o,f){e=e|0;t=t|0;i=i|0;r=r|0;n=n|0;a=a|0;o=o|0;f=f|0;var c=0,u=0,p=0,b=0,m=0,w=0,g=0,v=0,_=0,y=0,k=0,E=0,A=0,S=0,M=0,T=0,R=0,x=0,C=0,I=0,P=0;C=l;l=l+3296|0;M=C+1760|0;R=C+224|0;x=C+112|0;S=C;w=(r|0)/400|0;g=l;l=l+((1*(w<<2)|0)+15&-16)|0;T=s[a>>2]|0;s[x>>2]=T;h[S>>2]=1/((s[d>>2]=T,+h[d>>2])+1.0000000036274937e-15);T=(o|0)==0;if(T){r=t;u=0;m=1}else{u=(w<<1)-o|0;r=s[a+4>>2]|0;s[x+4>>2]=r;h[S+4>>2]=1/((s[d>>2]=r,+h[d>>2])+1.0000000036274937e-15);r=s[a+8>>2]|0;s[x+8>>2]=r;h[S+8>>2]=1/((s[d>>2]=r,+h[d>>2])+1.0000000036274937e-15);r=t-u|0;m=3}o=(r|0)/(w|0)|0;o=(o|0)<24?o:24;r=0;c=0;while(1){if((r|0)>=(o|0))break;t=(te(r,w)|0)+u|0;Zs[f&1](e,g,w,t,0,-2,i);t=0;c=(r|0)==0?+h[g>>2]:c;p=1.0000000036274937e-15;while(1){if((t|0)>=(w|0))break;_=+h[g+(t<<2)>>2];k=_-c;t=t+1|0;c=_;p=p+k*k}A=r+m|0;h[x+(A<<2)>>2]=p;h[S+(A<<2)>>2]=1/p;r=r+1|0}A=r+m|0;s[x+(A<<2)>>2]=s[x+(A+-1<<2)>>2];if(!T){o=o+2|0;o=(o|0)>24?24:o}E=~~+((i*60|0)+40|0);A=(n|0)/400|0;if((n|0)>=32e3)if((n|0)>64399)k=1;else k=+(A+-80|0)/80;else k=0;r=0;while(1){if((r|0)==16){m=0;break}s[R+(r<<2)>>2]=-1;h[M+(r<<2)>>2]=1e10;r=r+1|0}while(1){if((m|0)==4){y=1;break}b=+((A<(o|0)?o:u;t=0;c=0;p=0;while(1){if((t|0)>(r|0))break;_=p+ +h[S+(t<<2)>>2];v=c+ +h[x+(t<<2)>>2];t=t+1|0;c=v;p=_}y=r+1|0;c=(c*p/+(te(y,y)|0)+-2)*.05000000074505806;if(+H(+(c<=0?0:c))>1)c=1;else c=+H(+(c<=0?0:c));h[M+(u<<2)>>2]=b*(k*c+1);s[R+(u<<2)>>2]=m;m=m+1|0}while(1){if((o|0)<=(y|0))break;n=y+-1|0;r=2;while(1){if((r|0)==16)break;i=r+-1|0;s[M+(y<<6)+(r<<2)>>2]=s[M+(n<<6)+(i<<2)>>2];s[R+(y<<6)+(r<<2)>>2]=i;r=r+1|0}w=M+(n<<6)+4|0;g=x+(y<<2)|0;f=S+(y<<2)|0;e=o-y|0;_=+(e|0);i=0;while(1){if((i|0)==4)break;m=1<>2]=1;v=+h[w>>2];r=1;while(1){if((r|0)==4)break;r=r+1|0;t=(1<>2];if(!(c>2]=t;v=c}b=+((A<(e|0);r=u?e:m;t=0;c=0;p=0;while(1){if((t|0)>(r|0))break;I=p+ +h[f+(t<<2)>>2];P=c+ +h[g+(t<<2)>>2];t=t+1|0;c=P;p=I}t=r+1|0;c=(c*p/+(te(t,t)|0)+-2)*.05000000074505806;if(+H(+(c<=0?0:c))>1)c=1;else c=+H(+(c<=0?0:c));c=b*(k*c+1);r=M+(y<<6)+(m<<2)|0;h[r>>2]=v;if(u)c=c*_/+(m|0);h[r>>2]=v+c;i=i+1|0}y=y+1|0}r=o+-1|0;c=+h[M+(r<<6)+4>>2];t=1;u=2;while(1){if((u|0)==16)break;P=+h[M+(r<<6)+(u<<2)>>2];S=P>2]|0;o=r}r=1<>2]=s[x+(r<<2)>>2];if(T){l=C;return t|0}s[a+4>>2]=s[x+(r+1<<2)>>2];s[a+8>>2]=s[x+(r+2<<2)>>2];l=C;return t|0}function Ns(e,t,i,a,o,f,c,u,p,b,m,w,g){e=e|0;t=t|0;i=i|0;a=a|0;o=o|0;f=f|0;c=c|0;u=u|0;p=p|0;b=b|0;m=m|0;w=w|0;g=g|0;var v=0,_=0,y=0,k=0,E=0,A=0,S=0,M=0,T=0,R=0,x=0,C=0,I=0,P=0,O=0,N=0,D=0,L=0,B=0,U=0,j=0,F=0,G=0,V=0,W=0,K=0,Z=0,Y=0,$=0,X=0,Q=0,ee=0,ie=0,ne=0,se=0,ae=0,oe=0,fe=0,he=0,ce=0,le=0,ue=0,de=0,pe=0,be=0,me=0,we=0,ge=0,ve=0,_e=0,ye=0,ke=0,Ee=0,Ae=0,Se=0,Me=0,Te=0,Re=0,xe=0,Ce=0,Ie=0,Pe=0,Oe=0,De=0,Le=0,Be=0,Ue=0,je=0,Fe=0,ze=0,He=0,Ge=0,Ve=0,We=0,Ke=0,Ze=0,Ye=0,$e=0,Xe=0,Je=0,Qe=0,et=0,tt=0,it=0,rt=0,nt=0,st=0,at=0,ot=0,ft=0,ht=0,ct=0,lt=0,ut=0,dt=0,pt=0,bt=0,mt=0,wt=0,gt=0,vt=0,_t=0,yt=0,kt=0;pt=l;l=l+1280|0;st=pt+832|0;rt=pt+824|0;it=pt+816|0;tt=pt+808|0;et=pt+800|0;Qe=pt+792|0;$e=pt+784|0;Ye=pt+776|0;Ze=pt+768|0;Ke=pt+760|0;ut=pt+456|0;Ve=pt+448|0;Ge=pt+440|0;He=pt+432|0;ze=pt+424|0;Fe=pt+416|0;je=pt+408|0;Ue=pt+400|0;Be=pt+392|0;Se=pt+384|0;Ae=pt+376|0;Ee=pt+368|0;ke=pt+360|0;ye=pt+352|0;ge=pt+344|0;we=pt+336|0;me=pt+328|0;_e=pt+320|0;ve=pt+312|0;K=pt+304|0;x=pt;pe=pt+1272|0;Je=pt+1224|0;ft=pt+1220|0;Te=pt+1216|0;ht=pt+1184|0;W=pt+1152|0;ee=pt+852|0;le=pt+848|0;De=pt+840|0;We=pt+1278|0;nt=pt+1276|0;s[ft>>2]=0;R=(o|0)>1276?1276:o;lt=e+19044|0;s[lt>>2]=0;be=e+156|0;if(!(s[be>>2]|0)){y=i*400|0;_=e+144|0;v=s[_>>2]|0;if((y|0)!=(v|0))if(!((i*200|0)==(v|0)|(i*100|0)==(v|0))?(dt=i*50|0,!((dt|0)==(v|0)|(i*25|0)==(v|0)|(dt|0)==(v*3|0))):0){a=-1;l=pt;return a|0}else{dt=_;_=y}else{dt=_;_=y;v=y}}else{v=e+144|0;dt=v;_=i*400|0;v=s[v>>2]|0}if((_|0)<(v|0)|(R|0)<1){a=-1;l=pt;return a|0}de=e+(s[e+4>>2]|0)|0;Xe=e+(s[e>>2]|0)|0;Q=e+108|0;if((s[Q>>2]|0)==2051)Me=0;else Me=s[e+116>>2]|0;X=s[e+168>>2]|0;X=(X|0)>(f|0)?f:X;s[x>>2]=Te;qs(Xe,10015,x)|0;s[ht>>2]=0;T=e+44|0;do if((s[T>>2]|0)>6?(s[dt>>2]|0)==48e3:0){y=e+112|0;v=te(s[y>>2]|0,i)|0;_=0;E=0;A=0;while(1){if((_|0)>=(v|0))break;L=+h[t+(_<<2)>>2];_=_+1|0;E=E>L?E:L;A=AL?E:L)<=1/+(1<>2]=0;_=1;f=-1;k=-1;Oe=1;break}f=s[e+8696>>2]|0;k=s[e+8700>>2]|0;zs(e+188|0,s[Te>>2]|0,c,u,i,p,b,m,48e3,X,w,ht);if(+h[ht+28>>2]>.10000000149011612){c=e+19040|0;E=+h[c>>2];_=te(s[y>>2]|0,i)|0;v=0;O=0;while(1){if((v|0)>=(_|0))break;L=+h[t+(v<<2)>>2];v=v+1|0;O=O+L*L}E=E*.999;A=+(_|0);if(!(E>O/A)){v=0;E=0;while(1){if((v|0)>=(_|0))break;L=+h[t+(v<<2)>>2];v=v+1|0;E=E+L*L}E=E/A}h[c>>2]=E;ct=25}else ct=25}else{f=-1;k=-1;ct=25}while(0);do if((ct|0)==25){s[e+140>>2]=-1;_=s[ht>>2]|0;y=e+19032|0;s[y>>2]=0;_=(_|0)==0;if(!_){if((s[e+124>>2]|0)==-1e3)s[e+140>>2]=~~+z(+((1-+h[ht+20>>2])*100+.5));v=s[ht+24>>2]|0;if((v|0)<13){s[y>>2]=1101;G=y;Oe=0;break}if((v|0)<15){s[y>>2]=1102;G=y;Oe=0;break}if((v|0)<17){s[y>>2]=1103;G=y;Oe=0;break}if((v|0)<19){s[y>>2]=1104;G=y;Oe=0;break}else{s[y>>2]=1105;G=y;Oe=0;break}}else{G=y;Oe=0}}while(0);at=e+112|0;S=s[at>>2]|0;M=(S|0)==2;if(M?(s[e+120>>2]|0)!=1:0){u=(s[dt>>2]|0)/(i|0)|0;v=(u|0)<50;E=25/+(u|0);y=i+-3|0;c=0;A=0;O=0;N=0;while(1){if((c|0)>=(y|0))break;ot=c<<1;_t=+h[t+(ot<<2)>>2];mt=+h[t+((ot|1)<<2)>>2];vt=+h[t+((ot|2)<<2)>>2];bt=+h[t+((ot|3)<<2)>>2];gt=+h[t+((ot|4)<<2)>>2];D=+h[t+((ot|5)<<2)>>2];wt=+h[t+((ot|6)<<2)>>2];L=+h[t+((ot|7)<<2)>>2];c=c+4|0;A=A+(_t*_t+vt*vt+gt*gt+wt*wt);O=O+(_t*mt+vt*bt+gt*D+wt*L);N=N+(mt*mt+bt*bt+D*D+L*L)}_t=v?.5:1-E;Le=e+15172|0;E=+h[Le>>2];E=E+_t*(A-E);h[Le>>2]=E;v=e+15176|0;A=+h[v>>2];A=A+_t*(O-A);h[v>>2]=A;ot=e+15180|0;O=+h[ot>>2];O=O+_t*(N-O);h[ot>>2]=O;E=E<0?0:E;h[Le>>2]=E;A=A<0?0:A;h[v>>2]=A;O=O<0?0:O;h[ot>>2]=O;if((E>O?E:O)>.0007999999797903001){gt=+H(+E);_t=+H(+O);E=+H(+gt);vt=+H(+_t);_t=gt*_t;gt=A<_t?A:_t;h[v>>2]=gt;_t=gt/(_t+1.0000000036274937e-15);vt=+H(+(1-_t*_t))*(+q(+(E-vt))/(E+1.0000000036274937e-15+vt));ot=e+15184|0;E=+h[ot>>2];_t=+(u|0);E=E+(vt-E)/_t;h[ot>>2]=E;ot=e+15188|0;_t=+h[ot>>2]-.019999999552965164/_t;E=_t>E?_t:E;h[ot>>2]=E}else E=+h[e+15188>>2];E=E*20;if(E>1)E=1}else E=0;if(!i)v=(s[dt>>2]|0)/400|0;else v=i;y=s[e+164>>2]|0;switch(y|0){case-1e3:{P=s[dt>>2]|0;y=((P*60|0)/(v|0)|0)+(te(P,S)|0)|0;break}case-1:{P=s[dt>>2]|0;y=(te(R<<3,P)|0)/(v|0)|0;break}default:P=s[dt>>2]|0}Ie=e+160|0;s[Ie>>2]=y;v=(P|0)/(i|0)|0;ot=e+148|0;U=(s[ot>>2]|0)==0;if(U){B=(P*3|0)/(i|0)|0;Le=(((y*3|0)/8|0)+((B|0)/2|0)|0)/(B|0)|0;Le=(Le|0)<(R|0)?Le:R;B=((te(Le,B)|0)<<3|0)/3|0;s[Ie>>2]=B}else{B=y;Le=R}do if(!((Le|0)<3|(B|0)<(v*24|0))){if((v|0)<50){y=te(Le,v)|0;if((y|0)<300|(B|0)<2400)break;else ae=y}else ae=te(v,Le)|0;oe=ae<<3;C=s[T>>2]|0;F=e+40|0;I=s[F>>2]|0;T=v+-50|0;y=B-(te((S*40|0)+20|0,T)|0)|0;if(U)y=y-((y|0)/12|0)|0;R=C+90|0;c=(te(y,R)|0)/100|0;x=(I*12|0)+20|0;c=c-((te(c,I)|0)/(x|0)|0)|0;y=s[e+124>>2]|0;do if((y|0)!=3001)if((y|0)!=3002){y=s[e+140>>2]|0;if((y|0)>-1){j=y*327>>8;j=(s[Q>>2]|0)!=2049|(j|0)<115?j:115;break}else{j=(s[Q>>2]|0)==2048?115:48;break}}else j=0;else j=127;while(0);V=e+120|0;y=s[V>>2]|0;Pe=e+15104|0;do if((y|0)==-1e3|M^1)if(M){S=(c|0)>(((s[Pe>>2]|0)==2?23e3:25e3)|0)?2:1;s[Pe>>2]=S;break}else{s[Pe>>2]=S;break}else{s[Pe>>2]=y;S=y}while(0);y=B-(te((S*40|0)+20|0,T)|0)|0;if(U)y=y-((y|0)/12|0)|0;u=(te(y,R)|0)/100|0;u=u-((te(u,I)|0)/(x|0)|0)|0;c=s[Q>>2]|0;do if((c|0)!=2051){y=s[e+136>>2]|0;do if((y|0)==-1e3){_t=1-E;y=~~(_t*16e3+E*16e3);y=y+((te(te(j,j)|0,~~(_t*64e3+E*36e3)-y|0)|0)>>14)|0;y=(c|0)==2048?y+8e3|0:y;c=s[e+15140>>2]|0;if((c|0)==1002)y=y+-4e3|0;else y=(c|0)>0?y+4e3|0:y;y=(u|0)>=(y|0)?1002:1e3;c=e+15136|0;s[c>>2]=y;do if(s[e+48>>2]|0){if((I|0)<=(128-j>>4|0))break;s[c>>2]=1e3;y=1e3}while(0);if(!(s[e+184>>2]|0)){s[e+56>>2]=0;_=c;ct=112;break}if(!_){s[e+56>>2]=0;_=c;ct=112;break}s[e+56>>2]=Oe^1;if(!((Oe|0)==0&(j|0)>100)){_=c;ct=112;break}s[c>>2]=1e3;_=c;y=1e3}else{_=e+15136|0;s[_>>2]=y;ct=112}while(0);if((ct|0)==112)if((y|0)==1002){Ce=_;_=1002;break}if(((P|0)/100|0|0)>(i|0)){s[_>>2]=1002;Ce=_;_=1002}else{Ce=_;_=y}}else{Ce=e+15136|0;s[Ce>>2]=1002;_=1002}while(0);Y=e+176|0;if(s[Y>>2]|0){s[Ce>>2]=1002;_=1002}ie=(v|0)>50;if((Le|0)<((te(ie?9e3:6e3,i)|0)/(P<<3|0)|0|0)){s[Ce>>2]=1002;_=1002}do if((S|0)==1?(s[e+15144>>2]|0)==2:0){y=e+68|0;if((s[y>>2]|0)!=0|(_|0)==1002){ct=124;break}c=e+15140|0;if((s[c>>2]|0)==1002){ct=124;break}s[y>>2]=1;s[Pe>>2]=2;Re=c;c=2}else ct=124;while(0);if((ct|0)==124){s[e+68>>2]=0;Re=e+15140|0;c=S}M=s[Re>>2]|0;do if((M|0)>0){y=(_|0)==1002;if((M|0)==1002&(y^1)){xe=(_|0)!=1002;y=xe&1;if(xe){u=y;y=1;xe=0;break}}else{if(!y){u=0;y=0;xe=0;break}if((M|0)==1002){ +_=1002;u=0;y=0;xe=0;break}y=(_|0)!=1002&1}if(((P|0)/100|0|0)>(i|0)){_=1002;u=y;y=0;xe=0;break}s[Ce>>2]=M;_=M;u=y;y=1;xe=1}else{u=0;y=0;xe=0}while(0);c=B-(te((c*40|0)+20|0,T)|0)|0;if(U)c=c-((c|0)/12|0)|0;c=(te(c,R)|0)/100|0;e:do switch(_|0){case 1001:case 1e3:{if((C|0)<2)c=(c<<2|0)/5|0;fe=c-((te(c,I)|0)/((I*6|0)+10|0)|0)|0;break}case 1002:{if((C|0)>=5){fe=c;break e}fe=(c*9|0)/10|0;break}default:fe=c-((te(c,I)|0)/(x|0)|0)|0}while(0);he=e+15160|0;if(!(s[he>>2]|0))if(!y){ne=u;c=0;y=0;se=0}else{c=0;ct=145}else{s[he>>2]=0;u=1;c=1;y=1;ct=145}do if((ct|0)==145){S=(P|0)/200|0;S=(te(Le,S)|0)/(S+i|0)|0;S=(S|0)>257?257:S;if(U){ne=u;se=S;break}se=(B|0)/1600|0;ne=u;se=(S|0)<(se|0)?S:se}while(0);if((_|0)!=1002&(M|0)==1002){_=s[e+180>>2]|0;kn(de|0,0,20400)|0;c=0;while(1){if((c|0)==2)break;Fi(de+(c*10156|0)|0,_)|0;c=c+1|0}s[de+20376>>2]=1;s[de+20380>>2]=1;$=1}else $=c;T=(s[Ce>>2]|0)==1002;do if(T)ct=156;else{if(s[e+15164>>2]|0){ct=156;break}if(s[e+84>>2]|0){ct=156;break}c=e+15152|0;U=c;c=s[c>>2]|0}while(0);do if((ct|0)==156){if((s[at>>2]|0)==2?(s[V>>2]|0)!=1:0){u=616;S=616}else{u=616;S=616}_=te(j,j)|0;c=0;while(1){if((c|0)==8)break;ue=s[u+(c<<2)>>2]|0;s[W+(c<<2)>>2]=ue+((te(_,(s[S+(c<<2)>>2]|0)-ue|0)|0)>>14);c=c+1|0}M=(s[e+15164>>2]|0)==0;S=e+15156|0;c=1105;do{u=c<<1;_=s[W+(u+-2204<<2)>>2]|0;u=s[W+(u+-2203<<2)>>2]|0;do if(M)if((s[S>>2]|0)<(c|0)){_=_+u|0;break}else{_=_-u|0;break}while(0);if((fe|0)>=(_|0))break;c=c+-1|0}while((c|0)>1101);s[S>>2]=c;_=e+15152|0;s[_>>2]=c;if(T|M^1){U=_;break}if(!((s[e+88>>2]|0)==0&(c|0)>1103)){U=_;break}s[_>>2]=1103;U=_;c=1103}while(0);_=s[e+132>>2]|0;if((c|0)>(_|0))s[U>>2]=_;else _=c;B=e+128|0;c=s[B>>2]|0;S=(c|0)==-1e3;if(!S){s[U>>2]=c;_=c}if((oe|0)<15e3&(T^1)){_=(_|0)<1103?_:1103;s[U>>2]=_}c=s[dt>>2]|0;if((c|0)<24001&(_|0)>1104){s[U>>2]=1104;_=1104}if((c|0)<16001&(_|0)>1103){s[U>>2]=1103;_=1103}if((c|0)<12001&(_|0)>1102){s[U>>2]=1102;_=1102}if((c|0)<8001&(_|0)>1101){s[U>>2]=1101;_=1101}u=s[G>>2]|0;if(!((u|0)==0|S^1)){c=s[Pe>>2]|0;do if((fe|0)>(c*18e3|0)|T^1){if(!((fe|0)>(c*24e3|0)|T^1)){c=1102;break}if((fe|0)<=(c*3e4|0)){c=1103;break}c=(fe|0)>(c*44e3|0)?1105:1104}else c=1101;while(0);ue=(u|0)>(c|0)?u:c;s[G>>2]=ue;_=(_|0)<(ue|0)?_:ue;s[U>>2]=_}x=s[F>>2]|0;j=e+52|0;C=s[j>>2]|0;e:do if((s[e+48>>2]|0)==0|(x|0)==0|T)_=0;else{S=(x|0)<25;M=125-x|0;T=(x|0)<6;R=_;while(1){u=R<<1;c=s[648+(u+-2202<<2)>>2]|0;u=s[648+(u+-2201<<2)>>2]|0;switch(C|0){case 1:{c=c-u|0;break}case 0:{c=c+u|0;break}default:{}}ue=((te(c,S?M:100)|0)>>16)*655|0;c=(ue+((((te(c,S?125-x|0:100)|0)&65535)*655|0)>>>16)|0)<(fe|0);if(c|T){_=c&1;break e}if((R|0)<=1101)break;ue=R+-1|0;s[U>>2]=ue;R=ue}s[U>>2]=_;_=0}while(0);s[j>>2]=_;s[K>>2]=X;qs(Xe,4036,K)|0;c=s[Ce>>2]|0;_=(c|0)==1002;do if(_){if((s[U>>2]|0)!=1102)break;s[U>>2]=1103}while(0);if(s[Y>>2]|0)s[U>>2]=1101;u=s[dt>>2]|0;do if(((u|0)/50|0|0)<(i|0)){if(!_?(Z=s[U>>2]|0,(Z|0)<=1103):0){B=Z;break}if((f|0)!=-1){s[e+8696>>2]=f;s[e+8700>>2]=k}T=((u|0)/25|0|0)<(i|0)?3:2;c=(o+-3|0)/(T|0)|0;c=(c|0)>1276?1276:c;R=te(T,c)|0;P=Ne()|0;u=l;l=l+((1*R|0)+15&-16)|0;s[ee+4>>2]=0;R=e+136|0;x=s[R>>2]|0;C=s[B>>2]|0;I=s[V>>2]|0;s[R>>2]=s[Ce>>2];s[B>>2]=s[U>>2];v=s[Pe>>2]|0;s[V>>2]=v;S=e+68|0;M=s[S>>2]|0;if(!M)s[e+15144>>2]=v;else s[V>>2]=1;v=(xe|0)!=0;_=T+-1|0;k=0;while(1){if((k|0)>=(T|0)){ct=222;break}s[S>>2]=0;if(v&(k|0)==(_|0))s[R>>2]=1002;f=s[dt>>2]|0;y=u+(te(k,c)|0)|0;f=Ns(e,t+((te(k,(te(s[at>>2]|0,f)|0)/50|0)|0)<<2)|0,(f|0)/50|0,y,c,X,0,0,p,b,m,w,g)|0;if((f|0)<0){v=-3;break}if((js(ee,y,f)|0)<0){v=-3;break}k=k+1|0}do if((ct|0)==222){_=(s[ot>>2]|0)==0;if(_){v=((s[Ie>>2]|0)*3|0)/(1200/(T>>>0)|0|0)|0;v=(v|0)<(o|0)?v:o}else v=o;v=Fs(ee,T,a,v,_&1)|0;if((v|0)<0){v=-3;break}s[R>>2]=x;s[B>>2]=C;s[V>>2]=I;s[S>>2]=M}while(0);qe(P|0);a=v;l=pt;return a|0}else B=s[U>>2]|0;while(0);do if((c|0)==1e3){if((B|0)<=1103)break;s[Ce>>2]=1001}else{if(!((c|0)==1001&(B|0)<1104))break;s[Ce>>2]=1e3}while(0);ee=Le-se|0;u=(te(s[Ie>>2]|0,i)|0)/(u<<3|0)|0;u=((ee|0)<(u|0)?ee:u)+-1|0;ee=a+1|0;m=Le+-1|0;s[Je>>2]=ee;p=Je+8|0;s[p>>2]=0;s[Je+12>>2]=0;s[Je+16>>2]=0;ce=Je+20|0;s[ce>>2]=33;V=Je+24|0;s[V>>2]=0;o=Je+28|0;s[o>>2]=-2147483648;W=Je+40|0;s[W>>2]=-1;K=Je+32|0;s[K>>2]=0;Z=Je+36|0;s[Z>>2]=0;b=Je+4|0;s[b>>2]=m;X=Je+44|0;s[X>>2]=0;G=Me+i|0;F=te(G,s[at>>2]|0)|0;ue=Ne()|0;w=l;l=l+((1*(F<<2)|0)+15&-16)|0;F=e+172|0;R=s[at>>2]|0;T=te(Me,R)|0;Mn(w|0,e+15192+((te((s[F>>2]|0)-Me|0,R)|0)<<2)|0,T<<2|0)|0;x=(s[Ce>>2]|0)==1002;if(x)_=193536;else _=s[de+8>>2]|0;P=e+15112|0;I=s[P>>2]|0;_=_-I|0;_=I+(((_>>16)*983|0)+(((_&65535)*983|0)>>>16))|0;s[P>>2]=_;e:do if((s[Q>>2]|0)==2048){k=_>>8;do if((k|0)<0)_=0;else{if((k|0)>3966){_=2147483647;break}_=_>>15;c=1<<_;f=k&127;if((k|0)<2048)_=f+((te(te(f,128-f|0)|0,-174)|0)>>16)<<_>>7;else _=te(c>>7,f+((te(te(f,128-f|0)|0,-174)|0)>>16)|0)|0;_=c+_|0}while(0);M=w+(T<<2)|0;k=e+15120|0;S=((_<<16>>16)*2471|0)/((s[dt>>2]|0)/1e3|0|0)|0;_=te(S,-471)|0;f=_+268435456|0;Q=f>>6;C=f>>22;c=S<<16>>16;yt=te(S>>16,c)|0;c=te(S&65535,c)|0;S=te(S,(S>>15)+1>>1)|0;kt=yt+(c>>>16)+S<<16>>16;I=Q&65535;P=Q<<16>>16;E=+((te(C,kt)|0)+((te(I,kt)|0)>>16)+(te(Q,(yt+(c>>16)+S+-8388608>>15)+1>>1)|0)|0)*3.725290298461914e-9;A=+((te(C,P)|0)+((te(I,P)|0)>>16)+(te(Q,(f>>21)+1>>1)|0)|0)*3.725290298461914e-9;O=+(f|0)*3.725290298461914e-9;N=+(-268435456-_<<1|0)*3.725290298461914e-9;_=e+15124|0;f=0;while(1){if((f|0)>=(i|0))break;kt=te(f,R)|0;gt=+h[t+(kt<<2)>>2];vt=O*gt;_t=+h[k>>2]+vt;h[k>>2]=+h[_>>2]-_t*E+N*gt;h[_>>2]=vt-_t*A+1.0000000031710769e-30;h[M+(kt<<2)>>2]=_t;f=f+1|0}if((R|0)!=2)break;c=t+4|0;S=e+15128|0;_=M+4|0;f=e+15132|0;k=0;while(1){if((k|0)>=(i|0))break e;kt=k<<1;gt=+h[c+(kt<<2)>>2];vt=O*gt;_t=+h[S>>2]+vt;h[S>>2]=+h[f>>2]-_t*E+N*gt;h[f>>2]=vt-_t*A+1.0000000031710769e-30;h[_+(kt<<2)>>2]=_t;k=k+1|0}}else{c=w+(T<<2)|0;S=e+15120|0;D=12/+(s[dt>>2]|0);L=1-D;A=+h[S>>2];M=e+15124|0;E=+h[M>>2];if((R|0)!=2){_=0;while(1){if((_|0)>=(i|0))break;vt=+h[t+(_<<2)>>2];_t=vt-A;h[c+(_<<2)>>2]=_t-E;_=_+1|0;A=D*vt+1.0000000031710769e-30+L*A;E=D*_t+1.0000000031710769e-30+L*E}h[S>>2]=A;h[M>>2]=E;break}_=e+15128|0;f=e+15132|0;k=0;O=+h[_>>2];N=+h[f>>2];while(1){if((k|0)>=(i|0))break;yt=k<<1;wt=+h[t+(yt<<2)>>2];kt=yt|1;vt=+h[t+(kt<<2)>>2];gt=wt-A;_t=vt-O;h[c+(yt<<2)>>2]=gt-E;h[c+(kt<<2)>>2]=_t-N;k=k+1|0;A=D*wt+1.0000000031710769e-30+L*A;E=D*gt+1.0000000031710769e-30+L*E;O=D*vt+1.0000000031710769e-30+L*O;N=D*_t+1.0000000031710769e-30+L*N}h[S>>2]=A;h[M>>2]=E;h[_>>2]=O;h[f>>2]=N}while(0);do if(g|0){_=w+(T<<2)|0;f=te(R,i)|0;k=0;E=0;while(1){if((k|0)>=(f|0))break;_t=+h[_+(k<<2)>>2];k=k+1|0;E=E+_t*_t}if(!(!(E<1e9)|(E!=E|0!=0)))break;kn(_|0,0,f<<2|0)|0;kt=e+15120|0;s[kt>>2]=0;s[kt+4>>2]=0;s[kt+8>>2]=0;s[kt+12>>2]=0}while(0);do if(x){A=1;x=ne;ct=353}else{c=te(R,i)|0;P=Ne()|0;I=l;l=l+((1*(c<<1)|0)+15&-16)|0;c=te(u<<3,v)|0;x=s[Ce>>2]|0;C=(x|0)==1001;do if(!C){s[e+36>>2]=c;v=s[e+15168>>2]|0;if(!v){T=c;A=1}else{N=1;ct=275}}else{k=s[ot>>2]|0;_=((s[dt>>2]|0)==(i*50|0)?2:1)+(s[j>>2]<<1)|0;f=1;while(1){if((f|0)>=7){ct=268;break}v=s[688+(f*20|0)>>2]|0;if((v|0)>(c|0)){ct=271;break}f=f+1|0}do if((ct|0)==268)if((f|0)==7){v=(s[808+(_<<2)>>2]|0)+((c+-64e3|0)/2|0)|0;break}else{v=s[688+(f*20|0)>>2]|0;ct=271;break}while(0);if((ct|0)==271){yt=f+-1|0;kt=s[688+(yt*20|0)>>2]|0;v=((te(s[688+(yt*20|0)+(_<<2)>>2]|0,v-c|0)|0)+(te(s[688+(f*20|0)+(_<<2)>>2]|0,c-kt|0)|0)|0)/(v-kt|0)|0}_=(k|0)==0?v+100|0:v;_=(B|0)==1104?_+300|0:_;s[e+36>>2]=_;v=s[e+15168>>2]|0;if(v|0){c=_;N=1;ct=275;break}T=_;A=1-+J(+(+(_-c|0)*.0009765625*.6931471805599453))}while(0);do if((ct|0)==275){if(!(s[ot>>2]|0)){T=c;A=N;break}if(s[Y>>2]|0){T=c;A=N;break}R=s[U>>2]|0;if((R|0)==1101){M=13;O=8e3}else{kt=(R|0)==1102;M=kt?15:17;O=kt?12e3:16e3}f=s[at>>2]|0;S=0;E=0;while(1){if((S|0)>=(f|0))break;k=S*21|0;T=0;while(1){if((T|0)>=(M|0))break;A=+h[v+(k+T<<2)>>2];_=A<.5;do if(A>-2|_^1){if(_){if(!(A>0))break}else A=.5;A=A*.5}else A=-2;while(0);T=T+1|0;E=E+A}S=S+1|0}kt=~~(O*(E/+(M|0)*+(f|0)+.20000000298023224));_=(te(c,-2)|0)/3|0;_=(kt|0)>(_|0)?kt:_;if((R&-2|0)==1104)v=(_*3|0)/5|0;else v=_;T=c+v|0;s[e+36>>2]=T;kt=te(_,i)|0;A=N;u=u+((kt|0)/(s[dt>>2]<<3|0)|0)|0}while(0);R=s[dt>>2]|0;s[e+32>>2]=(i*1e3|0)/(R|0)|0;f=s[at>>2]|0;s[e+8>>2]=f;s[e+12>>2]=s[Pe>>2];switch(B|0){case 1101:{s[e+28>>2]=8e3;v=8e3;break}case 1102:{s[e+28>>2]=12e3;v=12e3;break}default:{s[e+28>>2]=16e3;v=16e3}}s[e+24>>2]=C?16e3:8e3;c=e+20|0;s[c>>2]=16e3;do if((x|0)==1e3){if(ie)k=(ae<<4|0)/3|0;else k=oe;if((k|0)>=8e3)break;s[c>>2]=12e3;_=e+28|0;v=v>>>0>12e3?12e3:v;s[_>>2]=v;if((k|0)>=7e3)break;s[c>>2]=8e3;s[_>>2]=(v|0)>8e3?8e3:v}while(0);S=(s[ot>>2]|0)==0;s[e+60>>2]=S&1;v=m-se|0;v=(v|0)>1275?1275:v;s[pe>>2]=v;v=v<<3;M=e+64|0;s[M>>2]=v;do if(S){if(!C)break;s[M>>2]=(te(T,i)|0)/(R|0)|0}else{if(!C)break;c=(te(v,R)|0)/(i|0)|0;_=((R|0)==(i*50|0)?2:1)+(s[j>>2]<<1)|0;k=1;while(1){if((k|0)>=7){ct=310;break}v=s[688+(k*20|0)>>2]|0;if((v|0)>(c|0)){ct=313;break}k=k+1|0}do if((ct|0)==310)if((k|0)==7){v=(s[808+(_<<2)>>2]|0)+((c+-64e3|0)/2|0)|0;break}else{v=s[688+(k*20|0)>>2]|0;ct=313;break}while(0);if((ct|0)==313){yt=k+-1|0;kt=s[688+(yt*20|0)>>2]|0;v=((te(s[688+(yt*20|0)+(_<<2)>>2]|0,v-c|0)|0)+(te(s[688+(k*20|0)+(_<<2)>>2]|0,c-kt|0)|0)|0)/(v-kt|0)|0}kt=S?v+100|0:v;s[M>>2]=(te((B|0)==1104?kt+300|0:kt,i)|0)/(R|0)|0}while(0);if($){s[le>>2]=0;kt=(R|0)/400|0;_=te(f,(s[F>>2]|0)-(s[e+116>>2]|0)-kt|0)|0;yt=e+15192+(_<<2)|0;k=s[Te>>2]|0;Ds(yt,yt,0,1,s[k+4>>2]|0,kt,f,s[k+60>>2]|0,R);kn(e+15192|0,0,_<<2|0)|0;_=s[F>>2]|0;f=te(_,s[at>>2]|0)|0;k=0;while(1){if((k|0)>=(f|0))break;E=+h[e+15192+(k<<2)>>2]*32768;do if(E>-32768){if(E<32767)break;E=32767}else E=-32768;while(0);v=(h[d>>2]=E,s[d>>2]|0);do if((v&2130706432)>>>0<=1249902592){v=(v|0)<0;E=v?E+-8388608+8388608:E+8388608+-8388608;if(!(E==0))break;E=v?-0:0}while(0);n[I+(k<<1)>>1]=~~E;k=k+1|0}Ni(de,e+8|0,I,_,0,le,1)|0;f=s[at>>2]|0}_=te(f,i)|0;k=0;while(1){if((k|0)>=(_|0))break;E=+h[w+((te(Me,f)|0)+k<<2)>>2]*32768;do if(E>-32768){if(E<32767)break;E=32767}else E=-32768;while(0);v=(h[d>>2]=E,s[d>>2]|0);do if((v&2130706432)>>>0<=1249902592){v=(v|0)<0;E=v?E+-8388608+8388608:E+8388608+-8388608;if(!(E==0))break;E=v?-0:0}while(0);n[I+(k<<1)>>1]=~~E;k=k+1|0}if(!(Ni(de,e+8|0,I,i,Je,pe,0)|0)){if(s[pe>>2]|0){do if((s[Ce>>2]|0)==1e3){v=s[e+80>>2]|0;if((v|0)==8e3){_=1101;break}if((v|0)==12e3){_=1102;break}_=(v|0)==16e3?1103:B}else _=B;while(0);kt=s[e+96>>2]|0;s[e+72>>2]=kt;if(!kt)v=ne;else{s[he>>2]=1;v=0;y=1}qe(P|0);x=v;B=_;ct=353;break}s[lt>>2]=0;y=s[Ce>>2]|0;f=s[Pe>>2]|0;v=(s[dt>>2]|0)/(i|0)|0;_=0;while(1){if((v|0)>=400)break;v=v<<1;_=_+1|0}switch(y|0){case 1e3:{v=(B<<5)+96&224|(_<<3)+-16;break}case 1002:{v=((B|0)<1102?0:(B<<5)+64&96)|_<<3|128;break}default:v=B<<4|(_<<3)+240|96}r[a>>0]=v|((f|0)==2&1)<<2;v=1}else v=-3;qe(P|0)}while(0);e:do if((ct|0)==353){switch(B|0){case 1101:{v=13;break}case 1103:case 1102:{v=17;break}case 1104:{v=19;break}default:v=21}s[ve>>2]=v;qs(Xe,10012,ve)|0;s[_e>>2]=s[Pe>>2];qs(Xe,10008,_e)|0;s[me>>2]=-1;qs(Xe,4002,me)|0;do if((s[Ce>>2]|0)==1e3){f=s[at>>2]|0;u=((te(f,s[dt>>2]|0)|0)/400|0)<<2;c=l;l=l+((1*u|0)+15&-16)|0;u=0}else{s[we>>2]=0;qs(Xe,4006,we)|0;s[ge>>2]=(s[e+76>>2]|0)==0?2:0;qs(Xe,10002,ge)|0;do if((s[Ce>>2]|0)==1001){v=(s[ce>>2]|0)+((re(s[o>>2]|0)|0)+-32)+7>>3;v=(y|0)==0?v:v+3|0;if(!(s[ot>>2]|0)){u=(v|0)>(u|0)?v:u;break}else{s[ye>>2]=(s[Ie>>2]|0)-(s[e+36>>2]|0);qs(Xe,4002,ye)|0;s[ke>>2]=0;qs(Xe,4020,ke)|0;u=m-se|0;break}}else{if(!(s[ot>>2]|0))break;do if((s[be>>2]|0)==5010){v=s[dt>>2]|0;if(((v|0)/50|0|0)==(i|0)){v=0;break}v=te(((s[Pe>>2]|0)*60|0)+40|0,((v|0)/(i|0)|0)+-50|0)|0;if(!(s[ht>>2]|0))break;v=~~(+(v|0)*(+h[ht+4>>2]*.5+1))}else v=0;while(0);s[Ee>>2]=1;qs(Xe,4006,Ee)|0;s[Ae>>2]=s[e+152>>2];qs(Xe,4020,Ae)|0;s[Se>>2]=(s[Ie>>2]|0)+v;qs(Xe,4002,Se)|0;u=m-se|0}while(0);v=s[Ce>>2]|0;_=s[at>>2]|0;f=s[dt>>2]|0;k=(te(_,f)|0)/400|0;c=l;l=l+((1*(k<<2)|0)+15&-16)|0;if((v|0)==1e3){f=_;break}kt=s[Re>>2]|0;if(!((v|0)!=(kt|0)&(kt|0)>0)){f=_;break}Mn(c|0,e+15192+((te((s[F>>2]|0)-Me-((f|0)/400|0)|0,_)|0)<<2)|0,k<<2|0)|0;f=_}while(0);v=s[F>>2]|0;_=e+15192|0;if((te(f,v-G|0)|0)>0){kt=te(f,v-i-Me|0)|0;Tn(_|0,e+15192+((te(f,i)|0)<<2)|0,kt<<2|0)|0;Mn(e+15192+(kt<<2)|0,w|0,(te(G,f)|0)<<2|0)|0}else Mn(_|0,w+((te(G-v|0,f)|0)<<2)|0,(te(v,f)|0)<<2|0)|0;v=e+15116|0;E=+h[v>>2];if(E<1|A<1){kt=s[Te>>2]|0;Ds(w,w,E,A,s[kt+4>>2]|0,i,s[at>>2]|0,s[kt+60>>2]|0,s[dt>>2]|0)}h[v>>2]=A;T=s[Ce>>2]|0;R=(T|0)==1001;if(!(R?(s[Pe>>2]|0)!=1:0)){if((fe|0)>=24e3){v=fe+-24e3|0;if((v<<1|0)>16384)v=16384;else ct=381}else{v=0;ct=381}if((ct|0)==381)v=v<<1;s[e+92>>2]=v}do if(!(s[e+15168>>2]|0)){if((s[at>>2]|0)!=2)break;M=e+15108|0;v=n[M>>1]|0;S=s[e+92>>2]|0;if(!(v<<16>>16<16384|(S|0)<16384))break;k=s[Te>>2]|0;_=s[k+60>>2]|0;f=48e3/(s[dt>>2]|0)|0;k=(s[k+4>>2]|0)/(f|0)|0;E=1-+(v<<16>>16)*6103515625e-14;A=1-+(S|0)*6103515625e-14;v=0;while(1){if((v|0)>=(k|0))break;_t=+h[_+((te(v,f)|0)<<2)>>2];_t=_t*_t;kt=v<<1;yt=w+(kt<<2)|0;gt=+h[yt>>2];kt=w+((kt|1)<<2)|0;vt=+h[kt>>2];_t=(_t*A+(1-_t)*E)*((gt-vt)*.5);h[yt>>2]=gt-_t;h[kt>>2]=vt+_t;v=v+1|0}while(1){if((v|0)>=(i|0))break;kt=v<<1;yt=w+(kt<<2)|0;gt=+h[yt>>2];kt=w+((kt|1)<<2)|0;vt=+h[kt>>2];_t=A*((gt-vt)*.5);h[yt>>2]=gt-_t;h[kt>>2]=vt+_t;v=v+1|0}n[M>>1]=S}while(0);t:do if((T|0)==1002)ct=456;else{_=s[ce>>2]|0;v=s[o>>2]|0;f=_+((re(v|0)|0)+-32)|0;if((f+17+(R?20:0)|0)>((Le<<3)+-8|0)){ct=456;break}i:do if(R){if(!y){if((f+37|0)>(u<<3|0)){ct=456;break t}v=v-(v>>>12)|0}else{kt=v>>>12;s[K>>2]=(s[K>>2]|0)+(v-kt);v=kt}s[o>>2]=v;while(1){if(v>>>0>=8388609){f=v;k=_;break i}f=s[K>>2]|0;k=f>>>23;if((k|0)==255)s[Z>>2]=(s[Z>>2]|0)+1;else{f=f>>>31;v=s[W>>2]|0;if((v|0)>-1){_=s[V>>2]|0;if((_+(s[p>>2]|0)|0)>>>0<(s[b>>2]|0)>>>0){s[V>>2]=_+1;r[(s[Je>>2]|0)+_>>0]=v+f;v=0}else v=-1;s[X>>2]=s[X>>2]|v}v=s[Z>>2]|0;if(v|0){f=f+255&255;do{_=s[V>>2]|0;if((_+(s[p>>2]|0)|0)>>>0<(s[b>>2]|0)>>>0){s[V>>2]=_+1;r[(s[Je>>2]|0)+_>>0]=f;_=0;v=s[Z>>2]|0}else _=-1;s[X>>2]=s[X>>2]|_;v=v+-1|0;s[Z>>2]=v}while((v|0)!=0)}s[W>>2]=k&255;f=s[K>>2]|0;v=s[o>>2]|0;_=s[ce>>2]|0}s[K>>2]=f<<8&2147483392;v=v<<8;s[o>>2]=v;_=_+8|0;s[ce>>2]=_}}else{f=v;k=_}while(0);if(!y){ct=456;break}v=f>>>1;_=f-v|0;if(!x)v=_;else s[K>>2]=(s[K>>2]|0)+_;s[o>>2]=v;_=k;while(1){if(v>>>0>=8388609)break;f=s[K>>2]|0;k=f>>>23;if((k|0)==255)s[Z>>2]=(s[Z>>2]|0)+1;else{f=f>>>31;v=s[W>>2]|0;if((v|0)>-1){_=s[V>>2]|0;if((_+(s[p>>2]|0)|0)>>>0<(s[b>>2]|0)>>>0){s[V>>2]=_+1;r[(s[Je>>2]|0)+_>>0]=v+f;v=0}else v=-1;s[X>>2]=s[X>>2]|v}v=s[Z>>2]|0;if(v|0){f=f+255&255;do{_=s[V>>2]|0;if((_+(s[p>>2]|0)|0)>>>0<(s[b>>2]|0)>>>0){s[V>>2]=_+1;r[(s[Je>>2]|0)+_>>0]=f;_=0;v=s[Z>>2]|0}else _=-1;s[X>>2]=s[X>>2]|_;v=v+-1|0;s[Z>>2]=v}while((v|0)!=0)}s[W>>2]=k&255;f=s[K>>2]|0;v=s[o>>2]|0;_=s[ce>>2]|0}s[K>>2]=f<<8&2147483392;v=v<<8;s[o>>2]=v;_=_+8|0;s[ce>>2]=_}k=(s[Ce>>2]|0)==1001;if(k)f=u;else f=_+((re(v|0)|0)+-32)+7>>3;kt=m-f|0;f=(s[Ie>>2]|0)/1600|0;f=(kt|0)<(f|0)?kt:f;if((f|0)>=2)if((f|0)>257)S=257;else ct=436;else{f=2;ct=436}if((ct|0)==436)S=f;if(!k){M=S;break}f=v>>>8;if((S|0)==2)v=v+(te(f,-255)|0)|0;else{v=v-(te(f,258-S|0)|0)|0;s[K>>2]=(s[K>>2]|0)+v;v=f}s[o>>2]=v;while(1){if(v>>>0>=8388609){M=S;break t}f=s[K>>2]|0;k=f>>>23;if((k|0)==255)s[Z>>2]=(s[Z>>2]|0)+1;else{f=f>>>31;v=s[W>>2]|0;if((v|0)>-1){_=s[V>>2]|0;if((_+(s[p>>2]|0)|0)>>>0<(s[b>>2]|0)>>>0){s[V>>2]=_+1;r[(s[Je>>2]|0)+_>>0]=v+f;v=0}else v=-1;s[X>>2]=s[X>>2]|v}v=s[Z>>2]|0;if(v|0){f=f+255&255;do{_=s[V>>2]|0;if((_+(s[p>>2]|0)|0)>>>0<(s[b>>2]|0)>>>0){s[V>>2]=_+1;r[(s[Je>>2]|0)+_>>0]=f;_=0;v=s[Z>>2]|0}else _=-1;s[X>>2]=s[X>>2]|_;v=v+-1|0;s[Z>>2]=v}while((v|0)!=0)}s[W>>2]=k&255;f=s[K>>2]|0;v=s[o>>2]|0;_=s[ce>>2]|0}s[K>>2]=f<<8&2147483392;v=v<<8;s[o>>2]=v;_=_+8|0;s[ce>>2]=_}}while(0);if((ct|0)==456){s[he>>2]=0;y=0;M=0}kt=s[Ce>>2]|0;_=(kt|0)==1002?0:17;if((kt|0)==1e3){v=(s[ce>>2]|0)+((re(s[o>>2]|0)|0)+-32)+7>>3;li(Je);k=v}else{k=m-M|0;k=(k|0)<(u|0)?k:u;yt=s[Je>>2]|0;v=s[p>>2]|0;kt=0-v|0;Tn(yt+k+kt|0,yt+(s[b>>2]|0)+kt|0,v|0)|0;s[b>>2]=k;v=0}f=(y|0)==0;if(f?(s[Ce>>2]|0)==1e3:0)ct=464;else ct=462;do if((ct|0)==462){s[Be>>2]=ht;qs(Xe,10022,Be)|0;if((s[Ce>>2]|0)!=1001){ct=464;break}s[De>>2]=s[e+100>>2];s[De+4>>2]=s[e+104>>2];s[Ue>>2]=De;qs(Xe,10028,Ue)|0}while(0);if((ct|0)==464){s[je>>2]=0;qs(Xe,10028,je)|0}if(!(f|(x|0)==0)){s[Fe>>2]=0;qs(Xe,10010,Fe)|0;s[ze>>2]=0;qs(Xe,4006,ze)|0;s[He>>2]=-1;qs(Xe,4002,He)|0;if((Jt(Xe,w,(s[dt>>2]|0)/200|0,ee+k|0,M,0)|0)<0){v=-3;break}s[Ge>>2]=ft;qs(Xe,4031,Ge)|0;qs(Xe,4028,Ve)|0}s[ut>>2]=_;qs(Xe,10010,ut)|0;_=s[Ce>>2]|0;do if((_|0)==1e3)ct=482;else{kt=s[Re>>2]|0;if((_|0)!=(kt|0)&(kt|0)>0){qs(Xe,4028,Ke)|0;Jt(Xe,c,(s[dt>>2]|0)/400|0,We,2,0)|0;s[Ze>>2]=0;qs(Xe,10002,Ze)|0}if(((s[ce>>2]|0)+((re(s[o>>2]|0)|0)+-32)|0)>(k<<3|0)){ct=482;break}do if(!(f|(x|0)==0)){if((s[Ce>>2]|0)!=1001)break;if(!(s[ot>>2]|0))break;s[Ye>>2]=(s[Ie>>2]|0)-(s[e+36>>2]|0);qs(Xe,4002,Ye)|0}while(0);s[$e>>2]=s[ot>>2];qs(Xe,4006,$e)|0;v=Jt(Xe,w,i,0,k,Je)|0;if((v|0)<0){v=-3;break e}if(f){y=0;ct=488;break}if(!x){_=k;ct=484;break}_=s[Ce>>2]|0;if((_|0)!=1001){S=y;break}if(!(s[ot>>2]|0)){ct=488;break}Mn(ee+v|0,ee+k|0,M|0)|0;ct=488}while(0);do if((ct|0)==482){if(f){y=0;ct=488;break}else _=k;if(!x)ct=484;else ct=488}while(0);if((ct|0)==484){k=s[dt>>2]|0;f=(k|0)/200|0;k=(k|0)/400|0;qs(Xe,4028,Qe)|0;s[et>>2]=0;qs(Xe,10010,et)|0;s[tt>>2]=0;qs(Xe,10002,tt)|0;s[it>>2]=0;qs(Xe,4006,it)|0;s[rt>>2]=-1;qs(Xe,4002,rt)|0;if((s[Ce>>2]|0)==1001){yt=s[Je>>2]|0;_=s[p>>2]|0;kt=0-_|0;Tn(yt+v+kt|0,yt+(s[b>>2]|0)+kt|0,_|0)|0;s[b>>2]=v;_=v}kt=i-f|0;Jt(Xe,w+((te(s[at>>2]|0,kt-k|0)|0)<<2)|0,k,nt,2,0)|0;if((Jt(Xe,w+((te(s[at>>2]|0,kt)|0)<<2)|0,f,ee+_|0,M,0)|0)<0){v=-3;break}s[st>>2]=ft;qs(Xe,4031,st)|0;ct=488}if((ct|0)==488){_=s[Ce>>2]|0;S=y}k=s[Pe>>2]|0;y=(s[dt>>2]|0)/(i|0)|0;f=0;while(1){if((y|0)>=400)break;y=y<<1;f=f+1|0}switch(_|0){case 1e3:{_=(B<<5)+96&224|(f<<3)+-16;break}case 1002:{_=((B|0)<1102?0:(B<<5)+64&96)|f<<3|128;break}default:_=B<<4|(f<<3)+240|96}r[a>>0]=_|((k|0)==2&1)<<2;u=s[o>>2]|0;s[lt>>2]=u^s[ft>>2];if(!xe)_=s[Ce>>2]|0;else _=1002;s[Re>>2]=_;c=s[Pe>>2]|0;s[e+15144>>2]=c;s[e+15148>>2]=i;s[e+15164>>2]=0;t:do if(s[e+184>>2]|0){do if(!(s[ht>>2]|0)){if(!Oe)break t;_=e+19036|0}else{_=e+19036|0;A=+h[e+19040>>2];if(Oe|0)break;k=+h[ht+28>>2]<.10000000149011612;if(k){y=te(s[at>>2]|0,i)|0;f=0;E=0;while(1){if((f|0)>=(y|0))break;_t=+h[t+(f<<2)>>2];f=f+1|0;E=E+_t*_t}if(!((E/+(y|0)*316.2300109863281<=A|0)==0|k^1))break}s[_>>2]=0;break t}while(0);kt=s[_>>2]|0;y=kt+1|0;s[_>>2]=y;if((kt|0)<=9)break;if((y|0)>=31){s[_>>2]=10;break}s[lt>>2]=0;y=s[Ce>>2]|0;v=(s[dt>>2]|0)/(i|0)|0;_=0;while(1){if((v|0)>=400)break;v=v<<1;_=_+1|0}switch(y|0){case 1e3:{v=(B<<5)+96&224|(_<<3)+-16;break}case 1002:{v=((B|0)<1102?0:(B<<5)+64&96)|_<<3|128;break}default:v=B<<4|(_<<3)+240|96}r[a>>0]=v|((c|0)==2&1)<<2;v=1;break e}while(0);t:do if(((s[ce>>2]|0)+((re(u|0)|0)+-32)|0)>((Le<<3)+-8|0)){if((Le|0)<2){v=-2;break e}r[ee>>0]=0;s[lt>>2]=0;v=1}else{if(!((s[Ce>>2]|0)==1e3&(S|0)==0))break;while(1){if((v|0)<=2)break t;if(r[a+v>>0]|0)break t;v=v+-1|0}}while(0);v=v+(M+1)|0;t:do if(!(s[ot>>2]|0)){i:do if((v|0)>=1){do if((v|0)!=(Le|0)){if((v|0)>(Le|0))break i;_=ut+4|0;s[_>>2]=0;kt=a+Le+(0-v)|0;Tn(kt|0,a|0,v|0)|0;if(js(ut,kt,v)|0)break i;v=Fs(ut,s[_>>2]|0,a,Le,1)|0;if((v|0)>0)break;if(!v){v=Le;break t}else{v=-3;break e}}while(0);v=Le;break t}while(0);v=-3;break e}while(0)}while(0);qe(ue|0);kt=v;l=pt;return kt|0}while(0);y=s[e+15136>>2]|0;_=s[e+15152>>2]|0;_=(_|0)==0?1101:_;y=(y|0)==0?1e3:y;e:do if((v|0)>100)ct=63;else{if((v|0)<50|(y|0)==1e3)if((_|0)>1103){_=1103;k=1e3;break}else{y=1e3;ct=64;break}switch(y|0){case 1002:{ct=63;break e}case 1001:break;default:{k=y;break e}}_=(_|0)>1104?_:1104;k=1001}while(0);if((ct|0)==63)if((_|0)==1102){_=1101;k=1002}else{y=1002;ct=64}if((ct|0)==64)k=y;f=s[e+15104>>2]|0;y=0;while(1){if((v|0)>=400)break;v=v<<1;y=y+1|0}switch(k|0){case 1e3:{v=(_<<5)+96&224|(y<<3)+-16;break}case 1002:{v=((_|0)<1102?0:(_<<5)+64&96)|y<<3|128;break}default:v=_<<4|(y<<3)+240|96}v=(v|((f|0)==2&1)<<2)&255;r[a>>0]=v;if(s[ot>>2]|0){kt=1;l=pt;return kt|0}do if((Le|0)==1)ct=78;else{if((Le|0)>=1){_=x+4|0;s[_>>2]=0;kt=a+Le+-1|0;r[kt>>0]=v;v=js(x,kt,1)|0;if(!v){v=Fs(x,s[_>>2]|0,a,Le,1)|0;if((v|0)>0){ct=78;break}if(!v)break;l=pt;return v|0}}else v=-1;kt=v;l=pt;return kt|0}while(0);kt=Le;l=pt;return kt|0}function Ds(e,t,i,r,n,s,a,o,f){e=e|0;t=t|0;i=+i;r=+r;n=n|0;s=s|0;a=a|0;o=o|0;f=f|0;var c=0,l=0,u=0;c=48e3/(f|0)|0;l=(n|0)/(c|0)|0;e:do if((a|0)==1){f=0;while(1){if((f|0)>=(l|0)){f=0;break e}u=+h[o+((te(f,c)|0)<<2)>>2];u=u*u;h[t+(f<<2)>>2]=(u*r+(1-u)*i)*+h[e+(f<<2)>>2];f=f+1|0}}else{f=0;while(1){if((f|0)>=(l|0)){f=0;break e}u=+h[o+((te(f,c)|0)<<2)>>2];u=u*u;u=u*r+(1-u)*i;n=f<<1;h[t+(n<<2)>>2]=u*+h[e+(n<<2)>>2];n=n|1;h[t+(n<<2)>>2]=u*+h[e+(n<<2)>>2];f=f+1|0}}while(0);do{n=l;while(1){if((n|0)>=(s|0))break;o=(te(n,a)|0)+f|0;h[t+(o<<2)>>2]=+h[e+(o<<2)>>2]*r;n=n+1|0}f=f+1|0}while((f|0)<(a|0));return}function Ls(e,t,i,r){e=e|0;t=t|0;i=i|0;r=r|0;var a=0,o=0,f=0,c=0,u=0,d=0,p=0,b=0;b=l;if((s[e+108>>2]|0)==2051)a=0;else a=s[e+116>>2]|0;f=s[e+156>>2]|0;p=e+112|0;c=s[e+144>>2]|0;o=(f|0)==5010;e:do if(((c|0)/200|0|0)>(i|0)|o^1){a=(c|0)/400|0;if((a|0)<=(i|0)){if((f|0)!=5e3){if(o)a=(c|0)/50|0;else{if((f+-5001|0)>>>0>=6){u=-1;break}u=(c*3|0)/50|0;a=a<(i|0)){u=-1;break}}else a=i;if(!((a*400|0)==(c|0)|(a*200|0)==(c|0)|(a*100|0)==(c|0))?(u=a*50|0,!((u|0)==(c|0)|(a*25|0)==(c|0)|(u|0)==(c*3|0))):0)u=-1;else d=16}else u=-1}else{f=(c|0)/400|0;o=Os(t,i,s[p>>2]|0,c,s[e+160>>2]|0,e+7060|0,a,1)|0;while(1){a=f<-1?a:-1;a=s[p>>2]|0;o=te(u,a)|0;f=l;l=l+((1*(o<<2)|0)+15&-16)|0;c=0;while(1){if((c|0)>=(o|0))break;h[f+(c<<2)>>2]=+(n[t+(c<<1)>>1]|0)*30517578125e-15;c=c+1|0}e=Ns(e,f,u,r,3828,16,t,i,0,-2,a,1,0)|0;l=b;return e|0}function Bs(e,t,i){e=e|0;t=t|0;i=i|0;var r=0,a=0,o=0,f=0,c=0,u=0,d=0,p=0,b=0,m=0;m=l;l=l+80|0;f=m+48|0;a=m+40|0;r=m+32|0;d=m+24|0;u=m+16|0;c=m+8|0;o=m;b=m+56|0;s[b>>2]=i;p=e+(s[e>>2]|0)|0;e:do switch(t|0){case 4e3:{p=(s[b>>2]|0)+(4-1)&~(4-1);t=s[p>>2]|0;s[b>>2]=p+4;switch(t|0){case 2051:case 2049:case 2048:break;default:{i=-1;t=108;break e}}i=e+108|0;if((s[e+15164>>2]|0)==0?(s[i>>2]|0)!=(t|0):0){i=-1;t=108;break e}s[i>>2]=t;i=0;t=108;break}case 4001:{p=(s[b>>2]|0)+(4-1)&~(4-1);i=s[p>>2]|0;s[b>>2]=p+4;if(!i)t=109;else{s[i>>2]=s[e+108>>2];i=0;t=108}break}case 4002:{p=(s[b>>2]|0)+(4-1)&~(4-1);i=s[p>>2]|0;s[b>>2]=p+4;if((i|0)!=-1e3)if((i|0)!=-1){if((i|0)<1){t=109;break e}if((i|0)<501)i=500;else{b=(s[e+112>>2]|0)*3e5|0;i=(i|0)>(b|0)?b:i}}else i=-1;else i=-1e3;s[e+164>>2]=i;i=0;t=108;break}case 4003:{p=(s[b>>2]|0)+(4-1)&~(4-1);r=s[p>>2]|0;s[b>>2]=p+4;if(!r)t=109;else{i=s[e+15148>>2]|0;if(!i)t=(s[e+144>>2]|0)/400|0;else t=i;i=s[e+164>>2]|0;switch(i|0){case-1e3:{i=s[e+144>>2]|0;i=((i*60|0)/(t|0)|0)+(te(i,s[e+112>>2]|0)|0)|0;break}case-1:{i=((s[e+144>>2]|0)*10208|0)/(t|0)|0;break}default:{}}s[r>>2]=i;i=0;t=108}break}case 4022:{p=(s[b>>2]|0)+(4-1)&~(4-1);i=s[p>>2]|0;s[b>>2]=p+4;if((i|0)<1){if((i|0)!=-1e3){t=109;break e}}else if((i|0)>(s[e+112>>2]|0)){t=109;break e}s[e+120>>2]=i;i=0;t=108;break}case 4023:{p=(s[b>>2]|0)+(4-1)&~(4-1);i=s[p>>2]|0;s[b>>2]=p+4;if(!i)t=109;else{s[i>>2]=s[e+120>>2];i=0;t=108}break}case 4004:{p=(s[b>>2]|0)+(4-1)&~(4-1);i=s[p>>2]|0;s[b>>2]=p+4;if((i+-1101|0)>>>0>4)t=109;else{s[e+132>>2]=i;switch(i|0){case 1101:{s[e+20>>2]=8e3;i=0;t=108;break e}case 1102:{s[e+20>>2]=12e3;i=0;t=108;break e}default:{s[e+20>>2]=16e3;i=0;t=108;break e}}}break}case 4005:{p=(s[b>>2]|0)+(4-1)&~(4-1);i=s[p>>2]|0;s[b>>2]=p+4;if(!i)t=109;else{s[i>>2]=s[e+132>>2];i=0;t=108}break}case 4008:{p=(s[b>>2]|0)+(4-1)&~(4-1);i=s[p>>2]|0;s[b>>2]=p+4;if((i|0)>=1101){if((i|0)>1105){t=109;break e}s[e+128>>2]=i;if((i|0)==1101){s[e+20>>2]=8e3;i=0;t=108;break e}else t=i;i=e+20|0;if((t|0)==1102){s[i>>2]=12e3;i=0;t=108;break e}}else{if((i|0)!=-1e3){t=109;break e}s[e+128>>2]=-1e3;i=e+20|0}s[i>>2]=16e3;i=0;t=108;break}case 4009:{p=(s[b>>2]|0)+(4-1)&~(4-1);i=s[p>>2]|0;s[b>>2]=p+4;if(!i)t=109;else{s[i>>2]=s[e+15152>>2];i=0;t=108}break}case 4016:{p=(s[b>>2]|0)+(4-1)&~(4-1);i=s[p>>2]|0;s[b>>2]=p+4;if(i>>>0>1)t=109;else{s[e+184>>2]=i;i=0;t=108}break}case 4017:{p=(s[b>>2]|0)+(4-1)&~(4-1);i=s[p>>2]|0;s[b>>2]=p+4;if(!i)t=109;else{s[i>>2]=s[e+184>>2];i=0;t=108}break}case 4010:{d=(s[b>>2]|0)+(4-1)&~(4-1);i=s[d>>2]|0;s[b>>2]=d+4;if(i>>>0>10)t=109;else{s[e+44>>2]=i;s[o>>2]=i;qs(p,4010,o)|0;i=0;t=108}break}case 4011:{p=(s[b>>2]|0)+(4-1)&~(4-1);i=s[p>>2]|0;s[b>>2]=p+4;if(!i)t=109;else{s[i>>2]=s[e+44>>2];i=0;t=108}break}case 4012:{p=(s[b>>2]|0)+(4-1)&~(4-1);i=s[p>>2]|0;s[b>>2]=p+4;if(i>>>0>1)t=109;else{s[e+48>>2]=i;i=0;t=108}break}case 4013:{p=(s[b>>2]|0)+(4-1)&~(4-1);i=s[p>>2]|0;s[b>>2]=p+4;if(!i)t=109;else{s[i>>2]=s[e+48>>2];i=0;t=108}break}case 4014:{d=(s[b>>2]|0)+(4-1)&~(4-1);i=s[d>>2]|0;s[b>>2]=d+4;if(i>>>0>100)t=109;else{s[e+40>>2]=i;s[c>>2]=i;qs(p,4014,c)|0;i=0;t=108}break}case 4015:{p=(s[b>>2]|0)+(4-1)&~(4-1);i=s[p>>2]|0;s[b>>2]=p+4;if(!i)t=109;else{s[i>>2]=s[e+40>>2];i=0;t=108}break}case 4006:{p=(s[b>>2]|0)+(4-1)&~(4-1);i=s[p>>2]|0;s[b>>2]=p+4;if(i>>>0>1)t=109;else{s[e+148>>2]=i;s[e+60>>2]=1-i;i=0;t=108}break}case 4007:{p=(s[b>>2]|0)+(4-1)&~(4-1);i=s[p>>2]|0;s[b>>2]=p+4;if(!i)t=109;else{s[i>>2]=s[e+148>>2];i=0;t=108}break}case 11018:{p=(s[b>>2]|0)+(4-1)&~(4-1);i=s[p>>2]|0;s[b>>2]=p+4;if((i+1|0)>>>0>101)t=109;else{s[e+140>>2]=i;i=0;t=108}break}case 11019:{p=(s[b>>2]|0)+(4-1)&~(4-1);i=s[p>>2]|0;s[b>>2]=p+4;if(!i)t=109;else{s[i>>2]=s[e+140>>2];i=0;t=108}break}case 4020:{p=(s[b>>2]|0)+(4-1)&~(4-1);i=s[p>>2]|0;s[b>>2]=p+4;if(i>>>0>1)t=109;else{s[e+152>>2]=i;i=0;t=108}break}case 4021:{p=(s[b>>2]|0)+(4-1)&~(4-1);i=s[p>>2]|0;s[b>>2]=p+4;if(!i)t=109;else{s[i>>2]=s[e+152>>2];i=0;t=108}break}case 4024:{p=(s[b>>2]|0)+(4-1)&~(4-1);i=s[p>>2]|0;s[b>>2]=p+4;if((i|0)<3001)switch(i|0){case-1e3:break;default:{t=109;break e}}else switch(i|0){case 3002:case 3001:break;default:{t=109;break e}}s[e+124>>2]=i;i=0;t=108;break}case 4025:{p=(s[b>>2]|0)+(4-1)&~(4-1);i=s[p>>2]|0;s[b>>2]=p+4;if(!i)t=109;else{s[i>>2]=s[e+124>>2];i=0;t=108}break}case 4027:{p=(s[b>>2]|0)+(4-1)&~(4-1);t=s[p>>2]|0;s[b>>2]=p+4;if(t){i=(s[e+144>>2]|0)/400|0;s[t>>2]=i;if((s[e+108>>2]|0)==2051){i=0;t=108}else{s[t>>2]=i+(s[e+116>>2]|0);i=0;t=108}}else t=109;break}case 4029:{p=(s[b>>2]|0)+(4-1)&~(4-1);i=s[p>>2]|0;s[b>>2]=p+4;if(!i)t=109;else{s[i>>2]=s[e+144>>2];i=0;t=108}break}case 4031:{p=(s[b>>2]|0)+(4-1)&~(4-1);i=s[p>>2]|0;s[b>>2]=p+4;if(!i)t=109;else{s[i>>2]=s[e+19044>>2];i=0;t=108}break}case 4036:{p=(s[b>>2]|0)+(4-1)&~(4-1);i=s[p>>2]|0;s[b>>2]=p+4;if((i+-8|0)>>>0>16)t=109;else{s[e+168>>2]=i;i=0;t=108}break}case 4037:{p=(s[b>>2]|0)+(4-1)&~(4-1);i=s[p>>2]|0;s[b>>2]=p+4;if(!i)t=109;else{s[i>>2]=s[e+168>>2];i=0;t=108}break}case 4040:{d=(s[b>>2]|0)+(4-1)&~(4-1);i=s[d>>2]|0;s[b>>2]=d+4;switch(i|0){case 5010:case 5006:case 5005:case 5004:case 5003:case 5002:case 5001:case 5e3:break;default:{t=109;break e}}s[e+156>>2]=i;s[u>>2]=i;qs(p,4040,u)|0;i=0;t=108;break}case 4041:{p=(s[b>>2]|0)+(4-1)&~(4-1);i=s[p>>2]|0;s[b>>2]=p+4;if(!i)t=109;else{s[i>>2]=s[e+156>>2];i=0;t=108}break}case 4042:{p=(s[b>>2]|0)+(4-1)&~(4-1);i=s[p>>2]|0;s[b>>2]=p+4;if(i>>>0>1)t=109;else{s[e+76>>2]=i;i=0;t=108}break}case 4043:{p=(s[b>>2]|0)+(4-1)&~(4-1);i=s[p>>2]|0;s[b>>2]=p+4;if(!i)t=109;else{s[i>>2]=s[e+76>>2];i=0;t=108}break}case 4028:{r=e+(s[e+4>>2]|0)|0;a=e+15104|0;kn(e+192|0,0,18856)|0;qs(p,4028,d)|0;i=s[e+180>>2]|0;kn(r|0,0,20400)|0;t=0;while(1){if((t|0)==2)break;Fi(r+(t*10156|0)|0,i)|0;t=t+1|0}s[r+20376>>2]=1;s[r+20380>>2]=1;s[a>>2]=s[e+112>>2];n[e+15108>>1]=16384;h[e+15116>>2]=1;s[e+15164>>2]=1;s[e+15136>>2]=1001;s[e+15152>>2]=1105;s[e+15112>>2]=193536;i=0;t=108;break}case 11002:{p=(s[b>>2]|0)+(4-1)&~(4-1);i=s[p>>2]|0;s[b>>2]=p+4;if((i|0)<1e3){if((i|0)!=-1e3){t=109;break e}}else if((i|0)>1002){t=109;break e}s[e+136>>2]=i;i=0;t=108;break}case 10024:{t=(s[b>>2]|0)+(4-1)&~(4-1);i=s[t>>2]|0;s[b>>2]=t+4;s[e+176>>2]=i;s[r>>2]=i;i=qs(p,10024,r)|0;t=108;break}case 10026:{t=(s[b>>2]|0)+(4-1)&~(4-1);i=s[t>>2]|0;s[b>>2]=t+4;s[e+15168>>2]=i;s[a>>2]=i;i=qs(p,10026,a)|0;t=108;break}case 10015:{e=(s[b>>2]|0)+(4-1)&~(4-1);i=s[e>>2]|0;s[b>>2]=e+4;if(!i)t=109;else{s[f>>2]=i;i=qs(p,10015,f)|0;t=108}break}default:{i=-5;t=108}}while(0);if((t|0)==108){e=i;l=m;return e|0}else if((t|0)==109){e=-1;l=m;return e|0}return 0}function Us(e){e=e|0;Hr(e);return}function js(e,t,i){e=e|0;t=t|0;i=i|0;var n=0,o=0,f=0,h=0,c=0,u=0;u=l;l=l+16|0;h=u;if((i|0)<1){c=-4;l=u;return c|0}c=e+4|0;f=s[c>>2]|0;e:do if(f){if(((r[e>>0]^r[t>>0])&255)>=4){c=-4;l=u;return c|0}}else{r[e>>0]=r[t>>0]|0;n=r[t>>0]|0;do if(n<<24>>24>=0)if((n&96)==96){if(n&8){n=160;break}s[e+296>>2]=80;break e}else{n=(n&255)>>>3&3;if((n|0)==3){n=480;break}s[e+296>>2]=(8e3<>>0)/100|0;break e}else n=(8e3<<((n&255)>>>3&3)>>>0)/400|0;while(0);s[e+296>>2]=n}while(0);n=(a[t>>0]|0)&3;if(n)if((n|0)==3){if((i|0)<2){c=-4;l=u;return c|0}n=(a[t+1>>0]|0)&63;if(!n){c=-4;l=u;return c|0}else o=n}else o=2;else o=1;if((te(o+f|0,s[e+296>>2]|0)|0)>960){c=-4;l=u;return c|0}n=rr(t,i,0,h,e+8+(f<<2)|0,e+200+(f<<1)|0,0,0)|0;if((n|0)<1){c=n;l=u;return c|0}s[c>>2]=(s[c>>2]|0)+o;c=0;l=u;return c|0}function Fs(e,t,i,o,f){e=e|0;t=t|0;i=i|0;o=o|0;f=f|0;var h=0,c=0,l=0,u=0,d=0,p=0,b=0;if((t|0)<1){e=-1;return e|0}if((s[e+4>>2]|0)<(t|0)){e=-1;return e|0}p=e+200|0;e:do switch(t|0){case 1:{h=n[p>>1]|0;if((h|0)<(o|0)){r[i>>0]=a[e>>0]&252;c=i+1|0;h=h+1|0;d=14;break e}else{e=-2;return e|0}}case 2:{h=n[e+202>>1]|0;c=n[p>>1]|0;if(h<<16>>16==c<<16>>16){h=h<<16>>16<<1|1;if((h|0)>(o|0)){e=-2;return e|0}else{r[i>>0]=a[e>>0]&252|1;c=i+1|0;d=14;break e}}h=(c<<16>>16)+(h<<16>>16)+2+(c<<16>>16>251&1)|0;if((h|0)>(o|0)){e=-2;return e|0}u=i+1|0;r[i>>0]=a[e>>0]&252|2;c=n[p>>1]|0;l=c<<16>>16;if(c<<16>>16<252){r[u>>0]=c;c=1}else{c=l|252;r[u>>0]=c;r[i+2>>0]=(l-(c&255)|0)>>>2;c=2}c=u+c|0;d=14;break}default:{h=1;d=15}}while(0);if((d|0)==14)if((f|0)!=0&(h|0)<(o|0)){h=1;d=15}e:do if((d|0)==15){while(1){if((h|0)>=(t|0)){d=23;break}if((n[e+200+(h<<1)>>1]|0)!=(n[p>>1]|0)){d=17;break}h=h+1|0;d=15}do if((d|0)==17){h=t+-1|0;c=0;l=2;while(1){if((c|0)>=(h|0))break;p=n[e+200+(c<<1)>>1]|0;c=c+1|0;l=l+((p<<16>>16>251?2:1)+(p<<16>>16))|0}h=l+(n[e+200+(h<<1)>>1]|0)|0;if((h|0)>(o|0)){e=-2;return e|0}else{r[i>>0]=a[e>>0]|3;l=t|128;r[i+1>>0]=l;u=1;break}}else if((d|0)==23){h=(te(n[p>>1]|0,t)|0)+2|0;if((h|0)>(o|0)){e=-2;return e|0}else{r[i>>0]=a[e>>0]|3;r[i+1>>0]=t;l=t;u=0;break}}while(0);c=i+2|0;if((f|0)!=0?(b=o-h|0,(h|0)!=(o|0)):0){r[i+1>>0]=l|64;h=(b+-1|0)/255|0;l=0;while(1){if((l|0)>=(h|0))break;r[c>>0]=-1;l=l+1|0;c=c+1|0}r[c>>0]=b+(te(h,-255)|0)+255;c=c+1|0;h=o}if(u){d=t+-1|0;p=0;while(1){if((p|0)>=(d|0))break e;l=n[e+200+(p<<1)>>1]|0;u=l<<16>>16;if(l<<16>>16<252){r[c>>0]=l;l=1}else{l=u|252;r[c>>0]=l;r[c+1>>0]=(u-(l&255)|0)>>>2;l=2}p=p+1|0;c=c+l|0}}}while(0);l=0;while(1){if((l|0)>=(t|0))break;b=e+200+(l<<1)|0;Tn(c|0,s[e+8+(l<<2)>>2]|0,n[b>>1]|0)|0;l=l+1|0;c=c+(n[b>>1]|0)|0}if(!f){e=h;return e|0}l=i+o|0;while(1){if(c>>>0>=l>>>0)break;r[c>>0]=0;c=c+1|0}return h|0}function zs(e,t,i,r,a,o,f,c,u,d,p,b){e=e|0;t=t|0;i=i|0;r=r|0;a=a|0;o=o|0;f=f|0;c=c|0;u=u|0;d=d|0;p=p|0;b=b|0;var m=0,w=0,g=0,v=0,_=0,y=0,k=0,E=0,A=0,S=0,M=0,T=0,R=0,x=0,C=0,I=0,P=0,O=0,N=0,D=0,L=0,B=0,U=0,j=0,F=0,V=0,W=0,K=0,Z=0,Y=0,$=0,X=0,J=0,ee=0,te=0,ie=0,re=0,ne=0,se=0,ae=0,oe=0,fe=0,he=0,ce=0,le=0,ue=0,de=0,pe=0,be=0,me=0,we=0,ge=0,ve=0,_e=0,ye=0,ke=0,Ee=0,Ae=0,Se=0,Me=0,Te=0,Re=0,xe=0,Ce=0,Ie=0,Pe=0,Oe=0,Ne=0,De=0,Le=0,Be=0,Ue=0;Le=l;l=l+10288|0;xe=Le+9888|0;Me=Le+9816|0;Ie=Le+9744|0;Se=Le+9712|0;Te=Le+9608|0;Re=Le+9600|0;Ce=Le+5760|0;Oe=Le+1920|0;Ne=Le+960|0;Pe=Le;if(!i)u=e+8504|0;else{_e=(u*195|0)/100|0;_e=(_e|0)<(r|0)?_e:r;ye=e+6884|0;V=s[ye>>2]|0;ke=e+6864|0;Ee=e+6868|0;Ae=e+6844|0;W=t+72|0;K=e+5764|0;u=e+8504|0;Z=e+2884|0;Y=e+4804|0;$=e+3844|0;X=e+6856|0;J=(d|0)<8;ee=e+6848|0;te=e+6852|0;ie=e+5840|0;re=Te+80|0;ne=Te+84|0;se=Te+88|0;ae=Te+92|0;oe=Te+96|0;fe=Re+4|0;he=e+6888|0;ce=e+7688|0;le=e+6892|0;ue=e+7692|0;de=e+7684|0;pe=e+8484|0;be=e+8500|0;me=e+8492|0;we=e+8496|0;ge=e+8488|0;ve=e+6860|0;U=d+-8|0;F=V;V=_e-V|0;while(1){j=(V|0)>480;w=j?480:V;s[ke>>2]=(s[ke>>2]|0)+1;r=s[Ee>>2]|0;D=(r|0)>19?.05000000074505806:1/+(r+1|0);B=r+1|0;N=(r|0)>49?.019999999552965164:1/+(B|0);S=(r|0)>999;P=1/+(B|0);if((r|0)<4){h[Ae>>2]=.5;t=s[W>>2]|0;if(!r){s[K>>2]=240;d=240;r=t}else{r=t;De=7}}else{r=s[W>>2]|0;De=7}if((De|0)==7){De=0;d=s[K>>2]|0}t=720-d|0;Zs[p&1](i,e+2884+(d<<2)|0,(t|0)>(w|0)?w:t,F,o,f,c); +d=s[K>>2]|0;t=d+w|0;do if((t|0)<720)s[K>>2]=t;else{L=s[u>>2]|0;B=e+8516+(L<<5)|0;s[u>>2]=L+((L|0)>198?-199:1);t=0;while(1){if((t|0)==240)break;I=+h[828+(t<<2)>>2];h[Ce+(t<<3)>>2]=I*+h[e+2884+(t<<2)>>2];h[Ce+(t<<3)+4>>2]=I*+h[e+2884+(t+240<<2)>>2];O=480-t+-1|0;h[Ce+(O<<3)>>2]=I*+h[e+2884+(O<<2)>>2];h[Ce+(O<<3)+4>>2]=I*+h[e+2884+(720-t+-1<<2)>>2];t=t+1|0}Mn(Z|0,Y|0,960)|0;t=d+-720+w|0;Zs[p&1](i,$,t,F+720-d|0,o,f,c);s[K>>2]=t+240;m=+h[r+4>>2];t=r+44|0;d=0;while(1){if((d|0)>=(s[r>>2]|0))break;I=+h[Ce+(d<<3)+4>>2];h[Oe+(n[(s[t>>2]|0)+(d<<1)>>1]<<3)>>2]=m*+h[Ce+(d<<3)>>2];h[Oe+(n[(s[t>>2]|0)+(d<<1)>>1]<<3)+4>>2]=m*I;d=d+1|0}ui(r,Oe);I=+h[Oe>>2];if(I!=I|0!=0){s[B>>2]=0;break}else d=1;while(1){if((d|0)==240)break;E=+h[Oe+(d<<3)>>2];O=480-d|0;v=+h[Oe+(O<<3)>>2];m=E+v;_=+h[Oe+(d<<3)+4>>2];k=+h[Oe+(O<<3)+4>>2];g=_-k;k=_+k;E=v-E;v=m*m;_=g*g;do if(!(v+_<1.000000045813705e-18))if(v<_){m=-(m*g*(_+v*.43157973885536194))/((_+v*.6784840226173401)*(_+v*.0859554186463356))+(g<0?-1.5707963705062866:1.5707963705062866);break}else{m=m*g;m=m*(v+_*.43157973885536194)/((v+_*.6784840226173401)*(v+_*.0859554186463356))+(g<0?-1.5707963705062866:1.5707963705062866)-(m<0?-1.5707963705062866:1.5707963705062866);break}else m=0;while(0);v=m*.15915493667125702;r=e+4+(d<<2)|0;_=v-+h[r>>2];t=e+964+(d<<2)|0;y=_-+h[t>>2];m=k*k;g=E*E;do if(!(m+g<1.000000045813705e-18))if(m>2]=+q(+T)+ +q(+I);I=I*I;I=I*I;O=e+1924+(d<<2)|0;h[Ne+(d<<2)>>2]=1/((+h[O>>2]+R*R*2+I)*.25*62341.81640625+1)+-.014999999664723873;h[r>>2]=x;h[t>>2]=C;h[O>>2]=I;d=d+1|0}O=e+8516+(L<<5)+16|0;h[O>>2]=0;e:do if(!(s[Ee>>2]|0)){r=0;while(1){if((r|0)==18){w=0;T=0;E=0;R=0;m=0;x=0;C=0;I=0;break e}h[e+6420+(r<<2)>>2]=1e10;h[e+6492+(r<<2)>>2]=-1e10;r=r+1|0}}else{w=0;T=0;E=0;R=0;m=0;x=0;C=0;I=0}while(0);while(1){if((w|0)>=18)break;d=w+1|0;r=s[1788+(d<<2)>>2]|0;v=0;t=s[1788+(w<<2)>>2]|0;g=0;A=0;while(1){if((t|0)>=(r|0))break;Be=+h[Oe+(t<<3)>>2];M=480-t|0;k=+h[Oe+(M<<3)>>2];y=+h[Oe+(t<<3)+4>>2];_=+h[Oe+(M<<3)+4>>2];_=Be*Be+k*k+y*y+_*_;y=g+_*2*(.5-+h[Pe+(t<<2)>>2]);k=A+_*+h[Ne+(t<<2)>>2];v=v+_;t=t+1|0;g=y;A=k}if(!(v<1e9)|(v!=v|0!=0)){De=37;break}h[e+5844+((s[X>>2]|0)*72|0)+(w<<2)>>2]=v;y=v+1.0000000036274937e-15;E=E+g/y;_=v+1.000000013351432e-10;k=T+ +H(+_);_=+Q(+_);h[Ie+(w<<2)>>2]=_;r=e+6420+(w<<2)|0;v=+h[r>>2]+.009999999776482582;v=_>2]=v;t=e+6492+(w<<2)|0;g=+h[t>>2]+-.10000000149011612;g=_>g?_:g;h[t>>2]=g;if(g>2]=g;v=v+-.5;h[r>>2]=v}_=(_-v)/(g+1.0000000036274937e-15-v);g=0;v=0;r=0;while(1){if((r|0)==8)break;Be=+h[e+5844+(r*72|0)+(w<<2)>>2];g=g+ +H(+Be);v=v+Be;r=r+1|0}v=g/+H(+(v*8+1e-15));v=v>.9900000095367432?.9900000095367432:v;v=v*v;v=v*v;Be=A/y;r=e+5768+(w<<2)|0;g=v*+h[r>>2];g=Be>g?Be:g;h[Me+(w<<2)>>2]=g;m=m+g;if((w|0)>8)m=m-+h[Me+(w+-9<<2)>>2];A=(+(w+-18|0)*.029999999329447746+1)*m;h[r>>2]=g;Be=I+g*+(w+-8|0);w=d;T=k;R=R+v;x=x>A?x:A;C=C+_;I=Be}if((De|0)==37){De=0;s[B>>2]=0;break}k=J?.0005699999746866524:.0005699999746866524/+(1<>2]|0;d=S+1|0;w=s[1864+(d<<2)>>2]|0;_=0;r=t;while(1){if((r|0)>=(w|0))break;v=+h[Oe+(r<<3)>>2];P=+h[Oe+(r<<3)+4>>2];Ue=480-r|0;A=+h[Oe+(Ue<<3)>>2];Be=+h[Oe+(Ue<<3)+4>>2];_=_+(v*v+A*A+P*P+Be*Be);r=r+1|0}v=g>_?g:_;Ue=e+6564+(S<<2)|0;g=y*+h[Ue>>2];g=g>_?g:_;h[Ue>>2]=g;g=_>g?_:g;m=m*.05000000074505806;m=m>g?m:g;if(!(g>m*.1&g*1e9>v)){Ue=M;S=d;g=v;M=Ue;continue}if(!(g>k*+(w-t|0))){Ue=M;S=d;g=v;M=Ue;continue}M=S;S=d;g=v}w=s[Ee>>2]|0;S=(w|0)<3?20:M;T=+zr(T)*20;P=+h[ee>>2]+-.029999999329447746;P=P>T?P:T;h[ee>>2]=P;Be=+h[te>>2]*(1-N);h[te>>2]=T>2]*+h[Ie+(t<<2)>>2];t=t+1|0;m=Be}h[Se+(d<<2)>>2]=m;d=d+1|0}g=R/18;T=E/18;h[O>>2]=T+(1-T)*((w|0)<10?.5:C/18);N=x/9;Be=+h[ie>>2]*.800000011920929;Be=N>Be?N:Be;h[ie>>2]=Be;d=e+8516+(L<<5)+8|0;h[d>>2]=I*.015625;s[X>>2]=((s[X>>2]|0)+1|0)%8|0;s[Ee>>2]=(s[Ee>>2]|0)+1;t=e+8516+(L<<5)+4|0;h[t>>2]=Be;r=0;while(1){if((r|0)==4)break;h[Te+(r<<2)>>2]=(+h[Se+(r<<2)>>2]+ +h[e+6648+(r+24<<2)>>2])*-.12298999726772308+(+h[e+6648+(r<<2)>>2]+ +h[e+6648+(r+16<<2)>>2])*.49195000529289246+ +h[e+6648+(r+8<<2)>>2]*.6969299912452698-+h[e+6776+(r<<2)>>2]*1.4349000453948975;r=r+1|0}m=1-D;r=0;while(1){if((r|0)==4){r=0;break}Ue=e+6776+(r<<2)|0;h[Ue>>2]=m*+h[Ue>>2]+D*+h[Se+(r<<2)>>2];r=r+1|0}while(1){if((r|0)==4){r=0;break}h[Te+(r+4<<2)>>2]=(+h[Se+(r<<2)>>2]-+h[e+6648+(r+24<<2)>>2])*.6324599981307983+(+h[e+6648+(r<<2)>>2]-+h[e+6648+(r+16<<2)>>2])*.31622999906539917;r=r+1|0}while(1){if((r|0)==3)break;Ue=r+8|0;h[Te+(Ue<<2)>>2]=(+h[Se+(r<<2)>>2]+ +h[e+6648+(r+24<<2)>>2])*.5345199704170227-(+h[e+6648+(r<<2)>>2]+ +h[e+6648+(r+16<<2)>>2])*.26725998520851135-+h[e+6648+(Ue<<2)>>2]*.5345199704170227;r=r+1|0}e:do if((s[Ee>>2]|0)>5){r=0;while(1){if((r|0)==9){r=0;break e}Ue=e+6808+(r<<2)|0;Be=+h[Te+(r<<2)>>2];h[Ue>>2]=m*+h[Ue>>2]+D*Be*Be;r=r+1|0}}else r=0;while(0);while(1){if((r|0)==8){r=0;break}Ue=e+6648+(r+16<<2)|0;s[e+6648+(r+24<<2)>>2]=s[Ue>>2];M=e+6648+(r+8<<2)|0;s[Ue>>2]=s[M>>2];Ue=e+6648+(r<<2)|0;s[M>>2]=s[Ue>>2];s[Ue>>2]=s[Se+(r<<2)>>2];r=r+1|0}while(1){if((r|0)==9)break;Be=+H(+ +h[e+6808+(r<<2)>>2]);h[Te+(r+11<<2)>>2]=Be-+h[2464+(r<<2)>>2];r=r+1|0}h[re>>2]=+h[t>>2]+-.154723;h[ne>>2]=+h[O>>2]+-.724643;h[se>>2]=g+-.743717;h[ae>>2]=+h[d>>2]+.069216;h[oe>>2]=+h[te>>2]+-.06793;r=3304;w=0;while(1){if((w|0)==16){r=4968;w=0;break}t=r;d=0;m=+h[r>>2];while(1){t=t+4|0;if((d|0)==25)break;Be=m+ +h[Te+(d<<2)>>2]*+h[t>>2];d=d+1|0;m=Be}r=r+104|0;if(m<8)if(m>-8)if(m!=m|0!=0)m=0;else{Ue=m<0;m=Ue?-m:m;O=~~+z(+(m*25+.5));m=m-+(O|0)*.03999999910593033;Be=+h[2500+(O<<2)>>2];m=(Ue?-1:1)*(Be+m*(1-Be*Be)*(1-Be*m))}else m=-1;else m=1;h[xe+(w<<2)>>2]=m;w=w+1|0}while(1){if((w|0)==2)break;t=r;d=0;m=+h[r>>2];while(1){t=t+4|0;if((d|0)==16)break;Be=m+ +h[xe+(d<<2)>>2]*+h[t>>2];d=d+1|0;m=Be}r=r+68|0;if(m<8)if(m>-8)if(m!=m|0!=0)m=0;else{Ue=m<0;m=Ue?-m:m;O=~~+z(+(m*25+.5));m=m-+(O|0)*.03999999910593033;Be=+h[2500+(O<<2)>>2];m=(Ue?-1:1)*(Be+m*(1-Be*Be)*(1-Be*m))}else m=-1;else m=1;h[Re+(w<<2)>>2]=m;w=w+1|0}A=(+h[Re>>2]+1)*.5;E=+h[fe>>2]*.5+.5;E=E*E;h[fe>>2]=E;A=E*A+(1-E)*.5;h[Re>>2]=A;h[e+8516+(L<<5)+28>>2]=E;_=E*4999999873689376e-20;Ue=A>.949999988079071;O=A<.05000000074505806&(Ue^1);k=O|Ue?O?.05000000074505806:.949999988079071:A;D=+h[Ae>>2];O=D>.949999988079071;Ue=D<.05000000074505806&(O^1);y=Ue|O?Ue?.05000000074505806:.949999988079071:D;N=1-D;g=1-_;k=+q(+(k-y))*.05000000074505806/(k*(1-y)+y*(1-k))+.009999999776482582;y=+G(+(1-A),+k);k=+G(+A,+k);Be=(D*g+N*_)*k;Be=Be/((N*g+D*_)*y+Be);h[Ae>>2]=Be;h[e+8516+(L<<5)+20>>2]=Be;if((s[Ee>>2]|0)==1){h[he>>2]=.5;h[ce>>2]=.5;m=.5}else m=+h[he>>2];m=m+ +h[le>>2];v=+h[ce>>2]+ +h[ue>>2];h[he>>2]=m*g*y;h[ce>>2]=v*g*k;r=1;while(1){if((r|0)==199)break;Ue=r+1|0;h[e+6888+(r<<2)>>2]=+h[e+6888+(Ue<<2)>>2]*y;h[e+7688+(r<<2)>>2]=+h[e+7688+(Ue<<2)>>2]*k;r=Ue}h[de>>2]=v*_*y;h[pe>>2]=m*_*k;r=0;m=9.999999682655225e-21;while(1){if((r|0)==200)break;Be=m+(+h[e+6888+(r<<2)>>2]+ +h[e+7688+(r<<2)>>2]);r=r+1|0;m=Be}m=1/m;r=0;while(1){if((r|0)==200)break;Ue=e+6888+(r<<2)|0;h[Ue>>2]=+h[Ue>>2]*m;Ue=e+7688+(r<<2)|0;h[Ue>>2]=+h[Ue>>2]*m;r=r+1|0}if(E>.75){m=+h[Ae>>2];if(m>.9){Ue=(s[be>>2]|0)+1|0;s[be>>2]=(Ue|0)<500?Ue:500;D=+h[me>>2];Be=A-D;h[me>>2]=D+1/+(Ue|0)*(Be<-.20000000298023224?-.20000000298023224:Be)}if(m<.1){Ue=(s[we>>2]|0)+1|0;s[we>>2]=(Ue|0)<500?Ue:500;D=+h[ge>>2];Be=A-D;h[ge>>2]=D+1/+(Ue|0)*(Be>.20000000298023224?.20000000298023224:Be)}}else{if(!(s[be>>2]|0))h[me>>2]=.8999999761581421;if(!(s[we>>2]|0))h[ge>>2]=.10000000149011612}r=+h[Ae>>2]>.5&1;if((s[ve>>2]|0)!=(r|0))s[ke>>2]=0;s[ve>>2]=r;s[e+8516+(L<<5)+24>>2]=S;h[e+8516+(L<<5)+12>>2]=T;s[B>>2]=1}while(0);if(j){F=F+480|0;V=V+-480|0}else break}s[ye>>2]=_e-a}s[b>>2]=0;w=e+8508|0;r=s[w>>2]|0;t=s[u>>2]|0;d=t-r|0;d=(d|0)<0?d+200|0:d;if((a|0)<481|(t|0)==(r|0))u=r;else{u=r+1|0;u=(u|0)==200?0:u}r=(u|0)==(t|0)?t+-1|0:u;r=e+8516+(((r|0)<0?199:r)<<5)|0;s[b>>2]=s[r>>2];s[b+4>>2]=s[r+4>>2];s[b+8>>2]=s[r+8>>2];s[b+12>>2]=s[r+12>>2];s[b+16>>2]=s[r+16>>2];s[b+20>>2]=s[r+20>>2];s[b+24>>2]=s[r+24>>2];s[b+28>>2]=s[r+28>>2];r=e+8512|0;u=(s[r>>2]|0)+((a|0)/120|0)|0;s[r>>2]=u;while(1){if((u|0)<=3)break;Ue=u+-4|0;s[r>>2]=Ue;s[w>>2]=(s[w>>2]|0)+1;u=Ue}u=s[w>>2]|0;if((u|0)>199)s[w>>2]=u+-200;u=(d|0)>10?210-d|0:200;r=0;m=0;while(1){if((r|0)>=(u|0))break;Be=m+ +h[e+7688+(r<<2)>>2];r=r+1|0;m=Be}while(1){if((r|0)>=200)break;Be=m+ +h[e+6888+(r<<2)>>2];r=r+1|0;m=Be}h[b+20>>2]=m*+h[e+8492>>2]+(1-m)*+h[e+8488>>2];l=Le;return}function qs(e,t,i){e=e|0;t=t|0;i=i|0;var r=0,n=0,a=0,o=0,f=0,c=0;f=l;l=l+16|0;r=f;s[r>>2]=i;do switch(t|0){case 4010:{o=(s[r>>2]|0)+(4-1)&~(4-1);t=s[o>>2]|0;s[r>>2]=o+4;if(t>>>0>10)t=40;else{s[e+24>>2]=t;t=39}break}case 10010:{o=(s[r>>2]|0)+(4-1)&~(4-1);t=s[o>>2]|0;s[r>>2]=o+4;if((t|0)>=0?(t|0)<(s[(s[e>>2]|0)+8>>2]|0):0){s[e+32>>2]=t;t=39}else t=40;break}case 10012:{o=(s[r>>2]|0)+(4-1)&~(4-1);t=s[o>>2]|0;s[r>>2]=o+4;if((t|0)>=1?(t|0)<=(s[(s[e>>2]|0)+8>>2]|0):0){s[e+36>>2]=t;t=39}else t=40;break}case 10002:{o=(s[r>>2]|0)+(4-1)&~(4-1);t=s[o>>2]|0;s[r>>2]=o+4;if(t>>>0>2)t=40;else{s[e+20>>2]=(t|0)<2&1;s[e+12>>2]=(t|0)==0&1;t=39}break}case 4014:{o=(s[r>>2]|0)+(4-1)&~(4-1);t=s[o>>2]|0;s[r>>2]=o+4;if(t>>>0>100)t=40;else{s[e+56>>2]=t;t=39}break}case 4020:{o=(s[r>>2]|0)+(4-1)&~(4-1);t=s[o>>2]|0;s[r>>2]=o+4;s[e+52>>2]=t;t=39;break}case 4006:{o=(s[r>>2]|0)+(4-1)&~(4-1);t=s[o>>2]|0;s[r>>2]=o+4;s[e+44>>2]=t;t=39;break}case 4002:{o=(s[r>>2]|0)+(4-1)&~(4-1);t=s[o>>2]|0;s[r>>2]=o+4;if((t|0)>500|(t|0)==-1){o=(s[e+4>>2]|0)*26e4|0;s[e+40>>2]=(t|0)<(o|0)?t:o;t=39}else t=40;break}case 10008:{o=(s[r>>2]|0)+(4-1)&~(4-1);t=s[o>>2]|0;s[r>>2]=o+4;if((t+-1|0)>>>0>1)t=40;else{s[e+8>>2]=t;t=39}break}case 4036:{o=(s[r>>2]|0)+(4-1)&~(4-1);t=s[o>>2]|0;s[r>>2]=o+4;if((t+-8|0)>>>0>16)t=40;else{s[e+60>>2]=t;t=39}break}case 4037:{o=(s[r>>2]|0)+(4-1)&~(4-1);t=s[o>>2]|0;s[r>>2]=o+4;s[t>>2]=s[e+60>>2];t=39;break}case 4040:{o=(s[r>>2]|0)+(4-1)&~(4-1);t=s[o>>2]|0;s[r>>2]=o+4;s[e+64>>2]=t;t=39;break}case 4028:{t=e+4|0;a=s[t>>2]|0;n=s[e>>2]|0;c=s[n+4>>2]|0;i=e+212+((te(a,c+1024|0)|0)<<2)|0;o=s[n+8>>2]|0;r=te(a,o)|0;i=i+(r<<2)|0;r=i+(r<<2)|0;kn(e+76|0,0,((te(c,a)|0)<<2)+212+(a<<12)+((te(a<<2,o)|0)<<2)+-76|0)|0;o=0;while(1){if((o|0)>=(te(a,s[n+8>>2]|0)|0))break;h[r+(o<<2)>>2]=-28;h[i+(o<<2)>>2]=-28;n=s[e>>2]|0;a=s[t>>2]|0;o=o+1|0}s[e+184>>2]=0;h[e+84>>2]=1;s[e+80>>2]=2;s[e+88>>2]=256;s[e+96>>2]=0;s[e+100>>2]=0;t=39;break}case 10016:{c=(s[r>>2]|0)+(4-1)&~(4-1);t=s[c>>2]|0;s[r>>2]=c+4;s[e+48>>2]=t;t=39;break}case 10022:{c=(s[r>>2]|0)+(4-1)&~(4-1);t=s[c>>2]|0;s[r>>2]=c+4;if(!t)t=39;else{c=e+120|0;s[c>>2]=s[t>>2];s[c+4>>2]=s[t+4>>2];s[c+8>>2]=s[t+8>>2];s[c+12>>2]=s[t+12>>2];s[c+16>>2]=s[t+16>>2];s[c+20>>2]=s[t+20>>2];s[c+24>>2]=s[t+24>>2];s[c+28>>2]=s[t+28>>2];t=39}break}case 10028:{c=(s[r>>2]|0)+(4-1)&~(4-1);t=s[c>>2]|0;s[r>>2]=c+4;if(!t)t=39;else{o=t;c=s[o+4>>2]|0;t=e+152|0;s[t>>2]=s[o>>2];s[t+4>>2]=c;t=39}break}case 10015:{c=(s[r>>2]|0)+(4-1)&~(4-1);t=s[c>>2]|0;s[r>>2]=c+4;if(!t)t=40;else{s[t>>2]=s[e>>2];t=39}break}case 4031:{c=(s[r>>2]|0)+(4-1)&~(4-1);t=s[c>>2]|0;s[r>>2]=c+4;if(!t)t=40;else{s[t>>2]=s[e+76>>2];t=39}break}case 10024:{c=(s[r>>2]|0)+(4-1)&~(4-1);t=s[c>>2]|0;s[r>>2]=c+4;s[e+68>>2]=t;t=39;break}case 10026:{c=(s[r>>2]|0)+(4-1)&~(4-1);t=s[c>>2]|0;s[r>>2]=c+4;s[e+204>>2]=t;t=39;break}default:{c=-5;l=f;return c|0}}while(0);if((t|0)==39){c=0;l=f;return c|0}else if((t|0)==40){c=-1;l=f;return c|0}return 0}var Hs=[Yn,Zr,hn,ln,vs,Yn,Yn,Yn];var Gs=[$n,rn,Jr,bn];var Vs=[Xn,Gr,en,Wr,Kr,Vr,sn,an,fn,cn,un,gs,Xn,Xn,Xn,Xn];var Ws=[Jn,ys];var Ks=[Qn,on,ws,Qn];var Zs=[es,Ps];var Ys=[ts];var $s=[is,_s,ms,is];var Xs=[rs,tn,$r,dn];var Js=[ns,bs,ks,ns];var Qs=[ss,nn,Qr,wn];return{___cxa_can_catch:vn,_free:Hr,_opus_strerror:Ss,_opus_decoder_create:Ms,___cxa_is_pointer_type:_n,_i64Add:En,_memmove:Tn,_bitshift64Ashr:An,_opus_encoder_destroy:Us,_memset:kn,_malloc:qr,_opus_decoder_destroy:Cs,_opus_encoder_create:Is,_memcpy:Mn,___getTypeName:Fr,_bitshift64Lshr:Sn,_opus_decoder_ctl:xs,_opus_encoder_ctl:Bs,__GLOBAL__sub_I_opusscript_encoder_cpp:Es,__GLOBAL__sub_I_bind_cpp:jr,runPostSets:yn,stackAlloc:as,stackSave:os,stackRestore:fs,establishStackSpace:hs,setThrew:cs,setTempRet0:ds,getTempRet0:ps,dynCall_iiii:Un,dynCall_viiiii:jn,dynCall_vi:Fn,dynCall_iiiiiii:zn,dynCall_ii:qn,dynCall_viiiiiii:Hn,dynCall_v:Gn,dynCall_iiiii:Vn,dynCall_viiiiii:Wn,dynCall_iiiiii:Kn,dynCall_viiii:Zn}}(Module.asmGlobalArg,Module.asmLibraryArg,buffer),runPostSets=Module.runPostSets=asm.runPostSets,___cxa_can_catch=Module.___cxa_can_catch=asm.___cxa_can_catch,__GLOBAL__sub_I_bind_cpp=Module.__GLOBAL__sub_I_bind_cpp=asm.__GLOBAL__sub_I_bind_cpp,_free=Module._free=asm._free,_opus_strerror=Module._opus_strerror=asm._opus_strerror,_opus_decoder_create=Module._opus_decoder_create=asm._opus_decoder_create,___cxa_is_pointer_type=Module.___cxa_is_pointer_type=asm.___cxa_is_pointer_type,_i64Add=Module._i64Add=asm._i64Add,_memmove=Module._memmove=asm._memmove,_bitshift64Ashr=Module._bitshift64Ashr=asm._bitshift64Ashr,_opus_encoder_destroy=Module._opus_encoder_destroy=asm._opus_encoder_destroy,_memset=Module._memset=asm._memset,_malloc=Module._malloc=asm._malloc,_opus_decoder_destroy=Module._opus_decoder_destroy=asm._opus_decoder_destroy,_opus_encoder_create=Module._opus_encoder_create=asm._opus_encoder_create,_memcpy=Module._memcpy=asm._memcpy,___getTypeName=Module.___getTypeName=asm.___getTypeName,_bitshift64Lshr=Module._bitshift64Lshr=asm._bitshift64Lshr,_opus_encoder_ctl=Module._opus_encoder_ctl=asm._opus_encoder_ctl,_opus_decoder_ctl=Module._opus_decoder_ctl=asm._opus_decoder_ctl,__GLOBAL__sub_I_opusscript_encoder_cpp=Module.__GLOBAL__sub_I_opusscript_encoder_cpp=asm.__GLOBAL__sub_I_opusscript_encoder_cpp,dynCall_iiii=Module.dynCall_iiii=asm.dynCall_iiii,dynCall_viiiii=Module.dynCall_viiiii=asm.dynCall_viiiii,dynCall_vi=Module.dynCall_vi=asm.dynCall_vi,dynCall_iiiiiii=Module.dynCall_iiiiiii=asm.dynCall_iiiiiii,dynCall_ii=Module.dynCall_ii=asm.dynCall_ii,dynCall_viiiiiii=Module.dynCall_viiiiiii=asm.dynCall_viiiiiii,dynCall_v=Module.dynCall_v=asm.dynCall_v,dynCall_iiiii=Module.dynCall_iiiii=asm.dynCall_iiiii,dynCall_viiiiii=Module.dynCall_viiiiii=asm.dynCall_viiiiii,dynCall_iiiiii=Module.dynCall_iiiiii=asm.dynCall_iiiiii,dynCall_viiii=Module.dynCall_viiii=asm.dynCall_viiii;Runtime.stackAlloc=asm.stackAlloc,Runtime.stackSave=asm.stackSave,Runtime.stackRestore=asm.stackRestore,Runtime.establishStackSpace=asm.establishStackSpace,Runtime.setTempRet0=asm.setTempRet0,Runtime.getTempRet0=asm.getTempRet0,ExitStatus.prototype=new Error,ExitStatus.prototype.constructor=ExitStatus;var initialStackTop,preloadStartTime=null,calledMain=!1;dependenciesFulfilled=function e(){Module.calledRun||run(),Module.calledRun||(dependenciesFulfilled=e)},Module.callMain=Module.callMain=function(e){function t(){for(var e=0;e<3;e++)r.push(0)}e=e||[],ensureInitRuntime();var i=e.length+1,r=[allocate(intArrayFromString(Module.thisProgram),"i8",ALLOC_NORMAL)];t();for(var n=0;n0;)Module.preInit.pop()();var shouldRunNow=!0;Module.noInitialRun&&(shouldRunNow=!1),run()}).call(exports,__webpack_require__(5),"node_modules/opusscript/build")},function(e,t,i){"use strict";(function(t){function r(e,t,i){if(!~o.indexOf(e))throw new RangeError(`${e} is an invalid sampling rate.`);this.samplingRate=e,this.channels=t||1,this.application=i||s.AUDIO,this.handler=new n.OpusScriptHandler(this.samplingRate,this.channels,this.application),this.inPCMLength=f*this.channels*2,this.inPCMPointer=n._malloc(this.inPCMLength),this.inPCM=n.HEAPU16.subarray(this.inPCMPointer,this.inPCMPointer+this.inPCMLength),this.inOpusPointer=n._malloc(h),this.inOpus=n.HEAPU8.subarray(this.inOpusPointer,this.inOpusPointer+h),this.outOpusPointer=n._malloc(h),this.outOpus=n.HEAPU8.subarray(this.outOpusPointer,this.outOpusPointer+h),this.outPCMLength=f*this.channels*2,this.outPCMPointer=n._malloc(this.outPCMLength),this.outPCM=n.HEAPU16.subarray(this.outPCMPointer,this.outPCMPointer+this.outPCMLength)}var n=i(203),s={VOIP:2048,AUDIO:2049,RESTRICTED_LOWDELAY:2051},a={0:"OK","-1":"Bad argument","-2":"Buffer too small","-3":"Internal error","-4":"Invalid packet","-5":"Unimplemented","-6":"Invalid state","-7":"Memory allocation fail"},o=[8e3,12e3,16e3,24e3,48e3],f=2880,h=3828,c=4002;r.prototype.setBitrate=function(e){this.bitrate=e||64e3,n.setValue(this.bitratePointer,this.bitrate,"i32");var t=n._opus_encoder_ctl(this.handler,c,this.bitratePointer);if(t<0)throw new Error("Failed to set bitrate: "+a[""+n.getValue(t,"i32")])},r.prototype.encode=function(e,i){this.inPCM.set(e);var r=this.handler._encode(this.inPCM.byteOffset,e.length,this.outOpusPointer,i);if(r<0)throw new Error("Encode error: "+a[""+r]);return new t(this.outOpus.subarray(0,r))},r.prototype.decode=function(e){this.inOpus.set(e);var i=this.handler._decode(this.inOpusPointer,e.length,this.outPCM.byteOffset);if(i<0)throw new Error("Decode error: "+a[""+i]);return new t(this.outPCM.subarray(0,i*this.channels*2))},r.Application=s,r.Error=a,r.VALID_SAMPLING_RATES=o,r.MAX_PACKET_SIZE=h,e.exports=r}).call(t,i(0).Buffer)},function(e,t){"use strict";e.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},function(e,t,i){"use strict";function r(e,t){return e.msg=N[t],t}function n(e){return(e<<1)-(e>4?9:0)}function s(e){for(var t=e.length;--t>=0;)e[t]=0}function a(e){var t=e.state,i=t.pending;i>e.avail_out&&(i=e.avail_out),0!==i&&(C.arraySet(e.output,t.pending_buf,t.pending_out,i,e.next_out),e.next_out+=i,t.pending_out+=i,e.total_out+=i,e.avail_out-=i,t.pending-=i,0===t.pending&&(t.pending_out=0))}function o(e,t){I._tr_flush_block(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,a(e.strm)}function f(e,t){e.pending_buf[e.pending++]=t}function h(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function c(e,t,i,r){var n=e.avail_in;return n>r&&(n=r),0===n?0:(e.avail_in-=n,C.arraySet(t,e.input,e.next_in,n,i),1===e.state.wrap?e.adler=P(e.adler,t,n,i):2===e.state.wrap&&(e.adler=O(e.adler,t,n,i)),e.next_in+=n,e.total_in+=n,n)}function l(e,t){var i,r,n=e.max_chain_length,s=e.strstart,a=e.prev_length,o=e.nice_match,f=e.strstart>e.w_size-le?e.strstart-(e.w_size-le):0,h=e.window,c=e.w_mask,l=e.prev,u=e.strstart+ce,d=h[s+a-1],p=h[s+a];e.prev_length>=e.good_match&&(n>>=2),o>e.lookahead&&(o=e.lookahead);do if(i=t,h[i+a]===p&&h[i+a-1]===d&&h[i]===h[s]&&h[++i]===h[s+1]){s+=2,i++;do;while(h[++s]===h[++i]&&h[++s]===h[++i]&&h[++s]===h[++i]&&h[++s]===h[++i]&&h[++s]===h[++i]&&h[++s]===h[++i]&&h[++s]===h[++i]&&h[++s]===h[++i]&&sa){if(e.match_start=t,a=r,r>=o)break;d=h[s+a-1],p=h[s+a]}}while((t=l[t&c])>f&&0!==--n);return a<=e.lookahead?a:e.lookahead}function u(e){var t,i,r,n,s,a=e.w_size;do{if(n=e.window_size-e.lookahead-e.strstart,e.strstart>=a+(a-le)){C.arraySet(e.window,e.window,a,a,0),e.match_start-=a,e.strstart-=a,e.block_start-=a,i=e.hash_size,t=i;do r=e.head[--t],e.head[t]=r>=a?r-a:0;while(--i);i=a,t=i;do r=e.prev[--t],e.prev[t]=r>=a?r-a:0;while(--i);n+=a}if(0===e.strm.avail_in)break;if(i=c(e.strm,e.window,e.strstart+e.lookahead,n),e.lookahead+=i,e.lookahead+e.insert>=he)for(s=e.strstart-e.insert,e.ins_h=e.window[s],e.ins_h=(e.ins_h<e.pending_buf_size-5&&(i=e.pending_buf_size-5);;){if(e.lookahead<=1){if(u(e),0===e.lookahead&&t===D)return _e;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var r=e.block_start+i;if((0===e.strstart||e.strstart>=r)&&(e.lookahead=e.strstart-r,e.strstart=r,o(e,!1),0===e.strm.avail_out))return _e;if(e.strstart-e.block_start>=e.w_size-le&&(o(e,!1),0===e.strm.avail_out))return _e}return e.insert=0,t===U?(o(e,!0),0===e.strm.avail_out?ke:Ee):e.strstart>e.block_start&&(o(e,!1),0===e.strm.avail_out)?_e:_e}function p(e,t){for(var i,r;;){if(e.lookahead=he&&(e.ins_h=(e.ins_h<=he)if(r=I._tr_tally(e,e.strstart-e.match_start,e.match_length-he),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=he){e.match_length--;do e.strstart++,e.ins_h=(e.ins_h<=he&&(e.ins_h=(e.ins_h<4096)&&(e.match_length=he-1)),e.prev_length>=he&&e.match_length<=e.prev_length){n=e.strstart+e.lookahead-he,r=I._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-he),e.lookahead-=e.prev_length-1,e.prev_length-=2;do++e.strstart<=n&&(e.ins_h=(e.ins_h<=he&&e.strstart>0&&(n=e.strstart-1,r=a[n],r===a[++n]&&r===a[++n]&&r===a[++n])){s=e.strstart+ce;do;while(r===a[++n]&&r===a[++n]&&r===a[++n]&&r===a[++n]&&r===a[++n]&&r===a[++n]&&r===a[++n]&&r===a[++n]&&ne.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=he?(i=I._tr_tally(e,1,e.match_length-he),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(i=I._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),i&&(o(e,!1),0===e.strm.avail_out))return _e}return e.insert=0,t===U?(o(e,!0),0===e.strm.avail_out?ke:Ee):e.last_lit&&(o(e,!1),0===e.strm.avail_out)?_e:ye}function w(e,t){for(var i;;){if(0===e.lookahead&&(u(e),0===e.lookahead)){if(t===D)return _e;break}if(e.match_length=0,i=I._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,i&&(o(e,!1),0===e.strm.avail_out))return _e}return e.insert=0,t===U?(o(e,!0),0===e.strm.avail_out?ke:Ee):e.last_lit&&(o(e,!1),0===e.strm.avail_out)?_e:ye}function g(e,t,i,r,n){this.good_length=e,this.max_lazy=t,this.nice_length=i,this.max_chain=r,this.func=n}function v(e){e.window_size=2*e.w_size,s(e.head),e.max_lazy_match=x[e.level].max_lazy,e.good_match=x[e.level].good_length,e.nice_match=x[e.level].nice_length,e.max_chain_length=x[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=he-1,e.match_available=0,e.ins_h=0}function _(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=J,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new C.Buf16(2*oe),this.dyn_dtree=new C.Buf16(2*(2*se+1)),this.bl_tree=new C.Buf16(2*(2*ae+1)),s(this.dyn_ltree),s(this.dyn_dtree),s(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new C.Buf16(fe+1),this.heap=new C.Buf16(2*ne+1),s(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new C.Buf16(2*ne+1),s(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function y(e){var t;return e&&e.state?(e.total_in=e.total_out=0,e.data_type=X,t=e.state,t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap?de:ge,e.adler=2===t.wrap?0:1,t.last_flush=D,I._tr_init(t),F):r(e,q)}function k(e){var t=y(e);return t===F&&v(e.state),t}function E(e,t){return e&&e.state?2!==e.state.wrap?q:(e.state.gzhead=t,F):q}function A(e,t,i,n,s,a){if(!e)return q;var o=1;if(t===V&&(t=6),n<0?(o=0,n=-n):n>15&&(o=2,n-=16),s<1||s>Q||i!==J||n<8||n>15||t<0||t>9||a<0||a>Y)return r(e,q);8===n&&(n=9);var f=new _;return e.state=f,f.strm=e,f.wrap=o,f.gzhead=null,f.w_bits=n,f.w_size=1<j||t<0)return e?r(e,q):q;if(o=e.state,!e.output||!e.input&&0!==e.avail_in||o.status===ve&&t!==U)return r(e,0===e.avail_out?G:q);if(o.strm=e,i=o.last_flush,o.last_flush=t,o.status===de)if(2===o.wrap)e.adler=0,f(o,31),f(o,139),f(o,8),o.gzhead?(f(o,(o.gzhead.text?1:0)+(o.gzhead.hcrc?2:0)+(o.gzhead.extra?4:0)+(o.gzhead.name?8:0)+(o.gzhead.comment?16:0)),f(o,255&o.gzhead.time),f(o,o.gzhead.time>>8&255),f(o,o.gzhead.time>>16&255),f(o,o.gzhead.time>>24&255),f(o,9===o.level?2:o.strategy>=K||o.level<2?4:0),f(o,255&o.gzhead.os),o.gzhead.extra&&o.gzhead.extra.length&&(f(o,255&o.gzhead.extra.length),f(o,o.gzhead.extra.length>>8&255)),o.gzhead.hcrc&&(e.adler=O(e.adler,o.pending_buf,o.pending,0)),o.gzindex=0,o.status=pe):(f(o,0),f(o,0),f(o,0),f(o,0),f(o,0),f(o,9===o.level?2:o.strategy>=K||o.level<2?4:0),f(o,Ae),o.status=ge);else{var u=J+(o.w_bits-8<<4)<<8,d=-1;d=o.strategy>=K||o.level<2?0:o.level<6?1:6===o.level?2:3,u|=d<<6,0!==o.strstart&&(u|=ue),u+=31-u%31,o.status=ge,h(o,u),0!==o.strstart&&(h(o,e.adler>>>16),h(o,65535&e.adler)),e.adler=1}if(o.status===pe)if(o.gzhead.extra){for(c=o.pending;o.gzindex<(65535&o.gzhead.extra.length)&&(o.pending!==o.pending_buf_size||(o.gzhead.hcrc&&o.pending>c&&(e.adler=O(e.adler,o.pending_buf,o.pending-c,c)),a(e),c=o.pending,o.pending!==o.pending_buf_size));)f(o,255&o.gzhead.extra[o.gzindex]),o.gzindex++;o.gzhead.hcrc&&o.pending>c&&(e.adler=O(e.adler,o.pending_buf,o.pending-c,c)),o.gzindex===o.gzhead.extra.length&&(o.gzindex=0,o.status=be)}else o.status=be;if(o.status===be)if(o.gzhead.name){c=o.pending;do{if(o.pending===o.pending_buf_size&&(o.gzhead.hcrc&&o.pending>c&&(e.adler=O(e.adler,o.pending_buf,o.pending-c,c)),a(e),c=o.pending,o.pending===o.pending_buf_size)){l=1;break}l=o.gzindexc&&(e.adler=O(e.adler,o.pending_buf,o.pending-c,c)),0===l&&(o.gzindex=0,o.status=me)}else o.status=me;if(o.status===me)if(o.gzhead.comment){c=o.pending;do{if(o.pending===o.pending_buf_size&&(o.gzhead.hcrc&&o.pending>c&&(e.adler=O(e.adler,o.pending_buf,o.pending-c,c)),a(e),c=o.pending,o.pending===o.pending_buf_size)){l=1;break}l=o.gzindexc&&(e.adler=O(e.adler,o.pending_buf,o.pending-c,c)),0===l&&(o.status=we)}else o.status=we;if(o.status===we&&(o.gzhead.hcrc?(o.pending+2>o.pending_buf_size&&a(e),o.pending+2<=o.pending_buf_size&&(f(o,255&e.adler),f(o,e.adler>>8&255),e.adler=0,o.status=ge)):o.status=ge),0!==o.pending){if(a(e),0===e.avail_out)return o.last_flush=-1,F}else if(0===e.avail_in&&n(t)<=n(i)&&t!==U)return r(e,G);if(o.status===ve&&0!==e.avail_in)return r(e,G);if(0!==e.avail_in||0!==o.lookahead||t!==D&&o.status!==ve){var p=o.strategy===K?w(o,t):o.strategy===Z?m(o,t):x[o.level].func(o,t);if(p!==ke&&p!==Ee||(o.status=ve),p===_e||p===ke)return 0===e.avail_out&&(o.last_flush=-1),F;if(p===ye&&(t===L?I._tr_align(o):t!==j&&(I._tr_stored_block(o,0,0,!1),t===B&&(s(o.head),0===o.lookahead&&(o.strstart=0,o.block_start=0,o.insert=0))),a(e),0===e.avail_out))return o.last_flush=-1,F}return t!==U?F:o.wrap<=0?z:(2===o.wrap?(f(o,255&e.adler),f(o,e.adler>>8&255),f(o,e.adler>>16&255),f(o,e.adler>>24&255),f(o,255&e.total_in),f(o,e.total_in>>8&255),f(o,e.total_in>>16&255),f(o,e.total_in>>24&255)):(h(o,e.adler>>>16),h(o,65535&e.adler)),a(e),o.wrap>0&&(o.wrap=-o.wrap),0!==o.pending?F:z)}function T(e){var t;return e&&e.state?(t=e.state.status,t!==de&&t!==pe&&t!==be&&t!==me&&t!==we&&t!==ge&&t!==ve?r(e,q):(e.state=null,t===ge?r(e,H):F)):q}function R(e,t){var i,r,n,a,o,f,h,c,l=t.length;if(!e||!e.state)return q;if(i=e.state,a=i.wrap,2===a||1===a&&i.status!==de||i.lookahead)return q;for(1===a&&(e.adler=P(e.adler,t,l,0)),i.wrap=0,l>=i.w_size&&(0===a&&(s(i.head),i.strstart=0,i.block_start=0,i.insert=0),c=new C.Buf8(i.w_size),C.arraySet(c,t,l-i.w_size,i.w_size,0),t=c,l=i.w_size),o=e.avail_in,f=e.next_in,h=e.input,e.avail_in=l,e.next_in=0,e.input=t,u(i);i.lookahead>=he;){r=i.strstart,n=i.lookahead-(he-1);do i.ins_h=(i.ins_h<>>24,b>>>=k,m-=k,k=y>>>16&255,0===k)R[o++]=65535&y;else{if(!(16&k)){if(0===(64&k)){y=w[(65535&y)+(b&(1<>>=k,m-=k),m<15&&(b+=T[s++]<>>24,b>>>=k,m-=k,k=y>>>16&255,!(16&k)){if(0===(64&k)){y=g[(65535&y)+(b&(1<c){e.msg="invalid distance too far back",n.mode=i;break e}if(b>>>=k,m-=k,k=o-f,A>k){if(k=A-k,k>u&&n.sane){e.msg="invalid distance too far back",n.mode=i;break e}if(S=0,M=p,0===d){if(S+=l-k,k2;)R[o++]=M[S++],R[o++]=M[S++],R[o++]=M[S++],E-=3;E&&(R[o++]=M[S++],E>1&&(R[o++]=M[S++]))}else{S=o-A;do R[o++]=R[S++],R[o++]=R[S++],R[o++]=R[S++],E-=3;while(E>2);E&&(R[o++]=R[S++],E>1&&(R[o++]=R[S++]))}break}}break}}while(s>3,s-=E,m-=E<<3,b&=(1<>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function n(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new g.Buf16(320),this.work=new g.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function s(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=B,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new g.Buf32(be),t.distcode=t.distdyn=new g.Buf32(me),t.sane=1,t.back=-1,x):P}function a(e){var t;return e&&e.state?(t=e.state,t.wsize=0,t.whave=0,t.wnext=0,s(e)):P}function o(e,t){var i,r;return e&&e.state?(r=e.state,t<0?(i=0,t=-t):(i=(t>>4)+1,t<48&&(t&=15)),t&&(t<8||t>15)?P:(null!==r.window&&r.wbits!==t&&(r.window=null),r.wrap=i,r.wbits=t,a(e))):P}function f(e,t){var i,r;return e?(r=new n,e.state=r,r.window=null,i=o(e,t),i!==x&&(e.state=null),i):P}function h(e){return f(e,ge)}function c(e){if(ve){var t;for(m=new g.Buf32(512),w=new g.Buf32(32),t=0;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(k(A,e.lens,0,288,m,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;k(S,e.lens,0,32,w,0,e.work,{bits:5}),ve=!1}e.lencode=m,e.lenbits=9,e.distcode=w,e.distbits=5}function l(e,t,i,r){var n,s=e.state;return null===s.window&&(s.wsize=1<=s.wsize?(g.arraySet(s.window,t,i-s.wsize,s.wsize,0),s.wnext=0,s.whave=s.wsize):(n=s.wsize-s.wnext,n>r&&(n=r),g.arraySet(s.window,t,i-r,n,s.wnext),r-=n,r?(g.arraySet(s.window,t,i-r,r,0),s.wnext=r,s.whave=s.wsize):(s.wnext+=n,s.wnext===s.wsize&&(s.wnext=0),s.whave>>8&255,i.check=_(i.check,Te,2,0),u=0,d=0,i.mode=U;break}if(i.flags=0,i.head&&(i.head.done=!1),!(1&i.wrap)||(((255&u)<<8)+(u>>8))%31){e.msg="incorrect header check",i.mode=ue;break}if((15&u)!==L){e.msg="unknown compression method",i.mode=ue;break}if(u>>>=4,d-=4,ke=(15&u)+8,0===i.wbits)i.wbits=ke;else if(ke>i.wbits){e.msg="invalid window size",i.mode=ue;break}i.dmax=1<>8&1),512&i.flags&&(Te[0]=255&u,Te[1]=u>>>8&255,i.check=_(i.check,Te,2,0)),u=0,d=0,i.mode=j;case j:for(;d<32;){if(0===f)break e;f--,u+=n[a++]<>>8&255,Te[2]=u>>>16&255,Te[3]=u>>>24&255,i.check=_(i.check,Te,4,0)),u=0,d=0,i.mode=F;case F:for(;d<16;){if(0===f)break e;f--,u+=n[a++]<>8),512&i.flags&&(Te[0]=255&u,Te[1]=u>>>8&255,i.check=_(i.check,Te,2,0)),u=0,d=0,i.mode=z;case z:if(1024&i.flags){for(;d<16;){if(0===f)break e;f--,u+=n[a++]<>>8&255,i.check=_(i.check,Te,2,0)),u=0,d=0}else i.head&&(i.head.extra=null);i.mode=q;case q:if(1024&i.flags&&(m=i.length,m>f&&(m=f),m&&(i.head&&(ke=i.head.extra_len-i.length,i.head.extra||(i.head.extra=new Array(i.head.extra_len)),g.arraySet(i.head.extra,n,a,m,ke)),512&i.flags&&(i.check=_(i.check,n,m,a)),f-=m,a+=m,i.length-=m),i.length))break e;i.length=0,i.mode=H;case H:if(2048&i.flags){if(0===f)break e;m=0;do ke=n[a+m++],i.head&&ke&&i.length<65536&&(i.head.name+=String.fromCharCode(ke));while(ke&&m>9&1,i.head.done=!0),e.adler=i.check=0,i.mode=Z;break;case W:for(;d<32;){if(0===f)break e;f--,u+=n[a++]<>>=7&d,d-=7&d,i.mode=he;break}for(;d<3;){if(0===f)break e;f--,u+=n[a++]<>>=1,d-=1,3&u){case 0:i.mode=$;break;case 1:if(c(i),i.mode=ie,t===R){u>>>=2,d-=2;break e}break;case 2:i.mode=Q;break;case 3:e.msg="invalid block type",i.mode=ue}u>>>=2,d-=2;break;case $:for(u>>>=7&d,d-=7&d;d<32;){if(0===f)break e;f--,u+=n[a++]<>>16^65535)){e.msg="invalid stored block lengths",i.mode=ue;break}if(i.length=65535&u,u=0,d=0,i.mode=X,t===R)break e;case X:i.mode=J;case J:if(m=i.length){if(m>f&&(m=f),m>h&&(m=h),0===m)break e;g.arraySet(s,n,a,m,o),f-=m,a+=m,h-=m,o+=m,i.length-=m;break}i.mode=Z;break;case Q:for(;d<14;){if(0===f)break e;f--,u+=n[a++]<>>=5,d-=5,i.ndist=(31&u)+1,u>>>=5,d-=5,i.ncode=(15&u)+4,u>>>=4,d-=4,i.nlen>286||i.ndist>30){e.msg="too many length or distance symbols",i.mode=ue;break}i.have=0,i.mode=ee;case ee:for(;i.have>>=3,d-=3}for(;i.have<19;)i.lens[Re[i.have++]]=0;if(i.lencode=i.lendyn,i.lenbits=7,Ae={bits:i.lenbits},Ee=k(E,i.lens,0,19,i.lencode,0,i.work,Ae),i.lenbits=Ae.bits,Ee){e.msg="invalid code lengths set",i.mode=ue;break}i.have=0,i.mode=te;case te:for(;i.have>>24,we=Me>>>16&255,ge=65535&Me,!(me<=d);){if(0===f)break e;f--,u+=n[a++]<>>=me,d-=me,i.lens[i.have++]=ge;else{if(16===ge){for(Se=me+2;d>>=me,d-=me,0===i.have){e.msg="invalid bit length repeat",i.mode=ue;break}ke=i.lens[i.have-1],m=3+(3&u),u>>>=2,d-=2}else if(17===ge){for(Se=me+3;d>>=me,d-=me,ke=0,m=3+(7&u),u>>>=3,d-=3}else{for(Se=me+7;d>>=me,d-=me,ke=0,m=11+(127&u),u>>>=7,d-=7}if(i.have+m>i.nlen+i.ndist){e.msg="invalid bit length repeat",i.mode=ue;break}for(;m--;)i.lens[i.have++]=ke}}if(i.mode===ue)break;if(0===i.lens[256]){e.msg="invalid code -- missing end-of-block",i.mode=ue;break}if(i.lenbits=9,Ae={bits:i.lenbits},Ee=k(A,i.lens,0,i.nlen,i.lencode,0,i.work,Ae),i.lenbits=Ae.bits,Ee){e.msg="invalid literal/lengths set",i.mode=ue;break}if(i.distbits=6,i.distcode=i.distdyn,Ae={bits:i.distbits},Ee=k(S,i.lens,i.nlen,i.ndist,i.distcode,0,i.work,Ae),i.distbits=Ae.bits,Ee){e.msg="invalid distances set",i.mode=ue;break}if(i.mode=ie,t===R)break e;case ie:i.mode=re;case re:if(f>=6&&h>=258){e.next_out=o,e.avail_out=h,e.next_in=a,e.avail_in=f,i.hold=u,i.bits=d,y(e,b),o=e.next_out,s=e.output,h=e.avail_out,a=e.next_in,n=e.input,f=e.avail_in,u=i.hold,d=i.bits,i.mode===Z&&(i.back=-1);break}for(i.back=0;Me=i.lencode[u&(1<>>24,we=Me>>>16&255,ge=65535&Me,!(me<=d);){if(0===f)break e;f--,u+=n[a++]<>ve)],me=Me>>>24,we=Me>>>16&255,ge=65535&Me,!(ve+me<=d);){if(0===f)break e;f--,u+=n[a++]<>>=ve,d-=ve,i.back+=ve}if(u>>>=me,d-=me,i.back+=me,i.length=ge,0===we){i.mode=fe;break}if(32&we){i.back=-1,i.mode=Z;break}if(64&we){e.msg="invalid literal/length code",i.mode=ue;break}i.extra=15&we,i.mode=ne;case ne:if(i.extra){for(Se=i.extra;d>>=i.extra,d-=i.extra,i.back+=i.extra}i.was=i.length,i.mode=se;case se:for(;Me=i.distcode[u&(1<>>24,we=Me>>>16&255,ge=65535&Me,!(me<=d);){if(0===f)break e;f--,u+=n[a++]<>ve)],me=Me>>>24,we=Me>>>16&255,ge=65535&Me,!(ve+me<=d);){if(0===f)break e;f--,u+=n[a++]<>>=ve,d-=ve,i.back+=ve}if(u>>>=me,d-=me,i.back+=me,64&we){e.msg="invalid distance code",i.mode=ue;break}i.offset=ge,i.extra=15&we,i.mode=ae;case ae:if(i.extra){for(Se=i.extra;d>>=i.extra,d-=i.extra,i.back+=i.extra}if(i.offset>i.dmax){e.msg="invalid distance too far back",i.mode=ue;break}i.mode=oe;case oe:if(0===h)break e;if(m=b-h,i.offset>m){if(m=i.offset-m,m>i.whave&&i.sane){e.msg="invalid distance too far back",i.mode=ue;break}m>i.wnext?(m-=i.wnext,w=i.wsize-m):w=i.wnext-m,m>i.length&&(m=i.length),be=i.window}else be=s,w=o-i.offset,m=i.length;m>h&&(m=h),h-=m,i.length-=m;do s[o++]=be[w++];while(--m);0===i.length&&(i.mode=re);break;case fe:if(0===h)break e;s[o++]=i.length,h--,i.mode=re;break;case he:if(i.wrap){for(;d<32;){if(0===f)break e;f--,u|=n[a++]<=1&&0===z[P];P--);if(O>P&&(O=P),0===P)return b[m++]=20971520,b[m++]=20971520,g.bits=1,0;for(I=1;I0&&(e===o||1!==P))return-1;for(q[1]=0,x=1;xs||e===h&&B>a)return 1;for(var V=0;;){V++,S=x-D,w[C]A?(M=H[G+w[C]],T=j[F+w[C]]):(M=96,T=0),v=1<>D)+_]=S<<24|M<<16|T|0;while(0!==_);for(v=1<>=1;if(0!==v?(U&=v-1,U+=v):U=0,C++,0===--z[x]){if(x===P)break;x=t[i+w[C]]}if(x>O&&(U&k)!==y){for(0===D&&(D=O),E+=I,N=x-D,L=1<s||e===h&&B>a)return 1;y=U&k,b[y]=O<<24|N<<16|E-m|0}}return 0!==U&&(b[E+U]=x-D<<24|64<<16|0),g.bits=O,0}},function(e,t,i){"use strict";function r(e){for(var t=e.length;--t>=0;)e[t]=0}function n(e,t,i,r,n){this.static_tree=e,this.extra_bits=t,this.extra_base=i,this.elems=r,this.max_length=n,this.has_stree=e&&e.length}function s(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function a(e){return e<256?fe[e]:fe[256+(e>>>7)]}function o(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function f(e,t,i){e.bi_valid>Y-i?(e.bi_buf|=t<>Y-e.bi_valid,e.bi_valid+=i-Y):(e.bi_buf|=t<>>=1,i<<=1;while(--t>0);return i>>>1}function l(e){16===e.bi_valid?(o(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}function u(e,t){var i,r,n,s,a,o,f=t.dyn_tree,h=t.max_code,c=t.stat_desc.static_tree,l=t.stat_desc.has_stree,u=t.stat_desc.extra_bits,d=t.stat_desc.extra_base,p=t.stat_desc.max_length,b=0;for(s=0;s<=Z;s++)e.bl_count[s]=0;for(f[2*e.heap[e.heap_max]+1]=0,i=e.heap_max+1;ip&&(s=p,b++),f[2*r+1]=s,r>h||(e.bl_count[s]++,a=0,r>=d&&(a=u[r-d]),o=f[2*r],e.opt_len+=o*(s+a),l&&(e.static_len+=o*(c[2*r+1]+a)));if(0!==b){do{for(s=p-1;0===e.bl_count[s];)s--;e.bl_count[s]--,e.bl_count[s+1]+=2,e.bl_count[p]--,b-=2}while(b>0);for(s=p;0!==s;s--)for(r=e.bl_count[s];0!==r;)n=e.heap[--i],n>h||(f[2*n+1]!==s&&(e.opt_len+=(s-f[2*n+1])*f[2*n],f[2*n+1]=s),r--)}}function d(e,t,i){var r,n,s=new Array(Z+1),a=0;for(r=1;r<=Z;r++)s[r]=a=a+i[r-1]<<1;for(n=0;n<=t;n++){var o=e[2*n+1];0!==o&&(e[2*n]=c(s[o]++,o))}}function p(){var e,t,i,r,s,a=new Array(Z+1);for(i=0,r=0;r>=7;r8?o(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0}function w(e,t,i,r){m(e),r&&(o(e,i),o(e,~i)),P.arraySet(e.pending_buf,e.window,t,i,e.pending),e.pending+=i}function g(e,t,i,r){var n=2*t,s=2*i;return e[n]>1;i>=1;i--)v(e,s,i);n=f;do i=e.heap[1],e.heap[1]=e.heap[e.heap_len--],v(e,s,1),r=e.heap[1],e.heap[--e.heap_max]=i,e.heap[--e.heap_max]=r,s[2*n]=s[2*i]+s[2*r],e.depth[n]=(e.depth[i]>=e.depth[r]?e.depth[i]:e.depth[r])+1,s[2*i+1]=s[2*r+1]=n,e.heap[1]=n++,v(e,s,1);while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],u(e,t),d(s,h,e.bl_count)}function k(e,t,i){var r,n,s=-1,a=t[1],o=0,f=7,h=4;for(0===a&&(f=138,h=3),t[2*(i+1)+1]=65535,r=0;r<=i;r++)n=a,a=t[2*(r+1)+1],++o=3&&0===e.bl_tree[2*ne[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t}function S(e,t,i,r){var n;for(f(e,t-257,5),f(e,i-1,5),f(e,r-4,4),n=0;n>>=1)if(1&i&&0!==e.dyn_ltree[2*t])return N;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return D;for(t=32;t0?(e.strm.data_type===L&&(e.strm.data_type=M(e)),y(e,e.l_desc),y(e,e.d_desc),a=A(e),n=e.opt_len+3+7>>>3,s=e.static_len+3+7>>>3,s<=n&&(n=s)):n=s=i+5,i+4<=n&&t!==-1?R(e,t,i,r):e.strategy===O||s===n?(f(e,(U<<1)+(r?1:0),3),_(e,ae,oe)):(f(e,(j<<1)+(r?1:0),3),S(e,e.l_desc.max_code+1,e.d_desc.max_code+1,a+1),_(e,e.dyn_ltree,e.dyn_dtree)),b(e),r&&m(e)}function I(e,t,i){return e.pending_buf[e.d_buf+2*e.last_lit]=t>>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&i,e.last_lit++,0===t?e.dyn_ltree[2*i]++:(e.matches++,t--,e.dyn_ltree[2*(he[i]+H+1)]++,e.dyn_dtree[2*a(t)]++),e.last_lit===e.lit_bufsize-1}var P=i(38),O=4,N=0,D=1,L=2,B=0,U=1,j=2,F=3,z=258,q=29,H=256,G=H+1+q,V=30,W=19,K=2*G+1,Z=15,Y=16,$=7,X=256,J=16,Q=17,ee=18,te=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],ie=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],re=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],ne=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],se=512,ae=new Array(2*(G+2));r(ae);var oe=new Array(2*V);r(oe);var fe=new Array(se);r(fe);var he=new Array(z-F+1);r(he);var ce=new Array(q);r(ce);var le=new Array(V);r(le);var ue,de,pe,be=!1;t._tr_init=T,t._tr_stored_block=R,t._tr_flush_block=C,t._tr_tally=I,t._tr_align=x},function(e,t){"use strict";function i(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}e.exports=i},function(e,t,i){var r=i(32),n=r.define("RSAPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("modulus").int(),this.key("publicExponent").int(),this.key("privateExponent").int(),this.key("prime1").int(),this.key("prime2").int(),this.key("exponent1").int(),this.key("exponent2").int(),this.key("coefficient").int())});t.RSAPrivateKey=n;var s=r.define("RSAPublicKey",function(){this.seq().obj(this.key("modulus").int(),this.key("publicExponent").int())});t.RSAPublicKey=s;var a=r.define("SubjectPublicKeyInfo",function(){this.seq().obj(this.key("algorithm").use(o),this.key("subjectPublicKey").bitstr())});t.PublicKey=a;var o=r.define("AlgorithmIdentifier",function(){this.seq().obj(this.key("algorithm").objid(),this.key("none").null_().optional(),this.key("curve").objid().optional(),this.key("params").seq().obj(this.key("p").int(),this.key("q").int(),this.key("g").int()).optional())}),f=r.define("PrivateKeyInfo",function(){this.seq().obj(this.key("version").int(),this.key("algorithm").use(o),this.key("subjectPrivateKey").octstr())});t.PrivateKey=f;var h=r.define("EncryptedPrivateKeyInfo",function(){this.seq().obj(this.key("algorithm").seq().obj(this.key("id").objid(),this.key("decrypt").seq().obj(this.key("kde").seq().obj(this.key("id").objid(),this.key("kdeparams").seq().obj(this.key("salt").octstr(),this.key("iters").int())),this.key("cipher").seq().obj(this.key("algo").objid(),this.key("iv").octstr()))),this.key("subjectPrivateKey").octstr())});t.EncryptedPrivateKey=h;var c=r.define("DSAPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("p").int(),this.key("q").int(),this.key("g").int(),this.key("pub_key").int(),this.key("priv_key").int())});t.DSAPrivateKey=c,t.DSAparam=r.define("DSAparam",function(){this.int()});var l=r.define("ECPrivateKey",function(){this.seq().obj(this.key("version").int(),this.key("privateKey").octstr(),this.key("parameters").optional().explicit(0).use(u),this.key("publicKey").optional().explicit(1).bitstr())});t.ECPrivateKey=l;var u=r.define("ECParameters",function(){this.choice({namedCurve:this.objid()})});t.signature=r.define("signature",function(){this.seq().obj(this.key("r").int(),this.key("s").int())})},function(e,t,i){(function(t){var r=/Proc-Type: 4,ENCRYPTED\r?\nDEK-Info: AES-((?:128)|(?:192)|(?:256))-CBC,([0-9A-H]+)\r?\n\r?\n([0-9A-z\n\r\+\/\=]+)\r?\n/m,n=/^-----BEGIN (.*) KEY-----\r?\n/m,s=/^-----BEGIN (.*) KEY-----\r?\n([0-9A-z\n\r\+\/\=]+)\r?\n-----END \1 KEY-----$/m,a=i(37),o=i(47);e.exports=function(e,i){var f,h=e.toString(),c=h.match(r);if(c){var l="aes"+c[1],u=new t(c[2],"hex"),d=new t(c[3].replace(/\r?\n/g,""),"base64"),p=a(i,u.slice(0,8),parseInt(c[1],10)).key,b=[],m=o.createDecipheriv(l,p,u);b.push(m.update(d)),b.push(m.final()),f=t.concat(b)}else{var w=h.match(s);f=new t(w[2].replace(/\r?\n/g,""),"base64")}var g=h.match(n)[1]+" KEY";return{tag:g,data:f}}}).call(t,i(0).Buffer)},function(e,t){var i=Math.pow(2,30)-1;e.exports=function(e,t){if("number"!=typeof e)throw new TypeError("Iterations not a number");if(e<0)throw new TypeError("Bad iterations");if("number"!=typeof t)throw new TypeError("Key length not a number");if(t<0||t>i||t!==t)throw new TypeError("Bad key length")}},function(e,t,i){t.publicEncrypt=i(217),t.privateDecrypt=i(216),t.privateEncrypt=function(e,i){return t.publicEncrypt(e,i,!0)},t.publicDecrypt=function(e,i){return t.privateDecrypt(e,i,!0)}},function(e,t,i){(function(t){function r(e,i){var r=(e.modulus,e.modulus.byteLength()),n=(i.length,l("sha1").update(new t("")).digest()),a=n.length;if(0!==i[0])throw new Error("decryption error");var h=i.slice(1,a+1),c=i.slice(a+1),u=f(h,o(c,a)),d=f(c,o(u,r-a-1));if(s(n,d.slice(0,a)))throw new Error("decryption error");for(var p=a;0===d[p];)p++;if(1!==d[p++])throw new Error("decryption error");return d.slice(p)}function n(e,t,i){for(var r=t.slice(0,2),n=2,s=0;0!==t[n++];)if(n>=t.length){s++;break}var a=t.slice(2,n-1);t.slice(n-1,n);if(("0002"!==r.toString("hex")&&!i||"0001"!==r.toString("hex")&&i)&&s++,a.length<8&&s++,s)throw new Error("decryption error");return t.slice(n)}function s(e,i){e=new t(e),i=new t(i);var r=0,n=e.length;e.length!==i.length&&(r++,n=Math.min(e.length,i.length));for(var s=-1;++sl||new h(i).cmp(f.modulus)>=0)throw new Error("decryption error");var d;d=s?u(new h(i),f):c(i,f);var p=new t(l-d.length);if(p.fill(0),d=t.concat([p,d],l),4===o)return r(f,d);if(1===o)return n(f,d,s);if(3===o)return d;throw new Error("unknown padding")}}).call(t,i(0).Buffer)},function(e,t,i){(function(t){function r(e,i){var r=e.modulus.byteLength(),n=i.length,s=f("sha1").update(new t("")).digest(),a=s.length,u=2*a;if(n>r-u-2)throw new Error("message too long");var d=new t(r-n-u-2);d.fill(0);var p=r-a-1,b=o(a),m=c(t.concat([s,d,new t([1]),i],p),h(b,p)),w=c(b,h(m,a));return new l(t.concat([new t([0]),w,m],r))}function n(e,i,r){var n=i.length,a=e.modulus.byteLength();if(n>a-11)throw new Error("message too long");var o;return r?(o=new t(a-n-3),o.fill(255)):o=s(a-n-3),new l(t.concat([new t([0,r?1:2]),o,new t([0]),i],a))}function s(e,i){for(var r,n=new t(e),s=0,a=o(2*e),f=0;s=0)throw new Error("data too long for modulus")}return i?d(o,f):u(o,f)}}).call(t,i(0).Buffer)},function(e,t,i){(function(e,r){var n;!function(s){function a(e){throw new RangeError(P[e])}function o(e,t){for(var i=e.length,r=[];i--;)r[i]=t(e[i]);return r}function f(e,t){var i=e.split("@"),r="";i.length>1&&(r=i[0]+"@",e=i[1]),e=e.replace(I,".");var n=e.split("."),s=o(n,t).join(".");return r+s}function h(e){for(var t,i,r=[],n=0,s=e.length;n=55296&&t<=56319&&n65535&&(e-=65536,t+=D(e>>>10&1023|55296),e=56320|1023&e),t+=D(e)}).join("")}function l(e){return e-48<10?e-22:e-65<26?e-65:e-97<26?e-97:y}function u(e,t){return e+22+75*(e<26)-((0!=t)<<5)}function d(e,t,i){var r=0;for(e=i?N(e/S):e>>1,e+=N(e/t);e>O*E>>1;r+=y)e=N(e/O);return N(r+(O+1)*e/(e+A))}function p(e){var t,i,r,n,s,o,f,h,u,p,b=[],m=e.length,w=0,g=T,v=M;for(i=e.lastIndexOf(R),i<0&&(i=0),r=0;r=128&&a("not-basic"),b.push(e.charCodeAt(r));for(n=i>0?i+1:0;n=m&&a("invalid-input"),h=l(e.charCodeAt(n++)),(h>=y||h>N((_-w)/o))&&a("overflow"),w+=h*o,u=f<=v?k:f>=v+E?E:f-v,!(hN(_/p)&&a("overflow"),o*=p;t=b.length+1,v=d(w-s,t,0==s),N(w/t)>_-g&&a("overflow"),g+=N(w/t),w%=t,b.splice(w++,0,g)}return c(b)}function b(e){var t,i,r,n,s,o,f,c,l,p,b,m,w,g,v,A=[];for(e=h(e),m=e.length,t=T,i=0,s=M,o=0;o=t&&bN((_-i)/w)&&a("overflow"),i+=(f-t)*w,t=f,o=0;o_&&a("overflow"),b==t){for(c=i,l=y;p=l<=s?k:l>=s+E?E:l-s,!(c= 0x80 (not a basic code point)","invalid-input":"Invalid input"},O=y-k,N=Math.floor,D=String.fromCharCode;v={version:"1.4.1",ucs2:{decode:h,encode:c},decode:p,encode:b,toASCII:w,toUnicode:m},n=function(){return v}.call(t,i,t,e),!(void 0!==n&&(e.exports=n))}(this)}).call(t,i(117)(e),i(16))},function(e,t){"use strict";function i(e,t){return Object.prototype.hasOwnProperty.call(e,t)}e.exports=function(e,t,n,s){t=t||"&",n=n||"=";var a={};if("string"!=typeof e||0===e.length)return a;var o=/\+/g;e=e.split(t);var f=1e3;s&&"number"==typeof s.maxKeys&&(f=s.maxKeys);var h=e.length;f>0&&h>f&&(h=f);for(var c=0;c=0?(l=b.substr(0,m),u=b.substr(m+1)):(l=b,u=""),d=decodeURIComponent(l),p=decodeURIComponent(u),i(a,d)?r(a[d])?a[d].push(p):a[d]=[a[d],p]:a[d]=p}return a};var r=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}},function(e,t){"use strict";function i(e,t){if(e.map)return e.map(t);for(var i=[],r=0;r0?this.tail.next=t:this.head=t,this.tail=t,++this.length},r.prototype.unshift=function(e){var t={data:e,next:this.head};0===this.length&&(this.tail=t),this.head=t,++this.length},r.prototype.shift=function(){if(0!==this.length){var e=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,e}},r.prototype.clear=function(){this.head=this.tail=null,this.length=0},r.prototype.join=function(e){if(0===this.length)return"";for(var t=this.head,i=""+t.data;t=t.next;)i+=e+t.data;return i},r.prototype.concat=function(e){if(0===this.length)return n.alloc(0);if(1===this.length)return this.head.data;for(var t=n.allocUnsafe(e>>>0),i=this.head,r=0;i;)i.data.copy(t,r),r+=i.data.length,i=i.next;return t}},function(e,t,i){e.exports=i(112)},function(e,t,i){(function(r){var n=function(){try{return i(9)}catch(e){}}();t=e.exports=i(113),t.Stream=n||t,t.Readable=t,t.Writable=i(55),t.Duplex=i(15),t.Transform=i(54),t.PassThrough=i(112),!r.browser&&"disable"===r.env.READABLE_STREAM&&n&&(e.exports=n)}).call(t,i(5))},function(e,t,i){e.exports=i(55)},function(e,t,i){function r(e){if(e)return n(e)}function n(e){for(var t in r.prototype)e[t]=r.prototype[t];return e}var s=i(115);e.exports=r,r.prototype.clearTimeout=function(){return this._timeout=0,clearTimeout(this._timer),this},r.prototype.parse=function(e){return this._parser=e,this},r.prototype.serialize=function(e){return this._serializer=e,this},r.prototype.timeout=function(e){return this._timeout=e,this},r.prototype.then=function(e,t){if(!this._fullfilledPromise){var i=this;this._fullfilledPromise=new Promise(function(e,t){i.end(function(i,r){i?t(i):e(r)})})}return this._fullfilledPromise.then(e,t)},r.prototype.catch=function(e){return this.then(void 0,e)},r.prototype.use=function(e){return e(this),this},r.prototype.get=function(e){return this._header[e.toLowerCase()]},r.prototype.getHeader=r.prototype.get,r.prototype.set=function(e,t){if(s(e)){for(var i in e)this.set(i,e[i]);return this}return this._header[e.toLowerCase()]=t,this.header[e]=t,this},r.prototype.unset=function(e){return delete this._header[e.toLowerCase()],delete this.header[e],this},r.prototype.field=function(e,t){if(null===e||void 0===e)throw new Error(".field(name, val) name can not be empty");if(s(e)){for(var i in e)this.field(i,e[i]);return this}if(null===t||void 0===t)throw new Error(".field(name, val) val can not be empty");return this._getFormData().append(e,t),this},r.prototype.abort=function(){return this._aborted?this:(this._aborted=!0,this.xhr&&this.xhr.abort(),this.req&&this.req.abort(),this.clearTimeout(),this.emit("abort"),this)},r.prototype.withCredentials=function(){return this._withCredentials=!0,this},r.prototype.redirects=function(e){return this._maxRedirects=e,this},r.prototype.toJSON=function(){return{method:this.method,url:this.url,data:this._data,headers:this._header}},r.prototype.send=function(e){var t=s(e),i=this._header["content-type"];if(t&&!this._data)Array.isArray(e)?this._data=[]:this._isHost(e)||(this._data={});else if(e&&this._data&&this._isHost(this._data))throw Error("Can't merge these send calls");if(t&&s(this._data))for(var r in e)this._data[r]=e[r];else"string"==typeof e?(i||this.type("form"),i=this._header["content-type"],"application/x-www-form-urlencoded"==i?this._data=this._data?this._data+"&"+e:e:this._data=(this._data||"")+e):this._data=e;return!t||this._isHost(e)?this:(i||this.type("json"),this)}},function(e,t){function i(e,t,i){return"function"==typeof i?new e("GET",t).end(i):2==arguments.length?new e("GET",t):new e(t,i)}e.exports=i},function(e,t){"use strict";function i(e){return this instanceof i?(this.id=n++,void(this.ee=e)):new i(e)}var r=Object.prototype.hasOwnProperty,n=0;i.prototype.on=function(e,t,i){return t.__ultron=this.id,this.ee.on(e,t,i),this},i.prototype.once=function(e,t,i){return t.__ultron=this.id,this.ee.once(e,t,i),this},i.prototype.remove=function(){var e,t=arguments;if(1===t.length&&"string"==typeof t[0])t=t[0].split(/[, ]+/);else if(!t.length){t=[];for(e in this.ee._events)r.call(this.ee._events,e)&&t.push(e)}for(var i=0;i + * MIT Licensed + */ +e.exports.Validation={isValidUTF8:function(e){return!0}}},function(e,t,i){"use strict";try{e.exports=i(85)("validation")}catch(t){e.exports=i(230)}},function(e,t,i){(function(t){function i(e,t){function i(){if(!n){if(r("throwDeprecation"))throw new Error(t);r("traceDeprecation")?console.trace(t):console.warn(t),n=!0}return e.apply(this,arguments)}if(r("noDeprecation"))return e;var n=!1;return i}function r(e){try{if(!t.localStorage)return!1}catch(e){return!1}var i=t.localStorage[e];return null!=i&&"true"===String(i).toLowerCase()}e.exports=i}).call(t,i(16))},function(e,t){"function"==typeof Object.create?e.exports=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function(e,t){e.super_=t;var i=function(){};i.prototype=t.prototype,e.prototype=new i,e.prototype.constructor=e}},function(e,t){e.exports=function(e){return e&&"object"==typeof e&&"function"==typeof e.copy&&"function"==typeof e.fill&&"function"==typeof e.readUInt8}},function(module,exports,__webpack_require__){function Context(){}var indexOf=__webpack_require__(199),Object_keys=function(e){if(Object.keys)return Object.keys(e);var t=[];for(var i in e)t.push(i);return t},forEach=function(e,t){if(e.forEach)return e.forEach(t);for(var i=0;i + * MIT Licensed + */ +i(8);r.prototype.get=function(e){if(null==this._buffer||this._offset+e>this._buffer.length){var i=new t(this._growStrategy(e));this._buffer=i,this._offset=0}this._used+=e;var r=this._buffer.slice(this._offset,this._offset+e);return this._offset+=e,r},r.prototype.reset=function(e){var i=this._shrinkStrategy();i + * MIT Licensed + */ +t.BufferUtil={merge:function(e,t){for(var i=0,r=0,n=t.length;r + * MIT Licensed + */ +var s=(i(8),0),a=1,o=2,f=3;e.exports=r,r.prototype.add=function(e){function t(){if(i.state===s){if(2==e.length&&255==e[0]&&0==e[1])return i.reset(),void i.onclose();if(128===e[0])i.messageEnd=0,i.state=o,e=e.slice(1);else{if(0!==e[0])return void i.error("payload must start with 0x00 byte",!0);e=e.slice(1),i.state=a}}if(i.state===o){for(var t=0;t0&&(e=e.slice(t))}if(i.state===f){var r=i.messageEnd-i.spanLength;return e.length>=r?(i.buffers.push(e),i.spanLength+=r,i.messageEnd=r,i.parse()):(i.buffers.push(e),void(i.spanLength+=e.length))}return i.buffers.push(e),(i.messageEnd=n(e,255))!=-1?(i.spanLength+=i.messageEnd,i.parse()):void(i.spanLength+=e.length)}if(!this.dead)for(var i=this;e;)e=t()},r.prototype.cleanup=function(){this.dead=!0,this.state=s,this.buffers=[]},r.prototype.parse=function(){for(var e=new t(this.spanLength),i=0,r=0,n=this.buffers.length;r0&&o.copy(e,i,0,this.messageEnd),this.state!==a&&--this.messageEnd;var f=null;return this.messageEnd + * MIT Licensed + */ +var n=i(3),s=i(8);n.EventEmitter;e.exports=r,s.inherits(r,n.EventEmitter),r.prototype.send=function(e,i,r){if(!this.isClosed){var n="string"==typeof e,s=n?t.byteLength(e):e.length,a=s>127?2:1,o=0==this.continuationFrame,f=!i||!("undefined"!=typeof i.fin&&!i.fin),h=new t((o?i&&i.binary?1+a:1:0)+s+(!f||i&&i.binary?0:1)),c=o?1:0;o&&(i&&i.binary?(h.write("€","binary"),a>1&&h.write(String.fromCharCode(128+s/128),c++,"binary"),h.write(String.fromCharCode(127&s),c++,"binary")):h.write("\0","binary")),n?h.write(e,c,"utf8"):e.copy(h,c,0),f?(i&&i.binary||h.write("ÿ",c+s,"binary"),this.continuationFrame=!1):this.continuationFrame=!0;try{this.socket.write(h,"binary",r)}catch(e){this.error(e.toString())}}},r.prototype.close=function(e,i,r,n){if(!this.isClosed){this.isClosed=!0;try{this.continuationFrame&&this.socket.write(new t([255],"binary")),this.socket.write(new t([255,0]),"binary",n)}catch(e){this.error(e.toString())}}},r.prototype.ping=function(e,t){},r.prototype.pong=function(e,t){},r.prototype.error=function(e){return this.emit("error",e),this}}).call(t,i(0).Buffer)},function(e,t){/*! + * ws: a node.js websocket client + * Copyright(c) 2011 Einar Otto Stangvik + * MIT Licensed + */ +t.Validation={isValidUTF8:function(e){return!0}}},function(e,t,i){"use strict";/*! + * ws: a node.js websocket client + * Copyright(c) 2011 Einar Otto Stangvik + * MIT Licensed + */ +try{e.exports=i(231)}catch(t){e.exports=i(244)}},function(e,t,i){(function(t){function r(e,i){if(this instanceof r==!1)return new r(e,i);if(h.EventEmitter.call(this),e=new u({host:"0.0.0.0",port:null,server:null,verifyClient:null,handleProtocols:null,path:null,noServer:!1,disableHixie:!1,clientTracking:!0,perMessageDeflate:!0,maxPayload:104857600}).merge(e),!e.isDefinedAndNonNull("port")&&!e.isDefinedAndNonNull("server")&&!e.value.noServer)throw new TypeError("`port` or a `server` must be provided");var n=this;if(e.isDefinedAndNonNull("port"))this._server=c.createServer(function(e,t){var i=c.STATUS_CODES[426];t.writeHead(426,{"Content-Length":i.length,"Content-Type":"text/plain"}),t.end(i)}),this._server.allowHalfOpen=!1,this._server.listen(e.value.port,e.value.host,i),this._closeServer=function(){n._server&&n._server.close()};else if(e.value.server&&(this._server=e.value.server,e.value.path)){if(this._server._webSocketPaths&&e.value.server._webSocketPaths[e.value.path])throw new Error("two instances of WebSocketServer cannot listen on the same http server path");"object"!=typeof this._server._webSocketPaths&&(this._server._webSocketPaths={}),this._server._webSocketPaths[e.value.path]=1}this._server&&(this._onceServerListening=function(){n.emit("listening")},this._server.once("listening",this._onceServerListening)),"undefined"!=typeof this._server&&(this._onServerError=function(e){n.emit("error",e)},this._server.on("error",this._onServerError),this._onServerUpgrade=function(e,i,r){var s=new t(r.length);r.copy(s),n.handleUpgrade(e,i,s,function(t){n.emit("connection"+e.url,t),n.emit("connection",t)})},this._server.on("upgrade",this._onServerUpgrade)),this.options=e.value,this.path=e.value.path,this.clients=[]}function n(e,t,i,r){var n=function(){try{t.destroy()}catch(e){}};if(t.on("error",n),!e.headers["sec-websocket-key"])return void o(t,400,"Bad Request");var s=parseInt(e.headers["sec-websocket-version"]);if([8,13].indexOf(s)===-1)return void o(t,400,"Bad Request");var f=e.headers["sec-websocket-protocol"],h=s<13?e.headers["sec-websocket-origin"]:e.headers.origin,u=p.parse(e.headers["sec-websocket-extensions"]),b=this,m=function(f){var h=e.headers["sec-websocket-key"],c=l.createHash("sha1");c.update(h+"258EAFA5-E914-47DA-95CA-C5AB0DC85B11"),h=c.digest("base64");var m=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade","Sec-WebSocket-Accept: "+h];"undefined"!=typeof f&&m.push("Sec-WebSocket-Protocol: "+f);var w={};try{w=a.call(b,u)}catch(e){return void o(t,400,"Bad Request")}if(Object.keys(w).length){var g={};Object.keys(w).forEach(function(e){g[e]=[w[e].params]}),m.push("Sec-WebSocket-Extensions: "+p.format(g))}b.emit("headers",m),t.setTimeout(0),t.setNoDelay(!0);try{t.write(m.concat("","").join("\r\n"))}catch(e){try{t.destroy()}catch(e){}return}var v=new d([e,t,i],{protocolVersion:s,protocol:f,extensions:w,maxPayload:b.options.maxPayload});b.options.clientTracking&&(b.clients.push(v),v.on("close",function(){var e=b.clients.indexOf(v);e!=-1&&b.clients.splice(e,1)})),t.removeListener("error",n),r(v)},w=function(){if("function"==typeof b.options.handleProtocols){var e=(f||"").split(/, */),i=!1;b.options.handleProtocols(e,function(e,r){i=!0,e?m(r):o(t,401,"Unauthorized")});return void(i||o(t,501,"Could not process protocols"))}"undefined"!=typeof f?m(f.split(/, */)[0]):m()};if("function"==typeof this.options.verifyClient){var g={origin:h,secure:"undefined"!=typeof e.connection.authorized||"undefined"!=typeof e.connection.encrypted,req:e};if(2==this.options.verifyClient.length)return void this.options.verifyClient(g,function(e,i,r){"undefined"==typeof i&&(i=401),"undefined"==typeof r&&(r=c.STATUS_CODES[i]),e?w():o(t,i,r)});if(!this.options.verifyClient(g))return void o(t,401,"Unauthorized")}w()}function s(e,i,r,n){var s=function(){try{i.destroy()}catch(e){}};if(i.on("error",s),this.options.disableHixie)return void o(i,401,"Hixie support disabled");if(!e.headers["sec-websocket-key2"])return void o(i,400,"Bad Request");var a=e.headers.origin,f=this,h=function(){var h;h=e.headers["x-forwarded-host"]?e.headers["x-forwarded-host"]:e.headers.host;var c=("https"===e.headers["x-forwarded-proto"]||i.encrypted?"wss":"ws")+"://"+h+e.url,u=e.headers["sec-websocket-protocol"],p=function(){var e=["HTTP/1.1 101 Switching Protocols","Upgrade: WebSocket","Connection: Upgrade","Sec-WebSocket-Location: "+c];return"undefined"!=typeof u&&e.push("Sec-WebSocket-Protocol: "+u),"undefined"!=typeof a&&e.push("Sec-WebSocket-Origin: "+a),new t(e.concat("","").join("\r\n"))},b=function(){i.setTimeout(0),i.setNoDelay(!0);var e=p();try{i.write(e,"binary",function(e){e&&i.removeListener("data",y)})}catch(e){try{i.destroy()}catch(e){}return}},m=function(r,a,h){var c=e.headers["sec-websocket-key1"],p=e.headers["sec-websocket-key2"],b=l.createHash("md5");[c,p].forEach(function(e){var t=parseInt(e.replace(/[^\d]/g,"")),r=e.replace(/[^ ]/g,"").length;return 0===r||t%r!==0?void o(i,400,"Bad Request"):(t/=r,void b.update(String.fromCharCode(t>>24&255,t>>16&255,t>>8&255,255&t)))}),b.update(r.toString("binary")),i.setTimeout(0),i.setNoDelay(!0);try{var m=new t(b.digest("binary"),"binary"),w=new t(h.length+m.length);h.copy(w,0),m.copy(w,h.length),i.write(w,"binary",function(t){if(!t){var r=new d([e,i,a],{protocolVersion:"hixie-76",protocol:u});f.options.clientTracking&&(f.clients.push(r),r.on("close",function(){var e=f.clients.indexOf(r);e!=-1&&f.clients.splice(e,1)})),i.removeListener("error",s),n(r)}})}catch(e){try{i.destroy()}catch(e){}return}},w=8;if(r&&r.length>=w){var g=r.slice(0,w),v=r.length>w?r.slice(w):null;m.call(f,g,v,p())}else{var g=new t(w);r.copy(g,0);var _=r.length,v=null,y=function(e){var r=Math.min(e.length,w-_);0!==r&&(e.copy(g,_,0,r),_+=r,_==w&&(i.removeListener("data",y),r + * MIT Licensed + */ +var f=i(8),h=i(3),c=i(52),l=i(118),u=i(104),d=i(125),p=i(122),b=i(40),m=(i(238),i(59));f.inherits(r,h.EventEmitter),r.prototype.close=function(e){var t=null;try{for(var i=0,r=this.clients.length;i>>8^G[255&(r^e[t])];for(n=s>>3;n--;t+=8)r=r>>>8^G[255&(r^e[t])],r=r>>>8^G[255&(r^e[t+1])],r=r>>>8^G[255&(r^e[t+2])],r=r>>>8^G[255&(r^e[t+3])],r=r>>>8^G[255&(r^e[t+4])],r=r>>>8^G[255&(r^e[t+5])],r=r>>>8^G[255&(r^e[t+6])],r=r>>>8^G[255&(r^e[t+7])];return(4294967295^r)>>>0}function a(){}function o(e){this.buffer=new(L?Uint16Array:Array)(2*e),this.length=0}function f(e){var t,i,r,n,s,a,o,f,h,c,l=e.length,u=0,d=Number.POSITIVE_INFINITY;for(f=0;fu&&(u=e[f]),e[f]>=1;for(c=r<<16|f,h=a;h>16&255,s[a++]=i>>24;var o;switch(D){case 1===n:o=[0,n-1,0];break;case 2===n:o=[1,n-2,0];break;case 3===n:o=[2,n-3,0];break;case 4===n:o=[3,n-4,0];break;case 6>=n:o=[4,n-5,1];break;case 8>=n:o=[5,n-7,1];break;case 12>=n:o=[6,n-9,2];break;case 16>=n:o=[7,n-13,2];break;case 24>=n:o=[8,n-17,3];break;case 32>=n:o=[9,n-25,3];break;case 48>=n:o=[10,n-33,4];break;case 64>=n:o=[11,n-49,4];break;case 96>=n:o=[12,n-65,5];break;case 128>=n:o=[13,n-97,5];break;case 192>=n:o=[14,n-129,6];break;case 256>=n:o=[15,n-193,6];break;case 384>=n:o=[16,n-257,7];break;case 512>=n:o=[17,n-385,7];break;case 768>=n:o=[18,n-513,8];break;case 1024>=n:o=[19,n-769,8];break;case 1536>=n:o=[20,n-1025,9];break;case 2048>=n:o=[21,n-1537,9];break;case 3072>=n:o=[22,n-2049,10];break;case 4096>=n:o=[23,n-3073,10];break;case 6144>=n:o=[24,n-4097,11];break;case 8192>=n:o=[25,n-6145,11];break;case 12288>=n:o=[26,n-8193,12];break;case 16384>=n:o=[27,n-12289,12];break;case 24576>=n:o=[28,n-16385,13];break;case 32768>=n:o=[29,n-24577,13];break;default:r("invalid distance")}i=o,s[a++]=i[0],s[a++]=i[1],s[a++]=i[2];var f,h;for(f=0,h=s.length;f=a;)g[a++]=0;for(a=0;29>=a;)v[a++]=0}for(g[256]=1,n=0,s=t.length;n=s){for(l&&i(l,-1),a=0,o=s-n;as&&t+sh&&(n=r,h=s),258===s)break}return new c(h,t-n)}function d(e,t){var i,r,n,s,a,f=e.length,h=new o(572),c=new(L?Uint8Array:Array)(f);if(!L)for(s=0;s2*h[s-1]+c[s]&&(h[s]=2*h[s-1]+c[s]),u[s]=Array(h[s]),d[s]=Array(h[s]);for(n=0;ne[n]?(u[s][a]=o,d[s][a]=t,f+=2):(u[s][a]=e[n],d[s][a]=n,++n);p[s]=0,1===c[s]&&r(s)}return l}function b(e){var t,i,r,n,s=new(L?Uint16Array:Array)(e.length),a=[],o=[],f=0;for(t=0,i=e.length;t>>=1;return s}function m(e,t){this.input=e,this.b=this.c=0,this.g={},t&&(t.flags&&(this.g=t.flags),"string"==typeof t.filename&&(this.filename=t.filename),"string"==typeof t.comment&&(this.w=t.comment),t.deflateOptions&&(this.l=t.deflateOptions)),this.l||(this.l={})}function w(e,t){switch(this.o=[],this.p=32768,this.e=this.j=this.c=this.s=0,this.input=L?new Uint8Array(e):e,this.u=!1,this.q=ie,this.L=!1,!t&&(t={})||(t.index&&(this.c=t.index),t.bufferSize&&(this.p=t.bufferSize),t.bufferType&&(this.q=t.bufferType),t.resize&&(this.L=t.resize)),this.q){case te:this.b=32768,this.a=new(L?Uint8Array:Array)(32768+this.p+258);break;case ie:this.b=0,this.a=new(L?Uint8Array:Array)(this.p),this.f=this.T,this.z=this.P,this.r=this.R;break;default:r(Error("invalid inflate mode"))}}function g(e,t){for(var i,n=e.j,s=e.e,a=e.input,o=e.c,f=a.length;s=f&&r(Error("input buffer is broken")),n|=a[o++]<>>t,e.e=s-t,e.c=o,i}function v(e,t){for(var i,r,n=e.j,s=e.e,a=e.input,o=e.c,f=a.length,h=t[0],c=t[1];s=f);)n|=a[o++]<>>16,e.j=n>>r,e.e=s-r,e.c=o,65535&i}function _(e){function t(e,t,i){var r,n,s,a=this.I;for(s=0;s>>0;e=r}for(var n,s=1,a=0,o=e.length,f=0;0>>0}function E(e,t){var i,n;switch(this.input=e,this.c=0,!t&&(t={})||(t.index&&(this.c=t.index),t.verify&&(this.W=t.verify)),i=e[this.c++],n=e[this.c++],15&i){case ye:this.method=ye;break;default:r(Error("unsupported compression method"))}0!==((i<<8)+n)%31&&r(Error("invalid fcheck flag:"+((i<<8)+n)%31)),32&n&&r(Error("fdict flag is not supported")),this.K=new w(e,{index:this.c,bufferSize:t.bufferSize,bufferType:t.bufferType,resize:t.resize})}function A(e,t){this.input=e,this.a=new(L?Uint8Array:Array)(32768),this.k=ke.t;var i,r={};!t&&(t={})||"number"!=typeof t.compressionType||(this.k=t.compressionType);for(i in t)r[i]=t[i];r.outputBuffer=this.a,this.J=new h(this.input,r)}function S(t,i,r){e.nextTick(function(){var e,n;try{n=M(t,r)}catch(t){e=t}i(e,n)})}function M(e,t){var i;return i=new A(e).h(),t||(t={}),t.H?i:O(i)}function T(t,i,r){e.nextTick(function(){var e,n;try{n=R(t,r)}catch(t){e=t}i(e,n)})}function R(e,t){var i;return e.subarray=e.slice,i=new E(e).i(),t||(t={}),t.noBuffer?i:O(i)}function x(t,i,r){e.nextTick(function(){var e,n;try{n=C(t,r)}catch(t){e=t}i(e,n)})}function C(e,t){var i;return e.subarray=e.slice,i=new m(e).h(),t||(t={}),t.H?i:O(i)}function I(t,i,r){e.nextTick(function(){var e,n;try{n=P(t,r)}catch(t){e=t}i(e,n)})}function P(e,t){var i;return e.subarray=e.slice,i=new y(e).i(),t||(t={}),t.H?i:O(i)}function O(e){var t,r,n=new i(e.length);for(t=0,r=e.length;t>>8&255]<<16|q[e>>>16&255]<<8|q[e>>>24&255])>>32-t:q[e]>>8-t),8>t+a)o=o<>t-r-1&1,8===++a&&(a=0,n[s++]=q[o],o=0,s===n.length&&(n=this.f()));n[s]=o,this.buffer=n,this.m=a,this.index=s},n.prototype.finish=function(){var e,t=this.buffer,i=this.index;return 0B;++B){for(var j=B,F=j,z=7,j=j>>>1;j;j>>>=1)F<<=1,F|=1&j,--z;U[B]=(F<>>0}var q=U,H=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117],G=L?new Uint32Array(H):H;o.prototype.getParent=function(e){return 2*((e-2)/4|0)},o.prototype.push=function(e,t){var i,r,n,s=this.buffer;for(i=this.length,s[this.length++]=t,s[this.length++]=e;0s[r]);)n=s[i],s[i]=s[r],s[r]=n,n=s[i+1],s[i+1]=s[r+1],s[r+1]=n,i=r;return this.length},o.prototype.pop=function(){var e,t,i,r,n,s=this.buffer;for(t=s[0],e=s[1],this.length-=2,s[0]=s[this.length],s[1]=s[this.length+1],n=0;(r=2*n+2,!(r>=this.length))&&(r+2s[r]&&(r+=2),s[r]>s[n]);)i=s[n],s[n]=s[r],s[r]=i,i=s[n+1],s[n+1]=s[r+1],s[r+1]=i,n=r;return{index:e,value:t,length:this.length}};var V,W=2,K={NONE:0,M:1,t:W,Y:3},Z=[];for(V=0;288>V;V++)switch(D){case 143>=V:Z.push([V+48,8]);break;case 255>=V:Z.push([V-144+400,9]);break;case 279>=V:Z.push([V-256+0,7]);break;case 287>=V:Z.push([V-280+192,8]);break;default:r("invalid literal: "+V)}h.prototype.h=function(){var e,t,i,s,a=this.input;switch(this.k){case 0:for(i=0,s=a.length;i>>8&255,w[g++]=255&u,w[g++]=u>>>8&255,L)w.set(o,g),g+=o.length,w=w.subarray(0,g);else{for(p=0,m=o.length;pY)for(;0Y?Y:138,J>Y-3&&J=J?(ie[X++]=17,ie[X++]=J-3,re[17]++):(ie[X++]=18,ie[X++]=J-11,re[18]++),Y-=J;else if(ie[X++]=te[V],re[te[V]]++,Y--,3>Y)for(;0Y?Y:6,J>Y-3&&JF;F++)G[F]=O[H[F]];for(R=19;4=e:return[265,e-11,1];case 14>=e:return[266,e-13,1];case 16>=e:return[267,e-15,1];case 18>=e:return[268,e-17,1];case 22>=e:return[269,e-19,2];case 26>=e:return[270,e-23,2];case 30>=e:return[271,e-27,2];case 34>=e:return[272,e-31,2];case 42>=e:return[273,e-35,3];case 50>=e:return[274,e-43,3];case 58>=e:return[275,e-51,3];case 66>=e:return[276,e-59,3];case 82>=e:return[277,e-67,4];case 98>=e:return[278,e-83,4];case 114>=e:return[279,e-99,4];case 130>=e:return[280,e-115,4];case 162>=e:return[281,e-131,5];case 194>=e:return[282,e-163,5];case 226>=e:return[283,e-195,5];case 257>=e:return[284,e-227,5];case 258===e:return[285,e-258,0];default:r("invalid length: "+e)}}var t,i,n=[];for(t=3;258>=t;t++)i=e(t),n[t]=i[2]<<24|i[1]<<16|i[0];return n}(),$=L?new Uint32Array(Y):Y;m.prototype.h=function(){var e,t,i,r,n,a,o,f,c=new(L?Uint8Array:Array)(32768),l=0,u=this.input,d=this.c,p=this.filename,b=this.w;if(c[l++]=31,c[l++]=139,c[l++]=8,e=0,this.g.fname&&(e|=Q),this.g.fcomment&&(e|=ee),this.g.fhcrc&&(e|=J),c[l++]=e,t=(Date.now?Date.now():+new Date)/1e3|0,c[l++]=255&t,c[l++]=t>>>8&255,c[l++]=t>>>16&255,c[l++]=t>>>24&255,c[l++]=0,c[l++]=X,this.g.fname!==N){for(o=0,f=p.length;o>>8&255),c[l++]=255&a;c[l++]=0}if(this.g.comment){for(o=0,f=b.length;o>>8&255),c[l++]=255&a;c[l++]=0}return this.g.fhcrc&&(i=65535&s(c,0,l),c[l++]=255&i,c[l++]=i>>>8&255),this.l.outputBuffer=c,this.l.outputIndex=l,n=new h(u,this.l),c=n.h(),l=n.b,L&&(l+8>c.buffer.byteLength?(this.a=new Uint8Array(l+8),this.a.set(new Uint8Array(c.buffer)),c=this.a):c=new Uint8Array(c.buffer)),r=s(u,N,N),c[l++]=255&r,c[l++]=r>>>8&255,c[l++]=r>>>16&255,c[l++]=r>>>24&255,f=u.length,c[l++]=255&f,c[l++]=f>>>8&255,c[l++]=f>>>16&255,c[l++]=f>>>24&255,this.c=d,L&&l>>=1){case 0:var t=this.input,i=this.c,n=this.a,s=this.b,a=t.length,o=N,f=N,h=n.length,c=N;switch(this.e=this.j=0,i+1>=a&&r(Error("invalid uncompressed block header: LEN")),o=t[i++]|t[i++]<<8,i+1>=a&&r(Error("invalid uncompressed block header: NLEN")),f=t[i++]|t[i++]<<8,o===~f&&r(Error("invalid uncompressed block header: length verify")),i+o>t.length&&r(Error("input buffer is broken")),this.q){case te:for(;s+o>n.length;){if(c=h-s,o-=c,L)n.set(t.subarray(i,i+c),s),s+=c,i+=c;else for(;c--;)n[s++]=t[i++];this.b=s,n=this.f(),s=this.b}break;case ie:for(;s+o>n.length;)n=this.f({B:2});break;default:r(Error("invalid inflate mode"))}if(L)n.set(t.subarray(i,i+o),s),s+=o,i+=o;else for(;o--;)n[s++]=t[i++];this.c=i,this.b=s,this.a=n;break;case 1:this.r(ge,_e);break;case 2:_(this);break;default:r(Error("unknown BTYPE: "+e))}}return this.z()};var re,ne,se=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],ae=L?new Uint16Array(se):se,oe=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,258,258],fe=L?new Uint16Array(oe):oe,he=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0],ce=L?new Uint8Array(he):he,le=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577],ue=L?new Uint16Array(le):le,de=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],pe=L?new Uint8Array(de):de,be=new(L?Uint8Array:Array)(288);for(re=0,ne=be.length;re=re?8:255>=re?9:279>=re?7:8;var me,we,ge=f(be),ve=new(L?Uint8Array:Array)(30);for(me=0,we=ve.length;men)r>=f&&(this.b=r,i=this.f(),r=this.b),i[r++]=n;else for(s=n-257,o=fe[s],0=f&&(this.b=r,i=this.f(),r=this.b);o--;)i[r]=i[r++-a];for(;8<=this.e;)this.e-=8,this.c--;this.b=r},w.prototype.R=function(e,t){var i=this.a,r=this.b;this.A=e;for(var n,s,a,o,f=i.length;256!==(n=v(this,e));)if(256>n)r>=f&&(i=this.f(),f=i.length),i[r++]=n;else for(s=n-257,o=fe[s],0f&&(i=this.f(),f=i.length);o--;)i[r]=i[r++-a];for(;8<=this.e;)this.e-=8,this.c--;this.b=r},w.prototype.f=function(){var e,t,i=new(L?Uint8Array:Array)(this.b-32768),r=this.b-32768,n=this.a;if(L)i.set(n.subarray(32768,i.length));else for(e=0,t=i.length;ee;++e)n[e]=n[r+e];return this.b=32768,n},w.prototype.T=function(e){var t,i,r,n,s=this.input.length/this.c+1|0,a=this.input,o=this.a;return e&&("number"==typeof e.B&&(s=e.B),"number"==typeof e.N&&(s+=e.N)),2>s?(i=(a.length-this.c)/this.A[2],n=258*(i/2)|0,r=nt&&(this.a.length=t),e=this.a),this.buffer=e},y.prototype.i=function(){for(var e=this.input.length;this.c>>0,s(o,N,N)!==d&&r(Error("invalid CRC-32 checksum: 0x"+s(o,N,N).toString(16)+" / 0x"+d.toString(16))),t.$=i=(p[b++]|p[b++]<<8|p[b++]<<16|p[b++]<<24)>>>0,(4294967295&o.length)!==i&&r(Error("invalid input size: "+(4294967295&o.length)+" / "+i)),this.G.push(t),this.c=b}this.S=D;var m,g,v,_=this.G,y=0,k=0;for(m=0,g=_.length;m>>0,t!==k(e)&&r(Error("invalid adler-32 checksum"))),e};var ye=8,ke=K;A.prototype.h=function(){var e,t,i,n,s,a,o,f=0;switch(o=this.a,e=ye){case ye:t=Math.LOG2E*Math.log(32768)-8;break;default:r(Error("invalid compression method"))}switch(i=t<<4|e,o[f++]=i,e){case ye:switch(this.k){case ke.NONE:s=0;break;case ke.M:s=1;break;case ke.t:s=2;break;default:r(Error("unsupported compression type"))}break;default:r(Error("invalid compression method"))}return n=s<<6|0,o[f++]=n|31-(256*i+n)%31,a=k(this.input),this.J.b=f,o=this.J.h(),f=o.length,L&&(o=new Uint8Array(o.buffer),o.length<=f+4&&(this.a=new Uint8Array(o.length+4),this.a.set(o),o=this.a),o=o.subarray(0,f+4)),o[f++]=a>>24&255,o[f++]=a>>16&255,o[f++]=a>>8&255,o[f++]=255&a,o},t.deflate=S,t.deflateSync=M,t.inflate=T,t.inflateSync=R,t.gzip=x,t.gzipSync=C,t.gunzip=I,t.gunzipSync=P}).call(this)}).call(t,i(5),i(0).Buffer)},function(e,t,i){const r=i(2),n=i(130),s=i(43),a=i(11),o=i(65),f=i(21),h=i(76),c=i(77),l=i(29),u=i(66);class d{constructor(e){this.client=e}get pastReady(){return this.client.ws.status===r.Status.READY}newGuild(e){const t=this.client.guilds.has(e.id),i=new s(this.client,e);return this.client.guilds.set(i.id,i),this.pastReady&&!t&&(this.client.options.fetchAllMembers?i.fetchMembers().then(()=>{this.client.emit(r.Events.GUILD_CREATE,i)}):this.client.emit(r.Events.GUILD_CREATE,i)),i}newUser(e){if(this.client.users.has(e.id))return this.client.users.get(e.id);const t=new a(this.client,e);return this.client.users.set(t.id,t),t}newChannel(e,t){const i=this.client.channels.has(e.id);let n;return e.type===r.ChannelTypes.DM?n=new o(this.client,e):e.type===r.ChannelTypes.groupDM?n=new u(this.client,e):(t=t||this.client.guilds.get(e.guild_id),t&&(e.type===r.ChannelTypes.text?(n=new h(t,e),t.channels.set(n.id,n)):e.type===r.ChannelTypes.voice&&(n=new c(t,e),t.channels.set(n.id,n)))),n?(this.pastReady&&!i&&this.client.emit(r.Events.CHANNEL_CREATE,n),this.client.channels.set(n.id,n),n):null}newEmoji(e,t){const i=t.emojis.has(e.id);if(e&&!i){let i=new f(t,e);return this.client.emit(r.Events.EMOJI_CREATE,i),t.emojis.set(i.id,i),i}return i?t.emojis.get(e.id):null}killEmoji(e){e instanceof f&&e.guild&&(this.client.emit(r.Events.EMOJI_DELETE,e),e.guild.emojis.delete(e.id))}killGuild(e){const t=this.client.guilds.has(e.id);this.client.guilds.delete(e.id),t&&this.pastReady&&this.client.emit(r.Events.GUILD_DELETE,e)}killUser(e){this.client.users.delete(e.id)}killChannel(e){this.client.channels.delete(e.id),e instanceof l&&e.guild.channels.delete(e.id)}updateGuild(e,t){const i=n(e);e.setup(t),this.pastReady&&this.client.emit(r.Events.GUILD_UPDATE,i,e)}updateChannel(e,t){e.setup(t)}updateEmoji(e,t){const i=n(e);e.setup(t),this.client.emit(r.Events.GUILD_EMOJI_UPDATE,i,e)}}e.exports=d},function(e,t,i){const r=i(2);class n{constructor(e){this.client=e,this.heartbeatInterval=null}connectToWebSocket(e,t,i){this.client.emit(r.Events.DEBUG,`Authenticated using token ${e}`),this.client.token=e;const n=this.client.setTimeout(()=>i(new Error(r.Errors.TOOK_TOO_LONG)),3e5);this.client.rest.methods.getGateway().then(s=>{this.client.emit(r.Events.DEBUG,`Using gateway ${s}`),this.client.ws.connect(s),this.client.ws.once("close",e=>{4004===e.code&&i(new Error(r.Errors.BAD_LOGIN)),4010===e.code&&i(new Error(r.Errors.INVALID_SHARD))}),this.client.once(r.Events.READY,()=>{t(e),this.client.clearTimeout(n)})},i)}setupKeepAlive(e){this.heartbeatInterval=this.client.setInterval(()=>{this.client.emit("debug","Sending heartbeat"),this.client.ws.send({op:r.OPCodes.HEARTBEAT,d:this.client.ws.sequence},!0)},e)}destroy(){return new Promise(e=>{this.client.ws.destroy(),this.client.user.bot?e():e(this.client.rest.methods.logout())})}}e.exports=n},function(e,t){function i(e){throw new Error("Cannot find module '"+e+"'.")}i.keys=function(){return[]},i.resolve=i,e.exports=i,i.id=250},function(e,t,i){class r{constructor(e){this.client=e,this.register("MessageCreate"),this.register("MessageDelete"),this.register("MessageDeleteBulk"),this.register("MessageUpdate"),this.register("MessageReactionAdd"),this.register("MessageReactionRemove"),this.register("MessageReactionRemoveAll"),this.register("ChannelCreate"),this.register("ChannelDelete"),this.register("ChannelUpdate"),this.register("GuildDelete"),this.register("GuildUpdate"),this.register("GuildMemberGet"),this.register("GuildMemberRemove"),this.register("GuildBanRemove"),this.register("GuildRoleCreate"),this.register("GuildRoleDelete"),this.register("GuildRoleUpdate"),this.register("UserGet"),this.register("UserUpdate"),this.register("UserNoteUpdate"),this.register("GuildSync"),this.register("GuildEmojiCreate"),this.register("GuildEmojiDelete"),this.register("GuildEmojiUpdate"),this.register("GuildRolesPositionUpdate")}register(e){const t=!function(){var e=new Error('Cannot find module "."');throw e.code="MODULE_NOT_FOUND",e}();this[e]=new t(this.client)}}e.exports=r},function(e,t,i){function r(e){let t=e.split("?")[0];if(t.includes("/channels/")||t.includes("/guilds/")){const e=~t.indexOf("/channels/")?t.indexOf("/channels/"):t.indexOf("/guilds/"),i=t.substring(e).split("/")[2];t=t.replace(/(\d{8,})/g,":id").replace(":id",i)}return t}const n=i(57),s=i(2);class a{constructor(e,t,i,n,s,a){this.rest=e,this.method=t,this.url=i,this.auth=n,this.data=s,this.file=a,this.route=r(this.url)}getAuth(){if(this.rest.client.token&&this.rest.client.user&&this.rest.client.user.bot)return`Bot ${this.rest.client.token}`;if(this.rest.client.token)return this.rest.client.token;throw new Error(s.Errors.NO_TOKEN)}gen(){const e=n[this.method](this.url);if(this.auth&&e.set("authorization",this.getAuth()),this.file&&this.file.file){e.attach("file",this.file.file,this.file.name),this.data=this.data||{};for(const t in this.data)this.data[t]&&e.field(t,this.data[t])}else this.data&&e.send(this.data);return e.set("User-Agent",this.rest.userAgentManager.userAgent),e}}e.exports=a},function(e,t,i){const r=i(2),n=i(6),s=i(79),a=i(277),o=i(11),f=i(30),h=i(22),c=i(67),l=i(46),u=i(276),d=i(64);class p{constructor(e){this.rest=e}loginToken(e=this.rest.client.token){return new Promise((t,i)=>{e=e.replace(/^Bot\s*/i,""),this.rest.client.manager.connectToWebSocket(e,t,i)})}loginEmailPassword(e,t){return this.rest.client.emit("warn","Client launched using email and password - should use token instead"),this.rest.client.email=e,this.rest.client.password=t,this.rest.makeRequest("post",r.Endpoints.login,!1,{email:e,password:t}).then(e=>this.loginToken(e.token))}logout(){return this.rest.makeRequest("post",r.Endpoints.logout,!0,{})}getGateway(){return this.rest.makeRequest("get",r.Endpoints.gateway,!0).then(e=>{return this.rest.client.ws.gateway=`${e.url}/?encoding=json&v=${r.PROTOCOL_VERSION}`,this.rest.client.ws.gateway})}getBotGateway(){return this.rest.makeRequest("get",r.Endpoints.botGateway,!0)}sendMessage(e,t,{tts,nonce,embed,disableEveryone,split}={},i=null){return new Promise((r,n)=>{"undefined"!=typeof t&&(t=this.rest.client.resolver.resolveString(t)),t&&((disableEveryone||"undefined"==typeof disableEveryone&&this.rest.client.options.disableEveryone)&&(t=t.replace(/@(everyone|here)/g,"@​$1")),split&&(t=s(t,"object"==typeof split?split:{}))),e instanceof o||e instanceof f?this.createDM(e).then(e=>{this._sendMessageRequest(e,t,i,tts,nonce,embed,r,n)},n):this._sendMessageRequest(e,t,i,tts,nonce,embed,r,n)})}_sendMessageRequest(e,t,i,n,s,a,o,f){if(t instanceof Array){const h=[];let c=this.rest.makeRequest("post",r.Endpoints.channelMessages(e.id),!0,{content:t[0],tts:n,nonce:s},i).catch(f);for(let l=1;l<=t.length;l++)if(l{return h.push(f),this.rest.makeRequest("post",r.Endpoints.channelMessages(e.id),!0,{content:t[o],tts:n,nonce:s,embed:a},i)},f)}else c.then(e=>{h.push(e),o(this.rest.client.actions.MessageCreate.handle(h).messages)},f)}else this.rest.makeRequest("post",r.Endpoints.channelMessages(e.id),!0,{content:t,tts:n, +nonce:s,embed:a},i).then(e=>o(this.rest.client.actions.MessageCreate.handle(e).message),f)}deleteMessage(e){return this.rest.makeRequest("del",r.Endpoints.channelMessage(e.channel.id,e.id),!0).then(()=>this.rest.client.actions.MessageDelete.handle({id:e.id,channel_id:e.channel.id}).message)}bulkDeleteMessages(e,t){return this.rest.makeRequest("post",`${r.Endpoints.channelMessages(e.id)}/bulk_delete`,!0,{messages:t}).then(()=>this.rest.client.actions.MessageDeleteBulk.handle({channel_id:e.id,ids:t}).messages)}updateMessage(e,t,{embed}={}){return t=this.rest.client.resolver.resolveString(t),this.rest.makeRequest("patch",r.Endpoints.channelMessage(e.channel.id,e.id),!0,{content:t,embed:embed}).then(e=>this.rest.client.actions.MessageUpdate.handle(e).updated)}createChannel(e,t,i){return this.rest.makeRequest("post",r.Endpoints.guildChannels(e.id),!0,{name:t,type:i}).then(e=>this.rest.client.actions.ChannelCreate.handle(e).channel)}createDM(e){const t=this.getExistingDM(e);return t?Promise.resolve(t):this.rest.makeRequest("post",r.Endpoints.userChannels(this.rest.client.user.id),!0,{recipient_id:e.id}).then(e=>this.rest.client.actions.ChannelCreate.handle(e).channel)}getExistingDM(e){return this.rest.client.channels.find(t=>t.recipient&&t.recipient.id===e.id)}deleteChannel(e){return(e instanceof o||e instanceof f)&&(e=this.getExistingDM(e)),e?this.rest.makeRequest("del",r.Endpoints.channel(e.id),!0).then(t=>{return t.id=e.id,this.rest.client.actions.ChannelDelete.handle(t).channel}):Promise.reject(new Error("No channel to delete."))}updateChannel(e,t){const i={};return i.name=(t.name||e.name).trim(),i.topic=t.topic||e.topic,i.position=t.position||e.position,i.bitrate=t.bitrate||e.bitrate,i.user_limit=t.userLimit||e.userLimit,this.rest.makeRequest("patch",r.Endpoints.channel(e.id),!0,i).then(e=>this.rest.client.actions.ChannelUpdate.handle(e).updated)}leaveGuild(e){return e.ownerID===this.rest.client.user.id?Promise.reject(new Error("Guild is owned by the client.")):this.rest.makeRequest("del",r.Endpoints.meGuild(e.id),!0).then(()=>this.rest.client.actions.GuildDelete.handle({id:e.id}).guild)}createGuild(e){return e.icon=this.rest.client.resolver.resolveBase64(e.icon)||null,e.region=e.region||"us-central",new Promise((t,i)=>{this.rest.makeRequest("post",r.Endpoints.guilds,!0,e).then(e=>{if(this.rest.client.guilds.has(e.id))return void t(this.rest.client.guilds.get(e.id));const r=i=>{i.id===e.id&&(this.rest.client.removeListener("guildCreate",r),this.rest.client.clearTimeout(n),t(i))};this.rest.client.on("guildCreate",r);const n=this.rest.client.setTimeout(()=>{this.rest.client.removeListener("guildCreate",r),i(new Error("Took too long to receive guild data."))},1e4)},i)})}deleteGuild(e){return this.rest.makeRequest("del",r.Endpoints.guild(e.id),!0).then(()=>this.rest.client.actions.GuildDelete.handle({id:e.id}).guild)}getUser(e){return this.rest.makeRequest("get",r.Endpoints.user(e),!0).then(e=>this.rest.client.actions.UserGet.handle(e).user)}updateCurrentUser(e){const t=this.rest.client.user,i={};return i.username=e.username||t.username,i.avatar=this.rest.client.resolver.resolveBase64(e.avatar)||t.avatar,t.bot||(i.email=e.email||t.email,i.password=this.rest.client.password,e.new_password&&(i.new_password=e.newPassword)),this.rest.makeRequest("patch",r.Endpoints.me,!0,i).then(e=>this.rest.client.actions.UserUpdate.handle(e).updated)}updateGuild(e,t){const i={};return t.name&&(i.name=t.name),t.region&&(i.region=t.region),t.verificationLevel&&(i.verification_level=Number(t.verificationLevel)),t.afkChannel&&(i.afk_channel_id=this.rest.client.resolver.resolveChannel(t.afkChannel).id),t.afkTimeout&&(i.afk_timeout=Number(t.afkTimeout)),t.icon&&(i.icon=this.rest.client.resolver.resolveBase64(t.icon)),t.owner&&(i.owner_id=this.rest.client.resolver.resolveUser(t.owner).id),t.splash&&(i.splash=this.rest.client.resolver.resolveBase64(t.splash)),this.rest.makeRequest("patch",r.Endpoints.guild(e.id),!0,i).then(e=>this.rest.client.actions.GuildUpdate.handle(e).updated)}kickGuildMember(e,t){return this.rest.makeRequest("del",r.Endpoints.guildMember(e.id,t.id),!0).then(()=>this.rest.client.actions.GuildMemberRemove.handle({guild_id:e.id,user:t.user}).member)}createGuildRole(e){return this.rest.makeRequest("post",r.Endpoints.guildRoles(e.id),!0).then(t=>this.rest.client.actions.GuildRoleCreate.handle({guild_id:e.id,role:t}).role)}deleteGuildRole(e){return this.rest.makeRequest("del",r.Endpoints.guildRole(e.guild.id,e.id),!0).then(()=>this.rest.client.actions.GuildRoleDelete.handle({guild_id:e.guild.id,role_id:e.id}).role)}setChannelOverwrite(e,t){return this.rest.makeRequest("put",`${r.Endpoints.channelPermissions(e.id)}/${t.id}`,!0,t)}deletePermissionOverwrites(e){return this.rest.makeRequest("del",`${r.Endpoints.channelPermissions(e.channel.id)}/${e.id}`,!0).then(()=>e)}getChannelMessages(e,t={}){const i=[];t.limit&&i.push(`limit=${t.limit}`),t.around?i.push(`around=${t.around}`):t.before?i.push(`before=${t.before}`):t.after&&i.push(`after=${t.after}`);let n=r.Endpoints.channelMessages(e.id);return i.length>0&&(n+=`?${i.join("&")}`),this.rest.makeRequest("get",n,!0)}getChannelMessage(e,t){const i=e.messages.get(t);return i?Promise.resolve(i):this.rest.makeRequest("get",r.Endpoints.channelMessage(e.id,t),!0)}getGuildMember(e,t){return this.rest.makeRequest("get",r.Endpoints.guildMember(e.id,t.id),!0).then(t=>this.rest.client.actions.GuildMemberGet.handle(e,t).member)}updateGuildMember(e,t){t.channel&&(t.channel_id=this.rest.client.resolver.resolveChannel(t.channel).id),t.roles&&(t.roles=t.roles.map(e=>e instanceof h?e.id:e));let i=r.Endpoints.guildMember(e.guild.id,e.id);if(e.id===this.rest.client.user.id){const n=Object.keys(t);1===n.length&&"nick"===n[0]&&(i=r.Endpoints.stupidInconsistentGuildEndpoint(e.guild.id))}return this.rest.makeRequest("patch",i,!0,t).then(t=>e.guild._updateMember(e,t).mem)}sendTyping(e){return this.rest.makeRequest("post",`${r.Endpoints.channel(e)}/typing`,!0)}banGuildMember(e,t,i=0){const n=this.rest.client.resolver.resolveUserID(t);return n?this.rest.makeRequest("put",`${r.Endpoints.guildBans(e.id)}/${n}?delete-message-days=${i}`,!0,{"delete-message-days":i}).then(()=>{if(t instanceof f)return t;const i=this.rest.client.resolver.resolveUser(n);return i?(t=this.rest.client.resolver.resolveGuildMember(e,i),t||i):n}):Promise.reject(new Error("Couldn't resolve the user ID to ban."))}unbanGuildMember(e,t){return new Promise((i,n)=>{const s=this.rest.client.resolver.resolveUserID(t);if(!s)throw new Error("Couldn't resolve the user ID to unban.");const a=(t,n)=>{t.id===e.id&&n.id===s&&(this.rest.client.removeListener(r.Events.GUILD_BAN_REMOVE,a),this.rest.client.clearTimeout(o),i(n))};this.rest.client.on(r.Events.GUILD_BAN_REMOVE,a);const o=this.rest.client.setTimeout(()=>{this.rest.client.removeListener(r.Events.GUILD_BAN_REMOVE,a),n(new Error("Took too long to receive the ban remove event."))},1e4);this.rest.makeRequest("del",`${r.Endpoints.guildBans(e.id)}/${s}`,!0).catch(e=>{this.rest.client.removeListener(r.Events.GUILD_BAN_REMOVE,a),this.rest.client.clearTimeout(o),n(e)})})}getGuildBans(e){return this.rest.makeRequest("get",r.Endpoints.guildBans(e.id),!0).then(e=>{const t=new n;for(const i of e){const e=this.rest.client.dataManager.newUser(i.user);t.set(e.id,e)}return t})}updateGuildRole(e,t){const i={};if(i.name=t.name||e.name,i.position="undefined"!=typeof t.position?t.position:e.position,i.color=t.color||e.color,"string"==typeof i.color&&i.color.startsWith("#")&&(i.color=parseInt(i.color.replace("#",""),16)),i.hoist="undefined"!=typeof t.hoist?t.hoist:e.hoist,i.mentionable="undefined"!=typeof t.mentionable?t.mentionable:e.mentionable,t.permissions){let e=0;for(let n of t.permissions)"string"==typeof n&&(n=r.PermissionFlags[n]),e|=n;i.permissions=e}else i.permissions=e.permissions;return this.rest.makeRequest("patch",r.Endpoints.guildRole(e.guild.id,e.id),!0,i).then(t=>this.rest.client.actions.GuildRoleUpdate.handle({role:t,guild_id:e.guild.id}).updated)}pinMessage(e){return this.rest.makeRequest("put",`${r.Endpoints.channel(e.channel.id)}/pins/${e.id}`,!0).then(()=>e)}unpinMessage(e){return this.rest.makeRequest("del",`${r.Endpoints.channel(e.channel.id)}/pins/${e.id}`,!0).then(()=>e)}getChannelPinnedMessages(e){return this.rest.makeRequest("get",`${r.Endpoints.channel(e.id)}/pins`,!0)}createChannelInvite(e,t){const i={};return i.temporary=t.temporary,i.max_age=t.maxAge,i.max_uses=t.maxUses,this.rest.makeRequest("post",`${r.Endpoints.channelInvites(e.id)}`,!0,i).then(e=>new c(this.rest.client,e))}deleteInvite(e){return this.rest.makeRequest("del",r.Endpoints.invite(e.code),!0).then(()=>e)}getInvite(e){return this.rest.makeRequest("get",r.Endpoints.invite(e),!0).then(e=>new c(this.rest.client,e))}getGuildInvites(e){return this.rest.makeRequest("get",r.Endpoints.guildInvites(e.id),!0).then(e=>{const t=new n;for(const i of e){const e=new c(this.rest.client,i);t.set(e.code,e)}return t})}pruneGuildMembers(e,t,i){return this.rest.makeRequest(i?"get":"post",`${r.Endpoints.guildPrune(e.id)}?days=${t}`,!0).then(e=>e.pruned)}createEmoji(e,t,i){return this.rest.makeRequest("post",`${r.Endpoints.guildEmojis(e.id)}`,!0,{name:i,image:t}).then(t=>this.rest.client.actions.EmojiCreate.handle(t,e).emoji)}deleteEmoji(e){return this.rest.makeRequest("delete",`${r.Endpoints.guildEmojis(e.guild.id)}/${e.id}`,!0).then(()=>this.rest.client.actions.EmojiDelete.handle(e).data)}getWebhook(e,t){return this.rest.makeRequest("get",r.Endpoints.webhook(e,t),!t).then(e=>new l(this.rest.client,e))}getGuildWebhooks(e){return this.rest.makeRequest("get",r.Endpoints.guildWebhooks(e.id),!0).then(e=>{const t=new n;for(const i of e)t.set(i.id,new l(this.rest.client,i));return t})}getChannelWebhooks(e){return this.rest.makeRequest("get",r.Endpoints.channelWebhooks(e.id),!0).then(e=>{const t=new n;for(const i of e)t.set(i.id,new l(this.rest.client,i));return t})}createWebhook(e,t,i){return this.rest.makeRequest("post",r.Endpoints.channelWebhooks(e.id),!0,{name:t,avatar:i}).then(e=>new l(this.rest.client,e))}editWebhook(e,t,i){return this.rest.makeRequest("patch",r.Endpoints.webhook(e.id,e.token),!1,{name:t,avatar:i}).then(t=>{return e.name=t.name,e.avatar=t.avatar,e})}deleteWebhook(e){return this.rest.makeRequest("delete",r.Endpoints.webhook(e.id,e.token),!1)}sendWebhookMessage(e,t,{avatarURL,tts,disableEveryone,embeds}={},i=null){return"undefined"!=typeof t&&(t=this.rest.client.resolver.resolveString(t)),t&&(disableEveryone||"undefined"==typeof disableEveryone&&this.rest.client.options.disableEveryone)&&(t=t.replace(/@(everyone|here)/g,"@​$1")),this.rest.makeRequest("post",`${r.Endpoints.webhook(e.id,e.token)}?wait=true`,!1,{username:e.name,avatar_url:avatarURL,content:t,tts:tts,file:i,embeds:embeds})}sendSlackWebhookMessage(e,t){return this.rest.makeRequest("post",`${r.Endpoints.webhook(e.id,e.token)}/slack?wait=true`,!1,t)}fetchUserProfile(e){return this.rest.makeRequest("get",r.Endpoints.userProfile(e.id),!0).then(t=>new u(e,t))}addFriend(e){return this.rest.makeRequest("post",r.Endpoints.relationships("@me"),!0,{username:e.username,discriminator:e.discriminator}).then(()=>e)}removeFriend(e){return this.rest.makeRequest("delete",`${r.Endpoints.relationships("@me")}/${e.id}`,!0).then(()=>e)}blockUser(e){return this.rest.makeRequest("put",`${r.Endpoints.relationships("@me")}/${e.id}`,!0,{type:2}).then(()=>e)}unblockUser(e){return this.rest.makeRequest("delete",`${r.Endpoints.relationships("@me")}/${e.id}`,!0).then(()=>e)}setRolePositions(e,t){return this.rest.makeRequest("patch",r.Endpoints.guildRoles(e),!0,t).then(()=>this.rest.client.actions.GuildRolesPositionUpdate.handle({guild_id:e,roles:t}).guild)}addMessageReaction(e,t){return this.rest.makeRequest("put",r.Endpoints.selfMessageReaction(e.channel.id,e.id,t),!0).then(()=>this.rest.client.actions.MessageReactionAdd.handle({user_id:this.rest.client.user.id,message_id:e.id,emoji:a(t),channel_id:e.channel.id}).reaction)}removeMessageReaction(e,t,i){let n=r.Endpoints.selfMessageReaction(e.channel.id,e.id,t);return i.id!==this.rest.client.user.id&&(n=r.Endpoints.userMessageReaction(e.channel.id,e.id,t,null,i.id)),this.rest.makeRequest("delete",n,!0).then(()=>this.rest.client.actions.MessageReactionRemove.handle({user_id:i.id,message_id:e.id,emoji:a(t),channel_id:e.channel.id}).reaction)}removeMessageReactions(e){this.rest.makeRequest("delete",r.Endpoints.messageReactions(e.channel.id,e.id),!0).then(()=>e)}getMessageReactionUsers(e,t,i=100){return this.rest.makeRequest("get",r.Endpoints.messageReaction(e.channel.id,e.id,t,i),!0)}getMyApplication(){return this.rest.makeRequest("get",r.Endpoints.myApplication,!0).then(e=>new d(this.rest.client,e))}setNote(e,t){return this.rest.makeRequest("put",r.Endpoints.note(e.id),!0,{note:t}).then(()=>e)}}e.exports=p},function(e,t,i){const r=i(128);class n extends r{constructor(e,t){super(e,t),this.requestRemaining=1,this.first=!0}push(e){super.push(e),this.handle()}handleNext(e){this.waiting||(this.waiting=!0,this.restManager.client.setTimeout(()=>{this.requestRemaining=this.requestLimit,this.waiting=!1,this.handle()},e))}execute(e){e.request.gen().end((t,i)=>{if(i&&i.headers&&(this.requestLimit=i.headers["x-ratelimit-limit"],this.requestResetTime=1e3*Number(i.headers["x-ratelimit-reset"]),this.requestRemaining=Number(i.headers["x-ratelimit-remaining"]),this.timeDifference=Date.now()-new Date(i.headers.date).getTime(),this.handleNext(this.requestResetTime-Date.now()+this.timeDifference+1e3)),t)429===t.status?(this.requestRemaining=0,this.queue.unshift(e),this.restManager.client.setTimeout(()=>{this.globalLimit=!1,this.handle()},Number(i.headers["retry-after"])+500),i.headers["x-ratelimit-global"]&&(this.globalLimit=!0)):e.reject(t);else{this.globalLimit=!1;const t=i&&i.body?i.body:{};e.resolve(t),this.first&&(this.first=!1,this.handle())}})}handle(){if(super.handle(),!(this.requestRemaining<1||0===this.queue.length||this.globalLimit))for(;this.queue.length>0&&this.requestRemaining>0;)this.execute(this.queue.shift()),this.requestRemaining--}}e.exports=n},function(e,t,i){const r=i(128);class n extends r{constructor(e,t){super(e,t),this.waiting=!1,this.endpoint=t,this.timeDifference=0}push(e){super.push(e),this.handle()}execute(e){return new Promise(t=>{e.request.gen().end((i,r)=>{if(r&&r.headers&&(this.requestLimit=r.headers["x-ratelimit-limit"],this.requestResetTime=1e3*Number(r.headers["x-ratelimit-reset"]),this.requestRemaining=Number(r.headers["x-ratelimit-remaining"]),this.timeDifference=Date.now()-new Date(r.headers.date).getTime()),i)429===i.status?(this.restManager.client.setTimeout(()=>{this.waiting=!1,this.globalLimit=!1,t()},Number(r.headers["retry-after"])+500),r.headers["x-ratelimit-global"]&&(this.globalLimit=!0)):(this.queue.shift(),this.waiting=!1,e.reject(i),t(i));else{this.queue.shift(),this.globalLimit=!1;const i=r&&r.body?r.body:{};e.resolve(i),0===this.requestRemaining?this.restManager.client.setTimeout(()=>{this.waiting=!1,t(i)},this.requestResetTime-Date.now()+this.timeDifference+1e3):(this.waiting=!1,t(i))}})})}handle(){if(super.handle(),!this.waiting&&0!==this.queue.length&&!this.globalLimit){this.waiting=!0;const e=this.queue[0];this.execute(e).then(()=>this.handle())}}}e.exports=n},function(e,t,i){const r=i(2);class n{constructor(e){this.restManager=e,this._userAgent={url:"https://github.com/hydrabolt/discord.js",version:r.Package.version}}set(e){this._userAgent.url=e.url||"https://github.com/hydrabolt/discord.js",this._userAgent.version=e.version||r.Package.version}get userAgent(){return`DiscordBot (${this._userAgent.url}, ${this._userAgent.version})`}}e.exports=n},function(e,t,i){const r=i(6),n=i(41),s=i(2),a=i(258),o=i(3).EventEmitter;class f{constructor(e){this.client=e,this.connections=new r,this.pending=new r,this.client.on("self.voiceServer",this.onVoiceServer.bind(this)),this.client.on("self.voiceStateUpdate",this.onVoiceStateUpdate.bind(this))}onVoiceServer(e){this.pending.has(e.guild_id)&&this.pending.get(e.guild_id).setTokenAndEndpoint(e.token,e.endpoint)}onVoiceStateUpdate(e){this.pending.has(e.guild_id)&&this.pending.get(e.guild_id).setSessionID(e.session_id)}sendVoiceStateUpdate(e,t={}){if(!this.client.user)throw new Error("Unable to join because there is no client user.");if(!e.permissionsFor)throw new Error("Channel does not support permissionsFor; is it really a voice channel?");const i=e.permissionsFor(this.client.user);if(!i)throw new Error("There is no permission set for the client user in this channel - are they part of the guild?");if(!i.hasPermission("CONNECT"))throw new Error("You do not have permission to join this voice channel.");t=n({guild_id:e.guild.id,channel_id:e.id,self_mute:!1,self_deaf:!1},t),this.client.ws.send({op:s.OPCodes.VOICE_STATE_UPDATE,d:t})}joinChannel(e){return new Promise((t,i)=>{if(this.client.browser)throw new Error("Voice connections are not available in browsers.");if(this.pending.get(e.guild.id))throw new Error("Already connecting to this guild's voice server.");if(!e.joinable)throw new Error("You do not have permission to join this voice channel.");const r=this.connections.get(e.guild.id);if(r)return r.channel.id!==e.id&&(this.sendVoiceStateUpdate(e),this.connections.get(e.guild.id).channel=e),void t(r);const n=new h(this,e);this.pending.set(e.guild.id,n),n.on("fail",t=>{this.pending.delete(e.guild.id),i(t)}),n.on("pass",r=>{this.pending.delete(e.guild.id),this.connections.set(e.guild.id,r),r.once("ready",()=>t(r)),r.once("error",i),r.once("disconnect",()=>this.connections.delete(e.guild.id))})})}}class h extends o{constructor(e,t){super(),this.voiceManager=e,this.channel=t,this.deathTimer=this.voiceManager.client.setTimeout(()=>this.fail(new Error("Connection not established within 15 seconds.")),15e3),this.data={},this.sendVoiceStateUpdate()}checkReady(){return!!(this.data.token&&this.data.endpoint&&this.data.session_id)&&(this.pass(),!0)}setTokenAndEndpoint(e,t){return e?t?this.data.token?void this.fail(new Error("There is already a registered token for this connection.")):this.data.endpoint?void this.fail(new Error("There is already a registered endpoint for this connection.")):(t=t.match(/([^:]*)/)[0])?(this.data.token=e,this.data.endpoint=t,void this.checkReady()):void this.fail(new Error("Failed to find an endpoint.")):void this.fail(new Error("Endpoint not provided from voice server packet.")):void this.fail(new Error("Token not provided from voice server packet."))}setSessionID(e){return e?this.data.session_id?void this.fail(new Error("There is already a registered session ID for this connection.")):(this.data.session_id=e,void this.checkReady()):void this.fail(new Error("Session ID not supplied."))}clean(){clearInterval(this.deathTimer),this.emit("fail",new Error("Clean-up triggered :fourTriggered:"))}pass(){clearInterval(this.deathTimer),this.emit("pass",this.upgrade())}fail(e){this.emit("fail",e),this.clean()}sendVoiceStateUpdate(){try{this.voiceManager.sendVoiceStateUpdate(this.channel)}catch(e){this.fail(e)}}upgrade(){return new a(this)}}e.exports=f},function(e,t,i){const r=i(260),n=i(259),s=i(2),a=i(268),o=i(270),f=i(3).EventEmitter,h=i(10);class c extends f{constructor(e){super(),this.voiceManager=e.voiceManager,this.channel=e.channel,this.speaking=!1,this.receivers=[],this.authentication=e.data,this.player=new a(this),this.player.on("debug",e=>{this.emit("debug",`audio player - ${e}`)}),this.player.on("error",e=>{this.emit("warn",e),this.player.cleanup()}),this.ssrcMap=new Map,this.ready=!1,this.sockets={},this.connect()}setSpeaking(e){this.speaking!==e&&(this.speaking=e,this.sockets.ws.sendPacket({op:s.VoiceOPCodes.SPEAKING,d:{speaking:!0,delay:0}}).catch(e=>{this.emit("debug",e)}))}disconnect(){this.emit("closing"),this.voiceManager.client.ws.send({op:s.OPCodes.VOICE_STATE_UPDATE,d:{guild_id:this.channel.guild.id,channel_id:null,self_mute:!1,self_deaf:!1}}),this.emit("disconnect")}connect(){if(this.sockets.ws)throw new Error("There is already an existing WebSocket connection.");if(this.sockets.udp)throw new Error("There is already an existing UDP connection.");this.sockets.ws=new r(this),this.sockets.udp=new n(this),this.sockets.ws.on("error",e=>this.emit("error",e)),this.sockets.udp.on("error",e=>this.emit("error",e)),this.sockets.ws.once("ready",e=>{this.authentication.port=e.port,this.authentication.ssrc=e.ssrc,this.sockets.udp.findEndpointAddress().then(e=>{this.sockets.udp.createUDPSocket(e)},e=>this.emit("error",e))}),this.sockets.ws.once("sessionDescription",(e,t)=>{this.authentication.encryptionMode=e,this.authentication.secretKey=t,this.emit("ready"),this.ready=!0}),this.sockets.ws.on("speaking",e=>{const t=this.channel.guild,i=this.voiceManager.client.users.get(e.user_id);if(this.ssrcMap.set(+e.ssrc,i),!e.speaking)for(const r of this.receivers){const e=r.opusStreams.get(i.id),t=r.pcmStreams.get(i.id);e&&(e.push(null),e.open=!1,r.opusStreams.delete(i.id)),t&&(t.push(null),t.open=!1,r.pcmStreams.delete(i.id))}this.ready&&this.emit("speaking",i,e.speaking),t._memberSpeakUpdate(e.user_id,e.speaking)})}playFile(e,t){return this.playStream(h.createReadStream(e),t)}playStream(e,{seek=0,volume=1,passes=1}={}){const t={seek:seek,volume:volume,passes:passes};return this.player.playUnknownStream(e,t)}playConvertedStream(e,{seek=0,volume=1,passes=1}={}){const t={seek:seek,volume:volume,passes:passes};return this.player.playPCMStream(e,t)}createReceiver(){const e=new o(this);return this.receivers.push(e),e}}e.exports=c},function(e,t,i){(function(t){function r(e){try{const i=new t(e);let r="";for(let n=4;n{s.lookup(this.voiceConnection.authentication.endpoint,(i,r)=>{return i?void t(i):(this.discordAddress=r,void e(r))})})}send(e){return new Promise((t,i)=>{if(!this.socket)throw new Error("Tried to send a UDP packet, but there is no socket available.");if(!this.discordAddress||!this.discordPort)throw new Error("Malformed UDP address or port.");this.socket.send(e,0,e.length,this.discordPort,this.discordAddress,r=>{r?i(r):t(e)})})}createUDPSocket(e){this.discordAddress=e;const i=this.socket=n.createSocket("udp4");i.once("message",e=>{const t=r(e);return t.error?void this.emit("error",t.error):(this.localAddress=t.address,this.localPort=t.port,void this.voiceConnection.sockets.ws.sendPacket({op:a.VoiceOPCodes.SELECT_PROTOCOL,d:{protocol:"udp",data:{address:t.address,port:t.port,mode:"xsalsa20_poly1305"}}}))});const s=new t(70);s.writeUIntBE(this.voiceConnection.authentication.ssrc,0,4),this.send(s)}}e.exports=f}).call(t,i(0).Buffer)},function(e,t,i){const r=i(119),n=i(2),s=i(271),a=i(3).EventEmitter;class o extends a{constructor(e){super(),this.voiceConnection=e,this.attempts=0,this.connect(),this.dead=!1,this.voiceConnection.on("closing",this.shutdown.bind(this))}shutdown(){this.dead=!0,this.reset()}get client(){return this.voiceConnection.voiceManager.client}reset(){this.ws&&(this.ws.readyState!==r.CLOSED&&this.ws.close(),this.ws=null),this.clearHeartbeat()}connect(){if(!this.dead){if(this.ws&&this.reset(),this.attempts>5)return void this.emit("error",new Error(`Too many connection attempts (${this.attempts}).`));this.attempts++,this.ws=new r(`wss://${this.voiceConnection.authentication.endpoint}`),this.ws.onopen=this.onOpen.bind(this),this.ws.onmessage=this.onMessage.bind(this),this.ws.onclose=this.onClose.bind(this),this.ws.onerror=this.onError.bind(this)}}send(e){return new Promise((t,i)=>{if(!this.ws||this.ws.readyState!==r.OPEN)throw new Error(`Voice websocket not open to send ${e}.`);this.ws.send(e,null,r=>{r?i(r):t(e)})})}sendPacket(e){try{e=JSON.stringify(e)}catch(e){return Promise.reject(e)}return this.send(e)}onOpen(){this.sendPacket({op:n.OPCodes.DISPATCH,d:{server_id:this.voiceConnection.channel.guild.id,user_id:this.client.user.id,token:this.voiceConnection.authentication.token,session_id:this.voiceConnection.authentication.session_id}}).catch(()=>{this.emit("error",new Error("Tried to send join packet, but the WebSocket is not open."))})}onMessage(e){try{return this.onPacket(JSON.parse(e.data))}catch(e){return this.onError(e)}}onClose(){this.dead||this.client.setTimeout(this.connect.bind(this),1e3*this.attempts)}onError(e){this.emit("error",e)}onPacket(e){switch(e.op){case n.VoiceOPCodes.READY:this.setHeartbeat(e.d.heartbeat_interval),this.emit("ready",e.d);break;case n.VoiceOPCodes.SESSION_DESCRIPTION:this.emit("sessionDescription",e.d.mode,new s(e.d.secret_key));break;case n.VoiceOPCodes.SPEAKING:this.emit("speaking",e.d);break;default:this.emit("unknownPacket",e)}}setHeartbeat(e){return!e||isNaN(e)?void this.onError(new Error("Tried to set voice heartbeat but no valid interval was specified.")):(this.heartbeatInterval&&(this.emit("warn","A voice heartbeat interval is being overwritten"),clearInterval(this.heartbeatInterval)),void(this.heartbeatInterval=this.client.setInterval(this.sendHeartbeat.bind(this),e)))}clearHeartbeat(){return this.heartbeatInterval?(clearInterval(this.heartbeatInterval),void(this.heartbeatInterval=null)):void this.emit("warn","Tried to clear a heartbeat interval that does not exist")}sendHeartbeat(){this.sendPacket({op:n.VoiceOPCodes.HEARTBEAT,d:null}).catch(()=>{this.emit("warn","Tried to send heartbeat, but connection is not open"),this.clearHeartbeat()})}}e.exports=o},function(e,t,i){(function(t){const r=i(3).EventEmitter,n=i(116),s=new t(24);s.fill(0);class a extends r{constructor(e,t,i,r){super(),this.player=e,this.stream=t,this.streamingData={channels:2,count:0,sequence:i.sequence,timestamp:i.timestamp,pausedTime:0},this._startStreaming(),this._triggered=!1,this._volume=r.volume,this.passes=r.passes||1,this.paused=!1,this.setVolume(r.volume||1)}get time(){return this.streamingData.count*(this.streamingData.length||0)}get totalStreamTime(){return this.time+this.streamingData.pausedTime}get volume(){return this._volume}setVolume(e){this._volume=e}setVolumeDecibels(e){this._volume=Math.pow(10,e/20)}setVolumeLogarithmic(e){this._volume=Math.pow(e,1.660964)}pause(){this._setPaused(!0)}resume(){this._setPaused(!1)}end(){this._triggerTerminalState("end","user requested")}_setSpeaking(e){this.speaking=e,this.emit("speaking",e)}_sendBuffer(e,t,i){let r=this.passes;const n=this._createPacket(t,i,this.player.opusEncoder.encode(e));for(;r--;)this.player.voiceConnection.sockets.udp.send(n).catch(e=>this.emit("debug",`Failed to send a packet ${e}`))}_createPacket(e,i,r){const a=new t(r.length+28);a.fill(0),a[0]=128,a[1]=120,a.writeUIntBE(e,2,2),a.writeUIntBE(i,4,4),a.writeUIntBE(this.player.voiceConnection.authentication.ssrc,8,4),a.copy(s,0,0,12),r=n.secretbox(r,s,this.player.voiceConnection.authentication.secretKey.key);for(let o=0;o=e.length-1);r+=2){const t=Math.min(32767,Math.max(-32767,Math.floor(this._volume*e.readInt16LE(r))));i.writeInt16LE(t,r)}return i}_send(){try{if(this._triggered)return void this._setSpeaking(!1);const e=this.streamingData;if(e.missed>=5)return void this._triggerTerminalState("end","Stream is not generating quickly enough.");if(this.paused)return e.pausedTime+=10*e.length,void this.player.voiceConnection.voiceManager.client.setTimeout(()=>this._send(),10*e.length);this._setSpeaking(!0),e.startTime||(this.emit("start"),e.startTime=Date.now());const i=1920*e.channels;let r=this.stream.read(i);if(!r)return e.missed++,e.pausedTime+=10*e.length,void this.player.voiceConnection.voiceManager.client.setTimeout(()=>this._send(),10*e.length);if(e.missed=0,r.length!==i){const e=new t(i).fill(0);r.copy(e),r=e}r=this._applyVolume(r),e.count++,e.sequence=e.sequence+1<65536?e.sequence+1:0,e.timestamp=e.timestamp+4294967295?e.timestamp+960:0,this._sendBuffer(r,e.sequence,e.timestamp);const n=e.length+(e.startTime+e.pausedTime+e.count*e.length-Date.now());this.player.voiceConnection.voiceManager.client.setTimeout(()=>this._send(),n)}catch(e){this._triggerTerminalState("error",e)}}_triggerEnd(){this.emit("end")}_triggerError(e){this.emit("end"),this.emit("error",e)}_triggerTerminalState(e,t){if(!this._triggered)switch(this.emit("debug",`Triggered terminal state ${e} - stream is now dead`),this._triggered=!0,this._setSpeaking(!1),e){case"end":this._triggerEnd(t);break;case"error":this._triggerError(t);break;default:this.emit("error","Unknown trigger state")}}_startStreaming(){if(!this.stream)return void this.emit("error","No stream");this.stream.on("end",e=>this._triggerTerminalState("end",e)),this.stream.on("error",e=>this._triggerTerminalState("error",e));const e=this.streamingData;e.length=20,e.missed=0,this.stream.once("readable",()=>this._send())}_setPaused(e){e?(this.paused=!0,this._setSpeaking(!1)):(this.paused=!1,this._setSpeaking(!0))}}e.exports=a}).call(t,i(0).Buffer)},function(e,t,i){const r=i(129);let n;class s extends r{constructor(e){super(e);try{n=i(!function(){var e=new Error('Cannot find module "node-opus"');throw e.code="MODULE_NOT_FOUND",e}())}catch(e){throw e}this.encoder=new n.OpusEncoder(48e3,2)}encode(e){return super.encode(e),this.encoder.encode(e,1920)}decode(e){return super.decode(e),this.encoder.decode(e,1920)}}e.exports=s},function(e,t,i){function r(e){try{return new e}catch(e){return null}}const n=[i(262),i(264)];t.add=(e=>{n.push(e)}),t.fetch=(()=>{for(const e of n){const t=r(e);if(t)return t}throw new Error("Couldn't find an Opus engine.")})},function(e,t,i){const r=i(129);let n;class s extends r{constructor(e){super(e);try{n=i(204)}catch(e){throw e}this.encoder=new n(48e3,2)}encode(e){return super.encode(e),this.encoder.encode(e,960)}decode(e){return super.decode(e),this.encoder.decode(e)}}e.exports=s},function(e,t,i){const r=i(3).EventEmitter;class n extends r{constructor(e){super(),this.player=e}createConvertStream(){}}e.exports=n},function(e,t,i){t.fetch=(()=>i(267))},function(e,t,i){function r(){for(const e of["ffmpeg","avconv","./ffmpeg","./avconv"])if(!s.spawnSync(e,["-h"]).error)return e;throw new Error("FFMPEG was not found on your system, so audio cannot be played. Please make sure FFMPEG is installed and in your PATH.")}const n=i(265),s=i(10),a=i(3).EventEmitter;class o extends a{constructor(e){super(),this.process=e,this.input=null,this.process.on("error",e=>this.emit("error",e))}setInput(e){this.input=e,e.pipe(this.process.stdin,{end:!1}),this.input.on("error",e=>this.emit("error",e)),this.process.stdin.on("error",e=>this.emit("error",e))}destroy(){this.emit("debug","destroying a ffmpeg process:"),this.input&&this.input.unpipe&&this.process.stdin&&(this.input.unpipe(this.process.stdin),this.emit("unpiped the user input stream from the process input stream")),this.process.stdin&&(this.process.stdin.end(),this.emit("ended the process stdin")),this.process.stdin.destroy&&(this.process.stdin.destroy(),this.emit("destroyed the process stdin")),this.process.kill&&(this.process.kill(),this.emit("killed the process"))}}class f extends n{constructor(e){super(e),this.command=r()}handleError(e,t){e.destroy&&e.destroy(),this.emit("error",t)}createConvertStream(e=0){super.createConvertStream();const t=s.spawn(this.command,["-analyzeduration","0","-loglevel","0","-i","-","-f","s16le","-ar","48000","-ac","2","-ss",String(e),"pipe:1"],{stdio:["pipe","pipe","ignore"]});return new o(t)}}e.exports=f},function(e,t,i){const r=i(266),n=i(263),s=i(3).EventEmitter,a=i(261);class o extends s{constructor(e){super(),this.voiceConnection=e, +this.audioToPCM=new(r.fetch()),this.opusEncoder=n.fetch(),this.currentConverter=null,this.dispatcher=null,this.audioToPCM.on("error",e=>this.emit("error",e)),this.streamingData={channels:2,count:0,sequence:0,timestamp:0,pausedTime:0},this.voiceConnection.on("closing",()=>this.cleanup(null,"voice connection closing"))}playUnknownStream(e,{seek=0,volume=1,passes=1}={}){const t={seek:seek,volume:volume,passes:passes};e.on("end",()=>{this.emit("debug","Input stream to converter has ended")}),e.on("error",e=>this.emit("error",e));const i=this.audioToPCM.createConvertStream(t.seek);return i.on("error",e=>this.emit("error",e)),i.setInput(e),this.playPCMStream(i.process.stdout,i,t)}cleanup(e,t){this.emit("debug",`Clean up triggered due to ${t}`);const i=e&&this.dispatcher&&this.dispatcher.stream===e;!this.currentConverter||e&&!i||(this.currentConverter.destroy(),this.currentConverter=null)}playPCMStream(e,t,{seek=0,volume=1,passes=1}={}){const i={seek:seek,volume:volume,passes:passes};e.on("end",()=>this.emit("debug","PCM input stream ended")),this.cleanup(null,"outstanding play stream"),this.currentConverter=t,this.dispatcher&&(this.streamingData=this.dispatcher.streamingData),e.on("error",e=>this.emit("error",e));const r=new a(this,e,this.streamingData,i);return r.on("error",e=>this.emit("error",e)),r.on("end",()=>this.cleanup(r.stream,"dispatcher ended")),r.on("speaking",e=>this.voiceConnection.setSpeaking(e)),this.dispatcher=r,r.on("debug",e=>this.emit("debug",`Stream dispatch - ${e}`)),r}}e.exports=o},function(e,t,i){const r=i(9).Readable;class n extends r{constructor(){super(),this._packets=[],this.open=!0}_read(){}_push(e){this.open&&this.push(e)}}e.exports=n},function(e,t,i){(function(t){const r=i(3).EventEmitter,n=i(116),s=i(269),a=new t(24);a.fill(0);class o extends r{constructor(e){super(),this.queues=new Map,this.pcmStreams=new Map,this.opusStreams=new Map,this.destroyed=!1,this.voiceConnection=e,this._listener=(e=>{const t=+e.readUInt32BE(8).toString(10),i=this.voiceConnection.ssrcMap.get(t);if(i){if(this.queues.get(t))return this.queues.get(t).push(e),this.queues.get(t).map(e=>this.handlePacket(e,i)),void this.queues.delete(t);this.handlePacket(e,i)}else this.queues.has(t)||this.queues.set(t,[]),this.queues.get(t).push(e)}),this.voiceConnection.sockets.udp.socket.on("message",this._listener)}recreate(){this.destroyed&&(this.voiceConnection.sockets.udp.socket.on("message",this._listener),this.destroyed=!1)}destroy(){this.voiceConnection.sockets.udp.socket.removeListener("message",this._listener);for(const e of this.pcmStreams)e[1]._push(null),this.pcmStreams.delete(e[0]);for(const e of this.opusStreams)e[1]._push(null),this.opusStreams.delete(e[0]);this.destroyed=!0}createOpusStream(e){if(e=this.voiceConnection.voiceManager.client.resolver.resolveUser(e),!e)throw new Error("Couldn't resolve the user to create Opus stream.");if(this.opusStreams.get(e.id))throw new Error("There is already an existing stream for that user.");const t=new s;return this.opusStreams.set(e.id,t),t}createPCMStream(e){if(e=this.voiceConnection.voiceManager.client.resolver.resolveUser(e),!e)throw new Error("Couldn't resolve the user to create PCM stream.");if(this.pcmStreams.get(e.id))throw new Error("There is already an existing stream for that user.");const t=new s;return this.pcmStreams.set(e.id,t),t}handlePacket(e,i){e.copy(a,0,0,12);let r=n.secretbox.open(e.slice(12),a,this.voiceConnection.authentication.secretKey.key);if(!r)return void this.emit("warn","Failed to decrypt voice packet");if(r=new t(r),this.opusStreams.get(i.id)&&this.opusStreams.get(i.id)._push(r),this.emit("opus",i,r),this.listenerCount("pcm")>0||this.pcmStreams.size>0){const e=this.voiceConnection.player.opusEncoder.decode(r);this.pcmStreams.get(i.id)&&this.pcmStreams.get(i.id)._push(e),this.emit("pcm",i,e)}}}e.exports=o}).call(t,i(0).Buffer)},function(e,t){class i{constructor(e){this.key=new Uint8Array(new ArrayBuffer(e.length));for(const t in e)this.key[t]=e[t]}}e.exports=i},function(e,t,i){const r="undefined"!=typeof window,n=r?window.WebSocket:i(119),s=i(3).EventEmitter,a=i(2),o=r?i(247).inflateSync:i(97).inflateSync,f=i(274),h=i(131);class c extends s{constructor(e){super(),this.client=e,this.packetManager=new f(this),this.status=a.Status.IDLE,this.sessionID=null,this.sequence=-1,this.gateway=null,this.normalReady=!1,this.ws=null,this.disabledEvents={};for(const t in e.options.disabledEvents)this.disabledEvents[t]=!0;this.first=!0}_connect(e){this.client.emit("debug",`Connecting to gateway ${e}`),this.normalReady=!1,this.status!==a.Status.RECONNECTING&&(this.status=a.Status.CONNECTING),this.ws=new n(e),r&&(this.ws.binaryType="arraybuffer"),this.ws.onopen=(()=>this.eventOpen()),this.ws.onclose=(e=>this.eventClose(e)),this.ws.onmessage=(e=>this.eventMessage(e)),this.ws.onerror=(e=>this.eventError(e)),this._queue=[],this._remaining=3}connect(e){this.first?(this._connect(e),this.first=!1):this.client.setTimeout(()=>this._connect(e),5500)}send(e,t=false){return t?void this._send(JSON.stringify(e)):(this._queue.push(JSON.stringify(e)),void this.doQueue())}destroy(){this.ws.close(1e3),this._queue=[],this.status=a.Status.IDLE}_send(e){this.ws.readyState===n.OPEN&&(this.emit("send",e),this.ws.send(e))}doQueue(){const e=this._queue[0];if(this.ws.readyState===n.OPEN&&e){if(0===this._remaining)return void this.client.setTimeout(()=>{this.doQueue()},1e3);this._remaining--,this._send(e),this._queue.shift(),this.doQueue(),this.client.setTimeout(()=>this._remaining++,1e3)}}eventOpen(){this.client.emit("debug","Connection to gateway opened"),this.status===a.Status.RECONNECTING?this._sendResume():this._sendNewIdentify()}_sendResume(){if(!this.sessionID)return void this._sendNewIdentify();this.client.emit("debug","Identifying as resumed session");const e={token:this.client.token,session_id:this.sessionID,seq:this.sequence};this.send({op:a.OPCodes.RESUME,d:e})}_sendNewIdentify(){this.reconnecting=!1;const e=this.client.options.ws;e.token=this.client.token,this.client.options.shardCount>0&&(e.shard=[Number(this.client.options.shardId),Number(this.client.options.shardCount)]),this.client.emit("debug","Identifying as new session"),this.send({op:a.OPCodes.IDENTIFY,d:e}),this.sequence=-1}eventClose(e){this.emit("close",e),this.client.clearInterval(this.client.manager.heartbeatInterval),this.reconnecting||this.client.emit(a.Events.DISCONNECT),4004!==e.code&&4010!==e.code&&(this.reconnecting||1e3===e.code||this.tryReconnect())}eventMessage(e){let t=e.data;try{"string"!=typeof t&&(t instanceof ArrayBuffer&&(t=h(t)),t=o(t).toString()),t=JSON.parse(t)}catch(e){return this.eventError(new Error(a.Errors.BAD_WS_MESSAGE))}return this.client.emit("raw",t),t.op===a.OPCodes.HELLO&&this.client.manager.setupKeepAlive(t.d.heartbeat_interval),this.packetManager.handle(t)}eventError(e){this.client.listenerCount("error")>0&&this.client.emit("error",e),this.ws.close()}_emitReady(e=true){this.status=a.Status.READY,this.client.emit(a.Events.READY),this.packetManager.handleQueue(),this.normalReady=e}checkIfReady(){if(this.status!==a.Status.READY&&this.status!==a.Status.NEARLY){let e=0;for(const t of this.client.guilds.keys())e+=this.client.guilds.get(t).available?0:1;if(0===e){if(this.status=a.Status.NEARLY,this.client.options.fetchAllMembers){const e=this.client.guilds.map(e=>e.fetchMembers());return void Promise.all(e).then(()=>this._emitReady(),e=>{this.client.emit(a.Events.WARN,"Error in pre-ready guild member fetching"),this.client.emit(a.Events.ERROR,e),this._emitReady()})}this._emitReady()}}}tryReconnect(){this.status=a.Status.RECONNECTING,this.ws.close(),this.packetManager.handleQueue(),this.client.emit(a.Events.RECONNECTING),this.connect(this.client.ws.gateway)}}e.exports=c},function(e,t){function i(e){throw new Error("Cannot find module '"+e+"'.")}i.keys=function(){return[]},i.resolve=i,e.exports=i,i.id=273},function(e,t,i){const r=i(2),n=[r.WSEvents.READY,r.WSEvents.GUILD_CREATE,r.WSEvents.GUILD_DELETE,r.WSEvents.GUILD_MEMBERS_CHUNK,r.WSEvents.GUILD_MEMBER_ADD,r.WSEvents.GUILD_MEMBER_REMOVE];class s{constructor(e){this.ws=e,this.handlers={},this.queue=[],this.register(r.WSEvents.READY,"Ready"),this.register(r.WSEvents.GUILD_CREATE,"GuildCreate"),this.register(r.WSEvents.GUILD_DELETE,"GuildDelete"),this.register(r.WSEvents.GUILD_UPDATE,"GuildUpdate"),this.register(r.WSEvents.GUILD_BAN_ADD,"GuildBanAdd"),this.register(r.WSEvents.GUILD_BAN_REMOVE,"GuildBanRemove"),this.register(r.WSEvents.GUILD_MEMBER_ADD,"GuildMemberAdd"),this.register(r.WSEvents.GUILD_MEMBER_REMOVE,"GuildMemberRemove"),this.register(r.WSEvents.GUILD_MEMBER_UPDATE,"GuildMemberUpdate"),this.register(r.WSEvents.GUILD_ROLE_CREATE,"GuildRoleCreate"),this.register(r.WSEvents.GUILD_ROLE_DELETE,"GuildRoleDelete"),this.register(r.WSEvents.GUILD_ROLE_UPDATE,"GuildRoleUpdate"),this.register(r.WSEvents.GUILD_MEMBERS_CHUNK,"GuildMembersChunk"),this.register(r.WSEvents.CHANNEL_CREATE,"ChannelCreate"),this.register(r.WSEvents.CHANNEL_DELETE,"ChannelDelete"),this.register(r.WSEvents.CHANNEL_UPDATE,"ChannelUpdate"),this.register(r.WSEvents.PRESENCE_UPDATE,"PresenceUpdate"),this.register(r.WSEvents.USER_UPDATE,"UserUpdate"),this.register(r.WSEvents.USER_NOTE_UPDATE,"UserNoteUpdate"),this.register(r.WSEvents.VOICE_STATE_UPDATE,"VoiceStateUpdate"),this.register(r.WSEvents.TYPING_START,"TypingStart"),this.register(r.WSEvents.MESSAGE_CREATE,"MessageCreate"),this.register(r.WSEvents.MESSAGE_DELETE,"MessageDelete"),this.register(r.WSEvents.MESSAGE_UPDATE,"MessageUpdate"),this.register(r.WSEvents.VOICE_SERVER_UPDATE,"VoiceServerUpdate"),this.register(r.WSEvents.MESSAGE_DELETE_BULK,"MessageDeleteBulk"),this.register(r.WSEvents.CHANNEL_PINS_UPDATE,"ChannelPinsUpdate"),this.register(r.WSEvents.GUILD_SYNC,"GuildSync"),this.register(r.WSEvents.RELATIONSHIP_ADD,"RelationshipAdd"),this.register(r.WSEvents.RELATIONSHIP_REMOVE,"RelationshipRemove"),this.register(r.WSEvents.MESSAGE_REACTION_ADD,"MessageReactionAdd"),this.register(r.WSEvents.MESSAGE_REACTION_REMOVE,"MessageReactionRemove"),this.register(r.WSEvents.MESSAGE_REACTION_REMOVE_ALL,"MessageReactionRemoveAll")}get client(){return this.ws.client}register(e,t){const i=!function(){var e=new Error('Cannot find module "."');throw e.code="MODULE_NOT_FOUND",e}();this.handlers[e]=new i(this)}handleQueue(){this.queue.forEach((e,t)=>{this.handle(this.queue[t]),this.queue.splice(t,1)})}setSequence(e){e&&e>this.ws.sequence&&(this.ws.sequence=e)}handle(e){return e.op===r.OPCodes.RECONNECT?(this.setSequence(e.s),this.ws.tryReconnect(),!1):e.op===r.OPCodes.INVALID_SESSION?(this.ws.sessionID=null,this.ws._sendNewIdentify(),!1):(e.op===r.OPCodes.HEARTBEAT_ACK&&this.ws.client.emit("debug","Heartbeat acknowledged"),this.ws.status===r.Status.RECONNECTING&&(this.ws.reconnecting=!1,this.ws.checkIfReady()),this.setSequence(e.s),void 0===this.ws.disabledEvents[e.t]&&(this.ws.status!==r.Status.READY&&n.indexOf(e.t)===-1?(this.queue.push(e),!1):!!this.handlers[e.t]&&this.handlers[e.t].handle(e)))}}e.exports=s},function(e,t){class i{constructor(e,t){this.user=e,this.setup(t)}setup(e){this.type=e.type,this.name=e.name,this.id=e.id,this.revoked=e.revoked,this.integrations=e.integrations}}e.exports=i},function(e,t,i){const r=i(6),n=i(275);class s{constructor(e,t){this.user=e,this.client=this.user.client,Object.defineProperty(this,"client",{enumerable:!1,configurable:!1}),this.mutualGuilds=new r,this.connections=new r,this.setup(t)}setup(e){for(const t of e.mutual_guilds)this.client.guilds.has(t.id)&&this.mutualGuilds.set(t.id,this.client.guilds.get(t.id));for(const i of e.connected_accounts)this.connections.set(i.id,new n(this.user,i))}}e.exports=s},function(e,t){e.exports=function(e){if(e.includes("%")&&(e=decodeURIComponent(e)),e.includes(":")){const[t,i]=e.split(":");return{name:t,id:i}}return{name:e,id:null}}},function(e,t){},function(e,t){},function(e,t){},function(e,t,i){e.exports={Client:i(134),WebhookClient:i(135),Shard:i(62),ShardClientUtil:i(63),ShardingManager:i(136),Collection:i(6),splitMessage:i(79),escapeMarkdown:i(31),fetchRecommendedShards:i(78),Channel:i(20),ClientOAuth2Application:i(64),ClientUser:i(137),DMChannel:i(65),Emoji:i(21),EvaluatedPermissions:i(42),Game:i(12).Game,GroupDMChannel:i(66),Guild:i(43),GuildChannel:i(29),GuildMember:i(30),Invite:i(67),Message:i(44),MessageAttachment:i(68),MessageCollector:i(69),MessageEmbed:i(70),MessageReaction:i(71),OAuth2Application:i(72),PartialGuild:i(73),PartialGuildChannel:i(74),PermissionOverwrites:i(75),Presence:i(12).Presence,ReactionEmoji:i(45),Role:i(22),TextChannel:i(76),User:i(11),VoiceChannel:i(77),Webhook:i(46),version:i(61).version},"undefined"!=typeof window&&(window.Discord=e.exports)}]); \ No newline at end of file