From 9afba6d555ed87b542145609ce8e8e2f9690bbdd Mon Sep 17 00:00:00 2001 From: Travis CI Date: Mon, 21 Nov 2016 00:59:11 +0000 Subject: [PATCH] Webpack build: 176859e7da74cccae4416ddda72f0e2b165c7ed8 --- discord.indev.js | 39749 +++++++++++++++++++++++++++++++++++++++++ discord.indev.min.js | 138 + 2 files changed, 39887 insertions(+) create mode 100644 discord.indev.js create mode 100644 discord.indev.min.js diff --git a/discord.indev.js b/discord.indev.js new file mode 100644 index 00000000..4144c5b9 --- /dev/null +++ b/discord.indev.js @@ -0,0 +1,39749 @@ +/******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; + +/******/ // The require function +/******/ function __webpack_require__(moduleId) { + +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) +/******/ return installedModules[moduleId].exports; + +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ exports: {}, +/******/ id: moduleId, +/******/ loaded: false +/******/ }; + +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); + +/******/ // Flag the module as loaded +/******/ module.loaded = true; + +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } + + +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; + +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; + +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; + +/******/ // Load entry module and return exports +/******/ return __webpack_require__(0); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 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), + + Collection: __webpack_require__(10), + splitMessage: __webpack_require__(11), + escapeMarkdown: __webpack_require__(19), + fetchRecommendedShards: __webpack_require__(251), + + 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), + + version: __webpack_require__(6).version, + }; + + if (typeof window !== 'undefined') window.Discord = module.exports; // eslint-disable-line no-undef + + +/***/ }, +/* 1 */ +/***/ function(module, exports, __webpack_require__) { + + /* 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); + + /** + * 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) { + + // shim for using process in browser + var process = module.exports = {}; + + // 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. + + var cachedSetTimeout; + var cachedClearTimeout; + + 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); + } + } + + + } + 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); + } + } + + + + } + var queue = []; + var draining = false; + var currentQueue; + var queueIndex = -1; + + function cleanUpNextTick() { + if (!draining || !currentQueue) { + return; + } + draining = false; + if (currentQueue.length) { + queue = currentQueue.concat(queue); + } else { + queueIndex = -1; + } + if (queue.length) { + drainQueue(); + } + } + + function drainQueue() { + if (draining) { + return; + } + var timeout = runTimeout(cleanUpNextTick); + draining = true; + + 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); + } + + 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); + } + }; + + // 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 = {}; + + function noop() {} + + process.on = noop; + process.addListener = noop; + process.once = noop; + process.off = noop; + process.removeListener = noop; + process.removeAllListeners = noop; + process.emit = noop; + + process.binding = function (name) { + throw new Error('process.binding is not supported'); + }; + + process.cwd = function () { return '/' }; + process.chdir = function (dir) { + throw new Error('process.chdir is not supported'); + }; + process.umask = function() { return 0; }; + + +/***/ }, +/* 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. + + function EventEmitter() { + this._events = this._events || {}; + this._maxListeners = this._maxListeners || undefined; + } + module.exports = EventEmitter; + + // Backwards-compat with node 0.10.x + EventEmitter.EventEmitter = EventEmitter; + + 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; + + // 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; + + 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; + } + } + } + + handler = this._events[type]; + + 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); + } + + return true; + }; + + EventEmitter.prototype.addListener = function(type, listener) { + var m; + + if (!isFunction(listener)) + throw TypeError('listener must be a function'); + + 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); + + 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; + } + + 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; + }; + + EventEmitter.prototype.on = EventEmitter.prototype.addListener; + + EventEmitter.prototype.once = function(type, listener) { + if (!isFunction(listener)) + throw TypeError('listener must be a function'); + + var fired = false; + + function g() { + this.removeListener(type, g); + + if (!fired) { + fired = true; + listener.apply(this, arguments); + } + } + + g.listener = listener; + this.on(type, g); + + return this; + }; + + // 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 (!this._events || !this._events[type]) + return this; + + 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); + + } 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 (list.length === 1) { + list.length = 0; + delete this._events[type]; + } else { + list.splice(position, 1); + } + + if (this._events.removeListener) + this.emit('removeListener', type, listener); + } + + return this; + }; + + EventEmitter.prototype.removeAllListeners = function(type) { + var key, listeners; + + 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; + } + + // 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]; + + 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; + }; + + 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]; + + if (isFunction(evlistener)) + return 1; + else if (evlistener) + return evlistener.length; + } + return 0; + }; + + EventEmitter.listenerCount = function(emitter, type) { + return emitter.listenerCount(type); + }; + + function isFunction(arg) { + return typeof arg === 'function'; + } + + function isNumber(arg) { + return typeof arg === 'number'; + } + + function isObject(arg) { + return typeof arg === 'object' && arg !== null; + } + + function isUndefined(arg) { + return arg === void 0; + } + + +/***/ }, +/* 4 */ +/***/ function(module, exports) { + + 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; + }; + + +/***/ }, +/* 5 */ +/***/ function(module, exports, __webpack_require__) { + + /* WEBPACK VAR INJECTION */(function(process) {exports.Package = __webpack_require__(6); + + /** + * 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: [], + + /** + * 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: '', + }, + }, + }; + + 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', + + // 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`, + + // 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}`, + + // webhooks + webhook: (webhookID, token) => `${API}/webhooks/${webhookID}${token ? `/${token}` : ''}`, + + // oauth + myApplication: `${API}/oauth2/applications/@me`, + getApp: (id) => `${API}/oauth2/authorize?client_id=${id}`, + }; + + exports.Status = { + READY: 0, + CONNECTING: 1, + RECONNECTING: 2, + IDLE: 3, + NEARLY: 4, + }; + + exports.ChannelTypes = { + text: 0, + DM: 1, + voice: 2, + groupDM: 3, + }; + + 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, + }; + + exports.VoiceOPCodes = { + IDENTIFY: 0, + SELECT_PROTOCOL: 1, + READY: 2, + HEARTBEAT: 3, + SESSION_DESCRIPTION: 4, + SPEAKING: 5, + }; + + 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', + }; + + 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', + }; + + 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__(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": "^2.3.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" + } + }; + +/***/ }, +/* 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); + + 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; + + +/***/ }, +/* 8 */ +/***/ function(module, exports, __webpack_require__) { + + const Constants = __webpack_require__(5); + + 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; + + +/***/ }, +/* 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); + + 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); + + 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; + + +/***/ }, +/* 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) { + + 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; + }; + + +/***/ }, +/* 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, + }; + } + }; + + +/***/ }, +/* 13 */ +/***/ function(module, exports, __webpack_require__) { + + const TextBasedChannel = __webpack_require__(14); + const Constants = __webpack_require__(5); + const Presence = __webpack_require__(24).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; + + +/***/ }, +/* 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); + + /** + * 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(); + + /** + * The ID of the last message in the channel, if one was sent. + * @type {?string} + */ + this.lastMessageID = null; + } + + /** + * 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. + */ + + /** + * 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 + */ + + /** + * 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); + } + + /** + * 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); + } + + /** + * 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, + }) + ); + } + + /** + * 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); + } + + /** + * 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; + }); + } + + /** + * 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 + */ + + /** + * 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; + }); + } + + /** + * 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; + }); + } + + /** + * 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; + } + } + + /** + * 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); + } + } + } + + /** + * 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); + } + + /** + * 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; + } + + /** + * 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); + } + + /** + * 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); + } + }); + }); + } + + /** + * 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)); + } + + +/***/ }, +/* 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. + + // 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--; + } + } + + // if the path is allowed to go above the root, restore leading ..s + if (allowAboveRoot) { + for (; up--; up) { + parts.unshift('..'); + } + } + + return parts; + } + + // 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); + }; + + // path.resolve([from ...], to) + // posix version + exports.resolve = function() { + var resolvedPath = '', + resolvedAbsolute = false; + + for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) { + var path = (i >= 0) ? arguments[i] : process.cwd(); + + // Skip empty and invalid entries + if (typeof path !== 'string') { + throw new TypeError('Arguments to path.resolve must be strings'); + } else if (!path) { + continue; + } + + resolvedPath = path + '/' + resolvedPath; + resolvedAbsolute = path.charAt(0) === '/'; + } + + // 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) + + // Normalize the path + resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function(p) { + return !!p; + }), !resolvedAbsolute).join('/'); + + return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.'; + }; + + // path.normalize(path) + // posix version + exports.normalize = function(path) { + var isAbsolute = exports.isAbsolute(path), + trailingSlash = substr(path, -1) === '/'; + + // Normalize the path + path = normalizeArray(filter(path.split('/'), function(p) { + return !!p; + }), !isAbsolute).join('/'); + + if (!path && !isAbsolute) { + path = '.'; + } + if (path && trailingSlash) { + path += '/'; + } + + return (isAbsolute ? '/' : '') + path; + }; + + // posix version + exports.isAbsolute = function(path) { + return path.charAt(0) === '/'; + }; + + // 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('/')); + }; + + + // 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))) + +/***/ }, +/* 16 */ +/***/ function(module, exports, __webpack_require__) { + + 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; + + +/***/ }, +/* 17 */ +/***/ 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; + + +/***/ }, +/* 18 */ +/***/ function(module, exports) { + + /** + * 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 }); + + /** + * The message this embed is part of + * @type {Message} + */ + this.message = message; + + this.setup(data); + } + + setup(data) { + /** + * The title of this embed, if there is one + * @type {?string} + */ + this.title = data.title; + + /** + * The type of this embed + * @type {string} + */ + this.type = data.type; + + /** + * The description of this embed, if there is one + * @type {?string} + */ + this.description = data.description; + + /** + * The URL of this embed + * @type {string} + */ + this.url = data.url; + + /** + * 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)); + + /** + * 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; + + /** + * The author of this embed, if there is one + * @type {MessageEmbedAuthor} + */ + this.author = data.author ? new MessageEmbedAuthor(this, data.author) : null; + + /** + * The provider of this embed, if there is one + * @type {MessageEmbedProvider} + */ + this.provider = data.provider ? new MessageEmbedProvider(this, data.provider) : null; + + /** + * The footer of this embed + * @type {MessageEmbedFooter} + */ + this.footer = data.footer ? new MessageEmbedFooter(this, data.footer) : null; + } + + /** + * The date this embed was created + * @type {Date} + */ + get createdAt() { + return new Date(this.createdTimestamp); + } + } + + /** + * 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; + + +/***/ }, +/* 19 */ +/***/ function(module, exports) { + + 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'); + }; + + +/***/ }, +/* 20 */ +/***/ function(module, exports, __webpack_require__) { + + const Collection = __webpack_require__(10); + const Emoji = __webpack_require__(21); + const ReactionEmoji = __webpack_require__(22); + + /** + * 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; + + +/***/ }, +/* 21 */ +/***/ function(module, exports, __webpack_require__) { + + const Constants = __webpack_require__(5); + const Collection = __webpack_require__(10); + + /** + * 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; + + this.setup(data); + } + + setup(data) { + /** + * The ID of the emoji + * @type {string} + */ + this.id = data.id; + + /** + * 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 this emoji is managed by an external service + * @type {boolean} + */ + this.managed = data.managed; + + this._roles = data.roles; + } + + /** + * 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); + } + + /** + * 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`; + } + + /** + * 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); + } + } + + module.exports = Emoji; + + +/***/ }, +/* 22 */ +/***/ function(module, exports) { + + /** + * 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; + + /** + * The name of this reaction emoji. + * @type {string} + */ + this.name = name; + + /** + * The ID of this reaction emoji. + * @type {string} + */ + this.id = id; + } + + /** + * 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); + } + + /** + * 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; + } + } + + module.exports = ReactionEmoji; + + +/***/ }, +/* 23 */ +/***/ function(module, exports, __webpack_require__) { + + const EventEmitter = __webpack_require__(3).EventEmitter; + const Collection = __webpack_require__(10); + + /** + * 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; + + +/***/ }, +/* 24 */ +/***/ function(module, exports) { + + /** + * 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; + + +/***/ }, +/* 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; + + /** + * 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 }); + + /** + * The guild that this member is part of + * @type {Guild} + */ + this.guild = guild; + + /** + * The user that this guild member instance Represents + * @type {User} + */ + this.user = {}; + + this._roles = []; + if (data) this.setup(data); + } + + setup(data) { + /** + * Whether this member is deafened server-wide + * @type {boolean} + */ + this.serverDeaf = data.deaf; + + /** + * Whether this member is muted server-wide + * @type {boolean} + */ + this.serverMute = data.mute; + + /** + * 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; + + +/***/ }, +/* 26 */ +/***/ function(module, exports, __webpack_require__) { + + const Constants = __webpack_require__(5); + + /** + * 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 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; + + +/***/ }, +/* 27 */ +/***/ function(module, exports, __webpack_require__) { + + const Constants = __webpack_require__(5); + + /** + * 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; + + /** + * A number representing the packed permissions + * @type {number} + */ + this.raw = raw; + } + + /** + * 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; + } + + /** + * 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; + } + + /** + * 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)); + } + + /** + * 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)); + } + } + + module.exports = EvaluatedPermissions; + + +/***/ }, +/* 28 */ +/***/ function(module, exports, __webpack_require__) { + + const PartialGuild = __webpack_require__(29); + const PartialGuildChannel = __webpack_require__(30); + const Constants = __webpack_require__(5); + + /* + { 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' } } + */ + + /** + * 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 }); + + this.setup(data); + } + + 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); + + /** + * The code for this invite + * @type {string} + */ + this.code = data.code; + + /** + * Whether or not this invite is temporary + * @type {boolean} + */ + this.temporary = data.temporary; + + /** + * The maximum age of the invite, in seconds + * @type {?number} + */ + this.maxAge = data.max_age; + + /** + * How many times this invite has been used + * @type {number} + */ + this.uses = data.uses; + + /** + * 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; + + +/***/ }, +/* 29 */ +/***/ function(module, exports) { + + /* + { splash: null, + id: '123123123', + icon: '123123123', + name: 'name' } + */ + + /** + * 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 }); + + this.setup(data); + } + + setup(data) { + /** + * The ID of this guild + * @type {string} + */ + this.id = data.id; + + /** + * The name of this guild + * @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 hash of the guild splash image, or null if no splash (VIP only) + * @type {?string} + */ + this.splash = data.splash; + } + } + + module.exports = PartialGuild; + + +/***/ }, +/* 30 */ +/***/ function(module, exports, __webpack_require__) { + + const Constants = __webpack_require__(5); + + /* + { type: 0, id: '123123', name: 'heavy-testing' } } + */ + + /** + * 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 }); + + this.setup(data); + } + + setup(data) { + /** + * The ID of this guild channel + * @type {string} + */ + this.id = data.id; + + /** + * The name of this guild channel + * @type {string} + */ + this.name = data.name; + + /** + * The type of this guild channel - `text` or `voice` + * @type {string} + */ + this.type = Constants.ChannelTypes.text === data.type ? 'text' : 'voice'; + } + } + + module.exports = PartialGuildChannel; + + +/***/ }, +/* 31 */ +/***/ function(module, exports, __webpack_require__) { + + 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; + + +/***/ }, +/* 32 */ +/***/ function(module, exports, __webpack_require__) { + + const Collection = __webpack_require__(10); + const UserConnection = __webpack_require__(33); + + /** + * 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; + + +/***/ }, +/* 33 */ +/***/ 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; + + +/***/ }, +/* 34 */ +/***/ function(module, exports, __webpack_require__) { + + 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; + + +/***/ }, +/* 35 */ +/***/ function(module, exports) { + + /** + * 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 }); + + 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; + + +/***/ }, +/* 36 */ +/***/ function(module, exports, __webpack_require__) { + + const RequestHandler = __webpack_require__(37); + + /** + * 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; + + +/***/ }, +/* 37 */ +/***/ function(module, exports) { + + /** + * 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; + + +/***/ }, +/* 38 */ +/***/ function(module, exports, __webpack_require__) { + + const RequestHandler = __webpack_require__(37); + + 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; + + +/***/ }, +/* 39 */ +/***/ function(module, exports, __webpack_require__) { + + const request = __webpack_require__(40); + const Constants = __webpack_require__(5); + + 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; + + +/***/ }, +/* 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 + err.rawResponse = self.xhr && self.xhr.responseText ? self.xhr.responseText : null; + // issue #876: return the http status code if the response parsing fails + err.statusCode = self.xhr && self.xhr.status ? self.xhr.status : 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); + for (var key in requestBase) { + Request.prototype[key] = requestBase[key]; + } + + /** + * 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 `filename`. + * + * ``` js + * request.post('/upload') + * .attach('content', new Blob(['hey!'], { type: "text/html"})) + * .end(callback); + * ``` + * + * @param {String} field + * @param {Blob|File} file + * @param {String} filename + * @return {Request} for chaining + * @api public + */ + + Request.prototype.attach = function(field, file, filename){ + this._getFormData().append(field, file, filename || 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(); + 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); + }; + + /** + * 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; + } + }; + + /** + * 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; + }; + + +/***/ }, +/* 41 */ +/***/ function(module, exports, __webpack_require__) { + + + /** + * 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; + }; + + +/***/ }, +/* 42 */ +/***/ function(module, exports, __webpack_require__) { + + /** + * Module of mixed-in functions shared between node and client code + */ + var isObject = __webpack_require__(43); + + /** + * Clear previous timeout. + * + * @return {Request} for chaining + * @api public + */ + + exports.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 + */ + + exports.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 + */ + + exports.serialize = function serialize(fn){ + this._serializer = fn; + return this; + }; + + /** + * Set timeout to `ms`. + * + * @param {Number} ms + * @return {Request} for chaining + * @api public + */ + + exports.timeout = function timeout(ms){ + this._timeout = ms; + return this; + }; + + /** + * Promise support + * + * @param {Function} resolve + * @param {Function} reject + * @return {Request} + */ + + exports.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); + } + + exports.catch = function(cb) { + return this.then(undefined, cb); + }; + + /** + * Allow for extension + */ + + exports.use = function use(fn) { + fn(this); + return this; + } + + + /** + * Get request header `field`. + * Case-insensitive. + * + * @param {String} field + * @return {String} + * @api public + */ + + exports.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 + */ + + exports.getHeader = exports.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 + */ + + exports.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 + */ + exports.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 + */ + exports.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 + */ + exports.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 + */ + + exports.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 + */ + + exports.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 + */ + + exports.toJSON = function(){ + return { + method: this.method, + url: this.url, + data: this._data, + headers: this._header + }; + }; + + /** + * Check if `obj` is a host object, + * we don't want to serialize these :) + * + * TODO: future proof, move to compoent land + * + * @param {Object} obj + * @return {Boolean} + * @api private + */ + + exports._isHost = function _isHost(obj) { + var str = {}.toString.call(obj); + + switch (str) { + case '[object File]': + case '[object Blob]': + case '[object FormData]': + return true; + default: + return false; + } + } + + /** + * 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 + */ + + exports.send = function(data){ + var obj = isObject(data); + var type = this._header['content-type']; + + // merge + if (obj && 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 (!obj || this._isHost(data)) return this; + + // default to json + if (!type) this.type('json'); + return this; + }; + + +/***/ }, +/* 43 */ +/***/ function(module, exports) { + + /** + * Check if `obj` is an object. + * + * @param {Object} obj + * @return {Boolean} + * @api private + */ + + function isObject(obj) { + return null !== obj && 'object' === typeof obj; + } + + module.exports = isObject; + + +/***/ }, +/* 44 */ +/***/ function(module, exports) { + + // 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 + */ + + function request(RequestConstructor, method, url) { + // callback + if ('function' == typeof url) { + return new RequestConstructor('GET', method).end(url); + } + + // url first + if (2 == arguments.length) { + return new RequestConstructor('GET', method); + } + + return new RequestConstructor(method, url); + } + + module.exports = request; + + +/***/ }, +/* 45 */ +/***/ function(module, exports, __webpack_require__) { + + 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); + + class ClientDataManager { + constructor(client) { + this.client = client; + } + + get pastReady() { + return this.client.ws.status === Constants.Status.READY; + } + + 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); + } + } + + return guild; + } + + 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; + + +/***/ }, +/* 46 */ +/***/ function(module, exports) { + + module.exports = function cloneObject(obj) { + const cloned = Object.create(obj); + Object.assign(cloned, obj); + return cloned; + }; + + +/***/ }, +/* 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; + + +/***/ }, +/* 48 */ +/***/ function(module, exports) { + + 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; + }; + + +/***/ }, +/* 49 */ +/***/ function(module, exports, __webpack_require__) { + + const Channel = __webpack_require__(50); + const TextBasedChannel = __webpack_require__(14); + const Collection = __webpack_require__(10); + + /** + * 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(); + } + + 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; + + +/***/ }, +/* 50 */ +/***/ function(module, exports) { + + /** + * 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 }); + + /** + * 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; + + if (data) this.setup(data); + } + + setup(data) { + /** + * The unique ID of the channel + * @type {string} + */ + this.id = data.id; + } + + /** + * The timestamp the channel was created at + * @type {number} + * @readonly + */ + get createdTimestamp() { + return (this.id / 4194304) + 1420070400000; + } + + /** + * The time the channel was created + * @type {Date} + * @readonly + */ + get createdAt() { + return new Date(this.createdTimestamp); + } + + /** + * 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); + } + } + + module.exports = Channel; + + +/***/ }, +/* 51 */ +/***/ function(module, exports, __webpack_require__) { + + const GuildChannel = __webpack_require__(52); + const TextBasedChannel = __webpack_require__(14); + const Collection = __webpack_require__(10); + + /** + * 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; + + +/***/ }, +/* 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); + + /** + * Represents a guild channel (i.e. text channels and voice channels) + * @extends {Channel} + */ + class GuildChannel extends Channel { + constructor(guild, data) { + super(guild.client, data); + + /** + * The guild the channel is in + * @type {Guild} + */ + this.guild = guild; + } + + setup(data) { + super.setup(data); + + /** + * The name of the guild channel + * @type {string} + */ + this.name = data.name; + + /** + * The position of the channel in the list. + * @type {number} + */ + this.position = data.position; + + /** + * 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; + + +/***/ }, +/* 53 */ +/***/ 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; + + +/***/ }, +/* 54 */ +/***/ function(module, exports, __webpack_require__) { + + const GuildChannel = __webpack_require__(52); + const Collection = __webpack_require__(10); + + /** + * 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; + + +/***/ }, +/* 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); + + /* + { 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 } + */ + + /** + * 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(); + } + + setup(data) { + super.setup(data); + + /** + * The name of this Group DM, can be null if one isn't set. + * @type {string} + */ + this.name = data.name; + + /** + * A hash of the Group DM icon. + * @type {string} + */ + this.icon = data.icon; + + /** + * The user ID of this Group DM's owner. + * @type {string} + */ + this.ownerID = data.owner_id; + + if (!this.recipients) { + /** + * A collection of the recipients of this DM, mapped by their ID. + * @type {Collection} + */ + this.recipients = new Collection(); + } + + if (data.recipients) { + for (const recipient of data.recipients) { + const user = this.client.dataManager.newUser(recipient); + this.recipients.set(user.id, user); + } + } + + this.lastMessageID = data.last_message_id; + } + + /** + * The owner of this Group DM. + * @type {User} + * @readonly + */ + get owner() { + return this.client.users.get(this.ownerID); + } + + /** + * 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; + + if (equal) { + const thisIDs = this.recipients.keyArray(); + const otherIDs = channel.recipients.keyArray(); + return arraysEqual(thisIDs, otherIDs); + } + + return equal; + } + + /** + * 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; + } + + // 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(GroupDMChannel, true); + + module.exports = GroupDMChannel; + + +/***/ }, +/* 56 */ +/***/ function(module, exports, __webpack_require__) { + + const Constants = __webpack_require__(5); + + /** + * 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; + + /** + * The heartbeat interval, null if not yet set + * @type {?number} + */ + this.heartbeatInterval = null; + } + + /** + * 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); + } + + destroy() { + return new Promise(resolve => { + this.client.ws.destroy(); + if (!this.client.user.bot) { + resolve(this.client.rest.methods.logout()); + } else { + resolve(); + } + }); + } + } + + module.exports = ClientManager; + + +/***/ }, +/* 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); + + 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); + + /** + * 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__(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; }()))) + +/***/ }, +/* 59 */ +/***/ function(module, exports) { + + 'use strict' + + exports.byteLength = byteLength + exports.toByteArray = toByteArray + exports.fromByteArray = fromByteArray + + 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('') + } + + +/***/ }, +/* 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] + + i += d + + 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 + } + + +/***/ }, +/* 61 */ +/***/ function(module, exports) { + + var toString = {}.toString; + + module.exports = Array.isArray || function (arr) { + return toString.call(arr) == '[object Array]'; + }; + + +/***/ }, +/* 62 */ +/***/ function(module, exports) { + + + +/***/ }, +/* 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; + } + + 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__(58).Buffer)) + +/***/ }, +/* 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; + + /** + * 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; + + +/***/ }, +/* 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); + + /** + * 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; + + +/***/ }, +/* 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; + + /** + * 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; + + +/***/ }, +/* 67 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + /*! + * ws: a node.js websocket client + * Copyright(c) 2011 Einar Otto Stangvik + * MIT Licensed + */ + + var WS = module.exports = __webpack_require__(68); + + WS.Server = __webpack_require__(156); + WS.Sender = __webpack_require__(116); + WS.Receiver = __webpack_require__(147); + + /** + * 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; + }; + + +/***/ }, +/* 68 */ +/***/ function(module, exports, __webpack_require__) { + + /* 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; + } + + +/***/ }, +/* 70 */ +/***/ function(module, exports, __webpack_require__) { + + var __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(module, global) {/*! https://mths.be/punycode v1.3.2 by @mathias */ + ;(function(root) { + + /** 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 `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 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. + * 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)); + } + + /** + * 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.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) { + + module.exports = function(module) { + if(!module.webpackPolyfill) { + module.deprecate = function() {}; + module.paths = []; + // module.parent = undefined by default + module.children = []; + module.webpackPolyfill = 1; + } + return module; + } + + +/***/ }, +/* 72 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + exports.decode = exports.parse = __webpack_require__(73); + exports.encode = exports.stringify = __webpack_require__(74); + + +/***/ }, +/* 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. + + 'use strict'; + + // 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 (Array.isArray(obj[k])) { + obj[k].push(v); + } else { + obj[k] = [obj[k], v]; + } + } + + return obj; + }; + + +/***/ }, +/* 74 */ +/***/ 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. + + 'use strict'; + + var stringifyPrimitive = function(v) { + switch (typeof v) { + case 'string': + return v; + + case 'boolean': + return v ? 'true' : 'false'; + + case 'number': + return isFinite(v) ? v : ''; + + default: + return ''; + } + }; + + module.exports = function(obj, sep, eq, name) { + sep = sep || '&'; + eq = eq || '='; + if (obj === null) { + obj = undefined; + } + + 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)); + }; + + +/***/ }, +/* 75 */ +/***/ function(module, exports, __webpack_require__) { + + /* 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) { + + 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) { + + 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 + } + } + + +/***/ }, +/* 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) + + 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; + } + + 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__) { + + 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; + }; + + +/***/ }, +/* 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. + + module.exports = Stream; + + var EE = __webpack_require__(3).EventEmitter; + var inherits = __webpack_require__(81); + + 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); + + // 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); + + 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; + }; + + +/***/ }, +/* 81 */ +/***/ function(module, exports) { + + 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 + } + } + + +/***/ }, +/* 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); + } + + /* 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))) + +/***/ }, +/* 84 */ +/***/ function(module, exports) { + + module.exports = Array.isArray || function (arr) { + return Object.prototype.toString.call(arr) == '[object Array]'; + }; + + +/***/ }, +/* 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. + + // NOTE: These type checking functions intentionally don't use `instanceof` + // because it is fragile and can be easily faked with `Object.create()`. + + function isArray(arg) { + if (Array.isArray) { + return Array.isArray(arg); + } + return objectToString(arg) === '[object Array]'; + } + 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 objectToString(re) === '[object RegExp]'; + } + exports.isRegExp = isRegExp; + + function isObject(arg) { + return typeof arg === 'object' && arg !== null; + } + exports.isObject = isObject; + + function isDate(d) { + return objectToString(d) === '[object Date]'; + } + exports.isDate = isDate; + + function isError(e) { + return (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 = Buffer.isBuffer; + + function objectToString(o) { + return Object.prototype.toString.call(o); + } + + /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(58).Buffer)) + +/***/ }, +/* 86 */ +/***/ function(module, exports) { + + /* (ignored) */ + +/***/ }, +/* 87 */ +/***/ 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. + + // 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. + + module.exports = Duplex; + + /**/ + 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))) + +/***/ }, +/* 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. + + // 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__(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. + + var Buffer = __webpack_require__(58).Buffer; + + 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; + } + } + + + 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; + } + + +/***/ }, +/* 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); + } + + +/***/ }, +/* 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); + }; + + +/***/ }, +/* 92 */ +/***/ function(module, exports, __webpack_require__) { + + module.exports = __webpack_require__(88) + + +/***/ }, +/* 93 */ +/***/ function(module, exports, __webpack_require__) { + + module.exports = __webpack_require__(87) + + +/***/ }, +/* 94 */ +/***/ function(module, exports, __webpack_require__) { + + module.exports = __webpack_require__(90) + + +/***/ }, +/* 95 */ +/***/ function(module, exports, __webpack_require__) { + + module.exports = __webpack_require__(91) + + +/***/ }, +/* 96 */ +/***/ function(module, exports, __webpack_require__) { + + var Stream = __webpack_require__(80); + var util = __webpack_require__(75); + + var Response = module.exports = function (res) { + this.offset = 0; + this.readable = true; + }; + + 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]'; + }; + + +/***/ }, +/* 97 */ +/***/ function(module, exports, __webpack_require__) { + + ;(function () { + + var object = true ? exports : this; // #8: web workers + var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='; + + 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; + }); + + // 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; + }); + + }()); + + +/***/ }, +/* 98 */ +/***/ function(module, exports, __webpack_require__) { + + var http = __webpack_require__(78); + + var https = module.exports; + + for (var key in http) { + if (http.hasOwnProperty(key)) https[key] = http[key]; + }; + + https.request = function (params, cb) { + if (!params) params = {}; + params.scheme = 'https'; + return http.request.call(this, params, cb); + } + + +/***/ }, +/* 99 */ +/***/ function(module, exports, __webpack_require__) { + + /* WEBPACK VAR INJECTION */(function(Buffer) {var rng = __webpack_require__(100) + + function error () { + var m = [].slice.call(arguments).join(' ') + throw new Error([ + m, + 'we accept pull requests', + 'http://github.com/dominictarr/crypto-browserify' + ].join('\n')) + } + + exports.createHash = __webpack_require__(102) + + exports.createHmac = __webpack_require__(111) + + 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 each(a, f) { + for(var i in a) + f(a[i], i) + } + + exports.getHashes = function () { + return ['sha1', 'sha256', 'sha512', 'md5', 'rmd160'] + } + + var p = __webpack_require__(112)(exports) + exports.pbkdf2 = p.pbkdf2 + exports.pbkdf2Sync = p.pbkdf2Sync + + + // 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') + } + }) + + /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(58).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 */}.call(exports, (function() { return this; }()), __webpack_require__(58).Buffer)) + +/***/ }, +/* 101 */ +/***/ function(module, exports) { + + /* (ignored) */ + +/***/ }, +/* 102 */ +/***/ function(module, exports, __webpack_require__) { + + /* WEBPACK VAR INJECTION */(function(Buffer) {var createHash = __webpack_require__(103) + + var md5 = toConstructor(__webpack_require__(108)) + var rmd160 = toConstructor(__webpack_require__(110)) + + 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 Buffer = __webpack_require__(58).Buffer + var Hash = __webpack_require__(104)(Buffer) + + exports.sha1 = __webpack_require__(105)(Buffer, Hash) + exports.sha256 = __webpack_require__(106)(Buffer, Hash) + exports.sha512 = __webpack_require__(107)(Buffer, Hash) + + +/***/ }, +/* 104 */ +/***/ function(module, exports) { + + module.exports = function (Buffer) { + + //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 + } + + Hash.prototype.init = function () { + this._s = 0 + this._len = 0 + } + + 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 + } + + +/***/ }, +/* 105 */ +/***/ function(module, exports, __webpack_require__) { + + /* + * 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. + */ + + var inherits = __webpack_require__(75).inherits + + module.exports = function (Buffer, Hash) { + + var A = 0|0 + var B = 4|0 + var C = 8|0 + var D = 12|0 + var E = 16|0 + + var W = new (typeof Int32Array === 'undefined' ? Array : Int32Array)(80) + + var POOL = [] + + function Sha1 () { + if(POOL.length) + return POOL.pop().init() + + 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 + } + + +/***/ }, +/* 106 */ +/***/ function(module, exports, __webpack_require__) { + + + /** + * 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 + * + */ + + var inherits = __webpack_require__(75).inherits + + 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 + ] + + var W = new Array(64) + + function Sha256() { + this.init() + + this._w = W //new Array(64) + + Hash.call(this, 16*4, 14*4) + } + + inherits(Sha256, Hash) + + Sha256.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._len = this._s = 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 + + } + + +/***/ }, +/* 107 */ +/***/ function(module, exports, __webpack_require__) { + + var inherits = __webpack_require__(75).inherits + + 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 + + } + + +/***/ }, +/* 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. + */ + + var helpers = __webpack_require__(109); + + /* + * 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; + + 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); + }; + + +/***/ }, +/* 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; + + 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)) + +/***/ }, +/* 110 */ +/***/ function(module, exports, __webpack_require__) { + + /* WEBPACK VAR INJECTION */(function(Buffer) { + module.exports = ripemd160 + + + + /* + 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)) + +/***/ }, +/* 111 */ +/***/ function(module, exports, __webpack_require__) { + + /* 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)) + +/***/ }, +/* 112 */ +/***/ function(module, exports, __webpack_require__) { + + var pbkdf2Export = __webpack_require__(113) + + module.exports = function (crypto, exports) { + exports = exports || {} + + var exported = pbkdf2Export(crypto) + + exports.pbkdf2 = exported.pbkdf2 + exports.pbkdf2Sync = exported.pbkdf2Sync + + return exports + } + + +/***/ }, +/* 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 + } + + if ('function' !== typeof callback) + throw new Error('No callback provided to pbkdf2') + + setTimeout(function() { + var result + + try { + result = pbkdf2Sync(password, salt, iterations, keylen, digest) + } catch (e) { + return callback(e) + } + + callback(undefined, result) + }) + } + + function pbkdf2Sync(password, salt, iterations, keylen, digest) { + if ('number' !== typeof iterations) + throw new TypeError('Iterations not a number') + + if (iterations < 0) + throw new TypeError('Bad iterations') + + if ('number' !== typeof keylen) + throw new TypeError('Key length not a number') + + if (keylen < 0) + throw new TypeError('Bad key length') + + digest = digest || 'sha1' + + if (!Buffer.isBuffer(password)) password = new Buffer(password) + if (!Buffer.isBuffer(salt)) salt = new Buffer(salt) + + 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) + + for (var i = 1; i <= l; i++) { + block1.writeUInt32BE(i, salt.length) + + var U = crypto.createHmac(digest, password).update(block1).digest() + + if (!hLen) { + hLen = U.length + T = new Buffer(hLen) + l = Math.ceil(keylen / hLen) + r = keylen - (l - 1) * hLen + + if (keylen > (Math.pow(2, 32) - 1) * hLen) + throw new TypeError('keylen exceeds maximum length') + } + + U.copy(T, 0, 0, hLen) + + for (var j = 1; j < iterations; j++) { + U = crypto.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 + } + + return { + pbkdf2: pbkdf2, + pbkdf2Sync: pbkdf2Sync + } + } + + /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(58).Buffer)) + +/***/ }, +/* 114 */ +/***/ function(module, exports) { + + '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; + + +/***/ }, +/* 115 */ +/***/ function(module, exports, __webpack_require__) { + + /*! + * Copyright(c) 2011 Einar Otto Stangvik + * MIT Licensed + */ + + var fs = __webpack_require__(62); + + 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; + + +/***/ }, +/* 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 + */ + + 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); + + /** + * 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__(58).Buffer)) + +/***/ }, +/* 117 */ +/***/ function(module, exports) { + + /*! + * ws: a node.js websocket client + * Copyright(c) 2011 Einar Otto Stangvik + * 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', + }; + +/***/ }, +/* 118 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + /*! + * ws: a node.js websocket client + * Copyright(c) 2011 Einar Otto Stangvik + * MIT Licensed + */ + + try { + module.exports = __webpack_require__(119); + } catch (e) { + module.exports = __webpack_require__(124); + } + + +/***/ }, +/* 119 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + try { + module.exports = __webpack_require__(120)('bufferutil'); + } catch (e) { + module.exports = __webpack_require__(123); + } + + +/***/ }, +/* 120 */ +/***/ function(module, exports, __webpack_require__) { + + /* WEBPACK VAR INJECTION */(function(process, __filename) { + /** + * Module dependencies. + */ + + 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' ] + ] + } + + /** + * 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 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=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) { + + 'use strict'; + + /*! + * bufferutil: WebSocket buffer utils + * Copyright(c) 2015 Einar Otto Stangvik + * MIT Licensed + */ + + module.exports.BufferUtil = { + merge: function(mergedBuffer, buffers) { + for (var i = 0, offset = 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) + , i = 0 + , num; + + for (; i < length - 3; i += 4) { + 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]; + } + }, + + unmask: function(data, mask) { + var maskNum = mask.readUInt32LE(0, true) + , length = data.length + , i = 0 + , num; + + for (; i < length - 3; i += 4) { + 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]; + } + } + }; + + +/***/ }, +/* 124 */ +/***/ function(module, exports) { + + /*! + * 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:; + } + } + } + + +/***/ }, +/* 125 */ +/***/ function(module, exports, __webpack_require__) { + + /* WEBPACK VAR INJECTION */(function(Buffer) { + var zlib = __webpack_require__(126); + + 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__(58).Buffer)) + +/***/ }, +/* 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))) + +/***/ }, +/* 127 */ +/***/ function(module, exports, __webpack_require__) { + + module.exports = __webpack_require__(128) + + +/***/ }, +/* 128 */ +/***/ 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__(129); + + /**/ + 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); + } + + +/***/ }, +/* 129 */ +/***/ 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. + + // 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. + + module.exports = Duplex; + + /**/ + 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__(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__) { + + /* 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__(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) { + + module.exports = Array.isArray || function (arr) { + return Object.prototype.toString.call(arr) == '[object Array]'; + }; + + +/***/ }, +/* 132 */ +/***/ function(module, exports) { + + /* (ignored) */ + +/***/ }, +/* 133 */ +/***/ 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. + + // 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); + + 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__(2), __webpack_require__(58).Buffer)) + +/***/ }, +/* 135 */ +/***/ function(module, exports) { + + 'use strict'; + + 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) */ + }; + + +/***/ }, +/* 136 */ +/***/ function(module, exports) { + + 'use strict'; + + + 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; + } + + module.exports = ZStream; + + +/***/ }, +/* 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; + */ + + +/***/ }, +/* 138 */ +/***/ function(module, exports) { + + 'use strict'; + + + var TYPED_OK = (typeof Uint8Array !== 'undefined') && + (typeof Uint16Array !== 'undefined') && + (typeof Int32Array !== 'undefined'); + + + 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; } + + 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; + + +/***/ }, +/* 140 */ +/***/ function(module, exports) { + + 'use strict'; + + // 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. + + function adler32(adler, buf, len, pos) { + var s1 = (adler & 0xffff) |0, + s2 = ((adler >>> 16) & 0xffff) |0, + n = 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; + + do { + s1 = (s1 + buf[pos++]) |0; + s2 = (s2 + s1) |0; + } while (--n); + + s1 %= 65521; + s2 %= 65521; + } + + return (s1 | (s2 << 16)) |0; + } + + + module.exports = adler32; + + +/***/ }, +/* 141 */ +/***/ function(module, exports) { + + 'use strict'; + + // Note: we can't get significant speed boost here. + // So write code to minimize size - no pregenerated tables + // and array tools dependencies. + + + // Use ordinary array, since untyped makes no boost here + function makeTable() { + var c, table = []; + + 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 table; + } + + // Create table on load. Just 255 signed longs. Not a problem. + var crcTable = makeTable(); + + + function crc32(crc, buf, len, pos) { + var t = crcTable, + end = pos + len; + + crc ^= -1; + + for (var i = pos; i < end; i++) { + crc = (crc >>> 8) ^ t[(crc ^ buf[i]) & 0xFF]; + } + + return (crc ^ (-1)); // >>> 0; + } + + + module.exports = crc32; + + +/***/ }, +/* 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; + */ + + +/***/ }, +/* 143 */ +/***/ function(module, exports) { + + 'use strict'; + + // 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; + }; + + +/***/ }, +/* 144 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + + var utils = __webpack_require__(138); + + 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; + }; + + +/***/ }, +/* 145 */ +/***/ function(module, exports) { + + 'use strict'; + + + 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 + }; + + +/***/ }, +/* 146 */ +/***/ function(module, exports, __webpack_require__) { + + /* WEBPACK VAR INJECTION */(function(global) {'use strict'; + + // compare and isBuffer taken from https://github.com/feross/buffer/blob/680e9e5e488f22aac27599a57dc844a6315928dd/index.js + // original notice: + + /*! + * The buffer module from node.js, for the browser. + * + * @author Feross Aboukhadijeh + * @license MIT + */ + function compare(a, b) { + 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; + } + 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 + */ + + 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); + + /** + * HyBi Receiver implementation + */ + + 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={}; + } + + + // 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; + }); + + // 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; + + 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 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); + } + }; + + /** + * 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__(58).Buffer)) + +/***/ }, +/* 148 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + /*! + * ws: a node.js websocket client + * Copyright(c) 2011 Einar Otto Stangvik + * MIT Licensed + */ + + try { + module.exports = __webpack_require__(149); + } catch (e) { + module.exports = __webpack_require__(151); + } + + +/***/ }, +/* 149 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + try { + module.exports = __webpack_require__(120)('validation'); + } catch (e) { + module.exports = __webpack_require__(150); + } + + +/***/ }, +/* 150 */ +/***/ function(module, exports) { + + 'use strict'; + + /*! + * UTF-8 validate: UTF-8 validation for WebSockets. + * Copyright(c) 2015 Einar Otto Stangvik + * MIT Licensed + */ + + module.exports.Validation = { + isValidUTF8: function(buffer) { + return true; + } + }; + + +/***/ }, +/* 151 */ +/***/ function(module, exports) { + + /*! + * ws: a node.js websocket client + * Copyright(c) 2011 Einar Otto Stangvik + * MIT Licensed + */ + + exports.Validation = { + isValidUTF8: function(buffer) { + return true; + } + }; + + +/***/ }, +/* 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 util = __webpack_require__(75); + + 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 + */ + + var events = __webpack_require__(3) + , util = __webpack_require__(75) + , EventEmitter = events.EventEmitter; + + /** + * 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)) + +/***/ }, +/* 154 */ +/***/ 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); + + /** + * 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); + + /** + * 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(', '); + } + + +/***/ }, +/* 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)) + +/***/ }, +/* 157 */ +/***/ function(module, exports) { + + // todo + + +/***/ }, +/* 158 */ +/***/ 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; + + +/***/ }, +/* 159 */ +/***/ function(module, exports, __webpack_require__) { + + /* 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; + + /** + * 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__(58).Buffer)) + +/***/ }, +/* 160 */ +/***/ function(module, exports) { + + 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') + } + } + + + +/***/ }, +/* 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; + + +/***/ }, +/* 162 */ +/***/ function(module, exports, __webpack_require__) { + + exports.fetch = () => __webpack_require__(163); + + +/***/ }, +/* 163 */ +/***/ function(module, exports, __webpack_require__) { + + const ConverterEngine = __webpack_require__(164); + const ChildProcess = __webpack_require__(62); + 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; + + +/***/ }, +/* 164 */ +/***/ 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; + + +/***/ }, +/* 165 */ +/***/ function(module, exports, __webpack_require__) { + + const list = [ + __webpack_require__(166), + __webpack_require__(168), + ]; + + 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.'); + }; + + +/***/ }, +/* 166 */ +/***/ function(module, exports, __webpack_require__) { + + const OpusEngine = __webpack_require__(167); + + 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; + + +/***/ }, +/* 167 */ +/***/ function(module, exports) { + + class BaseOpus { + constructor(player) { + this.player = player; + } + + encode(buffer) { + return buffer; + } + + decode(buffer) { + return buffer; + } + } + + module.exports = BaseOpus; + + +/***/ }, +/* 168 */ +/***/ function(module, exports, __webpack_require__) { + + const OpusEngine = __webpack_require__(167); + + let OpusScript; + + class NodeOpusEngine extends OpusEngine { + constructor(player) { + super(player); + try { + OpusScript = __webpack_require__(169); + } 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; + + +/***/ }, +/* 169 */ +/***/ function(module, exports, __webpack_require__) { + + /* WEBPACK VAR INJECTION */(function(Buffer) {"use strict"; + + var opusscript_native = __webpack_require__(170); + + 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__(58).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} + + // 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__(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); + + 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__(58).Buffer)) + +/***/ }, +/* 172 */ +/***/ function(module, exports, __webpack_require__) { + + (function(nacl) { + '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 gf = function(init) { + var i, r = new Float64Array(16); + if (init) for (i = 0; i < init.length; i++) r[i] = init[i]; + return r; + }; + + // Pluggable, initialized in high-level API below. + var randombytes = function(/* x, n */) { throw new Error('no PRNG'); }; + + 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 || {})); + + +/***/ }, +/* 173 */ +/***/ function(module, exports) { + + /* (ignored) */ + +/***/ }, +/* 174 */ +/***/ function(module, exports, __webpack_require__) { + + /* WEBPACK VAR INJECTION */(function(Buffer) {const EventEmitter = __webpack_require__(3).EventEmitter; + const NaCl = __webpack_require__(172); + const Readable = __webpack_require__(175); + + 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__(58).Buffer)) + +/***/ }, +/* 175 */ +/***/ function(module, exports, __webpack_require__) { + + const Readable = __webpack_require__(80).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; + + +/***/ }, +/* 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); + + /** + * 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; + + +/***/ }, +/* 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 { + 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; + + +/***/ }, +/* 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; + + +/***/ }, +/* 180 */ +/***/ function(module, exports) { + + class AbstractHandler { + constructor(packetManager) { + this.packetManager = packetManager; + } + + handle(packet) { + return packet; + } + } + + module.exports = AbstractHandler; + + +/***/ }, +/* 181 */ +/***/ function(module, exports, __webpack_require__) { + + const AbstractHandler = __webpack_require__(180); + + class ChannelCreateHandler extends AbstractHandler { + handle(packet) { + const client = this.packetManager.client; + const data = packet.d; + client.actions.ChannelCreate.handle(data); + } + } + + /** + * Emitted whenever a channel is created. + * @event Client#channelCreate + * @param {Channel} channel The channel that was created + */ + + module.exports = ChannelCreateHandler; + + +/***/ }, +/* 182 */ +/***/ function(module, exports, __webpack_require__) { + + const AbstractHandler = __webpack_require__(180); + + const Constants = __webpack_require__(5); + + 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); + } + } + + /** + * Emitted whenever a channel is deleted. + * @event Client#channelDelete + * @param {Channel} channel The channel that was deleted + */ + + module.exports = ChannelDeleteHandler; + + +/***/ }, +/* 183 */ +/***/ function(module, exports, __webpack_require__) { + + const AbstractHandler = __webpack_require__(180); + const Constants = __webpack_require__(5); + + /* + { t: 'CHANNEL_PINS_UPDATE', + s: 666, + op: 0, + d: + { last_pin_timestamp: '2016-08-28T17:37:13.171774+00:00', + channel_id: '314866471639044027' } } + */ + + 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); + } + } + + /** + * 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 + */ + + module.exports = ChannelPinsUpdate; + + +/***/ }, +/* 184 */ +/***/ function(module, exports, __webpack_require__) { + + const AbstractHandler = __webpack_require__(180); + + class ChannelUpdateHandler extends AbstractHandler { + handle(packet) { + const client = this.packetManager.client; + const data = packet.d; + client.actions.ChannelUpdate.handle(data); + } + } + + module.exports = ChannelUpdateHandler; + + +/***/ }, +/* 185 */ +/***/ function(module, exports, __webpack_require__) { + + // ##untested handler## + + const AbstractHandler = __webpack_require__(180); + const Constants = __webpack_require__(5); + + 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); + } + } + + /** + * 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 + */ + + module.exports = GuildBanAddHandler; + + +/***/ }, +/* 186 */ +/***/ function(module, exports, __webpack_require__) { + + // ##untested handler## + + const AbstractHandler = __webpack_require__(180); + + class GuildBanRemoveHandler extends AbstractHandler { + handle(packet) { + const client = this.packetManager.client; + const data = packet.d; + client.actions.GuildBanRemove.handle(data); + } + } + + /** + * 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 + */ + + module.exports = GuildBanRemoveHandler; + + +/***/ }, +/* 187 */ +/***/ function(module, exports, __webpack_require__) { + + const AbstractHandler = __webpack_require__(180); + + class GuildCreateHandler extends AbstractHandler { + handle(packet) { + const client = this.packetManager.client; + const data = packet.d; + + 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); + } + } + } + + module.exports = GuildCreateHandler; + + +/***/ }, +/* 188 */ +/***/ function(module, exports, __webpack_require__) { + + const AbstractHandler = __webpack_require__(180); + const Constants = __webpack_require__(5); + + 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); + } + } + + /** + * Emitted whenever a guild is deleted/left. + * @event Client#guildDelete + * @param {Guild} guild The guild that was deleted + */ + + module.exports = GuildDeleteHandler; + + +/***/ }, +/* 189 */ +/***/ function(module, exports, __webpack_require__) { + + 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; + + +/***/ }, +/* 190 */ +/***/ function(module, exports, __webpack_require__) { + + // ##untested handler## + + const AbstractHandler = __webpack_require__(180); + + 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); + } + } + } + + module.exports = GuildMemberAddHandler; + + +/***/ }, +/* 191 */ +/***/ function(module, exports, __webpack_require__) { + + // ##untested handler## + + const AbstractHandler = __webpack_require__(180); + + class GuildMemberRemoveHandler extends AbstractHandler { + handle(packet) { + const client = this.packetManager.client; + const data = packet.d; + client.actions.GuildMemberRemove.handle(data); + } + } + + module.exports = GuildMemberRemoveHandler; + + +/***/ }, +/* 192 */ +/***/ function(module, exports, __webpack_require__) { + + // ##untested handler## + + const AbstractHandler = __webpack_require__(180); + + class GuildMemberUpdateHandler 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) guild._updateMember(member, data); + } + } + } + + module.exports = GuildMemberUpdateHandler; + + +/***/ }, +/* 193 */ +/***/ function(module, exports, __webpack_require__) { + + // ##untested## + + const AbstractHandler = __webpack_require__(180); + const Constants = __webpack_require__(5); + + 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 = []; + + if (guild) { + for (const member of data.members) members.push(guild._addMember(member, false)); + } + + guild._checkChunks(); + client.emit(Constants.Events.GUILD_MEMBERS_CHUNK, members); + } + } + + /** + * 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 + */ + + module.exports = GuildMembersChunkHandler; + + +/***/ }, +/* 194 */ +/***/ function(module, exports, __webpack_require__) { + + const AbstractHandler = __webpack_require__(180); + + class GuildRoleCreateHandler extends AbstractHandler { + handle(packet) { + const client = this.packetManager.client; + const data = packet.d; + client.actions.GuildRoleCreate.handle(data); + } + } + + module.exports = GuildRoleCreateHandler; + + +/***/ }, +/* 195 */ +/***/ function(module, exports, __webpack_require__) { + + const AbstractHandler = __webpack_require__(180); + + class GuildRoleDeleteHandler extends AbstractHandler { + handle(packet) { + const client = this.packetManager.client; + const data = packet.d; + client.actions.GuildRoleDelete.handle(data); + } + } + + module.exports = GuildRoleDeleteHandler; + + +/***/ }, +/* 196 */ +/***/ function(module, exports, __webpack_require__) { + + const AbstractHandler = __webpack_require__(180); + + class GuildRoleUpdateHandler extends AbstractHandler { + handle(packet) { + const client = this.packetManager.client; + const data = packet.d; + client.actions.GuildRoleUpdate.handle(data); + } + } + + module.exports = GuildRoleUpdateHandler; + + +/***/ }, +/* 197 */ +/***/ function(module, exports, __webpack_require__) { + + const AbstractHandler = __webpack_require__(180); + + class GuildSyncHandler extends AbstractHandler { + handle(packet) { + const client = this.packetManager.client; + const data = packet.d; + client.actions.GuildSync.handle(data); + } + } + + module.exports = GuildSyncHandler; + + +/***/ }, +/* 198 */ +/***/ function(module, exports, __webpack_require__) { + + const AbstractHandler = __webpack_require__(180); + + class GuildUpdateHandler extends AbstractHandler { + handle(packet) { + const client = this.packetManager.client; + const data = packet.d; + client.actions.GuildUpdate.handle(data); + } + } + + module.exports = GuildUpdateHandler; + + +/***/ }, +/* 199 */ +/***/ function(module, exports, __webpack_require__) { + + 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; + + +/***/ }, +/* 200 */ +/***/ function(module, exports, __webpack_require__) { + + 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); + } + } + + /** + * 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; + + +/***/ }, +/* 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; + + +/***/ }, +/* 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; + + +/***/ }, +/* 204 */ +/***/ function(module, exports, __webpack_require__) { + + const AbstractHandler = __webpack_require__(180); + + class MessageReactionRemoveAll extends AbstractHandler { + handle(packet) { + const client = this.packetManager.client; + const data = packet.d; + client.actions.MessageReactionRemoveAll.handle(data); + } + } + + module.exports = MessageReactionRemoveAll; + + +/***/ }, +/* 205 */ +/***/ function(module, exports, __webpack_require__) { + + const AbstractHandler = __webpack_require__(180); + + class MessageUpdateHandler extends AbstractHandler { + handle(packet) { + const client = this.packetManager.client; + const data = packet.d; + client.actions.MessageUpdate.handle(data); + } + } + + module.exports = MessageUpdateHandler; + + +/***/ }, +/* 206 */ +/***/ function(module, exports, __webpack_require__) { + + const AbstractHandler = __webpack_require__(180); + const Constants = __webpack_require__(5); + const cloneObject = __webpack_require__(46); + + 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); + + // step 1 + if (!user) { + if (data.user.username) { + user = client.dataManager.newUser(data.user); + } else { + return; + } + } + + 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); + } + } + } + } + + /** + * 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 + */ + + /** + * Emitted whenever a member becomes available in a large guild + * @event Client#guildMemberAvailable + * @param {GuildMember} member The member that became available + */ + + module.exports = PresenceUpdateHandler; + + +/***/ }, +/* 207 */ +/***/ function(module, exports, __webpack_require__) { + + const AbstractHandler = __webpack_require__(180); + + const ClientUser = __webpack_require__(208); + + class ReadyHandler extends AbstractHandler { + handle(packet) { + const client = this.packetManager.client; + const data = packet.d; + + const clientUser = new ClientUser(client, data.user); + client.user = clientUser; + client.readyAt = new Date(); + client.users.set(clientUser.id, clientUser); + + for (const guild of data.guilds) client.dataManager.newGuild(guild); + for (const privateDM of data.private_channels) client.dataManager.newChannel(privateDM); + + 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); + } + } + + data.presences = data.presences || []; + for (const presence of data.presences) { + client.dataManager.newUser(presence.user); + client._setPresence(presence.user.id, presence); + } + + if (data.notes) { + for (const user in data.notes) { + let note = data.notes[user]; + if (!note.length) note = null; + + client.user.notes.set(user, note); + } + } + + if (!client.user.bot && client.options.sync) client.setInterval(client.syncGuilds.bind(client), 30000); + client.once('ready', client.syncGuilds.bind(client)); + + 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); + + this.packetManager.ws.sessionID = data.session_id; + this.packetManager.ws.checkIfReady(); + } + } + + module.exports = ReadyHandler; + + +/***/ }, +/* 208 */ +/***/ function(module, exports, __webpack_require__) { + + const User = __webpack_require__(13); + const Collection = __webpack_require__(10); + + /** + * 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; + + +/***/ }, +/* 209 */ +/***/ function(module, exports, __webpack_require__) { + + const AbstractHandler = __webpack_require__(180); + + 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; + + +/***/ }, +/* 210 */ +/***/ function(module, exports, __webpack_require__) { + + const AbstractHandler = __webpack_require__(180); + + 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; + + +/***/ }, +/* 211 */ +/***/ function(module, exports, __webpack_require__) { + + const AbstractHandler = __webpack_require__(180); + const Constants = __webpack_require__(5); + + 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); + } + } + } + } + + 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; + + +/***/ }, +/* 212 */ +/***/ function(module, exports, __webpack_require__) { + + const AbstractHandler = __webpack_require__(180); + + class UserNoteUpdateHandler extends AbstractHandler { + handle(packet) { + const client = this.packetManager.client; + const data = packet.d; + + client.actions.UserNoteUpdate.handle(data); + } + } + + module.exports = UserNoteUpdateHandler; + + +/***/ }, +/* 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; + + +/***/ }, +/* 214 */ +/***/ function(module, exports, __webpack_require__) { + + const AbstractHandler = __webpack_require__(180); + + /* + { + "token": "my_token", + "guild_id": "41771983423143937", + "endpoint": "smart.loyal.discord.gg" + } + */ + + class VoiceServerUpdate extends AbstractHandler { + handle(packet) { + const client = this.packetManager.client; + const data = packet.d; + client.emit('self.voiceServer', data); + } + } + + module.exports = VoiceServerUpdate; + + +/***/ }, +/* 215 */ +/***/ function(module, exports, __webpack_require__) { + + const AbstractHandler = __webpack_require__(180); + + 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; + + +/***/ }, +/* 216 */ +/***/ function(module, exports, __webpack_require__) { + + class ActionsManager { + constructor(client) { + this.client = client; + + 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 = __webpack_require__(217)(`./${name}`); + this[name] = new Action(this.client); + } + } + + module.exports = ActionsManager; + + +/***/ }, +/* 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; + + +/***/ }, +/* 218 */ +/***/ function(module, exports) { + + /* + + 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; + } + } + + module.exports = GenericAction; + + +/***/ }, +/* 219 */ +/***/ function(module, exports, __webpack_require__) { + + const Action = __webpack_require__(218); + + class ChannelCreateAction extends Action { + handle(data) { + const client = this.client; + const channel = client.dataManager.newChannel(data); + return { + channel, + }; + } + } + + module.exports = ChannelCreateAction; + + +/***/ }, +/* 220 */ +/***/ function(module, exports, __webpack_require__) { + + const Action = __webpack_require__(218); + + class ChannelDeleteAction extends Action { + constructor(client) { + super(client); + this.deleted = new Map(); + } + + handle(data) { + const client = this.client; + + 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; + } + + return { + channel, + }; + } + + scheduleForDeletion(id) { + this.client.setTimeout(() => this.deleted.delete(id), this.client.options.restWsBridgeTimeout); + } + } + + module.exports = ChannelDeleteAction; + + +/***/ }, +/* 221 */ +/***/ function(module, exports, __webpack_require__) { + + const Action = __webpack_require__(218); + const Constants = __webpack_require__(5); + const cloneObject = __webpack_require__(46); + + 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; + + +/***/ }, +/* 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; + + +/***/ }, +/* 223 */ +/***/ function(module, exports, __webpack_require__) { + + const Action = __webpack_require__(218); + const Constants = __webpack_require__(5); + + class GuildDeleteAction extends Action { + constructor(client) { + super(client); + this.deleted = new Map(); + } + + handle(data) { + const client = this.client; + + 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); + + // stops the GuildDelete packet thinking a guild was actually deleted, + // handles emitting of event itself + return { + guild: null, + }; + } + + // 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; + } + + return { + guild, + }; + } + + scheduleForDeletion(id) { + this.client.setTimeout(() => this.deleted.delete(id), this.client.options.restWsBridgeTimeout); + } + } + + /** + * 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; + + +/***/ }, +/* 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; + + +/***/ }, +/* 225 */ +/***/ function(module, exports, __webpack_require__) { + + const Action = __webpack_require__(218); + + 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; + + +/***/ }, +/* 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; + + +/***/ }, +/* 227 */ +/***/ function(module, exports, __webpack_require__) { + + const Action = __webpack_require__(218); + + class GuildMemberGetAction extends Action { + handle(guild, data) { + const member = guild._addMember(data, false); + return { + member, + }; + } + } + + module.exports = GuildMemberGetAction; + + +/***/ }, +/* 228 */ +/***/ function(module, exports, __webpack_require__) { + + const Action = __webpack_require__(218); + const Constants = __webpack_require__(5); + + class GuildMemberRemoveAction extends Action { + constructor(client) { + super(client); + this.deleted = new Map(); + } + + handle(data) { + const client = this.client; + + 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 { + 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; + + +/***/ }, +/* 229 */ +/***/ function(module, exports, __webpack_require__) { + + const Action = __webpack_require__(218); + const Constants = __webpack_require__(5); + const Role = __webpack_require__(26); + + class GuildRoleCreate extends Action { + handle(data) { + const client = this.client; + + 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, + }; + } + + return { + role: null, + }; + } + } + + /** + * Emitted whenever a role is created. + * @event Client#roleCreate + * @param {Role} role The role that was created. + */ + + module.exports = GuildRoleCreate; + + +/***/ }, +/* 230 */ +/***/ function(module, exports, __webpack_require__) { + + const Action = __webpack_require__(218); + const Constants = __webpack_require__(5); + + class GuildRoleDeleteAction extends Action { + constructor(client) { + super(client); + this.deleted = new Map(); + } + + 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; + + +/***/ }, +/* 231 */ +/***/ function(module, exports, __webpack_require__) { + + const Action = __webpack_require__(218); + const Constants = __webpack_require__(5); + const cloneObject = __webpack_require__(46); + + 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; + + +/***/ }, +/* 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; + + +/***/ }, +/* 233 */ +/***/ function(module, exports, __webpack_require__) { + + 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; + + +/***/ }, +/* 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; + + +/***/ }, +/* 235 */ +/***/ function(module, exports, __webpack_require__) { + + const Action = __webpack_require__(218); + const Message = __webpack_require__(16); + + class MessageCreateAction extends Action { + handle(data) { + const client = this.client; + + 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, + }; + } + } + + return { + message: null, + }; + } + } + + module.exports = MessageCreateAction; + + +/***/ }, +/* 236 */ +/***/ function(module, exports, __webpack_require__) { + + const Action = __webpack_require__(218); + + class MessageDeleteAction extends Action { + constructor(client) { + super(client); + this.deleted = new Map(); + } + + handle(data) { + const client = this.client; + + 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; + + +/***/ }, +/* 237 */ +/***/ function(module, exports, __webpack_require__) { + + 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; + + +/***/ }, +/* 238 */ +/***/ function(module, exports, __webpack_require__) { + + 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; + + +/***/ }, +/* 239 */ +/***/ function(module, exports, __webpack_require__) { + + const Action = __webpack_require__(218); + const Constants = __webpack_require__(5); + + /* + { 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; + + +/***/ }, +/* 240 */ +/***/ function(module, exports, __webpack_require__) { + + const Action = __webpack_require__(218); + const Constants = __webpack_require__(5); + + class MessageReactionRemoveAll extends Action { + handle(data) { + 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; + + message._clearReactions(); + this.client.emit(Constants.Events.MESSAGE_REACTION_REMOVE_ALL, message); + + return { + message, + }; + } + } + /** + * Emitted whenever all reactions are removed from a message. + * @event Client#messageReactionRemoveAll + * @param {MessageReaction} messageReaction The reaction object. + */ + module.exports = MessageReactionRemoveAll; + + +/***/ }, +/* 241 */ +/***/ function(module, exports, __webpack_require__) { + + const Action = __webpack_require__(218); + const Constants = __webpack_require__(5); + const cloneObject = __webpack_require__(46); + + 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; + + +/***/ }, +/* 242 */ +/***/ function(module, exports, __webpack_require__) { + + const Action = __webpack_require__(218); + + class UserGetAction extends Action { + handle(data) { + const client = this.client; + const user = client.dataManager.newUser(data); + return { + user, + }; + } + } + + module.exports = UserGetAction; + + +/***/ }, +/* 243 */ +/***/ function(module, exports, __webpack_require__) { + + const Action = __webpack_require__(218); + const Constants = __webpack_require__(5); + + class UserNoteUpdateAction extends Action { + handle(data) { + const client = this.client; + + const oldNote = client.user.notes.get(data.id); + const note = data.note.length ? data.note : null; + + client.user.notes.set(data.id, note); + + client.emit(Constants.Events.USER_NOTE_UPDATE, data.id, oldNote, note); + + return { + old: oldNote, + updated: note, + }; + } + } + + /** + * 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 = UserNoteUpdateAction; + + +/***/ }, +/* 244 */ +/***/ function(module, exports, __webpack_require__) { + + const Action = __webpack_require__(218); + const Constants = __webpack_require__(5); + const cloneObject = __webpack_require__(46); + + 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; + + +/***/ }, +/* 245 */ +/***/ function(module, exports, __webpack_require__) { + + /* WEBPACK VAR INJECTION */(function(process) {const makeError = __webpack_require__(246); + const makePlainError = __webpack_require__(247); + + /** + * 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)); + } + + /** + * ID of this shard + * @type {number} + * @readonly + */ + get id() { + return this.client.options.shardId; + } + + /** + * 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) { + + module.exports = function makeError(obj) { + const err = new Error(obj.message); + err.name = obj.name; + err.stack = obj.stack; + return err; + }; + + +/***/ }, +/* 247 */ +/***/ function(module, exports) { + + module.exports = function makePlainError(err) { + const obj = {}; + obj.name = err.name; + obj.message = err.message; + obj.stack = err.stack; + return obj; + }; + + +/***/ }, +/* 248 */ +/***/ function(module, exports, __webpack_require__) { + + const Webhook = __webpack_require__(31); + const RESTManager = __webpack_require__(7); + const ClientDataResolver = __webpack_require__(57); + const mergeDefault = __webpack_require__(4); + const Constants = __webpack_require__(5); + + /** + * 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; + + +/***/ }, +/* 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); + + /** + * 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__(2))) + +/***/ }, +/* 250 */ +/***/ function(module, exports, __webpack_require__) { + + /* 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); + + /** + * 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; + + /** + * 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); + }); + }); + }; + + +/***/ } +/******/ ]); \ No newline at end of file diff --git a/discord.indev.min.js b/discord.indev.min.js new file mode 100644 index 00000000..27b351cd --- /dev/null +++ b/discord.indev.min.js @@ -0,0 +1,138 @@ +!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:"^2.3.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||""} +${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||""} +${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||""} +${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);for(var v in w)c.prototype[v]=w[v];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){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(),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._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.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), +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